summaryrefslogtreecommitdiff
path: root/chromium/third_party/pdfium
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2017-07-12 14:07:37 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2017-07-17 10:29:26 +0000
commitec02ee4181c49b61fce1c8fb99292dbb8139cc90 (patch)
tree25cde714b2b71eb639d1cd53f5a22e9ba76e14ef /chromium/third_party/pdfium
parentbb09965444b5bb20b096a291445170876225268d (diff)
downloadqtwebengine-chromium-ec02ee4181c49b61fce1c8fb99292dbb8139cc90.tar.gz
BASELINE: Update Chromium to 59.0.3071.134
Change-Id: Id02ef6fb2204c5fd21668a1c3e6911c83b17585a Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'chromium/third_party/pdfium')
-rw-r--r--chromium/third_party/pdfium/.gn1
-rw-r--r--chromium/third_party/pdfium/BUILD.gn574
-rw-r--r--chromium/third_party/pdfium/DEPS67
-rw-r--r--chromium/third_party/pdfium/README.md22
-rw-r--r--chromium/third_party/pdfium/build_overrides/pdfium.gni16
-rw-r--r--chromium/third_party/pdfium/core/fdrm/crypto/fx_crypt.cpp126
-rw-r--r--chromium/third_party/pdfium/core/fdrm/crypto/fx_crypt.h7
-rw-r--r--chromium/third_party/pdfium/core/fdrm/crypto/fx_crypt_aes.cpp93
-rw-r--r--chromium/third_party/pdfium/core/fdrm/crypto/fx_crypt_sha.cpp634
-rw-r--r--chromium/third_party/pdfium/core/fdrm/crypto/fx_crypt_unittest.cpp17
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/cmaps/fpdf_cmaps.cpp14
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/edit/cpdf_creator.h13
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp44
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/edit/cpdf_pagecontentgenerator_unittest.cpp73
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/edit/fpdf_edit_create.cpp384
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/font/cpdf_cidfont.cpp77
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/font/cpdf_cidfont.h18
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/font/cpdf_font.cpp40
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/font/cpdf_font.h22
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/font/cpdf_fontencoding.cpp36
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/font/cpdf_fontencoding.h19
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/font/cpdf_simplefont.cpp17
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/font/cpdf_simplefont.h2
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/font/cpdf_truetypefont.cpp18
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/font/cpdf_type1font.cpp59
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/font/cpdf_type1font.h2
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/font/cpdf_type3char.cpp2
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/font/cpdf_type3char.h2
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/font/cpdf_type3font.cpp38
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/font/font_int.h31
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/font/fpdf_font.cpp24
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/font/fpdf_font_cid.cpp53
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/font/ttgsubtable.cpp16
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/page/cpdf_allstates.cpp19
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/page/cpdf_allstates.h8
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/page/cpdf_color.cpp24
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/page/cpdf_color.h8
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/page/cpdf_colorspace.cpp942
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/page/cpdf_colorspace.h49
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/page/cpdf_colorstate.cpp28
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/page/cpdf_colorstate.h14
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/page/cpdf_contentparser.cpp15
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/page/cpdf_contentparser.h5
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/page/cpdf_devicecs_unittest.cpp114
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/page/cpdf_docpagedata.cpp145
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/page/cpdf_docpagedata.h45
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/page/cpdf_generalstate.cpp23
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/page/cpdf_generalstate.h27
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/page/cpdf_image.cpp73
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/page/cpdf_image.h30
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/page/cpdf_imageobject.cpp44
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/page/cpdf_imageobject.h11
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/page/cpdf_meshstream.cpp33
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/page/cpdf_meshstream.h23
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/page/cpdf_page.cpp4
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/page/cpdf_page.h13
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/page/cpdf_pageobject.h8
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/page/cpdf_pageobjectholder.cpp8
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/page/cpdf_pageobjectlist.cpp4
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/page/cpdf_path.cpp9
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/page/cpdf_path.h4
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/page/cpdf_pathobject.cpp2
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/page/cpdf_psengine.h8
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/page/cpdf_streamcontentparser.cpp169
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/page/cpdf_streamcontentparser.h34
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/page/cpdf_streamparser.cpp16
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/page/cpdf_textobject.cpp66
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/page/cpdf_textobject.h14
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/page/cpdf_textstate.cpp44
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/page/cpdf_textstate.h46
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/page/cpdf_tilingpattern.cpp4
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/page/cpdf_tilingpattern.h8
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/page/fpdf_page_colors.cpp124
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/page/fpdf_page_func.cpp236
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/page/pageint.h119
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_array.cpp9
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_array.h4
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_array_unittest.cpp25
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_crypto_handler.cpp39
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_crypto_handler.h20
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_data_avail.cpp412
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_data_avail.h2
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_dictionary.cpp7
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_dictionary.h4
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_document.cpp50
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_document.h12
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_document_unittest.cpp59
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_hint_tables.cpp8
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_number.cpp6
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_number.h6
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_object.cpp2
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_object.h2
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_object_unittest.cpp35
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_parser.cpp67
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_parser.h12
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_parser_unittest.cpp2
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_reference.cpp2
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_reference.h2
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_security_handler.cpp56
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_security_handler.h3
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_stream.cpp20
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_stream_acc.cpp34
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_stream_acc.h15
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_syntax_parser.cpp42
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_syntax_parser.h4
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/parser/fpdf_parser_decode.cpp42
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/parser/fpdf_parser_decode.h4
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/parser/fpdf_parser_decode_embeddertest.cpp7
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/parser/fpdf_parser_decode_unittest.cpp6
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/parser/fpdf_parser_utility.cpp12
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/render/cpdf_charposlist.cpp18
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/render/cpdf_charposlist.h4
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/render/cpdf_devicebuffer.cpp24
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/render/cpdf_devicebuffer.h4
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/render/cpdf_dibsource.cpp307
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/render/cpdf_dibsource.h22
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/render/cpdf_dibtransferfunc.cpp3
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/render/cpdf_dibtransferfunc.h9
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/render/cpdf_docrenderdata.cpp84
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/render/cpdf_docrenderdata.h21
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/render/cpdf_imagecacheentry.cpp66
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/render/cpdf_imagecacheentry.h15
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/render/cpdf_imageloader.cpp13
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/render/cpdf_imageloader.h4
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/render/cpdf_imagerenderer.cpp101
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/render/cpdf_imagerenderer.h14
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/render/cpdf_pagerendercache.cpp7
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/render/cpdf_pagerendercache.h4
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/render/cpdf_rendercontext.cpp9
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/render/cpdf_rendercontext.h2
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/render/cpdf_renderstatus.cpp495
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/render/cpdf_renderstatus.h24
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/render/cpdf_scaledrenderbuffer.cpp4
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/render/cpdf_textrenderer.cpp18
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/render/cpdf_textrenderer.h14
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/render/cpdf_transferfunc.cpp12
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/render/cpdf_transferfunc.h14
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/render/cpdf_type3cache.cpp44
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/render/cpdf_type3cache.h21
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/render/cpdf_type3glyphs.cpp10
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/render/cpdf_type3glyphs.h5
-rw-r--r--chromium/third_party/pdfium/core/fpdfdoc/cline.cpp2
-rw-r--r--chromium/third_party/pdfium/core/fpdfdoc/cline.h3
-rw-r--r--chromium/third_party/pdfium/core/fpdfdoc/clines.cpp52
-rw-r--r--chromium/third_party/pdfium/core/fpdfdoc/clines.h35
-rw-r--r--chromium/third_party/pdfium/core/fpdfdoc/cpdf_aaction.cpp6
-rw-r--r--chromium/third_party/pdfium/core/fpdfdoc/cpdf_action.cpp2
-rw-r--r--chromium/third_party/pdfium/core/fpdfdoc/cpdf_annot.cpp8
-rw-r--r--chromium/third_party/pdfium/core/fpdfdoc/cpdf_apsettings.cpp29
-rw-r--r--chromium/third_party/pdfium/core/fpdfdoc/cpdf_apsettings.h12
-rw-r--r--chromium/third_party/pdfium/core/fpdfdoc/cpdf_bookmark.cpp4
-rw-r--r--chromium/third_party/pdfium/core/fpdfdoc/cpdf_defaultappearance.cpp39
-rw-r--r--chromium/third_party/pdfium/core/fpdfdoc/cpdf_defaultappearance.h4
-rw-r--r--chromium/third_party/pdfium/core/fpdfdoc/cpdf_dest.cpp6
-rw-r--r--chromium/third_party/pdfium/core/fpdfdoc/cpdf_dest.h2
-rw-r--r--chromium/third_party/pdfium/core/fpdfdoc/cpdf_docjsactions.cpp7
-rw-r--r--chromium/third_party/pdfium/core/fpdfdoc/cpdf_docjsactions.h2
-rw-r--r--chromium/third_party/pdfium/core/fpdfdoc/cpdf_filespec.cpp4
-rw-r--r--chromium/third_party/pdfium/core/fpdfdoc/cpdf_filespec_unittest.cpp12
-rw-r--r--chromium/third_party/pdfium/core/fpdfdoc/cpdf_formcontrol.cpp13
-rw-r--r--chromium/third_party/pdfium/core/fpdfdoc/cpdf_formcontrol.h12
-rw-r--r--chromium/third_party/pdfium/core/fpdfdoc/cpdf_formfield.cpp6
-rw-r--r--chromium/third_party/pdfium/core/fpdfdoc/cpdf_formfield.h12
-rw-r--r--chromium/third_party/pdfium/core/fpdfdoc/cpdf_iconfit.cpp2
-rw-r--r--chromium/third_party/pdfium/core/fpdfdoc/cpdf_iconfit.h2
-rw-r--r--chromium/third_party/pdfium/core/fpdfdoc/cpdf_interform.cpp176
-rw-r--r--chromium/third_party/pdfium/core/fpdfdoc/cpdf_interform.h8
-rw-r--r--chromium/third_party/pdfium/core/fpdfdoc/cpdf_metadata.cpp8
-rw-r--r--chromium/third_party/pdfium/core/fpdfdoc/cpdf_nametree.cpp11
-rw-r--r--chromium/third_party/pdfium/core/fpdfdoc/cpdf_nametree.h2
-rw-r--r--chromium/third_party/pdfium/core/fpdfdoc/cpdf_pagelabel.cpp2
-rw-r--r--chromium/third_party/pdfium/core/fpdfdoc/cpdf_structelement.cpp137
-rw-r--r--chromium/third_party/pdfium/core/fpdfdoc/cpdf_structelement.h66
-rw-r--r--chromium/third_party/pdfium/core/fpdfdoc/cpdf_structtree.cpp155
-rw-r--r--chromium/third_party/pdfium/core/fpdfdoc/cpdf_structtree.h50
-rw-r--r--chromium/third_party/pdfium/core/fpdfdoc/cpdf_variabletext.cpp861
-rw-r--r--chromium/third_party/pdfium/core/fpdfdoc/cpdf_variabletext.h74
-rw-r--r--chromium/third_party/pdfium/core/fpdfdoc/cpvt_arraytemplate.h30
-rw-r--r--chromium/third_party/pdfium/core/fpdfdoc/cpvt_color.cpp14
-rw-r--r--chromium/third_party/pdfium/core/fpdfdoc/cpvt_color.h16
-rw-r--r--chromium/third_party/pdfium/core/fpdfdoc/cpvt_floatrect.h10
-rw-r--r--chromium/third_party/pdfium/core/fpdfdoc/cpvt_fontmap.cpp28
-rw-r--r--chromium/third_party/pdfium/core/fpdfdoc/cpvt_fontmap.h7
-rw-r--r--chromium/third_party/pdfium/core/fpdfdoc/cpvt_generateap.cpp78
-rw-r--r--chromium/third_party/pdfium/core/fpdfdoc/cpvt_generateap.h4
-rw-r--r--chromium/third_party/pdfium/core/fpdfdoc/cpvt_line.h6
-rw-r--r--chromium/third_party/pdfium/core/fpdfdoc/cpvt_lineinfo.h10
-rw-r--r--chromium/third_party/pdfium/core/fpdfdoc/cpvt_secprops.h6
-rw-r--r--chromium/third_party/pdfium/core/fpdfdoc/cpvt_word.h8
-rw-r--r--chromium/third_party/pdfium/core/fpdfdoc/cpvt_wordinfo.h6
-rw-r--r--chromium/third_party/pdfium/core/fpdfdoc/cpvt_wordplace.h80
-rw-r--r--chromium/third_party/pdfium/core/fpdfdoc/cpvt_wordprops.h8
-rw-r--r--chromium/third_party/pdfium/core/fpdfdoc/cpvt_wordrange.h38
-rw-r--r--chromium/third_party/pdfium/core/fpdfdoc/csection.cpp280
-rw-r--r--chromium/third_party/pdfium/core/fpdfdoc/csection.h18
-rw-r--r--chromium/third_party/pdfium/core/fpdfdoc/ctypeset.cpp257
-rw-r--r--chromium/third_party/pdfium/core/fpdfdoc/ctypeset.h4
-rw-r--r--chromium/third_party/pdfium/core/fpdfdoc/doc_tagged.cpp418
-rw-r--r--chromium/third_party/pdfium/core/fpdfdoc/fpdf_tagged.h75
-rw-r--r--chromium/third_party/pdfium/core/fpdfdoc/tagged_int.h119
-rw-r--r--chromium/third_party/pdfium/core/fpdftext/cpdf_linkextract.cpp37
-rw-r--r--chromium/third_party/pdfium/core/fpdftext/cpdf_textpage.cpp228
-rw-r--r--chromium/third_party/pdfium/core/fpdftext/cpdf_textpage.h28
-rw-r--r--chromium/third_party/pdfium/core/fpdftext/cpdf_textpagefind.cpp23
-rw-r--r--chromium/third_party/pdfium/core/fpdftext/cpdf_textpagefind.h4
-rw-r--r--chromium/third_party/pdfium/core/fxcodec/DEPS2
-rw-r--r--chromium/third_party/pdfium/core/fxcodec/codec/ccodec_bmpmodule.cpp10
-rw-r--r--chromium/third_party/pdfium/core/fxcodec/codec/ccodec_bmpmodule.h2
-rw-r--r--chromium/third_party/pdfium/core/fxcodec/codec/ccodec_gifmodule.cpp12
-rw-r--r--chromium/third_party/pdfium/core/fxcodec/codec/ccodec_gifmodule.h2
-rw-r--r--chromium/third_party/pdfium/core/fxcodec/codec/ccodec_iccmodule.h2
-rw-r--r--chromium/third_party/pdfium/core/fxcodec/codec/ccodec_jbig2module.h11
-rw-r--r--chromium/third_party/pdfium/core/fxcodec/codec/ccodec_jpegmodule.h2
-rw-r--r--chromium/third_party/pdfium/core/fxcodec/codec/ccodec_jpxmodule.h8
-rw-r--r--chromium/third_party/pdfium/core/fxcodec/codec/ccodec_pngmodule.cpp21
-rw-r--r--chromium/third_party/pdfium/core/fxcodec/codec/ccodec_pngmodule.h2
-rw-r--r--chromium/third_party/pdfium/core/fxcodec/codec/ccodec_progressivedecoder.h32
-rw-r--r--chromium/third_party/pdfium/core/fxcodec/codec/ccodec_tiffmodule.cpp79
-rw-r--r--chromium/third_party/pdfium/core/fxcodec/codec/ccodec_tiffmodule.h3
-rw-r--r--chromium/third_party/pdfium/core/fxcodec/codec/cjpx_decoder.h36
-rw-r--r--chromium/third_party/pdfium/core/fxcodec/codec/codec_int.h9
-rw-r--r--chromium/third_party/pdfium/core/fxcodec/codec/fx_codec.cpp10
-rw-r--r--chromium/third_party/pdfium/core/fxcodec/codec/fx_codec_fax.cpp97
-rw-r--r--chromium/third_party/pdfium/core/fxcodec/codec/fx_codec_flate.cpp316
-rw-r--r--chromium/third_party/pdfium/core/fxcodec/codec/fx_codec_icc.cpp54
-rw-r--r--chromium/third_party/pdfium/core/fxcodec/codec/fx_codec_jbig.cpp40
-rw-r--r--chromium/third_party/pdfium/core/fxcodec/codec/fx_codec_jpeg.cpp12
-rw-r--r--chromium/third_party/pdfium/core/fxcodec/codec/fx_codec_jpx_opj.cpp64
-rw-r--r--chromium/third_party/pdfium/core/fxcodec/codec/fx_codec_jpx_unittest.cpp114
-rw-r--r--chromium/third_party/pdfium/core/fxcodec/codec/fx_codec_progress.cpp207
-rw-r--r--chromium/third_party/pdfium/core/fxcodec/codec/icodec_tiffmodule.h2
-rw-r--r--chromium/third_party/pdfium/core/fxcodec/fx_codec.h30
-rw-r--r--chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_ArithDecoder.cpp5
-rw-r--r--chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_ArithDecoder.h7
-rw-r--r--chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_BitStream.cpp23
-rw-r--r--chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_BitStream.h6
-rw-r--r--chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_BitStream_unittest.cpp119
-rw-r--r--chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_Context.cpp49
-rw-r--r--chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_Context.h6
-rw-r--r--chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_Define.h6
-rw-r--r--chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_GrdProc.cpp236
-rw-r--r--chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_GrrdProc.cpp9
-rw-r--r--chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_GsidProc.cpp5
-rw-r--r--chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_HtrdProc.cpp8
-rw-r--r--chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_HuffmanTable.cpp19
-rw-r--r--chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_HuffmanTable.h2
-rw-r--r--chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_PddProc.cpp9
-rw-r--r--chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_SddProc.cpp443
-rw-r--r--chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_SddProc.h1
-rw-r--r--chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_TrdProc.cpp29
-rw-r--r--chromium/third_party/pdfium/core/fxcodec/lbmp/fx_bmp.cpp124
-rw-r--r--chromium/third_party/pdfium/core/fxcodec/lbmp/fx_bmp.h8
-rw-r--r--chromium/third_party/pdfium/core/fxcodec/lgif/fx_gif.cpp99
-rw-r--r--chromium/third_party/pdfium/core/fxcodec/lgif/fx_gif.h12
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/cfx_blockbuffer.cpp121
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/cfx_blockbuffer.h51
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/cfx_bytestring.cpp843
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/cfx_bytestring.h236
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/cfx_bytestring_unittest.cpp1098
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/cfx_char.cpp48
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/cfx_char.h42
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/cfx_chariter.cpp51
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/cfx_chariter.h31
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/cfx_checksumcontext.cpp151
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/cfx_checksumcontext.h34
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/cfx_datetime.cpp129
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/cfx_datetime.h103
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/cfx_decimal.cpp471
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/cfx_decimal.h42
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/cfx_maybe_owned.h2
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/cfx_retain_ptr.h9
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/cfx_retain_ptr_unittest.cpp47
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/cfx_string_c_template.h7
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/cfx_string_data_template.h18
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/cfx_weak_ptr.h2
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/cfx_widestring.cpp1068
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/cfx_widestring.h233
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/cfx_widestring_unittest.cpp954
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/cfx_wordbreak.cpp2946
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/cfx_wordbreak.h39
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/fx_arabic.cpp666
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/fx_arabic.h177
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/fx_arb.h51
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/fx_basic.h355
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/fx_basic_array.cpp138
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/fx_basic_bstring.cpp1012
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/fx_basic_bstring_unittest.cpp1102
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/fx_basic_buffer.cpp51
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/fx_basic_coords.cpp144
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/fx_basic_gcc.cpp75
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/fx_basic_memmgr.cpp13
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/fx_basic_utf.cpp6
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/fx_basic_util.cpp54
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/fx_basic_wstring.cpp1022
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/fx_basic_wstring_unittest.cpp941
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/fx_bidi.cpp2
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/fx_bidi.h4
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/fx_bidi_unittest.cpp24
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/fx_coordinates.h120
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/fx_ext.h45
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/fx_extension.cpp141
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/fx_memory.h6
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/fx_safe_types.h1
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/fx_stream.h14
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/fx_string.h446
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/fx_system.h137
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/fx_system_unittest.cpp18
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/fx_ucd.h174
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/fx_unicode.cpp19
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/fx_xml.h163
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/fx_xml_composer.cpp33
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/fx_xml_parser.cpp918
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/fxcrt_posix.cpp2
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/ifx_chariter.h24
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/ifx_locale.h76
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/xml/cfx_saxcontext.h23
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/xml/cfx_saxreader.cpp729
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/xml/cfx_saxreader.h144
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/xml/cfx_saxreaderhandler.cpp128
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/xml/cfx_saxreaderhandler.h49
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/xml/cxml_attritem.cpp12
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/xml/cxml_attritem.h21
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/xml/cxml_attrmap.cpp50
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/xml/cxml_attrmap.h33
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/xml/cxml_content.h23
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/xml/cxml_element.cpp228
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/xml/cxml_element.h126
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/xml/cxml_parser.cpp680
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/xml/cxml_parser.h55
-rw-r--r--chromium/third_party/pdfium/core/fxcrt/xml_int.h55
-rw-r--r--chromium/third_party/pdfium/core/fxge/agg/fx_agg_driver.cpp2178
-rw-r--r--chromium/third_party/pdfium/core/fxge/agg/fx_agg_driver.h27
-rw-r--r--chromium/third_party/pdfium/core/fxge/android/cfpf_skiafont.cpp2
-rw-r--r--chromium/third_party/pdfium/core/fxge/android/cfpf_skiafont.h2
-rw-r--r--chromium/third_party/pdfium/core/fxge/android/cfpf_skiafontdescriptor.h8
-rw-r--r--chromium/third_party/pdfium/core/fxge/android/cfpf_skiafontmgr.cpp10
-rw-r--r--chromium/third_party/pdfium/core/fxge/android/cfpf_skiapathfont.h8
-rw-r--r--chromium/third_party/pdfium/core/fxge/android/cfx_androidfontinfo.cpp12
-rw-r--r--chromium/third_party/pdfium/core/fxge/android/cfx_androidfontinfo.h8
-rw-r--r--chromium/third_party/pdfium/core/fxge/android/fx_android_imp.cpp3
-rw-r--r--chromium/third_party/pdfium/core/fxge/apple/apple_int.h4
-rw-r--r--chromium/third_party/pdfium/core/fxge/apple/fx_apple_platform.cpp7
-rw-r--r--chromium/third_party/pdfium/core/fxge/apple/fx_mac_imp.cpp8
-rw-r--r--chromium/third_party/pdfium/core/fxge/apple/fx_quartz_device.cpp5
-rw-r--r--chromium/third_party/pdfium/core/fxge/cfx_fontmgr.h2
-rw-r--r--chromium/third_party/pdfium/core/fxge/cfx_fxgedevice.h13
-rw-r--r--chromium/third_party/pdfium/core/fxge/cfx_gemodule.h2
-rw-r--r--chromium/third_party/pdfium/core/fxge/cfx_graphstate.h10
-rw-r--r--chromium/third_party/pdfium/core/fxge/cfx_graphstatedata.h8
-rw-r--r--chromium/third_party/pdfium/core/fxge/cfx_pathdata.h4
-rw-r--r--chromium/third_party/pdfium/core/fxge/cfx_renderdevice.h75
-rw-r--r--chromium/third_party/pdfium/core/fxge/cfx_unicodeencodingex.h2
-rw-r--r--chromium/third_party/pdfium/core/fxge/dib/cfx_bitmapcomposer.cpp201
-rw-r--r--chromium/third_party/pdfium/core/fxge/dib/cfx_bitmapcomposer.h81
-rw-r--r--chromium/third_party/pdfium/core/fxge/dib/cfx_bitmapstorer.cpp55
-rw-r--r--chromium/third_party/pdfium/core/fxge/dib/cfx_bitmapstorer.h41
-rw-r--r--chromium/third_party/pdfium/core/fxge/dib/cfx_dibextractor.cpp27
-rw-r--r--chromium/third_party/pdfium/core/fxge/dib/cfx_dibextractor.h26
-rw-r--r--chromium/third_party/pdfium/core/fxge/dib/cfx_dibitmap.cpp1232
-rw-r--r--chromium/third_party/pdfium/core/fxge/dib/cfx_dibitmap.h120
-rw-r--r--chromium/third_party/pdfium/core/fxge/dib/cfx_dibsource.cpp1264
-rw-r--r--chromium/third_party/pdfium/core/fxge/dib/cfx_dibsource.h145
-rw-r--r--chromium/third_party/pdfium/core/fxge/dib/cfx_filtereddib.cpp42
-rw-r--r--chromium/third_party/pdfium/core/fxge/dib/cfx_filtereddib.h50
-rw-r--r--chromium/third_party/pdfium/core/fxge/dib/cfx_imagerenderer.cpp137
-rw-r--r--chromium/third_party/pdfium/core/fxge/dib/cfx_imagerenderer.h56
-rw-r--r--chromium/third_party/pdfium/core/fxge/dib/cfx_imagestretcher.cpp193
-rw-r--r--chromium/third_party/pdfium/core/fxge/dib/cfx_imagestretcher.h56
-rw-r--r--chromium/third_party/pdfium/core/fxge/dib/cfx_imagetransformer.cpp792
-rw-r--r--chromium/third_party/pdfium/core/fxge/dib/cfx_imagetransformer.h47
-rw-r--r--chromium/third_party/pdfium/core/fxge/dib/cfx_scanlinecompositor.cpp3348
-rw-r--r--chromium/third_party/pdfium/core/fxge/dib/cfx_scanlinecompositor.h72
-rw-r--r--chromium/third_party/pdfium/core/fxge/dib/cstretchengine.cpp830
-rw-r--r--chromium/third_party/pdfium/core/fxge/dib/cstretchengine.h81
-rw-r--r--chromium/third_party/pdfium/core/fxge/dib/cstretchengine_unittest.cpp32
-rw-r--r--chromium/third_party/pdfium/core/fxge/dib/dib_int.h116
-rw-r--r--chromium/third_party/pdfium/core/fxge/dib/fx_dib_composite.cpp5040
-rw-r--r--chromium/third_party/pdfium/core/fxge/dib/fx_dib_convert.cpp911
-rw-r--r--chromium/third_party/pdfium/core/fxge/dib/fx_dib_engine.cpp1007
-rw-r--r--chromium/third_party/pdfium/core/fxge/dib/fx_dib_engine_unittest.cpp31
-rw-r--r--chromium/third_party/pdfium/core/fxge/dib/fx_dib_main.cpp1677
-rw-r--r--chromium/third_party/pdfium/core/fxge/dib/fx_dib_transform.cpp963
-rw-r--r--chromium/third_party/pdfium/core/fxge/dib/ifx_scanlinecomposer.h26
-rw-r--r--chromium/third_party/pdfium/core/fxge/freetype/DEPS2
-rw-r--r--chromium/third_party/pdfium/core/fxge/freetype/fx_freetype.cpp2
-rw-r--r--chromium/third_party/pdfium/core/fxge/fx_dib.h621
-rw-r--r--chromium/third_party/pdfium/core/fxge/fx_font.h15
-rw-r--r--chromium/third_party/pdfium/core/fxge/ge/cfx_cliprgn.cpp46
-rw-r--r--chromium/third_party/pdfium/core/fxge/ge/cfx_cliprgn.h16
-rw-r--r--chromium/third_party/pdfium/core/fxge/ge/cfx_facecache.cpp40
-rw-r--r--chromium/third_party/pdfium/core/fxge/ge/cfx_folderfontinfo.cpp60
-rw-r--r--chromium/third_party/pdfium/core/fxge/ge/cfx_folderfontinfo.h12
-rw-r--r--chromium/third_party/pdfium/core/fxge/ge/cfx_font.cpp2
-rw-r--r--chromium/third_party/pdfium/core/fxge/ge/cfx_fontcache.cpp3
-rw-r--r--chromium/third_party/pdfium/core/fxge/ge/cfx_fontmapper.cpp39
-rw-r--r--chromium/third_party/pdfium/core/fxge/ge/cfx_fontmgr.cpp2
-rw-r--r--chromium/third_party/pdfium/core/fxge/ge/cfx_gemodule.cpp4
-rw-r--r--chromium/third_party/pdfium/core/fxge/ge/cfx_graphstate.cpp12
-rw-r--r--chromium/third_party/pdfium/core/fxge/ge/cfx_graphstatedata.cpp6
-rw-r--r--chromium/third_party/pdfium/core/fxge/ge/cfx_pathdata.cpp85
-rw-r--r--chromium/third_party/pdfium/core/fxge/ge/cfx_renderdevice.cpp247
-rw-r--r--chromium/third_party/pdfium/core/fxge/ge/cfx_unicodeencodingex.cpp2
-rw-r--r--chromium/third_party/pdfium/core/fxge/ge/fx_ge_linux.cpp14
-rw-r--r--chromium/third_party/pdfium/core/fxge/ge/fx_ge_text.cpp8
-rw-r--r--chromium/third_party/pdfium/core/fxge/ge/fx_text_int.h2
-rw-r--r--chromium/third_party/pdfium/core/fxge/ifx_renderdevicedriver.cpp39
-rw-r--r--chromium/third_party/pdfium/core/fxge/ifx_renderdevicedriver.h35
-rw-r--r--chromium/third_party/pdfium/core/fxge/ifx_systemfontinfo.h8
-rw-r--r--chromium/third_party/pdfium/core/fxge/skia/fx_skia_device.cpp529
-rw-r--r--chromium/third_party/pdfium/core/fxge/skia/fx_skia_device.h46
-rw-r--r--chromium/third_party/pdfium/core/fxge/skia/fx_skia_device_unittest.cpp4
-rw-r--r--chromium/third_party/pdfium/core/fxge/win32/cfx_psrenderer.cpp89
-rw-r--r--chromium/third_party/pdfium/core/fxge/win32/cfx_psrenderer.h8
-rw-r--r--chromium/third_party/pdfium/core/fxge/win32/cfx_windowsdib.h26
-rw-r--r--chromium/third_party/pdfium/core/fxge/win32/cpsoutput.cpp6
-rw-r--r--chromium/third_party/pdfium/core/fxge/win32/cpsoutput.h2
-rw-r--r--chromium/third_party/pdfium/core/fxge/win32/dwrite_int.h15
-rw-r--r--chromium/third_party/pdfium/core/fxge/win32/fx_win32_device.cpp298
-rw-r--r--chromium/third_party/pdfium/core/fxge/win32/fx_win32_dib.cpp72
-rw-r--r--chromium/third_party/pdfium/core/fxge/win32/fx_win32_dwrite.cpp35
-rw-r--r--chromium/third_party/pdfium/core/fxge/win32/fx_win32_gdipext.cpp95
-rw-r--r--chromium/third_party/pdfium/core/fxge/win32/fx_win32_print.cpp103
-rw-r--r--chromium/third_party/pdfium/core/fxge/win32/win32_int.h80
-rw-r--r--chromium/third_party/pdfium/docs/getting-started.md3
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/DEPS2
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/cba_annotiterator.cpp10
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/cfx_systemhandler.cpp8
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/cpdfsdk_annot.cpp4
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/cpdfsdk_annot.h4
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/cpdfsdk_annothandlermgr.cpp4
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/cpdfsdk_annotiteration.cpp2
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/cpdfsdk_baannot.cpp32
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/cpdfsdk_datetime.cpp2
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/cpdfsdk_formfillenvironment.cpp51
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/cpdfsdk_formfillenvironment.h46
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/cpdfsdk_interform.cpp17
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/cpdfsdk_pageview.cpp35
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/cpdfsdk_widget.cpp129
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/cpdfsdk_widget.h2
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/cpdfsdk_widgethandler.cpp2
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/cpdfsdk_xfawidget.cpp2
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/cpdfsdk_xfawidgethandler.cpp8
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/formfiller/cba_fontmap.cpp21
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/formfiller/cba_fontmap.h6
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/formfiller/cffl_combobox.cpp24
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/formfiller/cffl_formfiller.cpp4
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp16
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/formfiller/cffl_interactiveformfiller.h6
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/formfiller/cffl_textfield.cpp24
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/fpdf_dataavail.cpp15
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/fpdf_ext.cpp7
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/fpdf_flatten.cpp34
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/fpdf_progressive.cpp15
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/fpdf_searchex.cpp8
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/fpdf_structtree.cpp73
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/fpdf_structtree_embeddertest.cpp31
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/fpdf_sysfontinfo.cpp20
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/fpdf_transformpage.cpp3
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/fpdfdoc.cpp14
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/fpdfdoc_embeddertest.cpp14
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/fpdfedit_embeddertest.cpp357
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/fpdfeditimg.cpp55
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/fpdfeditimg_unittest.cpp10
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/fpdfeditpage.cpp21
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/fpdfeditpath.cpp38
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/fpdfedittext.cpp277
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/fpdfformfill.cpp82
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/fpdfppo.cpp14
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/fpdfppo_embeddertest.cpp80
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/fpdfsave.cpp40
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/fpdftext.cpp19
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/fpdftext_embeddertest.cpp68
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/fpdfview.cpp62
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/fpdfview_c_api_test.c7
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/fpdfxfa/DEPS2
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp44
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/fpdfxfa/cpdfxfa_context.h6
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp50
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h12
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp52
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/fpdfxfa/cpdfxfa_page.h4
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/fpdfxfa/cxfa_fwladaptertimermgr.cpp2
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/fsdk_define.h1
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/fxedit/fxet_ap.cpp6
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/fxedit/fxet_edit.cpp625
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/fxedit/fxet_edit.h56
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/fxedit/fxet_list.cpp269
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/fxedit/fxet_list.h77
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/javascript/Consts.cpp2
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/javascript/Document.cpp4
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/javascript/Field.cpp24
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/javascript/JS_Define.h2
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/javascript/JS_EventHandler.cpp4
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/javascript/JS_EventHandler.h4
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/javascript/JS_GlobalData.cpp19
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/javascript/JS_GlobalData.h6
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/javascript/JS_Value.cpp17
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/javascript/JS_Value.h6
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/javascript/PublicMethods.cpp104
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/javascript/PublicMethods.h2
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/javascript/app.cpp3
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/javascript/cjs_runtime.cpp7
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/javascript/color.cpp9
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/javascript/global.cpp6
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/javascript/global.h6
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/javascript/util.cpp26
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_Caret.cpp6
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_Caret.h2
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_ComboBox.cpp12
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_Edit.cpp48
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_Edit.h21
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp116
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_EditCtrl.h43
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_FontMap.cpp36
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_FontMap.h2
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_Icon.cpp40
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_Icon.h14
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_ListBox.cpp28
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_ListBox.h22
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_ScrollBar.cpp82
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_ScrollBar.h56
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_SpecialButton.cpp2
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_Utils.cpp143
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_Utils.h24
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_Wnd.cpp32
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_Wnd.h6
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/pdfwindow/cpwl_color.cpp27
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/pdfwindow/cpwl_color.h20
-rw-r--r--chromium/third_party/pdfium/fxbarcode/BC_Dimension.cpp46
-rw-r--r--chromium/third_party/pdfium/fxbarcode/BC_Dimension.h29
-rw-r--r--chromium/third_party/pdfium/fxbarcode/BC_Library.cpp36
-rw-r--r--chromium/third_party/pdfium/fxbarcode/BC_Library.h38
-rw-r--r--chromium/third_party/pdfium/fxbarcode/BC_TwoDimWriter.cpp145
-rw-r--r--chromium/third_party/pdfium/fxbarcode/BC_TwoDimWriter.h40
-rw-r--r--chromium/third_party/pdfium/fxbarcode/BC_UtilCodingConvert.cpp54
-rw-r--r--chromium/third_party/pdfium/fxbarcode/BC_UtilCodingConvert.h33
-rw-r--r--chromium/third_party/pdfium/fxbarcode/BC_Utils.cpp35
-rw-r--r--chromium/third_party/pdfium/fxbarcode/BC_Writer.cpp58
-rw-r--r--chromium/third_party/pdfium/fxbarcode/BC_Writer.h39
-rw-r--r--chromium/third_party/pdfium/fxbarcode/DEPS6
-rw-r--r--chromium/third_party/pdfium/fxbarcode/cbc_codabar.cpp110
-rw-r--r--chromium/third_party/pdfium/fxbarcode/cbc_codabar.h40
-rw-r--r--chromium/third_party/pdfium/fxbarcode/cbc_code128.cpp90
-rw-r--r--chromium/third_party/pdfium/fxbarcode/cbc_code128.h37
-rw-r--r--chromium/third_party/pdfium/fxbarcode/cbc_code39.cpp99
-rw-r--r--chromium/third_party/pdfium/fxbarcode/cbc_code39.h39
-rw-r--r--chromium/third_party/pdfium/fxbarcode/cbc_codebase.cpp58
-rw-r--r--chromium/third_party/pdfium/fxbarcode/cbc_codebase.h49
-rw-r--r--chromium/third_party/pdfium/fxbarcode/cbc_datamatrix.cpp65
-rw-r--r--chromium/third_party/pdfium/fxbarcode/cbc_datamatrix.h33
-rw-r--r--chromium/third_party/pdfium/fxbarcode/cbc_ean13.cpp95
-rw-r--r--chromium/third_party/pdfium/fxbarcode/cbc_ean13.h37
-rw-r--r--chromium/third_party/pdfium/fxbarcode/cbc_ean8.cpp94
-rw-r--r--chromium/third_party/pdfium/fxbarcode/cbc_ean8.h36
-rw-r--r--chromium/third_party/pdfium/fxbarcode/cbc_onecode.cpp78
-rw-r--r--chromium/third_party/pdfium/fxbarcode/cbc_onecode.h35
-rw-r--r--chromium/third_party/pdfium/fxbarcode/cbc_pdf417i.cpp75
-rw-r--r--chromium/third_party/pdfium/fxbarcode/cbc_pdf417i.h35
-rw-r--r--chromium/third_party/pdfium/fxbarcode/cbc_qrcode.cpp72
-rw-r--r--chromium/third_party/pdfium/fxbarcode/cbc_qrcode.h39
-rw-r--r--chromium/third_party/pdfium/fxbarcode/cbc_upca.cpp98
-rw-r--r--chromium/third_party/pdfium/fxbarcode/cbc_upca.h36
-rw-r--r--chromium/third_party/pdfium/fxbarcode/common/BC_CommonBitArray.cpp90
-rw-r--r--chromium/third_party/pdfium/fxbarcode/common/BC_CommonBitArray.h37
-rw-r--r--chromium/third_party/pdfium/fxbarcode/common/BC_CommonBitMatrix.cpp133
-rw-r--r--chromium/third_party/pdfium/fxbarcode/common/BC_CommonBitMatrix.h43
-rw-r--r--chromium/third_party/pdfium/fxbarcode/common/BC_CommonByteArray.cpp101
-rw-r--r--chromium/third_party/pdfium/fxbarcode/common/BC_CommonByteArray.h38
-rw-r--r--chromium/third_party/pdfium/fxbarcode/common/BC_CommonByteMatrix.cpp64
-rw-r--r--chromium/third_party/pdfium/fxbarcode/common/BC_CommonByteMatrix.h35
-rw-r--r--chromium/third_party/pdfium/fxbarcode/common/reedsolomon/BC_ReedSolomon.cpp100
-rw-r--r--chromium/third_party/pdfium/fxbarcode/common/reedsolomon/BC_ReedSolomon.h33
-rw-r--r--chromium/third_party/pdfium/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp136
-rw-r--r--chromium/third_party/pdfium/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.h47
-rw-r--r--chromium/third_party/pdfium/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp240
-rw-r--r--chromium/third_party/pdfium/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.h47
-rw-r--r--chromium/third_party/pdfium/fxbarcode/datamatrix/BC_ASCIIEncoder.cpp97
-rw-r--r--chromium/third_party/pdfium/fxbarcode/datamatrix/BC_ASCIIEncoder.h27
-rw-r--r--chromium/third_party/pdfium/fxbarcode/datamatrix/BC_Base256Encoder.cpp87
-rw-r--r--chromium/third_party/pdfium/fxbarcode/datamatrix/BC_Base256Encoder.h25
-rw-r--r--chromium/third_party/pdfium/fxbarcode/datamatrix/BC_C40Encoder.cpp200
-rw-r--r--chromium/third_party/pdfium/fxbarcode/datamatrix/BC_C40Encoder.h38
-rw-r--r--chromium/third_party/pdfium/fxbarcode/datamatrix/BC_DataMatrixSymbolInfo144.cpp40
-rw-r--r--chromium/third_party/pdfium/fxbarcode/datamatrix/BC_DataMatrixSymbolInfo144.h20
-rw-r--r--chromium/third_party/pdfium/fxbarcode/datamatrix/BC_DataMatrixWriter.cpp143
-rw-r--r--chromium/third_party/pdfium/fxbarcode/datamatrix/BC_DataMatrixWriter.h36
-rw-r--r--chromium/third_party/pdfium/fxbarcode/datamatrix/BC_DefaultPlacement.cpp163
-rw-r--r--chromium/third_party/pdfium/fxbarcode/datamatrix/BC_DefaultPlacement.h42
-rw-r--r--chromium/third_party/pdfium/fxbarcode/datamatrix/BC_EdifactEncoder.cpp152
-rw-r--r--chromium/third_party/pdfium/fxbarcode/datamatrix/BC_EdifactEncoder.h31
-rw-r--r--chromium/third_party/pdfium/fxbarcode/datamatrix/BC_Encoder.cpp10
-rw-r--r--chromium/third_party/pdfium/fxbarcode/datamatrix/BC_Encoder.h23
-rw-r--r--chromium/third_party/pdfium/fxbarcode/datamatrix/BC_EncoderContext.cpp112
-rw-r--r--chromium/third_party/pdfium/fxbarcode/datamatrix/BC_EncoderContext.h56
-rw-r--r--chromium/third_party/pdfium/fxbarcode/datamatrix/BC_ErrorCorrection.cpp209
-rw-r--r--chromium/third_party/pdfium/fxbarcode/datamatrix/BC_ErrorCorrection.h39
-rw-r--r--chromium/third_party/pdfium/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp361
-rw-r--r--chromium/third_party/pdfium/fxbarcode/datamatrix/BC_HighLevelEncoder.h79
-rw-r--r--chromium/third_party/pdfium/fxbarcode/datamatrix/BC_SymbolInfo.cpp230
-rw-r--r--chromium/third_party/pdfium/fxbarcode/datamatrix/BC_SymbolInfo.h79
-rw-r--r--chromium/third_party/pdfium/fxbarcode/datamatrix/BC_SymbolShapeHint.cpp26
-rw-r--r--chromium/third_party/pdfium/fxbarcode/datamatrix/BC_SymbolShapeHint.h22
-rw-r--r--chromium/third_party/pdfium/fxbarcode/datamatrix/BC_TextEncoder.cpp97
-rw-r--r--chromium/third_party/pdfium/fxbarcode/datamatrix/BC_TextEncoder.h22
-rw-r--r--chromium/third_party/pdfium/fxbarcode/datamatrix/BC_X12Encoder.cpp101
-rw-r--r--chromium/third_party/pdfium/fxbarcode/datamatrix/BC_X12Encoder.h26
-rw-r--r--chromium/third_party/pdfium/fxbarcode/oned/BC_OneDimWriter.cpp485
-rw-r--r--chromium/third_party/pdfium/fxbarcode/oned/BC_OneDimWriter.h118
-rw-r--r--chromium/third_party/pdfium/fxbarcode/oned/BC_OnedCodaBarWriter.cpp239
-rw-r--r--chromium/third_party/pdfium/fxbarcode/oned/BC_OnedCodaBarWriter.h58
-rw-r--r--chromium/third_party/pdfium/fxbarcode/oned/BC_OnedCode128Writer.cpp276
-rw-r--r--chromium/third_party/pdfium/fxbarcode/oned/BC_OnedCode128Writer.h55
-rw-r--r--chromium/third_party/pdfium/fxbarcode/oned/BC_OnedCode39Writer.cpp281
-rw-r--r--chromium/third_party/pdfium/fxbarcode/oned/BC_OnedCode39Writer.h54
-rw-r--r--chromium/third_party/pdfium/fxbarcode/oned/BC_OnedEAN13Writer.cpp306
-rw-r--r--chromium/third_party/pdfium/fxbarcode/oned/BC_OnedEAN13Writer.h60
-rw-r--r--chromium/third_party/pdfium/fxbarcode/oned/BC_OnedEAN8Writer.cpp268
-rw-r--r--chromium/third_party/pdfium/fxbarcode/oned/BC_OnedEAN8Writer.h64
-rw-r--r--chromium/third_party/pdfium/fxbarcode/oned/BC_OnedUPCAWriter.cpp286
-rw-r--r--chromium/third_party/pdfium/fxbarcode/oned/BC_OnedUPCAWriter.h66
-rw-r--r--chromium/third_party/pdfium/fxbarcode/pdf417/BC_PDF417.cpp584
-rw-r--r--chromium/third_party/pdfium/fxbarcode/pdf417/BC_PDF417.h68
-rw-r--r--chromium/third_party/pdfium/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.cpp84
-rw-r--r--chromium/third_party/pdfium/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.h42
-rw-r--r--chromium/third_party/pdfium/fxbarcode/pdf417/BC_PDF417BarcodeRow.cpp52
-rw-r--r--chromium/third_party/pdfium/fxbarcode/pdf417/BC_PDF417BarcodeRow.h31
-rw-r--r--chromium/third_party/pdfium/fxbarcode/pdf417/BC_PDF417Compaction.cpp26
-rw-r--r--chromium/third_party/pdfium/fxbarcode/pdf417/BC_PDF417Compaction.h18
-rw-r--r--chromium/third_party/pdfium/fxbarcode/pdf417/BC_PDF417ErrorCorrection.cpp191
-rw-r--r--chromium/third_party/pdfium/fxbarcode/pdf417/BC_PDF417ErrorCorrection.h28
-rw-r--r--chromium/third_party/pdfium/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp430
-rw-r--r--chromium/third_party/pdfium/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h76
-rw-r--r--chromium/third_party/pdfium/fxbarcode/pdf417/BC_PDF417HighLevelEncoder_unittest.cpp231
-rw-r--r--chromium/third_party/pdfium/fxbarcode/pdf417/BC_PDF417Writer.cpp113
-rw-r--r--chromium/third_party/pdfium/fxbarcode/pdf417/BC_PDF417Writer.h38
-rw-r--r--chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCodeWriter.cpp92
-rw-r--r--chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCodeWriter.h30
-rw-r--r--chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoder.cpp145
-rw-r--r--chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoder.h63
-rw-r--r--chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderBitVector.cpp105
-rw-r--r--chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderBitVector.h37
-rw-r--r--chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderBlockPair.cpp47
-rw-r--r--chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderBlockPair.h29
-rw-r--r--chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderECBlocks.cpp47
-rw-r--r--chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderECBlocks.h31
-rw-r--r--chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderECBlocksData.cpp180
-rw-r--r--chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderECBlocksData.h22
-rw-r--r--chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderEncoder.cpp634
-rw-r--r--chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderEncoder.h30
-rw-r--r--chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.cpp84
-rw-r--r--chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.h41
-rw-r--r--chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderMaskUtil.cpp198
-rw-r--r--chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderMaskUtil.h27
-rw-r--r--chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderMatrixUtil.cpp494
-rw-r--r--chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderMatrixUtil.h88
-rw-r--r--chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderMode.cpp172
-rw-r--r--chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderMode.h51
-rw-r--r--chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderVersion.cpp99
-rw-r--r--chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderVersion.h44
-rw-r--r--chromium/third_party/pdfium/fxbarcode/utils.h114
-rw-r--r--chromium/third_party/pdfium/fxjs/cfxjse_arguments.cpp4
-rw-r--r--chromium/third_party/pdfium/fxjs/cfxjse_arguments.h2
-rw-r--r--chromium/third_party/pdfium/fxjs/cfxjse_class.cpp68
-rw-r--r--chromium/third_party/pdfium/fxjs/cfxjse_context.cpp7
-rw-r--r--chromium/third_party/pdfium/fxjs/cfxjse_context.h2
-rw-r--r--chromium/third_party/pdfium/fxjs/cfxjse_value.cpp10
-rw-r--r--chromium/third_party/pdfium/fxjs/cfxjse_value.h4
-rw-r--r--chromium/third_party/pdfium/fxjs/fxjs_v8.cpp16
-rw-r--r--chromium/third_party/pdfium/fxjs/fxjs_v8.h2
-rw-r--r--chromium/third_party/pdfium/fxjs/fxjse.h6
-rw-r--r--chromium/third_party/pdfium/pdfium.gni19
-rw-r--r--chromium/third_party/pdfium/public/cpp/fpdf_deleters.h46
-rw-r--r--chromium/third_party/pdfium/public/fpdf_edit.h55
-rw-r--r--chromium/third_party/pdfium/public/fpdf_searchex.h9
-rw-r--r--chromium/third_party/pdfium/public/fpdf_structtree.h42
-rw-r--r--chromium/third_party/pdfium/public/fpdfview.h4
-rw-r--r--chromium/third_party/pdfium/samples/BUILD.gn5
-rw-r--r--chromium/third_party/pdfium/samples/DEPS2
-rw-r--r--chromium/third_party/pdfium/samples/image_diff_png.cc2
-rw-r--r--chromium/third_party/pdfium/samples/pdfium_test.cc194
-rw-r--r--chromium/third_party/pdfium/skia/BUILD.gn23
-rw-r--r--chromium/third_party/pdfium/testing/SUPPRESSIONS210
-rw-r--r--chromium/third_party/pdfium/testing/embedder_test.cpp15
-rw-r--r--chromium/third_party/pdfium/testing/embedder_test.h11
-rw-r--r--chromium/third_party/pdfium/testing/libfuzzer/BUILD.gn2
-rw-r--r--chromium/third_party/pdfium/testing/libfuzzer/pdf_cfx_saxreader_fuzzer.cc21
-rw-r--r--chromium/third_party/pdfium/testing/libfuzzer/pdf_cmap_fuzzer.cc5
-rw-r--r--chromium/third_party/pdfium/testing/libfuzzer/pdf_codec_icc_fuzzer.cc4
-rw-r--r--chromium/third_party/pdfium/testing/libfuzzer/pdf_codec_jbig2_fuzzer.cc13
-rw-r--r--chromium/third_party/pdfium/testing/libfuzzer/pdf_css_fuzzer.cc3
-rw-r--r--chromium/third_party/pdfium/testing/libfuzzer/pdf_fuzzer_init.cc21
-rw-r--r--chromium/third_party/pdfium/testing/libfuzzer/pdf_jpx_fuzzer.cc13
-rw-r--r--chromium/third_party/pdfium/testing/libfuzzer/pdf_xml_fuzzer.cc12
-rw-r--r--chromium/third_party/pdfium/testing/libfuzzer/xfa_codec_fuzzer.h5
-rw-r--r--chromium/third_party/pdfium/testing/resources/bug_650.pdfbin0 -> 85296 bytes
-rw-r--r--chromium/third_party/pdfium/testing/resources/circular_viewer_ref.in24
-rw-r--r--chromium/third_party/pdfium/testing/resources/circular_viewer_ref.pdf35
-rw-r--r--chromium/third_party/pdfium/testing/resources/javascript/array_buffer.in68
-rw-r--r--chromium/third_party/pdfium/testing/resources/javascript/array_buffer_expected.txt5
-rw-r--r--chromium/third_party/pdfium/testing/resources/pixel/bug_524043_1_expected.pdf.0.pngbin5433 -> 5387 bytes
-rw-r--r--chromium/third_party/pdfium/testing/resources/pixel/bug_524043_1_expected_mac.pdf.0.pngbin4365 -> 4379 bytes
-rw-r--r--chromium/third_party/pdfium/testing/resources/pixel/bug_524043_2_expected.pdf.0.pngbin2237 -> 2212 bytes
-rw-r--r--chromium/third_party/pdfium/testing/resources/pixel/bug_524043_2_expected_mac.pdf.0.pngbin2032 -> 2028 bytes
-rw-r--r--chromium/third_party/pdfium/testing/resources/pixel/bug_524043_3_expected.pdf.0.pngbin5433 -> 5387 bytes
-rw-r--r--chromium/third_party/pdfium/testing/resources/pixel/bug_524043_3_expected_mac.pdf.0.pngbin4365 -> 4379 bytes
-rw-r--r--chromium/third_party/pdfium/testing/resources/pixel/bug_524043_4_expected.pdf.0.pngbin5433 -> 5387 bytes
-rw-r--r--chromium/third_party/pdfium/testing/resources/pixel/bug_524043_4_expected_mac.pdf.0.pngbin4365 -> 4379 bytes
-rw-r--r--chromium/third_party/pdfium/testing/resources/pixel/bug_524043_5_expected.pdf.0.pngbin5433 -> 5387 bytes
-rw-r--r--chromium/third_party/pdfium/testing/resources/pixel/bug_524043_5_expected_mac.pdf.0.pngbin4365 -> 4379 bytes
-rw-r--r--chromium/third_party/pdfium/testing/resources/pixel/bug_524043_7_expected.pdf.0.pngbin2237 -> 2212 bytes
-rw-r--r--chromium/third_party/pdfium/testing/resources/pixel/bug_524043_7_expected_mac.pdf.0.pngbin2032 -> 2028 bytes
-rw-r--r--chromium/third_party/pdfium/testing/resources/pixel/bug_543018_1_expected.pdf.0.pngbin5433 -> 5387 bytes
-rw-r--r--chromium/third_party/pdfium/testing/resources/pixel/bug_543018_1_expected_mac.pdf.0.pngbin4365 -> 4379 bytes
-rw-r--r--chromium/third_party/pdfium/testing/resources/pixel/bug_543018_2_expected.pdf.0.pngbin5433 -> 5387 bytes
-rw-r--r--chromium/third_party/pdfium/testing/resources/pixel/bug_543018_2_expected_mac.pdf.0.pngbin4365 -> 4379 bytes
-rw-r--r--chromium/third_party/pdfium/testing/resources/pixel/bug_551258_1_expected.pdf.0.pngbin5433 -> 5387 bytes
-rw-r--r--chromium/third_party/pdfium/testing/resources/pixel/bug_551258_1_expected_mac.pdf.0.pngbin4365 -> 4379 bytes
-rw-r--r--chromium/third_party/pdfium/testing/resources/pixel/font_size_expected.pdf.0.pngbin12153 -> 12086 bytes
-rw-r--r--chromium/third_party/pdfium/testing/resources/pixel/font_size_expected_mac.pdf.0.pngbin0 -> 10012 bytes
-rw-r--r--chromium/third_party/pdfium/testing/resources/repeat_viewer_ref.in19
-rw-r--r--chromium/third_party/pdfium/testing/resources/repeat_viewer_ref.pdf30
-rw-r--r--chromium/third_party/pdfium/testing/resources/weblinks_across_lines.in74
-rw-r--r--chromium/third_party/pdfium/testing/resources/weblinks_across_lines.pdf84
-rw-r--r--chromium/third_party/pdfium/testing/resources/zero_length_stream.in63
-rw-r--r--chromium/third_party/pdfium/testing/resources/zero_length_stream.pdf74
-rw-r--r--chromium/third_party/pdfium/testing/test.gni25
-rw-r--r--chromium/third_party/pdfium/testing/test_support.cpp12
-rw-r--r--chromium/third_party/pdfium/testing/test_support.h7
-rw-r--r--chromium/third_party/pdfium/testing/tools/gold.py10
-rwxr-xr-xchromium/third_party/pdfium/testing/tools/suppressor.py3
-rw-r--r--chromium/third_party/pdfium/third_party/BUILD.gn359
-rw-r--r--chromium/third_party/pdfium/third_party/DEPS1
-rw-r--r--chromium/third_party/pdfium/third_party/agg23/0000-bug-466.patch10
-rw-r--r--chromium/third_party/pdfium/third_party/agg23/0001-gcc-warning.patch2
-rw-r--r--chromium/third_party/pdfium/third_party/agg23/0002-ubsan-error-fixes.patch14
-rw-r--r--chromium/third_party/pdfium/third_party/agg23/agg_array.h27
-rw-r--r--chromium/third_party/pdfium/third_party/agg23/agg_basics.h14
-rw-r--r--chromium/third_party/pdfium/third_party/agg23/agg_clip_liang_barsky.h42
-rw-r--r--chromium/third_party/pdfium/third_party/agg23/agg_conv_adaptor_vcgen.h12
-rw-r--r--chromium/third_party/pdfium/third_party/agg23/agg_conv_dash.h6
-rw-r--r--chromium/third_party/pdfium/third_party/agg23/agg_conv_stroke.h22
-rw-r--r--chromium/third_party/pdfium/third_party/agg23/agg_curves.cpp69
-rw-r--r--chromium/third_party/pdfium/third_party/agg23/agg_curves.h82
-rw-r--r--chromium/third_party/pdfium/third_party/agg23/agg_math.h40
-rw-r--r--chromium/third_party/pdfium/third_party/agg23/agg_math_stroke.h100
-rw-r--r--chromium/third_party/pdfium/third_party/agg23/agg_path_storage.cpp26
-rw-r--r--chromium/third_party/pdfium/third_party/agg23/agg_path_storage.h48
-rw-r--r--chromium/third_party/pdfium/third_party/agg23/agg_rasterizer_scanline_aa.cpp4
-rw-r--r--chromium/third_party/pdfium/third_party/agg23/agg_rasterizer_scanline_aa.h14
-rw-r--r--chromium/third_party/pdfium/third_party/agg23/agg_scanline_u.h4
-rw-r--r--chromium/third_party/pdfium/third_party/agg23/agg_shorten_path.h8
-rw-r--r--chromium/third_party/pdfium/third_party/agg23/agg_vcgen_dash.cpp14
-rw-r--r--chromium/third_party/pdfium/third_party/agg23/agg_vcgen_dash.h24
-rw-r--r--chromium/third_party/pdfium/third_party/agg23/agg_vcgen_stroke.cpp14
-rw-r--r--chromium/third_party/pdfium/third_party/agg23/agg_vcgen_stroke.h30
-rw-r--r--chromium/third_party/pdfium/third_party/agg23/agg_vertex_sequence.h12
-rw-r--r--chromium/third_party/pdfium/third_party/base/allocator/partition_allocator/OWNERS2
-rw-r--r--chromium/third_party/pdfium/third_party/base/allocator/partition_allocator/address_space_randomization.cc143
-rw-r--r--chromium/third_party/pdfium/third_party/base/allocator/partition_allocator/address_space_randomization.h18
-rw-r--r--chromium/third_party/pdfium/third_party/base/allocator/partition_allocator/oom.h37
-rw-r--r--chromium/third_party/pdfium/third_party/base/allocator/partition_allocator/page_allocator.cc281
-rw-r--r--chromium/third_party/pdfium/third_party/base/allocator/partition_allocator/page_allocator.h126
-rw-r--r--chromium/third_party/pdfium/third_party/base/allocator/partition_allocator/partition_alloc.cc1442
-rw-r--r--chromium/third_party/pdfium/third_party/base/allocator/partition_allocator/partition_alloc.h908
-rw-r--r--chromium/third_party/pdfium/third_party/base/allocator/partition_allocator/spin_lock.cc84
-rw-r--r--chromium/third_party/pdfium/third_party/base/allocator/partition_allocator/spin_lock.h54
-rw-r--r--chromium/third_party/pdfium/third_party/base/base_export.h3
-rw-r--r--chromium/third_party/pdfium/third_party/base/bits.h114
-rw-r--r--chromium/third_party/pdfium/third_party/base/compiler_specific.h233
-rw-r--r--chromium/third_party/pdfium/third_party/base/logging.h13
-rw-r--r--chromium/third_party/pdfium/third_party/base/macros.h6
-rw-r--r--chromium/third_party/pdfium/third_party/base/stl_util.h14
-rw-r--r--chromium/third_party/pdfium/third_party/base/sys_byteorder.h141
-rw-r--r--chromium/third_party/pdfium/third_party/base/template_util.h203
-rw-r--r--chromium/third_party/pdfium/third_party/build/build_config.h194
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/0000-include.patch52
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/README.pdfium24
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype-custom-config/ftmodule.h32
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype-custom-config/ftoption.h960
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/config/ftconfig.h467
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/config/ftheader.h834
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/config/ftmodule.h49
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/config/ftoption.h886
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/config/ftstdlib.h174
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/freetype.h4204
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/ftadvanc.h187
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/ftautoh.h450
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/ftbbox.h101
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/ftbdf.h210
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/ftbitmap.h240
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/ftbzip2.h102
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/ftcache.h1057
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/ftcffdrv.h262
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/ftcid.h168
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/fterrdef.h276
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/fterrors.h216
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/ftfntfmt.h92
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/ftgasp.h129
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/ftglyph.h605
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/ftgxval.h357
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/ftgzip.h148
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/ftimage.h1214
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/ftincrem.h354
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/ftlcdfil.h251
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/ftlist.h276
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/ftlzw.h99
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/ftmac.h274
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/ftmm.h379
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/ftmodapi.h669
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/ftmoderr.h194
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/ftotval.h204
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/ftoutln.h574
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/ftpfr.h172
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/ftrender.h232
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/ftsizes.h159
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/ftsnames.h200
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/ftstroke.h785
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/ftsynth.h84
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/ftsystem.h355
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/fttrigon.h350
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/ftttdrv.h310
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/fttypes.h602
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/ftwinfnt.h275
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/autohint.h244
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/ftcalc.h418
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/ftdebug.h255
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/ftdriver.h409
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/ftgloadr.h172
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/ftmemory.h386
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/ftobjs.h1571
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/ftpic.h71
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/ftrfork.h266
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/ftserv.h763
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/ftstream.h536
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/fttrace.h154
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/ftvalid.h159
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/internal.h63
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/psaux.h877
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/pshints.h722
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svbdf.h82
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svcid.h90
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svfntfmt.h55
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svgldict.h88
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svgxval.h72
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svkern.h51
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svmm.h113
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svotval.h55
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svpfr.h66
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svpostnm.h81
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svprop.h81
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svpscmap.h177
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svpsinfo.h111
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svsfnt.h103
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svttcmap.h106
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svtteng.h53
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svttglyf.h69
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svwinfnt.h50
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/sfnt.h748
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/t1types.h255
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/tttypes.h1526
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/t1tables.h761
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/ttnameid.h1237
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/tttables.h829
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/tttags.h111
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/freetype/ttunpat.h60
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/include/ft2build.h42
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/base/Jamfile87
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/base/basepic.c108
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/base/basepic.h91
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/base/ftadvanc.c168
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/base/ftapi.c121
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/base/ftbase.c41
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/base/ftbase.h74
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/base/ftbbox.c509
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/base/ftbdf.c91
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/base/ftbitmap.c809
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/base/ftcalc.c1003
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/base/ftcid.c118
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/base/ftdbgmem.c998
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/base/ftdebug.c266
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/base/ftfntfmt.c55
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/base/ftfstype.c62
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/base/ftgasp.c61
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/base/ftgloadr.c406
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/base/ftglyph.c629
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/base/ftgxval.c142
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/base/ftinit.c286
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/base/ftlcdfil.c398
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/base/ftmac.c1080
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/base/ftmm.c234
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/base/ftobjs.c4933
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/base/ftotval.c91
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/base/ftoutln.c1099
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/base/ftpatent.c287
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/base/ftpfr.c153
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/base/ftpic.c55
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/base/ftrfork.c880
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/base/ftsnames.c94
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/base/ftstream.c860
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/base/ftstroke.c2468
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/base/ftsynth.c163
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/base/ftsystem.c320
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/base/fttrigon.c525
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/base/fttype1.c127
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/base/ftutil.c441
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/base/ftwinfnt.c53
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/base/md5.c296
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/base/md5.h45
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/cff/Jamfile45
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/cff/cf2arrst.c241
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/cff/cf2arrst.h100
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/cff/cf2blues.c579
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/cff/cf2blues.h185
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/cff/cf2error.c52
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/cff/cf2error.h119
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/cff/cf2fixed.h95
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/cff/cf2font.c512
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/cff/cf2font.h121
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/cff/cf2ft.c700
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/cff/cf2ft.h147
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/cff/cf2glue.h144
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/cff/cf2hints.c1847
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/cff/cf2hints.h289
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/cff/cf2intrp.c1571
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/cff/cf2intrp.h83
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/cff/cf2read.c112
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/cff/cf2read.h68
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/cff/cf2stack.c205
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/cff/cf2stack.h106
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/cff/cf2types.h78
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/cff/cff.c41
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/cff/cffcmap.c216
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/cff/cffcmap.h67
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/cff/cffdrivr.c907
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/cff/cffdrivr.h38
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/cff/cfferrs.h42
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/cff/cffgload.c3086
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/cff/cffgload.h245
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/cff/cffload.c1703
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/cff/cffload.h83
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/cff/cffobjs.c1077
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/cff/cffobjs.h185
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/cff/cffparse.c1193
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/cff/cffparse.h106
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/cff/cffpic.c138
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/cff/cffpic.h108
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/cff/cfftoken.h97
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/cff/cfftypes.h284
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/cid/Jamfile34
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/cid/ciderrs.h41
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/cid/cidgload.c446
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/cid/cidgload.h51
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/cid/cidload.c705
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/cid/cidload.h53
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/cid/cidobjs.c492
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/cid/cidobjs.h154
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/cid/cidparse.c234
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/cid/cidparse.h123
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/cid/cidriver.c236
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/cid/cidriver.h43
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/cid/cidtoken.h112
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/cid/type1cid.c29
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/psaux/Jamfile35
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/psaux/afmparse.c977
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/psaux/afmparse.h89
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/psaux/psaux.c34
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/psaux/psauxerr.h42
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/psaux/psauxmod.c139
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/psaux/psauxmod.h42
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/psaux/psconv.c603
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/psaux/psconv.h71
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/psaux/psobjs.c1774
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/psaux/psobjs.h212
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/psaux/t1cmap.c355
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/psaux/t1cmap.h105
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/psaux/t1decode.c1624
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/psaux/t1decode.h64
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/pshinter/Jamfile34
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/pshinter/pshalgo.c2195
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/pshinter/pshalgo.h241
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/pshinter/pshglob.c795
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/pshinter/pshglob.h196
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/pshinter/pshinter.c29
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/pshinter/pshmod.c119
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/pshinter/pshmod.h39
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/pshinter/pshnterr.h41
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/pshinter/pshpic.c76
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/pshinter/pshpic.h63
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/pshinter/pshrec.c1220
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/pshinter/pshrec.h172
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/psnames/Jamfile31
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/psnames/psmodule.c609
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/psnames/psmodule.h38
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/psnames/psnamerr.h42
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/psnames/psnames.c26
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/psnames/pspic.c97
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/psnames/pspic.h68
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/psnames/pstables.h4170
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/raster/Jamfile32
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/raster/ftmisc.h142
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/raster/ftraster.c3200
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/raster/ftraster.h46
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/raster/ftrend1.c254
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/raster/ftrend1.h38
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/raster/raster.c27
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/raster/rasterrs.h42
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/raster/rastpic.c89
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/raster/rastpic.h63
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/sfnt/Jamfile40
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/sfnt/pngshim.c378
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/sfnt/pngshim.h50
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/sfnt/sfdriver.c531
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/sfnt/sfdriver.h38
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/sfnt/sferrors.h40
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/sfnt/sfnt.c43
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/sfnt/sfntpic.c143
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/sfnt/sfntpic.h112
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/sfnt/sfobjs.c1603
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/sfnt/sfobjs.h59
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/sfnt/ttbdf.c250
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/sfnt/ttbdf.h46
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/sfnt/ttcmap.c3721
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/sfnt/ttcmap.h158
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/sfnt/ttcmapc.h56
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/sfnt/ttkern.c306
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/sfnt/ttkern.h52
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/sfnt/ttload.c1363
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/sfnt/ttload.h112
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/sfnt/ttmtx.c280
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/sfnt/ttmtx.h55
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/sfnt/ttpost.c563
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/sfnt/ttpost.h46
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/sfnt/ttsbit.c1472
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/sfnt/ttsbit.h63
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/smooth/Jamfile32
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/smooth/ftgrays.c2116
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/smooth/ftgrays.h58
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/smooth/ftsmerrs.h42
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/smooth/ftsmooth.c511
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/smooth/ftsmooth.h49
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/smooth/ftspic.c118
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/smooth/ftspic.h75
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/smooth/smooth.c27
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/truetype/Jamfile37
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/truetype/truetype.c38
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/truetype/ttdriver.c565
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/truetype/ttdriver.h38
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/truetype/tterrors.h41
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/truetype/ttgload.c2563
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/truetype/ttgload.h62
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/truetype/ttgxvar.c2074
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/truetype/ttgxvar.h182
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/truetype/ttinterp.c8275
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/truetype/ttinterp.h388
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/truetype/ttobjs.c1359
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/truetype/ttobjs.h425
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/truetype/ttpic.c101
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/truetype/ttpic.h83
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/truetype/ttpload.c609
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/truetype/ttpload.h75
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/truetype/ttsubpix.c1011
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/truetype/ttsubpix.h110
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/type1/Jamfile35
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/type1/t1afm.c396
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/type1/t1afm.h54
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/type1/t1driver.c725
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/type1/t1driver.h42
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/type1/t1errors.h41
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/type1/t1gload.c521
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/type1/t1gload.h53
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/type1/t1load.c2320
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/type1/t1load.h102
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/type1/t1objs.c613
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/type1/t1objs.h160
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/type1/t1parse.c525
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/type1/t1parse.h129
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/type1/t1tokens.h143
-rw-r--r--chromium/third_party/pdfium/third_party/freetype/src/type1/type1.c33
-rw-r--r--chromium/third_party/pdfium/third_party/lcms2-2.6/src/cmserr.c4
-rw-r--r--chromium/third_party/pdfium/third_party/libjpeg/cderror.h132
-rw-r--r--chromium/third_party/pdfium/third_party/libjpeg/cdjpeg.h184
-rw-r--r--chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jcapimin.c280
-rw-r--r--chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jcapistd.c161
-rw-r--r--chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jccoefct.c449
-rw-r--r--chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jccolor.c459
-rw-r--r--chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jcdctmgr.c387
-rw-r--r--chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jchuff.c908
-rw-r--r--chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jcinit.c72
-rw-r--r--chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jcmainct.c293
-rw-r--r--chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jcmarker.c664
-rw-r--r--chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jcmaster.c590
-rw-r--r--chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jcomapi.c106
-rw-r--r--chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jcparam.c610
-rw-r--r--chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jcphuff.c833
-rw-r--r--chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jcprepct.c354
-rw-r--r--chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jcsample.c519
-rw-r--r--chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jctrans.c388
-rw-r--r--chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jdapimin.c395
-rw-r--r--chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jdapistd.c276
-rw-r--r--chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jdcoefct.c736
-rw-r--r--chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jdcolor.c396
-rw-r--r--chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jddctmgr.c269
-rw-r--r--chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jdhuff.c650
-rw-r--r--chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jdinput.c381
-rw-r--r--chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jdmainct.c512
-rw-r--r--chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jdmarker.c1393
-rw-r--r--chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jdmaster.c557
-rw-r--r--chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jdmerge.c399
-rw-r--r--chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jdphuff.c668
-rw-r--r--chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jdpostct.c290
-rw-r--r--chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jdsample.c478
-rw-r--r--chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jdtrans.c143
-rw-r--r--chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jerror.c239
-rw-r--r--chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jfdctfst.c224
-rw-r--r--chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jfdctint.c283
-rw-r--r--chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jidctfst.c368
-rw-r--r--chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jidctint.c389
-rw-r--r--chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jidctred.c398
-rw-r--r--chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jmemmgr.c1120
-rw-r--r--chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jmemnobs.c115
-rw-r--r--chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jutils.c179
-rw-r--r--chromium/third_party/pdfium/third_party/libjpeg/jchuff.h47
-rw-r--r--chromium/third_party/pdfium/third_party/libjpeg/jconfig.h51
-rw-r--r--chromium/third_party/pdfium/third_party/libjpeg/jdct.h176
-rw-r--r--chromium/third_party/pdfium/third_party/libjpeg/jdhuff.h201
-rw-r--r--chromium/third_party/pdfium/third_party/libjpeg/jerror.h291
-rw-r--r--chromium/third_party/pdfium/third_party/libjpeg/jinclude.h103
-rw-r--r--chromium/third_party/pdfium/third_party/libjpeg/jmemsys.h163
-rw-r--r--chromium/third_party/pdfium/third_party/libjpeg/jmorecfg.h372
-rw-r--r--chromium/third_party/pdfium/third_party/libjpeg/jpegint.h392
-rw-r--r--chromium/third_party/pdfium/third_party/libjpeg/jpeglib.h1200
-rw-r--r--chromium/third_party/pdfium/third_party/libjpeg/jversion.h14
-rw-r--r--chromium/third_party/pdfium/third_party/libjpeg/transupp.h135
-rw-r--r--chromium/third_party/pdfium/third_party/libopenjpeg20/0029-avoid-division-by-0.patch119
-rw-r--r--chromium/third_party/pdfium/third_party/libopenjpeg20/README.pdfium1
-rw-r--r--chromium/third_party/pdfium/third_party/libopenjpeg20/pi.c61
-rw-r--r--chromium/third_party/pdfium/third_party/libpng16/0000-build-config.patch12
-rw-r--r--chromium/third_party/pdfium/third_party/libpng16/pngstruct.h2
-rw-r--r--chromium/third_party/pdfium/third_party/libtiff/0000-build-config.patch26
-rw-r--r--chromium/third_party/pdfium/third_party/libtiff/0002-CVE-2015-8665-8683.patch114
-rw-r--r--chromium/third_party/pdfium/third_party/libtiff/0003-CVE-2015-8781-8782-8783.patch172
-rw-r--r--chromium/third_party/pdfium/third_party/libtiff/0004-CVE-2015-8784.patch50
-rw-r--r--chromium/third_party/pdfium/third_party/libtiff/0006-HeapBufferOverflow-ChopUpSingleUncompressedStrip.patch8
-rw-r--r--chromium/third_party/pdfium/third_party/libtiff/0009-HeapBufferOverflow-PixarLogDecode.patch33
-rw-r--r--chromium/third_party/pdfium/third_party/libtiff/0011-fix-leak-imagebegin2.patch63
-rw-r--r--chromium/third_party/pdfium/third_party/libtiff/0015-fix-leaks-in-tif_ojpeg.patch74
-rw-r--r--chromium/third_party/pdfium/third_party/libtiff/0016-fix-leak-in-pixarlogsetupdecode.patch24
-rw-r--r--chromium/third_party/pdfium/third_party/libtiff/0017-safe_skews_in_gtTileContig.patch84
-rw-r--r--chromium/third_party/pdfium/third_party/libtiff/0018-fix-leak-in-PredictorSetupDecode.patch44
-rw-r--r--chromium/third_party/pdfium/third_party/libtiff/0019-fix-invalid-reads-TIFFFetchNormalTag.patch28
-rw-r--r--chromium/third_party/pdfium/third_party/libtiff/0019-oom-TIFFReadDirEntryArray.patch81
-rw-r--r--chromium/third_party/pdfium/third_party/libtiff/0020-unreasonable-td-bitspersample.patch22
-rw-r--r--chromium/third_party/pdfium/third_party/libtiff/0020-upstream-security-fixes.patch270
-rw-r--r--chromium/third_party/pdfium/third_party/libtiff/0021-fix-leaks-ojpegreaderinfosectables.patch31
-rw-r--r--chromium/third_party/pdfium/third_party/libtiff/0021-oom-TIFFFillStrip.patch18
-rw-r--r--chromium/third_party/pdfium/third_party/libtiff/README.pdfium13
-rw-r--r--chromium/third_party/pdfium/third_party/libtiff/tif_aux.c33
-rw-r--r--chromium/third_party/pdfium/third_party/libtiff/tif_close.c12
-rw-r--r--chromium/third_party/pdfium/third_party/libtiff/tif_color.c22
-rw-r--r--chromium/third_party/pdfium/third_party/libtiff/tif_compress.c8
-rw-r--r--chromium/third_party/pdfium/third_party/libtiff/tif_dir.c138
-rw-r--r--chromium/third_party/pdfium/third_party/libtiff/tif_dirinfo.c40
-rw-r--r--chromium/third_party/pdfium/third_party/libtiff/tif_dirread.c134
-rw-r--r--chromium/third_party/pdfium/third_party/libtiff/tif_dirwrite.c78
-rw-r--r--chromium/third_party/pdfium/third_party/libtiff/tif_dumpmode.c4
-rw-r--r--chromium/third_party/pdfium/third_party/libtiff/tif_extension.c38
-rw-r--r--chromium/third_party/pdfium/third_party/libtiff/tif_fax3.c63
-rw-r--r--chromium/third_party/pdfium/third_party/libtiff/tif_fax3.h6
-rw-r--r--chromium/third_party/pdfium/third_party/libtiff/tif_getimage.c186
-rw-r--r--chromium/third_party/pdfium/third_party/libtiff/tif_jpeg.c33
-rw-r--r--chromium/third_party/pdfium/third_party/libtiff/tif_luv.c64
-rw-r--r--chromium/third_party/pdfium/third_party/libtiff/tif_lzw.c56
-rw-r--r--chromium/third_party/pdfium/third_party/libtiff/tif_next.c10
-rw-r--r--chromium/third_party/pdfium/third_party/libtiff/tif_ojpeg.c87
-rw-r--r--chromium/third_party/pdfium/third_party/libtiff/tif_open.c8
-rw-r--r--chromium/third_party/pdfium/third_party/libtiff/tif_packbits.c15
-rw-r--r--chromium/third_party/pdfium/third_party/libtiff/tif_pixarlog.c187
-rw-r--r--chromium/third_party/pdfium/third_party/libtiff/tif_predict.c176
-rw-r--r--chromium/third_party/pdfium/third_party/libtiff/tif_predict.h8
-rw-r--r--chromium/third_party/pdfium/third_party/libtiff/tif_print.c14
-rw-r--r--chromium/third_party/pdfium/third_party/libtiff/tif_read.c74
-rw-r--r--chromium/third_party/pdfium/third_party/libtiff/tif_strip.c2
-rw-r--r--chromium/third_party/pdfium/third_party/libtiff/tif_swab.c8
-rw-r--r--chromium/third_party/pdfium/third_party/libtiff/tif_thunder.c5
-rw-r--r--chromium/third_party/pdfium/third_party/libtiff/tif_write.c53
-rw-r--r--chromium/third_party/pdfium/third_party/libtiff/tif_zip.c16
-rw-r--r--chromium/third_party/pdfium/third_party/libtiff/tiff.h6
-rw-r--r--chromium/third_party/pdfium/third_party/libtiff/tiffio.h6
-rw-r--r--chromium/third_party/pdfium/third_party/libtiff/tiffiop.h56
-rw-r--r--chromium/third_party/pdfium/third_party/libtiff/tiffvers.h4
-rw-r--r--chromium/third_party/pdfium/third_party/libtiff/uvcode.h2
-rw-r--r--chromium/third_party/pdfium/third_party/yasm/BUILD.gn547
-rw-r--r--chromium/third_party/pdfium/third_party/yasm/CHROMIUM.diff20
-rw-r--r--chromium/third_party/pdfium/third_party/yasm/OWNERS1
-rw-r--r--chromium/third_party/pdfium/third_party/yasm/README.pdfium142
-rw-r--r--chromium/third_party/pdfium/third_party/yasm/run_yasm.py51
-rw-r--r--chromium/third_party/pdfium/third_party/yasm/source/config/android/Makefile3822
-rw-r--r--chromium/third_party/pdfium/third_party/yasm/source/config/android/config.h173
-rw-r--r--chromium/third_party/pdfium/third_party/yasm/source/config/android/libyasm-stdint.h9
-rw-r--r--chromium/third_party/pdfium/third_party/yasm/source/config/ios/Makefile3822
-rw-r--r--chromium/third_party/pdfium/third_party/yasm/source/config/ios/config.h173
-rw-r--r--chromium/third_party/pdfium/third_party/yasm/source/config/ios/libyasm-stdint.h9
-rw-r--r--chromium/third_party/pdfium/third_party/yasm/source/config/linux/Makefile3822
-rw-r--r--chromium/third_party/pdfium/third_party/yasm/source/config/linux/config.h173
-rw-r--r--chromium/third_party/pdfium/third_party/yasm/source/config/linux/libyasm-stdint.h9
-rw-r--r--chromium/third_party/pdfium/third_party/yasm/source/config/mac/Makefile3822
-rw-r--r--chromium/third_party/pdfium/third_party/yasm/source/config/mac/config.h173
-rw-r--r--chromium/third_party/pdfium/third_party/yasm/source/config/mac/libyasm-stdint.h9
-rw-r--r--chromium/third_party/pdfium/third_party/yasm/source/config/openbsd/Makefile3822
-rw-r--r--chromium/third_party/pdfium/third_party/yasm/source/config/openbsd/config.h165
-rw-r--r--chromium/third_party/pdfium/third_party/yasm/source/config/openbsd/libyasm-stdint.h9
-rw-r--r--chromium/third_party/pdfium/third_party/yasm/source/config/win/Makefile3822
-rw-r--r--chromium/third_party/pdfium/third_party/yasm/source/config/win/config.h173
-rw-r--r--chromium/third_party/pdfium/third_party/yasm/source/config/win/libyasm-stdint.h9
-rw-r--r--chromium/third_party/pdfium/third_party/yasm/source/config/win/stdint.h30
-rw-r--r--chromium/third_party/pdfium/third_party/yasm/yasm_assemble.gni196
-rw-r--r--chromium/third_party/pdfium/third_party/zlib_v128/adler32.c179
-rw-r--r--chromium/third_party/pdfium/third_party/zlib_v128/compress.c80
-rw-r--r--chromium/third_party/pdfium/third_party/zlib_v128/crc32.c425
-rw-r--r--chromium/third_party/pdfium/third_party/zlib_v128/crc32.h441
-rw-r--r--chromium/third_party/pdfium/third_party/zlib_v128/deflate.c1966
-rw-r--r--chromium/third_party/pdfium/third_party/zlib_v128/deflate.h346
-rw-r--r--chromium/third_party/pdfium/third_party/zlib_v128/gzclose.c25
-rw-r--r--chromium/third_party/pdfium/third_party/zlib_v128/gzguts.h217
-rw-r--r--chromium/third_party/pdfium/third_party/zlib_v128/gzlib.c634
-rw-r--r--chromium/third_party/pdfium/third_party/zlib_v128/gzread.c594
-rw-r--r--chromium/third_party/pdfium/third_party/zlib_v128/gzwrite.c576
-rw-r--r--chromium/third_party/pdfium/third_party/zlib_v128/infback.c640
-rw-r--r--chromium/third_party/pdfium/third_party/zlib_v128/inffast.c340
-rw-r--r--chromium/third_party/pdfium/third_party/zlib_v128/inffast.h11
-rw-r--r--chromium/third_party/pdfium/third_party/zlib_v128/inffixed.h94
-rw-r--r--chromium/third_party/pdfium/third_party/zlib_v128/inflate.c1513
-rw-r--r--chromium/third_party/pdfium/third_party/zlib_v128/inflate.h122
-rw-r--r--chromium/third_party/pdfium/third_party/zlib_v128/inftrees.c306
-rw-r--r--chromium/third_party/pdfium/third_party/zlib_v128/inftrees.h62
-rw-r--r--chromium/third_party/pdfium/third_party/zlib_v128/trees.c1226
-rw-r--r--chromium/third_party/pdfium/third_party/zlib_v128/trees.h129
-rw-r--r--chromium/third_party/pdfium/third_party/zlib_v128/uncompr.c59
-rw-r--r--chromium/third_party/pdfium/third_party/zlib_v128/zconf.h519
-rw-r--r--chromium/third_party/pdfium/third_party/zlib_v128/zlib.h1839
-rw-r--r--chromium/third_party/pdfium/third_party/zlib_v128/zutil.c341
-rw-r--r--chromium/third_party/pdfium/third_party/zlib_v128/zutil.h255
-rw-r--r--chromium/third_party/pdfium/xfa/DEPS1
-rw-r--r--chromium/third_party/pdfium/xfa/fde/cfde_brush.h23
-rw-r--r--chromium/third_party/pdfium/xfa/fde/cfde_path.cpp53
-rw-r--r--chromium/third_party/pdfium/xfa/fde/cfde_path.h10
-rw-r--r--chromium/third_party/pdfium/xfa/fde/cfde_pen.h24
-rw-r--r--chromium/third_party/pdfium/xfa/fde/cfde_rendercontext.cpp128
-rw-r--r--chromium/third_party/pdfium/xfa/fde/cfde_rendercontext.h50
-rw-r--r--chromium/third_party/pdfium/xfa/fde/cfde_renderdevice.cpp354
-rw-r--r--chromium/third_party/pdfium/xfa/fde/cfde_renderdevice.h127
-rw-r--r--chromium/third_party/pdfium/xfa/fde/cfde_textout.cpp790
-rw-r--r--chromium/third_party/pdfium/xfa/fde/cfde_textout.h175
-rw-r--r--chromium/third_party/pdfium/xfa/fde/cfde_txtedtbuf.cpp40
-rw-r--r--chromium/third_party/pdfium/xfa/fde/cfde_txtedtbuf.h14
-rw-r--r--chromium/third_party/pdfium/xfa/fde/cfde_txtedtbuf_unittest.cpp4
-rw-r--r--chromium/third_party/pdfium/xfa/fde/cfde_txtedtdorecord_insert.cpp6
-rw-r--r--chromium/third_party/pdfium/xfa/fde/cfde_txtedtdorecord_insert.h2
-rw-r--r--chromium/third_party/pdfium/xfa/fde/cfde_txtedtengine.cpp443
-rw-r--r--chromium/third_party/pdfium/xfa/fde/cfde_txtedtengine.h30
-rw-r--r--chromium/third_party/pdfium/xfa/fde/cfde_txtedtpage.cpp110
-rw-r--r--chromium/third_party/pdfium/xfa/fde/cfde_txtedtpage.h54
-rw-r--r--chromium/third_party/pdfium/xfa/fde/cfde_txtedtparag.cpp73
-rw-r--r--chromium/third_party/pdfium/xfa/fde/cfde_txtedttextset.cpp9
-rw-r--r--chromium/third_party/pdfium/xfa/fde/cfde_txtedttextset.h17
-rw-r--r--chromium/third_party/pdfium/xfa/fde/cfde_visualsetiterator.cpp94
-rw-r--r--chromium/third_party/pdfium/xfa/fde/cfde_visualsetiterator.h40
-rw-r--r--chromium/third_party/pdfium/xfa/fde/cfx_chariter.cpp51
-rw-r--r--chromium/third_party/pdfium/xfa/fde/cfx_chariter.h31
-rw-r--r--chromium/third_party/pdfium/xfa/fde/cfx_wordbreak.cpp2946
-rw-r--r--chromium/third_party/pdfium/xfa/fde/cfx_wordbreak.h39
-rw-r--r--chromium/third_party/pdfium/xfa/fde/css/cfde_csscomputedstyle.cpp12
-rw-r--r--chromium/third_party/pdfium/xfa/fde/css/cfde_csscomputedstyle.h18
-rw-r--r--chromium/third_party/pdfium/xfa/fde/css/cfde_cssdeclaration.cpp38
-rw-r--r--chromium/third_party/pdfium/xfa/fde/css/cfde_cssdeclaration.h20
-rw-r--r--chromium/third_party/pdfium/xfa/fde/css/cfde_cssdeclaration_unittest.cpp7
-rw-r--r--chromium/third_party/pdfium/xfa/fde/css/cfde_cssnumbervalue.cpp6
-rw-r--r--chromium/third_party/pdfium/xfa/fde/css/cfde_cssnumbervalue.h8
-rw-r--r--chromium/third_party/pdfium/xfa/fde/css/cfde_cssselector.cpp18
-rw-r--r--chromium/third_party/pdfium/xfa/fde/css/cfde_cssselector.h2
-rw-r--r--chromium/third_party/pdfium/xfa/fde/css/cfde_cssstyleselector.cpp22
-rw-r--r--chromium/third_party/pdfium/xfa/fde/css/cfde_cssstyleselector.h8
-rw-r--r--chromium/third_party/pdfium/xfa/fde/css/cfde_cssstylesheet.cpp4
-rw-r--r--chromium/third_party/pdfium/xfa/fde/css/cfde_cssstylesheet.h4
-rw-r--r--chromium/third_party/pdfium/xfa/fde/css/cfde_cssstylesheet_unittest.cpp10
-rw-r--r--chromium/third_party/pdfium/xfa/fde/css/cfde_csssyntaxparser.cpp12
-rw-r--r--chromium/third_party/pdfium/xfa/fde/css/cfde_csssyntaxparser.h4
-rw-r--r--chromium/third_party/pdfium/xfa/fde/css/cfde_csstextbuf.cpp14
-rw-r--r--chromium/third_party/pdfium/xfa/fde/css/cfde_csstextbuf.h16
-rw-r--r--chromium/third_party/pdfium/xfa/fde/css/cfde_cssvaluelistparser.cpp12
-rw-r--r--chromium/third_party/pdfium/xfa/fde/css/cfde_cssvaluelistparser.h14
-rw-r--r--chromium/third_party/pdfium/xfa/fde/css/cfde_cssvaluelistparser_unittest.cpp19
-rw-r--r--chromium/third_party/pdfium/xfa/fde/css/fde_css.h15
-rw-r--r--chromium/third_party/pdfium/xfa/fde/css/fde_cssdatatable.h4
-rw-r--r--chromium/third_party/pdfium/xfa/fde/fde_gedevice.cpp355
-rw-r--r--chromium/third_party/pdfium/xfa/fde/fde_gedevice.h127
-rw-r--r--chromium/third_party/pdfium/xfa/fde/fde_iterator.cpp98
-rw-r--r--chromium/third_party/pdfium/xfa/fde/fde_iterator.h37
-rw-r--r--chromium/third_party/pdfium/xfa/fde/fde_object.h37
-rw-r--r--chromium/third_party/pdfium/xfa/fde/fde_render.cpp128
-rw-r--r--chromium/third_party/pdfium/xfa/fde/fde_render.h49
-rw-r--r--chromium/third_party/pdfium/xfa/fde/fde_visualset.h72
-rw-r--r--chromium/third_party/pdfium/xfa/fde/ifde_txtedtengine.h19
-rw-r--r--chromium/third_party/pdfium/xfa/fde/ifde_txtedtpage.h43
-rw-r--r--chromium/third_party/pdfium/xfa/fde/ifde_visualset.h49
-rw-r--r--chromium/third_party/pdfium/xfa/fde/ifx_chariter.h24
-rw-r--r--chromium/third_party/pdfium/xfa/fde/tto/fde_textout.cpp876
-rw-r--r--chromium/third_party/pdfium/xfa/fde/tto/fde_textout.h185
-rw-r--r--chromium/third_party/pdfium/xfa/fde/xml/cfde_xmlattributenode.cpp35
-rw-r--r--chromium/third_party/pdfium/xfa/fde/xml/cfde_xmlattributenode.h44
-rw-r--r--chromium/third_party/pdfium/xfa/fde/xml/cfde_xmlchardata.cpp22
-rw-r--r--chromium/third_party/pdfium/xfa/fde/xml/cfde_xmlchardata.h24
-rw-r--r--chromium/third_party/pdfium/xfa/fde/xml/cfde_xmldoc.cpp159
-rw-r--r--chromium/third_party/pdfium/xfa/fde/xml/cfde_xmldoc.h37
-rw-r--r--chromium/third_party/pdfium/xfa/fde/xml/cfde_xmlelement.cpp102
-rw-r--r--chromium/third_party/pdfium/xfa/fde/xml/cfde_xmlelement.h33
-rw-r--r--chromium/third_party/pdfium/xfa/fde/xml/cfde_xmlinstruction.cpp36
-rw-r--r--chromium/third_party/pdfium/xfa/fde/xml/cfde_xmlinstruction.h35
-rw-r--r--chromium/third_party/pdfium/xfa/fde/xml/cfde_xmlnode.cpp440
-rw-r--r--chromium/third_party/pdfium/xfa/fde/xml/cfde_xmlnode.h75
-rw-r--r--chromium/third_party/pdfium/xfa/fde/xml/cfde_xmlparser.cpp170
-rw-r--r--chromium/third_party/pdfium/xfa/fde/xml/cfde_xmlparser.h47
-rw-r--r--chromium/third_party/pdfium/xfa/fde/xml/cfde_xmlsyntaxparser.cpp696
-rw-r--r--chromium/third_party/pdfium/xfa/fde/xml/cfde_xmlsyntaxparser.h127
-rw-r--r--chromium/third_party/pdfium/xfa/fde/xml/cfde_xmlsyntaxparser_unittest.cpp527
-rw-r--r--chromium/third_party/pdfium/xfa/fde/xml/cfde_xmltext.cpp22
-rw-r--r--chromium/third_party/pdfium/xfa/fde/xml/cfde_xmltext.h31
-rw-r--r--chromium/third_party/pdfium/xfa/fde/xml/cfx_saxreader.cpp739
-rw-r--r--chromium/third_party/pdfium/xfa/fde/xml/cfx_saxreader.h146
-rw-r--r--chromium/third_party/pdfium/xfa/fde/xml/fde_xml.h45
-rw-r--r--chromium/third_party/pdfium/xfa/fde/xml/fde_xml_imp.cpp1897
-rw-r--r--chromium/third_party/pdfium/xfa/fde/xml/fde_xml_imp.h344
-rw-r--r--chromium/third_party/pdfium/xfa/fde/xml/fde_xml_imp_unittest.cpp632
-rw-r--r--chromium/third_party/pdfium/xfa/fgas/crt/cfgas_formatstring.cpp2739
-rw-r--r--chromium/third_party/pdfium/xfa/fgas/crt/cfgas_formatstring.h76
-rw-r--r--chromium/third_party/pdfium/xfa/fgas/crt/fgas_codepage.cpp410
-rw-r--r--chromium/third_party/pdfium/xfa/fgas/crt/fgas_codepage.h12
-rw-r--r--chromium/third_party/pdfium/xfa/fgas/crt/fgas_stream.cpp1483
-rw-r--r--chromium/third_party/pdfium/xfa/fgas/crt/fgas_stream.h69
-rw-r--r--chromium/third_party/pdfium/xfa/fgas/crt/fgas_utils.cpp401
-rw-r--r--chromium/third_party/pdfium/xfa/fgas/crt/fgas_utils.h173
-rw-r--r--chromium/third_party/pdfium/xfa/fgas/crt/ifgas_stream.cpp593
-rw-r--r--chromium/third_party/pdfium/xfa/fgas/crt/ifgas_stream.h44
-rw-r--r--chromium/third_party/pdfium/xfa/fgas/font/DEPS3
-rw-r--r--chromium/third_party/pdfium/xfa/fgas/font/cfgas_fontmgr.cpp214
-rw-r--r--chromium/third_party/pdfium/xfa/fgas/font/cfgas_fontmgr.h53
-rw-r--r--chromium/third_party/pdfium/xfa/fgas/font/cfgas_gefont.cpp85
-rw-r--r--chromium/third_party/pdfium/xfa/fgas/font/cfgas_gefont.h32
-rw-r--r--chromium/third_party/pdfium/xfa/fgas/font/fgas_fontutils.cpp313
-rw-r--r--chromium/third_party/pdfium/xfa/fgas/font/fgas_fontutils.h6
-rw-r--r--chromium/third_party/pdfium/xfa/fgas/layout/cfx_break.cpp201
-rw-r--r--chromium/third_party/pdfium/xfa/fgas/layout/cfx_break.h91
-rw-r--r--chromium/third_party/pdfium/xfa/fgas/layout/cfx_breakline.cpp55
-rw-r--r--chromium/third_party/pdfium/xfa/fgas/layout/cfx_breakline.h39
-rw-r--r--chromium/third_party/pdfium/xfa/fgas/layout/cfx_breakpiece.cpp52
-rw-r--r--chromium/third_party/pdfium/xfa/fgas/layout/cfx_breakpiece.h45
-rw-r--r--chromium/third_party/pdfium/xfa/fgas/layout/fgas_linebreak.h1
-rw-r--r--chromium/third_party/pdfium/xfa/fgas/layout/fgas_rtfbreak.cpp601
-rw-r--r--chromium/third_party/pdfium/xfa/fgas/layout/fgas_rtfbreak.h183
-rw-r--r--chromium/third_party/pdfium/xfa/fgas/layout/fgas_rtfbreak_unittest.cpp87
-rw-r--r--chromium/third_party/pdfium/xfa/fgas/layout/fgas_textbreak.cpp1168
-rw-r--r--chromium/third_party/pdfium/xfa/fgas/layout/fgas_textbreak.h280
-rw-r--r--chromium/third_party/pdfium/xfa/fgas/localization/fgas_datetime.cpp550
-rw-r--r--chromium/third_party/pdfium/xfa/fgas/localization/fgas_datetime.h375
-rw-r--r--chromium/third_party/pdfium/xfa/fgas/localization/fgas_locale.cpp4766
-rw-r--r--chromium/third_party/pdfium/xfa/fgas/localization/fgas_locale.h146
-rw-r--r--chromium/third_party/pdfium/xfa/fgas/localization/fgas_localeimp.h89
-rw-r--r--chromium/third_party/pdfium/xfa/fwl/cfwl_barcode.cpp8
-rw-r--r--chromium/third_party/pdfium/xfa/fwl/cfwl_barcode.h15
-rw-r--r--chromium/third_party/pdfium/xfa/fwl/cfwl_checkbox.cpp8
-rw-r--r--chromium/third_party/pdfium/xfa/fwl/cfwl_checkbox.h4
-rw-r--r--chromium/third_party/pdfium/xfa/fwl/cfwl_combobox.cpp16
-rw-r--r--chromium/third_party/pdfium/xfa/fwl/cfwl_datetimepicker.cpp6
-rw-r--r--chromium/third_party/pdfium/xfa/fwl/cfwl_datetimepicker.h2
-rw-r--r--chromium/third_party/pdfium/xfa/fwl/cfwl_edit.cpp142
-rw-r--r--chromium/third_party/pdfium/xfa/fwl/cfwl_edit.h22
-rw-r--r--chromium/third_party/pdfium/xfa/fwl/cfwl_eventscroll.h2
-rw-r--r--chromium/third_party/pdfium/xfa/fwl/cfwl_form.cpp6
-rw-r--r--chromium/third_party/pdfium/xfa/fwl/cfwl_form.h4
-rw-r--r--chromium/third_party/pdfium/xfa/fwl/cfwl_listbox.cpp45
-rw-r--r--chromium/third_party/pdfium/xfa/fwl/cfwl_listbox.h18
-rw-r--r--chromium/third_party/pdfium/xfa/fwl/cfwl_monthcalendar.cpp39
-rw-r--r--chromium/third_party/pdfium/xfa/fwl/cfwl_monthcalendar.h3
-rw-r--r--chromium/third_party/pdfium/xfa/fwl/cfwl_pushbutton.cpp2
-rw-r--r--chromium/third_party/pdfium/xfa/fwl/cfwl_scrollbar.cpp36
-rw-r--r--chromium/third_party/pdfium/xfa/fwl/cfwl_scrollbar.h40
-rw-r--r--chromium/third_party/pdfium/xfa/fwl/cfwl_themebackground.h11
-rw-r--r--chromium/third_party/pdfium/xfa/fwl/cfwl_timer.cpp2
-rw-r--r--chromium/third_party/pdfium/xfa/fwl/cfwl_widget.cpp41
-rw-r--r--chromium/third_party/pdfium/xfa/fwl/cfwl_widget.h18
-rw-r--r--chromium/third_party/pdfium/xfa/fwl/cfwl_widgetmgr.cpp12
-rw-r--r--chromium/third_party/pdfium/xfa/fwl/cfwl_widgetmgr.h4
-rw-r--r--chromium/third_party/pdfium/xfa/fwl/cfx_barcode.cpp45
-rw-r--r--chromium/third_party/pdfium/xfa/fwl/cfx_barcode.h9
-rw-r--r--chromium/third_party/pdfium/xfa/fwl/theme/cfwl_checkboxtp.cpp34
-rw-r--r--chromium/third_party/pdfium/xfa/fwl/theme/cfwl_checkboxtp.h2
-rw-r--r--chromium/third_party/pdfium/xfa/fwl/theme/cfwl_edittp.cpp6
-rw-r--r--chromium/third_party/pdfium/xfa/fwl/theme/cfwl_monthcalendartp.cpp2
-rw-r--r--chromium/third_party/pdfium/xfa/fwl/theme/cfwl_pushbuttontp.cpp4
-rw-r--r--chromium/third_party/pdfium/xfa/fwl/theme/cfwl_scrollbartp.cpp24
-rw-r--r--chromium/third_party/pdfium/xfa/fwl/theme/cfwl_widgettp.cpp24
-rw-r--r--chromium/third_party/pdfium/xfa/fwl/theme/cfwl_widgettp.h8
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/BC_Dimension.cpp46
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/BC_Dimension.h29
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/BC_Library.cpp36
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/BC_Library.h38
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/BC_TwoDimWriter.cpp153
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/BC_TwoDimWriter.h39
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/BC_UtilCodingConvert.cpp54
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/BC_UtilCodingConvert.h31
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/BC_Utils.cpp34
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/BC_Writer.cpp56
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/BC_Writer.h38
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/DEPS3
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/cbc_codabar.cpp109
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/cbc_codabar.h39
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/cbc_code128.cpp92
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/cbc_code128.h36
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/cbc_code39.cpp100
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/cbc_code39.h37
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/cbc_codebase.cpp58
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/cbc_codebase.h47
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/cbc_datamatrix.cpp66
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/cbc_datamatrix.h31
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/cbc_ean13.cpp96
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/cbc_ean13.h35
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/cbc_ean8.cpp95
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/cbc_ean8.h35
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/cbc_onecode.cpp78
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/cbc_onecode.h35
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/cbc_pdf417i.cpp76
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/cbc_pdf417i.h34
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/cbc_qrcode.cpp82
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/cbc_qrcode.h34
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/cbc_upca.cpp99
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/cbc_upca.h35
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/common/BC_CommonBitArray.cpp113
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/common/BC_CommonBitArray.h36
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/common/BC_CommonBitMatrix.cpp146
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/common/BC_CommonBitMatrix.h48
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/common/BC_CommonByteArray.cpp99
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/common/BC_CommonByteArray.h36
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/common/BC_CommonByteMatrix.cpp64
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/common/BC_CommonByteMatrix.h35
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomon.cpp108
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomon.h32
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp134
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.h47
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp259
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.h47
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_ASCIIEncoder.cpp98
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_ASCIIEncoder.h29
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_Base256Encoder.cpp87
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_Base256Encoder.h25
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_C40Encoder.cpp200
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_C40Encoder.h38
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_DataMatrixSymbolInfo144.cpp40
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_DataMatrixSymbolInfo144.h20
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_DataMatrixWriter.cpp143
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_DataMatrixWriter.h36
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_DefaultPlacement.cpp164
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_DefaultPlacement.h40
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_EdifactEncoder.cpp154
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_EdifactEncoder.h31
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_Encoder.cpp10
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_Encoder.h23
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_EncoderContext.cpp112
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_EncoderContext.h56
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_ErrorCorrection.cpp210
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_ErrorCorrection.h39
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp371
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.h79
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_SymbolInfo.cpp230
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_SymbolInfo.h79
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_SymbolShapeHint.cpp26
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_SymbolShapeHint.h22
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_TextEncoder.cpp99
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_TextEncoder.h22
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_X12Encoder.cpp101
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_X12Encoder.h26
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/oned/BC_OneDimWriter.cpp485
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/oned/BC_OneDimWriter.h118
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/oned/BC_OnedCodaBarWriter.cpp239
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/oned/BC_OnedCodaBarWriter.h58
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/oned/BC_OnedCode128Writer.cpp276
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/oned/BC_OnedCode128Writer.h53
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/oned/BC_OnedCode39Writer.cpp285
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/oned/BC_OnedCode39Writer.h54
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/oned/BC_OnedEAN13Writer.cpp309
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/oned/BC_OnedEAN13Writer.h60
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp272
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/oned/BC_OnedEAN8Writer.h64
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/oned/BC_OnedUPCAWriter.cpp290
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/oned/BC_OnedUPCAWriter.h66
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/pdf417/BC_PDF417.cpp584
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/pdf417/BC_PDF417.h68
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.cpp88
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.h40
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/pdf417/BC_PDF417BarcodeRow.cpp53
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/pdf417/BC_PDF417BarcodeRow.h29
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/pdf417/BC_PDF417Compaction.cpp26
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/pdf417/BC_PDF417Compaction.h18
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/pdf417/BC_PDF417ErrorCorrection.cpp191
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/pdf417/BC_PDF417ErrorCorrection.h28
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp430
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h75
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder_unittest.cpp231
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/pdf417/BC_PDF417Writer.cpp116
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/pdf417/BC_PDF417Writer.h36
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCodeWriter.cpp122
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCodeWriter.h45
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoder.cpp145
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoder.h63
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderBitVector.cpp127
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderBitVector.h35
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderBlockPair.cpp44
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderBlockPair.h28
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderECB.cpp35
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderECB.h24
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderECBlocks.cpp63
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderECBlocks.h32
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderEncoder.cpp971
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderEncoder.h140
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.cpp84
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.h41
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderMaskUtil.cpp198
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderMaskUtil.h27
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderMatrixUtil.cpp506
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderMatrixUtil.h87
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderMode.cpp174
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderMode.h53
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderVersion.cpp794
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderVersion.h55
-rw-r--r--chromium/third_party/pdfium/xfa/fxbarcode/utils.h169
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/DEPS3
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/DEPS3
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/cxfa_eventparam.cpp48
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/cxfa_linkuserdata.cpp2
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/cxfa_linkuserdata.h6
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/cxfa_loadercontext.cpp4
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/cxfa_loadercontext.h14
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/cxfa_pieceline.h2
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/cxfa_textlayout.cpp282
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/cxfa_textlayout.h38
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/cxfa_textparsecontext.h2
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/cxfa_textparser.cpp88
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/cxfa_textparser.h23
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/cxfa_texttabstopscontext.cpp24
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/cxfa_texttabstopscontext.h17
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/cxfa_textuserdata.h2
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_checksum.cpp271
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffapp.cpp162
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffapp_unittest.cpp87
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffbarcode.cpp8
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffbarcode.h6
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffcheckbutton.cpp20
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffcheckbutton.h4
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffchoicelist.cpp115
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffchoicelist.h10
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffdoc.cpp441
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffdochandler.cpp60
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffdocview.cpp850
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffdraw.cpp8
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffdraw.h4
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffexclgroup.cpp8
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffexclgroup.h4
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_fffield.cpp31
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_fffield.h4
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffimage.cpp10
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffimageedit.cpp10
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffimageedit.h2
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffnotify.cpp26
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffnotify.h10
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffpageview.cpp468
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffpath.cpp14
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffpath.h2
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffpushbutton.cpp74
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffpushbutton.h14
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffsignature.cpp6
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffsubform.cpp8
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffsubform.h4
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_fftext.cpp36
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_fftext.h2
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_fftextedit.cpp29
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_fftextedit.h15
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffwidget.cpp2050
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffwidgetacc.cpp1523
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffwidgetacc.h4
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffwidgethandler.cpp533
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_fontmgr.cpp2055
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_fwladapter.cpp6
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_fwladapter.h4
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_fwltheme.cpp32
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_fwltheme.h2
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_rendercontext.cpp70
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/app/xfa_textpiece.h2
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/cxfa_deffontmgr.cpp77
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/cxfa_deffontmgr.h37
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/cxfa_eventparam.cpp46
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/cxfa_eventparam.h1
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/cxfa_ffapp.cpp96
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/cxfa_ffapp.h81
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/cxfa_ffapp_unittest.cpp88
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/cxfa_ffdoc.cpp427
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/cxfa_ffdoc.h92
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/cxfa_ffdochandler.cpp61
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/cxfa_ffdochandler.h29
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/cxfa_ffdocview.cpp792
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/cxfa_ffdocview.h135
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/cxfa_ffpageview.cpp464
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/cxfa_ffpageview.h114
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/cxfa_ffwidget.cpp2049
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/cxfa_ffwidget.h191
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/cxfa_ffwidgethandler.cpp524
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/cxfa_ffwidgethandler.h119
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/cxfa_fileread.cpp56
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/cxfa_fileread.h31
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/cxfa_fontmgr.cpp1797
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/cxfa_fontmgr.h56
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/cxfa_pdffontmgr.cpp208
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/cxfa_pdffontmgr.h57
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/cxfa_rendercontext.cpp70
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/cxfa_rendercontext.h45
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/cxfa_widgetacc.cpp1533
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/cxfa_widgetacc.h122
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/cxfa_widgetacciterator.cpp31
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/cxfa_widgetacciterator.h28
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/fm2js/xfa_error.cpp16
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/fm2js/xfa_error.h15
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/fm2js/xfa_expression.cpp4
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/fm2js/xfa_expression.h2
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp1095
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/fm2js/xfa_fm2jscontext.h109
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/fm2js/xfa_fmparse.cpp16
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/fm2js/xfa_fmparse.h2
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/fm2js/xfa_lexer.cpp87
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/fm2js/xfa_lexer.h24
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/fm2js/xfa_simpleexpression.cpp8
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/fm2js/xfa_simpleexpression_unittest.cpp5
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/fxfa.h24
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/fxfa_basic.h14
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/fxfa_widget.h121
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cscript_datawindow.cpp3
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cscript_datawindow.h5
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cscript_eventpseudomodel.cpp5
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cscript_eventpseudomodel.h4
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cscript_hostpseudomodel.cpp31
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cscript_hostpseudomodel.h11
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp93
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cscript_layoutpseudomodel.h19
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cscript_logpseudomodel.cpp3
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cscript_logpseudomodel.h5
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cscript_signaturepseudomodel.cpp3
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cscript_signaturepseudomodel.h5
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_arraynodelist.cpp47
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_arraynodelist.h35
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_assist.cpp2
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_attachnodelist.cpp12
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_attachnodelist.h30
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_bind.cpp2
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_binditems.cpp2
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_box.cpp8
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_box.h14
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_calculate.cpp2
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_caption.cpp4
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_caption.h2
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_containerlayoutitem.cpp1
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_contentlayoutitem.cpp2
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_contentlayoutitem.h4
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_data.cpp8
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_data.h6
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_dataexporter.cpp64
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_dataexporter.h6
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_dataimporter.cpp4
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_dataimporter.h2
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_document.cpp97
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_document.h34
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_document_parser.cpp1
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_document_parser.h2
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_event.cpp8
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_event.h8
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_exdata.cpp2
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_fill.cpp2
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_font.cpp16
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_font.h10
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_image.cpp2
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_image.h2
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp2793
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_itemlayoutprocessor.h172
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_layoutcontext.h32
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_layoutitem.cpp3
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp93
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_layoutpagemgr.h15
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_layoutprocessor.cpp35
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_layoutprocessor.h8
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_line.cpp2
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_localemgr.cpp1248
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_localemgr.h59
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_localevalue.cpp979
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_localevalue.h113
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_margin.cpp10
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_margin.h8
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_measurement.cpp8
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_measurement.h14
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_node.cpp468
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_node.h608
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_nodehelper.cpp130
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_nodehelper.h12
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_nodelist.cpp3
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_nodelist.h40
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_nodelocale.cpp175
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_nodelocale.h53
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_object.cpp42
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_object.h100
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_occur.cpp2
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_para.cpp14
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_para.h12
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_resolveprocessor.cpp498
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_resolveprocessor.h8
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_script.cpp2
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_scriptcontext.cpp140
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_scriptcontext.h14
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_simple_parser.cpp396
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_simple_parser.h8
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_stroke.cpp11
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_stroke.h4
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_submit.cpp2
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_text.cpp2
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_thisproxy.cpp12
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_thisproxy.h27
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_timezoneprovider.cpp32
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_timezoneprovider.h23
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_tooltip.cpp2
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_traversestrategy_xfacontainernode.h33
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_traversestrategy_xfanode.h28
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_validate.cpp3
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_validate.h2
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_value.cpp2
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_valuearray.cpp17
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_valuearray.h8
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_widetextread.cpp102
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_widetextread.h47
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_widgetdata.cpp392
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_widgetdata.h44
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_xml_parser.cpp172
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_xml_parser.h44
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_xmllocale.cpp194
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_xmllocale.h49
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/xfa_basic_data.cpp2
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/xfa_basic_data_element_script.cpp2
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp194
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/xfa_document_datamerger_imp.h18
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/xfa_layout_itemlayout.cpp2793
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/xfa_layout_itemlayout.h188
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/xfa_locale.cpp394
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/xfa_locale.h98
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/xfa_localemgr.cpp1274
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/xfa_localemgr.h71
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/xfa_localevalue.cpp984
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/xfa_localevalue.h112
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/xfa_object.h823
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/xfa_resolvenode_rs.h26
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/xfa_utils.cpp126
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/xfa_utils.h223
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/parser/xfa_utils_unittest.cpp257
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/xfa_checksum.h80
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/xfa_ffapp.h86
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/xfa_ffdoc.h74
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/xfa_ffdochandler.h31
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/xfa_ffdocview.h153
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/xfa_ffpageview.h107
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/xfa_ffwidget.h190
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/xfa_ffwidgethandler.h119
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/xfa_fontmgr.h103
-rw-r--r--chromium/third_party/pdfium/xfa/fxfa/xfa_rendercontext.h45
-rw-r--r--chromium/third_party/pdfium/xfa/fxgraphics/cfx_graphics.cpp150
-rw-r--r--chromium/third_party/pdfium/xfa/fxgraphics/cfx_graphics.h11
-rw-r--r--chromium/third_party/pdfium/xfa/fxgraphics/cfx_path.cpp45
-rw-r--r--chromium/third_party/pdfium/xfa/fxgraphics/cfx_path.h17
-rw-r--r--chromium/third_party/pdfium/xfa/fxgraphics/cfx_shading.cpp14
-rw-r--r--chromium/third_party/pdfium/xfa/fxgraphics/cfx_shading.h8
1781 files changed, 108491 insertions, 252957 deletions
diff --git a/chromium/third_party/pdfium/.gn b/chromium/third_party/pdfium/.gn
index ce525292541..542ee5bd985 100644
--- a/chromium/third_party/pdfium/.gn
+++ b/chromium/third_party/pdfium/.gn
@@ -8,7 +8,6 @@ secondary_source = "//build/secondary/"
default_args = {
v8_extra_library_files = []
v8_experimental_extra_library_files = []
- v8_enable_inspector = false
# Turns on compiler optimizations in V8 in Debug build.
v8_optimized_debug = true
diff --git a/chromium/third_party/pdfium/BUILD.gn b/chromium/third_party/pdfium/BUILD.gn
index de7f21b1302..1d8f3530ec2 100644
--- a/chromium/third_party/pdfium/BUILD.gn
+++ b/chromium/third_party/pdfium/BUILD.gn
@@ -5,14 +5,19 @@
import("//testing/test.gni")
import("pdfium.gni")
+group("freetype_common") {
+ public_deps = []
+ if (pdf_bundle_freetype) {
+ public_deps += [ "third_party:fx_freetype" ]
+ } else {
+ public_deps += [ "//build/config/freetype" ]
+ }
+}
+
config("pdfium_common_config") {
cflags = []
ldflags = []
- include_dirs = [
- ".",
- "third_party/freetype/include",
- "third_party/freetype/include/freetype",
- ]
+ include_dirs = [ "." ]
defines = [
"OPJ_STATIC",
"PNG_PREFIX",
@@ -59,6 +64,11 @@ config("pdfium_common_config") {
]
ldflags += [ "--coverage" ]
}
+
+ if (is_win) {
+ # Assume UTF-8 by default to avoid code page dependencies.
+ cflags += [ "/utf-8" ]
+ }
}
config("pdfium_core_config") {
@@ -74,7 +84,10 @@ config("pdfium_core_config") {
}
}
if (is_win) {
- cflags += [ "/wd4267" ]
+ cflags += [
+ "/wd4267",
+ "/wd4577",
+ ]
}
}
@@ -137,6 +150,7 @@ static_library("pdfium") {
"fpdfsdk/fsdk_pauseadapter.h",
"fpdfsdk/pdfsdk_fieldaction.cpp",
"fpdfsdk/pdfsdk_fieldaction.h",
+ "public/cpp/fpdf_deleters.h",
"public/fpdf_dataavail.h",
"public/fpdf_doc.h",
"public/fpdf_edit.h",
@@ -203,10 +217,8 @@ static_library("pdfium") {
]
}
- if (pdfium_bundle_freetype) {
- deps += [ "third_party:fx_freetype" ]
- } else {
- libs += [ "freetype" ]
+ if (pdf_is_complete_lib) {
+ complete_static_lib = true
}
}
@@ -267,8 +279,6 @@ static_library("fpdfdoc") {
sources = [
"core/fpdfdoc/cline.cpp",
"core/fpdfdoc/cline.h",
- "core/fpdfdoc/clines.cpp",
- "core/fpdfdoc/clines.h",
"core/fpdfdoc/cpdf_aaction.cpp",
"core/fpdfdoc/cpdf_aaction.h",
"core/fpdfdoc/cpdf_action.cpp",
@@ -315,11 +325,14 @@ static_library("fpdfdoc") {
"core/fpdfdoc/cpdf_occontext.h",
"core/fpdfdoc/cpdf_pagelabel.cpp",
"core/fpdfdoc/cpdf_pagelabel.h",
+ "core/fpdfdoc/cpdf_structelement.cpp",
+ "core/fpdfdoc/cpdf_structelement.h",
+ "core/fpdfdoc/cpdf_structtree.cpp",
+ "core/fpdfdoc/cpdf_structtree.h",
"core/fpdfdoc/cpdf_variabletext.cpp",
"core/fpdfdoc/cpdf_variabletext.h",
"core/fpdfdoc/cpdf_viewerpreferences.cpp",
"core/fpdfdoc/cpdf_viewerpreferences.h",
- "core/fpdfdoc/cpvt_arraytemplate.h",
"core/fpdfdoc/cpvt_color.cpp",
"core/fpdfdoc/cpvt_color.h",
"core/fpdfdoc/cpvt_dash.h",
@@ -344,11 +357,8 @@ static_library("fpdfdoc") {
"core/fpdfdoc/csection.h",
"core/fpdfdoc/ctypeset.cpp",
"core/fpdfdoc/ctypeset.h",
- "core/fpdfdoc/doc_tagged.cpp",
- "core/fpdfdoc/fpdf_tagged.h",
"core/fpdfdoc/ipdf_formnotify.h",
"core/fpdfdoc/ipvt_fontmap.h",
- "core/fpdfdoc/tagged_int.h",
]
configs += [ ":pdfium_core_config" ]
deps = [
@@ -636,6 +646,7 @@ static_library("fxcodec") {
"core/fxcodec/codec/ccodec_jpegmodule.h",
"core/fxcodec/codec/ccodec_jpxmodule.h",
"core/fxcodec/codec/ccodec_scanlinedecoder.h",
+ "core/fxcodec/codec/cjpx_decoder.h",
"core/fxcodec/codec/codec_int.h",
"core/fxcodec/codec/fx_codec.cpp",
"core/fxcodec/codec/fx_codec_fax.cpp",
@@ -691,10 +702,8 @@ static_library("fxcodec") {
":fxcrt",
"third_party:fx_lcms2",
"third_party:fx_libopenjpeg",
- "third_party:fx_zlib",
-
- # This is a generic JPEG library dependency.
"//third_party:jpeg",
+ "//third_party/zlib:zlib",
]
if (pdf_enable_xfa) {
@@ -741,6 +750,8 @@ config("fxge_warnings") {
static_library("fxcrt") {
sources = [
+ "core/fxcrt/cfx_bytestring.cpp",
+ "core/fxcrt/cfx_bytestring.h",
"core/fxcrt/cfx_maybe_owned.h",
"core/fxcrt/cfx_observable.h",
"core/fxcrt/cfx_retain_ptr.h",
@@ -749,17 +760,16 @@ static_library("fxcrt") {
"core/fxcrt/cfx_string_data_template.h",
"core/fxcrt/cfx_string_pool_template.h",
"core/fxcrt/cfx_weak_ptr.h",
+ "core/fxcrt/cfx_widestring.cpp",
+ "core/fxcrt/cfx_widestring.h",
"core/fxcrt/extension.h",
"core/fxcrt/fx_basic.h",
- "core/fxcrt/fx_basic_array.cpp",
- "core/fxcrt/fx_basic_bstring.cpp",
"core/fxcrt/fx_basic_buffer.cpp",
"core/fxcrt/fx_basic_coords.cpp",
"core/fxcrt/fx_basic_gcc.cpp",
"core/fxcrt/fx_basic_memmgr.cpp",
"core/fxcrt/fx_basic_utf.cpp",
"core/fxcrt/fx_basic_util.cpp",
- "core/fxcrt/fx_basic_wstring.cpp",
"core/fxcrt/fx_bidi.cpp",
"core/fxcrt/fx_bidi.h",
"core/fxcrt/fx_coordinates.h",
@@ -773,15 +783,20 @@ static_library("fxcrt") {
"core/fxcrt/fx_ucd.h",
"core/fxcrt/fx_ucddata.cpp",
"core/fxcrt/fx_unicode.cpp",
- "core/fxcrt/fx_xml.h",
- "core/fxcrt/fx_xml_composer.cpp",
- "core/fxcrt/fx_xml_parser.cpp",
"core/fxcrt/fxcrt_posix.cpp",
"core/fxcrt/fxcrt_posix.h",
"core/fxcrt/fxcrt_stream.cpp",
"core/fxcrt/fxcrt_windows.cpp",
"core/fxcrt/fxcrt_windows.h",
- "core/fxcrt/xml_int.h",
+ "core/fxcrt/xml/cxml_attritem.cpp",
+ "core/fxcrt/xml/cxml_attritem.h",
+ "core/fxcrt/xml/cxml_attrmap.cpp",
+ "core/fxcrt/xml/cxml_attrmap.h",
+ "core/fxcrt/xml/cxml_content.h",
+ "core/fxcrt/xml/cxml_element.cpp",
+ "core/fxcrt/xml/cxml_element.h",
+ "core/fxcrt/xml/cxml_parser.cpp",
+ "core/fxcrt/xml/cxml_parser.h",
]
configs += [ ":pdfium_core_config" ]
visibility += [ "third_party:*" ]
@@ -789,14 +804,35 @@ static_library("fxcrt") {
"third_party:pdfium_base",
]
public_deps = [
+ ":freetype_common",
"third_party:pdfium_base",
]
if (pdf_enable_xfa) {
sources += [
+ "core/fxcrt/cfx_blockbuffer.cpp",
+ "core/fxcrt/cfx_blockbuffer.h",
+ "core/fxcrt/cfx_char.cpp",
+ "core/fxcrt/cfx_char.h",
+ "core/fxcrt/cfx_chariter.cpp",
+ "core/fxcrt/cfx_chariter.h",
+ "core/fxcrt/cfx_checksumcontext.cpp",
+ "core/fxcrt/cfx_checksumcontext.h",
+ "core/fxcrt/cfx_datetime.cpp",
+ "core/fxcrt/cfx_datetime.h",
+ "core/fxcrt/cfx_decimal.cpp",
+ "core/fxcrt/cfx_decimal.h",
+ "core/fxcrt/cfx_wordbreak.cpp",
+ "core/fxcrt/cfx_wordbreak.h",
"core/fxcrt/fx_arabic.cpp",
"core/fxcrt/fx_arabic.h",
- "core/fxcrt/fx_arb.h",
+ "core/fxcrt/ifx_chariter.h",
+ "core/fxcrt/ifx_locale.h",
+ "core/fxcrt/xml/cfx_saxcontext.h",
+ "core/fxcrt/xml/cfx_saxreader.cpp",
+ "core/fxcrt/xml/cfx_saxreader.h",
+ "core/fxcrt/xml/cfx_saxreaderhandler.cpp",
+ "core/fxcrt/xml/cfx_saxreaderhandler.h",
]
}
}
@@ -829,12 +865,30 @@ static_library("fxge") {
"core/fxge/cfx_substfont.h",
"core/fxge/cfx_unicodeencoding.h",
"core/fxge/cfx_windowsdevice.h",
- "core/fxge/dib/dib_int.h",
- "core/fxge/dib/fx_dib_composite.cpp",
- "core/fxge/dib/fx_dib_convert.cpp",
- "core/fxge/dib/fx_dib_engine.cpp",
+ "core/fxge/dib/cfx_bitmapcomposer.cpp",
+ "core/fxge/dib/cfx_bitmapcomposer.h",
+ "core/fxge/dib/cfx_bitmapstorer.cpp",
+ "core/fxge/dib/cfx_bitmapstorer.h",
+ "core/fxge/dib/cfx_dibextractor.cpp",
+ "core/fxge/dib/cfx_dibextractor.h",
+ "core/fxge/dib/cfx_dibitmap.cpp",
+ "core/fxge/dib/cfx_dibitmap.h",
+ "core/fxge/dib/cfx_dibsource.cpp",
+ "core/fxge/dib/cfx_dibsource.h",
+ "core/fxge/dib/cfx_filtereddib.cpp",
+ "core/fxge/dib/cfx_filtereddib.h",
+ "core/fxge/dib/cfx_imagerenderer.cpp",
+ "core/fxge/dib/cfx_imagerenderer.h",
+ "core/fxge/dib/cfx_imagestretcher.cpp",
+ "core/fxge/dib/cfx_imagestretcher.h",
+ "core/fxge/dib/cfx_imagetransformer.cpp",
+ "core/fxge/dib/cfx_imagetransformer.h",
+ "core/fxge/dib/cfx_scanlinecompositor.cpp",
+ "core/fxge/dib/cfx_scanlinecompositor.h",
+ "core/fxge/dib/cstretchengine.cpp",
+ "core/fxge/dib/cstretchengine.h",
"core/fxge/dib/fx_dib_main.cpp",
- "core/fxge/dib/fx_dib_transform.cpp",
+ "core/fxge/dib/ifx_scanlinecomposer.h",
"core/fxge/fontdata/chromefontdata/FoxitDingbats.cpp",
"core/fxge/fontdata/chromefontdata/FoxitFixed.cpp",
"core/fxge/fontdata/chromefontdata/FoxitFixedBold.cpp",
@@ -893,6 +947,8 @@ static_library("fxge") {
":fxcrt",
]
+ defines = [ "DEFINE_PS_TABLES" ]
+
if (pdf_enable_xfa) {
sources += [
"core/fxge/cfx_unicodeencodingex.h",
@@ -909,10 +965,10 @@ static_library("fxge") {
"core/fxge/agg/fx_agg_driver.h",
]
deps += [ "third_party:fx_agg" ]
+ }
- if (is_mac) {
- sources += [ "core/fxge/apple/fx_apple_platform.cpp" ]
- }
+ if (is_mac) {
+ sources += [ "core/fxge/apple/fx_apple_platform.cpp" ]
}
if (is_win) {
@@ -1141,10 +1197,156 @@ if (pdf_enable_xfa) {
configs += [ ":pdfium_core_config" ]
}
+ static_library("fxbarcode") {
+ sources = [
+ "fxbarcode/BC_Dimension.cpp",
+ "fxbarcode/BC_Dimension.h",
+ "fxbarcode/BC_Library.cpp",
+ "fxbarcode/BC_Library.h",
+ "fxbarcode/BC_TwoDimWriter.cpp",
+ "fxbarcode/BC_TwoDimWriter.h",
+ "fxbarcode/BC_UtilCodingConvert.cpp",
+ "fxbarcode/BC_UtilCodingConvert.h",
+ "fxbarcode/BC_Utils.cpp",
+ "fxbarcode/BC_Writer.cpp",
+ "fxbarcode/BC_Writer.h",
+ "fxbarcode/cbc_codabar.cpp",
+ "fxbarcode/cbc_codabar.h",
+ "fxbarcode/cbc_code128.cpp",
+ "fxbarcode/cbc_code128.h",
+ "fxbarcode/cbc_code39.cpp",
+ "fxbarcode/cbc_code39.h",
+ "fxbarcode/cbc_codebase.cpp",
+ "fxbarcode/cbc_codebase.h",
+ "fxbarcode/cbc_datamatrix.cpp",
+ "fxbarcode/cbc_datamatrix.h",
+ "fxbarcode/cbc_ean13.cpp",
+ "fxbarcode/cbc_ean13.h",
+ "fxbarcode/cbc_ean8.cpp",
+ "fxbarcode/cbc_ean8.h",
+ "fxbarcode/cbc_onecode.cpp",
+ "fxbarcode/cbc_onecode.h",
+ "fxbarcode/cbc_pdf417i.cpp",
+ "fxbarcode/cbc_pdf417i.h",
+ "fxbarcode/cbc_qrcode.cpp",
+ "fxbarcode/cbc_qrcode.h",
+ "fxbarcode/cbc_upca.cpp",
+ "fxbarcode/cbc_upca.h",
+ "fxbarcode/common/BC_CommonBitArray.cpp",
+ "fxbarcode/common/BC_CommonBitArray.h",
+ "fxbarcode/common/BC_CommonBitMatrix.cpp",
+ "fxbarcode/common/BC_CommonBitMatrix.h",
+ "fxbarcode/common/BC_CommonByteArray.cpp",
+ "fxbarcode/common/BC_CommonByteArray.h",
+ "fxbarcode/common/BC_CommonByteMatrix.cpp",
+ "fxbarcode/common/BC_CommonByteMatrix.h",
+ "fxbarcode/common/reedsolomon/BC_ReedSolomon.cpp",
+ "fxbarcode/common/reedsolomon/BC_ReedSolomon.h",
+ "fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp",
+ "fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.h",
+ "fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp",
+ "fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.h",
+ "fxbarcode/datamatrix/BC_ASCIIEncoder.cpp",
+ "fxbarcode/datamatrix/BC_ASCIIEncoder.h",
+ "fxbarcode/datamatrix/BC_Base256Encoder.cpp",
+ "fxbarcode/datamatrix/BC_Base256Encoder.h",
+ "fxbarcode/datamatrix/BC_C40Encoder.cpp",
+ "fxbarcode/datamatrix/BC_C40Encoder.h",
+ "fxbarcode/datamatrix/BC_DataMatrixSymbolInfo144.cpp",
+ "fxbarcode/datamatrix/BC_DataMatrixSymbolInfo144.h",
+ "fxbarcode/datamatrix/BC_DataMatrixWriter.cpp",
+ "fxbarcode/datamatrix/BC_DataMatrixWriter.h",
+ "fxbarcode/datamatrix/BC_DefaultPlacement.cpp",
+ "fxbarcode/datamatrix/BC_DefaultPlacement.h",
+ "fxbarcode/datamatrix/BC_EdifactEncoder.cpp",
+ "fxbarcode/datamatrix/BC_EdifactEncoder.h",
+ "fxbarcode/datamatrix/BC_Encoder.cpp",
+ "fxbarcode/datamatrix/BC_Encoder.h",
+ "fxbarcode/datamatrix/BC_EncoderContext.cpp",
+ "fxbarcode/datamatrix/BC_EncoderContext.h",
+ "fxbarcode/datamatrix/BC_ErrorCorrection.cpp",
+ "fxbarcode/datamatrix/BC_ErrorCorrection.h",
+ "fxbarcode/datamatrix/BC_HighLevelEncoder.cpp",
+ "fxbarcode/datamatrix/BC_HighLevelEncoder.h",
+ "fxbarcode/datamatrix/BC_SymbolInfo.cpp",
+ "fxbarcode/datamatrix/BC_SymbolInfo.h",
+ "fxbarcode/datamatrix/BC_SymbolShapeHint.cpp",
+ "fxbarcode/datamatrix/BC_SymbolShapeHint.h",
+ "fxbarcode/datamatrix/BC_TextEncoder.cpp",
+ "fxbarcode/datamatrix/BC_TextEncoder.h",
+ "fxbarcode/datamatrix/BC_X12Encoder.cpp",
+ "fxbarcode/datamatrix/BC_X12Encoder.h",
+ "fxbarcode/oned/BC_OneDimWriter.cpp",
+ "fxbarcode/oned/BC_OneDimWriter.h",
+ "fxbarcode/oned/BC_OnedCodaBarWriter.cpp",
+ "fxbarcode/oned/BC_OnedCodaBarWriter.h",
+ "fxbarcode/oned/BC_OnedCode128Writer.cpp",
+ "fxbarcode/oned/BC_OnedCode128Writer.h",
+ "fxbarcode/oned/BC_OnedCode39Writer.cpp",
+ "fxbarcode/oned/BC_OnedCode39Writer.h",
+ "fxbarcode/oned/BC_OnedEAN13Writer.cpp",
+ "fxbarcode/oned/BC_OnedEAN13Writer.h",
+ "fxbarcode/oned/BC_OnedEAN8Writer.cpp",
+ "fxbarcode/oned/BC_OnedEAN8Writer.h",
+ "fxbarcode/oned/BC_OnedUPCAWriter.cpp",
+ "fxbarcode/oned/BC_OnedUPCAWriter.h",
+ "fxbarcode/pdf417/BC_PDF417.cpp",
+ "fxbarcode/pdf417/BC_PDF417.h",
+ "fxbarcode/pdf417/BC_PDF417BarcodeMatrix.cpp",
+ "fxbarcode/pdf417/BC_PDF417BarcodeMatrix.h",
+ "fxbarcode/pdf417/BC_PDF417BarcodeRow.cpp",
+ "fxbarcode/pdf417/BC_PDF417BarcodeRow.h",
+ "fxbarcode/pdf417/BC_PDF417Compaction.cpp",
+ "fxbarcode/pdf417/BC_PDF417Compaction.h",
+ "fxbarcode/pdf417/BC_PDF417ErrorCorrection.cpp",
+ "fxbarcode/pdf417/BC_PDF417ErrorCorrection.h",
+ "fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp",
+ "fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h",
+ "fxbarcode/pdf417/BC_PDF417Writer.cpp",
+ "fxbarcode/pdf417/BC_PDF417Writer.h",
+ "fxbarcode/qrcode/BC_QRCodeWriter.cpp",
+ "fxbarcode/qrcode/BC_QRCodeWriter.h",
+ "fxbarcode/qrcode/BC_QRCoder.cpp",
+ "fxbarcode/qrcode/BC_QRCoder.h",
+ "fxbarcode/qrcode/BC_QRCoderBitVector.cpp",
+ "fxbarcode/qrcode/BC_QRCoderBitVector.h",
+ "fxbarcode/qrcode/BC_QRCoderBlockPair.cpp",
+ "fxbarcode/qrcode/BC_QRCoderBlockPair.h",
+ "fxbarcode/qrcode/BC_QRCoderECBlocks.cpp",
+ "fxbarcode/qrcode/BC_QRCoderECBlocks.h",
+ "fxbarcode/qrcode/BC_QRCoderECBlocksData.cpp",
+ "fxbarcode/qrcode/BC_QRCoderECBlocksData.h",
+ "fxbarcode/qrcode/BC_QRCoderEncoder.cpp",
+ "fxbarcode/qrcode/BC_QRCoderEncoder.h",
+ "fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.cpp",
+ "fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.h",
+ "fxbarcode/qrcode/BC_QRCoderMaskUtil.cpp",
+ "fxbarcode/qrcode/BC_QRCoderMaskUtil.h",
+ "fxbarcode/qrcode/BC_QRCoderMatrixUtil.cpp",
+ "fxbarcode/qrcode/BC_QRCoderMatrixUtil.h",
+ "fxbarcode/qrcode/BC_QRCoderMode.cpp",
+ "fxbarcode/qrcode/BC_QRCoderMode.h",
+ "fxbarcode/qrcode/BC_QRCoderVersion.cpp",
+ "fxbarcode/qrcode/BC_QRCoderVersion.h",
+ "fxbarcode/utils.h",
+ ]
+ deps = [
+ ":fxcrt",
+ ]
+ configs += [ ":pdfium_core_config" ]
+ }
+
static_library("xfa") {
sources = [
+ "xfa/fde/cfde_brush.h",
"xfa/fde/cfde_path.cpp",
"xfa/fde/cfde_path.h",
+ "xfa/fde/cfde_pen.h",
+ "xfa/fde/cfde_rendercontext.cpp",
+ "xfa/fde/cfde_rendercontext.h",
+ "xfa/fde/cfde_renderdevice.cpp",
+ "xfa/fde/cfde_textout.cpp",
+ "xfa/fde/cfde_textout.h",
"xfa/fde/cfde_txtedtbuf.cpp",
"xfa/fde/cfde_txtedtbuf.h",
"xfa/fde/cfde_txtedtdorecord_deleterange.cpp",
@@ -1159,10 +1361,8 @@ if (pdf_enable_xfa) {
"xfa/fde/cfde_txtedtparag.h",
"xfa/fde/cfde_txtedttextset.cpp",
"xfa/fde/cfde_txtedttextset.h",
- "xfa/fde/cfx_chariter.cpp",
- "xfa/fde/cfx_chariter.h",
- "xfa/fde/cfx_wordbreak.cpp",
- "xfa/fde/cfx_wordbreak.h",
+ "xfa/fde/cfde_visualsetiterator.cpp",
+ "xfa/fde/cfde_visualsetiterator.h",
"xfa/fde/css/cfde_csscolorvalue.cpp",
"xfa/fde/css/cfde_csscolorvalue.h",
"xfa/fde/css/cfde_csscomputedstyle.cpp",
@@ -1202,47 +1402,52 @@ if (pdf_enable_xfa) {
"xfa/fde/css/fde_css.h",
"xfa/fde/css/fde_cssdatatable.cpp",
"xfa/fde/css/fde_cssdatatable.h",
- "xfa/fde/fde_gedevice.cpp",
- "xfa/fde/fde_iterator.cpp",
- "xfa/fde/fde_iterator.h",
- "xfa/fde/fde_object.h",
- "xfa/fde/fde_render.cpp",
- "xfa/fde/fde_render.h",
"xfa/fde/ifde_txtedtdorecord.h",
"xfa/fde/ifde_txtedtengine.h",
"xfa/fde/ifde_txtedtpage.h",
- "xfa/fde/ifx_chariter.h",
- "xfa/fde/tto/fde_textout.cpp",
- "xfa/fde/tto/fde_textout.h",
- "xfa/fde/xml/cfx_saxreader.cpp",
- "xfa/fde/xml/cfx_saxreader.h",
- "xfa/fde/xml/fde_xml.h",
- "xfa/fde/xml/fde_xml_imp.cpp",
- "xfa/fde/xml/fde_xml_imp.h",
+ "xfa/fde/xml/cfde_xmlattributenode.cpp",
+ "xfa/fde/xml/cfde_xmlattributenode.h",
+ "xfa/fde/xml/cfde_xmlchardata.cpp",
+ "xfa/fde/xml/cfde_xmlchardata.h",
+ "xfa/fde/xml/cfde_xmldoc.cpp",
+ "xfa/fde/xml/cfde_xmldoc.h",
+ "xfa/fde/xml/cfde_xmlelement.cpp",
+ "xfa/fde/xml/cfde_xmlelement.h",
+ "xfa/fde/xml/cfde_xmlinstruction.cpp",
+ "xfa/fde/xml/cfde_xmlinstruction.h",
+ "xfa/fde/xml/cfde_xmlnode.cpp",
+ "xfa/fde/xml/cfde_xmlnode.h",
+ "xfa/fde/xml/cfde_xmlparser.cpp",
+ "xfa/fde/xml/cfde_xmlparser.h",
+ "xfa/fde/xml/cfde_xmlsyntaxparser.cpp",
+ "xfa/fde/xml/cfde_xmlsyntaxparser.h",
+ "xfa/fde/xml/cfde_xmltext.cpp",
+ "xfa/fde/xml/cfde_xmltext.h",
+ "xfa/fgas/crt/cfgas_formatstring.cpp",
+ "xfa/fgas/crt/cfgas_formatstring.h",
"xfa/fgas/crt/fgas_codepage.cpp",
"xfa/fgas/crt/fgas_codepage.h",
"xfa/fgas/crt/fgas_language.h",
- "xfa/fgas/crt/fgas_stream.cpp",
- "xfa/fgas/crt/fgas_stream.h",
- "xfa/fgas/crt/fgas_utils.cpp",
- "xfa/fgas/crt/fgas_utils.h",
+ "xfa/fgas/crt/ifgas_stream.cpp",
+ "xfa/fgas/crt/ifgas_stream.h",
"xfa/fgas/font/cfgas_fontmgr.cpp",
"xfa/fgas/font/cfgas_fontmgr.h",
"xfa/fgas/font/cfgas_gefont.cpp",
"xfa/fgas/font/cfgas_gefont.h",
"xfa/fgas/font/fgas_fontutils.cpp",
"xfa/fgas/font/fgas_fontutils.h",
+ "xfa/fgas/layout/cfx_break.cpp",
+ "xfa/fgas/layout/cfx_break.h",
+ "xfa/fgas/layout/cfx_breakline.cpp",
+ "xfa/fgas/layout/cfx_breakline.h",
+ "xfa/fgas/layout/cfx_breakpiece.cpp",
+ "xfa/fgas/layout/cfx_breakpiece.h",
"xfa/fgas/layout/fgas_linebreak.cpp",
"xfa/fgas/layout/fgas_linebreak.h",
"xfa/fgas/layout/fgas_rtfbreak.cpp",
"xfa/fgas/layout/fgas_rtfbreak.h",
"xfa/fgas/layout/fgas_textbreak.cpp",
"xfa/fgas/layout/fgas_textbreak.h",
- "xfa/fgas/localization/fgas_datetime.cpp",
- "xfa/fgas/localization/fgas_datetime.h",
- "xfa/fgas/localization/fgas_locale.cpp",
- "xfa/fgas/localization/fgas_locale.h",
- "xfa/fgas/localization/fgas_localeimp.h",
"xfa/fwl/cfwl_app.cpp",
"xfa/fwl/cfwl_app.h",
"xfa/fwl/cfwl_barcode.cpp",
@@ -1362,139 +1567,8 @@ if (pdf_enable_xfa) {
"xfa/fwl/theme/cfwl_utils.h",
"xfa/fwl/theme/cfwl_widgettp.cpp",
"xfa/fwl/theme/cfwl_widgettp.h",
- "xfa/fxbarcode/BC_Dimension.cpp",
- "xfa/fxbarcode/BC_Dimension.h",
- "xfa/fxbarcode/BC_Library.cpp",
- "xfa/fxbarcode/BC_Library.h",
- "xfa/fxbarcode/BC_TwoDimWriter.cpp",
- "xfa/fxbarcode/BC_TwoDimWriter.h",
- "xfa/fxbarcode/BC_UtilCodingConvert.cpp",
- "xfa/fxbarcode/BC_UtilCodingConvert.h",
- "xfa/fxbarcode/BC_Utils.cpp",
- "xfa/fxbarcode/BC_Writer.cpp",
- "xfa/fxbarcode/BC_Writer.h",
- "xfa/fxbarcode/cbc_codabar.cpp",
- "xfa/fxbarcode/cbc_codabar.h",
- "xfa/fxbarcode/cbc_code128.cpp",
- "xfa/fxbarcode/cbc_code128.h",
- "xfa/fxbarcode/cbc_code39.cpp",
- "xfa/fxbarcode/cbc_code39.h",
- "xfa/fxbarcode/cbc_codebase.cpp",
- "xfa/fxbarcode/cbc_codebase.h",
- "xfa/fxbarcode/cbc_datamatrix.cpp",
- "xfa/fxbarcode/cbc_datamatrix.h",
- "xfa/fxbarcode/cbc_ean13.cpp",
- "xfa/fxbarcode/cbc_ean13.h",
- "xfa/fxbarcode/cbc_ean8.cpp",
- "xfa/fxbarcode/cbc_ean8.h",
- "xfa/fxbarcode/cbc_onecode.cpp",
- "xfa/fxbarcode/cbc_onecode.h",
- "xfa/fxbarcode/cbc_pdf417i.cpp",
- "xfa/fxbarcode/cbc_pdf417i.h",
- "xfa/fxbarcode/cbc_qrcode.cpp",
- "xfa/fxbarcode/cbc_qrcode.h",
- "xfa/fxbarcode/cbc_upca.cpp",
- "xfa/fxbarcode/cbc_upca.h",
- "xfa/fxbarcode/common/BC_CommonBitArray.cpp",
- "xfa/fxbarcode/common/BC_CommonBitArray.h",
- "xfa/fxbarcode/common/BC_CommonBitMatrix.cpp",
- "xfa/fxbarcode/common/BC_CommonBitMatrix.h",
- "xfa/fxbarcode/common/BC_CommonByteArray.cpp",
- "xfa/fxbarcode/common/BC_CommonByteArray.h",
- "xfa/fxbarcode/common/BC_CommonByteMatrix.cpp",
- "xfa/fxbarcode/common/BC_CommonByteMatrix.h",
- "xfa/fxbarcode/common/reedsolomon/BC_ReedSolomon.cpp",
- "xfa/fxbarcode/common/reedsolomon/BC_ReedSolomon.h",
- "xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp",
- "xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.h",
- "xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp",
- "xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.h",
- "xfa/fxbarcode/datamatrix/BC_ASCIIEncoder.cpp",
- "xfa/fxbarcode/datamatrix/BC_ASCIIEncoder.h",
- "xfa/fxbarcode/datamatrix/BC_Base256Encoder.cpp",
- "xfa/fxbarcode/datamatrix/BC_Base256Encoder.h",
- "xfa/fxbarcode/datamatrix/BC_C40Encoder.cpp",
- "xfa/fxbarcode/datamatrix/BC_C40Encoder.h",
- "xfa/fxbarcode/datamatrix/BC_DataMatrixSymbolInfo144.cpp",
- "xfa/fxbarcode/datamatrix/BC_DataMatrixSymbolInfo144.h",
- "xfa/fxbarcode/datamatrix/BC_DataMatrixWriter.cpp",
- "xfa/fxbarcode/datamatrix/BC_DataMatrixWriter.h",
- "xfa/fxbarcode/datamatrix/BC_DefaultPlacement.cpp",
- "xfa/fxbarcode/datamatrix/BC_DefaultPlacement.h",
- "xfa/fxbarcode/datamatrix/BC_EdifactEncoder.cpp",
- "xfa/fxbarcode/datamatrix/BC_EdifactEncoder.h",
- "xfa/fxbarcode/datamatrix/BC_Encoder.cpp",
- "xfa/fxbarcode/datamatrix/BC_Encoder.h",
- "xfa/fxbarcode/datamatrix/BC_EncoderContext.cpp",
- "xfa/fxbarcode/datamatrix/BC_EncoderContext.h",
- "xfa/fxbarcode/datamatrix/BC_ErrorCorrection.cpp",
- "xfa/fxbarcode/datamatrix/BC_ErrorCorrection.h",
- "xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp",
- "xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.h",
- "xfa/fxbarcode/datamatrix/BC_SymbolInfo.cpp",
- "xfa/fxbarcode/datamatrix/BC_SymbolInfo.h",
- "xfa/fxbarcode/datamatrix/BC_SymbolShapeHint.cpp",
- "xfa/fxbarcode/datamatrix/BC_SymbolShapeHint.h",
- "xfa/fxbarcode/datamatrix/BC_TextEncoder.cpp",
- "xfa/fxbarcode/datamatrix/BC_TextEncoder.h",
- "xfa/fxbarcode/datamatrix/BC_X12Encoder.cpp",
- "xfa/fxbarcode/datamatrix/BC_X12Encoder.h",
- "xfa/fxbarcode/oned/BC_OneDimWriter.cpp",
- "xfa/fxbarcode/oned/BC_OneDimWriter.h",
- "xfa/fxbarcode/oned/BC_OnedCodaBarWriter.cpp",
- "xfa/fxbarcode/oned/BC_OnedCodaBarWriter.h",
- "xfa/fxbarcode/oned/BC_OnedCode128Writer.cpp",
- "xfa/fxbarcode/oned/BC_OnedCode128Writer.h",
- "xfa/fxbarcode/oned/BC_OnedCode39Writer.cpp",
- "xfa/fxbarcode/oned/BC_OnedCode39Writer.h",
- "xfa/fxbarcode/oned/BC_OnedEAN13Writer.cpp",
- "xfa/fxbarcode/oned/BC_OnedEAN13Writer.h",
- "xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp",
- "xfa/fxbarcode/oned/BC_OnedEAN8Writer.h",
- "xfa/fxbarcode/oned/BC_OnedUPCAWriter.cpp",
- "xfa/fxbarcode/oned/BC_OnedUPCAWriter.h",
- "xfa/fxbarcode/pdf417/BC_PDF417.cpp",
- "xfa/fxbarcode/pdf417/BC_PDF417.h",
- "xfa/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.cpp",
- "xfa/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.h",
- "xfa/fxbarcode/pdf417/BC_PDF417BarcodeRow.cpp",
- "xfa/fxbarcode/pdf417/BC_PDF417BarcodeRow.h",
- "xfa/fxbarcode/pdf417/BC_PDF417Compaction.cpp",
- "xfa/fxbarcode/pdf417/BC_PDF417Compaction.h",
- "xfa/fxbarcode/pdf417/BC_PDF417ErrorCorrection.cpp",
- "xfa/fxbarcode/pdf417/BC_PDF417ErrorCorrection.h",
- "xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp",
- "xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h",
- "xfa/fxbarcode/pdf417/BC_PDF417Writer.cpp",
- "xfa/fxbarcode/pdf417/BC_PDF417Writer.h",
- "xfa/fxbarcode/qrcode/BC_QRCodeWriter.cpp",
- "xfa/fxbarcode/qrcode/BC_QRCodeWriter.h",
- "xfa/fxbarcode/qrcode/BC_QRCoder.cpp",
- "xfa/fxbarcode/qrcode/BC_QRCoder.h",
- "xfa/fxbarcode/qrcode/BC_QRCoderBitVector.cpp",
- "xfa/fxbarcode/qrcode/BC_QRCoderBitVector.h",
- "xfa/fxbarcode/qrcode/BC_QRCoderBlockPair.cpp",
- "xfa/fxbarcode/qrcode/BC_QRCoderBlockPair.h",
- "xfa/fxbarcode/qrcode/BC_QRCoderECB.cpp",
- "xfa/fxbarcode/qrcode/BC_QRCoderECB.h",
- "xfa/fxbarcode/qrcode/BC_QRCoderECBlocks.cpp",
- "xfa/fxbarcode/qrcode/BC_QRCoderECBlocks.h",
- "xfa/fxbarcode/qrcode/BC_QRCoderEncoder.cpp",
- "xfa/fxbarcode/qrcode/BC_QRCoderEncoder.h",
- "xfa/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.cpp",
- "xfa/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.h",
- "xfa/fxbarcode/qrcode/BC_QRCoderMaskUtil.cpp",
- "xfa/fxbarcode/qrcode/BC_QRCoderMaskUtil.h",
- "xfa/fxbarcode/qrcode/BC_QRCoderMatrixUtil.cpp",
- "xfa/fxbarcode/qrcode/BC_QRCoderMatrixUtil.h",
- "xfa/fxbarcode/qrcode/BC_QRCoderMode.cpp",
- "xfa/fxbarcode/qrcode/BC_QRCoderMode.h",
- "xfa/fxbarcode/qrcode/BC_QRCoderVersion.cpp",
- "xfa/fxbarcode/qrcode/BC_QRCoderVersion.h",
- "xfa/fxbarcode/utils.h",
"xfa/fxfa/app/cxfa_csstagprovider.cpp",
"xfa/fxfa/app/cxfa_csstagprovider.h",
- "xfa/fxfa/app/cxfa_eventparam.cpp",
"xfa/fxfa/app/cxfa_linkuserdata.cpp",
"xfa/fxfa/app/cxfa_linkuserdata.h",
"xfa/fxfa/app/cxfa_loadercontext.cpp",
@@ -1511,17 +1585,12 @@ if (pdf_enable_xfa) {
"xfa/fxfa/app/cxfa_texttabstopscontext.h",
"xfa/fxfa/app/cxfa_textuserdata.cpp",
"xfa/fxfa/app/cxfa_textuserdata.h",
- "xfa/fxfa/app/xfa_checksum.cpp",
- "xfa/fxfa/app/xfa_ffapp.cpp",
"xfa/fxfa/app/xfa_ffbarcode.cpp",
"xfa/fxfa/app/xfa_ffbarcode.h",
"xfa/fxfa/app/xfa_ffcheckbutton.cpp",
"xfa/fxfa/app/xfa_ffcheckbutton.h",
"xfa/fxfa/app/xfa_ffchoicelist.cpp",
"xfa/fxfa/app/xfa_ffchoicelist.h",
- "xfa/fxfa/app/xfa_ffdoc.cpp",
- "xfa/fxfa/app/xfa_ffdochandler.cpp",
- "xfa/fxfa/app/xfa_ffdocview.cpp",
"xfa/fxfa/app/xfa_ffdraw.cpp",
"xfa/fxfa/app/xfa_ffdraw.h",
"xfa/fxfa/app/xfa_ffexclgroup.cpp",
@@ -1534,7 +1603,6 @@ if (pdf_enable_xfa) {
"xfa/fxfa/app/xfa_ffimageedit.h",
"xfa/fxfa/app/xfa_ffnotify.cpp",
"xfa/fxfa/app/xfa_ffnotify.h",
- "xfa/fxfa/app/xfa_ffpageview.cpp",
"xfa/fxfa/app/xfa_ffpath.cpp",
"xfa/fxfa/app/xfa_ffpath.h",
"xfa/fxfa/app/xfa_ffpushbutton.cpp",
@@ -1547,19 +1615,44 @@ if (pdf_enable_xfa) {
"xfa/fxfa/app/xfa_fftext.h",
"xfa/fxfa/app/xfa_fftextedit.cpp",
"xfa/fxfa/app/xfa_fftextedit.h",
- "xfa/fxfa/app/xfa_ffwidget.cpp",
"xfa/fxfa/app/xfa_ffwidgetacc.cpp",
"xfa/fxfa/app/xfa_ffwidgetacc.h",
- "xfa/fxfa/app/xfa_ffwidgethandler.cpp",
- "xfa/fxfa/app/xfa_fontmgr.cpp",
"xfa/fxfa/app/xfa_fwladapter.cpp",
"xfa/fxfa/app/xfa_fwladapter.h",
"xfa/fxfa/app/xfa_fwltheme.cpp",
"xfa/fxfa/app/xfa_fwltheme.h",
- "xfa/fxfa/app/xfa_rendercontext.cpp",
"xfa/fxfa/app/xfa_textpiece.cpp",
"xfa/fxfa/app/xfa_textpiece.h",
+ "xfa/fxfa/cxfa_deffontmgr.cpp",
+ "xfa/fxfa/cxfa_deffontmgr.h",
+ "xfa/fxfa/cxfa_eventparam.cpp",
"xfa/fxfa/cxfa_eventparam.h",
+ "xfa/fxfa/cxfa_ffapp.cpp",
+ "xfa/fxfa/cxfa_ffapp.h",
+ "xfa/fxfa/cxfa_ffdoc.cpp",
+ "xfa/fxfa/cxfa_ffdoc.h",
+ "xfa/fxfa/cxfa_ffdochandler.cpp",
+ "xfa/fxfa/cxfa_ffdochandler.h",
+ "xfa/fxfa/cxfa_ffdocview.cpp",
+ "xfa/fxfa/cxfa_ffdocview.h",
+ "xfa/fxfa/cxfa_ffpageview.cpp",
+ "xfa/fxfa/cxfa_ffpageview.h",
+ "xfa/fxfa/cxfa_ffwidget.cpp",
+ "xfa/fxfa/cxfa_ffwidget.h",
+ "xfa/fxfa/cxfa_ffwidgethandler.cpp",
+ "xfa/fxfa/cxfa_ffwidgethandler.h",
+ "xfa/fxfa/cxfa_fileread.cpp",
+ "xfa/fxfa/cxfa_fileread.h",
+ "xfa/fxfa/cxfa_fontmgr.cpp",
+ "xfa/fxfa/cxfa_fontmgr.h",
+ "xfa/fxfa/cxfa_pdffontmgr.cpp",
+ "xfa/fxfa/cxfa_pdffontmgr.h",
+ "xfa/fxfa/cxfa_rendercontext.cpp",
+ "xfa/fxfa/cxfa_rendercontext.h",
+ "xfa/fxfa/cxfa_widgetacc.cpp",
+ "xfa/fxfa/cxfa_widgetacc.h",
+ "xfa/fxfa/cxfa_widgetacciterator.cpp",
+ "xfa/fxfa/cxfa_widgetacciterator.h",
"xfa/fxfa/fm2js/xfa_error.cpp",
"xfa/fxfa/fm2js/xfa_error.h",
"xfa/fxfa/fm2js/xfa_expression.cpp",
@@ -1576,7 +1669,6 @@ if (pdf_enable_xfa) {
"xfa/fxfa/fm2js/xfa_simpleexpression.h",
"xfa/fxfa/fxfa.h",
"xfa/fxfa/fxfa_basic.h",
- "xfa/fxfa/fxfa_widget.h",
"xfa/fxfa/parser/cscript_datawindow.cpp",
"xfa/fxfa/parser/cscript_datawindow.h",
"xfa/fxfa/parser/cscript_eventpseudomodel.cpp",
@@ -1591,9 +1683,11 @@ if (pdf_enable_xfa) {
"xfa/fxfa/parser/cscript_signaturepseudomodel.h",
"xfa/fxfa/parser/cxfa_arc.h",
"xfa/fxfa/parser/cxfa_arraynodelist.cpp",
+ "xfa/fxfa/parser/cxfa_arraynodelist.h",
"xfa/fxfa/parser/cxfa_assist.cpp",
"xfa/fxfa/parser/cxfa_assist.h",
"xfa/fxfa/parser/cxfa_attachnodelist.cpp",
+ "xfa/fxfa/parser/cxfa_attachnodelist.h",
"xfa/fxfa/parser/cxfa_bind.cpp",
"xfa/fxfa/parser/cxfa_bind.h",
"xfa/fxfa/parser/cxfa_binditems.cpp",
@@ -1631,6 +1725,9 @@ if (pdf_enable_xfa) {
"xfa/fxfa/parser/cxfa_font.h",
"xfa/fxfa/parser/cxfa_image.cpp",
"xfa/fxfa/parser/cxfa_image.h",
+ "xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp",
+ "xfa/fxfa/parser/cxfa_itemlayoutprocessor.h",
+ "xfa/fxfa/parser/cxfa_layoutcontext.h",
"xfa/fxfa/parser/cxfa_layoutitem.cpp",
"xfa/fxfa/parser/cxfa_layoutitem.h",
"xfa/fxfa/parser/cxfa_layoutpagemgr.cpp",
@@ -1639,15 +1736,24 @@ if (pdf_enable_xfa) {
"xfa/fxfa/parser/cxfa_layoutprocessor.h",
"xfa/fxfa/parser/cxfa_line.cpp",
"xfa/fxfa/parser/cxfa_line.h",
+ "xfa/fxfa/parser/cxfa_localemgr.cpp",
+ "xfa/fxfa/parser/cxfa_localemgr.h",
+ "xfa/fxfa/parser/cxfa_localevalue.cpp",
+ "xfa/fxfa/parser/cxfa_localevalue.h",
"xfa/fxfa/parser/cxfa_margin.cpp",
"xfa/fxfa/parser/cxfa_margin.h",
"xfa/fxfa/parser/cxfa_measurement.cpp",
"xfa/fxfa/parser/cxfa_measurement.h",
"xfa/fxfa/parser/cxfa_node.cpp",
+ "xfa/fxfa/parser/cxfa_node.h",
"xfa/fxfa/parser/cxfa_nodehelper.cpp",
"xfa/fxfa/parser/cxfa_nodehelper.h",
"xfa/fxfa/parser/cxfa_nodelist.cpp",
+ "xfa/fxfa/parser/cxfa_nodelist.h",
+ "xfa/fxfa/parser/cxfa_nodelocale.cpp",
+ "xfa/fxfa/parser/cxfa_nodelocale.h",
"xfa/fxfa/parser/cxfa_object.cpp",
+ "xfa/fxfa/parser/cxfa_object.h",
"xfa/fxfa/parser/cxfa_occur.cpp",
"xfa/fxfa/parser/cxfa_occur.h",
"xfa/fxfa/parser/cxfa_para.cpp",
@@ -1668,23 +1774,26 @@ if (pdf_enable_xfa) {
"xfa/fxfa/parser/cxfa_text.cpp",
"xfa/fxfa/parser/cxfa_text.h",
"xfa/fxfa/parser/cxfa_thisproxy.cpp",
+ "xfa/fxfa/parser/cxfa_thisproxy.h",
+ "xfa/fxfa/parser/cxfa_timezoneprovider.cpp",
+ "xfa/fxfa/parser/cxfa_timezoneprovider.h",
"xfa/fxfa/parser/cxfa_tooltip.cpp",
"xfa/fxfa/parser/cxfa_tooltip.h",
"xfa/fxfa/parser/cxfa_traversestrategy_contentareacontainerlayoutitem.h",
"xfa/fxfa/parser/cxfa_traversestrategy_contentlayoutitem.h",
"xfa/fxfa/parser/cxfa_traversestrategy_layoutitem.h",
+ "xfa/fxfa/parser/cxfa_traversestrategy_xfacontainernode.h",
+ "xfa/fxfa/parser/cxfa_traversestrategy_xfanode.h",
"xfa/fxfa/parser/cxfa_validate.cpp",
"xfa/fxfa/parser/cxfa_validate.h",
"xfa/fxfa/parser/cxfa_value.cpp",
"xfa/fxfa/parser/cxfa_value.h",
"xfa/fxfa/parser/cxfa_valuearray.cpp",
"xfa/fxfa/parser/cxfa_valuearray.h",
- "xfa/fxfa/parser/cxfa_widetextread.cpp",
- "xfa/fxfa/parser/cxfa_widetextread.h",
"xfa/fxfa/parser/cxfa_widgetdata.cpp",
"xfa/fxfa/parser/cxfa_widgetdata.h",
- "xfa/fxfa/parser/cxfa_xml_parser.cpp",
- "xfa/fxfa/parser/cxfa_xml_parser.h",
+ "xfa/fxfa/parser/cxfa_xmllocale.cpp",
+ "xfa/fxfa/parser/cxfa_xmllocale.h",
"xfa/fxfa/parser/xfa_basic_data.cpp",
"xfa/fxfa/parser/xfa_basic_data.h",
"xfa/fxfa/parser/xfa_basic_data_attributes.cpp",
@@ -1695,28 +1804,9 @@ if (pdf_enable_xfa) {
"xfa/fxfa/parser/xfa_basic_data_packets.cpp",
"xfa/fxfa/parser/xfa_document_datamerger_imp.cpp",
"xfa/fxfa/parser/xfa_document_datamerger_imp.h",
- "xfa/fxfa/parser/xfa_layout_itemlayout.cpp",
- "xfa/fxfa/parser/xfa_layout_itemlayout.h",
- "xfa/fxfa/parser/xfa_locale.cpp",
- "xfa/fxfa/parser/xfa_locale.h",
- "xfa/fxfa/parser/xfa_localemgr.cpp",
- "xfa/fxfa/parser/xfa_localemgr.h",
- "xfa/fxfa/parser/xfa_localevalue.cpp",
- "xfa/fxfa/parser/xfa_localevalue.h",
- "xfa/fxfa/parser/xfa_object.h",
"xfa/fxfa/parser/xfa_resolvenode_rs.h",
"xfa/fxfa/parser/xfa_utils.cpp",
"xfa/fxfa/parser/xfa_utils.h",
- "xfa/fxfa/xfa_checksum.h",
- "xfa/fxfa/xfa_ffapp.h",
- "xfa/fxfa/xfa_ffdoc.h",
- "xfa/fxfa/xfa_ffdochandler.h",
- "xfa/fxfa/xfa_ffdocview.h",
- "xfa/fxfa/xfa_ffpageview.h",
- "xfa/fxfa/xfa_ffwidget.h",
- "xfa/fxfa/xfa_ffwidgethandler.h",
- "xfa/fxfa/xfa_fontmgr.h",
- "xfa/fxfa/xfa_rendercontext.h",
"xfa/fxgraphics/cfx_color.cpp",
"xfa/fxgraphics/cfx_color.h",
"xfa/fxgraphics/cfx_graphics.cpp",
@@ -1730,6 +1820,7 @@ if (pdf_enable_xfa) {
]
include_dirs = [ "." ]
deps = [
+ ":fxbarcode",
":fxcrt",
":fxjs",
]
@@ -1746,6 +1837,7 @@ test("pdfium_unittests") {
"core/fpdfapi/edit/cpdf_pagecontentgenerator_unittest.cpp",
"core/fpdfapi/font/fpdf_font_cid_unittest.cpp",
"core/fpdfapi/font/fpdf_font_unittest.cpp",
+ "core/fpdfapi/page/cpdf_devicecs_unittest.cpp",
"core/fpdfapi/page/cpdf_streamcontentparser_unittest.cpp",
"core/fpdfapi/page/cpdf_streamparser_unittest.cpp",
"core/fpdfapi/parser/cpdf_array_unittest.cpp",
@@ -1762,22 +1854,23 @@ test("pdfium_unittests") {
"core/fxcodec/codec/fx_codec_a85_unittest.cpp",
"core/fxcodec/codec/fx_codec_jpx_unittest.cpp",
"core/fxcodec/codec/fx_codec_rle_unittest.cpp",
+ "core/fxcodec/jbig2/JBig2_BitStream_unittest.cpp",
"core/fxcodec/jbig2/JBig2_Image_unittest.cpp",
+ "core/fxcrt/cfx_bytestring_unittest.cpp",
"core/fxcrt/cfx_maybe_owned_unittest.cpp",
"core/fxcrt/cfx_observable_unittest.cpp",
"core/fxcrt/cfx_retain_ptr_unittest.cpp",
"core/fxcrt/cfx_shared_copy_on_write_unittest.cpp",
"core/fxcrt/cfx_string_pool_template_unittest.cpp",
"core/fxcrt/cfx_weak_ptr_unittest.cpp",
- "core/fxcrt/fx_basic_bstring_unittest.cpp",
+ "core/fxcrt/cfx_widestring_unittest.cpp",
"core/fxcrt/fx_basic_gcc_unittest.cpp",
"core/fxcrt/fx_basic_memmgr_unittest.cpp",
"core/fxcrt/fx_basic_util_unittest.cpp",
- "core/fxcrt/fx_basic_wstring_unittest.cpp",
"core/fxcrt/fx_bidi_unittest.cpp",
"core/fxcrt/fx_extension_unittest.cpp",
"core/fxcrt/fx_system_unittest.cpp",
- "core/fxge/dib/fx_dib_engine_unittest.cpp",
+ "core/fxge/dib/cstretchengine_unittest.cpp",
"fpdfsdk/fpdfdoc_unittest.cpp",
"fpdfsdk/fpdfeditimg_unittest.cpp",
"fpdfsdk/fpdfview_unittest.cpp",
@@ -1791,14 +1884,15 @@ test("pdfium_unittests") {
include_dirs = []
if (pdf_enable_xfa) {
sources += [
+ "fxbarcode/pdf417/BC_PDF417HighLevelEncoder_unittest.cpp",
"xfa/fde/cfde_txtedtbuf_unittest.cpp",
"xfa/fde/css/cfde_cssdeclaration_unittest.cpp",
"xfa/fde/css/cfde_cssstylesheet_unittest.cpp",
"xfa/fde/css/cfde_cssvaluelistparser_unittest.cpp",
- "xfa/fde/xml/fde_xml_imp_unittest.cpp",
- "xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder_unittest.cpp",
+ "xfa/fde/xml/cfde_xmlsyntaxparser_unittest.cpp",
+ "xfa/fgas/layout/fgas_rtfbreak_unittest.cpp",
"xfa/fxfa/app/cxfa_textparser_unittest.cpp",
- "xfa/fxfa/app/xfa_ffapp_unittest.cpp",
+ "xfa/fxfa/cxfa_ffapp_unittest.cpp",
"xfa/fxfa/fm2js/xfa_simpleexpression_unittest.cpp",
"xfa/fxfa/parser/xfa_utils_unittest.cpp",
]
@@ -1889,3 +1983,17 @@ if (pdf_is_standalone) {
]
}
}
+
+group("pdfium_all") {
+ testonly = true
+ deps = [
+ ":pdfium_embeddertests",
+ ":pdfium_unittests",
+ ]
+ if (pdf_is_standalone) {
+ deps += [
+ ":fuzzers",
+ ":samples",
+ ]
+ }
+}
diff --git a/chromium/third_party/pdfium/DEPS b/chromium/third_party/pdfium/DEPS
index 7ebf412cdb6..87d2ad866a2 100644
--- a/chromium/third_party/pdfium/DEPS
+++ b/chromium/third_party/pdfium/DEPS
@@ -5,21 +5,28 @@ vars = {
'pdfium_git': 'https://pdfium.googlesource.com',
'android_ndk_revision': '26d93ec07f3ce2ec2cdfeae1b21ee6f12ff868d8',
- 'build_revision': 'dd795a26b9e43ff3a0d761bfd509c2fa67a3a7a1',
- 'buildtools_revision': 'cf493f8b1ae59611b19b000d7af922559b6ae92a',
+ 'build_revision': 'a634e44492100123636cd2e66cc3cadd828f7031',
+ 'buildtools_revision': 'e6b510a9daf822bbe9f922c200c58150803d2fd8',
'catapult_revision': '86352b966b0245d6883e5f7df27687856978b6d7',
- 'clang_revision': '37d701b87a10a2bdee1a5c3523f754ebf64a7e66',
+ 'clang_revision': 'c55112ff399f9ad6958b4bb58ca031b8ada63628',
'cygwin_revision': 'c89e446b273697fadf3a10ff1007a97c0b7de6df',
+ 'freetype_revision': '66725768cdf758cfb3f9abf03cbf5e5a77f42088',
'gen_library_loader_revision': '916d4acd8b2cde67a390737dfba90b3c37de23a1',
'gmock_revision': '29763965ab52f24565299976b936d1265cb6a271',
'gtest_revision': '8245545b6dc9c4703e6496d1efd19e975ad2b038',
'icu_revision': '73e24736676b4b438270fda44e5b2c83b49fdd80',
'instrumented_lib_revision': '45f5814b1543e41ea0be54c771e3840ea52cca4a',
- 'pdfium_tests_revision': 'd25a422ab03d6c3109370bc454c629575e969329',
+ 'jinja2_revision': 'd34383206fa42d52faa10bb9931d6d538f3a57e0',
+ 'jpeg_turbo_revision': '7260e4d8b8e1e40b17f03fafdf1cd83296900f76',
+ 'markupsafe_revision': '8f45f5cfa0009d2a70589bcda0349b8cb2b72783',
+ 'pdfium_tests_revision': '7c6a0e40f9e4f6f69f75adeae974f86f4ee98f96',
'skia_revision': '90e3cd78991ef337dbd0023efb30ece864694308',
'tools_memory_revision': '427f10475e1a8d72424c29d00bf689122b738e5d',
'trace_event_revision': '06294c8a4a6f744ef284cd63cfe54dbf61eea290',
- 'v8_revision': '7a634798302b4ab1f1525a9a881629519c0c2a99',
+ 'v8_revision': '07b2253a044bffa43697c6a43aaccb68c7e82af4',
+ 'yasm_binary_revision': '52f9b3f4b0aa06da24ef8b123058bb61ee468881',
+ 'yasm_source_revision': '7da28c6c7c6a1387217352ce02b31754deb54d2a',
+ 'zlib_revision': 'eed2732a73838fd581cb25819ab1c4f478d6b38f',
}
deps = {
@@ -31,7 +38,8 @@ deps = {
Var('chromium_git') + "/chromium/src/build.git@" + Var('build_revision'),
"buildtools":
- Var('chromium_git') + "/chromium/buildtools.git@" + Var('buildtools_revision'),
+ Var('chromium_git') + "/chromium/buildtools.git@" +
+ Var('buildtools_revision'),
"testing/corpus":
Var('pdfium_git') + "/pdfium_tests@" + Var('pdfium_tests_revision'),
@@ -42,14 +50,40 @@ deps = {
"testing/gtest":
Var('chromium_git') + "/external/googletest.git@" + Var('gtest_revision'),
+ "third_party/freetype/src":
+ Var('chromium_git') + '/chromium/src/third_party/freetype2.git@' +
+ Var('freetype_revision'),
+
"third_party/icu":
Var('chromium_git') + "/chromium/deps/icu.git@" + Var('icu_revision'),
"third_party/instrumented_libraries":
- Var('chromium_git') + "/chromium/src/third_party/instrumented_libraries.git@" + Var('instrumented_lib_revision'),
+ Var('chromium_git') +
+ "/chromium/src/third_party/instrumented_libraries.git@" +
+ Var('instrumented_lib_revision'),
+
+ "third_party/jinja2":
+ Var('chromium_git') + "/chromium/src/third_party/jinja2.git@" +
+ Var('jinja2_revision'),
+
+ "third_party/markupsafe":
+ Var('chromium_git') + "/chromium/src/third_party/markupsafe.git@" +
+ Var('markupsafe_revision'),
+
+ "third_party/libjpeg_turbo":
+ Var('chromium_git') + "/chromium/deps/libjpeg_turbo.git@" +
+ Var('jpeg_turbo_revision'),
"third_party/skia":
- Var('chromium_git') + '/skia.git' + '@' + Var('skia_revision'),
+ Var('chromium_git') + '/skia.git@' + Var('skia_revision'),
+
+ "third_party/zlib":
+ Var('chromium_git') + "/chromium/src/third_party/zlib.git@" +
+ Var('zlib_revision'),
+
+ 'third_party/yasm/source/patched-yasm':
+ Var('chromium_git') + '/chromium/deps/yasm/patched-yasm.git@' +
+ Var('yasm_source_revision'),
"tools/clang":
Var('chromium_git') + "/chromium/src/tools/clang@" + Var('clang_revision'),
@@ -58,10 +92,6 @@ deps = {
Var('chromium_git') + "/chromium/src/tools/generate_library_loader@" +
Var('gen_library_loader_revision'),
- # TODO(GYP): Remove this when no tools rely on GYP anymore.
- "tools/gyp":
- Var('chromium_git') + '/external/gyp.git' + '@' + 'c61b0b35c8396bfd59efc6cfc11401d912b0f510',
-
"tools/memory":
Var('chromium_git') + "/chromium/src/tools/memory@" +
Var('tools_memory_revision'),
@@ -75,9 +105,20 @@ deps_os = {
"third_party/android_ndk":
Var('chromium_git') + "/android_ndk.git@" + Var('android_ndk_revision'),
"third_party/catapult":
- Var('chromium_git') + "/external/github.com/catapult-project/catapult.git@" + Var('catapult_revision'),
+ Var('chromium_git') +
+ "/external/github.com/catapult-project/catapult.git@" +
+ Var('catapult_revision'),
},
"win": {
+ 'third_party/yasm/binaries':
+ Var('chromium_git') + '/chromium/deps/yasm/binaries.git' + '@' +
+ Var('yasm_binary_revision'),
+
+ # TODO(GYP): Remove this when no tools rely on GYP anymore.
+ "tools/gyp":
+ Var('chromium_git') + '/external/gyp.git@' +
+ 'c61b0b35c8396bfd59efc6cfc11401d912b0f510',
+
"v8/third_party/cygwin":
Var('chromium_git') + "/chromium/deps/cygwin@" + Var('cygwin_revision'),
},
diff --git a/chromium/third_party/pdfium/README.md b/chromium/third_party/pdfium/README.md
index 8e1fbcb93a0..1f2b9236833 100644
--- a/chromium/third_party/pdfium/README.md
+++ b/chromium/third_party/pdfium/README.md
@@ -36,7 +36,7 @@ authentication instructions. **Note that you must authenticate with your
@google.com credentials**. Enter "0" if asked for a project-id.
Once you've done this, the toolchain will be installed automatically for
-you in [the step](#GenBuild) below.
+you in the [Generate the build files](#GenBuild) step below.
The toolchain will be in `depot_tools\win_toolchain\vs_files\<hash>`, and windbg
can be found in `depot_tools\win_toolchain\vs_files\<hash>\win_sdk\Debuggers`.
@@ -58,15 +58,12 @@ gclient sync
cd pdfium
```
-##<a name="GenBuild"></a> Generate the build files
+## Generate the build files
We use GN to generate the build files and
-[Ninja](http://martine.github.io/ninja/) (also included with the depot\_tools
-checkout) to execute the build files.
-
-```
-gn gen <directory>
-```
+[Ninja](http://martine.github.io/ninja/)
+to execute the build files. Both of these are included with the
+depot\_tools checkout.
### Selecting build configuration
@@ -90,17 +87,20 @@ pdf_is_standalone = true # Set for a non-embedded build.
is_component_build = false # Disable component build (must be false)
clang_use_chrome_plugins = false # Currently must be false.
-use_sysroot = false # Currently must be false on Linux.
+use_sysroot = false # Currently must be false on Linux, but entirely omitted on windows.
```
Note, you must set `pdf_is_standalone = true` if you want the sample
applications like `pdfium_test` to build.
-When complete the arguments will be stored in `<directory>/args.gn`.
+When complete the arguments will be stored in `<directory>/args.gn`, and
+GN will automatically use the new arguments to generate build files.
+Should your files fail to generate, please double-check that you have set
+use\_sysroot as indicated above.
## Building the code
-If you used Ninja, you can build the sample program by:
+You can build the sample program by:
`ninja -C <directory>/pdfium_test` You can build the entire product (which
includes a few unit tests) by: `ninja -C <directory>`.
diff --git a/chromium/third_party/pdfium/build_overrides/pdfium.gni b/chromium/third_party/pdfium/build_overrides/pdfium.gni
index 18e6a873994..e42888f55f5 100644
--- a/chromium/third_party/pdfium/build_overrides/pdfium.gni
+++ b/chromium/third_party/pdfium/build_overrides/pdfium.gni
@@ -5,16 +5,28 @@
# This file contains PDFium-related build overrides.
# Build PDFium either with or without v8 support.
+# Default: With V8 support.
pdf_enable_v8_override = true
# Build PDFium either with or without XFA Forms support.
+# Default: Without XFA support.
pdf_enable_xfa_override = false
-# Build PDFium against skia (experimental) rather than agg, replacing all PDFium graphics.
+# Build PDFium either using a bundled FreeType library, or using the FreeType
+# target defined in //build/config/freetype.
+# Default: Use a bundled FreeType.
+pdf_bundle_freetype_override = true
+
+# Build PDFium against skia (experimental) rather than agg, replacing all PDFium
+# graphics.
+# Default: Use agg.
pdf_use_skia_override = false
-# Build PDFium against skia (experimental) rather than agg, adding only path support.
+# Build PDFium against skia (experimental) rather than agg, adding only path
+# support.
+# Default: Use agg.
pdf_use_skia_paths_override = false
# Build PDFium either with or without experimental win32 GDI APIs.
+# Default: Without experimental win32 GDI APIs.
pdf_use_win32_gdi_override = false
diff --git a/chromium/third_party/pdfium/core/fdrm/crypto/fx_crypt.cpp b/chromium/third_party/pdfium/core/fdrm/crypto/fx_crypt.cpp
index 4010ff49eeb..aac4edb3177 100644
--- a/chromium/third_party/pdfium/core/fdrm/crypto/fx_crypt.cpp
+++ b/chromium/third_party/pdfium/core/fdrm/crypto/fx_crypt.cpp
@@ -6,60 +6,6 @@
#include "core/fdrm/crypto/fx_crypt.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void CRYPT_ArcFourSetup(CRYPT_rc4_context* s,
- const uint8_t* key,
- uint32_t length) {
- int i, j, k, *m, a;
- s->x = 0;
- s->y = 0;
- m = s->m;
- for (i = 0; i < 256; i++) {
- m[i] = i;
- }
- j = k = 0;
- for (i = 0; i < 256; i++) {
- a = m[i];
- j = (j + a + key[k]) & 0xFF;
- m[i] = m[j];
- m[j] = a;
- if (++k >= (int)length) {
- k = 0;
- }
- }
-}
-
-void CRYPT_ArcFourCrypt(CRYPT_rc4_context* s,
- unsigned char* data,
- uint32_t length) {
- int i, x, y, *m, a, b;
- x = s->x;
- y = s->y;
- m = s->m;
- for (i = 0; i < (int)length; i++) {
- x = (x + 1) & 0xFF;
- a = m[x];
- y = (y + a) & 0xFF;
- m[x] = b = m[y];
- m[y] = a;
- data[i] ^= m[(a + b) & 0xFF];
- }
- s->x = x;
- s->y = y;
-}
-
-void CRYPT_ArcFourCryptBlock(uint8_t* pData,
- uint32_t size,
- const uint8_t* key,
- uint32_t keylen) {
- CRYPT_rc4_context s;
- CRYPT_ArcFourSetup(&s, key, keylen);
- CRYPT_ArcFourCrypt(&s, pData, size);
-}
-
#define GET_UINT32(n, b, i) \
{ \
(n) = (uint32_t)((uint8_t*)b)[(i)] | \
@@ -75,6 +21,13 @@ void CRYPT_ArcFourCryptBlock(uint8_t* pData,
(((uint8_t*)b)[(i) + 3]) = (uint8_t)(((n) >> 24) & 0xFF); \
}
+namespace {
+
+const uint8_t md5_padding[64] = {
+ 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+
void md5_process(CRYPT_md5_context* ctx, const uint8_t data[64]) {
uint32_t A, B, C, D, X[16];
GET_UINT32(X[0], data, 0);
@@ -181,6 +134,58 @@ void md5_process(CRYPT_md5_context* ctx, const uint8_t data[64]) {
ctx->state[3] += D;
}
+} // namespace
+
+void CRYPT_ArcFourSetup(CRYPT_rc4_context* s,
+ const uint8_t* key,
+ uint32_t length) {
+ int i, j, k, *m, a;
+ s->x = 0;
+ s->y = 0;
+ m = s->m;
+ for (i = 0; i < 256; i++) {
+ m[i] = i;
+ }
+ j = k = 0;
+ for (i = 0; i < 256; i++) {
+ a = m[i];
+ j = (j + a + key[k]) & 0xFF;
+ m[i] = m[j];
+ m[j] = a;
+ if (++k >= (int)length) {
+ k = 0;
+ }
+ }
+}
+
+void CRYPT_ArcFourCrypt(CRYPT_rc4_context* s,
+ unsigned char* data,
+ uint32_t length) {
+ int i, x, y, *m, a, b;
+ x = s->x;
+ y = s->y;
+ m = s->m;
+ for (i = 0; i < (int)length; i++) {
+ x = (x + 1) & 0xFF;
+ a = m[x];
+ y = (y + a) & 0xFF;
+ m[x] = b = m[y];
+ m[y] = a;
+ data[i] ^= m[(a + b) & 0xFF];
+ }
+ s->x = x;
+ s->y = y;
+}
+
+void CRYPT_ArcFourCryptBlock(uint8_t* pData,
+ uint32_t size,
+ const uint8_t* key,
+ uint32_t keylen) {
+ CRYPT_rc4_context s;
+ CRYPT_ArcFourSetup(&s, key, keylen);
+ CRYPT_ArcFourCrypt(&s, pData, size);
+}
+
void CRYPT_MD5Start(CRYPT_md5_context* ctx) {
ctx->total[0] = 0;
ctx->total[1] = 0;
@@ -204,7 +209,7 @@ void CRYPT_MD5Update(CRYPT_md5_context* ctx,
ctx->total[0] &= 0xFFFFFFFF;
ctx->total[1] += ctx->total[0] < length << 3;
if (left && length >= fill) {
- FXSYS_memcpy((void*)(ctx->buffer + left), (void*)input, fill);
+ memcpy(ctx->buffer + left, input, fill);
md5_process(ctx, ctx->buffer);
length -= fill;
input += fill;
@@ -216,15 +221,10 @@ void CRYPT_MD5Update(CRYPT_md5_context* ctx,
input += 64;
}
if (length) {
- FXSYS_memcpy((void*)(ctx->buffer + left), (void*)input, length);
+ memcpy(ctx->buffer + left, input, length);
}
}
-const uint8_t md5_padding[64] = {
- 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
-
void CRYPT_MD5Finish(CRYPT_md5_context* ctx, uint8_t digest[16]) {
uint32_t last, padn;
uint8_t msglen[8];
@@ -248,7 +248,3 @@ void CRYPT_MD5Generate(const uint8_t* input,
CRYPT_MD5Update(&ctx, input, length);
CRYPT_MD5Finish(&ctx, digest);
}
-
-#ifdef __cplusplus
-};
-#endif
diff --git a/chromium/third_party/pdfium/core/fdrm/crypto/fx_crypt.h b/chromium/third_party/pdfium/core/fdrm/crypto/fx_crypt.h
index a498f4e19ba..cfbe119ddb7 100644
--- a/chromium/third_party/pdfium/core/fdrm/crypto/fx_crypt.h
+++ b/chromium/third_party/pdfium/core/fdrm/crypto/fx_crypt.h
@@ -9,10 +9,6 @@
#include "core/fxcrt/fx_system.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
typedef struct {
int32_t x;
int32_t y;
@@ -109,8 +105,5 @@ void CRYPT_SHA512Finish(void* context, uint8_t digest[64]);
void CRYPT_SHA512Generate(const uint8_t* data,
uint32_t size,
uint8_t digest[64]);
-#ifdef __cplusplus
-};
-#endif
#endif // CORE_FDRM_CRYPTO_FX_CRYPT_H_
diff --git a/chromium/third_party/pdfium/core/fdrm/crypto/fx_crypt_aes.cpp b/chromium/third_party/pdfium/core/fdrm/crypto/fx_crypt_aes.cpp
index 8484b6f4a50..671dc65f31e 100644
--- a/chromium/third_party/pdfium/core/fdrm/crypto/fx_crypt_aes.cpp
+++ b/chromium/third_party/pdfium/core/fdrm/crypto/fx_crypt_aes.cpp
@@ -6,9 +6,6 @@
#include "core/fdrm/crypto/fx_crypt.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
#define MAX_NR 14
#define MAX_NK 8
#define MAX_NB 8
@@ -25,6 +22,7 @@ extern "C" {
(cp)[1] = (value) >> 16; \
(cp)[0] = (value) >> 24; \
} while (0)
+
struct AESContext {
unsigned int keysched[(MAX_NR + 1) * MAX_NB];
unsigned int invkeysched[(MAX_NR + 1) * MAX_NB];
@@ -33,7 +31,10 @@ struct AESContext {
unsigned int iv[MAX_NB];
int Nb, Nr;
};
-static const unsigned char Sbox[256] = {
+
+namespace {
+
+const unsigned char Sbox[256] = {
0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b,
0xfe, 0xd7, 0xab, 0x76, 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0,
0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, 0xb7, 0xfd, 0x93, 0x26,
@@ -56,7 +57,7 @@ static const unsigned char Sbox[256] = {
0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf,
0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f,
0xb0, 0x54, 0xbb, 0x16};
-static const unsigned char Sboxinv[256] = {
+const unsigned char Sboxinv[256] = {
0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e,
0x81, 0xf3, 0xd7, 0xfb, 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87,
0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb, 0x54, 0x7b, 0x94, 0x32,
@@ -79,7 +80,7 @@ static const unsigned char Sboxinv[256] = {
0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61,
0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63,
0x55, 0x21, 0x0c, 0x7d};
-static const unsigned int E0[256] = {
+const unsigned int E0[256] = {
0xc66363a5, 0xf87c7c84, 0xee777799, 0xf67b7b8d, 0xfff2f20d, 0xd66b6bbd,
0xde6f6fb1, 0x91c5c554, 0x60303050, 0x02010103, 0xce6767a9, 0x562b2b7d,
0xe7fefe19, 0xb5d7d762, 0x4dababe6, 0xec76769a, 0x8fcaca45, 0x1f82829d,
@@ -124,7 +125,7 @@ static const unsigned int E0[256] = {
0x844242c6, 0xd06868b8, 0x824141c3, 0x299999b0, 0x5a2d2d77, 0x1e0f0f11,
0x7bb0b0cb, 0xa85454fc, 0x6dbbbbd6, 0x2c16163a,
};
-static const unsigned int E1[256] = {
+const unsigned int E1[256] = {
0xa5c66363, 0x84f87c7c, 0x99ee7777, 0x8df67b7b, 0x0dfff2f2, 0xbdd66b6b,
0xb1de6f6f, 0x5491c5c5, 0x50603030, 0x03020101, 0xa9ce6767, 0x7d562b2b,
0x19e7fefe, 0x62b5d7d7, 0xe64dabab, 0x9aec7676, 0x458fcaca, 0x9d1f8282,
@@ -169,7 +170,7 @@ static const unsigned int E1[256] = {
0xc6844242, 0xb8d06868, 0xc3824141, 0xb0299999, 0x775a2d2d, 0x111e0f0f,
0xcb7bb0b0, 0xfca85454, 0xd66dbbbb, 0x3a2c1616,
};
-static const unsigned int E2[256] = {
+const unsigned int E2[256] = {
0x63a5c663, 0x7c84f87c, 0x7799ee77, 0x7b8df67b, 0xf20dfff2, 0x6bbdd66b,
0x6fb1de6f, 0xc55491c5, 0x30506030, 0x01030201, 0x67a9ce67, 0x2b7d562b,
0xfe19e7fe, 0xd762b5d7, 0xabe64dab, 0x769aec76, 0xca458fca, 0x829d1f82,
@@ -214,7 +215,7 @@ static const unsigned int E2[256] = {
0x42c68442, 0x68b8d068, 0x41c38241, 0x99b02999, 0x2d775a2d, 0x0f111e0f,
0xb0cb7bb0, 0x54fca854, 0xbbd66dbb, 0x163a2c16,
};
-static const unsigned int E3[256] = {
+const unsigned int E3[256] = {
0x6363a5c6, 0x7c7c84f8, 0x777799ee, 0x7b7b8df6, 0xf2f20dff, 0x6b6bbdd6,
0x6f6fb1de, 0xc5c55491, 0x30305060, 0x01010302, 0x6767a9ce, 0x2b2b7d56,
0xfefe19e7, 0xd7d762b5, 0xababe64d, 0x76769aec, 0xcaca458f, 0x82829d1f,
@@ -259,7 +260,7 @@ static const unsigned int E3[256] = {
0x4242c684, 0x6868b8d0, 0x4141c382, 0x9999b029, 0x2d2d775a, 0x0f0f111e,
0xb0b0cb7b, 0x5454fca8, 0xbbbbd66d, 0x16163a2c,
};
-static const unsigned int D0[256] = {
+const unsigned int D0[256] = {
0x51f4a750, 0x7e416553, 0x1a17a4c3, 0x3a275e96, 0x3bab6bcb, 0x1f9d45f1,
0xacfa58ab, 0x4be30393, 0x2030fa55, 0xad766df6, 0x88cc7691, 0xf5024c25,
0x4fe5d7fc, 0xc52acbd7, 0x26354480, 0xb562a38f, 0xdeb15a49, 0x25ba1b67,
@@ -304,7 +305,7 @@ static const unsigned int D0[256] = {
0x283c498b, 0xff0d9541, 0x39a80171, 0x080cb3de, 0xd8b4e49c, 0x6456c190,
0x7bcb8461, 0xd532b670, 0x486c5c74, 0xd0b85742,
};
-static const unsigned int D1[256] = {
+const unsigned int D1[256] = {
0x5051f4a7, 0x537e4165, 0xc31a17a4, 0x963a275e, 0xcb3bab6b, 0xf11f9d45,
0xabacfa58, 0x934be303, 0x552030fa, 0xf6ad766d, 0x9188cc76, 0x25f5024c,
0xfc4fe5d7, 0xd7c52acb, 0x80263544, 0x8fb562a3, 0x49deb15a, 0x6725ba1b,
@@ -349,7 +350,7 @@ static const unsigned int D1[256] = {
0x8b283c49, 0x41ff0d95, 0x7139a801, 0xde080cb3, 0x9cd8b4e4, 0x906456c1,
0x617bcb84, 0x70d532b6, 0x74486c5c, 0x42d0b857,
};
-static const unsigned int D2[256] = {
+const unsigned int D2[256] = {
0xa75051f4, 0x65537e41, 0xa4c31a17, 0x5e963a27, 0x6bcb3bab, 0x45f11f9d,
0x58abacfa, 0x03934be3, 0xfa552030, 0x6df6ad76, 0x769188cc, 0x4c25f502,
0xd7fc4fe5, 0xcbd7c52a, 0x44802635, 0xa38fb562, 0x5a49deb1, 0x1b6725ba,
@@ -394,7 +395,7 @@ static const unsigned int D2[256] = {
0x498b283c, 0x9541ff0d, 0x017139a8, 0xb3de080c, 0xe49cd8b4, 0xc1906456,
0x84617bcb, 0xb670d532, 0x5c74486c, 0x5742d0b8,
};
-static const unsigned int D3[256] = {
+const unsigned int D3[256] = {
0xf4a75051, 0x4165537e, 0x17a4c31a, 0x275e963a, 0xab6bcb3b, 0x9d45f11f,
0xfa58abac, 0xe303934b, 0x30fa5520, 0x766df6ad, 0xcc769188, 0x024c25f5,
0xe5d7fc4f, 0x2acbd7c5, 0x35448026, 0x62a38fb5, 0xb15a49de, 0xba1b6725,
@@ -461,9 +462,9 @@ static const unsigned int D3[256] = {
(Sbox[(block[(i + C1) % Nb] >> 16) & 0xFF] << 16) | \
(Sbox[(block[(i + C2) % Nb] >> 8) & 0xFF] << 8) | \
(Sbox[(block[(i + C3) % Nb]) & 0xFF]))
-static void aes_encrypt_nb_4(AESContext* ctx, unsigned int* block) {
+void aes_encrypt_nb_4(AESContext* ctx, unsigned int* block) {
int i;
- static const int C1 = 1, C2 = 2, C3 = 3, Nb = 4;
+ const int C1 = 1, C2 = 2, C3 = 3, Nb = 4;
unsigned int* keysched = ctx->keysched;
unsigned int newstate[4];
for (i = 0; i < ctx->Nr - 1; i++) {
@@ -488,9 +489,9 @@ static void aes_encrypt_nb_4(AESContext* ctx, unsigned int* block) {
MOVEWORD(3);
ADD_ROUND_KEY_4;
}
-static void aes_encrypt_nb_6(AESContext* ctx, unsigned int* block) {
+void aes_encrypt_nb_6(AESContext* ctx, unsigned int* block) {
int i;
- static const int C1 = 1, C2 = 2, C3 = 3, Nb = 6;
+ const int C1 = 1, C2 = 2, C3 = 3, Nb = 6;
unsigned int* keysched = ctx->keysched;
unsigned int newstate[6];
for (i = 0; i < ctx->Nr - 1; i++) {
@@ -523,9 +524,9 @@ static void aes_encrypt_nb_6(AESContext* ctx, unsigned int* block) {
MOVEWORD(5);
ADD_ROUND_KEY_6;
}
-static void aes_encrypt_nb_8(AESContext* ctx, unsigned int* block) {
+void aes_encrypt_nb_8(AESContext* ctx, unsigned int* block) {
int i;
- static const int C1 = 1, C2 = 3, C3 = 4, Nb = 8;
+ const int C1 = 1, C2 = 3, C3 = 4, Nb = 8;
unsigned int* keysched = ctx->keysched;
unsigned int newstate[8];
for (i = 0; i < ctx->Nr - 1; i++) {
@@ -578,9 +579,9 @@ static void aes_encrypt_nb_8(AESContext* ctx, unsigned int* block) {
(Sboxinv[(block[(i + C1) % Nb] >> 16) & 0xFF] << 16) | \
(Sboxinv[(block[(i + C2) % Nb] >> 8) & 0xFF] << 8) | \
(Sboxinv[(block[(i + C3) % Nb]) & 0xFF]))
-static void aes_decrypt_nb_4(AESContext* ctx, unsigned int* block) {
+void aes_decrypt_nb_4(AESContext* ctx, unsigned int* block) {
int i;
- static const int C1 = 4 - 1, C2 = 4 - 2, C3 = 4 - 3, Nb = 4;
+ const int C1 = 4 - 1, C2 = 4 - 2, C3 = 4 - 3, Nb = 4;
unsigned int* keysched = ctx->invkeysched;
unsigned int newstate[4];
for (i = 0; i < ctx->Nr - 1; i++) {
@@ -605,9 +606,9 @@ static void aes_decrypt_nb_4(AESContext* ctx, unsigned int* block) {
MOVEWORD(3);
ADD_ROUND_KEY_4;
}
-static void aes_decrypt_nb_6(AESContext* ctx, unsigned int* block) {
+void aes_decrypt_nb_6(AESContext* ctx, unsigned int* block) {
int i;
- static const int C1 = 6 - 1, C2 = 6 - 2, C3 = 6 - 3, Nb = 6;
+ const int C1 = 6 - 1, C2 = 6 - 2, C3 = 6 - 3, Nb = 6;
unsigned int* keysched = ctx->invkeysched;
unsigned int newstate[6];
for (i = 0; i < ctx->Nr - 1; i++) {
@@ -640,9 +641,9 @@ static void aes_decrypt_nb_6(AESContext* ctx, unsigned int* block) {
MOVEWORD(5);
ADD_ROUND_KEY_6;
}
-static void aes_decrypt_nb_8(AESContext* ctx, unsigned int* block) {
+void aes_decrypt_nb_8(AESContext* ctx, unsigned int* block) {
int i;
- static const int C1 = 8 - 1, C2 = 8 - 3, C3 = 8 - 4, Nb = 8;
+ const int C1 = 8 - 1, C2 = 8 - 3, C3 = 8 - 4, Nb = 8;
unsigned int* keysched = ctx->invkeysched;
unsigned int newstate[8];
for (i = 0; i < ctx->Nr - 1; i++) {
@@ -685,10 +686,10 @@ static void aes_decrypt_nb_8(AESContext* ctx, unsigned int* block) {
}
#undef MAKEWORD
#undef LASTWORD
-static void aes_setup(AESContext* ctx,
- int blocklen,
- const unsigned char* key,
- int keylen) {
+void aes_setup(AESContext* ctx,
+ int blocklen,
+ const unsigned char* key,
+ int keylen) {
int i, j, Nk, rconst;
ASSERT(blocklen == 16 || blocklen == 24 || blocklen == 32);
ASSERT(keylen == 16 || keylen == 24 || keylen == 32);
@@ -752,17 +753,17 @@ static void aes_setup(AESContext* ctx,
}
}
}
-static void aes_decrypt(AESContext* ctx, unsigned int* block) {
+void aes_decrypt(AESContext* ctx, unsigned int* block) {
ctx->decrypt(ctx, block);
}
-static void aes_decrypt_cbc(unsigned char* dest,
- const unsigned char* src,
- int len,
- AESContext* ctx) {
+void aes_decrypt_cbc(unsigned char* dest,
+ const unsigned char* src,
+ int len,
+ AESContext* ctx) {
unsigned int iv[4], x[4], ct[4];
int i;
ASSERT((len & 15) == 0);
- FXSYS_memcpy(iv, ctx->iv, sizeof(iv));
+ memcpy(iv, ctx->iv, sizeof(iv));
while (len > 0) {
for (i = 0; i < 4; i++) {
x[i] = ct[i] = GET_32BIT_MSB_FIRST(src + 4 * i);
@@ -776,19 +777,19 @@ static void aes_decrypt_cbc(unsigned char* dest,
src += 16;
len -= 16;
}
- FXSYS_memcpy(ctx->iv, iv, sizeof(iv));
+ memcpy(ctx->iv, iv, sizeof(iv));
}
-static void aes_encrypt(AESContext* ctx, unsigned int* block) {
+void aes_encrypt(AESContext* ctx, unsigned int* block) {
ctx->encrypt(ctx, block);
}
-static void aes_encrypt_cbc(unsigned char* dest,
- const unsigned char* src,
- int len,
- AESContext* ctx) {
+void aes_encrypt_cbc(unsigned char* dest,
+ const unsigned char* src,
+ int len,
+ AESContext* ctx) {
unsigned int iv[4];
int i;
ASSERT((len & 15) == 0);
- FXSYS_memcpy(iv, ctx->iv, sizeof(iv));
+ memcpy(iv, ctx->iv, sizeof(iv));
while (len > 0) {
for (i = 0; i < 4; i++) {
iv[i] ^= GET_32BIT_MSB_FIRST(src + 4 * i);
@@ -801,8 +802,11 @@ static void aes_encrypt_cbc(unsigned char* dest,
src += 16;
len -= 16;
}
- FXSYS_memcpy(ctx->iv, iv, sizeof(iv));
+ memcpy(ctx->iv, iv, sizeof(iv));
}
+
+} // namespace
+
void CRYPT_AESSetKey(void* context,
uint32_t blocklen,
const uint8_t* key,
@@ -828,6 +832,3 @@ void CRYPT_AESEncrypt(void* context,
uint32_t len) {
aes_encrypt_cbc(dest, src, len, (AESContext*)context);
}
-#ifdef __cplusplus
-};
-#endif
diff --git a/chromium/third_party/pdfium/core/fdrm/crypto/fx_crypt_sha.cpp b/chromium/third_party/pdfium/core/fdrm/crypto/fx_crypt_sha.cpp
index 79ff503334f..7c0e64a9128 100644
--- a/chromium/third_party/pdfium/core/fdrm/crypto/fx_crypt_sha.cpp
+++ b/chromium/third_party/pdfium/core/fdrm/crypto/fx_crypt_sha.cpp
@@ -6,18 +6,89 @@
#include "core/fdrm/crypto/fx_crypt.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
#define rol(x, y) (((x) << (y)) | (((unsigned int)x) >> (32 - y)))
-static void SHA_Core_Init(unsigned int h[5]) {
+
+#define GET_UINT32(n, b, i) \
+ { \
+ (n) = ((uint32_t)(b)[(i)] << 24) | ((uint32_t)(b)[(i) + 1] << 16) | \
+ ((uint32_t)(b)[(i) + 2] << 8) | ((uint32_t)(b)[(i) + 3]); \
+ }
+#define PUT_UINT32(n, b, i) \
+ { \
+ (b)[(i)] = (uint8_t)((n) >> 24); \
+ (b)[(i) + 1] = (uint8_t)((n) >> 16); \
+ (b)[(i) + 2] = (uint8_t)((n) >> 8); \
+ (b)[(i) + 3] = (uint8_t)((n)); \
+ }
+
+#define SHA384_F0(x, y, z) ((x & y) | (z & (x | y)))
+#define SHA384_F1(x, y, z) (z ^ (x & (y ^ z)))
+#define SHA384_SHR(x, n) (x >> n)
+#define SHA384_ROTR(x, n) (SHA384_SHR(x, n) | x << (64 - n))
+#define SHA384_S0(x) (SHA384_ROTR(x, 1) ^ SHA384_ROTR(x, 8) ^ SHA384_SHR(x, 7))
+#define SHA384_S1(x) \
+ (SHA384_ROTR(x, 19) ^ SHA384_ROTR(x, 61) ^ SHA384_SHR(x, 6))
+#define SHA384_S2(x) \
+ (SHA384_ROTR(x, 28) ^ SHA384_ROTR(x, 34) ^ SHA384_ROTR(x, 39))
+#define SHA384_S3(x) \
+ (SHA384_ROTR(x, 14) ^ SHA384_ROTR(x, 18) ^ SHA384_ROTR(x, 41))
+#define SHA384_P(a, b, c, d, e, f, g, h, x, K) \
+ { \
+ temp1 = h + SHA384_S3(e) + SHA384_F1(e, f, g) + K + x; \
+ temp2 = SHA384_S2(a) + SHA384_F0(a, b, c); \
+ d += temp1; \
+ h = temp1 + temp2; \
+ }
+#define SHA384_R(t) \
+ (W[t] = SHA384_S1(W[t - 2]) + W[t - 7] + SHA384_S0(W[t - 15]) + W[t - 16])
+
+#define GET_FX_64WORD(n, b, i) \
+ { \
+ (n) = ((uint64_t)(b)[(i)] << 56) | ((uint64_t)(b)[(i) + 1] << 48) | \
+ ((uint64_t)(b)[(i) + 2] << 40) | ((uint64_t)(b)[(i) + 3] << 32) | \
+ ((uint64_t)(b)[(i) + 4] << 24) | ((uint64_t)(b)[(i) + 5] << 16) | \
+ ((uint64_t)(b)[(i) + 6] << 8) | ((uint64_t)(b)[(i) + 7]); \
+ }
+#define PUT_UINT64(n, b, i) \
+ { \
+ (b)[(i)] = (uint8_t)((n) >> 56); \
+ (b)[(i) + 1] = (uint8_t)((n) >> 48); \
+ (b)[(i) + 2] = (uint8_t)((n) >> 40); \
+ (b)[(i) + 3] = (uint8_t)((n) >> 32); \
+ (b)[(i) + 4] = (uint8_t)((n) >> 24); \
+ (b)[(i) + 5] = (uint8_t)((n) >> 16); \
+ (b)[(i) + 6] = (uint8_t)((n) >> 8); \
+ (b)[(i) + 7] = (uint8_t)((n)); \
+ }
+
+#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
+#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
+#define S0(x) (ROTR(x, 7) ^ ROTR(x, 18) ^ SHR(x, 3))
+#define S1(x) (ROTR(x, 17) ^ ROTR(x, 19) ^ SHR(x, 10))
+#define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
+#define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
+#define F0(x, y, z) ((x & y) | (z & (x | y)))
+#define F1(x, y, z) (z ^ (x & (y ^ z)))
+#define R(t) (W[t] = S1(W[t - 2]) + W[t - 7] + S0(W[t - 15]) + W[t - 16])
+#define P(a, b, c, d, e, f, g, h, x, K) \
+ { \
+ temp1 = h + S3(e) + F1(e, f, g) + K + x; \
+ temp2 = S2(a) + F0(a, b, c); \
+ d += temp1; \
+ h = temp1 + temp2; \
+ }
+
+namespace {
+
+void SHA_Core_Init(unsigned int h[5]) {
h[0] = 0x67452301;
h[1] = 0xefcdab89;
h[2] = 0x98badcfe;
h[3] = 0x10325476;
h[4] = 0xc3d2e1f0;
}
-static void SHATransform(unsigned int* digest, unsigned int* block) {
+
+void SHATransform(unsigned int* digest, unsigned int* block) {
unsigned int w[80];
unsigned int a, b, c, d, e;
int t;
@@ -73,110 +144,7 @@ static void SHATransform(unsigned int* digest, unsigned int* block) {
digest[4] += e;
}
-void CRYPT_SHA1Start(CRYPT_sha1_context* s) {
- SHA_Core_Init(s->h);
- s->blkused = 0;
- s->lenhi = s->lenlo = 0;
-}
-
-void CRYPT_SHA1Update(CRYPT_sha1_context* s,
- const uint8_t* data,
- uint32_t size) {
- unsigned char* q = (unsigned char*)data;
- unsigned int wordblock[16];
- int len = size;
- unsigned int lenw = len;
- int i;
- s->lenlo += lenw;
- s->lenhi += (s->lenlo < lenw);
- if (s->blkused && s->blkused + len < 64) {
- FXSYS_memcpy(s->block + s->blkused, q, len);
- s->blkused += len;
- } else {
- while (s->blkused + len >= 64) {
- FXSYS_memcpy(s->block + s->blkused, q, 64 - s->blkused);
- q += 64 - s->blkused;
- len -= 64 - s->blkused;
- for (i = 0; i < 16; i++) {
- wordblock[i] = (((unsigned int)s->block[i * 4 + 0]) << 24) |
- (((unsigned int)s->block[i * 4 + 1]) << 16) |
- (((unsigned int)s->block[i * 4 + 2]) << 8) |
- (((unsigned int)s->block[i * 4 + 3]) << 0);
- }
- SHATransform(s->h, wordblock);
- s->blkused = 0;
- }
- FXSYS_memcpy(s->block, q, len);
- s->blkused = len;
- }
-}
-
-void CRYPT_SHA1Finish(CRYPT_sha1_context* s, uint8_t digest[20]) {
- int i;
- int pad;
- unsigned char c[64];
- unsigned int lenhi, lenlo;
- if (s->blkused >= 56) {
- pad = 56 + 64 - s->blkused;
- } else {
- pad = 56 - s->blkused;
- }
- lenhi = (s->lenhi << 3) | (s->lenlo >> (32 - 3));
- lenlo = (s->lenlo << 3);
- FXSYS_memset(c, 0, pad);
- c[0] = 0x80;
- CRYPT_SHA1Update(s, c, pad);
- c[0] = (lenhi >> 24) & 0xFF;
- c[1] = (lenhi >> 16) & 0xFF;
- c[2] = (lenhi >> 8) & 0xFF;
- c[3] = (lenhi >> 0) & 0xFF;
- c[4] = (lenlo >> 24) & 0xFF;
- c[5] = (lenlo >> 16) & 0xFF;
- c[6] = (lenlo >> 8) & 0xFF;
- c[7] = (lenlo >> 0) & 0xFF;
- CRYPT_SHA1Update(s, c, 8);
- for (i = 0; i < 5; i++) {
- digest[i * 4] = (s->h[i] >> 24) & 0xFF;
- digest[i * 4 + 1] = (s->h[i] >> 16) & 0xFF;
- digest[i * 4 + 2] = (s->h[i] >> 8) & 0xFF;
- digest[i * 4 + 3] = (s->h[i]) & 0xFF;
- }
-}
-void CRYPT_SHA1Generate(const uint8_t* data,
- uint32_t size,
- uint8_t digest[20]) {
- CRYPT_sha1_context s;
- CRYPT_SHA1Start(&s);
- CRYPT_SHA1Update(&s, data, size);
- CRYPT_SHA1Finish(&s, digest);
-}
-#define GET_UINT32(n, b, i) \
- { \
- (n) = ((uint32_t)(b)[(i)] << 24) | ((uint32_t)(b)[(i) + 1] << 16) | \
- ((uint32_t)(b)[(i) + 2] << 8) | ((uint32_t)(b)[(i) + 3]); \
- }
-#define PUT_UINT32(n, b, i) \
- { \
- (b)[(i)] = (uint8_t)((n) >> 24); \
- (b)[(i) + 1] = (uint8_t)((n) >> 16); \
- (b)[(i) + 2] = (uint8_t)((n) >> 8); \
- (b)[(i) + 3] = (uint8_t)((n)); \
- }
-
-void CRYPT_SHA256Start(CRYPT_sha256_context* ctx) {
- ctx->total[0] = 0;
- ctx->total[1] = 0;
- ctx->state[0] = 0x6A09E667;
- ctx->state[1] = 0xBB67AE85;
- ctx->state[2] = 0x3C6EF372;
- ctx->state[3] = 0xA54FF53A;
- ctx->state[4] = 0x510E527F;
- ctx->state[5] = 0x9B05688C;
- ctx->state[6] = 0x1F83D9AB;
- ctx->state[7] = 0x5BE0CD19;
-}
-
-static void sha256_process(CRYPT_sha256_context* ctx, const uint8_t data[64]) {
+void sha256_process(CRYPT_sha256_context* ctx, const uint8_t data[64]) {
uint32_t temp1, temp2, W[64];
uint32_t A, B, C, D, E, F, G, H;
GET_UINT32(W[0], data, 0);
@@ -195,22 +163,6 @@ static void sha256_process(CRYPT_sha256_context* ctx, const uint8_t data[64]) {
GET_UINT32(W[13], data, 52);
GET_UINT32(W[14], data, 56);
GET_UINT32(W[15], data, 60);
-#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
-#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
-#define S0(x) (ROTR(x, 7) ^ ROTR(x, 18) ^ SHR(x, 3))
-#define S1(x) (ROTR(x, 17) ^ ROTR(x, 19) ^ SHR(x, 10))
-#define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
-#define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
-#define F0(x, y, z) ((x & y) | (z & (x | y)))
-#define F1(x, y, z) (z ^ (x & (y ^ z)))
-#define R(t) (W[t] = S1(W[t - 2]) + W[t - 7] + S0(W[t - 15]) + W[t - 16])
-#define P(a, b, c, d, e, f, g, h, x, K) \
- { \
- temp1 = h + S3(e) + F1(e, f, g) + K + x; \
- temp2 = S2(a) + F0(a, b, c); \
- d += temp1; \
- h = temp1 + temp2; \
- }
A = ctx->state[0];
B = ctx->state[1];
C = ctx->state[2];
@@ -293,131 +245,12 @@ static void sha256_process(CRYPT_sha256_context* ctx, const uint8_t data[64]) {
ctx->state[7] += H;
}
-void CRYPT_SHA256Update(CRYPT_sha256_context* ctx,
- const uint8_t* input,
- uint32_t length) {
- if (!length)
- return;
-
- uint32_t left = ctx->total[0] & 0x3F;
- uint32_t fill = 64 - left;
- ctx->total[0] += length;
- ctx->total[0] &= 0xFFFFFFFF;
- if (ctx->total[0] < length) {
- ctx->total[1]++;
- }
- if (left && length >= fill) {
- FXSYS_memcpy((void*)(ctx->buffer + left), (void*)input, fill);
- sha256_process(ctx, ctx->buffer);
- length -= fill;
- input += fill;
- left = 0;
- }
- while (length >= 64) {
- sha256_process(ctx, input);
- length -= 64;
- input += 64;
- }
- if (length) {
- FXSYS_memcpy((void*)(ctx->buffer + left), (void*)input, length);
- }
-}
-
-static const uint8_t sha256_padding[64] = {
+const uint8_t sha256_padding[64] = {
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
-void CRYPT_SHA256Finish(CRYPT_sha256_context* ctx, uint8_t digest[32]) {
- uint32_t last, padn;
- uint32_t high, low;
- uint8_t msglen[8];
- high = (ctx->total[0] >> 29) | (ctx->total[1] << 3);
- low = (ctx->total[0] << 3);
- PUT_UINT32(high, msglen, 0);
- PUT_UINT32(low, msglen, 4);
- last = ctx->total[0] & 0x3F;
- padn = (last < 56) ? (56 - last) : (120 - last);
- CRYPT_SHA256Update(ctx, sha256_padding, padn);
- CRYPT_SHA256Update(ctx, msglen, 8);
- PUT_UINT32(ctx->state[0], digest, 0);
- PUT_UINT32(ctx->state[1], digest, 4);
- PUT_UINT32(ctx->state[2], digest, 8);
- PUT_UINT32(ctx->state[3], digest, 12);
- PUT_UINT32(ctx->state[4], digest, 16);
- PUT_UINT32(ctx->state[5], digest, 20);
- PUT_UINT32(ctx->state[6], digest, 24);
- PUT_UINT32(ctx->state[7], digest, 28);
-}
-
-void CRYPT_SHA256Generate(const uint8_t* data,
- uint32_t size,
- uint8_t digest[32]) {
- CRYPT_sha256_context ctx;
- CRYPT_SHA256Start(&ctx);
- CRYPT_SHA256Update(&ctx, data, size);
- CRYPT_SHA256Finish(&ctx, digest);
-}
-
-uint64_t FX_ato64i(const FX_CHAR* str) {
- ASSERT(str);
- uint64_t ret = 0;
- int len = (int)FXSYS_strlen(str);
- len = len > 16 ? 16 : len;
- for (int i = 0; i < len; ++i) {
- if (i) {
- ret <<= 4;
- }
- if (str[i] >= '0' && str[i] <= '9') {
- ret |= (str[i] - '0') & 0xFF;
- } else if (str[i] >= 'a' && str[i] <= 'f') {
- ret |= (str[i] - 'a' + 10) & 0xFF;
- } else if (str[i] >= 'A' && str[i] <= 'F') {
- ret |= (str[i] - 'A' + 10) & 0xFF;
- } else {
- ASSERT(false);
- }
- }
- return ret;
-}
-
-void CRYPT_SHA384Start(CRYPT_sha384_context* ctx) {
- if (!ctx)
- return;
-
- FXSYS_memset(ctx, 0, sizeof(CRYPT_sha384_context));
- ctx->state[0] = FX_ato64i("cbbb9d5dc1059ed8");
- ctx->state[1] = FX_ato64i("629a292a367cd507");
- ctx->state[2] = FX_ato64i("9159015a3070dd17");
- ctx->state[3] = FX_ato64i("152fecd8f70e5939");
- ctx->state[4] = FX_ato64i("67332667ffc00b31");
- ctx->state[5] = FX_ato64i("8eb44a8768581511");
- ctx->state[6] = FX_ato64i("db0c2e0d64f98fa7");
- ctx->state[7] = FX_ato64i("47b5481dbefa4fa4");
-}
-
-#define SHA384_F0(x, y, z) ((x & y) | (z & (x | y)))
-#define SHA384_F1(x, y, z) (z ^ (x & (y ^ z)))
-#define SHA384_SHR(x, n) (x >> n)
-#define SHA384_ROTR(x, n) (SHA384_SHR(x, n) | x << (64 - n))
-#define SHA384_S0(x) (SHA384_ROTR(x, 1) ^ SHA384_ROTR(x, 8) ^ SHA384_SHR(x, 7))
-#define SHA384_S1(x) \
- (SHA384_ROTR(x, 19) ^ SHA384_ROTR(x, 61) ^ SHA384_SHR(x, 6))
-#define SHA384_S2(x) \
- (SHA384_ROTR(x, 28) ^ SHA384_ROTR(x, 34) ^ SHA384_ROTR(x, 39))
-#define SHA384_S3(x) \
- (SHA384_ROTR(x, 14) ^ SHA384_ROTR(x, 18) ^ SHA384_ROTR(x, 41))
-#define SHA384_P(a, b, c, d, e, f, g, h, x, K) \
- { \
- temp1 = h + SHA384_S3(e) + SHA384_F1(e, f, g) + K + x; \
- temp2 = SHA384_S2(a) + SHA384_F0(a, b, c); \
- d += temp1; \
- h = temp1 + temp2; \
- }
-#define SHA384_R(t) \
- (W[t] = SHA384_S1(W[t - 2]) + W[t - 7] + SHA384_S0(W[t - 15]) + W[t - 16])
-
-static const uint8_t sha384_padding[128] = {
+const uint8_t sha384_padding[128] = {
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -426,55 +259,37 @@ static const uint8_t sha384_padding[128] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
};
-static const FX_CHAR* constants[] = {
- "428a2f98d728ae22", "7137449123ef65cd", "b5c0fbcfec4d3b2f",
- "e9b5dba58189dbbc", "3956c25bf348b538", "59f111f1b605d019",
- "923f82a4af194f9b", "ab1c5ed5da6d8118", "d807aa98a3030242",
- "12835b0145706fbe", "243185be4ee4b28c", "550c7dc3d5ffb4e2",
- "72be5d74f27b896f", "80deb1fe3b1696b1", "9bdc06a725c71235",
- "c19bf174cf692694", "e49b69c19ef14ad2", "efbe4786384f25e3",
- "0fc19dc68b8cd5b5", "240ca1cc77ac9c65", "2de92c6f592b0275",
- "4a7484aa6ea6e483", "5cb0a9dcbd41fbd4", "76f988da831153b5",
- "983e5152ee66dfab", "a831c66d2db43210", "b00327c898fb213f",
- "bf597fc7beef0ee4", "c6e00bf33da88fc2", "d5a79147930aa725",
- "06ca6351e003826f", "142929670a0e6e70", "27b70a8546d22ffc",
- "2e1b21385c26c926", "4d2c6dfc5ac42aed", "53380d139d95b3df",
- "650a73548baf63de", "766a0abb3c77b2a8", "81c2c92e47edaee6",
- "92722c851482353b", "a2bfe8a14cf10364", "a81a664bbc423001",
- "c24b8b70d0f89791", "c76c51a30654be30", "d192e819d6ef5218",
- "d69906245565a910", "f40e35855771202a", "106aa07032bbd1b8",
- "19a4c116b8d2d0c8", "1e376c085141ab53", "2748774cdf8eeb99",
- "34b0bcb5e19b48a8", "391c0cb3c5c95a63", "4ed8aa4ae3418acb",
- "5b9cca4f7763e373", "682e6ff3d6b2b8a3", "748f82ee5defb2fc",
- "78a5636f43172f60", "84c87814a1f0ab72", "8cc702081a6439ec",
- "90befffa23631e28", "a4506cebde82bde9", "bef9a3f7b2c67915",
- "c67178f2e372532b", "ca273eceea26619c", "d186b8c721c0c207",
- "eada7dd6cde0eb1e", "f57d4f7fee6ed178", "06f067aa72176fba",
- "0a637dc5a2c898a6", "113f9804bef90dae", "1b710b35131c471b",
- "28db77f523047d84", "32caab7b40c72493", "3c9ebe0a15c9bebc",
- "431d67c49c100d4c", "4cc5d4becb3e42b6", "597f299cfc657e2a",
- "5fcb6fab3ad6faec", "6c44198c4a475817",
+uint64_t const constants[] = {
+ 0x428a2f98d728ae22ULL, 0x7137449123ef65cdULL, 0xb5c0fbcfec4d3b2fULL,
+ 0xe9b5dba58189dbbcULL, 0x3956c25bf348b538ULL, 0x59f111f1b605d019ULL,
+ 0x923f82a4af194f9bULL, 0xab1c5ed5da6d8118ULL, 0xd807aa98a3030242ULL,
+ 0x12835b0145706fbeULL, 0x243185be4ee4b28cULL, 0x550c7dc3d5ffb4e2ULL,
+ 0x72be5d74f27b896fULL, 0x80deb1fe3b1696b1ULL, 0x9bdc06a725c71235ULL,
+ 0xc19bf174cf692694ULL, 0xe49b69c19ef14ad2ULL, 0xefbe4786384f25e3ULL,
+ 0x0fc19dc68b8cd5b5ULL, 0x240ca1cc77ac9c65ULL, 0x2de92c6f592b0275ULL,
+ 0x4a7484aa6ea6e483ULL, 0x5cb0a9dcbd41fbd4ULL, 0x76f988da831153b5ULL,
+ 0x983e5152ee66dfabULL, 0xa831c66d2db43210ULL, 0xb00327c898fb213fULL,
+ 0xbf597fc7beef0ee4ULL, 0xc6e00bf33da88fc2ULL, 0xd5a79147930aa725ULL,
+ 0x06ca6351e003826fULL, 0x142929670a0e6e70ULL, 0x27b70a8546d22ffcULL,
+ 0x2e1b21385c26c926ULL, 0x4d2c6dfc5ac42aedULL, 0x53380d139d95b3dfULL,
+ 0x650a73548baf63deULL, 0x766a0abb3c77b2a8ULL, 0x81c2c92e47edaee6ULL,
+ 0x92722c851482353bULL, 0xa2bfe8a14cf10364ULL, 0xa81a664bbc423001ULL,
+ 0xc24b8b70d0f89791ULL, 0xc76c51a30654be30ULL, 0xd192e819d6ef5218ULL,
+ 0xd69906245565a910ULL, 0xf40e35855771202aULL, 0x106aa07032bbd1b8ULL,
+ 0x19a4c116b8d2d0c8ULL, 0x1e376c085141ab53ULL, 0x2748774cdf8eeb99ULL,
+ 0x34b0bcb5e19b48a8ULL, 0x391c0cb3c5c95a63ULL, 0x4ed8aa4ae3418acbULL,
+ 0x5b9cca4f7763e373ULL, 0x682e6ff3d6b2b8a3ULL, 0x748f82ee5defb2fcULL,
+ 0x78a5636f43172f60ULL, 0x84c87814a1f0ab72ULL, 0x8cc702081a6439ecULL,
+ 0x90befffa23631e28ULL, 0xa4506cebde82bde9ULL, 0xbef9a3f7b2c67915ULL,
+ 0xc67178f2e372532bULL, 0xca273eceea26619cULL, 0xd186b8c721c0c207ULL,
+ 0xeada7dd6cde0eb1eULL, 0xf57d4f7fee6ed178ULL, 0x06f067aa72176fbaULL,
+ 0x0a637dc5a2c898a6ULL, 0x113f9804bef90daeULL, 0x1b710b35131c471bULL,
+ 0x28db77f523047d84ULL, 0x32caab7b40c72493ULL, 0x3c9ebe0a15c9bebcULL,
+ 0x431d67c49c100d4cULL, 0x4cc5d4becb3e42b6ULL, 0x597f299cfc657e2aULL,
+ 0x5fcb6fab3ad6faecULL, 0x6c44198c4a475817ULL,
};
-#define GET_FX_64WORD(n, b, i) \
- { \
- (n) = ((uint64_t)(b)[(i)] << 56) | ((uint64_t)(b)[(i) + 1] << 48) | \
- ((uint64_t)(b)[(i) + 2] << 40) | ((uint64_t)(b)[(i) + 3] << 32) | \
- ((uint64_t)(b)[(i) + 4] << 24) | ((uint64_t)(b)[(i) + 5] << 16) | \
- ((uint64_t)(b)[(i) + 6] << 8) | ((uint64_t)(b)[(i) + 7]); \
- }
-#define PUT_UINT64(n, b, i) \
- { \
- (b)[(i)] = (uint8_t)((n) >> 56); \
- (b)[(i) + 1] = (uint8_t)((n) >> 48); \
- (b)[(i) + 2] = (uint8_t)((n) >> 40); \
- (b)[(i) + 3] = (uint8_t)((n) >> 32); \
- (b)[(i) + 4] = (uint8_t)((n) >> 24); \
- (b)[(i) + 5] = (uint8_t)((n) >> 16); \
- (b)[(i) + 6] = (uint8_t)((n) >> 8); \
- (b)[(i) + 7] = (uint8_t)((n)); \
- }
-static void sha384_process(CRYPT_sha384_context* ctx, const uint8_t data[128]) {
+void sha384_process(CRYPT_sha384_context* ctx, const uint8_t data[128]) {
uint64_t temp1, temp2;
uint64_t A, B, C, D, E, F, G, H;
uint64_t W[80];
@@ -523,14 +338,14 @@ static void sha384_process(CRYPT_sha384_context* ctx, const uint8_t data[128]) {
temp[6] = SHA384_R(i * 8 + 6);
temp[7] = SHA384_R(i * 8 + 7);
}
- SHA384_P(A, B, C, D, E, F, G, H, temp[0], FX_ato64i(constants[i * 8]));
- SHA384_P(H, A, B, C, D, E, F, G, temp[1], FX_ato64i(constants[i * 8 + 1]));
- SHA384_P(G, H, A, B, C, D, E, F, temp[2], FX_ato64i(constants[i * 8 + 2]));
- SHA384_P(F, G, H, A, B, C, D, E, temp[3], FX_ato64i(constants[i * 8 + 3]));
- SHA384_P(E, F, G, H, A, B, C, D, temp[4], FX_ato64i(constants[i * 8 + 4]));
- SHA384_P(D, E, F, G, H, A, B, C, temp[5], FX_ato64i(constants[i * 8 + 5]));
- SHA384_P(C, D, E, F, G, H, A, B, temp[6], FX_ato64i(constants[i * 8 + 6]));
- SHA384_P(B, C, D, E, F, G, H, A, temp[7], FX_ato64i(constants[i * 8 + 7]));
+ SHA384_P(A, B, C, D, E, F, G, H, temp[0], constants[i * 8]);
+ SHA384_P(H, A, B, C, D, E, F, G, temp[1], constants[i * 8 + 1]);
+ SHA384_P(G, H, A, B, C, D, E, F, temp[2], constants[i * 8 + 2]);
+ SHA384_P(F, G, H, A, B, C, D, E, temp[3], constants[i * 8 + 3]);
+ SHA384_P(E, F, G, H, A, B, C, D, temp[4], constants[i * 8 + 4]);
+ SHA384_P(D, E, F, G, H, A, B, C, temp[5], constants[i * 8 + 5]);
+ SHA384_P(C, D, E, F, G, H, A, B, temp[6], constants[i * 8 + 6]);
+ SHA384_P(B, C, D, E, F, G, H, A, temp[7], constants[i * 8 + 7]);
}
ctx->state[0] += A;
ctx->state[1] += B;
@@ -542,21 +357,187 @@ static void sha384_process(CRYPT_sha384_context* ctx, const uint8_t data[128]) {
ctx->state[7] += H;
}
-void CRYPT_SHA384Update(CRYPT_sha384_context* ctx,
+} // namespace
+
+void CRYPT_SHA1Start(CRYPT_sha1_context* s) {
+ SHA_Core_Init(s->h);
+ s->blkused = 0;
+ s->lenhi = s->lenlo = 0;
+}
+
+void CRYPT_SHA1Update(CRYPT_sha1_context* s,
+ const uint8_t* data,
+ uint32_t size) {
+ unsigned char* q = (unsigned char*)data;
+ unsigned int wordblock[16];
+ int len = size;
+ unsigned int lenw = len;
+ int i;
+ s->lenlo += lenw;
+ s->lenhi += (s->lenlo < lenw);
+ if (s->blkused && s->blkused + len < 64) {
+ memcpy(s->block + s->blkused, q, len);
+ s->blkused += len;
+ } else {
+ while (s->blkused + len >= 64) {
+ memcpy(s->block + s->blkused, q, 64 - s->blkused);
+ q += 64 - s->blkused;
+ len -= 64 - s->blkused;
+ for (i = 0; i < 16; i++) {
+ wordblock[i] = (((unsigned int)s->block[i * 4 + 0]) << 24) |
+ (((unsigned int)s->block[i * 4 + 1]) << 16) |
+ (((unsigned int)s->block[i * 4 + 2]) << 8) |
+ (((unsigned int)s->block[i * 4 + 3]) << 0);
+ }
+ SHATransform(s->h, wordblock);
+ s->blkused = 0;
+ }
+ memcpy(s->block, q, len);
+ s->blkused = len;
+ }
+}
+
+void CRYPT_SHA1Finish(CRYPT_sha1_context* s, uint8_t digest[20]) {
+ int i;
+ int pad;
+ unsigned char c[64];
+ unsigned int lenhi, lenlo;
+ if (s->blkused >= 56) {
+ pad = 56 + 64 - s->blkused;
+ } else {
+ pad = 56 - s->blkused;
+ }
+ lenhi = (s->lenhi << 3) | (s->lenlo >> (32 - 3));
+ lenlo = (s->lenlo << 3);
+ memset(c, 0, pad);
+ c[0] = 0x80;
+ CRYPT_SHA1Update(s, c, pad);
+ c[0] = (lenhi >> 24) & 0xFF;
+ c[1] = (lenhi >> 16) & 0xFF;
+ c[2] = (lenhi >> 8) & 0xFF;
+ c[3] = (lenhi >> 0) & 0xFF;
+ c[4] = (lenlo >> 24) & 0xFF;
+ c[5] = (lenlo >> 16) & 0xFF;
+ c[6] = (lenlo >> 8) & 0xFF;
+ c[7] = (lenlo >> 0) & 0xFF;
+ CRYPT_SHA1Update(s, c, 8);
+ for (i = 0; i < 5; i++) {
+ digest[i * 4] = (s->h[i] >> 24) & 0xFF;
+ digest[i * 4 + 1] = (s->h[i] >> 16) & 0xFF;
+ digest[i * 4 + 2] = (s->h[i] >> 8) & 0xFF;
+ digest[i * 4 + 3] = (s->h[i]) & 0xFF;
+ }
+}
+void CRYPT_SHA1Generate(const uint8_t* data,
+ uint32_t size,
+ uint8_t digest[20]) {
+ CRYPT_sha1_context s;
+ CRYPT_SHA1Start(&s);
+ CRYPT_SHA1Update(&s, data, size);
+ CRYPT_SHA1Finish(&s, digest);
+}
+void CRYPT_SHA256Start(CRYPT_sha256_context* ctx) {
+ ctx->total[0] = 0;
+ ctx->total[1] = 0;
+ ctx->state[0] = 0x6A09E667;
+ ctx->state[1] = 0xBB67AE85;
+ ctx->state[2] = 0x3C6EF372;
+ ctx->state[3] = 0xA54FF53A;
+ ctx->state[4] = 0x510E527F;
+ ctx->state[5] = 0x9B05688C;
+ ctx->state[6] = 0x1F83D9AB;
+ ctx->state[7] = 0x5BE0CD19;
+}
+
+void CRYPT_SHA256Update(CRYPT_sha256_context* ctx,
const uint8_t* input,
uint32_t length) {
- uint32_t left, fill;
- if (!length) {
+ if (!length)
return;
- }
- left = (uint32_t)ctx->total[0] & 0x7F;
- fill = 128 - left;
+
+ uint32_t left = ctx->total[0] & 0x3F;
+ uint32_t fill = 64 - left;
ctx->total[0] += length;
- if (ctx->total[0] < length) {
+ ctx->total[0] &= 0xFFFFFFFF;
+ if (ctx->total[0] < length)
ctx->total[1]++;
+
+ if (left && length >= fill) {
+ memcpy(ctx->buffer + left, input, fill);
+ sha256_process(ctx, ctx->buffer);
+ length -= fill;
+ input += fill;
+ left = 0;
}
+ while (length >= 64) {
+ sha256_process(ctx, input);
+ length -= 64;
+ input += 64;
+ }
+ if (length)
+ memcpy(ctx->buffer + left, input, length);
+}
+
+void CRYPT_SHA256Finish(CRYPT_sha256_context* ctx, uint8_t digest[32]) {
+ uint32_t last, padn;
+ uint32_t high, low;
+ uint8_t msglen[8];
+ high = (ctx->total[0] >> 29) | (ctx->total[1] << 3);
+ low = (ctx->total[0] << 3);
+ PUT_UINT32(high, msglen, 0);
+ PUT_UINT32(low, msglen, 4);
+ last = ctx->total[0] & 0x3F;
+ padn = (last < 56) ? (56 - last) : (120 - last);
+ CRYPT_SHA256Update(ctx, sha256_padding, padn);
+ CRYPT_SHA256Update(ctx, msglen, 8);
+ PUT_UINT32(ctx->state[0], digest, 0);
+ PUT_UINT32(ctx->state[1], digest, 4);
+ PUT_UINT32(ctx->state[2], digest, 8);
+ PUT_UINT32(ctx->state[3], digest, 12);
+ PUT_UINT32(ctx->state[4], digest, 16);
+ PUT_UINT32(ctx->state[5], digest, 20);
+ PUT_UINT32(ctx->state[6], digest, 24);
+ PUT_UINT32(ctx->state[7], digest, 28);
+}
+
+void CRYPT_SHA256Generate(const uint8_t* data,
+ uint32_t size,
+ uint8_t digest[32]) {
+ CRYPT_sha256_context ctx;
+ CRYPT_SHA256Start(&ctx);
+ CRYPT_SHA256Update(&ctx, data, size);
+ CRYPT_SHA256Finish(&ctx, digest);
+}
+
+void CRYPT_SHA384Start(CRYPT_sha384_context* ctx) {
+ if (!ctx)
+ return;
+
+ memset(ctx, 0, sizeof(CRYPT_sha384_context));
+ ctx->state[0] = 0xcbbb9d5dc1059ed8ULL;
+ ctx->state[1] = 0x629a292a367cd507ULL;
+ ctx->state[2] = 0x9159015a3070dd17ULL;
+ ctx->state[3] = 0x152fecd8f70e5939ULL;
+ ctx->state[4] = 0x67332667ffc00b31ULL;
+ ctx->state[5] = 0x8eb44a8768581511ULL;
+ ctx->state[6] = 0xdb0c2e0d64f98fa7ULL;
+ ctx->state[7] = 0x47b5481dbefa4fa4ULL;
+}
+
+void CRYPT_SHA384Update(CRYPT_sha384_context* ctx,
+ const uint8_t* input,
+ uint32_t length) {
+ if (!length)
+ return;
+
+ uint32_t left = static_cast<uint32_t>(ctx->total[0]) & 0x7F;
+ uint32_t fill = 128 - left;
+ ctx->total[0] += length;
+ if (ctx->total[0] < length)
+ ctx->total[1]++;
+
if (left && length >= fill) {
- FXSYS_memcpy((void*)(ctx->buffer + left), (void*)input, fill);
+ memcpy(ctx->buffer + left, input, fill);
sha384_process(ctx, ctx->buffer);
length -= fill;
input += fill;
@@ -567,15 +548,14 @@ void CRYPT_SHA384Update(CRYPT_sha384_context* ctx,
length -= 128;
input += 128;
}
- if (length) {
- FXSYS_memcpy((void*)(ctx->buffer + left), (void*)input, length);
- }
+ if (length)
+ memcpy(ctx->buffer + left, input, length);
}
void CRYPT_SHA384Finish(CRYPT_sha384_context* ctx, uint8_t digest[48]) {
uint32_t last, padn;
uint8_t msglen[16];
- FXSYS_memset(msglen, 0, 16);
+ memset(msglen, 0, 16);
uint64_t high, low;
high = (ctx->total[0] >> 29) | (ctx->total[1] << 3);
low = (ctx->total[0] << 3);
@@ -603,19 +583,19 @@ void CRYPT_SHA384Generate(const uint8_t* data,
}
void CRYPT_SHA512Start(void* context) {
- if (!context) {
+ if (!context)
return;
- }
+
CRYPT_sha384_context* ctx = (CRYPT_sha384_context*)context;
- FXSYS_memset(ctx, 0, sizeof(CRYPT_sha384_context));
- ctx->state[0] = FX_ato64i("6a09e667f3bcc908");
- ctx->state[1] = FX_ato64i("bb67ae8584caa73b");
- ctx->state[2] = FX_ato64i("3c6ef372fe94f82b");
- ctx->state[3] = FX_ato64i("a54ff53a5f1d36f1");
- ctx->state[4] = FX_ato64i("510e527fade682d1");
- ctx->state[5] = FX_ato64i("9b05688c2b3e6c1f");
- ctx->state[6] = FX_ato64i("1f83d9abfb41bd6b");
- ctx->state[7] = FX_ato64i("5be0cd19137e2179");
+ memset(ctx, 0, sizeof(CRYPT_sha384_context));
+ ctx->state[0] = 0x6a09e667f3bcc908ULL;
+ ctx->state[1] = 0xbb67ae8584caa73bULL;
+ ctx->state[2] = 0x3c6ef372fe94f82bULL;
+ ctx->state[3] = 0xa54ff53a5f1d36f1ULL;
+ ctx->state[4] = 0x510e527fade682d1ULL;
+ ctx->state[5] = 0x9b05688c2b3e6c1fULL;
+ ctx->state[6] = 0x1f83d9abfb41bd6bULL;
+ ctx->state[7] = 0x5be0cd19137e2179ULL;
}
void CRYPT_SHA512Update(void* context, const uint8_t* data, uint32_t size) {
@@ -627,7 +607,7 @@ void CRYPT_SHA512Finish(void* context, uint8_t digest[64]) {
CRYPT_sha384_context* ctx = (CRYPT_sha384_context*)context;
uint32_t last, padn;
uint8_t msglen[16];
- FXSYS_memset(msglen, 0, 16);
+ memset(msglen, 0, 16);
uint64_t high, low;
high = (ctx->total[0] >> 29) | (ctx->total[1] << 3);
low = (ctx->total[0] << 3);
@@ -655,7 +635,3 @@ void CRYPT_SHA512Generate(const uint8_t* data,
CRYPT_SHA512Update(&context, data, size);
CRYPT_SHA512Finish(&context, digest);
}
-
-#ifdef __cplusplus
-};
-#endif
diff --git a/chromium/third_party/pdfium/core/fdrm/crypto/fx_crypt_unittest.cpp b/chromium/third_party/pdfium/core/fdrm/crypto/fx_crypt_unittest.cpp
index 4e3da6e1863..bea9378b8c3 100644
--- a/chromium/third_party/pdfium/core/fdrm/crypto/fx_crypt_unittest.cpp
+++ b/chromium/third_party/pdfium/core/fdrm/crypto/fx_crypt_unittest.cpp
@@ -227,3 +227,20 @@ TEST(FXCRYPT, Sha256TestB2) {
for (size_t i = 0; i < 32; ++i)
EXPECT_EQ(expected[i], actual[i]) << " at byte " << i;
}
+
+TEST(FXCRYPT, Sha512Test) {
+ const char* const input =
+ "This is a simple test. To see whether it is getting correct value.";
+ const uint8_t expected[64] = {
+ 0x86, 0xB5, 0x05, 0x63, 0xA2, 0x6F, 0xD6, 0xFA, 0xEB, 0x9B, 0xC3,
+ 0xBB, 0x9E, 0xB7, 0x03, 0x82, 0xB6, 0x50, 0x55, 0x6B, 0x90, 0x69,
+ 0xD0, 0xA7, 0x53, 0x0A, 0x34, 0xDD, 0xEA, 0x11, 0xCC, 0x91, 0x5C,
+ 0xC7, 0x93, 0xCA, 0xAE, 0x30, 0xD1, 0x96, 0xBE, 0xD0, 0x35, 0x21,
+ 0x4A, 0xC6, 0x42, 0x56, 0x0C, 0xA3, 0x00, 0x69, 0x44, 0x77, 0xCC,
+ 0x3E, 0xD4, 0xD6, 0x10, 0x31, 0xC6, 0xC0, 0x58, 0xCF};
+ uint8_t actual[64];
+ CRYPT_SHA512Generate(reinterpret_cast<const uint8_t*>(input), strlen(input),
+ actual);
+ for (size_t i = 0; i < 64; ++i)
+ EXPECT_EQ(expected[i], actual[i]) << " at byte " << i;
+}
diff --git a/chromium/third_party/pdfium/core/fpdfapi/cmaps/fpdf_cmaps.cpp b/chromium/third_party/pdfium/core/fpdfapi/cmaps/fpdf_cmaps.cpp
index ca01d431f4d..cb2f09fb3cb 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/cmaps/fpdf_cmaps.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/cmaps/fpdf_cmaps.cpp
@@ -76,15 +76,15 @@ uint16_t FPDFAPI_CIDFromCharCode(const FXCMAP_CMap* pMap, uint32_t charcode) {
while (1) {
if (pMap->m_DWordMapType == FXCMAP_CMap::Range) {
uint16_t* found = static_cast<uint16_t*>(
- FXSYS_bsearch(&charcode, pMap->m_pDWordMap, pMap->m_DWordCount, 8,
- compareDWordRange));
+ bsearch(&charcode, pMap->m_pDWordMap, pMap->m_DWordCount, 8,
+ compareDWordRange));
if (found)
return found[3] + (uint16_t)charcode - found[1];
} else if (pMap->m_DWordMapType == FXCMAP_CMap::Single) {
uint16_t* found = static_cast<uint16_t*>(
- FXSYS_bsearch(&charcode, pMap->m_pDWordMap, pMap->m_DWordCount, 6,
- compareDWordSingle));
+ bsearch(&charcode, pMap->m_pDWordMap, pMap->m_DWordCount, 6,
+ compareDWordSingle));
if (found)
return found[2];
}
@@ -101,13 +101,13 @@ uint16_t FPDFAPI_CIDFromCharCode(const FXCMAP_CMap* pMap, uint32_t charcode) {
if (!pMap->m_pWordMap)
return 0;
if (pMap->m_WordMapType == FXCMAP_CMap::Single) {
- uint16_t* found = static_cast<uint16_t*>(FXSYS_bsearch(
- &code, pMap->m_pWordMap, pMap->m_WordCount, 4, compareWord));
+ uint16_t* found = static_cast<uint16_t*>(
+ bsearch(&code, pMap->m_pWordMap, pMap->m_WordCount, 4, compareWord));
if (found)
return found[1];
} else if (pMap->m_WordMapType == FXCMAP_CMap::Range) {
- uint16_t* found = static_cast<uint16_t*>(FXSYS_bsearch(
+ uint16_t* found = static_cast<uint16_t*>(bsearch(
&code, pMap->m_pWordMap, pMap->m_WordCount, 6, compareWordRange));
if (found)
return found[2] + code - found[0];
diff --git a/chromium/third_party/pdfium/core/fpdfapi/edit/cpdf_creator.h b/chromium/third_party/pdfium/core/fpdfapi/edit/cpdf_creator.h
index 0840e4b7a65..d3f18a82abd 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/edit/cpdf_creator.h
+++ b/chromium/third_party/pdfium/core/fpdfapi/edit/cpdf_creator.h
@@ -7,6 +7,7 @@
#ifndef CORE_FPDFAPI_EDIT_CPDF_CREATOR_H_
#define CORE_FPDFAPI_EDIT_CPDF_CREATOR_H_
+#include <map>
#include <memory>
#include <vector>
@@ -43,14 +44,12 @@ class CPDF_Creator {
friend class CPDF_XRefStream;
bool Create(uint32_t flags);
- void ResetStandardSecurity();
void Clear();
void InitOldObjNumOffsets();
void InitNewObjNumOffsets();
void InitID(bool bDefault = true);
- void AppendNewObjNum(uint32_t objbum);
int32_t AppendObjectNumberToXRef(uint32_t objnum);
int32_t WriteDoc_Stage1(IFX_Pause* pPause);
@@ -80,21 +79,19 @@ class CPDF_Creator {
bool m_bSecurityChanged;
CPDF_Dictionary* m_pEncryptDict;
uint32_t m_dwEncryptObjNum;
- bool m_bEncryptCloned;
- CPDF_CryptoHandler* m_pCryptoHandler;
- // Whether this owns the crypto handler |m_pCryptoHandler|.
- bool m_bLocalCryptoHandler;
+ CFX_RetainPtr<CPDF_CryptoHandler> m_pCryptoHandler;
CPDF_Object* m_pMetadata;
std::unique_ptr<CPDF_XRefStream> m_pXRefStream;
int32_t m_ObjectStreamSize;
uint32_t m_dwLastObjNum;
CFX_FileBufferArchive m_File;
FX_FILESIZE m_Offset;
+ FX_FILESIZE m_SavedOffset;
int32_t m_iStage;
uint32_t m_dwFlags;
- FX_POSITION m_Pos;
+ uint32_t m_CurObjNum;
FX_FILESIZE m_XrefStart;
- CFX_FileSizeListArray m_ObjectOffset;
+ std::map<uint32_t, FX_FILESIZE> m_ObjectOffsets;
std::vector<uint32_t> m_NewObjNumArray; // Sorted, ascending.
std::unique_ptr<CPDF_Array> m_pIDArray;
int32_t m_FileVersion;
diff --git a/chromium/third_party/pdfium/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp b/chromium/third_party/pdfium/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp
index 35595b3e1f6..e431b9bf574 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp
@@ -33,11 +33,11 @@ CFX_ByteTextBuf& operator<<(CFX_ByteTextBuf& ar, const CFX_Matrix& matrix) {
return ar;
}
-bool GetColor(const CPDF_Color* pColor, FX_FLOAT* rgb) {
+bool GetColor(const CPDF_Color* pColor, float* rgb) {
int intRGB[3];
if (!pColor ||
pColor->GetColorSpace() != CPDF_ColorSpace::GetStockCS(PDFCS_DEVICERGB) ||
- !pColor->GetRGB(intRGB[0], intRGB[1], intRGB[2])) {
+ !pColor->GetRGB(&intRGB[0], &intRGB[1], &intRGB[2])) {
return false;
}
rgb[0] = intRGB[0] / 255.0f;
@@ -114,7 +114,7 @@ void CPDF_PageContentGenerator::ProcessImage(CFX_ByteTextBuf* buf,
}
*buf << "q " << pImageObj->matrix() << " cm ";
- CPDF_Image* pImage = pImageObj->GetImage();
+ CFX_RetainPtr<CPDF_Image> pImage = pImageObj->GetImage();
if (pImage->IsInline())
return;
@@ -129,7 +129,7 @@ void CPDF_PageContentGenerator::ProcessImage(CFX_ByteTextBuf* buf,
uint32_t dwObjNum = pStream->GetObjNum();
CFX_ByteString name = RealizeResource(dwObjNum, "XObject");
if (bWasInline)
- pImageObj->SetUnownedImage(m_pDocument->GetPageData()->GetImage(dwObjNum));
+ pImageObj->SetImage(m_pDocument->GetPageData()->GetImage(dwObjNum));
*buf << "/" << PDF_NameEncode(name) << " Do Q\n";
}
@@ -201,17 +201,17 @@ void CPDF_PageContentGenerator::ProcessPath(CFX_ByteTextBuf* buf,
void CPDF_PageContentGenerator::ProcessGraphics(CFX_ByteTextBuf* buf,
CPDF_PageObject* pPageObj) {
*buf << "q ";
- FX_FLOAT fillColor[3];
+ float fillColor[3];
if (GetColor(pPageObj->m_ColorState.GetFillColor(), fillColor)) {
*buf << fillColor[0] << " " << fillColor[1] << " " << fillColor[2]
<< " rg ";
}
- FX_FLOAT strokeColor[3];
+ float strokeColor[3];
if (GetColor(pPageObj->m_ColorState.GetStrokeColor(), strokeColor)) {
*buf << strokeColor[0] << " " << strokeColor[1] << " " << strokeColor[2]
<< " RG ";
}
- FX_FLOAT lineWidth = pPageObj->m_GraphState.GetLineWidth();
+ float lineWidth = pPageObj->m_GraphState.GetLineWidth();
if (lineWidth != 1.0f)
*buf << lineWidth << " w ";
@@ -243,24 +243,35 @@ void CPDF_PageContentGenerator::ProcessGraphics(CFX_ByteTextBuf* buf,
// Tj sets the actual text, <####...> is used when specifying charcodes.
void CPDF_PageContentGenerator::ProcessText(CFX_ByteTextBuf* buf,
CPDF_TextObject* pTextObj) {
- // TODO(npm): Add support for something other than standard type1 fonts.
*buf << "BT " << pTextObj->GetTextMatrix() << " Tm ";
CPDF_Font* pFont = pTextObj->GetFont();
if (!pFont)
pFont = CPDF_Font::GetStockFont(m_pDocument, "Helvetica");
FontData fontD;
+ if (pFont->IsType1Font())
+ fontD.type = "Type1";
+ else if (pFont->IsTrueTypeFont())
+ fontD.type = "TrueType";
+ else if (pFont->IsCIDFont())
+ fontD.type = "Type0";
+ else
+ return;
fontD.baseFont = pFont->GetBaseFont();
auto it = m_pPage->m_FontsMap.find(fontD);
CFX_ByteString dictName;
if (it != m_pPage->m_FontsMap.end()) {
dictName = it->second;
} else {
- auto fontDict = pdfium::MakeUnique<CPDF_Dictionary>();
- fontDict->SetNewFor<CPDF_Name>("Type", "Font");
- fontDict->SetNewFor<CPDF_Name>("Subtype", "Type1");
- fontDict->SetNewFor<CPDF_Name>("BaseFont", fontD.baseFont);
- CPDF_Object* pDict = m_pDocument->AddIndirectObject(std::move(fontDict));
- uint32_t dwObjNum = pDict->GetObjNum();
+ uint32_t dwObjNum = pFont->GetFontDict()->GetObjNum();
+ if (!dwObjNum) {
+ // In this case we assume it must be a standard font
+ auto fontDict = pdfium::MakeUnique<CPDF_Dictionary>();
+ fontDict->SetNewFor<CPDF_Name>("Type", "Font");
+ fontDict->SetNewFor<CPDF_Name>("Subtype", fontD.type);
+ fontDict->SetNewFor<CPDF_Name>("BaseFont", fontD.baseFont);
+ CPDF_Object* pDict = m_pDocument->AddIndirectObject(std::move(fontDict));
+ dwObjNum = pDict->GetObjNum();
+ }
dictName = RealizeResource(dwObjNum, "Font");
m_pPage->m_FontsMap[fontD] = dictName;
}
@@ -268,9 +279,8 @@ void CPDF_PageContentGenerator::ProcessText(CFX_ByteTextBuf* buf,
<< " Tf ";
CFX_ByteString text;
for (uint32_t charcode : pTextObj->m_CharCodes) {
- if (charcode == CPDF_Font::kInvalidCharCode)
- continue;
- pFont->AppendChar(text, charcode);
+ if (charcode != CPDF_Font::kInvalidCharCode)
+ pFont->AppendChar(&text, charcode);
}
*buf << PDF_EncodeString(text, true) << " Tj ET\n";
}
diff --git a/chromium/third_party/pdfium/core/fpdfapi/edit/cpdf_pagecontentgenerator_unittest.cpp b/chromium/third_party/pdfium/core/fpdfapi/edit/cpdf_pagecontentgenerator_unittest.cpp
index d8813ba30fa..fdf31243b73 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/edit/cpdf_pagecontentgenerator_unittest.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/edit/cpdf_pagecontentgenerator_unittest.cpp
@@ -10,15 +10,24 @@
#include "core/fpdfapi/page/cpdf_pathobject.h"
#include "core/fpdfapi/page/cpdf_textobject.h"
#include "core/fpdfapi/parser/cpdf_document.h"
+#include "core/fpdfapi/parser/cpdf_name.h"
#include "core/fpdfapi/parser/cpdf_parser.h"
+#include "core/fpdfapi/parser/cpdf_reference.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "testing/test_support.h"
#include "third_party/base/ptr_util.h"
-class CPDF_PageContentGeneratorTest : public testing::Test {
+class CPDF_PageContentGeneratorTest : public pdfium::FPDF_Test {
protected:
- void SetUp() override { CPDF_ModuleMgr::Get()->InitPageModule(); }
+ void SetUp() override {
+ FPDF_Test::SetUp();
+ CPDF_ModuleMgr::Get()->InitPageModule();
+ }
- void TearDown() override { CPDF_ModuleMgr::Destroy(); }
+ void TearDown() override {
+ CPDF_ModuleMgr::Destroy();
+ FPDF_Test::TearDown();
+ }
void TestProcessPath(CPDF_PageContentGenerator* pGen,
CFX_ByteTextBuf* buf,
@@ -107,11 +116,11 @@ TEST_F(CPDF_PageContentGeneratorTest, ProcessGraphics) {
pPathObj->m_FillType = FXFILL_WINDING;
pPathObj->m_bStroke = true;
- FX_FLOAT rgb[3] = {0.5f, 0.7f, 0.35f};
+ float rgb[3] = {0.5f, 0.7f, 0.35f};
CPDF_ColorSpace* pCS = CPDF_ColorSpace::GetStockCS(PDFCS_DEVICERGB);
pPathObj->m_ColorState.SetFillColor(pCS, rgb, 3);
- FX_FLOAT rgb2[3] = {1, 0.9f, 0};
+ float rgb2[3] = {1, 0.9f, 0};
pPathObj->m_ColorState.SetStrokeColor(pCS, rgb2, 3);
pPathObj->m_GeneralState.SetFillAlpha(0.5f);
pPathObj->m_GeneralState.SetStrokeAlpha(0.8f);
@@ -151,7 +160,8 @@ TEST_F(CPDF_PageContentGeneratorTest, ProcessGraphics) {
pathString2.Mid(55, pathString2.GetLength() - 83));
}
-TEST_F(CPDF_PageContentGeneratorTest, ProcessText) {
+TEST_F(CPDF_PageContentGeneratorTest, ProcessStandardText) {
+ // Checking font whose font dictionary is not yet indirect object.
auto pDoc = pdfium::MakeUnique<CPDF_Document>(nullptr);
pDoc->CreateNewDoc();
CPDF_Dictionary* pPageDict = pDoc->CreateNewPage(0);
@@ -176,3 +186,54 @@ TEST_F(CPDF_PageContentGeneratorTest, ProcessText) {
EXPECT_EQ("Type1", fontDict->GetStringFor("Subtype"));
EXPECT_EQ("Times-Roman", fontDict->GetStringFor("BaseFont"));
}
+
+TEST_F(CPDF_PageContentGeneratorTest, ProcessText) {
+ // Checking font whose font dictionary is already an indirect object.
+ auto pDoc = pdfium::MakeUnique<CPDF_Document>(nullptr);
+ pDoc->CreateNewDoc();
+ CPDF_Dictionary* pPageDict = pDoc->CreateNewPage(0);
+ auto pTestPage = pdfium::MakeUnique<CPDF_Page>(pDoc.get(), pPageDict, false);
+ CPDF_PageContentGenerator generator(pTestPage.get());
+
+ CFX_ByteTextBuf buf;
+ {
+ // Set the text object font and text
+ auto pTextObj = pdfium::MakeUnique<CPDF_TextObject>();
+ CPDF_Dictionary* pDict = pDoc->NewIndirect<CPDF_Dictionary>();
+ pDict->SetNewFor<CPDF_Name>("Type", "Font");
+ pDict->SetNewFor<CPDF_Name>("Subtype", "TrueType");
+ CPDF_Font* pFont = CPDF_Font::GetStockFont(pDoc.get(), "Arial");
+ pDict->SetNewFor<CPDF_Name>("BaseFont", pFont->GetBaseFont());
+
+ CPDF_Dictionary* pDesc = pDoc->NewIndirect<CPDF_Dictionary>();
+ pDesc->SetNewFor<CPDF_Name>("Type", "FontDescriptor");
+ pDesc->SetNewFor<CPDF_Name>("FontName", pFont->GetBaseFont());
+ pDict->SetNewFor<CPDF_Reference>("FontDescriptor", pDoc.get(),
+ pDesc->GetObjNum());
+
+ CPDF_Font* loadedFont = pDoc->LoadFont(pDict);
+ pTextObj->m_TextState.SetFont(loadedFont);
+ pTextObj->m_TextState.SetFontSize(15.5f);
+ pTextObj->SetText("I am indirect");
+
+ TestProcessText(&generator, &buf, pTextObj.get());
+ }
+
+ CFX_ByteString textString = buf.MakeString();
+ EXPECT_LT(63, textString.GetLength());
+ EXPECT_EQ("BT 1 0 0 1 0 0 Tm /", textString.Left(19));
+ EXPECT_EQ(" 15.5 Tf <4920616D20696E646972656374> Tj ET\n",
+ textString.Right(44));
+ CPDF_Dictionary* fontDict = TestGetResource(
+ &generator, "Font", textString.Mid(19, textString.GetLength() - 63));
+ ASSERT_TRUE(fontDict);
+ EXPECT_TRUE(fontDict->GetObjNum());
+ EXPECT_EQ("Font", fontDict->GetStringFor("Type"));
+ EXPECT_EQ("TrueType", fontDict->GetStringFor("Subtype"));
+ EXPECT_EQ("Helvetica", fontDict->GetStringFor("BaseFont"));
+ CPDF_Dictionary* fontDesc = fontDict->GetDictFor("FontDescriptor");
+ ASSERT_TRUE(fontDesc);
+ EXPECT_TRUE(fontDesc->GetObjNum());
+ EXPECT_EQ("FontDescriptor", fontDesc->GetStringFor("Type"));
+ EXPECT_EQ("Helvetica", fontDesc->GetStringFor("FontName"));
+}
diff --git a/chromium/third_party/pdfium/core/fpdfapi/edit/fpdf_edit_create.cpp b/chromium/third_party/pdfium/core/fpdfapi/edit/fpdf_edit_create.cpp
index fec0de95123..4bdb63cb3cd 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/edit/fpdf_edit_create.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/edit/fpdf_edit_create.cpp
@@ -182,12 +182,15 @@ int32_t PDF_CreatorAppendObject(const CPDF_Object* pObj,
return -1;
}
offset += 8;
- CPDF_StreamAcc acc;
- acc.LoadAllData(p, true);
- if (pFile->AppendBlock(acc.GetData(), acc.GetSize()) < 0) {
- return -1;
+ if (p->GetRawSize() > 0) {
+ auto pAcc = pdfium::MakeRetain<CPDF_StreamAcc>(p);
+ pAcc->LoadAllData(true);
+
+ if (pFile->AppendBlock(pAcc->GetData(), pAcc->GetSize()) < 0) {
+ return -1;
+ }
+ offset += pAcc->GetSize();
}
- offset += acc.GetSize();
if ((len = pFile->AppendString("\r\nendstream")) < 0) {
return -1;
}
@@ -411,7 +414,7 @@ class CPDF_FlateEncoder {
uint32_t m_dwSize;
CFX_MaybeOwned<uint8_t, FxFreeDeleter> m_pData;
CFX_MaybeOwned<CPDF_Dictionary> m_pDict;
- CPDF_StreamAcc m_Acc;
+ CFX_RetainPtr<CPDF_StreamAcc> m_pAcc;
};
void CPDF_FlateEncoder::CloneDict() {
@@ -422,27 +425,27 @@ void CPDF_FlateEncoder::CloneDict() {
}
CPDF_FlateEncoder::CPDF_FlateEncoder(CPDF_Stream* pStream, bool bFlateEncode)
- : m_dwSize(0) {
- m_Acc.LoadAllData(pStream, true);
+ : m_dwSize(0), m_pAcc(pdfium::MakeRetain<CPDF_StreamAcc>(pStream)) {
+ m_pAcc->LoadAllData(true);
bool bHasFilter = pStream && pStream->HasFilter();
if (bHasFilter && !bFlateEncode) {
- CPDF_StreamAcc destAcc;
- destAcc.LoadAllData(pStream);
- m_dwSize = destAcc.GetSize();
- m_pData = destAcc.DetachData();
+ auto pDestAcc = pdfium::MakeRetain<CPDF_StreamAcc>(pStream);
+ pDestAcc->LoadAllData();
+ m_dwSize = pDestAcc->GetSize();
+ m_pData = pDestAcc->DetachData();
m_pDict = ToDictionary(pStream->GetDict()->Clone());
m_pDict->RemoveFor("Filter");
return;
}
if (bHasFilter || !bFlateEncode) {
- m_pData = const_cast<uint8_t*>(m_Acc.GetData());
- m_dwSize = m_Acc.GetSize();
+ m_pData = const_cast<uint8_t*>(m_pAcc->GetData());
+ m_dwSize = m_pAcc->GetSize();
m_pDict = pStream->GetDict();
return;
}
// TODO(thestig): Move to Init() and check return value.
uint8_t* buffer = nullptr;
- ::FlateEncode(m_Acc.GetData(), m_Acc.GetSize(), &buffer, &m_dwSize);
+ ::FlateEncode(m_pAcc->GetData(), m_pAcc->GetSize(), &buffer, &m_dwSize);
m_pData = std::unique_ptr<uint8_t, FxFreeDeleter>(buffer);
m_pDict = ToDictionary(pStream->GetDict()->Clone());
m_pDict->SetNewFor<CPDF_Number>("Length", static_cast<int>(m_dwSize));
@@ -577,7 +580,7 @@ FX_FILESIZE CPDF_ObjectStream::End(CPDF_Creator* pCreator) {
tempBuffer << m_Buffer;
CPDF_FlateEncoder encoder(tempBuffer.GetBuffer(), tempBuffer.GetLength(),
true, false);
- CPDF_Encryptor encryptor(pCreator->m_pCryptoHandler, m_dwObjNum,
+ CPDF_Encryptor encryptor(pCreator->m_pCryptoHandler.Get(), m_dwObjNum,
encoder.m_pData.Get(), encoder.m_dwSize);
if ((len = pFile->AppendDWord(encryptor.m_dwSize)) < 0) {
return -1;
@@ -664,11 +667,11 @@ int32_t CPDF_XRefStream::EndObjectStream(CPDF_Creator* pCreator, bool bEOF) {
uint32_t end_num = m_IndexArray.back().objnum + m_IndexArray.back().count;
int index = 0;
for (; m_dwTempObjNum < end_num; m_dwTempObjNum++) {
- FX_FILESIZE* offset = pCreator->m_ObjectOffset.GetPtrAt(m_dwTempObjNum);
- if (offset) {
+ auto it = pCreator->m_ObjectOffsets.find(m_dwTempObjNum);
+ if (it != pCreator->m_ObjectOffsets.end()) {
if (index >= iSize ||
m_dwTempObjNum != m_ObjStream.m_Items[index].objnum) {
- AppendIndex1(m_Buffer, *offset);
+ AppendIndex1(m_Buffer, it->second);
} else {
AppendIndex2(m_Buffer, dwObjStmNum, index++);
}
@@ -676,10 +679,9 @@ int32_t CPDF_XRefStream::EndObjectStream(CPDF_Creator* pCreator, bool bEOF) {
AppendIndex0(m_Buffer, false);
}
}
- if (iSize > 0 && bEOF) {
- pCreator->m_ObjectOffset.Add(dwObjStmNum, 1);
- pCreator->m_ObjectOffset[dwObjStmNum] = objOffset;
- }
+ if (iSize > 0 && bEOF)
+ pCreator->m_ObjectOffsets[dwObjStmNum] = objOffset;
+
m_iSeg = iSeg;
if (bEOF) {
m_ObjStream.Start();
@@ -691,7 +693,7 @@ int32_t CPDF_XRefStream::EndObjectStream(CPDF_Creator* pCreator, bool bEOF) {
for (uint32_t m = it->objnum; m < it->objnum + it->count; ++m) {
if (m_ObjStream.m_index >= iSize ||
m != m_ObjStream.m_Items[it - m_IndexArray.begin()].objnum) {
- AppendIndex1(m_Buffer, pCreator->m_ObjectOffset[m]);
+ AppendIndex1(m_Buffer, pCreator->m_ObjectOffsets[m]);
} else {
AppendIndex2(m_Buffer, dwObjStmNum, m_ObjStream.m_index++);
}
@@ -717,14 +719,14 @@ bool CPDF_XRefStream::GenerateXRefStream(CPDF_Creator* pCreator, bool bEOF) {
AddObjectNumberToIndexArray(objnum);
} else {
for (; m_dwTempObjNum < pCreator->m_dwLastObjNum; m_dwTempObjNum++) {
- FX_FILESIZE* offset = pCreator->m_ObjectOffset.GetPtrAt(m_dwTempObjNum);
- if (offset) {
- AppendIndex1(m_Buffer, *offset);
- } else {
+ auto it = pCreator->m_ObjectOffsets.find(m_dwTempObjNum);
+ if (it != pCreator->m_ObjectOffsets.end())
+ AppendIndex1(m_Buffer, it->second);
+ else
AppendIndex0(m_Buffer, false);
- }
}
}
+
AppendIndex1(m_Buffer, offset_tmp);
FX_FILESIZE& offset = pCreator->m_Offset;
int32_t len = pFile->AppendDWord(objnum);
@@ -778,8 +780,8 @@ bool CPDF_XRefStream::GenerateXRefStream(CPDF_Creator* pCreator, bool bEOF) {
if (pFile->AppendString("/Prev ") < 0) {
return false;
}
- FX_CHAR offset_buf[20];
- FXSYS_memset(offset_buf, 0, sizeof(offset_buf));
+ char offset_buf[20];
+ memset(offset_buf, 0, sizeof(offset_buf));
FXSYS_i64toa(m_PrevOffset, offset_buf, 10);
int32_t offset_len = (int32_t)FXSYS_strlen(offset_buf);
if (pFile->AppendBlock(offset_buf, offset_len) < 0) {
@@ -849,17 +851,16 @@ bool CPDF_XRefStream::EndXRefStream(CPDF_Creator* pCreator) {
if (!(pCreator->m_dwFlags & FPDFCREATE_INCREMENTAL)) {
AppendIndex0(m_Buffer, true);
for (uint32_t i = 1; i < pCreator->m_dwLastObjNum + 1; i++) {
- FX_FILESIZE* offset = pCreator->m_ObjectOffset.GetPtrAt(i);
- if (offset) {
- AppendIndex1(m_Buffer, *offset);
- } else {
+ auto it = pCreator->m_ObjectOffsets.find(i);
+ if (it != pCreator->m_ObjectOffsets.end())
+ AppendIndex1(m_Buffer, it->second);
+ else
AppendIndex0(m_Buffer, false);
- }
}
} else {
for (const auto& pair : m_IndexArray) {
for (uint32_t j = pair.objnum; j < pair.objnum + pair.count; ++j)
- AppendIndex1(m_Buffer, pCreator->m_ObjectOffset[j]);
+ AppendIndex1(m_Buffer, pCreator->m_ObjectOffsets[j]);
}
}
return GenerateXRefStream(pCreator, false);
@@ -882,26 +883,20 @@ CPDF_Creator::CPDF_Creator(CPDF_Document* pDoc)
m_bSecurityChanged(false),
m_pEncryptDict(m_pParser ? m_pParser->GetEncryptDict() : nullptr),
m_dwEncryptObjNum(0),
- m_bEncryptCloned(false),
m_pCryptoHandler(m_pParser ? m_pParser->GetCryptoHandler() : nullptr),
- m_bLocalCryptoHandler(false),
m_pMetadata(nullptr),
m_ObjectStreamSize(200),
m_dwLastObjNum(m_pDocument->GetLastObjNum()),
m_Offset(0),
+ m_SavedOffset(0),
m_iStage(-1),
m_dwFlags(0),
- m_Pos(nullptr),
+ m_CurObjNum(0),
m_XrefStart(0),
m_pIDArray(nullptr),
m_FileVersion(0) {}
CPDF_Creator::~CPDF_Creator() {
- ResetStandardSecurity();
- if (m_bEncryptCloned) {
- delete m_pEncryptDict;
- m_pEncryptDict = nullptr;
- }
Clear();
}
@@ -1026,7 +1021,7 @@ int32_t CPDF_Creator::WriteIndirectObj(uint32_t objnum,
m_Offset += len;
if (pObj->IsStream()) {
CPDF_CryptoHandler* pHandler =
- pObj != m_pMetadata ? m_pCryptoHandler : nullptr;
+ pObj != m_pMetadata ? m_pCryptoHandler.Get() : nullptr;
if (WriteStream(pObj, objnum, pHandler) < 0)
return -1;
} else {
@@ -1087,10 +1082,10 @@ int32_t CPDF_Creator::WriteDirectObj(uint32_t objnum,
m_Offset += len;
break;
}
- CPDF_Encryptor encryptor(m_pCryptoHandler, objnum, (uint8_t*)str.c_str(),
- str.GetLength());
+ CPDF_Encryptor encryptor(m_pCryptoHandler.Get(), objnum,
+ (uint8_t*)str.c_str(), str.GetLength());
CFX_ByteString content = PDF_EncodeString(
- CFX_ByteString((const FX_CHAR*)encryptor.m_pData, encryptor.m_dwSize),
+ CFX_ByteString((const char*)encryptor.m_pData, encryptor.m_dwSize),
bHex);
if ((len = m_File.AppendString(content.AsStringC())) < 0) {
return -1;
@@ -1101,8 +1096,8 @@ int32_t CPDF_Creator::WriteDirectObj(uint32_t objnum,
case CPDF_Object::STREAM: {
CPDF_FlateEncoder encoder(const_cast<CPDF_Stream*>(pObj->AsStream()),
true);
- CPDF_Encryptor encryptor(m_pCryptoHandler, objnum, encoder.m_pData.Get(),
- encoder.m_dwSize);
+ CPDF_Encryptor encryptor(m_pCryptoHandler.Get(), objnum,
+ encoder.m_pData.Get(), encoder.m_dwSize);
if (static_cast<uint32_t>(encoder.m_pDict->GetIntegerFor("Length")) !=
encryptor.m_dwSize) {
encoder.CloneDict();
@@ -1231,7 +1226,7 @@ int32_t CPDF_Creator::WriteOldIndirectObject(uint32_t objnum) {
if (m_pParser->IsObjectFreeOrNull(objnum))
return 0;
- m_ObjectOffset[objnum] = m_Offset;
+ m_ObjectOffsets[objnum] = m_Offset;
bool bExistInMap = !!m_pDocument->GetIndirectObject(objnum);
const uint8_t object_type = m_pParser->GetObjectType(objnum);
bool bObjStm = (object_type == 2) && m_pEncryptDict && !m_pXRefStream;
@@ -1239,7 +1234,7 @@ int32_t CPDF_Creator::WriteOldIndirectObject(uint32_t objnum) {
bObjStm) {
CPDF_Object* pObj = m_pDocument->GetOrParseIndirectObject(objnum);
if (!pObj) {
- m_ObjectOffset[objnum] = 0;
+ m_ObjectOffsets.erase(objnum);
return 0;
}
if (WriteIndirectObj(pObj)) {
@@ -1297,8 +1292,7 @@ int32_t CPDF_Creator::WriteOldObjs(IFX_Pause* pPause) {
if (!m_pParser->IsValidObjectNumber(nLastObjNum))
return 0;
- uint32_t objnum = (uint32_t)(uintptr_t)m_Pos;
- for (; objnum <= nLastObjNum; ++objnum) {
+ for (uint32_t objnum = m_CurObjNum; objnum <= nLastObjNum; ++objnum) {
int32_t iRet = WriteOldIndirectObject(objnum);
if (iRet < 0)
return iRet;
@@ -1307,7 +1301,7 @@ int32_t CPDF_Creator::WriteOldObjs(IFX_Pause* pPause) {
continue;
if (pPause && pPause->NeedToPauseNow()) {
- m_Pos = (void*)(uintptr_t)(objnum + 1);
+ m_CurObjNum = objnum + 1;
return 1;
}
}
@@ -1315,8 +1309,8 @@ int32_t CPDF_Creator::WriteOldObjs(IFX_Pause* pPause) {
}
int32_t CPDF_Creator::WriteNewObjs(bool bIncremental, IFX_Pause* pPause) {
- size_t iCount = m_NewObjNumArray.size();
- size_t index = (size_t)(uintptr_t)m_Pos;
+ uint32_t iCount = pdfium::CollectionSize<uint32_t>(m_NewObjNumArray);
+ uint32_t index = m_CurObjNum;
while (index < iCount) {
uint32_t objnum = m_NewObjNumArray[index];
CPDF_Object* pObj = m_pDocument->GetIndirectObject(objnum);
@@ -1324,13 +1318,13 @@ int32_t CPDF_Creator::WriteNewObjs(bool bIncremental, IFX_Pause* pPause) {
++index;
continue;
}
- m_ObjectOffset[objnum] = m_Offset;
+ m_ObjectOffsets[objnum] = m_Offset;
if (WriteIndirectObj(pObj))
return -1;
index++;
if (pPause && pPause->NeedToPauseNow()) {
- m_Pos = (FX_POSITION)(uintptr_t)index;
+ m_CurObjNum = index;
return 1;
}
}
@@ -1338,9 +1332,9 @@ int32_t CPDF_Creator::WriteNewObjs(bool bIncremental, IFX_Pause* pPause) {
}
void CPDF_Creator::InitOldObjNumOffsets() {
- if (!m_pParser) {
+ if (!m_pParser)
return;
- }
+
uint32_t j = 0;
uint32_t dwStart = 0;
uint32_t dwEnd = m_pParser->GetLastObjNum();
@@ -1355,14 +1349,12 @@ void CPDF_Creator::InitOldObjNumOffsets() {
while (j <= dwEnd && !m_pParser->IsObjectFreeOrNull(j))
j++;
- m_ObjectOffset.Add(dwStart, j - dwStart);
dwStart = j;
}
}
void CPDF_Creator::InitNewObjNumOffsets() {
bool bIncremental = (m_dwFlags & FPDFCREATE_INCREMENTAL) != 0;
- bool bNoOriginal = (m_dwFlags & FPDFCREATE_NO_ORIGINAL) != 0;
for (const auto& pair : *m_pDocument) {
const uint32_t objnum = pair.first;
const CPDF_Object* pObj = pair.second.get();
@@ -1372,52 +1364,10 @@ void CPDF_Creator::InitNewObjNumOffsets() {
m_pParser->GetObjectType(objnum)) {
continue;
}
- AppendNewObjNum(objnum);
- }
-
- size_t iCount = m_NewObjNumArray.size();
- if (iCount == 0)
- return;
-
- size_t i = 0;
- uint32_t dwStartObjNum = 0;
- bool bCrossRefValid = m_pParser && m_pParser->GetLastXRefOffset() > 0;
- while (i < iCount) {
- dwStartObjNum = m_NewObjNumArray[i];
- if ((bIncremental && (bNoOriginal || bCrossRefValid)) ||
- !m_ObjectOffset.GetPtrAt(dwStartObjNum)) {
- break;
- }
- i++;
+ m_NewObjNumArray.insert(std::lower_bound(m_NewObjNumArray.begin(),
+ m_NewObjNumArray.end(), objnum),
+ objnum);
}
- if (i >= iCount)
- return;
-
- uint32_t dwLastObjNum = dwStartObjNum;
- i++;
- bool bNewStart = false;
- for (; i < iCount; i++) {
- uint32_t dwCurObjNum = m_NewObjNumArray[i];
- bool bExist = m_pParser && m_pParser->IsValidObjectNumber(dwCurObjNum) &&
- m_ObjectOffset.GetPtrAt(dwCurObjNum);
- if (bExist || dwCurObjNum - dwLastObjNum > 1) {
- if (!bNewStart)
- m_ObjectOffset.Add(dwStartObjNum, dwLastObjNum - dwStartObjNum + 1);
- dwStartObjNum = dwCurObjNum;
- }
- if (bNewStart)
- dwStartObjNum = dwCurObjNum;
-
- bNewStart = bExist;
- dwLastObjNum = dwCurObjNum;
- }
- m_ObjectOffset.Add(dwStartObjNum, dwLastObjNum - dwStartObjNum + 1);
-}
-
-void CPDF_Creator::AppendNewObjNum(uint32_t objnum) {
- m_NewObjNumArray.insert(std::lower_bound(m_NewObjNumArray.begin(),
- m_NewObjNumArray.end(), objnum),
- objnum);
}
int32_t CPDF_Creator::WriteDoc_Stage1(IFX_Pause* pPause) {
@@ -1468,27 +1418,26 @@ int32_t CPDF_Creator::WriteDoc_Stage1(IFX_Pause* pPause) {
CFX_RetainPtr<IFX_SeekableReadStream> pSrcFile =
m_pParser->GetFileAccess();
m_Offset = pSrcFile->GetSize();
- m_Pos = (void*)(uintptr_t)m_Offset;
+ m_SavedOffset = m_Offset;
m_iStage = 15;
}
}
if (m_iStage == 15) {
- if ((m_dwFlags & FPDFCREATE_NO_ORIGINAL) == 0 && m_Pos) {
+ if ((m_dwFlags & FPDFCREATE_NO_ORIGINAL) == 0 && m_SavedOffset > 0) {
CFX_RetainPtr<IFX_SeekableReadStream> pSrcFile =
m_pParser->GetFileAccess();
uint8_t buffer[4096]; // TODO(tsepez): don't stack allocate.
- uint32_t src_size = (uint32_t)(uintptr_t)m_Pos;
+ FX_FILESIZE src_size = m_SavedOffset;
while (src_size) {
uint32_t block_size = src_size > 4096 ? 4096 : src_size;
- if (!pSrcFile->ReadBlock(buffer, m_Offset - src_size, block_size)) {
+ if (!pSrcFile->ReadBlock(buffer, m_Offset - src_size, block_size))
return -1;
- }
- if (m_File.AppendBlock(buffer, block_size) < 0) {
+ if (m_File.AppendBlock(buffer, block_size) < 0)
return -1;
- }
+
src_size -= block_size;
if (pPause && pPause->NeedToPauseNow()) {
- m_Pos = (void*)(uintptr_t)src_size;
+ m_SavedOffset = src_size;
return 1;
}
}
@@ -1502,7 +1451,7 @@ int32_t CPDF_Creator::WriteDoc_Stage1(IFX_Pause* pPause) {
if (m_pParser->IsObjectFreeOrNull(objnum))
continue;
- m_ObjectOffset[objnum] = m_pParser->GetObjectPositionOrZero(objnum);
+ m_ObjectOffsets[objnum] = m_pParser->GetObjectPositionOrZero(objnum);
if (bObjStm) {
m_pXRefStream->AddObjectNumberToIndexArray(objnum);
}
@@ -1521,7 +1470,7 @@ int32_t CPDF_Creator::WriteDoc_Stage2(IFX_Pause* pPause) {
ASSERT(m_iStage >= 20 || m_iStage < 30);
if (m_iStage == 20) {
if ((m_dwFlags & FPDFCREATE_INCREMENTAL) == 0 && m_pParser) {
- m_Pos = (void*)(uintptr_t)0;
+ m_CurObjNum = 0;
m_iStage = 21;
} else {
m_iStage = 25;
@@ -1535,7 +1484,7 @@ int32_t CPDF_Creator::WriteDoc_Stage2(IFX_Pause* pPause) {
m_iStage = 25;
}
if (m_iStage == 25) {
- m_Pos = (void*)(uintptr_t)0;
+ m_CurObjNum = 0;
m_iStage = 26;
}
if (m_iStage == 26) {
@@ -1553,8 +1502,7 @@ int32_t CPDF_Creator::WriteDoc_Stage2(IFX_Pause* pPause) {
if (WriteIndirectObj(m_dwLastObjNum, m_pEncryptDict) < 0)
return -1;
- m_ObjectOffset.Add(m_dwLastObjNum, 1);
- m_ObjectOffset[m_dwLastObjNum] = saveOffset;
+ m_ObjectOffsets[m_dwLastObjNum] = saveOffset;
m_dwEncryptObjNum = m_dwLastObjNum;
if (m_dwFlags & FPDFCREATE_INCREMENTAL)
m_NewObjNumArray.push_back(m_dwLastObjNum);
@@ -1577,19 +1525,19 @@ int32_t CPDF_Creator::WriteDoc_Stage3(IFX_Pause* pPause) {
if ((m_dwFlags & FPDFCREATE_INCREMENTAL) == 0 ||
m_pParser->GetLastXRefOffset() == 0) {
CFX_ByteString str;
- str = m_ObjectOffset.GetPtrAt(1)
+ str = pdfium::ContainsKey(m_ObjectOffsets, 1)
? "xref\r\n"
: "xref\r\n0 1\r\n0000000000 65535 f\r\n";
if (m_File.AppendString(str.AsStringC()) < 0) {
return -1;
}
- m_Pos = (void*)(uintptr_t)1;
+ m_CurObjNum = 1;
m_iStage = 81;
} else {
if (m_File.AppendString("xref\r\n") < 0) {
return -1;
}
- m_Pos = (void*)(uintptr_t)0;
+ m_CurObjNum = 0;
m_iStage = 82;
}
} else {
@@ -1598,28 +1546,29 @@ int32_t CPDF_Creator::WriteDoc_Stage3(IFX_Pause* pPause) {
}
if (m_iStage == 81) {
CFX_ByteString str;
- uint32_t i = (uint32_t)(uintptr_t)m_Pos, j;
+ uint32_t i = m_CurObjNum;
+ uint32_t j;
while (i <= dwLastObjNum) {
- while (i <= dwLastObjNum && !m_ObjectOffset.GetPtrAt(i)) {
+ while (i <= dwLastObjNum && !pdfium::ContainsKey(m_ObjectOffsets, i))
i++;
- }
- if (i > dwLastObjNum) {
+
+ if (i > dwLastObjNum)
break;
- }
+
j = i;
- while (j <= dwLastObjNum && m_ObjectOffset.GetPtrAt(j)) {
+ while (j <= dwLastObjNum && pdfium::ContainsKey(m_ObjectOffsets, j))
j++;
- }
- if (i == 1) {
+
+ if (i == 1)
str.Format("0 %d\r\n0000000000 65535 f\r\n", j);
- } else {
+ else
str.Format("%d %d\r\n", i, j - i);
- }
- if (m_File.AppendBlock(str.c_str(), str.GetLength()) < 0) {
+
+ if (m_File.AppendBlock(str.c_str(), str.GetLength()) < 0)
return -1;
- }
+
while (i < j) {
- str.Format("%010d 00000 n\r\n", m_ObjectOffset[i++]);
+ str.Format("%010d 00000 n\r\n", m_ObjectOffsets[i++]);
if (m_File.AppendBlock(str.c_str(), str.GetLength()) < 0) {
return -1;
}
@@ -1628,7 +1577,7 @@ int32_t CPDF_Creator::WriteDoc_Stage3(IFX_Pause* pPause) {
break;
}
if (pPause && pPause->NeedToPauseNow()) {
- m_Pos = (void*)(uintptr_t)i;
+ m_CurObjNum = i;
return 1;
}
}
@@ -1636,8 +1585,8 @@ int32_t CPDF_Creator::WriteDoc_Stage3(IFX_Pause* pPause) {
}
if (m_iStage == 82) {
CFX_ByteString str;
- size_t iCount = m_NewObjNumArray.size();
- size_t i = (size_t)(uintptr_t)m_Pos;
+ uint32_t iCount = pdfium::CollectionSize<uint32_t>(m_NewObjNumArray);
+ uint32_t i = m_CurObjNum;
while (i < iCount) {
size_t j = i;
uint32_t objnum = m_NewObjNumArray[i];
@@ -1660,12 +1609,12 @@ int32_t CPDF_Creator::WriteDoc_Stage3(IFX_Pause* pPause) {
}
while (i < j) {
objnum = m_NewObjNumArray[i++];
- str.Format("%010d 00000 n\r\n", m_ObjectOffset[objnum]);
+ str.Format("%010d 00000 n\r\n", m_ObjectOffsets[objnum]);
if (m_File.AppendBlock(str.c_str(), str.GetLength()) < 0)
return -1;
}
if (pPause && (i % 100) == 0 && pPause->NeedToPauseNow()) {
- m_Pos = (void*)(uintptr_t)i;
+ m_CurObjNum = i;
return 1;
}
}
@@ -1703,134 +1652,107 @@ int32_t CPDF_Creator::WriteDoc_Stage4(IFX_Pause* pPause) {
key == "XRefStm" || key == "ID") {
continue;
}
- if (m_File.AppendString(("/")) < 0) {
+ if (m_File.AppendString(("/")) < 0)
return -1;
- }
- if (m_File.AppendString(PDF_NameEncode(key).AsStringC()) < 0) {
+ if (m_File.AppendString(PDF_NameEncode(key).AsStringC()) < 0)
return -1;
- }
if (!pValue->IsInline()) {
- if (m_File.AppendString(" ") < 0) {
+ if (m_File.AppendString(" ") < 0)
return -1;
- }
- if (m_File.AppendDWord(pValue->GetObjNum()) < 0) {
+ if (m_File.AppendDWord(pValue->GetObjNum()) < 0)
return -1;
- }
- if (m_File.AppendString(" 0 R ") < 0) {
+ if (m_File.AppendString(" 0 R ") < 0)
return -1;
- }
} else {
FX_FILESIZE offset = 0;
- if (PDF_CreatorAppendObject(pValue, &m_File, offset) < 0) {
+ if (PDF_CreatorAppendObject(pValue, &m_File, offset) < 0)
return -1;
- }
}
}
} else {
- if (m_File.AppendString("\r\n/Root ") < 0) {
+ if (m_File.AppendString("\r\n/Root ") < 0)
return -1;
- }
- if (m_File.AppendDWord(m_pDocument->GetRoot()->GetObjNum()) < 0) {
+ if (m_File.AppendDWord(m_pDocument->GetRoot()->GetObjNum()) < 0)
return -1;
- }
- if (m_File.AppendString(" 0 R\r\n") < 0) {
+ if (m_File.AppendString(" 0 R\r\n") < 0)
return -1;
- }
if (m_pDocument->GetInfo()) {
- if (m_File.AppendString("/Info ") < 0) {
+ if (m_File.AppendString("/Info ") < 0)
return -1;
- }
- if (m_File.AppendDWord(m_pDocument->GetInfo()->GetObjNum()) < 0) {
+ if (m_File.AppendDWord(m_pDocument->GetInfo()->GetObjNum()) < 0)
return -1;
- }
- if (m_File.AppendString(" 0 R\r\n") < 0) {
+ if (m_File.AppendString(" 0 R\r\n") < 0)
return -1;
- }
}
}
if (m_pEncryptDict) {
- if (m_File.AppendString("/Encrypt") < 0) {
+ if (m_File.AppendString("/Encrypt") < 0)
return -1;
- }
+
uint32_t dwObjNum = m_pEncryptDict->GetObjNum();
- if (dwObjNum == 0) {
+ if (dwObjNum == 0)
dwObjNum = m_pDocument->GetLastObjNum() + 1;
- }
- if (m_File.AppendString(" ") < 0) {
+ if (m_File.AppendString(" ") < 0)
return -1;
- }
- if (m_File.AppendDWord(dwObjNum) < 0) {
+ if (m_File.AppendDWord(dwObjNum) < 0)
return -1;
- }
- if (m_File.AppendString(" 0 R ") < 0) {
+ if (m_File.AppendString(" 0 R ") < 0)
return -1;
- }
}
- if (m_File.AppendString("/Size ") < 0) {
+
+ if (m_File.AppendString("/Size ") < 0)
return -1;
- }
- if (m_File.AppendDWord(m_dwLastObjNum + (bXRefStream ? 2 : 1)) < 0) {
+ if (m_File.AppendDWord(m_dwLastObjNum + (bXRefStream ? 2 : 1)) < 0)
return -1;
- }
if ((m_dwFlags & FPDFCREATE_INCREMENTAL) != 0) {
FX_FILESIZE prev = m_pParser->GetLastXRefOffset();
if (prev) {
- if (m_File.AppendString("/Prev ") < 0) {
+ if (m_File.AppendString("/Prev ") < 0)
return -1;
- }
- FX_CHAR offset_buf[20];
- FXSYS_memset(offset_buf, 0, sizeof(offset_buf));
+
+ char offset_buf[20];
+ memset(offset_buf, 0, sizeof(offset_buf));
FXSYS_i64toa(prev, offset_buf, 10);
- if (m_File.AppendBlock(offset_buf, FXSYS_strlen(offset_buf)) < 0) {
+ if (m_File.AppendBlock(offset_buf, FXSYS_strlen(offset_buf)) < 0)
return -1;
- }
}
}
if (m_pIDArray) {
- if (m_File.AppendString(("/ID")) < 0) {
+ if (m_File.AppendString(("/ID")) < 0)
return -1;
- }
+
FX_FILESIZE offset = 0;
- if (PDF_CreatorAppendObject(m_pIDArray.get(), &m_File, offset) < 0) {
+ if (PDF_CreatorAppendObject(m_pIDArray.get(), &m_File, offset) < 0)
return -1;
- }
}
if (!bXRefStream) {
- if (m_File.AppendString(">>") < 0) {
+ if (m_File.AppendString(">>") < 0)
return -1;
- }
} else {
- if (m_File.AppendString("/W[0 4 1]/Index[") < 0) {
+ if (m_File.AppendString("/W[0 4 1]/Index[") < 0)
return -1;
- }
if ((m_dwFlags & FPDFCREATE_INCREMENTAL) != 0 && m_pParser &&
m_pParser->GetLastXRefOffset() == 0) {
uint32_t i = 0;
for (i = 0; i < m_dwLastObjNum; i++) {
- if (!m_ObjectOffset.GetPtrAt(i)) {
+ if (!pdfium::ContainsKey(m_ObjectOffsets, i))
continue;
- }
- if (m_File.AppendDWord(i) < 0) {
+ if (m_File.AppendDWord(i) < 0)
return -1;
- }
- if (m_File.AppendString(" 1 ") < 0) {
+ if (m_File.AppendString(" 1 ") < 0)
return -1;
- }
}
- if (m_File.AppendString("]/Length ") < 0) {
+ if (m_File.AppendString("]/Length ") < 0)
return -1;
- }
- if (m_File.AppendDWord(m_dwLastObjNum * 5) < 0) {
+ if (m_File.AppendDWord(m_dwLastObjNum * 5) < 0)
return -1;
- }
- if (m_File.AppendString(">>stream\r\n") < 0) {
+ if (m_File.AppendString(">>stream\r\n") < 0)
return -1;
- }
for (i = 0; i < m_dwLastObjNum; i++) {
- FX_FILESIZE* offset = m_ObjectOffset.GetPtrAt(i);
- if (!offset)
+ auto it = m_ObjectOffsets.find(i);
+ if (it == m_ObjectOffsets.end())
continue;
- OutputIndex(&m_File, *offset);
+ OutputIndex(&m_File, it->second);
}
} else {
size_t count = m_NewObjNumArray.size();
@@ -1847,28 +1769,25 @@ int32_t CPDF_Creator::WriteDoc_Stage4(IFX_Pause* pPause) {
return -1;
if (m_File.AppendString(">>stream\r\n") < 0)
return -1;
- for (i = 0; i < count; i++) {
- uint32_t objnum = m_NewObjNumArray[i];
- FX_FILESIZE offset = m_ObjectOffset[objnum];
- OutputIndex(&m_File, offset);
- }
+ for (i = 0; i < count; i++)
+ OutputIndex(&m_File, m_ObjectOffsets[m_NewObjNumArray[i]]);
}
if (m_File.AppendString("\r\nendstream") < 0)
return -1;
}
}
- if (m_File.AppendString("\r\nstartxref\r\n") < 0) {
+
+ if (m_File.AppendString("\r\nstartxref\r\n") < 0)
return -1;
- }
- FX_CHAR offset_buf[20];
- FXSYS_memset(offset_buf, 0, sizeof(offset_buf));
+
+ char offset_buf[20];
+ memset(offset_buf, 0, sizeof(offset_buf));
FXSYS_i64toa(m_XrefStart, offset_buf, 10);
- if (m_File.AppendBlock(offset_buf, FXSYS_strlen(offset_buf)) < 0) {
+ if (m_File.AppendBlock(offset_buf, FXSYS_strlen(offset_buf)) < 0)
return -1;
- }
- if (m_File.AppendString("\r\n%%EOF\r\n") < 0) {
+ if (m_File.AppendString("\r\n%%EOF\r\n") < 0)
return -1;
- }
+
m_File.Flush();
return m_iStage = 100;
}
@@ -1891,7 +1810,7 @@ bool CPDF_Creator::Create(uint32_t flags) {
m_iStage = 0;
m_Offset = 0;
m_dwLastObjNum = m_pDocument->GetLastObjNum();
- m_ObjectOffset.Clear();
+ m_ObjectOffsets.clear();
m_NewObjNumArray.clear();
InitID();
if (flags & FPDFCREATE_PROGRESSIVE)
@@ -1937,11 +1856,8 @@ void CPDF_Creator::InitID(bool bDefault) {
CPDF_SecurityHandler handler;
handler.OnCreate(m_pEncryptDict, m_pIDArray.get(), user_pass.raw_str(),
user_pass.GetLength(), flag);
- if (m_bLocalCryptoHandler)
- delete m_pCryptoHandler;
- m_pCryptoHandler = new CPDF_CryptoHandler;
+ m_pCryptoHandler = pdfium::MakeRetain<CPDF_CryptoHandler>();
m_pCryptoHandler->Init(m_pEncryptDict, &handler);
- m_bLocalCryptoHandler = true;
m_bSecurityChanged = true;
}
}
@@ -1979,17 +1895,9 @@ bool CPDF_Creator::SetFileVersion(int32_t fileVersion) {
m_FileVersion = fileVersion;
return true;
}
+
void CPDF_Creator::RemoveSecurity() {
- ResetStandardSecurity();
+ m_pCryptoHandler.Reset();
m_bSecurityChanged = true;
m_pEncryptDict = nullptr;
- m_pCryptoHandler = nullptr;
-}
-void CPDF_Creator::ResetStandardSecurity() {
- if (!m_bLocalCryptoHandler)
- return;
-
- delete m_pCryptoHandler;
- m_pCryptoHandler = nullptr;
- m_bLocalCryptoHandler = false;
}
diff --git a/chromium/third_party/pdfium/core/fpdfapi/font/cpdf_cidfont.cpp b/chromium/third_party/pdfium/core/fpdfapi/font/cpdf_cidfont.cpp
index 6d01538f544..c309ac1d26c 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/font/cpdf_cidfont.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/font/cpdf_cidfont.cpp
@@ -7,6 +7,7 @@
#include "core/fpdfapi/font/cpdf_cidfont.h"
#include <algorithm>
+#include <limits>
#include <vector>
#include "core/fpdfapi/cmaps/cmap_int.h"
@@ -20,6 +21,7 @@
#include "core/fpdfapi/parser/cpdf_stream_acc.h"
#include "third_party/base/numerics/safe_math.h"
#include "third_party/base/ptr_util.h"
+#include "third_party/base/stl_util.h"
namespace {
@@ -113,6 +115,10 @@ const struct CIDTransform {
{8818, 0, 129, 127, 0, 19, 114}, {8819, 0, 129, 127, 0, 218, 108},
};
+// Boundary values to avoid integer overflow when multiplied by 1000.
+const long kMinCBox = -2147483;
+const long kMaxCBox = 2147483;
+
CPDF_FontGlobals* GetFontGlobals() {
return CPDF_ModuleMgr::Get()->GetPageModule()->GetFontGlobals();
}
@@ -132,9 +138,9 @@ bool IsValidEmbeddedCharcodeFromUnicodeCharset(CIDSet charset) {
}
}
-FX_WCHAR EmbeddedUnicodeFromCharcode(const FXCMAP_CMap* pEmbedMap,
- CIDSet charset,
- uint32_t charcode) {
+wchar_t EmbeddedUnicodeFromCharcode(const FXCMAP_CMap* pEmbedMap,
+ CIDSet charset,
+ uint32_t charcode) {
if (!IsValidEmbeddedCharcodeFromUnicodeCharset(charset))
return 0;
@@ -147,7 +153,7 @@ FX_WCHAR EmbeddedUnicodeFromCharcode(const FXCMAP_CMap* pEmbedMap,
uint32_t EmbeddedCharcodeFromUnicode(const FXCMAP_CMap* pEmbedMap,
CIDSet charset,
- FX_WCHAR unicode) {
+ wchar_t unicode) {
if (!IsValidEmbeddedCharcodeFromUnicodeCharset(charset))
return 0;
@@ -235,15 +241,15 @@ CFX_WideString CPDF_CIDFont::UnicodeFromCharCode(uint32_t charcode) const {
CFX_WideString str = CPDF_Font::UnicodeFromCharCode(charcode);
if (!str.IsEmpty())
return str;
- FX_WCHAR ret = GetUnicodeFromCharCode(charcode);
+ wchar_t ret = GetUnicodeFromCharCode(charcode);
return ret ? ret : CFX_WideString();
}
-FX_WCHAR CPDF_CIDFont::GetUnicodeFromCharCode(uint32_t charcode) const {
+wchar_t CPDF_CIDFont::GetUnicodeFromCharCode(uint32_t charcode) const {
switch (m_pCMap->m_Coding) {
case CIDCODING_UCS2:
case CIDCODING_UTF16:
- return static_cast<FX_WCHAR>(charcode);
+ return static_cast<wchar_t>(charcode);
case CIDCODING_CID:
if (!m_pCID2UnicodeMap || !m_pCID2UnicodeMap->IsLoaded())
return 0;
@@ -253,15 +259,15 @@ FX_WCHAR CPDF_CIDFont::GetUnicodeFromCharCode(uint32_t charcode) const {
return m_pCID2UnicodeMap->UnicodeFromCID(CIDFromCharCode(charcode));
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
- FX_WCHAR unicode;
+ wchar_t unicode;
int charsize = 1;
if (charcode > 255) {
charcode = (charcode % 256) * 256 + (charcode / 256);
charsize = 2;
}
- int ret = FXSYS_MultiByteToWideChar(
- g_CharsetCPs[m_pCMap->m_Coding], 0,
- reinterpret_cast<const FX_CHAR*>(&charcode), charsize, &unicode, 1);
+ int ret = FXSYS_MultiByteToWideChar(g_CharsetCPs[m_pCMap->m_Coding], 0,
+ reinterpret_cast<const char*>(&charcode),
+ charsize, &unicode, 1);
return ret == 1 ? unicode : 0;
#else
if (!m_pCMap->m_pEmbedMap)
@@ -271,7 +277,7 @@ FX_WCHAR CPDF_CIDFont::GetUnicodeFromCharCode(uint32_t charcode) const {
#endif
}
-uint32_t CPDF_CIDFont::CharCodeFromUnicode(FX_WCHAR unicode) const {
+uint32_t CPDF_CIDFont::CharCodeFromUnicode(wchar_t unicode) const {
uint32_t charcode = CPDF_Font::CharCodeFromUnicode(unicode);
if (charcode)
return charcode;
@@ -286,7 +292,7 @@ uint32_t CPDF_CIDFont::CharCodeFromUnicode(FX_WCHAR unicode) const {
return 0;
uint32_t CID = 0;
while (CID < 65536) {
- FX_WCHAR this_unicode =
+ wchar_t this_unicode =
m_pCID2UnicodeMap->UnicodeFromCID(static_cast<uint16_t>(CID));
if (this_unicode == unicode)
return CID;
@@ -359,10 +365,10 @@ bool CPDF_CIDFont::Load() {
if (!m_pCMap)
return false;
} else if (CPDF_Stream* pStream = pEncoding->AsStream()) {
- m_pCMap = pdfium::MakeUnique<CPDF_CMap>();
- CPDF_StreamAcc acc;
- acc.LoadAllData(pStream, false);
- m_pCMap->LoadEmbedded(acc.GetData(), acc.GetSize());
+ auto pAcc = pdfium::MakeRetain<CPDF_StreamAcc>(pStream);
+ pAcc->LoadAllData(false);
+ m_pCMap = pdfium::MakeRetain<CPDF_CMap>();
+ m_pCMap->LoadEmbedded(pAcc->GetData(), pAcc->GetSize());
} else {
return false;
}
@@ -397,8 +403,8 @@ bool CPDF_CIDFont::Load() {
CPDF_Object* pmap = pCIDFontDict->GetDirectObjectFor("CIDToGIDMap");
if (pmap) {
if (CPDF_Stream* pStream = pmap->AsStream()) {
- m_pStreamAcc = pdfium::MakeUnique<CPDF_StreamAcc>();
- m_pStreamAcc->LoadAllData(pStream, false);
+ m_pStreamAcc = pdfium::MakeRetain<CPDF_StreamAcc>(pStream);
+ m_pStreamAcc->LoadAllData(false);
} else if (pmap->GetString() == "Identity") {
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
if (m_pFontFile)
@@ -440,11 +446,15 @@ FX_RECT CPDF_CIDFont::GetCharBBox(uint32_t charcode) {
int err = FXFT_Load_Glyph(face, glyph_index,
FXFT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH);
if (!err) {
- FXFT_BBox cbox;
FXFT_Glyph glyph;
err = FXFT_Get_Glyph(((FXFT_Face)face)->glyph, &glyph);
if (!err) {
+ FXFT_BBox cbox;
FXFT_Glyph_Get_CBox(glyph, FXFT_GLYPH_BBOX_PIXELS, &cbox);
+ cbox.xMin = pdfium::clamp(cbox.xMin, kMinCBox, kMaxCBox);
+ cbox.xMax = pdfium::clamp(cbox.xMax, kMinCBox, kMaxCBox);
+ cbox.yMin = pdfium::clamp(cbox.yMin, kMinCBox, kMaxCBox);
+ cbox.yMax = pdfium::clamp(cbox.yMax, kMinCBox, kMaxCBox);
int pixel_size_x = ((FXFT_Face)face)->size->metrics.x_ppem;
int pixel_size_y = ((FXFT_Face)face)->size->metrics.y_ppem;
if (pixel_size_x == 0 || pixel_size_y == 0) {
@@ -603,7 +613,7 @@ int CPDF_CIDFont::GlyphFromCharCode(uint32_t charcode, bool* pVertGlyph) {
if (!m_pFontFile && !m_pStreamAcc) {
uint16_t cid = CIDFromCharCode(charcode);
- FX_WCHAR unicode = 0;
+ wchar_t unicode = 0;
if (m_bCIDIsGID) {
#if _FXM_PLATFORM_ != _FXM_PLATFORM_APPLE_
return cid;
@@ -641,7 +651,7 @@ int CPDF_CIDFont::GlyphFromCharCode(uint32_t charcode, bool* pVertGlyph) {
iBaseEncoding = PDFFONT_ENCODING_WINANSI;
else if (bMacRoman)
iBaseEncoding = PDFFONT_ENCODING_MACROMAN;
- const FX_CHAR* name = GetAdobeCharName(
+ const char* name = GetAdobeCharName(
iBaseEncoding, std::vector<CFX_ByteString>(), charcode);
if (!name)
return charcode ? static_cast<int>(charcode) : -1;
@@ -685,16 +695,16 @@ int CPDF_CIDFont::GlyphFromCharCode(uint32_t charcode, bool* pVertGlyph) {
for (i = 0; i < FXFT_Get_Face_CharmapCount(face); i++) {
uint32_t ret = FT_CharCodeFromUnicode(
FXFT_Get_Charmap_Encoding(FXFT_Get_Face_Charmaps(face)[i]),
- static_cast<FX_WCHAR>(charcode));
+ static_cast<wchar_t>(charcode));
if (ret == 0)
continue;
FXFT_Set_Charmap(face, FXFT_Get_Face_Charmaps(face)[i]);
- unicode = static_cast<FX_WCHAR>(ret);
+ unicode = static_cast<wchar_t>(ret);
break;
}
if (i == FXFT_Get_Face_CharmapCount(face) && i) {
FXFT_Set_Charmap(face, FXFT_Get_Face_Charmaps(face)[0]);
- unicode = static_cast<FX_WCHAR>(charcode);
+ unicode = static_cast<wchar_t>(charcode);
}
}
if (FXFT_Get_Face_Charmap(face)) {
@@ -736,7 +746,7 @@ int CPDF_CIDFont::GlyphFromCharCode(uint32_t charcode, bool* pVertGlyph) {
return pdata[0] * 256 + pdata[1];
}
-uint32_t CPDF_CIDFont::GetNextChar(const FX_CHAR* pString,
+uint32_t CPDF_CIDFont::GetNextChar(const char* pString,
int nStrLen,
int& offset) const {
return m_pCMap->GetNextChar(pString, nStrLen, offset);
@@ -746,11 +756,11 @@ int CPDF_CIDFont::GetCharSize(uint32_t charcode) const {
return m_pCMap->GetCharSize(charcode);
}
-int CPDF_CIDFont::CountChar(const FX_CHAR* pString, int size) const {
+int CPDF_CIDFont::CountChar(const char* pString, int size) const {
return m_pCMap->CountChar(pString, size);
}
-int CPDF_CIDFont::AppendChar(FX_CHAR* str, uint32_t charcode) const {
+int CPDF_CIDFont::AppendChar(char* str, uint32_t charcode) const {
return m_pCMap->AppendChar(str, charcode);
}
@@ -773,8 +783,8 @@ void CPDF_CIDFont::LoadMetricsArray(CPDF_Array* pArray,
int nElements) {
int width_status = 0;
int iCurElement = 0;
- int first_code = 0;
- int last_code = 0;
+ uint32_t first_code = 0;
+ uint32_t last_code = 0;
for (size_t i = 0; i < pArray->GetCount(); i++) {
CPDF_Object* pObj = pArray->GetDirectObjectAt(i);
if (!pObj)
@@ -783,6 +793,11 @@ void CPDF_CIDFont::LoadMetricsArray(CPDF_Array* pArray,
if (CPDF_Array* pObjArray = pObj->AsArray()) {
if (width_status != 1)
return;
+ if (first_code >
+ std::numeric_limits<uint32_t>::max() - pObjArray->GetCount()) {
+ width_status = 0;
+ continue;
+ }
for (size_t j = 0; j < pObjArray->GetCount(); j += nElements) {
result->push_back(first_code);
@@ -815,7 +830,7 @@ void CPDF_CIDFont::LoadMetricsArray(CPDF_Array* pArray,
}
// static
-FX_FLOAT CPDF_CIDFont::CIDTransformToFloat(uint8_t ch) {
+float CPDF_CIDFont::CIDTransformToFloat(uint8_t ch) {
return (ch < 128 ? ch : ch - 255) * (1.0f / 127);
}
diff --git a/chromium/third_party/pdfium/core/fpdfapi/font/cpdf_cidfont.h b/chromium/third_party/pdfium/core/fpdfapi/font/cpdf_cidfont.h
index 79ec7cbb350..cc9bec16120 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/font/cpdf_cidfont.h
+++ b/chromium/third_party/pdfium/core/fpdfapi/font/cpdf_cidfont.h
@@ -11,7 +11,7 @@
#include <vector>
#include "core/fpdfapi/font/cpdf_font.h"
-#include "core/fxcrt/cfx_maybe_owned.h"
+#include "core/fxcrt/cfx_retain_ptr.h"
#include "core/fxcrt/fx_string.h"
#include "core/fxcrt/fx_system.h"
@@ -36,7 +36,7 @@ class CPDF_CIDFont : public CPDF_Font {
CPDF_CIDFont();
~CPDF_CIDFont() override;
- static FX_FLOAT CIDTransformToFloat(uint8_t ch);
+ static float CIDTransformToFloat(uint8_t ch);
// CPDF_Font:
bool IsCIDFont() const override;
@@ -45,16 +45,16 @@ class CPDF_CIDFont : public CPDF_Font {
int GlyphFromCharCode(uint32_t charcode, bool* pVertGlyph) override;
int GetCharWidthF(uint32_t charcode) override;
FX_RECT GetCharBBox(uint32_t charcode) override;
- uint32_t GetNextChar(const FX_CHAR* pString,
+ uint32_t GetNextChar(const char* pString,
int nStrLen,
int& offset) const override;
- int CountChar(const FX_CHAR* pString, int size) const override;
- int AppendChar(FX_CHAR* str, uint32_t charcode) const override;
+ int CountChar(const char* pString, int size) const override;
+ int AppendChar(char* str, uint32_t charcode) const override;
bool IsVertWriting() const override;
bool IsUnicodeCompatible() const override;
bool Load() override;
CFX_WideString UnicodeFromCharCode(uint32_t charcode) const override;
- uint32_t CharCodeFromUnicode(FX_WCHAR Unicode) const override;
+ uint32_t CharCodeFromUnicode(wchar_t Unicode) const override;
uint16_t CIDFromCharCode(uint32_t charcode) const;
const uint8_t* GetCIDTransform(uint16_t CID) const;
@@ -70,15 +70,15 @@ class CPDF_CIDFont : public CPDF_Font {
std::vector<uint32_t>* result,
int nElements);
void LoadSubstFont();
- FX_WCHAR GetUnicodeFromCharCode(uint32_t charcode) const;
+ wchar_t GetUnicodeFromCharCode(uint32_t charcode) const;
- CFX_MaybeOwned<CPDF_CMap> m_pCMap;
+ CFX_RetainPtr<CPDF_CMap> m_pCMap;
CPDF_CID2UnicodeMap* m_pCID2UnicodeMap;
CIDSet m_Charset;
bool m_bType1;
bool m_bCIDIsGID;
uint16_t m_DefaultWidth;
- std::unique_ptr<CPDF_StreamAcc> m_pStreamAcc;
+ CFX_RetainPtr<CPDF_StreamAcc> m_pStreamAcc;
bool m_bAnsiWidthsFixed;
FX_RECT m_CharBBox[256];
std::vector<uint32_t> m_WidthList;
diff --git a/chromium/third_party/pdfium/core/fpdfapi/font/cpdf_font.cpp b/chromium/third_party/pdfium/core/fpdfapi/font/cpdf_font.cpp
index 36d7d6aeeb4..b9be3aa8688 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/font/cpdf_font.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/font/cpdf_font.cpp
@@ -61,7 +61,7 @@ CPDF_Font::CPDF_Font()
CPDF_Font::~CPDF_Font() {
if (m_pFontFile) {
- m_pDocument->GetPageData()->ReleaseFontFileStreamAcc(
+ m_pDocument->GetPageData()->MaybePurgeFontFileStreamAcc(
m_pFontFile->GetStream()->AsStream());
}
}
@@ -118,7 +118,7 @@ bool CPDF_Font::IsUnicodeCompatible() const {
return false;
}
-int CPDF_Font::CountChar(const FX_CHAR* pString, int size) const {
+int CPDF_Font::CountChar(const char* pString, int size) const {
return size;
}
@@ -131,19 +131,15 @@ bool CPDF_Font::IsVertWriting() const {
return pCIDFont ? pCIDFont->IsVertWriting() : m_Font.IsVertical();
}
-int CPDF_Font::AppendChar(FX_CHAR* buf, uint32_t charcode) const {
- *buf = static_cast<FX_CHAR>(charcode);
+int CPDF_Font::AppendChar(char* buf, uint32_t charcode) const {
+ *buf = static_cast<char>(charcode);
return 1;
}
-void CPDF_Font::AppendChar(CFX_ByteString& str, uint32_t charcode) const {
+void CPDF_Font::AppendChar(CFX_ByteString* str, uint32_t charcode) const {
char buf[4];
int len = AppendChar(buf, charcode);
- if (len == 1) {
- str += buf[0];
- } else {
- str += CFX_ByteString(buf, len);
- }
+ *str += CFX_ByteStringC(buf, len);
}
CFX_WideString CPDF_Font::UnicodeFromCharCode(uint32_t charcode) const {
@@ -153,7 +149,7 @@ CFX_WideString CPDF_Font::UnicodeFromCharCode(uint32_t charcode) const {
return m_pToUnicodeMap ? m_pToUnicodeMap->Lookup(charcode) : CFX_WideString();
}
-uint32_t CPDF_Font::CharCodeFromUnicode(FX_WCHAR unicode) const {
+uint32_t CPDF_Font::CharCodeFromUnicode(wchar_t unicode) const {
if (!m_bToUnicodeLoaded)
LoadUnicodeMap();
@@ -219,7 +215,7 @@ void CPDF_Font::LoadFontDescriptor(CPDF_Dictionary* pFontDesc) {
const uint8_t* pFontData = m_pFontFile->GetData();
uint32_t dwFontSize = m_pFontFile->GetSize();
if (!m_Font.LoadEmbedded(pFontData, dwFontSize)) {
- m_pDocument->GetPageData()->ReleaseFontFileStreamAcc(
+ m_pDocument->GetPageData()->MaybePurgeFontFileStreamAcc(
m_pFontFile->GetStream()->AsStream());
m_pFontFile = nullptr;
}
@@ -281,7 +277,7 @@ void CPDF_Font::LoadUnicodeMap() const {
m_pToUnicodeMap->Load(pStream);
}
-int CPDF_Font::GetStringWidth(const FX_CHAR* pString, int size) {
+int CPDF_Font::GetStringWidth(const char* pString, int size) {
int offset = 0;
int width = 0;
while (offset < size) {
@@ -341,7 +337,7 @@ std::unique_ptr<CPDF_Font> CPDF_Font::Create(CPDF_Document* pDoc,
return pFont->Load() ? std::move(pFont) : nullptr;
}
-uint32_t CPDF_Font::GetNextChar(const FX_CHAR* pString,
+uint32_t CPDF_Font::GetNextChar(const char* pString,
int nStrLen,
int& offset) const {
if (offset < 0 || nStrLen < 1) {
@@ -429,7 +425,7 @@ bool CPDF_Font::IsStandardFont() const {
return true;
}
-const FX_CHAR* CPDF_Font::GetAdobeCharName(
+const char* CPDF_Font::GetAdobeCharName(
int iBaseEncoding,
const std::vector<CFX_ByteString>& charnames,
int charcode) {
@@ -441,7 +437,7 @@ const FX_CHAR* CPDF_Font::GetAdobeCharName(
if (!charnames.empty() && !charnames[charcode].IsEmpty())
return charnames[charcode].c_str();
- const FX_CHAR* name = nullptr;
+ const char* name = nullptr;
if (iBaseEncoding)
name = PDF_CharNameFromPredefinedCharSet(iBaseEncoding, charcode);
return name && name[0] ? name : nullptr;
@@ -458,13 +454,15 @@ uint32_t CPDF_Font::FallbackFontFromCharcode(uint32_t charcode) {
}
int CPDF_Font::FallbackGlyphFromCharcode(int fallbackFont, uint32_t charcode) {
- if (fallbackFont < 0 ||
- fallbackFont >= pdfium::CollectionSize<int>(m_FontFallbacks)) {
+ if (!pdfium::IndexInBounds(m_FontFallbacks, fallbackFont))
return -1;
- }
+
+ CFX_WideString str = UnicodeFromCharCode(charcode);
+ uint32_t unicode = !str.IsEmpty() ? str.GetAt(0) : charcode;
int glyph =
- FXFT_Get_Char_Index(m_FontFallbacks[fallbackFont]->GetFace(), charcode);
- if (glyph == 0 || glyph == 0xffff)
+ FXFT_Get_Char_Index(m_FontFallbacks[fallbackFont]->GetFace(), unicode);
+ if (glyph == 0)
return -1;
+
return glyph;
}
diff --git a/chromium/third_party/pdfium/core/fpdfapi/font/cpdf_font.h b/chromium/third_party/pdfium/core/fpdfapi/font/cpdf_font.h
index 6025a82d7a8..de29db6e13a 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/font/cpdf_font.h
+++ b/chromium/third_party/pdfium/core/fpdfapi/font/cpdf_font.h
@@ -10,6 +10,7 @@
#include <memory>
#include <vector>
+#include "core/fpdfapi/parser/cpdf_stream_acc.h"
#include "core/fxcrt/fx_string.h"
#include "core/fxcrt/fx_system.h"
#include "core/fxge/fx_font.h"
@@ -19,7 +20,6 @@ class CPDF_CIDFont;
class CPDF_Dictionary;
class CPDF_Document;
class CPDF_Object;
-class CPDF_StreamAcc;
class CPDF_TrueTypeFont;
class CPDF_Type1Font;
class CPDF_Type3Font;
@@ -50,15 +50,15 @@ class CPDF_Font {
virtual bool IsVertWriting() const;
virtual bool IsUnicodeCompatible() const;
- virtual uint32_t GetNextChar(const FX_CHAR* pString,
+ virtual uint32_t GetNextChar(const char* pString,
int nStrLen,
int& offset) const;
- virtual int CountChar(const FX_CHAR* pString, int size) const;
- virtual int AppendChar(FX_CHAR* buf, uint32_t charcode) const;
+ virtual int CountChar(const char* pString, int size) const;
+ virtual int AppendChar(char* buf, uint32_t charcode) const;
virtual int GlyphFromCharCode(uint32_t charcode, bool* pVertGlyph) = 0;
virtual int GlyphFromCharCodeExt(uint32_t charcode);
virtual CFX_WideString UnicodeFromCharCode(uint32_t charcode) const;
- virtual uint32_t CharCodeFromUnicode(FX_WCHAR Unicode) const;
+ virtual uint32_t CharCodeFromUnicode(wchar_t Unicode) const;
const CFX_ByteString& GetBaseFont() const { return m_BaseFont; }
CFX_SubstFont* GetSubstFont() const { return m_Font.GetSubstFont(); }
@@ -66,12 +66,12 @@ class CPDF_Font {
CPDF_Dictionary* GetFontDict() const { return m_pFontDict; }
bool IsStandardFont() const;
FXFT_Face GetFace() const { return m_Font.GetFace(); }
- void AppendChar(CFX_ByteString& str, uint32_t charcode) const;
+ void AppendChar(CFX_ByteString* str, uint32_t charcode) const;
void GetFontBBox(FX_RECT& rect) const { rect = m_FontBBox; }
int GetTypeAscent() const { return m_Ascent; }
int GetTypeDescent() const { return m_Descent; }
- int GetStringWidth(const FX_CHAR* pString, int size);
+ int GetStringWidth(const char* pString, int size);
uint32_t FallbackFontFromCharcode(uint32_t charcode);
int FallbackGlyphFromCharcode(int fallbackFont, uint32_t charcode);
@@ -96,12 +96,12 @@ class CPDF_Font {
void LoadFontDescriptor(CPDF_Dictionary* pDict);
void CheckFontMetrics();
- const FX_CHAR* GetAdobeCharName(int iBaseEncoding,
- const std::vector<CFX_ByteString>& charnames,
- int charcode);
+ const char* GetAdobeCharName(int iBaseEncoding,
+ const std::vector<CFX_ByteString>& charnames,
+ int charcode);
CFX_ByteString m_BaseFont;
- CPDF_StreamAcc* m_pFontFile;
+ CFX_RetainPtr<CPDF_StreamAcc> m_pFontFile;
CPDF_Dictionary* m_pFontDict;
mutable std::unique_ptr<CPDF_ToUnicodeMap> m_pToUnicodeMap;
mutable bool m_bToUnicodeLoaded;
diff --git a/chromium/third_party/pdfium/core/fpdfapi/font/cpdf_fontencoding.cpp b/chromium/third_party/pdfium/core/fpdfapi/font/cpdf_fontencoding.cpp
index 88b2c8d6a53..2cc6445ab27 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/font/cpdf_fontencoding.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/font/cpdf_fontencoding.cpp
@@ -236,7 +236,7 @@ const uint16_t ZapfEncoding[256] = {
0x27BC, 0x27BD, 0x27BE, 0x0000,
};
-const FX_CHAR* const StandardEncodingNames[224] = {
+const char* const StandardEncodingNames[224] = {
"space",
"exclam",
"quotedbl",
@@ -463,7 +463,7 @@ const FX_CHAR* const StandardEncodingNames[224] = {
nullptr,
};
-const FX_CHAR* const AdobeWinAnsiEncodingNames[224] = {
+const char* const AdobeWinAnsiEncodingNames[224] = {
"space",
"exclam",
"quotedbl",
@@ -690,7 +690,7 @@ const FX_CHAR* const AdobeWinAnsiEncodingNames[224] = {
"ydieresis",
};
-const FX_CHAR* const MacRomanEncodingNames[224] = {
+const char* const MacRomanEncodingNames[224] = {
"space",
"exclam",
"quotedbl",
@@ -917,7 +917,7 @@ const FX_CHAR* const MacRomanEncodingNames[224] = {
"caron",
};
-const FX_CHAR* const MacExpertEncodingNames[224] = {
+const char* const MacExpertEncodingNames[224] = {
"space",
"exclamsmall",
"Hungarumlautsmall",
@@ -1144,7 +1144,7 @@ const FX_CHAR* const MacExpertEncodingNames[224] = {
nullptr,
};
-const FX_CHAR* const PDFDocEncodingNames[232] = {
+const char* const PDFDocEncodingNames[232] = {
"breve",
"caron",
"circumflex",
@@ -1379,7 +1379,7 @@ const FX_CHAR* const PDFDocEncodingNames[232] = {
"ydieresis",
};
-const FX_CHAR* const AdobeSymbolEncodingNames[224] = {
+const char* const AdobeSymbolEncodingNames[224] = {
"space",
"exclam",
"universal",
@@ -1606,7 +1606,7 @@ const FX_CHAR* const AdobeSymbolEncodingNames[224] = {
nullptr,
};
-const FX_CHAR* const ZapfEncodingNames[224] = {
+const char* const ZapfEncodingNames[224] = {
"space", "a1", "a2", "a202", "a3", "a4", "a5", "a119",
"a118", "a117", "a11", "a12", "a13", "a14", "a15", "a16",
"a105", "a17", "a18", "a19", "a20", "a21", "a22", "a23",
@@ -1646,10 +1646,10 @@ uint32_t PDF_FindCode(const uint16_t* pCodes, uint16_t unicode) {
} // namespace
CPDF_FontEncoding::CPDF_FontEncoding() {
- FXSYS_memset(m_Unicodes, 0, sizeof(m_Unicodes));
+ memset(m_Unicodes, 0, sizeof(m_Unicodes));
}
-int CPDF_FontEncoding::CharCodeFromUnicode(FX_WCHAR unicode) const {
+int CPDF_FontEncoding::CharCodeFromUnicode(wchar_t unicode) const {
for (int i = 0; i < 256; i++)
if (m_Unicodes[i] == unicode) {
return i;
@@ -1660,7 +1660,7 @@ int CPDF_FontEncoding::CharCodeFromUnicode(FX_WCHAR unicode) const {
CPDF_FontEncoding::CPDF_FontEncoding(int PredefinedEncoding) {
const uint16_t* pSrc = PDF_UnicodesForPredefinedCharSet(PredefinedEncoding);
if (!pSrc) {
- FXSYS_memset(m_Unicodes, 0, sizeof(m_Unicodes));
+ memset(m_Unicodes, 0, sizeof(m_Unicodes));
} else {
for (int i = 0; i < 256; i++)
m_Unicodes[i] = pSrc[i];
@@ -1668,8 +1668,7 @@ CPDF_FontEncoding::CPDF_FontEncoding(int PredefinedEncoding) {
}
bool CPDF_FontEncoding::IsIdentical(CPDF_FontEncoding* pAnother) const {
- return FXSYS_memcmp(m_Unicodes, pAnother->m_Unicodes, sizeof(m_Unicodes)) ==
- 0;
+ return memcmp(m_Unicodes, pAnother->m_Unicodes, sizeof(m_Unicodes)) == 0;
}
std::unique_ptr<CPDF_Object> CPDF_FontEncoding::Realize(
@@ -1717,7 +1716,7 @@ std::unique_ptr<CPDF_Object> CPDF_FontEncoding::Realize(
return std::move(pDict);
}
-uint32_t FT_CharCodeFromUnicode(int encoding, FX_WCHAR unicode) {
+uint32_t FT_CharCodeFromUnicode(int encoding, wchar_t unicode) {
switch (encoding) {
case FXFT_ENCODING_UNICODE:
return unicode;
@@ -1758,18 +1757,17 @@ const uint16_t* PDF_UnicodesForPredefinedCharSet(int encoding) {
return nullptr;
}
-FX_WCHAR PDF_UnicodeFromAdobeName(const FX_CHAR* name) {
- return (FX_WCHAR)(FXFT_unicode_from_adobe_name(name) & 0x7FFFFFFF);
+wchar_t PDF_UnicodeFromAdobeName(const char* name) {
+ return (wchar_t)(FXFT_unicode_from_adobe_name(name) & 0x7FFFFFFF);
}
-CFX_ByteString PDF_AdobeNameFromUnicode(FX_WCHAR unicode) {
+CFX_ByteString PDF_AdobeNameFromUnicode(wchar_t unicode) {
char glyph_name[64];
FXFT_adobe_name_from_unicode(glyph_name, unicode);
return CFX_ByteString(glyph_name);
}
-const FX_CHAR* PDF_CharNameFromPredefinedCharSet(int encoding,
- uint8_t charcode) {
+const char* PDF_CharNameFromPredefinedCharSet(int encoding, uint8_t charcode) {
if (encoding == PDFFONT_ENCODING_PDFDOC) {
if (charcode < 24)
return nullptr;
@@ -1800,7 +1798,7 @@ const FX_CHAR* PDF_CharNameFromPredefinedCharSet(int encoding,
return nullptr;
}
-FX_WCHAR FT_UnicodeFromCharCode(int encoding, uint32_t charcode) {
+wchar_t FT_UnicodeFromCharCode(int encoding, uint32_t charcode) {
switch (encoding) {
case FXFT_ENCODING_UNICODE:
return (uint16_t)charcode;
diff --git a/chromium/third_party/pdfium/core/fpdfapi/font/cpdf_fontencoding.h b/chromium/third_party/pdfium/core/fpdfapi/font/cpdf_fontencoding.h
index 6c0de909e12..7a94db9f0ea 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/font/cpdf_fontencoding.h
+++ b/chromium/third_party/pdfium/core/fpdfapi/font/cpdf_fontencoding.h
@@ -24,15 +24,14 @@
#define PDFFONT_ENCODING_MS_SYMBOL 8
#define PDFFONT_ENCODING_UNICODE 9
-uint32_t FT_CharCodeFromUnicode(int encoding, FX_WCHAR unicode);
-FX_WCHAR FT_UnicodeFromCharCode(int encoding, uint32_t charcode);
+uint32_t FT_CharCodeFromUnicode(int encoding, wchar_t unicode);
+wchar_t FT_UnicodeFromCharCode(int encoding, uint32_t charcode);
-FX_WCHAR PDF_UnicodeFromAdobeName(const FX_CHAR* name);
-CFX_ByteString PDF_AdobeNameFromUnicode(FX_WCHAR unicode);
+wchar_t PDF_UnicodeFromAdobeName(const char* name);
+CFX_ByteString PDF_AdobeNameFromUnicode(wchar_t unicode);
const uint16_t* PDF_UnicodesForPredefinedCharSet(int encoding);
-const FX_CHAR* PDF_CharNameFromPredefinedCharSet(int encoding,
- uint8_t charcode);
+const char* PDF_CharNameFromPredefinedCharSet(int encoding, uint8_t charcode);
class CPDF_Object;
@@ -45,19 +44,19 @@ class CPDF_FontEncoding {
bool IsIdentical(CPDF_FontEncoding* pAnother) const;
- FX_WCHAR UnicodeFromCharCode(uint8_t charcode) const {
+ wchar_t UnicodeFromCharCode(uint8_t charcode) const {
return m_Unicodes[charcode];
}
- int CharCodeFromUnicode(FX_WCHAR unicode) const;
+ int CharCodeFromUnicode(wchar_t unicode) const;
- void SetUnicode(uint8_t charcode, FX_WCHAR unicode) {
+ void SetUnicode(uint8_t charcode, wchar_t unicode) {
m_Unicodes[charcode] = unicode;
}
std::unique_ptr<CPDF_Object> Realize(CFX_WeakPtr<CFX_ByteStringPool> pPool);
public:
- FX_WCHAR m_Unicodes[256];
+ wchar_t m_Unicodes[256];
};
#endif // CORE_FPDFAPI_FONT_CPDF_FONTENCODING_H_
diff --git a/chromium/third_party/pdfium/core/fpdfapi/font/cpdf_simplefont.cpp b/chromium/third_party/pdfium/core/fpdfapi/font/cpdf_simplefont.cpp
index c4142700686..cb8f00a98a6 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/font/cpdf_simplefont.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/font/cpdf_simplefont.cpp
@@ -13,9 +13,9 @@
#include "third_party/base/numerics/safe_math.h"
CPDF_SimpleFont::CPDF_SimpleFont() : m_BaseEncoding(PDFFONT_ENCODING_BUILTIN) {
- FXSYS_memset(m_CharWidth, 0xff, sizeof(m_CharWidth));
- FXSYS_memset(m_GlyphIndex, 0xff, sizeof(m_GlyphIndex));
- FXSYS_memset(m_ExtGID, 0xff, sizeof(m_ExtGID));
+ memset(m_CharWidth, 0xff, sizeof(m_CharWidth));
+ memset(m_GlyphIndex, 0xff, sizeof(m_GlyphIndex));
+ memset(m_ExtGID, 0xff, sizeof(m_ExtGID));
for (size_t i = 0; i < FX_ArraySize(m_CharBBox); ++i)
m_CharBBox[i] = FX_RECT(-1, -1, -1, -1);
}
@@ -29,8 +29,11 @@ int CPDF_SimpleFont::GlyphFromCharCode(uint32_t charcode, bool* pVertGlyph) {
if (charcode > 0xff)
return -1;
- int index = m_GlyphIndex[(uint8_t)charcode];
- return index != 0xffff ? index : -1;
+ int index = m_GlyphIndex[charcode];
+ if (index == 0xffff || (index == 0 && IsTrueTypeFont()))
+ return -1;
+
+ return index;
}
void CPDF_SimpleFont::LoadCharMetrics(int charcode) {
@@ -198,13 +201,13 @@ CFX_WideString CPDF_SimpleFont::UnicodeFromCharCode(uint32_t charcode) const {
CFX_WideString unicode = CPDF_Font::UnicodeFromCharCode(charcode);
if (!unicode.IsEmpty())
return unicode;
- FX_WCHAR ret = m_Encoding.UnicodeFromCharCode((uint8_t)charcode);
+ wchar_t ret = m_Encoding.UnicodeFromCharCode((uint8_t)charcode);
if (ret == 0)
return CFX_WideString();
return ret;
}
-uint32_t CPDF_SimpleFont::CharCodeFromUnicode(FX_WCHAR unicode) const {
+uint32_t CPDF_SimpleFont::CharCodeFromUnicode(wchar_t unicode) const {
uint32_t ret = CPDF_Font::CharCodeFromUnicode(unicode);
if (ret)
return ret;
diff --git a/chromium/third_party/pdfium/core/fpdfapi/font/cpdf_simplefont.h b/chromium/third_party/pdfium/core/fpdfapi/font/cpdf_simplefont.h
index 592290b99b4..3e414fa788c 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/font/cpdf_simplefont.h
+++ b/chromium/third_party/pdfium/core/fpdfapi/font/cpdf_simplefont.h
@@ -25,7 +25,7 @@ class CPDF_SimpleFont : public CPDF_Font {
int GlyphFromCharCode(uint32_t charcode, bool* pVertGlyph) override;
bool IsUnicodeCompatible() const override;
CFX_WideString UnicodeFromCharCode(uint32_t charcode) const override;
- uint32_t CharCodeFromUnicode(FX_WCHAR Unicode) const override;
+ uint32_t CharCodeFromUnicode(wchar_t Unicode) const override;
CPDF_FontEncoding* GetEncoding() { return &m_Encoding; }
diff --git a/chromium/third_party/pdfium/core/fpdfapi/font/cpdf_truetypefont.cpp b/chromium/third_party/pdfium/core/fpdfapi/font/cpdf_truetypefont.cpp
index b8bee2968e1..d78a5e0eb24 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/font/cpdf_truetypefont.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/font/cpdf_truetypefont.cpp
@@ -73,13 +73,11 @@ void CPDF_TrueTypeFont::LoadGlyphMap() {
return;
int charcode = 0;
- for (; charcode < nStartChar; charcode++) {
+ for (; charcode < nStartChar; charcode++)
m_GlyphIndex[charcode] = 0;
- }
uint16_t nGlyph = charcode - nStartChar + 3;
- for (; charcode < 256; charcode++, nGlyph++) {
+ for (; charcode < 256; charcode++, nGlyph++)
m_GlyphIndex[charcode] = nGlyph;
- }
return;
}
bool bMSUnicode = FT_UseTTCharmap(m_Font.GetFace(), 3, 1);
@@ -96,8 +94,7 @@ void CPDF_TrueTypeFont::LoadGlyphMap() {
}
bool bToUnicode = m_pFontDict->KeyExist("ToUnicode");
for (int charcode = 0; charcode < 256; charcode++) {
- const FX_CHAR* name =
- GetAdobeCharName(baseEncoding, m_CharNames, charcode);
+ const char* name = GetAdobeCharName(baseEncoding, m_CharNames, charcode);
if (!name) {
m_GlyphIndex[charcode] =
m_pFontFile ? FXFT_Get_Char_Index(m_Font.GetFace(), charcode) : -1;
@@ -109,9 +106,8 @@ void CPDF_TrueTypeFont::LoadGlyphMap() {
uint16_t unicode = kPrefix[j] * 256 + charcode;
m_GlyphIndex[charcode] =
FXFT_Get_Char_Index(m_Font.GetFace(), unicode);
- if (m_GlyphIndex[charcode]) {
+ if (m_GlyphIndex[charcode])
break;
- }
}
} else if (m_Encoding.m_Unicodes[charcode]) {
if (bMSUnicode) {
@@ -131,7 +127,7 @@ void CPDF_TrueTypeFont::LoadGlyphMap() {
}
if ((m_GlyphIndex[charcode] == 0 || m_GlyphIndex[charcode] == 0xffff) &&
name) {
- if (name[0] == '.' && FXSYS_strcmp(name, ".notdef") == 0) {
+ if (name[0] == '.' && strcmp(name, ".notdef") == 0) {
m_GlyphIndex[charcode] = FXFT_Get_Char_Index(m_Font.GetFace(), 32);
} else {
m_GlyphIndex[charcode] =
@@ -170,7 +166,7 @@ void CPDF_TrueTypeFont::LoadGlyphMap() {
if (bFound) {
if (baseEncoding != PDFFONT_ENCODING_BUILTIN) {
for (int charcode = 0; charcode < 256; charcode++) {
- const FX_CHAR* name =
+ const char* name =
GetAdobeCharName(baseEncoding, m_CharNames, charcode);
if (name)
m_Encoding.m_Unicodes[charcode] = PDF_UnicodeFromAdobeName(name);
@@ -204,7 +200,7 @@ void CPDF_TrueTypeFont::LoadGlyphMap() {
if (m_pFontFile) {
m_Encoding.m_Unicodes[charcode] = charcode;
} else {
- const FX_CHAR* name = GetAdobeCharName(0, m_CharNames, charcode);
+ const char* name = GetAdobeCharName(0, m_CharNames, charcode);
if (name)
m_Encoding.m_Unicodes[charcode] = PDF_UnicodeFromAdobeName(name);
else if (pUnicodes)
diff --git a/chromium/third_party/pdfium/core/fpdfapi/font/cpdf_type1font.cpp b/chromium/third_party/pdfium/core/fpdfapi/font/cpdf_type1font.cpp
index 1a37555a509..ac0aed4050b 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/font/cpdf_type1font.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/font/cpdf_type1font.cpp
@@ -19,8 +19,8 @@ namespace {
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
struct GlyphNameMap {
- const FX_CHAR* m_pStrAdobe;
- const FX_CHAR* m_pStrUnicode;
+ const char* m_pStrAdobe;
+ const char* m_pStrUnicode;
};
const GlyphNameMap g_GlyphNameSubsts[] = {{"ff", "uniFB00"},
@@ -30,14 +30,14 @@ const GlyphNameMap g_GlyphNameSubsts[] = {{"ff", "uniFB00"},
{"fl", "uniFB02"}};
int compareString(const void* key, const void* element) {
- return FXSYS_stricmp(static_cast<const FX_CHAR*>(key),
+ return FXSYS_stricmp(static_cast<const char*>(key),
static_cast<const GlyphNameMap*>(element)->m_pStrAdobe);
}
-const FX_CHAR* GlyphNameRemap(const FX_CHAR* pStrAdobe) {
- const GlyphNameMap* found = static_cast<const GlyphNameMap*>(FXSYS_bsearch(
- pStrAdobe, g_GlyphNameSubsts, FX_ArraySize(g_GlyphNameSubsts),
- sizeof(GlyphNameMap), compareString));
+const char* GlyphNameRemap(const char* pStrAdobe) {
+ const GlyphNameMap* found = static_cast<const GlyphNameMap*>(
+ bsearch(pStrAdobe, g_GlyphNameSubsts, FX_ArraySize(g_GlyphNameSubsts),
+ sizeof(GlyphNameMap), compareString));
return found ? found->m_pStrUnicode : nullptr;
}
@@ -151,7 +151,7 @@ void CPDF_Type1Font::LoadGlyphMap() {
if (bGotOne) {
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
if (!bCoreText)
- FXSYS_memcpy(m_ExtGID, m_GlyphIndex, 256);
+ memcpy(m_ExtGID, m_GlyphIndex, 256);
#endif
return;
}
@@ -161,7 +161,7 @@ void CPDF_Type1Font::LoadGlyphMap() {
m_BaseEncoding = PDFFONT_ENCODING_STANDARD;
}
for (int charcode = 0; charcode < 256; charcode++) {
- const FX_CHAR* name =
+ const char* name =
GetAdobeCharName(m_BaseEncoding, m_CharNames, charcode);
if (!name)
continue;
@@ -172,7 +172,7 @@ void CPDF_Type1Font::LoadGlyphMap() {
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
CalcExtGID(charcode);
#endif
- if (m_GlyphIndex[charcode] == 0 && FXSYS_strcmp(name, ".notdef") == 0) {
+ if (m_GlyphIndex[charcode] == 0 && strcmp(name, ".notdef") == 0) {
m_Encoding.m_Unicodes[charcode] = 0x20;
m_GlyphIndex[charcode] = FXFT_Get_Char_Index(m_Font.GetFace(), 0x20);
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
@@ -182,7 +182,7 @@ void CPDF_Type1Font::LoadGlyphMap() {
}
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
if (!bCoreText)
- FXSYS_memcpy(m_ExtGID, m_GlyphIndex, 256);
+ memcpy(m_ExtGID, m_GlyphIndex, 256);
#endif
return;
}
@@ -191,7 +191,7 @@ void CPDF_Type1Font::LoadGlyphMap() {
if (bCoreText) {
if (m_Flags & FXFONT_SYMBOLIC) {
for (int charcode = 0; charcode < 256; charcode++) {
- const FX_CHAR* name =
+ const char* name =
GetAdobeCharName(m_BaseEncoding, m_CharNames, charcode);
if (name) {
m_Encoding.m_Unicodes[charcode] = PDF_UnicodeFromAdobeName(name);
@@ -201,13 +201,13 @@ void CPDF_Type1Font::LoadGlyphMap() {
} else {
m_GlyphIndex[charcode] =
FXFT_Get_Char_Index(m_Font.GetFace(), charcode);
- FX_WCHAR unicode = 0;
+ wchar_t unicode = 0;
if (m_GlyphIndex[charcode]) {
unicode =
FT_UnicodeFromCharCode(PDFFONT_ENCODING_STANDARD, charcode);
}
- FX_CHAR name_glyph[256];
- FXSYS_memset(name_glyph, 0, sizeof(name_glyph));
+ char name_glyph[256];
+ memset(name_glyph, 0, sizeof(name_glyph));
FXFT_Get_Glyph_Name(m_Font.GetFace(), m_GlyphIndex[charcode],
name_glyph, 256);
name_glyph[255] = 0;
@@ -225,13 +225,13 @@ void CPDF_Type1Font::LoadGlyphMap() {
bUnicode = true;
}
for (int charcode = 0; charcode < 256; charcode++) {
- const FX_CHAR* name =
+ const char* name =
GetAdobeCharName(m_BaseEncoding, m_CharNames, charcode);
if (!name) {
continue;
}
m_Encoding.m_Unicodes[charcode] = PDF_UnicodeFromAdobeName(name);
- const FX_CHAR* pStrUnicode = GlyphNameRemap(name);
+ const char* pStrUnicode = GlyphNameRemap(name);
if (pStrUnicode &&
0 == FXFT_Get_Name_Index(m_Font.GetFace(), (char*)name)) {
name = pStrUnicode;
@@ -240,8 +240,7 @@ void CPDF_Type1Font::LoadGlyphMap() {
FXFT_Get_Name_Index(m_Font.GetFace(), (char*)name);
SetExtGID(name, charcode);
if (m_GlyphIndex[charcode] == 0) {
- if (FXSYS_strcmp(name, ".notdef") != 0 &&
- FXSYS_strcmp(name, "space") != 0) {
+ if (strcmp(name, ".notdef") != 0 && strcmp(name, "space") != 0) {
m_GlyphIndex[charcode] = FXFT_Get_Char_Index(
m_Font.GetFace(),
bUnicode ? m_Encoding.m_Unicodes[charcode] : charcode);
@@ -259,7 +258,7 @@ void CPDF_Type1Font::LoadGlyphMap() {
#endif // _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
if (m_Flags & FXFONT_SYMBOLIC) {
for (int charcode = 0; charcode < 256; charcode++) {
- const FX_CHAR* name =
+ const char* name =
GetAdobeCharName(m_BaseEncoding, m_CharNames, charcode);
if (name) {
m_Encoding.m_Unicodes[charcode] = PDF_UnicodeFromAdobeName(name);
@@ -269,11 +268,11 @@ void CPDF_Type1Font::LoadGlyphMap() {
m_GlyphIndex[charcode] =
FXFT_Get_Char_Index(m_Font.GetFace(), charcode);
if (m_GlyphIndex[charcode]) {
- FX_WCHAR unicode =
+ wchar_t unicode =
FT_UnicodeFromCharCode(PDFFONT_ENCODING_STANDARD, charcode);
if (unicode == 0) {
- FX_CHAR name_glyph[256];
- FXSYS_memset(name_glyph, 0, sizeof(name_glyph));
+ char name_glyph[256];
+ memset(name_glyph, 0, sizeof(name_glyph));
FXFT_Get_Glyph_Name(m_Font.GetFace(), m_GlyphIndex[charcode],
name_glyph, 256);
name_glyph[255] = 0;
@@ -287,7 +286,7 @@ void CPDF_Type1Font::LoadGlyphMap() {
}
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
if (!bCoreText)
- FXSYS_memcpy(m_ExtGID, m_GlyphIndex, 256);
+ memcpy(m_ExtGID, m_GlyphIndex, 256);
#endif
return;
@@ -297,16 +296,14 @@ void CPDF_Type1Font::LoadGlyphMap() {
bUnicode = true;
}
for (int charcode = 0; charcode < 256; charcode++) {
- const FX_CHAR* name =
- GetAdobeCharName(m_BaseEncoding, m_CharNames, charcode);
+ const char* name = GetAdobeCharName(m_BaseEncoding, m_CharNames, charcode);
if (!name) {
continue;
}
m_Encoding.m_Unicodes[charcode] = PDF_UnicodeFromAdobeName(name);
m_GlyphIndex[charcode] = FXFT_Get_Name_Index(m_Font.GetFace(), (char*)name);
if (m_GlyphIndex[charcode] == 0) {
- if (FXSYS_strcmp(name, ".notdef") != 0 &&
- FXSYS_strcmp(name, "space") != 0) {
+ if (strcmp(name, ".notdef") != 0 && strcmp(name, "space") != 0) {
m_GlyphIndex[charcode] = FXFT_Get_Char_Index(
m_Font.GetFace(),
bUnicode ? m_Encoding.m_Unicodes[charcode] : charcode);
@@ -318,12 +315,12 @@ void CPDF_Type1Font::LoadGlyphMap() {
}
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
if (!bCoreText)
- FXSYS_memcpy(m_ExtGID, m_GlyphIndex, 256);
+ memcpy(m_ExtGID, m_GlyphIndex, 256);
#endif
}
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
-void CPDF_Type1Font::SetExtGID(const FX_CHAR* name, int charcode) {
+void CPDF_Type1Font::SetExtGID(const char* name, int charcode) {
CFStringRef name_ct = CFStringCreateWithCStringNoCopy(
kCFAllocatorDefault, name, kCFStringEncodingASCII, kCFAllocatorNull);
m_ExtGID[charcode] =
@@ -333,7 +330,7 @@ void CPDF_Type1Font::SetExtGID(const FX_CHAR* name, int charcode) {
}
void CPDF_Type1Font::CalcExtGID(int charcode) {
- FX_CHAR name_glyph[256];
+ char name_glyph[256];
FXFT_Get_Glyph_Name(m_Font.GetFace(), m_GlyphIndex[charcode], name_glyph,
256);
name_glyph[255] = 0;
diff --git a/chromium/third_party/pdfium/core/fpdfapi/font/cpdf_type1font.h b/chromium/third_party/pdfium/core/fpdfapi/font/cpdf_type1font.h
index f5f378561d1..8039583d8e5 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/font/cpdf_type1font.h
+++ b/chromium/third_party/pdfium/core/fpdfapi/font/cpdf_type1font.h
@@ -30,7 +30,7 @@ class CPDF_Type1Font : public CPDF_SimpleFont {
void LoadGlyphMap() override;
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
- void SetExtGID(const FX_CHAR* name, int charcode);
+ void SetExtGID(const char* name, int charcode);
void CalcExtGID(int charcode);
#endif
diff --git a/chromium/third_party/pdfium/core/fpdfapi/font/cpdf_type3char.cpp b/chromium/third_party/pdfium/core/fpdfapi/font/cpdf_type3char.cpp
index 5eb12c17526..4f116a1afba 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/font/cpdf_type3char.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/font/cpdf_type3char.cpp
@@ -29,7 +29,7 @@ bool CPDF_Type3Char::LoadBitmap(CPDF_RenderContext* pContext) {
return false;
m_ImageMatrix = pPageObj->AsImage()->matrix();
- std::unique_ptr<CFX_DIBSource> pSource =
+ CFX_RetainPtr<CFX_DIBSource> pSource =
pPageObj->AsImage()->GetImage()->LoadDIBSource();
if (pSource)
m_pBitmap = pSource->Clone();
diff --git a/chromium/third_party/pdfium/core/fpdfapi/font/cpdf_type3char.h b/chromium/third_party/pdfium/core/fpdfapi/font/cpdf_type3char.h
index 549f49e3da3..3215802e0cc 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/font/cpdf_type3char.h
+++ b/chromium/third_party/pdfium/core/fpdfapi/font/cpdf_type3char.h
@@ -25,7 +25,7 @@ class CPDF_Type3Char {
bool LoadBitmap(CPDF_RenderContext* pContext);
std::unique_ptr<CPDF_Form> m_pForm;
- std::unique_ptr<CFX_DIBitmap> m_pBitmap;
+ CFX_RetainPtr<CFX_DIBitmap> m_pBitmap;
bool m_bColored;
int m_Width;
CFX_Matrix m_ImageMatrix;
diff --git a/chromium/third_party/pdfium/core/fpdfapi/font/cpdf_type3font.cpp b/chromium/third_party/pdfium/core/fpdfapi/font/cpdf_type3font.cpp
index f6cd6ecf263..da3b183c13f 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/font/cpdf_type3font.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/font/cpdf_type3font.cpp
@@ -24,7 +24,7 @@ CPDF_Type3Font::CPDF_Type3Font()
m_pPageResources(nullptr),
m_pFontResources(nullptr),
m_CharLoadingDepth(0) {
- FXSYS_memset(m_CharWidthL, 0, sizeof(m_CharWidthL));
+ memset(m_CharWidthL, 0, sizeof(m_CharWidthL));
}
CPDF_Type3Font::~CPDF_Type3Font() {}
@@ -44,22 +44,29 @@ CPDF_Type3Font* CPDF_Type3Font::AsType3Font() {
bool CPDF_Type3Font::Load() {
m_pFontResources = m_pFontDict->GetDictFor("Resources");
CPDF_Array* pMatrix = m_pFontDict->GetArrayFor("FontMatrix");
- FX_FLOAT xscale = 1.0f, yscale = 1.0f;
+ float xscale = 1.0f;
+ float yscale = 1.0f;
if (pMatrix) {
m_FontMatrix = pMatrix->GetMatrix();
xscale = m_FontMatrix.a;
yscale = m_FontMatrix.d;
}
+
CPDF_Array* pBBox = m_pFontDict->GetArrayFor("FontBBox");
if (pBBox) {
- m_FontBBox.left = (int32_t)(pBBox->GetNumberAt(0) * xscale * 1000);
- m_FontBBox.bottom = (int32_t)(pBBox->GetNumberAt(1) * yscale * 1000);
- m_FontBBox.right = (int32_t)(pBBox->GetNumberAt(2) * xscale * 1000);
- m_FontBBox.top = (int32_t)(pBBox->GetNumberAt(3) * yscale * 1000);
+ m_FontBBox.left =
+ static_cast<int32_t>(pBBox->GetNumberAt(0) * xscale * 1000);
+ m_FontBBox.bottom =
+ static_cast<int32_t>(pBBox->GetNumberAt(1) * yscale * 1000);
+ m_FontBBox.right =
+ static_cast<int32_t>(pBBox->GetNumberAt(2) * xscale * 1000);
+ m_FontBBox.top =
+ static_cast<int32_t>(pBBox->GetNumberAt(3) * yscale * 1000);
}
+
int StartChar = m_pFontDict->GetIntegerFor("FirstChar");
CPDF_Array* pWidthArray = m_pFontDict->GetArrayFor("Widths");
- if (pWidthArray && (StartChar >= 0 && StartChar < 256)) {
+ if (pWidthArray && StartChar >= 0 && StartChar < 256) {
size_t count = pWidthArray->GetCount();
if (count > 256)
count = 256;
@@ -89,7 +96,7 @@ CPDF_Type3Char* CPDF_Type3Font::LoadChar(uint32_t charcode) {
if (it != m_CacheMap.end())
return it->second.get();
- const FX_CHAR* name = GetAdobeCharName(m_BaseEncoding, m_CharNames, charcode);
+ const char* name = GetAdobeCharName(m_BaseEncoding, m_CharNames, charcode);
if (!name)
return nullptr;
@@ -98,9 +105,9 @@ CPDF_Type3Char* CPDF_Type3Font::LoadChar(uint32_t charcode) {
if (!pStream)
return nullptr;
- std::unique_ptr<CPDF_Type3Char> pNewChar(new CPDF_Type3Char(new CPDF_Form(
+ auto pNewChar = pdfium::MakeUnique<CPDF_Type3Char>(new CPDF_Form(
m_pDocument, m_pFontResources ? m_pFontResources : m_pPageResources,
- pStream, nullptr)));
+ pStream, nullptr));
// This can trigger recursion into this method. The content of |m_CacheMap|
// can change as a result. Thus after it returns, check the cache again for
@@ -112,12 +119,13 @@ CPDF_Type3Char* CPDF_Type3Font::LoadChar(uint32_t charcode) {
if (it != m_CacheMap.end())
return it->second.get();
- FX_FLOAT scale = m_FontMatrix.GetXUnit();
- pNewChar->m_Width = (int32_t)(pNewChar->m_Width * scale + 0.5f);
+ float scale = m_FontMatrix.GetXUnit();
+ pNewChar->m_Width = static_cast<int32_t>(pNewChar->m_Width * scale + 0.5f);
FX_RECT& rcBBox = pNewChar->m_BBox;
- CFX_FloatRect char_rect(
- (FX_FLOAT)rcBBox.left / 1000.0f, (FX_FLOAT)rcBBox.bottom / 1000.0f,
- (FX_FLOAT)rcBBox.right / 1000.0f, (FX_FLOAT)rcBBox.top / 1000.0f);
+ CFX_FloatRect char_rect(static_cast<float>(rcBBox.left) / 1000.0f,
+ static_cast<float>(rcBBox.bottom) / 1000.0f,
+ static_cast<float>(rcBBox.right) / 1000.0f,
+ static_cast<float>(rcBBox.top) / 1000.0f);
if (rcBBox.right <= rcBBox.left || rcBBox.bottom >= rcBBox.top)
char_rect = pNewChar->m_pForm->CalcBoundingBox();
diff --git a/chromium/third_party/pdfium/core/fpdfapi/font/font_int.h b/chromium/third_party/pdfium/core/fpdfapi/font/font_int.h
index 41d821ec81f..926ea91a9ed 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/font/font_int.h
+++ b/chromium/third_party/pdfium/core/fpdfapi/font/font_int.h
@@ -12,7 +12,7 @@
#include <vector>
#include "core/fpdfapi/font/cpdf_cidfont.h"
-#include "core/fxcrt/cfx_maybe_owned.h"
+#include "core/fxcrt/cfx_retain_ptr.h"
#include "core/fxcrt/fx_basic.h"
class CPDF_CID2UnicodeMap;
@@ -31,17 +31,17 @@ class CPDF_CMapManager {
CPDF_CMapManager();
~CPDF_CMapManager();
- CFX_MaybeOwned<CPDF_CMap> GetPredefinedCMap(const CFX_ByteString& name,
- bool bPromptCJK);
+ CFX_RetainPtr<CPDF_CMap> GetPredefinedCMap(const CFX_ByteString& name,
+ bool bPromptCJK);
CPDF_CID2UnicodeMap* GetCID2UnicodeMap(CIDSet charset, bool bPromptCJK);
private:
- std::unique_ptr<CPDF_CMap> LoadPredefinedCMap(const CFX_ByteString& name,
- bool bPromptCJK);
+ CFX_RetainPtr<CPDF_CMap> LoadPredefinedCMap(const CFX_ByteString& name,
+ bool bPromptCJK);
std::unique_ptr<CPDF_CID2UnicodeMap> LoadCID2UnicodeMap(CIDSet charset,
bool bPromptCJK);
- std::map<CFX_ByteString, std::unique_ptr<CPDF_CMap>> m_CMaps;
+ std::map<CFX_ByteString, CFX_RetainPtr<CPDF_CMap>> m_CMaps;
std::unique_ptr<CPDF_CID2UnicodeMap> m_CID2UnicodeMaps[6];
};
@@ -127,7 +127,7 @@ enum CIDCoding : uint8_t {
CIDCODING_UTF16,
};
-class CPDF_CMap {
+class CPDF_CMap : public CFX_Retainable {
public:
enum CodingScheme : uint8_t {
OneByte,
@@ -136,8 +136,8 @@ class CPDF_CMap {
MixedFourBytes
};
- CPDF_CMap();
- ~CPDF_CMap();
+ template <typename T, typename... Args>
+ friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args);
void LoadPredefined(CPDF_CMapManager* pMgr,
const CFX_ByteString& name,
@@ -148,14 +148,17 @@ class CPDF_CMap {
bool IsVertWriting() const;
uint16_t CIDFromCharCode(uint32_t charcode) const;
int GetCharSize(uint32_t charcode) const;
- uint32_t GetNextChar(const FX_CHAR* pString, int nStrLen, int& offset) const;
- int CountChar(const FX_CHAR* pString, int size) const;
- int AppendChar(FX_CHAR* str, uint32_t charcode) const;
+ uint32_t GetNextChar(const char* pString, int nStrLen, int& offset) const;
+ int CountChar(const char* pString, int size) const;
+ int AppendChar(char* str, uint32_t charcode) const;
private:
friend class CPDF_CMapParser;
friend class CPDF_CIDFont;
+ CPDF_CMap();
+ ~CPDF_CMap() override;
+
CFX_ByteString m_PredefinedCMap;
bool m_bVertical;
CIDSet m_Charset;
@@ -176,7 +179,7 @@ class CPDF_CID2UnicodeMap {
bool IsLoaded();
void Load(CPDF_CMapManager* pMgr, CIDSet charset, bool bPromptCJK);
- FX_WCHAR UnicodeFromCID(uint16_t CID);
+ wchar_t UnicodeFromCID(uint16_t CID);
private:
CIDSet m_Charset;
@@ -192,7 +195,7 @@ class CPDF_ToUnicodeMap {
void Load(CPDF_Stream* pStream);
CFX_WideString Lookup(uint32_t charcode) const;
- uint32_t ReverseLookup(FX_WCHAR unicode) const;
+ uint32_t ReverseLookup(wchar_t unicode) const;
private:
friend class fpdf_font_StringToCode_Test;
diff --git a/chromium/third_party/pdfium/core/fpdfapi/font/fpdf_font.cpp b/chromium/third_party/pdfium/core/fpdfapi/font/fpdf_font.cpp
index 7bbd6371778..a5616ea9635 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/font/fpdf_font.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/font/fpdf_font.cpp
@@ -36,7 +36,7 @@ int TT2PDF(int m, FXFT_Face face) {
}
bool FT_UseTTCharmap(FXFT_Face face, int platform_id, int encoding_id) {
- auto* pCharMap = FXFT_Get_Face_Charmaps(face);
+ auto** pCharMap = FXFT_Get_Face_Charmaps(face);
for (int i = 0; i < FXFT_Get_Face_CharmapCount(face); i++) {
if (FXFT_Get_Charmap_PlatformID(pCharMap[i]) == platform_id &&
FXFT_Get_Charmap_EncodingID(pCharMap[i]) == encoding_id) {
@@ -71,8 +71,8 @@ CPDF_Font* CFX_StockFontArray::SetFont(uint32_t index,
}
CPDF_FontGlobals::CPDF_FontGlobals() {
- FXSYS_memset(m_EmbeddedCharsets, 0, sizeof(m_EmbeddedCharsets));
- FXSYS_memset(m_EmbeddedToUnicodes, 0, sizeof(m_EmbeddedToUnicodes));
+ memset(m_EmbeddedCharsets, 0, sizeof(m_EmbeddedCharsets));
+ memset(m_EmbeddedToUnicodes, 0, sizeof(m_EmbeddedToUnicodes));
}
CPDF_FontGlobals::~CPDF_FontGlobals() {}
@@ -100,11 +100,11 @@ CFX_WideString CPDF_ToUnicodeMap::Lookup(uint32_t charcode) const {
auto it = m_Map.find(charcode);
if (it != m_Map.end()) {
uint32_t value = it->second;
- FX_WCHAR unicode = (FX_WCHAR)(value & 0xffff);
+ wchar_t unicode = (wchar_t)(value & 0xffff);
if (unicode != 0xffff) {
return unicode;
}
- const FX_WCHAR* buf = m_MultiCharBuf.GetBuffer();
+ const wchar_t* buf = m_MultiCharBuf.GetBuffer();
uint32_t buf_len = m_MultiCharBuf.GetLength();
if (!buf || buf_len == 0) {
return CFX_WideString();
@@ -125,7 +125,7 @@ CFX_WideString CPDF_ToUnicodeMap::Lookup(uint32_t charcode) const {
return CFX_WideString();
}
-uint32_t CPDF_ToUnicodeMap::ReverseLookup(FX_WCHAR unicode) const {
+uint32_t CPDF_ToUnicodeMap::ReverseLookup(wchar_t unicode) const {
for (const auto& pair : m_Map) {
if (pair.second == static_cast<uint32_t>(unicode))
return pair.first;
@@ -155,9 +155,9 @@ uint32_t CPDF_ToUnicodeMap::StringToCode(const CFX_ByteStringC& str) {
static CFX_WideString StringDataAdd(CFX_WideString str) {
CFX_WideString ret;
int len = str.GetLength();
- FX_WCHAR value = 1;
+ wchar_t value = 1;
for (int i = len - 1; i >= 0; --i) {
- FX_WCHAR ch = str[i] + value;
+ wchar_t ch = str[i] + value;
if (ch < str[i]) {
ret.Insert(0, 0);
} else {
@@ -181,7 +181,7 @@ CFX_WideString CPDF_ToUnicodeMap::StringToWideString(
CFX_WideString result;
if (str[0] == '<') {
int byte_pos = 0;
- FX_WCHAR ch = 0;
+ wchar_t ch = 0;
for (int i = 1; i < len && std::isxdigit(str[i]); ++i) {
ch = ch * 16 + FXSYS_toHexDigit(str[i]);
byte_pos++;
@@ -208,9 +208,9 @@ uint32_t CPDF_ToUnicodeMap::GetUnicode() {
void CPDF_ToUnicodeMap::Load(CPDF_Stream* pStream) {
CIDSet cid_set = CIDSET_UNKNOWN;
- CPDF_StreamAcc stream;
- stream.LoadAllData(pStream, false);
- CPDF_SimpleParser parser(stream.GetData(), stream.GetSize());
+ auto pAcc = pdfium::MakeRetain<CPDF_StreamAcc>(pStream);
+ pAcc->LoadAllData(false);
+ CPDF_SimpleParser parser(pAcc->GetData(), pAcc->GetSize());
while (1) {
CFX_ByteStringC word = parser.GetWord();
if (word.IsEmpty()) {
diff --git a/chromium/third_party/pdfium/core/fpdfapi/font/fpdf_font_cid.cpp b/chromium/third_party/pdfium/core/fpdfapi/font/fpdf_font_cid.cpp
index afb186d0706..434fe62ede2 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/font/fpdf_font_cid.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/font/fpdf_font_cid.cpp
@@ -23,12 +23,12 @@
namespace {
-const FX_CHAR* const g_CharsetNames[CIDSET_NUM_SETS] = {
- nullptr, "GB1", "CNS1", "Japan1", "Korea1", "UCS"};
+const char* const g_CharsetNames[CIDSET_NUM_SETS] = {nullptr, "GB1", "CNS1",
+ "Japan1", "Korea1", "UCS"};
class CPDF_PredefinedCMap {
public:
- const FX_CHAR* m_pName;
+ const char* m_pName;
CIDSet m_Charset;
CIDCoding m_Coding;
CPDF_CMap::CodingScheme m_CodingScheme;
@@ -286,30 +286,28 @@ CPDF_CMapManager::CPDF_CMapManager() {}
CPDF_CMapManager::~CPDF_CMapManager() {}
-CFX_MaybeOwned<CPDF_CMap> CPDF_CMapManager::GetPredefinedCMap(
+CFX_RetainPtr<CPDF_CMap> CPDF_CMapManager::GetPredefinedCMap(
const CFX_ByteString& name,
bool bPromptCJK) {
auto it = m_CMaps.find(name);
if (it != m_CMaps.end())
- return CFX_MaybeOwned<CPDF_CMap>(it->second.get()); // Unowned.
+ return it->second;
- std::unique_ptr<CPDF_CMap> pCMap = LoadPredefinedCMap(name, bPromptCJK);
- if (name.IsEmpty())
- return CFX_MaybeOwned<CPDF_CMap>(std::move(pCMap)); // Owned.
+ CFX_RetainPtr<CPDF_CMap> pCMap = LoadPredefinedCMap(name, bPromptCJK);
+ if (!name.IsEmpty())
+ m_CMaps[name] = pCMap;
- CPDF_CMap* pUnowned = pCMap.get();
- m_CMaps[name] = std::move(pCMap);
- return CFX_MaybeOwned<CPDF_CMap>(pUnowned); // Unowned.
+ return pCMap;
}
-std::unique_ptr<CPDF_CMap> CPDF_CMapManager::LoadPredefinedCMap(
+CFX_RetainPtr<CPDF_CMap> CPDF_CMapManager::LoadPredefinedCMap(
const CFX_ByteString& name,
bool bPromptCJK) {
- auto pCMap = pdfium::MakeUnique<CPDF_CMap>();
- const FX_CHAR* pname = name.c_str();
+ const char* pname = name.c_str();
if (*pname == '/')
pname++;
+ auto pCMap = pdfium::MakeRetain<CPDF_CMap>();
pCMap->LoadPredefined(this, pname, bPromptCJK);
return pCMap;
}
@@ -415,8 +413,8 @@ void CPDF_CMapParser::ParseWord(const CFX_ByteStringC& word) {
FX_Free(m_pCMap->m_pLeadingBytes);
m_pCMap->m_pLeadingBytes =
FX_Alloc2D(uint8_t, nSegs, sizeof(CMap_CodeRange));
- FXSYS_memcpy(m_pCMap->m_pLeadingBytes, m_CodeRanges.data(),
- nSegs * sizeof(CMap_CodeRange));
+ memcpy(m_pCMap->m_pLeadingBytes, m_CodeRanges.data(),
+ nSegs * sizeof(CMap_CodeRange));
} else if (nSegs == 1) {
m_pCMap->m_CodingScheme = (m_CodeRanges[0].m_CharSize == 2)
? CPDF_CMap::TwoBytes
@@ -451,7 +449,7 @@ uint32_t CPDF_CMapParser::CMap_GetCode(const CFX_ByteStringC& word) {
}
for (int i = 0; i < word.GetLength() && std::isdigit(word.GetAt(i)); ++i) {
- num = num * 10 + FXSYS_toDecimalDigit(static_cast<FX_WCHAR>(word.GetAt(i)));
+ num = num * 10 + FXSYS_toDecimalDigit(static_cast<wchar_t>(word.GetAt(i)));
if (!num.IsValid())
return 0;
}
@@ -579,10 +577,9 @@ void CPDF_CMap::LoadEmbedded(const uint8_t* pData, uint32_t size) {
if (m_CodingScheme == MixedFourBytes && parser.m_AddMaps.GetSize()) {
m_pAddMapping = FX_Alloc(uint8_t, parser.m_AddMaps.GetSize() + 4);
*(uint32_t*)m_pAddMapping = parser.m_AddMaps.GetSize() / 8;
- FXSYS_memcpy(m_pAddMapping + 4, parser.m_AddMaps.GetBuffer(),
- parser.m_AddMaps.GetSize());
- FXSYS_qsort(m_pAddMapping + 4, parser.m_AddMaps.GetSize() / 8, 8,
- CompareDWORD);
+ memcpy(m_pAddMapping + 4, parser.m_AddMaps.GetBuffer(),
+ parser.m_AddMaps.GetSize());
+ qsort(m_pAddMapping + 4, parser.m_AddMaps.GetSize() / 8, 8, CompareDWORD);
}
}
@@ -598,8 +595,8 @@ uint16_t CPDF_CMap::CIDFromCharCode(uint32_t charcode) const {
}
if (charcode >> 16) {
if (m_pAddMapping) {
- void* found = FXSYS_bsearch(&charcode, m_pAddMapping + 4,
- *(uint32_t*)m_pAddMapping, 8, CompareCID);
+ void* found = bsearch(&charcode, m_pAddMapping + 4,
+ *(uint32_t*)m_pAddMapping, 8, CompareCID);
if (!found)
return 0;
return (uint16_t)(((uint32_t*)found)[1] % 65536 + charcode -
@@ -610,7 +607,7 @@ uint16_t CPDF_CMap::CIDFromCharCode(uint32_t charcode) const {
return m_pMapping[charcode];
}
-uint32_t CPDF_CMap::GetNextChar(const FX_CHAR* pString,
+uint32_t CPDF_CMap::GetNextChar(const char* pString,
int nStrLen,
int& offset) const {
switch (m_CodingScheme) {
@@ -676,7 +673,7 @@ int CPDF_CMap::GetCharSize(uint32_t charcode) const {
}
return 1;
}
-int CPDF_CMap::CountChar(const FX_CHAR* pString, int size) const {
+int CPDF_CMap::CountChar(const char* pString, int size) const {
switch (m_CodingScheme) {
case OneByte:
return size;
@@ -704,7 +701,7 @@ int CPDF_CMap::CountChar(const FX_CHAR* pString, int size) const {
return size;
}
-int CPDF_CMap::AppendChar(FX_CHAR* str, uint32_t charcode) const {
+int CPDF_CMap::AppendChar(char* str, uint32_t charcode) const {
switch (m_CodingScheme) {
case OneByte:
str[0] = (uint8_t)charcode;
@@ -722,7 +719,7 @@ int CPDF_CMap::AppendChar(FX_CHAR* str, uint32_t charcode) const {
iSize = 1;
}
if (iSize > 1) {
- FXSYS_memset(str, 0, sizeof(uint8_t) * iSize);
+ memset(str, 0, sizeof(uint8_t) * iSize);
}
str[iSize - 1] = (uint8_t)charcode;
return iSize;
@@ -757,7 +754,7 @@ bool CPDF_CID2UnicodeMap::IsLoaded() {
return m_EmbeddedCount != 0;
}
-FX_WCHAR CPDF_CID2UnicodeMap::UnicodeFromCID(uint16_t CID) {
+wchar_t CPDF_CID2UnicodeMap::UnicodeFromCID(uint16_t CID) {
if (m_Charset == CIDSET_UNICODE) {
return CID;
}
diff --git a/chromium/third_party/pdfium/core/fpdfapi/font/ttgsubtable.cpp b/chromium/third_party/pdfium/core/fpdfapi/font/ttgsubtable.cpp
index 51e8e9cc200..d2a6b9ab52c 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/font/ttgsubtable.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/font/ttgsubtable.cpp
@@ -49,9 +49,9 @@ void CFX_GlyphMap::SetAt(int key, int value) {
}
bool CFX_GlyphMap::Lookup(int key, int& value) {
- void* pResult = FXSYS_bsearch(&key, m_Buffer.GetBuffer(),
- m_Buffer.GetSize() / sizeof(_IntPair),
- sizeof(_IntPair), _CompareInt);
+ void* pResult =
+ bsearch(&key, m_Buffer.GetBuffer(), m_Buffer.GetSize() / sizeof(_IntPair),
+ sizeof(_IntPair), _CompareInt);
if (!pResult) {
return false;
}
@@ -127,9 +127,8 @@ bool CFX_CTTGSUBTable::GetVerticalGlyphSub(uint32_t glyphnum,
uint32_t* vglyphnum,
TFeature* Feature) {
for (int index : Feature->LookupListIndices) {
- if (index < 0 || index >= pdfium::CollectionSize<int>(LookupList.Lookups))
+ if (!pdfium::IndexInBounds(LookupList.Lookups, index))
continue;
-
if (LookupList.Lookups[index].LookupType == 1 &&
GetVerticalGlyphSub2(glyphnum, vglyphnum, &LookupList.Lookups[index])) {
return true;
@@ -144,7 +143,7 @@ bool CFX_CTTGSUBTable::GetVerticalGlyphSub2(uint32_t glyphnum,
for (const auto& subTable : Lookup->SubTables) {
switch (subTable->SubstFormat) {
case 1: {
- auto tbl1 = static_cast<TSingleSubstFormat1*>(subTable.get());
+ auto* tbl1 = static_cast<TSingleSubstFormat1*>(subTable.get());
if (GetCoverageIndex(tbl1->Coverage.get(), glyphnum) >= 0) {
*vglyphnum = glyphnum + tbl1->DeltaGlyphID;
return true;
@@ -152,10 +151,9 @@ bool CFX_CTTGSUBTable::GetVerticalGlyphSub2(uint32_t glyphnum,
break;
}
case 2: {
- auto tbl2 = static_cast<TSingleSubstFormat2*>(subTable.get());
+ auto* tbl2 = static_cast<TSingleSubstFormat2*>(subTable.get());
int index = GetCoverageIndex(tbl2->Coverage.get(), glyphnum);
- if (index >= 0 &&
- index < pdfium::CollectionSize<int>(tbl2->Substitutes)) {
+ if (pdfium::IndexInBounds(tbl2->Substitutes, index)) {
*vglyphnum = tbl2->Substitutes[index];
return true;
}
diff --git a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_allstates.cpp b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_allstates.cpp
index 282a47fe29e..c67d3152c02 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_allstates.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_allstates.cpp
@@ -14,14 +14,7 @@
#include "core/fpdfapi/parser/cpdf_array.h"
#include "core/fpdfapi/parser/cpdf_dictionary.h"
#include "core/fxge/cfx_graphstatedata.h"
-
-namespace {
-
-FX_FLOAT ClipFloat(FX_FLOAT f) {
- return std::max(0.0f, std::min(1.0f, f));
-}
-
-} // namespace
+#include "third_party/base/stl_util.h"
CPDF_AllStates::CPDF_AllStates()
: m_TextLeading(0), m_TextRise(0), m_TextHorzScale(1.0f) {}
@@ -40,9 +33,7 @@ void CPDF_AllStates::Copy(const CPDF_AllStates& src) {
m_TextHorzScale = src.m_TextHorzScale;
}
-void CPDF_AllStates::SetLineDash(CPDF_Array* pArray,
- FX_FLOAT phase,
- FX_FLOAT scale) {
+void CPDF_AllStates::SetLineDash(CPDF_Array* pArray, float phase, float scale) {
m_GraphState.SetLineDash(pArray, phase, scale);
}
@@ -119,10 +110,12 @@ void CPDF_AllStates::ProcessExtGS(CPDF_Dictionary* pGS,
}
break;
case FXBSTR_ID('C', 'A', 0, 0):
- m_GeneralState.SetStrokeAlpha(ClipFloat(pObject->GetNumber()));
+ m_GeneralState.SetStrokeAlpha(
+ pdfium::clamp(pObject->GetNumber(), 0.0f, 1.0f));
break;
case FXBSTR_ID('c', 'a', 0, 0):
- m_GeneralState.SetFillAlpha(ClipFloat(pObject->GetNumber()));
+ m_GeneralState.SetFillAlpha(
+ pdfium::clamp(pObject->GetNumber(), 0.0f, 1.0f));
break;
case FXBSTR_ID('O', 'P', 0, 0):
m_GeneralState.SetStrokeOP(!!pObject->GetInteger());
diff --git a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_allstates.h b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_allstates.h
index dad1b8502ba..730003a96a3 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_allstates.h
+++ b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_allstates.h
@@ -22,16 +22,16 @@ class CPDF_AllStates : public CPDF_GraphicStates {
void Copy(const CPDF_AllStates& src);
void ProcessExtGS(CPDF_Dictionary* pGS, CPDF_StreamContentParser* pParser);
- void SetLineDash(CPDF_Array*, FX_FLOAT, FX_FLOAT scale);
+ void SetLineDash(CPDF_Array*, float, float scale);
CFX_Matrix m_TextMatrix;
CFX_Matrix m_CTM;
CFX_Matrix m_ParentMatrix;
CFX_PointF m_TextPos;
CFX_PointF m_TextLinePos;
- FX_FLOAT m_TextLeading;
- FX_FLOAT m_TextRise;
- FX_FLOAT m_TextHorzScale;
+ float m_TextLeading;
+ float m_TextRise;
+ float m_TextHorzScale;
};
#endif // CORE_FPDFAPI_PAGE_CPDF_ALLSTATES_H_
diff --git a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_color.cpp b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_color.cpp
index 4ba28ce3140..f0e433c2431 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_color.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_color.cpp
@@ -67,14 +67,14 @@ void CPDF_Color::SetColorSpace(CPDF_ColorSpace* pCS) {
}
}
-void CPDF_Color::SetValue(FX_FLOAT* comps) {
+void CPDF_Color::SetValue(float* comps) {
if (!m_pBuffer)
return;
if (m_pCS->GetFamily() != PDFCS_PATTERN)
- FXSYS_memcpy(m_pBuffer, comps, m_pCS->CountComponents() * sizeof(FX_FLOAT));
+ memcpy(m_pBuffer, comps, m_pCS->CountComponents() * sizeof(float));
}
-void CPDF_Color::SetValue(CPDF_Pattern* pPattern, FX_FLOAT* comps, int ncomps) {
+void CPDF_Color::SetValue(CPDF_Pattern* pPattern, float* comps, int ncomps) {
if (ncomps > MAX_PATTERN_COLORCOMPS)
return;
@@ -94,7 +94,7 @@ void CPDF_Color::SetValue(CPDF_Pattern* pPattern, FX_FLOAT* comps, int ncomps) {
pvalue->m_nComps = ncomps;
pvalue->m_pPattern = pPattern;
if (ncomps)
- FXSYS_memcpy(pvalue->m_Comps, comps, ncomps * sizeof(FX_FLOAT));
+ memcpy(pvalue->m_Comps, comps, ncomps * sizeof(float));
pvalue->m_pCountedPattern = nullptr;
if (pPattern && pPattern->document()) {
@@ -120,7 +120,7 @@ void CPDF_Color::Copy(const CPDF_Color* pSrc) {
return;
m_pBuffer = m_pCS->CreateBuf();
- FXSYS_memcpy(m_pBuffer, pSrc->m_pBuffer, m_pCS->GetBufSize());
+ memcpy(m_pBuffer, pSrc->m_pBuffer, m_pCS->GetBufSize());
if (m_pCS->GetFamily() != PDFCS_PATTERN)
return;
@@ -132,17 +132,19 @@ void CPDF_Color::Copy(const CPDF_Color* pSrc) {
}
}
-bool CPDF_Color::GetRGB(int& R, int& G, int& B) const {
+bool CPDF_Color::GetRGB(int* R, int* G, int* B) const {
if (!m_pCS || !m_pBuffer)
return false;
- FX_FLOAT r = 0.0f, g = 0.0f, b = 0.0f;
- if (!m_pCS->GetRGB(m_pBuffer, r, g, b))
+ float r = 0.0f;
+ float g = 0.0f;
+ float b = 0.0f;
+ if (!m_pCS->GetRGB(m_pBuffer, &r, &g, &b))
return false;
- R = (int32_t)(r * 255 + 0.5f);
- G = (int32_t)(g * 255 + 0.5f);
- B = (int32_t)(b * 255 + 0.5f);
+ *R = static_cast<int32_t>(r * 255 + 0.5f);
+ *G = static_cast<int32_t>(g * 255 + 0.5f);
+ *B = static_cast<int32_t>(b * 255 + 0.5f);
return true;
}
diff --git a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_color.h b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_color.h
index e81b5310550..67c50633260 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_color.h
+++ b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_color.h
@@ -23,10 +23,10 @@ class CPDF_Color {
void Copy(const CPDF_Color* pSrc);
void SetColorSpace(CPDF_ColorSpace* pCS);
- void SetValue(FX_FLOAT* comp);
- void SetValue(CPDF_Pattern* pPattern, FX_FLOAT* comp, int ncomps);
+ void SetValue(float* comp);
+ void SetValue(CPDF_Pattern* pPattern, float* comp, int ncomps);
- bool GetRGB(int& R, int& G, int& B) const;
+ bool GetRGB(int* R, int* G, int* B) const;
CPDF_Pattern* GetPattern() const;
const CPDF_ColorSpace* GetColorSpace() const { return m_pCS; }
@@ -35,7 +35,7 @@ class CPDF_Color {
void ReleaseColorSpace();
CPDF_ColorSpace* m_pCS;
- FX_FLOAT* m_pBuffer;
+ float* m_pBuffer;
};
#endif // CORE_FPDFAPI_PAGE_CPDF_COLOR_H_
diff --git a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_colorspace.cpp b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_colorspace.cpp
index 6cd0075e8e7..400b7a9150e 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_colorspace.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_colorspace.cpp
@@ -6,6 +6,8 @@
#include "core/fpdfapi/page/cpdf_colorspace.h"
+#include <algorithm>
+#include <limits>
#include <memory>
#include <utility>
@@ -23,6 +25,7 @@
#include "core/fxcodec/fx_codec.h"
#include "core/fxcrt/cfx_maybe_owned.h"
#include "core/fxcrt/fx_memory.h"
+#include "third_party/base/stl_util.h"
namespace {
@@ -62,57 +65,46 @@ const uint8_t g_sRGBSamples2[] = {
class CPDF_CalGray : public CPDF_ColorSpace {
public:
explicit CPDF_CalGray(CPDF_Document* pDoc);
+ ~CPDF_CalGray() override {}
+ // CPDF_ColorSpace:
bool v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override;
-
- bool GetRGB(FX_FLOAT* pBuf,
- FX_FLOAT& R,
- FX_FLOAT& G,
- FX_FLOAT& B) const override;
- bool SetRGB(FX_FLOAT* pBuf,
- FX_FLOAT R,
- FX_FLOAT G,
- FX_FLOAT B) const override;
-
+ bool GetRGB(float* pBuf, float* R, float* G, float* B) const override;
+ bool SetRGB(float* pBuf, float R, float G, float B) const override;
void TranslateImageLine(uint8_t* pDestBuf,
const uint8_t* pSrcBuf,
int pixels,
int image_width,
int image_height,
- bool bTransMask = false) const override;
+ bool bTransMask) const override;
private:
- FX_FLOAT m_WhitePoint[3];
- FX_FLOAT m_BlackPoint[3];
- FX_FLOAT m_Gamma;
+ float m_WhitePoint[3];
+ float m_BlackPoint[3];
+ float m_Gamma;
};
class CPDF_CalRGB : public CPDF_ColorSpace {
public:
explicit CPDF_CalRGB(CPDF_Document* pDoc);
+ ~CPDF_CalRGB() override {}
bool v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override;
- bool GetRGB(FX_FLOAT* pBuf,
- FX_FLOAT& R,
- FX_FLOAT& G,
- FX_FLOAT& B) const override;
- bool SetRGB(FX_FLOAT* pBuf,
- FX_FLOAT R,
- FX_FLOAT G,
- FX_FLOAT B) const override;
+ bool GetRGB(float* pBuf, float* R, float* G, float* B) const override;
+ bool SetRGB(float* pBuf, float R, float G, float B) const override;
void TranslateImageLine(uint8_t* pDestBuf,
const uint8_t* pSrcBuf,
int pixels,
int image_width,
int image_height,
- bool bTransMask = false) const override;
+ bool bTransMask) const override;
- FX_FLOAT m_WhitePoint[3];
- FX_FLOAT m_BlackPoint[3];
- FX_FLOAT m_Gamma[3];
- FX_FLOAT m_Matrix[9];
+ float m_WhitePoint[3];
+ float m_BlackPoint[3];
+ float m_Gamma[3];
+ float m_Matrix[9];
bool m_bGamma;
bool m_bMatrix;
};
@@ -120,32 +112,26 @@ class CPDF_CalRGB : public CPDF_ColorSpace {
class CPDF_LabCS : public CPDF_ColorSpace {
public:
explicit CPDF_LabCS(CPDF_Document* pDoc);
+ ~CPDF_LabCS() override {}
bool v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override;
void GetDefaultValue(int iComponent,
- FX_FLOAT& value,
- FX_FLOAT& min,
- FX_FLOAT& max) const override;
- bool GetRGB(FX_FLOAT* pBuf,
- FX_FLOAT& R,
- FX_FLOAT& G,
- FX_FLOAT& B) const override;
- bool SetRGB(FX_FLOAT* pBuf,
- FX_FLOAT R,
- FX_FLOAT G,
- FX_FLOAT B) const override;
+ float* value,
+ float* min,
+ float* max) const override;
+ bool GetRGB(float* pBuf, float* R, float* G, float* B) const override;
void TranslateImageLine(uint8_t* pDestBuf,
const uint8_t* pSrcBuf,
int pixels,
int image_width,
int image_height,
- bool bTransMask = false) const override;
+ bool bTransMask) const override;
- FX_FLOAT m_WhitePoint[3];
- FX_FLOAT m_BlackPoint[3];
- FX_FLOAT m_Ranges[4];
+ float m_WhitePoint[3];
+ float m_BlackPoint[3];
+ float m_Ranges[4];
};
class CPDF_ICCBasedCS : public CPDF_ColorSpace {
@@ -153,35 +139,36 @@ class CPDF_ICCBasedCS : public CPDF_ColorSpace {
explicit CPDF_ICCBasedCS(CPDF_Document* pDoc);
~CPDF_ICCBasedCS() override;
+ // CPDF_ColorSpace:
bool v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override;
-
- bool GetRGB(FX_FLOAT* pBuf,
- FX_FLOAT& R,
- FX_FLOAT& G,
- FX_FLOAT& B) const override;
- bool SetRGB(FX_FLOAT* pBuf,
- FX_FLOAT R,
- FX_FLOAT G,
- FX_FLOAT B) const override;
-
- bool v_GetCMYK(FX_FLOAT* pBuf,
- FX_FLOAT& c,
- FX_FLOAT& m,
- FX_FLOAT& y,
- FX_FLOAT& k) const override;
-
+ bool GetRGB(float* pBuf, float* R, float* G, float* B) const override;
+ bool v_GetCMYK(float* pBuf,
+ float* c,
+ float* m,
+ float* y,
+ float* k) const override;
void EnableStdConversion(bool bEnabled) override;
void TranslateImageLine(uint8_t* pDestBuf,
const uint8_t* pSrcBuf,
int pixels,
int image_width,
int image_height,
- bool bTransMask = false) const override;
+ bool bTransMask) const override;
+
+ bool IsSRGB() const { return m_pProfile->IsSRGB(); }
+
+ private:
+ // If no valid ICC profile or using sRGB, try looking for an alternate.
+ bool FindAlternateProfile(CPDF_Document* pDoc, CPDF_Dictionary* pDict);
+
+ void UseStockAlternateProfile();
+ bool IsValidComponents(int32_t nComps) const;
+ void PopulateRanges(CPDF_Dictionary* pDict);
CFX_MaybeOwned<CPDF_ColorSpace> m_pAlterCS;
- CPDF_IccProfile* m_pProfile;
+ CFX_RetainPtr<CPDF_IccProfile> m_pProfile;
uint8_t* m_pCache;
- FX_FLOAT* m_pRanges;
+ float* m_pRanges;
};
class CPDF_IndexedCS : public CPDF_ColorSpace {
@@ -191,10 +178,7 @@ class CPDF_IndexedCS : public CPDF_ColorSpace {
bool v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override;
- bool GetRGB(FX_FLOAT* pBuf,
- FX_FLOAT& R,
- FX_FLOAT& G,
- FX_FLOAT& B) const override;
+ bool GetRGB(float* pBuf, float* R, float* G, float* B) const override;
CPDF_ColorSpace* GetBaseCS() const override;
void EnableStdConversion(bool bEnabled) override;
@@ -204,7 +188,7 @@ class CPDF_IndexedCS : public CPDF_ColorSpace {
int m_nBaseComponents;
int m_MaxIndex;
CFX_ByteString m_Table;
- FX_FLOAT* m_pCompMinMax;
+ float* m_pCompMinMax;
};
class CPDF_SeparationCS : public CPDF_ColorSpace {
@@ -214,14 +198,11 @@ class CPDF_SeparationCS : public CPDF_ColorSpace {
// CPDF_ColorSpace:
void GetDefaultValue(int iComponent,
- FX_FLOAT& value,
- FX_FLOAT& min,
- FX_FLOAT& max) const override;
+ float* value,
+ float* min,
+ float* max) const override;
bool v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override;
- bool GetRGB(FX_FLOAT* pBuf,
- FX_FLOAT& R,
- FX_FLOAT& G,
- FX_FLOAT& B) const override;
+ bool GetRGB(float* pBuf, float* R, float* G, float* B) const override;
void EnableStdConversion(bool bEnabled) override;
std::unique_ptr<CPDF_ColorSpace> m_pAltCS;
@@ -236,80 +217,134 @@ class CPDF_DeviceNCS : public CPDF_ColorSpace {
// CPDF_ColorSpace:
void GetDefaultValue(int iComponent,
- FX_FLOAT& value,
- FX_FLOAT& min,
- FX_FLOAT& max) const override;
+ float* value,
+ float* min,
+ float* max) const override;
bool v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override;
- bool GetRGB(FX_FLOAT* pBuf,
- FX_FLOAT& R,
- FX_FLOAT& G,
- FX_FLOAT& B) const override;
+ bool GetRGB(float* pBuf, float* R, float* G, float* B) const override;
void EnableStdConversion(bool bEnabled) override;
std::unique_ptr<CPDF_ColorSpace> m_pAltCS;
std::unique_ptr<CPDF_Function> m_pFunc;
};
-FX_FLOAT RGB_Conversion(FX_FLOAT colorComponent) {
- if (colorComponent > 1)
- colorComponent = 1;
- if (colorComponent < 0)
- colorComponent = 0;
+class Vector_3by1 {
+ public:
+ Vector_3by1() : a(0.0f), b(0.0f), c(0.0f) {}
+
+ Vector_3by1(float a1, float b1, float c1) : a(a1), b(b1), c(c1) {}
+
+ float a;
+ float b;
+ float c;
+};
+
+class Matrix_3by3 {
+ public:
+ Matrix_3by3()
+ : a(0.0f),
+ b(0.0f),
+ c(0.0f),
+ d(0.0f),
+ e(0.0f),
+ f(0.0f),
+ g(0.0f),
+ h(0.0f),
+ i(0.0f) {}
+
+ Matrix_3by3(float a1,
+ float b1,
+ float c1,
+ float d1,
+ float e1,
+ float f1,
+ float g1,
+ float h1,
+ float i1)
+ : a(a1), b(b1), c(c1), d(d1), e(e1), f(f1), g(g1), h(h1), i(i1) {}
+
+ Matrix_3by3 Inverse() {
+ float det = a * (e * i - f * h) - b * (i * d - f * g) + c * (d * h - e * g);
+ if (fabs(det) < std::numeric_limits<float>::epsilon())
+ return Matrix_3by3();
+
+ return Matrix_3by3(
+ (e * i - f * h) / det, -(b * i - c * h) / det, (b * f - c * e) / det,
+ -(d * i - f * g) / det, (a * i - c * g) / det, -(a * f - c * d) / det,
+ (d * h - e * g) / det, -(a * h - b * g) / det, (a * e - b * d) / det);
+ }
+
+ Matrix_3by3 Multiply(const Matrix_3by3& m) {
+ return Matrix_3by3(a * m.a + b * m.d + c * m.g, a * m.b + b * m.e + c * m.h,
+ a * m.c + b * m.f + c * m.i, d * m.a + e * m.d + f * m.g,
+ d * m.b + e * m.e + f * m.h, d * m.c + e * m.f + f * m.i,
+ g * m.a + h * m.d + i * m.g, g * m.b + h * m.e + i * m.h,
+ g * m.c + h * m.f + i * m.i);
+ }
+
+ Vector_3by1 TransformVector(const Vector_3by1& v) {
+ return Vector_3by1(a * v.a + b * v.b + c * v.c, d * v.a + e * v.b + f * v.c,
+ g * v.a + h * v.b + i * v.c);
+ }
+
+ float a;
+ float b;
+ float c;
+ float d;
+ float e;
+ float f;
+ float g;
+ float h;
+ float i;
+};
- int scale = (int)(colorComponent * 1023);
- if (scale < 0)
- scale = 0;
+float RGB_Conversion(float colorComponent) {
+ colorComponent = pdfium::clamp(colorComponent, 0.0f, 1.0f);
+ int scale = std::max(static_cast<int>(colorComponent * 1023), 0);
if (scale < 192)
- colorComponent = (g_sRGBSamples1[scale] / 255.0f);
- else
- colorComponent = (g_sRGBSamples2[scale / 4 - 48] / 255.0f);
- return colorComponent;
+ return g_sRGBSamples1[scale] / 255.0f;
+ return g_sRGBSamples2[scale / 4 - 48] / 255.0f;
}
-void XYZ_to_sRGB(FX_FLOAT X,
- FX_FLOAT Y,
- FX_FLOAT Z,
- FX_FLOAT& R,
- FX_FLOAT& G,
- FX_FLOAT& B) {
- FX_FLOAT R1 = 3.2410f * X - 1.5374f * Y - 0.4986f * Z;
- FX_FLOAT G1 = -0.9692f * X + 1.8760f * Y + 0.0416f * Z;
- FX_FLOAT B1 = 0.0556f * X - 0.2040f * Y + 1.0570f * Z;
-
- R = RGB_Conversion(R1);
- G = RGB_Conversion(G1);
- B = RGB_Conversion(B1);
+void XYZ_to_sRGB(float X, float Y, float Z, float* R, float* G, float* B) {
+ float R1 = 3.2410f * X - 1.5374f * Y - 0.4986f * Z;
+ float G1 = -0.9692f * X + 1.8760f * Y + 0.0416f * Z;
+ float B1 = 0.0556f * X - 0.2040f * Y + 1.0570f * Z;
+
+ *R = RGB_Conversion(R1);
+ *G = RGB_Conversion(G1);
+ *B = RGB_Conversion(B1);
}
-void XYZ_to_sRGB_WhitePoint(FX_FLOAT X,
- FX_FLOAT Y,
- FX_FLOAT Z,
- FX_FLOAT& R,
- FX_FLOAT& G,
- FX_FLOAT& B,
- FX_FLOAT Xw,
- FX_FLOAT Yw,
- FX_FLOAT Zw) {
+void XYZ_to_sRGB_WhitePoint(float X,
+ float Y,
+ float Z,
+ float Xw,
+ float Yw,
+ float Zw,
+ float* R,
+ float* G,
+ float* B) {
// The following RGB_xyz is based on
// sRGB value {Rx,Ry}={0.64, 0.33}, {Gx,Gy}={0.30, 0.60}, {Bx,By}={0.15, 0.06}
- FX_FLOAT Rx = 0.64f, Ry = 0.33f;
- FX_FLOAT Gx = 0.30f, Gy = 0.60f;
- FX_FLOAT Bx = 0.15f, By = 0.06f;
- CFX_Matrix_3by3 RGB_xyz(Rx, Gx, Bx, Ry, Gy, By, 1 - Rx - Ry, 1 - Gx - Gy,
- 1 - Bx - By);
- CFX_Vector_3by1 whitePoint(Xw, Yw, Zw);
- CFX_Vector_3by1 XYZ(X, Y, Z);
-
- CFX_Vector_3by1 RGB_Sum_XYZ = RGB_xyz.Inverse().TransformVector(whitePoint);
- CFX_Matrix_3by3 RGB_SUM_XYZ_DIAG(RGB_Sum_XYZ.a, 0, 0, 0, RGB_Sum_XYZ.b, 0, 0,
- 0, RGB_Sum_XYZ.c);
- CFX_Matrix_3by3 M = RGB_xyz.Multiply(RGB_SUM_XYZ_DIAG);
- CFX_Vector_3by1 RGB = M.Inverse().TransformVector(XYZ);
-
- R = RGB_Conversion(RGB.a);
- G = RGB_Conversion(RGB.b);
- B = RGB_Conversion(RGB.c);
+ float Rx = 0.64f, Ry = 0.33f;
+ float Gx = 0.30f, Gy = 0.60f;
+ float Bx = 0.15f, By = 0.06f;
+ Matrix_3by3 RGB_xyz(Rx, Gx, Bx, Ry, Gy, By, 1 - Rx - Ry, 1 - Gx - Gy,
+ 1 - Bx - By);
+ Vector_3by1 whitePoint(Xw, Yw, Zw);
+ Vector_3by1 XYZ(X, Y, Z);
+
+ Vector_3by1 RGB_Sum_XYZ = RGB_xyz.Inverse().TransformVector(whitePoint);
+ Matrix_3by3 RGB_SUM_XYZ_DIAG(RGB_Sum_XYZ.a, 0, 0, 0, RGB_Sum_XYZ.b, 0, 0, 0,
+ RGB_Sum_XYZ.c);
+ Matrix_3by3 M = RGB_xyz.Multiply(RGB_SUM_XYZ_DIAG);
+ Vector_3by1 RGB = M.Inverse().TransformVector(XYZ);
+
+ *R = RGB_Conversion(RGB.a);
+ *G = RGB_Conversion(RGB.b);
+ *B = RGB_Conversion(RGB.c);
}
} // namespace
@@ -369,26 +404,34 @@ std::unique_ptr<CPDF_ColorSpace> CPDF_ColorSpace::Load(CPDF_Document* pDoc,
return std::unique_ptr<CPDF_ColorSpace>(ColorspaceFromName(familyname));
std::unique_ptr<CPDF_ColorSpace> pCS;
- uint32_t id = familyname.GetID();
- if (id == FXBSTR_ID('C', 'a', 'l', 'G')) {
- pCS.reset(new CPDF_CalGray(pDoc));
- } else if (id == FXBSTR_ID('C', 'a', 'l', 'R')) {
- pCS.reset(new CPDF_CalRGB(pDoc));
- } else if (id == FXBSTR_ID('L', 'a', 'b', 0)) {
- pCS.reset(new CPDF_LabCS(pDoc));
- } else if (id == FXBSTR_ID('I', 'C', 'C', 'B')) {
- pCS.reset(new CPDF_ICCBasedCS(pDoc));
- } else if (id == FXBSTR_ID('I', 'n', 'd', 'e') ||
- id == FXBSTR_ID('I', 0, 0, 0)) {
- pCS.reset(new CPDF_IndexedCS(pDoc));
- } else if (id == FXBSTR_ID('S', 'e', 'p', 'a')) {
- pCS.reset(new CPDF_SeparationCS(pDoc));
- } else if (id == FXBSTR_ID('D', 'e', 'v', 'i')) {
- pCS.reset(new CPDF_DeviceNCS(pDoc));
- } else if (id == FXBSTR_ID('P', 'a', 't', 't')) {
- pCS.reset(new CPDF_PatternCS(pDoc));
- } else {
- return nullptr;
+ switch (familyname.GetID()) {
+ case FXBSTR_ID('C', 'a', 'l', 'G'):
+ pCS.reset(new CPDF_CalGray(pDoc));
+ break;
+ case FXBSTR_ID('C', 'a', 'l', 'R'):
+ pCS.reset(new CPDF_CalRGB(pDoc));
+ break;
+ case FXBSTR_ID('L', 'a', 'b', 0):
+ pCS.reset(new CPDF_LabCS(pDoc));
+ break;
+ case FXBSTR_ID('I', 'C', 'C', 'B'):
+ pCS.reset(new CPDF_ICCBasedCS(pDoc));
+ break;
+ case FXBSTR_ID('I', 'n', 'd', 'e'):
+ case FXBSTR_ID('I', 0, 0, 0):
+ pCS.reset(new CPDF_IndexedCS(pDoc));
+ break;
+ case FXBSTR_ID('S', 'e', 'p', 'a'):
+ pCS.reset(new CPDF_SeparationCS(pDoc));
+ break;
+ case FXBSTR_ID('D', 'e', 'v', 'i'):
+ pCS.reset(new CPDF_DeviceNCS(pDoc));
+ break;
+ case FXBSTR_ID('P', 'a', 't', 't'):
+ pCS.reset(new CPDF_PatternCS(pDoc));
+ break;
+ default:
+ return nullptr;
}
pCS->m_pArray = pArray;
if (!pCS->v_Load(pDoc, pArray))
@@ -411,70 +454,71 @@ int CPDF_ColorSpace::GetBufSize() const {
if (m_Family == PDFCS_PATTERN) {
return sizeof(PatternValue);
}
- return m_nComponents * sizeof(FX_FLOAT);
+ return m_nComponents * sizeof(float);
}
-FX_FLOAT* CPDF_ColorSpace::CreateBuf() {
+float* CPDF_ColorSpace::CreateBuf() {
int size = GetBufSize();
uint8_t* pBuf = FX_Alloc(uint8_t, size);
- return (FX_FLOAT*)pBuf;
+ return (float*)pBuf;
}
bool CPDF_ColorSpace::sRGB() const {
- if (m_Family == PDFCS_DEVICERGB) {
+ if (m_Family == PDFCS_DEVICERGB)
return true;
- }
- if (m_Family != PDFCS_ICCBASED) {
+
+ if (m_Family != PDFCS_ICCBASED)
return false;
- }
- CPDF_ICCBasedCS* pCS = (CPDF_ICCBasedCS*)this;
- return pCS->m_pProfile->m_bsRGB;
+
+ const CPDF_ICCBasedCS* pCS = static_cast<const CPDF_ICCBasedCS*>(this);
+ return pCS->IsSRGB();
}
-bool CPDF_ColorSpace::SetRGB(FX_FLOAT* pBuf,
- FX_FLOAT R,
- FX_FLOAT G,
- FX_FLOAT B) const {
+bool CPDF_ColorSpace::SetRGB(float* pBuf, float R, float G, float B) const {
return false;
}
-bool CPDF_ColorSpace::GetCMYK(FX_FLOAT* pBuf,
- FX_FLOAT& c,
- FX_FLOAT& m,
- FX_FLOAT& y,
- FX_FLOAT& k) const {
- if (v_GetCMYK(pBuf, c, m, y, k)) {
+bool CPDF_ColorSpace::GetCMYK(float* pBuf,
+ float* c,
+ float* m,
+ float* y,
+ float* k) const {
+ if (v_GetCMYK(pBuf, c, m, y, k))
return true;
- }
- FX_FLOAT R, G, B;
- if (!GetRGB(pBuf, R, G, B)) {
+
+ float R;
+ float G;
+ float B;
+ if (!GetRGB(pBuf, &R, &G, &B))
return false;
- }
- sRGB_to_AdobeCMYK(R, G, B, c, m, y, k);
+
+ sRGB_to_AdobeCMYK(R, G, B, *c, *m, *y, *k);
return true;
}
-bool CPDF_ColorSpace::SetCMYK(FX_FLOAT* pBuf,
- FX_FLOAT c,
- FX_FLOAT m,
- FX_FLOAT y,
- FX_FLOAT k) const {
- if (v_SetCMYK(pBuf, c, m, y, k)) {
+bool CPDF_ColorSpace::SetCMYK(float* pBuf,
+ float c,
+ float m,
+ float y,
+ float k) const {
+ if (v_SetCMYK(pBuf, c, m, y, k))
return true;
- }
- FX_FLOAT R, G, B;
+
+ float R;
+ float G;
+ float B;
AdobeCMYK_to_sRGB(c, m, y, k, R, G, B);
return SetRGB(pBuf, R, G, B);
}
-void CPDF_ColorSpace::GetDefaultColor(FX_FLOAT* buf) const {
- if (!buf || m_Family == PDFCS_PATTERN) {
+void CPDF_ColorSpace::GetDefaultColor(float* buf) const {
+ if (!buf || m_Family == PDFCS_PATTERN)
return;
- }
- FX_FLOAT min, max;
- for (uint32_t i = 0; i < m_nComponents; i++) {
- GetDefaultValue(i, buf[i], min, max);
- }
+
+ float min;
+ float max;
+ for (uint32_t i = 0; i < m_nComponents; i++)
+ GetDefaultValue(i, &buf[i], &min, &max);
}
uint32_t CPDF_ColorSpace::CountComponents() const {
@@ -482,12 +526,12 @@ uint32_t CPDF_ColorSpace::CountComponents() const {
}
void CPDF_ColorSpace::GetDefaultValue(int iComponent,
- FX_FLOAT& value,
- FX_FLOAT& min,
- FX_FLOAT& max) const {
- value = 0;
- min = 0;
- max = 1.0f;
+ float* value,
+ float* min,
+ float* max) const {
+ *value = 0.0f;
+ *min = 0.0f;
+ *max = 1.0f;
}
void CPDF_ColorSpace::TranslateImageLine(uint8_t* dest_buf,
@@ -496,20 +540,19 @@ void CPDF_ColorSpace::TranslateImageLine(uint8_t* dest_buf,
int image_width,
int image_height,
bool bTransMask) const {
- CFX_FixedBufGrow<FX_FLOAT, 16> srcbuf(m_nComponents);
- FX_FLOAT* src = srcbuf;
- FX_FLOAT R, G, B;
+ CFX_FixedBufGrow<float, 16> srcbuf(m_nComponents);
+ float* src = srcbuf;
+ float R;
+ float G;
+ float B;
+ const int divisor = m_Family != PDFCS_INDEXED ? 255 : 1;
for (int i = 0; i < pixels; i++) {
for (uint32_t j = 0; j < m_nComponents; j++)
- if (m_Family == PDFCS_INDEXED) {
- src[j] = (FX_FLOAT)(*src_buf++);
- } else {
- src[j] = (FX_FLOAT)(*src_buf++) / 255;
- }
- GetRGB(src, R, G, B);
- *dest_buf++ = (int32_t)(B * 255);
- *dest_buf++ = (int32_t)(G * 255);
- *dest_buf++ = (int32_t)(R * 255);
+ src[j] = static_cast<float>(*src_buf++) / divisor;
+ GetRGB(src, &R, &G, &B);
+ *dest_buf++ = static_cast<int32_t>(B * 255);
+ *dest_buf++ = static_cast<int32_t>(G * 255);
+ *dest_buf++ = static_cast<int32_t>(R * 255);
}
}
@@ -539,19 +582,19 @@ bool CPDF_ColorSpace::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) {
return true;
}
-bool CPDF_ColorSpace::v_GetCMYK(FX_FLOAT* pBuf,
- FX_FLOAT& c,
- FX_FLOAT& m,
- FX_FLOAT& y,
- FX_FLOAT& k) const {
+bool CPDF_ColorSpace::v_GetCMYK(float* pBuf,
+ float* c,
+ float* m,
+ float* y,
+ float* k) const {
return false;
}
-bool CPDF_ColorSpace::v_SetCMYK(FX_FLOAT* pBuf,
- FX_FLOAT c,
- FX_FLOAT m,
- FX_FLOAT y,
- FX_FLOAT k) const {
+bool CPDF_ColorSpace::v_SetCMYK(float* pBuf,
+ float c,
+ float m,
+ float y,
+ float k) const {
return false;
}
@@ -578,18 +621,14 @@ bool CPDF_CalGray::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) {
return true;
}
-bool CPDF_CalGray::GetRGB(FX_FLOAT* pBuf,
- FX_FLOAT& R,
- FX_FLOAT& G,
- FX_FLOAT& B) const {
- R = G = B = *pBuf;
+bool CPDF_CalGray::GetRGB(float* pBuf, float* R, float* G, float* B) const {
+ *R = *pBuf;
+ *G = *pBuf;
+ *B = *pBuf;
return true;
}
-bool CPDF_CalGray::SetRGB(FX_FLOAT* pBuf,
- FX_FLOAT R,
- FX_FLOAT G,
- FX_FLOAT B) const {
+bool CPDF_CalGray::SetRGB(float* pBuf, float R, float G, float B) const {
if (R == G && R == B) {
*pBuf = R;
return true;
@@ -647,22 +686,19 @@ bool CPDF_CalRGB::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) {
return true;
}
-bool CPDF_CalRGB::GetRGB(FX_FLOAT* pBuf,
- FX_FLOAT& R,
- FX_FLOAT& G,
- FX_FLOAT& B) const {
- FX_FLOAT A_ = pBuf[0];
- FX_FLOAT B_ = pBuf[1];
- FX_FLOAT C_ = pBuf[2];
+bool CPDF_CalRGB::GetRGB(float* pBuf, float* R, float* G, float* B) const {
+ float A_ = pBuf[0];
+ float B_ = pBuf[1];
+ float C_ = pBuf[2];
if (m_bGamma) {
- A_ = (FX_FLOAT)FXSYS_pow(A_, m_Gamma[0]);
- B_ = (FX_FLOAT)FXSYS_pow(B_, m_Gamma[1]);
- C_ = (FX_FLOAT)FXSYS_pow(C_, m_Gamma[2]);
+ A_ = (float)FXSYS_pow(A_, m_Gamma[0]);
+ B_ = (float)FXSYS_pow(B_, m_Gamma[1]);
+ C_ = (float)FXSYS_pow(C_, m_Gamma[2]);
}
- FX_FLOAT X;
- FX_FLOAT Y;
- FX_FLOAT Z;
+ float X;
+ float Y;
+ float Z;
if (m_bMatrix) {
X = m_Matrix[0] * A_ + m_Matrix[3] * B_ + m_Matrix[6] * C_;
Y = m_Matrix[1] * A_ + m_Matrix[4] * B_ + m_Matrix[7] * C_;
@@ -672,15 +708,12 @@ bool CPDF_CalRGB::GetRGB(FX_FLOAT* pBuf,
Y = B_;
Z = C_;
}
- XYZ_to_sRGB_WhitePoint(X, Y, Z, R, G, B, m_WhitePoint[0], m_WhitePoint[1],
- m_WhitePoint[2]);
+ XYZ_to_sRGB_WhitePoint(X, Y, Z, m_WhitePoint[0], m_WhitePoint[1],
+ m_WhitePoint[2], R, G, B);
return true;
}
-bool CPDF_CalRGB::SetRGB(FX_FLOAT* pBuf,
- FX_FLOAT R,
- FX_FLOAT G,
- FX_FLOAT B) const {
+bool CPDF_CalRGB::SetRGB(float* pBuf, float R, float G, float B) const {
pBuf[0] = R;
pBuf[1] = G;
pBuf[2] = B;
@@ -694,15 +727,15 @@ void CPDF_CalRGB::TranslateImageLine(uint8_t* pDestBuf,
int image_height,
bool bTransMask) const {
if (bTransMask) {
- FX_FLOAT Cal[3];
- FX_FLOAT R;
- FX_FLOAT G;
- FX_FLOAT B;
+ float Cal[3];
+ float R;
+ float G;
+ float B;
for (int i = 0; i < pixels; i++) {
- Cal[0] = ((FX_FLOAT)pSrcBuf[2]) / 255;
- Cal[1] = ((FX_FLOAT)pSrcBuf[1]) / 255;
- Cal[2] = ((FX_FLOAT)pSrcBuf[0]) / 255;
- GetRGB(Cal, R, G, B);
+ Cal[0] = static_cast<float>(pSrcBuf[2]) / 255;
+ Cal[1] = static_cast<float>(pSrcBuf[1]) / 255;
+ Cal[2] = static_cast<float>(pSrcBuf[0]) / 255;
+ GetRGB(Cal, &R, &G, &B);
pDestBuf[0] = FXSYS_round(B * 255);
pDestBuf[1] = FXSYS_round(G * 255);
pDestBuf[2] = FXSYS_round(R * 255);
@@ -717,22 +750,20 @@ CPDF_LabCS::CPDF_LabCS(CPDF_Document* pDoc)
: CPDF_ColorSpace(pDoc, PDFCS_LAB, 3) {}
void CPDF_LabCS::GetDefaultValue(int iComponent,
- FX_FLOAT& value,
- FX_FLOAT& min,
- FX_FLOAT& max) const {
+ float* value,
+ float* min,
+ float* max) const {
ASSERT(iComponent < 3);
- value = 0;
if (iComponent == 0) {
- min = 0;
- max = 100 * 1.0f;
- } else {
- min = m_Ranges[iComponent * 2 - 2];
- max = m_Ranges[iComponent * 2 - 1];
- if (value < min)
- value = min;
- else if (value > max)
- value = max;
+ *min = 0.0f;
+ *max = 100 * 1.0f;
+ *value = 0.0f;
+ return;
}
+
+ *min = m_Ranges[iComponent * 2 - 2];
+ *max = m_Ranges[iComponent * 2 - 1];
+ *value = pdfium::clamp(0.0f, *min, *max);
}
bool CPDF_LabCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) {
@@ -750,24 +781,23 @@ bool CPDF_LabCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) {
m_BlackPoint[i] = pParam ? pParam->GetNumberAt(i) : 0;
pParam = pDict->GetArrayFor("Range");
- const FX_FLOAT def_ranges[4] = {-100 * 1.0f, 100 * 1.0f, -100 * 1.0f,
- 100 * 1.0f};
+ const float def_ranges[4] = {-100 * 1.0f, 100 * 1.0f, -100 * 1.0f,
+ 100 * 1.0f};
for (i = 0; i < 4; i++)
m_Ranges[i] = pParam ? pParam->GetNumberAt(i) : def_ranges[i];
return true;
}
-bool CPDF_LabCS::GetRGB(FX_FLOAT* pBuf,
- FX_FLOAT& R,
- FX_FLOAT& G,
- FX_FLOAT& B) const {
- FX_FLOAT Lstar = pBuf[0];
- FX_FLOAT astar = pBuf[1];
- FX_FLOAT bstar = pBuf[2];
- FX_FLOAT M = (Lstar + 16.0f) / 116.0f;
- FX_FLOAT L = M + astar / 500.0f;
- FX_FLOAT N = M - bstar / 200.0f;
- FX_FLOAT X, Y, Z;
+bool CPDF_LabCS::GetRGB(float* pBuf, float* R, float* G, float* B) const {
+ float Lstar = pBuf[0];
+ float astar = pBuf[1];
+ float bstar = pBuf[2];
+ float M = (Lstar + 16.0f) / 116.0f;
+ float L = M + astar / 500.0f;
+ float N = M - bstar / 200.0f;
+ float X;
+ float Y;
+ float Z;
if (L < 0.2069f)
X = 0.957f * 0.12842f * (L - 0.1379f);
else
@@ -787,13 +817,6 @@ bool CPDF_LabCS::GetRGB(FX_FLOAT* pBuf,
return true;
}
-bool CPDF_LabCS::SetRGB(FX_FLOAT* pBuf,
- FX_FLOAT R,
- FX_FLOAT G,
- FX_FLOAT B) const {
- return false;
-}
-
void CPDF_LabCS::TranslateImageLine(uint8_t* pDestBuf,
const uint8_t* pSrcBuf,
int pixels,
@@ -801,15 +824,17 @@ void CPDF_LabCS::TranslateImageLine(uint8_t* pDestBuf,
int image_height,
bool bTransMask) const {
for (int i = 0; i < pixels; i++) {
- FX_FLOAT lab[3];
- FX_FLOAT R, G, B;
+ float lab[3];
+ float R;
+ float G;
+ float B;
lab[0] = (pSrcBuf[0] * 100 / 255.0f);
- lab[1] = (FX_FLOAT)(pSrcBuf[1] - 128);
- lab[2] = (FX_FLOAT)(pSrcBuf[2] - 128);
- GetRGB(lab, R, G, B);
- pDestBuf[0] = (int32_t)(B * 255);
- pDestBuf[1] = (int32_t)(G * 255);
- pDestBuf[2] = (int32_t)(R * 255);
+ lab[1] = (float)(pSrcBuf[1] - 128);
+ lab[2] = (float)(pSrcBuf[2] - 128);
+ GetRGB(lab, &R, &G, &B);
+ pDestBuf[0] = static_cast<int32_t>(B * 255);
+ pDestBuf[1] = static_cast<int32_t>(G * 255);
+ pDestBuf[2] = static_cast<int32_t>(R * 255);
pDestBuf += 3;
pSrcBuf += 3;
}
@@ -824,8 +849,11 @@ CPDF_ICCBasedCS::CPDF_ICCBasedCS(CPDF_Document* pDoc)
CPDF_ICCBasedCS::~CPDF_ICCBasedCS() {
FX_Free(m_pCache);
FX_Free(m_pRanges);
- if (m_pProfile && m_pDocument)
- m_pDocument->GetPageData()->ReleaseIccProfile(m_pProfile);
+ if (m_pProfile && m_pDocument) {
+ CPDF_Stream* pStream = m_pProfile->GetStream();
+ m_pProfile.Reset(); // Give up our reference first.
+ m_pDocument->GetPageData()->MaybePurgeIccProfile(pStream);
+ }
}
bool CPDF_ICCBasedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) {
@@ -833,108 +861,79 @@ bool CPDF_ICCBasedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) {
if (!pStream)
return false;
+ // The PDF 1.7 spec says the number of components must be valid. While some
+ // PDF viewers tolerate invalid values, Acrobat does not, so be consistent
+ // with Acrobat and reject bad values.
+ CPDF_Dictionary* pDict = pStream->GetDict();
+ int32_t nDictComponents = pDict ? pDict->GetIntegerFor("N") : 0;
+ if (!IsValidComponents(nDictComponents))
+ return false;
+
+ m_nComponents = nDictComponents;
m_pProfile = pDoc->LoadIccProfile(pStream);
if (!m_pProfile)
return false;
- // Try using the |nComponents| from ICC profile
- m_nComponents = m_pProfile->GetComponents();
- CPDF_Dictionary* pDict = pStream->GetDict();
- if (!m_pProfile->m_pTransform) { // No valid ICC profile or using sRGB
- CPDF_Object* pAlterCSObj =
- pDict ? pDict->GetDirectObjectFor("Alternate") : nullptr;
- if (pAlterCSObj) {
- std::unique_ptr<CPDF_ColorSpace> pAlterCS =
- CPDF_ColorSpace::Load(pDoc, pAlterCSObj);
- if (pAlterCS) {
- if (m_nComponents == 0) { // NO valid ICC profile
- if (pAlterCS->CountComponents() > 0) { // Use Alternative colorspace
- m_nComponents = pAlterCS->CountComponents();
- m_pAlterCS = std::move(pAlterCS);
- } else { // No valid alternative colorspace
- int32_t nDictComponents = pDict ? pDict->GetIntegerFor("N") : 0;
- if (nDictComponents != 1 && nDictComponents != 3 &&
- nDictComponents != 4) {
- return false;
- }
- m_nComponents = nDictComponents;
- }
- } else { // Using sRGB
- if (pAlterCS->CountComponents() == m_nComponents)
- m_pAlterCS = std::move(pAlterCS);
- }
- }
- }
- if (!m_pAlterCS) {
- if (m_nComponents == 1)
- m_pAlterCS = GetStockCS(PDFCS_DEVICEGRAY);
- else if (m_nComponents == 3)
- m_pAlterCS = GetStockCS(PDFCS_DEVICERGB);
- else if (m_nComponents == 4)
- m_pAlterCS = GetStockCS(PDFCS_DEVICECMYK);
- }
- }
- CPDF_Array* pRanges = pDict->GetArrayFor("Range");
- m_pRanges = FX_Alloc2D(FX_FLOAT, m_nComponents, 2);
- for (uint32_t i = 0; i < m_nComponents * 2; i++) {
- if (pRanges)
- m_pRanges[i] = pRanges->GetNumberAt(i);
- else if (i % 2)
- m_pRanges[i] = 1.0f;
- else
- m_pRanges[i] = 0;
+ // The PDF 1.7 spec also says the number of components in the ICC profile
+ // must match the N value. However, that assumes the viewer actually
+ // understands the ICC profile.
+ // If the valid ICC profile has a mismatch, fail.
+ if (m_pProfile->IsValid() && m_pProfile->GetComponents() != m_nComponents)
+ return false;
+
+ // If PDFium does not understand the ICC profile format at all, or if it's
+ // SRGB, a profile PDFium recognizes but does not support well, then try the
+ // alternate profile.
+ if (!m_pProfile->IsSupported() && !FindAlternateProfile(pDoc, pDict)) {
+ // If there is no alternate profile, use a stock profile as mentioned in
+ // the PDF 1.7 spec in table 4.16 in the "Alternate" key description.
+ UseStockAlternateProfile();
}
+
+ PopulateRanges(pDict);
return true;
}
-bool CPDF_ICCBasedCS::GetRGB(FX_FLOAT* pBuf,
- FX_FLOAT& R,
- FX_FLOAT& G,
- FX_FLOAT& B) const {
- if (m_pProfile && m_pProfile->m_bsRGB) {
- R = pBuf[0];
- G = pBuf[1];
- B = pBuf[2];
+bool CPDF_ICCBasedCS::GetRGB(float* pBuf, float* R, float* G, float* B) const {
+ ASSERT(m_pProfile);
+ if (IsSRGB()) {
+ *R = pBuf[0];
+ *G = pBuf[1];
+ *B = pBuf[2];
return true;
}
- CCodec_IccModule* pIccModule = CPDF_ModuleMgr::Get()->GetIccModule();
- if (!m_pProfile->m_pTransform || !pIccModule) {
- if (m_pAlterCS)
- return m_pAlterCS->GetRGB(pBuf, R, G, B);
-
- R = 0.0f;
- G = 0.0f;
- B = 0.0f;
+ if (m_pProfile->transform()) {
+ float rgb[3];
+ CCodec_IccModule* pIccModule = CPDF_ModuleMgr::Get()->GetIccModule();
+ pIccModule->SetComponents(m_nComponents);
+ pIccModule->Translate(m_pProfile->transform(), pBuf, rgb);
+ *R = rgb[0];
+ *G = rgb[1];
+ *B = rgb[2];
return true;
}
- FX_FLOAT rgb[3];
- pIccModule->SetComponents(m_nComponents);
- pIccModule->Translate(m_pProfile->m_pTransform, pBuf, rgb);
- R = rgb[0];
- G = rgb[1];
- B = rgb[2];
- return true;
-}
-bool CPDF_ICCBasedCS::SetRGB(FX_FLOAT* pBuf,
- FX_FLOAT R,
- FX_FLOAT G,
- FX_FLOAT B) const {
- return false;
+ if (m_pAlterCS)
+ return m_pAlterCS->GetRGB(pBuf, R, G, B);
+
+ *R = 0.0f;
+ *G = 0.0f;
+ *B = 0.0f;
+ return true;
}
-bool CPDF_ICCBasedCS::v_GetCMYK(FX_FLOAT* pBuf,
- FX_FLOAT& c,
- FX_FLOAT& m,
- FX_FLOAT& y,
- FX_FLOAT& k) const {
+bool CPDF_ICCBasedCS::v_GetCMYK(float* pBuf,
+ float* c,
+ float* m,
+ float* y,
+ float* k) const {
if (m_nComponents != 4)
return false;
- c = pBuf[0];
- m = pBuf[1];
- y = pBuf[2];
- k = pBuf[3];
+ *c = pBuf[0];
+ *m = pBuf[1];
+ *y = pBuf[2];
+ *k = pBuf[3];
return true;
}
@@ -950,16 +949,16 @@ void CPDF_ICCBasedCS::TranslateImageLine(uint8_t* pDestBuf,
int image_width,
int image_height,
bool bTransMask) const {
- if (m_pProfile->m_bsRGB) {
+ if (IsSRGB()) {
ReverseRGB(pDestBuf, pSrcBuf, pixels);
- } else if (m_pProfile->m_pTransform) {
+ } else if (m_pProfile->transform()) {
int nMaxColors = 1;
for (uint32_t i = 0; i < m_nComponents; i++) {
nMaxColors *= 52;
}
if (m_nComponents > 3 || image_width * image_height < nMaxColors * 3 / 2) {
CPDF_ModuleMgr::Get()->GetIccModule()->TranslateScanline(
- m_pProfile->m_pTransform, pDestBuf, pSrcBuf, pixels);
+ m_pProfile->transform(), pDestBuf, pSrcBuf, pixels);
} else {
if (!m_pCache) {
((CPDF_ICCBasedCS*)this)->m_pCache = FX_Alloc2D(uint8_t, nMaxColors, 3);
@@ -975,7 +974,7 @@ void CPDF_ICCBasedCS::TranslateImageLine(uint8_t* pDestBuf,
}
}
CPDF_ModuleMgr::Get()->GetIccModule()->TranslateScanline(
- m_pProfile->m_pTransform, m_pCache, temp_src, nMaxColors);
+ m_pProfile->transform(), m_pCache, temp_src, nMaxColors);
FX_Free(temp_src);
}
for (int i = 0; i < pixels; i++) {
@@ -992,7 +991,51 @@ void CPDF_ICCBasedCS::TranslateImageLine(uint8_t* pDestBuf,
}
} else if (m_pAlterCS) {
m_pAlterCS->TranslateImageLine(pDestBuf, pSrcBuf, pixels, image_width,
- image_height);
+ image_height, false);
+ }
+}
+
+bool CPDF_ICCBasedCS::FindAlternateProfile(CPDF_Document* pDoc,
+ CPDF_Dictionary* pDict) {
+ CPDF_Object* pAlterCSObj = pDict->GetDirectObjectFor("Alternate");
+ if (!pAlterCSObj)
+ return false;
+
+ auto pAlterCS = CPDF_ColorSpace::Load(pDoc, pAlterCSObj);
+ if (!pAlterCS)
+ return false;
+
+ if (pAlterCS->CountComponents() != m_nComponents)
+ return false;
+
+ m_pAlterCS = std::move(pAlterCS);
+ return true;
+}
+
+void CPDF_ICCBasedCS::UseStockAlternateProfile() {
+ ASSERT(!m_pAlterCS);
+ if (m_nComponents == 1)
+ m_pAlterCS = GetStockCS(PDFCS_DEVICEGRAY);
+ else if (m_nComponents == 3)
+ m_pAlterCS = GetStockCS(PDFCS_DEVICERGB);
+ else if (m_nComponents == 4)
+ m_pAlterCS = GetStockCS(PDFCS_DEVICECMYK);
+}
+
+bool CPDF_ICCBasedCS::IsValidComponents(int32_t nComps) const {
+ return nComps == 1 || nComps == 3 || nComps == 4;
+}
+
+void CPDF_ICCBasedCS::PopulateRanges(CPDF_Dictionary* pDict) {
+ CPDF_Array* pRanges = pDict->GetArrayFor("Range");
+ m_pRanges = FX_Alloc2D(float, m_nComponents, 2);
+ for (uint32_t i = 0; i < m_nComponents * 2; i++) {
+ if (pRanges)
+ m_pRanges[i] = pRanges->GetNumberAt(i);
+ else if (i % 2)
+ m_pRanges[i] = 1.0f;
+ else
+ m_pRanges[i] = 0.0f;
}
}
@@ -1011,25 +1054,25 @@ CPDF_IndexedCS::~CPDF_IndexedCS() {
}
bool CPDF_IndexedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) {
- if (pArray->GetCount() < 4) {
+ if (pArray->GetCount() < 4)
return false;
- }
+
CPDF_Object* pBaseObj = pArray->GetDirectObjectAt(1);
- if (pBaseObj == m_pArray) {
+ if (pBaseObj == m_pArray)
return false;
- }
+
CPDF_DocPageData* pDocPageData = pDoc->GetPageData();
m_pBaseCS = pDocPageData->GetColorSpace(pBaseObj, nullptr);
- if (!m_pBaseCS) {
+ if (!m_pBaseCS)
return false;
- }
+
m_pCountedBaseCS = pDocPageData->FindColorSpacePtr(m_pBaseCS->GetArray());
m_nBaseComponents = m_pBaseCS->CountComponents();
- m_pCompMinMax = FX_Alloc2D(FX_FLOAT, m_nBaseComponents, 2);
- FX_FLOAT defvalue;
+ m_pCompMinMax = FX_Alloc2D(float, m_nBaseComponents, 2);
+ float defvalue;
for (int i = 0; i < m_nBaseComponents; i++) {
- m_pBaseCS->GetDefaultValue(i, defvalue, m_pCompMinMax[i * 2],
- m_pCompMinMax[i * 2 + 1]);
+ m_pBaseCS->GetDefaultValue(i, &defvalue, &m_pCompMinMax[i * 2],
+ &m_pCompMinMax[i * 2 + 1]);
m_pCompMinMax[i * 2 + 1] -= m_pCompMinMax[i * 2];
}
m_MaxIndex = pArray->GetIntegerAt(2);
@@ -1041,21 +1084,18 @@ bool CPDF_IndexedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) {
if (CPDF_String* pString = pTableObj->AsString()) {
m_Table = pString->GetString();
} else if (CPDF_Stream* pStream = pTableObj->AsStream()) {
- CPDF_StreamAcc acc;
- acc.LoadAllData(pStream, false);
- m_Table = CFX_ByteStringC(acc.GetData(), acc.GetSize());
+ auto pAcc = pdfium::MakeRetain<CPDF_StreamAcc>(pStream);
+ pAcc->LoadAllData(false);
+ m_Table = CFX_ByteStringC(pAcc->GetData(), pAcc->GetSize());
}
return true;
}
-bool CPDF_IndexedCS::GetRGB(FX_FLOAT* pBuf,
- FX_FLOAT& R,
- FX_FLOAT& G,
- FX_FLOAT& B) const {
- int index = (int32_t)(*pBuf);
- if (index < 0 || index > m_MaxIndex) {
+bool CPDF_IndexedCS::GetRGB(float* pBuf, float* R, float* G, float* B) const {
+ int index = static_cast<int32_t>(*pBuf);
+ if (index < 0 || index > m_MaxIndex)
return false;
- }
+
if (m_nBaseComponents) {
if (index == INT_MAX || (index + 1) > INT_MAX / m_nBaseComponents ||
(index + 1) * m_nBaseComponents > (int)m_Table.GetLength()) {
@@ -1063,8 +1103,8 @@ bool CPDF_IndexedCS::GetRGB(FX_FLOAT* pBuf,
return false;
}
}
- CFX_FixedBufGrow<FX_FLOAT, 16> Comps(m_nBaseComponents);
- FX_FLOAT* comps = Comps;
+ CFX_FixedBufGrow<float, 16> Comps(m_nBaseComponents);
+ float* comps = Comps;
const uint8_t* pTable = m_Table.raw_str();
for (int i = 0; i < m_nBaseComponents; i++) {
comps[i] =
@@ -1080,9 +1120,8 @@ CPDF_ColorSpace* CPDF_IndexedCS::GetBaseCS() const {
void CPDF_IndexedCS::EnableStdConversion(bool bEnabled) {
CPDF_ColorSpace::EnableStdConversion(bEnabled);
- if (m_pBaseCS) {
+ if (m_pBaseCS)
m_pBaseCS->EnableStdConversion(bEnabled);
- }
}
CPDF_PatternCS::CPDF_PatternCS(CPDF_Document* pDoc)
@@ -1099,38 +1138,34 @@ CPDF_PatternCS::~CPDF_PatternCS() {
bool CPDF_PatternCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) {
CPDF_Object* pBaseCS = pArray->GetDirectObjectAt(1);
- if (pBaseCS == m_pArray) {
+ if (pBaseCS == m_pArray)
return false;
- }
+
CPDF_DocPageData* pDocPageData = pDoc->GetPageData();
m_pBaseCS = pDocPageData->GetColorSpace(pBaseCS, nullptr);
- if (m_pBaseCS) {
- if (m_pBaseCS->GetFamily() == PDFCS_PATTERN) {
- return false;
- }
- m_pCountedBaseCS = pDocPageData->FindColorSpacePtr(m_pBaseCS->GetArray());
- m_nComponents = m_pBaseCS->CountComponents() + 1;
- if (m_pBaseCS->CountComponents() > MAX_PATTERN_COLORCOMPS) {
- return false;
- }
- } else {
+ if (!m_pBaseCS) {
m_nComponents = 1;
+ return true;
}
- return true;
+
+ if (m_pBaseCS->GetFamily() == PDFCS_PATTERN)
+ return false;
+
+ m_pCountedBaseCS = pDocPageData->FindColorSpacePtr(m_pBaseCS->GetArray());
+ m_nComponents = m_pBaseCS->CountComponents() + 1;
+ return m_pBaseCS->CountComponents() <= MAX_PATTERN_COLORCOMPS;
}
-bool CPDF_PatternCS::GetRGB(FX_FLOAT* pBuf,
- FX_FLOAT& R,
- FX_FLOAT& G,
- FX_FLOAT& B) const {
+bool CPDF_PatternCS::GetRGB(float* pBuf, float* R, float* G, float* B) const {
if (m_pBaseCS) {
ASSERT(m_pBaseCS->GetFamily() != PDFCS_PATTERN);
PatternValue* pvalue = (PatternValue*)pBuf;
- if (m_pBaseCS->GetRGB(pvalue->m_Comps, R, G, B)) {
+ if (m_pBaseCS->GetRGB(pvalue->m_Comps, R, G, B))
return true;
- }
}
- R = G = B = 0.75f;
+ *R = 0.75f;
+ *G = 0.75f;
+ *B = 0.75f;
return false;
}
@@ -1144,12 +1179,12 @@ CPDF_SeparationCS::CPDF_SeparationCS(CPDF_Document* pDoc)
CPDF_SeparationCS::~CPDF_SeparationCS() {}
void CPDF_SeparationCS::GetDefaultValue(int iComponent,
- FX_FLOAT& value,
- FX_FLOAT& min,
- FX_FLOAT& max) const {
- value = 1.0f;
- min = 0;
- max = 1.0f;
+ float* value,
+ float* min,
+ float* max) const {
+ *value = 1.0f;
+ *min = 0;
+ *max = 1.0f;
}
bool CPDF_SeparationCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) {
@@ -1177,10 +1212,10 @@ bool CPDF_SeparationCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) {
return true;
}
-bool CPDF_SeparationCS::GetRGB(FX_FLOAT* pBuf,
- FX_FLOAT& R,
- FX_FLOAT& G,
- FX_FLOAT& B) const {
+bool CPDF_SeparationCS::GetRGB(float* pBuf,
+ float* R,
+ float* G,
+ float* B) const {
if (m_Type == None)
return false;
@@ -1189,15 +1224,15 @@ bool CPDF_SeparationCS::GetRGB(FX_FLOAT* pBuf,
return false;
int nComps = m_pAltCS->CountComponents();
- CFX_FixedBufGrow<FX_FLOAT, 16> results(nComps);
+ CFX_FixedBufGrow<float, 16> results(nComps);
for (int i = 0; i < nComps; i++)
results[i] = *pBuf;
return m_pAltCS->GetRGB(results, R, G, B);
}
- CFX_FixedBufGrow<FX_FLOAT, 16> results(m_pFunc->CountOutputs());
+ CFX_FixedBufGrow<float, 16> results(m_pFunc->CountOutputs());
int nresults = 0;
- m_pFunc->Call(pBuf, 1, results, nresults);
+ m_pFunc->Call(pBuf, 1, results, &nresults);
if (nresults == 0)
return false;
@@ -1222,12 +1257,12 @@ CPDF_DeviceNCS::CPDF_DeviceNCS(CPDF_Document* pDoc)
CPDF_DeviceNCS::~CPDF_DeviceNCS() {}
void CPDF_DeviceNCS::GetDefaultValue(int iComponent,
- FX_FLOAT& value,
- FX_FLOAT& min,
- FX_FLOAT& max) const {
- value = 1.0f;
- min = 0;
- max = 1.0f;
+ float* value,
+ float* min,
+ float* max) const {
+ *value = 1.0f;
+ *min = 0;
+ *max = 1.0f;
}
bool CPDF_DeviceNCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) {
@@ -1248,16 +1283,13 @@ bool CPDF_DeviceNCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) {
return m_pFunc->CountOutputs() >= m_pAltCS->CountComponents();
}
-bool CPDF_DeviceNCS::GetRGB(FX_FLOAT* pBuf,
- FX_FLOAT& R,
- FX_FLOAT& G,
- FX_FLOAT& B) const {
+bool CPDF_DeviceNCS::GetRGB(float* pBuf, float* R, float* G, float* B) const {
if (!m_pFunc)
return false;
- CFX_FixedBufGrow<FX_FLOAT, 16> results(m_pFunc->CountOutputs());
+ CFX_FixedBufGrow<float, 16> results(m_pFunc->CountOutputs());
int nresults = 0;
- m_pFunc->Call(pBuf, m_nComponents, results, nresults);
+ m_pFunc->Call(pBuf, m_nComponents, results, &nresults);
if (nresults == 0)
return false;
diff --git a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_colorspace.h b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_colorspace.h
index c4d62ed8493..76072d12602 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_colorspace.h
+++ b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_colorspace.h
@@ -38,39 +38,28 @@ class CPDF_ColorSpace {
void Release();
int GetBufSize() const;
- FX_FLOAT* CreateBuf();
- void GetDefaultColor(FX_FLOAT* buf) const;
+ float* CreateBuf();
+ void GetDefaultColor(float* buf) const;
uint32_t CountComponents() const;
int GetFamily() const { return m_Family; }
virtual void GetDefaultValue(int iComponent,
- FX_FLOAT& value,
- FX_FLOAT& min,
- FX_FLOAT& max) const;
+ float* value,
+ float* min,
+ float* max) const;
bool sRGB() const;
- virtual bool GetRGB(FX_FLOAT* pBuf,
- FX_FLOAT& R,
- FX_FLOAT& G,
- FX_FLOAT& B) const = 0;
- virtual bool SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) const;
-
- bool GetCMYK(FX_FLOAT* pBuf,
- FX_FLOAT& c,
- FX_FLOAT& m,
- FX_FLOAT& y,
- FX_FLOAT& k) const;
- bool SetCMYK(FX_FLOAT* pBuf,
- FX_FLOAT c,
- FX_FLOAT m,
- FX_FLOAT y,
- FX_FLOAT k) const;
+ virtual bool GetRGB(float* pBuf, float* R, float* G, float* B) const = 0;
+ virtual bool SetRGB(float* pBuf, float R, float G, float B) const;
+
+ bool GetCMYK(float* pBuf, float* c, float* m, float* y, float* k) const;
+ bool SetCMYK(float* pBuf, float c, float m, float y, float k) const;
virtual void TranslateImageLine(uint8_t* dest_buf,
const uint8_t* src_buf,
int pixels,
int image_width,
int image_height,
- bool bTransMask = false) const;
+ bool bTransMask) const;
CPDF_Array*& GetArray() { return m_pArray; }
virtual CPDF_ColorSpace* GetBaseCS() const;
@@ -84,16 +73,12 @@ class CPDF_ColorSpace {
virtual ~CPDF_ColorSpace();
virtual bool v_Load(CPDF_Document* pDoc, CPDF_Array* pArray);
- virtual bool v_GetCMYK(FX_FLOAT* pBuf,
- FX_FLOAT& c,
- FX_FLOAT& m,
- FX_FLOAT& y,
- FX_FLOAT& k) const;
- virtual bool v_SetCMYK(FX_FLOAT* pBuf,
- FX_FLOAT c,
- FX_FLOAT m,
- FX_FLOAT y,
- FX_FLOAT k) const;
+ virtual bool v_GetCMYK(float* pBuf,
+ float* c,
+ float* m,
+ float* y,
+ float* k) const;
+ virtual bool v_SetCMYK(float* pBuf, float c, float m, float y, float k) const;
int m_Family;
uint32_t m_nComponents;
diff --git a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_colorstate.cpp b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_colorstate.cpp
index c43a331c64f..693fcf1a932 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_colorstate.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_colorstate.cpp
@@ -70,42 +70,46 @@ bool CPDF_ColorState::HasStrokeColor() const {
}
void CPDF_ColorState::SetFillColor(CPDF_ColorSpace* pCS,
- FX_FLOAT* pValue,
+ float* pValue,
uint32_t nValues) {
ColorData* pData = m_Ref.GetPrivateCopy();
SetColor(pData->m_FillColor, pData->m_FillRGB, pCS, pValue, nValues);
}
void CPDF_ColorState::SetStrokeColor(CPDF_ColorSpace* pCS,
- FX_FLOAT* pValue,
+ float* pValue,
uint32_t nValues) {
ColorData* pData = m_Ref.GetPrivateCopy();
SetColor(pData->m_StrokeColor, pData->m_StrokeRGB, pCS, pValue, nValues);
}
void CPDF_ColorState::SetFillPattern(CPDF_Pattern* pPattern,
- FX_FLOAT* pValue,
+ float* pValue,
uint32_t nValues) {
ColorData* pData = m_Ref.GetPrivateCopy();
pData->m_FillColor.SetValue(pPattern, pValue, nValues);
- int R, G, B;
- bool ret = pData->m_FillColor.GetRGB(R, G, B);
+ int R;
+ int G;
+ int B;
+ bool ret = pData->m_FillColor.GetRGB(&R, &G, &B);
if (CPDF_TilingPattern* pTilingPattern = pPattern->AsTilingPattern()) {
if (!ret && pTilingPattern->colored()) {
pData->m_FillRGB = 0x00BFBFBF;
return;
}
}
- pData->m_FillRGB = ret ? FXSYS_RGB(R, G, B) : (uint32_t)-1;
+ pData->m_FillRGB = ret ? FXSYS_RGB(R, G, B) : 0xFFFFFFFF;
}
void CPDF_ColorState::SetStrokePattern(CPDF_Pattern* pPattern,
- FX_FLOAT* pValue,
+ float* pValue,
uint32_t nValues) {
ColorData* pData = m_Ref.GetPrivateCopy();
pData->m_StrokeColor.SetValue(pPattern, pValue, nValues);
- int R, G, B;
- bool ret = pData->m_StrokeColor.GetRGB(R, G, B);
+ int R;
+ int G;
+ int B;
+ bool ret = pData->m_StrokeColor.GetRGB(&R, &G, &B);
if (CPDF_TilingPattern* pTilingPattern = pPattern->AsTilingPattern()) {
if (!ret && pTilingPattern->colored()) {
pData->m_StrokeRGB = 0x00BFBFBF;
@@ -113,13 +117,13 @@ void CPDF_ColorState::SetStrokePattern(CPDF_Pattern* pPattern,
}
}
pData->m_StrokeRGB =
- pData->m_StrokeColor.GetRGB(R, G, B) ? FXSYS_RGB(R, G, B) : (uint32_t)-1;
+ pData->m_StrokeColor.GetRGB(&R, &G, &B) ? FXSYS_RGB(R, G, B) : 0xFFFFFFFF;
}
void CPDF_ColorState::SetColor(CPDF_Color& color,
uint32_t& rgb,
CPDF_ColorSpace* pCS,
- FX_FLOAT* pValue,
+ float* pValue,
uint32_t nValues) {
if (pCS)
color.SetColorSpace(pCS);
@@ -133,7 +137,7 @@ void CPDF_ColorState::SetColor(CPDF_Color& color,
int R;
int G;
int B;
- rgb = color.GetRGB(R, G, B) ? FXSYS_RGB(R, G, B) : (uint32_t)-1;
+ rgb = color.GetRGB(&R, &G, &B) ? FXSYS_RGB(R, G, B) : 0xFFFFFFFF;
}
CPDF_ColorState::ColorData::ColorData() : m_FillRGB(0), m_StrokeRGB(0) {}
diff --git a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_colorstate.h b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_colorstate.h
index 49c71b66f90..f66eac3d81e 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_colorstate.h
+++ b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_colorstate.h
@@ -39,14 +39,10 @@ class CPDF_ColorState {
CPDF_Color* GetMutableStrokeColor();
bool HasStrokeColor() const;
- void SetFillColor(CPDF_ColorSpace* pCS, FX_FLOAT* pValue, uint32_t nValues);
- void SetStrokeColor(CPDF_ColorSpace* pCS, FX_FLOAT* pValue, uint32_t nValues);
- void SetFillPattern(CPDF_Pattern* pattern,
- FX_FLOAT* pValue,
- uint32_t nValues);
- void SetStrokePattern(CPDF_Pattern* pattern,
- FX_FLOAT* pValue,
- uint32_t nValues);
+ void SetFillColor(CPDF_ColorSpace* pCS, float* pValue, uint32_t nValues);
+ void SetStrokeColor(CPDF_ColorSpace* pCS, float* pValue, uint32_t nValues);
+ void SetFillPattern(CPDF_Pattern* pattern, float* pValue, uint32_t nValues);
+ void SetStrokePattern(CPDF_Pattern* pattern, float* pValue, uint32_t nValues);
explicit operator bool() const { return !!m_Ref; }
@@ -68,7 +64,7 @@ class CPDF_ColorState {
void SetColor(CPDF_Color& color,
uint32_t& rgb,
CPDF_ColorSpace* pCS,
- FX_FLOAT* pValue,
+ float* pValue,
uint32_t nValues);
CFX_SharedCopyOnWrite<ColorData> m_Ref;
diff --git a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_contentparser.cpp b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_contentparser.cpp
index 7ceb509348a..96bc7a22217 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_contentparser.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_contentparser.cpp
@@ -55,8 +55,8 @@ void CPDF_ContentParser::Start(CPDF_Page* pPage) {
}
if (CPDF_Stream* pStream = pContent->AsStream()) {
m_nStreams = 0;
- m_pSingleStream = pdfium::MakeUnique<CPDF_StreamAcc>();
- m_pSingleStream->LoadAllData(pStream, false);
+ m_pSingleStream = pdfium::MakeRetain<CPDF_StreamAcc>(pStream);
+ m_pSingleStream->LoadAllData(false);
} else if (CPDF_Array* pArray = pContent->AsArray()) {
m_nStreams = pArray->GetCount();
if (m_nStreams)
@@ -114,8 +114,8 @@ void CPDF_ContentParser::Start(CPDF_Form* pForm,
pState->SetSoftMask(nullptr);
}
m_nStreams = 0;
- m_pSingleStream = pdfium::MakeUnique<CPDF_StreamAcc>();
- m_pSingleStream->LoadAllData(pForm->m_pFormStream, false);
+ m_pSingleStream = pdfium::MakeRetain<CPDF_StreamAcc>(pForm->m_pFormStream);
+ m_pSingleStream->LoadAllData(false);
m_pData = (uint8_t*)m_pSingleStream->GetData();
m_Size = m_pSingleStream->GetSize();
m_Status = ToBeContinued;
@@ -142,7 +142,7 @@ void CPDF_ContentParser::Continue(IFX_Pause* pPause) {
m_pData = FX_Alloc(uint8_t, m_Size);
uint32_t pos = 0;
for (const auto& stream : m_StreamArray) {
- FXSYS_memcpy(m_pData + pos, stream->GetData(), stream->GetSize());
+ memcpy(m_pData + pos, stream->GetData(), stream->GetSize());
pos += stream->GetSize();
m_pData[pos++] = ' ';
}
@@ -156,10 +156,11 @@ void CPDF_ContentParser::Continue(IFX_Pause* pPause) {
} else {
CPDF_Array* pContent =
m_pObjectHolder->m_pFormDict->GetArrayFor("Contents");
- m_StreamArray[m_CurrentOffset] = pdfium::MakeUnique<CPDF_StreamAcc>();
CPDF_Stream* pStreamObj = ToStream(
pContent ? pContent->GetDirectObjectAt(m_CurrentOffset) : nullptr);
- m_StreamArray[m_CurrentOffset]->LoadAllData(pStreamObj, false);
+ m_StreamArray[m_CurrentOffset] =
+ pdfium::MakeRetain<CPDF_StreamAcc>(pStreamObj);
+ m_StreamArray[m_CurrentOffset]->LoadAllData(false);
m_CurrentOffset++;
}
}
diff --git a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_contentparser.h b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_contentparser.h
index 5fd11f6c0b4..402fd2fdd05 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_contentparser.h
+++ b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_contentparser.h
@@ -12,6 +12,7 @@
#include "core/fpdfapi/page/cpdf_pageobjectholder.h"
#include "core/fpdfapi/page/cpdf_streamcontentparser.h"
+#include "core/fpdfapi/parser/cpdf_stream_acc.h"
class CPDF_AllStates;
class CPDF_Form;
@@ -48,8 +49,8 @@ class CPDF_ContentParser {
bool m_bForm;
CPDF_Type3Char* m_pType3Char;
uint32_t m_nStreams;
- std::unique_ptr<CPDF_StreamAcc> m_pSingleStream;
- std::vector<std::unique_ptr<CPDF_StreamAcc>> m_StreamArray;
+ CFX_RetainPtr<CPDF_StreamAcc> m_pSingleStream;
+ std::vector<CFX_RetainPtr<CPDF_StreamAcc>> m_StreamArray;
uint8_t* m_pData;
uint32_t m_Size;
uint32_t m_CurrentOffset;
diff --git a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_devicecs_unittest.cpp b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_devicecs_unittest.cpp
new file mode 100644
index 00000000000..742f4a0f15c
--- /dev/null
+++ b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_devicecs_unittest.cpp
@@ -0,0 +1,114 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "core/fpdfapi/page/pageint.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+TEST(CPDF_DeviceCSTest, GetRGBFromGray) {
+ float R;
+ float G;
+ float B;
+ CPDF_DeviceCS deviceGray(nullptr, PDFCS_DEVICEGRAY);
+
+ // Test normal values. For gray, only first value from buf should be used.
+ float buf[3] = {0.43f, 0.11f, 0.34f};
+ ASSERT_TRUE(deviceGray.GetRGB(buf, &R, &G, &B));
+ EXPECT_FLOAT_EQ(0.43f, R);
+ EXPECT_FLOAT_EQ(0.43f, G);
+ EXPECT_FLOAT_EQ(0.43f, B);
+ buf[0] = 0.872f;
+ ASSERT_TRUE(deviceGray.GetRGB(buf, &R, &G, &B));
+ EXPECT_FLOAT_EQ(0.872f, R);
+ EXPECT_FLOAT_EQ(0.872f, G);
+ EXPECT_FLOAT_EQ(0.872f, B);
+
+ // Test boundary values
+ buf[0] = {0.0f};
+ ASSERT_TRUE(deviceGray.GetRGB(buf, &R, &G, &B));
+ EXPECT_FLOAT_EQ(0.0f, R);
+ EXPECT_FLOAT_EQ(0.0f, G);
+ EXPECT_FLOAT_EQ(0.0f, B);
+ buf[0] = 1.0f;
+ ASSERT_TRUE(deviceGray.GetRGB(buf, &R, &G, &B));
+ EXPECT_FLOAT_EQ(1.0f, R);
+ EXPECT_FLOAT_EQ(1.0f, G);
+ EXPECT_FLOAT_EQ(1.0f, B);
+
+ // Test out of range values
+ buf[0] = -0.01f;
+ ASSERT_TRUE(deviceGray.GetRGB(buf, &R, &G, &B));
+ EXPECT_FLOAT_EQ(0.0f, R);
+ EXPECT_FLOAT_EQ(0.0f, G);
+ EXPECT_FLOAT_EQ(0.0f, B);
+ buf[0] = 12.5f;
+ ASSERT_TRUE(deviceGray.GetRGB(buf, &R, &G, &B));
+ EXPECT_FLOAT_EQ(1.0f, R);
+ EXPECT_FLOAT_EQ(1.0f, G);
+ EXPECT_FLOAT_EQ(1.0f, B);
+}
+
+TEST(CPDF_DeviceCSTest, GetRGBFromRGB) {
+ float R;
+ float G;
+ float B;
+ CPDF_DeviceCS deviceRGB(nullptr, PDFCS_DEVICERGB);
+
+ // Test normal values
+ float buf[3] = {0.13f, 1.0f, 0.652f};
+ ASSERT_TRUE(deviceRGB.GetRGB(buf, &R, &G, &B));
+ EXPECT_FLOAT_EQ(0.13f, R);
+ EXPECT_FLOAT_EQ(1.0f, G);
+ EXPECT_FLOAT_EQ(0.652f, B);
+ buf[0] = 0.0f;
+ buf[1] = 0.52f;
+ buf[2] = 0.78f;
+ ASSERT_TRUE(deviceRGB.GetRGB(buf, &R, &G, &B));
+ EXPECT_FLOAT_EQ(0.0f, R);
+ EXPECT_FLOAT_EQ(0.52f, G);
+ EXPECT_FLOAT_EQ(0.78f, B);
+
+ // Test out of range values
+ buf[0] = -10.5f;
+ buf[1] = 100.0f;
+ ASSERT_TRUE(deviceRGB.GetRGB(buf, &R, &G, &B));
+ EXPECT_FLOAT_EQ(0.0f, R);
+ EXPECT_FLOAT_EQ(1.0f, G);
+ EXPECT_FLOAT_EQ(0.78f, B);
+}
+
+TEST(CPDF_DeviceCSTest, GetRGBFromCMYK) {
+ float R;
+ float G;
+ float B;
+ CPDF_DeviceCS deviceCMYK(nullptr, PDFCS_DEVICECMYK);
+
+ // Test normal values
+ float buf[4] = {0.6f, 0.5f, 0.3f, 0.9f};
+ ASSERT_TRUE(deviceCMYK.GetRGB(buf, &R, &G, &B));
+ EXPECT_FLOAT_EQ(0.0627451f, R);
+ EXPECT_FLOAT_EQ(0.0627451f, G);
+ EXPECT_FLOAT_EQ(0.10588236f, B);
+ buf[0] = 0.15f;
+ buf[2] = 0.0f;
+ ASSERT_TRUE(deviceCMYK.GetRGB(buf, &R, &G, &B));
+ EXPECT_FLOAT_EQ(0.2f, R);
+ EXPECT_FLOAT_EQ(0.0862745f, G);
+ EXPECT_FLOAT_EQ(0.16470589f, B);
+ buf[2] = 1.0f;
+ buf[3] = 0.0f;
+ ASSERT_TRUE(deviceCMYK.GetRGB(buf, &R, &G, &B));
+ EXPECT_FLOAT_EQ(0.85098046f, R);
+ EXPECT_FLOAT_EQ(0.552941f, G);
+ EXPECT_FLOAT_EQ(0.15686275f, B);
+
+ // Test out of range values
+ buf[2] = 1.5f;
+ buf[3] = -0.6f;
+ ASSERT_TRUE(deviceCMYK.GetRGB(buf, &R, &G, &B));
+ EXPECT_FLOAT_EQ(0.85098046f, R);
+ EXPECT_FLOAT_EQ(0.552941f, G);
+ EXPECT_FLOAT_EQ(0.15686275f, B);
+}
diff --git a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_docpagedata.cpp b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_docpagedata.cpp
index af2618286e5..5e13740c214 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_docpagedata.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_docpagedata.cpp
@@ -82,11 +82,7 @@ void CPDF_DocPageData::Clear(bool bForceRelease) {
for (auto it = m_IccProfileMap.begin(); it != m_IccProfileMap.end();) {
auto curr_it = it++;
- CPDF_CountedIccProfile* ipData = curr_it->second;
- if (!ipData->get())
- continue;
-
- if (bForceRelease || ipData->use_count() < 2) {
+ if (bForceRelease || curr_it->second->HasOneRef()) {
for (auto hash_it = m_HashProfileMap.begin();
hash_it != m_HashProfileMap.end(); ++hash_it) {
if (curr_it->first == hash_it->second) {
@@ -94,37 +90,17 @@ void CPDF_DocPageData::Clear(bool bForceRelease) {
break;
}
}
- delete ipData->get();
- delete ipData;
m_IccProfileMap.erase(curr_it);
}
}
for (auto it = m_FontFileMap.begin(); it != m_FontFileMap.end();) {
auto curr_it = it++;
- CPDF_CountedStreamAcc* pCountedFont = curr_it->second;
- if (!pCountedFont->get())
- continue;
-
- if (bForceRelease || pCountedFont->use_count() < 2) {
- delete pCountedFont->get();
- delete pCountedFont;
+ if (bForceRelease || curr_it->second->HasOneRef())
m_FontFileMap.erase(curr_it);
- }
}
- for (auto it = m_ImageMap.begin(); it != m_ImageMap.end();) {
- auto curr_it = it++;
- CPDF_CountedImage* pCountedImage = curr_it->second;
- if (!pCountedImage->get())
- continue;
-
- if (bForceRelease || pCountedImage->use_count() < 2) {
- delete pCountedImage->get();
- delete pCountedImage;
- m_ImageMap.erase(curr_it);
- }
- }
+ m_ImageMap.clear();
}
CPDF_Font* CPDF_DocPageData::GetFont(CPDF_Dictionary* pFontDict) {
@@ -398,91 +374,66 @@ void CPDF_DocPageData::ReleasePattern(const CPDF_Object* pPatternObj) {
pPattern->clear();
}
-CPDF_Image* CPDF_DocPageData::GetImage(uint32_t dwStreamObjNum) {
+CFX_RetainPtr<CPDF_Image> CPDF_DocPageData::GetImage(uint32_t dwStreamObjNum) {
ASSERT(dwStreamObjNum);
auto it = m_ImageMap.find(dwStreamObjNum);
if (it != m_ImageMap.end())
- return it->second->AddRef();
+ return it->second;
- CPDF_CountedImage* pCountedImage = new CPDF_CountedImage(
- pdfium::MakeUnique<CPDF_Image>(m_pPDFDoc, dwStreamObjNum));
- m_ImageMap[dwStreamObjNum] = pCountedImage;
- return pCountedImage->AddRef();
+ auto pImage = pdfium::MakeRetain<CPDF_Image>(m_pPDFDoc, dwStreamObjNum);
+ m_ImageMap[dwStreamObjNum] = pImage;
+ return pImage;
}
-void CPDF_DocPageData::ReleaseImage(uint32_t dwStreamObjNum) {
+void CPDF_DocPageData::MaybePurgeImage(uint32_t dwStreamObjNum) {
ASSERT(dwStreamObjNum);
auto it = m_ImageMap.find(dwStreamObjNum);
- if (it == m_ImageMap.end())
- return;
-
- CPDF_CountedImage* pCountedImage = it->second;
- if (!pCountedImage)
- return;
-
- pCountedImage->RemoveRef();
- if (pCountedImage->use_count() > 1)
- return;
-
- // We have item only in m_ImageMap cache. Clean it.
- delete pCountedImage->get();
- delete pCountedImage;
- m_ImageMap.erase(it);
+ if (it != m_ImageMap.end() && it->second->HasOneRef())
+ m_ImageMap.erase(it);
}
-CPDF_IccProfile* CPDF_DocPageData::GetIccProfile(
- CPDF_Stream* pIccProfileStream) {
- if (!pIccProfileStream)
+CFX_RetainPtr<CPDF_IccProfile> CPDF_DocPageData::GetIccProfile(
+ CPDF_Stream* pProfileStream) {
+ if (!pProfileStream)
return nullptr;
- auto it = m_IccProfileMap.find(pIccProfileStream);
+ auto it = m_IccProfileMap.find(pProfileStream);
if (it != m_IccProfileMap.end())
- return it->second->AddRef();
+ return it->second;
+
+ auto pAccessor = pdfium::MakeRetain<CPDF_StreamAcc>(pProfileStream);
+ pAccessor->LoadAllData(false);
- CPDF_StreamAcc stream;
- stream.LoadAllData(pIccProfileStream, false);
uint8_t digest[20];
- CRYPT_SHA1Generate(stream.GetData(), stream.GetSize(), digest);
+ CRYPT_SHA1Generate(pAccessor->GetData(), pAccessor->GetSize(), digest);
+
CFX_ByteString bsDigest(digest, 20);
auto hash_it = m_HashProfileMap.find(bsDigest);
if (hash_it != m_HashProfileMap.end()) {
auto it_copied_stream = m_IccProfileMap.find(hash_it->second);
if (it_copied_stream != m_IccProfileMap.end())
- return it_copied_stream->second->AddRef();
+ return it_copied_stream->second;
}
- CPDF_CountedIccProfile* ipData = new CPDF_CountedIccProfile(
- pdfium::MakeUnique<CPDF_IccProfile>(stream.GetData(), stream.GetSize()));
- m_IccProfileMap[pIccProfileStream] = ipData;
- m_HashProfileMap[bsDigest] = pIccProfileStream;
- return ipData->AddRef();
+ auto pProfile = pdfium::MakeRetain<CPDF_IccProfile>(
+ pProfileStream, pAccessor->GetData(), pAccessor->GetSize());
+ m_IccProfileMap[pProfileStream] = pProfile;
+ m_HashProfileMap[bsDigest] = pProfileStream;
+ return pProfile;
}
-void CPDF_DocPageData::ReleaseIccProfile(const CPDF_IccProfile* pIccProfile) {
- ASSERT(pIccProfile);
-
- for (auto it = m_IccProfileMap.begin(); it != m_IccProfileMap.end(); ++it) {
- CPDF_CountedIccProfile* profile = it->second;
- if (profile->get() != pIccProfile)
- continue;
-
- profile->RemoveRef();
- if (profile->use_count() > 1)
- continue;
- // We have item only in m_IccProfileMap cache. Clean it.
- delete profile->get();
- delete profile;
+void CPDF_DocPageData::MaybePurgeIccProfile(CPDF_Stream* pProfileStream) {
+ ASSERT(pProfileStream);
+ auto it = m_IccProfileMap.find(pProfileStream);
+ if (it != m_IccProfileMap.end() && it->second->HasOneRef())
m_IccProfileMap.erase(it);
- return;
- }
}
-CPDF_StreamAcc* CPDF_DocPageData::GetFontFileStreamAcc(
+CFX_RetainPtr<CPDF_StreamAcc> CPDF_DocPageData::GetFontFileStreamAcc(
CPDF_Stream* pFontStream) {
ASSERT(pFontStream);
-
auto it = m_FontFileMap.find(pFontStream);
if (it != m_FontFileMap.end())
- return it->second->AddRef();
+ return it->second;
CPDF_Dictionary* pFontDict = pFontStream->GetDict();
int32_t org_size = pFontDict->GetIntegerFor("Length1") +
@@ -490,36 +441,20 @@ CPDF_StreamAcc* CPDF_DocPageData::GetFontFileStreamAcc(
pFontDict->GetIntegerFor("Length3");
org_size = std::max(org_size, 0);
- auto pFontAcc = pdfium::MakeUnique<CPDF_StreamAcc>();
- pFontAcc->LoadAllData(pFontStream, false, org_size);
-
- CPDF_CountedStreamAcc* pCountedFont =
- new CPDF_CountedStreamAcc(std::move(pFontAcc));
- m_FontFileMap[pFontStream] = pCountedFont;
- return pCountedFont->AddRef();
+ auto pFontAcc = pdfium::MakeRetain<CPDF_StreamAcc>(pFontStream);
+ pFontAcc->LoadAllData(false, org_size);
+ m_FontFileMap[pFontStream] = pFontAcc;
+ return pFontAcc;
}
-void CPDF_DocPageData::ReleaseFontFileStreamAcc(
+void CPDF_DocPageData::MaybePurgeFontFileStreamAcc(
const CPDF_Stream* pFontStream) {
if (!pFontStream)
return;
auto it = m_FontFileMap.find(pFontStream);
- if (it == m_FontFileMap.end())
- return;
-
- CPDF_CountedStreamAcc* pCountedStream = it->second;
- if (!pCountedStream)
- return;
-
- pCountedStream->RemoveRef();
- if (pCountedStream->use_count() > 1)
- return;
-
- // We have item only in m_FontFileMap cache. Clean it.
- delete pCountedStream->get();
- delete pCountedStream;
- m_FontFileMap.erase(it);
+ if (it != m_FontFileMap.end() && it->second->HasOneRef())
+ m_FontFileMap.erase(it);
}
CPDF_CountedColorSpace* CPDF_DocPageData::FindColorSpacePtr(
diff --git a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_docpagedata.h b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_docpagedata.h
index 37538eb3298..f5ac3032909 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_docpagedata.h
+++ b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_docpagedata.h
@@ -30,42 +30,37 @@ class CPDF_DocPageData {
~CPDF_DocPageData();
void Clear(bool bRelease = false);
+ bool IsForceClear() const { return m_bForceClear; }
+
CPDF_Font* GetFont(CPDF_Dictionary* pFontDict);
CPDF_Font* GetStandardFont(const CFX_ByteString& fontName,
CPDF_FontEncoding* pEncoding);
void ReleaseFont(const CPDF_Dictionary* pFontDict);
+
CPDF_ColorSpace* GetColorSpace(CPDF_Object* pCSObj,
const CPDF_Dictionary* pResources);
CPDF_ColorSpace* GetCopiedColorSpace(CPDF_Object* pCSObj);
void ReleaseColorSpace(const CPDF_Object* pColorSpace);
+
CPDF_Pattern* GetPattern(CPDF_Object* pPatternObj,
bool bShading,
const CFX_Matrix& matrix);
void ReleasePattern(const CPDF_Object* pPatternObj);
- CPDF_Image* GetImage(uint32_t dwStreamObjNum);
- void ReleaseImage(uint32_t dwStreamObjNum);
- CPDF_IccProfile* GetIccProfile(CPDF_Stream* pIccProfileStream);
- void ReleaseIccProfile(const CPDF_IccProfile* pIccProfile);
- CPDF_StreamAcc* GetFontFileStreamAcc(CPDF_Stream* pFontStream);
- void ReleaseFontFileStreamAcc(const CPDF_Stream* pFontStream);
- bool IsForceClear() const { return m_bForceClear; }
+
+ CFX_RetainPtr<CPDF_Image> GetImage(uint32_t dwStreamObjNum);
+ void MaybePurgeImage(uint32_t dwStreamObjNum);
+
+ CFX_RetainPtr<CPDF_IccProfile> GetIccProfile(CPDF_Stream* pProfileStream);
+ void MaybePurgeIccProfile(CPDF_Stream* pProfileStream);
+
+ CFX_RetainPtr<CPDF_StreamAcc> GetFontFileStreamAcc(CPDF_Stream* pFontStream);
+ void MaybePurgeFontFileStreamAcc(const CPDF_Stream* pFontStream);
+
CPDF_CountedColorSpace* FindColorSpacePtr(CPDF_Object* pCSObj) const;
CPDF_CountedPattern* FindPatternPtr(CPDF_Object* pPatternObj) const;
private:
using CPDF_CountedFont = CPDF_CountedObject<CPDF_Font>;
- using CPDF_CountedIccProfile = CPDF_CountedObject<CPDF_IccProfile>;
- using CPDF_CountedImage = CPDF_CountedObject<CPDF_Image>;
- using CPDF_CountedStreamAcc = CPDF_CountedObject<CPDF_StreamAcc>;
-
- using CPDF_ColorSpaceMap =
- std::map<const CPDF_Object*, CPDF_CountedColorSpace*>;
- using CPDF_FontFileMap = std::map<const CPDF_Stream*, CPDF_CountedStreamAcc*>;
- using CPDF_FontMap = std::map<const CPDF_Dictionary*, CPDF_CountedFont*>;
- using CPDF_IccProfileMap =
- std::map<const CPDF_Stream*, CPDF_CountedIccProfile*>;
- using CPDF_ImageMap = std::map<uint32_t, CPDF_CountedImage*>;
- using CPDF_PatternMap = std::map<const CPDF_Object*, CPDF_CountedPattern*>;
CPDF_ColorSpace* GetColorSpaceImpl(CPDF_Object* pCSObj,
const CPDF_Dictionary* pResources,
@@ -74,12 +69,12 @@ class CPDF_DocPageData {
CPDF_Document* const m_pPDFDoc;
bool m_bForceClear;
std::map<CFX_ByteString, CPDF_Stream*> m_HashProfileMap;
- CPDF_ColorSpaceMap m_ColorSpaceMap;
- CPDF_FontFileMap m_FontFileMap;
- CPDF_FontMap m_FontMap;
- CPDF_IccProfileMap m_IccProfileMap;
- CPDF_ImageMap m_ImageMap;
- CPDF_PatternMap m_PatternMap;
+ std::map<const CPDF_Object*, CPDF_CountedColorSpace*> m_ColorSpaceMap;
+ std::map<const CPDF_Stream*, CFX_RetainPtr<CPDF_StreamAcc>> m_FontFileMap;
+ std::map<const CPDF_Dictionary*, CPDF_CountedFont*> m_FontMap;
+ std::map<const CPDF_Stream*, CFX_RetainPtr<CPDF_IccProfile>> m_IccProfileMap;
+ std::map<uint32_t, CFX_RetainPtr<CPDF_Image>> m_ImageMap;
+ std::map<const CPDF_Object*, CPDF_CountedPattern*> m_PatternMap;
};
#endif // CORE_FPDFAPI_PAGE_CPDF_DOCPAGEDATA_H_
diff --git a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_generalstate.cpp b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_generalstate.cpp
index 4edd9b2a3c6..513e5ff7a53 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_generalstate.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_generalstate.cpp
@@ -88,21 +88,21 @@ void CPDF_GeneralState::SetBlendType(int type) {
m_Ref.GetPrivateCopy()->m_BlendType = type;
}
-FX_FLOAT CPDF_GeneralState::GetFillAlpha() const {
+float CPDF_GeneralState::GetFillAlpha() const {
const StateData* pData = m_Ref.GetObject();
return pData ? pData->m_FillAlpha : 1.0f;
}
-void CPDF_GeneralState::SetFillAlpha(FX_FLOAT alpha) {
+void CPDF_GeneralState::SetFillAlpha(float alpha) {
m_Ref.GetPrivateCopy()->m_FillAlpha = alpha;
}
-FX_FLOAT CPDF_GeneralState::GetStrokeAlpha() const {
+float CPDF_GeneralState::GetStrokeAlpha() const {
const StateData* pData = m_Ref.GetObject();
return pData ? pData->m_StrokeAlpha : 1.0f;
}
-void CPDF_GeneralState::SetStrokeAlpha(FX_FLOAT alpha) {
+void CPDF_GeneralState::SetStrokeAlpha(float alpha) {
m_Ref.GetPrivateCopy()->m_StrokeAlpha = alpha;
}
@@ -124,12 +124,13 @@ void CPDF_GeneralState::SetTR(CPDF_Object* pObject) {
m_Ref.GetPrivateCopy()->m_pTR = pObject;
}
-CPDF_TransferFunc* CPDF_GeneralState::GetTransferFunc() const {
+CFX_RetainPtr<CPDF_TransferFunc> CPDF_GeneralState::GetTransferFunc() const {
const StateData* pData = m_Ref.GetObject();
return pData ? pData->m_pTransferFunc : nullptr;
}
-void CPDF_GeneralState::SetTransferFunc(CPDF_TransferFunc* pFunc) {
+void CPDF_GeneralState::SetTransferFunc(
+ const CFX_RetainPtr<CPDF_TransferFunc>& pFunc) {
m_Ref.GetPrivateCopy()->m_pTransferFunc = pFunc;
}
@@ -186,11 +187,11 @@ void CPDF_GeneralState::SetHT(CPDF_Object* pObject) {
m_Ref.GetPrivateCopy()->m_pHT = pObject;
}
-void CPDF_GeneralState::SetFlatness(FX_FLOAT flatness) {
+void CPDF_GeneralState::SetFlatness(float flatness) {
m_Ref.GetPrivateCopy()->m_Flatness = flatness;
}
-void CPDF_GeneralState::SetSmoothness(FX_FLOAT smoothness) {
+void CPDF_GeneralState::SetSmoothness(float smoothness) {
m_Ref.GetPrivateCopy()->m_Smoothness = smoothness;
}
@@ -277,7 +278,9 @@ CPDF_GeneralState::StateData::StateData(const StateData& that)
CPDF_GeneralState::StateData::~StateData() {
if (m_pTransferFunc && m_pTransferFunc->m_pPDFDoc) {
CPDF_DocRenderData* pDocCache = m_pTransferFunc->m_pPDFDoc->GetRenderData();
- if (pDocCache)
- pDocCache->ReleaseTransferFunc(m_pTR);
+ if (pDocCache) {
+ m_pTransferFunc.Reset(); // Give up our reference first.
+ pDocCache->MaybePurgeTransferFunc(m_pTR);
+ }
}
}
diff --git a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_generalstate.h b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_generalstate.h
index 5211c52e5bd..8de5a36ca67 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_generalstate.h
+++ b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_generalstate.h
@@ -7,6 +7,7 @@
#ifndef CORE_FPDFAPI_PAGE_CPDF_GENERALSTATE_H_
#define CORE_FPDFAPI_PAGE_CPDF_GENERALSTATE_H_
+#include "core/fxcrt/cfx_shared_copy_on_write.h"
#include "core/fxcrt/fx_basic.h"
#include "core/fxcrt/fx_coordinates.h"
#include "core/fxge/fx_dib.h"
@@ -28,11 +29,11 @@ class CPDF_GeneralState {
int GetBlendType() const;
void SetBlendType(int type);
- FX_FLOAT GetFillAlpha() const;
- void SetFillAlpha(FX_FLOAT alpha);
+ float GetFillAlpha() const;
+ void SetFillAlpha(float alpha);
- FX_FLOAT GetStrokeAlpha() const;
- void SetStrokeAlpha(FX_FLOAT alpha);
+ float GetStrokeAlpha() const;
+ void SetStrokeAlpha(float alpha);
CPDF_Object* GetSoftMask() const;
void SetSoftMask(CPDF_Object* pObject);
@@ -40,8 +41,8 @@ class CPDF_GeneralState {
CPDF_Object* GetTR() const;
void SetTR(CPDF_Object* pObject);
- CPDF_TransferFunc* GetTransferFunc() const;
- void SetTransferFunc(CPDF_TransferFunc* pFunc);
+ CFX_RetainPtr<CPDF_TransferFunc> GetTransferFunc() const;
+ void SetTransferFunc(const CFX_RetainPtr<CPDF_TransferFunc>& pFunc);
void SetBlendMode(const CFX_ByteString& mode);
@@ -61,8 +62,8 @@ class CPDF_GeneralState {
void SetUCR(CPDF_Object* pObject);
void SetHT(CPDF_Object* pObject);
- void SetFlatness(FX_FLOAT flatness);
- void SetSmoothness(FX_FLOAT smoothness);
+ void SetFlatness(float flatness);
+ void SetSmoothness(float smoothness);
bool GetStrokeAdjust() const;
void SetStrokeAdjust(bool adjust);
@@ -84,10 +85,10 @@ class CPDF_GeneralState {
int m_BlendType;
CPDF_Object* m_pSoftMask;
CFX_Matrix m_SMaskMatrix;
- FX_FLOAT m_StrokeAlpha;
- FX_FLOAT m_FillAlpha;
+ float m_StrokeAlpha;
+ float m_FillAlpha;
CPDF_Object* m_pTR;
- CPDF_TransferFunc* m_pTransferFunc;
+ CFX_RetainPtr<CPDF_TransferFunc> m_pTransferFunc;
CFX_Matrix m_Matrix;
int m_RenderIntent;
bool m_StrokeAdjust;
@@ -99,8 +100,8 @@ class CPDF_GeneralState {
CPDF_Object* m_pBG;
CPDF_Object* m_pUCR;
CPDF_Object* m_pHT;
- FX_FLOAT m_Flatness;
- FX_FLOAT m_Smoothness;
+ float m_Flatness;
+ float m_Smoothness;
};
CFX_SharedCopyOnWrite<StateData> m_Ref;
diff --git a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_image.cpp b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_image.cpp
index 6b0bfd7d6d1..da49fab8b19 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_image.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_image.cpp
@@ -88,7 +88,7 @@ std::unique_ptr<CPDF_Dictionary> CPDF_Image::InitJPEG(uint8_t* pData,
pDict->SetNewFor<CPDF_Name>("Subtype", "Image");
pDict->SetNewFor<CPDF_Number>("Width", width);
pDict->SetNewFor<CPDF_Number>("Height", height);
- const FX_CHAR* csname = nullptr;
+ const char* csname = nullptr;
if (num_comps == 1) {
csname = "DeviceGray";
} else if (num_comps == 3) {
@@ -157,7 +157,7 @@ void CPDF_Image::SetJpegImageInline(
m_pStream->InitStream(&(data[0]), size, std::move(pDict));
}
-void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap) {
+void CPDF_Image::SetImage(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap) {
int32_t BitmapWidth = pBitmap->GetWidth();
int32_t BitmapHeight = pBitmap->GetHeight();
if (BitmapWidth < 1 || BitmapHeight < 1)
@@ -200,13 +200,13 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap) {
pCS->AddNew<CPDF_Name>("DeviceRGB");
pCS->AddNew<CPDF_Number>(1);
CFX_ByteString ct;
- FX_CHAR* pBuf = ct.GetBuffer(6);
- pBuf[0] = (FX_CHAR)reset_r;
- pBuf[1] = (FX_CHAR)reset_g;
- pBuf[2] = (FX_CHAR)reset_b;
- pBuf[3] = (FX_CHAR)set_r;
- pBuf[4] = (FX_CHAR)set_g;
- pBuf[5] = (FX_CHAR)set_b;
+ char* pBuf = ct.GetBuffer(6);
+ pBuf[0] = (char)reset_r;
+ pBuf[1] = (char)reset_g;
+ pBuf[2] = (char)reset_b;
+ pBuf[3] = (char)set_r;
+ pBuf[4] = (char)set_g;
+ pBuf[5] = (char)set_b;
ct.ReleaseBuffer(6);
pCS->AddNew<CPDF_String>(ct, true);
}
@@ -248,7 +248,7 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap) {
bCopyWithoutAlpha = false;
}
- std::unique_ptr<CFX_DIBitmap> pMaskBitmap;
+ CFX_RetainPtr<CFX_DIBitmap> pMaskBitmap;
if (pBitmap->HasAlpha())
pMaskBitmap = pBitmap->CloneAlphaMask();
@@ -269,8 +269,8 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap) {
mask_buf.reset(FX_Alloc2D(uint8_t, maskHeight, maskWidth));
mask_size = maskHeight * maskWidth; // Safe since checked alloc returned.
for (int32_t a = 0; a < maskHeight; a++) {
- FXSYS_memcpy(mask_buf.get() + a * maskWidth,
- pMaskBitmap->GetScanline(a), maskWidth);
+ memcpy(mask_buf.get() + a * maskWidth, pMaskBitmap->GetScanline(a),
+ maskWidth);
}
}
pMaskDict->SetNewFor<CPDF_Number>("Length", mask_size);
@@ -288,7 +288,7 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap) {
uint8_t* pDest = dest_buf;
if (bCopyWithoutAlpha) {
for (int32_t i = 0; i < BitmapHeight; i++) {
- FXSYS_memcpy(pDest, src_buf, dest_pitch);
+ memcpy(pDest, src_buf, dest_pitch);
pDest += dest_pitch;
src_buf += src_pitch;
}
@@ -298,7 +298,7 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap) {
for (int32_t row = 0; row < BitmapHeight; row++) {
src_offset = row * src_pitch;
for (int32_t column = 0; column < BitmapWidth; column++) {
- FX_FLOAT alpha = 1;
+ float alpha = 1;
pDest[dest_offset] = (uint8_t)(src_buf[src_offset + 2] * alpha);
pDest[dest_offset + 1] = (uint8_t)(src_buf[src_offset + 1] * alpha);
pDest[dest_offset + 2] = (uint8_t)(src_buf[src_offset] * alpha);
@@ -320,28 +320,25 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap) {
FX_Free(dest_buf);
}
-void CPDF_Image::ResetCache(CPDF_Page* pPage, const CFX_DIBitmap* pBitmap) {
+void CPDF_Image::ResetCache(CPDF_Page* pPage,
+ const CFX_RetainPtr<CFX_DIBitmap>& pBitmap) {
pPage->GetRenderCache()->ResetBitmap(m_pStream.Get(), pBitmap);
}
-std::unique_ptr<CFX_DIBSource> CPDF_Image::LoadDIBSource() const {
- auto source = pdfium::MakeUnique<CPDF_DIBSource>();
+CFX_RetainPtr<CFX_DIBSource> CPDF_Image::LoadDIBSource() const {
+ auto source = pdfium::MakeRetain<CPDF_DIBSource>();
if (!source->Load(m_pDocument, m_pStream.Get()))
return nullptr;
- return std::move(source);
+ return source;
}
-CFX_DIBSource* CPDF_Image::DetachBitmap() {
- CFX_DIBSource* pBitmap = m_pDIBSource;
- m_pDIBSource = nullptr;
- return pBitmap;
+CFX_RetainPtr<CFX_DIBSource> CPDF_Image::DetachBitmap() {
+ return std::move(m_pDIBSource);
}
-CFX_DIBSource* CPDF_Image::DetachMask() {
- CFX_DIBSource* pBitmap = m_pMask;
- m_pMask = nullptr;
- return pBitmap;
+CFX_RetainPtr<CFX_DIBSource> CPDF_Image::DetachMask() {
+ return std::move(m_pMask);
}
bool CPDF_Image::StartLoadDIBSource(CPDF_Dictionary* pFormResource,
@@ -349,35 +346,33 @@ bool CPDF_Image::StartLoadDIBSource(CPDF_Dictionary* pFormResource,
bool bStdCS,
uint32_t GroupFamily,
bool bLoadMask) {
- auto source = pdfium::MakeUnique<CPDF_DIBSource>();
+ auto source = pdfium::MakeRetain<CPDF_DIBSource>();
int ret = source->StartLoadDIBSource(m_pDocument, m_pStream.Get(), true,
pFormResource, pPageResource, bStdCS,
GroupFamily, bLoadMask);
- if (ret == 2) {
- m_pDIBSource = source.release();
- return true;
- }
if (!ret) {
- m_pDIBSource = nullptr;
+ m_pDIBSource.Reset();
return false;
}
+ m_pDIBSource = source;
+ if (ret == 2)
+ return true;
+
m_pMask = source->DetachMask();
m_MatteColor = source->GetMatteColor();
- m_pDIBSource = source.release();
return false;
}
bool CPDF_Image::Continue(IFX_Pause* pPause) {
- CPDF_DIBSource* pSource = static_cast<CPDF_DIBSource*>(m_pDIBSource);
+ CFX_RetainPtr<CPDF_DIBSource> pSource = m_pDIBSource.As<CPDF_DIBSource>();
int ret = pSource->ContinueLoadDIBSource(pPause);
- if (ret == 2) {
- return true;
- }
if (!ret) {
- delete m_pDIBSource;
- m_pDIBSource = nullptr;
+ m_pDIBSource.Reset();
return false;
}
+ if (ret == 2)
+ return true;
+
m_pMask = pSource->DetachMask();
m_MatteColor = pSource->GetMatteColor();
return false;
diff --git a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_image.h b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_image.h
index 19094981026..7b7e090b49a 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_image.h
+++ b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_image.h
@@ -11,6 +11,7 @@
#include "core/fpdfapi/parser/cpdf_stream.h"
#include "core/fxcrt/cfx_maybe_owned.h"
+#include "core/fxcrt/cfx_retain_ptr.h"
#include "core/fxcrt/fx_system.h"
class CFX_DIBSource;
@@ -20,12 +21,10 @@ class CPDF_Page;
class IFX_Pause;
class IFX_SeekableReadStream;
-class CPDF_Image {
+class CPDF_Image : public CFX_Retainable {
public:
- explicit CPDF_Image(CPDF_Document* pDoc);
- CPDF_Image(CPDF_Document* pDoc, std::unique_ptr<CPDF_Stream> pStream);
- CPDF_Image(CPDF_Document* pDoc, uint32_t dwStreamObjNum);
- ~CPDF_Image();
+ template <typename T, typename... Args>
+ friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args);
void ConvertStreamToIndirectObject();
@@ -44,28 +43,33 @@ class CPDF_Image {
bool IsMask() const { return m_bIsMask; }
bool IsInterpol() const { return m_bInterpolate; }
- std::unique_ptr<CFX_DIBSource> LoadDIBSource() const;
+ CFX_RetainPtr<CFX_DIBSource> LoadDIBSource() const;
- void SetImage(const CFX_DIBitmap* pDIBitmap);
+ void SetImage(const CFX_RetainPtr<CFX_DIBitmap>& pDIBitmap);
void SetJpegImage(const CFX_RetainPtr<IFX_SeekableReadStream>& pFile);
void SetJpegImageInline(const CFX_RetainPtr<IFX_SeekableReadStream>& pFile);
- void ResetCache(CPDF_Page* pPage, const CFX_DIBitmap* pDIBitmap);
-
+ void ResetCache(CPDF_Page* pPage,
+ const CFX_RetainPtr<CFX_DIBitmap>& pDIBitmap);
bool StartLoadDIBSource(CPDF_Dictionary* pFormResource,
CPDF_Dictionary* pPageResource,
bool bStdCS = false,
uint32_t GroupFamily = 0,
bool bLoadMask = false);
bool Continue(IFX_Pause* pPause);
- CFX_DIBSource* DetachBitmap();
- CFX_DIBSource* DetachMask();
+ CFX_RetainPtr<CFX_DIBSource> DetachBitmap();
+ CFX_RetainPtr<CFX_DIBSource> DetachMask();
- CFX_DIBSource* m_pDIBSource = nullptr;
- CFX_DIBSource* m_pMask = nullptr;
+ CFX_RetainPtr<CFX_DIBSource> m_pDIBSource;
+ CFX_RetainPtr<CFX_DIBSource> m_pMask;
uint32_t m_MatteColor = 0;
private:
+ explicit CPDF_Image(CPDF_Document* pDoc);
+ CPDF_Image(CPDF_Document* pDoc, std::unique_ptr<CPDF_Stream> pStream);
+ CPDF_Image(CPDF_Document* pDoc, uint32_t dwStreamObjNum);
+ ~CPDF_Image() override;
+
void FinishInitialization();
std::unique_ptr<CPDF_Dictionary> InitJPEG(uint8_t* pData, uint32_t size);
diff --git a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_imageobject.cpp b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_imageobject.cpp
index 01d2df74217..1c2cc6ba7e4 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_imageobject.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_imageobject.cpp
@@ -12,11 +12,10 @@
#include "core/fpdfapi/page/cpdf_image.h"
#include "core/fpdfapi/parser/cpdf_document.h"
-CPDF_ImageObject::CPDF_ImageObject()
- : m_pImage(nullptr), m_pImageOwned(false) {}
+CPDF_ImageObject::CPDF_ImageObject() {}
CPDF_ImageObject::~CPDF_ImageObject() {
- Release();
+ MaybePurgeCache();
}
CPDF_PageObject::Type CPDF_ImageObject::GetType() const {
@@ -48,30 +47,31 @@ void CPDF_ImageObject::CalcBoundingBox() {
m_Matrix.TransformRect(m_Left, m_Right, m_Top, m_Bottom);
}
-void CPDF_ImageObject::SetOwnedImage(std::unique_ptr<CPDF_Image> pImage) {
- Release();
- m_pImage = pImage.release();
- m_pImageOwned = true;
-}
-
-void CPDF_ImageObject::SetUnownedImage(CPDF_Image* pImage) {
- Release();
+void CPDF_ImageObject::SetImage(const CFX_RetainPtr<CPDF_Image>& pImage) {
+ MaybePurgeCache();
m_pImage = pImage;
- m_pImageOwned = false;
}
-void CPDF_ImageObject::Release() {
- if (m_pImageOwned) {
- delete m_pImage;
- m_pImage = nullptr;
- m_pImageOwned = false;
+void CPDF_ImageObject::MaybePurgeCache() {
+ if (!m_pImage)
return;
- }
- if (!m_pImage)
+ CPDF_Document* pDocument = m_pImage->GetDocument();
+ if (!pDocument)
+ return;
+
+ CPDF_DocPageData* pPageData = pDocument->GetPageData();
+ if (pPageData)
+ return;
+
+ CPDF_Stream* pStream = m_pImage->GetStream();
+ if (!pStream)
+ return;
+
+ uint32_t objnum = pStream->GetObjNum();
+ if (!objnum)
return;
- CPDF_DocPageData* pPageData = m_pImage->GetDocument()->GetPageData();
- pPageData->ReleaseImage(m_pImage->GetStream()->GetObjNum());
- m_pImage = nullptr;
+ m_pImage.Reset(); // Clear my reference before asking the cache.
+ pPageData->MaybePurgeImage(objnum);
}
diff --git a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_imageobject.h b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_imageobject.h
index 1bbfc0509cd..484fb7baa6d 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_imageobject.h
+++ b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_imageobject.h
@@ -27,19 +27,16 @@ class CPDF_ImageObject : public CPDF_PageObject {
const CPDF_ImageObject* AsImage() const override;
void CalcBoundingBox();
- CPDF_Image* GetImage() const { return m_pImage; }
- void SetOwnedImage(std::unique_ptr<CPDF_Image> pImage);
- void SetUnownedImage(CPDF_Image* pImage);
-
+ CFX_RetainPtr<CPDF_Image> GetImage() const { return m_pImage; }
+ void SetImage(const CFX_RetainPtr<CPDF_Image>& pImage);
void set_matrix(const CFX_Matrix& matrix) { m_Matrix = matrix; }
const CFX_Matrix& matrix() const { return m_Matrix; }
private:
- void Release();
+ void MaybePurgeCache();
CFX_Matrix m_Matrix;
- CPDF_Image* m_pImage;
- bool m_pImageOwned;
+ CFX_RetainPtr<CPDF_Image> m_pImage;
};
#endif // CORE_FPDFAPI_PAGE_CPDF_IMAGEOBJECT_H_
diff --git a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_meshstream.cpp b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_meshstream.cpp
index 24ef9b271e2..ac935131635 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_meshstream.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_meshstream.cpp
@@ -107,14 +107,17 @@ CPDF_MeshStream::CPDF_MeshStream(
m_xmin(0),
m_xmax(0),
m_ymin(0),
- m_ymax(0) {
+ m_ymax(0),
+ m_pStream(pdfium::MakeRetain<CPDF_StreamAcc>(pShadingStream)) {
memset(&m_ColorMin, 0, sizeof(m_ColorMin));
memset(&m_ColorMax, 0, sizeof(m_ColorMax));
}
+CPDF_MeshStream::~CPDF_MeshStream() {}
+
bool CPDF_MeshStream::Load() {
- m_Stream.LoadAllData(m_pShadingStream);
- m_BitStream.Init(m_Stream.GetData(), m_Stream.GetSize());
+ m_pStream->LoadAllData();
+ m_BitStream.Init(m_pStream->GetData(), m_pStream->GetSize());
CPDF_Dictionary* pDict = m_pShadingStream->GetDict();
m_nCoordBits = pDict->GetIntegerFor("BitsPerCoordinate");
m_nComponentBits = pDict->GetIntegerFor("BitsPerComponent");
@@ -191,34 +194,34 @@ CFX_PointF CPDF_MeshStream::ReadCoords() {
return pos;
}
-std::tuple<FX_FLOAT, FX_FLOAT, FX_FLOAT> CPDF_MeshStream::ReadColor() {
+std::tuple<float, float, float> CPDF_MeshStream::ReadColor() {
ASSERT(ShouldCheckBPC(m_type));
- FX_FLOAT color_value[kMaxComponents];
+ float color_value[kMaxComponents];
for (uint32_t i = 0; i < m_nComponents; ++i) {
color_value[i] = m_ColorMin[i] +
m_BitStream.GetBits(m_nComponentBits) *
(m_ColorMax[i] - m_ColorMin[i]) / m_ComponentMax;
}
- FX_FLOAT r;
- FX_FLOAT g;
- FX_FLOAT b;
+ float r = 0.0;
+ float g = 0.0;
+ float b = 0.0;
if (m_funcs.empty()) {
- m_pCS->GetRGB(color_value, r, g, b);
- return std::tuple<FX_FLOAT, FX_FLOAT, FX_FLOAT>(r, g, b);
+ m_pCS->GetRGB(color_value, &r, &g, &b);
+ return std::tuple<float, float, float>(r, g, b);
}
- FX_FLOAT result[kMaxComponents];
- FXSYS_memset(result, 0, sizeof(result));
+ float result[kMaxComponents];
+ memset(result, 0, sizeof(result));
int nResults;
for (const auto& func : m_funcs) {
if (func && func->CountOutputs() <= kMaxComponents)
- func->Call(color_value, 1, result, nResults);
+ func->Call(color_value, 1, result, &nResults);
}
- m_pCS->GetRGB(result, r, g, b);
- return std::tuple<FX_FLOAT, FX_FLOAT, FX_FLOAT>(r, g, b);
+ m_pCS->GetRGB(result, &r, &g, &b);
+ return std::tuple<float, float, float>(r, g, b);
}
bool CPDF_MeshStream::ReadVertex(const CFX_Matrix& pObject2Bitmap,
diff --git a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_meshstream.h b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_meshstream.h
index d40de4a013d..e02c3bb4e83 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_meshstream.h
+++ b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_meshstream.h
@@ -23,9 +23,9 @@ class CPDF_MeshVertex {
~CPDF_MeshVertex();
CFX_PointF position;
- FX_FLOAT r;
- FX_FLOAT g;
- FX_FLOAT b;
+ float r;
+ float g;
+ float b;
};
class CFX_Matrix;
@@ -39,6 +39,7 @@ class CPDF_MeshStream {
const std::vector<std::unique_ptr<CPDF_Function>>& funcs,
CPDF_Stream* pShadingStream,
CPDF_ColorSpace* pCS);
+ ~CPDF_MeshStream();
bool Load();
@@ -48,7 +49,7 @@ class CPDF_MeshStream {
uint32_t ReadFlag();
CFX_PointF ReadCoords();
- std::tuple<FX_FLOAT, FX_FLOAT, FX_FLOAT> ReadColor();
+ std::tuple<float, float, float> ReadColor();
bool ReadVertex(const CFX_Matrix& pObject2Bitmap,
CPDF_MeshVertex* vertex,
@@ -74,13 +75,13 @@ class CPDF_MeshStream {
uint32_t m_nComponents;
uint32_t m_CoordMax;
uint32_t m_ComponentMax;
- FX_FLOAT m_xmin;
- FX_FLOAT m_xmax;
- FX_FLOAT m_ymin;
- FX_FLOAT m_ymax;
- FX_FLOAT m_ColorMin[kMaxComponents];
- FX_FLOAT m_ColorMax[kMaxComponents];
- CPDF_StreamAcc m_Stream;
+ float m_xmin;
+ float m_xmax;
+ float m_ymin;
+ float m_ymax;
+ float m_ColorMin[kMaxComponents];
+ float m_ColorMax[kMaxComponents];
+ CFX_RetainPtr<CPDF_StreamAcc> m_pStream;
CFX_BitStream m_BitStream;
};
diff --git a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_page.cpp b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_page.cpp
index 46123ab42eb..314b8acbaa2 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_page.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_page.cpp
@@ -183,5 +183,7 @@ bool GraphicsData::operator<(const GraphicsData& other) const {
}
bool FontData::operator<(const FontData& other) const {
- return baseFont < other.baseFont;
+ if (baseFont != other.baseFont)
+ return baseFont < other.baseFont;
+ return type < other.type;
}
diff --git a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_page.h b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_page.h
index 9e303562c6d..076ab3f93bf 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_page.h
+++ b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_page.h
@@ -24,13 +24,14 @@ class CPDF_PageRenderContext;
// These structs are used to keep track of resources that have already been
// generated in the page.
struct GraphicsData {
- FX_FLOAT fillAlpha;
- FX_FLOAT strokeAlpha;
+ float fillAlpha;
+ float strokeAlpha;
bool operator<(const GraphicsData& other) const;
};
struct FontData {
CFX_ByteString baseFont;
+ CFX_ByteString type;
bool operator<(const FontData& other) const;
};
@@ -51,8 +52,8 @@ class CPDF_Page : public CPDF_PageObjectHolder {
int ySize,
int iRotate) const;
- FX_FLOAT GetPageWidth() const { return m_PageWidth; }
- FX_FLOAT GetPageHeight() const { return m_PageHeight; }
+ float GetPageWidth() const { return m_PageWidth; }
+ float GetPageHeight() const { return m_PageHeight; }
CFX_FloatRect GetPageBBox() const { return m_BBox; }
const CFX_Matrix& GetPageMatrix() const { return m_PageMatrix; }
CPDF_Object* GetPageAttr(const CFX_ByteString& name) const;
@@ -72,8 +73,8 @@ class CPDF_Page : public CPDF_PageObjectHolder {
protected:
void StartParse();
- FX_FLOAT m_PageWidth;
- FX_FLOAT m_PageHeight;
+ float m_PageWidth;
+ float m_PageHeight;
CFX_Matrix m_PageMatrix;
View* m_pView;
std::unique_ptr<CPDF_PageRenderCache> m_pPageRender;
diff --git a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_pageobject.h b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_pageobject.h
index d2b84a5d40b..668621ff512 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_pageobject.h
+++ b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_pageobject.h
@@ -57,10 +57,10 @@ class CPDF_PageObject : public CPDF_GraphicStates {
}
FX_RECT GetBBox(const CFX_Matrix* pMatrix) const;
- FX_FLOAT m_Left;
- FX_FLOAT m_Right;
- FX_FLOAT m_Top;
- FX_FLOAT m_Bottom;
+ float m_Left;
+ float m_Right;
+ float m_Top;
+ float m_Bottom;
CPDF_ContentMark m_ContentMark;
protected:
diff --git a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_pageobjectholder.cpp b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_pageobjectholder.cpp
index 3304d4eec4c..974baa65a09 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_pageobjectholder.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_pageobjectholder.cpp
@@ -46,10 +46,10 @@ CFX_FloatRect CPDF_PageObjectHolder::CalcBoundingBox() const {
if (m_PageObjectList.empty())
return CFX_FloatRect(0, 0, 0, 0);
- FX_FLOAT left = 1000000.0f;
- FX_FLOAT right = -1000000.0f;
- FX_FLOAT bottom = 1000000.0f;
- FX_FLOAT top = -1000000.0f;
+ float left = 1000000.0f;
+ float right = -1000000.0f;
+ float bottom = 1000000.0f;
+ float top = -1000000.0f;
for (const auto& pObj : m_PageObjectList) {
left = std::min(left, pObj->m_Left);
right = std::max(right, pObj->m_Right);
diff --git a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_pageobjectlist.cpp b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_pageobjectlist.cpp
index 02b590e4139..5c30fe98779 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_pageobjectlist.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_pageobjectlist.cpp
@@ -10,7 +10,5 @@
#include "third_party/base/stl_util.h"
CPDF_PageObject* CPDF_PageObjectList::GetPageObjectByIndex(int index) {
- if (index < 0 || index >= pdfium::CollectionSize<int>(*this))
- return nullptr;
- return (*this)[index].get();
+ return pdfium::IndexInBounds(*this, index) ? (*this)[index].get() : nullptr;
}
diff --git a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_path.cpp b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_path.cpp
index ddc6bbd1d6f..b56249cd622 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_path.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_path.cpp
@@ -28,8 +28,8 @@ CFX_FloatRect CPDF_Path::GetBoundingBox() const {
return m_Ref.GetObject()->GetBoundingBox();
}
-CFX_FloatRect CPDF_Path::GetBoundingBox(FX_FLOAT line_width,
- FX_FLOAT miter_limit) const {
+CFX_FloatRect CPDF_Path::GetBoundingBox(float line_width,
+ float miter_limit) const {
return m_Ref.GetObject()->GetBoundingBox(line_width, miter_limit);
}
@@ -49,10 +49,7 @@ void CPDF_Path::Append(const CFX_PathData* pData, const CFX_Matrix* pMatrix) {
m_Ref.GetPrivateCopy()->Append(pData, pMatrix);
}
-void CPDF_Path::AppendRect(FX_FLOAT left,
- FX_FLOAT bottom,
- FX_FLOAT right,
- FX_FLOAT top) {
+void CPDF_Path::AppendRect(float left, float bottom, float right, float top) {
m_Ref.GetPrivateCopy()->AppendRect(left, bottom, right, top);
}
diff --git a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_path.h b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_path.h
index b0c5a68a444..84b844e7982 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_path.h
+++ b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_path.h
@@ -29,14 +29,14 @@ class CPDF_Path {
CFX_PointF GetPoint(int index) const;
CFX_FloatRect GetBoundingBox() const;
- CFX_FloatRect GetBoundingBox(FX_FLOAT line_width, FX_FLOAT miter_limit) const;
+ CFX_FloatRect GetBoundingBox(float line_width, float miter_limit) const;
bool IsRect() const;
void Transform(const CFX_Matrix* pMatrix);
void Append(const CPDF_Path& other, const CFX_Matrix* pMatrix);
void Append(const CFX_PathData* pData, const CFX_Matrix* pMatrix);
- void AppendRect(FX_FLOAT left, FX_FLOAT bottom, FX_FLOAT right, FX_FLOAT top);
+ void AppendRect(float left, float bottom, float right, float top);
void AppendPoint(const CFX_PointF& point, FXPT_TYPE type, bool close);
// TODO(tsepez): Remove when all access thru this class.
diff --git a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_pathobject.cpp b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_pathobject.cpp
index b5bb89390ce..1dd0a88f789 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_pathobject.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_pathobject.cpp
@@ -35,7 +35,7 @@ void CPDF_PathObject::CalcBoundingBox() {
if (!m_Path)
return;
CFX_FloatRect rect;
- FX_FLOAT width = m_GraphState.GetLineWidth();
+ float width = m_GraphState.GetLineWidth();
if (m_bStroke && width != 0) {
rect = m_Path.GetBoundingBox(width, m_GraphState.GetMiterLimit());
} else {
diff --git a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_psengine.h b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_psengine.h
index 659ca82f6b8..607d81065d3 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_psengine.h
+++ b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_psengine.h
@@ -83,16 +83,16 @@ class CPDF_PSEngine {
CPDF_PSEngine();
~CPDF_PSEngine();
- bool Parse(const FX_CHAR* str, int size);
+ bool Parse(const char* str, int size);
bool Execute();
bool DoOperator(PDF_PSOP op);
void Reset() { m_StackCount = 0; }
- void Push(FX_FLOAT value);
- FX_FLOAT Pop();
+ void Push(float value);
+ float Pop();
uint32_t GetStackSize() const { return m_StackCount; }
private:
- FX_FLOAT m_Stack[PSENGINE_STACKSIZE];
+ float m_Stack[PSENGINE_STACKSIZE];
uint32_t m_StackCount;
CPDF_PSProc m_MainProc;
};
diff --git a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_streamcontentparser.cpp b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_streamcontentparser.cpp
index 6211b6a4dd3..30686133c23 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_streamcontentparser.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_streamcontentparser.cpp
@@ -135,8 +135,8 @@ CFX_FloatRect GetShadingBBox(CPDF_ShadingPattern* pShading,
}
struct AbbrPair {
- const FX_CHAR* abbr;
- const FX_CHAR* full_name;
+ const char* abbr;
+ const char* full_name;
};
const AbbrPair InlineKeyAbbr[] = {
@@ -163,7 +163,7 @@ struct AbbrReplacementOp {
CFX_ByteStringC FindFullName(const AbbrPair* table,
size_t count,
const CFX_ByteStringC& abbr) {
- auto it = std::find_if(table, table + count, [abbr](const AbbrPair& pair) {
+ auto* it = std::find_if(table, table + count, [abbr](const AbbrPair& pair) {
return pair.abbr == abbr;
});
return it != table + count ? CFX_ByteStringC(it->full_name)
@@ -262,12 +262,9 @@ CPDF_StreamContentParser::CPDF_StreamContentParser(
m_Level(level),
m_ParamStartPos(0),
m_ParamCount(0),
- m_pCurStates(new CPDF_AllStates),
+ m_pCurStates(pdfium::MakeUnique<CPDF_AllStates>()),
m_pLastTextObject(nullptr),
m_DefFontSize(0),
- m_pPathPoints(nullptr),
- m_PathPointCount(0),
- m_PathAllocSize(0),
m_PathStartX(0.0f),
m_PathStartY(0.0f),
m_PathCurrentX(0.0f),
@@ -299,7 +296,6 @@ CPDF_StreamContentParser::CPDF_StreamContentParser(
CPDF_StreamContentParser::~CPDF_StreamContentParser() {
ClearAllParams();
- FX_Free(m_pPathPoints);
}
int CPDF_StreamContentParser::GetNextParamPos() {
@@ -330,11 +326,11 @@ void CPDF_StreamContentParser::AddNameParam(const CFX_ByteStringC& bsName) {
} else {
param.m_Type = ContentParam::NAME;
if (bsName.Find('#') == -1) {
- FXSYS_memcpy(param.m_Name.m_Buffer, bsName.raw_str(), bsName.GetLength());
+ memcpy(param.m_Name.m_Buffer, bsName.raw_str(), bsName.GetLength());
param.m_Name.m_Len = bsName.GetLength();
} else {
CFX_ByteString str = PDF_NameDecode(bsName);
- FXSYS_memcpy(param.m_Name.m_Buffer, str.c_str(), str.GetLength());
+ memcpy(param.m_Name.m_Buffer, str.c_str(), str.GetLength());
param.m_Name.m_Len = str.GetLength();
}
}
@@ -415,7 +411,7 @@ CFX_ByteString CPDF_StreamContentParser::GetString(uint32_t index) {
return CFX_ByteString();
}
-FX_FLOAT CPDF_StreamContentParser::GetNumber(uint32_t index) {
+float CPDF_StreamContentParser::GetNumber(uint32_t index) {
if (index >= m_ParamCount) {
return 0;
}
@@ -425,7 +421,7 @@ FX_FLOAT CPDF_StreamContentParser::GetNumber(uint32_t index) {
}
ContentParam& param = m_ParamBuf[real_index];
if (param.m_Type == ContentParam::NUMBER) {
- return param.m_Number.m_bInteger ? (FX_FLOAT)param.m_Number.m_Integer
+ return param.m_Number.m_bInteger ? (float)param.m_Number.m_Integer
: param.m_Number.m_Float;
}
if (param.m_Type == 0 && param.m_pObject) {
@@ -769,9 +765,9 @@ void CPDF_StreamContentParser::Handle_ExecuteXObject() {
}
void CPDF_StreamContentParser::AddForm(CPDF_Stream* pStream) {
- std::unique_ptr<CPDF_FormObject> pFormObj(new CPDF_FormObject);
- pFormObj->m_pForm.reset(
- new CPDF_Form(m_pDocument, m_pPageResources, pStream, m_pResources));
+ auto pFormObj = pdfium::MakeUnique<CPDF_FormObject>();
+ pFormObj->m_pForm = pdfium::MakeUnique<CPDF_Form>(
+ m_pDocument, m_pPageResources, pStream, m_pResources);
pFormObj->m_FormMatrix = m_pCurStates->m_CTM;
pFormObj->m_FormMatrix.Concat(m_mtContentToUser);
CPDF_AllStates status;
@@ -795,23 +791,24 @@ CPDF_ImageObject* CPDF_StreamContentParser::AddImage(
return nullptr;
auto pImageObj = pdfium::MakeUnique<CPDF_ImageObject>();
- pImageObj->SetOwnedImage(
- pdfium::MakeUnique<CPDF_Image>(m_pDocument, std::move(pStream)));
+ pImageObj->SetImage(
+ pdfium::MakeRetain<CPDF_Image>(m_pDocument, std::move(pStream)));
return AddImageObject(std::move(pImageObj));
}
CPDF_ImageObject* CPDF_StreamContentParser::AddImage(uint32_t streamObjNum) {
auto pImageObj = pdfium::MakeUnique<CPDF_ImageObject>();
- pImageObj->SetUnownedImage(m_pDocument->LoadImageFromPageData(streamObjNum));
+ pImageObj->SetImage(m_pDocument->LoadImageFromPageData(streamObjNum));
return AddImageObject(std::move(pImageObj));
}
-CPDF_ImageObject* CPDF_StreamContentParser::AddImage(CPDF_Image* pImage) {
+CPDF_ImageObject* CPDF_StreamContentParser::AddImage(
+ const CFX_RetainPtr<CPDF_Image>& pImage) {
if (!pImage)
return nullptr;
auto pImageObj = pdfium::MakeUnique<CPDF_ImageObject>();
- pImageObj->SetUnownedImage(
+ pImageObj->SetImage(
m_pDocument->GetPageData()->GetImage(pImage->GetStream()->GetObjNum()));
return AddImageObject(std::move(pImageObj));
@@ -864,13 +861,13 @@ void CPDF_StreamContentParser::Handle_EOFillPath() {
}
void CPDF_StreamContentParser::Handle_SetGray_Fill() {
- FX_FLOAT value = GetNumber(0);
+ float value = GetNumber(0);
CPDF_ColorSpace* pCS = CPDF_ColorSpace::GetStockCS(PDFCS_DEVICEGRAY);
m_pCurStates->m_ColorState.SetFillColor(pCS, &value, 1);
}
void CPDF_StreamContentParser::Handle_SetGray_Stroke() {
- FX_FLOAT value = GetNumber(0);
+ float value = GetNumber(0);
CPDF_ColorSpace* pCS = CPDF_ColorSpace::GetStockCS(PDFCS_DEVICEGRAY);
m_pCurStates->m_ColorState.SetStrokeColor(pCS, &value, 1);
}
@@ -886,14 +883,13 @@ void CPDF_StreamContentParser::Handle_SetExtendGraphState() {
}
void CPDF_StreamContentParser::Handle_ClosePath() {
- if (m_PathPointCount == 0) {
+ if (m_PathPoints.empty())
return;
- }
- if (m_PathStartX != m_PathCurrentX || m_PathStartY != m_PathCurrentY) {
+
+ if (m_PathStartX != m_PathCurrentX || m_PathStartY != m_PathCurrentY)
AddPathPoint(m_PathStartX, m_PathStartY, FXPT_TYPE::LineTo, true);
- } else if (m_pPathPoints[m_PathPointCount - 1].m_Type != FXPT_TYPE::MoveTo) {
- m_pPathPoints[m_PathPointCount - 1].m_CloseFigure = true;
- }
+ else if (m_PathPoints.back().m_Type != FXPT_TYPE::MoveTo)
+ m_PathPoints.back().m_CloseFigure = true;
}
void CPDF_StreamContentParser::Handle_SetFlat() {
@@ -916,7 +912,7 @@ void CPDF_StreamContentParser::Handle_SetCMYKColor_Fill() {
if (m_ParamCount != 4)
return;
- FX_FLOAT values[4];
+ float values[4];
for (int i = 0; i < 4; i++) {
values[i] = GetNumber(3 - i);
}
@@ -928,7 +924,7 @@ void CPDF_StreamContentParser::Handle_SetCMYKColor_Stroke() {
if (m_ParamCount != 4)
return;
- FX_FLOAT values[4];
+ float values[4];
for (int i = 0; i < 4; i++) {
values[i] = GetNumber(3 - i);
}
@@ -962,7 +958,7 @@ void CPDF_StreamContentParser::Handle_EndPath() {
}
void CPDF_StreamContentParser::Handle_SaveGraphState() {
- std::unique_ptr<CPDF_AllStates> pStates(new CPDF_AllStates);
+ auto pStates = pdfium::MakeUnique<CPDF_AllStates>();
pStates->Copy(*m_pCurStates);
m_StateStack.push_back(std::move(pStates));
}
@@ -976,15 +972,12 @@ void CPDF_StreamContentParser::Handle_RestoreGraphState() {
}
void CPDF_StreamContentParser::Handle_Rectangle() {
- FX_FLOAT x = GetNumber(3), y = GetNumber(2);
- FX_FLOAT w = GetNumber(1), h = GetNumber(0);
+ float x = GetNumber(3), y = GetNumber(2);
+ float w = GetNumber(1), h = GetNumber(0);
AddPathRect(x, y, w, h);
}
-void CPDF_StreamContentParser::AddPathRect(FX_FLOAT x,
- FX_FLOAT y,
- FX_FLOAT w,
- FX_FLOAT h) {
+void CPDF_StreamContentParser::AddPathRect(float x, float y, float w, float h) {
AddPathPoint(x, y, FXPT_TYPE::MoveTo, false);
AddPathPoint(x + w, y, FXPT_TYPE::LineTo, false);
AddPathPoint(x + w, y + h, FXPT_TYPE::LineTo, false);
@@ -996,7 +989,7 @@ void CPDF_StreamContentParser::Handle_SetRGBColor_Fill() {
if (m_ParamCount != 3)
return;
- FX_FLOAT values[3];
+ float values[3];
for (int i = 0; i < 3; i++) {
values[i] = GetNumber(2 - i);
}
@@ -1008,7 +1001,7 @@ void CPDF_StreamContentParser::Handle_SetRGBColor_Stroke() {
if (m_ParamCount != 3)
return;
- FX_FLOAT values[3];
+ float values[3];
for (int i = 0; i < 3; i++) {
values[i] = GetNumber(2 - i);
}
@@ -1028,7 +1021,7 @@ void CPDF_StreamContentParser::Handle_StrokePath() {
}
void CPDF_StreamContentParser::Handle_SetColor_Fill() {
- FX_FLOAT values[4];
+ float values[4];
int nargs = m_ParamCount;
if (nargs > 4) {
nargs = 4;
@@ -1040,7 +1033,7 @@ void CPDF_StreamContentParser::Handle_SetColor_Fill() {
}
void CPDF_StreamContentParser::Handle_SetColor_Stroke() {
- FX_FLOAT values[4];
+ float values[4];
int nargs = m_ParamCount;
if (nargs > 4) {
nargs = 4;
@@ -1060,9 +1053,9 @@ void CPDF_StreamContentParser::Handle_SetColorPS_Fill() {
uint32_t nvalues = nargs;
if (pLastParam->IsName())
nvalues--;
- FX_FLOAT* values = nullptr;
+ float* values = nullptr;
if (nvalues) {
- values = FX_Alloc(FX_FLOAT, nvalues);
+ values = FX_Alloc(float, nvalues);
for (uint32_t i = 0; i < nvalues; i++) {
values[i] = GetNumber(nargs - i - 1);
}
@@ -1088,9 +1081,9 @@ void CPDF_StreamContentParser::Handle_SetColorPS_Stroke() {
if (pLastParam->IsName())
nvalues--;
- FX_FLOAT* values = nullptr;
+ float* values = nullptr;
if (nvalues) {
- values = FX_Alloc(FX_FLOAT, nvalues);
+ values = FX_Alloc(float, nvalues);
for (int i = 0; i < nvalues; i++) {
values[i] = GetNumber(nargs - i - 1);
}
@@ -1118,7 +1111,7 @@ void CPDF_StreamContentParser::Handle_ShadeFill() {
if (!pShading->IsShadingObject() || !pShading->Load())
return;
- std::unique_ptr<CPDF_ShadingObject> pObj(new CPDF_ShadingObject);
+ auto pObj = pdfium::MakeUnique<CPDF_ShadingObject>();
pObj->m_pShading = pShading;
SetGraphicStates(pObj.get(), false, false, false);
pObj->m_Matrix = m_pCurStates->m_CTM;
@@ -1149,7 +1142,7 @@ void CPDF_StreamContentParser::Handle_MoveTextPoint_SetLeading() {
}
void CPDF_StreamContentParser::Handle_SetFont() {
- FX_FLOAT fs = GetNumber(0);
+ float fs = GetNumber(0);
if (fs == 0) {
fs = m_DefFontSize;
}
@@ -1231,8 +1224,8 @@ CPDF_Pattern* CPDF_StreamContentParser::FindPattern(const CFX_ByteString& name,
}
void CPDF_StreamContentParser::AddTextObject(CFX_ByteString* pStrs,
- FX_FLOAT fInitKerning,
- FX_FLOAT* pKerning,
+ float fInitKerning,
+ float* pKerning,
int nsegs) {
CPDF_Font* pFont = m_pCurStates->m_TextState.GetFont();
if (!pFont) {
@@ -1256,11 +1249,11 @@ void CPDF_StreamContentParser::AddTextObject(CFX_ByteString* pStrs,
pFont->IsType3Font() ? TextRenderingMode::MODE_FILL
: m_pCurStates->m_TextState.GetTextMode();
{
- std::unique_ptr<CPDF_TextObject> pText(new CPDF_TextObject);
+ auto pText = pdfium::MakeUnique<CPDF_TextObject>();
m_pLastTextObject = pText.get();
SetGraphicStates(m_pLastTextObject, true, true, true);
if (TextRenderingModeIsStrokeMode(text_mode)) {
- FX_FLOAT* pCTM = pText->m_TextState.GetMutableCTM();
+ float* pCTM = pText->m_TextState.GetMutableCTM();
pCTM[0] = m_pCurStates->m_CTM.a;
pCTM[1] = m_pCurStates->m_CTM.c;
pCTM[2] = m_pCurStates->m_CTM.b;
@@ -1323,9 +1316,9 @@ void CPDF_StreamContentParser::Handle_ShowText_Positioning() {
return;
}
CFX_ByteString* pStrs = new CFX_ByteString[nsegs];
- FX_FLOAT* pKerning = FX_Alloc(FX_FLOAT, nsegs);
+ float* pKerning = FX_Alloc(float, nsegs);
size_t iSegment = 0;
- FX_FLOAT fInitKerning = 0;
+ float fInitKerning = 0;
for (size_t i = 0; i < n; i++) {
CPDF_Object* pObj = pArray->GetDirectObjectAt(i);
if (pObj->IsString()) {
@@ -1336,7 +1329,7 @@ void CPDF_StreamContentParser::Handle_ShowText_Positioning() {
pStrs[iSegment] = str;
pKerning[iSegment++] = 0;
} else {
- FX_FLOAT num = pObj ? pObj->GetNumber() : 0;
+ float num = pObj ? pObj->GetNumber() : 0;
if (iSegment == 0) {
fInitKerning += num;
} else {
@@ -1368,7 +1361,7 @@ void CPDF_StreamContentParser::OnChangeTextMatrix() {
text_matrix.Concat(m_pCurStates->m_TextMatrix);
text_matrix.Concat(m_pCurStates->m_CTM);
text_matrix.Concat(m_mtContentToUser);
- FX_FLOAT* pTextMatrix = m_pCurStates->m_TextState.GetMutableMatrix();
+ float* pTextMatrix = m_pCurStates->m_TextState.GetMutableMatrix();
pTextMatrix[0] = text_matrix.a;
pTextMatrix[1] = text_matrix.c;
pTextMatrix[2] = text_matrix.b;
@@ -1439,68 +1432,64 @@ void CPDF_StreamContentParser::Handle_NextLineShowText_Space() {
void CPDF_StreamContentParser::Handle_Invalid() {}
-void CPDF_StreamContentParser::AddPathPoint(FX_FLOAT x,
- FX_FLOAT y,
+void CPDF_StreamContentParser::AddPathPoint(float x,
+ float y,
FXPT_TYPE type,
bool close) {
+ // If the path point is the same move as the previous one and neither of them
+ // closes the path, then just skip it.
+ if (!close && type == FXPT_TYPE::MoveTo && !m_PathPoints.empty() &&
+ !m_PathPoints.back().m_CloseFigure &&
+ m_PathPoints.back().m_Type == type && m_PathCurrentX == x &&
+ m_PathCurrentY == y) {
+ return;
+ }
+
m_PathCurrentX = x;
m_PathCurrentY = y;
if (type == FXPT_TYPE::MoveTo && !close) {
m_PathStartX = x;
m_PathStartY = y;
- if (m_PathPointCount &&
- m_pPathPoints[m_PathPointCount - 1].IsTypeAndOpen(FXPT_TYPE::MoveTo)) {
- m_pPathPoints[m_PathPointCount - 1].m_Point = CFX_PointF(x, y);
+ if (!m_PathPoints.empty() &&
+ m_PathPoints.back().IsTypeAndOpen(FXPT_TYPE::MoveTo)) {
+ m_PathPoints.back().m_Point = CFX_PointF(x, y);
return;
}
- } else if (m_PathPointCount == 0) {
+ } else if (m_PathPoints.empty()) {
return;
}
- m_PathPointCount++;
- if (m_PathPointCount > m_PathAllocSize) {
- int newsize = m_PathPointCount + 256;
- FX_PATHPOINT* pNewPoints = FX_Alloc(FX_PATHPOINT, newsize);
- if (m_PathAllocSize) {
- FXSYS_memcpy(pNewPoints, m_pPathPoints,
- m_PathAllocSize * sizeof(FX_PATHPOINT));
- FX_Free(m_pPathPoints);
- }
- m_pPathPoints = pNewPoints;
- m_PathAllocSize = newsize;
- }
- m_pPathPoints[m_PathPointCount - 1].m_Type = type;
- m_pPathPoints[m_PathPointCount - 1].m_CloseFigure = close;
- m_pPathPoints[m_PathPointCount - 1].m_Point = CFX_PointF(x, y);
+ m_PathPoints.push_back(FX_PATHPOINT(CFX_PointF(x, y), type, close));
}
void CPDF_StreamContentParser::AddPathObject(int FillType, bool bStroke) {
- int PathPointCount = m_PathPointCount;
+ std::vector<FX_PATHPOINT> PathPoints;
+ PathPoints.swap(m_PathPoints);
uint8_t PathClipType = m_PathClipType;
- m_PathPointCount = 0;
m_PathClipType = 0;
- if (PathPointCount <= 1) {
- if (PathPointCount && PathClipType) {
+
+ if (PathPoints.empty())
+ return;
+
+ if (PathPoints.size() == 1) {
+ if (PathClipType) {
CPDF_Path path;
path.AppendRect(0, 0, 0, 0);
m_pCurStates->m_ClipPath.AppendPath(path, FXFILL_WINDING, true);
}
return;
}
- if (PathPointCount &&
- m_pPathPoints[PathPointCount - 1].IsTypeAndOpen(FXPT_TYPE::MoveTo)) {
- PathPointCount--;
- }
+
+ if (PathPoints.back().IsTypeAndOpen(FXPT_TYPE::MoveTo))
+ PathPoints.pop_back();
CPDF_Path Path;
- for (int i = 0; i < PathPointCount; i++) {
- FX_PATHPOINT& point = m_pPathPoints[i];
+ for (const auto& point : PathPoints)
Path.AppendPoint(point.m_Point, point.m_Type, point.m_CloseFigure);
- }
CFX_Matrix matrix = m_pCurStates->m_CTM;
matrix.Concat(m_mtContentToUser);
if (bStroke || FillType) {
- std::unique_ptr<CPDF_PathObject> pPathObj(new CPDF_PathObject);
+ auto pPathObj = pdfium::MakeUnique<CPDF_PathObject>();
pPathObj->m_bStroke = bStroke;
pPathObj->m_FillType = FillType;
pPathObj->m_Path = Path;
@@ -1553,7 +1542,7 @@ uint32_t CPDF_StreamContentParser::Parse(const uint8_t* pData,
}
void CPDF_StreamContentParser::ParsePathObject() {
- FX_FLOAT params[6] = {};
+ float params[6] = {};
int nParams = 0;
int last_pos = m_pSyntax->GetPos();
while (1) {
@@ -1624,7 +1613,7 @@ void CPDF_StreamContentParser::ParsePathObject() {
int value;
bool bInteger = FX_atonum(m_pSyntax->GetWord(), &value);
- params[nParams++] = bInteger ? (FX_FLOAT)value : *(FX_FLOAT*)&value;
+ params[nParams++] = bInteger ? (float)value : *(float*)&value;
break;
}
default:
diff --git a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_streamcontentparser.h b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_streamcontentparser.h
index cd41990b0a7..4440aabb430 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_streamcontentparser.h
+++ b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_streamcontentparser.h
@@ -46,7 +46,7 @@ class CPDF_StreamContentParser {
CPDF_PageObjectHolder* GetPageObjectHolder() const { return m_pObjectHolder; }
CPDF_AllStates* GetCurStates() const { return m_pCurStates.get(); }
bool IsColored() const { return m_bColored; }
- const FX_FLOAT* GetType3Data() const { return m_Type3Data; }
+ const float* GetType3Data() const { return m_Type3Data; }
CPDF_Font* FindFont(const CFX_ByteString& name);
private:
@@ -62,7 +62,7 @@ class CPDF_StreamContentParser {
bool m_bInteger;
union {
int m_Integer;
- FX_FLOAT m_Float;
+ float m_Float;
};
} m_Number;
struct {
@@ -84,22 +84,22 @@ class CPDF_StreamContentParser {
void ClearAllParams();
CPDF_Object* GetObject(uint32_t index);
CFX_ByteString GetString(uint32_t index);
- FX_FLOAT GetNumber(uint32_t index);
+ float GetNumber(uint32_t index);
int GetInteger(uint32_t index) { return (int32_t)(GetNumber(index)); }
void OnOperator(const CFX_ByteStringC& op);
void AddTextObject(CFX_ByteString* pText,
- FX_FLOAT fInitKerning,
- FX_FLOAT* pKerning,
+ float fInitKerning,
+ float* pKerning,
int count);
void OnChangeTextMatrix();
void ParsePathObject();
- void AddPathPoint(FX_FLOAT x, FX_FLOAT y, FXPT_TYPE type, bool close);
- void AddPathRect(FX_FLOAT x, FX_FLOAT y, FX_FLOAT w, FX_FLOAT h);
+ void AddPathPoint(float x, float y, FXPT_TYPE type, bool close);
+ void AddPathRect(float x, float y, float w, float h);
void AddPathObject(int FillType, bool bStroke);
CPDF_ImageObject* AddImage(std::unique_ptr<CPDF_Stream> pStream);
CPDF_ImageObject* AddImage(uint32_t streamObjNum);
- CPDF_ImageObject* AddImage(CPDF_Image* pImage);
+ CPDF_ImageObject* AddImage(const CFX_RetainPtr<CPDF_Image>& pImage);
void AddForm(CPDF_Stream* pStream);
void SetGraphicStates(CPDF_PageObject* pObj,
@@ -203,19 +203,17 @@ class CPDF_StreamContentParser {
CPDF_ContentMark m_CurContentMark;
std::vector<std::unique_ptr<CPDF_TextObject>> m_ClipTextList;
CPDF_TextObject* m_pLastTextObject;
- FX_FLOAT m_DefFontSize;
- FX_PATHPOINT* m_pPathPoints;
- int m_PathPointCount;
- int m_PathAllocSize;
- FX_FLOAT m_PathStartX;
- FX_FLOAT m_PathStartY;
- FX_FLOAT m_PathCurrentX;
- FX_FLOAT m_PathCurrentY;
+ float m_DefFontSize;
+ std::vector<FX_PATHPOINT> m_PathPoints;
+ float m_PathStartX;
+ float m_PathStartY;
+ float m_PathCurrentX;
+ float m_PathCurrentY;
uint8_t m_PathClipType;
CFX_ByteString m_LastImageName;
- CPDF_Image* m_pLastImage;
+ CFX_RetainPtr<CPDF_Image> m_pLastImage;
bool m_bColored;
- FX_FLOAT m_Type3Data[6];
+ float m_Type3Data[6];
bool m_bResourceMissing;
std::vector<std::unique_ptr<CPDF_AllStates>> m_StateStack;
};
diff --git a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_streamparser.cpp b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_streamparser.cpp
index 294d72c9506..e0c6e25aefb 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_streamparser.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_streamparser.cpp
@@ -53,7 +53,7 @@ uint32_t DecodeAllScanlines(std::unique_ptr<CCodec_ScanlineDecoder> pDecoder,
if (!pLine)
break;
- FXSYS_memcpy(dest_buf + row * pitch, pLine, pitch);
+ memcpy(dest_buf + row * pitch, pLine, pitch);
}
return pDecoder->GetSrcOffset();
}
@@ -62,7 +62,7 @@ uint32_t PDF_DecodeInlineStream(const uint8_t* src_buf,
uint32_t limit,
int width,
int height,
- CFX_ByteString& decoder,
+ const CFX_ByteString& decoder,
CPDF_Dictionary* pParam,
uint8_t*& dest_buf,
uint32_t& dest_size) {
@@ -94,7 +94,7 @@ uint32_t PDF_DecodeInlineStream(const uint8_t* src_buf,
return RunLengthDecode(src_buf, limit, dest_buf, dest_size);
dest_size = 0;
dest_buf = 0;
- return (uint32_t)-1;
+ return 0xFFFFFFFF;
}
} // namespace
@@ -184,7 +184,7 @@ std::unique_ptr<CPDF_Stream> CPDF_StreamParser::ReadInlineStream(
if (OrigSize > m_Size - m_Pos)
OrigSize = m_Size - m_Pos;
pData.reset(FX_Alloc(uint8_t, OrigSize));
- FXSYS_memcpy(pData.get(), m_pBuf + m_Pos, OrigSize);
+ memcpy(pData.get(), m_pBuf + m_Pos, OrigSize);
dwStreamSize = OrigSize;
m_Pos += OrigSize;
} else {
@@ -217,7 +217,7 @@ std::unique_ptr<CPDF_Stream> CPDF_StreamParser::ReadInlineStream(
}
m_Pos = dwSavePos;
pData.reset(FX_Alloc(uint8_t, dwStreamSize));
- FXSYS_memcpy(pData.get(), m_pBuf + m_Pos, dwStreamSize);
+ memcpy(pData.get(), m_pBuf + m_Pos, dwStreamSize);
m_Pos += dwStreamSize;
}
pDict->SetNewFor<CPDF_Number>("Length", (int)dwStreamSize);
@@ -500,7 +500,7 @@ CFX_ByteString CPDF_StreamParser::ReadString() {
break;
case 1:
if (ch >= '0' && ch <= '7') {
- iEscCode = FXSYS_toDecimalDigit(static_cast<FX_WCHAR>(ch));
+ iEscCode = FXSYS_toDecimalDigit(static_cast<wchar_t>(ch));
status = 2;
break;
}
@@ -526,7 +526,7 @@ CFX_ByteString CPDF_StreamParser::ReadString() {
case 2:
if (ch >= '0' && ch <= '7') {
iEscCode =
- iEscCode * 8 + FXSYS_toDecimalDigit(static_cast<FX_WCHAR>(ch));
+ iEscCode * 8 + FXSYS_toDecimalDigit(static_cast<wchar_t>(ch));
status = 3;
} else {
buf.AppendChar(iEscCode);
@@ -537,7 +537,7 @@ CFX_ByteString CPDF_StreamParser::ReadString() {
case 3:
if (ch >= '0' && ch <= '7') {
iEscCode =
- iEscCode * 8 + FXSYS_toDecimalDigit(static_cast<FX_WCHAR>(ch));
+ iEscCode * 8 + FXSYS_toDecimalDigit(static_cast<wchar_t>(ch));
buf.AppendChar(iEscCode);
status = 0;
} else {
diff --git a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_textobject.cpp b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_textobject.cpp
index da69de8ce1a..b8f3f610734 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_textobject.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_textobject.cpp
@@ -44,7 +44,7 @@ void CPDF_TextObject::GetItemInfo(int index, CPDF_TextObjectItem* pInfo) const {
short vy;
pFont->AsCIDFont()->GetVertOrigin(CID, vx, vy);
- FX_FLOAT fontsize = m_TextState.GetFontSize();
+ float fontsize = m_TextState.GetFontSize();
pInfo->m_Origin.x -= fontsize * vx / 1000;
pInfo->m_Origin.y -= fontsize * vy / 1000;
}
@@ -60,7 +60,7 @@ int CPDF_TextObject::CountChars() const {
void CPDF_TextObject::GetCharInfo(int index,
uint32_t* charcode,
- FX_FLOAT* kerning) const {
+ float* kerning) const {
int count = 0;
for (size_t i = 0; i < m_CharCodes.size(); ++i) {
if (m_CharCodes[i] == CPDF_Font::kInvalidCharCode)
@@ -108,7 +108,7 @@ void CPDF_TextObject::Transform(const CFX_Matrix& matrix) {
CFX_Matrix text_matrix = GetTextMatrix();
text_matrix.Concat(matrix);
- FX_FLOAT* pTextMatrix = m_TextState.GetMutableMatrix();
+ float* pTextMatrix = m_TextState.GetMutableMatrix();
pTextMatrix[0] = text_matrix.a;
pTextMatrix[1] = text_matrix.c;
pTextMatrix[2] = text_matrix.b;
@@ -130,13 +130,13 @@ const CPDF_TextObject* CPDF_TextObject::AsText() const {
}
CFX_Matrix CPDF_TextObject::GetTextMatrix() const {
- const FX_FLOAT* pTextMatrix = m_TextState.GetMatrix();
+ const float* pTextMatrix = m_TextState.GetMatrix();
return CFX_Matrix(pTextMatrix[0], pTextMatrix[2], pTextMatrix[1],
pTextMatrix[3], m_Pos.x, m_Pos.y);
}
void CPDF_TextObject::SetSegments(const CFX_ByteString* pStrs,
- const FX_FLOAT* pKerning,
+ const float* pKerning,
int nsegs) {
m_CharCodes.clear();
m_CharPos.clear();
@@ -149,7 +149,7 @@ void CPDF_TextObject::SetSegments(const CFX_ByteString* pStrs,
m_CharPos.resize(nChars - 1);
int index = 0;
for (int i = 0; i < nsegs; ++i) {
- const FX_CHAR* segment = pStrs[i].c_str();
+ const char* segment = pStrs[i].c_str();
int len = pStrs[i].GetLength();
int offset = 0;
while (offset < len)
@@ -166,8 +166,8 @@ void CPDF_TextObject::SetText(const CFX_ByteString& str) {
RecalcPositionData();
}
-FX_FLOAT CPDF_TextObject::GetCharWidth(uint32_t charcode) const {
- FX_FLOAT fontsize = m_TextState.GetFontSize() / 1000;
+float CPDF_TextObject::GetCharWidth(uint32_t charcode) const {
+ float fontsize = m_TextState.GetFontSize() / 1000;
CPDF_Font* pFont = m_TextState.GetFont();
bool bVertWriting = false;
CPDF_CIDFont* pCIDFont = pFont->AsCIDFont();
@@ -184,23 +184,23 @@ CPDF_Font* CPDF_TextObject::GetFont() const {
return m_TextState.GetFont();
}
-FX_FLOAT CPDF_TextObject::GetFontSize() const {
+float CPDF_TextObject::GetFontSize() const {
return m_TextState.GetFontSize();
}
-CFX_PointF CPDF_TextObject::CalcPositionData(FX_FLOAT horz_scale) {
- FX_FLOAT curpos = 0;
- FX_FLOAT min_x = 10000 * 1.0f;
- FX_FLOAT max_x = -10000 * 1.0f;
- FX_FLOAT min_y = 10000 * 1.0f;
- FX_FLOAT max_y = -10000 * 1.0f;
+CFX_PointF CPDF_TextObject::CalcPositionData(float horz_scale) {
+ float curpos = 0;
+ float min_x = 10000 * 1.0f;
+ float max_x = -10000 * 1.0f;
+ float min_y = 10000 * 1.0f;
+ float max_y = -10000 * 1.0f;
CPDF_Font* pFont = m_TextState.GetFont();
bool bVertWriting = false;
CPDF_CIDFont* pCIDFont = pFont->AsCIDFont();
if (pCIDFont)
bVertWriting = pCIDFont->IsVertWriting();
- FX_FLOAT fontsize = m_TextState.GetFontSize();
+ float fontsize = m_TextState.GetFontSize();
for (int i = 0; i < pdfium::CollectionSize<int>(m_CharCodes); ++i) {
uint32_t charcode = m_CharCodes[i];
if (i > 0) {
@@ -212,14 +212,14 @@ CFX_PointF CPDF_TextObject::CalcPositionData(FX_FLOAT horz_scale) {
}
FX_RECT char_rect = pFont->GetCharBBox(charcode);
- FX_FLOAT charwidth;
+ float charwidth;
if (!bVertWriting) {
- min_y = std::min(min_y, static_cast<FX_FLOAT>(
- std::min(char_rect.top, char_rect.bottom)));
- max_y = std::max(max_y, static_cast<FX_FLOAT>(
- std::max(char_rect.top, char_rect.bottom)));
- FX_FLOAT char_left = curpos + char_rect.left * fontsize / 1000;
- FX_FLOAT char_right = curpos + char_rect.right * fontsize / 1000;
+ min_y = std::min(
+ min_y, static_cast<float>(std::min(char_rect.top, char_rect.bottom)));
+ max_y = std::max(
+ max_y, static_cast<float>(std::max(char_rect.top, char_rect.bottom)));
+ float char_left = curpos + char_rect.left * fontsize / 1000;
+ float char_right = curpos + char_rect.right * fontsize / 1000;
min_x = std::min(min_x, std::min(char_left, char_right));
max_x = std::max(max_x, std::max(char_left, char_right));
charwidth = pFont->GetCharWidthF(charcode) * fontsize / 1000;
@@ -232,12 +232,12 @@ CFX_PointF CPDF_TextObject::CalcPositionData(FX_FLOAT horz_scale) {
char_rect.right -= vx;
char_rect.top -= vy;
char_rect.bottom -= vy;
- min_x = std::min(min_x, static_cast<FX_FLOAT>(
- std::min(char_rect.left, char_rect.right)));
- max_x = std::max(max_x, static_cast<FX_FLOAT>(
- std::max(char_rect.left, char_rect.right)));
- FX_FLOAT char_top = curpos + char_rect.top * fontsize / 1000;
- FX_FLOAT char_bottom = curpos + char_rect.bottom * fontsize / 1000;
+ min_x = std::min(
+ min_x, static_cast<float>(std::min(char_rect.left, char_rect.right)));
+ max_x = std::max(
+ max_x, static_cast<float>(std::max(char_rect.left, char_rect.right)));
+ float char_top = curpos + char_rect.top * fontsize / 1000;
+ float char_bottom = curpos + char_rect.bottom * fontsize / 1000;
min_y = std::min(min_y, std::min(char_top, char_bottom));
max_y = std::max(max_y, std::max(char_top, char_bottom));
charwidth = pCIDFont->GetVertWidth(CID) * fontsize / 1000;
@@ -269,7 +269,7 @@ CFX_PointF CPDF_TextObject::CalcPositionData(FX_FLOAT horz_scale) {
if (!TextRenderingModeIsStrokeMode(m_TextState.GetTextMode()))
return ret;
- FX_FLOAT half_width = m_GraphState.GetLineWidth() / 2;
+ float half_width = m_GraphState.GetLineWidth() / 2;
m_Left -= half_width;
m_Right += half_width;
m_Top += half_width;
@@ -278,9 +278,9 @@ CFX_PointF CPDF_TextObject::CalcPositionData(FX_FLOAT horz_scale) {
return ret;
}
-void CPDF_TextObject::SetPosition(FX_FLOAT x, FX_FLOAT y) {
- FX_FLOAT dx = x - m_Pos.x;
- FX_FLOAT dy = y - m_Pos.y;
+void CPDF_TextObject::SetPosition(float x, float y) {
+ float dx = x - m_Pos.x;
+ float dy = y - m_Pos.y;
m_Pos.x = x;
m_Pos.y = y;
m_Left += dx;
diff --git a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_textobject.h b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_textobject.h
index 59da718f629..e08b7280dec 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_textobject.h
+++ b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_textobject.h
@@ -39,16 +39,16 @@ class CPDF_TextObject : public CPDF_PageObject {
int CountItems() const;
void GetItemInfo(int index, CPDF_TextObjectItem* pInfo) const;
int CountChars() const;
- void GetCharInfo(int index, uint32_t* charcode, FX_FLOAT* kerning) const;
+ void GetCharInfo(int index, uint32_t* charcode, float* kerning) const;
void GetCharInfo(int index, CPDF_TextObjectItem* pInfo) const;
- FX_FLOAT GetCharWidth(uint32_t charcode) const;
+ float GetCharWidth(uint32_t charcode) const;
CFX_PointF GetPos() const { return m_Pos; }
CFX_Matrix GetTextMatrix() const;
CPDF_Font* GetFont() const;
- FX_FLOAT GetFontSize() const;
+ float GetFontSize() const;
void SetText(const CFX_ByteString& text);
- void SetPosition(FX_FLOAT x, FX_FLOAT y);
+ void SetPosition(float x, float y);
void RecalcPositionData();
@@ -59,14 +59,14 @@ class CPDF_TextObject : public CPDF_PageObject {
friend class CPDF_PageContentGenerator;
void SetSegments(const CFX_ByteString* pStrs,
- const FX_FLOAT* pKerning,
+ const float* pKerning,
int nSegs);
- CFX_PointF CalcPositionData(FX_FLOAT horz_scale);
+ CFX_PointF CalcPositionData(float horz_scale);
CFX_PointF m_Pos;
std::vector<uint32_t> m_CharCodes;
- std::vector<FX_FLOAT> m_CharPos;
+ std::vector<float> m_CharPos;
};
#endif // CORE_FPDFAPI_PAGE_CPDF_TEXTOBJECT_H_
diff --git a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_textstate.cpp b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_textstate.cpp
index 990c9cc3112..ed90bd310d0 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_textstate.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_textstate.cpp
@@ -25,51 +25,51 @@ void CPDF_TextState::SetFont(CPDF_Font* pFont) {
m_Ref.GetPrivateCopy()->SetFont(pFont);
}
-FX_FLOAT CPDF_TextState::GetFontSize() const {
+float CPDF_TextState::GetFontSize() const {
return m_Ref.GetObject()->m_FontSize;
}
-void CPDF_TextState::SetFontSize(FX_FLOAT size) {
+void CPDF_TextState::SetFontSize(float size) {
m_Ref.GetPrivateCopy()->m_FontSize = size;
}
-const FX_FLOAT* CPDF_TextState::GetMatrix() const {
+const float* CPDF_TextState::GetMatrix() const {
return m_Ref.GetObject()->m_Matrix;
}
-FX_FLOAT* CPDF_TextState::GetMutableMatrix() {
+float* CPDF_TextState::GetMutableMatrix() {
return m_Ref.GetPrivateCopy()->m_Matrix;
}
-FX_FLOAT CPDF_TextState::GetCharSpace() const {
+float CPDF_TextState::GetCharSpace() const {
return m_Ref.GetObject()->m_CharSpace;
}
-void CPDF_TextState::SetCharSpace(FX_FLOAT sp) {
+void CPDF_TextState::SetCharSpace(float sp) {
m_Ref.GetPrivateCopy()->m_CharSpace = sp;
}
-FX_FLOAT CPDF_TextState::GetWordSpace() const {
+float CPDF_TextState::GetWordSpace() const {
return m_Ref.GetObject()->m_WordSpace;
}
-void CPDF_TextState::SetWordSpace(FX_FLOAT sp) {
+void CPDF_TextState::SetWordSpace(float sp) {
m_Ref.GetPrivateCopy()->m_WordSpace = sp;
}
-FX_FLOAT CPDF_TextState::GetFontSizeV() const {
+float CPDF_TextState::GetFontSizeV() const {
return m_Ref.GetObject()->GetFontSizeV();
}
-FX_FLOAT CPDF_TextState::GetFontSizeH() const {
+float CPDF_TextState::GetFontSizeH() const {
return m_Ref.GetObject()->GetFontSizeH();
}
-FX_FLOAT CPDF_TextState::GetBaselineAngle() const {
+float CPDF_TextState::GetBaselineAngle() const {
return m_Ref.GetObject()->GetBaselineAngle();
}
-FX_FLOAT CPDF_TextState::GetShearAngle() const {
+float CPDF_TextState::GetShearAngle() const {
return m_Ref.GetObject()->GetShearAngle();
}
@@ -81,11 +81,11 @@ void CPDF_TextState::SetTextMode(TextRenderingMode mode) {
m_Ref.GetPrivateCopy()->m_TextMode = mode;
}
-const FX_FLOAT* CPDF_TextState::GetCTM() const {
+const float* CPDF_TextState::GetCTM() const {
return m_Ref.GetObject()->m_CTM;
}
-FX_FLOAT* CPDF_TextState::GetMutableCTM() {
+float* CPDF_TextState::GetMutableCTM() {
return m_Ref.GetPrivateCopy()->m_CTM;
}
@@ -138,20 +138,20 @@ void CPDF_TextState::TextData::SetFont(CPDF_Font* pFont) {
m_pFont = pFont;
}
-FX_FLOAT CPDF_TextState::TextData::GetFontSizeV() const {
- return FXSYS_fabs(FXSYS_sqrt2(m_Matrix[1], m_Matrix[3]) * m_FontSize);
+float CPDF_TextState::TextData::GetFontSizeV() const {
+ return fabs(FXSYS_sqrt2(m_Matrix[1], m_Matrix[3]) * m_FontSize);
}
-FX_FLOAT CPDF_TextState::TextData::GetFontSizeH() const {
- return FXSYS_fabs(FXSYS_sqrt2(m_Matrix[0], m_Matrix[2]) * m_FontSize);
+float CPDF_TextState::TextData::GetFontSizeH() const {
+ return fabs(FXSYS_sqrt2(m_Matrix[0], m_Matrix[2]) * m_FontSize);
}
-FX_FLOAT CPDF_TextState::TextData::GetBaselineAngle() const {
- return FXSYS_atan2(m_Matrix[2], m_Matrix[0]);
+float CPDF_TextState::TextData::GetBaselineAngle() const {
+ return atan2(m_Matrix[2], m_Matrix[0]);
}
-FX_FLOAT CPDF_TextState::TextData::GetShearAngle() const {
- return GetBaselineAngle() + FXSYS_atan2(m_Matrix[1], m_Matrix[3]);
+float CPDF_TextState::TextData::GetShearAngle() const {
+ return GetBaselineAngle() + atan2(m_Matrix[1], m_Matrix[3]);
}
bool SetTextRenderingModeFromInt(int iMode, TextRenderingMode* mode) {
diff --git a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_textstate.h b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_textstate.h
index 4723469fd96..07bee5ed042 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_textstate.h
+++ b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_textstate.h
@@ -35,28 +35,28 @@ class CPDF_TextState {
CPDF_Font* GetFont() const;
void SetFont(CPDF_Font* pFont);
- FX_FLOAT GetFontSize() const;
- void SetFontSize(FX_FLOAT size);
+ float GetFontSize() const;
+ void SetFontSize(float size);
- const FX_FLOAT* GetMatrix() const;
- FX_FLOAT* GetMutableMatrix();
+ const float* GetMatrix() const;
+ float* GetMutableMatrix();
- FX_FLOAT GetCharSpace() const;
- void SetCharSpace(FX_FLOAT sp);
+ float GetCharSpace() const;
+ void SetCharSpace(float sp);
- FX_FLOAT GetWordSpace() const;
- void SetWordSpace(FX_FLOAT sp);
+ float GetWordSpace() const;
+ void SetWordSpace(float sp);
- FX_FLOAT GetFontSizeV() const;
- FX_FLOAT GetFontSizeH() const;
- FX_FLOAT GetBaselineAngle() const;
- FX_FLOAT GetShearAngle() const;
+ float GetFontSizeV() const;
+ float GetFontSizeH() const;
+ float GetBaselineAngle() const;
+ float GetShearAngle() const;
TextRenderingMode GetTextMode() const;
void SetTextMode(TextRenderingMode mode);
- const FX_FLOAT* GetCTM() const;
- FX_FLOAT* GetMutableCTM();
+ const float* GetCTM() const;
+ float* GetMutableCTM();
private:
class TextData {
@@ -66,19 +66,19 @@ class CPDF_TextState {
~TextData();
void SetFont(CPDF_Font* pFont);
- FX_FLOAT GetFontSizeV() const;
- FX_FLOAT GetFontSizeH() const;
- FX_FLOAT GetBaselineAngle() const;
- FX_FLOAT GetShearAngle() const;
+ float GetFontSizeV() const;
+ float GetFontSizeH() const;
+ float GetBaselineAngle() const;
+ float GetShearAngle() const;
CPDF_Font* m_pFont;
CPDF_Document* m_pDocument;
- FX_FLOAT m_FontSize;
- FX_FLOAT m_CharSpace;
- FX_FLOAT m_WordSpace;
+ float m_FontSize;
+ float m_CharSpace;
+ float m_WordSpace;
TextRenderingMode m_TextMode;
- FX_FLOAT m_Matrix[4];
- FX_FLOAT m_CTM[4];
+ float m_Matrix[4];
+ float m_CTM[4];
};
CFX_SharedCopyOnWrite<TextData> m_Ref;
diff --git a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_tilingpattern.cpp b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_tilingpattern.cpp
index a041f380749..a68b4423e5a 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_tilingpattern.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_tilingpattern.cpp
@@ -41,8 +41,8 @@ bool CPDF_TilingPattern::Load() {
return false;
m_bColored = pDict->GetIntegerFor("PaintType") == 1;
- m_XStep = (FX_FLOAT)FXSYS_fabs(pDict->GetNumberFor("XStep"));
- m_YStep = (FX_FLOAT)FXSYS_fabs(pDict->GetNumberFor("YStep"));
+ m_XStep = (float)fabs(pDict->GetNumberFor("XStep"));
+ m_YStep = (float)fabs(pDict->GetNumberFor("YStep"));
CPDF_Stream* pStream = m_pPatternObj->AsStream();
if (!pStream)
diff --git a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_tilingpattern.h b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_tilingpattern.h
index 3f0851aa7ea..d9450d7c2f4 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_tilingpattern.h
+++ b/chromium/third_party/pdfium/core/fpdfapi/page/cpdf_tilingpattern.h
@@ -31,15 +31,15 @@ class CPDF_TilingPattern : public CPDF_Pattern {
bool colored() const { return m_bColored; }
const CFX_FloatRect& bbox() const { return m_BBox; }
- FX_FLOAT x_step() const { return m_XStep; }
- FX_FLOAT y_step() const { return m_YStep; }
+ float x_step() const { return m_XStep; }
+ float y_step() const { return m_YStep; }
CPDF_Form* form() const { return m_pForm.get(); }
private:
bool m_bColored;
CFX_FloatRect m_BBox;
- FX_FLOAT m_XStep;
- FX_FLOAT m_YStep;
+ float m_XStep;
+ float m_YStep;
std::unique_ptr<CPDF_Form> m_pForm;
};
diff --git a/chromium/third_party/pdfium/core/fpdfapi/page/fpdf_page_colors.cpp b/chromium/third_party/pdfium/core/fpdfapi/page/fpdf_page_colors.cpp
index 69129e4f2b1..a59ca37d026 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/page/fpdf_page_colors.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/page/fpdf_page_colors.cpp
@@ -18,11 +18,16 @@
#include "core/fpdfapi/parser/cpdf_stream_acc.h"
#include "core/fpdfapi/parser/cpdf_string.h"
#include "core/fxcodec/fx_codec.h"
+#include "third_party/base/stl_util.h"
namespace {
-FX_FLOAT NormalizeChannel(FX_FLOAT fVal) {
- return std::min(std::max(fVal, 0.0f), 1.0f);
+float NormalizeChannel(float fVal) {
+ return pdfium::clamp(fVal, 0.0f, 1.0f);
+}
+
+bool DetectSRGB(const uint8_t* pData, uint32_t dwSize) {
+ return dwSize == 3144 && memcmp(pData + 0x190, "sRGB IEC61966-2.1", 17) == 0;
}
} // namespace
@@ -36,23 +41,17 @@ uint32_t ComponentsForFamily(int family) {
return 4;
}
-void sRGB_to_AdobeCMYK(FX_FLOAT R,
- FX_FLOAT G,
- FX_FLOAT B,
- FX_FLOAT& c,
- FX_FLOAT& m,
- FX_FLOAT& y,
- FX_FLOAT& k) {
+void sRGB_to_AdobeCMYK(float R,
+ float G,
+ float B,
+ float& c,
+ float& m,
+ float& y,
+ float& k) {
c = 1.0f - R;
m = 1.0f - G;
y = 1.0f - B;
- k = c;
- if (m < k) {
- k = m;
- }
- if (y < k) {
- k = y;
- }
+ k = std::min(c, std::min(m, y));
}
void ReverseRGB(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels) {
@@ -79,57 +78,54 @@ CPDF_DeviceCS::CPDF_DeviceCS(CPDF_Document* pDoc, int family)
family == PDFCS_DEVICECMYK);
}
-bool CPDF_DeviceCS::GetRGB(FX_FLOAT* pBuf,
- FX_FLOAT& R,
- FX_FLOAT& G,
- FX_FLOAT& B) const {
+CPDF_DeviceCS::~CPDF_DeviceCS() {}
+
+bool CPDF_DeviceCS::GetRGB(float* pBuf, float* R, float* G, float* B) const {
switch (m_Family) {
case PDFCS_DEVICEGRAY:
- R = NormalizeChannel(*pBuf);
- G = R;
- B = R;
- break;
+ *R = NormalizeChannel(*pBuf);
+ *G = *R;
+ *B = *R;
+ return true;
case PDFCS_DEVICERGB:
- R = NormalizeChannel(pBuf[0]);
- G = NormalizeChannel(pBuf[1]);
- B = NormalizeChannel(pBuf[2]);
- break;
+ *R = NormalizeChannel(pBuf[0]);
+ *G = NormalizeChannel(pBuf[1]);
+ *B = NormalizeChannel(pBuf[2]);
+ return true;
case PDFCS_DEVICECMYK:
if (m_dwStdConversion) {
- FX_FLOAT k = pBuf[3];
- R = 1.0f - std::min(1.0f, pBuf[0] + k);
- G = 1.0f - std::min(1.0f, pBuf[1] + k);
- B = 1.0f - std::min(1.0f, pBuf[2] + k);
+ float k = pBuf[3];
+ *R = 1.0f - std::min(1.0f, pBuf[0] + k);
+ *G = 1.0f - std::min(1.0f, pBuf[1] + k);
+ *B = 1.0f - std::min(1.0f, pBuf[2] + k);
} else {
- AdobeCMYK_to_sRGB(pBuf[0], pBuf[1], pBuf[2], pBuf[3], R, G, B);
+ AdobeCMYK_to_sRGB(NormalizeChannel(pBuf[0]), NormalizeChannel(pBuf[1]),
+ NormalizeChannel(pBuf[2]), NormalizeChannel(pBuf[3]),
+ *R, *G, *B);
}
- break;
+ return true;
default:
ASSERT(false);
return false;
}
- return true;
}
-bool CPDF_DeviceCS::v_GetCMYK(FX_FLOAT* pBuf,
- FX_FLOAT& c,
- FX_FLOAT& m,
- FX_FLOAT& y,
- FX_FLOAT& k) const {
+bool CPDF_DeviceCS::v_GetCMYK(float* pBuf,
+ float* c,
+ float* m,
+ float* y,
+ float* k) const {
if (m_Family != PDFCS_DEVICECMYK)
return false;
- c = pBuf[0];
- m = pBuf[1];
- y = pBuf[2];
- k = pBuf[3];
+ *c = pBuf[0];
+ *m = pBuf[1];
+ *y = pBuf[2];
+ *k = pBuf[3];
return true;
}
-bool CPDF_DeviceCS::SetRGB(FX_FLOAT* pBuf,
- FX_FLOAT R,
- FX_FLOAT G,
- FX_FLOAT B) const {
+bool CPDF_DeviceCS::SetRGB(float* pBuf, float R, float G, float B) const {
switch (m_Family) {
case PDFCS_DEVICEGRAY:
if (R != G || R != B)
@@ -150,11 +146,11 @@ bool CPDF_DeviceCS::SetRGB(FX_FLOAT* pBuf,
}
}
-bool CPDF_DeviceCS::v_SetCMYK(FX_FLOAT* pBuf,
- FX_FLOAT c,
- FX_FLOAT m,
- FX_FLOAT y,
- FX_FLOAT k) const {
+bool CPDF_DeviceCS::v_SetCMYK(float* pBuf,
+ float c,
+ float m,
+ float y,
+ float k) const {
switch (m_Family) {
case PDFCS_DEVICEGRAY:
return false;
@@ -222,17 +218,23 @@ void CPDF_DeviceCS::TranslateImageLine(uint8_t* pDestBuf,
}
}
-CPDF_IccProfile::CPDF_IccProfile(const uint8_t* pData, uint32_t dwSize)
- : m_bsRGB(false), m_pTransform(nullptr), m_nSrcComponents(0) {
- if (dwSize == 3144 &&
- FXSYS_memcmp(pData + 0x190, "sRGB IEC61966-2.1", 17) == 0) {
- m_bsRGB = true;
+CPDF_IccProfile::CPDF_IccProfile(CPDF_Stream* pStream,
+ const uint8_t* pData,
+ uint32_t dwSize)
+ : m_bsRGB(DetectSRGB(pData, dwSize)), m_pStream(pStream) {
+ if (m_bsRGB) {
m_nSrcComponents = 3;
- } else if (CPDF_ModuleMgr::Get()->GetIccModule()) {
- m_pTransform = CPDF_ModuleMgr::Get()->GetIccModule()->CreateTransform_sRGB(
- pData, dwSize, m_nSrcComponents);
+ return;
+ }
+ auto* pIccModule = CPDF_ModuleMgr::Get()->GetIccModule();
+ if (pIccModule) {
+ uint32_t nSrcComps = 0;
+ m_pTransform = pIccModule->CreateTransform_sRGB(pData, dwSize, nSrcComps);
+ if (m_pTransform)
+ m_nSrcComponents = nSrcComps;
}
}
+
CPDF_IccProfile::~CPDF_IccProfile() {
if (m_pTransform) {
CPDF_ModuleMgr::Get()->GetIccModule()->DestroyTransform(m_pTransform);
diff --git a/chromium/third_party/pdfium/core/fpdfapi/page/fpdf_page_func.cpp b/chromium/third_party/pdfium/core/fpdfapi/page/fpdf_page_func.cpp
index 916641f05df..bc66adf726f 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/page/fpdf_page_func.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/page/fpdf_page_func.cpp
@@ -21,11 +21,12 @@
#include "core/fpdfapi/parser/cpdf_stream_acc.h"
#include "core/fxcrt/fx_safe_types.h"
#include "third_party/base/ptr_util.h"
+#include "third_party/base/stl_util.h"
namespace {
struct PDF_PSOpName {
- const FX_CHAR* name;
+ const char* name;
PDF_PSOP op;
};
@@ -70,12 +71,8 @@ bool IsValidBitsPerSample(uint32_t x) {
}
// See PDF Reference 1.7, page 170.
-FX_FLOAT PDF_Interpolate(FX_FLOAT x,
- FX_FLOAT xmin,
- FX_FLOAT xmax,
- FX_FLOAT ymin,
- FX_FLOAT ymax) {
- FX_FLOAT divisor = xmax - xmin;
+float PDF_Interpolate(float x, float xmin, float xmax, float ymin, float ymax) {
+ float divisor = xmax - xmin;
return ymin + (divisor ? (x - xmin) * (ymax - ymin) / divisor : 0);
}
@@ -86,20 +83,20 @@ class CPDF_PSFunc : public CPDF_Function {
// CPDF_Function
bool v_Init(CPDF_Object* pObj) override;
- bool v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const override;
+ bool v_Call(float* inputs, float* results) const override;
private:
CPDF_PSEngine m_PS;
};
bool CPDF_PSFunc::v_Init(CPDF_Object* pObj) {
- CPDF_StreamAcc acc;
- acc.LoadAllData(pObj->AsStream(), false);
- return m_PS.Parse(reinterpret_cast<const FX_CHAR*>(acc.GetData()),
- acc.GetSize());
+ auto pAcc = pdfium::MakeRetain<CPDF_StreamAcc>(pObj->AsStream());
+ pAcc->LoadAllData(false);
+ return m_PS.Parse(reinterpret_cast<const char*>(pAcc->GetData()),
+ pAcc->GetSize());
}
-bool CPDF_PSFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const {
+bool CPDF_PSFunc::v_Call(float* inputs, float* results) const {
CPDF_PSEngine& PS = const_cast<CPDF_PSEngine&>(m_PS);
PS.Reset();
for (uint32_t i = 0; i < m_nInputs; i++)
@@ -120,11 +117,13 @@ class CPDF_PSOP {
ASSERT(m_op != PSOP_CONST);
ASSERT(m_op != PSOP_PROC);
}
- explicit CPDF_PSOP(FX_FLOAT value) : m_op(PSOP_CONST), m_value(value) {}
- explicit CPDF_PSOP(std::unique_ptr<CPDF_PSProc> proc)
- : m_op(PSOP_PROC), m_value(0), m_proc(std::move(proc)) {}
+ explicit CPDF_PSOP(float value) : m_op(PSOP_CONST), m_value(value) {}
+ CPDF_PSOP()
+ : m_op(PSOP_PROC),
+ m_value(0),
+ m_proc(pdfium::MakeUnique<CPDF_PSProc>()) {}
- FX_FLOAT GetFloatValue() const {
+ float GetFloatValue() const {
if (m_op == PSOP_CONST)
return m_value;
@@ -142,7 +141,7 @@ class CPDF_PSOP {
private:
const PDF_PSOP m_op;
- const FX_FLOAT m_value;
+ const float m_value;
std::unique_ptr<CPDF_PSProc> m_proc;
};
@@ -184,29 +183,23 @@ bool CPDF_PSProc::Execute(CPDF_PSEngine* pEngine) {
return true;
}
-CPDF_PSEngine::CPDF_PSEngine() {
- m_StackCount = 0;
-}
+CPDF_PSEngine::CPDF_PSEngine() : m_StackCount(0) {}
+
CPDF_PSEngine::~CPDF_PSEngine() {}
-void CPDF_PSEngine::Push(FX_FLOAT v) {
- if (m_StackCount == PSENGINE_STACKSIZE) {
- return;
- }
- m_Stack[m_StackCount++] = v;
+
+void CPDF_PSEngine::Push(float v) {
+ if (m_StackCount < PSENGINE_STACKSIZE)
+ m_Stack[m_StackCount++] = v;
}
-FX_FLOAT CPDF_PSEngine::Pop() {
- if (m_StackCount == 0) {
- return 0;
- }
- return m_Stack[--m_StackCount];
+
+float CPDF_PSEngine::Pop() {
+ return m_StackCount > 0 ? m_Stack[--m_StackCount] : 0;
}
-bool CPDF_PSEngine::Parse(const FX_CHAR* str, int size) {
- CPDF_SimpleParser parser((uint8_t*)str, size);
+
+bool CPDF_PSEngine::Parse(const char* str, int size) {
+ CPDF_SimpleParser parser(reinterpret_cast<const uint8_t*>(str), size);
CFX_ByteStringC word = parser.GetWord();
- if (word != "{") {
- return false;
- }
- return m_MainProc.Parse(&parser, 0);
+ return word == "{" ? m_MainProc.Parse(&parser, 0) : false;
}
bool CPDF_PSProc::Parse(CPDF_SimpleParser* parser, int depth) {
@@ -215,42 +208,37 @@ bool CPDF_PSProc::Parse(CPDF_SimpleParser* parser, int depth) {
while (1) {
CFX_ByteStringC word = parser->GetWord();
- if (word.IsEmpty()) {
+ if (word.IsEmpty())
return false;
- }
- if (word == "}") {
+
+ if (word == "}")
return true;
- }
+
if (word == "{") {
- std::unique_ptr<CPDF_PSProc> proc(new CPDF_PSProc);
- std::unique_ptr<CPDF_PSOP> op(new CPDF_PSOP(std::move(proc)));
- m_Operators.push_back(std::move(op));
- if (!m_Operators.back()->GetProc()->Parse(parser, depth + 1)) {
+ m_Operators.push_back(pdfium::MakeUnique<CPDF_PSOP>());
+ if (!m_Operators.back()->GetProc()->Parse(parser, depth + 1))
return false;
- }
- } else {
- bool found = false;
- for (const PDF_PSOpName& op_name : kPsOpNames) {
- if (word == CFX_ByteStringC(op_name.name)) {
- std::unique_ptr<CPDF_PSOP> op(new CPDF_PSOP(op_name.op));
- m_Operators.push_back(std::move(op));
- found = true;
- break;
- }
- }
- if (!found) {
- std::unique_ptr<CPDF_PSOP> op(new CPDF_PSOP(FX_atof(word)));
- m_Operators.push_back(std::move(op));
+ continue;
+ }
+
+ std::unique_ptr<CPDF_PSOP> op;
+ for (const PDF_PSOpName& op_name : kPsOpNames) {
+ if (word == CFX_ByteStringC(op_name.name)) {
+ op = pdfium::MakeUnique<CPDF_PSOP>(op_name.op);
+ break;
}
}
+ if (!op)
+ op = pdfium::MakeUnique<CPDF_PSOP>(FX_atof(word));
+ m_Operators.push_back(std::move(op));
}
}
bool CPDF_PSEngine::DoOperator(PDF_PSOP op) {
int i1;
int i2;
- FX_FLOAT d1;
- FX_FLOAT d2;
+ float d1;
+ float d2;
FX_SAFE_INT32 result;
switch (op) {
case PSOP_ADD:
@@ -301,15 +289,15 @@ bool CPDF_PSEngine::DoOperator(PDF_PSOP op) {
break;
case PSOP_ABS:
d1 = Pop();
- Push((FX_FLOAT)FXSYS_fabs(d1));
+ Push((float)fabs(d1));
break;
case PSOP_CEILING:
d1 = Pop();
- Push((FX_FLOAT)FXSYS_ceil(d1));
+ Push((float)ceil(d1));
break;
case PSOP_FLOOR:
d1 = Pop();
- Push((FX_FLOAT)FXSYS_floor(d1));
+ Push((float)floor(d1));
break;
case PSOP_ROUND:
d1 = Pop();
@@ -321,20 +309,20 @@ bool CPDF_PSEngine::DoOperator(PDF_PSOP op) {
break;
case PSOP_SQRT:
d1 = Pop();
- Push((FX_FLOAT)FXSYS_sqrt(d1));
+ Push((float)sqrt(d1));
break;
case PSOP_SIN:
d1 = Pop();
- Push((FX_FLOAT)FXSYS_sin(d1 * FX_PI / 180.0f));
+ Push((float)sin(d1 * FX_PI / 180.0f));
break;
case PSOP_COS:
d1 = Pop();
- Push((FX_FLOAT)FXSYS_cos(d1 * FX_PI / 180.0f));
+ Push((float)cos(d1 * FX_PI / 180.0f));
break;
case PSOP_ATAN:
d2 = Pop();
d1 = Pop();
- d1 = (FX_FLOAT)(FXSYS_atan2(d1, d2) * 180.0 / FX_PI);
+ d1 = (float)(atan2(d1, d2) * 180.0 / FX_PI);
if (d1 < 0) {
d1 += 360;
}
@@ -343,15 +331,15 @@ bool CPDF_PSEngine::DoOperator(PDF_PSOP op) {
case PSOP_EXP:
d2 = Pop();
d1 = Pop();
- Push((FX_FLOAT)FXSYS_pow(d1, d2));
+ Push((float)FXSYS_pow(d1, d2));
break;
case PSOP_LN:
d1 = Pop();
- Push((FX_FLOAT)FXSYS_log(d1));
+ Push((float)log(d1));
break;
case PSOP_LOG:
d1 = Pop();
- Push((FX_FLOAT)FXSYS_log10(d1));
+ Push((float)log10(d1));
break;
case PSOP_CVI:
i1 = (int)Pop();
@@ -469,9 +457,9 @@ bool CPDF_PSEngine::DoOperator(PDF_PSOP op) {
j %= n;
if (j > 0)
j -= n;
- auto begin_it = std::begin(m_Stack) + m_StackCount - n;
- auto middle_it = begin_it - j;
- auto end_it = std::begin(m_Stack) + m_StackCount;
+ auto* begin_it = std::begin(m_Stack) + m_StackCount - n;
+ auto* middle_it = begin_it - j;
+ auto* end_it = std::begin(m_Stack) + m_StackCount;
std::rotate(begin_it, middle_it, end_it);
break;
}
@@ -499,8 +487,8 @@ bool CPDF_SampledFunc::v_Init(CPDF_Object* pObj) {
return false;
m_SampleMax = 0xffffffff >> (32 - m_nBitsPerSample);
- m_pSampleStream = pdfium::MakeUnique<CPDF_StreamAcc>();
- m_pSampleStream->LoadAllData(pStream, false);
+ m_pSampleStream = pdfium::MakeRetain<CPDF_StreamAcc>(pStream);
+ m_pSampleStream->LoadAllData(false);
FX_SAFE_UINT32 nTotalSampleBits = 1;
m_EncodeInfo.resize(m_nInputs);
for (uint32_t i = 0; i < m_nInputs; i++) {
@@ -514,7 +502,7 @@ bool CPDF_SampledFunc::v_Init(CPDF_Object* pObj) {
} else {
m_EncodeInfo[i].encode_min = 0;
m_EncodeInfo[i].encode_max =
- m_EncodeInfo[i].sizes == 1 ? 1 : (FX_FLOAT)m_EncodeInfo[i].sizes - 1;
+ m_EncodeInfo[i].sizes == 1 ? 1 : (float)m_EncodeInfo[i].sizes - 1;
}
}
nTotalSampleBits *= m_nBitsPerSample;
@@ -539,10 +527,10 @@ bool CPDF_SampledFunc::v_Init(CPDF_Object* pObj) {
return true;
}
-bool CPDF_SampledFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const {
+bool CPDF_SampledFunc::v_Call(float* inputs, float* results) const {
int pos = 0;
- CFX_FixedBufGrow<FX_FLOAT, 16> encoded_input_buf(m_nInputs);
- FX_FLOAT* encoded_input = encoded_input_buf;
+ CFX_FixedBufGrow<float, 16> encoded_input_buf(m_nInputs);
+ float* encoded_input = encoded_input_buf;
CFX_FixedBufGrow<uint32_t, 32> int_buf(m_nInputs * 2);
uint32_t* index = int_buf;
uint32_t* blocksize = index + m_nInputs;
@@ -554,8 +542,8 @@ bool CPDF_SampledFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const {
encoded_input[i] =
PDF_Interpolate(inputs[i], m_pDomains[i * 2], m_pDomains[i * 2 + 1],
m_EncodeInfo[i].encode_min, m_EncodeInfo[i].encode_max);
- index[i] = std::min((uint32_t)std::max(0.f, encoded_input[i]),
- m_EncodeInfo[i].sizes - 1);
+ index[i] = pdfium::clamp(static_cast<uint32_t>(encoded_input[i]), 0U,
+ m_EncodeInfo[i].sizes - 1);
pos += index[i] * blocksize[i];
}
FX_SAFE_INT32 bits_to_output = m_nOutputs;
@@ -580,11 +568,11 @@ bool CPDF_SampledFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const {
for (uint32_t j = 0; j < m_nOutputs; j++, bitpos += m_nBitsPerSample) {
uint32_t sample =
GetBits32(pSampleData, bitpos.ValueOrDie(), m_nBitsPerSample);
- FX_FLOAT encoded = (FX_FLOAT)sample;
+ float encoded = (float)sample;
for (uint32_t i = 0; i < m_nInputs; i++) {
if (index[i] == m_EncodeInfo[i].sizes - 1) {
if (index[i] == 0)
- encoded = encoded_input[i] * (FX_FLOAT)sample;
+ encoded = encoded_input[i] * (float)sample;
} else {
FX_SAFE_INT32 bitpos2 = blocksize[i];
bitpos2 += pos;
@@ -595,12 +583,12 @@ bool CPDF_SampledFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const {
return false;
uint32_t sample1 =
GetBits32(pSampleData, bitpos2.ValueOrDie(), m_nBitsPerSample);
- encoded += (encoded_input[i] - index[i]) *
- ((FX_FLOAT)sample1 - (FX_FLOAT)sample);
+ encoded +=
+ (encoded_input[i] - index[i]) * ((float)sample1 - (float)sample);
}
}
results[j] =
- PDF_Interpolate(encoded, 0, (FX_FLOAT)m_SampleMax,
+ PDF_Interpolate(encoded, 0, (float)m_SampleMax,
m_DecodeInfo[j].decode_min, m_DecodeInfo[j].decode_max);
}
return true;
@@ -615,39 +603,42 @@ CPDF_ExpIntFunc::~CPDF_ExpIntFunc() {
FX_Free(m_pBeginValues);
FX_Free(m_pEndValues);
}
+
bool CPDF_ExpIntFunc::v_Init(CPDF_Object* pObj) {
CPDF_Dictionary* pDict = pObj->GetDict();
- if (!pDict) {
+ if (!pDict)
return false;
- }
+
CPDF_Array* pArray0 = pDict->GetArrayFor("C0");
if (m_nOutputs == 0) {
m_nOutputs = 1;
- if (pArray0) {
+ if (pArray0)
m_nOutputs = pArray0->GetCount();
- }
}
+
CPDF_Array* pArray1 = pDict->GetArrayFor("C1");
- m_pBeginValues = FX_Alloc2D(FX_FLOAT, m_nOutputs, 2);
- m_pEndValues = FX_Alloc2D(FX_FLOAT, m_nOutputs, 2);
+ m_pBeginValues = FX_Alloc2D(float, m_nOutputs, 2);
+ m_pEndValues = FX_Alloc2D(float, m_nOutputs, 2);
for (uint32_t i = 0; i < m_nOutputs; i++) {
m_pBeginValues[i] = pArray0 ? pArray0->GetFloatAt(i) : 0.0f;
m_pEndValues[i] = pArray1 ? pArray1->GetFloatAt(i) : 1.0f;
}
+
m_Exponent = pDict->GetFloatFor("N");
m_nOrigOutputs = m_nOutputs;
- if (m_nOutputs && m_nInputs > INT_MAX / m_nOutputs) {
+ if (m_nOutputs && m_nInputs > INT_MAX / m_nOutputs)
return false;
- }
+
m_nOutputs *= m_nInputs;
return true;
}
-bool CPDF_ExpIntFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const {
+
+bool CPDF_ExpIntFunc::v_Call(float* inputs, float* results) const {
for (uint32_t i = 0; i < m_nInputs; i++)
for (uint32_t j = 0; j < m_nOrigOutputs; j++) {
results[i * m_nOrigOutputs + j] =
m_pBeginValues[j] +
- (FX_FLOAT)FXSYS_pow(inputs[i], m_Exponent) *
+ FXSYS_pow(inputs[i], m_Exponent) *
(m_pEndValues[j] - m_pBeginValues[j]);
}
return true;
@@ -699,7 +690,7 @@ bool CPDF_StitchFunc::v_Init(CPDF_Object* pObj) {
m_pSubFunctions.push_back(std::move(pFunc));
}
- m_pBounds = FX_Alloc(FX_FLOAT, nSubs + 1);
+ m_pBounds = FX_Alloc(float, nSubs + 1);
m_pBounds[0] = m_pDomains[0];
pArray = pDict->GetArrayFor("Bounds");
if (!pArray)
@@ -707,7 +698,7 @@ bool CPDF_StitchFunc::v_Init(CPDF_Object* pObj) {
for (uint32_t i = 0; i < nSubs - 1; i++)
m_pBounds[i + 1] = pArray->GetFloatAt(i);
m_pBounds[nSubs] = m_pDomains[1];
- m_pEncode = FX_Alloc2D(FX_FLOAT, nSubs, 2);
+ m_pEncode = FX_Alloc2D(float, nSubs, 2);
pArray = pDict->GetArrayFor("Encode");
if (!pArray)
return false;
@@ -717,8 +708,8 @@ bool CPDF_StitchFunc::v_Init(CPDF_Object* pObj) {
return true;
}
-bool CPDF_StitchFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* outputs) const {
- FX_FLOAT input = inputs[0];
+bool CPDF_StitchFunc::v_Call(float* inputs, float* outputs) const {
+ float input = inputs[0];
size_t i;
for (i = 0; i < m_pSubFunctions.size() - 1; i++) {
if (input < m_pBounds[i + 1])
@@ -727,7 +718,7 @@ bool CPDF_StitchFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* outputs) const {
input = PDF_Interpolate(input, m_pBounds[i], m_pBounds[i + 1],
m_pEncode[i * 2], m_pEncode[i * 2 + 1]);
int nresults;
- m_pSubFunctions[i]->Call(&input, kRequiredNumInputs, outputs, nresults);
+ m_pSubFunctions[i]->Call(&input, kRequiredNumInputs, outputs, &nresults);
return true;
}
@@ -792,7 +783,7 @@ bool CPDF_Function::Init(CPDF_Object* pObj) {
if (m_nInputs == 0)
return false;
- m_pDomains = FX_Alloc2D(FX_FLOAT, m_nInputs, 2);
+ m_pDomains = FX_Alloc2D(float, m_nInputs, 2);
for (uint32_t i = 0; i < m_nInputs * 2; i++) {
m_pDomains[i] = pDomains->GetFloatAt(i);
}
@@ -800,7 +791,7 @@ bool CPDF_Function::Init(CPDF_Object* pObj) {
m_nOutputs = 0;
if (pRanges) {
m_nOutputs = pRanges->GetCount() / 2;
- m_pRanges = FX_Alloc2D(FX_FLOAT, m_nOutputs, 2);
+ m_pRanges = FX_Alloc2D(float, m_nOutputs, 2);
for (uint32_t i = 0; i < m_nOutputs * 2; i++)
m_pRanges[i] = pRanges->GetFloatAt(i);
}
@@ -808,37 +799,34 @@ bool CPDF_Function::Init(CPDF_Object* pObj) {
if (!v_Init(pObj))
return false;
if (m_pRanges && m_nOutputs > old_outputs) {
- m_pRanges = FX_Realloc(FX_FLOAT, m_pRanges, m_nOutputs * 2);
+ m_pRanges = FX_Realloc(float, m_pRanges, m_nOutputs * 2);
if (m_pRanges) {
- FXSYS_memset(m_pRanges + (old_outputs * 2), 0,
- sizeof(FX_FLOAT) * (m_nOutputs - old_outputs) * 2);
+ memset(m_pRanges + (old_outputs * 2), 0,
+ sizeof(float) * (m_nOutputs - old_outputs) * 2);
}
}
return true;
}
-bool CPDF_Function::Call(FX_FLOAT* inputs,
+bool CPDF_Function::Call(float* inputs,
uint32_t ninputs,
- FX_FLOAT* results,
- int& nresults) const {
- if (m_nInputs != ninputs) {
+ float* results,
+ int* nresults) const {
+ if (m_nInputs != ninputs)
return false;
- }
- nresults = m_nOutputs;
+
+ *nresults = m_nOutputs;
for (uint32_t i = 0; i < m_nInputs; i++) {
- if (inputs[i] < m_pDomains[i * 2])
- inputs[i] = m_pDomains[i * 2];
- else if (inputs[i] > m_pDomains[i * 2 + 1])
- inputs[i] = m_pDomains[i * 2] + 1;
+ inputs[i] =
+ pdfium::clamp(inputs[i], m_pDomains[i * 2], m_pDomains[i * 2 + 1]);
}
v_Call(inputs, results);
- if (m_pRanges) {
- for (uint32_t i = 0; i < m_nOutputs; i++) {
- if (results[i] < m_pRanges[i * 2])
- results[i] = m_pRanges[i * 2];
- else if (results[i] > m_pRanges[i * 2 + 1])
- results[i] = m_pRanges[i * 2 + 1];
- }
+ if (!m_pRanges)
+ return true;
+
+ for (uint32_t i = 0; i < m_nOutputs; i++) {
+ results[i] =
+ pdfium::clamp(results[i], m_pRanges[i * 2], m_pRanges[i * 2 + 1]);
}
return true;
}
diff --git a/chromium/third_party/pdfium/core/fpdfapi/page/pageint.h b/chromium/third_party/pdfium/core/fpdfapi/page/pageint.h
index 6700633604a..05865ca58e9 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/page/pageint.h
+++ b/chromium/third_party/pdfium/core/fpdfapi/page/pageint.h
@@ -12,12 +12,13 @@
#include "core/fpdfapi/page/cpdf_colorspace.h"
#include "core/fpdfapi/page/cpdf_countedobject.h"
+#include "core/fpdfapi/parser/cpdf_stream_acc.h"
+#include "core/fxcrt/cfx_retain_ptr.h"
class CPDF_ExpIntFunc;
class CPDF_Pattern;
class CPDF_SampledFunc;
class CPDF_StitchFunc;
-class CPDF_StreamAcc;
class CPDF_Function {
public:
@@ -33,14 +34,15 @@ class CPDF_Function {
static Type IntegerToFunctionType(int iType);
virtual ~CPDF_Function();
- bool Call(FX_FLOAT* inputs,
+
+ bool Call(float* inputs,
uint32_t ninputs,
- FX_FLOAT* results,
- int& nresults) const;
+ float* results,
+ int* nresults) const;
uint32_t CountInputs() const { return m_nInputs; }
uint32_t CountOutputs() const { return m_nOutputs; }
- FX_FLOAT GetDomain(int i) const { return m_pDomains[i]; }
- FX_FLOAT GetRange(int i) const { return m_pRanges[i]; }
+ float GetDomain(int i) const { return m_pDomains[i]; }
+ float GetRange(int i) const { return m_pRanges[i]; }
const CPDF_SampledFunc* ToSampledFunc() const;
const CPDF_ExpIntFunc* ToExpIntFunc() const;
@@ -51,12 +53,12 @@ class CPDF_Function {
bool Init(CPDF_Object* pObj);
virtual bool v_Init(CPDF_Object* pObj) = 0;
- virtual bool v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const = 0;
+ virtual bool v_Call(float* inputs, float* results) const = 0;
uint32_t m_nInputs;
uint32_t m_nOutputs;
- FX_FLOAT* m_pDomains;
- FX_FLOAT* m_pRanges;
+ float* m_pDomains;
+ float* m_pRanges;
const Type m_Type;
};
@@ -67,25 +69,25 @@ class CPDF_ExpIntFunc : public CPDF_Function {
// CPDF_Function
bool v_Init(CPDF_Object* pObj) override;
- bool v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const override;
+ bool v_Call(float* inputs, float* results) const override;
uint32_t m_nOrigOutputs;
- FX_FLOAT m_Exponent;
- FX_FLOAT* m_pBeginValues;
- FX_FLOAT* m_pEndValues;
+ float m_Exponent;
+ float* m_pBeginValues;
+ float* m_pEndValues;
};
class CPDF_SampledFunc : public CPDF_Function {
public:
struct SampleEncodeInfo {
- FX_FLOAT encode_max;
- FX_FLOAT encode_min;
+ float encode_max;
+ float encode_min;
uint32_t sizes;
};
struct SampleDecodeInfo {
- FX_FLOAT decode_max;
- FX_FLOAT decode_min;
+ float decode_max;
+ float decode_min;
};
CPDF_SampledFunc();
@@ -93,14 +95,14 @@ class CPDF_SampledFunc : public CPDF_Function {
// CPDF_Function
bool v_Init(CPDF_Object* pObj) override;
- bool v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const override;
+ bool v_Call(float* inputs, float* results) const override;
const std::vector<SampleEncodeInfo>& GetEncodeInfo() const {
return m_EncodeInfo;
}
uint32_t GetBitsPerSample() const { return m_nBitsPerSample; }
- const CPDF_StreamAcc* GetSampleStream() const {
- return m_pSampleStream.get();
+ CFX_RetainPtr<CPDF_StreamAcc> GetSampleStream() const {
+ return m_pSampleStream;
}
private:
@@ -108,7 +110,7 @@ class CPDF_SampledFunc : public CPDF_Function {
std::vector<SampleDecodeInfo> m_DecodeInfo;
uint32_t m_nBitsPerSample;
uint32_t m_SampleMax;
- std::unique_ptr<CPDF_StreamAcc> m_pSampleStream;
+ CFX_RetainPtr<CPDF_StreamAcc> m_pSampleStream;
};
class CPDF_StitchFunc : public CPDF_Function {
@@ -118,72 +120,77 @@ class CPDF_StitchFunc : public CPDF_Function {
// CPDF_Function
bool v_Init(CPDF_Object* pObj) override;
- bool v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const override;
+ bool v_Call(float* inputs, float* results) const override;
const std::vector<std::unique_ptr<CPDF_Function>>& GetSubFunctions() const {
return m_pSubFunctions;
}
- FX_FLOAT GetBound(size_t i) const { return m_pBounds[i]; }
+ float GetBound(size_t i) const { return m_pBounds[i]; }
private:
std::vector<std::unique_ptr<CPDF_Function>> m_pSubFunctions;
- FX_FLOAT* m_pBounds;
- FX_FLOAT* m_pEncode;
+ float* m_pBounds;
+ float* m_pEncode;
static const uint32_t kRequiredNumInputs = 1;
};
-class CPDF_IccProfile {
+class CPDF_IccProfile : public CFX_Retainable {
public:
- CPDF_IccProfile(const uint8_t* pData, uint32_t dwSize);
- ~CPDF_IccProfile();
+ template <typename T, typename... Args>
+ friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args);
+
+ CPDF_Stream* GetStream() const { return m_pStream; }
+ bool IsValid() const { return IsSRGB() || IsSupported(); }
+ bool IsSRGB() const { return m_bsRGB; }
+ bool IsSupported() const { return !!m_pTransform; }
+ void* transform() { return m_pTransform; }
uint32_t GetComponents() const { return m_nSrcComponents; }
- bool m_bsRGB;
- void* m_pTransform;
private:
- uint32_t m_nSrcComponents;
+ CPDF_IccProfile(CPDF_Stream* pStream, const uint8_t* pData, uint32_t dwSize);
+ ~CPDF_IccProfile() override;
+
+ const bool m_bsRGB;
+ CPDF_Stream* const m_pStream;
+ void* m_pTransform = nullptr;
+ uint32_t m_nSrcComponents = 0;
};
class CPDF_DeviceCS : public CPDF_ColorSpace {
public:
CPDF_DeviceCS(CPDF_Document* pDoc, int family);
-
- bool GetRGB(FX_FLOAT* pBuf,
- FX_FLOAT& R,
- FX_FLOAT& G,
- FX_FLOAT& B) const override;
- bool SetRGB(FX_FLOAT* pBuf,
- FX_FLOAT R,
- FX_FLOAT G,
- FX_FLOAT B) const override;
- bool v_GetCMYK(FX_FLOAT* pBuf,
- FX_FLOAT& c,
- FX_FLOAT& m,
- FX_FLOAT& y,
- FX_FLOAT& k) const override;
- bool v_SetCMYK(FX_FLOAT* pBuf,
- FX_FLOAT c,
- FX_FLOAT m,
- FX_FLOAT y,
- FX_FLOAT k) const override;
+ ~CPDF_DeviceCS() override;
+
+ // CPDF_ColorSpace:
+ bool GetRGB(float* pBuf, float* R, float* G, float* B) const override;
+ bool SetRGB(float* pBuf, float R, float G, float B) const override;
+ bool v_GetCMYK(float* pBuf,
+ float* c,
+ float* m,
+ float* y,
+ float* k) const override;
+ bool v_SetCMYK(float* pBuf,
+ float c,
+ float m,
+ float y,
+ float k) const override;
void TranslateImageLine(uint8_t* pDestBuf,
const uint8_t* pSrcBuf,
int pixels,
int image_width,
int image_height,
- bool bTransMask = false) const override;
+ bool bTransMask) const override;
};
class CPDF_PatternCS : public CPDF_ColorSpace {
public:
explicit CPDF_PatternCS(CPDF_Document* pDoc);
~CPDF_PatternCS() override;
+
+ // CPDF_ColorSpace:
bool v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override;
- bool GetRGB(FX_FLOAT* pBuf,
- FX_FLOAT& R,
- FX_FLOAT& G,
- FX_FLOAT& B) const override;
+ bool GetRGB(float* pBuf, float* R, float* G, float* B) const override;
CPDF_ColorSpace* GetBaseCS() const override;
private:
@@ -196,7 +203,7 @@ struct PatternValue {
CPDF_Pattern* m_pPattern;
CPDF_CountedPattern* m_pCountedPattern;
int m_nComps;
- FX_FLOAT m_Comps[MAX_PATTERN_COLORCOMPS];
+ float m_Comps[MAX_PATTERN_COLORCOMPS];
};
CFX_ByteStringC PDF_FindKeyAbbreviationForTesting(const CFX_ByteStringC& abbr);
diff --git a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_array.cpp b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_array.cpp
index 05a93702f17..f3c23f37beb 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_array.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_array.cpp
@@ -57,8 +57,11 @@ std::unique_ptr<CPDF_Object> CPDF_Array::CloneNonCyclic(
pVisited->insert(this);
auto pCopy = pdfium::MakeUnique<CPDF_Array>();
for (const auto& pValue : m_Objects) {
- if (!pdfium::ContainsKey(*pVisited, pValue.get()))
- pCopy->m_Objects.push_back(pValue->CloneNonCyclic(bDirect, pVisited));
+ if (!pdfium::ContainsKey(*pVisited, pValue.get())) {
+ std::set<const CPDF_Object*> visited(*pVisited);
+ if (auto obj = pValue->CloneNonCyclic(bDirect, &visited))
+ pCopy->m_Objects.push_back(std::move(obj));
+ }
}
return std::move(pCopy);
}
@@ -108,7 +111,7 @@ int CPDF_Array::GetIntegerAt(size_t i) const {
return m_Objects[i]->GetInteger();
}
-FX_FLOAT CPDF_Array::GetNumberAt(size_t i) const {
+float CPDF_Array::GetNumberAt(size_t i) const {
if (i >= m_Objects.size())
return 0;
return m_Objects[i]->GetNumber();
diff --git a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_array.h b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_array.h
index 0b16f7f21b6..8f8b600c7e0 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_array.h
+++ b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_array.h
@@ -41,11 +41,11 @@ class CPDF_Array : public CPDF_Object {
CPDF_Object* GetDirectObjectAt(size_t index) const;
CFX_ByteString GetStringAt(size_t index) const;
int GetIntegerAt(size_t index) const;
- FX_FLOAT GetNumberAt(size_t index) const;
+ float GetNumberAt(size_t index) const;
CPDF_Dictionary* GetDictAt(size_t index) const;
CPDF_Stream* GetStreamAt(size_t index) const;
CPDF_Array* GetArrayAt(size_t index) const;
- FX_FLOAT GetFloatAt(size_t index) const { return GetNumberAt(index); }
+ float GetFloatAt(size_t index) const { return GetNumberAt(index); }
CFX_Matrix GetMatrix();
CFX_FloatRect GetRect();
diff --git a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_array_unittest.cpp b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_array_unittest.cpp
index 46777289b53..1e92b32716c 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_array_unittest.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_array_unittest.cpp
@@ -15,7 +15,7 @@
TEST(cpdf_array, RemoveAt) {
{
int elems[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
- std::unique_ptr<CPDF_Array> arr(new CPDF_Array);
+ auto arr = pdfium::MakeUnique<CPDF_Array>();
for (size_t i = 0; i < FX_ArraySize(elems); ++i)
arr->AddNew<CPDF_Number>(elems[i]);
arr->RemoveAt(3, 3);
@@ -32,7 +32,7 @@ TEST(cpdf_array, RemoveAt) {
{
// When the range is out of bound, RemoveAt has no effect.
int elems[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
- std::unique_ptr<CPDF_Array> arr(new CPDF_Array);
+ auto arr = pdfium::MakeUnique<CPDF_Array>();
for (size_t i = 0; i < FX_ArraySize(elems); ++i)
arr->AddNew<CPDF_Number>(elems[i]);
arr->RemoveAt(8, 5);
@@ -102,14 +102,13 @@ TEST(cpdf_array, Clone) {
static const size_t kNumOfRowElems = 5;
int elems[kNumOfRows][kNumOfRowElems] = {
{1, 2, 3, 4, 5}, {10, 9, 8, 7, 6}, {11, 12, 13, 14, 15}};
- std::unique_ptr<CPDF_Array> arr(new CPDF_Array);
+ auto arr = pdfium::MakeUnique<CPDF_Array>();
// Indirect references to indirect objects.
- std::unique_ptr<CPDF_IndirectObjectHolder> obj_holder(
- new CPDF_IndirectObjectHolder());
+ auto obj_holder = pdfium::MakeUnique<CPDF_IndirectObjectHolder>();
for (size_t i = 0; i < kNumOfRows; ++i) {
auto arr_elem = pdfium::MakeUnique<CPDF_Array>();
for (size_t j = 0; j < kNumOfRowElems; ++j) {
- std::unique_ptr<CPDF_Number> obj(new CPDF_Number(elems[i][j]));
+ auto obj = pdfium::MakeUnique<CPDF_Number>(elems[i][j]);
// Starts object number from 1.
int obj_num = i * kNumOfRowElems + j + 1;
obj_holder->ReplaceIndirectObjectIfHigherGeneration(obj_num,
@@ -133,9 +132,9 @@ TEST(cpdf_array, Clone) {
EXPECT_NE(arr_elem, arr1_elem);
EXPECT_NE(arr_elem, arr2_elem);
for (size_t j = 0; j < kNumOfRowElems; ++j) {
- auto elem_obj = arr_elem->GetObjectAt(j);
- auto elem_obj1 = arr1_elem->GetObjectAt(j);
- auto elem_obj2 = arr2_elem->GetObjectAt(j);
+ auto* elem_obj = arr_elem->GetObjectAt(j);
+ auto* elem_obj1 = arr1_elem->GetObjectAt(j);
+ auto* elem_obj2 = arr2_elem->GetObjectAt(j);
// Results from not deferencing reference objects.
EXPECT_NE(elem_obj, elem_obj1);
EXPECT_TRUE(elem_obj1->IsReference());
@@ -154,7 +153,7 @@ TEST(cpdf_array, Clone) {
for (size_t i = 0; i < kNumOfRows; ++i) {
for (size_t j = 0; j < kNumOfRowElems; ++j) {
// Results from not deferencing reference objects.
- auto elem_obj1 = arr1->GetObjectAt(i)->AsArray()->GetObjectAt(j);
+ auto* elem_obj1 = arr1->GetObjectAt(i)->AsArray()->GetObjectAt(j);
EXPECT_TRUE(elem_obj1->IsReference());
EXPECT_EQ(elems[i][j], elem_obj1->GetInteger());
// Results from deferencing reference objects.
@@ -166,9 +165,9 @@ TEST(cpdf_array, Clone) {
}
TEST(cpdf_array, Iterator) {
- int elems[] = {-23, -11, 3, 455, 2345877,
- 0, 7895330, -12564334, 10000, -100000};
- std::unique_ptr<CPDF_Array> arr(new CPDF_Array);
+ const int elems[] = {-23, -11, 3, 455, 2345877,
+ 0, 7895330, -12564334, 10000, -100000};
+ auto arr = pdfium::MakeUnique<CPDF_Array>();
for (size_t i = 0; i < FX_ArraySize(elems); ++i)
arr->InsertNewAt<CPDF_Number>(i, elems[i]);
size_t index = 0;
diff --git a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_crypto_handler.cpp b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_crypto_handler.cpp
index 61f78c4ee5c..ea09601b30e 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_crypto_handler.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_crypto_handler.cpp
@@ -21,7 +21,7 @@ void CPDF_CryptoHandler::CryptBlock(bool bEncrypt,
uint8_t* dest_buf,
uint32_t& dest_size) {
if (m_Cipher == FXCIPHER_NONE) {
- FXSYS_memcpy(dest_buf, src_buf, src_size);
+ memcpy(dest_buf, src_buf, src_size);
return;
}
uint8_t realkey[16];
@@ -31,7 +31,7 @@ void CPDF_CryptoHandler::CryptBlock(bool bEncrypt,
PopulateKey(objnum, gennum, key1);
if (m_Cipher == FXCIPHER_AES) {
- FXSYS_memcpy(key1 + m_KeyLen + 5, "sAlT", 4);
+ memcpy(key1 + m_KeyLen + 5, "sAlT", 4);
}
CRYPT_MD5Generate(
key1, m_Cipher == FXCIPHER_AES ? m_KeyLen + 9 : m_KeyLen + 5, realkey);
@@ -49,13 +49,12 @@ void CPDF_CryptoHandler::CryptBlock(bool bEncrypt,
iv[i] = (uint8_t)rand();
}
CRYPT_AESSetIV(m_pAESContext, iv);
- FXSYS_memcpy(dest_buf, iv, 16);
+ memcpy(dest_buf, iv, 16);
int nblocks = src_size / 16;
CRYPT_AESEncrypt(m_pAESContext, dest_buf + 16, src_buf, nblocks * 16);
uint8_t padding[16];
- FXSYS_memcpy(padding, src_buf + nblocks * 16, src_size % 16);
- FXSYS_memset(padding + src_size % 16, 16 - src_size % 16,
- 16 - src_size % 16);
+ memcpy(padding, src_buf + nblocks * 16, src_size % 16);
+ memset(padding + src_size % 16, 16 - src_size % 16, 16 - src_size % 16);
CRYPT_AESEncrypt(m_pAESContext, dest_buf + nblocks * 16 + 16, padding,
16);
dest_size = 32 + nblocks * 16;
@@ -68,7 +67,7 @@ void CPDF_CryptoHandler::CryptBlock(bool bEncrypt,
} else {
ASSERT(dest_size == src_size);
if (dest_buf != src_buf) {
- FXSYS_memcpy(dest_buf, src_buf, src_size);
+ memcpy(dest_buf, src_buf, src_size);
}
CRYPT_ArcFourCryptBlock(dest_buf, dest_size, realkey, realkeylen);
}
@@ -104,7 +103,7 @@ void* CPDF_CryptoHandler::CryptStart(uint32_t objnum,
PopulateKey(objnum, gennum, key1);
if (m_Cipher == FXCIPHER_AES) {
- FXSYS_memcpy(key1 + m_KeyLen + 5, "sAlT", 4);
+ memcpy(key1 + m_KeyLen + 5, "sAlT", 4);
}
uint8_t realkey[16];
CRYPT_MD5Generate(
@@ -162,8 +161,8 @@ bool CPDF_CryptoHandler::CryptStream(void* context,
if (copy_size > src_left) {
copy_size = src_left;
}
- FXSYS_memcpy(pContext->m_Block + pContext->m_BlockOffset, src_buf + src_off,
- copy_size);
+ memcpy(pContext->m_Block + pContext->m_BlockOffset, src_buf + src_off,
+ copy_size);
src_off += copy_size;
src_left -= copy_size;
pContext->m_BlockOffset += copy_size;
@@ -212,9 +211,9 @@ bool CPDF_CryptoHandler::CryptFinish(void* context,
dest_buf.AppendBlock(block_buf, 16);
pContext->m_BlockOffset = 0;
}
- FXSYS_memset(pContext->m_Block + pContext->m_BlockOffset,
- (uint8_t)(16 - pContext->m_BlockOffset),
- 16 - pContext->m_BlockOffset);
+ memset(pContext->m_Block + pContext->m_BlockOffset,
+ (uint8_t)(16 - pContext->m_BlockOffset),
+ 16 - pContext->m_BlockOffset);
CRYPT_AESEncrypt(pContext->m_Context, block_buf, pContext->m_Block, 16);
dest_buf.AppendBlock(block_buf, 16);
} else if (pContext->m_BlockOffset == 16) {
@@ -228,14 +227,14 @@ bool CPDF_CryptoHandler::CryptFinish(void* context,
return true;
}
-void CPDF_CryptoHandler::Decrypt(uint32_t objnum,
- uint32_t gennum,
- CFX_ByteString& str) {
+CFX_ByteString CPDF_CryptoHandler::Decrypt(uint32_t objnum,
+ uint32_t gennum,
+ const CFX_ByteString& str) {
CFX_BinaryBuf dest_buf;
void* context = DecryptStart(objnum, gennum);
DecryptStream(context, str.raw_str(), str.GetLength(), dest_buf);
DecryptFinish(context, dest_buf);
- str = CFX_ByteString(dest_buf.GetBuffer(), dest_buf.GetSize());
+ return CFX_ByteString(dest_buf.GetBuffer(), dest_buf.GetSize());
}
void* CPDF_CryptoHandler::DecryptStart(uint32_t objnum, uint32_t gennum) {
@@ -255,7 +254,7 @@ bool CPDF_CryptoHandler::Init(CPDF_Dictionary* pEncryptDict,
return false;
}
if (m_Cipher != FXCIPHER_NONE) {
- FXSYS_memcpy(m_EncryptKey, key, m_KeyLen);
+ memcpy(m_EncryptKey, key, m_KeyLen);
}
if (m_Cipher == FXCIPHER_AES) {
m_pAESContext = FX_Alloc(uint8_t, 2048);
@@ -288,7 +287,7 @@ bool CPDF_CryptoHandler::Init(int cipher, const uint8_t* key, int keylen) {
}
m_Cipher = cipher;
m_KeyLen = keylen;
- FXSYS_memcpy(m_EncryptKey, key, keylen);
+ memcpy(m_EncryptKey, key, keylen);
if (m_Cipher == FXCIPHER_AES) {
m_pAESContext = FX_Alloc(uint8_t, 2048);
}
@@ -333,7 +332,7 @@ CPDF_CryptoHandler::~CPDF_CryptoHandler() {
void CPDF_CryptoHandler::PopulateKey(uint32_t objnum,
uint32_t gennum,
uint8_t* key) {
- FXSYS_memcpy(key, m_EncryptKey, m_KeyLen);
+ memcpy(key, m_EncryptKey, m_KeyLen);
key[m_KeyLen + 0] = (uint8_t)objnum;
key[m_KeyLen + 1] = (uint8_t)(objnum >> 8);
key[m_KeyLen + 2] = (uint8_t)(objnum >> 16);
diff --git a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_crypto_handler.h b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_crypto_handler.h
index 63a25909505..24caff7081d 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_crypto_handler.h
+++ b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_crypto_handler.h
@@ -7,6 +7,7 @@
#ifndef CORE_FPDFAPI_PARSER_CPDF_CRYPTO_HANDLER_H_
#define CORE_FPDFAPI_PARSER_CPDF_CRYPTO_HANDLER_H_
+#include "core/fxcrt/cfx_retain_ptr.h"
#include "core/fxcrt/fx_basic.h"
#include "core/fxcrt/fx_string.h"
#include "core/fxcrt/fx_system.h"
@@ -14,16 +15,18 @@
class CPDF_Dictionary;
class CPDF_SecurityHandler;
-class CPDF_CryptoHandler {
+class CPDF_CryptoHandler : public CFX_Retainable {
public:
- CPDF_CryptoHandler();
- ~CPDF_CryptoHandler();
+ template <typename T, typename... Args>
+ friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args);
bool Init(CPDF_Dictionary* pEncryptDict,
CPDF_SecurityHandler* pSecurityHandler);
uint32_t DecryptGetSize(uint32_t src_size);
void* DecryptStart(uint32_t objnum, uint32_t gennum);
- void Decrypt(uint32_t objnum, uint32_t gennum, CFX_ByteString& str);
+ CFX_ByteString Decrypt(uint32_t objnum,
+ uint32_t gennum,
+ const CFX_ByteString& str);
bool DecryptStream(void* context,
const uint8_t* src_buf,
uint32_t src_size,
@@ -42,7 +45,11 @@ class CPDF_CryptoHandler {
bool Init(int cipher, const uint8_t* key, int keylen);
- protected:
+ private:
+ CPDF_CryptoHandler();
+ ~CPDF_CryptoHandler() override;
+
+ void PopulateKey(uint32_t objnum, uint32_t gennum, uint8_t* key);
void CryptBlock(bool bEncrypt,
uint32_t objnum,
uint32_t gennum,
@@ -62,9 +69,6 @@ class CPDF_CryptoHandler {
int m_KeyLen;
int m_Cipher;
uint8_t* m_pAESContext;
-
- private:
- void PopulateKey(uint32_t objnum, uint32_t gennum, uint8_t* key);
};
#endif // CORE_FPDFAPI_PARSER_CPDF_CRYPTO_HANDLER_H_
diff --git a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_data_avail.cpp b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_data_avail.cpp
index 64eaf2a43be..aa0b4fdad60 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_data_avail.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_data_avail.cpp
@@ -135,7 +135,8 @@ bool CPDF_DataAvail::AreObjectsAvailable(std::vector<CPDF_Object*>& obj_array,
CPDF_Array* pArray = pObj->AsArray();
for (size_t k = 0; k < pArray->GetCount(); ++k)
new_obj_array.push_back(pArray->GetObjectAt(k));
- } break;
+ break;
+ }
case CPDF_Object::STREAM:
pObj = pObj->GetDict();
case CPDF_Object::DICTIONARY: {
@@ -147,7 +148,8 @@ bool CPDF_DataAvail::AreObjectsAvailable(std::vector<CPDF_Object*>& obj_array,
if (it.first != "Parent")
new_obj_array.push_back(it.second.get());
}
- } break;
+ break;
+ }
case CPDF_Object::REFERENCE: {
CPDF_Reference* pRef = pObj->AsReference();
uint32_t dwNum = pRef->GetRefObjNum();
@@ -167,7 +169,8 @@ bool CPDF_DataAvail::AreObjectsAvailable(std::vector<CPDF_Object*>& obj_array,
if (pReferred)
new_obj_array.push_back(pReferred);
}
- } break;
+ break;
+ }
}
}
@@ -522,7 +525,8 @@ bool CPDF_DataAvail::GetPageKids(CPDF_Parser* pParser, CPDF_Object* pPages) {
if (CPDF_Reference* pRef = ToReference(pKidsArray->GetObjectAt(i)))
m_PageObjList.push_back(pRef->GetRefObjNum());
}
- } break;
+ break;
+ }
default:
m_docStatus = PDF_DATAAVAIL_ERROR;
return false;
@@ -560,22 +564,21 @@ bool CPDF_DataAvail::CheckHeader(DownloadHints* pHints) {
ASSERT(m_dwFileLen >= 0);
const uint32_t kReqSize = std::min(static_cast<uint32_t>(m_dwFileLen), 1024U);
- if (m_pFileAvail->IsDataAvail(0, kReqSize)) {
- uint8_t buffer[1024];
- m_pFileRead->ReadBlock(buffer, 0, kReqSize);
-
- if (IsLinearizedFile(buffer, kReqSize)) {
- m_docStatus = PDF_DATAAVAIL_FIRSTPAGE;
- } else {
- if (m_docStatus == PDF_DATAAVAIL_ERROR)
- return false;
- m_docStatus = PDF_DATAAVAIL_END;
- }
- return true;
+ if (!m_pFileAvail->IsDataAvail(0, kReqSize)) {
+ pHints->AddSegment(0, kReqSize);
+ return false;
}
- pHints->AddSegment(0, kReqSize);
- return false;
+ uint8_t buffer[1024];
+ m_pFileRead->ReadBlock(buffer, 0, kReqSize);
+ if (IsLinearizedFile(buffer, kReqSize)) {
+ m_docStatus = PDF_DATAAVAIL_FIRSTPAGE;
+ } else {
+ if (m_docStatus == PDF_DATAAVAIL_ERROR)
+ return false;
+ m_docStatus = PDF_DATAAVAIL_END;
+ }
+ return true;
}
bool CPDF_DataAvail::CheckFirstPage(DownloadHints* pHints) {
@@ -746,43 +749,43 @@ bool CPDF_DataAvail::CheckEnd(DownloadHints* pHints) {
uint32_t req_pos = (uint32_t)(m_dwFileLen > 1024 ? m_dwFileLen - 1024 : 0);
uint32_t dwSize = (uint32_t)(m_dwFileLen - req_pos);
- if (m_pFileAvail->IsDataAvail(req_pos, dwSize)) {
- uint8_t buffer[1024];
- m_pFileRead->ReadBlock(buffer, req_pos, dwSize);
+ if (!m_pFileAvail->IsDataAvail(req_pos, dwSize)) {
+ pHints->AddSegment(req_pos, dwSize);
+ return false;
+ }
- CFX_RetainPtr<IFX_MemoryStream> file =
- IFX_MemoryStream::Create(buffer, (size_t)dwSize, false);
- m_syntaxParser.InitParser(file, 0);
- m_syntaxParser.RestorePos(dwSize - 1);
+ uint8_t buffer[1024];
+ m_pFileRead->ReadBlock(buffer, req_pos, dwSize);
- if (m_syntaxParser.SearchWord("startxref", true, false, dwSize)) {
- m_syntaxParser.GetNextWord(nullptr);
+ CFX_RetainPtr<IFX_MemoryStream> file =
+ IFX_MemoryStream::Create(buffer, (size_t)dwSize, false);
+ m_syntaxParser.InitParser(file, 0);
+ m_syntaxParser.RestorePos(dwSize - 1);
- bool bNumber;
- CFX_ByteString xrefpos_str = m_syntaxParser.GetNextWord(&bNumber);
- if (!bNumber) {
- m_docStatus = PDF_DATAAVAIL_ERROR;
- return false;
- }
+ if (!m_syntaxParser.SearchWord("startxref", true, false, dwSize)) {
+ m_docStatus = PDF_DATAAVAIL_LOADALLFILE;
+ return true;
+ }
- m_dwXRefOffset = (FX_FILESIZE)FXSYS_atoi64(xrefpos_str.c_str());
- if (!m_dwXRefOffset || m_dwXRefOffset > m_dwFileLen) {
- m_docStatus = PDF_DATAAVAIL_LOADALLFILE;
- return true;
- }
+ m_syntaxParser.GetNextWord(nullptr);
- m_dwLastXRefOffset = m_dwXRefOffset;
- SetStartOffset(m_dwXRefOffset);
- m_docStatus = PDF_DATAAVAIL_CROSSREF;
- return true;
- }
+ bool bNumber;
+ CFX_ByteString xrefpos_str = m_syntaxParser.GetNextWord(&bNumber);
+ if (!bNumber) {
+ m_docStatus = PDF_DATAAVAIL_ERROR;
+ return false;
+ }
+ m_dwXRefOffset = (FX_FILESIZE)FXSYS_atoi64(xrefpos_str.c_str());
+ if (!m_dwXRefOffset || m_dwXRefOffset > m_dwFileLen) {
m_docStatus = PDF_DATAAVAIL_LOADALLFILE;
return true;
}
- pHints->AddSegment(req_pos, dwSize);
- return false;
+ m_dwLastXRefOffset = m_dwXRefOffset;
+ SetStartOffset(m_dwXRefOffset);
+ m_docStatus = PDF_DATAAVAIL_CROSSREF;
+ return true;
}
int32_t CPDF_DataAvail::CheckCrossRefStream(DownloadHints* pHints,
@@ -791,49 +794,50 @@ int32_t CPDF_DataAvail::CheckCrossRefStream(DownloadHints* pHints,
uint32_t req_size =
(uint32_t)(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos : 512);
- if (m_pFileAvail->IsDataAvail(m_Pos, req_size)) {
- int32_t iSize = (int32_t)(m_Pos + req_size - m_dwCurrentXRefSteam);
- CFX_BinaryBuf buf(iSize);
- uint8_t* pBuf = buf.GetBuffer();
+ if (!m_pFileAvail->IsDataAvail(m_Pos, req_size)) {
+ pHints->AddSegment(m_Pos, req_size);
+ return 0;
+ }
- m_pFileRead->ReadBlock(pBuf, m_dwCurrentXRefSteam, iSize);
+ int32_t iSize = (int32_t)(m_Pos + req_size - m_dwCurrentXRefSteam);
+ CFX_BinaryBuf buf(iSize);
+ uint8_t* pBuf = buf.GetBuffer();
- CFX_RetainPtr<IFX_MemoryStream> file =
- IFX_MemoryStream::Create(pBuf, (size_t)iSize, false);
- m_parser.m_pSyntax->InitParser(file, 0);
+ m_pFileRead->ReadBlock(pBuf, m_dwCurrentXRefSteam, iSize);
- bool bNumber;
- CFX_ByteString objnum = m_parser.m_pSyntax->GetNextWord(&bNumber);
- if (!bNumber)
- return -1;
+ CFX_RetainPtr<IFX_MemoryStream> file =
+ IFX_MemoryStream::Create(pBuf, (size_t)iSize, false);
+ m_parser.m_pSyntax->InitParser(file, 0);
- uint32_t objNum = FXSYS_atoui(objnum.c_str());
- std::unique_ptr<CPDF_Object> pObj =
- m_parser.ParseIndirectObjectAt(nullptr, 0, objNum);
+ bool bNumber;
+ CFX_ByteString objnum = m_parser.m_pSyntax->GetNextWord(&bNumber);
+ if (!bNumber)
+ return -1;
- if (!pObj) {
- m_Pos += m_parser.m_pSyntax->SavePos();
- return 0;
- }
+ uint32_t objNum = FXSYS_atoui(objnum.c_str());
+ std::unique_ptr<CPDF_Object> pObj =
+ m_parser.ParseIndirectObjectAt(nullptr, 0, objNum);
- CPDF_Dictionary* pDict = pObj->GetDict();
- CPDF_Name* pName = ToName(pDict ? pDict->GetObjectFor("Type") : nullptr);
- if (pName && pName->GetString() == "XRef") {
- m_Pos += m_parser.m_pSyntax->SavePos();
- xref_offset = pObj->GetDict()->GetIntegerFor("Prev");
- return 1;
- }
- return -1;
+ if (!pObj) {
+ m_Pos += m_parser.m_pSyntax->SavePos();
+ return 0;
}
- pHints->AddSegment(m_Pos, req_size);
- return 0;
+
+ CPDF_Dictionary* pDict = pObj->GetDict();
+ CPDF_Name* pName = ToName(pDict ? pDict->GetObjectFor("Type") : nullptr);
+ if (pName && pName->GetString() == "XRef") {
+ m_Pos += m_parser.m_pSyntax->SavePos();
+ xref_offset = pObj->GetDict()->GetIntegerFor("Prev");
+ return 1;
+ }
+ return -1;
}
void CPDF_DataAvail::SetStartOffset(FX_FILESIZE dwOffset) {
m_Pos = dwOffset;
}
-bool CPDF_DataAvail::GetNextToken(CFX_ByteString& token) {
+bool CPDF_DataAvail::GetNextToken(CFX_ByteString* token) {
uint8_t ch;
if (!GetNextChar(ch))
return false;
@@ -866,11 +870,9 @@ bool CPDF_DataAvail::GetNextToken(CFX_ByteString& token) {
if (!PDFCharIsOther(ch) && !PDFCharIsNumeric(ch)) {
m_Pos--;
- CFX_ByteString ret(buffer, index);
- token = ret;
+ *token = CFX_ByteString(buffer, index);
return true;
}
-
if (index < sizeof(buffer))
buffer[index++] = ch;
}
@@ -891,9 +893,7 @@ bool CPDF_DataAvail::GetNextToken(CFX_ByteString& token) {
else
m_Pos--;
}
-
- CFX_ByteString ret(buffer, index);
- token = ret;
+ *token = CFX_ByteString(buffer, index);
return true;
}
@@ -910,7 +910,7 @@ bool CPDF_DataAvail::GetNextToken(CFX_ByteString& token) {
}
}
- token = CFX_ByteString(buffer, index);
+ *token = CFX_ByteString(buffer, index);
return true;
}
@@ -944,8 +944,9 @@ bool CPDF_DataAvail::CheckCrossRefItem(DownloadHints* pHints) {
int32_t iSize = 0;
CFX_ByteString token;
while (1) {
- if (!GetNextToken(token)) {
- iSize = (int32_t)(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos : 512);
+ if (!GetNextToken(&token)) {
+ iSize = static_cast<int32_t>(
+ m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos : 512);
pHints->AddSegment(m_Pos, iSize);
return false;
}
@@ -960,14 +961,13 @@ bool CPDF_DataAvail::CheckCrossRefItem(DownloadHints* pHints) {
bool CPDF_DataAvail::CheckAllCrossRefStream(DownloadHints* pHints) {
FX_FILESIZE xref_offset = 0;
-
int32_t nRet = CheckCrossRefStream(pHints, xref_offset);
if (nRet == 1) {
- if (!xref_offset) {
- m_docStatus = PDF_DATAAVAIL_LOADALLCROSSREF;
- } else {
+ if (xref_offset) {
m_dwCurrentXRefSteam = xref_offset;
m_Pos = xref_offset;
+ } else {
+ m_docStatus = PDF_DATAAVAIL_LOADALLCROSSREF;
}
return true;
}
@@ -980,32 +980,33 @@ bool CPDF_DataAvail::CheckAllCrossRefStream(DownloadHints* pHints) {
bool CPDF_DataAvail::CheckCrossRef(DownloadHints* pHints) {
int32_t iSize = 0;
CFX_ByteString token;
- if (!GetNextToken(token)) {
- iSize = (int32_t)(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos : 512);
+ if (!GetNextToken(&token)) {
+ iSize = static_cast<int32_t>(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos
+ : 512);
pHints->AddSegment(m_Pos, iSize);
return false;
}
- if (token == "xref") {
- while (1) {
- if (!GetNextToken(token)) {
- iSize =
- (int32_t)(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos : 512);
- pHints->AddSegment(m_Pos, iSize);
- m_docStatus = PDF_DATAAVAIL_CROSSREF_ITEM;
- return false;
- }
-
- if (token == "trailer") {
- m_dwTrailerOffset = m_Pos;
- m_docStatus = PDF_DATAAVAIL_TRAILER;
- return true;
- }
- }
- } else {
+ if (token != "xref") {
m_docStatus = PDF_DATAAVAIL_LOADALLFILE;
return true;
}
+
+ while (1) {
+ if (!GetNextToken(&token)) {
+ iSize = static_cast<int32_t>(
+ m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos : 512);
+ pHints->AddSegment(m_Pos, iSize);
+ m_docStatus = PDF_DATAAVAIL_CROSSREF_ITEM;
+ return false;
+ }
+
+ if (token == "trailer") {
+ m_dwTrailerOffset = m_Pos;
+ m_docStatus = PDF_DATAAVAIL_TRAILER;
+ return true;
+ }
+ }
return false;
}
@@ -1033,62 +1034,65 @@ bool CPDF_DataAvail::CheckTrailerAppend(DownloadHints* pHints) {
bool CPDF_DataAvail::CheckTrailer(DownloadHints* pHints) {
int32_t iTrailerSize =
(int32_t)(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos : 512);
- if (m_pFileAvail->IsDataAvail(m_Pos, iTrailerSize)) {
- int32_t iSize = (int32_t)(m_Pos + iTrailerSize - m_dwTrailerOffset);
- CFX_BinaryBuf buf(iSize);
- uint8_t* pBuf = buf.GetBuffer();
- if (!pBuf) {
- m_docStatus = PDF_DATAAVAIL_ERROR;
- return false;
- }
+ if (!m_pFileAvail->IsDataAvail(m_Pos, iTrailerSize)) {
+ pHints->AddSegment(m_Pos, iTrailerSize);
+ return false;
+ }
- if (!m_pFileRead->ReadBlock(pBuf, m_dwTrailerOffset, iSize))
- return false;
+ int32_t iSize = (int32_t)(m_Pos + iTrailerSize - m_dwTrailerOffset);
+ CFX_BinaryBuf buf(iSize);
+ uint8_t* pBuf = buf.GetBuffer();
+ if (!pBuf) {
+ m_docStatus = PDF_DATAAVAIL_ERROR;
+ return false;
+ }
- CFX_RetainPtr<IFX_MemoryStream> file =
- IFX_MemoryStream::Create(pBuf, (size_t)iSize, false);
- m_syntaxParser.InitParser(file, 0);
+ if (!m_pFileRead->ReadBlock(pBuf, m_dwTrailerOffset, iSize))
+ return false;
- std::unique_ptr<CPDF_Object> pTrailer(
- m_syntaxParser.GetObject(nullptr, 0, 0, true));
- if (!pTrailer) {
- m_Pos += m_syntaxParser.SavePos();
- pHints->AddSegment(m_Pos, iTrailerSize);
- return false;
- }
+ CFX_RetainPtr<IFX_MemoryStream> file =
+ IFX_MemoryStream::Create(pBuf, (size_t)iSize, false);
+ m_syntaxParser.InitParser(file, 0);
+
+ std::unique_ptr<CPDF_Object> pTrailer(
+ m_syntaxParser.GetObject(nullptr, 0, 0, true));
+ if (!pTrailer) {
+ m_Pos += m_syntaxParser.SavePos();
+ pHints->AddSegment(m_Pos, iTrailerSize);
+ return false;
+ }
- if (!pTrailer->IsDictionary())
- return false;
+ if (!pTrailer->IsDictionary())
+ return false;
- CPDF_Dictionary* pTrailerDict = pTrailer->GetDict();
- CPDF_Object* pEncrypt = pTrailerDict->GetObjectFor("Encrypt");
- if (ToReference(pEncrypt)) {
- m_docStatus = PDF_DATAAVAIL_LOADALLFILE;
- return true;
- }
+ CPDF_Dictionary* pTrailerDict = pTrailer->GetDict();
+ CPDF_Object* pEncrypt = pTrailerDict->GetObjectFor("Encrypt");
+ if (ToReference(pEncrypt)) {
+ m_docStatus = PDF_DATAAVAIL_LOADALLFILE;
+ return true;
+ }
- uint32_t xrefpos = GetDirectInteger(pTrailerDict, "Prev");
- if (xrefpos) {
- m_dwPrevXRefOffset = GetDirectInteger(pTrailerDict, "XRefStm");
- if (m_dwPrevXRefOffset) {
- m_docStatus = PDF_DATAAVAIL_LOADALLFILE;
- } else {
- m_dwPrevXRefOffset = xrefpos;
- if (m_dwPrevXRefOffset >= m_dwFileLen) {
- m_docStatus = PDF_DATAAVAIL_LOADALLFILE;
- } else {
- SetStartOffset(m_dwPrevXRefOffset);
- m_docStatus = PDF_DATAAVAIL_TRAILER_APPEND;
- }
- }
- return true;
- }
+ uint32_t xrefpos = GetDirectInteger(pTrailerDict, "Prev");
+ if (!xrefpos) {
m_dwPrevXRefOffset = 0;
m_docStatus = PDF_DATAAVAIL_TRAILER_APPEND;
return true;
}
- pHints->AddSegment(m_Pos, iTrailerSize);
- return false;
+
+ m_dwPrevXRefOffset = GetDirectInteger(pTrailerDict, "XRefStm");
+ if (m_dwPrevXRefOffset) {
+ m_docStatus = PDF_DATAAVAIL_LOADALLFILE;
+ return true;
+ }
+
+ m_dwPrevXRefOffset = xrefpos;
+ if (m_dwPrevXRefOffset >= m_dwFileLen) {
+ m_docStatus = PDF_DATAAVAIL_LOADALLFILE;
+ } else {
+ SetStartOffset(m_dwPrevXRefOffset);
+ m_docStatus = PDF_DATAAVAIL_TRAILER_APPEND;
+ }
+ return true;
}
bool CPDF_DataAvail::CheckPage(uint32_t dwPage, DownloadHints* pHints) {
@@ -1172,42 +1176,47 @@ bool CPDF_DataAvail::CheckUnknownPageNode(uint32_t dwPageNo,
pPageNode->m_dwPageNo = dwPageNo;
CPDF_Dictionary* pDict = pPage->GetDict();
- CFX_ByteString type = pDict->GetStringFor("Type");
- if (type == "Pages") {
- pPageNode->m_type = PDF_PAGENODE_PAGES;
- CPDF_Object* pKids = pDict->GetObjectFor("Kids");
- if (!pKids) {
- m_docStatus = PDF_DATAAVAIL_PAGE;
- return true;
+ const CFX_ByteString type = pDict->GetStringFor("Type");
+ if (type == "Page") {
+ pPageNode->m_type = PDF_PAGENODE_PAGE;
+ return true;
+ }
+
+ if (type != "Pages") {
+ m_docStatus = PDF_DATAAVAIL_ERROR;
+ return false;
+ }
+
+ pPageNode->m_type = PDF_PAGENODE_PAGES;
+ CPDF_Object* pKids = pDict->GetObjectFor("Kids");
+ if (!pKids) {
+ m_docStatus = PDF_DATAAVAIL_PAGE;
+ return true;
+ }
+
+ switch (pKids->GetType()) {
+ case CPDF_Object::REFERENCE: {
+ CPDF_Reference* pKid = pKids->AsReference();
+ auto pNode = pdfium::MakeUnique<PageNode>();
+ pNode->m_dwPageNo = pKid->GetRefObjNum();
+ pPageNode->m_ChildNodes.push_back(std::move(pNode));
+ break;
}
+ case CPDF_Object::ARRAY: {
+ CPDF_Array* pKidsArray = pKids->AsArray();
+ for (size_t i = 0; i < pKidsArray->GetCount(); ++i) {
+ CPDF_Reference* pKid = ToReference(pKidsArray->GetObjectAt(i));
+ if (!pKid)
+ continue;
- switch (pKids->GetType()) {
- case CPDF_Object::REFERENCE: {
- CPDF_Reference* pKid = pKids->AsReference();
auto pNode = pdfium::MakeUnique<PageNode>();
pNode->m_dwPageNo = pKid->GetRefObjNum();
pPageNode->m_ChildNodes.push_back(std::move(pNode));
- } break;
- case CPDF_Object::ARRAY: {
- CPDF_Array* pKidsArray = pKids->AsArray();
- for (size_t i = 0; i < pKidsArray->GetCount(); ++i) {
- CPDF_Reference* pKid = ToReference(pKidsArray->GetObjectAt(i));
- if (!pKid)
- continue;
-
- auto pNode = pdfium::MakeUnique<PageNode>();
- pNode->m_dwPageNo = pKid->GetRefObjNum();
- pPageNode->m_ChildNodes.push_back(std::move(pNode));
- }
- } break;
- default:
- break;
+ }
+ break;
}
- } else if (type == "Page") {
- pPageNode->m_type = PDF_PAGENODE_PAGE;
- } else {
- m_docStatus = PDF_DATAAVAIL_ERROR;
- return false;
+ default:
+ break;
}
return true;
}
@@ -1403,9 +1412,8 @@ CPDF_DataAvail::DocAvailStatus CPDF_DataAvail::CheckLinearizedFirstPage(
return DataNotAvailable;
m_bAnnotsLoad = true;
}
- const bool is_page_valid = ValidatePage(dwPage);
- (void)is_page_valid;
- ASSERT(is_page_valid);
+ if (!ValidatePage(dwPage))
+ return DataError;
return DataAvailable;
}
@@ -1469,21 +1477,20 @@ CPDF_DataAvail::DocAvailStatus CPDF_DataAvail::IsPageAvail(
return GetPage(dwPage) ? DataAvailable : DataError;
}
- if (m_bMainXRefLoadedOK) {
- if (m_bTotalLoadPageTree) {
- if (!LoadPages(pHints))
- return DataNotAvailable;
- } else {
- if (!m_bCurPageDictLoadOK && !CheckPage(dwPage, pHints))
- return DataNotAvailable;
- }
- } else {
+ if (!m_bMainXRefLoadedOK) {
if (!LoadAllFile(pHints))
return DataNotAvailable;
m_pDocument->GetParser()->RebuildCrossRef();
ResetFirstCheck(dwPage);
return DataAvailable;
}
+ if (m_bTotalLoadPageTree) {
+ if (!LoadPages(pHints))
+ return DataNotAvailable;
+ } else {
+ if (!m_bCurPageDictLoadOK && !CheckPage(dwPage, pHints))
+ return DataNotAvailable;
+ }
} else {
if (!m_bTotalLoadPageTree && !m_bCurPageDictLoadOK &&
!CheckPage(dwPage, pHints)) {
@@ -1550,9 +1557,8 @@ CPDF_DataAvail::DocAvailStatus CPDF_DataAvail::IsPageAvail(
ResetFirstCheck(dwPage);
m_pagesLoadState.insert(dwPage);
- const bool is_page_valid = ValidatePage(dwPage);
- (void)is_page_valid;
- ASSERT(is_page_valid);
+ if (!ValidatePage(dwPage))
+ return DataError;
return DataAvailable;
}
@@ -1616,9 +1622,8 @@ CPDF_Dictionary* CPDF_DataAvail::GetPage(int index) {
m_pDocument->ReplaceIndirectObjectIfHigherGeneration(
dwObjNum, ParseIndirectObjectAt(0, dwObjNum, m_pDocument));
}
- const bool is_page_valid = ValidatePage(index);
- (void)is_page_valid;
- ASSERT(is_page_valid);
+ if (!ValidatePage(index))
+ return nullptr;
return m_pDocument->GetPage(index);
}
@@ -1654,9 +1659,8 @@ CPDF_DataAvail::DocFormStatus CPDF_DataAvail::IsFormAvail(
}
m_objs_array.clear();
- const bool is_form_valid = ValidateForm();
- (void)is_form_valid;
- ASSERT(is_form_valid);
+ if (!ValidateForm())
+ return FormError;
return FormAvailable;
}
diff --git a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_data_avail.h b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_data_avail.h
index 65638cff0b2..62c5d49c9d1 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_data_avail.h
+++ b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_data_avail.h
@@ -156,7 +156,7 @@ class CPDF_DataAvail final {
int32_t CheckCrossRefStream(DownloadHints* pHints, FX_FILESIZE& xref_offset);
bool IsLinearizedFile(uint8_t* pData, uint32_t dwLen);
void SetStartOffset(FX_FILESIZE dwOffset);
- bool GetNextToken(CFX_ByteString& token);
+ bool GetNextToken(CFX_ByteString* token);
bool GetNextChar(uint8_t& ch);
std::unique_ptr<CPDF_Object> ParseIndirectObjectAt(
FX_FILESIZE pos,
diff --git a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_dictionary.cpp b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_dictionary.cpp
index 40877539b53..d4e4080d313 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_dictionary.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_dictionary.cpp
@@ -68,8 +68,9 @@ std::unique_ptr<CPDF_Object> CPDF_Dictionary::CloneNonCyclic(
auto pCopy = pdfium::MakeUnique<CPDF_Dictionary>(m_pPool);
for (const auto& it : *this) {
if (!pdfium::ContainsKey(*pVisited, it.second.get())) {
- pCopy->m_Map.insert(std::make_pair(
- it.first, it.second->CloneNonCyclic(bDirect, pVisited)));
+ std::set<const CPDF_Object*> visited(*pVisited);
+ if (auto obj = it.second->CloneNonCyclic(bDirect, &visited))
+ pCopy->m_Map.insert(std::make_pair(it.first, std::move(obj)));
}
}
return std::move(pCopy);
@@ -115,7 +116,7 @@ int CPDF_Dictionary::GetIntegerFor(const CFX_ByteString& key, int def) const {
return p ? p->GetInteger() : def;
}
-FX_FLOAT CPDF_Dictionary::GetNumberFor(const CFX_ByteString& key) const {
+float CPDF_Dictionary::GetNumberFor(const CFX_ByteString& key) const {
CPDF_Object* p = GetObjectFor(key);
return p ? p->GetNumber() : 0;
}
diff --git a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_dictionary.h b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_dictionary.h
index 13cbdcf7ac9..b14574fd612 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_dictionary.h
+++ b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_dictionary.h
@@ -48,13 +48,13 @@ class CPDF_Dictionary : public CPDF_Object {
int GetIntegerFor(const CFX_ByteString& key) const;
int GetIntegerFor(const CFX_ByteString& key, int default_int) const;
bool GetBooleanFor(const CFX_ByteString& key, bool bDefault = false) const;
- FX_FLOAT GetNumberFor(const CFX_ByteString& key) const;
+ float GetNumberFor(const CFX_ByteString& key) const;
CPDF_Dictionary* GetDictFor(const CFX_ByteString& key) const;
CPDF_Stream* GetStreamFor(const CFX_ByteString& key) const;
CPDF_Array* GetArrayFor(const CFX_ByteString& key) const;
CFX_FloatRect GetRectFor(const CFX_ByteString& key) const;
CFX_Matrix GetMatrixFor(const CFX_ByteString& key) const;
- FX_FLOAT GetFloatFor(const CFX_ByteString& key) const {
+ float GetFloatFor(const CFX_ByteString& key) const {
return GetNumberFor(key);
}
diff --git a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_document.cpp b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_document.cpp
index 21eb61a9915..4d99ac910fc 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_document.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_document.cpp
@@ -231,8 +231,8 @@ CFX_ByteString FPDF_GetPSNameFromTT(HDC hDC) {
void InsertWidthArray1(CFX_Font* pFont,
CFX_UnicodeEncoding* pEncoding,
- FX_WCHAR start,
- FX_WCHAR end,
+ wchar_t start,
+ wchar_t end,
CPDF_Array* pWidthArray) {
int size = end - start + 1;
int* widths = FX_Alloc(int, size);
@@ -406,6 +406,7 @@ CPDF_Dictionary* CPDF_Document::TraversePDFPages(int iPage,
CPDF_Dictionary* pPages = m_pTreeTraversal[level].first;
CPDF_Array* pKidList = pPages->GetArrayFor("Kids");
if (!pKidList) {
+ m_pTreeTraversal.pop_back();
if (*nPagesToGo != 1)
return nullptr;
m_PageList[iPage] = pPages->GetObjNum();
@@ -477,10 +478,10 @@ bool CPDF_Document::IsPageLoaded(int iPage) const {
}
CPDF_Dictionary* CPDF_Document::GetPage(int iPage) {
- if (iPage < 0 || iPage >= pdfium::CollectionSize<int>(m_PageList))
+ if (!pdfium::IndexInBounds(m_PageList, iPage))
return nullptr;
- if (m_bLinearized && (iPage == m_iFirstPageNo)) {
+ if (m_bLinearized && iPage == m_iFirstPageNo) {
if (CPDF_Dictionary* pDict =
ToDictionary(GetOrParseIndirectObject(m_dwFirstPageObjNum))) {
return pDict;
@@ -503,9 +504,11 @@ CPDF_Dictionary* CPDF_Document::GetPage(int iPage) {
// TODO(art-snake): optimize this.
ResetTraversal();
}
- int nPagesToGo = iPage - m_iNextPageToTraverse + 1;
- if (m_pTreeTraversal.empty())
+ if (m_pTreeTraversal.empty()) {
+ ResetTraversal();
m_pTreeTraversal.push_back(std::make_pair(pPages, 0));
+ }
+ int nPagesToGo = iPage - m_iNextPageToTraverse + 1;
CPDF_Dictionary* pPage = TraversePDFPages(iPage, &nPagesToGo, 0);
m_iNextPageToTraverse = iPage + 1;
return pPage;
@@ -586,7 +589,7 @@ int CPDF_Document::GetPageIndex(uint32_t objnum) {
int found_index = FindPageIndex(pPages, &skip_count, objnum, &start_index);
// Corrupt page tree may yield out-of-range results.
- if (found_index < 0 || found_index >= pdfium::CollectionSize<int>(m_PageList))
+ if (!pdfium::IndexInBounds(m_PageList, found_index))
return -1;
m_PageList[found_index] = objnum;
@@ -627,7 +630,8 @@ CPDF_Font* CPDF_Document::LoadFont(CPDF_Dictionary* pFontDict) {
return m_pDocPage->GetFont(pFontDict);
}
-CPDF_StreamAcc* CPDF_Document::LoadFontFile(CPDF_Stream* pStream) {
+CFX_RetainPtr<CPDF_StreamAcc> CPDF_Document::LoadFontFile(
+ CPDF_Stream* pStream) {
return m_pDocPage->GetFontFileStreamAcc(pStream);
}
@@ -642,11 +646,13 @@ CPDF_Pattern* CPDF_Document::LoadPattern(CPDF_Object* pPatternObj,
return m_pDocPage->GetPattern(pPatternObj, bShading, matrix);
}
-CPDF_IccProfile* CPDF_Document::LoadIccProfile(CPDF_Stream* pStream) {
+CFX_RetainPtr<CPDF_IccProfile> CPDF_Document::LoadIccProfile(
+ CPDF_Stream* pStream) {
return m_pDocPage->GetIccProfile(pStream);
}
-CPDF_Image* CPDF_Document::LoadImageFromPageData(uint32_t dwStreamObjNum) {
+CFX_RetainPtr<CPDF_Image> CPDF_Document::LoadImageFromPageData(
+ uint32_t dwStreamObjNum) {
ASSERT(dwStreamObjNum);
return m_pDocPage->GetImage(dwStreamObjNum);
}
@@ -765,7 +771,7 @@ void CPDF_Document::DeletePage(int iPage) {
m_PageList.erase(m_PageList.begin() + iPage);
}
-CPDF_Font* CPDF_Document::AddStandardFont(const FX_CHAR* font,
+CPDF_Font* CPDF_Document::AddStandardFont(const char* font,
CPDF_FontEncoding* pEncoding) {
CFX_ByteString name(font);
if (PDF_GetStandardFontName(&name) < 0)
@@ -804,7 +810,7 @@ CPDF_Dictionary* CPDF_Document::ProcessbCJK(
int charset,
bool bVert,
CFX_ByteString basefont,
- std::function<void(FX_WCHAR, FX_WCHAR, CPDF_Array*)> Insert) {
+ std::function<void(wchar_t, wchar_t, CPDF_Array*)> Insert) {
CPDF_Dictionary* pFontDict = NewIndirect<CPDF_Dictionary>();
CFX_ByteString cmap;
CFX_ByteString ordering;
@@ -914,12 +920,11 @@ CPDF_Font* CPDF_Document::AddFont(CFX_Font* pFont, int charset, bool bVert) {
ProcessNonbCJK(pBaseDict, pFont->IsBold(), pFont->IsItalic(), basefont,
std::move(pWidths));
} else {
- pFontDict = ProcessbCJK(pBaseDict, charset, bVert, basefont,
- [pFont, &pEncoding](FX_WCHAR start, FX_WCHAR end,
- CPDF_Array* widthArr) {
- InsertWidthArray1(pFont, pEncoding.get(), start,
- end, widthArr);
- });
+ pFontDict = ProcessbCJK(
+ pBaseDict, charset, bVert, basefont,
+ [pFont, &pEncoding](wchar_t start, wchar_t end, CPDF_Array* widthArr) {
+ InsertWidthArray1(pFont, pEncoding.get(), start, end, widthArr);
+ });
}
int italicangle =
pFont->GetSubstFont() ? pFont->GetSubstFont()->m_ItalicAngle : 0;
@@ -934,7 +939,7 @@ CPDF_Font* CPDF_Document::AddFont(CFX_Font* pFont, int charset, bool bVert) {
if (pFont->GetSubstFont()) {
nStemV = pFont->GetSubstFont()->m_Weight / 5;
} else {
- static const FX_CHAR stem_chars[] = {'i', 'I', '!', '1'};
+ static const char stem_chars[] = {'i', 'I', '!', '1'};
const size_t count = FX_ArraySize(stem_chars);
uint32_t glyph = pEncoding->GlyphFromCharCode(stem_chars[0]);
nStemV = pFont->GetGlyphWidth(glyph);
@@ -958,12 +963,13 @@ CPDF_Font* CPDF_Document::AddWindowsFont(LOGFONTW* pLogFont,
bool bVert,
bool bTranslateName) {
LOGFONTA lfa;
- FXSYS_memcpy(&lfa, pLogFont, (char*)lfa.lfFaceName - (char*)&lfa);
+ memcpy(&lfa, pLogFont, (char*)lfa.lfFaceName - (char*)&lfa);
CFX_ByteString face = CFX_ByteString::FromUnicode(pLogFont->lfFaceName);
if (face.GetLength() >= LF_FACESIZE)
return nullptr;
- FXSYS_strcpy(lfa.lfFaceName, face.c_str());
+ strncpy(lfa.lfFaceName, face.c_str(),
+ (face.GetLength() + 1) * sizeof(CFX_ByteString::CharType));
return AddWindowsFont(&lfa, bVert, bTranslateName);
}
@@ -1032,7 +1038,7 @@ CPDF_Font* CPDF_Document::AddWindowsFont(LOGFONTA* pLogFont,
} else {
pFontDict =
ProcessbCJK(pBaseDict, pLogFont->lfCharSet, bVert, basefont,
- [&hDC](FX_WCHAR start, FX_WCHAR end, CPDF_Array* widthArr) {
+ [&hDC](wchar_t start, wchar_t end, CPDF_Array* widthArr) {
InsertWidthArray(hDC, start, end, widthArr);
});
}
diff --git a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_document.h b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_document.h
index 3848ad62209..8d3525419fe 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_document.h
+++ b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_document.h
@@ -13,6 +13,7 @@
#include <utility>
#include <vector>
+#include "core/fpdfapi/page/cpdf_image.h"
#include "core/fpdfapi/parser/cpdf_indirect_object_holder.h"
#include "core/fpdfapi/parser/cpdf_object.h"
#include "core/fpdfdoc/cpdf_linklist.h"
@@ -26,7 +27,6 @@ class CPDF_DocRenderData;
class CPDF_Font;
class CPDF_FontEncoding;
class CPDF_IccProfile;
-class CPDF_Image;
class CPDF_LinearizedHeader;
class CPDF_Parser;
class CPDF_Pattern;
@@ -78,9 +78,9 @@ class CPDF_Document : public CPDF_IndirectObjectHolder {
bool bShading,
const CFX_Matrix& matrix);
- CPDF_Image* LoadImageFromPageData(uint32_t dwStreamObjNum);
- CPDF_StreamAcc* LoadFontFile(CPDF_Stream* pStream);
- CPDF_IccProfile* LoadIccProfile(CPDF_Stream* pStream);
+ CFX_RetainPtr<CPDF_Image> LoadImageFromPageData(uint32_t dwStreamObjNum);
+ CFX_RetainPtr<CPDF_StreamAcc> LoadFontFile(CPDF_Stream* pStream);
+ CFX_RetainPtr<CPDF_IccProfile> LoadIccProfile(CPDF_Stream* pStream);
void LoadDoc();
void LoadLinearizedDoc(const CPDF_LinearizedHeader* pLinearizationParams);
@@ -89,7 +89,7 @@ class CPDF_Document : public CPDF_IndirectObjectHolder {
void CreateNewDoc();
CPDF_Dictionary* CreateNewPage(int iPage);
- CPDF_Font* AddStandardFont(const FX_CHAR* font, CPDF_FontEncoding* pEncoding);
+ CPDF_Font* AddStandardFont(const char* font, CPDF_FontEncoding* pEncoding);
CPDF_Font* AddFont(CFX_Font* pFont, int charset, bool bVert);
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
CPDF_Font* AddWindowsFont(LOGFONTA* pLogFont,
@@ -119,7 +119,7 @@ class CPDF_Document : public CPDF_IndirectObjectHolder {
int charset,
bool bVert,
CFX_ByteString basefont,
- std::function<void(FX_WCHAR, FX_WCHAR, CPDF_Array*)> Insert);
+ std::function<void(wchar_t, wchar_t, CPDF_Array*)> Insert);
bool InsertDeletePDFPage(CPDF_Dictionary* pPages,
int nPagesToGo,
CPDF_Dictionary* pPageDict,
diff --git a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_document_unittest.cpp b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_document_unittest.cpp
index 4815ffba520..f052af3aec2 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_document_unittest.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_document_unittest.cpp
@@ -12,6 +12,7 @@
#include "core/fpdfapi/parser/cpdf_boolean.h"
#include "core/fpdfapi/parser/cpdf_dictionary.h"
#include "core/fpdfapi/parser/cpdf_linearized_header.h"
+#include "core/fpdfapi/parser/cpdf_name.h"
#include "core/fpdfapi/parser/cpdf_number.h"
#include "core/fpdfapi/parser/cpdf_parser.h"
#include "core/fpdfapi/parser/cpdf_reference.h"
@@ -22,6 +23,8 @@
namespace {
+const int kNumTestPages = 7;
+
CPDF_Dictionary* CreatePageTreeNode(std::unique_ptr<CPDF_Array> kids,
CPDF_Document* pDoc,
int count) {
@@ -82,13 +85,18 @@ class CPDF_TestDocumentForPages : public CPDF_Document {
allPages->AddNew<CPDF_Reference>(this, branch3->GetObjNum());
allPages->AddNew<CPDF_Reference>(this, branch4->GetObjNum());
CPDF_Dictionary* pagesDict =
- CreatePageTreeNode(std::move(allPages), this, 7);
+ CreatePageTreeNode(std::move(allPages), this, kNumTestPages);
m_pOwnedRootDict = pdfium::MakeUnique<CPDF_Dictionary>();
m_pOwnedRootDict->SetNewFor<CPDF_Reference>("Pages", this,
pagesDict->GetObjNum());
m_pRootDict = m_pOwnedRootDict.get();
- m_PageList.resize(7);
+ m_PageList.resize(kNumTestPages);
+ }
+
+ void SetTreeSize(int size) {
+ m_pOwnedRootDict->SetNewFor<CPDF_Number>("Count", size);
+ m_PageList.resize(size);
}
private:
@@ -124,6 +132,23 @@ class TestLinearized : public CPDF_LinearizedHeader {
explicit TestLinearized(CPDF_Dictionary* dict)
: CPDF_LinearizedHeader(dict) {}
};
+
+class CPDF_TestDocPagesWithoutKids : public CPDF_Document {
+ public:
+ CPDF_TestDocPagesWithoutKids() : CPDF_Document(nullptr) {
+ CPDF_Dictionary* pagesDict = NewIndirect<CPDF_Dictionary>();
+ pagesDict->SetNewFor<CPDF_Name>("Type", "Pages");
+ pagesDict->SetNewFor<CPDF_Number>("Count", 3);
+ m_PageList.resize(10);
+ m_pOwnedRootDict = pdfium::MakeUnique<CPDF_Dictionary>();
+ m_pOwnedRootDict->SetNewFor<CPDF_Reference>("Pages", this,
+ pagesDict->GetObjNum());
+ m_pRootDict = m_pOwnedRootDict.get();
+ }
+
+ private:
+ std::unique_ptr<CPDF_Dictionary> m_pOwnedRootDict;
+};
} // namespace
class cpdf_document_test : public testing::Test {
@@ -138,13 +163,13 @@ class cpdf_document_test : public testing::Test {
TEST_F(cpdf_document_test, GetPages) {
std::unique_ptr<CPDF_TestDocumentForPages> document =
pdfium::MakeUnique<CPDF_TestDocumentForPages>();
- for (int i = 0; i < 7; i++) {
+ for (int i = 0; i < kNumTestPages; i++) {
CPDF_Dictionary* page = document->GetPage(i);
ASSERT_TRUE(page);
ASSERT_TRUE(page->KeyExist("PageNumbering"));
EXPECT_EQ(i, page->GetIntegerFor("PageNumbering"));
}
- CPDF_Dictionary* page = document->GetPage(7);
+ CPDF_Dictionary* page = document->GetPage(kNumTestPages);
EXPECT_FALSE(page);
}
@@ -169,7 +194,7 @@ TEST_F(cpdf_document_test, GetPagesReverseOrder) {
ASSERT_TRUE(page->KeyExist("PageNumbering"));
EXPECT_EQ(i, page->GetIntegerFor("PageNumbering"));
}
- CPDF_Dictionary* page = document->GetPage(7);
+ CPDF_Dictionary* page = document->GetPage(kNumTestPages);
EXPECT_FALSE(page);
}
@@ -187,7 +212,7 @@ TEST_F(cpdf_document_test, GetPagesInDisorder) {
ASSERT_TRUE(page->KeyExist("PageNumbering"));
EXPECT_EQ(3, page->GetIntegerFor("PageNumbering"));
- page = document->GetPage(7);
+ page = document->GetPage(kNumTestPages);
EXPECT_FALSE(page);
page = document->GetPage(6);
@@ -219,3 +244,25 @@ TEST_F(cpdf_document_test, UseCachedPageObjNumIfHaveNotPagesDict) {
EXPECT_TRUE(document.IsPageLoaded(test_page_num));
EXPECT_EQ(page_stub, document.GetPage(test_page_num));
}
+
+TEST_F(cpdf_document_test, CountGreaterThanPageTree) {
+ std::unique_ptr<CPDF_TestDocumentForPages> document =
+ pdfium::MakeUnique<CPDF_TestDocumentForPages>();
+ document->SetTreeSize(kNumTestPages + 3);
+ for (int i = 0; i < kNumTestPages; i++)
+ EXPECT_TRUE(document->GetPage(i));
+ for (int i = kNumTestPages; i < kNumTestPages + 4; i++)
+ EXPECT_FALSE(document->GetPage(i));
+ EXPECT_TRUE(document->GetPage(kNumTestPages - 1));
+}
+
+TEST_F(cpdf_document_test, PagesWithoutKids) {
+ // Set up a document with Pages dict without kids, and Count = 3
+ auto pDoc = pdfium::MakeUnique<CPDF_TestDocPagesWithoutKids>();
+ EXPECT_TRUE(pDoc->GetPage(0));
+ // Test GetPage does not fetch pages out of range
+ for (int i = 1; i < 5; i++)
+ EXPECT_FALSE(pDoc->GetPage(i));
+
+ EXPECT_TRUE(pDoc->GetPage(0));
+}
diff --git a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_hint_tables.cpp b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_hint_tables.cpp
index e000188e7d6..24abf5dd134 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_hint_tables.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_hint_tables.cpp
@@ -464,10 +464,10 @@ bool CPDF_HintTables::LoadHintStream(CPDF_Stream* pHintStream) {
if (shared_hint_table_offset <= 0)
return false;
- CPDF_StreamAcc acc;
- acc.LoadAllData(pHintStream);
+ auto pAcc = pdfium::MakeRetain<CPDF_StreamAcc>(pHintStream);
+ pAcc->LoadAllData();
- uint32_t size = acc.GetSize();
+ uint32_t size = pAcc->GetSize();
// The header section of page offset hint table is 36 bytes.
// The header section of shared object hint table is 24 bytes.
// Hint table has at least 60 bytes.
@@ -482,7 +482,7 @@ bool CPDF_HintTables::LoadHintStream(CPDF_Stream* pHintStream) {
}
CFX_BitStream bs;
- bs.Init(acc.GetData(), size);
+ bs.Init(pAcc->GetData(), size);
return ReadPageHintTable(&bs) &&
ReadSharedObjHintTable(&bs, shared_hint_table_offset);
}
diff --git a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_number.cpp b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_number.cpp
index 24feb2a2e05..c83b9dcd380 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_number.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_number.cpp
@@ -11,7 +11,7 @@ CPDF_Number::CPDF_Number() : m_bInteger(true), m_Integer(0) {}
CPDF_Number::CPDF_Number(int value) : m_bInteger(true), m_Integer(value) {}
-CPDF_Number::CPDF_Number(FX_FLOAT value) : m_bInteger(false), m_Float(value) {}
+CPDF_Number::CPDF_Number(float value) : m_bInteger(false), m_Float(value) {}
CPDF_Number::CPDF_Number(const CFX_ByteStringC& str)
: m_bInteger(FX_atonum(str, &m_Integer)) {}
@@ -27,8 +27,8 @@ std::unique_ptr<CPDF_Object> CPDF_Number::Clone() const {
: pdfium::MakeUnique<CPDF_Number>(m_Float);
}
-FX_FLOAT CPDF_Number::GetNumber() const {
- return m_bInteger ? static_cast<FX_FLOAT>(m_Integer) : m_Float;
+float CPDF_Number::GetNumber() const {
+ return m_bInteger ? static_cast<float>(m_Integer) : m_Float;
}
int CPDF_Number::GetInteger() const {
diff --git a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_number.h b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_number.h
index 85a78e5f1a7..6e85044d2ab 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_number.h
+++ b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_number.h
@@ -17,7 +17,7 @@ class CPDF_Number : public CPDF_Object {
public:
CPDF_Number();
explicit CPDF_Number(int value);
- explicit CPDF_Number(FX_FLOAT value);
+ explicit CPDF_Number(float value);
explicit CPDF_Number(const CFX_ByteStringC& str);
~CPDF_Number() override;
@@ -25,7 +25,7 @@ class CPDF_Number : public CPDF_Object {
Type GetType() const override;
std::unique_ptr<CPDF_Object> Clone() const override;
CFX_ByteString GetString() const override;
- FX_FLOAT GetNumber() const override;
+ float GetNumber() const override;
int GetInteger() const override;
void SetString(const CFX_ByteString& str) override;
bool IsNumber() const override;
@@ -38,7 +38,7 @@ class CPDF_Number : public CPDF_Object {
bool m_bInteger;
union {
int m_Integer;
- FX_FLOAT m_Float;
+ float m_Float;
};
};
diff --git a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_object.cpp b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_object.cpp
index acda334c9ef..f0ff81eeed3 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_object.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_object.cpp
@@ -46,7 +46,7 @@ CFX_WideString CPDF_Object::GetUnicodeText() const {
return CFX_WideString();
}
-FX_FLOAT CPDF_Object::GetNumber() const {
+float CPDF_Object::GetNumber() const {
return 0;
}
diff --git a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_object.h b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_object.h
index f6bc5b444f4..616573724b8 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_object.h
+++ b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_object.h
@@ -56,7 +56,7 @@ class CPDF_Object {
virtual CPDF_Object* GetDirect() const;
virtual CFX_ByteString GetString() const;
virtual CFX_WideString GetUnicodeText() const;
- virtual FX_FLOAT GetNumber() const;
+ virtual float GetNumber() const;
virtual int GetInteger() const;
virtual CPDF_Dictionary* GetDict() const;
diff --git a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_object_unittest.cpp b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_object_unittest.cpp
index 927b1064745..1923992d7a4 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_object_unittest.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_object_unittest.cpp
@@ -162,8 +162,8 @@ class PDFObjectsTest : public testing::Test {
// streams need to be handled.
if (!stream1->IsMemoryBased() || !stream2->IsMemoryBased())
return false;
- return FXSYS_memcmp(stream1->GetRawData(), stream2->GetRawData(),
- stream1->GetRawSize()) == 0;
+ return memcmp(stream1->GetRawData(), stream2->GetRawData(),
+ stream1->GetRawSize()) == 0;
}
case CPDF_Object::REFERENCE:
return obj1->AsReference()->GetRefObjNum() ==
@@ -218,14 +218,14 @@ TEST_F(PDFObjectsTest, GetUnicodeText) {
}
TEST_F(PDFObjectsTest, GetNumber) {
- const FX_FLOAT direct_obj_results[] = {0, 0, 1245, 9.00345f, 0, 0,
- 0, 0, 0, 0, 0};
+ const float direct_obj_results[] = {0, 0, 1245, 9.00345f, 0, 0,
+ 0, 0, 0, 0, 0};
// Check for direct objects.
for (size_t i = 0; i < m_DirectObjs.size(); ++i)
EXPECT_EQ(direct_obj_results[i], m_DirectObjs[i]->GetNumber());
// Check indirect references.
- const FX_FLOAT indirect_obj_results[] = {0, 1245, 0, 0, 0, 0, 0};
+ const float indirect_obj_results[] = {0, 1245, 0, 0, 0, 0, 0};
for (size_t i = 0; i < m_RefObjs.size(); ++i)
EXPECT_EQ(indirect_obj_results[i], m_RefObjs[i]->GetNumber());
}
@@ -484,8 +484,8 @@ TEST(PDFArrayTest, GetTypeAt) {
// String and name array
const char* const vals[] = {"this", "adsde$%^", "\r\t", "\"012",
".", "EYREW", "It is a joke :)"};
- std::unique_ptr<CPDF_Array> string_array(new CPDF_Array);
- std::unique_ptr<CPDF_Array> name_array(new CPDF_Array);
+ auto string_array = pdfium::MakeUnique<CPDF_Array>();
+ auto name_array = pdfium::MakeUnique<CPDF_Array>();
for (size_t i = 0; i < FX_ArraySize(vals); ++i) {
string_array->InsertNewAt<CPDF_String>(i, vals[i], false);
name_array->InsertNewAt<CPDF_Name>(i, vals[i]);
@@ -695,8 +695,8 @@ TEST(PDFArrayTest, AddInteger) {
TEST(PDFArrayTest, AddStringAndName) {
const char* vals[] = {"", "a", "ehjhRIOYTTFdfcdnv", "122323",
"$#%^&**", " ", "This is a test.\r\n"};
- std::unique_ptr<CPDF_Array> string_array(new CPDF_Array);
- std::unique_ptr<CPDF_Array> name_array(new CPDF_Array);
+ auto string_array = pdfium::MakeUnique<CPDF_Array>();
+ auto name_array = pdfium::MakeUnique<CPDF_Array>();
for (size_t i = 0; i < FX_ArraySize(vals); ++i) {
string_array->AddNew<CPDF_String>(vals[i], false);
name_array->AddNew<CPDF_Name>(vals[i]);
@@ -710,8 +710,7 @@ TEST(PDFArrayTest, AddStringAndName) {
}
TEST(PDFArrayTest, AddReferenceAndGetObjectAt) {
- std::unique_ptr<CPDF_IndirectObjectHolder> holder(
- new CPDF_IndirectObjectHolder());
+ auto holder = pdfium::MakeUnique<CPDF_IndirectObjectHolder>();
CPDF_Boolean* boolean_obj = new CPDF_Boolean(true);
CPDF_Number* int_obj = new CPDF_Number(-1234);
CPDF_Number* float_obj = new CPDF_Number(2345.089f);
@@ -723,7 +722,7 @@ TEST(PDFArrayTest, AddReferenceAndGetObjectAt) {
str_obj, name_obj, null_obj};
unsigned int obj_nums[] = {2, 4, 7, 2345, 799887, 1};
auto arr = pdfium::MakeUnique<CPDF_Array>();
- std::unique_ptr<CPDF_Array> arr1(new CPDF_Array);
+ auto arr1 = pdfium::MakeUnique<CPDF_Array>();
// Create two arrays of references by different AddReference() APIs.
for (size_t i = 0; i < FX_ArraySize(indirect_objs); ++i) {
holder->ReplaceIndirectObjectIfHigherGeneration(
@@ -748,7 +747,7 @@ TEST(PDFArrayTest, AddReferenceAndGetObjectAt) {
TEST(PDFArrayTest, CloneDirectObject) {
CPDF_IndirectObjectHolder objects_holder;
- std::unique_ptr<CPDF_Array> array(new CPDF_Array);
+ auto array = pdfium::MakeUnique<CPDF_Array>();
array->AddNew<CPDF_Reference>(&objects_holder, 1234);
ASSERT_EQ(1U, array->GetCount());
CPDF_Object* obj = array->GetObjectAt(0);
@@ -761,7 +760,7 @@ TEST(PDFArrayTest, CloneDirectObject) {
std::unique_ptr<CPDF_Array> cloned_array =
ToArray(std::move(cloned_array_object));
- ASSERT_EQ(1U, cloned_array->GetCount());
+ ASSERT_EQ(0U, cloned_array->GetCount());
CPDF_Object* cloned_obj = cloned_array->GetObjectAt(0);
EXPECT_FALSE(cloned_obj);
}
@@ -782,7 +781,7 @@ TEST(PDFArrayTest, ConvertIndirect) {
TEST(PDFDictionaryTest, CloneDirectObject) {
CPDF_IndirectObjectHolder objects_holder;
- std::unique_ptr<CPDF_Dictionary> dict(new CPDF_Dictionary());
+ auto dict = pdfium::MakeUnique<CPDF_Dictionary>();
dict->SetNewFor<CPDF_Reference>("foo", &objects_holder, 1234);
ASSERT_EQ(1U, dict->GetCount());
CPDF_Object* obj = dict->GetObjectFor("foo");
@@ -795,7 +794,7 @@ TEST(PDFDictionaryTest, CloneDirectObject) {
std::unique_ptr<CPDF_Dictionary> cloned_dict =
ToDictionary(std::move(cloned_dict_object));
- ASSERT_EQ(1U, cloned_dict->GetCount());
+ ASSERT_EQ(0U, cloned_dict->GetCount());
CPDF_Object* cloned_obj = cloned_dict->GetObjectFor("foo");
EXPECT_FALSE(cloned_obj);
}
@@ -859,7 +858,7 @@ TEST(PDFObjectTest, CloneCheckLoop) {
CPDF_Object* cloned_arr = cloned_dict->GetObjectFor("arr");
ASSERT_TRUE(cloned_arr);
ASSERT_TRUE(cloned_arr->IsArray());
- EXPECT_EQ(1u, cloned_arr->AsArray()->GetCount());
+ EXPECT_EQ(0U, cloned_arr->AsArray()->GetCount());
// Recursively referenced object is not cloned.
EXPECT_EQ(nullptr, cloned_arr->AsArray()->GetObjectAt(0));
}
@@ -867,7 +866,7 @@ TEST(PDFObjectTest, CloneCheckLoop) {
TEST(PDFDictionaryTest, ConvertIndirect) {
CPDF_IndirectObjectHolder objects_holder;
- std::unique_ptr<CPDF_Dictionary> dict(new CPDF_Dictionary);
+ auto dict = pdfium::MakeUnique<CPDF_Dictionary>();
CPDF_Object* pObj = dict->SetNewFor<CPDF_Number>("clams", 42);
dict->ConvertToIndirectObjectFor("clams", &objects_holder);
CPDF_Object* pRef = dict->GetObjectFor("clams");
diff --git a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_parser.cpp b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_parser.cpp
index f9d9eb3a979..f009798058c 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_parser.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_parser.cpp
@@ -40,11 +40,11 @@ uint32_t GetVarInt(const uint8_t* p, int32_t n) {
return result;
}
-int32_t GetStreamNCount(CPDF_StreamAcc* pObjStream) {
+int32_t GetStreamNCount(const CFX_RetainPtr<CPDF_StreamAcc>& pObjStream) {
return pObjStream->GetDict()->GetIntegerFor("N");
}
-int32_t GetStreamFirst(CPDF_StreamAcc* pObjStream) {
+int32_t GetStreamFirst(const CFX_RetainPtr<CPDF_StreamAcc>& pObjStream) {
return pObjStream->GetDict()->GetIntegerFor("First");
}
@@ -100,8 +100,8 @@ void CPDF_Parser::SetEncryptDictionary(CPDF_Dictionary* pDict) {
m_pEncryptDict = pDict;
}
-CPDF_CryptoHandler* CPDF_Parser::GetCryptoHandler() {
- return m_pSyntax->m_pCryptoHandler.get();
+CFX_RetainPtr<CPDF_CryptoHandler> CPDF_Parser::GetCryptoHandler() const {
+ return m_pSyntax->m_pCryptoHandler;
}
CFX_RetainPtr<IFX_SeekableReadStream> CPDF_Parser::GetFileAccess() const {
@@ -143,13 +143,13 @@ CPDF_Parser::Error CPDF_Parser::StartParse(
return FORMAT_ERROR;
if (std::isdigit(ch))
- m_FileVersion = FXSYS_toDecimalDigit(static_cast<FX_WCHAR>(ch)) * 10;
+ m_FileVersion = FXSYS_toDecimalDigit(static_cast<wchar_t>(ch)) * 10;
if (!m_pSyntax->GetCharAt(7, ch))
return FORMAT_ERROR;
if (std::isdigit(ch))
- m_FileVersion += FXSYS_toDecimalDigit(static_cast<FX_WCHAR>(ch));
+ m_FileVersion += FXSYS_toDecimalDigit(static_cast<wchar_t>(ch));
if (m_pSyntax->m_FileLen < m_pSyntax->m_HeaderOffset + 9)
return FORMAT_ERROR;
@@ -240,30 +240,25 @@ CPDF_Parser::Error CPDF_Parser::SetEncryptHandler() {
if (m_pEncryptDict) {
CFX_ByteString filter = m_pEncryptDict->GetStringFor("Filter");
- std::unique_ptr<CPDF_SecurityHandler> pSecurityHandler;
- Error err = HANDLER_ERROR;
- if (filter == "Standard") {
- pSecurityHandler = pdfium::MakeUnique<CPDF_SecurityHandler>();
- err = PASSWORD_ERROR;
- }
- if (!pSecurityHandler)
+ if (filter != "Standard")
return HANDLER_ERROR;
+ std::unique_ptr<CPDF_SecurityHandler> pSecurityHandler =
+ pdfium::MakeUnique<CPDF_SecurityHandler>();
if (!pSecurityHandler->OnInit(this, m_pEncryptDict))
- return err;
+ return PASSWORD_ERROR;
m_pSecurityHandler = std::move(pSecurityHandler);
- std::unique_ptr<CPDF_CryptoHandler> pCryptoHandler(
- m_pSecurityHandler->CreateCryptoHandler());
+ auto pCryptoHandler = pdfium::MakeRetain<CPDF_CryptoHandler>();
if (!pCryptoHandler->Init(m_pEncryptDict, m_pSecurityHandler.get()))
return HANDLER_ERROR;
- m_pSyntax->SetEncrypt(std::move(pCryptoHandler));
+ m_pSyntax->SetEncrypt(pCryptoHandler);
}
return SUCCESS;
}
void CPDF_Parser::ReleaseEncryptHandler() {
- m_pSyntax->m_pCryptoHandler.reset();
+ m_pSyntax->m_pCryptoHandler.Reset();
m_pSecurityHandler.reset();
}
@@ -627,7 +622,7 @@ bool CPDF_Parser::RebuildCrossRef() {
if (std::isdigit(byte)) {
start_pos = pos + i;
state = ParserState::kObjNum;
- objnum = FXSYS_toDecimalDigit(static_cast<FX_WCHAR>(byte));
+ objnum = FXSYS_toDecimalDigit(static_cast<wchar_t>(byte));
} else if (byte == 't') {
state = ParserState::kTrailer;
inside_index = 1;
@@ -643,7 +638,7 @@ bool CPDF_Parser::RebuildCrossRef() {
case ParserState::kObjNum:
if (std::isdigit(byte)) {
objnum =
- objnum * 10 + FXSYS_toDecimalDigit(static_cast<FX_WCHAR>(byte));
+ objnum * 10 + FXSYS_toDecimalDigit(static_cast<wchar_t>(byte));
} else if (PDFCharIsWhitespace(byte)) {
state = ParserState::kPostObjNum;
} else {
@@ -657,7 +652,7 @@ bool CPDF_Parser::RebuildCrossRef() {
if (std::isdigit(byte)) {
start_pos1 = pos + i;
state = ParserState::kGenNum;
- gennum = FXSYS_toDecimalDigit(static_cast<FX_WCHAR>(byte));
+ gennum = FXSYS_toDecimalDigit(static_cast<wchar_t>(byte));
} else if (byte == 't') {
state = ParserState::kTrailer;
inside_index = 1;
@@ -670,7 +665,7 @@ bool CPDF_Parser::RebuildCrossRef() {
case ParserState::kGenNum:
if (std::isdigit(byte)) {
gennum =
- gennum * 10 + FXSYS_toDecimalDigit(static_cast<FX_WCHAR>(byte));
+ gennum * 10 + FXSYS_toDecimalDigit(static_cast<wchar_t>(byte));
} else if (PDFCharIsWhitespace(byte)) {
state = ParserState::kPostGenNum;
} else {
@@ -685,7 +680,7 @@ bool CPDF_Parser::RebuildCrossRef() {
inside_index = 1;
} else if (std::isdigit(byte)) {
objnum = gennum;
- gennum = FXSYS_toDecimalDigit(static_cast<FX_WCHAR>(byte));
+ gennum = FXSYS_toDecimalDigit(static_cast<wchar_t>(byte));
start_pos = start_pos1;
start_pos1 = pos + i;
state = ParserState::kGenNum;
@@ -997,11 +992,11 @@ bool CPDF_Parser::LoadCrossRefV5(FX_FILESIZE* pos, bool bMainXRef) {
return false;
uint32_t totalWidth = dwAccWidth.ValueOrDie();
- CPDF_StreamAcc acc;
- acc.LoadAllData(pStream);
+ auto pAcc = pdfium::MakeRetain<CPDF_StreamAcc>(pStream);
+ pAcc->LoadAllData();
- const uint8_t* pData = acc.GetData();
- uint32_t dwTotalSize = acc.GetSize();
+ const uint8_t* pData = pAcc->GetData();
+ uint32_t dwTotalSize = pAcc->GetSize();
uint32_t segindex = 0;
for (uint32_t i = 0; i < arrIndex.size(); i++) {
int32_t startnum = arrIndex[i].first;
@@ -1114,7 +1109,8 @@ std::unique_ptr<CPDF_Object> CPDF_Parser::ParseIndirectObject(
if (GetObjectType(objnum) != 2)
return nullptr;
- CPDF_StreamAcc* pObjStream = GetObjectStream(m_ObjectInfo[objnum].pos);
+ CFX_RetainPtr<CPDF_StreamAcc> pObjStream =
+ GetObjectStream(m_ObjectInfo[objnum].pos);
if (!pObjStream)
return nullptr;
@@ -1141,10 +1137,10 @@ std::unique_ptr<CPDF_Object> CPDF_Parser::ParseIndirectObject(
return syntax.GetObject(pObjList, 0, 0, true);
}
-CPDF_StreamAcc* CPDF_Parser::GetObjectStream(uint32_t objnum) {
+CFX_RetainPtr<CPDF_StreamAcc> CPDF_Parser::GetObjectStream(uint32_t objnum) {
auto it = m_ObjectStreamMap.find(objnum);
if (it != m_ObjectStreamMap.end())
- return it->second.get();
+ return it->second;
if (!m_pDocument)
return nullptr;
@@ -1154,9 +1150,9 @@ CPDF_StreamAcc* CPDF_Parser::GetObjectStream(uint32_t objnum) {
if (!pStream)
return nullptr;
- CPDF_StreamAcc* pStreamAcc = new CPDF_StreamAcc;
- pStreamAcc->LoadAllData(pStream);
- m_ObjectStreamMap[objnum].reset(pStreamAcc);
+ auto pStreamAcc = pdfium::MakeRetain<CPDF_StreamAcc>(pStream);
+ pStreamAcc->LoadAllData();
+ m_ObjectStreamMap[objnum] = pStreamAcc;
return pStreamAcc;
}
@@ -1190,7 +1186,8 @@ void CPDF_Parser::GetIndirectBinary(uint32_t objnum,
return;
if (GetObjectType(objnum) == 2) {
- CPDF_StreamAcc* pObjStream = GetObjectStream(m_ObjectInfo[objnum].pos);
+ CFX_RetainPtr<CPDF_StreamAcc> pObjStream =
+ GetObjectStream(m_ObjectInfo[objnum].pos);
if (!pObjStream)
return;
@@ -1217,7 +1214,7 @@ void CPDF_Parser::GetIndirectBinary(uint32_t objnum,
}
pBuffer = FX_Alloc(uint8_t, size);
- FXSYS_memcpy(pBuffer, pData + thisoff + offset, size);
+ memcpy(pBuffer, pData + thisoff + offset, size);
return;
}
return;
diff --git a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_parser.h b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_parser.h
index f8ff7a17ec0..7ae2d4627e6 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_parser.h
+++ b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_parser.h
@@ -48,7 +48,7 @@ class CPDF_Parser {
Error StartLinearizedParse(const CFX_RetainPtr<IFX_SeekableReadStream>& pFile,
CPDF_Document* pDocument);
- void SetPassword(const FX_CHAR* password) { m_Password = password; }
+ void SetPassword(const char* password) { m_Password = password; }
CFX_ByteString GetPassword() { return m_Password; }
CPDF_Dictionary* GetTrailer() const { return m_pTrailer.get(); }
FX_FILESIZE GetLastXRefOffset() const { return m_LastXRefOffset; }
@@ -71,7 +71,7 @@ class CPDF_Parser {
uint16_t GetObjectGenNum(uint32_t objnum) const;
bool IsVersionUpdated() const { return m_bVersionUpdated; }
bool IsObjectFreeOrNull(uint32_t objnum) const;
- CPDF_CryptoHandler* GetCryptoHandler();
+ CFX_RetainPtr<CPDF_CryptoHandler> GetCryptoHandler() const;
CFX_RetainPtr<IFX_SeekableReadStream> GetFileAccess() const;
FX_FILESIZE GetObjectOffset(uint32_t objnum) const;
@@ -140,7 +140,7 @@ class CPDF_Parser {
bool LoadLinearizedCrossRefV4(FX_FILESIZE pos, uint32_t dwObjCount);
bool LoadLinearizedAllCrossRefV5(FX_FILESIZE pos);
Error LoadLinearizedMainXRefTable();
- CPDF_StreamAcc* GetObjectStream(uint32_t number);
+ CFX_RetainPtr<CPDF_StreamAcc> GetObjectStream(uint32_t number);
bool IsLinearizedFile(
const CFX_RetainPtr<IFX_SeekableReadStream>& pFileAccess,
uint32_t offset);
@@ -165,8 +165,8 @@ class CPDF_Parser {
std::unique_ptr<CPDF_LinearizedHeader> m_pLinearized;
uint32_t m_dwXrefStartObjNum;
- // A map of object numbers to indirect streams. Map owns the streams.
- std::map<uint32_t, std::unique_ptr<CPDF_StreamAcc>> m_ObjectStreamMap;
+ // A map of object numbers to indirect streams.
+ std::map<uint32_t, CFX_RetainPtr<CPDF_StreamAcc>> m_ObjectStreamMap;
// Mapping of object numbers to offsets. The offsets are relative to the first
// object in the stream.
@@ -174,7 +174,7 @@ class CPDF_Parser {
// Mapping of streams to their object caches. This is valid as long as the
// streams in |m_ObjectStreamMap| are valid.
- std::map<CPDF_StreamAcc*, StreamObjectCache> m_ObjCache;
+ std::map<CFX_RetainPtr<CPDF_StreamAcc>, StreamObjectCache> m_ObjCache;
// All indirect object numbers that are being parsed.
std::set<uint32_t> m_ParsingObjNums;
diff --git a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_parser_unittest.cpp b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_parser_unittest.cpp
index 3518f7d16bf..a90477f9302 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_parser_unittest.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_parser_unittest.cpp
@@ -49,7 +49,7 @@ class CPDF_TestParser : public CPDF_Parser {
~CPDF_TestParser() {}
// Setup reading from a file and initial states.
- bool InitTestFromFile(const FX_CHAR* path) {
+ bool InitTestFromFile(const char* path) {
CFX_RetainPtr<IFX_SeekableReadStream> pFileAccess =
IFX_SeekableReadStream::CreateFromFilename(path);
if (!pFileAccess)
diff --git a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_reference.cpp b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_reference.cpp
index 67b67c24dd1..942bae58bae 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_reference.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_reference.cpp
@@ -24,7 +24,7 @@ CFX_ByteString CPDF_Reference::GetString() const {
return obj ? obj->GetString() : CFX_ByteString();
}
-FX_FLOAT CPDF_Reference::GetNumber() const {
+float CPDF_Reference::GetNumber() const {
CPDF_Object* obj = SafeGetDirect();
return obj ? obj->GetNumber() : 0;
}
diff --git a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_reference.h b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_reference.h
index be7f18478e9..ff8875572c7 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_reference.h
+++ b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_reference.h
@@ -24,7 +24,7 @@ class CPDF_Reference : public CPDF_Object {
std::unique_ptr<CPDF_Object> Clone() const override;
CPDF_Object* GetDirect() const override;
CFX_ByteString GetString() const override;
- FX_FLOAT GetNumber() const override;
+ float GetNumber() const override;
int GetInteger() const override;
CPDF_Dictionary* GetDict() const override;
bool IsReference() const override;
diff --git a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_security_handler.cpp b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_security_handler.cpp
index 61834fca133..4ea5da3497e 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_security_handler.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_security_handler.cpp
@@ -52,7 +52,7 @@ void CalcEncryptKey(CPDF_Dictionary* pEncrypt,
}
if (!bIgnoreMeta && revision >= 3 &&
!pEncrypt->GetIntegerFor("EncryptMetadata", 1)) {
- uint32_t tag = (uint32_t)-1;
+ uint32_t tag = 0xFFFFFFFF;
CRYPT_MD5Update(&md5, (uint8_t*)&tag, 4);
}
uint8_t digest[16];
@@ -66,8 +66,8 @@ void CalcEncryptKey(CPDF_Dictionary* pEncrypt,
CRYPT_MD5Generate(digest, copy_len, digest);
}
}
- FXSYS_memset(key, 0, keylen);
- FXSYS_memcpy(key, digest, copy_len);
+ memset(key, 0, keylen);
+ memcpy(key, digest, copy_len);
}
} // namespace
@@ -84,10 +84,6 @@ CPDF_SecurityHandler::CPDF_SecurityHandler()
CPDF_SecurityHandler::~CPDF_SecurityHandler() {}
-CPDF_CryptoHandler* CPDF_SecurityHandler::CreateCryptoHandler() {
- return new CPDF_CryptoHandler;
-}
-
bool CPDF_SecurityHandler::OnInit(CPDF_Parser* pParser,
CPDF_Dictionary* pEncryptDict) {
m_pParser = pParser;
@@ -303,7 +299,7 @@ void Revision6_Hash(const uint8_t* password,
}
FX_Free(aes);
if (hash) {
- FXSYS_memcpy(hash, input, 32);
+ memcpy(hash, input, 32);
}
}
@@ -337,7 +333,7 @@ bool CPDF_SecurityHandler::AES256_CheckPassword(const uint8_t* password,
CRYPT_SHA256Finish(&sha, digest);
}
- if (FXSYS_memcmp(digest, pkey, 32) != 0)
+ if (memcmp(digest, pkey, 32) != 0)
return false;
if (!key)
@@ -364,7 +360,7 @@ bool CPDF_SecurityHandler::AES256_CheckPassword(const uint8_t* password,
std::vector<uint8_t> aes(2048);
CRYPT_AESSetKey(aes.data(), 16, digest, 32, false);
uint8_t iv[16];
- FXSYS_memset(iv, 0, 16);
+ memset(iv, 0, 16);
CRYPT_AESSetIV(aes.data(), iv);
CRYPT_AESDecrypt(aes.data(), key, ekey.raw_str(), 32);
CRYPT_AESSetKey(aes.data(), 16, key, 32, false);
@@ -374,10 +370,10 @@ bool CPDF_SecurityHandler::AES256_CheckPassword(const uint8_t* password,
return false;
uint8_t perms_buf[16];
- FXSYS_memset(perms_buf, 0, sizeof(perms_buf));
+ memset(perms_buf, 0, sizeof(perms_buf));
size_t copy_len =
std::min(sizeof(perms_buf), static_cast<size_t>(perms.GetLength()));
- FXSYS_memcpy(perms_buf, perms.raw_str(), copy_len);
+ memcpy(perms_buf, perms.raw_str(), copy_len);
uint8_t buf[16];
CRYPT_AESDecrypt(aes.data(), buf, perms_buf, 16);
if (buf[9] != 'a' || buf[10] != 'd' || buf[11] != 'b')
@@ -425,7 +421,7 @@ bool CPDF_SecurityHandler::CheckUserPassword(const uint8_t* password,
}
uint8_t ukeybuf[32];
if (m_Revision == 2) {
- FXSYS_memcpy(ukeybuf, defpasscode, 32);
+ memcpy(ukeybuf, defpasscode, 32);
CRYPT_ArcFourCryptBlock(ukeybuf, 32, key, key_len);
} else {
uint8_t test[32], tmpkey[32];
@@ -433,9 +429,9 @@ bool CPDF_SecurityHandler::CheckUserPassword(const uint8_t* password,
if (copy_len > (uint32_t)ukey.GetLength()) {
copy_len = ukey.GetLength();
}
- FXSYS_memset(test, 0, sizeof(test));
- FXSYS_memset(tmpkey, 0, sizeof(tmpkey));
- FXSYS_memcpy(test, ukey.c_str(), copy_len);
+ memset(test, 0, sizeof(test));
+ memset(tmpkey, 0, sizeof(tmpkey));
+ memcpy(test, ukey.c_str(), copy_len);
for (int32_t i = 19; i >= 0; i--) {
for (int j = 0; j < key_len; j++)
tmpkey[j] = key[j] ^ static_cast<uint8_t>(i);
@@ -450,13 +446,11 @@ bool CPDF_SecurityHandler::CheckUserPassword(const uint8_t* password,
CRYPT_MD5Update(&md5, (uint8_t*)id.c_str(), id.GetLength());
}
CRYPT_MD5Finish(&md5, ukeybuf);
- return FXSYS_memcmp(test, ukeybuf, 16) == 0;
+ return memcmp(test, ukeybuf, 16) == 0;
}
- if (FXSYS_memcmp((void*)ukey.c_str(), ukeybuf, 16) == 0) {
- return true;
- }
- return false;
+ return memcmp(ukey.c_str(), ukeybuf, 16) == 0;
}
+
CFX_ByteString CPDF_SecurityHandler::GetUserPassword(const uint8_t* owner_pass,
uint32_t pass_size,
int32_t key_len) {
@@ -473,25 +467,25 @@ CFX_ByteString CPDF_SecurityHandler::GetUserPassword(const uint8_t* owner_pass,
}
}
uint8_t enckey[32];
- FXSYS_memset(enckey, 0, sizeof(enckey));
+ memset(enckey, 0, sizeof(enckey));
uint32_t copy_len = key_len;
if (copy_len > sizeof(digest)) {
copy_len = sizeof(digest);
}
- FXSYS_memcpy(enckey, digest, copy_len);
+ memcpy(enckey, digest, copy_len);
int okeylen = okey.GetLength();
if (okeylen > 32) {
okeylen = 32;
}
uint8_t okeybuf[64];
- FXSYS_memset(okeybuf, 0, sizeof(okeybuf));
- FXSYS_memcpy(okeybuf, okey.c_str(), okeylen);
+ memset(okeybuf, 0, sizeof(okeybuf));
+ memcpy(okeybuf, okey.c_str(), okeylen);
if (m_Revision == 2) {
CRYPT_ArcFourCryptBlock(okeybuf, okeylen, enckey, key_len);
} else {
for (int32_t i = 19; i >= 0; i--) {
uint8_t tempkey[32];
- FXSYS_memset(tempkey, 0, sizeof(tempkey));
+ memset(tempkey, 0, sizeof(tempkey));
for (int j = 0; j < m_KeyLen; j++)
tempkey[j] = enckey[j] ^ static_cast<uint8_t>(i);
CRYPT_ArcFourCryptBlock(okeybuf, okeylen, tempkey, key_len);
@@ -567,7 +561,7 @@ void CPDF_SecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict,
CRYPT_MD5Generate(digest, 16, digest);
}
uint8_t enckey[32];
- FXSYS_memcpy(enckey, digest, key_len);
+ memcpy(enckey, digest, key_len);
for (uint32_t i = 0; i < 32; i++) {
passcode[i] = i < user_size ? user_pass[i] : defpasscode[i - user_size];
}
@@ -587,7 +581,7 @@ void CPDF_SecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict,
key_len, false, pIdArray);
if (m_Revision < 3) {
uint8_t tempbuf[32];
- FXSYS_memcpy(tempbuf, defpasscode, 32);
+ memcpy(tempbuf, defpasscode, 32);
CRYPT_ArcFourCryptBlock(tempbuf, 32, m_EncryptKey, key_len);
pEncryptDict->SetNewFor<CPDF_String>("U", CFX_ByteString(tempbuf, 32),
false);
@@ -660,7 +654,7 @@ void CPDF_SecurityHandler::AES256_SetPassword(CPDF_Dictionary* pEncryptDict,
}
CRYPT_SHA256Finish(&sha2, digest1);
}
- FXSYS_memcpy(digest1 + 32, digest, 16);
+ memcpy(digest1 + 32, digest, 16);
pEncryptDict->SetNewFor<CPDF_String>(bOwner ? "O" : "U",
CFX_ByteString(digest1, 48), false);
if (m_Revision >= 6) {
@@ -678,7 +672,7 @@ void CPDF_SecurityHandler::AES256_SetPassword(CPDF_Dictionary* pEncryptDict,
uint8_t* aes = FX_Alloc(uint8_t, 2048);
CRYPT_AESSetKey(aes, 16, digest1, 32, true);
uint8_t iv[16];
- FXSYS_memset(iv, 0, 16);
+ memset(iv, 0, 16);
CRYPT_AESSetIV(aes, iv);
CRYPT_AESEncrypt(aes, digest1, key, 32);
FX_Free(aes);
@@ -706,7 +700,7 @@ void CPDF_SecurityHandler::AES256_SetPerms(CPDF_Dictionary* pEncryptDict,
uint8_t* aes = FX_Alloc(uint8_t, 2048);
CRYPT_AESSetKey(aes, 16, key, 32, true);
uint8_t iv[16], buf1[16];
- FXSYS_memset(iv, 0, 16);
+ memset(iv, 0, 16);
CRYPT_AESSetIV(aes, iv);
CRYPT_AESEncrypt(aes, buf1, buf, 16);
FX_Free(aes);
diff --git a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_security_handler.h b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_security_handler.h
index 1a41b67195e..93a4e4ff61c 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_security_handler.h
+++ b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_security_handler.h
@@ -7,6 +7,7 @@
#ifndef CORE_FPDFAPI_PARSER_CPDF_SECURITY_HANDLER_H_
#define CORE_FPDFAPI_PARSER_CPDF_SECURITY_HANDLER_H_
+#include "core/fpdfapi/parser/cpdf_crypto_handler.h"
#include "core/fxcrt/fx_string.h"
#include "core/fxcrt/fx_system.h"
@@ -18,7 +19,6 @@
#define PDF_ENCRYPT_CONTENT 0
class CPDF_Array;
-class CPDF_CryptoHandler;
class CPDF_Dictionary;
class CPDF_Parser;
@@ -31,7 +31,6 @@ class CPDF_SecurityHandler {
uint32_t GetPermissions();
bool GetCryptInfo(int& cipher, const uint8_t*& buffer, int& keylen);
bool IsMetadataEncrypted() const;
- CPDF_CryptoHandler* CreateCryptoHandler();
void OnCreate(CPDF_Dictionary* pEncryptDict,
CPDF_Array* pIdArray,
diff --git a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_stream.cpp b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_stream.cpp
index d62b45641b3..e4f279a32dd 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_stream.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_stream.cpp
@@ -57,7 +57,7 @@ void CPDF_Stream::InitStream(const uint8_t* pData,
m_pFile = nullptr;
m_pDataBuf.reset(FX_Alloc(uint8_t, size));
if (pData)
- FXSYS_memcpy(m_pDataBuf.get(), pData, size);
+ memcpy(m_pDataBuf.get(), pData, size);
m_dwSize = size;
if (m_pDict)
m_pDict->SetNewFor<CPDF_Number>("Length", static_cast<int>(m_dwSize));
@@ -83,17 +83,17 @@ std::unique_ptr<CPDF_Object> CPDF_Stream::CloneNonCyclic(
bool bDirect,
std::set<const CPDF_Object*>* pVisited) const {
pVisited->insert(this);
- CPDF_StreamAcc acc;
- acc.LoadAllData(this, true);
+ auto pAcc = pdfium::MakeRetain<CPDF_StreamAcc>(this);
+ pAcc->LoadAllData(true);
- uint32_t streamSize = acc.GetSize();
+ uint32_t streamSize = pAcc->GetSize();
CPDF_Dictionary* pDict = GetDict();
std::unique_ptr<CPDF_Dictionary> pNewDict;
if (pDict && !pdfium::ContainsKey(*pVisited, pDict)) {
pNewDict = ToDictionary(
static_cast<CPDF_Object*>(pDict)->CloneNonCyclic(bDirect, pVisited));
}
- return pdfium::MakeUnique<CPDF_Stream>(acc.DetachData(), streamSize,
+ return pdfium::MakeUnique<CPDF_Stream>(pAcc->DetachData(), streamSize,
std::move(pNewDict));
}
@@ -101,7 +101,7 @@ void CPDF_Stream::SetData(const uint8_t* pData, uint32_t size) {
m_bMemoryBased = true;
m_pDataBuf.reset(FX_Alloc(uint8_t, size));
if (pData)
- FXSYS_memcpy(m_pDataBuf.get(), pData, size);
+ memcpy(m_pDataBuf.get(), pData, size);
m_dwSize = size;
if (!m_pDict)
m_pDict = pdfium::MakeUnique<CPDF_Dictionary>();
@@ -117,7 +117,7 @@ bool CPDF_Stream::ReadRawData(FX_FILESIZE offset,
return m_pFile->ReadBlock(buf, offset, size);
if (m_pDataBuf)
- FXSYS_memcpy(buf, m_pDataBuf.get() + offset, size);
+ memcpy(buf, m_pDataBuf.get() + offset, size);
return true;
}
@@ -127,7 +127,7 @@ bool CPDF_Stream::HasFilter() const {
}
CFX_WideString CPDF_Stream::GetUnicodeText() const {
- CPDF_StreamAcc stream;
- stream.LoadAllData(this, false);
- return PDF_DecodeText(stream.GetData(), stream.GetSize());
+ auto pAcc = pdfium::MakeRetain<CPDF_StreamAcc>(this);
+ pAcc->LoadAllData(false);
+ return PDF_DecodeText(pAcc->GetData(), pAcc->GetSize());
}
diff --git a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_stream_acc.cpp b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_stream_acc.cpp
index 423de7c571d..fe333e4d2bc 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_stream_acc.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_stream_acc.cpp
@@ -8,52 +8,50 @@
#include "core/fpdfapi/parser/fpdf_parser_decode.h"
-CPDF_StreamAcc::CPDF_StreamAcc()
+CPDF_StreamAcc::CPDF_StreamAcc(const CPDF_Stream* pStream)
: m_pData(nullptr),
m_dwSize(0),
m_bNewBuf(false),
m_pImageParam(nullptr),
- m_pStream(nullptr),
+ m_pStream(pStream),
m_pSrcData(nullptr) {}
-void CPDF_StreamAcc::LoadAllData(const CPDF_Stream* pStream,
- bool bRawAccess,
+void CPDF_StreamAcc::LoadAllData(bool bRawAccess,
uint32_t estimated_size,
bool bImageAcc) {
- if (!pStream)
+ if (!m_pStream)
return;
- m_pStream = pStream;
- if (pStream->IsMemoryBased() && (!pStream->HasFilter() || bRawAccess)) {
- m_dwSize = pStream->GetRawSize();
- m_pData = pStream->GetRawData();
+ if (m_pStream->IsMemoryBased() && (!m_pStream->HasFilter() || bRawAccess)) {
+ m_dwSize = m_pStream->GetRawSize();
+ m_pData = m_pStream->GetRawData();
return;
}
- uint32_t dwSrcSize = pStream->GetRawSize();
+ uint32_t dwSrcSize = m_pStream->GetRawSize();
if (dwSrcSize == 0)
return;
uint8_t* pSrcData;
- if (!pStream->IsMemoryBased()) {
+ if (!m_pStream->IsMemoryBased()) {
pSrcData = m_pSrcData = FX_Alloc(uint8_t, dwSrcSize);
- if (!pStream->ReadRawData(0, pSrcData, dwSrcSize))
+ if (!m_pStream->ReadRawData(0, pSrcData, dwSrcSize))
return;
} else {
- pSrcData = pStream->GetRawData();
+ pSrcData = m_pStream->GetRawData();
}
- if (!pStream->HasFilter() || bRawAccess) {
+ if (!m_pStream->HasFilter() || bRawAccess) {
m_pData = pSrcData;
m_dwSize = dwSrcSize;
} else if (!PDF_DataDecode(pSrcData, dwSrcSize, m_pStream->GetDict(), m_pData,
- m_dwSize, m_ImageDecoder, m_pImageParam,
+ m_dwSize, &m_ImageDecoder, m_pImageParam,
estimated_size, bImageAcc)) {
m_pData = pSrcData;
m_dwSize = dwSrcSize;
}
- if (pSrcData != pStream->GetRawData() && pSrcData != m_pData)
+ if (pSrcData != m_pStream->GetRawData() && pSrcData != m_pData)
FX_Free(pSrcData);
m_pSrcData = nullptr;
- m_bNewBuf = m_pData != pStream->GetRawData();
+ m_bNewBuf = m_pData != m_pStream->GetRawData();
}
CPDF_StreamAcc::~CPDF_StreamAcc() {
@@ -82,6 +80,6 @@ std::unique_ptr<uint8_t, FxFreeDeleter> CPDF_StreamAcc::DetachData() {
return p;
}
std::unique_ptr<uint8_t, FxFreeDeleter> p(FX_Alloc(uint8_t, m_dwSize));
- FXSYS_memcpy(p.get(), m_pData, m_dwSize);
+ memcpy(p.get(), m_pData, m_dwSize);
return p;
}
diff --git a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_stream_acc.h b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_stream_acc.h
index 51a8a183325..5bfdd186c47 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_stream_acc.h
+++ b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_stream_acc.h
@@ -11,19 +11,19 @@
#include "core/fpdfapi/parser/cpdf_dictionary.h"
#include "core/fpdfapi/parser/cpdf_stream.h"
+#include "core/fxcrt/cfx_retain_ptr.h"
#include "core/fxcrt/fx_string.h"
#include "core/fxcrt/fx_system.h"
-class CPDF_StreamAcc {
+class CPDF_StreamAcc : public CFX_Retainable {
public:
- CPDF_StreamAcc();
- ~CPDF_StreamAcc();
+ template <typename T, typename... Args>
+ friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args);
CPDF_StreamAcc(const CPDF_StreamAcc&) = delete;
CPDF_StreamAcc& operator=(const CPDF_StreamAcc&) = delete;
- void LoadAllData(const CPDF_Stream* pStream,
- bool bRawAccess = false,
+ void LoadAllData(bool bRawAccess = false,
uint32_t estimated_size = 0,
bool bImageAcc = false);
@@ -39,12 +39,15 @@ class CPDF_StreamAcc {
std::unique_ptr<uint8_t, FxFreeDeleter> DetachData();
protected:
+ explicit CPDF_StreamAcc(const CPDF_Stream* pStream);
+ ~CPDF_StreamAcc() override;
+
uint8_t* m_pData;
uint32_t m_dwSize;
bool m_bNewBuf;
CFX_ByteString m_ImageDecoder;
CPDF_Dictionary* m_pImageParam;
- const CPDF_Stream* m_pStream;
+ const CPDF_Stream* const m_pStream;
uint8_t* m_pSrcData;
};
diff --git a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_syntax_parser.cpp b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_syntax_parser.cpp
index 1b81b98c96b..7b7495dfc64 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_syntax_parser.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_syntax_parser.cpp
@@ -225,7 +225,7 @@ CFX_ByteString CPDF_SyntaxParser::ReadString() {
break;
case ReadStatus::Backslash:
if (ch >= '0' && ch <= '7') {
- iEscCode = FXSYS_toDecimalDigit(static_cast<FX_WCHAR>(ch));
+ iEscCode = FXSYS_toDecimalDigit(static_cast<wchar_t>(ch));
status = ReadStatus::Octal;
break;
}
@@ -251,7 +251,7 @@ CFX_ByteString CPDF_SyntaxParser::ReadString() {
case ReadStatus::Octal:
if (ch >= '0' && ch <= '7') {
iEscCode =
- iEscCode * 8 + FXSYS_toDecimalDigit(static_cast<FX_WCHAR>(ch));
+ iEscCode * 8 + FXSYS_toDecimalDigit(static_cast<wchar_t>(ch));
status = ReadStatus::FinishOctal;
} else {
buf.AppendChar(iEscCode);
@@ -263,7 +263,7 @@ CFX_ByteString CPDF_SyntaxParser::ReadString() {
status = ReadStatus::Normal;
if (ch >= '0' && ch <= '7') {
iEscCode =
- iEscCode * 8 + FXSYS_toDecimalDigit(static_cast<FX_WCHAR>(ch));
+ iEscCode * 8 + FXSYS_toDecimalDigit(static_cast<wchar_t>(ch));
buf.AppendChar(iEscCode);
} else {
buf.AppendChar(iEscCode);
@@ -358,7 +358,7 @@ void CPDF_SyntaxParser::ToNextWord() {
CFX_ByteString CPDF_SyntaxParser::GetNextWord(bool* bIsNumber) {
GetNextWordInternal(bIsNumber);
- return CFX_ByteString((const FX_CHAR*)m_WordBuffer, m_WordSize);
+ return CFX_ByteString((const char*)m_WordBuffer, m_WordSize);
}
CFX_ByteString CPDF_SyntaxParser::GetKeyword() {
@@ -405,13 +405,13 @@ std::unique_ptr<CPDF_Object> CPDF_SyntaxParser::GetObject(
if (word == "(") {
CFX_ByteString str = ReadString();
if (m_pCryptoHandler && bDecrypt)
- m_pCryptoHandler->Decrypt(objnum, gennum, str);
+ str = m_pCryptoHandler->Decrypt(objnum, gennum, str);
return pdfium::MakeUnique<CPDF_String>(m_pPool, str, false);
}
if (word == "<") {
CFX_ByteString str = ReadHexString();
if (m_pCryptoHandler && bDecrypt)
- m_pCryptoHandler->Decrypt(objnum, gennum, str);
+ str = m_pCryptoHandler->Decrypt(objnum, gennum, str);
return pdfium::MakeUnique<CPDF_String>(m_pPool, str, true);
}
if (word == "[") {
@@ -526,17 +526,17 @@ std::unique_ptr<CPDF_Object> CPDF_SyntaxParser::GetObjectForStrict(
if (word == "(") {
CFX_ByteString str = ReadString();
if (m_pCryptoHandler)
- m_pCryptoHandler->Decrypt(objnum, gennum, str);
+ str = m_pCryptoHandler->Decrypt(objnum, gennum, str);
return pdfium::MakeUnique<CPDF_String>(m_pPool, str, false);
}
if (word == "<") {
CFX_ByteString str = ReadHexString();
if (m_pCryptoHandler)
- m_pCryptoHandler->Decrypt(objnum, gennum, str);
+ str = m_pCryptoHandler->Decrypt(objnum, gennum, str);
return pdfium::MakeUnique<CPDF_String>(m_pPool, str, true);
}
if (word == "[") {
- std::unique_ptr<CPDF_Array> pArray = pdfium::MakeUnique<CPDF_Array>();
+ auto pArray = pdfium::MakeUnique<CPDF_Array>();
while (std::unique_ptr<CPDF_Object> pObj =
GetObject(pObjList, objnum, gennum, true)) {
pArray->Add(std::move(pObj));
@@ -635,7 +635,7 @@ std::unique_ptr<CPDF_Stream> CPDF_SyntaxParser::ReadStream(
const CFX_ByteStringC kEndObjStr("endobj");
CPDF_CryptoHandler* pCryptoHandler =
- objnum == m_MetadataObjnum ? nullptr : m_pCryptoHandler.get();
+ objnum == m_MetadataObjnum ? nullptr : m_pCryptoHandler.Get();
if (!pCryptoHandler) {
bool bSearchForKeyword = true;
if (len >= 0) {
@@ -645,13 +645,13 @@ std::unique_ptr<CPDF_Stream> CPDF_SyntaxParser::ReadStream(
m_Pos = pos.ValueOrDie();
m_Pos += ReadEOLMarkers(m_Pos);
- FXSYS_memset(m_WordBuffer, 0, kEndStreamStr.GetLength() + 1);
+ memset(m_WordBuffer, 0, kEndStreamStr.GetLength() + 1);
GetNextWordInternal(nullptr);
// Earlier version of PDF specification doesn't require EOL marker before
// 'endstream' keyword. If keyword 'endstream' follows the bytes in
// specified length, it signals the end of stream.
- if (FXSYS_memcmp(m_WordBuffer, kEndStreamStr.raw_str(),
- kEndStreamStr.GetLength()) == 0) {
+ if (memcmp(m_WordBuffer, kEndStreamStr.raw_str(),
+ kEndStreamStr.GetLength()) == 0) {
bSearchForKeyword = false;
}
}
@@ -724,6 +724,10 @@ std::unique_ptr<CPDF_Stream> CPDF_SyntaxParser::ReadStream(
}
m_Pos = streamStartPos;
}
+ // Read up to the end of the buffer. Note, we allow zero length streams as
+ // we need to pass them through when we are importing pages into a new
+ // document.
+ len = std::min(len, m_FileLen - m_Pos - m_HeaderOffset);
if (len < 0)
return nullptr;
@@ -742,18 +746,16 @@ std::unique_ptr<CPDF_Stream> CPDF_SyntaxParser::ReadStream(
pData = dest_buf.DetachBuffer();
}
}
-
auto pStream =
pdfium::MakeUnique<CPDF_Stream>(std::move(pData), len, std::move(pDict));
streamStartPos = m_Pos;
- FXSYS_memset(m_WordBuffer, 0, kEndObjStr.GetLength() + 1);
+ memset(m_WordBuffer, 0, kEndObjStr.GetLength() + 1);
GetNextWordInternal(nullptr);
int numMarkers = ReadEOLMarkers(m_Pos);
if (m_WordSize == static_cast<unsigned int>(kEndObjStr.GetLength()) &&
numMarkers != 0 &&
- FXSYS_memcmp(m_WordBuffer, kEndObjStr.raw_str(),
- kEndObjStr.GetLength()) == 0) {
+ memcmp(m_WordBuffer, kEndObjStr.raw_str(), kEndObjStr.GetLength()) == 0) {
m_Pos = streamStartPos;
}
return pStream;
@@ -781,7 +783,7 @@ uint32_t CPDF_SyntaxParser::GetDirectNum() {
return 0;
m_WordBuffer[m_WordSize] = 0;
- return FXSYS_atoui(reinterpret_cast<const FX_CHAR*>(m_WordBuffer));
+ return FXSYS_atoui(reinterpret_cast<const char*>(m_WordBuffer));
}
bool CPDF_SyntaxParser::IsWholeWord(FX_FILESIZE startpos,
@@ -909,6 +911,6 @@ FX_FILESIZE CPDF_SyntaxParser::FindTag(const CFX_ByteStringC& tag,
}
void CPDF_SyntaxParser::SetEncrypt(
- std::unique_ptr<CPDF_CryptoHandler> pCryptoHandler) {
- m_pCryptoHandler = std::move(pCryptoHandler);
+ const CFX_RetainPtr<CPDF_CryptoHandler>& pCryptoHandler) {
+ m_pCryptoHandler = pCryptoHandler;
}
diff --git a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_syntax_parser.h b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_syntax_parser.h
index 8dd9103f1b7..9c2d84070de 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_syntax_parser.h
+++ b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_syntax_parser.h
@@ -51,7 +51,7 @@ class CPDF_SyntaxParser {
FX_FILESIZE limit);
FX_FILESIZE FindTag(const CFX_ByteStringC& tag, FX_FILESIZE limit);
- void SetEncrypt(std::unique_ptr<CPDF_CryptoHandler> pCryptoHandler);
+ void SetEncrypt(const CFX_RetainPtr<CPDF_CryptoHandler>& pCryptoHandler);
bool ReadBlock(uint8_t* pBuf, uint32_t size);
bool GetCharAt(FX_FILESIZE pos, uint8_t& ch);
CFX_ByteString GetNextWord(bool* bIsNumber);
@@ -95,7 +95,7 @@ class CPDF_SyntaxParser {
uint8_t* m_pFileBuf;
uint32_t m_BufSize;
FX_FILESIZE m_BufOffset;
- std::unique_ptr<CPDF_CryptoHandler> m_pCryptoHandler;
+ CFX_RetainPtr<CPDF_CryptoHandler> m_pCryptoHandler;
uint8_t m_WordBuffer[257];
uint32_t m_WordSize;
CFX_WeakPtr<CFX_ByteStringPool> m_pPool;
diff --git a/chromium/third_party/pdfium/core/fpdfapi/parser/fpdf_parser_decode.cpp b/chromium/third_party/pdfium/core/fpdfapi/parser/fpdf_parser_decode.cpp
index 480e2c111f4..cc8b507025c 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/parser/fpdf_parser_decode.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/parser/fpdf_parser_decode.cpp
@@ -101,9 +101,9 @@ uint32_t A85Decode(const uint8_t* src_buf,
// Count the space needed to contain non-zero characters. The encoding ratio
// of Ascii85 is 4:5.
uint32_t space_for_non_zeroes = (pos - zcount) / 5 * 4 + 4;
- if (zcount > (UINT_MAX - space_for_non_zeroes) / 4) {
- return (uint32_t)-1;
- }
+ if (zcount > (UINT_MAX - space_for_non_zeroes) / 4)
+ return 0xFFFFFFFF;
+
dest_buf = FX_Alloc(uint8_t, zcount * 4 + space_for_non_zeroes);
size_t state = 0;
uint32_t res = 0;
@@ -114,7 +114,7 @@ uint32_t A85Decode(const uint8_t* src_buf,
continue;
if (ch == 'z') {
- FXSYS_memset(dest_buf + dest_size, 0, 4);
+ memset(dest_buf + dest_size, 0, 4);
state = 0;
res = 0;
dest_size += 4;
@@ -226,9 +226,9 @@ uint32_t RunLengthDecode(const uint8_t* src_buf,
if (buf_left < copy_len) {
uint32_t delta = copy_len - buf_left;
copy_len = buf_left;
- FXSYS_memset(dest_buf + dest_count + copy_len, '\0', delta);
+ memset(dest_buf + dest_count + copy_len, '\0', delta);
}
- FXSYS_memcpy(dest_buf + dest_count, src_buf + i + 1, copy_len);
+ memcpy(dest_buf + dest_count, src_buf + i + 1, copy_len);
dest_count += src_buf[i] + 1;
i += src_buf[i] + 2;
} else {
@@ -236,7 +236,7 @@ uint32_t RunLengthDecode(const uint8_t* src_buf,
if (i < src_size - 1) {
fill = src_buf[i + 1];
}
- FXSYS_memset(dest_buf + dest_count, fill, 257 - src_buf[i]);
+ memset(dest_buf + dest_count, fill, 257 - src_buf[i]);
dest_count += 257 - src_buf[i];
i += 2;
}
@@ -315,7 +315,7 @@ uint32_t FPDFAPI_FlateOrLZWDecode(bool bLZW,
BitsPerComponent = pParams->GetIntegerFor("BitsPerComponent", 8);
Columns = pParams->GetIntegerFor("Columns", 1);
if (!CheckFlateDecodeParams(Colors, BitsPerComponent, Columns))
- return (uint32_t)-1;
+ return 0xFFFFFFFF;
}
return CPDF_ModuleMgr::Get()->GetFlateModule()->FlateOrLZWDecode(
bLZW, src_buf, src_size, bEarlyChange, predictor, Colors,
@@ -327,7 +327,7 @@ bool PDF_DataDecode(const uint8_t* src_buf,
const CPDF_Dictionary* pDict,
uint8_t*& dest_buf,
uint32_t& dest_size,
- CFX_ByteString& ImageEncoding,
+ CFX_ByteString* ImageEncoding,
CPDF_Dictionary*& pImageParms,
uint32_t last_estimated_size,
bool bImageAcc) {
@@ -358,12 +358,12 @@ bool PDF_DataDecode(const uint8_t* src_buf,
CFX_ByteString decoder = DecoderArray[i].first;
CPDF_Dictionary* pParam = ToDictionary(DecoderArray[i].second);
uint8_t* new_buf = nullptr;
- uint32_t new_size = (uint32_t)-1;
+ uint32_t new_size = 0xFFFFFFFF;
int offset = -1;
if (decoder == "FlateDecode" || decoder == "Fl") {
if (bImageAcc && i == nSize - 1) {
- ImageEncoding = "FlateDecode";
- dest_buf = (uint8_t*)last_buf;
+ *ImageEncoding = "FlateDecode";
+ dest_buf = last_buf;
dest_size = last_size;
pImageParms = pParam;
return true;
@@ -379,8 +379,8 @@ bool PDF_DataDecode(const uint8_t* src_buf,
offset = HexDecode(last_buf, last_size, new_buf, new_size);
} else if (decoder == "RunLengthDecode" || decoder == "RL") {
if (bImageAcc && i == nSize - 1) {
- ImageEncoding = "RunLengthDecode";
- dest_buf = (uint8_t*)last_buf;
+ *ImageEncoding = "RunLengthDecode";
+ dest_buf = last_buf;
dest_size = last_size;
pImageParms = pParam;
return true;
@@ -395,9 +395,9 @@ bool PDF_DataDecode(const uint8_t* src_buf,
} else if (decoder == "CCF") {
decoder = "CCITTFaxDecode";
}
- ImageEncoding = decoder;
+ *ImageEncoding = decoder;
pImageParms = pParam;
- dest_buf = (uint8_t*)last_buf;
+ dest_buf = last_buf;
dest_size = last_size;
if (CPDF_Array* pDecoders = pDecoder->AsArray())
pDecoders->RemoveAt(i + 1, pDecoders->GetCount() - i - 1);
@@ -413,7 +413,7 @@ bool PDF_DataDecode(const uint8_t* src_buf,
last_buf = new_buf;
last_size = new_size;
}
- ImageEncoding = "";
+ *ImageEncoding = "";
pImageParms = nullptr;
dest_buf = last_buf;
dest_size = last_size;
@@ -432,7 +432,7 @@ CFX_WideString PDF_DecodeText(const uint8_t* src_data, uint32_t src_len) {
if (src_data[0] == 0xff) {
bBE = !src_data[2];
}
- FX_WCHAR* dest_buf = result.GetBuffer(max_chars);
+ wchar_t* dest_buf = result.GetBuffer(max_chars);
const uint8_t* uni_str = src_data + 2;
int dest_pos = 0;
for (uint32_t i = 0; i < max_chars * 2; i += 2) {
@@ -453,7 +453,7 @@ CFX_WideString PDF_DecodeText(const uint8_t* src_data, uint32_t src_len) {
}
result.ReleaseBuffer(dest_pos);
} else {
- FX_WCHAR* dest_buf = result.GetBuffer(src_len);
+ wchar_t* dest_buf = result.GetBuffer(src_len);
for (uint32_t i = 0; i < src_len; i++)
dest_buf[i] = PDFDocEncoding[src_data[i]];
result.ReleaseBuffer(src_len);
@@ -465,12 +465,12 @@ CFX_WideString PDF_DecodeText(const CFX_ByteString& bstr) {
return PDF_DecodeText((const uint8_t*)bstr.c_str(), bstr.GetLength());
}
-CFX_ByteString PDF_EncodeText(const FX_WCHAR* pString, int len) {
+CFX_ByteString PDF_EncodeText(const wchar_t* pString, int len) {
if (len == -1) {
len = FXSYS_wcslen(pString);
}
CFX_ByteString result;
- FX_CHAR* dest_buf1 = result.GetBuffer(len);
+ char* dest_buf1 = result.GetBuffer(len);
int i;
for (i = 0; i < len; i++) {
int code;
diff --git a/chromium/third_party/pdfium/core/fpdfapi/parser/fpdf_parser_decode.h b/chromium/third_party/pdfium/core/fpdfapi/parser/fpdf_parser_decode.h
index dc8ecf0c9b5..955a8cfb329 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/parser/fpdf_parser_decode.h
+++ b/chromium/third_party/pdfium/core/fpdfapi/parser/fpdf_parser_decode.h
@@ -23,7 +23,7 @@ CFX_ByteString PDF_NameEncode(const CFX_ByteString& orig);
CFX_ByteString PDF_EncodeString(const CFX_ByteString& src, bool bHex = false);
CFX_WideString PDF_DecodeText(const uint8_t* pData, uint32_t size);
CFX_WideString PDF_DecodeText(const CFX_ByteString& bstr);
-CFX_ByteString PDF_EncodeText(const FX_WCHAR* pString, int len = -1);
+CFX_ByteString PDF_EncodeText(const wchar_t* pString, int len = -1);
CFX_ByteString PDF_EncodeText(const CFX_WideString& str);
bool FlateEncode(const uint8_t* src_buf,
@@ -87,7 +87,7 @@ bool PDF_DataDecode(const uint8_t* src_buf,
const CPDF_Dictionary* pDict,
uint8_t*& dest_buf,
uint32_t& dest_size,
- CFX_ByteString& ImageEncoding,
+ CFX_ByteString* ImageEncoding,
CPDF_Dictionary*& pImageParms,
uint32_t estimated_size,
bool bImageAcc);
diff --git a/chromium/third_party/pdfium/core/fpdfapi/parser/fpdf_parser_decode_embeddertest.cpp b/chromium/third_party/pdfium/core/fpdfapi/parser/fpdf_parser_decode_embeddertest.cpp
index 9dfc26e369f..136d7c9f2ff 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/parser/fpdf_parser_decode_embeddertest.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/parser/fpdf_parser_decode_embeddertest.cpp
@@ -115,10 +115,11 @@ TEST_F(FPDFParserDecodeEmbeddertest, Bug_455199) {
FPDF_PAGE page = LoadPage(0);
FPDF_BITMAP bitmap = RenderPage(page);
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
- // Rendering on Mac is inconsistent, so skip this check.
- const char* const kExpectedMd5sum = nullptr;
+ const char kExpectedMd5sum[] = "b90475ca64d1348c3bf5e2b77ad9187a";
+#elif _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
+ const char kExpectedMd5sum[] = "5db84ceda153acc4420c2062b182191b";
#else
- const char kExpectedMd5sum[] = "6f9f0fd903da177babb24dd50a806a56";
+ const char kExpectedMd5sum[] = "f24438fe53948941200fd43da37908bc";
#endif
CompareBitmap(bitmap, 200, 200, kExpectedMd5sum);
FPDFBitmap_Destroy(bitmap);
diff --git a/chromium/third_party/pdfium/core/fpdfapi/parser/fpdf_parser_decode_unittest.cpp b/chromium/third_party/pdfium/core/fpdfapi/parser/fpdf_parser_decode_unittest.cpp
index 30d30a433da..f8c9863c324 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/parser/fpdf_parser_decode_unittest.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/parser/fpdf_parser_decode_unittest.cpp
@@ -79,8 +79,8 @@ TEST(fpdf_parser_decode, HexDecode) {
TEST(fpdf_parser_decode, EncodeText) {
struct EncodeTestData {
- const FX_WCHAR* input;
- const FX_CHAR* expected_output;
+ const wchar_t* input;
+ const char* expected_output;
FX_STRSIZE expected_length;
} test_data[] = {
// Empty src string.
@@ -102,7 +102,7 @@ TEST(fpdf_parser_decode, EncodeText) {
CFX_ByteString output = PDF_EncodeText(test_case.input);
ASSERT_EQ(test_case.expected_length, output.GetLength()) << "for case "
<< i;
- const FX_CHAR* str_ptr = output.c_str();
+ const char* str_ptr = output.c_str();
for (FX_STRSIZE j = 0; j < test_case.expected_length; ++j) {
EXPECT_EQ(test_case.expected_output[j], str_ptr[j]) << "for case " << i
<< " char " << j;
diff --git a/chromium/third_party/pdfium/core/fpdfapi/parser/fpdf_parser_utility.cpp b/chromium/third_party/pdfium/core/fpdfapi/parser/fpdf_parser_utility.cpp
index 9583ea70bcb..d6ea1a2c503 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/parser/fpdf_parser_utility.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/parser/fpdf_parser_utility.cpp
@@ -93,8 +93,8 @@ CFX_ByteString PDF_NameDecode(const CFX_ByteStringC& bstr) {
int size = bstr.GetLength();
CFX_ByteString result;
- FX_CHAR* pDestStart = result.GetBuffer(size);
- FX_CHAR* pDest = pDestStart;
+ char* pDestStart = result.GetBuffer(size);
+ char* pDest = pDestStart;
for (int i = 0; i < size; i++) {
if (bstr[i] == '#' && i < size - 2) {
*pDest++ =
@@ -132,7 +132,7 @@ CFX_ByteString PDF_NameEncode(const CFX_ByteString& orig) {
return orig;
CFX_ByteString res;
- FX_CHAR* dest_buf = res.GetBuffer(dest_len);
+ char* dest_buf = res.GetBuffer(dest_len);
dest_len = 0;
for (i = 0; i < src_len; i++) {
uint8_t ch = src_buf[i];
@@ -208,9 +208,9 @@ CFX_ByteTextBuf& operator<<(CFX_ByteTextBuf& buf, const CPDF_Object* pObj) {
case CPDF_Object::STREAM: {
const CPDF_Stream* p = pObj->AsStream();
buf << p->GetDict() << "stream\r\n";
- CPDF_StreamAcc acc;
- acc.LoadAllData(p, true);
- buf.AppendBlock(acc.GetData(), acc.GetSize());
+ auto pAcc = pdfium::MakeRetain<CPDF_StreamAcc>(p);
+ pAcc->LoadAllData(true);
+ buf.AppendBlock(pAcc->GetData(), pAcc->GetSize());
buf << "\r\nendstream";
break;
}
diff --git a/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_charposlist.cpp b/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_charposlist.cpp
index 639bdcf17b4..d4c6b3b5f94 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_charposlist.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_charposlist.cpp
@@ -20,9 +20,9 @@ CPDF_CharPosList::~CPDF_CharPosList() {
}
void CPDF_CharPosList::Load(const std::vector<uint32_t>& charCodes,
- const std::vector<FX_FLOAT>& charPos,
+ const std::vector<float>& charPos,
CPDF_Font* pFont,
- FX_FLOAT FontSize) {
+ float FontSize) {
int nChars = pdfium::CollectionSize<int>(charCodes);
m_pCharPos = FX_Alloc(FXTEXT_CHARPOS, nChars);
m_nChars = 0;
@@ -39,19 +39,23 @@ void CPDF_CharPosList::Load(const std::vector<uint32_t>& charCodes,
charpos.m_bFontStyle = true;
charpos.m_GlyphIndex = pFont->GlyphFromCharCode(CharCode, &bVert);
- if (charpos.m_GlyphIndex != static_cast<uint32_t>(-1)) {
+ uint32_t GlyphID = charpos.m_GlyphIndex;
+#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
+ charpos.m_ExtGID = pFont->GlyphFromCharCodeExt(CharCode);
+ GlyphID = charpos.m_ExtGID;
+#endif
+ if (GlyphID != static_cast<uint32_t>(-1)) {
charpos.m_FallbackFontPosition = -1;
} else {
charpos.m_FallbackFontPosition =
pFont->FallbackFontFromCharcode(CharCode);
charpos.m_GlyphIndex = pFont->FallbackGlyphFromCharcode(
charpos.m_FallbackFontPosition, CharCode);
- }
-
-// TODO(npm): Figure out how this affects m_ExtGID
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
- charpos.m_ExtGID = pFont->GlyphFromCharCodeExt(CharCode);
+ charpos.m_ExtGID = charpos.m_GlyphIndex;
#endif
+ }
+
if (!pFont->IsEmbedded() && !pFont->IsCIDFont())
charpos.m_FontCharWidth = pFont->GetCharWidthF(CharCode);
else
diff --git a/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_charposlist.h b/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_charposlist.h
index 2f5a44dfa0d..c4636bca513 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_charposlist.h
+++ b/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_charposlist.h
@@ -19,9 +19,9 @@ class CPDF_CharPosList {
CPDF_CharPosList();
~CPDF_CharPosList();
void Load(const std::vector<uint32_t>& charCodes,
- const std::vector<FX_FLOAT>& charPos,
+ const std::vector<float>& charPos,
CPDF_Font* pFont,
- FX_FLOAT font_size);
+ float font_size);
FXTEXT_CHARPOS* m_pCharPos;
uint32_t m_nChars;
};
diff --git a/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_devicebuffer.cpp b/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_devicebuffer.cpp
index dec13433e42..605e09bb5be 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_devicebuffer.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_devicebuffer.cpp
@@ -38,19 +38,19 @@ bool CPDF_DeviceBuffer::Initialize(CPDF_RenderContext* pContext,
int dpiv =
pDevice->GetDeviceCaps(FXDC_PIXEL_HEIGHT) * 254 / (vert_size * 10);
if (dpih > max_dpi)
- m_Matrix.Scale((FX_FLOAT)(max_dpi) / dpih, 1.0f);
+ m_Matrix.Scale((float)(max_dpi) / dpih, 1.0f);
if (dpiv > max_dpi)
- m_Matrix.Scale(1.0f, (FX_FLOAT)(max_dpi) / (FX_FLOAT)dpiv);
+ m_Matrix.Scale(1.0f, (float)(max_dpi) / (float)dpiv);
}
#endif
CFX_Matrix ctm = m_pDevice->GetCTM();
- m_Matrix.Concat(CFX_Matrix(FXSYS_fabs(ctm.a), 0, 0, FXSYS_fabs(ctm.d), 0, 0));
+ m_Matrix.Concat(CFX_Matrix(fabs(ctm.a), 0, 0, fabs(ctm.d), 0, 0));
CFX_FloatRect rect(*pRect);
m_Matrix.TransformRect(rect);
FX_RECT bitmap_rect = rect.GetOuterRect();
- m_pBitmap = pdfium::MakeUnique<CFX_DIBitmap>();
+ m_pBitmap = pdfium::MakeRetain<CFX_DIBitmap>();
m_pBitmap->Create(bitmap_rect.Width(), bitmap_rect.Height(), FXDIB_Argb);
return true;
}
@@ -58,19 +58,19 @@ bool CPDF_DeviceBuffer::Initialize(CPDF_RenderContext* pContext,
void CPDF_DeviceBuffer::OutputToDevice() {
if (m_pDevice->GetDeviceCaps(FXDC_RENDER_CAPS) & FXRC_GET_BITS) {
if (m_Matrix.a == 1.0f && m_Matrix.d == 1.0f) {
- m_pDevice->SetDIBits(m_pBitmap.get(), m_Rect.left, m_Rect.top);
+ m_pDevice->SetDIBits(m_pBitmap, m_Rect.left, m_Rect.top);
} else {
- m_pDevice->StretchDIBits(m_pBitmap.get(), m_Rect.left, m_Rect.top,
+ m_pDevice->StretchDIBits(m_pBitmap, m_Rect.left, m_Rect.top,
m_Rect.Width(), m_Rect.Height());
}
return;
}
- CFX_DIBitmap buffer;
- m_pDevice->CreateCompatibleBitmap(&buffer, m_pBitmap->GetWidth(),
+ auto pBuffer = pdfium::MakeRetain<CFX_DIBitmap>();
+ m_pDevice->CreateCompatibleBitmap(pBuffer, m_pBitmap->GetWidth(),
m_pBitmap->GetHeight());
- m_pContext->GetBackground(&buffer, m_pObject, nullptr, &m_Matrix);
- buffer.CompositeBitmap(0, 0, buffer.GetWidth(), buffer.GetHeight(),
- m_pBitmap.get(), 0, 0);
- m_pDevice->StretchDIBits(&buffer, m_Rect.left, m_Rect.top, m_Rect.Width(),
+ m_pContext->GetBackground(pBuffer, m_pObject, nullptr, &m_Matrix);
+ pBuffer->CompositeBitmap(0, 0, pBuffer->GetWidth(), pBuffer->GetHeight(),
+ m_pBitmap, 0, 0);
+ m_pDevice->StretchDIBits(pBuffer, m_Rect.left, m_Rect.top, m_Rect.Width(),
m_Rect.Height());
}
diff --git a/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_devicebuffer.h b/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_devicebuffer.h
index e5bbf1fcdf8..61cdc9776bd 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_devicebuffer.h
+++ b/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_devicebuffer.h
@@ -26,7 +26,7 @@ class CPDF_DeviceBuffer {
const CPDF_PageObject* pObj,
int max_dpi);
void OutputToDevice();
- CFX_DIBitmap* GetBitmap() const { return m_pBitmap.get(); }
+ CFX_RetainPtr<CFX_DIBitmap> GetBitmap() const { return m_pBitmap; }
const CFX_Matrix* GetMatrix() const { return &m_Matrix; }
private:
@@ -34,7 +34,7 @@ class CPDF_DeviceBuffer {
CPDF_RenderContext* m_pContext;
FX_RECT m_Rect;
const CPDF_PageObject* m_pObject;
- std::unique_ptr<CFX_DIBitmap> m_pBitmap;
+ CFX_RetainPtr<CFX_DIBitmap> m_pBitmap;
CFX_Matrix m_Matrix;
};
diff --git a/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_dibsource.cpp b/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_dibsource.cpp
index 33a8d930a53..e60d0329d0b 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_dibsource.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_dibsource.cpp
@@ -8,6 +8,7 @@
#include <algorithm>
#include <memory>
+#include <utility>
#include <vector>
#include "core/fpdfapi/cpdf_modulemgr.h"
@@ -20,6 +21,7 @@
#include "core/fpdfapi/parser/fpdf_parser_decode.h"
#include "core/fpdfapi/render/cpdf_pagerendercache.h"
#include "core/fpdfapi/render/cpdf_renderstatus.h"
+#include "core/fxcodec/codec/cjpx_decoder.h"
#include "core/fxcodec/fx_codec.h"
#include "core/fxcrt/fx_safe_types.h"
#include "third_party/base/ptr_util.h"
@@ -78,16 +80,17 @@ class JpxBitMapContext {
explicit JpxBitMapContext(CCodec_JpxModule* jpx_module)
: jpx_module_(jpx_module), decoder_(nullptr) {}
- ~JpxBitMapContext() { jpx_module_->DestroyDecoder(decoder_); }
+ ~JpxBitMapContext() {}
- // Takes ownership of |decoder|.
- void set_decoder(CJPX_Decoder* decoder) { decoder_ = decoder; }
+ void set_decoder(std::unique_ptr<CJPX_Decoder> decoder) {
+ decoder_ = std::move(decoder);
+ }
- CJPX_Decoder* decoder() { return decoder_; }
+ CJPX_Decoder* decoder() { return decoder_.get(); }
private:
CCodec_JpxModule* const jpx_module_; // Weak pointer.
- CJPX_Decoder* decoder_; // Decoder, owned.
+ std::unique_ptr<CJPX_Decoder> decoder_;
// Disallow evil constructors
JpxBitMapContext(const JpxBitMapContext&);
@@ -126,12 +129,11 @@ CPDF_DIBSource::CPDF_DIBSource()
CPDF_DIBSource::~CPDF_DIBSource() {
FX_Free(m_pMaskedLine);
FX_Free(m_pLineBuf);
- m_pCachedBitmap.reset();
+ m_pCachedBitmap.Reset(); // TODO(tsepez): determine if required early here.
FX_Free(m_pCompData);
CPDF_ColorSpace* pCS = m_pColorSpace;
- if (pCS && m_pDocument) {
+ if (pCS && m_pDocument)
m_pDocument->GetPageData()->ReleaseColorSpace(pCS->GetArray());
- }
}
bool CPDF_DIBSource::Load(CPDF_Document* pDoc, const CPDF_Stream* pStream) {
@@ -163,8 +165,8 @@ bool CPDF_DIBSource::Load(CPDF_Document* pDoc, const CPDF_Stream* pStream) {
if (!src_size.IsValid())
return false;
- m_pStreamAcc = pdfium::MakeUnique<CPDF_StreamAcc>();
- m_pStreamAcc->LoadAllData(pStream, false, src_size.ValueOrDie(), true);
+ m_pStreamAcc = pdfium::MakeRetain<CPDF_StreamAcc>(pStream);
+ m_pStreamAcc->LoadAllData(false, src_size.ValueOrDie(), true);
if (m_pStreamAcc->GetSize() == 0 || !m_pStreamAcc->GetData())
return false;
@@ -276,8 +278,8 @@ int CPDF_DIBSource::StartLoadDIBSource(CPDF_Document* pDoc,
if (!src_size.IsValid()) {
return 0;
}
- m_pStreamAcc = pdfium::MakeUnique<CPDF_StreamAcc>();
- m_pStreamAcc->LoadAllData(pStream, false, src_size.ValueOrDie(), true);
+ m_pStreamAcc = pdfium::MakeRetain<CPDF_StreamAcc>(pStream);
+ m_pStreamAcc->LoadAllData(false, src_size.ValueOrDie(), true);
if (m_pStreamAcc->GetSize() == 0 || !m_pStreamAcc->GetData()) {
return 0;
}
@@ -323,17 +325,17 @@ int CPDF_DIBSource::ContinueLoadDIBSource(IFX_Pause* pPause) {
CPDF_Stream* pGlobals =
m_pStreamAcc->GetImageParam()->GetStreamFor("JBIG2Globals");
if (pGlobals) {
- m_pGlobalStream = pdfium::MakeUnique<CPDF_StreamAcc>();
- m_pGlobalStream->LoadAllData(pGlobals, false);
+ m_pGlobalStream = pdfium::MakeRetain<CPDF_StreamAcc>(pGlobals);
+ m_pGlobalStream->LoadAllData(false);
}
}
ret = pJbig2Module->StartDecode(
m_pJbig2Context.get(), m_pDocument->CodecContext(), m_Width, m_Height,
- m_pStreamAcc.get(), m_pGlobalStream.get(),
- m_pCachedBitmap->GetBuffer(), m_pCachedBitmap->GetPitch(), pPause);
+ m_pStreamAcc, m_pGlobalStream, m_pCachedBitmap->GetBuffer(),
+ m_pCachedBitmap->GetPitch(), pPause);
if (ret < 0) {
- m_pCachedBitmap.reset();
- m_pGlobalStream.reset();
+ m_pCachedBitmap.Reset();
+ m_pGlobalStream.Reset();
m_pJbig2Context.reset();
return 0;
}
@@ -355,8 +357,8 @@ int CPDF_DIBSource::ContinueLoadDIBSource(IFX_Pause* pPause) {
}
ret = pJbig2Module->ContinueDecode(m_pJbig2Context.get(), pPause);
if (ret < 0) {
- m_pCachedBitmap.reset();
- m_pGlobalStream.reset();
+ m_pCachedBitmap.Reset();
+ m_pGlobalStream.Reset();
m_pJbig2Context.reset();
return 0;
}
@@ -428,71 +430,68 @@ bool CPDF_DIBSource::LoadColorInfo(const CPDF_Dictionary* pFormResources,
m_nComponents = m_pColorSpace->CountComponents();
if (m_Family == PDFCS_ICCBASED && pCSObj->IsName()) {
CFX_ByteString cs = pCSObj->GetString();
- if (cs == "DeviceGray") {
+ if (cs == "DeviceGray")
m_nComponents = 1;
- } else if (cs == "DeviceRGB") {
+ else if (cs == "DeviceRGB")
m_nComponents = 3;
- } else if (cs == "DeviceCMYK") {
+ else if (cs == "DeviceCMYK")
m_nComponents = 4;
- }
}
ValidateDictParam();
- m_pCompData = GetDecodeAndMaskArray(m_bDefaultDecode, m_bColorKey);
+ m_pCompData = GetDecodeAndMaskArray(&m_bDefaultDecode, &m_bColorKey);
return !!m_pCompData;
}
-DIB_COMP_DATA* CPDF_DIBSource::GetDecodeAndMaskArray(bool& bDefaultDecode,
- bool& bColorKey) {
- if (!m_pColorSpace) {
+DIB_COMP_DATA* CPDF_DIBSource::GetDecodeAndMaskArray(bool* bDefaultDecode,
+ bool* bColorKey) {
+ if (!m_pColorSpace)
return nullptr;
- }
- DIB_COMP_DATA* pCompData = FX_Alloc(DIB_COMP_DATA, m_nComponents);
+
+ DIB_COMP_DATA* const pCompData = FX_Alloc(DIB_COMP_DATA, m_nComponents);
int max_data = (1 << m_bpc) - 1;
CPDF_Array* pDecode = m_pDict->GetArrayFor("Decode");
if (pDecode) {
for (uint32_t i = 0; i < m_nComponents; i++) {
pCompData[i].m_DecodeMin = pDecode->GetNumberAt(i * 2);
- FX_FLOAT max = pDecode->GetNumberAt(i * 2 + 1);
+ float max = pDecode->GetNumberAt(i * 2 + 1);
pCompData[i].m_DecodeStep = (max - pCompData[i].m_DecodeMin) / max_data;
- FX_FLOAT def_value;
- FX_FLOAT def_min;
- FX_FLOAT def_max;
- m_pColorSpace->GetDefaultValue(i, def_value, def_min, def_max);
- if (m_Family == PDFCS_INDEXED) {
+ float def_value;
+ float def_min;
+ float def_max;
+ m_pColorSpace->GetDefaultValue(i, &def_value, &def_min, &def_max);
+ if (m_Family == PDFCS_INDEXED)
def_max = max_data;
- }
- if (def_min != pCompData[i].m_DecodeMin || def_max != max) {
- bDefaultDecode = false;
- }
+ if (def_min != pCompData[i].m_DecodeMin || def_max != max)
+ *bDefaultDecode = false;
}
} else {
for (uint32_t i = 0; i < m_nComponents; i++) {
- FX_FLOAT def_value;
- m_pColorSpace->GetDefaultValue(i, def_value, pCompData[i].m_DecodeMin,
- pCompData[i].m_DecodeStep);
- if (m_Family == PDFCS_INDEXED) {
+ float def_value;
+ m_pColorSpace->GetDefaultValue(i, &def_value, &pCompData[i].m_DecodeMin,
+ &pCompData[i].m_DecodeStep);
+ if (m_Family == PDFCS_INDEXED)
pCompData[i].m_DecodeStep = max_data;
- }
pCompData[i].m_DecodeStep =
(pCompData[i].m_DecodeStep - pCompData[i].m_DecodeMin) / max_data;
}
}
- if (!m_pDict->KeyExist("SMask")) {
- CPDF_Object* pMask = m_pDict->GetDirectObjectFor("Mask");
- if (!pMask) {
- return pCompData;
- }
- if (CPDF_Array* pArray = pMask->AsArray()) {
- if (pArray->GetCount() >= m_nComponents * 2) {
- for (uint32_t i = 0; i < m_nComponents; i++) {
- int min_num = pArray->GetIntegerAt(i * 2);
- int max_num = pArray->GetIntegerAt(i * 2 + 1);
- pCompData[i].m_ColorKeyMin = std::max(min_num, 0);
- pCompData[i].m_ColorKeyMax = std::min(max_num, max_data);
- }
+ if (m_pDict->KeyExist("SMask"))
+ return pCompData;
+
+ CPDF_Object* pMask = m_pDict->GetDirectObjectFor("Mask");
+ if (!pMask)
+ return pCompData;
+
+ if (CPDF_Array* pArray = pMask->AsArray()) {
+ if (pArray->GetCount() >= m_nComponents * 2) {
+ for (uint32_t i = 0; i < m_nComponents; i++) {
+ int min_num = pArray->GetIntegerAt(i * 2);
+ int max_num = pArray->GetIntegerAt(i * 2 + 1);
+ pCompData[i].m_ColorKeyMin = std::max(min_num, 0);
+ pCompData[i].m_ColorKeyMax = std::min(max_num, max_data);
}
- bColorKey = true;
}
+ *bColorKey = true;
}
return pCompData;
}
@@ -510,10 +509,10 @@ int CPDF_DIBSource::CreateDecoder() {
return m_pCachedBitmap ? 1 : 0;
}
if (decoder == "JBIG2Decode") {
- m_pCachedBitmap = pdfium::MakeUnique<CFX_DIBitmap>();
+ m_pCachedBitmap = pdfium::MakeRetain<CFX_DIBitmap>();
if (!m_pCachedBitmap->Create(
m_Width, m_Height, m_bImageMask ? FXDIB_1bppMask : FXDIB_1bppRgb)) {
- m_pCachedBitmap.reset();
+ m_pCachedBitmap.Reset();
return 0;
}
m_Status = 1;
@@ -585,7 +584,7 @@ int CPDF_DIBSource::CreateDecoder() {
if (m_Family == PDFCS_LAB && m_nComponents != 3)
return 0;
}
- m_pCompData = GetDecodeAndMaskArray(m_bDefaultDecode, m_bColorKey);
+ m_pCompData = GetDecodeAndMaskArray(&m_bDefaultDecode, &m_bColorKey);
if (!m_pCompData)
return 0;
}
@@ -616,7 +615,7 @@ void CPDF_DIBSource::LoadJpxBitmap() {
if (!pJpxModule)
return;
- std::unique_ptr<JpxBitMapContext> context(new JpxBitMapContext(pJpxModule));
+ auto context = pdfium::MakeUnique<JpxBitMapContext>(pJpxModule);
context->set_decoder(pJpxModule->CreateDecoder(
m_pStreamAcc->GetData(), m_pStreamAcc->GetSize(), m_pColorSpace));
if (!context->decoder())
@@ -659,9 +658,9 @@ void CPDF_DIBSource::LoadJpxBitmap() {
format = FXDIB_Rgb;
}
- m_pCachedBitmap = pdfium::MakeUnique<CFX_DIBitmap>();
+ m_pCachedBitmap = pdfium::MakeRetain<CFX_DIBitmap>();
if (!m_pCachedBitmap->Create(width, height, format)) {
- m_pCachedBitmap.reset();
+ m_pCachedBitmap.Reset();
return;
}
m_pCachedBitmap->Clear(0xFFFFFFFF);
@@ -674,7 +673,7 @@ void CPDF_DIBSource::LoadJpxBitmap() {
}
if (!pJpxModule->Decode(context->decoder(), m_pCachedBitmap->GetBuffer(),
m_pCachedBitmap->GetPitch(), output_offsets)) {
- m_pCachedBitmap.reset();
+ m_pCachedBitmap.Reset();
return;
}
if (m_pColorSpace && m_pColorSpace->GetFamily() == PDFCS_INDEXED &&
@@ -699,12 +698,12 @@ int CPDF_DIBSource::StratLoadMask() {
CPDF_Array* pMatte = m_pMaskStream->GetDict()->GetArrayFor("Matte");
if (pMatte && m_pColorSpace &&
m_pColorSpace->CountComponents() <= m_nComponents) {
- FX_FLOAT R, G, B;
- std::vector<FX_FLOAT> colors(m_nComponents);
- for (uint32_t i = 0; i < m_nComponents; i++) {
+ float R, G, B;
+ std::vector<float> colors(m_nComponents);
+ for (uint32_t i = 0; i < m_nComponents; i++)
colors[i] = pMatte->GetFloatAt(i);
- }
- m_pColorSpace->GetRGB(colors.data(), R, G, B);
+
+ m_pColorSpace->GetRGB(colors.data(), &R, &G, &B);
m_MatteColor = FXARGB_MAKE(0, FXSYS_round(R * 255), FXSYS_round(G * 255),
FXSYS_round(B * 255));
}
@@ -716,32 +715,29 @@ int CPDF_DIBSource::StratLoadMask() {
}
int CPDF_DIBSource::ContinueLoadMaskDIB(IFX_Pause* pPause) {
- if (!m_pMask) {
+ if (!m_pMask)
return 1;
- }
+
int ret = m_pMask->ContinueLoadDIBSource(pPause);
- if (ret == 2) {
+ if (ret == 2)
return ret;
- }
- if (m_pColorSpace && m_bStdCS) {
+
+ if (m_pColorSpace && m_bStdCS)
m_pColorSpace->EnableStdConversion(false);
- }
+
if (!ret) {
- delete m_pMask;
- m_pMask = nullptr;
+ m_pMask.Reset();
return ret;
}
return 1;
}
-CPDF_DIBSource* CPDF_DIBSource::DetachMask() {
- CPDF_DIBSource* pDIBSource = m_pMask;
- m_pMask = nullptr;
- return pDIBSource;
+CFX_RetainPtr<CPDF_DIBSource> CPDF_DIBSource::DetachMask() {
+ return std::move(m_pMask);
}
int CPDF_DIBSource::StartLoadMaskDIB() {
- m_pMask = new CPDF_DIBSource;
+ m_pMask = pdfium::MakeRetain<CPDF_DIBSource>();
int ret = m_pMask->StartLoadDIBSource(m_pDocument, m_pMaskStream, false,
nullptr, nullptr, true);
if (ret == 2) {
@@ -750,8 +746,7 @@ int CPDF_DIBSource::StartLoadMaskDIB() {
return 2;
}
if (!ret) {
- delete m_pMask;
- m_pMask = nullptr;
+ m_pMask.Reset();
return 1;
}
return 1;
@@ -775,17 +770,17 @@ void CPDF_DIBSource::LoadPalette() {
if (m_pColorSpace->CountComponents() > 3) {
return;
}
- FX_FLOAT color_values[3];
+ float color_values[3];
color_values[0] = m_pCompData[0].m_DecodeMin;
color_values[1] = color_values[2] = color_values[0];
- FX_FLOAT R = 0.0f, G = 0.0f, B = 0.0f;
- m_pColorSpace->GetRGB(color_values, R, G, B);
+ float R = 0.0f, G = 0.0f, B = 0.0f;
+ m_pColorSpace->GetRGB(color_values, &R, &G, &B);
FX_ARGB argb0 = ArgbEncode(255, FXSYS_round(R * 255), FXSYS_round(G * 255),
FXSYS_round(B * 255));
color_values[0] += m_pCompData[0].m_DecodeStep;
color_values[1] += m_pCompData[0].m_DecodeStep;
color_values[2] += m_pCompData[0].m_DecodeStep;
- m_pColorSpace->GetRGB(color_values, R, G, B);
+ m_pColorSpace->GetRGB(color_values, &R, &G, &B);
FX_ARGB argb1 = ArgbEncode(255, FXSYS_round(R * 255), FXSYS_round(G * 255),
FXSYS_round(B * 255));
if (argb0 != 0xFF000000 || argb1 != 0xFFFFFFFF) {
@@ -798,8 +793,8 @@ void CPDF_DIBSource::LoadPalette() {
m_bpc == 8 && m_bDefaultDecode) {
} else {
int palette_count = 1 << (m_bpc * m_nComponents);
- CFX_FixedBufGrow<FX_FLOAT, 16> color_values(m_nComponents);
- FX_FLOAT* color_value = color_values;
+ CFX_FixedBufGrow<float, 16> color_values(m_nComponents);
+ float* color_value = color_values;
for (int i = 0; i < palette_count; i++) {
int color_data = i;
for (uint32_t j = 0; j < m_nComponents; j++) {
@@ -808,17 +803,17 @@ void CPDF_DIBSource::LoadPalette() {
color_value[j] = m_pCompData[j].m_DecodeMin +
m_pCompData[j].m_DecodeStep * encoded_component;
}
- FX_FLOAT R = 0, G = 0, B = 0;
+ float R = 0, G = 0, B = 0;
if (m_nComponents == 1 && m_Family == PDFCS_ICCBASED &&
m_pColorSpace->CountComponents() > 1) {
int nComponents = m_pColorSpace->CountComponents();
- std::vector<FX_FLOAT> temp_buf(nComponents);
+ std::vector<float> temp_buf(nComponents);
for (int k = 0; k < nComponents; k++) {
temp_buf[k] = *color_value;
}
- m_pColorSpace->GetRGB(temp_buf.data(), R, G, B);
+ m_pColorSpace->GetRGB(temp_buf.data(), &R, &G, &B);
} else {
- m_pColorSpace->GetRGB(color_value, R, G, B);
+ m_pColorSpace->GetRGB(color_value, &R, &G, &B);
}
SetPaletteArgb(i, ArgbEncode(255, FXSYS_round(R * 255),
FXSYS_round(G * 255), FXSYS_round(B * 255)));
@@ -861,9 +856,9 @@ void CPDF_DIBSource::ValidateDictParam() {
void CPDF_DIBSource::TranslateScanline24bpp(uint8_t* dest_scan,
const uint8_t* src_scan) const {
- if (m_bpc == 0) {
+ if (m_bpc == 0)
return;
- }
+
unsigned int max_data = (1 << m_bpc) - 1;
if (m_bDefaultDecode) {
if (m_Family == PDFCS_DEVICERGB || m_Family == PDFCS_CALRGB) {
@@ -872,14 +867,6 @@ void CPDF_DIBSource::TranslateScanline24bpp(uint8_t* dest_scan,
const uint8_t* src_pos = src_scan;
switch (m_bpc) {
- case 16:
- for (int col = 0; col < m_Width; col++) {
- *dest_scan++ = src_pos[4];
- *dest_scan++ = src_pos[2];
- *dest_scan++ = *src_pos;
- src_pos += 6;
- }
- break;
case 8:
for (int column = 0; column < m_Width; column++) {
*dest_scan++ = src_pos[2];
@@ -888,6 +875,14 @@ void CPDF_DIBSource::TranslateScanline24bpp(uint8_t* dest_scan,
src_pos += 3;
}
break;
+ case 16:
+ for (int col = 0; col < m_Width; col++) {
+ *dest_scan++ = src_pos[4];
+ *dest_scan++ = src_pos[2];
+ *dest_scan++ = *src_pos;
+ src_pos += 6;
+ }
+ break;
default:
uint64_t src_bit_pos = 0;
size_t dest_byte_pos = 0;
@@ -917,9 +912,12 @@ void CPDF_DIBSource::TranslateScanline24bpp(uint8_t* dest_scan,
return;
}
}
- CFX_FixedBufGrow<FX_FLOAT, 16> color_values1(m_nComponents);
- FX_FLOAT* color_values = color_values1;
- FX_FLOAT R = 0.0f, G = 0.0f, B = 0.0f;
+
+ CFX_FixedBufGrow<float, 16> color_values1(m_nComponents);
+ float* color_values = color_values1;
+ float R = 0.0f;
+ float G = 0.0f;
+ float B = 0.0f;
if (m_bpc == 8) {
uint64_t src_byte_pos = 0;
size_t dest_byte_pos = 0;
@@ -930,12 +928,12 @@ void CPDF_DIBSource::TranslateScanline24bpp(uint8_t* dest_scan,
m_pCompData[color].m_DecodeStep * data;
}
if (TransMask()) {
- FX_FLOAT k = 1.0f - color_values[3];
+ float k = 1.0f - color_values[3];
R = (1.0f - color_values[0]) * k;
G = (1.0f - color_values[1]) * k;
B = (1.0f - color_values[2]) * k;
} else {
- m_pColorSpace->GetRGB(color_values, R, G, B);
+ m_pColorSpace->GetRGB(color_values, &R, &G, &B);
}
R = ClampValue(R, 1.0f);
G = ClampValue(G, 1.0f);
@@ -956,12 +954,12 @@ void CPDF_DIBSource::TranslateScanline24bpp(uint8_t* dest_scan,
src_bit_pos += m_bpc;
}
if (TransMask()) {
- FX_FLOAT k = 1.0f - color_values[3];
+ float k = 1.0f - color_values[3];
R = (1.0f - color_values[0]) * k;
G = (1.0f - color_values[1]) * k;
B = (1.0f - color_values[2]) * k;
} else {
- m_pColorSpace->GetRGB(color_values, R, G, B);
+ m_pColorSpace->GetRGB(color_values, &R, &G, &B);
}
R = ClampValue(R, 1.0f);
G = ClampValue(G, 1.0f);
@@ -1001,7 +999,7 @@ const uint8_t* CPDF_DIBSource::GetScanline(int line) const {
}
if (!pSrcLine) {
uint8_t* pLineBuf = m_pMaskedLine ? m_pMaskedLine : m_pLineBuf;
- FXSYS_memset(pLineBuf, 0xFF, m_Pitch);
+ memset(pLineBuf, 0xFF, m_Pitch);
return pLineBuf;
}
if (m_bpc * m_nComponents == 1) {
@@ -1032,13 +1030,13 @@ const uint8_t* CPDF_DIBSource::GetScanline(int line) const {
}
return m_pMaskedLine;
} else {
- FXSYS_memcpy(m_pLineBuf, pSrcLine, src_pitch_value);
+ memcpy(m_pLineBuf, pSrcLine, src_pitch_value);
}
return m_pLineBuf;
}
if (m_bpc * m_nComponents <= 8) {
if (m_bpc == 8) {
- FXSYS_memcpy(m_pLineBuf, pSrcLine, src_pitch_value);
+ memcpy(m_pLineBuf, pSrcLine, src_pitch_value);
} else {
uint64_t src_bit_pos = 0;
for (int col = 0; col < m_Width; col++) {
@@ -1051,29 +1049,29 @@ const uint8_t* CPDF_DIBSource::GetScanline(int line) const {
m_pLineBuf[col] = color_index;
}
}
- if (m_bColorKey) {
- uint8_t* pDestPixel = m_pMaskedLine;
- const uint8_t* pSrcPixel = m_pLineBuf;
- for (int col = 0; col < m_Width; col++) {
- uint8_t index = *pSrcPixel++;
- if (m_pPalette) {
- *pDestPixel++ = FXARGB_B(m_pPalette.get()[index]);
- *pDestPixel++ = FXARGB_G(m_pPalette.get()[index]);
- *pDestPixel++ = FXARGB_R(m_pPalette.get()[index]);
- } else {
- *pDestPixel++ = index;
- *pDestPixel++ = index;
- *pDestPixel++ = index;
- }
- *pDestPixel = (index < m_pCompData[0].m_ColorKeyMin ||
- index > m_pCompData[0].m_ColorKeyMax)
- ? 0xFF
- : 0;
- pDestPixel++;
+ if (!m_bColorKey)
+ return m_pLineBuf;
+
+ uint8_t* pDestPixel = m_pMaskedLine;
+ const uint8_t* pSrcPixel = m_pLineBuf;
+ for (int col = 0; col < m_Width; col++) {
+ uint8_t index = *pSrcPixel++;
+ if (m_pPalette) {
+ *pDestPixel++ = FXARGB_B(m_pPalette.get()[index]);
+ *pDestPixel++ = FXARGB_G(m_pPalette.get()[index]);
+ *pDestPixel++ = FXARGB_R(m_pPalette.get()[index]);
+ } else {
+ *pDestPixel++ = index;
+ *pDestPixel++ = index;
+ *pDestPixel++ = index;
}
- return m_pMaskedLine;
+ *pDestPixel = (index < m_pCompData[0].m_ColorKeyMin ||
+ index > m_pCompData[0].m_ColorKeyMax)
+ ? 0xFF
+ : 0;
+ pDestPixel++;
}
- return m_pLineBuf;
+ return m_pMaskedLine;
}
if (m_bColorKey) {
if (m_nComponents == 3 && m_bpc == 8) {
@@ -1090,25 +1088,25 @@ const uint8_t* CPDF_DIBSource::GetScanline(int line) const {
: 0;
}
} else {
- FXSYS_memset(m_pMaskedLine, 0xFF, m_Pitch);
+ memset(m_pMaskedLine, 0xFF, m_Pitch);
}
}
if (m_pColorSpace) {
TranslateScanline24bpp(m_pLineBuf, pSrcLine);
pSrcLine = m_pLineBuf;
}
- if (m_bColorKey) {
- const uint8_t* pSrcPixel = pSrcLine;
- uint8_t* pDestPixel = m_pMaskedLine;
- for (int col = 0; col < m_Width; col++) {
- *pDestPixel++ = *pSrcPixel++;
- *pDestPixel++ = *pSrcPixel++;
- *pDestPixel++ = *pSrcPixel++;
- pDestPixel++;
- }
- return m_pMaskedLine;
+ if (!m_bColorKey)
+ return pSrcLine;
+
+ const uint8_t* pSrcPixel = pSrcLine;
+ uint8_t* pDestPixel = m_pMaskedLine;
+ for (int col = 0; col < m_Width; col++) {
+ *pDestPixel++ = *pSrcPixel++;
+ *pDestPixel++ = *pSrcPixel++;
+ *pDestPixel++ = *pSrcPixel++;
+ pDestPixel++;
}
- return pSrcLine;
+ return m_pMaskedLine;
}
bool CPDF_DIBSource::SkipToScanline(int line, IFX_Pause* pPause) const {
@@ -1151,7 +1149,7 @@ void CPDF_DIBSource::DownSampleScanline(int line,
int orig_Bpp = m_bpc * m_nComponents / 8;
int dest_Bpp = dest_bpp / 8;
if (!pSrcLine) {
- FXSYS_memset(dest_scan, 0xFF, dest_Bpp * clip_width);
+ memset(dest_scan, 0xFF, dest_Bpp * clip_width);
return;
}
@@ -1183,12 +1181,12 @@ void CPDF_DIBSource::DownSampleScanline1Bit(int orig_Bpp,
bool bFlipX,
int clip_left,
int clip_width) const {
- uint32_t set_argb = (uint32_t)-1;
+ uint32_t set_argb = 0xFFFFFFFF;
uint32_t reset_argb = 0;
if (m_bImageMask) {
if (m_bDefaultDecode) {
set_argb = 0;
- reset_argb = (uint32_t)-1;
+ reset_argb = 0xFFFFFFFF;
}
} else if (m_bColorKey) {
reset_argb = m_pPalette ? m_pPalette.get()[0] : 0xFF000000;
@@ -1332,7 +1330,7 @@ void CPDF_DIBSource::DownSampleScanline32Bit(int orig_Bpp,
// in [0, src_width). Set the initial value to be an invalid src_x value.
uint32_t last_src_x = src_width;
FX_ARGB last_argb = FXARGB_MAKE(0xFF, 0xFF, 0xFF, 0xFF);
- FX_FLOAT unit_To8Bpc = 255.0f / ((1 << m_bpc) - 1);
+ float unit_To8Bpc = 255.0f / ((1 << m_bpc) - 1);
for (int i = 0; i < clip_width; i++) {
int dest_x = clip_left + i;
uint32_t src_x = (bFlipX ? (dest_width - dest_x - 1) : dest_x) *
@@ -1376,8 +1374,7 @@ void CPDF_DIBSource::DownSampleScanline32Bit(int orig_Bpp,
bTransMask);
} else {
for (uint32_t j = 0; j < m_nComponents; ++j) {
- FX_FLOAT component_value =
- static_cast<FX_FLOAT>(extracted_components[j]);
+ float component_value = static_cast<float>(extracted_components[j]);
int color_value = static_cast<int>(
(m_pCompData[j].m_DecodeMin +
m_pCompData[j].m_DecodeStep * component_value) *
diff --git a/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_dibsource.h b/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_dibsource.h
index d5820d8bae7..f484f57d755 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_dibsource.h
+++ b/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_dibsource.h
@@ -29,8 +29,8 @@ class CPDF_Document;
class CPDF_Stream;
typedef struct {
- FX_FLOAT m_DecodeMin;
- FX_FLOAT m_DecodeStep;
+ float m_DecodeMin;
+ float m_DecodeStep;
int m_ColorKeyMin;
int m_ColorKeyMax;
} DIB_COMP_DATA;
@@ -39,7 +39,9 @@ typedef struct {
class CPDF_DIBSource : public CFX_DIBSource {
public:
- CPDF_DIBSource();
+ template <typename T, typename... Args>
+ friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args);
+
~CPDF_DIBSource() override;
bool Load(CPDF_Document* pDoc, const CPDF_Stream* pStream);
@@ -71,12 +73,14 @@ class CPDF_DIBSource : public CFX_DIBSource {
int StartLoadMaskDIB();
int ContinueLoadMaskDIB(IFX_Pause* pPause);
int ContinueToLoadMask();
- CPDF_DIBSource* DetachMask();
+ CFX_RetainPtr<CPDF_DIBSource> DetachMask();
private:
+ CPDF_DIBSource();
+
bool LoadColorInfo(const CPDF_Dictionary* pFormResources,
const CPDF_Dictionary* pPageResources);
- DIB_COMP_DATA* GetDecodeAndMaskArray(bool& bDefaultDecode, bool& bColorKey);
+ DIB_COMP_DATA* GetDecodeAndMaskArray(bool* bDefaultDecode, bool* bColorKey);
void LoadJpxBitmap();
void LoadPalette();
int CreateDecoder();
@@ -114,7 +118,7 @@ class CPDF_DIBSource : public CFX_DIBSource {
CPDF_Document* m_pDocument;
const CPDF_Stream* m_pStream;
- std::unique_ptr<CPDF_StreamAcc> m_pStreamAcc;
+ CFX_RetainPtr<CPDF_StreamAcc> m_pStreamAcc;
const CPDF_Dictionary* m_pDict;
CPDF_ColorSpace* m_pColorSpace;
uint32_t m_Family;
@@ -133,10 +137,10 @@ class CPDF_DIBSource : public CFX_DIBSource {
DIB_COMP_DATA* m_pCompData;
uint8_t* m_pLineBuf;
uint8_t* m_pMaskedLine;
- std::unique_ptr<CFX_DIBitmap> m_pCachedBitmap;
+ CFX_RetainPtr<CFX_DIBitmap> m_pCachedBitmap;
+ CFX_RetainPtr<CPDF_DIBSource> m_pMask;
+ CFX_RetainPtr<CPDF_StreamAcc> m_pGlobalStream;
std::unique_ptr<CCodec_ScanlineDecoder> m_pDecoder;
- CPDF_DIBSource* m_pMask;
- std::unique_ptr<CPDF_StreamAcc> m_pGlobalStream;
std::unique_ptr<CCodec_Jbig2Context> m_pJbig2Context;
CPDF_Stream* m_pMaskStream;
int m_Status;
diff --git a/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_dibtransferfunc.cpp b/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_dibtransferfunc.cpp
index 41575fc8c21..6ba148e15c2 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_dibtransferfunc.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_dibtransferfunc.cpp
@@ -12,7 +12,8 @@
#include "core/fpdfapi/render/cpdf_transferfunc.h"
CPDF_DIBTransferFunc::CPDF_DIBTransferFunc(
- const CPDF_TransferFunc* pTransferFunc) {
+ const CFX_RetainPtr<CPDF_TransferFunc>& pTransferFunc)
+ : m_pTransferFunc(pTransferFunc) {
m_RampR = pTransferFunc->m_Samples;
m_RampG = &pTransferFunc->m_Samples[256];
m_RampB = &pTransferFunc->m_Samples[512];
diff --git a/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_dibtransferfunc.h b/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_dibtransferfunc.h
index d290c00d8ad..b22ae9c775e 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_dibtransferfunc.h
+++ b/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_dibtransferfunc.h
@@ -9,13 +9,16 @@
#include <vector>
+#include "core/fxge/dib/cfx_filtereddib.h"
#include "core/fxge/fx_dib.h"
class CPDF_TransferFunc;
class CPDF_DIBTransferFunc : public CFX_FilteredDIB {
public:
- explicit CPDF_DIBTransferFunc(const CPDF_TransferFunc* pTransferFunc);
+ template <typename T, typename... Args>
+ friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args);
+
~CPDF_DIBTransferFunc() override;
// CFX_FilteredDIB
@@ -29,9 +32,13 @@ class CPDF_DIBTransferFunc : public CFX_FilteredDIB {
int Bpp) const override;
private:
+ explicit CPDF_DIBTransferFunc(
+ const CFX_RetainPtr<CPDF_TransferFunc>& pTransferFunc);
+
const uint8_t* m_RampR;
const uint8_t* m_RampG;
const uint8_t* m_RampB;
+ CFX_RetainPtr<CPDF_TransferFunc> m_pTransferFunc;
};
#endif // CORE_FPDFAPI_RENDER_CPDF_DIBTRANSFERFUNC_H_
diff --git a/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_docrenderdata.cpp b/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_docrenderdata.cpp
index 0e6f2d07e5a..2d0bca44977 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_docrenderdata.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_docrenderdata.cpp
@@ -32,59 +32,43 @@ CPDF_DocRenderData::~CPDF_DocRenderData() {
void CPDF_DocRenderData::Clear(bool bRelease) {
for (auto it = m_Type3FaceMap.begin(); it != m_Type3FaceMap.end();) {
auto curr_it = it++;
- CPDF_CountedObject<CPDF_Type3Cache>* cache = curr_it->second;
- if (bRelease || cache->use_count() < 2) {
- delete cache->get();
- delete cache;
+ if (bRelease || curr_it->second->HasOneRef()) {
m_Type3FaceMap.erase(curr_it);
}
}
for (auto it = m_TransferFuncMap.begin(); it != m_TransferFuncMap.end();) {
auto curr_it = it++;
- CPDF_CountedObject<CPDF_TransferFunc>* value = curr_it->second;
- if (bRelease || value->use_count() < 2) {
- delete value->get();
- delete value;
+ if (bRelease || curr_it->second->HasOneRef())
m_TransferFuncMap.erase(curr_it);
- }
}
}
-CPDF_Type3Cache* CPDF_DocRenderData::GetCachedType3(CPDF_Type3Font* pFont) {
- CPDF_CountedObject<CPDF_Type3Cache>* pCache;
+CFX_RetainPtr<CPDF_Type3Cache> CPDF_DocRenderData::GetCachedType3(
+ CPDF_Type3Font* pFont) {
auto it = m_Type3FaceMap.find(pFont);
- if (it == m_Type3FaceMap.end()) {
- pCache = new CPDF_CountedObject<CPDF_Type3Cache>(
- pdfium::MakeUnique<CPDF_Type3Cache>(pFont));
- m_Type3FaceMap[pFont] = pCache;
- } else {
- pCache = it->second;
- }
- return pCache->AddRef();
+ if (it != m_Type3FaceMap.end())
+ return it->second;
+
+ auto pCache = pdfium::MakeRetain<CPDF_Type3Cache>(pFont);
+ m_Type3FaceMap[pFont] = pCache;
+ return pCache;
}
-void CPDF_DocRenderData::ReleaseCachedType3(CPDF_Type3Font* pFont) {
+void CPDF_DocRenderData::MaybePurgeCachedType3(CPDF_Type3Font* pFont) {
auto it = m_Type3FaceMap.find(pFont);
- if (it != m_Type3FaceMap.end()) {
- it->second->RemoveRef();
- if (it->second->use_count() < 2) {
- delete it->second->get();
- delete it->second;
- m_Type3FaceMap.erase(it);
- }
- }
+ if (it != m_Type3FaceMap.end() && it->second->HasOneRef())
+ m_Type3FaceMap.erase(it);
}
-CPDF_TransferFunc* CPDF_DocRenderData::GetTransferFunc(CPDF_Object* pObj) {
+CFX_RetainPtr<CPDF_TransferFunc> CPDF_DocRenderData::GetTransferFunc(
+ CPDF_Object* pObj) {
if (!pObj)
return nullptr;
auto it = m_TransferFuncMap.find(pObj);
- if (it != m_TransferFuncMap.end()) {
- CPDF_CountedObject<CPDF_TransferFunc>* pTransferCounter = it->second;
- return pTransferCounter->AddRef();
- }
+ if (it != m_TransferFuncMap.end())
+ return it->second;
std::unique_ptr<CPDF_Function> pFuncs[3];
bool bUniTransfer = true;
@@ -104,20 +88,18 @@ CPDF_TransferFunc* CPDF_DocRenderData::GetTransferFunc(CPDF_Object* pObj) {
if (!pFuncs[0])
return nullptr;
}
- CPDF_CountedObject<CPDF_TransferFunc>* pTransferCounter =
- new CPDF_CountedObject<CPDF_TransferFunc>(
- pdfium::MakeUnique<CPDF_TransferFunc>(m_pPDFDoc));
- CPDF_TransferFunc* pTransfer = pTransferCounter->get();
- m_TransferFuncMap[pObj] = pTransferCounter;
- FX_FLOAT output[kMaxOutputs];
- FXSYS_memset(output, 0, sizeof(output));
- FX_FLOAT input;
+ auto pTransfer = pdfium::MakeRetain<CPDF_TransferFunc>(m_pPDFDoc);
+ m_TransferFuncMap[pObj] = pTransfer;
+
+ float input;
int noutput;
+ float output[kMaxOutputs];
+ memset(output, 0, sizeof(output));
for (int v = 0; v < 256; ++v) {
- input = (FX_FLOAT)v / 255.0f;
+ input = (float)v / 255.0f;
if (bUniTransfer) {
if (pFuncs[0] && pFuncs[0]->CountOutputs() <= kMaxOutputs)
- pFuncs[0]->Call(&input, 1, output, noutput);
+ pFuncs[0]->Call(&input, 1, output, &noutput);
int o = FXSYS_round(output[0] * 255);
if (o != v)
bIdentity = false;
@@ -130,7 +112,7 @@ CPDF_TransferFunc* CPDF_DocRenderData::GetTransferFunc(CPDF_Object* pObj) {
pTransfer->m_Samples[i * 256 + v] = v;
continue;
}
- pFuncs[i]->Call(&input, 1, output, noutput);
+ pFuncs[i]->Call(&input, 1, output, &noutput);
int o = FXSYS_round(output[0] * 255);
if (o != v)
bIdentity = false;
@@ -139,17 +121,11 @@ CPDF_TransferFunc* CPDF_DocRenderData::GetTransferFunc(CPDF_Object* pObj) {
}
pTransfer->m_bIdentity = bIdentity;
- return pTransferCounter->AddRef();
+ return pTransfer;
}
-void CPDF_DocRenderData::ReleaseTransferFunc(CPDF_Object* pObj) {
+void CPDF_DocRenderData::MaybePurgeTransferFunc(CPDF_Object* pObj) {
auto it = m_TransferFuncMap.find(pObj);
- if (it != m_TransferFuncMap.end()) {
- it->second->RemoveRef();
- if (it->second->use_count() < 2) {
- delete it->second->get();
- delete it->second;
- m_TransferFuncMap.erase(it);
- }
- }
+ if (it != m_TransferFuncMap.end() && it->second->HasOneRef())
+ m_TransferFuncMap.erase(it);
}
diff --git a/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_docrenderdata.h b/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_docrenderdata.h
index a8f4167a8d9..7952f959915 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_docrenderdata.h
+++ b/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_docrenderdata.h
@@ -10,11 +10,11 @@
#include <map>
#include "core/fpdfapi/page/cpdf_countedobject.h"
+#include "core/fpdfapi/render/cpdf_transferfunc.h"
class CPDF_Document;
class CPDF_Font;
class CPDF_Object;
-class CPDF_TransferFunc;
class CPDF_Type3Cache;
class CPDF_Type3Font;
@@ -23,21 +23,18 @@ class CPDF_DocRenderData {
explicit CPDF_DocRenderData(CPDF_Document* pPDFDoc);
~CPDF_DocRenderData();
- CPDF_Type3Cache* GetCachedType3(CPDF_Type3Font* pFont);
- void ReleaseCachedType3(CPDF_Type3Font* pFont);
- CPDF_TransferFunc* GetTransferFunc(CPDF_Object* pObj);
- void ReleaseTransferFunc(CPDF_Object* pObj);
+ CFX_RetainPtr<CPDF_Type3Cache> GetCachedType3(CPDF_Type3Font* pFont);
+ void MaybePurgeCachedType3(CPDF_Type3Font* pFont);
+
+ CFX_RetainPtr<CPDF_TransferFunc> GetTransferFunc(CPDF_Object* pObj);
+ void MaybePurgeTransferFunc(CPDF_Object* pOb);
+
void Clear(bool bRelease);
private:
- using CPDF_Type3CacheMap =
- std::map<CPDF_Font*, CPDF_CountedObject<CPDF_Type3Cache>*>;
- using CPDF_TransferFuncMap =
- std::map<CPDF_Object*, CPDF_CountedObject<CPDF_TransferFunc>*>;
-
CPDF_Document* m_pPDFDoc; // Not Owned
- CPDF_Type3CacheMap m_Type3FaceMap;
- CPDF_TransferFuncMap m_TransferFuncMap;
+ std::map<CPDF_Font*, CFX_RetainPtr<CPDF_Type3Cache>> m_Type3FaceMap;
+ std::map<CPDF_Object*, CFX_RetainPtr<CPDF_TransferFunc>> m_TransferFuncMap;
};
#endif // CORE_FPDFAPI_RENDER_CPDF_DOCRENDERDATA_H_
diff --git a/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_imagecacheentry.cpp b/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_imagecacheentry.cpp
index 82b6117f863..751b3eb4b43 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_imagecacheentry.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_imagecacheentry.cpp
@@ -31,30 +31,27 @@ CPDF_ImageCacheEntry::CPDF_ImageCacheEntry(CPDF_Document* pDoc,
CPDF_ImageCacheEntry::~CPDF_ImageCacheEntry() {}
-void CPDF_ImageCacheEntry::Reset(const CFX_DIBitmap* pBitmap) {
- m_pCachedBitmap.reset();
+void CPDF_ImageCacheEntry::Reset(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap) {
+ m_pCachedBitmap.Reset();
if (pBitmap)
m_pCachedBitmap = pBitmap->Clone();
CalcSize();
}
-static uint32_t FPDF_ImageCache_EstimateImageSize(const CFX_DIBSource* pDIB) {
+static uint32_t FPDF_ImageCache_EstimateImageSize(
+ const CFX_RetainPtr<CFX_DIBSource>& pDIB) {
return pDIB && pDIB->GetBuffer()
? (uint32_t)pDIB->GetHeight() * pDIB->GetPitch() +
(uint32_t)pDIB->GetPaletteSize() * 4
: 0;
}
-CFX_DIBSource* CPDF_ImageCacheEntry::DetachBitmap() {
- CFX_DIBSource* pDIBSource = m_pCurBitmap;
- m_pCurBitmap = nullptr;
- return pDIBSource;
+CFX_RetainPtr<CFX_DIBSource> CPDF_ImageCacheEntry::DetachBitmap() {
+ return std::move(m_pCurBitmap);
}
-CFX_DIBSource* CPDF_ImageCacheEntry::DetachMask() {
- CFX_DIBSource* pDIBSource = m_pCurMask;
- m_pCurMask = nullptr;
- return pDIBSource;
+CFX_RetainPtr<CFX_DIBSource> CPDF_ImageCacheEntry::DetachMask() {
+ return std::move(m_pCurMask);
}
int CPDF_ImageCacheEntry::StartGetCachedBitmap(CPDF_Dictionary* pFormResources,
@@ -66,25 +63,23 @@ int CPDF_ImageCacheEntry::StartGetCachedBitmap(CPDF_Dictionary* pFormResources,
int32_t downsampleWidth,
int32_t downsampleHeight) {
if (m_pCachedBitmap) {
- m_pCurBitmap = m_pCachedBitmap.get();
- m_pCurMask = m_pCachedMask.get();
+ m_pCurBitmap = m_pCachedBitmap;
+ m_pCurMask = m_pCachedMask;
return 1;
}
if (!pRenderStatus)
return 0;
m_pRenderStatus = pRenderStatus;
- m_pCurBitmap = new CPDF_DIBSource;
- int ret =
- ((CPDF_DIBSource*)m_pCurBitmap)
- ->StartLoadDIBSource(m_pDocument, m_pStream, true, pFormResources,
- pPageResources, bStdCS, GroupFamily, bLoadMask);
+ m_pCurBitmap = pdfium::MakeRetain<CPDF_DIBSource>();
+ int ret = m_pCurBitmap.As<CPDF_DIBSource>()->StartLoadDIBSource(
+ m_pDocument, m_pStream, true, pFormResources, pPageResources, bStdCS,
+ GroupFamily, bLoadMask);
if (ret == 2)
return ret;
if (!ret) {
- delete m_pCurBitmap;
- m_pCurBitmap = nullptr;
+ m_pCurBitmap.Reset();
return 0;
}
ContinueGetCachedBitmap();
@@ -92,44 +87,41 @@ int CPDF_ImageCacheEntry::StartGetCachedBitmap(CPDF_Dictionary* pFormResources,
}
void CPDF_ImageCacheEntry::ContinueGetCachedBitmap() {
- m_MatteColor = ((CPDF_DIBSource*)m_pCurBitmap)->GetMatteColor();
- m_pCurMask = ((CPDF_DIBSource*)m_pCurBitmap)->DetachMask();
+ m_MatteColor = m_pCurBitmap.As<CPDF_DIBSource>()->GetMatteColor();
+ m_pCurMask = m_pCurBitmap.As<CPDF_DIBSource>()->DetachMask();
CPDF_RenderContext* pContext = m_pRenderStatus->GetContext();
CPDF_PageRenderCache* pPageRenderCache = pContext->GetPageCache();
m_dwTimeCount = pPageRenderCache->GetTimeCount();
if (m_pCurBitmap->GetPitch() * m_pCurBitmap->GetHeight() <
FPDF_HUGE_IMAGE_SIZE) {
m_pCachedBitmap = m_pCurBitmap->Clone();
- delete m_pCurBitmap;
- m_pCurBitmap = nullptr;
+ m_pCurBitmap.Reset();
} else {
- m_pCachedBitmap = pdfium::WrapUnique<CFX_DIBSource>(m_pCurBitmap);
+ m_pCachedBitmap = m_pCurBitmap;
}
if (m_pCurMask) {
m_pCachedMask = m_pCurMask->Clone();
- delete m_pCurMask;
- m_pCurMask = nullptr;
+ m_pCurMask.Reset();
}
- m_pCurBitmap = m_pCachedBitmap.get();
- m_pCurMask = m_pCachedMask.get();
+ m_pCurBitmap = m_pCachedBitmap;
+ m_pCurMask = m_pCachedMask;
CalcSize();
}
int CPDF_ImageCacheEntry::Continue(IFX_Pause* pPause) {
- int ret = ((CPDF_DIBSource*)m_pCurBitmap)->ContinueLoadDIBSource(pPause);
- if (ret == 2)
- return ret;
-
+ int ret = m_pCurBitmap.As<CPDF_DIBSource>()->ContinueLoadDIBSource(pPause);
if (!ret) {
- delete m_pCurBitmap;
- m_pCurBitmap = nullptr;
+ m_pCurBitmap.Reset();
return 0;
}
+ if (ret == 2)
+ return ret;
+
ContinueGetCachedBitmap();
return 0;
}
void CPDF_ImageCacheEntry::CalcSize() {
- m_dwCacheSize = FPDF_ImageCache_EstimateImageSize(m_pCachedBitmap.get()) +
- FPDF_ImageCache_EstimateImageSize(m_pCachedMask.get());
+ m_dwCacheSize = FPDF_ImageCache_EstimateImageSize(m_pCachedBitmap) +
+ FPDF_ImageCache_EstimateImageSize(m_pCachedMask);
}
diff --git a/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_imagecacheentry.h b/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_imagecacheentry.h
index d11fe94c296..b17d3fdda21 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_imagecacheentry.h
+++ b/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_imagecacheentry.h
@@ -9,6 +9,7 @@
#include <memory>
+#include "core/fxcrt/cfx_retain_ptr.h"
#include "core/fxcrt/fx_system.h"
class CFX_DIBitmap;
@@ -24,7 +25,7 @@ class CPDF_ImageCacheEntry {
CPDF_ImageCacheEntry(CPDF_Document* pDoc, CPDF_Stream* pStream);
~CPDF_ImageCacheEntry();
- void Reset(const CFX_DIBitmap* pBitmap);
+ void Reset(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap);
uint32_t EstimateSize() const { return m_dwCacheSize; }
uint32_t GetTimeCount() const { return m_dwTimeCount; }
CPDF_Stream* GetStream() const { return m_pStream; }
@@ -38,8 +39,8 @@ class CPDF_ImageCacheEntry {
int32_t downsampleWidth,
int32_t downsampleHeight);
int Continue(IFX_Pause* pPause);
- CFX_DIBSource* DetachBitmap();
- CFX_DIBSource* DetachMask();
+ CFX_RetainPtr<CFX_DIBSource> DetachBitmap();
+ CFX_RetainPtr<CFX_DIBSource> DetachMask();
int m_dwTimeCount;
uint32_t m_MatteColor;
@@ -51,10 +52,10 @@ class CPDF_ImageCacheEntry {
CPDF_RenderStatus* m_pRenderStatus;
CPDF_Document* m_pDocument;
CPDF_Stream* m_pStream;
- CFX_DIBSource* m_pCurBitmap;
- CFX_DIBSource* m_pCurMask;
- std::unique_ptr<CFX_DIBSource> m_pCachedBitmap;
- std::unique_ptr<CFX_DIBSource> m_pCachedMask;
+ CFX_RetainPtr<CFX_DIBSource> m_pCurBitmap;
+ CFX_RetainPtr<CFX_DIBSource> m_pCurMask;
+ CFX_RetainPtr<CFX_DIBSource> m_pCachedBitmap;
+ CFX_RetainPtr<CFX_DIBSource> m_pCachedMask;
uint32_t m_dwCacheSize;
};
diff --git a/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_imageloader.cpp b/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_imageloader.cpp
index 18213ea6954..230dc02fe52 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_imageloader.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_imageloader.cpp
@@ -15,21 +15,14 @@
#include "core/fxcrt/fx_basic.h"
CPDF_ImageLoader::CPDF_ImageLoader()
- : m_pBitmap(nullptr),
- m_pMask(nullptr),
- m_MatteColor(0),
+ : m_MatteColor(0),
m_bCached(false),
m_nDownsampleWidth(0),
m_nDownsampleHeight(0),
m_pCache(nullptr),
m_pImage(nullptr) {}
-CPDF_ImageLoader::~CPDF_ImageLoader() {
- if (!m_bCached) {
- delete m_pBitmap;
- delete m_pMask;
- }
-}
+CPDF_ImageLoader::~CPDF_ImageLoader() {}
bool CPDF_ImageLoader::Start(const CPDF_ImageObject* pImage,
CPDF_PageRenderCache* pCache,
@@ -75,7 +68,7 @@ void CPDF_ImageLoader::HandleFailure() {
m_MatteColor = entry->m_MatteColor;
return;
}
- CPDF_Image* pImage = m_pImage->GetImage();
+ CFX_RetainPtr<CPDF_Image> pImage = m_pImage->GetImage();
m_bCached = false;
m_pBitmap = pImage->DetachBitmap();
m_pMask = pImage->DetachMask();
diff --git a/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_imageloader.h b/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_imageloader.h
index a270c45bbfb..c7161c34865 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_imageloader.h
+++ b/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_imageloader.h
@@ -31,8 +31,8 @@ class CPDF_ImageLoader {
int32_t nDownsampleHeight);
bool Continue(IFX_Pause* pPause);
- CFX_DIBSource* m_pBitmap;
- CFX_DIBSource* m_pMask;
+ CFX_RetainPtr<CFX_DIBSource> m_pBitmap;
+ CFX_RetainPtr<CFX_DIBSource> m_pMask;
uint32_t m_MatteColor;
bool m_bCached;
diff --git a/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_imagerenderer.cpp b/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_imagerenderer.cpp
index 358d13edd0c..b4cc36f6c36 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_imagerenderer.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_imagerenderer.cpp
@@ -29,29 +29,29 @@
#include "core/fxcrt/fx_safe_types.h"
#include "core/fxge/cfx_fxgedevice.h"
#include "core/fxge/cfx_pathdata.h"
+#include "core/fxge/dib/cfx_dibitmap.h"
+#include "core/fxge/dib/cfx_dibsource.h"
+#include "core/fxge/dib/cfx_imagestretcher.h"
+#include "core/fxge/dib/cfx_imagetransformer.h"
#include "third_party/base/ptr_util.h"
+#include "third_party/base/stl_util.h"
#ifdef _SKIA_SUPPORT_
#include "core/fxge/skia/fx_skia_device.h"
#endif
-CPDF_ImageRenderer::CPDF_ImageRenderer() {
- m_pRenderStatus = nullptr;
- m_pImageObject = nullptr;
- m_Result = true;
- m_Status = 0;
- m_DeviceHandle = nullptr;
- m_bStdCS = false;
- m_bPatternColor = false;
- m_BlendType = FXDIB_BLEND_NORMAL;
- m_pPattern = nullptr;
- m_pObj2Device = nullptr;
-}
+CPDF_ImageRenderer::CPDF_ImageRenderer()
+ : m_pRenderStatus(nullptr),
+ m_pImageObject(nullptr),
+ m_Status(0),
+ m_pObj2Device(nullptr),
+ m_bPatternColor(false),
+ m_pPattern(nullptr),
+ m_bStdCS(false),
+ m_BlendType(FXDIB_BLEND_NORMAL),
+ m_Result(true) {}
-CPDF_ImageRenderer::~CPDF_ImageRenderer() {
- if (m_DeviceHandle)
- m_pRenderStatus->m_pDevice->CancelDIBits(m_DeviceHandle);
-}
+CPDF_ImageRenderer::~CPDF_ImageRenderer() {}
bool CPDF_ImageRenderer::StartLoadDIBSource() {
CFX_FloatRect image_rect_f = m_ImageMatrix.GetUnitRect();
@@ -94,9 +94,9 @@ bool CPDF_ImageRenderer::StartRenderDIBSource() {
!m_pImageObject->m_GeneralState.GetTransferFunc()->m_bIdentity) {
m_pDIBSource = m_Loader.m_pBitmap =
m_pImageObject->m_GeneralState.GetTransferFunc()->TranslateImage(
- m_Loader.m_pBitmap, !m_Loader.m_bCached);
+ m_Loader.m_pBitmap);
if (m_Loader.m_bCached && m_Loader.m_pMask)
- m_Loader.m_pMask = m_Loader.m_pMask->Clone().release();
+ m_Loader.m_pMask = m_Loader.m_pMask->Clone();
m_Loader.m_bCached = false;
}
}
@@ -115,7 +115,7 @@ bool CPDF_ImageRenderer::StartRenderDIBSource() {
m_pClone = m_pDIBSource->Clone();
m_pClone->ConvertColorScale(m_pRenderStatus->m_Options.m_BackColor,
m_pRenderStatus->m_Options.m_ForeColor);
- m_pDIBSource = m_pClone.get();
+ m_pDIBSource = m_pClone;
}
m_Flags = 0;
if (m_pRenderStatus->m_Options.m_Flags & RENDER_FORCE_DOWNSAMPLE)
@@ -208,7 +208,7 @@ bool CPDF_ImageRenderer::Start(CPDF_RenderStatus* pStatus,
}
bool CPDF_ImageRenderer::Start(CPDF_RenderStatus* pStatus,
- const CFX_DIBSource* pDIBSource,
+ const CFX_RetainPtr<CFX_DIBSource>& pDIBSource,
FX_ARGB bitmap_argb,
int bitmap_alpha,
const CFX_Matrix* pImage2Device,
@@ -243,11 +243,12 @@ CFX_Matrix CPDF_ImageRenderer::GetDrawMatrix(const FX_RECT& rect) const {
return new_matrix;
}
-void CPDF_ImageRenderer::CalculateDrawImage(CFX_FxgeDevice* pBitmapDevice1,
- CFX_FxgeDevice* pBitmapDevice2,
- const CFX_DIBSource* pDIBSource,
- CFX_Matrix* pNewMatrix,
- const FX_RECT& rect) const {
+void CPDF_ImageRenderer::CalculateDrawImage(
+ CFX_FxgeDevice* pBitmapDevice1,
+ CFX_FxgeDevice* pBitmapDevice2,
+ const CFX_RetainPtr<CFX_DIBSource>& pDIBSource,
+ CFX_Matrix* pNewMatrix,
+ const FX_RECT& rect) const {
CPDF_RenderStatus bitmap_render;
bitmap_render.Initialize(m_pRenderStatus->m_pContext, pBitmapDevice2, nullptr,
nullptr, nullptr, nullptr, nullptr, 0,
@@ -273,11 +274,11 @@ void CPDF_ImageRenderer::CalculateDrawImage(CFX_FxgeDevice* pBitmapDevice1,
continue;
}
int orig = (*dest_scan - matte_b) * 255 / alpha + matte_b;
- *dest_scan++ = std::min(std::max(orig, 0), 255);
+ *dest_scan++ = pdfium::clamp(orig, 0, 255);
orig = (*dest_scan - matte_g) * 255 / alpha + matte_g;
- *dest_scan++ = std::min(std::max(orig, 0), 255);
+ *dest_scan++ = pdfium::clamp(orig, 0, 255);
orig = (*dest_scan - matte_r) * 255 / alpha + matte_r;
- *dest_scan++ = std::min(std::max(orig, 0), 255);
+ *dest_scan++ = pdfium::clamp(orig, 0, 255);
dest_scan++;
}
}
@@ -305,7 +306,7 @@ bool CPDF_ImageRenderer::DrawPatternImage(const CFX_Matrix* pObj2Device) {
&m_pRenderStatus->m_Options, 0,
m_pRenderStatus->m_bDropObjects, nullptr, true);
CFX_Matrix patternDevice = *pObj2Device;
- patternDevice.Translate((FX_FLOAT)-rect.left, (FX_FLOAT)-rect.top);
+ patternDevice.Translate((float)-rect.left, (float)-rect.top);
if (CPDF_TilingPattern* pTilingPattern = m_pPattern->AsTilingPattern()) {
bitmap_render.DrawTilingPattern(pTilingPattern, m_pImageObject,
&patternDevice, false);
@@ -402,12 +403,12 @@ bool CPDF_ImageRenderer::StartDIBSource() {
}
}
#ifdef _SKIA_SUPPORT_
- CFX_DIBitmap* premultiplied = m_pDIBSource->Clone().release();
+ CFX_RetainPtr<CFX_DIBitmap> premultiplied = m_pDIBSource->Clone();
if (m_pDIBSource->HasAlpha())
CFX_SkiaDeviceDriver::PreMultiply(premultiplied);
if (m_pRenderStatus->m_pDevice->StartDIBitsWithBlend(
premultiplied, m_BitmapAlpha, m_FillArgb, &m_ImageMatrix, m_Flags,
- m_DeviceHandle, m_BlendType)) {
+ &m_DeviceHandle, m_BlendType)) {
if (m_DeviceHandle) {
m_Status = 3;
return true;
@@ -417,7 +418,7 @@ bool CPDF_ImageRenderer::StartDIBSource() {
#else
if (m_pRenderStatus->m_pDevice->StartDIBitsWithBlend(
m_pDIBSource, m_BitmapAlpha, m_FillArgb, &m_ImageMatrix, m_Flags,
- m_DeviceHandle, m_BlendType)) {
+ &m_DeviceHandle, m_BlendType)) {
if (m_DeviceHandle) {
m_Status = 3;
return true;
@@ -429,8 +430,8 @@ bool CPDF_ImageRenderer::StartDIBSource() {
FX_RECT image_rect = image_rect_f.GetOuterRect();
int dest_width = image_rect.Width();
int dest_height = image_rect.Height();
- if ((FXSYS_fabs(m_ImageMatrix.b) >= 0.5f || m_ImageMatrix.a == 0) ||
- (FXSYS_fabs(m_ImageMatrix.c) >= 0.5f || m_ImageMatrix.d == 0)) {
+ if ((fabs(m_ImageMatrix.b) >= 0.5f || m_ImageMatrix.a == 0) ||
+ (fabs(m_ImageMatrix.c) >= 0.5f || m_ImageMatrix.d == 0)) {
if (NotDrawing()) {
m_Result = false;
return false;
@@ -479,10 +480,10 @@ bool CPDF_ImageRenderer::StartDIBSource() {
FX_RECT dest_clip(
dest_rect.left - image_rect.left, dest_rect.top - image_rect.top,
dest_rect.right - image_rect.left, dest_rect.bottom - image_rect.top);
- std::unique_ptr<CFX_DIBitmap> pStretched(
- m_pDIBSource->StretchTo(dest_width, dest_height, m_Flags, &dest_clip));
+ CFX_RetainPtr<CFX_DIBitmap> pStretched =
+ m_pDIBSource->StretchTo(dest_width, dest_height, m_Flags, &dest_clip);
if (pStretched) {
- m_pRenderStatus->CompositeDIBitmap(pStretched.get(), dest_rect.left,
+ m_pRenderStatus->CompositeDIBitmap(pStretched, dest_rect.left,
dest_rect.top, m_FillArgb, m_BitmapAlpha,
m_BlendType, false);
}
@@ -500,23 +501,22 @@ bool CPDF_ImageRenderer::StartBitmapAlpha() {
FXFILL_WINDING);
return false;
}
- CFX_MaybeOwned<CFX_DIBSource> pAlphaMask;
+ CFX_RetainPtr<CFX_DIBSource> pAlphaMask;
if (m_pDIBSource->IsAlphaMask())
- pAlphaMask = const_cast<CFX_DIBSource*>(m_pDIBSource);
+ pAlphaMask = m_pDIBSource;
else
pAlphaMask = m_pDIBSource->CloneAlphaMask();
- if (FXSYS_fabs(m_ImageMatrix.b) >= 0.5f ||
- FXSYS_fabs(m_ImageMatrix.c) >= 0.5f) {
+ if (fabs(m_ImageMatrix.b) >= 0.5f || fabs(m_ImageMatrix.c) >= 0.5f) {
int left;
int top;
- std::unique_ptr<CFX_DIBitmap> pTransformed =
+ CFX_RetainPtr<CFX_DIBitmap> pTransformed =
pAlphaMask->TransformTo(&m_ImageMatrix, left, top);
if (!pTransformed)
return true;
m_pRenderStatus->m_pDevice->SetBitMask(
- pTransformed.get(), left, top,
+ pTransformed, left, top,
ArgbEncode(0xff, m_BitmapAlpha, m_BitmapAlpha, m_BitmapAlpha));
return false;
}
@@ -529,7 +529,7 @@ bool CPDF_ImageRenderer::StartBitmapAlpha() {
int left = dest_width > 0 ? image_rect.left : image_rect.right;
int top = dest_height > 0 ? image_rect.top : image_rect.bottom;
m_pRenderStatus->m_pDevice->StretchBitMask(
- pAlphaMask.Get(), left, top, dest_width, dest_height,
+ pAlphaMask, left, top, dest_width, dest_height,
ArgbEncode(0xff, m_BitmapAlpha, m_BitmapAlpha, m_BitmapAlpha));
return false;
}
@@ -539,7 +539,7 @@ bool CPDF_ImageRenderer::Continue(IFX_Pause* pPause) {
if (m_pTransformer->Continue(pPause))
return true;
- std::unique_ptr<CFX_DIBitmap> pBitmap(m_pTransformer->DetachBitmap());
+ CFX_RetainPtr<CFX_DIBitmap> pBitmap = m_pTransformer->DetachBitmap();
if (!pBitmap)
return false;
@@ -547,19 +547,20 @@ bool CPDF_ImageRenderer::Continue(IFX_Pause* pPause) {
if (m_BitmapAlpha != 255)
m_FillArgb = FXARGB_MUL_ALPHA(m_FillArgb, m_BitmapAlpha);
m_Result = m_pRenderStatus->m_pDevice->SetBitMask(
- pBitmap.get(), m_pTransformer->result().left,
- m_pTransformer->result().top, m_FillArgb);
+ pBitmap, m_pTransformer->result().left, m_pTransformer->result().top,
+ m_FillArgb);
} else {
if (m_BitmapAlpha != 255)
pBitmap->MultiplyAlpha(m_BitmapAlpha);
m_Result = m_pRenderStatus->m_pDevice->SetDIBitsWithBlend(
- pBitmap.get(), m_pTransformer->result().left,
- m_pTransformer->result().top, m_BlendType);
+ pBitmap, m_pTransformer->result().left, m_pTransformer->result().top,
+ m_BlendType);
}
return false;
}
if (m_Status == 3)
- return m_pRenderStatus->m_pDevice->ContinueDIBits(m_DeviceHandle, pPause);
+ return m_pRenderStatus->m_pDevice->ContinueDIBits(m_DeviceHandle.get(),
+ pPause);
if (m_Status == 4) {
if (m_Loader.Continue(pPause))
diff --git a/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_imagerenderer.h b/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_imagerenderer.h
index d358716e9fe..79bb018886f 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_imagerenderer.h
+++ b/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_imagerenderer.h
@@ -10,7 +10,11 @@
#include <memory>
#include "core/fpdfapi/render/cpdf_imageloader.h"
+#include "core/fxcrt/fx_coordinates.h"
+#include "core/fxge/dib/cfx_imagerenderer.h"
+class CFX_DIBitmap;
+class CFX_DIBSource;
class CFX_FxgeDevice;
class CFX_ImageTransformer;
class CPDF_ImageObject;
@@ -30,7 +34,7 @@ class CPDF_ImageRenderer {
int blendType);
bool Start(CPDF_RenderStatus* pStatus,
- const CFX_DIBSource* pDIBSource,
+ const CFX_RetainPtr<CFX_DIBSource>& pDIBSource,
FX_ARGB bitmap_argb,
int bitmap_alpha,
const CFX_Matrix* pImage2Device,
@@ -53,7 +57,7 @@ class CPDF_ImageRenderer {
CFX_Matrix GetDrawMatrix(const FX_RECT& rect) const;
void CalculateDrawImage(CFX_FxgeDevice* bitmap_device1,
CFX_FxgeDevice* bitmap_device2,
- const CFX_DIBSource* pDIBSource,
+ const CFX_RetainPtr<CFX_DIBSource>& pDIBSource,
CFX_Matrix* pNewMatrix,
const FX_RECT& rect) const;
@@ -63,15 +67,15 @@ class CPDF_ImageRenderer {
const CFX_Matrix* m_pObj2Device;
CFX_Matrix m_ImageMatrix;
CPDF_ImageLoader m_Loader;
- const CFX_DIBSource* m_pDIBSource;
- std::unique_ptr<CFX_DIBitmap> m_pClone;
+ CFX_RetainPtr<CFX_DIBSource> m_pDIBSource;
+ CFX_RetainPtr<CFX_DIBitmap> m_pClone;
int m_BitmapAlpha;
bool m_bPatternColor;
CPDF_Pattern* m_pPattern;
FX_ARGB m_FillArgb;
uint32_t m_Flags;
std::unique_ptr<CFX_ImageTransformer> m_pTransformer;
- void* m_DeviceHandle;
+ std::unique_ptr<CFX_ImageRenderer> m_DeviceHandle;
bool m_bStdCS;
int m_BlendType;
bool m_Result;
diff --git a/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_pagerendercache.cpp b/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_pagerendercache.cpp
index faa9732f9b0..549f466527f 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_pagerendercache.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_pagerendercache.cpp
@@ -48,7 +48,7 @@ void CPDF_PageRenderCache::CacheOptimization(int32_t dwLimitCacheSize) {
pCACHEINFO[i].time = it.second->GetTimeCount();
pCACHEINFO[i++].pStream = it.second->GetStream();
}
- FXSYS_qsort(pCACHEINFO, nCount, sizeof(CACHEINFO), compare);
+ qsort(pCACHEINFO, nCount, sizeof(CACHEINFO), compare);
uint32_t nTimeCount = m_nTimeCount;
// Check if time value is about to roll over and reset all entries.
@@ -124,8 +124,9 @@ bool CPDF_PageRenderCache::Continue(IFX_Pause* pPause) {
return false;
}
-void CPDF_PageRenderCache::ResetBitmap(CPDF_Stream* pStream,
- const CFX_DIBitmap* pBitmap) {
+void CPDF_PageRenderCache::ResetBitmap(
+ CPDF_Stream* pStream,
+ const CFX_RetainPtr<CFX_DIBitmap>& pBitmap) {
CPDF_ImageCacheEntry* pEntry;
const auto it = m_ImageCache.find(pStream);
if (it == m_ImageCache.end()) {
diff --git a/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_pagerendercache.h b/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_pagerendercache.h
index 6c9ed769115..affd55bbfe3 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_pagerendercache.h
+++ b/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_pagerendercache.h
@@ -9,6 +9,7 @@
#include <map>
+#include "core/fxcrt/cfx_retain_ptr.h"
#include "core/fxcrt/fx_system.h"
class CPDF_Stream;
@@ -27,7 +28,8 @@ class CPDF_PageRenderCache {
void CacheOptimization(int32_t dwLimitCacheSize);
uint32_t GetTimeCount() const { return m_nTimeCount; }
- void ResetBitmap(CPDF_Stream* pStream, const CFX_DIBitmap* pBitmap);
+ void ResetBitmap(CPDF_Stream* pStream,
+ const CFX_RetainPtr<CFX_DIBitmap>& pBitmap);
CPDF_Page* GetPage() const { return m_pPage; }
CPDF_ImageCacheEntry* GetCurImageCacheEntry() const {
return m_pCurImageCacheEntry;
diff --git a/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_rendercontext.cpp b/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_rendercontext.cpp
index d74f7298586..07af2cc172b 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_rendercontext.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_rendercontext.cpp
@@ -30,10 +30,11 @@ CPDF_RenderContext::CPDF_RenderContext(CPDF_Document* pDoc,
CPDF_RenderContext::~CPDF_RenderContext() {}
-void CPDF_RenderContext::GetBackground(CFX_DIBitmap* pBuffer,
- const CPDF_PageObject* pObj,
- const CPDF_RenderOptions* pOptions,
- CFX_Matrix* pFinalMatrix) {
+void CPDF_RenderContext::GetBackground(
+ const CFX_RetainPtr<CFX_DIBitmap>& pBuffer,
+ const CPDF_PageObject* pObj,
+ const CPDF_RenderOptions* pOptions,
+ CFX_Matrix* pFinalMatrix) {
CFX_FxgeDevice device;
device.Attach(pBuffer, false, nullptr, false);
diff --git a/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_rendercontext.h b/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_rendercontext.h
index a9fd2db78ba..0cce1ae77e4 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_rendercontext.h
+++ b/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_rendercontext.h
@@ -47,7 +47,7 @@ class CPDF_RenderContext {
const CPDF_RenderOptions* pOptions,
const CFX_Matrix* pFinalMatrix);
- void GetBackground(CFX_DIBitmap* pBuffer,
+ void GetBackground(const CFX_RetainPtr<CFX_DIBitmap>& pBuffer,
const CPDF_PageObject* pObj,
const CPDF_RenderOptions* pOptions,
CFX_Matrix* pFinalMatrix);
diff --git a/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_renderstatus.cpp b/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_renderstatus.cpp
index 9022212eccb..d175684233b 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_renderstatus.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_renderstatus.cpp
@@ -66,11 +66,12 @@
namespace {
void ReleaseCachedType3(CPDF_Type3Font* pFont) {
- if (!pFont->m_pDocument)
+ CPDF_Document* pDoc = pFont->m_pDocument;
+ if (!pDoc)
return;
- pFont->m_pDocument->GetRenderData()->ReleaseCachedType3(pFont);
- pFont->m_pDocument->GetPageData()->ReleaseFont(pFont->GetFontDict());
+ pDoc->GetRenderData()->MaybePurgeCachedType3(pFont);
+ pDoc->GetPageData()->ReleaseFont(pFont->GetFontDict());
}
class CPDF_RefType3Cache {
@@ -97,7 +98,7 @@ uint32_t CountOutputs(
return total;
}
-void DrawAxialShading(CFX_DIBitmap* pBitmap,
+void DrawAxialShading(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
CFX_Matrix* pObject2Bitmap,
CPDF_Dictionary* pDict,
const std::vector<std::unique_ptr<CPDF_Function>>& funcs,
@@ -108,12 +109,12 @@ void DrawAxialShading(CFX_DIBitmap* pBitmap,
if (!pCoords)
return;
- FX_FLOAT start_x = pCoords->GetNumberAt(0);
- FX_FLOAT start_y = pCoords->GetNumberAt(1);
- FX_FLOAT end_x = pCoords->GetNumberAt(2);
- FX_FLOAT end_y = pCoords->GetNumberAt(3);
- FX_FLOAT t_min = 0;
- FX_FLOAT t_max = 1.0f;
+ float start_x = pCoords->GetNumberAt(0);
+ float start_y = pCoords->GetNumberAt(1);
+ float end_x = pCoords->GetNumberAt(2);
+ float end_y = pCoords->GetNumberAt(3);
+ float t_min = 0;
+ float t_max = 1.0f;
CPDF_Array* pArray = pDict->GetArrayFor("Domain");
if (pArray) {
t_min = pArray->GetNumberAt(0);
@@ -128,29 +129,31 @@ void DrawAxialShading(CFX_DIBitmap* pBitmap,
}
int width = pBitmap->GetWidth();
int height = pBitmap->GetHeight();
- FX_FLOAT x_span = end_x - start_x;
- FX_FLOAT y_span = end_y - start_y;
- FX_FLOAT axis_len_square = (x_span * x_span) + (y_span * y_span);
+ float x_span = end_x - start_x;
+ float y_span = end_y - start_y;
+ float axis_len_square = (x_span * x_span) + (y_span * y_span);
CFX_Matrix matrix;
matrix.SetReverse(*pObject2Bitmap);
uint32_t total_results =
std::max(CountOutputs(funcs), pCS->CountComponents());
- CFX_FixedBufGrow<FX_FLOAT, 16> result_array(total_results);
- FX_FLOAT* pResults = result_array;
- FXSYS_memset(pResults, 0, total_results * sizeof(FX_FLOAT));
+ CFX_FixedBufGrow<float, 16> result_array(total_results);
+ float* pResults = result_array;
+ memset(pResults, 0, total_results * sizeof(float));
uint32_t rgb_array[SHADING_STEPS];
for (int i = 0; i < SHADING_STEPS; i++) {
- FX_FLOAT input = (t_max - t_min) * i / SHADING_STEPS + t_min;
+ float input = (t_max - t_min) * i / SHADING_STEPS + t_min;
int offset = 0;
for (const auto& func : funcs) {
if (func) {
int nresults = 0;
- if (func->Call(&input, 1, pResults + offset, nresults))
+ if (func->Call(&input, 1, pResults + offset, &nresults))
offset += nresults;
}
}
- FX_FLOAT R = 0.0f, G = 0.0f, B = 0.0f;
- pCS->GetRGB(pResults, R, G, B);
+ float R = 0.0f;
+ float G = 0.0f;
+ float B = 0.0f;
+ pCS->GetRGB(pResults, &R, &G, &B);
rgb_array[i] =
FXARGB_TODIB(FXARGB_MAKE(alpha, FXSYS_round(R * 255),
FXSYS_round(G * 255), FXSYS_round(B * 255)));
@@ -159,9 +162,9 @@ void DrawAxialShading(CFX_DIBitmap* pBitmap,
for (int row = 0; row < height; row++) {
uint32_t* dib_buf = (uint32_t*)(pBitmap->GetBuffer() + row * pitch);
for (int column = 0; column < width; column++) {
- CFX_PointF pos = matrix.Transform(CFX_PointF(
- static_cast<FX_FLOAT>(column), static_cast<FX_FLOAT>(row)));
- FX_FLOAT scale =
+ CFX_PointF pos = matrix.Transform(
+ CFX_PointF(static_cast<float>(column), static_cast<float>(row)));
+ float scale =
(((pos.x - start_x) * x_span) + ((pos.y - start_y) * y_span)) /
axis_len_square;
int index = (int32_t)(scale * (SHADING_STEPS - 1));
@@ -181,7 +184,7 @@ void DrawAxialShading(CFX_DIBitmap* pBitmap,
}
}
-void DrawRadialShading(CFX_DIBitmap* pBitmap,
+void DrawRadialShading(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
CFX_Matrix* pObject2Bitmap,
CPDF_Dictionary* pDict,
const std::vector<std::unique_ptr<CPDF_Function>>& funcs,
@@ -192,16 +195,16 @@ void DrawRadialShading(CFX_DIBitmap* pBitmap,
if (!pCoords)
return;
- FX_FLOAT start_x = pCoords->GetNumberAt(0);
- FX_FLOAT start_y = pCoords->GetNumberAt(1);
- FX_FLOAT start_r = pCoords->GetNumberAt(2);
- FX_FLOAT end_x = pCoords->GetNumberAt(3);
- FX_FLOAT end_y = pCoords->GetNumberAt(4);
- FX_FLOAT end_r = pCoords->GetNumberAt(5);
+ float start_x = pCoords->GetNumberAt(0);
+ float start_y = pCoords->GetNumberAt(1);
+ float start_r = pCoords->GetNumberAt(2);
+ float end_x = pCoords->GetNumberAt(3);
+ float end_y = pCoords->GetNumberAt(4);
+ float end_r = pCoords->GetNumberAt(5);
CFX_Matrix matrix;
matrix.SetReverse(*pObject2Bitmap);
- FX_FLOAT t_min = 0;
- FX_FLOAT t_max = 1.0f;
+ float t_min = 0;
+ float t_max = 1.0f;
CPDF_Array* pArray = pDict->GetArrayFor("Domain");
if (pArray) {
t_min = pArray->GetNumberAt(0);
@@ -216,36 +219,38 @@ void DrawRadialShading(CFX_DIBitmap* pBitmap,
}
uint32_t total_results =
std::max(CountOutputs(funcs), pCS->CountComponents());
- CFX_FixedBufGrow<FX_FLOAT, 16> result_array(total_results);
- FX_FLOAT* pResults = result_array;
- FXSYS_memset(pResults, 0, total_results * sizeof(FX_FLOAT));
+ CFX_FixedBufGrow<float, 16> result_array(total_results);
+ float* pResults = result_array;
+ memset(pResults, 0, total_results * sizeof(float));
uint32_t rgb_array[SHADING_STEPS];
for (int i = 0; i < SHADING_STEPS; i++) {
- FX_FLOAT input = (t_max - t_min) * i / SHADING_STEPS + t_min;
+ float input = (t_max - t_min) * i / SHADING_STEPS + t_min;
int offset = 0;
for (const auto& func : funcs) {
if (func) {
int nresults;
- if (func->Call(&input, 1, pResults + offset, nresults))
+ if (func->Call(&input, 1, pResults + offset, &nresults))
offset += nresults;
}
}
- FX_FLOAT R = 0.0f, G = 0.0f, B = 0.0f;
- pCS->GetRGB(pResults, R, G, B);
+ float R = 0.0f;
+ float G = 0.0f;
+ float B = 0.0f;
+ pCS->GetRGB(pResults, &R, &G, &B);
rgb_array[i] =
FXARGB_TODIB(FXARGB_MAKE(alpha, FXSYS_round(R * 255),
FXSYS_round(G * 255), FXSYS_round(B * 255)));
}
- FX_FLOAT a = ((start_x - end_x) * (start_x - end_x)) +
- ((start_y - end_y) * (start_y - end_y)) -
- ((start_r - end_r) * (start_r - end_r));
+ float a = ((start_x - end_x) * (start_x - end_x)) +
+ ((start_y - end_y) * (start_y - end_y)) -
+ ((start_r - end_r) * (start_r - end_r));
int width = pBitmap->GetWidth();
int height = pBitmap->GetHeight();
int pitch = pBitmap->GetPitch();
bool bDecreasing = false;
if (start_r > end_r) {
- int length = (int)FXSYS_sqrt((((start_x - end_x) * (start_x - end_x)) +
- ((start_y - end_y) * (start_y - end_y))));
+ int length = (int)sqrt((((start_x - end_x) * (start_x - end_x)) +
+ ((start_y - end_y) * (start_y - end_y))));
if (length < start_r - end_r) {
bDecreasing = true;
}
@@ -253,24 +258,23 @@ void DrawRadialShading(CFX_DIBitmap* pBitmap,
for (int row = 0; row < height; row++) {
uint32_t* dib_buf = (uint32_t*)(pBitmap->GetBuffer() + row * pitch);
for (int column = 0; column < width; column++) {
- CFX_PointF pos = matrix.Transform(CFX_PointF(
- static_cast<FX_FLOAT>(column), static_cast<FX_FLOAT>(row)));
- FX_FLOAT b = -2 * (((pos.x - start_x) * (end_x - start_x)) +
- ((pos.y - start_y) * (end_y - start_y)) +
- (start_r * (end_r - start_r)));
- FX_FLOAT c = ((pos.x - start_x) * (pos.x - start_x)) +
- ((pos.y - start_y) * (pos.y - start_y)) -
- (start_r * start_r);
- FX_FLOAT s;
+ CFX_PointF pos = matrix.Transform(
+ CFX_PointF(static_cast<float>(column), static_cast<float>(row)));
+ float b = -2 * (((pos.x - start_x) * (end_x - start_x)) +
+ ((pos.y - start_y) * (end_y - start_y)) +
+ (start_r * (end_r - start_r)));
+ float c = ((pos.x - start_x) * (pos.x - start_x)) +
+ ((pos.y - start_y) * (pos.y - start_y)) - (start_r * start_r);
+ float s;
if (a == 0) {
s = -c / b;
} else {
- FX_FLOAT b2_4ac = (b * b) - 4 * (a * c);
+ float b2_4ac = (b * b) - 4 * (a * c);
if (b2_4ac < 0) {
continue;
}
- FX_FLOAT root = FXSYS_sqrt(b2_4ac);
- FX_FLOAT s1, s2;
+ float root = sqrt(b2_4ac);
+ float s1, s2;
if (a > 0) {
s1 = (-b - root) / (2 * a);
s2 = (-b + root) / (2 * a);
@@ -313,7 +317,7 @@ void DrawRadialShading(CFX_DIBitmap* pBitmap,
}
}
-void DrawFuncShading(CFX_DIBitmap* pBitmap,
+void DrawFuncShading(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
CFX_Matrix* pObject2Bitmap,
CPDF_Dictionary* pDict,
const std::vector<std::unique_ptr<CPDF_Function>>& funcs,
@@ -321,7 +325,7 @@ void DrawFuncShading(CFX_DIBitmap* pBitmap,
int alpha) {
ASSERT(pBitmap->GetFormat() == FXDIB_Argb);
CPDF_Array* pDomain = pDict->GetArrayFor("Domain");
- FX_FLOAT xmin = 0, ymin = 0, xmax = 1.0f, ymax = 1.0f;
+ float xmin = 0, ymin = 0, xmax = 1.0f, ymax = 1.0f;
if (pDomain) {
xmin = pDomain->GetNumberAt(0);
xmax = pDomain->GetNumberAt(1);
@@ -340,31 +344,31 @@ void DrawFuncShading(CFX_DIBitmap* pBitmap,
int pitch = pBitmap->GetPitch();
uint32_t total_results =
std::max(CountOutputs(funcs), pCS->CountComponents());
- CFX_FixedBufGrow<FX_FLOAT, 16> result_array(total_results);
- FX_FLOAT* pResults = result_array;
- FXSYS_memset(pResults, 0, total_results * sizeof(FX_FLOAT));
+ CFX_FixedBufGrow<float, 16> result_array(total_results);
+ float* pResults = result_array;
+ memset(pResults, 0, total_results * sizeof(float));
for (int row = 0; row < height; row++) {
uint32_t* dib_buf = (uint32_t*)(pBitmap->GetBuffer() + row * pitch);
for (int column = 0; column < width; column++) {
- CFX_PointF pos = matrix.Transform(CFX_PointF(
- static_cast<FX_FLOAT>(column), static_cast<FX_FLOAT>(row)));
+ CFX_PointF pos = matrix.Transform(
+ CFX_PointF(static_cast<float>(column), static_cast<float>(row)));
if (pos.x < xmin || pos.x > xmax || pos.y < ymin || pos.y > ymax)
continue;
- FX_FLOAT input[] = {pos.x, pos.y};
+ float input[] = {pos.x, pos.y};
int offset = 0;
for (const auto& func : funcs) {
if (func) {
int nresults;
- if (func->Call(input, 2, pResults + offset, nresults))
+ if (func->Call(input, 2, pResults + offset, &nresults))
offset += nresults;
}
}
- FX_FLOAT R = 0.0f;
- FX_FLOAT G = 0.0f;
- FX_FLOAT B = 0.0f;
- pCS->GetRGB(pResults, R, G, B);
+ float R = 0.0f;
+ float G = 0.0f;
+ float B = 0.0f;
+ pCS->GetRGB(pResults, &R, &G, &B);
dib_buf[column] = FXARGB_TODIB(FXARGB_MAKE(
alpha, (int32_t)(R * 255), (int32_t)(G * 255), (int32_t)(B * 255)));
}
@@ -374,7 +378,7 @@ void DrawFuncShading(CFX_DIBitmap* pBitmap,
bool GetScanlineIntersect(int y,
const CFX_PointF& first,
const CFX_PointF& second,
- FX_FLOAT* x) {
+ float* x) {
if (first.y == second.y)
return false;
@@ -388,11 +392,11 @@ bool GetScanlineIntersect(int y,
return true;
}
-void DrawGouraud(CFX_DIBitmap* pBitmap,
+void DrawGouraud(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
int alpha,
CPDF_MeshVertex triangle[3]) {
- FX_FLOAT min_y = triangle[0].position.y;
- FX_FLOAT max_y = triangle[0].position.y;
+ float min_y = triangle[0].position.y;
+ float max_y = triangle[0].position.y;
for (int i = 1; i < 3; i++) {
min_y = std::min(min_y, triangle[i].position.y);
max_y = std::max(max_y, triangle[i].position.y);
@@ -400,18 +404,18 @@ void DrawGouraud(CFX_DIBitmap* pBitmap,
if (min_y == max_y)
return;
- int min_yi = std::max(static_cast<int>(FXSYS_floor(min_y)), 0);
- int max_yi = static_cast<int>(FXSYS_ceil(max_y));
+ int min_yi = std::max(static_cast<int>(floor(min_y)), 0);
+ int max_yi = static_cast<int>(ceil(max_y));
if (max_yi >= pBitmap->GetHeight())
max_yi = pBitmap->GetHeight() - 1;
for (int y = min_yi; y <= max_yi; y++) {
int nIntersects = 0;
- FX_FLOAT inter_x[3];
- FX_FLOAT r[3];
- FX_FLOAT g[3];
- FX_FLOAT b[3];
+ float inter_x[3];
+ float r[3];
+ float g[3];
+ float b[3];
for (int i = 0; i < 3; i++) {
CPDF_MeshVertex& vertex1 = triangle[i];
CPDF_MeshVertex& vertex2 = triangle[(i + 1) % 3];
@@ -422,7 +426,7 @@ void DrawGouraud(CFX_DIBitmap* pBitmap,
if (!bIntersect)
continue;
- FX_FLOAT y_dist = (y - position1.y) / (position2.y - position1.y);
+ float y_dist = (y - position1.y) / (position2.y - position1.y);
r[nIntersects] = vertex1.r + ((vertex2.r - vertex1.r) * y_dist);
g[nIntersects] = vertex1.g + ((vertex2.g - vertex1.g) * y_dist);
b[nIntersects] = vertex1.b + ((vertex2.b - vertex1.b) * y_dist);
@@ -433,13 +437,13 @@ void DrawGouraud(CFX_DIBitmap* pBitmap,
int min_x, max_x, start_index, end_index;
if (inter_x[0] < inter_x[1]) {
- min_x = (int)FXSYS_floor(inter_x[0]);
- max_x = (int)FXSYS_ceil(inter_x[1]);
+ min_x = (int)floor(inter_x[0]);
+ max_x = (int)ceil(inter_x[1]);
start_index = 0;
end_index = 1;
} else {
- min_x = (int)FXSYS_floor(inter_x[1]);
- max_x = (int)FXSYS_ceil(inter_x[0]);
+ min_x = (int)floor(inter_x[1]);
+ max_x = (int)ceil(inter_x[0]);
start_index = 1;
end_index = 0;
}
@@ -451,12 +455,12 @@ void DrawGouraud(CFX_DIBitmap* pBitmap,
uint8_t* dib_buf =
pBitmap->GetBuffer() + y * pBitmap->GetPitch() + start_x * 4;
- FX_FLOAT r_unit = (r[end_index] - r[start_index]) / (max_x - min_x);
- FX_FLOAT g_unit = (g[end_index] - g[start_index]) / (max_x - min_x);
- FX_FLOAT b_unit = (b[end_index] - b[start_index]) / (max_x - min_x);
- FX_FLOAT R = r[start_index] + (start_x - min_x) * r_unit;
- FX_FLOAT G = g[start_index] + (start_x - min_x) * g_unit;
- FX_FLOAT B = b[start_index] + (start_x - min_x) * b_unit;
+ float r_unit = (r[end_index] - r[start_index]) / (max_x - min_x);
+ float g_unit = (g[end_index] - g[start_index]) / (max_x - min_x);
+ float b_unit = (b[end_index] - b[start_index]) / (max_x - min_x);
+ float R = r[start_index] + (start_x - min_x) * r_unit;
+ float G = g[start_index] + (start_x - min_x) * g_unit;
+ float B = b[start_index] + (start_x - min_x) * b_unit;
for (int x = start_x; x < end_x; x++) {
R += r_unit;
G += g_unit;
@@ -470,7 +474,7 @@ void DrawGouraud(CFX_DIBitmap* pBitmap,
}
void DrawFreeGouraudShading(
- CFX_DIBitmap* pBitmap,
+ const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
CFX_Matrix* pObject2Bitmap,
CPDF_Stream* pShadingStream,
const std::vector<std::unique_ptr<CPDF_Function>>& funcs,
@@ -484,7 +488,7 @@ void DrawFreeGouraudShading(
return;
CPDF_MeshVertex triangle[3];
- FXSYS_memset(triangle, 0, sizeof(triangle));
+ memset(triangle, 0, sizeof(triangle));
while (!stream.BitStream()->IsEOF()) {
CPDF_MeshVertex vertex;
@@ -511,7 +515,7 @@ void DrawFreeGouraudShading(
}
void DrawLatticeGouraudShading(
- CFX_DIBitmap* pBitmap,
+ const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
CFX_Matrix* pObject2Bitmap,
CPDF_Stream* pShadingStream,
const std::vector<std::unique_ptr<CPDF_Function>>& funcs,
@@ -682,7 +686,7 @@ int BiInterpolImpl(int c0,
}
struct Coon_Color {
- Coon_Color() { FXSYS_memset(comp, 0, sizeof(int) * 3); }
+ Coon_Color() { memset(comp, 0, sizeof(int) * 3); }
int comp[3];
void BiInterpol(Coon_Color colors[4],
@@ -698,9 +702,8 @@ struct Coon_Color {
}
int Distance(Coon_Color& o) {
- return std::max({FXSYS_abs(comp[0] - o.comp[0]),
- FXSYS_abs(comp[1] - o.comp[1]),
- FXSYS_abs(comp[2] - o.comp[2])});
+ return std::max({abs(comp[0] - o.comp[0]), abs(comp[1] - o.comp[1]),
+ abs(comp[2] - o.comp[2])});
}
};
@@ -805,7 +808,7 @@ struct CPDF_PatchDrawer {
void DrawCoonPatchMeshes(
ShadingType type,
- CFX_DIBitmap* pBitmap,
+ const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
CFX_Matrix* pObject2Bitmap,
CPDF_Stream* pShadingStream,
const std::vector<std::unique_ptr<CPDF_Function>>& funcs,
@@ -846,11 +849,11 @@ void DrawCoonPatchMeshes(
for (i = 0; i < 4; i++) {
tempCoords[i] = coords[(flag * 3 + i) % 12];
}
- FXSYS_memcpy(coords, tempCoords, sizeof(tempCoords));
+ memcpy(coords, tempCoords, sizeof(tempCoords));
Coon_Color tempColors[2];
tempColors[0] = patch.patch_colors[flag];
tempColors[1] = patch.patch_colors[(flag + 1) % 4];
- FXSYS_memcpy(patch.patch_colors, tempColors, sizeof(Coon_Color) * 2);
+ memcpy(patch.patch_colors, tempColors, sizeof(Coon_Color) * 2);
}
for (i = iStartPoint; i < point_count; i++) {
if (!stream.CanReadCoords())
@@ -862,9 +865,9 @@ void DrawCoonPatchMeshes(
if (!stream.CanReadColor())
break;
- FX_FLOAT r;
- FX_FLOAT g;
- FX_FLOAT b;
+ float r;
+ float g;
+ float b;
std::tie(r, g, b) = stream.ReadColor();
patch.patch_colors[i].comp[0] = (int32_t)(r * 255);
@@ -872,8 +875,8 @@ void DrawCoonPatchMeshes(
patch.patch_colors[i].comp[2] = (int32_t)(b * 255);
}
CFX_FloatRect bbox = CFX_FloatRect::GetBBox(coords, point_count);
- if (bbox.right <= 0 || bbox.left >= (FX_FLOAT)pBitmap->GetWidth() ||
- bbox.top <= 0 || bbox.bottom >= (FX_FLOAT)pBitmap->GetHeight()) {
+ if (bbox.right <= 0 || bbox.left >= (float)pBitmap->GetWidth() ||
+ bbox.top <= 0 || bbox.bottom >= (float)pBitmap->GetHeight()) {
continue;
}
Coon_Bezier C1, C2, D1, D2;
@@ -889,26 +892,25 @@ void DrawCoonPatchMeshes(
}
}
-std::unique_ptr<CFX_DIBitmap> DrawPatternBitmap(
- CPDF_Document* pDoc,
- CPDF_PageRenderCache* pCache,
- CPDF_TilingPattern* pPattern,
- const CFX_Matrix* pObject2Device,
- int width,
- int height,
- int flags) {
- std::unique_ptr<CFX_DIBitmap> pBitmap(new CFX_DIBitmap);
+CFX_RetainPtr<CFX_DIBitmap> DrawPatternBitmap(CPDF_Document* pDoc,
+ CPDF_PageRenderCache* pCache,
+ CPDF_TilingPattern* pPattern,
+ const CFX_Matrix* pObject2Device,
+ int width,
+ int height,
+ int flags) {
+ auto pBitmap = pdfium::MakeRetain<CFX_DIBitmap>();
if (!pBitmap->Create(width, height,
pPattern->colored() ? FXDIB_Argb : FXDIB_8bppMask)) {
return nullptr;
}
CFX_FxgeDevice bitmap_device;
- bitmap_device.Attach(pBitmap.get(), false, nullptr, false);
+ bitmap_device.Attach(pBitmap, false, nullptr, false);
pBitmap->Clear(0);
CFX_FloatRect cell_bbox = pPattern->bbox();
pPattern->pattern_to_form()->TransformRect(cell_bbox);
pObject2Device->TransformRect(cell_bbox);
- CFX_FloatRect bitmap_rect(0.0f, 0.0f, (FX_FLOAT)width, (FX_FLOAT)height);
+ CFX_FloatRect bitmap_rect(0.0f, 0.0f, (float)width, (float)height);
CFX_Matrix mtAdjust;
mtAdjust.MatchRect(bitmap_rect, cell_bbox);
@@ -1128,15 +1130,13 @@ bool CPDF_RenderStatus::GetObjectClippedRect(const CPDF_PageObject* pObj,
FX_RECT rtClip = m_pDevice->GetClipBox();
if (!bLogical) {
CFX_Matrix dCTM = m_pDevice->GetCTM();
- FX_FLOAT a = FXSYS_fabs(dCTM.a);
- FX_FLOAT d = FXSYS_fabs(dCTM.d);
+ float a = fabs(dCTM.a);
+ float d = fabs(dCTM.d);
if (a != 1.0f || d != 1.0f) {
- rect.right = rect.left + (int32_t)FXSYS_ceil((FX_FLOAT)rect.Width() * a);
- rect.bottom = rect.top + (int32_t)FXSYS_ceil((FX_FLOAT)rect.Height() * d);
- rtClip.right =
- rtClip.left + (int32_t)FXSYS_ceil((FX_FLOAT)rtClip.Width() * a);
- rtClip.bottom =
- rtClip.top + (int32_t)FXSYS_ceil((FX_FLOAT)rtClip.Height() * d);
+ rect.right = rect.left + (int32_t)ceil((float)rect.Width() * a);
+ rect.bottom = rect.top + (int32_t)ceil((float)rect.Height() * d);
+ rtClip.right = rtClip.left + (int32_t)ceil((float)rtClip.Width() * a);
+ rtClip.bottom = rtClip.top + (int32_t)ceil((float)rtClip.Height() * d);
}
}
rect.Intersect(rtClip);
@@ -1194,8 +1194,8 @@ bool CPDF_RenderStatus::DrawObjWithBlend(CPDF_PageObject* pObj,
void CPDF_RenderStatus::GetScaledMatrix(CFX_Matrix& matrix) const {
CFX_Matrix dCTM = m_pDevice->GetCTM();
- matrix.a *= FXSYS_fabs(dCTM.a);
- matrix.d *= FXSYS_fabs(dCTM.d);
+ matrix.a *= fabs(dCTM.a);
+ matrix.d *= fabs(dCTM.d);
}
void CPDF_RenderStatus::DrawObjWithBackground(CPDF_PageObject* pObj,
@@ -1301,7 +1301,8 @@ bool CPDF_RenderStatus::ProcessPath(CPDF_PathObject* pPathObj,
fill_argb, stroke_argb, FillType, m_curBlend);
}
-CPDF_TransferFunc* CPDF_RenderStatus::GetTransferFunc(CPDF_Object* pObj) const {
+CFX_RetainPtr<CPDF_TransferFunc> CPDF_RenderStatus::GetTransferFunc(
+ CPDF_Object* pObj) const {
ASSERT(pObj);
CPDF_DocRenderData* pDocCache = m_pContext->GetDocument()->GetRenderData();
return pDocCache ? pDocCache->GetTransferFunc(pObj) : nullptr;
@@ -1462,7 +1463,7 @@ bool CPDF_RenderStatus::ProcessTransparency(CPDF_PageObject* pPageObj,
}
}
CPDF_Dictionary* pFormResource = nullptr;
- FX_FLOAT group_alpha = 1.0f;
+ float group_alpha = 1.0f;
int Transparency = m_Transparency;
bool bGroupTransparent = false;
if (pPageObj->IsForm()) {
@@ -1528,38 +1529,41 @@ bool CPDF_RenderStatus::ProcessTransparency(CPDF_PageObject* pPageObj,
}
FX_RECT rect = pPageObj->GetBBox(pObj2Device);
rect.Intersect(m_pDevice->GetClipBox());
- if (rect.IsEmpty()) {
+ if (rect.IsEmpty())
return true;
- }
+
CFX_Matrix deviceCTM = m_pDevice->GetCTM();
- FX_FLOAT scaleX = FXSYS_fabs(deviceCTM.a);
- FX_FLOAT scaleY = FXSYS_fabs(deviceCTM.d);
- int width = FXSYS_round((FX_FLOAT)rect.Width() * scaleX);
- int height = FXSYS_round((FX_FLOAT)rect.Height() * scaleY);
+ float scaleX = fabs(deviceCTM.a);
+ float scaleY = fabs(deviceCTM.d);
+ int width = FXSYS_round((float)rect.Width() * scaleX);
+ int height = FXSYS_round((float)rect.Height() * scaleY);
CFX_FxgeDevice bitmap_device;
- std::unique_ptr<CFX_DIBitmap> oriDevice;
+ CFX_RetainPtr<CFX_DIBitmap> oriDevice;
if (!isolated && (m_pDevice->GetRenderCaps() & FXRC_GET_BITS)) {
- oriDevice = pdfium::MakeUnique<CFX_DIBitmap>();
- if (!m_pDevice->CreateCompatibleBitmap(oriDevice.get(), width, height))
+ oriDevice = pdfium::MakeRetain<CFX_DIBitmap>();
+ if (!m_pDevice->CreateCompatibleBitmap(oriDevice, width, height))
return true;
- m_pDevice->GetDIBits(oriDevice.get(), rect.left, rect.top);
+ m_pDevice->GetDIBits(oriDevice, rect.left, rect.top);
}
- if (!bitmap_device.Create(width, height, FXDIB_Argb, oriDevice.get()))
+ if (!bitmap_device.Create(width, height, FXDIB_Argb, oriDevice))
return true;
- CFX_DIBitmap* bitmap = bitmap_device.GetBitmap();
+
+ CFX_RetainPtr<CFX_DIBitmap> bitmap = bitmap_device.GetBitmap();
bitmap->Clear(0);
+
CFX_Matrix new_matrix = *pObj2Device;
new_matrix.Translate(-rect.left, -rect.top);
new_matrix.Scale(scaleX, scaleY);
- std::unique_ptr<CFX_DIBitmap> pTextMask;
+
+ CFX_RetainPtr<CFX_DIBitmap> pTextMask;
if (bTextClip) {
- pTextMask = pdfium::MakeUnique<CFX_DIBitmap>();
+ pTextMask = pdfium::MakeRetain<CFX_DIBitmap>();
if (!pTextMask->Create(width, height, FXDIB_8bppMask))
return true;
pTextMask->Clear(0);
CFX_FxgeDevice text_device;
- text_device.Attach(pTextMask.get(), false, nullptr, false);
+ text_device.Attach(pTextMask, false, nullptr, false);
for (uint32_t i = 0; i < pPageObj->m_ClipPath.GetTextCount(); i++) {
CPDF_TextObject* textobj = pPageObj->m_ClipPath.GetText(i);
if (!textobj)
@@ -1586,14 +1590,14 @@ bool CPDF_RenderStatus::ProcessTransparency(CPDF_PageObject* pPageObj,
if (pSMaskDict) {
CFX_Matrix smask_matrix = *pPageObj->m_GeneralState.GetSMaskMatrix();
smask_matrix.Concat(*pObj2Device);
- std::unique_ptr<CFX_DIBSource> pSMaskSource =
+ CFX_RetainPtr<CFX_DIBSource> pSMaskSource =
LoadSMask(pSMaskDict, &rect, &smask_matrix);
if (pSMaskSource)
- bitmap->MultiplyAlpha(pSMaskSource.get());
+ bitmap->MultiplyAlpha(pSMaskSource);
}
if (pTextMask) {
- bitmap->MultiplyAlpha(pTextMask.get());
- pTextMask.reset();
+ bitmap->MultiplyAlpha(pTextMask);
+ pTextMask.Reset();
}
int32_t blitAlpha = 255;
if (Transparency & PDFTRANS_GROUP && group_alpha != 1.0f) {
@@ -1615,7 +1619,7 @@ bool CPDF_RenderStatus::ProcessTransparency(CPDF_PageObject* pPageObj,
return true;
}
-std::unique_ptr<CFX_DIBitmap> CPDF_RenderStatus::GetBackdrop(
+CFX_RetainPtr<CFX_DIBitmap> CPDF_RenderStatus::GetBackdrop(
const CPDF_PageObject* pObj,
const FX_RECT& rect,
int& left,
@@ -1626,15 +1630,15 @@ std::unique_ptr<CFX_DIBitmap> CPDF_RenderStatus::GetBackdrop(
left = bbox.left;
top = bbox.top;
CFX_Matrix deviceCTM = m_pDevice->GetCTM();
- FX_FLOAT scaleX = FXSYS_fabs(deviceCTM.a);
- FX_FLOAT scaleY = FXSYS_fabs(deviceCTM.d);
+ float scaleX = fabs(deviceCTM.a);
+ float scaleY = fabs(deviceCTM.d);
int width = FXSYS_round(bbox.Width() * scaleX);
int height = FXSYS_round(bbox.Height() * scaleY);
- auto pBackdrop = pdfium::MakeUnique<CFX_DIBitmap>();
+ auto pBackdrop = pdfium::MakeRetain<CFX_DIBitmap>();
if (bBackAlphaRequired && !m_bDropObjects)
pBackdrop->Create(width, height, FXDIB_Argb);
else
- m_pDevice->CreateCompatibleBitmap(pBackdrop.get(), width, height);
+ m_pDevice->CreateCompatibleBitmap(pBackdrop, width, height);
if (!pBackdrop->GetBuffer())
return nullptr;
@@ -1646,16 +1650,16 @@ std::unique_ptr<CFX_DIBitmap> CPDF_RenderStatus::GetBackdrop(
bNeedDraw = !(m_pDevice->GetRenderCaps() & FXRC_GET_BITS);
if (!bNeedDraw) {
- m_pDevice->GetDIBits(pBackdrop.get(), left, top);
+ m_pDevice->GetDIBits(pBackdrop, left, top);
return pBackdrop;
}
-
CFX_Matrix FinalMatrix = m_DeviceMatrix;
FinalMatrix.Translate(-left, -top);
FinalMatrix.Scale(scaleX, scaleY);
pBackdrop->Clear(pBackdrop->HasAlpha() ? 0 : 0xffffffff);
+
CFX_FxgeDevice device;
- device.Attach(pBackdrop.get(), false, nullptr, false);
+ device.Attach(pBackdrop, false, nullptr, false);
m_pContext->Render(&device, pObj, &m_Options, &FinalMatrix);
return pBackdrop;
}
@@ -1753,7 +1757,7 @@ bool CPDF_RenderStatus::ProcessText(CPDF_TextObject* textobj,
if (!IsAvailableMatrix(text_matrix))
return true;
- FX_FLOAT font_size = textobj->m_TextState.GetFontSize();
+ float font_size = textobj->m_TextState.GetFontSize();
if (bPattern) {
DrawTextPathWithPattern(textobj, pObj2Device, pFont, font_size,
&text_matrix, bFill, bStroke);
@@ -1763,7 +1767,7 @@ bool CPDF_RenderStatus::ProcessText(CPDF_TextObject* textobj,
const CFX_Matrix* pDeviceMatrix = pObj2Device;
CFX_Matrix device_matrix;
if (bStroke) {
- const FX_FLOAT* pCTM = textobj->m_TextState.GetCTM();
+ const float* pCTM = textobj->m_TextState.GetCTM();
if (pCTM[0] != 1.0f || pCTM[3] != 1.0f) {
CFX_Matrix ctm(pCTM[0], pCTM[1], pCTM[2], pCTM[3], 0, 0);
text_matrix.ConcatInverse(ctm);
@@ -1792,12 +1796,14 @@ bool CPDF_RenderStatus::ProcessText(CPDF_TextObject* textobj,
&text_matrix, fill_argb, &m_Options);
}
-CPDF_Type3Cache* CPDF_RenderStatus::GetCachedType3(CPDF_Type3Font* pFont) {
- if (!pFont->m_pDocument) {
+CFX_RetainPtr<CPDF_Type3Cache> CPDF_RenderStatus::GetCachedType3(
+ CPDF_Type3Font* pFont) {
+ CPDF_Document* pDoc = pFont->m_pDocument;
+ if (!pDoc)
return nullptr;
- }
- pFont->m_pDocument->GetPageData()->GetFont(pFont->GetFontDict());
- return pFont->m_pDocument->GetRenderData()->GetCachedType3(pFont);
+
+ pDoc->GetPageData()->GetFont(pFont->GetFontDict());
+ return pDoc->GetRenderData()->GetCachedType3(pFont);
}
// TODO(npm): Font fallback for type 3 fonts? (Completely separate code!!)
@@ -1808,11 +1814,11 @@ bool CPDF_RenderStatus::ProcessType3Text(CPDF_TextObject* textobj,
return true;
CFX_Matrix dCTM = m_pDevice->GetCTM();
- FX_FLOAT sa = FXSYS_fabs(dCTM.a);
- FX_FLOAT sd = FXSYS_fabs(dCTM.d);
+ float sa = fabs(dCTM.a);
+ float sd = fabs(dCTM.d);
CFX_Matrix text_matrix = textobj->GetTextMatrix();
CFX_Matrix char_matrix = pType3Font->GetFontMatrix();
- FX_FLOAT font_size = textobj->m_TextState.GetFontSize();
+ float font_size = textobj->m_TextState.GetFontSize();
char_matrix.Scale(font_size, font_size);
FX_ARGB fill_argb = GetFillArgb(textobj, true);
int fill_alpha = FXARGB_A(fill_argb);
@@ -1845,7 +1851,7 @@ bool CPDF_RenderStatus::ProcessType3Text(CPDF_TextObject* textobj,
if (!glyph.m_pGlyph)
continue;
- m_pDevice->SetBitMask(&glyph.m_pGlyph->m_Bitmap,
+ m_pDevice->SetBitMask(glyph.m_pGlyph->m_pBitmap,
glyph.m_Origin.x + glyph.m_pGlyph->m_Left,
glyph.m_Origin.y - glyph.m_pGlyph->m_Top,
fill_argb);
@@ -1899,7 +1905,7 @@ bool CPDF_RenderStatus::ProcessType3Text(CPDF_TextObject* textobj,
delete pStates;
} else if (pType3Char->m_pBitmap) {
if (device_class == FXDC_DISPLAY) {
- CPDF_Type3Cache* pCache = GetCachedType3(pType3Font);
+ CFX_RetainPtr<CPDF_Type3Cache> pCache = GetCachedType3(pType3Font);
refTypeCache.m_dwCount++;
CFX_GlyphBitmap* pBitmap = pCache->LoadGlyph(charcode, &matrix, sa, sd);
if (!pBitmap)
@@ -1907,7 +1913,7 @@ bool CPDF_RenderStatus::ProcessType3Text(CPDF_TextObject* textobj,
CFX_Point origin(FXSYS_round(matrix.e), FXSYS_round(matrix.f));
if (glyphs.empty()) {
- m_pDevice->SetBitMask(&pBitmap->m_Bitmap, origin.x + pBitmap->m_Left,
+ m_pDevice->SetBitMask(pBitmap->m_pBitmap, origin.x + pBitmap->m_Left,
origin.y - pBitmap->m_Top, fill_argb);
} else {
glyphs[iChar].m_pGlyph = pBitmap;
@@ -1917,7 +1923,7 @@ bool CPDF_RenderStatus::ProcessType3Text(CPDF_TextObject* textobj,
CFX_Matrix image_matrix = pType3Char->m_ImageMatrix;
image_matrix.Concat(matrix);
CPDF_ImageRenderer renderer;
- if (renderer.Start(this, pType3Char->m_pBitmap.get(), fill_argb, 255,
+ if (renderer.Start(this, pType3Char->m_pBitmap, fill_argb, 255,
&image_matrix, 0, false, FXDIB_BLEND_NORMAL)) {
renderer.Continue(nullptr);
}
@@ -1931,12 +1937,12 @@ bool CPDF_RenderStatus::ProcessType3Text(CPDF_TextObject* textobj,
return true;
FX_RECT rect = FXGE_GetGlyphsBBox(glyphs, 0, sa, sd);
- CFX_DIBitmap bitmap;
- if (!bitmap.Create(static_cast<int>(rect.Width() * sa),
- static_cast<int>(rect.Height() * sd), FXDIB_8bppMask)) {
+ auto pBitmap = pdfium::MakeRetain<CFX_DIBitmap>();
+ if (!pBitmap->Create(static_cast<int>(rect.Width() * sa),
+ static_cast<int>(rect.Height() * sd), FXDIB_8bppMask)) {
return true;
}
- bitmap.Clear(0);
+ pBitmap->Clear(0);
for (const FXTEXT_GLYPHPOS& glyph : glyphs) {
if (!glyph.m_pGlyph)
continue;
@@ -1955,20 +1961,20 @@ bool CPDF_RenderStatus::ProcessType3Text(CPDF_TextObject* textobj,
if (!top.IsValid())
continue;
- bitmap.CompositeMask(left.ValueOrDie(), top.ValueOrDie(),
- glyph.m_pGlyph->m_Bitmap.GetWidth(),
- glyph.m_pGlyph->m_Bitmap.GetHeight(),
- &glyph.m_pGlyph->m_Bitmap, fill_argb, 0, 0,
- FXDIB_BLEND_NORMAL, nullptr, false, 0, nullptr);
+ pBitmap->CompositeMask(left.ValueOrDie(), top.ValueOrDie(),
+ glyph.m_pGlyph->m_pBitmap->GetWidth(),
+ glyph.m_pGlyph->m_pBitmap->GetHeight(),
+ glyph.m_pGlyph->m_pBitmap, fill_argb, 0, 0,
+ FXDIB_BLEND_NORMAL, nullptr, false, 0);
}
- m_pDevice->SetBitMask(&bitmap, rect.left, rect.top, fill_argb);
+ m_pDevice->SetBitMask(pBitmap, rect.left, rect.top, fill_argb);
return true;
}
void CPDF_RenderStatus::DrawTextPathWithPattern(const CPDF_TextObject* textobj,
const CFX_Matrix* pObj2Device,
CPDF_Font* pFont,
- FX_FLOAT font_size,
+ float font_size,
const CFX_Matrix* pTextMatrix,
bool bFill,
bool bStroke) {
@@ -1993,7 +1999,7 @@ void CPDF_RenderStatus::DrawTextPathWithPattern(const CPDF_TextObject* textobj,
CharPosList.Load(textobj->m_CharCodes, textobj->m_CharPos, pFont, font_size);
for (uint32_t i = 0; i < CharPosList.m_nChars; i++) {
FXTEXT_CHARPOS& charpos = CharPosList.m_pCharPos[i];
- auto font =
+ auto* font =
charpos.m_FallbackFontPosition == -1
? &pFont->m_Font
: pFont->m_FontFallbacks[charpos.m_FallbackFontPosition].get();
@@ -2039,11 +2045,13 @@ void CPDF_RenderStatus::DrawShading(CPDF_ShadingPattern* pPattern,
CPDF_Array* pBackColor = pDict->GetArrayFor("Background");
if (pBackColor &&
pBackColor->GetCount() >= pColorSpace->CountComponents()) {
- CFX_FixedBufGrow<FX_FLOAT, 16> comps(pColorSpace->CountComponents());
+ CFX_FixedBufGrow<float, 16> comps(pColorSpace->CountComponents());
for (uint32_t i = 0; i < pColorSpace->CountComponents(); i++)
comps[i] = pBackColor->GetNumberAt(i);
- FX_FLOAT R = 0.0f, G = 0.0f, B = 0.0f;
- pColorSpace->GetRGB(comps, R, G, B);
+ float R = 0.0f;
+ float G = 0.0f;
+ float B = 0.0f;
+ pColorSpace->GetRGB(comps, &R, &G, &B);
background = ArgbEncode(255, (int32_t)(R * 255), (int32_t)(G * 255),
(int32_t)(B * 255));
}
@@ -2062,7 +2070,7 @@ void CPDF_RenderStatus::DrawShading(CPDF_ShadingPattern* pPattern,
buffer.Initialize(m_pContext, m_pDevice, &clip_rect, m_pCurObj, 150);
CFX_Matrix FinalMatrix = *pMatrix;
FinalMatrix.Concat(*buffer.GetMatrix());
- CFX_DIBitmap* pBitmap = buffer.GetBitmap();
+ CFX_RetainPtr<CFX_DIBitmap> pBitmap = buffer.GetBitmap();
if (!pBitmap->GetBuffer())
return;
@@ -2189,10 +2197,10 @@ void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern,
return;
}
CFX_Matrix dCTM = m_pDevice->GetCTM();
- FX_FLOAT sa = FXSYS_fabs(dCTM.a);
- FX_FLOAT sd = FXSYS_fabs(dCTM.d);
- clip_box.right = clip_box.left + (int32_t)FXSYS_ceil(clip_box.Width() * sa);
- clip_box.bottom = clip_box.top + (int32_t)FXSYS_ceil(clip_box.Height() * sd);
+ float sa = fabs(dCTM.a);
+ float sd = fabs(dCTM.d);
+ clip_box.right = clip_box.left + (int32_t)ceil(clip_box.Width() * sa);
+ clip_box.bottom = clip_box.top + (int32_t)ceil(clip_box.Height() * sd);
CFX_Matrix mtPattern2Device = *pPattern->pattern_to_form();
mtPattern2Device.Concat(*pObj2Device);
GetScaledMatrix(mtPattern2Device);
@@ -2205,8 +2213,8 @@ void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern,
}
CFX_FloatRect cell_bbox = pPattern->bbox();
mtPattern2Device.TransformRect(cell_bbox);
- int width = (int)FXSYS_ceil(cell_bbox.Width());
- int height = (int)FXSYS_ceil(cell_bbox.Height());
+ int width = (int)ceil(cell_bbox.Width());
+ int height = (int)ceil(cell_bbox.Height());
if (width == 0) {
width = 1;
}
@@ -2220,14 +2228,14 @@ void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern,
CFX_FloatRect clip_box_p(clip_box);
mtDevice2Pattern.TransformRect(clip_box_p);
- min_col = (int)FXSYS_ceil((clip_box_p.left - pPattern->bbox().right) /
- pPattern->x_step());
- max_col = (int)FXSYS_floor((clip_box_p.right - pPattern->bbox().left) /
- pPattern->x_step());
- min_row = (int)FXSYS_ceil((clip_box_p.bottom - pPattern->bbox().top) /
- pPattern->y_step());
- max_row = (int)FXSYS_floor((clip_box_p.top - pPattern->bbox().bottom) /
- pPattern->y_step());
+ min_col = (int)ceil((clip_box_p.left - pPattern->bbox().right) /
+ pPattern->x_step());
+ max_col = (int)floor((clip_box_p.right - pPattern->bbox().left) /
+ pPattern->x_step());
+ min_row = (int)ceil((clip_box_p.bottom - pPattern->bbox().top) /
+ pPattern->y_step());
+ max_row = (int)floor((clip_box_p.top - pPattern->bbox().bottom) /
+ pPattern->y_step());
if (width > clip_box.Width() || height > clip_box.Height() ||
width * height > clip_box.Width() * clip_box.Height()) {
@@ -2278,11 +2286,11 @@ void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern,
max_row--;
}
}
- FX_FLOAT left_offset = cell_bbox.left - mtPattern2Device.e;
- FX_FLOAT top_offset = cell_bbox.bottom - mtPattern2Device.f;
- std::unique_ptr<CFX_DIBitmap> pPatternBitmap;
+ float left_offset = cell_bbox.left - mtPattern2Device.e;
+ float top_offset = cell_bbox.bottom - mtPattern2Device.f;
+ CFX_RetainPtr<CFX_DIBitmap> pPatternBitmap;
if (width * height < 16) {
- std::unique_ptr<CFX_DIBitmap> pEnlargedBitmap =
+ CFX_RetainPtr<CFX_DIBitmap> pEnlargedBitmap =
DrawPatternBitmap(m_pContext->GetDocument(), m_pContext->GetPageCache(),
pPattern, pObj2Device, 8, 8, m_Options.m_Flags);
pPatternBitmap = pEnlargedBitmap->StretchTo(width, height);
@@ -2302,11 +2310,11 @@ void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern,
FX_ARGB fill_argb = GetFillArgb(pPageObj);
int clip_width = clip_box.right - clip_box.left;
int clip_height = clip_box.bottom - clip_box.top;
- CFX_DIBitmap screen;
- if (!screen.Create(clip_width, clip_height, FXDIB_Argb)) {
+ auto pScreen = pdfium::MakeRetain<CFX_DIBitmap>();
+ if (!pScreen->Create(clip_width, clip_height, FXDIB_Argb))
return;
- }
- screen.Clear(0);
+
+ pScreen->Clear(0);
uint32_t* src_buf = (uint32_t*)pPatternBitmap->GetBuffer();
for (int col = min_col; col <= max_col; col++) {
for (int row = min_row; row <= max_row; row++) {
@@ -2337,7 +2345,7 @@ void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern,
continue;
}
uint32_t* dest_buf =
- (uint32_t*)(screen.GetBuffer() + screen.GetPitch() * start_y +
+ (uint32_t*)(pScreen->GetBuffer() + pScreen->GetPitch() * start_y +
start_x * 4);
if (pPattern->colored())
*dest_buf = *src_buf;
@@ -2345,16 +2353,16 @@ void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern,
*dest_buf = (*(uint8_t*)src_buf << 24) | (fill_argb & 0xffffff);
} else {
if (pPattern->colored()) {
- screen.CompositeBitmap(start_x, start_y, width, height,
- pPatternBitmap.get(), 0, 0);
+ pScreen->CompositeBitmap(start_x, start_y, width, height,
+ pPatternBitmap, 0, 0);
} else {
- screen.CompositeMask(start_x, start_y, width, height,
- pPatternBitmap.get(), fill_argb, 0, 0);
+ pScreen->CompositeMask(start_x, start_y, width, height,
+ pPatternBitmap, fill_argb, 0, 0);
}
}
}
}
- CompositeDIBitmap(&screen, clip_box.left, clip_box.top, 0, 255,
+ CompositeDIBitmap(pScreen, clip_box.left, clip_box.top, 0, 255,
FXDIB_BLEND_NORMAL, false);
m_pDevice->RestoreState(false);
}
@@ -2401,24 +2409,25 @@ bool CPDF_RenderStatus::ProcessImage(CPDF_ImageObject* pImageObj,
return render.GetResult();
}
-void CPDF_RenderStatus::CompositeDIBitmap(CFX_DIBitmap* pDIBitmap,
- int left,
- int top,
- FX_ARGB mask_argb,
- int bitmap_alpha,
- int blend_mode,
- int Transparency) {
- if (!pDIBitmap) {
+void CPDF_RenderStatus::CompositeDIBitmap(
+ const CFX_RetainPtr<CFX_DIBitmap>& pDIBitmap,
+ int left,
+ int top,
+ FX_ARGB mask_argb,
+ int bitmap_alpha,
+ int blend_mode,
+ int Transparency) {
+ if (!pDIBitmap)
return;
- }
+
if (blend_mode == FXDIB_BLEND_NORMAL) {
if (!pDIBitmap->IsAlphaMask()) {
if (bitmap_alpha < 255) {
#ifdef _SKIA_SUPPORT_
- void* dummy;
+ std::unique_ptr<CFX_ImageRenderer> dummy;
CFX_Matrix m(pDIBitmap->GetWidth(), 0, 0, -pDIBitmap->GetHeight(), left,
top + pDIBitmap->GetHeight());
- m_pDevice->StartDIBits(pDIBitmap, bitmap_alpha, 0, &m, 0, dummy);
+ m_pDevice->StartDIBits(pDIBitmap, bitmap_alpha, 0, &m, 0, &dummy);
return;
#else
pDIBitmap->MultiplyAlpha(bitmap_alpha);
@@ -2458,10 +2467,10 @@ void CPDF_RenderStatus::CompositeDIBitmap(CFX_DIBitmap* pDIBitmap,
FX_RECT rect(left, top, left + pDIBitmap->GetWidth(),
top + pDIBitmap->GetHeight());
rect.Intersect(m_pDevice->GetClipBox());
- CFX_MaybeOwned<CFX_DIBitmap> pClone;
+ CFX_RetainPtr<CFX_DIBitmap> pClone;
if (m_pDevice->GetBackDrop() && m_pDevice->GetBitmap()) {
pClone = m_pDevice->GetBackDrop()->Clone(&rect);
- CFX_DIBitmap* pForeBitmap = m_pDevice->GetBitmap();
+ CFX_RetainPtr<CFX_DIBitmap> pForeBitmap = m_pDevice->GetBitmap();
pClone->CompositeBitmap(0, 0, pClone->GetWidth(), pClone->GetHeight(),
pForeBitmap, rect.left, rect.top);
left = left >= 0 ? 0 : left;
@@ -2476,7 +2485,7 @@ void CPDF_RenderStatus::CompositeDIBitmap(CFX_DIBitmap* pDIBitmap,
pClone = pDIBitmap;
}
if (m_pDevice->GetBackDrop()) {
- m_pDevice->SetDIBits(pClone.Get(), rect.left, rect.top);
+ m_pDevice->SetDIBits(pClone, rect.left, rect.top);
} else {
if (pDIBitmap->IsAlphaMask())
return;
@@ -2489,7 +2498,7 @@ void CPDF_RenderStatus::CompositeDIBitmap(CFX_DIBitmap* pDIBitmap,
int back_left, back_top;
FX_RECT rect(left, top, left + pDIBitmap->GetWidth(),
top + pDIBitmap->GetHeight());
- std::unique_ptr<CFX_DIBitmap> pBackdrop =
+ CFX_RetainPtr<CFX_DIBitmap> pBackdrop =
GetBackdrop(m_pCurObj, rect, back_left, back_top,
blend_mode > FXDIB_BLEND_NORMAL && bIsolated);
if (!pBackdrop)
@@ -2505,17 +2514,17 @@ void CPDF_RenderStatus::CompositeDIBitmap(CFX_DIBitmap* pDIBitmap,
pDIBitmap, mask_argb, 0, 0, blend_mode);
}
- auto pBackdrop1 = pdfium::MakeUnique<CFX_DIBitmap>();
+ auto pBackdrop1 = pdfium::MakeRetain<CFX_DIBitmap>();
pBackdrop1->Create(pBackdrop->GetWidth(), pBackdrop->GetHeight(),
FXDIB_Rgb32);
pBackdrop1->Clear((uint32_t)-1);
pBackdrop1->CompositeBitmap(0, 0, pBackdrop->GetWidth(),
- pBackdrop->GetHeight(), pBackdrop.get(), 0, 0);
+ pBackdrop->GetHeight(), pBackdrop, 0, 0);
pBackdrop = std::move(pBackdrop1);
- m_pDevice->SetDIBits(pBackdrop.get(), back_left, back_top);
+ m_pDevice->SetDIBits(pBackdrop, back_left, back_top);
}
-std::unique_ptr<CFX_DIBitmap> CPDF_RenderStatus::LoadSMask(
+CFX_RetainPtr<CFX_DIBitmap> CPDF_RenderStatus::LoadSMask(
CPDF_Dictionary* pSMaskDict,
FX_RECT* pClipRect,
const CFX_Matrix* pMatrix) {
@@ -2569,24 +2578,24 @@ std::unique_ptr<CFX_DIBitmap> CPDF_RenderStatus::LoadSMask(
// Store Color Space Family to use in CPDF_RenderStatus::Initialize.
color_space_family = pCS->GetFamily();
- FX_FLOAT R, G, B;
+ float R, G, B;
uint32_t comps = 8;
if (pCS->CountComponents() > comps) {
comps = pCS->CountComponents();
}
- CFX_FixedBufGrow<FX_FLOAT, 8> float_array(comps);
- FX_FLOAT* pFloats = float_array;
+ CFX_FixedBufGrow<float, 8> float_array(comps);
+ float* pFloats = float_array;
FX_SAFE_UINT32 num_floats = comps;
- num_floats *= sizeof(FX_FLOAT);
+ num_floats *= sizeof(float);
if (!num_floats.IsValid()) {
return nullptr;
}
- FXSYS_memset(pFloats, 0, num_floats.ValueOrDie());
+ memset(pFloats, 0, num_floats.ValueOrDie());
size_t count = pBC->GetCount() > 8 ? 8 : pBC->GetCount();
for (size_t i = 0; i < count; i++) {
pFloats[i] = pBC->GetNumberAt(i);
}
- pCS->GetRGB(pFloats, R, G, B);
+ pCS->GetRGB(pFloats, &R, &G, &B);
back_color = 0xff000000 | ((int32_t)(R * 255) << 16) |
((int32_t)(G * 255) << 8) | (int32_t)(B * 255);
m_pContext->GetDocument()->GetPageData()->ReleaseColorSpace(pCSObj);
@@ -2608,7 +2617,7 @@ std::unique_ptr<CFX_DIBitmap> CPDF_RenderStatus::LoadSMask(
nullptr, 0, color_space_family, bLuminosity);
status.RenderObjectList(&form, &matrix);
- auto pMask = pdfium::MakeUnique<CFX_DIBitmap>();
+ auto pMask = pdfium::MakeRetain<CFX_DIBitmap>();
if (!pMask->Create(width, height, FXDIB_8bppMask))
return nullptr;
@@ -2618,11 +2627,11 @@ std::unique_ptr<CFX_DIBitmap> CPDF_RenderStatus::LoadSMask(
int src_pitch = bitmap.GetPitch();
std::vector<uint8_t> transfers(256);
if (pFunc) {
- CFX_FixedBufGrow<FX_FLOAT, 16> results(pFunc->CountOutputs());
+ CFX_FixedBufGrow<float, 16> results(pFunc->CountOutputs());
for (int i = 0; i < 256; i++) {
- FX_FLOAT input = (FX_FLOAT)i / 255.0f;
+ float input = (float)i / 255.0f;
int nresult;
- pFunc->Call(&input, 1, results, nresult);
+ pFunc->Call(&input, 1, results, &nresult);
transfers[i] = FXSYS_round(results[0] * 255);
}
} else {
@@ -2646,7 +2655,7 @@ std::unique_ptr<CFX_DIBitmap> CPDF_RenderStatus::LoadSMask(
dest_buf[i] = transfers[src_buf[i]];
}
} else {
- FXSYS_memcpy(dest_buf, src_buf, dest_pitch * height);
+ memcpy(dest_buf, src_buf, dest_pitch * height);
}
return pMask;
}
diff --git a/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_renderstatus.h b/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_renderstatus.h
index 25ddfb06c37..e9d1f873872 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_renderstatus.h
+++ b/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_renderstatus.h
@@ -105,7 +105,7 @@ class CPDF_RenderStatus {
const CFX_Matrix* pObj2Device,
bool bStroke);
bool ProcessImage(CPDF_ImageObject* pImageObj, const CFX_Matrix* pObj2Device);
- void CompositeDIBitmap(CFX_DIBitmap* pDIBitmap,
+ void CompositeDIBitmap(const CFX_RetainPtr<CFX_DIBitmap>& pDIBitmap,
int left,
int top,
FX_ARGB mask_argb,
@@ -127,24 +127,24 @@ class CPDF_RenderStatus {
void DrawTextPathWithPattern(const CPDF_TextObject* textobj,
const CFX_Matrix* pObj2Device,
CPDF_Font* pFont,
- FX_FLOAT font_size,
+ float font_size,
const CFX_Matrix* pTextMatrix,
bool bFill,
bool bStroke);
bool ProcessForm(const CPDF_FormObject* pFormObj,
const CFX_Matrix* pObj2Device);
- std::unique_ptr<CFX_DIBitmap> GetBackdrop(const CPDF_PageObject* pObj,
- const FX_RECT& rect,
- int& left,
- int& top,
- bool bBackAlphaRequired);
- std::unique_ptr<CFX_DIBitmap> LoadSMask(CPDF_Dictionary* pSMaskDict,
- FX_RECT* pClipRect,
- const CFX_Matrix* pMatrix);
- static CPDF_Type3Cache* GetCachedType3(CPDF_Type3Font* pFont);
+ CFX_RetainPtr<CFX_DIBitmap> GetBackdrop(const CPDF_PageObject* pObj,
+ const FX_RECT& rect,
+ int& left,
+ int& top,
+ bool bBackAlphaRequired);
+ CFX_RetainPtr<CFX_DIBitmap> LoadSMask(CPDF_Dictionary* pSMaskDict,
+ FX_RECT* pClipRect,
+ const CFX_Matrix* pMatrix);
+ static CFX_RetainPtr<CPDF_Type3Cache> GetCachedType3(CPDF_Type3Font* pFont);
static CPDF_GraphicStates* CloneObjStates(const CPDF_GraphicStates* pPathObj,
bool bStroke);
- CPDF_TransferFunc* GetTransferFunc(CPDF_Object* pObject) const;
+ CFX_RetainPtr<CPDF_TransferFunc> GetTransferFunc(CPDF_Object* pObject) const;
FX_ARGB GetFillArgb(CPDF_PageObject* pObj, bool bType3 = false) const;
FX_ARGB GetStrokeArgb(CPDF_PageObject* pObj) const;
bool GetObjectClippedRect(const CPDF_PageObject* pObj,
diff --git a/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_scaledrenderbuffer.cpp b/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_scaledrenderbuffer.cpp
index de60e732bb2..927d23210c0 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_scaledrenderbuffer.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_scaledrenderbuffer.cpp
@@ -40,9 +40,9 @@ bool CPDF_ScaledRenderBuffer::Initialize(CPDF_RenderContext* pContext,
int dpiv =
pDevice->GetDeviceCaps(FXDC_PIXEL_HEIGHT) * 254 / (vert_size * 10);
if (dpih > max_dpi)
- m_Matrix.Scale((FX_FLOAT)(max_dpi) / dpih, 1.0f);
+ m_Matrix.Scale((float)(max_dpi) / dpih, 1.0f);
if (dpiv > max_dpi)
- m_Matrix.Scale(1.0f, (FX_FLOAT)(max_dpi) / (FX_FLOAT)dpiv);
+ m_Matrix.Scale(1.0f, (float)(max_dpi) / (float)dpiv);
}
m_pBitmapDevice = pdfium::MakeUnique<CFX_FxgeDevice>();
FXDIB_Format dibFormat = FXDIB_Rgb;
diff --git a/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_textrenderer.cpp b/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_textrenderer.cpp
index 95af863f7af..c45c1ef792e 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_textrenderer.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_textrenderer.cpp
@@ -18,9 +18,9 @@
// static
bool CPDF_TextRenderer::DrawTextPath(CFX_RenderDevice* pDevice,
const std::vector<uint32_t>& charCodes,
- const std::vector<FX_FLOAT>& charPos,
+ const std::vector<float>& charPos,
CPDF_Font* pFont,
- FX_FLOAT font_size,
+ float font_size,
const CFX_Matrix* pText2User,
const CFX_Matrix* pUser2Device,
const CFX_GraphStateData* pGraphState,
@@ -65,10 +65,10 @@ bool CPDF_TextRenderer::DrawTextPath(CFX_RenderDevice* pDevice,
// static
void CPDF_TextRenderer::DrawTextString(CFX_RenderDevice* pDevice,
- FX_FLOAT origin_x,
- FX_FLOAT origin_y,
+ float origin_x,
+ float origin_y,
CPDF_Font* pFont,
- FX_FLOAT font_size,
+ float font_size,
const CFX_Matrix* pMatrix,
const CFX_ByteString& str,
FX_ARGB fill_argb,
@@ -83,10 +83,10 @@ void CPDF_TextRenderer::DrawTextString(CFX_RenderDevice* pDevice,
int offset = 0;
std::vector<uint32_t> codes;
- std::vector<FX_FLOAT> positions;
+ std::vector<float> positions;
codes.resize(nChars);
positions.resize(nChars - 1);
- FX_FLOAT cur_pos = 0;
+ float cur_pos = 0;
for (int i = 0; i < nChars; i++) {
codes[i] = pFont->GetNextChar(str.c_str(), str.GetLength(), offset);
if (i)
@@ -107,9 +107,9 @@ void CPDF_TextRenderer::DrawTextString(CFX_RenderDevice* pDevice,
// static
bool CPDF_TextRenderer::DrawNormalText(CFX_RenderDevice* pDevice,
const std::vector<uint32_t>& charCodes,
- const std::vector<FX_FLOAT>& charPos,
+ const std::vector<float>& charPos,
CPDF_Font* pFont,
- FX_FLOAT font_size,
+ float font_size,
const CFX_Matrix* pText2Device,
FX_ARGB fill_argb,
const CPDF_RenderOptions* pOptions) {
diff --git a/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_textrenderer.h b/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_textrenderer.h
index 54e9d1bd054..31c44d95992 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_textrenderer.h
+++ b/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_textrenderer.h
@@ -23,10 +23,10 @@ class CPDF_Font;
class CPDF_TextRenderer {
public:
static void DrawTextString(CFX_RenderDevice* pDevice,
- FX_FLOAT origin_x,
- FX_FLOAT origin_y,
+ float origin_x,
+ float origin_y,
CPDF_Font* pFont,
- FX_FLOAT font_size,
+ float font_size,
const CFX_Matrix* matrix,
const CFX_ByteString& str,
FX_ARGB fill_argb,
@@ -35,9 +35,9 @@ class CPDF_TextRenderer {
static bool DrawTextPath(CFX_RenderDevice* pDevice,
const std::vector<uint32_t>& charCodes,
- const std::vector<FX_FLOAT>& charPos,
+ const std::vector<float>& charPos,
CPDF_Font* pFont,
- FX_FLOAT font_size,
+ float font_size,
const CFX_Matrix* pText2User,
const CFX_Matrix* pUser2Device,
const CFX_GraphStateData* pGraphState,
@@ -48,9 +48,9 @@ class CPDF_TextRenderer {
static bool DrawNormalText(CFX_RenderDevice* pDevice,
const std::vector<uint32_t>& charCodes,
- const std::vector<FX_FLOAT>& charPos,
+ const std::vector<float>& charPos,
CPDF_Font* pFont,
- FX_FLOAT font_size,
+ float font_size,
const CFX_Matrix* pText2Device,
FX_ARGB fill_argb,
const CPDF_RenderOptions* pOptions);
diff --git a/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_transferfunc.cpp b/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_transferfunc.cpp
index be4836d20ab..e9ea0576ae5 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_transferfunc.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_transferfunc.cpp
@@ -8,18 +8,22 @@
#include "core/fpdfapi/parser/cpdf_document.h"
#include "core/fpdfapi/render/cpdf_dibtransferfunc.h"
+#include "core/fxge/dib/cfx_dibsource.h"
CPDF_TransferFunc::CPDF_TransferFunc(CPDF_Document* pDoc) : m_pPDFDoc(pDoc) {}
+CPDF_TransferFunc::~CPDF_TransferFunc() {}
+
FX_COLORREF CPDF_TransferFunc::TranslateColor(FX_COLORREF rgb) const {
return FXSYS_RGB(m_Samples[FXSYS_GetRValue(rgb)],
m_Samples[256 + FXSYS_GetGValue(rgb)],
m_Samples[512 + FXSYS_GetBValue(rgb)]);
}
-CFX_DIBSource* CPDF_TransferFunc::TranslateImage(const CFX_DIBSource* pSrc,
- bool bAutoDropSrc) {
- CPDF_DIBTransferFunc* pDest = new CPDF_DIBTransferFunc(this);
- pDest->LoadSrc(pSrc, bAutoDropSrc);
+CFX_RetainPtr<CFX_DIBSource> CPDF_TransferFunc::TranslateImage(
+ const CFX_RetainPtr<CFX_DIBSource>& pSrc) {
+ CFX_RetainPtr<CPDF_TransferFunc> pHolder(this);
+ auto pDest = pdfium::MakeRetain<CPDF_DIBTransferFunc>(pHolder);
+ pDest->LoadSrc(pSrc);
return pDest;
}
diff --git a/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_transferfunc.h b/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_transferfunc.h
index 829b274d9b9..82e7a390379 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_transferfunc.h
+++ b/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_transferfunc.h
@@ -7,20 +7,28 @@
#ifndef CORE_FPDFAPI_RENDER_CPDF_TRANSFERFUNC_H_
#define CORE_FPDFAPI_RENDER_CPDF_TRANSFERFUNC_H_
+#include "core/fxcrt/cfx_retain_ptr.h"
#include "core/fxge/fx_dib.h"
class CPDF_Document;
+class CFX_DIBSource;
-class CPDF_TransferFunc {
+class CPDF_TransferFunc : public CFX_Retainable {
public:
- explicit CPDF_TransferFunc(CPDF_Document* pDoc);
+ template <typename T, typename... Args>
+ friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args);
FX_COLORREF TranslateColor(FX_COLORREF src) const;
- CFX_DIBSource* TranslateImage(const CFX_DIBSource* pSrc, bool bAutoDropSrc);
+ CFX_RetainPtr<CFX_DIBSource> TranslateImage(
+ const CFX_RetainPtr<CFX_DIBSource>& pSrc);
CPDF_Document* const m_pPDFDoc;
bool m_bIdentity;
uint8_t m_Samples[256 * 3];
+
+ private:
+ explicit CPDF_TransferFunc(CPDF_Document* pDoc);
+ ~CPDF_TransferFunc() override;
};
#endif // CORE_FPDFAPI_RENDER_CPDF_TRANSFERFUNC_H_
diff --git a/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_type3cache.cpp b/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_type3cache.cpp
index 63cc780d1d4..b7a4cb808f2 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_type3cache.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_type3cache.cpp
@@ -8,18 +8,20 @@
#include <map>
#include <memory>
+#include <utility>
#include "core/fpdfapi/font/cpdf_type3char.h"
#include "core/fpdfapi/font/cpdf_type3font.h"
#include "core/fpdfapi/render/cpdf_type3glyphs.h"
#include "core/fxge/fx_dib.h"
#include "core/fxge/fx_font.h"
+#include "third_party/base/ptr_util.h"
namespace {
struct CPDF_UniqueKeyGen {
void Generate(int count, ...);
- FX_CHAR m_Key[128];
+ char m_Key[128];
int m_KeyLen;
};
@@ -51,7 +53,8 @@ bool IsScanLine8bpp(uint8_t* pBuf, int width) {
return false;
}
-int DetectFirstLastScan(const CFX_DIBitmap* pBitmap, bool bFirst) {
+int DetectFirstLastScan(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
+ bool bFirst) {
int height = pBitmap->GetHeight();
int pitch = pBitmap->GetPitch();
int width = pBitmap->GetWidth();
@@ -79,16 +82,12 @@ int DetectFirstLastScan(const CFX_DIBitmap* pBitmap, bool bFirst) {
CPDF_Type3Cache::CPDF_Type3Cache(CPDF_Type3Font* pFont) : m_pFont(pFont) {}
-CPDF_Type3Cache::~CPDF_Type3Cache() {
- for (const auto& pair : m_SizeMap)
- delete pair.second;
- m_SizeMap.clear();
-}
+CPDF_Type3Cache::~CPDF_Type3Cache() {}
CFX_GlyphBitmap* CPDF_Type3Cache::LoadGlyph(uint32_t charcode,
const CFX_Matrix* pMatrix,
- FX_FLOAT retinaScaleX,
- FX_FLOAT retinaScaleY) {
+ float retinaScaleX,
+ float retinaScaleY) {
CPDF_UniqueKeyGen keygen;
keygen.Generate(
4, FXSYS_round(pMatrix->a * 10000), FXSYS_round(pMatrix->b * 10000),
@@ -97,10 +96,11 @@ CFX_GlyphBitmap* CPDF_Type3Cache::LoadGlyph(uint32_t charcode,
CPDF_Type3Glyphs* pSizeCache;
auto it = m_SizeMap.find(FaceGlyphsKey);
if (it == m_SizeMap.end()) {
- pSizeCache = new CPDF_Type3Glyphs;
- m_SizeMap[FaceGlyphsKey] = pSizeCache;
+ auto pNew = pdfium::MakeUnique<CPDF_Type3Glyphs>();
+ pSizeCache = pNew.get();
+ m_SizeMap[FaceGlyphsKey] = std::move(pNew);
} else {
- pSizeCache = it->second;
+ pSizeCache = it->second.get();
}
auto it2 = pSizeCache->m_GlyphMap.find(charcode);
if (it2 != pSizeCache->m_GlyphMap.end())
@@ -115,30 +115,30 @@ CFX_GlyphBitmap* CPDF_Type3Cache::LoadGlyph(uint32_t charcode,
CFX_GlyphBitmap* CPDF_Type3Cache::RenderGlyph(CPDF_Type3Glyphs* pSize,
uint32_t charcode,
const CFX_Matrix* pMatrix,
- FX_FLOAT retinaScaleX,
- FX_FLOAT retinaScaleY) {
+ float retinaScaleX,
+ float retinaScaleY) {
const CPDF_Type3Char* pChar = m_pFont->LoadChar(charcode);
if (!pChar || !pChar->m_pBitmap)
return nullptr;
- CFX_DIBitmap* pBitmap = pChar->m_pBitmap.get();
+ CFX_RetainPtr<CFX_DIBitmap> pBitmap = pChar->m_pBitmap;
CFX_Matrix image_matrix = pChar->m_ImageMatrix;
CFX_Matrix text_matrix(pMatrix->a, pMatrix->b, pMatrix->c, pMatrix->d, 0, 0);
image_matrix.Concat(text_matrix);
- std::unique_ptr<CFX_DIBitmap> pResBitmap;
+ CFX_RetainPtr<CFX_DIBitmap> pResBitmap;
int left = 0;
int top = 0;
- if (FXSYS_fabs(image_matrix.b) < FXSYS_fabs(image_matrix.a) / 100 &&
- FXSYS_fabs(image_matrix.c) < FXSYS_fabs(image_matrix.d) / 100) {
+ if (fabs(image_matrix.b) < fabs(image_matrix.a) / 100 &&
+ fabs(image_matrix.c) < fabs(image_matrix.d) / 100) {
int top_line = DetectFirstLastScan(pBitmap, true);
int bottom_line = DetectFirstLastScan(pBitmap, false);
if (top_line == 0 && bottom_line == pBitmap->GetHeight() - 1) {
- FX_FLOAT top_y = image_matrix.d + image_matrix.f;
- FX_FLOAT bottom_y = image_matrix.f;
+ float top_y = image_matrix.d + image_matrix.f;
+ float bottom_y = image_matrix.f;
bool bFlipped = top_y > bottom_y;
if (bFlipped) {
- FX_FLOAT temp = top_y;
+ float temp = top_y;
top_y = bottom_y;
bottom_y = temp;
}
@@ -166,6 +166,6 @@ CFX_GlyphBitmap* CPDF_Type3Cache::RenderGlyph(CPDF_Type3Glyphs* pSize,
CFX_GlyphBitmap* pGlyph = new CFX_GlyphBitmap;
pGlyph->m_Left = left;
pGlyph->m_Top = -top;
- pGlyph->m_Bitmap.TakeOver(pResBitmap.get());
+ pGlyph->m_pBitmap->TakeOver(std::move(pResBitmap));
return pGlyph;
}
diff --git a/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_type3cache.h b/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_type3cache.h
index f74a43acc57..dc3e91b3599 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_type3cache.h
+++ b/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_type3cache.h
@@ -8,33 +8,38 @@
#define CORE_FPDFAPI_RENDER_CPDF_TYPE3CACHE_H_
#include <map>
+#include <memory>
#include "core/fpdfapi/font/cpdf_type3font.h"
+#include "core/fxcrt/cfx_retain_ptr.h"
#include "core/fxcrt/fx_coordinates.h"
#include "core/fxcrt/fx_string.h"
#include "core/fxcrt/fx_system.h"
class CPDF_Type3Glyphs;
-class CPDF_Type3Cache {
+class CPDF_Type3Cache : public CFX_Retainable {
public:
- explicit CPDF_Type3Cache(CPDF_Type3Font* pFont);
- ~CPDF_Type3Cache();
+ template <typename T, typename... Args>
+ friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args);
CFX_GlyphBitmap* LoadGlyph(uint32_t charcode,
const CFX_Matrix* pMatrix,
- FX_FLOAT retinaScaleX,
- FX_FLOAT retinaScaleY);
+ float retinaScaleX,
+ float retinaScaleY);
private:
+ explicit CPDF_Type3Cache(CPDF_Type3Font* pFont);
+ ~CPDF_Type3Cache() override;
+
CFX_GlyphBitmap* RenderGlyph(CPDF_Type3Glyphs* pSize,
uint32_t charcode,
const CFX_Matrix* pMatrix,
- FX_FLOAT retinaScaleX,
- FX_FLOAT retinaScaleY);
+ float retinaScaleX,
+ float retinaScaleY);
CPDF_Type3Font* const m_pFont;
- std::map<CFX_ByteString, CPDF_Type3Glyphs*> m_SizeMap;
+ std::map<CFX_ByteString, std::unique_ptr<CPDF_Type3Glyphs>> m_SizeMap;
};
#endif // CORE_FPDFAPI_RENDER_CPDF_TYPE3CACHE_H_
diff --git a/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_type3glyphs.cpp b/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_type3glyphs.cpp
index 189fc2439d7..5fce32ce932 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_type3glyphs.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_type3glyphs.cpp
@@ -18,11 +18,11 @@ CPDF_Type3Glyphs::~CPDF_Type3Glyphs() {
delete pair.second;
}
-static int _AdjustBlue(FX_FLOAT pos, int& count, int blues[]) {
- FX_FLOAT min_distance = 1000000.0f;
+static int _AdjustBlue(float pos, int& count, int blues[]) {
+ float min_distance = 1000000.0f;
int closest_pos = -1;
for (int i = 0; i < count; i++) {
- FX_FLOAT distance = FXSYS_fabs(pos - static_cast<FX_FLOAT>(blues[i]));
+ float distance = fabs(pos - static_cast<float>(blues[i]));
if (distance < 1.0f * 80.0f / 100.0f && distance < min_distance) {
min_distance = distance;
closest_pos = i;
@@ -37,8 +37,8 @@ static int _AdjustBlue(FX_FLOAT pos, int& count, int blues[]) {
return new_pos;
}
-void CPDF_Type3Glyphs::AdjustBlue(FX_FLOAT top,
- FX_FLOAT bottom,
+void CPDF_Type3Glyphs::AdjustBlue(float top,
+ float bottom,
int& top_line,
int& bottom_line) {
top_line = _AdjustBlue(top, m_TopBlueCount, m_TopBlue);
diff --git a/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_type3glyphs.h b/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_type3glyphs.h
index 00814d5b3bf..443910dac07 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_type3glyphs.h
+++ b/chromium/third_party/pdfium/core/fpdfapi/render/cpdf_type3glyphs.h
@@ -20,10 +20,7 @@ class CPDF_Type3Glyphs {
CPDF_Type3Glyphs();
~CPDF_Type3Glyphs();
- void AdjustBlue(FX_FLOAT top,
- FX_FLOAT bottom,
- int& top_line,
- int& bottom_line);
+ void AdjustBlue(float top, float bottom, int& top_line, int& bottom_line);
std::map<uint32_t, CFX_GlyphBitmap*> m_GlyphMap;
int m_TopBlue[TYPE3_MAX_BLUES];
diff --git a/chromium/third_party/pdfium/core/fpdfdoc/cline.cpp b/chromium/third_party/pdfium/core/fpdfdoc/cline.cpp
index 2e8477cfe72..a24b81950a2 100644
--- a/chromium/third_party/pdfium/core/fpdfdoc/cline.cpp
+++ b/chromium/third_party/pdfium/core/fpdfdoc/cline.cpp
@@ -8,6 +8,8 @@
CLine::CLine() {}
+CLine::CLine(const CPVT_LineInfo& lineinfo) : m_LineInfo(lineinfo) {}
+
CLine::~CLine() {}
CPVT_WordPlace CLine::GetBeginWordPlace() const {
diff --git a/chromium/third_party/pdfium/core/fpdfdoc/cline.h b/chromium/third_party/pdfium/core/fpdfdoc/cline.h
index 6f95beb546e..67bf06b649e 100644
--- a/chromium/third_party/pdfium/core/fpdfdoc/cline.h
+++ b/chromium/third_party/pdfium/core/fpdfdoc/cline.h
@@ -10,9 +10,10 @@
#include "core/fpdfdoc/cpvt_lineinfo.h"
#include "core/fpdfdoc/cpvt_wordplace.h"
-class CLine final {
+class CLine {
public:
CLine();
+ explicit CLine(const CPVT_LineInfo& lineinfo);
~CLine();
CPVT_WordPlace GetBeginWordPlace() const;
diff --git a/chromium/third_party/pdfium/core/fpdfdoc/clines.cpp b/chromium/third_party/pdfium/core/fpdfdoc/clines.cpp
deleted file mode 100644
index 1e425eab932..00000000000
--- a/chromium/third_party/pdfium/core/fpdfdoc/clines.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright 2016 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#include "core/fpdfdoc/clines.h"
-
-#include "core/fpdfdoc/cline.h"
-
-CLines::CLines() : m_nTotal(0) {}
-
-CLines::~CLines() {
- RemoveAll();
-}
-
-int32_t CLines::GetSize() const {
- return m_Lines.GetSize();
-}
-
-CLine* CLines::GetAt(int32_t nIndex) const {
- return m_Lines.GetAt(nIndex);
-}
-
-void CLines::Empty() {
- m_nTotal = 0;
-}
-
-void CLines::RemoveAll() {
- for (int32_t i = 0, sz = GetSize(); i < sz; i++)
- delete GetAt(i);
- m_Lines.RemoveAll();
- m_nTotal = 0;
-}
-
-int32_t CLines::Add(const CPVT_LineInfo& lineinfo) {
- if (m_nTotal >= GetSize()) {
- CLine* pLine = new CLine;
- pLine->m_LineInfo = lineinfo;
- m_Lines.Add(pLine);
- } else if (CLine* pLine = GetAt(m_nTotal)) {
- pLine->m_LineInfo = lineinfo;
- }
- return m_nTotal++;
-}
-
-void CLines::Clear() {
- for (int32_t i = GetSize() - 1; i >= m_nTotal; i--) {
- delete GetAt(i);
- m_Lines.RemoveAt(i);
- }
-}
diff --git a/chromium/third_party/pdfium/core/fpdfdoc/clines.h b/chromium/third_party/pdfium/core/fpdfdoc/clines.h
deleted file mode 100644
index b4db0e39666..00000000000
--- a/chromium/third_party/pdfium/core/fpdfdoc/clines.h
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright 2016 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef CORE_FPDFDOC_CLINES_H_
-#define CORE_FPDFDOC_CLINES_H_
-
-#include <stdint.h>
-
-#include "core/fpdfdoc/cpvt_arraytemplate.h"
-#include "core/fpdfdoc/cpvt_lineinfo.h"
-
-class CLine;
-
-class CLines final {
- public:
- CLines();
- ~CLines();
-
- int32_t GetSize() const;
- CLine* GetAt(int32_t nIndex) const;
-
- void Empty();
- void RemoveAll();
- int32_t Add(const CPVT_LineInfo& lineinfo);
- void Clear();
-
- private:
- CPVT_ArrayTemplate<CLine*> m_Lines;
- int32_t m_nTotal;
-};
-
-#endif // CORE_FPDFDOC_CLINES_H_
diff --git a/chromium/third_party/pdfium/core/fpdfdoc/cpdf_aaction.cpp b/chromium/third_party/pdfium/core/fpdfdoc/cpdf_aaction.cpp
index 39120fcdb33..7dc42828f47 100644
--- a/chromium/third_party/pdfium/core/fpdfdoc/cpdf_aaction.cpp
+++ b/chromium/third_party/pdfium/core/fpdfdoc/cpdf_aaction.cpp
@@ -8,9 +8,9 @@
namespace {
-const FX_CHAR* g_sAATypes[] = {"E", "X", "D", "U", "Fo", "Bl", "PO", "PC",
- "PV", "PI", "O", "C", "K", "F", "V", "C",
- "WC", "WS", "DS", "WP", "DP", ""};
+const char* g_sAATypes[] = {"E", "X", "D", "U", "Fo", "Bl", "PO", "PC",
+ "PV", "PI", "O", "C", "K", "F", "V", "C",
+ "WC", "WS", "DS", "WP", "DP", ""};
} // namespace
diff --git a/chromium/third_party/pdfium/core/fpdfdoc/cpdf_action.cpp b/chromium/third_party/pdfium/core/fpdfdoc/cpdf_action.cpp
index dabc0bb1028..f523f86b373 100644
--- a/chromium/third_party/pdfium/core/fpdfdoc/cpdf_action.cpp
+++ b/chromium/third_party/pdfium/core/fpdfdoc/cpdf_action.cpp
@@ -13,7 +13,7 @@
namespace {
-const FX_CHAR* const g_sATypes[] = {
+const char* const g_sATypes[] = {
"Unknown", "GoTo", "GoToR", "GoToE", "Launch",
"Thread", "URI", "Sound", "Movie", "Hide",
"Named", "SubmitForm", "ResetForm", "ImportData", "JavaScript",
diff --git a/chromium/third_party/pdfium/core/fpdfdoc/cpdf_annot.cpp b/chromium/third_party/pdfium/core/fpdfdoc/cpdf_annot.cpp
index 89c4785d982..a3ee70ab36b 100644
--- a/chromium/third_party/pdfium/core/fpdfdoc/cpdf_annot.cpp
+++ b/chromium/third_party/pdfium/core/fpdfdoc/cpdf_annot.cpp
@@ -163,7 +163,7 @@ CPDF_Stream* FPDFDOC_GetAnnotAP(CPDF_Dictionary* pAnnotDict,
if (!pAP) {
return nullptr;
}
- const FX_CHAR* ap_entry = "N";
+ const char* ap_entry = "N";
if (mode == CPDF_Annot::Down)
ap_entry = "D";
else if (mode == CPDF_Annot::Rollover)
@@ -426,7 +426,7 @@ void CPDF_Annot::DrawBorder(CFX_RenderDevice* pDevice,
}
CPDF_Dictionary* pBS = m_pAnnotDict->GetDictFor("BS");
char style_char;
- FX_FLOAT width;
+ float width;
CPDF_Array* pDashArray = nullptr;
if (!pBS) {
CPDF_Array* pBorderArray = m_pAnnotDict->GetArrayFor("Border");
@@ -479,7 +479,7 @@ void CPDF_Annot::DrawBorder(CFX_RenderDevice* pDevice,
if (dash_count % 2) {
dash_count++;
}
- graph_state.m_DashArray = FX_Alloc(FX_FLOAT, dash_count);
+ graph_state.m_DashArray = FX_Alloc(float, dash_count);
graph_state.m_DashCount = dash_count;
size_t i;
for (i = 0; i < pDashArray->GetCount(); ++i) {
@@ -489,7 +489,7 @@ void CPDF_Annot::DrawBorder(CFX_RenderDevice* pDevice,
graph_state.m_DashArray[i] = graph_state.m_DashArray[i - 1];
}
} else {
- graph_state.m_DashArray = FX_Alloc(FX_FLOAT, 2);
+ graph_state.m_DashArray = FX_Alloc(float, 2);
graph_state.m_DashCount = 2;
graph_state.m_DashArray[0] = graph_state.m_DashArray[1] = 3 * 1.0f;
}
diff --git a/chromium/third_party/pdfium/core/fpdfdoc/cpdf_apsettings.cpp b/chromium/third_party/pdfium/core/fpdfdoc/cpdf_apsettings.cpp
index 9fc9c1aa066..4c44f5a13e2 100644
--- a/chromium/third_party/pdfium/core/fpdfdoc/cpdf_apsettings.cpp
+++ b/chromium/third_party/pdfium/core/fpdfdoc/cpdf_apsettings.cpp
@@ -36,33 +36,32 @@ FX_ARGB CPDF_ApSettings::GetColor(int& iColorType,
size_t dwCount = pEntry->GetCount();
if (dwCount == 1) {
iColorType = COLORTYPE_GRAY;
- FX_FLOAT g = pEntry->GetNumberAt(0) * 255;
+ float g = pEntry->GetNumberAt(0) * 255;
return ArgbEncode(255, (int)g, (int)g, (int)g);
}
if (dwCount == 3) {
iColorType = COLORTYPE_RGB;
- FX_FLOAT r = pEntry->GetNumberAt(0) * 255;
- FX_FLOAT g = pEntry->GetNumberAt(1) * 255;
- FX_FLOAT b = pEntry->GetNumberAt(2) * 255;
+ float r = pEntry->GetNumberAt(0) * 255;
+ float g = pEntry->GetNumberAt(1) * 255;
+ float b = pEntry->GetNumberAt(2) * 255;
return ArgbEncode(255, (int)r, (int)g, (int)b);
}
if (dwCount == 4) {
iColorType = COLORTYPE_CMYK;
- FX_FLOAT c = pEntry->GetNumberAt(0);
- FX_FLOAT m = pEntry->GetNumberAt(1);
- FX_FLOAT y = pEntry->GetNumberAt(2);
- FX_FLOAT k = pEntry->GetNumberAt(3);
- FX_FLOAT r = 1.0f - std::min(1.0f, c + k);
- FX_FLOAT g = 1.0f - std::min(1.0f, m + k);
- FX_FLOAT b = 1.0f - std::min(1.0f, y + k);
+ float c = pEntry->GetNumberAt(0);
+ float m = pEntry->GetNumberAt(1);
+ float y = pEntry->GetNumberAt(2);
+ float k = pEntry->GetNumberAt(3);
+ float r = 1.0f - std::min(1.0f, c + k);
+ float g = 1.0f - std::min(1.0f, m + k);
+ float b = 1.0f - std::min(1.0f, y + k);
return ArgbEncode(255, (int)(r * 255), (int)(g * 255), (int)(b * 255));
}
return color;
}
-FX_FLOAT CPDF_ApSettings::GetOriginalColor(
- int index,
- const CFX_ByteString& csEntry) const {
+float CPDF_ApSettings::GetOriginalColor(int index,
+ const CFX_ByteString& csEntry) const {
if (!m_pDict)
return 0;
@@ -71,7 +70,7 @@ FX_FLOAT CPDF_ApSettings::GetOriginalColor(
}
void CPDF_ApSettings::GetOriginalColor(int& iColorType,
- FX_FLOAT fc[4],
+ float fc[4],
const CFX_ByteString& csEntry) const {
iColorType = COLORTYPE_TRANSPARENT;
for (int i = 0; i < 4; i++)
diff --git a/chromium/third_party/pdfium/core/fpdfdoc/cpdf_apsettings.h b/chromium/third_party/pdfium/core/fpdfdoc/cpdf_apsettings.h
index ffddffdbe06..ba0b05bd2b4 100644
--- a/chromium/third_party/pdfium/core/fpdfdoc/cpdf_apsettings.h
+++ b/chromium/third_party/pdfium/core/fpdfdoc/cpdf_apsettings.h
@@ -27,11 +27,11 @@ class CPDF_ApSettings {
return GetColor(iColorType, "BC");
}
- FX_FLOAT GetOriginalBorderColor(int index) const {
+ float GetOriginalBorderColor(int index) const {
return GetOriginalColor(index, "BC");
}
- void GetOriginalBorderColor(int& iColorType, FX_FLOAT fc[4]) const {
+ void GetOriginalBorderColor(int& iColorType, float fc[4]) const {
GetOriginalColor(iColorType, fc, "BC");
}
@@ -39,11 +39,11 @@ class CPDF_ApSettings {
return GetColor(iColorType, "BG");
}
- FX_FLOAT GetOriginalBackgroundColor(int index) const {
+ float GetOriginalBackgroundColor(int index) const {
return GetOriginalColor(index, "BG");
}
- void GetOriginalBackgroundColor(int& iColorType, FX_FLOAT fc[4]) const {
+ void GetOriginalBackgroundColor(int& iColorType, float fc[4]) const {
GetOriginalColor(iColorType, fc, "BG");
}
@@ -60,9 +60,9 @@ class CPDF_ApSettings {
friend class CPDF_FormControl;
FX_ARGB GetColor(int& iColorType, const CFX_ByteString& csEntry) const;
- FX_FLOAT GetOriginalColor(int index, const CFX_ByteString& csEntry) const;
+ float GetOriginalColor(int index, const CFX_ByteString& csEntry) const;
void GetOriginalColor(int& iColorType,
- FX_FLOAT fc[4],
+ float fc[4],
const CFX_ByteString& csEntry) const;
CFX_WideString GetCaption(const CFX_ByteString& csEntry) const;
diff --git a/chromium/third_party/pdfium/core/fpdfdoc/cpdf_bookmark.cpp b/chromium/third_party/pdfium/core/fpdfdoc/cpdf_bookmark.cpp
index c2c37057170..ba1e18c46d0 100644
--- a/chromium/third_party/pdfium/core/fpdfdoc/cpdf_bookmark.cpp
+++ b/chromium/third_party/pdfium/core/fpdfdoc/cpdf_bookmark.cpp
@@ -44,9 +44,9 @@ CFX_WideString CPDF_Bookmark::GetTitle() const {
if (!len)
return CFX_WideString();
- std::unique_ptr<FX_WCHAR[]> buf(new FX_WCHAR[len]);
+ std::unique_ptr<wchar_t[]> buf(new wchar_t[len]);
for (int i = 0; i < len; i++) {
- FX_WCHAR w = title[i];
+ wchar_t w = title[i];
buf[i] = w > 0x20 ? w : 0x20;
}
return CFX_WideString(buf.get(), len);
diff --git a/chromium/third_party/pdfium/core/fpdfdoc/cpdf_defaultappearance.cpp b/chromium/third_party/pdfium/core/fpdfdoc/cpdf_defaultappearance.cpp
index 19767650f3a..28213aa33b4 100644
--- a/chromium/third_party/pdfium/core/fpdfdoc/cpdf_defaultappearance.cpp
+++ b/chromium/third_party/pdfium/core/fpdfdoc/cpdf_defaultappearance.cpp
@@ -36,20 +36,19 @@ CFX_ByteString CPDF_DefaultAppearance::GetFontString() {
return csFont;
}
-void CPDF_DefaultAppearance::GetFont(CFX_ByteString& csFontNameTag,
- FX_FLOAT& fFontSize) {
- csFontNameTag = "";
- fFontSize = 0;
+CFX_ByteString CPDF_DefaultAppearance::GetFont(float* fFontSize) {
+ *fFontSize = 0.0f;
if (m_csDA.IsEmpty())
- return;
+ return CFX_ByteString();
+ CFX_ByteString csFontNameTag;
CPDF_SimpleParser syntax(m_csDA.AsStringC());
if (syntax.FindTagParamFromStart("Tf", 2)) {
csFontNameTag = CFX_ByteString(syntax.GetWord());
csFontNameTag.Delete(0, 1);
- fFontSize = FX_atof(syntax.GetWord());
+ *fFontSize = FX_atof(syntax.GetWord());
}
- csFontNameTag = PDF_NameDecode(csFontNameTag);
+ return PDF_NameDecode(csFontNameTag);
}
bool CPDF_DefaultAppearance::HasColor(PaintOperation nOperation) {
@@ -110,7 +109,7 @@ CFX_ByteString CPDF_DefaultAppearance::GetColorString(
}
void CPDF_DefaultAppearance::GetColor(int& iColorType,
- FX_FLOAT fc[4],
+ float fc[4],
PaintOperation nOperation) {
iColorType = COLORTYPE_TRANSPARENT;
for (int c = 0; c < 4; c++)
@@ -156,29 +155,29 @@ void CPDF_DefaultAppearance::GetColor(FX_ARGB& color,
if (syntax.FindTagParamFromStart(
(nOperation == PaintOperation::STROKE ? "G" : "g"), 1)) {
iColorType = COLORTYPE_GRAY;
- FX_FLOAT g = FX_atof(syntax.GetWord()) * 255 + 0.5f;
+ float g = FX_atof(syntax.GetWord()) * 255 + 0.5f;
color = ArgbEncode(255, (int)g, (int)g, (int)g);
return;
}
if (syntax.FindTagParamFromStart(
(nOperation == PaintOperation::STROKE ? "RG" : "rg"), 3)) {
iColorType = COLORTYPE_RGB;
- FX_FLOAT r = FX_atof(syntax.GetWord()) * 255 + 0.5f;
- FX_FLOAT g = FX_atof(syntax.GetWord()) * 255 + 0.5f;
- FX_FLOAT b = FX_atof(syntax.GetWord()) * 255 + 0.5f;
+ float r = FX_atof(syntax.GetWord()) * 255 + 0.5f;
+ float g = FX_atof(syntax.GetWord()) * 255 + 0.5f;
+ float b = FX_atof(syntax.GetWord()) * 255 + 0.5f;
color = ArgbEncode(255, (int)r, (int)g, (int)b);
return;
}
if (syntax.FindTagParamFromStart(
(nOperation == PaintOperation::STROKE ? "K" : "k"), 4)) {
iColorType = COLORTYPE_CMYK;
- FX_FLOAT c = FX_atof(syntax.GetWord());
- FX_FLOAT m = FX_atof(syntax.GetWord());
- FX_FLOAT y = FX_atof(syntax.GetWord());
- FX_FLOAT k = FX_atof(syntax.GetWord());
- FX_FLOAT r = 1.0f - std::min(1.0f, c + k);
- FX_FLOAT g = 1.0f - std::min(1.0f, m + k);
- FX_FLOAT b = 1.0f - std::min(1.0f, y + k);
+ float c = FX_atof(syntax.GetWord());
+ float m = FX_atof(syntax.GetWord());
+ float y = FX_atof(syntax.GetWord());
+ float k = FX_atof(syntax.GetWord());
+ float r = 1.0f - std::min(1.0f, c + k);
+ float g = 1.0f - std::min(1.0f, m + k);
+ float b = 1.0f - std::min(1.0f, y + k);
color = ArgbEncode(255, (int)(r * 255 + 0.5f), (int)(g * 255 + 0.5f),
(int)(b * 255 + 0.5f));
}
@@ -216,7 +215,7 @@ CFX_Matrix CPDF_DefaultAppearance::GetTextMatrix() {
if (!syntax.FindTagParamFromStart("Tm", 6))
return CFX_Matrix();
- FX_FLOAT f[6];
+ float f[6];
for (int i = 0; i < 6; i++)
f[i] = FX_atof(syntax.GetWord());
return CFX_Matrix(f);
diff --git a/chromium/third_party/pdfium/core/fpdfdoc/cpdf_defaultappearance.h b/chromium/third_party/pdfium/core/fpdfdoc/cpdf_defaultappearance.h
index 4fd32ebd0c7..3be06e294d0 100644
--- a/chromium/third_party/pdfium/core/fpdfdoc/cpdf_defaultappearance.h
+++ b/chromium/third_party/pdfium/core/fpdfdoc/cpdf_defaultappearance.h
@@ -29,13 +29,13 @@ class CPDF_DefaultAppearance {
bool HasFont();
CFX_ByteString GetFontString();
- void GetFont(CFX_ByteString& csFontNameTag, FX_FLOAT& fFontSize);
+ CFX_ByteString GetFont(float* fFontSize);
bool HasColor(PaintOperation nOperation = PaintOperation::FILL);
CFX_ByteString GetColorString(
PaintOperation nOperation = PaintOperation::FILL);
void GetColor(int& iColorType,
- FX_FLOAT fc[4],
+ float fc[4],
PaintOperation nOperation = PaintOperation::FILL);
void GetColor(FX_ARGB& color,
int& iColorType,
diff --git a/chromium/third_party/pdfium/core/fpdfdoc/cpdf_dest.cpp b/chromium/third_party/pdfium/core/fpdfdoc/cpdf_dest.cpp
index 51e2d0b5342..ca380be957b 100644
--- a/chromium/third_party/pdfium/core/fpdfdoc/cpdf_dest.cpp
+++ b/chromium/third_party/pdfium/core/fpdfdoc/cpdf_dest.cpp
@@ -13,8 +13,8 @@
namespace {
-const FX_CHAR* const g_sZoomModes[] = {"XYZ", "Fit", "FitH", "FitV", "FitR",
- "FitB", "FitBH", "FitBV", nullptr};
+const char* const g_sZoomModes[] = {"XYZ", "Fit", "FitH", "FitV", "FitR",
+ "FitB", "FitBH", "FitBV", nullptr};
} // namespace
@@ -113,7 +113,7 @@ bool CPDF_Dest::GetXYZ(bool* pHasX,
return true;
}
-FX_FLOAT CPDF_Dest::GetParam(int index) {
+float CPDF_Dest::GetParam(int index) {
CPDF_Array* pArray = ToArray(m_pObj);
return pArray ? pArray->GetNumberAt(2 + index) : 0;
}
diff --git a/chromium/third_party/pdfium/core/fpdfdoc/cpdf_dest.h b/chromium/third_party/pdfium/core/fpdfdoc/cpdf_dest.h
index 527d1dcf8b1..47559495a47 100644
--- a/chromium/third_party/pdfium/core/fpdfdoc/cpdf_dest.h
+++ b/chromium/third_party/pdfium/core/fpdfdoc/cpdf_dest.h
@@ -23,7 +23,7 @@ class CPDF_Dest {
int GetPageIndex(CPDF_Document* pDoc);
uint32_t GetPageObjNum();
int GetZoomMode();
- FX_FLOAT GetParam(int index);
+ float GetParam(int index);
bool GetXYZ(bool* pHasX,
bool* pHasY,
diff --git a/chromium/third_party/pdfium/core/fpdfdoc/cpdf_docjsactions.cpp b/chromium/third_party/pdfium/core/fpdfdoc/cpdf_docjsactions.cpp
index a7fcdfd0710..c0e7a78fd6d 100644
--- a/chromium/third_party/pdfium/core/fpdfdoc/cpdf_docjsactions.cpp
+++ b/chromium/third_party/pdfium/core/fpdfdoc/cpdf_docjsactions.cpp
@@ -16,11 +16,12 @@ int CPDF_DocJSActions::CountJSActions() const {
return name_tree.GetCount();
}
-CPDF_Action CPDF_DocJSActions::GetJSAction(int index,
- CFX_ByteString& csName) const {
+CPDF_Action CPDF_DocJSActions::GetJSActionAndName(
+ int index,
+ CFX_ByteString* csName) const {
ASSERT(m_pDocument);
CPDF_NameTree name_tree(m_pDocument, "JavaScript");
- CPDF_Object* pAction = name_tree.LookupValue(index, csName);
+ CPDF_Object* pAction = name_tree.LookupValueAndName(index, csName);
return ToDictionary(pAction) ? CPDF_Action(pAction->GetDict())
: CPDF_Action();
}
diff --git a/chromium/third_party/pdfium/core/fpdfdoc/cpdf_docjsactions.h b/chromium/third_party/pdfium/core/fpdfdoc/cpdf_docjsactions.h
index 8a8d03d3649..16b6be3d696 100644
--- a/chromium/third_party/pdfium/core/fpdfdoc/cpdf_docjsactions.h
+++ b/chromium/third_party/pdfium/core/fpdfdoc/cpdf_docjsactions.h
@@ -17,7 +17,7 @@ class CPDF_DocJSActions {
explicit CPDF_DocJSActions(CPDF_Document* pDoc);
int CountJSActions() const;
- CPDF_Action GetJSAction(int index, CFX_ByteString& csName) const;
+ CPDF_Action GetJSActionAndName(int index, CFX_ByteString* csName) const;
CPDF_Action GetJSAction(const CFX_ByteString& csName) const;
int FindJSAction(const CFX_ByteString& csName) const;
CPDF_Document* GetDocument() const { return m_pDocument; }
diff --git a/chromium/third_party/pdfium/core/fpdfdoc/cpdf_filespec.cpp b/chromium/third_party/pdfium/core/fpdfdoc/cpdf_filespec.cpp
index ce6f9a247e9..e5f026e5739 100644
--- a/chromium/third_party/pdfium/core/fpdfdoc/cpdf_filespec.cpp
+++ b/chromium/third_party/pdfium/core/fpdfdoc/cpdf_filespec.cpp
@@ -17,7 +17,7 @@ namespace {
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ || \
_FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
-CFX_WideString ChangeSlashToPlatform(const FX_WCHAR* str) {
+CFX_WideString ChangeSlashToPlatform(const wchar_t* str) {
CFX_WideString result;
while (*str) {
if (*str == '/') {
@@ -34,7 +34,7 @@ CFX_WideString ChangeSlashToPlatform(const FX_WCHAR* str) {
return result;
}
-CFX_WideString ChangeSlashToPDF(const FX_WCHAR* str) {
+CFX_WideString ChangeSlashToPDF(const wchar_t* str) {
CFX_WideString result;
while (*str) {
if (*str == '\\' || *str == ':')
diff --git a/chromium/third_party/pdfium/core/fpdfdoc/cpdf_filespec_unittest.cpp b/chromium/third_party/pdfium/core/fpdfdoc/cpdf_filespec_unittest.cpp
index d164165f00d..e237aa5b6bb 100644
--- a/chromium/third_party/pdfium/core/fpdfdoc/cpdf_filespec_unittest.cpp
+++ b/chromium/third_party/pdfium/core/fpdfdoc/cpdf_filespec_unittest.cpp
@@ -11,6 +11,7 @@
#include "core/fpdfdoc/cpdf_filespec.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/test_support.h"
+#include "third_party/base/ptr_util.h"
TEST(cpdf_filespec, EncodeDecodeFileName) {
std::vector<pdfium::NullTermWstrFuncTestData> test_data = {
@@ -67,8 +68,7 @@ TEST(cpdf_filespec, GetFileName) {
L"/docs/test.pdf"
#endif
};
- std::unique_ptr<CPDF_Object> str_obj(
- new CPDF_String(nullptr, test_data.input));
+ auto str_obj = pdfium::MakeUnique<CPDF_String>(nullptr, test_data.input);
CPDF_FileSpec file_spec(str_obj.get());
CFX_WideString file_name;
EXPECT_TRUE(file_spec.GetFileName(&file_name));
@@ -99,7 +99,7 @@ TEST(cpdf_filespec, GetFileName) {
};
// Keyword fields in reverse order of precedence to retrieve the file name.
const char* const keywords[5] = {"Unix", "Mac", "DOS", "F", "UF"};
- std::unique_ptr<CPDF_Dictionary> dict_obj(new CPDF_Dictionary());
+ auto dict_obj = pdfium::MakeUnique<CPDF_Dictionary>();
CPDF_FileSpec file_spec(dict_obj.get());
CFX_WideString file_name;
for (int i = 0; i < 5; ++i) {
@@ -116,7 +116,7 @@ TEST(cpdf_filespec, GetFileName) {
}
{
// Invalid object.
- std::unique_ptr<CPDF_Object> name_obj(new CPDF_Name(nullptr, "test.pdf"));
+ auto name_obj = pdfium::MakeUnique<CPDF_Name>(nullptr, "test.pdf");
CPDF_FileSpec file_spec(name_obj.get());
CFX_WideString file_name;
EXPECT_FALSE(file_spec.GetFileName(&file_name));
@@ -137,7 +137,7 @@ TEST(cpdf_filespec, SetFileName) {
#endif
};
// String object.
- std::unique_ptr<CPDF_Object> str_obj(new CPDF_String(nullptr, L"babababa"));
+ auto str_obj = pdfium::MakeUnique<CPDF_String>(nullptr, L"babababa");
CPDF_FileSpec file_spec1(str_obj.get());
file_spec1.SetFileName(test_data.input);
// Check internal object value.
@@ -149,7 +149,7 @@ TEST(cpdf_filespec, SetFileName) {
EXPECT_TRUE(file_name == test_data.input);
// Dictionary object.
- std::unique_ptr<CPDF_Dictionary> dict_obj(new CPDF_Dictionary());
+ auto dict_obj = pdfium::MakeUnique<CPDF_Dictionary>();
CPDF_FileSpec file_spec2(dict_obj.get());
file_spec2.SetFileName(test_data.input);
// Check internal object value.
diff --git a/chromium/third_party/pdfium/core/fpdfdoc/cpdf_formcontrol.cpp b/chromium/third_party/pdfium/core/fpdfdoc/cpdf_formcontrol.cpp
index 54edb4910c0..d8d6854b82d 100644
--- a/chromium/third_party/pdfium/core/fpdfdoc/cpdf_formcontrol.cpp
+++ b/chromium/third_party/pdfium/core/fpdfdoc/cpdf_formcontrol.cpp
@@ -20,7 +20,7 @@
namespace {
-const FX_CHAR* const g_sHighlightingMode[] = {
+const char* const g_sHighlightingMode[] = {
// Must match order of HighlightingMode enum.
"N", "I", "O", "P", "T"};
@@ -216,13 +216,13 @@ FX_ARGB CPDF_FormControl::GetColor(int& iColorType,
return GetMK().GetColor(iColorType, csEntry);
}
-FX_FLOAT CPDF_FormControl::GetOriginalColor(int index,
- const CFX_ByteString& csEntry) {
+float CPDF_FormControl::GetOriginalColor(int index,
+ const CFX_ByteString& csEntry) {
return GetMK().GetOriginalColor(index, csEntry);
}
void CPDF_FormControl::GetOriginalColor(int& iColorType,
- FX_FLOAT fc[4],
+ float fc[4],
const CFX_ByteString& csEntry) {
GetMK().GetOriginalColor(iColorType, fc, csEntry);
}
@@ -280,10 +280,9 @@ CPDF_DefaultAppearance CPDF_FormControl::GetDefaultAppearance() {
}
CPDF_Font* CPDF_FormControl::GetDefaultControlFont() {
+ float fFontSize;
CPDF_DefaultAppearance cDA = GetDefaultAppearance();
- CFX_ByteString csFontNameTag;
- FX_FLOAT fFontSize;
- cDA.GetFont(csFontNameTag, fFontSize);
+ CFX_ByteString csFontNameTag = cDA.GetFont(&fFontSize);
if (csFontNameTag.IsEmpty())
return nullptr;
diff --git a/chromium/third_party/pdfium/core/fpdfdoc/cpdf_formcontrol.h b/chromium/third_party/pdfium/core/fpdfdoc/cpdf_formcontrol.h
index c0dad390985..fff77fb32dd 100644
--- a/chromium/third_party/pdfium/core/fpdfdoc/cpdf_formcontrol.h
+++ b/chromium/third_party/pdfium/core/fpdfdoc/cpdf_formcontrol.h
@@ -72,11 +72,11 @@ class CPDF_FormControl {
FX_ARGB GetBorderColor(int& iColorType) { return GetColor(iColorType, "BC"); }
- FX_FLOAT GetOriginalBorderColor(int index) {
+ float GetOriginalBorderColor(int index) {
return GetOriginalColor(index, "BC");
}
- void GetOriginalBorderColor(int& iColorType, FX_FLOAT fc[4]) {
+ void GetOriginalBorderColor(int& iColorType, float fc[4]) {
GetOriginalColor(iColorType, fc, "BC");
}
@@ -84,11 +84,11 @@ class CPDF_FormControl {
return GetColor(iColorType, "BG");
}
- FX_FLOAT GetOriginalBackgroundColor(int index) {
+ float GetOriginalBackgroundColor(int index) {
return GetOriginalColor(index, "BG");
}
- void GetOriginalBackgroundColor(int& iColorType, FX_FLOAT fc[4]) {
+ void GetOriginalBackgroundColor(int& iColorType, float fc[4]) {
GetOriginalColor(iColorType, fc, "BG");
}
@@ -117,9 +117,9 @@ class CPDF_FormControl {
void SetOnStateName(const CFX_ByteString& csOn);
void CheckControl(bool bChecked);
FX_ARGB GetColor(int& iColorType, const CFX_ByteString& csEntry);
- FX_FLOAT GetOriginalColor(int index, const CFX_ByteString& csEntry);
+ float GetOriginalColor(int index, const CFX_ByteString& csEntry);
void GetOriginalColor(int& iColorType,
- FX_FLOAT fc[4],
+ float fc[4],
const CFX_ByteString& csEntry);
CFX_WideString GetCaption(const CFX_ByteString& csEntry);
diff --git a/chromium/third_party/pdfium/core/fpdfdoc/cpdf_formfield.cpp b/chromium/third_party/pdfium/core/fpdfdoc/cpdf_formfield.cpp
index b4aa90e2beb..e7ca7c6a8d3 100644
--- a/chromium/third_party/pdfium/core/fpdfdoc/cpdf_formfield.cpp
+++ b/chromium/third_party/pdfium/core/fpdfdoc/cpdf_formfield.cpp
@@ -48,7 +48,7 @@ bool IsUnison(CPDF_FormField* pField) {
} // namespace
CPDF_Object* FPDF_GetFieldAttr(CPDF_Dictionary* pFieldDict,
- const FX_CHAR* name,
+ const char* name,
int nLevel) {
if (nLevel > kMaxRecursion)
return nullptr;
@@ -407,7 +407,7 @@ int CPDF_FormField::GetMaxLen() const {
if (CPDF_Object* pObj = FPDF_GetFieldAttr(m_pDict, "MaxLen"))
return pObj->GetInteger();
- for (const auto& pControl : m_ControlList) {
+ for (auto* pControl : m_ControlList) {
if (!pControl)
continue;
CPDF_Dictionary* pWidgetDict = pControl->m_pWidgetDict;
@@ -566,7 +566,7 @@ bool CPDF_FormField::SetItemSelection(int index, bool bSelected, bool bNotify) {
if (pValue->GetUnicodeText() == opt_value)
m_pDict->RemoveFor("V");
} else if (pValue->IsArray()) {
- std::unique_ptr<CPDF_Array> pArray(new CPDF_Array);
+ auto pArray = pdfium::MakeUnique<CPDF_Array>();
for (int i = 0; i < CountOptions(); i++) {
if (i != index && IsItemSelected(i)) {
opt_value = GetOptionValue(i);
diff --git a/chromium/third_party/pdfium/core/fpdfdoc/cpdf_formfield.h b/chromium/third_party/pdfium/core/fpdfdoc/cpdf_formfield.h
index 42608b1122d..951d31c7926 100644
--- a/chromium/third_party/pdfium/core/fpdfdoc/cpdf_formfield.h
+++ b/chromium/third_party/pdfium/core/fpdfdoc/cpdf_formfield.h
@@ -36,7 +36,7 @@ class CPDF_InterForm;
class CPDF_String;
CPDF_Object* FPDF_GetFieldAttr(CPDF_Dictionary* pFieldDict,
- const FX_CHAR* name,
+ const char* name,
int nLevel = 0);
CFX_WideString FPDF_GetFullName(CPDF_Dictionary* pFieldDict);
@@ -55,6 +55,9 @@ class CPDF_FormField {
Sign
};
+ CPDF_FormField(CPDF_InterForm* pForm, CPDF_Dictionary* pDict);
+ ~CPDF_FormField();
+
CFX_WideString GetFullName() const;
Type GetType() const { return m_Type; }
@@ -125,16 +128,13 @@ class CPDF_FormField {
bool bNotify = false);
#endif // PDF_ENABLE_XFA
- FX_FLOAT GetFontSize() const { return m_FontSize; }
+ float GetFontSize() const { return m_FontSize; }
CPDF_Font* GetFont() const { return m_pFont; }
private:
friend class CPDF_InterForm;
friend class CPDF_FormControl;
- CPDF_FormField(CPDF_InterForm* pForm, CPDF_Dictionary* pDict);
- ~CPDF_FormField();
-
CFX_WideString GetValue(bool bDefault) const;
bool SetValue(const CFX_WideString& value, bool bDefault, bool bNotify);
@@ -160,7 +160,7 @@ class CPDF_FormField {
CPDF_InterForm* const m_pForm;
CPDF_Dictionary* m_pDict;
std::vector<CPDF_FormControl*> m_ControlList; // Owned by InterForm parent.
- FX_FLOAT m_FontSize;
+ float m_FontSize;
CPDF_Font* m_pFont;
};
diff --git a/chromium/third_party/pdfium/core/fpdfdoc/cpdf_iconfit.cpp b/chromium/third_party/pdfium/core/fpdfdoc/cpdf_iconfit.cpp
index aedb7859129..0f05d7de35e 100644
--- a/chromium/third_party/pdfium/core/fpdfdoc/cpdf_iconfit.cpp
+++ b/chromium/third_party/pdfium/core/fpdfdoc/cpdf_iconfit.cpp
@@ -28,7 +28,7 @@ bool CPDF_IconFit::IsProportionalScale() {
return m_pDict ? m_pDict->GetStringFor("S", "P") != "A" : true;
}
-void CPDF_IconFit::GetIconPosition(FX_FLOAT& fLeft, FX_FLOAT& fBottom) {
+void CPDF_IconFit::GetIconPosition(float& fLeft, float& fBottom) {
fLeft = fBottom = 0.5;
if (!m_pDict)
return;
diff --git a/chromium/third_party/pdfium/core/fpdfdoc/cpdf_iconfit.h b/chromium/third_party/pdfium/core/fpdfdoc/cpdf_iconfit.h
index 37df48d43e5..6e3b8cf50a5 100644
--- a/chromium/third_party/pdfium/core/fpdfdoc/cpdf_iconfit.h
+++ b/chromium/third_party/pdfium/core/fpdfdoc/cpdf_iconfit.h
@@ -19,7 +19,7 @@ class CPDF_IconFit {
ScaleMethod GetScaleMethod();
bool IsProportionalScale();
- void GetIconPosition(FX_FLOAT& fLeft, FX_FLOAT& fBottom);
+ void GetIconPosition(float& fLeft, float& fBottom);
bool GetFittingBounds();
const CPDF_Dictionary* GetDict() const { return m_pDict; }
diff --git a/chromium/third_party/pdfium/core/fpdfdoc/cpdf_interform.cpp b/chromium/third_party/pdfium/core/fpdfdoc/cpdf_interform.cpp
index d9f0db97479..ebe5079f3b5 100644
--- a/chromium/third_party/pdfium/core/fpdfdoc/cpdf_interform.cpp
+++ b/chromium/third_party/pdfium/core/fpdfdoc/cpdf_interform.cpp
@@ -29,7 +29,7 @@ namespace {
const int nMaxRecursion = 32;
const struct SupportFieldEncoding {
- const FX_CHAR* m_name;
+ const char* m_name;
uint16_t m_codePage;
} g_fieldEncoding[] = {
{"BigFive", 950},
@@ -55,7 +55,7 @@ CFX_WideString GetFieldValue(const CPDF_Dictionary& pFieldDict,
void AddFont(CPDF_Dictionary*& pFormDict,
CPDF_Document* pDocument,
const CPDF_Font* pFont,
- CFX_ByteString& csNameTag);
+ CFX_ByteString* csNameTag);
void InitDict(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument) {
if (!pDocument)
@@ -70,27 +70,24 @@ void InitDict(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument) {
CFX_ByteString csDA;
if (!pFormDict->KeyExist("DR")) {
CFX_ByteString csBaseName;
- CFX_ByteString csDefault;
uint8_t charSet = CPDF_InterForm::GetNativeCharSet();
CPDF_Font* pFont = CPDF_InterForm::AddStandardFont(pDocument, "Helvetica");
- if (pFont) {
- AddFont(pFormDict, pDocument, pFont, csBaseName);
- csDefault = csBaseName;
- }
+ if (pFont)
+ AddFont(pFormDict, pDocument, pFont, &csBaseName);
+
if (charSet != FXFONT_ANSI_CHARSET) {
CFX_ByteString csFontName =
CPDF_InterForm::GetNativeFont(charSet, nullptr);
if (!pFont || csFontName != "Helvetica") {
pFont = CPDF_InterForm::AddNativeFont(pDocument);
if (pFont) {
- csBaseName = "";
- AddFont(pFormDict, pDocument, pFont, csBaseName);
- csDefault = csBaseName;
+ csBaseName.clear();
+ AddFont(pFormDict, pDocument, pFont, &csBaseName);
}
}
}
if (pFont)
- csDA = "/" + PDF_NameEncode(csDefault) + " 0 Tf";
+ csDA = "/" + PDF_NameEncode(csBaseName) + " 0 Tf";
}
if (!csDA.IsEmpty())
csDA += " ";
@@ -102,7 +99,7 @@ void InitDict(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument) {
CPDF_Font* GetFont(CPDF_Dictionary* pFormDict,
CPDF_Document* pDocument,
- CFX_ByteString csNameTag) {
+ const CFX_ByteString& csNameTag) {
CFX_ByteString csAlias = PDF_NameDecode(csNameTag);
if (!pFormDict || csAlias.IsEmpty())
return nullptr;
@@ -127,7 +124,7 @@ CPDF_Font* GetFont(CPDF_Dictionary* pFormDict,
CPDF_Font* GetNativeFont(CPDF_Dictionary* pFormDict,
CPDF_Document* pDocument,
uint8_t charSet,
- CFX_ByteString& csNameTag) {
+ CFX_ByteString* csNameTag) {
if (!pFormDict)
return nullptr;
@@ -157,8 +154,8 @@ CPDF_Font* GetNativeFont(CPDF_Dictionary* pFormDict,
if (!pSubst)
continue;
- if (pSubst->m_Charset == (int)charSet) {
- csNameTag = csKey;
+ if (pSubst->m_Charset == static_cast<int>(charSet)) {
+ *csNameTag = csKey;
return pFind;
}
}
@@ -167,7 +164,7 @@ CPDF_Font* GetNativeFont(CPDF_Dictionary* pFormDict,
bool FindFont(CPDF_Dictionary* pFormDict,
const CPDF_Font* pFont,
- CFX_ByteString& csNameTag) {
+ CFX_ByteString* csNameTag) {
if (!pFormDict || !pFont)
return false;
@@ -189,7 +186,7 @@ bool FindFont(CPDF_Dictionary* pFormDict,
if (pElement->GetStringFor("Type") != "Font")
continue;
if (pFont->GetFontDict() == pElement) {
- csNameTag = csKey;
+ *csNameTag = csKey;
return true;
}
}
@@ -200,7 +197,7 @@ bool FindFont(CPDF_Dictionary* pFormDict,
CPDF_Document* pDocument,
CFX_ByteString csFontName,
CPDF_Font*& pFont,
- CFX_ByteString& csNameTag) {
+ CFX_ByteString* csNameTag) {
if (!pFormDict)
return false;
@@ -211,6 +208,7 @@ bool FindFont(CPDF_Dictionary* pFormDict,
CPDF_Dictionary* pFonts = pDR->GetDictFor("Font");
if (!pFonts)
return false;
+
if (csFontName.GetLength() > 0)
csFontName.Remove(' ');
@@ -232,7 +230,7 @@ bool FindFont(CPDF_Dictionary* pFormDict,
csBaseFont = pFont->GetBaseFont();
csBaseFont.Remove(' ');
if (csBaseFont == csFontName) {
- csNameTag = csKey;
+ *csNameTag = csKey;
return true;
}
}
@@ -242,15 +240,15 @@ bool FindFont(CPDF_Dictionary* pFormDict,
void AddFont(CPDF_Dictionary*& pFormDict,
CPDF_Document* pDocument,
const CPDF_Font* pFont,
- CFX_ByteString& csNameTag) {
+ CFX_ByteString* csNameTag) {
if (!pFont)
return;
if (!pFormDict)
InitDict(pFormDict, pDocument);
CFX_ByteString csTag;
- if (FindFont(pFormDict, pFont, csTag)) {
- csNameTag = csTag;
+ if (FindFont(pFormDict, pFont, &csTag)) {
+ *csNameTag = csTag;
return;
}
if (!pFormDict)
@@ -264,27 +262,27 @@ void AddFont(CPDF_Dictionary*& pFormDict,
if (!pFonts)
pFonts = pDR->SetNewFor<CPDF_Dictionary>("Font");
- if (csNameTag.IsEmpty())
- csNameTag = pFont->GetBaseFont();
+ if (csNameTag->IsEmpty())
+ *csNameTag = pFont->GetBaseFont();
- csNameTag.Remove(' ');
- csNameTag = CPDF_InterForm::GenerateNewResourceName(pDR, "Font", 4,
- csNameTag.c_str());
- pFonts->SetNewFor<CPDF_Reference>(csNameTag, pDocument,
+ csNameTag->Remove(' ');
+ *csNameTag = CPDF_InterForm::GenerateNewResourceName(pDR, "Font", 4,
+ csNameTag->c_str());
+ pFonts->SetNewFor<CPDF_Reference>(*csNameTag, pDocument,
pFont->GetFontDict()->GetObjNum());
}
CPDF_Font* AddNativeFont(CPDF_Dictionary*& pFormDict,
CPDF_Document* pDocument,
uint8_t charSet,
- CFX_ByteString& csNameTag) {
+ CFX_ByteString* csNameTag) {
if (!pFormDict)
InitDict(pFormDict, pDocument);
CFX_ByteString csTemp;
- CPDF_Font* pFont = GetNativeFont(pFormDict, pDocument, charSet, csTemp);
+ CPDF_Font* pFont = GetNativeFont(pFormDict, pDocument, charSet, &csTemp);
if (pFont) {
- csNameTag = csTemp;
+ *csNameTag = csTemp;
return pFont;
}
CFX_ByteString csFontName = CPDF_InterForm::GetNativeFont(charSet, nullptr);
@@ -307,7 +305,7 @@ class CFieldNameExtractor {
m_pEnd = m_pCur + m_FullName.GetLength();
}
- void GetNext(const FX_WCHAR*& pSubName, FX_STRSIZE& size) {
+ void GetNext(const wchar_t*& pSubName, FX_STRSIZE& size) {
pSubName = m_pCur;
while (m_pCur < m_pEnd && m_pCur[0] != L'.')
m_pCur++;
@@ -319,8 +317,8 @@ class CFieldNameExtractor {
protected:
CFX_WideString m_FullName;
- const FX_WCHAR* m_pCur;
- const FX_WCHAR* m_pEnd;
+ const wchar_t* m_pCur;
+ const wchar_t* m_pEnd;
};
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
@@ -372,8 +370,8 @@ bool RetrieveSpecificFont(uint8_t charSet,
#endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
int CompareFieldName(const CFX_WideString& name1, const CFX_WideString& name2) {
- const FX_WCHAR* ptr1 = name1.c_str();
- const FX_WCHAR* ptr2 = name2.c_str();
+ const wchar_t* ptr1 = name1.c_str();
+ const wchar_t* ptr2 = name2.c_str();
if (name1.GetLength() == name2.GetLength())
return name1 == name2 ? 1 : 0;
@@ -394,16 +392,17 @@ class CFieldTree {
class Node {
public:
Node() : m_pField(nullptr) {}
- Node(const CFX_WideString& short_name, CPDF_FormField* pField)
- : m_ShortName(short_name), m_pField(pField) {}
+ explicit Node(const CFX_WideString& short_name) : m_ShortName(short_name) {}
~Node() {}
- void AddChildNode(Node* pNode) { m_Children.push_back(pNode); }
+ void AddChildNode(std::unique_ptr<Node> pNode) {
+ m_Children.push_back(std::move(pNode));
+ }
size_t GetChildrenCount() const { return m_Children.size(); }
- Node* GetChildAt(size_t i) { return m_Children[i]; }
- const Node* GetChildAt(size_t i) const { return m_Children[i]; }
+ Node* GetChildAt(size_t i) { return m_Children[i].get(); }
+ const Node* GetChildAt(size_t i) const { return m_Children[i].get(); }
CPDF_FormField* GetFieldAtIndex(size_t index) {
size_t nFieldsToGo = index;
@@ -412,10 +411,11 @@ class CFieldTree {
size_t CountFields() const { return CountFieldsInternal(0); }
- void SetField(CPDF_FormField* pField) { m_pField = pField; }
+ void SetField(std::unique_ptr<CPDF_FormField> pField) {
+ m_pField = std::move(pField);
+ }
- CPDF_FormField* GetField() { return m_pField; }
- const CPDF_FormField* GetField() const { return m_pField; }
+ CPDF_FormField* GetField() const { return m_pField.get(); }
const CFX_WideString& GetShortName() const { return m_ShortName; }
@@ -423,7 +423,7 @@ class CFieldTree {
CPDF_FormField* GetFieldInternal(size_t* pFieldsToGo) {
if (m_pField) {
if (*pFieldsToGo == 0)
- return m_pField;
+ return m_pField.get();
--*pFieldsToGo;
}
@@ -448,23 +448,20 @@ class CFieldTree {
return count;
}
- std::vector<Node*> m_Children;
+ std::vector<std::unique_ptr<Node>> m_Children;
CFX_WideString m_ShortName;
- CPDF_FormField* m_pField;
+ std::unique_ptr<CPDF_FormField> m_pField;
};
CFieldTree();
~CFieldTree();
- void SetField(const CFX_WideString& full_name, CPDF_FormField* pField);
+ bool SetField(const CFX_WideString& full_name,
+ std::unique_ptr<CPDF_FormField> pField);
CPDF_FormField* GetField(const CFX_WideString& full_name);
- void RemoveAll();
Node* FindNode(const CFX_WideString& full_name);
- Node* AddChild(Node* pParent,
- const CFX_WideString& short_name,
- CPDF_FormField* pField);
- void RemoveNode(Node* pNode, int nLevel = 0);
+ Node* AddChild(Node* pParent, const CFX_WideString& short_name);
Node* Lookup(Node* pParent, const CFX_WideString& short_name);
@@ -473,30 +470,17 @@ class CFieldTree {
CFieldTree::CFieldTree() {}
-CFieldTree::~CFieldTree() {
- RemoveAll();
-}
+CFieldTree::~CFieldTree() {}
CFieldTree::Node* CFieldTree::AddChild(Node* pParent,
- const CFX_WideString& short_name,
- CPDF_FormField* pField) {
+ const CFX_WideString& short_name) {
if (!pParent)
return nullptr;
- Node* pNode = new Node(short_name, pField);
- pParent->AddChildNode(pNode);
- return pNode;
-}
-
-void CFieldTree::RemoveNode(Node* pNode, int nLevel) {
- if (!pNode)
- return;
-
- if (nLevel <= nMaxRecursion) {
- for (size_t i = 0; i < pNode->GetChildrenCount(); ++i)
- RemoveNode(pNode->GetChildAt(i), nLevel + 1);
- }
- delete pNode;
+ auto pNew = pdfium::MakeUnique<Node>(short_name);
+ Node* pChild = pNew.get();
+ pParent->AddChildNode(std::move(pNew));
+ return pChild;
}
CFieldTree::Node* CFieldTree::Lookup(Node* pParent,
@@ -512,18 +496,13 @@ CFieldTree::Node* CFieldTree::Lookup(Node* pParent,
return nullptr;
}
-void CFieldTree::RemoveAll() {
- for (size_t i = 0; i < m_Root.GetChildrenCount(); ++i)
- RemoveNode(m_Root.GetChildAt(i));
-}
-
-void CFieldTree::SetField(const CFX_WideString& full_name,
- CPDF_FormField* pField) {
+bool CFieldTree::SetField(const CFX_WideString& full_name,
+ std::unique_ptr<CPDF_FormField> pField) {
if (full_name.IsEmpty())
- return;
+ return false;
CFieldNameExtractor name_extractor(full_name);
- const FX_WCHAR* pName;
+ const wchar_t* pName;
FX_STRSIZE nLength;
name_extractor.GetNext(pName, nLength);
Node* pNode = &m_Root;
@@ -533,12 +512,15 @@ void CFieldTree::SetField(const CFX_WideString& full_name,
CFX_WideString name = CFX_WideString(pName, nLength);
pNode = Lookup(pLast, name);
if (!pNode)
- pNode = AddChild(pLast, name, nullptr);
+ pNode = AddChild(pLast, name);
name_extractor.GetNext(pName, nLength);
}
- if (pNode != &m_Root)
- pNode->SetField(pField);
+ if (pNode == &m_Root)
+ return false;
+
+ pNode->SetField(std::move(pField));
+ return true;
}
CPDF_FormField* CFieldTree::GetField(const CFX_WideString& full_name) {
@@ -546,7 +528,7 @@ CPDF_FormField* CFieldTree::GetField(const CFX_WideString& full_name) {
return nullptr;
CFieldNameExtractor name_extractor(full_name);
- const FX_WCHAR* pName;
+ const wchar_t* pName;
FX_STRSIZE nLength;
name_extractor.GetNext(pName, nLength);
Node* pNode = &m_Root;
@@ -565,7 +547,7 @@ CFieldTree::Node* CFieldTree::FindNode(const CFX_WideString& full_name) {
return nullptr;
CFieldNameExtractor name_extractor(full_name);
- const FX_WCHAR* pName;
+ const wchar_t* pName;
FX_STRSIZE nLength;
name_extractor.GetNext(pName, nLength);
Node* pNode = &m_Root;
@@ -581,7 +563,7 @@ CFieldTree::Node* CFieldTree::FindNode(const CFX_WideString& full_name) {
CPDF_Font* AddNativeInterFormFont(CPDF_Dictionary*& pFormDict,
CPDF_Document* pDocument,
- CFX_ByteString& csNameTag) {
+ CFX_ByteString* csNameTag) {
uint8_t charSet = CPDF_InterForm::GetNativeCharSet();
return AddNativeFont(pFormDict, pDocument, charSet, csNameTag);
}
@@ -670,9 +652,6 @@ CPDF_InterForm::CPDF_InterForm(CPDF_Document* pDocument)
CPDF_InterForm::~CPDF_InterForm() {
m_ControlMap.clear();
- size_t nCount = m_pFieldTree->m_Root.CountFields();
- for (size_t i = 0; i < nCount; ++i)
- delete m_pFieldTree->m_Root.GetFieldAtIndex(i);
}
bool CPDF_InterForm::s_bUpdateAP = true;
@@ -687,9 +666,9 @@ void CPDF_InterForm::SetUpdateAP(bool bUpdateAP) {
CFX_ByteString CPDF_InterForm::GenerateNewResourceName(
const CPDF_Dictionary* pResDict,
- const FX_CHAR* csType,
+ const char* csType,
int iMinLen,
- const FX_CHAR* csPrefix) {
+ const char* csPrefix) {
CFX_ByteString csStr = csPrefix;
CFX_ByteString csBType = csType;
if (csStr.IsEmpty()) {
@@ -1075,18 +1054,18 @@ void CPDF_InterForm::FixPageFields(const CPDF_Page* pPage) {
}
}
-CPDF_FormField* CPDF_InterForm::AddTerminalField(CPDF_Dictionary* pFieldDict) {
+void CPDF_InterForm::AddTerminalField(CPDF_Dictionary* pFieldDict) {
if (!pFieldDict->KeyExist("FT")) {
// Key "FT" is required for terminal fields, it is also inheritable.
CPDF_Dictionary* pParentDict = pFieldDict->GetDictFor("Parent");
if (!pParentDict || !pParentDict->KeyExist("FT"))
- return nullptr;
+ return;
}
CPDF_Dictionary* pDict = pFieldDict;
CFX_WideString csWName = FPDF_GetFullName(pFieldDict);
if (csWName.IsEmpty())
- return nullptr;
+ return;
CPDF_FormField* pField = nullptr;
pField = m_pFieldTree->GetField(csWName);
@@ -1113,7 +1092,8 @@ CPDF_FormField* CPDF_InterForm::AddTerminalField(CPDF_Dictionary* pFieldDict) {
}
}
- pField = new CPDF_FormField(this, pParent);
+ auto newField = pdfium::MakeUnique<CPDF_FormField>(this, pParent);
+ pField = newField.get();
CPDF_Object* pTObj = pDict->GetObjectFor("T");
if (ToReference(pTObj)) {
std::unique_ptr<CPDF_Object> pClone = pTObj->CloneDirectObject();
@@ -1122,7 +1102,8 @@ CPDF_FormField* CPDF_InterForm::AddTerminalField(CPDF_Dictionary* pFieldDict) {
else
pDict->SetNewFor<CPDF_Name>("T", "");
}
- m_pFieldTree->SetField(csWName, pField);
+ if (!m_pFieldTree->SetField(csWName, std::move(newField)))
+ return;
}
CPDF_Array* pKids = pFieldDict->GetArrayFor("Kids");
@@ -1140,7 +1121,6 @@ CPDF_FormField* CPDF_InterForm::AddTerminalField(CPDF_Dictionary* pFieldDict) {
if (pFieldDict->GetStringFor("Subtype") == "Widget")
AddControl(pField, pFieldDict);
}
- return pField;
}
CPDF_FormControl* CPDF_InterForm::AddControl(CPDF_FormField* pField,
diff --git a/chromium/third_party/pdfium/core/fpdfdoc/cpdf_interform.h b/chromium/third_party/pdfium/core/fpdfdoc/cpdf_interform.h
index cbaaa7bc2de..74e5b10864a 100644
--- a/chromium/third_party/pdfium/core/fpdfdoc/cpdf_interform.h
+++ b/chromium/third_party/pdfium/core/fpdfdoc/cpdf_interform.h
@@ -29,7 +29,7 @@ class IPDF_FormNotify;
CPDF_Font* AddNativeInterFormFont(CPDF_Dictionary*& pFormDict,
CPDF_Document* pDocument,
- CFX_ByteString& csNameTag);
+ CFX_ByteString* csNameTag);
class CPDF_InterForm {
public:
@@ -39,9 +39,9 @@ class CPDF_InterForm {
static void SetUpdateAP(bool bUpdateAP);
static bool IsUpdateAPEnabled();
static CFX_ByteString GenerateNewResourceName(const CPDF_Dictionary* pResDict,
- const FX_CHAR* csType,
+ const char* csType,
int iMinLen,
- const FX_CHAR* csPrefix);
+ const char* csPrefix);
static CPDF_Font* AddStandardFont(CPDF_Document* pDocument,
CFX_ByteString csFontName);
static CFX_ByteString GetNativeFont(uint8_t iCharSet, void* pLogFont);
@@ -94,7 +94,7 @@ class CPDF_InterForm {
friend class CPDF_FormField;
void LoadField(CPDF_Dictionary* pFieldDict, int nLevel);
- CPDF_FormField* AddTerminalField(CPDF_Dictionary* pFieldDict);
+ void AddTerminalField(CPDF_Dictionary* pFieldDict);
CPDF_FormControl* AddControl(CPDF_FormField* pField,
CPDF_Dictionary* pWidgetDict);
void FDF_ImportField(CPDF_Dictionary* pField,
diff --git a/chromium/third_party/pdfium/core/fpdfdoc/cpdf_metadata.cpp b/chromium/third_party/pdfium/core/fpdfdoc/cpdf_metadata.cpp
index 5e3acbe3a23..5379275544c 100644
--- a/chromium/third_party/pdfium/core/fpdfdoc/cpdf_metadata.cpp
+++ b/chromium/third_party/pdfium/core/fpdfdoc/cpdf_metadata.cpp
@@ -9,7 +9,7 @@
#include "core/fpdfapi/parser/cpdf_document.h"
#include "core/fpdfapi/parser/cpdf_stream.h"
#include "core/fpdfapi/parser/cpdf_stream_acc.h"
-#include "core/fxcrt/fx_xml.h"
+#include "core/fxcrt/xml/cxml_element.h"
CPDF_Metadata::CPDF_Metadata(CPDF_Document* pDoc) {
CPDF_Dictionary* pRoot = pDoc->GetRoot();
@@ -20,9 +20,9 @@ CPDF_Metadata::CPDF_Metadata(CPDF_Document* pDoc) {
if (!pStream)
return;
- CPDF_StreamAcc acc;
- acc.LoadAllData(pStream, false);
- m_pXmlElement = CXML_Element::Parse(acc.GetData(), acc.GetSize());
+ auto pAcc = pdfium::MakeRetain<CPDF_StreamAcc>(pStream);
+ pAcc->LoadAllData(false);
+ m_pXmlElement = CXML_Element::Parse(pAcc->GetData(), pAcc->GetSize());
}
CPDF_Metadata::~CPDF_Metadata() {}
diff --git a/chromium/third_party/pdfium/core/fpdfdoc/cpdf_nametree.cpp b/chromium/third_party/pdfium/core/fpdfdoc/cpdf_nametree.cpp
index b8d1eb0ab14..5ecdb4863b3 100644
--- a/chromium/third_party/pdfium/core/fpdfdoc/cpdf_nametree.cpp
+++ b/chromium/third_party/pdfium/core/fpdfdoc/cpdf_nametree.cpp
@@ -78,7 +78,7 @@ CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode,
CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode,
size_t nIndex,
size_t& nCurIndex,
- CFX_ByteString& csName,
+ CFX_ByteString* csName,
CPDF_Array** ppFind,
int nLevel = 0) {
if (nLevel > nMaxRecursion)
@@ -93,7 +93,7 @@ CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode,
}
if (ppFind)
*ppFind = pNames;
- csName = pNames->GetStringAt((nIndex - nCurIndex) * 2);
+ *csName = pNames->GetStringAt((nIndex - nCurIndex) * 2);
return pNames->GetDirectObjectAt((nIndex - nCurIndex) * 2 + 1);
}
CPDF_Array* pKids = pNode->GetArrayFor("Kids");
@@ -164,10 +164,12 @@ int CPDF_NameTree::GetIndex(const CFX_ByteString& csName) const {
return nIndex;
}
-CPDF_Object* CPDF_NameTree::LookupValue(int nIndex,
- CFX_ByteString& csName) const {
+CPDF_Object* CPDF_NameTree::LookupValueAndName(int nIndex,
+ CFX_ByteString* csName) const {
+ *csName = CFX_ByteString();
if (!m_pRoot)
return nullptr;
+
size_t nCurIndex = 0;
return SearchNameNode(m_pRoot, nIndex, nCurIndex, csName, nullptr);
}
@@ -175,6 +177,7 @@ CPDF_Object* CPDF_NameTree::LookupValue(int nIndex,
CPDF_Object* CPDF_NameTree::LookupValue(const CFX_ByteString& csName) const {
if (!m_pRoot)
return nullptr;
+
size_t nIndex = 0;
return SearchNameNode(m_pRoot, csName, nIndex, nullptr);
}
diff --git a/chromium/third_party/pdfium/core/fpdfdoc/cpdf_nametree.h b/chromium/third_party/pdfium/core/fpdfdoc/cpdf_nametree.h
index d6763ad9872..7a792aef59a 100644
--- a/chromium/third_party/pdfium/core/fpdfdoc/cpdf_nametree.h
+++ b/chromium/third_party/pdfium/core/fpdfdoc/cpdf_nametree.h
@@ -19,7 +19,7 @@ class CPDF_NameTree {
explicit CPDF_NameTree(CPDF_Dictionary* pRoot) : m_pRoot(pRoot) {}
CPDF_NameTree(CPDF_Document* pDoc, const CFX_ByteString& category);
- CPDF_Object* LookupValue(int nIndex, CFX_ByteString& csName) const;
+ CPDF_Object* LookupValueAndName(int nIndex, CFX_ByteString* csName) const;
CPDF_Object* LookupValue(const CFX_ByteString& csName) const;
CPDF_Array* LookupNamedDest(CPDF_Document* pDoc, const CFX_ByteString& sName);
diff --git a/chromium/third_party/pdfium/core/fpdfdoc/cpdf_pagelabel.cpp b/chromium/third_party/pdfium/core/fpdfdoc/cpdf_pagelabel.cpp
index 2a79d77ca7e..4200a28f641 100644
--- a/chromium/third_party/pdfium/core/fpdfdoc/cpdf_pagelabel.cpp
+++ b/chromium/third_party/pdfium/core/fpdfdoc/cpdf_pagelabel.cpp
@@ -44,7 +44,7 @@ CFX_WideString MakeLetters(int num) {
int count = num / nLetterCount + 1;
count %= nMaxCount;
- FX_WCHAR ch = L'a' + num % nLetterCount;
+ wchar_t ch = L'a' + num % nLetterCount;
for (int i = 0; i < count; i++)
wsLetters += ch;
return wsLetters;
diff --git a/chromium/third_party/pdfium/core/fpdfdoc/cpdf_structelement.cpp b/chromium/third_party/pdfium/core/fpdfdoc/cpdf_structelement.cpp
new file mode 100644
index 00000000000..c85ae0dd424
--- /dev/null
+++ b/chromium/third_party/pdfium/core/fpdfdoc/cpdf_structelement.cpp
@@ -0,0 +1,137 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "core/fpdfdoc/cpdf_structelement.h"
+
+#include "core/fpdfapi/parser/cpdf_array.h"
+#include "core/fpdfapi/parser/cpdf_dictionary.h"
+#include "core/fpdfapi/parser/cpdf_name.h"
+#include "core/fpdfapi/parser/cpdf_number.h"
+#include "core/fpdfapi/parser/cpdf_object.h"
+#include "core/fpdfapi/parser/cpdf_reference.h"
+#include "core/fpdfapi/parser/cpdf_stream.h"
+#include "core/fpdfdoc/cpdf_structtree.h"
+#include "third_party/base/stl_util.h"
+
+CPDF_StructKid::CPDF_StructKid()
+ : m_Type(Invalid),
+ m_pDict(nullptr),
+ m_PageObjNum(0),
+ m_RefObjNum(0),
+ m_ContentId(0) {}
+
+CPDF_StructKid::CPDF_StructKid(const CPDF_StructKid& that) = default;
+
+CPDF_StructKid::~CPDF_StructKid() = default;
+
+CPDF_StructElement::CPDF_StructElement(CPDF_StructTree* pTree,
+ CPDF_StructElement* pParent,
+ CPDF_Dictionary* pDict)
+ : m_pTree(pTree),
+ m_pParent(pParent),
+ m_pDict(pDict),
+ m_Type(pDict->GetStringFor("S")),
+ m_Title(pDict->GetStringFor("T")) {
+ if (pTree->GetRoleMap()) {
+ CFX_ByteString mapped = pTree->GetRoleMap()->GetStringFor(m_Type);
+ if (!mapped.IsEmpty())
+ m_Type = mapped;
+ }
+ LoadKids(pDict);
+}
+
+CPDF_StructElement::~CPDF_StructElement() = default;
+
+int CPDF_StructElement::CountKids() const {
+ return pdfium::CollectionSize<int>(m_Kids);
+}
+
+CPDF_StructElement* CPDF_StructElement::GetKidIfElement(int index) const {
+ return m_Kids[index].m_Type == CPDF_StructKid::Element
+ ? m_Kids[index].m_pElement.Get()
+ : nullptr;
+}
+
+void CPDF_StructElement::LoadKids(CPDF_Dictionary* pDict) {
+ CPDF_Object* pObj = pDict->GetObjectFor("Pg");
+ uint32_t PageObjNum = 0;
+ if (CPDF_Reference* pRef = ToReference(pObj))
+ PageObjNum = pRef->GetRefObjNum();
+
+ CPDF_Object* pKids = pDict->GetDirectObjectFor("K");
+ if (!pKids)
+ return;
+
+ m_Kids.clear();
+ if (CPDF_Array* pArray = pKids->AsArray()) {
+ m_Kids.resize(pArray->GetCount());
+ for (uint32_t i = 0; i < pArray->GetCount(); i++) {
+ CPDF_Object* pKid = pArray->GetDirectObjectAt(i);
+ LoadKid(PageObjNum, pKid, &m_Kids[i]);
+ }
+ return;
+ }
+
+ m_Kids.resize(1);
+ LoadKid(PageObjNum, pKids, &m_Kids[0]);
+}
+
+void CPDF_StructElement::LoadKid(uint32_t PageObjNum,
+ CPDF_Object* pKidObj,
+ CPDF_StructKid* pKid) {
+ pKid->m_Type = CPDF_StructKid::Invalid;
+ if (!pKidObj)
+ return;
+
+ if (pKidObj->IsNumber()) {
+ if (m_pTree->GetPage() && m_pTree->GetPage()->GetObjNum() != PageObjNum)
+ return;
+
+ pKid->m_Type = CPDF_StructKid::PageContent;
+ pKid->m_ContentId = pKidObj->GetInteger();
+ pKid->m_PageObjNum = PageObjNum;
+ return;
+ }
+
+ CPDF_Dictionary* pKidDict = pKidObj->AsDictionary();
+ if (!pKidDict)
+ return;
+ if (CPDF_Reference* pRef = ToReference(pKidDict->GetObjectFor("Pg")))
+ PageObjNum = pRef->GetRefObjNum();
+
+ CFX_ByteString type = pKidDict->GetStringFor("Type");
+ if ((type == "MCR" || type == "OBJR") && m_pTree->GetPage() &&
+ m_pTree->GetPage()->GetObjNum() != PageObjNum) {
+ return;
+ }
+
+ if (type == "MCR") {
+ pKid->m_Type = CPDF_StructKid::StreamContent;
+ CPDF_Reference* pRef = ToReference(pKidDict->GetObjectFor("Stm"));
+ pKid->m_RefObjNum = pRef ? pRef->GetRefObjNum() : 0;
+ pKid->m_PageObjNum = PageObjNum;
+ pKid->m_ContentId = pKidDict->GetIntegerFor("MCID");
+ return;
+ }
+
+ if (type == "OBJR") {
+ pKid->m_Type = CPDF_StructKid::Object;
+ CPDF_Reference* pObj = ToReference(pKidDict->GetObjectFor("Obj"));
+ pKid->m_RefObjNum = pObj ? pObj->GetRefObjNum() : 0;
+ pKid->m_PageObjNum = PageObjNum;
+ return;
+ }
+
+ pKid->m_Type = CPDF_StructKid::Element;
+ pKid->m_pDict = pKidDict;
+ if (m_pTree->GetPage()) {
+ pKid->m_pElement = nullptr;
+ return;
+ }
+
+ pKid->m_pElement =
+ pdfium::MakeRetain<CPDF_StructElement>(m_pTree, this, pKidDict);
+}
diff --git a/chromium/third_party/pdfium/core/fpdfdoc/cpdf_structelement.h b/chromium/third_party/pdfium/core/fpdfdoc/cpdf_structelement.h
new file mode 100644
index 00000000000..c65363db536
--- /dev/null
+++ b/chromium/third_party/pdfium/core/fpdfdoc/cpdf_structelement.h
@@ -0,0 +1,66 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef CORE_FPDFDOC_CPDF_STRUCTELEMENT_H_
+#define CORE_FPDFDOC_CPDF_STRUCTELEMENT_H_
+
+#include <vector>
+
+#include "core/fxcrt/cfx_retain_ptr.h"
+#include "core/fxcrt/fx_string.h"
+#include "core/fxge/fx_dib.h"
+
+class CPDF_Dictionary;
+class CPDF_Object;
+class CPDF_StructElement;
+class CPDF_StructTree;
+
+class CPDF_StructKid {
+ public:
+ CPDF_StructKid();
+ CPDF_StructKid(const CPDF_StructKid& that);
+ ~CPDF_StructKid();
+
+ enum { Invalid, Element, PageContent, StreamContent, Object } m_Type;
+
+ CFX_RetainPtr<CPDF_StructElement> m_pElement; // For Element.
+ CPDF_Dictionary* m_pDict; // For Element.
+ uint32_t m_PageObjNum; // For PageContent, StreamContent, Object.
+ uint32_t m_RefObjNum; // For StreamContent, Object.
+ uint32_t m_ContentId; // For PageContent, StreamContent.
+};
+
+class CPDF_StructElement : public CFX_Retainable {
+ public:
+ template <typename T, typename... Args>
+ friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args);
+
+ const CFX_ByteString& GetType() const { return m_Type; }
+ const CFX_ByteString& GetTitle() const { return m_Title; }
+ CPDF_Dictionary* GetDict() const { return m_pDict; }
+
+ int CountKids() const;
+ CPDF_StructElement* GetKidIfElement(int index) const;
+ std::vector<CPDF_StructKid>* GetKids() { return &m_Kids; }
+
+ private:
+ CPDF_StructElement(CPDF_StructTree* pTree,
+ CPDF_StructElement* pParent,
+ CPDF_Dictionary* pDict);
+ ~CPDF_StructElement() override;
+
+ void LoadKids(CPDF_Dictionary* pDict);
+ void LoadKid(uint32_t PageObjNum, CPDF_Object* pObj, CPDF_StructKid* pKid);
+
+ CPDF_StructTree* const m_pTree;
+ CPDF_StructElement* const m_pParent;
+ CPDF_Dictionary* const m_pDict;
+ CFX_ByteString m_Type;
+ CFX_ByteString m_Title;
+ std::vector<CPDF_StructKid> m_Kids;
+};
+
+#endif // CORE_FPDFDOC_CPDF_STRUCTELEMENT_H_
diff --git a/chromium/third_party/pdfium/core/fpdfdoc/cpdf_structtree.cpp b/chromium/third_party/pdfium/core/fpdfdoc/cpdf_structtree.cpp
new file mode 100644
index 00000000000..62500ac1557
--- /dev/null
+++ b/chromium/third_party/pdfium/core/fpdfdoc/cpdf_structtree.cpp
@@ -0,0 +1,155 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "core/fpdfdoc/cpdf_structtree.h"
+
+#include "core/fpdfapi/parser/cpdf_array.h"
+#include "core/fpdfapi/parser/cpdf_document.h"
+#include "core/fpdfapi/parser/cpdf_number.h"
+#include "core/fpdfapi/parser/cpdf_reference.h"
+#include "core/fpdfdoc/cpdf_numbertree.h"
+#include "core/fpdfdoc/cpdf_structelement.h"
+#include "third_party/base/stl_util.h"
+
+namespace {
+
+const int nMaxRecursion = 32;
+
+bool IsTagged(const CPDF_Document* pDoc) {
+ CPDF_Dictionary* pCatalog = pDoc->GetRoot();
+ CPDF_Dictionary* pMarkInfo = pCatalog->GetDictFor("MarkInfo");
+ return pMarkInfo && pMarkInfo->GetIntegerFor("Marked");
+}
+
+} // namespace
+
+// static
+std::unique_ptr<CPDF_StructTree> CPDF_StructTree::LoadPage(
+ const CPDF_Document* pDoc,
+ const CPDF_Dictionary* pPageDict) {
+ if (!IsTagged(pDoc))
+ return nullptr;
+
+ auto pTree = pdfium::MakeUnique<CPDF_StructTree>(pDoc);
+ pTree->LoadPageTree(pPageDict);
+ return pTree;
+}
+
+CPDF_StructTree::CPDF_StructTree(const CPDF_Document* pDoc)
+ : m_pTreeRoot(pDoc->GetRoot()->GetDictFor("StructTreeRoot")),
+ m_pRoleMap(m_pTreeRoot ? m_pTreeRoot->GetDictFor("RoleMap") : nullptr),
+ m_pPage(nullptr) {}
+
+CPDF_StructTree::~CPDF_StructTree() {}
+
+int CPDF_StructTree::CountTopElements() const {
+ return pdfium::CollectionSize<int>(m_Kids);
+}
+
+CPDF_StructElement* CPDF_StructTree::GetTopElement(int i) const {
+ return m_Kids[i].Get();
+}
+
+void CPDF_StructTree::LoadPageTree(const CPDF_Dictionary* pPageDict) {
+ m_pPage = pPageDict;
+ if (!m_pTreeRoot)
+ return;
+
+ CPDF_Object* pKids = m_pTreeRoot->GetDirectObjectFor("K");
+ if (!pKids)
+ return;
+
+ uint32_t dwKids = 0;
+ if (pKids->IsDictionary())
+ dwKids = 1;
+ else if (CPDF_Array* pArray = pKids->AsArray())
+ dwKids = pArray->GetCount();
+ else
+ return;
+
+ m_Kids.clear();
+ m_Kids.resize(dwKids);
+ CPDF_Dictionary* pParentTree = m_pTreeRoot->GetDictFor("ParentTree");
+ if (!pParentTree)
+ return;
+
+ CPDF_NumberTree parent_tree(pParentTree);
+ int parents_id = pPageDict->GetIntegerFor("StructParents", -1);
+ if (parents_id < 0)
+ return;
+
+ CPDF_Array* pParentArray = ToArray(parent_tree.LookupValue(parents_id));
+ if (!pParentArray)
+ return;
+
+ std::map<CPDF_Dictionary*, CFX_RetainPtr<CPDF_StructElement>> element_map;
+ for (size_t i = 0; i < pParentArray->GetCount(); i++) {
+ if (CPDF_Dictionary* pParent = pParentArray->GetDictAt(i))
+ AddPageNode(pParent, &element_map, 0);
+ }
+}
+
+CFX_RetainPtr<CPDF_StructElement> CPDF_StructTree::AddPageNode(
+ CPDF_Dictionary* pDict,
+ std::map<CPDF_Dictionary*, CFX_RetainPtr<CPDF_StructElement>>* map,
+ int nLevel) {
+ if (nLevel > nMaxRecursion)
+ return nullptr;
+
+ auto it = map->find(pDict);
+ if (it != map->end())
+ return it->second;
+
+ auto pElement = pdfium::MakeRetain<CPDF_StructElement>(this, nullptr, pDict);
+ (*map)[pDict] = pElement;
+ CPDF_Dictionary* pParent = pDict->GetDictFor("P");
+ if (!pParent || pParent->GetStringFor("Type") == "StructTreeRoot") {
+ if (!AddTopLevelNode(pDict, pElement))
+ map->erase(pDict);
+ return pElement;
+ }
+
+ CFX_RetainPtr<CPDF_StructElement> pParentElement =
+ AddPageNode(pParent, map, nLevel + 1);
+ bool bSave = false;
+ for (CPDF_StructKid& kid : *pParentElement->GetKids()) {
+ if (kid.m_Type == CPDF_StructKid::Element && kid.m_pDict == pDict) {
+ kid.m_pElement = pElement;
+ bSave = true;
+ }
+ }
+ if (!bSave)
+ map->erase(pDict);
+ return pElement;
+}
+
+bool CPDF_StructTree::AddTopLevelNode(
+ CPDF_Dictionary* pDict,
+ const CFX_RetainPtr<CPDF_StructElement>& pElement) {
+ CPDF_Object* pObj = m_pTreeRoot->GetDirectObjectFor("K");
+ if (!pObj)
+ return false;
+
+ if (pObj->IsDictionary()) {
+ if (pObj->GetObjNum() != pDict->GetObjNum())
+ return false;
+ m_Kids[0] = pElement;
+ }
+
+ CPDF_Array* pTopKids = pObj->AsArray();
+ if (!pTopKids)
+ return true;
+
+ bool bSave = false;
+ for (size_t i = 0; i < pTopKids->GetCount(); i++) {
+ CPDF_Reference* pKidRef = ToReference(pTopKids->GetObjectAt(i));
+ if (pKidRef && pKidRef->GetRefObjNum() == pDict->GetObjNum()) {
+ m_Kids[i] = pElement;
+ bSave = true;
+ }
+ }
+ return bSave;
+}
diff --git a/chromium/third_party/pdfium/core/fpdfdoc/cpdf_structtree.h b/chromium/third_party/pdfium/core/fpdfdoc/cpdf_structtree.h
new file mode 100644
index 00000000000..aa30f802db0
--- /dev/null
+++ b/chromium/third_party/pdfium/core/fpdfdoc/cpdf_structtree.h
@@ -0,0 +1,50 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef CORE_FPDFDOC_CPDF_STRUCTTREE_H_
+#define CORE_FPDFDOC_CPDF_STRUCTTREE_H_
+
+#include <map>
+#include <memory>
+#include <vector>
+
+#include "core/fxcrt/cfx_retain_ptr.h"
+
+class CPDF_Dictionary;
+class CPDF_Document;
+class CPDF_StructElement;
+
+class CPDF_StructTree {
+ public:
+ static std::unique_ptr<CPDF_StructTree> LoadPage(
+ const CPDF_Document* pDoc,
+ const CPDF_Dictionary* pPageDict);
+
+ explicit CPDF_StructTree(const CPDF_Document* pDoc);
+ ~CPDF_StructTree();
+
+ int CountTopElements() const;
+ CPDF_StructElement* GetTopElement(int i) const;
+ const CPDF_Dictionary* GetRoleMap() const { return m_pRoleMap; }
+ const CPDF_Dictionary* GetPage() const { return m_pPage; }
+ const CPDF_Dictionary* GetTreeRoot() const { return m_pTreeRoot; }
+
+ private:
+ void LoadPageTree(const CPDF_Dictionary* pPageDict);
+ CFX_RetainPtr<CPDF_StructElement> AddPageNode(
+ CPDF_Dictionary* pElement,
+ std::map<CPDF_Dictionary*, CFX_RetainPtr<CPDF_StructElement>>* map,
+ int nLevel);
+ bool AddTopLevelNode(CPDF_Dictionary* pDict,
+ const CFX_RetainPtr<CPDF_StructElement>& pElement);
+
+ const CPDF_Dictionary* const m_pTreeRoot;
+ const CPDF_Dictionary* const m_pRoleMap;
+ const CPDF_Dictionary* m_pPage;
+ std::vector<CFX_RetainPtr<CPDF_StructElement>> m_Kids;
+};
+
+#endif // CORE_FPDFDOC_CPDF_STRUCTTREE_H_
diff --git a/chromium/third_party/pdfium/core/fpdfdoc/cpdf_variabletext.cpp b/chromium/third_party/pdfium/core/fpdfdoc/cpdf_variabletext.cpp
index 94b3425a097..ab5c5e8050f 100644
--- a/chromium/third_party/pdfium/core/fpdfdoc/cpdf_variabletext.cpp
+++ b/chromium/third_party/pdfium/core/fpdfdoc/cpdf_variabletext.cpp
@@ -7,6 +7,7 @@
#include "core/fpdfdoc/cpdf_variabletext.h"
#include <algorithm>
+#include <utility>
#include "core/fpdfapi/font/cpdf_font.h"
#include "core/fpdfdoc/cline.h"
@@ -16,6 +17,7 @@
#include "core/fpdfdoc/csection.h"
#include "core/fpdfdoc/ipvt_fontmap.h"
#include "third_party/base/ptr_util.h"
+#include "third_party/base/stl_util.h"
namespace {
@@ -112,41 +114,44 @@ bool CPDF_VariableText::Iterator::PrevWord() {
}
bool CPDF_VariableText::Iterator::NextLine() {
- if (CSection* pSection = m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex)) {
- if (m_CurPos.nLineIndex < pSection->m_LineArray.GetSize() - 1) {
- m_CurPos =
- CPVT_WordPlace(m_CurPos.nSecIndex, m_CurPos.nLineIndex + 1, -1);
- return true;
- }
- if (m_CurPos.nSecIndex < m_pVT->m_SectionArray.GetSize() - 1) {
- m_CurPos = CPVT_WordPlace(m_CurPos.nSecIndex + 1, 0, -1);
- return true;
- }
+ if (!pdfium::IndexInBounds(m_pVT->m_SectionArray, m_CurPos.nSecIndex))
+ return false;
+
+ CSection* pSection = m_pVT->m_SectionArray[m_CurPos.nSecIndex].get();
+ if (m_CurPos.nLineIndex <
+ pdfium::CollectionSize<int32_t>(pSection->m_LineArray) - 1) {
+ m_CurPos = CPVT_WordPlace(m_CurPos.nSecIndex, m_CurPos.nLineIndex + 1, -1);
+ return true;
+ }
+ if (m_CurPos.nSecIndex <
+ pdfium::CollectionSize<int32_t>(m_pVT->m_SectionArray) - 1) {
+ m_CurPos = CPVT_WordPlace(m_CurPos.nSecIndex + 1, 0, -1);
+ return true;
}
return false;
}
bool CPDF_VariableText::Iterator::PrevLine() {
- if (m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex)) {
- if (m_CurPos.nLineIndex > 0) {
- m_CurPos =
- CPVT_WordPlace(m_CurPos.nSecIndex, m_CurPos.nLineIndex - 1, -1);
- return true;
- }
- if (m_CurPos.nSecIndex > 0) {
- if (CSection* pLastSection =
- m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex - 1)) {
- m_CurPos = CPVT_WordPlace(m_CurPos.nSecIndex - 1,
- pLastSection->m_LineArray.GetSize() - 1, -1);
- return true;
- }
- }
+ if (!pdfium::IndexInBounds(m_pVT->m_SectionArray, m_CurPos.nSecIndex))
+ return false;
+
+ if (m_CurPos.nLineIndex > 0) {
+ m_CurPos = CPVT_WordPlace(m_CurPos.nSecIndex, m_CurPos.nLineIndex - 1, -1);
+ return true;
}
- return false;
+ if (!pdfium::IndexInBounds(m_pVT->m_SectionArray, m_CurPos.nSecIndex - 1))
+ return false;
+
+ CSection* pLastSection = m_pVT->m_SectionArray[m_CurPos.nSecIndex - 1].get();
+ m_CurPos = CPVT_WordPlace(
+ m_CurPos.nSecIndex - 1,
+ pdfium::CollectionSize<int32_t>(pLastSection->m_LineArray) - 1, -1);
+ return true;
}
bool CPDF_VariableText::Iterator::NextSection() {
- if (m_CurPos.nSecIndex < m_pVT->m_SectionArray.GetSize() - 1) {
+ if (m_CurPos.nSecIndex <
+ pdfium::CollectionSize<int32_t>(m_pVT->m_SectionArray) - 1) {
m_CurPos = CPVT_WordPlace(m_CurPos.nSecIndex + 1, 0, -1);
return true;
}
@@ -164,82 +169,90 @@ bool CPDF_VariableText::Iterator::PrevSection() {
bool CPDF_VariableText::Iterator::GetWord(CPVT_Word& word) const {
word.WordPlace = m_CurPos;
- if (CSection* pSection = m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex)) {
- if (pSection->m_LineArray.GetAt(m_CurPos.nLineIndex)) {
- if (CPVT_WordInfo* pWord =
- pSection->m_WordArray.GetAt(m_CurPos.nWordIndex)) {
- word.Word = pWord->Word;
- word.nCharset = pWord->nCharset;
- word.fWidth = m_pVT->GetWordWidth(*pWord);
- word.ptWord = m_pVT->InToOut(
- CFX_PointF(pWord->fWordX + pSection->m_SecInfo.rcSection.left,
- pWord->fWordY + pSection->m_SecInfo.rcSection.top));
- word.fAscent = m_pVT->GetWordAscent(*pWord);
- word.fDescent = m_pVT->GetWordDescent(*pWord);
- if (pWord->pWordProps)
- word.WordProps = *pWord->pWordProps;
-
- word.nFontIndex = m_pVT->GetWordFontIndex(*pWord);
- word.fFontSize = m_pVT->GetWordFontSize(*pWord);
- return true;
- }
- }
+ if (!pdfium::IndexInBounds(m_pVT->m_SectionArray, m_CurPos.nSecIndex))
+ return false;
+
+ CSection* pSection = m_pVT->m_SectionArray[m_CurPos.nSecIndex].get();
+ if (!pdfium::IndexInBounds(pSection->m_LineArray, m_CurPos.nLineIndex) ||
+ !pdfium::IndexInBounds(pSection->m_WordArray, m_CurPos.nWordIndex)) {
+ return false;
}
- return false;
+
+ CPVT_WordInfo* pWord = pSection->m_WordArray[m_CurPos.nWordIndex].get();
+ word.Word = pWord->Word;
+ word.nCharset = pWord->nCharset;
+ word.fWidth = m_pVT->GetWordWidth(*pWord);
+ word.ptWord = m_pVT->InToOut(
+ CFX_PointF(pWord->fWordX + pSection->m_SecInfo.rcSection.left,
+ pWord->fWordY + pSection->m_SecInfo.rcSection.top));
+ word.fAscent = m_pVT->GetWordAscent(*pWord);
+ word.fDescent = m_pVT->GetWordDescent(*pWord);
+ if (pWord->pWordProps)
+ word.WordProps = *pWord->pWordProps;
+ word.nFontIndex = m_pVT->GetWordFontIndex(*pWord);
+ word.fFontSize = m_pVT->GetWordFontSize(*pWord);
+ return true;
}
bool CPDF_VariableText::Iterator::SetWord(const CPVT_Word& word) {
- if (CSection* pSection = m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex)) {
- if (CPVT_WordInfo* pWord =
- pSection->m_WordArray.GetAt(m_CurPos.nWordIndex)) {
- if (pWord->pWordProps)
- *pWord->pWordProps = word.WordProps;
- return true;
- }
- }
- return false;
+ if (!pdfium::IndexInBounds(m_pVT->m_SectionArray, m_CurPos.nSecIndex))
+ return false;
+
+ CSection* pSection = m_pVT->m_SectionArray[m_CurPos.nSecIndex].get();
+ if (!pdfium::IndexInBounds(pSection->m_WordArray, m_CurPos.nWordIndex))
+ return false;
+
+ CPVT_WordInfo* pWord = pSection->m_WordArray[m_CurPos.nWordIndex].get();
+ if (pWord->pWordProps)
+ *pWord->pWordProps = word.WordProps;
+ return true;
}
bool CPDF_VariableText::Iterator::GetLine(CPVT_Line& line) const {
ASSERT(m_pVT);
line.lineplace = CPVT_WordPlace(m_CurPos.nSecIndex, m_CurPos.nLineIndex, -1);
- if (CSection* pSection = m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex)) {
- if (CLine* pLine = pSection->m_LineArray.GetAt(m_CurPos.nLineIndex)) {
- line.ptLine = m_pVT->InToOut(CFX_PointF(
- pLine->m_LineInfo.fLineX + pSection->m_SecInfo.rcSection.left,
- pLine->m_LineInfo.fLineY + pSection->m_SecInfo.rcSection.top));
- line.fLineWidth = pLine->m_LineInfo.fLineWidth;
- line.fLineAscent = pLine->m_LineInfo.fLineAscent;
- line.fLineDescent = pLine->m_LineInfo.fLineDescent;
- line.lineEnd = pLine->GetEndWordPlace();
- return true;
- }
- }
- return false;
+ if (!pdfium::IndexInBounds(m_pVT->m_SectionArray, m_CurPos.nSecIndex))
+ return false;
+
+ CSection* pSection = m_pVT->m_SectionArray[m_CurPos.nSecIndex].get();
+ if (!pdfium::IndexInBounds(pSection->m_LineArray, m_CurPos.nLineIndex))
+ return false;
+
+ CLine* pLine = pSection->m_LineArray[m_CurPos.nLineIndex].get();
+ line.ptLine = m_pVT->InToOut(
+ CFX_PointF(pLine->m_LineInfo.fLineX + pSection->m_SecInfo.rcSection.left,
+ pLine->m_LineInfo.fLineY + pSection->m_SecInfo.rcSection.top));
+ line.fLineWidth = pLine->m_LineInfo.fLineWidth;
+ line.fLineAscent = pLine->m_LineInfo.fLineAscent;
+ line.fLineDescent = pLine->m_LineInfo.fLineDescent;
+ line.lineEnd = pLine->GetEndWordPlace();
+ return true;
}
bool CPDF_VariableText::Iterator::GetSection(CPVT_Section& section) const {
section.secplace = CPVT_WordPlace(m_CurPos.nSecIndex, 0, -1);
- if (CSection* pSection = m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex)) {
- section.rcSection = m_pVT->InToOut(pSection->m_SecInfo.rcSection);
- if (pSection->m_SecInfo.pSecProps)
- section.SecProps = *pSection->m_SecInfo.pSecProps;
- if (pSection->m_SecInfo.pWordProps)
- section.WordProps = *pSection->m_SecInfo.pWordProps;
- return true;
- }
- return false;
+ if (!pdfium::IndexInBounds(m_pVT->m_SectionArray, m_CurPos.nSecIndex))
+ return false;
+
+ CSection* pSection = m_pVT->m_SectionArray[m_CurPos.nSecIndex].get();
+ section.rcSection = m_pVT->InToOut(pSection->m_SecInfo.rcSection);
+ if (pSection->m_SecInfo.pSecProps)
+ section.SecProps = *pSection->m_SecInfo.pSecProps;
+ if (pSection->m_SecInfo.pWordProps)
+ section.WordProps = *pSection->m_SecInfo.pWordProps;
+ return true;
}
bool CPDF_VariableText::Iterator::SetSection(const CPVT_Section& section) {
- if (CSection* pSection = m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex)) {
- if (pSection->m_SecInfo.pSecProps)
- *pSection->m_SecInfo.pSecProps = section.SecProps;
- if (pSection->m_SecInfo.pWordProps)
- *pSection->m_SecInfo.pWordProps = section.WordProps;
- return true;
- }
- return false;
+ if (!pdfium::IndexInBounds(m_pVT->m_SectionArray, m_CurPos.nSecIndex))
+ return false;
+
+ CSection* pSection = m_pVT->m_SectionArray[m_CurPos.nSecIndex].get();
+ if (pSection->m_SecInfo.pSecProps)
+ *pSection->m_SecInfo.pSecProps = section.SecProps;
+ if (pSection->m_SecInfo.pWordProps)
+ *pSection->m_SecInfo.pWordProps = section.WordProps;
+ return true;
}
CPDF_VariableText::CPDF_VariableText()
@@ -254,7 +267,7 @@ CPDF_VariableText::CPDF_VariableText()
m_nHorzScale(100),
m_wSubWord(0),
m_fFontSize(0.0f),
- m_bInitial(false),
+ m_bInitialized(false),
m_pVTProvider(nullptr) {}
CPDF_VariableText::~CPDF_VariableText() {
@@ -262,36 +275,38 @@ CPDF_VariableText::~CPDF_VariableText() {
}
void CPDF_VariableText::Initialize() {
- if (!m_bInitial) {
- CPVT_SectionInfo secinfo;
- CPVT_WordPlace place;
- place.nSecIndex = 0;
- AddSection(place, secinfo);
- CPVT_LineInfo lineinfo;
- lineinfo.fLineAscent = GetFontAscent(GetDefaultFontIndex(), GetFontSize());
- lineinfo.fLineDescent =
- GetFontDescent(GetDefaultFontIndex(), GetFontSize());
- AddLine(place, lineinfo);
- if (CSection* pSection = m_SectionArray.GetAt(0))
- pSection->ResetLinePlace();
+ if (m_bInitialized)
+ return;
- m_bInitial = true;
- }
+ CPVT_SectionInfo secinfo;
+ CPVT_WordPlace place;
+ place.nSecIndex = 0;
+ AddSection(place, secinfo);
+
+ CPVT_LineInfo lineinfo;
+ lineinfo.fLineAscent = GetFontAscent(GetDefaultFontIndex(), GetFontSize());
+ lineinfo.fLineDescent = GetFontDescent(GetDefaultFontIndex(), GetFontSize());
+ AddLine(place, lineinfo);
+
+ if (!m_SectionArray.empty())
+ m_SectionArray.front()->ResetLinePlace();
+
+ m_bInitialized = true;
}
void CPDF_VariableText::ResetAll() {
- m_bInitial = false;
- ResetSectionArray();
+ m_bInitialized = false;
+ m_SectionArray.clear();
}
CPVT_WordPlace CPDF_VariableText::InsertWord(const CPVT_WordPlace& place,
uint16_t word,
int32_t charset,
const CPVT_WordProps* pWordProps) {
- int32_t nTotlaWords = GetTotalWords();
- if (m_nLimitChar > 0 && nTotlaWords >= m_nLimitChar)
+ int32_t nTotalWords = GetTotalWords();
+ if (m_nLimitChar > 0 && nTotalWords >= m_nLimitChar)
return place;
- if (m_nCharArray > 0 && nTotlaWords >= m_nCharArray)
+ if (m_nCharArray > 0 && nTotalWords >= m_nCharArray)
return place;
CPVT_WordPlace newplace = place;
@@ -306,39 +321,38 @@ CPVT_WordPlace CPDF_VariableText::InsertSection(
const CPVT_WordPlace& place,
const CPVT_SecProps* pSecProps,
const CPVT_WordProps* pWordProps) {
- int32_t nTotlaWords = GetTotalWords();
- if (m_nLimitChar > 0 && nTotlaWords >= m_nLimitChar)
+ int32_t nTotalWords = GetTotalWords();
+ if (m_nLimitChar > 0 && nTotalWords >= m_nLimitChar)
return place;
- if (m_nCharArray > 0 && nTotlaWords >= m_nCharArray)
+ if (m_nCharArray > 0 && nTotalWords >= m_nCharArray)
return place;
if (!m_bMultiLine)
return place;
CPVT_WordPlace wordplace = place;
UpdateWordPlace(wordplace);
- CPVT_WordPlace newplace = place;
- if (CSection* pSection = m_SectionArray.GetAt(wordplace.nSecIndex)) {
- CPVT_WordPlace NewPlace(wordplace.nSecIndex + 1, 0, -1);
- CPVT_SectionInfo secinfo;
- AddSection(NewPlace, secinfo);
- newplace = NewPlace;
- if (CSection* pNewSection = m_SectionArray.GetAt(NewPlace.nSecIndex)) {
- for (int32_t w = wordplace.nWordIndex + 1,
- sz = pSection->m_WordArray.GetSize();
- w < sz; w++) {
- if (CPVT_WordInfo* pWord = pSection->m_WordArray.GetAt(w)) {
- NewPlace.nWordIndex++;
- pNewSection->AddWord(NewPlace, *pWord);
- }
- }
+ if (!pdfium::IndexInBounds(m_SectionArray, wordplace.nSecIndex))
+ return place;
+
+ CSection* pSection = m_SectionArray[wordplace.nSecIndex].get();
+ CPVT_WordPlace NewPlace(wordplace.nSecIndex + 1, 0, -1);
+ CPVT_SectionInfo secinfo;
+ AddSection(NewPlace, secinfo);
+ CPVT_WordPlace result = NewPlace;
+ if (pdfium::IndexInBounds(m_SectionArray, NewPlace.nSecIndex)) {
+ CSection* pNewSection = m_SectionArray[NewPlace.nSecIndex].get();
+ for (int32_t w = wordplace.nWordIndex + 1;
+ w < pdfium::CollectionSize<int32_t>(pSection->m_WordArray); ++w) {
+ NewPlace.nWordIndex++;
+ pNewSection->AddWord(NewPlace, *pSection->m_WordArray[w]);
}
- ClearSectionRightWords(wordplace);
}
- return newplace;
+ ClearSectionRightWords(wordplace);
+ return result;
}
CPVT_WordPlace CPDF_VariableText::InsertText(const CPVT_WordPlace& place,
- const FX_WCHAR* text) {
+ const wchar_t* text) {
CFX_WideString swText = text;
CPVT_WordPlace wp = place;
for (int32_t i = 0, sz = swText.GetLength(); i < sz; i++) {
@@ -375,9 +389,10 @@ CPVT_WordPlace CPDF_VariableText::InsertText(const CPVT_WordPlace& place,
CPVT_WordPlace CPDF_VariableText::DeleteWords(
const CPVT_WordRange& PlaceRange) {
- bool bLastSecPos = false;
- if (CSection* pSection = m_SectionArray.GetAt(PlaceRange.EndPos.nSecIndex))
- bLastSecPos = (PlaceRange.EndPos == pSection->GetEndWordPlace());
+ bool bLastSecPos =
+ pdfium::IndexInBounds(m_SectionArray, PlaceRange.EndPos.nSecIndex) &&
+ PlaceRange.EndPos ==
+ m_SectionArray[PlaceRange.EndPos.nSecIndex]->GetEndWordPlace();
ClearWords(PlaceRange);
if (PlaceRange.BeginPos.nSecIndex != PlaceRange.EndPos.nSecIndex) {
@@ -400,8 +415,8 @@ void CPDF_VariableText::SetText(const CFX_WideString& swText) {
DeleteWords(CPVT_WordRange(GetBeginWordPlace(), GetEndWordPlace()));
CPVT_WordPlace wp(0, 0, -1);
CPVT_SectionInfo secinfo;
- if (CSection* pSection = m_SectionArray.GetAt(0))
- pSection->m_SecInfo = secinfo;
+ if (!m_SectionArray.empty())
+ m_SectionArray.front()->m_SecInfo = secinfo;
int32_t nCharCount = 0;
for (int32_t i = 0, sz = swText.GetLength(); i < sz; i++) {
@@ -417,9 +432,7 @@ void CPDF_VariableText::SetText(const CFX_WideString& swText) {
if (swText.GetAt(i + 1) == 0x0A)
i += 1;
- wp.nSecIndex++;
- wp.nLineIndex = 0;
- wp.nWordIndex = -1;
+ wp.AdvanceSection();
AddSection(wp, secinfo);
}
break;
@@ -428,9 +441,7 @@ void CPDF_VariableText::SetText(const CFX_WideString& swText) {
if (swText.GetAt(i + 1) == 0x0D)
i += 1;
- wp.nSecIndex++;
- wp.nLineIndex = 0;
- wp.nWordIndex = -1;
+ wp.AdvanceSection();
AddSection(wp, secinfo);
}
break;
@@ -447,12 +458,12 @@ void CPDF_VariableText::SetText(const CFX_WideString& swText) {
void CPDF_VariableText::UpdateWordPlace(CPVT_WordPlace& place) const {
if (place.nSecIndex < 0)
place = GetBeginWordPlace();
- if (place.nSecIndex >= m_SectionArray.GetSize())
+ if (place.nSecIndex >= pdfium::CollectionSize<int32_t>(m_SectionArray))
place = GetEndWordPlace();
place = AdjustLineHeader(place, true);
- if (CSection* pSection = m_SectionArray.GetAt(place.nSecIndex))
- pSection->UpdateWordPlace(place);
+ if (pdfium::IndexInBounds(m_SectionArray, place.nSecIndex))
+ m_SectionArray[place.nSecIndex]->UpdateWordPlace(place);
}
int32_t CPDF_VariableText::WordPlaceToWordIndex(
@@ -462,89 +473,86 @@ int32_t CPDF_VariableText::WordPlaceToWordIndex(
int32_t nIndex = 0;
int32_t i = 0;
int32_t sz = 0;
- for (i = 0, sz = m_SectionArray.GetSize(); i < sz && i < newplace.nSecIndex;
- i++) {
- if (CSection* pSection = m_SectionArray.GetAt(i)) {
- nIndex += pSection->m_WordArray.GetSize();
- if (i != m_SectionArray.GetSize() - 1)
- nIndex += kReturnLength;
- }
+ for (i = 0, sz = pdfium::CollectionSize<int32_t>(m_SectionArray);
+ i < sz && i < newplace.nSecIndex; i++) {
+ CSection* pSection = m_SectionArray[i].get();
+ nIndex += pdfium::CollectionSize<int32_t>(pSection->m_WordArray);
+ if (i != sz - 1)
+ nIndex += kReturnLength;
}
- if (i >= 0 && i < m_SectionArray.GetSize())
+ if (pdfium::IndexInBounds(m_SectionArray, i))
nIndex += newplace.nWordIndex + kReturnLength;
return nIndex;
}
CPVT_WordPlace CPDF_VariableText::WordIndexToWordPlace(int32_t index) const {
CPVT_WordPlace place = GetBeginWordPlace();
- int32_t nOldIndex = 0, nIndex = 0;
- bool bFind = false;
- for (int32_t i = 0, sz = m_SectionArray.GetSize(); i < sz; i++) {
- if (CSection* pSection = m_SectionArray.GetAt(i)) {
- nIndex += pSection->m_WordArray.GetSize();
- if (nIndex == index) {
- place = pSection->GetEndWordPlace();
- bFind = true;
- break;
- } else if (nIndex > index) {
- place.nSecIndex = i;
- place.nWordIndex = index - nOldIndex - 1;
- pSection->UpdateWordPlace(place);
- bFind = true;
- break;
- }
- if (i != m_SectionArray.GetSize() - 1)
- nIndex += kReturnLength;
- nOldIndex = nIndex;
+ int32_t nOldIndex = 0;
+ int32_t nIndex = 0;
+ bool bFound = false;
+ for (int32_t i = 0, sz = pdfium::CollectionSize<int32_t>(m_SectionArray);
+ i < sz; i++) {
+ CSection* pSection = m_SectionArray[i].get();
+ nIndex += pdfium::CollectionSize<int32_t>(pSection->m_WordArray);
+ if (nIndex == index) {
+ place = pSection->GetEndWordPlace();
+ bFound = true;
+ break;
+ }
+ if (nIndex > index) {
+ place.nSecIndex = i;
+ place.nWordIndex = index - nOldIndex - 1;
+ pSection->UpdateWordPlace(place);
+ bFound = true;
+ break;
}
+ if (i != sz - 1)
+ nIndex += kReturnLength;
+ nOldIndex = nIndex;
}
- if (!bFind)
+ if (!bFound)
place = GetEndWordPlace();
return place;
}
CPVT_WordPlace CPDF_VariableText::GetBeginWordPlace() const {
- return m_bInitial ? CPVT_WordPlace(0, 0, -1) : CPVT_WordPlace();
+ return m_bInitialized ? CPVT_WordPlace(0, 0, -1) : CPVT_WordPlace();
}
CPVT_WordPlace CPDF_VariableText::GetEndWordPlace() const {
- if (CSection* pSection = m_SectionArray.GetAt(m_SectionArray.GetSize() - 1))
- return pSection->GetEndWordPlace();
- return CPVT_WordPlace();
+ if (m_SectionArray.empty())
+ return CPVT_WordPlace();
+ return m_SectionArray.back()->GetEndWordPlace();
}
CPVT_WordPlace CPDF_VariableText::GetPrevWordPlace(
const CPVT_WordPlace& place) const {
if (place.nSecIndex < 0)
return GetBeginWordPlace();
- if (place.nSecIndex >= m_SectionArray.GetSize())
+ if (place.nSecIndex >= pdfium::CollectionSize<int32_t>(m_SectionArray))
return GetEndWordPlace();
- if (CSection* pSection = m_SectionArray.GetAt(place.nSecIndex)) {
- if (place.WordCmp(pSection->GetBeginWordPlace()) <= 0) {
- if (CSection* pPrevSection = m_SectionArray.GetAt(place.nSecIndex - 1))
- return pPrevSection->GetEndWordPlace();
- return GetBeginWordPlace();
- }
+
+ CSection* pSection = m_SectionArray[place.nSecIndex].get();
+ if (place > pSection->GetBeginWordPlace())
return pSection->GetPrevWordPlace(place);
- }
- return place;
+ if (!pdfium::IndexInBounds(m_SectionArray, place.nSecIndex - 1))
+ return GetBeginWordPlace();
+ return m_SectionArray[place.nSecIndex - 1]->GetEndWordPlace();
}
CPVT_WordPlace CPDF_VariableText::GetNextWordPlace(
const CPVT_WordPlace& place) const {
if (place.nSecIndex < 0)
return GetBeginWordPlace();
- if (place.nSecIndex >= m_SectionArray.GetSize())
+ if (place.nSecIndex >= pdfium::CollectionSize<int32_t>(m_SectionArray))
return GetEndWordPlace();
- if (CSection* pSection = m_SectionArray.GetAt(place.nSecIndex)) {
- if (place.WordCmp(pSection->GetEndWordPlace()) >= 0) {
- if (CSection* pNextSection = m_SectionArray.GetAt(place.nSecIndex + 1))
- return pNextSection->GetBeginWordPlace();
- return GetEndWordPlace();
- }
+
+ CSection* pSection = m_SectionArray[place.nSecIndex].get();
+ if (place < pSection->GetEndWordPlace())
return pSection->GetNextWordPlace(place);
- }
- return place;
+ if (!pdfium::IndexInBounds(m_SectionArray, place.nSecIndex + 1))
+ return GetEndWordPlace();
+ return m_SectionArray[place.nSecIndex + 1]->GetBeginWordPlace();
}
CPVT_WordPlace CPDF_VariableText::SearchWordPlace(
@@ -552,36 +560,33 @@ CPVT_WordPlace CPDF_VariableText::SearchWordPlace(
CFX_PointF pt = OutToIn(point);
CPVT_WordPlace place = GetBeginWordPlace();
int32_t nLeft = 0;
- int32_t nRight = m_SectionArray.GetSize() - 1;
- int32_t nMid = m_SectionArray.GetSize() / 2;
+ int32_t nRight = pdfium::CollectionSize<int32_t>(m_SectionArray) - 1;
+ int32_t nMid = pdfium::CollectionSize<int32_t>(m_SectionArray) / 2;
bool bUp = true;
bool bDown = true;
while (nLeft <= nRight) {
- if (CSection* pSection = m_SectionArray.GetAt(nMid)) {
- if (IsFloatBigger(pt.y, pSection->m_SecInfo.rcSection.top)) {
- bUp = false;
- }
- if (IsFloatBigger(pSection->m_SecInfo.rcSection.bottom, pt.y)) {
- bDown = false;
- }
- if (IsFloatSmaller(pt.y, pSection->m_SecInfo.rcSection.top)) {
- nRight = nMid - 1;
- nMid = (nLeft + nRight) / 2;
- continue;
- } else if (IsFloatBigger(pt.y, pSection->m_SecInfo.rcSection.bottom)) {
- nLeft = nMid + 1;
- nMid = (nLeft + nRight) / 2;
- continue;
- } else {
- place = pSection->SearchWordPlace(
- CFX_PointF(pt.x - pSection->m_SecInfo.rcSection.left,
- pt.y - pSection->m_SecInfo.rcSection.top));
- place.nSecIndex = nMid;
- return place;
- }
- } else {
+ if (!pdfium::IndexInBounds(m_SectionArray, nMid))
break;
+ CSection* pSection = m_SectionArray[nMid].get();
+ if (IsFloatBigger(pt.y, pSection->m_SecInfo.rcSection.top))
+ bUp = false;
+ if (IsFloatBigger(pSection->m_SecInfo.rcSection.bottom, pt.y))
+ bDown = false;
+ if (IsFloatSmaller(pt.y, pSection->m_SecInfo.rcSection.top)) {
+ nRight = nMid - 1;
+ nMid = (nLeft + nRight) / 2;
+ continue;
}
+ if (IsFloatBigger(pt.y, pSection->m_SecInfo.rcSection.bottom)) {
+ nLeft = nMid + 1;
+ nMid = (nLeft + nRight) / 2;
+ continue;
+ }
+ place = pSection->SearchWordPlace(
+ CFX_PointF(pt.x - pSection->m_SecInfo.rcSection.left,
+ pt.y - pSection->m_SecInfo.rcSection.top));
+ place.nSecIndex = nMid;
+ return place;
}
if (bUp)
place = GetBeginWordPlace();
@@ -593,19 +598,23 @@ CPVT_WordPlace CPDF_VariableText::SearchWordPlace(
CPVT_WordPlace CPDF_VariableText::GetUpWordPlace(
const CPVT_WordPlace& place,
const CFX_PointF& point) const {
- if (CSection* pSection = m_SectionArray.GetAt(place.nSecIndex)) {
- CPVT_WordPlace temp = place;
- CFX_PointF pt = OutToIn(point);
- if (temp.nLineIndex-- > 0) {
- return pSection->SearchWordPlace(
- pt.x - pSection->m_SecInfo.rcSection.left, temp);
- }
- if (temp.nSecIndex-- > 0) {
- if (CSection* pLastSection = m_SectionArray.GetAt(temp.nSecIndex)) {
- temp.nLineIndex = pLastSection->m_LineArray.GetSize() - 1;
- return pLastSection->SearchWordPlace(
- pt.x - pLastSection->m_SecInfo.rcSection.left, temp);
- }
+ if (!pdfium::IndexInBounds(m_SectionArray, place.nSecIndex))
+ return place;
+
+ CSection* pSection = m_SectionArray[place.nSecIndex].get();
+ CPVT_WordPlace temp = place;
+ CFX_PointF pt = OutToIn(point);
+ if (temp.nLineIndex-- > 0) {
+ return pSection->SearchWordPlace(pt.x - pSection->m_SecInfo.rcSection.left,
+ temp);
+ }
+ if (temp.nSecIndex-- > 0) {
+ if (pdfium::IndexInBounds(m_SectionArray, temp.nSecIndex)) {
+ CSection* pLastSection = m_SectionArray[temp.nSecIndex].get();
+ temp.nLineIndex =
+ pdfium::CollectionSize<int32_t>(pLastSection->m_LineArray) - 1;
+ return pLastSection->SearchWordPlace(
+ pt.x - pLastSection->m_SecInfo.rcSection.left, temp);
}
}
return place;
@@ -614,22 +623,23 @@ CPVT_WordPlace CPDF_VariableText::GetUpWordPlace(
CPVT_WordPlace CPDF_VariableText::GetDownWordPlace(
const CPVT_WordPlace& place,
const CFX_PointF& point) const {
- if (CSection* pSection = m_SectionArray.GetAt(place.nSecIndex)) {
- CPVT_WordPlace temp = place;
- CFX_PointF pt = OutToIn(point);
- if (temp.nLineIndex++ < pSection->m_LineArray.GetSize() - 1) {
- return pSection->SearchWordPlace(
- pt.x - pSection->m_SecInfo.rcSection.left, temp);
- }
- if (temp.nSecIndex++ < m_SectionArray.GetSize() - 1) {
- if (CSection* pNextSection = m_SectionArray.GetAt(temp.nSecIndex)) {
- temp.nLineIndex = 0;
- return pNextSection->SearchWordPlace(
- pt.x - pSection->m_SecInfo.rcSection.left, temp);
- }
- }
+ if (!pdfium::IndexInBounds(m_SectionArray, place.nSecIndex))
+ return place;
+
+ CSection* pSection = m_SectionArray[place.nSecIndex].get();
+ CPVT_WordPlace temp = place;
+ CFX_PointF pt = OutToIn(point);
+ if (temp.nLineIndex++ <
+ pdfium::CollectionSize<int32_t>(pSection->m_LineArray) - 1) {
+ return pSection->SearchWordPlace(pt.x - pSection->m_SecInfo.rcSection.left,
+ temp);
}
- return place;
+ temp.AdvanceSection();
+ if (!pdfium::IndexInBounds(m_SectionArray, temp.nSecIndex))
+ return place;
+
+ return m_SectionArray[temp.nSecIndex]->SearchWordPlace(
+ pt.x - pSection->m_SecInfo.rcSection.left, temp);
}
CPVT_WordPlace CPDF_VariableText::GetLineBeginPlace(
@@ -639,11 +649,14 @@ CPVT_WordPlace CPDF_VariableText::GetLineBeginPlace(
CPVT_WordPlace CPDF_VariableText::GetLineEndPlace(
const CPVT_WordPlace& place) const {
- if (CSection* pSection = m_SectionArray.GetAt(place.nSecIndex)) {
- if (CLine* pLine = pSection->m_LineArray.GetAt(place.nLineIndex))
- return pLine->GetEndWordPlace();
- }
- return place;
+ if (!pdfium::IndexInBounds(m_SectionArray, place.nSecIndex))
+ return place;
+
+ CSection* pSection = m_SectionArray[place.nSecIndex].get();
+ if (!pdfium::IndexInBounds(pSection->m_LineArray, place.nLineIndex))
+ return place;
+
+ return pSection->m_LineArray[place.nLineIndex]->GetEndWordPlace();
}
CPVT_WordPlace CPDF_VariableText::GetSectionBeginPlace(
@@ -653,108 +666,103 @@ CPVT_WordPlace CPDF_VariableText::GetSectionBeginPlace(
CPVT_WordPlace CPDF_VariableText::GetSectionEndPlace(
const CPVT_WordPlace& place) const {
- if (CSection* pSection = m_SectionArray.GetAt(place.nSecIndex))
- return pSection->GetEndWordPlace();
- return place;
+ if (!pdfium::IndexInBounds(m_SectionArray, place.nSecIndex))
+ return place;
+
+ return m_SectionArray[place.nSecIndex]->GetEndWordPlace();
}
int32_t CPDF_VariableText::GetTotalWords() const {
int32_t nTotal = 0;
- for (int32_t i = 0, sz = m_SectionArray.GetSize(); i < sz; i++) {
- if (CSection* pSection = m_SectionArray.GetAt(i))
- nTotal += (pSection->m_WordArray.GetSize() + kReturnLength);
+ for (const auto& pSection : m_SectionArray) {
+ nTotal +=
+ pdfium::CollectionSize<int32_t>(pSection->m_WordArray) + kReturnLength;
}
-
return nTotal - kReturnLength;
}
-void CPDF_VariableText::ResetSectionArray() {
- for (int32_t s = 0, sz = m_SectionArray.GetSize(); s < sz; s++)
- delete m_SectionArray.GetAt(s);
-
- m_SectionArray.RemoveAll();
-}
-
CPVT_WordPlace CPDF_VariableText::AddSection(const CPVT_WordPlace& place,
const CPVT_SectionInfo& secinfo) {
if (IsValid() && !m_bMultiLine)
return place;
- int32_t nSecIndex =
- std::max(std::min(place.nSecIndex, m_SectionArray.GetSize()), 0);
- CSection* pSection = new CSection(this);
+ int32_t nSecIndex = pdfium::clamp(
+ place.nSecIndex, 0, pdfium::CollectionSize<int32_t>(m_SectionArray));
+
+ auto pSection = pdfium::MakeUnique<CSection>(this);
pSection->m_SecInfo = secinfo;
pSection->SecPlace.nSecIndex = nSecIndex;
- if (nSecIndex == m_SectionArray.GetSize())
- m_SectionArray.Add(pSection);
- else
- m_SectionArray.InsertAt(nSecIndex, pSection);
-
+ m_SectionArray.insert(m_SectionArray.begin() + nSecIndex,
+ std::move(pSection));
return place;
}
CPVT_WordPlace CPDF_VariableText::AddLine(const CPVT_WordPlace& place,
const CPVT_LineInfo& lineinfo) {
- if (m_SectionArray.IsEmpty())
+ if (!pdfium::IndexInBounds(m_SectionArray, place.nSecIndex))
return place;
- if (CSection* pSection = m_SectionArray.GetAt(place.nSecIndex))
- return pSection->AddLine(lineinfo);
- return place;
+
+ return m_SectionArray[place.nSecIndex]->AddLine(lineinfo);
}
CPVT_WordPlace CPDF_VariableText::AddWord(const CPVT_WordPlace& place,
const CPVT_WordInfo& wordinfo) {
- if (m_SectionArray.GetSize() <= 0) {
+ if (m_SectionArray.empty())
return place;
- }
+
CPVT_WordPlace newplace = place;
newplace.nSecIndex =
- std::max(std::min(newplace.nSecIndex, m_SectionArray.GetSize() - 1), 0);
- if (CSection* pSection = m_SectionArray.GetAt(newplace.nSecIndex))
- return pSection->AddWord(newplace, wordinfo);
- return place;
+ pdfium::clamp(newplace.nSecIndex, 0,
+ pdfium::CollectionSize<int32_t>(m_SectionArray) - 1);
+ return m_SectionArray[newplace.nSecIndex]->AddWord(newplace, wordinfo);
}
bool CPDF_VariableText::GetWordInfo(const CPVT_WordPlace& place,
CPVT_WordInfo& wordinfo) {
- if (CSection* pSection = m_SectionArray.GetAt(place.nSecIndex)) {
- if (CPVT_WordInfo* pWord = pSection->m_WordArray.GetAt(place.nWordIndex)) {
- wordinfo = *pWord;
- return true;
- }
- }
- return false;
+ if (!pdfium::IndexInBounds(m_SectionArray, place.nSecIndex))
+ return false;
+
+ CSection* pSection = m_SectionArray[place.nSecIndex].get();
+ if (!pdfium::IndexInBounds(pSection->m_WordArray, place.nWordIndex))
+ return false;
+
+ wordinfo = *pSection->m_WordArray[place.nWordIndex];
+ return true;
}
bool CPDF_VariableText::SetWordInfo(const CPVT_WordPlace& place,
const CPVT_WordInfo& wordinfo) {
- if (CSection* pSection = m_SectionArray.GetAt(place.nSecIndex)) {
- if (CPVT_WordInfo* pWord = pSection->m_WordArray.GetAt(place.nWordIndex)) {
- *pWord = wordinfo;
- return true;
- }
- }
- return false;
+ if (!pdfium::IndexInBounds(m_SectionArray, place.nSecIndex))
+ return false;
+
+ CSection* pSection = m_SectionArray[place.nSecIndex].get();
+ if (!pdfium::IndexInBounds(pSection->m_WordArray, place.nWordIndex))
+ return false;
+
+ *pSection->m_WordArray[place.nWordIndex] = wordinfo;
+ return true;
}
bool CPDF_VariableText::GetLineInfo(const CPVT_WordPlace& place,
CPVT_LineInfo& lineinfo) {
- if (CSection* pSection = m_SectionArray.GetAt(place.nSecIndex)) {
- if (CLine* pLine = pSection->m_LineArray.GetAt(place.nLineIndex)) {
- lineinfo = pLine->m_LineInfo;
- return true;
- }
- }
- return false;
+ if (!pdfium::IndexInBounds(m_SectionArray, place.nSecIndex))
+ return false;
+
+ CSection* pSection = m_SectionArray[place.nSecIndex].get();
+ if (!pdfium::IndexInBounds(pSection->m_LineArray, place.nLineIndex))
+ return false;
+
+ lineinfo = pSection->m_LineArray[place.nLineIndex]->m_LineInfo;
+ return true;
}
bool CPDF_VariableText::GetSectionInfo(const CPVT_WordPlace& place,
CPVT_SectionInfo& secinfo) {
- if (CSection* pSection = m_SectionArray.GetAt(place.nSecIndex)) {
- secinfo = pSection->m_SecInfo;
- return true;
- }
- return false;
+ if (!pdfium::IndexInBounds(m_SectionArray, place.nSecIndex))
+ return false;
+
+ secinfo = m_SectionArray[place.nSecIndex]->m_SecInfo;
+ return true;
}
void CPDF_VariableText::SetPlateRect(const CFX_FloatRect& rect) {
@@ -773,7 +781,7 @@ const CFX_FloatRect& CPDF_VariableText::GetPlateRect() const {
return m_rcPlate;
}
-FX_FLOAT CPDF_VariableText::GetWordFontSize(const CPVT_WordInfo& WordInfo) {
+float CPDF_VariableText::GetWordFontSize(const CPVT_WordInfo& WordInfo) {
return GetFontSize();
}
@@ -781,66 +789,64 @@ int32_t CPDF_VariableText::GetWordFontIndex(const CPVT_WordInfo& WordInfo) {
return WordInfo.nFontIndex;
}
-FX_FLOAT CPDF_VariableText::GetWordWidth(int32_t nFontIndex,
- uint16_t Word,
- uint16_t SubWord,
- FX_FLOAT fCharSpace,
- int32_t nHorzScale,
- FX_FLOAT fFontSize,
- FX_FLOAT fWordTail) {
+float CPDF_VariableText::GetWordWidth(int32_t nFontIndex,
+ uint16_t Word,
+ uint16_t SubWord,
+ float fCharSpace,
+ int32_t nHorzScale,
+ float fFontSize,
+ float fWordTail) {
return (GetCharWidth(nFontIndex, Word, SubWord) * fFontSize * kFontScale +
fCharSpace) *
nHorzScale * kScalePercent +
fWordTail;
}
-FX_FLOAT CPDF_VariableText::GetWordWidth(const CPVT_WordInfo& WordInfo) {
+float CPDF_VariableText::GetWordWidth(const CPVT_WordInfo& WordInfo) {
return GetWordWidth(GetWordFontIndex(WordInfo), WordInfo.Word, GetSubWord(),
GetCharSpace(WordInfo), GetHorzScale(WordInfo),
GetWordFontSize(WordInfo), WordInfo.fWordTail);
}
-FX_FLOAT CPDF_VariableText::GetLineAscent(const CPVT_SectionInfo& SecInfo) {
+float CPDF_VariableText::GetLineAscent(const CPVT_SectionInfo& SecInfo) {
return GetFontAscent(GetDefaultFontIndex(), GetFontSize());
}
-FX_FLOAT CPDF_VariableText::GetLineDescent(const CPVT_SectionInfo& SecInfo) {
+float CPDF_VariableText::GetLineDescent(const CPVT_SectionInfo& SecInfo) {
return GetFontDescent(GetDefaultFontIndex(), GetFontSize());
}
-FX_FLOAT CPDF_VariableText::GetFontAscent(int32_t nFontIndex,
- FX_FLOAT fFontSize) {
- return (FX_FLOAT)GetTypeAscent(nFontIndex) * fFontSize * kFontScale;
+float CPDF_VariableText::GetFontAscent(int32_t nFontIndex, float fFontSize) {
+ return (float)GetTypeAscent(nFontIndex) * fFontSize * kFontScale;
}
-FX_FLOAT CPDF_VariableText::GetFontDescent(int32_t nFontIndex,
- FX_FLOAT fFontSize) {
- return (FX_FLOAT)GetTypeDescent(nFontIndex) * fFontSize * kFontScale;
+float CPDF_VariableText::GetFontDescent(int32_t nFontIndex, float fFontSize) {
+ return (float)GetTypeDescent(nFontIndex) * fFontSize * kFontScale;
}
-FX_FLOAT CPDF_VariableText::GetWordAscent(const CPVT_WordInfo& WordInfo,
- FX_FLOAT fFontSize) {
+float CPDF_VariableText::GetWordAscent(const CPVT_WordInfo& WordInfo,
+ float fFontSize) {
return GetFontAscent(GetWordFontIndex(WordInfo), fFontSize);
}
-FX_FLOAT CPDF_VariableText::GetWordDescent(const CPVT_WordInfo& WordInfo,
- FX_FLOAT fFontSize) {
+float CPDF_VariableText::GetWordDescent(const CPVT_WordInfo& WordInfo,
+ float fFontSize) {
return GetFontDescent(GetWordFontIndex(WordInfo), fFontSize);
}
-FX_FLOAT CPDF_VariableText::GetWordAscent(const CPVT_WordInfo& WordInfo) {
+float CPDF_VariableText::GetWordAscent(const CPVT_WordInfo& WordInfo) {
return GetFontAscent(GetWordFontIndex(WordInfo), GetWordFontSize(WordInfo));
}
-FX_FLOAT CPDF_VariableText::GetWordDescent(const CPVT_WordInfo& WordInfo) {
+float CPDF_VariableText::GetWordDescent(const CPVT_WordInfo& WordInfo) {
return GetFontDescent(GetWordFontIndex(WordInfo), GetWordFontSize(WordInfo));
}
-FX_FLOAT CPDF_VariableText::GetLineLeading(const CPVT_SectionInfo& SecInfo) {
+float CPDF_VariableText::GetLineLeading(const CPVT_SectionInfo& SecInfo) {
return m_fLineLeading;
}
-FX_FLOAT CPDF_VariableText::GetLineIndent(const CPVT_SectionInfo& SecInfo) {
+float CPDF_VariableText::GetLineIndent(const CPVT_SectionInfo& SecInfo) {
return 0.0f;
}
@@ -848,7 +854,7 @@ int32_t CPDF_VariableText::GetAlignment(const CPVT_SectionInfo& SecInfo) {
return m_nAlignment;
}
-FX_FLOAT CPDF_VariableText::GetCharSpace(const CPVT_WordInfo& WordInfo) {
+float CPDF_VariableText::GetCharSpace(const CPVT_WordInfo& WordInfo) {
return m_fCharSpace;
}
@@ -858,13 +864,16 @@ int32_t CPDF_VariableText::GetHorzScale(const CPVT_WordInfo& WordInfo) {
void CPDF_VariableText::ClearSectionRightWords(const CPVT_WordPlace& place) {
CPVT_WordPlace wordplace = AdjustLineHeader(place, true);
- if (CSection* pSection = m_SectionArray.GetAt(place.nSecIndex)) {
- for (int32_t w = pSection->m_WordArray.GetSize() - 1;
- w > wordplace.nWordIndex; w--) {
- delete pSection->m_WordArray.GetAt(w);
- pSection->m_WordArray.RemoveAt(w);
- }
- }
+ if (!pdfium::IndexInBounds(m_SectionArray, place.nSecIndex))
+ return;
+
+ CSection* pSection = m_SectionArray[place.nSecIndex].get();
+ if (!pdfium::IndexInBounds(pSection->m_WordArray, wordplace.nWordIndex + 1))
+ return;
+
+ pSection->m_WordArray.erase(
+ pSection->m_WordArray.begin() + wordplace.nWordIndex + 1,
+ pSection->m_WordArray.end());
}
CPVT_WordPlace CPDF_VariableText::AdjustLineHeader(const CPVT_WordPlace& place,
@@ -875,16 +884,17 @@ CPVT_WordPlace CPDF_VariableText::AdjustLineHeader(const CPVT_WordPlace& place,
}
bool CPDF_VariableText::ClearEmptySection(const CPVT_WordPlace& place) {
- if (place.nSecIndex == 0 && m_SectionArray.GetSize() == 1)
+ if (place.nSecIndex == 0 && m_SectionArray.size() == 1)
return false;
- if (CSection* pSection = m_SectionArray.GetAt(place.nSecIndex)) {
- if (pSection->m_WordArray.GetSize() == 0) {
- delete pSection;
- m_SectionArray.RemoveAt(place.nSecIndex);
- return true;
- }
- }
- return false;
+
+ if (!pdfium::IndexInBounds(m_SectionArray, place.nSecIndex))
+ return false;
+
+ if (!m_SectionArray[place.nSecIndex]->m_WordArray.empty())
+ return false;
+
+ m_SectionArray.erase(m_SectionArray.begin() + place.nSecIndex);
+ return true;
}
void CPDF_VariableText::ClearEmptySections(const CPVT_WordRange& PlaceRange) {
@@ -898,19 +908,18 @@ void CPDF_VariableText::ClearEmptySections(const CPVT_WordRange& PlaceRange) {
void CPDF_VariableText::LinkLatterSection(const CPVT_WordPlace& place) {
CPVT_WordPlace oldplace = AdjustLineHeader(place, true);
- if (CSection* pNextSection = m_SectionArray.GetAt(place.nSecIndex + 1)) {
- if (CSection* pSection = m_SectionArray.GetAt(oldplace.nSecIndex)) {
- for (int32_t w = 0, sz = pNextSection->m_WordArray.GetSize(); w < sz;
- w++) {
- if (CPVT_WordInfo* pWord = pNextSection->m_WordArray.GetAt(w)) {
- oldplace.nWordIndex++;
- pSection->AddWord(oldplace, *pWord);
- }
- }
+ if (!pdfium::IndexInBounds(m_SectionArray, place.nSecIndex + 1))
+ return;
+
+ CSection* pNextSection = m_SectionArray[place.nSecIndex + 1].get();
+ if (pdfium::IndexInBounds(m_SectionArray, oldplace.nSecIndex)) {
+ CSection* pSection = m_SectionArray[oldplace.nSecIndex].get();
+ for (auto& pWord : pNextSection->m_WordArray) {
+ oldplace.nWordIndex++;
+ pSection->AddWord(oldplace, *pWord);
}
- delete pNextSection;
- m_SectionArray.RemoveAt(place.nSecIndex + 1);
}
+ m_SectionArray.erase(m_SectionArray.begin() + place.nSecIndex + 1);
}
void CPDF_VariableText::ClearWords(const CPVT_WordRange& PlaceRange) {
@@ -919,40 +928,44 @@ void CPDF_VariableText::ClearWords(const CPVT_WordRange& PlaceRange) {
NewRange.EndPos = AdjustLineHeader(PlaceRange.EndPos, true);
for (int32_t s = NewRange.EndPos.nSecIndex; s >= NewRange.BeginPos.nSecIndex;
s--) {
- if (CSection* pSection = m_SectionArray.GetAt(s))
- pSection->ClearWords(NewRange);
+ if (pdfium::IndexInBounds(m_SectionArray, s))
+ m_SectionArray[s]->ClearWords(NewRange);
}
}
CPVT_WordPlace CPDF_VariableText::ClearLeftWord(const CPVT_WordPlace& place) {
- if (CSection* pSection = m_SectionArray.GetAt(place.nSecIndex)) {
- CPVT_WordPlace leftplace = GetPrevWordPlace(place);
- if (leftplace != place) {
- if (leftplace.nSecIndex != place.nSecIndex) {
- if (pSection->m_WordArray.GetSize() == 0)
- ClearEmptySection(place);
- else
- LinkLatterSection(leftplace);
- } else {
- pSection->ClearWord(place);
- }
- }
- return leftplace;
+ if (!pdfium::IndexInBounds(m_SectionArray, place.nSecIndex))
+ return place;
+
+ CSection* pSection = m_SectionArray[place.nSecIndex].get();
+ CPVT_WordPlace leftplace = GetPrevWordPlace(place);
+ if (leftplace == place)
+ return place;
+
+ if (leftplace.nSecIndex != place.nSecIndex) {
+ if (pSection->m_WordArray.empty())
+ ClearEmptySection(place);
+ else
+ LinkLatterSection(leftplace);
+ } else {
+ pSection->ClearWord(place);
}
- return place;
+ return leftplace;
}
CPVT_WordPlace CPDF_VariableText::ClearRightWord(const CPVT_WordPlace& place) {
- if (CSection* pSection = m_SectionArray.GetAt(place.nSecIndex)) {
- CPVT_WordPlace rightplace =
- AdjustLineHeader(GetNextWordPlace(place), false);
- if (rightplace != place) {
- if (rightplace.nSecIndex != place.nSecIndex)
- LinkLatterSection(place);
- else
- pSection->ClearWord(rightplace);
- }
- }
+ if (!pdfium::IndexInBounds(m_SectionArray, place.nSecIndex))
+ return place;
+
+ CSection* pSection = m_SectionArray[place.nSecIndex].get();
+ CPVT_WordPlace rightplace = AdjustLineHeader(GetNextWordPlace(place), false);
+ if (rightplace == place)
+ return place;
+
+ if (rightplace.nSecIndex != place.nSecIndex)
+ LinkLatterSection(place);
+ else
+ pSection->ClearWord(rightplace);
return place;
}
@@ -979,7 +992,7 @@ CPVT_FloatRect CPDF_VariableText::Rearrange(const CPVT_WordRange& PlaceRange) {
return rcRet;
}
-FX_FLOAT CPDF_VariableText::GetAutoFontSize() {
+float CPDF_VariableText::GetAutoFontSize() {
int32_t nTotal = sizeof(gFontSizeSteps) / sizeof(uint8_t);
if (IsMultiLine())
nTotal /= 4;
@@ -1002,20 +1015,18 @@ FX_FLOAT CPDF_VariableText::GetAutoFontSize() {
continue;
}
}
- return (FX_FLOAT)gFontSizeSteps[nMid];
+ return (float)gFontSizeSteps[nMid];
}
-bool CPDF_VariableText::IsBigger(FX_FLOAT fFontSize) const {
+bool CPDF_VariableText::IsBigger(float fFontSize) const {
CFX_SizeF szTotal;
- for (int32_t s = 0, sz = m_SectionArray.GetSize(); s < sz; s++) {
- if (CSection* pSection = m_SectionArray.GetAt(s)) {
- CFX_SizeF size = pSection->GetSectionSize(fFontSize);
- szTotal.width = std::max(size.width, szTotal.width);
- szTotal.height += size.height;
- if (IsFloatBigger(szTotal.width, GetPlateWidth()) ||
- IsFloatBigger(szTotal.height, GetPlateHeight())) {
- return true;
- }
+ for (const auto& pSection : m_SectionArray) {
+ CFX_SizeF size = pSection->GetSectionSize(fFontSize);
+ szTotal.width = std::max(size.width, szTotal.width);
+ szTotal.height += size.height;
+ if (IsFloatBigger(szTotal.width, GetPlateWidth()) ||
+ IsFloatBigger(szTotal.height, GetPlateHeight())) {
+ return true;
}
}
return false;
@@ -1024,40 +1035,40 @@ bool CPDF_VariableText::IsBigger(FX_FLOAT fFontSize) const {
CPVT_FloatRect CPDF_VariableText::RearrangeSections(
const CPVT_WordRange& PlaceRange) {
CPVT_WordPlace place;
- FX_FLOAT fPosY = 0;
- FX_FLOAT fOldHeight;
+ float fPosY = 0;
+ float fOldHeight;
int32_t nSSecIndex = PlaceRange.BeginPos.nSecIndex;
int32_t nESecIndex = PlaceRange.EndPos.nSecIndex;
CPVT_FloatRect rcRet;
- for (int32_t s = 0, sz = m_SectionArray.GetSize(); s < sz; s++) {
+ for (int32_t s = 0, sz = pdfium::CollectionSize<int32_t>(m_SectionArray);
+ s < sz; s++) {
place.nSecIndex = s;
- if (CSection* pSection = m_SectionArray.GetAt(s)) {
- pSection->SecPlace = place;
- CPVT_FloatRect rcSec = pSection->m_SecInfo.rcSection;
- if (s >= nSSecIndex) {
- if (s <= nESecIndex) {
- rcSec = pSection->Rearrange();
- rcSec.top += fPosY;
- rcSec.bottom += fPosY;
- } else {
- fOldHeight = pSection->m_SecInfo.rcSection.bottom -
- pSection->m_SecInfo.rcSection.top;
- rcSec.top = fPosY;
- rcSec.bottom = fPosY + fOldHeight;
- }
- pSection->m_SecInfo.rcSection = rcSec;
- pSection->ResetLinePlace();
- }
- if (s == 0) {
- rcRet = rcSec;
+ CSection* pSection = m_SectionArray[s].get();
+ pSection->SecPlace = place;
+ CPVT_FloatRect rcSec = pSection->m_SecInfo.rcSection;
+ if (s >= nSSecIndex) {
+ if (s <= nESecIndex) {
+ rcSec = pSection->Rearrange();
+ rcSec.top += fPosY;
+ rcSec.bottom += fPosY;
} else {
- rcRet.left = std::min(rcSec.left, rcRet.left);
- rcRet.top = std::min(rcSec.top, rcRet.top);
- rcRet.right = std::max(rcSec.right, rcRet.right);
- rcRet.bottom = std::max(rcSec.bottom, rcRet.bottom);
+ fOldHeight = pSection->m_SecInfo.rcSection.bottom -
+ pSection->m_SecInfo.rcSection.top;
+ rcSec.top = fPosY;
+ rcSec.bottom = fPosY + fOldHeight;
}
- fPosY += rcSec.Height();
+ pSection->m_SecInfo.rcSection = rcSec;
+ pSection->ResetLinePlace();
+ }
+ if (s == 0) {
+ rcRet = rcSec;
+ } else {
+ rcRet.left = std::min(rcSec.left, rcRet.left);
+ rcRet.top = std::min(rcSec.top, rcRet.top);
+ rcRet.right = std::max(rcSec.right, rcRet.right);
+ rcRet.bottom = std::max(rcSec.bottom, rcRet.bottom);
}
+ fPosY += rcSec.Height();
}
return rcRet;
}
diff --git a/chromium/third_party/pdfium/core/fpdfdoc/cpdf_variabletext.h b/chromium/third_party/pdfium/core/fpdfdoc/cpdf_variabletext.h
index 8e7c0c964a6..2e6caf63d60 100644
--- a/chromium/third_party/pdfium/core/fpdfdoc/cpdf_variabletext.h
+++ b/chromium/third_party/pdfium/core/fpdfdoc/cpdf_variabletext.h
@@ -8,8 +8,8 @@
#define CORE_FPDFDOC_CPDF_VARIABLETEXT_H_
#include <memory>
+#include <vector>
-#include "core/fpdfdoc/cpvt_arraytemplate.h"
#include "core/fpdfdoc/cpvt_floatrect.h"
#include "core/fpdfdoc/cpvt_line.h"
#include "core/fpdfdoc/cpvt_lineinfo.h"
@@ -93,15 +93,15 @@ class CPDF_VariableText {
void SetAlignment(int32_t nFormat) { m_nAlignment = nFormat; }
void SetPasswordChar(uint16_t wSubWord) { m_wSubWord = wSubWord; }
void SetLimitChar(int32_t nLimitChar) { m_nLimitChar = nLimitChar; }
- void SetCharSpace(FX_FLOAT fCharSpace) { m_fCharSpace = fCharSpace; }
+ void SetCharSpace(float fCharSpace) { m_fCharSpace = fCharSpace; }
void SetMultiLine(bool bMultiLine) { m_bMultiLine = bMultiLine; }
void SetAutoReturn(bool bAuto) { m_bLimitWidth = bAuto; }
- void SetFontSize(FX_FLOAT fFontSize) { m_fFontSize = fFontSize; }
+ void SetFontSize(float fFontSize) { m_fFontSize = fFontSize; }
void SetCharArray(int32_t nCharArray) { m_nCharArray = nCharArray; }
void SetAutoFontSize(bool bAuto) { m_bAutoFontSize = bAuto; }
void Initialize();
- bool IsValid() const { return m_bInitial; }
+ bool IsValid() const { return m_bInitialized; }
void RearrangeAll();
void RearrangePart(const CPVT_WordRange& PlaceRange);
@@ -114,20 +114,20 @@ class CPDF_VariableText {
CPVT_WordPlace InsertSection(const CPVT_WordPlace& place,
const CPVT_SecProps* pSecProps,
const CPVT_WordProps* pWordProps);
- CPVT_WordPlace InsertText(const CPVT_WordPlace& place, const FX_WCHAR* text);
+ CPVT_WordPlace InsertText(const CPVT_WordPlace& place, const wchar_t* text);
CPVT_WordPlace DeleteWords(const CPVT_WordRange& PlaceRange);
CPVT_WordPlace DeleteWord(const CPVT_WordPlace& place);
CPVT_WordPlace BackSpaceWord(const CPVT_WordPlace& place);
int32_t GetTotalWords() const;
- FX_FLOAT GetFontSize() const { return m_fFontSize; }
+ float GetFontSize() const { return m_fFontSize; }
int32_t GetAlignment() const { return m_nAlignment; }
uint16_t GetPasswordChar() const { return GetSubWord(); }
int32_t GetCharArray() const { return m_nCharArray; }
int32_t GetLimitChar() const { return m_nLimitChar; }
bool IsMultiLine() const { return m_bMultiLine; }
int32_t GetHorzScale() const { return m_nHorzScale; }
- FX_FLOAT GetCharSpace() const { return m_fCharSpace; }
+ float GetCharSpace() const { return m_fCharSpace; }
CPVT_WordPlace GetBeginWordPlace() const;
CPVT_WordPlace GetEndWordPlace() const;
CPVT_WordPlace GetPrevWordPlace(const CPVT_WordPlace& place) const;
@@ -149,8 +149,8 @@ class CPDF_VariableText {
uint16_t GetSubWord() const { return m_wSubWord; }
- FX_FLOAT GetPlateWidth() const { return m_rcPlate.right - m_rcPlate.left; }
- FX_FLOAT GetPlateHeight() const { return m_rcPlate.top - m_rcPlate.bottom; }
+ float GetPlateWidth() const { return m_rcPlate.right - m_rcPlate.left; }
+ float GetPlateHeight() const { return m_rcPlate.top - m_rcPlate.bottom; }
CFX_SizeF GetPlateSize() const;
CFX_PointF GetBTPoint() const;
CFX_PointF GetETPoint() const;
@@ -181,28 +181,28 @@ class CPDF_VariableText {
bool SetWordInfo(const CPVT_WordPlace& place, const CPVT_WordInfo& wordinfo);
bool GetLineInfo(const CPVT_WordPlace& place, CPVT_LineInfo& lineinfo);
bool GetSectionInfo(const CPVT_WordPlace& place, CPVT_SectionInfo& secinfo);
- FX_FLOAT GetWordFontSize(const CPVT_WordInfo& WordInfo);
- FX_FLOAT GetWordWidth(int32_t nFontIndex,
- uint16_t Word,
- uint16_t SubWord,
- FX_FLOAT fCharSpace,
- int32_t nHorzScale,
- FX_FLOAT fFontSize,
- FX_FLOAT fWordTail);
- FX_FLOAT GetWordWidth(const CPVT_WordInfo& WordInfo);
- FX_FLOAT GetWordAscent(const CPVT_WordInfo& WordInfo, FX_FLOAT fFontSize);
- FX_FLOAT GetWordDescent(const CPVT_WordInfo& WordInfo, FX_FLOAT fFontSize);
- FX_FLOAT GetWordAscent(const CPVT_WordInfo& WordInfo);
- FX_FLOAT GetWordDescent(const CPVT_WordInfo& WordInfo);
- FX_FLOAT GetLineAscent(const CPVT_SectionInfo& SecInfo);
- FX_FLOAT GetLineDescent(const CPVT_SectionInfo& SecInfo);
- FX_FLOAT GetFontAscent(int32_t nFontIndex, FX_FLOAT fFontSize);
- FX_FLOAT GetFontDescent(int32_t nFontIndex, FX_FLOAT fFontSize);
+ float GetWordFontSize(const CPVT_WordInfo& WordInfo);
+ float GetWordWidth(int32_t nFontIndex,
+ uint16_t Word,
+ uint16_t SubWord,
+ float fCharSpace,
+ int32_t nHorzScale,
+ float fFontSize,
+ float fWordTail);
+ float GetWordWidth(const CPVT_WordInfo& WordInfo);
+ float GetWordAscent(const CPVT_WordInfo& WordInfo, float fFontSize);
+ float GetWordDescent(const CPVT_WordInfo& WordInfo, float fFontSize);
+ float GetWordAscent(const CPVT_WordInfo& WordInfo);
+ float GetWordDescent(const CPVT_WordInfo& WordInfo);
+ float GetLineAscent(const CPVT_SectionInfo& SecInfo);
+ float GetLineDescent(const CPVT_SectionInfo& SecInfo);
+ float GetFontAscent(int32_t nFontIndex, float fFontSize);
+ float GetFontDescent(int32_t nFontIndex, float fFontSize);
int32_t GetWordFontIndex(const CPVT_WordInfo& WordInfo);
- FX_FLOAT GetCharSpace(const CPVT_WordInfo& WordInfo);
+ float GetCharSpace(const CPVT_WordInfo& WordInfo);
int32_t GetHorzScale(const CPVT_WordInfo& WordInfo);
- FX_FLOAT GetLineLeading(const CPVT_SectionInfo& SecInfo);
- FX_FLOAT GetLineIndent(const CPVT_SectionInfo& SecInfo);
+ float GetLineLeading(const CPVT_SectionInfo& SecInfo);
+ float GetLineIndent(const CPVT_SectionInfo& SecInfo);
int32_t GetAlignment(const CPVT_SectionInfo& SecInfo);
void ClearSectionRightWords(const CPVT_WordPlace& place);
@@ -215,25 +215,23 @@ class CPDF_VariableText {
CPVT_WordPlace ClearRightWord(const CPVT_WordPlace& place);
CPVT_FloatRect Rearrange(const CPVT_WordRange& PlaceRange);
- FX_FLOAT GetAutoFontSize();
- bool IsBigger(FX_FLOAT fFontSize) const;
+ float GetAutoFontSize();
+ bool IsBigger(float fFontSize) const;
CPVT_FloatRect RearrangeSections(const CPVT_WordRange& PlaceRange);
- void ResetSectionArray();
-
- CPVT_ArrayTemplate<CSection*> m_SectionArray;
+ std::vector<std::unique_ptr<CSection>> m_SectionArray;
int32_t m_nLimitChar;
int32_t m_nCharArray;
bool m_bMultiLine;
bool m_bLimitWidth;
bool m_bAutoFontSize;
int32_t m_nAlignment;
- FX_FLOAT m_fLineLeading;
- FX_FLOAT m_fCharSpace;
+ float m_fLineLeading;
+ float m_fCharSpace;
int32_t m_nHorzScale;
uint16_t m_wSubWord;
- FX_FLOAT m_fFontSize;
- bool m_bInitial;
+ float m_fFontSize;
+ bool m_bInitialized;
CPDF_VariableText::Provider* m_pVTProvider;
std::unique_ptr<CPDF_VariableText::Iterator> m_pVTIterator;
CFX_FloatRect m_rcPlate;
diff --git a/chromium/third_party/pdfium/core/fpdfdoc/cpvt_arraytemplate.h b/chromium/third_party/pdfium/core/fpdfdoc/cpvt_arraytemplate.h
deleted file mode 100644
index 5274bd9ba44..00000000000
--- a/chromium/third_party/pdfium/core/fpdfdoc/cpvt_arraytemplate.h
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright 2016 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef CORE_FPDFDOC_CPVT_ARRAYTEMPLATE_H_
-#define CORE_FPDFDOC_CPVT_ARRAYTEMPLATE_H_
-
-#include "core/fxcrt/fx_basic.h"
-#include "core/fxcrt/fx_system.h"
-
-template <class TYPE>
-class CPVT_ArrayTemplate : public CFX_ArrayTemplate<TYPE> {
- public:
- bool IsEmpty() { return CFX_ArrayTemplate<TYPE>::GetSize() <= 0; }
-
- TYPE GetAt(int nIndex) const {
- if (nIndex >= 0 && nIndex < CFX_ArrayTemplate<TYPE>::GetSize())
- return CFX_ArrayTemplate<TYPE>::GetAt(nIndex);
- return nullptr;
- }
-
- void RemoveAt(int nIndex) {
- if (nIndex >= 0 && nIndex < CFX_ArrayTemplate<TYPE>::GetSize())
- CFX_ArrayTemplate<TYPE>::RemoveAt(nIndex);
- }
-};
-
-#endif // CORE_FPDFDOC_CPVT_ARRAYTEMPLATE_H_
diff --git a/chromium/third_party/pdfium/core/fpdfdoc/cpvt_color.cpp b/chromium/third_party/pdfium/core/fpdfdoc/cpvt_color.cpp
index e0e6a26db7a..584a85aaec1 100644
--- a/chromium/third_party/pdfium/core/fpdfdoc/cpvt_color.cpp
+++ b/chromium/third_party/pdfium/core/fpdfdoc/cpvt_color.cpp
@@ -15,16 +15,16 @@ CPVT_Color CPVT_Color::ParseColor(const CFX_ByteString& str) {
return CPVT_Color(CPVT_Color::kGray, FX_atof(syntax.GetWord()));
if (syntax.FindTagParamFromStart("rg", 3)) {
- FX_FLOAT f1 = FX_atof(syntax.GetWord());
- FX_FLOAT f2 = FX_atof(syntax.GetWord());
- FX_FLOAT f3 = FX_atof(syntax.GetWord());
+ float f1 = FX_atof(syntax.GetWord());
+ float f2 = FX_atof(syntax.GetWord());
+ float f3 = FX_atof(syntax.GetWord());
return CPVT_Color(CPVT_Color::kRGB, f1, f2, f3);
}
if (syntax.FindTagParamFromStart("k", 4)) {
- FX_FLOAT f1 = FX_atof(syntax.GetWord());
- FX_FLOAT f2 = FX_atof(syntax.GetWord());
- FX_FLOAT f3 = FX_atof(syntax.GetWord());
- FX_FLOAT f4 = FX_atof(syntax.GetWord());
+ float f1 = FX_atof(syntax.GetWord());
+ float f2 = FX_atof(syntax.GetWord());
+ float f3 = FX_atof(syntax.GetWord());
+ float f4 = FX_atof(syntax.GetWord());
return CPVT_Color(CPVT_Color::kCMYK, f1, f2, f3, f4);
}
return CPVT_Color(CPVT_Color::kTransparent);
diff --git a/chromium/third_party/pdfium/core/fpdfdoc/cpvt_color.h b/chromium/third_party/pdfium/core/fpdfdoc/cpvt_color.h
index 4d4942dbf98..2db3b8310ec 100644
--- a/chromium/third_party/pdfium/core/fpdfdoc/cpvt_color.h
+++ b/chromium/third_party/pdfium/core/fpdfdoc/cpvt_color.h
@@ -15,10 +15,10 @@ struct CPVT_Color {
enum Type { kTransparent = 0, kGray, kRGB, kCMYK };
CPVT_Color(Type type = kTransparent,
- FX_FLOAT color1 = 0.0f,
- FX_FLOAT color2 = 0.0f,
- FX_FLOAT color3 = 0.0f,
- FX_FLOAT color4 = 0.0f)
+ float color1 = 0.0f,
+ float color2 = 0.0f,
+ float color3 = 0.0f,
+ float color4 = 0.0f)
: nColorType(type),
fColor1(color1),
fColor2(color2),
@@ -26,10 +26,10 @@ struct CPVT_Color {
fColor4(color4) {}
Type nColorType;
- FX_FLOAT fColor1;
- FX_FLOAT fColor2;
- FX_FLOAT fColor3;
- FX_FLOAT fColor4;
+ float fColor1;
+ float fColor2;
+ float fColor3;
+ float fColor4;
static CPVT_Color ParseColor(const CFX_ByteString& str);
static CPVT_Color ParseColor(const CPDF_Array& array);
diff --git a/chromium/third_party/pdfium/core/fpdfdoc/cpvt_floatrect.h b/chromium/third_party/pdfium/core/fpdfdoc/cpvt_floatrect.h
index 6fc4b8ebce5..a8b32dc7e52 100644
--- a/chromium/third_party/pdfium/core/fpdfdoc/cpvt_floatrect.h
+++ b/chromium/third_party/pdfium/core/fpdfdoc/cpvt_floatrect.h
@@ -13,10 +13,10 @@ class CPVT_FloatRect : public CFX_FloatRect {
public:
CPVT_FloatRect() { left = top = right = bottom = 0.0f; }
- CPVT_FloatRect(FX_FLOAT other_left,
- FX_FLOAT other_top,
- FX_FLOAT other_right,
- FX_FLOAT other_bottom) {
+ CPVT_FloatRect(float other_left,
+ float other_top,
+ float other_right,
+ float other_bottom) {
left = other_left;
top = other_top;
right = other_right;
@@ -32,7 +32,7 @@ class CPVT_FloatRect : public CFX_FloatRect {
void Default() { left = top = right = bottom = 0.0f; }
- FX_FLOAT Height() const {
+ float Height() const {
if (top > bottom)
return top - bottom;
return bottom - top;
diff --git a/chromium/third_party/pdfium/core/fpdfdoc/cpvt_fontmap.cpp b/chromium/third_party/pdfium/core/fpdfdoc/cpvt_fontmap.cpp
index 283f60011b2..17ce673fdeb 100644
--- a/chromium/third_party/pdfium/core/fpdfdoc/cpvt_fontmap.cpp
+++ b/chromium/third_party/pdfium/core/fpdfdoc/cpvt_fontmap.cpp
@@ -25,25 +25,23 @@ CPVT_FontMap::CPVT_FontMap(CPDF_Document* pDoc,
CPVT_FontMap::~CPVT_FontMap() {}
-void CPVT_FontMap::GetAnnotSysPDFFont(CPDF_Document* pDoc,
- const CPDF_Dictionary* pResDict,
- CPDF_Font*& pSysFont,
- CFX_ByteString& sSysFontAlias) {
+CPDF_Font* CPVT_FontMap::GetAnnotSysPDFFont(CPDF_Document* pDoc,
+ const CPDF_Dictionary* pResDict,
+ CFX_ByteString* sSysFontAlias) {
if (!pDoc || !pResDict)
- return;
+ return nullptr;
- CFX_ByteString sFontAlias;
CPDF_Dictionary* pFormDict = pDoc->GetRoot()->GetDictFor("AcroForm");
CPDF_Font* pPDFFont = AddNativeInterFormFont(pFormDict, pDoc, sSysFontAlias);
if (!pPDFFont)
- return;
+ return nullptr;
CPDF_Dictionary* pFontList = pResDict->GetDictFor("Font");
- if (pFontList && !pFontList->KeyExist(sSysFontAlias)) {
- pFontList->SetNewFor<CPDF_Reference>(sSysFontAlias, pDoc,
+ if (pFontList && !pFontList->KeyExist(*sSysFontAlias)) {
+ pFontList->SetNewFor<CPDF_Reference>(*sSysFontAlias, pDoc,
pPDFFont->GetFontDict()->GetObjNum());
}
- pSysFont = pPDFFont;
+ return pPDFFont;
}
CPDF_Font* CPVT_FontMap::GetPDFFont(int32_t nFontIndex) {
@@ -52,8 +50,8 @@ CPDF_Font* CPVT_FontMap::GetPDFFont(int32_t nFontIndex) {
return m_pDefFont;
case 1:
if (!m_pSysFont) {
- GetAnnotSysPDFFont(m_pDocument, m_pResDict, m_pSysFont,
- m_sSysFontAlias);
+ m_pSysFont =
+ GetAnnotSysPDFFont(m_pDocument, m_pResDict, &m_sSysFontAlias);
}
return m_pSysFont;
default:
@@ -67,12 +65,12 @@ CFX_ByteString CPVT_FontMap::GetPDFFontAlias(int32_t nFontIndex) {
return m_sDefFontAlias;
case 1:
if (!m_pSysFont) {
- GetAnnotSysPDFFont(m_pDocument, m_pResDict, m_pSysFont,
- m_sSysFontAlias);
+ m_pSysFont =
+ GetAnnotSysPDFFont(m_pDocument, m_pResDict, &m_sSysFontAlias);
}
return m_sSysFontAlias;
default:
- return "";
+ return CFX_ByteString();
}
}
diff --git a/chromium/third_party/pdfium/core/fpdfdoc/cpvt_fontmap.h b/chromium/third_party/pdfium/core/fpdfdoc/cpvt_fontmap.h
index 98e390f4097..6080010cac9 100644
--- a/chromium/third_party/pdfium/core/fpdfdoc/cpvt_fontmap.h
+++ b/chromium/third_party/pdfium/core/fpdfdoc/cpvt_fontmap.h
@@ -33,10 +33,9 @@ class CPVT_FontMap : public IPVT_FontMap {
int32_t CharCodeFromUnicode(int32_t nFontIndex, uint16_t word) override;
int32_t CharSetFromUnicode(uint16_t word, int32_t nOldCharset) override;
- static void GetAnnotSysPDFFont(CPDF_Document* pDoc,
- const CPDF_Dictionary* pResDict,
- CPDF_Font*& pSysFont,
- CFX_ByteString& sSysFontAlias);
+ static CPDF_Font* GetAnnotSysPDFFont(CPDF_Document* pDoc,
+ const CPDF_Dictionary* pResDict,
+ CFX_ByteString* sSysFontAlias);
private:
CPDF_Document* const m_pDocument;
diff --git a/chromium/third_party/pdfium/core/fpdfdoc/cpvt_generateap.cpp b/chromium/third_party/pdfium/core/fpdfdoc/cpvt_generateap.cpp
index 15515151bc1..bcd3aa1d00a 100644
--- a/chromium/third_party/pdfium/core/fpdfdoc/cpvt_generateap.cpp
+++ b/chromium/third_party/pdfium/core/fpdfdoc/cpvt_generateap.cpp
@@ -54,7 +54,7 @@ bool GenerateWidgetAP(CPDF_Document* pDoc,
if (sFontName.IsEmpty())
return false;
- FX_FLOAT fFontSize = FX_atof(syntax.GetWord());
+ float fFontSize = FX_atof(syntax.GetWord());
CPVT_Color crText = CPVT_Color::ParseColor(DA);
CPDF_Dictionary* pDRDict = pFormDict->GetDictFor("DR");
if (!pDRDict)
@@ -109,7 +109,7 @@ bool GenerateWidgetAP(CPDF_Document* pDoc,
}
BorderStyle nBorderStyle = BorderStyle::SOLID;
- FX_FLOAT fBorderWidth = 1;
+ float fBorderWidth = 1;
CPVT_Dash dsBorder(3, 0, 0);
CPVT_Color crLeftTop, crRightBottom;
if (CPDF_Dictionary* pBSDict = pAnnotDict->GetDictFor("BS")) {
@@ -353,7 +353,7 @@ bool GenerateWidgetAP(CPDF_Document* pDoc,
int32_t nTop = pTi ? pTi->GetInteger() : 0;
CFX_ByteTextBuf sBody;
if (pOpts) {
- FX_FLOAT fy = rcBody.top;
+ float fy = rcBody.top;
for (size_t i = nTop, sz = pOpts->GetCount(); i < sz; i++) {
if (IsFloatSmaller(fy, rcBody.bottom))
break;
@@ -384,7 +384,7 @@ bool GenerateWidgetAP(CPDF_Document* pDoc,
vt.Initialize();
vt.SetText(swItem);
vt.RearrangeAll();
- FX_FLOAT fItemHeight = vt.GetContentRect().Height();
+ float fItemHeight = vt.GetContentRect().Height();
if (bSelected) {
CFX_FloatRect rcItem = CFX_FloatRect(
rcBody.left, fy - fItemHeight, rcBody.right, fy);
@@ -463,7 +463,7 @@ CFX_ByteString GetColorStringWithDefault(CPDF_Array* pColor,
return CPVT_GenerateAP::GenerateColorAP(crDefaultColor, nOperation);
}
-FX_FLOAT GetBorderWidth(const CPDF_Dictionary& pAnnotDict) {
+float GetBorderWidth(const CPDF_Dictionary& pAnnotDict) {
if (CPDF_Dictionary* pBorderStyleDict = pAnnotDict.GetDictFor("BS")) {
if (pBorderStyleDict->KeyExist("W"))
return pBorderStyleDict->GetNumberFor("W");
@@ -552,7 +552,7 @@ std::unique_ptr<CPDF_Dictionary> GenerateExtGStateDict(
pdfium::MakeUnique<CPDF_Dictionary>(pAnnotDict.GetByteStringPool());
pGSDict->SetNewFor<CPDF_String>("Type", "ExtGState", false);
- FX_FLOAT fOpacity =
+ float fOpacity =
pAnnotDict.KeyExist("CA") ? pAnnotDict.GetNumberFor("CA") : 1;
pGSDict->SetNewFor<CPDF_Number>("CA", fOpacity);
pGSDict->SetNewFor<CPDF_Number>("ca", fOpacity);
@@ -630,11 +630,11 @@ CFX_ByteString GenerateTextSymbolAP(const CFX_FloatRect& rect) {
sAppStream << CPVT_GenerateAP::GenerateColorAP(
CPVT_Color(CPVT_Color::kRGB, 0, 0, 0), PaintOperation::STROKE);
- const FX_FLOAT fBorderWidth = 1;
+ const float fBorderWidth = 1;
sAppStream << fBorderWidth << " w\n";
- const FX_FLOAT fHalfWidth = fBorderWidth / 2;
- const FX_FLOAT fTipDelta = 4;
+ const float fHalfWidth = fBorderWidth / 2;
+ const float fTipDelta = 4;
CFX_FloatRect outerRect1 = rect;
outerRect1.Deflate(fHalfWidth, fHalfWidth);
@@ -644,7 +644,7 @@ CFX_ByteString GenerateTextSymbolAP(const CFX_FloatRect& rect) {
outerRect2.left += fTipDelta;
outerRect2.right = outerRect2.left + fTipDelta;
outerRect2.top = outerRect2.bottom - fTipDelta;
- FX_FLOAT outerRect2Middle = (outerRect2.left + outerRect2.right) / 2;
+ float outerRect2Middle = (outerRect2.left + outerRect2.right) / 2;
// Draw outer boxes.
sAppStream << outerRect1.left << " " << outerRect1.bottom << " m\n"
@@ -658,8 +658,8 @@ CFX_ByteString GenerateTextSymbolAP(const CFX_FloatRect& rect) {
// Draw inner lines.
CFX_FloatRect lineRect = outerRect1;
- const FX_FLOAT fXDelta = 2;
- const FX_FLOAT fYDelta = (lineRect.top - lineRect.bottom) / 4;
+ const float fXDelta = 2;
+ const float fYDelta = (lineRect.top - lineRect.bottom) / 4;
lineRect.left += fXDelta;
lineRect.right -= fXDelta;
@@ -744,7 +744,7 @@ bool CPVT_GenerateAP::GenerateCircleAP(CPDF_Document* pDoc,
CPVT_Color(CPVT_Color::kRGB, 0, 0, 0),
PaintOperation::STROKE);
- FX_FLOAT fBorderWidth = GetBorderWidth(*pAnnotDict);
+ float fBorderWidth = GetBorderWidth(*pAnnotDict);
bool bIsStrokeRect = fBorderWidth > 0;
if (bIsStrokeRect) {
@@ -762,15 +762,15 @@ bool CPVT_GenerateAP::GenerateCircleAP(CPDF_Document* pDoc,
rect.Deflate(fBorderWidth / 2, fBorderWidth / 2);
}
- const FX_FLOAT fMiddleX = (rect.left + rect.right) / 2;
- const FX_FLOAT fMiddleY = (rect.top + rect.bottom) / 2;
+ const float fMiddleX = (rect.left + rect.right) / 2;
+ const float fMiddleY = (rect.top + rect.bottom) / 2;
// |fL| is precalculated approximate value of 4 * tan((3.14 / 2) / 4) / 3,
// where |fL| * radius is a good approximation of control points for
// arc with 90 degrees.
- const FX_FLOAT fL = 0.5523f;
- const FX_FLOAT fDeltaX = fL * rect.Width() / 2.0;
- const FX_FLOAT fDeltaY = fL * rect.Height() / 2.0;
+ const float fL = 0.5523f;
+ const float fDeltaX = fL * rect.Width() / 2.0;
+ const float fDeltaY = fL * rect.Height() / 2.0;
// Starting point
sAppStream << fMiddleX << " " << rect.top << " m\n";
@@ -833,7 +833,7 @@ bool CPVT_GenerateAP::GenerateHighlightAP(CPDF_Document* pDoc,
bool CPVT_GenerateAP::GenerateInkAP(CPDF_Document* pDoc,
CPDF_Dictionary* pAnnotDict) {
- FX_FLOAT fBorderWidth = GetBorderWidth(*pAnnotDict);
+ float fBorderWidth = GetBorderWidth(*pAnnotDict);
bool bIsStroke = fBorderWidth > 0;
if (!bIsStroke)
@@ -892,7 +892,7 @@ bool CPVT_GenerateAP::GenerateTextAP(CPDF_Document* pDoc,
sAppStream << "/" << sExtGSDictName << " gs ";
CFX_FloatRect rect = pAnnotDict->GetRectFor("Rect");
- const FX_FLOAT fNoteLength = 20;
+ const float fNoteLength = 20;
CFX_FloatRect noteRect(rect.left, rect.bottom, rect.left + fNoteLength,
rect.bottom + fNoteLength);
pAnnotDict->SetRectFor("Rect", noteRect);
@@ -921,7 +921,7 @@ bool CPVT_GenerateAP::GenerateUnderlineAP(CPDF_Document* pDoc,
CFX_FloatRect rect = CPDF_Annot::RectFromQuadPoints(pAnnotDict);
rect.Normalize();
- FX_FLOAT fLineWidth = 1.0;
+ float fLineWidth = 1.0;
sAppStream << fLineWidth << " w " << rect.left << " "
<< rect.bottom + fLineWidth << " m " << rect.right << " "
<< rect.bottom + fLineWidth << " l S\n";
@@ -946,7 +946,7 @@ bool CPVT_GenerateAP::GeneratePopupAP(CPDF_Document* pDoc,
sAppStream << GenerateColorAP(CPVT_Color(CPVT_Color::kRGB, 0, 0, 0),
PaintOperation::STROKE);
- const FX_FLOAT fBorderWidth = 1;
+ const float fBorderWidth = 1;
sAppStream << fBorderWidth << " w\n";
CFX_FloatRect rect = pAnnotDict->GetRectFor("Rect");
@@ -988,7 +988,7 @@ bool CPVT_GenerateAP::GenerateSquareAP(CPDF_Document* pDoc,
CPVT_Color(CPVT_Color::kRGB, 0, 0, 0),
PaintOperation::STROKE);
- FX_FLOAT fBorderWidth = GetBorderWidth(*pAnnotDict);
+ float fBorderWidth = GetBorderWidth(*pAnnotDict);
bool bIsStrokeRect = fBorderWidth > 0;
if (bIsStrokeRect) {
@@ -1034,16 +1034,16 @@ bool CPVT_GenerateAP::GenerateSquigglyAP(CPDF_Document* pDoc,
CFX_FloatRect rect = CPDF_Annot::RectFromQuadPoints(pAnnotDict);
rect.Normalize();
- FX_FLOAT fLineWidth = 1.0;
+ float fLineWidth = 1.0;
sAppStream << fLineWidth << " w ";
- const FX_FLOAT fDelta = 2.0;
- const FX_FLOAT fTop = rect.bottom + fDelta;
- const FX_FLOAT fBottom = rect.bottom;
+ const float fDelta = 2.0;
+ const float fTop = rect.bottom + fDelta;
+ const float fBottom = rect.bottom;
sAppStream << rect.left << " " << fTop << " m ";
- FX_FLOAT fX = rect.left + fDelta;
+ float fX = rect.left + fDelta;
bool isUpwards = false;
while (fX < rect.right) {
@@ -1053,7 +1053,7 @@ bool CPVT_GenerateAP::GenerateSquigglyAP(CPDF_Document* pDoc,
isUpwards = !isUpwards;
}
- FX_FLOAT fRemainder = rect.right - (fX - fDelta);
+ float fRemainder = rect.right - (fX - fDelta);
if (isUpwards)
sAppStream << rect.right << " " << fBottom + fRemainder << " l ";
else
@@ -1083,8 +1083,8 @@ bool CPVT_GenerateAP::GenerateStrikeOutAP(CPDF_Document* pDoc,
CFX_FloatRect rect = CPDF_Annot::RectFromQuadPoints(pAnnotDict);
rect.Normalize();
- FX_FLOAT fLineWidth = 1.0;
- FX_FLOAT fY = (rect.top + rect.bottom) / 2;
+ float fLineWidth = 1.0;
+ float fY = (rect.top + rect.bottom) / 2;
sAppStream << fLineWidth << " w " << rect.left << " " << fY << " m "
<< rect.right << " " << fY << " l S\n";
@@ -1184,7 +1184,7 @@ CFX_ByteString CPVT_GenerateAP::GenerateEditAP(
// Static.
CFX_ByteString CPVT_GenerateAP::GenerateBorderAP(
const CFX_FloatRect& rect,
- FX_FLOAT fWidth,
+ float fWidth,
const CPVT_Color& color,
const CPVT_Color& crLeftTop,
const CPVT_Color& crRightBottom,
@@ -1192,12 +1192,12 @@ CFX_ByteString CPVT_GenerateAP::GenerateBorderAP(
const CPVT_Dash& dash) {
CFX_ByteTextBuf sAppStream;
CFX_ByteString sColor;
- FX_FLOAT fLeft = rect.left;
- FX_FLOAT fRight = rect.right;
- FX_FLOAT fTop = rect.top;
- FX_FLOAT fBottom = rect.bottom;
+ float fLeft = rect.left;
+ float fRight = rect.right;
+ float fTop = rect.top;
+ float fBottom = rect.bottom;
if (fWidth > 0.0f) {
- FX_FLOAT fHalfWidth = fWidth / 2.0f;
+ float fHalfWidth = fWidth / 2.0f;
switch (nStyle) {
default:
case BorderStyle::SOLID:
@@ -1338,7 +1338,7 @@ CFX_ByteString CPVT_GenerateAP::GetPDFWordString(IPVT_FontMap* pFontMap,
} else {
uint32_t dwCharCode = pPDFFont->CharCodeFromUnicode(Word);
if (dwCharCode != CPDF_Font::kInvalidCharCode)
- pPDFFont->AppendChar(sWord, dwCharCode);
+ pPDFFont->AppendChar(&sWord, dwCharCode);
}
}
return sWord;
@@ -1355,7 +1355,7 @@ CFX_ByteString CPVT_GenerateAP::GetWordRenderString(
// Static.
CFX_ByteString CPVT_GenerateAP::GetFontSetString(IPVT_FontMap* pFontMap,
int32_t nFontIndex,
- FX_FLOAT fFontSize) {
+ float fFontSize) {
CFX_ByteTextBuf sRet;
if (pFontMap) {
CFX_ByteString sFontAlias = pFontMap->GetPDFFontAlias(nFontIndex);
diff --git a/chromium/third_party/pdfium/core/fpdfdoc/cpvt_generateap.h b/chromium/third_party/pdfium/core/fpdfdoc/cpvt_generateap.h
index 62a84531eee..c5586362556 100644
--- a/chromium/third_party/pdfium/core/fpdfdoc/cpvt_generateap.h
+++ b/chromium/third_party/pdfium/core/fpdfdoc/cpvt_generateap.h
@@ -52,7 +52,7 @@ class CPVT_GenerateAP {
bool bContinuous,
uint16_t SubWord);
static CFX_ByteString GenerateBorderAP(const CFX_FloatRect& rect,
- FX_FLOAT fWidth,
+ float fWidth,
const CPVT_Color& color,
const CPVT_Color& crLeftTop,
const CPVT_Color& crRightBottom,
@@ -68,7 +68,7 @@ class CPVT_GenerateAP {
static CFX_ByteString GetWordRenderString(const CFX_ByteString& strWords);
static CFX_ByteString GetFontSetString(IPVT_FontMap* pFontMap,
int32_t nFontIndex,
- FX_FLOAT fFontSize);
+ float fFontSize);
};
#endif // CORE_FPDFDOC_CPVT_GENERATEAP_H_
diff --git a/chromium/third_party/pdfium/core/fpdfdoc/cpvt_line.h b/chromium/third_party/pdfium/core/fpdfdoc/cpvt_line.h
index 47c3e84d6ac..087034d3d5f 100644
--- a/chromium/third_party/pdfium/core/fpdfdoc/cpvt_line.h
+++ b/chromium/third_party/pdfium/core/fpdfdoc/cpvt_line.h
@@ -18,9 +18,9 @@ class CPVT_Line {
CPVT_WordPlace lineplace;
CPVT_WordPlace lineEnd;
CFX_PointF ptLine;
- FX_FLOAT fLineWidth;
- FX_FLOAT fLineAscent;
- FX_FLOAT fLineDescent;
+ float fLineWidth;
+ float fLineAscent;
+ float fLineDescent;
};
inline CPVT_Line::CPVT_Line()
diff --git a/chromium/third_party/pdfium/core/fpdfdoc/cpvt_lineinfo.h b/chromium/third_party/pdfium/core/fpdfdoc/cpvt_lineinfo.h
index 8fb10de2507..96a32343807 100644
--- a/chromium/third_party/pdfium/core/fpdfdoc/cpvt_lineinfo.h
+++ b/chromium/third_party/pdfium/core/fpdfdoc/cpvt_lineinfo.h
@@ -16,11 +16,11 @@ class CPVT_LineInfo {
int32_t nTotalWord;
int32_t nBeginWordIndex;
int32_t nEndWordIndex;
- FX_FLOAT fLineX;
- FX_FLOAT fLineY;
- FX_FLOAT fLineWidth;
- FX_FLOAT fLineAscent;
- FX_FLOAT fLineDescent;
+ float fLineX;
+ float fLineY;
+ float fLineWidth;
+ float fLineAscent;
+ float fLineDescent;
};
inline CPVT_LineInfo::CPVT_LineInfo()
diff --git a/chromium/third_party/pdfium/core/fpdfdoc/cpvt_secprops.h b/chromium/third_party/pdfium/core/fpdfdoc/cpvt_secprops.h
index d1c4b589f11..93829f9b007 100644
--- a/chromium/third_party/pdfium/core/fpdfdoc/cpvt_secprops.h
+++ b/chromium/third_party/pdfium/core/fpdfdoc/cpvt_secprops.h
@@ -12,7 +12,7 @@
struct CPVT_SecProps {
CPVT_SecProps() : fLineLeading(0.0f), fLineIndent(0.0f), nAlignment(0) {}
- CPVT_SecProps(FX_FLOAT lineLeading, FX_FLOAT lineIndent, int32_t alignment)
+ CPVT_SecProps(float lineLeading, float lineIndent, int32_t alignment)
: fLineLeading(lineLeading),
fLineIndent(lineIndent),
nAlignment(alignment) {}
@@ -22,8 +22,8 @@ struct CPVT_SecProps {
fLineIndent(other.fLineIndent),
nAlignment(other.nAlignment) {}
- FX_FLOAT fLineLeading;
- FX_FLOAT fLineIndent;
+ float fLineLeading;
+ float fLineIndent;
int32_t nAlignment;
};
diff --git a/chromium/third_party/pdfium/core/fpdfdoc/cpvt_word.h b/chromium/third_party/pdfium/core/fpdfdoc/cpvt_word.h
index 540f0416ad5..28e192467be 100644
--- a/chromium/third_party/pdfium/core/fpdfdoc/cpvt_word.h
+++ b/chromium/third_party/pdfium/core/fpdfdoc/cpvt_word.h
@@ -19,11 +19,11 @@ class CPVT_Word {
int32_t nCharset;
CPVT_WordPlace WordPlace;
CFX_PointF ptWord;
- FX_FLOAT fAscent;
- FX_FLOAT fDescent;
- FX_FLOAT fWidth;
+ float fAscent;
+ float fDescent;
+ float fWidth;
int32_t nFontIndex;
- FX_FLOAT fFontSize;
+ float fFontSize;
CPVT_WordProps WordProps;
};
diff --git a/chromium/third_party/pdfium/core/fpdfdoc/cpvt_wordinfo.h b/chromium/third_party/pdfium/core/fpdfdoc/cpvt_wordinfo.h
index 861534b0a52..00f5a45e708 100644
--- a/chromium/third_party/pdfium/core/fpdfdoc/cpvt_wordinfo.h
+++ b/chromium/third_party/pdfium/core/fpdfdoc/cpvt_wordinfo.h
@@ -25,9 +25,9 @@ struct CPVT_WordInfo {
uint16_t Word;
int32_t nCharset;
- FX_FLOAT fWordX;
- FX_FLOAT fWordY;
- FX_FLOAT fWordTail;
+ float fWordX;
+ float fWordY;
+ float fWordTail;
int32_t nFontIndex;
std::unique_ptr<CPVT_WordProps> pWordProps;
};
diff --git a/chromium/third_party/pdfium/core/fpdfdoc/cpvt_wordplace.h b/chromium/third_party/pdfium/core/fpdfdoc/cpvt_wordplace.h
index f4a6b087b92..c0a1a9cd5c3 100644
--- a/chromium/third_party/pdfium/core/fpdfdoc/cpvt_wordplace.h
+++ b/chromium/third_party/pdfium/core/fpdfdoc/cpvt_wordplace.h
@@ -14,55 +14,55 @@ struct CPVT_WordPlace {
CPVT_WordPlace(int32_t other_nSecIndex,
int32_t other_nLineIndex,
- int32_t other_nWordIndex) {
- nSecIndex = other_nSecIndex;
- nLineIndex = other_nLineIndex;
- nWordIndex = other_nWordIndex;
+ int32_t other_nWordIndex)
+ : nSecIndex(other_nSecIndex),
+ nLineIndex(other_nLineIndex),
+ nWordIndex(other_nWordIndex) {}
+
+ void Reset() {
+ nSecIndex = -1;
+ nLineIndex = -1;
+ nWordIndex = -1;
}
- void Default() { nSecIndex = nLineIndex = nWordIndex = -1; }
+ void AdvanceSection() {
+ nSecIndex++;
+ nLineIndex = 0;
+ nWordIndex = -1;
+ }
- bool operator==(const CPVT_WordPlace& wp) const {
+ inline bool operator==(const CPVT_WordPlace& wp) const {
return wp.nSecIndex == nSecIndex && wp.nLineIndex == nLineIndex &&
wp.nWordIndex == nWordIndex;
}
-
- bool operator!=(const CPVT_WordPlace& wp) const { return !(*this == wp); }
-
- inline int32_t WordCmp(const CPVT_WordPlace& wp) const {
- if (nSecIndex > wp.nSecIndex)
- return 1;
- if (nSecIndex < wp.nSecIndex)
- return -1;
- if (nLineIndex > wp.nLineIndex)
- return 1;
- if (nLineIndex < wp.nLineIndex)
- return -1;
- if (nWordIndex > wp.nWordIndex)
- return 1;
- if (nWordIndex < wp.nWordIndex)
- return -1;
- return 0;
+ inline bool operator!=(const CPVT_WordPlace& wp) const {
+ return !(*this == wp);
}
-
- inline int32_t LineCmp(const CPVT_WordPlace& wp) const {
- if (nSecIndex > wp.nSecIndex)
- return 1;
- if (nSecIndex < wp.nSecIndex)
- return -1;
- if (nLineIndex > wp.nLineIndex)
- return 1;
- if (nLineIndex < wp.nLineIndex)
- return -1;
- return 0;
+ inline bool operator<(const CPVT_WordPlace& wp) const {
+ if (nSecIndex != wp.nSecIndex)
+ return nSecIndex < wp.nSecIndex;
+ if (nLineIndex != wp.nLineIndex)
+ return nLineIndex < wp.nLineIndex;
+ return nWordIndex < wp.nWordIndex;
+ }
+ inline bool operator>(const CPVT_WordPlace& wp) const {
+ if (nSecIndex != wp.nSecIndex)
+ return nSecIndex > wp.nSecIndex;
+ if (nLineIndex != wp.nLineIndex)
+ return nLineIndex > wp.nLineIndex;
+ return nWordIndex > wp.nWordIndex;
+ }
+ inline bool operator<=(const CPVT_WordPlace& wp) const {
+ return *this < wp || *this == wp;
+ }
+ inline bool operator>=(const CPVT_WordPlace& wp) const {
+ return *this > wp || *this == wp;
}
- inline int32_t SecCmp(const CPVT_WordPlace& wp) const {
- if (nSecIndex > wp.nSecIndex)
- return 1;
- if (nSecIndex < wp.nSecIndex)
- return -1;
- return 0;
+ inline int32_t LineCmp(const CPVT_WordPlace& wp) const {
+ if (nSecIndex != wp.nSecIndex)
+ return nSecIndex - wp.nSecIndex;
+ return nLineIndex - wp.nLineIndex;
}
int32_t nSecIndex;
diff --git a/chromium/third_party/pdfium/core/fpdfdoc/cpvt_wordprops.h b/chromium/third_party/pdfium/core/fpdfdoc/cpvt_wordprops.h
index 2b7084116ae..2d0e5d51b3b 100644
--- a/chromium/third_party/pdfium/core/fpdfdoc/cpvt_wordprops.h
+++ b/chromium/third_party/pdfium/core/fpdfdoc/cpvt_wordprops.h
@@ -22,12 +22,12 @@ struct CPVT_WordProps {
nHorzScale(0) {}
CPVT_WordProps(int32_t fontIndex,
- FX_FLOAT fontSize,
+ float fontSize,
FX_COLORREF wordColor = 0,
CPDF_VariableText::ScriptType scriptType =
CPDF_VariableText::ScriptType::Normal,
int32_t wordStyle = 0,
- FX_FLOAT charSpace = 0,
+ float charSpace = 0,
int32_t horzScale = 100)
: nFontIndex(fontIndex),
fFontSize(fontSize),
@@ -47,11 +47,11 @@ struct CPVT_WordProps {
nHorzScale(other.nHorzScale) {}
int32_t nFontIndex;
- FX_FLOAT fFontSize;
+ float fFontSize;
FX_COLORREF dwWordColor;
CPDF_VariableText::ScriptType nScriptType;
int32_t nWordStyle;
- FX_FLOAT fCharSpace;
+ float fCharSpace;
int32_t nHorzScale;
};
diff --git a/chromium/third_party/pdfium/core/fpdfdoc/cpvt_wordrange.h b/chromium/third_party/pdfium/core/fpdfdoc/cpvt_wordrange.h
index b291e50e53b..ed06d6f0de6 100644
--- a/chromium/third_party/pdfium/core/fpdfdoc/cpvt_wordrange.h
+++ b/chromium/third_party/pdfium/core/fpdfdoc/cpvt_wordrange.h
@@ -7,49 +7,51 @@
#ifndef CORE_FPDFDOC_CPVT_WORDRANGE_H_
#define CORE_FPDFDOC_CPVT_WORDRANGE_H_
+#include <utility>
+
#include "core/fpdfdoc/cpvt_wordplace.h"
#include "core/fxcrt/fx_system.h"
struct CPVT_WordRange {
CPVT_WordRange() {}
- CPVT_WordRange(const CPVT_WordPlace& begin, const CPVT_WordPlace& end) {
- Set(begin, end);
+ CPVT_WordRange(const CPVT_WordPlace& begin, const CPVT_WordPlace& end)
+ : BeginPos(begin), EndPos(end) {
+ Normalize();
}
- void Default() {
- BeginPos.Default();
- EndPos.Default();
+ void Reset() {
+ BeginPos.Reset();
+ EndPos.Reset();
}
void Set(const CPVT_WordPlace& begin, const CPVT_WordPlace& end) {
BeginPos = begin;
EndPos = end;
- SwapWordPlace();
+ Normalize();
}
void SetBeginPos(const CPVT_WordPlace& begin) {
BeginPos = begin;
- SwapWordPlace();
+ Normalize();
}
void SetEndPos(const CPVT_WordPlace& end) {
EndPos = end;
- SwapWordPlace();
+ Normalize();
}
- bool IsExist() const { return BeginPos != EndPos; }
-
- bool operator!=(const CPVT_WordRange& wr) const {
- return wr.BeginPos != BeginPos || wr.EndPos != EndPos;
+ inline bool IsEmpty() const { return BeginPos == EndPos; }
+ inline bool operator==(const CPVT_WordRange& wr) const {
+ return wr.BeginPos == BeginPos && wr.EndPos == EndPos;
+ }
+ inline bool operator!=(const CPVT_WordRange& wr) const {
+ return !(*this == wr);
}
- void SwapWordPlace() {
- if (BeginPos.WordCmp(EndPos) > 0) {
- CPVT_WordPlace place = EndPos;
- EndPos = BeginPos;
- BeginPos = place;
- }
+ void Normalize() {
+ if (BeginPos > EndPos)
+ std::swap(BeginPos, EndPos);
}
CPVT_WordPlace BeginPos;
diff --git a/chromium/third_party/pdfium/core/fpdfdoc/csection.cpp b/chromium/third_party/pdfium/core/fpdfdoc/csection.cpp
index 490ef1b2306..b6f45a274cd 100644
--- a/chromium/third_party/pdfium/core/fpdfdoc/csection.cpp
+++ b/chromium/third_party/pdfium/core/fpdfdoc/csection.cpp
@@ -10,138 +10,114 @@
#include "core/fpdfdoc/cline.h"
#include "core/fpdfdoc/cpvt_wordinfo.h"
+#include "third_party/base/ptr_util.h"
+#include "third_party/base/stl_util.h"
CSection::CSection(CPDF_VariableText* pVT) : m_pVT(pVT) {}
-CSection::~CSection() {
- ResetAll();
-}
+CSection::~CSection() {}
void CSection::ResetAll() {
- ResetWordArray();
- ResetLineArray();
-}
-
-void CSection::ResetLineArray() {
- m_LineArray.RemoveAll();
-}
-
-void CSection::ResetWordArray() {
- for (int32_t i = 0, sz = m_WordArray.GetSize(); i < sz; i++) {
- delete m_WordArray.GetAt(i);
- }
- m_WordArray.RemoveAll();
+ m_WordArray.clear();
+ m_LineArray.clear();
}
void CSection::ResetLinePlace() {
- for (int32_t i = 0, sz = m_LineArray.GetSize(); i < sz; i++) {
- if (CLine* pLine = m_LineArray.GetAt(i)) {
- pLine->LinePlace = CPVT_WordPlace(SecPlace.nSecIndex, i, -1);
- }
+ int32_t i = 0;
+ for (auto& pLine : m_LineArray) {
+ pLine->LinePlace = CPVT_WordPlace(SecPlace.nSecIndex, i, -1);
+ ++i;
}
}
CPVT_WordPlace CSection::AddWord(const CPVT_WordPlace& place,
const CPVT_WordInfo& wordinfo) {
- CPVT_WordInfo* pWord = new CPVT_WordInfo(wordinfo);
- int32_t nWordIndex =
- std::max(std::min(place.nWordIndex, m_WordArray.GetSize()), 0);
- if (nWordIndex == m_WordArray.GetSize()) {
- m_WordArray.Add(pWord);
- } else {
- m_WordArray.InsertAt(nWordIndex, pWord);
- }
+ int32_t nWordIndex = pdfium::clamp(
+ place.nWordIndex, 0, pdfium::CollectionSize<int32_t>(m_WordArray));
+ m_WordArray.insert(m_WordArray.begin() + nWordIndex,
+ pdfium::MakeUnique<CPVT_WordInfo>(wordinfo));
return place;
}
CPVT_WordPlace CSection::AddLine(const CPVT_LineInfo& lineinfo) {
- return CPVT_WordPlace(SecPlace.nSecIndex, m_LineArray.Add(lineinfo), -1);
+ m_LineArray.push_back(pdfium::MakeUnique<CLine>(lineinfo));
+ return CPVT_WordPlace(SecPlace.nSecIndex, m_LineArray.size() - 1, -1);
}
CPVT_FloatRect CSection::Rearrange() {
- if (m_pVT->m_nCharArray > 0) {
+ if (m_pVT->m_nCharArray > 0)
return CTypeset(this).CharArray();
- }
return CTypeset(this).Typeset();
}
-CFX_SizeF CSection::GetSectionSize(FX_FLOAT fFontSize) {
+CFX_SizeF CSection::GetSectionSize(float fFontSize) {
return CTypeset(this).GetEditSize(fFontSize);
}
CPVT_WordPlace CSection::GetBeginWordPlace() const {
- if (CLine* pLine = m_LineArray.GetAt(0)) {
- return pLine->GetBeginWordPlace();
- }
- return SecPlace;
+ if (m_LineArray.empty())
+ return SecPlace;
+ return m_LineArray.front()->GetBeginWordPlace();
}
CPVT_WordPlace CSection::GetEndWordPlace() const {
- if (CLine* pLine = m_LineArray.GetAt(m_LineArray.GetSize() - 1)) {
- return pLine->GetEndWordPlace();
- }
- return SecPlace;
+ if (m_LineArray.empty())
+ return SecPlace;
+ return m_LineArray.back()->GetEndWordPlace();
}
CPVT_WordPlace CSection::GetPrevWordPlace(const CPVT_WordPlace& place) const {
- if (place.nLineIndex < 0) {
+ if (place.nLineIndex < 0)
return GetBeginWordPlace();
- }
- if (place.nLineIndex >= m_LineArray.GetSize()) {
+
+ if (place.nLineIndex >= pdfium::CollectionSize<int32_t>(m_LineArray))
return GetEndWordPlace();
- }
- if (CLine* pLine = m_LineArray.GetAt(place.nLineIndex)) {
- if (place.nWordIndex == pLine->m_LineInfo.nBeginWordIndex) {
- return CPVT_WordPlace(place.nSecIndex, place.nLineIndex, -1);
- }
- if (place.nWordIndex < pLine->m_LineInfo.nBeginWordIndex) {
- if (CLine* pPrevLine = m_LineArray.GetAt(place.nLineIndex - 1)) {
- return pPrevLine->GetEndWordPlace();
- }
- } else {
- return pLine->GetPrevWordPlace(place);
- }
- }
- return place;
+
+ CLine* pLine = m_LineArray[place.nLineIndex].get();
+ if (place.nWordIndex == pLine->m_LineInfo.nBeginWordIndex)
+ return CPVT_WordPlace(place.nSecIndex, place.nLineIndex, -1);
+
+ if (place.nWordIndex >= pLine->m_LineInfo.nBeginWordIndex)
+ return pLine->GetPrevWordPlace(place);
+
+ if (!pdfium::IndexInBounds(m_LineArray, place.nLineIndex - 1))
+ return place;
+
+ return m_LineArray[place.nLineIndex - 1]->GetEndWordPlace();
}
CPVT_WordPlace CSection::GetNextWordPlace(const CPVT_WordPlace& place) const {
- if (place.nLineIndex < 0) {
+ if (place.nLineIndex < 0)
return GetBeginWordPlace();
- }
- if (place.nLineIndex >= m_LineArray.GetSize()) {
+
+ if (place.nLineIndex >= pdfium::CollectionSize<int32_t>(m_LineArray))
return GetEndWordPlace();
- }
- if (CLine* pLine = m_LineArray.GetAt(place.nLineIndex)) {
- if (place.nWordIndex >= pLine->m_LineInfo.nEndWordIndex) {
- if (CLine* pNextLine = m_LineArray.GetAt(place.nLineIndex + 1)) {
- return pNextLine->GetBeginWordPlace();
- }
- } else {
- return pLine->GetNextWordPlace(place);
- }
- }
- return place;
+
+ CLine* pLine = m_LineArray[place.nLineIndex].get();
+ if (place.nWordIndex < pLine->m_LineInfo.nEndWordIndex)
+ return pLine->GetNextWordPlace(place);
+
+ if (!pdfium::IndexInBounds(m_LineArray, place.nLineIndex + 1))
+ return place;
+
+ return m_LineArray[place.nLineIndex + 1]->GetBeginWordPlace();
}
void CSection::UpdateWordPlace(CPVT_WordPlace& place) const {
int32_t nLeft = 0;
- int32_t nRight = m_LineArray.GetSize() - 1;
+ int32_t nRight = pdfium::CollectionSize<int32_t>(m_LineArray) - 1;
int32_t nMid = (nLeft + nRight) / 2;
while (nLeft <= nRight) {
- if (CLine* pLine = m_LineArray.GetAt(nMid)) {
- if (place.nWordIndex < pLine->m_LineInfo.nBeginWordIndex) {
- nRight = nMid - 1;
- nMid = (nLeft + nRight) / 2;
- } else if (place.nWordIndex > pLine->m_LineInfo.nEndWordIndex) {
- nLeft = nMid + 1;
- nMid = (nLeft + nRight) / 2;
- } else {
- place.nLineIndex = nMid;
- return;
- }
+ CLine* pLine = m_LineArray[nMid].get();
+ if (place.nWordIndex < pLine->m_LineInfo.nBeginWordIndex) {
+ nRight = nMid - 1;
+ nMid = (nLeft + nRight) / 2;
+ } else if (place.nWordIndex > pLine->m_LineInfo.nEndWordIndex) {
+ nLeft = nMid + 1;
+ nMid = (nLeft + nRight) / 2;
} else {
- break;
+ place.nLineIndex = nMid;
+ return;
}
}
}
@@ -152,61 +128,55 @@ CPVT_WordPlace CSection::SearchWordPlace(const CFX_PointF& point) const {
bool bUp = true;
bool bDown = true;
int32_t nLeft = 0;
- int32_t nRight = m_LineArray.GetSize() - 1;
- int32_t nMid = m_LineArray.GetSize() / 2;
- FX_FLOAT fTop = 0;
- FX_FLOAT fBottom = 0;
+ int32_t nRight = pdfium::CollectionSize<int32_t>(m_LineArray) - 1;
+ int32_t nMid = pdfium::CollectionSize<int32_t>(m_LineArray) / 2;
while (nLeft <= nRight) {
- if (CLine* pLine = m_LineArray.GetAt(nMid)) {
- fTop = pLine->m_LineInfo.fLineY - pLine->m_LineInfo.fLineAscent -
- m_pVT->GetLineLeading(m_SecInfo);
- fBottom = pLine->m_LineInfo.fLineY - pLine->m_LineInfo.fLineDescent;
- if (IsFloatBigger(point.y, fTop)) {
- bUp = false;
- }
- if (IsFloatSmaller(point.y, fBottom)) {
- bDown = false;
- }
- if (IsFloatSmaller(point.y, fTop)) {
- nRight = nMid - 1;
- nMid = (nLeft + nRight) / 2;
- continue;
- } else if (IsFloatBigger(point.y, fBottom)) {
- nLeft = nMid + 1;
- nMid = (nLeft + nRight) / 2;
- continue;
- } else {
- place = SearchWordPlace(
- point.x,
- CPVT_WordRange(pLine->GetNextWordPlace(pLine->GetBeginWordPlace()),
- pLine->GetEndWordPlace()));
- place.nLineIndex = nMid;
- return place;
- }
+ CLine* pLine = m_LineArray[nMid].get();
+ float fTop = pLine->m_LineInfo.fLineY - pLine->m_LineInfo.fLineAscent -
+ m_pVT->GetLineLeading(m_SecInfo);
+ float fBottom = pLine->m_LineInfo.fLineY - pLine->m_LineInfo.fLineDescent;
+ if (IsFloatBigger(point.y, fTop))
+ bUp = false;
+ if (IsFloatSmaller(point.y, fBottom))
+ bDown = false;
+ if (IsFloatSmaller(point.y, fTop)) {
+ nRight = nMid - 1;
+ nMid = (nLeft + nRight) / 2;
+ continue;
+ }
+ if (IsFloatBigger(point.y, fBottom)) {
+ nLeft = nMid + 1;
+ nMid = (nLeft + nRight) / 2;
+ continue;
}
+ place = SearchWordPlace(
+ point.x,
+ CPVT_WordRange(pLine->GetNextWordPlace(pLine->GetBeginWordPlace()),
+ pLine->GetEndWordPlace()));
+ place.nLineIndex = nMid;
+ return place;
}
- if (bUp) {
+ if (bUp)
place = GetBeginWordPlace();
- }
- if (bDown) {
+ if (bDown)
place = GetEndWordPlace();
- }
return place;
}
CPVT_WordPlace CSection::SearchWordPlace(
- FX_FLOAT fx,
+ float fx,
const CPVT_WordPlace& lineplace) const {
- if (CLine* pLine = m_LineArray.GetAt(lineplace.nLineIndex)) {
- return SearchWordPlace(
- fx - m_SecInfo.rcSection.left,
- CPVT_WordRange(pLine->GetNextWordPlace(pLine->GetBeginWordPlace()),
- pLine->GetEndWordPlace()));
- }
- return GetBeginWordPlace();
+ if (!pdfium::IndexInBounds(m_LineArray, lineplace.nLineIndex))
+ return GetBeginWordPlace();
+
+ CLine* pLine = m_LineArray[lineplace.nLineIndex].get();
+ return SearchWordPlace(
+ fx - m_SecInfo.rcSection.left,
+ CPVT_WordRange(pLine->GetNextWordPlace(pLine->GetBeginWordPlace()),
+ pLine->GetEndWordPlace()));
}
-CPVT_WordPlace CSection::SearchWordPlace(FX_FLOAT fx,
+CPVT_WordPlace CSection::SearchWordPlace(float fx,
const CPVT_WordRange& range) const {
CPVT_WordPlace wordplace = range.BeginPos;
wordplace.nWordIndex = -1;
@@ -217,75 +187,71 @@ CPVT_WordPlace CSection::SearchWordPlace(FX_FLOAT fx,
int32_t nRight = range.EndPos.nWordIndex + 1;
int32_t nMid = (nLeft + nRight) / 2;
while (nLeft < nRight) {
- if (nMid == nLeft) {
+ if (nMid == nLeft)
break;
- }
if (nMid == nRight) {
nMid--;
break;
}
- if (CPVT_WordInfo* pWord = m_WordArray.GetAt(nMid)) {
- if (fx >
- pWord->fWordX + m_pVT->GetWordWidth(*pWord) * VARIABLETEXT_HALF) {
- nLeft = nMid;
- nMid = (nLeft + nRight) / 2;
- continue;
- } else {
- nRight = nMid;
- nMid = (nLeft + nRight) / 2;
- continue;
- }
- } else {
+ if (!pdfium::IndexInBounds(m_WordArray, nMid))
break;
+ CPVT_WordInfo* pWord = m_WordArray[nMid].get();
+ if (fx > pWord->fWordX + m_pVT->GetWordWidth(*pWord) * VARIABLETEXT_HALF) {
+ nLeft = nMid;
+ nMid = (nLeft + nRight) / 2;
+ continue;
}
+ nRight = nMid;
+ nMid = (nLeft + nRight) / 2;
}
- if (CPVT_WordInfo* pWord = m_WordArray.GetAt(nMid)) {
- if (fx > pWord->fWordX + m_pVT->GetWordWidth(*pWord) * VARIABLETEXT_HALF) {
+ if (pdfium::IndexInBounds(m_WordArray, nMid)) {
+ CPVT_WordInfo* pWord = m_WordArray[nMid].get();
+ if (fx > pWord->fWordX + m_pVT->GetWordWidth(*pWord) * VARIABLETEXT_HALF)
wordplace.nWordIndex = nMid;
- }
}
return wordplace;
}
void CSection::ClearLeftWords(int32_t nWordIndex) {
for (int32_t i = nWordIndex; i >= 0; i--) {
- delete m_WordArray.GetAt(i);
- m_WordArray.RemoveAt(i);
+ if (pdfium::IndexInBounds(m_WordArray, i))
+ m_WordArray.erase(m_WordArray.begin() + i);
}
}
void CSection::ClearRightWords(int32_t nWordIndex) {
- for (int32_t i = m_WordArray.GetSize() - 1; i > nWordIndex; i--) {
- delete m_WordArray.GetAt(i);
- m_WordArray.RemoveAt(i);
+ int32_t sz = pdfium::CollectionSize<int32_t>(m_WordArray);
+ for (int32_t i = sz - 1; i > nWordIndex; i--) {
+ if (pdfium::IndexInBounds(m_WordArray, i))
+ m_WordArray.erase(m_WordArray.begin() + i);
}
}
void CSection::ClearMidWords(int32_t nBeginIndex, int32_t nEndIndex) {
for (int32_t i = nEndIndex; i > nBeginIndex; i--) {
- delete m_WordArray.GetAt(i);
- m_WordArray.RemoveAt(i);
+ if (pdfium::IndexInBounds(m_WordArray, i))
+ m_WordArray.erase(m_WordArray.begin() + i);
}
}
void CSection::ClearWords(const CPVT_WordRange& PlaceRange) {
CPVT_WordPlace SecBeginPos = GetBeginWordPlace();
CPVT_WordPlace SecEndPos = GetEndWordPlace();
- if (PlaceRange.BeginPos.WordCmp(SecBeginPos) >= 0) {
- if (PlaceRange.EndPos.WordCmp(SecEndPos) <= 0) {
+ if (PlaceRange.BeginPos >= SecBeginPos) {
+ if (PlaceRange.EndPos <= SecEndPos) {
ClearMidWords(PlaceRange.BeginPos.nWordIndex,
PlaceRange.EndPos.nWordIndex);
} else {
ClearRightWords(PlaceRange.BeginPos.nWordIndex);
}
- } else if (PlaceRange.EndPos.WordCmp(SecEndPos) <= 0) {
+ } else if (PlaceRange.EndPos <= SecEndPos) {
ClearLeftWords(PlaceRange.EndPos.nWordIndex);
} else {
- ResetWordArray();
+ m_WordArray.clear();
}
}
void CSection::ClearWord(const CPVT_WordPlace& place) {
- delete m_WordArray.GetAt(place.nWordIndex);
- m_WordArray.RemoveAt(place.nWordIndex);
+ if (pdfium::IndexInBounds(m_WordArray, place.nWordIndex))
+ m_WordArray.erase(m_WordArray.begin() + place.nWordIndex);
}
diff --git a/chromium/third_party/pdfium/core/fpdfdoc/csection.h b/chromium/third_party/pdfium/core/fpdfdoc/csection.h
index a2ac43b102d..b465d1d63df 100644
--- a/chromium/third_party/pdfium/core/fpdfdoc/csection.h
+++ b/chromium/third_party/pdfium/core/fpdfdoc/csection.h
@@ -7,7 +7,10 @@
#ifndef CORE_FPDFDOC_CSECTION_H_
#define CORE_FPDFDOC_CSECTION_H_
-#include "core/fpdfdoc/clines.h"
+#include <memory>
+#include <vector>
+
+#include "core/fpdfdoc/cline.h"
#include "core/fpdfdoc/cpvt_sectioninfo.h"
#include "core/fpdfdoc/ctypeset.h"
#include "core/fxcrt/fx_coordinates.h"
@@ -24,8 +27,6 @@ class CSection final {
~CSection();
void ResetAll();
- void ResetLineArray();
- void ResetWordArray();
void ResetLinePlace();
CPVT_WordPlace AddWord(const CPVT_WordPlace& place,
const CPVT_WordInfo& wordinfo);
@@ -33,22 +34,21 @@ class CSection final {
void ClearWords(const CPVT_WordRange& PlaceRange);
void ClearWord(const CPVT_WordPlace& place);
CPVT_FloatRect Rearrange();
- CFX_SizeF GetSectionSize(FX_FLOAT fFontSize);
+ CFX_SizeF GetSectionSize(float fFontSize);
CPVT_WordPlace GetBeginWordPlace() const;
CPVT_WordPlace GetEndWordPlace() const;
CPVT_WordPlace GetPrevWordPlace(const CPVT_WordPlace& place) const;
CPVT_WordPlace GetNextWordPlace(const CPVT_WordPlace& place) const;
void UpdateWordPlace(CPVT_WordPlace& place) const;
CPVT_WordPlace SearchWordPlace(const CFX_PointF& point) const;
- CPVT_WordPlace SearchWordPlace(FX_FLOAT fx,
+ CPVT_WordPlace SearchWordPlace(float fx,
const CPVT_WordPlace& lineplace) const;
- CPVT_WordPlace SearchWordPlace(FX_FLOAT fx,
- const CPVT_WordRange& range) const;
+ CPVT_WordPlace SearchWordPlace(float fx, const CPVT_WordRange& range) const;
CPVT_WordPlace SecPlace;
CPVT_SectionInfo m_SecInfo;
- CLines m_LineArray;
- CPVT_ArrayTemplate<CPVT_WordInfo*> m_WordArray;
+ std::vector<std::unique_ptr<CLine>> m_LineArray;
+ std::vector<std::unique_ptr<CPVT_WordInfo>> m_WordArray;
private:
friend class CTypeset;
diff --git a/chromium/third_party/pdfium/core/fpdfdoc/ctypeset.cpp b/chromium/third_party/pdfium/core/fpdfdoc/ctypeset.cpp
index 452143e6825..2e2f6c54a4d 100644
--- a/chromium/third_party/pdfium/core/fpdfdoc/ctypeset.cpp
+++ b/chromium/third_party/pdfium/core/fpdfdoc/ctypeset.cpp
@@ -11,6 +11,7 @@
#include "core/fpdfdoc/cline.h"
#include "core/fpdfdoc/cpvt_wordinfo.h"
#include "core/fpdfdoc/csection.h"
+#include "third_party/base/stl_util.h"
namespace {
@@ -179,83 +180,86 @@ CTypeset::CTypeset(CSection* pSection)
CTypeset::~CTypeset() {}
CPVT_FloatRect CTypeset::CharArray() {
- ASSERT(m_pSection);
- FX_FLOAT fLineAscent =
+ m_rcRet = CPVT_FloatRect(0, 0, 0, 0);
+ if (m_pSection->m_LineArray.empty())
+ return m_rcRet;
+
+ float fNodeWidth = m_pVT->GetPlateWidth() /
+ (m_pVT->m_nCharArray <= 0 ? 1 : m_pVT->m_nCharArray);
+ float fLineAscent =
m_pVT->GetFontAscent(m_pVT->GetDefaultFontIndex(), m_pVT->GetFontSize());
- FX_FLOAT fLineDescent =
+ float fLineDescent =
m_pVT->GetFontDescent(m_pVT->GetDefaultFontIndex(), m_pVT->GetFontSize());
- m_rcRet.Default();
- FX_FLOAT x = 0.0f, y = 0.0f;
- FX_FLOAT fNextWidth;
+ float x = 0.0f;
+ float y = m_pVT->GetLineLeading(m_pSection->m_SecInfo) + fLineAscent;
int32_t nStart = 0;
- FX_FLOAT fNodeWidth = m_pVT->GetPlateWidth() /
- (m_pVT->m_nCharArray <= 0 ? 1 : m_pVT->m_nCharArray);
- if (CLine* pLine = m_pSection->m_LineArray.GetAt(0)) {
- x = 0.0f;
- y += m_pVT->GetLineLeading(m_pSection->m_SecInfo);
- y += fLineAscent;
- nStart = 0;
- switch (m_pVT->GetAlignment(m_pSection->m_SecInfo)) {
- case 0:
- pLine->m_LineInfo.fLineX = fNodeWidth * VARIABLETEXT_HALF;
- break;
- case 1:
- nStart = (m_pVT->m_nCharArray - m_pSection->m_WordArray.GetSize()) / 2;
- pLine->m_LineInfo.fLineX =
- fNodeWidth * nStart - fNodeWidth * VARIABLETEXT_HALF;
- break;
- case 2:
- nStart = m_pVT->m_nCharArray - m_pSection->m_WordArray.GetSize();
- pLine->m_LineInfo.fLineX =
- fNodeWidth * nStart - fNodeWidth * VARIABLETEXT_HALF;
- break;
+ CLine* pLine = m_pSection->m_LineArray.front().get();
+ switch (m_pVT->GetAlignment(m_pSection->m_SecInfo)) {
+ case 0:
+ pLine->m_LineInfo.fLineX = fNodeWidth * VARIABLETEXT_HALF;
+ break;
+ case 1:
+ nStart = (m_pVT->m_nCharArray -
+ pdfium::CollectionSize<int32_t>(m_pSection->m_WordArray)) /
+ 2;
+ pLine->m_LineInfo.fLineX =
+ fNodeWidth * nStart - fNodeWidth * VARIABLETEXT_HALF;
+ break;
+ case 2:
+ nStart = m_pVT->m_nCharArray -
+ pdfium::CollectionSize<int32_t>(m_pSection->m_WordArray);
+ pLine->m_LineInfo.fLineX =
+ fNodeWidth * nStart - fNodeWidth * VARIABLETEXT_HALF;
+ break;
+ }
+ for (int32_t w = 0,
+ sz = pdfium::CollectionSize<int32_t>(m_pSection->m_WordArray);
+ w < sz; w++) {
+ if (w >= m_pVT->m_nCharArray)
+ break;
+
+ float fNextWidth = 0;
+ if (pdfium::IndexInBounds(m_pSection->m_WordArray, w + 1)) {
+ CPVT_WordInfo* pNextWord = m_pSection->m_WordArray[w + 1].get();
+ pNextWord->fWordTail = 0;
+ fNextWidth = m_pVT->GetWordWidth(*pNextWord);
}
- for (int32_t w = 0, sz = m_pSection->m_WordArray.GetSize(); w < sz; w++) {
- if (w >= m_pVT->m_nCharArray) {
- break;
- }
- fNextWidth = 0;
- if (CPVT_WordInfo* pNextWord = m_pSection->m_WordArray.GetAt(w + 1)) {
- pNextWord->fWordTail = 0;
- fNextWidth = m_pVT->GetWordWidth(*pNextWord);
- }
- if (CPVT_WordInfo* pWord = m_pSection->m_WordArray.GetAt(w)) {
- pWord->fWordTail = 0;
- FX_FLOAT fWordWidth = m_pVT->GetWordWidth(*pWord);
- FX_FLOAT fWordAscent = m_pVT->GetWordAscent(*pWord);
- FX_FLOAT fWordDescent = m_pVT->GetWordDescent(*pWord);
- x = (FX_FLOAT)(fNodeWidth * (w + nStart + 0.5) -
- fWordWidth * VARIABLETEXT_HALF);
- pWord->fWordX = x;
- pWord->fWordY = y;
- if (w == 0) {
- pLine->m_LineInfo.fLineX = x;
- }
- if (w != m_pSection->m_WordArray.GetSize() - 1) {
- pWord->fWordTail =
- (fNodeWidth - (fWordWidth + fNextWidth) * VARIABLETEXT_HALF > 0
- ? fNodeWidth - (fWordWidth + fNextWidth) * VARIABLETEXT_HALF
- : 0);
- } else {
- pWord->fWordTail = 0;
- }
- x += fWordWidth;
- fLineAscent = std::max(fLineAscent, fWordAscent);
- fLineDescent = std::min(fLineDescent, fWordDescent);
- }
+ CPVT_WordInfo* pWord = m_pSection->m_WordArray[w].get();
+ pWord->fWordTail = 0;
+ float fWordWidth = m_pVT->GetWordWidth(*pWord);
+ float fWordAscent = m_pVT->GetWordAscent(*pWord);
+ float fWordDescent = m_pVT->GetWordDescent(*pWord);
+ x = (float)(fNodeWidth * (w + nStart + 0.5) -
+ fWordWidth * VARIABLETEXT_HALF);
+ pWord->fWordX = x;
+ pWord->fWordY = y;
+ if (w == 0) {
+ pLine->m_LineInfo.fLineX = x;
}
- pLine->m_LineInfo.nBeginWordIndex = 0;
- pLine->m_LineInfo.nEndWordIndex = m_pSection->m_WordArray.GetSize() - 1;
- pLine->m_LineInfo.fLineY = y;
- pLine->m_LineInfo.fLineWidth = x - pLine->m_LineInfo.fLineX;
- pLine->m_LineInfo.fLineAscent = fLineAscent;
- pLine->m_LineInfo.fLineDescent = fLineDescent;
- y -= fLineDescent;
+ if (w != pdfium::CollectionSize<int32_t>(m_pSection->m_WordArray) - 1) {
+ pWord->fWordTail =
+ (fNodeWidth - (fWordWidth + fNextWidth) * VARIABLETEXT_HALF > 0
+ ? fNodeWidth - (fWordWidth + fNextWidth) * VARIABLETEXT_HALF
+ : 0);
+ } else {
+ pWord->fWordTail = 0;
+ }
+ x += fWordWidth;
+ fLineAscent = std::max(fLineAscent, fWordAscent);
+ fLineDescent = std::min(fLineDescent, fWordDescent);
}
- return m_rcRet = CPVT_FloatRect(0, 0, x, y);
+ pLine->m_LineInfo.nBeginWordIndex = 0;
+ pLine->m_LineInfo.nEndWordIndex =
+ pdfium::CollectionSize<int32_t>(m_pSection->m_WordArray) - 1;
+ pLine->m_LineInfo.fLineY = y;
+ pLine->m_LineInfo.fLineWidth = x - pLine->m_LineInfo.fLineX;
+ pLine->m_LineInfo.fLineAscent = fLineAscent;
+ pLine->m_LineInfo.fLineDescent = fLineDescent;
+ m_rcRet = CPVT_FloatRect(0, 0, x, y - fLineDescent);
+ return m_rcRet;
}
-CFX_SizeF CTypeset::GetEditSize(FX_FLOAT fFontSize) {
+CFX_SizeF CTypeset::GetEditSize(float fFontSize) {
ASSERT(m_pSection);
ASSERT(m_pVT);
SplitLines(false, fFontSize);
@@ -264,40 +268,40 @@ CFX_SizeF CTypeset::GetEditSize(FX_FLOAT fFontSize) {
CPVT_FloatRect CTypeset::Typeset() {
ASSERT(m_pVT);
- m_pSection->m_LineArray.Empty();
+ m_pSection->m_LineArray.clear();
SplitLines(true, 0.0f);
- m_pSection->m_LineArray.Clear();
OutputLines();
return m_rcRet;
}
-void CTypeset::SplitLines(bool bTypeset, FX_FLOAT fFontSize) {
+void CTypeset::SplitLines(bool bTypeset, float fFontSize) {
ASSERT(m_pVT);
ASSERT(m_pSection);
int32_t nLineHead = 0;
int32_t nLineTail = 0;
- FX_FLOAT fMaxX = 0.0f, fMaxY = 0.0f;
- FX_FLOAT fLineWidth = 0.0f, fBackupLineWidth = 0.0f;
- FX_FLOAT fLineAscent = 0.0f, fBackupLineAscent = 0.0f;
- FX_FLOAT fLineDescent = 0.0f, fBackupLineDescent = 0.0f;
+ float fMaxX = 0.0f, fMaxY = 0.0f;
+ float fLineWidth = 0.0f, fBackupLineWidth = 0.0f;
+ float fLineAscent = 0.0f, fBackupLineAscent = 0.0f;
+ float fLineDescent = 0.0f, fBackupLineDescent = 0.0f;
int32_t nWordStartPos = 0;
bool bFullWord = false;
int32_t nLineFullWordIndex = 0;
int32_t nCharIndex = 0;
CPVT_LineInfo line;
- FX_FLOAT fWordWidth = 0;
- FX_FLOAT fTypesetWidth = std::max(
+ float fWordWidth = 0;
+ float fTypesetWidth = std::max(
m_pVT->GetPlateWidth() - m_pVT->GetLineIndent(m_pSection->m_SecInfo),
0.0f);
- int32_t nTotalWords = m_pSection->m_WordArray.GetSize();
+ int32_t nTotalWords =
+ pdfium::CollectionSize<int32_t>(m_pSection->m_WordArray);
bool bOpened = false;
if (nTotalWords > 0) {
int32_t i = 0;
while (i < nTotalWords) {
- CPVT_WordInfo* pWord = m_pSection->m_WordArray.GetAt(i);
+ CPVT_WordInfo* pWord = m_pSection->m_WordArray[i].get();
CPVT_WordInfo* pOldWord = pWord;
if (i > 0) {
- pOldWord = m_pSection->m_WordArray.GetAt(i - 1);
+ pOldWord = m_pSection->m_WordArray[i - 1].get();
}
if (pWord) {
if (bTypeset) {
@@ -420,10 +424,10 @@ void CTypeset::SplitLines(bool bTypeset, FX_FLOAT fFontSize) {
void CTypeset::OutputLines() {
ASSERT(m_pVT);
ASSERT(m_pSection);
- FX_FLOAT fMinX = 0.0f, fMinY = 0.0f, fMaxX = 0.0f, fMaxY = 0.0f;
- FX_FLOAT fPosX = 0.0f, fPosY = 0.0f;
- FX_FLOAT fLineIndent = m_pVT->GetLineIndent(m_pSection->m_SecInfo);
- FX_FLOAT fTypesetWidth = std::max(m_pVT->GetPlateWidth() - fLineIndent, 0.0f);
+ float fMinX = 0.0f, fMinY = 0.0f, fMaxX = 0.0f, fMaxY = 0.0f;
+ float fPosX = 0.0f, fPosY = 0.0f;
+ float fLineIndent = m_pVT->GetLineIndent(m_pSection->m_SecInfo);
+ float fTypesetWidth = std::max(m_pVT->GetPlateWidth() - fLineIndent, 0.0f);
switch (m_pVT->GetAlignment(m_pSection->m_SecInfo)) {
default:
case 0:
@@ -439,54 +443,55 @@ void CTypeset::OutputLines() {
fMaxX = fMinX + m_rcRet.Width();
fMinY = 0.0f;
fMaxY = m_rcRet.Height();
- int32_t nTotalLines = m_pSection->m_LineArray.GetSize();
+ int32_t nTotalLines =
+ pdfium::CollectionSize<int32_t>(m_pSection->m_LineArray);
if (nTotalLines > 0) {
m_pSection->m_SecInfo.nTotalLine = nTotalLines;
for (int32_t l = 0; l < nTotalLines; l++) {
- if (CLine* pLine = m_pSection->m_LineArray.GetAt(l)) {
- switch (m_pVT->GetAlignment(m_pSection->m_SecInfo)) {
- default:
- case 0:
- fPosX = 0;
- break;
- case 1:
- fPosX = (fTypesetWidth - pLine->m_LineInfo.fLineWidth) *
- VARIABLETEXT_HALF;
- break;
- case 2:
- fPosX = fTypesetWidth - pLine->m_LineInfo.fLineWidth;
- break;
- }
- fPosX += fLineIndent;
- fPosY += m_pVT->GetLineLeading(m_pSection->m_SecInfo);
- fPosY += pLine->m_LineInfo.fLineAscent;
- pLine->m_LineInfo.fLineX = fPosX - fMinX;
- pLine->m_LineInfo.fLineY = fPosY - fMinY;
- for (int32_t w = pLine->m_LineInfo.nBeginWordIndex;
- w <= pLine->m_LineInfo.nEndWordIndex; w++) {
- if (CPVT_WordInfo* pWord = m_pSection->m_WordArray.GetAt(w)) {
- pWord->fWordX = fPosX - fMinX;
- if (pWord->pWordProps) {
- switch (pWord->pWordProps->nScriptType) {
- default:
- case CPDF_VariableText::ScriptType::Normal:
- pWord->fWordY = fPosY - fMinY;
- break;
- case CPDF_VariableText::ScriptType::Super:
- pWord->fWordY = fPosY - m_pVT->GetWordAscent(*pWord) - fMinY;
- break;
- case CPDF_VariableText::ScriptType::Sub:
- pWord->fWordY = fPosY - m_pVT->GetWordDescent(*pWord) - fMinY;
- break;
- }
- } else {
- pWord->fWordY = fPosY - fMinY;
+ CLine* pLine = m_pSection->m_LineArray[l].get();
+ switch (m_pVT->GetAlignment(m_pSection->m_SecInfo)) {
+ default:
+ case 0:
+ fPosX = 0;
+ break;
+ case 1:
+ fPosX = (fTypesetWidth - pLine->m_LineInfo.fLineWidth) *
+ VARIABLETEXT_HALF;
+ break;
+ case 2:
+ fPosX = fTypesetWidth - pLine->m_LineInfo.fLineWidth;
+ break;
+ }
+ fPosX += fLineIndent;
+ fPosY += m_pVT->GetLineLeading(m_pSection->m_SecInfo);
+ fPosY += pLine->m_LineInfo.fLineAscent;
+ pLine->m_LineInfo.fLineX = fPosX - fMinX;
+ pLine->m_LineInfo.fLineY = fPosY - fMinY;
+ for (int32_t w = pLine->m_LineInfo.nBeginWordIndex;
+ w <= pLine->m_LineInfo.nEndWordIndex; w++) {
+ if (pdfium::IndexInBounds(m_pSection->m_WordArray, w)) {
+ CPVT_WordInfo* pWord = m_pSection->m_WordArray[w].get();
+ pWord->fWordX = fPosX - fMinX;
+ if (pWord->pWordProps) {
+ switch (pWord->pWordProps->nScriptType) {
+ default:
+ case CPDF_VariableText::ScriptType::Normal:
+ pWord->fWordY = fPosY - fMinY;
+ break;
+ case CPDF_VariableText::ScriptType::Super:
+ pWord->fWordY = fPosY - m_pVT->GetWordAscent(*pWord) - fMinY;
+ break;
+ case CPDF_VariableText::ScriptType::Sub:
+ pWord->fWordY = fPosY - m_pVT->GetWordDescent(*pWord) - fMinY;
+ break;
}
- fPosX += m_pVT->GetWordWidth(*pWord);
+ } else {
+ pWord->fWordY = fPosY - fMinY;
}
+ fPosX += m_pVT->GetWordWidth(*pWord);
}
- fPosY -= pLine->m_LineInfo.fLineDescent;
}
+ fPosY -= pLine->m_LineInfo.fLineDescent;
}
}
m_rcRet = CPVT_FloatRect(fMinX, fMinY, fMaxX, fMaxY);
diff --git a/chromium/third_party/pdfium/core/fpdfdoc/ctypeset.h b/chromium/third_party/pdfium/core/fpdfdoc/ctypeset.h
index 4161c03b426..f769fe13114 100644
--- a/chromium/third_party/pdfium/core/fpdfdoc/ctypeset.h
+++ b/chromium/third_party/pdfium/core/fpdfdoc/ctypeset.h
@@ -18,12 +18,12 @@ class CTypeset final {
explicit CTypeset(CSection* pSection);
~CTypeset();
- CFX_SizeF GetEditSize(FX_FLOAT fFontSize);
+ CFX_SizeF GetEditSize(float fFontSize);
CPVT_FloatRect Typeset();
CPVT_FloatRect CharArray();
private:
- void SplitLines(bool bTypeset, FX_FLOAT fFontSize);
+ void SplitLines(bool bTypeset, float fFontSize);
void OutputLines();
CPVT_FloatRect m_rcRet;
diff --git a/chromium/third_party/pdfium/core/fpdfdoc/doc_tagged.cpp b/chromium/third_party/pdfium/core/fpdfdoc/doc_tagged.cpp
deleted file mode 100644
index af5cf859382..00000000000
--- a/chromium/third_party/pdfium/core/fpdfdoc/doc_tagged.cpp
+++ /dev/null
@@ -1,418 +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
-
-#include <map>
-#include <memory>
-#include <utility>
-
-#include "core/fpdfapi/parser/cpdf_array.h"
-#include "core/fpdfapi/parser/cpdf_dictionary.h"
-#include "core/fpdfapi/parser/cpdf_document.h"
-#include "core/fpdfapi/parser/cpdf_name.h"
-#include "core/fpdfapi/parser/cpdf_number.h"
-#include "core/fpdfapi/parser/cpdf_reference.h"
-#include "core/fpdfapi/parser/cpdf_stream.h"
-#include "core/fpdfdoc/cpdf_numbertree.h"
-#include "core/fpdfdoc/fpdf_tagged.h"
-#include "core/fpdfdoc/tagged_int.h"
-#include "third_party/base/ptr_util.h"
-
-namespace {
-
-const int nMaxRecursion = 32;
-
-bool IsTagged(const CPDF_Document* pDoc) {
- CPDF_Dictionary* pCatalog = pDoc->GetRoot();
- CPDF_Dictionary* pMarkInfo = pCatalog->GetDictFor("MarkInfo");
- return pMarkInfo && pMarkInfo->GetIntegerFor("Marked");
-}
-
-} // namespace
-
-CPDF_StructKid::CPDF_StructKid()
- : m_Type(Invalid),
- m_pDict(nullptr),
- m_PageObjNum(0),
- m_RefObjNum(0),
- m_ContentId(0) {}
-
-CPDF_StructKid::CPDF_StructKid(const CPDF_StructKid& that) = default;
-
-CPDF_StructKid::~CPDF_StructKid() {}
-
-// static
-std::unique_ptr<IPDF_StructTree> IPDF_StructTree::LoadPage(
- const CPDF_Document* pDoc,
- const CPDF_Dictionary* pPageDict) {
- if (!IsTagged(pDoc))
- return nullptr;
-
- auto pTree = pdfium::MakeUnique<CPDF_StructTree>(pDoc);
- pTree->LoadPageTree(pPageDict);
- return std::move(pTree);
-}
-
-CPDF_StructTree::CPDF_StructTree(const CPDF_Document* pDoc)
- : m_pTreeRoot(pDoc->GetRoot()->GetDictFor("StructTreeRoot")),
- m_pRoleMap(m_pTreeRoot ? m_pTreeRoot->GetDictFor("RoleMap") : nullptr),
- m_pPage(nullptr) {}
-
-CPDF_StructTree::~CPDF_StructTree() {}
-
-int CPDF_StructTree::CountTopElements() const {
- return pdfium::CollectionSize<int>(m_Kids);
-}
-
-IPDF_StructElement* CPDF_StructTree::GetTopElement(int i) const {
- return m_Kids[i].Get();
-}
-
-void CPDF_StructTree::LoadPageTree(const CPDF_Dictionary* pPageDict) {
- m_pPage = pPageDict;
- if (!m_pTreeRoot)
- return;
-
- CPDF_Object* pKids = m_pTreeRoot->GetDirectObjectFor("K");
- if (!pKids)
- return;
-
- uint32_t dwKids = 0;
- if (pKids->IsDictionary())
- dwKids = 1;
- else if (CPDF_Array* pArray = pKids->AsArray())
- dwKids = pArray->GetCount();
- else
- return;
-
- m_Kids.clear();
- m_Kids.resize(dwKids);
- CPDF_Dictionary* pParentTree = m_pTreeRoot->GetDictFor("ParentTree");
- if (!pParentTree)
- return;
-
- CPDF_NumberTree parent_tree(pParentTree);
- int parents_id = pPageDict->GetIntegerFor("StructParents", -1);
- if (parents_id < 0)
- return;
-
- CPDF_Array* pParentArray = ToArray(parent_tree.LookupValue(parents_id));
- if (!pParentArray)
- return;
-
- std::map<CPDF_Dictionary*, CFX_RetainPtr<CPDF_StructElement>> element_map;
- for (size_t i = 0; i < pParentArray->GetCount(); i++) {
- if (CPDF_Dictionary* pParent = pParentArray->GetDictAt(i))
- AddPageNode(pParent, &element_map);
- }
-}
-
-CFX_RetainPtr<CPDF_StructElement> CPDF_StructTree::AddPageNode(
- CPDF_Dictionary* pDict,
- std::map<CPDF_Dictionary*, CFX_RetainPtr<CPDF_StructElement>>* map,
- int nLevel) {
- if (nLevel > nMaxRecursion)
- return nullptr;
-
- auto it = map->find(pDict);
- if (it != map->end())
- return it->second;
-
- auto pElement = pdfium::MakeRetain<CPDF_StructElement>(this, nullptr, pDict);
- (*map)[pDict] = pElement;
- CPDF_Dictionary* pParent = pDict->GetDictFor("P");
- if (!pParent || pParent->GetStringFor("Type") == "StructTreeRoot") {
- if (!AddTopLevelNode(pDict, pElement))
- map->erase(pDict);
- return pElement;
- }
-
- CFX_RetainPtr<CPDF_StructElement> pParentElement =
- AddPageNode(pParent, map, nLevel + 1);
- bool bSave = false;
- for (CPDF_StructKid& kid : *pParentElement->GetKids()) {
- if (kid.m_Type == CPDF_StructKid::Element && kid.m_pDict == pDict) {
- kid.m_pElement = pElement;
- bSave = true;
- }
- }
- if (!bSave)
- map->erase(pDict);
- return pElement;
-}
-
-bool CPDF_StructTree::AddTopLevelNode(
- CPDF_Dictionary* pDict,
- const CFX_RetainPtr<CPDF_StructElement>& pElement) {
- CPDF_Object* pObj = m_pTreeRoot->GetDirectObjectFor("K");
- if (!pObj)
- return false;
-
- if (pObj->IsDictionary()) {
- if (pObj->GetObjNum() != pDict->GetObjNum())
- return false;
- m_Kids[0] = pElement;
- }
- if (CPDF_Array* pTopKids = pObj->AsArray()) {
- bool bSave = false;
- for (size_t i = 0; i < pTopKids->GetCount(); i++) {
- CPDF_Reference* pKidRef = ToReference(pTopKids->GetObjectAt(i));
- if (pKidRef && pKidRef->GetRefObjNum() == pDict->GetObjNum()) {
- m_Kids[i] = pElement;
- bSave = true;
- }
- }
- if (!bSave)
- return false;
- }
- return true;
-}
-
-CPDF_StructElement::CPDF_StructElement(CPDF_StructTree* pTree,
- CPDF_StructElement* pParent,
- CPDF_Dictionary* pDict)
- : m_pTree(pTree),
- m_pParent(pParent),
- m_pDict(pDict),
- m_Type(pDict->GetStringFor("S")) {
- if (pTree->m_pRoleMap) {
- CFX_ByteString mapped = pTree->m_pRoleMap->GetStringFor(m_Type);
- if (!mapped.IsEmpty())
- m_Type = mapped;
- }
- LoadKids(pDict);
-}
-
-IPDF_StructTree* CPDF_StructElement::GetTree() const {
- return m_pTree;
-}
-
-const CFX_ByteString& CPDF_StructElement::GetType() const {
- return m_Type;
-}
-
-IPDF_StructElement* CPDF_StructElement::GetParent() const {
- return m_pParent;
-}
-
-CPDF_Dictionary* CPDF_StructElement::GetDict() const {
- return m_pDict;
-}
-
-int CPDF_StructElement::CountKids() const {
- return pdfium::CollectionSize<int>(m_Kids);
-}
-
-IPDF_StructElement* CPDF_StructElement::GetKidIfElement(int index) const {
- if (m_Kids[index].m_Type != CPDF_StructKid::Element)
- return nullptr;
-
- return m_Kids[index].m_pElement.Get();
-}
-
-CPDF_StructElement::~CPDF_StructElement() {}
-
-void CPDF_StructElement::LoadKids(CPDF_Dictionary* pDict) {
- CPDF_Object* pObj = pDict->GetObjectFor("Pg");
- uint32_t PageObjNum = 0;
- if (CPDF_Reference* pRef = ToReference(pObj))
- PageObjNum = pRef->GetRefObjNum();
-
- CPDF_Object* pKids = pDict->GetDirectObjectFor("K");
- if (!pKids)
- return;
-
- m_Kids.clear();
- if (CPDF_Array* pArray = pKids->AsArray()) {
- m_Kids.resize(pArray->GetCount());
- for (uint32_t i = 0; i < pArray->GetCount(); i++) {
- CPDF_Object* pKid = pArray->GetDirectObjectAt(i);
- LoadKid(PageObjNum, pKid, &m_Kids[i]);
- }
- } else {
- m_Kids.resize(1);
- LoadKid(PageObjNum, pKids, &m_Kids[0]);
- }
-}
-void CPDF_StructElement::LoadKid(uint32_t PageObjNum,
- CPDF_Object* pKidObj,
- CPDF_StructKid* pKid) {
- pKid->m_Type = CPDF_StructKid::Invalid;
- if (!pKidObj)
- return;
-
- if (pKidObj->IsNumber()) {
- if (m_pTree->m_pPage && m_pTree->m_pPage->GetObjNum() != PageObjNum) {
- return;
- }
- pKid->m_Type = CPDF_StructKid::PageContent;
- pKid->m_ContentId = pKidObj->GetInteger();
- pKid->m_PageObjNum = PageObjNum;
- return;
- }
-
- CPDF_Dictionary* pKidDict = pKidObj->AsDictionary();
- if (!pKidDict)
- return;
-
- if (CPDF_Reference* pRef = ToReference(pKidDict->GetObjectFor("Pg")))
- PageObjNum = pRef->GetRefObjNum();
-
- CFX_ByteString type = pKidDict->GetStringFor("Type");
- if (type == "MCR") {
- if (m_pTree->m_pPage && m_pTree->m_pPage->GetObjNum() != PageObjNum) {
- return;
- }
- pKid->m_Type = CPDF_StructKid::StreamContent;
- CPDF_Reference* pRef = ToReference(pKidDict->GetObjectFor("Stm"));
- pKid->m_RefObjNum = pRef ? pRef->GetRefObjNum() : 0;
- pKid->m_PageObjNum = PageObjNum;
- pKid->m_ContentId = pKidDict->GetIntegerFor("MCID");
- } else if (type == "OBJR") {
- if (m_pTree->m_pPage && m_pTree->m_pPage->GetObjNum() != PageObjNum) {
- return;
- }
- pKid->m_Type = CPDF_StructKid::Object;
- CPDF_Reference* pObj = ToReference(pKidDict->GetObjectFor("Obj"));
- pKid->m_RefObjNum = pObj ? pObj->GetRefObjNum() : 0;
- pKid->m_PageObjNum = PageObjNum;
- } else {
- pKid->m_Type = CPDF_StructKid::Element;
- pKid->m_pDict = pKidDict;
- if (!m_pTree->m_pPage) {
- pKid->m_pElement =
- pdfium::MakeRetain<CPDF_StructElement>(m_pTree, this, pKidDict);
- } else {
- pKid->m_pElement = nullptr;
- }
- }
-}
-static CPDF_Dictionary* FindAttrDict(CPDF_Object* pAttrs,
- const CFX_ByteStringC& owner,
- FX_FLOAT nLevel = 0.0F) {
- if (nLevel > nMaxRecursion)
- return nullptr;
- if (!pAttrs)
- return nullptr;
-
- CPDF_Dictionary* pDict = nullptr;
- if (pAttrs->IsDictionary()) {
- pDict = pAttrs->AsDictionary();
- } else if (CPDF_Stream* pStream = pAttrs->AsStream()) {
- pDict = pStream->GetDict();
- } else if (CPDF_Array* pArray = pAttrs->AsArray()) {
- for (uint32_t i = 0; i < pArray->GetCount(); i++) {
- CPDF_Object* pElement = pArray->GetDirectObjectAt(i);
- pDict = FindAttrDict(pElement, owner, nLevel + 1);
- if (pDict)
- return pDict;
- }
- }
- if (pDict && pDict->GetStringFor("O") == owner)
- return pDict;
- return nullptr;
-}
-CPDF_Object* CPDF_StructElement::GetAttr(const CFX_ByteStringC& owner,
- const CFX_ByteStringC& name,
- bool bInheritable,
- FX_FLOAT fLevel) {
- if (fLevel > nMaxRecursion) {
- return nullptr;
- }
- if (bInheritable) {
- CPDF_Object* pAttr = GetAttr(owner, name, false);
- if (pAttr) {
- return pAttr;
- }
- if (!m_pParent) {
- return nullptr;
- }
- return m_pParent->GetAttr(owner, name, true, fLevel + 1);
- }
- CPDF_Object* pA = m_pDict->GetDirectObjectFor("A");
- if (pA) {
- CPDF_Dictionary* pAttrDict = FindAttrDict(pA, owner);
- if (pAttrDict) {
- CPDF_Object* pAttr = pAttrDict->GetDirectObjectFor(CFX_ByteString(name));
- if (pAttr) {
- return pAttr;
- }
- }
- }
- CPDF_Object* pC = m_pDict->GetDirectObjectFor("C");
- if (!pC)
- return nullptr;
-
- CPDF_Dictionary* pClassMap = m_pTree->m_pTreeRoot->GetDictFor("ClassMap");
- if (!pClassMap)
- return nullptr;
-
- if (CPDF_Array* pArray = pC->AsArray()) {
- for (uint32_t i = 0; i < pArray->GetCount(); i++) {
- CFX_ByteString class_name = pArray->GetStringAt(i);
- CPDF_Dictionary* pClassDict = pClassMap->GetDictFor(class_name);
- if (pClassDict && pClassDict->GetStringFor("O") == owner)
- return pClassDict->GetDirectObjectFor(CFX_ByteString(name));
- }
- return nullptr;
- }
- CFX_ByteString class_name = pC->GetString();
- CPDF_Dictionary* pClassDict = pClassMap->GetDictFor(class_name);
- if (pClassDict && pClassDict->GetStringFor("O") == owner)
- return pClassDict->GetDirectObjectFor(CFX_ByteString(name));
- return nullptr;
-}
-CPDF_Object* CPDF_StructElement::GetAttr(const CFX_ByteStringC& owner,
- const CFX_ByteStringC& name,
- bool bInheritable,
- int subindex) {
- CPDF_Object* pAttr = GetAttr(owner, name, bInheritable);
- CPDF_Array* pArray = ToArray(pAttr);
- if (!pArray || subindex == -1)
- return pAttr;
-
- if (subindex >= static_cast<int>(pArray->GetCount()))
- return pAttr;
- return pArray->GetDirectObjectAt(subindex);
-}
-CFX_ByteString CPDF_StructElement::GetName(const CFX_ByteStringC& owner,
- const CFX_ByteStringC& name,
- const CFX_ByteStringC& default_value,
- bool bInheritable,
- int subindex) {
- CPDF_Object* pAttr = GetAttr(owner, name, bInheritable, subindex);
- if (ToName(pAttr))
- return pAttr->GetString();
- return CFX_ByteString(default_value);
-}
-
-FX_ARGB CPDF_StructElement::GetColor(const CFX_ByteStringC& owner,
- const CFX_ByteStringC& name,
- FX_ARGB default_value,
- bool bInheritable,
- int subindex) {
- CPDF_Array* pArray = ToArray(GetAttr(owner, name, bInheritable, subindex));
- if (!pArray)
- return default_value;
- return 0xff000000 | ((int)(pArray->GetNumberAt(0) * 255) << 16) |
- ((int)(pArray->GetNumberAt(1) * 255) << 8) |
- (int)(pArray->GetNumberAt(2) * 255);
-}
-FX_FLOAT CPDF_StructElement::GetNumber(const CFX_ByteStringC& owner,
- const CFX_ByteStringC& name,
- FX_FLOAT default_value,
- bool bInheritable,
- int subindex) {
- CPDF_Object* pAttr = GetAttr(owner, name, bInheritable, subindex);
- return ToNumber(pAttr) ? pAttr->GetNumber() : default_value;
-}
-int CPDF_StructElement::GetInteger(const CFX_ByteStringC& owner,
- const CFX_ByteStringC& name,
- int default_value,
- bool bInheritable,
- int subindex) {
- CPDF_Object* pAttr = GetAttr(owner, name, bInheritable, subindex);
- return ToNumber(pAttr) ? pAttr->GetInteger() : default_value;
-}
diff --git a/chromium/third_party/pdfium/core/fpdfdoc/fpdf_tagged.h b/chromium/third_party/pdfium/core/fpdfdoc/fpdf_tagged.h
deleted file mode 100644
index fbbb49f8568..00000000000
--- a/chromium/third_party/pdfium/core/fpdfdoc/fpdf_tagged.h
+++ /dev/null
@@ -1,75 +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_FPDFDOC_FPDF_TAGGED_H_
-#define CORE_FPDFDOC_FPDF_TAGGED_H_
-
-#include <memory>
-
-#include "core/fxge/fx_dib.h"
-
-class CPDF_Dictionary;
-class CPDF_Document;
-class IPDF_StructElement;
-
-class IPDF_StructTree {
- public:
- static std::unique_ptr<IPDF_StructTree> LoadPage(
- const CPDF_Document* pDoc,
- const CPDF_Dictionary* pPageDict);
-
-
- virtual int CountTopElements() const = 0;
- virtual IPDF_StructElement* GetTopElement(int i) const = 0;
-
- protected:
- friend std::default_delete<IPDF_StructTree>;
- virtual ~IPDF_StructTree() {}
-};
-
-class IPDF_StructElement {
- public:
- virtual IPDF_StructTree* GetTree() const = 0;
- virtual const CFX_ByteString& GetType() const = 0;
- virtual IPDF_StructElement* GetParent() const = 0;
- virtual CPDF_Dictionary* GetDict() const = 0;
- virtual int CountKids() const = 0;
- virtual IPDF_StructElement* GetKidIfElement(int index) const = 0;
-
- virtual CPDF_Object* GetAttr(const CFX_ByteStringC& owner,
- const CFX_ByteStringC& name,
- bool bInheritable = false,
- FX_FLOAT fLevel = 0.0F) = 0;
-
- virtual CFX_ByteString GetName(const CFX_ByteStringC& owner,
- const CFX_ByteStringC& name,
- const CFX_ByteStringC& default_value,
- bool bInheritable = false,
- int subindex = -1) = 0;
-
- virtual FX_ARGB GetColor(const CFX_ByteStringC& owner,
- const CFX_ByteStringC& name,
- FX_ARGB default_value,
- bool bInheritable = false,
- int subindex = -1) = 0;
-
- virtual FX_FLOAT GetNumber(const CFX_ByteStringC& owner,
- const CFX_ByteStringC& name,
- FX_FLOAT default_value,
- bool bInheritable = false,
- int subindex = -1) = 0;
-
- virtual int GetInteger(const CFX_ByteStringC& owner,
- const CFX_ByteStringC& name,
- int default_value,
- bool bInheritable = false,
- int subindex = -1) = 0;
-
- protected:
- virtual ~IPDF_StructElement() {}
-};
-
-#endif // CORE_FPDFDOC_FPDF_TAGGED_H_
diff --git a/chromium/third_party/pdfium/core/fpdfdoc/tagged_int.h b/chromium/third_party/pdfium/core/fpdfdoc/tagged_int.h
deleted file mode 100644
index ce246023dfc..00000000000
--- a/chromium/third_party/pdfium/core/fpdfdoc/tagged_int.h
+++ /dev/null
@@ -1,119 +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_FPDFDOC_TAGGED_INT_H_
-#define CORE_FPDFDOC_TAGGED_INT_H_
-
-#include <map>
-#include <memory>
-#include <vector>
-
-#include "core/fpdfdoc/fpdf_tagged.h"
-#include "core/fxcrt/cfx_retain_ptr.h"
-#include "third_party/base/stl_util.h"
-
-class CPDF_StructElement;
-
-struct CPDF_StructKid {
- CPDF_StructKid();
- CPDF_StructKid(const CPDF_StructKid& that);
- ~CPDF_StructKid();
-
- enum { Invalid, Element, PageContent, StreamContent, Object } m_Type;
-
- CFX_RetainPtr<CPDF_StructElement> m_pElement; // For Element.
- CPDF_Dictionary* m_pDict; // For Element.
- uint32_t m_PageObjNum; // For PageContent, StreamContent, Object.
- uint32_t m_RefObjNum; // For StreamContent, Object.
- uint32_t m_ContentId; // For PageContent, StreamContent.
-};
-
-class CPDF_StructTree final : public IPDF_StructTree {
- public:
- explicit CPDF_StructTree(const CPDF_Document* pDoc);
- ~CPDF_StructTree() override;
-
- // IPDF_StructTree:
- int CountTopElements() const override;
- IPDF_StructElement* GetTopElement(int i) const override;
-
- void LoadPageTree(const CPDF_Dictionary* pPageDict);
- CFX_RetainPtr<CPDF_StructElement> AddPageNode(
- CPDF_Dictionary* pElement,
- std::map<CPDF_Dictionary*, CFX_RetainPtr<CPDF_StructElement>>* map,
- int nLevel = 0);
- bool AddTopLevelNode(CPDF_Dictionary* pDict,
- const CFX_RetainPtr<CPDF_StructElement>& pElement);
-
- protected:
- const CPDF_Dictionary* const m_pTreeRoot;
- const CPDF_Dictionary* const m_pRoleMap;
- const CPDF_Dictionary* m_pPage;
- std::vector<CFX_RetainPtr<CPDF_StructElement>> m_Kids;
-
- friend class CPDF_StructElement;
-};
-
-class CPDF_StructElement final : public CFX_Retainable,
- public IPDF_StructElement {
- public:
- template <typename T, typename... Args>
- friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args);
-
- // IPDF_StructElement
- IPDF_StructTree* GetTree() const override;
- const CFX_ByteString& GetType() const override;
- IPDF_StructElement* GetParent() const override;
- CPDF_Dictionary* GetDict() const override;
- int CountKids() const override;
- IPDF_StructElement* GetKidIfElement(int index) const override;
- CPDF_Object* GetAttr(const CFX_ByteStringC& owner,
- const CFX_ByteStringC& name,
- bool bInheritable = false,
- FX_FLOAT fLevel = 0.0F) override;
- CFX_ByteString GetName(const CFX_ByteStringC& owner,
- const CFX_ByteStringC& name,
- const CFX_ByteStringC& default_value,
- bool bInheritable = false,
- int subindex = -1) override;
- FX_ARGB GetColor(const CFX_ByteStringC& owner,
- const CFX_ByteStringC& name,
- FX_ARGB default_value,
- bool bInheritable = false,
- int subindex = -1) override;
- FX_FLOAT GetNumber(const CFX_ByteStringC& owner,
- const CFX_ByteStringC& name,
- FX_FLOAT default_value,
- bool bInheritable = false,
- int subindex = -1) override;
- int GetInteger(const CFX_ByteStringC& owner,
- const CFX_ByteStringC& name,
- int default_value,
- bool bInheritable = false,
- int subindex = -1) override;
-
- std::vector<CPDF_StructKid>* GetKids() { return &m_Kids; }
- void LoadKids(CPDF_Dictionary* pDict);
- void LoadKid(uint32_t PageObjNum, CPDF_Object* pObj, CPDF_StructKid* pKid);
- CPDF_Object* GetAttr(const CFX_ByteStringC& owner,
- const CFX_ByteStringC& name,
- bool bInheritable,
- int subindex);
-
- private:
- CPDF_StructElement(CPDF_StructTree* pTree,
- CPDF_StructElement* pParent,
- CPDF_Dictionary* pDict);
- ~CPDF_StructElement() override;
-
- CPDF_StructTree* const m_pTree;
- CPDF_StructElement* const m_pParent;
- CPDF_Dictionary* const m_pDict;
- CFX_ByteString m_Type;
- std::vector<CPDF_StructKid> m_Kids;
-};
-
-#endif // CORE_FPDFDOC_TAGGED_INT_H_
diff --git a/chromium/third_party/pdfium/core/fpdftext/cpdf_linkextract.cpp b/chromium/third_party/pdfium/core/fpdftext/cpdf_linkextract.cpp
index a1fc93e158c..47d0754bd25 100644
--- a/chromium/third_party/pdfium/core/fpdftext/cpdf_linkextract.cpp
+++ b/chromium/third_party/pdfium/core/fpdftext/cpdf_linkextract.cpp
@@ -31,21 +31,39 @@ void CPDF_LinkExtract::ExtractLinks() {
}
void CPDF_LinkExtract::ParseLink() {
- int start = 0, pos = 0;
- int TotalChar = m_pTextPage->CountChars();
- while (pos < TotalChar) {
+ int start = 0;
+ int pos = 0;
+ int nTotalChar = m_pTextPage->CountChars();
+ bool bAfterHyphen = false;
+ bool bLineBreak = false;
+ while (pos < nTotalChar) {
FPDF_CHAR_INFO pageChar;
m_pTextPage->GetCharInfo(pos, &pageChar);
if (pageChar.m_Flag == FPDFTEXT_CHAR_GENERATED ||
- pageChar.m_Unicode == 0x20 || pos == TotalChar - 1) {
+ pageChar.m_Unicode == TEXT_SPACE_CHAR || pos == nTotalChar - 1) {
int nCount = pos - start;
- if (pos == TotalChar - 1)
+ if (pos == nTotalChar - 1) {
nCount++;
+ } else if (bAfterHyphen && (pageChar.m_Unicode == TEXT_LINEFEED_CHAR ||
+ pageChar.m_Unicode == TEXT_RETURN_CHAR)) {
+ // Handle text breaks with a hyphen to the next line.
+ bLineBreak = true;
+ pos++;
+ continue;
+ }
CFX_WideString strBeCheck;
strBeCheck = m_pTextPage->GetPageText(start, nCount);
+ if (bLineBreak) {
+ strBeCheck.Remove(TEXT_LINEFEED_CHAR);
+ strBeCheck.Remove(TEXT_RETURN_CHAR);
+ bLineBreak = false;
+ }
+ // Replace the generated code with the hyphen char.
+ strBeCheck.Replace(L"\xfffe", TEXT_HYPHEN);
+
if (strBeCheck.GetLength() > 5) {
while (strBeCheck.GetLength() > 0) {
- FX_WCHAR ch = strBeCheck.GetAt(strBeCheck.GetLength() - 1);
+ wchar_t ch = strBeCheck.GetAt(strBeCheck.GetLength() - 1);
if (ch == L')' || ch == L',' || ch == L'>' || ch == L'.') {
strBeCheck = strBeCheck.Mid(0, strBeCheck.GetLength() - 1);
nCount--;
@@ -60,6 +78,9 @@ void CPDF_LinkExtract::ParseLink() {
}
start = ++pos;
} else {
+ bAfterHyphen = (pageChar.m_Flag == FPDFTEXT_CHAR_HYPHEN ||
+ (pageChar.m_Flag == FPDFTEXT_CHAR_NORMAL &&
+ pageChar.m_Unicode == TEXT_HYPHEN_CHAR));
pos++;
}
}
@@ -101,7 +122,7 @@ bool CPDF_LinkExtract::CheckMailLink(CFX_WideString& str) {
// Check the local part.
int pPos = aPos; // Used to track the position of '@' or '.'.
for (int i = aPos - 1; i >= 0; i--) {
- FX_WCHAR ch = str.GetAt(i);
+ wchar_t ch = str.GetAt(i);
if (ch == L'_' || ch == L'-' || FXSYS_iswalnum(ch))
continue;
@@ -137,7 +158,7 @@ bool CPDF_LinkExtract::CheckMailLink(CFX_WideString& str) {
int nLen = str.GetLength();
pPos = 0; // Used to track the position of '.'.
for (int i = aPos + 1; i < nLen; i++) {
- FX_WCHAR wch = str.GetAt(i);
+ wchar_t wch = str.GetAt(i);
if (wch == L'-' || FXSYS_iswalnum(wch))
continue;
diff --git a/chromium/third_party/pdfium/core/fpdftext/cpdf_textpage.cpp b/chromium/third_party/pdfium/core/fpdftext/cpdf_textpage.cpp
index 73a1a7e88e4..c81d4fa4079 100644
--- a/chromium/third_party/pdfium/core/fpdftext/cpdf_textpage.cpp
+++ b/chromium/third_party/pdfium/core/fpdftext/cpdf_textpage.cpp
@@ -26,12 +26,12 @@
namespace {
-const FX_FLOAT kDefaultFontSize = 1.0f;
+const float kDefaultFontSize = 1.0f;
const uint16_t* const g_UnicodeData_Normalization_Maps[5] = {
nullptr, g_UnicodeData_Normalization_Map1, g_UnicodeData_Normalization_Map2,
g_UnicodeData_Normalization_Map3, g_UnicodeData_Normalization_Map4};
-FX_FLOAT NormalizeThreshold(FX_FLOAT threshold) {
+float NormalizeThreshold(float threshold) {
if (threshold < 300)
return threshold / 2.0f;
if (threshold < 500)
@@ -41,21 +41,21 @@ FX_FLOAT NormalizeThreshold(FX_FLOAT threshold) {
return threshold / 6.0f;
}
-FX_FLOAT CalculateBaseSpace(const CPDF_TextObject* pTextObj,
- const CFX_Matrix& matrix) {
- FX_FLOAT baseSpace = 0.0;
+float CalculateBaseSpace(const CPDF_TextObject* pTextObj,
+ const CFX_Matrix& matrix) {
+ float baseSpace = 0.0;
const int nItems = pTextObj->CountItems();
if (pTextObj->m_TextState.GetCharSpace() && nItems >= 3) {
bool bAllChar = true;
- FX_FLOAT spacing =
+ float spacing =
matrix.TransformDistance(pTextObj->m_TextState.GetCharSpace());
baseSpace = spacing;
for (int i = 0; i < nItems; i++) {
CPDF_TextObjectItem item;
pTextObj->GetItemInfo(i, &item);
if (item.m_CharCode == static_cast<uint32_t>(-1)) {
- FX_FLOAT fontsize_h = pTextObj->m_TextState.GetFontSizeH();
- FX_FLOAT kerning = -fontsize_h * item.m_Origin.x / 1000;
+ float fontsize_h = pTextObj->m_TextState.GetFontSizeH();
+ float kerning = -fontsize_h * item.m_Origin.x / 1000;
baseSpace = std::min(baseSpace, kerning + spacing);
bAllChar = false;
}
@@ -66,9 +66,9 @@ FX_FLOAT CalculateBaseSpace(const CPDF_TextObject* pTextObj,
return baseSpace;
}
-FX_STRSIZE Unicode_GetNormalization(FX_WCHAR wch, FX_WCHAR* pDst) {
+FX_STRSIZE Unicode_GetNormalization(wchar_t wch, wchar_t* pDst) {
wch = wch & 0xFFFF;
- FX_WCHAR wFind = g_UnicodeData_Normalization[wch];
+ wchar_t wFind = g_UnicodeData_Normalization[wch];
if (!wFind) {
if (pDst)
*pDst = wch;
@@ -84,12 +84,12 @@ FX_STRSIZE Unicode_GetNormalization(FX_WCHAR wch, FX_WCHAR* pDst) {
const uint16_t* pMap = g_UnicodeData_Normalization_Maps[wFind];
if (pMap == g_UnicodeData_Normalization_Map4) {
pMap = g_UnicodeData_Normalization_Map4 + wch;
- wFind = (FX_WCHAR)(*pMap++);
+ wFind = (wchar_t)(*pMap++);
} else {
pMap += wch;
}
if (pDst) {
- FX_WCHAR n = wFind;
+ wchar_t n = wFind;
while (n--)
*pDst++ = *pMap++;
}
@@ -277,7 +277,7 @@ std::vector<CFX_FloatRect> CPDF_TextPage::GetRectArray(int start,
rect.top =
origin.y +
pCurObj->GetFont()->GetTypeAscent() * pCurObj->GetFontSize() / 1000;
- FX_FLOAT xPosTemp =
+ float xPosTemp =
origin.x +
GetCharWidth(info_curchar.m_CharCode, pCurObj->GetFont()) *
pCurObj->GetFontSize() / 1000;
@@ -323,14 +323,12 @@ int CPDF_TextPage::GetIndexAtPos(const CFX_PointF& point,
charRectExt.bottom = charrect.bottom - tolerance.height / 2;
if (charRectExt.Contains(point)) {
double curXdif, curYdif;
- curXdif = FXSYS_fabs(point.x - charrect.left) <
- FXSYS_fabs(point.x - charrect.right)
- ? FXSYS_fabs(point.x - charrect.left)
- : FXSYS_fabs(point.x - charrect.right);
- curYdif = FXSYS_fabs(point.y - charrect.bottom) <
- FXSYS_fabs(point.y - charrect.top)
- ? FXSYS_fabs(point.y - charrect.bottom)
- : FXSYS_fabs(point.y - charrect.top);
+ curXdif = fabs(point.x - charrect.left) < fabs(point.x - charrect.right)
+ ? fabs(point.x - charrect.left)
+ : fabs(point.x - charrect.right);
+ curYdif = fabs(point.y - charrect.bottom) < fabs(point.y - charrect.top)
+ ? fabs(point.y - charrect.bottom)
+ : fabs(point.y - charrect.top);
if (curYdif + curXdif < xdif + ydif) {
ydif = curYdif;
xdif = curXdif;
@@ -347,13 +345,13 @@ CFX_WideString CPDF_TextPage::GetTextByRect(const CFX_FloatRect& rect) const {
if (!m_bIsParsed)
return CFX_WideString();
- FX_FLOAT posy = 0;
+ float posy = 0;
bool IsContainPreChar = false;
bool IsAddLineFeed = false;
CFX_WideString strText;
for (const auto& charinfo : m_CharList) {
if (IsRectIntersect(rect, charinfo.m_CharBox)) {
- if (FXSYS_fabs(posy - charinfo.m_Origin.y) > 0 && !IsContainPreChar &&
+ if (fabs(posy - charinfo.m_Origin.y) > 0 && !IsContainPreChar &&
IsAddLineFeed) {
posy = charinfo.m_Origin.y;
if (!strText.IsEmpty())
@@ -378,10 +376,7 @@ CFX_WideString CPDF_TextPage::GetTextByRect(const CFX_FloatRect& rect) const {
}
void CPDF_TextPage::GetCharInfo(int index, FPDF_CHAR_INFO* info) const {
- if (!m_bIsParsed)
- return;
-
- if (index < 0 || index >= pdfium::CollectionSize<int>(m_CharList))
+ if (!m_bIsParsed || !pdfium::IndexInBounds(m_CharList, index))
return;
const PAGECHAR_INFO& charinfo = m_CharList[index];
@@ -492,14 +487,11 @@ int CPDF_TextPage::CountRects(int start, int nCount) {
}
void CPDF_TextPage::GetRect(int rectIndex,
- FX_FLOAT& left,
- FX_FLOAT& top,
- FX_FLOAT& right,
- FX_FLOAT& bottom) const {
- if (!m_bIsParsed)
- return;
-
- if (rectIndex < 0 || rectIndex >= pdfium::CollectionSize<int>(m_SelRects))
+ float& left,
+ float& top,
+ float& right,
+ float& bottom) const {
+ if (!m_bIsParsed || !pdfium::IndexInBounds(m_SelRects, rectIndex))
return;
left = m_SelRects[rectIndex].left;
@@ -520,7 +512,7 @@ CPDF_TextPage::TextOrientation CPDF_TextPage::FindTextlineFlowOrientation()
std::vector<bool> nHorizontalMask(nPageWidth);
std::vector<bool> nVerticalMask(nPageHeight);
- FX_FLOAT fLineHeight = 0.0f;
+ float fLineHeight = 0.0f;
int32_t nStartH = nPageWidth;
int32_t nEndH = 0;
int32_t nStartV = nPageHeight;
@@ -556,11 +548,11 @@ CPDF_TextPage::TextOrientation CPDF_TextPage::FindTextlineFlowOrientation()
if ((nEndH - nStartH) < nDoubleLineHeight)
return TextOrientation::Vertical;
- const FX_FLOAT nSumH = MaskPercentFilled(nHorizontalMask, nStartH, nEndH);
+ const float nSumH = MaskPercentFilled(nHorizontalMask, nStartH, nEndH);
if (nSumH > 0.8f)
return TextOrientation::Horizontal;
- const FX_FLOAT nSumV = MaskPercentFilled(nVerticalMask, nStartV, nEndV);
+ const float nSumV = MaskPercentFilled(nVerticalMask, nStartV, nEndV);
if (nSumH > nSumV)
return TextOrientation::Horizontal;
if (nSumH < nSumV)
@@ -568,7 +560,7 @@ CPDF_TextPage::TextOrientation CPDF_TextPage::FindTextlineFlowOrientation()
return TextOrientation::Unknown;
}
-void CPDF_TextPage::AppendGeneratedCharacter(FX_WCHAR unicode,
+void CPDF_TextPage::AppendGeneratedCharacter(wchar_t unicode,
const CFX_Matrix& formMatrix) {
PAGECHAR_INFO generateChar;
if (!GenerateCharInfo(unicode, generateChar))
@@ -632,14 +624,14 @@ int CPDF_TextPage::GetCharWidth(uint32_t charCode, CPDF_Font* pFont) const {
return w;
CFX_ByteString str;
- pFont->AppendChar(str, charCode);
+ pFont->AppendChar(&str, charCode);
if (int w = pFont->GetStringWidth(str.c_str(), 1))
return w;
return pFont->GetCharBBox(charCode).Width();
}
-void CPDF_TextPage::AddCharInfoByLRDirection(FX_WCHAR wChar,
+void CPDF_TextPage::AddCharInfoByLRDirection(wchar_t wChar,
PAGECHAR_INFO info) {
if (IsControlChar(info)) {
info.m_Index = -1;
@@ -649,10 +641,10 @@ void CPDF_TextPage::AddCharInfoByLRDirection(FX_WCHAR wChar,
info.m_Index = m_TextBuf.GetLength();
if (wChar >= 0xFB00 && wChar <= 0xFB06) {
- FX_WCHAR* pDst = nullptr;
+ wchar_t* pDst = nullptr;
FX_STRSIZE nCount = Unicode_GetNormalization(wChar, pDst);
if (nCount >= 1) {
- pDst = FX_Alloc(FX_WCHAR, nCount);
+ pDst = FX_Alloc(wchar_t, nCount);
Unicode_GetNormalization(wChar, pDst);
for (int nIndex = 0; nIndex < nCount; nIndex++) {
PAGECHAR_INFO info2 = info;
@@ -669,7 +661,7 @@ void CPDF_TextPage::AddCharInfoByLRDirection(FX_WCHAR wChar,
m_CharList.push_back(info);
}
-void CPDF_TextPage::AddCharInfoByRLDirection(FX_WCHAR wChar,
+void CPDF_TextPage::AddCharInfoByRLDirection(wchar_t wChar,
PAGECHAR_INFO info) {
if (IsControlChar(info)) {
info.m_Index = -1;
@@ -679,10 +671,10 @@ void CPDF_TextPage::AddCharInfoByRLDirection(FX_WCHAR wChar,
info.m_Index = m_TextBuf.GetLength();
wChar = FX_GetMirrorChar(wChar, true, false);
- FX_WCHAR* pDst = nullptr;
+ wchar_t* pDst = nullptr;
FX_STRSIZE nCount = Unicode_GetNormalization(wChar, pDst);
if (nCount >= 1) {
- pDst = FX_Alloc(FX_WCHAR, nCount);
+ pDst = FX_Alloc(wchar_t, nCount);
Unicode_GetNormalization(wChar, pDst);
for (int nIndex = 0; nIndex < nCount; nIndex++) {
PAGECHAR_INFO info2 = info;
@@ -744,7 +736,7 @@ void CPDF_TextPage::ProcessTextObject(
const CFX_Matrix& formMatrix,
const CPDF_PageObjectList* pObjList,
CPDF_PageObjectList::const_iterator ObjPos) {
- if (FXSYS_fabs(pTextObj->m_Right - pTextObj->m_Left) < 0.01f)
+ if (fabs(pTextObj->m_Right - pTextObj->m_Left) < 0.01f)
return;
size_t count = m_LineObj.size();
@@ -762,31 +754,30 @@ void CPDF_TextPage::ProcessTextObject(
CPDF_TextObjectItem item;
int nItem = prev_Obj.m_pTextObj->CountItems();
prev_Obj.m_pTextObj->GetItemInfo(nItem - 1, &item);
- FX_FLOAT prev_width =
+ float prev_width =
GetCharWidth(item.m_CharCode, prev_Obj.m_pTextObj->GetFont()) *
prev_Obj.m_pTextObj->GetFontSize() / 1000;
CFX_Matrix prev_matrix = prev_Obj.m_pTextObj->GetTextMatrix();
- prev_width = FXSYS_fabs(prev_width);
+ prev_width = fabs(prev_width);
prev_matrix.Concat(prev_Obj.m_formMatrix);
prev_width = prev_matrix.TransformDistance(prev_width);
pTextObj->GetItemInfo(0, &item);
- FX_FLOAT this_width = GetCharWidth(item.m_CharCode, pTextObj->GetFont()) *
- pTextObj->GetFontSize() / 1000;
- this_width = FXSYS_fabs(this_width);
+ float this_width = GetCharWidth(item.m_CharCode, pTextObj->GetFont()) *
+ pTextObj->GetFontSize() / 1000;
+ this_width = fabs(this_width);
CFX_Matrix this_matrix = pTextObj->GetTextMatrix();
- this_width = FXSYS_fabs(this_width);
+ this_width = fabs(this_width);
this_matrix.Concat(formMatrix);
this_width = this_matrix.TransformDistance(this_width);
- FX_FLOAT threshold =
- prev_width > this_width ? prev_width / 4 : this_width / 4;
+ float threshold = prev_width > this_width ? prev_width / 4 : this_width / 4;
CFX_PointF prev_pos = m_DisplayMatrix.Transform(
prev_Obj.m_formMatrix.Transform(prev_Obj.m_pTextObj->GetPos()));
CFX_PointF this_pos =
m_DisplayMatrix.Transform(formMatrix.Transform(pTextObj->GetPos()));
- if (FXSYS_fabs(this_pos.y - prev_pos.y) > threshold * 2) {
+ if (fabs(this_pos.y - prev_pos.y) > threshold * 2) {
for (size_t i = 0; i < count; i++)
ProcessTextObject(m_LineObj[i]);
m_LineObj.clear();
@@ -858,7 +849,7 @@ FPDFText_MarkedContent CPDF_TextPage::PreMarkedContent(PDFTEXT_Obj Obj) {
bExist = false;
for (FX_STRSIZE i = 0; i < nItems; i++) {
- FX_WCHAR wChar = actText.GetAt(i);
+ wchar_t wChar = actText.GetAt(i);
if ((wChar > 0x80 && wChar < 0xFFFD) || (wChar <= 0x80 && isprint(wChar))) {
bExist = true;
break;
@@ -895,7 +886,7 @@ void CPDF_TextPage::ProcessMarkedContent(PDFTEXT_Obj Obj) {
matrix.Concat(Obj.m_formMatrix);
for (FX_STRSIZE k = 0; k < nItems; k++) {
- FX_WCHAR wChar = actText.GetAt(k);
+ wchar_t wChar = actText.GetAt(k);
if (wChar <= 0x80 && !isprint(wChar))
wChar = 0x20;
if (wChar >= 0xFFFD)
@@ -934,7 +925,7 @@ void CPDF_TextPage::SwapTempTextBuf(int32_t iCharListStartAppend,
std::swap(m_TempCharList[i], m_TempCharList[j]);
std::swap(m_TempCharList[i].m_Index, m_TempCharList[j].m_Index);
}
- FX_WCHAR* pTempBuffer = m_TempTextBuf.GetBuffer();
+ wchar_t* pTempBuffer = m_TempTextBuf.GetBuffer();
i = iBufStartAppend;
j = m_TempTextBuf.GetLength() - 1;
for (; i < j; i++, j--)
@@ -951,9 +942,9 @@ bool CPDF_TextPage::IsRightToLeft(const CPDF_TextObject* pTextObj,
if (item.m_CharCode == static_cast<uint32_t>(-1))
continue;
CFX_WideString wstrItem = pFont->UnicodeFromCharCode(item.m_CharCode);
- FX_WCHAR wChar = wstrItem.GetAt(0);
+ wchar_t wChar = wstrItem.GetAt(0);
if ((wstrItem.IsEmpty() || wChar == 0) && item.m_CharCode)
- wChar = (FX_WCHAR)item.m_CharCode;
+ wChar = (wchar_t)item.m_CharCode;
if (wChar)
str += wChar;
}
@@ -962,7 +953,7 @@ bool CPDF_TextPage::IsRightToLeft(const CPDF_TextObject* pTextObj,
void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) {
CPDF_TextObject* pTextObj = Obj.m_pTextObj;
- if (FXSYS_fabs(pTextObj->m_Right - pTextObj->m_Left) < 0.01f)
+ if (fabs(pTextObj->m_Right - pTextObj->m_Left) < 0.01f)
return;
CFX_Matrix formMatrix = Obj.m_formMatrix;
CPDF_Font* pFont = pTextObj->GetFont();
@@ -1010,8 +1001,8 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) {
CFX_WideString wstrItem =
pTextObj->GetFont()->UnicodeFromCharCode(item.m_CharCode);
if (wstrItem.IsEmpty())
- wstrItem += (FX_WCHAR)item.m_CharCode;
- FX_WCHAR curChar = wstrItem.GetAt(0);
+ wstrItem += (wchar_t)item.m_CharCode;
+ wchar_t curChar = wstrItem.GetAt(0);
if (curChar == 0x2D || curChar == 0xAD)
return;
}
@@ -1041,7 +1032,7 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) {
m_pPreTextObj = pTextObj;
m_perMatrix = formMatrix;
int nItems = pTextObj->CountItems();
- FX_FLOAT baseSpace = CalculateBaseSpace(pTextObj, matrix);
+ float baseSpace = CalculateBaseSpace(pTextObj, matrix);
const bool bR2L = IsRightToLeft(pTextObj, pFont, nItems);
const bool bIsBidiAndMirrorInverse =
@@ -1050,7 +1041,7 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) {
int32_t iCharListStartAppend =
pdfium::CollectionSize<int32_t>(m_TempCharList);
- FX_FLOAT spacing = 0;
+ float spacing = 0;
for (int i = 0; i < nItems; i++) {
CPDF_TextObjectItem item;
PAGECHAR_INFO charinfo;
@@ -1062,21 +1053,21 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) {
if (str.IsEmpty() || str.GetAt(str.GetLength() - 1) == TEXT_SPACE_CHAR)
continue;
- FX_FLOAT fontsize_h = pTextObj->m_TextState.GetFontSizeH();
+ float fontsize_h = pTextObj->m_TextState.GetFontSizeH();
spacing = -fontsize_h * item.m_Origin.x / 1000;
continue;
}
- FX_FLOAT charSpace = pTextObj->m_TextState.GetCharSpace();
+ float charSpace = pTextObj->m_TextState.GetCharSpace();
if (charSpace > 0.001)
spacing += matrix.TransformDistance(charSpace);
else if (charSpace < -0.001)
- spacing -= matrix.TransformDistance(FXSYS_fabs(charSpace));
+ spacing -= matrix.TransformDistance(fabs(charSpace));
spacing -= baseSpace;
if (spacing && i > 0) {
int last_width = 0;
- FX_FLOAT fontsize_h = pTextObj->m_TextState.GetFontSizeH();
+ float fontsize_h = pTextObj->m_TextState.GetFontSizeH();
uint32_t space_charcode = pFont->CharCodeFromUnicode(' ');
- FX_FLOAT threshold = 0;
+ float threshold = 0;
if (space_charcode != CPDF_Font::kInvalidCharCode)
threshold = fontsize_h * pFont->GetCharWidthF(space_charcode) / 1000;
if (threshold > fontsize_h / 3)
@@ -1085,9 +1076,9 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) {
threshold /= 2;
if (threshold == 0) {
threshold = fontsize_h;
- int this_width = FXSYS_abs(GetCharWidth(item.m_CharCode, pFont));
- threshold = this_width > last_width ? (FX_FLOAT)this_width
- : (FX_FLOAT)last_width;
+ int this_width = abs(GetCharWidth(item.m_CharCode, pFont));
+ threshold =
+ this_width > last_width ? (float)this_width : (float)last_width;
threshold = NormalizeThreshold(threshold);
threshold = fontsize_h * threshold / 1000;
}
@@ -1112,7 +1103,7 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) {
CFX_WideString wstrItem = pFont->UnicodeFromCharCode(item.m_CharCode);
bool bNoUnicode = false;
if (wstrItem.IsEmpty() && item.m_CharCode) {
- wstrItem += static_cast<FX_WCHAR>(item.m_CharCode);
+ wstrItem += static_cast<wchar_t>(item.m_CharCode);
bNoUnicode = true;
}
charinfo.m_Index = -1;
@@ -1155,15 +1146,15 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) {
bool bDel = false;
const int count =
std::min(pdfium::CollectionSize<int>(m_TempCharList), 7);
- FX_FLOAT threshold = charinfo.m_Matrix.TransformXDistance(
- (FX_FLOAT)TEXT_CHARRATIO_GAPDELTA * pTextObj->GetFontSize());
+ float threshold = charinfo.m_Matrix.TransformXDistance(
+ (float)TEXT_CHARRATIO_GAPDELTA * pTextObj->GetFontSize());
for (int n = pdfium::CollectionSize<int>(m_TempCharList);
n > pdfium::CollectionSize<int>(m_TempCharList) - count; n--) {
const PAGECHAR_INFO& charinfo1 = m_TempCharList[n - 1];
CFX_PointF diff = charinfo1.m_Origin - charinfo.m_Origin;
if (charinfo1.m_CharCode == charinfo.m_CharCode &&
charinfo1.m_pTextObj->GetFont() == charinfo.m_pTextObj->GetFont() &&
- FXSYS_fabs(diff.x) < threshold && FXSYS_fabs(diff.y) < threshold) {
+ fabs(diff.x) < threshold && fabs(diff.y) < threshold) {
bDel = true;
break;
}
@@ -1207,8 +1198,8 @@ CPDF_TextPage::TextOrientation CPDF_TextPage::GetTextObjectWritingMode(
first.m_Origin = textMatrix.Transform(first.m_Origin);
last.m_Origin = textMatrix.Transform(last.m_Origin);
- FX_FLOAT dX = FXSYS_fabs(last.m_Origin.x - first.m_Origin.x);
- FX_FLOAT dY = FXSYS_fabs(last.m_Origin.y - first.m_Origin.y);
+ float dX = fabs(last.m_Origin.x - first.m_Origin.x);
+ float dY = fabs(last.m_Origin.y - first.m_Origin.y);
if (dX <= 0.0001f && dY <= 0.0001f)
return TextOrientation::Unknown;
@@ -1223,18 +1214,18 @@ CPDF_TextPage::TextOrientation CPDF_TextPage::GetTextObjectWritingMode(
return m_TextlineDir;
}
-bool CPDF_TextPage::IsHyphen(FX_WCHAR curChar) {
+bool CPDF_TextPage::IsHyphen(wchar_t curChar) {
CFX_WideString strCurText = m_TempTextBuf.MakeString();
if (strCurText.IsEmpty())
strCurText = m_TextBuf.AsStringC();
FX_STRSIZE nCount = strCurText.GetLength();
int nIndex = nCount - 1;
- FX_WCHAR wcTmp = strCurText.GetAt(nIndex);
+ wchar_t wcTmp = strCurText.GetAt(nIndex);
while (wcTmp == 0x20 && nIndex <= nCount - 1 && nIndex >= 0)
wcTmp = strCurText.GetAt(--nIndex);
if (0x2D == wcTmp || 0xAD == wcTmp) {
if (--nIndex > 0) {
- FX_WCHAR preChar = strCurText.GetAt((nIndex));
+ wchar_t preChar = strCurText.GetAt((nIndex));
if (((preChar >= L'A' && preChar <= L'Z') ||
(preChar >= L'a' && preChar <= L'z')) &&
((curChar >= L'A' && curChar <= L'Z') ||
@@ -1275,14 +1266,13 @@ CPDF_TextPage::GenerateCharacter CPDF_TextPage::ProcessInsertObject(
CFX_WideString wstrItem =
pObj->GetFont()->UnicodeFromCharCode(item.m_CharCode);
if (wstrItem.IsEmpty())
- wstrItem += static_cast<FX_WCHAR>(item.m_CharCode);
- FX_WCHAR curChar = wstrItem.GetAt(0);
+ wstrItem += static_cast<wchar_t>(item.m_CharCode);
+ wchar_t curChar = wstrItem.GetAt(0);
if (WritingMode == TextOrientation::Horizontal) {
if (this_rect.Height() > 4.5 && prev_rect.Height() > 4.5) {
- FX_FLOAT top =
- this_rect.top < prev_rect.top ? this_rect.top : prev_rect.top;
- FX_FLOAT bottom = this_rect.bottom > prev_rect.bottom ? this_rect.bottom
- : prev_rect.bottom;
+ float top = this_rect.top < prev_rect.top ? this_rect.top : prev_rect.top;
+ float bottom = this_rect.bottom > prev_rect.bottom ? this_rect.bottom
+ : prev_rect.bottom;
if (bottom >= top) {
return IsHyphen(curChar) ? GenerateCharacter::Hyphen
: GenerateCharacter::LineBreak;
@@ -1291,11 +1281,10 @@ CPDF_TextPage::GenerateCharacter CPDF_TextPage::ProcessInsertObject(
} else if (WritingMode == TextOrientation::Vertical) {
if (this_rect.Width() > pObj->GetFontSize() * 0.1f &&
prev_rect.Width() > m_pPreTextObj->GetFontSize() * 0.1f) {
- FX_FLOAT left = this_rect.left > m_CurlineRect.left ? this_rect.left
- : m_CurlineRect.left;
- FX_FLOAT right = this_rect.right < m_CurlineRect.right
- ? this_rect.right
- : m_CurlineRect.right;
+ float left = this_rect.left > m_CurlineRect.left ? this_rect.left
+ : m_CurlineRect.left;
+ float right = this_rect.right < m_CurlineRect.right ? this_rect.right
+ : m_CurlineRect.right;
if (right <= left) {
return IsHyphen(curChar) ? GenerateCharacter::Hyphen
: GenerateCharacter::LineBreak;
@@ -1303,15 +1292,14 @@ CPDF_TextPage::GenerateCharacter CPDF_TextPage::ProcessInsertObject(
}
}
- FX_FLOAT last_pos = PrevItem.m_Origin.x;
+ float last_pos = PrevItem.m_Origin.x;
int nLastWidth = GetCharWidth(PrevItem.m_CharCode, m_pPreTextObj->GetFont());
- FX_FLOAT last_width = nLastWidth * m_pPreTextObj->GetFontSize() / 1000;
- last_width = FXSYS_fabs(last_width);
+ float last_width = nLastWidth * m_pPreTextObj->GetFontSize() / 1000;
+ last_width = fabs(last_width);
int nThisWidth = GetCharWidth(item.m_CharCode, pObj->GetFont());
- FX_FLOAT this_width = nThisWidth * pObj->GetFontSize() / 1000;
- this_width = FXSYS_fabs(this_width);
- FX_FLOAT threshold =
- last_width > this_width ? last_width / 4 : this_width / 4;
+ float this_width = nThisWidth * pObj->GetFontSize() / 1000;
+ this_width = fabs(this_width);
+ float threshold = last_width > this_width ? last_width / 4 : this_width / 4;
CFX_Matrix prev_matrix = m_pPreTextObj->GetTextMatrix();
prev_matrix.Concat(m_perMatrix);
@@ -1332,8 +1320,7 @@ CPDF_TextPage::GenerateCharacter CPDF_TextPage::ProcessInsertObject(
rect1.Intersect(rect2);
if ((rect1.IsEmpty() && rect2.Height() > 5 && rect3.Height() > 5) ||
((pos.y > threshold * 2 || pos.y < threshold * -3) &&
- (FXSYS_fabs(pos.y) < 1 ? FXSYS_fabs(pos.x) < FXSYS_fabs(pos.y)
- : true))) {
+ (fabs(pos.y) < 1 ? fabs(pos.x) < fabs(pos.y) : true))) {
bNewline = true;
if (nItem > 1) {
CPDF_TextObjectItem tempItem;
@@ -1368,20 +1355,20 @@ CPDF_TextPage::GenerateCharacter CPDF_TextPage::ProcessInsertObject(
}
CFX_WideString PrevStr =
m_pPreTextObj->GetFont()->UnicodeFromCharCode(PrevItem.m_CharCode);
- FX_WCHAR preChar = PrevStr.GetAt(PrevStr.GetLength() - 1);
+ wchar_t preChar = PrevStr.GetAt(PrevStr.GetLength() - 1);
CFX_Matrix matrix = pObj->GetTextMatrix();
matrix.Concat(formMatrix);
- threshold = (FX_FLOAT)(nLastWidth > nThisWidth ? nLastWidth : nThisWidth);
+ threshold = (float)(nLastWidth > nThisWidth ? nLastWidth : nThisWidth);
threshold = threshold > 400
? (threshold < 700
? threshold / 4
: (threshold > 800 ? threshold / 6 : threshold / 5))
: (threshold / 2);
if (nLastWidth >= nThisWidth) {
- threshold *= FXSYS_fabs(m_pPreTextObj->GetFontSize());
+ threshold *= fabs(m_pPreTextObj->GetFontSize());
} else {
- threshold *= FXSYS_fabs(pObj->GetFontSize());
+ threshold *= fabs(pObj->GetFontSize());
threshold = matrix.TransformDistance(threshold);
threshold = prev_reverse.TransformDistance(threshold);
}
@@ -1390,8 +1377,8 @@ CPDF_TextPage::GenerateCharacter CPDF_TextPage::ProcessInsertObject(
(threshold < 1.39001 && threshold > 1.38999)) {
threshold *= 1.5;
}
- if (FXSYS_fabs(last_pos + last_width - pos.x) > threshold &&
- curChar != L' ' && preChar != L' ') {
+ if (fabs(last_pos + last_width - pos.x) > threshold && curChar != L' ' &&
+ preChar != L' ') {
if (curChar != L' ' && preChar != L' ') {
if ((pos.x - last_pos - last_width) > threshold ||
(last_pos - pos.x - last_width) > threshold) {
@@ -1416,11 +1403,11 @@ bool CPDF_TextPage::IsSameTextObject(CPDF_TextObject* pTextObj1,
CFX_FloatRect rcPreObj = pTextObj2->GetRect();
CFX_FloatRect rcCurObj = pTextObj1->GetRect();
if (rcPreObj.IsEmpty() && rcCurObj.IsEmpty()) {
- FX_FLOAT dbXdif = FXSYS_fabs(rcPreObj.left - rcCurObj.left);
+ float dbXdif = fabs(rcPreObj.left - rcCurObj.left);
size_t nCount = m_CharList.size();
if (nCount >= 2) {
PAGECHAR_INFO perCharTemp = m_CharList[nCount - 2];
- FX_FLOAT dbSpace = perCharTemp.m_CharBox.Width();
+ float dbSpace = perCharTemp.m_CharBox.Width();
if (dbXdif > dbSpace)
return false;
}
@@ -1429,8 +1416,7 @@ bool CPDF_TextPage::IsSameTextObject(CPDF_TextObject* pTextObj1,
rcPreObj.Intersect(rcCurObj);
if (rcPreObj.IsEmpty())
return false;
- if (FXSYS_fabs(rcPreObj.Width() - rcCurObj.Width()) >
- rcCurObj.Width() / 2) {
+ if (fabs(rcPreObj.Width() - rcCurObj.Width()) > rcCurObj.Width() / 2) {
return false;
}
if (pTextObj2->GetFontSize() != pTextObj1->GetFontSize())
@@ -1454,12 +1440,12 @@ bool CPDF_TextPage::IsSameTextObject(CPDF_TextObject* pTextObj1,
}
CFX_PointF diff = pTextObj1->GetPos() - pTextObj2->GetPos();
- FX_FLOAT font_size = pTextObj2->GetFontSize();
- FX_FLOAT char_size = GetCharWidth(itemPer.m_CharCode, pTextObj2->GetFont());
- FX_FLOAT max_pre_size =
+ float font_size = pTextObj2->GetFontSize();
+ float char_size = GetCharWidth(itemPer.m_CharCode, pTextObj2->GetFont());
+ float max_pre_size =
std::max(std::max(rcPreObj.Height(), rcPreObj.Width()), font_size);
- if (FXSYS_fabs(diff.x) > char_size * font_size / 1000 * 0.9 ||
- FXSYS_fabs(diff.y) > max_pre_size / 8) {
+ if (fabs(diff.x) > char_size * font_size / 1000 * 0.9 ||
+ fabs(diff.y) > max_pre_size / 8) {
return false;
}
return true;
@@ -1482,7 +1468,7 @@ bool CPDF_TextPage::IsSameAsPreTextObject(
return false;
}
-bool CPDF_TextPage::GenerateCharInfo(FX_WCHAR unicode, PAGECHAR_INFO& info) {
+bool CPDF_TextPage::GenerateCharInfo(wchar_t unicode, PAGECHAR_INFO& info) {
const PAGECHAR_INFO* preChar;
if (!m_TempCharList.empty())
preChar = &m_TempCharList.back();
@@ -1503,8 +1489,8 @@ bool CPDF_TextPage::GenerateCharInfo(FX_WCHAR unicode, PAGECHAR_INFO& info) {
GetCharWidth(preChar->m_CharCode, preChar->m_pTextObj->GetFont());
}
- FX_FLOAT fFontSize = preChar->m_pTextObj ? preChar->m_pTextObj->GetFontSize()
- : preChar->m_CharBox.Height();
+ float fFontSize = preChar->m_pTextObj ? preChar->m_pTextObj->GetFontSize()
+ : preChar->m_CharBox.Height();
if (!fFontSize)
fFontSize = kDefaultFontSize;
diff --git a/chromium/third_party/pdfium/core/fpdftext/cpdf_textpage.h b/chromium/third_party/pdfium/core/fpdftext/cpdf_textpage.h
index 91942d1bec0..d7e29edf3b9 100644
--- a/chromium/third_party/pdfium/core/fpdftext/cpdf_textpage.h
+++ b/chromium/third_party/pdfium/core/fpdftext/cpdf_textpage.h
@@ -34,10 +34,12 @@ class CPDF_TextObject;
#define TEXT_SPACE_CHAR L' '
#define TEXT_LINEFEED_CHAR L'\n'
#define TEXT_RETURN_CHAR L'\r'
+#define TEXT_HYPHEN_CHAR L'-'
#define TEXT_EMPTY L""
#define TEXT_SPACE L" "
#define TEXT_RETURN_LINEFEED L"\r\n"
#define TEXT_LINEFEED L"\n"
+#define TEXT_HYPHEN L"-"
#define TEXT_CHARRATIO_GAPDELTA 0.070
enum class FPDFText_MarkedContent { Pass = 0, Done, Delay };
@@ -49,10 +51,10 @@ class FPDF_CHAR_INFO {
FPDF_CHAR_INFO();
~FPDF_CHAR_INFO();
- FX_WCHAR m_Unicode;
- FX_WCHAR m_Charcode;
+ wchar_t m_Unicode;
+ wchar_t m_Charcode;
int32_t m_Flag;
- FX_FLOAT m_FontSize;
+ float m_FontSize;
CFX_PointF m_Origin;
CFX_FloatRect m_CharBox;
CPDF_TextObject* m_pTextObj;
@@ -72,7 +74,7 @@ class PAGECHAR_INFO {
int m_Index;
int m_CharCode;
- FX_WCHAR m_Unicode;
+ wchar_t m_Unicode;
int32_t m_Flag;
CFX_PointF m_Origin;
CFX_FloatRect m_CharBox;
@@ -103,10 +105,10 @@ class CPDF_TextPage {
CFX_WideString GetPageText(int start = 0, int nCount = -1) const;
int CountRects(int start, int nCount);
void GetRect(int rectIndex,
- FX_FLOAT& left,
- FX_FLOAT& top,
- FX_FLOAT& right,
- FX_FLOAT& bottom) const;
+ float& left,
+ float& top,
+ float& right,
+ float& bottom) const;
static bool IsRectIntersect(const CFX_FloatRect& rect1,
const CFX_FloatRect& rect2);
@@ -125,7 +127,7 @@ class CPDF_TextPage {
Hyphen,
};
- bool IsHyphen(FX_WCHAR curChar);
+ bool IsHyphen(wchar_t curChar);
bool IsControlChar(const PAGECHAR_INFO& charInfo);
void ProcessObject();
void ProcessFormObject(CPDF_FormObject* pFormObj,
@@ -137,7 +139,7 @@ class CPDF_TextPage {
CPDF_PageObjectList::const_iterator ObjPos);
GenerateCharacter ProcessInsertObject(const CPDF_TextObject* pObj,
const CFX_Matrix& formMatrix);
- bool GenerateCharInfo(FX_WCHAR unicode, PAGECHAR_INFO& info);
+ bool GenerateCharInfo(wchar_t unicode, PAGECHAR_INFO& info);
bool IsSameAsPreTextObject(CPDF_TextObject* pTextObj,
const CPDF_PageObjectList* pObjList,
CPDF_PageObjectList::const_iterator ObjPos);
@@ -148,12 +150,12 @@ class CPDF_TextPage {
void ProcessMarkedContent(PDFTEXT_Obj pObj);
void CheckMarkedContentObject(int32_t& start, int32_t& nCount) const;
void FindPreviousTextObject();
- void AddCharInfoByLRDirection(FX_WCHAR wChar, PAGECHAR_INFO info);
- void AddCharInfoByRLDirection(FX_WCHAR wChar, PAGECHAR_INFO info);
+ void AddCharInfoByLRDirection(wchar_t wChar, PAGECHAR_INFO info);
+ void AddCharInfoByRLDirection(wchar_t wChar, PAGECHAR_INFO info);
TextOrientation GetTextObjectWritingMode(
const CPDF_TextObject* pTextObj) const;
TextOrientation FindTextlineFlowOrientation() const;
- void AppendGeneratedCharacter(FX_WCHAR unicode, const CFX_Matrix& formMatrix);
+ void AppendGeneratedCharacter(wchar_t unicode, const CFX_Matrix& formMatrix);
void SwapTempTextBuf(int32_t iCharListStartAppend, int32_t iBufStartAppend);
bool IsRightToLeft(const CPDF_TextObject* pTextObj,
diff --git a/chromium/third_party/pdfium/core/fpdftext/cpdf_textpagefind.cpp b/chromium/third_party/pdfium/core/fpdftext/cpdf_textpagefind.cpp
index a79b5e7e8a1..7eaac35194e 100644
--- a/chromium/third_party/pdfium/core/fpdftext/cpdf_textpagefind.cpp
+++ b/chromium/third_party/pdfium/core/fpdftext/cpdf_textpagefind.cpp
@@ -17,7 +17,7 @@
namespace {
-bool IsIgnoreSpaceCharacter(FX_WCHAR curChar) {
+bool IsIgnoreSpaceCharacter(wchar_t curChar) {
if (curChar < 255 || (curChar >= 0x0600 && curChar <= 0x06FF) ||
(curChar >= 0xFE70 && curChar <= 0xFEFF) ||
(curChar >= 0xFB50 && curChar <= 0xFDFF) ||
@@ -150,7 +150,7 @@ bool CPDF_TextPageFind::FindNext() {
CFX_WideString csWord = m_csFindWhatArray[iWord];
if (csWord.IsEmpty()) {
if (iWord == nCount - 1) {
- FX_WCHAR strInsert = m_strText.GetAt(nStartPos);
+ wchar_t strInsert = m_strText.GetAt(nStartPos);
if (strInsert == TEXT_LINEFEED_CHAR || strInsert == TEXT_SPACE_CHAR ||
strInsert == TEXT_RETURN_CHAR || strInsert == 160) {
nResultPos = nStartPos + 1;
@@ -183,7 +183,7 @@ bool CPDF_TextPageFind::FindNext() {
bMatch = false;
}
for (int d = PreResEndPos; d < nResultPos; d++) {
- FX_WCHAR strInsert = m_strText.GetAt(d);
+ wchar_t strInsert = m_strText.GetAt(d);
if (strInsert != TEXT_LINEFEED_CHAR && strInsert != TEXT_SPACE_CHAR &&
strInsert != TEXT_RETURN_CHAR && strInsert != 160) {
bMatch = false;
@@ -192,7 +192,7 @@ bool CPDF_TextPageFind::FindNext() {
}
} else if (bSpaceStart) {
if (nResultPos > 0) {
- FX_WCHAR strInsert = m_strText.GetAt(nResultPos - 1);
+ wchar_t strInsert = m_strText.GetAt(nResultPos - 1);
if (strInsert != TEXT_LINEFEED_CHAR && strInsert != TEXT_SPACE_CHAR &&
strInsert != TEXT_RETURN_CHAR && strInsert != 160) {
bMatch = false;
@@ -293,7 +293,7 @@ void CPDF_TextPageFind::ExtractFindWhat(const CFX_WideString& findwhat) {
int pos = 0;
while (pos < csWord.GetLength()) {
CFX_WideString curStr = csWord.Mid(pos, 1);
- FX_WCHAR curChar = csWord.GetAt(pos);
+ wchar_t curChar = csWord.GetAt(pos);
if (IsIgnoreSpaceCharacter(curChar)) {
if (pos > 0 && curChar == 0x2019) {
pos++;
@@ -321,8 +321,8 @@ void CPDF_TextPageFind::ExtractFindWhat(const CFX_WideString& findwhat) {
bool CPDF_TextPageFind::IsMatchWholeWord(const CFX_WideString& csPageText,
int startPos,
int endPos) {
- FX_WCHAR char_left = 0;
- FX_WCHAR char_right = 0;
+ wchar_t char_left = 0;
+ wchar_t char_right = 0;
int char_count = endPos - startPos + 1;
if (char_count < 1)
return false;
@@ -362,9 +362,9 @@ bool CPDF_TextPageFind::IsMatchWholeWord(const CFX_WideString& csPageText,
}
bool CPDF_TextPageFind::ExtractSubString(CFX_WideString& rString,
- const FX_WCHAR* lpszFullString,
+ const wchar_t* lpszFullString,
int iSubString,
- FX_WCHAR chSep) {
+ wchar_t chSep) {
if (!lpszFullString)
return false;
while (iSubString--) {
@@ -377,12 +377,11 @@ bool CPDF_TextPageFind::ExtractSubString(CFX_WideString& rString,
while (*lpszFullString == chSep)
lpszFullString++;
}
- const FX_WCHAR* lpchEnd = std::wcschr(lpszFullString, chSep);
+ const wchar_t* lpchEnd = std::wcschr(lpszFullString, chSep);
int nLen = lpchEnd ? (int)(lpchEnd - lpszFullString)
: (int)FXSYS_wcslen(lpszFullString);
ASSERT(nLen >= 0);
- FXSYS_memcpy(rString.GetBuffer(nLen), lpszFullString,
- nLen * sizeof(FX_WCHAR));
+ memcpy(rString.GetBuffer(nLen), lpszFullString, nLen * sizeof(wchar_t));
rString.ReleaseBuffer();
return true;
}
diff --git a/chromium/third_party/pdfium/core/fpdftext/cpdf_textpagefind.h b/chromium/third_party/pdfium/core/fpdftext/cpdf_textpagefind.h
index c60cb576a77..dd509018bd0 100644
--- a/chromium/third_party/pdfium/core/fpdftext/cpdf_textpagefind.h
+++ b/chromium/third_party/pdfium/core/fpdftext/cpdf_textpagefind.h
@@ -32,9 +32,9 @@ class CPDF_TextPageFind {
int startPos,
int endPos);
bool ExtractSubString(CFX_WideString& rString,
- const FX_WCHAR* lpszFullString,
+ const wchar_t* lpszFullString,
int iSubString,
- FX_WCHAR chSep);
+ wchar_t chSep);
CFX_WideString MakeReverse(const CFX_WideString& str);
int GetCharIndex(int index) const;
diff --git a/chromium/third_party/pdfium/core/fxcodec/DEPS b/chromium/third_party/pdfium/core/fxcodec/DEPS
index a88b3294a9d..f82f477616f 100644
--- a/chromium/third_party/pdfium/core/fxcodec/DEPS
+++ b/chromium/third_party/pdfium/core/fxcodec/DEPS
@@ -4,5 +4,5 @@ include_rules = [
# For non-standalone builds that may use libjpeg_turbo.
'+third_party/libjpeg_turbo/jpeglib.h',
'+third_party/libopenjpeg20',
- '+third_party/zlib_v128',
+ '+third_party/zlib',
]
diff --git a/chromium/third_party/pdfium/core/fxcodec/codec/ccodec_bmpmodule.cpp b/chromium/third_party/pdfium/core/fxcodec/codec/ccodec_bmpmodule.cpp
index 9d64199501a..003f5d3d492 100644
--- a/chromium/third_party/pdfium/core/fxcodec/codec/ccodec_bmpmodule.cpp
+++ b/chromium/third_party/pdfium/core/fxcodec/codec/ccodec_bmpmodule.cpp
@@ -27,8 +27,8 @@ static void bmp_free_func(void* p) {
}
};
static void bmp_error_data(bmp_decompress_struct_p bmp_ptr,
- const FX_CHAR* err_msg) {
- FXSYS_strncpy((char*)bmp_ptr->err_ptr, err_msg, BMP_MAX_ERROR_SIZE - 1);
+ const char* err_msg) {
+ strncpy((char*)bmp_ptr->err_ptr, err_msg, BMP_MAX_ERROR_SIZE - 1);
longjmp(bmp_ptr->jmpbuf, 1);
}
static void bmp_read_scanline(bmp_decompress_struct_p bmp_ptr,
@@ -56,20 +56,20 @@ FXBMP_Context* CCodec_BmpModule::Start() {
if (!p)
return nullptr;
- FXSYS_memset(p, 0, sizeof(FXBMP_Context));
+ memset(p, 0, sizeof(FXBMP_Context));
if (!p)
return nullptr;
p->m_AllocFunc = bmp_alloc_func;
p->m_FreeFunc = bmp_free_func;
p->bmp_ptr = nullptr;
- p->parent_ptr = (void*)this;
+ p->parent_ptr = this;
p->bmp_ptr = bmp_create_decompress();
if (!p->bmp_ptr) {
FX_Free(p);
return nullptr;
}
- p->bmp_ptr->context_ptr = (void*)p;
+ p->bmp_ptr->context_ptr = p;
p->bmp_ptr->err_ptr = m_szLastError;
p->bmp_ptr->bmp_error_fn = bmp_error_data;
p->bmp_ptr->bmp_get_row_fn = bmp_read_scanline;
diff --git a/chromium/third_party/pdfium/core/fxcodec/codec/ccodec_bmpmodule.h b/chromium/third_party/pdfium/core/fxcodec/codec/ccodec_bmpmodule.h
index 11d5931cac3..d07d9850c6a 100644
--- a/chromium/third_party/pdfium/core/fxcodec/codec/ccodec_bmpmodule.h
+++ b/chromium/third_party/pdfium/core/fxcodec/codec/ccodec_bmpmodule.h
@@ -33,7 +33,7 @@ class CCodec_BmpModule : public ICodec_BmpModule {
int32_t LoadImage(FXBMP_Context* pContext) override;
protected:
- FX_CHAR m_szLastError[256];
+ char m_szLastError[256];
};
#endif // CORE_FXCODEC_CODEC_CCODEC_BMPMODULE_H_
diff --git a/chromium/third_party/pdfium/core/fxcodec/codec/ccodec_gifmodule.cpp b/chromium/third_party/pdfium/core/fxcodec/codec/ccodec_gifmodule.cpp
index a85bc5eddc3..ca9fd07ba66 100644
--- a/chromium/third_party/pdfium/core/fxcodec/codec/ccodec_gifmodule.cpp
+++ b/chromium/third_party/pdfium/core/fxcodec/codec/ccodec_gifmodule.cpp
@@ -29,8 +29,8 @@ static void gif_free_func(void* p) {
};
static void gif_error_data(gif_decompress_struct_p gif_ptr,
- const FX_CHAR* err_msg) {
- FXSYS_strncpy((char*)gif_ptr->err_ptr, err_msg, GIF_MAX_ERROR_SIZE - 1);
+ const char* err_msg) {
+ strncpy((char*)gif_ptr->err_ptr, err_msg, GIF_MAX_ERROR_SIZE - 1);
longjmp(gif_ptr->jmpbuf, 1);
}
@@ -88,17 +88,17 @@ FXGIF_Context* CCodec_GifModule::Start() {
if (!p)
return nullptr;
- FXSYS_memset(p, 0, sizeof(FXGIF_Context));
+ memset(p, 0, sizeof(FXGIF_Context));
p->m_AllocFunc = gif_alloc_func;
p->m_FreeFunc = gif_free_func;
p->gif_ptr = nullptr;
- p->parent_ptr = (void*)this;
+ p->parent_ptr = this;
p->gif_ptr = gif_create_decompress();
if (!p->gif_ptr) {
FX_Free(p);
return nullptr;
}
- p->gif_ptr->context_ptr = (void*)p;
+ p->gif_ptr->context_ptr = p;
p->gif_ptr->err_ptr = m_szLastError;
p->gif_ptr->gif_error_fn = gif_error_data;
p->gif_ptr->gif_ask_buf_for_pal_fn = gif_ask_buf_for_pal;
@@ -177,7 +177,7 @@ int32_t CCodec_GifModule::LoadFrame(FXGIF_Context* ctx,
buf += size;
size = *buf++;
if (size == 20) {
- FXSYS_memcpy(pAttribute->m_strTime, buf, size);
+ memcpy(pAttribute->m_strTime, buf, size);
}
}
}
diff --git a/chromium/third_party/pdfium/core/fxcodec/codec/ccodec_gifmodule.h b/chromium/third_party/pdfium/core/fxcodec/codec/ccodec_gifmodule.h
index 7721d7a767a..6830064d434 100644
--- a/chromium/third_party/pdfium/core/fxcodec/codec/ccodec_gifmodule.h
+++ b/chromium/third_party/pdfium/core/fxcodec/codec/ccodec_gifmodule.h
@@ -39,7 +39,7 @@ class CCodec_GifModule : public ICodec_GifModule {
CFX_DIBAttribute* pAttribute) override;
protected:
- FX_CHAR m_szLastError[256];
+ char m_szLastError[256];
};
#endif // CORE_FXCODEC_CODEC_CCODEC_GIFMODULE_H_
diff --git a/chromium/third_party/pdfium/core/fxcodec/codec/ccodec_iccmodule.h b/chromium/third_party/pdfium/core/fxcodec/codec/ccodec_iccmodule.h
index 1f856faa041..08878acc988 100644
--- a/chromium/third_party/pdfium/core/fxcodec/codec/ccodec_iccmodule.h
+++ b/chromium/third_party/pdfium/core/fxcodec/codec/ccodec_iccmodule.h
@@ -22,7 +22,7 @@ class CCodec_IccModule {
int32_t intent = 0,
uint32_t dwSrcFormat = Icc_FORMAT_DEFAULT);
void DestroyTransform(void* pTransform);
- void Translate(void* pTransform, FX_FLOAT* pSrcValues, FX_FLOAT* pDestValues);
+ void Translate(void* pTransform, const float* pSrcValues, float* pDestValues);
void TranslateScanline(void* pTransform,
uint8_t* pDest,
const uint8_t* pSrc,
diff --git a/chromium/third_party/pdfium/core/fxcodec/codec/ccodec_jbig2module.h b/chromium/third_party/pdfium/core/fxcodec/codec/ccodec_jbig2module.h
index c74ed5fb026..43abe042f02 100644
--- a/chromium/third_party/pdfium/core/fxcodec/codec/ccodec_jbig2module.h
+++ b/chromium/third_party/pdfium/core/fxcodec/codec/ccodec_jbig2module.h
@@ -25,8 +25,8 @@ class CCodec_Jbig2Context {
uint32_t m_width;
uint32_t m_height;
- CPDF_StreamAcc* m_pGlobalStream;
- CPDF_StreamAcc* m_pSrcStream;
+ CFX_RetainPtr<CPDF_StreamAcc> m_pGlobalStream;
+ CFX_RetainPtr<CPDF_StreamAcc> m_pSrcStream;
uint8_t* m_dest_buf;
uint32_t m_dest_pitch;
IFX_Pause* m_pPause;
@@ -43,13 +43,16 @@ class CCodec_Jbig2Module {
std::unique_ptr<JBig2_DocumentContext>* pContextHolder,
uint32_t width,
uint32_t height,
- CPDF_StreamAcc* src_stream,
- CPDF_StreamAcc* global_stream,
+ const CFX_RetainPtr<CPDF_StreamAcc>& src_stream,
+ const CFX_RetainPtr<CPDF_StreamAcc>& global_stream,
uint8_t* dest_buf,
uint32_t dest_pitch,
IFX_Pause* pPause);
FXCODEC_STATUS ContinueDecode(CCodec_Jbig2Context* pJbig2Context,
IFX_Pause* pPause);
+
+ private:
+ FXCODEC_STATUS Decode(CCodec_Jbig2Context* pJbig2Context, int result);
};
#endif // CORE_FXCODEC_CODEC_CCODEC_JBIG2MODULE_H_
diff --git a/chromium/third_party/pdfium/core/fxcodec/codec/ccodec_jpegmodule.h b/chromium/third_party/pdfium/core/fxcodec/codec/ccodec_jpegmodule.h
index bad6fa6a943..7782b5fad13 100644
--- a/chromium/third_party/pdfium/core/fxcodec/codec/ccodec_jpegmodule.h
+++ b/chromium/third_party/pdfium/core/fxcodec/codec/ccodec_jpegmodule.h
@@ -60,7 +60,7 @@ class CCodec_JpegModule {
uint32_t GetAvailInput(FXJPEG_Context* pContext, uint8_t** avail_buf_ptr);
#if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_DESKTOP_
- static bool JpegEncode(const CFX_DIBSource* pSource,
+ static bool JpegEncode(const CFX_RetainPtr<CFX_DIBSource>& pSource,
uint8_t** dest_buf,
FX_STRSIZE* dest_size);
#endif
diff --git a/chromium/third_party/pdfium/core/fxcodec/codec/ccodec_jpxmodule.h b/chromium/third_party/pdfium/core/fxcodec/codec/ccodec_jpxmodule.h
index fd919d91b08..c57002722ee 100644
--- a/chromium/third_party/pdfium/core/fxcodec/codec/ccodec_jpxmodule.h
+++ b/chromium/third_party/pdfium/core/fxcodec/codec/ccodec_jpxmodule.h
@@ -7,6 +7,7 @@
#ifndef CORE_FXCODEC_CODEC_CCODEC_JPXMODULE_H_
#define CORE_FXCODEC_CODEC_CCODEC_JPXMODULE_H_
+#include <memory>
#include <vector>
#include "core/fxcrt/fx_system.h"
@@ -19,9 +20,9 @@ class CCodec_JpxModule {
CCodec_JpxModule();
~CCodec_JpxModule();
- CJPX_Decoder* CreateDecoder(const uint8_t* src_buf,
- uint32_t src_size,
- CPDF_ColorSpace* cs);
+ std::unique_ptr<CJPX_Decoder> CreateDecoder(const uint8_t* src_buf,
+ uint32_t src_size,
+ CPDF_ColorSpace* cs);
void GetImageInfo(CJPX_Decoder* pDecoder,
uint32_t* width,
uint32_t* height,
@@ -30,7 +31,6 @@ class CCodec_JpxModule {
uint8_t* dest_data,
int pitch,
const std::vector<uint8_t>& offsets);
- void DestroyDecoder(CJPX_Decoder* pDecoder);
};
#endif // CORE_FXCODEC_CODEC_CCODEC_JPXMODULE_H_
diff --git a/chromium/third_party/pdfium/core/fxcodec/codec/ccodec_pngmodule.cpp b/chromium/third_party/pdfium/core/fxcodec/codec/ccodec_pngmodule.cpp
index 028513b7294..09bc1ac7e76 100644
--- a/chromium/third_party/pdfium/core/fxcodec/codec/ccodec_pngmodule.cpp
+++ b/chromium/third_party/pdfium/core/fxcodec/codec/ccodec_pngmodule.cpp
@@ -19,8 +19,7 @@ extern "C" {
static void _png_error_data(png_structp png_ptr, png_const_charp error_msg) {
if (png_get_error_ptr(png_ptr)) {
- FXSYS_strncpy((char*)png_get_error_ptr(png_ptr), error_msg,
- PNG_ERROR_SIZE - 1);
+ strncpy((char*)png_get_error_ptr(png_ptr), error_msg, PNG_ERROR_SIZE - 1);
}
longjmp(png_jmpbuf(png_ptr), 1);
}
@@ -56,8 +55,8 @@ static void _png_load_bmp_attribute(png_structp png_ptr,
png_timep t = nullptr;
png_get_tIME(png_ptr, info_ptr, &t);
if (t) {
- FXSYS_memset(pAttribute->m_strTime, 0, sizeof(pAttribute->m_strTime));
- FXSYS_snprintf((FX_CHAR*)pAttribute->m_strTime,
+ memset(pAttribute->m_strTime, 0, sizeof(pAttribute->m_strTime));
+ FXSYS_snprintf((char*)pAttribute->m_strTime,
sizeof(pAttribute->m_strTime), "%4u:%2u:%2u %2u:%2u:%2u",
t->year, t->month, t->day, t->hour, t->minute, t->second);
pAttribute->m_strTime[sizeof(pAttribute->m_strTime) - 1] = 0;
@@ -67,23 +66,23 @@ static void _png_load_bmp_attribute(png_structp png_ptr,
#if defined(PNG_TEXT_SUPPORTED)
int i;
FX_STRSIZE len;
- const FX_CHAR* buf;
+ const char* buf;
int num_text;
png_textp text = nullptr;
png_get_text(png_ptr, info_ptr, &text, &num_text);
for (i = 0; i < num_text; i++) {
len = FXSYS_strlen(text[i].key);
buf = "Time";
- if (!FXSYS_memcmp(buf, text[i].key, std::min(len, FXSYS_strlen(buf)))) {
+ if (!memcmp(buf, text[i].key, std::min(len, FXSYS_strlen(buf)))) {
if (!bTime) {
- FXSYS_memset(pAttribute->m_strTime, 0, sizeof(pAttribute->m_strTime));
- FXSYS_memcpy(
+ memset(pAttribute->m_strTime, 0, sizeof(pAttribute->m_strTime));
+ memcpy(
pAttribute->m_strTime, text[i].text,
std::min(sizeof(pAttribute->m_strTime) - 1, text[i].text_length));
}
} else {
buf = "Author";
- if (!FXSYS_memcmp(buf, text[i].key, std::min(len, FXSYS_strlen(buf)))) {
+ if (!memcmp(buf, text[i].key, std::min(len, FXSYS_strlen(buf)))) {
pAttribute->m_strAuthor =
CFX_ByteString(reinterpret_cast<uint8_t*>(text[i].text),
static_cast<FX_STRSIZE>(text[i].text_length));
@@ -212,7 +211,7 @@ FXPNG_Context* CCodec_PngModule::Start() {
p->m_FreeFunc = _png_free_func;
p->png_ptr = nullptr;
p->info_ptr = nullptr;
- p->parent_ptr = (void*)this;
+ p->parent_ptr = this;
p->png_ptr =
png_create_read_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr);
if (!p->png_ptr) {
@@ -252,7 +251,7 @@ bool CCodec_PngModule::Input(FXPNG_Context* ctx,
CFX_DIBAttribute* pAttribute) {
if (setjmp(png_jmpbuf(ctx->png_ptr))) {
if (pAttribute &&
- 0 == FXSYS_strcmp(m_szLastError, "Read Header Callback Error")) {
+ 0 == strcmp(m_szLastError, "Read Header Callback Error")) {
_png_load_bmp_attribute(ctx->png_ptr, ctx->info_ptr, pAttribute);
}
return false;
diff --git a/chromium/third_party/pdfium/core/fxcodec/codec/ccodec_pngmodule.h b/chromium/third_party/pdfium/core/fxcodec/codec/ccodec_pngmodule.h
index 1f3a3d96cc9..0ca33f03c61 100644
--- a/chromium/third_party/pdfium/core/fxcodec/codec/ccodec_pngmodule.h
+++ b/chromium/third_party/pdfium/core/fxcodec/codec/ccodec_pngmodule.h
@@ -25,7 +25,7 @@ class CCodec_PngModule : public ICodec_PngModule {
CFX_DIBAttribute* pAttribute) override;
protected:
- FX_CHAR m_szLastError[PNG_ERROR_SIZE];
+ char m_szLastError[PNG_ERROR_SIZE];
};
#endif // CORE_FXCODEC_CODEC_CCODEC_PNGMODULE_H_
diff --git a/chromium/third_party/pdfium/core/fxcodec/codec/ccodec_progressivedecoder.h b/chromium/third_party/pdfium/core/fxcodec/codec/ccodec_progressivedecoder.h
index 61703dde29f..cd96ee76a0e 100644
--- a/chromium/third_party/pdfium/core/fxcodec/codec/ccodec_progressivedecoder.h
+++ b/chromium/third_party/pdfium/core/fxcodec/codec/ccodec_progressivedecoder.h
@@ -58,7 +58,7 @@ class CCodec_ProgressiveDecoder : public ICodec_BmpModule::Delegate,
void SetClipBox(FX_RECT* clip);
FXCODEC_STATUS GetFrames(int32_t& frames, IFX_Pause* pPause = nullptr);
- FXCODEC_STATUS StartDecode(CFX_DIBitmap* pDIBitmap,
+ FXCODEC_STATUS StartDecode(const CFX_RetainPtr<CFX_DIBitmap>& pDIBitmap,
int start_x,
int start_y,
int size_x,
@@ -138,7 +138,7 @@ class CCodec_ProgressiveDecoder : public ICodec_BmpModule::Delegate,
uint32_t m_SrcSize;
uint8_t* m_pDecodeBuf;
int m_ScanlineSize;
- CFX_DIBitmap* m_pDeviceBitmap;
+ CFX_RetainPtr<CFX_DIBitmap> m_pDeviceBitmap;
bool m_bInterpol;
CFXCODEC_WeightTable m_WeightHorz;
CFXCODEC_VertTable m_WeightVert;
@@ -201,29 +201,35 @@ class CCodec_ProgressiveDecoder : public ICodec_BmpModule::Delegate,
FXCODEC_STATUS& err_status);
bool GifReadMoreData(ICodec_GifModule* pGifModule,
FXCODEC_STATUS& err_status);
- void GifDoubleLineResampleVert(CFX_DIBitmap* pDeviceBitmap,
- double scale_y,
- int des_row);
- void PngOneOneMapResampleHorz(CFX_DIBitmap* pDeviceBitmap,
- int32_t des_line,
- uint8_t* src_scan,
- FXCodec_Format src_format);
+ void GifDoubleLineResampleVert(
+ const CFX_RetainPtr<CFX_DIBitmap>& pDeviceBitmap,
+ double scale_y,
+ int des_row);
+ void PngOneOneMapResampleHorz(
+ const CFX_RetainPtr<CFX_DIBitmap>& pDeviceBitmap,
+ int32_t des_line,
+ uint8_t* src_scan,
+ FXCodec_Format src_format);
bool DetectImageType(FXCODEC_IMAGE_TYPE imageType,
CFX_DIBAttribute* pAttribute);
void GetDownScale(int& down_scale);
void GetTransMethod(FXDIB_Format des_format, FXCodec_Format src_format);
- void ReSampleScanline(CFX_DIBitmap* pDeviceBitmap,
+ void ReSampleScanline(const CFX_RetainPtr<CFX_DIBitmap>& pDeviceBitmap,
int32_t des_line,
uint8_t* src_scan,
FXCodec_Format src_format);
- void Resample(CFX_DIBitmap* pDeviceBitmap,
+ void Resample(const CFX_RetainPtr<CFX_DIBitmap>& pDeviceBitmap,
int32_t src_line,
uint8_t* src_scan,
FXCodec_Format src_format);
- void ResampleVert(CFX_DIBitmap* pDeviceBitmap, double scale_y, int des_row);
+ void ResampleVert(const CFX_RetainPtr<CFX_DIBitmap>& pDeviceBitmap,
+ double scale_y,
+ int des_row);
bool JpegReadMoreData(CCodec_JpegModule* pJpegModule,
FXCODEC_STATUS& err_status);
- void ResampleVertBT(CFX_DIBitmap* pDeviceBitmap, double scale_y, int des_row);
+ void ResampleVertBT(const CFX_RetainPtr<CFX_DIBitmap>& pDeviceBitmap,
+ double scale_y,
+ int des_row);
};
#endif // CORE_FXCODEC_CODEC_CCODEC_PROGRESSIVEDECODER_H_
diff --git a/chromium/third_party/pdfium/core/fxcodec/codec/ccodec_tiffmodule.cpp b/chromium/third_party/pdfium/core/fxcodec/codec/ccodec_tiffmodule.cpp
index 736772892ad..295f0abe348 100644
--- a/chromium/third_party/pdfium/core/fxcodec/codec/ccodec_tiffmodule.cpp
+++ b/chromium/third_party/pdfium/core/fxcodec/codec/ccodec_tiffmodule.cpp
@@ -12,6 +12,7 @@
#include "core/fxcodec/fx_codec.h"
#include "core/fxcrt/cfx_retain_ptr.h"
#include "core/fxcrt/fx_safe_types.h"
+#include "core/fxge/dib/cfx_dibitmap.h"
#include "core/fxge/fx_dib.h"
#include "third_party/base/ptr_util.h"
@@ -31,26 +32,26 @@ class CCodec_TiffContext {
int32_t* comps,
int32_t* bpc,
CFX_DIBAttribute* pAttribute);
- bool Decode(CFX_DIBitmap* pDIBitmap);
+ bool Decode(const CFX_RetainPtr<CFX_DIBitmap>& pDIBitmap);
CFX_RetainPtr<IFX_SeekableReadStream> io_in() const { return m_io_in; }
uint32_t offset() const { return m_offset; }
void set_offset(uint32_t offset) { m_offset = offset; }
private:
- bool IsSupport(const CFX_DIBitmap* pDIBitmap) const;
- void SetPalette(CFX_DIBitmap* pDIBitmap, uint16_t bps);
- bool Decode1bppRGB(CFX_DIBitmap* pDIBitmap,
+ bool IsSupport(const CFX_RetainPtr<CFX_DIBitmap>& pDIBitmap) const;
+ void SetPalette(const CFX_RetainPtr<CFX_DIBitmap>& pDIBitmap, uint16_t bps);
+ bool Decode1bppRGB(const CFX_RetainPtr<CFX_DIBitmap>& pDIBitmap,
int32_t height,
int32_t width,
uint16_t bps,
uint16_t spp);
- bool Decode8bppRGB(CFX_DIBitmap* pDIBitmap,
+ bool Decode8bppRGB(const CFX_RetainPtr<CFX_DIBitmap>& pDIBitmap,
int32_t height,
int32_t width,
uint16_t bps,
uint16_t spp);
- bool Decode24bppRGB(CFX_DIBitmap* pDIBitmap,
+ bool Decode24bppRGB(const CFX_RetainPtr<CFX_DIBitmap>& pDIBitmap,
int32_t height,
int32_t width,
uint16_t bps,
@@ -74,15 +75,15 @@ void* _TIFFrealloc(void* ptr, tmsize_t size) {
}
void _TIFFmemset(void* ptr, int val, tmsize_t size) {
- FXSYS_memset(ptr, val, (size_t)size);
+ memset(ptr, val, (size_t)size);
}
void _TIFFmemcpy(void* des, const void* src, tmsize_t size) {
- FXSYS_memcpy(des, src, (size_t)size);
+ memcpy(des, src, (size_t)size);
}
int _TIFFmemcmp(const void* ptr1, const void* ptr2, tmsize_t size) {
- return FXSYS_memcmp(ptr1, ptr2, (size_t)size);
+ return memcmp(ptr1, ptr2, (size_t)size);
}
int _TIFFIfMultiplicationOverflow(tmsize_t op1, tmsize_t op2) {
@@ -186,20 +187,20 @@ bool Tiff_Exif_GetInfo(TIFF* tif_ctx, ttag_t tag, CFX_DIBAttribute* pAttr) {
return false;
T* ptr = FX_Alloc(T, 1);
*ptr = val;
- pAttr->m_Exif[tag] = (void*)ptr;
+ pAttr->m_Exif[tag] = ptr;
return true;
}
void Tiff_Exif_GetStringInfo(TIFF* tif_ctx,
ttag_t tag,
CFX_DIBAttribute* pAttr) {
- FX_CHAR* buf = nullptr;
+ char* buf = nullptr;
TIFFGetField(tif_ctx, tag, &buf);
if (!buf)
return;
FX_STRSIZE size = FXSYS_strlen(buf);
uint8_t* ptr = FX_Alloc(uint8_t, size + 1);
- FXSYS_memcpy(ptr, buf, size);
+ memcpy(ptr, buf, size);
ptr[size] = 0;
pAttr->m_Exif[tag] = ptr;
}
@@ -257,16 +258,14 @@ bool CCodec_TiffContext::LoadFrameInfo(int32_t frame,
pAttribute->m_wDPIUnit--;
}
Tiff_Exif_GetInfo<uint16_t>(m_tif_ctx, TIFFTAG_ORIENTATION, pAttribute);
- if (Tiff_Exif_GetInfo<FX_FLOAT>(m_tif_ctx, TIFFTAG_XRESOLUTION,
- pAttribute)) {
+ if (Tiff_Exif_GetInfo<float>(m_tif_ctx, TIFFTAG_XRESOLUTION, pAttribute)) {
void* val = pAttribute->m_Exif[TIFFTAG_XRESOLUTION];
- FX_FLOAT fDpi = val ? *reinterpret_cast<FX_FLOAT*>(val) : 0;
+ float fDpi = val ? *reinterpret_cast<float*>(val) : 0;
pAttribute->m_nXDPI = (int32_t)(fDpi + 0.5f);
}
- if (Tiff_Exif_GetInfo<FX_FLOAT>(m_tif_ctx, TIFFTAG_YRESOLUTION,
- pAttribute)) {
+ if (Tiff_Exif_GetInfo<float>(m_tif_ctx, TIFFTAG_YRESOLUTION, pAttribute)) {
void* val = pAttribute->m_Exif[TIFFTAG_YRESOLUTION];
- FX_FLOAT fDpi = val ? *reinterpret_cast<FX_FLOAT*>(val) : 0;
+ float fDpi = val ? *reinterpret_cast<float*>(val) : 0;
pAttribute->m_nYDPI = (int32_t)(fDpi + 0.5f);
}
Tiff_Exif_GetStringInfo(m_tif_ctx, TIFFTAG_IMAGEDESCRIPTION, pAttribute);
@@ -289,7 +288,8 @@ bool CCodec_TiffContext::LoadFrameInfo(int32_t frame,
return true;
}
-bool CCodec_TiffContext::IsSupport(const CFX_DIBitmap* pDIBitmap) const {
+bool CCodec_TiffContext::IsSupport(
+ const CFX_RetainPtr<CFX_DIBitmap>& pDIBitmap) const {
if (TIFFIsTiled(m_tif_ctx))
return false;
@@ -319,7 +319,9 @@ bool CCodec_TiffContext::IsSupport(const CFX_DIBitmap* pDIBitmap) const {
return planarconfig != PLANARCONFIG_SEPARATE;
}
-void CCodec_TiffContext::SetPalette(CFX_DIBitmap* pDIBitmap, uint16_t bps) {
+void CCodec_TiffContext::SetPalette(
+ const CFX_RetainPtr<CFX_DIBitmap>& pDIBitmap,
+ uint16_t bps) {
uint16_t* red_orig = nullptr;
uint16_t* green_orig = nullptr;
uint16_t* blue_orig = nullptr;
@@ -342,11 +344,12 @@ void CCodec_TiffContext::SetPalette(CFX_DIBitmap* pDIBitmap, uint16_t bps) {
}
}
-bool CCodec_TiffContext::Decode1bppRGB(CFX_DIBitmap* pDIBitmap,
- int32_t height,
- int32_t width,
- uint16_t bps,
- uint16_t spp) {
+bool CCodec_TiffContext::Decode1bppRGB(
+ const CFX_RetainPtr<CFX_DIBitmap>& pDIBitmap,
+ int32_t height,
+ int32_t width,
+ uint16_t bps,
+ uint16_t spp) {
if (pDIBitmap->GetBPP() != 1 || spp != 1 || bps != 1 ||
!IsSupport(pDIBitmap)) {
return false;
@@ -370,11 +373,12 @@ bool CCodec_TiffContext::Decode1bppRGB(CFX_DIBitmap* pDIBitmap,
return true;
}
-bool CCodec_TiffContext::Decode8bppRGB(CFX_DIBitmap* pDIBitmap,
- int32_t height,
- int32_t width,
- uint16_t bps,
- uint16_t spp) {
+bool CCodec_TiffContext::Decode8bppRGB(
+ const CFX_RetainPtr<CFX_DIBitmap>& pDIBitmap,
+ int32_t height,
+ int32_t width,
+ uint16_t bps,
+ uint16_t spp) {
if (pDIBitmap->GetBPP() != 8 || spp != 1 || (bps != 4 && bps != 8) ||
!IsSupport(pDIBitmap)) {
return false;
@@ -406,11 +410,12 @@ bool CCodec_TiffContext::Decode8bppRGB(CFX_DIBitmap* pDIBitmap,
return true;
}
-bool CCodec_TiffContext::Decode24bppRGB(CFX_DIBitmap* pDIBitmap,
- int32_t height,
- int32_t width,
- uint16_t bps,
- uint16_t spp) {
+bool CCodec_TiffContext::Decode24bppRGB(
+ const CFX_RetainPtr<CFX_DIBitmap>& pDIBitmap,
+ int32_t height,
+ int32_t width,
+ uint16_t bps,
+ uint16_t spp) {
if (pDIBitmap->GetBPP() != 24 || !IsSupport(pDIBitmap))
return false;
@@ -434,7 +439,7 @@ bool CCodec_TiffContext::Decode24bppRGB(CFX_DIBitmap* pDIBitmap,
return true;
}
-bool CCodec_TiffContext::Decode(CFX_DIBitmap* pDIBitmap) {
+bool CCodec_TiffContext::Decode(const CFX_RetainPtr<CFX_DIBitmap>& pDIBitmap) {
uint32_t img_wid = pDIBitmap->GetWidth();
uint32_t img_hei = pDIBitmap->GetHeight();
uint32_t width = 0;
@@ -495,7 +500,7 @@ bool CCodec_TiffModule::LoadFrameInfo(CCodec_TiffContext* ctx,
}
bool CCodec_TiffModule::Decode(CCodec_TiffContext* ctx,
- class CFX_DIBitmap* pDIBitmap) {
+ const CFX_RetainPtr<CFX_DIBitmap>& pDIBitmap) {
return ctx->Decode(pDIBitmap);
}
diff --git a/chromium/third_party/pdfium/core/fxcodec/codec/ccodec_tiffmodule.h b/chromium/third_party/pdfium/core/fxcodec/codec/ccodec_tiffmodule.h
index a8820f4aacc..8878ad504eb 100644
--- a/chromium/third_party/pdfium/core/fxcodec/codec/ccodec_tiffmodule.h
+++ b/chromium/third_party/pdfium/core/fxcodec/codec/ccodec_tiffmodule.h
@@ -24,7 +24,8 @@ class CCodec_TiffModule : public ICodec_TiffModule {
int32_t* comps,
int32_t* bpc,
CFX_DIBAttribute* pAttribute) override;
- bool Decode(CCodec_TiffContext* ctx, class CFX_DIBitmap* pDIBitmap) override;
+ bool Decode(CCodec_TiffContext* ctx,
+ const CFX_RetainPtr<CFX_DIBitmap>& pDIBitmap) override;
void DestroyDecoder(CCodec_TiffContext* ctx) override;
};
diff --git a/chromium/third_party/pdfium/core/fxcodec/codec/cjpx_decoder.h b/chromium/third_party/pdfium/core/fxcodec/codec/cjpx_decoder.h
new file mode 100644
index 00000000000..2e63caac73c
--- /dev/null
+++ b/chromium/third_party/pdfium/core/fxcodec/codec/cjpx_decoder.h
@@ -0,0 +1,36 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef CORE_FXCODEC_CODEC_CJPX_DECODER_H_
+#define CORE_FXCODEC_CODEC_CJPX_DECODER_H_
+
+#include <vector>
+
+#include "third_party/libopenjpeg20/openjpeg.h"
+
+class CPDF_ColorSpace;
+
+class CJPX_Decoder {
+ public:
+ explicit CJPX_Decoder(CPDF_ColorSpace* cs);
+ ~CJPX_Decoder();
+
+ bool Init(const unsigned char* src_data, uint32_t src_size);
+ void GetInfo(uint32_t* width, uint32_t* height, uint32_t* components);
+ bool Decode(uint8_t* dest_buf,
+ int pitch,
+ const std::vector<uint8_t>& offsets);
+
+ private:
+ const uint8_t* m_SrcData;
+ uint32_t m_SrcSize;
+ opj_image_t* image;
+ opj_codec_t* l_codec;
+ opj_stream_t* l_stream;
+ const CPDF_ColorSpace* const m_ColorSpace;
+};
+
+#endif // CORE_FXCODEC_CODEC_CJPX_DECODER_H_
diff --git a/chromium/third_party/pdfium/core/fxcodec/codec/codec_int.h b/chromium/third_party/pdfium/core/fxcodec/codec/codec_int.h
index edd5a67a25f..4c451c733d1 100644
--- a/chromium/third_party/pdfium/core/fxcodec/codec/codec_int.h
+++ b/chromium/third_party/pdfium/core/fxcodec/codec/codec_int.h
@@ -21,10 +21,10 @@
class CPDF_ColorSpace;
struct DecodeData {
- public:
- DecodeData(uint8_t* data, OPJ_SIZE_T size)
+ DecodeData(const uint8_t* data, OPJ_SIZE_T size)
: src_data(data), src_size(size), offset(0) {}
- uint8_t* src_data;
+
+ const uint8_t* src_data;
OPJ_SIZE_T src_size;
OPJ_SIZE_T offset;
};
@@ -35,9 +35,6 @@ void sycc420_to_rgb(opj_image_t* img);
OPJ_SIZE_T opj_read_from_memory(void* p_buffer,
OPJ_SIZE_T nb_bytes,
void* p_user_data);
-OPJ_SIZE_T opj_write_from_memory(void* p_buffer,
- OPJ_SIZE_T nb_bytes,
- void* p_user_data);
OPJ_OFF_T opj_skip_from_memory(OPJ_OFF_T nb_bytes, void* p_user_data);
OPJ_BOOL opj_seek_from_memory(OPJ_OFF_T nb_bytes, void* p_user_data);
diff --git a/chromium/third_party/pdfium/core/fxcodec/codec/fx_codec.cpp b/chromium/third_party/pdfium/core/fxcodec/codec/fx_codec.cpp
index 0d886b43cb1..900fed2d87b 100644
--- a/chromium/third_party/pdfium/core/fxcodec/codec/fx_codec.cpp
+++ b/chromium/third_party/pdfium/core/fxcodec/codec/fx_codec.cpp
@@ -254,7 +254,7 @@ CFX_DIBAttribute::CFX_DIBAttribute()
m_pGifLocalPalette(nullptr),
m_nGifLocalPalNum(0),
m_nBmpCompressType(0) {
- FXSYS_memset(m_strTime, 0, sizeof(m_strTime));
+ memset(m_strTime, 0, sizeof(m_strTime));
}
CFX_DIBAttribute::~CFX_DIBAttribute() {
for (const auto& pair : m_Exif)
@@ -361,7 +361,7 @@ bool CCodec_RLScanlineDecoder::Create(const uint8_t* src_buf,
return CheckDestSize();
}
bool CCodec_RLScanlineDecoder::v_Rewind() {
- FXSYS_memset(m_pScanline, 0, m_Pitch);
+ memset(m_pScanline, 0, m_Pitch);
m_SrcOffset = 0;
m_bEOD = false;
m_Operator = 0;
@@ -375,7 +375,7 @@ uint8_t* CCodec_RLScanlineDecoder::v_GetNextLine() {
return nullptr;
}
}
- FXSYS_memset(m_pScanline, 0, m_Pitch);
+ memset(m_pScanline, 0, m_Pitch);
uint32_t col_pos = 0;
bool eol = false;
while (m_SrcOffset < m_SrcSize && !eol) {
@@ -389,7 +389,7 @@ uint8_t* CCodec_RLScanlineDecoder::v_GetNextLine() {
copy_len = m_SrcSize - m_SrcOffset;
m_bEOD = true;
}
- FXSYS_memcpy(m_pScanline + col_pos, m_pSrcBuf + m_SrcOffset, copy_len);
+ memcpy(m_pScanline + col_pos, m_pSrcBuf + m_SrcOffset, copy_len);
col_pos += copy_len;
UpdateOperator((uint8_t)copy_len);
} else if (m_Operator > 128) {
@@ -402,7 +402,7 @@ uint8_t* CCodec_RLScanlineDecoder::v_GetNextLine() {
duplicate_len = m_dwLineBytes - col_pos;
eol = true;
}
- FXSYS_memset(m_pScanline + col_pos, fill, duplicate_len);
+ memset(m_pScanline + col_pos, fill, duplicate_len);
col_pos += duplicate_len;
UpdateOperator((uint8_t)duplicate_len);
} else {
diff --git a/chromium/third_party/pdfium/core/fxcodec/codec/fx_codec_fax.cpp b/chromium/third_party/pdfium/core/fxcodec/codec/fx_codec_fax.cpp
index 8a9c3efbc76..641e0fd9d17 100644
--- a/chromium/third_party/pdfium/core/fxcodec/codec/fx_codec_fax.cpp
+++ b/chromium/third_party/pdfium/core/fxcodec/codec/fx_codec_fax.cpp
@@ -12,6 +12,7 @@
#include "core/fxcodec/fx_codec.h"
#include "core/fxcrt/fx_memory.h"
#include "third_party/base/ptr_util.h"
+#include "third_party/base/stl_util.h"
namespace {
@@ -104,7 +105,7 @@ void FaxG4FindB1B2(const std::vector<uint8_t>& ref_buf,
void FaxFillBits(uint8_t* dest_buf, int columns, int startpos, int endpos) {
startpos = std::max(startpos, 0);
- endpos = std::min(std::max(endpos, 0), columns);
+ endpos = pdfium::clamp(endpos, 0, columns);
if (startpos >= endpos)
return;
@@ -122,7 +123,7 @@ void FaxFillBits(uint8_t* dest_buf, int columns, int startpos, int endpos) {
dest_buf[last_byte] -= 1 << (7 - i);
if (last_byte > first_byte + 1)
- FXSYS_memset(dest_buf + first_byte + 1, 0, last_byte - first_byte - 1);
+ memset(dest_buf + first_byte + 1, 0, last_byte - first_byte - 1);
}
inline bool NextBit(const uint8_t* src_buf, int* bitpos) {
@@ -266,14 +267,13 @@ int FaxGetRun(const uint8_t* ins_array,
++(*bitpos);
int next_off = ins_off + ins * 3;
for (; ins_off < next_off; ins_off += 3) {
- if (ins_array[ins_off] == code) {
+ if (ins_array[ins_off] == code)
return ins_array[ins_off + 1] + ins_array[ins_off + 2] * 256;
- }
}
}
}
-bool FaxG4GetRow(const uint8_t* src_buf,
+void FaxG4GetRow(const uint8_t* src_buf,
int bitsize,
int* bitpos,
uint8_t* dest_buf,
@@ -283,7 +283,7 @@ bool FaxG4GetRow(const uint8_t* src_buf,
bool a0color = true;
while (1) {
if (*bitpos >= bitsize)
- return false;
+ return;
int a1;
int a2;
@@ -294,11 +294,11 @@ bool FaxG4GetRow(const uint8_t* src_buf,
int v_delta = 0;
if (!NextBit(src_buf, bitpos)) {
if (*bitpos >= bitsize)
- return false;
+ return;
bool bit1 = NextBit(src_buf, bitpos);
if (*bitpos >= bitsize)
- return false;
+ return;
bool bit2 = NextBit(src_buf, bitpos);
if (bit1) {
@@ -309,12 +309,13 @@ bool FaxG4GetRow(const uint8_t* src_buf,
int run = FaxGetRun(a0color ? FaxWhiteRunIns : FaxBlackRunIns,
src_buf, bitpos, bitsize);
run_len1 += run;
- if (run < 64) {
+ if (run < 64)
break;
- }
}
if (a0 < 0)
++run_len1;
+ if (run_len1 < 0)
+ return;
a1 = a0 + run_len1;
if (!a0color)
@@ -325,10 +326,11 @@ bool FaxG4GetRow(const uint8_t* src_buf,
int run = FaxGetRun(a0color ? FaxBlackRunIns : FaxWhiteRunIns,
src_buf, bitpos, bitsize);
run_len2 += run;
- if (run < 64) {
+ if (run < 64)
break;
- }
}
+ if (run_len2 < 0)
+ return;
a2 = a1 + run_len2;
if (a0color)
FaxFillBits(dest_buf, columns, a1, a2);
@@ -337,47 +339,47 @@ bool FaxG4GetRow(const uint8_t* src_buf,
if (a0 < columns)
continue;
- return true;
+ return;
} else {
if (*bitpos >= bitsize)
- return false;
+ return;
if (NextBit(src_buf, bitpos)) {
if (!a0color)
FaxFillBits(dest_buf, columns, a0, b2);
if (b2 >= columns)
- return true;
+ return;
a0 = b2;
continue;
}
if (*bitpos >= bitsize)
- return false;
+ return;
bool next_bit1 = NextBit(src_buf, bitpos);
if (*bitpos >= bitsize)
- return false;
+ return;
bool next_bit2 = NextBit(src_buf, bitpos);
if (next_bit1) {
v_delta = next_bit2 ? 2 : -2;
} else if (next_bit2) {
if (*bitpos >= bitsize)
- return false;
+ return;
v_delta = NextBit(src_buf, bitpos) ? 3 : -3;
} else {
if (*bitpos >= bitsize)
- return false;
+ return;
if (NextBit(src_buf, bitpos)) {
*bitpos += 3;
continue;
}
*bitpos += 5;
- return true;
+ return;
}
}
}
@@ -386,30 +388,29 @@ bool FaxG4GetRow(const uint8_t* src_buf,
FaxFillBits(dest_buf, columns, a0, a1);
if (a1 >= columns)
- return true;
+ return;
// The position of picture element must be monotonic increasing.
if (a0 >= a1)
- return false;
+ return;
a0 = a1;
a0color = !a0color;
}
}
-bool FaxSkipEOL(const uint8_t* src_buf, int bitsize, int* bitpos) {
+void FaxSkipEOL(const uint8_t* src_buf, int bitsize, int* bitpos) {
int startbit = *bitpos;
while (*bitpos < bitsize) {
if (!NextBit(src_buf, bitpos))
continue;
if (*bitpos - startbit <= 11)
*bitpos = startbit;
- return true;
+ return;
}
- return false;
}
-bool FaxGet1DLine(const uint8_t* src_buf,
+void FaxGet1DLine(const uint8_t* src_buf,
int bitsize,
int* bitpos,
std::vector<uint8_t>* dest_buf,
@@ -418,7 +419,7 @@ bool FaxGet1DLine(const uint8_t* src_buf,
int startpos = 0;
while (1) {
if (*bitpos >= bitsize)
- return false;
+ return;
int run_len = 0;
while (1) {
@@ -427,14 +428,13 @@ bool FaxGet1DLine(const uint8_t* src_buf,
if (run < 0) {
while (*bitpos < bitsize) {
if (NextBit(src_buf, bitpos))
- return true;
+ return;
}
- return false;
+ return;
}
run_len += run;
- if (run < 64) {
+ if (run < 64)
break;
- }
}
if (!color)
FaxFillBits(dest_buf->data(), columns, startpos, startpos + run_len);
@@ -445,7 +445,6 @@ bool FaxGet1DLine(const uint8_t* src_buf,
color = !color;
}
- return true;
}
} // namespace
@@ -503,7 +502,7 @@ CCodec_FaxDecoder::CCodec_FaxDecoder(const uint8_t* src_buf,
CCodec_FaxDecoder::~CCodec_FaxDecoder() {}
bool CCodec_FaxDecoder::v_Rewind() {
- FXSYS_memset(m_RefBuf.data(), 0xff, m_RefBuf.size());
+ memset(m_RefBuf.data(), 0xff, m_RefBuf.size());
m_bitpos = 0;
return true;
}
@@ -514,7 +513,7 @@ uint8_t* CCodec_FaxDecoder::v_GetNextLine() {
if (m_bitpos >= bitsize)
return nullptr;
- FXSYS_memset(m_ScanlineBuf.data(), 0xff, m_ScanlineBuf.size());
+ memset(m_ScanlineBuf.data(), 0xff, m_ScanlineBuf.size());
if (m_Encoding < 0) {
FaxG4GetRow(m_pSrcBuf, bitsize, &m_bitpos, m_ScanlineBuf.data(), m_RefBuf,
m_OrigWidth);
@@ -538,19 +537,17 @@ uint8_t* CCodec_FaxDecoder::v_GetNextLine() {
int bitpos1 = (m_bitpos + 7) / 8 * 8;
while (m_bByteAlign && bitpos0 < bitpos1) {
int bit = m_pSrcBuf[bitpos0 / 8] & (1 << (7 - bitpos0 % 8));
- if (bit != 0) {
+ if (bit != 0)
m_bByteAlign = false;
- } else {
+ else
++bitpos0;
- }
}
if (m_bByteAlign)
m_bitpos = bitpos1;
}
if (m_bBlack) {
- for (uint32_t i = 0; i < m_Pitch; ++i) {
+ for (uint32_t i = 0; i < m_Pitch; ++i)
m_ScanlineBuf[i] = ~m_ScanlineBuf[i];
- }
}
return m_ScanlineBuf.data();
}
@@ -573,9 +570,9 @@ void FaxG4Decode(const uint8_t* src_buf,
int bitpos = *pbitpos;
for (int iRow = 0; iRow < height; iRow++) {
uint8_t* line_buf = dest_buf + iRow * pitch;
- FXSYS_memset(line_buf, 0xff, pitch);
+ memset(line_buf, 0xff, pitch);
FaxG4GetRow(src_buf, src_size << 3, &bitpos, line_buf, ref_buf, width);
- FXSYS_memcpy(ref_buf.data(), line_buf, pitch);
+ memcpy(ref_buf.data(), line_buf, pitch);
}
*pbitpos = bitpos;
}
@@ -654,9 +651,8 @@ const uint8_t WhiteRunMarkup[80] = {
void AddBitStream(uint8_t* dest_buf, int* dest_bitpos, int data, int bitlen) {
for (int i = bitlen - 1; i >= 0; i--) {
- if (data & (1 << i)) {
+ if (data & (1 << i))
dest_buf[*dest_bitpos / 8] |= 1 << (7 - *dest_bitpos % 8);
- }
(*dest_bitpos)++;
}
}
@@ -726,16 +722,14 @@ void FaxEncode2DLine(uint8_t* dest_buf,
(*dest_bitpos)++;
dest_buf[*dest_bitpos / 8] |= 1 << (7 - *dest_bitpos % 8);
(*dest_bitpos)++;
- if (a0 < 0) {
+ if (a0 < 0)
a0 = 0;
- }
FaxEncodeRun(dest_buf, dest_bitpos, a1 - a0, a0color);
FaxEncodeRun(dest_buf, dest_bitpos, a2 - a1, !a0color);
a0 = a2;
}
- if (a0 >= cols) {
+ if (a0 >= cols)
return;
- }
}
}
@@ -762,7 +756,7 @@ CCodec_FaxEncoder::CCodec_FaxEncoder(const uint8_t* src_buf,
int pitch)
: m_Cols(width), m_Rows(height), m_Pitch(pitch), m_pSrcBuf(src_buf) {
m_RefLine.resize(m_Pitch);
- FXSYS_memset(m_RefLine.data(), 0xff, m_Pitch);
+ memset(m_RefLine.data(), 0xff, m_Pitch);
m_pLineBuf = FX_Alloc2D(uint8_t, m_Pitch, 8);
m_DestBuf.EstimateSize(0, 10240);
}
@@ -778,17 +772,16 @@ void CCodec_FaxEncoder::Encode(
uint8_t last_byte = 0;
for (int i = 0; i < m_Rows; i++) {
const uint8_t* scan_line = m_pSrcBuf + i * m_Pitch;
- FXSYS_memset(m_pLineBuf, 0, m_Pitch * 8);
+ memset(m_pLineBuf, 0, m_Pitch * 8);
m_pLineBuf[0] = last_byte;
FaxEncode2DLine(m_pLineBuf, &dest_bitpos, scan_line, m_RefLine, m_Cols);
m_DestBuf.AppendBlock(m_pLineBuf, dest_bitpos / 8);
last_byte = m_pLineBuf[dest_bitpos / 8];
dest_bitpos %= 8;
- FXSYS_memcpy(m_RefLine.data(), scan_line, m_Pitch);
+ memcpy(m_RefLine.data(), scan_line, m_Pitch);
}
- if (dest_bitpos) {
+ if (dest_bitpos)
m_DestBuf.AppendByte(last_byte);
- }
*dest_size = m_DestBuf.GetSize();
*dest_buf = m_DestBuf.DetachBuffer();
}
diff --git a/chromium/third_party/pdfium/core/fxcodec/codec/fx_codec_flate.cpp b/chromium/third_party/pdfium/core/fxcodec/codec/fx_codec_flate.cpp
index 3cffc0b7cf3..ef782482174 100644
--- a/chromium/third_party/pdfium/core/fxcodec/codec/fx_codec_flate.cpp
+++ b/chromium/third_party/pdfium/core/fxcodec/codec/fx_codec_flate.cpp
@@ -13,83 +13,86 @@
#include "core/fxcodec/fx_codec.h"
#include "core/fxcrt/fx_ext.h"
+#include "third_party/base/numerics/safe_conversions.h"
#include "third_party/base/ptr_util.h"
-#include "third_party/zlib_v128/zlib.h"
+#include "third_party/zlib/zlib.h"
extern "C" {
+
static void* my_alloc_func(void* opaque,
unsigned int items,
unsigned int size) {
return FX_Alloc2D(uint8_t, items, size);
}
+
static void my_free_func(void* opaque, void* address) {
FX_Free(address);
}
-static int FPDFAPI_FlateGetTotalOut(void* context) {
- return ((z_stream*)context)->total_out;
+
+} // extern "C"
+
+namespace {
+
+uint32_t FlateGetPossiblyTruncatedTotalOut(void* context) {
+ return pdfium::base::saturated_cast<uint32_t>(
+ static_cast<z_stream*>(context)->total_out);
}
-static int FPDFAPI_FlateGetTotalIn(void* context) {
- return ((z_stream*)context)->total_in;
+
+uint32_t FlateGetPossiblyTruncatedTotalIn(void* context) {
+ return pdfium::base::saturated_cast<uint32_t>(
+ static_cast<z_stream*>(context)->total_in);
}
-static bool FPDFAPI_FlateCompress(unsigned char* dest_buf,
- unsigned long* dest_size,
- const unsigned char* src_buf,
- unsigned long src_size) {
+bool FlateCompress(unsigned char* dest_buf,
+ unsigned long* dest_size,
+ const unsigned char* src_buf,
+ uint32_t src_size) {
return compress(dest_buf, dest_size, src_buf, src_size) == Z_OK;
}
-void* FPDFAPI_FlateInit(void* (*alloc_func)(void*, unsigned int, unsigned int),
- void (*free_func)(void*, void*)) {
- z_stream* p = (z_stream*)alloc_func(0, 1, sizeof(z_stream));
- if (!p)
- return nullptr;
-
- FXSYS_memset(p, 0, sizeof(z_stream));
- p->zalloc = alloc_func;
- p->zfree = free_func;
+void* FlateInit() {
+ z_stream* p = FX_Alloc(z_stream, 1);
+ memset(p, 0, sizeof(z_stream));
+ p->zalloc = my_alloc_func;
+ p->zfree = my_free_func;
inflateInit(p);
return p;
}
-void FPDFAPI_FlateInput(void* context,
- const unsigned char* src_buf,
- unsigned int src_size) {
- ((z_stream*)context)->next_in = (unsigned char*)src_buf;
- ((z_stream*)context)->avail_in = src_size;
+void FlateInput(void* context,
+ const unsigned char* src_buf,
+ uint32_t src_size) {
+ static_cast<z_stream*>(context)->next_in =
+ const_cast<unsigned char*>(src_buf);
+ static_cast<z_stream*>(context)->avail_in = src_size;
}
-int FPDFAPI_FlateOutput(void* context,
- unsigned char* dest_buf,
- unsigned int dest_size) {
- ((z_stream*)context)->next_out = dest_buf;
- ((z_stream*)context)->avail_out = dest_size;
- unsigned int pre_pos = (unsigned int)FPDFAPI_FlateGetTotalOut(context);
- int ret = inflate((z_stream*)context, Z_SYNC_FLUSH);
- unsigned int post_pos = (unsigned int)FPDFAPI_FlateGetTotalOut(context);
- unsigned int written = post_pos - pre_pos;
- if (written < dest_size) {
- FXSYS_memset(dest_buf + written, '\0', dest_size - written);
- }
- return ret;
-}
+uint32_t FlateOutput(void* context,
+ unsigned char* dest_buf,
+ uint32_t dest_size) {
+ static_cast<z_stream*>(context)->next_out = dest_buf;
+ static_cast<z_stream*>(context)->avail_out = dest_size;
+ uint32_t pre_pos = FlateGetPossiblyTruncatedTotalOut(context);
+ int ret = inflate(static_cast<z_stream*>(context), Z_SYNC_FLUSH);
-int FPDFAPI_FlateGetAvailIn(void* context) {
- return ((z_stream*)context)->avail_in;
-}
+ uint32_t post_pos = FlateGetPossiblyTruncatedTotalOut(context);
+ ASSERT(post_pos >= pre_pos);
-int FPDFAPI_FlateGetAvailOut(void* context) {
- return ((z_stream*)context)->avail_out;
-}
+ uint32_t written = post_pos - pre_pos;
+ if (written < dest_size)
+ memset(dest_buf + written, '\0', dest_size - written);
-void FPDFAPI_FlateEnd(void* context) {
- inflateEnd((z_stream*)context);
- ((z_stream*)context)->zfree(0, context);
+ return ret;
}
-} // extern "C"
+uint32_t FlateGetAvailOut(void* context) {
+ return static_cast<z_stream*>(context)->avail_out;
+}
-namespace {
+void FlateEnd(void* context) {
+ inflateEnd(static_cast<z_stream*>(context));
+ static_cast<z_stream*>(context)->zfree(0, context);
+}
class CLZWDecoder {
public:
@@ -158,7 +161,7 @@ int CLZWDecoder::Decode(uint8_t* dest_buf,
m_pOutput = dest_buf;
m_Early = bEarlyChange ? 1 : 0;
m_nCodes = 0;
- uint32_t old_code = (uint32_t)-1;
+ uint32_t old_code = 0xFFFFFFFF;
uint8_t last_char = 0;
while (1) {
if (m_InPos + m_CodeLen > src_size * 8) {
@@ -190,20 +193,19 @@ int CLZWDecoder::Decode(uint8_t* dest_buf,
}
m_OutPos++;
last_char = (uint8_t)code;
- if (old_code != (uint32_t)-1) {
+ if (old_code != 0xFFFFFFFF)
AddCode(old_code, last_char);
- }
old_code = code;
} else if (code == 256) {
m_CodeLen = 9;
m_nCodes = 0;
- old_code = (uint32_t)-1;
+ old_code = 0xFFFFFFFF;
} else if (code == 257) {
break;
} else {
- if (old_code == (uint32_t)-1) {
+ if (old_code == 0xFFFFFFFF)
return 2;
- }
+
m_StackLen = 0;
if (code >= m_nCodes + 258) {
if (m_StackLen < sizeof(m_DecodeStack)) {
@@ -242,9 +244,9 @@ int CLZWDecoder::Decode(uint8_t* dest_buf,
uint8_t PathPredictor(int a, int b, int c) {
int p = a + b - c;
- int pa = FXSYS_abs(p - a);
- int pb = FXSYS_abs(p - b);
- int pc = FXSYS_abs(p - c);
+ int pa = abs(p - a);
+ int pb = abs(p - b);
+ int pc = abs(p - c);
if (pa <= pb && pa <= pc)
return (uint8_t)a;
if (pb <= pc)
@@ -288,7 +290,7 @@ void PNG_PredictLine(uint8_t* pDestData,
int BytesPerPixel = (bpc * nColors + 7) / 8;
uint8_t tag = pSrcData[0];
if (tag == 0) {
- FXSYS_memmove(pDestData, pSrcData + 1, row_size);
+ memmove(pDestData, pSrcData + 1, row_size);
return;
}
for (int byte = 0; byte < row_size; byte++) {
@@ -370,7 +372,7 @@ bool PNG_Predictor(uint8_t*& data_buf,
if ((row + 1) * (move_size + 1) > (int)data_size) {
move_size = last_row_size - 1;
}
- FXSYS_memmove(pDestData, pSrcData + 1, move_size);
+ memmove(pDestData, pSrcData + 1, move_size);
pSrcData += move_size + 1;
pDestData += move_size;
byte_cnt += move_size;
@@ -505,109 +507,66 @@ void FlateUncompress(const uint8_t* src_buf,
uint8_t*& dest_buf,
uint32_t& dest_size,
uint32_t& offset) {
- uint32_t guess_size = orig_size ? orig_size : src_size * 2;
- const uint32_t kStepSize = 10240;
- uint32_t alloc_step = orig_size ? kStepSize : std::min(src_size, kStepSize);
- static const uint32_t kMaxInitialAllocSize = 10000000;
- if (guess_size > kMaxInitialAllocSize) {
- guess_size = kMaxInitialAllocSize;
- alloc_step = kMaxInitialAllocSize;
- }
- uint32_t buf_size = guess_size;
- uint32_t last_buf_size = buf_size;
-
dest_buf = nullptr;
dest_size = 0;
- void* context = FPDFAPI_FlateInit(my_alloc_func, my_free_func);
+ void* context = FlateInit();
if (!context)
return;
+ FlateInput(context, src_buf, src_size);
+
+ const uint32_t kMaxInitialAllocSize = 10000000;
+ uint32_t guess_size = orig_size ? orig_size : src_size * 2;
+ guess_size = std::min(guess_size, kMaxInitialAllocSize);
+
+ uint32_t buf_size = guess_size;
+ uint32_t last_buf_size = buf_size;
std::unique_ptr<uint8_t, FxFreeDeleter> guess_buf(
FX_Alloc(uint8_t, guess_size + 1));
guess_buf.get()[guess_size] = '\0';
- FPDFAPI_FlateInput(context, src_buf, src_size);
-
- if (src_size < kStepSize) {
- // This is the old implementation.
- uint8_t* cur_buf = guess_buf.get();
- while (1) {
- int32_t ret = FPDFAPI_FlateOutput(context, cur_buf, buf_size);
- if (ret != Z_OK)
- break;
- int32_t avail_buf_size = FPDFAPI_FlateGetAvailOut(context);
- if (avail_buf_size != 0)
- break;
-
- uint32_t old_size = guess_size;
- guess_size += alloc_step;
- if (guess_size < old_size || guess_size + 1 < guess_size) {
- FPDFAPI_FlateEnd(context);
- return;
- }
-
- {
- uint8_t* new_buf =
- FX_Realloc(uint8_t, guess_buf.release(), guess_size + 1);
- guess_buf.reset(new_buf);
- }
- guess_buf.get()[guess_size] = '\0';
- cur_buf = guess_buf.get() + old_size;
- buf_size = guess_size - old_size;
- }
- dest_size = FPDFAPI_FlateGetTotalOut(context);
- offset = FPDFAPI_FlateGetTotalIn(context);
- if (guess_size / 2 > dest_size) {
- {
- uint8_t* new_buf =
- FX_Realloc(uint8_t, guess_buf.release(), dest_size + 1);
- guess_buf.reset(new_buf);
- }
- guess_size = dest_size;
- guess_buf.get()[guess_size] = '\0';
- }
- dest_buf = guess_buf.release();
- } else {
- std::vector<uint8_t*> result_tmp_bufs;
- uint8_t* cur_buf = guess_buf.release();
- while (1) {
- int32_t ret = FPDFAPI_FlateOutput(context, cur_buf, buf_size);
- int32_t avail_buf_size = FPDFAPI_FlateGetAvailOut(context);
- if (ret != Z_OK) {
- last_buf_size = buf_size - avail_buf_size;
- result_tmp_bufs.push_back(cur_buf);
- break;
- }
- if (avail_buf_size != 0) {
- last_buf_size = buf_size - avail_buf_size;
- result_tmp_bufs.push_back(cur_buf);
- break;
- }
+ std::vector<uint8_t*> result_tmp_bufs;
+ uint8_t* cur_buf = guess_buf.release();
+ while (1) {
+ uint32_t ret = FlateOutput(context, cur_buf, buf_size);
+ uint32_t avail_buf_size = FlateGetAvailOut(context);
+ if (ret != Z_OK || avail_buf_size != 0) {
+ last_buf_size = buf_size - avail_buf_size;
result_tmp_bufs.push_back(cur_buf);
- cur_buf = FX_Alloc(uint8_t, buf_size + 1);
- cur_buf[buf_size] = '\0';
+ break;
}
- dest_size = FPDFAPI_FlateGetTotalOut(context);
- offset = FPDFAPI_FlateGetTotalIn(context);
- if (result_tmp_bufs.size() == 1) {
- dest_buf = result_tmp_bufs[0];
- } else {
- uint8_t* result_buf = FX_Alloc(uint8_t, dest_size);
- uint32_t result_pos = 0;
- for (size_t i = 0; i < result_tmp_bufs.size(); i++) {
- uint8_t* tmp_buf = result_tmp_bufs[i];
- uint32_t tmp_buf_size = buf_size;
- if (i == result_tmp_bufs.size() - 1) {
- tmp_buf_size = last_buf_size;
- }
- FXSYS_memcpy(result_buf + result_pos, tmp_buf, tmp_buf_size);
- result_pos += tmp_buf_size;
- FX_Free(result_tmp_bufs[i]);
- }
- dest_buf = result_buf;
+ result_tmp_bufs.push_back(cur_buf);
+ cur_buf = FX_Alloc(uint8_t, buf_size + 1);
+ cur_buf[buf_size] = '\0';
+ }
+
+ // The TotalOut size returned from the library may not be big enough to
+ // handle the content the library returns. We can only handle items
+ // up to 4GB in size.
+ dest_size = FlateGetPossiblyTruncatedTotalOut(context);
+ offset = FlateGetPossiblyTruncatedTotalIn(context);
+ if (result_tmp_bufs.size() == 1) {
+ dest_buf = result_tmp_bufs[0];
+ } else {
+ uint8_t* result_buf = FX_Alloc(uint8_t, dest_size);
+ uint32_t result_pos = 0;
+ uint32_t remaining = dest_size;
+ for (size_t i = 0; i < result_tmp_bufs.size(); i++) {
+ uint8_t* tmp_buf = result_tmp_bufs[i];
+ uint32_t tmp_buf_size = buf_size;
+ if (i == result_tmp_bufs.size() - 1)
+ tmp_buf_size = last_buf_size;
+
+ uint32_t cp_size = std::min(tmp_buf_size, remaining);
+ memcpy(result_buf + result_pos, tmp_buf, cp_size);
+ result_pos += cp_size;
+ remaining -= cp_size;
+
+ FX_Free(result_tmp_bufs[i]);
}
+ dest_buf = result_buf;
}
- FPDFAPI_FlateEnd(context);
+ FlateEnd(context);
}
} // namespace
@@ -656,15 +615,16 @@ CCodec_FlateScanlineDecoder::CCodec_FlateScanlineDecoder() {
m_pPredictRaw = nullptr;
m_LeftOver = 0;
}
+
CCodec_FlateScanlineDecoder::~CCodec_FlateScanlineDecoder() {
FX_Free(m_pScanline);
FX_Free(m_pLastLine);
FX_Free(m_pPredictBuffer);
FX_Free(m_pPredictRaw);
- if (m_pFlate) {
- FPDFAPI_FlateEnd(m_pFlate);
- }
+ if (m_pFlate)
+ FlateEnd(m_pFlate);
}
+
void CCodec_FlateScanlineDecoder::Create(const uint8_t* src_buf,
uint32_t src_size,
int width,
@@ -709,28 +669,30 @@ void CCodec_FlateScanlineDecoder::Create(const uint8_t* src_buf,
}
}
}
+
bool CCodec_FlateScanlineDecoder::v_Rewind() {
- if (m_pFlate) {
- FPDFAPI_FlateEnd(m_pFlate);
- }
- m_pFlate = FPDFAPI_FlateInit(my_alloc_func, my_free_func);
- if (!m_pFlate) {
+ if (m_pFlate)
+ FlateEnd(m_pFlate);
+
+ m_pFlate = FlateInit();
+ if (!m_pFlate)
return false;
- }
- FPDFAPI_FlateInput(m_pFlate, m_SrcBuf, m_SrcSize);
+
+ FlateInput(m_pFlate, m_SrcBuf, m_SrcSize);
m_LeftOver = 0;
return true;
}
+
uint8_t* CCodec_FlateScanlineDecoder::v_GetNextLine() {
if (m_Predictor) {
if (m_Pitch == m_PredictPitch) {
if (m_Predictor == 2) {
- FPDFAPI_FlateOutput(m_pFlate, m_pPredictRaw, m_PredictPitch + 1);
+ FlateOutput(m_pFlate, m_pPredictRaw, m_PredictPitch + 1);
PNG_PredictLine(m_pScanline, m_pPredictRaw, m_pLastLine,
m_BitsPerComponent, m_Colors, m_Columns);
- FXSYS_memcpy(m_pLastLine, m_pScanline, m_PredictPitch);
+ memcpy(m_pLastLine, m_pScanline, m_PredictPitch);
} else {
- FPDFAPI_FlateOutput(m_pFlate, m_pScanline, m_Pitch);
+ FlateOutput(m_pFlate, m_pScanline, m_Pitch);
TIFF_PredictLine(m_pScanline, m_PredictPitch, m_bpc, m_nComps,
m_OutputWidth);
}
@@ -739,38 +701,38 @@ uint8_t* CCodec_FlateScanlineDecoder::v_GetNextLine() {
size_t read_leftover =
m_LeftOver > bytes_to_go ? bytes_to_go : m_LeftOver;
if (read_leftover) {
- FXSYS_memcpy(m_pScanline,
- m_pPredictBuffer + m_PredictPitch - m_LeftOver,
- read_leftover);
+ memcpy(m_pScanline, m_pPredictBuffer + m_PredictPitch - m_LeftOver,
+ read_leftover);
m_LeftOver -= read_leftover;
bytes_to_go -= read_leftover;
}
while (bytes_to_go) {
if (m_Predictor == 2) {
- FPDFAPI_FlateOutput(m_pFlate, m_pPredictRaw, m_PredictPitch + 1);
+ FlateOutput(m_pFlate, m_pPredictRaw, m_PredictPitch + 1);
PNG_PredictLine(m_pPredictBuffer, m_pPredictRaw, m_pLastLine,
m_BitsPerComponent, m_Colors, m_Columns);
- FXSYS_memcpy(m_pLastLine, m_pPredictBuffer, m_PredictPitch);
+ memcpy(m_pLastLine, m_pPredictBuffer, m_PredictPitch);
} else {
- FPDFAPI_FlateOutput(m_pFlate, m_pPredictBuffer, m_PredictPitch);
+ FlateOutput(m_pFlate, m_pPredictBuffer, m_PredictPitch);
TIFF_PredictLine(m_pPredictBuffer, m_PredictPitch, m_BitsPerComponent,
m_Colors, m_Columns);
}
size_t read_bytes =
m_PredictPitch > bytes_to_go ? bytes_to_go : m_PredictPitch;
- FXSYS_memcpy(m_pScanline + m_Pitch - bytes_to_go, m_pPredictBuffer,
- read_bytes);
+ memcpy(m_pScanline + m_Pitch - bytes_to_go, m_pPredictBuffer,
+ read_bytes);
m_LeftOver += m_PredictPitch - read_bytes;
bytes_to_go -= read_bytes;
}
}
} else {
- FPDFAPI_FlateOutput(m_pFlate, m_pScanline, m_Pitch);
+ FlateOutput(m_pFlate, m_pScanline, m_Pitch);
}
return m_pScanline;
}
+
uint32_t CCodec_FlateScanlineDecoder::GetSrcOffset() {
- return FPDFAPI_FlateGetTotalIn(m_pFlate);
+ return FlateGetPossiblyTruncatedTotalIn(m_pFlate);
}
std::unique_ptr<CCodec_ScanlineDecoder> CCodec_FlateModule::CreateDecoder(
@@ -813,8 +775,8 @@ uint32_t CCodec_FlateModule::FlateOrLZWDecode(bool bLZW,
}
if (bLZW) {
{
- std::unique_ptr<CLZWDecoder> decoder(new CLZWDecoder);
- dest_size = (uint32_t)-1;
+ auto decoder = pdfium::MakeUnique<CLZWDecoder>();
+ dest_size = 0xFFFFFFFF;
offset = src_size;
int err =
decoder->Decode(nullptr, dest_size, src_buf, offset, bEarlyChange);
@@ -823,7 +785,7 @@ uint32_t CCodec_FlateModule::FlateOrLZWDecode(bool bLZW,
}
}
{
- std::unique_ptr<CLZWDecoder> decoder(new CLZWDecoder);
+ auto decoder = pdfium::MakeUnique<CLZWDecoder>();
dest_buf = FX_Alloc(uint8_t, dest_size + 1);
dest_buf[dest_size] = '\0';
decoder->Decode(dest_buf, dest_size, src_buf, offset, bEarlyChange);
@@ -852,7 +814,7 @@ bool CCodec_FlateModule::Encode(const uint8_t* src_buf,
*dest_size = src_size + src_size / 1000 + 12;
*dest_buf = FX_Alloc(uint8_t, *dest_size);
unsigned long temp_size = *dest_size;
- if (!FPDFAPI_FlateCompress(*dest_buf, &temp_size, src_buf, src_size))
+ if (!FlateCompress(*dest_buf, &temp_size, src_buf, src_size))
return false;
*dest_size = (uint32_t)temp_size;
@@ -864,7 +826,7 @@ bool CCodec_FlateModule::PngEncode(const uint8_t* src_buf,
uint8_t** dest_buf,
uint32_t* dest_size) {
uint8_t* pSrcBuf = FX_Alloc(uint8_t, src_size);
- FXSYS_memcpy(pSrcBuf, src_buf, src_size);
+ memcpy(pSrcBuf, src_buf, src_size);
PNG_PredictorEncode(&pSrcBuf, &src_size);
bool ret = Encode(pSrcBuf, src_size, dest_buf, dest_size);
FX_Free(pSrcBuf);
diff --git a/chromium/third_party/pdfium/core/fxcodec/codec/fx_codec_icc.cpp b/chromium/third_party/pdfium/core/fxcodec/codec/fx_codec_icc.cpp
index f77c8507bfb..7592c053c52 100644
--- a/chromium/third_party/pdfium/core/fxcodec/codec/fx_codec_icc.cpp
+++ b/chromium/third_party/pdfium/core/fxcodec/codec/fx_codec_icc.cpp
@@ -62,7 +62,7 @@ void* IccLib_CreateTransform(const unsigned char* pSrcProfileData,
uint32_t dwDstFormat = Icc_FORMAT_DEFAULT) {
nSrcComponents = 0;
cmsHPROFILE srcProfile =
- cmsOpenProfileFromMem((void*)pSrcProfileData, dwSrcProfileSize);
+ cmsOpenProfileFromMem(pSrcProfileData, dwSrcProfileSize);
if (!srcProfile)
return nullptr;
@@ -70,8 +70,7 @@ void* IccLib_CreateTransform(const unsigned char* pSrcProfileData,
if (!pDstProfileData && dwDstProfileSize == 0 && nDstComponents == 3) {
dstProfile = cmsCreate_sRGBProfile();
} else {
- dstProfile =
- cmsOpenProfileFromMem((void*)pDstProfileData, dwDstProfileSize);
+ dstProfile = cmsOpenProfileFromMem(pDstProfileData, dwDstProfileSize);
}
if (!dstProfile) {
cmsCloseProfile(srcProfile);
@@ -154,33 +153,32 @@ void IccLib_DestroyTransform(void* pTransform) {
cmsDeleteTransform(((CLcmsCmm*)pTransform)->m_hTransform);
delete (CLcmsCmm*)pTransform;
}
+
void IccLib_Translate(void* pTransform,
uint32_t nSrcComponents,
- FX_FLOAT* pSrcValues,
- FX_FLOAT* pDestValues) {
- if (!pTransform) {
+ const float* pSrcValues,
+ float* pDestValues) {
+ if (!pTransform)
return;
- }
+
CLcmsCmm* p = (CLcmsCmm*)pTransform;
uint8_t output[4];
if (p->m_bLab) {
CFX_FixedBufGrow<double, 16> inputs(nSrcComponents);
double* input = inputs;
- for (uint32_t i = 0; i < nSrcComponents; i++) {
+ for (uint32_t i = 0; i < nSrcComponents; i++)
input[i] = pSrcValues[i];
- }
cmsDoTransform(p->m_hTransform, input, output, 1);
} else {
CFX_FixedBufGrow<uint8_t, 16> inputs(nSrcComponents);
uint8_t* input = inputs;
for (uint32_t i = 0; i < nSrcComponents; i++) {
- if (pSrcValues[i] > 1.0f) {
+ if (pSrcValues[i] > 1.0f)
input[i] = 255;
- } else if (pSrcValues[i] < 0) {
+ else if (pSrcValues[i] < 0)
input[i] = 0;
- } else {
- input[i] = (int)(pSrcValues[i] * 255.0f);
- }
+ else
+ input[i] = static_cast<int>(pSrcValues[i] * 255.0f);
}
cmsDoTransform(p->m_hTransform, input, output, 1);
}
@@ -201,12 +199,14 @@ void IccLib_Translate(void* pTransform,
break;
}
}
+
void IccLib_TranslateImage(void* pTransform,
unsigned char* pDest,
const unsigned char* pSrc,
int32_t pixels) {
- cmsDoTransform(((CLcmsCmm*)pTransform)->m_hTransform, (void*)pSrc, pDest,
- pixels);
+ if (!pTransform)
+ return;
+ cmsDoTransform(((CLcmsCmm*)pTransform)->m_hTransform, pSrc, pDest, pixels);
}
CCodec_IccModule::CCodec_IccModule() : m_nComponents(0) {}
@@ -225,17 +225,20 @@ void* CCodec_IccModule::CreateTransform_sRGB(const uint8_t* pProfileData,
void CCodec_IccModule::DestroyTransform(void* pTransform) {
IccLib_DestroyTransform(pTransform);
}
+
void CCodec_IccModule::Translate(void* pTransform,
- FX_FLOAT* pSrcValues,
- FX_FLOAT* pDestValues) {
+ const float* pSrcValues,
+ float* pDestValues) {
IccLib_Translate(pTransform, m_nComponents, pSrcValues, pDestValues);
}
+
void CCodec_IccModule::TranslateScanline(void* pTransform,
uint8_t* pDest,
const uint8_t* pSrc,
int32_t pixels) {
IccLib_TranslateImage(pTransform, pDest, pSrc, pixels);
}
+
const uint8_t g_CMYKSamples[81 * 81 * 3] = {
255, 255, 255, 225, 226, 228, 199, 200, 202, 173, 174, 178, 147, 149, 152,
123, 125, 128, 99, 99, 102, 69, 70, 71, 34, 30, 31, 255, 253, 229,
@@ -1551,6 +1554,7 @@ const uint8_t g_CMYKSamples[81 * 81 * 3] = {
33, 28, 32, 22, 19, 23, 11, 6, 10, 1, 0, 0, 0, 0, 0,
0, 0, 0,
};
+
void AdobeCMYK_to_sRGB1(uint8_t c,
uint8_t m,
uint8_t y,
@@ -1631,13 +1635,13 @@ void AdobeCMYK_to_sRGB1(uint8_t c,
G = fix_g >> 8;
B = fix_b >> 8;
}
-void AdobeCMYK_to_sRGB(FX_FLOAT c,
- FX_FLOAT m,
- FX_FLOAT y,
- FX_FLOAT k,
- FX_FLOAT& R,
- FX_FLOAT& G,
- FX_FLOAT& B) {
+void AdobeCMYK_to_sRGB(float c,
+ float m,
+ float y,
+ float k,
+ float& R,
+ float& G,
+ float& B) {
// Convert to uint8_t with round-to-nearest. Avoid using FXSYS_round because
// it is incredibly expensive with VC++ (tested on VC++ 2015) because round()
// is very expensive.
diff --git a/chromium/third_party/pdfium/core/fxcodec/codec/fx_codec_jbig.cpp b/chromium/third_party/pdfium/core/fxcodec/codec/fx_codec_jbig.cpp
index 926541f07dc..7df87e981fc 100644
--- a/chromium/third_party/pdfium/core/fxcodec/codec/fx_codec_jbig.cpp
+++ b/chromium/third_party/pdfium/core/fxcodec/codec/fx_codec_jbig.cpp
@@ -45,8 +45,8 @@ FXCODEC_STATUS CCodec_Jbig2Module::StartDecode(
std::unique_ptr<JBig2_DocumentContext>* pContextHolder,
uint32_t width,
uint32_t height,
- CPDF_StreamAcc* src_stream,
- CPDF_StreamAcc* global_stream,
+ const CFX_RetainPtr<CPDF_StreamAcc>& src_stream,
+ const CFX_RetainPtr<CPDF_StreamAcc>& global_stream,
uint8_t* dest_buf,
uint32_t dest_pitch,
IFX_Pause* pPause) {
@@ -62,44 +62,34 @@ FXCODEC_STATUS CCodec_Jbig2Module::StartDecode(
pJbig2Context->m_dest_buf = dest_buf;
pJbig2Context->m_dest_pitch = dest_pitch;
pJbig2Context->m_pPause = pPause;
- FXSYS_memset(dest_buf, 0, height * dest_pitch);
+ memset(dest_buf, 0, height * dest_pitch);
pJbig2Context->m_pContext = pdfium::MakeUnique<CJBig2_Context>(
global_stream, src_stream, pJBig2DocumentContext->GetSymbolDictCache(),
pPause, false);
- if (!pJbig2Context->m_pContext)
- return FXCODEC_STATUS_ERROR;
-
int ret = pJbig2Context->m_pContext->getFirstPage(dest_buf, width, height,
dest_pitch, pPause);
- if (pJbig2Context->m_pContext->GetProcessingStatus() ==
- FXCODEC_STATUS_DECODE_FINISH) {
- pJbig2Context->m_pContext.reset();
- if (ret != JBIG2_SUCCESS)
- return FXCODEC_STATUS_ERROR;
-
- int dword_size = height * dest_pitch / 4;
- uint32_t* dword_buf = (uint32_t*)dest_buf;
- for (int i = 0; i < dword_size; i++)
- dword_buf[i] = ~dword_buf[i];
- return FXCODEC_STATUS_DECODE_FINISH;
- }
- return pJbig2Context->m_pContext->GetProcessingStatus();
+ return Decode(pJbig2Context, ret);
}
FXCODEC_STATUS CCodec_Jbig2Module::ContinueDecode(
CCodec_Jbig2Context* pJbig2Context,
IFX_Pause* pPause) {
int ret = pJbig2Context->m_pContext->Continue(pPause);
- if (pJbig2Context->m_pContext->GetProcessingStatus() !=
- FXCODEC_STATUS_DECODE_FINISH) {
- return pJbig2Context->m_pContext->GetProcessingStatus();
- }
+ return Decode(pJbig2Context, ret);
+}
+
+FXCODEC_STATUS CCodec_Jbig2Module::Decode(CCodec_Jbig2Context* pJbig2Context,
+ int result) {
+ FXCODEC_STATUS status = pJbig2Context->m_pContext->GetProcessingStatus();
+ if (status != FXCODEC_STATUS_DECODE_FINISH)
+ return status;
+
pJbig2Context->m_pContext.reset();
- if (ret != JBIG2_SUCCESS)
+ if (result != JBIG2_SUCCESS)
return FXCODEC_STATUS_ERROR;
int dword_size = pJbig2Context->m_height * pJbig2Context->m_dest_pitch / 4;
- uint32_t* dword_buf = (uint32_t*)pJbig2Context->m_dest_buf;
+ uint32_t* dword_buf = reinterpret_cast<uint32_t*>(pJbig2Context->m_dest_buf);
for (int i = 0; i < dword_size; i++)
dword_buf[i] = ~dword_buf[i];
return FXCODEC_STATUS_DECODE_FINISH;
diff --git a/chromium/third_party/pdfium/core/fxcodec/codec/fx_codec_jpeg.cpp b/chromium/third_party/pdfium/core/fxcodec/codec/fx_codec_jpeg.cpp
index c7976055753..907d15f3fb6 100644
--- a/chromium/third_party/pdfium/core/fxcodec/codec/fx_codec_jpeg.cpp
+++ b/chromium/third_party/pdfium/core/fxcodec/codec/fx_codec_jpeg.cpp
@@ -12,6 +12,7 @@
#include "core/fxcodec/codec/codec_int.h"
#include "core/fxcodec/fx_codec.h"
#include "core/fxcrt/fx_safe_types.h"
+#include "core/fxge/dib/cfx_dibsource.h"
#include "core/fxge/fx_dib.h"
#include "third_party/base/ptr_util.h"
@@ -185,9 +186,9 @@ CCodec_JpegDecoder::CCodec_JpegDecoder() {
m_pScanlineBuf = nullptr;
m_bStarted = false;
m_bInited = false;
- FXSYS_memset(&cinfo, 0, sizeof(cinfo));
- FXSYS_memset(&jerr, 0, sizeof(jerr));
- FXSYS_memset(&src, 0, sizeof(src));
+ memset(&cinfo, 0, sizeof(cinfo));
+ memset(&jerr, 0, sizeof(jerr));
+ memset(&src, 0, sizeof(src));
m_nDefaultScaleDenom = 1;
}
@@ -253,8 +254,7 @@ bool CCodec_JpegDecoder::Create(const uint8_t* src_buf,
src.fill_input_buffer = _src_fill_buffer;
src.resync_to_restart = _src_resync;
m_bJpegTransform = ColorTransform;
- if (src_size > 1 &&
- FXSYS_memcmp(src_buf + src_size - 2, "\xFF\xD9", 2) != 0) {
+ if (src_size > 1 && memcmp(src_buf + src_size - 2, "\xFF\xD9", 2) != 0) {
((uint8_t*)src_buf)[src_size - 2] = 0xFF;
((uint8_t*)src_buf)[src_size - 1] = 0xD9;
}
@@ -484,7 +484,7 @@ uint32_t CCodec_JpegModule::GetAvailInput(FXJPEG_Context* ctx,
#if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_DESKTOP_
#define JPEG_BLOCK_SIZE 1048576
-bool CCodec_JpegModule::JpegEncode(const CFX_DIBSource* pSource,
+bool CCodec_JpegModule::JpegEncode(const CFX_RetainPtr<CFX_DIBSource>& pSource,
uint8_t** dest_buf,
FX_STRSIZE* dest_size) {
struct jpeg_error_mgr jerr;
diff --git a/chromium/third_party/pdfium/core/fxcodec/codec/fx_codec_jpx_opj.cpp b/chromium/third_party/pdfium/core/fxcodec/codec/fx_codec_jpx_opj.cpp
index fa163567f42..30e79deeeb3 100644
--- a/chromium/third_party/pdfium/core/fxcodec/codec/fx_codec_jpx_opj.cpp
+++ b/chromium/third_party/pdfium/core/fxcodec/codec/fx_codec_jpx_opj.cpp
@@ -7,12 +7,15 @@
#include <algorithm>
#include <limits>
#include <memory>
+#include <utility>
#include <vector>
#include "core/fpdfapi/page/cpdf_colorspace.h"
+#include "core/fxcodec/codec/cjpx_decoder.h"
#include "core/fxcodec/codec/codec_int.h"
#include "core/fxcodec/fx_codec.h"
#include "core/fxcrt/fx_safe_types.h"
+#include "third_party/base/ptr_util.h"
#include "third_party/lcms2-2.6/include/lcms2.h"
#include "third_party/libopenjpeg20/openjpeg.h"
@@ -44,24 +47,6 @@ OPJ_SIZE_T opj_read_from_memory(void* p_buffer,
return readlength;
}
-OPJ_SIZE_T opj_write_from_memory(void* p_buffer,
- OPJ_SIZE_T nb_bytes,
- void* p_user_data) {
- DecodeData* srcData = static_cast<DecodeData*>(p_user_data);
- if (!srcData || !srcData->src_data || srcData->src_size == 0) {
- return static_cast<OPJ_SIZE_T>(-1);
- }
- // Writes at EOF return an error code.
- if (srcData->offset >= srcData->src_size) {
- return static_cast<OPJ_SIZE_T>(-1);
- }
- OPJ_SIZE_T bufferLength = srcData->src_size - srcData->offset;
- OPJ_SIZE_T writeLength = nb_bytes < bufferLength ? nb_bytes : bufferLength;
- memcpy(&srcData->src_data[srcData->offset], p_buffer, writeLength);
- srcData->offset += writeLength;
- return writeLength;
-}
-
OPJ_OFF_T opj_skip_from_memory(OPJ_OFF_T nb_bytes, void* p_user_data) {
DecodeData* srcData = static_cast<DecodeData*>(p_user_data);
if (!srcData || !srcData->src_data || srcData->src_size == 0) {
@@ -132,7 +117,6 @@ opj_stream_t* fx_opj_stream_create_memory_stream(DecodeData* data,
opj_stream_set_user_data(l_stream, data, nullptr);
opj_stream_set_user_data_length(l_stream, data->src_size);
opj_stream_set_read_function(l_stream, opj_read_from_memory);
- opj_stream_set_write_function(l_stream, opj_write_from_memory);
opj_stream_set_skip_function(l_stream, opj_skip_from_memory);
opj_stream_set_seek_function(l_stream, opj_seek_from_memory);
return l_stream;
@@ -580,9 +564,9 @@ void color_apply_icc_profile(opj_image_t* image) {
image->comps[1] = image->comps[0];
image->comps[2] = image->comps[0];
image->comps[1].data = FX_Alloc(int, (size_t)max);
- FXSYS_memset(image->comps[1].data, 0, sizeof(int) * (size_t)max);
+ memset(image->comps[1].data, 0, sizeof(int) * (size_t)max);
image->comps[2].data = FX_Alloc(int, (size_t)max);
- FXSYS_memset(image->comps[2].data, 0, sizeof(int) * (size_t)max);
+ memset(image->comps[2].data, 0, sizeof(int) * (size_t)max);
image->numcomps += 2;
r = image->comps[0].data;
for (int i = 0; i < max; ++i) {
@@ -688,24 +672,6 @@ void color_apply_conversion(opj_image_t* image) {
return;
}
}
-class CJPX_Decoder {
- public:
- explicit CJPX_Decoder(CPDF_ColorSpace* cs);
- ~CJPX_Decoder();
- bool Init(const unsigned char* src_data, uint32_t src_size);
- void GetInfo(uint32_t* width, uint32_t* height, uint32_t* components);
- bool Decode(uint8_t* dest_buf,
- int pitch,
- const std::vector<uint8_t>& offsets);
-
- private:
- const uint8_t* m_SrcData;
- uint32_t m_SrcSize;
- opj_image_t* image;
- opj_codec_t* l_codec;
- opj_stream_t* l_stream;
- const CPDF_ColorSpace* const m_ColorSpace;
-};
CJPX_Decoder::CJPX_Decoder(CPDF_ColorSpace* cs)
: image(nullptr), l_codec(nullptr), l_stream(nullptr), m_ColorSpace(cs) {}
@@ -741,7 +707,7 @@ bool CJPX_Decoder::Init(const unsigned char* src_data, uint32_t src_size) {
opj_set_default_decoder_parameters(&parameters);
parameters.decod_format = 0;
parameters.cod_format = 3;
- if (FXSYS_memcmp(m_SrcData, szJP2Header, sizeof(szJP2Header)) == 0) {
+ if (memcmp(m_SrcData, szJP2Header, sizeof(szJP2Header)) == 0) {
l_codec = opj_create_decompress(OPJ_CODEC_JP2);
parameters.decod_format = 1;
} else {
@@ -822,7 +788,7 @@ bool CJPX_Decoder::Decode(uint8_t* dest_buf,
if (pitch<(int)(image->comps[0].w * 8 * image->numcomps + 31)>> 5 << 2)
return false;
- FXSYS_memset(dest_buf, 0xff, image->y1 * pitch);
+ memset(dest_buf, 0xff, image->y1 * pitch);
std::vector<uint8_t*> channel_bufs(image->numcomps);
std::vector<int> adjust_comps(image->numcomps);
for (uint32_t i = 0; i < image->numcomps; i++) {
@@ -891,13 +857,15 @@ bool CJPX_Decoder::Decode(uint8_t* dest_buf,
}
CCodec_JpxModule::CCodec_JpxModule() {}
+
CCodec_JpxModule::~CCodec_JpxModule() {}
-CJPX_Decoder* CCodec_JpxModule::CreateDecoder(const uint8_t* src_buf,
- uint32_t src_size,
- CPDF_ColorSpace* cs) {
- std::unique_ptr<CJPX_Decoder> decoder(new CJPX_Decoder(cs));
- return decoder->Init(src_buf, src_size) ? decoder.release() : nullptr;
+std::unique_ptr<CJPX_Decoder> CCodec_JpxModule::CreateDecoder(
+ const uint8_t* src_buf,
+ uint32_t src_size,
+ CPDF_ColorSpace* cs) {
+ auto decoder = pdfium::MakeUnique<CJPX_Decoder>(cs);
+ return decoder->Init(src_buf, src_size) ? std::move(decoder) : nullptr;
}
void CCodec_JpxModule::GetImageInfo(CJPX_Decoder* pDecoder,
@@ -913,7 +881,3 @@ bool CCodec_JpxModule::Decode(CJPX_Decoder* pDecoder,
const std::vector<uint8_t>& offsets) {
return pDecoder->Decode(dest_data, pitch, offsets);
}
-
-void CCodec_JpxModule::DestroyDecoder(CJPX_Decoder* pDecoder) {
- delete pDecoder;
-}
diff --git a/chromium/third_party/pdfium/core/fxcodec/codec/fx_codec_jpx_unittest.cpp b/chromium/third_party/pdfium/core/fxcodec/codec/fx_codec_jpx_unittest.cpp
index 3ef14e62c35..2acb76c355d 100644
--- a/chromium/third_party/pdfium/core/fxcodec/codec/fx_codec_jpx_unittest.cpp
+++ b/chromium/third_party/pdfium/core/fxcodec/codec/fx_codec_jpx_unittest.cpp
@@ -12,9 +12,8 @@
static const OPJ_OFF_T kSkipError = static_cast<OPJ_OFF_T>(-1);
static const OPJ_SIZE_T kReadError = static_cast<OPJ_SIZE_T>(-1);
-static const OPJ_SIZE_T kWriteError = static_cast<OPJ_SIZE_T>(-1);
-static unsigned char stream_data[] = {
+static const uint8_t stream_data[] = {
0x00, 0x01, 0x02, 0x03,
0x84, 0x85, 0x86, 0x87, // Include some hi-bytes, too.
};
@@ -23,16 +22,16 @@ union Float_t {
Float_t(float num = 0.0f) : f(num) {}
int32_t i;
- FX_FLOAT f;
+ float f;
};
TEST(fxcodec, CMYK_Rounding) {
// Testing all floats from 0.0 to 1.0 takes about 35 seconds in release
// builds and much longer in debug builds, so just test the known-dangerous
// range.
- const FX_FLOAT startValue = 0.001f;
- const FX_FLOAT endValue = 0.003f;
- FX_FLOAT R = 0.0f, G = 0.0f, B = 0.0f;
+ const float startValue = 0.001f;
+ const float endValue = 0.003f;
+ float R = 0.0f, G = 0.0f, B = 0.0f;
// Iterate through floats by incrementing the representation, as discussed in
// https://randomascii.wordpress.com/2012/01/23/stupid-float-tricks-2/
for (Float_t f = startValue; f.f < endValue; f.i++) {
@@ -43,19 +42,18 @@ TEST(fxcodec, CMYK_Rounding) {
}
TEST(fxcodec, DecodeDataNullDecodeData) {
- unsigned char buffer[16];
+ uint8_t buffer[16];
DecodeData* ptr = nullptr;
// Error codes, not segvs, should callers pass us a nullptr pointer.
EXPECT_EQ(kReadError, opj_read_from_memory(buffer, sizeof(buffer), ptr));
- EXPECT_EQ(kWriteError, opj_write_from_memory(buffer, sizeof(buffer), ptr));
EXPECT_EQ(kSkipError, opj_skip_from_memory(1, ptr));
EXPECT_FALSE(opj_seek_from_memory(1, ptr));
}
TEST(fxcodec, DecodeDataNullStream) {
DecodeData dd(nullptr, 0);
- unsigned char buffer[16];
+ uint8_t buffer[16];
// Reads of size 0 do nothing but return an error code.
memset(buffer, 0xbd, sizeof(buffer));
@@ -67,12 +65,6 @@ TEST(fxcodec, DecodeDataNullStream) {
EXPECT_EQ(kReadError, opj_read_from_memory(buffer, sizeof(buffer), &dd));
EXPECT_EQ(0xbd, buffer[0]);
- // writes of size 0 do nothing but return an error code.
- EXPECT_EQ(kWriteError, opj_write_from_memory(buffer, 0, &dd));
-
- // writes of nonzero size do nothing but return an error code.
- EXPECT_EQ(kWriteError, opj_write_from_memory(buffer, sizeof(buffer), &dd));
-
// Skips of size 0 always return an error code.
EXPECT_EQ(kSkipError, opj_skip_from_memory(0, &dd));
@@ -88,7 +80,7 @@ TEST(fxcodec, DecodeDataNullStream) {
TEST(fxcodec, DecodeDataZeroSize) {
DecodeData dd(stream_data, 0);
- unsigned char buffer[16];
+ uint8_t buffer[16];
// Reads of size 0 do nothing but return an error code.
memset(buffer, 0xbd, sizeof(buffer));
@@ -100,12 +92,6 @@ TEST(fxcodec, DecodeDataZeroSize) {
EXPECT_EQ(kReadError, opj_read_from_memory(buffer, sizeof(buffer), &dd));
EXPECT_EQ(0xbd, buffer[0]);
- // writes of size 0 do nothing but return an error code.
- EXPECT_EQ(kWriteError, opj_write_from_memory(buffer, 0, &dd));
-
- // writes of nonzero size do nothing but return an error code.
- EXPECT_EQ(kWriteError, opj_write_from_memory(buffer, sizeof(buffer), &dd));
-
// Skips of size 0 always return an error code.
EXPECT_EQ(kSkipError, opj_skip_from_memory(0, &dd));
@@ -120,7 +106,7 @@ TEST(fxcodec, DecodeDataZeroSize) {
}
TEST(fxcodec, DecodeDataReadInBounds) {
- unsigned char buffer[16];
+ uint8_t buffer[16];
{
DecodeData dd(stream_data, sizeof(stream_data));
@@ -171,7 +157,7 @@ TEST(fxcodec, DecodeDataReadInBounds) {
}
TEST(fxcodec, DecodeDataReadBeyondBounds) {
- unsigned char buffer[16];
+ uint8_t buffer[16];
{
DecodeData dd(stream_data, sizeof(stream_data));
@@ -234,86 +220,10 @@ TEST(fxcodec, DecodeDataReadBeyondBounds) {
}
}
-TEST(fxcodec, DecodeDataWriteInBounds) {
- unsigned char stream[16];
- static unsigned char buffer_data[] = {
- 0x00, 0x01, 0x02, 0x03, 0x80, 0x80, 0x81, 0x82, 0x83, 0x84,
- };
- {
- // Pretend the stream can only hold 4 bytes.
- DecodeData dd(stream, 4);
-
- memset(stream, 0xbd, sizeof(stream));
- EXPECT_EQ(4u, opj_write_from_memory(buffer_data, 4, &dd));
- EXPECT_EQ(0x00, stream[0]);
- EXPECT_EQ(0x01, stream[1]);
- EXPECT_EQ(0x02, stream[2]);
- EXPECT_EQ(0x03, stream[3]);
- EXPECT_EQ(0xbd, stream[4]);
- }
- {
- // Pretend the stream can only hold 4 bytes.
- DecodeData dd(stream, 4);
-
- memset(stream, 0xbd, sizeof(stream));
- EXPECT_EQ(2u, opj_write_from_memory(buffer_data, 2, &dd));
- EXPECT_EQ(2u, opj_write_from_memory(buffer_data, 2, &dd));
- EXPECT_EQ(0x00, stream[0]);
- EXPECT_EQ(0x01, stream[1]);
- EXPECT_EQ(0x00, stream[2]);
- EXPECT_EQ(0x01, stream[3]);
- EXPECT_EQ(0xbd, stream[4]);
- }
-}
-
-TEST(fxcodec, DecodeDataWriteBeyondBounds) {
- unsigned char stream[16];
- static unsigned char buffer_data[] = {
- 0x10, 0x11, 0x12, 0x13, 0x94, 0x95, 0x96, 0x97,
- };
- {
- // Pretend the stream can only hold 4 bytes.
- DecodeData dd(stream, 4);
-
- // Write ending past EOF transfers up til EOF.
- memset(stream, 0xbd, sizeof(stream));
- EXPECT_EQ(4u, opj_write_from_memory(buffer_data, 5, &dd));
- EXPECT_EQ(0x10, stream[0]);
- EXPECT_EQ(0x11, stream[1]);
- EXPECT_EQ(0x12, stream[2]);
- EXPECT_EQ(0x13, stream[3]);
- EXPECT_EQ(0xbd, stream[4]);
-
- // Subsequent writes fail.
- memset(stream, 0xbd, sizeof(stream));
- EXPECT_EQ(kWriteError, opj_write_from_memory(buffer_data, 5, &dd));
- EXPECT_EQ(0xbd, stream[0]);
- }
- {
- // Pretend the stream can only hold 4 bytes.
- DecodeData dd(stream, 4);
-
- // Write ending past EOF (two steps) transfers up til EOF.
- memset(stream, 0xbd, sizeof(stream));
- EXPECT_EQ(2u, opj_write_from_memory(buffer_data, 2, &dd));
- EXPECT_EQ(2u, opj_write_from_memory(buffer_data, 4, &dd));
- EXPECT_EQ(0x10, stream[0]);
- EXPECT_EQ(0x11, stream[1]);
- EXPECT_EQ(0x10, stream[2]);
- EXPECT_EQ(0x11, stream[3]);
- EXPECT_EQ(0xbd, stream[4]);
-
- // Subsequent writes fail.
- memset(stream, 0xbd, sizeof(stream));
- EXPECT_EQ(kWriteError, opj_write_from_memory(buffer_data, 5, &dd));
- EXPECT_EQ(0xbd, stream[0]);
- }
-}
-
// Note: Some care needs to be taken here because the skip/seek functions
// take OPJ_OFF_T's as arguments, which are typically a signed type.
TEST(fxcodec, DecodeDataSkip) {
- unsigned char buffer[16];
+ uint8_t buffer[16];
{
DecodeData dd(stream_data, sizeof(stream_data));
@@ -430,7 +340,7 @@ TEST(fxcodec, DecodeDataSkip) {
}
TEST(fxcodec, DecodeDataSeek) {
- unsigned char buffer[16];
+ uint8_t buffer[16];
DecodeData dd(stream_data, sizeof(stream_data));
// Seeking within buffer is allowed and read succeeds
diff --git a/chromium/third_party/pdfium/core/fxcodec/codec/fx_codec_progress.cpp b/chromium/third_party/pdfium/core/fxcodec/codec/fx_codec_progress.cpp
index 1f2f50c29e1..79f0bed4159 100644
--- a/chromium/third_party/pdfium/core/fxcodec/codec/fx_codec_progress.cpp
+++ b/chromium/third_party/pdfium/core/fxcodec/codec/fx_codec_progress.cpp
@@ -10,6 +10,7 @@
#include <memory>
#include "core/fxcodec/fx_codec.h"
+#include "core/fxge/dib/cfx_dibitmap.h"
#include "core/fxge/fx_dib.h"
#include "third_party/base/numerics/safe_math.h"
#include "third_party/base/ptr_util.h"
@@ -51,25 +52,23 @@ void CCodec_ProgressiveDecoder::CFXCODEC_WeightTable::Calc(int dest_len,
int src_max,
bool bInterpol) {
double scale, base;
- scale = (FX_FLOAT)src_len / (FX_FLOAT)dest_len;
+ scale = (float)src_len / (float)dest_len;
if (dest_len < 0) {
- base = (FX_FLOAT)(src_len);
+ base = (float)(src_len);
} else {
base = 0.0f;
}
m_ItemSize =
- (int)(sizeof(int) * 2 +
- sizeof(int) * (FXSYS_ceil(FXSYS_fabs((FX_FLOAT)scale)) + 1));
+ (int)(sizeof(int) * 2 + sizeof(int) * (ceil(fabs((float)scale)) + 1));
m_DestMin = dest_min;
m_pWeightTables.resize((dest_max - dest_min) * m_ItemSize + 4);
- if (FXSYS_fabs((FX_FLOAT)scale) < 1.0f) {
+ if (fabs((float)scale) < 1.0f) {
for (int dest_pixel = dest_min; dest_pixel < dest_max; dest_pixel++) {
PixelWeight& pixel_weights = *GetPixelWeight(dest_pixel);
double src_pos = dest_pixel * scale + scale / 2 + base;
if (bInterpol) {
- pixel_weights.m_SrcStart =
- (int)FXSYS_floor((FX_FLOAT)src_pos - 1.0f / 2);
- pixel_weights.m_SrcEnd = (int)FXSYS_floor((FX_FLOAT)src_pos + 1.0f / 2);
+ pixel_weights.m_SrcStart = (int)floor((float)src_pos - 1.0f / 2);
+ pixel_weights.m_SrcEnd = (int)floor((float)src_pos + 1.0f / 2);
if (pixel_weights.m_SrcStart < src_min) {
pixel_weights.m_SrcStart = src_min;
}
@@ -80,13 +79,12 @@ void CCodec_ProgressiveDecoder::CFXCODEC_WeightTable::Calc(int dest_len,
pixel_weights.m_Weights[0] = 65536;
} else {
pixel_weights.m_Weights[1] = FXSYS_round(
- (FX_FLOAT)(src_pos - pixel_weights.m_SrcStart - 1.0f / 2) *
- 65536);
+ (float)(src_pos - pixel_weights.m_SrcStart - 1.0f / 2) * 65536);
pixel_weights.m_Weights[0] = 65536 - pixel_weights.m_Weights[1];
}
} else {
pixel_weights.m_SrcStart = pixel_weights.m_SrcEnd =
- (int)FXSYS_floor((FX_FLOAT)src_pos);
+ (int)floor((float)src_pos);
pixel_weights.m_Weights[0] = 65536;
}
}
@@ -98,11 +96,11 @@ void CCodec_ProgressiveDecoder::CFXCODEC_WeightTable::Calc(int dest_len,
double src_end = src_start + scale;
int start_i, end_i;
if (src_start < src_end) {
- start_i = (int)FXSYS_floor((FX_FLOAT)src_start);
- end_i = (int)FXSYS_ceil((FX_FLOAT)src_end);
+ start_i = (int)floor((float)src_start);
+ end_i = (int)ceil((float)src_end);
} else {
- start_i = (int)FXSYS_floor((FX_FLOAT)src_end);
- end_i = (int)FXSYS_ceil((FX_FLOAT)src_start);
+ start_i = (int)floor((float)src_end);
+ end_i = (int)ceil((float)src_start);
}
if (start_i < src_min) {
start_i = src_min;
@@ -118,18 +116,17 @@ void CCodec_ProgressiveDecoder::CFXCODEC_WeightTable::Calc(int dest_len,
pixel_weights.m_SrcStart = start_i;
pixel_weights.m_SrcEnd = end_i;
for (int j = start_i; j <= end_i; j++) {
- double dest_start = ((FX_FLOAT)j - base) / scale;
- double dest_end = ((FX_FLOAT)(j + 1) - base) / scale;
+ double dest_start = ((float)j - base) / scale;
+ double dest_end = ((float)(j + 1) - base) / scale;
if (dest_start > dest_end) {
double temp = dest_start;
dest_start = dest_end;
dest_end = temp;
}
- double area_start = dest_start > (FX_FLOAT)(dest_pixel)
- ? dest_start
- : (FX_FLOAT)(dest_pixel);
- double area_end = dest_end > (FX_FLOAT)(dest_pixel + 1)
- ? (FX_FLOAT)(dest_pixel + 1)
+ double area_start =
+ dest_start > (float)(dest_pixel) ? dest_start : (float)(dest_pixel);
+ double area_end = dest_end > (float)(dest_pixel + 1)
+ ? (float)(dest_pixel + 1)
: dest_end;
double weight = area_start >= area_end ? 0.0f : area_end - area_start;
if (weight == 0 && j == end_i) {
@@ -137,7 +134,7 @@ void CCodec_ProgressiveDecoder::CFXCODEC_WeightTable::Calc(int dest_len,
break;
}
pixel_weights.m_Weights[j - start_i] =
- FXSYS_round((FX_FLOAT)(weight * 65536));
+ FXSYS_round((float)(weight * 65536));
}
}
}
@@ -157,7 +154,7 @@ void CCodec_ProgressiveDecoder::CFXCODEC_HorzTable::Calc(int dest_len,
int pre_des_col = 0;
for (int src_col = 0; src_col < src_len; src_col++) {
double des_col_f = src_col * scale;
- int des_col = FXSYS_round((FX_FLOAT)des_col_f);
+ int des_col = FXSYS_round((float)des_col_f);
PixelWeight* pWeight = GetPixelWeight(des_col);
pWeight->m_SrcStart = pWeight->m_SrcEnd = src_col;
pWeight->m_Weights[0] = 65536;
@@ -179,10 +176,10 @@ void CCodec_ProgressiveDecoder::CFXCODEC_HorzTable::Calc(int dest_len,
pWeight->m_SrcStart = src_col - 1;
pWeight->m_SrcEnd = src_col;
pWeight->m_Weights[0] =
- bInterpol ? FXSYS_round((FX_FLOAT)(
- ((FX_FLOAT)des_col - (FX_FLOAT)des_col_index) /
- (FX_FLOAT)des_col_len * 65536))
- : 65536;
+ bInterpol
+ ? FXSYS_round((float)(((float)des_col - (float)des_col_index) /
+ (float)des_col_len * 65536))
+ : 65536;
pWeight->m_Weights[1] = 65536 - pWeight->m_Weights[0];
}
pre_des_col = des_col;
@@ -191,7 +188,7 @@ void CCodec_ProgressiveDecoder::CFXCODEC_HorzTable::Calc(int dest_len,
}
for (int des_col = 0; des_col < dest_len; des_col++) {
double src_col_f = des_col / scale;
- int src_col = FXSYS_round((FX_FLOAT)src_col_f);
+ int src_col = FXSYS_round((float)src_col_f);
PixelWeight* pWeight = GetPixelWeight(des_col);
pWeight->m_SrcStart = pWeight->m_SrcEnd = src_col;
pWeight->m_Weights[0] = 65536;
@@ -249,8 +246,8 @@ void CCodec_ProgressiveDecoder::CFXCODEC_VertTable::Calc(int dest_len,
PixelWeight* pWeight = GetPixelWeight(des_row);
pWeight->m_SrcStart = start_step;
pWeight->m_SrcEnd = end_step;
- pWeight->m_Weights[0] = FXSYS_round((FX_FLOAT)(end_step - des_row) /
- (FX_FLOAT)length * 65536);
+ pWeight->m_Weights[0] =
+ FXSYS_round((float)(end_step - des_row) / (float)length * 65536);
pWeight->m_Weights[1] = 65536 - pWeight->m_Weights[0];
}
}
@@ -335,7 +332,7 @@ bool CCodec_ProgressiveDecoder::JpegReadMoreData(CCodec_JpegModule* pJpegModule,
} else {
uint32_t dwConsume = m_SrcSize - dwAvail;
if (dwAvail) {
- FXSYS_memmove(m_pSrcBuf, m_pSrcBuf + dwConsume, dwAvail);
+ memmove(m_pSrcBuf, m_pSrcBuf + dwConsume, dwAvail);
}
if (dwSize > dwConsume) {
dwSize = dwConsume;
@@ -408,7 +405,7 @@ bool CCodec_ProgressiveDecoder::PngReadHeader(int width,
}
bool CCodec_ProgressiveDecoder::PngAskScanlineBuf(int line, uint8_t*& src_buf) {
- CFX_DIBitmap* pDIBitmap = m_pDeviceBitmap;
+ CFX_RetainPtr<CFX_DIBitmap> pDIBitmap = m_pDeviceBitmap;
if (!pDIBitmap) {
ASSERT(false);
return false;
@@ -477,7 +474,7 @@ bool CCodec_ProgressiveDecoder::PngAskScanlineBuf(int line, uint8_t*& src_buf) {
}
void CCodec_ProgressiveDecoder::PngOneOneMapResampleHorz(
- CFX_DIBitmap* pDeviceBitmap,
+ const CFX_RetainPtr<CFX_DIBitmap>& pDeviceBitmap,
int32_t des_line,
uint8_t* src_scan,
FXCodec_Format src_format) {
@@ -550,7 +547,7 @@ void CCodec_ProgressiveDecoder::PngOneOneMapResampleHorz(
void CCodec_ProgressiveDecoder::PngFillScanlineBufCompleted(int pass,
int line) {
- CFX_DIBitmap* pDIBitmap = m_pDeviceBitmap;
+ CFX_RetainPtr<CFX_DIBitmap> pDIBitmap = m_pDeviceBitmap;
ASSERT(pDIBitmap);
int src_top = m_clipBox.top;
int src_bottom = m_clipBox.bottom;
@@ -597,7 +594,7 @@ bool CCodec_ProgressiveDecoder::GifReadMoreData(ICodec_GifModule* pGifModule,
} else {
uint32_t dwConsume = m_SrcSize - dwAvail;
if (dwAvail) {
- FXSYS_memmove(m_pSrcBuf, m_pSrcBuf + dwConsume, dwAvail);
+ memmove(m_pSrcBuf, m_pSrcBuf + dwConsume, dwAvail);
}
if (dwSize > dwConsume) {
dwSize = dwConsume;
@@ -662,7 +659,7 @@ bool CCodec_ProgressiveDecoder::GifInputRecordPositionBuf(
m_GifFrameRect = img_rc;
m_SrcPassNumber = interlace ? 4 : 1;
int32_t pal_index = m_GifBgIndex;
- CFX_DIBitmap* pDevice = m_pDeviceBitmap;
+ CFX_RetainPtr<CFX_DIBitmap> pDevice = m_pDeviceBitmap;
if (trans_index >= pal_num)
trans_index = -1;
if (trans_index != -1) {
@@ -686,7 +683,7 @@ bool CCodec_ProgressiveDecoder::GifInputRecordPositionBuf(
case 3: {
uint8_t gray =
FXRGB2GRAY(FXARGB_R(argb), FXARGB_G(argb), FXARGB_B(argb));
- FXSYS_memset(pScanline, gray, sizeX);
+ memset(pScanline, gray, sizeX);
break;
}
case 8: {
@@ -712,7 +709,7 @@ bool CCodec_ProgressiveDecoder::GifInputRecordPositionBuf(
void CCodec_ProgressiveDecoder::GifReadScanline(int32_t row_num,
uint8_t* row_buf) {
- CFX_DIBitmap* pDIBitmap = m_pDeviceBitmap;
+ CFX_RetainPtr<CFX_DIBitmap> pDIBitmap = m_pDeviceBitmap;
ASSERT(pDIBitmap);
int32_t img_width = m_GifFrameRect.Width();
if (!pDIBitmap->HasAlpha()) {
@@ -728,11 +725,11 @@ void CCodec_ProgressiveDecoder::GifReadScanline(int32_t row_num,
if (m_GifTransIndex != -1 && m_pDeviceBitmap->HasAlpha()) {
pal_index = m_GifTransIndex;
}
- FXSYS_memset(m_pDecodeBuf, pal_index, m_SrcWidth);
+ memset(m_pDecodeBuf, pal_index, m_SrcWidth);
bool bLastPass = (row_num % 2) == 1;
int32_t line = row_num + m_GifFrameRect.top;
int32_t left = m_GifFrameRect.left;
- FXSYS_memcpy(m_pDecodeBuf + left, row_buf, img_width);
+ memcpy(m_pDecodeBuf + left, row_buf, img_width);
int src_top = m_clipBox.top;
int src_bottom = m_clipBox.bottom;
int des_top = m_startY;
@@ -766,7 +763,7 @@ void CCodec_ProgressiveDecoder::GifReadScanline(int32_t row_num,
uint8_t* scan_des =
(uint8_t*)pDIBitmap->GetScanline(cur_row) + des_ScanOffet;
uint32_t size = m_sizeX * des_Bpp;
- FXSYS_memmove(scan_des, scan_src, size);
+ memmove(scan_des, scan_src, size);
}
}
if (bLastPass)
@@ -774,7 +771,7 @@ void CCodec_ProgressiveDecoder::GifReadScanline(int32_t row_num,
}
void CCodec_ProgressiveDecoder::GifDoubleLineResampleVert(
- CFX_DIBitmap* pDeviceBitmap,
+ const CFX_RetainPtr<CFX_DIBitmap>& pDeviceBitmap,
double scale_y,
int des_row) {
int des_Bpp = pDeviceBitmap->GetBPP() >> 3;
@@ -876,7 +873,7 @@ bool CCodec_ProgressiveDecoder::BmpReadMoreData(ICodec_BmpModule* pBmpModule,
} else {
uint32_t dwConsume = m_SrcSize - dwAvail;
if (dwAvail) {
- FXSYS_memmove(m_pSrcBuf, m_pSrcBuf + dwConsume, dwAvail);
+ memmove(m_pSrcBuf, m_pSrcBuf + dwConsume, dwAvail);
}
if (dwSize > dwConsume) {
dwSize = dwConsume;
@@ -899,9 +896,9 @@ bool CCodec_ProgressiveDecoder::BmpInputImagePositionBuf(uint32_t rcd_pos) {
void CCodec_ProgressiveDecoder::BmpReadScanline(int32_t row_num,
uint8_t* row_buf) {
- CFX_DIBitmap* pDIBitmap = m_pDeviceBitmap;
+ CFX_RetainPtr<CFX_DIBitmap> pDIBitmap = m_pDeviceBitmap;
ASSERT(pDIBitmap);
- FXSYS_memcpy(m_pDecodeBuf, row_buf, m_ScanlineSize);
+ memcpy(m_pDecodeBuf, row_buf, m_ScanlineSize);
int src_top = m_clipBox.top;
int src_bottom = m_clipBox.bottom;
int des_top = m_startY;
@@ -927,9 +924,10 @@ void CCodec_ProgressiveDecoder::BmpReadScanline(int32_t row_num,
ResampleVertBT(pDIBitmap, scale_y, des_row);
}
-void CCodec_ProgressiveDecoder::ResampleVertBT(CFX_DIBitmap* pDeviceBitmap,
- double scale_y,
- int des_row) {
+void CCodec_ProgressiveDecoder::ResampleVertBT(
+ const CFX_RetainPtr<CFX_DIBitmap>& pDeviceBitmap,
+ double scale_y,
+ int des_row) {
int des_Bpp = pDeviceBitmap->GetBPP() >> 3;
uint32_t des_ScanOffet = m_startX * des_Bpp;
int des_top = m_startY;
@@ -944,7 +942,7 @@ void CCodec_ProgressiveDecoder::ResampleVertBT(CFX_DIBitmap* pDeviceBitmap,
uint8_t* scan_des =
(uint8_t*)pDeviceBitmap->GetScanline(des_row) + des_ScanOffet;
uint32_t size = m_sizeX * des_Bpp;
- FXSYS_memmove(scan_des, scan_src, size);
+ memmove(scan_des, scan_src, size);
}
return;
}
@@ -1020,7 +1018,7 @@ bool CCodec_ProgressiveDecoder::DetectImageType(FXCODEC_IMAGE_TYPE imageType,
}
FX_Free(m_pSrcBuf);
m_pSrcBuf = FX_Alloc(uint8_t, size);
- FXSYS_memset(m_pSrcBuf, 0, size);
+ memset(m_pSrcBuf, 0, size);
m_SrcSize = size;
switch (imageType) {
case FXCODEC_IMAGE_BMP: {
@@ -1062,8 +1060,8 @@ bool CCodec_ProgressiveDecoder::DetectImageType(FXCODEC_IMAGE_TYPE imageType,
FX_Free(m_pSrcPalette);
if (m_SrcPaletteNumber) {
m_pSrcPalette = FX_Alloc(FX_ARGB, m_SrcPaletteNumber);
- FXSYS_memcpy(m_pSrcPalette, pPalette,
- m_SrcPaletteNumber * sizeof(uint32_t));
+ memcpy(m_pSrcPalette, pPalette,
+ m_SrcPaletteNumber * sizeof(uint32_t));
} else {
m_pSrcPalette = nullptr;
}
@@ -1153,7 +1151,7 @@ bool CCodec_ProgressiveDecoder::DetectImageType(FXCODEC_IMAGE_TYPE imageType,
if (m_pSrcBuf && input_size > m_SrcSize) {
FX_Free(m_pSrcBuf);
m_pSrcBuf = FX_Alloc(uint8_t, input_size);
- FXSYS_memset(m_pSrcBuf, 0, input_size);
+ memset(m_pSrcBuf, 0, input_size);
m_SrcSize = input_size;
}
bResult = m_pFile->ReadBlock(m_pSrcBuf, m_offSet, input_size);
@@ -1444,10 +1442,11 @@ void CCodec_ProgressiveDecoder::GetTransMethod(FXDIB_Format des_format,
}
}
-void CCodec_ProgressiveDecoder::ReSampleScanline(CFX_DIBitmap* pDeviceBitmap,
- int des_line,
- uint8_t* src_scan,
- FXCodec_Format src_format) {
+void CCodec_ProgressiveDecoder::ReSampleScanline(
+ const CFX_RetainPtr<CFX_DIBitmap>& pDeviceBitmap,
+ int des_line,
+ uint8_t* src_scan,
+ FXCodec_Format src_format) {
int src_left = m_clipBox.left;
int des_left = m_startX;
uint8_t* des_scan =
@@ -1533,7 +1532,7 @@ void CCodec_ProgressiveDecoder::ReSampleScanline(CFX_DIBitmap* pDeviceBitmap,
pPixelWeights->m_Weights[j - pPixelWeights->m_SrcStart];
des_g += pixel_weight * src_scan[j];
}
- FXSYS_memset(des_scan, (uint8_t)(des_g >> 16), 3);
+ memset(des_scan, (uint8_t)(des_g >> 16), 3);
des_scan += des_Bpp;
} break;
case 8: {
@@ -1646,9 +1645,10 @@ void CCodec_ProgressiveDecoder::ReSampleScanline(CFX_DIBitmap* pDeviceBitmap,
}
}
-void CCodec_ProgressiveDecoder::ResampleVert(CFX_DIBitmap* pDeviceBitmap,
- double scale_y,
- int des_row) {
+void CCodec_ProgressiveDecoder::ResampleVert(
+ const CFX_RetainPtr<CFX_DIBitmap>& pDeviceBitmap,
+ double scale_y,
+ int des_row) {
int des_Bpp = pDeviceBitmap->GetBPP() >> 3;
uint32_t des_ScanOffet = m_startX * des_Bpp;
if (m_bInterpol) {
@@ -1665,7 +1665,7 @@ void CCodec_ProgressiveDecoder::ResampleVert(CFX_DIBitmap* pDeviceBitmap,
uint8_t* scan_des =
(uint8_t*)pDeviceBitmap->GetScanline(des_row) + des_ScanOffet;
uint32_t size = m_sizeX * des_Bpp;
- FXSYS_memmove(scan_des, scan_src, size);
+ memmove(scan_des, scan_src, size);
}
}
return;
@@ -1740,12 +1740,12 @@ void CCodec_ProgressiveDecoder::ResampleVert(CFX_DIBitmap* pDeviceBitmap,
uint8_t* scan_des =
(uint8_t*)pDeviceBitmap->GetScanline(des_row) + des_ScanOffet;
uint32_t size = m_sizeX * des_Bpp;
- FXSYS_memmove(scan_des, scan_src, size);
+ memmove(scan_des, scan_src, size);
}
}
return;
}
- int multiple = (int)FXSYS_ceil((FX_FLOAT)scale_y - 1);
+ int multiple = (int)ceil((float)scale_y - 1);
if (multiple > 0) {
uint8_t* scan_src =
(uint8_t*)pDeviceBitmap->GetScanline(des_row) + des_ScanOffet;
@@ -1756,15 +1756,16 @@ void CCodec_ProgressiveDecoder::ResampleVert(CFX_DIBitmap* pDeviceBitmap,
uint8_t* scan_des =
(uint8_t*)pDeviceBitmap->GetScanline(des_row + i) + des_ScanOffet;
uint32_t size = m_sizeX * des_Bpp;
- FXSYS_memmove(scan_des, scan_src, size);
+ memmove(scan_des, scan_src, size);
}
}
}
-void CCodec_ProgressiveDecoder::Resample(CFX_DIBitmap* pDeviceBitmap,
- int32_t src_line,
- uint8_t* src_scan,
- FXCodec_Format src_format) {
+void CCodec_ProgressiveDecoder::Resample(
+ const CFX_RetainPtr<CFX_DIBitmap>& pDeviceBitmap,
+ int32_t src_line,
+ uint8_t* src_scan,
+ FXCodec_Format src_format) {
int src_top = m_clipBox.top;
int des_top = m_startY;
int src_hei = m_clipBox.Height();
@@ -1835,13 +1836,14 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::GetFrames(int32_t& frames,
}
}
-FXCODEC_STATUS CCodec_ProgressiveDecoder::StartDecode(CFX_DIBitmap* pDIBitmap,
- int start_x,
- int start_y,
- int size_x,
- int size_y,
- int32_t frames,
- bool bInterpol) {
+FXCODEC_STATUS CCodec_ProgressiveDecoder::StartDecode(
+ const CFX_RetainPtr<CFX_DIBitmap>& pDIBitmap,
+ int start_x,
+ int start_y,
+ int size_x,
+ int size_y,
+ int32_t frames,
+ bool bInterpol) {
if (m_status != FXCODEC_STATUS_DECODE_READY)
return FXCODEC_STATUS_ERROR;
@@ -1871,21 +1873,21 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::StartDecode(CFX_DIBitmap* pDIBitmap,
m_bInterpol = bInterpol;
m_FrameCur = 0;
if (start_x < 0 || out_range_x > 0) {
- FX_FLOAT scaleX = (FX_FLOAT)m_clipBox.Width() / (FX_FLOAT)size_x;
+ float scaleX = (float)m_clipBox.Width() / (float)size_x;
if (start_x < 0) {
- m_clipBox.left -= (int32_t)FXSYS_ceil((FX_FLOAT)start_x * scaleX);
+ m_clipBox.left -= (int32_t)ceil((float)start_x * scaleX);
}
if (out_range_x > 0) {
- m_clipBox.right -= (int32_t)FXSYS_floor((FX_FLOAT)out_range_x * scaleX);
+ m_clipBox.right -= (int32_t)floor((float)out_range_x * scaleX);
}
}
if (start_y < 0 || out_range_y > 0) {
- FX_FLOAT scaleY = (FX_FLOAT)m_clipBox.Height() / (FX_FLOAT)size_y;
+ float scaleY = (float)m_clipBox.Height() / (float)size_y;
if (start_y < 0) {
- m_clipBox.top -= (int32_t)FXSYS_ceil((FX_FLOAT)start_y * scaleY);
+ m_clipBox.top -= (int32_t)ceil((float)start_y * scaleY);
}
if (out_range_y > 0) {
- m_clipBox.bottom -= (int32_t)FXSYS_floor((FX_FLOAT)out_range_y * scaleY);
+ m_clipBox.bottom -= (int32_t)floor((float)out_range_y * scaleY);
}
}
if (m_clipBox.IsEmpty()) {
@@ -1911,7 +1913,7 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::StartDecode(CFX_DIBitmap* pDIBitmap,
scanline_size = (scanline_size * m_SrcComponents + 3) / 4 * 4;
FX_Free(m_pDecodeBuf);
m_pDecodeBuf = FX_Alloc(uint8_t, scanline_size);
- FXSYS_memset(m_pDecodeBuf, 0, scanline_size);
+ memset(m_pDecodeBuf, 0, scanline_size);
m_WeightHorz.Calc(m_sizeX, 0, m_sizeX, m_clipBox.Width(), 0,
m_clipBox.Width(), m_bInterpol);
m_WeightVert.Calc(m_sizeY, m_clipBox.Height());
@@ -1976,7 +1978,7 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::StartDecode(CFX_DIBitmap* pDIBitmap,
int scanline_size = (m_SrcWidth * m_SrcComponents + 3) / 4 * 4;
FX_Free(m_pDecodeBuf);
m_pDecodeBuf = FX_Alloc(uint8_t, scanline_size);
- FXSYS_memset(m_pDecodeBuf, 0, scanline_size);
+ memset(m_pDecodeBuf, 0, scanline_size);
m_WeightHorzOO.Calc(m_sizeX, m_clipBox.Width(), m_bInterpol);
m_WeightVert.Calc(m_sizeY, m_clipBox.Height());
m_status = FXCODEC_STATUS_DECODE_TOBECONTINUE;
@@ -1995,7 +1997,7 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::StartDecode(CFX_DIBitmap* pDIBitmap,
int scanline_size = (m_SrcWidth + 3) / 4 * 4;
FX_Free(m_pDecodeBuf);
m_pDecodeBuf = FX_Alloc(uint8_t, scanline_size);
- FXSYS_memset(m_pDecodeBuf, 0, scanline_size);
+ memset(m_pDecodeBuf, 0, scanline_size);
m_WeightHorz.Calc(m_sizeX, 0, m_sizeX, m_clipBox.Width(), 0,
m_clipBox.Width(), m_bInterpol);
m_WeightVert.Calc(m_sizeY, m_clipBox.Height());
@@ -2026,7 +2028,7 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::StartDecode(CFX_DIBitmap* pDIBitmap,
m_ScanlineSize = (m_SrcWidth * m_SrcComponents + 3) / 4 * 4;
FX_Free(m_pDecodeBuf);
m_pDecodeBuf = FX_Alloc(uint8_t, m_ScanlineSize);
- FXSYS_memset(m_pDecodeBuf, 0, m_ScanlineSize);
+ memset(m_pDecodeBuf, 0, m_ScanlineSize);
m_WeightHorz.Calc(m_sizeX, 0, m_sizeX, m_clipBox.Width(), 0,
m_clipBox.Width(), m_bInterpol);
m_WeightVert.Calc(m_sizeY, m_clipBox.Height());
@@ -2101,7 +2103,7 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::ContinueDecode(IFX_Pause* pPause) {
if (m_pSrcBuf && input_size > m_SrcSize) {
FX_Free(m_pSrcBuf);
m_pSrcBuf = FX_Alloc(uint8_t, input_size);
- FXSYS_memset(m_pSrcBuf, 0, input_size);
+ memset(m_pSrcBuf, 0, input_size);
m_SrcSize = input_size;
}
bool bResult = m_pFile->ReadBlock(m_pSrcBuf, m_offSet, input_size);
@@ -2219,10 +2221,9 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::ContinueDecode(IFX_Pause* pPause) {
return m_status;
}
- CFX_DIBitmap* pDIBitmap = new CFX_DIBitmap;
+ auto pDIBitmap = pdfium::MakeRetain<CFX_DIBitmap>();
pDIBitmap->Create(m_SrcWidth, m_SrcHeight, FXDIB_Argb);
if (!pDIBitmap->GetBuffer()) {
- delete pDIBitmap;
m_pDeviceBitmap = nullptr;
m_pFile = nullptr;
m_status = FXCODEC_STATUS_ERR_MEMORY;
@@ -2230,45 +2231,41 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::ContinueDecode(IFX_Pause* pPause) {
}
ret = pTiffModule->Decode(m_pTiffContext, pDIBitmap);
if (!ret) {
- delete pDIBitmap;
m_pDeviceBitmap = nullptr;
m_pFile = nullptr;
m_status = FXCODEC_STATUS_ERROR;
return m_status;
}
- CFX_DIBitmap* pClipBitmap =
+ CFX_RetainPtr<CFX_DIBitmap> pClipBitmap =
(m_clipBox.left == 0 && m_clipBox.top == 0 &&
m_clipBox.right == m_SrcWidth && m_clipBox.bottom == m_SrcHeight)
? pDIBitmap
- : pDIBitmap->Clone(&m_clipBox).release();
- if (pDIBitmap != pClipBitmap) {
- delete pDIBitmap;
- }
+ : pDIBitmap->Clone(&m_clipBox);
if (!pClipBitmap) {
m_pDeviceBitmap = nullptr;
m_pFile = nullptr;
m_status = FXCODEC_STATUS_ERR_MEMORY;
return m_status;
}
- CFX_DIBitmap* pFormatBitmap = nullptr;
+ CFX_RetainPtr<CFX_DIBitmap> pFormatBitmap;
switch (m_pDeviceBitmap->GetFormat()) {
case FXDIB_8bppRgb:
- pFormatBitmap = new CFX_DIBitmap;
+ pFormatBitmap = pdfium::MakeRetain<CFX_DIBitmap>();
pFormatBitmap->Create(pClipBitmap->GetWidth(),
pClipBitmap->GetHeight(), FXDIB_8bppRgb);
break;
case FXDIB_8bppMask:
- pFormatBitmap = new CFX_DIBitmap;
+ pFormatBitmap = pdfium::MakeRetain<CFX_DIBitmap>();
pFormatBitmap->Create(pClipBitmap->GetWidth(),
pClipBitmap->GetHeight(), FXDIB_8bppMask);
break;
case FXDIB_Rgb:
- pFormatBitmap = new CFX_DIBitmap;
+ pFormatBitmap = pdfium::MakeRetain<CFX_DIBitmap>();
pFormatBitmap->Create(pClipBitmap->GetWidth(),
pClipBitmap->GetHeight(), FXDIB_Rgb);
break;
case FXDIB_Rgb32:
- pFormatBitmap = new CFX_DIBitmap;
+ pFormatBitmap = pdfium::MakeRetain<CFX_DIBitmap>();
pFormatBitmap->Create(pClipBitmap->GetWidth(),
pClipBitmap->GetHeight(), FXDIB_Rgb32);
break;
@@ -2316,18 +2313,14 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::ContinueDecode(IFX_Pause* pPause) {
default:
break;
}
- if (pClipBitmap != pFormatBitmap) {
- delete pClipBitmap;
- }
if (!pFormatBitmap) {
m_pDeviceBitmap = nullptr;
m_pFile = nullptr;
m_status = FXCODEC_STATUS_ERR_MEMORY;
return m_status;
}
- std::unique_ptr<CFX_DIBitmap> pStrechBitmap = pFormatBitmap->StretchTo(
+ CFX_RetainPtr<CFX_DIBitmap> pStrechBitmap = pFormatBitmap->StretchTo(
m_sizeX, m_sizeY, m_bInterpol ? FXDIB_INTERPOL : FXDIB_DOWNSAMPLE);
- delete pFormatBitmap;
pFormatBitmap = nullptr;
if (!pStrechBitmap) {
m_pDeviceBitmap = nullptr;
@@ -2336,7 +2329,7 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::ContinueDecode(IFX_Pause* pPause) {
return m_status;
}
m_pDeviceBitmap->TransferBitmap(m_startX, m_startY, m_sizeX, m_sizeY,
- pStrechBitmap.get(), 0, 0);
+ pStrechBitmap, 0, 0);
m_pDeviceBitmap = nullptr;
m_pFile = nullptr;
m_status = FXCODEC_STATUS_DECODE_FINISH;
diff --git a/chromium/third_party/pdfium/core/fxcodec/codec/icodec_tiffmodule.h b/chromium/third_party/pdfium/core/fxcodec/codec/icodec_tiffmodule.h
index 540d82ff639..49abd1865f6 100644
--- a/chromium/third_party/pdfium/core/fxcodec/codec/icodec_tiffmodule.h
+++ b/chromium/third_party/pdfium/core/fxcodec/codec/icodec_tiffmodule.h
@@ -29,7 +29,7 @@ class ICodec_TiffModule {
int32_t* bpc,
CFX_DIBAttribute* pAttribute) = 0;
virtual bool Decode(CCodec_TiffContext* ctx,
- class CFX_DIBitmap* pDIBitmap) = 0;
+ const CFX_RetainPtr<CFX_DIBitmap>& pDIBitmap) = 0;
virtual void DestroyDecoder(CCodec_TiffContext* ctx) = 0;
};
diff --git a/chromium/third_party/pdfium/core/fxcodec/fx_codec.h b/chromium/third_party/pdfium/core/fxcodec/fx_codec.h
index b0b9fa1821e..fa4956c0958 100644
--- a/chromium/third_party/pdfium/core/fxcodec/fx_codec.h
+++ b/chromium/third_party/pdfium/core/fxcodec/fx_codec.h
@@ -46,7 +46,7 @@ class CFX_DIBAttribute {
int32_t m_nXDPI;
int32_t m_nYDPI;
- FX_FLOAT m_fAspectRatio;
+ float m_fAspectRatio;
uint16_t m_wDPIUnit;
CFX_ByteString m_strAuthor;
uint8_t m_strTime[20];
@@ -112,20 +112,20 @@ class CCodec_ModuleMgr {
void ReverseRGB(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels);
uint32_t ComponentsForFamily(int family);
-void sRGB_to_AdobeCMYK(FX_FLOAT R,
- FX_FLOAT G,
- FX_FLOAT B,
- FX_FLOAT& c,
- FX_FLOAT& m,
- FX_FLOAT& y,
- FX_FLOAT& k);
-void AdobeCMYK_to_sRGB(FX_FLOAT c,
- FX_FLOAT m,
- FX_FLOAT y,
- FX_FLOAT k,
- FX_FLOAT& R,
- FX_FLOAT& G,
- FX_FLOAT& B);
+void sRGB_to_AdobeCMYK(float R,
+ float G,
+ float B,
+ float& c,
+ float& m,
+ float& y,
+ float& k);
+void AdobeCMYK_to_sRGB(float c,
+ float m,
+ float y,
+ float k,
+ float& R,
+ float& G,
+ float& B);
void AdobeCMYK_to_sRGB1(uint8_t c,
uint8_t m,
uint8_t y,
diff --git a/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_ArithDecoder.cpp b/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_ArithDecoder.cpp
index 0d45f57bdfb..78c7939458c 100644
--- a/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_ArithDecoder.cpp
+++ b/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_ArithDecoder.cpp
@@ -56,7 +56,7 @@ int DecodeNLPS(JBig2ArithCtx* pCX, const JBig2ArithQe& qe) {
} // namespace
CJBig2_ArithDecoder::CJBig2_ArithDecoder(CJBig2_BitStream* pStream)
- : m_pStream(pStream) {
+ : m_Complete(false), m_pStream(pStream) {
m_B = m_pStream->getCurByte_arith();
m_C = (m_B ^ 0xff) << 16;
BYTEIN();
@@ -107,6 +107,9 @@ void CJBig2_ArithDecoder::BYTEIN() {
m_C = m_C + 0xff00 - (m_B << 8);
m_CT = 8;
}
+
+ if (!m_pStream->IsInBounds())
+ m_Complete = true;
}
void CJBig2_ArithDecoder::ReadValueA() {
diff --git a/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_ArithDecoder.h b/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_ArithDecoder.h
index a8ab5dd7309..24fb80cfbd2 100644
--- a/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_ArithDecoder.h
+++ b/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_ArithDecoder.h
@@ -7,6 +7,8 @@
#ifndef CORE_FXCODEC_JBIG2_JBIG2_ARITHDECODER_H_
#define CORE_FXCODEC_JBIG2_JBIG2_ARITHDECODER_H_
+#include <stdint.h>
+
class CJBig2_BitStream;
struct JBig2ArithCtx {
@@ -24,11 +26,14 @@ class CJBig2_ArithDecoder {
int DECODE(JBig2ArithCtx* pCX);
+ bool IsComplete() const { return m_Complete; }
+
private:
void BYTEIN();
void ReadValueA();
- unsigned char m_B;
+ bool m_Complete;
+ uint8_t m_B;
unsigned int m_C;
unsigned int m_A;
unsigned int m_CT;
diff --git a/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_BitStream.cpp b/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_BitStream.cpp
index dc4beabc4b8..921fa2a6610 100644
--- a/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_BitStream.cpp
+++ b/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_BitStream.cpp
@@ -11,7 +11,8 @@
#include "core/fpdfapi/parser/cpdf_stream.h"
#include "core/fpdfapi/parser/cpdf_stream_acc.h"
-CJBig2_BitStream::CJBig2_BitStream(CPDF_StreamAcc* pSrcStream)
+CJBig2_BitStream::CJBig2_BitStream(
+ const CFX_RetainPtr<CPDF_StreamAcc>& pSrcStream)
: m_pBuf(pSrcStream->GetData()),
m_dwLength(pSrcStream->GetSize()),
m_dwByteIdx(0),
@@ -27,6 +28,9 @@ CJBig2_BitStream::CJBig2_BitStream(CPDF_StreamAcc* pSrcStream)
CJBig2_BitStream::~CJBig2_BitStream() {}
int32_t CJBig2_BitStream::readNBits(uint32_t dwBits, uint32_t* dwResult) {
+ if (!IsInBounds())
+ return -1;
+
uint32_t dwBitPos = getBitPos();
if (dwBitPos > LengthInBits())
return -1;
@@ -46,6 +50,9 @@ int32_t CJBig2_BitStream::readNBits(uint32_t dwBits, uint32_t* dwResult) {
}
int32_t CJBig2_BitStream::readNBits(uint32_t dwBits, int32_t* nResult) {
+ if (!IsInBounds())
+ return -1;
+
uint32_t dwBitPos = getBitPos();
if (dwBitPos > LengthInBits())
return -1;
@@ -65,7 +72,7 @@ int32_t CJBig2_BitStream::readNBits(uint32_t dwBits, int32_t* nResult) {
}
int32_t CJBig2_BitStream::read1Bit(uint32_t* dwResult) {
- if (!IsInBound())
+ if (!IsInBounds())
return -1;
*dwResult = (m_pBuf[m_dwByteIdx] >> (7 - m_dwBitIdx)) & 0x01;
@@ -74,7 +81,7 @@ int32_t CJBig2_BitStream::read1Bit(uint32_t* dwResult) {
}
int32_t CJBig2_BitStream::read1Bit(bool* bResult) {
- if (!IsInBound())
+ if (!IsInBounds())
return -1;
*bResult = (m_pBuf[m_dwByteIdx] >> (7 - m_dwBitIdx)) & 0x01;
@@ -83,7 +90,7 @@ int32_t CJBig2_BitStream::read1Bit(bool* bResult) {
}
int32_t CJBig2_BitStream::read1Byte(uint8_t* cResult) {
- if (!IsInBound())
+ if (!IsInBounds())
return -1;
*cResult = m_pBuf[m_dwByteIdx];
@@ -118,16 +125,16 @@ void CJBig2_BitStream::alignByte() {
}
uint8_t CJBig2_BitStream::getCurByte() const {
- return IsInBound() ? m_pBuf[m_dwByteIdx] : 0;
+ return IsInBounds() ? m_pBuf[m_dwByteIdx] : 0;
}
void CJBig2_BitStream::incByteIdx() {
- if (IsInBound())
+ if (IsInBounds())
++m_dwByteIdx;
}
uint8_t CJBig2_BitStream::getCurByte_arith() const {
- return IsInBound() ? m_pBuf[m_dwByteIdx] : 0xFF;
+ return IsInBounds() ? m_pBuf[m_dwByteIdx] : 0xFF;
}
uint8_t CJBig2_BitStream::getNextByte_arith() const {
@@ -176,7 +183,7 @@ void CJBig2_BitStream::AdvanceBit() {
}
}
-bool CJBig2_BitStream::IsInBound() const {
+bool CJBig2_BitStream::IsInBounds() const {
return m_dwByteIdx < m_dwLength;
}
diff --git a/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_BitStream.h b/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_BitStream.h
index aeb2eba693c..7517eb0c6cd 100644
--- a/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_BitStream.h
+++ b/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_BitStream.h
@@ -7,13 +7,14 @@
#ifndef CORE_FXCODEC_JBIG2_JBIG2_BITSTREAM_H_
#define CORE_FXCODEC_JBIG2_JBIG2_BITSTREAM_H_
+#include "core/fxcrt/cfx_retain_ptr.h"
#include "core/fxcrt/fx_basic.h"
class CPDF_StreamAcc;
class CJBig2_BitStream {
public:
- explicit CJBig2_BitStream(CPDF_StreamAcc* pSrcStream);
+ explicit CJBig2_BitStream(const CFX_RetainPtr<CPDF_StreamAcc>& pSrcStream);
~CJBig2_BitStream();
// TODO(thestig): readFoo() should return bool.
@@ -40,9 +41,10 @@ class CJBig2_BitStream {
uint32_t getByteLeft() const;
uint32_t getObjNum() const;
+ bool IsInBounds() const;
+
private:
void AdvanceBit();
- bool IsInBound() const;
uint32_t LengthInBits() const;
const uint8_t* m_pBuf;
diff --git a/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_BitStream_unittest.cpp b/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_BitStream_unittest.cpp
new file mode 100644
index 00000000000..7b91eff982c
--- /dev/null
+++ b/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_BitStream_unittest.cpp
@@ -0,0 +1,119 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "core/fxcodec/jbig2/JBig2_BitStream.h"
+
+#include <memory>
+#include <utility>
+
+#include "core/fpdfapi/parser/cpdf_stream_acc.h"
+#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/base/ptr_util.h"
+
+TEST(JBig2_BitStream, ReadNBits) {
+ std::unique_ptr<uint8_t, FxFreeDeleter> data(FX_Alloc(uint8_t, 1));
+ data.get()[0] = 0xb1; // 10110001
+
+ auto in_stream = pdfium::MakeUnique<CPDF_Stream>(std::move(data), 1, nullptr);
+ auto acc = pdfium::MakeRetain<CPDF_StreamAcc>(in_stream.get());
+ acc->LoadAllData();
+
+ CJBig2_BitStream stream(acc);
+
+ uint32_t val1;
+ EXPECT_EQ(0, stream.readNBits(1, &val1));
+ EXPECT_EQ(1U, val1);
+
+ int32_t val2;
+ EXPECT_EQ(0, stream.readNBits(1, &val2));
+ EXPECT_EQ(0, val2);
+
+ EXPECT_EQ(0, stream.readNBits(2, &val2));
+ EXPECT_EQ(3, val2);
+
+ EXPECT_EQ(0, stream.readNBits(4, &val2));
+ EXPECT_EQ(1, val2);
+}
+
+TEST(JBig2_BitStream, ReadNBitsLargerThenData) {
+ std::unique_ptr<uint8_t, FxFreeDeleter> data(FX_Alloc(uint8_t, 1));
+ data.get()[0] = 0xb1;
+
+ auto in_stream = pdfium::MakeUnique<CPDF_Stream>(std::move(data), 1, nullptr);
+ auto acc = pdfium::MakeRetain<CPDF_StreamAcc>(in_stream.get());
+ acc->LoadAllData();
+
+ CJBig2_BitStream stream(acc);
+
+ uint32_t val1;
+ EXPECT_EQ(0, stream.readNBits(10, &val1));
+ EXPECT_EQ(0xb1U, val1);
+}
+
+TEST(JBig2_BitStream, ReadNBitsNullStream) {
+ auto in_stream = pdfium::MakeUnique<CPDF_Stream>(nullptr, 0, nullptr);
+ auto acc = pdfium::MakeRetain<CPDF_StreamAcc>(in_stream.get());
+ acc->LoadAllData();
+
+ CJBig2_BitStream stream(acc);
+
+ uint32_t val1;
+ EXPECT_EQ(-1, stream.readNBits(1, &val1));
+
+ int32_t val2;
+ EXPECT_EQ(-1, stream.readNBits(2, &val2));
+}
+
+TEST(JBig2_BitStream, ReadNBitsEmptyStream) {
+ std::unique_ptr<uint8_t, FxFreeDeleter> data(FX_Alloc(uint8_t, 1));
+
+ auto in_stream = pdfium::MakeUnique<CPDF_Stream>(std::move(data), 0, nullptr);
+ auto acc = pdfium::MakeRetain<CPDF_StreamAcc>(in_stream.get());
+ acc->LoadAllData();
+
+ CJBig2_BitStream stream(acc);
+
+ uint32_t val1;
+ EXPECT_EQ(-1, stream.readNBits(1, &val1));
+
+ int32_t val2;
+ EXPECT_EQ(-1, stream.readNBits(2, &val2));
+}
+
+TEST(JBig2_BitStream, ReadNBitsOutOfBounds) {
+ std::unique_ptr<uint8_t, FxFreeDeleter> data(FX_Alloc(uint8_t, 1));
+ data.get()[0] = 0xb1; // 10110001
+
+ auto in_stream = pdfium::MakeUnique<CPDF_Stream>(std::move(data), 1, nullptr);
+ auto acc = pdfium::MakeRetain<CPDF_StreamAcc>(in_stream.get());
+ acc->LoadAllData();
+
+ CJBig2_BitStream stream(acc);
+
+ uint32_t val1;
+ EXPECT_EQ(0, stream.readNBits(8, &val1));
+
+ int32_t val2;
+ EXPECT_EQ(-1, stream.readNBits(2, &val2));
+}
+
+TEST(JBig2_BitStream, ReadNBitsWhereNIs36) {
+ std::unique_ptr<uint8_t, FxFreeDeleter> data(FX_Alloc(uint8_t, 5));
+ data.get()[0] = 0xb0;
+ data.get()[1] = 0x01;
+ data.get()[2] = 0x00;
+ data.get()[3] = 0x00;
+ data.get()[4] = 0x40;
+
+ auto in_stream = pdfium::MakeUnique<CPDF_Stream>(std::move(data), 5, nullptr);
+ auto acc = pdfium::MakeRetain<CPDF_StreamAcc>(in_stream.get());
+ acc->LoadAllData();
+
+ CJBig2_BitStream stream(acc);
+
+ // This will shift off the top two bits and they end up lost.
+ uint32_t val1;
+ EXPECT_EQ(0, stream.readNBits(34, &val1));
+ EXPECT_EQ(0xc0040001U, val1);
+}
diff --git a/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_Context.cpp b/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_Context.cpp
index 109013204e1..116abb77540 100644
--- a/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_Context.cpp
+++ b/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_Context.cpp
@@ -46,11 +46,12 @@ size_t GetRefAggContextSize(bool val) {
// difference for typical JBIG2 documents.
static const int kSymbolDictCacheMaxSize = 2;
-CJBig2_Context::CJBig2_Context(CPDF_StreamAcc* pGlobalStream,
- CPDF_StreamAcc* pSrcStream,
- std::list<CJBig2_CachePair>* pSymbolDictCache,
- IFX_Pause* pPause,
- bool bIsGlobal)
+CJBig2_Context::CJBig2_Context(
+ const CFX_RetainPtr<CPDF_StreamAcc>& pGlobalStream,
+ const CFX_RetainPtr<CPDF_StreamAcc>& pSrcStream,
+ std::list<CJBig2_CachePair>* pSymbolDictCache,
+ IFX_Pause* pPause,
+ bool bIsGlobal)
: m_nSegmentDecoded(0),
m_bInPage(false),
m_bBufSpecified(false),
@@ -122,7 +123,7 @@ int32_t CJBig2_Context::decode_EmbedOrgnazation(IFX_Pause* pPause) {
int32_t CJBig2_Context::decode_RandomOrgnazation_FirstPage(IFX_Pause* pPause) {
int32_t nRet;
while (m_pStream->getByteLeft() > JBIG2_MIN_SEGMENT_SIZE) {
- std::unique_ptr<CJBig2_Segment> pSegment(new CJBig2_Segment);
+ auto pSegment = pdfium::MakeUnique<CJBig2_Segment>();
nRet = parseSegmentHeader(pSegment.get());
if (nRet != JBIG2_SUCCESS) {
return nRet;
@@ -364,7 +365,7 @@ int32_t CJBig2_Context::ProcessingParseSegmentData(CJBig2_Segment* pSegment,
return parseGenericRefinementRegion(pSegment);
case 48: {
uint16_t wTemp;
- std::unique_ptr<JBig2PageInfo> pPageInfo(new JBig2PageInfo);
+ auto pPageInfo = pdfium::MakeUnique<JBig2PageInfo>();
if (m_pStream->readInteger(&pPageInfo->m_dwWidth) != 0 ||
m_pStream->readInteger(&pPageInfo->m_dwHeight) != 0 ||
m_pStream->readInteger(&pPageInfo->m_dwResolutionX) != 0 ||
@@ -424,7 +425,7 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment* pSegment,
if (m_pStream->readShortInteger(&wFlags) != 0)
return JBIG2_ERROR_TOO_SHORT;
- std::unique_ptr<CJBig2_SDDProc> pSymbolDictDecoder(new CJBig2_SDDProc);
+ auto pSymbolDictDecoder = pdfium::MakeUnique<CJBig2_SDDProc>();
pSymbolDictDecoder->SDHUFF = wFlags & 0x0001;
pSymbolDictDecoder->SDREFAGG = (wFlags >> 1) & 0x0001;
pSymbolDictDecoder->SDTEMPLATE = (wFlags >> 10) & 0x0003;
@@ -600,8 +601,8 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment* pSegment,
}
if (!cache_hit) {
if (bUseGbContext) {
- std::unique_ptr<CJBig2_ArithDecoder> pArithDecoder(
- new CJBig2_ArithDecoder(m_pStream.get()));
+ auto pArithDecoder =
+ pdfium::MakeUnique<CJBig2_ArithDecoder>(m_pStream.get());
pSegment->m_Result.sd = pSymbolDictDecoder->decode_Arith(
pArithDecoder.get(), &gbContext, &grContext);
if (!pSegment->m_Result.sd)
@@ -644,7 +645,7 @@ int32_t CJBig2_Context::parseTextRegion(CJBig2_Segment* pSegment) {
return JBIG2_ERROR_TOO_SHORT;
}
- std::unique_ptr<CJBig2_TRDProc> pTRD(new CJBig2_TRDProc);
+ auto pTRD = pdfium::MakeUnique<CJBig2_TRDProc>();
pTRD->SBW = ri.width;
pTRD->SBH = ri.height;
pTRD->SBHUFF = wFlags & 0x0001;
@@ -902,8 +903,8 @@ int32_t CJBig2_Context::parseTextRegion(CJBig2_Segment* pSegment) {
JBIG2_memset(grContext.get(), 0, sizeof(JBig2ArithCtx) * size);
}
if (pTRD->SBHUFF == 0) {
- std::unique_ptr<CJBig2_ArithDecoder> pArithDecoder(
- new CJBig2_ArithDecoder(m_pStream.get()));
+ auto pArithDecoder =
+ pdfium::MakeUnique<CJBig2_ArithDecoder>(m_pStream.get());
pSegment->m_nResultType = JBIG2_IMAGE_POINTER;
pSegment->m_Result.im =
pTRD->decode_Arith(pArithDecoder.get(), grContext.get(), nullptr);
@@ -938,7 +939,7 @@ int32_t CJBig2_Context::parseTextRegion(CJBig2_Segment* pSegment) {
int32_t CJBig2_Context::parsePatternDict(CJBig2_Segment* pSegment,
IFX_Pause* pPause) {
uint8_t cFlags;
- std::unique_ptr<CJBig2_PDDProc> pPDD(new CJBig2_PDDProc);
+ auto pPDD = pdfium::MakeUnique<CJBig2_PDDProc>();
if (m_pStream->read1Byte(&cFlags) != 0 ||
m_pStream->read1Byte(&pPDD->HDPW) != 0 ||
m_pStream->read1Byte(&pPDD->HDPH) != 0 ||
@@ -956,8 +957,8 @@ int32_t CJBig2_Context::parsePatternDict(CJBig2_Segment* pSegment,
std::unique_ptr<JBig2ArithCtx, FxFreeDeleter> gbContext(
FX_Alloc(JBig2ArithCtx, size));
JBIG2_memset(gbContext.get(), 0, sizeof(JBig2ArithCtx) * size);
- std::unique_ptr<CJBig2_ArithDecoder> pArithDecoder(
- new CJBig2_ArithDecoder(m_pStream.get()));
+ auto pArithDecoder =
+ pdfium::MakeUnique<CJBig2_ArithDecoder>(m_pStream.get());
pSegment->m_Result.pd =
pPDD->decode_Arith(pArithDecoder.get(), gbContext.get(), pPause);
if (!pSegment->m_Result.pd)
@@ -978,7 +979,7 @@ int32_t CJBig2_Context::parseHalftoneRegion(CJBig2_Segment* pSegment,
IFX_Pause* pPause) {
uint8_t cFlags;
JBig2RegionInfo ri;
- std::unique_ptr<CJBig2_HTRDProc> pHRD(new CJBig2_HTRDProc);
+ auto pHRD = pdfium::MakeUnique<CJBig2_HTRDProc>();
if (parseRegionInfo(&ri) != JBIG2_SUCCESS ||
m_pStream->read1Byte(&cFlags) != 0 ||
m_pStream->readInteger(&pHRD->HGW) != 0 ||
@@ -1022,8 +1023,8 @@ int32_t CJBig2_Context::parseHalftoneRegion(CJBig2_Segment* pSegment,
std::unique_ptr<JBig2ArithCtx, FxFreeDeleter> gbContext(
FX_Alloc(JBig2ArithCtx, size));
JBIG2_memset(gbContext.get(), 0, sizeof(JBig2ArithCtx) * size);
- std::unique_ptr<CJBig2_ArithDecoder> pArithDecoder(
- new CJBig2_ArithDecoder(m_pStream.get()));
+ auto pArithDecoder =
+ pdfium::MakeUnique<CJBig2_ArithDecoder>(m_pStream.get());
pSegment->m_Result.im =
pHRD->decode_Arith(pArithDecoder.get(), gbContext.get(), pPause);
if (!pSegment->m_Result.im)
@@ -1056,7 +1057,7 @@ int32_t CJBig2_Context::parseHalftoneRegion(CJBig2_Segment* pSegment,
int32_t CJBig2_Context::parseGenericRegion(CJBig2_Segment* pSegment,
IFX_Pause* pPause) {
if (!m_pGRD) {
- std::unique_ptr<CJBig2_GRDProc> pGRD(new CJBig2_GRDProc);
+ auto pGRD = pdfium::MakeUnique<CJBig2_GRDProc>();
uint8_t cFlags;
if (parseRegionInfo(&m_ri) != JBIG2_SUCCESS ||
m_pStream->read1Byte(&cFlags) != 0) {
@@ -1165,7 +1166,7 @@ int32_t CJBig2_Context::parseGenericRefinementRegion(CJBig2_Segment* pSegment) {
m_pStream->read1Byte(&cFlags) != 0) {
return JBIG2_ERROR_TOO_SHORT;
}
- std::unique_ptr<CJBig2_GRRDProc> pGRRD(new CJBig2_GRRDProc);
+ auto pGRRD = pdfium::MakeUnique<CJBig2_GRRDProc>();
pGRRD->GRW = ri.width;
pGRRD->GRH = ri.height;
pGRRD->GRTEMPLATE = !!(cFlags & 0x01);
@@ -1202,8 +1203,7 @@ int32_t CJBig2_Context::parseGenericRefinementRegion(CJBig2_Segment* pSegment) {
std::unique_ptr<JBig2ArithCtx, FxFreeDeleter> grContext(
FX_Alloc(JBig2ArithCtx, size));
JBIG2_memset(grContext.get(), 0, sizeof(JBig2ArithCtx) * size);
- std::unique_ptr<CJBig2_ArithDecoder> pArithDecoder(
- new CJBig2_ArithDecoder(m_pStream.get()));
+ auto pArithDecoder = pdfium::MakeUnique<CJBig2_ArithDecoder>(m_pStream.get());
pSegment->m_nResultType = JBIG2_IMAGE_POINTER;
pSegment->m_Result.im = pGRRD->decode(pArithDecoder.get(), grContext.get());
if (!pSegment->m_Result.im)
@@ -1230,8 +1230,7 @@ int32_t CJBig2_Context::parseGenericRefinementRegion(CJBig2_Segment* pSegment) {
int32_t CJBig2_Context::parseTable(CJBig2_Segment* pSegment) {
pSegment->m_nResultType = JBIG2_HUFFMAN_TABLE_POINTER;
pSegment->m_Result.ht = nullptr;
- std::unique_ptr<CJBig2_HuffmanTable> pHuff(
- new CJBig2_HuffmanTable(m_pStream.get()));
+ auto pHuff = pdfium::MakeUnique<CJBig2_HuffmanTable>(m_pStream.get());
if (!pHuff->IsOK())
return JBIG2_ERROR_FATAL;
diff --git a/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_Context.h b/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_Context.h
index cd44a82c61d..a9fb1e24515 100644
--- a/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_Context.h
+++ b/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_Context.h
@@ -40,8 +40,8 @@ using CJBig2_CachePair =
class CJBig2_Context {
public:
- CJBig2_Context(CPDF_StreamAcc* pGlobalStream,
- CPDF_StreamAcc* pSrcStream,
+ CJBig2_Context(const CFX_RetainPtr<CPDF_StreamAcc>& pGlobalStream,
+ const CFX_RetainPtr<CPDF_StreamAcc>& pSrcStream,
std::list<CJBig2_CachePair>* pSymbolDictCache,
IFX_Pause* pPause,
bool bIsGlobal);
@@ -54,7 +54,7 @@ class CJBig2_Context {
IFX_Pause* pPause);
int32_t Continue(IFX_Pause* pPause);
- FXCODEC_STATUS GetProcessingStatus() { return m_ProcessingStatus; }
+ FXCODEC_STATUS GetProcessingStatus() const { return m_ProcessingStatus; }
private:
int32_t decode_SquentialOrgnazation(IFX_Pause* pPause);
diff --git a/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_Define.h b/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_Define.h
index 86df248786b..2934de4e9b3 100644
--- a/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_Define.h
+++ b/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_Define.h
@@ -9,9 +9,9 @@
#include "core/fxcrt/fx_system.h"
-#define JBIG2_memset FXSYS_memset
-#define JBIG2_memcmp FXSYS_memcmp
-#define JBIG2_memcpy FXSYS_memcpy
+#define JBIG2_memset memset
+#define JBIG2_memcmp memcmp
+#define JBIG2_memcpy memcpy
#define JBIG2_OOB 1
struct JBig2RegionInfo {
diff --git a/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_GrdProc.cpp b/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_GrdProc.cpp
index 8c6d58e5119..675de9bcddf 100644
--- a/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_GrdProc.cpp
+++ b/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_GrdProc.cpp
@@ -12,6 +12,7 @@
#include "core/fxcodec/jbig2/JBig2_ArithDecoder.h"
#include "core/fxcodec/jbig2/JBig2_BitStream.h"
#include "core/fxcodec/jbig2/JBig2_Image.h"
+#include "third_party/base/ptr_util.h"
CJBig2_GRDProc::CJBig2_GRDProc()
: m_loopIndex(0),
@@ -65,7 +66,7 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith(CJBig2_ArithDecoder* pArithDecoder,
CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template0_opt3(
CJBig2_ArithDecoder* pArithDecoder,
JBig2ArithCtx* gbContext) {
- std::unique_ptr<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH));
+ auto GBREG = pdfium::MakeUnique<CJBig2_Image>(GBW, GBH);
if (!GBREG->m_pData)
return nullptr;
@@ -77,8 +78,12 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template0_opt3(
int32_t nBitsLeft = GBW - (nLineBytes << 3);
uint32_t height = GBH & 0x7fffffff;
for (uint32_t h = 0; h < height; h++) {
- if (TPGDON)
+ if (TPGDON) {
+ if (pArithDecoder->IsComplete())
+ return nullptr;
+
LTP = LTP ^ pArithDecoder->DECODE(&gbContext[0x9b25]);
+ }
if (LTP) {
GBREG->copyLine(h, h - 1);
} else {
@@ -93,6 +98,9 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template0_opt3(
line2 = (line2 << 8) | (*pLine2++);
uint8_t cVal = 0;
for (int32_t k = 7; k >= 0; k--) {
+ if (pArithDecoder->IsComplete())
+ return nullptr;
+
int bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]);
cVal |= bVal << k;
CONTEXT = (((CONTEXT & 0x7bf7) << 1) | bVal |
@@ -104,6 +112,9 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template0_opt3(
line2 <<= 8;
uint8_t cVal1 = 0;
for (int32_t k = 0; k < nBitsLeft; k++) {
+ if (pArithDecoder->IsComplete())
+ return nullptr;
+
int bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]);
cVal1 |= bVal << (7 - k);
CONTEXT =
@@ -121,6 +132,9 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template0_opt3(
}
uint8_t cVal = 0;
for (int32_t k = 7; k >= 0; k--) {
+ if (pArithDecoder->IsComplete())
+ return nullptr;
+
int bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]);
cVal |= bVal << k;
CONTEXT =
@@ -131,6 +145,9 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template0_opt3(
line2 <<= 8;
uint8_t cVal1 = 0;
for (int32_t k = 0; k < nBitsLeft; k++) {
+ if (pArithDecoder->IsComplete())
+ return nullptr;
+
int bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]);
cVal1 |= bVal << (7 - k);
CONTEXT = (((CONTEXT & 0x7bf7) << 1) | bVal |
@@ -148,11 +165,15 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template0_unopt(
CJBig2_ArithDecoder* pArithDecoder,
JBig2ArithCtx* gbContext) {
int LTP = 0;
- std::unique_ptr<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH));
+ auto GBREG = pdfium::MakeUnique<CJBig2_Image>(GBW, GBH);
GBREG->fill(0);
for (uint32_t h = 0; h < GBH; h++) {
- if (TPGDON)
+ if (TPGDON) {
+ if (pArithDecoder->IsComplete())
+ return nullptr;
+
LTP = LTP ^ pArithDecoder->DECODE(&gbContext[0x9b25]);
+ }
if (LTP) {
GBREG->copyLine(h, h - 1);
} else {
@@ -174,6 +195,9 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template0_unopt(
CONTEXT |= GBREG->getPixel(w + GBAT[4], h + GBAT[5]) << 11;
CONTEXT |= line1 << 12;
CONTEXT |= GBREG->getPixel(w + GBAT[6], h + GBAT[7]) << 15;
+ if (pArithDecoder->IsComplete())
+ return nullptr;
+
bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]);
}
if (bVal) {
@@ -191,7 +215,7 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template0_unopt(
CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template1_opt3(
CJBig2_ArithDecoder* pArithDecoder,
JBig2ArithCtx* gbContext) {
- std::unique_ptr<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH));
+ auto GBREG = pdfium::MakeUnique<CJBig2_Image>(GBW, GBH);
if (!GBREG->m_pData)
return nullptr;
@@ -202,8 +226,12 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template1_opt3(
int32_t nLineBytes = ((GBW + 7) >> 3) - 1;
int32_t nBitsLeft = GBW - (nLineBytes << 3);
for (uint32_t h = 0; h < GBH; h++) {
- if (TPGDON)
+ if (TPGDON) {
+ if (pArithDecoder->IsComplete())
+ return nullptr;
+
LTP = LTP ^ pArithDecoder->DECODE(&gbContext[0x0795]);
+ }
if (LTP) {
GBREG->copyLine(h, h - 1);
} else {
@@ -218,6 +246,9 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template1_opt3(
line2 = (line2 << 8) | (*pLine2++);
uint8_t cVal = 0;
for (int32_t k = 7; k >= 0; k--) {
+ if (pArithDecoder->IsComplete())
+ return nullptr;
+
int bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]);
cVal |= bVal << k;
CONTEXT = ((CONTEXT & 0x0efb) << 1) | bVal |
@@ -229,6 +260,9 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template1_opt3(
line2 <<= 8;
uint8_t cVal1 = 0;
for (int32_t k = 0; k < nBitsLeft; k++) {
+ if (pArithDecoder->IsComplete())
+ return nullptr;
+
int bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]);
cVal1 |= bVal << (7 - k);
CONTEXT = ((CONTEXT & 0x0efb) << 1) | bVal |
@@ -246,6 +280,9 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template1_opt3(
}
uint8_t cVal = 0;
for (int32_t k = 7; k >= 0; k--) {
+ if (pArithDecoder->IsComplete())
+ return nullptr;
+
int bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]);
cVal |= bVal << k;
CONTEXT = ((CONTEXT & 0x0efb) << 1) | bVal |
@@ -256,6 +293,9 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template1_opt3(
line2 <<= 8;
uint8_t cVal1 = 0;
for (int32_t k = 0; k < nBitsLeft; k++) {
+ if (pArithDecoder->IsComplete())
+ return nullptr;
+
int bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]);
cVal1 |= bVal << (7 - k);
CONTEXT =
@@ -273,11 +313,15 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template1_unopt(
CJBig2_ArithDecoder* pArithDecoder,
JBig2ArithCtx* gbContext) {
int LTP = 0;
- std::unique_ptr<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH));
+ auto GBREG = pdfium::MakeUnique<CJBig2_Image>(GBW, GBH);
GBREG->fill(0);
for (uint32_t h = 0; h < GBH; h++) {
- if (TPGDON)
+ if (TPGDON) {
+ if (pArithDecoder->IsComplete())
+ return nullptr;
+
LTP = LTP ^ pArithDecoder->DECODE(&gbContext[0x0795]);
+ }
if (LTP) {
GBREG->copyLine(h, h - 1);
} else {
@@ -297,6 +341,9 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template1_unopt(
CONTEXT |= GBREG->getPixel(w + GBAT[0], h + GBAT[1]) << 3;
CONTEXT |= line2 << 4;
CONTEXT |= line1 << 9;
+ if (pArithDecoder->IsComplete())
+ return nullptr;
+
bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]);
}
if (bVal) {
@@ -314,7 +361,7 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template1_unopt(
CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template2_opt3(
CJBig2_ArithDecoder* pArithDecoder,
JBig2ArithCtx* gbContext) {
- std::unique_ptr<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH));
+ auto GBREG = pdfium::MakeUnique<CJBig2_Image>(GBW, GBH);
if (!GBREG->m_pData)
return nullptr;
@@ -325,8 +372,12 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template2_opt3(
int32_t nLineBytes = ((GBW + 7) >> 3) - 1;
int32_t nBitsLeft = GBW - (nLineBytes << 3);
for (uint32_t h = 0; h < GBH; h++) {
- if (TPGDON)
+ if (TPGDON) {
+ if (pArithDecoder->IsComplete())
+ return nullptr;
+
LTP = LTP ^ pArithDecoder->DECODE(&gbContext[0x00e5]);
+ }
if (LTP) {
GBREG->copyLine(h, h - 1);
} else {
@@ -341,6 +392,9 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template2_opt3(
line2 = (line2 << 8) | (*pLine2++);
uint8_t cVal = 0;
for (int32_t k = 7; k >= 0; k--) {
+ if (pArithDecoder->IsComplete())
+ return nullptr;
+
int bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]);
cVal |= bVal << k;
CONTEXT = ((CONTEXT & 0x01bd) << 1) | bVal |
@@ -352,6 +406,9 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template2_opt3(
line2 <<= 8;
uint8_t cVal1 = 0;
for (int32_t k = 0; k < nBitsLeft; k++) {
+ if (pArithDecoder->IsComplete())
+ return nullptr;
+
int bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]);
cVal1 |= bVal << (7 - k);
CONTEXT = ((CONTEXT & 0x01bd) << 1) | bVal |
@@ -369,6 +426,9 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template2_opt3(
}
uint8_t cVal = 0;
for (int32_t k = 7; k >= 0; k--) {
+ if (pArithDecoder->IsComplete())
+ return nullptr;
+
int bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]);
cVal |= bVal << k;
CONTEXT = ((CONTEXT & 0x01bd) << 1) | bVal |
@@ -379,6 +439,9 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template2_opt3(
line2 <<= 8;
uint8_t cVal1 = 0;
for (int32_t k = 0; k < nBitsLeft; k++) {
+ if (pArithDecoder->IsComplete())
+ return nullptr;
+
int bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]);
cVal1 |= bVal << (7 - k);
CONTEXT = ((CONTEXT & 0x01bd) << 1) | bVal |
@@ -396,11 +459,15 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template2_unopt(
CJBig2_ArithDecoder* pArithDecoder,
JBig2ArithCtx* gbContext) {
int LTP = 0;
- std::unique_ptr<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH));
+ auto GBREG = pdfium::MakeUnique<CJBig2_Image>(GBW, GBH);
GBREG->fill(0);
for (uint32_t h = 0; h < GBH; h++) {
- if (TPGDON)
+ if (TPGDON) {
+ if (pArithDecoder->IsComplete())
+ return nullptr;
+
LTP = LTP ^ pArithDecoder->DECODE(&gbContext[0x00e5]);
+ }
if (LTP) {
GBREG->copyLine(h, h - 1);
} else {
@@ -418,6 +485,9 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template2_unopt(
CONTEXT |= GBREG->getPixel(w + GBAT[0], h + GBAT[1]) << 2;
CONTEXT |= line2 << 3;
CONTEXT |= line1 << 7;
+ if (pArithDecoder->IsComplete())
+ return nullptr;
+
bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]);
}
if (bVal) {
@@ -435,7 +505,7 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template2_unopt(
CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template3_opt3(
CJBig2_ArithDecoder* pArithDecoder,
JBig2ArithCtx* gbContext) {
- std::unique_ptr<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH));
+ auto GBREG = pdfium::MakeUnique<CJBig2_Image>(GBW, GBH);
if (!GBREG->m_pData)
return nullptr;
@@ -444,9 +514,15 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template3_opt3(
int32_t nStride = GBREG->stride();
int32_t nLineBytes = ((GBW + 7) >> 3) - 1;
int32_t nBitsLeft = GBW - (nLineBytes << 3);
+
for (uint32_t h = 0; h < GBH; h++) {
- if (TPGDON)
+ if (TPGDON) {
+ if (pArithDecoder->IsComplete())
+ return nullptr;
+
LTP = LTP ^ pArithDecoder->DECODE(&gbContext[0x0195]);
+ }
+
if (LTP) {
GBREG->copyLine(h, h - 1);
} else {
@@ -458,6 +534,9 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template3_opt3(
line1 = (line1 << 8) | (*pLine1++);
uint8_t cVal = 0;
for (int32_t k = 7; k >= 0; k--) {
+ if (pArithDecoder->IsComplete())
+ return nullptr;
+
int bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]);
cVal |= bVal << k;
CONTEXT = ((CONTEXT & 0x01f7) << 1) | bVal |
@@ -468,6 +547,9 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template3_opt3(
line1 <<= 8;
uint8_t cVal1 = 0;
for (int32_t k = 0; k < nBitsLeft; k++) {
+ if (pArithDecoder->IsComplete())
+ return nullptr;
+
int bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]);
cVal1 |= bVal << (7 - k);
CONTEXT =
@@ -479,6 +561,9 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template3_opt3(
for (int32_t cc = 0; cc < nLineBytes; cc++) {
uint8_t cVal = 0;
for (int32_t k = 7; k >= 0; k--) {
+ if (pArithDecoder->IsComplete())
+ return nullptr;
+
int bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]);
cVal |= bVal << k;
CONTEXT = ((CONTEXT & 0x01f7) << 1) | bVal;
@@ -487,6 +572,9 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template3_opt3(
}
uint8_t cVal1 = 0;
for (int32_t k = 0; k < nBitsLeft; k++) {
+ if (pArithDecoder->IsComplete())
+ return nullptr;
+
int bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]);
cVal1 |= bVal << (7 - k);
CONTEXT = ((CONTEXT & 0x01f7) << 1) | bVal;
@@ -503,11 +591,15 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template3_unopt(
CJBig2_ArithDecoder* pArithDecoder,
JBig2ArithCtx* gbContext) {
int LTP = 0;
- std::unique_ptr<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH));
+ auto GBREG = pdfium::MakeUnique<CJBig2_Image>(GBW, GBH);
GBREG->fill(0);
for (uint32_t h = 0; h < GBH; h++) {
- if (TPGDON)
+ if (TPGDON) {
+ if (pArithDecoder->IsComplete())
+ return nullptr;
+
LTP = LTP ^ pArithDecoder->DECODE(&gbContext[0x0195]);
+ }
if (LTP == 1) {
GBREG->copyLine(h, h - 1);
} else {
@@ -522,6 +614,9 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template3_unopt(
uint32_t CONTEXT = line2;
CONTEXT |= GBREG->getPixel(w + GBAT[0], h + GBAT[1]) << 4;
CONTEXT |= line1 << 5;
+ if (pArithDecoder->IsComplete())
+ return nullptr;
+
bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]);
}
if (bVal) {
@@ -658,9 +753,14 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template0_opt3(
int32_t nLineBytes = ((GBW + 7) >> 3) - 1;
int32_t nBitsLeft = GBW - (nLineBytes << 3);
uint32_t height = GBH & 0x7fffffff;
+
for (; m_loopIndex < height; m_loopIndex++) {
- if (TPGDON)
+ if (TPGDON) {
+ if (pArithDecoder->IsComplete())
+ return FXCODEC_STATUS_ERROR;
+
m_LTP = m_LTP ^ pArithDecoder->DECODE(&gbContext[0x9b25]);
+ }
if (m_LTP) {
pImage->copyLine(m_loopIndex, m_loopIndex - 1);
} else {
@@ -675,6 +775,9 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template0_opt3(
line2 = (line2 << 8) | (*pLine2++);
uint8_t cVal = 0;
for (int32_t k = 7; k >= 0; k--) {
+ if (pArithDecoder->IsComplete())
+ return FXCODEC_STATUS_ERROR;
+
int bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]);
cVal |= bVal << k;
CONTEXT = (((CONTEXT & 0x7bf7) << 1) | bVal |
@@ -686,6 +789,9 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template0_opt3(
line2 <<= 8;
uint8_t cVal1 = 0;
for (int32_t k = 0; k < nBitsLeft; k++) {
+ if (pArithDecoder->IsComplete())
+ return FXCODEC_STATUS_ERROR;
+
int bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]);
cVal1 |= bVal << (7 - k);
CONTEXT =
@@ -703,6 +809,9 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template0_opt3(
}
uint8_t cVal = 0;
for (int32_t k = 7; k >= 0; k--) {
+ if (pArithDecoder->IsComplete())
+ return FXCODEC_STATUS_ERROR;
+
int bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]);
cVal |= bVal << k;
CONTEXT =
@@ -713,6 +822,9 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template0_opt3(
line2 <<= 8;
uint8_t cVal1 = 0;
for (int32_t k = 0; k < nBitsLeft; k++) {
+ if (pArithDecoder->IsComplete())
+ return FXCODEC_STATUS_ERROR;
+
int bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]);
cVal1 |= bVal << (7 - k);
CONTEXT = (((CONTEXT & 0x7bf7) << 1) | bVal |
@@ -738,8 +850,12 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template0_unopt(
JBig2ArithCtx* gbContext,
IFX_Pause* pPause) {
for (; m_loopIndex < GBH; m_loopIndex++) {
- if (TPGDON)
+ if (TPGDON) {
+ if (pArithDecoder->IsComplete())
+ return FXCODEC_STATUS_ERROR;
+
m_LTP = m_LTP ^ pArithDecoder->DECODE(&gbContext[0x9b25]);
+ }
if (m_LTP) {
pImage->copyLine(m_loopIndex, m_loopIndex - 1);
} else {
@@ -761,6 +877,9 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template0_unopt(
CONTEXT |= pImage->getPixel(w + GBAT[4], m_loopIndex + GBAT[5]) << 11;
CONTEXT |= line1 << 12;
CONTEXT |= pImage->getPixel(w + GBAT[6], m_loopIndex + GBAT[7]) << 15;
+ if (pArithDecoder->IsComplete())
+ return FXCODEC_STATUS_ERROR;
+
bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]);
}
if (bVal) {
@@ -796,8 +915,12 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template1_opt3(
int32_t nLineBytes = ((GBW + 7) >> 3) - 1;
int32_t nBitsLeft = GBW - (nLineBytes << 3);
for (; m_loopIndex < GBH; m_loopIndex++) {
- if (TPGDON)
+ if (TPGDON) {
+ if (pArithDecoder->IsComplete())
+ return FXCODEC_STATUS_ERROR;
+
m_LTP = m_LTP ^ pArithDecoder->DECODE(&gbContext[0x0795]);
+ }
if (m_LTP) {
pImage->copyLine(m_loopIndex, m_loopIndex - 1);
} else {
@@ -812,6 +935,9 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template1_opt3(
line2 = (line2 << 8) | (*pLine2++);
uint8_t cVal = 0;
for (int32_t k = 7; k >= 0; k--) {
+ if (pArithDecoder->IsComplete())
+ return FXCODEC_STATUS_ERROR;
+
int bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]);
cVal |= bVal << k;
CONTEXT = ((CONTEXT & 0x0efb) << 1) | bVal |
@@ -823,6 +949,9 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template1_opt3(
line2 <<= 8;
uint8_t cVal1 = 0;
for (int32_t k = 0; k < nBitsLeft; k++) {
+ if (pArithDecoder->IsComplete())
+ return FXCODEC_STATUS_ERROR;
+
int bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]);
cVal1 |= bVal << (7 - k);
CONTEXT = ((CONTEXT & 0x0efb) << 1) | bVal |
@@ -840,6 +969,9 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template1_opt3(
}
uint8_t cVal = 0;
for (int32_t k = 7; k >= 0; k--) {
+ if (pArithDecoder->IsComplete())
+ return FXCODEC_STATUS_ERROR;
+
int bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]);
cVal |= bVal << k;
CONTEXT = ((CONTEXT & 0x0efb) << 1) | bVal |
@@ -850,6 +982,9 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template1_opt3(
line2 <<= 8;
uint8_t cVal1 = 0;
for (int32_t k = 0; k < nBitsLeft; k++) {
+ if (pArithDecoder->IsComplete())
+ return FXCODEC_STATUS_ERROR;
+
int bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]);
cVal1 |= bVal << (7 - k);
CONTEXT =
@@ -875,8 +1010,12 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template1_unopt(
JBig2ArithCtx* gbContext,
IFX_Pause* pPause) {
for (uint32_t h = 0; h < GBH; h++) {
- if (TPGDON)
+ if (TPGDON) {
+ if (pArithDecoder->IsComplete())
+ return FXCODEC_STATUS_ERROR;
+
m_LTP = m_LTP ^ pArithDecoder->DECODE(&gbContext[0x0795]);
+ }
if (m_LTP) {
pImage->copyLine(h, h - 1);
} else {
@@ -896,6 +1035,9 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template1_unopt(
CONTEXT |= pImage->getPixel(w + GBAT[0], h + GBAT[1]) << 3;
CONTEXT |= line2 << 4;
CONTEXT |= line1 << 9;
+ if (pArithDecoder->IsComplete())
+ return FXCODEC_STATUS_ERROR;
+
bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]);
}
if (bVal) {
@@ -929,8 +1071,12 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template2_opt3(
int32_t nLineBytes = ((GBW + 7) >> 3) - 1;
int32_t nBitsLeft = GBW - (nLineBytes << 3);
for (; m_loopIndex < GBH; m_loopIndex++) {
- if (TPGDON)
+ if (TPGDON) {
+ if (pArithDecoder->IsComplete())
+ return FXCODEC_STATUS_ERROR;
+
m_LTP = m_LTP ^ pArithDecoder->DECODE(&gbContext[0x00e5]);
+ }
if (m_LTP) {
pImage->copyLine(m_loopIndex, m_loopIndex - 1);
} else {
@@ -945,6 +1091,9 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template2_opt3(
line2 = (line2 << 8) | (*pLine2++);
uint8_t cVal = 0;
for (int32_t k = 7; k >= 0; k--) {
+ if (pArithDecoder->IsComplete())
+ return FXCODEC_STATUS_ERROR;
+
int bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]);
cVal |= bVal << k;
CONTEXT = ((CONTEXT & 0x01bd) << 1) | bVal |
@@ -956,6 +1105,9 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template2_opt3(
line2 <<= 8;
uint8_t cVal1 = 0;
for (int32_t k = 0; k < nBitsLeft; k++) {
+ if (pArithDecoder->IsComplete())
+ return FXCODEC_STATUS_ERROR;
+
int bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]);
cVal1 |= bVal << (7 - k);
CONTEXT = ((CONTEXT & 0x01bd) << 1) | bVal |
@@ -973,6 +1125,9 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template2_opt3(
}
uint8_t cVal = 0;
for (int32_t k = 7; k >= 0; k--) {
+ if (pArithDecoder->IsComplete())
+ return FXCODEC_STATUS_ERROR;
+
int bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]);
cVal |= bVal << k;
CONTEXT = ((CONTEXT & 0x01bd) << 1) | bVal |
@@ -983,6 +1138,9 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template2_opt3(
line2 <<= 8;
uint8_t cVal1 = 0;
for (int32_t k = 0; k < nBitsLeft; k++) {
+ if (pArithDecoder->IsComplete())
+ return FXCODEC_STATUS_ERROR;
+
int bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]);
cVal1 |= bVal << (7 - k);
CONTEXT = ((CONTEXT & 0x01bd) << 1) | bVal |
@@ -1008,8 +1166,12 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template2_unopt(
JBig2ArithCtx* gbContext,
IFX_Pause* pPause) {
for (; m_loopIndex < GBH; m_loopIndex++) {
- if (TPGDON)
+ if (TPGDON) {
+ if (pArithDecoder->IsComplete())
+ return FXCODEC_STATUS_ERROR;
+
m_LTP = m_LTP ^ pArithDecoder->DECODE(&gbContext[0x00e5]);
+ }
if (m_LTP) {
pImage->copyLine(m_loopIndex, m_loopIndex - 1);
} else {
@@ -1027,6 +1189,9 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template2_unopt(
CONTEXT |= pImage->getPixel(w + GBAT[0], m_loopIndex + GBAT[1]) << 2;
CONTEXT |= line2 << 3;
CONTEXT |= line1 << 7;
+ if (pArithDecoder->IsComplete())
+ return FXCODEC_STATUS_ERROR;
+
bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]);
}
if (bVal) {
@@ -1061,8 +1226,12 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template3_opt3(
int32_t nLineBytes = ((GBW + 7) >> 3) - 1;
int32_t nBitsLeft = GBW - (nLineBytes << 3);
for (; m_loopIndex < GBH; m_loopIndex++) {
- if (TPGDON)
+ if (TPGDON) {
+ if (pArithDecoder->IsComplete())
+ return FXCODEC_STATUS_ERROR;
+
m_LTP = m_LTP ^ pArithDecoder->DECODE(&gbContext[0x0195]);
+ }
if (m_LTP) {
pImage->copyLine(m_loopIndex, m_loopIndex - 1);
} else {
@@ -1074,6 +1243,9 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template3_opt3(
line1 = (line1 << 8) | (*pLine1++);
uint8_t cVal = 0;
for (int32_t k = 7; k >= 0; k--) {
+ if (pArithDecoder->IsComplete())
+ return FXCODEC_STATUS_ERROR;
+
int bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]);
cVal |= bVal << k;
CONTEXT = ((CONTEXT & 0x01f7) << 1) | bVal |
@@ -1084,6 +1256,9 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template3_opt3(
line1 <<= 8;
uint8_t cVal1 = 0;
for (int32_t k = 0; k < nBitsLeft; k++) {
+ if (pArithDecoder->IsComplete())
+ return FXCODEC_STATUS_ERROR;
+
int bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]);
cVal1 |= bVal << (7 - k);
CONTEXT =
@@ -1095,6 +1270,9 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template3_opt3(
for (int32_t cc = 0; cc < nLineBytes; cc++) {
uint8_t cVal = 0;
for (int32_t k = 7; k >= 0; k--) {
+ if (pArithDecoder->IsComplete())
+ return FXCODEC_STATUS_ERROR;
+
int bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]);
cVal |= bVal << k;
CONTEXT = ((CONTEXT & 0x01f7) << 1) | bVal;
@@ -1103,6 +1281,9 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template3_opt3(
}
uint8_t cVal1 = 0;
for (int32_t k = 0; k < nBitsLeft; k++) {
+ if (pArithDecoder->IsComplete())
+ return FXCODEC_STATUS_ERROR;
+
int bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]);
cVal1 |= bVal << (7 - k);
CONTEXT = ((CONTEXT & 0x01f7) << 1) | bVal;
@@ -1127,8 +1308,12 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template3_unopt(
JBig2ArithCtx* gbContext,
IFX_Pause* pPause) {
for (; m_loopIndex < GBH; m_loopIndex++) {
- if (TPGDON)
+ if (TPGDON) {
+ if (pArithDecoder->IsComplete())
+ return FXCODEC_STATUS_ERROR;
+
m_LTP = m_LTP ^ pArithDecoder->DECODE(&gbContext[0x0195]);
+ }
if (m_LTP) {
pImage->copyLine(m_loopIndex, m_loopIndex - 1);
} else {
@@ -1143,6 +1328,9 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template3_unopt(
uint32_t CONTEXT = line2;
CONTEXT |= pImage->getPixel(w + GBAT[0], m_loopIndex + GBAT[1]) << 4;
CONTEXT |= line1 << 5;
+ if (pArithDecoder->IsComplete())
+ return FXCODEC_STATUS_ERROR;
+
bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]);
}
if (bVal) {
diff --git a/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_GrrdProc.cpp b/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_GrrdProc.cpp
index 669fed68e9c..936b851d37f 100644
--- a/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_GrrdProc.cpp
+++ b/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_GrrdProc.cpp
@@ -11,6 +11,7 @@
#include "core/fxcodec/jbig2/JBig2_ArithDecoder.h"
#include "core/fxcodec/jbig2/JBig2_BitStream.h"
#include "core/fxcodec/jbig2/JBig2_Image.h"
+#include "third_party/base/ptr_util.h"
CJBig2_Image* CJBig2_GRRDProc::decode(CJBig2_ArithDecoder* pArithDecoder,
JBig2ArithCtx* grContext) {
@@ -35,7 +36,7 @@ CJBig2_Image* CJBig2_GRRDProc::decode_Template0_unopt(
CJBig2_ArithDecoder* pArithDecoder,
JBig2ArithCtx* grContext) {
int LTP = 0;
- std::unique_ptr<CJBig2_Image> GRREG(new CJBig2_Image(GRW, GRH));
+ auto GRREG = pdfium::MakeUnique<CJBig2_Image>(GRW, GRH);
GRREG->fill(0);
for (uint32_t h = 0; h < GRH; h++) {
if (TPGRON)
@@ -155,7 +156,7 @@ CJBig2_Image* CJBig2_GRRDProc::decode_Template0_opt(
int32_t iGRW = static_cast<int32_t>(GRW);
int32_t iGRH = static_cast<int32_t>(GRH);
- std::unique_ptr<CJBig2_Image> GRREG(new CJBig2_Image(iGRW, iGRH));
+ auto GRREG = pdfium::MakeUnique<CJBig2_Image>(iGRW, iGRH);
if (!GRREG->m_pData)
return nullptr;
@@ -283,7 +284,7 @@ CJBig2_Image* CJBig2_GRRDProc::decode_Template1_unopt(
CJBig2_ArithDecoder* pArithDecoder,
JBig2ArithCtx* grContext) {
int LTP = 0;
- std::unique_ptr<CJBig2_Image> GRREG(new CJBig2_Image(GRW, GRH));
+ auto GRREG = pdfium::MakeUnique<CJBig2_Image>(GRW, GRH);
GRREG->fill(0);
for (uint32_t h = 0; h < GRH; h++) {
if (TPGRON)
@@ -389,7 +390,7 @@ CJBig2_Image* CJBig2_GRRDProc::decode_Template1_opt(
int32_t iGRW = static_cast<int32_t>(GRW);
int32_t iGRH = static_cast<int32_t>(GRH);
- std::unique_ptr<CJBig2_Image> GRREG(new CJBig2_Image(iGRW, iGRH));
+ auto GRREG = pdfium::MakeUnique<CJBig2_Image>(iGRW, iGRH);
if (!GRREG->m_pData)
return nullptr;
diff --git a/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_GsidProc.cpp b/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_GsidProc.cpp
index 387f8ee5115..e65b47de62d 100644
--- a/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_GsidProc.cpp
+++ b/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_GsidProc.cpp
@@ -13,11 +13,12 @@
#include "core/fxcodec/jbig2/JBig2_GrdProc.h"
#include "core/fxcodec/jbig2/JBig2_Image.h"
#include "core/fxcrt/fx_basic.h"
+#include "third_party/base/ptr_util.h"
uint32_t* CJBig2_GSIDProc::decode_Arith(CJBig2_ArithDecoder* pArithDecoder,
JBig2ArithCtx* gbContext,
IFX_Pause* pPause) {
- std::unique_ptr<CJBig2_GRDProc> pGRD(new CJBig2_GRDProc());
+ auto pGRD = pdfium::MakeUnique<CJBig2_GRDProc>();
pGRD->MMR = GSMMR;
pGRD->GBW = GSW;
pGRD->GBH = GSH;
@@ -69,7 +70,7 @@ uint32_t* CJBig2_GSIDProc::decode_Arith(CJBig2_ArithDecoder* pArithDecoder,
uint32_t* CJBig2_GSIDProc::decode_MMR(CJBig2_BitStream* pStream,
IFX_Pause* pPause) {
- std::unique_ptr<CJBig2_GRDProc> pGRD(new CJBig2_GRDProc());
+ auto pGRD = pdfium::MakeUnique<CJBig2_GRDProc>();
pGRD->MMR = GSMMR;
pGRD->GBW = GSW;
pGRD->GBH = GSH;
diff --git a/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_HtrdProc.cpp b/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_HtrdProc.cpp
index 121bf1d6dfa..8899fb13503 100644
--- a/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_HtrdProc.cpp
+++ b/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_HtrdProc.cpp
@@ -20,7 +20,7 @@ CJBig2_Image* CJBig2_HTRDProc::decode_Arith(CJBig2_ArithDecoder* pArithDecoder,
uint32_t HBPP;
uint32_t* GI;
std::unique_ptr<CJBig2_Image> HSKIP;
- std::unique_ptr<CJBig2_Image> HTREG(new CJBig2_Image(HBW, HBH));
+ auto HTREG = pdfium::MakeUnique<CJBig2_Image>(HBW, HBH);
HTREG->fill(HDEFPIXEL);
if (HENABLESKIP == 1) {
HSKIP = pdfium::MakeUnique<CJBig2_Image>(HGW, HGH);
@@ -41,7 +41,7 @@ CJBig2_Image* CJBig2_HTRDProc::decode_Arith(CJBig2_ArithDecoder* pArithDecoder,
while ((uint32_t)(1 << HBPP) < HNUMPATS) {
HBPP++;
}
- std::unique_ptr<CJBig2_GSIDProc> pGID(new CJBig2_GSIDProc());
+ auto pGID = pdfium::MakeUnique<CJBig2_GSIDProc>();
pGID->GSMMR = HMMR;
pGID->GSW = HGW;
pGID->GSH = HGH;
@@ -73,13 +73,13 @@ CJBig2_Image* CJBig2_HTRDProc::decode_MMR(CJBig2_BitStream* pStream,
uint32_t ng, mg;
int32_t x, y;
uint32_t* GI;
- std::unique_ptr<CJBig2_Image> HTREG(new CJBig2_Image(HBW, HBH));
+ auto HTREG = pdfium::MakeUnique<CJBig2_Image>(HBW, HBH);
HTREG->fill(HDEFPIXEL);
uint32_t HBPP = 1;
while ((uint32_t)(1 << HBPP) < HNUMPATS) {
HBPP++;
}
- std::unique_ptr<CJBig2_GSIDProc> pGID(new CJBig2_GSIDProc());
+ auto pGID = pdfium::MakeUnique<CJBig2_GSIDProc>();
pGID->GSMMR = HMMR;
pGID->GSW = HGW;
pGID->GSH = HGH;
diff --git a/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_HuffmanTable.cpp b/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_HuffmanTable.cpp
index baf97567fb7..a4998e99cf6 100644
--- a/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_HuffmanTable.cpp
+++ b/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_HuffmanTable.cpp
@@ -70,6 +70,10 @@ bool CJBig2_HuffmanTable::ParseFromCodedBuffer(CJBig2_BitStream* pStream) {
return false;
}
RANGELOW[NTEMP] = cur_low.ValueOrDie();
+
+ if (RANGELEN[NTEMP] >= 32)
+ return false;
+
cur_low += (1 << RANGELEN[NTEMP]);
if (!cur_low.IsValid())
return false;
@@ -97,11 +101,10 @@ bool CJBig2_HuffmanTable::ParseFromCodedBuffer(CJBig2_BitStream* pStream) {
++NTEMP;
}
- InitCodes();
- return true;
+ return InitCodes();
}
-void CJBig2_HuffmanTable::InitCodes() {
+bool CJBig2_HuffmanTable::InitCodes() {
int lenmax = 0;
for (uint32_t i = 0; i < NTEMP; ++i)
lenmax = std::max(PREFLEN[i], lenmax);
@@ -115,13 +118,21 @@ void CJBig2_HuffmanTable::InitCodes() {
FIRSTCODE[0] = 0;
LENCOUNT[0] = 0;
for (int i = 1; i <= lenmax; ++i) {
- FIRSTCODE[i] = (FIRSTCODE[i - 1] + LENCOUNT[i - 1]) << 1;
+ pdfium::base::CheckedNumeric<int> shifted;
+ shifted = FIRSTCODE[i - 1] + LENCOUNT[i - 1];
+ shifted <<= 1;
+ if (!shifted.IsValid())
+ return false;
+
+ FIRSTCODE[i] = shifted.ValueOrDie();
int CURCODE = FIRSTCODE[i];
for (uint32_t j = 0; j < NTEMP; ++j) {
if (PREFLEN[j] == i)
CODES[j] = CURCODE++;
}
}
+
+ return true;
}
void CJBig2_HuffmanTable::ExtendBuffers(bool increment) {
diff --git a/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_HuffmanTable.h b/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_HuffmanTable.h
index 58a31248813..b49fcebc9c5 100644
--- a/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_HuffmanTable.h
+++ b/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_HuffmanTable.h
@@ -35,7 +35,7 @@ class CJBig2_HuffmanTable {
private:
void ParseFromStandardTable(const JBig2TableLine* pTable);
bool ParseFromCodedBuffer(CJBig2_BitStream* pStream);
- void InitCodes();
+ bool InitCodes();
void ExtendBuffers(bool increment);
bool m_bOK;
diff --git a/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_PddProc.cpp b/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_PddProc.cpp
index 679a87a0369..3eef302bafe 100644
--- a/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_PddProc.cpp
+++ b/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_PddProc.cpp
@@ -11,6 +11,7 @@
#include "core/fxcodec/jbig2/JBig2_GrdProc.h"
#include "core/fxcodec/jbig2/JBig2_Image.h"
#include "core/fxcodec/jbig2/JBig2_PatternDict.h"
+#include "third_party/base/ptr_util.h"
CJBig2_PatternDict* CJBig2_PDDProc::decode_Arith(
CJBig2_ArithDecoder* pArithDecoder,
@@ -18,12 +19,12 @@ CJBig2_PatternDict* CJBig2_PDDProc::decode_Arith(
IFX_Pause* pPause) {
uint32_t GRAY;
CJBig2_Image* BHDC = nullptr;
- std::unique_ptr<CJBig2_PatternDict> pDict(new CJBig2_PatternDict());
+ auto pDict = pdfium::MakeUnique<CJBig2_PatternDict>();
pDict->NUMPATS = GRAYMAX + 1;
pDict->HDPATS = FX_Alloc(CJBig2_Image*, pDict->NUMPATS);
JBIG2_memset(pDict->HDPATS, 0, sizeof(CJBig2_Image*) * pDict->NUMPATS);
- std::unique_ptr<CJBig2_GRDProc> pGRD(new CJBig2_GRDProc());
+ auto pGRD = pdfium::MakeUnique<CJBig2_GRDProc>();
pGRD->MMR = HDMMR;
pGRD->GBW = (GRAYMAX + 1) * HDPW;
pGRD->GBH = HDPH;
@@ -60,12 +61,12 @@ CJBig2_PatternDict* CJBig2_PDDProc::decode_MMR(CJBig2_BitStream* pStream,
IFX_Pause* pPause) {
uint32_t GRAY;
CJBig2_Image* BHDC = nullptr;
- std::unique_ptr<CJBig2_PatternDict> pDict(new CJBig2_PatternDict());
+ auto pDict = pdfium::MakeUnique<CJBig2_PatternDict>();
pDict->NUMPATS = GRAYMAX + 1;
pDict->HDPATS = FX_Alloc(CJBig2_Image*, pDict->NUMPATS);
JBIG2_memset(pDict->HDPATS, 0, sizeof(CJBig2_Image*) * pDict->NUMPATS);
- std::unique_ptr<CJBig2_GRDProc> pGRD(new CJBig2_GRDProc());
+ auto pGRD = pdfium::MakeUnique<CJBig2_GRDProc>();
pGRD->MMR = HDMMR;
pGRD->GBW = (GRAYMAX + 1) * HDPW;
pGRD->GBH = HDPH;
diff --git a/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_SddProc.cpp b/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_SddProc.cpp
index 5f23fcf4e1d..8e6c4ac304a 100644
--- a/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_SddProc.cpp
+++ b/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_SddProc.cpp
@@ -24,14 +24,14 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Arith(
CJBig2_ArithDecoder* pArithDecoder,
std::vector<JBig2ArithCtx>* gbContext,
std::vector<JBig2ArithCtx>* grContext) {
- CJBig2_Image** SDNEWSYMS;
+ std::vector<std::unique_ptr<CJBig2_Image>> SDNEWSYMS;
uint32_t HCHEIGHT, NSYMSDECODED;
int32_t HCDH;
uint32_t SYMWIDTH, TOTWIDTH;
int32_t DW;
CJBig2_Image* BS;
uint32_t I, J, REFAGGNINST;
- bool* EXFLAGS;
+ std::vector<bool> EXFLAGS;
uint32_t EXINDEX;
bool CUREXFLAG;
uint32_t EXRUNLENGTH;
@@ -40,29 +40,29 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Arith(
uint8_t SBSYMCODELEN;
int32_t RDXI, RDYI;
uint32_t num_ex_syms;
- CJBig2_Image** SBSYMS;
+ // Pointers are not owned
+ std::vector<CJBig2_Image*> SBSYMS;
std::unique_ptr<CJBig2_ArithIaidDecoder> IAID;
std::unique_ptr<CJBig2_SymbolDict> pDict;
- std::unique_ptr<CJBig2_ArithIntDecoder> IADH(new CJBig2_ArithIntDecoder);
- std::unique_ptr<CJBig2_ArithIntDecoder> IADW(new CJBig2_ArithIntDecoder);
- std::unique_ptr<CJBig2_ArithIntDecoder> IAAI(new CJBig2_ArithIntDecoder);
- std::unique_ptr<CJBig2_ArithIntDecoder> IARDX(new CJBig2_ArithIntDecoder);
- std::unique_ptr<CJBig2_ArithIntDecoder> IARDY(new CJBig2_ArithIntDecoder);
- std::unique_ptr<CJBig2_ArithIntDecoder> IAEX(new CJBig2_ArithIntDecoder);
- std::unique_ptr<CJBig2_ArithIntDecoder> IADT(new CJBig2_ArithIntDecoder);
- std::unique_ptr<CJBig2_ArithIntDecoder> IAFS(new CJBig2_ArithIntDecoder);
- std::unique_ptr<CJBig2_ArithIntDecoder> IADS(new CJBig2_ArithIntDecoder);
- std::unique_ptr<CJBig2_ArithIntDecoder> IAIT(new CJBig2_ArithIntDecoder);
- std::unique_ptr<CJBig2_ArithIntDecoder> IARI(new CJBig2_ArithIntDecoder);
- std::unique_ptr<CJBig2_ArithIntDecoder> IARDW(new CJBig2_ArithIntDecoder);
- std::unique_ptr<CJBig2_ArithIntDecoder> IARDH(new CJBig2_ArithIntDecoder);
+ auto IADH = pdfium::MakeUnique<CJBig2_ArithIntDecoder>();
+ auto IADW = pdfium::MakeUnique<CJBig2_ArithIntDecoder>();
+ auto IAAI = pdfium::MakeUnique<CJBig2_ArithIntDecoder>();
+ auto IARDX = pdfium::MakeUnique<CJBig2_ArithIntDecoder>();
+ auto IARDY = pdfium::MakeUnique<CJBig2_ArithIntDecoder>();
+ auto IAEX = pdfium::MakeUnique<CJBig2_ArithIntDecoder>();
+ auto IADT = pdfium::MakeUnique<CJBig2_ArithIntDecoder>();
+ auto IAFS = pdfium::MakeUnique<CJBig2_ArithIntDecoder>();
+ auto IADS = pdfium::MakeUnique<CJBig2_ArithIntDecoder>();
+ auto IAIT = pdfium::MakeUnique<CJBig2_ArithIntDecoder>();
+ auto IARI = pdfium::MakeUnique<CJBig2_ArithIntDecoder>();
+ auto IARDW = pdfium::MakeUnique<CJBig2_ArithIntDecoder>();
+ auto IARDH = pdfium::MakeUnique<CJBig2_ArithIntDecoder>();
nTmp = 0;
while ((uint32_t)(1 << nTmp) < (SDNUMINSYMS + SDNUMNEWSYMS)) {
nTmp++;
}
IAID = pdfium::MakeUnique<CJBig2_ArithIaidDecoder>((uint8_t)nTmp);
- SDNEWSYMS = FX_Alloc(CJBig2_Image*, SDNUMNEWSYMS);
- FXSYS_memset(SDNEWSYMS, 0, SDNUMNEWSYMS * sizeof(CJBig2_Image*));
+ SDNEWSYMS.resize(SDNUMNEWSYMS);
HCHEIGHT = 0;
NSYMSDECODED = 0;
@@ -70,9 +70,9 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Arith(
BS = nullptr;
IADH->decode(pArithDecoder, &HCDH);
HCHEIGHT = HCHEIGHT + HCDH;
- if ((int)HCHEIGHT < 0 || (int)HCHEIGHT > JBIG2_MAX_IMAGE_SIZE) {
- goto failed;
- }
+ if ((int)HCHEIGHT < 0 || (int)HCHEIGHT > JBIG2_MAX_IMAGE_SIZE)
+ return nullptr;
+
SYMWIDTH = 0;
TOTWIDTH = 0;
for (;;) {
@@ -80,11 +80,11 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Arith(
break;
if (NSYMSDECODED >= SDNUMNEWSYMS)
- goto failed;
+ return nullptr;
SYMWIDTH = SYMWIDTH + DW;
if ((int)SYMWIDTH < 0 || (int)SYMWIDTH > JBIG2_MAX_IMAGE_SIZE)
- goto failed;
+ return nullptr;
if (HCHEIGHT == 0 || SYMWIDTH == 0) {
TOTWIDTH = TOTWIDTH + SYMWIDTH;
@@ -94,7 +94,7 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Arith(
}
TOTWIDTH = TOTWIDTH + SYMWIDTH;
if (SDREFAGG == 0) {
- std::unique_ptr<CJBig2_GRDProc> pGRD(new CJBig2_GRDProc());
+ auto pGRD = pdfium::MakeUnique<CJBig2_GRDProc>();
pGRD->MMR = 0;
pGRD->GBW = SYMWIDTH;
pGRD->GBH = HCHEIGHT;
@@ -110,13 +110,12 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Arith(
pGRD->GBAT[6] = SDAT[6];
pGRD->GBAT[7] = SDAT[7];
BS = pGRD->decode_Arith(pArithDecoder, gbContext->data());
- if (!BS) {
- goto failed;
- }
+ if (!BS)
+ return nullptr;
} else {
IAAI->decode(pArithDecoder, (int*)&REFAGGNINST);
if (REFAGGNINST > 1) {
- std::unique_ptr<CJBig2_TRDProc> pDecoder(new CJBig2_TRDProc());
+ auto pDecoder = pdfium::MakeUnique<CJBig2_TRDProc>();
pDecoder->SBHUFF = SDHUFF;
pDecoder->SBREFINE = 1;
pDecoder->SBW = SYMWIDTH;
@@ -131,37 +130,32 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Arith(
}
SBSYMCODELEN = (uint8_t)nTmp;
pDecoder->SBSYMCODELEN = SBSYMCODELEN;
- SBSYMS = FX_Alloc(CJBig2_Image*, SBNUMSYMS);
- JBIG2_memcpy(SBSYMS, SDINSYMS, SDNUMINSYMS * sizeof(CJBig2_Image*));
- JBIG2_memcpy(SBSYMS + SDNUMINSYMS, SDNEWSYMS,
- NSYMSDECODED * sizeof(CJBig2_Image*));
- pDecoder->SBSYMS = SBSYMS;
+ SBSYMS.resize(SBNUMSYMS);
+ std::copy(SDINSYMS, SDINSYMS + SDNUMINSYMS, SBSYMS.begin());
+ for (size_t i = 0; i < NSYMSDECODED; ++i)
+ SBSYMS[i + SDNUMINSYMS] = SDNEWSYMS[i].get();
+ pDecoder->SBSYMS = SBSYMS.data();
pDecoder->SBDEFPIXEL = 0;
pDecoder->SBCOMBOP = JBIG2_COMPOSE_OR;
pDecoder->TRANSPOSED = 0;
pDecoder->REFCORNER = JBIG2_CORNER_TOPLEFT;
pDecoder->SBDSOFFSET = 0;
- std::unique_ptr<CJBig2_HuffmanTable> SBHUFFFS(new CJBig2_HuffmanTable(
- HuffmanTable_B6, HuffmanTable_B6_Size, HuffmanTable_HTOOB_B6));
- std::unique_ptr<CJBig2_HuffmanTable> SBHUFFDS(new CJBig2_HuffmanTable(
- HuffmanTable_B8, HuffmanTable_B8_Size, HuffmanTable_HTOOB_B8));
- std::unique_ptr<CJBig2_HuffmanTable> SBHUFFDT(new CJBig2_HuffmanTable(
- HuffmanTable_B11, HuffmanTable_B11_Size, HuffmanTable_HTOOB_B11));
- std::unique_ptr<CJBig2_HuffmanTable> SBHUFFRDW(
- new CJBig2_HuffmanTable(HuffmanTable_B15, HuffmanTable_B15_Size,
- HuffmanTable_HTOOB_B15));
- std::unique_ptr<CJBig2_HuffmanTable> SBHUFFRDH(
- new CJBig2_HuffmanTable(HuffmanTable_B15, HuffmanTable_B15_Size,
- HuffmanTable_HTOOB_B15));
- std::unique_ptr<CJBig2_HuffmanTable> SBHUFFRDX(
- new CJBig2_HuffmanTable(HuffmanTable_B15, HuffmanTable_B15_Size,
- HuffmanTable_HTOOB_B15));
- std::unique_ptr<CJBig2_HuffmanTable> SBHUFFRDY(
- new CJBig2_HuffmanTable(HuffmanTable_B15, HuffmanTable_B15_Size,
- HuffmanTable_HTOOB_B15));
- std::unique_ptr<CJBig2_HuffmanTable> SBHUFFRSIZE(
- new CJBig2_HuffmanTable(HuffmanTable_B1, HuffmanTable_B1_Size,
- HuffmanTable_HTOOB_B1));
+ auto SBHUFFFS = pdfium::MakeUnique<CJBig2_HuffmanTable>(
+ HuffmanTable_B6, HuffmanTable_B6_Size, HuffmanTable_HTOOB_B6);
+ auto SBHUFFDS = pdfium::MakeUnique<CJBig2_HuffmanTable>(
+ HuffmanTable_B8, HuffmanTable_B8_Size, HuffmanTable_HTOOB_B8);
+ auto SBHUFFDT = pdfium::MakeUnique<CJBig2_HuffmanTable>(
+ HuffmanTable_B11, HuffmanTable_B11_Size, HuffmanTable_HTOOB_B11);
+ auto SBHUFFRDW = pdfium::MakeUnique<CJBig2_HuffmanTable>(
+ HuffmanTable_B15, HuffmanTable_B15_Size, HuffmanTable_HTOOB_B15);
+ auto SBHUFFRDH = pdfium::MakeUnique<CJBig2_HuffmanTable>(
+ HuffmanTable_B15, HuffmanTable_B15_Size, HuffmanTable_HTOOB_B15);
+ auto SBHUFFRDX = pdfium::MakeUnique<CJBig2_HuffmanTable>(
+ HuffmanTable_B15, HuffmanTable_B15_Size, HuffmanTable_HTOOB_B15);
+ auto SBHUFFRDY = pdfium::MakeUnique<CJBig2_HuffmanTable>(
+ HuffmanTable_B15, HuffmanTable_B15_Size, HuffmanTable_HTOOB_B15);
+ auto SBHUFFRSIZE = pdfium::MakeUnique<CJBig2_HuffmanTable>(
+ HuffmanTable_B1, HuffmanTable_B1_Size, HuffmanTable_HTOOB_B1);
pDecoder->SBHUFFFS = SBHUFFFS.get();
pDecoder->SBHUFFDS = SBHUFFDS.get();
pDecoder->SBHUFFDT = SBHUFFDT.get();
@@ -187,29 +181,25 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Arith(
ids.IARDY = IARDY.get();
ids.IAID = IAID.get();
BS = pDecoder->decode_Arith(pArithDecoder, grContext->data(), &ids);
- if (!BS) {
- FX_Free(SBSYMS);
- goto failed;
- }
- FX_Free(SBSYMS);
+ if (!BS)
+ return nullptr;
} else if (REFAGGNINST == 1) {
SBNUMSYMS = SDNUMINSYMS + NSYMSDECODED;
uint32_t IDI;
IAID->decode(pArithDecoder, &IDI);
IARDX->decode(pArithDecoder, &RDXI);
IARDY->decode(pArithDecoder, &RDYI);
- if (IDI >= SBNUMSYMS) {
- goto failed;
- }
- SBSYMS = FX_Alloc(CJBig2_Image*, SBNUMSYMS);
- JBIG2_memcpy(SBSYMS, SDINSYMS, SDNUMINSYMS * sizeof(CJBig2_Image*));
- JBIG2_memcpy(SBSYMS + SDNUMINSYMS, SDNEWSYMS,
- NSYMSDECODED * sizeof(CJBig2_Image*));
- if (!SBSYMS[IDI]) {
- FX_Free(SBSYMS);
- goto failed;
- }
- std::unique_ptr<CJBig2_GRRDProc> pGRRD(new CJBig2_GRRDProc());
+ if (IDI >= SBNUMSYMS)
+ return nullptr;
+
+ SBSYMS.resize(SBNUMSYMS);
+ std::copy(SDINSYMS, SDINSYMS + SDNUMINSYMS, SBSYMS.begin());
+ for (size_t i = 0; i < NSYMSDECODED; ++i)
+ SBSYMS[i + SDNUMINSYMS] = SDNEWSYMS[i].get();
+ if (!SBSYMS[IDI])
+ return nullptr;
+
+ auto pGRRD = pdfium::MakeUnique<CJBig2_GRRDProc>();
pGRRD->GRW = SYMWIDTH;
pGRRD->GRH = HCHEIGHT;
pGRRD->GRTEMPLATE = SDRTEMPLATE;
@@ -222,28 +212,24 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Arith(
pGRRD->GRAT[2] = SDRAT[2];
pGRRD->GRAT[3] = SDRAT[3];
BS = pGRRD->decode(pArithDecoder, grContext->data());
- if (!BS) {
- FX_Free(SBSYMS);
- goto failed;
- }
- FX_Free(SBSYMS);
+ if (!BS)
+ return nullptr;
}
}
- SDNEWSYMS[NSYMSDECODED] = BS;
+ SDNEWSYMS[NSYMSDECODED] = pdfium::WrapUnique<CJBig2_Image>(BS);
BS = nullptr;
NSYMSDECODED = NSYMSDECODED + 1;
}
}
EXINDEX = 0;
CUREXFLAG = 0;
- EXFLAGS = FX_Alloc(bool, SDNUMINSYMS + SDNUMNEWSYMS);
+ EXFLAGS.resize(SDNUMINSYMS + SDNUMNEWSYMS);
num_ex_syms = 0;
while (EXINDEX < SDNUMINSYMS + SDNUMNEWSYMS) {
IAEX->decode(pArithDecoder, (int*)&EXRUNLENGTH);
- if (EXINDEX + EXRUNLENGTH > SDNUMINSYMS + SDNUMNEWSYMS) {
- FX_Free(EXFLAGS);
- goto failed;
- }
+ if (EXINDEX + EXRUNLENGTH > SDNUMINSYMS + SDNUMNEWSYMS)
+ return nullptr;
+
if (EXRUNLENGTH != 0) {
for (I = EXINDEX; I < EXINDEX + EXRUNLENGTH; I++) {
if (CUREXFLAG)
@@ -254,39 +240,24 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Arith(
EXINDEX = EXINDEX + EXRUNLENGTH;
CUREXFLAG = !CUREXFLAG;
}
- if (num_ex_syms > SDNUMEXSYMS) {
- FX_Free(EXFLAGS);
- goto failed;
- }
+ if (num_ex_syms > SDNUMEXSYMS)
+ return nullptr;
pDict = pdfium::MakeUnique<CJBig2_SymbolDict>();
I = J = 0;
for (I = 0; I < SDNUMINSYMS + SDNUMNEWSYMS; I++) {
- if (EXFLAGS[I] && J < SDNUMEXSYMS) {
- if (I < SDNUMINSYMS) {
- pDict->AddImage(SDINSYMS[I]
- ? pdfium::MakeUnique<CJBig2_Image>(*SDINSYMS[I])
- : nullptr);
- } else {
- pDict->AddImage(pdfium::WrapUnique(SDNEWSYMS[I - SDNUMINSYMS]));
- }
- ++J;
- } else if (!EXFLAGS[I] && I >= SDNUMINSYMS) {
- delete SDNEWSYMS[I - SDNUMINSYMS];
+ if (!EXFLAGS[I] || J >= SDNUMEXSYMS)
+ continue;
+ if (I < SDNUMINSYMS) {
+ pDict->AddImage(SDINSYMS[I]
+ ? pdfium::MakeUnique<CJBig2_Image>(*SDINSYMS[I])
+ : nullptr);
+ } else {
+ pDict->AddImage(std::move(SDNEWSYMS[I - SDNUMINSYMS]));
}
+ ++J;
}
- FX_Free(EXFLAGS);
- FX_Free(SDNEWSYMS);
return pDict.release();
-failed:
- for (I = 0; I < NSYMSDECODED; I++) {
- if (SDNEWSYMS[I]) {
- delete SDNEWSYMS[I];
- SDNEWSYMS[I] = nullptr;
- }
- }
- FX_Free(SDNEWSYMS);
- return nullptr;
}
CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman(
@@ -294,53 +265,49 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman(
std::vector<JBig2ArithCtx>* gbContext,
std::vector<JBig2ArithCtx>* grContext,
IFX_Pause* pPause) {
- CJBig2_Image** SDNEWSYMS;
- uint32_t* SDNEWSYMWIDTHS;
+ std::vector<std::unique_ptr<CJBig2_Image>> SDNEWSYMS;
+ std::vector<uint32_t> SDNEWSYMWIDTHS;
uint32_t HCHEIGHT, NSYMSDECODED;
int32_t HCDH;
uint32_t SYMWIDTH, TOTWIDTH, HCFIRSTSYM;
int32_t DW;
CJBig2_Image *BS, *BHC;
uint32_t I, J, REFAGGNINST;
- bool* EXFLAGS;
+ std::vector<bool> EXFLAGS;
uint32_t EXINDEX;
bool CUREXFLAG;
uint32_t EXRUNLENGTH;
- int32_t nVal, nBits;
+ int32_t nVal;
uint32_t nTmp;
uint32_t SBNUMSYMS;
uint8_t SBSYMCODELEN;
- JBig2HuffmanCode* SBSYMCODES;
+ std::vector<JBig2HuffmanCode> SBSYMCODES;
uint32_t IDI;
int32_t RDXI, RDYI;
uint32_t BMSIZE;
uint32_t stride;
uint32_t num_ex_syms;
- CJBig2_Image** SBSYMS;
- std::unique_ptr<CJBig2_HuffmanDecoder> pHuffmanDecoder(
- new CJBig2_HuffmanDecoder(pStream));
- SDNEWSYMS = FX_Alloc(CJBig2_Image*, SDNUMNEWSYMS);
- FXSYS_memset(SDNEWSYMS, 0, SDNUMNEWSYMS * sizeof(CJBig2_Image*));
- SDNEWSYMWIDTHS = nullptr;
+ // Pointers are not owned
+ std::vector<CJBig2_Image*> SBSYMS;
+ auto pHuffmanDecoder = pdfium::MakeUnique<CJBig2_HuffmanDecoder>(pStream);
+ SDNEWSYMS.resize(SDNUMNEWSYMS);
BHC = nullptr;
- if (SDREFAGG == 0) {
- SDNEWSYMWIDTHS = FX_Alloc(uint32_t, SDNUMNEWSYMS);
- FXSYS_memset(SDNEWSYMWIDTHS, 0, SDNUMNEWSYMS * sizeof(uint32_t));
- }
- std::unique_ptr<CJBig2_SymbolDict> pDict(new CJBig2_SymbolDict());
+ if (SDREFAGG == 0)
+ SDNEWSYMWIDTHS.resize(SDNUMNEWSYMS);
+ auto pDict = pdfium::MakeUnique<CJBig2_SymbolDict>();
std::unique_ptr<CJBig2_HuffmanTable> pTable;
HCHEIGHT = 0;
NSYMSDECODED = 0;
BS = nullptr;
while (NSYMSDECODED < SDNUMNEWSYMS) {
- if (pHuffmanDecoder->decodeAValue(SDHUFFDH, &HCDH) != 0) {
- goto failed;
- }
+ if (pHuffmanDecoder->decodeAValue(SDHUFFDH, &HCDH) != 0)
+ return nullptr;
+
HCHEIGHT = HCHEIGHT + HCDH;
- if ((int)HCHEIGHT < 0 || (int)HCHEIGHT > JBIG2_MAX_IMAGE_SIZE) {
- goto failed;
- }
+ if ((int)HCHEIGHT < 0 || (int)HCHEIGHT > JBIG2_MAX_IMAGE_SIZE)
+ return nullptr;
+
SYMWIDTH = 0;
TOTWIDTH = 0;
HCFIRSTSYM = NSYMSDECODED;
@@ -349,14 +316,14 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman(
if (nVal == JBIG2_OOB) {
break;
} else if (nVal != 0) {
- goto failed;
+ return nullptr;
} else {
- if (NSYMSDECODED >= SDNUMNEWSYMS) {
- goto failed;
- }
+ if (NSYMSDECODED >= SDNUMNEWSYMS)
+ return nullptr;
+
SYMWIDTH = SYMWIDTH + DW;
if ((int)SYMWIDTH < 0 || (int)SYMWIDTH > JBIG2_MAX_IMAGE_SIZE) {
- goto failed;
+ return nullptr;
} else if (HCHEIGHT == 0 || SYMWIDTH == 0) {
TOTWIDTH = TOTWIDTH + SYMWIDTH;
SDNEWSYMS[NSYMSDECODED] = nullptr;
@@ -368,11 +335,11 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman(
if (SDREFAGG == 1) {
if (pHuffmanDecoder->decodeAValue(SDHUFFAGGINST, (int*)&REFAGGNINST) !=
0) {
- goto failed;
+ return nullptr;
}
BS = nullptr;
if (REFAGGNINST > 1) {
- std::unique_ptr<CJBig2_TRDProc> pDecoder(new CJBig2_TRDProc());
+ auto pDecoder = pdfium::MakeUnique<CJBig2_TRDProc>();
pDecoder->SBHUFF = SDHUFF;
pDecoder->SBREFINE = 1;
pDecoder->SBW = SYMWIDTH;
@@ -381,7 +348,7 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman(
pDecoder->SBSTRIPS = 1;
pDecoder->SBNUMSYMS = SDNUMINSYMS + NSYMSDECODED;
SBNUMSYMS = pDecoder->SBNUMSYMS;
- SBSYMCODES = FX_Alloc(JBig2HuffmanCode, SBNUMSYMS);
+ SBSYMCODES.resize(SBNUMSYMS);
nTmp = 1;
while ((uint32_t)(1 << nTmp) < SBNUMSYMS) {
nTmp++;
@@ -390,38 +357,33 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman(
SBSYMCODES[I].codelen = nTmp;
SBSYMCODES[I].code = I;
}
- pDecoder->SBSYMCODES = SBSYMCODES;
- SBSYMS = FX_Alloc(CJBig2_Image*, SBNUMSYMS);
- JBIG2_memcpy(SBSYMS, SDINSYMS, SDNUMINSYMS * sizeof(CJBig2_Image*));
- JBIG2_memcpy(SBSYMS + SDNUMINSYMS, SDNEWSYMS,
- NSYMSDECODED * sizeof(CJBig2_Image*));
- pDecoder->SBSYMS = SBSYMS;
+ pDecoder->SBSYMCODES = SBSYMCODES.data();
+ SBSYMS.resize(SBNUMSYMS);
+ std::copy(SDINSYMS, SDINSYMS + SDNUMINSYMS, SBSYMS.begin());
+ for (size_t i = 0; i < NSYMSDECODED; ++i)
+ SBSYMS[i + SDNUMINSYMS] = SDNEWSYMS[i].get();
+ pDecoder->SBSYMS = SBSYMS.data();
pDecoder->SBDEFPIXEL = 0;
pDecoder->SBCOMBOP = JBIG2_COMPOSE_OR;
pDecoder->TRANSPOSED = 0;
pDecoder->REFCORNER = JBIG2_CORNER_TOPLEFT;
pDecoder->SBDSOFFSET = 0;
- std::unique_ptr<CJBig2_HuffmanTable> SBHUFFFS(new CJBig2_HuffmanTable(
- HuffmanTable_B6, HuffmanTable_B6_Size, HuffmanTable_HTOOB_B6));
- std::unique_ptr<CJBig2_HuffmanTable> SBHUFFDS(new CJBig2_HuffmanTable(
- HuffmanTable_B8, HuffmanTable_B8_Size, HuffmanTable_HTOOB_B8));
- std::unique_ptr<CJBig2_HuffmanTable> SBHUFFDT(new CJBig2_HuffmanTable(
- HuffmanTable_B11, HuffmanTable_B11_Size, HuffmanTable_HTOOB_B11));
- std::unique_ptr<CJBig2_HuffmanTable> SBHUFFRDW(
- new CJBig2_HuffmanTable(HuffmanTable_B15, HuffmanTable_B15_Size,
- HuffmanTable_HTOOB_B15));
- std::unique_ptr<CJBig2_HuffmanTable> SBHUFFRDH(
- new CJBig2_HuffmanTable(HuffmanTable_B15, HuffmanTable_B15_Size,
- HuffmanTable_HTOOB_B15));
- std::unique_ptr<CJBig2_HuffmanTable> SBHUFFRDX(
- new CJBig2_HuffmanTable(HuffmanTable_B15, HuffmanTable_B15_Size,
- HuffmanTable_HTOOB_B15));
- std::unique_ptr<CJBig2_HuffmanTable> SBHUFFRDY(
- new CJBig2_HuffmanTable(HuffmanTable_B15, HuffmanTable_B15_Size,
- HuffmanTable_HTOOB_B15));
- std::unique_ptr<CJBig2_HuffmanTable> SBHUFFRSIZE(
- new CJBig2_HuffmanTable(HuffmanTable_B1, HuffmanTable_B1_Size,
- HuffmanTable_HTOOB_B1));
+ auto SBHUFFFS = pdfium::MakeUnique<CJBig2_HuffmanTable>(
+ HuffmanTable_B6, HuffmanTable_B6_Size, HuffmanTable_HTOOB_B6);
+ auto SBHUFFDS = pdfium::MakeUnique<CJBig2_HuffmanTable>(
+ HuffmanTable_B8, HuffmanTable_B8_Size, HuffmanTable_HTOOB_B8);
+ auto SBHUFFDT = pdfium::MakeUnique<CJBig2_HuffmanTable>(
+ HuffmanTable_B11, HuffmanTable_B11_Size, HuffmanTable_HTOOB_B11);
+ auto SBHUFFRDW = pdfium::MakeUnique<CJBig2_HuffmanTable>(
+ HuffmanTable_B15, HuffmanTable_B15_Size, HuffmanTable_HTOOB_B15);
+ auto SBHUFFRDH = pdfium::MakeUnique<CJBig2_HuffmanTable>(
+ HuffmanTable_B15, HuffmanTable_B15_Size, HuffmanTable_HTOOB_B15);
+ auto SBHUFFRDX = pdfium::MakeUnique<CJBig2_HuffmanTable>(
+ HuffmanTable_B15, HuffmanTable_B15_Size, HuffmanTable_HTOOB_B15);
+ auto SBHUFFRDY = pdfium::MakeUnique<CJBig2_HuffmanTable>(
+ HuffmanTable_B15, HuffmanTable_B15_Size, HuffmanTable_HTOOB_B15);
+ auto SBHUFFRSIZE = pdfium::MakeUnique<CJBig2_HuffmanTable>(
+ HuffmanTable_B1, HuffmanTable_B1_Size, HuffmanTable_HTOOB_B1);
pDecoder->SBHUFFFS = SBHUFFFS.get();
pDecoder->SBHUFFDS = SBHUFFDS.get();
pDecoder->SBHUFFDT = SBHUFFDT.get();
@@ -436,13 +398,9 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman(
pDecoder->SBRAT[2] = SDRAT[2];
pDecoder->SBRAT[3] = SDRAT[3];
BS = pDecoder->decode_Huffman(pStream, grContext->data());
- if (!BS) {
- FX_Free(SBSYMCODES);
- FX_Free(SBSYMS);
- goto failed;
- }
- FX_Free(SBSYMCODES);
- FX_Free(SBSYMS);
+ if (!BS)
+ return nullptr;
+
} else if (REFAGGNINST == 1) {
SBNUMSYMS = SDNUMINSYMS + SDNUMNEWSYMS;
nTmp = 1;
@@ -450,48 +408,35 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman(
nTmp++;
}
SBSYMCODELEN = (uint8_t)nTmp;
- SBSYMCODES = FX_Alloc(JBig2HuffmanCode, SBNUMSYMS);
- for (I = 0; I < SBNUMSYMS; I++) {
- SBSYMCODES[I].codelen = SBSYMCODELEN;
- SBSYMCODES[I].code = I;
- }
- nVal = 0;
- nBits = 0;
+ uint32_t uVal = 0;
for (;;) {
- if (pStream->read1Bit(&nTmp) != 0) {
- FX_Free(SBSYMCODES);
- goto failed;
- }
- nVal = (nVal << 1) | nTmp;
- for (IDI = 0; IDI < SBNUMSYMS; IDI++) {
- if ((nVal == SBSYMCODES[IDI].code) &&
- (nBits == SBSYMCODES[IDI].codelen)) {
- break;
- }
- }
- if (IDI < SBNUMSYMS) {
+ if (pStream->read1Bit(&nTmp) != 0)
+ return nullptr;
+
+ uVal = (uVal << 1) | nTmp;
+ if (uVal >= SBNUMSYMS)
+ return nullptr;
+
+ IDI = SBSYMCODELEN == 0 ? uVal : SBNUMSYMS;
+ if (IDI < SBNUMSYMS)
break;
- }
}
- FX_Free(SBSYMCODES);
- std::unique_ptr<CJBig2_HuffmanTable> SBHUFFRDX(
- new CJBig2_HuffmanTable(HuffmanTable_B15, HuffmanTable_B15_Size,
- HuffmanTable_HTOOB_B15));
- std::unique_ptr<CJBig2_HuffmanTable> SBHUFFRSIZE(
- new CJBig2_HuffmanTable(HuffmanTable_B1, HuffmanTable_B1_Size,
- HuffmanTable_HTOOB_B1));
+ auto SBHUFFRDX = pdfium::MakeUnique<CJBig2_HuffmanTable>(
+ HuffmanTable_B15, HuffmanTable_B15_Size, HuffmanTable_HTOOB_B15);
+ auto SBHUFFRSIZE = pdfium::MakeUnique<CJBig2_HuffmanTable>(
+ HuffmanTable_B1, HuffmanTable_B1_Size, HuffmanTable_HTOOB_B1);
if ((pHuffmanDecoder->decodeAValue(SBHUFFRDX.get(), &RDXI) != 0) ||
(pHuffmanDecoder->decodeAValue(SBHUFFRDX.get(), &RDYI) != 0) ||
(pHuffmanDecoder->decodeAValue(SBHUFFRSIZE.get(), &nVal) != 0)) {
- goto failed;
+ return nullptr;
}
pStream->alignByte();
nTmp = pStream->getOffset();
- SBSYMS = FX_Alloc(CJBig2_Image*, SBNUMSYMS);
- JBIG2_memcpy(SBSYMS, SDINSYMS, SDNUMINSYMS * sizeof(CJBig2_Image*));
- JBIG2_memcpy(SBSYMS + SDNUMINSYMS, SDNEWSYMS,
- NSYMSDECODED * sizeof(CJBig2_Image*));
- std::unique_ptr<CJBig2_GRRDProc> pGRRD(new CJBig2_GRRDProc());
+ SBSYMS.resize(SBNUMSYMS);
+ std::copy(SDINSYMS, SDINSYMS + SDNUMINSYMS, SBSYMS.begin());
+ for (size_t i = 0; i < NSYMSDECODED; ++i)
+ SBSYMS[i + SDNUMINSYMS] = SDNEWSYMS[i].get();
+ auto pGRRD = pdfium::MakeUnique<CJBig2_GRRDProc>();
pGRRD->GRW = SYMWIDTH;
pGRRD->GRH = HCHEIGHT;
pGRRD->GRTEMPLATE = SDRTEMPLATE;
@@ -503,33 +448,28 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman(
pGRRD->GRAT[1] = SDRAT[1];
pGRRD->GRAT[2] = SDRAT[2];
pGRRD->GRAT[3] = SDRAT[3];
- std::unique_ptr<CJBig2_ArithDecoder> pArithDecoder(
- new CJBig2_ArithDecoder(pStream));
+ auto pArithDecoder = pdfium::MakeUnique<CJBig2_ArithDecoder>(pStream);
BS = pGRRD->decode(pArithDecoder.get(), grContext->data());
- if (!BS) {
- FX_Free(SBSYMS);
- goto failed;
- }
+ if (!BS)
+ return nullptr;
+
pStream->alignByte();
pStream->offset(2);
if ((uint32_t)nVal != (pStream->getOffset() - nTmp)) {
delete BS;
- FX_Free(SBSYMS);
- goto failed;
+ return nullptr;
}
- FX_Free(SBSYMS);
}
- SDNEWSYMS[NSYMSDECODED] = BS;
+ SDNEWSYMS[NSYMSDECODED] = pdfium::WrapUnique<CJBig2_Image>(BS);
}
- if (SDREFAGG == 0) {
+ if (SDREFAGG == 0)
SDNEWSYMWIDTHS[NSYMSDECODED] = SYMWIDTH;
- }
NSYMSDECODED = NSYMSDECODED + 1;
}
if (SDREFAGG == 0) {
- if (pHuffmanDecoder->decodeAValue(SDHUFFBMSIZE, (int32_t*)&BMSIZE) != 0) {
- goto failed;
- }
+ if (pHuffmanDecoder->decodeAValue(SDHUFFBMSIZE, (int32_t*)&BMSIZE) != 0)
+ return nullptr;
+
pStream->alignByte();
if (BMSIZE == 0) {
stride = (TOTWIDTH + 7) >> 3;
@@ -541,10 +481,10 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman(
pStream->offset(stride);
}
} else {
- goto failed;
+ return nullptr;
}
} else {
- std::unique_ptr<CJBig2_GRDProc> pGRD(new CJBig2_GRDProc());
+ auto pGRD = pdfium::MakeUnique<CJBig2_GRDProc>();
pGRD->MMR = 1;
pGRD->GBW = TOTWIDTH;
pGRD->GBH = HCHEIGHT;
@@ -556,7 +496,8 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman(
continue;
}
for (I = HCFIRSTSYM; I < NSYMSDECODED; I++) {
- SDNEWSYMS[I] = BHC->subImage(nTmp, 0, SDNEWSYMWIDTHS[I], HCHEIGHT);
+ SDNEWSYMS[I] = pdfium::WrapUnique<CJBig2_Image>(
+ BHC->subImage(nTmp, 0, SDNEWSYMWIDTHS[I], HCHEIGHT));
nTmp += SDNEWSYMWIDTHS[I];
}
delete BHC;
@@ -567,17 +508,15 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman(
CUREXFLAG = 0;
pTable = pdfium::MakeUnique<CJBig2_HuffmanTable>(
HuffmanTable_B1, HuffmanTable_B1_Size, HuffmanTable_HTOOB_B1);
- EXFLAGS = FX_Alloc(bool, SDNUMINSYMS + SDNUMNEWSYMS);
+ EXFLAGS.resize(SDNUMINSYMS + SDNUMNEWSYMS);
num_ex_syms = 0;
while (EXINDEX < SDNUMINSYMS + SDNUMNEWSYMS) {
- if (pHuffmanDecoder->decodeAValue(pTable.get(), (int*)&EXRUNLENGTH) != 0) {
- FX_Free(EXFLAGS);
- goto failed;
- }
- if (EXINDEX + EXRUNLENGTH > SDNUMINSYMS + SDNUMNEWSYMS) {
- FX_Free(EXFLAGS);
- goto failed;
- }
+ if (pHuffmanDecoder->decodeAValue(pTable.get(), (int*)&EXRUNLENGTH) != 0)
+ return nullptr;
+
+ if (EXINDEX + EXRUNLENGTH > SDNUMINSYMS + SDNUMNEWSYMS)
+ return nullptr;
+
if (EXRUNLENGTH != 0) {
for (I = EXINDEX; I < EXINDEX + EXRUNLENGTH; I++) {
if (CUREXFLAG)
@@ -589,39 +528,21 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman(
EXINDEX = EXINDEX + EXRUNLENGTH;
CUREXFLAG = !CUREXFLAG;
}
- if (num_ex_syms > SDNUMEXSYMS) {
- FX_Free(EXFLAGS);
- goto failed;
- }
+ if (num_ex_syms > SDNUMEXSYMS)
+ return nullptr;
I = J = 0;
for (I = 0; I < SDNUMINSYMS + SDNUMNEWSYMS; I++) {
- if (EXFLAGS[I] && J < SDNUMEXSYMS) {
- if (I < SDNUMINSYMS) {
- pDict->AddImage(SDINSYMS[I]
- ? pdfium::MakeUnique<CJBig2_Image>(*SDINSYMS[I])
- : nullptr);
- } else {
- pDict->AddImage(pdfium::WrapUnique(SDNEWSYMS[I - SDNUMINSYMS]));
- }
- ++J;
- } else if (!EXFLAGS[I] && I >= SDNUMINSYMS) {
- delete SDNEWSYMS[I - SDNUMINSYMS];
+ if (!EXFLAGS[I] || J >= SDNUMEXSYMS)
+ continue;
+ if (I < SDNUMINSYMS) {
+ pDict->AddImage(SDINSYMS[I]
+ ? pdfium::MakeUnique<CJBig2_Image>(*SDINSYMS[I])
+ : nullptr);
+ } else {
+ pDict->AddImage(std::move(SDNEWSYMS[I - SDNUMINSYMS]));
}
- }
- FX_Free(EXFLAGS);
- FX_Free(SDNEWSYMS);
- if (SDREFAGG == 0) {
- FX_Free(SDNEWSYMWIDTHS);
+ ++J;
}
return pDict.release();
-failed:
- for (I = 0; I < NSYMSDECODED; I++) {
- delete SDNEWSYMS[I];
- }
- FX_Free(SDNEWSYMS);
- if (SDREFAGG == 0) {
- FX_Free(SDNEWSYMWIDTHS);
- }
- return nullptr;
}
diff --git a/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_SddProc.h b/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_SddProc.h
index 4df0cb41460..86479c7231f 100644
--- a/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_SddProc.h
+++ b/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_SddProc.h
@@ -29,7 +29,6 @@ class CJBig2_SDDProc {
std::vector<JBig2ArithCtx>* grContext,
IFX_Pause* pPause);
- public:
bool SDHUFF;
bool SDREFAGG;
uint32_t SDNUMINSYMS;
diff --git a/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_TrdProc.cpp b/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_TrdProc.cpp
index 84042dbd8ce..f681e05569b 100644
--- a/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_TrdProc.cpp
+++ b/chromium/third_party/pdfium/core/fxcodec/jbig2/JBig2_TrdProc.cpp
@@ -16,9 +16,8 @@
CJBig2_Image* CJBig2_TRDProc::decode_Huffman(CJBig2_BitStream* pStream,
JBig2ArithCtx* grContext) {
- std::unique_ptr<CJBig2_HuffmanDecoder> pHuffmanDecoder(
- new CJBig2_HuffmanDecoder(pStream));
- std::unique_ptr<CJBig2_Image> SBREG(new CJBig2_Image(SBW, SBH));
+ auto pHuffmanDecoder = pdfium::MakeUnique<CJBig2_HuffmanDecoder>(pStream);
+ auto SBREG = pdfium::MakeUnique<CJBig2_Image>(SBW, SBH);
SBREG->fill(SBDEFPIXEL);
int32_t STRIPT;
if (pHuffmanDecoder->decodeAValue(SBHUFFDT, &STRIPT) != 0)
@@ -70,7 +69,7 @@ CJBig2_Image* CJBig2_TRDProc::decode_Huffman(CJBig2_BitStream* pStream,
CURT = nVal;
}
int32_t TI = STRIPT + CURT;
- int32_t nVal = 0;
+ pdfium::base::CheckedNumeric<int32_t> nVal = 0;
int32_t nBits = 0;
uint32_t IDI;
for (;;) {
@@ -78,11 +77,15 @@ CJBig2_Image* CJBig2_TRDProc::decode_Huffman(CJBig2_BitStream* pStream,
if (pStream->read1Bit(&nTmp) != 0)
return nullptr;
- nVal = (nVal << 1) | nTmp;
+ nVal <<= 1;
+ if (!nVal.IsValid())
+ return nullptr;
+
+ nVal |= nTmp;
nBits++;
for (IDI = 0; IDI < SBNUMSYMS; IDI++) {
if ((nBits == SBSYMCODES[IDI].codelen) &&
- (nVal == SBSYMCODES[IDI].code)) {
+ (nVal.ValueOrDie() == SBSYMCODES[IDI].code)) {
break;
}
}
@@ -102,11 +105,12 @@ CJBig2_Image* CJBig2_TRDProc::decode_Huffman(CJBig2_BitStream* pStream,
int32_t RDHI;
int32_t RDXI;
int32_t RDYI;
+ int32_t HUFFRSIZE;
if ((pHuffmanDecoder->decodeAValue(SBHUFFRDW, &RDWI) != 0) ||
(pHuffmanDecoder->decodeAValue(SBHUFFRDH, &RDHI) != 0) ||
(pHuffmanDecoder->decodeAValue(SBHUFFRDX, &RDXI) != 0) ||
(pHuffmanDecoder->decodeAValue(SBHUFFRDY, &RDYI) != 0) ||
- (pHuffmanDecoder->decodeAValue(SBHUFFRSIZE, &nVal) != 0)) {
+ (pHuffmanDecoder->decodeAValue(SBHUFFRSIZE, &HUFFRSIZE) != 0)) {
return nullptr;
}
pStream->alignByte();
@@ -120,7 +124,7 @@ CJBig2_Image* CJBig2_TRDProc::decode_Huffman(CJBig2_BitStream* pStream,
if ((int)(WOI + RDWI) < 0 || (int)(HOI + RDHI) < 0)
return nullptr;
- std::unique_ptr<CJBig2_GRRDProc> pGRRD(new CJBig2_GRRDProc());
+ auto pGRRD = pdfium::MakeUnique<CJBig2_GRRDProc>();
pGRRD->GRW = WOI + RDWI;
pGRRD->GRH = HOI + RDHI;
pGRRD->GRTEMPLATE = SBRTEMPLATE;
@@ -134,8 +138,7 @@ CJBig2_Image* CJBig2_TRDProc::decode_Huffman(CJBig2_BitStream* pStream,
pGRRD->GRAT[3] = SBRAT[3];
{
- std::unique_ptr<CJBig2_ArithDecoder> pArithDecoder(
- new CJBig2_ArithDecoder(pStream));
+ auto pArithDecoder = pdfium::MakeUnique<CJBig2_ArithDecoder>(pStream);
IBI = pGRRD->decode(pArithDecoder.get(), grContext);
if (!IBI)
return nullptr;
@@ -143,7 +146,7 @@ CJBig2_Image* CJBig2_TRDProc::decode_Huffman(CJBig2_BitStream* pStream,
pStream->alignByte();
pStream->offset(2);
- if ((uint32_t)nVal != (pStream->getOffset() - nTmp)) {
+ if (static_cast<uint32_t>(HUFFRSIZE) != (pStream->getOffset() - nTmp)) {
delete IBI;
return nullptr;
}
@@ -264,7 +267,7 @@ CJBig2_Image* CJBig2_TRDProc::decode_Arith(CJBig2_ArithDecoder* pArithDecoder,
pIARDY = IARDY.get();
pIAID = IAID.get();
}
- std::unique_ptr<CJBig2_Image> SBREG(new CJBig2_Image(SBW, SBH));
+ auto SBREG = pdfium::MakeUnique<CJBig2_Image>(SBW, SBH);
SBREG->fill(SBDEFPIXEL);
int32_t STRIPT;
if (!pIADT->decode(pArithDecoder, &STRIPT))
@@ -335,7 +338,7 @@ CJBig2_Image* CJBig2_TRDProc::decode_Arith(CJBig2_ArithDecoder* pArithDecoder,
if ((int)(WOI + RDWI) < 0 || (int)(HOI + RDHI) < 0)
return nullptr;
- std::unique_ptr<CJBig2_GRRDProc> pGRRD(new CJBig2_GRRDProc());
+ auto pGRRD = pdfium::MakeUnique<CJBig2_GRRDProc>();
pGRRD->GRW = WOI + RDWI;
pGRRD->GRH = HOI + RDHI;
pGRRD->GRTEMPLATE = SBRTEMPLATE;
diff --git a/chromium/third_party/pdfium/core/fxcodec/lbmp/fx_bmp.cpp b/chromium/third_party/pdfium/core/fxcodec/lbmp/fx_bmp.cpp
index 2b072a4a0c0..e4fa17dc89b 100644
--- a/chromium/third_party/pdfium/core/fxcodec/lbmp/fx_bmp.cpp
+++ b/chromium/third_party/pdfium/core/fxcodec/lbmp/fx_bmp.cpp
@@ -7,6 +7,7 @@
#include "core/fxcodec/lbmp/fx_bmp.h"
#include <algorithm>
+#include <limits>
namespace {
@@ -24,6 +25,12 @@ void SetDWord_LSBFirst(uint8_t* p, uint32_t v) {
p[2] = (uint8_t)(v >> 16);
p[3] = (uint8_t)(v >> 24);
}
+
+uint8_t HalfRoundUp(uint8_t value) {
+ uint16_t value16 = value;
+ return static_cast<uint8_t>((value16 + 1) / 2);
+}
+
} // namespace
uint16_t GetWord_LSBFirst(uint8_t* p) {
@@ -33,14 +40,14 @@ void SetWord_LSBFirst(uint8_t* p, uint16_t v) {
p[0] = (uint8_t)v;
p[1] = (uint8_t)(v >> 8);
}
-void bmp_error(bmp_decompress_struct_p bmp_ptr, const FX_CHAR* err_msg) {
+void bmp_error(bmp_decompress_struct_p bmp_ptr, const char* err_msg) {
if (bmp_ptr && bmp_ptr->bmp_error_fn) {
bmp_ptr->bmp_error_fn(bmp_ptr, err_msg);
}
}
bmp_decompress_struct_p bmp_create_decompress() {
bmp_decompress_struct_p bmp_ptr = FX_Alloc(bmp_decompress_struct, 1);
- FXSYS_memset(bmp_ptr, 0, sizeof(bmp_decompress_struct));
+ memset(bmp_ptr, 0, sizeof(bmp_decompress_struct));
bmp_ptr->decode_status = BMP_D_STATUS_HEADER;
bmp_ptr->bmp_header_ptr = FX_Alloc(BmpFileHeader, 1);
return bmp_ptr;
@@ -51,9 +58,7 @@ void bmp_destroy_decompress(bmp_decompress_struct_pp bmp_ptr_ptr) {
bmp_decompress_struct_p bmp_ptr = *bmp_ptr_ptr;
*bmp_ptr_ptr = nullptr;
- if (bmp_ptr->out_row_buffer) {
- FX_Free(bmp_ptr->out_row_buffer);
- }
+ FX_Free(bmp_ptr->out_row_buffer);
FX_Free(bmp_ptr->pal_ptr);
FX_Free(bmp_ptr->bmp_header_ptr);
FX_Free(bmp_ptr);
@@ -129,6 +134,10 @@ int32_t bmp_read_header(bmp_decompress_struct_p bmp_ptr) {
bmp_ptr->dpi_y = (int32_t)GetDWord_LSBFirst(
(uint8_t*)&bmp_info_header_ptr->biYPelsPerMeter);
if (bmp_ptr->height < 0) {
+ if (bmp_ptr->height == std::numeric_limits<int>::min()) {
+ bmp_error(bmp_ptr, "Unsupported height");
+ return 0;
+ }
bmp_ptr->height = -bmp_ptr->height;
bmp_ptr->imgTB_flag = true;
}
@@ -159,6 +168,10 @@ int32_t bmp_read_header(bmp_decompress_struct_p bmp_ptr) {
bmp_ptr->dpi_y = GetDWord_LSBFirst(
(uint8_t*)&bmp_info_header_ptr->biYPelsPerMeter);
if (bmp_ptr->height < 0) {
+ if (bmp_ptr->height == std::numeric_limits<int>::min()) {
+ bmp_error(bmp_ptr, "Unsupported height");
+ return 0;
+ }
bmp_ptr->height = -bmp_ptr->height;
bmp_ptr->imgTB_flag = true;
}
@@ -171,7 +184,8 @@ int32_t bmp_read_header(bmp_decompress_struct_p bmp_ptr) {
return 0;
}
}
- if (bmp_ptr->width <= 0 || bmp_ptr->compress_flag > BMP_BITFIELDS) {
+ if (bmp_ptr->width <= 0 || bmp_ptr->width > BMP_MAX_WIDTH ||
+ bmp_ptr->compress_flag > BMP_BITFIELDS) {
bmp_error(bmp_ptr, "The Bmp File Is Corrupt");
return 0;
}
@@ -211,6 +225,7 @@ int32_t bmp_read_header(bmp_decompress_struct_p bmp_ptr) {
break;
}
FX_Free(bmp_ptr->out_row_buffer);
+ bmp_ptr->out_row_buffer = nullptr;
if (bmp_ptr->out_row_bytes <= 0) {
bmp_error(bmp_ptr, "The Bmp File Is Corrupt");
@@ -218,7 +233,7 @@ int32_t bmp_read_header(bmp_decompress_struct_p bmp_ptr) {
}
bmp_ptr->out_row_buffer = FX_Alloc(uint8_t, bmp_ptr->out_row_bytes);
- FXSYS_memset(bmp_ptr->out_row_buffer, 0, bmp_ptr->out_row_bytes);
+ memset(bmp_ptr->out_row_buffer, 0, bmp_ptr->out_row_bytes);
bmp_save_decoding_status(bmp_ptr, BMP_D_STATUS_PAL);
}
if (bmp_ptr->decode_status == BMP_D_STATUS_PAL) {
@@ -373,7 +388,7 @@ int32_t bmp_decode_rgb(bmp_decompress_struct_p bmp_ptr) {
case 8:
case 24:
case 32:
- FXSYS_memcpy(bmp_ptr->out_row_buffer, des_buf, bmp_ptr->src_row_bytes);
+ memcpy(bmp_ptr->out_row_buffer, des_buf, bmp_ptr->src_row_bytes);
break;
}
row_buf = bmp_ptr->out_row_buffer;
@@ -414,7 +429,7 @@ int32_t bmp_decode_rle8(bmp_decompress_struct_p bmp_ptr) {
: (bmp_ptr->height - 1 - bmp_ptr->row_num++),
bmp_ptr->out_row_buffer);
bmp_ptr->col_num = 0;
- FXSYS_memset(bmp_ptr->out_row_buffer, 0, bmp_ptr->out_row_bytes);
+ memset(bmp_ptr->out_row_buffer, 0, bmp_ptr->out_row_bytes);
bmp_save_decoding_status(bmp_ptr, BMP_D_STATUS_DATA);
continue;
}
@@ -443,7 +458,7 @@ int32_t bmp_decode_rle8(bmp_decompress_struct_p bmp_ptr) {
return 0;
}
while (bmp_ptr->row_num < bmp_row_num_next) {
- FXSYS_memset(bmp_ptr->out_row_buffer, 0, bmp_ptr->out_row_bytes);
+ memset(bmp_ptr->out_row_buffer, 0, bmp_ptr->out_row_bytes);
bmp_ptr->bmp_get_row_fn(
bmp_ptr, bmp_ptr->imgTB_flag
? bmp_ptr->row_num++
@@ -452,8 +467,9 @@ int32_t bmp_decode_rle8(bmp_decompress_struct_p bmp_ptr) {
}
} break;
default: {
- if ((int32_t)(*first_byte_ptr) >
- bmp_ptr->src_row_bytes - bmp_ptr->col_num) {
+ int32_t avail_size = bmp_ptr->out_row_bytes - bmp_ptr->col_num;
+ if (!avail_size ||
+ static_cast<int32_t>(*first_byte_ptr) > avail_size) {
bmp_error(bmp_ptr, "The Bmp File Is Corrupt");
return 0;
}
@@ -463,24 +479,24 @@ int32_t bmp_decode_rle8(bmp_decompress_struct_p bmp_ptr) {
bmp_ptr->skip_size = skip_size_org;
return 2;
}
- FXSYS_memcpy(bmp_ptr->out_row_buffer + bmp_ptr->col_num,
- second_byte_ptr, *first_byte_ptr);
+ memcpy(bmp_ptr->out_row_buffer + bmp_ptr->col_num, second_byte_ptr,
+ *first_byte_ptr);
bmp_ptr->col_num += (int32_t)(*first_byte_ptr);
}
}
} break;
default: {
+ int32_t avail_size = bmp_ptr->out_row_bytes - bmp_ptr->col_num;
+ if (!avail_size || static_cast<int32_t>(*first_byte_ptr) > avail_size) {
+ bmp_error(bmp_ptr, "The Bmp File Is Corrupt");
+ return 0;
+ }
if (!bmp_read_data(bmp_ptr, &second_byte_ptr, 1)) {
bmp_ptr->skip_size = skip_size_org;
return 2;
}
- if ((int32_t)(*first_byte_ptr) >
- bmp_ptr->src_row_bytes - bmp_ptr->col_num) {
- bmp_error(bmp_ptr, "The Bmp File Is Corrupt");
- return 0;
- }
- FXSYS_memset(bmp_ptr->out_row_buffer + bmp_ptr->col_num,
- *second_byte_ptr, *first_byte_ptr);
+ memset(bmp_ptr->out_row_buffer + bmp_ptr->col_num, *second_byte_ptr,
+ *first_byte_ptr);
bmp_ptr->col_num += (int32_t)(*first_byte_ptr);
}
}
@@ -488,6 +504,7 @@ int32_t bmp_decode_rle8(bmp_decompress_struct_p bmp_ptr) {
bmp_error(bmp_ptr, "Any Uncontrol Error");
return 0;
}
+
int32_t bmp_decode_rle4(bmp_decompress_struct_p bmp_ptr) {
uint8_t* first_byte_ptr = nullptr;
uint8_t* second_byte_ptr = nullptr;
@@ -516,7 +533,7 @@ int32_t bmp_decode_rle4(bmp_decompress_struct_p bmp_ptr) {
: (bmp_ptr->height - 1 - bmp_ptr->row_num++),
bmp_ptr->out_row_buffer);
bmp_ptr->col_num = 0;
- FXSYS_memset(bmp_ptr->out_row_buffer, 0, bmp_ptr->out_row_bytes);
+ memset(bmp_ptr->out_row_buffer, 0, bmp_ptr->out_row_bytes);
bmp_save_decoding_status(bmp_ptr, BMP_D_STATUS_DATA);
continue;
}
@@ -545,7 +562,7 @@ int32_t bmp_decode_rle4(bmp_decompress_struct_p bmp_ptr) {
return 0;
}
while (bmp_ptr->row_num < bmp_row_num_next) {
- FXSYS_memset(bmp_ptr->out_row_buffer, 0, bmp_ptr->out_row_bytes);
+ memset(bmp_ptr->out_row_buffer, 0, bmp_ptr->out_row_bytes);
bmp_ptr->bmp_get_row_fn(
bmp_ptr, bmp_ptr->imgTB_flag
? bmp_ptr->row_num++
@@ -554,14 +571,18 @@ int32_t bmp_decode_rle4(bmp_decompress_struct_p bmp_ptr) {
}
} break;
default: {
- uint8_t size = (uint8_t)(((uint16_t)(*first_byte_ptr) + 1) >> 1);
- if ((int32_t)*first_byte_ptr >=
- bmp_ptr->out_row_bytes - bmp_ptr->col_num) {
+ int32_t avail_size = bmp_ptr->out_row_bytes - bmp_ptr->col_num;
+ if (!avail_size) {
+ bmp_error(bmp_ptr, "The Bmp File Is Corrupt");
+ return 0;
+ }
+ uint8_t size = HalfRoundUp(*first_byte_ptr);
+ if (static_cast<int32_t>(*first_byte_ptr) > avail_size) {
if (size + (bmp_ptr->col_num >> 1) > bmp_ptr->src_row_bytes) {
bmp_error(bmp_ptr, "The Bmp File Is Corrupt");
return 0;
}
- *first_byte_ptr = bmp_ptr->out_row_bytes - bmp_ptr->col_num - 1;
+ *first_byte_ptr = avail_size - 1;
}
if (!bmp_read_data(bmp_ptr, &second_byte_ptr,
size & 1 ? size + 1 : size)) {
@@ -581,27 +602,28 @@ int32_t bmp_decode_rle4(bmp_decompress_struct_p bmp_ptr) {
}
} break;
default: {
- if (!bmp_read_data(bmp_ptr, &second_byte_ptr, 1)) {
- bmp_ptr->skip_size = skip_size_org;
- return 2;
+ int32_t avail_size = bmp_ptr->out_row_bytes - bmp_ptr->col_num;
+ if (!avail_size) {
+ bmp_error(bmp_ptr, "The Bmp File Is Corrupt");
+ return 0;
}
- if ((int32_t)*first_byte_ptr >
- bmp_ptr->out_row_bytes - bmp_ptr->col_num) {
- uint8_t size = (uint8_t)(((uint16_t)(*first_byte_ptr) + 1) >> 1);
+ if (static_cast<int32_t>(*first_byte_ptr) > avail_size) {
+ uint8_t size = HalfRoundUp(*first_byte_ptr);
if (size + (bmp_ptr->col_num >> 1) > bmp_ptr->src_row_bytes) {
bmp_error(bmp_ptr, "The Bmp File Is Corrupt");
return 0;
}
- *first_byte_ptr = bmp_ptr->out_row_bytes - bmp_ptr->col_num - 1;
+ *first_byte_ptr = avail_size - 1;
+ }
+ if (!bmp_read_data(bmp_ptr, &second_byte_ptr, 1)) {
+ bmp_ptr->skip_size = skip_size_org;
+ return 2;
}
for (uint8_t i = 0; i < *first_byte_ptr; i++) {
- if (i & 0x01) {
- *(bmp_ptr->out_row_buffer + bmp_ptr->col_num++) =
- (*second_byte_ptr & 0x0F);
- } else {
- *(bmp_ptr->out_row_buffer + bmp_ptr->col_num++) =
- ((*second_byte_ptr & 0xF0) >> 4);
- }
+ uint8_t second_byte = *second_byte_ptr;
+ second_byte =
+ i & 0x01 ? (second_byte & 0x0F) : (second_byte & 0xF0) >> 4;
+ *(bmp_ptr->out_row_buffer + bmp_ptr->col_num++) = second_byte;
}
}
}
@@ -609,6 +631,7 @@ int32_t bmp_decode_rle4(bmp_decompress_struct_p bmp_ptr) {
bmp_error(bmp_ptr, "Any Uncontrol Error");
return 0;
}
+
uint8_t* bmp_read_data(bmp_decompress_struct_p bmp_ptr,
uint8_t** des_buf_pp,
uint32_t data_size) {
@@ -646,7 +669,7 @@ bmp_compress_struct_p bmp_create_compress() {
bmp_compress_struct_p bmp_ptr;
bmp_ptr = FX_Alloc(bmp_compress_struct, 1);
if (bmp_ptr) {
- FXSYS_memset(bmp_ptr, 0, sizeof(bmp_compress_struct));
+ memset(bmp_ptr, 0, sizeof(bmp_compress_struct));
}
return bmp_ptr;
}
@@ -711,7 +734,7 @@ static void bmp_encode_bitfields(bmp_compress_struct_p bmp_ptr,
dst_pos = bmp_ptr->file_header.bfOffBits;
dst_size += size;
dst_buf = FX_Realloc(uint8_t, dst_buf, dst_size);
- FXSYS_memset(&dst_buf[dst_pos], 0, size);
+ memset(&dst_buf[dst_pos], 0, size);
uint32_t mask_red;
uint32_t mask_green;
uint32_t mask_blue;
@@ -795,11 +818,10 @@ static void bmp_encode_rgb(bmp_compress_struct_p bmp_ptr,
dst_pos = bmp_ptr->file_header.bfOffBits;
dst_size += size;
dst_buf = FX_Realloc(uint8_t, dst_buf, dst_size);
- FXSYS_memset(&dst_buf[dst_pos], 0, size);
+ memset(&dst_buf[dst_pos], 0, size);
for (int32_t row_num = bmp_ptr->src_row - 1; row_num > -1; row_num--) {
- FXSYS_memcpy(&dst_buf[dst_pos],
- &bmp_ptr->src_buf[row_num * bmp_ptr->src_pitch],
- bmp_ptr->src_pitch);
+ memcpy(&dst_buf[dst_pos], &bmp_ptr->src_buf[row_num * bmp_ptr->src_pitch],
+ bmp_ptr->src_pitch);
dst_pos += dst_pitch;
}
dst_size = dst_pos;
@@ -824,7 +846,7 @@ static void bmp_encode_rle8(bmp_compress_struct_p bmp_ptr,
dst_pos = bmp_ptr->file_header.bfOffBits;
dst_size += size;
dst_buf = FX_Realloc(uint8_t, dst_buf, dst_size);
- FXSYS_memset(&dst_buf[dst_pos], 0, size);
+ memset(&dst_buf[dst_pos], 0, size);
for (int32_t row_num = bmp_ptr->src_row - 1, i = 0; row_num > -1;) {
index = row_num * bmp_ptr->src_pitch;
rle[0] = bmp_rle8_search(&bmp_ptr->src_buf[index + i], size - index - i);
@@ -869,7 +891,7 @@ static void bmp_encode_rle4(bmp_compress_struct_p bmp_ptr,
dst_pos = bmp_ptr->file_header.bfOffBits;
dst_size += size;
dst_buf = FX_Realloc(uint8_t, dst_buf, dst_size);
- FXSYS_memset(&dst_buf[dst_pos], 0, size);
+ memset(&dst_buf[dst_pos], 0, size);
for (int32_t row_num = bmp_ptr->src_row - 1, i = 0; row_num > -1;
rle[1] = 0) {
index = row_num * bmp_ptr->src_pitch;
@@ -910,10 +932,10 @@ bool bmp_encode_image(bmp_compress_struct_p bmp_ptr,
if (!dst_buf)
return false;
- FXSYS_memset(dst_buf, 0, dst_size);
+ memset(dst_buf, 0, dst_size);
bmp_ptr->file_header.bfOffBits = head_size;
if (bmp_ptr->pal_ptr && pal_size) {
- FXSYS_memcpy(&dst_buf[head_size], bmp_ptr->pal_ptr, pal_size);
+ memcpy(&dst_buf[head_size], bmp_ptr->pal_ptr, pal_size);
bmp_ptr->file_header.bfOffBits += pal_size;
}
WriteInfoHeader(&bmp_ptr->info_header, dst_buf);
diff --git a/chromium/third_party/pdfium/core/fxcodec/lbmp/fx_bmp.h b/chromium/third_party/pdfium/core/fxcodec/lbmp/fx_bmp.h
index 27a0f19970d..5d1f799fd1f 100644
--- a/chromium/third_party/pdfium/core/fxcodec/lbmp/fx_bmp.h
+++ b/chromium/third_party/pdfium/core/fxcodec/lbmp/fx_bmp.h
@@ -33,6 +33,8 @@
#define BMP_BIT_555 0
#define BMP_BIT_565 1
#define BMP_MAX_ERROR_SIZE 256
+// Limit width to (MAXINT32 - 31) / 32
+#define BMP_MAX_WIDTH 67108863
#pragma pack(1)
typedef struct tagBmpFileHeader {
uint16_t bfType;
@@ -68,8 +70,8 @@ typedef bmp_decompress_struct* bmp_decompress_struct_p;
typedef bmp_decompress_struct_p* bmp_decompress_struct_pp;
struct tag_bmp_decompress_struct {
jmp_buf jmpbuf;
- FX_CHAR* err_ptr;
- void (*bmp_error_fn)(bmp_decompress_struct_p gif_ptr, const FX_CHAR* err_msg);
+ char* err_ptr;
+ void (*bmp_error_fn)(bmp_decompress_struct_p gif_ptr, const char* err_msg);
void* context_ptr;
@@ -109,7 +111,7 @@ struct tag_bmp_decompress_struct {
uint32_t skip_size;
int32_t decode_status;
};
-void bmp_error(bmp_decompress_struct_p bmp_ptr, const FX_CHAR* err_msg);
+void bmp_error(bmp_decompress_struct_p bmp_ptr, const char* err_msg);
bmp_decompress_struct_p bmp_create_decompress();
void bmp_destroy_decompress(bmp_decompress_struct_pp bmp_ptr_ptr);
int32_t bmp_read_header(bmp_decompress_struct_p bmp_ptr);
diff --git a/chromium/third_party/pdfium/core/fxcodec/lgif/fx_gif.cpp b/chromium/third_party/pdfium/core/fxcodec/lgif/fx_gif.cpp
index d62dacb36c2..3d5d0e23259 100644
--- a/chromium/third_party/pdfium/core/fxcodec/lgif/fx_gif.cpp
+++ b/chromium/third_party/pdfium/core/fxcodec/lgif/fx_gif.cpp
@@ -18,7 +18,7 @@ uint32_t CGifLZWDecoder::GetAvailInput() {
return avail_in;
}
-CGifLZWDecoder::CGifLZWDecoder(FX_CHAR* error_ptr)
+CGifLZWDecoder::CGifLZWDecoder(char* error_ptr)
: code_size(0),
code_size_cur(0),
code_clear(0),
@@ -52,8 +52,8 @@ void CGifLZWDecoder::ClearTable() {
code_size_cur = code_size + 1;
code_next = code_end + 1;
code_old = (uint16_t)-1;
- FXSYS_memset(code_table, 0, sizeof(tag_Table) * GIF_MAX_LZW_CODE);
- FXSYS_memset(stack, 0, GIF_MAX_LZW_CODE);
+ memset(code_table, 0, sizeof(tag_Table) * GIF_MAX_LZW_CODE);
+ memset(stack, 0, GIF_MAX_LZW_CODE);
for (uint16_t i = 0; i < code_clear; i++) {
code_table[i].suffix = (uint8_t)i;
}
@@ -90,11 +90,11 @@ int32_t CGifLZWDecoder::Decode(uint8_t* des_buf, uint32_t& des_size) {
uint32_t i = 0;
if (stack_size != 0) {
if (des_size < stack_size) {
- FXSYS_memcpy(des_buf, &stack[GIF_MAX_LZW_CODE - stack_size], des_size);
+ memcpy(des_buf, &stack[GIF_MAX_LZW_CODE - stack_size], des_size);
stack_size -= (uint16_t)des_size;
return 3;
}
- FXSYS_memcpy(des_buf, &stack[GIF_MAX_LZW_CODE - stack_size], stack_size);
+ memcpy(des_buf, &stack[GIF_MAX_LZW_CODE - stack_size], stack_size);
des_buf += stack_size;
i += stack_size;
stack_size = 0;
@@ -103,15 +103,15 @@ int32_t CGifLZWDecoder::Decode(uint8_t* des_buf, uint32_t& des_size) {
while (i <= des_size && (avail_in > 0 || bits_left >= code_size_cur)) {
if (code_size_cur > 12) {
if (err_msg_ptr) {
- FXSYS_strncpy(err_msg_ptr, "Code Length Out Of Range",
- GIF_MAX_ERROR_SIZE - 1);
+ strncpy(err_msg_ptr, "Code Length Out Of Range",
+ GIF_MAX_ERROR_SIZE - 1);
}
return 0;
}
if (avail_in > 0) {
if (bits_left > 31) {
if (err_msg_ptr)
- FXSYS_strncpy(err_msg_ptr, "Decode Error", GIF_MAX_ERROR_SIZE - 1);
+ strncpy(err_msg_ptr, "Decode Error", GIF_MAX_ERROR_SIZE - 1);
return 0;
}
pdfium::base::CheckedNumeric<uint32_t> safe_code = *next_in++;
@@ -119,8 +119,8 @@ int32_t CGifLZWDecoder::Decode(uint8_t* des_buf, uint32_t& des_size) {
safe_code |= code_store;
if (!safe_code.IsValid()) {
if (err_msg_ptr) {
- FXSYS_strncpy(err_msg_ptr, "Code Store Out Of Range",
- GIF_MAX_ERROR_SIZE - 1);
+ strncpy(err_msg_ptr, "Code Store Out Of Range",
+ GIF_MAX_ERROR_SIZE - 1);
}
return 0;
}
@@ -146,8 +146,8 @@ int32_t CGifLZWDecoder::Decode(uint8_t* des_buf, uint32_t& des_size) {
DecodeString(code);
} else if (code > code_next) {
if (err_msg_ptr) {
- FXSYS_strncpy(err_msg_ptr, "Decode Error, Out Of Range",
- GIF_MAX_ERROR_SIZE - 1);
+ strncpy(err_msg_ptr, "Decode Error, Out Of Range",
+ GIF_MAX_ERROR_SIZE - 1);
}
return 0;
} else {
@@ -161,13 +161,11 @@ int32_t CGifLZWDecoder::Decode(uint8_t* des_buf, uint32_t& des_size) {
}
code_old = code;
if (i + stack_size > des_size) {
- FXSYS_memcpy(des_buf, &stack[GIF_MAX_LZW_CODE - stack_size],
- des_size - i);
+ memcpy(des_buf, &stack[GIF_MAX_LZW_CODE - stack_size], des_size - i);
stack_size -= (uint16_t)(des_size - i);
return 3;
}
- FXSYS_memcpy(des_buf, &stack[GIF_MAX_LZW_CODE - stack_size],
- stack_size);
+ memcpy(des_buf, &stack[GIF_MAX_LZW_CODE - stack_size], stack_size);
des_buf += stack_size;
i += stack_size;
stack_size = 0;
@@ -192,7 +190,7 @@ static bool gif_grow_buf(uint8_t*& dst_buf, uint32_t& dst_len, uint32_t size) {
dst_len = size;
dst_buf = FX_Realloc(uint8_t, dst_buf, dst_len);
}
- FXSYS_memset(dst_buf + len_org, 0, dst_len - len_org);
+ memset(dst_buf + len_org, 0, dst_len - len_org);
return !!dst_buf;
}
return true;
@@ -229,7 +227,7 @@ static inline uint8_t gif_cut_buf(const uint8_t* buf,
return buf[offset++];
}
CGifLZWEncoder::CGifLZWEncoder() {
- FXSYS_memset(this, 0, sizeof(CGifLZWEncoder));
+ memset(this, 0, sizeof(CGifLZWEncoder));
}
CGifLZWEncoder::~CGifLZWEncoder() {}
void CGifLZWEncoder::ClearTable() {
@@ -272,9 +270,9 @@ void CGifLZWEncoder::WriteBlock(uint8_t*& dst_buf,
longjmp(jmp, 1);
}
dst_buf[offset++] = index_buf_len;
- FXSYS_memcpy(&dst_buf[offset], index_buf, index_buf_len);
+ memcpy(&dst_buf[offset], index_buf, index_buf_len);
offset += index_buf_len;
- FXSYS_memset(index_buf, 0, GIF_DATA_BLOCK);
+ memset(index_buf, 0, GIF_DATA_BLOCK);
index_buf_len = 0;
}
void CGifLZWEncoder::EncodeString(uint32_t index,
@@ -391,7 +389,7 @@ void CGifLZWEncoder::Finish(uint8_t*& dst_buf,
}
gif_decompress_struct_p gif_create_decompress() {
gif_decompress_struct_p gif_ptr = FX_Alloc(gif_decompress_struct, 1);
- FXSYS_memset(gif_ptr, 0, sizeof(gif_decompress_struct));
+ memset(gif_ptr, 0, sizeof(gif_decompress_struct));
gif_ptr->decode_status = GIF_D_STATUS_SIG;
gif_ptr->img_ptr_arr_ptr = new std::vector<GifImage*>;
gif_ptr->cmt_data_ptr = new CFX_ByteString;
@@ -439,7 +437,7 @@ void gif_destroy_decompress(gif_decompress_struct_pp gif_ptr_ptr) {
}
gif_compress_struct_p gif_create_compress() {
gif_compress_struct_p gif_ptr = FX_Alloc(gif_compress_struct, 1);
- FXSYS_memset(gif_ptr, 0, sizeof(gif_compress_struct));
+ memset(gif_ptr, 0, sizeof(gif_compress_struct));
gif_ptr->img_encoder_ptr = new CGifLZWEncoder;
gif_ptr->header_ptr = FX_Alloc(GifHeader, 1);
if (!gif_ptr->header_ptr) {
@@ -447,8 +445,8 @@ gif_compress_struct_p gif_create_compress() {
FX_Free(gif_ptr);
return nullptr;
}
- FXSYS_memcpy(gif_ptr->header_ptr->signature, GIF_SIGNATURE, 3);
- FXSYS_memcpy(gif_ptr->header_ptr->version, "89a", 3);
+ memcpy(gif_ptr->header_ptr->signature, GIF_SIGNATURE, 3);
+ memcpy(gif_ptr->header_ptr->version, "89a", 3);
gif_ptr->lsd_ptr = FX_Alloc(GifLSD, 1);
if (!gif_ptr->lsd_ptr) {
FX_Free(gif_ptr->header_ptr);
@@ -456,7 +454,7 @@ gif_compress_struct_p gif_create_compress() {
FX_Free(gif_ptr);
return nullptr;
}
- FXSYS_memset(gif_ptr->lsd_ptr, 0, sizeof(GifLSD));
+ memset(gif_ptr->lsd_ptr, 0, sizeof(GifLSD));
gif_ptr->image_info_ptr = FX_Alloc(GifImageInfo, 1);
if (!gif_ptr->image_info_ptr) {
FX_Free(gif_ptr->lsd_ptr);
@@ -465,7 +463,7 @@ gif_compress_struct_p gif_create_compress() {
FX_Free(gif_ptr);
return nullptr;
}
- FXSYS_memset(gif_ptr->image_info_ptr, 0, sizeof(GifImageInfo));
+ memset(gif_ptr->image_info_ptr, 0, sizeof(GifImageInfo));
gif_ptr->gce_ptr = FX_Alloc(GifGCE, 1);
if (!gif_ptr->gce_ptr) {
FX_Free(gif_ptr->image_info_ptr);
@@ -485,7 +483,7 @@ gif_compress_struct_p gif_create_compress() {
FX_Free(gif_ptr);
return nullptr;
}
- FXSYS_memset(gif_ptr->pte_ptr, 0, sizeof(GifPTE));
+ memset(gif_ptr->pte_ptr, 0, sizeof(GifPTE));
gif_ptr->pte_ptr->block_size = 12;
return gif_ptr;
}
@@ -506,12 +504,12 @@ void gif_destroy_compress(gif_compress_struct_pp gif_ptr_ptr) {
FX_Free(gif_ptr->pte_ptr);
FX_Free(gif_ptr);
}
-void gif_error(gif_decompress_struct_p gif_ptr, const FX_CHAR* err_msg) {
+void gif_error(gif_decompress_struct_p gif_ptr, const char* err_msg) {
if (gif_ptr && gif_ptr->gif_error_fn) {
gif_ptr->gif_error_fn(gif_ptr, err_msg);
}
}
-void gif_warn(gif_decompress_struct_p gif_ptr, const FX_CHAR* err_msg) {}
+void gif_warn(gif_decompress_struct_p gif_ptr, const char* err_msg) {}
int32_t gif_read_header(gif_decompress_struct_p gif_ptr) {
if (!gif_ptr)
return 0;
@@ -522,7 +520,7 @@ int32_t gif_read_header(gif_decompress_struct_p gif_ptr) {
if (!gif_read_data(gif_ptr, (uint8_t**)&gif_header_ptr, 6))
return 2;
- if (FXSYS_strncmp(gif_header_ptr->signature, GIF_SIGNATURE, 3) != 0 ||
+ if (strncmp(gif_header_ptr->signature, GIF_SIGNATURE, 3) != 0 ||
gif_header_ptr->version[0] != '8' || gif_header_ptr->version[2] != 'a') {
gif_error(gif_ptr, "Not A Gif Image");
return 0;
@@ -548,7 +546,7 @@ int32_t gif_read_header(gif_decompress_struct_p gif_ptr) {
((GifGF*)&gif_lsd_ptr->global_flag)->color_resolution;
FX_Free(gif_ptr->global_pal_ptr);
gif_ptr->global_pal_ptr = (GifPalette*)FX_Alloc(uint8_t, global_pal_size);
- FXSYS_memcpy(gif_ptr->global_pal_ptr, global_pal_ptr, global_pal_size);
+ memcpy(gif_ptr->global_pal_ptr, global_pal_ptr, global_pal_size);
}
gif_ptr->width = (int)GetWord_LSBFirst((uint8_t*)&gif_lsd_ptr->width);
gif_ptr->height = (int)GetWord_LSBFirst((uint8_t*)&gif_lsd_ptr->height);
@@ -680,7 +678,7 @@ int32_t gif_decode_extension(gif_decompress_struct_p gif_ptr) {
return 2;
}
*(gif_ptr->cmt_data_ptr) +=
- CFX_ByteString((const FX_CHAR*)data_ptr, data_size);
+ CFX_ByteString((const char*)data_ptr, data_size);
}
} break;
case GIF_D_STATUS_EXT_PTE: {
@@ -690,7 +688,7 @@ int32_t gif_decode_extension(gif_decompress_struct_p gif_ptr) {
return 2;
}
GifPlainText* gif_pt_ptr = FX_Alloc(GifPlainText, 1);
- FXSYS_memset(gif_pt_ptr, 0, sizeof(GifPlainText));
+ memset(gif_pt_ptr, 0, sizeof(GifPlainText));
gif_takeover_gce_ptr(gif_ptr, &gif_pt_ptr->gce_ptr);
gif_pt_ptr->pte_ptr = FX_Alloc(GifPTE, 1);
gif_pt_ptr->string_ptr = new CFX_ByteString;
@@ -731,7 +729,7 @@ int32_t gif_decode_extension(gif_decompress_struct_p gif_ptr) {
return 2;
}
*(gif_pt_ptr->string_ptr) +=
- CFX_ByteString((const FX_CHAR*)data_ptr, data_size);
+ CFX_ByteString((const char*)data_ptr, data_size);
}
gif_ptr->pt_ptr_arr_ptr->push_back(gif_pt_ptr);
} break;
@@ -781,7 +779,7 @@ int32_t gif_decode_image_info(gif_decompress_struct_p gif_ptr) {
return 2;
GifImage* gif_image_ptr = FX_Alloc(GifImage, 1);
- FXSYS_memset(gif_image_ptr, 0, sizeof(GifImage));
+ memset(gif_image_ptr, 0, sizeof(GifImage));
gif_image_ptr->image_info_ptr = FX_Alloc(GifImageInfo, 1);
gif_image_ptr->image_info_ptr->left =
GetWord_LSBFirst((uint8_t*)&gif_img_info_ptr->left);
@@ -819,8 +817,7 @@ int32_t gif_decode_image_info(gif_decompress_struct_p gif_ptr) {
gif_image_ptr->local_pal_ptr =
(GifPalette*)gif_ptr->gif_ask_buf_for_pal_fn(gif_ptr, loc_pal_size);
if (gif_image_ptr->local_pal_ptr) {
- FXSYS_memcpy((uint8_t*)gif_image_ptr->local_pal_ptr, loc_pal_ptr,
- loc_pal_size);
+ memcpy((uint8_t*)gif_image_ptr->local_pal_ptr, loc_pal_ptr, loc_pal_size);
}
}
uint8_t* code_size_ptr = nullptr;
@@ -841,11 +838,11 @@ int32_t gif_decode_image_info(gif_decompress_struct_p gif_ptr) {
gif_save_decoding_status(gif_ptr, GIF_D_STATUS_IMG_DATA);
return 1;
}
+
int32_t gif_load_frame(gif_decompress_struct_p gif_ptr, int32_t frame_num) {
- if (!gif_ptr || frame_num < 0 ||
- frame_num >= pdfium::CollectionSize<int>(*gif_ptr->img_ptr_arr_ptr)) {
+ if (!gif_ptr || !pdfium::IndexInBounds(*gif_ptr->img_ptr_arr_ptr, frame_num))
return 0;
- }
+
uint8_t* data_size_ptr = nullptr;
uint8_t* data_ptr = nullptr;
uint32_t skip_size_org = gif_ptr->skip_size;
@@ -1065,8 +1062,8 @@ static bool gif_write_header(gif_compress_struct_p gif_ptr,
if (!dst_buf)
return false;
- FXSYS_memset(dst_buf, 0, dst_len);
- FXSYS_memcpy(dst_buf, gif_ptr->header_ptr, sizeof(GifHeader));
+ memset(dst_buf, 0, dst_len);
+ memcpy(dst_buf, gif_ptr->header_ptr, sizeof(GifHeader));
gif_ptr->cur_offset += sizeof(GifHeader);
SetWord_LSBFirst(dst_buf + gif_ptr->cur_offset, gif_ptr->lsd_ptr->width);
gif_ptr->cur_offset += 2;
@@ -1080,7 +1077,7 @@ static bool gif_write_header(gif_compress_struct_p gif_ptr,
if (!gif_grow_buf(dst_buf, dst_len, gif_ptr->cur_offset + size)) {
return false;
}
- FXSYS_memcpy(&dst_buf[gif_ptr->cur_offset], gif_ptr->global_pal, size);
+ memcpy(&dst_buf[gif_ptr->cur_offset], gif_ptr->global_pal, size);
gif_ptr->cur_offset += size;
}
return true;
@@ -1101,13 +1098,13 @@ void interlace_buf(const uint8_t* buf, uint32_t pitch, uint32_t height) {
j = 3;
}
temp = FX_Alloc(uint8_t, pitch);
- FXSYS_memcpy(temp, &buf[pitch * row], pitch);
+ memcpy(temp, &buf[pitch * row], pitch);
pass[j].push_back(temp);
row++;
}
for (size_t i = 0, row = 0; i < 4; i++) {
for (size_t j = 0; j < pass[i].size(); j++, row++) {
- FXSYS_memcpy((uint8_t*)&buf[pitch * row], pass[i][j], pitch);
+ memcpy((uint8_t*)&buf[pitch * row], pass[i][j], pitch);
FX_Free(pass[i][j]);
}
}
@@ -1120,13 +1117,13 @@ static void gif_write_block_data(const uint8_t* src_buf,
uint32_t src_offset = 0;
while (src_len > GIF_DATA_BLOCK) {
dst_buf[dst_offset++] = GIF_DATA_BLOCK;
- FXSYS_memcpy(&dst_buf[dst_offset], &src_buf[src_offset], GIF_DATA_BLOCK);
+ memcpy(&dst_buf[dst_offset], &src_buf[src_offset], GIF_DATA_BLOCK);
dst_offset += GIF_DATA_BLOCK;
src_offset += GIF_DATA_BLOCK;
src_len -= GIF_DATA_BLOCK;
}
dst_buf[dst_offset++] = (uint8_t)src_len;
- FXSYS_memcpy(&dst_buf[dst_offset], &src_buf[src_offset], src_len);
+ memcpy(&dst_buf[dst_offset], &src_buf[src_offset], src_len);
dst_offset += src_len;
}
static bool gif_write_data(gif_compress_struct_p gif_ptr,
@@ -1135,7 +1132,7 @@ static bool gif_write_data(gif_compress_struct_p gif_ptr,
if (!gif_grow_buf(dst_buf, dst_len, gif_ptr->cur_offset + GIF_DATA_BLOCK)) {
return false;
}
- if (FXSYS_memcmp(gif_ptr->header_ptr->version, "89a", 3) == 0) {
+ if (memcmp(gif_ptr->header_ptr->version, "89a", 3) == 0) {
dst_buf[gif_ptr->cur_offset++] = GIF_SIG_EXTENSION;
dst_buf[gif_ptr->cur_offset++] = GIF_BLOCK_GCE;
gif_ptr->gce_ptr->block_size = 4;
@@ -1169,7 +1166,7 @@ static bool gif_write_data(gif_compress_struct_p gif_ptr,
if (!gif_grow_buf(dst_buf, dst_len, pal_size + gif_ptr->cur_offset)) {
return false;
}
- FXSYS_memcpy(&dst_buf[gif_ptr->cur_offset], gif_ptr->local_pal, pal_size);
+ memcpy(&dst_buf[gif_ptr->cur_offset], gif_ptr->local_pal, pal_size);
gif_ptr->cur_offset += pal_size;
}
if (lf.interlace) {
@@ -1196,7 +1193,7 @@ static bool gif_write_data(gif_compress_struct_p gif_ptr,
}
gif_ptr->img_encoder_ptr->Finish(dst_buf, dst_len, gif_ptr->cur_offset);
dst_buf[gif_ptr->cur_offset++] = 0;
- if (FXSYS_memcmp(gif_ptr->header_ptr->version, "89a", 3) == 0 &&
+ if (memcmp(gif_ptr->header_ptr->version, "89a", 3) == 0 &&
gif_ptr->cmt_data_ptr) {
dst_buf[gif_ptr->cur_offset++] = GIF_SIG_EXTENSION;
dst_buf[gif_ptr->cur_offset++] = GIF_BLOCK_CE;
@@ -1204,7 +1201,7 @@ static bool gif_write_data(gif_compress_struct_p gif_ptr,
dst_len, gif_ptr->cur_offset);
dst_buf[gif_ptr->cur_offset++] = 0;
}
- if (FXSYS_memcmp(gif_ptr->header_ptr->version, "89a", 3) == 0 &&
+ if (memcmp(gif_ptr->header_ptr->version, "89a", 3) == 0 &&
gif_ptr->pte_data_ptr) {
dst_buf[gif_ptr->cur_offset++] = GIF_SIG_EXTENSION;
dst_buf[gif_ptr->cur_offset++] = GIF_BLOCK_PTE;
diff --git a/chromium/third_party/pdfium/core/fxcodec/lgif/fx_gif.h b/chromium/third_party/pdfium/core/fxcodec/lgif/fx_gif.h
index a8b780b0999..5027c447d50 100644
--- a/chromium/third_party/pdfium/core/fxcodec/lgif/fx_gif.h
+++ b/chromium/third_party/pdfium/core/fxcodec/lgif/fx_gif.h
@@ -122,7 +122,7 @@ class CGifLZWDecoder {
uint8_t suffix;
};
- explicit CGifLZWDecoder(FX_CHAR* error_ptr);
+ explicit CGifLZWDecoder(char* error_ptr);
~CGifLZWDecoder();
void InitTable(uint8_t code_len);
@@ -152,7 +152,7 @@ class CGifLZWDecoder {
uint8_t bits_left;
uint32_t code_store;
- FX_CHAR* err_msg_ptr;
+ char* err_msg_ptr;
};
class CGifLZWEncoder {
@@ -208,8 +208,8 @@ typedef gif_decompress_struct_p* gif_decompress_struct_pp;
static const int32_t s_gif_interlace_step[4] = {8, 8, 4, 2};
struct tag_gif_decompress_struct {
jmp_buf jmpbuf;
- FX_CHAR* err_ptr;
- void (*gif_error_fn)(gif_decompress_struct_p gif_ptr, const FX_CHAR* err_msg);
+ char* err_ptr;
+ void (*gif_error_fn)(gif_decompress_struct_p gif_ptr, const char* err_msg);
void* context_ptr;
int width;
int height;
@@ -280,8 +280,8 @@ struct tag_gif_compress_struct {
uint32_t pte_data_len;
};
-void gif_error(gif_decompress_struct_p gif_ptr, const FX_CHAR* err_msg);
-void gif_warn(gif_decompress_struct_p gif_ptr, const FX_CHAR* err_msg);
+void gif_error(gif_decompress_struct_p gif_ptr, const char* err_msg);
+void gif_warn(gif_decompress_struct_p gif_ptr, const char* err_msg);
gif_decompress_struct_p gif_create_decompress();
void gif_destroy_decompress(gif_decompress_struct_pp gif_ptr_ptr);
gif_compress_struct_p gif_create_compress();
diff --git a/chromium/third_party/pdfium/core/fxcrt/cfx_blockbuffer.cpp b/chromium/third_party/pdfium/core/fxcrt/cfx_blockbuffer.cpp
new file mode 100644
index 00000000000..aeef5653e8d
--- /dev/null
+++ b/chromium/third_party/pdfium/core/fxcrt/cfx_blockbuffer.cpp
@@ -0,0 +1,121 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "core/fxcrt/cfx_blockbuffer.h"
+
+#include <algorithm>
+#include <utility>
+
+namespace {
+
+const size_t kAllocStep = 1024 * 1024;
+
+} // namespace
+
+CFX_BlockBuffer::CFX_BlockBuffer()
+ : m_DataLength(0), m_BufferSize(0), m_StartPosition(0) {}
+
+CFX_BlockBuffer::~CFX_BlockBuffer() {}
+
+size_t CFX_BlockBuffer::GetAllocStep() const {
+ return kAllocStep;
+}
+
+std::pair<wchar_t*, size_t> CFX_BlockBuffer::GetAvailableBlock() {
+ if (m_BlockArray.empty())
+ return {nullptr, 0};
+
+ size_t realIndex = m_StartPosition + m_DataLength;
+ if (realIndex == m_BufferSize) {
+ m_BlockArray.emplace_back(FX_Alloc(wchar_t, kAllocStep));
+ m_BufferSize += kAllocStep;
+ return {m_BlockArray.back().get(), 0};
+ }
+ return {m_BlockArray[realIndex / kAllocStep].get(), realIndex % kAllocStep};
+}
+
+bool CFX_BlockBuffer::InitBuffer() {
+ m_BlockArray.clear();
+ m_BlockArray.emplace_back(FX_Alloc(wchar_t, kAllocStep));
+ m_BufferSize = kAllocStep;
+ return true;
+}
+
+void CFX_BlockBuffer::SetTextChar(size_t index, wchar_t ch) {
+ size_t realIndex = m_StartPosition + index;
+ size_t blockIndex = realIndex / kAllocStep;
+ if (blockIndex >= m_BlockArray.size()) {
+ size_t newBlocks = blockIndex - m_BlockArray.size() + 1;
+ do {
+ m_BlockArray.emplace_back(FX_Alloc(wchar_t, kAllocStep));
+ m_BufferSize += kAllocStep;
+ } while (--newBlocks);
+ }
+ wchar_t* pTextData = m_BlockArray[blockIndex].get();
+ pTextData[realIndex % kAllocStep] = ch;
+ m_DataLength = std::max(m_DataLength, index + 1);
+}
+
+void CFX_BlockBuffer::DeleteTextChars(size_t count) {
+ if (count == 0)
+ return;
+
+ if (count >= m_DataLength) {
+ Reset(false);
+ return;
+ }
+ m_DataLength -= count;
+}
+
+CFX_WideString CFX_BlockBuffer::GetTextData(size_t start, size_t length) const {
+ if (m_BufferSize <= m_StartPosition + 1 || length == 0)
+ return CFX_WideString();
+
+ size_t maybeDataLength = m_BufferSize - 1 - m_StartPosition;
+ if (start > maybeDataLength)
+ return CFX_WideString();
+ length = std::min(length, maybeDataLength);
+
+ CFX_WideString wsTextData;
+ wchar_t* pBuf = wsTextData.GetBuffer(length);
+ if (!pBuf)
+ return CFX_WideString();
+
+ size_t startBlock = 0;
+ size_t startInner = 0;
+ std::tie(startBlock, startInner) = TextDataIndex2BufIndex(start);
+
+ size_t endBlock = 0;
+ size_t endInner = 0;
+ std::tie(endBlock, endInner) = TextDataIndex2BufIndex(start + length);
+
+ size_t pointer = 0;
+ for (size_t i = startBlock; i <= endBlock; ++i) {
+ size_t bufferPointer = 0;
+ size_t copyLength = kAllocStep;
+ if (i == startBlock) {
+ copyLength -= startInner;
+ bufferPointer = startInner;
+ }
+ if (i == endBlock)
+ copyLength -= ((kAllocStep - 1) - endInner);
+
+ wchar_t* pBlockBuf = m_BlockArray[i].get();
+ memcpy(pBuf + pointer, pBlockBuf + bufferPointer,
+ copyLength * sizeof(wchar_t));
+ pointer += copyLength;
+ }
+ wsTextData.ReleaseBuffer(length);
+ return wsTextData;
+}
+
+std::pair<size_t, size_t> CFX_BlockBuffer::TextDataIndex2BufIndex(
+ const size_t iIndex) const {
+ ASSERT(iIndex >= 0);
+
+ size_t realIndex = m_StartPosition + iIndex;
+ return {realIndex / kAllocStep, realIndex % kAllocStep};
+}
diff --git a/chromium/third_party/pdfium/core/fxcrt/cfx_blockbuffer.h b/chromium/third_party/pdfium/core/fxcrt/cfx_blockbuffer.h
new file mode 100644
index 00000000000..867449074d7
--- /dev/null
+++ b/chromium/third_party/pdfium/core/fxcrt/cfx_blockbuffer.h
@@ -0,0 +1,51 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef CORE_FXCRT_CFX_BLOCKBUFFER_H_
+#define CORE_FXCRT_CFX_BLOCKBUFFER_H_
+
+#include <stdint.h>
+
+#include <memory>
+#include <utility>
+#include <vector>
+
+#include "core/fxcrt/fx_string.h"
+
+class CFX_BlockBuffer {
+ public:
+ CFX_BlockBuffer();
+ ~CFX_BlockBuffer();
+
+ bool InitBuffer();
+ bool IsInitialized() { return m_BufferSize / GetAllocStep() >= 1; }
+
+ std::pair<wchar_t*, size_t> GetAvailableBlock();
+ size_t GetAllocStep() const;
+ size_t GetDataLength() const { return m_DataLength; }
+ void IncrementDataLength() { m_DataLength++; }
+ bool IsEmpty() const { return m_DataLength == 0; }
+
+ void Reset(bool bReserveData) {
+ if (!bReserveData)
+ m_StartPosition = 0;
+ m_DataLength = 0;
+ }
+
+ void SetTextChar(size_t iIndex, wchar_t ch);
+ void DeleteTextChars(size_t iCount);
+ CFX_WideString GetTextData(size_t iStart, size_t iLength) const;
+
+ private:
+ std::pair<size_t, size_t> TextDataIndex2BufIndex(const size_t iIndex) const;
+
+ std::vector<std::unique_ptr<wchar_t, FxFreeDeleter>> m_BlockArray;
+ size_t m_DataLength;
+ size_t m_BufferSize;
+ size_t m_StartPosition;
+};
+
+#endif // CORE_FXCRT_CFX_BLOCKBUFFER_H_
diff --git a/chromium/third_party/pdfium/core/fxcrt/cfx_bytestring.cpp b/chromium/third_party/pdfium/core/fxcrt/cfx_bytestring.cpp
new file mode 100644
index 00000000000..ab35e5d0c53
--- /dev/null
+++ b/chromium/third_party/pdfium/core/fxcrt/cfx_bytestring.cpp
@@ -0,0 +1,843 @@
+// 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
+
+#include "core/fxcrt/cfx_bytestring.h"
+
+#include <stddef.h>
+
+#include <algorithm>
+#include <cctype>
+
+#include "core/fxcrt/cfx_string_pool_template.h"
+#include "core/fxcrt/fx_basic.h"
+#include "core/fxcrt/fx_safe_types.h"
+#include "third_party/base/numerics/safe_math.h"
+#include "third_party/base/stl_util.h"
+
+template class CFX_StringDataTemplate<char>;
+template class CFX_StringCTemplate<char>;
+template class CFX_StringPoolTemplate<CFX_ByteString>;
+template struct std::hash<CFX_ByteString>;
+
+namespace {
+
+int Buffer_itoa(char* buf, int i, uint32_t flags) {
+ if (i == 0) {
+ buf[0] = '0';
+ return 1;
+ }
+ char buf1[32];
+ int buf_pos = 31;
+ uint32_t u = i;
+ if ((flags & FXFORMAT_SIGNED) && i < 0) {
+ u = -i;
+ }
+ int base = 10;
+ const char* str = "0123456789abcdef";
+ if (flags & FXFORMAT_HEX) {
+ base = 16;
+ if (flags & FXFORMAT_CAPITAL) {
+ str = "0123456789ABCDEF";
+ }
+ }
+ while (u != 0) {
+ buf1[buf_pos--] = str[u % base];
+ u = u / base;
+ }
+ if ((flags & FXFORMAT_SIGNED) && i < 0) {
+ buf1[buf_pos--] = '-';
+ }
+ int len = 31 - buf_pos;
+ for (int ii = 0; ii < len; ii++) {
+ buf[ii] = buf1[ii + buf_pos + 1];
+ }
+ return len;
+}
+
+const char* FX_strstr(const char* haystack,
+ int haystack_len,
+ const char* needle,
+ int needle_len) {
+ if (needle_len > haystack_len || needle_len == 0) {
+ return nullptr;
+ }
+ const char* end_ptr = haystack + haystack_len - needle_len;
+ while (haystack <= end_ptr) {
+ int i = 0;
+ while (1) {
+ if (haystack[i] != needle[i]) {
+ break;
+ }
+ i++;
+ if (i == needle_len) {
+ return haystack;
+ }
+ }
+ haystack++;
+ }
+ return nullptr;
+}
+
+} // namespace
+
+static_assert(sizeof(CFX_ByteString) <= sizeof(char*),
+ "Strings must not require more space than pointers");
+
+CFX_ByteString::CFX_ByteString(const char* pStr, FX_STRSIZE nLen) {
+ if (nLen < 0)
+ nLen = pStr ? FXSYS_strlen(pStr) : 0;
+
+ if (nLen)
+ m_pData.Reset(StringData::Create(pStr, nLen));
+}
+
+CFX_ByteString::CFX_ByteString(const uint8_t* pStr, FX_STRSIZE nLen) {
+ if (nLen > 0) {
+ m_pData.Reset(
+ StringData::Create(reinterpret_cast<const char*>(pStr), nLen));
+ }
+}
+
+CFX_ByteString::CFX_ByteString() {}
+
+CFX_ByteString::CFX_ByteString(const CFX_ByteString& other)
+ : m_pData(other.m_pData) {}
+
+CFX_ByteString::CFX_ByteString(CFX_ByteString&& other) noexcept {
+ m_pData.Swap(other.m_pData);
+}
+
+CFX_ByteString::CFX_ByteString(char ch) {
+ m_pData.Reset(StringData::Create(1));
+ m_pData->m_String[0] = ch;
+}
+
+CFX_ByteString::CFX_ByteString(const char* ptr)
+ : CFX_ByteString(ptr, ptr ? FXSYS_strlen(ptr) : 0) {}
+
+CFX_ByteString::CFX_ByteString(const CFX_ByteStringC& stringSrc) {
+ if (!stringSrc.IsEmpty())
+ m_pData.Reset(StringData::Create(stringSrc.c_str(), stringSrc.GetLength()));
+}
+
+CFX_ByteString::CFX_ByteString(const CFX_ByteStringC& str1,
+ const CFX_ByteStringC& str2) {
+ FX_SAFE_STRSIZE nSafeLen = str1.GetLength();
+ nSafeLen += str2.GetLength();
+
+ FX_STRSIZE nNewLen = nSafeLen.ValueOrDie();
+ if (nNewLen == 0)
+ return;
+
+ m_pData.Reset(StringData::Create(nNewLen));
+ m_pData->CopyContents(str1.c_str(), str1.GetLength());
+ m_pData->CopyContentsAt(str1.GetLength(), str2.c_str(), str2.GetLength());
+}
+
+CFX_ByteString::CFX_ByteString(
+ const std::initializer_list<CFX_ByteStringC>& list) {
+ FX_SAFE_STRSIZE nSafeLen = 0;
+ for (const auto& item : list)
+ nSafeLen += item.GetLength();
+
+ FX_STRSIZE nNewLen = nSafeLen.ValueOrDie();
+ if (nNewLen == 0)
+ return;
+
+ m_pData.Reset(StringData::Create(nNewLen));
+
+ FX_STRSIZE nOffset = 0;
+ for (const auto& item : list) {
+ m_pData->CopyContentsAt(nOffset, item.c_str(), item.GetLength());
+ nOffset += item.GetLength();
+ }
+}
+
+CFX_ByteString::~CFX_ByteString() {}
+
+const CFX_ByteString& CFX_ByteString::operator=(const char* pStr) {
+ if (!pStr || !pStr[0])
+ clear();
+ else
+ AssignCopy(pStr, FXSYS_strlen(pStr));
+
+ return *this;
+}
+
+const CFX_ByteString& CFX_ByteString::operator=(
+ const CFX_ByteStringC& stringSrc) {
+ if (stringSrc.IsEmpty())
+ clear();
+ else
+ AssignCopy(stringSrc.c_str(), stringSrc.GetLength());
+
+ return *this;
+}
+
+const CFX_ByteString& CFX_ByteString::operator=(
+ const CFX_ByteString& stringSrc) {
+ if (m_pData != stringSrc.m_pData)
+ m_pData = stringSrc.m_pData;
+
+ return *this;
+}
+
+const CFX_ByteString& CFX_ByteString::operator+=(const char* pStr) {
+ if (pStr)
+ Concat(pStr, FXSYS_strlen(pStr));
+
+ return *this;
+}
+
+const CFX_ByteString& CFX_ByteString::operator+=(char ch) {
+ Concat(&ch, 1);
+ return *this;
+}
+
+const CFX_ByteString& CFX_ByteString::operator+=(const CFX_ByteString& str) {
+ if (str.m_pData)
+ Concat(str.m_pData->m_String, str.m_pData->m_nDataLength);
+
+ return *this;
+}
+
+const CFX_ByteString& CFX_ByteString::operator+=(const CFX_ByteStringC& str) {
+ if (!str.IsEmpty())
+ Concat(str.c_str(), str.GetLength());
+
+ return *this;
+}
+
+bool CFX_ByteString::operator==(const char* ptr) const {
+ if (!m_pData)
+ return !ptr || !ptr[0];
+
+ if (!ptr)
+ return m_pData->m_nDataLength == 0;
+
+ return FXSYS_strlen(ptr) == m_pData->m_nDataLength &&
+ memcmp(ptr, m_pData->m_String, m_pData->m_nDataLength) == 0;
+}
+
+bool CFX_ByteString::operator==(const CFX_ByteStringC& str) const {
+ if (!m_pData)
+ return str.IsEmpty();
+
+ return m_pData->m_nDataLength == str.GetLength() &&
+ memcmp(m_pData->m_String, str.c_str(), str.GetLength()) == 0;
+}
+
+bool CFX_ByteString::operator==(const CFX_ByteString& other) const {
+ if (m_pData == other.m_pData)
+ return true;
+
+ if (IsEmpty())
+ return other.IsEmpty();
+
+ if (other.IsEmpty())
+ return false;
+
+ return other.m_pData->m_nDataLength == m_pData->m_nDataLength &&
+ memcmp(other.m_pData->m_String, m_pData->m_String,
+ m_pData->m_nDataLength) == 0;
+}
+
+bool CFX_ByteString::operator<(const CFX_ByteString& str) const {
+ if (m_pData == str.m_pData)
+ return false;
+
+ int result =
+ memcmp(c_str(), str.c_str(), std::min(GetLength(), str.GetLength()));
+ return result < 0 || (result == 0 && GetLength() < str.GetLength());
+}
+
+bool CFX_ByteString::EqualNoCase(const CFX_ByteStringC& str) const {
+ if (!m_pData)
+ return str.IsEmpty();
+
+ FX_STRSIZE len = str.GetLength();
+ if (m_pData->m_nDataLength != len)
+ return false;
+
+ const uint8_t* pThis = (const uint8_t*)m_pData->m_String;
+ const uint8_t* pThat = str.raw_str();
+ for (FX_STRSIZE i = 0; i < len; i++) {
+ if ((*pThis) != (*pThat)) {
+ uint8_t bThis = *pThis;
+ if (bThis >= 'A' && bThis <= 'Z')
+ bThis += 'a' - 'A';
+
+ uint8_t bThat = *pThat;
+ if (bThat >= 'A' && bThat <= 'Z')
+ bThat += 'a' - 'A';
+
+ if (bThis != bThat)
+ return false;
+ }
+ pThis++;
+ pThat++;
+ }
+ return true;
+}
+
+void CFX_ByteString::AssignCopy(const char* pSrcData, FX_STRSIZE nSrcLen) {
+ AllocBeforeWrite(nSrcLen);
+ m_pData->CopyContents(pSrcData, nSrcLen);
+ m_pData->m_nDataLength = nSrcLen;
+}
+
+void CFX_ByteString::ReallocBeforeWrite(FX_STRSIZE nNewLength) {
+ if (m_pData && m_pData->CanOperateInPlace(nNewLength))
+ return;
+
+ if (nNewLength <= 0) {
+ clear();
+ return;
+ }
+
+ CFX_RetainPtr<StringData> pNewData(StringData::Create(nNewLength));
+ if (m_pData) {
+ FX_STRSIZE nCopyLength = std::min(m_pData->m_nDataLength, nNewLength);
+ pNewData->CopyContents(m_pData->m_String, nCopyLength);
+ pNewData->m_nDataLength = nCopyLength;
+ } else {
+ pNewData->m_nDataLength = 0;
+ }
+ pNewData->m_String[pNewData->m_nDataLength] = 0;
+ m_pData.Swap(pNewData);
+}
+
+void CFX_ByteString::AllocBeforeWrite(FX_STRSIZE nNewLength) {
+ if (m_pData && m_pData->CanOperateInPlace(nNewLength))
+ return;
+
+ if (nNewLength <= 0) {
+ clear();
+ return;
+ }
+
+ m_pData.Reset(StringData::Create(nNewLength));
+}
+
+void CFX_ByteString::ReleaseBuffer(FX_STRSIZE nNewLength) {
+ if (!m_pData)
+ return;
+
+ if (nNewLength == -1)
+ nNewLength = FXSYS_strlen(m_pData->m_String);
+
+ nNewLength = std::min(nNewLength, m_pData->m_nAllocLength);
+ if (nNewLength == 0) {
+ clear();
+ return;
+ }
+
+ ASSERT(m_pData->m_nRefs == 1);
+ m_pData->m_nDataLength = nNewLength;
+ m_pData->m_String[nNewLength] = 0;
+ if (m_pData->m_nAllocLength - nNewLength >= 32) {
+ // Over arbitrary threshold, so pay the price to relocate. Force copy to
+ // always occur by holding a second reference to the string.
+ CFX_ByteString preserve(*this);
+ ReallocBeforeWrite(nNewLength);
+ }
+}
+
+void CFX_ByteString::Reserve(FX_STRSIZE len) {
+ GetBuffer(len);
+}
+
+char* CFX_ByteString::GetBuffer(FX_STRSIZE nMinBufLength) {
+ if (!m_pData) {
+ if (nMinBufLength == 0)
+ return nullptr;
+
+ m_pData.Reset(StringData::Create(nMinBufLength));
+ m_pData->m_nDataLength = 0;
+ m_pData->m_String[0] = 0;
+ return m_pData->m_String;
+ }
+
+ if (m_pData->CanOperateInPlace(nMinBufLength))
+ return m_pData->m_String;
+
+ nMinBufLength = std::max(nMinBufLength, m_pData->m_nDataLength);
+ if (nMinBufLength == 0)
+ return nullptr;
+
+ CFX_RetainPtr<StringData> pNewData(StringData::Create(nMinBufLength));
+ pNewData->CopyContents(*m_pData);
+ pNewData->m_nDataLength = m_pData->m_nDataLength;
+ m_pData.Swap(pNewData);
+ return m_pData->m_String;
+}
+
+FX_STRSIZE CFX_ByteString::Delete(FX_STRSIZE nIndex, FX_STRSIZE nCount) {
+ if (!m_pData)
+ return 0;
+
+ if (nIndex < 0)
+ nIndex = 0;
+
+ FX_STRSIZE nOldLength = m_pData->m_nDataLength;
+ if (nCount > 0 && nIndex < nOldLength) {
+ FX_STRSIZE mLength = nIndex + nCount;
+ if (mLength >= nOldLength) {
+ m_pData->m_nDataLength = nIndex;
+ return m_pData->m_nDataLength;
+ }
+ ReallocBeforeWrite(nOldLength);
+ int nCharsToCopy = nOldLength - mLength + 1;
+ memmove(m_pData->m_String + nIndex, m_pData->m_String + mLength,
+ nCharsToCopy);
+ m_pData->m_nDataLength = nOldLength - nCount;
+ }
+ return m_pData->m_nDataLength;
+}
+
+void CFX_ByteString::Concat(const char* pSrcData, FX_STRSIZE nSrcLen) {
+ if (!pSrcData || nSrcLen <= 0)
+ return;
+
+ if (!m_pData) {
+ m_pData.Reset(StringData::Create(pSrcData, nSrcLen));
+ return;
+ }
+
+ if (m_pData->CanOperateInPlace(m_pData->m_nDataLength + nSrcLen)) {
+ m_pData->CopyContentsAt(m_pData->m_nDataLength, pSrcData, nSrcLen);
+ m_pData->m_nDataLength += nSrcLen;
+ return;
+ }
+
+ CFX_RetainPtr<StringData> pNewData(
+ StringData::Create(m_pData->m_nDataLength + nSrcLen));
+ pNewData->CopyContents(*m_pData);
+ pNewData->CopyContentsAt(m_pData->m_nDataLength, pSrcData, nSrcLen);
+ m_pData.Swap(pNewData);
+}
+
+CFX_ByteString CFX_ByteString::Mid(FX_STRSIZE nFirst) const {
+ if (!m_pData)
+ return CFX_ByteString();
+
+ return Mid(nFirst, m_pData->m_nDataLength - nFirst);
+}
+
+CFX_ByteString CFX_ByteString::Mid(FX_STRSIZE nFirst, FX_STRSIZE nCount) const {
+ if (!m_pData)
+ return CFX_ByteString();
+
+ nFirst = pdfium::clamp(nFirst, 0, m_pData->m_nDataLength);
+ nCount = pdfium::clamp(nCount, 0, m_pData->m_nDataLength - nFirst);
+ if (nCount == 0)
+ return CFX_ByteString();
+
+ if (nFirst == 0 && nCount == m_pData->m_nDataLength)
+ return *this;
+
+ CFX_ByteString dest;
+ AllocCopy(dest, nCount, nFirst);
+ return dest;
+}
+
+void CFX_ByteString::AllocCopy(CFX_ByteString& dest,
+ FX_STRSIZE nCopyLen,
+ FX_STRSIZE nCopyIndex) const {
+ if (nCopyLen <= 0)
+ return;
+
+ CFX_RetainPtr<StringData> pNewData(
+ StringData::Create(m_pData->m_String + nCopyIndex, nCopyLen));
+ dest.m_pData.Swap(pNewData);
+}
+
+#define FORCE_ANSI 0x10000
+#define FORCE_UNICODE 0x20000
+#define FORCE_INT64 0x40000
+
+CFX_ByteString CFX_ByteString::FormatInteger(int i, uint32_t flags) {
+ char buf[32];
+ return CFX_ByteString(buf, Buffer_itoa(buf, i, flags));
+}
+
+void CFX_ByteString::FormatV(const char* pFormat, va_list argList) {
+ va_list argListSave;
+ FX_VA_COPY(argListSave, argList);
+ FX_STRSIZE nMaxLen = vsnprintf(nullptr, 0, pFormat, argList);
+ if (nMaxLen > 0) {
+ GetBuffer(nMaxLen);
+ if (m_pData) {
+ // In the following two calls, there's always space in the buffer for
+ // a terminating NUL that's not included in nMaxLen.
+ memset(m_pData->m_String, 0, nMaxLen + 1);
+ vsnprintf(m_pData->m_String, nMaxLen + 1, pFormat, argListSave);
+ ReleaseBuffer();
+ }
+ }
+ va_end(argListSave);
+}
+
+void CFX_ByteString::Format(const char* pFormat, ...) {
+ va_list argList;
+ va_start(argList, pFormat);
+ FormatV(pFormat, argList);
+ va_end(argList);
+}
+
+FX_STRSIZE CFX_ByteString::Insert(FX_STRSIZE nIndex, char ch) {
+ FX_STRSIZE nNewLength = m_pData ? m_pData->m_nDataLength : 0;
+ nIndex = std::max(nIndex, 0);
+ nIndex = std::min(nIndex, nNewLength);
+ nNewLength++;
+
+ ReallocBeforeWrite(nNewLength);
+ memmove(m_pData->m_String + nIndex + 1, m_pData->m_String + nIndex,
+ nNewLength - nIndex);
+ m_pData->m_String[nIndex] = ch;
+ m_pData->m_nDataLength = nNewLength;
+ return nNewLength;
+}
+
+CFX_ByteString CFX_ByteString::Right(FX_STRSIZE nCount) const {
+ if (!m_pData)
+ return CFX_ByteString();
+
+ nCount = std::max(nCount, 0);
+ if (nCount >= m_pData->m_nDataLength)
+ return *this;
+
+ CFX_ByteString dest;
+ AllocCopy(dest, nCount, m_pData->m_nDataLength - nCount);
+ return dest;
+}
+
+CFX_ByteString CFX_ByteString::Left(FX_STRSIZE nCount) const {
+ if (!m_pData)
+ return CFX_ByteString();
+
+ nCount = std::max(nCount, 0);
+ if (nCount >= m_pData->m_nDataLength)
+ return *this;
+
+ CFX_ByteString dest;
+ AllocCopy(dest, nCount, 0);
+ return dest;
+}
+
+FX_STRSIZE CFX_ByteString::Find(char ch, FX_STRSIZE nStart) const {
+ if (!m_pData)
+ return -1;
+
+ if (nStart < 0 || nStart >= m_pData->m_nDataLength)
+ return -1;
+
+ const char* pStr = static_cast<const char*>(
+ memchr(m_pData->m_String + nStart, ch, m_pData->m_nDataLength - nStart));
+ return pStr ? pStr - m_pData->m_String : -1;
+}
+
+FX_STRSIZE CFX_ByteString::ReverseFind(char ch) const {
+ if (!m_pData)
+ return -1;
+
+ FX_STRSIZE nLength = m_pData->m_nDataLength;
+ while (nLength--) {
+ if (m_pData->m_String[nLength] == ch)
+ return nLength;
+ }
+ return -1;
+}
+
+FX_STRSIZE CFX_ByteString::Find(const CFX_ByteStringC& pSub,
+ FX_STRSIZE nStart) const {
+ if (!m_pData)
+ return -1;
+
+ FX_STRSIZE nLength = m_pData->m_nDataLength;
+ if (nStart > nLength)
+ return -1;
+
+ const char* pStr =
+ FX_strstr(m_pData->m_String + nStart, m_pData->m_nDataLength - nStart,
+ pSub.c_str(), pSub.GetLength());
+ return pStr ? (int)(pStr - m_pData->m_String) : -1;
+}
+
+void CFX_ByteString::MakeLower() {
+ if (!m_pData)
+ return;
+
+ ReallocBeforeWrite(m_pData->m_nDataLength);
+ FXSYS_strlwr(m_pData->m_String);
+}
+
+void CFX_ByteString::MakeUpper() {
+ if (!m_pData)
+ return;
+
+ ReallocBeforeWrite(m_pData->m_nDataLength);
+ FXSYS_strupr(m_pData->m_String);
+}
+
+FX_STRSIZE CFX_ByteString::Remove(char chRemove) {
+ if (!m_pData || m_pData->m_nDataLength < 1)
+ return 0;
+
+ char* pstrSource = m_pData->m_String;
+ char* pstrEnd = m_pData->m_String + m_pData->m_nDataLength;
+ while (pstrSource < pstrEnd) {
+ if (*pstrSource == chRemove)
+ break;
+ pstrSource++;
+ }
+ if (pstrSource == pstrEnd)
+ return 0;
+
+ ptrdiff_t copied = pstrSource - m_pData->m_String;
+ ReallocBeforeWrite(m_pData->m_nDataLength);
+ pstrSource = m_pData->m_String + copied;
+ pstrEnd = m_pData->m_String + m_pData->m_nDataLength;
+
+ char* pstrDest = pstrSource;
+ while (pstrSource < pstrEnd) {
+ if (*pstrSource != chRemove) {
+ *pstrDest = *pstrSource;
+ pstrDest++;
+ }
+ pstrSource++;
+ }
+
+ *pstrDest = 0;
+ FX_STRSIZE nCount = (FX_STRSIZE)(pstrSource - pstrDest);
+ m_pData->m_nDataLength -= nCount;
+ return nCount;
+}
+
+FX_STRSIZE CFX_ByteString::Replace(const CFX_ByteStringC& pOld,
+ const CFX_ByteStringC& pNew) {
+ if (!m_pData || pOld.IsEmpty())
+ return 0;
+
+ FX_STRSIZE nSourceLen = pOld.GetLength();
+ FX_STRSIZE nReplacementLen = pNew.GetLength();
+ FX_STRSIZE nCount = 0;
+ const char* pStart = m_pData->m_String;
+ char* pEnd = m_pData->m_String + m_pData->m_nDataLength;
+ while (1) {
+ const char* pTarget = FX_strstr(pStart, (FX_STRSIZE)(pEnd - pStart),
+ pOld.c_str(), nSourceLen);
+ if (!pTarget)
+ break;
+
+ nCount++;
+ pStart = pTarget + nSourceLen;
+ }
+ if (nCount == 0)
+ return 0;
+
+ FX_STRSIZE nNewLength =
+ m_pData->m_nDataLength + (nReplacementLen - nSourceLen) * nCount;
+
+ if (nNewLength == 0) {
+ clear();
+ return nCount;
+ }
+
+ CFX_RetainPtr<StringData> pNewData(StringData::Create(nNewLength));
+ pStart = m_pData->m_String;
+ char* pDest = pNewData->m_String;
+ for (FX_STRSIZE i = 0; i < nCount; i++) {
+ const char* pTarget = FX_strstr(pStart, (FX_STRSIZE)(pEnd - pStart),
+ pOld.c_str(), nSourceLen);
+ memcpy(pDest, pStart, pTarget - pStart);
+ pDest += pTarget - pStart;
+ memcpy(pDest, pNew.c_str(), pNew.GetLength());
+ pDest += pNew.GetLength();
+ pStart = pTarget + nSourceLen;
+ }
+ memcpy(pDest, pStart, pEnd - pStart);
+ m_pData.Swap(pNewData);
+ return nCount;
+}
+
+void CFX_ByteString::SetAt(FX_STRSIZE nIndex, char ch) {
+ if (!m_pData) {
+ return;
+ }
+ ASSERT(nIndex >= 0);
+ ASSERT(nIndex < m_pData->m_nDataLength);
+ ReallocBeforeWrite(m_pData->m_nDataLength);
+ m_pData->m_String[nIndex] = ch;
+}
+
+CFX_WideString CFX_ByteString::UTF8Decode() const {
+ CFX_UTF8Decoder decoder;
+ for (FX_STRSIZE i = 0; i < GetLength(); i++) {
+ decoder.Input((uint8_t)m_pData->m_String[i]);
+ }
+ return CFX_WideString(decoder.GetResult());
+}
+
+// static
+CFX_ByteString CFX_ByteString::FromUnicode(const wchar_t* str, FX_STRSIZE len) {
+ FX_STRSIZE str_len = len >= 0 ? len : FXSYS_wcslen(str);
+ return FromUnicode(CFX_WideString(str, str_len));
+}
+
+// static
+CFX_ByteString CFX_ByteString::FromUnicode(const CFX_WideString& str) {
+ return CFX_CharMap::GetByteString(0, str.AsStringC());
+}
+
+int CFX_ByteString::Compare(const CFX_ByteStringC& str) const {
+ if (!m_pData) {
+ return str.IsEmpty() ? 0 : -1;
+ }
+ int this_len = m_pData->m_nDataLength;
+ int that_len = str.GetLength();
+ int min_len = this_len < that_len ? this_len : that_len;
+ for (int i = 0; i < min_len; i++) {
+ if ((uint8_t)m_pData->m_String[i] < str.GetAt(i)) {
+ return -1;
+ }
+ if ((uint8_t)m_pData->m_String[i] > str.GetAt(i)) {
+ return 1;
+ }
+ }
+ if (this_len < that_len) {
+ return -1;
+ }
+ if (this_len > that_len) {
+ return 1;
+ }
+ return 0;
+}
+
+void CFX_ByteString::TrimRight(const CFX_ByteStringC& pTargets) {
+ if (!m_pData || pTargets.IsEmpty()) {
+ return;
+ }
+ FX_STRSIZE pos = GetLength();
+ if (pos < 1) {
+ return;
+ }
+ while (pos) {
+ FX_STRSIZE i = 0;
+ while (i < pTargets.GetLength() &&
+ pTargets[i] != m_pData->m_String[pos - 1]) {
+ i++;
+ }
+ if (i == pTargets.GetLength()) {
+ break;
+ }
+ pos--;
+ }
+ if (pos < m_pData->m_nDataLength) {
+ ReallocBeforeWrite(m_pData->m_nDataLength);
+ m_pData->m_String[pos] = 0;
+ m_pData->m_nDataLength = pos;
+ }
+}
+
+void CFX_ByteString::TrimRight(char chTarget) {
+ TrimRight(CFX_ByteStringC(chTarget));
+}
+
+void CFX_ByteString::TrimRight() {
+ TrimRight("\x09\x0a\x0b\x0c\x0d\x20");
+}
+
+void CFX_ByteString::TrimLeft(const CFX_ByteStringC& pTargets) {
+ if (!m_pData || pTargets.IsEmpty())
+ return;
+
+ FX_STRSIZE len = GetLength();
+ if (len < 1)
+ return;
+
+ FX_STRSIZE pos = 0;
+ while (pos < len) {
+ FX_STRSIZE i = 0;
+ while (i < pTargets.GetLength() && pTargets[i] != m_pData->m_String[pos]) {
+ i++;
+ }
+ if (i == pTargets.GetLength()) {
+ break;
+ }
+ pos++;
+ }
+ if (pos) {
+ ReallocBeforeWrite(len);
+ FX_STRSIZE nDataLength = len - pos;
+ memmove(m_pData->m_String, m_pData->m_String + pos,
+ (nDataLength + 1) * sizeof(char));
+ m_pData->m_nDataLength = nDataLength;
+ }
+}
+
+void CFX_ByteString::TrimLeft(char chTarget) {
+ TrimLeft(CFX_ByteStringC(chTarget));
+}
+
+void CFX_ByteString::TrimLeft() {
+ TrimLeft("\x09\x0a\x0b\x0c\x0d\x20");
+}
+
+uint32_t CFX_ByteString::GetID(FX_STRSIZE start_pos) const {
+ return AsStringC().GetID(start_pos);
+}
+FX_STRSIZE FX_ftoa(float d, char* buf) {
+ buf[0] = '0';
+ buf[1] = '\0';
+ if (d == 0.0f) {
+ return 1;
+ }
+ bool bNegative = false;
+ if (d < 0) {
+ bNegative = true;
+ d = -d;
+ }
+ int scale = 1;
+ int scaled = FXSYS_round(d);
+ while (scaled < 100000) {
+ if (scale == 1000000) {
+ break;
+ }
+ scale *= 10;
+ scaled = FXSYS_round(d * scale);
+ }
+ if (scaled == 0) {
+ return 1;
+ }
+ char buf2[32];
+ int buf_size = 0;
+ if (bNegative) {
+ buf[buf_size++] = '-';
+ }
+ int i = scaled / scale;
+ FXSYS_itoa(i, buf2, 10);
+ FX_STRSIZE len = FXSYS_strlen(buf2);
+ memcpy(buf + buf_size, buf2, len);
+ buf_size += len;
+ int fraction = scaled % scale;
+ if (fraction == 0) {
+ return buf_size;
+ }
+ buf[buf_size++] = '.';
+ scale /= 10;
+ while (fraction) {
+ buf[buf_size++] = '0' + fraction / scale;
+ fraction %= scale;
+ scale /= 10;
+ }
+ return buf_size;
+}
+CFX_ByteString CFX_ByteString::FormatFloat(float d, int precision) {
+ char buf[32];
+ FX_STRSIZE len = FX_ftoa(d, buf);
+ return CFX_ByteString(buf, len);
+}
diff --git a/chromium/third_party/pdfium/core/fxcrt/cfx_bytestring.h b/chromium/third_party/pdfium/core/fxcrt/cfx_bytestring.h
new file mode 100644
index 00000000000..b9ebd8a83c6
--- /dev/null
+++ b/chromium/third_party/pdfium/core/fxcrt/cfx_bytestring.h
@@ -0,0 +1,236 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef CORE_FXCRT_CFX_BYTESTRING_H_
+#define CORE_FXCRT_CFX_BYTESTRING_H_
+
+#include <functional>
+#include <utility>
+
+#include "core/fxcrt/cfx_retain_ptr.h"
+#include "core/fxcrt/cfx_string_c_template.h"
+#include "core/fxcrt/cfx_string_data_template.h"
+#include "core/fxcrt/fx_memory.h"
+#include "core/fxcrt/fx_system.h"
+
+class CFX_WideString;
+
+// A mutable string with shared buffers using copy-on-write semantics that
+// avoids the cost of std::string's iterator stability guarantees.
+class CFX_ByteString {
+ public:
+ using CharType = char;
+
+ CFX_ByteString();
+ CFX_ByteString(const CFX_ByteString& other);
+ CFX_ByteString(CFX_ByteString&& other) noexcept;
+
+ // Deliberately implicit to avoid calling on every string literal.
+ // NOLINTNEXTLINE(runtime/explicit)
+ CFX_ByteString(char ch);
+ // NOLINTNEXTLINE(runtime/explicit)
+ CFX_ByteString(const char* ptr);
+
+ CFX_ByteString(const char* ptr, FX_STRSIZE len);
+ CFX_ByteString(const uint8_t* ptr, FX_STRSIZE len);
+
+ explicit CFX_ByteString(const CFX_ByteStringC& bstrc);
+ CFX_ByteString(const CFX_ByteStringC& bstrc1, const CFX_ByteStringC& bstrc2);
+ CFX_ByteString(const std::initializer_list<CFX_ByteStringC>& list);
+
+ ~CFX_ByteString();
+
+ void clear() { m_pData.Reset(); }
+
+ static CFX_ByteString FromUnicode(const wchar_t* ptr, FX_STRSIZE len = -1);
+ static CFX_ByteString FromUnicode(const CFX_WideString& str);
+
+ // Explicit conversion to C-style string.
+ // Note: Any subsequent modification of |this| will invalidate the result.
+ const char* c_str() const { return m_pData ? m_pData->m_String : ""; }
+
+ // Explicit conversion to uint8_t*.
+ // Note: Any subsequent modification of |this| will invalidate the result.
+ const uint8_t* raw_str() const {
+ return m_pData ? reinterpret_cast<const uint8_t*>(m_pData->m_String)
+ : nullptr;
+ }
+
+ // Explicit conversion to CFX_ByteStringC.
+ // Note: Any subsequent modification of |this| will invalidate the result.
+ CFX_ByteStringC AsStringC() const {
+ return CFX_ByteStringC(raw_str(), GetLength());
+ }
+
+ FX_STRSIZE GetLength() const { return m_pData ? m_pData->m_nDataLength : 0; }
+ bool IsEmpty() const { return !GetLength(); }
+
+ int Compare(const CFX_ByteStringC& str) const;
+ bool EqualNoCase(const CFX_ByteStringC& str) const;
+
+ bool operator==(const char* ptr) const;
+ bool operator==(const CFX_ByteStringC& str) const;
+ bool operator==(const CFX_ByteString& other) const;
+
+ bool operator!=(const char* ptr) const { return !(*this == ptr); }
+ bool operator!=(const CFX_ByteStringC& str) const { return !(*this == str); }
+ bool operator!=(const CFX_ByteString& other) const {
+ return !(*this == other);
+ }
+
+ bool operator<(const CFX_ByteString& str) const;
+
+ const CFX_ByteString& operator=(const char* str);
+ const CFX_ByteString& operator=(const CFX_ByteStringC& bstrc);
+ const CFX_ByteString& operator=(const CFX_ByteString& stringSrc);
+
+ const CFX_ByteString& operator+=(char ch);
+ const CFX_ByteString& operator+=(const char* str);
+ const CFX_ByteString& operator+=(const CFX_ByteString& str);
+ const CFX_ByteString& operator+=(const CFX_ByteStringC& bstrc);
+
+ uint8_t GetAt(FX_STRSIZE nIndex) const {
+ return m_pData ? m_pData->m_String[nIndex] : 0;
+ }
+
+ uint8_t operator[](FX_STRSIZE nIndex) const {
+ return m_pData ? m_pData->m_String[nIndex] : 0;
+ }
+
+ void SetAt(FX_STRSIZE nIndex, char ch);
+ FX_STRSIZE Insert(FX_STRSIZE index, char ch);
+ FX_STRSIZE Delete(FX_STRSIZE index, FX_STRSIZE count = 1);
+
+ void Format(const char* lpszFormat, ...);
+ void FormatV(const char* lpszFormat, va_list argList);
+
+ void Reserve(FX_STRSIZE len);
+ char* GetBuffer(FX_STRSIZE len);
+ void ReleaseBuffer(FX_STRSIZE len = -1);
+
+ CFX_ByteString Mid(FX_STRSIZE first) const;
+ CFX_ByteString Mid(FX_STRSIZE first, FX_STRSIZE count) const;
+ CFX_ByteString Left(FX_STRSIZE count) const;
+ CFX_ByteString Right(FX_STRSIZE count) const;
+
+ FX_STRSIZE Find(const CFX_ByteStringC& lpszSub, FX_STRSIZE start = 0) const;
+ FX_STRSIZE Find(char ch, FX_STRSIZE start = 0) const;
+ FX_STRSIZE ReverseFind(char ch) const;
+
+ void MakeLower();
+ void MakeUpper();
+
+ void TrimRight();
+ void TrimRight(char chTarget);
+ void TrimRight(const CFX_ByteStringC& lpszTargets);
+
+ void TrimLeft();
+ void TrimLeft(char chTarget);
+ void TrimLeft(const CFX_ByteStringC& lpszTargets);
+
+ FX_STRSIZE Replace(const CFX_ByteStringC& lpszOld,
+ const CFX_ByteStringC& lpszNew);
+
+ FX_STRSIZE Remove(char ch);
+
+ CFX_WideString UTF8Decode() const;
+
+ uint32_t GetID(FX_STRSIZE start_pos = 0) const;
+
+#define FXFORMAT_SIGNED 1
+#define FXFORMAT_HEX 2
+#define FXFORMAT_CAPITAL 4
+
+ static CFX_ByteString FormatInteger(int i, uint32_t flags = 0);
+ static CFX_ByteString FormatFloat(float f, int precision = 0);
+
+ protected:
+ using StringData = CFX_StringDataTemplate<char>;
+
+ void ReallocBeforeWrite(FX_STRSIZE nNewLen);
+ void AllocBeforeWrite(FX_STRSIZE nNewLen);
+ void AllocCopy(CFX_ByteString& dest,
+ FX_STRSIZE nCopyLen,
+ FX_STRSIZE nCopyIndex) const;
+ void AssignCopy(const char* pSrcData, FX_STRSIZE nSrcLen);
+ void Concat(const char* lpszSrcData, FX_STRSIZE nSrcLen);
+
+ CFX_RetainPtr<StringData> m_pData;
+
+ friend class fxcrt_ByteStringConcat_Test;
+ friend class fxcrt_ByteStringPool_Test;
+};
+
+inline bool operator==(const char* lhs, const CFX_ByteString& rhs) {
+ return rhs == lhs;
+}
+inline bool operator==(const CFX_ByteStringC& lhs, const CFX_ByteString& rhs) {
+ return rhs == lhs;
+}
+inline bool operator!=(const char* lhs, const CFX_ByteString& rhs) {
+ return rhs != lhs;
+}
+inline bool operator!=(const CFX_ByteStringC& lhs, const CFX_ByteString& rhs) {
+ return rhs != lhs;
+}
+
+inline CFX_ByteString operator+(const CFX_ByteStringC& str1,
+ const CFX_ByteStringC& str2) {
+ return CFX_ByteString(str1, str2);
+}
+inline CFX_ByteString operator+(const CFX_ByteStringC& str1, const char* str2) {
+ return CFX_ByteString(str1, str2);
+}
+inline CFX_ByteString operator+(const char* str1, const CFX_ByteStringC& str2) {
+ return CFX_ByteString(str1, str2);
+}
+inline CFX_ByteString operator+(const CFX_ByteStringC& str1, char ch) {
+ return CFX_ByteString(str1, CFX_ByteStringC(ch));
+}
+inline CFX_ByteString operator+(char ch, const CFX_ByteStringC& str2) {
+ return CFX_ByteString(ch, str2);
+}
+inline CFX_ByteString operator+(const CFX_ByteString& str1,
+ const CFX_ByteString& str2) {
+ return CFX_ByteString(str1.AsStringC(), str2.AsStringC());
+}
+inline CFX_ByteString operator+(const CFX_ByteString& str1, char ch) {
+ return CFX_ByteString(str1.AsStringC(), CFX_ByteStringC(ch));
+}
+inline CFX_ByteString operator+(char ch, const CFX_ByteString& str2) {
+ return CFX_ByteString(ch, str2.AsStringC());
+}
+inline CFX_ByteString operator+(const CFX_ByteString& str1, const char* str2) {
+ return CFX_ByteString(str1.AsStringC(), str2);
+}
+inline CFX_ByteString operator+(const char* str1, const CFX_ByteString& str2) {
+ return CFX_ByteString(str1, str2.AsStringC());
+}
+inline CFX_ByteString operator+(const CFX_ByteString& str1,
+ const CFX_ByteStringC& str2) {
+ return CFX_ByteString(str1.AsStringC(), str2);
+}
+inline CFX_ByteString operator+(const CFX_ByteStringC& str1,
+ const CFX_ByteString& str2) {
+ return CFX_ByteString(str1, str2.AsStringC());
+}
+
+uint32_t FX_HashCode_GetA(const CFX_ByteStringC& str, bool bIgnoreCase);
+
+namespace std {
+
+template <>
+struct hash<CFX_ByteString> {
+ std::size_t operator()(const CFX_ByteString& str) const {
+ return FX_HashCode_GetA(str.AsStringC(), false);
+ }
+};
+
+} // namespace std
+
+extern template struct std::hash<CFX_ByteString>;
+
+#endif // CORE_FXCRT_CFX_BYTESTRING_H_
diff --git a/chromium/third_party/pdfium/core/fxcrt/cfx_bytestring_unittest.cpp b/chromium/third_party/pdfium/core/fxcrt/cfx_bytestring_unittest.cpp
new file mode 100644
index 00000000000..3b679a086ce
--- /dev/null
+++ b/chromium/third_party/pdfium/core/fxcrt/cfx_bytestring_unittest.cpp
@@ -0,0 +1,1098 @@
+// 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.
+
+#include "core/fxcrt/cfx_bytestring.h"
+
+#include "testing/fx_string_testhelpers.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+TEST(fxcrt, ByteStringOperatorSubscript) {
+ // CFX_ByteString includes the NUL terminator for non-empty strings.
+ CFX_ByteString abc("abc");
+ EXPECT_EQ('a', abc[0]);
+ EXPECT_EQ('b', abc[1]);
+ EXPECT_EQ('c', abc[2]);
+ EXPECT_EQ(0, abc[3]);
+}
+
+TEST(fxcrt, ByteStringOperatorLT) {
+ CFX_ByteString empty;
+ CFX_ByteString a("a");
+ CFX_ByteString abc("abc");
+ CFX_ByteString def("def");
+
+ EXPECT_FALSE(empty < empty);
+ EXPECT_FALSE(a < a);
+ EXPECT_FALSE(abc < abc);
+ EXPECT_FALSE(def < def);
+
+ EXPECT_TRUE(empty < a);
+ EXPECT_FALSE(a < empty);
+
+ EXPECT_TRUE(empty < abc);
+ EXPECT_FALSE(abc < empty);
+
+ EXPECT_TRUE(empty < def);
+ EXPECT_FALSE(def < empty);
+
+ EXPECT_TRUE(a < abc);
+ EXPECT_FALSE(abc < a);
+
+ EXPECT_TRUE(a < def);
+ EXPECT_FALSE(def < a);
+
+ EXPECT_TRUE(abc < def);
+ EXPECT_FALSE(def < abc);
+}
+
+TEST(fxcrt, ByteStringOperatorEQ) {
+ CFX_ByteString null_string;
+ EXPECT_TRUE(null_string == null_string);
+
+ CFX_ByteString empty_string("");
+ EXPECT_TRUE(empty_string == empty_string);
+ EXPECT_TRUE(empty_string == null_string);
+ EXPECT_TRUE(null_string == empty_string);
+
+ CFX_ByteString deleted_string("hello");
+ deleted_string.Delete(0, 5);
+ EXPECT_TRUE(deleted_string == deleted_string);
+ EXPECT_TRUE(deleted_string == null_string);
+ EXPECT_TRUE(deleted_string == empty_string);
+ EXPECT_TRUE(null_string == deleted_string);
+ EXPECT_TRUE(empty_string == deleted_string);
+
+ CFX_ByteString byte_string("hello");
+ EXPECT_TRUE(byte_string == byte_string);
+ EXPECT_FALSE(byte_string == null_string);
+ EXPECT_FALSE(byte_string == empty_string);
+ EXPECT_FALSE(byte_string == deleted_string);
+ EXPECT_FALSE(null_string == byte_string);
+ EXPECT_FALSE(empty_string == byte_string);
+ EXPECT_FALSE(deleted_string == byte_string);
+
+ CFX_ByteString byte_string_same1("hello");
+ EXPECT_TRUE(byte_string == byte_string_same1);
+ EXPECT_TRUE(byte_string_same1 == byte_string);
+
+ CFX_ByteString byte_string_same2(byte_string);
+ EXPECT_TRUE(byte_string == byte_string_same2);
+ EXPECT_TRUE(byte_string_same2 == byte_string);
+
+ CFX_ByteString byte_string1("he");
+ CFX_ByteString byte_string2("hellp");
+ CFX_ByteString byte_string3("hellod");
+ EXPECT_FALSE(byte_string == byte_string1);
+ EXPECT_FALSE(byte_string == byte_string2);
+ EXPECT_FALSE(byte_string == byte_string3);
+ EXPECT_FALSE(byte_string1 == byte_string);
+ EXPECT_FALSE(byte_string2 == byte_string);
+ EXPECT_FALSE(byte_string3 == byte_string);
+
+ CFX_ByteStringC null_string_c;
+ CFX_ByteStringC empty_string_c("");
+ EXPECT_TRUE(null_string == null_string_c);
+ EXPECT_TRUE(null_string == empty_string_c);
+ EXPECT_TRUE(empty_string == null_string_c);
+ EXPECT_TRUE(empty_string == empty_string_c);
+ EXPECT_TRUE(deleted_string == null_string_c);
+ EXPECT_TRUE(deleted_string == empty_string_c);
+ EXPECT_TRUE(null_string_c == null_string);
+ EXPECT_TRUE(empty_string_c == null_string);
+ EXPECT_TRUE(null_string_c == empty_string);
+ EXPECT_TRUE(empty_string_c == empty_string);
+ EXPECT_TRUE(null_string_c == deleted_string);
+ EXPECT_TRUE(empty_string_c == deleted_string);
+
+ CFX_ByteStringC byte_string_c_same1("hello");
+ EXPECT_TRUE(byte_string == byte_string_c_same1);
+ EXPECT_TRUE(byte_string_c_same1 == byte_string);
+
+ CFX_ByteStringC byte_string_c1("he");
+ CFX_ByteStringC byte_string_c2("hellp");
+ CFX_ByteStringC byte_string_c3("hellod");
+ EXPECT_FALSE(byte_string == byte_string_c1);
+ EXPECT_FALSE(byte_string == byte_string_c2);
+ EXPECT_FALSE(byte_string == byte_string_c3);
+ EXPECT_FALSE(byte_string_c1 == byte_string);
+ EXPECT_FALSE(byte_string_c2 == byte_string);
+ EXPECT_FALSE(byte_string_c3 == byte_string);
+
+ const char* c_null_string = nullptr;
+ const char* c_empty_string = "";
+ EXPECT_TRUE(null_string == c_null_string);
+ EXPECT_TRUE(null_string == c_empty_string);
+ EXPECT_TRUE(empty_string == c_null_string);
+ EXPECT_TRUE(empty_string == c_empty_string);
+ EXPECT_TRUE(deleted_string == c_null_string);
+ EXPECT_TRUE(deleted_string == c_empty_string);
+ EXPECT_TRUE(c_null_string == null_string);
+ EXPECT_TRUE(c_empty_string == null_string);
+ EXPECT_TRUE(c_null_string == empty_string);
+ EXPECT_TRUE(c_empty_string == empty_string);
+ EXPECT_TRUE(c_null_string == deleted_string);
+ EXPECT_TRUE(c_empty_string == deleted_string);
+
+ const char* c_string_same1 = "hello";
+ EXPECT_TRUE(byte_string == c_string_same1);
+ EXPECT_TRUE(c_string_same1 == byte_string);
+
+ const char* c_string1 = "he";
+ const char* c_string2 = "hellp";
+ const char* c_string3 = "hellod";
+ EXPECT_FALSE(byte_string == c_string1);
+ EXPECT_FALSE(byte_string == c_string2);
+ EXPECT_FALSE(byte_string == c_string3);
+ EXPECT_FALSE(c_string1 == byte_string);
+ EXPECT_FALSE(c_string2 == byte_string);
+ EXPECT_FALSE(c_string3 == byte_string);
+}
+
+TEST(fxcrt, ByteStringOperatorNE) {
+ CFX_ByteString null_string;
+ EXPECT_FALSE(null_string != null_string);
+
+ CFX_ByteString empty_string("");
+ EXPECT_FALSE(empty_string != empty_string);
+ EXPECT_FALSE(empty_string != null_string);
+ EXPECT_FALSE(null_string != empty_string);
+
+ CFX_ByteString deleted_string("hello");
+ deleted_string.Delete(0, 5);
+ EXPECT_FALSE(deleted_string != deleted_string);
+ EXPECT_FALSE(deleted_string != null_string);
+ EXPECT_FALSE(deleted_string != empty_string);
+ EXPECT_FALSE(deleted_string != deleted_string);
+ EXPECT_FALSE(null_string != deleted_string);
+ EXPECT_FALSE(empty_string != deleted_string);
+ EXPECT_FALSE(deleted_string != deleted_string);
+
+ CFX_ByteString byte_string("hello");
+ EXPECT_FALSE(byte_string != byte_string);
+ EXPECT_TRUE(byte_string != null_string);
+ EXPECT_TRUE(byte_string != empty_string);
+ EXPECT_TRUE(byte_string != deleted_string);
+ EXPECT_TRUE(null_string != byte_string);
+ EXPECT_TRUE(empty_string != byte_string);
+ EXPECT_TRUE(deleted_string != byte_string);
+
+ CFX_ByteString byte_string_same1("hello");
+ EXPECT_FALSE(byte_string != byte_string_same1);
+ EXPECT_FALSE(byte_string_same1 != byte_string);
+
+ CFX_ByteString byte_string_same2(byte_string);
+ EXPECT_FALSE(byte_string != byte_string_same2);
+ EXPECT_FALSE(byte_string_same2 != byte_string);
+
+ CFX_ByteString byte_string1("he");
+ CFX_ByteString byte_string2("hellp");
+ CFX_ByteString byte_string3("hellod");
+ EXPECT_TRUE(byte_string != byte_string1);
+ EXPECT_TRUE(byte_string != byte_string2);
+ EXPECT_TRUE(byte_string != byte_string3);
+ EXPECT_TRUE(byte_string1 != byte_string);
+ EXPECT_TRUE(byte_string2 != byte_string);
+ EXPECT_TRUE(byte_string3 != byte_string);
+
+ CFX_ByteStringC null_string_c;
+ CFX_ByteStringC empty_string_c("");
+ EXPECT_FALSE(null_string != null_string_c);
+ EXPECT_FALSE(null_string != empty_string_c);
+ EXPECT_FALSE(empty_string != null_string_c);
+ EXPECT_FALSE(empty_string != empty_string_c);
+ EXPECT_FALSE(null_string_c != null_string);
+ EXPECT_FALSE(empty_string_c != null_string);
+ EXPECT_FALSE(null_string_c != empty_string);
+ EXPECT_FALSE(empty_string_c != empty_string);
+
+ CFX_ByteStringC byte_string_c_same1("hello");
+ EXPECT_FALSE(byte_string != byte_string_c_same1);
+ EXPECT_FALSE(byte_string_c_same1 != byte_string);
+
+ CFX_ByteStringC byte_string_c1("he");
+ CFX_ByteStringC byte_string_c2("hellp");
+ CFX_ByteStringC byte_string_c3("hellod");
+ EXPECT_TRUE(byte_string != byte_string_c1);
+ EXPECT_TRUE(byte_string != byte_string_c2);
+ EXPECT_TRUE(byte_string != byte_string_c3);
+ EXPECT_TRUE(byte_string_c1 != byte_string);
+ EXPECT_TRUE(byte_string_c2 != byte_string);
+ EXPECT_TRUE(byte_string_c3 != byte_string);
+
+ const char* c_null_string = nullptr;
+ const char* c_empty_string = "";
+ EXPECT_FALSE(null_string != c_null_string);
+ EXPECT_FALSE(null_string != c_empty_string);
+ EXPECT_FALSE(empty_string != c_null_string);
+ EXPECT_FALSE(empty_string != c_empty_string);
+ EXPECT_FALSE(deleted_string != c_null_string);
+ EXPECT_FALSE(deleted_string != c_empty_string);
+ EXPECT_FALSE(c_null_string != null_string);
+ EXPECT_FALSE(c_empty_string != null_string);
+ EXPECT_FALSE(c_null_string != empty_string);
+ EXPECT_FALSE(c_empty_string != empty_string);
+ EXPECT_FALSE(c_null_string != deleted_string);
+ EXPECT_FALSE(c_empty_string != deleted_string);
+
+ const char* c_string_same1 = "hello";
+ EXPECT_FALSE(byte_string != c_string_same1);
+ EXPECT_FALSE(c_string_same1 != byte_string);
+
+ const char* c_string1 = "he";
+ const char* c_string2 = "hellp";
+ const char* c_string3 = "hellod";
+ EXPECT_TRUE(byte_string != c_string1);
+ EXPECT_TRUE(byte_string != c_string2);
+ EXPECT_TRUE(byte_string != c_string3);
+ EXPECT_TRUE(c_string1 != byte_string);
+ EXPECT_TRUE(c_string2 != byte_string);
+ EXPECT_TRUE(c_string3 != byte_string);
+}
+
+TEST(fxcrt, ByteStringCNull) {
+ CFX_ByteStringC null_string;
+ EXPECT_FALSE(null_string.raw_str());
+ EXPECT_EQ(null_string.GetLength(), 0);
+ EXPECT_TRUE(null_string.IsEmpty());
+
+ CFX_ByteStringC another_null_string;
+ EXPECT_EQ(null_string, another_null_string);
+
+ CFX_ByteStringC copied_null_string(null_string);
+ EXPECT_FALSE(copied_null_string.raw_str());
+ EXPECT_EQ(copied_null_string.GetLength(), 0);
+ EXPECT_TRUE(copied_null_string.IsEmpty());
+ EXPECT_EQ(null_string, copied_null_string);
+
+ CFX_ByteStringC empty_string(""); // Pointer to NUL, not NULL pointer.
+ EXPECT_TRUE(empty_string.raw_str());
+ EXPECT_EQ(empty_string.GetLength(), 0);
+ EXPECT_TRUE(empty_string.IsEmpty());
+ EXPECT_EQ(null_string, empty_string);
+
+ CFX_ByteStringC assigned_null_string("initially not nullptr");
+ assigned_null_string = null_string;
+ EXPECT_FALSE(assigned_null_string.raw_str());
+ EXPECT_EQ(assigned_null_string.GetLength(), 0);
+ EXPECT_TRUE(assigned_null_string.IsEmpty());
+ EXPECT_EQ(null_string, assigned_null_string);
+
+ CFX_ByteStringC assigned_nullptr_string("initially not nullptr");
+ assigned_nullptr_string = (const char*)nullptr;
+ EXPECT_FALSE(assigned_nullptr_string.raw_str());
+ EXPECT_EQ(assigned_nullptr_string.GetLength(), 0);
+ EXPECT_TRUE(assigned_nullptr_string.IsEmpty());
+ EXPECT_EQ(null_string, assigned_nullptr_string);
+
+ CFX_ByteStringC non_null_string("a");
+ EXPECT_NE(null_string, non_null_string);
+}
+
+TEST(fxcrt, ByteStringConcat) {
+ CFX_ByteString fred;
+ fred.Concat("FRED", 4);
+ EXPECT_EQ("FRED", fred);
+
+ fred.Concat("DY", 2);
+ EXPECT_EQ("FREDDY", fred);
+
+ fred.Delete(3, 3);
+ EXPECT_EQ("FRE", fred);
+
+ fred.Concat("D", 1);
+ EXPECT_EQ("FRED", fred);
+
+ CFX_ByteString copy = fred;
+ fred.Concat("DY", 2);
+ EXPECT_EQ("FREDDY", fred);
+ EXPECT_EQ("FRED", copy);
+
+ // Test invalid arguments.
+ copy = fred;
+ fred.Concat("freddy", -6);
+ CFX_ByteString not_aliased("xxxxxx");
+ EXPECT_EQ("FREDDY", fred);
+ EXPECT_EQ("xxxxxx", not_aliased);
+}
+
+TEST(fxcrt, ByteStringRemove) {
+ CFX_ByteString freed("FREED");
+ freed.Remove('E');
+ EXPECT_EQ("FRD", freed);
+ freed.Remove('F');
+ EXPECT_EQ("RD", freed);
+ freed.Remove('D');
+ EXPECT_EQ("R", freed);
+ freed.Remove('X');
+ EXPECT_EQ("R", freed);
+ freed.Remove('R');
+ EXPECT_EQ("", freed);
+
+ CFX_ByteString empty;
+ empty.Remove('X');
+ EXPECT_EQ("", empty);
+}
+
+TEST(fxcrt, ByteStringRemoveCopies) {
+ CFX_ByteString freed("FREED");
+ const char* old_buffer = freed.c_str();
+
+ // No change with single reference - no copy.
+ freed.Remove('Q');
+ EXPECT_EQ("FREED", freed);
+ EXPECT_EQ(old_buffer, freed.c_str());
+
+ // Change with single reference - no copy.
+ freed.Remove('E');
+ EXPECT_EQ("FRD", freed);
+ EXPECT_EQ(old_buffer, freed.c_str());
+
+ // No change with multiple references - no copy.
+ CFX_ByteString shared(freed);
+ freed.Remove('Q');
+ EXPECT_EQ("FRD", freed);
+ EXPECT_EQ(old_buffer, freed.c_str());
+ EXPECT_EQ(old_buffer, shared.c_str());
+
+ // Change with multiple references -- must copy.
+ freed.Remove('D');
+ EXPECT_EQ("FR", freed);
+ EXPECT_NE(old_buffer, freed.c_str());
+ EXPECT_EQ("FRD", shared);
+ EXPECT_EQ(old_buffer, shared.c_str());
+}
+
+TEST(fxcrt, ByteStringReplace) {
+ CFX_ByteString fred("FRED");
+ fred.Replace("FR", "BL");
+ EXPECT_EQ("BLED", fred);
+ fred.Replace("D", "DDY");
+ EXPECT_EQ("BLEDDY", fred);
+ fred.Replace("LEDD", "");
+ EXPECT_EQ("BY", fred);
+ fred.Replace("X", "CLAMS");
+ EXPECT_EQ("BY", fred);
+ fred.Replace("BY", "HI");
+ EXPECT_EQ("HI", fred);
+ fred.Replace("", "CLAMS");
+ EXPECT_EQ("HI", fred);
+ fred.Replace("HI", "");
+ EXPECT_EQ("", fred);
+}
+
+TEST(fxcrt, ByteStringInsert) {
+ CFX_ByteString fred("FRED");
+ fred.Insert(-1, 'X');
+ EXPECT_EQ("XFRED", fred);
+ fred.Insert(0, 'S');
+ EXPECT_EQ("SXFRED", fred);
+ fred.Insert(2, 'T');
+ EXPECT_EQ("SXTFRED", fred);
+ fred.Insert(5, 'U');
+ EXPECT_EQ("SXTFRUED", fred);
+ fred.Insert(8, 'V');
+ EXPECT_EQ("SXTFRUEDV", fred);
+ fred.Insert(12, 'P');
+ EXPECT_EQ("SXTFRUEDVP", fred);
+ {
+ CFX_ByteString empty;
+ empty.Insert(-1, 'X');
+ EXPECT_EQ("X", empty);
+ }
+ {
+ CFX_ByteString empty;
+ empty.Insert(0, 'X');
+ EXPECT_EQ("X", empty);
+ }
+ {
+ CFX_ByteString empty;
+ empty.Insert(5, 'X');
+ EXPECT_EQ("X", empty);
+ }
+}
+
+TEST(fxcrt, ByteStringDelete) {
+ CFX_ByteString fred("FRED");
+ fred.Delete(0, 2);
+ EXPECT_EQ("ED", fred);
+ fred.Delete(1);
+ EXPECT_EQ("E", fred);
+ fred.Delete(-1);
+ EXPECT_EQ("", fred);
+ fred.Delete(1);
+ EXPECT_EQ("", fred);
+
+ CFX_ByteString empty;
+ empty.Delete(0);
+ EXPECT_EQ("", empty);
+ empty.Delete(-1);
+ EXPECT_EQ("", empty);
+ empty.Delete(1);
+ EXPECT_EQ("", empty);
+}
+
+TEST(fxcrt, ByteStringMid) {
+ CFX_ByteString fred("FRED");
+ EXPECT_EQ("", fred.Mid(0, 0));
+ EXPECT_EQ("", fred.Mid(3, 0));
+ EXPECT_EQ("FRED", fred.Mid(0));
+ EXPECT_EQ("RED", fred.Mid(1));
+ EXPECT_EQ("ED", fred.Mid(2));
+ EXPECT_EQ("D", fred.Mid(3));
+ EXPECT_EQ("F", fred.Mid(0, 1));
+ EXPECT_EQ("R", fred.Mid(1, 1));
+ EXPECT_EQ("E", fred.Mid(2, 1));
+ EXPECT_EQ("D", fred.Mid(3, 1));
+ EXPECT_EQ("FR", fred.Mid(0, 2));
+ EXPECT_EQ("FRED", fred.Mid(0, 4));
+ EXPECT_EQ("FRED", fred.Mid(0, 10));
+
+ EXPECT_EQ("FR", fred.Mid(-1, 2));
+ EXPECT_EQ("RED", fred.Mid(1, 4));
+ EXPECT_EQ("", fred.Mid(4, 1));
+
+ CFX_ByteString empty;
+ EXPECT_EQ("", empty.Mid(0, 0));
+ EXPECT_EQ("", empty.Mid(0));
+ EXPECT_EQ("", empty.Mid(1));
+ EXPECT_EQ("", empty.Mid(-1));
+}
+
+TEST(fxcrt, ByteStringLeft) {
+ CFX_ByteString fred("FRED");
+ EXPECT_EQ("", fred.Left(0));
+ EXPECT_EQ("F", fred.Left(1));
+ EXPECT_EQ("FR", fred.Left(2));
+ EXPECT_EQ("FRE", fred.Left(3));
+ EXPECT_EQ("FRED", fred.Left(4));
+
+ EXPECT_EQ("FRED", fred.Left(5));
+ EXPECT_EQ("", fred.Left(-1));
+
+ CFX_ByteString empty;
+ EXPECT_EQ("", empty.Left(0));
+ EXPECT_EQ("", empty.Left(1));
+ EXPECT_EQ("", empty.Left(-1));
+}
+
+TEST(fxcrt, ByteStringRight) {
+ CFX_ByteString fred("FRED");
+ EXPECT_EQ("", fred.Right(0));
+ EXPECT_EQ("D", fred.Right(1));
+ EXPECT_EQ("ED", fred.Right(2));
+ EXPECT_EQ("RED", fred.Right(3));
+ EXPECT_EQ("FRED", fred.Right(4));
+
+ EXPECT_EQ("FRED", fred.Right(5));
+ EXPECT_EQ("", fred.Right(-1));
+
+ CFX_ByteString empty;
+ EXPECT_EQ("", empty.Right(0));
+ EXPECT_EQ("", empty.Right(1));
+ EXPECT_EQ("", empty.Right(-1));
+}
+
+TEST(fxcrt, ByteStringUpperLower) {
+ CFX_ByteString fred("F-Re.42D");
+ fred.MakeLower();
+ EXPECT_EQ("f-re.42d", fred);
+ fred.MakeUpper();
+ EXPECT_EQ("F-RE.42D", fred);
+
+ CFX_ByteString empty;
+ empty.MakeLower();
+ EXPECT_EQ("", empty);
+ empty.MakeUpper();
+ EXPECT_EQ("", empty);
+}
+
+TEST(fxcrt, ByteStringTrimRight) {
+ CFX_ByteString fred(" FRED ");
+ fred.TrimRight();
+ EXPECT_EQ(" FRED", fred);
+ fred.TrimRight('E');
+ EXPECT_EQ(" FRED", fred);
+ fred.TrimRight('D');
+ EXPECT_EQ(" FRE", fred);
+ fred.TrimRight("ERP");
+ EXPECT_EQ(" F", fred);
+
+ CFX_ByteString blank(" ");
+ blank.TrimRight("ERP");
+ EXPECT_EQ(" ", blank);
+ blank.TrimRight('E');
+ EXPECT_EQ(" ", blank);
+ blank.TrimRight();
+ EXPECT_EQ("", blank);
+
+ CFX_ByteString empty;
+ empty.TrimRight("ERP");
+ EXPECT_EQ("", empty);
+ empty.TrimRight('E');
+ EXPECT_EQ("", empty);
+ empty.TrimRight();
+ EXPECT_EQ("", empty);
+}
+
+TEST(fxcrt, ByteStringTrimRightCopies) {
+ {
+ // With a single reference, no copy takes place.
+ CFX_ByteString fred(" FRED ");
+ const char* old_buffer = fred.c_str();
+ fred.TrimRight();
+ EXPECT_EQ(" FRED", fred);
+ EXPECT_EQ(old_buffer, fred.c_str());
+ }
+ {
+ // With multiple references, we must copy.
+ CFX_ByteString fred(" FRED ");
+ CFX_ByteString other_fred = fred;
+ const char* old_buffer = fred.c_str();
+ fred.TrimRight();
+ EXPECT_EQ(" FRED", fred);
+ EXPECT_EQ(" FRED ", other_fred);
+ EXPECT_NE(old_buffer, fred.c_str());
+ }
+ {
+ // With multiple references, but no modifications, no copy.
+ CFX_ByteString fred("FRED");
+ CFX_ByteString other_fred = fred;
+ const char* old_buffer = fred.c_str();
+ fred.TrimRight();
+ EXPECT_EQ("FRED", fred);
+ EXPECT_EQ("FRED", other_fred);
+ EXPECT_EQ(old_buffer, fred.c_str());
+ }
+}
+
+TEST(fxcrt, ByteStringTrimLeft) {
+ CFX_ByteString fred(" FRED ");
+ fred.TrimLeft();
+ EXPECT_EQ("FRED ", fred);
+ fred.TrimLeft('E');
+ EXPECT_EQ("FRED ", fred);
+ fred.TrimLeft('F');
+ EXPECT_EQ("RED ", fred);
+ fred.TrimLeft("ERP");
+ EXPECT_EQ("D ", fred);
+
+ CFX_ByteString blank(" ");
+ blank.TrimLeft("ERP");
+ EXPECT_EQ(" ", blank);
+ blank.TrimLeft('E');
+ EXPECT_EQ(" ", blank);
+ blank.TrimLeft();
+ EXPECT_EQ("", blank);
+
+ CFX_ByteString empty;
+ empty.TrimLeft("ERP");
+ EXPECT_EQ("", empty);
+ empty.TrimLeft('E');
+ EXPECT_EQ("", empty);
+ empty.TrimLeft();
+ EXPECT_EQ("", empty);
+}
+
+TEST(fxcrt, ByteStringTrimLeftCopies) {
+ {
+ // With a single reference, no copy takes place.
+ CFX_ByteString fred(" FRED ");
+ const char* old_buffer = fred.c_str();
+ fred.TrimLeft();
+ EXPECT_EQ("FRED ", fred);
+ EXPECT_EQ(old_buffer, fred.c_str());
+ }
+ {
+ // With multiple references, we must copy.
+ CFX_ByteString fred(" FRED ");
+ CFX_ByteString other_fred = fred;
+ const char* old_buffer = fred.c_str();
+ fred.TrimLeft();
+ EXPECT_EQ("FRED ", fred);
+ EXPECT_EQ(" FRED ", other_fred);
+ EXPECT_NE(old_buffer, fred.c_str());
+ }
+ {
+ // With multiple references, but no modifications, no copy.
+ CFX_ByteString fred("FRED");
+ CFX_ByteString other_fred = fred;
+ const char* old_buffer = fred.c_str();
+ fred.TrimLeft();
+ EXPECT_EQ("FRED", fred);
+ EXPECT_EQ("FRED", other_fred);
+ EXPECT_EQ(old_buffer, fred.c_str());
+ }
+}
+
+TEST(fxcrt, ByteStringReserve) {
+ {
+ CFX_ByteString str;
+ str.Reserve(6);
+ const char* old_buffer = str.c_str();
+ str += "ABCDEF";
+ EXPECT_EQ(old_buffer, str.c_str());
+ str += "Blah Blah Blah Blah Blah Blah";
+ EXPECT_NE(old_buffer, str.c_str());
+ }
+ {
+ CFX_ByteString str("A");
+ str.Reserve(6);
+ const char* old_buffer = str.c_str();
+ str += "BCDEF";
+ EXPECT_EQ(old_buffer, str.c_str());
+ str += "Blah Blah Blah Blah Blah Blah";
+ EXPECT_NE(old_buffer, str.c_str());
+ }
+}
+
+TEST(fxcrt, ByteStringGetBuffer) {
+ {
+ CFX_ByteString str;
+ char* buffer = str.GetBuffer(12);
+ // NOLINTNEXTLINE(runtime/printf)
+ strcpy(buffer, "clams");
+ str.ReleaseBuffer();
+ EXPECT_EQ("clams", str);
+ }
+ {
+ CFX_ByteString str("cl");
+ char* buffer = str.GetBuffer(12);
+ // NOLINTNEXTLINE(runtime/printf)
+ strcpy(buffer + 2, "ams");
+ str.ReleaseBuffer();
+ EXPECT_EQ("clams", str);
+ }
+}
+
+TEST(fxcrt, ByteStringReleaseBuffer) {
+ {
+ CFX_ByteString str;
+ str.Reserve(12);
+ str += "clams";
+ const char* old_buffer = str.c_str();
+ str.ReleaseBuffer(4);
+ EXPECT_EQ(old_buffer, str.c_str());
+ EXPECT_EQ("clam", str);
+ }
+ {
+ CFX_ByteString str("c");
+ str.Reserve(12);
+ str += "lams";
+ const char* old_buffer = str.c_str();
+ str.ReleaseBuffer(4);
+ EXPECT_EQ(old_buffer, str.c_str());
+ EXPECT_EQ("clam", str);
+ }
+ {
+ CFX_ByteString str;
+ str.Reserve(200);
+ str += "clams";
+ const char* old_buffer = str.c_str();
+ str.ReleaseBuffer(4);
+ EXPECT_NE(old_buffer, str.c_str());
+ EXPECT_EQ("clam", str);
+ }
+ {
+ CFX_ByteString str("c");
+ str.Reserve(200);
+ str += "lams";
+ const char* old_buffer = str.c_str();
+ str.ReleaseBuffer(4);
+ EXPECT_NE(old_buffer, str.c_str());
+ EXPECT_EQ("clam", str);
+ }
+}
+
+TEST(fxcrt, ByteStringCNotNull) {
+ CFX_ByteStringC string3("abc");
+ CFX_ByteStringC string6("abcdef");
+ CFX_ByteStringC alternate_string3("abcdef", 3);
+ CFX_ByteStringC embedded_nul_string7("abc\0def", 7);
+ CFX_ByteStringC illegal_string7("abcdef", 7);
+
+ EXPECT_EQ(3, string3.GetLength());
+ EXPECT_EQ(6, string6.GetLength());
+ EXPECT_EQ(3, alternate_string3.GetLength());
+ EXPECT_EQ(7, embedded_nul_string7.GetLength());
+ EXPECT_EQ(7, illegal_string7.GetLength());
+
+ EXPECT_NE(string3, string6);
+ EXPECT_EQ(string3, alternate_string3);
+ EXPECT_NE(string3, embedded_nul_string7);
+ EXPECT_NE(string3, illegal_string7);
+ EXPECT_NE(string6, alternate_string3);
+ EXPECT_NE(string6, embedded_nul_string7);
+ EXPECT_NE(string6, illegal_string7);
+ EXPECT_NE(alternate_string3, embedded_nul_string7);
+ EXPECT_NE(alternate_string3, illegal_string7);
+ EXPECT_NE(embedded_nul_string7, illegal_string7);
+
+ CFX_ByteStringC copied_string3(string3);
+ CFX_ByteStringC copied_alternate_string3(alternate_string3);
+ CFX_ByteStringC copied_embedded_nul_string7(embedded_nul_string7);
+
+ EXPECT_EQ(string3, copied_string3);
+ EXPECT_EQ(alternate_string3, copied_alternate_string3);
+ EXPECT_EQ(embedded_nul_string7, copied_embedded_nul_string7);
+
+ CFX_ByteStringC assigned_string3("intially something else");
+ CFX_ByteStringC assigned_alternate_string3("initally something else");
+ CFX_ByteStringC assigned_ptr_string3("initially something else");
+ CFX_ByteStringC assigned_embedded_nul_string7("initially something else");
+
+ assigned_string3 = string3;
+ assigned_alternate_string3 = alternate_string3;
+ assigned_ptr_string3 = "abc";
+ assigned_embedded_nul_string7 = embedded_nul_string7;
+ EXPECT_EQ(string3, assigned_string3);
+ EXPECT_EQ(alternate_string3, assigned_alternate_string3);
+ EXPECT_EQ(alternate_string3, assigned_ptr_string3);
+ EXPECT_EQ(embedded_nul_string7, assigned_embedded_nul_string7);
+}
+
+TEST(fxcrt, ByteStringCFromChar) {
+ CFX_ByteStringC null_string;
+ CFX_ByteStringC lower_a_string("a");
+
+ // Must have lvalues that outlive the corresponding ByteStringC.
+ char nul = '\0';
+ char lower_a = 'a';
+ CFX_ByteStringC nul_string_from_char(nul);
+ CFX_ByteStringC lower_a_string_from_char(lower_a);
+
+ // Pointer to nul, not nullptr ptr, hence length 1 ...
+ EXPECT_EQ(1, nul_string_from_char.GetLength());
+ EXPECT_NE(null_string, nul_string_from_char);
+
+ EXPECT_EQ(1, lower_a_string_from_char.GetLength());
+ EXPECT_EQ(lower_a_string, lower_a_string_from_char);
+ EXPECT_NE(nul_string_from_char, lower_a_string_from_char);
+
+ CFX_ByteStringC longer_string("ab");
+ EXPECT_NE(longer_string, lower_a_string_from_char);
+}
+
+TEST(fxcrt, ByteStringCGetID) {
+ CFX_ByteStringC null_string;
+ EXPECT_EQ(0u, null_string.GetID());
+ EXPECT_EQ(0u, null_string.GetID(1));
+ EXPECT_EQ(0u, null_string.GetID(-1));
+ EXPECT_EQ(0u, null_string.GetID(-1000000));
+
+ CFX_ByteStringC empty_string("");
+ EXPECT_EQ(0u, empty_string.GetID());
+ EXPECT_EQ(0u, empty_string.GetID(1));
+ EXPECT_EQ(0u, empty_string.GetID(-1));
+ EXPECT_EQ(0u, empty_string.GetID(-1000000));
+
+ CFX_ByteStringC short_string("ab");
+ EXPECT_EQ(FXBSTR_ID('a', 'b', 0, 0), short_string.GetID());
+ EXPECT_EQ(FXBSTR_ID('b', 0, 0, 0), short_string.GetID(1));
+ EXPECT_EQ(0u, short_string.GetID(2));
+ EXPECT_EQ(0u, short_string.GetID(-1));
+ EXPECT_EQ(0u, short_string.GetID(-1000000));
+
+ CFX_ByteStringC longer_string("abcdef");
+ EXPECT_EQ(FXBSTR_ID('a', 'b', 'c', 'd'), longer_string.GetID());
+ EXPECT_EQ(FXBSTR_ID('b', 'c', 'd', 'e'), longer_string.GetID(1));
+ EXPECT_EQ(FXBSTR_ID('c', 'd', 'e', 'f'), longer_string.GetID(2));
+ EXPECT_EQ(FXBSTR_ID('d', 'e', 'f', 0), longer_string.GetID(3));
+ EXPECT_EQ(FXBSTR_ID('e', 'f', 0, 0), longer_string.GetID(4));
+ EXPECT_EQ(FXBSTR_ID('f', 0, 0, 0), longer_string.GetID(5));
+ EXPECT_EQ(0u, longer_string.GetID(6));
+ EXPECT_EQ(0u, longer_string.GetID(-1));
+ EXPECT_EQ(0u, longer_string.GetID(-1000000));
+}
+
+TEST(fxcrt, ByteStringCFind) {
+ CFX_ByteStringC null_string;
+ EXPECT_EQ(-1, null_string.Find('a'));
+ EXPECT_EQ(-1, null_string.Find(0));
+
+ CFX_ByteStringC empty_string("");
+ EXPECT_EQ(-1, empty_string.Find('a'));
+ EXPECT_EQ(-1, empty_string.Find(0));
+
+ CFX_ByteStringC single_string("a");
+ EXPECT_EQ(0, single_string.Find('a'));
+ EXPECT_EQ(-1, single_string.Find('b'));
+ EXPECT_EQ(-1, single_string.Find(0));
+
+ CFX_ByteStringC longer_string("abccc");
+ EXPECT_EQ(0, longer_string.Find('a'));
+ EXPECT_EQ(2, longer_string.Find('c'));
+ EXPECT_EQ(-1, longer_string.Find(0));
+
+ CFX_ByteStringC hibyte_string(
+ "ab\x8c"
+ "def");
+ EXPECT_EQ(2, hibyte_string.Find('\x8c'));
+}
+
+TEST(fxcrt, ByteStringCMid) {
+ CFX_ByteStringC null_string;
+ EXPECT_EQ(null_string, null_string.Mid(0, 1));
+ EXPECT_EQ(null_string, null_string.Mid(1, 1));
+
+ CFX_ByteStringC empty_string("");
+ EXPECT_EQ(empty_string, empty_string.Mid(0, 1));
+ EXPECT_EQ(empty_string, empty_string.Mid(1, 1));
+
+ CFX_ByteStringC single_character("a");
+ EXPECT_EQ(empty_string, single_character.Mid(0, 0));
+ EXPECT_EQ(single_character, single_character.Mid(0, 1));
+ EXPECT_EQ(empty_string, single_character.Mid(1, 0));
+ EXPECT_EQ(empty_string, single_character.Mid(1, 1));
+
+ CFX_ByteStringC longer_string("abcdef");
+ EXPECT_EQ(longer_string, longer_string.Mid(0, 6));
+ EXPECT_EQ(longer_string, longer_string.Mid(0, 187));
+ EXPECT_EQ(longer_string, longer_string.Mid(-42, 6));
+ EXPECT_EQ(longer_string, longer_string.Mid(-42, 187));
+
+ CFX_ByteStringC leading_substring("ab");
+ EXPECT_EQ(leading_substring, longer_string.Mid(0, 2));
+ EXPECT_EQ(leading_substring, longer_string.Mid(-1, 2));
+
+ CFX_ByteStringC middle_substring("bcde");
+ EXPECT_EQ(middle_substring, longer_string.Mid(1, 4));
+
+ CFX_ByteStringC trailing_substring("ef");
+ EXPECT_EQ(trailing_substring, longer_string.Mid(4, 2));
+ EXPECT_EQ(trailing_substring, longer_string.Mid(4, 3));
+}
+
+TEST(fxcrt, ByteStringCGetAt) {
+ CFX_ByteString short_string("a");
+ CFX_ByteString longer_string("abc");
+ CFX_ByteString embedded_nul_string("ab\0c", 4);
+
+ EXPECT_EQ('a', short_string.GetAt(0));
+ EXPECT_EQ('c', longer_string.GetAt(2));
+ EXPECT_EQ('b', embedded_nul_string.GetAt(1));
+ EXPECT_EQ('\0', embedded_nul_string.GetAt(2));
+ EXPECT_EQ('c', embedded_nul_string.GetAt(3));
+}
+
+TEST(fxcrt, ByteStringCOperatorSubscript) {
+ // CFX_ByteStringC includes the NUL terminator for non-empty strings.
+ CFX_ByteStringC abc("abc");
+ EXPECT_EQ('a', abc[0]);
+ EXPECT_EQ('b', abc[1]);
+ EXPECT_EQ('c', abc[2]);
+ EXPECT_EQ(0, abc[3]);
+}
+
+TEST(fxcrt, ByteStringCOperatorLT) {
+ CFX_ByteStringC empty;
+ CFX_ByteStringC a("a");
+ CFX_ByteStringC abc("abc");
+ CFX_ByteStringC def("def");
+
+ EXPECT_FALSE(empty < empty);
+ EXPECT_FALSE(a < a);
+ EXPECT_FALSE(abc < abc);
+ EXPECT_FALSE(def < def);
+
+ EXPECT_TRUE(empty < a);
+ EXPECT_FALSE(a < empty);
+
+ EXPECT_TRUE(empty < abc);
+ EXPECT_FALSE(abc < empty);
+
+ EXPECT_TRUE(empty < def);
+ EXPECT_FALSE(def < empty);
+
+ EXPECT_TRUE(a < abc);
+ EXPECT_FALSE(abc < a);
+
+ EXPECT_TRUE(a < def);
+ EXPECT_FALSE(def < a);
+
+ EXPECT_TRUE(abc < def);
+ EXPECT_FALSE(def < abc);
+}
+
+TEST(fxcrt, ByteStringCOperatorEQ) {
+ CFX_ByteStringC byte_string_c("hello");
+ EXPECT_TRUE(byte_string_c == byte_string_c);
+
+ CFX_ByteStringC byte_string_c_same1("hello");
+ EXPECT_TRUE(byte_string_c == byte_string_c_same1);
+ EXPECT_TRUE(byte_string_c_same1 == byte_string_c);
+
+ CFX_ByteStringC byte_string_c_same2(byte_string_c);
+ EXPECT_TRUE(byte_string_c == byte_string_c_same2);
+ EXPECT_TRUE(byte_string_c_same2 == byte_string_c);
+
+ CFX_ByteStringC byte_string_c1("he");
+ CFX_ByteStringC byte_string_c2("hellp");
+ CFX_ByteStringC byte_string_c3("hellod");
+ EXPECT_FALSE(byte_string_c == byte_string_c1);
+ EXPECT_FALSE(byte_string_c == byte_string_c2);
+ EXPECT_FALSE(byte_string_c == byte_string_c3);
+ EXPECT_FALSE(byte_string_c1 == byte_string_c);
+ EXPECT_FALSE(byte_string_c2 == byte_string_c);
+ EXPECT_FALSE(byte_string_c3 == byte_string_c);
+
+ CFX_ByteString byte_string_same1("hello");
+ EXPECT_TRUE(byte_string_c == byte_string_same1);
+ EXPECT_TRUE(byte_string_same1 == byte_string_c);
+
+ CFX_ByteString byte_string1("he");
+ CFX_ByteString byte_string2("hellp");
+ CFX_ByteString byte_string3("hellod");
+ EXPECT_FALSE(byte_string_c == byte_string1);
+ EXPECT_FALSE(byte_string_c == byte_string2);
+ EXPECT_FALSE(byte_string_c == byte_string3);
+ EXPECT_FALSE(byte_string1 == byte_string_c);
+ EXPECT_FALSE(byte_string2 == byte_string_c);
+ EXPECT_FALSE(byte_string3 == byte_string_c);
+
+ const char* c_string_same1 = "hello";
+ EXPECT_TRUE(byte_string_c == c_string_same1);
+ EXPECT_TRUE(c_string_same1 == byte_string_c);
+
+ const char* c_string1 = "he";
+ const char* c_string2 = "hellp";
+ const char* c_string3 = "hellod";
+ EXPECT_FALSE(byte_string_c == c_string1);
+ EXPECT_FALSE(byte_string_c == c_string2);
+ EXPECT_FALSE(byte_string_c == c_string3);
+
+ EXPECT_FALSE(c_string1 == byte_string_c);
+ EXPECT_FALSE(c_string2 == byte_string_c);
+ EXPECT_FALSE(c_string3 == byte_string_c);
+}
+
+TEST(fxcrt, ByteStringCOperatorNE) {
+ CFX_ByteStringC byte_string_c("hello");
+ EXPECT_FALSE(byte_string_c != byte_string_c);
+
+ CFX_ByteStringC byte_string_c_same1("hello");
+ EXPECT_FALSE(byte_string_c != byte_string_c_same1);
+ EXPECT_FALSE(byte_string_c_same1 != byte_string_c);
+
+ CFX_ByteStringC byte_string_c_same2(byte_string_c);
+ EXPECT_FALSE(byte_string_c != byte_string_c_same2);
+ EXPECT_FALSE(byte_string_c_same2 != byte_string_c);
+
+ CFX_ByteStringC byte_string_c1("he");
+ CFX_ByteStringC byte_string_c2("hellp");
+ CFX_ByteStringC byte_string_c3("hellod");
+ EXPECT_TRUE(byte_string_c != byte_string_c1);
+ EXPECT_TRUE(byte_string_c != byte_string_c2);
+ EXPECT_TRUE(byte_string_c != byte_string_c3);
+ EXPECT_TRUE(byte_string_c1 != byte_string_c);
+ EXPECT_TRUE(byte_string_c2 != byte_string_c);
+ EXPECT_TRUE(byte_string_c3 != byte_string_c);
+
+ CFX_ByteString byte_string_same1("hello");
+ EXPECT_FALSE(byte_string_c != byte_string_same1);
+ EXPECT_FALSE(byte_string_same1 != byte_string_c);
+
+ CFX_ByteString byte_string1("he");
+ CFX_ByteString byte_string2("hellp");
+ CFX_ByteString byte_string3("hellod");
+ EXPECT_TRUE(byte_string_c != byte_string1);
+ EXPECT_TRUE(byte_string_c != byte_string2);
+ EXPECT_TRUE(byte_string_c != byte_string3);
+ EXPECT_TRUE(byte_string1 != byte_string_c);
+ EXPECT_TRUE(byte_string2 != byte_string_c);
+ EXPECT_TRUE(byte_string3 != byte_string_c);
+
+ const char* c_string_same1 = "hello";
+ EXPECT_FALSE(byte_string_c != c_string_same1);
+ EXPECT_FALSE(c_string_same1 != byte_string_c);
+
+ const char* c_string1 = "he";
+ const char* c_string2 = "hellp";
+ const char* c_string3 = "hellod";
+ EXPECT_TRUE(byte_string_c != c_string1);
+ EXPECT_TRUE(byte_string_c != c_string2);
+ EXPECT_TRUE(byte_string_c != c_string3);
+
+ EXPECT_TRUE(c_string1 != byte_string_c);
+ EXPECT_TRUE(c_string2 != byte_string_c);
+ EXPECT_TRUE(c_string3 != byte_string_c);
+}
+
+TEST(fxcrt, ByteStringFormatWidth) {
+ {
+ CFX_ByteString str;
+ str.Format("%5d", 1);
+ EXPECT_EQ(" 1", str);
+ }
+
+ {
+ CFX_ByteString str;
+ str.Format("%d", 1);
+ EXPECT_EQ("1", str);
+ }
+
+ {
+ CFX_ByteString str;
+ str.Format("%*d", 5, 1);
+ EXPECT_EQ(" 1", str);
+ }
+
+ {
+ CFX_ByteString str;
+ str.Format("%-1d", 1);
+ EXPECT_EQ("1", str);
+ }
+
+ {
+ CFX_ByteString str;
+ str.Format("%0d", 1);
+ EXPECT_EQ("1", str);
+ }
+}
+
+TEST(fxcrt, ByteStringFormatPrecision) {
+ {
+ CFX_ByteString str;
+ str.Format("%.2f", 1.12345);
+ EXPECT_EQ("1.12", str);
+ }
+
+ {
+ CFX_ByteString str;
+ str.Format("%.*f", 3, 1.12345);
+ EXPECT_EQ("1.123", str);
+ }
+
+ {
+ CFX_ByteString str;
+ str.Format("%f", 1.12345);
+ EXPECT_EQ("1.123450", str);
+ }
+
+ {
+ CFX_ByteString str;
+ str.Format("%-1f", 1.12345);
+ EXPECT_EQ("1.123450", str);
+ }
+
+ {
+ CFX_ByteString str;
+ str.Format("%0f", 1.12345);
+ EXPECT_EQ("1.123450", str);
+ }
+}
+
+TEST(fxcrt, EmptyByteString) {
+ CFX_ByteString empty_str;
+ EXPECT_TRUE(empty_str.IsEmpty());
+ EXPECT_EQ(0, empty_str.GetLength());
+ const char* cstr = empty_str.c_str();
+ EXPECT_EQ(0, FXSYS_strlen(cstr));
+}
+
+TEST(fxcrt, ByteStringInitializerList) {
+ CFX_ByteString many_str({"clams", " and ", "oysters"});
+ EXPECT_EQ("clams and oysters", many_str);
+ many_str = {"fish", " and ", "chips", " and ", "soda"};
+ EXPECT_EQ("fish and chips and soda", many_str);
+}
diff --git a/chromium/third_party/pdfium/core/fxcrt/cfx_char.cpp b/chromium/third_party/pdfium/core/fxcrt/cfx_char.cpp
new file mode 100644
index 00000000000..b23ae078cd7
--- /dev/null
+++ b/chromium/third_party/pdfium/core/fxcrt/cfx_char.cpp
@@ -0,0 +1,48 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "core/fxcrt/cfx_char.h"
+
+CFX_Char::CFX_Char()
+ : m_dwStatus(CFX_BreakType::None),
+ m_nBreakType(0),
+ m_dwCharStyles(0),
+ m_dwCharProps(0),
+ m_iCharWidth(0),
+ m_iHorizontalScale(100),
+ m_iVerticalScale(100),
+ m_iBidiClass(0),
+ m_iBidiLevel(0),
+ m_iBidiPos(0),
+ m_iBidiOrder(0),
+ m_wCharCode(0),
+ m_iFontSize(0),
+ m_dwIdentity(0),
+ m_pUserData(nullptr) {}
+
+CFX_Char::CFX_Char(uint16_t wCharCode, uint32_t dwCharProps)
+ : m_nBreakType(0),
+ m_dwCharStyles(0),
+ m_dwCharProps(dwCharProps),
+ m_iCharWidth(0),
+ m_iHorizontalScale(100),
+ m_iVerticalScale(100),
+ m_iBidiClass(0),
+ m_iBidiLevel(0),
+ m_iBidiPos(0),
+ m_iBidiOrder(0),
+ m_wCharCode(wCharCode),
+ m_iFontSize(0),
+ m_dwIdentity(0),
+ m_pUserData(nullptr) {}
+
+CFX_Char::CFX_Char(const CFX_Char& other) = default;
+
+CFX_Char::~CFX_Char() = default;
+
+FX_CHARTYPE CFX_Char::GetCharType() const {
+ return GetCharTypeFromProp(m_dwCharProps);
+}
diff --git a/chromium/third_party/pdfium/core/fxcrt/cfx_char.h b/chromium/third_party/pdfium/core/fxcrt/cfx_char.h
new file mode 100644
index 00000000000..cd0166feb23
--- /dev/null
+++ b/chromium/third_party/pdfium/core/fxcrt/cfx_char.h
@@ -0,0 +1,42 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef CORE_FXCRT_CFX_CHAR_H_
+#define CORE_FXCRT_CFX_CHAR_H_
+
+#include <stdint.h>
+
+#include "core/fxcrt/fx_ucd.h"
+
+enum class CFX_BreakType { None = 0, Piece, Line, Paragraph, Page };
+
+class CFX_Char {
+ public:
+ CFX_Char();
+ CFX_Char(uint16_t wCharCode, uint32_t dwCharProps);
+ CFX_Char(const CFX_Char& other);
+ ~CFX_Char();
+
+ FX_CHARTYPE GetCharType() const;
+
+ CFX_BreakType m_dwStatus;
+ uint8_t m_nBreakType;
+ uint32_t m_dwCharStyles;
+ uint32_t m_dwCharProps;
+ int32_t m_iCharWidth;
+ int32_t m_iHorizontalScale;
+ int32_t m_iVerticalScale;
+ int16_t m_iBidiClass;
+ int16_t m_iBidiLevel;
+ int16_t m_iBidiPos;
+ int16_t m_iBidiOrder;
+ uint16_t m_wCharCode;
+ int32_t m_iFontSize;
+ uint32_t m_dwIdentity;
+ CFX_RetainPtr<CFX_Retainable> m_pUserData;
+};
+
+#endif // CORE_FXCRT_CFX_CHAR_H_
diff --git a/chromium/third_party/pdfium/core/fxcrt/cfx_chariter.cpp b/chromium/third_party/pdfium/core/fxcrt/cfx_chariter.cpp
new file mode 100644
index 00000000000..c14db2f322d
--- /dev/null
+++ b/chromium/third_party/pdfium/core/fxcrt/cfx_chariter.cpp
@@ -0,0 +1,51 @@
+// Copyright 2016 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "core/fxcrt/cfx_chariter.h"
+
+CFX_CharIter::CFX_CharIter(const CFX_WideString& wsText)
+ : m_wsText(wsText), m_nIndex(0) {
+ ASSERT(!wsText.IsEmpty());
+}
+
+CFX_CharIter::~CFX_CharIter() {}
+
+bool CFX_CharIter::Next(bool bPrev) {
+ if (bPrev) {
+ if (m_nIndex <= 0)
+ return false;
+ m_nIndex--;
+ } else {
+ if (m_nIndex + 1 >= m_wsText.GetLength())
+ return false;
+ m_nIndex++;
+ }
+ return true;
+}
+
+wchar_t CFX_CharIter::GetChar() {
+ return m_wsText.GetAt(m_nIndex);
+}
+
+void CFX_CharIter::SetAt(int32_t nIndex) {
+ if (nIndex < 0 || nIndex >= m_wsText.GetLength())
+ return;
+ m_nIndex = nIndex;
+}
+
+int32_t CFX_CharIter::GetAt() const {
+ return m_nIndex;
+}
+
+bool CFX_CharIter::IsEOF(bool bTail) const {
+ return bTail ? (m_nIndex + 1 == m_wsText.GetLength()) : (m_nIndex == 0);
+}
+
+IFX_CharIter* CFX_CharIter::Clone() {
+ CFX_CharIter* pIter = new CFX_CharIter(m_wsText);
+ pIter->m_nIndex = m_nIndex;
+ return pIter;
+}
diff --git a/chromium/third_party/pdfium/core/fxcrt/cfx_chariter.h b/chromium/third_party/pdfium/core/fxcrt/cfx_chariter.h
new file mode 100644
index 00000000000..00a725ef754
--- /dev/null
+++ b/chromium/third_party/pdfium/core/fxcrt/cfx_chariter.h
@@ -0,0 +1,31 @@
+// Copyright 2016 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef CORE_FXCRT_CFX_CHARITER_H_
+#define CORE_FXCRT_CFX_CHARITER_H_
+
+#include "core/fxcrt/fx_string.h"
+#include "core/fxcrt/fx_system.h"
+#include "core/fxcrt/ifx_chariter.h"
+
+class CFX_CharIter : public IFX_CharIter {
+ public:
+ explicit CFX_CharIter(const CFX_WideString& wsText);
+ ~CFX_CharIter() override;
+
+ bool Next(bool bPrev = false) override;
+ wchar_t GetChar() override;
+ void SetAt(int32_t nIndex) override;
+ int32_t GetAt() const override;
+ bool IsEOF(bool bTail = true) const override;
+ IFX_CharIter* Clone() override;
+
+ private:
+ const CFX_WideString& m_wsText;
+ int32_t m_nIndex;
+};
+
+#endif // CORE_FXCRT_CFX_CHARITER_H_
diff --git a/chromium/third_party/pdfium/core/fxcrt/cfx_checksumcontext.cpp b/chromium/third_party/pdfium/core/fxcrt/cfx_checksumcontext.cpp
new file mode 100644
index 00000000000..97d0af2d756
--- /dev/null
+++ b/chromium/third_party/pdfium/core/fxcrt/cfx_checksumcontext.cpp
@@ -0,0 +1,151 @@
+// 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
+
+#include "core/fxcrt/cfx_checksumcontext.h"
+
+#include "core/fdrm/crypto/fx_crypt.h"
+#include "core/fxcrt/xml/cfx_saxreaderhandler.h"
+#include "third_party/base/ptr_util.h"
+
+namespace {
+
+struct FX_BASE64DATA {
+ uint32_t data1 : 2;
+ uint32_t data2 : 6;
+ uint32_t data3 : 4;
+ uint32_t data4 : 4;
+ uint32_t data5 : 6;
+ uint32_t data6 : 2;
+ uint32_t data7 : 8;
+};
+
+const char g_FXBase64EncoderMap[64] = {
+ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
+ 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
+ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
+ 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
+ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/',
+};
+
+void Base64EncodePiece(const FX_BASE64DATA& src, int32_t iBytes, char dst[4]) {
+ dst[0] = g_FXBase64EncoderMap[src.data2];
+ uint32_t b = src.data1 << 4;
+ if (iBytes > 1) {
+ b |= src.data4;
+ }
+ dst[1] = g_FXBase64EncoderMap[b];
+ if (iBytes > 1) {
+ b = src.data3 << 2;
+ if (iBytes > 2) {
+ b |= src.data6;
+ }
+ dst[2] = g_FXBase64EncoderMap[b];
+ if (iBytes > 2) {
+ dst[3] = g_FXBase64EncoderMap[src.data5];
+ } else {
+ dst[3] = '=';
+ }
+ } else {
+ dst[2] = dst[3] = '=';
+ }
+}
+
+int32_t Base64EncodeA(const uint8_t* pSrc, int32_t iSrcLen, char* pDst) {
+ ASSERT(pSrc);
+ if (iSrcLen < 1) {
+ return 0;
+ }
+ if (!pDst) {
+ int32_t iDstLen = iSrcLen / 3 * 4;
+ if ((iSrcLen % 3) != 0) {
+ iDstLen += 4;
+ }
+ return iDstLen;
+ }
+ FX_BASE64DATA srcData;
+ int32_t iBytes = 3;
+ char* pDstEnd = pDst;
+ while (iSrcLen > 0) {
+ if (iSrcLen > 2) {
+ ((uint8_t*)&srcData)[0] = *pSrc++;
+ ((uint8_t*)&srcData)[1] = *pSrc++;
+ ((uint8_t*)&srcData)[2] = *pSrc++;
+ iSrcLen -= 3;
+ } else {
+ *((uint32_t*)&srcData) = 0;
+ ((uint8_t*)&srcData)[0] = *pSrc++;
+ if (iSrcLen > 1) {
+ ((uint8_t*)&srcData)[1] = *pSrc++;
+ }
+ iBytes = iSrcLen;
+ iSrcLen = 0;
+ }
+ Base64EncodePiece(srcData, iBytes, pDstEnd);
+ pDstEnd += 4;
+ }
+ return pDstEnd - pDst;
+}
+
+} // namespace
+
+CFX_ChecksumContext::CFX_ChecksumContext() {}
+
+CFX_ChecksumContext::~CFX_ChecksumContext() {}
+
+void CFX_ChecksumContext::StartChecksum() {
+ FinishChecksum();
+ m_pByteContext = pdfium::MakeUnique<CRYPT_sha1_context>();
+ CRYPT_SHA1Start(m_pByteContext.get());
+ m_bsChecksum.clear();
+ m_pSAXReader = pdfium::MakeUnique<CFX_SAXReader>();
+}
+
+bool CFX_ChecksumContext::UpdateChecksum(
+ const CFX_RetainPtr<IFX_SeekableReadStream>& pSrcFile,
+ FX_FILESIZE offset,
+ size_t size) {
+ if (!m_pSAXReader || !pSrcFile)
+ return false;
+
+ if (size < 1)
+ size = pSrcFile->GetSize();
+
+ CFX_SAXReaderHandler handler(this);
+ m_pSAXReader->SetHandler(&handler);
+ if (m_pSAXReader->StartParse(
+ pSrcFile, (uint32_t)offset, (uint32_t)size,
+ CFX_SaxParseMode_NotSkipSpace | CFX_SaxParseMode_NotConvert_amp |
+ CFX_SaxParseMode_NotConvert_lt | CFX_SaxParseMode_NotConvert_gt |
+ CFX_SaxParseMode_NotConvert_sharp) < 0) {
+ return false;
+ }
+ return m_pSAXReader->ContinueParse(nullptr) > 99;
+}
+
+void CFX_ChecksumContext::FinishChecksum() {
+ m_pSAXReader.reset();
+ if (m_pByteContext) {
+ uint8_t digest[20];
+ memset(digest, 0, 20);
+ CRYPT_SHA1Finish(m_pByteContext.get(), digest);
+ int32_t nLen = Base64EncodeA(digest, 20, nullptr);
+ char* pBuffer = m_bsChecksum.GetBuffer(nLen);
+ Base64EncodeA(digest, 20, pBuffer);
+ m_bsChecksum.ReleaseBuffer(nLen);
+ m_pByteContext.reset();
+ }
+}
+
+CFX_ByteString CFX_ChecksumContext::GetChecksum() const {
+ return m_bsChecksum;
+}
+
+void CFX_ChecksumContext::Update(const CFX_ByteStringC& bsText) {
+ if (!m_pByteContext)
+ return;
+
+ CRYPT_SHA1Update(m_pByteContext.get(), bsText.raw_str(), bsText.GetLength());
+}
diff --git a/chromium/third_party/pdfium/core/fxcrt/cfx_checksumcontext.h b/chromium/third_party/pdfium/core/fxcrt/cfx_checksumcontext.h
new file mode 100644
index 00000000000..8869c540fb2
--- /dev/null
+++ b/chromium/third_party/pdfium/core/fxcrt/cfx_checksumcontext.h
@@ -0,0 +1,34 @@
+// 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_FXCRT_CFX_CHECKSUMCONTEXT_H_
+#define CORE_FXCRT_CFX_CHECKSUMCONTEXT_H_
+
+#include <memory>
+
+#include "core/fdrm/crypto/fx_crypt.h"
+#include "core/fxcrt/xml/cfx_saxreader.h"
+
+class CFX_ChecksumContext {
+ public:
+ CFX_ChecksumContext();
+ ~CFX_ChecksumContext();
+
+ void StartChecksum();
+ void Update(const CFX_ByteStringC& bsText);
+ bool UpdateChecksum(const CFX_RetainPtr<IFX_SeekableReadStream>& pSrcFile,
+ FX_FILESIZE offset = 0,
+ size_t size = 0);
+ void FinishChecksum();
+ CFX_ByteString GetChecksum() const;
+
+ private:
+ std::unique_ptr<CFX_SAXReader> m_pSAXReader;
+ std::unique_ptr<CRYPT_sha1_context> m_pByteContext;
+ CFX_ByteString m_bsChecksum;
+};
+
+#endif // CORE_FXCRT_CFX_CHECKSUMCONTEXT_H_
diff --git a/chromium/third_party/pdfium/core/fxcrt/cfx_datetime.cpp b/chromium/third_party/pdfium/core/fxcrt/cfx_datetime.cpp
new file mode 100644
index 00000000000..dcf25d54638
--- /dev/null
+++ b/chromium/third_party/pdfium/core/fxcrt/cfx_datetime.cpp
@@ -0,0 +1,129 @@
+// 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
+
+#include "core/fxcrt/cfx_datetime.h"
+#include "core/fxcrt/fx_system.h"
+
+#if _FX_OS_ == _FX_LINUX_DESKTOP_ || _FX_OS_ == _FX_ANDROID_ || \
+ _FX_OS_ == _FX_MACOSX_ || _FX_OS_ == _FX_IOS_
+#include <sys/time.h>
+#include <time.h>
+#endif
+
+namespace {
+
+const uint8_t g_FXDaysPerMonth[12] = {31, 28, 31, 30, 31, 30,
+ 31, 31, 30, 31, 30, 31};
+const uint8_t g_FXDaysPerLeapMonth[12] = {31, 29, 31, 30, 31, 30,
+ 31, 31, 30, 31, 30, 31};
+const int32_t g_FXDaysBeforeMonth[12] = {0, 31, 59, 90, 120, 151,
+ 181, 212, 243, 273, 304, 334};
+const int32_t g_FXDaysBeforeLeapMonth[12] = {0, 31, 60, 91, 121, 152,
+ 182, 213, 244, 274, 305, 335};
+const int32_t g_FXDaysPerYear = 365;
+const int32_t g_FXDaysPerLeapYear = 366;
+
+int32_t DaysBeforeMonthInYear(int32_t iYear, uint8_t iMonth) {
+ ASSERT(iYear != 0);
+ ASSERT(iMonth >= 1 && iMonth <= 12);
+
+ const int32_t* p =
+ FX_IsLeapYear(iYear) ? g_FXDaysBeforeLeapMonth : g_FXDaysBeforeMonth;
+ return p[iMonth - 1];
+}
+
+int32_t DaysInYear(int32_t iYear) {
+ ASSERT(iYear != 0);
+ return FX_IsLeapYear(iYear) ? g_FXDaysPerLeapYear : g_FXDaysPerYear;
+}
+
+int64_t DateToDays(int32_t iYear,
+ uint8_t iMonth,
+ uint8_t iDay,
+ bool bIncludeThisDay) {
+ ASSERT(iYear != 0);
+ ASSERT(iMonth >= 1 && iMonth <= 12);
+ ASSERT(iDay >= 1 && iDay <= FX_DaysInMonth(iYear, iMonth));
+
+ int64_t iDays = DaysBeforeMonthInYear(iYear, iMonth);
+ iDays += iDay;
+ if (!bIncludeThisDay)
+ iDays--;
+
+ if (iYear > 0) {
+ iYear--;
+ } else {
+ iDays -= DaysInYear(iYear);
+ iYear++;
+ }
+ return iDays + static_cast<int64_t>(iYear) * 365 + iYear / 4 - iYear / 100 +
+ iYear / 400;
+}
+
+struct FXUT_SYSTEMTIME {
+ uint16_t wYear;
+ uint16_t wMonth;
+ uint16_t wDayOfWeek;
+ uint16_t wDay;
+ uint16_t wHour;
+ uint16_t wMinute;
+ uint16_t wSecond;
+ uint16_t wMillisecond;
+};
+
+} // namespace
+
+uint8_t FX_DaysInMonth(int32_t iYear, uint8_t iMonth) {
+ ASSERT(iYear != 0);
+ ASSERT(iMonth >= 1 && iMonth <= 12);
+
+ const uint8_t* p =
+ FX_IsLeapYear(iYear) ? g_FXDaysPerLeapMonth : g_FXDaysPerMonth;
+ return p[iMonth - 1];
+}
+
+bool FX_IsLeapYear(int32_t iYear) {
+ ASSERT(iYear != 0);
+ return ((iYear % 4) == 0 && (iYear % 100) != 0) || (iYear % 400) == 0;
+}
+
+void CFX_DateTime::Now() {
+ FXUT_SYSTEMTIME utLocal;
+#if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN32_MOBILE_ || \
+ _FX_OS_ == _FX_WIN64_
+ ::GetLocalTime((LPSYSTEMTIME)&utLocal);
+#elif _FX_OS_ != _FX_EMBEDDED_
+ timeval curTime;
+ gettimeofday(&curTime, nullptr);
+
+ struct tm st;
+ localtime_r(&curTime.tv_sec, &st);
+ utLocal.wYear = st.tm_year + 1900;
+ utLocal.wMonth = st.tm_mon + 1;
+ utLocal.wDayOfWeek = st.tm_wday;
+ utLocal.wDay = st.tm_mday;
+ utLocal.wHour = st.tm_hour;
+ utLocal.wMinute = st.tm_min;
+ utLocal.wSecond = st.tm_sec;
+ utLocal.wMillisecond = curTime.tv_usec / 1000;
+#endif // _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN32_MOBILE_ || \
+ // _FX_OS_ == _FX_WIN64_
+
+ year_ = utLocal.wYear;
+ month_ = static_cast<uint8_t>(utLocal.wMonth);
+ day_ = static_cast<uint8_t>(utLocal.wDay);
+ hour_ = static_cast<uint8_t>(utLocal.wHour);
+ minute_ = static_cast<uint8_t>(utLocal.wMinute);
+ second_ = static_cast<uint8_t>(utLocal.wSecond);
+ millisecond_ = static_cast<uint16_t>(utLocal.wMillisecond);
+}
+
+int32_t CFX_DateTime::GetDayOfWeek() const {
+ int32_t v = static_cast<int32_t>(DateToDays(year_, month_, day_, true) % 7);
+ if (v < 0)
+ v += 7;
+ return v;
+}
diff --git a/chromium/third_party/pdfium/core/fxcrt/cfx_datetime.h b/chromium/third_party/pdfium/core/fxcrt/cfx_datetime.h
new file mode 100644
index 00000000000..2de75c4e387
--- /dev/null
+++ b/chromium/third_party/pdfium/core/fxcrt/cfx_datetime.h
@@ -0,0 +1,103 @@
+// 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_FXCRT_CFX_DATETIME_H_
+#define CORE_FXCRT_CFX_DATETIME_H_
+
+#include "core/fxcrt/fx_system.h"
+
+bool FX_IsLeapYear(int32_t iYear);
+uint8_t FX_DaysInMonth(int32_t iYear, uint8_t iMonth);
+
+class CFX_DateTime {
+ public:
+ CFX_DateTime()
+ : year_(0),
+ month_(0),
+ day_(0),
+ hour_(0),
+ minute_(0),
+ second_(0),
+ millisecond_(0) {}
+ CFX_DateTime(int32_t year,
+ uint8_t month,
+ uint8_t day,
+ uint8_t hour,
+ uint8_t minute,
+ uint8_t second,
+ uint16_t millisecond)
+ : year_(year),
+ month_(month),
+ day_(day),
+ hour_(hour),
+ minute_(minute),
+ second_(second),
+ millisecond_(millisecond) {}
+
+ void Now();
+
+ void Reset() {
+ year_ = 0;
+ month_ = 0;
+ day_ = 0;
+ hour_ = 0;
+ minute_ = 0;
+ second_ = 0;
+ millisecond_ = 0;
+ }
+
+ bool IsSet() const {
+ return year_ != 0 || month_ != 0 || day_ != 0 || hour_ != 0 ||
+ minute_ != 0 || second_ != 0 || millisecond_ != 0;
+ }
+
+ void SetDate(int32_t year, uint8_t month, uint8_t day) {
+ year_ = year;
+ month_ = month;
+ day_ = day;
+ }
+
+ void SetTime(uint8_t hour,
+ uint8_t minute,
+ uint8_t second,
+ uint16_t millisecond) {
+ hour_ = hour;
+ minute_ = minute;
+ second_ = second;
+ millisecond_ = millisecond;
+ }
+
+ int32_t GetYear() const { return year_; }
+ uint8_t GetMonth() const { return month_; }
+ uint8_t GetDay() const { return day_; }
+ uint8_t GetHour() const { return hour_; }
+ uint8_t GetMinute() const { return minute_; }
+ uint8_t GetSecond() const { return second_; }
+ uint16_t GetMillisecond() const { return millisecond_; }
+ int32_t GetDayOfWeek() const;
+
+ private:
+ int32_t year_;
+ uint8_t month_;
+ uint8_t day_;
+ uint8_t hour_;
+ uint8_t minute_;
+ uint8_t second_;
+ uint16_t millisecond_;
+};
+
+#if _FX_OS_ != _FX_ANDROID_
+#pragma pack(push, 1)
+#endif
+struct FX_TIMEZONE {
+ int8_t tzHour;
+ uint8_t tzMinute;
+};
+#if _FX_OS_ != _FX_ANDROID_
+#pragma pack(pop)
+#endif
+
+#endif // CORE_FXCRT_CFX_DATETIME_H_
diff --git a/chromium/third_party/pdfium/core/fxcrt/cfx_decimal.cpp b/chromium/third_party/pdfium/core/fxcrt/cfx_decimal.cpp
new file mode 100644
index 00000000000..095978cd432
--- /dev/null
+++ b/chromium/third_party/pdfium/core/fxcrt/cfx_decimal.cpp
@@ -0,0 +1,471 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "core/fxcrt/cfx_decimal.h"
+
+#include <algorithm>
+#include <utility>
+
+#define FXMATH_DECIMAL_SCALELIMIT 0x1c
+#define FXMATH_DECIMAL_NEGMASK (0x80000000L)
+#define FXMATH_DECIMAL_FORCEBOOL(x) (!!(x))
+#define FXMATH_DECIMAL_MAKEFLAGS(NEG, SCALE) \
+ (((SCALE) << 0x10) | ((NEG) ? FXMATH_DECIMAL_NEGMASK : 0))
+#define FXMATH_DECIMAL_FLAGS2NEG(FLAGS) \
+ FXMATH_DECIMAL_FORCEBOOL((FLAGS)&FXMATH_DECIMAL_NEGMASK)
+#define FXMATH_DECIMAL_FLAGS2SCALE(FLAGS) \
+ ((uint8_t)(((FLAGS) & ~FXMATH_DECIMAL_NEGMASK) >> 0x10))
+#define FXMATH_DECIMAL_RSHIFT32BIT(x) ((x) >> 0x10 >> 0x10)
+#define FXMATH_DECIMAL_LSHIFT32BIT(x) ((x) << 0x10 << 0x10)
+
+namespace {
+
+inline uint8_t decimal_helper_div10(uint64_t& phi,
+ uint64_t& pmid,
+ uint64_t& plo) {
+ uint8_t retVal;
+ pmid += FXMATH_DECIMAL_LSHIFT32BIT(phi % 0xA);
+ phi /= 0xA;
+ plo += FXMATH_DECIMAL_LSHIFT32BIT(pmid % 0xA);
+ pmid /= 0xA;
+ retVal = plo % 0xA;
+ plo /= 0xA;
+ return retVal;
+}
+
+inline uint8_t decimal_helper_div10_any(uint64_t nums[], uint8_t numcount) {
+ uint8_t retVal = 0;
+ for (int i = numcount - 1; i > 0; i--) {
+ nums[i - 1] += FXMATH_DECIMAL_LSHIFT32BIT(nums[i] % 0xA);
+ nums[i] /= 0xA;
+ }
+ if (numcount) {
+ retVal = nums[0] % 0xA;
+ nums[0] /= 0xA;
+ }
+ return retVal;
+}
+
+inline void decimal_helper_mul10(uint64_t& phi, uint64_t& pmid, uint64_t& plo) {
+ plo *= 0xA;
+ pmid = pmid * 0xA + FXMATH_DECIMAL_RSHIFT32BIT(plo);
+ plo = (uint32_t)plo;
+ phi = phi * 0xA + FXMATH_DECIMAL_RSHIFT32BIT(pmid);
+ pmid = (uint32_t)pmid;
+}
+
+inline void decimal_helper_mul10_any(uint64_t nums[], uint8_t numcount) {
+ nums[0] *= 0xA;
+ for (int i = 1; i < numcount; i++) {
+ nums[i] = nums[i] * 0xA + FXMATH_DECIMAL_RSHIFT32BIT(nums[i - 1]);
+ nums[i - 1] = (uint32_t)nums[i - 1];
+ }
+}
+
+inline void decimal_helper_normalize(uint64_t& phi,
+ uint64_t& pmid,
+ uint64_t& plo) {
+ phi += FXMATH_DECIMAL_RSHIFT32BIT(pmid);
+ pmid = (uint32_t)pmid;
+ pmid += FXMATH_DECIMAL_RSHIFT32BIT(plo);
+ plo = (uint32_t)plo;
+ phi += FXMATH_DECIMAL_RSHIFT32BIT(pmid);
+ pmid = (uint32_t)pmid;
+}
+
+inline void decimal_helper_normalize_any(uint64_t nums[], uint8_t len) {
+ for (int i = len - 2; i > 0; i--) {
+ nums[i + 1] += FXMATH_DECIMAL_RSHIFT32BIT(nums[i]);
+ nums[i] = (uint32_t)nums[i];
+ }
+ for (int i = 0; i < len - 1; i++) {
+ nums[i + 1] += FXMATH_DECIMAL_RSHIFT32BIT(nums[i]);
+ nums[i] = (uint32_t)nums[i];
+ }
+}
+
+inline int8_t decimal_helper_raw_compare_any(uint64_t a[],
+ uint8_t al,
+ uint64_t b[],
+ uint8_t bl) {
+ int8_t retVal = 0;
+ for (int i = std::max(al - 1, bl - 1); i >= 0; i--) {
+ uint64_t l = (i >= al ? 0 : a[i]), r = (i >= bl ? 0 : b[i]);
+ retVal += (l > r ? 1 : (l < r ? -1 : 0));
+ if (retVal)
+ return retVal;
+ }
+ return retVal;
+}
+
+inline void decimal_helper_dec_any(uint64_t a[], uint8_t al) {
+ for (int i = 0; i < al; i++) {
+ if (a[i]--)
+ return;
+ }
+}
+
+inline void decimal_helper_inc_any(uint64_t a[], uint8_t al) {
+ for (int i = 0; i < al; i++) {
+ a[i]++;
+ if ((uint32_t)a[i] == a[i])
+ return;
+ a[i] = 0;
+ }
+}
+
+inline void decimal_helper_raw_mul(uint64_t a[],
+ uint8_t al,
+ uint64_t b[],
+ uint8_t bl,
+ uint64_t c[],
+ uint8_t cl) {
+ ASSERT(al + bl <= cl);
+ for (int i = 0; i < cl; i++)
+ c[i] = 0;
+
+ for (int i = 0; i < al; i++) {
+ for (int j = 0; j < bl; j++) {
+ uint64_t m = (uint64_t)a[i] * b[j];
+ c[i + j] += (uint32_t)m;
+ c[i + j + 1] += FXMATH_DECIMAL_RSHIFT32BIT(m);
+ }
+ }
+ for (int i = 0; i < cl - 1; i++) {
+ c[i + 1] += FXMATH_DECIMAL_RSHIFT32BIT(c[i]);
+ c[i] = (uint32_t)c[i];
+ }
+ for (int i = 0; i < cl; i++)
+ c[i] = (uint32_t)c[i];
+}
+
+inline void decimal_helper_raw_div(uint64_t a[],
+ uint8_t al,
+ uint64_t b[],
+ uint8_t bl,
+ uint64_t c[],
+ uint8_t cl) {
+ for (int i = 0; i < cl; i++)
+ c[i] = 0;
+
+ uint64_t left[16] = {0};
+ uint64_t right[16] = {0};
+ left[0] = 0;
+ for (int i = 0; i < al; i++)
+ right[i] = a[i];
+
+ uint64_t tmp[16];
+ while (decimal_helper_raw_compare_any(left, al, right, al) <= 0) {
+ uint64_t cur[16];
+ for (int i = 0; i < al; i++)
+ cur[i] = left[i] + right[i];
+
+ for (int i = al - 1; i >= 0; i--) {
+ if (i)
+ cur[i - 1] += FXMATH_DECIMAL_LSHIFT32BIT(cur[i] % 2);
+ cur[i] /= 2;
+ }
+
+ decimal_helper_raw_mul(cur, al, b, bl, tmp, 16);
+ switch (decimal_helper_raw_compare_any(tmp, 16, a, al)) {
+ case -1:
+ for (int i = 0; i < 16; i++)
+ left[i] = cur[i];
+
+ left[0]++;
+ decimal_helper_normalize_any(left, al);
+ break;
+ case 1:
+ for (int i = 0; i < 16; i++)
+ right[i] = cur[i];
+ decimal_helper_dec_any(right, al);
+ break;
+ case 0:
+ for (int i = 0; i < std::min(al, cl); i++)
+ c[i] = cur[i];
+ return;
+ }
+ }
+ for (int i = 0; i < std::min(al, cl); i++)
+ c[i] = left[i];
+}
+
+inline bool decimal_helper_outofrange(uint64_t a[], uint8_t al, uint8_t goal) {
+ for (int i = goal; i < al; i++) {
+ if (a[i])
+ return true;
+ }
+ return false;
+}
+
+inline void decimal_helper_shrinkintorange(uint64_t a[],
+ uint8_t al,
+ uint8_t goal,
+ uint8_t& scale) {
+ bool bRoundUp = false;
+ while (scale != 0 && (scale > FXMATH_DECIMAL_SCALELIMIT ||
+ decimal_helper_outofrange(a, al, goal))) {
+ bRoundUp = decimal_helper_div10_any(a, al) >= 5;
+ scale--;
+ }
+ if (bRoundUp) {
+ decimal_helper_normalize_any(a, goal);
+ decimal_helper_inc_any(a, goal);
+ }
+}
+
+inline void decimal_helper_truncate(uint64_t& phi,
+ uint64_t& pmid,
+ uint64_t& plo,
+ uint8_t& scale,
+ uint8_t minscale = 0) {
+ while (scale > minscale) {
+ uint64_t thi = phi, tmid = pmid, tlo = plo;
+ if (decimal_helper_div10(thi, tmid, tlo) != 0)
+ break;
+
+ phi = thi;
+ pmid = tmid;
+ plo = tlo;
+ scale--;
+ }
+}
+
+} // namespace
+
+CFX_Decimal::CFX_Decimal() : m_uHi(0), m_uLo(0), m_uMid(0), m_uFlags(0) {}
+
+CFX_Decimal::CFX_Decimal(uint64_t val)
+ : m_uHi(0),
+ m_uLo(static_cast<uint32_t>(val)),
+ m_uMid(static_cast<uint32_t>(FXMATH_DECIMAL_RSHIFT32BIT(val))),
+ m_uFlags(0) {}
+
+CFX_Decimal::CFX_Decimal(uint32_t val)
+ : m_uHi(0), m_uLo(static_cast<uint32_t>(val)), m_uMid(0), m_uFlags(0) {}
+
+CFX_Decimal::CFX_Decimal(uint32_t lo,
+ uint32_t mid,
+ uint32_t hi,
+ bool neg,
+ uint8_t scale)
+ : m_uHi(hi),
+ m_uLo(lo),
+ m_uMid(mid),
+ m_uFlags(FXMATH_DECIMAL_MAKEFLAGS(
+ neg && IsNotZero(),
+ (scale > FXMATH_DECIMAL_SCALELIMIT ? 0 : scale))) {}
+
+CFX_Decimal::CFX_Decimal(int32_t val) {
+ if (val >= 0) {
+ *this = CFX_Decimal(static_cast<uint32_t>(val));
+ } else {
+ *this = CFX_Decimal(static_cast<uint32_t>(-val));
+ SetNegate();
+ }
+}
+
+CFX_Decimal::CFX_Decimal(float val, uint8_t scale) {
+ float newval = fabs(val);
+ uint64_t phi;
+ uint64_t pmid;
+ uint64_t plo;
+ plo = static_cast<uint64_t>(newval);
+ pmid = static_cast<uint64_t>(newval / 1e32);
+ phi = static_cast<uint64_t>(newval / 1e64);
+ newval = fmod(newval, 1.0f);
+ for (uint8_t iter = 0; iter < scale; iter++) {
+ decimal_helper_mul10(phi, pmid, plo);
+ newval *= 10;
+ plo += static_cast<uint64_t>(newval);
+ newval = fmod(newval, 1.0f);
+ }
+
+ plo += FXSYS_round(newval);
+ decimal_helper_normalize(phi, pmid, plo);
+ m_uHi = static_cast<uint32_t>(phi);
+ m_uMid = static_cast<uint32_t>(pmid);
+ m_uLo = static_cast<uint32_t>(plo);
+ m_uFlags = FXMATH_DECIMAL_MAKEFLAGS(val < 0 && IsNotZero(), scale);
+}
+
+CFX_Decimal::CFX_Decimal(const CFX_WideStringC& strObj) {
+ const wchar_t* str = strObj.c_str();
+ const wchar_t* strBound = str + strObj.GetLength();
+ bool pointmet = false;
+ bool negmet = false;
+ uint8_t scale = 0;
+ m_uHi = 0;
+ m_uMid = 0;
+ m_uLo = 0;
+ while (str != strBound && *str == ' ')
+ str++;
+ if (str != strBound && *str == '-') {
+ negmet = 1;
+ str++;
+ } else if (str != strBound && *str == '+') {
+ str++;
+ }
+
+ while (str != strBound && ((*str >= '0' && *str <= '9') || *str == '.') &&
+ scale < FXMATH_DECIMAL_SCALELIMIT) {
+ if (*str == '.') {
+ if (!pointmet)
+ pointmet = 1;
+ } else {
+ m_uHi = m_uHi * 0xA + FXMATH_DECIMAL_RSHIFT32BIT((uint64_t)m_uMid * 0xA);
+ m_uMid = m_uMid * 0xA + FXMATH_DECIMAL_RSHIFT32BIT((uint64_t)m_uLo * 0xA);
+ m_uLo = m_uLo * 0xA + (*str - '0');
+ if (pointmet)
+ scale++;
+ }
+ str++;
+ }
+ m_uFlags = FXMATH_DECIMAL_MAKEFLAGS(negmet && IsNotZero(), scale);
+}
+
+CFX_Decimal::operator CFX_WideString() const {
+ CFX_WideString retString;
+ CFX_WideString tmpbuf;
+ uint64_t phi = m_uHi;
+ uint64_t pmid = m_uMid;
+ uint64_t plo = m_uLo;
+ while (phi || pmid || plo)
+ tmpbuf += decimal_helper_div10(phi, pmid, plo) + '0';
+
+ uint8_t outputlen = (uint8_t)tmpbuf.GetLength();
+ uint8_t scale = (uint8_t)FXMATH_DECIMAL_FLAGS2SCALE(m_uFlags);
+ while (scale >= outputlen) {
+ tmpbuf += '0';
+ outputlen++;
+ }
+ if (FXMATH_DECIMAL_FLAGS2NEG(m_uFlags) && IsNotZero())
+ retString += '-';
+
+ for (uint8_t idx = 0; idx < outputlen; idx++) {
+ if (idx == (outputlen - scale) && scale != 0)
+ retString += '.';
+ retString += tmpbuf[outputlen - 1 - idx];
+ }
+ return retString;
+}
+
+CFX_Decimal::operator double() const {
+ double pow = (double)(1 << 16) * (1 << 16);
+ double base = static_cast<double>(m_uHi) * pow * pow +
+ static_cast<double>(m_uMid) * pow + static_cast<double>(m_uLo);
+ int8_t scale = FXMATH_DECIMAL_FLAGS2SCALE(m_uFlags);
+ bool bNeg = FXMATH_DECIMAL_FLAGS2NEG(m_uFlags);
+ return (bNeg ? -1 : 1) * base * ::pow(10.0, -scale);
+}
+
+void CFX_Decimal::SetScale(uint8_t newscale) {
+ uint8_t oldscale = FXMATH_DECIMAL_FLAGS2SCALE(m_uFlags);
+ if (newscale > oldscale) {
+ uint64_t phi = m_uHi;
+ uint64_t pmid = m_uMid;
+ uint64_t plo = m_uLo;
+ for (uint8_t iter = 0; iter < newscale - oldscale; iter++)
+ decimal_helper_mul10(phi, pmid, plo);
+
+ m_uHi = static_cast<uint32_t>(phi);
+ m_uMid = static_cast<uint32_t>(pmid);
+ m_uLo = static_cast<uint32_t>(plo);
+ m_uFlags = FXMATH_DECIMAL_MAKEFLAGS(
+ FXMATH_DECIMAL_FLAGS2NEG(m_uFlags) && IsNotZero(), newscale);
+ } else if (newscale < oldscale) {
+ uint64_t phi;
+ uint64_t pmid;
+ uint64_t plo;
+ phi = 0;
+ pmid = 0;
+ plo = 5;
+ for (uint8_t iter = 0; iter < oldscale - newscale - 1; iter++)
+ decimal_helper_mul10(phi, pmid, plo);
+
+ phi += m_uHi;
+ pmid += m_uMid;
+ plo += m_uLo;
+ decimal_helper_normalize(phi, pmid, plo);
+ for (uint8_t iter = 0; iter < oldscale - newscale; iter++)
+ decimal_helper_div10(phi, pmid, plo);
+
+ m_uHi = static_cast<uint32_t>(phi);
+ m_uMid = static_cast<uint32_t>(pmid);
+ m_uLo = static_cast<uint32_t>(plo);
+ m_uFlags = FXMATH_DECIMAL_MAKEFLAGS(
+ FXMATH_DECIMAL_FLAGS2NEG(m_uFlags) && IsNotZero(), newscale);
+ }
+}
+
+uint8_t CFX_Decimal::GetScale() {
+ return FXMATH_DECIMAL_FLAGS2SCALE(m_uFlags);
+}
+
+void CFX_Decimal::SetNegate() {
+ if (IsNotZero())
+ m_uFlags ^= FXMATH_DECIMAL_NEGMASK;
+}
+
+void CFX_Decimal::Swap(CFX_Decimal& val) {
+ std::swap(m_uHi, val.m_uHi);
+ std::swap(m_uMid, val.m_uMid);
+ std::swap(m_uLo, val.m_uLo);
+ std::swap(m_uFlags, val.m_uFlags);
+}
+
+CFX_Decimal CFX_Decimal::operator*(const CFX_Decimal& val) const {
+ uint64_t a[3] = {m_uLo, m_uMid, m_uHi},
+ b[3] = {val.m_uLo, val.m_uMid, val.m_uHi};
+ uint64_t c[6];
+ decimal_helper_raw_mul(a, 3, b, 3, c, 6);
+ bool neg = FXMATH_DECIMAL_FLAGS2NEG(m_uFlags) ^
+ FXMATH_DECIMAL_FLAGS2NEG(val.m_uFlags);
+ uint8_t scale = FXMATH_DECIMAL_FLAGS2SCALE(m_uFlags) +
+ FXMATH_DECIMAL_FLAGS2SCALE(val.m_uFlags);
+ decimal_helper_shrinkintorange(c, 6, 3, scale);
+ return CFX_Decimal(static_cast<uint32_t>(c[0]), static_cast<uint32_t>(c[1]),
+ static_cast<uint32_t>(c[2]), neg, scale);
+}
+
+CFX_Decimal CFX_Decimal::operator/(const CFX_Decimal& val) const {
+ if (!val.IsNotZero())
+ return CFX_Decimal();
+
+ bool neg = FXMATH_DECIMAL_FLAGS2NEG(m_uFlags) ^
+ FXMATH_DECIMAL_FLAGS2NEG(val.m_uFlags);
+ uint64_t a[7] = {m_uLo, m_uMid, m_uHi},
+ b[3] = {val.m_uLo, val.m_uMid, val.m_uHi}, c[7] = {0};
+ uint8_t scale = 0;
+ if (FXMATH_DECIMAL_FLAGS2SCALE(m_uFlags) <
+ FXMATH_DECIMAL_FLAGS2SCALE(val.m_uFlags)) {
+ for (int i = FXMATH_DECIMAL_FLAGS2SCALE(val.m_uFlags) -
+ FXMATH_DECIMAL_FLAGS2SCALE(m_uFlags);
+ i > 0; i--) {
+ decimal_helper_mul10_any(a, 7);
+ }
+ } else {
+ scale = FXMATH_DECIMAL_FLAGS2SCALE(m_uFlags) -
+ FXMATH_DECIMAL_FLAGS2SCALE(val.m_uFlags);
+ }
+
+ uint8_t minscale = scale;
+ if (!IsNotZero())
+ return CFX_Decimal(0, 0, 0, 0, minscale);
+
+ while (!a[6]) {
+ decimal_helper_mul10_any(a, 7);
+ scale++;
+ }
+
+ decimal_helper_div10_any(a, 7);
+ scale--;
+ decimal_helper_raw_div(a, 6, b, 3, c, 7);
+ decimal_helper_shrinkintorange(c, 6, 3, scale);
+ decimal_helper_truncate(c[2], c[1], c[0], scale, minscale);
+ return CFX_Decimal(static_cast<uint32_t>(c[0]), static_cast<uint32_t>(c[1]),
+ static_cast<uint32_t>(c[2]), neg, scale);
+}
diff --git a/chromium/third_party/pdfium/core/fxcrt/cfx_decimal.h b/chromium/third_party/pdfium/core/fxcrt/cfx_decimal.h
new file mode 100644
index 00000000000..544280444ad
--- /dev/null
+++ b/chromium/third_party/pdfium/core/fxcrt/cfx_decimal.h
@@ -0,0 +1,42 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef CORE_FXCRT_CFX_DECIMAL_H_
+#define CORE_FXCRT_CFX_DECIMAL_H_
+
+#include "core/fxcrt/fx_string.h"
+
+class CFX_Decimal {
+ public:
+ CFX_Decimal();
+ explicit CFX_Decimal(uint32_t val);
+ explicit CFX_Decimal(uint64_t val);
+ explicit CFX_Decimal(int32_t val);
+ CFX_Decimal(float val, uint8_t scale);
+ explicit CFX_Decimal(const CFX_WideStringC& str);
+
+ operator CFX_WideString() const;
+ operator double() const;
+
+ CFX_Decimal operator*(const CFX_Decimal& val) const;
+ CFX_Decimal operator/(const CFX_Decimal& val) const;
+
+ void SetScale(uint8_t newScale);
+ uint8_t GetScale();
+ void SetNegate();
+
+ private:
+ CFX_Decimal(uint32_t hi, uint32_t mid, uint32_t lo, bool neg, uint8_t scale);
+ bool IsNotZero() const { return m_uHi || m_uMid || m_uLo; }
+ void Swap(CFX_Decimal& val);
+
+ uint32_t m_uHi;
+ uint32_t m_uLo;
+ uint32_t m_uMid;
+ uint32_t m_uFlags;
+};
+
+#endif // CORE_FXCRT_CFX_DECIMAL_H_
diff --git a/chromium/third_party/pdfium/core/fxcrt/cfx_maybe_owned.h b/chromium/third_party/pdfium/core/fxcrt/cfx_maybe_owned.h
index 92b1c1c2425..8b08d9be378 100644
--- a/chromium/third_party/pdfium/core/fxcrt/cfx_maybe_owned.h
+++ b/chromium/third_party/pdfium/core/fxcrt/cfx_maybe_owned.h
@@ -25,7 +25,7 @@ class CFX_MaybeOwned {
: m_pOwnedObj(std::move(ptr)), m_pObj(m_pOwnedObj.get()) {}
CFX_MaybeOwned(const CFX_MaybeOwned& that) = delete;
- CFX_MaybeOwned(CFX_MaybeOwned&& that)
+ CFX_MaybeOwned(CFX_MaybeOwned&& that) noexcept
: m_pOwnedObj(that.m_pOwnedObj.release()), m_pObj(that.m_pObj) {
that.m_pObj = nullptr;
}
diff --git a/chromium/third_party/pdfium/core/fxcrt/cfx_retain_ptr.h b/chromium/third_party/pdfium/core/fxcrt/cfx_retain_ptr.h
index 0267ae04cd8..32a77c5a6c5 100644
--- a/chromium/third_party/pdfium/core/fxcrt/cfx_retain_ptr.h
+++ b/chromium/third_party/pdfium/core/fxcrt/cfx_retain_ptr.h
@@ -22,7 +22,7 @@ class CFX_RetainPtr {
CFX_RetainPtr() {}
CFX_RetainPtr(const CFX_RetainPtr& that) : CFX_RetainPtr(that.Get()) {}
- CFX_RetainPtr(CFX_RetainPtr&& that) { Swap(that); }
+ CFX_RetainPtr(CFX_RetainPtr&& that) noexcept { Swap(that); }
// Deliberately implicit to allow returning nullptrs.
CFX_RetainPtr(std::nullptr_t ptr) {}
@@ -44,7 +44,7 @@ class CFX_RetainPtr {
T* Get() const { return m_pObj.get(); }
void Swap(CFX_RetainPtr& that) { m_pObj.swap(that.m_pObj); }
- // TODO(tsepez): temporary scaffolding, to be removed.
+ // Useful for passing notion of object ownership across a C API.
T* Leak() { return m_pObj.release(); }
void Unleak(T* ptr) { m_pObj.reset(ptr); }
@@ -54,6 +54,11 @@ class CFX_RetainPtr {
return *this;
}
+ CFX_RetainPtr& operator=(CFX_RetainPtr&& that) {
+ m_pObj.reset(that.Leak());
+ return *this;
+ }
+
bool operator==(const CFX_RetainPtr& that) const {
return Get() == that.Get();
}
diff --git a/chromium/third_party/pdfium/core/fxcrt/cfx_retain_ptr_unittest.cpp b/chromium/third_party/pdfium/core/fxcrt/cfx_retain_ptr_unittest.cpp
index 3168b5a4c7b..fc0309467c0 100644
--- a/chromium/third_party/pdfium/core/fxcrt/cfx_retain_ptr_unittest.cpp
+++ b/chromium/third_party/pdfium/core/fxcrt/cfx_retain_ptr_unittest.cpp
@@ -5,6 +5,7 @@
#include "core/fxcrt/cfx_retain_ptr.h"
#include <utility>
+#include <vector>
#include "testing/fx_string_testhelpers.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -65,6 +66,8 @@ TEST(fxcrt, RetainPtrMoveCtor) {
CFX_RetainPtr<PseudoRetainable> ptr1(&obj);
{
CFX_RetainPtr<PseudoRetainable> ptr2(std::move(ptr1));
+ EXPECT_EQ(nullptr, ptr1.Get());
+ EXPECT_EQ(&obj, ptr2.Get());
EXPECT_EQ(1, obj.retain_count());
EXPECT_EQ(0, obj.release_count());
}
@@ -185,6 +188,27 @@ TEST(fxcrt, RetainPtrAssign) {
EXPECT_EQ(2, obj.release_count());
}
+TEST(fxcrt, RetainPtrMoveAssign) {
+ PseudoRetainable obj;
+ {
+ CFX_RetainPtr<PseudoRetainable> ptr1(&obj);
+ {
+ CFX_RetainPtr<PseudoRetainable> ptr2;
+ EXPECT_EQ(&obj, ptr1.Get());
+ EXPECT_EQ(nullptr, ptr2.Get());
+ ptr2 = std::move(ptr1);
+ EXPECT_EQ(nullptr, ptr1.Get());
+ EXPECT_EQ(&obj, ptr2.Get());
+ EXPECT_EQ(1, obj.retain_count());
+ EXPECT_EQ(0, obj.release_count());
+ }
+ EXPECT_EQ(1, obj.retain_count());
+ EXPECT_EQ(1, obj.release_count());
+ }
+ EXPECT_EQ(1, obj.retain_count());
+ EXPECT_EQ(1, obj.release_count());
+}
+
TEST(fxcrt, RetainPtrEquals) {
PseudoRetainable obj1;
PseudoRetainable obj2;
@@ -252,3 +276,26 @@ TEST(fxcrt, RetainPtrMakeRetained) {
}
EXPECT_TRUE(ptr->HasOneRef());
}
+
+TEST(fxcrt, RetainPtrVectorMove) {
+ // Proves move ctor is selected by std::vector over copy/delete, this
+ // may require the ctor to be marked "noexcept".
+ PseudoRetainable obj;
+ {
+ CFX_RetainPtr<PseudoRetainable> ptr(&obj);
+ std::vector<CFX_RetainPtr<PseudoRetainable>> vec1;
+ vec1.push_back(std::move(ptr));
+ EXPECT_EQ(1, obj.retain_count());
+ EXPECT_EQ(0, obj.release_count());
+
+ std::vector<CFX_RetainPtr<PseudoRetainable>> vec2 = std::move(vec1);
+ EXPECT_EQ(1, obj.retain_count());
+ EXPECT_EQ(0, obj.release_count());
+
+ vec2.resize(4096);
+ EXPECT_EQ(1, obj.retain_count());
+ EXPECT_EQ(0, obj.release_count());
+ }
+ EXPECT_EQ(1, obj.retain_count());
+ EXPECT_EQ(1, obj.release_count());
+}
diff --git a/chromium/third_party/pdfium/core/fxcrt/cfx_string_c_template.h b/chromium/third_party/pdfium/core/fxcrt/cfx_string_c_template.h
index 3bfcc915fb3..b52817d7901 100644
--- a/chromium/third_party/pdfium/core/fxcrt/cfx_string_c_template.h
+++ b/chromium/third_party/pdfium/core/fxcrt/cfx_string_c_template.h
@@ -164,7 +164,10 @@ inline bool operator!=(const T* lhs, const CFX_StringCTemplate<T>& rhs) {
return rhs != lhs;
}
-extern template class CFX_StringCTemplate<FX_CHAR>;
-extern template class CFX_StringCTemplate<FX_WCHAR>;
+extern template class CFX_StringCTemplate<char>;
+extern template class CFX_StringCTemplate<wchar_t>;
+
+using CFX_ByteStringC = CFX_StringCTemplate<char>;
+using CFX_WideStringC = CFX_StringCTemplate<wchar_t>;
#endif // CORE_FXCRT_CFX_STRING_C_TEMPLATE_H_
diff --git a/chromium/third_party/pdfium/core/fxcrt/cfx_string_data_template.h b/chromium/third_party/pdfium/core/fxcrt/cfx_string_data_template.h
index c3e090fef0c..e39f6a5dfdf 100644
--- a/chromium/third_party/pdfium/core/fxcrt/cfx_string_data_template.h
+++ b/chromium/third_party/pdfium/core/fxcrt/cfx_string_data_template.h
@@ -35,7 +35,8 @@ class CFX_StringDataTemplate {
int usableLen = (totalSize - overhead) / sizeof(CharType);
ASSERT(usableLen >= nLen);
- void* pData = FX_Alloc(uint8_t, totalSize);
+ void* pData = pdfium::base::PartitionAllocGeneric(
+ gStringPartitionAllocator.root(), totalSize, "CFX_StringDataTemplate");
return new (pData) CFX_StringDataTemplate(nLen, usableLen);
}
@@ -54,7 +55,8 @@ class CFX_StringDataTemplate {
void Retain() { ++m_nRefs; }
void Release() {
if (--m_nRefs <= 0)
- FX_Free(this);
+ pdfium::base::PartitionFreeGeneric(gStringPartitionAllocator.root(),
+ this);
}
bool CanOperateInPlace(FX_STRSIZE nTotalLen) const {
@@ -63,13 +65,13 @@ class CFX_StringDataTemplate {
void CopyContents(const CFX_StringDataTemplate& other) {
ASSERT(other.m_nDataLength <= m_nAllocLength);
- FXSYS_memcpy(m_String, other.m_String,
- (other.m_nDataLength + 1) * sizeof(CharType));
+ memcpy(m_String, other.m_String,
+ (other.m_nDataLength + 1) * sizeof(CharType));
}
void CopyContents(const CharType* pStr, FX_STRSIZE nLen) {
ASSERT(nLen >= 0 && nLen <= m_nAllocLength);
- FXSYS_memcpy(m_String, pStr, nLen * sizeof(CharType));
+ memcpy(m_String, pStr, nLen * sizeof(CharType));
m_String[nLen] = 0;
}
@@ -77,7 +79,7 @@ class CFX_StringDataTemplate {
const CharType* pStr,
FX_STRSIZE nLen) {
ASSERT(offset >= 0 && nLen >= 0 && offset + nLen <= m_nAllocLength);
- FXSYS_memcpy(m_String + offset, pStr, nLen * sizeof(CharType));
+ memcpy(m_String + offset, pStr, nLen * sizeof(CharType));
m_String[offset + nLen] = 0;
}
@@ -110,7 +112,7 @@ class CFX_StringDataTemplate {
~CFX_StringDataTemplate() = delete;
};
-extern template class CFX_StringDataTemplate<FX_CHAR>;
-extern template class CFX_StringDataTemplate<FX_WCHAR>;
+extern template class CFX_StringDataTemplate<char>;
+extern template class CFX_StringDataTemplate<wchar_t>;
#endif // CORE_FXCRT_CFX_STRING_DATA_TEMPLATE_H_
diff --git a/chromium/third_party/pdfium/core/fxcrt/cfx_weak_ptr.h b/chromium/third_party/pdfium/core/fxcrt/cfx_weak_ptr.h
index 43ae5b881d4..4aca1c3218b 100644
--- a/chromium/third_party/pdfium/core/fxcrt/cfx_weak_ptr.h
+++ b/chromium/third_party/pdfium/core/fxcrt/cfx_weak_ptr.h
@@ -19,7 +19,7 @@ class CFX_WeakPtr {
public:
CFX_WeakPtr() {}
CFX_WeakPtr(const CFX_WeakPtr& that) : m_pHandle(that.m_pHandle) {}
- CFX_WeakPtr(CFX_WeakPtr&& that) { Swap(that); }
+ CFX_WeakPtr(CFX_WeakPtr&& that) noexcept { Swap(that); }
explicit CFX_WeakPtr(std::unique_ptr<T, D> pObj)
: m_pHandle(new Handle(std::move(pObj))) {}
diff --git a/chromium/third_party/pdfium/core/fxcrt/cfx_widestring.cpp b/chromium/third_party/pdfium/core/fxcrt/cfx_widestring.cpp
new file mode 100644
index 00000000000..c9a89fe112c
--- /dev/null
+++ b/chromium/third_party/pdfium/core/fxcrt/cfx_widestring.cpp
@@ -0,0 +1,1068 @@
+// 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
+
+#include "core/fxcrt/cfx_widestring.h"
+
+#include <stddef.h>
+
+#include <algorithm>
+#include <cctype>
+
+#include "core/fxcrt/cfx_string_pool_template.h"
+#include "core/fxcrt/fx_basic.h"
+#include "core/fxcrt/fx_ext.h"
+#include "core/fxcrt/fx_safe_types.h"
+#include "third_party/base/numerics/safe_math.h"
+#include "third_party/base/stl_util.h"
+
+template class CFX_StringDataTemplate<wchar_t>;
+template class CFX_StringCTemplate<wchar_t>;
+template class CFX_StringPoolTemplate<CFX_WideString>;
+template struct std::hash<CFX_WideString>;
+
+#define FORCE_ANSI 0x10000
+#define FORCE_UNICODE 0x20000
+#define FORCE_INT64 0x40000
+
+namespace {
+
+#ifndef NDEBUG
+bool IsValidCodePage(uint16_t codepage) {
+ switch (codepage) {
+ case 0:
+ case 932:
+ case 936:
+ case 949:
+ case 950:
+ return true;
+
+ default:
+ return false;
+ }
+}
+#endif
+
+const wchar_t* FX_wcsstr(const wchar_t* haystack,
+ int haystack_len,
+ const wchar_t* needle,
+ int needle_len) {
+ if (needle_len > haystack_len || needle_len == 0) {
+ return nullptr;
+ }
+ const wchar_t* end_ptr = haystack + haystack_len - needle_len;
+ while (haystack <= end_ptr) {
+ int i = 0;
+ while (1) {
+ if (haystack[i] != needle[i]) {
+ break;
+ }
+ i++;
+ if (i == needle_len) {
+ return haystack;
+ }
+ }
+ haystack++;
+ }
+ return nullptr;
+}
+
+FX_STRSIZE GuessSizeForVSWPrintf(const wchar_t* pFormat, va_list argList) {
+ FX_STRSIZE nMaxLen = 0;
+ for (const wchar_t* pStr = pFormat; *pStr != 0; pStr++) {
+ if (*pStr != '%' || *(pStr = pStr + 1) == '%') {
+ ++nMaxLen;
+ continue;
+ }
+ int nItemLen = 0;
+ int nWidth = 0;
+ for (; *pStr != 0; pStr++) {
+ if (*pStr == '#') {
+ nMaxLen += 2;
+ } else if (*pStr == '*') {
+ nWidth = va_arg(argList, int);
+ } else if (*pStr != '-' && *pStr != '+' && *pStr != '0' && *pStr != ' ') {
+ break;
+ }
+ }
+ if (nWidth == 0) {
+ nWidth = FXSYS_wtoi(pStr);
+ while (std::iswdigit(*pStr))
+ ++pStr;
+ }
+ if (nWidth < 0 || nWidth > 128 * 1024)
+ return -1;
+ int nPrecision = 0;
+ if (*pStr == '.') {
+ pStr++;
+ if (*pStr == '*') {
+ nPrecision = va_arg(argList, int);
+ pStr++;
+ } else {
+ nPrecision = FXSYS_wtoi(pStr);
+ while (std::iswdigit(*pStr))
+ ++pStr;
+ }
+ }
+ if (nPrecision < 0 || nPrecision > 128 * 1024)
+ return -1;
+ int nModifier = 0;
+ if (*pStr == L'I' && *(pStr + 1) == L'6' && *(pStr + 2) == L'4') {
+ pStr += 3;
+ nModifier = FORCE_INT64;
+ } else {
+ switch (*pStr) {
+ case 'h':
+ nModifier = FORCE_ANSI;
+ pStr++;
+ break;
+ case 'l':
+ nModifier = FORCE_UNICODE;
+ pStr++;
+ break;
+ case 'F':
+ case 'N':
+ case 'L':
+ pStr++;
+ break;
+ }
+ }
+ switch (*pStr | nModifier) {
+ case 'c':
+ case 'C':
+ nItemLen = 2;
+ va_arg(argList, int);
+ break;
+ case 'c' | FORCE_ANSI:
+ case 'C' | FORCE_ANSI:
+ nItemLen = 2;
+ va_arg(argList, int);
+ break;
+ case 'c' | FORCE_UNICODE:
+ case 'C' | FORCE_UNICODE:
+ nItemLen = 2;
+ va_arg(argList, int);
+ break;
+ case 's': {
+ const wchar_t* pstrNextArg = va_arg(argList, const wchar_t*);
+ if (pstrNextArg) {
+ nItemLen = FXSYS_wcslen(pstrNextArg);
+ if (nItemLen < 1) {
+ nItemLen = 1;
+ }
+ } else {
+ nItemLen = 6;
+ }
+ } break;
+ case 'S': {
+ const char* pstrNextArg = va_arg(argList, const char*);
+ if (pstrNextArg) {
+ nItemLen = FXSYS_strlen(pstrNextArg);
+ if (nItemLen < 1) {
+ nItemLen = 1;
+ }
+ } else {
+ nItemLen = 6;
+ }
+ } break;
+ case 's' | FORCE_ANSI:
+ case 'S' | FORCE_ANSI: {
+ const char* pstrNextArg = va_arg(argList, const char*);
+ if (pstrNextArg) {
+ nItemLen = FXSYS_strlen(pstrNextArg);
+ if (nItemLen < 1) {
+ nItemLen = 1;
+ }
+ } else {
+ nItemLen = 6;
+ }
+ } break;
+ case 's' | FORCE_UNICODE:
+ case 'S' | FORCE_UNICODE: {
+ const wchar_t* pstrNextArg = va_arg(argList, wchar_t*);
+ if (pstrNextArg) {
+ nItemLen = FXSYS_wcslen(pstrNextArg);
+ if (nItemLen < 1) {
+ nItemLen = 1;
+ }
+ } else {
+ nItemLen = 6;
+ }
+ } break;
+ }
+ if (nItemLen != 0) {
+ if (nPrecision != 0 && nItemLen > nPrecision) {
+ nItemLen = nPrecision;
+ }
+ if (nItemLen < nWidth) {
+ nItemLen = nWidth;
+ }
+ } else {
+ switch (*pStr) {
+ case 'd':
+ case 'i':
+ case 'u':
+ case 'x':
+ case 'X':
+ case 'o':
+ if (nModifier & FORCE_INT64) {
+ va_arg(argList, int64_t);
+ } else {
+ va_arg(argList, int);
+ }
+ nItemLen = 32;
+ if (nItemLen < nWidth + nPrecision) {
+ nItemLen = nWidth + nPrecision;
+ }
+ break;
+ case 'a':
+ case 'A':
+ case 'e':
+ case 'E':
+ case 'g':
+ case 'G':
+ va_arg(argList, double);
+ nItemLen = 128;
+ if (nItemLen < nWidth + nPrecision) {
+ nItemLen = nWidth + nPrecision;
+ }
+ break;
+ case 'f':
+ if (nWidth + nPrecision > 100) {
+ nItemLen = nPrecision + nWidth + 128;
+ } else {
+ double f;
+ char pszTemp[256];
+ f = va_arg(argList, double);
+ FXSYS_snprintf(pszTemp, sizeof(pszTemp), "%*.*f", nWidth,
+ nPrecision + 6, f);
+ nItemLen = FXSYS_strlen(pszTemp);
+ }
+ break;
+ case 'p':
+ va_arg(argList, void*);
+ nItemLen = 32;
+ if (nItemLen < nWidth + nPrecision) {
+ nItemLen = nWidth + nPrecision;
+ }
+ break;
+ case 'n':
+ va_arg(argList, int*);
+ break;
+ }
+ }
+ nMaxLen += nItemLen;
+ }
+ nMaxLen += 32; // Fudge factor.
+ return nMaxLen;
+}
+
+} // namespace
+
+static_assert(sizeof(CFX_WideString) <= sizeof(wchar_t*),
+ "Strings must not require more space than pointers");
+
+CFX_WideString::CFX_WideString() {}
+
+CFX_WideString::CFX_WideString(const CFX_WideString& other)
+ : m_pData(other.m_pData) {}
+
+CFX_WideString::CFX_WideString(CFX_WideString&& other) noexcept {
+ m_pData.Swap(other.m_pData);
+}
+
+CFX_WideString::CFX_WideString(const wchar_t* pStr, FX_STRSIZE nLen) {
+ if (nLen < 0)
+ nLen = pStr ? FXSYS_wcslen(pStr) : 0;
+
+ if (nLen)
+ m_pData.Reset(StringData::Create(pStr, nLen));
+}
+
+CFX_WideString::CFX_WideString(wchar_t ch) {
+ m_pData.Reset(StringData::Create(1));
+ m_pData->m_String[0] = ch;
+}
+
+CFX_WideString::CFX_WideString(const wchar_t* ptr)
+ : CFX_WideString(ptr, ptr ? FXSYS_wcslen(ptr) : 0) {}
+
+CFX_WideString::CFX_WideString(const CFX_WideStringC& stringSrc) {
+ if (!stringSrc.IsEmpty()) {
+ m_pData.Reset(StringData::Create(stringSrc.c_str(), stringSrc.GetLength()));
+ }
+}
+
+CFX_WideString::CFX_WideString(const CFX_WideStringC& str1,
+ const CFX_WideStringC& str2) {
+ FX_SAFE_STRSIZE nSafeLen = str1.GetLength();
+ nSafeLen += str2.GetLength();
+
+ FX_STRSIZE nNewLen = nSafeLen.ValueOrDie();
+ if (nNewLen == 0)
+ return;
+
+ m_pData.Reset(StringData::Create(nNewLen));
+ m_pData->CopyContents(str1.c_str(), str1.GetLength());
+ m_pData->CopyContentsAt(str1.GetLength(), str2.c_str(), str2.GetLength());
+}
+
+CFX_WideString::CFX_WideString(
+ const std::initializer_list<CFX_WideStringC>& list) {
+ FX_SAFE_STRSIZE nSafeLen = 0;
+ for (const auto& item : list)
+ nSafeLen += item.GetLength();
+
+ FX_STRSIZE nNewLen = nSafeLen.ValueOrDie();
+ if (nNewLen == 0)
+ return;
+
+ m_pData.Reset(StringData::Create(nNewLen));
+
+ FX_STRSIZE nOffset = 0;
+ for (const auto& item : list) {
+ m_pData->CopyContentsAt(nOffset, item.c_str(), item.GetLength());
+ nOffset += item.GetLength();
+ }
+}
+
+CFX_WideString::~CFX_WideString() {}
+
+const CFX_WideString& CFX_WideString::operator=(const wchar_t* pStr) {
+ if (!pStr || !pStr[0])
+ clear();
+ else
+ AssignCopy(pStr, FXSYS_wcslen(pStr));
+
+ return *this;
+}
+
+const CFX_WideString& CFX_WideString::operator=(
+ const CFX_WideStringC& stringSrc) {
+ if (stringSrc.IsEmpty())
+ clear();
+ else
+ AssignCopy(stringSrc.c_str(), stringSrc.GetLength());
+
+ return *this;
+}
+
+const CFX_WideString& CFX_WideString::operator=(
+ const CFX_WideString& stringSrc) {
+ if (m_pData != stringSrc.m_pData)
+ m_pData = stringSrc.m_pData;
+
+ return *this;
+}
+
+const CFX_WideString& CFX_WideString::operator+=(const wchar_t* pStr) {
+ if (pStr)
+ Concat(pStr, FXSYS_wcslen(pStr));
+
+ return *this;
+}
+
+const CFX_WideString& CFX_WideString::operator+=(wchar_t ch) {
+ Concat(&ch, 1);
+ return *this;
+}
+
+const CFX_WideString& CFX_WideString::operator+=(const CFX_WideString& str) {
+ if (str.m_pData)
+ Concat(str.m_pData->m_String, str.m_pData->m_nDataLength);
+
+ return *this;
+}
+
+const CFX_WideString& CFX_WideString::operator+=(const CFX_WideStringC& str) {
+ if (!str.IsEmpty())
+ Concat(str.c_str(), str.GetLength());
+
+ return *this;
+}
+
+bool CFX_WideString::operator==(const wchar_t* ptr) const {
+ if (!m_pData)
+ return !ptr || !ptr[0];
+
+ if (!ptr)
+ return m_pData->m_nDataLength == 0;
+
+ return wcslen(ptr) == static_cast<size_t>(m_pData->m_nDataLength) &&
+ wmemcmp(ptr, m_pData->m_String, m_pData->m_nDataLength) == 0;
+}
+
+bool CFX_WideString::operator==(const CFX_WideStringC& str) const {
+ if (!m_pData)
+ return str.IsEmpty();
+
+ return m_pData->m_nDataLength == str.GetLength() &&
+ wmemcmp(m_pData->m_String, str.c_str(), str.GetLength()) == 0;
+}
+
+bool CFX_WideString::operator==(const CFX_WideString& other) const {
+ if (m_pData == other.m_pData)
+ return true;
+
+ if (IsEmpty())
+ return other.IsEmpty();
+
+ if (other.IsEmpty())
+ return false;
+
+ return other.m_pData->m_nDataLength == m_pData->m_nDataLength &&
+ wmemcmp(other.m_pData->m_String, m_pData->m_String,
+ m_pData->m_nDataLength) == 0;
+}
+
+bool CFX_WideString::operator<(const CFX_WideString& str) const {
+ if (m_pData == str.m_pData)
+ return false;
+
+ int result =
+ wmemcmp(c_str(), str.c_str(), std::min(GetLength(), str.GetLength()));
+ return result < 0 || (result == 0 && GetLength() < str.GetLength());
+}
+
+void CFX_WideString::AssignCopy(const wchar_t* pSrcData, FX_STRSIZE nSrcLen) {
+ AllocBeforeWrite(nSrcLen);
+ m_pData->CopyContents(pSrcData, nSrcLen);
+ m_pData->m_nDataLength = nSrcLen;
+}
+
+void CFX_WideString::ReallocBeforeWrite(FX_STRSIZE nNewLength) {
+ if (m_pData && m_pData->CanOperateInPlace(nNewLength))
+ return;
+
+ if (nNewLength <= 0) {
+ clear();
+ return;
+ }
+
+ CFX_RetainPtr<StringData> pNewData(StringData::Create(nNewLength));
+ if (m_pData) {
+ FX_STRSIZE nCopyLength = std::min(m_pData->m_nDataLength, nNewLength);
+ pNewData->CopyContents(m_pData->m_String, nCopyLength);
+ pNewData->m_nDataLength = nCopyLength;
+ } else {
+ pNewData->m_nDataLength = 0;
+ }
+ pNewData->m_String[pNewData->m_nDataLength] = 0;
+ m_pData.Swap(pNewData);
+}
+
+void CFX_WideString::AllocBeforeWrite(FX_STRSIZE nNewLength) {
+ if (m_pData && m_pData->CanOperateInPlace(nNewLength))
+ return;
+
+ if (nNewLength <= 0) {
+ clear();
+ return;
+ }
+
+ m_pData.Reset(StringData::Create(nNewLength));
+}
+
+void CFX_WideString::ReleaseBuffer(FX_STRSIZE nNewLength) {
+ if (!m_pData)
+ return;
+
+ if (nNewLength == -1)
+ nNewLength = FXSYS_wcslen(m_pData->m_String);
+
+ nNewLength = std::min(nNewLength, m_pData->m_nAllocLength);
+ if (nNewLength == 0) {
+ clear();
+ return;
+ }
+
+ ASSERT(m_pData->m_nRefs == 1);
+ m_pData->m_nDataLength = nNewLength;
+ m_pData->m_String[nNewLength] = 0;
+ if (m_pData->m_nAllocLength - nNewLength >= 32) {
+ // Over arbitrary threshold, so pay the price to relocate. Force copy to
+ // always occur by holding a second reference to the string.
+ CFX_WideString preserve(*this);
+ ReallocBeforeWrite(nNewLength);
+ }
+}
+
+void CFX_WideString::Reserve(FX_STRSIZE len) {
+ GetBuffer(len);
+}
+
+wchar_t* CFX_WideString::GetBuffer(FX_STRSIZE nMinBufLength) {
+ if (!m_pData) {
+ if (nMinBufLength == 0)
+ return nullptr;
+
+ m_pData.Reset(StringData::Create(nMinBufLength));
+ m_pData->m_nDataLength = 0;
+ m_pData->m_String[0] = 0;
+ return m_pData->m_String;
+ }
+
+ if (m_pData->CanOperateInPlace(nMinBufLength))
+ return m_pData->m_String;
+
+ nMinBufLength = std::max(nMinBufLength, m_pData->m_nDataLength);
+ if (nMinBufLength == 0)
+ return nullptr;
+
+ CFX_RetainPtr<StringData> pNewData(StringData::Create(nMinBufLength));
+ pNewData->CopyContents(*m_pData);
+ pNewData->m_nDataLength = m_pData->m_nDataLength;
+ m_pData.Swap(pNewData);
+ return m_pData->m_String;
+}
+
+FX_STRSIZE CFX_WideString::Delete(FX_STRSIZE nIndex, FX_STRSIZE nCount) {
+ if (!m_pData)
+ return 0;
+
+ if (nIndex < 0)
+ nIndex = 0;
+
+ FX_STRSIZE nOldLength = m_pData->m_nDataLength;
+ if (nCount > 0 && nIndex < nOldLength) {
+ FX_STRSIZE mLength = nIndex + nCount;
+ if (mLength >= nOldLength) {
+ m_pData->m_nDataLength = nIndex;
+ return m_pData->m_nDataLength;
+ }
+ ReallocBeforeWrite(nOldLength);
+ int nCharsToCopy = nOldLength - mLength + 1;
+ wmemmove(m_pData->m_String + nIndex, m_pData->m_String + mLength,
+ nCharsToCopy);
+ m_pData->m_nDataLength = nOldLength - nCount;
+ }
+ return m_pData->m_nDataLength;
+}
+
+void CFX_WideString::Concat(const wchar_t* pSrcData, FX_STRSIZE nSrcLen) {
+ if (!pSrcData || nSrcLen <= 0)
+ return;
+
+ if (!m_pData) {
+ m_pData.Reset(StringData::Create(pSrcData, nSrcLen));
+ return;
+ }
+
+ if (m_pData->CanOperateInPlace(m_pData->m_nDataLength + nSrcLen)) {
+ m_pData->CopyContentsAt(m_pData->m_nDataLength, pSrcData, nSrcLen);
+ m_pData->m_nDataLength += nSrcLen;
+ return;
+ }
+
+ CFX_RetainPtr<StringData> pNewData(
+ StringData::Create(m_pData->m_nDataLength + nSrcLen));
+ pNewData->CopyContents(*m_pData);
+ pNewData->CopyContentsAt(m_pData->m_nDataLength, pSrcData, nSrcLen);
+ m_pData.Swap(pNewData);
+}
+
+CFX_ByteString CFX_WideString::UTF8Encode() const {
+ return FX_UTF8Encode(AsStringC());
+}
+
+CFX_ByteString CFX_WideString::UTF16LE_Encode() const {
+ if (!m_pData) {
+ return CFX_ByteString("\0\0", 2);
+ }
+ int len = m_pData->m_nDataLength;
+ CFX_ByteString result;
+ char* buffer = result.GetBuffer(len * 2 + 2);
+ for (int i = 0; i < len; i++) {
+ buffer[i * 2] = m_pData->m_String[i] & 0xff;
+ buffer[i * 2 + 1] = m_pData->m_String[i] >> 8;
+ }
+ buffer[len * 2] = 0;
+ buffer[len * 2 + 1] = 0;
+ result.ReleaseBuffer(len * 2 + 2);
+ return result;
+}
+
+CFX_WideString CFX_WideString::Mid(FX_STRSIZE nFirst) const {
+ if (!m_pData)
+ return CFX_WideString();
+
+ return Mid(nFirst, m_pData->m_nDataLength - nFirst);
+}
+
+CFX_WideString CFX_WideString::Mid(FX_STRSIZE nFirst, FX_STRSIZE nCount) const {
+ if (!m_pData)
+ return CFX_WideString();
+
+ nFirst = pdfium::clamp(nFirst, 0, m_pData->m_nDataLength);
+ nCount = pdfium::clamp(nCount, 0, m_pData->m_nDataLength - nFirst);
+ if (nCount == 0)
+ return CFX_WideString();
+
+ if (nFirst == 0 && nCount == m_pData->m_nDataLength)
+ return *this;
+
+ CFX_WideString dest;
+ AllocCopy(dest, nCount, nFirst);
+ return dest;
+}
+
+void CFX_WideString::AllocCopy(CFX_WideString& dest,
+ FX_STRSIZE nCopyLen,
+ FX_STRSIZE nCopyIndex) const {
+ if (nCopyLen <= 0)
+ return;
+
+ CFX_RetainPtr<StringData> pNewData(
+ StringData::Create(m_pData->m_String + nCopyIndex, nCopyLen));
+ dest.m_pData.Swap(pNewData);
+}
+
+bool CFX_WideString::TryVSWPrintf(FX_STRSIZE size,
+ const wchar_t* pFormat,
+ va_list argList) {
+ GetBuffer(size);
+ if (!m_pData)
+ return true;
+
+ // In the following two calls, there's always space in the buffer for
+ // a terminating NUL that's not included in nMaxLen.
+ // For vswprintf(), MSAN won't untaint the buffer on a truncated write's
+ // -1 return code even though the buffer is written. Probably just as well
+ // not to trust the vendor's implementation to write anything anyways.
+ // See https://crbug.com/705912.
+ memset(m_pData->m_String, 0, (size + 1) * sizeof(wchar_t));
+ int ret = vswprintf(m_pData->m_String, size + 1, pFormat, argList);
+ bool bSufficientBuffer = ret >= 0 || m_pData->m_String[size - 1] == 0;
+ ReleaseBuffer();
+ return bSufficientBuffer;
+}
+
+void CFX_WideString::FormatV(const wchar_t* pFormat, va_list argList) {
+ va_list argListCopy;
+ FX_VA_COPY(argListCopy, argList);
+ FX_STRSIZE nMaxLen = vswprintf(nullptr, 0, pFormat, argListCopy);
+ va_end(argListCopy);
+ if (nMaxLen <= 0) {
+ nMaxLen = GuessSizeForVSWPrintf(pFormat, argListCopy);
+ if (nMaxLen <= 0)
+ return;
+ }
+ while (nMaxLen < 32 * 1024) {
+ FX_VA_COPY(argListCopy, argList);
+ bool bSufficientBuffer = TryVSWPrintf(nMaxLen, pFormat, argListCopy);
+ va_end(argListCopy);
+ if (bSufficientBuffer)
+ break;
+ nMaxLen *= 2;
+ }
+}
+
+void CFX_WideString::Format(const wchar_t* pFormat, ...) {
+ va_list argList;
+ va_start(argList, pFormat);
+ FormatV(pFormat, argList);
+ va_end(argList);
+}
+
+FX_STRSIZE CFX_WideString::Insert(FX_STRSIZE nIndex, wchar_t ch) {
+ FX_STRSIZE nNewLength = m_pData ? m_pData->m_nDataLength : 0;
+ nIndex = std::max(nIndex, 0);
+ nIndex = std::min(nIndex, nNewLength);
+ nNewLength++;
+
+ ReallocBeforeWrite(nNewLength);
+ wmemmove(m_pData->m_String + nIndex + 1, m_pData->m_String + nIndex,
+ nNewLength - nIndex);
+ m_pData->m_String[nIndex] = ch;
+ m_pData->m_nDataLength = nNewLength;
+ return nNewLength;
+}
+
+CFX_WideString CFX_WideString::Right(FX_STRSIZE nCount) const {
+ if (!m_pData)
+ return CFX_WideString();
+
+ nCount = std::max(nCount, 0);
+ if (nCount >= m_pData->m_nDataLength)
+ return *this;
+
+ CFX_WideString dest;
+ AllocCopy(dest, nCount, m_pData->m_nDataLength - nCount);
+ return dest;
+}
+
+CFX_WideString CFX_WideString::Left(FX_STRSIZE nCount) const {
+ if (!m_pData)
+ return CFX_WideString();
+
+ nCount = std::max(nCount, 0);
+ if (nCount >= m_pData->m_nDataLength)
+ return *this;
+
+ CFX_WideString dest;
+ AllocCopy(dest, nCount, 0);
+ return dest;
+}
+
+FX_STRSIZE CFX_WideString::Find(wchar_t ch, FX_STRSIZE nStart) const {
+ if (!m_pData)
+ return -1;
+
+ if (nStart < 0 || nStart >= m_pData->m_nDataLength)
+ return -1;
+
+ const wchar_t* pStr =
+ wmemchr(m_pData->m_String + nStart, ch, m_pData->m_nDataLength - nStart);
+ return pStr ? pStr - m_pData->m_String : -1;
+}
+
+FX_STRSIZE CFX_WideString::Find(const CFX_WideStringC& pSub,
+ FX_STRSIZE nStart) const {
+ if (!m_pData)
+ return -1;
+
+ FX_STRSIZE nLength = m_pData->m_nDataLength;
+ if (nStart > nLength)
+ return -1;
+
+ const wchar_t* pStr =
+ FX_wcsstr(m_pData->m_String + nStart, m_pData->m_nDataLength - nStart,
+ pSub.c_str(), pSub.GetLength());
+ return pStr ? (int)(pStr - m_pData->m_String) : -1;
+}
+
+void CFX_WideString::MakeLower() {
+ if (!m_pData)
+ return;
+
+ ReallocBeforeWrite(m_pData->m_nDataLength);
+ FXSYS_wcslwr(m_pData->m_String);
+}
+
+void CFX_WideString::MakeUpper() {
+ if (!m_pData)
+ return;
+
+ ReallocBeforeWrite(m_pData->m_nDataLength);
+ FXSYS_wcsupr(m_pData->m_String);
+}
+
+FX_STRSIZE CFX_WideString::Remove(wchar_t chRemove) {
+ if (!m_pData || m_pData->m_nDataLength < 1)
+ return 0;
+
+ wchar_t* pstrSource = m_pData->m_String;
+ wchar_t* pstrEnd = m_pData->m_String + m_pData->m_nDataLength;
+ while (pstrSource < pstrEnd) {
+ if (*pstrSource == chRemove)
+ break;
+ pstrSource++;
+ }
+ if (pstrSource == pstrEnd)
+ return 0;
+
+ ptrdiff_t copied = pstrSource - m_pData->m_String;
+ ReallocBeforeWrite(m_pData->m_nDataLength);
+ pstrSource = m_pData->m_String + copied;
+ pstrEnd = m_pData->m_String + m_pData->m_nDataLength;
+
+ wchar_t* pstrDest = pstrSource;
+ while (pstrSource < pstrEnd) {
+ if (*pstrSource != chRemove) {
+ *pstrDest = *pstrSource;
+ pstrDest++;
+ }
+ pstrSource++;
+ }
+
+ *pstrDest = 0;
+ FX_STRSIZE nCount = (FX_STRSIZE)(pstrSource - pstrDest);
+ m_pData->m_nDataLength -= nCount;
+ return nCount;
+}
+
+FX_STRSIZE CFX_WideString::Replace(const CFX_WideStringC& pOld,
+ const CFX_WideStringC& pNew) {
+ if (!m_pData || pOld.IsEmpty())
+ return 0;
+
+ FX_STRSIZE nSourceLen = pOld.GetLength();
+ FX_STRSIZE nReplacementLen = pNew.GetLength();
+ FX_STRSIZE nCount = 0;
+ const wchar_t* pStart = m_pData->m_String;
+ wchar_t* pEnd = m_pData->m_String + m_pData->m_nDataLength;
+ while (1) {
+ const wchar_t* pTarget = FX_wcsstr(pStart, (FX_STRSIZE)(pEnd - pStart),
+ pOld.c_str(), nSourceLen);
+ if (!pTarget)
+ break;
+
+ nCount++;
+ pStart = pTarget + nSourceLen;
+ }
+ if (nCount == 0)
+ return 0;
+
+ FX_STRSIZE nNewLength =
+ m_pData->m_nDataLength + (nReplacementLen - nSourceLen) * nCount;
+
+ if (nNewLength == 0) {
+ clear();
+ return nCount;
+ }
+
+ CFX_RetainPtr<StringData> pNewData(StringData::Create(nNewLength));
+ pStart = m_pData->m_String;
+ wchar_t* pDest = pNewData->m_String;
+ for (FX_STRSIZE i = 0; i < nCount; i++) {
+ const wchar_t* pTarget = FX_wcsstr(pStart, (FX_STRSIZE)(pEnd - pStart),
+ pOld.c_str(), nSourceLen);
+ wmemcpy(pDest, pStart, pTarget - pStart);
+ pDest += pTarget - pStart;
+ wmemcpy(pDest, pNew.c_str(), pNew.GetLength());
+ pDest += pNew.GetLength();
+ pStart = pTarget + nSourceLen;
+ }
+ wmemcpy(pDest, pStart, pEnd - pStart);
+ m_pData.Swap(pNewData);
+ return nCount;
+}
+
+void CFX_WideString::SetAt(FX_STRSIZE nIndex, wchar_t ch) {
+ if (!m_pData) {
+ return;
+ }
+ ASSERT(nIndex >= 0);
+ ASSERT(nIndex < m_pData->m_nDataLength);
+ ReallocBeforeWrite(m_pData->m_nDataLength);
+ m_pData->m_String[nIndex] = ch;
+}
+
+// static
+CFX_WideString CFX_WideString::FromLocal(const CFX_ByteStringC& str) {
+ return FromCodePage(str, 0);
+}
+
+// static
+CFX_WideString CFX_WideString::FromCodePage(const CFX_ByteStringC& str,
+ uint16_t codepage) {
+ return CFX_CharMap::GetWideString(codepage, str);
+}
+
+// static
+CFX_WideString CFX_WideString::FromUTF8(const CFX_ByteStringC& str) {
+ if (str.IsEmpty())
+ return CFX_WideString();
+
+ CFX_UTF8Decoder decoder;
+ for (FX_STRSIZE i = 0; i < str.GetLength(); i++)
+ decoder.Input(str[i]);
+
+ return CFX_WideString(decoder.GetResult());
+}
+
+// static
+CFX_WideString CFX_WideString::FromUTF16LE(const unsigned short* wstr,
+ FX_STRSIZE wlen) {
+ if (!wstr || 0 == wlen) {
+ return CFX_WideString();
+ }
+
+ CFX_WideString result;
+ wchar_t* buf = result.GetBuffer(wlen);
+ for (int i = 0; i < wlen; i++) {
+ buf[i] = wstr[i];
+ }
+ result.ReleaseBuffer(wlen);
+ return result;
+}
+
+int CFX_WideString::Compare(const wchar_t* lpsz) const {
+ if (m_pData)
+ return wcscmp(m_pData->m_String, lpsz);
+ return (!lpsz || lpsz[0] == 0) ? 0 : -1;
+}
+
+int CFX_WideString::Compare(const CFX_WideString& str) const {
+ if (!m_pData) {
+ if (!str.m_pData) {
+ return 0;
+ }
+ return -1;
+ }
+ if (!str.m_pData) {
+ return 1;
+ }
+ int this_len = m_pData->m_nDataLength;
+ int that_len = str.m_pData->m_nDataLength;
+ int min_len = this_len < that_len ? this_len : that_len;
+ for (int i = 0; i < min_len; i++) {
+ if (m_pData->m_String[i] < str.m_pData->m_String[i]) {
+ return -1;
+ }
+ if (m_pData->m_String[i] > str.m_pData->m_String[i]) {
+ return 1;
+ }
+ }
+ if (this_len < that_len) {
+ return -1;
+ }
+ if (this_len > that_len) {
+ return 1;
+ }
+ return 0;
+}
+
+int CFX_WideString::CompareNoCase(const wchar_t* lpsz) const {
+ if (!m_pData) {
+ return (!lpsz || lpsz[0] == 0) ? 0 : -1;
+ }
+ return FXSYS_wcsicmp(m_pData->m_String, lpsz);
+}
+
+FX_STRSIZE CFX_WideString::WStringLength(const unsigned short* str) {
+ FX_STRSIZE len = 0;
+ if (str)
+ while (str[len])
+ len++;
+ return len;
+}
+
+void CFX_WideString::TrimRight(const CFX_WideStringC& pTargets) {
+ if (IsEmpty() || pTargets.IsEmpty())
+ return;
+
+ FX_STRSIZE pos = GetLength();
+ while (pos && pTargets.Find(m_pData->m_String[pos - 1]) != -1)
+ pos--;
+
+ if (pos < m_pData->m_nDataLength) {
+ ReallocBeforeWrite(m_pData->m_nDataLength);
+ m_pData->m_String[pos] = 0;
+ m_pData->m_nDataLength = pos;
+ }
+}
+
+void CFX_WideString::TrimRight(wchar_t chTarget) {
+ wchar_t str[2] = {chTarget, 0};
+ TrimRight(str);
+}
+
+void CFX_WideString::TrimRight() {
+ TrimRight(L"\x09\x0a\x0b\x0c\x0d\x20");
+}
+
+void CFX_WideString::TrimLeft(const CFX_WideStringC& pTargets) {
+ if (!m_pData || pTargets.IsEmpty())
+ return;
+
+ FX_STRSIZE len = GetLength();
+ if (len < 1)
+ return;
+
+ FX_STRSIZE pos = 0;
+ while (pos < len) {
+ FX_STRSIZE i = 0;
+ while (i < pTargets.GetLength() &&
+ pTargets.CharAt(i) != m_pData->m_String[pos]) {
+ i++;
+ }
+ if (i == pTargets.GetLength()) {
+ break;
+ }
+ pos++;
+ }
+ if (pos) {
+ ReallocBeforeWrite(len);
+ FX_STRSIZE nDataLength = len - pos;
+ memmove(m_pData->m_String, m_pData->m_String + pos,
+ (nDataLength + 1) * sizeof(wchar_t));
+ m_pData->m_nDataLength = nDataLength;
+ }
+}
+
+void CFX_WideString::TrimLeft(wchar_t chTarget) {
+ wchar_t str[2] = {chTarget, 0};
+ TrimLeft(str);
+}
+
+void CFX_WideString::TrimLeft() {
+ TrimLeft(L"\x09\x0a\x0b\x0c\x0d\x20");
+}
+float FX_wtof(const wchar_t* str, int len) {
+ if (len == 0) {
+ return 0.0;
+ }
+ int cc = 0;
+ bool bNegative = false;
+ if (str[0] == '+') {
+ cc++;
+ } else if (str[0] == '-') {
+ bNegative = true;
+ cc++;
+ }
+ int integer = 0;
+ while (cc < len) {
+ if (str[cc] == '.') {
+ break;
+ }
+ integer = integer * 10 + FXSYS_toDecimalDigit(str[cc]);
+ cc++;
+ }
+ float fraction = 0;
+ if (str[cc] == '.') {
+ cc++;
+ float scale = 0.1f;
+ while (cc < len) {
+ fraction += scale * FXSYS_toDecimalDigit(str[cc]);
+ scale *= 0.1f;
+ cc++;
+ }
+ }
+ fraction += (float)integer;
+ return bNegative ? -fraction : fraction;
+}
+
+int CFX_WideString::GetInteger() const {
+ return m_pData ? FXSYS_wtoi(m_pData->m_String) : 0;
+}
+
+float CFX_WideString::GetFloat() const {
+ return m_pData ? FX_wtof(m_pData->m_String, m_pData->m_nDataLength) : 0.0f;
+}
+
+// static
+CFX_ByteString CFX_CharMap::GetByteString(uint16_t codepage,
+ const CFX_WideStringC& wstr) {
+ ASSERT(IsValidCodePage(codepage));
+ int src_len = wstr.GetLength();
+ int dest_len = FXSYS_WideCharToMultiByte(codepage, 0, wstr.c_str(), src_len,
+ nullptr, 0, nullptr, nullptr);
+ CFX_ByteString bstr;
+ if (dest_len) {
+ char* dest_buf = bstr.GetBuffer(dest_len);
+ FXSYS_WideCharToMultiByte(codepage, 0, wstr.c_str(), src_len, dest_buf,
+ dest_len, nullptr, nullptr);
+ bstr.ReleaseBuffer(dest_len);
+ }
+ return bstr;
+}
+
+// static
+CFX_WideString CFX_CharMap::GetWideString(uint16_t codepage,
+ const CFX_ByteStringC& bstr) {
+ ASSERT(IsValidCodePage(codepage));
+ int src_len = bstr.GetLength();
+ int dest_len =
+ FXSYS_MultiByteToWideChar(codepage, 0, bstr.c_str(), src_len, nullptr, 0);
+ CFX_WideString wstr;
+ if (dest_len) {
+ wchar_t* dest_buf = wstr.GetBuffer(dest_len);
+ FXSYS_MultiByteToWideChar(codepage, 0, bstr.c_str(), src_len, dest_buf,
+ dest_len);
+ wstr.ReleaseBuffer(dest_len);
+ }
+ return wstr;
+}
diff --git a/chromium/third_party/pdfium/core/fxcrt/cfx_widestring.h b/chromium/third_party/pdfium/core/fxcrt/cfx_widestring.h
new file mode 100644
index 00000000000..52cd65a2b7a
--- /dev/null
+++ b/chromium/third_party/pdfium/core/fxcrt/cfx_widestring.h
@@ -0,0 +1,233 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef CORE_FXCRT_CFX_WIDESTRING_H_
+#define CORE_FXCRT_CFX_WIDESTRING_H_
+
+#include <functional>
+#include <utility>
+
+#include "core/fxcrt/cfx_retain_ptr.h"
+#include "core/fxcrt/cfx_string_c_template.h"
+#include "core/fxcrt/cfx_string_data_template.h"
+#include "core/fxcrt/fx_memory.h"
+#include "core/fxcrt/fx_system.h"
+
+class CFX_ByteString;
+
+// A mutable string with shared buffers using copy-on-write semantics that
+// avoids the cost of std::string's iterator stability guarantees.
+class CFX_WideString {
+ public:
+ using CharType = wchar_t;
+
+ CFX_WideString();
+ CFX_WideString(const CFX_WideString& other);
+ CFX_WideString(CFX_WideString&& other) noexcept;
+
+ // Deliberately implicit to avoid calling on every string literal.
+ // NOLINTNEXTLINE(runtime/explicit)
+ CFX_WideString(wchar_t ch);
+ // NOLINTNEXTLINE(runtime/explicit)
+ CFX_WideString(const wchar_t* ptr);
+
+ CFX_WideString(const wchar_t* ptr, FX_STRSIZE len);
+
+ explicit CFX_WideString(const CFX_WideStringC& str);
+ CFX_WideString(const CFX_WideStringC& str1, const CFX_WideStringC& str2);
+ CFX_WideString(const std::initializer_list<CFX_WideStringC>& list);
+
+ ~CFX_WideString();
+
+ static CFX_WideString FromLocal(const CFX_ByteStringC& str);
+ static CFX_WideString FromCodePage(const CFX_ByteStringC& str,
+ uint16_t codepage);
+
+ static CFX_WideString FromUTF8(const CFX_ByteStringC& str);
+ static CFX_WideString FromUTF16LE(const unsigned short* str, FX_STRSIZE len);
+
+ static FX_STRSIZE WStringLength(const unsigned short* str);
+
+ // Explicit conversion to C-style wide string.
+ // Note: Any subsequent modification of |this| will invalidate the result.
+ const wchar_t* c_str() const { return m_pData ? m_pData->m_String : L""; }
+
+ // Explicit conversion to CFX_WideStringC.
+ // Note: Any subsequent modification of |this| will invalidate the result.
+ CFX_WideStringC AsStringC() const {
+ return CFX_WideStringC(c_str(), GetLength());
+ }
+
+ void clear() { m_pData.Reset(); }
+
+ FX_STRSIZE GetLength() const { return m_pData ? m_pData->m_nDataLength : 0; }
+ bool IsEmpty() const { return !GetLength(); }
+
+ const CFX_WideString& operator=(const wchar_t* str);
+ const CFX_WideString& operator=(const CFX_WideString& stringSrc);
+ const CFX_WideString& operator=(const CFX_WideStringC& stringSrc);
+
+ const CFX_WideString& operator+=(const wchar_t* str);
+ const CFX_WideString& operator+=(wchar_t ch);
+ const CFX_WideString& operator+=(const CFX_WideString& str);
+ const CFX_WideString& operator+=(const CFX_WideStringC& str);
+
+ bool operator==(const wchar_t* ptr) const;
+ bool operator==(const CFX_WideStringC& str) const;
+ bool operator==(const CFX_WideString& other) const;
+
+ bool operator!=(const wchar_t* ptr) const { return !(*this == ptr); }
+ bool operator!=(const CFX_WideStringC& str) const { return !(*this == str); }
+ bool operator!=(const CFX_WideString& other) const {
+ return !(*this == other);
+ }
+
+ bool operator<(const CFX_WideString& str) const;
+
+ wchar_t GetAt(FX_STRSIZE nIndex) const {
+ return m_pData ? m_pData->m_String[nIndex] : 0;
+ }
+
+ wchar_t operator[](FX_STRSIZE nIndex) const {
+ return m_pData ? m_pData->m_String[nIndex] : 0;
+ }
+
+ void SetAt(FX_STRSIZE nIndex, wchar_t ch);
+
+ int Compare(const wchar_t* str) const;
+ int Compare(const CFX_WideString& str) const;
+ int CompareNoCase(const wchar_t* str) const;
+
+ CFX_WideString Mid(FX_STRSIZE first) const;
+ CFX_WideString Mid(FX_STRSIZE first, FX_STRSIZE count) const;
+ CFX_WideString Left(FX_STRSIZE count) const;
+ CFX_WideString Right(FX_STRSIZE count) const;
+
+ FX_STRSIZE Insert(FX_STRSIZE index, wchar_t ch);
+ FX_STRSIZE Delete(FX_STRSIZE index, FX_STRSIZE count = 1);
+
+ void Format(const wchar_t* lpszFormat, ...);
+ void FormatV(const wchar_t* lpszFormat, va_list argList);
+
+ void MakeLower();
+ void MakeUpper();
+
+ void TrimRight();
+ void TrimRight(wchar_t chTarget);
+ void TrimRight(const CFX_WideStringC& pTargets);
+
+ void TrimLeft();
+ void TrimLeft(wchar_t chTarget);
+ void TrimLeft(const CFX_WideStringC& pTargets);
+
+ void Reserve(FX_STRSIZE len);
+ wchar_t* GetBuffer(FX_STRSIZE len);
+ void ReleaseBuffer(FX_STRSIZE len = -1);
+
+ int GetInteger() const;
+ float GetFloat() const;
+
+ FX_STRSIZE Find(const CFX_WideStringC& pSub, FX_STRSIZE start = 0) const;
+ FX_STRSIZE Find(wchar_t ch, FX_STRSIZE start = 0) const;
+ FX_STRSIZE Replace(const CFX_WideStringC& pOld, const CFX_WideStringC& pNew);
+ FX_STRSIZE Remove(wchar_t ch);
+
+ CFX_ByteString UTF8Encode() const;
+ CFX_ByteString UTF16LE_Encode() const;
+
+ protected:
+ using StringData = CFX_StringDataTemplate<wchar_t>;
+
+ void ReallocBeforeWrite(FX_STRSIZE nLen);
+ void AllocBeforeWrite(FX_STRSIZE nLen);
+ void AllocCopy(CFX_WideString& dest,
+ FX_STRSIZE nCopyLen,
+ FX_STRSIZE nCopyIndex) const;
+ void AssignCopy(const wchar_t* pSrcData, FX_STRSIZE nSrcLen);
+ void Concat(const wchar_t* lpszSrcData, FX_STRSIZE nSrcLen);
+
+ // Returns true unless we ran out of space.
+ bool TryVSWPrintf(FX_STRSIZE size, const wchar_t* format, va_list argList);
+
+ CFX_RetainPtr<StringData> m_pData;
+
+ friend class fxcrt_WideStringConcatInPlace_Test;
+ friend class fxcrt_WideStringPool_Test;
+};
+
+inline CFX_WideString operator+(const CFX_WideStringC& str1,
+ const CFX_WideStringC& str2) {
+ return CFX_WideString(str1, str2);
+}
+inline CFX_WideString operator+(const CFX_WideStringC& str1,
+ const wchar_t* str2) {
+ return CFX_WideString(str1, str2);
+}
+inline CFX_WideString operator+(const wchar_t* str1,
+ const CFX_WideStringC& str2) {
+ return CFX_WideString(str1, str2);
+}
+inline CFX_WideString operator+(const CFX_WideStringC& str1, wchar_t ch) {
+ return CFX_WideString(str1, CFX_WideStringC(ch));
+}
+inline CFX_WideString operator+(wchar_t ch, const CFX_WideStringC& str2) {
+ return CFX_WideString(ch, str2);
+}
+inline CFX_WideString operator+(const CFX_WideString& str1,
+ const CFX_WideString& str2) {
+ return CFX_WideString(str1.AsStringC(), str2.AsStringC());
+}
+inline CFX_WideString operator+(const CFX_WideString& str1, wchar_t ch) {
+ return CFX_WideString(str1.AsStringC(), CFX_WideStringC(ch));
+}
+inline CFX_WideString operator+(wchar_t ch, const CFX_WideString& str2) {
+ return CFX_WideString(ch, str2.AsStringC());
+}
+inline CFX_WideString operator+(const CFX_WideString& str1,
+ const wchar_t* str2) {
+ return CFX_WideString(str1.AsStringC(), str2);
+}
+inline CFX_WideString operator+(const wchar_t* str1,
+ const CFX_WideString& str2) {
+ return CFX_WideString(str1, str2.AsStringC());
+}
+inline CFX_WideString operator+(const CFX_WideString& str1,
+ const CFX_WideStringC& str2) {
+ return CFX_WideString(str1.AsStringC(), str2);
+}
+inline CFX_WideString operator+(const CFX_WideStringC& str1,
+ const CFX_WideString& str2) {
+ return CFX_WideString(str1, str2.AsStringC());
+}
+inline bool operator==(const wchar_t* lhs, const CFX_WideString& rhs) {
+ return rhs == lhs;
+}
+inline bool operator==(const CFX_WideStringC& lhs, const CFX_WideString& rhs) {
+ return rhs == lhs;
+}
+inline bool operator!=(const wchar_t* lhs, const CFX_WideString& rhs) {
+ return rhs != lhs;
+}
+inline bool operator!=(const CFX_WideStringC& lhs, const CFX_WideString& rhs) {
+ return rhs != lhs;
+}
+
+uint32_t FX_HashCode_GetW(const CFX_WideStringC& str, bool bIgnoreCase);
+
+namespace std {
+
+template <>
+struct hash<CFX_WideString> {
+ std::size_t operator()(const CFX_WideString& str) const {
+ return FX_HashCode_GetW(str.AsStringC(), false);
+ }
+};
+
+} // namespace std
+
+extern template struct std::hash<CFX_WideString>;
+
+#endif // CORE_FXCRT_CFX_WIDESTRING_H_
diff --git a/chromium/third_party/pdfium/core/fxcrt/cfx_widestring_unittest.cpp b/chromium/third_party/pdfium/core/fxcrt/cfx_widestring_unittest.cpp
new file mode 100644
index 00000000000..dd44cb70af5
--- /dev/null
+++ b/chromium/third_party/pdfium/core/fxcrt/cfx_widestring_unittest.cpp
@@ -0,0 +1,954 @@
+// 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.
+
+#include "core/fxcrt/cfx_widestring.h"
+
+#include "testing/fx_string_testhelpers.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+TEST(fxcrt, WideStringOperatorSubscript) {
+ // CFX_WideString includes the NUL terminator for non-empty strings.
+ CFX_WideString abc(L"abc");
+ EXPECT_EQ(L'a', abc[0]);
+ EXPECT_EQ(L'b', abc[1]);
+ EXPECT_EQ(L'c', abc[2]);
+ EXPECT_EQ(L'\0', abc[3]);
+}
+
+TEST(fxcrt, WideStringOperatorLT) {
+ CFX_WideString empty;
+ CFX_WideString a(L"a");
+ CFX_WideString abc(L"\x0110qq"); // Comes before despite endianness.
+ CFX_WideString def(L"\x1001qq"); // Comes after despite endianness.
+
+ EXPECT_FALSE(empty < empty);
+ EXPECT_FALSE(a < a);
+ EXPECT_FALSE(abc < abc);
+ EXPECT_FALSE(def < def);
+
+ EXPECT_TRUE(empty < a);
+ EXPECT_FALSE(a < empty);
+
+ EXPECT_TRUE(empty < abc);
+ EXPECT_FALSE(abc < empty);
+
+ EXPECT_TRUE(empty < def);
+ EXPECT_FALSE(def < empty);
+
+ EXPECT_TRUE(a < abc);
+ EXPECT_FALSE(abc < a);
+
+ EXPECT_TRUE(a < def);
+ EXPECT_FALSE(def < a);
+
+ EXPECT_TRUE(abc < def);
+ EXPECT_FALSE(def < abc);
+}
+
+TEST(fxcrt, WideStringOperatorEQ) {
+ CFX_WideString null_string;
+ EXPECT_TRUE(null_string == null_string);
+
+ CFX_WideString empty_string(L"");
+ EXPECT_TRUE(empty_string == empty_string);
+ EXPECT_TRUE(empty_string == null_string);
+ EXPECT_TRUE(null_string == empty_string);
+
+ CFX_WideString deleted_string(L"hello");
+ deleted_string.Delete(0, 5);
+ EXPECT_TRUE(deleted_string == deleted_string);
+ EXPECT_TRUE(deleted_string == null_string);
+ EXPECT_TRUE(deleted_string == empty_string);
+ EXPECT_TRUE(null_string == deleted_string);
+ EXPECT_TRUE(null_string == empty_string);
+
+ CFX_WideString wide_string(L"hello");
+ EXPECT_TRUE(wide_string == wide_string);
+ EXPECT_FALSE(wide_string == null_string);
+ EXPECT_FALSE(wide_string == empty_string);
+ EXPECT_FALSE(wide_string == deleted_string);
+ EXPECT_FALSE(null_string == wide_string);
+ EXPECT_FALSE(empty_string == wide_string);
+ EXPECT_FALSE(deleted_string == wide_string);
+
+ CFX_WideString wide_string_same1(L"hello");
+ EXPECT_TRUE(wide_string == wide_string_same1);
+ EXPECT_TRUE(wide_string_same1 == wide_string);
+
+ CFX_WideString wide_string_same2(wide_string);
+ EXPECT_TRUE(wide_string == wide_string_same2);
+ EXPECT_TRUE(wide_string_same2 == wide_string);
+
+ CFX_WideString wide_string1(L"he");
+ CFX_WideString wide_string2(L"hellp");
+ CFX_WideString wide_string3(L"hellod");
+ EXPECT_FALSE(wide_string == wide_string1);
+ EXPECT_FALSE(wide_string == wide_string2);
+ EXPECT_FALSE(wide_string == wide_string3);
+ EXPECT_FALSE(wide_string1 == wide_string);
+ EXPECT_FALSE(wide_string2 == wide_string);
+ EXPECT_FALSE(wide_string3 == wide_string);
+
+ CFX_WideStringC null_string_c;
+ CFX_WideStringC empty_string_c(L"");
+ EXPECT_TRUE(null_string == null_string_c);
+ EXPECT_TRUE(null_string == empty_string_c);
+ EXPECT_TRUE(empty_string == null_string_c);
+ EXPECT_TRUE(empty_string == empty_string_c);
+ EXPECT_TRUE(deleted_string == null_string_c);
+ EXPECT_TRUE(deleted_string == empty_string_c);
+ EXPECT_TRUE(null_string_c == null_string);
+ EXPECT_TRUE(empty_string_c == null_string);
+ EXPECT_TRUE(null_string_c == empty_string);
+ EXPECT_TRUE(empty_string_c == empty_string);
+ EXPECT_TRUE(null_string_c == deleted_string);
+ EXPECT_TRUE(empty_string_c == deleted_string);
+
+ CFX_WideStringC wide_string_c_same1(L"hello");
+ EXPECT_TRUE(wide_string == wide_string_c_same1);
+ EXPECT_TRUE(wide_string_c_same1 == wide_string);
+
+ CFX_WideStringC wide_string_c1(L"he");
+ CFX_WideStringC wide_string_c2(L"hellp");
+ CFX_WideStringC wide_string_c3(L"hellod");
+ EXPECT_FALSE(wide_string == wide_string_c1);
+ EXPECT_FALSE(wide_string == wide_string_c2);
+ EXPECT_FALSE(wide_string == wide_string_c3);
+ EXPECT_FALSE(wide_string_c1 == wide_string);
+ EXPECT_FALSE(wide_string_c2 == wide_string);
+ EXPECT_FALSE(wide_string_c3 == wide_string);
+
+ const wchar_t* c_null_string = nullptr;
+ const wchar_t* c_empty_string = L"";
+ EXPECT_TRUE(null_string == c_null_string);
+ EXPECT_TRUE(null_string == c_empty_string);
+ EXPECT_TRUE(empty_string == c_null_string);
+ EXPECT_TRUE(empty_string == c_empty_string);
+ EXPECT_TRUE(deleted_string == c_null_string);
+ EXPECT_TRUE(deleted_string == c_empty_string);
+ EXPECT_TRUE(c_null_string == null_string);
+ EXPECT_TRUE(c_empty_string == null_string);
+ EXPECT_TRUE(c_null_string == empty_string);
+ EXPECT_TRUE(c_empty_string == empty_string);
+ EXPECT_TRUE(c_null_string == deleted_string);
+ EXPECT_TRUE(c_empty_string == deleted_string);
+
+ const wchar_t* c_string_same1 = L"hello";
+ EXPECT_TRUE(wide_string == c_string_same1);
+ EXPECT_TRUE(c_string_same1 == wide_string);
+
+ const wchar_t* c_string1 = L"he";
+ const wchar_t* c_string2 = L"hellp";
+ const wchar_t* c_string3 = L"hellod";
+ EXPECT_FALSE(wide_string == c_string1);
+ EXPECT_FALSE(wide_string == c_string2);
+ EXPECT_FALSE(wide_string == c_string3);
+ EXPECT_FALSE(c_string1 == wide_string);
+ EXPECT_FALSE(c_string2 == wide_string);
+ EXPECT_FALSE(c_string3 == wide_string);
+}
+
+TEST(fxcrt, WideStringOperatorNE) {
+ CFX_WideString null_string;
+ EXPECT_FALSE(null_string != null_string);
+
+ CFX_WideString empty_string(L"");
+ EXPECT_FALSE(empty_string != empty_string);
+ EXPECT_FALSE(empty_string != null_string);
+ EXPECT_FALSE(null_string != empty_string);
+
+ CFX_WideString deleted_string(L"hello");
+ deleted_string.Delete(0, 5);
+ EXPECT_FALSE(deleted_string != deleted_string);
+ EXPECT_FALSE(deleted_string != null_string);
+ EXPECT_FALSE(deleted_string != empty_string);
+ EXPECT_FALSE(null_string != deleted_string);
+ EXPECT_FALSE(null_string != empty_string);
+
+ CFX_WideString wide_string(L"hello");
+ EXPECT_FALSE(wide_string != wide_string);
+ EXPECT_TRUE(wide_string != null_string);
+ EXPECT_TRUE(wide_string != empty_string);
+ EXPECT_TRUE(wide_string != deleted_string);
+ EXPECT_TRUE(null_string != wide_string);
+ EXPECT_TRUE(empty_string != wide_string);
+ EXPECT_TRUE(deleted_string != wide_string);
+
+ CFX_WideString wide_string_same1(L"hello");
+ EXPECT_FALSE(wide_string != wide_string_same1);
+ EXPECT_FALSE(wide_string_same1 != wide_string);
+
+ CFX_WideString wide_string_same2(wide_string);
+ EXPECT_FALSE(wide_string != wide_string_same2);
+ EXPECT_FALSE(wide_string_same2 != wide_string);
+
+ CFX_WideString wide_string1(L"he");
+ CFX_WideString wide_string2(L"hellp");
+ CFX_WideString wide_string3(L"hellod");
+ EXPECT_TRUE(wide_string != wide_string1);
+ EXPECT_TRUE(wide_string != wide_string2);
+ EXPECT_TRUE(wide_string != wide_string3);
+ EXPECT_TRUE(wide_string1 != wide_string);
+ EXPECT_TRUE(wide_string2 != wide_string);
+ EXPECT_TRUE(wide_string3 != wide_string);
+
+ CFX_WideStringC null_string_c;
+ CFX_WideStringC empty_string_c(L"");
+ EXPECT_FALSE(null_string != null_string_c);
+ EXPECT_FALSE(null_string != empty_string_c);
+ EXPECT_FALSE(empty_string != null_string_c);
+ EXPECT_FALSE(empty_string != empty_string_c);
+ EXPECT_FALSE(deleted_string != null_string_c);
+ EXPECT_FALSE(deleted_string != empty_string_c);
+ EXPECT_FALSE(null_string_c != null_string);
+ EXPECT_FALSE(empty_string_c != null_string);
+ EXPECT_FALSE(null_string_c != empty_string);
+ EXPECT_FALSE(empty_string_c != empty_string);
+
+ CFX_WideStringC wide_string_c_same1(L"hello");
+ EXPECT_FALSE(wide_string != wide_string_c_same1);
+ EXPECT_FALSE(wide_string_c_same1 != wide_string);
+
+ CFX_WideStringC wide_string_c1(L"he");
+ CFX_WideStringC wide_string_c2(L"hellp");
+ CFX_WideStringC wide_string_c3(L"hellod");
+ EXPECT_TRUE(wide_string != wide_string_c1);
+ EXPECT_TRUE(wide_string != wide_string_c2);
+ EXPECT_TRUE(wide_string != wide_string_c3);
+ EXPECT_TRUE(wide_string_c1 != wide_string);
+ EXPECT_TRUE(wide_string_c2 != wide_string);
+ EXPECT_TRUE(wide_string_c3 != wide_string);
+
+ const wchar_t* c_null_string = nullptr;
+ const wchar_t* c_empty_string = L"";
+ EXPECT_FALSE(null_string != c_null_string);
+ EXPECT_FALSE(null_string != c_empty_string);
+ EXPECT_FALSE(empty_string != c_null_string);
+ EXPECT_FALSE(empty_string != c_empty_string);
+ EXPECT_FALSE(deleted_string != c_null_string);
+ EXPECT_FALSE(deleted_string != c_empty_string);
+ EXPECT_FALSE(c_null_string != null_string);
+ EXPECT_FALSE(c_empty_string != null_string);
+ EXPECT_FALSE(c_null_string != empty_string);
+ EXPECT_FALSE(c_empty_string != empty_string);
+ EXPECT_FALSE(c_null_string != deleted_string);
+ EXPECT_FALSE(c_empty_string != deleted_string);
+
+ const wchar_t* c_string_same1 = L"hello";
+ EXPECT_FALSE(wide_string != c_string_same1);
+ EXPECT_FALSE(c_string_same1 != wide_string);
+
+ const wchar_t* c_string1 = L"he";
+ const wchar_t* c_string2 = L"hellp";
+ const wchar_t* c_string3 = L"hellod";
+ EXPECT_TRUE(wide_string != c_string1);
+ EXPECT_TRUE(wide_string != c_string2);
+ EXPECT_TRUE(wide_string != c_string3);
+ EXPECT_TRUE(c_string1 != wide_string);
+ EXPECT_TRUE(c_string2 != wide_string);
+ EXPECT_TRUE(c_string3 != wide_string);
+}
+
+TEST(fxcrt, WideStringConcatInPlace) {
+ CFX_WideString fred;
+ fred.Concat(L"FRED", 4);
+ EXPECT_EQ(L"FRED", fred);
+
+ fred.Concat(L"DY", 2);
+ EXPECT_EQ(L"FREDDY", fred);
+
+ fred.Delete(3, 3);
+ EXPECT_EQ(L"FRE", fred);
+
+ fred.Concat(L"D", 1);
+ EXPECT_EQ(L"FRED", fred);
+
+ CFX_WideString copy = fred;
+ fred.Concat(L"DY", 2);
+ EXPECT_EQ(L"FREDDY", fred);
+ EXPECT_EQ(L"FRED", copy);
+
+ // Test invalid arguments.
+ copy = fred;
+ fred.Concat(L"freddy", -6);
+ CFX_WideString not_aliased(L"xxxxxx");
+ EXPECT_EQ(L"FREDDY", fred);
+ EXPECT_EQ(L"xxxxxx", not_aliased);
+}
+
+TEST(fxcrt, WideStringRemove) {
+ CFX_WideString freed(L"FREED");
+ freed.Remove(L'E');
+ EXPECT_EQ(L"FRD", freed);
+ freed.Remove(L'F');
+ EXPECT_EQ(L"RD", freed);
+ freed.Remove(L'D');
+ EXPECT_EQ(L"R", freed);
+ freed.Remove(L'X');
+ EXPECT_EQ(L"R", freed);
+ freed.Remove(L'R');
+ EXPECT_EQ(L"", freed);
+
+ CFX_WideString empty;
+ empty.Remove(L'X');
+ EXPECT_EQ(L"", empty);
+}
+
+TEST(fxcrt, WideStringRemoveCopies) {
+ CFX_WideString freed(L"FREED");
+ const wchar_t* old_buffer = freed.c_str();
+
+ // No change with single reference - no copy.
+ freed.Remove(L'Q');
+ EXPECT_EQ(L"FREED", freed);
+ EXPECT_EQ(old_buffer, freed.c_str());
+
+ // Change with single reference - no copy.
+ freed.Remove(L'E');
+ EXPECT_EQ(L"FRD", freed);
+ EXPECT_EQ(old_buffer, freed.c_str());
+
+ // No change with multiple references - no copy.
+ CFX_WideString shared(freed);
+ freed.Remove(L'Q');
+ EXPECT_EQ(L"FRD", freed);
+ EXPECT_EQ(old_buffer, freed.c_str());
+ EXPECT_EQ(old_buffer, shared.c_str());
+
+ // Change with multiple references -- must copy.
+ freed.Remove(L'D');
+ EXPECT_EQ(L"FR", freed);
+ EXPECT_NE(old_buffer, freed.c_str());
+ EXPECT_EQ(L"FRD", shared);
+ EXPECT_EQ(old_buffer, shared.c_str());
+}
+
+TEST(fxcrt, WideStringReplace) {
+ CFX_WideString fred(L"FRED");
+ fred.Replace(L"FR", L"BL");
+ EXPECT_EQ(L"BLED", fred);
+ fred.Replace(L"D", L"DDY");
+ EXPECT_EQ(L"BLEDDY", fred);
+ fred.Replace(L"LEDD", L"");
+ EXPECT_EQ(L"BY", fred);
+ fred.Replace(L"X", L"CLAMS");
+ EXPECT_EQ(L"BY", fred);
+ fred.Replace(L"BY", L"HI");
+ EXPECT_EQ(L"HI", fred);
+ fred.Replace(L"", L"CLAMS");
+ EXPECT_EQ(L"HI", fred);
+ fred.Replace(L"HI", L"");
+ EXPECT_EQ(L"", fred);
+}
+
+TEST(fxcrt, WideStringInsert) {
+ CFX_WideString fred(L"FRED");
+ fred.Insert(-1, 'X');
+ EXPECT_EQ(L"XFRED", fred);
+
+ fred.Insert(0, 'S');
+ EXPECT_EQ(L"SXFRED", fred);
+
+ fred.Insert(2, 'T');
+ EXPECT_EQ(L"SXTFRED", fred);
+
+ fred.Insert(5, 'U');
+ EXPECT_EQ(L"SXTFRUED", fred);
+
+ fred.Insert(8, 'V');
+ EXPECT_EQ(L"SXTFRUEDV", fred);
+
+ fred.Insert(12, 'P');
+ EXPECT_EQ(L"SXTFRUEDVP", fred);
+
+ {
+ CFX_WideString empty;
+ empty.Insert(-1, 'X');
+ EXPECT_EQ(L"X", empty);
+ }
+ {
+ CFX_WideString empty;
+ empty.Insert(0, 'X');
+ EXPECT_EQ(L"X", empty);
+ }
+ {
+ CFX_WideString empty;
+ empty.Insert(5, 'X');
+ EXPECT_EQ(L"X", empty);
+ }
+}
+
+TEST(fxcrt, WideStringDelete) {
+ CFX_WideString fred(L"FRED");
+ fred.Delete(0, 2);
+ EXPECT_EQ(L"ED", fred);
+ fred.Delete(1);
+ EXPECT_EQ(L"E", fred);
+ fred.Delete(-1);
+ EXPECT_EQ(L"", fred);
+ fred.Delete(1);
+ EXPECT_EQ(L"", fred);
+
+ CFX_WideString empty;
+ empty.Delete(0);
+ EXPECT_EQ(L"", empty);
+ empty.Delete(-1);
+ EXPECT_EQ(L"", empty);
+ empty.Delete(1);
+ EXPECT_EQ(L"", empty);
+}
+
+TEST(fxcrt, WideStringMid) {
+ CFX_WideString fred(L"FRED");
+ EXPECT_EQ(L"", fred.Mid(0, 0));
+ EXPECT_EQ(L"", fred.Mid(3, 0));
+ EXPECT_EQ(L"FRED", fred.Mid(0));
+ EXPECT_EQ(L"RED", fred.Mid(1));
+ EXPECT_EQ(L"ED", fred.Mid(2));
+ EXPECT_EQ(L"D", fred.Mid(3));
+ EXPECT_EQ(L"F", fred.Mid(0, 1));
+ EXPECT_EQ(L"R", fred.Mid(1, 1));
+ EXPECT_EQ(L"E", fred.Mid(2, 1));
+ EXPECT_EQ(L"D", fred.Mid(3, 1));
+ EXPECT_EQ(L"FR", fred.Mid(0, 2));
+ EXPECT_EQ(L"FRED", fred.Mid(0, 4));
+ EXPECT_EQ(L"FRED", fred.Mid(0, 10));
+
+ EXPECT_EQ(L"FR", fred.Mid(-1, 2));
+ EXPECT_EQ(L"RED", fred.Mid(1, 4));
+ EXPECT_EQ(L"", fred.Mid(4, 1));
+
+ CFX_WideString empty;
+ EXPECT_EQ(L"", empty.Mid(0, 0));
+ EXPECT_EQ(L"", empty.Mid(0));
+ EXPECT_EQ(L"", empty.Mid(1));
+ EXPECT_EQ(L"", empty.Mid(-1));
+}
+
+TEST(fxcrt, WideStringLeft) {
+ CFX_WideString fred(L"FRED");
+ EXPECT_EQ(L"", fred.Left(0));
+ EXPECT_EQ(L"F", fred.Left(1));
+ EXPECT_EQ(L"FR", fred.Left(2));
+ EXPECT_EQ(L"FRE", fred.Left(3));
+ EXPECT_EQ(L"FRED", fred.Left(4));
+
+ EXPECT_EQ(L"FRED", fred.Left(5));
+ EXPECT_EQ(L"", fred.Left(-1));
+
+ CFX_WideString empty;
+ EXPECT_EQ(L"", empty.Left(0));
+ EXPECT_EQ(L"", empty.Left(1));
+ EXPECT_EQ(L"", empty.Left(-1));
+}
+
+TEST(fxcrt, WideStringRight) {
+ CFX_WideString fred(L"FRED");
+ EXPECT_EQ(L"", fred.Right(0));
+ EXPECT_EQ(L"D", fred.Right(1));
+ EXPECT_EQ(L"ED", fred.Right(2));
+ EXPECT_EQ(L"RED", fred.Right(3));
+ EXPECT_EQ(L"FRED", fred.Right(4));
+
+ EXPECT_EQ(L"FRED", fred.Right(5));
+ EXPECT_EQ(L"", fred.Right(-1));
+
+ CFX_WideString empty;
+ EXPECT_EQ(L"", empty.Right(0));
+ EXPECT_EQ(L"", empty.Right(1));
+ EXPECT_EQ(L"", empty.Right(-1));
+}
+
+TEST(fxcrt, WideStringUpperLower) {
+ CFX_WideString fred(L"F-Re.42D");
+ fred.MakeLower();
+ EXPECT_EQ(L"f-re.42d", fred);
+ fred.MakeUpper();
+ EXPECT_EQ(L"F-RE.42D", fred);
+
+ CFX_WideString empty;
+ empty.MakeLower();
+ EXPECT_EQ(L"", empty);
+ empty.MakeUpper();
+ EXPECT_EQ(L"", empty);
+}
+
+TEST(fxcrt, WideStringTrimRight) {
+ CFX_WideString fred(L" FRED ");
+ fred.TrimRight();
+ EXPECT_EQ(L" FRED", fred);
+ fred.TrimRight(L'E');
+ EXPECT_EQ(L" FRED", fred);
+ fred.TrimRight(L'D');
+ EXPECT_EQ(L" FRE", fred);
+ fred.TrimRight(L"ERP");
+ EXPECT_EQ(L" F", fred);
+
+ CFX_WideString blank(L" ");
+ blank.TrimRight(L"ERP");
+ EXPECT_EQ(L" ", blank);
+ blank.TrimRight(L'E');
+ EXPECT_EQ(L" ", blank);
+ blank.TrimRight();
+ EXPECT_EQ(L"", blank);
+
+ CFX_WideString empty;
+ empty.TrimRight(L"ERP");
+ EXPECT_EQ(L"", empty);
+ empty.TrimRight(L'E');
+ EXPECT_EQ(L"", empty);
+ empty.TrimRight();
+ EXPECT_EQ(L"", empty);
+}
+
+TEST(fxcrt, WideStringTrimRightCopies) {
+ {
+ // With a single reference, no copy takes place.
+ CFX_WideString fred(L" FRED ");
+ const wchar_t* old_buffer = fred.c_str();
+ fred.TrimRight();
+ EXPECT_EQ(L" FRED", fred);
+ EXPECT_EQ(old_buffer, fred.c_str());
+ }
+ {
+ // With multiple references, we must copy.
+ CFX_WideString fred(L" FRED ");
+ CFX_WideString other_fred = fred;
+ const wchar_t* old_buffer = fred.c_str();
+ fred.TrimRight();
+ EXPECT_EQ(L" FRED", fred);
+ EXPECT_EQ(L" FRED ", other_fred);
+ EXPECT_NE(old_buffer, fred.c_str());
+ }
+ {
+ // With multiple references, but no modifications, no copy.
+ CFX_WideString fred(L"FRED");
+ CFX_WideString other_fred = fred;
+ const wchar_t* old_buffer = fred.c_str();
+ fred.TrimRight();
+ EXPECT_EQ(L"FRED", fred);
+ EXPECT_EQ(L"FRED", other_fred);
+ EXPECT_EQ(old_buffer, fred.c_str());
+ }
+}
+
+TEST(fxcrt, WideStringTrimLeft) {
+ CFX_WideString fred(L" FRED ");
+ fred.TrimLeft();
+ EXPECT_EQ(L"FRED ", fred);
+ fred.TrimLeft(L'E');
+ EXPECT_EQ(L"FRED ", fred);
+ fred.TrimLeft(L'F');
+ EXPECT_EQ(L"RED ", fred);
+ fred.TrimLeft(L"ERP");
+ EXPECT_EQ(L"D ", fred);
+
+ CFX_WideString blank(L" ");
+ blank.TrimLeft(L"ERP");
+ EXPECT_EQ(L" ", blank);
+ blank.TrimLeft(L'E');
+ EXPECT_EQ(L" ", blank);
+ blank.TrimLeft();
+ EXPECT_EQ(L"", blank);
+
+ CFX_WideString empty;
+ empty.TrimLeft(L"ERP");
+ EXPECT_EQ(L"", empty);
+ empty.TrimLeft(L'E');
+ EXPECT_EQ(L"", empty);
+ empty.TrimLeft();
+ EXPECT_EQ(L"", empty);
+}
+
+TEST(fxcrt, WideStringTrimLeftCopies) {
+ {
+ // With a single reference, no copy takes place.
+ CFX_WideString fred(L" FRED ");
+ const wchar_t* old_buffer = fred.c_str();
+ fred.TrimLeft();
+ EXPECT_EQ(L"FRED ", fred);
+ EXPECT_EQ(old_buffer, fred.c_str());
+ }
+ {
+ // With multiple references, we must copy.
+ CFX_WideString fred(L" FRED ");
+ CFX_WideString other_fred = fred;
+ const wchar_t* old_buffer = fred.c_str();
+ fred.TrimLeft();
+ EXPECT_EQ(L"FRED ", fred);
+ EXPECT_EQ(L" FRED ", other_fred);
+ EXPECT_NE(old_buffer, fred.c_str());
+ }
+ {
+ // With multiple references, but no modifications, no copy.
+ CFX_WideString fred(L"FRED");
+ CFX_WideString other_fred = fred;
+ const wchar_t* old_buffer = fred.c_str();
+ fred.TrimLeft();
+ EXPECT_EQ(L"FRED", fred);
+ EXPECT_EQ(L"FRED", other_fred);
+ EXPECT_EQ(old_buffer, fred.c_str());
+ }
+}
+
+TEST(fxcrt, WideStringReserve) {
+ {
+ CFX_WideString str;
+ str.Reserve(6);
+ const wchar_t* old_buffer = str.c_str();
+ str += L"ABCDEF";
+ EXPECT_EQ(old_buffer, str.c_str());
+ str += L"Blah Blah Blah Blah Blah Blah";
+ EXPECT_NE(old_buffer, str.c_str());
+ }
+ {
+ CFX_WideString str(L"A");
+ str.Reserve(6);
+ const wchar_t* old_buffer = str.c_str();
+ str += L"BCDEF";
+ EXPECT_EQ(old_buffer, str.c_str());
+ str += L"Blah Blah Blah Blah Blah Blah";
+ EXPECT_NE(old_buffer, str.c_str());
+ }
+}
+
+TEST(fxcrt, WideStringGetBuffer) {
+ {
+ CFX_WideString str;
+ wchar_t* buffer = str.GetBuffer(12);
+ wcscpy(buffer, L"clams");
+ str.ReleaseBuffer();
+ EXPECT_EQ(L"clams", str);
+ }
+ {
+ CFX_WideString str(L"cl");
+ wchar_t* buffer = str.GetBuffer(12);
+ wcscpy(buffer + 2, L"ams");
+ str.ReleaseBuffer();
+ EXPECT_EQ(L"clams", str);
+ }
+}
+
+TEST(fxcrt, WideStringReleaseBuffer) {
+ {
+ CFX_WideString str;
+ str.Reserve(12);
+ str += L"clams";
+ const wchar_t* old_buffer = str.c_str();
+ str.ReleaseBuffer(4);
+ EXPECT_EQ(old_buffer, str.c_str());
+ EXPECT_EQ(L"clam", str);
+ }
+ {
+ CFX_WideString str(L"c");
+ str.Reserve(12);
+ str += L"lams";
+ const wchar_t* old_buffer = str.c_str();
+ str.ReleaseBuffer(4);
+ EXPECT_EQ(old_buffer, str.c_str());
+ EXPECT_EQ(L"clam", str);
+ }
+ {
+ CFX_WideString str;
+ str.Reserve(200);
+ str += L"clams";
+ const wchar_t* old_buffer = str.c_str();
+ str.ReleaseBuffer(4);
+ EXPECT_NE(old_buffer, str.c_str());
+ EXPECT_EQ(L"clam", str);
+ }
+ {
+ CFX_WideString str(L"c");
+ str.Reserve(200);
+ str += L"lams";
+ const wchar_t* old_buffer = str.c_str();
+ str.ReleaseBuffer(4);
+ EXPECT_NE(old_buffer, str.c_str());
+ EXPECT_EQ(L"clam", str);
+ }
+}
+
+TEST(fxcrt, WideStringUTF16LE_Encode) {
+ struct UTF16LEEncodeCase {
+ CFX_WideString ws;
+ CFX_ByteString bs;
+ } utf16le_encode_cases[] = {
+ {L"", CFX_ByteString("\0\0", 2)},
+ {L"abc", CFX_ByteString("a\0b\0c\0\0\0", 8)},
+ {L"abcdef", CFX_ByteString("a\0b\0c\0d\0e\0f\0\0\0", 14)},
+ {L"abc\0def", CFX_ByteString("a\0b\0c\0\0\0", 8)},
+ {L"\xaabb\xccdd", CFX_ByteString("\xbb\xaa\xdd\xcc\0\0", 6)},
+ {L"\x3132\x6162", CFX_ByteString("\x32\x31\x62\x61\0\0", 6)},
+ };
+
+ for (size_t i = 0; i < FX_ArraySize(utf16le_encode_cases); ++i) {
+ EXPECT_EQ(utf16le_encode_cases[i].bs,
+ utf16le_encode_cases[i].ws.UTF16LE_Encode())
+ << " for case number " << i;
+ }
+}
+
+TEST(fxcrt, WideStringCOperatorSubscript) {
+ // CFX_WideStringC includes the NUL terminator for non-empty strings.
+ CFX_WideStringC abc(L"abc");
+ EXPECT_EQ(L'a', abc.CharAt(0));
+ EXPECT_EQ(L'b', abc.CharAt(1));
+ EXPECT_EQ(L'c', abc.CharAt(2));
+ EXPECT_EQ(L'\0', abc.CharAt(3));
+}
+
+TEST(fxcrt, WideStringCOperatorLT) {
+ CFX_WideStringC empty;
+ CFX_WideStringC a(L"a");
+ CFX_WideStringC abc(L"\x0110qq"); // Comes before despite endianness.
+ CFX_WideStringC def(L"\x1001qq"); // Comes after despite endianness.
+
+ EXPECT_FALSE(empty < empty);
+ EXPECT_FALSE(a < a);
+ EXPECT_FALSE(abc < abc);
+ EXPECT_FALSE(def < def);
+
+ EXPECT_TRUE(empty < a);
+ EXPECT_FALSE(a < empty);
+
+ EXPECT_TRUE(empty < abc);
+ EXPECT_FALSE(abc < empty);
+
+ EXPECT_TRUE(empty < def);
+ EXPECT_FALSE(def < empty);
+
+ EXPECT_TRUE(a < abc);
+ EXPECT_FALSE(abc < a);
+
+ EXPECT_TRUE(a < def);
+ EXPECT_FALSE(def < a);
+
+ EXPECT_TRUE(abc < def);
+ EXPECT_FALSE(def < abc);
+}
+
+TEST(fxcrt, WideStringCOperatorEQ) {
+ CFX_WideStringC wide_string_c(L"hello");
+ EXPECT_TRUE(wide_string_c == wide_string_c);
+
+ CFX_WideStringC wide_string_c_same1(L"hello");
+ EXPECT_TRUE(wide_string_c == wide_string_c_same1);
+ EXPECT_TRUE(wide_string_c_same1 == wide_string_c);
+
+ CFX_WideStringC wide_string_c_same2(wide_string_c);
+ EXPECT_TRUE(wide_string_c == wide_string_c_same2);
+ EXPECT_TRUE(wide_string_c_same2 == wide_string_c);
+
+ CFX_WideStringC wide_string_c1(L"he");
+ CFX_WideStringC wide_string_c2(L"hellp");
+ CFX_WideStringC wide_string_c3(L"hellod");
+ EXPECT_FALSE(wide_string_c == wide_string_c1);
+ EXPECT_FALSE(wide_string_c == wide_string_c2);
+ EXPECT_FALSE(wide_string_c == wide_string_c3);
+ EXPECT_FALSE(wide_string_c1 == wide_string_c);
+ EXPECT_FALSE(wide_string_c2 == wide_string_c);
+ EXPECT_FALSE(wide_string_c3 == wide_string_c);
+
+ CFX_WideString wide_string_same1(L"hello");
+ EXPECT_TRUE(wide_string_c == wide_string_same1);
+ EXPECT_TRUE(wide_string_same1 == wide_string_c);
+
+ CFX_WideString wide_string1(L"he");
+ CFX_WideString wide_string2(L"hellp");
+ CFX_WideString wide_string3(L"hellod");
+ EXPECT_FALSE(wide_string_c == wide_string1);
+ EXPECT_FALSE(wide_string_c == wide_string2);
+ EXPECT_FALSE(wide_string_c == wide_string3);
+ EXPECT_FALSE(wide_string1 == wide_string_c);
+ EXPECT_FALSE(wide_string2 == wide_string_c);
+ EXPECT_FALSE(wide_string3 == wide_string_c);
+
+ const wchar_t* c_string_same1 = L"hello";
+ EXPECT_TRUE(wide_string_c == c_string_same1);
+ EXPECT_TRUE(c_string_same1 == wide_string_c);
+
+ const wchar_t* c_string1 = L"he";
+ const wchar_t* c_string2 = L"hellp";
+ const wchar_t* c_string3 = L"hellod";
+ EXPECT_FALSE(wide_string_c == c_string1);
+ EXPECT_FALSE(wide_string_c == c_string2);
+ EXPECT_FALSE(wide_string_c == c_string3);
+
+ EXPECT_FALSE(c_string1 == wide_string_c);
+ EXPECT_FALSE(c_string2 == wide_string_c);
+ EXPECT_FALSE(c_string3 == wide_string_c);
+}
+
+TEST(fxcrt, WideStringCOperatorNE) {
+ CFX_WideStringC wide_string_c(L"hello");
+ EXPECT_FALSE(wide_string_c != wide_string_c);
+
+ CFX_WideStringC wide_string_c_same1(L"hello");
+ EXPECT_FALSE(wide_string_c != wide_string_c_same1);
+ EXPECT_FALSE(wide_string_c_same1 != wide_string_c);
+
+ CFX_WideStringC wide_string_c_same2(wide_string_c);
+ EXPECT_FALSE(wide_string_c != wide_string_c_same2);
+ EXPECT_FALSE(wide_string_c_same2 != wide_string_c);
+
+ CFX_WideStringC wide_string_c1(L"he");
+ CFX_WideStringC wide_string_c2(L"hellp");
+ CFX_WideStringC wide_string_c3(L"hellod");
+ EXPECT_TRUE(wide_string_c != wide_string_c1);
+ EXPECT_TRUE(wide_string_c != wide_string_c2);
+ EXPECT_TRUE(wide_string_c != wide_string_c3);
+ EXPECT_TRUE(wide_string_c1 != wide_string_c);
+ EXPECT_TRUE(wide_string_c2 != wide_string_c);
+ EXPECT_TRUE(wide_string_c3 != wide_string_c);
+
+ CFX_WideString wide_string_same1(L"hello");
+ EXPECT_FALSE(wide_string_c != wide_string_same1);
+ EXPECT_FALSE(wide_string_same1 != wide_string_c);
+
+ CFX_WideString wide_string1(L"he");
+ CFX_WideString wide_string2(L"hellp");
+ CFX_WideString wide_string3(L"hellod");
+ EXPECT_TRUE(wide_string_c != wide_string1);
+ EXPECT_TRUE(wide_string_c != wide_string2);
+ EXPECT_TRUE(wide_string_c != wide_string3);
+ EXPECT_TRUE(wide_string1 != wide_string_c);
+ EXPECT_TRUE(wide_string2 != wide_string_c);
+ EXPECT_TRUE(wide_string3 != wide_string_c);
+
+ const wchar_t* c_string_same1 = L"hello";
+ EXPECT_FALSE(wide_string_c != c_string_same1);
+ EXPECT_FALSE(c_string_same1 != wide_string_c);
+
+ const wchar_t* c_string1 = L"he";
+ const wchar_t* c_string2 = L"hellp";
+ const wchar_t* c_string3 = L"hellod";
+ EXPECT_TRUE(wide_string_c != c_string1);
+ EXPECT_TRUE(wide_string_c != c_string2);
+ EXPECT_TRUE(wide_string_c != c_string3);
+
+ EXPECT_TRUE(c_string1 != wide_string_c);
+ EXPECT_TRUE(c_string2 != wide_string_c);
+ EXPECT_TRUE(c_string3 != wide_string_c);
+}
+
+TEST(fxcrt, WideStringCFind) {
+ CFX_WideStringC null_string;
+ EXPECT_EQ(-1, null_string.Find(L'a'));
+ EXPECT_EQ(-1, null_string.Find(0));
+
+ CFX_WideStringC empty_string(L"");
+ EXPECT_EQ(-1, empty_string.Find(L'a'));
+ EXPECT_EQ(-1, empty_string.Find(0));
+
+ CFX_WideStringC single_string(L"a");
+ EXPECT_EQ(0, single_string.Find(L'a'));
+ EXPECT_EQ(-1, single_string.Find(L'b'));
+ EXPECT_EQ(-1, single_string.Find(0));
+
+ CFX_WideStringC longer_string(L"abccc");
+ EXPECT_EQ(0, longer_string.Find(L'a'));
+ EXPECT_EQ(2, longer_string.Find(L'c'));
+ EXPECT_EQ(-1, longer_string.Find(0));
+
+ CFX_WideStringC hibyte_string(
+ L"ab\xff08"
+ L"def");
+ EXPECT_EQ(2, hibyte_string.Find(L'\xff08'));
+}
+
+TEST(fxcrt, WideStringFormatWidth) {
+ {
+ CFX_WideString str;
+ str.Format(L"%5d", 1);
+ EXPECT_EQ(L" 1", str);
+ }
+
+ {
+ CFX_WideString str;
+ str.Format(L"%d", 1);
+ EXPECT_EQ(L"1", str);
+ }
+
+ {
+ CFX_WideString str;
+ str.Format(L"%*d", 5, 1);
+ EXPECT_EQ(L" 1", str);
+ }
+
+ {
+ CFX_WideString str;
+ str.Format(L"%-1d", 1);
+ EXPECT_EQ(L"1", str);
+ }
+
+ {
+ CFX_WideString str;
+ str.Format(L"%0d", 1);
+ EXPECT_EQ(L"1", str);
+ }
+
+ {
+ CFX_WideString str;
+ str.Format(L"%1048576d", 1);
+ EXPECT_EQ(L"", str);
+ }
+}
+
+TEST(fxcrt, WideStringFormatPrecision) {
+ {
+ CFX_WideString str;
+ str.Format(L"%.2f", 1.12345);
+ EXPECT_EQ(L"1.12", str);
+ }
+
+ {
+ CFX_WideString str;
+ str.Format(L"%.*f", 3, 1.12345);
+ EXPECT_EQ(L"1.123", str);
+ }
+
+ {
+ CFX_WideString str;
+ str.Format(L"%f", 1.12345);
+ EXPECT_EQ(L"1.123450", str);
+ }
+
+ {
+ CFX_WideString str;
+ str.Format(L"%-1f", 1.12345);
+ EXPECT_EQ(L"1.123450", str);
+ }
+
+ {
+ CFX_WideString str;
+ str.Format(L"%0f", 1.12345);
+ EXPECT_EQ(L"1.123450", str);
+ }
+
+ {
+ CFX_WideString str;
+ str.Format(L"%.1048576f", 1.2);
+ EXPECT_EQ(L"", str);
+ }
+}
+
+TEST(fxcrt, WideStringFormatOutOfRangeChar) {
+ CFX_WideString str;
+ str.Format(L"unsupported char '%c'", 0x00FF00FF);
+}
+
+TEST(fxcrt, EmptyWideString) {
+ CFX_WideString empty_str;
+ EXPECT_TRUE(empty_str.IsEmpty());
+ EXPECT_EQ(0, empty_str.GetLength());
+ const wchar_t* cstr = empty_str.c_str();
+ EXPECT_EQ(0, FXSYS_wcslen(cstr));
+}
+
+TEST(fxcrt, WidStringInitializerList) {
+ CFX_WideString many_str({L"clams", L" and ", L"oysters"});
+ EXPECT_EQ(L"clams and oysters", many_str);
+ many_str = {L"fish", L" and ", L"chips", L" and ", L"soda"};
+ EXPECT_EQ(L"fish and chips and soda", many_str);
+}
diff --git a/chromium/third_party/pdfium/core/fxcrt/cfx_wordbreak.cpp b/chromium/third_party/pdfium/core/fxcrt/cfx_wordbreak.cpp
new file mode 100644
index 00000000000..c236f599f26
--- /dev/null
+++ b/chromium/third_party/pdfium/core/fxcrt/cfx_wordbreak.cpp
@@ -0,0 +1,2946 @@
+// 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
+
+#include "core/fxcrt/cfx_wordbreak.h"
+
+#include <utility>
+
+#include "core/fxcrt/cfx_chariter.h"
+#include "third_party/base/ptr_util.h"
+
+namespace {
+
+enum FX_WordBreakProp {
+ FX_WordBreakProp_None = 0,
+ FX_WordBreakProp_CR,
+ FX_WordBreakProp_LF,
+ FX_WordBreakProp_NewLine,
+ FX_WordBreakProp_Extend,
+ FX_WordBreakProp_Format,
+ FX_WordBreakProp_KataKana,
+ FX_WordBreakProp_ALetter,
+ FX_WordBreakProp_MidLetter,
+ FX_WordBreakProp_MidNum,
+ FX_WordBreakProp_MidNumLet,
+ FX_WordBreakProp_Numberic,
+ FX_WordBreakProp_ExtendNumLet,
+};
+
+const uint16_t gs_FX_WordBreak_Table[16] = {
+ 0xFFFF, 0xFFF9, 0xFFFB, 0xFFFB, 0xFFFB, 0xFFFB, 0xEFBB, 0xE77B,
+ 0xFFFB, 0xFFFB, 0xFFFB, 0xE77B, 0xE73B, 0xFFFB, 0xFFFB, 0xFFFB,
+};
+
+const uint8_t gs_FX_WordBreak_CodePointProperties[(0xFFFF - 1) / 2 + 1] =
+ // NOLINTNEXTLINE
+ {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x00, 0x90, 0xA0,
+ 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0x89, 0x00, 0x00, 0x07, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x70, 0x00, 0x0C,
+ 0x07, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x70, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x70, 0x05, 0x00, 0x00, 0x00, 0x07, 0x08, 0x00, 0x70, 0x00, 0x00,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x70,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x70, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x00, 0x00, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x77, 0x70, 0x00,
+ 0x00, 0x00, 0x70, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44,
+ 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44,
+ 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44,
+ 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44,
+ 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x77, 0x77, 0x70, 0x77,
+ 0x00, 0x77, 0x77, 0x90, 0x00, 0x00, 0x00, 0x78, 0x77, 0x70, 0x70, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x07, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x07, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x04, 0x44, 0x44, 0x44, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x07, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x70,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x09, 0x00, 0x00, 0x00, 0x04, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44,
+ 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44,
+ 0x44, 0x44, 0x44, 0x04, 0x04, 0x40, 0x44, 0x04, 0x00, 0x00, 0x00, 0x00,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x70, 0x00, 0x00, 0x77, 0x77, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x55, 0x55, 0x00, 0x00, 0x00, 0x00, 0x99, 0x00, 0x44, 0x44, 0x44, 0x44,
+ 0x44, 0x40, 0x00, 0x00, 0x07, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x74, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x40,
+ 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0x0B, 0x90, 0x77, 0x47, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x07, 0x44,
+ 0x44, 0x44, 0x45, 0x44, 0x44, 0x44, 0x47, 0x74, 0x40, 0x44, 0x44, 0x77,
+ 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0x77, 0x70, 0x07, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x05, 0x74, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x44, 0x44, 0x44, 0x44,
+ 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x40, 0x07, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x44, 0x44, 0x44, 0x44, 0x44,
+ 0x47, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xBB, 0xBB, 0xBB, 0xBB,
+ 0xBB, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x74, 0x44, 0x44, 0x44, 0x44, 0x77, 0x00,
+ 0x90, 0x70, 0x00, 0x00, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x44, 0x44, 0x74, 0x44, 0x44, 0x44, 0x44, 0x74, 0x44,
+ 0x74, 0x44, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x44, 0x44, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x00, 0x47, 0x44, 0x44, 0x44, 0x44, 0x44,
+ 0x44, 0x44, 0x44, 0x40, 0x74, 0x44, 0x44, 0x00, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x44, 0x00, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0x07, 0x70, 0x00, 0x00,
+ 0x07, 0x77, 0x77, 0x77, 0x04, 0x44, 0x07, 0x77, 0x77, 0x77, 0x70, 0x07,
+ 0x70, 0x07, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x70, 0x77, 0x77, 0x77, 0x70, 0x70, 0x00, 0x77, 0x77, 0x00, 0x47, 0x44,
+ 0x44, 0x44, 0x40, 0x04, 0x40, 0x04, 0x44, 0x70, 0x00, 0x00, 0x00, 0x04,
+ 0x00, 0x00, 0x77, 0x07, 0x77, 0x44, 0x00, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB,
+ 0x77, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x44, 0x07, 0x77,
+ 0x77, 0x70, 0x00, 0x07, 0x70, 0x07, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x70, 0x77, 0x77, 0x77, 0x70, 0x77, 0x07, 0x70,
+ 0x77, 0x00, 0x40, 0x44, 0x44, 0x40, 0x00, 0x04, 0x40, 0x04, 0x44, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x07, 0x77, 0x70, 0x70, 0x00, 0x00, 0x00, 0xBB,
+ 0xBB, 0xBB, 0xBB, 0xBB, 0x44, 0x77, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x04, 0x44, 0x07, 0x77, 0x77, 0x77, 0x77, 0x07, 0x77, 0x07, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x70, 0x77, 0x77, 0x77,
+ 0x70, 0x77, 0x07, 0x77, 0x77, 0x00, 0x47, 0x44, 0x44, 0x44, 0x44, 0x04,
+ 0x44, 0x04, 0x44, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x77, 0x44, 0x00, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x04, 0x44, 0x07, 0x77, 0x77, 0x77, 0x70, 0x07,
+ 0x70, 0x07, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x70, 0x77, 0x77, 0x77, 0x70, 0x77, 0x07, 0x77, 0x77, 0x00, 0x47, 0x44,
+ 0x44, 0x44, 0x40, 0x04, 0x40, 0x04, 0x44, 0x00, 0x00, 0x00, 0x00, 0x44,
+ 0x00, 0x00, 0x77, 0x07, 0x77, 0x44, 0x00, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB,
+ 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x07, 0x77,
+ 0x77, 0x70, 0x00, 0x77, 0x70, 0x77, 0x77, 0x00, 0x07, 0x70, 0x70, 0x77,
+ 0x00, 0x07, 0x70, 0x00, 0x77, 0x70, 0x00, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x00, 0x00, 0x44, 0x44, 0x40, 0x00, 0x44, 0x40, 0x44, 0x44, 0x00,
+ 0x70, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xBB,
+ 0xBB, 0xBB, 0xBB, 0xBB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x04, 0x44, 0x07, 0x77, 0x77, 0x77, 0x70, 0x77, 0x70, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x70, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x07, 0x77, 0x77, 0x00, 0x07, 0x44, 0x44, 0x44, 0x40, 0x44,
+ 0x40, 0x44, 0x44, 0x00, 0x00, 0x00, 0x04, 0x40, 0x77, 0x00, 0x00, 0x00,
+ 0x77, 0x44, 0x00, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x07, 0x77, 0x77, 0x77, 0x70, 0x77,
+ 0x70, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x70, 0x77, 0x77, 0x77, 0x77, 0x77, 0x07, 0x77, 0x77, 0x00, 0x47, 0x44,
+ 0x44, 0x44, 0x40, 0x44, 0x40, 0x44, 0x44, 0x00, 0x00, 0x00, 0x04, 0x40,
+ 0x00, 0x00, 0x00, 0x70, 0x77, 0x44, 0x00, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x07, 0x77,
+ 0x77, 0x77, 0x70, 0x77, 0x70, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x70, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x00, 0x07, 0x44, 0x44, 0x44, 0x40, 0x44, 0x40, 0x44, 0x44, 0x00,
+ 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x77, 0x44, 0x00, 0xBB,
+ 0xBB, 0xBB, 0xBB, 0xBB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x77, 0x77,
+ 0x00, 0x44, 0x07, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x70,
+ 0x00, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x07, 0x77, 0x77, 0x77, 0x77, 0x07, 0x00, 0x77, 0x77, 0x77, 0x70,
+ 0x00, 0x40, 0x00, 0x04, 0x44, 0x44, 0x40, 0x40, 0x44, 0x44, 0x44, 0x44,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x44, 0x44, 0x44, 0x40, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x04, 0x44, 0x44, 0x44, 0x40, 0xBB, 0xBB, 0xBB, 0xBB,
+ 0xBB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x44, 0x44,
+ 0x44, 0x04, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x44, 0x44, 0x00,
+ 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x44, 0x00, 0x00, 0x00, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x04, 0x04, 0x04, 0x00, 0x00, 0x44, 0x77, 0x77, 0x77, 0x77,
+ 0x07, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x70, 0x00, 0x04, 0x44, 0x44, 0x44,
+ 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x40, 0x44, 0x77, 0x77, 0x00, 0x00,
+ 0x44, 0x44, 0x44, 0x44, 0x04, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44,
+ 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x40, 0x00,
+ 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44,
+ 0x44, 0x44, 0x44, 0x40, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x44, 0x44, 0x00, 0x00, 0x44, 0x40, 0x44, 0x40, 0x04,
+ 0x44, 0x44, 0x44, 0x00, 0x04, 0x44, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x04, 0xBB, 0xBB, 0xBB, 0xBB,
+ 0xBB, 0x44, 0x44, 0x00, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x70, 0x70, 0x00, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x70, 0x77, 0x77, 0x00, 0x77, 0x77, 0x77, 0x70, 0x70, 0x77, 0x77, 0x00,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x70, 0x77, 0x77, 0x00,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x70, 0x77, 0x77, 0x00, 0x77, 0x77, 0x77, 0x70,
+ 0x70, 0x77, 0x77, 0x00, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x70,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x70, 0x77, 0x77, 0x00, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x70, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x70, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x07, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x70, 0x07, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x07, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x70, 0x00, 0x00, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x70, 0x00, 0x77, 0x70, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x70, 0x77,
+ 0x77, 0x44, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x44, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x44, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x70, 0x77,
+ 0x70, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x44,
+ 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44,
+ 0x44, 0x44, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0xBB, 0xBB, 0xBB, 0xBB,
+ 0xBB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x44, 0x00, 0xBB, 0xBB, 0xBB, 0xBB,
+ 0xBB, 0x00, 0x00, 0x00, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x00, 0x00, 0x00, 0x00, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x74, 0x70, 0x00, 0x00, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x70, 0x00,
+ 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x00, 0x00, 0x44, 0x44, 0x44, 0x44,
+ 0x44, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x40, 0x00, 0x00, 0x00,
+ 0x44, 0x00, 0x00, 0x00, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xB0, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x74, 0x44, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x44,
+ 0x44, 0x44, 0x44, 0x40, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44,
+ 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x40, 0x04, 0xBB, 0xBB, 0xBB, 0xBB,
+ 0xBB, 0x00, 0x00, 0x00, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x44, 0x44, 0x47, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x47, 0x77,
+ 0x77, 0x77, 0x00, 0x00, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x44, 0x44, 0x44, 0x44, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x44, 0x47, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x74, 0x44, 0x44, 0x44,
+ 0x44, 0x40, 0x00, 0x77, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44,
+ 0x00, 0x00, 0x00, 0x00, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0x00, 0x07, 0x77,
+ 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x44, 0x40, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44,
+ 0x44, 0x44, 0x44, 0x44, 0x47, 0x77, 0x74, 0x77, 0x77, 0x40, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44,
+ 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x40,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x44,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x00, 0x77, 0x77, 0x77, 0x00,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x00, 0x77, 0x77, 0x77, 0x00,
+ 0x77, 0x77, 0x77, 0x77, 0x07, 0x07, 0x07, 0x07, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x00,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x70, 0x77, 0x77, 0x77, 0x70, 0x70, 0x00, 0x77, 0x70, 0x77,
+ 0x77, 0x77, 0x70, 0x00, 0x77, 0x77, 0x00, 0x77, 0x77, 0x77, 0x00, 0x00,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x70, 0x00, 0x00, 0x77, 0x70, 0x77,
+ 0x77, 0x77, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x55,
+ 0x00, 0x00, 0x00, 0x00, 0xAA, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA0, 0x08,
+ 0x33, 0x55, 0x55, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C,
+ 0xC0, 0x00, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x55, 0x55, 0x50, 0x00, 0x00, 0x55, 0x55, 0x55,
+ 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x77, 0x77, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44,
+ 0x44, 0x44, 0x44, 0x44, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x70, 0x00, 0x07, 0x00, 0x77, 0x77, 0x77, 0x77, 0x77, 0x07, 0x00,
+ 0x07, 0x77, 0x77, 0x00, 0x00, 0x00, 0x70, 0x70, 0x70, 0x77, 0x77, 0x07,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x00, 0x77, 0x77, 0x00, 0x00, 0x07, 0x77,
+ 0x77, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x70, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x70, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x70, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x70, 0x00,
+ 0x00, 0x07, 0x77, 0x74, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x70, 0x00, 0x00, 0x00, 0x00, 0x77, 0x77, 0x77, 0x70,
+ 0x77, 0x77, 0x77, 0x70, 0x77, 0x77, 0x77, 0x70, 0x77, 0x77, 0x77, 0x70,
+ 0x77, 0x77, 0x77, 0x70, 0x77, 0x77, 0x77, 0x70, 0x77, 0x77, 0x77, 0x70,
+ 0x77, 0x77, 0x77, 0x70, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44,
+ 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x44, 0x44,
+ 0x06, 0x66, 0x66, 0x00, 0x00, 0x07, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x04, 0x46, 0x60, 0x00, 0x66, 0x66, 0x66, 0x66,
+ 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
+ 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
+ 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
+ 0x66, 0x66, 0x66, 0x66, 0x66, 0x60, 0x66, 0x66, 0x00, 0x00, 0x07, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x00, 0x07, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x70, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66,
+ 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
+ 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x60,
+ 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
+ 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
+ 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
+ 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x00,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x70, 0x00, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0x77, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x00, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x74, 0x44, 0x40, 0x00, 0x00, 0x00, 0x00, 0x44, 0x07,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x00, 0x00, 0x00, 0x00, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x44, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x07, 0x77, 0x77, 0x77, 0x77, 0x00, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x70, 0x07, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x77, 0x77,
+ 0x77, 0x47, 0x77, 0x47, 0x77, 0x74, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x74, 0x44, 0x44, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x44, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44,
+ 0x44, 0x44, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0xBB, 0xBB, 0xBB, 0xBB,
+ 0xBB, 0x00, 0x00, 0x00, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44,
+ 0x44, 0x77, 0x77, 0x77, 0x00, 0x07, 0x00, 0x00, 0xBB, 0xBB, 0xBB, 0xBB,
+ 0xBB, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x44, 0x44, 0x44, 0x44, 0x00, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x74, 0x44, 0x44, 0x44, 0x44,
+ 0x44, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x70, 0x00,
+ 0x44, 0x44, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x74, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x40, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x07, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x74, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x40, 0x00, 0x00, 0x00, 0x00,
+ 0x77, 0x74, 0x77, 0x77, 0x77, 0x77, 0x44, 0x00, 0xBB, 0xBB, 0xBB, 0xBB,
+ 0xBB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x44, 0x40, 0x04,
+ 0x40, 0x00, 0x00, 0x44, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x74, 0x44, 0x44, 0x44, 0x40, 0x44, 0x00,
+ 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0x00, 0x00, 0x00, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x70, 0x00, 0x07, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x77, 0x77, 0x77, 0x70, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x07, 0x77, 0x77, 0x00, 0x00, 0x07, 0x47, 0x77, 0x77, 0x77, 0x77,
+ 0x70, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x70, 0x77, 0x77, 0x70, 0x70,
+ 0x77, 0x07, 0x70, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x07, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x00, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x00, 0x00, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44,
+ 0x90, 0x08, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x44, 0x44, 0x40,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0xCC, 0x90, 0xA0, 0x98, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x77, 0x77, 0x70, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x70, 0x05,
+ 0x00, 0x00, 0x00, 0x0A, 0x00, 0x00, 0x90, 0xA0, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x89, 0x00, 0x00, 0x07, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x70, 0x00, 0x0C, 0x07, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x70, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
+ 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
+ 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x44, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x70,
+ 0x00, 0x77, 0x77, 0x77, 0x00, 0x77, 0x77, 0x77, 0x00, 0x77, 0x77, 0x77,
+ 0x00, 0x77, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x05, 0x55, 0x00, 0x00,
+};
+
+FX_WordBreakProp GetWordBreakProperty(wchar_t wcCodePoint) {
+ uint32_t dwProperty =
+ (uint32_t)gs_FX_WordBreak_CodePointProperties[wcCodePoint >> 1];
+ return (FX_WordBreakProp)(((wcCodePoint)&1) ? (dwProperty & 0x0F)
+ : (dwProperty >> 4));
+}
+
+} // namespace
+
+CFX_WordBreak::CFX_WordBreak() {}
+
+CFX_WordBreak::~CFX_WordBreak() {}
+
+void CFX_WordBreak::Attach(IFX_CharIter* pIter) {
+ ASSERT(pIter);
+ m_pCurIter.reset(pIter);
+}
+
+void CFX_WordBreak::Attach(const CFX_WideString& wsText) {
+ m_pCurIter = pdfium::MakeUnique<CFX_CharIter>(wsText);
+}
+
+bool CFX_WordBreak::Next(bool bPrev) {
+ std::unique_ptr<IFX_CharIter> pIter(
+ (bPrev ? m_pPreIter : m_pCurIter)->Clone());
+ if (pIter->IsEOF(!bPrev))
+ return false;
+
+ pIter->Next(bPrev);
+ if (!FindNextBreakPos(pIter.get(), bPrev, true))
+ return false;
+
+ if (bPrev) {
+ m_pCurIter = std::move(m_pPreIter);
+ m_pCurIter->Next(true);
+ m_pPreIter = std::move(pIter);
+ } else {
+ m_pPreIter = std::move(m_pCurIter);
+ m_pPreIter->Next();
+ m_pCurIter = std::move(pIter);
+ }
+ return true;
+}
+
+void CFX_WordBreak::SetAt(int32_t nIndex) {
+ m_pPreIter.reset();
+ m_pCurIter->SetAt(nIndex);
+ FindNextBreakPos(m_pCurIter.get(), true, false);
+ m_pPreIter = std::move(m_pCurIter);
+ m_pCurIter.reset(m_pPreIter->Clone());
+ FindNextBreakPos(m_pCurIter.get(), false, false);
+}
+
+int32_t CFX_WordBreak::GetWordPos() const {
+ return m_pPreIter->GetAt();
+}
+
+int32_t CFX_WordBreak::GetWordLength() const {
+ return m_pCurIter->GetAt() - m_pPreIter->GetAt() + 1;
+}
+
+void CFX_WordBreak::GetWord(CFX_WideString& wsWord) const {
+ int32_t nWordLength = GetWordLength();
+ if (nWordLength <= 0) {
+ return;
+ }
+ wchar_t* lpBuf = wsWord.GetBuffer(nWordLength);
+ std::unique_ptr<IFX_CharIter> pTempIter(m_pPreIter->Clone());
+ int32_t i = 0;
+ while (pTempIter->GetAt() <= m_pCurIter->GetAt()) {
+ lpBuf[i++] = pTempIter->GetChar();
+ if (!pTempIter->Next())
+ break;
+ }
+ wsWord.ReleaseBuffer(nWordLength);
+}
+
+bool CFX_WordBreak::IsEOF(bool bTail) const {
+ return m_pCurIter->IsEOF(bTail);
+}
+
+bool CFX_WordBreak::FindNextBreakPos(IFX_CharIter* pIter,
+ bool bPrev,
+ bool bFromNext) {
+ FX_WordBreakProp ePreType = FX_WordBreakProp_None;
+ FX_WordBreakProp eCurType = FX_WordBreakProp_None;
+ FX_WordBreakProp eNextType = FX_WordBreakProp_None;
+ if (pIter->IsEOF(!bPrev)) {
+ return true;
+ }
+ if (!(bFromNext || pIter->IsEOF(bPrev))) {
+ pIter->Next(!bPrev);
+ ePreType = GetWordBreakProperty(pIter->GetChar());
+ pIter->Next(bPrev);
+ }
+ eCurType = GetWordBreakProperty(pIter->GetChar());
+ bool bFirst = true;
+ do {
+ pIter->Next(bPrev);
+ eNextType = GetWordBreakProperty(pIter->GetChar());
+ uint16_t wBreak =
+ gs_FX_WordBreak_Table[eCurType] & ((uint16_t)(1 << eNextType));
+ if (wBreak) {
+ if (pIter->IsEOF(!bPrev)) {
+ pIter->Next(!bPrev);
+ return true;
+ }
+ if (bFirst) {
+ int32_t nFlags = 0;
+ if (eCurType == FX_WordBreakProp_MidLetter) {
+ if (eNextType == FX_WordBreakProp_ALetter) {
+ nFlags = 1;
+ }
+ } else if (eCurType == FX_WordBreakProp_MidNum) {
+ if (eNextType == FX_WordBreakProp_Numberic) {
+ nFlags = 2;
+ }
+ } else if (eCurType == FX_WordBreakProp_MidNumLet) {
+ if (eNextType == FX_WordBreakProp_ALetter) {
+ nFlags = 1;
+ } else if (eNextType == FX_WordBreakProp_Numberic) {
+ nFlags = 2;
+ }
+ }
+ if (nFlags > 0) {
+ ASSERT(nFlags <= 2);
+ if (!((nFlags == 1 && ePreType == FX_WordBreakProp_ALetter) ||
+ (nFlags == 2 && ePreType == FX_WordBreakProp_Numberic))) {
+ pIter->Next(!bPrev);
+ return true;
+ }
+ pIter->Next(bPrev);
+ wBreak = false;
+ }
+ bFirst = false;
+ }
+ if (wBreak) {
+ int32_t nFlags = 0;
+ if (eNextType == FX_WordBreakProp_MidLetter) {
+ if (eCurType == FX_WordBreakProp_ALetter) {
+ nFlags = 1;
+ }
+ } else if (eNextType == FX_WordBreakProp_MidNum) {
+ if (eCurType == FX_WordBreakProp_Numberic) {
+ nFlags = 2;
+ }
+ } else if (eNextType == FX_WordBreakProp_MidNumLet) {
+ if (eCurType == FX_WordBreakProp_ALetter) {
+ nFlags = 1;
+ } else if (eCurType == FX_WordBreakProp_Numberic) {
+ nFlags = 2;
+ }
+ }
+ if (nFlags <= 0) {
+ pIter->Next(!bPrev);
+ return true;
+ }
+ ASSERT(nFlags <= 2);
+ pIter->Next(bPrev);
+ eNextType = (FX_WordBreakProp)GetWordBreakProperty(pIter->GetChar());
+ if (!((nFlags == 1 && eNextType == FX_WordBreakProp_ALetter) ||
+ (nFlags == 2 && eNextType == FX_WordBreakProp_Numberic))) {
+ pIter->Next(!bPrev);
+ pIter->Next(!bPrev);
+ return true;
+ }
+ }
+ }
+ ePreType = eCurType;
+ eCurType = eNextType;
+ bFirst = false;
+ } while (!pIter->IsEOF(!bPrev));
+ return true;
+}
diff --git a/chromium/third_party/pdfium/core/fxcrt/cfx_wordbreak.h b/chromium/third_party/pdfium/core/fxcrt/cfx_wordbreak.h
new file mode 100644
index 00000000000..4a7d925ec62
--- /dev/null
+++ b/chromium/third_party/pdfium/core/fxcrt/cfx_wordbreak.h
@@ -0,0 +1,39 @@
+// 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_FXCRT_CFX_WORDBREAK_H_
+#define CORE_FXCRT_CFX_WORDBREAK_H_
+
+#include <memory>
+
+#include "core/fxcrt/fx_string.h"
+#include "core/fxcrt/fx_system.h"
+
+class IFX_CharIter;
+
+class CFX_WordBreak {
+ public:
+ CFX_WordBreak();
+ ~CFX_WordBreak();
+
+ void Attach(IFX_CharIter* pIter);
+ void Attach(const CFX_WideString& wsText);
+ bool Next(bool bPrev);
+ void SetAt(int32_t nIndex);
+ int32_t GetWordPos() const;
+ int32_t GetWordLength() const;
+ void GetWord(CFX_WideString& wsWord) const;
+ bool IsEOF(bool bTail) const;
+
+ protected:
+ bool FindNextBreakPos(IFX_CharIter* pIter, bool bPrev, bool bFromNext = true);
+
+ private:
+ std::unique_ptr<IFX_CharIter> m_pPreIter;
+ std::unique_ptr<IFX_CharIter> m_pCurIter;
+};
+
+#endif // CORE_FXCRT_CFX_WORDBREAK_H_
diff --git a/chromium/third_party/pdfium/core/fxcrt/fx_arabic.cpp b/chromium/third_party/pdfium/core/fxcrt/fx_arabic.cpp
index 108c6c19ac4..f197af5e131 100644
--- a/chromium/third_party/pdfium/core/fxcrt/fx_arabic.cpp
+++ b/chromium/third_party/pdfium/core/fxcrt/fx_arabic.cpp
@@ -12,8 +12,93 @@
#include "core/fxcrt/fx_ucd.h"
#include "third_party/base/stl_util.h"
+#define FX_BIDIMAXLEVEL 61
+
namespace {
+struct FX_ARBFORMTABLE {
+ uint16_t wIsolated;
+ uint16_t wFinal;
+ uint16_t wInitial;
+ uint16_t wMedial;
+};
+
+struct FX_ARAALEF {
+ uint16_t wAlef;
+ uint16_t wIsolated;
+};
+
+struct FX_ARASHADDA {
+ uint16_t wShadda;
+ uint16_t wIsolated;
+};
+
+enum FX_BIDIWEAKSTATE {
+ FX_BWSxa = 0,
+ FX_BWSxr,
+ FX_BWSxl,
+ FX_BWSao,
+ FX_BWSro,
+ FX_BWSlo,
+ FX_BWSrt,
+ FX_BWSlt,
+ FX_BWScn,
+ FX_BWSra,
+ FX_BWSre,
+ FX_BWSla,
+ FX_BWSle,
+ FX_BWSac,
+ FX_BWSrc,
+ FX_BWSrs,
+ FX_BWSlc,
+ FX_BWSls,
+ FX_BWSret,
+ FX_BWSlet
+};
+
+enum FX_BIDIWEAKACTION {
+ FX_BWAIX = 0x100,
+ FX_BWAXX = 0x0F,
+ FX_BWAxxx = (0x0F << 4) + 0x0F,
+ FX_BWAxIx = 0x100 + FX_BWAxxx,
+ FX_BWAxxN = (0x0F << 4) + FX_BIDICLASS_ON,
+ FX_BWAxxE = (0x0F << 4) + FX_BIDICLASS_EN,
+ FX_BWAxxA = (0x0F << 4) + FX_BIDICLASS_AN,
+ FX_BWAxxR = (0x0F << 4) + FX_BIDICLASS_R,
+ FX_BWAxxL = (0x0F << 4) + FX_BIDICLASS_L,
+ FX_BWANxx = (FX_BIDICLASS_ON << 4) + 0x0F,
+ FX_BWAAxx = (FX_BIDICLASS_AN << 4) + 0x0F,
+ FX_BWAExE = (FX_BIDICLASS_EN << 4) + FX_BIDICLASS_EN,
+ FX_BWANIx = (FX_BIDICLASS_ON << 4) + 0x0F + 0x100,
+ FX_BWANxN = (FX_BIDICLASS_ON << 4) + FX_BIDICLASS_ON,
+ FX_BWANxR = (FX_BIDICLASS_ON << 4) + FX_BIDICLASS_R,
+ FX_BWANxE = (FX_BIDICLASS_ON << 4) + FX_BIDICLASS_EN,
+ FX_BWAAxA = (FX_BIDICLASS_AN << 4) + FX_BIDICLASS_AN,
+ FX_BWANxL = (FX_BIDICLASS_ON << 4) + FX_BIDICLASS_L,
+ FX_BWALxL = (FX_BIDICLASS_L << 4) + FX_BIDICLASS_L,
+ FX_BWAxIL = (0x0F << 4) + FX_BIDICLASS_L + 0x100,
+ FX_BWAAxR = (FX_BIDICLASS_AN << 4) + FX_BIDICLASS_R,
+ FX_BWALxx = (FX_BIDICLASS_L << 4) + 0x0F,
+};
+
+enum FX_BIDINEUTRALSTATE {
+ FX_BNSr = 0,
+ FX_BNSl,
+ FX_BNSrn,
+ FX_BNSln,
+ FX_BNSa,
+ FX_BNSna
+};
+
+enum FX_BIDINEUTRALACTION {
+ FX_BNAnL = FX_BIDICLASS_L,
+ FX_BNAEn = (FX_BIDICLASS_AN << 4),
+ FX_BNARn = (FX_BIDICLASS_R << 4),
+ FX_BNALn = (FX_BIDICLASS_L << 4),
+ FX_BNAIn = FX_BWAIX,
+ FX_BNALnL = (FX_BIDICLASS_L << 4) + FX_BIDICLASS_L,
+};
+
const FX_ARBFORMTABLE g_FX_ArabicFormTables[] = {
{0xFE81, 0xFE82, 0xFE81, 0xFE82}, {0xFE83, 0xFE84, 0xFE83, 0xFE84},
{0xFE85, 0xFE86, 0xFE85, 0xFE86}, {0xFE87, 0xFE88, 0xFE87, 0xFE88},
@@ -235,395 +320,287 @@ const int32_t gc_FX_BidiAddLevel[][4] = {
{1, 0, 1, 1},
};
+const FX_ARBFORMTABLE* GetArabicFormTable(wchar_t unicode) {
+ if (unicode < 0x622 || unicode > 0x6d5)
+ return nullptr;
+ return g_FX_ArabicFormTables + unicode - 0x622;
+}
+
const FX_ARBFORMTABLE* ParseChar(const CFX_Char* pTC,
- FX_WCHAR& wChar,
- FX_CHARTYPE& eType) {
+ wchar_t* wChar,
+ FX_CHARTYPE* eType) {
if (!pTC) {
- eType = FX_CHARTYPE_Unknown;
- wChar = 0xFEFF;
+ *eType = FX_CHARTYPE_Unknown;
+ *wChar = 0xFEFF;
return nullptr;
}
- eType = pTC->GetCharType();
- wChar = (FX_WCHAR)pTC->m_wCharCode;
- const FX_ARBFORMTABLE* pFT = FX_GetArabicFormTable(wChar);
- if (!pFT || eType >= FX_CHARTYPE_ArabicNormal)
- eType = FX_CHARTYPE_Unknown;
+
+ *eType = pTC->GetCharType();
+ *wChar = static_cast<wchar_t>(pTC->m_wCharCode);
+ const FX_ARBFORMTABLE* pFT = GetArabicFormTable(*wChar);
+ if (!pFT || *eType >= FX_CHARTYPE_ArabicNormal)
+ *eType = FX_CHARTYPE_Unknown;
return pFT;
}
-} // namespace
-
-const FX_ARBFORMTABLE* FX_GetArabicFormTable(FX_WCHAR unicode) {
- if (unicode < 0x622 || unicode > 0x6d5) {
- return nullptr;
- }
- return g_FX_ArabicFormTables + unicode - 0x622;
-}
-FX_WCHAR FX_GetArabicFromAlefTable(FX_WCHAR alef) {
- static const int32_t s_iAlefCount =
- sizeof(gs_FX_AlefTable) / sizeof(FX_ARAALEF);
- for (int32_t iStart = 0; iStart < s_iAlefCount; iStart++) {
+wchar_t GetArabicFromAlefTable(wchar_t alef) {
+ static const size_t s_iAlefCount = FX_ArraySize(gs_FX_AlefTable);
+ for (size_t iStart = 0; iStart < s_iAlefCount; iStart++) {
const FX_ARAALEF& v = gs_FX_AlefTable[iStart];
- if (v.wAlef == alef) {
+ if (v.wAlef == alef)
return v.wIsolated;
- }
}
return alef;
}
-FX_WCHAR FX_GetArabicFromShaddaTable(FX_WCHAR shadda) {
- static const int32_t s_iShaddaCount =
- sizeof(gs_FX_ShaddaTable) / sizeof(FX_ARASHADDA);
- for (int32_t iStart = 0; iStart < s_iShaddaCount; iStart++) {
- const FX_ARASHADDA& v = gs_FX_ShaddaTable[iStart];
- if (v.wShadda == shadda) {
- return v.wIsolated;
- }
- }
- return shadda;
-}
-
-namespace pdfium {
-namespace arabic {
-
-bool IsArabicChar(FX_WCHAR wch) {
- uint32_t dwRet =
- kTextLayoutCodeProperties[(uint16_t)wch] & FX_CHARTYPEBITSMASK;
- return dwRet >= FX_CHARTYPE_ArabicAlef;
-}
-
-bool IsArabicFormChar(FX_WCHAR wch) {
- return (kTextLayoutCodeProperties[(uint16_t)wch] & FX_CHARTYPEBITSMASK) ==
- FX_CHARTYPE_ArabicForm;
-}
-FX_WCHAR GetFormChar(FX_WCHAR wch, FX_WCHAR prev, FX_WCHAR next) {
- CFX_Char c(wch, kTextLayoutCodeProperties[(uint16_t)wch]);
- CFX_Char p(prev, kTextLayoutCodeProperties[(uint16_t)prev]);
- CFX_Char n(next, kTextLayoutCodeProperties[(uint16_t)next]);
- return GetFormChar(&c, &p, &n);
-}
+class CFX_BidiLine {
+ public:
+ void BidiLine(std::vector<CFX_Char>* chars,
+ int32_t iCount,
+ int32_t iBaseLevel) {
+ ASSERT(iCount >= 0 && iCount <= pdfium::CollectionSize<int32_t>(*chars));
+ if (iCount < 2)
+ return;
-FX_WCHAR GetFormChar(const CFX_Char* cur,
- const CFX_Char* prev,
- const CFX_Char* next) {
- FX_CHARTYPE eCur;
- FX_WCHAR wCur;
- const FX_ARBFORMTABLE* ft = ParseChar(cur, wCur, eCur);
- if (eCur < FX_CHARTYPE_ArabicAlef || eCur >= FX_CHARTYPE_ArabicNormal) {
- return wCur;
+ Classify(chars, iCount, false);
+ ResolveExplicit(chars, iCount, iBaseLevel);
+ ResolveWeak(chars, iCount, iBaseLevel);
+ ResolveNeutrals(chars, iCount, iBaseLevel);
+ ResolveImplicit(chars, iCount);
+ Classify(chars, iCount, true);
+ ResolveWhitespace(chars, iCount, iBaseLevel);
+ Reorder(chars, iCount, iBaseLevel);
+ Position(chars, iCount);
}
- FX_CHARTYPE ePrev;
- FX_WCHAR wPrev;
- ParseChar(prev, wPrev, ePrev);
- if (wPrev == 0x0644 && eCur == FX_CHARTYPE_ArabicAlef) {
- return 0xFEFF;
- }
- FX_CHARTYPE eNext;
- FX_WCHAR wNext;
- ParseChar(next, wNext, eNext);
- bool bAlef = (eNext == FX_CHARTYPE_ArabicAlef && wCur == 0x644);
- if (ePrev < FX_CHARTYPE_ArabicAlef) {
- if (bAlef) {
- return FX_GetArabicFromAlefTable(wNext);
- }
- return (eNext < FX_CHARTYPE_ArabicAlef) ? ft->wIsolated : ft->wInitial;
- }
- if (bAlef) {
- wCur = FX_GetArabicFromAlefTable(wNext);
- return (ePrev != FX_CHARTYPE_ArabicDistortion) ? wCur : ++wCur;
- }
- if (ePrev == FX_CHARTYPE_ArabicAlef || ePrev == FX_CHARTYPE_ArabicSpecial) {
- return (eNext < FX_CHARTYPE_ArabicAlef) ? ft->wIsolated : ft->wInitial;
- }
- return (eNext < FX_CHARTYPE_ArabicAlef) ? ft->wFinal : ft->wMedial;
-}
-
-} // namespace arabic
-} // namespace pdfium
-void FX_BidiReverseString(CFX_WideString& wsText,
- int32_t iStart,
- int32_t iCount) {
- ASSERT(iStart > -1 && iStart < wsText.GetLength());
- ASSERT(iCount >= 0 && iStart + iCount <= wsText.GetLength());
- FX_WCHAR wch;
- FX_WCHAR* pStart = const_cast<FX_WCHAR*>(wsText.c_str());
- pStart += iStart;
- FX_WCHAR* pEnd = pStart + iCount - 1;
- while (pStart < pEnd) {
- wch = *pStart;
- *pStart++ = *pEnd;
- *pEnd-- = wch;
+ private:
+ int32_t Direction(int32_t val) {
+ return FX_IsOdd(val) ? FX_BIDICLASS_R : FX_BIDICLASS_L;
}
-}
+ int32_t GetDeferredType(int32_t val) { return (val >> 4) & 0x0F; }
-int32_t FX_BidiGetDeferredNeutrals(int32_t iAction, int32_t iLevel) {
- iAction = (iAction >> 4) & 0xF;
- if (iAction == (FX_BIDINEUTRALACTION_En >> 4)) {
- return FX_BidiDirection(iLevel);
- } else {
- return iAction;
- }
-}
+ int32_t GetResolvedType(int32_t val) { return val & 0x0F; }
-int32_t FX_BidiGetResolvedNeutrals(int32_t iAction) {
- iAction = (iAction & 0xF);
- if (iAction == FX_BIDINEUTRALACTION_In) {
- return 0;
- } else {
+ int32_t GetDeferredNeutrals(int32_t iAction, int32_t iLevel) {
+ iAction = (iAction >> 4) & 0xF;
+ if (iAction == (FX_BNAEn >> 4))
+ return Direction(iLevel);
return iAction;
}
-}
-int32_t FX_BidiReorderLevel(int32_t iBaseLevel,
- CFX_WideString& wsText,
- const CFX_ArrayTemplate<int32_t>& levels,
- int32_t iStart,
- bool bReverse) {
- ASSERT(iBaseLevel >= 0 && iBaseLevel <= FX_BIDIMAXLEVEL);
- ASSERT(wsText.GetLength() == levels.GetSize());
- ASSERT(iStart >= 0 && iStart < wsText.GetLength());
- int32_t iSize = wsText.GetLength();
- if (iSize < 1) {
- return 0;
- }
- bReverse = bReverse || FX_IsOdd(iBaseLevel);
- int32_t i = iStart, iLevel;
- for (; i < iSize; i++) {
- if ((iLevel = levels.GetAt(i)) == iBaseLevel) {
- continue;
- }
- if (iLevel < iBaseLevel) {
- break;
- }
- i += FX_BidiReorderLevel(iBaseLevel + 1, wsText, levels, i, bReverse) - 1;
- }
- int32_t iCount = i - iStart;
- if (bReverse && iCount > 1) {
- FX_BidiReverseString(wsText, iStart, iCount);
+ int32_t GetResolvedNeutrals(int32_t iAction) {
+ iAction &= 0xF;
+ return iAction == FX_BNAIn ? 0 : iAction;
}
- return iCount;
-}
-void FX_BidiReorder(int32_t iBaseLevel,
- CFX_WideString& wsText,
- const CFX_ArrayTemplate<int32_t>& levels) {
- ASSERT(iBaseLevel >= 0 && iBaseLevel <= FX_BIDIMAXLEVEL);
- ASSERT(wsText.GetLength() == levels.GetSize());
- int32_t iSize = wsText.GetLength();
- if (iSize < 1) {
- return;
- }
- int32_t i = 0;
- while (i < iSize) {
- i += FX_BidiReorderLevel(iBaseLevel, wsText, levels, i, false);
- }
-}
-template <class baseType>
-class CFX_BidiLineTemplate {
- public:
- void FX_BidiReverseString(std::vector<baseType>& chars,
- int32_t iStart,
- int32_t iCount) {
- ASSERT(iStart >= 0 && iStart < pdfium::CollectionSize<int32_t>(chars));
+ void ReverseString(std::vector<CFX_Char>* chars,
+ int32_t iStart,
+ int32_t iCount) {
+ ASSERT(pdfium::IndexInBounds(*chars, iStart));
ASSERT(iCount >= 0 &&
- iStart + iCount <= pdfium::CollectionSize<int32_t>(chars));
- std::reverse(chars.begin() + iStart, chars.begin() + iStart + iCount);
+ iStart + iCount <= pdfium::CollectionSize<int32_t>(*chars));
+ std::reverse(chars->begin() + iStart, chars->begin() + iStart + iCount);
}
- void FX_BidiSetDeferredRun(std::vector<baseType>& chars,
- bool bClass,
- int32_t iStart,
- int32_t iCount,
- int32_t iValue) {
- ASSERT(iStart >= 0 && iStart <= pdfium::CollectionSize<int32_t>(chars));
+ void SetDeferredRun(std::vector<CFX_Char>* chars,
+ bool bClass,
+ int32_t iStart,
+ int32_t iCount,
+ int32_t iValue) {
+ ASSERT(iStart >= 0 && iStart <= pdfium::CollectionSize<int32_t>(*chars));
ASSERT(iStart - iCount > -1);
int32_t iLast = iStart - iCount;
if (bClass) {
for (int32_t i = iStart - 1; i >= iLast; i--)
- chars[i].m_iBidiClass = (int16_t)iValue;
- } else {
- for (int32_t i = iStart - 1; i >= iLast; i--)
- chars[i].m_iBidiLevel = (int16_t)iValue;
+ (*chars)[i].m_iBidiClass = static_cast<int16_t>(iValue);
+ return;
}
+
+ for (int32_t i = iStart - 1; i >= iLast; i--)
+ (*chars)[i].m_iBidiLevel = static_cast<int16_t>(iValue);
}
- void FX_BidiClassify(std::vector<baseType>& chars, int32_t iCount, bool bWS) {
- ASSERT(iCount >= 0 && iCount <= pdfium::CollectionSize<int32_t>(chars));
+ void Classify(std::vector<CFX_Char>* chars, int32_t iCount, bool bWS) {
+ ASSERT(iCount >= 0 && iCount <= pdfium::CollectionSize<int32_t>(*chars));
if (bWS) {
for (int32_t i = 0; i < iCount; i++) {
- chars[i].m_iBidiClass =
- (int16_t)(chars[i].m_dwCharProps & FX_BIDICLASSBITSMASK) >>
+ (*chars)[i].m_iBidiClass =
+ static_cast<int16_t>((*chars)[i].m_dwCharProps &
+ FX_BIDICLASSBITSMASK) >>
FX_BIDICLASSBITS;
}
- } else {
- for (int32_t i = 0; i < iCount; i++) {
- chars[i].m_iBidiClass = (int16_t)
- gc_FX_BidiNTypes[(chars[i].m_dwCharProps & FX_BIDICLASSBITSMASK) >>
- FX_BIDICLASSBITS];
- }
+ return;
+ }
+
+ for (int32_t i = 0; i < iCount; i++) {
+ (*chars)[i].m_iBidiClass = static_cast<int16_t>(
+ gc_FX_BidiNTypes[((*chars)[i].m_dwCharProps & FX_BIDICLASSBITSMASK) >>
+ FX_BIDICLASSBITS]);
}
}
- void FX_BidiResolveExplicit(std::vector<baseType>& chars,
- int32_t iCount,
- int32_t iBaseLevel) {
- ASSERT(iCount >= 0 && iCount <= pdfium::CollectionSize<int32_t>(chars));
+ void ResolveExplicit(std::vector<CFX_Char>* chars,
+ int32_t iCount,
+ int32_t iBaseLevel) {
+ ASSERT(iCount >= 0 && iCount <= pdfium::CollectionSize<int32_t>(*chars));
ASSERT(iBaseLevel >= 0 && iBaseLevel <= FX_BIDIMAXLEVEL);
for (int32_t i = 0; i < iCount; i++)
- chars[i].m_iBidiLevel = static_cast<int16_t>(iBaseLevel);
+ (*chars)[i].m_iBidiLevel = static_cast<int16_t>(iBaseLevel);
}
- void FX_BidiResolveWeak(std::vector<baseType>& chars,
- int32_t iCount,
- int32_t iBaseLevel) {
- ASSERT(iCount >= 0 && iCount <= pdfium::CollectionSize<int32_t>(chars));
+ void ResolveWeak(std::vector<CFX_Char>* chars,
+ int32_t iCount,
+ int32_t iBaseLevel) {
+ ASSERT(iCount >= 0 && iCount <= pdfium::CollectionSize<int32_t>(*chars));
iCount--;
- if (iCount < 1) {
+ if (iCount < 1)
return;
- }
- baseType *pTC, *pTCNext;
+
int32_t iLevelCur = iBaseLevel;
int32_t iState = FX_IsOdd(iBaseLevel) ? FX_BWSxr : FX_BWSxl;
- int32_t i = 0, iNum = 0, iClsCur, iClsRun, iClsNew, iAction;
+ int32_t i = 0;
+ int32_t iNum = 0;
+ int32_t iClsCur;
+ int32_t iClsRun;
+ int32_t iClsNew;
+ int32_t iAction;
for (; i <= iCount; i++) {
- pTC = &chars[i];
+ CFX_Char* pTC = &(*chars)[i];
iClsCur = pTC->m_iBidiClass;
if (iClsCur == FX_BIDICLASS_BN) {
pTC->m_iBidiLevel = (int16_t)iLevelCur;
if (i == iCount && iLevelCur != iBaseLevel) {
- iClsCur = FX_BidiDirection(iLevelCur);
+ iClsCur = Direction(iLevelCur);
pTC->m_iBidiClass = (int16_t)iClsCur;
} else if (i < iCount) {
- pTCNext = &chars[i + 1];
+ CFX_Char* pTCNext = &(*chars)[i + 1];
int32_t iLevelNext, iLevelNew;
iClsNew = pTCNext->m_iBidiClass;
iLevelNext = pTCNext->m_iBidiLevel;
if (iClsNew != FX_BIDICLASS_BN && iLevelCur != iLevelNext) {
- iLevelNew = iLevelNext;
- if (iLevelCur > iLevelNew) {
- iLevelNew = iLevelCur;
- }
- pTC->m_iBidiLevel = (int16_t)iLevelNew;
- iClsCur = FX_BidiDirection(iLevelNew);
- pTC->m_iBidiClass = (int16_t)iClsCur;
+ iLevelNew = std::max(iLevelNext, iLevelCur);
+ pTC->m_iBidiLevel = static_cast<int16_t>(iLevelNew);
+ iClsCur = Direction(iLevelNew);
+ pTC->m_iBidiClass = static_cast<int16_t>(iClsCur);
iLevelCur = iLevelNext;
} else {
- if (iNum > 0) {
+ if (iNum > 0)
iNum++;
- }
continue;
}
} else {
- if (iNum > 0) {
+ if (iNum > 0)
iNum++;
- }
continue;
}
}
+
ASSERT(iClsCur <= FX_BIDICLASS_BN);
iAction = gc_FX_BidiWeakActions[iState][iClsCur];
- iClsRun = FX_BidiGetDeferredType(iAction);
- if (iClsRun != FX_BIDIWEAKACTION_XX && iNum > 0) {
- FX_BidiSetDeferredRun(chars, true, i, iNum, iClsRun);
+ iClsRun = GetDeferredType(iAction);
+ if (iClsRun != FX_BWAXX && iNum > 0) {
+ SetDeferredRun(chars, true, i, iNum, iClsRun);
iNum = 0;
}
- iClsNew = FX_BidiGetResolvedType(iAction);
- if (iClsNew != FX_BIDIWEAKACTION_XX) {
- pTC->m_iBidiClass = (int16_t)iClsNew;
- }
- if (FX_BIDIWEAKACTION_IX & iAction) {
+ iClsNew = GetResolvedType(iAction);
+ if (iClsNew != FX_BWAXX)
+ pTC->m_iBidiClass = static_cast<int16_t>(iClsNew);
+ if (FX_BWAIX & iAction)
iNum++;
- }
+
iState = gc_FX_BidiWeakStates[iState][iClsCur];
}
if (iNum > 0) {
- iClsCur = FX_BidiDirection(iBaseLevel);
- iClsRun = FX_BidiGetDeferredType(gc_FX_BidiWeakActions[iState][iClsCur]);
- if (iClsRun != FX_BIDIWEAKACTION_XX) {
- FX_BidiSetDeferredRun(chars, true, i, iNum, iClsRun);
- }
+ iClsCur = Direction(iBaseLevel);
+ iClsRun = GetDeferredType(gc_FX_BidiWeakActions[iState][iClsCur]);
+ if (iClsRun != FX_BWAXX)
+ SetDeferredRun(chars, true, i, iNum, iClsRun);
}
}
- void FX_BidiResolveNeutrals(std::vector<baseType>& chars,
- int32_t iCount,
- int32_t iBaseLevel) {
- ASSERT(iCount >= 0 && iCount <= pdfium::CollectionSize<int32_t>(chars));
+ void ResolveNeutrals(std::vector<CFX_Char>* chars,
+ int32_t iCount,
+ int32_t iBaseLevel) {
+ ASSERT(iCount >= 0 && iCount <= pdfium::CollectionSize<int32_t>(*chars));
ASSERT(iBaseLevel >= 0 && iBaseLevel <= FX_BIDIMAXLEVEL);
iCount--;
- if (iCount < 1) {
+ if (iCount < 1)
return;
- }
- baseType* pTC;
+
+ CFX_Char* pTC;
int32_t iLevel = iBaseLevel;
int32_t iState = FX_IsOdd(iBaseLevel) ? FX_BNSr : FX_BNSl;
- int32_t i = 0, iNum = 0, iClsCur, iClsRun, iClsNew, iAction;
+ int32_t i = 0;
+ int32_t iNum = 0;
+ int32_t iClsCur;
+ int32_t iClsRun;
+ int32_t iClsNew;
+ int32_t iAction;
for (; i <= iCount; i++) {
- pTC = &chars[i];
+ pTC = &(*chars)[i];
iClsCur = pTC->m_iBidiClass;
if (iClsCur == FX_BIDICLASS_BN) {
- if (iNum) {
+ if (iNum)
iNum++;
- }
continue;
}
+
ASSERT(iClsCur < FX_BIDICLASS_AL);
iAction = gc_FX_BidiNeutralActions[iState][iClsCur];
- iClsRun = FX_BidiGetDeferredNeutrals(iAction, iLevel);
+ iClsRun = GetDeferredNeutrals(iAction, iLevel);
if (iClsRun != FX_BIDICLASS_N && iNum > 0) {
- FX_BidiSetDeferredRun(chars, true, i, iNum, iClsRun);
+ SetDeferredRun(chars, true, i, iNum, iClsRun);
iNum = 0;
}
- iClsNew = FX_BidiGetResolvedNeutrals(iAction);
- if (iClsNew != FX_BIDICLASS_N) {
+
+ iClsNew = GetResolvedNeutrals(iAction);
+ if (iClsNew != FX_BIDICLASS_N)
pTC->m_iBidiClass = (int16_t)iClsNew;
- }
- if (FX_BIDINEUTRALACTION_In & iAction) {
+ if (FX_BNAIn & iAction)
iNum++;
- }
+
iState = gc_FX_BidiNeutralStates[iState][iClsCur];
iLevel = pTC->m_iBidiLevel;
}
if (iNum > 0) {
- iClsCur = FX_BidiDirection(iLevel);
- iClsRun = FX_BidiGetDeferredNeutrals(
- gc_FX_BidiNeutralActions[iState][iClsCur], iLevel);
- if (iClsRun != FX_BIDICLASS_N) {
- FX_BidiSetDeferredRun(chars, true, i, iNum, iClsRun);
- }
+ iClsCur = Direction(iLevel);
+ iClsRun = GetDeferredNeutrals(gc_FX_BidiNeutralActions[iState][iClsCur],
+ iLevel);
+ if (iClsRun != FX_BIDICLASS_N)
+ SetDeferredRun(chars, true, i, iNum, iClsRun);
}
}
- void FX_BidiResolveImplicit(std::vector<baseType>& chars, int32_t iCount) {
- ASSERT(iCount >= 0 && iCount <= pdfium::CollectionSize<int32_t>(chars));
+ void ResolveImplicit(std::vector<CFX_Char>* chars, int32_t iCount) {
+ ASSERT(iCount >= 0 && iCount <= pdfium::CollectionSize<int32_t>(*chars));
for (int32_t i = 0; i < iCount; i++) {
- int32_t iCls = chars[i].m_iBidiClass;
- if (iCls == FX_BIDICLASS_BN) {
+ int32_t iCls = (*chars)[i].m_iBidiClass;
+ if (iCls == FX_BIDICLASS_BN)
continue;
- }
+
ASSERT(iCls > FX_BIDICLASS_ON && iCls < FX_BIDICLASS_AL);
- int32_t iLevel = chars[i].m_iBidiLevel;
+ int32_t iLevel = (*chars)[i].m_iBidiLevel;
iLevel += gc_FX_BidiAddLevel[FX_IsOdd(iLevel)][iCls - 1];
- chars[i].m_iBidiLevel = (int16_t)iLevel;
+ (*chars)[i].m_iBidiLevel = (int16_t)iLevel;
}
}
- void FX_BidiResolveWhitespace(std::vector<baseType>& chars,
- int32_t iCount,
- int32_t iBaseLevel) {
- ASSERT(iCount >= 0 && iCount <= pdfium::CollectionSize<int32_t>(chars));
+ void ResolveWhitespace(std::vector<CFX_Char>* chars,
+ int32_t iCount,
+ int32_t iBaseLevel) {
+ ASSERT(iCount >= 0 && iCount <= pdfium::CollectionSize<int32_t>(*chars));
ASSERT(iBaseLevel >= 0 && iBaseLevel <= FX_BIDIMAXLEVEL);
- if (iCount < 1) {
+ if (iCount < 1)
return;
- }
+
iCount--;
int32_t iLevel = iBaseLevel;
- int32_t i = 0, iNum = 0;
+ int32_t i = 0;
+ int32_t iNum = 0;
for (; i <= iCount; i++) {
- switch (chars[i].m_iBidiClass) {
+ switch ((*chars)[i].m_iBidiClass) {
case FX_BIDICLASS_WS:
iNum++;
break;
@@ -633,101 +610,134 @@ class CFX_BidiLineTemplate {
case FX_BIDICLASS_RLO:
case FX_BIDICLASS_PDF:
case FX_BIDICLASS_BN:
- chars[i].m_iBidiLevel = (int16_t)iLevel;
+ (*chars)[i].m_iBidiLevel = (int16_t)iLevel;
iNum++;
break;
case FX_BIDICLASS_S:
case FX_BIDICLASS_B:
- if (iNum > 0) {
- FX_BidiSetDeferredRun(chars, false, i, iNum, iBaseLevel);
- }
- chars[i].m_iBidiLevel = (int16_t)iBaseLevel;
+ if (iNum > 0)
+ SetDeferredRun(chars, false, i, iNum, iBaseLevel);
+
+ (*chars)[i].m_iBidiLevel = static_cast<int16_t>(iBaseLevel);
iNum = 0;
break;
default:
iNum = 0;
break;
}
- iLevel = chars[i].m_iBidiLevel;
- }
- if (iNum > 0) {
- FX_BidiSetDeferredRun(chars, false, i, iNum, iBaseLevel);
+ iLevel = (*chars)[i].m_iBidiLevel;
}
+ if (iNum > 0)
+ SetDeferredRun(chars, false, i, iNum, iBaseLevel);
}
- int32_t FX_BidiReorderLevel(std::vector<baseType>& chars,
- int32_t iCount,
- int32_t iBaseLevel,
- int32_t iStart,
- bool bReverse) {
- ASSERT(iCount >= 0 && iCount <= pdfium::CollectionSize<int32_t>(chars));
+ int32_t ReorderLevel(std::vector<CFX_Char>* chars,
+ int32_t iCount,
+ int32_t iBaseLevel,
+ int32_t iStart,
+ bool bReverse) {
+ ASSERT(iCount >= 0 && iCount <= pdfium::CollectionSize<int32_t>(*chars));
ASSERT(iBaseLevel >= 0 && iBaseLevel <= FX_BIDIMAXLEVEL);
ASSERT(iStart >= 0 && iStart < iCount);
- if (iCount < 1) {
+
+ if (iCount < 1)
return 0;
- }
+
bReverse = bReverse || FX_IsOdd(iBaseLevel);
int32_t i = iStart;
for (; i < iCount; i++) {
- int32_t iLevel = chars[i].m_iBidiLevel;
+ int32_t iLevel = (*chars)[i].m_iBidiLevel;
if (iLevel == iBaseLevel)
continue;
if (iLevel < iBaseLevel)
break;
- i += FX_BidiReorderLevel(chars, iCount, iBaseLevel + 1, i, bReverse) - 1;
+ i += ReorderLevel(chars, iCount, iBaseLevel + 1, i, bReverse) - 1;
}
int32_t iNum = i - iStart;
- if (bReverse && iNum > 1) {
- FX_BidiReverseString(chars, iStart, iNum);
- }
+ if (bReverse && iNum > 1)
+ ReverseString(chars, iStart, iNum);
+
return iNum;
}
- void FX_BidiReorder(std::vector<baseType>& chars,
- int32_t iCount,
- int32_t iBaseLevel) {
- ASSERT(iCount >= 0 && iCount <= pdfium::CollectionSize<int32_t>(chars));
+ void Reorder(std::vector<CFX_Char>* chars,
+ int32_t iCount,
+ int32_t iBaseLevel) {
+ ASSERT(iCount >= 0 && iCount <= pdfium::CollectionSize<int32_t>(*chars));
ASSERT(iBaseLevel >= 0 && iBaseLevel <= FX_BIDIMAXLEVEL);
int32_t i = 0;
- while (i < iCount) {
- i += FX_BidiReorderLevel(chars, iCount, iBaseLevel, i, false);
- }
+ while (i < iCount)
+ i += ReorderLevel(chars, iCount, iBaseLevel, i, false);
}
- void FX_BidiPosition(std::vector<baseType>& chars, int32_t iCount) {
- ASSERT(iCount >= 0 && iCount <= pdfium::CollectionSize<int32_t>(chars));
+ void Position(std::vector<CFX_Char>* chars, int32_t iCount) {
+ ASSERT(iCount >= 0 && iCount <= pdfium::CollectionSize<int32_t>(*chars));
for (int32_t i = 0; i < iCount; ++i)
- chars[chars[i].m_iBidiPos].m_iBidiOrder = i;
+ (*chars)[(*chars)[i].m_iBidiPos].m_iBidiOrder = i;
}
+};
- void FX_BidiLine(std::vector<baseType>& chars,
- int32_t iCount,
- int32_t iBaseLevel) {
- ASSERT(iCount >= 0 && iCount <= pdfium::CollectionSize<int32_t>(chars));
- if (iCount < 2) {
- return;
- }
- FX_BidiClassify(chars, iCount, false);
- FX_BidiResolveExplicit(chars, iCount, iBaseLevel);
- FX_BidiResolveWeak(chars, iCount, iBaseLevel);
- FX_BidiResolveNeutrals(chars, iCount, iBaseLevel);
- FX_BidiResolveImplicit(chars, iCount);
- FX_BidiClassify(chars, iCount, true);
- FX_BidiResolveWhitespace(chars, iCount, iBaseLevel);
- FX_BidiReorder(chars, iCount, iBaseLevel);
- FX_BidiPosition(chars, iCount);
+} // namespace
+
+namespace pdfium {
+namespace arabic {
+
+wchar_t GetFormChar(wchar_t wch, wchar_t prev, wchar_t next) {
+ CFX_Char c(wch, kTextLayoutCodeProperties[static_cast<uint16_t>(wch)]);
+ CFX_Char p(prev, kTextLayoutCodeProperties[static_cast<uint16_t>(prev)]);
+ CFX_Char n(next, kTextLayoutCodeProperties[static_cast<uint16_t>(next)]);
+ return GetFormChar(&c, &p, &n);
+}
+
+wchar_t GetFormChar(const CFX_Char* cur,
+ const CFX_Char* prev,
+ const CFX_Char* next) {
+ FX_CHARTYPE eCur;
+ wchar_t wCur;
+ const FX_ARBFORMTABLE* ft = ParseChar(cur, &wCur, &eCur);
+ if (eCur < FX_CHARTYPE_ArabicAlef || eCur >= FX_CHARTYPE_ArabicNormal)
+ return wCur;
+
+ FX_CHARTYPE ePrev;
+ wchar_t wPrev;
+ ParseChar(prev, &wPrev, &ePrev);
+ if (wPrev == 0x0644 && eCur == FX_CHARTYPE_ArabicAlef)
+ return 0xFEFF;
+
+ FX_CHARTYPE eNext;
+ wchar_t wNext;
+ ParseChar(next, &wNext, &eNext);
+ bool bAlef = (eNext == FX_CHARTYPE_ArabicAlef && wCur == 0x644);
+ if (ePrev < FX_CHARTYPE_ArabicAlef) {
+ if (bAlef)
+ return GetArabicFromAlefTable(wNext);
+ return (eNext < FX_CHARTYPE_ArabicAlef) ? ft->wIsolated : ft->wInitial;
}
-};
-void FX_BidiLine(std::vector<CFX_TxtChar>& chars,
- int32_t iCount,
- int32_t iBaseLevel) {
- CFX_BidiLineTemplate<CFX_TxtChar> blt;
- blt.FX_BidiLine(chars, iCount, iBaseLevel);
+ if (bAlef) {
+ wCur = GetArabicFromAlefTable(wNext);
+ return (ePrev != FX_CHARTYPE_ArabicDistortion) ? wCur : ++wCur;
+ }
+
+ if (ePrev == FX_CHARTYPE_ArabicAlef || ePrev == FX_CHARTYPE_ArabicSpecial)
+ return (eNext < FX_CHARTYPE_ArabicAlef) ? ft->wIsolated : ft->wInitial;
+ return (eNext < FX_CHARTYPE_ArabicAlef) ? ft->wFinal : ft->wMedial;
+}
+
+} // namespace arabic
+} // namespace pdfium
+
+wchar_t FX_GetArabicFromShaddaTable(wchar_t shadda) {
+ static const size_t s_iShaddaCount = FX_ArraySize(gs_FX_ShaddaTable);
+ for (size_t iStart = 0; iStart < s_iShaddaCount; iStart++) {
+ const FX_ARASHADDA& v = gs_FX_ShaddaTable[iStart];
+ if (v.wShadda == shadda)
+ return v.wIsolated;
+ }
+ return shadda;
}
-void FX_BidiLine(std::vector<CFX_RTFChar>& chars,
- int32_t iCount,
- int32_t iBaseLevel) {
- CFX_BidiLineTemplate<CFX_RTFChar> blt;
- blt.FX_BidiLine(chars, iCount, iBaseLevel);
+
+void FX_BidiLine(std::vector<CFX_Char>* chars, int32_t iCount) {
+ CFX_BidiLine blt;
+ blt.BidiLine(chars, iCount, 0);
}
diff --git a/chromium/third_party/pdfium/core/fxcrt/fx_arabic.h b/chromium/third_party/pdfium/core/fxcrt/fx_arabic.h
index e7ba079f437..32021c358fb 100644
--- a/chromium/third_party/pdfium/core/fxcrt/fx_arabic.h
+++ b/chromium/third_party/pdfium/core/fxcrt/fx_arabic.h
@@ -7,182 +7,23 @@
#ifndef CORE_FXCRT_FX_ARABIC_H_
#define CORE_FXCRT_FX_ARABIC_H_
-#include "core/fxcrt/fx_arb.h"
+#include <vector>
-#define FX_BIDIMAXLEVEL 61
-#define FX_BidiDirection(a) (FX_IsOdd(a) ? FX_BIDICLASS_R : FX_BIDICLASS_L)
-#define FX_BidiGetDeferredType(a) (((a) >> 4) & 0x0F)
-#define FX_BidiGetResolvedType(a) ((a)&0x0F)
+#include "core/fxcrt/cfx_char.h"
+#include "core/fxcrt/fx_system.h"
namespace pdfium {
namespace arabic {
-bool IsArabicChar(FX_WCHAR wch);
-bool IsArabicFormChar(FX_WCHAR wch);
-FX_WCHAR GetFormChar(FX_WCHAR wch, FX_WCHAR prev = 0, FX_WCHAR next = 0);
-FX_WCHAR GetFormChar(const CFX_Char* cur,
- const CFX_Char* prev,
- const CFX_Char* next);
+wchar_t GetFormChar(wchar_t wch, wchar_t prev, wchar_t next);
+wchar_t GetFormChar(const CFX_Char* cur,
+ const CFX_Char* prev,
+ const CFX_Char* next);
} // namespace arabic
} // namespace pdfium
-void FX_BidiReverseString(CFX_WideString& wsText,
- int32_t iStart,
- int32_t iCount);
-void FX_BidiSetDeferredRun(CFX_ArrayTemplate<int32_t>& values,
- int32_t iStart,
- int32_t iCount,
- int32_t iValue);
-void FX_BidiClassify(const CFX_WideString& wsText,
- CFX_ArrayTemplate<int32_t>& classes,
- bool bWS = false);
-int32_t FX_BidiResolveExplicit(int32_t iBaseLevel,
- int32_t iDirection,
- CFX_ArrayTemplate<int32_t>& classes,
- CFX_ArrayTemplate<int32_t>& levels,
- int32_t iStart,
- int32_t iCount,
- int32_t iNest = 0);
-
-enum FX_BIDIWEAKSTATE {
- FX_BIDIWEAKSTATE_xa = 0,
- FX_BIDIWEAKSTATE_xr,
- FX_BIDIWEAKSTATE_xl,
- FX_BIDIWEAKSTATE_ao,
- FX_BIDIWEAKSTATE_ro,
- FX_BIDIWEAKSTATE_lo,
- FX_BIDIWEAKSTATE_rt,
- FX_BIDIWEAKSTATE_lt,
- FX_BIDIWEAKSTATE_cn,
- FX_BIDIWEAKSTATE_ra,
- FX_BIDIWEAKSTATE_re,
- FX_BIDIWEAKSTATE_la,
- FX_BIDIWEAKSTATE_le,
- FX_BIDIWEAKSTATE_ac,
- FX_BIDIWEAKSTATE_rc,
- FX_BIDIWEAKSTATE_rs,
- FX_BIDIWEAKSTATE_lc,
- FX_BIDIWEAKSTATE_ls,
- FX_BIDIWEAKSTATE_ret,
- FX_BIDIWEAKSTATE_let,
-};
-#define FX_BWSxa FX_BIDIWEAKSTATE_xa
-#define FX_BWSxr FX_BIDIWEAKSTATE_xr
-#define FX_BWSxl FX_BIDIWEAKSTATE_xl
-#define FX_BWSao FX_BIDIWEAKSTATE_ao
-#define FX_BWSro FX_BIDIWEAKSTATE_ro
-#define FX_BWSlo FX_BIDIWEAKSTATE_lo
-#define FX_BWSrt FX_BIDIWEAKSTATE_rt
-#define FX_BWSlt FX_BIDIWEAKSTATE_lt
-#define FX_BWScn FX_BIDIWEAKSTATE_cn
-#define FX_BWSra FX_BIDIWEAKSTATE_ra
-#define FX_BWSre FX_BIDIWEAKSTATE_re
-#define FX_BWSla FX_BIDIWEAKSTATE_la
-#define FX_BWSle FX_BIDIWEAKSTATE_le
-#define FX_BWSac FX_BIDIWEAKSTATE_ac
-#define FX_BWSrc FX_BIDIWEAKSTATE_rc
-#define FX_BWSrs FX_BIDIWEAKSTATE_rs
-#define FX_BWSlc FX_BIDIWEAKSTATE_lc
-#define FX_BWSls FX_BIDIWEAKSTATE_ls
-#define FX_BWSret FX_BIDIWEAKSTATE_ret
-#define FX_BWSlet FX_BIDIWEAKSTATE_let
-
-enum FX_BIDIWEAKACTION {
- FX_BIDIWEAKACTION_IX = 0x100,
- FX_BIDIWEAKACTION_XX = 0x0F,
- FX_BIDIWEAKACTION_xxx = (0x0F << 4) + 0x0F,
- FX_BIDIWEAKACTION_xIx = 0x100 + FX_BIDIWEAKACTION_xxx,
- FX_BIDIWEAKACTION_xxN = (0x0F << 4) + FX_BIDICLASS_ON,
- FX_BIDIWEAKACTION_xxE = (0x0F << 4) + FX_BIDICLASS_EN,
- FX_BIDIWEAKACTION_xxA = (0x0F << 4) + FX_BIDICLASS_AN,
- FX_BIDIWEAKACTION_xxR = (0x0F << 4) + FX_BIDICLASS_R,
- FX_BIDIWEAKACTION_xxL = (0x0F << 4) + FX_BIDICLASS_L,
- FX_BIDIWEAKACTION_Nxx = (FX_BIDICLASS_ON << 4) + 0x0F,
- FX_BIDIWEAKACTION_Axx = (FX_BIDICLASS_AN << 4) + 0x0F,
- FX_BIDIWEAKACTION_ExE = (FX_BIDICLASS_EN << 4) + FX_BIDICLASS_EN,
- FX_BIDIWEAKACTION_NIx = (FX_BIDICLASS_ON << 4) + 0x0F + 0x100,
- FX_BIDIWEAKACTION_NxN = (FX_BIDICLASS_ON << 4) + FX_BIDICLASS_ON,
- FX_BIDIWEAKACTION_NxR = (FX_BIDICLASS_ON << 4) + FX_BIDICLASS_R,
- FX_BIDIWEAKACTION_NxE = (FX_BIDICLASS_ON << 4) + FX_BIDICLASS_EN,
- FX_BIDIWEAKACTION_AxA = (FX_BIDICLASS_AN << 4) + FX_BIDICLASS_AN,
- FX_BIDIWEAKACTION_NxL = (FX_BIDICLASS_ON << 4) + FX_BIDICLASS_L,
- FX_BIDIWEAKACTION_LxL = (FX_BIDICLASS_L << 4) + FX_BIDICLASS_L,
- FX_BIDIWEAKACTION_xIL = (0x0F << 4) + FX_BIDICLASS_L + 0x100,
- FX_BIDIWEAKACTION_AxR = (FX_BIDICLASS_AN << 4) + FX_BIDICLASS_R,
- FX_BIDIWEAKACTION_Lxx = (FX_BIDICLASS_L << 4) + 0x0F,
-};
-#define FX_BWAIX FX_BIDIWEAKACTION_IX
-#define FX_BWAXX FX_BIDIWEAKACTION_XX
-#define FX_BWAxxx FX_BIDIWEAKACTION_xxx
-#define FX_BWAxIx FX_BIDIWEAKACTION_xIx
-#define FX_BWAxxN FX_BIDIWEAKACTION_xxN
-#define FX_BWAxxE FX_BIDIWEAKACTION_xxE
-#define FX_BWAxxA FX_BIDIWEAKACTION_xxA
-#define FX_BWAxxR FX_BIDIWEAKACTION_xxR
-#define FX_BWAxxL FX_BIDIWEAKACTION_xxL
-#define FX_BWANxx FX_BIDIWEAKACTION_Nxx
-#define FX_BWAAxx FX_BIDIWEAKACTION_Axx
-#define FX_BWAExE FX_BIDIWEAKACTION_ExE
-#define FX_BWANIx FX_BIDIWEAKACTION_NIx
-#define FX_BWANxN FX_BIDIWEAKACTION_NxN
-#define FX_BWANxR FX_BIDIWEAKACTION_NxR
-#define FX_BWANxE FX_BIDIWEAKACTION_NxE
-#define FX_BWAAxA FX_BIDIWEAKACTION_AxA
-#define FX_BWANxL FX_BIDIWEAKACTION_NxL
-#define FX_BWALxL FX_BIDIWEAKACTION_LxL
-#define FX_BWAxIL FX_BIDIWEAKACTION_xIL
-#define FX_BWAAxR FX_BIDIWEAKACTION_AxR
-#define FX_BWALxx FX_BIDIWEAKACTION_Lxx
-
-void FX_BidiResolveWeak(int32_t iBaseLevel,
- CFX_ArrayTemplate<int32_t>& classes,
- CFX_ArrayTemplate<int32_t>& levels);
-enum FX_BIDINEUTRALSTATE {
- FX_BIDINEUTRALSTATE_r = 0,
- FX_BIDINEUTRALSTATE_l,
- FX_BIDINEUTRALSTATE_rn,
- FX_BIDINEUTRALSTATE_ln,
- FX_BIDINEUTRALSTATE_a,
- FX_BIDINEUTRALSTATE_na,
-};
-#define FX_BNSr FX_BIDINEUTRALSTATE_r
-#define FX_BNSl FX_BIDINEUTRALSTATE_l
-#define FX_BNSrn FX_BIDINEUTRALSTATE_rn
-#define FX_BNSln FX_BIDINEUTRALSTATE_ln
-#define FX_BNSa FX_BIDINEUTRALSTATE_a
-#define FX_BNSna FX_BIDINEUTRALSTATE_na
-enum FX_BIDINEUTRALACTION {
- FX_BIDINEUTRALACTION_nL = FX_BIDICLASS_L,
- FX_BIDINEUTRALACTION_En = (FX_BIDICLASS_AN << 4),
- FX_BIDINEUTRALACTION_Rn = (FX_BIDICLASS_R << 4),
- FX_BIDINEUTRALACTION_Ln = (FX_BIDICLASS_L << 4),
- FX_BIDINEUTRALACTION_In = FX_BIDIWEAKACTION_IX,
- FX_BIDINEUTRALACTION_LnL = (FX_BIDICLASS_L << 4) + FX_BIDICLASS_L,
-};
-#define FX_BNAnL FX_BIDINEUTRALACTION_nL
-#define FX_BNAEn FX_BIDINEUTRALACTION_En
-#define FX_BNARn FX_BIDINEUTRALACTION_Rn
-#define FX_BNALn FX_BIDINEUTRALACTION_Ln
-#define FX_BNAIn FX_BIDINEUTRALACTION_In
-#define FX_BNALnL FX_BIDINEUTRALACTION_LnL
-int32_t FX_BidiGetDeferredNeutrals(int32_t iAction, int32_t iLevel);
-int32_t FX_BidiGetResolvedNeutrals(int32_t iAction);
-void FX_BidiResolveNeutrals(int32_t iBaseLevel,
- CFX_ArrayTemplate<int32_t>& classes,
- const CFX_ArrayTemplate<int32_t>& levels);
-void FX_BidiResolveImplicit(const CFX_ArrayTemplate<int32_t>& classes,
- CFX_ArrayTemplate<int32_t>& levels);
-void FX_BidiResolveWhitespace(int32_t iBaseLevel,
- const CFX_ArrayTemplate<int32_t>& classes,
- CFX_ArrayTemplate<int32_t>& levels);
-int32_t FX_BidiReorderLevel(int32_t iBaseLevel,
- CFX_WideString& wsText,
- const CFX_ArrayTemplate<int32_t>& levels,
- int32_t iStart,
- bool bReverse = false);
-void FX_BidiReorder(int32_t iBaseLevel,
- CFX_WideString& wsText,
- const CFX_ArrayTemplate<int32_t>& levels);
+wchar_t FX_GetArabicFromShaddaTable(wchar_t shadda);
+void FX_BidiLine(std::vector<CFX_Char>* chars, int32_t iCount);
#endif // CORE_FXCRT_FX_ARABIC_H_
diff --git a/chromium/third_party/pdfium/core/fxcrt/fx_arb.h b/chromium/third_party/pdfium/core/fxcrt/fx_arb.h
deleted file mode 100644
index d24197c7e5c..00000000000
--- a/chromium/third_party/pdfium/core/fxcrt/fx_arb.h
+++ /dev/null
@@ -1,51 +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_FXCRT_FX_ARB_H_
-#define CORE_FXCRT_FX_ARB_H_
-
-#include <vector>
-
-#include "core/fxcrt/fx_system.h"
-#include "core/fxcrt/fx_ucd.h"
-
-struct FX_ARBFORMTABLE {
- uint16_t wIsolated;
- uint16_t wFinal;
- uint16_t wInitial;
- uint16_t wMedial;
-};
-
-struct FX_ARAALEF {
- uint16_t wAlef;
- uint16_t wIsolated;
-};
-
-struct FX_ARASHADDA {
- uint16_t wShadda;
- uint16_t wIsolated;
-};
-
-const FX_ARBFORMTABLE* FX_GetArabicFormTable(FX_WCHAR unicode);
-FX_WCHAR FX_GetArabicFromAlefTable(FX_WCHAR alef);
-FX_WCHAR FX_GetArabicFromShaddaTable(FX_WCHAR shadda);
-
-enum FX_ARBPOSITION {
- FX_ARBPOSITION_Isolated = 0,
- FX_ARBPOSITION_Final,
- FX_ARBPOSITION_Initial,
- FX_ARBPOSITION_Medial,
-};
-
-void FX_BidiLine(CFX_WideString& wsText, int32_t iBaseLevel = 0);
-void FX_BidiLine(std::vector<CFX_TxtChar>& chars,
- int32_t iCount,
- int32_t iBaseLevel = 0);
-void FX_BidiLine(std::vector<CFX_RTFChar>& chars,
- int32_t iCount,
- int32_t iBaseLevel = 0);
-
-#endif // CORE_FXCRT_FX_ARB_H_
diff --git a/chromium/third_party/pdfium/core/fxcrt/fx_basic.h b/chromium/third_party/pdfium/core/fxcrt/fx_basic.h
index 18413b2e706..ed2f579579d 100644
--- a/chromium/third_party/pdfium/core/fxcrt/fx_basic.h
+++ b/chromium/third_party/pdfium/core/fxcrt/fx_basic.h
@@ -70,7 +70,7 @@ class CFX_ByteTextBuf : public CFX_BinaryBuf {
CFX_ByteTextBuf& operator<<(int i);
CFX_ByteTextBuf& operator<<(uint32_t i);
CFX_ByteTextBuf& operator<<(double f);
- CFX_ByteTextBuf& operator<<(const FX_CHAR* pStr) {
+ CFX_ByteTextBuf& operator<<(const char* pStr) {
return *this << CFX_ByteStringC(pStr);
}
CFX_ByteTextBuf& operator<<(const CFX_ByteString& str) {
@@ -82,29 +82,29 @@ class CFX_ByteTextBuf : public CFX_BinaryBuf {
class CFX_WideTextBuf : public CFX_BinaryBuf {
public:
- void AppendChar(FX_WCHAR wch);
- FX_STRSIZE GetLength() const { return m_DataSize / sizeof(FX_WCHAR); }
- FX_WCHAR* GetBuffer() const {
- return reinterpret_cast<FX_WCHAR*>(m_pBuffer.get());
+ void AppendChar(wchar_t wch);
+ FX_STRSIZE GetLength() const { return m_DataSize / sizeof(wchar_t); }
+ wchar_t* GetBuffer() const {
+ return reinterpret_cast<wchar_t*>(m_pBuffer.get());
}
CFX_WideStringC AsStringC() const {
- return CFX_WideStringC(reinterpret_cast<const FX_WCHAR*>(m_pBuffer.get()),
- m_DataSize / sizeof(FX_WCHAR));
+ return CFX_WideStringC(reinterpret_cast<const wchar_t*>(m_pBuffer.get()),
+ m_DataSize / sizeof(wchar_t));
}
CFX_WideString MakeString() const {
- return CFX_WideString(reinterpret_cast<const FX_WCHAR*>(m_pBuffer.get()),
- m_DataSize / sizeof(FX_WCHAR));
+ return CFX_WideString(reinterpret_cast<const wchar_t*>(m_pBuffer.get()),
+ m_DataSize / sizeof(wchar_t));
}
void Delete(int start_index, int count) {
- CFX_BinaryBuf::Delete(start_index * sizeof(FX_WCHAR),
- count * sizeof(FX_WCHAR));
+ CFX_BinaryBuf::Delete(start_index * sizeof(wchar_t),
+ count * sizeof(wchar_t));
}
CFX_WideTextBuf& operator<<(int i);
CFX_WideTextBuf& operator<<(double f);
- CFX_WideTextBuf& operator<<(const FX_WCHAR* lpsz);
+ CFX_WideTextBuf& operator<<(const wchar_t* lpsz);
CFX_WideTextBuf& operator<<(const CFX_WideStringC& str);
CFX_WideTextBuf& operator<<(const CFX_WideString& str);
CFX_WideTextBuf& operator<<(const CFX_WideTextBuf& buf);
@@ -168,7 +168,7 @@ class CFX_UTF8Encoder {
public:
CFX_UTF8Encoder() {}
- void Input(FX_WCHAR unicode);
+ void Input(wchar_t unicode);
void AppendStr(const CFX_ByteStringC& str) { m_Buffer << str; }
CFX_ByteStringC GetResult() const { return m_Buffer.AsStringC(); }
@@ -176,147 +176,6 @@ class CFX_UTF8Encoder {
CFX_ByteTextBuf m_Buffer;
};
-class CFX_BasicArray {
- protected:
- explicit CFX_BasicArray(int unit_size);
- CFX_BasicArray(const CFX_BasicArray&) = delete;
- ~CFX_BasicArray();
-
- bool SetSize(int nNewSize);
- bool Append(const CFX_BasicArray& src);
- bool Copy(const CFX_BasicArray& src);
- uint8_t* InsertSpaceAt(int nIndex, int nCount);
- bool RemoveAt(int nIndex, int nCount);
- bool InsertAt(int nStartIndex, const CFX_BasicArray* pNewArray);
- const void* GetDataPtr(int index) const;
-
- protected:
- uint8_t* m_pData;
- int m_nSize;
- int m_nMaxSize;
- int m_nUnitSize;
-};
-
-template <class TYPE>
-class CFX_ArrayTemplate : public CFX_BasicArray {
- public:
- CFX_ArrayTemplate() : CFX_BasicArray(sizeof(TYPE)) {}
-
- int GetSize() const { return m_nSize; }
-
- int GetUpperBound() const { return m_nSize - 1; }
-
- bool SetSize(int nNewSize) { return CFX_BasicArray::SetSize(nNewSize); }
-
- void RemoveAll() { SetSize(0); }
-
- const TYPE GetAt(int nIndex) const {
- if (nIndex < 0 || nIndex >= m_nSize) {
- PDFIUM_IMMEDIATE_CRASH();
- }
- return ((const TYPE*)m_pData)[nIndex];
- }
-
- bool SetAt(int nIndex, TYPE newElement) {
- if (nIndex < 0 || nIndex >= m_nSize) {
- return false;
- }
- ((TYPE*)m_pData)[nIndex] = newElement;
- return true;
- }
-
- TYPE& ElementAt(int nIndex) {
- if (nIndex < 0 || nIndex >= m_nSize) {
- PDFIUM_IMMEDIATE_CRASH();
- }
- return ((TYPE*)m_pData)[nIndex];
- }
-
- const TYPE* GetData() const { return (const TYPE*)m_pData; }
-
- TYPE* GetData() { return (TYPE*)m_pData; }
-
- bool SetAtGrow(int nIndex, TYPE newElement) {
- if (nIndex < 0)
- return false;
-
- if (nIndex >= m_nSize && !SetSize(nIndex + 1))
- return false;
-
- ((TYPE*)m_pData)[nIndex] = newElement;
- return true;
- }
-
- bool Add(TYPE newElement) {
- if (m_nSize < m_nMaxSize) {
- m_nSize++;
- } else if (!SetSize(m_nSize + 1)) {
- return false;
- }
- ((TYPE*)m_pData)[m_nSize - 1] = newElement;
- return true;
- }
-
- bool Append(const CFX_ArrayTemplate& src) {
- return CFX_BasicArray::Append(src);
- }
-
- bool Copy(const CFX_ArrayTemplate& src) { return CFX_BasicArray::Copy(src); }
-
- TYPE* GetDataPtr(int index) {
- return (TYPE*)CFX_BasicArray::GetDataPtr(index);
- }
-
- TYPE* AddSpace() { return (TYPE*)CFX_BasicArray::InsertSpaceAt(m_nSize, 1); }
-
- TYPE* InsertSpaceAt(int nIndex, int nCount) {
- return (TYPE*)CFX_BasicArray::InsertSpaceAt(nIndex, nCount);
- }
-
- const TYPE operator[](int nIndex) const {
- if (nIndex < 0 || nIndex >= m_nSize) {
- *(volatile char*)0 = '\0';
- }
- return ((const TYPE*)m_pData)[nIndex];
- }
-
- TYPE& operator[](int nIndex) {
- if (nIndex < 0 || nIndex >= m_nSize) {
- *(volatile char*)0 = '\0';
- }
- return ((TYPE*)m_pData)[nIndex];
- }
-
- bool InsertAt(int nIndex, TYPE newElement, int nCount = 1) {
- if (!InsertSpaceAt(nIndex, nCount)) {
- return false;
- }
- while (nCount--) {
- ((TYPE*)m_pData)[nIndex++] = newElement;
- }
- return true;
- }
-
- bool RemoveAt(int nIndex, int nCount = 1) {
- return CFX_BasicArray::RemoveAt(nIndex, nCount);
- }
-
- bool InsertAt(int nStartIndex, const CFX_BasicArray* pNewArray) {
- return CFX_BasicArray::InsertAt(nStartIndex, pNewArray);
- }
-
- int Find(TYPE data, int iStart = 0) const {
- if (iStart < 0) {
- return -1;
- }
- for (; iStart < (int)m_nSize; iStart++)
- if (((TYPE*)m_pData)[iStart] == data) {
- return iStart;
- }
- return -1;
- }
-};
-
template <class DataType, int FixedSize>
class CFX_FixedBufGrow {
public:
@@ -325,7 +184,7 @@ class CFX_FixedBufGrow {
m_pGrowData.reset(FX_Alloc(DataType, data_size));
return;
}
- FXSYS_memset(m_FixedData, 0, sizeof(DataType) * FixedSize);
+ memset(m_FixedData, 0, sizeof(DataType) * FixedSize);
}
operator DataType*() { return m_pGrowData ? m_pGrowData.get() : m_FixedData; }
@@ -338,18 +197,12 @@ class CFX_BitStream {
public:
void Init(const uint8_t* pData, uint32_t dwSize);
- uint32_t GetBits(uint32_t nBits);
-
void ByteAlign();
-
- bool IsEOF() { return m_BitPos >= m_BitSize; }
-
+ bool IsEOF() const { return m_BitPos >= m_BitSize; }
+ uint32_t GetBits(uint32_t nBits);
void SkipBits(uint32_t nBits) { m_BitPos += nBits; }
-
void Rewind() { m_BitPos = 0; }
-
uint32_t GetPos() const { return m_BitPos; }
-
uint32_t BitsRemaining() const {
return m_BitSize >= m_BitPos ? m_BitSize - m_BitPos : 0;
}
@@ -378,182 +231,6 @@ class CFX_AutoRestorer {
const T m_OldValue;
};
-#define FX_DATALIST_LENGTH 1024
-template <size_t unit>
-class CFX_SortListArray {
- protected:
- struct DataList {
- int32_t start;
-
- int32_t count;
- uint8_t* data;
- };
-
- public:
- CFX_SortListArray() : m_CurList(0) {}
-
- ~CFX_SortListArray() { Clear(); }
-
- void Clear() {
- for (int32_t i = m_DataLists.GetUpperBound(); i >= 0; i--) {
- DataList list = m_DataLists.ElementAt(i);
- FX_Free(list.data);
- }
- m_DataLists.RemoveAll();
- m_CurList = 0;
- }
-
- void Append(int32_t nStart, int32_t nCount) {
- if (nStart < 0) {
- return;
- }
- while (nCount > 0) {
- int32_t temp_count = std::min(nCount, FX_DATALIST_LENGTH);
- DataList list;
- list.data = FX_Alloc2D(uint8_t, temp_count, unit);
- list.start = nStart;
- list.count = temp_count;
- Append(list);
- nCount -= temp_count;
- nStart += temp_count;
- }
- }
-
- uint8_t* GetAt(int32_t nIndex) {
- if (nIndex < 0) {
- return nullptr;
- }
- if (m_CurList < 0 || m_CurList >= m_DataLists.GetSize()) {
- return nullptr;
- }
- DataList* pCurList = m_DataLists.GetDataPtr(m_CurList);
- if (!pCurList || nIndex < pCurList->start ||
- nIndex >= pCurList->start + pCurList->count) {
- pCurList = nullptr;
- int32_t iStart = 0;
- int32_t iEnd = m_DataLists.GetUpperBound();
- int32_t iMid = 0;
- while (iStart <= iEnd) {
- iMid = (iStart + iEnd) / 2;
- DataList* list = m_DataLists.GetDataPtr(iMid);
- if (nIndex < list->start) {
- iEnd = iMid - 1;
- } else if (nIndex >= list->start + list->count) {
- iStart = iMid + 1;
- } else {
- pCurList = list;
- m_CurList = iMid;
- break;
- }
- }
- }
- return pCurList ? pCurList->data + (nIndex - pCurList->start) * unit
- : nullptr;
- }
-
- protected:
- void Append(const DataList& list) {
- int32_t iStart = 0;
- int32_t iEnd = m_DataLists.GetUpperBound();
- int32_t iFind = 0;
- while (iStart <= iEnd) {
- int32_t iMid = (iStart + iEnd) / 2;
- DataList* cur_list = m_DataLists.GetDataPtr(iMid);
- if (list.start < cur_list->start + cur_list->count) {
- iEnd = iMid - 1;
- } else {
- if (iMid == iEnd) {
- iFind = iMid + 1;
- break;
- }
- DataList* next_list = m_DataLists.GetDataPtr(iMid + 1);
- if (list.start < next_list->start) {
- iFind = iMid + 1;
- break;
- } else {
- iStart = iMid + 1;
- }
- }
- }
- m_DataLists.InsertAt(iFind, list);
- }
- int32_t m_CurList;
- CFX_ArrayTemplate<DataList> m_DataLists;
-};
-template <typename T1, typename T2>
-class CFX_ListArrayTemplate {
- public:
- void Clear() { m_Data.Clear(); }
-
- void Add(int32_t nStart, int32_t nCount) { m_Data.Append(nStart, nCount); }
-
- T2& operator[](int32_t nIndex) {
- uint8_t* data = m_Data.GetAt(nIndex);
- ASSERT(data);
- return (T2&)(*(volatile T2*)data);
- }
-
- T2* GetPtrAt(int32_t nIndex) { return (T2*)m_Data.GetAt(nIndex); }
-
- protected:
- T1 m_Data;
-};
-typedef CFX_ListArrayTemplate<CFX_SortListArray<sizeof(FX_FILESIZE)>,
- FX_FILESIZE>
- CFX_FileSizeListArray;
-
-class CFX_Vector_3by1 {
- public:
- CFX_Vector_3by1() : a(0.0f), b(0.0f), c(0.0f) {}
-
- CFX_Vector_3by1(FX_FLOAT a1, FX_FLOAT b1, FX_FLOAT c1)
- : a(a1), b(b1), c(c1) {}
-
- FX_FLOAT a;
- FX_FLOAT b;
- FX_FLOAT c;
-};
-class CFX_Matrix_3by3 {
- public:
- CFX_Matrix_3by3()
- : a(0.0f),
- b(0.0f),
- c(0.0f),
- d(0.0f),
- e(0.0f),
- f(0.0f),
- g(0.0f),
- h(0.0f),
- i(0.0f) {}
-
- CFX_Matrix_3by3(FX_FLOAT a1,
- FX_FLOAT b1,
- FX_FLOAT c1,
- FX_FLOAT d1,
- FX_FLOAT e1,
- FX_FLOAT f1,
- FX_FLOAT g1,
- FX_FLOAT h1,
- FX_FLOAT i1)
- : a(a1), b(b1), c(c1), d(d1), e(e1), f(f1), g(g1), h(h1), i(i1) {}
-
- CFX_Matrix_3by3 Inverse();
-
- CFX_Matrix_3by3 Multiply(const CFX_Matrix_3by3& m);
-
- CFX_Vector_3by1 TransformVector(const CFX_Vector_3by1& v);
-
- FX_FLOAT a;
- FX_FLOAT b;
- FX_FLOAT c;
- FX_FLOAT d;
- FX_FLOAT e;
- FX_FLOAT f;
- FX_FLOAT g;
- FX_FLOAT h;
- FX_FLOAT i;
-};
-
uint32_t GetBits32(const uint8_t* pData, int bitpos, int nbits);
#endif // CORE_FXCRT_FX_BASIC_H_
diff --git a/chromium/third_party/pdfium/core/fxcrt/fx_basic_array.cpp b/chromium/third_party/pdfium/core/fxcrt/fx_basic_array.cpp
deleted file mode 100644
index 83c981e9e76..00000000000
--- a/chromium/third_party/pdfium/core/fxcrt/fx_basic_array.cpp
+++ /dev/null
@@ -1,138 +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
-
-#include "core/fxcrt/fx_basic.h"
-#include "third_party/base/numerics/safe_math.h"
-
-CFX_BasicArray::CFX_BasicArray(int unit_size)
- : m_pData(nullptr), m_nSize(0), m_nMaxSize(0) {
- if (unit_size < 0 || unit_size > (1 << 28)) {
- m_nUnitSize = 4;
- } else {
- m_nUnitSize = unit_size;
- }
-}
-CFX_BasicArray::~CFX_BasicArray() {
- FX_Free(m_pData);
-}
-bool CFX_BasicArray::SetSize(int nNewSize) {
- if (nNewSize <= 0) {
- FX_Free(m_pData);
- m_pData = nullptr;
- m_nSize = m_nMaxSize = 0;
- return 0 == nNewSize;
- }
-
- if (!m_pData) {
- pdfium::base::CheckedNumeric<int> totalSize = nNewSize;
- totalSize *= m_nUnitSize;
- if (!totalSize.IsValid()) {
- m_nSize = m_nMaxSize = 0;
- return false;
- }
- m_pData =
- FX_Alloc(uint8_t, pdfium::base::ValueOrDieForType<size_t>(totalSize));
- m_nSize = m_nMaxSize = nNewSize;
- } else if (nNewSize <= m_nMaxSize) {
- if (nNewSize > m_nSize) {
- FXSYS_memset(m_pData + m_nSize * m_nUnitSize, 0,
- (nNewSize - m_nSize) * m_nUnitSize);
- }
- m_nSize = nNewSize;
- } else {
- int nNewMax = nNewSize < m_nMaxSize ? m_nMaxSize : nNewSize;
- pdfium::base::CheckedNumeric<int> totalSize = nNewMax;
- totalSize *= m_nUnitSize;
- if (!totalSize.IsValid() || nNewMax < m_nSize) {
- return false;
- }
- uint8_t* pNewData = FX_Realloc(
- uint8_t, m_pData, pdfium::base::ValueOrDieForType<size_t>(totalSize));
- if (!pNewData) {
- return false;
- }
- FXSYS_memset(pNewData + m_nSize * m_nUnitSize, 0,
- (nNewMax - m_nSize) * m_nUnitSize);
- m_pData = pNewData;
- m_nSize = nNewSize;
- m_nMaxSize = nNewMax;
- }
- return true;
-}
-bool CFX_BasicArray::Append(const CFX_BasicArray& src) {
- int nOldSize = m_nSize;
- pdfium::base::CheckedNumeric<int> newSize = m_nSize;
- newSize += src.m_nSize;
- if (m_nUnitSize != src.m_nUnitSize || !newSize.IsValid() ||
- !SetSize(newSize.ValueOrDie())) {
- return false;
- }
-
- FXSYS_memcpy(m_pData + nOldSize * m_nUnitSize, src.m_pData,
- src.m_nSize * m_nUnitSize);
- return true;
-}
-bool CFX_BasicArray::Copy(const CFX_BasicArray& src) {
- if (!SetSize(src.m_nSize)) {
- return false;
- }
- FXSYS_memcpy(m_pData, src.m_pData, src.m_nSize * m_nUnitSize);
- return true;
-}
-uint8_t* CFX_BasicArray::InsertSpaceAt(int nIndex, int nCount) {
- if (nIndex < 0 || nCount <= 0) {
- return nullptr;
- }
- if (nIndex >= m_nSize) {
- if (!SetSize(nIndex + nCount)) {
- return nullptr;
- }
- } else {
- int nOldSize = m_nSize;
- if (!SetSize(m_nSize + nCount)) {
- return nullptr;
- }
- FXSYS_memmove(m_pData + (nIndex + nCount) * m_nUnitSize,
- m_pData + nIndex * m_nUnitSize,
- (nOldSize - nIndex) * m_nUnitSize);
- FXSYS_memset(m_pData + nIndex * m_nUnitSize, 0, nCount * m_nUnitSize);
- }
- return m_pData + nIndex * m_nUnitSize;
-}
-bool CFX_BasicArray::RemoveAt(int nIndex, int nCount) {
- if (nIndex < 0 || nCount <= 0 || m_nSize < nIndex + nCount) {
- return false;
- }
- int nMoveCount = m_nSize - (nIndex + nCount);
- if (nMoveCount) {
- FXSYS_memmove(m_pData + nIndex * m_nUnitSize,
- m_pData + (nIndex + nCount) * m_nUnitSize,
- nMoveCount * m_nUnitSize);
- }
- m_nSize -= nCount;
- return true;
-}
-bool CFX_BasicArray::InsertAt(int nStartIndex,
- const CFX_BasicArray* pNewArray) {
- if (!pNewArray) {
- return false;
- }
- if (pNewArray->m_nSize == 0) {
- return true;
- }
- if (!InsertSpaceAt(nStartIndex, pNewArray->m_nSize)) {
- return false;
- }
- FXSYS_memcpy(m_pData + nStartIndex * m_nUnitSize, pNewArray->m_pData,
- pNewArray->m_nSize * m_nUnitSize);
- return true;
-}
-const void* CFX_BasicArray::GetDataPtr(int index) const {
- if (index < 0 || index >= m_nSize || !m_pData) {
- return nullptr;
- }
- return m_pData + index * m_nUnitSize;
-}
diff --git a/chromium/third_party/pdfium/core/fxcrt/fx_basic_bstring.cpp b/chromium/third_party/pdfium/core/fxcrt/fx_basic_bstring.cpp
deleted file mode 100644
index 2669474f009..00000000000
--- a/chromium/third_party/pdfium/core/fxcrt/fx_basic_bstring.cpp
+++ /dev/null
@@ -1,1012 +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
-
-#include <stddef.h>
-
-#include <algorithm>
-#include <cctype>
-
-#include "core/fxcrt/cfx_string_pool_template.h"
-#include "core/fxcrt/fx_basic.h"
-#include "third_party/base/numerics/safe_math.h"
-
-template class CFX_StringDataTemplate<FX_CHAR>;
-template class CFX_StringCTemplate<FX_CHAR>;
-template class CFX_StringPoolTemplate<CFX_ByteString>;
-template struct std::hash<CFX_ByteString>;
-
-namespace {
-
-int Buffer_itoa(char* buf, int i, uint32_t flags) {
- if (i == 0) {
- buf[0] = '0';
- return 1;
- }
- char buf1[32];
- int buf_pos = 31;
- uint32_t u = i;
- if ((flags & FXFORMAT_SIGNED) && i < 0) {
- u = -i;
- }
- int base = 10;
- const FX_CHAR* str = "0123456789abcdef";
- if (flags & FXFORMAT_HEX) {
- base = 16;
- if (flags & FXFORMAT_CAPITAL) {
- str = "0123456789ABCDEF";
- }
- }
- while (u != 0) {
- buf1[buf_pos--] = str[u % base];
- u = u / base;
- }
- if ((flags & FXFORMAT_SIGNED) && i < 0) {
- buf1[buf_pos--] = '-';
- }
- int len = 31 - buf_pos;
- for (int ii = 0; ii < len; ii++) {
- buf[ii] = buf1[ii + buf_pos + 1];
- }
- return len;
-}
-
-const FX_CHAR* FX_strstr(const FX_CHAR* haystack,
- int haystack_len,
- const FX_CHAR* needle,
- int needle_len) {
- if (needle_len > haystack_len || needle_len == 0) {
- return nullptr;
- }
- const FX_CHAR* end_ptr = haystack + haystack_len - needle_len;
- while (haystack <= end_ptr) {
- int i = 0;
- while (1) {
- if (haystack[i] != needle[i]) {
- break;
- }
- i++;
- if (i == needle_len) {
- return haystack;
- }
- }
- haystack++;
- }
- return nullptr;
-}
-
-} // namespace
-
-static_assert(sizeof(CFX_ByteString) <= sizeof(FX_CHAR*),
- "Strings must not require more space than pointers");
-
-CFX_ByteString::CFX_ByteString(const FX_CHAR* pStr, FX_STRSIZE nLen) {
- if (nLen < 0)
- nLen = pStr ? FXSYS_strlen(pStr) : 0;
-
- if (nLen)
- m_pData.Reset(StringData::Create(pStr, nLen));
-}
-
-CFX_ByteString::CFX_ByteString(const uint8_t* pStr, FX_STRSIZE nLen) {
- if (nLen > 0) {
- m_pData.Reset(
- StringData::Create(reinterpret_cast<const FX_CHAR*>(pStr), nLen));
- }
-}
-
-CFX_ByteString::CFX_ByteString() {}
-
-CFX_ByteString::CFX_ByteString(const CFX_ByteString& other)
- : m_pData(other.m_pData) {}
-
-CFX_ByteString::CFX_ByteString(CFX_ByteString&& other) {
- m_pData.Swap(other.m_pData);
-}
-
-CFX_ByteString::CFX_ByteString(char ch) {
- m_pData.Reset(StringData::Create(1));
- m_pData->m_String[0] = ch;
-}
-
-CFX_ByteString::CFX_ByteString(const FX_CHAR* ptr)
- : CFX_ByteString(ptr, ptr ? FXSYS_strlen(ptr) : 0) {}
-
-CFX_ByteString::CFX_ByteString(const CFX_ByteStringC& stringSrc) {
- if (!stringSrc.IsEmpty())
- m_pData.Reset(StringData::Create(stringSrc.c_str(), stringSrc.GetLength()));
-}
-
-CFX_ByteString::CFX_ByteString(const CFX_ByteStringC& str1,
- const CFX_ByteStringC& str2) {
- int nNewLen = str1.GetLength() + str2.GetLength();
- if (nNewLen == 0)
- return;
-
- m_pData.Reset(StringData::Create(nNewLen));
- m_pData->CopyContents(str1.c_str(), str1.GetLength());
- m_pData->CopyContentsAt(str1.GetLength(), str2.c_str(), str2.GetLength());
-}
-
-CFX_ByteString::~CFX_ByteString() {}
-
-const CFX_ByteString& CFX_ByteString::operator=(const FX_CHAR* pStr) {
- if (!pStr || !pStr[0])
- clear();
- else
- AssignCopy(pStr, FXSYS_strlen(pStr));
-
- return *this;
-}
-
-const CFX_ByteString& CFX_ByteString::operator=(
- const CFX_ByteStringC& stringSrc) {
- if (stringSrc.IsEmpty())
- clear();
- else
- AssignCopy(stringSrc.c_str(), stringSrc.GetLength());
-
- return *this;
-}
-
-const CFX_ByteString& CFX_ByteString::operator=(
- const CFX_ByteString& stringSrc) {
- if (m_pData != stringSrc.m_pData)
- m_pData = stringSrc.m_pData;
-
- return *this;
-}
-
-const CFX_ByteString& CFX_ByteString::operator+=(const FX_CHAR* pStr) {
- if (pStr)
- Concat(pStr, FXSYS_strlen(pStr));
-
- return *this;
-}
-
-const CFX_ByteString& CFX_ByteString::operator+=(char ch) {
- Concat(&ch, 1);
- return *this;
-}
-
-const CFX_ByteString& CFX_ByteString::operator+=(const CFX_ByteString& str) {
- if (str.m_pData)
- Concat(str.m_pData->m_String, str.m_pData->m_nDataLength);
-
- return *this;
-}
-
-const CFX_ByteString& CFX_ByteString::operator+=(const CFX_ByteStringC& str) {
- if (!str.IsEmpty())
- Concat(str.c_str(), str.GetLength());
-
- return *this;
-}
-
-bool CFX_ByteString::operator==(const char* ptr) const {
- if (!m_pData)
- return !ptr || !ptr[0];
-
- if (!ptr)
- return m_pData->m_nDataLength == 0;
-
- return FXSYS_strlen(ptr) == m_pData->m_nDataLength &&
- FXSYS_memcmp(ptr, m_pData->m_String, m_pData->m_nDataLength) == 0;
-}
-
-bool CFX_ByteString::operator==(const CFX_ByteStringC& str) const {
- if (!m_pData)
- return str.IsEmpty();
-
- return m_pData->m_nDataLength == str.GetLength() &&
- FXSYS_memcmp(m_pData->m_String, str.c_str(), str.GetLength()) == 0;
-}
-
-bool CFX_ByteString::operator==(const CFX_ByteString& other) const {
- if (m_pData == other.m_pData)
- return true;
-
- if (IsEmpty())
- return other.IsEmpty();
-
- if (other.IsEmpty())
- return false;
-
- return other.m_pData->m_nDataLength == m_pData->m_nDataLength &&
- FXSYS_memcmp(other.m_pData->m_String, m_pData->m_String,
- m_pData->m_nDataLength) == 0;
-}
-
-bool CFX_ByteString::operator<(const CFX_ByteString& str) const {
- if (m_pData == str.m_pData)
- return false;
-
- int result = FXSYS_memcmp(c_str(), str.c_str(),
- std::min(GetLength(), str.GetLength()));
- return result < 0 || (result == 0 && GetLength() < str.GetLength());
-}
-
-bool CFX_ByteString::EqualNoCase(const CFX_ByteStringC& str) const {
- if (!m_pData)
- return str.IsEmpty();
-
- FX_STRSIZE len = str.GetLength();
- if (m_pData->m_nDataLength != len)
- return false;
-
- const uint8_t* pThis = (const uint8_t*)m_pData->m_String;
- const uint8_t* pThat = str.raw_str();
- for (FX_STRSIZE i = 0; i < len; i++) {
- if ((*pThis) != (*pThat)) {
- uint8_t bThis = *pThis;
- if (bThis >= 'A' && bThis <= 'Z')
- bThis += 'a' - 'A';
-
- uint8_t bThat = *pThat;
- if (bThat >= 'A' && bThat <= 'Z')
- bThat += 'a' - 'A';
-
- if (bThis != bThat)
- return false;
- }
- pThis++;
- pThat++;
- }
- return true;
-}
-
-void CFX_ByteString::AssignCopy(const FX_CHAR* pSrcData, FX_STRSIZE nSrcLen) {
- AllocBeforeWrite(nSrcLen);
- m_pData->CopyContents(pSrcData, nSrcLen);
- m_pData->m_nDataLength = nSrcLen;
-}
-
-void CFX_ByteString::ReallocBeforeWrite(FX_STRSIZE nNewLength) {
- if (m_pData && m_pData->CanOperateInPlace(nNewLength))
- return;
-
- if (nNewLength <= 0) {
- clear();
- return;
- }
-
- CFX_RetainPtr<StringData> pNewData(StringData::Create(nNewLength));
- if (m_pData) {
- FX_STRSIZE nCopyLength = std::min(m_pData->m_nDataLength, nNewLength);
- pNewData->CopyContents(m_pData->m_String, nCopyLength);
- pNewData->m_nDataLength = nCopyLength;
- } else {
- pNewData->m_nDataLength = 0;
- }
- pNewData->m_String[pNewData->m_nDataLength] = 0;
- m_pData.Swap(pNewData);
-}
-
-void CFX_ByteString::AllocBeforeWrite(FX_STRSIZE nNewLength) {
- if (m_pData && m_pData->CanOperateInPlace(nNewLength))
- return;
-
- if (nNewLength <= 0) {
- clear();
- return;
- }
-
- m_pData.Reset(StringData::Create(nNewLength));
-}
-
-void CFX_ByteString::ReleaseBuffer(FX_STRSIZE nNewLength) {
- if (!m_pData)
- return;
-
- if (nNewLength == -1)
- nNewLength = FXSYS_strlen(m_pData->m_String);
-
- nNewLength = std::min(nNewLength, m_pData->m_nAllocLength);
- if (nNewLength == 0) {
- clear();
- return;
- }
-
- ASSERT(m_pData->m_nRefs == 1);
- m_pData->m_nDataLength = nNewLength;
- m_pData->m_String[nNewLength] = 0;
- if (m_pData->m_nAllocLength - nNewLength >= 32) {
- // Over arbitrary threshold, so pay the price to relocate. Force copy to
- // always occur by holding a second reference to the string.
- CFX_ByteString preserve(*this);
- ReallocBeforeWrite(nNewLength);
- }
-}
-
-void CFX_ByteString::Reserve(FX_STRSIZE len) {
- GetBuffer(len);
-}
-
-FX_CHAR* CFX_ByteString::GetBuffer(FX_STRSIZE nMinBufLength) {
- if (!m_pData) {
- if (nMinBufLength == 0)
- return nullptr;
-
- m_pData.Reset(StringData::Create(nMinBufLength));
- m_pData->m_nDataLength = 0;
- m_pData->m_String[0] = 0;
- return m_pData->m_String;
- }
-
- if (m_pData->CanOperateInPlace(nMinBufLength))
- return m_pData->m_String;
-
- nMinBufLength = std::max(nMinBufLength, m_pData->m_nDataLength);
- if (nMinBufLength == 0)
- return nullptr;
-
- CFX_RetainPtr<StringData> pNewData(StringData::Create(nMinBufLength));
- pNewData->CopyContents(*m_pData);
- pNewData->m_nDataLength = m_pData->m_nDataLength;
- m_pData.Swap(pNewData);
- return m_pData->m_String;
-}
-
-FX_STRSIZE CFX_ByteString::Delete(FX_STRSIZE nIndex, FX_STRSIZE nCount) {
- if (!m_pData)
- return 0;
-
- if (nIndex < 0)
- nIndex = 0;
-
- FX_STRSIZE nOldLength = m_pData->m_nDataLength;
- if (nCount > 0 && nIndex < nOldLength) {
- FX_STRSIZE mLength = nIndex + nCount;
- if (mLength >= nOldLength) {
- m_pData->m_nDataLength = nIndex;
- return m_pData->m_nDataLength;
- }
- ReallocBeforeWrite(nOldLength);
- int nCharsToCopy = nOldLength - mLength + 1;
- FXSYS_memmove(m_pData->m_String + nIndex, m_pData->m_String + mLength,
- nCharsToCopy);
- m_pData->m_nDataLength = nOldLength - nCount;
- }
- return m_pData->m_nDataLength;
-}
-
-void CFX_ByteString::Concat(const FX_CHAR* pSrcData, FX_STRSIZE nSrcLen) {
- if (!pSrcData || nSrcLen <= 0)
- return;
-
- if (!m_pData) {
- m_pData.Reset(StringData::Create(pSrcData, nSrcLen));
- return;
- }
-
- if (m_pData->CanOperateInPlace(m_pData->m_nDataLength + nSrcLen)) {
- m_pData->CopyContentsAt(m_pData->m_nDataLength, pSrcData, nSrcLen);
- m_pData->m_nDataLength += nSrcLen;
- return;
- }
-
- CFX_RetainPtr<StringData> pNewData(
- StringData::Create(m_pData->m_nDataLength + nSrcLen));
- pNewData->CopyContents(*m_pData);
- pNewData->CopyContentsAt(m_pData->m_nDataLength, pSrcData, nSrcLen);
- m_pData.Swap(pNewData);
-}
-
-CFX_ByteString CFX_ByteString::Mid(FX_STRSIZE nFirst) const {
- if (!m_pData)
- return CFX_ByteString();
-
- return Mid(nFirst, m_pData->m_nDataLength - nFirst);
-}
-
-CFX_ByteString CFX_ByteString::Mid(FX_STRSIZE nFirst, FX_STRSIZE nCount) const {
- if (!m_pData)
- return CFX_ByteString();
-
- nFirst = std::min(std::max(nFirst, 0), m_pData->m_nDataLength);
- nCount = std::min(std::max(nCount, 0), m_pData->m_nDataLength - nFirst);
- if (nCount == 0)
- return CFX_ByteString();
-
- if (nFirst == 0 && nCount == m_pData->m_nDataLength)
- return *this;
-
- CFX_ByteString dest;
- AllocCopy(dest, nCount, nFirst);
- return dest;
-}
-
-void CFX_ByteString::AllocCopy(CFX_ByteString& dest,
- FX_STRSIZE nCopyLen,
- FX_STRSIZE nCopyIndex) const {
- if (nCopyLen <= 0)
- return;
-
- CFX_RetainPtr<StringData> pNewData(
- StringData::Create(m_pData->m_String + nCopyIndex, nCopyLen));
- dest.m_pData.Swap(pNewData);
-}
-
-#define FORCE_ANSI 0x10000
-#define FORCE_UNICODE 0x20000
-#define FORCE_INT64 0x40000
-
-CFX_ByteString CFX_ByteString::FormatInteger(int i, uint32_t flags) {
- char buf[32];
- return CFX_ByteString(buf, Buffer_itoa(buf, i, flags));
-}
-
-void CFX_ByteString::FormatV(const FX_CHAR* pFormat, va_list argList) {
- va_list argListSave;
-#if defined(__ARMCC_VERSION) || \
- (!defined(_MSC_VER) && (_FX_CPU_ == _FX_X64_ || _FX_CPU_ == _FX_IA64_ || \
- _FX_CPU_ == _FX_ARM64_)) || \
- defined(__native_client__)
- va_copy(argListSave, argList);
-#else
- argListSave = argList;
-#endif
- int nMaxLen = 0;
- for (const FX_CHAR* pStr = pFormat; *pStr != 0; pStr++) {
- if (*pStr != '%' || *(pStr = pStr + 1) == '%') {
- nMaxLen += FXSYS_strlen(pStr);
- continue;
- }
- int nItemLen = 0;
- int nWidth = 0;
- for (; *pStr != 0; pStr++) {
- if (*pStr == '#') {
- nMaxLen += 2;
- } else if (*pStr == '*') {
- nWidth = va_arg(argList, int);
- } else if (*pStr != '-' && *pStr != '+' && *pStr != '0' && *pStr != ' ') {
- break;
- }
- }
- if (nWidth == 0) {
- nWidth = FXSYS_atoi(pStr);
- while (std::isdigit(*pStr))
- pStr++;
- }
- if (nWidth < 0 || nWidth > 128 * 1024) {
- pFormat = "Bad width";
- nMaxLen = 10;
- break;
- }
- int nPrecision = 0;
- if (*pStr == '.') {
- pStr++;
- if (*pStr == '*') {
- nPrecision = va_arg(argList, int);
- pStr++;
- } else {
- nPrecision = FXSYS_atoi(pStr);
- while (std::isdigit(*pStr))
- pStr++;
- }
- }
- if (nPrecision < 0 || nPrecision > 128 * 1024) {
- pFormat = "Bad precision";
- nMaxLen = 14;
- break;
- }
- int nModifier = 0;
- if (FXSYS_strncmp(pStr, "I64", 3) == 0) {
- pStr += 3;
- nModifier = FORCE_INT64;
- } else {
- switch (*pStr) {
- case 'h':
- nModifier = FORCE_ANSI;
- pStr++;
- break;
- case 'l':
- nModifier = FORCE_UNICODE;
- pStr++;
- break;
- case 'F':
- case 'N':
- case 'L':
- pStr++;
- break;
- }
- }
- switch (*pStr | nModifier) {
- case 'c':
- case 'C':
- nItemLen = 2;
- va_arg(argList, int);
- break;
- case 'c' | FORCE_ANSI:
- case 'C' | FORCE_ANSI:
- nItemLen = 2;
- va_arg(argList, int);
- break;
- case 'c' | FORCE_UNICODE:
- case 'C' | FORCE_UNICODE:
- nItemLen = 2;
- va_arg(argList, int);
- break;
- case 's': {
- const FX_CHAR* pstrNextArg = va_arg(argList, const FX_CHAR*);
- if (pstrNextArg) {
- nItemLen = FXSYS_strlen(pstrNextArg);
- if (nItemLen < 1) {
- nItemLen = 1;
- }
- } else {
- nItemLen = 6;
- }
- } break;
- case 'S': {
- FX_WCHAR* pstrNextArg = va_arg(argList, FX_WCHAR*);
- if (pstrNextArg) {
- nItemLen = FXSYS_wcslen(pstrNextArg);
- if (nItemLen < 1) {
- nItemLen = 1;
- }
- } else {
- nItemLen = 6;
- }
- } break;
- case 's' | FORCE_ANSI:
- case 'S' | FORCE_ANSI: {
- const FX_CHAR* pstrNextArg = va_arg(argList, const FX_CHAR*);
- if (pstrNextArg) {
- nItemLen = FXSYS_strlen(pstrNextArg);
- if (nItemLen < 1) {
- nItemLen = 1;
- }
- } else {
- nItemLen = 6;
- }
- } break;
- case 's' | FORCE_UNICODE:
- case 'S' | FORCE_UNICODE: {
- FX_WCHAR* pstrNextArg = va_arg(argList, FX_WCHAR*);
- if (pstrNextArg) {
- nItemLen = FXSYS_wcslen(pstrNextArg);
- if (nItemLen < 1) {
- nItemLen = 1;
- }
- } else {
- nItemLen = 6;
- }
- } break;
- }
- if (nItemLen != 0) {
- if (nPrecision != 0 && nItemLen > nPrecision) {
- nItemLen = nPrecision;
- }
- if (nItemLen < nWidth) {
- nItemLen = nWidth;
- }
- } else {
- switch (*pStr) {
- case 'd':
- case 'i':
- case 'u':
- case 'x':
- case 'X':
- case 'o':
- if (nModifier & FORCE_INT64) {
- va_arg(argList, int64_t);
- } else {
- va_arg(argList, int);
- }
- nItemLen = 32;
- if (nItemLen < nWidth + nPrecision) {
- nItemLen = nWidth + nPrecision;
- }
- break;
- case 'a':
- case 'A':
- case 'e':
- case 'E':
- case 'g':
- case 'G':
- va_arg(argList, double);
- nItemLen = 128;
- if (nItemLen < nWidth + nPrecision) {
- nItemLen = nWidth + nPrecision;
- }
- break;
- case 'f':
- if (nWidth + nPrecision > 100) {
- nItemLen = nPrecision + nWidth + 128;
- } else {
- char pszTemp[256];
- double f = va_arg(argList, double);
- memset(pszTemp, 0, sizeof(pszTemp));
- FXSYS_snprintf(pszTemp, sizeof(pszTemp) - 1, "%*.*f", nWidth,
- nPrecision + 6, f);
- nItemLen = FXSYS_strlen(pszTemp);
- }
- break;
- case 'p':
- va_arg(argList, void*);
- nItemLen = 32;
- if (nItemLen < nWidth + nPrecision) {
- nItemLen = nWidth + nPrecision;
- }
- break;
- case 'n':
- va_arg(argList, int*);
- break;
- }
- }
- nMaxLen += nItemLen;
- }
- nMaxLen += 32; // Fudge factor.
- GetBuffer(nMaxLen);
- if (m_pData) {
- memset(m_pData->m_String, 0, nMaxLen);
- FXSYS_vsnprintf(m_pData->m_String, nMaxLen - 1, pFormat, argListSave);
- ReleaseBuffer();
- }
- va_end(argListSave);
-}
-
-void CFX_ByteString::Format(const FX_CHAR* pFormat, ...) {
- va_list argList;
- va_start(argList, pFormat);
- FormatV(pFormat, argList);
- va_end(argList);
-}
-
-FX_STRSIZE CFX_ByteString::Insert(FX_STRSIZE nIndex, FX_CHAR ch) {
- FX_STRSIZE nNewLength = m_pData ? m_pData->m_nDataLength : 0;
- nIndex = std::max(nIndex, 0);
- nIndex = std::min(nIndex, nNewLength);
- nNewLength++;
-
- ReallocBeforeWrite(nNewLength);
- FXSYS_memmove(m_pData->m_String + nIndex + 1, m_pData->m_String + nIndex,
- nNewLength - nIndex);
- m_pData->m_String[nIndex] = ch;
- m_pData->m_nDataLength = nNewLength;
- return nNewLength;
-}
-
-CFX_ByteString CFX_ByteString::Right(FX_STRSIZE nCount) const {
- if (!m_pData)
- return CFX_ByteString();
-
- nCount = std::max(nCount, 0);
- if (nCount >= m_pData->m_nDataLength)
- return *this;
-
- CFX_ByteString dest;
- AllocCopy(dest, nCount, m_pData->m_nDataLength - nCount);
- return dest;
-}
-
-CFX_ByteString CFX_ByteString::Left(FX_STRSIZE nCount) const {
- if (!m_pData)
- return CFX_ByteString();
-
- nCount = std::max(nCount, 0);
- if (nCount >= m_pData->m_nDataLength)
- return *this;
-
- CFX_ByteString dest;
- AllocCopy(dest, nCount, 0);
- return dest;
-}
-
-FX_STRSIZE CFX_ByteString::Find(FX_CHAR ch, FX_STRSIZE nStart) const {
- if (!m_pData)
- return -1;
-
- if (nStart < 0 || nStart >= m_pData->m_nDataLength)
- return -1;
-
- const FX_CHAR* pStr = static_cast<const FX_CHAR*>(
- memchr(m_pData->m_String + nStart, ch, m_pData->m_nDataLength - nStart));
- return pStr ? pStr - m_pData->m_String : -1;
-}
-
-FX_STRSIZE CFX_ByteString::ReverseFind(FX_CHAR ch) const {
- if (!m_pData)
- return -1;
-
- FX_STRSIZE nLength = m_pData->m_nDataLength;
- while (nLength--) {
- if (m_pData->m_String[nLength] == ch)
- return nLength;
- }
- return -1;
-}
-
-FX_STRSIZE CFX_ByteString::Find(const CFX_ByteStringC& pSub,
- FX_STRSIZE nStart) const {
- if (!m_pData)
- return -1;
-
- FX_STRSIZE nLength = m_pData->m_nDataLength;
- if (nStart > nLength)
- return -1;
-
- const FX_CHAR* pStr =
- FX_strstr(m_pData->m_String + nStart, m_pData->m_nDataLength - nStart,
- pSub.c_str(), pSub.GetLength());
- return pStr ? (int)(pStr - m_pData->m_String) : -1;
-}
-
-void CFX_ByteString::MakeLower() {
- if (!m_pData)
- return;
-
- ReallocBeforeWrite(m_pData->m_nDataLength);
- FXSYS_strlwr(m_pData->m_String);
-}
-
-void CFX_ByteString::MakeUpper() {
- if (!m_pData)
- return;
-
- ReallocBeforeWrite(m_pData->m_nDataLength);
- FXSYS_strupr(m_pData->m_String);
-}
-
-FX_STRSIZE CFX_ByteString::Remove(FX_CHAR chRemove) {
- if (!m_pData || m_pData->m_nDataLength < 1)
- return 0;
-
- FX_CHAR* pstrSource = m_pData->m_String;
- FX_CHAR* pstrEnd = m_pData->m_String + m_pData->m_nDataLength;
- while (pstrSource < pstrEnd) {
- if (*pstrSource == chRemove)
- break;
- pstrSource++;
- }
- if (pstrSource == pstrEnd)
- return 0;
-
- ptrdiff_t copied = pstrSource - m_pData->m_String;
- ReallocBeforeWrite(m_pData->m_nDataLength);
- pstrSource = m_pData->m_String + copied;
- pstrEnd = m_pData->m_String + m_pData->m_nDataLength;
-
- FX_CHAR* pstrDest = pstrSource;
- while (pstrSource < pstrEnd) {
- if (*pstrSource != chRemove) {
- *pstrDest = *pstrSource;
- pstrDest++;
- }
- pstrSource++;
- }
-
- *pstrDest = 0;
- FX_STRSIZE nCount = (FX_STRSIZE)(pstrSource - pstrDest);
- m_pData->m_nDataLength -= nCount;
- return nCount;
-}
-
-FX_STRSIZE CFX_ByteString::Replace(const CFX_ByteStringC& pOld,
- const CFX_ByteStringC& pNew) {
- if (!m_pData || pOld.IsEmpty())
- return 0;
-
- FX_STRSIZE nSourceLen = pOld.GetLength();
- FX_STRSIZE nReplacementLen = pNew.GetLength();
- FX_STRSIZE nCount = 0;
- const FX_CHAR* pStart = m_pData->m_String;
- FX_CHAR* pEnd = m_pData->m_String + m_pData->m_nDataLength;
- while (1) {
- const FX_CHAR* pTarget = FX_strstr(pStart, (FX_STRSIZE)(pEnd - pStart),
- pOld.c_str(), nSourceLen);
- if (!pTarget)
- break;
-
- nCount++;
- pStart = pTarget + nSourceLen;
- }
- if (nCount == 0)
- return 0;
-
- FX_STRSIZE nNewLength =
- m_pData->m_nDataLength + (nReplacementLen - nSourceLen) * nCount;
-
- if (nNewLength == 0) {
- clear();
- return nCount;
- }
-
- CFX_RetainPtr<StringData> pNewData(StringData::Create(nNewLength));
- pStart = m_pData->m_String;
- FX_CHAR* pDest = pNewData->m_String;
- for (FX_STRSIZE i = 0; i < nCount; i++) {
- const FX_CHAR* pTarget = FX_strstr(pStart, (FX_STRSIZE)(pEnd - pStart),
- pOld.c_str(), nSourceLen);
- FXSYS_memcpy(pDest, pStart, pTarget - pStart);
- pDest += pTarget - pStart;
- FXSYS_memcpy(pDest, pNew.c_str(), pNew.GetLength());
- pDest += pNew.GetLength();
- pStart = pTarget + nSourceLen;
- }
- FXSYS_memcpy(pDest, pStart, pEnd - pStart);
- m_pData.Swap(pNewData);
- return nCount;
-}
-
-void CFX_ByteString::SetAt(FX_STRSIZE nIndex, FX_CHAR ch) {
- if (!m_pData) {
- return;
- }
- ASSERT(nIndex >= 0);
- ASSERT(nIndex < m_pData->m_nDataLength);
- ReallocBeforeWrite(m_pData->m_nDataLength);
- m_pData->m_String[nIndex] = ch;
-}
-
-CFX_WideString CFX_ByteString::UTF8Decode() const {
- CFX_UTF8Decoder decoder;
- for (FX_STRSIZE i = 0; i < GetLength(); i++) {
- decoder.Input((uint8_t)m_pData->m_String[i]);
- }
- return CFX_WideString(decoder.GetResult());
-}
-
-// static
-CFX_ByteString CFX_ByteString::FromUnicode(const FX_WCHAR* str,
- FX_STRSIZE len) {
- FX_STRSIZE str_len = len >= 0 ? len : FXSYS_wcslen(str);
- return FromUnicode(CFX_WideString(str, str_len));
-}
-
-// static
-CFX_ByteString CFX_ByteString::FromUnicode(const CFX_WideString& str) {
- return CFX_CharMap::GetByteString(0, str.AsStringC());
-}
-
-int CFX_ByteString::Compare(const CFX_ByteStringC& str) const {
- if (!m_pData) {
- return str.IsEmpty() ? 0 : -1;
- }
- int this_len = m_pData->m_nDataLength;
- int that_len = str.GetLength();
- int min_len = this_len < that_len ? this_len : that_len;
- for (int i = 0; i < min_len; i++) {
- if ((uint8_t)m_pData->m_String[i] < str.GetAt(i)) {
- return -1;
- }
- if ((uint8_t)m_pData->m_String[i] > str.GetAt(i)) {
- return 1;
- }
- }
- if (this_len < that_len) {
- return -1;
- }
- if (this_len > that_len) {
- return 1;
- }
- return 0;
-}
-
-void CFX_ByteString::TrimRight(const CFX_ByteStringC& pTargets) {
- if (!m_pData || pTargets.IsEmpty()) {
- return;
- }
- FX_STRSIZE pos = GetLength();
- if (pos < 1) {
- return;
- }
- while (pos) {
- FX_STRSIZE i = 0;
- while (i < pTargets.GetLength() &&
- pTargets[i] != m_pData->m_String[pos - 1]) {
- i++;
- }
- if (i == pTargets.GetLength()) {
- break;
- }
- pos--;
- }
- if (pos < m_pData->m_nDataLength) {
- ReallocBeforeWrite(m_pData->m_nDataLength);
- m_pData->m_String[pos] = 0;
- m_pData->m_nDataLength = pos;
- }
-}
-
-void CFX_ByteString::TrimRight(FX_CHAR chTarget) {
- TrimRight(CFX_ByteStringC(chTarget));
-}
-
-void CFX_ByteString::TrimRight() {
- TrimRight("\x09\x0a\x0b\x0c\x0d\x20");
-}
-
-void CFX_ByteString::TrimLeft(const CFX_ByteStringC& pTargets) {
- if (!m_pData || pTargets.IsEmpty())
- return;
-
- FX_STRSIZE len = GetLength();
- if (len < 1)
- return;
-
- FX_STRSIZE pos = 0;
- while (pos < len) {
- FX_STRSIZE i = 0;
- while (i < pTargets.GetLength() && pTargets[i] != m_pData->m_String[pos]) {
- i++;
- }
- if (i == pTargets.GetLength()) {
- break;
- }
- pos++;
- }
- if (pos) {
- ReallocBeforeWrite(len);
- FX_STRSIZE nDataLength = len - pos;
- FXSYS_memmove(m_pData->m_String, m_pData->m_String + pos,
- (nDataLength + 1) * sizeof(FX_CHAR));
- m_pData->m_nDataLength = nDataLength;
- }
-}
-
-void CFX_ByteString::TrimLeft(FX_CHAR chTarget) {
- TrimLeft(CFX_ByteStringC(chTarget));
-}
-
-void CFX_ByteString::TrimLeft() {
- TrimLeft("\x09\x0a\x0b\x0c\x0d\x20");
-}
-
-uint32_t CFX_ByteString::GetID(FX_STRSIZE start_pos) const {
- return AsStringC().GetID(start_pos);
-}
-FX_STRSIZE FX_ftoa(FX_FLOAT d, FX_CHAR* buf) {
- buf[0] = '0';
- buf[1] = '\0';
- if (d == 0.0f) {
- return 1;
- }
- bool bNegative = false;
- if (d < 0) {
- bNegative = true;
- d = -d;
- }
- int scale = 1;
- int scaled = FXSYS_round(d);
- while (scaled < 100000) {
- if (scale == 1000000) {
- break;
- }
- scale *= 10;
- scaled = FXSYS_round(d * scale);
- }
- if (scaled == 0) {
- return 1;
- }
- char buf2[32];
- int buf_size = 0;
- if (bNegative) {
- buf[buf_size++] = '-';
- }
- int i = scaled / scale;
- FXSYS_itoa(i, buf2, 10);
- FX_STRSIZE len = FXSYS_strlen(buf2);
- FXSYS_memcpy(buf + buf_size, buf2, len);
- buf_size += len;
- int fraction = scaled % scale;
- if (fraction == 0) {
- return buf_size;
- }
- buf[buf_size++] = '.';
- scale /= 10;
- while (fraction) {
- buf[buf_size++] = '0' + fraction / scale;
- fraction %= scale;
- scale /= 10;
- }
- return buf_size;
-}
-CFX_ByteString CFX_ByteString::FormatFloat(FX_FLOAT d, int precision) {
- FX_CHAR buf[32];
- FX_STRSIZE len = FX_ftoa(d, buf);
- return CFX_ByteString(buf, len);
-}
diff --git a/chromium/third_party/pdfium/core/fxcrt/fx_basic_bstring_unittest.cpp b/chromium/third_party/pdfium/core/fxcrt/fx_basic_bstring_unittest.cpp
deleted file mode 100644
index 503e68458ab..00000000000
--- a/chromium/third_party/pdfium/core/fxcrt/fx_basic_bstring_unittest.cpp
+++ /dev/null
@@ -1,1102 +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.
-
-#include "core/fxcrt/fx_string.h"
-#include "testing/fx_string_testhelpers.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-TEST(fxcrt, ByteStringOperatorSubscript) {
- // CFX_ByteString includes the NUL terminator for non-empty strings.
- CFX_ByteString abc("abc");
- EXPECT_EQ('a', abc[0]);
- EXPECT_EQ('b', abc[1]);
- EXPECT_EQ('c', abc[2]);
- EXPECT_EQ(0, abc[3]);
-}
-
-TEST(fxcrt, ByteStringOperatorLT) {
- CFX_ByteString empty;
- CFX_ByteString a("a");
- CFX_ByteString abc("abc");
- CFX_ByteString def("def");
-
- EXPECT_FALSE(empty < empty);
- EXPECT_FALSE(a < a);
- EXPECT_FALSE(abc < abc);
- EXPECT_FALSE(def < def);
-
- EXPECT_TRUE(empty < a);
- EXPECT_FALSE(a < empty);
-
- EXPECT_TRUE(empty < abc);
- EXPECT_FALSE(abc < empty);
-
- EXPECT_TRUE(empty < def);
- EXPECT_FALSE(def < empty);
-
- EXPECT_TRUE(a < abc);
- EXPECT_FALSE(abc < a);
-
- EXPECT_TRUE(a < def);
- EXPECT_FALSE(def < a);
-
- EXPECT_TRUE(abc < def);
- EXPECT_FALSE(def < abc);
-}
-
-TEST(fxcrt, ByteStringOperatorEQ) {
- CFX_ByteString null_string;
- EXPECT_TRUE(null_string == null_string);
-
- CFX_ByteString empty_string("");
- EXPECT_TRUE(empty_string == empty_string);
- EXPECT_TRUE(empty_string == null_string);
- EXPECT_TRUE(null_string == empty_string);
-
- CFX_ByteString deleted_string("hello");
- deleted_string.Delete(0, 5);
- EXPECT_TRUE(deleted_string == deleted_string);
- EXPECT_TRUE(deleted_string == null_string);
- EXPECT_TRUE(deleted_string == empty_string);
- EXPECT_TRUE(null_string == deleted_string);
- EXPECT_TRUE(empty_string == deleted_string);
-
- CFX_ByteString byte_string("hello");
- EXPECT_TRUE(byte_string == byte_string);
- EXPECT_FALSE(byte_string == null_string);
- EXPECT_FALSE(byte_string == empty_string);
- EXPECT_FALSE(byte_string == deleted_string);
- EXPECT_FALSE(null_string == byte_string);
- EXPECT_FALSE(empty_string == byte_string);
- EXPECT_FALSE(deleted_string == byte_string);
-
- CFX_ByteString byte_string_same1("hello");
- EXPECT_TRUE(byte_string == byte_string_same1);
- EXPECT_TRUE(byte_string_same1 == byte_string);
-
- CFX_ByteString byte_string_same2(byte_string);
- EXPECT_TRUE(byte_string == byte_string_same2);
- EXPECT_TRUE(byte_string_same2 == byte_string);
-
- CFX_ByteString byte_string1("he");
- CFX_ByteString byte_string2("hellp");
- CFX_ByteString byte_string3("hellod");
- EXPECT_FALSE(byte_string == byte_string1);
- EXPECT_FALSE(byte_string == byte_string2);
- EXPECT_FALSE(byte_string == byte_string3);
- EXPECT_FALSE(byte_string1 == byte_string);
- EXPECT_FALSE(byte_string2 == byte_string);
- EXPECT_FALSE(byte_string3 == byte_string);
-
- CFX_ByteStringC null_string_c;
- CFX_ByteStringC empty_string_c("");
- EXPECT_TRUE(null_string == null_string_c);
- EXPECT_TRUE(null_string == empty_string_c);
- EXPECT_TRUE(empty_string == null_string_c);
- EXPECT_TRUE(empty_string == empty_string_c);
- EXPECT_TRUE(deleted_string == null_string_c);
- EXPECT_TRUE(deleted_string == empty_string_c);
- EXPECT_TRUE(null_string_c == null_string);
- EXPECT_TRUE(empty_string_c == null_string);
- EXPECT_TRUE(null_string_c == empty_string);
- EXPECT_TRUE(empty_string_c == empty_string);
- EXPECT_TRUE(null_string_c == deleted_string);
- EXPECT_TRUE(empty_string_c == deleted_string);
-
- CFX_ByteStringC byte_string_c_same1("hello");
- EXPECT_TRUE(byte_string == byte_string_c_same1);
- EXPECT_TRUE(byte_string_c_same1 == byte_string);
-
- CFX_ByteStringC byte_string_c1("he");
- CFX_ByteStringC byte_string_c2("hellp");
- CFX_ByteStringC byte_string_c3("hellod");
- EXPECT_FALSE(byte_string == byte_string_c1);
- EXPECT_FALSE(byte_string == byte_string_c2);
- EXPECT_FALSE(byte_string == byte_string_c3);
- EXPECT_FALSE(byte_string_c1 == byte_string);
- EXPECT_FALSE(byte_string_c2 == byte_string);
- EXPECT_FALSE(byte_string_c3 == byte_string);
-
- const char* c_null_string = nullptr;
- const char* c_empty_string = "";
- EXPECT_TRUE(null_string == c_null_string);
- EXPECT_TRUE(null_string == c_empty_string);
- EXPECT_TRUE(empty_string == c_null_string);
- EXPECT_TRUE(empty_string == c_empty_string);
- EXPECT_TRUE(deleted_string == c_null_string);
- EXPECT_TRUE(deleted_string == c_empty_string);
- EXPECT_TRUE(c_null_string == null_string);
- EXPECT_TRUE(c_empty_string == null_string);
- EXPECT_TRUE(c_null_string == empty_string);
- EXPECT_TRUE(c_empty_string == empty_string);
- EXPECT_TRUE(c_null_string == deleted_string);
- EXPECT_TRUE(c_empty_string == deleted_string);
-
- const char* c_string_same1 = "hello";
- EXPECT_TRUE(byte_string == c_string_same1);
- EXPECT_TRUE(c_string_same1 == byte_string);
-
- const char* c_string1 = "he";
- const char* c_string2 = "hellp";
- const char* c_string3 = "hellod";
- EXPECT_FALSE(byte_string == c_string1);
- EXPECT_FALSE(byte_string == c_string2);
- EXPECT_FALSE(byte_string == c_string3);
- EXPECT_FALSE(c_string1 == byte_string);
- EXPECT_FALSE(c_string2 == byte_string);
- EXPECT_FALSE(c_string3 == byte_string);
-}
-
-TEST(fxcrt, ByteStringOperatorNE) {
- CFX_ByteString null_string;
- EXPECT_FALSE(null_string != null_string);
-
- CFX_ByteString empty_string("");
- EXPECT_FALSE(empty_string != empty_string);
- EXPECT_FALSE(empty_string != null_string);
- EXPECT_FALSE(null_string != empty_string);
-
- CFX_ByteString deleted_string("hello");
- deleted_string.Delete(0, 5);
- EXPECT_FALSE(deleted_string != deleted_string);
- EXPECT_FALSE(deleted_string != null_string);
- EXPECT_FALSE(deleted_string != empty_string);
- EXPECT_FALSE(deleted_string != deleted_string);
- EXPECT_FALSE(null_string != deleted_string);
- EXPECT_FALSE(empty_string != deleted_string);
- EXPECT_FALSE(deleted_string != deleted_string);
-
- CFX_ByteString byte_string("hello");
- EXPECT_FALSE(byte_string != byte_string);
- EXPECT_TRUE(byte_string != null_string);
- EXPECT_TRUE(byte_string != empty_string);
- EXPECT_TRUE(byte_string != deleted_string);
- EXPECT_TRUE(null_string != byte_string);
- EXPECT_TRUE(empty_string != byte_string);
- EXPECT_TRUE(deleted_string != byte_string);
-
- CFX_ByteString byte_string_same1("hello");
- EXPECT_FALSE(byte_string != byte_string_same1);
- EXPECT_FALSE(byte_string_same1 != byte_string);
-
- CFX_ByteString byte_string_same2(byte_string);
- EXPECT_FALSE(byte_string != byte_string_same2);
- EXPECT_FALSE(byte_string_same2 != byte_string);
-
- CFX_ByteString byte_string1("he");
- CFX_ByteString byte_string2("hellp");
- CFX_ByteString byte_string3("hellod");
- EXPECT_TRUE(byte_string != byte_string1);
- EXPECT_TRUE(byte_string != byte_string2);
- EXPECT_TRUE(byte_string != byte_string3);
- EXPECT_TRUE(byte_string1 != byte_string);
- EXPECT_TRUE(byte_string2 != byte_string);
- EXPECT_TRUE(byte_string3 != byte_string);
-
- CFX_ByteStringC null_string_c;
- CFX_ByteStringC empty_string_c("");
- EXPECT_FALSE(null_string != null_string_c);
- EXPECT_FALSE(null_string != empty_string_c);
- EXPECT_FALSE(empty_string != null_string_c);
- EXPECT_FALSE(empty_string != empty_string_c);
- EXPECT_FALSE(null_string_c != null_string);
- EXPECT_FALSE(empty_string_c != null_string);
- EXPECT_FALSE(null_string_c != empty_string);
- EXPECT_FALSE(empty_string_c != empty_string);
-
- CFX_ByteStringC byte_string_c_same1("hello");
- EXPECT_FALSE(byte_string != byte_string_c_same1);
- EXPECT_FALSE(byte_string_c_same1 != byte_string);
-
- CFX_ByteStringC byte_string_c1("he");
- CFX_ByteStringC byte_string_c2("hellp");
- CFX_ByteStringC byte_string_c3("hellod");
- EXPECT_TRUE(byte_string != byte_string_c1);
- EXPECT_TRUE(byte_string != byte_string_c2);
- EXPECT_TRUE(byte_string != byte_string_c3);
- EXPECT_TRUE(byte_string_c1 != byte_string);
- EXPECT_TRUE(byte_string_c2 != byte_string);
- EXPECT_TRUE(byte_string_c3 != byte_string);
-
- const char* c_null_string = nullptr;
- const char* c_empty_string = "";
- EXPECT_FALSE(null_string != c_null_string);
- EXPECT_FALSE(null_string != c_empty_string);
- EXPECT_FALSE(empty_string != c_null_string);
- EXPECT_FALSE(empty_string != c_empty_string);
- EXPECT_FALSE(deleted_string != c_null_string);
- EXPECT_FALSE(deleted_string != c_empty_string);
- EXPECT_FALSE(c_null_string != null_string);
- EXPECT_FALSE(c_empty_string != null_string);
- EXPECT_FALSE(c_null_string != empty_string);
- EXPECT_FALSE(c_empty_string != empty_string);
- EXPECT_FALSE(c_null_string != deleted_string);
- EXPECT_FALSE(c_empty_string != deleted_string);
-
- const char* c_string_same1 = "hello";
- EXPECT_FALSE(byte_string != c_string_same1);
- EXPECT_FALSE(c_string_same1 != byte_string);
-
- const char* c_string1 = "he";
- const char* c_string2 = "hellp";
- const char* c_string3 = "hellod";
- EXPECT_TRUE(byte_string != c_string1);
- EXPECT_TRUE(byte_string != c_string2);
- EXPECT_TRUE(byte_string != c_string3);
- EXPECT_TRUE(c_string1 != byte_string);
- EXPECT_TRUE(c_string2 != byte_string);
- EXPECT_TRUE(c_string3 != byte_string);
-}
-
-TEST(fxcrt, ByteStringCNull) {
- CFX_ByteStringC null_string;
- EXPECT_FALSE(null_string.raw_str());
- EXPECT_EQ(null_string.GetLength(), 0);
- EXPECT_TRUE(null_string.IsEmpty());
-
- CFX_ByteStringC another_null_string;
- EXPECT_EQ(null_string, another_null_string);
-
- CFX_ByteStringC copied_null_string(null_string);
- EXPECT_FALSE(copied_null_string.raw_str());
- EXPECT_EQ(copied_null_string.GetLength(), 0);
- EXPECT_TRUE(copied_null_string.IsEmpty());
- EXPECT_EQ(null_string, copied_null_string);
-
- CFX_ByteStringC empty_string(""); // Pointer to NUL, not NULL pointer.
- EXPECT_TRUE(empty_string.raw_str());
- EXPECT_EQ(empty_string.GetLength(), 0);
- EXPECT_TRUE(empty_string.IsEmpty());
- EXPECT_EQ(null_string, empty_string);
-
- CFX_ByteStringC assigned_null_string("initially not nullptr");
- assigned_null_string = null_string;
- EXPECT_FALSE(assigned_null_string.raw_str());
- EXPECT_EQ(assigned_null_string.GetLength(), 0);
- EXPECT_TRUE(assigned_null_string.IsEmpty());
- EXPECT_EQ(null_string, assigned_null_string);
-
- CFX_ByteStringC assigned_nullptr_string("initially not nullptr");
- assigned_nullptr_string = (const FX_CHAR*)nullptr;
- EXPECT_FALSE(assigned_nullptr_string.raw_str());
- EXPECT_EQ(assigned_nullptr_string.GetLength(), 0);
- EXPECT_TRUE(assigned_nullptr_string.IsEmpty());
- EXPECT_EQ(null_string, assigned_nullptr_string);
-
- CFX_ByteStringC non_null_string("a");
- EXPECT_NE(null_string, non_null_string);
-}
-
-TEST(fxcrt, ByteStringConcat) {
- CFX_ByteString fred;
- fred.Concat("FRED", 4);
- EXPECT_EQ("FRED", fred);
-
- fred.Concat("DY", 2);
- EXPECT_EQ("FREDDY", fred);
-
- fred.Delete(3, 3);
- EXPECT_EQ("FRE", fred);
-
- fred.Concat("D", 1);
- EXPECT_EQ("FRED", fred);
-
- CFX_ByteString copy = fred;
- fred.Concat("DY", 2);
- EXPECT_EQ("FREDDY", fred);
- EXPECT_EQ("FRED", copy);
-
- // Test invalid arguments.
- copy = fred;
- fred.Concat("freddy", -6);
- CFX_ByteString not_aliased("xxxxxx");
- EXPECT_EQ("FREDDY", fred);
- EXPECT_EQ("xxxxxx", not_aliased);
-}
-
-TEST(fxcrt, ByteStringRemove) {
- CFX_ByteString freed("FREED");
- freed.Remove('E');
- EXPECT_EQ("FRD", freed);
- freed.Remove('F');
- EXPECT_EQ("RD", freed);
- freed.Remove('D');
- EXPECT_EQ("R", freed);
- freed.Remove('X');
- EXPECT_EQ("R", freed);
- freed.Remove('R');
- EXPECT_EQ("", freed);
-
- CFX_ByteString empty;
- empty.Remove('X');
- EXPECT_EQ("", empty);
-}
-
-TEST(fxcrt, ByteStringRemoveCopies) {
- CFX_ByteString freed("FREED");
- const FX_CHAR* old_buffer = freed.c_str();
-
- // No change with single reference - no copy.
- freed.Remove('Q');
- EXPECT_EQ("FREED", freed);
- EXPECT_EQ(old_buffer, freed.c_str());
-
- // Change with single reference - no copy.
- freed.Remove('E');
- EXPECT_EQ("FRD", freed);
- EXPECT_EQ(old_buffer, freed.c_str());
-
- // No change with multiple references - no copy.
- CFX_ByteString shared(freed);
- freed.Remove('Q');
- EXPECT_EQ("FRD", freed);
- EXPECT_EQ(old_buffer, freed.c_str());
- EXPECT_EQ(old_buffer, shared.c_str());
-
- // Change with multiple references -- must copy.
- freed.Remove('D');
- EXPECT_EQ("FR", freed);
- EXPECT_NE(old_buffer, freed.c_str());
- EXPECT_EQ("FRD", shared);
- EXPECT_EQ(old_buffer, shared.c_str());
-}
-
-TEST(fxcrt, ByteStringReplace) {
- CFX_ByteString fred("FRED");
- fred.Replace("FR", "BL");
- EXPECT_EQ("BLED", fred);
- fred.Replace("D", "DDY");
- EXPECT_EQ("BLEDDY", fred);
- fred.Replace("LEDD", "");
- EXPECT_EQ("BY", fred);
- fred.Replace("X", "CLAMS");
- EXPECT_EQ("BY", fred);
- fred.Replace("BY", "HI");
- EXPECT_EQ("HI", fred);
- fred.Replace("", "CLAMS");
- EXPECT_EQ("HI", fred);
- fred.Replace("HI", "");
- EXPECT_EQ("", fred);
-}
-
-TEST(fxcrt, ByteStringInsert) {
- CFX_ByteString fred("FRED");
- fred.Insert(-1, 'X');
- EXPECT_EQ("XFRED", fred);
- fred.Insert(0, 'S');
- EXPECT_EQ("SXFRED", fred);
- fred.Insert(2, 'T');
- EXPECT_EQ("SXTFRED", fred);
- fred.Insert(5, 'U');
- EXPECT_EQ("SXTFRUED", fred);
- fred.Insert(8, 'V');
- EXPECT_EQ("SXTFRUEDV", fred);
- fred.Insert(12, 'P');
- EXPECT_EQ("SXTFRUEDVP", fred);
- {
- CFX_ByteString empty;
- empty.Insert(-1, 'X');
- EXPECT_EQ("X", empty);
- }
- {
- CFX_ByteString empty;
- empty.Insert(0, 'X');
- EXPECT_EQ("X", empty);
- }
- {
- CFX_ByteString empty;
- empty.Insert(5, 'X');
- EXPECT_EQ("X", empty);
- }
-}
-
-TEST(fxcrt, ByteStringDelete) {
- CFX_ByteString fred("FRED");
- fred.Delete(0, 2);
- EXPECT_EQ("ED", fred);
- fred.Delete(1);
- EXPECT_EQ("E", fred);
- fred.Delete(-1);
- EXPECT_EQ("", fred);
- fred.Delete(1);
- EXPECT_EQ("", fred);
-
- CFX_ByteString empty;
- empty.Delete(0);
- EXPECT_EQ("", empty);
- empty.Delete(-1);
- EXPECT_EQ("", empty);
- empty.Delete(1);
- EXPECT_EQ("", empty);
-}
-
-TEST(fxcrt, ByteStringMid) {
- CFX_ByteString fred("FRED");
- EXPECT_EQ("", fred.Mid(0, 0));
- EXPECT_EQ("", fred.Mid(3, 0));
- EXPECT_EQ("FRED", fred.Mid(0));
- EXPECT_EQ("RED", fred.Mid(1));
- EXPECT_EQ("ED", fred.Mid(2));
- EXPECT_EQ("D", fred.Mid(3));
- EXPECT_EQ("F", fred.Mid(0, 1));
- EXPECT_EQ("R", fred.Mid(1, 1));
- EXPECT_EQ("E", fred.Mid(2, 1));
- EXPECT_EQ("D", fred.Mid(3, 1));
- EXPECT_EQ("FR", fred.Mid(0, 2));
- EXPECT_EQ("FRED", fred.Mid(0, 4));
- EXPECT_EQ("FRED", fred.Mid(0, 10));
-
- EXPECT_EQ("FR", fred.Mid(-1, 2));
- EXPECT_EQ("RED", fred.Mid(1, 4));
- EXPECT_EQ("", fred.Mid(4, 1));
-
- CFX_ByteString empty;
- EXPECT_EQ("", empty.Mid(0, 0));
- EXPECT_EQ("", empty.Mid(0));
- EXPECT_EQ("", empty.Mid(1));
- EXPECT_EQ("", empty.Mid(-1));
-}
-
-TEST(fxcrt, ByteStringLeft) {
- CFX_ByteString fred("FRED");
- EXPECT_EQ("", fred.Left(0));
- EXPECT_EQ("F", fred.Left(1));
- EXPECT_EQ("FR", fred.Left(2));
- EXPECT_EQ("FRE", fred.Left(3));
- EXPECT_EQ("FRED", fred.Left(4));
-
- EXPECT_EQ("FRED", fred.Left(5));
- EXPECT_EQ("", fred.Left(-1));
-
- CFX_ByteString empty;
- EXPECT_EQ("", empty.Left(0));
- EXPECT_EQ("", empty.Left(1));
- EXPECT_EQ("", empty.Left(-1));
-}
-
-TEST(fxcrt, ByteStringRight) {
- CFX_ByteString fred("FRED");
- EXPECT_EQ("", fred.Right(0));
- EXPECT_EQ("D", fred.Right(1));
- EXPECT_EQ("ED", fred.Right(2));
- EXPECT_EQ("RED", fred.Right(3));
- EXPECT_EQ("FRED", fred.Right(4));
-
- EXPECT_EQ("FRED", fred.Right(5));
- EXPECT_EQ("", fred.Right(-1));
-
- CFX_ByteString empty;
- EXPECT_EQ("", empty.Right(0));
- EXPECT_EQ("", empty.Right(1));
- EXPECT_EQ("", empty.Right(-1));
-}
-
-TEST(fxcrt, ByteStringUpperLower) {
- CFX_ByteString fred("F-Re.42D");
- fred.MakeLower();
- EXPECT_EQ("f-re.42d", fred);
- fred.MakeUpper();
- EXPECT_EQ("F-RE.42D", fred);
-
- CFX_ByteString empty;
- empty.MakeLower();
- EXPECT_EQ("", empty);
- empty.MakeUpper();
- EXPECT_EQ("", empty);
-}
-
-TEST(fxcrt, ByteStringTrimRight) {
- CFX_ByteString fred(" FRED ");
- fred.TrimRight();
- EXPECT_EQ(" FRED", fred);
- fred.TrimRight('E');
- EXPECT_EQ(" FRED", fred);
- fred.TrimRight('D');
- EXPECT_EQ(" FRE", fred);
- fred.TrimRight("ERP");
- EXPECT_EQ(" F", fred);
-
- CFX_ByteString blank(" ");
- blank.TrimRight("ERP");
- EXPECT_EQ(" ", blank);
- blank.TrimRight('E');
- EXPECT_EQ(" ", blank);
- blank.TrimRight();
- EXPECT_EQ("", blank);
-
- CFX_ByteString empty;
- empty.TrimRight("ERP");
- EXPECT_EQ("", empty);
- empty.TrimRight('E');
- EXPECT_EQ("", empty);
- empty.TrimRight();
- EXPECT_EQ("", empty);
-}
-
-TEST(fxcrt, ByteStringTrimRightCopies) {
- {
- // With a single reference, no copy takes place.
- CFX_ByteString fred(" FRED ");
- const FX_CHAR* old_buffer = fred.c_str();
- fred.TrimRight();
- EXPECT_EQ(" FRED", fred);
- EXPECT_EQ(old_buffer, fred.c_str());
- }
- {
- // With multiple references, we must copy.
- CFX_ByteString fred(" FRED ");
- CFX_ByteString other_fred = fred;
- const FX_CHAR* old_buffer = fred.c_str();
- fred.TrimRight();
- EXPECT_EQ(" FRED", fred);
- EXPECT_EQ(" FRED ", other_fred);
- EXPECT_NE(old_buffer, fred.c_str());
- }
- {
- // With multiple references, but no modifications, no copy.
- CFX_ByteString fred("FRED");
- CFX_ByteString other_fred = fred;
- const FX_CHAR* old_buffer = fred.c_str();
- fred.TrimRight();
- EXPECT_EQ("FRED", fred);
- EXPECT_EQ("FRED", other_fred);
- EXPECT_EQ(old_buffer, fred.c_str());
- }
-}
-
-TEST(fxcrt, ByteStringTrimLeft) {
- CFX_ByteString fred(" FRED ");
- fred.TrimLeft();
- EXPECT_EQ("FRED ", fred);
- fred.TrimLeft('E');
- EXPECT_EQ("FRED ", fred);
- fred.TrimLeft('F');
- EXPECT_EQ("RED ", fred);
- fred.TrimLeft("ERP");
- EXPECT_EQ("D ", fred);
-
- CFX_ByteString blank(" ");
- blank.TrimLeft("ERP");
- EXPECT_EQ(" ", blank);
- blank.TrimLeft('E');
- EXPECT_EQ(" ", blank);
- blank.TrimLeft();
- EXPECT_EQ("", blank);
-
- CFX_ByteString empty;
- empty.TrimLeft("ERP");
- EXPECT_EQ("", empty);
- empty.TrimLeft('E');
- EXPECT_EQ("", empty);
- empty.TrimLeft();
- EXPECT_EQ("", empty);
-}
-
-TEST(fxcrt, ByteStringTrimLeftCopies) {
- {
- // With a single reference, no copy takes place.
- CFX_ByteString fred(" FRED ");
- const FX_CHAR* old_buffer = fred.c_str();
- fred.TrimLeft();
- EXPECT_EQ("FRED ", fred);
- EXPECT_EQ(old_buffer, fred.c_str());
- }
- {
- // With multiple references, we must copy.
- CFX_ByteString fred(" FRED ");
- CFX_ByteString other_fred = fred;
- const FX_CHAR* old_buffer = fred.c_str();
- fred.TrimLeft();
- EXPECT_EQ("FRED ", fred);
- EXPECT_EQ(" FRED ", other_fred);
- EXPECT_NE(old_buffer, fred.c_str());
- }
- {
- // With multiple references, but no modifications, no copy.
- CFX_ByteString fred("FRED");
- CFX_ByteString other_fred = fred;
- const FX_CHAR* old_buffer = fred.c_str();
- fred.TrimLeft();
- EXPECT_EQ("FRED", fred);
- EXPECT_EQ("FRED", other_fred);
- EXPECT_EQ(old_buffer, fred.c_str());
- }
-}
-
-TEST(fxcrt, ByteStringReserve) {
- {
- CFX_ByteString str;
- str.Reserve(6);
- const FX_CHAR* old_buffer = str.c_str();
- str += "ABCDEF";
- EXPECT_EQ(old_buffer, str.c_str());
- str += "Blah Blah Blah Blah Blah Blah";
- EXPECT_NE(old_buffer, str.c_str());
- }
- {
- CFX_ByteString str("A");
- str.Reserve(6);
- const FX_CHAR* old_buffer = str.c_str();
- str += "BCDEF";
- EXPECT_EQ(old_buffer, str.c_str());
- str += "Blah Blah Blah Blah Blah Blah";
- EXPECT_NE(old_buffer, str.c_str());
- }
-}
-
-TEST(fxcrt, ByteStringGetBuffer) {
- {
- CFX_ByteString str;
- FX_CHAR* buffer = str.GetBuffer(12);
- // NOLINTNEXTLINE(runtime/printf)
- strcpy(buffer, "clams");
- str.ReleaseBuffer();
- EXPECT_EQ("clams", str);
- }
- {
- CFX_ByteString str("cl");
- FX_CHAR* buffer = str.GetBuffer(12);
- // NOLINTNEXTLINE(runtime/printf)
- strcpy(buffer + 2, "ams");
- str.ReleaseBuffer();
- EXPECT_EQ("clams", str);
- }
-}
-
-TEST(fxcrt, ByteStringReleaseBuffer) {
- {
- CFX_ByteString str;
- str.Reserve(12);
- str += "clams";
- const FX_CHAR* old_buffer = str.c_str();
- str.ReleaseBuffer(4);
- EXPECT_EQ(old_buffer, str.c_str());
- EXPECT_EQ("clam", str);
- }
- {
- CFX_ByteString str("c");
- str.Reserve(12);
- str += "lams";
- const FX_CHAR* old_buffer = str.c_str();
- str.ReleaseBuffer(4);
- EXPECT_EQ(old_buffer, str.c_str());
- EXPECT_EQ("clam", str);
- }
- {
- CFX_ByteString str;
- str.Reserve(200);
- str += "clams";
- const FX_CHAR* old_buffer = str.c_str();
- str.ReleaseBuffer(4);
- EXPECT_NE(old_buffer, str.c_str());
- EXPECT_EQ("clam", str);
- }
- {
- CFX_ByteString str("c");
- str.Reserve(200);
- str += "lams";
- const FX_CHAR* old_buffer = str.c_str();
- str.ReleaseBuffer(4);
- EXPECT_NE(old_buffer, str.c_str());
- EXPECT_EQ("clam", str);
- }
-}
-
-TEST(fxcrt, ByteStringCNotNull) {
- CFX_ByteStringC string3("abc");
- CFX_ByteStringC string6("abcdef");
- CFX_ByteStringC alternate_string3("abcdef", 3);
- CFX_ByteStringC embedded_nul_string7("abc\0def", 7);
- CFX_ByteStringC illegal_string7("abcdef", 7);
-
- EXPECT_EQ(3, string3.GetLength());
- EXPECT_EQ(6, string6.GetLength());
- EXPECT_EQ(3, alternate_string3.GetLength());
- EXPECT_EQ(7, embedded_nul_string7.GetLength());
- EXPECT_EQ(7, illegal_string7.GetLength());
-
- EXPECT_NE(string3, string6);
- EXPECT_EQ(string3, alternate_string3);
- EXPECT_NE(string3, embedded_nul_string7);
- EXPECT_NE(string3, illegal_string7);
- EXPECT_NE(string6, alternate_string3);
- EXPECT_NE(string6, embedded_nul_string7);
- EXPECT_NE(string6, illegal_string7);
- EXPECT_NE(alternate_string3, embedded_nul_string7);
- EXPECT_NE(alternate_string3, illegal_string7);
- EXPECT_NE(embedded_nul_string7, illegal_string7);
-
- CFX_ByteStringC copied_string3(string3);
- CFX_ByteStringC copied_alternate_string3(alternate_string3);
- CFX_ByteStringC copied_embedded_nul_string7(embedded_nul_string7);
-
- EXPECT_EQ(string3, copied_string3);
- EXPECT_EQ(alternate_string3, copied_alternate_string3);
- EXPECT_EQ(embedded_nul_string7, copied_embedded_nul_string7);
-
- CFX_ByteStringC assigned_string3("intially something else");
- CFX_ByteStringC assigned_alternate_string3("initally something else");
- CFX_ByteStringC assigned_ptr_string3("initially something else");
- CFX_ByteStringC assigned_embedded_nul_string7("initially something else");
-
- assigned_string3 = string3;
- assigned_alternate_string3 = alternate_string3;
- assigned_ptr_string3 = "abc";
- assigned_embedded_nul_string7 = embedded_nul_string7;
- EXPECT_EQ(string3, assigned_string3);
- EXPECT_EQ(alternate_string3, assigned_alternate_string3);
- EXPECT_EQ(alternate_string3, assigned_ptr_string3);
- EXPECT_EQ(embedded_nul_string7, assigned_embedded_nul_string7);
-}
-
-TEST(fxcrt, ByteStringCFromChar) {
- CFX_ByteStringC null_string;
- CFX_ByteStringC lower_a_string("a");
-
- // Must have lvalues that outlive the corresponding ByteStringC.
- char nul = '\0';
- char lower_a = 'a';
- CFX_ByteStringC nul_string_from_char(nul);
- CFX_ByteStringC lower_a_string_from_char(lower_a);
-
- // Pointer to nul, not nullptr ptr, hence length 1 ...
- EXPECT_EQ(1, nul_string_from_char.GetLength());
- EXPECT_NE(null_string, nul_string_from_char);
-
- EXPECT_EQ(1, lower_a_string_from_char.GetLength());
- EXPECT_EQ(lower_a_string, lower_a_string_from_char);
- EXPECT_NE(nul_string_from_char, lower_a_string_from_char);
-
- CFX_ByteStringC longer_string("ab");
- EXPECT_NE(longer_string, lower_a_string_from_char);
-}
-
-TEST(fxcrt, ByteStringCGetID) {
- CFX_ByteStringC null_string;
- EXPECT_EQ(0u, null_string.GetID());
- EXPECT_EQ(0u, null_string.GetID(1));
- EXPECT_EQ(0u, null_string.GetID(-1));
- EXPECT_EQ(0u, null_string.GetID(-1000000));
-
- CFX_ByteStringC empty_string("");
- EXPECT_EQ(0u, empty_string.GetID());
- EXPECT_EQ(0u, empty_string.GetID(1));
- EXPECT_EQ(0u, empty_string.GetID(-1));
- EXPECT_EQ(0u, empty_string.GetID(-1000000));
-
- CFX_ByteStringC short_string("ab");
- EXPECT_EQ(FXBSTR_ID('a', 'b', 0, 0), short_string.GetID());
- EXPECT_EQ(FXBSTR_ID('b', 0, 0, 0), short_string.GetID(1));
- EXPECT_EQ(0u, short_string.GetID(2));
- EXPECT_EQ(0u, short_string.GetID(-1));
- EXPECT_EQ(0u, short_string.GetID(-1000000));
-
- CFX_ByteStringC longer_string("abcdef");
- EXPECT_EQ(FXBSTR_ID('a', 'b', 'c', 'd'), longer_string.GetID());
- EXPECT_EQ(FXBSTR_ID('b', 'c', 'd', 'e'), longer_string.GetID(1));
- EXPECT_EQ(FXBSTR_ID('c', 'd', 'e', 'f'), longer_string.GetID(2));
- EXPECT_EQ(FXBSTR_ID('d', 'e', 'f', 0), longer_string.GetID(3));
- EXPECT_EQ(FXBSTR_ID('e', 'f', 0, 0), longer_string.GetID(4));
- EXPECT_EQ(FXBSTR_ID('f', 0, 0, 0), longer_string.GetID(5));
- EXPECT_EQ(0u, longer_string.GetID(6));
- EXPECT_EQ(0u, longer_string.GetID(-1));
- EXPECT_EQ(0u, longer_string.GetID(-1000000));
-}
-
-TEST(fxcrt, ByteStringCFind) {
- CFX_ByteStringC null_string;
- EXPECT_EQ(-1, null_string.Find('a'));
- EXPECT_EQ(-1, null_string.Find(0));
-
- CFX_ByteStringC empty_string("");
- EXPECT_EQ(-1, empty_string.Find('a'));
- EXPECT_EQ(-1, empty_string.Find(0));
-
- CFX_ByteStringC single_string("a");
- EXPECT_EQ(0, single_string.Find('a'));
- EXPECT_EQ(-1, single_string.Find('b'));
- EXPECT_EQ(-1, single_string.Find(0));
-
- CFX_ByteStringC longer_string("abccc");
- EXPECT_EQ(0, longer_string.Find('a'));
- EXPECT_EQ(2, longer_string.Find('c'));
- EXPECT_EQ(-1, longer_string.Find(0));
-
- CFX_ByteStringC hibyte_string(
- "ab\x8c"
- "def");
- EXPECT_EQ(2, hibyte_string.Find('\x8c'));
-}
-
-TEST(fxcrt, ByteStringCMid) {
- CFX_ByteStringC null_string;
- EXPECT_EQ(null_string, null_string.Mid(0, 1));
- EXPECT_EQ(null_string, null_string.Mid(1, 1));
-
- CFX_ByteStringC empty_string("");
- EXPECT_EQ(empty_string, empty_string.Mid(0, 1));
- EXPECT_EQ(empty_string, empty_string.Mid(1, 1));
-
- CFX_ByteStringC single_character("a");
- EXPECT_EQ(empty_string, single_character.Mid(0, 0));
- EXPECT_EQ(single_character, single_character.Mid(0, 1));
- EXPECT_EQ(empty_string, single_character.Mid(1, 0));
- EXPECT_EQ(empty_string, single_character.Mid(1, 1));
-
- CFX_ByteStringC longer_string("abcdef");
- EXPECT_EQ(longer_string, longer_string.Mid(0, 6));
- EXPECT_EQ(longer_string, longer_string.Mid(0, 187));
- EXPECT_EQ(longer_string, longer_string.Mid(-42, 6));
- EXPECT_EQ(longer_string, longer_string.Mid(-42, 187));
-
- CFX_ByteStringC leading_substring("ab");
- EXPECT_EQ(leading_substring, longer_string.Mid(0, 2));
- EXPECT_EQ(leading_substring, longer_string.Mid(-1, 2));
-
- CFX_ByteStringC middle_substring("bcde");
- EXPECT_EQ(middle_substring, longer_string.Mid(1, 4));
-
- CFX_ByteStringC trailing_substring("ef");
- EXPECT_EQ(trailing_substring, longer_string.Mid(4, 2));
- EXPECT_EQ(trailing_substring, longer_string.Mid(4, 3));
-}
-
-TEST(fxcrt, ByteStringCGetAt) {
- CFX_ByteString short_string("a");
- CFX_ByteString longer_string("abc");
- CFX_ByteString embedded_nul_string("ab\0c", 4);
-
- EXPECT_EQ('a', short_string.GetAt(0));
- EXPECT_EQ('c', longer_string.GetAt(2));
- EXPECT_EQ('b', embedded_nul_string.GetAt(1));
- EXPECT_EQ('\0', embedded_nul_string.GetAt(2));
- EXPECT_EQ('c', embedded_nul_string.GetAt(3));
-}
-
-TEST(fxcrt, ByteStringCOperatorSubscript) {
- // CFX_ByteStringC includes the NUL terminator for non-empty strings.
- CFX_ByteStringC abc("abc");
- EXPECT_EQ('a', abc[0]);
- EXPECT_EQ('b', abc[1]);
- EXPECT_EQ('c', abc[2]);
- EXPECT_EQ(0, abc[3]);
-}
-
-TEST(fxcrt, ByteStringCOperatorLT) {
- CFX_ByteStringC empty;
- CFX_ByteStringC a("a");
- CFX_ByteStringC abc("abc");
- CFX_ByteStringC def("def");
-
- EXPECT_FALSE(empty < empty);
- EXPECT_FALSE(a < a);
- EXPECT_FALSE(abc < abc);
- EXPECT_FALSE(def < def);
-
- EXPECT_TRUE(empty < a);
- EXPECT_FALSE(a < empty);
-
- EXPECT_TRUE(empty < abc);
- EXPECT_FALSE(abc < empty);
-
- EXPECT_TRUE(empty < def);
- EXPECT_FALSE(def < empty);
-
- EXPECT_TRUE(a < abc);
- EXPECT_FALSE(abc < a);
-
- EXPECT_TRUE(a < def);
- EXPECT_FALSE(def < a);
-
- EXPECT_TRUE(abc < def);
- EXPECT_FALSE(def < abc);
-}
-
-TEST(fxcrt, ByteStringCOperatorEQ) {
- CFX_ByteStringC byte_string_c("hello");
- EXPECT_TRUE(byte_string_c == byte_string_c);
-
- CFX_ByteStringC byte_string_c_same1("hello");
- EXPECT_TRUE(byte_string_c == byte_string_c_same1);
- EXPECT_TRUE(byte_string_c_same1 == byte_string_c);
-
- CFX_ByteStringC byte_string_c_same2(byte_string_c);
- EXPECT_TRUE(byte_string_c == byte_string_c_same2);
- EXPECT_TRUE(byte_string_c_same2 == byte_string_c);
-
- CFX_ByteStringC byte_string_c1("he");
- CFX_ByteStringC byte_string_c2("hellp");
- CFX_ByteStringC byte_string_c3("hellod");
- EXPECT_FALSE(byte_string_c == byte_string_c1);
- EXPECT_FALSE(byte_string_c == byte_string_c2);
- EXPECT_FALSE(byte_string_c == byte_string_c3);
- EXPECT_FALSE(byte_string_c1 == byte_string_c);
- EXPECT_FALSE(byte_string_c2 == byte_string_c);
- EXPECT_FALSE(byte_string_c3 == byte_string_c);
-
- CFX_ByteString byte_string_same1("hello");
- EXPECT_TRUE(byte_string_c == byte_string_same1);
- EXPECT_TRUE(byte_string_same1 == byte_string_c);
-
- CFX_ByteString byte_string1("he");
- CFX_ByteString byte_string2("hellp");
- CFX_ByteString byte_string3("hellod");
- EXPECT_FALSE(byte_string_c == byte_string1);
- EXPECT_FALSE(byte_string_c == byte_string2);
- EXPECT_FALSE(byte_string_c == byte_string3);
- EXPECT_FALSE(byte_string1 == byte_string_c);
- EXPECT_FALSE(byte_string2 == byte_string_c);
- EXPECT_FALSE(byte_string3 == byte_string_c);
-
- const char* c_string_same1 = "hello";
- EXPECT_TRUE(byte_string_c == c_string_same1);
- EXPECT_TRUE(c_string_same1 == byte_string_c);
-
- const char* c_string1 = "he";
- const char* c_string2 = "hellp";
- const char* c_string3 = "hellod";
- EXPECT_FALSE(byte_string_c == c_string1);
- EXPECT_FALSE(byte_string_c == c_string2);
- EXPECT_FALSE(byte_string_c == c_string3);
-
- EXPECT_FALSE(c_string1 == byte_string_c);
- EXPECT_FALSE(c_string2 == byte_string_c);
- EXPECT_FALSE(c_string3 == byte_string_c);
-}
-
-TEST(fxcrt, ByteStringCOperatorNE) {
- CFX_ByteStringC byte_string_c("hello");
- EXPECT_FALSE(byte_string_c != byte_string_c);
-
- CFX_ByteStringC byte_string_c_same1("hello");
- EXPECT_FALSE(byte_string_c != byte_string_c_same1);
- EXPECT_FALSE(byte_string_c_same1 != byte_string_c);
-
- CFX_ByteStringC byte_string_c_same2(byte_string_c);
- EXPECT_FALSE(byte_string_c != byte_string_c_same2);
- EXPECT_FALSE(byte_string_c_same2 != byte_string_c);
-
- CFX_ByteStringC byte_string_c1("he");
- CFX_ByteStringC byte_string_c2("hellp");
- CFX_ByteStringC byte_string_c3("hellod");
- EXPECT_TRUE(byte_string_c != byte_string_c1);
- EXPECT_TRUE(byte_string_c != byte_string_c2);
- EXPECT_TRUE(byte_string_c != byte_string_c3);
- EXPECT_TRUE(byte_string_c1 != byte_string_c);
- EXPECT_TRUE(byte_string_c2 != byte_string_c);
- EXPECT_TRUE(byte_string_c3 != byte_string_c);
-
- CFX_ByteString byte_string_same1("hello");
- EXPECT_FALSE(byte_string_c != byte_string_same1);
- EXPECT_FALSE(byte_string_same1 != byte_string_c);
-
- CFX_ByteString byte_string1("he");
- CFX_ByteString byte_string2("hellp");
- CFX_ByteString byte_string3("hellod");
- EXPECT_TRUE(byte_string_c != byte_string1);
- EXPECT_TRUE(byte_string_c != byte_string2);
- EXPECT_TRUE(byte_string_c != byte_string3);
- EXPECT_TRUE(byte_string1 != byte_string_c);
- EXPECT_TRUE(byte_string2 != byte_string_c);
- EXPECT_TRUE(byte_string3 != byte_string_c);
-
- const char* c_string_same1 = "hello";
- EXPECT_FALSE(byte_string_c != c_string_same1);
- EXPECT_FALSE(c_string_same1 != byte_string_c);
-
- const char* c_string1 = "he";
- const char* c_string2 = "hellp";
- const char* c_string3 = "hellod";
- EXPECT_TRUE(byte_string_c != c_string1);
- EXPECT_TRUE(byte_string_c != c_string2);
- EXPECT_TRUE(byte_string_c != c_string3);
-
- EXPECT_TRUE(c_string1 != byte_string_c);
- EXPECT_TRUE(c_string2 != byte_string_c);
- EXPECT_TRUE(c_string3 != byte_string_c);
-}
-
-TEST(fxcrt, ByteStringFormatWidth) {
- {
- CFX_ByteString str;
- str.Format("%5d", 1);
- EXPECT_EQ(" 1", str);
- }
-
- {
- CFX_ByteString str;
- str.Format("%d", 1);
- EXPECT_EQ("1", str);
- }
-
- {
- CFX_ByteString str;
- str.Format("%*d", 5, 1);
- EXPECT_EQ(" 1", str);
- }
-
- {
- CFX_ByteString str;
- str.Format("%-1d", 1);
- EXPECT_EQ("1", str);
- }
-
- {
- CFX_ByteString str;
- str.Format("%0d", 1);
- EXPECT_EQ("1", str);
- }
-
- {
- CFX_ByteString str;
- str.Format("%1048576d", 1);
- EXPECT_EQ("Bad width", str);
- }
-}
-
-TEST(fxcrt, ByteStringFormatPrecision) {
- {
- CFX_ByteString str;
- str.Format("%.2f", 1.12345);
- EXPECT_EQ("1.12", str);
- }
-
- {
- CFX_ByteString str;
- str.Format("%.*f", 3, 1.12345);
- EXPECT_EQ("1.123", str);
- }
-
- {
- CFX_ByteString str;
- str.Format("%f", 1.12345);
- EXPECT_EQ("1.123450", str);
- }
-
- {
- CFX_ByteString str;
- str.Format("%-1f", 1.12345);
- EXPECT_EQ("1.123450", str);
- }
-
- {
- CFX_ByteString str;
- str.Format("%0f", 1.12345);
- EXPECT_EQ("1.123450", str);
- }
-
- {
- CFX_ByteString str;
- str.Format("%.1048576f", 1.2);
- EXPECT_EQ("Bad precision", str);
- }
-}
-
-TEST(fxcrt, EmptyByteString) {
- CFX_ByteString empty_str;
- EXPECT_TRUE(empty_str.IsEmpty());
- EXPECT_EQ(0, empty_str.GetLength());
- const FX_CHAR* cstr = empty_str.c_str();
- EXPECT_EQ(0, FXSYS_strlen(cstr));
-}
diff --git a/chromium/third_party/pdfium/core/fxcrt/fx_basic_buffer.cpp b/chromium/third_party/pdfium/core/fxcrt/fx_basic_buffer.cpp
index 14a85c2ee5e..701676f71ef 100644
--- a/chromium/third_party/pdfium/core/fxcrt/fx_basic_buffer.cpp
+++ b/chromium/third_party/pdfium/core/fxcrt/fx_basic_buffer.cpp
@@ -28,9 +28,8 @@ void CFX_BinaryBuf::Delete(int start_index, int count) {
start_index > m_DataSize - count) {
return;
}
- FXSYS_memmove(m_pBuffer.get() + start_index,
- m_pBuffer.get() + start_index + count,
- m_DataSize - start_index - count);
+ memmove(m_pBuffer.get() + start_index, m_pBuffer.get() + start_index + count,
+ m_DataSize - start_index - count);
m_DataSize -= count;
}
@@ -72,9 +71,9 @@ void CFX_BinaryBuf::AppendBlock(const void* pBuf, FX_STRSIZE size) {
ExpandBuf(size);
if (pBuf) {
- FXSYS_memcpy(m_pBuffer.get() + m_DataSize, pBuf, size);
+ memcpy(m_pBuffer.get() + m_DataSize, pBuf, size);
} else {
- FXSYS_memset(m_pBuffer.get() + m_DataSize, 0, size);
+ memset(m_pBuffer.get() + m_DataSize, 0, size);
}
m_DataSize += size;
}
@@ -86,12 +85,12 @@ void CFX_BinaryBuf::InsertBlock(FX_STRSIZE pos,
return;
ExpandBuf(size);
- FXSYS_memmove(m_pBuffer.get() + pos + size, m_pBuffer.get() + pos,
- m_DataSize - pos);
+ memmove(m_pBuffer.get() + pos + size, m_pBuffer.get() + pos,
+ m_DataSize - pos);
if (pBuf) {
- FXSYS_memcpy(m_pBuffer.get() + pos, pBuf, size);
+ memcpy(m_pBuffer.get() + pos, pBuf, size);
} else {
- FXSYS_memset(m_pBuffer.get() + pos, 0, size);
+ memset(m_pBuffer.get() + pos, 0, size);
}
m_DataSize += size;
}
@@ -117,7 +116,7 @@ CFX_ByteTextBuf& CFX_ByteTextBuf::operator<<(uint32_t i) {
CFX_ByteTextBuf& CFX_ByteTextBuf::operator<<(double f) {
char buf[32];
- FX_STRSIZE len = FX_ftoa((FX_FLOAT)f, buf);
+ FX_STRSIZE len = FX_ftoa((float)f, buf);
AppendBlock(buf, len);
return *this;
}
@@ -127,19 +126,19 @@ CFX_ByteTextBuf& CFX_ByteTextBuf::operator<<(const CFX_ByteTextBuf& buf) {
return *this;
}
-void CFX_WideTextBuf::AppendChar(FX_WCHAR ch) {
- ExpandBuf(sizeof(FX_WCHAR));
- *(FX_WCHAR*)(m_pBuffer.get() + m_DataSize) = ch;
- m_DataSize += sizeof(FX_WCHAR);
+void CFX_WideTextBuf::AppendChar(wchar_t ch) {
+ ExpandBuf(sizeof(wchar_t));
+ *(wchar_t*)(m_pBuffer.get() + m_DataSize) = ch;
+ m_DataSize += sizeof(wchar_t);
}
CFX_WideTextBuf& CFX_WideTextBuf::operator<<(const CFX_WideStringC& str) {
- AppendBlock(str.c_str(), str.GetLength() * sizeof(FX_WCHAR));
+ AppendBlock(str.c_str(), str.GetLength() * sizeof(wchar_t));
return *this;
}
CFX_WideTextBuf& CFX_WideTextBuf::operator<<(const CFX_WideString& str) {
- AppendBlock(str.c_str(), str.GetLength() * sizeof(FX_WCHAR));
+ AppendBlock(str.c_str(), str.GetLength() * sizeof(wchar_t));
return *this;
}
@@ -147,29 +146,29 @@ CFX_WideTextBuf& CFX_WideTextBuf::operator<<(int i) {
char buf[32];
FXSYS_itoa(i, buf, 10);
FX_STRSIZE len = FXSYS_strlen(buf);
- ExpandBuf(len * sizeof(FX_WCHAR));
- FX_WCHAR* str = (FX_WCHAR*)(m_pBuffer.get() + m_DataSize);
+ ExpandBuf(len * sizeof(wchar_t));
+ wchar_t* str = (wchar_t*)(m_pBuffer.get() + m_DataSize);
for (FX_STRSIZE j = 0; j < len; j++) {
*str++ = buf[j];
}
- m_DataSize += len * sizeof(FX_WCHAR);
+ m_DataSize += len * sizeof(wchar_t);
return *this;
}
CFX_WideTextBuf& CFX_WideTextBuf::operator<<(double f) {
char buf[32];
- FX_STRSIZE len = FX_ftoa((FX_FLOAT)f, buf);
- ExpandBuf(len * sizeof(FX_WCHAR));
- FX_WCHAR* str = (FX_WCHAR*)(m_pBuffer.get() + m_DataSize);
+ FX_STRSIZE len = FX_ftoa((float)f, buf);
+ ExpandBuf(len * sizeof(wchar_t));
+ wchar_t* str = (wchar_t*)(m_pBuffer.get() + m_DataSize);
for (FX_STRSIZE i = 0; i < len; i++) {
*str++ = buf[i];
}
- m_DataSize += len * sizeof(FX_WCHAR);
+ m_DataSize += len * sizeof(wchar_t);
return *this;
}
-CFX_WideTextBuf& CFX_WideTextBuf::operator<<(const FX_WCHAR* lpsz) {
- AppendBlock(lpsz, FXSYS_wcslen(lpsz) * sizeof(FX_WCHAR));
+CFX_WideTextBuf& CFX_WideTextBuf::operator<<(const wchar_t* lpsz) {
+ AppendBlock(lpsz, FXSYS_wcslen(lpsz) * sizeof(wchar_t));
return *this;
}
@@ -254,7 +253,7 @@ int32_t CFX_FileBufferArchive::AppendBlock(const void* pBuf, size_t size) {
size_t temp_size = size;
while (temp_size) {
size_t buf_size = std::min(kBufSize - m_Length, temp_size);
- FXSYS_memcpy(m_pBuffer.get() + m_Length, buffer, buf_size);
+ memcpy(m_pBuffer.get() + m_Length, buffer, buf_size);
m_Length += buf_size;
if (m_Length == kBufSize) {
if (!Flush()) {
diff --git a/chromium/third_party/pdfium/core/fxcrt/fx_basic_coords.cpp b/chromium/third_party/pdfium/core/fxcrt/fx_basic_coords.cpp
index cb5a0104271..f9c3acf5fd6 100644
--- a/chromium/third_party/pdfium/core/fxcrt/fx_basic_coords.cpp
+++ b/chromium/third_party/pdfium/core/fxcrt/fx_basic_coords.cpp
@@ -13,12 +13,12 @@
namespace {
-void MatchFloatRange(FX_FLOAT f1, FX_FLOAT f2, int* i1, int* i2) {
- int length = static_cast<int>(FXSYS_ceil(f2 - f1));
- int i1_1 = static_cast<int>(FXSYS_floor(f1));
- int i1_2 = static_cast<int>(FXSYS_ceil(f1));
- FX_FLOAT error1 = f1 - i1_1 + (FX_FLOAT)FXSYS_fabs(f2 - i1_1 - length);
- FX_FLOAT error2 = i1_2 - f1 + (FX_FLOAT)FXSYS_fabs(f2 - i1_2 - length);
+void MatchFloatRange(float f1, float f2, int* i1, int* i2) {
+ int length = static_cast<int>(ceil(f2 - f1));
+ int i1_1 = static_cast<int>(floor(f1));
+ int i1_2 = static_cast<int>(ceil(f1));
+ float error1 = f1 - i1_1 + (float)fabs(f2 - i1_1 - length);
+ float error2 = i1_2 - f1 + (float)fabs(f2 - i1_2 - length);
*i1 = (error1 > error2) ? i1_2 : i1_1;
*i2 = *i1 + length;
@@ -51,12 +51,12 @@ void FX_RECT::Intersect(const FX_RECT& src) {
}
}
-bool GetIntersection(FX_FLOAT low1,
- FX_FLOAT high1,
- FX_FLOAT low2,
- FX_FLOAT high2,
- FX_FLOAT& interlow,
- FX_FLOAT& interhigh) {
+bool GetIntersection(float low1,
+ float high1,
+ float low2,
+ float high2,
+ float& interlow,
+ float& interhigh) {
if (low1 >= high2 || low2 >= high1) {
return false;
}
@@ -64,24 +64,24 @@ bool GetIntersection(FX_FLOAT low1,
interhigh = high1 > high2 ? high2 : high1;
return true;
}
-extern "C" int FXSYS_round(FX_FLOAT d) {
- if (d < (FX_FLOAT)INT_MIN) {
+extern "C" int FXSYS_round(float d) {
+ if (d < (float)INT_MIN) {
return INT_MIN;
}
- if (d > (FX_FLOAT)INT_MAX) {
+ if (d > (float)INT_MAX) {
return INT_MAX;
}
return (int)round(d);
}
CFX_FloatRect::CFX_FloatRect(const FX_RECT& rect) {
- left = (FX_FLOAT)(rect.left);
- right = (FX_FLOAT)(rect.right);
- bottom = (FX_FLOAT)(rect.top);
- top = (FX_FLOAT)(rect.bottom);
+ left = (float)(rect.left);
+ right = (float)(rect.right);
+ bottom = (float)(rect.top);
+ top = (float)(rect.bottom);
}
void CFX_FloatRect::Normalize() {
- FX_FLOAT temp;
+ float temp;
if (left > right) {
temp = left;
left = right;
@@ -161,10 +161,10 @@ int CFX_FloatRect::Substract4(CFX_FloatRect& s, CFX_FloatRect* pRects) {
FX_RECT CFX_FloatRect::GetOuterRect() const {
CFX_FloatRect rect1 = *this;
FX_RECT rect;
- rect.left = (int)FXSYS_floor(rect1.left);
- rect.right = (int)FXSYS_ceil(rect1.right);
- rect.top = (int)FXSYS_floor(rect1.bottom);
- rect.bottom = (int)FXSYS_ceil(rect1.top);
+ rect.left = (int)floor(rect1.left);
+ rect.right = (int)ceil(rect1.right);
+ rect.top = (int)floor(rect1.bottom);
+ rect.bottom = (int)ceil(rect1.top);
rect.Normalize();
return rect;
}
@@ -172,10 +172,10 @@ FX_RECT CFX_FloatRect::GetOuterRect() const {
FX_RECT CFX_FloatRect::GetInnerRect() const {
CFX_FloatRect rect1 = *this;
FX_RECT rect;
- rect.left = (int)FXSYS_ceil(rect1.left);
- rect.right = (int)FXSYS_floor(rect1.right);
- rect.top = (int)FXSYS_ceil(rect1.bottom);
- rect.bottom = (int)FXSYS_floor(rect1.top);
+ rect.left = (int)ceil(rect1.left);
+ rect.right = (int)floor(rect1.right);
+ rect.top = (int)ceil(rect1.bottom);
+ rect.bottom = (int)floor(rect1.top);
rect.Normalize();
return rect;
}
@@ -205,7 +205,7 @@ bool CFX_FloatRect::Contains(const CFX_FloatRect& other_rect) const {
n2.top <= n1.top;
}
-void CFX_FloatRect::UpdateRect(FX_FLOAT x, FX_FLOAT y) {
+void CFX_FloatRect::UpdateRect(float x, float y) {
left = std::min(left, x);
right = std::max(right, x);
bottom = std::min(bottom, y);
@@ -216,10 +216,10 @@ CFX_FloatRect CFX_FloatRect::GetBBox(const CFX_PointF* pPoints, int nPoints) {
if (nPoints == 0)
return CFX_FloatRect();
- FX_FLOAT min_x = pPoints->x;
- FX_FLOAT max_x = pPoints->x;
- FX_FLOAT min_y = pPoints->y;
- FX_FLOAT max_y = pPoints->y;
+ float min_x = pPoints->x;
+ float max_x = pPoints->x;
+ float min_y = pPoints->y;
+ float max_y = pPoints->y;
for (int i = 1; i < nPoints; i++) {
min_x = std::min(min_x, pPoints[i].x);
max_x = std::max(max_x, pPoints[i].x);
@@ -230,11 +230,11 @@ CFX_FloatRect CFX_FloatRect::GetBBox(const CFX_PointF* pPoints, int nPoints) {
}
void CFX_Matrix::SetReverse(const CFX_Matrix& m) {
- FX_FLOAT i = m.a * m.d - m.b * m.c;
- if (FXSYS_fabs(i) == 0)
+ float i = m.a * m.d - m.b * m.c;
+ if (fabs(i) == 0)
return;
- FX_FLOAT j = -i;
+ float j = -i;
a = m.d / i;
b = m.b / j;
c = m.c / j;
@@ -254,16 +254,14 @@ void CFX_Matrix::ConcatInverse(const CFX_Matrix& src, bool bPrepended) {
}
bool CFX_Matrix::Is90Rotated() const {
- return FXSYS_fabs(a * 1000) < FXSYS_fabs(b) &&
- FXSYS_fabs(d * 1000) < FXSYS_fabs(c);
+ return fabs(a * 1000) < fabs(b) && fabs(d * 1000) < fabs(c);
}
bool CFX_Matrix::IsScaled() const {
- return FXSYS_fabs(b * 1000) < FXSYS_fabs(a) &&
- FXSYS_fabs(c * 1000) < FXSYS_fabs(d);
+ return fabs(b * 1000) < fabs(a) && fabs(c * 1000) < fabs(d);
}
-void CFX_Matrix::Translate(FX_FLOAT x, FX_FLOAT y, bool bPrepended) {
+void CFX_Matrix::Translate(float x, float y, bool bPrepended) {
if (bPrepended) {
e += x * a + y * c;
f += y * d + x * b;
@@ -273,7 +271,7 @@ void CFX_Matrix::Translate(FX_FLOAT x, FX_FLOAT y, bool bPrepended) {
f += y;
}
-void CFX_Matrix::Scale(FX_FLOAT sx, FX_FLOAT sy, bool bPrepended) {
+void CFX_Matrix::Scale(float sx, float sy, bool bPrepended) {
a *= sx;
d *= sy;
if (bPrepended) {
@@ -288,57 +286,51 @@ void CFX_Matrix::Scale(FX_FLOAT sx, FX_FLOAT sy, bool bPrepended) {
f *= sy;
}
-void CFX_Matrix::Rotate(FX_FLOAT fRadian, bool bPrepended) {
- FX_FLOAT cosValue = FXSYS_cos(fRadian);
- FX_FLOAT sinValue = FXSYS_sin(fRadian);
+void CFX_Matrix::Rotate(float fRadian, bool bPrepended) {
+ float cosValue = cos(fRadian);
+ float sinValue = sin(fRadian);
ConcatInternal(CFX_Matrix(cosValue, sinValue, -sinValue, cosValue, 0, 0),
bPrepended);
}
-void CFX_Matrix::RotateAt(FX_FLOAT fRadian,
- FX_FLOAT dx,
- FX_FLOAT dy,
- bool bPrepended) {
+void CFX_Matrix::RotateAt(float fRadian, float dx, float dy, bool bPrepended) {
Translate(dx, dy, bPrepended);
Rotate(fRadian, bPrepended);
Translate(-dx, -dy, bPrepended);
}
-void CFX_Matrix::Shear(FX_FLOAT fAlphaRadian,
- FX_FLOAT fBetaRadian,
- bool bPrepended) {
- ConcatInternal(
- CFX_Matrix(1, FXSYS_tan(fAlphaRadian), FXSYS_tan(fBetaRadian), 1, 0, 0),
- bPrepended);
+void CFX_Matrix::Shear(float fAlphaRadian, float fBetaRadian, bool bPrepended) {
+ ConcatInternal(CFX_Matrix(1, tan(fAlphaRadian), tan(fBetaRadian), 1, 0, 0),
+ bPrepended);
}
void CFX_Matrix::MatchRect(const CFX_FloatRect& dest,
const CFX_FloatRect& src) {
- FX_FLOAT fDiff = src.left - src.right;
- a = FXSYS_fabs(fDiff) < 0.001f ? 1 : (dest.left - dest.right) / fDiff;
+ float fDiff = src.left - src.right;
+ a = fabs(fDiff) < 0.001f ? 1 : (dest.left - dest.right) / fDiff;
fDiff = src.bottom - src.top;
- d = FXSYS_fabs(fDiff) < 0.001f ? 1 : (dest.bottom - dest.top) / fDiff;
+ d = fabs(fDiff) < 0.001f ? 1 : (dest.bottom - dest.top) / fDiff;
e = dest.left - src.left * a;
f = dest.bottom - src.bottom * d;
b = 0;
c = 0;
}
-FX_FLOAT CFX_Matrix::GetXUnit() const {
+float CFX_Matrix::GetXUnit() const {
if (b == 0)
return (a > 0 ? a : -a);
if (a == 0)
return (b > 0 ? b : -b);
- return FXSYS_sqrt(a * a + b * b);
+ return sqrt(a * a + b * b);
}
-FX_FLOAT CFX_Matrix::GetYUnit() const {
+float CFX_Matrix::GetYUnit() const {
if (c == 0)
return (d > 0 ? d : -d);
if (d == 0)
return (c > 0 ? c : -c);
- return FXSYS_sqrt(c * c + d * d);
+ return sqrt(c * c + d * d);
}
CFX_FloatRect CFX_Matrix::GetUnitRect() const {
@@ -347,19 +339,19 @@ CFX_FloatRect CFX_Matrix::GetUnitRect() const {
return rect;
}
-FX_FLOAT CFX_Matrix::TransformXDistance(FX_FLOAT dx) const {
- FX_FLOAT fx = a * dx;
- FX_FLOAT fy = b * dx;
- return FXSYS_sqrt(fx * fx + fy * fy);
+float CFX_Matrix::TransformXDistance(float dx) const {
+ float fx = a * dx;
+ float fy = b * dx;
+ return sqrt(fx * fx + fy * fy);
}
-FX_FLOAT CFX_Matrix::TransformDistance(FX_FLOAT dx, FX_FLOAT dy) const {
- FX_FLOAT fx = a * dx + c * dy;
- FX_FLOAT fy = b * dx + d * dy;
- return FXSYS_sqrt(fx * fx + fy * fy);
+float CFX_Matrix::TransformDistance(float dx, float dy) const {
+ float fx = a * dx + c * dy;
+ float fy = b * dx + d * dy;
+ return sqrt(fx * fx + fy * fy);
}
-FX_FLOAT CFX_Matrix::TransformDistance(FX_FLOAT distance) const {
+float CFX_Matrix::TransformDistance(float distance) const {
return distance * (GetXUnit() + GetYUnit()) / 2;
}
@@ -369,16 +361,16 @@ CFX_PointF CFX_Matrix::Transform(const CFX_PointF& point) const {
}
void CFX_Matrix::TransformRect(CFX_RectF& rect) const {
- FX_FLOAT right = rect.right(), bottom = rect.bottom();
+ float right = rect.right(), bottom = rect.bottom();
TransformRect(rect.left, right, bottom, rect.top);
rect.width = right - rect.left;
rect.height = bottom - rect.top;
}
-void CFX_Matrix::TransformRect(FX_FLOAT& left,
- FX_FLOAT& right,
- FX_FLOAT& top,
- FX_FLOAT& bottom) const {
+void CFX_Matrix::TransformRect(float& left,
+ float& right,
+ float& top,
+ float& bottom) const {
CFX_PointF points[] = {
{left, top}, {left, bottom}, {right, top}, {right, bottom}};
for (int i = 0; i < 4; i++)
diff --git a/chromium/third_party/pdfium/core/fxcrt/fx_basic_gcc.cpp b/chromium/third_party/pdfium/core/fxcrt/fx_basic_gcc.cpp
index 42fb2a17f7a..2033265f103 100644
--- a/chromium/third_party/pdfium/core/fxcrt/fx_basic_gcc.cpp
+++ b/chromium/third_party/pdfium/core/fxcrt/fx_basic_gcc.cpp
@@ -82,23 +82,23 @@ STR_T FXSYS_IntToStr(T value, STR_T str, int radix) {
#ifdef __cplusplus
extern "C" {
#endif
-int32_t FXSYS_atoi(const FX_CHAR* str) {
- return FXSYS_StrToInt<int32_t, FX_CHAR>(str);
+int32_t FXSYS_atoi(const char* str) {
+ return FXSYS_StrToInt<int32_t, char>(str);
}
-uint32_t FXSYS_atoui(const FX_CHAR* str) {
+uint32_t FXSYS_atoui(const char* str) {
return FXSYS_StrToInt<uint32_t>(str);
}
-int32_t FXSYS_wtoi(const FX_WCHAR* str) {
- return FXSYS_StrToInt<int32_t, FX_WCHAR>(str);
+int32_t FXSYS_wtoi(const wchar_t* str) {
+ return FXSYS_StrToInt<int32_t, wchar_t>(str);
}
-int64_t FXSYS_atoi64(const FX_CHAR* str) {
- return FXSYS_StrToInt<int64_t, FX_CHAR>(str);
+int64_t FXSYS_atoi64(const char* str) {
+ return FXSYS_StrToInt<int64_t, char>(str);
}
-int64_t FXSYS_wtoi64(const FX_WCHAR* str) {
- return FXSYS_StrToInt<int64_t, FX_WCHAR>(str);
+int64_t FXSYS_wtoi64(const wchar_t* str) {
+ return FXSYS_StrToInt<int64_t, wchar_t>(str);
}
-const FX_CHAR* FXSYS_i64toa(int64_t value, FX_CHAR* str, int radix) {
- return FXSYS_IntToStr<int64_t, uint64_t, FX_CHAR*>(value, str, radix);
+const char* FXSYS_i64toa(int64_t value, char* str, int radix) {
+ return FXSYS_IntToStr<int64_t, uint64_t, char*>(value, str, radix);
}
#ifdef __cplusplus
}
@@ -110,20 +110,23 @@ extern "C" {
int FXSYS_GetACP() {
return 0;
}
-uint32_t FXSYS_GetFullPathName(const FX_CHAR* filename,
+
+uint32_t FXSYS_GetFullPathName(const char* filename,
uint32_t buflen,
- FX_CHAR* buf,
- FX_CHAR** filepart) {
+ char* buf,
+ char** filepart) {
int srclen = FXSYS_strlen(filename);
- if (!buf || (int)buflen < srclen + 1) {
+ if (!buf || (int)buflen < srclen + 1)
return srclen + 1;
- }
- FXSYS_strcpy(buf, filename);
+
+ strncpy(buf, filename, buflen);
return srclen;
}
+
uint32_t FXSYS_GetModuleFileName(void* hModule, char* buf, uint32_t bufsize) {
- return (uint32_t)-1;
+ return 0xFFFFFFFF;
}
+
#ifdef __cplusplus
}
#endif
@@ -132,9 +135,9 @@ uint32_t FXSYS_GetModuleFileName(void* hModule, char* buf, uint32_t bufsize) {
#ifdef __cplusplus
extern "C" {
#endif
-FXSYS_FILE* FXSYS_wfopen(const FX_WCHAR* filename, const FX_WCHAR* mode) {
- return FXSYS_fopen(CFX_ByteString::FromUnicode(filename).c_str(),
- CFX_ByteString::FromUnicode(mode).c_str());
+FILE* FXSYS_wfopen(const wchar_t* filename, const wchar_t* mode) {
+ return fopen(CFX_ByteString::FromUnicode(filename).c_str(),
+ CFX_ByteString::FromUnicode(mode).c_str());
}
char* FXSYS_strlwr(char* str) {
if (!str) {
@@ -158,22 +161,22 @@ char* FXSYS_strupr(char* str) {
}
return s;
}
-FX_WCHAR* FXSYS_wcslwr(FX_WCHAR* str) {
+wchar_t* FXSYS_wcslwr(wchar_t* str) {
if (!str) {
return nullptr;
}
- FX_WCHAR* s = str;
+ wchar_t* s = str;
while (*str) {
*str = FXSYS_tolower(*str);
str++;
}
return s;
}
-FX_WCHAR* FXSYS_wcsupr(FX_WCHAR* str) {
+wchar_t* FXSYS_wcsupr(wchar_t* str) {
if (!str) {
return nullptr;
}
- FX_WCHAR* s = str;
+ wchar_t* s = str;
while (*str) {
*str = FXSYS_toupper(*str);
str++;
@@ -192,20 +195,20 @@ int FXSYS_stricmp(const char* dst, const char* src) {
} while (f && (f == l));
return (f - l);
}
-int FXSYS_wcsicmp(const FX_WCHAR* dst, const FX_WCHAR* src) {
- FX_WCHAR f, l;
+int FXSYS_wcsicmp(const wchar_t* dst, const wchar_t* src) {
+ wchar_t f, l;
do {
- if (((f = (FX_WCHAR)(*(dst++))) >= 'A') && (f <= 'Z')) {
+ if (((f = (wchar_t)(*(dst++))) >= 'A') && (f <= 'Z')) {
f -= ('A' - 'a');
}
- if (((l = (FX_WCHAR)(*(src++))) >= 'A') && (l <= 'Z')) {
+ if (((l = (wchar_t)(*(src++))) >= 'A') && (l <= 'Z')) {
l -= ('A' - 'a');
}
} while (f && (f == l));
return (f - l);
}
char* FXSYS_itoa(int value, char* str, int radix) {
- return FXSYS_IntToStr<int32_t, uint32_t, FX_CHAR*>(value, str, radix);
+ return FXSYS_IntToStr<int32_t, uint32_t, char*>(value, str, radix);
}
#ifdef __cplusplus
}
@@ -217,17 +220,17 @@ extern "C" {
#endif
int FXSYS_WideCharToMultiByte(uint32_t codepage,
uint32_t dwFlags,
- const FX_WCHAR* wstr,
+ const wchar_t* wstr,
int wlen,
- FX_CHAR* buf,
+ char* buf,
int buflen,
- const FX_CHAR* default_str,
+ const char* default_str,
int* pUseDefault) {
int len = 0;
for (int i = 0; i < wlen; i++) {
if (wstr[i] < 0x100) {
if (buf && len < buflen)
- buf[len] = static_cast<FX_CHAR>(wstr[i]);
+ buf[len] = static_cast<char>(wstr[i]);
len++;
}
}
@@ -235,9 +238,9 @@ int FXSYS_WideCharToMultiByte(uint32_t codepage,
}
int FXSYS_MultiByteToWideChar(uint32_t codepage,
uint32_t dwFlags,
- const FX_CHAR* bstr,
+ const char* bstr,
int blen,
- FX_WCHAR* buf,
+ wchar_t* buf,
int buflen) {
int wlen = 0;
for (int i = 0; i < blen; i++) {
diff --git a/chromium/third_party/pdfium/core/fxcrt/fx_basic_memmgr.cpp b/chromium/third_party/pdfium/core/fxcrt/fx_basic_memmgr.cpp
index 927b994b5ff..f3aaa3678db 100644
--- a/chromium/third_party/pdfium/core/fxcrt/fx_basic_memmgr.cpp
+++ b/chromium/third_party/pdfium/core/fxcrt/fx_basic_memmgr.cpp
@@ -8,6 +8,19 @@
#include "core/fxcrt/fx_memory.h"
+pdfium::base::PartitionAllocatorGeneric gArrayBufferPartitionAllocator;
+pdfium::base::PartitionAllocatorGeneric gStringPartitionAllocator;
+
+void FXMEM_InitalizePartitionAlloc() {
+ static bool s_gPartitionAllocatorsInitialized = false;
+ if (!s_gPartitionAllocatorsInitialized) {
+ pdfium::base::PartitionAllocGlobalInit(FX_OutOfMemoryTerminate);
+ gArrayBufferPartitionAllocator.init();
+ gStringPartitionAllocator.init();
+ s_gPartitionAllocatorsInitialized = true;
+ }
+}
+
void* FXMEM_DefaultAlloc(size_t byte_size, int flags) {
return (void*)malloc(byte_size);
}
diff --git a/chromium/third_party/pdfium/core/fxcrt/fx_basic_utf.cpp b/chromium/third_party/pdfium/core/fxcrt/fx_basic_utf.cpp
index c0f14c81787..10aa918962b 100644
--- a/chromium/third_party/pdfium/core/fxcrt/fx_basic_utf.cpp
+++ b/chromium/third_party/pdfium/core/fxcrt/fx_basic_utf.cpp
@@ -11,7 +11,7 @@ void CFX_UTF8Decoder::Clear() {
m_PendingBytes = 0;
}
void CFX_UTF8Decoder::AppendChar(uint32_t ch) {
- m_Buffer.AppendChar((FX_WCHAR)ch);
+ m_Buffer.AppendChar((wchar_t)ch);
}
void CFX_UTF8Decoder::Input(uint8_t byte) {
if (byte < 0x80) {
@@ -43,7 +43,7 @@ void CFX_UTF8Decoder::Input(uint8_t byte) {
m_PendingChar = (byte & 0x01) << 30;
}
}
-void CFX_UTF8Encoder::Input(FX_WCHAR unicode) {
+void CFX_UTF8Encoder::Input(wchar_t unicode) {
if ((uint32_t)unicode < 0x80) {
m_Buffer.AppendChar(unicode);
} else {
@@ -76,7 +76,7 @@ void CFX_UTF8Encoder::Input(FX_WCHAR unicode) {
CFX_ByteString FX_UTF8Encode(const CFX_WideStringC& wsStr) {
FX_STRSIZE len = wsStr.GetLength();
- const FX_WCHAR* pStr = wsStr.c_str();
+ const wchar_t* pStr = wsStr.c_str();
CFX_UTF8Encoder encoder;
while (len-- > 0)
encoder.Input(*pStr++);
diff --git a/chromium/third_party/pdfium/core/fxcrt/fx_basic_util.cpp b/chromium/third_party/pdfium/core/fxcrt/fx_basic_util.cpp
index f608e290a2a..58d54a3b10b 100644
--- a/chromium/third_party/pdfium/core/fxcrt/fx_basic_util.cpp
+++ b/chromium/third_party/pdfium/core/fxcrt/fx_basic_util.cpp
@@ -4,17 +4,18 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "core/fxcrt/fx_basic.h"
-#include "core/fxcrt/fx_ext.h"
-
#include <algorithm>
#include <cctype>
#include <limits>
#include <memory>
+#include "core/fxcrt/fx_basic.h"
+#include "core/fxcrt/fx_ext.h"
+#include "third_party/base/ptr_util.h"
+
bool FX_atonum(const CFX_ByteStringC& strc, void* pData) {
if (strc.Find('.') != -1) {
- FX_FLOAT* pFloat = static_cast<FX_FLOAT*>(pData);
+ float* pFloat = static_cast<float*>(pData);
*pFloat = FX_atof(strc);
return false;
}
@@ -69,7 +70,7 @@ bool FX_atonum(const CFX_ByteStringC& strc, void* pData) {
return true;
}
-static const FX_FLOAT fraction_scales[] = {
+static const float fraction_scales[] = {
0.1f, 0.01f, 0.001f, 0.0001f,
0.00001f, 0.000001f, 0.0000001f, 0.00000001f,
0.000000001f, 0.0000000001f, 0.00000000001f};
@@ -78,11 +79,11 @@ int FXSYS_FractionalScaleCount() {
return FX_ArraySize(fraction_scales);
}
-FX_FLOAT FXSYS_FractionalScale(size_t scale_factor, int value) {
+float FXSYS_FractionalScale(size_t scale_factor, int value) {
return fraction_scales[scale_factor] * value;
}
-FX_FLOAT FX_atof(const CFX_ByteStringC& strc) {
+float FX_atof(const CFX_ByteStringC& strc) {
if (strc.IsEmpty())
return 0.0;
@@ -100,7 +101,7 @@ FX_FLOAT FX_atof(const CFX_ByteStringC& strc) {
break;
cc++;
}
- FX_FLOAT value = 0;
+ float value = 0;
while (cc < len) {
if (strc[cc] == '.')
break;
@@ -122,6 +123,10 @@ FX_FLOAT FX_atof(const CFX_ByteStringC& strc) {
return bNegative ? -value : value;
}
+float FX_atof(const CFX_WideStringC& wsStr) {
+ return FX_atof(FX_UTF8Encode(wsStr).c_str());
+}
+
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ && _MSC_VER < 1900
void FXSYS_snprintf(char* str,
size_t size,
@@ -140,9 +145,9 @@ void FXSYS_vsnprintf(char* str, size_t size, const char* fmt, va_list ap) {
}
#endif // _FXM_PLATFORM_WINDOWS_ && _MSC_VER < 1900
-FX_FileHandle* FX_OpenFolder(const FX_CHAR* path) {
+FX_FileHandle* FX_OpenFolder(const char* path) {
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
- std::unique_ptr<CFindFileDataA> pData(new CFindFileDataA);
+ auto pData = pdfium::MakeUnique<CFindFileDataA>();
pData->m_Handle = FindFirstFileExA((CFX_ByteString(path) + "/*.*").c_str(),
FindExInfoStandard, &pData->m_FindData,
FindExSearchNameMatch, nullptr, 0);
@@ -197,7 +202,7 @@ void FX_CloseFolder(FX_FileHandle* handle) {
#endif
}
-FX_WCHAR FX_GetFolderSeparator() {
+wchar_t FX_GetFolderSeparator() {
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
return '\\';
#else
@@ -205,33 +210,6 @@ FX_WCHAR FX_GetFolderSeparator() {
#endif
}
-CFX_Matrix_3by3 CFX_Matrix_3by3::Inverse() {
- FX_FLOAT det =
- a * (e * i - f * h) - b * (i * d - f * g) + c * (d * h - e * g);
- if (FXSYS_fabs(det) < 0.0000001)
- return CFX_Matrix_3by3();
-
- return CFX_Matrix_3by3(
- (e * i - f * h) / det, -(b * i - c * h) / det, (b * f - c * e) / det,
- -(d * i - f * g) / det, (a * i - c * g) / det, -(a * f - c * d) / det,
- (d * h - e * g) / det, -(a * h - b * g) / det, (a * e - b * d) / det);
-}
-
-CFX_Matrix_3by3 CFX_Matrix_3by3::Multiply(const CFX_Matrix_3by3& m) {
- return CFX_Matrix_3by3(
- a * m.a + b * m.d + c * m.g, a * m.b + b * m.e + c * m.h,
- a * m.c + b * m.f + c * m.i, d * m.a + e * m.d + f * m.g,
- d * m.b + e * m.e + f * m.h, d * m.c + e * m.f + f * m.i,
- g * m.a + h * m.d + i * m.g, g * m.b + h * m.e + i * m.h,
- g * m.c + h * m.f + i * m.i);
-}
-
-CFX_Vector_3by1 CFX_Matrix_3by3::TransformVector(const CFX_Vector_3by1& v) {
- return CFX_Vector_3by1(a * v.a + b * v.b + c * v.c,
- d * v.a + e * v.b + f * v.c,
- g * v.a + h * v.b + i * v.c);
-}
-
uint32_t GetBits32(const uint8_t* pData, int bitpos, int nbits) {
ASSERT(0 < nbits && nbits <= 32);
const uint8_t* dataPtr = &pData[bitpos / 8];
diff --git a/chromium/third_party/pdfium/core/fxcrt/fx_basic_wstring.cpp b/chromium/third_party/pdfium/core/fxcrt/fx_basic_wstring.cpp
deleted file mode 100644
index 93b9ba7c25a..00000000000
--- a/chromium/third_party/pdfium/core/fxcrt/fx_basic_wstring.cpp
+++ /dev/null
@@ -1,1022 +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
-
-#include <stddef.h>
-
-#include <algorithm>
-#include <cctype>
-
-#include "core/fxcrt/cfx_string_pool_template.h"
-#include "core/fxcrt/fx_basic.h"
-#include "core/fxcrt/fx_ext.h"
-#include "third_party/base/numerics/safe_math.h"
-
-template class CFX_StringDataTemplate<FX_WCHAR>;
-template class CFX_StringCTemplate<FX_WCHAR>;
-template class CFX_StringPoolTemplate<CFX_WideString>;
-template struct std::hash<CFX_WideString>;
-
-namespace {
-
-#ifndef NDEBUG
-bool IsValidCodePage(uint16_t codepage) {
- switch (codepage) {
- case 0:
- case 932:
- case 936:
- case 949:
- case 950:
- return true;
-
- default:
- return false;
- }
-}
-#endif
-
-const FX_WCHAR* FX_wcsstr(const FX_WCHAR* haystack,
- int haystack_len,
- const FX_WCHAR* needle,
- int needle_len) {
- if (needle_len > haystack_len || needle_len == 0) {
- return nullptr;
- }
- const FX_WCHAR* end_ptr = haystack + haystack_len - needle_len;
- while (haystack <= end_ptr) {
- int i = 0;
- while (1) {
- if (haystack[i] != needle[i]) {
- break;
- }
- i++;
- if (i == needle_len) {
- return haystack;
- }
- }
- haystack++;
- }
- return nullptr;
-}
-
-} // namespace
-
-static_assert(sizeof(CFX_WideString) <= sizeof(FX_WCHAR*),
- "Strings must not require more space than pointers");
-
-CFX_WideString::CFX_WideString() {}
-
-CFX_WideString::CFX_WideString(const CFX_WideString& other)
- : m_pData(other.m_pData) {}
-
-CFX_WideString::CFX_WideString(CFX_WideString&& other) {
- m_pData.Swap(other.m_pData);
-}
-
-CFX_WideString::CFX_WideString(const FX_WCHAR* pStr, FX_STRSIZE nLen) {
- if (nLen < 0)
- nLen = pStr ? FXSYS_wcslen(pStr) : 0;
-
- if (nLen)
- m_pData.Reset(StringData::Create(pStr, nLen));
-}
-
-CFX_WideString::CFX_WideString(FX_WCHAR ch) {
- m_pData.Reset(StringData::Create(1));
- m_pData->m_String[0] = ch;
-}
-
-CFX_WideString::CFX_WideString(const FX_WCHAR* ptr)
- : CFX_WideString(ptr, ptr ? FXSYS_wcslen(ptr) : 0) {}
-
-CFX_WideString::CFX_WideString(const CFX_WideStringC& stringSrc) {
- if (!stringSrc.IsEmpty()) {
- m_pData.Reset(StringData::Create(stringSrc.c_str(), stringSrc.GetLength()));
- }
-}
-
-CFX_WideString::CFX_WideString(const CFX_WideStringC& str1,
- const CFX_WideStringC& str2) {
- int nNewLen = str1.GetLength() + str2.GetLength();
- if (nNewLen == 0)
- return;
-
- m_pData.Reset(StringData::Create(nNewLen));
- m_pData->CopyContents(str1.c_str(), str1.GetLength());
- m_pData->CopyContentsAt(str1.GetLength(), str2.c_str(), str2.GetLength());
-}
-
-CFX_WideString::~CFX_WideString() {}
-
-const CFX_WideString& CFX_WideString::operator=(const FX_WCHAR* pStr) {
- if (!pStr || !pStr[0])
- clear();
- else
- AssignCopy(pStr, FXSYS_wcslen(pStr));
-
- return *this;
-}
-
-const CFX_WideString& CFX_WideString::operator=(
- const CFX_WideStringC& stringSrc) {
- if (stringSrc.IsEmpty())
- clear();
- else
- AssignCopy(stringSrc.c_str(), stringSrc.GetLength());
-
- return *this;
-}
-
-const CFX_WideString& CFX_WideString::operator=(
- const CFX_WideString& stringSrc) {
- if (m_pData != stringSrc.m_pData)
- m_pData = stringSrc.m_pData;
-
- return *this;
-}
-
-const CFX_WideString& CFX_WideString::operator+=(const FX_WCHAR* pStr) {
- if (pStr)
- Concat(pStr, FXSYS_wcslen(pStr));
-
- return *this;
-}
-
-const CFX_WideString& CFX_WideString::operator+=(FX_WCHAR ch) {
- Concat(&ch, 1);
- return *this;
-}
-
-const CFX_WideString& CFX_WideString::operator+=(const CFX_WideString& str) {
- if (str.m_pData)
- Concat(str.m_pData->m_String, str.m_pData->m_nDataLength);
-
- return *this;
-}
-
-const CFX_WideString& CFX_WideString::operator+=(const CFX_WideStringC& str) {
- if (!str.IsEmpty())
- Concat(str.c_str(), str.GetLength());
-
- return *this;
-}
-
-bool CFX_WideString::operator==(const wchar_t* ptr) const {
- if (!m_pData)
- return !ptr || !ptr[0];
-
- if (!ptr)
- return m_pData->m_nDataLength == 0;
-
- return wcslen(ptr) == static_cast<size_t>(m_pData->m_nDataLength) &&
- wmemcmp(ptr, m_pData->m_String, m_pData->m_nDataLength) == 0;
-}
-
-bool CFX_WideString::operator==(const CFX_WideStringC& str) const {
- if (!m_pData)
- return str.IsEmpty();
-
- return m_pData->m_nDataLength == str.GetLength() &&
- wmemcmp(m_pData->m_String, str.c_str(), str.GetLength()) == 0;
-}
-
-bool CFX_WideString::operator==(const CFX_WideString& other) const {
- if (m_pData == other.m_pData)
- return true;
-
- if (IsEmpty())
- return other.IsEmpty();
-
- if (other.IsEmpty())
- return false;
-
- return other.m_pData->m_nDataLength == m_pData->m_nDataLength &&
- wmemcmp(other.m_pData->m_String, m_pData->m_String,
- m_pData->m_nDataLength) == 0;
-}
-
-bool CFX_WideString::operator<(const CFX_WideString& str) const {
- if (m_pData == str.m_pData)
- return false;
-
- int result =
- wmemcmp(c_str(), str.c_str(), std::min(GetLength(), str.GetLength()));
- return result < 0 || (result == 0 && GetLength() < str.GetLength());
-}
-
-void CFX_WideString::AssignCopy(const FX_WCHAR* pSrcData, FX_STRSIZE nSrcLen) {
- AllocBeforeWrite(nSrcLen);
- m_pData->CopyContents(pSrcData, nSrcLen);
- m_pData->m_nDataLength = nSrcLen;
-}
-
-void CFX_WideString::ReallocBeforeWrite(FX_STRSIZE nNewLength) {
- if (m_pData && m_pData->CanOperateInPlace(nNewLength))
- return;
-
- if (nNewLength <= 0) {
- clear();
- return;
- }
-
- CFX_RetainPtr<StringData> pNewData(StringData::Create(nNewLength));
- if (m_pData) {
- FX_STRSIZE nCopyLength = std::min(m_pData->m_nDataLength, nNewLength);
- pNewData->CopyContents(m_pData->m_String, nCopyLength);
- pNewData->m_nDataLength = nCopyLength;
- } else {
- pNewData->m_nDataLength = 0;
- }
- pNewData->m_String[pNewData->m_nDataLength] = 0;
- m_pData.Swap(pNewData);
-}
-
-void CFX_WideString::AllocBeforeWrite(FX_STRSIZE nNewLength) {
- if (m_pData && m_pData->CanOperateInPlace(nNewLength))
- return;
-
- if (nNewLength <= 0) {
- clear();
- return;
- }
-
- m_pData.Reset(StringData::Create(nNewLength));
-}
-
-void CFX_WideString::ReleaseBuffer(FX_STRSIZE nNewLength) {
- if (!m_pData)
- return;
-
- if (nNewLength == -1)
- nNewLength = FXSYS_wcslen(m_pData->m_String);
-
- nNewLength = std::min(nNewLength, m_pData->m_nAllocLength);
- if (nNewLength == 0) {
- clear();
- return;
- }
-
- ASSERT(m_pData->m_nRefs == 1);
- m_pData->m_nDataLength = nNewLength;
- m_pData->m_String[nNewLength] = 0;
- if (m_pData->m_nAllocLength - nNewLength >= 32) {
- // Over arbitrary threshold, so pay the price to relocate. Force copy to
- // always occur by holding a second reference to the string.
- CFX_WideString preserve(*this);
- ReallocBeforeWrite(nNewLength);
- }
-}
-
-void CFX_WideString::Reserve(FX_STRSIZE len) {
- GetBuffer(len);
-}
-
-FX_WCHAR* CFX_WideString::GetBuffer(FX_STRSIZE nMinBufLength) {
- if (!m_pData) {
- if (nMinBufLength == 0)
- return nullptr;
-
- m_pData.Reset(StringData::Create(nMinBufLength));
- m_pData->m_nDataLength = 0;
- m_pData->m_String[0] = 0;
- return m_pData->m_String;
- }
-
- if (m_pData->CanOperateInPlace(nMinBufLength))
- return m_pData->m_String;
-
- nMinBufLength = std::max(nMinBufLength, m_pData->m_nDataLength);
- if (nMinBufLength == 0)
- return nullptr;
-
- CFX_RetainPtr<StringData> pNewData(StringData::Create(nMinBufLength));
- pNewData->CopyContents(*m_pData);
- pNewData->m_nDataLength = m_pData->m_nDataLength;
- m_pData.Swap(pNewData);
- return m_pData->m_String;
-}
-
-FX_STRSIZE CFX_WideString::Delete(FX_STRSIZE nIndex, FX_STRSIZE nCount) {
- if (!m_pData)
- return 0;
-
- if (nIndex < 0)
- nIndex = 0;
-
- FX_STRSIZE nOldLength = m_pData->m_nDataLength;
- if (nCount > 0 && nIndex < nOldLength) {
- FX_STRSIZE mLength = nIndex + nCount;
- if (mLength >= nOldLength) {
- m_pData->m_nDataLength = nIndex;
- return m_pData->m_nDataLength;
- }
- ReallocBeforeWrite(nOldLength);
- int nCharsToCopy = nOldLength - mLength + 1;
- wmemmove(m_pData->m_String + nIndex, m_pData->m_String + mLength,
- nCharsToCopy);
- m_pData->m_nDataLength = nOldLength - nCount;
- }
- return m_pData->m_nDataLength;
-}
-
-void CFX_WideString::Concat(const FX_WCHAR* pSrcData, FX_STRSIZE nSrcLen) {
- if (!pSrcData || nSrcLen <= 0)
- return;
-
- if (!m_pData) {
- m_pData.Reset(StringData::Create(pSrcData, nSrcLen));
- return;
- }
-
- if (m_pData->CanOperateInPlace(m_pData->m_nDataLength + nSrcLen)) {
- m_pData->CopyContentsAt(m_pData->m_nDataLength, pSrcData, nSrcLen);
- m_pData->m_nDataLength += nSrcLen;
- return;
- }
-
- CFX_RetainPtr<StringData> pNewData(
- StringData::Create(m_pData->m_nDataLength + nSrcLen));
- pNewData->CopyContents(*m_pData);
- pNewData->CopyContentsAt(m_pData->m_nDataLength, pSrcData, nSrcLen);
- m_pData.Swap(pNewData);
-}
-
-CFX_ByteString CFX_WideString::UTF8Encode() const {
- return FX_UTF8Encode(AsStringC());
-}
-
-CFX_ByteString CFX_WideString::UTF16LE_Encode() const {
- if (!m_pData) {
- return CFX_ByteString("\0\0", 2);
- }
- int len = m_pData->m_nDataLength;
- CFX_ByteString result;
- FX_CHAR* buffer = result.GetBuffer(len * 2 + 2);
- for (int i = 0; i < len; i++) {
- buffer[i * 2] = m_pData->m_String[i] & 0xff;
- buffer[i * 2 + 1] = m_pData->m_String[i] >> 8;
- }
- buffer[len * 2] = 0;
- buffer[len * 2 + 1] = 0;
- result.ReleaseBuffer(len * 2 + 2);
- return result;
-}
-
-CFX_WideString CFX_WideString::Mid(FX_STRSIZE nFirst) const {
- if (!m_pData)
- return CFX_WideString();
-
- return Mid(nFirst, m_pData->m_nDataLength - nFirst);
-}
-
-CFX_WideString CFX_WideString::Mid(FX_STRSIZE nFirst, FX_STRSIZE nCount) const {
- if (!m_pData)
- return CFX_WideString();
-
- nFirst = std::min(std::max(nFirst, 0), m_pData->m_nDataLength);
- nCount = std::min(std::max(nCount, 0), m_pData->m_nDataLength - nFirst);
- if (nCount == 0)
- return CFX_WideString();
-
- if (nFirst == 0 && nCount == m_pData->m_nDataLength)
- return *this;
-
- CFX_WideString dest;
- AllocCopy(dest, nCount, nFirst);
- return dest;
-}
-
-void CFX_WideString::AllocCopy(CFX_WideString& dest,
- FX_STRSIZE nCopyLen,
- FX_STRSIZE nCopyIndex) const {
- if (nCopyLen <= 0)
- return;
-
- CFX_RetainPtr<StringData> pNewData(
- StringData::Create(m_pData->m_String + nCopyIndex, nCopyLen));
- dest.m_pData.Swap(pNewData);
-}
-
-#define FORCE_ANSI 0x10000
-#define FORCE_UNICODE 0x20000
-#define FORCE_INT64 0x40000
-
-void CFX_WideString::FormatV(const FX_WCHAR* pFormat, va_list argList) {
- va_list argListSave;
-#if defined(__ARMCC_VERSION) || \
- (!defined(_MSC_VER) && (_FX_CPU_ == _FX_X64_ || _FX_CPU_ == _FX_IA64_ || \
- _FX_CPU_ == _FX_ARM64_)) || \
- defined(__native_client__)
- va_copy(argListSave, argList);
-#else
- argListSave = argList;
-#endif
- int nMaxLen = 0;
- for (const FX_WCHAR* pStr = pFormat; *pStr != 0; pStr++) {
- if (*pStr != '%' || *(pStr = pStr + 1) == '%') {
- nMaxLen += FXSYS_wcslen(pStr);
- continue;
- }
- int nItemLen = 0;
- int nWidth = 0;
- for (; *pStr != 0; pStr++) {
- if (*pStr == '#') {
- nMaxLen += 2;
- } else if (*pStr == '*') {
- nWidth = va_arg(argList, int);
- } else if (*pStr != '-' && *pStr != '+' && *pStr != '0' && *pStr != ' ') {
- break;
- }
- }
- if (nWidth == 0) {
- nWidth = FXSYS_wtoi(pStr);
- while (std::iswdigit(*pStr))
- ++pStr;
- }
- if (nWidth < 0 || nWidth > 128 * 1024) {
- pFormat = L"Bad width";
- nMaxLen = 10;
- break;
- }
- int nPrecision = 0;
- if (*pStr == '.') {
- pStr++;
- if (*pStr == '*') {
- nPrecision = va_arg(argList, int);
- pStr++;
- } else {
- nPrecision = FXSYS_wtoi(pStr);
- while (std::iswdigit(*pStr))
- ++pStr;
- }
- }
- if (nPrecision < 0 || nPrecision > 128 * 1024) {
- pFormat = L"Bad precision";
- nMaxLen = 14;
- break;
- }
- int nModifier = 0;
- if (*pStr == L'I' && *(pStr + 1) == L'6' && *(pStr + 2) == L'4') {
- pStr += 3;
- nModifier = FORCE_INT64;
- } else {
- switch (*pStr) {
- case 'h':
- nModifier = FORCE_ANSI;
- pStr++;
- break;
- case 'l':
- nModifier = FORCE_UNICODE;
- pStr++;
- break;
- case 'F':
- case 'N':
- case 'L':
- pStr++;
- break;
- }
- }
- switch (*pStr | nModifier) {
- case 'c':
- case 'C':
- nItemLen = 2;
- va_arg(argList, int);
- break;
- case 'c' | FORCE_ANSI:
- case 'C' | FORCE_ANSI:
- nItemLen = 2;
- va_arg(argList, int);
- break;
- case 'c' | FORCE_UNICODE:
- case 'C' | FORCE_UNICODE:
- nItemLen = 2;
- va_arg(argList, int);
- break;
- case 's': {
- const FX_WCHAR* pstrNextArg = va_arg(argList, const FX_WCHAR*);
- if (pstrNextArg) {
- nItemLen = FXSYS_wcslen(pstrNextArg);
- if (nItemLen < 1) {
- nItemLen = 1;
- }
- } else {
- nItemLen = 6;
- }
- } break;
- case 'S': {
- const FX_CHAR* pstrNextArg = va_arg(argList, const FX_CHAR*);
- if (pstrNextArg) {
- nItemLen = FXSYS_strlen(pstrNextArg);
- if (nItemLen < 1) {
- nItemLen = 1;
- }
- } else {
- nItemLen = 6;
- }
- } break;
- case 's' | FORCE_ANSI:
- case 'S' | FORCE_ANSI: {
- const FX_CHAR* pstrNextArg = va_arg(argList, const FX_CHAR*);
- if (pstrNextArg) {
- nItemLen = FXSYS_strlen(pstrNextArg);
- if (nItemLen < 1) {
- nItemLen = 1;
- }
- } else {
- nItemLen = 6;
- }
- } break;
- case 's' | FORCE_UNICODE:
- case 'S' | FORCE_UNICODE: {
- const FX_WCHAR* pstrNextArg = va_arg(argList, FX_WCHAR*);
- if (pstrNextArg) {
- nItemLen = FXSYS_wcslen(pstrNextArg);
- if (nItemLen < 1) {
- nItemLen = 1;
- }
- } else {
- nItemLen = 6;
- }
- } break;
- }
- if (nItemLen != 0) {
- if (nPrecision != 0 && nItemLen > nPrecision) {
- nItemLen = nPrecision;
- }
- if (nItemLen < nWidth) {
- nItemLen = nWidth;
- }
- } else {
- switch (*pStr) {
- case 'd':
- case 'i':
- case 'u':
- case 'x':
- case 'X':
- case 'o':
- if (nModifier & FORCE_INT64) {
- va_arg(argList, int64_t);
- } else {
- va_arg(argList, int);
- }
- nItemLen = 32;
- if (nItemLen < nWidth + nPrecision) {
- nItemLen = nWidth + nPrecision;
- }
- break;
- case 'a':
- case 'A':
- case 'e':
- case 'E':
- case 'g':
- case 'G':
- va_arg(argList, double);
- nItemLen = 128;
- if (nItemLen < nWidth + nPrecision) {
- nItemLen = nWidth + nPrecision;
- }
- break;
- case 'f':
- if (nWidth + nPrecision > 100) {
- nItemLen = nPrecision + nWidth + 128;
- } else {
- double f;
- char pszTemp[256];
- f = va_arg(argList, double);
- FXSYS_snprintf(pszTemp, sizeof(pszTemp), "%*.*f", nWidth,
- nPrecision + 6, f);
- nItemLen = FXSYS_strlen(pszTemp);
- }
- break;
- case 'p':
- va_arg(argList, void*);
- nItemLen = 32;
- if (nItemLen < nWidth + nPrecision) {
- nItemLen = nWidth + nPrecision;
- }
- break;
- case 'n':
- va_arg(argList, int*);
- break;
- }
- }
- nMaxLen += nItemLen;
- }
- GetBuffer(nMaxLen);
- if (m_pData) {
- FXSYS_vswprintf((wchar_t*)m_pData->m_String, nMaxLen + 1,
- (const wchar_t*)pFormat, argListSave);
- ReleaseBuffer();
- }
- va_end(argListSave);
-}
-
-void CFX_WideString::Format(const FX_WCHAR* pFormat, ...) {
- va_list argList;
- va_start(argList, pFormat);
- FormatV(pFormat, argList);
- va_end(argList);
-}
-
-FX_STRSIZE CFX_WideString::Insert(FX_STRSIZE nIndex, FX_WCHAR ch) {
- FX_STRSIZE nNewLength = m_pData ? m_pData->m_nDataLength : 0;
- nIndex = std::max(nIndex, 0);
- nIndex = std::min(nIndex, nNewLength);
- nNewLength++;
-
- ReallocBeforeWrite(nNewLength);
- wmemmove(m_pData->m_String + nIndex + 1, m_pData->m_String + nIndex,
- nNewLength - nIndex);
- m_pData->m_String[nIndex] = ch;
- m_pData->m_nDataLength = nNewLength;
- return nNewLength;
-}
-
-CFX_WideString CFX_WideString::Right(FX_STRSIZE nCount) const {
- if (!m_pData)
- return CFX_WideString();
-
- nCount = std::max(nCount, 0);
- if (nCount >= m_pData->m_nDataLength)
- return *this;
-
- CFX_WideString dest;
- AllocCopy(dest, nCount, m_pData->m_nDataLength - nCount);
- return dest;
-}
-
-CFX_WideString CFX_WideString::Left(FX_STRSIZE nCount) const {
- if (!m_pData)
- return CFX_WideString();
-
- nCount = std::max(nCount, 0);
- if (nCount >= m_pData->m_nDataLength)
- return *this;
-
- CFX_WideString dest;
- AllocCopy(dest, nCount, 0);
- return dest;
-}
-
-FX_STRSIZE CFX_WideString::Find(FX_WCHAR ch, FX_STRSIZE nStart) const {
- if (!m_pData)
- return -1;
-
- if (nStart < 0 || nStart >= m_pData->m_nDataLength)
- return -1;
-
- const FX_WCHAR* pStr =
- wmemchr(m_pData->m_String + nStart, ch, m_pData->m_nDataLength - nStart);
- return pStr ? pStr - m_pData->m_String : -1;
-}
-
-FX_STRSIZE CFX_WideString::Find(const CFX_WideStringC& pSub,
- FX_STRSIZE nStart) const {
- if (!m_pData)
- return -1;
-
- FX_STRSIZE nLength = m_pData->m_nDataLength;
- if (nStart > nLength)
- return -1;
-
- const FX_WCHAR* pStr =
- FX_wcsstr(m_pData->m_String + nStart, m_pData->m_nDataLength - nStart,
- pSub.c_str(), pSub.GetLength());
- return pStr ? (int)(pStr - m_pData->m_String) : -1;
-}
-
-void CFX_WideString::MakeLower() {
- if (!m_pData)
- return;
-
- ReallocBeforeWrite(m_pData->m_nDataLength);
- FXSYS_wcslwr(m_pData->m_String);
-}
-
-void CFX_WideString::MakeUpper() {
- if (!m_pData)
- return;
-
- ReallocBeforeWrite(m_pData->m_nDataLength);
- FXSYS_wcsupr(m_pData->m_String);
-}
-
-FX_STRSIZE CFX_WideString::Remove(FX_WCHAR chRemove) {
- if (!m_pData || m_pData->m_nDataLength < 1)
- return 0;
-
- FX_WCHAR* pstrSource = m_pData->m_String;
- FX_WCHAR* pstrEnd = m_pData->m_String + m_pData->m_nDataLength;
- while (pstrSource < pstrEnd) {
- if (*pstrSource == chRemove)
- break;
- pstrSource++;
- }
- if (pstrSource == pstrEnd)
- return 0;
-
- ptrdiff_t copied = pstrSource - m_pData->m_String;
- ReallocBeforeWrite(m_pData->m_nDataLength);
- pstrSource = m_pData->m_String + copied;
- pstrEnd = m_pData->m_String + m_pData->m_nDataLength;
-
- FX_WCHAR* pstrDest = pstrSource;
- while (pstrSource < pstrEnd) {
- if (*pstrSource != chRemove) {
- *pstrDest = *pstrSource;
- pstrDest++;
- }
- pstrSource++;
- }
-
- *pstrDest = 0;
- FX_STRSIZE nCount = (FX_STRSIZE)(pstrSource - pstrDest);
- m_pData->m_nDataLength -= nCount;
- return nCount;
-}
-
-FX_STRSIZE CFX_WideString::Replace(const CFX_WideStringC& pOld,
- const CFX_WideStringC& pNew) {
- if (!m_pData || pOld.IsEmpty())
- return 0;
-
- FX_STRSIZE nSourceLen = pOld.GetLength();
- FX_STRSIZE nReplacementLen = pNew.GetLength();
- FX_STRSIZE nCount = 0;
- const FX_WCHAR* pStart = m_pData->m_String;
- FX_WCHAR* pEnd = m_pData->m_String + m_pData->m_nDataLength;
- while (1) {
- const FX_WCHAR* pTarget = FX_wcsstr(pStart, (FX_STRSIZE)(pEnd - pStart),
- pOld.c_str(), nSourceLen);
- if (!pTarget)
- break;
-
- nCount++;
- pStart = pTarget + nSourceLen;
- }
- if (nCount == 0)
- return 0;
-
- FX_STRSIZE nNewLength =
- m_pData->m_nDataLength + (nReplacementLen - nSourceLen) * nCount;
-
- if (nNewLength == 0) {
- clear();
- return nCount;
- }
-
- CFX_RetainPtr<StringData> pNewData(StringData::Create(nNewLength));
- pStart = m_pData->m_String;
- FX_WCHAR* pDest = pNewData->m_String;
- for (FX_STRSIZE i = 0; i < nCount; i++) {
- const FX_WCHAR* pTarget = FX_wcsstr(pStart, (FX_STRSIZE)(pEnd - pStart),
- pOld.c_str(), nSourceLen);
- wmemcpy(pDest, pStart, pTarget - pStart);
- pDest += pTarget - pStart;
- wmemcpy(pDest, pNew.c_str(), pNew.GetLength());
- pDest += pNew.GetLength();
- pStart = pTarget + nSourceLen;
- }
- wmemcpy(pDest, pStart, pEnd - pStart);
- m_pData.Swap(pNewData);
- return nCount;
-}
-
-void CFX_WideString::SetAt(FX_STRSIZE nIndex, FX_WCHAR ch) {
- if (!m_pData) {
- return;
- }
- ASSERT(nIndex >= 0);
- ASSERT(nIndex < m_pData->m_nDataLength);
- ReallocBeforeWrite(m_pData->m_nDataLength);
- m_pData->m_String[nIndex] = ch;
-}
-
-// static
-CFX_WideString CFX_WideString::FromLocal(const CFX_ByteStringC& str) {
- return FromCodePage(str, 0);
-}
-
-// static
-CFX_WideString CFX_WideString::FromCodePage(const CFX_ByteStringC& str,
- uint16_t codepage) {
- return CFX_CharMap::GetWideString(codepage, str);
-}
-
-// static
-CFX_WideString CFX_WideString::FromUTF8(const CFX_ByteStringC& str) {
- if (str.IsEmpty())
- return CFX_WideString();
-
- CFX_UTF8Decoder decoder;
- for (FX_STRSIZE i = 0; i < str.GetLength(); i++)
- decoder.Input(str[i]);
-
- return CFX_WideString(decoder.GetResult());
-}
-
-// static
-CFX_WideString CFX_WideString::FromUTF16LE(const unsigned short* wstr,
- FX_STRSIZE wlen) {
- if (!wstr || 0 == wlen) {
- return CFX_WideString();
- }
-
- CFX_WideString result;
- FX_WCHAR* buf = result.GetBuffer(wlen);
- for (int i = 0; i < wlen; i++) {
- buf[i] = wstr[i];
- }
- result.ReleaseBuffer(wlen);
- return result;
-}
-
-int CFX_WideString::Compare(const FX_WCHAR* lpsz) const {
- if (m_pData)
- return FXSYS_wcscmp(m_pData->m_String, lpsz);
- return (!lpsz || lpsz[0] == 0) ? 0 : -1;
-}
-
-int CFX_WideString::Compare(const CFX_WideString& str) const {
- if (!m_pData) {
- if (!str.m_pData) {
- return 0;
- }
- return -1;
- }
- if (!str.m_pData) {
- return 1;
- }
- int this_len = m_pData->m_nDataLength;
- int that_len = str.m_pData->m_nDataLength;
- int min_len = this_len < that_len ? this_len : that_len;
- for (int i = 0; i < min_len; i++) {
- if (m_pData->m_String[i] < str.m_pData->m_String[i]) {
- return -1;
- }
- if (m_pData->m_String[i] > str.m_pData->m_String[i]) {
- return 1;
- }
- }
- if (this_len < that_len) {
- return -1;
- }
- if (this_len > that_len) {
- return 1;
- }
- return 0;
-}
-
-int CFX_WideString::CompareNoCase(const FX_WCHAR* lpsz) const {
- if (!m_pData) {
- return (!lpsz || lpsz[0] == 0) ? 0 : -1;
- }
- return FXSYS_wcsicmp(m_pData->m_String, lpsz);
-}
-
-FX_STRSIZE CFX_WideString::WStringLength(const unsigned short* str) {
- FX_STRSIZE len = 0;
- if (str)
- while (str[len])
- len++;
- return len;
-}
-
-void CFX_WideString::TrimRight(const CFX_WideStringC& pTargets) {
- if (IsEmpty() || pTargets.IsEmpty())
- return;
-
- FX_STRSIZE pos = GetLength();
- while (pos && pTargets.Find(m_pData->m_String[pos - 1]) != -1)
- pos--;
-
- if (pos < m_pData->m_nDataLength) {
- ReallocBeforeWrite(m_pData->m_nDataLength);
- m_pData->m_String[pos] = 0;
- m_pData->m_nDataLength = pos;
- }
-}
-
-void CFX_WideString::TrimRight(FX_WCHAR chTarget) {
- FX_WCHAR str[2] = {chTarget, 0};
- TrimRight(str);
-}
-
-void CFX_WideString::TrimRight() {
- TrimRight(L"\x09\x0a\x0b\x0c\x0d\x20");
-}
-
-void CFX_WideString::TrimLeft(const CFX_WideStringC& pTargets) {
- if (!m_pData || pTargets.IsEmpty())
- return;
-
- FX_STRSIZE len = GetLength();
- if (len < 1)
- return;
-
- FX_STRSIZE pos = 0;
- while (pos < len) {
- FX_STRSIZE i = 0;
- while (i < pTargets.GetLength() &&
- pTargets.CharAt(i) != m_pData->m_String[pos]) {
- i++;
- }
- if (i == pTargets.GetLength()) {
- break;
- }
- pos++;
- }
- if (pos) {
- ReallocBeforeWrite(len);
- FX_STRSIZE nDataLength = len - pos;
- FXSYS_memmove(m_pData->m_String, m_pData->m_String + pos,
- (nDataLength + 1) * sizeof(FX_WCHAR));
- m_pData->m_nDataLength = nDataLength;
- }
-}
-
-void CFX_WideString::TrimLeft(FX_WCHAR chTarget) {
- FX_WCHAR str[2] = {chTarget, 0};
- TrimLeft(str);
-}
-
-void CFX_WideString::TrimLeft() {
- TrimLeft(L"\x09\x0a\x0b\x0c\x0d\x20");
-}
-FX_FLOAT FX_wtof(const FX_WCHAR* str, int len) {
- if (len == 0) {
- return 0.0;
- }
- int cc = 0;
- bool bNegative = false;
- if (str[0] == '+') {
- cc++;
- } else if (str[0] == '-') {
- bNegative = true;
- cc++;
- }
- int integer = 0;
- while (cc < len) {
- if (str[cc] == '.') {
- break;
- }
- integer = integer * 10 + FXSYS_toDecimalDigit(str[cc]);
- cc++;
- }
- FX_FLOAT fraction = 0;
- if (str[cc] == '.') {
- cc++;
- FX_FLOAT scale = 0.1f;
- while (cc < len) {
- fraction += scale * FXSYS_toDecimalDigit(str[cc]);
- scale *= 0.1f;
- cc++;
- }
- }
- fraction += (FX_FLOAT)integer;
- return bNegative ? -fraction : fraction;
-}
-
-int CFX_WideString::GetInteger() const {
- return m_pData ? FXSYS_wtoi(m_pData->m_String) : 0;
-}
-
-FX_FLOAT CFX_WideString::GetFloat() const {
- return m_pData ? FX_wtof(m_pData->m_String, m_pData->m_nDataLength) : 0.0f;
-}
-
-// static
-CFX_ByteString CFX_CharMap::GetByteString(uint16_t codepage,
- const CFX_WideStringC& wstr) {
- ASSERT(IsValidCodePage(codepage));
- int src_len = wstr.GetLength();
- int dest_len = FXSYS_WideCharToMultiByte(codepage, 0, wstr.c_str(), src_len,
- nullptr, 0, nullptr, nullptr);
- CFX_ByteString bstr;
- if (dest_len) {
- FX_CHAR* dest_buf = bstr.GetBuffer(dest_len);
- FXSYS_WideCharToMultiByte(codepage, 0, wstr.c_str(), src_len, dest_buf,
- dest_len, nullptr, nullptr);
- bstr.ReleaseBuffer(dest_len);
- }
- return bstr;
-}
-
-// static
-CFX_WideString CFX_CharMap::GetWideString(uint16_t codepage,
- const CFX_ByteStringC& bstr) {
- ASSERT(IsValidCodePage(codepage));
- int src_len = bstr.GetLength();
- int dest_len =
- FXSYS_MultiByteToWideChar(codepage, 0, bstr.c_str(), src_len, nullptr, 0);
- CFX_WideString wstr;
- if (dest_len) {
- FX_WCHAR* dest_buf = wstr.GetBuffer(dest_len);
- FXSYS_MultiByteToWideChar(codepage, 0, bstr.c_str(), src_len, dest_buf,
- dest_len);
- wstr.ReleaseBuffer(dest_len);
- }
- return wstr;
-}
diff --git a/chromium/third_party/pdfium/core/fxcrt/fx_basic_wstring_unittest.cpp b/chromium/third_party/pdfium/core/fxcrt/fx_basic_wstring_unittest.cpp
deleted file mode 100644
index 07b5aaf13c1..00000000000
--- a/chromium/third_party/pdfium/core/fxcrt/fx_basic_wstring_unittest.cpp
+++ /dev/null
@@ -1,941 +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.
-
-#include "core/fxcrt/fx_basic.h"
-#include "testing/fx_string_testhelpers.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-TEST(fxcrt, WideStringOperatorSubscript) {
- // CFX_WideString includes the NUL terminator for non-empty strings.
- CFX_WideString abc(L"abc");
- EXPECT_EQ(L'a', abc[0]);
- EXPECT_EQ(L'b', abc[1]);
- EXPECT_EQ(L'c', abc[2]);
- EXPECT_EQ(L'\0', abc[3]);
-}
-
-TEST(fxcrt, WideStringOperatorLT) {
- CFX_WideString empty;
- CFX_WideString a(L"a");
- CFX_WideString abc(L"\x0110qq"); // Comes before despite endianness.
- CFX_WideString def(L"\x1001qq"); // Comes after despite endianness.
-
- EXPECT_FALSE(empty < empty);
- EXPECT_FALSE(a < a);
- EXPECT_FALSE(abc < abc);
- EXPECT_FALSE(def < def);
-
- EXPECT_TRUE(empty < a);
- EXPECT_FALSE(a < empty);
-
- EXPECT_TRUE(empty < abc);
- EXPECT_FALSE(abc < empty);
-
- EXPECT_TRUE(empty < def);
- EXPECT_FALSE(def < empty);
-
- EXPECT_TRUE(a < abc);
- EXPECT_FALSE(abc < a);
-
- EXPECT_TRUE(a < def);
- EXPECT_FALSE(def < a);
-
- EXPECT_TRUE(abc < def);
- EXPECT_FALSE(def < abc);
-}
-
-TEST(fxcrt, WideStringOperatorEQ) {
- CFX_WideString null_string;
- EXPECT_TRUE(null_string == null_string);
-
- CFX_WideString empty_string(L"");
- EXPECT_TRUE(empty_string == empty_string);
- EXPECT_TRUE(empty_string == null_string);
- EXPECT_TRUE(null_string == empty_string);
-
- CFX_WideString deleted_string(L"hello");
- deleted_string.Delete(0, 5);
- EXPECT_TRUE(deleted_string == deleted_string);
- EXPECT_TRUE(deleted_string == null_string);
- EXPECT_TRUE(deleted_string == empty_string);
- EXPECT_TRUE(null_string == deleted_string);
- EXPECT_TRUE(null_string == empty_string);
-
- CFX_WideString wide_string(L"hello");
- EXPECT_TRUE(wide_string == wide_string);
- EXPECT_FALSE(wide_string == null_string);
- EXPECT_FALSE(wide_string == empty_string);
- EXPECT_FALSE(wide_string == deleted_string);
- EXPECT_FALSE(null_string == wide_string);
- EXPECT_FALSE(empty_string == wide_string);
- EXPECT_FALSE(deleted_string == wide_string);
-
- CFX_WideString wide_string_same1(L"hello");
- EXPECT_TRUE(wide_string == wide_string_same1);
- EXPECT_TRUE(wide_string_same1 == wide_string);
-
- CFX_WideString wide_string_same2(wide_string);
- EXPECT_TRUE(wide_string == wide_string_same2);
- EXPECT_TRUE(wide_string_same2 == wide_string);
-
- CFX_WideString wide_string1(L"he");
- CFX_WideString wide_string2(L"hellp");
- CFX_WideString wide_string3(L"hellod");
- EXPECT_FALSE(wide_string == wide_string1);
- EXPECT_FALSE(wide_string == wide_string2);
- EXPECT_FALSE(wide_string == wide_string3);
- EXPECT_FALSE(wide_string1 == wide_string);
- EXPECT_FALSE(wide_string2 == wide_string);
- EXPECT_FALSE(wide_string3 == wide_string);
-
- CFX_WideStringC null_string_c;
- CFX_WideStringC empty_string_c(L"");
- EXPECT_TRUE(null_string == null_string_c);
- EXPECT_TRUE(null_string == empty_string_c);
- EXPECT_TRUE(empty_string == null_string_c);
- EXPECT_TRUE(empty_string == empty_string_c);
- EXPECT_TRUE(deleted_string == null_string_c);
- EXPECT_TRUE(deleted_string == empty_string_c);
- EXPECT_TRUE(null_string_c == null_string);
- EXPECT_TRUE(empty_string_c == null_string);
- EXPECT_TRUE(null_string_c == empty_string);
- EXPECT_TRUE(empty_string_c == empty_string);
- EXPECT_TRUE(null_string_c == deleted_string);
- EXPECT_TRUE(empty_string_c == deleted_string);
-
- CFX_WideStringC wide_string_c_same1(L"hello");
- EXPECT_TRUE(wide_string == wide_string_c_same1);
- EXPECT_TRUE(wide_string_c_same1 == wide_string);
-
- CFX_WideStringC wide_string_c1(L"he");
- CFX_WideStringC wide_string_c2(L"hellp");
- CFX_WideStringC wide_string_c3(L"hellod");
- EXPECT_FALSE(wide_string == wide_string_c1);
- EXPECT_FALSE(wide_string == wide_string_c2);
- EXPECT_FALSE(wide_string == wide_string_c3);
- EXPECT_FALSE(wide_string_c1 == wide_string);
- EXPECT_FALSE(wide_string_c2 == wide_string);
- EXPECT_FALSE(wide_string_c3 == wide_string);
-
- const wchar_t* c_null_string = nullptr;
- const wchar_t* c_empty_string = L"";
- EXPECT_TRUE(null_string == c_null_string);
- EXPECT_TRUE(null_string == c_empty_string);
- EXPECT_TRUE(empty_string == c_null_string);
- EXPECT_TRUE(empty_string == c_empty_string);
- EXPECT_TRUE(deleted_string == c_null_string);
- EXPECT_TRUE(deleted_string == c_empty_string);
- EXPECT_TRUE(c_null_string == null_string);
- EXPECT_TRUE(c_empty_string == null_string);
- EXPECT_TRUE(c_null_string == empty_string);
- EXPECT_TRUE(c_empty_string == empty_string);
- EXPECT_TRUE(c_null_string == deleted_string);
- EXPECT_TRUE(c_empty_string == deleted_string);
-
- const wchar_t* c_string_same1 = L"hello";
- EXPECT_TRUE(wide_string == c_string_same1);
- EXPECT_TRUE(c_string_same1 == wide_string);
-
- const wchar_t* c_string1 = L"he";
- const wchar_t* c_string2 = L"hellp";
- const wchar_t* c_string3 = L"hellod";
- EXPECT_FALSE(wide_string == c_string1);
- EXPECT_FALSE(wide_string == c_string2);
- EXPECT_FALSE(wide_string == c_string3);
- EXPECT_FALSE(c_string1 == wide_string);
- EXPECT_FALSE(c_string2 == wide_string);
- EXPECT_FALSE(c_string3 == wide_string);
-}
-
-TEST(fxcrt, WideStringOperatorNE) {
- CFX_WideString null_string;
- EXPECT_FALSE(null_string != null_string);
-
- CFX_WideString empty_string(L"");
- EXPECT_FALSE(empty_string != empty_string);
- EXPECT_FALSE(empty_string != null_string);
- EXPECT_FALSE(null_string != empty_string);
-
- CFX_WideString deleted_string(L"hello");
- deleted_string.Delete(0, 5);
- EXPECT_FALSE(deleted_string != deleted_string);
- EXPECT_FALSE(deleted_string != null_string);
- EXPECT_FALSE(deleted_string != empty_string);
- EXPECT_FALSE(null_string != deleted_string);
- EXPECT_FALSE(null_string != empty_string);
-
- CFX_WideString wide_string(L"hello");
- EXPECT_FALSE(wide_string != wide_string);
- EXPECT_TRUE(wide_string != null_string);
- EXPECT_TRUE(wide_string != empty_string);
- EXPECT_TRUE(wide_string != deleted_string);
- EXPECT_TRUE(null_string != wide_string);
- EXPECT_TRUE(empty_string != wide_string);
- EXPECT_TRUE(deleted_string != wide_string);
-
- CFX_WideString wide_string_same1(L"hello");
- EXPECT_FALSE(wide_string != wide_string_same1);
- EXPECT_FALSE(wide_string_same1 != wide_string);
-
- CFX_WideString wide_string_same2(wide_string);
- EXPECT_FALSE(wide_string != wide_string_same2);
- EXPECT_FALSE(wide_string_same2 != wide_string);
-
- CFX_WideString wide_string1(L"he");
- CFX_WideString wide_string2(L"hellp");
- CFX_WideString wide_string3(L"hellod");
- EXPECT_TRUE(wide_string != wide_string1);
- EXPECT_TRUE(wide_string != wide_string2);
- EXPECT_TRUE(wide_string != wide_string3);
- EXPECT_TRUE(wide_string1 != wide_string);
- EXPECT_TRUE(wide_string2 != wide_string);
- EXPECT_TRUE(wide_string3 != wide_string);
-
- CFX_WideStringC null_string_c;
- CFX_WideStringC empty_string_c(L"");
- EXPECT_FALSE(null_string != null_string_c);
- EXPECT_FALSE(null_string != empty_string_c);
- EXPECT_FALSE(empty_string != null_string_c);
- EXPECT_FALSE(empty_string != empty_string_c);
- EXPECT_FALSE(deleted_string != null_string_c);
- EXPECT_FALSE(deleted_string != empty_string_c);
- EXPECT_FALSE(null_string_c != null_string);
- EXPECT_FALSE(empty_string_c != null_string);
- EXPECT_FALSE(null_string_c != empty_string);
- EXPECT_FALSE(empty_string_c != empty_string);
-
- CFX_WideStringC wide_string_c_same1(L"hello");
- EXPECT_FALSE(wide_string != wide_string_c_same1);
- EXPECT_FALSE(wide_string_c_same1 != wide_string);
-
- CFX_WideStringC wide_string_c1(L"he");
- CFX_WideStringC wide_string_c2(L"hellp");
- CFX_WideStringC wide_string_c3(L"hellod");
- EXPECT_TRUE(wide_string != wide_string_c1);
- EXPECT_TRUE(wide_string != wide_string_c2);
- EXPECT_TRUE(wide_string != wide_string_c3);
- EXPECT_TRUE(wide_string_c1 != wide_string);
- EXPECT_TRUE(wide_string_c2 != wide_string);
- EXPECT_TRUE(wide_string_c3 != wide_string);
-
- const wchar_t* c_null_string = nullptr;
- const wchar_t* c_empty_string = L"";
- EXPECT_FALSE(null_string != c_null_string);
- EXPECT_FALSE(null_string != c_empty_string);
- EXPECT_FALSE(empty_string != c_null_string);
- EXPECT_FALSE(empty_string != c_empty_string);
- EXPECT_FALSE(deleted_string != c_null_string);
- EXPECT_FALSE(deleted_string != c_empty_string);
- EXPECT_FALSE(c_null_string != null_string);
- EXPECT_FALSE(c_empty_string != null_string);
- EXPECT_FALSE(c_null_string != empty_string);
- EXPECT_FALSE(c_empty_string != empty_string);
- EXPECT_FALSE(c_null_string != deleted_string);
- EXPECT_FALSE(c_empty_string != deleted_string);
-
- const wchar_t* c_string_same1 = L"hello";
- EXPECT_FALSE(wide_string != c_string_same1);
- EXPECT_FALSE(c_string_same1 != wide_string);
-
- const wchar_t* c_string1 = L"he";
- const wchar_t* c_string2 = L"hellp";
- const wchar_t* c_string3 = L"hellod";
- EXPECT_TRUE(wide_string != c_string1);
- EXPECT_TRUE(wide_string != c_string2);
- EXPECT_TRUE(wide_string != c_string3);
- EXPECT_TRUE(c_string1 != wide_string);
- EXPECT_TRUE(c_string2 != wide_string);
- EXPECT_TRUE(c_string3 != wide_string);
-}
-
-TEST(fxcrt, WideStringConcatInPlace) {
- CFX_WideString fred;
- fred.Concat(L"FRED", 4);
- EXPECT_EQ(L"FRED", fred);
-
- fred.Concat(L"DY", 2);
- EXPECT_EQ(L"FREDDY", fred);
-
- fred.Delete(3, 3);
- EXPECT_EQ(L"FRE", fred);
-
- fred.Concat(L"D", 1);
- EXPECT_EQ(L"FRED", fred);
-
- CFX_WideString copy = fred;
- fred.Concat(L"DY", 2);
- EXPECT_EQ(L"FREDDY", fred);
- EXPECT_EQ(L"FRED", copy);
-
- // Test invalid arguments.
- copy = fred;
- fred.Concat(L"freddy", -6);
- CFX_WideString not_aliased(L"xxxxxx");
- EXPECT_EQ(L"FREDDY", fred);
- EXPECT_EQ(L"xxxxxx", not_aliased);
-}
-
-TEST(fxcrt, WideStringRemove) {
- CFX_WideString freed(L"FREED");
- freed.Remove(L'E');
- EXPECT_EQ(L"FRD", freed);
- freed.Remove(L'F');
- EXPECT_EQ(L"RD", freed);
- freed.Remove(L'D');
- EXPECT_EQ(L"R", freed);
- freed.Remove(L'X');
- EXPECT_EQ(L"R", freed);
- freed.Remove(L'R');
- EXPECT_EQ(L"", freed);
-
- CFX_WideString empty;
- empty.Remove(L'X');
- EXPECT_EQ(L"", empty);
-}
-
-TEST(fxcrt, WideStringRemoveCopies) {
- CFX_WideString freed(L"FREED");
- const FX_WCHAR* old_buffer = freed.c_str();
-
- // No change with single reference - no copy.
- freed.Remove(L'Q');
- EXPECT_EQ(L"FREED", freed);
- EXPECT_EQ(old_buffer, freed.c_str());
-
- // Change with single reference - no copy.
- freed.Remove(L'E');
- EXPECT_EQ(L"FRD", freed);
- EXPECT_EQ(old_buffer, freed.c_str());
-
- // No change with multiple references - no copy.
- CFX_WideString shared(freed);
- freed.Remove(L'Q');
- EXPECT_EQ(L"FRD", freed);
- EXPECT_EQ(old_buffer, freed.c_str());
- EXPECT_EQ(old_buffer, shared.c_str());
-
- // Change with multiple references -- must copy.
- freed.Remove(L'D');
- EXPECT_EQ(L"FR", freed);
- EXPECT_NE(old_buffer, freed.c_str());
- EXPECT_EQ(L"FRD", shared);
- EXPECT_EQ(old_buffer, shared.c_str());
-}
-
-TEST(fxcrt, WideStringReplace) {
- CFX_WideString fred(L"FRED");
- fred.Replace(L"FR", L"BL");
- EXPECT_EQ(L"BLED", fred);
- fred.Replace(L"D", L"DDY");
- EXPECT_EQ(L"BLEDDY", fred);
- fred.Replace(L"LEDD", L"");
- EXPECT_EQ(L"BY", fred);
- fred.Replace(L"X", L"CLAMS");
- EXPECT_EQ(L"BY", fred);
- fred.Replace(L"BY", L"HI");
- EXPECT_EQ(L"HI", fred);
- fred.Replace(L"", L"CLAMS");
- EXPECT_EQ(L"HI", fred);
- fred.Replace(L"HI", L"");
- EXPECT_EQ(L"", fred);
-}
-
-TEST(fxcrt, WideStringInsert) {
- CFX_WideString fred(L"FRED");
- fred.Insert(-1, 'X');
- EXPECT_EQ(L"XFRED", fred);
-
- fred.Insert(0, 'S');
- EXPECT_EQ(L"SXFRED", fred);
-
- fred.Insert(2, 'T');
- EXPECT_EQ(L"SXTFRED", fred);
-
- fred.Insert(5, 'U');
- EXPECT_EQ(L"SXTFRUED", fred);
-
- fred.Insert(8, 'V');
- EXPECT_EQ(L"SXTFRUEDV", fred);
-
- fred.Insert(12, 'P');
- EXPECT_EQ(L"SXTFRUEDVP", fred);
-
- {
- CFX_WideString empty;
- empty.Insert(-1, 'X');
- EXPECT_EQ(L"X", empty);
- }
- {
- CFX_WideString empty;
- empty.Insert(0, 'X');
- EXPECT_EQ(L"X", empty);
- }
- {
- CFX_WideString empty;
- empty.Insert(5, 'X');
- EXPECT_EQ(L"X", empty);
- }
-}
-
-TEST(fxcrt, WideStringDelete) {
- CFX_WideString fred(L"FRED");
- fred.Delete(0, 2);
- EXPECT_EQ(L"ED", fred);
- fred.Delete(1);
- EXPECT_EQ(L"E", fred);
- fred.Delete(-1);
- EXPECT_EQ(L"", fred);
- fred.Delete(1);
- EXPECT_EQ(L"", fred);
-
- CFX_WideString empty;
- empty.Delete(0);
- EXPECT_EQ(L"", empty);
- empty.Delete(-1);
- EXPECT_EQ(L"", empty);
- empty.Delete(1);
- EXPECT_EQ(L"", empty);
-}
-
-TEST(fxcrt, WideStringMid) {
- CFX_WideString fred(L"FRED");
- EXPECT_EQ(L"", fred.Mid(0, 0));
- EXPECT_EQ(L"", fred.Mid(3, 0));
- EXPECT_EQ(L"FRED", fred.Mid(0));
- EXPECT_EQ(L"RED", fred.Mid(1));
- EXPECT_EQ(L"ED", fred.Mid(2));
- EXPECT_EQ(L"D", fred.Mid(3));
- EXPECT_EQ(L"F", fred.Mid(0, 1));
- EXPECT_EQ(L"R", fred.Mid(1, 1));
- EXPECT_EQ(L"E", fred.Mid(2, 1));
- EXPECT_EQ(L"D", fred.Mid(3, 1));
- EXPECT_EQ(L"FR", fred.Mid(0, 2));
- EXPECT_EQ(L"FRED", fred.Mid(0, 4));
- EXPECT_EQ(L"FRED", fred.Mid(0, 10));
-
- EXPECT_EQ(L"FR", fred.Mid(-1, 2));
- EXPECT_EQ(L"RED", fred.Mid(1, 4));
- EXPECT_EQ(L"", fred.Mid(4, 1));
-
- CFX_WideString empty;
- EXPECT_EQ(L"", empty.Mid(0, 0));
- EXPECT_EQ(L"", empty.Mid(0));
- EXPECT_EQ(L"", empty.Mid(1));
- EXPECT_EQ(L"", empty.Mid(-1));
-}
-
-TEST(fxcrt, WideStringLeft) {
- CFX_WideString fred(L"FRED");
- EXPECT_EQ(L"", fred.Left(0));
- EXPECT_EQ(L"F", fred.Left(1));
- EXPECT_EQ(L"FR", fred.Left(2));
- EXPECT_EQ(L"FRE", fred.Left(3));
- EXPECT_EQ(L"FRED", fred.Left(4));
-
- EXPECT_EQ(L"FRED", fred.Left(5));
- EXPECT_EQ(L"", fred.Left(-1));
-
- CFX_WideString empty;
- EXPECT_EQ(L"", empty.Left(0));
- EXPECT_EQ(L"", empty.Left(1));
- EXPECT_EQ(L"", empty.Left(-1));
-}
-
-TEST(fxcrt, WideStringRight) {
- CFX_WideString fred(L"FRED");
- EXPECT_EQ(L"", fred.Right(0));
- EXPECT_EQ(L"D", fred.Right(1));
- EXPECT_EQ(L"ED", fred.Right(2));
- EXPECT_EQ(L"RED", fred.Right(3));
- EXPECT_EQ(L"FRED", fred.Right(4));
-
- EXPECT_EQ(L"FRED", fred.Right(5));
- EXPECT_EQ(L"", fred.Right(-1));
-
- CFX_WideString empty;
- EXPECT_EQ(L"", empty.Right(0));
- EXPECT_EQ(L"", empty.Right(1));
- EXPECT_EQ(L"", empty.Right(-1));
-}
-
-TEST(fxcrt, WideStringUpperLower) {
- CFX_WideString fred(L"F-Re.42D");
- fred.MakeLower();
- EXPECT_EQ(L"f-re.42d", fred);
- fred.MakeUpper();
- EXPECT_EQ(L"F-RE.42D", fred);
-
- CFX_WideString empty;
- empty.MakeLower();
- EXPECT_EQ(L"", empty);
- empty.MakeUpper();
- EXPECT_EQ(L"", empty);
-}
-
-TEST(fxcrt, WideStringTrimRight) {
- CFX_WideString fred(L" FRED ");
- fred.TrimRight();
- EXPECT_EQ(L" FRED", fred);
- fred.TrimRight(L'E');
- EXPECT_EQ(L" FRED", fred);
- fred.TrimRight(L'D');
- EXPECT_EQ(L" FRE", fred);
- fred.TrimRight(L"ERP");
- EXPECT_EQ(L" F", fred);
-
- CFX_WideString blank(L" ");
- blank.TrimRight(L"ERP");
- EXPECT_EQ(L" ", blank);
- blank.TrimRight(L'E');
- EXPECT_EQ(L" ", blank);
- blank.TrimRight();
- EXPECT_EQ(L"", blank);
-
- CFX_WideString empty;
- empty.TrimRight(L"ERP");
- EXPECT_EQ(L"", empty);
- empty.TrimRight(L'E');
- EXPECT_EQ(L"", empty);
- empty.TrimRight();
- EXPECT_EQ(L"", empty);
-}
-
-TEST(fxcrt, WideStringTrimRightCopies) {
- {
- // With a single reference, no copy takes place.
- CFX_WideString fred(L" FRED ");
- const FX_WCHAR* old_buffer = fred.c_str();
- fred.TrimRight();
- EXPECT_EQ(L" FRED", fred);
- EXPECT_EQ(old_buffer, fred.c_str());
- }
- {
- // With multiple references, we must copy.
- CFX_WideString fred(L" FRED ");
- CFX_WideString other_fred = fred;
- const FX_WCHAR* old_buffer = fred.c_str();
- fred.TrimRight();
- EXPECT_EQ(L" FRED", fred);
- EXPECT_EQ(L" FRED ", other_fred);
- EXPECT_NE(old_buffer, fred.c_str());
- }
- {
- // With multiple references, but no modifications, no copy.
- CFX_WideString fred(L"FRED");
- CFX_WideString other_fred = fred;
- const FX_WCHAR* old_buffer = fred.c_str();
- fred.TrimRight();
- EXPECT_EQ(L"FRED", fred);
- EXPECT_EQ(L"FRED", other_fred);
- EXPECT_EQ(old_buffer, fred.c_str());
- }
-}
-
-TEST(fxcrt, WideStringTrimLeft) {
- CFX_WideString fred(L" FRED ");
- fred.TrimLeft();
- EXPECT_EQ(L"FRED ", fred);
- fred.TrimLeft(L'E');
- EXPECT_EQ(L"FRED ", fred);
- fred.TrimLeft(L'F');
- EXPECT_EQ(L"RED ", fred);
- fred.TrimLeft(L"ERP");
- EXPECT_EQ(L"D ", fred);
-
- CFX_WideString blank(L" ");
- blank.TrimLeft(L"ERP");
- EXPECT_EQ(L" ", blank);
- blank.TrimLeft(L'E');
- EXPECT_EQ(L" ", blank);
- blank.TrimLeft();
- EXPECT_EQ(L"", blank);
-
- CFX_WideString empty;
- empty.TrimLeft(L"ERP");
- EXPECT_EQ(L"", empty);
- empty.TrimLeft(L'E');
- EXPECT_EQ(L"", empty);
- empty.TrimLeft();
- EXPECT_EQ(L"", empty);
-}
-
-TEST(fxcrt, WideStringTrimLeftCopies) {
- {
- // With a single reference, no copy takes place.
- CFX_WideString fred(L" FRED ");
- const FX_WCHAR* old_buffer = fred.c_str();
- fred.TrimLeft();
- EXPECT_EQ(L"FRED ", fred);
- EXPECT_EQ(old_buffer, fred.c_str());
- }
- {
- // With multiple references, we must copy.
- CFX_WideString fred(L" FRED ");
- CFX_WideString other_fred = fred;
- const FX_WCHAR* old_buffer = fred.c_str();
- fred.TrimLeft();
- EXPECT_EQ(L"FRED ", fred);
- EXPECT_EQ(L" FRED ", other_fred);
- EXPECT_NE(old_buffer, fred.c_str());
- }
- {
- // With multiple references, but no modifications, no copy.
- CFX_WideString fred(L"FRED");
- CFX_WideString other_fred = fred;
- const FX_WCHAR* old_buffer = fred.c_str();
- fred.TrimLeft();
- EXPECT_EQ(L"FRED", fred);
- EXPECT_EQ(L"FRED", other_fred);
- EXPECT_EQ(old_buffer, fred.c_str());
- }
-}
-
-TEST(fxcrt, WideStringReserve) {
- {
- CFX_WideString str;
- str.Reserve(6);
- const FX_WCHAR* old_buffer = str.c_str();
- str += L"ABCDEF";
- EXPECT_EQ(old_buffer, str.c_str());
- str += L"Blah Blah Blah Blah Blah Blah";
- EXPECT_NE(old_buffer, str.c_str());
- }
- {
- CFX_WideString str(L"A");
- str.Reserve(6);
- const FX_WCHAR* old_buffer = str.c_str();
- str += L"BCDEF";
- EXPECT_EQ(old_buffer, str.c_str());
- str += L"Blah Blah Blah Blah Blah Blah";
- EXPECT_NE(old_buffer, str.c_str());
- }
-}
-
-TEST(fxcrt, WideStringGetBuffer) {
- {
- CFX_WideString str;
- FX_WCHAR* buffer = str.GetBuffer(12);
- wcscpy(buffer, L"clams");
- str.ReleaseBuffer();
- EXPECT_EQ(L"clams", str);
- }
- {
- CFX_WideString str(L"cl");
- FX_WCHAR* buffer = str.GetBuffer(12);
- wcscpy(buffer + 2, L"ams");
- str.ReleaseBuffer();
- EXPECT_EQ(L"clams", str);
- }
-}
-
-TEST(fxcrt, WideStringReleaseBuffer) {
- {
- CFX_WideString str;
- str.Reserve(12);
- str += L"clams";
- const FX_WCHAR* old_buffer = str.c_str();
- str.ReleaseBuffer(4);
- EXPECT_EQ(old_buffer, str.c_str());
- EXPECT_EQ(L"clam", str);
- }
- {
- CFX_WideString str(L"c");
- str.Reserve(12);
- str += L"lams";
- const FX_WCHAR* old_buffer = str.c_str();
- str.ReleaseBuffer(4);
- EXPECT_EQ(old_buffer, str.c_str());
- EXPECT_EQ(L"clam", str);
- }
- {
- CFX_WideString str;
- str.Reserve(200);
- str += L"clams";
- const FX_WCHAR* old_buffer = str.c_str();
- str.ReleaseBuffer(4);
- EXPECT_NE(old_buffer, str.c_str());
- EXPECT_EQ(L"clam", str);
- }
- {
- CFX_WideString str(L"c");
- str.Reserve(200);
- str += L"lams";
- const FX_WCHAR* old_buffer = str.c_str();
- str.ReleaseBuffer(4);
- EXPECT_NE(old_buffer, str.c_str());
- EXPECT_EQ(L"clam", str);
- }
-}
-
-TEST(fxcrt, WideStringUTF16LE_Encode) {
- struct UTF16LEEncodeCase {
- CFX_WideString ws;
- CFX_ByteString bs;
- } utf16le_encode_cases[] = {
- {L"", CFX_ByteString("\0\0", 2)},
- {L"abc", CFX_ByteString("a\0b\0c\0\0\0", 8)},
- {L"abcdef", CFX_ByteString("a\0b\0c\0d\0e\0f\0\0\0", 14)},
- {L"abc\0def", CFX_ByteString("a\0b\0c\0\0\0", 8)},
- {L"\xaabb\xccdd", CFX_ByteString("\xbb\xaa\xdd\xcc\0\0", 6)},
- {L"\x3132\x6162", CFX_ByteString("\x32\x31\x62\x61\0\0", 6)},
- };
-
- for (size_t i = 0; i < FX_ArraySize(utf16le_encode_cases); ++i) {
- EXPECT_EQ(utf16le_encode_cases[i].bs,
- utf16le_encode_cases[i].ws.UTF16LE_Encode())
- << " for case number " << i;
- }
-}
-
-TEST(fxcrt, WideStringCOperatorSubscript) {
- // CFX_WideStringC includes the NUL terminator for non-empty strings.
- CFX_WideStringC abc(L"abc");
- EXPECT_EQ(L'a', abc.CharAt(0));
- EXPECT_EQ(L'b', abc.CharAt(1));
- EXPECT_EQ(L'c', abc.CharAt(2));
- EXPECT_EQ(L'\0', abc.CharAt(3));
-}
-
-TEST(fxcrt, WideStringCOperatorLT) {
- CFX_WideStringC empty;
- CFX_WideStringC a(L"a");
- CFX_WideStringC abc(L"\x0110qq"); // Comes before despite endianness.
- CFX_WideStringC def(L"\x1001qq"); // Comes after despite endianness.
-
- EXPECT_FALSE(empty < empty);
- EXPECT_FALSE(a < a);
- EXPECT_FALSE(abc < abc);
- EXPECT_FALSE(def < def);
-
- EXPECT_TRUE(empty < a);
- EXPECT_FALSE(a < empty);
-
- EXPECT_TRUE(empty < abc);
- EXPECT_FALSE(abc < empty);
-
- EXPECT_TRUE(empty < def);
- EXPECT_FALSE(def < empty);
-
- EXPECT_TRUE(a < abc);
- EXPECT_FALSE(abc < a);
-
- EXPECT_TRUE(a < def);
- EXPECT_FALSE(def < a);
-
- EXPECT_TRUE(abc < def);
- EXPECT_FALSE(def < abc);
-}
-
-TEST(fxcrt, WideStringCOperatorEQ) {
- CFX_WideStringC wide_string_c(L"hello");
- EXPECT_TRUE(wide_string_c == wide_string_c);
-
- CFX_WideStringC wide_string_c_same1(L"hello");
- EXPECT_TRUE(wide_string_c == wide_string_c_same1);
- EXPECT_TRUE(wide_string_c_same1 == wide_string_c);
-
- CFX_WideStringC wide_string_c_same2(wide_string_c);
- EXPECT_TRUE(wide_string_c == wide_string_c_same2);
- EXPECT_TRUE(wide_string_c_same2 == wide_string_c);
-
- CFX_WideStringC wide_string_c1(L"he");
- CFX_WideStringC wide_string_c2(L"hellp");
- CFX_WideStringC wide_string_c3(L"hellod");
- EXPECT_FALSE(wide_string_c == wide_string_c1);
- EXPECT_FALSE(wide_string_c == wide_string_c2);
- EXPECT_FALSE(wide_string_c == wide_string_c3);
- EXPECT_FALSE(wide_string_c1 == wide_string_c);
- EXPECT_FALSE(wide_string_c2 == wide_string_c);
- EXPECT_FALSE(wide_string_c3 == wide_string_c);
-
- CFX_WideString wide_string_same1(L"hello");
- EXPECT_TRUE(wide_string_c == wide_string_same1);
- EXPECT_TRUE(wide_string_same1 == wide_string_c);
-
- CFX_WideString wide_string1(L"he");
- CFX_WideString wide_string2(L"hellp");
- CFX_WideString wide_string3(L"hellod");
- EXPECT_FALSE(wide_string_c == wide_string1);
- EXPECT_FALSE(wide_string_c == wide_string2);
- EXPECT_FALSE(wide_string_c == wide_string3);
- EXPECT_FALSE(wide_string1 == wide_string_c);
- EXPECT_FALSE(wide_string2 == wide_string_c);
- EXPECT_FALSE(wide_string3 == wide_string_c);
-
- const wchar_t* c_string_same1 = L"hello";
- EXPECT_TRUE(wide_string_c == c_string_same1);
- EXPECT_TRUE(c_string_same1 == wide_string_c);
-
- const wchar_t* c_string1 = L"he";
- const wchar_t* c_string2 = L"hellp";
- const wchar_t* c_string3 = L"hellod";
- EXPECT_FALSE(wide_string_c == c_string1);
- EXPECT_FALSE(wide_string_c == c_string2);
- EXPECT_FALSE(wide_string_c == c_string3);
-
- EXPECT_FALSE(c_string1 == wide_string_c);
- EXPECT_FALSE(c_string2 == wide_string_c);
- EXPECT_FALSE(c_string3 == wide_string_c);
-}
-
-TEST(fxcrt, WideStringCOperatorNE) {
- CFX_WideStringC wide_string_c(L"hello");
- EXPECT_FALSE(wide_string_c != wide_string_c);
-
- CFX_WideStringC wide_string_c_same1(L"hello");
- EXPECT_FALSE(wide_string_c != wide_string_c_same1);
- EXPECT_FALSE(wide_string_c_same1 != wide_string_c);
-
- CFX_WideStringC wide_string_c_same2(wide_string_c);
- EXPECT_FALSE(wide_string_c != wide_string_c_same2);
- EXPECT_FALSE(wide_string_c_same2 != wide_string_c);
-
- CFX_WideStringC wide_string_c1(L"he");
- CFX_WideStringC wide_string_c2(L"hellp");
- CFX_WideStringC wide_string_c3(L"hellod");
- EXPECT_TRUE(wide_string_c != wide_string_c1);
- EXPECT_TRUE(wide_string_c != wide_string_c2);
- EXPECT_TRUE(wide_string_c != wide_string_c3);
- EXPECT_TRUE(wide_string_c1 != wide_string_c);
- EXPECT_TRUE(wide_string_c2 != wide_string_c);
- EXPECT_TRUE(wide_string_c3 != wide_string_c);
-
- CFX_WideString wide_string_same1(L"hello");
- EXPECT_FALSE(wide_string_c != wide_string_same1);
- EXPECT_FALSE(wide_string_same1 != wide_string_c);
-
- CFX_WideString wide_string1(L"he");
- CFX_WideString wide_string2(L"hellp");
- CFX_WideString wide_string3(L"hellod");
- EXPECT_TRUE(wide_string_c != wide_string1);
- EXPECT_TRUE(wide_string_c != wide_string2);
- EXPECT_TRUE(wide_string_c != wide_string3);
- EXPECT_TRUE(wide_string1 != wide_string_c);
- EXPECT_TRUE(wide_string2 != wide_string_c);
- EXPECT_TRUE(wide_string3 != wide_string_c);
-
- const wchar_t* c_string_same1 = L"hello";
- EXPECT_FALSE(wide_string_c != c_string_same1);
- EXPECT_FALSE(c_string_same1 != wide_string_c);
-
- const wchar_t* c_string1 = L"he";
- const wchar_t* c_string2 = L"hellp";
- const wchar_t* c_string3 = L"hellod";
- EXPECT_TRUE(wide_string_c != c_string1);
- EXPECT_TRUE(wide_string_c != c_string2);
- EXPECT_TRUE(wide_string_c != c_string3);
-
- EXPECT_TRUE(c_string1 != wide_string_c);
- EXPECT_TRUE(c_string2 != wide_string_c);
- EXPECT_TRUE(c_string3 != wide_string_c);
-}
-
-TEST(fxcrt, WideStringCFind) {
- CFX_WideStringC null_string;
- EXPECT_EQ(-1, null_string.Find(L'a'));
- EXPECT_EQ(-1, null_string.Find(0));
-
- CFX_WideStringC empty_string(L"");
- EXPECT_EQ(-1, empty_string.Find(L'a'));
- EXPECT_EQ(-1, empty_string.Find(0));
-
- CFX_WideStringC single_string(L"a");
- EXPECT_EQ(0, single_string.Find(L'a'));
- EXPECT_EQ(-1, single_string.Find(L'b'));
- EXPECT_EQ(-1, single_string.Find(0));
-
- CFX_WideStringC longer_string(L"abccc");
- EXPECT_EQ(0, longer_string.Find(L'a'));
- EXPECT_EQ(2, longer_string.Find(L'c'));
- EXPECT_EQ(-1, longer_string.Find(0));
-
- CFX_WideStringC hibyte_string(
- L"ab\xff08"
- L"def");
- EXPECT_EQ(2, hibyte_string.Find(L'\xff08'));
-}
-
-TEST(fxcrt, WideStringFormatWidth) {
- {
- CFX_WideString str;
- str.Format(L"%5d", 1);
- EXPECT_EQ(L" 1", str);
- }
-
- {
- CFX_WideString str;
- str.Format(L"%d", 1);
- EXPECT_EQ(L"1", str);
- }
-
- {
- CFX_WideString str;
- str.Format(L"%*d", 5, 1);
- EXPECT_EQ(L" 1", str);
- }
-
- {
- CFX_WideString str;
- str.Format(L"%-1d", 1);
- EXPECT_EQ(L"1", str);
- }
-
- {
- CFX_WideString str;
- str.Format(L"%0d", 1);
- EXPECT_EQ(L"1", str);
- }
-
- {
- CFX_WideString str;
- str.Format(L"%1048576d", 1);
- EXPECT_EQ(L"Bad width", str);
- }
-}
-
-TEST(fxcrt, WideStringFormatPrecision) {
- {
- CFX_WideString str;
- str.Format(L"%.2f", 1.12345);
- EXPECT_EQ(L"1.12", str);
- }
-
- {
- CFX_WideString str;
- str.Format(L"%.*f", 3, 1.12345);
- EXPECT_EQ(L"1.123", str);
- }
-
- {
- CFX_WideString str;
- str.Format(L"%f", 1.12345);
- EXPECT_EQ(L"1.123450", str);
- }
-
- {
- CFX_WideString str;
- str.Format(L"%-1f", 1.12345);
- EXPECT_EQ(L"1.123450", str);
- }
-
- {
- CFX_WideString str;
- str.Format(L"%0f", 1.12345);
- EXPECT_EQ(L"1.123450", str);
- }
-
- {
- CFX_WideString str;
- str.Format(L"%.1048576f", 1.2);
- EXPECT_EQ(L"Bad precision", str);
- }
-}
-
-TEST(fxcrt, EmptyWideString) {
- CFX_WideString empty_str;
- EXPECT_TRUE(empty_str.IsEmpty());
- EXPECT_EQ(0, empty_str.GetLength());
- const FX_WCHAR* cstr = empty_str.c_str();
- EXPECT_EQ(0, FXSYS_wcslen(cstr));
-}
diff --git a/chromium/third_party/pdfium/core/fxcrt/fx_bidi.cpp b/chromium/third_party/pdfium/core/fxcrt/fx_bidi.cpp
index e82b3e72847..5ad6439e07f 100644
--- a/chromium/third_party/pdfium/core/fxcrt/fx_bidi.cpp
+++ b/chromium/third_party/pdfium/core/fxcrt/fx_bidi.cpp
@@ -12,7 +12,7 @@
CFX_BidiChar::CFX_BidiChar()
: m_CurrentSegment({0, 0, NEUTRAL}), m_LastSegment({0, 0, NEUTRAL}) {}
-bool CFX_BidiChar::AppendChar(FX_WCHAR wch) {
+bool CFX_BidiChar::AppendChar(wchar_t wch) {
uint32_t dwProps = FX_GetUnicodeProperties(wch);
int32_t iBidiCls = (dwProps & FX_BIDICLASSBITSMASK) >> FX_BIDICLASSBITS;
Direction direction = NEUTRAL;
diff --git a/chromium/third_party/pdfium/core/fxcrt/fx_bidi.h b/chromium/third_party/pdfium/core/fxcrt/fx_bidi.h
index 8d12cc89978..d5e0bd3f620 100644
--- a/chromium/third_party/pdfium/core/fxcrt/fx_bidi.h
+++ b/chromium/third_party/pdfium/core/fxcrt/fx_bidi.h
@@ -28,7 +28,7 @@ class CFX_BidiChar {
// Append a character and classify it as left, right, or neutral.
// Returns true if the character has a different direction than the
// existing direction to indicate there is a segment to process.
- bool AppendChar(FX_WCHAR wch);
+ bool AppendChar(wchar_t wch);
// Call this after the last character has been appended. AppendChar()
// must not be called after this.
@@ -61,7 +61,7 @@ class CFX_BidiString {
// Force the overall direction to be R2L regardless of what was detected.
void SetOverallDirectionRight();
- FX_WCHAR CharAt(size_t x) const { return m_Str[x]; }
+ wchar_t CharAt(size_t x) const { return m_Str[x]; }
const_iterator begin() const { return m_Order.begin(); }
const_iterator end() const { return m_Order.end(); }
diff --git a/chromium/third_party/pdfium/core/fxcrt/fx_bidi_unittest.cpp b/chromium/third_party/pdfium/core/fxcrt/fx_bidi_unittest.cpp
index 2c1996be461..ad598a6741d 100644
--- a/chromium/third_party/pdfium/core/fxcrt/fx_bidi_unittest.cpp
+++ b/chromium/third_party/pdfium/core/fxcrt/fx_bidi_unittest.cpp
@@ -7,9 +7,9 @@
namespace {
-const FX_WCHAR kNeutralChar = 32;
-const FX_WCHAR kLeftChar = 65;
-const FX_WCHAR kRightChar = 1424;
+const wchar_t kNeutralChar = 32;
+const wchar_t kLeftChar = 65;
+const wchar_t kRightChar = 1424;
} // namespace
@@ -126,7 +126,7 @@ TEST(fxcrt, BidiStringEmpty) {
TEST(fxcrt, BidiStringAllNeutral) {
{
- const FX_WCHAR str[] = {kNeutralChar, 0};
+ const wchar_t str[] = {kNeutralChar, 0};
CFX_BidiString bidi(str);
EXPECT_EQ(CFX_BidiChar::LEFT, bidi.OverallDirection());
@@ -139,7 +139,7 @@ TEST(fxcrt, BidiStringAllNeutral) {
EXPECT_TRUE(it == bidi.end());
}
{
- const FX_WCHAR str[] = {kNeutralChar, kNeutralChar, kNeutralChar, 0};
+ const wchar_t str[] = {kNeutralChar, kNeutralChar, kNeutralChar, 0};
CFX_BidiString bidi(str);
EXPECT_EQ(CFX_BidiChar::LEFT, bidi.OverallDirection());
@@ -155,7 +155,7 @@ TEST(fxcrt, BidiStringAllNeutral) {
TEST(fxcrt, BidiStringAllLeft) {
{
- const FX_WCHAR str[] = {kLeftChar, 0};
+ const wchar_t str[] = {kLeftChar, 0};
CFX_BidiString bidi(str);
EXPECT_EQ(CFX_BidiChar::LEFT, bidi.OverallDirection());
@@ -176,7 +176,7 @@ TEST(fxcrt, BidiStringAllLeft) {
EXPECT_TRUE(it == bidi.end());
}
{
- const FX_WCHAR str[] = {kLeftChar, kLeftChar, kLeftChar, 0};
+ const wchar_t str[] = {kLeftChar, kLeftChar, kLeftChar, 0};
CFX_BidiString bidi(str);
EXPECT_EQ(CFX_BidiChar::LEFT, bidi.OverallDirection());
@@ -200,7 +200,7 @@ TEST(fxcrt, BidiStringAllLeft) {
TEST(fxcrt, BidiStringAllRight) {
{
- const FX_WCHAR str[] = {kRightChar, 0};
+ const wchar_t str[] = {kRightChar, 0};
CFX_BidiString bidi(str);
EXPECT_EQ(CFX_BidiChar::RIGHT, bidi.OverallDirection());
@@ -221,7 +221,7 @@ TEST(fxcrt, BidiStringAllRight) {
EXPECT_TRUE(it == bidi.end());
}
{
- const FX_WCHAR str[] = {kRightChar, kRightChar, kRightChar, 0};
+ const wchar_t str[] = {kRightChar, kRightChar, kRightChar, 0};
CFX_BidiString bidi(str);
EXPECT_EQ(CFX_BidiChar::RIGHT, bidi.OverallDirection());
@@ -244,7 +244,7 @@ TEST(fxcrt, BidiStringAllRight) {
}
TEST(fxcrt, BidiStringLeftNeutralLeftRight) {
- const FX_WCHAR str[] = {kLeftChar, kNeutralChar, kLeftChar, kRightChar, 0};
+ const wchar_t str[] = {kLeftChar, kNeutralChar, kLeftChar, kRightChar, 0};
CFX_BidiString bidi(str);
EXPECT_EQ(CFX_BidiChar::LEFT, bidi.OverallDirection());
@@ -284,7 +284,7 @@ TEST(fxcrt, BidiStringLeftNeutralLeftRight) {
}
TEST(fxcrt, BidiStringRightNeutralLeftRight) {
- const FX_WCHAR str[] = {kRightChar, kNeutralChar, kLeftChar, kRightChar, 0};
+ const wchar_t str[] = {kRightChar, kNeutralChar, kLeftChar, kRightChar, 0};
CFX_BidiString bidi(str);
EXPECT_EQ(CFX_BidiChar::RIGHT, bidi.OverallDirection());
@@ -324,7 +324,7 @@ TEST(fxcrt, BidiStringRightNeutralLeftRight) {
}
TEST(fxcrt, BidiStringReverse) {
- const FX_WCHAR str[] = {kLeftChar, kNeutralChar, kRightChar, kLeftChar, 0};
+ const wchar_t str[] = {kLeftChar, kNeutralChar, kRightChar, kLeftChar, 0};
CFX_BidiString bidi(str);
EXPECT_EQ(CFX_BidiChar::LEFT, bidi.OverallDirection());
bidi.SetOverallDirectionRight();
diff --git a/chromium/third_party/pdfium/core/fxcrt/fx_coordinates.h b/chromium/third_party/pdfium/core/fxcrt/fx_coordinates.h
index 2c84d0776ce..0262268f497 100644
--- a/chromium/third_party/pdfium/core/fxcrt/fx_coordinates.h
+++ b/chromium/third_party/pdfium/core/fxcrt/fx_coordinates.h
@@ -71,7 +71,7 @@ class CFX_PTemplate {
BaseType y;
};
using CFX_Point = CFX_PTemplate<int32_t>;
-using CFX_PointF = CFX_PTemplate<FX_FLOAT>;
+using CFX_PointF = CFX_PTemplate<float>;
template <class BaseType>
class CFX_STemplate {
@@ -144,7 +144,7 @@ class CFX_STemplate {
BaseType height;
};
using CFX_Size = CFX_STemplate<int32_t>;
-using CFX_SizeF = CFX_STemplate<FX_FLOAT>;
+using CFX_SizeF = CFX_STemplate<float>;
template <class BaseType>
class CFX_VTemplate : public CFX_PTemplate<BaseType> {
@@ -162,9 +162,9 @@ class CFX_VTemplate : public CFX_PTemplate<BaseType> {
const CFX_PTemplate<BaseType>& point2)
: CFX_PTemplate<BaseType>(point2.x - point1.x, point2.y - point1.y) {}
- FX_FLOAT Length() const { return FXSYS_sqrt(x * x + y * y); }
+ float Length() const { return sqrt(x * x + y * y); }
void Normalize() {
- FX_FLOAT fLen = Length();
+ float fLen = Length();
if (fLen < 0.0001f)
return;
@@ -179,15 +179,15 @@ class CFX_VTemplate : public CFX_PTemplate<BaseType> {
x *= sx;
y *= sy;
}
- void Rotate(FX_FLOAT fRadian) {
- FX_FLOAT cosValue = FXSYS_cos(fRadian);
- FX_FLOAT sinValue = FXSYS_sin(fRadian);
+ void Rotate(float fRadian) {
+ float cosValue = cos(fRadian);
+ float sinValue = sin(fRadian);
x = x * cosValue - y * sinValue;
y = x * sinValue + y * cosValue;
}
};
using CFX_Vector = CFX_VTemplate<int32_t>;
-using CFX_VectorF = CFX_VTemplate<FX_FLOAT>;
+using CFX_VectorF = CFX_VTemplate<float>;
// Rectangles.
// TODO(tsepez): Consolidate all these different rectangle classes.
@@ -313,7 +313,7 @@ class CFX_RTemplate {
Deflate(rt.left, rt.top, rt.top + rt.width, rt.top + rt.height);
}
bool IsEmpty() const { return width <= 0 || height <= 0; }
- bool IsEmpty(FX_FLOAT fEpsilon) const {
+ bool IsEmpty(float fEpsilon) const {
return width <= fEpsilon || height <= fEpsilon;
}
void Empty() { width = height = 0; }
@@ -385,7 +385,7 @@ class CFX_RTemplate {
rect.Intersect(*this);
return !rect.IsEmpty();
}
- bool IntersectWith(const RectType& rt, FX_FLOAT fEpsilon) const {
+ bool IntersectWith(const RectType& rt, float fEpsilon) const {
RectType rect = rt;
rect.Intersect(*this);
return !rect.IsEmpty(fEpsilon);
@@ -404,7 +404,7 @@ class CFX_RTemplate {
BaseType height;
};
using CFX_Rect = CFX_RTemplate<int32_t>;
-using CFX_RectF = CFX_RTemplate<FX_FLOAT>;
+using CFX_RectF = CFX_RTemplate<float>;
// LTRB rectangles (y-axis runs downwards).
struct FX_RECT {
@@ -454,10 +454,10 @@ struct FX_RECT {
class CFX_FloatRect {
public:
CFX_FloatRect() : CFX_FloatRect(0.0f, 0.0f, 0.0f, 0.0f) {}
- CFX_FloatRect(FX_FLOAT l, FX_FLOAT b, FX_FLOAT r, FX_FLOAT t)
+ CFX_FloatRect(float l, float b, float r, float t)
: left(l), bottom(b), right(r), top(t) {}
- explicit CFX_FloatRect(const FX_FLOAT* pArray)
+ explicit CFX_FloatRect(const float* pArray)
: CFX_FloatRect(pArray[0], pArray[1], pArray[2], pArray[3]) {}
explicit CFX_FloatRect(const FX_RECT& rect);
@@ -485,18 +485,18 @@ class CFX_FloatRect {
int Substract4(CFX_FloatRect& substract_rect, CFX_FloatRect* pRects);
- void InitRect(FX_FLOAT x, FX_FLOAT y) {
+ void InitRect(float x, float y) {
left = x;
right = x;
bottom = y;
top = y;
}
- void UpdateRect(FX_FLOAT x, FX_FLOAT y);
+ void UpdateRect(float x, float y);
- FX_FLOAT Width() const { return right - left; }
- FX_FLOAT Height() const { return top - bottom; }
+ float Width() const { return right - left; }
+ float Height() const { return top - bottom; }
- void Inflate(FX_FLOAT x, FX_FLOAT y) {
+ void Inflate(float x, float y) {
Normalize();
left -= x;
right += x;
@@ -504,10 +504,10 @@ class CFX_FloatRect {
top += y;
}
- void Inflate(FX_FLOAT other_left,
- FX_FLOAT other_bottom,
- FX_FLOAT other_right,
- FX_FLOAT other_top) {
+ void Inflate(float other_left,
+ float other_bottom,
+ float other_right,
+ float other_top) {
Normalize();
left -= other_left;
bottom -= other_bottom;
@@ -519,7 +519,7 @@ class CFX_FloatRect {
Inflate(rt.left, rt.bottom, rt.right, rt.top);
}
- void Deflate(FX_FLOAT x, FX_FLOAT y) {
+ void Deflate(float x, float y) {
Normalize();
left += x;
right -= x;
@@ -527,10 +527,10 @@ class CFX_FloatRect {
top -= y;
}
- void Deflate(FX_FLOAT other_left,
- FX_FLOAT other_bottom,
- FX_FLOAT other_right,
- FX_FLOAT other_top) {
+ void Deflate(float other_left,
+ float other_bottom,
+ float other_right,
+ float other_top) {
Normalize();
left += other_left;
bottom += other_bottom;
@@ -542,7 +542,7 @@ class CFX_FloatRect {
Deflate(rt.left, rt.bottom, rt.right, rt.top);
}
- void Translate(FX_FLOAT e, FX_FLOAT f) {
+ void Translate(float e, float f) {
left += e;
right += e;
top += f;
@@ -560,17 +560,17 @@ class CFX_FloatRect {
return CFX_FloatRect(rect.left, rect.top, rect.right(), rect.bottom());
}
- FX_FLOAT left;
- FX_FLOAT bottom;
- FX_FLOAT right;
- FX_FLOAT top;
+ float left;
+ float bottom;
+ float right;
+ float top;
};
class CFX_Matrix {
public:
CFX_Matrix() { SetIdentity(); }
- explicit CFX_Matrix(const FX_FLOAT n[6])
+ explicit CFX_Matrix(const float n[6])
: a(n[0]), b(n[1]), c(n[2]), d(n[3]), e(n[4]), f(n[5]) {}
CFX_Matrix(const CFX_Matrix& other)
@@ -581,12 +581,7 @@ class CFX_Matrix {
e(other.e),
f(other.f) {}
- CFX_Matrix(FX_FLOAT a1,
- FX_FLOAT b1,
- FX_FLOAT c1,
- FX_FLOAT d1,
- FX_FLOAT e1,
- FX_FLOAT f1)
+ CFX_Matrix(float a1, float b1, float c1, float d1, float e1, float f1)
: a(a1), b(b1), c(c1), d(d1), e(e1), f(f1) {}
void operator=(const CFX_Matrix& other) {
@@ -620,49 +615,44 @@ class CFX_Matrix {
bool IsScaled() const;
bool WillScale() const { return a != 1.0f || b != 0 || c != 0 || d != 1.0f; }
- void Translate(FX_FLOAT x, FX_FLOAT y, bool bPrepended = false);
+ void Translate(float x, float y, bool bPrepended = false);
void Translate(int32_t x, int32_t y, bool bPrepended = false) {
- Translate(static_cast<FX_FLOAT>(x), static_cast<FX_FLOAT>(y), bPrepended);
+ Translate(static_cast<float>(x), static_cast<float>(y), bPrepended);
}
- void Scale(FX_FLOAT sx, FX_FLOAT sy, bool bPrepended = false);
- void Rotate(FX_FLOAT fRadian, bool bPrepended = false);
- void RotateAt(FX_FLOAT fRadian,
- FX_FLOAT x,
- FX_FLOAT y,
- bool bPrepended = false);
+ void Scale(float sx, float sy, bool bPrepended = false);
+ void Rotate(float fRadian, bool bPrepended = false);
+ void RotateAt(float fRadian, float x, float y, bool bPrepended = false);
- void Shear(FX_FLOAT fAlphaRadian,
- FX_FLOAT fBetaRadian,
- bool bPrepended = false);
+ void Shear(float fAlphaRadian, float fBetaRadian, bool bPrepended = false);
void MatchRect(const CFX_FloatRect& dest, const CFX_FloatRect& src);
- FX_FLOAT GetXUnit() const;
- FX_FLOAT GetYUnit() const;
+ float GetXUnit() const;
+ float GetYUnit() const;
CFX_FloatRect GetUnitRect() const;
- FX_FLOAT TransformXDistance(FX_FLOAT dx) const;
- FX_FLOAT TransformDistance(FX_FLOAT dx, FX_FLOAT dy) const;
- FX_FLOAT TransformDistance(FX_FLOAT distance) const;
+ float TransformXDistance(float dx) const;
+ float TransformDistance(float dx, float dy) const;
+ float TransformDistance(float distance) const;
CFX_PointF Transform(const CFX_PointF& point) const;
void TransformRect(CFX_RectF& rect) const;
- void TransformRect(FX_FLOAT& left,
- FX_FLOAT& right,
- FX_FLOAT& top,
- FX_FLOAT& bottom) const;
+ void TransformRect(float& left,
+ float& right,
+ float& top,
+ float& bottom) const;
void TransformRect(CFX_FloatRect& rect) const {
TransformRect(rect.left, rect.right, rect.top, rect.bottom);
}
- FX_FLOAT a;
- FX_FLOAT b;
- FX_FLOAT c;
- FX_FLOAT d;
- FX_FLOAT e;
- FX_FLOAT f;
+ float a;
+ float b;
+ float c;
+ float d;
+ float e;
+ float f;
private:
void ConcatInternal(const CFX_Matrix& other, bool prepend);
diff --git a/chromium/third_party/pdfium/core/fxcrt/fx_ext.h b/chromium/third_party/pdfium/core/fxcrt/fx_ext.h
index 9203938c2c7..d7f21af9ffa 100644
--- a/chromium/third_party/pdfium/core/fxcrt/fx_ext.h
+++ b/chromium/third_party/pdfium/core/fxcrt/fx_ext.h
@@ -15,67 +15,72 @@
#define FX_INVALID_OFFSET static_cast<uint32_t>(-1)
-FX_FLOAT FXSYS_tan(FX_FLOAT a);
-FX_FLOAT FXSYS_logb(FX_FLOAT b, FX_FLOAT x);
-FX_FLOAT FXSYS_strtof(const FX_CHAR* pcsStr,
- int32_t iLength = -1,
- int32_t* pUsedLen = nullptr);
-FX_FLOAT FXSYS_wcstof(const FX_WCHAR* pwsStr,
- int32_t iLength = -1,
- int32_t* pUsedLen = nullptr);
-FX_WCHAR* FXSYS_wcsncpy(FX_WCHAR* dstStr, const FX_WCHAR* srcStr, size_t count);
-int32_t FXSYS_wcsnicmp(const FX_WCHAR* s1, const FX_WCHAR* s2, size_t count);
-int32_t FXSYS_strnicmp(const FX_CHAR* s1, const FX_CHAR* s2, size_t count);
+float FXSYS_strtof(const char* pcsStr,
+ int32_t iLength = -1,
+ int32_t* pUsedLen = nullptr);
+float FXSYS_wcstof(const wchar_t* pwsStr,
+ int32_t iLength = -1,
+ int32_t* pUsedLen = nullptr);
+wchar_t* FXSYS_wcsncpy(wchar_t* dstStr, const wchar_t* srcStr, size_t count);
+int32_t FXSYS_wcsnicmp(const wchar_t* s1, const wchar_t* s2, size_t count);
+int32_t FXSYS_strnicmp(const char* s1, const char* s2, size_t count);
inline bool FXSYS_islower(int32_t ch) {
return ch >= 'a' && ch <= 'z';
}
+
inline bool FXSYS_isupper(int32_t ch) {
return ch >= 'A' && ch <= 'Z';
}
+
inline int32_t FXSYS_tolower(int32_t ch) {
return ch < 'A' || ch > 'Z' ? ch : (ch + 0x20);
}
+
inline int32_t FXSYS_toupper(int32_t ch) {
return ch < 'a' || ch > 'z' ? ch : (ch - 0x20);
}
+
inline bool FXSYS_iswalpha(wchar_t wch) {
return (wch >= L'A' && wch <= L'Z') || (wch >= L'a' && wch <= L'z');
}
+
inline bool FXSYS_iswdigit(wchar_t wch) {
return wch >= L'0' && wch <= L'9';
}
+
inline bool FXSYS_iswalnum(wchar_t wch) {
return FXSYS_iswalpha(wch) || FXSYS_iswdigit(wch);
}
-inline bool FXSYS_iswspace(FX_WCHAR c) {
+
+inline bool FXSYS_iswspace(wchar_t c) {
return (c == 0x20) || (c == 0x0d) || (c == 0x0a) || (c == 0x09);
}
-inline int FXSYS_toHexDigit(const FX_CHAR c) {
+inline int FXSYS_toHexDigit(const char c) {
if (!std::isxdigit(c))
return 0;
char upchar = std::toupper(c);
return upchar > '9' ? upchar - 'A' + 10 : upchar - '0';
}
-inline bool FXSYS_isDecimalDigit(const FX_CHAR c) {
+inline bool FXSYS_isDecimalDigit(const char c) {
return !!std::isdigit(c);
}
-inline bool FXSYS_isDecimalDigit(const FX_WCHAR c) {
+inline bool FXSYS_isDecimalDigit(const wchar_t c) {
return !!std::iswdigit(c);
}
-inline int FXSYS_toDecimalDigit(const FX_CHAR c) {
+inline int FXSYS_toDecimalDigit(const char c) {
return std::isdigit(c) ? c - '0' : 0;
}
-inline int FXSYS_toDecimalDigit(const FX_WCHAR c) {
+inline int FXSYS_toDecimalDigit(const wchar_t c) {
return std::iswdigit(c) ? c - L'0' : 0;
}
-FX_FLOAT FXSYS_FractionalScale(size_t scale_factor, int value);
+float FXSYS_FractionalScale(size_t scale_factor, int value);
int FXSYS_FractionalScaleCount();
void* FX_Random_MT_Start(uint32_t dwSeed);
@@ -93,9 +98,7 @@ struct FX_GUID {
uint8_t data4[8];
};
void FX_GUID_CreateV4(FX_GUID* pGUID);
-void FX_GUID_ToString(const FX_GUID* pGUID,
- CFX_ByteString& bsStr,
- bool bSeparator = true);
+CFX_ByteString FX_GUID_ToString(const FX_GUID* pGUID, bool bSeparator = true);
#endif // PDF_ENABLE_XFA
#endif // CORE_FXCRT_FX_EXT_H_
diff --git a/chromium/third_party/pdfium/core/fxcrt/fx_extension.cpp b/chromium/third_party/pdfium/core/fxcrt/fx_extension.cpp
index 5b577f745ca..acdce048e0c 100644
--- a/chromium/third_party/pdfium/core/fxcrt/fx_extension.cpp
+++ b/chromium/third_party/pdfium/core/fxcrt/fx_extension.cpp
@@ -9,9 +9,11 @@
#include <algorithm>
#include <memory>
#include <utility>
+#include <vector>
#include "core/fxcrt/fx_basic.h"
#include "core/fxcrt/fx_ext.h"
+#include "third_party/base/stl_util.h"
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
#include <wincrypt.h>
@@ -151,7 +153,7 @@ class CFX_MemoryStream final : public IFX_MemoryStream {
bool ExpandBlocks(size_t size);
- CFX_ArrayTemplate<uint8_t*> m_Blocks;
+ std::vector<uint8_t*> m_Blocks;
size_t m_nTotalSize;
size_t m_nCurSize;
size_t m_nCurPos;
@@ -175,18 +177,16 @@ CFX_MemoryStream::CFX_MemoryStream(uint8_t* pBuffer,
m_nCurSize(nSize),
m_nCurPos(0),
m_nGrowSize(FX_MEMSTREAM_BlockSize) {
- m_Blocks.Add(pBuffer);
+ m_Blocks.push_back(pBuffer);
m_dwFlags =
FX_MEMSTREAM_Consecutive | (bTakeOver ? FX_MEMSTREAM_TakeOver : 0);
}
CFX_MemoryStream::~CFX_MemoryStream() {
if (m_dwFlags & FX_MEMSTREAM_TakeOver) {
- for (int32_t i = 0; i < m_Blocks.GetSize(); i++) {
- FX_Free(m_Blocks[i]);
- }
+ for (uint8_t* pBlock : m_Blocks)
+ FX_Free(pBlock);
}
- m_Blocks.RemoveAll();
}
FX_FILESIZE CFX_MemoryStream::GetSize() {
@@ -216,7 +216,7 @@ bool CFX_MemoryStream::ReadBlock(void* buffer,
m_nCurPos = newPos.ValueOrDie();
if (m_dwFlags & FX_MEMSTREAM_Consecutive) {
- FXSYS_memcpy(buffer, m_Blocks[0] + (size_t)offset, size);
+ memcpy(buffer, m_Blocks[0] + (size_t)offset, size);
return true;
}
size_t nStartBlock = (size_t)offset / m_nGrowSize;
@@ -226,7 +226,7 @@ bool CFX_MemoryStream::ReadBlock(void* buffer,
if (nRead > size) {
nRead = size;
}
- FXSYS_memcpy(buffer, m_Blocks[(int)nStartBlock] + (size_t)offset, nRead);
+ memcpy(buffer, m_Blocks[(int)nStartBlock] + (size_t)offset, nRead);
buffer = ((uint8_t*)buffer) + nRead;
size -= nRead;
nStartBlock++;
@@ -261,18 +261,13 @@ bool CFX_MemoryStream::WriteBlock(const void* buffer,
m_nCurPos = newPos.ValueOrDie();
if (m_nCurPos > m_nTotalSize) {
m_nTotalSize = (m_nCurPos + m_nGrowSize - 1) / m_nGrowSize * m_nGrowSize;
- if (m_Blocks.GetSize() < 1) {
- uint8_t* block = FX_Alloc(uint8_t, m_nTotalSize);
- m_Blocks.Add(block);
+ if (m_Blocks.empty()) {
+ m_Blocks.push_back(FX_Alloc(uint8_t, m_nTotalSize));
} else {
m_Blocks[0] = FX_Realloc(uint8_t, m_Blocks[0], m_nTotalSize);
}
- if (!m_Blocks[0]) {
- m_Blocks.RemoveAll();
- return false;
- }
}
- FXSYS_memcpy(m_Blocks[0] + (size_t)offset, buffer, size);
+ memcpy(m_Blocks[0] + (size_t)offset, buffer, size);
if (m_nCurSize < m_nCurPos) {
m_nCurSize = m_nCurPos;
}
@@ -296,7 +291,7 @@ bool CFX_MemoryStream::WriteBlock(const void* buffer,
if (nWrite > size) {
nWrite = size;
}
- FXSYS_memcpy(m_Blocks[(int)nStartBlock] + (size_t)offset, buffer, nWrite);
+ memcpy(m_Blocks[(int)nStartBlock] + (size_t)offset, buffer, nWrite);
buffer = ((uint8_t*)buffer) + nWrite;
size -= nWrite;
nStartBlock++;
@@ -315,19 +310,18 @@ bool CFX_MemoryStream::IsConsecutive() const {
void CFX_MemoryStream::EstimateSize(size_t nInitSize, size_t nGrowSize) {
if (m_dwFlags & FX_MEMSTREAM_Consecutive) {
- if (m_Blocks.GetSize() < 1) {
- uint8_t* pBlock =
- FX_Alloc(uint8_t, std::max(nInitSize, static_cast<size_t>(4096)));
- m_Blocks.Add(pBlock);
+ if (m_Blocks.empty()) {
+ m_Blocks.push_back(
+ FX_Alloc(uint8_t, std::max(nInitSize, static_cast<size_t>(4096))));
}
m_nGrowSize = std::max(nGrowSize, static_cast<size_t>(4096));
- } else if (m_Blocks.GetSize() < 1) {
+ } else if (m_Blocks.empty()) {
m_nGrowSize = std::max(nGrowSize, static_cast<size_t>(4096));
}
}
uint8_t* CFX_MemoryStream::GetBuffer() const {
- return m_Blocks.GetSize() ? m_Blocks[0] : nullptr;
+ return !m_Blocks.empty() ? m_Blocks.front() : nullptr;
}
void CFX_MemoryStream::AttachBuffer(uint8_t* pBuffer,
@@ -336,36 +330,38 @@ void CFX_MemoryStream::AttachBuffer(uint8_t* pBuffer,
if (!(m_dwFlags & FX_MEMSTREAM_Consecutive))
return;
- m_Blocks.RemoveAll();
- m_Blocks.Add(pBuffer);
- m_nTotalSize = m_nCurSize = nSize;
+ m_Blocks.clear();
+ m_Blocks.push_back(pBuffer);
+ m_nTotalSize = nSize;
+ m_nCurSize = nSize;
m_nCurPos = 0;
m_dwFlags =
FX_MEMSTREAM_Consecutive | (bTakeOver ? FX_MEMSTREAM_TakeOver : 0);
}
void CFX_MemoryStream::DetachBuffer() {
- if (!(m_dwFlags & FX_MEMSTREAM_Consecutive)) {
+ if (!(m_dwFlags & FX_MEMSTREAM_Consecutive))
return;
- }
- m_Blocks.RemoveAll();
- m_nTotalSize = m_nCurSize = m_nCurPos = 0;
+
+ m_Blocks.clear();
+ m_nTotalSize = 0;
+ m_nCurSize = 0;
+ m_nCurPos = 0;
m_dwFlags = FX_MEMSTREAM_TakeOver;
}
bool CFX_MemoryStream::ExpandBlocks(size_t size) {
- if (m_nCurSize < size) {
+ if (m_nCurSize < size)
m_nCurSize = size;
- }
- if (size <= m_nTotalSize) {
+
+ if (size <= m_nTotalSize)
return true;
- }
- int32_t iCount = m_Blocks.GetSize();
+
size = (size - m_nTotalSize + m_nGrowSize - 1) / m_nGrowSize;
- m_Blocks.SetSize(m_Blocks.GetSize() + (int32_t)size);
+ size_t iCount = m_Blocks.size();
+ m_Blocks.resize(iCount + size);
while (size--) {
- uint8_t* pBlock = FX_Alloc(uint8_t, m_nGrowSize);
- m_Blocks.SetAt(iCount++, pBlock);
+ m_Blocks[iCount++] = FX_Alloc(uint8_t, m_nGrowSize);
m_nTotalSize += m_nGrowSize;
}
return true;
@@ -387,7 +383,7 @@ CFX_RetainPtr<IFX_FileAccess> IFX_FileAccess::CreateDefault(
// static
CFX_RetainPtr<IFX_SeekableStream> IFX_SeekableStream::CreateFromFilename(
- const FX_CHAR* filename,
+ const char* filename,
uint32_t dwModes) {
std::unique_ptr<IFXCRT_FileAccess> pFA(IFXCRT_FileAccess::Create());
if (!pFA->Open(filename, dwModes))
@@ -397,7 +393,7 @@ CFX_RetainPtr<IFX_SeekableStream> IFX_SeekableStream::CreateFromFilename(
// static
CFX_RetainPtr<IFX_SeekableStream> IFX_SeekableStream::CreateFromFilename(
- const FX_WCHAR* filename,
+ const wchar_t* filename,
uint32_t dwModes) {
std::unique_ptr<IFXCRT_FileAccess> pFA(IFXCRT_FileAccess::Create());
if (!pFA->Open(filename, dwModes))
@@ -407,7 +403,7 @@ CFX_RetainPtr<IFX_SeekableStream> IFX_SeekableStream::CreateFromFilename(
// static
CFX_RetainPtr<IFX_SeekableReadStream>
-IFX_SeekableReadStream::CreateFromFilename(const FX_CHAR* filename) {
+IFX_SeekableReadStream::CreateFromFilename(const char* filename) {
return IFX_SeekableStream::CreateFromFilename(filename, FX_FILEMODE_ReadOnly);
}
@@ -423,15 +419,7 @@ CFX_RetainPtr<IFX_MemoryStream> IFX_MemoryStream::Create(bool bConsecutive) {
return pdfium::MakeRetain<CFX_MemoryStream>(bConsecutive);
}
-FX_FLOAT FXSYS_tan(FX_FLOAT a) {
- return (FX_FLOAT)tan(a);
-}
-FX_FLOAT FXSYS_logb(FX_FLOAT b, FX_FLOAT x) {
- return FXSYS_log(x) / FXSYS_log(b);
-}
-FX_FLOAT FXSYS_strtof(const FX_CHAR* pcsStr,
- int32_t iLength,
- int32_t* pUsedLen) {
+float FXSYS_strtof(const char* pcsStr, int32_t iLength, int32_t* pUsedLen) {
ASSERT(pcsStr);
if (iLength < 0) {
iLength = (int32_t)FXSYS_strlen(pcsStr);
@@ -440,9 +428,8 @@ FX_FLOAT FXSYS_strtof(const FX_CHAR* pcsStr,
CFX_WideString::FromLocal(CFX_ByteStringC(pcsStr, iLength));
return FXSYS_wcstof(ws.c_str(), iLength, pUsedLen);
}
-FX_FLOAT FXSYS_wcstof(const FX_WCHAR* pwsStr,
- int32_t iLength,
- int32_t* pUsedLen) {
+
+float FXSYS_wcstof(const wchar_t* pwsStr, int32_t iLength, int32_t* pUsedLen) {
ASSERT(pwsStr);
if (iLength < 0) {
iLength = (int32_t)FXSYS_wcslen(pwsStr);
@@ -459,9 +446,9 @@ FX_FLOAT FXSYS_wcstof(const FX_WCHAR* pwsStr,
iUsedLen++;
break;
}
- FX_FLOAT fValue = 0.0f;
+ float fValue = 0.0f;
while (iUsedLen < iLength) {
- FX_WCHAR wch = pwsStr[iUsedLen];
+ wchar_t wch = pwsStr[iUsedLen];
if (wch >= L'0' && wch <= L'9') {
fValue = fValue * 10.0f + (wch - L'0');
} else {
@@ -470,9 +457,9 @@ FX_FLOAT FXSYS_wcstof(const FX_WCHAR* pwsStr,
iUsedLen++;
}
if (iUsedLen < iLength && pwsStr[iUsedLen] == L'.') {
- FX_FLOAT fPrecise = 0.1f;
+ float fPrecise = 0.1f;
while (++iUsedLen < iLength) {
- FX_WCHAR wch = pwsStr[iUsedLen];
+ wchar_t wch = pwsStr[iUsedLen];
if (wch >= L'0' && wch <= L'9') {
fValue += (wch - L'0') * fPrecise;
fPrecise *= 0.1f;
@@ -486,9 +473,7 @@ FX_FLOAT FXSYS_wcstof(const FX_WCHAR* pwsStr,
}
return bNegtive ? -fValue : fValue;
}
-FX_WCHAR* FXSYS_wcsncpy(FX_WCHAR* dstStr,
- const FX_WCHAR* srcStr,
- size_t count) {
+wchar_t* FXSYS_wcsncpy(wchar_t* dstStr, const wchar_t* srcStr, size_t count) {
ASSERT(dstStr && srcStr && count > 0);
for (size_t i = 0; i < count; ++i)
if ((dstStr[i] = srcStr[i]) == L'\0') {
@@ -496,24 +481,24 @@ FX_WCHAR* FXSYS_wcsncpy(FX_WCHAR* dstStr,
}
return dstStr;
}
-int32_t FXSYS_wcsnicmp(const FX_WCHAR* s1, const FX_WCHAR* s2, size_t count) {
+int32_t FXSYS_wcsnicmp(const wchar_t* s1, const wchar_t* s2, size_t count) {
ASSERT(s1 && s2 && count > 0);
- FX_WCHAR wch1 = 0, wch2 = 0;
+ wchar_t wch1 = 0, wch2 = 0;
while (count-- > 0) {
- wch1 = (FX_WCHAR)FXSYS_tolower(*s1++);
- wch2 = (FX_WCHAR)FXSYS_tolower(*s2++);
+ wch1 = (wchar_t)FXSYS_tolower(*s1++);
+ wch2 = (wchar_t)FXSYS_tolower(*s2++);
if (wch1 != wch2) {
break;
}
}
return wch1 - wch2;
}
-int32_t FXSYS_strnicmp(const FX_CHAR* s1, const FX_CHAR* s2, size_t count) {
+int32_t FXSYS_strnicmp(const char* s1, const char* s2, size_t count) {
ASSERT(s1 && s2 && count > 0);
- FX_CHAR ch1 = 0, ch2 = 0;
+ char ch1 = 0, ch2 = 0;
while (count-- > 0) {
- ch1 = (FX_CHAR)FXSYS_tolower(*s1++);
- ch2 = (FX_CHAR)FXSYS_tolower(*s2++);
+ ch1 = (char)FXSYS_tolower(*s1++);
+ ch2 = (char)FXSYS_tolower(*s2++);
if (ch1 != ch2) {
break;
}
@@ -612,7 +597,7 @@ void FX_Random_GenerateBase(uint32_t* pBuffer, int32_t iCount) {
::GetSystemTime(&st1);
do {
::GetSystemTime(&st2);
- } while (FXSYS_memcmp(&st1, &st2, sizeof(SYSTEMTIME)) == 0);
+ } while (memcmp(&st1, &st2, sizeof(SYSTEMTIME)) == 0);
uint32_t dwHash1 =
FX_HashCode_GetA(CFX_ByteStringC((uint8_t*)&st1, sizeof(st1)), true);
uint32_t dwHash2 =
@@ -652,25 +637,25 @@ void FX_Random_GenerateCrypto(uint32_t* pBuffer, int32_t iCount) {
}
#ifdef PDF_ENABLE_XFA
-static const FX_CHAR gs_FX_pHexChars[] = "0123456789ABCDEF";
+static const char gs_FX_pHexChars[] = "0123456789ABCDEF";
+
void FX_GUID_CreateV4(FX_GUID* pGUID) {
FX_Random_GenerateMT((uint32_t*)pGUID, 4);
uint8_t& b = ((uint8_t*)pGUID)[6];
b = (b & 0x0F) | 0x40;
}
-void FX_GUID_ToString(const FX_GUID* pGUID,
- CFX_ByteString& bsStr,
- bool bSeparator) {
- FX_CHAR* pBuf = bsStr.GetBuffer(40);
- uint8_t b;
+
+CFX_ByteString FX_GUID_ToString(const FX_GUID* pGUID, bool bSeparator) {
+ CFX_ByteString bsStr;
+ char* pBuf = bsStr.GetBuffer(40);
for (int32_t i = 0; i < 16; i++) {
- b = ((const uint8_t*)pGUID)[i];
+ uint8_t b = reinterpret_cast<const uint8_t*>(pGUID)[i];
*pBuf++ = gs_FX_pHexChars[b >> 4];
*pBuf++ = gs_FX_pHexChars[b & 0x0F];
- if (bSeparator && (i == 3 || i == 5 || i == 7 || i == 9)) {
+ if (bSeparator && (i == 3 || i == 5 || i == 7 || i == 9))
*pBuf++ = L'-';
}
- }
bsStr.ReleaseBuffer(bSeparator ? 36 : 32);
+ return bsStr;
}
#endif // PDF_ENABLE_XFA
diff --git a/chromium/third_party/pdfium/core/fxcrt/fx_memory.h b/chromium/third_party/pdfium/core/fxcrt/fx_memory.h
index 0ad28ce8961..eb369d7d6c5 100644
--- a/chromium/third_party/pdfium/core/fxcrt/fx_memory.h
+++ b/chromium/third_party/pdfium/core/fxcrt/fx_memory.h
@@ -26,6 +26,12 @@ void FXMEM_DefaultFree(void* pointer, int flags);
#include <memory>
#include <new>
+#include "third_party/base/allocator/partition_allocator/partition_alloc.h"
+
+extern pdfium::base::PartitionAllocatorGeneric gArrayBufferPartitionAllocator;
+extern pdfium::base::PartitionAllocatorGeneric gStringPartitionAllocator;
+
+void FXMEM_InitalizePartitionAlloc();
NEVER_INLINE void FX_OutOfMemoryTerminate();
inline void* FX_SafeRealloc(void* ptr, size_t num_members, size_t member_size) {
diff --git a/chromium/third_party/pdfium/core/fxcrt/fx_safe_types.h b/chromium/third_party/pdfium/core/fxcrt/fx_safe_types.h
index 66dbc576811..c7362b82f32 100644
--- a/chromium/third_party/pdfium/core/fxcrt/fx_safe_types.h
+++ b/chromium/third_party/pdfium/core/fxcrt/fx_safe_types.h
@@ -7,7 +7,6 @@
#include <stdlib.h> // For size_t.
-#include "core/fxcrt/fx_stream.h" // for FX_FILESIZE.
#include "core/fxcrt/fx_system.h"
#include "third_party/base/numerics/safe_math.h"
diff --git a/chromium/third_party/pdfium/core/fxcrt/fx_stream.h b/chromium/third_party/pdfium/core/fxcrt/fx_stream.h
index 2f4b5ad2805..51a602dfb5c 100644
--- a/chromium/third_party/pdfium/core/fxcrt/fx_stream.h
+++ b/chromium/third_party/pdfium/core/fxcrt/fx_stream.h
@@ -16,9 +16,8 @@
class CFindFileDataA;
typedef CFindFileDataA FX_FileHandle;
-#define FX_FILESIZE int32_t
-#else
+#else // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
#include <dirent.h>
#include <fcntl.h>
@@ -35,15 +34,14 @@ typedef CFindFileDataA FX_FileHandle;
#endif // O_LARGEFILE
typedef DIR FX_FileHandle;
-#define FX_FILESIZE off_t
#endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
-FX_FileHandle* FX_OpenFolder(const FX_CHAR* path);
+FX_FileHandle* FX_OpenFolder(const char* path);
bool FX_GetNextFile(FX_FileHandle* handle,
CFX_ByteString* filename,
bool* bFolder);
void FX_CloseFolder(FX_FileHandle* handle);
-FX_WCHAR FX_GetFolderSeparator();
+wchar_t FX_GetFolderSeparator();
#define FX_FILEMODE_Write 0
#define FX_FILEMODE_ReadOnly 1
@@ -76,7 +74,7 @@ class IFX_SeekableWriteStream : public IFX_WriteStream {
class IFX_SeekableReadStream : public IFX_ReadStream {
public:
static CFX_RetainPtr<IFX_SeekableReadStream> CreateFromFilename(
- const FX_CHAR* filename);
+ const char* filename);
// IFX_ReadStream:
bool IsEOF() override;
@@ -91,11 +89,11 @@ class IFX_SeekableStream : public IFX_SeekableReadStream,
public IFX_SeekableWriteStream {
public:
static CFX_RetainPtr<IFX_SeekableStream> CreateFromFilename(
- const FX_CHAR* filename,
+ const char* filename,
uint32_t dwModes);
static CFX_RetainPtr<IFX_SeekableStream> CreateFromFilename(
- const FX_WCHAR* filename,
+ const wchar_t* filename,
uint32_t dwModes);
// IFX_SeekableReadStream:
diff --git a/chromium/third_party/pdfium/core/fxcrt/fx_string.h b/chromium/third_party/pdfium/core/fxcrt/fx_string.h
index cd93f272750..9cc0b251eb4 100644
--- a/chromium/third_party/pdfium/core/fxcrt/fx_string.h
+++ b/chromium/third_party/pdfium/core/fxcrt/fx_string.h
@@ -7,453 +7,17 @@
#ifndef CORE_FXCRT_FX_STRING_H_
#define CORE_FXCRT_FX_STRING_H_
-#include <stdint.h> // For intptr_t.
-
-#include <algorithm>
-#include <functional>
-
-#include "core/fxcrt/cfx_retain_ptr.h"
-#include "core/fxcrt/cfx_string_c_template.h"
-#include "core/fxcrt/cfx_string_data_template.h"
-#include "core/fxcrt/fx_memory.h"
-#include "core/fxcrt/fx_system.h"
-
-class CFX_ByteString;
-class CFX_WideString;
-
-using CFX_ByteStringC = CFX_StringCTemplate<FX_CHAR>;
-using CFX_WideStringC = CFX_StringCTemplate<FX_WCHAR>;
+#include "core/fxcrt/cfx_bytestring.h"
+#include "core/fxcrt/cfx_widestring.h"
#define FXBSTR_ID(c1, c2, c3, c4) \
(((uint32_t)c1 << 24) | ((uint32_t)c2 << 16) | ((uint32_t)c3 << 8) | \
((uint32_t)c4))
-// A mutable string with shared buffers using copy-on-write semantics that
-// avoids the cost of std::string's iterator stability guarantees.
-class CFX_ByteString {
- public:
- using CharType = FX_CHAR;
-
- CFX_ByteString();
- CFX_ByteString(const CFX_ByteString& other);
- CFX_ByteString(CFX_ByteString&& other);
-
- // Deliberately implicit to avoid calling on every string literal.
- // NOLINTNEXTLINE(runtime/explicit)
- CFX_ByteString(char ch);
- // NOLINTNEXTLINE(runtime/explicit)
- CFX_ByteString(const FX_CHAR* ptr);
-
- CFX_ByteString(const FX_CHAR* ptr, FX_STRSIZE len);
- CFX_ByteString(const uint8_t* ptr, FX_STRSIZE len);
-
- explicit CFX_ByteString(const CFX_ByteStringC& bstrc);
- CFX_ByteString(const CFX_ByteStringC& bstrc1, const CFX_ByteStringC& bstrc2);
-
- ~CFX_ByteString();
-
- void clear() { m_pData.Reset(); }
-
- static CFX_ByteString FromUnicode(const FX_WCHAR* ptr, FX_STRSIZE len = -1);
- static CFX_ByteString FromUnicode(const CFX_WideString& str);
-
- // Explicit conversion to C-style string.
- // Note: Any subsequent modification of |this| will invalidate the result.
- const FX_CHAR* c_str() const { return m_pData ? m_pData->m_String : ""; }
-
- // Explicit conversion to uint8_t*.
- // Note: Any subsequent modification of |this| will invalidate the result.
- const uint8_t* raw_str() const {
- return m_pData ? reinterpret_cast<const uint8_t*>(m_pData->m_String)
- : nullptr;
- }
-
- // Explicit conversion to CFX_ByteStringC.
- // Note: Any subsequent modification of |this| will invalidate the result.
- CFX_ByteStringC AsStringC() const {
- return CFX_ByteStringC(raw_str(), GetLength());
- }
-
- FX_STRSIZE GetLength() const { return m_pData ? m_pData->m_nDataLength : 0; }
- bool IsEmpty() const { return !GetLength(); }
-
- int Compare(const CFX_ByteStringC& str) const;
- bool EqualNoCase(const CFX_ByteStringC& str) const;
-
- bool operator==(const char* ptr) const;
- bool operator==(const CFX_ByteStringC& str) const;
- bool operator==(const CFX_ByteString& other) const;
-
- bool operator!=(const char* ptr) const { return !(*this == ptr); }
- bool operator!=(const CFX_ByteStringC& str) const { return !(*this == str); }
- bool operator!=(const CFX_ByteString& other) const {
- return !(*this == other);
- }
-
- bool operator<(const CFX_ByteString& str) const;
-
- const CFX_ByteString& operator=(const FX_CHAR* str);
- const CFX_ByteString& operator=(const CFX_ByteStringC& bstrc);
- const CFX_ByteString& operator=(const CFX_ByteString& stringSrc);
-
- const CFX_ByteString& operator+=(FX_CHAR ch);
- const CFX_ByteString& operator+=(const FX_CHAR* str);
- const CFX_ByteString& operator+=(const CFX_ByteString& str);
- const CFX_ByteString& operator+=(const CFX_ByteStringC& bstrc);
-
- uint8_t GetAt(FX_STRSIZE nIndex) const {
- return m_pData ? m_pData->m_String[nIndex] : 0;
- }
-
- uint8_t operator[](FX_STRSIZE nIndex) const {
- return m_pData ? m_pData->m_String[nIndex] : 0;
- }
-
- void SetAt(FX_STRSIZE nIndex, FX_CHAR ch);
- FX_STRSIZE Insert(FX_STRSIZE index, FX_CHAR ch);
- FX_STRSIZE Delete(FX_STRSIZE index, FX_STRSIZE count = 1);
-
- void Format(const FX_CHAR* lpszFormat, ...);
- void FormatV(const FX_CHAR* lpszFormat, va_list argList);
-
- void Reserve(FX_STRSIZE len);
- FX_CHAR* GetBuffer(FX_STRSIZE len);
- void ReleaseBuffer(FX_STRSIZE len = -1);
-
- CFX_ByteString Mid(FX_STRSIZE first) const;
- CFX_ByteString Mid(FX_STRSIZE first, FX_STRSIZE count) const;
- CFX_ByteString Left(FX_STRSIZE count) const;
- CFX_ByteString Right(FX_STRSIZE count) const;
-
- FX_STRSIZE Find(const CFX_ByteStringC& lpszSub, FX_STRSIZE start = 0) const;
- FX_STRSIZE Find(FX_CHAR ch, FX_STRSIZE start = 0) const;
- FX_STRSIZE ReverseFind(FX_CHAR ch) const;
-
- void MakeLower();
- void MakeUpper();
-
- void TrimRight();
- void TrimRight(FX_CHAR chTarget);
- void TrimRight(const CFX_ByteStringC& lpszTargets);
-
- void TrimLeft();
- void TrimLeft(FX_CHAR chTarget);
- void TrimLeft(const CFX_ByteStringC& lpszTargets);
-
- FX_STRSIZE Replace(const CFX_ByteStringC& lpszOld,
- const CFX_ByteStringC& lpszNew);
-
- FX_STRSIZE Remove(FX_CHAR ch);
-
- CFX_WideString UTF8Decode() const;
-
- uint32_t GetID(FX_STRSIZE start_pos = 0) const;
-
-#define FXFORMAT_SIGNED 1
-#define FXFORMAT_HEX 2
-#define FXFORMAT_CAPITAL 4
-
- static CFX_ByteString FormatInteger(int i, uint32_t flags = 0);
- static CFX_ByteString FormatFloat(FX_FLOAT f, int precision = 0);
-
- protected:
- using StringData = CFX_StringDataTemplate<FX_CHAR>;
-
- void ReallocBeforeWrite(FX_STRSIZE nNewLen);
- void AllocBeforeWrite(FX_STRSIZE nNewLen);
- void AllocCopy(CFX_ByteString& dest,
- FX_STRSIZE nCopyLen,
- FX_STRSIZE nCopyIndex) const;
- void AssignCopy(const FX_CHAR* pSrcData, FX_STRSIZE nSrcLen);
- void Concat(const FX_CHAR* lpszSrcData, FX_STRSIZE nSrcLen);
-
- CFX_RetainPtr<StringData> m_pData;
-
- friend class fxcrt_ByteStringConcat_Test;
- friend class fxcrt_ByteStringPool_Test;
-};
-
-inline bool operator==(const char* lhs, const CFX_ByteString& rhs) {
- return rhs == lhs;
-}
-inline bool operator==(const CFX_ByteStringC& lhs, const CFX_ByteString& rhs) {
- return rhs == lhs;
-}
-inline bool operator!=(const char* lhs, const CFX_ByteString& rhs) {
- return rhs != lhs;
-}
-inline bool operator!=(const CFX_ByteStringC& lhs, const CFX_ByteString& rhs) {
- return rhs != lhs;
-}
-
-inline CFX_ByteString operator+(const CFX_ByteStringC& str1,
- const CFX_ByteStringC& str2) {
- return CFX_ByteString(str1, str2);
-}
-inline CFX_ByteString operator+(const CFX_ByteStringC& str1,
- const FX_CHAR* str2) {
- return CFX_ByteString(str1, str2);
-}
-inline CFX_ByteString operator+(const FX_CHAR* str1,
- const CFX_ByteStringC& str2) {
- return CFX_ByteString(str1, str2);
-}
-inline CFX_ByteString operator+(const CFX_ByteStringC& str1, FX_CHAR ch) {
- return CFX_ByteString(str1, CFX_ByteStringC(ch));
-}
-inline CFX_ByteString operator+(FX_CHAR ch, const CFX_ByteStringC& str2) {
- return CFX_ByteString(ch, str2);
-}
-inline CFX_ByteString operator+(const CFX_ByteString& str1,
- const CFX_ByteString& str2) {
- return CFX_ByteString(str1.AsStringC(), str2.AsStringC());
-}
-inline CFX_ByteString operator+(const CFX_ByteString& str1, FX_CHAR ch) {
- return CFX_ByteString(str1.AsStringC(), CFX_ByteStringC(ch));
-}
-inline CFX_ByteString operator+(FX_CHAR ch, const CFX_ByteString& str2) {
- return CFX_ByteString(ch, str2.AsStringC());
-}
-inline CFX_ByteString operator+(const CFX_ByteString& str1,
- const FX_CHAR* str2) {
- return CFX_ByteString(str1.AsStringC(), str2);
-}
-inline CFX_ByteString operator+(const FX_CHAR* str1,
- const CFX_ByteString& str2) {
- return CFX_ByteString(str1, str2.AsStringC());
-}
-inline CFX_ByteString operator+(const CFX_ByteString& str1,
- const CFX_ByteStringC& str2) {
- return CFX_ByteString(str1.AsStringC(), str2);
-}
-inline CFX_ByteString operator+(const CFX_ByteStringC& str1,
- const CFX_ByteString& str2) {
- return CFX_ByteString(str1, str2.AsStringC());
-}
-
-// A mutable string with shared buffers using copy-on-write semantics that
-// avoids the cost of std::string's iterator stability guarantees.
-class CFX_WideString {
- public:
- using CharType = FX_WCHAR;
-
- CFX_WideString();
- CFX_WideString(const CFX_WideString& other);
- CFX_WideString(CFX_WideString&& other);
-
- // Deliberately implicit to avoid calling on every string literal.
- // NOLINTNEXTLINE(runtime/explicit)
- CFX_WideString(FX_WCHAR ch);
- // NOLINTNEXTLINE(runtime/explicit)
- CFX_WideString(const FX_WCHAR* ptr);
-
- CFX_WideString(const FX_WCHAR* ptr, FX_STRSIZE len);
-
- explicit CFX_WideString(const CFX_WideStringC& str);
- CFX_WideString(const CFX_WideStringC& str1, const CFX_WideStringC& str2);
-
- ~CFX_WideString();
-
- static CFX_WideString FromLocal(const CFX_ByteStringC& str);
- static CFX_WideString FromCodePage(const CFX_ByteStringC& str,
- uint16_t codepage);
-
- static CFX_WideString FromUTF8(const CFX_ByteStringC& str);
- static CFX_WideString FromUTF16LE(const unsigned short* str, FX_STRSIZE len);
-
- static FX_STRSIZE WStringLength(const unsigned short* str);
-
- // Explicit conversion to C-style wide string.
- // Note: Any subsequent modification of |this| will invalidate the result.
- const FX_WCHAR* c_str() const { return m_pData ? m_pData->m_String : L""; }
-
- // Explicit conversion to CFX_WideStringC.
- // Note: Any subsequent modification of |this| will invalidate the result.
- CFX_WideStringC AsStringC() const {
- return CFX_WideStringC(c_str(), GetLength());
- }
-
- void clear() { m_pData.Reset(); }
-
- FX_STRSIZE GetLength() const { return m_pData ? m_pData->m_nDataLength : 0; }
- bool IsEmpty() const { return !GetLength(); }
-
- const CFX_WideString& operator=(const FX_WCHAR* str);
- const CFX_WideString& operator=(const CFX_WideString& stringSrc);
- const CFX_WideString& operator=(const CFX_WideStringC& stringSrc);
-
- const CFX_WideString& operator+=(const FX_WCHAR* str);
- const CFX_WideString& operator+=(FX_WCHAR ch);
- const CFX_WideString& operator+=(const CFX_WideString& str);
- const CFX_WideString& operator+=(const CFX_WideStringC& str);
-
- bool operator==(const wchar_t* ptr) const;
- bool operator==(const CFX_WideStringC& str) const;
- bool operator==(const CFX_WideString& other) const;
-
- bool operator!=(const wchar_t* ptr) const { return !(*this == ptr); }
- bool operator!=(const CFX_WideStringC& str) const { return !(*this == str); }
- bool operator!=(const CFX_WideString& other) const {
- return !(*this == other);
- }
-
- bool operator<(const CFX_WideString& str) const;
-
- FX_WCHAR GetAt(FX_STRSIZE nIndex) const {
- return m_pData ? m_pData->m_String[nIndex] : 0;
- }
-
- FX_WCHAR operator[](FX_STRSIZE nIndex) const {
- return m_pData ? m_pData->m_String[nIndex] : 0;
- }
-
- void SetAt(FX_STRSIZE nIndex, FX_WCHAR ch);
-
- int Compare(const FX_WCHAR* str) const;
- int Compare(const CFX_WideString& str) const;
- int CompareNoCase(const FX_WCHAR* str) const;
-
- CFX_WideString Mid(FX_STRSIZE first) const;
- CFX_WideString Mid(FX_STRSIZE first, FX_STRSIZE count) const;
- CFX_WideString Left(FX_STRSIZE count) const;
- CFX_WideString Right(FX_STRSIZE count) const;
-
- FX_STRSIZE Insert(FX_STRSIZE index, FX_WCHAR ch);
- FX_STRSIZE Delete(FX_STRSIZE index, FX_STRSIZE count = 1);
-
- void Format(const FX_WCHAR* lpszFormat, ...);
- void FormatV(const FX_WCHAR* lpszFormat, va_list argList);
-
- void MakeLower();
- void MakeUpper();
-
- void TrimRight();
- void TrimRight(FX_WCHAR chTarget);
- void TrimRight(const CFX_WideStringC& pTargets);
-
- void TrimLeft();
- void TrimLeft(FX_WCHAR chTarget);
- void TrimLeft(const CFX_WideStringC& pTargets);
-
- void Reserve(FX_STRSIZE len);
- FX_WCHAR* GetBuffer(FX_STRSIZE len);
- void ReleaseBuffer(FX_STRSIZE len = -1);
-
- int GetInteger() const;
- FX_FLOAT GetFloat() const;
-
- FX_STRSIZE Find(const CFX_WideStringC& pSub, FX_STRSIZE start = 0) const;
- FX_STRSIZE Find(FX_WCHAR ch, FX_STRSIZE start = 0) const;
- FX_STRSIZE Replace(const CFX_WideStringC& pOld, const CFX_WideStringC& pNew);
- FX_STRSIZE Remove(FX_WCHAR ch);
-
- CFX_ByteString UTF8Encode() const;
- CFX_ByteString UTF16LE_Encode() const;
-
- protected:
- using StringData = CFX_StringDataTemplate<FX_WCHAR>;
-
- void ReallocBeforeWrite(FX_STRSIZE nLen);
- void AllocBeforeWrite(FX_STRSIZE nLen);
- void AllocCopy(CFX_WideString& dest,
- FX_STRSIZE nCopyLen,
- FX_STRSIZE nCopyIndex) const;
- void AssignCopy(const FX_WCHAR* pSrcData, FX_STRSIZE nSrcLen);
- void Concat(const FX_WCHAR* lpszSrcData, FX_STRSIZE nSrcLen);
-
- CFX_RetainPtr<StringData> m_pData;
-
- friend class fxcrt_WideStringConcatInPlace_Test;
- friend class fxcrt_WideStringPool_Test;
-};
-
-inline CFX_WideString operator+(const CFX_WideStringC& str1,
- const CFX_WideStringC& str2) {
- return CFX_WideString(str1, str2);
-}
-inline CFX_WideString operator+(const CFX_WideStringC& str1,
- const FX_WCHAR* str2) {
- return CFX_WideString(str1, str2);
-}
-inline CFX_WideString operator+(const FX_WCHAR* str1,
- const CFX_WideStringC& str2) {
- return CFX_WideString(str1, str2);
-}
-inline CFX_WideString operator+(const CFX_WideStringC& str1, FX_WCHAR ch) {
- return CFX_WideString(str1, CFX_WideStringC(ch));
-}
-inline CFX_WideString operator+(FX_WCHAR ch, const CFX_WideStringC& str2) {
- return CFX_WideString(ch, str2);
-}
-inline CFX_WideString operator+(const CFX_WideString& str1,
- const CFX_WideString& str2) {
- return CFX_WideString(str1.AsStringC(), str2.AsStringC());
-}
-inline CFX_WideString operator+(const CFX_WideString& str1, FX_WCHAR ch) {
- return CFX_WideString(str1.AsStringC(), CFX_WideStringC(ch));
-}
-inline CFX_WideString operator+(FX_WCHAR ch, const CFX_WideString& str2) {
- return CFX_WideString(ch, str2.AsStringC());
-}
-inline CFX_WideString operator+(const CFX_WideString& str1,
- const FX_WCHAR* str2) {
- return CFX_WideString(str1.AsStringC(), str2);
-}
-inline CFX_WideString operator+(const FX_WCHAR* str1,
- const CFX_WideString& str2) {
- return CFX_WideString(str1, str2.AsStringC());
-}
-inline CFX_WideString operator+(const CFX_WideString& str1,
- const CFX_WideStringC& str2) {
- return CFX_WideString(str1.AsStringC(), str2);
-}
-inline CFX_WideString operator+(const CFX_WideStringC& str1,
- const CFX_WideString& str2) {
- return CFX_WideString(str1, str2.AsStringC());
-}
-inline bool operator==(const wchar_t* lhs, const CFX_WideString& rhs) {
- return rhs == lhs;
-}
-inline bool operator==(const CFX_WideStringC& lhs, const CFX_WideString& rhs) {
- return rhs == lhs;
-}
-inline bool operator!=(const wchar_t* lhs, const CFX_WideString& rhs) {
- return rhs != lhs;
-}
-inline bool operator!=(const CFX_WideStringC& lhs, const CFX_WideString& rhs) {
- return rhs != lhs;
-}
-
CFX_ByteString FX_UTF8Encode(const CFX_WideStringC& wsStr);
-FX_FLOAT FX_atof(const CFX_ByteStringC& str);
-inline FX_FLOAT FX_atof(const CFX_WideStringC& wsStr) {
- return FX_atof(FX_UTF8Encode(wsStr).c_str());
-}
+float FX_atof(const CFX_ByteStringC& str);
+float FX_atof(const CFX_WideStringC& wsStr);
bool FX_atonum(const CFX_ByteStringC& str, void* pData);
-FX_STRSIZE FX_ftoa(FX_FLOAT f, FX_CHAR* buf);
-
-uint32_t FX_HashCode_GetA(const CFX_ByteStringC& str, bool bIgnoreCase);
-uint32_t FX_HashCode_GetW(const CFX_WideStringC& str, bool bIgnoreCase);
-
-namespace std {
-
-template <>
-struct hash<CFX_ByteString> {
- std::size_t operator()(const CFX_ByteString& str) const {
- return FX_HashCode_GetA(str.AsStringC(), false);
- }
-};
-
-template <>
-struct hash<CFX_WideString> {
- std::size_t operator()(const CFX_WideString& str) const {
- return FX_HashCode_GetW(str.AsStringC(), false);
- }
-};
-
-} // namespace std
-
-extern template struct std::hash<CFX_ByteString>;
-extern template struct std::hash<CFX_WideString>;
+FX_STRSIZE FX_ftoa(float f, char* buf);
#endif // CORE_FXCRT_FX_STRING_H_
diff --git a/chromium/third_party/pdfium/core/fxcrt/fx_system.h b/chromium/third_party/pdfium/core/fxcrt/fx_system.h
index c31bef974fe..1ee0d8b601d 100644
--- a/chromium/third_party/pdfium/core/fxcrt/fx_system.h
+++ b/chromium/third_party/pdfium/core/fxcrt/fx_system.h
@@ -56,23 +56,17 @@
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
#include <windows.h>
#include <sal.h>
-#endif
+#endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
#include <Carbon/Carbon.h>
#include <libkern/OSAtomic.h>
-#endif
+#endif // _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
-typedef void* FX_POSITION; // Keep until fxcrt containers gone
-typedef float FX_FLOAT; // Keep, allow upgrade to doubles.
-typedef double FX_DOUBLE; // Keep, allow downgrade to floats.
-typedef char FX_CHAR; // Keep, questionable signedness.
-typedef wchar_t FX_WCHAR; // Keep, maybe bad platform wchars.
-
#define IsFloatZero(f) ((f) < 0.0001 && (f) > -0.0001)
#define IsFloatBigger(fa, fb) ((fa) > (fb) && !IsFloatZero((fa) - (fb)))
#define IsFloatSmaller(fa, fb) ((fa) < (fb) && !IsFloatZero((fa) - (fb)))
@@ -83,19 +77,29 @@ typedef wchar_t FX_WCHAR; // Keep, maybe bad platform wchars.
// TODO(palmer): it should be a |size_t|, or at least unsigned.
typedef int FX_STRSIZE;
+// PDFium file sizes match the platform, but PDFium itself does not support
+// files larger than 2GB even if the platform does. The value must be signed
+// to support -1 error returns.
+// TODO(tsepez): support larger files.
+#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
+#define FX_FILESIZE int32_t
+#else // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
+#define FX_FILESIZE off_t
+#endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
+
#ifndef ASSERT
#ifndef NDEBUG
#define ASSERT assert
#else
#define ASSERT(a)
-#endif
-#endif
+#endif // NDEBUG
+#endif // ASSERT
#if defined(__clang__) || defined(__GNUC__)
#define PDFIUM_IMMEDIATE_CRASH() __builtin_trap()
#else
#define PDFIUM_IMMEDIATE_CRASH() ((void)(*(volatile char*)0 = 0))
-#endif
+#endif // defined(__clang__) || defined(__GNUC__)
// M_PI not universally present on all platforms.
#define FX_PI 3.1415926535897932384626433832795f
@@ -113,35 +117,19 @@ void FXSYS_vsnprintf(char* str, size_t size, const char* fmt, va_list ap);
#else
#define FXSYS_snprintf (void)snprintf
#define FXSYS_vsnprintf (void)vsnprintf
-#endif
+#endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ && _MSC_VER < 1900
#define FXSYS_sprintf DO_NOT_USE_SPRINTF_DIE_DIE_DIE
#define FXSYS_vsprintf DO_NOT_USE_VSPRINTF_DIE_DIE_DIE
-#define FXSYS_strncmp strncmp
-#define FXSYS_strcmp strcmp
-#define FXSYS_strcpy strcpy
-#define FXSYS_strncpy strncpy
-#define FXSYS_strstr strstr
-#define FXSYS_FILE FILE
-#define FXSYS_fopen fopen
-#define FXSYS_fclose fclose
-#define FXSYS_SEEK_END SEEK_END
-#define FXSYS_SEEK_SET SEEK_SET
-#define FXSYS_fseek fseek
-#define FXSYS_ftell ftell
-#define FXSYS_fread fread
-#define FXSYS_fwrite fwrite
-#define FXSYS_fprintf fprintf
-#define FXSYS_fflush fflush
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
#ifdef _NATIVE_WCHAR_T_DEFINED
#define FXSYS_wfopen(f, m) _wfopen((const wchar_t*)(f), (const wchar_t*)(m))
#else
#define FXSYS_wfopen _wfopen
-#endif
+#endif // _NATIVE_WCHAR_T_DEFINED
#else
-FXSYS_FILE* FXSYS_wfopen(const FX_WCHAR* filename, const FX_WCHAR* mode);
+FILE* FXSYS_wfopen(const wchar_t* filename, const wchar_t* mode);
#endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
#ifdef __cplusplus
@@ -153,27 +141,27 @@ FXSYS_FILE* FXSYS_wfopen(const FX_WCHAR* filename, const FX_WCHAR* mode);
#define FXSYS_wcslen(ptr) pdfium::base::checked_cast<FX_STRSIZE>(wcslen(ptr))
// Overloaded functions for C++ templates
-inline FX_STRSIZE FXSYS_len(const FX_CHAR* ptr) {
+inline FX_STRSIZE FXSYS_len(const char* ptr) {
return FXSYS_strlen(ptr);
}
-inline FX_STRSIZE FXSYS_len(const FX_WCHAR* ptr) {
+inline FX_STRSIZE FXSYS_len(const wchar_t* ptr) {
return FXSYS_wcslen(ptr);
}
-inline int FXSYS_cmp(const FX_CHAR* ptr1, const FX_CHAR* ptr2, size_t len) {
+inline int FXSYS_cmp(const char* ptr1, const char* ptr2, size_t len) {
return memcmp(ptr1, ptr2, len);
}
-inline int FXSYS_cmp(const FX_WCHAR* ptr1, const FX_WCHAR* ptr2, size_t len) {
+inline int FXSYS_cmp(const wchar_t* ptr1, const wchar_t* ptr2, size_t len) {
return wmemcmp(ptr1, ptr2, len);
}
-inline const FX_CHAR* FXSYS_chr(const FX_CHAR* ptr, FX_CHAR ch, size_t len) {
- return reinterpret_cast<const FX_CHAR*>(memchr(ptr, ch, len));
+inline const char* FXSYS_chr(const char* ptr, char ch, size_t len) {
+ return reinterpret_cast<const char*>(memchr(ptr, ch, len));
}
-inline const FX_WCHAR* FXSYS_chr(const FX_WCHAR* ptr, FX_WCHAR ch, size_t len) {
+inline const wchar_t* FXSYS_chr(const wchar_t* ptr, wchar_t ch, size_t len) {
return wmemchr(ptr, ch, len);
}
@@ -181,20 +169,7 @@ extern "C" {
#else
#define FXSYS_strlen(ptr) ((FX_STRSIZE)strlen(ptr))
#define FXSYS_wcslen(ptr) ((FX_STRSIZE)wcslen(ptr))
-#endif
-
-#define FXSYS_wcscmp wcscmp
-#define FXSYS_wcsstr wcsstr
-#define FXSYS_wcsncmp wcsncmp
-#define FXSYS_vswprintf vswprintf
-#define FXSYS_mbstowcs mbstowcs
-#define FXSYS_wcstombs wcstombs
-#define FXSYS_memcmp memcmp
-#define FXSYS_memcpy memcpy
-#define FXSYS_memmove memmove
-#define FXSYS_memset memset
-#define FXSYS_qsort qsort
-#define FXSYS_bsearch bsearch
+#endif // __cplusplus
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
#define FXSYS_GetACP GetACP
@@ -202,6 +177,10 @@ extern "C" {
#define FXSYS_strlwr _strlwr
#define FXSYS_strupr _strupr
#define FXSYS_stricmp _stricmp
+#define FXSYS_pow(a, b) (float)powf(a, b)
+#define FXSYS_GetFullPathName GetFullPathName
+#define FXSYS_GetModuleFileName GetModuleFileName
+
#ifdef _NATIVE_WCHAR_T_DEFINED
#define FXSYS_wcsicmp(str1, str2) _wcsicmp((wchar_t*)(str1), (wchar_t*)(str2))
#define FXSYS_WideCharToMultiByte(p1, p2, p3, p4, p5, p6, p7, p8) \
@@ -216,9 +195,7 @@ extern "C" {
#define FXSYS_MultiByteToWideChar MultiByteToWideChar
#define FXSYS_wcslwr _wcslwr
#define FXSYS_wcsupr _wcsupr
-#endif
-#define FXSYS_GetFullPathName GetFullPathName
-#define FXSYS_GetModuleFileName GetModuleFileName
+#endif // _NATIVE_WCHAR_T_DEFINED
#else
int FXSYS_GetACP();
char* FXSYS_itoa(int value, char* str, int radix);
@@ -247,46 +224,26 @@ int FXSYS_stricmp(const char*, const char*);
int FXSYS_wcsicmp(const wchar_t* str1, const wchar_t* str2);
wchar_t* FXSYS_wcslwr(wchar_t* str);
wchar_t* FXSYS_wcsupr(wchar_t* str);
+#define FXSYS_pow(a, b) (float)pow(a, b)
#endif // _FXM_PLATFORM == _FXM_PLATFORM_WINDOWS_
-#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
-#define FXSYS_pow(a, b) (FX_FLOAT) powf(a, b)
-#else
-#define FXSYS_pow(a, b) (FX_FLOAT) pow(a, b)
-#endif
-#define FXSYS_sqrt(a) (FX_FLOAT) sqrt(a)
-#define FXSYS_fabs(a) (FX_FLOAT) fabs(a)
-#define FXSYS_atan2(a, b) (FX_FLOAT) atan2(a, b)
-#define FXSYS_ceil(a) (FX_FLOAT) ceil(a)
-#define FXSYS_floor(a) (FX_FLOAT) floor(a)
-#define FXSYS_cos(a) (FX_FLOAT) cos(a)
-#define FXSYS_acos(a) (FX_FLOAT) acos(a)
-#define FXSYS_sin(a) (FX_FLOAT) sin(a)
-#define FXSYS_log(a) (FX_FLOAT) log(a)
-#define FXSYS_log10(a) (FX_FLOAT) log10(a)
-#define FXSYS_fmod(a, b) (FX_FLOAT) fmod(a, b)
-#define FXSYS_abs abs
#define FXDWORD_GET_LSBFIRST(p) \
((static_cast<uint32_t>(p[3]) << 24) | (static_cast<uint32_t>(p[2]) << 16) | \
(static_cast<uint32_t>(p[1]) << 8) | (static_cast<uint32_t>(p[0])))
#define FXDWORD_GET_MSBFIRST(p) \
((static_cast<uint32_t>(p[0]) << 24) | (static_cast<uint32_t>(p[1]) << 16) | \
(static_cast<uint32_t>(p[2]) << 8) | (static_cast<uint32_t>(p[3])))
-#define FXSYS_HIBYTE(word) ((uint8_t)((word) >> 8))
-#define FXSYS_LOBYTE(word) ((uint8_t)(word))
-#define FXSYS_HIWORD(dword) ((uint16_t)((dword) >> 16))
-#define FXSYS_LOWORD(dword) ((uint16_t)(dword))
-int32_t FXSYS_atoi(const FX_CHAR* str);
-uint32_t FXSYS_atoui(const FX_CHAR* str);
-int32_t FXSYS_wtoi(const FX_WCHAR* str);
-int64_t FXSYS_atoi64(const FX_CHAR* str);
-int64_t FXSYS_wtoi64(const FX_WCHAR* str);
-const FX_CHAR* FXSYS_i64toa(int64_t value, FX_CHAR* str, int radix);
-int FXSYS_round(FX_FLOAT f);
-#define FXSYS_sqrt2(a, b) (FX_FLOAT) FXSYS_sqrt((a) * (a) + (b) * (b))
+int32_t FXSYS_atoi(const char* str);
+uint32_t FXSYS_atoui(const char* str);
+int32_t FXSYS_wtoi(const wchar_t* str);
+int64_t FXSYS_atoi64(const char* str);
+int64_t FXSYS_wtoi64(const wchar_t* str);
+const char* FXSYS_i64toa(int64_t value, char* str, int radix);
+int FXSYS_round(float f);
+#define FXSYS_sqrt2(a, b) (float)sqrt((a) * (a) + (b) * (b))
#ifdef __cplusplus
-};
-#endif
+}; // extern C
+#endif // __cplusplus
// To print a size_t value in a portable way:
// size_t size;
@@ -326,4 +283,14 @@ int FXSYS_round(FX_FLOAT f);
#define NEVER_INLINE __attribute__((__noinline__))
#endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
+// Handle differnces between platform's variadic function implementations.
+#if defined(__ARMCC_VERSION) || \
+ (!defined(_MSC_VER) && (_FX_CPU_ == _FX_X64_ || _FX_CPU_ == _FX_IA64_ || \
+ _FX_CPU_ == _FX_ARM64_)) || \
+ defined(__native_client__)
+#define FX_VA_COPY(dst, src) va_copy((dst), (src))
+#else
+#define FX_VA_COPY(dst, src) ((dst) = (src))
+#endif
+
#endif // CORE_FXCRT_FX_SYSTEM_H_
diff --git a/chromium/third_party/pdfium/core/fxcrt/fx_system_unittest.cpp b/chromium/third_party/pdfium/core/fxcrt/fx_system_unittest.cpp
index 4ab37c7bdb4..def0043bab4 100644
--- a/chromium/third_party/pdfium/core/fxcrt/fx_system_unittest.cpp
+++ b/chromium/third_party/pdfium/core/fxcrt/fx_system_unittest.cpp
@@ -16,11 +16,11 @@
namespace {
-const FX_CHAR kSentinel = 0x7f;
+const char kSentinel = 0x7f;
void Check32BitBase16Itoa(int32_t input, const char* expected_output) {
const size_t kBufLen = 11; // "-" + 8 digits + NUL + sentinel.
- FX_CHAR buf[kBufLen];
+ char buf[kBufLen];
buf[kBufLen - 1] = kSentinel;
FXSYS_itoa(input, buf, 16);
EXPECT_EQ(std::string(expected_output), buf);
@@ -29,7 +29,7 @@ void Check32BitBase16Itoa(int32_t input, const char* expected_output) {
void Check32BitBase10Itoa(int32_t input, const char* expected_output) {
const size_t kBufLen = 13; // "-" + 10 digits + NUL + sentinel.
- FX_CHAR buf[kBufLen];
+ char buf[kBufLen];
buf[kBufLen - 1] = kSentinel;
FXSYS_itoa(input, buf, 10);
EXPECT_EQ(std::string(expected_output), buf);
@@ -38,7 +38,7 @@ void Check32BitBase10Itoa(int32_t input, const char* expected_output) {
void Check32BitBase2Itoa(int32_t input, const char* expected_output) {
const size_t kBufLen = 35; // "-" + 32 digits + NUL + sentinel.
- FX_CHAR buf[kBufLen];
+ char buf[kBufLen];
buf[kBufLen - 1] = kSentinel;
FXSYS_itoa(input, buf, 2);
EXPECT_EQ(std::string(expected_output), buf);
@@ -47,7 +47,7 @@ void Check32BitBase2Itoa(int32_t input, const char* expected_output) {
void Check64BitBase16Itoa(int64_t input, const char* expected_output) {
const size_t kBufLen = 19; // "-" + 16 digits + NUL + sentinel.
- FX_CHAR buf[kBufLen];
+ char buf[kBufLen];
buf[kBufLen - 1] = kSentinel;
FXSYS_i64toa(input, buf, 16);
EXPECT_EQ(std::string(expected_output), buf);
@@ -56,7 +56,7 @@ void Check64BitBase16Itoa(int64_t input, const char* expected_output) {
void Check64BitBase10Itoa(int64_t input, const char* expected_output) {
const size_t kBufLen = 22; // "-" + 19 digits + NUL + sentinel.
- FX_CHAR buf[kBufLen];
+ char buf[kBufLen];
buf[kBufLen - 1] = kSentinel;
FXSYS_i64toa(input, buf, 10);
EXPECT_EQ(std::string(expected_output), buf);
@@ -65,7 +65,7 @@ void Check64BitBase10Itoa(int64_t input, const char* expected_output) {
void Check64BitBase2Itoa(int64_t input, const char* expected_output) {
const size_t kBufLen = 67; // "-" + 64 digits + NUL + sentinel.
- FX_CHAR buf[kBufLen];
+ char buf[kBufLen];
buf[kBufLen - 1] = kSentinel;
FXSYS_i64toa(input, buf, 2);
EXPECT_EQ(std::string(expected_output), buf);
@@ -75,7 +75,7 @@ void Check64BitBase2Itoa(int64_t input, const char* expected_output) {
} // namespace
TEST(fxcrt, FXSYS_itoa_InvalidRadix) {
- FX_CHAR buf[32];
+ char buf[32];
FXSYS_itoa(42, buf, 17); // Ours stops at 16.
EXPECT_EQ(std::string(""), buf);
@@ -115,7 +115,7 @@ TEST(fxcrt, FXSYS_itoa) {
}
TEST(fxcrt, FXSYS_i64toa_InvalidRadix) {
- FX_CHAR buf[32];
+ char buf[32];
FXSYS_i64toa(42, buf, 17); // Ours stops at 16.
EXPECT_EQ(std::string(""), buf);
diff --git a/chromium/third_party/pdfium/core/fxcrt/fx_ucd.h b/chromium/third_party/pdfium/core/fxcrt/fx_ucd.h
index eb4bad097e9..b96d09a4060 100644
--- a/chromium/third_party/pdfium/core/fxcrt/fx_ucd.h
+++ b/chromium/third_party/pdfium/core/fxcrt/fx_ucd.h
@@ -45,50 +45,52 @@ extern const size_t kFXTextLayoutVerticalMirrorSize;
extern const uint16_t kFXTextLayoutBidiMirror[];
extern const size_t kFXTextLayoutBidiMirrorSize;
-uint32_t FX_GetUnicodeProperties(FX_WCHAR wch);
-FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch, bool bRTL, bool bVertical);
+uint32_t FX_GetUnicodeProperties(wchar_t wch);
+wchar_t FX_GetMirrorChar(wchar_t wch, bool bRTL, bool bVertical);
#ifdef PDF_ENABLE_XFA
-enum FX_CHARBREAKPROP {
- FX_CBP_OP = 0,
- FX_CBP_CL = 1,
- FX_CBP_QU = 2,
- FX_CBP_GL = 3,
- FX_CBP_NS = 4,
- FX_CBP_EX = 5,
- FX_CBP_SY = 6,
- FX_CBP_IS = 7,
- FX_CBP_PR = 8,
- FX_CBP_PO = 9,
- FX_CBP_NU = 10,
- FX_CBP_AL = 11,
- FX_CBP_ID = 12,
- FX_CBP_IN = 13,
- FX_CBP_HY = 14,
- FX_CBP_BA = 15,
- FX_CBP_BB = 16,
- FX_CBP_B2 = 17,
- FX_CBP_ZW = 18,
- FX_CBP_CM = 19,
- FX_CBP_WJ = 20,
- FX_CBP_H2 = 21,
- FX_CBP_H3 = 22,
- FX_CBP_JL = 23,
- FX_CBP_JV = 24,
- FX_CBP_JT = 25,
-
- FX_CBP_BK = 26,
- FX_CBP_CR = 27,
- FX_CBP_LF = 28,
- FX_CBP_NL = 29,
- FX_CBP_SA = 30,
- FX_CBP_SG = 31,
- FX_CBP_CB = 32,
- FX_CBP_XX = 33,
- FX_CBP_AI = 34,
- FX_CBP_SP = 35,
- FX_CBP_TB = 37,
+
+// As defined in http://www.unicode.org/reports/tr14/
+enum FXCHAR_BREAKPROP {
+ FX_CBP_OP = 0, // Opening Punctuation
+ FX_CBP_CL = 1, // Closing Punctuation
+ FX_CBP_QU = 2, // Ambiguous Quotation
+ FX_CBP_GL = 3, // Non-breaking ("Glue")
+ FX_CBP_NS = 4, // Non Starter
+ FX_CBP_EX = 5, // Exclamation/Interrogation
+ FX_CBP_SY = 6, // Symbols Allowing Breaks
+ FX_CBP_IS = 7, // Infix Separator (Numeric)
+ FX_CBP_PR = 8, // Prefix (Numeric)
+ FX_CBP_PO = 9, // Postfix (Numeric)
+ FX_CBP_NU = 10, // Numeric
+ FX_CBP_AL = 11, // Ordinary Alphabetic and Symbol Characters
+ FX_CBP_ID = 12, // Ideographic
+ FX_CBP_IN = 13, // Inseparable
+ FX_CBP_HY = 14, // Hyphen
+ FX_CBP_BA = 15, // Break Opportunity After
+ FX_CBP_BB = 16, // Break Opportunity Before
+ FX_CBP_B2 = 17, // Break Opportunity Before and After
+ FX_CBP_ZW = 18, // Zero Width Space
+ FX_CBP_CM = 19, // Attached Characters and Combining Marks
+ FX_CBP_WJ = 20, // Word Joiner
+ FX_CBP_H2 = 21, // Hangul LV Syllable
+ FX_CBP_H3 = 22, // Hangul LVT Syllable
+ FX_CBP_JL = 23, // Hangul Leading Jamo
+ FX_CBP_JV = 24, // Hangul Vowel Jamo
+ FX_CBP_JT = 25, // Hangul Trailing Jamo
+
+ FX_CBP_BK = 26, // Mandatory Break
+ FX_CBP_CR = 27, // Carriage Return
+ FX_CBP_LF = 28, // Line Feed
+ FX_CBP_NL = 29, // Next Line
+ FX_CBP_SA = 30, // Complex Context (South East Asian)
+ FX_CBP_SG = 31, // Surrogate
+ FX_CBP_CB = 32, // Contingent Break Opportunity
+ FX_CBP_XX = 33, // Unknown
+ FX_CBP_AI = 34, // Ambiguous (Alphabetic or Ideographic)
+ FX_CBP_SP = 35, // Space
FX_CBP_NONE = 36,
+ FX_CBP_TB = 37, // ?
};
#define FX_CHARTYPEBITS 11
@@ -112,92 +114,10 @@ inline FX_CHARTYPE GetCharTypeFromProp(uint32_t prop) {
return static_cast<FX_CHARTYPE>(prop & FX_CHARTYPEBITSMASK);
}
-bool FX_IsCtrlCode(FX_WCHAR ch);
-FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch,
- uint32_t dwProps,
- bool bRTL,
- bool bVertical);
-class CFX_Char {
- public:
- CFX_Char()
- : m_wCharCode(0),
- m_nBreakType(0),
- m_dwCharProps(0),
- m_iCharWidth(0),
- m_iHorizontalScale(100),
- m_iVerticalScale(100) {}
-
- CFX_Char(uint16_t wCharCode, uint32_t dwCharProps)
- : m_wCharCode(wCharCode),
- m_nBreakType(0),
- m_dwCharProps(dwCharProps),
- m_iCharWidth(0),
- m_iHorizontalScale(100),
- m_iVerticalScale(100) {}
-
- FX_CHARTYPE GetCharType() const { return GetCharTypeFromProp(m_dwCharProps); }
-
- uint16_t m_wCharCode;
- uint8_t m_nBreakType;
- uint32_t m_dwCharProps;
- int32_t m_iCharWidth;
- int32_t m_iHorizontalScale;
- int32_t m_iVerticalScale;
-};
-
-class CFX_TxtChar : public CFX_Char {
- public:
- CFX_TxtChar()
- : m_nRotation(0),
- m_dwCharStyles(0),
- m_dwStatus(0),
- m_iBidiClass(0),
- m_iBidiLevel(0),
- m_iBidiPos(0),
- m_iBidiOrder(0),
- m_pUserData(nullptr) {}
-
- int8_t m_nRotation;
- uint32_t m_dwCharStyles;
- uint32_t m_dwStatus;
- int16_t m_iBidiClass;
- int16_t m_iBidiLevel;
- int16_t m_iBidiPos;
- int16_t m_iBidiOrder;
- void* m_pUserData;
-};
-
-enum class CFX_RTFBreakType { None = 0, Piece, Line, Paragraph, Page };
-
-class CFX_RTFChar : public CFX_Char {
- public:
- CFX_RTFChar();
- CFX_RTFChar(const CFX_RTFChar& other);
- ~CFX_RTFChar();
-
- CFX_RTFBreakType m_dwStatus;
- int32_t m_iFontSize;
- int32_t m_iFontHeight;
- int16_t m_iBidiClass;
- int16_t m_iBidiLevel;
- int16_t m_iBidiPos;
- int16_t m_iBidiOrder;
- uint32_t m_dwIdentity;
- CFX_RetainPtr<CFX_Retainable> m_pUserData;
-};
-
-inline CFX_RTFChar::CFX_RTFChar()
- : m_dwStatus(CFX_RTFBreakType::None),
- m_iFontSize(0),
- m_iFontHeight(0),
- m_iBidiClass(0),
- m_iBidiLevel(0),
- m_iBidiPos(0),
- m_dwIdentity(0),
- m_pUserData(nullptr) {}
-
-inline CFX_RTFChar::CFX_RTFChar(const CFX_RTFChar& other) = default;
-inline CFX_RTFChar::~CFX_RTFChar() = default;
+wchar_t FX_GetMirrorChar(wchar_t wch,
+ uint32_t dwProps,
+ bool bRTL,
+ bool bVertical);
#endif // PDF_ENABLE_XFA
diff --git a/chromium/third_party/pdfium/core/fxcrt/fx_unicode.cpp b/chromium/third_party/pdfium/core/fxcrt/fx_unicode.cpp
index e6f423e2afa..fce826dac80 100644
--- a/chromium/third_party/pdfium/core/fxcrt/fx_unicode.cpp
+++ b/chromium/third_party/pdfium/core/fxcrt/fx_unicode.cpp
@@ -6,21 +6,14 @@
#include "core/fxcrt/fx_ucd.h"
-uint32_t FX_GetUnicodeProperties(FX_WCHAR wch) {
+uint32_t FX_GetUnicodeProperties(wchar_t wch) {
size_t idx = static_cast<size_t>(wch);
if (idx < kTextLayoutCodePropertiesSize)
return kTextLayoutCodeProperties[(uint16_t)wch];
return 0;
}
-#ifdef PDF_ENABLE_XFA
-bool FX_IsCtrlCode(FX_WCHAR ch) {
- uint32_t dwRet = (FX_GetUnicodeProperties(ch) & FX_CHARTYPEBITSMASK);
- return dwRet == FX_CHARTYPE_Tab || dwRet == FX_CHARTYPE_Control;
-}
-#endif // PDF_ENABLE_XFA
-
-FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch, bool bRTL, bool bVertical) {
+wchar_t FX_GetMirrorChar(wchar_t wch, bool bRTL, bool bVertical) {
uint32_t dwProps = FX_GetUnicodeProperties(wch);
uint32_t dwTemp = (dwProps & 0xFF800000);
if (bRTL && dwTemp < 0xFF800000) {
@@ -42,10 +35,10 @@ FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch, bool bRTL, bool bVertical) {
}
#ifdef PDF_ENABLE_XFA
-FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch,
- uint32_t dwProps,
- bool bRTL,
- bool bVertical) {
+wchar_t FX_GetMirrorChar(wchar_t wch,
+ uint32_t dwProps,
+ bool bRTL,
+ bool bVertical) {
uint32_t dwTemp = (dwProps & 0xFF800000);
if (bRTL && dwTemp < 0xFF800000) {
size_t idx = dwTemp >> 23;
diff --git a/chromium/third_party/pdfium/core/fxcrt/fx_xml.h b/chromium/third_party/pdfium/core/fxcrt/fx_xml.h
deleted file mode 100644
index 87f1915cb1a..00000000000
--- a/chromium/third_party/pdfium/core/fxcrt/fx_xml.h
+++ /dev/null
@@ -1,163 +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_FXCRT_FX_XML_H_
-#define CORE_FXCRT_FX_XML_H_
-
-#include <memory>
-#include <vector>
-
-#include "core/fxcrt/fx_basic.h"
-
-class CXML_AttrItem {
- public:
- bool Matches(const CFX_ByteString& space, const CFX_ByteString& name) const;
-
- CFX_ByteString m_QSpaceName;
- CFX_ByteString m_AttrName;
- CFX_WideString m_Value;
-};
-
-class CXML_AttrMap {
- public:
- CXML_AttrMap();
- ~CXML_AttrMap();
-
- const CFX_WideString* Lookup(const CFX_ByteString& space,
- const CFX_ByteString& name) const;
- int GetSize() const;
- CXML_AttrItem& GetAt(int index) const;
-
- void SetAt(const CFX_ByteString& space,
- const CFX_ByteString& name,
- const CFX_WideString& value);
-
- std::unique_ptr<std::vector<CXML_AttrItem>> m_pMap;
-};
-
-class CXML_Content {
- public:
- CXML_Content() : m_bCDATA(false), m_Content() {}
- void Set(bool bCDATA, const CFX_WideStringC& content) {
- m_bCDATA = bCDATA;
- m_Content = content;
- }
-
- bool m_bCDATA;
- CFX_WideString m_Content;
-};
-
-class CXML_Element {
- public:
- enum ChildType { Invalid, Element, Content };
-
- static std::unique_ptr<CXML_Element> Parse(const void* pBuffer, size_t size);
-
- CXML_Element(const CXML_Element* pParent,
- const CFX_ByteStringC& qSpace,
- const CFX_ByteStringC& tagname);
- ~CXML_Element();
-
- void Empty();
- CFX_ByteString GetTagName(bool bQualified = false) const;
- CFX_ByteString GetNamespace(bool bQualified = false) const;
- CFX_ByteString GetNamespaceURI(const CFX_ByteString& qName) const;
- const CXML_Element* GetParent() const { return m_pParent; }
- uint32_t CountAttrs() const { return m_AttrMap.GetSize(); }
- void GetAttrByIndex(int index,
- CFX_ByteString& space,
- CFX_ByteString& name,
- CFX_WideString& value) const;
- bool HasAttr(const CFX_ByteStringC& qName) const;
- bool GetAttrValue(const CFX_ByteStringC& name,
- CFX_WideString& attribute) const;
- CFX_WideString GetAttrValue(const CFX_ByteStringC& name) const {
- CFX_WideString attr;
- GetAttrValue(name, attr);
- return attr;
- }
-
- bool GetAttrValue(const CFX_ByteStringC& space,
- const CFX_ByteStringC& name,
- CFX_WideString& attribute) const;
- CFX_WideString GetAttrValue(const CFX_ByteStringC& space,
- const CFX_ByteStringC& name) const {
- CFX_WideString attr;
- GetAttrValue(space, name, attr);
- return attr;
- }
-
- bool GetAttrInteger(const CFX_ByteStringC& name, int& attribute) const;
- int GetAttrInteger(const CFX_ByteStringC& name) const {
- int attr = 0;
- GetAttrInteger(name, attr);
- return attr;
- }
-
- bool GetAttrInteger(const CFX_ByteStringC& space,
- const CFX_ByteStringC& name,
- int& attribute) const;
- int GetAttrInteger(const CFX_ByteStringC& space,
- const CFX_ByteStringC& name) const {
- int attr = 0;
- GetAttrInteger(space, name, attr);
- return attr;
- }
-
- bool GetAttrFloat(const CFX_ByteStringC& name, FX_FLOAT& attribute) const;
- FX_FLOAT GetAttrFloat(const CFX_ByteStringC& name) const {
- FX_FLOAT attr = 0;
- GetAttrFloat(name, attr);
- return attr;
- }
-
- bool GetAttrFloat(const CFX_ByteStringC& space,
- const CFX_ByteStringC& name,
- FX_FLOAT& attribute) const;
- FX_FLOAT GetAttrFloat(const CFX_ByteStringC& space,
- const CFX_ByteStringC& name) const {
- FX_FLOAT attr = 0;
- GetAttrFloat(space, name, attr);
- return attr;
- }
-
- uint32_t CountChildren() const { return m_Children.size(); }
- ChildType GetChildType(uint32_t index) const;
- CFX_WideString GetContent(uint32_t index) const;
- CXML_Element* GetElement(uint32_t index) const;
- CXML_Element* GetElement(const CFX_ByteStringC& space,
- const CFX_ByteStringC& tag) const {
- return GetElement(space, tag, 0);
- }
-
- uint32_t CountElements(const CFX_ByteStringC& space,
- const CFX_ByteStringC& tag) const;
- CXML_Element* GetElement(const CFX_ByteStringC& space,
- const CFX_ByteStringC& tag,
- int index) const;
-
- uint32_t FindElement(CXML_Element* pChild) const;
- void SetTag(const CFX_ByteStringC& qTagName);
- void RemoveChildren();
- void RemoveChild(uint32_t index);
-
- protected:
- struct ChildRecord {
- ChildType type;
- void* child; // CXML_Element and CXML_Content lack a common ancestor.
- };
-
- const CXML_Element* const m_pParent;
- CFX_ByteString m_QSpaceName;
- CFX_ByteString m_TagName;
- CXML_AttrMap m_AttrMap;
- std::vector<ChildRecord> m_Children;
-
- friend class CXML_Parser;
- friend class CXML_Composer;
-};
-
-#endif // CORE_FXCRT_FX_XML_H_
diff --git a/chromium/third_party/pdfium/core/fxcrt/fx_xml_composer.cpp b/chromium/third_party/pdfium/core/fxcrt/fx_xml_composer.cpp
deleted file mode 100644
index 637d64cd82f..00000000000
--- a/chromium/third_party/pdfium/core/fxcrt/fx_xml_composer.cpp
+++ /dev/null
@@ -1,33 +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
-
-#include "core/fxcrt/xml_int.h"
-
-#include "core/fxcrt/fx_xml.h"
-
-void FX_XML_SplitQualifiedName(const CFX_ByteStringC& bsFullName,
- CFX_ByteStringC& bsSpace,
- CFX_ByteStringC& bsName) {
- if (bsFullName.IsEmpty())
- return;
-
- FX_STRSIZE iStart = bsFullName.Find(':');
- if (iStart == -1) {
- bsName = bsFullName;
- } else {
- bsSpace = bsFullName.Mid(0, iStart);
- bsName = bsFullName.Mid(iStart + 1);
- }
-}
-
-void CXML_Element::SetTag(const CFX_ByteStringC& qTagName) {
- ASSERT(!qTagName.IsEmpty());
- CFX_ByteStringC bsSpace;
- CFX_ByteStringC bsName;
- FX_XML_SplitQualifiedName(qTagName, bsSpace, bsName);
- m_QSpaceName = bsSpace;
- m_TagName = bsName;
-}
diff --git a/chromium/third_party/pdfium/core/fxcrt/fx_xml_parser.cpp b/chromium/third_party/pdfium/core/fxcrt/fx_xml_parser.cpp
deleted file mode 100644
index 761aae77758..00000000000
--- a/chromium/third_party/pdfium/core/fxcrt/fx_xml_parser.cpp
+++ /dev/null
@@ -1,918 +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
-
-#include <algorithm>
-#include <memory>
-#include <vector>
-
-#include "core/fxcrt/fx_ext.h"
-#include "core/fxcrt/fx_xml.h"
-#include "core/fxcrt/xml_int.h"
-#include "third_party/base/ptr_util.h"
-#include "third_party/base/stl_util.h"
-
-namespace {
-
-#define FXCRTM_XML_CHARTYPE_Normal 0x00
-#define FXCRTM_XML_CHARTYPE_SpaceChar 0x01
-#define FXCRTM_XML_CHARTYPE_Letter 0x02
-#define FXCRTM_XML_CHARTYPE_Digital 0x04
-#define FXCRTM_XML_CHARTYPE_NameIntro 0x08
-#define FXCRTM_XML_CHARTYPE_NameChar 0x10
-#define FXCRTM_XML_CHARTYPE_HexDigital 0x20
-#define FXCRTM_XML_CHARTYPE_HexLowerLetter 0x40
-#define FXCRTM_XML_CHARTYPE_HexUpperLetter 0x60
-#define FXCRTM_XML_CHARTYPE_HexChar 0x60
-
-const uint8_t g_FXCRT_XML_ByteTypes[256] = {
- 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
- 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
- 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00,
- 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x08, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x1A,
- 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A,
- 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x00, 0x00, 0x00, 0x00, 0x18,
- 0x00, 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A,
- 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A,
- 0x1A, 0x1A, 0x1A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1A, 0x1A, 0x1A, 0x1A,
- 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A,
- 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A,
- 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A,
- 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A,
- 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A,
- 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A,
- 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A,
- 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A,
- 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A,
- 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A,
- 0x1A, 0x1A, 0x01, 0x01,
-};
-
-bool g_FXCRT_XML_IsWhiteSpace(uint8_t ch) {
- return !!(g_FXCRT_XML_ByteTypes[ch] & FXCRTM_XML_CHARTYPE_SpaceChar);
-}
-
-bool g_FXCRT_XML_IsDigital(uint8_t ch) {
- return !!(g_FXCRT_XML_ByteTypes[ch] & FXCRTM_XML_CHARTYPE_Digital);
-}
-
-bool g_FXCRT_XML_IsNameIntro(uint8_t ch) {
- return !!(g_FXCRT_XML_ByteTypes[ch] & FXCRTM_XML_CHARTYPE_NameIntro);
-}
-
-bool g_FXCRT_XML_IsNameChar(uint8_t ch) {
- return !!(g_FXCRT_XML_ByteTypes[ch] & FXCRTM_XML_CHARTYPE_NameChar);
-}
-
-class CXML_DataBufAcc : public IFX_BufferedReadStream {
- public:
- template <typename T, typename... Args>
- friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args);
-
- // IFX_BufferedReadStream
- bool IsEOF() override;
- FX_FILESIZE GetPosition() override;
- size_t ReadBlock(void* buffer, size_t size) override;
- bool ReadNextBlock(bool bRestart) override;
- const uint8_t* GetBlockBuffer() override;
- size_t GetBlockSize() override;
- FX_FILESIZE GetBlockOffset() override;
-
- private:
- CXML_DataBufAcc(const uint8_t* pBuffer, size_t size);
- ~CXML_DataBufAcc() override;
-
- const uint8_t* m_pBuffer;
- size_t m_dwSize;
- size_t m_dwCurPos;
-};
-
-CXML_DataBufAcc::CXML_DataBufAcc(const uint8_t* pBuffer, size_t size)
- : m_pBuffer(pBuffer), m_dwSize(size), m_dwCurPos(0) {}
-
-CXML_DataBufAcc::~CXML_DataBufAcc() {}
-
-bool CXML_DataBufAcc::IsEOF() {
- return m_dwCurPos >= m_dwSize;
-}
-
-FX_FILESIZE CXML_DataBufAcc::GetPosition() {
- return static_cast<FX_FILESIZE>(m_dwCurPos);
-}
-
-size_t CXML_DataBufAcc::ReadBlock(void* buffer, size_t size) {
- return 0;
-}
-
-bool CXML_DataBufAcc::ReadNextBlock(bool bRestart) {
- if (bRestart)
- m_dwCurPos = 0;
-
- if (m_dwCurPos < m_dwSize) {
- m_dwCurPos = m_dwSize;
- return true;
- }
- return false;
-}
-
-const uint8_t* CXML_DataBufAcc::GetBlockBuffer() {
- return m_pBuffer;
-}
-
-size_t CXML_DataBufAcc::GetBlockSize() {
- return m_dwSize;
-}
-
-FX_FILESIZE CXML_DataBufAcc::GetBlockOffset() {
- return 0;
-}
-
-class CXML_DataStmAcc : public IFX_BufferedReadStream {
- public:
- template <typename T, typename... Args>
- friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args);
-
- // IFX_BufferedReadStream
- bool IsEOF() override;
- FX_FILESIZE GetPosition() override;
- size_t ReadBlock(void* buffer, size_t size) override;
- bool ReadNextBlock(bool bRestart) override;
- const uint8_t* GetBlockBuffer() override;
- size_t GetBlockSize() override;
- FX_FILESIZE GetBlockOffset() override;
-
- private:
- explicit CXML_DataStmAcc(
- const CFX_RetainPtr<IFX_SeekableReadStream>& pFileRead);
- ~CXML_DataStmAcc() override;
-
- CFX_RetainPtr<IFX_SeekableReadStream> m_pFileRead;
- uint8_t* m_pBuffer;
- FX_FILESIZE m_nStart;
- size_t m_dwSize;
-};
-
-CXML_DataStmAcc::CXML_DataStmAcc(
- const CFX_RetainPtr<IFX_SeekableReadStream>& pFileRead)
- : m_pFileRead(pFileRead), m_pBuffer(nullptr), m_nStart(0), m_dwSize(0) {
- ASSERT(m_pFileRead);
-}
-
-CXML_DataStmAcc::~CXML_DataStmAcc() {
- FX_Free(m_pBuffer);
-}
-
-bool CXML_DataStmAcc::IsEOF() {
- return m_nStart + static_cast<FX_FILESIZE>(m_dwSize) >=
- m_pFileRead->GetSize();
-}
-
-FX_FILESIZE CXML_DataStmAcc::GetPosition() {
- return m_nStart + static_cast<FX_FILESIZE>(m_dwSize);
-}
-
-size_t CXML_DataStmAcc::ReadBlock(void* buffer, size_t size) {
- return 0;
-}
-
-bool CXML_DataStmAcc::ReadNextBlock(bool bRestart) {
- if (bRestart)
- m_nStart = 0;
-
- FX_FILESIZE nLength = m_pFileRead->GetSize();
- m_nStart += static_cast<FX_FILESIZE>(m_dwSize);
- if (m_nStart >= nLength)
- return false;
-
- static const FX_FILESIZE FX_XMLDATASTREAM_BufferSize = 32 * 1024;
- m_dwSize = static_cast<size_t>(
- std::min(FX_XMLDATASTREAM_BufferSize, nLength - m_nStart));
- if (!m_pBuffer)
- m_pBuffer = FX_Alloc(uint8_t, m_dwSize);
-
- return m_pFileRead->ReadBlock(m_pBuffer, m_nStart, m_dwSize);
-}
-
-const uint8_t* CXML_DataStmAcc::GetBlockBuffer() {
- return (const uint8_t*)m_pBuffer;
-}
-
-size_t CXML_DataStmAcc::GetBlockSize() {
- return m_dwSize;
-}
-
-FX_FILESIZE CXML_DataStmAcc::GetBlockOffset() {
- return m_nStart;
-}
-
-} // namespace
-
-CXML_Parser::CXML_Parser()
- : m_nOffset(0),
- m_pBuffer(nullptr),
- m_dwBufferSize(0),
- m_nBufferOffset(0),
- m_dwIndex(0) {}
-
-CXML_Parser::~CXML_Parser() {}
-
-bool CXML_Parser::Init(const uint8_t* pBuffer, size_t size) {
- m_pDataAcc = pdfium::MakeRetain<CXML_DataBufAcc>(pBuffer, size);
- m_nOffset = 0;
- return ReadNextBlock();
-}
-
-bool CXML_Parser::ReadNextBlock() {
- if (!m_pDataAcc->ReadNextBlock())
- return false;
-
- m_pBuffer = m_pDataAcc->GetBlockBuffer();
- m_dwBufferSize = m_pDataAcc->GetBlockSize();
- m_nBufferOffset = m_pDataAcc->GetBlockOffset();
- m_dwIndex = 0;
- return m_dwBufferSize > 0;
-}
-
-bool CXML_Parser::IsEOF() {
- return m_pDataAcc->IsEOF() && m_dwIndex >= m_dwBufferSize;
-}
-
-void CXML_Parser::SkipWhiteSpaces() {
- m_nOffset = m_nBufferOffset + static_cast<FX_FILESIZE>(m_dwIndex);
- if (IsEOF())
- return;
-
- do {
- while (m_dwIndex < m_dwBufferSize &&
- g_FXCRT_XML_IsWhiteSpace(m_pBuffer[m_dwIndex])) {
- m_dwIndex++;
- }
- m_nOffset = m_nBufferOffset + static_cast<FX_FILESIZE>(m_dwIndex);
- if (m_dwIndex < m_dwBufferSize || IsEOF())
- break;
- } while (ReadNextBlock());
-}
-
-void CXML_Parser::GetName(CFX_ByteString* space, CFX_ByteString* name) {
- m_nOffset = m_nBufferOffset + static_cast<FX_FILESIZE>(m_dwIndex);
- if (IsEOF())
- return;
-
- CFX_ByteTextBuf buf;
- uint8_t ch;
- do {
- while (m_dwIndex < m_dwBufferSize) {
- ch = m_pBuffer[m_dwIndex];
- if (ch == ':') {
- *space = buf.AsStringC();
- buf.Clear();
- } else if (g_FXCRT_XML_IsNameChar(ch)) {
- buf.AppendChar(ch);
- } else {
- break;
- }
- m_dwIndex++;
- }
- m_nOffset = m_nBufferOffset + static_cast<FX_FILESIZE>(m_dwIndex);
- if (m_dwIndex < m_dwBufferSize || IsEOF())
- break;
- } while (ReadNextBlock());
- *name = buf.AsStringC();
-}
-
-void CXML_Parser::SkipLiterals(const CFX_ByteStringC& str) {
- m_nOffset = m_nBufferOffset + static_cast<FX_FILESIZE>(m_dwIndex);
- if (IsEOF()) {
- return;
- }
- int32_t i = 0, iLen = str.GetLength();
- do {
- while (m_dwIndex < m_dwBufferSize) {
- if (str.GetAt(i) != m_pBuffer[m_dwIndex++]) {
- i = 0;
- continue;
- }
- i++;
- if (i == iLen)
- break;
- }
- m_nOffset = m_nBufferOffset + static_cast<FX_FILESIZE>(m_dwIndex);
- if (i == iLen)
- return;
-
- if (m_dwIndex < m_dwBufferSize || IsEOF())
- break;
- } while (ReadNextBlock());
- while (!m_pDataAcc->IsEOF()) {
- ReadNextBlock();
- m_nOffset = m_nBufferOffset + static_cast<FX_FILESIZE>(m_dwBufferSize);
- }
- m_dwIndex = m_dwBufferSize;
-}
-
-uint32_t CXML_Parser::GetCharRef() {
- m_nOffset = m_nBufferOffset + static_cast<FX_FILESIZE>(m_dwIndex);
- if (IsEOF())
- return 0;
-
- uint8_t ch;
- int32_t iState = 0;
- CFX_ByteTextBuf buf;
- uint32_t code = 0;
- do {
- while (m_dwIndex < m_dwBufferSize) {
- ch = m_pBuffer[m_dwIndex];
- switch (iState) {
- case 0:
- if (ch == '#') {
- m_dwIndex++;
- iState = 2;
- break;
- }
- iState = 1;
- case 1:
- m_dwIndex++;
- if (ch == ';') {
- CFX_ByteStringC ref = buf.AsStringC();
- if (ref == "gt")
- code = '>';
- else if (ref == "lt")
- code = '<';
- else if (ref == "amp")
- code = '&';
- else if (ref == "apos")
- code = '\'';
- else if (ref == "quot")
- code = '"';
- iState = 10;
- break;
- }
- buf.AppendByte(ch);
- break;
- case 2:
- if (ch == 'x') {
- m_dwIndex++;
- iState = 4;
- break;
- }
- iState = 3;
- case 3:
- m_dwIndex++;
- if (ch == ';') {
- iState = 10;
- break;
- }
- if (g_FXCRT_XML_IsDigital(ch))
- code = code * 10 + FXSYS_toDecimalDigit(static_cast<FX_WCHAR>(ch));
- break;
- case 4:
- m_dwIndex++;
- if (ch == ';') {
- iState = 10;
- break;
- }
- uint8_t nHex =
- g_FXCRT_XML_ByteTypes[ch] & FXCRTM_XML_CHARTYPE_HexChar;
- if (nHex) {
- if (nHex == FXCRTM_XML_CHARTYPE_HexDigital) {
- code =
- (code << 4) + FXSYS_toDecimalDigit(static_cast<FX_WCHAR>(ch));
- } else if (nHex == FXCRTM_XML_CHARTYPE_HexLowerLetter) {
- code = (code << 4) + ch - 87;
- } else {
- code = (code << 4) + ch - 55;
- }
- }
- break;
- }
- if (iState == 10)
- break;
- }
- m_nOffset = m_nBufferOffset + static_cast<FX_FILESIZE>(m_dwIndex);
- if (iState == 10 || m_dwIndex < m_dwBufferSize || IsEOF()) {
- break;
- }
- } while (ReadNextBlock());
- return code;
-}
-
-void CXML_Parser::GetAttrValue(CFX_WideString& value) {
- m_nOffset = m_nBufferOffset + static_cast<FX_FILESIZE>(m_dwIndex);
- if (IsEOF())
- return;
-
- CFX_UTF8Decoder decoder;
- uint8_t mark = 0, ch = 0;
- do {
- while (m_dwIndex < m_dwBufferSize) {
- ch = m_pBuffer[m_dwIndex];
- if (mark == 0) {
- if (ch != '\'' && ch != '"')
- return;
-
- mark = ch;
- m_dwIndex++;
- ch = 0;
- continue;
- }
- m_dwIndex++;
- if (ch == mark)
- break;
-
- if (ch == '&') {
- decoder.AppendChar(GetCharRef());
- if (IsEOF()) {
- value = decoder.GetResult();
- return;
- }
- } else {
- decoder.Input(ch);
- }
- }
- m_nOffset = m_nBufferOffset + static_cast<FX_FILESIZE>(m_dwIndex);
- if (ch == mark || m_dwIndex < m_dwBufferSize || IsEOF())
- break;
- } while (ReadNextBlock());
- value = decoder.GetResult();
-}
-
-void CXML_Parser::GetTagName(bool bStartTag,
- bool* bEndTag,
- CFX_ByteString* space,
- CFX_ByteString* name) {
- m_nOffset = m_nBufferOffset + static_cast<FX_FILESIZE>(m_dwIndex);
- if (IsEOF())
- return;
-
- *bEndTag = false;
- uint8_t ch;
- int32_t iState = bStartTag ? 1 : 0;
- do {
- while (m_dwIndex < m_dwBufferSize) {
- ch = m_pBuffer[m_dwIndex];
- switch (iState) {
- case 0:
- m_dwIndex++;
- if (ch != '<')
- break;
-
- iState = 1;
- break;
- case 1:
- if (ch == '?') {
- m_dwIndex++;
- SkipLiterals("?>");
- iState = 0;
- break;
- }
- if (ch == '!') {
- m_dwIndex++;
- SkipLiterals("-->");
- iState = 0;
- break;
- }
- if (ch == '/') {
- m_dwIndex++;
- GetName(space, name);
- *bEndTag = true;
- } else {
- GetName(space, name);
- *bEndTag = false;
- }
- return;
- }
- }
- m_nOffset = m_nBufferOffset + static_cast<FX_FILESIZE>(m_dwIndex);
- if (m_dwIndex < m_dwBufferSize || IsEOF())
- break;
- } while (ReadNextBlock());
-}
-
-std::unique_ptr<CXML_Element> CXML_Parser::ParseElement(CXML_Element* pParent,
- bool bStartTag) {
- m_nOffset = m_nBufferOffset + static_cast<FX_FILESIZE>(m_dwIndex);
- if (IsEOF())
- return nullptr;
-
- CFX_ByteString tag_name;
- CFX_ByteString tag_space;
- bool bEndTag;
- GetTagName(bStartTag, &bEndTag, &tag_space, &tag_name);
- if (tag_name.IsEmpty() || bEndTag)
- return nullptr;
-
- auto pElement = pdfium::MakeUnique<CXML_Element>(
- pParent, tag_space.AsStringC(), tag_name.AsStringC());
- do {
- CFX_ByteString attr_space;
- CFX_ByteString attr_name;
- while (m_dwIndex < m_dwBufferSize) {
- SkipWhiteSpaces();
- if (IsEOF())
- break;
-
- if (!g_FXCRT_XML_IsNameIntro(m_pBuffer[m_dwIndex]))
- break;
-
- GetName(&attr_space, &attr_name);
- SkipWhiteSpaces();
- if (IsEOF())
- break;
-
- if (m_pBuffer[m_dwIndex] != '=')
- break;
-
- m_dwIndex++;
- SkipWhiteSpaces();
- if (IsEOF())
- break;
-
- CFX_WideString attr_value;
- GetAttrValue(attr_value);
- pElement->m_AttrMap.SetAt(attr_space, attr_name, attr_value);
- }
- m_nOffset = m_nBufferOffset + static_cast<FX_FILESIZE>(m_dwIndex);
- if (m_dwIndex < m_dwBufferSize || IsEOF())
- break;
- } while (ReadNextBlock());
- SkipWhiteSpaces();
- if (IsEOF())
- return pElement;
-
- uint8_t ch = m_pBuffer[m_dwIndex++];
- if (ch == '/') {
- m_dwIndex++;
- m_nOffset = m_nBufferOffset + static_cast<FX_FILESIZE>(m_dwIndex);
- return pElement;
- }
- if (ch != '>') {
- m_nOffset = m_nBufferOffset + static_cast<FX_FILESIZE>(m_dwIndex);
- return nullptr;
- }
- SkipWhiteSpaces();
- if (IsEOF())
- return pElement;
-
- CFX_UTF8Decoder decoder;
- CFX_WideTextBuf content;
- bool bCDATA = false;
- int32_t iState = 0;
- do {
- while (m_dwIndex < m_dwBufferSize) {
- ch = m_pBuffer[m_dwIndex++];
- switch (iState) {
- case 0:
- if (ch == '<') {
- iState = 1;
- } else if (ch == '&') {
- decoder.ClearStatus();
- decoder.AppendChar(GetCharRef());
- } else {
- decoder.Input(ch);
- }
- break;
- case 1:
- if (ch == '!') {
- iState = 2;
- } else if (ch == '?') {
- SkipLiterals("?>");
- SkipWhiteSpaces();
- iState = 0;
- } else if (ch == '/') {
- CFX_ByteString space;
- CFX_ByteString name;
- GetName(&space, &name);
- SkipWhiteSpaces();
- m_dwIndex++;
- iState = 10;
- } else {
- content << decoder.GetResult();
- CFX_WideString dataStr = content.MakeString();
- if (!bCDATA)
- dataStr.TrimRight(L" \t\r\n");
-
- InsertContentSegment(bCDATA, dataStr.AsStringC(), pElement.get());
- content.Clear();
- decoder.Clear();
- bCDATA = false;
- iState = 0;
- m_dwIndex--;
- std::unique_ptr<CXML_Element> pSubElement(
- ParseElement(pElement.get(), true));
- if (!pSubElement)
- break;
-
- pElement->m_Children.push_back(
- {CXML_Element::Element, pSubElement.release()});
- SkipWhiteSpaces();
- }
- break;
- case 2:
- if (ch == '[') {
- SkipLiterals("]]>");
- } else if (ch == '-') {
- m_dwIndex++;
- SkipLiterals("-->");
- } else {
- SkipLiterals(">");
- }
- decoder.Clear();
- SkipWhiteSpaces();
- iState = 0;
- break;
- }
- if (iState == 10) {
- break;
- }
- }
- m_nOffset = m_nBufferOffset + static_cast<FX_FILESIZE>(m_dwIndex);
- if (iState == 10 || m_dwIndex < m_dwBufferSize || IsEOF())
- break;
- } while (ReadNextBlock());
- content << decoder.GetResult();
- CFX_WideString dataStr = content.MakeString();
- dataStr.TrimRight(L" \t\r\n");
-
- InsertContentSegment(bCDATA, dataStr.AsStringC(), pElement.get());
- content.Clear();
- decoder.Clear();
- bCDATA = false;
- return pElement;
-}
-
-void CXML_Parser::InsertContentSegment(bool bCDATA,
- const CFX_WideStringC& content,
- CXML_Element* pElement) {
- if (content.IsEmpty())
- return;
-
- CXML_Content* pContent = new CXML_Content;
- pContent->Set(bCDATA, content);
- pElement->m_Children.push_back({CXML_Element::Content, pContent});
-}
-
-std::unique_ptr<CXML_Element> CXML_Element::Parse(const void* pBuffer,
- size_t size) {
- CXML_Parser parser;
- if (!parser.Init(static_cast<const uint8_t*>(pBuffer), size))
- return nullptr;
- return parser.ParseElement(nullptr, false);
-}
-
-CXML_Element::CXML_Element(const CXML_Element* pParent,
- const CFX_ByteStringC& qSpace,
- const CFX_ByteStringC& tagname)
- : m_pParent(pParent), m_QSpaceName(qSpace), m_TagName(tagname) {}
-
-CXML_Element::~CXML_Element() {
- Empty();
-}
-
-void CXML_Element::Empty() {
- RemoveChildren();
-}
-void CXML_Element::RemoveChildren() {
- for (const ChildRecord& record : m_Children) {
- if (record.type == Content) {
- delete static_cast<CXML_Content*>(record.child);
- } else if (record.type == Element) {
- CXML_Element* child = static_cast<CXML_Element*>(record.child);
- child->RemoveChildren();
- delete child;
- }
- }
- m_Children.clear();
-}
-CFX_ByteString CXML_Element::GetTagName(bool bQualified) const {
- if (!bQualified || m_QSpaceName.IsEmpty()) {
- return m_TagName;
- }
- CFX_ByteString bsTag = m_QSpaceName;
- bsTag += ":";
- bsTag += m_TagName;
- return bsTag;
-}
-
-CFX_ByteString CXML_Element::GetNamespace(bool bQualified) const {
- return bQualified ? m_QSpaceName : GetNamespaceURI(m_QSpaceName);
-}
-
-CFX_ByteString CXML_Element::GetNamespaceURI(
- const CFX_ByteString& qName) const {
- const CFX_WideString* pwsSpace;
- const CXML_Element* pElement = this;
- do {
- if (qName.IsEmpty())
- pwsSpace = pElement->m_AttrMap.Lookup("", "xmlns");
- else
- pwsSpace = pElement->m_AttrMap.Lookup("xmlns", qName);
- if (pwsSpace)
- break;
-
- pElement = pElement->GetParent();
- } while (pElement);
- return pwsSpace ? pwsSpace->UTF8Encode() : CFX_ByteString();
-}
-
-void CXML_Element::GetAttrByIndex(int index,
- CFX_ByteString& space,
- CFX_ByteString& name,
- CFX_WideString& value) const {
- if (index < 0 || index >= m_AttrMap.GetSize())
- return;
-
- CXML_AttrItem& item = m_AttrMap.GetAt(index);
- space = item.m_QSpaceName;
- name = item.m_AttrName;
- value = item.m_Value;
-}
-
-bool CXML_Element::HasAttr(const CFX_ByteStringC& name) const {
- CFX_ByteStringC bsSpace;
- CFX_ByteStringC bsName;
- FX_XML_SplitQualifiedName(name, bsSpace, bsName);
- return !!m_AttrMap.Lookup(CFX_ByteString(bsSpace), CFX_ByteString(bsName));
-}
-
-bool CXML_Element::GetAttrValue(const CFX_ByteStringC& name,
- CFX_WideString& attribute) const {
- CFX_ByteStringC bsSpace;
- CFX_ByteStringC bsName;
- FX_XML_SplitQualifiedName(name, bsSpace, bsName);
- return GetAttrValue(bsSpace, bsName, attribute);
-}
-
-bool CXML_Element::GetAttrValue(const CFX_ByteStringC& space,
- const CFX_ByteStringC& name,
- CFX_WideString& attribute) const {
- const CFX_WideString* pValue =
- m_AttrMap.Lookup(CFX_ByteString(space), CFX_ByteString(name));
- if (!pValue)
- return false;
-
- attribute = *pValue;
- return true;
-}
-
-bool CXML_Element::GetAttrInteger(const CFX_ByteStringC& name,
- int& attribute) const {
- CFX_ByteStringC bsSpace;
- CFX_ByteStringC bsName;
- FX_XML_SplitQualifiedName(name, bsSpace, bsName);
- const CFX_WideString* pwsValue =
- m_AttrMap.Lookup(CFX_ByteString(bsSpace), CFX_ByteString(bsName));
- if (!pwsValue)
- return false;
-
- attribute = pwsValue->GetInteger();
- return true;
-}
-
-bool CXML_Element::GetAttrInteger(const CFX_ByteStringC& space,
- const CFX_ByteStringC& name,
- int& attribute) const {
- const CFX_WideString* pwsValue =
- m_AttrMap.Lookup(CFX_ByteString(space), CFX_ByteString(name));
- if (!pwsValue)
- return false;
-
- attribute = pwsValue->GetInteger();
- return true;
-}
-
-bool CXML_Element::GetAttrFloat(const CFX_ByteStringC& name,
- FX_FLOAT& attribute) const {
- CFX_ByteStringC bsSpace;
- CFX_ByteStringC bsName;
- FX_XML_SplitQualifiedName(name, bsSpace, bsName);
- return GetAttrFloat(bsSpace, bsName, attribute);
-}
-
-bool CXML_Element::GetAttrFloat(const CFX_ByteStringC& space,
- const CFX_ByteStringC& name,
- FX_FLOAT& attribute) const {
- const CFX_WideString* pValue =
- m_AttrMap.Lookup(CFX_ByteString(space), CFX_ByteString(name));
- if (!pValue)
- return false;
-
- attribute = pValue->GetFloat();
- return true;
-}
-
-CXML_Element::ChildType CXML_Element::GetChildType(uint32_t index) const {
- return index < m_Children.size() ? m_Children[index].type : Invalid;
-}
-
-CFX_WideString CXML_Element::GetContent(uint32_t index) const {
- if (index < m_Children.size() && m_Children[index].type == Content) {
- CXML_Content* pContent =
- static_cast<CXML_Content*>(m_Children[index].child);
- if (pContent)
- return pContent->m_Content;
- }
- return CFX_WideString();
-}
-
-CXML_Element* CXML_Element::GetElement(uint32_t index) const {
- if (index < m_Children.size() && m_Children[index].type == Element)
- return static_cast<CXML_Element*>(m_Children[index].child);
- return nullptr;
-}
-
-uint32_t CXML_Element::CountElements(const CFX_ByteStringC& space,
- const CFX_ByteStringC& tag) const {
- int count = 0;
- for (const ChildRecord& record : m_Children) {
- if (record.type != Element)
- continue;
-
- CXML_Element* pKid = static_cast<CXML_Element*>(record.child);
- if ((space.IsEmpty() || pKid->m_QSpaceName == space) &&
- pKid->m_TagName == tag) {
- count++;
- }
- }
- return count;
-}
-
-CXML_Element* CXML_Element::GetElement(const CFX_ByteStringC& space,
- const CFX_ByteStringC& tag,
- int index) const {
- if (index < 0)
- return nullptr;
-
- for (const ChildRecord& record : m_Children) {
- if (record.type != Element)
- continue;
-
- CXML_Element* pKid = static_cast<CXML_Element*>(record.child);
- if ((space.IsEmpty() || pKid->m_QSpaceName == space) &&
- pKid->m_TagName == tag) {
- if (index-- == 0)
- return pKid;
- }
- }
- return nullptr;
-}
-
-uint32_t CXML_Element::FindElement(CXML_Element* pChild) const {
- int index = 0;
- for (const ChildRecord& record : m_Children) {
- if (record.type == Element &&
- static_cast<CXML_Element*>(record.child) == pChild) {
- return index;
- }
- ++index;
- }
- return (uint32_t)-1;
-}
-
-bool CXML_AttrItem::Matches(const CFX_ByteString& space,
- const CFX_ByteString& name) const {
- return (space.IsEmpty() || m_QSpaceName == space) && m_AttrName == name;
-}
-
-CXML_AttrMap::CXML_AttrMap() {}
-
-CXML_AttrMap::~CXML_AttrMap() {}
-
-const CFX_WideString* CXML_AttrMap::Lookup(const CFX_ByteString& space,
- const CFX_ByteString& name) const {
- if (!m_pMap)
- return nullptr;
-
- for (const auto& item : *m_pMap) {
- if (item.Matches(space, name))
- return &item.m_Value;
- }
- return nullptr;
-}
-
-void CXML_AttrMap::SetAt(const CFX_ByteString& space,
- const CFX_ByteString& name,
- const CFX_WideString& value) {
- if (!m_pMap)
- m_pMap = pdfium::MakeUnique<std::vector<CXML_AttrItem>>();
-
- for (CXML_AttrItem& item : *m_pMap) {
- if (item.Matches(space, name)) {
- item.m_Value = value;
- return;
- }
- }
-
- m_pMap->push_back({space, name, CFX_WideString(value)});
-}
-
-int CXML_AttrMap::GetSize() const {
- return m_pMap ? pdfium::CollectionSize<int>(*m_pMap) : 0;
-}
-
-CXML_AttrItem& CXML_AttrMap::GetAt(int index) const {
- return (*m_pMap)[index];
-}
diff --git a/chromium/third_party/pdfium/core/fxcrt/fxcrt_posix.cpp b/chromium/third_party/pdfium/core/fxcrt/fxcrt_posix.cpp
index a96f164c7f1..562c70c23ef 100644
--- a/chromium/third_party/pdfium/core/fxcrt/fxcrt_posix.cpp
+++ b/chromium/third_party/pdfium/core/fxcrt/fxcrt_posix.cpp
@@ -66,7 +66,7 @@ FX_FILESIZE CFXCRT_FileAccess_Posix::GetSize() const {
return 0;
}
struct stat s;
- FXSYS_memset(&s, 0, sizeof(s));
+ memset(&s, 0, sizeof(s));
fstat(m_nFD, &s);
return s.st_size;
}
diff --git a/chromium/third_party/pdfium/core/fxcrt/ifx_chariter.h b/chromium/third_party/pdfium/core/fxcrt/ifx_chariter.h
new file mode 100644
index 00000000000..4435257cc99
--- /dev/null
+++ b/chromium/third_party/pdfium/core/fxcrt/ifx_chariter.h
@@ -0,0 +1,24 @@
+// Copyright 2016 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef CORE_FXCRT_IFX_CHARITER_H_
+#define CORE_FXCRT_IFX_CHARITER_H_
+
+#include "core/fxcrt/fx_system.h"
+
+class IFX_CharIter {
+ public:
+ virtual ~IFX_CharIter() {}
+
+ virtual bool Next(bool bPrev = false) = 0;
+ virtual wchar_t GetChar() = 0;
+ virtual void SetAt(int32_t nIndex) = 0;
+ virtual int32_t GetAt() const = 0;
+ virtual bool IsEOF(bool bTail = true) const = 0;
+ virtual IFX_CharIter* Clone() = 0;
+};
+
+#endif // CORE_FXCRT_IFX_CHARITER_H_
diff --git a/chromium/third_party/pdfium/core/fxcrt/ifx_locale.h b/chromium/third_party/pdfium/core/fxcrt/ifx_locale.h
new file mode 100644
index 00000000000..5039aec6f0e
--- /dev/null
+++ b/chromium/third_party/pdfium/core/fxcrt/ifx_locale.h
@@ -0,0 +1,76 @@
+// 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_FXCRT_IFX_LOCALE_H_
+#define CORE_FXCRT_IFX_LOCALE_H_
+
+#include "core/fxcrt/cfx_datetime.h"
+#include "core/fxcrt/fx_string.h"
+
+enum FX_LOCALENUMSYMBOL {
+ FX_LOCALENUMSYMBOL_Decimal,
+ FX_LOCALENUMSYMBOL_Grouping,
+ FX_LOCALENUMSYMBOL_Percent,
+ FX_LOCALENUMSYMBOL_Minus,
+ FX_LOCALENUMSYMBOL_Zero,
+ FX_LOCALENUMSYMBOL_CurrencySymbol,
+ FX_LOCALENUMSYMBOL_CurrencyName,
+};
+
+enum FX_LOCALEDATETIMESUBCATEGORY {
+ FX_LOCALEDATETIMESUBCATEGORY_Default,
+ FX_LOCALEDATETIMESUBCATEGORY_Short,
+ FX_LOCALEDATETIMESUBCATEGORY_Medium,
+ FX_LOCALEDATETIMESUBCATEGORY_Full,
+ FX_LOCALEDATETIMESUBCATEGORY_Long,
+};
+
+enum FX_LOCALENUMSUBCATEGORY {
+ FX_LOCALENUMPATTERN_Percent,
+ FX_LOCALENUMPATTERN_Currency,
+ FX_LOCALENUMPATTERN_Decimal,
+ FX_LOCALENUMPATTERN_Integer,
+};
+
+enum FX_LOCALECATEGORY {
+ FX_LOCALECATEGORY_Unknown,
+ FX_LOCALECATEGORY_Date,
+ FX_LOCALECATEGORY_Time,
+ FX_LOCALECATEGORY_DateTime,
+ FX_LOCALECATEGORY_Num,
+ FX_LOCALECATEGORY_Text,
+ FX_LOCALECATEGORY_Zero,
+ FX_LOCALECATEGORY_Null,
+};
+
+enum FX_DATETIMETYPE {
+ FX_DATETIMETYPE_Unknown,
+ FX_DATETIMETYPE_Date,
+ FX_DATETIMETYPE_Time,
+ FX_DATETIMETYPE_DateTime,
+ FX_DATETIMETYPE_TimeDate,
+};
+
+class IFX_Locale {
+ public:
+ virtual ~IFX_Locale() {}
+
+ virtual CFX_WideString GetName() const = 0;
+ virtual CFX_WideString GetNumbericSymbol(FX_LOCALENUMSYMBOL eType) const = 0;
+ virtual CFX_WideString GetDateTimeSymbols() const = 0;
+ virtual CFX_WideString GetMonthName(int32_t nMonth, bool bAbbr) const = 0;
+ virtual CFX_WideString GetDayName(int32_t nWeek, bool bAbbr) const = 0;
+ virtual CFX_WideString GetMeridiemName(bool bAM) const = 0;
+ virtual FX_TIMEZONE GetTimeZone() const = 0;
+ virtual CFX_WideString GetEraName(bool bAD) const = 0;
+ virtual CFX_WideString GetDatePattern(
+ FX_LOCALEDATETIMESUBCATEGORY eType) const = 0;
+ virtual CFX_WideString GetTimePattern(
+ FX_LOCALEDATETIMESUBCATEGORY eType) const = 0;
+ virtual CFX_WideString GetNumPattern(FX_LOCALENUMSUBCATEGORY eType) const = 0;
+};
+
+#endif // CORE_FXCRT_IFX_LOCALE_H_
diff --git a/chromium/third_party/pdfium/core/fxcrt/xml/cfx_saxcontext.h b/chromium/third_party/pdfium/core/fxcrt/xml/cfx_saxcontext.h
new file mode 100644
index 00000000000..7afebed98d5
--- /dev/null
+++ b/chromium/third_party/pdfium/core/fxcrt/xml/cfx_saxcontext.h
@@ -0,0 +1,23 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef CORE_FXCRT_XML_CFX_SAXCONTEXT_H_
+#define CORE_FXCRT_XML_CFX_SAXCONTEXT_H_
+
+#include "core/fxcrt/fx_basic.h"
+#include "core/fxcrt/fx_string.h"
+#include "core/fxcrt/xml/cfx_saxreader.h"
+
+class CFX_SAXContext {
+ public:
+ CFX_SAXContext() : m_eNode(CFX_SAXItem::Type::Unknown) {}
+
+ CFX_ByteTextBuf m_TextBuf;
+ CFX_ByteString m_bsTagName;
+ CFX_SAXItem::Type m_eNode;
+};
+
+#endif // CORE_FXCRT_XML_CFX_SAXCONTEXT_H_
diff --git a/chromium/third_party/pdfium/core/fxcrt/xml/cfx_saxreader.cpp b/chromium/third_party/pdfium/core/fxcrt/xml/cfx_saxreader.cpp
new file mode 100644
index 00000000000..c571e8be96a
--- /dev/null
+++ b/chromium/third_party/pdfium/core/fxcrt/xml/cfx_saxreader.cpp
@@ -0,0 +1,729 @@
+// 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
+
+#include "core/fxcrt/xml/cfx_saxreader.h"
+
+#include <algorithm>
+#include <utility>
+
+#include "core/fxcrt/xml/cfx_saxreaderhandler.h"
+#include "third_party/base/ptr_util.h"
+#include "third_party/base/stl_util.h"
+
+enum class CFX_SaxMode {
+ Text = 0,
+ NodeStart,
+ DeclOrComment,
+ DeclNode,
+ Comment,
+ CommentContent,
+ TagName,
+ TagAttributeName,
+ TagAttributeEqual,
+ TagAttributeValue,
+ TagMaybeClose,
+ TagClose,
+ TagEnd,
+ TargetData,
+ MAX
+};
+
+class CFX_SAXCommentContext {
+ public:
+ CFX_SAXCommentContext() : m_iHeaderCount(0), m_iTailCount(0) {}
+ int32_t m_iHeaderCount;
+ int32_t m_iTailCount;
+};
+
+namespace {
+
+const uint32_t kSaxFileBufSize = 32768;
+
+typedef void (CFX_SAXReader::*FX_SAXReader_LPFParse)();
+static const FX_SAXReader_LPFParse
+ g_FX_SAXReader_LPFParse[static_cast<int>(CFX_SaxMode::MAX)] = {
+ &CFX_SAXReader::ParseText,
+ &CFX_SAXReader::ParseNodeStart,
+ &CFX_SAXReader::ParseDeclOrComment,
+ &CFX_SAXReader::ParseDeclNode,
+ &CFX_SAXReader::ParseComment,
+ &CFX_SAXReader::ParseCommentContent,
+ &CFX_SAXReader::ParseTagName,
+ &CFX_SAXReader::ParseTagAttributeName,
+ &CFX_SAXReader::ParseTagAttributeEqual,
+ &CFX_SAXReader::ParseTagAttributeValue,
+ &CFX_SAXReader::ParseMaybeClose,
+ &CFX_SAXReader::ParseTagClose,
+ &CFX_SAXReader::ParseTagEnd,
+ &CFX_SAXReader::ParseTargetData,
+};
+
+} // namespace
+
+CFX_SAXFile::CFX_SAXFile()
+ : m_dwStart(0),
+ m_dwEnd(0),
+ m_dwCur(0),
+ m_pBuf(nullptr),
+ m_dwBufSize(0),
+ m_dwBufIndex(0) {}
+
+CFX_SAXFile::~CFX_SAXFile() {}
+
+bool CFX_SAXFile::StartFile(const CFX_RetainPtr<IFX_SeekableReadStream>& pFile,
+ uint32_t dwStart,
+ uint32_t dwLen) {
+ ASSERT(!m_pFile && pFile);
+ uint32_t dwSize = pFile->GetSize();
+ if (dwStart >= dwSize)
+ return false;
+
+ if (dwLen == static_cast<uint32_t>(-1) || dwStart + dwLen > dwSize)
+ dwLen = dwSize - dwStart;
+
+ if (dwLen == 0)
+ return false;
+
+ m_dwBufSize = std::min(dwLen, kSaxFileBufSize);
+ m_pBuf = FX_Alloc(uint8_t, m_dwBufSize);
+ if (!pFile->ReadBlock(m_pBuf, dwStart, m_dwBufSize))
+ return false;
+
+ m_dwStart = dwStart;
+ m_dwEnd = dwStart + dwLen;
+ m_dwCur = dwStart;
+ m_pFile = pFile;
+ m_dwBufIndex = 0;
+ return true;
+}
+
+bool CFX_SAXFile::ReadNextBlock() {
+ ASSERT(m_pFile);
+ uint32_t dwSize = m_dwEnd - m_dwCur;
+ if (dwSize == 0) {
+ return false;
+ }
+ m_dwBufSize = std::min(dwSize, kSaxFileBufSize);
+ if (!m_pFile->ReadBlock(m_pBuf, m_dwCur, m_dwBufSize)) {
+ return false;
+ }
+ m_dwBufIndex = 0;
+ return true;
+}
+
+void CFX_SAXFile::Reset() {
+ if (m_pBuf) {
+ FX_Free(m_pBuf);
+ m_pBuf = nullptr;
+ }
+ m_pFile = nullptr;
+}
+
+CFX_SAXReader::CFX_SAXReader()
+ : m_File(),
+ m_pHandler(nullptr),
+ m_iState(-1),
+ m_dwItemID(0),
+ m_iDataSize(256),
+ m_iNameSize(256),
+ m_dwParseMode(0),
+ m_pCommentContext(nullptr) {
+ m_pszData = FX_Alloc(uint8_t, m_iDataSize);
+ m_pszName = FX_Alloc(uint8_t, m_iNameSize);
+}
+CFX_SAXReader::~CFX_SAXReader() {
+ Reset();
+ if (m_pszData) {
+ FX_Free(m_pszData);
+ m_pszData = nullptr;
+ }
+ if (m_pszName) {
+ FX_Free(m_pszName);
+ m_pszName = nullptr;
+ }
+}
+
+void CFX_SAXReader::Reset() {
+ m_File.Reset();
+ m_Stack = std::stack<std::unique_ptr<CFX_SAXItem>>();
+ m_dwItemID = 0;
+ m_SkipStack = std::stack<char>();
+ m_SkipChar = 0;
+ m_iDataLength = 0;
+ m_iEntityStart = -1;
+ m_iNameLength = 0;
+ m_iDataPos = 0;
+ m_pCommentContext.reset();
+}
+
+void CFX_SAXReader::Push() {
+ std::unique_ptr<CFX_SAXItem> pNew =
+ pdfium::MakeUnique<CFX_SAXItem>(++m_dwItemID);
+ if (!m_Stack.empty())
+ pNew->m_bSkip = m_Stack.top()->m_bSkip;
+ m_Stack.push(std::move(pNew));
+}
+
+void CFX_SAXReader::Pop() {
+ if (!m_Stack.empty())
+ m_Stack.pop();
+}
+
+CFX_SAXItem* CFX_SAXReader::GetCurrentItem() const {
+ return m_Stack.empty() ? nullptr : m_Stack.top().get();
+}
+
+void CFX_SAXReader::AppendData(uint8_t ch) {
+ ReallocDataBuffer();
+ m_pszData[m_iDataPos++] = ch;
+}
+
+void CFX_SAXReader::AppendName(uint8_t ch) {
+ ReallocNameBuffer();
+ m_pszName[m_iDataPos++] = ch;
+}
+
+void CFX_SAXReader::ReallocDataBuffer() {
+ if (m_iDataPos < m_iDataSize) {
+ return;
+ }
+ if (m_iDataSize <= 1024 * 1024) {
+ m_iDataSize *= 2;
+ } else {
+ m_iDataSize += 1024 * 1024;
+ }
+ m_pszData = (uint8_t*)FX_Realloc(uint8_t, m_pszData, m_iDataSize);
+}
+
+void CFX_SAXReader::ReallocNameBuffer() {
+ if (m_iDataPos < m_iNameSize) {
+ return;
+ }
+ if (m_iNameSize <= 1024 * 1024) {
+ m_iNameSize *= 2;
+ } else {
+ m_iNameSize += 1024 * 1024;
+ }
+ m_pszName = (uint8_t*)FX_Realloc(uint8_t, m_pszName, m_iNameSize);
+}
+
+bool CFX_SAXReader::SkipSpace(uint8_t ch) {
+ return (m_dwParseMode & CFX_SaxParseMode_NotSkipSpace) == 0 && ch < 0x21;
+}
+
+int32_t CFX_SAXReader::StartParse(
+ const CFX_RetainPtr<IFX_SeekableReadStream>& pFile,
+ uint32_t dwStart,
+ uint32_t dwLen,
+ uint32_t dwParseMode) {
+ m_iState = -1;
+ Reset();
+ if (!m_File.StartFile(pFile, dwStart, dwLen))
+ return -1;
+
+ m_iState = 0;
+ m_eMode = CFX_SaxMode::Text;
+ m_ePrevMode = CFX_SaxMode::Text;
+ m_bCharData = false;
+ m_dwDataOffset = 0;
+ m_dwParseMode = dwParseMode;
+ m_Stack.emplace(new CFX_SAXItem(++m_dwItemID));
+ return 0;
+}
+
+int32_t CFX_SAXReader::ContinueParse(IFX_Pause* pPause) {
+ if (m_iState < 0 || m_iState > 99) {
+ return m_iState;
+ }
+ while (m_File.m_dwCur < m_File.m_dwEnd) {
+ uint32_t& index = m_File.m_dwBufIndex;
+ uint32_t size = m_File.m_dwBufSize;
+ const uint8_t* pBuf = m_File.m_pBuf;
+ while (index < size) {
+ m_CurByte = pBuf[index];
+ (this->*g_FX_SAXReader_LPFParse[static_cast<int>(m_eMode)])();
+ index++;
+ }
+ m_File.m_dwCur += index;
+ m_iState = (m_File.m_dwCur - m_File.m_dwStart) * 100 /
+ (m_File.m_dwEnd - m_File.m_dwStart);
+ if (m_File.m_dwCur >= m_File.m_dwEnd) {
+ break;
+ }
+ if (!m_File.ReadNextBlock()) {
+ m_iState = -2;
+ break;
+ }
+ m_dwDataOffset = 0;
+ if (pPause && pPause->NeedToPauseNow()) {
+ break;
+ }
+ }
+ return m_iState;
+}
+void CFX_SAXReader::ParseChar(uint8_t ch) {
+ ReallocDataBuffer();
+ m_pszData[m_iDataPos] = ch;
+ if (m_iEntityStart > -1 && ch == ';') {
+ int32_t iSaveEntityStart = m_iEntityStart;
+ CFX_ByteString csEntity(m_pszData + m_iEntityStart + 1,
+ m_iDataPos - m_iEntityStart - 1);
+ int32_t iLen = csEntity.GetLength();
+ if (iLen > 0) {
+ if (csEntity[0] == '#') {
+ if ((m_dwParseMode & CFX_SaxParseMode_NotConvert_sharp) == 0) {
+ ch = 0;
+ uint8_t w;
+ if (iLen > 1 && csEntity[1] == 'x') {
+ for (int32_t i = 2; i < iLen; i++) {
+ w = csEntity[i];
+ if (w >= '0' && w <= '9') {
+ ch = (ch << 4) + w - '0';
+ } else if (w >= 'A' && w <= 'F') {
+ ch = (ch << 4) + w - 55;
+ } else if (w >= 'a' && w <= 'f') {
+ ch = (ch << 4) + w - 87;
+ } else {
+ break;
+ }
+ }
+ } else {
+ for (int32_t i = 1; i < iLen; i++) {
+ w = csEntity[i];
+ if (w < '0' || w > '9') {
+ break;
+ }
+ ch = ch * 10 + w - '0';
+ }
+ }
+ if (ch != 0) {
+ m_pszData[m_iEntityStart++] = ch;
+ }
+ }
+ } else {
+ if (csEntity.Compare("amp") == 0) {
+ if ((m_dwParseMode & CFX_SaxParseMode_NotConvert_amp) == 0) {
+ m_pszData[m_iEntityStart++] = '&';
+ }
+ } else if (csEntity.Compare("lt") == 0) {
+ if ((m_dwParseMode & CFX_SaxParseMode_NotConvert_lt) == 0) {
+ m_pszData[m_iEntityStart++] = '<';
+ }
+ } else if (csEntity.Compare("gt") == 0) {
+ if ((m_dwParseMode & CFX_SaxParseMode_NotConvert_gt) == 0) {
+ m_pszData[m_iEntityStart++] = '>';
+ }
+ } else if (csEntity.Compare("apos") == 0) {
+ if ((m_dwParseMode & CFX_SaxParseMode_NotConvert_apos) == 0) {
+ m_pszData[m_iEntityStart++] = '\'';
+ }
+ } else if (csEntity.Compare("quot") == 0) {
+ if ((m_dwParseMode & CFX_SaxParseMode_NotConvert_quot) == 0) {
+ m_pszData[m_iEntityStart++] = '\"';
+ }
+ }
+ }
+ }
+ if (iSaveEntityStart != m_iEntityStart) {
+ m_iDataPos = m_iEntityStart;
+ m_iEntityStart = -1;
+ } else {
+ m_iDataPos++;
+ m_iEntityStart = -1;
+ }
+ } else {
+ if (m_iEntityStart < 0 && ch == '&') {
+ m_iEntityStart = m_iDataPos;
+ }
+ m_iDataPos++;
+ }
+}
+
+void CFX_SAXReader::ParseText() {
+ if (m_CurByte == '<') {
+ if (m_iDataPos > 0) {
+ m_iDataLength = m_iDataPos;
+ m_iDataPos = 0;
+ if (m_pHandler) {
+ NotifyData();
+ }
+ }
+ Push();
+ m_dwNodePos = m_File.m_dwCur + m_File.m_dwBufIndex;
+ m_eMode = CFX_SaxMode::NodeStart;
+ return;
+ }
+ if (m_iDataPos < 1 && SkipSpace(m_CurByte)) {
+ return;
+ }
+ ParseChar(m_CurByte);
+}
+
+void CFX_SAXReader::ParseNodeStart() {
+ if (m_CurByte == '?') {
+ GetCurrentItem()->m_eNode = CFX_SAXItem::Type::Instruction;
+ m_eMode = CFX_SaxMode::TagName;
+ return;
+ }
+ if (m_CurByte == '!') {
+ m_eMode = CFX_SaxMode::DeclOrComment;
+ return;
+ }
+ if (m_CurByte == '/') {
+ m_eMode = CFX_SaxMode::TagEnd;
+ return;
+ }
+ if (m_CurByte == '>') {
+ Pop();
+ m_eMode = CFX_SaxMode::Text;
+ return;
+ }
+ if (m_CurByte > 0x20) {
+ m_dwDataOffset = m_File.m_dwBufIndex;
+ GetCurrentItem()->m_eNode = CFX_SAXItem::Type::Tag;
+ m_eMode = CFX_SaxMode::TagName;
+ AppendData(m_CurByte);
+ }
+}
+
+void CFX_SAXReader::ParseDeclOrComment() {
+ if (m_CurByte == '-') {
+ m_eMode = CFX_SaxMode::Comment;
+ GetCurrentItem()->m_eNode = CFX_SAXItem::Type::Comment;
+ if (!m_pCommentContext)
+ m_pCommentContext = pdfium::MakeUnique<CFX_SAXCommentContext>();
+ m_pCommentContext->m_iHeaderCount = 1;
+ m_pCommentContext->m_iTailCount = 0;
+ return;
+ }
+ m_eMode = CFX_SaxMode::DeclNode;
+ m_dwDataOffset = m_File.m_dwBufIndex;
+ m_SkipChar = '>';
+ m_SkipStack.push('>');
+ SkipNode();
+}
+
+void CFX_SAXReader::ParseComment() {
+ m_pCommentContext->m_iHeaderCount = 2;
+ m_dwNodePos = m_File.m_dwCur + m_File.m_dwBufIndex;
+ m_eMode = CFX_SaxMode::CommentContent;
+}
+
+void CFX_SAXReader::ParseCommentContent() {
+ if (m_CurByte == '-') {
+ m_pCommentContext->m_iTailCount++;
+ } else if (m_CurByte == '>' && m_pCommentContext->m_iTailCount == 2) {
+ m_iDataLength = m_iDataPos;
+ m_iDataPos = 0;
+ if (m_pHandler) {
+ NotifyTargetData();
+ }
+ Pop();
+ m_eMode = CFX_SaxMode::Text;
+ } else {
+ while (m_pCommentContext->m_iTailCount > 0) {
+ AppendData('-');
+ m_pCommentContext->m_iTailCount--;
+ }
+ AppendData(m_CurByte);
+ }
+}
+void CFX_SAXReader::ParseDeclNode() {
+ SkipNode();
+}
+void CFX_SAXReader::ParseTagName() {
+ if (m_CurByte < 0x21 || m_CurByte == '/' || m_CurByte == '>' ||
+ m_CurByte == '?') {
+ m_iDataLength = m_iDataPos;
+ m_iDataPos = 0;
+ if (m_pHandler) {
+ NotifyEnter();
+ }
+ if (m_CurByte < 0x21) {
+ m_eMode = CFX_SaxMode::TagAttributeName;
+ } else if (m_CurByte == '/' || m_CurByte == '?') {
+ m_ePrevMode = m_eMode;
+ m_eMode = CFX_SaxMode::TagMaybeClose;
+ } else {
+ if (m_pHandler) {
+ NotifyBreak();
+ }
+ m_eMode = CFX_SaxMode::Text;
+ }
+ } else {
+ AppendData(m_CurByte);
+ }
+}
+void CFX_SAXReader::ParseTagAttributeName() {
+ if (m_CurByte < 0x21 || m_CurByte == '=') {
+ if (m_iDataPos < 1 && m_CurByte < 0x21) {
+ return;
+ }
+ m_iNameLength = m_iDataPos;
+ m_iDataPos = 0;
+ m_SkipChar = 0;
+ m_eMode = m_CurByte == '=' ? CFX_SaxMode::TagAttributeValue
+ : CFX_SaxMode::TagAttributeEqual;
+ return;
+ }
+ if (m_CurByte == '/' || m_CurByte == '>' || m_CurByte == '?') {
+ if (m_CurByte == '/' || m_CurByte == '?') {
+ m_ePrevMode = m_eMode;
+ m_eMode = CFX_SaxMode::TagMaybeClose;
+ } else {
+ if (m_pHandler) {
+ NotifyBreak();
+ }
+ m_eMode = CFX_SaxMode::Text;
+ }
+ return;
+ }
+ if (m_iDataPos < 1) {
+ m_dwDataOffset = m_File.m_dwBufIndex;
+ }
+ AppendName(m_CurByte);
+}
+
+void CFX_SAXReader::ParseTagAttributeEqual() {
+ if (m_CurByte == '=') {
+ m_SkipChar = 0;
+ m_eMode = CFX_SaxMode::TagAttributeValue;
+ return;
+ }
+ if (GetCurrentItem()->m_eNode == CFX_SAXItem::Type::Instruction) {
+ m_iDataPos = m_iNameLength;
+ AppendName(0x20);
+ m_eMode = CFX_SaxMode::TargetData;
+ ParseTargetData();
+ }
+}
+
+void CFX_SAXReader::ParseTagAttributeValue() {
+ if (m_SkipChar) {
+ if (m_SkipChar == m_CurByte) {
+ {
+ m_iDataLength = m_iDataPos;
+ m_iDataPos = 0;
+ if (m_pHandler) {
+ NotifyAttribute();
+ }
+ }
+ m_SkipChar = 0;
+ m_eMode = CFX_SaxMode::TagAttributeName;
+ return;
+ }
+ ParseChar(m_CurByte);
+ return;
+ }
+ if (m_CurByte < 0x21) {
+ return;
+ }
+ if (m_iDataPos < 1) {
+ if (m_CurByte == '\'' || m_CurByte == '\"') {
+ m_SkipChar = m_CurByte;
+ }
+ }
+}
+
+void CFX_SAXReader::ParseMaybeClose() {
+ if (m_CurByte == '>') {
+ if (GetCurrentItem()->m_eNode == CFX_SAXItem::Type::Instruction) {
+ m_iNameLength = m_iDataPos;
+ m_iDataPos = 0;
+ if (m_pHandler) {
+ NotifyTargetData();
+ }
+ }
+ ParseTagClose();
+ m_eMode = CFX_SaxMode::Text;
+ } else if (m_ePrevMode == CFX_SaxMode::TagName) {
+ AppendData('/');
+ m_eMode = CFX_SaxMode::TagName;
+ m_ePrevMode = CFX_SaxMode::Text;
+ ParseTagName();
+ } else if (m_ePrevMode == CFX_SaxMode::TagAttributeName) {
+ AppendName('/');
+ m_eMode = CFX_SaxMode::TagAttributeName;
+ m_ePrevMode = CFX_SaxMode::Text;
+ ParseTagAttributeName();
+ } else if (m_ePrevMode == CFX_SaxMode::TargetData) {
+ AppendName('?');
+ m_eMode = CFX_SaxMode::TargetData;
+ m_ePrevMode = CFX_SaxMode::Text;
+ ParseTargetData();
+ }
+}
+void CFX_SAXReader::ParseTagClose() {
+ m_dwNodePos = m_File.m_dwCur + m_File.m_dwBufIndex;
+ if (m_pHandler) {
+ NotifyClose();
+ }
+ Pop();
+}
+void CFX_SAXReader::ParseTagEnd() {
+ if (m_CurByte < 0x21) {
+ return;
+ }
+ if (m_CurByte == '>') {
+ Pop();
+ m_dwNodePos = m_File.m_dwCur + m_File.m_dwBufIndex;
+ m_iDataLength = m_iDataPos;
+ m_iDataPos = 0;
+ if (m_pHandler) {
+ NotifyEnd();
+ }
+ Pop();
+ m_eMode = CFX_SaxMode::Text;
+ } else {
+ ParseChar(m_CurByte);
+ }
+}
+void CFX_SAXReader::ParseTargetData() {
+ if (m_CurByte == '?') {
+ m_ePrevMode = m_eMode;
+ m_eMode = CFX_SaxMode::TagMaybeClose;
+ } else {
+ AppendName(m_CurByte);
+ }
+}
+void CFX_SAXReader::SkipNode() {
+ if (m_SkipChar == '\'' || m_SkipChar == '\"') {
+ if (m_CurByte != m_SkipChar)
+ return;
+
+ ASSERT(!m_SkipStack.empty());
+ m_SkipStack.pop();
+ m_SkipChar = !m_SkipStack.empty() ? m_SkipStack.top() : 0;
+ return;
+ }
+ switch (m_CurByte) {
+ case '<':
+ m_SkipChar = '>';
+ m_SkipStack.push('>');
+ break;
+ case '[':
+ m_SkipChar = ']';
+ m_SkipStack.push(']');
+ break;
+ case '(':
+ m_SkipChar = ')';
+ m_SkipStack.push(')');
+ break;
+ case '\'':
+ m_SkipChar = '\'';
+ m_SkipStack.push('\'');
+ break;
+ case '\"':
+ m_SkipChar = '\"';
+ m_SkipStack.push('\"');
+ break;
+ default:
+ if (m_CurByte == m_SkipChar) {
+ m_SkipStack.pop();
+ m_SkipChar = !m_SkipStack.empty() ? m_SkipStack.top() : 0;
+ if (m_SkipStack.empty() && m_CurByte == '>') {
+ m_iDataLength = m_iDataPos;
+ m_iDataPos = 0;
+ if (m_iDataLength >= 9 &&
+ memcmp(m_pszData, "[CDATA[", 7 * sizeof(uint8_t)) == 0 &&
+ memcmp(m_pszData + m_iDataLength - 2, "]]",
+ 2 * sizeof(uint8_t)) == 0) {
+ Pop();
+ m_iDataLength -= 9;
+ m_dwDataOffset += 7;
+ memmove(m_pszData, m_pszData + 7, m_iDataLength * sizeof(uint8_t));
+ m_bCharData = true;
+ if (m_pHandler) {
+ NotifyData();
+ }
+ m_bCharData = false;
+ } else {
+ Pop();
+ }
+ m_eMode = CFX_SaxMode::Text;
+ }
+ }
+ break;
+ }
+ if (!m_SkipStack.empty())
+ ParseChar(m_CurByte);
+}
+
+void CFX_SAXReader::NotifyData() {
+ CFX_SAXItem* pItem = GetCurrentItem();
+ if (!pItem)
+ return;
+
+ if (pItem->m_eNode == CFX_SAXItem::Type::Tag)
+ m_pHandler->OnTagData(
+ pItem->m_pNode,
+ m_bCharData ? CFX_SAXItem::Type::CharData : CFX_SAXItem::Type::Text,
+ CFX_ByteStringC(m_pszData, m_iDataLength),
+ m_File.m_dwCur + m_dwDataOffset);
+}
+
+void CFX_SAXReader::NotifyEnter() {
+ CFX_SAXItem* pItem = GetCurrentItem();
+ if (pItem->m_eNode == CFX_SAXItem::Type::Tag ||
+ pItem->m_eNode == CFX_SAXItem::Type::Instruction) {
+ pItem->m_pNode = m_pHandler->OnTagEnter(
+ CFX_ByteStringC(m_pszData, m_iDataLength), pItem->m_eNode, m_dwNodePos);
+ }
+}
+
+void CFX_SAXReader::NotifyAttribute() {
+ CFX_SAXItem* pItem = GetCurrentItem();
+ if (pItem->m_eNode == CFX_SAXItem::Type::Tag ||
+ pItem->m_eNode == CFX_SAXItem::Type::Instruction) {
+ m_pHandler->OnTagAttribute(pItem->m_pNode,
+ CFX_ByteStringC(m_pszName, m_iNameLength),
+ CFX_ByteStringC(m_pszData, m_iDataLength));
+ }
+}
+
+void CFX_SAXReader::NotifyBreak() {
+ CFX_SAXItem* pItem = GetCurrentItem();
+ if (pItem->m_eNode == CFX_SAXItem::Type::Tag)
+ m_pHandler->OnTagBreak(pItem->m_pNode);
+}
+
+void CFX_SAXReader::NotifyClose() {
+ CFX_SAXItem* pItem = GetCurrentItem();
+ if (pItem->m_eNode == CFX_SAXItem::Type::Tag ||
+ pItem->m_eNode == CFX_SAXItem::Type::Instruction) {
+ m_pHandler->OnTagClose(pItem->m_pNode, m_dwNodePos);
+ }
+}
+
+void CFX_SAXReader::NotifyEnd() {
+ CFX_SAXItem* pItem = GetCurrentItem();
+ if (!pItem || pItem->m_eNode != CFX_SAXItem::Type::Tag)
+ return;
+
+ m_pHandler->OnTagEnd(pItem->m_pNode,
+ CFX_ByteStringC(m_pszData, m_iDataLength), m_dwNodePos);
+}
+
+void CFX_SAXReader::NotifyTargetData() {
+ CFX_SAXItem* pItem = GetCurrentItem();
+ if (pItem->m_eNode == CFX_SAXItem::Type::Instruction) {
+ m_pHandler->OnTargetData(pItem->m_pNode, pItem->m_eNode,
+ CFX_ByteStringC(m_pszName, m_iNameLength),
+ m_dwNodePos);
+ } else if (pItem->m_eNode == CFX_SAXItem::Type::Comment) {
+ m_pHandler->OnTargetData(pItem->m_pNode, pItem->m_eNode,
+ CFX_ByteStringC(m_pszData, m_iDataLength),
+ m_dwNodePos);
+ }
+}
+
+void CFX_SAXReader::SkipCurrentNode() {
+ CFX_SAXItem* pItem = GetCurrentItem();
+ if (!pItem)
+ return;
+
+ pItem->m_bSkip = true;
+}
diff --git a/chromium/third_party/pdfium/core/fxcrt/xml/cfx_saxreader.h b/chromium/third_party/pdfium/core/fxcrt/xml/cfx_saxreader.h
new file mode 100644
index 00000000000..af3c26f94aa
--- /dev/null
+++ b/chromium/third_party/pdfium/core/fxcrt/xml/cfx_saxreader.h
@@ -0,0 +1,144 @@
+// 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_FXCRT_XML_CFX_SAXREADER_H_
+#define CORE_FXCRT_XML_CFX_SAXREADER_H_
+
+#include <memory>
+#include <stack>
+
+#include "core/fxcrt/fx_basic.h"
+
+class CFX_SAXCommentContext;
+class CFX_SAXContext;
+class CFX_SAXReaderHandler;
+enum class CFX_SaxMode;
+
+class CFX_SAXItem {
+ public:
+ enum class Type {
+ Unknown = 0,
+ Instruction,
+ Declaration,
+ Comment,
+ Tag,
+ Text,
+ CharData,
+ };
+
+ explicit CFX_SAXItem(uint32_t id)
+ : m_pNode(nullptr), m_eNode(Type::Unknown), m_dwID(id), m_bSkip(false) {}
+
+ CFX_SAXContext* m_pNode;
+ Type m_eNode;
+ const uint32_t m_dwID;
+ bool m_bSkip;
+};
+
+class CFX_SAXFile {
+ public:
+ CFX_SAXFile();
+ ~CFX_SAXFile();
+
+ bool StartFile(const CFX_RetainPtr<IFX_SeekableReadStream>& pFile,
+ uint32_t dwStart,
+ uint32_t dwLen);
+ bool ReadNextBlock();
+ void Reset();
+
+ CFX_RetainPtr<IFX_SeekableReadStream> m_pFile;
+ uint32_t m_dwStart;
+ uint32_t m_dwEnd;
+ uint32_t m_dwCur;
+ uint8_t* m_pBuf;
+ uint32_t m_dwBufSize;
+ uint32_t m_dwBufIndex;
+};
+
+enum CFX_SaxParseMode {
+ CFX_SaxParseMode_NotConvert_amp = 1 << 0,
+ CFX_SaxParseMode_NotConvert_lt = 1 << 1,
+ CFX_SaxParseMode_NotConvert_gt = 1 << 2,
+ CFX_SaxParseMode_NotConvert_apos = 1 << 3,
+ CFX_SaxParseMode_NotConvert_quot = 1 << 4,
+ CFX_SaxParseMode_NotConvert_sharp = 1 << 5,
+ CFX_SaxParseMode_NotSkipSpace = 1 << 6
+};
+
+class CFX_SAXReader {
+ public:
+ CFX_SAXReader();
+ ~CFX_SAXReader();
+
+ int32_t StartParse(const CFX_RetainPtr<IFX_SeekableReadStream>& pFile,
+ uint32_t dwStart = 0,
+ uint32_t dwLen = -1,
+ uint32_t dwParseMode = 0);
+ int32_t ContinueParse(IFX_Pause* pPause = nullptr);
+ void SkipCurrentNode();
+ void SetHandler(CFX_SAXReaderHandler* pHandler) { m_pHandler = pHandler; }
+ void AppendData(uint8_t ch);
+ void AppendName(uint8_t ch);
+ void ParseText();
+ void ParseNodeStart();
+ void ParseInstruction();
+ void ParseDeclOrComment();
+ void ParseDeclNode();
+ void ParseComment();
+ void ParseCommentContent();
+ void ParseTagName();
+ void ParseTagAttributeName();
+ void ParseTagAttributeEqual();
+ void ParseTagAttributeValue();
+ void ParseMaybeClose();
+ void ParseTagClose();
+ void ParseTagEnd();
+ void ParseTargetData();
+
+ private:
+ void Reset();
+ void Push();
+ void Pop();
+ CFX_SAXItem* GetCurrentItem() const;
+ bool SkipSpace(uint8_t ch);
+ void SkipNode();
+ void NotifyData();
+ void NotifyEnter();
+ void NotifyAttribute();
+ void NotifyBreak();
+ void NotifyClose();
+ void NotifyEnd();
+ void NotifyTargetData();
+ void ReallocDataBuffer();
+ void ReallocNameBuffer();
+ void ParseChar(uint8_t ch);
+
+ CFX_SAXFile m_File;
+ CFX_SAXReaderHandler* m_pHandler;
+ int32_t m_iState;
+ std::stack<std::unique_ptr<CFX_SAXItem>> m_Stack;
+ uint32_t m_dwItemID;
+ CFX_SaxMode m_eMode;
+ CFX_SaxMode m_ePrevMode;
+ bool m_bCharData;
+ uint8_t m_CurByte;
+ uint32_t m_dwDataOffset;
+ std::stack<char> m_SkipStack;
+ uint8_t m_SkipChar;
+ uint32_t m_dwNodePos;
+ uint8_t* m_pszData;
+ int32_t m_iDataSize;
+ int32_t m_iDataLength;
+ int32_t m_iEntityStart;
+ int32_t m_iDataPos;
+ uint8_t* m_pszName;
+ int32_t m_iNameSize;
+ int32_t m_iNameLength;
+ uint32_t m_dwParseMode;
+ std::unique_ptr<CFX_SAXCommentContext> m_pCommentContext;
+};
+
+#endif // CORE_FXCRT_XML_CFX_SAXREADER_H_
diff --git a/chromium/third_party/pdfium/core/fxcrt/xml/cfx_saxreaderhandler.cpp b/chromium/third_party/pdfium/core/fxcrt/xml/cfx_saxreaderhandler.cpp
new file mode 100644
index 00000000000..e7b6cd186c4
--- /dev/null
+++ b/chromium/third_party/pdfium/core/fxcrt/xml/cfx_saxreaderhandler.cpp
@@ -0,0 +1,128 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "core/fxcrt/xml/cfx_saxreaderhandler.h"
+
+#include "core/fxcrt/cfx_checksumcontext.h"
+
+CFX_SAXReaderHandler::CFX_SAXReaderHandler(CFX_ChecksumContext* pContext)
+ : m_pContext(pContext) {
+ ASSERT(m_pContext);
+}
+
+CFX_SAXReaderHandler::~CFX_SAXReaderHandler() {}
+
+CFX_SAXContext* CFX_SAXReaderHandler::OnTagEnter(
+ const CFX_ByteStringC& bsTagName,
+ CFX_SAXItem::Type eType,
+ uint32_t dwStartPos) {
+ UpdateChecksum(true);
+ if (eType != CFX_SAXItem::Type::Tag &&
+ eType != CFX_SAXItem::Type::Instruction) {
+ return nullptr;
+ }
+
+ m_SAXContext.m_eNode = eType;
+ CFX_ByteTextBuf& textBuf = m_SAXContext.m_TextBuf;
+ textBuf << "<";
+ if (eType == CFX_SAXItem::Type::Instruction)
+ textBuf << "?";
+
+ textBuf << bsTagName;
+ m_SAXContext.m_bsTagName = bsTagName;
+ return &m_SAXContext;
+}
+
+void CFX_SAXReaderHandler::OnTagAttribute(CFX_SAXContext* pTag,
+ const CFX_ByteStringC& bsAttri,
+ const CFX_ByteStringC& bsValue) {
+ if (!pTag)
+ return;
+ pTag->m_TextBuf << " " << bsAttri << "=\"" << bsValue << "\"";
+}
+
+void CFX_SAXReaderHandler::OnTagBreak(CFX_SAXContext* pTag) {
+ if (!pTag)
+ return;
+
+ pTag->m_TextBuf << ">";
+ UpdateChecksum(false);
+}
+
+void CFX_SAXReaderHandler::OnTagData(CFX_SAXContext* pTag,
+ CFX_SAXItem::Type eType,
+ const CFX_ByteStringC& bsData,
+ uint32_t dwStartPos) {
+ if (!pTag)
+ return;
+
+ CFX_ByteTextBuf& textBuf = pTag->m_TextBuf;
+ if (eType == CFX_SAXItem::Type::CharData)
+ textBuf << "<![CDATA[";
+
+ textBuf << bsData;
+ if (eType == CFX_SAXItem::Type::CharData)
+ textBuf << "]]>";
+}
+
+void CFX_SAXReaderHandler::OnTagClose(CFX_SAXContext* pTag, uint32_t dwEndPos) {
+ if (!pTag)
+ return;
+
+ CFX_ByteTextBuf& textBuf = pTag->m_TextBuf;
+ if (pTag->m_eNode == CFX_SAXItem::Type::Instruction)
+ textBuf << "?>";
+ else if (pTag->m_eNode == CFX_SAXItem::Type::Tag)
+ textBuf << "></" << pTag->m_bsTagName.AsStringC() << ">";
+
+ UpdateChecksum(false);
+}
+
+void CFX_SAXReaderHandler::OnTagEnd(CFX_SAXContext* pTag,
+ const CFX_ByteStringC& bsTagName,
+ uint32_t dwEndPos) {
+ if (!pTag)
+ return;
+
+ pTag->m_TextBuf << "</" << bsTagName << ">";
+ UpdateChecksum(false);
+}
+
+void CFX_SAXReaderHandler::OnTargetData(CFX_SAXContext* pTag,
+ CFX_SAXItem::Type eType,
+ const CFX_ByteStringC& bsData,
+ uint32_t dwStartPos) {
+ if (!pTag && eType != CFX_SAXItem::Type::Comment)
+ return;
+
+ if (eType == CFX_SAXItem::Type::Comment) {
+ m_SAXContext.m_TextBuf << "<!--" << bsData << "-->";
+ UpdateChecksum(false);
+ } else {
+ pTag->m_TextBuf << " " << bsData;
+ }
+}
+
+void CFX_SAXReaderHandler::UpdateChecksum(bool bCheckSpace) {
+ int32_t iLength = m_SAXContext.m_TextBuf.GetLength();
+ if (iLength < 1)
+ return;
+
+ uint8_t* pBuffer = m_SAXContext.m_TextBuf.GetBuffer();
+ bool bUpdata = true;
+ if (bCheckSpace) {
+ bUpdata = false;
+ for (int32_t i = 0; i < iLength; i++) {
+ bUpdata = (pBuffer[i] > 0x20);
+ if (bUpdata)
+ break;
+ }
+ }
+ if (bUpdata)
+ m_pContext->Update(CFX_ByteStringC(pBuffer, iLength));
+
+ m_SAXContext.m_TextBuf.Clear();
+}
diff --git a/chromium/third_party/pdfium/core/fxcrt/xml/cfx_saxreaderhandler.h b/chromium/third_party/pdfium/core/fxcrt/xml/cfx_saxreaderhandler.h
new file mode 100644
index 00000000000..bfedf038463
--- /dev/null
+++ b/chromium/third_party/pdfium/core/fxcrt/xml/cfx_saxreaderhandler.h
@@ -0,0 +1,49 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef CORE_FXCRT_XML_CFX_SAXREADERHANDLER_H_
+#define CORE_FXCRT_XML_CFX_SAXREADERHANDLER_H_
+
+#include "core/fxcrt/fx_string.h"
+#include "core/fxcrt/xml/cfx_saxcontext.h"
+#include "core/fxcrt/xml/cfx_saxreader.h"
+
+class CFX_ChecksumContext;
+
+class CFX_SAXReaderHandler {
+ public:
+ explicit CFX_SAXReaderHandler(CFX_ChecksumContext* pContext);
+ ~CFX_SAXReaderHandler();
+
+ CFX_SAXContext* OnTagEnter(const CFX_ByteStringC& bsTagName,
+ CFX_SAXItem::Type eType,
+ uint32_t dwStartPos);
+ void OnTagAttribute(CFX_SAXContext* pTag,
+ const CFX_ByteStringC& bsAttri,
+ const CFX_ByteStringC& bsValue);
+ void OnTagBreak(CFX_SAXContext* pTag);
+ void OnTagData(CFX_SAXContext* pTag,
+ CFX_SAXItem::Type eType,
+ const CFX_ByteStringC& bsData,
+ uint32_t dwStartPos);
+ void OnTagClose(CFX_SAXContext* pTag, uint32_t dwEndPos);
+ void OnTagEnd(CFX_SAXContext* pTag,
+ const CFX_ByteStringC& bsTagName,
+ uint32_t dwEndPos);
+
+ void OnTargetData(CFX_SAXContext* pTag,
+ CFX_SAXItem::Type eType,
+ const CFX_ByteStringC& bsData,
+ uint32_t dwStartPos);
+
+ private:
+ void UpdateChecksum(bool bCheckSpace);
+
+ CFX_ChecksumContext* m_pContext;
+ CFX_SAXContext m_SAXContext;
+};
+
+#endif // CORE_FXCRT_XML_CFX_SAXREADERHANDLER_H_
diff --git a/chromium/third_party/pdfium/core/fxcrt/xml/cxml_attritem.cpp b/chromium/third_party/pdfium/core/fxcrt/xml/cxml_attritem.cpp
new file mode 100644
index 00000000000..8e55799a62d
--- /dev/null
+++ b/chromium/third_party/pdfium/core/fxcrt/xml/cxml_attritem.cpp
@@ -0,0 +1,12 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "core/fxcrt/xml/cxml_attritem.h"
+
+bool CXML_AttrItem::Matches(const CFX_ByteString& space,
+ const CFX_ByteString& name) const {
+ return (space.IsEmpty() || m_QSpaceName == space) && m_AttrName == name;
+}
diff --git a/chromium/third_party/pdfium/core/fxcrt/xml/cxml_attritem.h b/chromium/third_party/pdfium/core/fxcrt/xml/cxml_attritem.h
new file mode 100644
index 00000000000..63305e80c80
--- /dev/null
+++ b/chromium/third_party/pdfium/core/fxcrt/xml/cxml_attritem.h
@@ -0,0 +1,21 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef CORE_FXCRT_XML_CXML_ATTRITEM_H_
+#define CORE_FXCRT_XML_CXML_ATTRITEM_H_
+
+#include "core/fxcrt/fx_string.h"
+
+class CXML_AttrItem {
+ public:
+ bool Matches(const CFX_ByteString& space, const CFX_ByteString& name) const;
+
+ CFX_ByteString m_QSpaceName;
+ CFX_ByteString m_AttrName;
+ CFX_WideString m_Value;
+};
+
+#endif // CORE_FXCRT_XML_CXML_ATTRITEM_H_
diff --git a/chromium/third_party/pdfium/core/fxcrt/xml/cxml_attrmap.cpp b/chromium/third_party/pdfium/core/fxcrt/xml/cxml_attrmap.cpp
new file mode 100644
index 00000000000..8d226fe5f0d
--- /dev/null
+++ b/chromium/third_party/pdfium/core/fxcrt/xml/cxml_attrmap.cpp
@@ -0,0 +1,50 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "core/fxcrt/xml/cxml_attrmap.h"
+
+#include "third_party/base/ptr_util.h"
+#include "third_party/base/stl_util.h"
+
+CXML_AttrMap::CXML_AttrMap() {}
+
+CXML_AttrMap::~CXML_AttrMap() {}
+
+const CFX_WideString* CXML_AttrMap::Lookup(const CFX_ByteString& space,
+ const CFX_ByteString& name) const {
+ if (!m_pMap)
+ return nullptr;
+
+ for (const auto& item : *m_pMap) {
+ if (item.Matches(space, name))
+ return &item.m_Value;
+ }
+ return nullptr;
+}
+
+void CXML_AttrMap::SetAt(const CFX_ByteString& space,
+ const CFX_ByteString& name,
+ const CFX_WideString& value) {
+ if (!m_pMap)
+ m_pMap = pdfium::MakeUnique<std::vector<CXML_AttrItem>>();
+
+ for (CXML_AttrItem& item : *m_pMap) {
+ if (item.Matches(space, name)) {
+ item.m_Value = value;
+ return;
+ }
+ }
+
+ m_pMap->push_back({space, name, CFX_WideString(value)});
+}
+
+int CXML_AttrMap::GetSize() const {
+ return m_pMap ? pdfium::CollectionSize<int>(*m_pMap) : 0;
+}
+
+CXML_AttrItem& CXML_AttrMap::GetAt(int index) const {
+ return (*m_pMap)[index];
+}
diff --git a/chromium/third_party/pdfium/core/fxcrt/xml/cxml_attrmap.h b/chromium/third_party/pdfium/core/fxcrt/xml/cxml_attrmap.h
new file mode 100644
index 00000000000..0a026d31d7e
--- /dev/null
+++ b/chromium/third_party/pdfium/core/fxcrt/xml/cxml_attrmap.h
@@ -0,0 +1,33 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef CORE_FXCRT_XML_CXML_ATTRMAP_H_
+#define CORE_FXCRT_XML_CXML_ATTRMAP_H_
+
+#include <memory>
+#include <vector>
+
+#include "core/fxcrt/fx_string.h"
+#include "core/fxcrt/xml/cxml_attritem.h"
+
+class CXML_AttrMap {
+ public:
+ CXML_AttrMap();
+ ~CXML_AttrMap();
+
+ const CFX_WideString* Lookup(const CFX_ByteString& space,
+ const CFX_ByteString& name) const;
+ int GetSize() const;
+ CXML_AttrItem& GetAt(int index) const;
+
+ void SetAt(const CFX_ByteString& space,
+ const CFX_ByteString& name,
+ const CFX_WideString& value);
+
+ std::unique_ptr<std::vector<CXML_AttrItem>> m_pMap;
+};
+
+#endif // CORE_FXCRT_XML_CXML_ATTRMAP_H_
diff --git a/chromium/third_party/pdfium/core/fxcrt/xml/cxml_content.h b/chromium/third_party/pdfium/core/fxcrt/xml/cxml_content.h
new file mode 100644
index 00000000000..261c622ecab
--- /dev/null
+++ b/chromium/third_party/pdfium/core/fxcrt/xml/cxml_content.h
@@ -0,0 +1,23 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef CORE_FXCRT_XML_CXML_CONTENT_H_
+#define CORE_FXCRT_XML_CXML_CONTENT_H_
+
+class CXML_Content {
+ public:
+ CXML_Content() : m_bCDATA(false), m_Content() {}
+
+ void Set(bool bCDATA, const CFX_WideStringC& content) {
+ m_bCDATA = bCDATA;
+ m_Content = content;
+ }
+
+ bool m_bCDATA;
+ CFX_WideString m_Content;
+};
+
+#endif // CORE_FXCRT_XML_CXML_CONTENT_H_
diff --git a/chromium/third_party/pdfium/core/fxcrt/xml/cxml_element.cpp b/chromium/third_party/pdfium/core/fxcrt/xml/cxml_element.cpp
new file mode 100644
index 00000000000..17caebfa143
--- /dev/null
+++ b/chromium/third_party/pdfium/core/fxcrt/xml/cxml_element.cpp
@@ -0,0 +1,228 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "core/fxcrt/xml/cxml_element.h"
+
+#include "core/fxcrt/xml/cxml_content.h"
+#include "core/fxcrt/xml/cxml_parser.h"
+
+CXML_Element::CXML_Element(const CXML_Element* pParent,
+ const CFX_ByteStringC& qSpace,
+ const CFX_ByteStringC& tagname)
+ : m_pParent(pParent), m_QSpaceName(qSpace), m_TagName(tagname) {}
+
+CXML_Element::~CXML_Element() {
+ Empty();
+}
+
+void CXML_Element::Empty() {
+ RemoveChildren();
+}
+void CXML_Element::RemoveChildren() {
+ for (const ChildRecord& record : m_Children) {
+ if (record.type == Content) {
+ delete static_cast<CXML_Content*>(record.child);
+ } else if (record.type == Element) {
+ CXML_Element* child = static_cast<CXML_Element*>(record.child);
+ child->RemoveChildren();
+ delete child;
+ }
+ }
+ m_Children.clear();
+}
+CFX_ByteString CXML_Element::GetTagName(bool bQualified) const {
+ if (!bQualified || m_QSpaceName.IsEmpty()) {
+ return m_TagName;
+ }
+ CFX_ByteString bsTag = m_QSpaceName;
+ bsTag += ":";
+ bsTag += m_TagName;
+ return bsTag;
+}
+
+CFX_ByteString CXML_Element::GetNamespace(bool bQualified) const {
+ return bQualified ? m_QSpaceName : GetNamespaceURI(m_QSpaceName);
+}
+
+CFX_ByteString CXML_Element::GetNamespaceURI(
+ const CFX_ByteString& qName) const {
+ const CFX_WideString* pwsSpace;
+ const CXML_Element* pElement = this;
+ do {
+ if (qName.IsEmpty())
+ pwsSpace = pElement->m_AttrMap.Lookup("", "xmlns");
+ else
+ pwsSpace = pElement->m_AttrMap.Lookup("xmlns", qName);
+ if (pwsSpace)
+ break;
+
+ pElement = pElement->GetParent();
+ } while (pElement);
+ return pwsSpace ? pwsSpace->UTF8Encode() : CFX_ByteString();
+}
+
+void CXML_Element::GetAttrByIndex(int index,
+ CFX_ByteString* space,
+ CFX_ByteString* name,
+ CFX_WideString* value) const {
+ if (index < 0 || index >= m_AttrMap.GetSize())
+ return;
+
+ CXML_AttrItem& item = m_AttrMap.GetAt(index);
+ *space = item.m_QSpaceName;
+ *name = item.m_AttrName;
+ *value = item.m_Value;
+}
+
+bool CXML_Element::HasAttr(const CFX_ByteStringC& name) const {
+ CFX_ByteStringC bsSpace;
+ CFX_ByteStringC bsName;
+ FX_XML_SplitQualifiedName(name, bsSpace, bsName);
+ return !!m_AttrMap.Lookup(CFX_ByteString(bsSpace), CFX_ByteString(bsName));
+}
+
+bool CXML_Element::GetAttrValue(const CFX_ByteStringC& name,
+ CFX_WideString& attribute) const {
+ CFX_ByteStringC bsSpace;
+ CFX_ByteStringC bsName;
+ FX_XML_SplitQualifiedName(name, bsSpace, bsName);
+ return GetAttrValue(bsSpace, bsName, attribute);
+}
+
+bool CXML_Element::GetAttrValue(const CFX_ByteStringC& space,
+ const CFX_ByteStringC& name,
+ CFX_WideString& attribute) const {
+ const CFX_WideString* pValue =
+ m_AttrMap.Lookup(CFX_ByteString(space), CFX_ByteString(name));
+ if (!pValue)
+ return false;
+
+ attribute = *pValue;
+ return true;
+}
+
+bool CXML_Element::GetAttrInteger(const CFX_ByteStringC& name,
+ int& attribute) const {
+ CFX_ByteStringC bsSpace;
+ CFX_ByteStringC bsName;
+ FX_XML_SplitQualifiedName(name, bsSpace, bsName);
+ const CFX_WideString* pwsValue =
+ m_AttrMap.Lookup(CFX_ByteString(bsSpace), CFX_ByteString(bsName));
+ if (!pwsValue)
+ return false;
+
+ attribute = pwsValue->GetInteger();
+ return true;
+}
+
+bool CXML_Element::GetAttrInteger(const CFX_ByteStringC& space,
+ const CFX_ByteStringC& name,
+ int& attribute) const {
+ const CFX_WideString* pwsValue =
+ m_AttrMap.Lookup(CFX_ByteString(space), CFX_ByteString(name));
+ if (!pwsValue)
+ return false;
+
+ attribute = pwsValue->GetInteger();
+ return true;
+}
+
+bool CXML_Element::GetAttrFloat(const CFX_ByteStringC& name,
+ float& attribute) const {
+ CFX_ByteStringC bsSpace;
+ CFX_ByteStringC bsName;
+ FX_XML_SplitQualifiedName(name, bsSpace, bsName);
+ return GetAttrFloat(bsSpace, bsName, attribute);
+}
+
+bool CXML_Element::GetAttrFloat(const CFX_ByteStringC& space,
+ const CFX_ByteStringC& name,
+ float& attribute) const {
+ const CFX_WideString* pValue =
+ m_AttrMap.Lookup(CFX_ByteString(space), CFX_ByteString(name));
+ if (!pValue)
+ return false;
+
+ attribute = pValue->GetFloat();
+ return true;
+}
+
+CXML_Element::ChildType CXML_Element::GetChildType(uint32_t index) const {
+ return index < m_Children.size() ? m_Children[index].type : Invalid;
+}
+
+CFX_WideString CXML_Element::GetContent(uint32_t index) const {
+ if (index < m_Children.size() && m_Children[index].type == Content) {
+ CXML_Content* pContent =
+ static_cast<CXML_Content*>(m_Children[index].child);
+ if (pContent)
+ return pContent->m_Content;
+ }
+ return CFX_WideString();
+}
+
+CXML_Element* CXML_Element::GetElement(uint32_t index) const {
+ if (index < m_Children.size() && m_Children[index].type == Element)
+ return static_cast<CXML_Element*>(m_Children[index].child);
+ return nullptr;
+}
+
+uint32_t CXML_Element::CountElements(const CFX_ByteStringC& space,
+ const CFX_ByteStringC& tag) const {
+ int count = 0;
+ for (const ChildRecord& record : m_Children) {
+ if (record.type != Element)
+ continue;
+
+ CXML_Element* pKid = static_cast<CXML_Element*>(record.child);
+ if ((space.IsEmpty() || pKid->m_QSpaceName == space) &&
+ pKid->m_TagName == tag) {
+ count++;
+ }
+ }
+ return count;
+}
+
+CXML_Element* CXML_Element::GetElement(const CFX_ByteStringC& space,
+ const CFX_ByteStringC& tag,
+ int index) const {
+ if (index < 0)
+ return nullptr;
+
+ for (const ChildRecord& record : m_Children) {
+ if (record.type != Element)
+ continue;
+
+ CXML_Element* pKid = static_cast<CXML_Element*>(record.child);
+ if ((space.IsEmpty() || pKid->m_QSpaceName == space) &&
+ pKid->m_TagName == tag) {
+ if (index-- == 0)
+ return pKid;
+ }
+ }
+ return nullptr;
+}
+
+uint32_t CXML_Element::FindElement(CXML_Element* pChild) const {
+ int index = 0;
+ for (const ChildRecord& record : m_Children) {
+ if (record.type == Element &&
+ static_cast<CXML_Element*>(record.child) == pChild) {
+ return index;
+ }
+ ++index;
+ }
+ return 0xFFFFFFFF;
+}
+
+void CXML_Element::SetTag(const CFX_ByteStringC& qTagName) {
+ ASSERT(!qTagName.IsEmpty());
+ CFX_ByteStringC bsSpace;
+ CFX_ByteStringC bsName;
+ FX_XML_SplitQualifiedName(qTagName, bsSpace, bsName);
+ m_QSpaceName = bsSpace;
+ m_TagName = bsName;
+}
diff --git a/chromium/third_party/pdfium/core/fxcrt/xml/cxml_element.h b/chromium/third_party/pdfium/core/fxcrt/xml/cxml_element.h
new file mode 100644
index 00000000000..349deba2c82
--- /dev/null
+++ b/chromium/third_party/pdfium/core/fxcrt/xml/cxml_element.h
@@ -0,0 +1,126 @@
+// 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_FXCRT_XML_CXML_ELEMENT_H_
+#define CORE_FXCRT_XML_CXML_ELEMENT_H_
+
+#include <memory>
+#include <vector>
+
+#include "core/fxcrt/fx_basic.h"
+#include "core/fxcrt/xml/cxml_attrmap.h"
+
+class CXML_Element {
+ public:
+ enum ChildType { Invalid, Element, Content };
+
+ static std::unique_ptr<CXML_Element> Parse(const void* pBuffer, size_t size);
+
+ CXML_Element(const CXML_Element* pParent,
+ const CFX_ByteStringC& qSpace,
+ const CFX_ByteStringC& tagname);
+ ~CXML_Element();
+
+ void Empty();
+ CFX_ByteString GetTagName(bool bQualified = false) const;
+ CFX_ByteString GetNamespace(bool bQualified = false) const;
+ CFX_ByteString GetNamespaceURI(const CFX_ByteString& qName) const;
+ const CXML_Element* GetParent() const { return m_pParent; }
+ uint32_t CountAttrs() const { return m_AttrMap.GetSize(); }
+ void GetAttrByIndex(int index,
+ CFX_ByteString* space,
+ CFX_ByteString* name,
+ CFX_WideString* value) const;
+ bool HasAttr(const CFX_ByteStringC& qName) const;
+ bool GetAttrValue(const CFX_ByteStringC& name,
+ CFX_WideString& attribute) const;
+ CFX_WideString GetAttrValue(const CFX_ByteStringC& name) const {
+ CFX_WideString attr;
+ GetAttrValue(name, attr);
+ return attr;
+ }
+
+ bool GetAttrValue(const CFX_ByteStringC& space,
+ const CFX_ByteStringC& name,
+ CFX_WideString& attribute) const;
+ CFX_WideString GetAttrValue(const CFX_ByteStringC& space,
+ const CFX_ByteStringC& name) const {
+ CFX_WideString attr;
+ GetAttrValue(space, name, attr);
+ return attr;
+ }
+
+ bool GetAttrInteger(const CFX_ByteStringC& name, int& attribute) const;
+ int GetAttrInteger(const CFX_ByteStringC& name) const {
+ int attr = 0;
+ GetAttrInteger(name, attr);
+ return attr;
+ }
+
+ bool GetAttrInteger(const CFX_ByteStringC& space,
+ const CFX_ByteStringC& name,
+ int& attribute) const;
+ int GetAttrInteger(const CFX_ByteStringC& space,
+ const CFX_ByteStringC& name) const {
+ int attr = 0;
+ GetAttrInteger(space, name, attr);
+ return attr;
+ }
+
+ bool GetAttrFloat(const CFX_ByteStringC& name, float& attribute) const;
+ float GetAttrFloat(const CFX_ByteStringC& name) const {
+ float attr = 0;
+ GetAttrFloat(name, attr);
+ return attr;
+ }
+
+ bool GetAttrFloat(const CFX_ByteStringC& space,
+ const CFX_ByteStringC& name,
+ float& attribute) const;
+ float GetAttrFloat(const CFX_ByteStringC& space,
+ const CFX_ByteStringC& name) const {
+ float attr = 0;
+ GetAttrFloat(space, name, attr);
+ return attr;
+ }
+
+ uint32_t CountChildren() const { return m_Children.size(); }
+ ChildType GetChildType(uint32_t index) const;
+ CFX_WideString GetContent(uint32_t index) const;
+ CXML_Element* GetElement(uint32_t index) const;
+ CXML_Element* GetElement(const CFX_ByteStringC& space,
+ const CFX_ByteStringC& tag) const {
+ return GetElement(space, tag, 0);
+ }
+
+ uint32_t CountElements(const CFX_ByteStringC& space,
+ const CFX_ByteStringC& tag) const;
+ CXML_Element* GetElement(const CFX_ByteStringC& space,
+ const CFX_ByteStringC& tag,
+ int index) const;
+
+ uint32_t FindElement(CXML_Element* pChild) const;
+ void SetTag(const CFX_ByteStringC& qTagName);
+ void RemoveChildren();
+ void RemoveChild(uint32_t index);
+
+ private:
+ friend class CXML_Parser;
+ friend class CXML_Composer;
+
+ struct ChildRecord {
+ ChildType type;
+ void* child; // CXML_Element and CXML_Content lack a common ancestor.
+ };
+
+ const CXML_Element* const m_pParent;
+ CFX_ByteString m_QSpaceName;
+ CFX_ByteString m_TagName;
+ CXML_AttrMap m_AttrMap;
+ std::vector<ChildRecord> m_Children;
+};
+
+#endif // CORE_FXCRT_XML_CXML_ELEMENT_H_
diff --git a/chromium/third_party/pdfium/core/fxcrt/xml/cxml_parser.cpp b/chromium/third_party/pdfium/core/fxcrt/xml/cxml_parser.cpp
new file mode 100644
index 00000000000..be48b7adc26
--- /dev/null
+++ b/chromium/third_party/pdfium/core/fxcrt/xml/cxml_parser.cpp
@@ -0,0 +1,680 @@
+// 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
+
+#include <algorithm>
+#include <memory>
+#include <vector>
+
+#include "core/fxcrt/fx_ext.h"
+#include "core/fxcrt/xml/cxml_content.h"
+#include "core/fxcrt/xml/cxml_element.h"
+#include "core/fxcrt/xml/cxml_parser.h"
+#include "third_party/base/ptr_util.h"
+#include "third_party/base/stl_util.h"
+
+namespace {
+
+#define FXCRTM_XML_CHARTYPE_Normal 0x00
+#define FXCRTM_XML_CHARTYPE_SpaceChar 0x01
+#define FXCRTM_XML_CHARTYPE_Letter 0x02
+#define FXCRTM_XML_CHARTYPE_Digital 0x04
+#define FXCRTM_XML_CHARTYPE_NameIntro 0x08
+#define FXCRTM_XML_CHARTYPE_NameChar 0x10
+#define FXCRTM_XML_CHARTYPE_HexDigital 0x20
+#define FXCRTM_XML_CHARTYPE_HexLowerLetter 0x40
+#define FXCRTM_XML_CHARTYPE_HexUpperLetter 0x60
+#define FXCRTM_XML_CHARTYPE_HexChar 0x60
+
+const uint8_t g_FXCRT_XML_ByteTypes[256] = {
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00,
+ 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x08, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x1A,
+ 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A,
+ 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x00, 0x00, 0x00, 0x00, 0x18,
+ 0x00, 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A,
+ 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A,
+ 0x1A, 0x1A, 0x1A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1A, 0x1A, 0x1A, 0x1A,
+ 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A,
+ 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A,
+ 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A,
+ 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A,
+ 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A,
+ 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A,
+ 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A,
+ 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A,
+ 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A,
+ 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A,
+ 0x1A, 0x1A, 0x01, 0x01,
+};
+
+bool g_FXCRT_XML_IsWhiteSpace(uint8_t ch) {
+ return !!(g_FXCRT_XML_ByteTypes[ch] & FXCRTM_XML_CHARTYPE_SpaceChar);
+}
+
+bool g_FXCRT_XML_IsDigital(uint8_t ch) {
+ return !!(g_FXCRT_XML_ByteTypes[ch] & FXCRTM_XML_CHARTYPE_Digital);
+}
+
+bool g_FXCRT_XML_IsNameIntro(uint8_t ch) {
+ return !!(g_FXCRT_XML_ByteTypes[ch] & FXCRTM_XML_CHARTYPE_NameIntro);
+}
+
+bool g_FXCRT_XML_IsNameChar(uint8_t ch) {
+ return !!(g_FXCRT_XML_ByteTypes[ch] & FXCRTM_XML_CHARTYPE_NameChar);
+}
+
+class CXML_DataBufAcc : public IFX_BufferedReadStream {
+ public:
+ template <typename T, typename... Args>
+ friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args);
+
+ // IFX_BufferedReadStream
+ bool IsEOF() override;
+ FX_FILESIZE GetPosition() override;
+ size_t ReadBlock(void* buffer, size_t size) override;
+ bool ReadNextBlock(bool bRestart) override;
+ const uint8_t* GetBlockBuffer() override;
+ size_t GetBlockSize() override;
+ FX_FILESIZE GetBlockOffset() override;
+
+ private:
+ CXML_DataBufAcc(const uint8_t* pBuffer, size_t size);
+ ~CXML_DataBufAcc() override;
+
+ const uint8_t* m_pBuffer;
+ size_t m_dwSize;
+ size_t m_dwCurPos;
+};
+
+CXML_DataBufAcc::CXML_DataBufAcc(const uint8_t* pBuffer, size_t size)
+ : m_pBuffer(pBuffer), m_dwSize(size), m_dwCurPos(0) {}
+
+CXML_DataBufAcc::~CXML_DataBufAcc() {}
+
+bool CXML_DataBufAcc::IsEOF() {
+ return m_dwCurPos >= m_dwSize;
+}
+
+FX_FILESIZE CXML_DataBufAcc::GetPosition() {
+ return static_cast<FX_FILESIZE>(m_dwCurPos);
+}
+
+size_t CXML_DataBufAcc::ReadBlock(void* buffer, size_t size) {
+ return 0;
+}
+
+bool CXML_DataBufAcc::ReadNextBlock(bool bRestart) {
+ if (bRestart)
+ m_dwCurPos = 0;
+
+ if (m_dwCurPos < m_dwSize) {
+ m_dwCurPos = m_dwSize;
+ return true;
+ }
+ return false;
+}
+
+const uint8_t* CXML_DataBufAcc::GetBlockBuffer() {
+ return m_pBuffer;
+}
+
+size_t CXML_DataBufAcc::GetBlockSize() {
+ return m_dwSize;
+}
+
+FX_FILESIZE CXML_DataBufAcc::GetBlockOffset() {
+ return 0;
+}
+
+class CXML_DataStmAcc : public IFX_BufferedReadStream {
+ public:
+ template <typename T, typename... Args>
+ friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args);
+
+ // IFX_BufferedReadStream
+ bool IsEOF() override;
+ FX_FILESIZE GetPosition() override;
+ size_t ReadBlock(void* buffer, size_t size) override;
+ bool ReadNextBlock(bool bRestart) override;
+ const uint8_t* GetBlockBuffer() override;
+ size_t GetBlockSize() override;
+ FX_FILESIZE GetBlockOffset() override;
+
+ private:
+ explicit CXML_DataStmAcc(
+ const CFX_RetainPtr<IFX_SeekableReadStream>& pFileRead);
+ ~CXML_DataStmAcc() override;
+
+ CFX_RetainPtr<IFX_SeekableReadStream> m_pFileRead;
+ uint8_t* m_pBuffer;
+ FX_FILESIZE m_nStart;
+ size_t m_dwSize;
+};
+
+CXML_DataStmAcc::CXML_DataStmAcc(
+ const CFX_RetainPtr<IFX_SeekableReadStream>& pFileRead)
+ : m_pFileRead(pFileRead), m_pBuffer(nullptr), m_nStart(0), m_dwSize(0) {
+ ASSERT(m_pFileRead);
+}
+
+CXML_DataStmAcc::~CXML_DataStmAcc() {
+ FX_Free(m_pBuffer);
+}
+
+bool CXML_DataStmAcc::IsEOF() {
+ return m_nStart + static_cast<FX_FILESIZE>(m_dwSize) >=
+ m_pFileRead->GetSize();
+}
+
+FX_FILESIZE CXML_DataStmAcc::GetPosition() {
+ return m_nStart + static_cast<FX_FILESIZE>(m_dwSize);
+}
+
+size_t CXML_DataStmAcc::ReadBlock(void* buffer, size_t size) {
+ return 0;
+}
+
+bool CXML_DataStmAcc::ReadNextBlock(bool bRestart) {
+ if (bRestart)
+ m_nStart = 0;
+
+ FX_FILESIZE nLength = m_pFileRead->GetSize();
+ m_nStart += static_cast<FX_FILESIZE>(m_dwSize);
+ if (m_nStart >= nLength)
+ return false;
+
+ static const FX_FILESIZE FX_XMLDATASTREAM_BufferSize = 32 * 1024;
+ m_dwSize = static_cast<size_t>(
+ std::min(FX_XMLDATASTREAM_BufferSize, nLength - m_nStart));
+ if (!m_pBuffer)
+ m_pBuffer = FX_Alloc(uint8_t, m_dwSize);
+
+ return m_pFileRead->ReadBlock(m_pBuffer, m_nStart, m_dwSize);
+}
+
+const uint8_t* CXML_DataStmAcc::GetBlockBuffer() {
+ return (const uint8_t*)m_pBuffer;
+}
+
+size_t CXML_DataStmAcc::GetBlockSize() {
+ return m_dwSize;
+}
+
+FX_FILESIZE CXML_DataStmAcc::GetBlockOffset() {
+ return m_nStart;
+}
+
+} // namespace
+
+void FX_XML_SplitQualifiedName(const CFX_ByteStringC& bsFullName,
+ CFX_ByteStringC& bsSpace,
+ CFX_ByteStringC& bsName) {
+ if (bsFullName.IsEmpty())
+ return;
+
+ FX_STRSIZE iStart = bsFullName.Find(':');
+ if (iStart == -1) {
+ bsName = bsFullName;
+ } else {
+ bsSpace = bsFullName.Mid(0, iStart);
+ bsName = bsFullName.Mid(iStart + 1);
+ }
+}
+
+CXML_Parser::CXML_Parser()
+ : m_nOffset(0),
+ m_pBuffer(nullptr),
+ m_dwBufferSize(0),
+ m_nBufferOffset(0),
+ m_dwIndex(0) {}
+
+CXML_Parser::~CXML_Parser() {}
+
+bool CXML_Parser::Init(const uint8_t* pBuffer, size_t size) {
+ m_pDataAcc = pdfium::MakeRetain<CXML_DataBufAcc>(pBuffer, size);
+ m_nOffset = 0;
+ return ReadNextBlock();
+}
+
+bool CXML_Parser::ReadNextBlock() {
+ if (!m_pDataAcc->ReadNextBlock())
+ return false;
+
+ m_pBuffer = m_pDataAcc->GetBlockBuffer();
+ m_dwBufferSize = m_pDataAcc->GetBlockSize();
+ m_nBufferOffset = m_pDataAcc->GetBlockOffset();
+ m_dwIndex = 0;
+ return m_dwBufferSize > 0;
+}
+
+bool CXML_Parser::IsEOF() {
+ return m_pDataAcc->IsEOF() && m_dwIndex >= m_dwBufferSize;
+}
+
+void CXML_Parser::SkipWhiteSpaces() {
+ m_nOffset = m_nBufferOffset + static_cast<FX_FILESIZE>(m_dwIndex);
+ if (IsEOF())
+ return;
+
+ do {
+ while (m_dwIndex < m_dwBufferSize &&
+ g_FXCRT_XML_IsWhiteSpace(m_pBuffer[m_dwIndex])) {
+ m_dwIndex++;
+ }
+ m_nOffset = m_nBufferOffset + static_cast<FX_FILESIZE>(m_dwIndex);
+ if (m_dwIndex < m_dwBufferSize || IsEOF())
+ break;
+ } while (ReadNextBlock());
+}
+
+void CXML_Parser::GetName(CFX_ByteString* space, CFX_ByteString* name) {
+ m_nOffset = m_nBufferOffset + static_cast<FX_FILESIZE>(m_dwIndex);
+ if (IsEOF())
+ return;
+
+ CFX_ByteTextBuf buf;
+ uint8_t ch;
+ do {
+ while (m_dwIndex < m_dwBufferSize) {
+ ch = m_pBuffer[m_dwIndex];
+ if (ch == ':') {
+ *space = buf.AsStringC();
+ buf.Clear();
+ } else if (g_FXCRT_XML_IsNameChar(ch)) {
+ buf.AppendChar(ch);
+ } else {
+ break;
+ }
+ m_dwIndex++;
+ }
+ m_nOffset = m_nBufferOffset + static_cast<FX_FILESIZE>(m_dwIndex);
+ if (m_dwIndex < m_dwBufferSize || IsEOF())
+ break;
+ } while (ReadNextBlock());
+ *name = buf.AsStringC();
+}
+
+void CXML_Parser::SkipLiterals(const CFX_ByteStringC& str) {
+ m_nOffset = m_nBufferOffset + static_cast<FX_FILESIZE>(m_dwIndex);
+ if (IsEOF()) {
+ return;
+ }
+ int32_t i = 0, iLen = str.GetLength();
+ do {
+ while (m_dwIndex < m_dwBufferSize) {
+ if (str.GetAt(i) != m_pBuffer[m_dwIndex++]) {
+ i = 0;
+ continue;
+ }
+ i++;
+ if (i == iLen)
+ break;
+ }
+ m_nOffset = m_nBufferOffset + static_cast<FX_FILESIZE>(m_dwIndex);
+ if (i == iLen)
+ return;
+
+ if (m_dwIndex < m_dwBufferSize || IsEOF())
+ break;
+ } while (ReadNextBlock());
+ while (!m_pDataAcc->IsEOF()) {
+ ReadNextBlock();
+ m_nOffset = m_nBufferOffset + static_cast<FX_FILESIZE>(m_dwBufferSize);
+ }
+ m_dwIndex = m_dwBufferSize;
+}
+
+uint32_t CXML_Parser::GetCharRef() {
+ m_nOffset = m_nBufferOffset + static_cast<FX_FILESIZE>(m_dwIndex);
+ if (IsEOF())
+ return 0;
+
+ uint8_t ch;
+ int32_t iState = 0;
+ CFX_ByteTextBuf buf;
+ uint32_t code = 0;
+ do {
+ while (m_dwIndex < m_dwBufferSize) {
+ ch = m_pBuffer[m_dwIndex];
+ switch (iState) {
+ case 0:
+ if (ch == '#') {
+ m_dwIndex++;
+ iState = 2;
+ break;
+ }
+ iState = 1;
+ case 1:
+ m_dwIndex++;
+ if (ch == ';') {
+ CFX_ByteStringC ref = buf.AsStringC();
+ if (ref == "gt")
+ code = '>';
+ else if (ref == "lt")
+ code = '<';
+ else if (ref == "amp")
+ code = '&';
+ else if (ref == "apos")
+ code = '\'';
+ else if (ref == "quot")
+ code = '"';
+ iState = 10;
+ break;
+ }
+ buf.AppendByte(ch);
+ break;
+ case 2:
+ if (ch == 'x') {
+ m_dwIndex++;
+ iState = 4;
+ break;
+ }
+ iState = 3;
+ case 3:
+ m_dwIndex++;
+ if (ch == ';') {
+ iState = 10;
+ break;
+ }
+ if (g_FXCRT_XML_IsDigital(ch))
+ code = code * 10 + FXSYS_toDecimalDigit(static_cast<wchar_t>(ch));
+ break;
+ case 4:
+ m_dwIndex++;
+ if (ch == ';') {
+ iState = 10;
+ break;
+ }
+ uint8_t nHex =
+ g_FXCRT_XML_ByteTypes[ch] & FXCRTM_XML_CHARTYPE_HexChar;
+ if (nHex) {
+ if (nHex == FXCRTM_XML_CHARTYPE_HexDigital) {
+ code =
+ (code << 4) + FXSYS_toDecimalDigit(static_cast<wchar_t>(ch));
+ } else if (nHex == FXCRTM_XML_CHARTYPE_HexLowerLetter) {
+ code = (code << 4) + ch - 87;
+ } else {
+ code = (code << 4) + ch - 55;
+ }
+ }
+ break;
+ }
+ if (iState == 10)
+ break;
+ }
+ m_nOffset = m_nBufferOffset + static_cast<FX_FILESIZE>(m_dwIndex);
+ if (iState == 10 || m_dwIndex < m_dwBufferSize || IsEOF()) {
+ break;
+ }
+ } while (ReadNextBlock());
+ return code;
+}
+
+void CXML_Parser::GetAttrValue(CFX_WideString& value) {
+ m_nOffset = m_nBufferOffset + static_cast<FX_FILESIZE>(m_dwIndex);
+ if (IsEOF())
+ return;
+
+ CFX_UTF8Decoder decoder;
+ uint8_t mark = 0, ch = 0;
+ do {
+ while (m_dwIndex < m_dwBufferSize) {
+ ch = m_pBuffer[m_dwIndex];
+ if (mark == 0) {
+ if (ch != '\'' && ch != '"')
+ return;
+
+ mark = ch;
+ m_dwIndex++;
+ ch = 0;
+ continue;
+ }
+ m_dwIndex++;
+ if (ch == mark)
+ break;
+
+ if (ch == '&') {
+ decoder.AppendChar(GetCharRef());
+ if (IsEOF()) {
+ value = decoder.GetResult();
+ return;
+ }
+ } else {
+ decoder.Input(ch);
+ }
+ }
+ m_nOffset = m_nBufferOffset + static_cast<FX_FILESIZE>(m_dwIndex);
+ if (ch == mark || m_dwIndex < m_dwBufferSize || IsEOF())
+ break;
+ } while (ReadNextBlock());
+ value = decoder.GetResult();
+}
+
+void CXML_Parser::GetTagName(bool bStartTag,
+ bool* bEndTag,
+ CFX_ByteString* space,
+ CFX_ByteString* name) {
+ m_nOffset = m_nBufferOffset + static_cast<FX_FILESIZE>(m_dwIndex);
+ if (IsEOF())
+ return;
+
+ *bEndTag = false;
+ uint8_t ch;
+ int32_t iState = bStartTag ? 1 : 0;
+ do {
+ while (m_dwIndex < m_dwBufferSize) {
+ ch = m_pBuffer[m_dwIndex];
+ switch (iState) {
+ case 0:
+ m_dwIndex++;
+ if (ch != '<')
+ break;
+
+ iState = 1;
+ break;
+ case 1:
+ if (ch == '?') {
+ m_dwIndex++;
+ SkipLiterals("?>");
+ iState = 0;
+ break;
+ }
+ if (ch == '!') {
+ m_dwIndex++;
+ SkipLiterals("-->");
+ iState = 0;
+ break;
+ }
+ if (ch == '/') {
+ m_dwIndex++;
+ GetName(space, name);
+ *bEndTag = true;
+ } else {
+ GetName(space, name);
+ *bEndTag = false;
+ }
+ return;
+ }
+ }
+ m_nOffset = m_nBufferOffset + static_cast<FX_FILESIZE>(m_dwIndex);
+ if (m_dwIndex < m_dwBufferSize || IsEOF())
+ break;
+ } while (ReadNextBlock());
+}
+
+std::unique_ptr<CXML_Element> CXML_Parser::ParseElement(CXML_Element* pParent,
+ bool bStartTag) {
+ m_nOffset = m_nBufferOffset + static_cast<FX_FILESIZE>(m_dwIndex);
+ if (IsEOF())
+ return nullptr;
+
+ CFX_ByteString tag_name;
+ CFX_ByteString tag_space;
+ bool bEndTag;
+ GetTagName(bStartTag, &bEndTag, &tag_space, &tag_name);
+ if (tag_name.IsEmpty() || bEndTag)
+ return nullptr;
+
+ auto pElement = pdfium::MakeUnique<CXML_Element>(
+ pParent, tag_space.AsStringC(), tag_name.AsStringC());
+ do {
+ CFX_ByteString attr_space;
+ CFX_ByteString attr_name;
+ while (m_dwIndex < m_dwBufferSize) {
+ SkipWhiteSpaces();
+ if (IsEOF())
+ break;
+
+ if (!g_FXCRT_XML_IsNameIntro(m_pBuffer[m_dwIndex]))
+ break;
+
+ GetName(&attr_space, &attr_name);
+ SkipWhiteSpaces();
+ if (IsEOF())
+ break;
+
+ if (m_pBuffer[m_dwIndex] != '=')
+ break;
+
+ m_dwIndex++;
+ SkipWhiteSpaces();
+ if (IsEOF())
+ break;
+
+ CFX_WideString attr_value;
+ GetAttrValue(attr_value);
+ pElement->m_AttrMap.SetAt(attr_space, attr_name, attr_value);
+ }
+ m_nOffset = m_nBufferOffset + static_cast<FX_FILESIZE>(m_dwIndex);
+ if (m_dwIndex < m_dwBufferSize || IsEOF())
+ break;
+ } while (ReadNextBlock());
+ SkipWhiteSpaces();
+ if (IsEOF())
+ return pElement;
+
+ uint8_t ch = m_pBuffer[m_dwIndex++];
+ if (ch == '/') {
+ m_dwIndex++;
+ m_nOffset = m_nBufferOffset + static_cast<FX_FILESIZE>(m_dwIndex);
+ return pElement;
+ }
+ if (ch != '>') {
+ m_nOffset = m_nBufferOffset + static_cast<FX_FILESIZE>(m_dwIndex);
+ return nullptr;
+ }
+ SkipWhiteSpaces();
+ if (IsEOF())
+ return pElement;
+
+ CFX_UTF8Decoder decoder;
+ CFX_WideTextBuf content;
+ bool bCDATA = false;
+ int32_t iState = 0;
+ do {
+ while (m_dwIndex < m_dwBufferSize) {
+ ch = m_pBuffer[m_dwIndex++];
+ switch (iState) {
+ case 0:
+ if (ch == '<') {
+ iState = 1;
+ } else if (ch == '&') {
+ decoder.ClearStatus();
+ decoder.AppendChar(GetCharRef());
+ } else {
+ decoder.Input(ch);
+ }
+ break;
+ case 1:
+ if (ch == '!') {
+ iState = 2;
+ } else if (ch == '?') {
+ SkipLiterals("?>");
+ SkipWhiteSpaces();
+ iState = 0;
+ } else if (ch == '/') {
+ CFX_ByteString space;
+ CFX_ByteString name;
+ GetName(&space, &name);
+ SkipWhiteSpaces();
+ m_dwIndex++;
+ iState = 10;
+ } else {
+ content << decoder.GetResult();
+ CFX_WideString dataStr = content.MakeString();
+ if (!bCDATA)
+ dataStr.TrimRight(L" \t\r\n");
+
+ InsertContentSegment(bCDATA, dataStr.AsStringC(), pElement.get());
+ content.Clear();
+ decoder.Clear();
+ bCDATA = false;
+ iState = 0;
+ m_dwIndex--;
+ std::unique_ptr<CXML_Element> pSubElement(
+ ParseElement(pElement.get(), true));
+ if (!pSubElement)
+ break;
+
+ pElement->m_Children.push_back(
+ {CXML_Element::Element, pSubElement.release()});
+ SkipWhiteSpaces();
+ }
+ break;
+ case 2:
+ if (ch == '[') {
+ SkipLiterals("]]>");
+ } else if (ch == '-') {
+ m_dwIndex++;
+ SkipLiterals("-->");
+ } else {
+ SkipLiterals(">");
+ }
+ decoder.Clear();
+ SkipWhiteSpaces();
+ iState = 0;
+ break;
+ }
+ if (iState == 10) {
+ break;
+ }
+ }
+ m_nOffset = m_nBufferOffset + static_cast<FX_FILESIZE>(m_dwIndex);
+ if (iState == 10 || m_dwIndex < m_dwBufferSize || IsEOF())
+ break;
+ } while (ReadNextBlock());
+ content << decoder.GetResult();
+ CFX_WideString dataStr = content.MakeString();
+ dataStr.TrimRight(L" \t\r\n");
+
+ InsertContentSegment(bCDATA, dataStr.AsStringC(), pElement.get());
+ content.Clear();
+ decoder.Clear();
+ bCDATA = false;
+ return pElement;
+}
+
+void CXML_Parser::InsertContentSegment(bool bCDATA,
+ const CFX_WideStringC& content,
+ CXML_Element* pElement) {
+ if (content.IsEmpty())
+ return;
+
+ CXML_Content* pContent = new CXML_Content;
+ pContent->Set(bCDATA, content);
+ pElement->m_Children.push_back({CXML_Element::Content, pContent});
+}
+
+std::unique_ptr<CXML_Element> CXML_Element::Parse(const void* pBuffer,
+ size_t size) {
+ CXML_Parser parser;
+ if (!parser.Init(static_cast<const uint8_t*>(pBuffer), size))
+ return nullptr;
+ return parser.ParseElement(nullptr, false);
+}
diff --git a/chromium/third_party/pdfium/core/fxcrt/xml/cxml_parser.h b/chromium/third_party/pdfium/core/fxcrt/xml/cxml_parser.h
new file mode 100644
index 00000000000..37f14e98349
--- /dev/null
+++ b/chromium/third_party/pdfium/core/fxcrt/xml/cxml_parser.h
@@ -0,0 +1,55 @@
+// 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_FXCRT_XML_CXML_PARSER_H_
+#define CORE_FXCRT_XML_CXML_PARSER_H_
+
+#include <algorithm>
+#include <memory>
+
+#include "core/fxcrt/fx_stream.h"
+
+class CFX_UTF8Decoder;
+class CXML_Element;
+
+class CXML_Parser {
+ public:
+ CXML_Parser();
+ ~CXML_Parser();
+
+ bool Init(const uint8_t* pBuffer, size_t size);
+ bool ReadNextBlock();
+ bool IsEOF();
+ bool HaveAvailData();
+ void SkipWhiteSpaces();
+ void GetName(CFX_ByteString* space, CFX_ByteString* name);
+ void GetAttrValue(CFX_WideString& value);
+ uint32_t GetCharRef();
+ void GetTagName(bool bStartTag,
+ bool* bEndTag,
+ CFX_ByteString* space,
+ CFX_ByteString* name);
+ void SkipLiterals(const CFX_ByteStringC& str);
+ std::unique_ptr<CXML_Element> ParseElement(CXML_Element* pParent,
+ bool bStartTag);
+ void InsertContentSegment(bool bCDATA,
+ const CFX_WideStringC& content,
+ CXML_Element* pElement);
+ void InsertCDATASegment(CFX_UTF8Decoder& decoder, CXML_Element* pElement);
+
+ CFX_RetainPtr<IFX_BufferedReadStream> m_pDataAcc;
+ FX_FILESIZE m_nOffset;
+ const uint8_t* m_pBuffer;
+ size_t m_dwBufferSize;
+ FX_FILESIZE m_nBufferOffset;
+ size_t m_dwIndex;
+};
+
+void FX_XML_SplitQualifiedName(const CFX_ByteStringC& bsFullName,
+ CFX_ByteStringC& bsSpace,
+ CFX_ByteStringC& bsName);
+
+#endif // CORE_FXCRT_XML_CXML_PARSER_H_
diff --git a/chromium/third_party/pdfium/core/fxcrt/xml_int.h b/chromium/third_party/pdfium/core/fxcrt/xml_int.h
deleted file mode 100644
index 96a7da9c51d..00000000000
--- a/chromium/third_party/pdfium/core/fxcrt/xml_int.h
+++ /dev/null
@@ -1,55 +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_FXCRT_XML_INT_H_
-#define CORE_FXCRT_XML_INT_H_
-
-#include <algorithm>
-#include <memory>
-
-#include "core/fxcrt/fx_stream.h"
-
-class CFX_UTF8Decoder;
-class CXML_Element;
-
-class CXML_Parser {
- public:
- CXML_Parser();
- ~CXML_Parser();
-
- bool Init(const uint8_t* pBuffer, size_t size);
- bool ReadNextBlock();
- bool IsEOF();
- bool HaveAvailData();
- void SkipWhiteSpaces();
- void GetName(CFX_ByteString* space, CFX_ByteString* name);
- void GetAttrValue(CFX_WideString& value);
- uint32_t GetCharRef();
- void GetTagName(bool bStartTag,
- bool* bEndTag,
- CFX_ByteString* space,
- CFX_ByteString* name);
- void SkipLiterals(const CFX_ByteStringC& str);
- std::unique_ptr<CXML_Element> ParseElement(CXML_Element* pParent,
- bool bStartTag);
- void InsertContentSegment(bool bCDATA,
- const CFX_WideStringC& content,
- CXML_Element* pElement);
- void InsertCDATASegment(CFX_UTF8Decoder& decoder, CXML_Element* pElement);
-
- CFX_RetainPtr<IFX_BufferedReadStream> m_pDataAcc;
- FX_FILESIZE m_nOffset;
- const uint8_t* m_pBuffer;
- size_t m_dwBufferSize;
- FX_FILESIZE m_nBufferOffset;
- size_t m_dwIndex;
-};
-
-void FX_XML_SplitQualifiedName(const CFX_ByteStringC& bsFullName,
- CFX_ByteStringC& bsSpace,
- CFX_ByteStringC& bsName);
-
-#endif // CORE_FXCRT_XML_INT_H_
diff --git a/chromium/third_party/pdfium/core/fxge/agg/fx_agg_driver.cpp b/chromium/third_party/pdfium/core/fxge/agg/fx_agg_driver.cpp
index 8c7277752ee..e4fc151fabf 100644
--- a/chromium/third_party/pdfium/core/fxge/agg/fx_agg_driver.cpp
+++ b/chromium/third_party/pdfium/core/fxge/agg/fx_agg_driver.cpp
@@ -10,16 +10,13 @@
#include <utility>
#include "core/fxcodec/fx_codec.h"
-#include "core/fxcrt/fx_memory.h"
#include "core/fxge/cfx_fxgedevice.h"
#include "core/fxge/cfx_gemodule.h"
#include "core/fxge/cfx_graphstatedata.h"
#include "core/fxge/cfx_pathdata.h"
-#include "core/fxge/cfx_renderdevice.h"
-#include "core/fxge/dib/dib_int.h"
+#include "core/fxge/dib/cfx_imagerenderer.h"
+#include "core/fxge/dib/cfx_imagestretcher.h"
#include "core/fxge/ge/cfx_cliprgn.h"
-#include "core/fxge/ge/fx_text_int.h"
-#include "core/fxge/ifx_renderdevicedriver.h"
#include "third_party/agg23/agg_conv_dash.h"
#include "third_party/agg23/agg_conv_stroke.h"
#include "third_party/agg23/agg_curves.h"
@@ -29,19 +26,25 @@
#include "third_party/agg23/agg_renderer_scanline.h"
#include "third_party/agg23/agg_scanline_u.h"
#include "third_party/base/ptr_util.h"
+#include "third_party/base/stl_util.h"
namespace {
+const float kMaxPos = 32000.0f;
+
CFX_PointF HardClip(const CFX_PointF& pos) {
- return CFX_PointF(std::max(std::min(pos.x, 50000.0f), -50000.0f),
- std::max(std::min(pos.y, 50000.0f), -50000.0f));
+ return CFX_PointF(pdfium::clamp(pos.x, -kMaxPos, kMaxPos),
+ pdfium::clamp(pos.y, -kMaxPos, kMaxPos));
}
-void RgbByteOrderSetPixel(CFX_DIBitmap* pBitmap, int x, int y, uint32_t argb) {
+void RgbByteOrderSetPixel(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
+ int x,
+ int y,
+ uint32_t argb) {
if (x < 0 || x >= pBitmap->GetWidth() || y < 0 || y >= pBitmap->GetHeight())
return;
- uint8_t* pos = (uint8_t*)pBitmap->GetBuffer() + y * pBitmap->GetPitch() +
+ uint8_t* pos = pBitmap->GetBuffer() + y * pBitmap->GetPitch() +
x * pBitmap->GetBPP() / 8;
if (pBitmap->GetFormat() == FXDIB_Argb) {
FXARGB_SETRGBORDERDIB(pos, argb);
@@ -54,7 +57,7 @@ void RgbByteOrderSetPixel(CFX_DIBitmap* pBitmap, int x, int y, uint32_t argb) {
pos[2] = (FXARGB_B(argb) * alpha + pos[2] * (255 - alpha)) / 255;
}
-void RgbByteOrderCompositeRect(CFX_DIBitmap* pBitmap,
+void RgbByteOrderCompositeRect(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
int left,
int top,
int width,
@@ -71,7 +74,6 @@ void RgbByteOrderCompositeRect(CFX_DIBitmap* pBitmap,
int src_g = FXARGB_G(argb);
int src_b = FXARGB_B(argb);
int Bpp = pBitmap->GetBPP() / 8;
- bool bAlpha = pBitmap->HasAlpha();
int dib_argb = FXARGB_TOBGRORDERDIB(argb);
uint8_t* pBuffer = pBitmap->GetBuffer();
if (src_alpha == 255) {
@@ -79,7 +81,7 @@ void RgbByteOrderCompositeRect(CFX_DIBitmap* pBitmap,
uint8_t* dest_scan =
pBuffer + row * pBitmap->GetPitch() + rect.left * Bpp;
if (Bpp == 4) {
- uint32_t* scan = (uint32_t*)dest_scan;
+ uint32_t* scan = reinterpret_cast<uint32_t*>(dest_scan);
for (int col = 0; col < width; col++)
*scan++ = dib_argb;
} else {
@@ -92,6 +94,7 @@ void RgbByteOrderCompositeRect(CFX_DIBitmap* pBitmap,
}
return;
}
+ bool bAlpha = pBitmap->HasAlpha();
for (int row = rect.top; row < rect.bottom; row++) {
uint8_t* dest_scan = pBuffer + row * pBitmap->GetPitch() + rect.left * Bpp;
if (bAlpha) {
@@ -114,27 +117,27 @@ void RgbByteOrderCompositeRect(CFX_DIBitmap* pBitmap,
*dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio);
dest_scan += 2;
}
- } else {
- for (int col = 0; col < width; col++) {
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, src_alpha);
- dest_scan++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, src_alpha);
- dest_scan++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, src_alpha);
+ continue;
+ }
+ for (int col = 0; col < width; col++) {
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, src_alpha);
+ dest_scan++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, src_alpha);
+ dest_scan++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, src_alpha);
+ dest_scan++;
+ if (Bpp == 4)
dest_scan++;
- if (Bpp == 4)
- dest_scan++;
- }
}
}
}
-void RgbByteOrderTransferBitmap(CFX_DIBitmap* pBitmap,
+void RgbByteOrderTransferBitmap(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
int dest_left,
int dest_top,
int width,
int height,
- const CFX_DIBSource* pSrcBitmap,
+ const CFX_RetainPtr<CFX_DIBSource>& pSrcBitmap,
int src_left,
int src_top) {
if (!pBitmap)
@@ -155,7 +158,8 @@ void RgbByteOrderTransferBitmap(CFX_DIBitmap* pBitmap,
for (int row = 0; row < height; row++) {
uint8_t* dest_scan = buffer + (dest_top + row) * pitch + dest_left * Bpp;
uint8_t* src_scan =
- (uint8_t*)pSrcBitmap->GetScanline(src_top + row) + src_left * Bpp;
+ const_cast<uint8_t*>(pSrcBitmap->GetScanline(src_top + row)) +
+ src_left * Bpp;
if (Bpp == 4) {
for (int col = 0; col < width; col++) {
FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_scan[3], src_scan[0],
@@ -163,13 +167,13 @@ void RgbByteOrderTransferBitmap(CFX_DIBitmap* pBitmap,
dest_scan += 4;
src_scan += 4;
}
- } else {
- for (int col = 0; col < width; col++) {
- *dest_scan++ = src_scan[2];
- *dest_scan++ = src_scan[1];
- *dest_scan++ = src_scan[0];
- src_scan += 3;
- }
+ continue;
+ }
+ for (int col = 0; col < width; col++) {
+ *dest_scan++ = src_scan[2];
+ *dest_scan++ = src_scan[1];
+ *dest_scan++ = src_scan[0];
+ src_scan += 3;
}
}
return;
@@ -177,55 +181,53 @@ void RgbByteOrderTransferBitmap(CFX_DIBitmap* pBitmap,
uint8_t* dest_buf = buffer + dest_top * pitch + dest_left * Bpp;
if (dest_format == FXDIB_Rgb) {
- if (src_format == FXDIB_Rgb32) {
- for (int row = 0; row < height; row++) {
- uint8_t* dest_scan = dest_buf + row * pitch;
- uint8_t* src_scan =
- (uint8_t*)pSrcBitmap->GetScanline(src_top + row) + src_left * 4;
- for (int col = 0; col < width; col++) {
- *dest_scan++ = src_scan[2];
- *dest_scan++ = src_scan[1];
- *dest_scan++ = src_scan[0];
- src_scan += 4;
- }
+ ASSERT(src_format == FXDIB_Rgb32);
+ for (int row = 0; row < height; row++) {
+ uint8_t* dest_scan = dest_buf + row * pitch;
+ uint8_t* src_scan =
+ const_cast<uint8_t*>(pSrcBitmap->GetScanline(src_top + row)) +
+ src_left * 4;
+ for (int col = 0; col < width; col++) {
+ *dest_scan++ = src_scan[2];
+ *dest_scan++ = src_scan[1];
+ *dest_scan++ = src_scan[0];
+ src_scan += 4;
}
- } else {
- ASSERT(false);
}
return;
}
- if (dest_format == FXDIB_Argb || dest_format == FXDIB_Rgb32) {
- if (src_format == FXDIB_Rgb) {
- for (int row = 0; row < height; row++) {
- uint8_t* dest_scan = (uint8_t*)(dest_buf + row * pitch);
- uint8_t* src_scan =
- (uint8_t*)pSrcBitmap->GetScanline(src_top + row) + src_left * 3;
- for (int col = 0; col < width; col++) {
- FXARGB_SETDIB(dest_scan, FXARGB_MAKE(0xff, src_scan[0], src_scan[1],
- src_scan[2]));
- dest_scan += 4;
- src_scan += 3;
- }
- }
- } else if (src_format == FXDIB_Rgb32) {
- ASSERT(dest_format == FXDIB_Argb);
- for (int row = 0; row < height; row++) {
- uint8_t* dest_scan = dest_buf + row * pitch;
- uint8_t* src_scan =
- (uint8_t*)(pSrcBitmap->GetScanline(src_top + row) + src_left * 4);
- for (int col = 0; col < width; col++) {
- FXARGB_SETDIB(dest_scan, FXARGB_MAKE(0xff, src_scan[0], src_scan[1],
- src_scan[2]));
- src_scan += 4;
- dest_scan += 4;
- }
+ ASSERT(dest_format == FXDIB_Argb || dest_format == FXDIB_Rgb32);
+ if (src_format == FXDIB_Rgb) {
+ for (int row = 0; row < height; row++) {
+ uint8_t* dest_scan = dest_buf + row * pitch;
+ uint8_t* src_scan =
+ const_cast<uint8_t*>(pSrcBitmap->GetScanline(src_top + row)) +
+ src_left * 3;
+ for (int col = 0; col < width; col++) {
+ FXARGB_SETDIB(dest_scan,
+ FXARGB_MAKE(0xff, src_scan[0], src_scan[1], src_scan[2]));
+ dest_scan += 4;
+ src_scan += 3;
}
}
return;
}
-
- ASSERT(false);
+ if (src_format != FXDIB_Rgb32)
+ return;
+ ASSERT(dest_format == FXDIB_Argb);
+ for (int row = 0; row < height; row++) {
+ uint8_t* dest_scan = dest_buf + row * pitch;
+ uint8_t* src_scan =
+ const_cast<uint8_t*>(pSrcBitmap->GetScanline(src_top + row)) +
+ src_left * 4;
+ for (int col = 0; col < width; col++) {
+ FXARGB_SETDIB(dest_scan,
+ FXARGB_MAKE(0xff, src_scan[0], src_scan[1], src_scan[2]));
+ src_scan += 4;
+ dest_scan += 4;
+ }
+ }
}
FX_ARGB DefaultCMYK2ARGB(FX_CMYK cmyk, uint8_t alpha) {
@@ -235,7 +237,7 @@ FX_ARGB DefaultCMYK2ARGB(FX_CMYK cmyk, uint8_t alpha) {
return ArgbEncode(alpha, r, g, b);
}
-bool DibSetPixel(CFX_DIBitmap* pDevice,
+bool DibSetPixel(const CFX_RetainPtr<CFX_DIBitmap>& pDevice,
int x,
int y,
uint32_t color,
@@ -247,72 +249,878 @@ bool DibSetPixel(CFX_DIBitmap* pDevice,
CCodec_IccModule* pIccModule =
CFX_GEModule::Get()->GetCodecModule()->GetIccModule();
color = bObjCMYK ? FXCMYK_TODIB(color) : FXARGB_TODIB(color);
- pIccModule->TranslateScanline(pIccTransform, (uint8_t*)&color,
- (uint8_t*)&color, 1);
+ uint8_t* pColor = reinterpret_cast<uint8_t*>(&color);
+ pIccModule->TranslateScanline(pIccTransform, pColor, pColor, 1);
color = bObjCMYK ? FXCMYK_TODIB(color) : FXARGB_TODIB(color);
- if (!pDevice->IsCmykImage()) {
+ if (!pDevice->IsCmykImage())
color = (color & 0xffffff) | (alpha << 24);
- }
} else {
if (pDevice->IsCmykImage()) {
if (!bObjCMYK)
return false;
- } else {
- if (bObjCMYK)
- color = DefaultCMYK2ARGB(color, alpha);
+ } else if (bObjCMYK) {
+ color = DefaultCMYK2ARGB(color, alpha);
}
}
pDevice->SetPixel(x, y, color);
- if (pDevice->m_pAlphaMask) {
+ if (pDevice->m_pAlphaMask)
pDevice->m_pAlphaMask->SetPixel(x, y, alpha << 24);
- }
return true;
}
-} // namespace
+void RasterizeStroke(agg::rasterizer_scanline_aa* rasterizer,
+ agg::path_storage* path_data,
+ const CFX_Matrix* pObject2Device,
+ const CFX_GraphStateData* pGraphState,
+ float scale,
+ bool bStrokeAdjust,
+ bool bTextMode) {
+ agg::line_cap_e cap;
+ switch (pGraphState->m_LineCap) {
+ case CFX_GraphStateData::LineCapRound:
+ cap = agg::round_cap;
+ break;
+ case CFX_GraphStateData::LineCapSquare:
+ cap = agg::square_cap;
+ break;
+ default:
+ cap = agg::butt_cap;
+ break;
+ }
+ agg::line_join_e join;
+ switch (pGraphState->m_LineJoin) {
+ case CFX_GraphStateData::LineJoinRound:
+ join = agg::round_join;
+ break;
+ case CFX_GraphStateData::LineJoinBevel:
+ join = agg::bevel_join;
+ break;
+ default:
+ join = agg::miter_join_revert;
+ break;
+ }
+ float width = pGraphState->m_LineWidth * scale;
+ float unit = 1.0f;
+ if (pObject2Device) {
+ unit =
+ 1.0f / ((pObject2Device->GetXUnit() + pObject2Device->GetYUnit()) / 2);
+ }
+ width = std::max(width, unit);
+ if (pGraphState->m_DashArray) {
+ typedef agg::conv_dash<agg::path_storage> dash_converter;
+ dash_converter dash(*path_data);
+ for (int i = 0; i < (pGraphState->m_DashCount + 1) / 2; i++) {
+ float on = pGraphState->m_DashArray[i * 2];
+ if (on <= 0.000001f)
+ on = 1.0f / 10;
+ float off = i * 2 + 1 == pGraphState->m_DashCount
+ ? on
+ : pGraphState->m_DashArray[i * 2 + 1];
+ off = std::max(off, 0.0f);
+ dash.add_dash(on * scale, off * scale);
+ }
+ dash.dash_start(pGraphState->m_DashPhase * scale);
+ typedef agg::conv_stroke<dash_converter> dash_stroke;
+ dash_stroke stroke(dash);
+ stroke.line_join(join);
+ stroke.line_cap(cap);
+ stroke.miter_limit(pGraphState->m_MiterLimit);
+ stroke.width(width);
+ rasterizer->add_path_transformed(stroke, pObject2Device);
+ return;
+ }
+ agg::conv_stroke<agg::path_storage> stroke(*path_data);
+ stroke.line_join(join);
+ stroke.line_cap(cap);
+ stroke.miter_limit(pGraphState->m_MiterLimit);
+ stroke.width(width);
+ rasterizer->add_path_transformed(stroke, pObject2Device);
+}
-void CAgg_PathData::BuildPath(const CFX_PathData* pPathData,
- const CFX_Matrix* pObject2Device) {
- const std::vector<FX_PATHPOINT>& pPoints = pPathData->GetPoints();
- for (size_t i = 0; i < pPoints.size(); i++) {
- CFX_PointF pos = pPoints[i].m_Point;
- if (pObject2Device)
- pos = pObject2Device->Transform(pos);
+class CFX_Renderer {
+ public:
+ // Needed for agg caller
+ void prepare(unsigned) {}
- pos = HardClip(pos);
- FXPT_TYPE point_type = pPoints[i].m_Type;
- if (point_type == FXPT_TYPE::MoveTo) {
- m_PathData.move_to(pos.x, pos.y);
- } else if (point_type == FXPT_TYPE::LineTo) {
- if (pPoints[i - 1].IsTypeAndOpen(FXPT_TYPE::MoveTo) &&
- (i == pPoints.size() - 1 ||
- pPoints[i + 1].IsTypeAndOpen(FXPT_TYPE::MoveTo)) &&
- pPoints[i].m_Point == pPoints[i - 1].m_Point) {
- pos.x += 1;
+ void CompositeSpan(uint8_t* dest_scan,
+ uint8_t* ori_scan,
+ int Bpp,
+ bool bDestAlpha,
+ int span_left,
+ int span_len,
+ uint8_t* cover_scan,
+ int clip_left,
+ int clip_right,
+ uint8_t* clip_scan);
+
+ void CompositeSpan1bpp(uint8_t* dest_scan,
+ int Bpp,
+ int span_left,
+ int span_len,
+ uint8_t* cover_scan,
+ int clip_left,
+ int clip_right,
+ uint8_t* clip_scan,
+ uint8_t* dest_extra_alpha_scan);
+
+ void CompositeSpanGray(uint8_t* dest_scan,
+ int Bpp,
+ int span_left,
+ int span_len,
+ uint8_t* cover_scan,
+ int clip_left,
+ int clip_right,
+ uint8_t* clip_scan,
+ uint8_t* dest_extra_alpha_scan);
+
+ void CompositeSpanARGB(uint8_t* dest_scan,
+ int Bpp,
+ int span_left,
+ int span_len,
+ uint8_t* cover_scan,
+ int clip_left,
+ int clip_right,
+ uint8_t* clip_scan,
+ uint8_t* dest_extra_alpha_scan);
+
+ void CompositeSpanRGB(uint8_t* dest_scan,
+ int Bpp,
+ int span_left,
+ int span_len,
+ uint8_t* cover_scan,
+ int clip_left,
+ int clip_right,
+ uint8_t* clip_scan,
+ uint8_t* dest_extra_alpha_scan);
+
+ void CompositeSpanCMYK(uint8_t* dest_scan,
+ int Bpp,
+ int span_left,
+ int span_len,
+ uint8_t* cover_scan,
+ int clip_left,
+ int clip_right,
+ uint8_t* clip_scan,
+ uint8_t* dest_extra_alpha_scan);
+
+ bool Init(const CFX_RetainPtr<CFX_DIBitmap>& pDevice,
+ const CFX_RetainPtr<CFX_DIBitmap>& pOriDevice,
+ const CFX_ClipRgn* pClipRgn,
+ uint32_t color,
+ bool bFullCover,
+ bool bRgbByteOrder,
+ int alpha_flag,
+ void* pIccTransform);
+
+ template <class Scanline>
+ void render(const Scanline& sl);
+
+ private:
+ void (CFX_Renderer::*composite_span)(uint8_t*,
+ int,
+ int,
+ int,
+ uint8_t*,
+ int,
+ int,
+ uint8_t*,
+ uint8_t*);
+
+ void CompositeSpan1bppHelper(uint8_t* dest_scan,
+ int col_start,
+ int col_end,
+ const uint8_t* cover_scan,
+ const uint8_t* clip_scan,
+ int span_left);
+
+ inline int GetSrcAlpha(const uint8_t* clip_scan, int col) const {
+ return clip_scan ? m_Alpha * clip_scan[col] / 255 : m_Alpha;
+ }
+
+ inline int GetSourceAlpha(const uint8_t* cover_scan,
+ const uint8_t* clip_scan,
+ int col) const {
+ return clip_scan ? m_Alpha * cover_scan[col] * clip_scan[col] / 255 / 255
+ : m_Alpha * cover_scan[col] / 255;
+ }
+
+ inline int GetColStart(int span_left, int clip_left) const {
+ return span_left < clip_left ? clip_left - span_left : 0;
+ }
+
+ inline int GetColEnd(int span_left, int span_len, int clip_right) const {
+ return span_left + span_len < clip_right ? span_len
+ : clip_right - span_left;
+ }
+
+ int m_Alpha;
+ int m_Red;
+ int m_Green;
+ int m_Blue;
+ int m_Gray;
+ uint32_t m_Color;
+ bool m_bFullCover;
+ bool m_bRgbByteOrder;
+ FX_RECT m_ClipBox;
+ CFX_RetainPtr<CFX_DIBitmap> m_pOriDevice;
+ CFX_RetainPtr<CFX_DIBitmap> m_pClipMask;
+ CFX_RetainPtr<CFX_DIBitmap> m_pDevice;
+ const CFX_ClipRgn* m_pClipRgn;
+};
+
+void CFX_Renderer::CompositeSpan(uint8_t* dest_scan,
+ uint8_t* ori_scan,
+ int Bpp,
+ bool bDestAlpha,
+ int span_left,
+ int span_len,
+ uint8_t* cover_scan,
+ int clip_left,
+ int clip_right,
+ uint8_t* clip_scan) {
+ ASSERT(!m_pDevice->IsCmykImage());
+ int col_start = GetColStart(span_left, clip_left);
+ int col_end = GetColEnd(span_left, span_len, clip_right);
+ if (Bpp) {
+ dest_scan += col_start * Bpp;
+ ori_scan += col_start * Bpp;
+ } else {
+ dest_scan += col_start / 8;
+ ori_scan += col_start / 8;
+ }
+ if (m_bRgbByteOrder) {
+ if (Bpp == 4 && bDestAlpha) {
+ for (int col = col_start; col < col_end; col++) {
+ int src_alpha = GetSrcAlpha(clip_scan, col);
+ uint8_t dest_alpha =
+ ori_scan[3] + src_alpha - ori_scan[3] * src_alpha / 255;
+ dest_scan[3] = dest_alpha;
+ int alpha_ratio = src_alpha * 255 / dest_alpha;
+ if (m_bFullCover) {
+ *dest_scan++ = FXDIB_ALPHA_MERGE(*ori_scan++, m_Red, alpha_ratio);
+ *dest_scan++ = FXDIB_ALPHA_MERGE(*ori_scan++, m_Green, alpha_ratio);
+ *dest_scan++ = FXDIB_ALPHA_MERGE(*ori_scan++, m_Blue, alpha_ratio);
+ dest_scan++;
+ ori_scan++;
+ } else {
+ int r = FXDIB_ALPHA_MERGE(*ori_scan++, m_Red, alpha_ratio);
+ int g = FXDIB_ALPHA_MERGE(*ori_scan++, m_Green, alpha_ratio);
+ int b = FXDIB_ALPHA_MERGE(*ori_scan++, m_Blue, alpha_ratio);
+ ori_scan++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, r, cover_scan[col]);
+ dest_scan++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, g, cover_scan[col]);
+ dest_scan++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, b, cover_scan[col]);
+ dest_scan += 2;
+ }
}
- m_PathData.line_to(pos.x, pos.y);
- } else if (point_type == FXPT_TYPE::BezierTo) {
- CFX_PointF pos0 = pPoints[i - 1].m_Point;
- CFX_PointF pos2 = pPoints[i + 1].m_Point;
- CFX_PointF pos3 = pPoints[i + 2].m_Point;
- if (pObject2Device) {
- pos0 = pObject2Device->Transform(pos0);
- pos2 = pObject2Device->Transform(pos2);
- pos3 = pObject2Device->Transform(pos3);
+ return;
+ }
+ if (Bpp == 3 || Bpp == 4) {
+ for (int col = col_start; col < col_end; col++) {
+ int src_alpha = GetSrcAlpha(clip_scan, col);
+ int r = FXDIB_ALPHA_MERGE(*ori_scan++, m_Red, src_alpha);
+ int g = FXDIB_ALPHA_MERGE(*ori_scan++, m_Green, src_alpha);
+ int b = FXDIB_ALPHA_MERGE(*ori_scan, m_Blue, src_alpha);
+ ori_scan += Bpp - 2;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, r, cover_scan[col]);
+ dest_scan++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, g, cover_scan[col]);
+ dest_scan++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, b, cover_scan[col]);
+ dest_scan += Bpp - 2;
}
- pos0 = HardClip(pos0);
- pos2 = HardClip(pos2);
- pos3 = HardClip(pos3);
- agg::curve4 curve(pos0.x, pos0.y, pos.x, pos.y, pos2.x, pos2.y, pos3.x,
- pos3.y);
- i += 2;
- m_PathData.add_path_curve(curve);
}
- if (pPoints[i].m_CloseFigure)
- m_PathData.end_poly();
+ return;
+ }
+ if (Bpp == 4 && bDestAlpha) {
+ for (int col = col_start; col < col_end; col++) {
+ int src_alpha = GetSrcAlpha(clip_scan, col);
+ int src_alpha_covered = src_alpha * cover_scan[col] / 255;
+ if (src_alpha_covered == 0) {
+ dest_scan += 4;
+ continue;
+ }
+ if (cover_scan[col] == 255) {
+ dest_scan[3] = src_alpha_covered;
+ *dest_scan++ = m_Blue;
+ *dest_scan++ = m_Green;
+ *dest_scan = m_Red;
+ dest_scan += 2;
+ continue;
+ }
+ if (dest_scan[3] == 0) {
+ dest_scan[3] = src_alpha_covered;
+ *dest_scan++ = m_Blue;
+ *dest_scan++ = m_Green;
+ *dest_scan = m_Red;
+ dest_scan += 2;
+ continue;
+ }
+ uint8_t cover = cover_scan[col];
+ dest_scan[3] = FXDIB_ALPHA_MERGE(dest_scan[3], src_alpha, cover);
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, cover);
+ dest_scan++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, cover);
+ dest_scan++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, cover);
+ dest_scan += 2;
+ }
+ return;
+ }
+ if (Bpp == 3 || Bpp == 4) {
+ for (int col = col_start; col < col_end; col++) {
+ int src_alpha = GetSrcAlpha(clip_scan, col);
+ if (m_bFullCover) {
+ *dest_scan++ = FXDIB_ALPHA_MERGE(*ori_scan++, m_Blue, src_alpha);
+ *dest_scan++ = FXDIB_ALPHA_MERGE(*ori_scan++, m_Green, src_alpha);
+ *dest_scan = FXDIB_ALPHA_MERGE(*ori_scan, m_Red, src_alpha);
+ dest_scan += Bpp - 2;
+ ori_scan += Bpp - 2;
+ continue;
+ }
+ int b = FXDIB_ALPHA_MERGE(*ori_scan++, m_Blue, src_alpha);
+ int g = FXDIB_ALPHA_MERGE(*ori_scan++, m_Green, src_alpha);
+ int r = FXDIB_ALPHA_MERGE(*ori_scan, m_Red, src_alpha);
+ ori_scan += Bpp - 2;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, b, cover_scan[col]);
+ dest_scan++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, g, cover_scan[col]);
+ dest_scan++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, r, cover_scan[col]);
+ dest_scan += Bpp - 2;
+ continue;
+ }
+ return;
+ }
+ if (Bpp == 1) {
+ for (int col = col_start; col < col_end; col++) {
+ int src_alpha = GetSrcAlpha(clip_scan, col);
+ if (m_bFullCover) {
+ *dest_scan = FXDIB_ALPHA_MERGE(*ori_scan++, m_Gray, src_alpha);
+ continue;
+ }
+ int gray = FXDIB_ALPHA_MERGE(*ori_scan++, m_Gray, src_alpha);
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, cover_scan[col]);
+ dest_scan++;
+ }
+ return;
+ }
+ CompositeSpan1bppHelper(dest_scan, col_start, col_end, cover_scan, clip_scan,
+ span_left);
+}
+
+void CFX_Renderer::CompositeSpan1bpp(uint8_t* dest_scan,
+ int Bpp,
+ int span_left,
+ int span_len,
+ uint8_t* cover_scan,
+ int clip_left,
+ int clip_right,
+ uint8_t* clip_scan,
+ uint8_t* dest_extra_alpha_scan) {
+ ASSERT(!m_bRgbByteOrder);
+ ASSERT(!m_pDevice->IsCmykImage());
+ int col_start = GetColStart(span_left, clip_left);
+ int col_end = GetColEnd(span_left, span_len, clip_right);
+ dest_scan += col_start / 8;
+ CompositeSpan1bppHelper(dest_scan, col_start, col_end, cover_scan, clip_scan,
+ span_left);
+}
+
+void CFX_Renderer::CompositeSpanGray(uint8_t* dest_scan,
+ int Bpp,
+ int span_left,
+ int span_len,
+ uint8_t* cover_scan,
+ int clip_left,
+ int clip_right,
+ uint8_t* clip_scan,
+ uint8_t* dest_extra_alpha_scan) {
+ ASSERT(!m_bRgbByteOrder);
+ int col_start = GetColStart(span_left, clip_left);
+ int col_end = GetColEnd(span_left, span_len, clip_right);
+ dest_scan += col_start;
+ if (dest_extra_alpha_scan) {
+ for (int col = col_start; col < col_end; col++) {
+ int src_alpha = m_bFullCover ? GetSrcAlpha(clip_scan, col)
+ : GetSourceAlpha(cover_scan, clip_scan, col);
+ if (src_alpha) {
+ if (src_alpha == 255) {
+ *dest_scan = m_Gray;
+ *dest_extra_alpha_scan = m_Alpha;
+ } else {
+ uint8_t dest_alpha = (*dest_extra_alpha_scan) + src_alpha -
+ (*dest_extra_alpha_scan) * src_alpha / 255;
+ *dest_extra_alpha_scan++ = dest_alpha;
+ int alpha_ratio = src_alpha * 255 / dest_alpha;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Gray, alpha_ratio);
+ dest_scan++;
+ continue;
+ }
+ }
+ dest_extra_alpha_scan++;
+ dest_scan++;
+ }
+ return;
+ }
+ for (int col = col_start; col < col_end; col++) {
+ int src_alpha = GetSourceAlpha(cover_scan, clip_scan, col);
+ if (src_alpha) {
+ if (src_alpha == 255)
+ *dest_scan = m_Gray;
+ else
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Gray, src_alpha);
+ }
+ dest_scan++;
+ }
+}
+
+void CFX_Renderer::CompositeSpanARGB(uint8_t* dest_scan,
+ int Bpp,
+ int span_left,
+ int span_len,
+ uint8_t* cover_scan,
+ int clip_left,
+ int clip_right,
+ uint8_t* clip_scan,
+ uint8_t* dest_extra_alpha_scan) {
+ int col_start = GetColStart(span_left, clip_left);
+ int col_end = GetColEnd(span_left, span_len, clip_right);
+ dest_scan += col_start * Bpp;
+ if (m_bRgbByteOrder) {
+ for (int col = col_start; col < col_end; col++) {
+ int src_alpha = m_bFullCover ? GetSrcAlpha(clip_scan, col)
+ : GetSourceAlpha(cover_scan, clip_scan, col);
+ if (src_alpha) {
+ if (src_alpha == 255) {
+ *(reinterpret_cast<uint32_t*>(dest_scan)) = m_Color;
+ } else {
+ uint8_t dest_alpha =
+ dest_scan[3] + src_alpha - dest_scan[3] * src_alpha / 255;
+ dest_scan[3] = dest_alpha;
+ int alpha_ratio = src_alpha * 255 / dest_alpha;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, alpha_ratio);
+ dest_scan++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, alpha_ratio);
+ dest_scan++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, alpha_ratio);
+ dest_scan += 2;
+ continue;
+ }
+ }
+ dest_scan += 4;
+ }
+ return;
+ }
+ for (int col = col_start; col < col_end; col++) {
+ int src_alpha = m_bFullCover ? GetSrcAlpha(clip_scan, col)
+ : GetSourceAlpha(cover_scan, clip_scan, col);
+ if (src_alpha) {
+ if (src_alpha == 255) {
+ *(reinterpret_cast<uint32_t*>(dest_scan)) = m_Color;
+ } else {
+ if (dest_scan[3] == 0) {
+ dest_scan[3] = src_alpha;
+ *dest_scan++ = m_Blue;
+ *dest_scan++ = m_Green;
+ *dest_scan = m_Red;
+ dest_scan += 2;
+ continue;
+ }
+ uint8_t dest_alpha =
+ dest_scan[3] + src_alpha - dest_scan[3] * src_alpha / 255;
+ dest_scan[3] = dest_alpha;
+ int alpha_ratio = src_alpha * 255 / dest_alpha;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, alpha_ratio);
+ dest_scan++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, alpha_ratio);
+ dest_scan++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, alpha_ratio);
+ dest_scan += 2;
+ continue;
+ }
+ }
+ dest_scan += Bpp;
}
}
+void CFX_Renderer::CompositeSpanRGB(uint8_t* dest_scan,
+ int Bpp,
+ int span_left,
+ int span_len,
+ uint8_t* cover_scan,
+ int clip_left,
+ int clip_right,
+ uint8_t* clip_scan,
+ uint8_t* dest_extra_alpha_scan) {
+ int col_start = GetColStart(span_left, clip_left);
+ int col_end = GetColEnd(span_left, span_len, clip_right);
+ dest_scan += col_start * Bpp;
+ if (m_bRgbByteOrder) {
+ for (int col = col_start; col < col_end; col++) {
+ int src_alpha = GetSourceAlpha(cover_scan, clip_scan, col);
+ if (src_alpha) {
+ if (src_alpha == 255) {
+ if (Bpp == 4) {
+ *(uint32_t*)dest_scan = m_Color;
+ } else if (Bpp == 3) {
+ *dest_scan++ = m_Red;
+ *dest_scan++ = m_Green;
+ *dest_scan++ = m_Blue;
+ continue;
+ }
+ } else {
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, src_alpha);
+ dest_scan++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, src_alpha);
+ dest_scan++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, src_alpha);
+ dest_scan += Bpp - 2;
+ continue;
+ }
+ }
+ dest_scan += Bpp;
+ }
+ return;
+ }
+ if (Bpp == 3 && dest_extra_alpha_scan) {
+ for (int col = col_start; col < col_end; col++) {
+ int src_alpha = m_bFullCover ? GetSrcAlpha(clip_scan, col)
+ : GetSourceAlpha(cover_scan, clip_scan, col);
+ if (src_alpha) {
+ if (src_alpha == 255) {
+ *dest_scan++ = static_cast<uint8_t>(m_Blue);
+ *dest_scan++ = static_cast<uint8_t>(m_Green);
+ *dest_scan++ = static_cast<uint8_t>(m_Red);
+ *dest_extra_alpha_scan++ = static_cast<uint8_t>(m_Alpha);
+ continue;
+ }
+ uint8_t dest_alpha = (*dest_extra_alpha_scan) + src_alpha -
+ (*dest_extra_alpha_scan) * src_alpha / 255;
+ *dest_extra_alpha_scan++ = dest_alpha;
+ int alpha_ratio = src_alpha * 255 / dest_alpha;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, alpha_ratio);
+ dest_scan++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, alpha_ratio);
+ dest_scan++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, alpha_ratio);
+ dest_scan++;
+ continue;
+ }
+ dest_extra_alpha_scan++;
+ dest_scan += Bpp;
+ }
+ return;
+ }
+ for (int col = col_start; col < col_end; col++) {
+ int src_alpha = m_bFullCover ? GetSrcAlpha(clip_scan, col)
+ : GetSourceAlpha(cover_scan, clip_scan, col);
+ if (src_alpha) {
+ if (src_alpha == 255) {
+ if (Bpp == 4) {
+ *(uint32_t*)dest_scan = m_Color;
+ } else if (Bpp == 3) {
+ *dest_scan++ = m_Blue;
+ *dest_scan++ = m_Green;
+ *dest_scan++ = m_Red;
+ continue;
+ }
+ } else {
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, src_alpha);
+ dest_scan++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, src_alpha);
+ dest_scan++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, src_alpha);
+ dest_scan += Bpp - 2;
+ continue;
+ }
+ }
+ dest_scan += Bpp;
+ }
+}
+
+void CFX_Renderer::CompositeSpanCMYK(uint8_t* dest_scan,
+ int Bpp,
+ int span_left,
+ int span_len,
+ uint8_t* cover_scan,
+ int clip_left,
+ int clip_right,
+ uint8_t* clip_scan,
+ uint8_t* dest_extra_alpha_scan) {
+ ASSERT(!m_bRgbByteOrder);
+ int col_start = GetColStart(span_left, clip_left);
+ int col_end = GetColEnd(span_left, span_len, clip_right);
+ dest_scan += col_start * 4;
+ if (dest_extra_alpha_scan) {
+ for (int col = col_start; col < col_end; col++) {
+ int src_alpha = m_bFullCover ? GetSrcAlpha(clip_scan, col)
+ : GetSourceAlpha(cover_scan, clip_scan, col);
+ if (src_alpha) {
+ if (src_alpha == 255) {
+ *(reinterpret_cast<FX_CMYK*>(dest_scan)) = m_Color;
+ *dest_extra_alpha_scan = static_cast<uint8_t>(m_Alpha);
+ } else {
+ uint8_t dest_alpha = (*dest_extra_alpha_scan) + src_alpha -
+ (*dest_extra_alpha_scan) * src_alpha / 255;
+ *dest_extra_alpha_scan++ = dest_alpha;
+ int alpha_ratio = src_alpha * 255 / dest_alpha;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, alpha_ratio);
+ dest_scan++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, alpha_ratio);
+ dest_scan++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, alpha_ratio);
+ dest_scan++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Gray, alpha_ratio);
+ dest_scan++;
+ continue;
+ }
+ }
+ dest_extra_alpha_scan++;
+ dest_scan += 4;
+ }
+ return;
+ }
+ for (int col = col_start; col < col_end; col++) {
+ int src_alpha = GetSourceAlpha(cover_scan, clip_scan, col);
+ if (src_alpha) {
+ if (src_alpha == 255) {
+ *(reinterpret_cast<FX_CMYK*>(dest_scan)) = m_Color;
+ } else {
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, src_alpha);
+ dest_scan++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, src_alpha);
+ dest_scan++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, src_alpha);
+ dest_scan++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Gray, src_alpha);
+ dest_scan++;
+ continue;
+ }
+ }
+ dest_scan += 4;
+ }
+}
+
+bool CFX_Renderer::Init(const CFX_RetainPtr<CFX_DIBitmap>& pDevice,
+ const CFX_RetainPtr<CFX_DIBitmap>& pOriDevice,
+ const CFX_ClipRgn* pClipRgn,
+ uint32_t color,
+ bool bFullCover,
+ bool bRgbByteOrder,
+ int alpha_flag,
+ void* pIccTransform) {
+ m_pDevice = pDevice;
+ m_pClipRgn = pClipRgn;
+ composite_span = nullptr;
+ m_bRgbByteOrder = bRgbByteOrder;
+ m_pOriDevice = pOriDevice;
+ if (m_pClipRgn) {
+ m_ClipBox = m_pClipRgn->GetBox();
+ } else {
+ m_ClipBox.left = m_ClipBox.top = 0;
+ m_ClipBox.right = m_pDevice->GetWidth();
+ m_ClipBox.bottom = m_pDevice->GetHeight();
+ }
+ m_pClipMask = nullptr;
+ if (m_pClipRgn && m_pClipRgn->GetType() == CFX_ClipRgn::MaskF)
+ m_pClipMask = m_pClipRgn->GetMask();
+ m_bFullCover = bFullCover;
+ bool bObjectCMYK = !!FXGETFLAG_COLORTYPE(alpha_flag);
+ bool bDeviceCMYK = pDevice->IsCmykImage();
+ m_Alpha = bObjectCMYK ? FXGETFLAG_ALPHA_FILL(alpha_flag) : FXARGB_A(color);
+ CCodec_IccModule* pIccModule = nullptr;
+ if (!CFX_GEModule::Get()->GetCodecModule() ||
+ !CFX_GEModule::Get()->GetCodecModule()->GetIccModule()) {
+ pIccTransform = nullptr;
+ } else {
+ pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule();
+ }
+ if (m_pDevice->GetBPP() == 8) {
+ ASSERT(!m_bRgbByteOrder);
+ composite_span = &CFX_Renderer::CompositeSpanGray;
+ if (m_pDevice->IsAlphaMask()) {
+ m_Gray = 255;
+ } else {
+ if (pIccTransform) {
+ uint8_t gray;
+ color = bObjectCMYK ? FXCMYK_TODIB(color) : FXARGB_TODIB(color);
+ pIccModule->TranslateScanline(pIccTransform, &gray,
+ (const uint8_t*)&color, 1);
+ m_Gray = gray;
+ } else {
+ if (bObjectCMYK) {
+ uint8_t r, g, b;
+ AdobeCMYK_to_sRGB1(FXSYS_GetCValue(color), FXSYS_GetMValue(color),
+ FXSYS_GetYValue(color), FXSYS_GetKValue(color), r,
+ g, b);
+ m_Gray = FXRGB2GRAY(r, g, b);
+ } else {
+ m_Gray =
+ FXRGB2GRAY(FXARGB_R(color), FXARGB_G(color), FXARGB_B(color));
+ }
+ }
+ }
+ return true;
+ }
+ if (bDeviceCMYK) {
+ ASSERT(!m_bRgbByteOrder);
+ composite_span = &CFX_Renderer::CompositeSpanCMYK;
+ if (bObjectCMYK) {
+ m_Color = FXCMYK_TODIB(color);
+ if (pIccTransform) {
+ uint8_t* pColor = reinterpret_cast<uint8_t*>(&m_Color);
+ pIccModule->TranslateScanline(pIccTransform, pColor, pColor, 1);
+ }
+ } else {
+ if (!pIccTransform)
+ return false;
+
+ color = FXARGB_TODIB(color);
+ pIccModule->TranslateScanline(
+ pIccTransform, reinterpret_cast<uint8_t*>(&m_Color),
+ reinterpret_cast<const uint8_t*>(&color), 1);
+ }
+ uint8_t* pColor = reinterpret_cast<uint8_t*>(&m_Color);
+ m_Red = pColor[0];
+ m_Green = pColor[1];
+ m_Blue = pColor[2];
+ m_Gray = pColor[3];
+ } else {
+ composite_span = (pDevice->GetFormat() == FXDIB_Argb)
+ ? &CFX_Renderer::CompositeSpanARGB
+ : &CFX_Renderer::CompositeSpanRGB;
+ if (pIccTransform) {
+ color = bObjectCMYK ? FXCMYK_TODIB(color) : FXARGB_TODIB(color);
+ pIccModule->TranslateScanline(
+ pIccTransform, reinterpret_cast<uint8_t*>(&m_Color),
+ reinterpret_cast<const uint8_t*>(&color), 1);
+ uint8_t* pColor = reinterpret_cast<uint8_t*>(&m_Color);
+ pColor[3] = m_Alpha;
+ m_Red = pColor[2];
+ m_Green = pColor[1];
+ m_Blue = pColor[0];
+ if (m_bRgbByteOrder)
+ m_Color = FXARGB_TOBGRORDERDIB(FXARGB_TODIB(m_Color));
+ } else {
+ if (bObjectCMYK) {
+ uint8_t r, g, b;
+ AdobeCMYK_to_sRGB1(FXSYS_GetCValue(color), FXSYS_GetMValue(color),
+ FXSYS_GetYValue(color), FXSYS_GetKValue(color), r, g,
+ b);
+ m_Color = FXARGB_MAKE(m_Alpha, r, g, b);
+ if (m_bRgbByteOrder)
+ m_Color = FXARGB_TOBGRORDERDIB(m_Color);
+ else
+ m_Color = FXARGB_TODIB(m_Color);
+ m_Red = r;
+ m_Green = g;
+ m_Blue = b;
+ } else {
+ if (m_bRgbByteOrder)
+ m_Color = FXARGB_TOBGRORDERDIB(color);
+ else
+ m_Color = FXARGB_TODIB(color);
+ ArgbDecode(color, m_Alpha, m_Red, m_Green, m_Blue);
+ }
+ }
+ }
+ if (m_pDevice->GetBPP() == 1)
+ composite_span = &CFX_Renderer::CompositeSpan1bpp;
+ return true;
+}
+
+template <class Scanline>
+void CFX_Renderer::render(const Scanline& sl) {
+ if (!m_pOriDevice && !composite_span)
+ return;
+
+ int y = sl.y();
+ if (y < m_ClipBox.top || y >= m_ClipBox.bottom)
+ return;
+
+ uint8_t* dest_scan = m_pDevice->GetBuffer() + m_pDevice->GetPitch() * y;
+ uint8_t* dest_scan_extra_alpha = nullptr;
+ CFX_RetainPtr<CFX_DIBitmap> pAlphaMask = m_pDevice->m_pAlphaMask;
+ if (pAlphaMask) {
+ dest_scan_extra_alpha =
+ pAlphaMask->GetBuffer() + pAlphaMask->GetPitch() * y;
+ }
+ uint8_t* ori_scan = nullptr;
+ if (m_pOriDevice)
+ ori_scan = m_pOriDevice->GetBuffer() + m_pOriDevice->GetPitch() * y;
+ int Bpp = m_pDevice->GetBPP() / 8;
+ bool bDestAlpha = m_pDevice->HasAlpha() || m_pDevice->IsAlphaMask();
+ unsigned num_spans = sl.num_spans();
+ typename Scanline::const_iterator span = sl.begin();
+ while (1) {
+ int x = span->x;
+ ASSERT(span->len > 0);
+ uint8_t* dest_pos = nullptr;
+ uint8_t* dest_extra_alpha_pos = nullptr;
+ uint8_t* ori_pos = nullptr;
+ if (Bpp) {
+ ori_pos = ori_scan ? ori_scan + x * Bpp : nullptr;
+ dest_pos = dest_scan + x * Bpp;
+ dest_extra_alpha_pos =
+ dest_scan_extra_alpha ? dest_scan_extra_alpha + x : nullptr;
+ } else {
+ dest_pos = dest_scan + x / 8;
+ ori_pos = ori_scan ? ori_scan + x / 8 : nullptr;
+ }
+ uint8_t* clip_pos = nullptr;
+ if (m_pClipMask) {
+ clip_pos = m_pClipMask->GetBuffer() +
+ (y - m_ClipBox.top) * m_pClipMask->GetPitch() + x -
+ m_ClipBox.left;
+ }
+ if (ori_pos) {
+ CompositeSpan(dest_pos, ori_pos, Bpp, bDestAlpha, x, span->len,
+ span->covers, m_ClipBox.left, m_ClipBox.right, clip_pos);
+ } else {
+ (this->*composite_span)(dest_pos, Bpp, x, span->len, span->covers,
+ m_ClipBox.left, m_ClipBox.right, clip_pos,
+ dest_extra_alpha_pos);
+ }
+ if (--num_spans == 0)
+ break;
+
+ ++span;
+ }
+}
+
+void CFX_Renderer::CompositeSpan1bppHelper(uint8_t* dest_scan,
+ int col_start,
+ int col_end,
+ const uint8_t* cover_scan,
+ const uint8_t* clip_scan,
+ int span_left) {
+ int index = 0;
+ if (m_pDevice->GetPalette()) {
+ for (int i = 0; i < 2; i++) {
+ if (FXARGB_TODIB(m_pDevice->GetPalette()[i]) == m_Color)
+ index = i;
+ }
+ } else {
+ index = (static_cast<uint8_t>(m_Color) == 0xff) ? 1 : 0;
+ }
+ uint8_t* dest_scan1 = dest_scan;
+ for (int col = col_start; col < col_end; col++) {
+ int src_alpha = GetSourceAlpha(cover_scan, clip_scan, col);
+ if (src_alpha) {
+ if (!index)
+ *dest_scan1 &= ~(1 << (7 - (col + span_left) % 8));
+ else
+ *dest_scan1 |= 1 << (7 - (col + span_left) % 8);
+ }
+ dest_scan1 = dest_scan + (span_left % 8 + col - col_start + 1) / 8;
+ }
+}
+
+} // namespace
+
namespace agg {
template <class BaseRenderer>
@@ -330,7 +1138,7 @@ class renderer_scanline_aa_offset {
int y = sl.y();
unsigned num_spans = sl.num_spans();
typename Scanline::const_iterator span = sl.begin();
- for (;;) {
+ while (1) {
int x = span->x;
if (span->len > 0) {
m_ren->blend_solid_hspan(x - m_left, y - m_top, (unsigned)span->len,
@@ -339,9 +1147,9 @@ class renderer_scanline_aa_offset {
m_ren->blend_hline(x - m_left, y - m_top, (unsigned)(x - span->len - 1),
m_color, *(span->covers));
}
- if (--num_spans == 0) {
+ if (--num_spans == 0)
break;
- }
+
++span;
}
}
@@ -354,84 +1162,53 @@ class renderer_scanline_aa_offset {
} // namespace agg
-static void RasterizeStroke(agg::rasterizer_scanline_aa& rasterizer,
- agg::path_storage& path_data,
- const CFX_Matrix* pObject2Device,
- const CFX_GraphStateData* pGraphState,
- FX_FLOAT scale = 1.0f,
- bool bStrokeAdjust = false,
- bool bTextMode = false) {
- agg::line_cap_e cap;
- switch (pGraphState->m_LineCap) {
- case CFX_GraphStateData::LineCapRound:
- cap = agg::round_cap;
- break;
- case CFX_GraphStateData::LineCapSquare:
- cap = agg::square_cap;
- break;
- default:
- cap = agg::butt_cap;
- break;
- }
- agg::line_join_e join;
- switch (pGraphState->m_LineJoin) {
- case CFX_GraphStateData::LineJoinRound:
- join = agg::round_join;
- break;
- case CFX_GraphStateData::LineJoinBevel:
- join = agg::bevel_join;
- break;
- default:
- join = agg::miter_join_revert;
- break;
- }
- FX_FLOAT width = pGraphState->m_LineWidth * scale;
- FX_FLOAT unit = 1.f;
- if (pObject2Device) {
- unit =
- 1.0f / ((pObject2Device->GetXUnit() + pObject2Device->GetYUnit()) / 2);
- }
- if (width < unit) {
- width = unit;
- }
- if (pGraphState->m_DashArray) {
- typedef agg::conv_dash<agg::path_storage> dash_converter;
- dash_converter dash(path_data);
- for (int i = 0; i < (pGraphState->m_DashCount + 1) / 2; i++) {
- FX_FLOAT on = pGraphState->m_DashArray[i * 2];
- if (on <= 0.000001f) {
- on = 1.0f / 10;
+void CAgg_PathData::BuildPath(const CFX_PathData* pPathData,
+ const CFX_Matrix* pObject2Device) {
+ const std::vector<FX_PATHPOINT>& pPoints = pPathData->GetPoints();
+ for (size_t i = 0; i < pPoints.size(); i++) {
+ CFX_PointF pos = pPoints[i].m_Point;
+ if (pObject2Device)
+ pos = pObject2Device->Transform(pos);
+
+ pos = HardClip(pos);
+ FXPT_TYPE point_type = pPoints[i].m_Type;
+ if (point_type == FXPT_TYPE::MoveTo) {
+ m_PathData.move_to(pos.x, pos.y);
+ } else if (point_type == FXPT_TYPE::LineTo) {
+ if (pPoints[i - 1].IsTypeAndOpen(FXPT_TYPE::MoveTo) &&
+ (i == pPoints.size() - 1 ||
+ pPoints[i + 1].IsTypeAndOpen(FXPT_TYPE::MoveTo)) &&
+ pPoints[i].m_Point == pPoints[i - 1].m_Point) {
+ pos.x += 1;
}
- FX_FLOAT off = i * 2 + 1 == pGraphState->m_DashCount
- ? on
- : pGraphState->m_DashArray[i * 2 + 1];
- if (off < 0) {
- off = 0;
+ m_PathData.line_to(pos.x, pos.y);
+ } else if (point_type == FXPT_TYPE::BezierTo) {
+ CFX_PointF pos0 = pPoints[i - 1].m_Point;
+ CFX_PointF pos2 = pPoints[i + 1].m_Point;
+ CFX_PointF pos3 = pPoints[i + 2].m_Point;
+ if (pObject2Device) {
+ pos0 = pObject2Device->Transform(pos0);
+ pos2 = pObject2Device->Transform(pos2);
+ pos3 = pObject2Device->Transform(pos3);
}
- dash.add_dash(on * scale, off * scale);
+ pos0 = HardClip(pos0);
+ pos2 = HardClip(pos2);
+ pos3 = HardClip(pos3);
+ agg::curve4 curve(pos0.x, pos0.y, pos.x, pos.y, pos2.x, pos2.y, pos3.x,
+ pos3.y);
+ i += 2;
+ m_PathData.add_path_curve(curve);
}
- dash.dash_start(pGraphState->m_DashPhase * scale);
- typedef agg::conv_stroke<dash_converter> dash_stroke;
- dash_stroke stroke(dash);
- stroke.line_join(join);
- stroke.line_cap(cap);
- stroke.miter_limit(pGraphState->m_MiterLimit);
- stroke.width(width);
- rasterizer.add_path_transformed(stroke, pObject2Device);
- } else {
- agg::conv_stroke<agg::path_storage> stroke(path_data);
- stroke.line_join(join);
- stroke.line_cap(cap);
- stroke.miter_limit(pGraphState->m_MiterLimit);
- stroke.width(width);
- rasterizer.add_path_transformed(stroke, pObject2Device);
+ if (pPoints[i].m_CloseFigure)
+ m_PathData.end_poly();
}
}
-CFX_AggDeviceDriver::CFX_AggDeviceDriver(CFX_DIBitmap* pBitmap,
- bool bRgbByteOrder,
- CFX_DIBitmap* pOriDevice,
- bool bGroupKnockout)
+CFX_AggDeviceDriver::CFX_AggDeviceDriver(
+ const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
+ bool bRgbByteOrder,
+ const CFX_RetainPtr<CFX_DIBitmap>& pOriDevice,
+ bool bGroupKnockout)
: m_pBitmap(pBitmap),
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
m_pPlatformGraphics(nullptr),
@@ -460,7 +1237,7 @@ bool CFX_AggDeviceDriver::DrawDeviceText(int nChars,
const FXTEXT_CHARPOS* pCharPos,
CFX_Font* pFont,
const CFX_Matrix* pObject2Device,
- FX_FLOAT font_size,
+ float font_size,
uint32_t color) {
return false;
}
@@ -485,19 +1262,18 @@ int CFX_AggDeviceDriver::GetDeviceCaps(int caps_id) const {
if (m_pBitmap->HasAlpha()) {
flags |= FXRC_ALPHA_OUTPUT;
} else if (m_pBitmap->IsAlphaMask()) {
- if (m_pBitmap->GetBPP() == 1) {
+ if (m_pBitmap->GetBPP() == 1)
flags |= FXRC_BITMASK_OUTPUT;
- } else {
+ else
flags |= FXRC_BYTEMASK_OUTPUT;
- }
}
- if (m_pBitmap->IsCmykImage()) {
+ if (m_pBitmap->IsCmykImage())
flags |= FXRC_CMYK_OUTPUT;
- }
return flags;
}
+ default:
+ return 0;
}
- return 0;
}
void CFX_AggDeviceDriver::SaveState() {
@@ -526,8 +1302,7 @@ void CFX_AggDeviceDriver::SetClipMask(agg::rasterizer_scanline_aa& rasterizer) {
FX_RECT path_rect(rasterizer.min_x(), rasterizer.min_y(),
rasterizer.max_x() + 1, rasterizer.max_y() + 1);
path_rect.Intersect(m_pClipRgn->GetBox());
- CFX_DIBitmapRef mask;
- CFX_DIBitmap* pThisLayer = mask.Emplace();
+ auto pThisLayer = pdfium::MakeRetain<CFX_DIBitmap>();
pThisLayer->Create(path_rect.Width(), path_rect.Height(), FXDIB_8bppMask);
pThisLayer->Clear(0);
agg::rendering_buffer raw_buf(pThisLayer->GetBuffer(), pThisLayer->GetWidth(),
@@ -541,7 +1316,7 @@ void CFX_AggDeviceDriver::SetClipMask(agg::rasterizer_scanline_aa& rasterizer) {
agg::scanline_u8 scanline;
agg::render_scanlines(rasterizer, scanline, final_render,
(m_FillFlags & FXFILL_NOPATHSMOOTH) != 0);
- m_pClipRgn->IntersectMaskF(path_rect.left, path_rect.top, mask);
+ m_pClipRgn->IntersectMaskF(path_rect.left, path_rect.top, pThisLayer);
}
bool CFX_AggDeviceDriver::SetClip_PathFill(const CFX_PathData* pPathData,
@@ -556,9 +1331,9 @@ bool CFX_AggDeviceDriver::SetClip_PathFill(const CFX_PathData* pPathData,
if (size == 5 || size == 4) {
CFX_FloatRect rectf;
if (pPathData->IsRect(pObject2Device, &rectf)) {
- rectf.Intersect(
- CFX_FloatRect(0, 0, (FX_FLOAT)GetDeviceCaps(FXDC_PIXEL_WIDTH),
- (FX_FLOAT)GetDeviceCaps(FXDC_PIXEL_HEIGHT)));
+ rectf.Intersect(CFX_FloatRect(
+ 0, 0, static_cast<float>(GetDeviceCaps(FXDC_PIXEL_WIDTH)),
+ static_cast<float>(GetDeviceCaps(FXDC_PIXEL_HEIGHT))));
FX_RECT rect = rectf.GetOuterRect();
m_pClipRgn->IntersectRect(rect);
return true;
@@ -568,8 +1343,9 @@ bool CFX_AggDeviceDriver::SetClip_PathFill(const CFX_PathData* pPathData,
path_data.BuildPath(pPathData, pObject2Device);
path_data.m_PathData.end_poly();
agg::rasterizer_scanline_aa rasterizer;
- rasterizer.clip_box(0.0f, 0.0f, (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_WIDTH)),
- (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_HEIGHT)));
+ rasterizer.clip_box(0.0f, 0.0f,
+ static_cast<float>(GetDeviceCaps(FXDC_PIXEL_WIDTH)),
+ static_cast<float>(GetDeviceCaps(FXDC_PIXEL_HEIGHT)));
rasterizer.add_path(path_data.m_PathData);
rasterizer.filling_rule((fill_mode & 3) == FXFILL_WINDING
? agg::fill_non_zero
@@ -589,843 +1365,16 @@ bool CFX_AggDeviceDriver::SetClip_PathStroke(
CAgg_PathData path_data;
path_data.BuildPath(pPathData, nullptr);
agg::rasterizer_scanline_aa rasterizer;
- rasterizer.clip_box(0.0f, 0.0f, (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_WIDTH)),
- (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_HEIGHT)));
- RasterizeStroke(rasterizer, path_data.m_PathData, pObject2Device,
- pGraphState);
+ rasterizer.clip_box(0.0f, 0.0f,
+ static_cast<float>(GetDeviceCaps(FXDC_PIXEL_WIDTH)),
+ static_cast<float>(GetDeviceCaps(FXDC_PIXEL_HEIGHT)));
+ RasterizeStroke(&rasterizer, &path_data.m_PathData, pObject2Device,
+ pGraphState, 1.0f, false, false);
rasterizer.filling_rule(agg::fill_non_zero);
SetClipMask(rasterizer);
return true;
}
-class CFX_Renderer {
- private:
- int m_Alpha, m_Red, m_Green, m_Blue, m_Gray;
- uint32_t m_Color;
- bool m_bFullCover;
- bool m_bRgbByteOrder;
- CFX_DIBitmap* m_pOriDevice;
- FX_RECT m_ClipBox;
- const CFX_DIBitmap* m_pClipMask;
- CFX_DIBitmap* m_pDevice;
- const CFX_ClipRgn* m_pClipRgn;
- void (CFX_Renderer::*composite_span)(uint8_t*,
- int,
- int,
- int,
- uint8_t*,
- int,
- int,
- uint8_t*,
- uint8_t*);
-
- public:
- void prepare(unsigned) {}
-
- void CompositeSpan(uint8_t* dest_scan,
- uint8_t* ori_scan,
- int Bpp,
- bool bDestAlpha,
- int span_left,
- int span_len,
- uint8_t* cover_scan,
- int clip_left,
- int clip_right,
- uint8_t* clip_scan) {
- ASSERT(!m_pDevice->IsCmykImage());
- int col_start = span_left < clip_left ? clip_left - span_left : 0;
- int col_end = (span_left + span_len) < clip_right
- ? span_len
- : (clip_right - span_left);
- if (Bpp) {
- dest_scan += col_start * Bpp;
- ori_scan += col_start * Bpp;
- } else {
- dest_scan += col_start / 8;
- ori_scan += col_start / 8;
- }
- if (m_bRgbByteOrder) {
- if (Bpp == 4 && bDestAlpha) {
- for (int col = col_start; col < col_end; col++) {
- int src_alpha;
- if (clip_scan) {
- src_alpha = m_Alpha * clip_scan[col] / 255;
- } else {
- src_alpha = m_Alpha;
- }
- uint8_t dest_alpha =
- ori_scan[3] + src_alpha - ori_scan[3] * src_alpha / 255;
- dest_scan[3] = dest_alpha;
- int alpha_ratio = src_alpha * 255 / dest_alpha;
- if (m_bFullCover) {
- *dest_scan++ = FXDIB_ALPHA_MERGE(*ori_scan++, m_Red, alpha_ratio);
- *dest_scan++ = FXDIB_ALPHA_MERGE(*ori_scan++, m_Green, alpha_ratio);
- *dest_scan++ = FXDIB_ALPHA_MERGE(*ori_scan++, m_Blue, alpha_ratio);
- dest_scan++;
- ori_scan++;
- } else {
- int r = FXDIB_ALPHA_MERGE(*ori_scan++, m_Red, alpha_ratio);
- int g = FXDIB_ALPHA_MERGE(*ori_scan++, m_Green, alpha_ratio);
- int b = FXDIB_ALPHA_MERGE(*ori_scan++, m_Blue, alpha_ratio);
- ori_scan++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, r, cover_scan[col]);
- dest_scan++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, g, cover_scan[col]);
- dest_scan++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, b, cover_scan[col]);
- dest_scan += 2;
- }
- }
- return;
- }
- if (Bpp == 3 || Bpp == 4) {
- for (int col = col_start; col < col_end; col++) {
- int src_alpha;
- if (clip_scan) {
- src_alpha = m_Alpha * clip_scan[col] / 255;
- } else {
- src_alpha = m_Alpha;
- }
- int r = FXDIB_ALPHA_MERGE(*ori_scan++, m_Red, src_alpha);
- int g = FXDIB_ALPHA_MERGE(*ori_scan++, m_Green, src_alpha);
- int b = FXDIB_ALPHA_MERGE(*ori_scan, m_Blue, src_alpha);
- ori_scan += Bpp - 2;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, r, cover_scan[col]);
- dest_scan++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, g, cover_scan[col]);
- dest_scan++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, b, cover_scan[col]);
- dest_scan += Bpp - 2;
- }
- }
- return;
- }
- if (Bpp == 4 && bDestAlpha) {
- for (int col = col_start; col < col_end; col++) {
- int src_alpha;
- if (clip_scan) {
- src_alpha = m_Alpha * clip_scan[col] / 255;
- } else {
- src_alpha = m_Alpha;
- }
- int src_alpha_covered = src_alpha * cover_scan[col] / 255;
- if (src_alpha_covered == 0) {
- dest_scan += 4;
- continue;
- }
- if (cover_scan[col] == 255) {
- dest_scan[3] = src_alpha_covered;
- *dest_scan++ = m_Blue;
- *dest_scan++ = m_Green;
- *dest_scan = m_Red;
- dest_scan += 2;
- continue;
- } else {
- if (dest_scan[3] == 0) {
- dest_scan[3] = src_alpha_covered;
- *dest_scan++ = m_Blue;
- *dest_scan++ = m_Green;
- *dest_scan = m_Red;
- dest_scan += 2;
- continue;
- }
- uint8_t cover = cover_scan[col];
- dest_scan[3] = FXDIB_ALPHA_MERGE(dest_scan[3], src_alpha, cover);
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, cover);
- dest_scan++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, cover);
- dest_scan++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, cover);
- dest_scan += 2;
- }
- }
- return;
- }
- if (Bpp == 3 || Bpp == 4) {
- for (int col = col_start; col < col_end; col++) {
- int src_alpha;
- if (clip_scan) {
- src_alpha = m_Alpha * clip_scan[col] / 255;
- } else {
- src_alpha = m_Alpha;
- }
- if (m_bFullCover) {
- *dest_scan++ = FXDIB_ALPHA_MERGE(*ori_scan++, m_Blue, src_alpha);
- *dest_scan++ = FXDIB_ALPHA_MERGE(*ori_scan++, m_Green, src_alpha);
- *dest_scan = FXDIB_ALPHA_MERGE(*ori_scan, m_Red, src_alpha);
- dest_scan += Bpp - 2;
- ori_scan += Bpp - 2;
- continue;
- }
- int b = FXDIB_ALPHA_MERGE(*ori_scan++, m_Blue, src_alpha);
- int g = FXDIB_ALPHA_MERGE(*ori_scan++, m_Green, src_alpha);
- int r = FXDIB_ALPHA_MERGE(*ori_scan, m_Red, src_alpha);
- ori_scan += Bpp - 2;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, b, cover_scan[col]);
- dest_scan++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, g, cover_scan[col]);
- dest_scan++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, r, cover_scan[col]);
- dest_scan += Bpp - 2;
- continue;
- }
- return;
- }
- if (Bpp == 1) {
- for (int col = col_start; col < col_end; col++) {
- int src_alpha;
- if (clip_scan) {
- src_alpha = m_Alpha * clip_scan[col] / 255;
- } else {
- src_alpha = m_Alpha;
- }
- if (m_bFullCover) {
- *dest_scan = FXDIB_ALPHA_MERGE(*ori_scan++, m_Gray, src_alpha);
- } else {
- int gray = FXDIB_ALPHA_MERGE(*ori_scan++, m_Gray, src_alpha);
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, cover_scan[col]);
- dest_scan++;
- }
- }
- } else {
- int index = 0;
- if (m_pDevice->GetPalette()) {
- for (int i = 0; i < 2; i++) {
- if (FXARGB_TODIB(m_pDevice->GetPalette()[i]) == m_Color) {
- index = i;
- }
- }
- } else {
- index = ((uint8_t)m_Color == 0xff) ? 1 : 0;
- }
- uint8_t* dest_scan1 = dest_scan;
- for (int col = col_start; col < col_end; col++) {
- int src_alpha;
- if (clip_scan) {
- src_alpha = m_Alpha * cover_scan[col] * clip_scan[col] / 255 / 255;
- } else {
- src_alpha = m_Alpha * cover_scan[col] / 255;
- }
- if (src_alpha) {
- if (!index) {
- *dest_scan1 &= ~(1 << (7 - (col + span_left) % 8));
- } else {
- *dest_scan1 |= 1 << (7 - (col + span_left) % 8);
- }
- }
- dest_scan1 = dest_scan + (span_left % 8 + col - col_start + 1) / 8;
- }
- }
- }
-
- void CompositeSpan1bpp(uint8_t* dest_scan,
- int Bpp,
- int span_left,
- int span_len,
- uint8_t* cover_scan,
- int clip_left,
- int clip_right,
- uint8_t* clip_scan,
- uint8_t* dest_extra_alpha_scan) {
- ASSERT(!m_bRgbByteOrder);
- ASSERT(!m_pDevice->IsCmykImage());
- int col_start = span_left < clip_left ? clip_left - span_left : 0;
- int col_end = (span_left + span_len) < clip_right
- ? span_len
- : (clip_right - span_left);
- dest_scan += col_start / 8;
- int index = 0;
- if (m_pDevice->GetPalette()) {
- for (int i = 0; i < 2; i++) {
- if (FXARGB_TODIB(m_pDevice->GetPalette()[i]) == m_Color) {
- index = i;
- }
- }
- } else {
- index = ((uint8_t)m_Color == 0xff) ? 1 : 0;
- }
- uint8_t* dest_scan1 = dest_scan;
- for (int col = col_start; col < col_end; col++) {
- int src_alpha;
- if (clip_scan) {
- src_alpha = m_Alpha * cover_scan[col] * clip_scan[col] / 255 / 255;
- } else {
- src_alpha = m_Alpha * cover_scan[col] / 255;
- }
- if (src_alpha) {
- if (!index) {
- *dest_scan1 &= ~(1 << (7 - (col + span_left) % 8));
- } else {
- *dest_scan1 |= 1 << (7 - (col + span_left) % 8);
- }
- }
- dest_scan1 = dest_scan + (span_left % 8 + col - col_start + 1) / 8;
- }
- }
-
- void CompositeSpanGray(uint8_t* dest_scan,
- int Bpp,
- int span_left,
- int span_len,
- uint8_t* cover_scan,
- int clip_left,
- int clip_right,
- uint8_t* clip_scan,
- uint8_t* dest_extra_alpha_scan) {
- ASSERT(!m_bRgbByteOrder);
- int col_start = span_left < clip_left ? clip_left - span_left : 0;
- int col_end = (span_left + span_len) < clip_right
- ? span_len
- : (clip_right - span_left);
- dest_scan += col_start;
- if (dest_extra_alpha_scan) {
- for (int col = col_start; col < col_end; col++) {
- int src_alpha;
- if (m_bFullCover) {
- if (clip_scan) {
- src_alpha = m_Alpha * clip_scan[col] / 255;
- } else {
- src_alpha = m_Alpha;
- }
- } else {
- if (clip_scan) {
- src_alpha = m_Alpha * cover_scan[col] * clip_scan[col] / 255 / 255;
- } else {
- src_alpha = m_Alpha * cover_scan[col] / 255;
- }
- }
- if (src_alpha) {
- if (src_alpha == 255) {
- *dest_scan = m_Gray;
- *dest_extra_alpha_scan = m_Alpha;
- } else {
- uint8_t dest_alpha = (*dest_extra_alpha_scan) + src_alpha -
- (*dest_extra_alpha_scan) * src_alpha / 255;
- *dest_extra_alpha_scan++ = dest_alpha;
- int alpha_ratio = src_alpha * 255 / dest_alpha;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Gray, alpha_ratio);
- dest_scan++;
- continue;
- }
- }
- dest_extra_alpha_scan++;
- dest_scan++;
- }
- } else {
- for (int col = col_start; col < col_end; col++) {
- int src_alpha;
- if (clip_scan) {
- src_alpha = m_Alpha * cover_scan[col] * clip_scan[col] / 255 / 255;
- } else {
- src_alpha = m_Alpha * cover_scan[col] / 255;
- }
- if (src_alpha) {
- if (src_alpha == 255) {
- *dest_scan = m_Gray;
- } else {
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Gray, src_alpha);
- }
- }
- dest_scan++;
- }
- }
- }
-
- void CompositeSpanARGB(uint8_t* dest_scan,
- int Bpp,
- int span_left,
- int span_len,
- uint8_t* cover_scan,
- int clip_left,
- int clip_right,
- uint8_t* clip_scan,
- uint8_t* dest_extra_alpha_scan) {
- int col_start = span_left < clip_left ? clip_left - span_left : 0;
- int col_end = (span_left + span_len) < clip_right
- ? span_len
- : (clip_right - span_left);
- dest_scan += col_start * Bpp;
- if (m_bRgbByteOrder) {
- for (int col = col_start; col < col_end; col++) {
- int src_alpha;
- if (m_bFullCover) {
- if (clip_scan) {
- src_alpha = m_Alpha * clip_scan[col] / 255;
- } else {
- src_alpha = m_Alpha;
- }
- } else {
- if (clip_scan) {
- src_alpha = m_Alpha * cover_scan[col] * clip_scan[col] / 255 / 255;
- } else {
- src_alpha = m_Alpha * cover_scan[col] / 255;
- }
- }
- if (src_alpha) {
- if (src_alpha == 255) {
- *(uint32_t*)dest_scan = m_Color;
- } else {
- uint8_t dest_alpha =
- dest_scan[3] + src_alpha - dest_scan[3] * src_alpha / 255;
- dest_scan[3] = dest_alpha;
- int alpha_ratio = src_alpha * 255 / dest_alpha;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, alpha_ratio);
- dest_scan++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, alpha_ratio);
- dest_scan++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, alpha_ratio);
- dest_scan += 2;
- continue;
- }
- }
- dest_scan += 4;
- }
- return;
- }
- for (int col = col_start; col < col_end; col++) {
- int src_alpha;
- if (m_bFullCover) {
- if (clip_scan) {
- src_alpha = m_Alpha * clip_scan[col] / 255;
- } else {
- src_alpha = m_Alpha;
- }
- } else {
- if (clip_scan) {
- src_alpha = m_Alpha * cover_scan[col] * clip_scan[col] / 255 / 255;
- } else {
- src_alpha = m_Alpha * cover_scan[col] / 255;
- }
- }
- if (src_alpha) {
- if (src_alpha == 255) {
- *(uint32_t*)dest_scan = m_Color;
- } else {
- if (dest_scan[3] == 0) {
- dest_scan[3] = src_alpha;
- *dest_scan++ = m_Blue;
- *dest_scan++ = m_Green;
- *dest_scan = m_Red;
- dest_scan += 2;
- continue;
- }
- uint8_t dest_alpha =
- dest_scan[3] + src_alpha - dest_scan[3] * src_alpha / 255;
- dest_scan[3] = dest_alpha;
- int alpha_ratio = src_alpha * 255 / dest_alpha;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, alpha_ratio);
- dest_scan++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, alpha_ratio);
- dest_scan++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, alpha_ratio);
- dest_scan += 2;
- continue;
- }
- }
- dest_scan += Bpp;
- }
- }
-
- void CompositeSpanRGB(uint8_t* dest_scan,
- int Bpp,
- int span_left,
- int span_len,
- uint8_t* cover_scan,
- int clip_left,
- int clip_right,
- uint8_t* clip_scan,
- uint8_t* dest_extra_alpha_scan) {
- int col_start = span_left < clip_left ? clip_left - span_left : 0;
- int col_end = (span_left + span_len) < clip_right
- ? span_len
- : (clip_right - span_left);
- dest_scan += col_start * Bpp;
- if (m_bRgbByteOrder) {
- for (int col = col_start; col < col_end; col++) {
- int src_alpha;
- if (clip_scan) {
- src_alpha = m_Alpha * cover_scan[col] * clip_scan[col] / 255 / 255;
- } else {
- src_alpha = m_Alpha * cover_scan[col] / 255;
- }
- if (src_alpha) {
- if (src_alpha == 255) {
- if (Bpp == 4) {
- *(uint32_t*)dest_scan = m_Color;
- } else if (Bpp == 3) {
- *dest_scan++ = m_Red;
- *dest_scan++ = m_Green;
- *dest_scan++ = m_Blue;
- continue;
- }
- } else {
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, src_alpha);
- dest_scan++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, src_alpha);
- dest_scan++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, src_alpha);
- dest_scan += Bpp - 2;
- continue;
- }
- }
- dest_scan += Bpp;
- }
- return;
- }
- if (Bpp == 3 && dest_extra_alpha_scan) {
- for (int col = col_start; col < col_end; col++) {
- int src_alpha;
- if (m_bFullCover) {
- if (clip_scan) {
- src_alpha = m_Alpha * clip_scan[col] / 255;
- } else {
- src_alpha = m_Alpha;
- }
- } else {
- if (clip_scan) {
- src_alpha = m_Alpha * cover_scan[col] * clip_scan[col] / 255 / 255;
- } else {
- src_alpha = m_Alpha * cover_scan[col] / 255;
- }
- }
- if (src_alpha) {
- if (src_alpha == 255) {
- *dest_scan++ = (uint8_t)m_Blue;
- *dest_scan++ = (uint8_t)m_Green;
- *dest_scan++ = (uint8_t)m_Red;
- *dest_extra_alpha_scan++ = (uint8_t)m_Alpha;
- continue;
- } else {
- uint8_t dest_alpha = (*dest_extra_alpha_scan) + src_alpha -
- (*dest_extra_alpha_scan) * src_alpha / 255;
- *dest_extra_alpha_scan++ = dest_alpha;
- int alpha_ratio = src_alpha * 255 / dest_alpha;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, alpha_ratio);
- dest_scan++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, alpha_ratio);
- dest_scan++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, alpha_ratio);
- dest_scan++;
- continue;
- }
- }
- dest_extra_alpha_scan++;
- dest_scan += Bpp;
- }
- } else {
- for (int col = col_start; col < col_end; col++) {
- int src_alpha;
- if (m_bFullCover) {
- if (clip_scan) {
- src_alpha = m_Alpha * clip_scan[col] / 255;
- } else {
- src_alpha = m_Alpha;
- }
- } else {
- if (clip_scan) {
- src_alpha = m_Alpha * cover_scan[col] * clip_scan[col] / 255 / 255;
- } else {
- src_alpha = m_Alpha * cover_scan[col] / 255;
- }
- }
- if (src_alpha) {
- if (src_alpha == 255) {
- if (Bpp == 4) {
- *(uint32_t*)dest_scan = m_Color;
- } else if (Bpp == 3) {
- *dest_scan++ = m_Blue;
- *dest_scan++ = m_Green;
- *dest_scan++ = m_Red;
- continue;
- }
- } else {
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, src_alpha);
- dest_scan++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, src_alpha);
- dest_scan++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, src_alpha);
- dest_scan += Bpp - 2;
- continue;
- }
- }
- dest_scan += Bpp;
- }
- }
- }
-
- void CompositeSpanCMYK(uint8_t* dest_scan,
- int Bpp,
- int span_left,
- int span_len,
- uint8_t* cover_scan,
- int clip_left,
- int clip_right,
- uint8_t* clip_scan,
- uint8_t* dest_extra_alpha_scan) {
- ASSERT(!m_bRgbByteOrder);
- int col_start = span_left < clip_left ? clip_left - span_left : 0;
- int col_end = (span_left + span_len) < clip_right
- ? span_len
- : (clip_right - span_left);
- dest_scan += col_start * 4;
- if (dest_extra_alpha_scan) {
- for (int col = col_start; col < col_end; col++) {
- int src_alpha;
- if (m_bFullCover) {
- if (clip_scan) {
- src_alpha = m_Alpha * clip_scan[col] / 255;
- } else {
- src_alpha = m_Alpha;
- }
- } else {
- if (clip_scan) {
- src_alpha = m_Alpha * cover_scan[col] * clip_scan[col] / 255 / 255;
- } else {
- src_alpha = m_Alpha * cover_scan[col] / 255;
- }
- }
- if (src_alpha) {
- if (src_alpha == 255) {
- *(FX_CMYK*)dest_scan = m_Color;
- *dest_extra_alpha_scan = (uint8_t)m_Alpha;
- } else {
- uint8_t dest_alpha = (*dest_extra_alpha_scan) + src_alpha -
- (*dest_extra_alpha_scan) * src_alpha / 255;
- *dest_extra_alpha_scan++ = dest_alpha;
- int alpha_ratio = src_alpha * 255 / dest_alpha;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, alpha_ratio);
- dest_scan++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, alpha_ratio);
- dest_scan++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, alpha_ratio);
- dest_scan++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Gray, alpha_ratio);
- dest_scan++;
- continue;
- }
- }
- dest_extra_alpha_scan++;
- dest_scan += 4;
- }
- } else {
- for (int col = col_start; col < col_end; col++) {
- int src_alpha;
- if (clip_scan) {
- src_alpha = m_Alpha * cover_scan[col] * clip_scan[col] / 255 / 255;
- } else {
- src_alpha = m_Alpha * cover_scan[col] / 255;
- }
- if (src_alpha) {
- if (src_alpha == 255) {
- *(FX_CMYK*)dest_scan = m_Color;
- } else {
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, src_alpha);
- dest_scan++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, src_alpha);
- dest_scan++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, src_alpha);
- dest_scan++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Gray, src_alpha);
- dest_scan++;
- continue;
- }
- }
- dest_scan += 4;
- }
- }
- }
-
- template <class Scanline>
- void render(const Scanline& sl) {
- if (!m_pOriDevice && !composite_span) {
- return;
- }
- int y = sl.y();
- if (y < m_ClipBox.top || y >= m_ClipBox.bottom) {
- return;
- }
- uint8_t* dest_scan = m_pDevice->GetBuffer() + m_pDevice->GetPitch() * y;
- uint8_t* dest_scan_extra_alpha = nullptr;
- CFX_DIBitmap* pAlphaMask = m_pDevice->m_pAlphaMask;
- if (pAlphaMask) {
- dest_scan_extra_alpha =
- pAlphaMask->GetBuffer() + pAlphaMask->GetPitch() * y;
- }
- uint8_t* ori_scan = nullptr;
- if (m_pOriDevice) {
- ori_scan = m_pOriDevice->GetBuffer() + m_pOriDevice->GetPitch() * y;
- }
- int Bpp = m_pDevice->GetBPP() / 8;
- bool bDestAlpha = m_pDevice->HasAlpha() || m_pDevice->IsAlphaMask();
- unsigned num_spans = sl.num_spans();
- typename Scanline::const_iterator span = sl.begin();
- while (1) {
- int x = span->x;
- ASSERT(span->len > 0);
- uint8_t* dest_pos = nullptr;
- uint8_t* dest_extra_alpha_pos = nullptr;
- uint8_t* ori_pos = nullptr;
- if (Bpp) {
- ori_pos = ori_scan ? ori_scan + x * Bpp : nullptr;
- dest_pos = dest_scan + x * Bpp;
- dest_extra_alpha_pos =
- dest_scan_extra_alpha ? dest_scan_extra_alpha + x : nullptr;
- } else {
- dest_pos = dest_scan + x / 8;
- ori_pos = ori_scan ? ori_scan + x / 8 : nullptr;
- }
- uint8_t* clip_pos = nullptr;
- if (m_pClipMask) {
- clip_pos = m_pClipMask->GetBuffer() +
- (y - m_ClipBox.top) * m_pClipMask->GetPitch() + x -
- m_ClipBox.left;
- }
- if (ori_pos) {
- CompositeSpan(dest_pos, ori_pos, Bpp, bDestAlpha, x, span->len,
- span->covers, m_ClipBox.left, m_ClipBox.right, clip_pos);
- } else {
- (this->*composite_span)(dest_pos, Bpp, x, span->len, span->covers,
- m_ClipBox.left, m_ClipBox.right, clip_pos,
- dest_extra_alpha_pos);
- }
- if (--num_spans == 0) {
- break;
- }
- ++span;
- }
- }
-
- bool Init(CFX_DIBitmap* pDevice,
- CFX_DIBitmap* pOriDevice,
- const CFX_ClipRgn* pClipRgn,
- uint32_t color,
- bool bFullCover,
- bool bRgbByteOrder,
- int alpha_flag = 0,
- void* pIccTransform = nullptr) {
- m_pDevice = pDevice;
- m_pClipRgn = pClipRgn;
- composite_span = nullptr;
- m_bRgbByteOrder = bRgbByteOrder;
- m_pOriDevice = pOriDevice;
- if (m_pClipRgn) {
- m_ClipBox = m_pClipRgn->GetBox();
- } else {
- m_ClipBox.left = m_ClipBox.top = 0;
- m_ClipBox.right = m_pDevice->GetWidth();
- m_ClipBox.bottom = m_pDevice->GetHeight();
- }
- m_pClipMask = nullptr;
- if (m_pClipRgn && m_pClipRgn->GetType() == CFX_ClipRgn::MaskF) {
- m_pClipMask = m_pClipRgn->GetMask().GetObject();
- }
- m_bFullCover = bFullCover;
- bool bObjectCMYK = !!FXGETFLAG_COLORTYPE(alpha_flag);
- bool bDeviceCMYK = pDevice->IsCmykImage();
- m_Alpha = bObjectCMYK ? FXGETFLAG_ALPHA_FILL(alpha_flag) : FXARGB_A(color);
- CCodec_IccModule* pIccModule = nullptr;
- if (!CFX_GEModule::Get()->GetCodecModule() ||
- !CFX_GEModule::Get()->GetCodecModule()->GetIccModule()) {
- pIccTransform = nullptr;
- } else {
- pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule();
- }
- if (m_pDevice->GetBPP() == 8) {
- ASSERT(!m_bRgbByteOrder);
- composite_span = &CFX_Renderer::CompositeSpanGray;
- if (m_pDevice->IsAlphaMask()) {
- m_Gray = 255;
- } else {
- if (pIccTransform) {
- uint8_t gray;
- color = bObjectCMYK ? FXCMYK_TODIB(color) : FXARGB_TODIB(color);
- pIccModule->TranslateScanline(pIccTransform, &gray,
- (const uint8_t*)&color, 1);
- m_Gray = gray;
- } else {
- if (bObjectCMYK) {
- uint8_t r, g, b;
- AdobeCMYK_to_sRGB1(FXSYS_GetCValue(color), FXSYS_GetMValue(color),
- FXSYS_GetYValue(color), FXSYS_GetKValue(color),
- r, g, b);
- m_Gray = FXRGB2GRAY(r, g, b);
- } else {
- m_Gray =
- FXRGB2GRAY(FXARGB_R(color), FXARGB_G(color), FXARGB_B(color));
- }
- }
- }
- return true;
- }
- if (bDeviceCMYK) {
- ASSERT(!m_bRgbByteOrder);
- composite_span = &CFX_Renderer::CompositeSpanCMYK;
- if (bObjectCMYK) {
- m_Color = FXCMYK_TODIB(color);
- if (pIccTransform) {
- pIccModule->TranslateScanline(pIccTransform, (uint8_t*)&m_Color,
- (const uint8_t*)&m_Color, 1);
- }
- } else {
- if (!pIccTransform) {
- return false;
- }
- color = FXARGB_TODIB(color);
- pIccModule->TranslateScanline(pIccTransform, (uint8_t*)&m_Color,
- (const uint8_t*)&color, 1);
- }
- m_Red = ((uint8_t*)&m_Color)[0];
- m_Green = ((uint8_t*)&m_Color)[1];
- m_Blue = ((uint8_t*)&m_Color)[2];
- m_Gray = ((uint8_t*)&m_Color)[3];
- } else {
- composite_span = (pDevice->GetFormat() == FXDIB_Argb)
- ? &CFX_Renderer::CompositeSpanARGB
- : &CFX_Renderer::CompositeSpanRGB;
- if (pIccTransform) {
- color = bObjectCMYK ? FXCMYK_TODIB(color) : FXARGB_TODIB(color);
- pIccModule->TranslateScanline(pIccTransform, (uint8_t*)&m_Color,
- (const uint8_t*)&color, 1);
- ((uint8_t*)&m_Color)[3] = m_Alpha;
- m_Red = ((uint8_t*)&m_Color)[2];
- m_Green = ((uint8_t*)&m_Color)[1];
- m_Blue = ((uint8_t*)&m_Color)[0];
- if (m_bRgbByteOrder) {
- m_Color = FXARGB_TODIB(m_Color);
- m_Color = FXARGB_TOBGRORDERDIB(m_Color);
- }
- } else {
- if (bObjectCMYK) {
- uint8_t r, g, b;
- AdobeCMYK_to_sRGB1(FXSYS_GetCValue(color), FXSYS_GetMValue(color),
- FXSYS_GetYValue(color), FXSYS_GetKValue(color), r,
- g, b);
- m_Color = FXARGB_MAKE(m_Alpha, r, g, b);
- if (m_bRgbByteOrder) {
- m_Color = FXARGB_TOBGRORDERDIB(m_Color);
- } else {
- m_Color = FXARGB_TODIB(m_Color);
- }
- m_Red = r;
- m_Green = g;
- m_Blue = b;
- } else {
- if (m_bRgbByteOrder) {
- m_Color = FXARGB_TOBGRORDERDIB(color);
- } else {
- m_Color = FXARGB_TODIB(color);
- }
- ArgbDecode(color, m_Alpha, m_Red, m_Green, m_Blue);
- }
- }
- }
- if (m_pDevice->GetBPP() == 1) {
- composite_span = &CFX_Renderer::CompositeSpan1bpp;
- }
- return true;
- }
-};
-
int CFX_AggDeviceDriver::GetDriverType() const {
return 1;
}
@@ -1437,7 +1386,7 @@ bool CFX_AggDeviceDriver::RenderRasterizer(
bool bGroupKnockout,
int alpha_flag,
void* pIccTransform) {
- CFX_DIBitmap* pt = bGroupKnockout ? m_pOriDevice : nullptr;
+ CFX_RetainPtr<CFX_DIBitmap> pt = bGroupKnockout ? m_pOriDevice : nullptr;
CFX_Renderer render;
if (!render.Init(m_pBitmap, pt, m_pClipRgn.get(), color, bFullCover,
m_bRgbByteOrder, alpha_flag, pIccTransform)) {
@@ -1467,8 +1416,9 @@ bool CFX_AggDeviceDriver::DrawPath(const CFX_PathData* pPathData,
CAgg_PathData path_data;
path_data.BuildPath(pPathData, pObject2Device);
agg::rasterizer_scanline_aa rasterizer;
- rasterizer.clip_box(0.0f, 0.0f, (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_WIDTH)),
- (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_HEIGHT)));
+ rasterizer.clip_box(0.0f, 0.0f,
+ static_cast<float>(GetDeviceCaps(FXDC_PIXEL_WIDTH)),
+ static_cast<float>(GetDeviceCaps(FXDC_PIXEL_HEIGHT)));
rasterizer.add_path(path_data.m_PathData);
rasterizer.filling_rule((fill_mode & 3) == FXFILL_WINDING
? agg::fill_non_zero
@@ -1487,9 +1437,10 @@ bool CFX_AggDeviceDriver::DrawPath(const CFX_PathData* pPathData,
CAgg_PathData path_data;
path_data.BuildPath(pPathData, pObject2Device);
agg::rasterizer_scanline_aa rasterizer;
- rasterizer.clip_box(0.0f, 0.0f, (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_WIDTH)),
- (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_HEIGHT)));
- RasterizeStroke(rasterizer, path_data.m_PathData, nullptr, pGraphState, 1,
+ rasterizer.clip_box(0.0f, 0.0f,
+ static_cast<float>(GetDeviceCaps(FXDC_PIXEL_WIDTH)),
+ static_cast<float>(GetDeviceCaps(FXDC_PIXEL_HEIGHT)));
+ RasterizeStroke(&rasterizer, &path_data.m_PathData, nullptr, pGraphState, 1,
false, !!(fill_mode & FX_STROKE_TEXT_MODE));
return RenderRasterizer(rasterizer, stroke_color,
!!(fill_mode & FXFILL_FULLCOVER), m_bGroupKnockout,
@@ -1498,8 +1449,7 @@ bool CFX_AggDeviceDriver::DrawPath(const CFX_PathData* pPathData,
CFX_Matrix matrix1;
CFX_Matrix matrix2;
if (pObject2Device) {
- matrix1.a =
- std::max(FXSYS_fabs(pObject2Device->a), FXSYS_fabs(pObject2Device->b));
+ matrix1.a = std::max(fabs(pObject2Device->a), fabs(pObject2Device->b));
matrix1.d = matrix1.a;
matrix2 = CFX_Matrix(
pObject2Device->a / matrix1.a, pObject2Device->b / matrix1.a,
@@ -1514,9 +1464,10 @@ bool CFX_AggDeviceDriver::DrawPath(const CFX_PathData* pPathData,
CAgg_PathData path_data;
path_data.BuildPath(pPathData, &matrix1);
agg::rasterizer_scanline_aa rasterizer;
- rasterizer.clip_box(0.0f, 0.0f, (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_WIDTH)),
- (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_HEIGHT)));
- RasterizeStroke(rasterizer, path_data.m_PathData, &matrix2, pGraphState,
+ rasterizer.clip_box(0.0f, 0.0f,
+ static_cast<float>(GetDeviceCaps(FXDC_PIXEL_WIDTH)),
+ static_cast<float>(GetDeviceCaps(FXDC_PIXEL_HEIGHT)));
+ RasterizeStroke(&rasterizer, &path_data.m_PathData, &matrix2, pGraphState,
matrix1.a, false, !!(fill_mode & FX_STROKE_TEXT_MODE));
return RenderRasterizer(rasterizer, stroke_color,
!!(fill_mode & FXFILL_FULLCOVER), m_bGroupKnockout, 0,
@@ -1545,8 +1496,8 @@ bool CFX_AggDeviceDriver::SetPixel(int x, int y, uint32_t color) {
if (m_pClipRgn->GetType() != CFX_ClipRgn::MaskF)
return true;
- const CFX_DIBitmap* pMask = m_pClipRgn->GetMask().GetObject();
- int new_alpha = FXARGB_A(color) * pMask->GetScanline(y)[x] / 255;
+ int new_alpha =
+ FXARGB_A(color) * m_pClipRgn->GetMask()->GetScanline(y)[x] / 255;
color = (color & 0xffffff) | (new_alpha << 24);
if (m_bRgbByteOrder) {
RgbByteOrderSetPixel(m_pBitmap, x, y, color);
@@ -1579,15 +1530,15 @@ bool CFX_AggDeviceDriver::FillRectWithBlend(const FX_RECT* pRect,
fill_color);
} else {
m_pBitmap->CompositeRect(draw_rect.left, draw_rect.top, draw_rect.Width(),
- draw_rect.Height(), fill_color, 0, nullptr);
+ draw_rect.Height(), fill_color, 0);
}
return true;
}
- m_pBitmap->CompositeMask(
- draw_rect.left, draw_rect.top, draw_rect.Width(), draw_rect.Height(),
- m_pClipRgn->GetMask().GetObject(), fill_color,
- draw_rect.left - clip_rect.left, draw_rect.top - clip_rect.top,
- FXDIB_BLEND_NORMAL, nullptr, m_bRgbByteOrder, 0, nullptr);
+ m_pBitmap->CompositeMask(draw_rect.left, draw_rect.top, draw_rect.Width(),
+ draw_rect.Height(), m_pClipRgn->GetMask(),
+ fill_color, draw_rect.left - clip_rect.left,
+ draw_rect.top - clip_rect.top, FXDIB_BLEND_NORMAL,
+ nullptr, m_bRgbByteOrder, 0);
return true;
}
@@ -1602,13 +1553,15 @@ bool CFX_AggDeviceDriver::GetClipBox(FX_RECT* pRect) {
return true;
}
-bool CFX_AggDeviceDriver::GetDIBits(CFX_DIBitmap* pBitmap, int left, int top) {
+bool CFX_AggDeviceDriver::GetDIBits(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
+ int left,
+ int top) {
if (!m_pBitmap || !m_pBitmap->GetBuffer())
return true;
FX_RECT rect(left, top, left + pBitmap->GetWidth(),
top + pBitmap->GetHeight());
- std::unique_ptr<CFX_DIBitmap> pBack;
+ CFX_RetainPtr<CFX_DIBitmap> pBack;
if (m_pOriDevice) {
pBack = m_pOriDevice->Clone(&rect);
if (!pBack)
@@ -1626,18 +1579,18 @@ bool CFX_AggDeviceDriver::GetDIBits(CFX_DIBitmap* pBitmap, int left, int top) {
top = std::min(top, 0);
if (m_bRgbByteOrder) {
RgbByteOrderTransferBitmap(pBitmap, 0, 0, rect.Width(), rect.Height(),
- pBack.get(), left, top);
+ pBack, left, top);
return true;
}
- return pBitmap->TransferBitmap(0, 0, rect.Width(), rect.Height(), pBack.get(),
- left, top);
+ return pBitmap->TransferBitmap(0, 0, rect.Width(), rect.Height(), pBack, left,
+ top);
}
-CFX_DIBitmap* CFX_AggDeviceDriver::GetBackDrop() {
+CFX_RetainPtr<CFX_DIBitmap> CFX_AggDeviceDriver::GetBackDrop() {
return m_pOriDevice;
}
-bool CFX_AggDeviceDriver::SetDIBits(const CFX_DIBSource* pBitmap,
+bool CFX_AggDeviceDriver::SetDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
uint32_t argb,
const FX_RECT* pSrcRect,
int left,
@@ -1647,25 +1600,26 @@ bool CFX_AggDeviceDriver::SetDIBits(const CFX_DIBSource* pBitmap,
return true;
if (pBitmap->IsAlphaMask()) {
- return m_pBitmap->CompositeMask(
- left, top, pSrcRect->Width(), pSrcRect->Height(), pBitmap, argb,
- pSrcRect->left, pSrcRect->top, blend_type, m_pClipRgn.get(),
- m_bRgbByteOrder, 0, nullptr);
+ return m_pBitmap->CompositeMask(left, top, pSrcRect->Width(),
+ pSrcRect->Height(), pBitmap, argb,
+ pSrcRect->left, pSrcRect->top, blend_type,
+ m_pClipRgn.get(), m_bRgbByteOrder, 0);
}
return m_pBitmap->CompositeBitmap(
left, top, pSrcRect->Width(), pSrcRect->Height(), pBitmap, pSrcRect->left,
- pSrcRect->top, blend_type, m_pClipRgn.get(), m_bRgbByteOrder, nullptr);
+ pSrcRect->top, blend_type, m_pClipRgn.get(), m_bRgbByteOrder);
}
-bool CFX_AggDeviceDriver::StretchDIBits(const CFX_DIBSource* pSource,
- uint32_t argb,
- int dest_left,
- int dest_top,
- int dest_width,
- int dest_height,
- const FX_RECT* pClipRect,
- uint32_t flags,
- int blend_type) {
+bool CFX_AggDeviceDriver::StretchDIBits(
+ const CFX_RetainPtr<CFX_DIBSource>& pSource,
+ uint32_t argb,
+ int dest_left,
+ int dest_top,
+ int dest_width,
+ int dest_height,
+ const FX_RECT* pClipRect,
+ uint32_t flags,
+ int blend_type) {
if (!m_pBitmap->GetBuffer())
return true;
@@ -1681,7 +1635,7 @@ bool CFX_AggDeviceDriver::StretchDIBits(const CFX_DIBSource* pSource,
dest_clip.Intersect(*pClipRect);
CFX_BitmapComposer composer;
composer.Compose(m_pBitmap, m_pClipRgn.get(), 255, argb, dest_clip, false,
- false, false, m_bRgbByteOrder, 0, nullptr, blend_type);
+ false, false, m_bRgbByteOrder, 0, blend_type);
dest_clip.Offset(-dest_rect.left, -dest_rect.top);
CFX_ImageStretcher stretcher(&composer, pSource, dest_width, dest_height,
dest_clip, flags);
@@ -1690,45 +1644,36 @@ bool CFX_AggDeviceDriver::StretchDIBits(const CFX_DIBSource* pSource,
return true;
}
-bool CFX_AggDeviceDriver::StartDIBits(const CFX_DIBSource* pSource,
- int bitmap_alpha,
- uint32_t argb,
- const CFX_Matrix* pMatrix,
- uint32_t render_flags,
- void*& handle,
- int blend_type) {
+bool CFX_AggDeviceDriver::StartDIBits(
+ const CFX_RetainPtr<CFX_DIBSource>& pSource,
+ int bitmap_alpha,
+ uint32_t argb,
+ const CFX_Matrix* pMatrix,
+ uint32_t render_flags,
+ std::unique_ptr<CFX_ImageRenderer>* handle,
+ int blend_type) {
if (!m_pBitmap->GetBuffer())
return true;
- CFX_ImageRenderer* pRenderer = new CFX_ImageRenderer;
- pRenderer->Start(m_pBitmap, m_pClipRgn.get(), pSource, bitmap_alpha, argb,
- pMatrix, render_flags, m_bRgbByteOrder, 0, nullptr);
- handle = pRenderer;
+ *handle = pdfium::MakeUnique<CFX_ImageRenderer>();
+ (*handle)->Start(m_pBitmap, m_pClipRgn.get(), pSource, bitmap_alpha, argb,
+ pMatrix, render_flags, m_bRgbByteOrder);
return true;
}
-bool CFX_AggDeviceDriver::ContinueDIBits(void* pHandle, IFX_Pause* pPause) {
- if (!m_pBitmap->GetBuffer()) {
- return true;
- }
- return ((CFX_ImageRenderer*)pHandle)->Continue(pPause);
-}
-
-void CFX_AggDeviceDriver::CancelDIBits(void* pHandle) {
- if (!m_pBitmap->GetBuffer()) {
- return;
- }
- delete (CFX_ImageRenderer*)pHandle;
+bool CFX_AggDeviceDriver::ContinueDIBits(CFX_ImageRenderer* pHandle,
+ IFX_Pause* pPause) {
+ return m_pBitmap->GetBuffer() ? pHandle->Continue(pPause) : true;
}
#ifndef _SKIA_SUPPORT_
-CFX_FxgeDevice::CFX_FxgeDevice() {
- m_bOwnedBitmap = false;
-}
+CFX_FxgeDevice::CFX_FxgeDevice() {}
-bool CFX_FxgeDevice::Attach(CFX_DIBitmap* pBitmap,
+CFX_FxgeDevice::~CFX_FxgeDevice() {}
+
+bool CFX_FxgeDevice::Attach(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
bool bRgbByteOrder,
- CFX_DIBitmap* pOriDevice,
+ const CFX_RetainPtr<CFX_DIBitmap>& pOriDevice,
bool bGroupKnockout) {
if (!pBitmap)
return false;
@@ -1742,22 +1687,15 @@ bool CFX_FxgeDevice::Attach(CFX_DIBitmap* pBitmap,
bool CFX_FxgeDevice::Create(int width,
int height,
FXDIB_Format format,
- CFX_DIBitmap* pOriDevice) {
- m_bOwnedBitmap = true;
- CFX_DIBitmap* pBitmap = new CFX_DIBitmap;
- if (!pBitmap->Create(width, height, format)) {
- delete pBitmap;
+ const CFX_RetainPtr<CFX_DIBitmap>& pOriDevice) {
+ auto pBitmap = pdfium::MakeRetain<CFX_DIBitmap>();
+ if (!pBitmap->Create(width, height, format))
return false;
- }
+
SetBitmap(pBitmap);
SetDeviceDriver(pdfium::MakeUnique<CFX_AggDeviceDriver>(pBitmap, false,
pOriDevice, false));
return true;
}
-CFX_FxgeDevice::~CFX_FxgeDevice() {
- if (m_bOwnedBitmap) {
- delete GetBitmap();
- }
-}
#endif
diff --git a/chromium/third_party/pdfium/core/fxge/agg/fx_agg_driver.h b/chromium/third_party/pdfium/core/fxge/agg/fx_agg_driver.h
index 8da63394a46..3eb56c507e2 100644
--- a/chromium/third_party/pdfium/core/fxge/agg/fx_agg_driver.h
+++ b/chromium/third_party/pdfium/core/fxge/agg/fx_agg_driver.h
@@ -32,9 +32,9 @@ class CAgg_PathData {
class CFX_AggDeviceDriver : public IFX_RenderDeviceDriver {
public:
- CFX_AggDeviceDriver(CFX_DIBitmap* pBitmap,
+ CFX_AggDeviceDriver(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
bool bRgbByteOrder,
- CFX_DIBitmap* pOriDevice,
+ const CFX_RetainPtr<CFX_DIBitmap>& pOriDevice,
bool bGroupKnockout);
~CFX_AggDeviceDriver() override;
@@ -63,15 +63,17 @@ class CFX_AggDeviceDriver : public IFX_RenderDeviceDriver {
uint32_t fill_color,
int blend_type) override;
bool GetClipBox(FX_RECT* pRect) override;
- bool GetDIBits(CFX_DIBitmap* pBitmap, int left, int top) override;
- CFX_DIBitmap* GetBackDrop() override;
- bool SetDIBits(const CFX_DIBSource* pBitmap,
+ bool GetDIBits(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
+ int left,
+ int top) override;
+ CFX_RetainPtr<CFX_DIBitmap> GetBackDrop() override;
+ bool SetDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
uint32_t color,
const FX_RECT* pSrcRect,
int left,
int top,
int blend_type) override;
- bool StretchDIBits(const CFX_DIBSource* pBitmap,
+ bool StretchDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
uint32_t color,
int dest_left,
int dest_top,
@@ -80,20 +82,19 @@ class CFX_AggDeviceDriver : public IFX_RenderDeviceDriver {
const FX_RECT* pClipRect,
uint32_t flags,
int blend_type) override;
- bool StartDIBits(const CFX_DIBSource* pBitmap,
+ bool StartDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
int bitmap_alpha,
uint32_t color,
const CFX_Matrix* pMatrix,
uint32_t flags,
- void*& handle,
+ std::unique_ptr<CFX_ImageRenderer>* handle,
int blend_type) override;
- bool ContinueDIBits(void* handle, IFX_Pause* pPause) override;
- void CancelDIBits(void* handle) override;
+ bool ContinueDIBits(CFX_ImageRenderer* handle, IFX_Pause* pPause) override;
bool DrawDeviceText(int nChars,
const FXTEXT_CHARPOS* pCharPos,
CFX_Font* pFont,
const CFX_Matrix* pObject2Device,
- FX_FLOAT font_size,
+ float font_size,
uint32_t color) override;
int GetDriverType() const override;
@@ -109,7 +110,7 @@ class CFX_AggDeviceDriver : public IFX_RenderDeviceDriver {
virtual uint8_t* GetBuffer() const;
private:
- CFX_DIBitmap* m_pBitmap;
+ CFX_RetainPtr<CFX_DIBitmap> m_pBitmap;
std::unique_ptr<CFX_ClipRgn> m_pClipRgn;
std::vector<std::unique_ptr<CFX_ClipRgn>> m_StateStack;
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
@@ -117,7 +118,7 @@ class CFX_AggDeviceDriver : public IFX_RenderDeviceDriver {
#endif
int m_FillFlags;
bool m_bRgbByteOrder;
- CFX_DIBitmap* m_pOriDevice;
+ CFX_RetainPtr<CFX_DIBitmap> m_pOriDevice;
bool m_bGroupKnockout;
};
diff --git a/chromium/third_party/pdfium/core/fxge/android/cfpf_skiafont.cpp b/chromium/third_party/pdfium/core/fxge/android/cfpf_skiafont.cpp
index 5e11efae9df..e00aa840e4c 100644
--- a/chromium/third_party/pdfium/core/fxge/android/cfpf_skiafont.cpp
+++ b/chromium/third_party/pdfium/core/fxge/android/cfpf_skiafont.cpp
@@ -53,7 +53,7 @@ CFX_ByteString CFPF_SkiaFont::GetPsName() {
return FXFT_Get_Postscript_Name(m_Face);
}
-int32_t CFPF_SkiaFont::GetGlyphIndex(FX_WCHAR wUnicode) {
+int32_t CFPF_SkiaFont::GetGlyphIndex(wchar_t wUnicode) {
if (!m_Face)
return wUnicode;
if (FXFT_Select_Charmap(m_Face, FXFT_ENCODING_UNICODE))
diff --git a/chromium/third_party/pdfium/core/fxge/android/cfpf_skiafont.h b/chromium/third_party/pdfium/core/fxge/android/cfpf_skiafont.h
index b72c1111778..657ced88f25 100644
--- a/chromium/third_party/pdfium/core/fxge/android/cfpf_skiafont.h
+++ b/chromium/third_party/pdfium/core/fxge/android/cfpf_skiafont.h
@@ -25,7 +25,7 @@ class CFPF_SkiaFont {
CFX_ByteString GetPsName();
uint32_t GetFontStyle() const { return m_dwStyle; }
uint8_t GetCharset() const { return m_uCharset; }
- int32_t GetGlyphIndex(FX_WCHAR wUnicode);
+ int32_t GetGlyphIndex(wchar_t wUnicode);
int32_t GetGlyphWidth(int32_t iGlyphIndex);
int32_t GetAscent() const;
int32_t GetDescent() const;
diff --git a/chromium/third_party/pdfium/core/fxge/android/cfpf_skiafontdescriptor.h b/chromium/third_party/pdfium/core/fxge/android/cfpf_skiafontdescriptor.h
index 57b85404ad6..f653050feb0 100644
--- a/chromium/third_party/pdfium/core/fxge/android/cfpf_skiafontdescriptor.h
+++ b/chromium/third_party/pdfium/core/fxge/android/cfpf_skiafontdescriptor.h
@@ -23,14 +23,14 @@ class CFPF_SkiaFontDescriptor {
virtual int32_t GetType() const { return FPF_SKIAFONTTYPE_Unknown; }
- void SetFamily(const FX_CHAR* pFamily) {
+ void SetFamily(const char* pFamily) {
FX_Free(m_pFamily);
int32_t iSize = FXSYS_strlen(pFamily);
- m_pFamily = FX_Alloc(FX_CHAR, iSize + 1);
- FXSYS_memcpy(m_pFamily, pFamily, iSize * sizeof(FX_CHAR));
+ m_pFamily = FX_Alloc(char, iSize + 1);
+ memcpy(m_pFamily, pFamily, iSize * sizeof(char));
m_pFamily[iSize] = 0;
}
- FX_CHAR* m_pFamily;
+ char* m_pFamily;
uint32_t m_dwStyle;
int32_t m_iFaceIndex;
uint32_t m_dwCharsets;
diff --git a/chromium/third_party/pdfium/core/fxge/android/cfpf_skiafontmgr.cpp b/chromium/third_party/pdfium/core/fxge/android/cfpf_skiafontmgr.cpp
index e3511be67a1..534f41a548f 100644
--- a/chromium/third_party/pdfium/core/fxge/android/cfpf_skiafontmgr.cpp
+++ b/chromium/third_party/pdfium/core/fxge/android/cfpf_skiafontmgr.cpp
@@ -87,12 +87,12 @@ uint32_t FPF_SkiaGetSubstFont(uint32_t dwHash,
return 0;
}
-uint32_t FPF_GetHashCode_StringA(const FX_CHAR* pStr, int32_t iLength) {
+uint32_t FPF_GetHashCode_StringA(const char* pStr, int32_t iLength) {
if (!pStr)
return 0;
if (iLength < 0)
iLength = FXSYS_strlen(pStr);
- const FX_CHAR* pStrEnd = pStr + iLength;
+ const char* pStrEnd = pStr + iLength;
uint32_t uHashCode = 0;
while (pStr < pStrEnd)
uHashCode = 31 * uHashCode + FXSYS_tolower(*pStr++);
@@ -160,9 +160,9 @@ uint32_t FPF_SkiaGetCharset(uint8_t uCharset) {
uint32_t FPF_SKIANormalizeFontName(const CFX_ByteStringC& bsfamily) {
uint32_t dwHash = 0;
int32_t iLength = bsfamily.GetLength();
- const FX_CHAR* pBuffer = bsfamily.c_str();
+ const char* pBuffer = bsfamily.c_str();
for (int32_t i = 0; i < iLength; i++) {
- FX_CHAR ch = pBuffer[i];
+ char ch = pBuffer[i];
if (ch == ' ' || ch == '-' || ch == ',')
continue;
dwHash = 31 * dwHash + FXSYS_tolower(ch);
@@ -371,7 +371,7 @@ FXFT_Face CFPF_SkiaFontMgr::GetFontFace(
if (iFaceIndex < 0)
return nullptr;
FXFT_StreamRec streamRec;
- FXSYS_memset(&streamRec, 0, sizeof(FXFT_StreamRec));
+ memset(&streamRec, 0, sizeof(FXFT_StreamRec));
streamRec.size = pFileRead->GetSize();
streamRec.descriptor.pointer = static_cast<void*>(pFileRead.Get());
streamRec.read = FPF_SkiaStream_Read;
diff --git a/chromium/third_party/pdfium/core/fxge/android/cfpf_skiapathfont.h b/chromium/third_party/pdfium/core/fxge/android/cfpf_skiapathfont.h
index f1cff2574b7..8b7a4f9fb48 100644
--- a/chromium/third_party/pdfium/core/fxge/android/cfpf_skiapathfont.h
+++ b/chromium/third_party/pdfium/core/fxge/android/cfpf_skiapathfont.h
@@ -20,14 +20,14 @@ class CFPF_SkiaPathFont : public CFPF_SkiaFontDescriptor {
// CFPF_SkiaFontDescriptor
int32_t GetType() const override { return FPF_SKIAFONTTYPE_Path; }
- void SetPath(const FX_CHAR* pPath) {
+ void SetPath(const char* pPath) {
FX_Free(m_pPath);
int32_t iSize = FXSYS_strlen(pPath);
- m_pPath = FX_Alloc(FX_CHAR, iSize + 1);
- FXSYS_memcpy(m_pPath, pPath, iSize * sizeof(FX_CHAR));
+ m_pPath = FX_Alloc(char, iSize + 1);
+ memcpy(m_pPath, pPath, iSize * sizeof(char));
m_pPath[iSize] = 0;
}
- FX_CHAR* m_pPath;
+ char* m_pPath;
};
#endif // CORE_FXGE_ANDROID_CFPF_SKIAPATHFONT_H_
diff --git a/chromium/third_party/pdfium/core/fxge/android/cfx_androidfontinfo.cpp b/chromium/third_party/pdfium/core/fxge/android/cfx_androidfontinfo.cpp
index 03a7ffbd9e4..1183cdeaaa8 100644
--- a/chromium/third_party/pdfium/core/fxge/android/cfx_androidfontinfo.cpp
+++ b/chromium/third_party/pdfium/core/fxge/android/cfx_androidfontinfo.cpp
@@ -30,7 +30,7 @@ void* CFX_AndroidFontInfo::MapFont(int weight,
bool bItalic,
int charset,
int pitch_family,
- const FX_CHAR* face,
+ const char* face,
int& iExact) {
if (!m_pFontMgr)
return nullptr;
@@ -50,7 +50,7 @@ void* CFX_AndroidFontInfo::MapFont(int weight,
FPF_MATCHFONT_REPLACEANSI);
}
-void* CFX_AndroidFontInfo::GetFont(const FX_CHAR* face) {
+void* CFX_AndroidFontInfo::GetFont(const char* face) {
return nullptr;
}
@@ -63,19 +63,19 @@ uint32_t CFX_AndroidFontInfo::GetFontData(void* hFont,
return static_cast<CFPF_SkiaFont*>(hFont)->GetFontData(table, buffer, size);
}
-bool CFX_AndroidFontInfo::GetFaceName(void* hFont, CFX_ByteString& name) {
+bool CFX_AndroidFontInfo::GetFaceName(void* hFont, CFX_ByteString* name) {
if (!hFont)
return false;
- name = static_cast<CFPF_SkiaFont*>(hFont)->GetFamilyName();
+ *name = static_cast<CFPF_SkiaFont*>(hFont)->GetFamilyName();
return true;
}
-bool CFX_AndroidFontInfo::GetFontCharset(void* hFont, int& charset) {
+bool CFX_AndroidFontInfo::GetFontCharset(void* hFont, int* charset) {
if (!hFont)
return false;
- charset = static_cast<CFPF_SkiaFont*>(hFont)->GetCharset();
+ *charset = static_cast<CFPF_SkiaFont*>(hFont)->GetCharset();
return false;
}
diff --git a/chromium/third_party/pdfium/core/fxge/android/cfx_androidfontinfo.h b/chromium/third_party/pdfium/core/fxge/android/cfx_androidfontinfo.h
index 94e1db88ac0..ce08f2558a1 100644
--- a/chromium/third_party/pdfium/core/fxge/android/cfx_androidfontinfo.h
+++ b/chromium/third_party/pdfium/core/fxge/android/cfx_androidfontinfo.h
@@ -27,15 +27,15 @@ class CFX_AndroidFontInfo : public IFX_SystemFontInfo {
bool bItalic,
int charset,
int pitch_family,
- const FX_CHAR* face,
+ const char* face,
int& bExact) override;
- void* GetFont(const FX_CHAR* face) override;
+ void* GetFont(const char* face) override;
uint32_t GetFontData(void* hFont,
uint32_t table,
uint8_t* buffer,
uint32_t size) override;
- bool GetFaceName(void* hFont, CFX_ByteString& name) override;
- bool GetFontCharset(void* hFont, int& charset) override;
+ bool GetFaceName(void* hFont, CFX_ByteString* name) override;
+ bool GetFontCharset(void* hFont, int* charset) override;
void DeleteFont(void* hFont) override;
protected:
diff --git a/chromium/third_party/pdfium/core/fxge/android/fx_android_imp.cpp b/chromium/third_party/pdfium/core/fxge/android/fx_android_imp.cpp
index b8e7c5b2180..e4fdd1e131f 100644
--- a/chromium/third_party/pdfium/core/fxge/android/fx_android_imp.cpp
+++ b/chromium/third_party/pdfium/core/fxge/android/fx_android_imp.cpp
@@ -11,6 +11,7 @@
#include "core/fxge/android/cfpf_skiadevicemodule.h"
#include "core/fxge/android/cfx_androidfontinfo.h"
+#include "third_party/base/ptr_util.h"
void CFX_GEModule::InitPlatform() {
CFPF_SkiaDeviceModule* pDeviceModule = CFPF_GetSkiaDeviceModule();
@@ -19,7 +20,7 @@ void CFX_GEModule::InitPlatform() {
CFPF_SkiaFontMgr* pFontMgr = pDeviceModule->GetFontMgr();
if (pFontMgr) {
- std::unique_ptr<CFX_AndroidFontInfo> pFontInfo(new CFX_AndroidFontInfo);
+ auto pFontInfo = pdfium::MakeUnique<CFX_AndroidFontInfo>();
pFontInfo->Init(pFontMgr);
m_pFontMgr->SetSystemFontInfo(std::move(pFontInfo));
}
diff --git a/chromium/third_party/pdfium/core/fxge/apple/apple_int.h b/chromium/third_party/pdfium/core/fxge/apple/apple_int.h
index fed6abcfb09..f1b9fcf2e81 100644
--- a/chromium/third_party/pdfium/core/fxge/apple/apple_int.h
+++ b/chromium/third_party/pdfium/core/fxge/apple/apple_int.h
@@ -19,7 +19,7 @@
class CQuartz2D {
public:
- void* createGraphics(CFX_DIBitmap* bitmap);
+ void* createGraphics(const CFX_RetainPtr<CFX_DIBitmap>& bitmap);
void destroyGraphics(void* graphics);
void* CreateFont(const uint8_t* pFontData, uint32_t dwFontSize);
@@ -27,7 +27,7 @@ class CQuartz2D {
void setGraphicsTextMatrix(void* graphics, CFX_Matrix* matrix);
bool drawGraphicsString(void* graphics,
void* font,
- FX_FLOAT fontSize,
+ float fontSize,
uint16_t* glyphIndices,
CGPoint* glyphPositions,
int32_t chars,
diff --git a/chromium/third_party/pdfium/core/fxge/apple/fx_apple_platform.cpp b/chromium/third_party/pdfium/core/fxge/apple/fx_apple_platform.cpp
index f576eb0ba27..818e19e7d44 100644
--- a/chromium/third_party/pdfium/core/fxge/apple/fx_apple_platform.cpp
+++ b/chromium/third_party/pdfium/core/fxge/apple/fx_apple_platform.cpp
@@ -14,7 +14,6 @@
#include "core/fxge/cfx_facecache.h"
#include "core/fxge/cfx_gemodule.h"
#include "core/fxge/cfx_renderdevice.h"
-#include "core/fxge/dib/dib_int.h"
#include "core/fxge/fx_freetype.h"
#include "core/fxge/ge/cfx_cliprgn.h"
#include "core/fxge/ge/fx_text_int.h"
@@ -30,7 +29,7 @@ bool CGDrawGlyphRun(CGContextRef pContext,
const FXTEXT_CHARPOS* pCharPos,
CFX_Font* pFont,
const CFX_Matrix* pObject2Device,
- FX_FLOAT font_size,
+ float font_size,
uint32_t argb) {
if (nChars == 0)
return true;
@@ -102,7 +101,7 @@ bool CFX_AggDeviceDriver::DrawDeviceText(int nChars,
const FXTEXT_CHARPOS* pCharPos,
CFX_Font* pFont,
const CFX_Matrix* pObject2Device,
- FX_FLOAT font_size,
+ float font_size,
uint32_t argb) {
if (!pFont)
return false;
@@ -129,7 +128,7 @@ bool CFX_AggDeviceDriver::DrawDeviceText(int nChars,
rect_cg =
CGRectMake(m_pClipRgn->GetBox().left, m_pClipRgn->GetBox().top,
m_pClipRgn->GetBox().Width(), m_pClipRgn->GetBox().Height());
- const CFX_DIBitmap* pClipMask = m_pClipRgn->GetMask().GetObject();
+ CFX_RetainPtr<CFX_DIBitmap> pClipMask = m_pClipRgn->GetMask();
if (pClipMask) {
CGDataProviderRef pClipMaskDataProvider = CGDataProviderCreateWithData(
nullptr, pClipMask->GetBuffer(),
diff --git a/chromium/third_party/pdfium/core/fxge/apple/fx_mac_imp.cpp b/chromium/third_party/pdfium/core/fxge/apple/fx_mac_imp.cpp
index c05aea34f54..2df6e754a06 100644
--- a/chromium/third_party/pdfium/core/fxge/apple/fx_mac_imp.cpp
+++ b/chromium/third_party/pdfium/core/fxge/apple/fx_mac_imp.cpp
@@ -14,8 +14,8 @@
namespace {
const struct {
- const FX_CHAR* m_pName;
- const FX_CHAR* m_pSubstName;
+ const char* m_pName;
+ const char* m_pSubstName;
} g_Base14Substs[] = {
{"Courier", "Courier New"},
{"Courier-Bold", "Courier New Bold"},
@@ -41,7 +41,7 @@ class CFX_MacFontInfo : public CFX_FolderFontInfo {
bool bItalic,
int charset,
int pitch_family,
- const FX_CHAR* family,
+ const char* family,
int& iExact) override;
};
@@ -61,7 +61,7 @@ void* CFX_MacFontInfo::MapFont(int weight,
bool bItalic,
int charset,
int pitch_family,
- const FX_CHAR* cstr_face,
+ const char* cstr_face,
int& iExact) {
CFX_ByteString face = cstr_face;
for (size_t i = 0; i < FX_ArraySize(g_Base14Substs); ++i) {
diff --git a/chromium/third_party/pdfium/core/fxge/apple/fx_quartz_device.cpp b/chromium/third_party/pdfium/core/fxge/apple/fx_quartz_device.cpp
index 0cd5b6b93a0..eef0e0cd88d 100644
--- a/chromium/third_party/pdfium/core/fxge/apple/fx_quartz_device.cpp
+++ b/chromium/third_party/pdfium/core/fxge/apple/fx_quartz_device.cpp
@@ -15,7 +15,6 @@
#include "core/fxge/cfx_graphstatedata.h"
#include "core/fxge/cfx_pathdata.h"
#include "core/fxge/cfx_renderdevice.h"
-#include "core/fxge/dib/dib_int.h"
#include "core/fxge/fx_freetype.h"
#include "core/fxge/ge/fx_text_int.h"
#include "third_party/base/ptr_util.h"
@@ -25,7 +24,7 @@
#error Expected CGFLOAT_IS_DOUBLE to be defined by CoreGraphics headers
#endif
-void* CQuartz2D::createGraphics(CFX_DIBitmap* pBitmap) {
+void* CQuartz2D::createGraphics(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap) {
if (!pBitmap)
return nullptr;
CGBitmapInfo bmpInfo = kCGBitmapByteOrder32Little;
@@ -77,7 +76,7 @@ void CQuartz2D::setGraphicsTextMatrix(void* graphics, CFX_Matrix* matrix) {
bool CQuartz2D::drawGraphicsString(void* graphics,
void* font,
- FX_FLOAT fontSize,
+ float fontSize,
uint16_t* glyphIndices,
CGPoint* glyphPositions,
int32_t charsCount,
diff --git a/chromium/third_party/pdfium/core/fxge/cfx_fontmgr.h b/chromium/third_party/pdfium/core/fxge/cfx_fontmgr.h
index 432f34b38ca..b7f2e1a032d 100644
--- a/chromium/third_party/pdfium/core/fxge/cfx_fontmgr.h
+++ b/chromium/third_party/pdfium/core/fxge/cfx_fontmgr.h
@@ -43,7 +43,7 @@ class CFX_FontMgr {
uint8_t* pData,
uint32_t size,
int font_offset);
- FXFT_Face GetFileFace(const FX_CHAR* filename, int face_index);
+ FXFT_Face GetFileFace(const 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(std::unique_ptr<IFX_SystemFontInfo> pFontInfo);
diff --git a/chromium/third_party/pdfium/core/fxge/cfx_fxgedevice.h b/chromium/third_party/pdfium/core/fxge/cfx_fxgedevice.h
index 8358e436667..4e8a7f4f55e 100644
--- a/chromium/third_party/pdfium/core/fxge/cfx_fxgedevice.h
+++ b/chromium/third_party/pdfium/core/fxge/cfx_fxgedevice.h
@@ -17,30 +17,27 @@ class CFX_FxgeDevice : public CFX_RenderDevice {
CFX_FxgeDevice();
~CFX_FxgeDevice() override;
- bool Attach(CFX_DIBitmap* pBitmap,
+ bool Attach(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
bool bRgbByteOrder,
- CFX_DIBitmap* pOriDevice,
+ const CFX_RetainPtr<CFX_DIBitmap>& pOriDevice,
bool bGroupKnockout);
bool Create(int width,
int height,
FXDIB_Format format,
- CFX_DIBitmap* pOriDevice);
+ const CFX_RetainPtr<CFX_DIBitmap>& pOriDevice);
#ifdef _SKIA_SUPPORT_
bool AttachRecorder(SkPictureRecorder* recorder);
void Clear(uint32_t color);
SkPictureRecorder* CreateRecorder(int size_x, int size_y);
void DebugVerifyBitmapIsPreMultiplied() const override;
- bool SetBitsWithMask(const CFX_DIBSource* pBitmap,
- const CFX_DIBSource* pMask,
+ bool SetBitsWithMask(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
+ const CFX_RetainPtr<CFX_DIBSource>& pMask,
int left,
int top,
int bitmap_alpha,
int blend_type) override;
#endif
-
- private:
- bool m_bOwnedBitmap;
};
#endif // CORE_FXGE_CFX_FXGEDEVICE_H_
diff --git a/chromium/third_party/pdfium/core/fxge/cfx_gemodule.h b/chromium/third_party/pdfium/core/fxge/cfx_gemodule.h
index c5bd8410025..587ec89e592 100644
--- a/chromium/third_party/pdfium/core/fxge/cfx_gemodule.h
+++ b/chromium/third_party/pdfium/core/fxge/cfx_gemodule.h
@@ -24,7 +24,7 @@ class CFX_GEModule {
void Init(const char** pUserFontPaths, CCodec_ModuleMgr* pCodecModule);
CFX_FontCache* GetFontCache();
CFX_FontMgr* GetFontMgr() { return m_pFontMgr.get(); }
- void SetTextGamma(FX_FLOAT gammaValue);
+ void SetTextGamma(float gammaValue);
const uint8_t* GetTextGammaTable() const;
CCodec_ModuleMgr* GetCodecModule() { return m_pCodecModule; }
diff --git a/chromium/third_party/pdfium/core/fxge/cfx_graphstate.h b/chromium/third_party/pdfium/core/fxge/cfx_graphstate.h
index a838dfc17ca..b023ce790dc 100644
--- a/chromium/third_party/pdfium/core/fxge/cfx_graphstate.h
+++ b/chromium/third_party/pdfium/core/fxge/cfx_graphstate.h
@@ -20,10 +20,10 @@ class CFX_GraphState {
void Emplace();
- void SetLineDash(CPDF_Array* pArray, FX_FLOAT phase, FX_FLOAT scale);
+ void SetLineDash(CPDF_Array* pArray, float phase, float scale);
- FX_FLOAT GetLineWidth() const;
- void SetLineWidth(FX_FLOAT width);
+ float GetLineWidth() const;
+ void SetLineWidth(float width);
CFX_GraphStateData::LineCap GetLineCap() const;
void SetLineCap(CFX_GraphStateData::LineCap cap);
@@ -31,8 +31,8 @@ class CFX_GraphState {
CFX_GraphStateData::LineJoin GetLineJoin() const;
void SetLineJoin(CFX_GraphStateData::LineJoin join);
- FX_FLOAT GetMiterLimit() const;
- void SetMiterLimit(FX_FLOAT limit);
+ float GetMiterLimit() const;
+ void SetMiterLimit(float limit);
// FIXME(tsepez): remove when all GraphStateData usage gone.
const CFX_GraphStateData* GetObject() const { return m_Ref.GetObject(); }
diff --git a/chromium/third_party/pdfium/core/fxge/cfx_graphstatedata.h b/chromium/third_party/pdfium/core/fxge/cfx_graphstatedata.h
index 03e4a8f51a9..dc0098be3e4 100644
--- a/chromium/third_party/pdfium/core/fxge/cfx_graphstatedata.h
+++ b/chromium/third_party/pdfium/core/fxge/cfx_graphstatedata.h
@@ -22,8 +22,8 @@ class CFX_GraphStateData {
LineCap m_LineCap;
int m_DashCount;
- FX_FLOAT* m_DashArray;
- FX_FLOAT m_DashPhase;
+ float* m_DashArray;
+ float m_DashPhase;
enum LineJoin {
LineJoinMiter = 0,
@@ -31,8 +31,8 @@ class CFX_GraphStateData {
LineJoinBevel = 2,
};
LineJoin m_LineJoin;
- FX_FLOAT m_MiterLimit;
- FX_FLOAT m_LineWidth;
+ float m_MiterLimit;
+ float m_LineWidth;
};
#endif // CORE_FXGE_CFX_GRAPHSTATEDATA_H_
diff --git a/chromium/third_party/pdfium/core/fxge/cfx_pathdata.h b/chromium/third_party/pdfium/core/fxge/cfx_pathdata.h
index b0e30e32ad7..bcb2b7aadf7 100644
--- a/chromium/third_party/pdfium/core/fxge/cfx_pathdata.h
+++ b/chromium/third_party/pdfium/core/fxge/cfx_pathdata.h
@@ -47,7 +47,7 @@ class CFX_PathData {
std::vector<FX_PATHPOINT>& GetPoints() { return m_Points; }
CFX_FloatRect GetBoundingBox() const;
- CFX_FloatRect GetBoundingBox(FX_FLOAT line_width, FX_FLOAT miter_limit) const;
+ CFX_FloatRect GetBoundingBox(float line_width, float miter_limit) const;
void Transform(const CFX_Matrix* pMatrix);
bool IsRect() const;
@@ -59,7 +59,7 @@ class CFX_PathData {
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 AppendRect(float left, float bottom, float right, float top);
void AppendPoint(const CFX_PointF& pos, FXPT_TYPE type, bool closeFigure);
void ClosePath();
diff --git a/chromium/third_party/pdfium/core/fxge/cfx_renderdevice.h b/chromium/third_party/pdfium/core/fxge/cfx_renderdevice.h
index 2e9abf9963d..794c2fec6b4 100644
--- a/chromium/third_party/pdfium/core/fxge/cfx_renderdevice.h
+++ b/chromium/third_party/pdfium/core/fxge/cfx_renderdevice.h
@@ -15,6 +15,7 @@
class CFX_Font;
class CFX_GraphStateData;
+class CFX_ImageRenderer;
class IFX_RenderDeviceDriver;
#define FXDC_DEVICE_CLASS 1
@@ -68,7 +69,7 @@ class FXTEXT_CHARPOS {
FXTEXT_CHARPOS(const FXTEXT_CHARPOS&);
~FXTEXT_CHARPOS();
- FX_FLOAT m_AdjustMatrix[4];
+ float m_AdjustMatrix[4];
CFX_PointF m_Origin;
uint32_t m_GlyphIndex;
int32_t m_FontCharWidth;
@@ -100,9 +101,13 @@ class CFX_RenderDevice {
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; }
- bool CreateCompatibleBitmap(CFX_DIBitmap* pDIB, int width, int height) const;
+ CFX_RetainPtr<CFX_DIBitmap> GetBitmap() const { return m_pBitmap; }
+ void SetBitmap(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap) {
+ m_pBitmap = pBitmap;
+ }
+ bool CreateCompatibleBitmap(const CFX_RetainPtr<CFX_DIBitmap>& pDIB,
+ int width,
+ int height) const;
const FX_RECT& GetClipBox() const { return m_ClipBox; }
bool SetClip_PathFill(const CFX_PathData* pPathData,
const CFX_Matrix* pObject2Device,
@@ -132,24 +137,26 @@ class CFX_RenderDevice {
return FillRectWithBlend(pRect, color, FXDIB_BLEND_NORMAL);
}
bool FillRectWithBlend(const FX_RECT* pRect, uint32_t color, int blend_type);
- bool DrawCosmeticLine(FX_FLOAT x1,
- FX_FLOAT y1,
- FX_FLOAT x2,
- FX_FLOAT y2,
+ bool DrawCosmeticLine(float x1,
+ float y1,
+ float x2,
+ float y2,
uint32_t color,
int fill_mode,
int blend_type);
- bool GetDIBits(CFX_DIBitmap* pBitmap, int left, int top);
- CFX_DIBitmap* GetBackDrop();
- bool SetDIBits(const CFX_DIBSource* pBitmap, int left, int top) {
+ CFX_RetainPtr<CFX_DIBitmap> GetBackDrop();
+ bool GetDIBits(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap, int left, int top);
+ bool SetDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
+ int left,
+ int top) {
return SetDIBitsWithBlend(pBitmap, left, top, FXDIB_BLEND_NORMAL);
}
- bool SetDIBitsWithBlend(const CFX_DIBSource* pBitmap,
+ bool SetDIBitsWithBlend(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
int left,
int top,
int blend_type);
- bool StretchDIBits(const CFX_DIBSource* pBitmap,
+ bool StretchDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
int left,
int top,
int dest_width,
@@ -157,60 +164,60 @@ class CFX_RenderDevice {
return StretchDIBitsWithFlagsAndBlend(pBitmap, left, top, dest_width,
dest_height, 0, FXDIB_BLEND_NORMAL);
}
- bool StretchDIBitsWithFlagsAndBlend(const CFX_DIBSource* pBitmap,
- int left,
- int top,
- int dest_width,
- int dest_height,
- uint32_t flags,
- int blend_type);
- bool SetBitMask(const CFX_DIBSource* pBitmap,
+ bool StretchDIBitsWithFlagsAndBlend(
+ const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
+ int left,
+ int top,
+ int dest_width,
+ int dest_height,
+ uint32_t flags,
+ int blend_type);
+ bool SetBitMask(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
int left,
int top,
uint32_t color);
- bool StretchBitMask(const CFX_DIBSource* pBitmap,
+ bool StretchBitMask(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
int left,
int top,
int dest_width,
int dest_height,
uint32_t color);
- bool StretchBitMaskWithFlags(const CFX_DIBSource* pBitmap,
+ bool StretchBitMaskWithFlags(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
int left,
int top,
int dest_width,
int dest_height,
uint32_t color,
uint32_t flags);
- bool StartDIBits(const CFX_DIBSource* pBitmap,
+ bool StartDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
int bitmap_alpha,
uint32_t color,
const CFX_Matrix* pMatrix,
uint32_t flags,
- void*& handle) {
+ std::unique_ptr<CFX_ImageRenderer>* handle) {
return StartDIBitsWithBlend(pBitmap, bitmap_alpha, color, pMatrix, flags,
handle, FXDIB_BLEND_NORMAL);
}
- bool StartDIBitsWithBlend(const CFX_DIBSource* pBitmap,
+ bool StartDIBitsWithBlend(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
int bitmap_alpha,
uint32_t color,
const CFX_Matrix* pMatrix,
uint32_t flags,
- void*& handle,
+ std::unique_ptr<CFX_ImageRenderer>* handle,
int blend_type);
- bool ContinueDIBits(void* handle, IFX_Pause* pPause);
- void CancelDIBits(void* handle);
+ bool ContinueDIBits(CFX_ImageRenderer* handle, IFX_Pause* pPause);
bool DrawNormalText(int nChars,
const FXTEXT_CHARPOS* pCharPos,
CFX_Font* pFont,
- FX_FLOAT font_size,
+ float font_size,
const CFX_Matrix* pText2Device,
uint32_t fill_color,
uint32_t text_flags);
bool DrawTextPath(int nChars,
const FXTEXT_CHARPOS* pCharPos,
CFX_Font* pFont,
- FX_FLOAT font_size,
+ float font_size,
const CFX_Matrix* pText2User,
const CFX_Matrix* pUser2Device,
const CFX_GraphStateData* pGraphState,
@@ -221,8 +228,8 @@ class CFX_RenderDevice {
#ifdef _SKIA_SUPPORT_
virtual void DebugVerifyBitmapIsPreMultiplied() const;
- virtual bool SetBitsWithMask(const CFX_DIBSource* pBitmap,
- const CFX_DIBSource* pMask,
+ virtual bool SetBitsWithMask(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
+ const CFX_RetainPtr<CFX_DIBSource>& pMask,
int left,
int top,
int bitmap_alpha,
@@ -243,7 +250,7 @@ class CFX_RenderDevice {
int fill_mode,
int blend_type);
- CFX_DIBitmap* m_pBitmap;
+ CFX_RetainPtr<CFX_DIBitmap> m_pBitmap;
int m_Width;
int m_Height;
int m_bpp;
diff --git a/chromium/third_party/pdfium/core/fxge/cfx_unicodeencodingex.h b/chromium/third_party/pdfium/core/fxge/cfx_unicodeencodingex.h
index df2edbe1bf6..21deb44d790 100644
--- a/chromium/third_party/pdfium/core/fxge/cfx_unicodeencodingex.h
+++ b/chromium/third_party/pdfium/core/fxge/cfx_unicodeencodingex.h
@@ -24,7 +24,7 @@ class CFX_UnicodeEncodingEx : public CFX_UnicodeEncoding {
// CFX_UnicodeEncoding:
uint32_t GlyphFromCharCode(uint32_t charcode) override;
- uint32_t CharCodeFromUnicode(FX_WCHAR Unicode) const;
+ uint32_t CharCodeFromUnicode(wchar_t Unicode) const;
private:
uint32_t m_nEncodingID;
diff --git a/chromium/third_party/pdfium/core/fxge/dib/cfx_bitmapcomposer.cpp b/chromium/third_party/pdfium/core/fxge/dib/cfx_bitmapcomposer.cpp
new file mode 100644
index 00000000000..bd634ad5743
--- /dev/null
+++ b/chromium/third_party/pdfium/core/fxge/dib/cfx_bitmapcomposer.cpp
@@ -0,0 +1,201 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "core/fxge/dib/cfx_bitmapcomposer.h"
+
+#include "core/fxcodec/fx_codec.h"
+#include "core/fxge/cfx_gemodule.h"
+#include "core/fxge/dib/cfx_dibitmap.h"
+#include "core/fxge/ge/cfx_cliprgn.h"
+
+CFX_BitmapComposer::CFX_BitmapComposer()
+ : m_bRgbByteOrder(false), m_BlendType(FXDIB_BLEND_NORMAL) {}
+
+CFX_BitmapComposer::~CFX_BitmapComposer() {}
+
+void CFX_BitmapComposer::Compose(const CFX_RetainPtr<CFX_DIBitmap>& pDest,
+ const CFX_ClipRgn* pClipRgn,
+ int bitmap_alpha,
+ uint32_t mask_color,
+ const FX_RECT& dest_rect,
+ bool bVertical,
+ bool bFlipX,
+ bool bFlipY,
+ bool bRgbByteOrder,
+ int alpha_flag,
+ int blend_type) {
+ m_pBitmap = pDest;
+ m_pClipRgn = pClipRgn;
+ m_DestLeft = dest_rect.left;
+ m_DestTop = dest_rect.top;
+ m_DestWidth = dest_rect.Width();
+ m_DestHeight = dest_rect.Height();
+ m_BitmapAlpha = bitmap_alpha;
+ m_MaskColor = mask_color;
+ m_pClipMask = nullptr;
+ if (pClipRgn && pClipRgn->GetType() != CFX_ClipRgn::RectI)
+ m_pClipMask = pClipRgn->GetMask();
+ m_bVertical = bVertical;
+ m_bFlipX = bFlipX;
+ m_bFlipY = bFlipY;
+ m_AlphaFlag = alpha_flag;
+ m_bRgbByteOrder = bRgbByteOrder;
+ m_BlendType = blend_type;
+}
+bool CFX_BitmapComposer::SetInfo(int width,
+ int height,
+ FXDIB_Format src_format,
+ uint32_t* pSrcPalette) {
+ m_SrcFormat = src_format;
+ if (!m_Compositor.Init(m_pBitmap->GetFormat(), src_format, width, pSrcPalette,
+ m_MaskColor, FXDIB_BLEND_NORMAL,
+ m_pClipMask != nullptr || (m_BitmapAlpha < 255),
+ m_bRgbByteOrder, m_AlphaFlag)) {
+ return false;
+ }
+ if (m_bVertical) {
+ m_pScanlineV.resize(m_pBitmap->GetBPP() / 8 * width + 4);
+ m_pClipScanV.resize(m_pBitmap->GetHeight());
+ if (m_pBitmap->m_pAlphaMask)
+ m_pScanlineAlphaV.resize(width + 4);
+ }
+ if (m_BitmapAlpha < 255) {
+ m_pAddClipScan.resize(m_bVertical ? m_pBitmap->GetHeight()
+ : m_pBitmap->GetWidth());
+ }
+ return true;
+}
+
+void CFX_BitmapComposer::DoCompose(uint8_t* dest_scan,
+ const uint8_t* src_scan,
+ int dest_width,
+ const uint8_t* clip_scan,
+ const uint8_t* src_extra_alpha,
+ uint8_t* dst_extra_alpha) {
+ uint8_t* pAddClipScan = m_pAddClipScan.data();
+ if (m_BitmapAlpha < 255) {
+ if (clip_scan) {
+ for (int i = 0; i < dest_width; ++i)
+ pAddClipScan[i] = clip_scan[i] * m_BitmapAlpha / 255;
+ } else {
+ memset(pAddClipScan, m_BitmapAlpha, dest_width);
+ }
+ clip_scan = pAddClipScan;
+ }
+ if (m_SrcFormat == FXDIB_8bppMask) {
+ m_Compositor.CompositeByteMaskLine(dest_scan, src_scan, dest_width,
+ clip_scan, dst_extra_alpha);
+ } else if ((m_SrcFormat & 0xff) == 8) {
+ m_Compositor.CompositePalBitmapLine(dest_scan, src_scan, 0, dest_width,
+ clip_scan, src_extra_alpha,
+ dst_extra_alpha);
+ } else {
+ m_Compositor.CompositeRgbBitmapLine(dest_scan, src_scan, dest_width,
+ clip_scan, src_extra_alpha,
+ dst_extra_alpha);
+ }
+}
+
+void CFX_BitmapComposer::ComposeScanline(int line,
+ const uint8_t* scanline,
+ const uint8_t* scan_extra_alpha) {
+ if (m_bVertical) {
+ ComposeScanlineV(line, scanline, scan_extra_alpha);
+ return;
+ }
+ const uint8_t* clip_scan = nullptr;
+ if (m_pClipMask)
+ clip_scan = m_pClipMask->GetBuffer() +
+ (m_DestTop + line - m_pClipRgn->GetBox().top) *
+ m_pClipMask->GetPitch() +
+ (m_DestLeft - m_pClipRgn->GetBox().left);
+ uint8_t* dest_scan =
+ const_cast<uint8_t*>(m_pBitmap->GetScanline(line + m_DestTop)) +
+ m_DestLeft * m_pBitmap->GetBPP() / 8;
+ uint8_t* dest_alpha_scan =
+ m_pBitmap->m_pAlphaMask
+ ? const_cast<uint8_t*>(
+ m_pBitmap->m_pAlphaMask->GetScanline(line + m_DestTop)) +
+ m_DestLeft
+ : nullptr;
+ DoCompose(dest_scan, scanline, m_DestWidth, clip_scan, scan_extra_alpha,
+ dest_alpha_scan);
+}
+
+void CFX_BitmapComposer::ComposeScanlineV(int line,
+ const uint8_t* scanline,
+ const uint8_t* scan_extra_alpha) {
+ int Bpp = m_pBitmap->GetBPP() / 8;
+ int dest_pitch = m_pBitmap->GetPitch();
+ int dest_alpha_pitch =
+ m_pBitmap->m_pAlphaMask ? m_pBitmap->m_pAlphaMask->GetPitch() : 0;
+ int dest_x = m_DestLeft + (m_bFlipX ? (m_DestWidth - line - 1) : line);
+ uint8_t* dest_buf =
+ m_pBitmap->GetBuffer() + dest_x * Bpp + m_DestTop * dest_pitch;
+ uint8_t* dest_alpha_buf = m_pBitmap->m_pAlphaMask
+ ? m_pBitmap->m_pAlphaMask->GetBuffer() +
+ dest_x + m_DestTop * dest_alpha_pitch
+ : nullptr;
+ if (m_bFlipY) {
+ dest_buf += dest_pitch * (m_DestHeight - 1);
+ dest_alpha_buf += dest_alpha_pitch * (m_DestHeight - 1);
+ }
+ int y_step = dest_pitch;
+ int y_alpha_step = dest_alpha_pitch;
+ if (m_bFlipY) {
+ y_step = -y_step;
+ y_alpha_step = -y_alpha_step;
+ }
+ uint8_t* src_scan = m_pScanlineV.data();
+ uint8_t* dest_scan = dest_buf;
+ for (int i = 0; i < m_DestHeight; ++i) {
+ for (int j = 0; j < Bpp; ++j)
+ *src_scan++ = dest_scan[j];
+ dest_scan += y_step;
+ }
+ uint8_t* src_alpha_scan = m_pScanlineAlphaV.data();
+ uint8_t* dest_alpha_scan = dest_alpha_buf;
+ if (dest_alpha_scan) {
+ for (int i = 0; i < m_DestHeight; ++i) {
+ *src_alpha_scan++ = *dest_alpha_scan;
+ dest_alpha_scan += y_alpha_step;
+ }
+ }
+ uint8_t* clip_scan = nullptr;
+ if (m_pClipMask) {
+ clip_scan = m_pClipScanV.data();
+ int clip_pitch = m_pClipMask->GetPitch();
+ const uint8_t* src_clip =
+ m_pClipMask->GetBuffer() +
+ (m_DestTop - m_pClipRgn->GetBox().top) * clip_pitch +
+ (dest_x - m_pClipRgn->GetBox().left);
+ if (m_bFlipY) {
+ src_clip += clip_pitch * (m_DestHeight - 1);
+ clip_pitch = -clip_pitch;
+ }
+ for (int i = 0; i < m_DestHeight; ++i) {
+ clip_scan[i] = *src_clip;
+ src_clip += clip_pitch;
+ }
+ }
+ DoCompose(m_pScanlineV.data(), scanline, m_DestHeight, clip_scan,
+ scan_extra_alpha, m_pScanlineAlphaV.data());
+ src_scan = m_pScanlineV.data();
+ dest_scan = dest_buf;
+ for (int i = 0; i < m_DestHeight; ++i) {
+ for (int j = 0; j < Bpp; ++j)
+ dest_scan[j] = *src_scan++;
+ dest_scan += y_step;
+ }
+ src_alpha_scan = m_pScanlineAlphaV.data();
+ dest_alpha_scan = dest_alpha_buf;
+ if (!dest_alpha_scan)
+ return;
+ for (int i = 0; i < m_DestHeight; ++i) {
+ *dest_alpha_scan = *src_alpha_scan++;
+ dest_alpha_scan += y_alpha_step;
+ }
+}
diff --git a/chromium/third_party/pdfium/core/fxge/dib/cfx_bitmapcomposer.h b/chromium/third_party/pdfium/core/fxge/dib/cfx_bitmapcomposer.h
new file mode 100644
index 00000000000..6e961cbd457
--- /dev/null
+++ b/chromium/third_party/pdfium/core/fxge/dib/cfx_bitmapcomposer.h
@@ -0,0 +1,81 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef CORE_FXGE_DIB_CFX_BITMAPCOMPOSER_H_
+#define CORE_FXGE_DIB_CFX_BITMAPCOMPOSER_H_
+
+#include <vector>
+
+#include "core/fxcrt/cfx_retain_ptr.h"
+#include "core/fxcrt/fx_coordinates.h"
+#include "core/fxge/dib/cfx_scanlinecompositor.h"
+#include "core/fxge/dib/ifx_scanlinecomposer.h"
+
+class CFX_ClipRgn;
+class CFX_DIBitmap;
+
+class CFX_BitmapComposer : public IFX_ScanlineComposer {
+ public:
+ CFX_BitmapComposer();
+ ~CFX_BitmapComposer() override;
+
+ void Compose(const CFX_RetainPtr<CFX_DIBitmap>& pDest,
+ const CFX_ClipRgn* pClipRgn,
+ int bitmap_alpha,
+ uint32_t mask_color,
+ const FX_RECT& dest_rect,
+ bool bVertical,
+ bool bFlipX,
+ bool bFlipY,
+ bool bRgbByteOrder,
+ int alpha_flag,
+ int blend_type);
+
+ // IFX_ScanlineComposer
+ 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;
+
+ private:
+ 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,
+ uint8_t* dst_extra_alpha);
+ void ComposeScanlineV(int line,
+ const uint8_t* scanline,
+ const uint8_t* scan_extra_alpha);
+
+ CFX_RetainPtr<CFX_DIBitmap> m_pBitmap;
+ const CFX_ClipRgn* m_pClipRgn;
+ FXDIB_Format m_SrcFormat;
+ int m_DestLeft;
+ int m_DestTop;
+ int m_DestWidth;
+ int m_DestHeight;
+ int m_BitmapAlpha;
+ uint32_t m_MaskColor;
+ CFX_RetainPtr<CFX_DIBitmap> m_pClipMask;
+ CFX_ScanlineCompositor m_Compositor;
+ bool m_bVertical;
+ bool m_bFlipX;
+ bool m_bFlipY;
+ int m_AlphaFlag;
+ bool m_bRgbByteOrder;
+ int m_BlendType;
+ std::vector<uint8_t> m_pScanlineV;
+ std::vector<uint8_t> m_pClipScanV;
+ std::vector<uint8_t> m_pAddClipScan;
+ std::vector<uint8_t> m_pScanlineAlphaV;
+};
+
+#endif // CORE_FXGE_DIB_CFX_BITMAPCOMPOSER_H_
diff --git a/chromium/third_party/pdfium/core/fxge/dib/cfx_bitmapstorer.cpp b/chromium/third_party/pdfium/core/fxge/dib/cfx_bitmapstorer.cpp
new file mode 100644
index 00000000000..1e097080987
--- /dev/null
+++ b/chromium/third_party/pdfium/core/fxge/dib/cfx_bitmapstorer.cpp
@@ -0,0 +1,55 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "core/fxge/dib/cfx_bitmapstorer.h"
+
+#include <utility>
+
+#include "third_party/base/ptr_util.h"
+
+CFX_BitmapStorer::CFX_BitmapStorer() {}
+
+CFX_BitmapStorer::~CFX_BitmapStorer() {}
+
+CFX_RetainPtr<CFX_DIBitmap> CFX_BitmapStorer::Detach() {
+ return std::move(m_pBitmap);
+}
+
+void CFX_BitmapStorer::Replace(CFX_RetainPtr<CFX_DIBitmap>&& pBitmap) {
+ m_pBitmap = std::move(pBitmap);
+}
+
+void CFX_BitmapStorer::ComposeScanline(int line,
+ const uint8_t* scanline,
+ const uint8_t* scan_extra_alpha) {
+ uint8_t* dest_buf = const_cast<uint8_t*>(m_pBitmap->GetScanline(line));
+ uint8_t* dest_alpha_buf =
+ m_pBitmap->m_pAlphaMask
+ ? const_cast<uint8_t*>(m_pBitmap->m_pAlphaMask->GetScanline(line))
+ : nullptr;
+ if (dest_buf)
+ memcpy(dest_buf, scanline, m_pBitmap->GetPitch());
+
+ if (dest_alpha_buf) {
+ memcpy(dest_alpha_buf, scan_extra_alpha,
+ m_pBitmap->m_pAlphaMask->GetPitch());
+ }
+}
+
+bool CFX_BitmapStorer::SetInfo(int width,
+ int height,
+ FXDIB_Format src_format,
+ uint32_t* pSrcPalette) {
+ auto pBitmap = pdfium::MakeRetain<CFX_DIBitmap>();
+ if (!pBitmap->Create(width, height, src_format))
+ return false;
+
+ if (pSrcPalette)
+ pBitmap->SetPalette(pSrcPalette);
+
+ m_pBitmap = std::move(pBitmap);
+ return true;
+}
diff --git a/chromium/third_party/pdfium/core/fxge/dib/cfx_bitmapstorer.h b/chromium/third_party/pdfium/core/fxge/dib/cfx_bitmapstorer.h
new file mode 100644
index 00000000000..a574493e6e2
--- /dev/null
+++ b/chromium/third_party/pdfium/core/fxge/dib/cfx_bitmapstorer.h
@@ -0,0 +1,41 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef CORE_FXGE_DIB_CFX_BITMAPSTORER_H_
+#define CORE_FXGE_DIB_CFX_BITMAPSTORER_H_
+
+#include <memory>
+#include <vector>
+
+#include "core/fxcrt/cfx_retain_ptr.h"
+#include "core/fxcrt/fx_coordinates.h"
+#include "core/fxge/dib/cfx_dibitmap.h"
+#include "core/fxge/dib/ifx_scanlinecomposer.h"
+#include "third_party/base/stl_util.h"
+
+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;
+ bool SetInfo(int width,
+ int height,
+ FXDIB_Format src_format,
+ uint32_t* pSrcPalette) override;
+
+ CFX_RetainPtr<CFX_DIBitmap> GetBitmap() { return m_pBitmap; }
+ CFX_RetainPtr<CFX_DIBitmap> Detach();
+ void Replace(CFX_RetainPtr<CFX_DIBitmap>&& pBitmap);
+
+ private:
+ CFX_RetainPtr<CFX_DIBitmap> m_pBitmap;
+};
+
+#endif // CORE_FXGE_DIB_CFX_BITMAPSTORER_H_
diff --git a/chromium/third_party/pdfium/core/fxge/dib/cfx_dibextractor.cpp b/chromium/third_party/pdfium/core/fxge/dib/cfx_dibextractor.cpp
new file mode 100644
index 00000000000..8de69e2e3bc
--- /dev/null
+++ b/chromium/third_party/pdfium/core/fxge/dib/cfx_dibextractor.cpp
@@ -0,0 +1,27 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "core/fxge/dib/cfx_dibextractor.h"
+
+#include "core/fxge/dib/cfx_dibsource.h"
+
+CFX_DIBExtractor::CFX_DIBExtractor(const CFX_RetainPtr<CFX_DIBSource>& pSrc) {
+ if (!pSrc->GetBuffer()) {
+ m_pBitmap = pSrc->Clone();
+ return;
+ }
+ CFX_RetainPtr<CFX_DIBSource> pOldSrc(pSrc);
+ m_pBitmap = pdfium::MakeRetain<CFX_DIBitmap>();
+ if (!m_pBitmap->Create(pOldSrc->GetWidth(), pOldSrc->GetHeight(),
+ pOldSrc->GetFormat(), pOldSrc->GetBuffer())) {
+ m_pBitmap.Reset();
+ return;
+ }
+ m_pBitmap->SetPalette(pOldSrc->GetPalette());
+ m_pBitmap->SetAlphaMask(pOldSrc->m_pAlphaMask);
+}
+
+CFX_DIBExtractor::~CFX_DIBExtractor() {}
diff --git a/chromium/third_party/pdfium/core/fxge/dib/cfx_dibextractor.h b/chromium/third_party/pdfium/core/fxge/dib/cfx_dibextractor.h
new file mode 100644
index 00000000000..25d80ecb946
--- /dev/null
+++ b/chromium/third_party/pdfium/core/fxge/dib/cfx_dibextractor.h
@@ -0,0 +1,26 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef CORE_FXGE_DIB_CFX_DIBEXTRACTOR_H_
+#define CORE_FXGE_DIB_CFX_DIBEXTRACTOR_H_
+
+#include "core/fxcrt/cfx_retain_ptr.h"
+#include "core/fxge/dib/cfx_dibitmap.h"
+
+class CFX_DIBSource;
+
+class CFX_DIBExtractor {
+ public:
+ explicit CFX_DIBExtractor(const CFX_RetainPtr<CFX_DIBSource>& pSrc);
+ ~CFX_DIBExtractor();
+
+ CFX_RetainPtr<CFX_DIBitmap> GetBitmap() { return m_pBitmap; }
+
+ private:
+ CFX_RetainPtr<CFX_DIBitmap> m_pBitmap;
+};
+
+#endif // CORE_FXGE_DIB_CFX_DIBEXTRACTOR_H_
diff --git a/chromium/third_party/pdfium/core/fxge/dib/cfx_dibitmap.cpp b/chromium/third_party/pdfium/core/fxge/dib/cfx_dibitmap.cpp
new file mode 100644
index 00000000000..61eba3fd748
--- /dev/null
+++ b/chromium/third_party/pdfium/core/fxge/dib/cfx_dibitmap.cpp
@@ -0,0 +1,1232 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "core/fxge/dib/cfx_dibitmap.h"
+
+#include <limits>
+#include <memory>
+#include <utility>
+
+#include "core/fxcodec/fx_codec.h"
+#include "core/fxge/cfx_gemodule.h"
+#include "core/fxge/dib/cfx_scanlinecompositor.h"
+#include "core/fxge/ge/cfx_cliprgn.h"
+#include "third_party/base/ptr_util.h"
+
+#define MAX_OOM_LIMIT 12000000
+
+namespace {
+
+const int8_t g_ChannelOffset[] = {0, 2, 1, 0, 0, 1, 2, 3, 3};
+
+} // namespace
+
+CFX_DIBitmap::CFX_DIBitmap() {
+ m_pPalette = nullptr;
+#ifdef _SKIA_SUPPORT_PATHS_
+ m_nFormat = Format::kCleared;
+#endif
+}
+
+bool CFX_DIBitmap::Create(int width,
+ int height,
+ FXDIB_Format format,
+ uint8_t* pBuffer,
+ int pitch) {
+ m_pBuffer = nullptr;
+ m_bpp = static_cast<uint8_t>(format);
+ m_AlphaFlag = static_cast<uint8_t>(format >> 8);
+ m_Width = m_Height = m_Pitch = 0;
+ if (width <= 0 || height <= 0 || pitch < 0)
+ return false;
+
+ if ((INT_MAX - 31) / width < (format & 0xff))
+ return false;
+
+ if (!pitch)
+ pitch = (width * (format & 0xff) + 31) / 32 * 4;
+
+ if ((1 << 30) / pitch < height)
+ return false;
+
+ if (pBuffer) {
+ m_pBuffer.Reset(pBuffer);
+ } else {
+ int size = pitch * height + 4;
+ int oomlimit = MAX_OOM_LIMIT;
+ if (oomlimit >= 0 && size >= oomlimit) {
+ m_pBuffer =
+ std::unique_ptr<uint8_t, FxFreeDeleter>(FX_TryAlloc(uint8_t, size));
+ if (!m_pBuffer)
+ return false;
+ } else {
+ m_pBuffer =
+ std::unique_ptr<uint8_t, FxFreeDeleter>(FX_Alloc(uint8_t, size));
+ }
+ }
+ m_Width = width;
+ m_Height = height;
+ m_Pitch = pitch;
+ if (!HasAlpha() || format == FXDIB_Argb)
+ return true;
+
+ if (BuildAlphaMask())
+ return true;
+
+ if (pBuffer)
+ return true;
+
+ m_pBuffer = nullptr;
+ m_Width = 0;
+ m_Height = 0;
+ m_Pitch = 0;
+ return false;
+}
+
+bool CFX_DIBitmap::Copy(const CFX_RetainPtr<CFX_DIBSource>& pSrc) {
+ if (m_pBuffer)
+ return false;
+
+ if (!Create(pSrc->GetWidth(), pSrc->GetHeight(), pSrc->GetFormat()))
+ return false;
+
+ SetPalette(pSrc->GetPalette());
+ SetAlphaMask(pSrc->m_pAlphaMask);
+ for (int row = 0; row < pSrc->GetHeight(); row++)
+ memcpy(m_pBuffer.Get() + row * m_Pitch, pSrc->GetScanline(row), m_Pitch);
+ return true;
+}
+
+CFX_DIBitmap::~CFX_DIBitmap() {}
+
+uint8_t* CFX_DIBitmap::GetBuffer() const {
+ return m_pBuffer.Get();
+}
+
+const uint8_t* CFX_DIBitmap::GetScanline(int line) const {
+ return m_pBuffer.Get() ? m_pBuffer.Get() + line * m_Pitch : nullptr;
+}
+
+void CFX_DIBitmap::TakeOver(CFX_RetainPtr<CFX_DIBitmap>&& pSrcBitmap) {
+ m_pBuffer = std::move(pSrcBitmap->m_pBuffer);
+ m_pPalette = std::move(pSrcBitmap->m_pPalette);
+ m_pAlphaMask = pSrcBitmap->m_pAlphaMask;
+ pSrcBitmap->m_pBuffer = nullptr;
+ pSrcBitmap->m_pAlphaMask = nullptr;
+ m_bpp = pSrcBitmap->m_bpp;
+ m_AlphaFlag = pSrcBitmap->m_AlphaFlag;
+ m_Width = pSrcBitmap->m_Width;
+ m_Height = pSrcBitmap->m_Height;
+ m_Pitch = pSrcBitmap->m_Pitch;
+}
+
+void CFX_DIBitmap::Clear(uint32_t color) {
+ if (!m_pBuffer)
+ return;
+
+ uint8_t* pBuffer = m_pBuffer.Get();
+ switch (GetFormat()) {
+ case FXDIB_1bppMask:
+ memset(pBuffer, (color & 0xff000000) ? 0xff : 0, m_Pitch * m_Height);
+ break;
+ case FXDIB_1bppRgb: {
+ int index = FindPalette(color);
+ memset(pBuffer, index ? 0xff : 0, m_Pitch * m_Height);
+ break;
+ }
+ case FXDIB_8bppMask:
+ memset(pBuffer, color >> 24, m_Pitch * m_Height);
+ break;
+ case FXDIB_8bppRgb: {
+ int index = FindPalette(color);
+ memset(pBuffer, index, m_Pitch * m_Height);
+ break;
+ }
+ case FXDIB_Rgb:
+ case FXDIB_Rgba: {
+ int a, r, g, b;
+ ArgbDecode(color, a, r, g, b);
+ if (r == g && g == b) {
+ memset(pBuffer, r, m_Pitch * m_Height);
+ } else {
+ int byte_pos = 0;
+ for (int col = 0; col < m_Width; col++) {
+ pBuffer[byte_pos++] = b;
+ pBuffer[byte_pos++] = g;
+ pBuffer[byte_pos++] = r;
+ }
+ for (int row = 1; row < m_Height; row++) {
+ memcpy(pBuffer + row * m_Pitch, pBuffer, m_Pitch);
+ }
+ }
+ break;
+ }
+ case FXDIB_Rgb32:
+ case FXDIB_Argb: {
+ color = IsCmykImage() ? FXCMYK_TODIB(color) : FXARGB_TODIB(color);
+#ifdef _SKIA_SUPPORT_
+ if (FXDIB_Rgb32 == GetFormat() && !IsCmykImage())
+ color |= 0xFF000000;
+#endif
+ for (int i = 0; i < m_Width; i++)
+ reinterpret_cast<uint32_t*>(pBuffer)[i] = color;
+ for (int row = 1; row < m_Height; row++)
+ memcpy(pBuffer + row * m_Pitch, pBuffer, m_Pitch);
+ break;
+ }
+ default:
+ break;
+ }
+}
+
+bool CFX_DIBitmap::TransferBitmap(
+ int dest_left,
+ int dest_top,
+ int width,
+ int height,
+ const CFX_RetainPtr<CFX_DIBSource>& pSrcBitmap,
+ int src_left,
+ int src_top) {
+ if (!m_pBuffer)
+ return false;
+
+ GetOverlapRect(dest_left, dest_top, width, height, pSrcBitmap->GetWidth(),
+ pSrcBitmap->GetHeight(), src_left, src_top, nullptr);
+ if (width == 0 || height == 0)
+ return true;
+
+ FXDIB_Format dest_format = GetFormat();
+ FXDIB_Format src_format = pSrcBitmap->GetFormat();
+ if (dest_format == src_format) {
+ if (GetBPP() == 1) {
+ for (int row = 0; row < height; row++) {
+ uint8_t* dest_scan = m_pBuffer.Get() + (dest_top + row) * m_Pitch;
+ const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row);
+ for (int col = 0; col < width; col++) {
+ if (src_scan[(src_left + col) / 8] &
+ (1 << (7 - (src_left + col) % 8))) {
+ dest_scan[(dest_left + col) / 8] |= 1
+ << (7 - (dest_left + col) % 8);
+ } else {
+ dest_scan[(dest_left + col) / 8] &=
+ ~(1 << (7 - (dest_left + col) % 8));
+ }
+ }
+ }
+ } else {
+ int Bpp = GetBPP() / 8;
+ for (int row = 0; row < height; row++) {
+ uint8_t* dest_scan =
+ m_pBuffer.Get() + (dest_top + row) * m_Pitch + dest_left * Bpp;
+ const uint8_t* src_scan =
+ pSrcBitmap->GetScanline(src_top + row) + src_left * Bpp;
+ memcpy(dest_scan, src_scan, width * Bpp);
+ }
+ }
+ } else {
+ if (m_pPalette)
+ return false;
+
+ if (m_bpp == 8)
+ dest_format = FXDIB_8bppMask;
+
+ uint8_t* dest_buf =
+ m_pBuffer.Get() + dest_top * m_Pitch + dest_left * GetBPP() / 8;
+ std::unique_ptr<uint32_t, FxFreeDeleter> d_plt;
+ if (!ConvertBuffer(dest_format, dest_buf, m_Pitch, width, height,
+ pSrcBitmap, src_left, src_top, &d_plt)) {
+ return false;
+ }
+ }
+ return true;
+}
+
+bool CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel,
+ const CFX_RetainPtr<CFX_DIBSource>& pSrcBitmap,
+ FXDIB_Channel srcChannel) {
+ if (!m_pBuffer)
+ return false;
+
+ CFX_RetainPtr<CFX_DIBSource> pSrcClone = pSrcBitmap;
+ int srcOffset;
+ if (srcChannel == FXDIB_Alpha) {
+ if (!pSrcBitmap->HasAlpha() && !pSrcBitmap->IsAlphaMask())
+ return false;
+
+ if (pSrcBitmap->GetBPP() == 1) {
+ pSrcClone = pSrcBitmap->CloneConvert(FXDIB_8bppMask);
+ if (!pSrcClone)
+ return false;
+ }
+ srcOffset = pSrcBitmap->GetFormat() == FXDIB_Argb ? 3 : 0;
+ } else {
+ if (pSrcBitmap->IsAlphaMask())
+ return false;
+
+ if (pSrcBitmap->GetBPP() < 24) {
+ if (pSrcBitmap->IsCmykImage()) {
+ pSrcClone = pSrcBitmap->CloneConvert(static_cast<FXDIB_Format>(
+ (pSrcBitmap->GetFormat() & 0xff00) | 0x20));
+ } else {
+ pSrcClone = pSrcBitmap->CloneConvert(static_cast<FXDIB_Format>(
+ (pSrcBitmap->GetFormat() & 0xff00) | 0x18));
+ }
+ if (!pSrcClone)
+ return false;
+ }
+ srcOffset = g_ChannelOffset[srcChannel];
+ }
+ int destOffset = 0;
+ if (destChannel == FXDIB_Alpha) {
+ if (IsAlphaMask()) {
+ if (!ConvertFormat(FXDIB_8bppMask))
+ return false;
+ } else {
+ if (!ConvertFormat(IsCmykImage() ? FXDIB_Cmyka : FXDIB_Argb))
+ return false;
+
+ if (GetFormat() == FXDIB_Argb)
+ destOffset = 3;
+ }
+ } else {
+ if (IsAlphaMask())
+ return false;
+
+ if (GetBPP() < 24) {
+ if (HasAlpha()) {
+ if (!ConvertFormat(IsCmykImage() ? FXDIB_Cmyka : FXDIB_Argb))
+ return false;
+#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
+ } else if (!ConvertFormat(IsCmykImage() ? FXDIB_Cmyk : FXDIB_Rgb32)) {
+#else
+ } else if (!ConvertFormat(IsCmykImage() ? FXDIB_Cmyk : FXDIB_Rgb)) {
+#endif
+ return false;
+ }
+ }
+ destOffset = g_ChannelOffset[destChannel];
+ }
+ if (srcChannel == FXDIB_Alpha && pSrcClone->m_pAlphaMask) {
+ CFX_RetainPtr<CFX_DIBSource> pAlphaMask = pSrcClone->m_pAlphaMask;
+ if (pSrcClone->GetWidth() != m_Width ||
+ pSrcClone->GetHeight() != m_Height) {
+ if (pAlphaMask) {
+ pAlphaMask = pAlphaMask->StretchTo(m_Width, m_Height);
+ if (!pAlphaMask)
+ return false;
+ }
+ }
+ pSrcClone = std::move(pAlphaMask);
+ srcOffset = 0;
+ } else if (pSrcClone->GetWidth() != m_Width ||
+ pSrcClone->GetHeight() != m_Height) {
+ CFX_RetainPtr<CFX_DIBitmap> pSrcMatched =
+ pSrcClone->StretchTo(m_Width, m_Height);
+ if (!pSrcMatched)
+ return false;
+
+ pSrcClone = std::move(pSrcMatched);
+ }
+ CFX_RetainPtr<CFX_DIBitmap> pDst(this);
+ if (destChannel == FXDIB_Alpha && m_pAlphaMask) {
+ pDst = m_pAlphaMask;
+ destOffset = 0;
+ }
+ int srcBytes = pSrcClone->GetBPP() / 8;
+ int destBytes = pDst->GetBPP() / 8;
+ for (int row = 0; row < m_Height; row++) {
+ uint8_t* dest_pos = (uint8_t*)pDst->GetScanline(row) + destOffset;
+ const uint8_t* src_pos = pSrcClone->GetScanline(row) + srcOffset;
+ for (int col = 0; col < m_Width; col++) {
+ *dest_pos = *src_pos;
+ dest_pos += destBytes;
+ src_pos += srcBytes;
+ }
+ }
+ return true;
+}
+
+bool CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel, int value) {
+ if (!m_pBuffer)
+ return false;
+
+ int destOffset;
+ if (destChannel == FXDIB_Alpha) {
+ if (IsAlphaMask()) {
+ if (!ConvertFormat(FXDIB_8bppMask)) {
+ return false;
+ }
+ destOffset = 0;
+ } else {
+ destOffset = 0;
+ if (!ConvertFormat(IsCmykImage() ? FXDIB_Cmyka : FXDIB_Argb)) {
+ return false;
+ }
+ if (GetFormat() == FXDIB_Argb) {
+ destOffset = 3;
+ }
+ }
+ } else {
+ if (IsAlphaMask()) {
+ return false;
+ }
+ if (GetBPP() < 24) {
+ if (HasAlpha()) {
+ if (!ConvertFormat(IsCmykImage() ? FXDIB_Cmyka : FXDIB_Argb)) {
+ return false;
+ }
+#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
+ } else if (!ConvertFormat(IsCmykImage() ? FXDIB_Cmyk : FXDIB_Rgb)) {
+#else
+ } else if (!ConvertFormat(IsCmykImage() ? FXDIB_Cmyk : FXDIB_Rgb32)) {
+#endif
+ return false;
+ }
+ }
+ destOffset = g_ChannelOffset[destChannel];
+ }
+ int Bpp = GetBPP() / 8;
+ if (Bpp == 1) {
+ memset(m_pBuffer.Get(), value, m_Height * m_Pitch);
+ return true;
+ }
+ if (destChannel == FXDIB_Alpha && m_pAlphaMask) {
+ memset(m_pAlphaMask->GetBuffer(), value,
+ m_pAlphaMask->GetHeight() * m_pAlphaMask->GetPitch());
+ return true;
+ }
+ for (int row = 0; row < m_Height; row++) {
+ uint8_t* scan_line = m_pBuffer.Get() + row * m_Pitch + destOffset;
+ for (int col = 0; col < m_Width; col++) {
+ *scan_line = value;
+ scan_line += Bpp;
+ }
+ }
+ return true;
+}
+
+bool CFX_DIBitmap::MultiplyAlpha(
+ const CFX_RetainPtr<CFX_DIBSource>& pSrcBitmap) {
+ if (!m_pBuffer)
+ return false;
+
+ ASSERT(pSrcBitmap->IsAlphaMask());
+ if (!pSrcBitmap->IsAlphaMask())
+ return false;
+
+ if (!IsAlphaMask() && !HasAlpha())
+ return LoadChannel(FXDIB_Alpha, pSrcBitmap, FXDIB_Alpha);
+
+ CFX_RetainPtr<CFX_DIBitmap> pSrcClone = pSrcBitmap.As<CFX_DIBitmap>();
+ if (pSrcBitmap->GetWidth() != m_Width ||
+ pSrcBitmap->GetHeight() != m_Height) {
+ pSrcClone = pSrcBitmap->StretchTo(m_Width, m_Height);
+ if (!pSrcClone)
+ return false;
+ }
+ if (IsAlphaMask()) {
+ if (!ConvertFormat(FXDIB_8bppMask))
+ return false;
+
+ for (int row = 0; row < m_Height; row++) {
+ uint8_t* dest_scan = m_pBuffer.Get() + m_Pitch * row;
+ uint8_t* src_scan = pSrcClone->m_pBuffer.Get() + pSrcClone->m_Pitch * row;
+ if (pSrcClone->GetBPP() == 1) {
+ for (int col = 0; col < m_Width; col++) {
+ if (!((1 << (7 - col % 8)) & src_scan[col / 8]))
+ dest_scan[col] = 0;
+ }
+ } else {
+ for (int col = 0; col < m_Width; col++) {
+ *dest_scan = (*dest_scan) * src_scan[col] / 255;
+ dest_scan++;
+ }
+ }
+ }
+ } else {
+ if (GetFormat() == FXDIB_Argb) {
+ if (pSrcClone->GetBPP() == 1)
+ return false;
+
+ for (int row = 0; row < m_Height; row++) {
+ uint8_t* dest_scan = m_pBuffer.Get() + m_Pitch * row + 3;
+ uint8_t* src_scan =
+ pSrcClone->m_pBuffer.Get() + pSrcClone->m_Pitch * row;
+ for (int col = 0; col < m_Width; col++) {
+ *dest_scan = (*dest_scan) * src_scan[col] / 255;
+ dest_scan += 4;
+ }
+ }
+ } else {
+ m_pAlphaMask->MultiplyAlpha(pSrcClone);
+ }
+ }
+ return true;
+}
+
+bool CFX_DIBitmap::MultiplyAlpha(int alpha) {
+ if (!m_pBuffer)
+ return false;
+
+ switch (GetFormat()) {
+ case FXDIB_1bppMask:
+ if (!ConvertFormat(FXDIB_8bppMask)) {
+ return false;
+ }
+ MultiplyAlpha(alpha);
+ break;
+ case FXDIB_8bppMask: {
+ for (int row = 0; row < m_Height; row++) {
+ uint8_t* scan_line = m_pBuffer.Get() + row * m_Pitch;
+ for (int col = 0; col < m_Width; col++) {
+ scan_line[col] = scan_line[col] * alpha / 255;
+ }
+ }
+ break;
+ }
+ case FXDIB_Argb: {
+ for (int row = 0; row < m_Height; row++) {
+ uint8_t* scan_line = m_pBuffer.Get() + row * m_Pitch + 3;
+ for (int col = 0; col < m_Width; col++) {
+ *scan_line = (*scan_line) * alpha / 255;
+ scan_line += 4;
+ }
+ }
+ break;
+ }
+ default:
+ if (HasAlpha()) {
+ m_pAlphaMask->MultiplyAlpha(alpha);
+ } else if (IsCmykImage()) {
+ if (!ConvertFormat((FXDIB_Format)(GetFormat() | 0x0200))) {
+ return false;
+ }
+ m_pAlphaMask->MultiplyAlpha(alpha);
+ } else {
+ if (!ConvertFormat(FXDIB_Argb)) {
+ return false;
+ }
+ MultiplyAlpha(alpha);
+ }
+ break;
+ }
+ return true;
+}
+
+uint32_t CFX_DIBitmap::GetPixel(int x, int y) const {
+ if (!m_pBuffer)
+ return 0;
+
+ uint8_t* pos = m_pBuffer.Get() + y * m_Pitch + x * GetBPP() / 8;
+ switch (GetFormat()) {
+ case FXDIB_1bppMask: {
+ if ((*pos) & (1 << (7 - x % 8))) {
+ return 0xff000000;
+ }
+ return 0;
+ }
+ case FXDIB_1bppRgb: {
+ if ((*pos) & (1 << (7 - x % 8))) {
+ return m_pPalette ? m_pPalette.get()[1] : 0xffffffff;
+ }
+ return m_pPalette ? m_pPalette.get()[0] : 0xff000000;
+ }
+ case FXDIB_8bppMask:
+ return (*pos) << 24;
+ case FXDIB_8bppRgb:
+ return m_pPalette ? m_pPalette.get()[*pos]
+ : (0xff000000 | ((*pos) * 0x10101));
+ case FXDIB_Rgb:
+ case FXDIB_Rgba:
+ case FXDIB_Rgb32:
+ return FXARGB_GETDIB(pos) | 0xff000000;
+ case FXDIB_Argb:
+ return FXARGB_GETDIB(pos);
+ default:
+ break;
+ }
+ return 0;
+}
+
+void CFX_DIBitmap::SetPixel(int x, int y, uint32_t color) {
+ if (!m_pBuffer)
+ return;
+
+ if (x < 0 || x >= m_Width || y < 0 || y >= m_Height)
+ return;
+
+ uint8_t* pos = m_pBuffer.Get() + y * m_Pitch + x * GetBPP() / 8;
+ switch (GetFormat()) {
+ case FXDIB_1bppMask:
+ if (color >> 24) {
+ *pos |= 1 << (7 - x % 8);
+ } else {
+ *pos &= ~(1 << (7 - x % 8));
+ }
+ break;
+ case FXDIB_1bppRgb:
+ if (m_pPalette) {
+ if (color == m_pPalette.get()[1]) {
+ *pos |= 1 << (7 - x % 8);
+ } else {
+ *pos &= ~(1 << (7 - x % 8));
+ }
+ } else {
+ if (color == 0xffffffff) {
+ *pos |= 1 << (7 - x % 8);
+ } else {
+ *pos &= ~(1 << (7 - x % 8));
+ }
+ }
+ break;
+ case FXDIB_8bppMask:
+ *pos = (uint8_t)(color >> 24);
+ break;
+ case FXDIB_8bppRgb: {
+ if (m_pPalette) {
+ for (int i = 0; i < 256; i++) {
+ if (m_pPalette.get()[i] == color) {
+ *pos = (uint8_t)i;
+ return;
+ }
+ }
+ *pos = 0;
+ } else {
+ *pos = FXRGB2GRAY(FXARGB_R(color), FXARGB_G(color), FXARGB_B(color));
+ }
+ break;
+ }
+ case FXDIB_Rgb:
+ case FXDIB_Rgb32: {
+ int alpha = FXARGB_A(color);
+ pos[0] = (FXARGB_B(color) * alpha + pos[0] * (255 - alpha)) / 255;
+ pos[1] = (FXARGB_G(color) * alpha + pos[1] * (255 - alpha)) / 255;
+ pos[2] = (FXARGB_R(color) * alpha + pos[2] * (255 - alpha)) / 255;
+ break;
+ }
+ case FXDIB_Rgba: {
+ pos[0] = FXARGB_B(color);
+ pos[1] = FXARGB_G(color);
+ pos[2] = FXARGB_R(color);
+ break;
+ }
+ case FXDIB_Argb:
+ FXARGB_SETDIB(pos, color);
+ break;
+ default:
+ break;
+ }
+}
+
+void CFX_DIBitmap::DownSampleScanline(int line,
+ uint8_t* dest_scan,
+ int dest_bpp,
+ int dest_width,
+ bool bFlipX,
+ int clip_left,
+ int clip_width) const {
+ if (!m_pBuffer)
+ return;
+
+ int src_Bpp = m_bpp / 8;
+ uint8_t* scanline = m_pBuffer.Get() + line * m_Pitch;
+ if (src_Bpp == 0) {
+ for (int i = 0; i < clip_width; i++) {
+ uint32_t dest_x = clip_left + i;
+ uint32_t src_x = dest_x * m_Width / dest_width;
+ if (bFlipX) {
+ src_x = m_Width - src_x - 1;
+ }
+ src_x %= m_Width;
+ dest_scan[i] = (scanline[src_x / 8] & (1 << (7 - src_x % 8))) ? 255 : 0;
+ }
+ } else if (src_Bpp == 1) {
+ for (int i = 0; i < clip_width; i++) {
+ uint32_t dest_x = clip_left + i;
+ uint32_t src_x = dest_x * m_Width / dest_width;
+ if (bFlipX) {
+ src_x = m_Width - src_x - 1;
+ }
+ src_x %= m_Width;
+ int dest_pos = i;
+ if (m_pPalette) {
+ if (!IsCmykImage()) {
+ dest_pos *= 3;
+ FX_ARGB argb = m_pPalette.get()[scanline[src_x]];
+ dest_scan[dest_pos] = FXARGB_B(argb);
+ dest_scan[dest_pos + 1] = FXARGB_G(argb);
+ dest_scan[dest_pos + 2] = FXARGB_R(argb);
+ } else {
+ dest_pos *= 4;
+ FX_CMYK cmyk = m_pPalette.get()[scanline[src_x]];
+ dest_scan[dest_pos] = FXSYS_GetCValue(cmyk);
+ dest_scan[dest_pos + 1] = FXSYS_GetMValue(cmyk);
+ dest_scan[dest_pos + 2] = FXSYS_GetYValue(cmyk);
+ dest_scan[dest_pos + 3] = FXSYS_GetKValue(cmyk);
+ }
+ } else {
+ dest_scan[dest_pos] = scanline[src_x];
+ }
+ }
+ } else {
+ for (int i = 0; i < clip_width; i++) {
+ uint32_t dest_x = clip_left + i;
+ uint32_t src_x =
+ bFlipX ? (m_Width - dest_x * m_Width / dest_width - 1) * src_Bpp
+ : (dest_x * m_Width / dest_width) * src_Bpp;
+ src_x %= m_Width * src_Bpp;
+ int dest_pos = i * src_Bpp;
+ for (int b = 0; b < src_Bpp; b++) {
+ dest_scan[dest_pos + b] = scanline[src_x + b];
+ }
+ }
+ }
+}
+
+// TODO(weili): Split this function into two for handling CMYK and RGB
+// colors separately.
+bool CFX_DIBitmap::ConvertColorScale(uint32_t forecolor, uint32_t backcolor) {
+ ASSERT(!IsAlphaMask());
+ if (!m_pBuffer || IsAlphaMask())
+ return false;
+
+ // Values used for CMYK colors.
+ int fc = 0;
+ int fm = 0;
+ int fy = 0;
+ int fk = 0;
+ int bc = 0;
+ int bm = 0;
+ int by = 0;
+ int bk = 0;
+ // Values used for RGB colors.
+ int fr = 0;
+ int fg = 0;
+ int fb = 0;
+ int br = 0;
+ int bg = 0;
+ int bb = 0;
+ bool isCmykImage = IsCmykImage();
+ if (isCmykImage) {
+ fc = FXSYS_GetCValue(forecolor);
+ fm = FXSYS_GetMValue(forecolor);
+ fy = FXSYS_GetYValue(forecolor);
+ fk = FXSYS_GetKValue(forecolor);
+ bc = FXSYS_GetCValue(backcolor);
+ bm = FXSYS_GetMValue(backcolor);
+ by = FXSYS_GetYValue(backcolor);
+ bk = FXSYS_GetKValue(backcolor);
+ } else {
+ fr = FXSYS_GetRValue(forecolor);
+ fg = FXSYS_GetGValue(forecolor);
+ fb = FXSYS_GetBValue(forecolor);
+ br = FXSYS_GetRValue(backcolor);
+ bg = FXSYS_GetGValue(backcolor);
+ bb = FXSYS_GetBValue(backcolor);
+ }
+ if (m_bpp <= 8) {
+ if (isCmykImage) {
+ if (forecolor == 0xff && backcolor == 0 && !m_pPalette) {
+ return true;
+ }
+ } else if (forecolor == 0 && backcolor == 0xffffff && !m_pPalette) {
+ return true;
+ }
+ if (!m_pPalette) {
+ BuildPalette();
+ }
+ int size = 1 << m_bpp;
+ if (isCmykImage) {
+ for (int i = 0; i < size; i++) {
+ uint8_t b, g, r;
+ AdobeCMYK_to_sRGB1(FXSYS_GetCValue(m_pPalette.get()[i]),
+ FXSYS_GetMValue(m_pPalette.get()[i]),
+ FXSYS_GetYValue(m_pPalette.get()[i]),
+ FXSYS_GetKValue(m_pPalette.get()[i]), r, g, b);
+ int gray = 255 - FXRGB2GRAY(r, g, b);
+ m_pPalette.get()[i] = CmykEncode(
+ bc + (fc - bc) * gray / 255, bm + (fm - bm) * gray / 255,
+ by + (fy - by) * gray / 255, bk + (fk - bk) * gray / 255);
+ }
+ } else {
+ for (int i = 0; i < size; i++) {
+ int gray = FXRGB2GRAY(FXARGB_R(m_pPalette.get()[i]),
+ FXARGB_G(m_pPalette.get()[i]),
+ FXARGB_B(m_pPalette.get()[i]));
+ m_pPalette.get()[i] = FXARGB_MAKE(0xff, br + (fr - br) * gray / 255,
+ bg + (fg - bg) * gray / 255,
+ bb + (fb - bb) * gray / 255);
+ }
+ }
+ return true;
+ }
+ if (isCmykImage) {
+ if (forecolor == 0xff && backcolor == 0x00) {
+ for (int row = 0; row < m_Height; row++) {
+ uint8_t* scanline = m_pBuffer.Get() + row * m_Pitch;
+ for (int col = 0; col < m_Width; col++) {
+ uint8_t b, g, r;
+ AdobeCMYK_to_sRGB1(scanline[0], scanline[1], scanline[2], scanline[3],
+ r, g, b);
+ *scanline++ = 0;
+ *scanline++ = 0;
+ *scanline++ = 0;
+ *scanline++ = 255 - FXRGB2GRAY(r, g, b);
+ }
+ }
+ return true;
+ }
+ } else if (forecolor == 0 && backcolor == 0xffffff) {
+ for (int row = 0; row < m_Height; row++) {
+ uint8_t* scanline = m_pBuffer.Get() + row * m_Pitch;
+ int gap = m_bpp / 8 - 2;
+ for (int col = 0; col < m_Width; col++) {
+ int gray = FXRGB2GRAY(scanline[2], scanline[1], scanline[0]);
+ *scanline++ = gray;
+ *scanline++ = gray;
+ *scanline = gray;
+ scanline += gap;
+ }
+ }
+ return true;
+ }
+ if (isCmykImage) {
+ for (int row = 0; row < m_Height; row++) {
+ uint8_t* scanline = m_pBuffer.Get() + row * m_Pitch;
+ for (int col = 0; col < m_Width; col++) {
+ uint8_t b, g, r;
+ AdobeCMYK_to_sRGB1(scanline[0], scanline[1], scanline[2], scanline[3],
+ r, g, b);
+ int gray = 255 - FXRGB2GRAY(r, g, b);
+ *scanline++ = bc + (fc - bc) * gray / 255;
+ *scanline++ = bm + (fm - bm) * gray / 255;
+ *scanline++ = by + (fy - by) * gray / 255;
+ *scanline++ = bk + (fk - bk) * gray / 255;
+ }
+ }
+ } else {
+ for (int row = 0; row < m_Height; row++) {
+ uint8_t* scanline = m_pBuffer.Get() + row * m_Pitch;
+ int gap = m_bpp / 8 - 2;
+ for (int col = 0; col < m_Width; col++) {
+ int gray = FXRGB2GRAY(scanline[2], scanline[1], scanline[0]);
+ *scanline++ = bb + (fb - bb) * gray / 255;
+ *scanline++ = bg + (fg - bg) * gray / 255;
+ *scanline = br + (fr - br) * gray / 255;
+ scanline += gap;
+ }
+ }
+ }
+ return true;
+}
+
+bool CFX_DIBitmap::CompositeBitmap(
+ int dest_left,
+ int dest_top,
+ int width,
+ int height,
+ const CFX_RetainPtr<CFX_DIBSource>& pSrcBitmap,
+ int src_left,
+ int src_top,
+ int blend_type,
+ const CFX_ClipRgn* pClipRgn,
+ bool bRgbByteOrder) {
+ if (!m_pBuffer)
+ return false;
+
+ ASSERT(!pSrcBitmap->IsAlphaMask());
+ ASSERT(m_bpp >= 8);
+ if (pSrcBitmap->IsAlphaMask() || m_bpp < 8) {
+ return false;
+ }
+ GetOverlapRect(dest_left, dest_top, width, height, pSrcBitmap->GetWidth(),
+ pSrcBitmap->GetHeight(), src_left, src_top, pClipRgn);
+ if (width == 0 || height == 0) {
+ return true;
+ }
+ CFX_RetainPtr<CFX_DIBitmap> pClipMask;
+ FX_RECT clip_box;
+ if (pClipRgn && pClipRgn->GetType() != CFX_ClipRgn::RectI) {
+ ASSERT(pClipRgn->GetType() == CFX_ClipRgn::MaskF);
+ pClipMask = pClipRgn->GetMask();
+ clip_box = pClipRgn->GetBox();
+ }
+ CFX_ScanlineCompositor compositor;
+ if (!compositor.Init(GetFormat(), pSrcBitmap->GetFormat(), width,
+ pSrcBitmap->GetPalette(), 0, blend_type,
+ pClipMask != nullptr, bRgbByteOrder, 0)) {
+ return false;
+ }
+ int dest_Bpp = m_bpp / 8;
+ int src_Bpp = pSrcBitmap->GetBPP() / 8;
+ bool bRgb = src_Bpp > 1 && !pSrcBitmap->IsCmykImage();
+ CFX_RetainPtr<CFX_DIBitmap> pSrcAlphaMask = pSrcBitmap->m_pAlphaMask;
+ for (int row = 0; row < height; row++) {
+ uint8_t* dest_scan =
+ m_pBuffer.Get() + (dest_top + row) * m_Pitch + dest_left * dest_Bpp;
+ const uint8_t* src_scan =
+ pSrcBitmap->GetScanline(src_top + row) + src_left * src_Bpp;
+ const uint8_t* src_scan_extra_alpha =
+ pSrcAlphaMask ? pSrcAlphaMask->GetScanline(src_top + row) + src_left
+ : nullptr;
+ uint8_t* dst_scan_extra_alpha =
+ m_pAlphaMask
+ ? (uint8_t*)m_pAlphaMask->GetScanline(dest_top + row) + dest_left
+ : nullptr;
+ const uint8_t* clip_scan = nullptr;
+ if (pClipMask) {
+ clip_scan = pClipMask->m_pBuffer.Get() +
+ (dest_top + row - clip_box.top) * pClipMask->m_Pitch +
+ (dest_left - clip_box.left);
+ }
+ if (bRgb) {
+ compositor.CompositeRgbBitmapLine(dest_scan, src_scan, width, clip_scan,
+ src_scan_extra_alpha,
+ dst_scan_extra_alpha);
+ } else {
+ compositor.CompositePalBitmapLine(dest_scan, src_scan, src_left, width,
+ clip_scan, src_scan_extra_alpha,
+ dst_scan_extra_alpha);
+ }
+ }
+ return true;
+}
+
+bool CFX_DIBitmap::CompositeMask(int dest_left,
+ int dest_top,
+ int width,
+ int height,
+ const CFX_RetainPtr<CFX_DIBSource>& pMask,
+ uint32_t color,
+ int src_left,
+ int src_top,
+ int blend_type,
+ const CFX_ClipRgn* pClipRgn,
+ bool bRgbByteOrder,
+ int alpha_flag) {
+ if (!m_pBuffer)
+ return false;
+
+ ASSERT(pMask->IsAlphaMask());
+ ASSERT(m_bpp >= 8);
+ if (!pMask->IsAlphaMask() || m_bpp < 8)
+ return false;
+
+ GetOverlapRect(dest_left, dest_top, width, height, pMask->GetWidth(),
+ pMask->GetHeight(), src_left, src_top, pClipRgn);
+ if (width == 0 || height == 0)
+ return true;
+
+ int src_alpha =
+ (uint8_t)(alpha_flag >> 8) ? (alpha_flag & 0xff) : FXARGB_A(color);
+ if (src_alpha == 0)
+ return true;
+
+ CFX_RetainPtr<CFX_DIBitmap> pClipMask;
+ FX_RECT clip_box;
+ if (pClipRgn && pClipRgn->GetType() != CFX_ClipRgn::RectI) {
+ ASSERT(pClipRgn->GetType() == CFX_ClipRgn::MaskF);
+ pClipMask = pClipRgn->GetMask();
+ clip_box = pClipRgn->GetBox();
+ }
+ int src_bpp = pMask->GetBPP();
+ int Bpp = GetBPP() / 8;
+ CFX_ScanlineCompositor compositor;
+ if (!compositor.Init(GetFormat(), pMask->GetFormat(), width, nullptr, color,
+ blend_type, pClipMask != nullptr, bRgbByteOrder,
+ alpha_flag)) {
+ return false;
+ }
+ for (int row = 0; row < height; row++) {
+ uint8_t* dest_scan =
+ m_pBuffer.Get() + (dest_top + row) * m_Pitch + dest_left * Bpp;
+ const uint8_t* src_scan = pMask->GetScanline(src_top + row);
+ uint8_t* dst_scan_extra_alpha =
+ m_pAlphaMask
+ ? (uint8_t*)m_pAlphaMask->GetScanline(dest_top + row) + dest_left
+ : nullptr;
+ const uint8_t* clip_scan = nullptr;
+ if (pClipMask) {
+ clip_scan = pClipMask->m_pBuffer.Get() +
+ (dest_top + row - clip_box.top) * pClipMask->m_Pitch +
+ (dest_left - clip_box.left);
+ }
+ if (src_bpp == 1) {
+ compositor.CompositeBitMaskLine(dest_scan, src_scan, src_left, width,
+ clip_scan, dst_scan_extra_alpha);
+ } else {
+ compositor.CompositeByteMaskLine(dest_scan, src_scan + src_left, width,
+ clip_scan, dst_scan_extra_alpha);
+ }
+ }
+ return true;
+}
+
+bool CFX_DIBitmap::CompositeRect(int left,
+ int top,
+ int width,
+ int height,
+ uint32_t color,
+ int alpha_flag) {
+ if (!m_pBuffer)
+ return false;
+
+ int src_alpha = (alpha_flag >> 8) ? (alpha_flag & 0xff) : FXARGB_A(color);
+ if (src_alpha == 0)
+ return true;
+
+ FX_RECT rect(left, top, left + width, top + height);
+ rect.Intersect(0, 0, m_Width, m_Height);
+ if (rect.IsEmpty())
+ return true;
+
+ width = rect.Width();
+ uint32_t dst_color;
+ if (alpha_flag >> 8)
+ dst_color = FXCMYK_TODIB(color);
+ else
+ dst_color = FXARGB_TODIB(color);
+ uint8_t* color_p = (uint8_t*)&dst_color;
+ if (m_bpp == 8) {
+ uint8_t gray = 255;
+ if (!IsAlphaMask()) {
+ if (alpha_flag >> 8) {
+ uint8_t r;
+ uint8_t g;
+ uint8_t b;
+ AdobeCMYK_to_sRGB1(color_p[0], color_p[1], color_p[2], color_p[3], r, g,
+ b);
+ gray = FXRGB2GRAY(r, g, b);
+ } else {
+ gray = (uint8_t)FXRGB2GRAY((int)color_p[2], color_p[1], color_p[0]);
+ }
+ if (IsCmykImage()) {
+ gray = ~gray;
+ }
+ }
+ for (int row = rect.top; row < rect.bottom; row++) {
+ uint8_t* dest_scan = m_pBuffer.Get() + row * m_Pitch + rect.left;
+ if (src_alpha == 255) {
+ memset(dest_scan, gray, width);
+ } else {
+ for (int col = 0; col < width; col++) {
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, src_alpha);
+ dest_scan++;
+ }
+ }
+ }
+ return true;
+ }
+ if (m_bpp == 1) {
+ ASSERT(!IsCmykImage() && static_cast<uint8_t>(alpha_flag >> 8) == 0);
+ int left_shift = rect.left % 8;
+ int right_shift = rect.right % 8;
+ int new_width = rect.right / 8 - rect.left / 8;
+ int index = 0;
+ if (m_pPalette) {
+ for (int i = 0; i < 2; i++) {
+ if (m_pPalette.get()[i] == color)
+ index = i;
+ }
+ } else {
+ index = (static_cast<uint8_t>(color) == 0xff) ? 1 : 0;
+ }
+ for (int row = rect.top; row < rect.bottom; row++) {
+ uint8_t* dest_scan_top =
+ const_cast<uint8_t*>(GetScanline(row)) + rect.left / 8;
+ uint8_t* dest_scan_top_r =
+ const_cast<uint8_t*>(GetScanline(row)) + rect.right / 8;
+ uint8_t left_flag = *dest_scan_top & (255 << (8 - left_shift));
+ uint8_t right_flag = *dest_scan_top_r & (255 >> right_shift);
+ if (new_width) {
+ memset(dest_scan_top + 1, index ? 255 : 0, new_width - 1);
+ if (!index) {
+ *dest_scan_top &= left_flag;
+ *dest_scan_top_r &= right_flag;
+ } else {
+ *dest_scan_top |= ~left_flag;
+ *dest_scan_top_r |= ~right_flag;
+ }
+ } else {
+ if (!index) {
+ *dest_scan_top &= left_flag | right_flag;
+ } else {
+ *dest_scan_top |= ~(left_flag | right_flag);
+ }
+ }
+ }
+ return true;
+ }
+ ASSERT(m_bpp >= 24);
+ if (m_bpp < 24 || (!(alpha_flag >> 8) && IsCmykImage()))
+ return false;
+ if (alpha_flag >> 8 && !IsCmykImage()) {
+ AdobeCMYK_to_sRGB1(FXSYS_GetCValue(color), FXSYS_GetMValue(color),
+ FXSYS_GetYValue(color), FXSYS_GetKValue(color),
+ color_p[2], color_p[1], color_p[0]);
+ }
+ if (!IsCmykImage())
+ color_p[3] = static_cast<uint8_t>(src_alpha);
+ int Bpp = m_bpp / 8;
+ bool bAlpha = HasAlpha();
+ bool bArgb = GetFormat() == FXDIB_Argb;
+ if (src_alpha == 255) {
+ for (int row = rect.top; row < rect.bottom; row++) {
+ uint8_t* dest_scan = m_pBuffer.Get() + row * m_Pitch + rect.left * Bpp;
+ uint8_t* dest_scan_alpha =
+ m_pAlphaMask ? (uint8_t*)m_pAlphaMask->GetScanline(row) + rect.left
+ : nullptr;
+ if (dest_scan_alpha) {
+ memset(dest_scan_alpha, 0xff, width);
+ }
+ if (Bpp == 4) {
+ uint32_t* scan = (uint32_t*)dest_scan;
+ for (int col = 0; col < width; col++) {
+ *scan++ = dst_color;
+ }
+ } else {
+ for (int col = 0; col < width; col++) {
+ *dest_scan++ = color_p[0];
+ *dest_scan++ = color_p[1];
+ *dest_scan++ = color_p[2];
+ }
+ }
+ }
+ return true;
+ }
+ for (int row = rect.top; row < rect.bottom; row++) {
+ uint8_t* dest_scan = m_pBuffer.Get() + row * m_Pitch + rect.left * Bpp;
+ if (bAlpha) {
+ if (bArgb) {
+ for (int col = 0; col < width; col++) {
+ uint8_t back_alpha = dest_scan[3];
+ if (back_alpha == 0) {
+ FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alpha, color_p[2],
+ color_p[1], color_p[0]));
+ dest_scan += 4;
+ continue;
+ }
+ uint8_t dest_alpha =
+ back_alpha + src_alpha - back_alpha * src_alpha / 255;
+ int alpha_ratio = src_alpha * 255 / dest_alpha;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, color_p[0], alpha_ratio);
+ dest_scan++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, color_p[1], alpha_ratio);
+ dest_scan++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, color_p[2], alpha_ratio);
+ dest_scan++;
+ *dest_scan++ = dest_alpha;
+ }
+ } else {
+ uint8_t* dest_scan_alpha =
+ (uint8_t*)m_pAlphaMask->GetScanline(row) + rect.left;
+ for (int col = 0; col < width; col++) {
+ uint8_t back_alpha = *dest_scan_alpha;
+ if (back_alpha == 0) {
+ *dest_scan_alpha++ = src_alpha;
+ memcpy(dest_scan, color_p, Bpp);
+ dest_scan += Bpp;
+ continue;
+ }
+ uint8_t dest_alpha =
+ back_alpha + src_alpha - back_alpha * src_alpha / 255;
+ *dest_scan_alpha++ = dest_alpha;
+ int alpha_ratio = src_alpha * 255 / dest_alpha;
+ for (int comps = 0; comps < Bpp; comps++) {
+ *dest_scan =
+ FXDIB_ALPHA_MERGE(*dest_scan, color_p[comps], alpha_ratio);
+ dest_scan++;
+ }
+ }
+ }
+ } else {
+ for (int col = 0; col < width; col++) {
+ for (int comps = 0; comps < Bpp; comps++) {
+ if (comps == 3) {
+ *dest_scan++ = 255;
+ continue;
+ }
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, color_p[comps], src_alpha);
+ dest_scan++;
+ }
+ }
+ }
+ }
+ return true;
+}
+
+bool CFX_DIBitmap::ConvertFormat(FXDIB_Format dest_format) {
+ FXDIB_Format src_format = GetFormat();
+ if (dest_format == src_format)
+ return true;
+
+ if (dest_format == FXDIB_8bppMask && src_format == FXDIB_8bppRgb &&
+ !m_pPalette) {
+ m_AlphaFlag = 1;
+ return true;
+ }
+ if (dest_format == FXDIB_Argb && src_format == FXDIB_Rgb32) {
+ m_AlphaFlag = 2;
+ for (int row = 0; row < m_Height; row++) {
+ uint8_t* scanline = m_pBuffer.Get() + row * m_Pitch + 3;
+ for (int col = 0; col < m_Width; col++) {
+ *scanline = 0xff;
+ scanline += 4;
+ }
+ }
+ return true;
+ }
+ int dest_bpp = dest_format & 0xff;
+ int dest_pitch = (dest_bpp * m_Width + 31) / 32 * 4;
+ std::unique_ptr<uint8_t, FxFreeDeleter> dest_buf(
+ FX_TryAlloc(uint8_t, dest_pitch * m_Height + 4));
+ if (!dest_buf)
+ return false;
+
+ CFX_RetainPtr<CFX_DIBitmap> pAlphaMask;
+ if (dest_format == FXDIB_Argb) {
+ memset(dest_buf.get(), 0xff, dest_pitch * m_Height + 4);
+ if (m_pAlphaMask) {
+ for (int row = 0; row < m_Height; row++) {
+ uint8_t* pDstScanline = dest_buf.get() + row * dest_pitch + 3;
+ const uint8_t* pSrcScanline = m_pAlphaMask->GetScanline(row);
+ for (int col = 0; col < m_Width; col++) {
+ *pDstScanline = *pSrcScanline++;
+ pDstScanline += 4;
+ }
+ }
+ }
+ } else if (dest_format & 0x0200) {
+ if (src_format == FXDIB_Argb) {
+ pAlphaMask = CloneAlphaMask();
+ if (!pAlphaMask)
+ return false;
+ } else {
+ if (!m_pAlphaMask) {
+ if (!BuildAlphaMask())
+ return false;
+ pAlphaMask = std::move(m_pAlphaMask);
+ } else {
+ pAlphaMask = m_pAlphaMask;
+ }
+ }
+ }
+ bool ret = false;
+ CFX_RetainPtr<CFX_DIBSource> holder(this);
+ std::unique_ptr<uint32_t, FxFreeDeleter> pal_8bpp;
+ ret = ConvertBuffer(dest_format, dest_buf.get(), dest_pitch, m_Width,
+ m_Height, holder, 0, 0, &pal_8bpp);
+ if (!ret)
+ return false;
+
+ m_pAlphaMask = pAlphaMask;
+ m_pPalette = std::move(pal_8bpp);
+ m_pBuffer = std::move(dest_buf);
+ m_bpp = static_cast<uint8_t>(dest_format);
+ m_AlphaFlag = static_cast<uint8_t>(dest_format >> 8);
+ m_Pitch = dest_pitch;
+ return true;
+}
diff --git a/chromium/third_party/pdfium/core/fxge/dib/cfx_dibitmap.h b/chromium/third_party/pdfium/core/fxge/dib/cfx_dibitmap.h
new file mode 100644
index 00000000000..6fd4b7c89a4
--- /dev/null
+++ b/chromium/third_party/pdfium/core/fxge/dib/cfx_dibitmap.h
@@ -0,0 +1,120 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef CORE_FXGE_DIB_CFX_DIBITMAP_H_
+#define CORE_FXGE_DIB_CFX_DIBITMAP_H_
+
+#include "core/fxcrt/cfx_maybe_owned.h"
+#include "core/fxcrt/cfx_retain_ptr.h"
+#include "core/fxcrt/fx_basic.h"
+#include "core/fxcrt/fx_coordinates.h"
+#include "core/fxge/dib/cfx_dibsource.h"
+#include "third_party/base/stl_util.h"
+
+class CFX_DIBitmap : public CFX_DIBSource {
+ public:
+ template <typename T, typename... Args>
+ friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args);
+
+ ~CFX_DIBitmap() override;
+
+ bool Create(int width,
+ int height,
+ FXDIB_Format format,
+ uint8_t* pBuffer = nullptr,
+ int pitch = 0);
+
+ bool Copy(const CFX_RetainPtr<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,
+ bool bFlipX,
+ int clip_left,
+ int clip_width) const override;
+
+ void TakeOver(CFX_RetainPtr<CFX_DIBitmap>&& pSrcBitmap);
+ bool ConvertFormat(FXDIB_Format format);
+ void Clear(uint32_t color);
+
+ uint32_t GetPixel(int x, int y) const;
+ void SetPixel(int x, int y, uint32_t color);
+
+ bool LoadChannel(FXDIB_Channel destChannel,
+ const CFX_RetainPtr<CFX_DIBSource>& pSrcBitmap,
+ FXDIB_Channel srcChannel);
+ bool LoadChannel(FXDIB_Channel destChannel, int value);
+
+ bool MultiplyAlpha(int alpha);
+ bool MultiplyAlpha(const CFX_RetainPtr<CFX_DIBSource>& pAlphaMask);
+
+ bool TransferBitmap(int dest_left,
+ int dest_top,
+ int width,
+ int height,
+ const CFX_RetainPtr<CFX_DIBSource>& pSrcBitmap,
+ int src_left,
+ int src_top);
+
+ bool CompositeBitmap(int dest_left,
+ int dest_top,
+ int width,
+ int height,
+ const CFX_RetainPtr<CFX_DIBSource>& pSrcBitmap,
+ int src_left,
+ int src_top,
+ int blend_type = FXDIB_BLEND_NORMAL,
+ const CFX_ClipRgn* pClipRgn = nullptr,
+ bool bRgbByteOrder = false);
+
+ bool CompositeMask(int dest_left,
+ int dest_top,
+ int width,
+ int height,
+ const CFX_RetainPtr<CFX_DIBSource>& pMask,
+ uint32_t color,
+ int src_left,
+ int src_top,
+ int blend_type = FXDIB_BLEND_NORMAL,
+ const CFX_ClipRgn* pClipRgn = nullptr,
+ bool bRgbByteOrder = false,
+ int alpha_flag = 0);
+
+ bool CompositeRect(int dest_left,
+ int dest_top,
+ int width,
+ int height,
+ uint32_t color,
+ int alpha_flag);
+
+ bool ConvertColorScale(uint32_t forecolor, uint32_t backcolor);
+
+#if defined _SKIA_SUPPORT_ || _SKIA_SUPPORT_PATHS_
+ void PreMultiply();
+#endif
+#if defined _SKIA_SUPPORT_PATHS_
+ void UnPreMultiply();
+#endif
+
+ protected:
+ CFX_DIBitmap();
+ CFX_DIBitmap(const CFX_DIBitmap& src);
+
+#if defined _SKIA_SUPPORT_PATHS_
+ enum class Format { kCleared, kPreMultiplied, kUnPreMultiplied };
+#endif
+
+ CFX_MaybeOwned<uint8_t, FxFreeDeleter> m_pBuffer;
+#if defined _SKIA_SUPPORT_PATHS_
+ Format m_nFormat;
+#endif
+};
+
+#endif // CORE_FXGE_DIB_CFX_DIBITMAP_H_
diff --git a/chromium/third_party/pdfium/core/fxge/dib/cfx_dibsource.cpp b/chromium/third_party/pdfium/core/fxge/dib/cfx_dibsource.cpp
new file mode 100644
index 00000000000..63fcc5806ac
--- /dev/null
+++ b/chromium/third_party/pdfium/core/fxge/dib/cfx_dibsource.cpp
@@ -0,0 +1,1264 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "core/fxge/dib/cfx_dibsource.h"
+
+#include <algorithm>
+#include <memory>
+#include <utility>
+#include <vector>
+
+#include "core/fxcodec/fx_codec.h"
+#include "core/fxge/dib/cfx_bitmapstorer.h"
+#include "core/fxge/dib/cfx_dibitmap.h"
+#include "core/fxge/dib/cfx_imagestretcher.h"
+#include "core/fxge/dib/cfx_imagetransformer.h"
+#include "core/fxge/ge/cfx_cliprgn.h"
+#include "third_party/base/ptr_util.h"
+
+namespace {
+
+class CFX_Palette {
+ public:
+ explicit CFX_Palette(const CFX_RetainPtr<CFX_DIBSource>& pBitmap);
+ ~CFX_Palette();
+
+ const uint32_t* GetPalette() { return m_Palette.data(); }
+ const std::pair<uint32_t, uint32_t>* GetLuts() const { return m_Luts.data(); }
+ int32_t GetLutCount() const { return m_lut; }
+ void SetAmountLut(int row, uint32_t value) { m_Luts[row].first = value; }
+
+ private:
+ std::vector<uint32_t> m_Palette;
+ // (Amount, Color) pairs
+ std::vector<std::pair<uint32_t, uint32_t>> m_Luts;
+ int m_lut;
+};
+
+void ColorDecode(uint32_t pal_v, uint8_t* r, uint8_t* g, uint8_t* b) {
+ *r = static_cast<uint8_t>((pal_v & 0xf00) >> 4);
+ *g = static_cast<uint8_t>(pal_v & 0x0f0);
+ *b = static_cast<uint8_t>((pal_v & 0x00f) << 4);
+}
+
+void Obtain_Pal(std::pair<uint32_t, uint32_t>* luts,
+ uint32_t* dest_pal,
+ uint32_t lut) {
+ uint32_t lut_1 = lut - 1;
+ for (int row = 0; row < 256; row++) {
+ int lut_offset = lut_1 - row;
+ if (lut_offset < 0)
+ lut_offset += 256;
+ uint32_t color = luts[lut_offset].second;
+ uint8_t r;
+ uint8_t g;
+ uint8_t b;
+ ColorDecode(color, &r, &g, &b);
+ dest_pal[row] = (static_cast<uint32_t>(r) << 16) |
+ (static_cast<uint32_t>(g) << 8) | b | 0xff000000;
+ luts[lut_offset].first = row;
+ }
+}
+
+CFX_Palette::CFX_Palette(const CFX_RetainPtr<CFX_DIBSource>& pBitmap)
+ : m_Palette(256), m_Luts(4096), m_lut(0) {
+ int bpp = pBitmap->GetBPP() / 8;
+ int width = pBitmap->GetWidth();
+ int height = pBitmap->GetHeight();
+ for (int row = 0; row < height; ++row) {
+ const uint8_t* scan_line = pBitmap->GetScanline(row);
+ for (int col = 0; col < width; ++col) {
+ const uint8_t* src_port = scan_line + col * bpp;
+ uint32_t b = src_port[0] & 0xf0;
+ uint32_t g = src_port[1] & 0xf0;
+ uint32_t r = src_port[2] & 0xf0;
+ uint32_t index = (r << 4) + g + (b >> 4);
+ m_Luts[index].first++;
+ }
+ }
+ // Move non-zeros to the front and count them
+ for (int row = 0; row < 4096; ++row) {
+ if (m_Luts[row].first != 0) {
+ m_Luts[m_lut].first = m_Luts[row].first;
+ m_Luts[m_lut].second = row;
+ ++m_lut;
+ }
+ }
+ std::sort(m_Luts.begin(), m_Luts.begin() + m_lut,
+ [](const std::pair<uint32_t, uint32_t>& arg1,
+ const std::pair<uint32_t, uint32_t>& arg2) {
+ return arg1.first < arg2.first;
+ });
+ Obtain_Pal(m_Luts.data(), m_Palette.data(), m_lut);
+}
+
+CFX_Palette::~CFX_Palette() {}
+
+bool ConvertBuffer_1bppMask2Gray(uint8_t* dest_buf,
+ int dest_pitch,
+ int width,
+ int height,
+ const CFX_RetainPtr<CFX_DIBSource>& pSrcBitmap,
+ int src_left,
+ int src_top) {
+ uint8_t set_gray, reset_gray;
+ set_gray = 0xff;
+ reset_gray = 0x00;
+ for (int row = 0; row < height; row++) {
+ uint8_t* dest_scan = dest_buf + row * dest_pitch;
+ memset(dest_scan, reset_gray, width);
+ const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row);
+ for (int col = src_left; col < src_left + width; col++) {
+ if (src_scan[col / 8] & (1 << (7 - col % 8))) {
+ *dest_scan = set_gray;
+ }
+ dest_scan++;
+ }
+ }
+ return true;
+}
+
+bool ConvertBuffer_8bppMask2Gray(uint8_t* dest_buf,
+ int dest_pitch,
+ int width,
+ int height,
+ const CFX_RetainPtr<CFX_DIBSource>& pSrcBitmap,
+ int src_left,
+ int src_top) {
+ for (int row = 0; row < height; row++) {
+ uint8_t* dest_scan = dest_buf + row * dest_pitch;
+ const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left;
+ memcpy(dest_scan, src_scan, width);
+ }
+ return true;
+}
+
+bool ConvertBuffer_1bppPlt2Gray(uint8_t* dest_buf,
+ int dest_pitch,
+ int width,
+ int height,
+ const CFX_RetainPtr<CFX_DIBSource>& pSrcBitmap,
+ int src_left,
+ int src_top) {
+ uint32_t* src_plt = pSrcBitmap->GetPalette();
+ uint8_t gray[2];
+ uint8_t reset_r;
+ uint8_t reset_g;
+ uint8_t reset_b;
+ uint8_t set_r;
+ uint8_t set_g;
+ uint8_t set_b;
+ if (pSrcBitmap->IsCmykImage()) {
+ AdobeCMYK_to_sRGB1(FXSYS_GetCValue(src_plt[0]), FXSYS_GetMValue(src_plt[0]),
+ FXSYS_GetYValue(src_plt[0]), FXSYS_GetKValue(src_plt[0]),
+ reset_r, reset_g, reset_b);
+ AdobeCMYK_to_sRGB1(FXSYS_GetCValue(src_plt[1]), FXSYS_GetMValue(src_plt[1]),
+ FXSYS_GetYValue(src_plt[1]), FXSYS_GetKValue(src_plt[1]),
+ set_r, set_g, set_b);
+ } else {
+ reset_r = FXARGB_R(src_plt[0]);
+ reset_g = FXARGB_G(src_plt[0]);
+ reset_b = FXARGB_B(src_plt[0]);
+ set_r = FXARGB_R(src_plt[1]);
+ set_g = FXARGB_G(src_plt[1]);
+ set_b = FXARGB_B(src_plt[1]);
+ }
+ gray[0] = FXRGB2GRAY(reset_r, reset_g, reset_b);
+ gray[1] = FXRGB2GRAY(set_r, set_g, set_b);
+
+ for (int row = 0; row < height; row++) {
+ uint8_t* dest_scan = dest_buf + row * dest_pitch;
+ memset(dest_scan, gray[0], width);
+ const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row);
+ for (int col = src_left; col < src_left + width; col++) {
+ if (src_scan[col / 8] & (1 << (7 - col % 8))) {
+ *dest_scan = gray[1];
+ }
+ dest_scan++;
+ }
+ }
+ return true;
+}
+
+bool ConvertBuffer_8bppPlt2Gray(uint8_t* dest_buf,
+ int dest_pitch,
+ int width,
+ int height,
+ const CFX_RetainPtr<CFX_DIBSource>& pSrcBitmap,
+ int src_left,
+ int src_top) {
+ uint32_t* src_plt = pSrcBitmap->GetPalette();
+ uint8_t gray[256];
+ if (pSrcBitmap->IsCmykImage()) {
+ uint8_t r;
+ uint8_t g;
+ uint8_t b;
+ for (size_t i = 0; i < FX_ArraySize(gray); i++) {
+ AdobeCMYK_to_sRGB1(
+ FXSYS_GetCValue(src_plt[i]), FXSYS_GetMValue(src_plt[i]),
+ FXSYS_GetYValue(src_plt[i]), FXSYS_GetKValue(src_plt[i]), r, g, b);
+ gray[i] = FXRGB2GRAY(r, g, b);
+ }
+ } else {
+ for (size_t i = 0; i < FX_ArraySize(gray); i++) {
+ gray[i] = FXRGB2GRAY(FXARGB_R(src_plt[i]), FXARGB_G(src_plt[i]),
+ FXARGB_B(src_plt[i]));
+ }
+ }
+
+ for (int row = 0; row < height; row++) {
+ uint8_t* dest_scan = dest_buf + row * dest_pitch;
+ const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left;
+ for (int col = 0; col < width; col++) {
+ *dest_scan++ = gray[*src_scan++];
+ }
+ }
+ return true;
+}
+
+bool ConvertBuffer_RgbOrCmyk2Gray(
+ uint8_t* dest_buf,
+ int dest_pitch,
+ int width,
+ int height,
+ const CFX_RetainPtr<CFX_DIBSource>& pSrcBitmap,
+ int src_left,
+ int src_top) {
+ int Bpp = pSrcBitmap->GetBPP() / 8;
+ if (pSrcBitmap->IsCmykImage()) {
+ for (int row = 0; row < height; row++) {
+ uint8_t* dest_scan = dest_buf + row * dest_pitch;
+ const uint8_t* src_scan =
+ pSrcBitmap->GetScanline(src_top + row) + src_left * 4;
+ for (int col = 0; col < width; col++) {
+ uint8_t r, g, b;
+ AdobeCMYK_to_sRGB1(FXSYS_GetCValue(static_cast<uint32_t>(src_scan[0])),
+ FXSYS_GetMValue(static_cast<uint32_t>(src_scan[1])),
+ FXSYS_GetYValue(static_cast<uint32_t>(src_scan[2])),
+ FXSYS_GetKValue(static_cast<uint32_t>(src_scan[3])),
+ r, g, b);
+ *dest_scan++ = FXRGB2GRAY(r, g, b);
+ src_scan += 4;
+ }
+ }
+ } else {
+ for (int row = 0; row < height; row++) {
+ uint8_t* dest_scan = dest_buf + row * dest_pitch;
+ const uint8_t* src_scan =
+ pSrcBitmap->GetScanline(src_top + row) + src_left * Bpp;
+ for (int col = 0; col < width; col++) {
+ *dest_scan++ = FXRGB2GRAY(src_scan[2], src_scan[1], src_scan[0]);
+ src_scan += Bpp;
+ }
+ }
+ }
+ return true;
+}
+
+void ConvertBuffer_IndexCopy(uint8_t* dest_buf,
+ int dest_pitch,
+ int width,
+ int height,
+ const CFX_RetainPtr<CFX_DIBSource>& pSrcBitmap,
+ int src_left,
+ int src_top) {
+ if (pSrcBitmap->GetBPP() == 1) {
+ for (int row = 0; row < height; row++) {
+ uint8_t* dest_scan = dest_buf + row * dest_pitch;
+ memset(dest_scan, 0, width);
+ const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row);
+ for (int col = src_left; col < src_left + width; col++) {
+ if (src_scan[col / 8] & (1 << (7 - col % 8))) {
+ *dest_scan = 1;
+ }
+ dest_scan++;
+ }
+ }
+ } else {
+ for (int row = 0; row < height; row++) {
+ uint8_t* dest_scan = dest_buf + row * dest_pitch;
+ const uint8_t* src_scan =
+ pSrcBitmap->GetScanline(src_top + row) + src_left;
+ memcpy(dest_scan, src_scan, width);
+ }
+ }
+}
+
+bool ConvertBuffer_Plt2PltRgb8(uint8_t* dest_buf,
+ int dest_pitch,
+ int width,
+ int height,
+ const CFX_RetainPtr<CFX_DIBSource>& pSrcBitmap,
+ int src_left,
+ int src_top,
+ uint32_t* dst_plt) {
+ ConvertBuffer_IndexCopy(dest_buf, dest_pitch, width, height, pSrcBitmap,
+ src_left, src_top);
+ uint32_t* src_plt = pSrcBitmap->GetPalette();
+ int plt_size = pSrcBitmap->GetPaletteSize();
+ if (pSrcBitmap->IsCmykImage()) {
+ for (int i = 0; i < plt_size; i++) {
+ uint8_t r;
+ uint8_t g;
+ uint8_t b;
+ AdobeCMYK_to_sRGB1(
+ FXSYS_GetCValue(src_plt[i]), FXSYS_GetMValue(src_plt[i]),
+ FXSYS_GetYValue(src_plt[i]), FXSYS_GetKValue(src_plt[i]), r, g, b);
+ dst_plt[i] = FXARGB_MAKE(0xff, r, g, b);
+ }
+ } else {
+ memcpy(dst_plt, src_plt, plt_size * 4);
+ }
+ return true;
+}
+
+bool ConvertBuffer_Rgb2PltRgb8(uint8_t* dest_buf,
+ int dest_pitch,
+ int width,
+ int height,
+ const CFX_RetainPtr<CFX_DIBSource>& pSrcBitmap,
+ int src_left,
+ int src_top,
+ uint32_t* dst_plt) {
+ int bpp = pSrcBitmap->GetBPP() / 8;
+ if (!pSrcBitmap)
+ return false;
+ CFX_Palette palette(pSrcBitmap);
+ const std::pair<uint32_t, uint32_t>* Luts = palette.GetLuts();
+ int lut = palette.GetLutCount();
+ const uint32_t* pal = palette.GetPalette();
+ if (lut > 256) {
+ int err;
+ int min_err;
+ int lut_256 = lut - 256;
+ for (int row = 0; row < lut_256; row++) {
+ min_err = 1000000;
+ uint8_t r;
+ uint8_t g;
+ uint8_t b;
+ ColorDecode(Luts[row].second, &r, &g, &b);
+ uint32_t clrindex = 0;
+ for (int col = 0; col < 256; col++) {
+ uint32_t p_color = pal[col];
+ int d_r = r - static_cast<uint8_t>(p_color >> 16);
+ int d_g = g - static_cast<uint8_t>(p_color >> 8);
+ int d_b = b - static_cast<uint8_t>(p_color);
+ err = d_r * d_r + d_g * d_g + d_b * d_b;
+ if (err < min_err) {
+ min_err = err;
+ clrindex = col;
+ }
+ }
+ palette.SetAmountLut(row, clrindex);
+ }
+ }
+ int32_t lut_1 = lut - 1;
+ for (int row = 0; row < height; row++) {
+ uint8_t* src_scan =
+ const_cast<uint8_t*>(pSrcBitmap->GetScanline(src_top + row)) + src_left;
+ uint8_t* dest_scan = dest_buf + row * dest_pitch;
+ for (int col = 0; col < width; col++) {
+ uint8_t* src_port = src_scan + col * bpp;
+ int r = src_port[2] & 0xf0;
+ int g = src_port[1] & 0xf0;
+ int b = src_port[0] & 0xf0;
+ uint32_t clrindex = (r << 4) + g + (b >> 4);
+ for (int i = lut_1; i >= 0; i--)
+ if (clrindex == Luts[i].second) {
+ *(dest_scan + col) = static_cast<uint8_t>(Luts[i].first);
+ break;
+ }
+ }
+ }
+ memcpy(dst_plt, pal, sizeof(uint32_t) * 256);
+ return true;
+}
+
+bool ConvertBuffer_1bppMask2Rgb(FXDIB_Format dst_format,
+ uint8_t* dest_buf,
+ int dest_pitch,
+ int width,
+ int height,
+ const CFX_RetainPtr<CFX_DIBSource>& pSrcBitmap,
+ int src_left,
+ int src_top) {
+ int comps = (dst_format & 0xff) / 8;
+ uint8_t set_gray, reset_gray;
+ set_gray = 0xff;
+ reset_gray = 0x00;
+ for (int row = 0; row < height; row++) {
+ uint8_t* dest_scan = dest_buf + row * dest_pitch;
+ const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row);
+ for (int col = src_left; col < src_left + width; col++) {
+ if (src_scan[col / 8] & (1 << (7 - col % 8))) {
+ dest_scan[0] = set_gray;
+ dest_scan[1] = set_gray;
+ dest_scan[2] = set_gray;
+ } else {
+ dest_scan[0] = reset_gray;
+ dest_scan[1] = reset_gray;
+ dest_scan[2] = reset_gray;
+ }
+ dest_scan += comps;
+ }
+ }
+ return true;
+}
+
+bool ConvertBuffer_8bppMask2Rgb(FXDIB_Format dst_format,
+ uint8_t* dest_buf,
+ int dest_pitch,
+ int width,
+ int height,
+ const CFX_RetainPtr<CFX_DIBSource>& pSrcBitmap,
+ int src_left,
+ int src_top) {
+ int comps = (dst_format & 0xff) / 8;
+ for (int row = 0; row < height; row++) {
+ uint8_t* dest_scan = dest_buf + row * dest_pitch;
+ const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left;
+ uint8_t src_pixel;
+ for (int col = 0; col < width; col++) {
+ src_pixel = *src_scan++;
+ *dest_scan++ = src_pixel;
+ *dest_scan++ = src_pixel;
+ *dest_scan = src_pixel;
+ dest_scan += comps - 2;
+ }
+ }
+ return true;
+}
+
+bool ConvertBuffer_1bppPlt2Rgb(FXDIB_Format dst_format,
+ uint8_t* dest_buf,
+ int dest_pitch,
+ int width,
+ int height,
+ const CFX_RetainPtr<CFX_DIBSource>& pSrcBitmap,
+ int src_left,
+ int src_top) {
+ int comps = (dst_format & 0xff) / 8;
+ uint32_t* src_plt = pSrcBitmap->GetPalette();
+ uint32_t plt[2];
+ uint8_t* bgr_ptr = reinterpret_cast<uint8_t*>(plt);
+ if (pSrcBitmap->IsCmykImage()) {
+ plt[0] = FXCMYK_TODIB(src_plt[0]);
+ plt[1] = FXCMYK_TODIB(src_plt[1]);
+ } else {
+ bgr_ptr[0] = FXARGB_B(src_plt[0]);
+ bgr_ptr[1] = FXARGB_G(src_plt[0]);
+ bgr_ptr[2] = FXARGB_R(src_plt[0]);
+ bgr_ptr[3] = FXARGB_B(src_plt[1]);
+ bgr_ptr[4] = FXARGB_G(src_plt[1]);
+ bgr_ptr[5] = FXARGB_R(src_plt[1]);
+ }
+
+ if (pSrcBitmap->IsCmykImage()) {
+ AdobeCMYK_to_sRGB1(FXSYS_GetCValue(src_plt[0]), FXSYS_GetMValue(src_plt[0]),
+ FXSYS_GetYValue(src_plt[0]), FXSYS_GetKValue(src_plt[0]),
+ bgr_ptr[2], bgr_ptr[1], bgr_ptr[0]);
+ AdobeCMYK_to_sRGB1(FXSYS_GetCValue(src_plt[1]), FXSYS_GetMValue(src_plt[1]),
+ FXSYS_GetYValue(src_plt[1]), FXSYS_GetKValue(src_plt[1]),
+ bgr_ptr[5], bgr_ptr[4], bgr_ptr[3]);
+ }
+
+ for (int row = 0; row < height; row++) {
+ uint8_t* dest_scan = dest_buf + row * dest_pitch;
+ const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row);
+ for (int col = src_left; col < src_left + width; col++) {
+ if (src_scan[col / 8] & (1 << (7 - col % 8))) {
+ *dest_scan++ = bgr_ptr[3];
+ *dest_scan++ = bgr_ptr[4];
+ *dest_scan = bgr_ptr[5];
+ } else {
+ *dest_scan++ = bgr_ptr[0];
+ *dest_scan++ = bgr_ptr[1];
+ *dest_scan = bgr_ptr[2];
+ }
+ dest_scan += comps - 2;
+ }
+ }
+ return true;
+}
+
+bool ConvertBuffer_8bppPlt2Rgb(FXDIB_Format dst_format,
+ uint8_t* dest_buf,
+ int dest_pitch,
+ int width,
+ int height,
+ const CFX_RetainPtr<CFX_DIBSource>& pSrcBitmap,
+ int src_left,
+ int src_top) {
+ int comps = (dst_format & 0xff) / 8;
+ uint32_t* src_plt = pSrcBitmap->GetPalette();
+ uint32_t plt[256];
+ uint8_t* bgr_ptr = reinterpret_cast<uint8_t*>(plt);
+ if (!pSrcBitmap->IsCmykImage()) {
+ for (int i = 0; i < 256; i++) {
+ *bgr_ptr++ = FXARGB_B(src_plt[i]);
+ *bgr_ptr++ = FXARGB_G(src_plt[i]);
+ *bgr_ptr++ = FXARGB_R(src_plt[i]);
+ }
+ bgr_ptr = reinterpret_cast<uint8_t*>(plt);
+ }
+
+ if (pSrcBitmap->IsCmykImage()) {
+ for (int i = 0; i < 256; i++) {
+ AdobeCMYK_to_sRGB1(
+ FXSYS_GetCValue(src_plt[i]), FXSYS_GetMValue(src_plt[i]),
+ FXSYS_GetYValue(src_plt[i]), FXSYS_GetKValue(src_plt[i]), bgr_ptr[2],
+ bgr_ptr[1], bgr_ptr[0]);
+ bgr_ptr += 3;
+ }
+ bgr_ptr = reinterpret_cast<uint8_t*>(plt);
+ }
+
+ for (int row = 0; row < height; row++) {
+ uint8_t* dest_scan = dest_buf + row * dest_pitch;
+ const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left;
+ for (int col = 0; col < width; col++) {
+ uint8_t* src_pixel = bgr_ptr + 3 * (*src_scan++);
+ *dest_scan++ = *src_pixel++;
+ *dest_scan++ = *src_pixel++;
+ *dest_scan = *src_pixel++;
+ dest_scan += comps - 2;
+ }
+ }
+ return true;
+}
+
+bool ConvertBuffer_24bppRgb2Rgb24(
+ uint8_t* dest_buf,
+ int dest_pitch,
+ int width,
+ int height,
+ const CFX_RetainPtr<CFX_DIBSource>& pSrcBitmap,
+ int src_left,
+ int src_top) {
+ for (int row = 0; row < height; row++) {
+ uint8_t* dest_scan = dest_buf + row * dest_pitch;
+ const uint8_t* src_scan =
+ pSrcBitmap->GetScanline(src_top + row) + src_left * 3;
+ memcpy(dest_scan, src_scan, width * 3);
+ }
+ return true;
+}
+
+bool ConvertBuffer_32bppRgb2Rgb24(
+ uint8_t* dest_buf,
+ int dest_pitch,
+ int width,
+ int height,
+ const CFX_RetainPtr<CFX_DIBSource>& pSrcBitmap,
+ int src_left,
+ int src_top) {
+ for (int row = 0; row < height; row++) {
+ uint8_t* dest_scan = dest_buf + row * dest_pitch;
+ const uint8_t* src_scan =
+ pSrcBitmap->GetScanline(src_top + row) + src_left * 4;
+ for (int col = 0; col < width; col++) {
+ *dest_scan++ = *src_scan++;
+ *dest_scan++ = *src_scan++;
+ *dest_scan++ = *src_scan++;
+ src_scan++;
+ }
+ }
+ return true;
+}
+
+bool ConvertBuffer_Rgb2Rgb32(uint8_t* dest_buf,
+ int dest_pitch,
+ int width,
+ int height,
+ const CFX_RetainPtr<CFX_DIBSource>& pSrcBitmap,
+ int src_left,
+ int src_top) {
+ int comps = pSrcBitmap->GetBPP() / 8;
+ for (int row = 0; row < height; row++) {
+ uint8_t* dest_scan = dest_buf + row * dest_pitch;
+ const uint8_t* src_scan =
+ pSrcBitmap->GetScanline(src_top + row) + src_left * comps;
+ for (int col = 0; col < width; col++) {
+ *dest_scan++ = *src_scan++;
+ *dest_scan++ = *src_scan++;
+ *dest_scan++ = *src_scan++;
+ dest_scan++;
+ src_scan += comps - 3;
+ }
+ }
+ return true;
+}
+
+bool ConvertBuffer_32bppCmyk2Rgb32(
+ uint8_t* dest_buf,
+ int dest_pitch,
+ int width,
+ int height,
+ const CFX_RetainPtr<CFX_DIBSource>& pSrcBitmap,
+ int src_left,
+ int src_top) {
+ for (int row = 0; row < height; row++) {
+ uint8_t* dest_scan = dest_buf + row * dest_pitch;
+ const uint8_t* src_scan =
+ pSrcBitmap->GetScanline(src_top + row) + src_left * 4;
+ for (int col = 0; col < width; col++) {
+ AdobeCMYK_to_sRGB1(src_scan[0], src_scan[1], src_scan[2], src_scan[3],
+ dest_scan[2], dest_scan[1], dest_scan[0]);
+ dest_scan += 4;
+ src_scan += 4;
+ }
+ }
+ return true;
+}
+
+} // namespace
+
+CFX_DIBSource::CFX_DIBSource()
+ : m_Width(0), m_Height(0), m_bpp(0), m_AlphaFlag(0), m_Pitch(0) {}
+
+CFX_DIBSource::~CFX_DIBSource() {}
+
+uint8_t* CFX_DIBSource::GetBuffer() const {
+ return nullptr;
+}
+
+bool CFX_DIBSource::SkipToScanline(int line, IFX_Pause* pPause) const {
+ return false;
+}
+
+CFX_RetainPtr<CFX_DIBitmap> CFX_DIBSource::Clone(const FX_RECT* pClip) const {
+ FX_RECT rect(0, 0, m_Width, m_Height);
+ if (pClip) {
+ rect.Intersect(*pClip);
+ if (rect.IsEmpty())
+ return nullptr;
+ }
+ auto pNewBitmap = pdfium::MakeRetain<CFX_DIBitmap>();
+ if (!pNewBitmap->Create(rect.Width(), rect.Height(), GetFormat()))
+ return nullptr;
+
+ pNewBitmap->SetPalette(m_pPalette.get());
+ pNewBitmap->SetAlphaMask(m_pAlphaMask, pClip);
+ if (GetBPP() == 1 && rect.left % 8 != 0) {
+ int left_shift = rect.left % 32;
+ int right_shift = 32 - left_shift;
+ int dword_count = pNewBitmap->m_Pitch / 4;
+ for (int row = rect.top; row < rect.bottom; row++) {
+ uint32_t* src_scan = (uint32_t*)GetScanline(row) + rect.left / 32;
+ uint32_t* dest_scan = (uint32_t*)pNewBitmap->GetScanline(row - rect.top);
+ for (int i = 0; i < dword_count; i++) {
+ dest_scan[i] =
+ (src_scan[i] << left_shift) | (src_scan[i + 1] >> right_shift);
+ }
+ }
+ } else {
+ int copy_len = (pNewBitmap->GetWidth() * pNewBitmap->GetBPP() + 7) / 8;
+ if (m_Pitch < static_cast<uint32_t>(copy_len))
+ copy_len = m_Pitch;
+
+ for (int row = rect.top; row < rect.bottom; row++) {
+ const uint8_t* src_scan = GetScanline(row) + rect.left * m_bpp / 8;
+ uint8_t* dest_scan = (uint8_t*)pNewBitmap->GetScanline(row - rect.top);
+ memcpy(dest_scan, src_scan, copy_len);
+ }
+ }
+ return pNewBitmap;
+}
+
+void CFX_DIBSource::BuildPalette() {
+ if (m_pPalette)
+ return;
+
+ if (GetBPP() == 1) {
+ m_pPalette.reset(FX_Alloc(uint32_t, 2));
+ if (IsCmykImage()) {
+ m_pPalette.get()[0] = 0xff;
+ m_pPalette.get()[1] = 0;
+ } else {
+ m_pPalette.get()[0] = 0xff000000;
+ m_pPalette.get()[1] = 0xffffffff;
+ }
+ } else if (GetBPP() == 8) {
+ m_pPalette.reset(FX_Alloc(uint32_t, 256));
+ if (IsCmykImage()) {
+ for (int i = 0; i < 256; i++)
+ m_pPalette.get()[i] = 0xff - i;
+ } else {
+ for (int i = 0; i < 256; i++)
+ m_pPalette.get()[i] = 0xff000000 | (i * 0x10101);
+ }
+ }
+}
+
+bool CFX_DIBSource::BuildAlphaMask() {
+ if (m_pAlphaMask)
+ return true;
+
+ m_pAlphaMask = pdfium::MakeRetain<CFX_DIBitmap>();
+ if (!m_pAlphaMask->Create(m_Width, m_Height, FXDIB_8bppMask)) {
+ m_pAlphaMask = nullptr;
+ return false;
+ }
+ memset(m_pAlphaMask->GetBuffer(), 0xff,
+ m_pAlphaMask->GetHeight() * m_pAlphaMask->GetPitch());
+ return true;
+}
+
+uint32_t CFX_DIBSource::GetPaletteEntry(int index) const {
+ ASSERT((GetBPP() == 1 || GetBPP() == 8) && !IsAlphaMask());
+ if (m_pPalette) {
+ return m_pPalette.get()[index];
+ }
+ if (IsCmykImage()) {
+ if (GetBPP() == 1) {
+ return index ? 0 : 0xff;
+ }
+ return 0xff - index;
+ }
+ if (GetBPP() == 1) {
+ return index ? 0xffffffff : 0xff000000;
+ }
+ return index * 0x10101 | 0xff000000;
+}
+
+void CFX_DIBSource::SetPaletteEntry(int index, uint32_t color) {
+ ASSERT((GetBPP() == 1 || GetBPP() == 8) && !IsAlphaMask());
+ if (!m_pPalette) {
+ BuildPalette();
+ }
+ m_pPalette.get()[index] = color;
+}
+
+int CFX_DIBSource::FindPalette(uint32_t color) const {
+ ASSERT((GetBPP() == 1 || GetBPP() == 8) && !IsAlphaMask());
+ if (!m_pPalette) {
+ if (IsCmykImage()) {
+ if (GetBPP() == 1)
+ return (static_cast<uint8_t>(color) == 0xff) ? 0 : 1;
+
+ return 0xff - static_cast<uint8_t>(color);
+ }
+ if (GetBPP() == 1) {
+ return (static_cast<uint8_t>(color) == 0xff) ? 1 : 0;
+ }
+ return static_cast<uint8_t>(color);
+ }
+ int palsize = (1 << GetBPP());
+ for (int i = 0; i < palsize; i++)
+ if (m_pPalette.get()[i] == color) {
+ return i;
+ }
+ return -1;
+}
+
+void CFX_DIBSource::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) {
+ if (width == 0 || height == 0) {
+ return;
+ }
+ ASSERT(width > 0 && height > 0);
+ if (dest_left > m_Width || dest_top > m_Height) {
+ width = 0;
+ height = 0;
+ return;
+ }
+ int x_offset = dest_left - src_left;
+ int y_offset = dest_top - src_top;
+ FX_RECT src_rect(src_left, src_top, src_left + width, src_top + height);
+ FX_RECT src_bound(0, 0, src_width, src_height);
+ src_rect.Intersect(src_bound);
+ FX_RECT dest_rect(src_rect.left + x_offset, src_rect.top + y_offset,
+ src_rect.right + x_offset, src_rect.bottom + y_offset);
+ FX_RECT dest_bound(0, 0, m_Width, m_Height);
+ dest_rect.Intersect(dest_bound);
+ if (pClipRgn) {
+ dest_rect.Intersect(pClipRgn->GetBox());
+ }
+ dest_left = dest_rect.left;
+ dest_top = dest_rect.top;
+ src_left = dest_left - x_offset;
+ src_top = dest_top - y_offset;
+ width = dest_rect.right - dest_rect.left;
+ height = dest_rect.bottom - dest_rect.top;
+}
+
+void CFX_DIBSource::SetPalette(const uint32_t* pSrc) {
+ static const uint32_t kPaletteSize = 256;
+ if (!pSrc || GetBPP() > 8) {
+ m_pPalette.reset();
+ return;
+ }
+ uint32_t pal_size = 1 << GetBPP();
+ if (!m_pPalette)
+ m_pPalette.reset(FX_Alloc(uint32_t, pal_size));
+ pal_size = std::min(pal_size, kPaletteSize);
+ memcpy(m_pPalette.get(), pSrc, pal_size * sizeof(uint32_t));
+}
+
+void CFX_DIBSource::GetPalette(uint32_t* pal, int alpha) const {
+ ASSERT(GetBPP() <= 8 && !IsCmykImage());
+ if (GetBPP() == 1) {
+ pal[0] = ((m_pPalette ? m_pPalette.get()[0] : 0xff000000) & 0xffffff) |
+ (alpha << 24);
+ pal[1] = ((m_pPalette ? m_pPalette.get()[1] : 0xffffffff) & 0xffffff) |
+ (alpha << 24);
+ return;
+ }
+ if (m_pPalette) {
+ for (int i = 0; i < 256; i++) {
+ pal[i] = (m_pPalette.get()[i] & 0x00ffffff) | (alpha << 24);
+ }
+ } else {
+ for (int i = 0; i < 256; i++) {
+ pal[i] = (i * 0x10101) | (alpha << 24);
+ }
+ }
+}
+
+CFX_RetainPtr<CFX_DIBitmap> CFX_DIBSource::CloneAlphaMask(
+ const FX_RECT* pClip) const {
+ ASSERT(GetFormat() == FXDIB_Argb);
+ FX_RECT rect(0, 0, m_Width, m_Height);
+ if (pClip) {
+ rect.Intersect(*pClip);
+ if (rect.IsEmpty())
+ return nullptr;
+ }
+ auto pMask = pdfium::MakeRetain<CFX_DIBitmap>();
+ if (!pMask->Create(rect.Width(), rect.Height(), FXDIB_8bppMask))
+ return nullptr;
+
+ for (int row = rect.top; row < rect.bottom; row++) {
+ const uint8_t* src_scan = GetScanline(row) + rect.left * 4 + 3;
+ uint8_t* dest_scan =
+ const_cast<uint8_t*>(pMask->GetScanline(row - rect.top));
+ for (int col = rect.left; col < rect.right; col++) {
+ *dest_scan++ = *src_scan;
+ src_scan += 4;
+ }
+ }
+ return pMask;
+}
+
+bool CFX_DIBSource::SetAlphaMask(const CFX_RetainPtr<CFX_DIBSource>& pAlphaMask,
+ const FX_RECT* pClip) {
+ if (!HasAlpha() || GetFormat() == FXDIB_Argb)
+ return false;
+
+ if (!pAlphaMask) {
+ m_pAlphaMask->Clear(0xff000000);
+ return true;
+ }
+ FX_RECT rect(0, 0, pAlphaMask->m_Width, pAlphaMask->m_Height);
+ if (pClip) {
+ rect.Intersect(*pClip);
+ if (rect.IsEmpty() || rect.Width() != m_Width ||
+ rect.Height() != m_Height) {
+ return false;
+ }
+ } else {
+ if (pAlphaMask->m_Width != m_Width || pAlphaMask->m_Height != m_Height)
+ return false;
+ }
+ for (int row = 0; row < m_Height; row++) {
+ memcpy(const_cast<uint8_t*>(m_pAlphaMask->GetScanline(row)),
+ pAlphaMask->GetScanline(row + rect.top) + rect.left,
+ m_pAlphaMask->m_Pitch);
+ }
+ return true;
+}
+
+CFX_RetainPtr<CFX_DIBitmap> CFX_DIBSource::FlipImage(bool bXFlip,
+ bool bYFlip) const {
+ auto pFlipped = pdfium::MakeRetain<CFX_DIBitmap>();
+ if (!pFlipped->Create(m_Width, m_Height, GetFormat()))
+ return nullptr;
+
+ pFlipped->SetPalette(m_pPalette.get());
+ uint8_t* pDestBuffer = pFlipped->GetBuffer();
+ int Bpp = m_bpp / 8;
+ for (int row = 0; row < m_Height; row++) {
+ const uint8_t* src_scan = GetScanline(row);
+ uint8_t* dest_scan =
+ pDestBuffer + m_Pitch * (bYFlip ? (m_Height - row - 1) : row);
+ if (!bXFlip) {
+ memcpy(dest_scan, src_scan, m_Pitch);
+ continue;
+ }
+ if (m_bpp == 1) {
+ memset(dest_scan, 0, m_Pitch);
+ for (int col = 0; col < m_Width; col++)
+ if (src_scan[col / 8] & (1 << (7 - col % 8))) {
+ int dest_col = m_Width - col - 1;
+ dest_scan[dest_col / 8] |= (1 << (7 - dest_col % 8));
+ }
+ } else {
+ dest_scan += (m_Width - 1) * Bpp;
+ if (Bpp == 1) {
+ for (int col = 0; col < m_Width; col++) {
+ *dest_scan = *src_scan;
+ dest_scan--;
+ src_scan++;
+ }
+ } else if (Bpp == 3) {
+ for (int col = 0; col < m_Width; col++) {
+ dest_scan[0] = src_scan[0];
+ dest_scan[1] = src_scan[1];
+ dest_scan[2] = src_scan[2];
+ dest_scan -= 3;
+ src_scan += 3;
+ }
+ } else {
+ ASSERT(Bpp == 4);
+ for (int col = 0; col < m_Width; col++) {
+ *(uint32_t*)dest_scan = *(uint32_t*)src_scan;
+ dest_scan -= 4;
+ src_scan += 4;
+ }
+ }
+ }
+ }
+ if (m_pAlphaMask) {
+ pDestBuffer = pFlipped->m_pAlphaMask->GetBuffer();
+ uint32_t dest_pitch = pFlipped->m_pAlphaMask->GetPitch();
+ for (int row = 0; row < m_Height; row++) {
+ const uint8_t* src_scan = m_pAlphaMask->GetScanline(row);
+ uint8_t* dest_scan =
+ pDestBuffer + dest_pitch * (bYFlip ? (m_Height - row - 1) : row);
+ if (!bXFlip) {
+ memcpy(dest_scan, src_scan, dest_pitch);
+ continue;
+ }
+ dest_scan += (m_Width - 1);
+ for (int col = 0; col < m_Width; col++) {
+ *dest_scan = *src_scan;
+ dest_scan--;
+ src_scan++;
+ }
+ }
+ }
+ return pFlipped;
+}
+
+CFX_RetainPtr<CFX_DIBitmap> CFX_DIBSource::CloneConvert(
+ FXDIB_Format dest_format) {
+ if (dest_format == GetFormat())
+ return Clone(nullptr);
+
+ auto pClone = pdfium::MakeRetain<CFX_DIBitmap>();
+ if (!pClone->Create(m_Width, m_Height, dest_format))
+ return nullptr;
+
+ CFX_RetainPtr<CFX_DIBitmap> pSrcAlpha;
+ if (HasAlpha()) {
+ if (GetFormat() == FXDIB_Argb)
+ pSrcAlpha = CloneAlphaMask();
+ else
+ pSrcAlpha = m_pAlphaMask;
+
+ if (!pSrcAlpha)
+ return nullptr;
+ }
+ bool ret = true;
+ if (dest_format & 0x0200) {
+ if (dest_format == FXDIB_Argb) {
+ ret = pSrcAlpha ? pClone->LoadChannel(FXDIB_Alpha, pSrcAlpha, FXDIB_Alpha)
+ : pClone->LoadChannel(FXDIB_Alpha, 0xff);
+ } else {
+ ret = pClone->SetAlphaMask(pSrcAlpha);
+ }
+ }
+ if (!ret)
+ return nullptr;
+
+ CFX_RetainPtr<CFX_DIBSource> holder(this);
+ std::unique_ptr<uint32_t, FxFreeDeleter> pal_8bpp;
+ if (!ConvertBuffer(dest_format, pClone->GetBuffer(), pClone->GetPitch(),
+ m_Width, m_Height, holder, 0, 0, &pal_8bpp)) {
+ return nullptr;
+ }
+ if (pal_8bpp)
+ pClone->SetPalette(pal_8bpp.get());
+
+ return pClone;
+}
+
+CFX_RetainPtr<CFX_DIBitmap> CFX_DIBSource::SwapXY(
+ bool bXFlip,
+ bool bYFlip,
+ const FX_RECT* pDestClip) const {
+ FX_RECT dest_clip(0, 0, m_Height, m_Width);
+ if (pDestClip)
+ dest_clip.Intersect(*pDestClip);
+ if (dest_clip.IsEmpty())
+ return nullptr;
+
+ auto pTransBitmap = pdfium::MakeRetain<CFX_DIBitmap>();
+ int result_height = dest_clip.Height();
+ int result_width = dest_clip.Width();
+ if (!pTransBitmap->Create(result_width, result_height, GetFormat()))
+ return nullptr;
+
+ pTransBitmap->SetPalette(m_pPalette.get());
+ int dest_pitch = pTransBitmap->GetPitch();
+ uint8_t* dest_buf = pTransBitmap->GetBuffer();
+ int row_start = bXFlip ? m_Height - dest_clip.right : dest_clip.left;
+ int row_end = bXFlip ? m_Height - dest_clip.left : dest_clip.right;
+ int col_start = bYFlip ? m_Width - dest_clip.bottom : dest_clip.top;
+ int col_end = bYFlip ? m_Width - dest_clip.top : dest_clip.bottom;
+ if (GetBPP() == 1) {
+ memset(dest_buf, 0xff, dest_pitch * result_height);
+ for (int row = row_start; row < row_end; row++) {
+ const uint8_t* src_scan = GetScanline(row);
+ int dest_col = (bXFlip ? dest_clip.right - (row - row_start) - 1 : row) -
+ dest_clip.left;
+ uint8_t* dest_scan = dest_buf;
+ if (bYFlip) {
+ dest_scan += (result_height - 1) * dest_pitch;
+ }
+ int dest_step = bYFlip ? -dest_pitch : dest_pitch;
+ for (int col = col_start; col < col_end; col++) {
+ if (!(src_scan[col / 8] & (1 << (7 - col % 8)))) {
+ dest_scan[dest_col / 8] &= ~(1 << (7 - dest_col % 8));
+ }
+ dest_scan += dest_step;
+ }
+ }
+ } else {
+ int nBytes = GetBPP() / 8;
+ int dest_step = bYFlip ? -dest_pitch : dest_pitch;
+ if (nBytes == 3) {
+ dest_step -= 2;
+ }
+ for (int row = row_start; row < row_end; row++) {
+ int dest_col = (bXFlip ? dest_clip.right - (row - row_start) - 1 : row) -
+ dest_clip.left;
+ uint8_t* dest_scan = dest_buf + dest_col * nBytes;
+ if (bYFlip) {
+ dest_scan += (result_height - 1) * dest_pitch;
+ }
+ if (nBytes == 4) {
+ uint32_t* src_scan = (uint32_t*)GetScanline(row) + col_start;
+ for (int col = col_start; col < col_end; col++) {
+ *(uint32_t*)dest_scan = *src_scan++;
+ dest_scan += dest_step;
+ }
+ } else {
+ const uint8_t* src_scan = GetScanline(row) + col_start * nBytes;
+ if (nBytes == 1) {
+ for (int col = col_start; col < col_end; col++) {
+ *dest_scan = *src_scan++;
+ dest_scan += dest_step;
+ }
+ } else {
+ for (int col = col_start; col < col_end; col++) {
+ *dest_scan++ = *src_scan++;
+ *dest_scan++ = *src_scan++;
+ *dest_scan = *src_scan++;
+ dest_scan += dest_step;
+ }
+ }
+ }
+ }
+ }
+ if (m_pAlphaMask) {
+ dest_pitch = pTransBitmap->m_pAlphaMask->GetPitch();
+ dest_buf = pTransBitmap->m_pAlphaMask->GetBuffer();
+ int dest_step = bYFlip ? -dest_pitch : dest_pitch;
+ for (int row = row_start; row < row_end; row++) {
+ int dest_col = (bXFlip ? dest_clip.right - (row - row_start) - 1 : row) -
+ dest_clip.left;
+ uint8_t* dest_scan = dest_buf + dest_col;
+ if (bYFlip) {
+ dest_scan += (result_height - 1) * dest_pitch;
+ }
+ const uint8_t* src_scan = m_pAlphaMask->GetScanline(row) + col_start;
+ for (int col = col_start; col < col_end; col++) {
+ *dest_scan = *src_scan++;
+ dest_scan += dest_step;
+ }
+ }
+ }
+ return pTransBitmap;
+}
+
+CFX_RetainPtr<CFX_DIBitmap> CFX_DIBSource::TransformTo(
+ const CFX_Matrix* pDestMatrix,
+ int& result_left,
+ int& result_top,
+ uint32_t flags,
+ const FX_RECT* pDestClip) {
+ CFX_RetainPtr<CFX_DIBSource> holder(this);
+ CFX_ImageTransformer transformer(holder, pDestMatrix, flags, pDestClip);
+ transformer.Start();
+ transformer.Continue(nullptr);
+ result_left = transformer.result().left;
+ result_top = transformer.result().top;
+ return transformer.DetachBitmap();
+}
+
+CFX_RetainPtr<CFX_DIBitmap> CFX_DIBSource::StretchTo(int dest_width,
+ int dest_height,
+ uint32_t flags,
+ const FX_RECT* pClip) {
+ CFX_RetainPtr<CFX_DIBSource> holder(this);
+ FX_RECT clip_rect(0, 0, abs(dest_width), abs(dest_height));
+ if (pClip)
+ clip_rect.Intersect(*pClip);
+
+ if (clip_rect.IsEmpty())
+ return nullptr;
+
+ if (dest_width == m_Width && dest_height == m_Height)
+ return Clone(&clip_rect);
+
+ CFX_BitmapStorer storer;
+ CFX_ImageStretcher stretcher(&storer, holder, dest_width, dest_height,
+ clip_rect, flags);
+ if (stretcher.Start())
+ stretcher.Continue(nullptr);
+
+ return storer.Detach();
+}
+
+// static
+bool CFX_DIBSource::ConvertBuffer(
+ FXDIB_Format dest_format,
+ uint8_t* dest_buf,
+ int dest_pitch,
+ int width,
+ int height,
+ const CFX_RetainPtr<CFX_DIBSource>& pSrcBitmap,
+ int src_left,
+ int src_top,
+ std::unique_ptr<uint32_t, FxFreeDeleter>* p_pal) {
+ FXDIB_Format src_format = pSrcBitmap->GetFormat();
+ switch (dest_format) {
+ case FXDIB_Invalid:
+ case FXDIB_1bppCmyk:
+ case FXDIB_1bppMask:
+ case FXDIB_1bppRgb:
+ ASSERT(false);
+ return false;
+ case FXDIB_8bppMask: {
+ if ((src_format & 0xff) == 1) {
+ if (pSrcBitmap->GetPalette()) {
+ return ConvertBuffer_1bppPlt2Gray(dest_buf, dest_pitch, width, height,
+ pSrcBitmap, src_left, src_top);
+ }
+ return ConvertBuffer_1bppMask2Gray(dest_buf, dest_pitch, width, height,
+ pSrcBitmap, src_left, src_top);
+ }
+ if ((src_format & 0xff) == 8) {
+ if (pSrcBitmap->GetPalette()) {
+ return ConvertBuffer_8bppPlt2Gray(dest_buf, dest_pitch, width, height,
+ pSrcBitmap, src_left, src_top);
+ }
+ return ConvertBuffer_8bppMask2Gray(dest_buf, dest_pitch, width, height,
+ pSrcBitmap, src_left, src_top);
+ }
+ if ((src_format & 0xff) >= 24) {
+ return ConvertBuffer_RgbOrCmyk2Gray(dest_buf, dest_pitch, width, height,
+ pSrcBitmap, src_left, src_top);
+ }
+ return false;
+ }
+ case FXDIB_8bppRgb:
+ case FXDIB_8bppRgba: {
+ if ((src_format & 0xff) == 8 && !pSrcBitmap->GetPalette()) {
+ return ConvertBuffer(FXDIB_8bppMask, dest_buf, dest_pitch, width,
+ height, pSrcBitmap, src_left, src_top, p_pal);
+ }
+ p_pal->reset(FX_Alloc(uint32_t, 256));
+ if (((src_format & 0xff) == 1 || (src_format & 0xff) == 8) &&
+ pSrcBitmap->GetPalette()) {
+ return ConvertBuffer_Plt2PltRgb8(dest_buf, dest_pitch, width, height,
+ pSrcBitmap, src_left, src_top,
+ p_pal->get());
+ }
+ if ((src_format & 0xff) >= 24) {
+ return ConvertBuffer_Rgb2PltRgb8(dest_buf, dest_pitch, width, height,
+ pSrcBitmap, src_left, src_top,
+ p_pal->get());
+ }
+ return false;
+ }
+ case FXDIB_Rgb:
+ case FXDIB_Rgba: {
+ if ((src_format & 0xff) == 1) {
+ if (pSrcBitmap->GetPalette()) {
+ return ConvertBuffer_1bppPlt2Rgb(dest_format, dest_buf, dest_pitch,
+ width, height, pSrcBitmap, src_left,
+ src_top);
+ }
+ return ConvertBuffer_1bppMask2Rgb(dest_format, dest_buf, dest_pitch,
+ width, height, pSrcBitmap, src_left,
+ src_top);
+ }
+ if ((src_format & 0xff) == 8) {
+ if (pSrcBitmap->GetPalette()) {
+ return ConvertBuffer_8bppPlt2Rgb(dest_format, dest_buf, dest_pitch,
+ width, height, pSrcBitmap, src_left,
+ src_top);
+ }
+ return ConvertBuffer_8bppMask2Rgb(dest_format, dest_buf, dest_pitch,
+ width, height, pSrcBitmap, src_left,
+ src_top);
+ }
+ if ((src_format & 0xff) == 24) {
+ return ConvertBuffer_24bppRgb2Rgb24(dest_buf, dest_pitch, width, height,
+ pSrcBitmap, src_left, src_top);
+ }
+ if ((src_format & 0xff) == 32) {
+ return ConvertBuffer_32bppRgb2Rgb24(dest_buf, dest_pitch, width, height,
+ pSrcBitmap, src_left, src_top);
+ }
+ return false;
+ }
+ case FXDIB_Argb:
+ case FXDIB_Rgb32: {
+ if ((src_format & 0xff) == 1) {
+ if (pSrcBitmap->GetPalette()) {
+ return ConvertBuffer_1bppPlt2Rgb(dest_format, dest_buf, dest_pitch,
+ width, height, pSrcBitmap, src_left,
+ src_top);
+ }
+ return ConvertBuffer_1bppMask2Rgb(dest_format, dest_buf, dest_pitch,
+ width, height, pSrcBitmap, src_left,
+ src_top);
+ }
+ if ((src_format & 0xff) == 8) {
+ if (pSrcBitmap->GetPalette()) {
+ return ConvertBuffer_8bppPlt2Rgb(dest_format, dest_buf, dest_pitch,
+ width, height, pSrcBitmap, src_left,
+ src_top);
+ }
+ return ConvertBuffer_8bppMask2Rgb(dest_format, dest_buf, dest_pitch,
+ width, height, pSrcBitmap, src_left,
+ src_top);
+ }
+ if ((src_format & 0xff) >= 24) {
+ if (src_format & 0x0400) {
+ return ConvertBuffer_32bppCmyk2Rgb32(dest_buf, dest_pitch, width,
+ height, pSrcBitmap, src_left,
+ src_top);
+ }
+ return ConvertBuffer_Rgb2Rgb32(dest_buf, dest_pitch, width, height,
+ pSrcBitmap, src_left, src_top);
+ }
+ return false;
+ }
+ default:
+ return false;
+ }
+}
diff --git a/chromium/third_party/pdfium/core/fxge/dib/cfx_dibsource.h b/chromium/third_party/pdfium/core/fxge/dib/cfx_dibsource.h
new file mode 100644
index 00000000000..97af196677c
--- /dev/null
+++ b/chromium/third_party/pdfium/core/fxge/dib/cfx_dibsource.h
@@ -0,0 +1,145 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef CORE_FXGE_DIB_CFX_DIBSOURCE_H_
+#define CORE_FXGE_DIB_CFX_DIBSOURCE_H_
+
+#include <memory>
+
+#include "core/fxcrt/cfx_retain_ptr.h"
+#include "core/fxcrt/fx_basic.h"
+#include "core/fxcrt/fx_coordinates.h"
+#include "core/fxge/fx_dib.h"
+
+enum FXDIB_Channel {
+ FXDIB_Red = 1,
+ FXDIB_Green,
+ FXDIB_Blue,
+ FXDIB_Cyan,
+ FXDIB_Magenta,
+ FXDIB_Yellow,
+ FXDIB_Black,
+ FXDIB_Alpha
+};
+
+class CFX_ClipRgn;
+class CFX_DIBitmap;
+
+class CFX_DIBSource : public CFX_Retainable {
+ public:
+ ~CFX_DIBSource() override;
+
+ virtual uint8_t* GetBuffer() const;
+ virtual const uint8_t* GetScanline(int line) const = 0;
+ virtual bool SkipToScanline(int line, IFX_Pause* pPause) const;
+ virtual void DownSampleScanline(int line,
+ uint8_t* dest_scan,
+ int dest_bpp,
+ int dest_width,
+ bool bFlipX,
+ int clip_left,
+ int clip_width) const = 0;
+
+ 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.get(); }
+ 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);
+ }
+
+ // Copies into internally-owned palette.
+ void SetPalette(const uint32_t* pSrcPal);
+
+ CFX_RetainPtr<CFX_DIBitmap> Clone(const FX_RECT* pClip = nullptr) const;
+ CFX_RetainPtr<CFX_DIBitmap> CloneConvert(FXDIB_Format format);
+ CFX_RetainPtr<CFX_DIBitmap> StretchTo(int dest_width,
+ int dest_height,
+ uint32_t flags = 0,
+ const FX_RECT* pClip = nullptr);
+ CFX_RetainPtr<CFX_DIBitmap> TransformTo(const CFX_Matrix* pMatrix,
+ int& left,
+ int& top,
+ uint32_t flags = 0,
+ const FX_RECT* pClip = nullptr);
+ CFX_RetainPtr<CFX_DIBitmap> SwapXY(bool bXFlip,
+ bool bYFlip,
+ const FX_RECT* pClip = nullptr) const;
+ CFX_RetainPtr<CFX_DIBitmap> FlipImage(bool bXFlip, bool bYFlip) const;
+
+ CFX_RetainPtr<CFX_DIBitmap> CloneAlphaMask(
+ const FX_RECT* pClip = nullptr) const;
+
+ // Copies into internally-owned mask.
+ bool SetAlphaMask(const CFX_RetainPtr<CFX_DIBSource>& pAlphaMask,
+ const FX_RECT* pClip = nullptr);
+
+ 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);
+
+#if defined _SKIA_SUPPORT_ || defined _SKIA_SUPPORT_PATHS_
+ void DebugVerifyBitmapIsPreMultiplied(void* buffer = nullptr) const;
+#endif
+
+ CFX_RetainPtr<CFX_DIBitmap> m_pAlphaMask;
+
+ protected:
+ CFX_DIBSource();
+
+ static bool ConvertBuffer(FXDIB_Format dest_format,
+ uint8_t* dest_buf,
+ int dest_pitch,
+ int width,
+ int height,
+ const CFX_RetainPtr<CFX_DIBSource>& pSrcBitmap,
+ int src_left,
+ int src_top,
+ std::unique_ptr<uint32_t, FxFreeDeleter>* pal);
+
+ void BuildPalette();
+ bool BuildAlphaMask();
+ int FindPalette(uint32_t color) const;
+ void GetPalette(uint32_t* pal, int alpha) const;
+
+ int m_Width;
+ int m_Height;
+ int m_bpp;
+ uint32_t m_AlphaFlag;
+ uint32_t m_Pitch;
+ // TODO(weili): Use std::vector for this.
+ std::unique_ptr<uint32_t, FxFreeDeleter> m_pPalette;
+};
+
+#endif // CORE_FXGE_DIB_CFX_DIBSOURCE_H_
diff --git a/chromium/third_party/pdfium/core/fxge/dib/cfx_filtereddib.cpp b/chromium/third_party/pdfium/core/fxge/dib/cfx_filtereddib.cpp
new file mode 100644
index 00000000000..2d6edd0d60e
--- /dev/null
+++ b/chromium/third_party/pdfium/core/fxge/dib/cfx_filtereddib.cpp
@@ -0,0 +1,42 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "core/fxge/dib/cfx_filtereddib.h"
+
+#include "core/fxge/fx_dib.h"
+
+CFX_FilteredDIB::CFX_FilteredDIB() {}
+
+CFX_FilteredDIB::~CFX_FilteredDIB() {}
+
+void CFX_FilteredDIB::LoadSrc(const CFX_RetainPtr<CFX_DIBSource>& pSrc) {
+ m_pSrc = pSrc;
+ m_Width = pSrc->GetWidth();
+ m_Height = pSrc->GetHeight();
+ FXDIB_Format format = GetDestFormat();
+ m_bpp = static_cast<uint8_t>(format);
+ m_AlphaFlag = static_cast<uint8_t>(format >> 8);
+ m_Pitch = (m_Width * (format & 0xff) + 31) / 32 * 4;
+ m_pPalette.reset(GetDestPalette());
+ m_Scanline.resize(m_Pitch);
+}
+
+const uint8_t* CFX_FilteredDIB::GetScanline(int line) const {
+ TranslateScanline(m_pSrc->GetScanline(line), &m_Scanline);
+ return m_Scanline.data();
+}
+
+void CFX_FilteredDIB::DownSampleScanline(int line,
+ uint8_t* dest_scan,
+ int dest_bpp,
+ int dest_width,
+ bool bFlipX,
+ int clip_left,
+ int clip_width) const {
+ m_pSrc->DownSampleScanline(line, dest_scan, dest_bpp, dest_width, bFlipX,
+ clip_left, clip_width);
+ TranslateDownSamples(dest_scan, dest_scan, clip_width, dest_bpp);
+}
diff --git a/chromium/third_party/pdfium/core/fxge/dib/cfx_filtereddib.h b/chromium/third_party/pdfium/core/fxge/dib/cfx_filtereddib.h
new file mode 100644
index 00000000000..3a16bb07504
--- /dev/null
+++ b/chromium/third_party/pdfium/core/fxge/dib/cfx_filtereddib.h
@@ -0,0 +1,50 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef CORE_FXGE_DIB_CFX_FILTEREDDIB_H_
+#define CORE_FXGE_DIB_CFX_FILTEREDDIB_H_
+
+#include <vector>
+
+#include "core/fxcrt/cfx_retain_ptr.h"
+#include "core/fxge/dib/cfx_dibsource.h"
+
+class CFX_FilteredDIB : public CFX_DIBSource {
+ public:
+ template <typename T, typename... Args>
+ friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args);
+
+ ~CFX_FilteredDIB() override;
+
+ virtual FXDIB_Format GetDestFormat() = 0;
+ virtual uint32_t* GetDestPalette() = 0;
+ virtual void TranslateScanline(const uint8_t* src_buf,
+ std::vector<uint8_t>* dest_buf) const = 0;
+ virtual void TranslateDownSamples(uint8_t* dest_buf,
+ const uint8_t* src_buf,
+ int pixels,
+ int Bpp) const = 0;
+
+ void LoadSrc(const CFX_RetainPtr<CFX_DIBSource>& pSrc);
+
+ protected:
+ CFX_FilteredDIB();
+
+ // CFX_DIBSource
+ const uint8_t* GetScanline(int line) const override;
+ void DownSampleScanline(int line,
+ uint8_t* dest_scan,
+ int dest_bpp,
+ int dest_width,
+ bool bFlipX,
+ int clip_left,
+ int clip_width) const override;
+
+ CFX_RetainPtr<CFX_DIBSource> m_pSrc;
+ mutable std::vector<uint8_t> m_Scanline;
+};
+
+#endif // CORE_FXGE_DIB_CFX_FILTEREDDIB_H_
diff --git a/chromium/third_party/pdfium/core/fxge/dib/cfx_imagerenderer.cpp b/chromium/third_party/pdfium/core/fxge/dib/cfx_imagerenderer.cpp
new file mode 100644
index 00000000000..aa818555b69
--- /dev/null
+++ b/chromium/third_party/pdfium/core/fxge/dib/cfx_imagerenderer.cpp
@@ -0,0 +1,137 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "core/fxge/dib/cfx_imagerenderer.h"
+
+#include <memory>
+
+#include "core/fxge/dib/cfx_imagestretcher.h"
+#include "core/fxge/dib/cfx_imagetransformer.h"
+#include "core/fxge/ge/cfx_cliprgn.h"
+#include "third_party/base/ptr_util.h"
+
+CFX_ImageRenderer::CFX_ImageRenderer()
+ : m_Status(0),
+ m_bRgbByteOrder(false),
+ m_BlendType(FXDIB_BLEND_NORMAL) {}
+
+CFX_ImageRenderer::~CFX_ImageRenderer() {}
+
+bool CFX_ImageRenderer::Start(const CFX_RetainPtr<CFX_DIBitmap>& pDevice,
+ const CFX_ClipRgn* pClipRgn,
+ const CFX_RetainPtr<CFX_DIBSource>& pSource,
+ int bitmap_alpha,
+ uint32_t mask_color,
+ const CFX_Matrix* pMatrix,
+ uint32_t dib_flags,
+ bool bRgbByteOrder) {
+ m_Matrix = *pMatrix;
+ CFX_FloatRect image_rect_f = m_Matrix.GetUnitRect();
+ FX_RECT image_rect = image_rect_f.GetOuterRect();
+ m_ClipBox = pClipRgn ? pClipRgn->GetBox() : FX_RECT(0, 0, pDevice->GetWidth(),
+ pDevice->GetHeight());
+ m_ClipBox.Intersect(image_rect);
+ if (m_ClipBox.IsEmpty())
+ return false;
+
+ m_pDevice = pDevice;
+ m_pClipRgn = pClipRgn;
+ m_MaskColor = mask_color;
+ m_BitmapAlpha = bitmap_alpha;
+ m_Matrix = *pMatrix;
+ m_Flags = dib_flags;
+ m_AlphaFlag = 0;
+ m_bRgbByteOrder = bRgbByteOrder;
+ m_BlendType = FXDIB_BLEND_NORMAL;
+
+ if ((fabs(m_Matrix.b) >= 0.5f || m_Matrix.a == 0) ||
+ (fabs(m_Matrix.c) >= 0.5f || m_Matrix.d == 0)) {
+ if (fabs(m_Matrix.a) < fabs(m_Matrix.b) / 20 &&
+ fabs(m_Matrix.d) < fabs(m_Matrix.c) / 20 && fabs(m_Matrix.a) < 0.5f &&
+ fabs(m_Matrix.d) < 0.5f) {
+ int dest_width = image_rect.Width();
+ int dest_height = image_rect.Height();
+ FX_RECT bitmap_clip = m_ClipBox;
+ bitmap_clip.Offset(-image_rect.left, -image_rect.top);
+ bitmap_clip = FXDIB_SwapClipBox(bitmap_clip, dest_width, dest_height,
+ m_Matrix.c > 0, m_Matrix.b < 0);
+ m_Composer.Compose(pDevice, pClipRgn, bitmap_alpha, mask_color, m_ClipBox,
+ true, m_Matrix.c > 0, m_Matrix.b < 0, m_bRgbByteOrder,
+ 0, m_BlendType);
+ m_Stretcher = pdfium::MakeUnique<CFX_ImageStretcher>(
+ &m_Composer, pSource, dest_height, dest_width, bitmap_clip,
+ dib_flags);
+ if (!m_Stretcher->Start())
+ return false;
+
+ m_Status = 1;
+ return true;
+ }
+ m_Status = 2;
+ m_pTransformer = pdfium::MakeUnique<CFX_ImageTransformer>(
+ pSource, &m_Matrix, dib_flags, &m_ClipBox);
+ m_pTransformer->Start();
+ return true;
+ }
+
+ int dest_width = image_rect.Width();
+ if (m_Matrix.a < 0)
+ dest_width = -dest_width;
+
+ int dest_height = image_rect.Height();
+ if (m_Matrix.d > 0)
+ dest_height = -dest_height;
+
+ if (dest_width == 0 || dest_height == 0)
+ return false;
+
+ FX_RECT bitmap_clip = m_ClipBox;
+ bitmap_clip.Offset(-image_rect.left, -image_rect.top);
+ m_Composer.Compose(pDevice, pClipRgn, bitmap_alpha, mask_color, m_ClipBox,
+ false, false, false, m_bRgbByteOrder, 0, m_BlendType);
+ m_Status = 1;
+ m_Stretcher = pdfium::MakeUnique<CFX_ImageStretcher>(
+ &m_Composer, pSource, dest_width, dest_height, bitmap_clip, dib_flags);
+ return m_Stretcher->Start();
+}
+
+bool CFX_ImageRenderer::Continue(IFX_Pause* pPause) {
+ if (m_Status == 1)
+ return m_Stretcher->Continue(pPause);
+
+ if (m_Status != 2)
+ return false;
+
+ if (m_pTransformer->Continue(pPause))
+ return true;
+
+ CFX_RetainPtr<CFX_DIBitmap> pBitmap = m_pTransformer->DetachBitmap();
+ if (!pBitmap || !pBitmap->GetBuffer())
+ return false;
+
+ if (pBitmap->IsAlphaMask()) {
+ if (m_BitmapAlpha != 255) {
+ if (m_AlphaFlag >> 8) {
+ m_AlphaFlag = (((uint8_t)((m_AlphaFlag & 0xff) * m_BitmapAlpha / 255)) |
+ ((m_AlphaFlag >> 8) << 8));
+ } else {
+ m_MaskColor = FXARGB_MUL_ALPHA(m_MaskColor, m_BitmapAlpha);
+ }
+ }
+ m_pDevice->CompositeMask(
+ m_pTransformer->result().left, m_pTransformer->result().top,
+ pBitmap->GetWidth(), pBitmap->GetHeight(), pBitmap, m_MaskColor, 0, 0,
+ m_BlendType, m_pClipRgn, m_bRgbByteOrder, m_AlphaFlag);
+ } else {
+ if (m_BitmapAlpha != 255)
+ pBitmap->MultiplyAlpha(m_BitmapAlpha);
+ m_pDevice->CompositeBitmap(
+ m_pTransformer->result().left, m_pTransformer->result().top,
+ pBitmap->GetWidth(), pBitmap->GetHeight(), pBitmap, 0, 0, m_BlendType,
+ m_pClipRgn, m_bRgbByteOrder);
+ }
+ return false;
+}
diff --git a/chromium/third_party/pdfium/core/fxge/dib/cfx_imagerenderer.h b/chromium/third_party/pdfium/core/fxge/dib/cfx_imagerenderer.h
new file mode 100644
index 00000000000..f3d1286dc62
--- /dev/null
+++ b/chromium/third_party/pdfium/core/fxge/dib/cfx_imagerenderer.h
@@ -0,0 +1,56 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef CORE_FXGE_DIB_CFX_IMAGERENDERER_H_
+#define CORE_FXGE_DIB_CFX_IMAGERENDERER_H_
+
+#include <memory>
+
+#include "core/fxcrt/cfx_retain_ptr.h"
+#include "core/fxcrt/fx_coordinates.h"
+#include "core/fxge/dib/cfx_bitmapcomposer.h"
+#include "core/fxge/dib/cfx_dibitmap.h"
+#include "core/fxge/dib/cfx_dibsource.h"
+#include "core/fxge/fx_dib.h"
+#include "third_party/base/stl_util.h"
+
+class CFX_ImageTransformer;
+class CFX_ImageStretcher;
+
+class CFX_ImageRenderer {
+ public:
+ CFX_ImageRenderer();
+ ~CFX_ImageRenderer();
+
+ bool Start(const CFX_RetainPtr<CFX_DIBitmap>& pDevice,
+ const CFX_ClipRgn* pClipRgn,
+ const CFX_RetainPtr<CFX_DIBSource>& pSource,
+ int bitmap_alpha,
+ uint32_t mask_color,
+ const CFX_Matrix* pMatrix,
+ uint32_t dib_flags,
+ bool bRgbByteOrder);
+
+ bool Continue(IFX_Pause* pPause);
+
+ private:
+ CFX_RetainPtr<CFX_DIBitmap> m_pDevice;
+ const CFX_ClipRgn* m_pClipRgn;
+ int m_BitmapAlpha;
+ uint32_t m_MaskColor;
+ CFX_Matrix m_Matrix;
+ std::unique_ptr<CFX_ImageTransformer> m_pTransformer;
+ std::unique_ptr<CFX_ImageStretcher> m_Stretcher;
+ CFX_BitmapComposer m_Composer;
+ int m_Status;
+ FX_RECT m_ClipBox;
+ uint32_t m_Flags;
+ int m_AlphaFlag;
+ bool m_bRgbByteOrder;
+ int m_BlendType;
+};
+
+#endif // CORE_FXGE_DIB_CFX_IMAGERENDERER_H_
diff --git a/chromium/third_party/pdfium/core/fxge/dib/cfx_imagestretcher.cpp b/chromium/third_party/pdfium/core/fxge/dib/cfx_imagestretcher.cpp
new file mode 100644
index 00000000000..f52a62d5296
--- /dev/null
+++ b/chromium/third_party/pdfium/core/fxge/dib/cfx_imagestretcher.cpp
@@ -0,0 +1,193 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "core/fxge/dib/cfx_imagestretcher.h"
+
+#include <climits>
+
+#include "core/fxge/dib/cfx_dibitmap.h"
+#include "core/fxge/dib/cfx_dibsource.h"
+#include "core/fxge/dib/cstretchengine.h"
+#include "core/fxge/fx_dib.h"
+#include "third_party/base/ptr_util.h"
+
+namespace {
+
+bool SourceSizeWithinLimit(int width, int height) {
+ const int kMaxProgressiveStretchPixels = 1000000;
+ return !height || width < kMaxProgressiveStretchPixels / height;
+}
+
+FXDIB_Format GetStretchedFormat(const CFX_DIBSource& src) {
+ FXDIB_Format format = src.GetFormat();
+ if (format == FXDIB_1bppMask)
+ return FXDIB_8bppMask;
+ if (format == FXDIB_1bppRgb)
+ return FXDIB_8bppRgb;
+ if (format == FXDIB_8bppRgb && src.GetPalette())
+ return FXDIB_Rgb;
+ return format;
+}
+
+void CmykDecode(uint32_t cmyk, int& c, int& m, int& y, int& k) {
+ c = FXSYS_GetCValue(cmyk);
+ m = FXSYS_GetMValue(cmyk);
+ y = FXSYS_GetYValue(cmyk);
+ k = FXSYS_GetKValue(cmyk);
+}
+
+} // namespace
+
+CFX_ImageStretcher::CFX_ImageStretcher(
+ IFX_ScanlineComposer* pDest,
+ const CFX_RetainPtr<CFX_DIBSource>& pSource,
+ int dest_width,
+ int dest_height,
+ const FX_RECT& bitmap_rect,
+ uint32_t flags)
+ : m_pDest(pDest),
+ m_pSource(pSource),
+ m_Flags(flags),
+ m_bFlipX(false),
+ m_bFlipY(false),
+ m_DestWidth(dest_width),
+ m_DestHeight(dest_height),
+ m_ClipRect(bitmap_rect),
+ m_DestFormat(GetStretchedFormat(*pSource)),
+ m_DestBPP(m_DestFormat & 0xff),
+ m_LineIndex(0) {}
+
+CFX_ImageStretcher::~CFX_ImageStretcher() {}
+
+bool CFX_ImageStretcher::Start() {
+ if (m_DestWidth == 0 || m_DestHeight == 0)
+ return false;
+
+ if (m_pSource->GetFormat() == FXDIB_1bppRgb && m_pSource->GetPalette()) {
+ FX_ARGB pal[256];
+ int a0, r0, g0, b0, a1, r1, g1, b1;
+ ArgbDecode(m_pSource->GetPaletteEntry(0), a0, r0, g0, b0);
+ ArgbDecode(m_pSource->GetPaletteEntry(1), a1, r1, g1, b1);
+ for (int i = 0; i < 256; i++) {
+ int a = a0 + (a1 - a0) * i / 255;
+ int r = r0 + (r1 - r0) * i / 255;
+ int g = g0 + (g1 - g0) * i / 255;
+ int b = b0 + (b1 - b0) * i / 255;
+ pal[i] = ArgbEncode(a, r, g, b);
+ }
+ if (!m_pDest->SetInfo(m_ClipRect.Width(), m_ClipRect.Height(), m_DestFormat,
+ pal)) {
+ return false;
+ }
+ } else if (m_pSource->GetFormat() == FXDIB_1bppCmyk &&
+ m_pSource->GetPalette()) {
+ FX_CMYK pal[256];
+ int c0, m0, y0, k0, c1, m1, y1, k1;
+ CmykDecode(m_pSource->GetPaletteEntry(0), c0, m0, y0, k0);
+ CmykDecode(m_pSource->GetPaletteEntry(1), c1, m1, y1, k1);
+ for (int i = 0; i < 256; i++) {
+ int c = c0 + (c1 - c0) * i / 255;
+ int m = m0 + (m1 - m0) * i / 255;
+ int y = y0 + (y1 - y0) * i / 255;
+ int k = k0 + (k1 - k0) * i / 255;
+ pal[i] = CmykEncode(c, m, y, k);
+ }
+ if (!m_pDest->SetInfo(m_ClipRect.Width(), m_ClipRect.Height(), m_DestFormat,
+ pal)) {
+ return false;
+ }
+ } else if (!m_pDest->SetInfo(m_ClipRect.Width(), m_ClipRect.Height(),
+ m_DestFormat, nullptr)) {
+ return false;
+ }
+
+ if (m_Flags & FXDIB_DOWNSAMPLE)
+ return StartQuickStretch();
+ return StartStretch();
+}
+
+bool CFX_ImageStretcher::Continue(IFX_Pause* pPause) {
+ if (m_Flags & FXDIB_DOWNSAMPLE)
+ return ContinueQuickStretch(pPause);
+ return ContinueStretch(pPause);
+}
+
+bool CFX_ImageStretcher::StartStretch() {
+ m_pStretchEngine = pdfium::MakeUnique<CStretchEngine>(
+ m_pDest, m_DestFormat, m_DestWidth, m_DestHeight, m_ClipRect, m_pSource,
+ m_Flags);
+ m_pStretchEngine->StartStretchHorz();
+ if (SourceSizeWithinLimit(m_pSource->GetWidth(), m_pSource->GetHeight())) {
+ m_pStretchEngine->Continue(nullptr);
+ return false;
+ }
+ return true;
+}
+
+bool CFX_ImageStretcher::ContinueStretch(IFX_Pause* pPause) {
+ return m_pStretchEngine && m_pStretchEngine->Continue(pPause);
+}
+
+bool CFX_ImageStretcher::StartQuickStretch() {
+ if (m_DestWidth < 0) {
+ m_bFlipX = true;
+ m_DestWidth = -m_DestWidth;
+ }
+ if (m_DestHeight < 0) {
+ m_bFlipY = true;
+ m_DestHeight = -m_DestHeight;
+ }
+ uint32_t size = m_ClipRect.Width();
+ if (size && m_DestBPP > static_cast<int>(INT_MAX / size))
+ return false;
+
+ size *= m_DestBPP;
+ m_pScanline.reset(FX_Alloc(uint8_t, (size / 8 + 3) / 4 * 4));
+ if (m_pSource->m_pAlphaMask)
+ m_pMaskScanline.reset(FX_Alloc(uint8_t, (m_ClipRect.Width() + 3) / 4 * 4));
+
+ if (SourceSizeWithinLimit(m_pSource->GetWidth(), m_pSource->GetHeight())) {
+ ContinueQuickStretch(nullptr);
+ return false;
+ }
+ return true;
+}
+
+bool CFX_ImageStretcher::ContinueQuickStretch(IFX_Pause* pPause) {
+ if (!m_pScanline)
+ return false;
+
+ int result_width = m_ClipRect.Width();
+ int result_height = m_ClipRect.Height();
+ int src_height = m_pSource->GetHeight();
+ for (; m_LineIndex < result_height; m_LineIndex++) {
+ int dest_y;
+ int src_y;
+ if (m_bFlipY) {
+ dest_y = result_height - m_LineIndex - 1;
+ src_y = (m_DestHeight - (dest_y + m_ClipRect.top) - 1) * src_height /
+ m_DestHeight;
+ } else {
+ dest_y = m_LineIndex;
+ src_y = (dest_y + m_ClipRect.top) * src_height / m_DestHeight;
+ }
+ src_y = pdfium::clamp(src_y, 0, src_height - 1);
+
+ if (m_pSource->SkipToScanline(src_y, pPause))
+ return true;
+
+ m_pSource->DownSampleScanline(src_y, m_pScanline.get(), m_DestBPP,
+ m_DestWidth, m_bFlipX, m_ClipRect.left,
+ result_width);
+ if (m_pMaskScanline) {
+ m_pSource->m_pAlphaMask->DownSampleScanline(
+ src_y, m_pMaskScanline.get(), 1, m_DestWidth, m_bFlipX,
+ m_ClipRect.left, result_width);
+ }
+ m_pDest->ComposeScanline(dest_y, m_pScanline.get(), m_pMaskScanline.get());
+ }
+ return false;
+}
diff --git a/chromium/third_party/pdfium/core/fxge/dib/cfx_imagestretcher.h b/chromium/third_party/pdfium/core/fxge/dib/cfx_imagestretcher.h
new file mode 100644
index 00000000000..63863cd1a9b
--- /dev/null
+++ b/chromium/third_party/pdfium/core/fxge/dib/cfx_imagestretcher.h
@@ -0,0 +1,56 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef CORE_FXGE_DIB_CFX_IMAGESTRETCHER_H_
+#define CORE_FXGE_DIB_CFX_IMAGESTRETCHER_H_
+
+#include <memory>
+
+#include "core/fxcrt/cfx_retain_ptr.h"
+#include "core/fxcrt/fx_coordinates.h"
+#include "core/fxge/dib/ifx_scanlinecomposer.h"
+#include "core/fxge/fx_dib.h"
+
+class CFX_DIBSource;
+
+class CFX_ImageStretcher {
+ public:
+ CFX_ImageStretcher(IFX_ScanlineComposer* pDest,
+ const CFX_RetainPtr<CFX_DIBSource>& pSource,
+ int dest_width,
+ int dest_height,
+ const FX_RECT& bitmap_rect,
+ uint32_t flags);
+ ~CFX_ImageStretcher();
+
+ bool Start();
+ bool Continue(IFX_Pause* pPause);
+
+ CFX_RetainPtr<CFX_DIBSource> source() { return m_pSource; }
+
+ private:
+ bool StartQuickStretch();
+ bool StartStretch();
+ bool ContinueQuickStretch(IFX_Pause* pPause);
+ bool ContinueStretch(IFX_Pause* pPause);
+
+ IFX_ScanlineComposer* const m_pDest;
+ CFX_RetainPtr<CFX_DIBSource> m_pSource;
+ std::unique_ptr<CStretchEngine> m_pStretchEngine;
+ std::unique_ptr<uint8_t, FxFreeDeleter> m_pScanline;
+ std::unique_ptr<uint8_t, FxFreeDeleter> m_pMaskScanline;
+ const uint32_t m_Flags;
+ bool m_bFlipX;
+ bool m_bFlipY;
+ int m_DestWidth;
+ int m_DestHeight;
+ FX_RECT m_ClipRect;
+ const FXDIB_Format m_DestFormat;
+ const int m_DestBPP;
+ int m_LineIndex;
+};
+
+#endif // CORE_FXGE_DIB_CFX_IMAGESTRETCHER_H_
diff --git a/chromium/third_party/pdfium/core/fxge/dib/cfx_imagetransformer.cpp b/chromium/third_party/pdfium/core/fxge/dib/cfx_imagetransformer.cpp
new file mode 100644
index 00000000000..c5fb467ad83
--- /dev/null
+++ b/chromium/third_party/pdfium/core/fxge/dib/cfx_imagetransformer.cpp
@@ -0,0 +1,792 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "core/fxge/dib/cfx_imagetransformer.h"
+
+#include <memory>
+#include <utility>
+
+#include "core/fxge/dib/cfx_imagestretcher.h"
+#include "core/fxge/fx_dib.h"
+#include "third_party/base/ptr_util.h"
+
+namespace {
+
+uint8_t bilinear_interpol(const uint8_t* buf,
+ int row_offset_l,
+ int row_offset_r,
+ int src_col_l,
+ int src_col_r,
+ int res_x,
+ int res_y,
+ int bpp,
+ int c_offset) {
+ int i_resx = 255 - res_x;
+ int col_bpp_l = src_col_l * bpp;
+ int col_bpp_r = src_col_r * bpp;
+ const uint8_t* buf_u = buf + row_offset_l + c_offset;
+ const uint8_t* buf_d = buf + row_offset_r + c_offset;
+ const uint8_t* src_pos0 = buf_u + col_bpp_l;
+ const uint8_t* src_pos1 = buf_u + col_bpp_r;
+ const uint8_t* src_pos2 = buf_d + col_bpp_l;
+ const uint8_t* src_pos3 = buf_d + col_bpp_r;
+ uint8_t r_pos_0 = (*src_pos0 * i_resx + *src_pos1 * res_x) >> 8;
+ uint8_t r_pos_1 = (*src_pos2 * i_resx + *src_pos3 * res_x) >> 8;
+ return (r_pos_0 * (255 - res_y) + r_pos_1 * res_y) >> 8;
+}
+
+uint8_t bicubic_interpol(const uint8_t* buf,
+ int pitch,
+ int pos_pixel[],
+ int u_w[],
+ int v_w[],
+ int res_x,
+ int res_y,
+ int bpp,
+ int c_offset) {
+ int s_result = 0;
+ for (int i = 0; i < 4; i++) {
+ int a_result = 0;
+ for (int j = 0; j < 4; j++) {
+ a_result += u_w[j] * (*(uint8_t*)(buf + pos_pixel[i + 4] * pitch +
+ pos_pixel[j] * bpp + c_offset));
+ }
+ s_result += a_result * v_w[i];
+ }
+ s_result >>= 16;
+ return (uint8_t)(s_result < 0 ? 0 : s_result > 255 ? 255 : s_result);
+}
+
+void bicubic_get_pos_weight(int pos_pixel[],
+ int u_w[],
+ int v_w[],
+ int src_col_l,
+ int src_row_l,
+ int res_x,
+ int res_y,
+ int stretch_width,
+ int stretch_height) {
+ pos_pixel[0] = src_col_l - 1;
+ pos_pixel[1] = src_col_l;
+ pos_pixel[2] = src_col_l + 1;
+ pos_pixel[3] = src_col_l + 2;
+ pos_pixel[4] = src_row_l - 1;
+ pos_pixel[5] = src_row_l;
+ pos_pixel[6] = src_row_l + 1;
+ pos_pixel[7] = src_row_l + 2;
+ for (int i = 0; i < 4; i++) {
+ if (pos_pixel[i] < 0) {
+ pos_pixel[i] = 0;
+ }
+ if (pos_pixel[i] >= stretch_width) {
+ pos_pixel[i] = stretch_width - 1;
+ }
+ if (pos_pixel[i + 4] < 0) {
+ pos_pixel[i + 4] = 0;
+ }
+ if (pos_pixel[i + 4] >= stretch_height) {
+ pos_pixel[i + 4] = stretch_height - 1;
+ }
+ }
+ u_w[0] = SDP_Table[256 + res_x];
+ u_w[1] = SDP_Table[res_x];
+ u_w[2] = SDP_Table[256 - res_x];
+ u_w[3] = SDP_Table[512 - res_x];
+ v_w[0] = SDP_Table[256 + res_y];
+ v_w[1] = SDP_Table[res_y];
+ v_w[2] = SDP_Table[256 - res_y];
+ v_w[3] = SDP_Table[512 - res_y];
+}
+
+FXDIB_Format GetTransformedFormat(const CFX_RetainPtr<CFX_DIBSource>& pDrc) {
+ FXDIB_Format format = pDrc->GetFormat();
+ if (pDrc->IsAlphaMask()) {
+ format = FXDIB_8bppMask;
+ } else if (format >= 1025) {
+ format = FXDIB_Cmyka;
+ } else if (format <= 32 || format == FXDIB_Argb) {
+ format = FXDIB_Argb;
+ } else {
+ format = FXDIB_Rgba;
+ }
+ return format;
+}
+
+class CPDF_FixedMatrix {
+ public:
+ CPDF_FixedMatrix(const CFX_Matrix& src, int bits) {
+ base = 1 << bits;
+ a = FXSYS_round(src.a * base);
+ b = FXSYS_round(src.b * base);
+ c = FXSYS_round(src.c * base);
+ d = FXSYS_round(src.d * base);
+ e = FXSYS_round(src.e * base);
+ f = FXSYS_round(src.f * base);
+ }
+
+ inline void Transform(int x, int y, int& x1, int& y1) {
+ x1 = (a * x + c * y + e + base / 2) / base;
+ y1 = (b * x + d * y + f + base / 2) / base;
+ }
+
+ int a;
+ int b;
+ int c;
+ int d;
+ int e;
+ int f;
+ int base;
+};
+
+class CFX_BilinearMatrix : public CPDF_FixedMatrix {
+ public:
+ CFX_BilinearMatrix(const CFX_Matrix& src, int bits)
+ : CPDF_FixedMatrix(src, bits) {}
+ inline void Transform(int x,
+ int y,
+ int& x1,
+ int& y1,
+ int& res_x,
+ int& res_y) {
+ x1 = a * x + c * y + e + base / 2;
+ y1 = b * x + d * y + f + base / 2;
+ res_x = x1 % base;
+ res_y = y1 % base;
+ if (res_x < 0 && res_x > -base) {
+ res_x = base + res_x;
+ }
+ if (res_y < 0 && res_x > -base) {
+ res_y = base + res_y;
+ }
+ x1 /= base;
+ y1 /= base;
+ }
+};
+
+#define FIX16_005 0.05f
+
+} // namespace
+
+CFX_ImageTransformer::CFX_ImageTransformer(
+ const CFX_RetainPtr<CFX_DIBSource>& pSrc,
+ const CFX_Matrix* pMatrix,
+ int flags,
+ const FX_RECT* pClip)
+ : m_pSrc(pSrc),
+ m_pMatrix(pMatrix),
+ m_pClip(pClip),
+ m_Flags(flags),
+ m_Status(0) {}
+
+CFX_ImageTransformer::~CFX_ImageTransformer() {}
+
+bool CFX_ImageTransformer::Start() {
+ CFX_FloatRect unit_rect = m_pMatrix->GetUnitRect();
+ FX_RECT result_rect = unit_rect.GetClosestRect();
+ FX_RECT result_clip = result_rect;
+ if (m_pClip)
+ result_clip.Intersect(*m_pClip);
+
+ if (result_clip.IsEmpty())
+ return false;
+
+ m_result = result_clip;
+ if (fabs(m_pMatrix->a) < fabs(m_pMatrix->b) / 20 &&
+ fabs(m_pMatrix->d) < fabs(m_pMatrix->c) / 20 &&
+ fabs(m_pMatrix->a) < 0.5f && fabs(m_pMatrix->d) < 0.5f) {
+ int dest_width = result_rect.Width();
+ int dest_height = result_rect.Height();
+ result_clip.Offset(-result_rect.left, -result_rect.top);
+ result_clip = FXDIB_SwapClipBox(result_clip, dest_width, dest_height,
+ m_pMatrix->c > 0, m_pMatrix->b < 0);
+ m_Stretcher = pdfium::MakeUnique<CFX_ImageStretcher>(
+ &m_Storer, m_pSrc, dest_height, dest_width, result_clip, m_Flags);
+ m_Stretcher->Start();
+ m_Status = 1;
+ return true;
+ }
+ if (fabs(m_pMatrix->b) < FIX16_005 && fabs(m_pMatrix->c) < FIX16_005) {
+ int dest_width =
+ m_pMatrix->a > 0 ? (int)ceil(m_pMatrix->a) : (int)floor(m_pMatrix->a);
+ int dest_height =
+ m_pMatrix->d > 0 ? (int)-ceil(m_pMatrix->d) : (int)-floor(m_pMatrix->d);
+ result_clip.Offset(-result_rect.left, -result_rect.top);
+ m_Stretcher = pdfium::MakeUnique<CFX_ImageStretcher>(
+ &m_Storer, m_pSrc, dest_width, dest_height, result_clip, m_Flags);
+ m_Stretcher->Start();
+ m_Status = 2;
+ return true;
+ }
+ int stretch_width = (int)ceil(FXSYS_sqrt2(m_pMatrix->a, m_pMatrix->b));
+ int stretch_height = (int)ceil(FXSYS_sqrt2(m_pMatrix->c, m_pMatrix->d));
+ CFX_Matrix stretch2dest(1.0f, 0.0f, 0.0f, -1.0f, 0.0f,
+ (float)(stretch_height));
+ stretch2dest.Concat(
+ CFX_Matrix(m_pMatrix->a / stretch_width, m_pMatrix->b / stretch_width,
+ m_pMatrix->c / stretch_height, m_pMatrix->d / stretch_height,
+ m_pMatrix->e, m_pMatrix->f));
+ m_dest2stretch.SetReverse(stretch2dest);
+
+ CFX_FloatRect clip_rect_f(result_clip);
+ m_dest2stretch.TransformRect(clip_rect_f);
+ m_StretchClip = clip_rect_f.GetOuterRect();
+ m_StretchClip.Intersect(0, 0, stretch_width, stretch_height);
+ m_Stretcher = pdfium::MakeUnique<CFX_ImageStretcher>(
+ &m_Storer, m_pSrc, stretch_width, stretch_height, m_StretchClip, m_Flags);
+ m_Stretcher->Start();
+ m_Status = 3;
+ return true;
+}
+
+bool CFX_ImageTransformer::Continue(IFX_Pause* pPause) {
+ if (m_Status == 1) {
+ if (m_Stretcher->Continue(pPause))
+ return true;
+
+ if (m_Storer.GetBitmap()) {
+ m_Storer.Replace(
+ m_Storer.GetBitmap()->SwapXY(m_pMatrix->c > 0, m_pMatrix->b < 0));
+ }
+ return false;
+ }
+
+ if (m_Status == 2)
+ return m_Stretcher->Continue(pPause);
+
+ if (m_Status != 3)
+ return false;
+
+ if (m_Stretcher->Continue(pPause))
+ return true;
+
+ int stretch_width = m_StretchClip.Width();
+ int stretch_height = m_StretchClip.Height();
+ if (!m_Storer.GetBitmap())
+ return false;
+
+ const uint8_t* stretch_buf = m_Storer.GetBitmap()->GetBuffer();
+ const uint8_t* stretch_buf_mask = nullptr;
+ if (m_Storer.GetBitmap()->m_pAlphaMask)
+ stretch_buf_mask = m_Storer.GetBitmap()->m_pAlphaMask->GetBuffer();
+
+ int stretch_pitch = m_Storer.GetBitmap()->GetPitch();
+ auto pTransformed = pdfium::MakeRetain<CFX_DIBitmap>();
+ FXDIB_Format transformF = GetTransformedFormat(m_Stretcher->source());
+ if (!pTransformed->Create(m_result.Width(), m_result.Height(), transformF))
+ return false;
+
+ pTransformed->Clear(0);
+ if (pTransformed->m_pAlphaMask)
+ pTransformed->m_pAlphaMask->Clear(0);
+
+ CFX_Matrix result2stretch(1.0f, 0.0f, 0.0f, 1.0f, (float)(m_result.left),
+ (float)(m_result.top));
+ result2stretch.Concat(m_dest2stretch);
+ result2stretch.Translate(-m_StretchClip.left, -m_StretchClip.top);
+ if (!stretch_buf_mask && pTransformed->m_pAlphaMask) {
+ pTransformed->m_pAlphaMask->Clear(0xff000000);
+ } else if (pTransformed->m_pAlphaMask) {
+ int stretch_pitch_mask = m_Storer.GetBitmap()->m_pAlphaMask->GetPitch();
+ if (!(m_Flags & FXDIB_DOWNSAMPLE) && !(m_Flags & FXDIB_BICUBIC_INTERPOL)) {
+ CFX_BilinearMatrix result2stretch_fix(result2stretch, 8);
+ for (int row = 0; row < m_result.Height(); row++) {
+ uint8_t* dest_pos_mask =
+ (uint8_t*)pTransformed->m_pAlphaMask->GetScanline(row);
+ for (int col = 0; col < m_result.Width(); col++) {
+ int src_col_l, src_row_l, res_x, res_y;
+ result2stretch_fix.Transform(col, row, src_col_l, src_row_l, res_x,
+ res_y);
+ if (src_col_l >= 0 && src_col_l <= stretch_width && src_row_l >= 0 &&
+ src_row_l <= stretch_height) {
+ if (src_col_l == stretch_width) {
+ src_col_l--;
+ }
+ if (src_row_l == stretch_height) {
+ src_row_l--;
+ }
+ int src_col_r = src_col_l + 1;
+ int src_row_r = src_row_l + 1;
+ if (src_col_r == stretch_width) {
+ src_col_r--;
+ }
+ if (src_row_r == stretch_height) {
+ src_row_r--;
+ }
+ int row_offset_l = src_row_l * stretch_pitch_mask;
+ int row_offset_r = src_row_r * stretch_pitch_mask;
+ *dest_pos_mask =
+ bilinear_interpol(stretch_buf_mask, row_offset_l, row_offset_r,
+ src_col_l, src_col_r, res_x, res_y, 1, 0);
+ }
+ dest_pos_mask++;
+ }
+ }
+ } else if (m_Flags & FXDIB_BICUBIC_INTERPOL) {
+ CFX_BilinearMatrix result2stretch_fix(result2stretch, 8);
+ for (int row = 0; row < m_result.Height(); row++) {
+ uint8_t* dest_pos_mask =
+ (uint8_t*)pTransformed->m_pAlphaMask->GetScanline(row);
+ for (int col = 0; col < m_result.Width(); col++) {
+ int src_col_l, src_row_l, res_x, res_y;
+ result2stretch_fix.Transform(col, row, src_col_l, src_row_l, res_x,
+ res_y);
+ if (src_col_l >= 0 && src_col_l <= stretch_width && src_row_l >= 0 &&
+ src_row_l <= stretch_height) {
+ int pos_pixel[8];
+ int u_w[4], v_w[4];
+ if (src_col_l == stretch_width) {
+ src_col_l--;
+ }
+ if (src_row_l == stretch_height) {
+ src_row_l--;
+ }
+ bicubic_get_pos_weight(pos_pixel, u_w, v_w, src_col_l, src_row_l,
+ res_x, res_y, stretch_width, stretch_height);
+ *dest_pos_mask =
+ bicubic_interpol(stretch_buf_mask, stretch_pitch_mask,
+ pos_pixel, u_w, v_w, res_x, res_y, 1, 0);
+ }
+ dest_pos_mask++;
+ }
+ }
+ } else {
+ CPDF_FixedMatrix result2stretch_fix(result2stretch, 8);
+ for (int row = 0; row < m_result.Height(); row++) {
+ uint8_t* dest_pos_mask =
+ (uint8_t*)pTransformed->m_pAlphaMask->GetScanline(row);
+ for (int col = 0; col < m_result.Width(); col++) {
+ int src_col, src_row;
+ result2stretch_fix.Transform(col, row, src_col, src_row);
+ if (src_col >= 0 && src_col <= stretch_width && src_row >= 0 &&
+ src_row <= stretch_height) {
+ if (src_col == stretch_width) {
+ src_col--;
+ }
+ if (src_row == stretch_height) {
+ src_row--;
+ }
+ *dest_pos_mask =
+ stretch_buf_mask[src_row * stretch_pitch_mask + src_col];
+ }
+ dest_pos_mask++;
+ }
+ }
+ }
+ }
+ if (m_Storer.GetBitmap()->IsAlphaMask()) {
+ if (!(m_Flags & FXDIB_DOWNSAMPLE) && !(m_Flags & FXDIB_BICUBIC_INTERPOL)) {
+ CFX_BilinearMatrix result2stretch_fix(result2stretch, 8);
+ for (int row = 0; row < m_result.Height(); row++) {
+ uint8_t* dest_scan = (uint8_t*)pTransformed->GetScanline(row);
+ for (int col = 0; col < m_result.Width(); col++) {
+ int src_col_l, src_row_l, res_x, res_y;
+ result2stretch_fix.Transform(col, row, src_col_l, src_row_l, res_x,
+ res_y);
+ if (src_col_l >= 0 && src_col_l <= stretch_width && src_row_l >= 0 &&
+ src_row_l <= stretch_height) {
+ if (src_col_l == stretch_width) {
+ src_col_l--;
+ }
+ if (src_row_l == stretch_height) {
+ src_row_l--;
+ }
+ int src_col_r = src_col_l + 1;
+ int src_row_r = src_row_l + 1;
+ if (src_col_r == stretch_width) {
+ src_col_r--;
+ }
+ if (src_row_r == stretch_height) {
+ src_row_r--;
+ }
+ int row_offset_l = src_row_l * stretch_pitch;
+ int row_offset_r = src_row_r * stretch_pitch;
+ *dest_scan =
+ bilinear_interpol(stretch_buf, row_offset_l, row_offset_r,
+ src_col_l, src_col_r, res_x, res_y, 1, 0);
+ }
+ dest_scan++;
+ }
+ }
+ } else if (m_Flags & FXDIB_BICUBIC_INTERPOL) {
+ CFX_BilinearMatrix result2stretch_fix(result2stretch, 8);
+ for (int row = 0; row < m_result.Height(); row++) {
+ uint8_t* dest_scan = (uint8_t*)pTransformed->GetScanline(row);
+ for (int col = 0; col < m_result.Width(); col++) {
+ int src_col_l, src_row_l, res_x, res_y;
+ result2stretch_fix.Transform(col, row, src_col_l, src_row_l, res_x,
+ res_y);
+ if (src_col_l >= 0 && src_col_l <= stretch_width && src_row_l >= 0 &&
+ src_row_l <= stretch_height) {
+ int pos_pixel[8];
+ int u_w[4], v_w[4];
+ if (src_col_l == stretch_width) {
+ src_col_l--;
+ }
+ if (src_row_l == stretch_height) {
+ src_row_l--;
+ }
+ bicubic_get_pos_weight(pos_pixel, u_w, v_w, src_col_l, src_row_l,
+ res_x, res_y, stretch_width, stretch_height);
+ *dest_scan = bicubic_interpol(stretch_buf, stretch_pitch, pos_pixel,
+ u_w, v_w, res_x, res_y, 1, 0);
+ }
+ dest_scan++;
+ }
+ }
+ } else {
+ CPDF_FixedMatrix result2stretch_fix(result2stretch, 8);
+ for (int row = 0; row < m_result.Height(); row++) {
+ uint8_t* dest_scan = (uint8_t*)pTransformed->GetScanline(row);
+ for (int col = 0; col < m_result.Width(); col++) {
+ int src_col, src_row;
+ result2stretch_fix.Transform(col, row, src_col, src_row);
+ if (src_col >= 0 && src_col <= stretch_width && src_row >= 0 &&
+ src_row <= stretch_height) {
+ if (src_col == stretch_width) {
+ src_col--;
+ }
+ if (src_row == stretch_height) {
+ src_row--;
+ }
+ const uint8_t* src_pixel =
+ stretch_buf + stretch_pitch * src_row + src_col;
+ *dest_scan = *src_pixel;
+ }
+ dest_scan++;
+ }
+ }
+ }
+ } else {
+ int Bpp = m_Storer.GetBitmap()->GetBPP() / 8;
+ if (Bpp == 1) {
+ uint32_t argb[256];
+ FX_ARGB* pPal = m_Storer.GetBitmap()->GetPalette();
+ if (pPal) {
+ for (int i = 0; i < 256; i++) {
+ argb[i] = pPal[i];
+ }
+ } else {
+ if (m_Storer.GetBitmap()->IsCmykImage()) {
+ for (int i = 0; i < 256; i++) {
+ argb[i] = 255 - i;
+ }
+ } else {
+ for (int i = 0; i < 256; i++) {
+ argb[i] = 0xff000000 | (i * 0x010101);
+ }
+ }
+ }
+ int destBpp = pTransformed->GetBPP() / 8;
+ if (!(m_Flags & FXDIB_DOWNSAMPLE) &&
+ !(m_Flags & FXDIB_BICUBIC_INTERPOL)) {
+ CFX_BilinearMatrix result2stretch_fix(result2stretch, 8);
+ for (int row = 0; row < m_result.Height(); row++) {
+ uint8_t* dest_pos = (uint8_t*)pTransformed->GetScanline(row);
+ for (int col = 0; col < m_result.Width(); col++) {
+ int src_col_l, src_row_l, res_x, res_y;
+ result2stretch_fix.Transform(col, row, src_col_l, src_row_l, res_x,
+ res_y);
+ if (src_col_l >= 0 && src_col_l <= stretch_width &&
+ src_row_l >= 0 && src_row_l <= stretch_height) {
+ if (src_col_l == stretch_width) {
+ src_col_l--;
+ }
+ if (src_row_l == stretch_height) {
+ src_row_l--;
+ }
+ int src_col_r = src_col_l + 1;
+ int src_row_r = src_row_l + 1;
+ if (src_col_r == stretch_width) {
+ src_col_r--;
+ }
+ if (src_row_r == stretch_height) {
+ src_row_r--;
+ }
+ int row_offset_l = src_row_l * stretch_pitch;
+ int row_offset_r = src_row_r * stretch_pitch;
+ uint32_t r_bgra_cmyk = argb[bilinear_interpol(
+ stretch_buf, row_offset_l, row_offset_r, src_col_l, src_col_r,
+ res_x, res_y, 1, 0)];
+ if (transformF == FXDIB_Rgba) {
+ dest_pos[0] = (uint8_t)(r_bgra_cmyk >> 24);
+ dest_pos[1] = (uint8_t)(r_bgra_cmyk >> 16);
+ dest_pos[2] = (uint8_t)(r_bgra_cmyk >> 8);
+ } else {
+ *(uint32_t*)dest_pos = r_bgra_cmyk;
+ }
+ }
+ dest_pos += destBpp;
+ }
+ }
+ } else if (m_Flags & FXDIB_BICUBIC_INTERPOL) {
+ CFX_BilinearMatrix result2stretch_fix(result2stretch, 8);
+ for (int row = 0; row < m_result.Height(); row++) {
+ uint8_t* dest_pos = (uint8_t*)pTransformed->GetScanline(row);
+ for (int col = 0; col < m_result.Width(); col++) {
+ int src_col_l, src_row_l, res_x, res_y;
+ result2stretch_fix.Transform(col, row, src_col_l, src_row_l, res_x,
+ res_y);
+ if (src_col_l >= 0 && src_col_l <= stretch_width &&
+ src_row_l >= 0 && src_row_l <= stretch_height) {
+ int pos_pixel[8];
+ int u_w[4], v_w[4];
+ if (src_col_l == stretch_width) {
+ src_col_l--;
+ }
+ if (src_row_l == stretch_height) {
+ src_row_l--;
+ }
+ bicubic_get_pos_weight(pos_pixel, u_w, v_w, src_col_l, src_row_l,
+ res_x, res_y, stretch_width,
+ stretch_height);
+ uint32_t r_bgra_cmyk =
+ argb[bicubic_interpol(stretch_buf, stretch_pitch, pos_pixel,
+ u_w, v_w, res_x, res_y, 1, 0)];
+ if (transformF == FXDIB_Rgba) {
+ dest_pos[0] = (uint8_t)(r_bgra_cmyk >> 24);
+ dest_pos[1] = (uint8_t)(r_bgra_cmyk >> 16);
+ dest_pos[2] = (uint8_t)(r_bgra_cmyk >> 8);
+ } else {
+ *(uint32_t*)dest_pos = r_bgra_cmyk;
+ }
+ }
+ dest_pos += destBpp;
+ }
+ }
+ } else {
+ CPDF_FixedMatrix result2stretch_fix(result2stretch, 8);
+ for (int row = 0; row < m_result.Height(); row++) {
+ uint8_t* dest_pos = (uint8_t*)pTransformed->GetScanline(row);
+ for (int col = 0; col < m_result.Width(); col++) {
+ int src_col, src_row;
+ result2stretch_fix.Transform(col, row, src_col, src_row);
+ if (src_col >= 0 && src_col <= stretch_width && src_row >= 0 &&
+ src_row <= stretch_height) {
+ if (src_col == stretch_width) {
+ src_col--;
+ }
+ if (src_row == stretch_height) {
+ src_row--;
+ }
+ uint32_t r_bgra_cmyk =
+ argb[stretch_buf[src_row * stretch_pitch + src_col]];
+ if (transformF == FXDIB_Rgba) {
+ dest_pos[0] = (uint8_t)(r_bgra_cmyk >> 24);
+ dest_pos[1] = (uint8_t)(r_bgra_cmyk >> 16);
+ dest_pos[2] = (uint8_t)(r_bgra_cmyk >> 8);
+ } else {
+ *(uint32_t*)dest_pos = r_bgra_cmyk;
+ }
+ }
+ dest_pos += destBpp;
+ }
+ }
+ }
+ } else {
+ bool bHasAlpha = m_Storer.GetBitmap()->HasAlpha();
+ int destBpp = pTransformed->GetBPP() / 8;
+ if (!(m_Flags & FXDIB_DOWNSAMPLE) &&
+ !(m_Flags & FXDIB_BICUBIC_INTERPOL)) {
+ CFX_BilinearMatrix result2stretch_fix(result2stretch, 8);
+ for (int row = 0; row < m_result.Height(); row++) {
+ uint8_t* dest_pos = (uint8_t*)pTransformed->GetScanline(row);
+ for (int col = 0; col < m_result.Width(); col++) {
+ int src_col_l, src_row_l, res_x, res_y, r_pos_k_r = 0;
+ result2stretch_fix.Transform(col, row, src_col_l, src_row_l, res_x,
+ res_y);
+ if (src_col_l >= 0 && src_col_l <= stretch_width &&
+ src_row_l >= 0 && src_row_l <= stretch_height) {
+ if (src_col_l == stretch_width) {
+ src_col_l--;
+ }
+ if (src_row_l == stretch_height) {
+ src_row_l--;
+ }
+ int src_col_r = src_col_l + 1;
+ int src_row_r = src_row_l + 1;
+ if (src_col_r == stretch_width) {
+ src_col_r--;
+ }
+ if (src_row_r == stretch_height) {
+ src_row_r--;
+ }
+ int row_offset_l = src_row_l * stretch_pitch;
+ int row_offset_r = src_row_r * stretch_pitch;
+ uint8_t r_pos_red_y_r =
+ bilinear_interpol(stretch_buf, row_offset_l, row_offset_r,
+ src_col_l, src_col_r, res_x, res_y, Bpp, 2);
+ uint8_t r_pos_green_m_r =
+ bilinear_interpol(stretch_buf, row_offset_l, row_offset_r,
+ src_col_l, src_col_r, res_x, res_y, Bpp, 1);
+ uint8_t r_pos_blue_c_r =
+ bilinear_interpol(stretch_buf, row_offset_l, row_offset_r,
+ src_col_l, src_col_r, res_x, res_y, Bpp, 0);
+ if (bHasAlpha) {
+ if (transformF != FXDIB_Argb) {
+ if (transformF == FXDIB_Rgba) {
+ dest_pos[0] = r_pos_blue_c_r;
+ dest_pos[1] = r_pos_green_m_r;
+ dest_pos[2] = r_pos_red_y_r;
+ } else {
+ r_pos_k_r = bilinear_interpol(
+ stretch_buf, row_offset_l, row_offset_r, src_col_l,
+ src_col_r, res_x, res_y, Bpp, 3);
+ *(uint32_t*)dest_pos =
+ FXCMYK_TODIB(CmykEncode(r_pos_blue_c_r, r_pos_green_m_r,
+ r_pos_red_y_r, r_pos_k_r));
+ }
+ } else {
+ uint8_t r_pos_a_r = bilinear_interpol(
+ stretch_buf, row_offset_l, row_offset_r, src_col_l,
+ src_col_r, res_x, res_y, Bpp, 3);
+ *(uint32_t*)dest_pos = FXARGB_TODIB(
+ FXARGB_MAKE(r_pos_a_r, r_pos_red_y_r, r_pos_green_m_r,
+ r_pos_blue_c_r));
+ }
+ } else {
+ r_pos_k_r = 0xff;
+ if (transformF == FXDIB_Cmyka) {
+ r_pos_k_r = bilinear_interpol(
+ stretch_buf, row_offset_l, row_offset_r, src_col_l,
+ src_col_r, res_x, res_y, Bpp, 3);
+ *(uint32_t*)dest_pos =
+ FXCMYK_TODIB(CmykEncode(r_pos_blue_c_r, r_pos_green_m_r,
+ r_pos_red_y_r, r_pos_k_r));
+ } else {
+ *(uint32_t*)dest_pos = FXARGB_TODIB(
+ FXARGB_MAKE(r_pos_k_r, r_pos_red_y_r, r_pos_green_m_r,
+ r_pos_blue_c_r));
+ }
+ }
+ }
+ dest_pos += destBpp;
+ }
+ }
+ } else if (m_Flags & FXDIB_BICUBIC_INTERPOL) {
+ CFX_BilinearMatrix result2stretch_fix(result2stretch, 8);
+ for (int row = 0; row < m_result.Height(); row++) {
+ uint8_t* dest_pos = (uint8_t*)pTransformed->GetScanline(row);
+ for (int col = 0; col < m_result.Width(); col++) {
+ int src_col_l, src_row_l, res_x, res_y, r_pos_k_r = 0;
+ result2stretch_fix.Transform(col, row, src_col_l, src_row_l, res_x,
+ res_y);
+ if (src_col_l >= 0 && src_col_l <= stretch_width &&
+ src_row_l >= 0 && src_row_l <= stretch_height) {
+ int pos_pixel[8];
+ int u_w[4], v_w[4];
+ if (src_col_l == stretch_width) {
+ src_col_l--;
+ }
+ if (src_row_l == stretch_height) {
+ src_row_l--;
+ }
+ bicubic_get_pos_weight(pos_pixel, u_w, v_w, src_col_l, src_row_l,
+ res_x, res_y, stretch_width,
+ stretch_height);
+ uint8_t r_pos_red_y_r =
+ bicubic_interpol(stretch_buf, stretch_pitch, pos_pixel, u_w,
+ v_w, res_x, res_y, Bpp, 2);
+ uint8_t r_pos_green_m_r =
+ bicubic_interpol(stretch_buf, stretch_pitch, pos_pixel, u_w,
+ v_w, res_x, res_y, Bpp, 1);
+ uint8_t r_pos_blue_c_r =
+ bicubic_interpol(stretch_buf, stretch_pitch, pos_pixel, u_w,
+ v_w, res_x, res_y, Bpp, 0);
+ if (bHasAlpha) {
+ if (transformF != FXDIB_Argb) {
+ if (transformF == FXDIB_Rgba) {
+ dest_pos[0] = r_pos_blue_c_r;
+ dest_pos[1] = r_pos_green_m_r;
+ dest_pos[2] = r_pos_red_y_r;
+ } else {
+ r_pos_k_r =
+ bicubic_interpol(stretch_buf, stretch_pitch, pos_pixel,
+ u_w, v_w, res_x, res_y, Bpp, 3);
+ *(uint32_t*)dest_pos =
+ FXCMYK_TODIB(CmykEncode(r_pos_blue_c_r, r_pos_green_m_r,
+ r_pos_red_y_r, r_pos_k_r));
+ }
+ } else {
+ uint8_t r_pos_a_r =
+ bicubic_interpol(stretch_buf, stretch_pitch, pos_pixel,
+ u_w, v_w, res_x, res_y, Bpp, 3);
+ *(uint32_t*)dest_pos = FXARGB_TODIB(
+ FXARGB_MAKE(r_pos_a_r, r_pos_red_y_r, r_pos_green_m_r,
+ r_pos_blue_c_r));
+ }
+ } else {
+ r_pos_k_r = 0xff;
+ if (transformF == FXDIB_Cmyka) {
+ r_pos_k_r =
+ bicubic_interpol(stretch_buf, stretch_pitch, pos_pixel,
+ u_w, v_w, res_x, res_y, Bpp, 3);
+ *(uint32_t*)dest_pos =
+ FXCMYK_TODIB(CmykEncode(r_pos_blue_c_r, r_pos_green_m_r,
+ r_pos_red_y_r, r_pos_k_r));
+ } else {
+ *(uint32_t*)dest_pos = FXARGB_TODIB(
+ FXARGB_MAKE(r_pos_k_r, r_pos_red_y_r, r_pos_green_m_r,
+ r_pos_blue_c_r));
+ }
+ }
+ }
+ dest_pos += destBpp;
+ }
+ }
+ } else {
+ CPDF_FixedMatrix result2stretch_fix(result2stretch, 8);
+ for (int row = 0; row < m_result.Height(); row++) {
+ uint8_t* dest_pos = (uint8_t*)pTransformed->GetScanline(row);
+ for (int col = 0; col < m_result.Width(); col++) {
+ int src_col, src_row;
+ result2stretch_fix.Transform(col, row, src_col, src_row);
+ if (src_col >= 0 && src_col <= stretch_width && src_row >= 0 &&
+ src_row <= stretch_height) {
+ if (src_col == stretch_width) {
+ src_col--;
+ }
+ if (src_row == stretch_height) {
+ src_row--;
+ }
+ const uint8_t* src_pos =
+ stretch_buf + src_row * stretch_pitch + src_col * Bpp;
+ if (bHasAlpha) {
+ if (transformF != FXDIB_Argb) {
+ if (transformF == FXDIB_Rgba) {
+ dest_pos[0] = src_pos[0];
+ dest_pos[1] = src_pos[1];
+ dest_pos[2] = src_pos[2];
+ } else {
+ *(uint32_t*)dest_pos = FXCMYK_TODIB(CmykEncode(
+ src_pos[0], src_pos[1], src_pos[2], src_pos[3]));
+ }
+ } else {
+ *(uint32_t*)dest_pos = FXARGB_TODIB(FXARGB_MAKE(
+ src_pos[3], src_pos[2], src_pos[1], src_pos[0]));
+ }
+ } else {
+ if (transformF == FXDIB_Cmyka) {
+ *(uint32_t*)dest_pos = FXCMYK_TODIB(CmykEncode(
+ src_pos[0], src_pos[1], src_pos[2], src_pos[3]));
+ } else {
+ *(uint32_t*)dest_pos = FXARGB_TODIB(
+ FXARGB_MAKE(0xff, src_pos[2], src_pos[1], src_pos[0]));
+ }
+ }
+ }
+ dest_pos += destBpp;
+ }
+ }
+ }
+ }
+ }
+ m_Storer.Replace(std::move(pTransformed));
+ return false;
+}
+
+CFX_RetainPtr<CFX_DIBitmap> CFX_ImageTransformer::DetachBitmap() {
+ return m_Storer.Detach();
+}
diff --git a/chromium/third_party/pdfium/core/fxge/dib/cfx_imagetransformer.h b/chromium/third_party/pdfium/core/fxge/dib/cfx_imagetransformer.h
new file mode 100644
index 00000000000..52aca9792e4
--- /dev/null
+++ b/chromium/third_party/pdfium/core/fxge/dib/cfx_imagetransformer.h
@@ -0,0 +1,47 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef CORE_FXGE_DIB_CFX_IMAGETRANSFORMER_H_
+#define CORE_FXGE_DIB_CFX_IMAGETRANSFORMER_H_
+
+#include <memory>
+
+#include "core/fxcrt/cfx_retain_ptr.h"
+#include "core/fxcrt/fx_coordinates.h"
+#include "core/fxge/dib/cfx_bitmapstorer.h"
+#include "core/fxge/dib/cfx_dibitmap.h"
+#include "core/fxge/dib/cfx_dibsource.h"
+
+class CFX_ImageStretcher;
+
+class CFX_ImageTransformer {
+ public:
+ CFX_ImageTransformer(const CFX_RetainPtr<CFX_DIBSource>& pSrc,
+ const CFX_Matrix* pMatrix,
+ int flags,
+ const FX_RECT* pClip);
+ ~CFX_ImageTransformer();
+
+ bool Start();
+ bool Continue(IFX_Pause* pPause);
+
+ const FX_RECT& result() const { return m_result; }
+ CFX_RetainPtr<CFX_DIBitmap> DetachBitmap();
+
+ private:
+ const CFX_RetainPtr<CFX_DIBSource> m_pSrc;
+ const CFX_Matrix* const m_pMatrix;
+ const FX_RECT* const m_pClip;
+ FX_RECT m_StretchClip;
+ FX_RECT m_result;
+ CFX_Matrix m_dest2stretch;
+ std::unique_ptr<CFX_ImageStretcher> m_Stretcher;
+ CFX_BitmapStorer m_Storer;
+ const uint32_t m_Flags;
+ int m_Status;
+};
+
+#endif // CORE_FXGE_DIB_CFX_IMAGETRANSFORMER_H_
diff --git a/chromium/third_party/pdfium/core/fxge/dib/cfx_scanlinecompositor.cpp b/chromium/third_party/pdfium/core/fxge/dib/cfx_scanlinecompositor.cpp
new file mode 100644
index 00000000000..5c4625020de
--- /dev/null
+++ b/chromium/third_party/pdfium/core/fxge/dib/cfx_scanlinecompositor.cpp
@@ -0,0 +1,3348 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "core/fxge/dib/cfx_scanlinecompositor.h"
+
+#include <algorithm>
+
+#include "core/fxcodec/fx_codec.h"
+#include "core/fxge/cfx_gemodule.h"
+
+#define FX_CCOLOR(val) (255 - (val))
+#define FXDIB_ALPHA_UNION(dest, src) ((dest) + (src) - (dest) * (src) / 255)
+#define FXARGB_COPY(dest, src) \
+ *(dest) = *(src), *((dest) + 1) = *((src) + 1), \
+ *((dest) + 2) = *((src) + 2), *((dest) + 3) = *((src) + 3)
+#define FXARGB_RGBORDERCOPY(dest, src) \
+ *((dest) + 3) = *((src) + 3), *(dest) = *((src) + 2), \
+ *((dest) + 1) = *((src) + 1), *((dest) + 2) = *((src))
+
+namespace {
+
+const uint8_t color_sqrt[256] = {
+ 0x00, 0x03, 0x07, 0x0B, 0x0F, 0x12, 0x16, 0x19, 0x1D, 0x20, 0x23, 0x26,
+ 0x29, 0x2C, 0x2F, 0x32, 0x35, 0x37, 0x3A, 0x3C, 0x3F, 0x41, 0x43, 0x46,
+ 0x48, 0x4A, 0x4C, 0x4E, 0x50, 0x52, 0x54, 0x56, 0x57, 0x59, 0x5B, 0x5C,
+ 0x5E, 0x60, 0x61, 0x63, 0x64, 0x65, 0x67, 0x68, 0x69, 0x6B, 0x6C, 0x6D,
+ 0x6E, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A,
+ 0x7B, 0x7C, 0x7D, 0x7E, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
+ 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, 0x90, 0x91, 0x91,
+ 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x97, 0x98, 0x99, 0x9A, 0x9B, 0x9C,
+ 0x9C, 0x9D, 0x9E, 0x9F, 0xA0, 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA4, 0xA5,
+ 0xA6, 0xA7, 0xA7, 0xA8, 0xA9, 0xAA, 0xAA, 0xAB, 0xAC, 0xAD, 0xAD, 0xAE,
+ 0xAF, 0xB0, 0xB0, 0xB1, 0xB2, 0xB3, 0xB3, 0xB4, 0xB5, 0xB5, 0xB6, 0xB7,
+ 0xB7, 0xB8, 0xB9, 0xBA, 0xBA, 0xBB, 0xBC, 0xBC, 0xBD, 0xBE, 0xBE, 0xBF,
+ 0xC0, 0xC0, 0xC1, 0xC2, 0xC2, 0xC3, 0xC4, 0xC4, 0xC5, 0xC6, 0xC6, 0xC7,
+ 0xC7, 0xC8, 0xC9, 0xC9, 0xCA, 0xCB, 0xCB, 0xCC, 0xCC, 0xCD, 0xCE, 0xCE,
+ 0xCF, 0xD0, 0xD0, 0xD1, 0xD1, 0xD2, 0xD3, 0xD3, 0xD4, 0xD4, 0xD5, 0xD6,
+ 0xD6, 0xD7, 0xD7, 0xD8, 0xD9, 0xD9, 0xDA, 0xDA, 0xDB, 0xDC, 0xDC, 0xDD,
+ 0xDD, 0xDE, 0xDE, 0xDF, 0xE0, 0xE0, 0xE1, 0xE1, 0xE2, 0xE2, 0xE3, 0xE4,
+ 0xE4, 0xE5, 0xE5, 0xE6, 0xE6, 0xE7, 0xE7, 0xE8, 0xE9, 0xE9, 0xEA, 0xEA,
+ 0xEB, 0xEB, 0xEC, 0xEC, 0xED, 0xED, 0xEE, 0xEE, 0xEF, 0xF0, 0xF0, 0xF1,
+ 0xF1, 0xF2, 0xF2, 0xF3, 0xF3, 0xF4, 0xF4, 0xF5, 0xF5, 0xF6, 0xF6, 0xF7,
+ 0xF7, 0xF8, 0xF8, 0xF9, 0xF9, 0xFA, 0xFA, 0xFB, 0xFB, 0xFC, 0xFC, 0xFD,
+ 0xFD, 0xFE, 0xFE, 0xFF};
+
+int Blend(int blend_mode, int back_color, int src_color) {
+ switch (blend_mode) {
+ case FXDIB_BLEND_NORMAL:
+ return src_color;
+ case FXDIB_BLEND_MULTIPLY:
+ return src_color * back_color / 255;
+ case FXDIB_BLEND_SCREEN:
+ return src_color + back_color - src_color * back_color / 255;
+ case FXDIB_BLEND_OVERLAY:
+ return Blend(FXDIB_BLEND_HARDLIGHT, src_color, back_color);
+ case FXDIB_BLEND_DARKEN:
+ return src_color < back_color ? src_color : back_color;
+ case FXDIB_BLEND_LIGHTEN:
+ return src_color > back_color ? src_color : back_color;
+ case FXDIB_BLEND_COLORDODGE: {
+ if (src_color == 255)
+ return src_color;
+
+ return std::min(back_color * 255 / (255 - src_color), 255);
+ }
+ case FXDIB_BLEND_COLORBURN: {
+ if (src_color == 0)
+ return src_color;
+
+ return 255 - std::min((255 - back_color) * 255 / src_color, 255);
+ }
+ case FXDIB_BLEND_HARDLIGHT:
+ if (src_color < 128)
+ return (src_color * back_color * 2) / 255;
+
+ return Blend(FXDIB_BLEND_SCREEN, back_color, 2 * src_color - 255);
+ case FXDIB_BLEND_SOFTLIGHT: {
+ if (src_color < 128) {
+ return back_color -
+ (255 - 2 * src_color) * back_color * (255 - back_color) / 255 /
+ 255;
+ }
+ return back_color +
+ (2 * src_color - 255) * (color_sqrt[back_color] - back_color) /
+ 255;
+ }
+ case FXDIB_BLEND_DIFFERENCE:
+ return back_color < src_color ? src_color - back_color
+ : back_color - src_color;
+ case FXDIB_BLEND_EXCLUSION:
+ return back_color + src_color - 2 * back_color * src_color / 255;
+ }
+ return src_color;
+}
+
+struct RGB {
+ int red;
+ int green;
+ int blue;
+};
+
+int Lum(RGB color) {
+ return (color.red * 30 + color.green * 59 + color.blue * 11) / 100;
+}
+
+RGB ClipColor(RGB color) {
+ int l = Lum(color);
+ int n = std::min(color.red, std::min(color.green, color.blue));
+ int x = std::max(color.red, std::max(color.green, color.blue));
+ if (n < 0) {
+ color.red = l + ((color.red - l) * l / (l - n));
+ color.green = l + ((color.green - l) * l / (l - n));
+ color.blue = l + ((color.blue - l) * l / (l - n));
+ }
+ if (x > 255) {
+ color.red = l + ((color.red - l) * (255 - l) / (x - l));
+ color.green = l + ((color.green - l) * (255 - l) / (x - l));
+ color.blue = l + ((color.blue - l) * (255 - l) / (x - l));
+ }
+ return color;
+}
+
+RGB SetLum(RGB color, int l) {
+ int d = l - Lum(color);
+ color.red += d;
+ color.green += d;
+ color.blue += d;
+ return ClipColor(color);
+}
+
+int Sat(RGB color) {
+ return std::max(color.red, std::max(color.green, color.blue)) -
+ std::min(color.red, std::min(color.green, color.blue));
+}
+
+RGB SetSat(RGB color, int s) {
+ int min = std::min(color.red, std::min(color.green, color.blue));
+ int max = std::max(color.red, std::max(color.green, color.blue));
+ if (min == max)
+ return {0, 0, 0};
+
+ color.red = (color.red - min) * s / (max - min);
+ color.green = (color.green - min) * s / (max - min);
+ color.blue = (color.blue - min) * s / (max - min);
+ return color;
+}
+
+void RGB_Blend(int blend_mode,
+ const uint8_t* src_scan,
+ const uint8_t* dest_scan,
+ int results[3]) {
+ RGB result = {0, 0, 0};
+ RGB src;
+ src.red = src_scan[2];
+ src.green = src_scan[1];
+ src.blue = src_scan[0];
+ RGB back;
+ back.red = dest_scan[2];
+ back.green = dest_scan[1];
+ back.blue = dest_scan[0];
+ switch (blend_mode) {
+ case FXDIB_BLEND_HUE:
+ result = SetLum(SetSat(src, Sat(back)), Lum(back));
+ break;
+ case FXDIB_BLEND_SATURATION:
+ result = SetLum(SetSat(back, Sat(src)), Lum(back));
+ break;
+ case FXDIB_BLEND_COLOR:
+ result = SetLum(src, Lum(back));
+ break;
+ case FXDIB_BLEND_LUMINOSITY:
+ result = SetLum(back, Lum(src));
+ break;
+ }
+ results[0] = result.blue;
+ results[1] = result.green;
+ results[2] = result.red;
+}
+
+int GetAlpha(uint8_t src_alpha, const uint8_t* clip_scan, int col) {
+ return clip_scan ? clip_scan[col] * src_alpha / 255 : src_alpha;
+}
+
+void CompositeRow_AlphaToMask(uint8_t* dest_scan,
+ const uint8_t* src_scan,
+ int pixel_count,
+ const uint8_t* clip_scan,
+ uint8_t stride) {
+ src_scan += stride - 1;
+ for (int col = 0; col < pixel_count; ++col) {
+ int src_alpha = GetAlpha(*src_scan, clip_scan, col);
+ uint8_t back_alpha = *dest_scan;
+ if (!back_alpha)
+ *dest_scan = src_alpha;
+ else if (src_alpha)
+ *dest_scan = back_alpha + src_alpha - back_alpha * src_alpha / 255;
+ ++dest_scan;
+ src_scan += stride;
+ }
+}
+
+void CompositeRow_Rgb2Mask(uint8_t* dest_scan,
+ const uint8_t* src_scan,
+ int width,
+ const uint8_t* clip_scan) {
+ if (!clip_scan) {
+ memset(dest_scan, 0xff, width);
+ return;
+ }
+ for (int i = 0; i < width; ++i) {
+ *dest_scan = FXDIB_ALPHA_UNION(*dest_scan, *clip_scan);
+ ++dest_scan;
+ ++clip_scan;
+ }
+}
+
+uint8_t GetGray(const uint8_t* src_scan) {
+ return FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan);
+}
+
+uint8_t GetGrayWithBlend(const uint8_t* src_scan,
+ const uint8_t* dest_scan,
+ int blend_type) {
+ uint8_t gray = GetGray(src_scan);
+ if (blend_type >= FXDIB_BLEND_NONSEPARABLE)
+ gray = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan;
+ else if (blend_type)
+ gray = Blend(blend_type, *dest_scan, gray);
+ return gray;
+}
+
+void CompositeRow_Argb2Graya(uint8_t* dest_scan,
+ const uint8_t* src_scan,
+ int pixel_count,
+ int blend_type,
+ const uint8_t* clip_scan,
+ const uint8_t* src_alpha_scan,
+ uint8_t* dst_alpha_scan) {
+ uint8_t offset = src_alpha_scan ? 3 : 4;
+ for (int col = 0; col < pixel_count; ++col) {
+ const uint8_t* alpha_scan =
+ src_alpha_scan ? src_alpha_scan++ : &src_scan[3];
+ uint8_t back_alpha = *dst_alpha_scan;
+ if (back_alpha == 0) {
+ int src_alpha = GetAlpha(*alpha_scan, clip_scan, col);
+ if (src_alpha) {
+ *dest_scan = GetGray(src_scan);
+ *dst_alpha_scan = src_alpha;
+ }
+ ++dest_scan;
+ ++dst_alpha_scan;
+ src_scan += offset;
+ continue;
+ }
+ uint8_t src_alpha = GetAlpha(*alpha_scan, clip_scan, col);
+ if (src_alpha == 0) {
+ ++dest_scan;
+ ++dst_alpha_scan;
+ src_scan += offset;
+ continue;
+ }
+ *dst_alpha_scan = FXDIB_ALPHA_UNION(back_alpha, src_alpha);
+ int alpha_ratio = src_alpha * 255 / (*dst_alpha_scan);
+ uint8_t gray = GetGray(src_scan);
+ // TODO(npm): Does this if really need src_alpha_scan or was that a bug?
+ if (blend_type && src_alpha_scan) {
+ if (blend_type >= FXDIB_BLEND_NONSEPARABLE)
+ gray = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan;
+ else
+ gray = Blend(blend_type, *dest_scan, gray);
+ }
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio);
+ ++dest_scan;
+ ++dst_alpha_scan;
+ src_scan += offset;
+ }
+}
+
+void CompositeRow_Argb2Gray(uint8_t* dest_scan,
+ const uint8_t* src_scan,
+ int pixel_count,
+ int blend_type,
+ const uint8_t* clip_scan,
+ const uint8_t* src_alpha_scan) {
+ uint8_t gray;
+ uint8_t offset = src_alpha_scan ? 3 : 4;
+ for (int col = 0; col < pixel_count; ++col) {
+ const uint8_t* alpha_scan =
+ src_alpha_scan ? src_alpha_scan++ : &src_scan[3];
+ int src_alpha = GetAlpha(*alpha_scan, clip_scan, col);
+ if (src_alpha) {
+ gray = GetGrayWithBlend(src_scan, dest_scan, blend_type);
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, src_alpha);
+ }
+ ++dest_scan;
+ src_scan += offset;
+ }
+}
+
+void CompositeRow_Rgb2Gray(uint8_t* dest_scan,
+ const uint8_t* src_scan,
+ int src_Bpp,
+ int pixel_count,
+ int blend_type,
+ const uint8_t* clip_scan) {
+ uint8_t gray;
+ for (int col = 0; col < pixel_count; ++col) {
+ gray = GetGrayWithBlend(src_scan, dest_scan, blend_type);
+ if (clip_scan && clip_scan[col] < 255)
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, clip_scan[col]);
+ else
+ *dest_scan = gray;
+ ++dest_scan;
+ src_scan += src_Bpp;
+ }
+}
+
+void CompositeRow_Rgb2Graya(uint8_t* dest_scan,
+ const uint8_t* src_scan,
+ int src_Bpp,
+ int pixel_count,
+ int blend_type,
+ const uint8_t* clip_scan,
+ uint8_t* dest_alpha_scan) {
+ for (int col = 0; col < pixel_count; ++col) {
+ if (blend_type && *dest_alpha_scan == 0) {
+ *dest_scan = GetGray(src_scan);
+ ++dest_scan;
+ ++dest_alpha_scan;
+ src_scan += src_Bpp;
+ continue;
+ }
+ int src_alpha = clip_scan ? clip_scan[col] : 255;
+ if (src_alpha == 255) {
+ *dest_scan = GetGrayWithBlend(src_scan, dest_scan, blend_type);
+ ++dest_scan;
+ *dest_alpha_scan = 255;
+ ++dest_alpha_scan;
+ src_scan += src_Bpp;
+ continue;
+ }
+ if (src_alpha == 0) {
+ ++dest_scan;
+ ++dest_alpha_scan;
+ src_scan += src_Bpp;
+ continue;
+ }
+ int back_alpha = *dest_alpha_scan;
+ uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255;
+ *dest_alpha_scan = dest_alpha;
+ ++dest_alpha_scan;
+ int alpha_ratio = src_alpha * 255 / dest_alpha;
+ uint8_t gray = GetGrayWithBlend(src_scan, dest_scan, blend_type);
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio);
+ ++dest_scan;
+ src_scan += src_Bpp;
+ }
+}
+
+void CompositeRow_Argb2Argb(uint8_t* dest_scan,
+ const uint8_t* src_scan,
+ int pixel_count,
+ int blend_type,
+ const uint8_t* clip_scan,
+ uint8_t* dest_alpha_scan,
+ const uint8_t* src_alpha_scan) {
+ int blended_colors[3];
+ uint8_t dest_offset = dest_alpha_scan ? 3 : 4;
+ uint8_t src_offset = src_alpha_scan ? 3 : 4;
+ bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
+ bool has_src = !!src_alpha_scan;
+ bool has_dest = !!dest_alpha_scan;
+ for (int col = 0; col < pixel_count; ++col) {
+ uint8_t back_alpha = has_dest ? *dest_alpha_scan : dest_scan[3];
+ const uint8_t* alpha_source = has_src ? src_alpha_scan++ : &src_scan[3];
+ uint8_t src_alpha = GetAlpha(*alpha_source, clip_scan, col);
+ if (back_alpha == 0) {
+ if (!has_dest && !has_src) {
+ if (clip_scan) {
+ FXARGB_SETDIB(dest_scan, (FXARGB_GETDIB(src_scan) & 0xffffff) |
+ (src_alpha << 24));
+ } else {
+ FXARGB_COPY(dest_scan, src_scan);
+ }
+ } else if (has_dest) {
+ *dest_alpha_scan = src_alpha;
+ for (int i = 0; i < 3; ++i) {
+ *dest_scan = *src_scan++;
+ ++dest_scan;
+ }
+ ++dest_alpha_scan;
+ if (!has_src)
+ ++src_scan;
+ } else {
+ FXARGB_SETDIB(dest_scan, FXARGB_MAKE((src_alpha << 24), src_scan[2],
+ src_scan[1], *src_scan));
+ }
+ if (!has_dest) {
+ dest_scan += dest_offset;
+ src_scan += src_offset;
+ }
+ continue;
+ }
+ if (src_alpha == 0) {
+ dest_scan += dest_offset;
+ src_scan += src_offset;
+ if (has_dest)
+ ++dest_alpha_scan;
+ continue;
+ }
+ uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255;
+ if (has_dest) {
+ *dest_alpha_scan = dest_alpha;
+ ++dest_alpha_scan;
+ } else {
+ dest_scan[3] = dest_alpha;
+ }
+ int alpha_ratio = src_alpha * 255 / dest_alpha;
+ if (bNonseparableBlend)
+ RGB_Blend(blend_type, src_scan, dest_scan, blended_colors);
+ for (int color = 0; color < 3; ++color) {
+ if (blend_type) {
+ int blended = bNonseparableBlend
+ ? blended_colors[color]
+ : Blend(blend_type, *dest_scan, *src_scan);
+ blended = FXDIB_ALPHA_MERGE(*src_scan, blended, back_alpha);
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alpha_ratio);
+ } else {
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, *src_scan, alpha_ratio);
+ }
+ ++dest_scan;
+ ++src_scan;
+ }
+ if (!has_dest)
+ ++dest_scan;
+ if (!has_src)
+ ++src_scan;
+ }
+}
+
+void CompositeRow_Rgb2Argb_Blend_NoClip(uint8_t* dest_scan,
+ const uint8_t* src_scan,
+ int width,
+ int blend_type,
+ int src_Bpp,
+ uint8_t* dest_alpha_scan) {
+ int blended_colors[3];
+ bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
+ int src_gap = src_Bpp - 3;
+ for (int col = 0; col < width; ++col) {
+ uint8_t* dest_alpha = dest_alpha_scan ? dest_alpha_scan : &dest_scan[3];
+ uint8_t back_alpha = *dest_alpha;
+ if (back_alpha == 0) {
+ if (dest_alpha_scan) {
+ for (int i = 0; i < 3; ++i) {
+ *dest_scan = *src_scan++;
+ ++dest_scan;
+ }
+ *dest_alpha_scan = 0xff;
+ ++dest_alpha_scan;
+ } else {
+ if (src_Bpp == 4) {
+ FXARGB_SETDIB(dest_scan, 0xff000000 | FXARGB_GETDIB(src_scan));
+ } else {
+ FXARGB_SETDIB(dest_scan, FXARGB_MAKE(0xff, src_scan[2], src_scan[1],
+ src_scan[0]));
+ }
+ dest_scan += 4;
+ }
+ src_scan += src_Bpp;
+ continue;
+ }
+ *dest_alpha = 0xff;
+ if (bNonseparableBlend)
+ RGB_Blend(blend_type, src_scan, dest_scan, blended_colors);
+ for (int color = 0; color < 3; ++color) {
+ int src_color = *src_scan;
+ int blended = bNonseparableBlend
+ ? blended_colors[color]
+ : Blend(blend_type, *dest_scan, src_color);
+ *dest_scan = FXDIB_ALPHA_MERGE(src_color, blended, back_alpha);
+ ++dest_scan;
+ ++src_scan;
+ }
+ if (dest_alpha_scan)
+ ++dest_alpha_scan;
+ else
+ ++dest_scan;
+ src_scan += src_gap;
+ }
+}
+
+void CompositeRow_Rgb2Argb_Blend_Clip(uint8_t* dest_scan,
+ const uint8_t* src_scan,
+ int width,
+ int blend_type,
+ int src_Bpp,
+ const uint8_t* clip_scan,
+ uint8_t* dest_alpha_scan) {
+ int blended_colors[3];
+ bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
+ int src_gap = src_Bpp - 3;
+ bool has_dest = !!dest_alpha_scan;
+ for (int col = 0; col < width; ++col) {
+ int src_alpha = *clip_scan++;
+ uint8_t back_alpha = has_dest ? *dest_alpha_scan : dest_scan[3];
+ if (back_alpha == 0) {
+ for (int i = 0; i < 3; ++i) {
+ *dest_scan = *src_scan++;
+ ++dest_scan;
+ }
+ src_scan += src_gap;
+ if (has_dest)
+ dest_alpha_scan++;
+ else
+ dest_scan++;
+ continue;
+ }
+ if (src_alpha == 0) {
+ dest_scan += has_dest ? 3 : 4;
+ if (has_dest)
+ dest_alpha_scan++;
+ src_scan += src_Bpp;
+ continue;
+ }
+ uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255;
+ if (has_dest)
+ *dest_alpha_scan++ = dest_alpha;
+ else
+ dest_scan[3] = dest_alpha;
+ int alpha_ratio = src_alpha * 255 / dest_alpha;
+ if (bNonseparableBlend)
+ RGB_Blend(blend_type, src_scan, dest_scan, blended_colors);
+ for (int color = 0; color < 3; color++) {
+ int src_color = *src_scan;
+ int blended = bNonseparableBlend
+ ? blended_colors[color]
+ : Blend(blend_type, *dest_scan, src_color);
+ blended = FXDIB_ALPHA_MERGE(src_color, blended, back_alpha);
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alpha_ratio);
+ dest_scan++;
+ src_scan++;
+ }
+ src_scan += src_gap;
+ if (!has_dest)
+ dest_scan++;
+ }
+}
+
+void CompositeRow_Rgb2Argb_NoBlend_Clip(uint8_t* dest_scan,
+ const uint8_t* src_scan,
+ int width,
+ int src_Bpp,
+ const uint8_t* clip_scan,
+ uint8_t* dest_alpha_scan) {
+ int src_gap = src_Bpp - 3;
+ if (dest_alpha_scan) {
+ for (int col = 0; col < width; col++) {
+ int src_alpha = clip_scan[col];
+ if (src_alpha == 255) {
+ *dest_scan++ = *src_scan++;
+ *dest_scan++ = *src_scan++;
+ *dest_scan++ = *src_scan++;
+ *dest_alpha_scan++ = 255;
+ src_scan += src_gap;
+ continue;
+ }
+ if (src_alpha == 0) {
+ dest_scan += 3;
+ dest_alpha_scan++;
+ src_scan += src_Bpp;
+ continue;
+ }
+ int back_alpha = *dest_alpha_scan;
+ uint8_t dest_alpha =
+ back_alpha + src_alpha - back_alpha * src_alpha / 255;
+ *dest_alpha_scan++ = dest_alpha;
+ int alpha_ratio = src_alpha * 255 / dest_alpha;
+ for (int color = 0; color < 3; color++) {
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, *src_scan, alpha_ratio);
+ dest_scan++;
+ src_scan++;
+ }
+ src_scan += src_gap;
+ }
+ } else {
+ for (int col = 0; col < width; col++) {
+ int src_alpha = clip_scan[col];
+ if (src_alpha == 255) {
+ *dest_scan++ = *src_scan++;
+ *dest_scan++ = *src_scan++;
+ *dest_scan++ = *src_scan++;
+ *dest_scan++ = 255;
+ src_scan += src_gap;
+ continue;
+ }
+ if (src_alpha == 0) {
+ dest_scan += 4;
+ src_scan += src_Bpp;
+ continue;
+ }
+ int back_alpha = dest_scan[3];
+ uint8_t dest_alpha =
+ back_alpha + src_alpha - back_alpha * src_alpha / 255;
+ dest_scan[3] = dest_alpha;
+ int alpha_ratio = src_alpha * 255 / dest_alpha;
+ for (int color = 0; color < 3; color++) {
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, *src_scan, alpha_ratio);
+ dest_scan++;
+ src_scan++;
+ }
+ dest_scan++;
+ src_scan += src_gap;
+ }
+ }
+}
+
+void CompositeRow_Rgb2Argb_NoBlend_NoClip(uint8_t* dest_scan,
+ const uint8_t* src_scan,
+ int width,
+ int src_Bpp,
+ uint8_t* dest_alpha_scan) {
+ if (dest_alpha_scan) {
+ int src_gap = src_Bpp - 3;
+ for (int col = 0; col < width; col++) {
+ *dest_scan++ = *src_scan++;
+ *dest_scan++ = *src_scan++;
+ *dest_scan++ = *src_scan++;
+ *dest_alpha_scan++ = 0xff;
+ src_scan += src_gap;
+ }
+ } else {
+ for (int col = 0; col < width; col++) {
+ if (src_Bpp == 4) {
+ FXARGB_SETDIB(dest_scan, 0xff000000 | FXARGB_GETDIB(src_scan));
+ } else {
+ FXARGB_SETDIB(dest_scan,
+ FXARGB_MAKE(0xff, src_scan[2], src_scan[1], src_scan[0]));
+ }
+ dest_scan += 4;
+ src_scan += src_Bpp;
+ }
+ }
+}
+
+void CompositeRow_Argb2Rgb_Blend(uint8_t* dest_scan,
+ const uint8_t* src_scan,
+ int width,
+ int blend_type,
+ int dest_Bpp,
+ const uint8_t* clip_scan,
+ const uint8_t* src_alpha_scan) {
+ int blended_colors[3];
+ bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
+ int dest_gap = dest_Bpp - 3;
+ if (src_alpha_scan) {
+ for (int col = 0; col < width; col++) {
+ uint8_t src_alpha;
+ if (clip_scan) {
+ src_alpha = (*src_alpha_scan++) * (*clip_scan++) / 255;
+ } else {
+ src_alpha = *src_alpha_scan++;
+ }
+ if (src_alpha == 0) {
+ dest_scan += dest_Bpp;
+ src_scan += 3;
+ continue;
+ }
+ if (bNonseparableBlend) {
+ RGB_Blend(blend_type, src_scan, dest_scan, blended_colors);
+ }
+ for (int color = 0; color < 3; color++) {
+ int back_color = *dest_scan;
+ int blended = bNonseparableBlend
+ ? blended_colors[color]
+ : Blend(blend_type, back_color, *src_scan);
+ *dest_scan = FXDIB_ALPHA_MERGE(back_color, blended, src_alpha);
+ dest_scan++;
+ src_scan++;
+ }
+ dest_scan += dest_gap;
+ }
+ } else {
+ for (int col = 0; col < width; col++) {
+ uint8_t src_alpha;
+ if (clip_scan) {
+ src_alpha = src_scan[3] * (*clip_scan++) / 255;
+ } else {
+ src_alpha = src_scan[3];
+ }
+ if (src_alpha == 0) {
+ dest_scan += dest_Bpp;
+ src_scan += 4;
+ continue;
+ }
+ if (bNonseparableBlend) {
+ RGB_Blend(blend_type, src_scan, dest_scan, blended_colors);
+ }
+ for (int color = 0; color < 3; color++) {
+ int back_color = *dest_scan;
+ int blended = bNonseparableBlend
+ ? blended_colors[color]
+ : Blend(blend_type, back_color, *src_scan);
+ *dest_scan = FXDIB_ALPHA_MERGE(back_color, blended, src_alpha);
+ dest_scan++;
+ src_scan++;
+ }
+ dest_scan += dest_gap;
+ src_scan++;
+ }
+ }
+}
+
+void CompositeRow_Argb2Rgb_NoBlend(uint8_t* dest_scan,
+ const uint8_t* src_scan,
+ int width,
+ int dest_Bpp,
+ const uint8_t* clip_scan,
+ const uint8_t* src_alpha_scan) {
+ int dest_gap = dest_Bpp - 3;
+ if (src_alpha_scan) {
+ for (int col = 0; col < width; col++) {
+ uint8_t src_alpha;
+ if (clip_scan) {
+ src_alpha = (*src_alpha_scan++) * (*clip_scan++) / 255;
+ } else {
+ src_alpha = *src_alpha_scan++;
+ }
+ if (src_alpha == 255) {
+ *dest_scan++ = *src_scan++;
+ *dest_scan++ = *src_scan++;
+ *dest_scan++ = *src_scan++;
+ dest_scan += dest_gap;
+ continue;
+ }
+ if (src_alpha == 0) {
+ dest_scan += dest_Bpp;
+ src_scan += 3;
+ continue;
+ }
+ for (int color = 0; color < 3; color++) {
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, *src_scan, src_alpha);
+ dest_scan++;
+ src_scan++;
+ }
+ dest_scan += dest_gap;
+ }
+ } else {
+ for (int col = 0; col < width; col++) {
+ uint8_t src_alpha;
+ if (clip_scan) {
+ src_alpha = src_scan[3] * (*clip_scan++) / 255;
+ } else {
+ src_alpha = src_scan[3];
+ }
+ if (src_alpha == 255) {
+ *dest_scan++ = *src_scan++;
+ *dest_scan++ = *src_scan++;
+ *dest_scan++ = *src_scan++;
+ dest_scan += dest_gap;
+ src_scan++;
+ continue;
+ }
+ if (src_alpha == 0) {
+ dest_scan += dest_Bpp;
+ src_scan += 4;
+ continue;
+ }
+ for (int color = 0; color < 3; color++) {
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, *src_scan, src_alpha);
+ dest_scan++;
+ src_scan++;
+ }
+ dest_scan += dest_gap;
+ src_scan++;
+ }
+ }
+}
+
+void CompositeRow_Rgb2Rgb_Blend_NoClip(uint8_t* dest_scan,
+ const uint8_t* src_scan,
+ int width,
+ int blend_type,
+ int dest_Bpp,
+ int src_Bpp) {
+ int blended_colors[3];
+ bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
+ int dest_gap = dest_Bpp - 3;
+ int src_gap = src_Bpp - 3;
+ for (int col = 0; col < width; col++) {
+ if (bNonseparableBlend) {
+ RGB_Blend(blend_type, src_scan, dest_scan, blended_colors);
+ }
+ for (int color = 0; color < 3; color++) {
+ int back_color = *dest_scan;
+ int src_color = *src_scan;
+ int blended = bNonseparableBlend
+ ? blended_colors[color]
+ : Blend(blend_type, back_color, src_color);
+ *dest_scan = blended;
+ dest_scan++;
+ src_scan++;
+ }
+ dest_scan += dest_gap;
+ src_scan += src_gap;
+ }
+}
+
+void CompositeRow_Rgb2Rgb_Blend_Clip(uint8_t* dest_scan,
+ const uint8_t* src_scan,
+ int width,
+ int blend_type,
+ int dest_Bpp,
+ int src_Bpp,
+ const uint8_t* clip_scan) {
+ int blended_colors[3];
+ bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
+ int dest_gap = dest_Bpp - 3;
+ int src_gap = src_Bpp - 3;
+ for (int col = 0; col < width; col++) {
+ uint8_t src_alpha = *clip_scan++;
+ if (src_alpha == 0) {
+ dest_scan += dest_Bpp;
+ src_scan += src_Bpp;
+ continue;
+ }
+ if (bNonseparableBlend) {
+ RGB_Blend(blend_type, src_scan, dest_scan, blended_colors);
+ }
+ for (int color = 0; color < 3; color++) {
+ int src_color = *src_scan;
+ int back_color = *dest_scan;
+ int blended = bNonseparableBlend
+ ? blended_colors[color]
+ : Blend(blend_type, back_color, src_color);
+ *dest_scan = FXDIB_ALPHA_MERGE(back_color, blended, src_alpha);
+ dest_scan++;
+ src_scan++;
+ }
+ dest_scan += dest_gap;
+ src_scan += src_gap;
+ }
+}
+
+void CompositeRow_Rgb2Rgb_NoBlend_NoClip(uint8_t* dest_scan,
+ const uint8_t* src_scan,
+ int width,
+ int dest_Bpp,
+ int src_Bpp) {
+ if (dest_Bpp == src_Bpp) {
+ memcpy(dest_scan, src_scan, width * dest_Bpp);
+ return;
+ }
+ for (int col = 0; col < width; col++) {
+ dest_scan[0] = src_scan[0];
+ dest_scan[1] = src_scan[1];
+ dest_scan[2] = src_scan[2];
+ dest_scan += dest_Bpp;
+ src_scan += src_Bpp;
+ }
+}
+
+void CompositeRow_Rgb2Rgb_NoBlend_Clip(uint8_t* dest_scan,
+ const uint8_t* src_scan,
+ int width,
+ int dest_Bpp,
+ int src_Bpp,
+ const uint8_t* clip_scan) {
+ for (int col = 0; col < width; col++) {
+ int src_alpha = clip_scan[col];
+ if (src_alpha == 255) {
+ dest_scan[0] = src_scan[0];
+ dest_scan[1] = src_scan[1];
+ dest_scan[2] = src_scan[2];
+ } else if (src_alpha) {
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, *src_scan, src_alpha);
+ dest_scan++;
+ src_scan++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, *src_scan, src_alpha);
+ dest_scan++;
+ src_scan++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, *src_scan, src_alpha);
+ dest_scan += dest_Bpp - 2;
+ src_scan += src_Bpp - 2;
+ continue;
+ }
+ dest_scan += dest_Bpp;
+ src_scan += src_Bpp;
+ }
+}
+
+void CompositeRow_8bppPal2Gray(uint8_t* dest_scan,
+ const uint8_t* src_scan,
+ const uint8_t* pPalette,
+ int pixel_count,
+ int blend_type,
+ const uint8_t* clip_scan,
+ const uint8_t* src_alpha_scan) {
+ if (src_alpha_scan) {
+ if (blend_type) {
+ bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
+ for (int col = 0; col < pixel_count; col++) {
+ uint8_t gray = pPalette[*src_scan];
+ int src_alpha = GetAlpha(*src_alpha_scan++, clip_scan, col);
+ if (bNonseparableBlend)
+ gray = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan;
+ else
+ gray = Blend(blend_type, *dest_scan, gray);
+ if (src_alpha)
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, src_alpha);
+ else
+ *dest_scan = gray;
+ dest_scan++;
+ src_scan++;
+ }
+ return;
+ }
+ for (int col = 0; col < pixel_count; col++) {
+ uint8_t gray = pPalette[*src_scan];
+ int src_alpha = GetAlpha(*src_alpha_scan++, clip_scan, col);
+ if (src_alpha)
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, src_alpha);
+ else
+ *dest_scan = gray;
+ dest_scan++;
+ src_scan++;
+ }
+ } else {
+ if (blend_type) {
+ bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
+ for (int col = 0; col < pixel_count; col++) {
+ uint8_t gray = pPalette[*src_scan];
+ if (bNonseparableBlend)
+ gray = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan;
+ else
+ gray = Blend(blend_type, *dest_scan, gray);
+ if (clip_scan && clip_scan[col] < 255)
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, clip_scan[col]);
+ else
+ *dest_scan = gray;
+ dest_scan++;
+ src_scan++;
+ }
+ return;
+ }
+ for (int col = 0; col < pixel_count; col++) {
+ uint8_t gray = pPalette[*src_scan];
+ if (clip_scan && clip_scan[col] < 255)
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, clip_scan[col]);
+ else
+ *dest_scan = gray;
+ dest_scan++;
+ src_scan++;
+ }
+ }
+}
+
+void CompositeRow_8bppPal2Graya(uint8_t* dest_scan,
+ const uint8_t* src_scan,
+ const uint8_t* pPalette,
+ int pixel_count,
+ int blend_type,
+ const uint8_t* clip_scan,
+ uint8_t* dest_alpha_scan,
+ const uint8_t* src_alpha_scan) {
+ if (src_alpha_scan) {
+ if (blend_type) {
+ bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
+ for (int col = 0; col < pixel_count; col++) {
+ uint8_t gray = pPalette[*src_scan];
+ src_scan++;
+ uint8_t back_alpha = *dest_alpha_scan;
+ if (back_alpha == 0) {
+ int src_alpha = GetAlpha(*src_alpha_scan++, clip_scan, col);
+ if (src_alpha) {
+ *dest_scan = gray;
+ *dest_alpha_scan = src_alpha;
+ }
+ dest_scan++;
+ dest_alpha_scan++;
+ continue;
+ }
+ uint8_t src_alpha = GetAlpha(*src_alpha_scan++, clip_scan, col);
+ if (src_alpha == 0) {
+ dest_scan++;
+ dest_alpha_scan++;
+ continue;
+ }
+ *dest_alpha_scan =
+ back_alpha + src_alpha - back_alpha * src_alpha / 255;
+ int alpha_ratio = src_alpha * 255 / (*dest_alpha_scan);
+ if (bNonseparableBlend)
+ gray = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan;
+ else
+ gray = Blend(blend_type, *dest_scan, gray);
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio);
+ dest_alpha_scan++;
+ dest_scan++;
+ }
+ return;
+ }
+ for (int col = 0; col < pixel_count; col++) {
+ uint8_t gray = pPalette[*src_scan];
+ src_scan++;
+ uint8_t back_alpha = *dest_alpha_scan;
+ if (back_alpha == 0) {
+ int src_alpha = GetAlpha(*src_alpha_scan++, clip_scan, col);
+ if (src_alpha) {
+ *dest_scan = gray;
+ *dest_alpha_scan = src_alpha;
+ }
+ dest_scan++;
+ dest_alpha_scan++;
+ continue;
+ }
+ uint8_t src_alpha = GetAlpha(*src_alpha_scan++, clip_scan, col);
+ if (src_alpha == 0) {
+ dest_scan++;
+ dest_alpha_scan++;
+ continue;
+ }
+ *dest_alpha_scan = back_alpha + src_alpha - back_alpha * src_alpha / 255;
+ int alpha_ratio = src_alpha * 255 / (*dest_alpha_scan);
+ dest_alpha_scan++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio);
+ dest_scan++;
+ }
+ } else {
+ if (blend_type) {
+ bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
+ for (int col = 0; col < pixel_count; col++) {
+ uint8_t gray = pPalette[*src_scan];
+ src_scan++;
+ if (!clip_scan || clip_scan[col] == 255) {
+ *dest_scan++ = gray;
+ *dest_alpha_scan++ = 255;
+ continue;
+ }
+ int src_alpha = clip_scan[col];
+ if (src_alpha == 0) {
+ dest_scan++;
+ dest_alpha_scan++;
+ continue;
+ }
+ int back_alpha = *dest_alpha_scan;
+ uint8_t dest_alpha =
+ back_alpha + src_alpha - back_alpha * src_alpha / 255;
+ *dest_alpha_scan++ = dest_alpha;
+ int alpha_ratio = src_alpha * 255 / dest_alpha;
+ if (bNonseparableBlend)
+ gray = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan;
+ else
+ gray = Blend(blend_type, *dest_scan, gray);
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio);
+ dest_scan++;
+ }
+ return;
+ }
+ for (int col = 0; col < pixel_count; col++) {
+ uint8_t gray = pPalette[*src_scan];
+ src_scan++;
+ if (!clip_scan || clip_scan[col] == 255) {
+ *dest_scan++ = gray;
+ *dest_alpha_scan++ = 255;
+ continue;
+ }
+ int src_alpha = clip_scan[col];
+ if (src_alpha == 0) {
+ dest_scan++;
+ dest_alpha_scan++;
+ continue;
+ }
+ int back_alpha = *dest_alpha_scan;
+ uint8_t dest_alpha =
+ back_alpha + src_alpha - back_alpha * src_alpha / 255;
+ *dest_alpha_scan++ = dest_alpha;
+ int alpha_ratio = src_alpha * 255 / dest_alpha;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio);
+ dest_scan++;
+ }
+ }
+}
+
+void CompositeRow_1bppPal2Gray(uint8_t* dest_scan,
+ const uint8_t* src_scan,
+ int src_left,
+ const uint8_t* pPalette,
+ int pixel_count,
+ int blend_type,
+ const uint8_t* clip_scan) {
+ int reset_gray = pPalette[0];
+ int set_gray = pPalette[1];
+ if (blend_type) {
+ bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
+ for (int col = 0; col < pixel_count; col++) {
+ uint8_t gray =
+ (src_scan[(col + src_left) / 8] & (1 << (7 - (col + src_left) % 8)))
+ ? set_gray
+ : reset_gray;
+ if (bNonseparableBlend)
+ gray = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan;
+ else
+ gray = Blend(blend_type, *dest_scan, gray);
+ if (clip_scan && clip_scan[col] < 255) {
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, clip_scan[col]);
+ } else {
+ *dest_scan = gray;
+ }
+ dest_scan++;
+ }
+ return;
+ }
+ for (int col = 0; col < pixel_count; col++) {
+ uint8_t gray =
+ (src_scan[(col + src_left) / 8] & (1 << (7 - (col + src_left) % 8)))
+ ? set_gray
+ : reset_gray;
+ if (clip_scan && clip_scan[col] < 255) {
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, clip_scan[col]);
+ } else {
+ *dest_scan = gray;
+ }
+ dest_scan++;
+ }
+}
+
+void CompositeRow_1bppPal2Graya(uint8_t* dest_scan,
+ const uint8_t* src_scan,
+ int src_left,
+ const uint8_t* pPalette,
+ int pixel_count,
+ int blend_type,
+ const uint8_t* clip_scan,
+ uint8_t* dest_alpha_scan) {
+ int reset_gray = pPalette[0];
+ int set_gray = pPalette[1];
+ if (blend_type) {
+ bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
+ for (int col = 0; col < pixel_count; col++) {
+ uint8_t gray =
+ (src_scan[(col + src_left) / 8] & (1 << (7 - (col + src_left) % 8)))
+ ? set_gray
+ : reset_gray;
+ if (!clip_scan || clip_scan[col] == 255) {
+ *dest_scan++ = gray;
+ *dest_alpha_scan++ = 255;
+ continue;
+ }
+ int src_alpha = clip_scan[col];
+ if (src_alpha == 0) {
+ dest_scan++;
+ dest_alpha_scan++;
+ continue;
+ }
+ int back_alpha = *dest_alpha_scan;
+ uint8_t dest_alpha =
+ back_alpha + src_alpha - back_alpha * src_alpha / 255;
+ *dest_alpha_scan++ = dest_alpha;
+ int alpha_ratio = src_alpha * 255 / dest_alpha;
+ if (bNonseparableBlend)
+ gray = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan;
+ else
+ gray = Blend(blend_type, *dest_scan, gray);
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio);
+ dest_scan++;
+ }
+ return;
+ }
+ for (int col = 0; col < pixel_count; col++) {
+ uint8_t gray =
+ (src_scan[(col + src_left) / 8] & (1 << (7 - (col + src_left) % 8)))
+ ? set_gray
+ : reset_gray;
+ if (!clip_scan || clip_scan[col] == 255) {
+ *dest_scan++ = gray;
+ *dest_alpha_scan++ = 255;
+ continue;
+ }
+ int src_alpha = clip_scan[col];
+ if (src_alpha == 0) {
+ dest_scan++;
+ dest_alpha_scan++;
+ continue;
+ }
+ int back_alpha = *dest_alpha_scan;
+ uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255;
+ *dest_alpha_scan++ = dest_alpha;
+ int alpha_ratio = src_alpha * 255 / dest_alpha;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio);
+ dest_scan++;
+ }
+}
+
+void CompositeRow_8bppRgb2Rgb_NoBlend(uint8_t* dest_scan,
+ const uint8_t* src_scan,
+ uint32_t* pPalette,
+ int pixel_count,
+ int DestBpp,
+ const uint8_t* clip_scan,
+ const uint8_t* src_alpha_scan) {
+ if (src_alpha_scan) {
+ int dest_gap = DestBpp - 3;
+ FX_ARGB argb = 0;
+ for (int col = 0; col < pixel_count; col++) {
+ argb = pPalette[*src_scan];
+ int src_r = FXARGB_R(argb);
+ int src_g = FXARGB_G(argb);
+ int src_b = FXARGB_B(argb);
+ src_scan++;
+ uint8_t src_alpha = 0;
+ if (clip_scan) {
+ src_alpha = (*src_alpha_scan++) * (*clip_scan++) / 255;
+ } else {
+ src_alpha = *src_alpha_scan++;
+ }
+ if (src_alpha == 255) {
+ *dest_scan++ = src_b;
+ *dest_scan++ = src_g;
+ *dest_scan++ = src_r;
+ dest_scan += dest_gap;
+ continue;
+ }
+ if (src_alpha == 0) {
+ dest_scan += DestBpp;
+ continue;
+ }
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, src_alpha);
+ dest_scan++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, src_alpha);
+ dest_scan++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, src_alpha);
+ dest_scan++;
+ dest_scan += dest_gap;
+ }
+ } else {
+ FX_ARGB argb = 0;
+ for (int col = 0; col < pixel_count; col++) {
+ argb = pPalette[*src_scan];
+ int src_r = FXARGB_R(argb);
+ int src_g = FXARGB_G(argb);
+ int src_b = FXARGB_B(argb);
+ if (clip_scan && clip_scan[col] < 255) {
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, clip_scan[col]);
+ dest_scan++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, clip_scan[col]);
+ dest_scan++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, clip_scan[col]);
+ dest_scan++;
+ } else {
+ *dest_scan++ = src_b;
+ *dest_scan++ = src_g;
+ *dest_scan++ = src_r;
+ }
+ if (DestBpp == 4) {
+ dest_scan++;
+ }
+ src_scan++;
+ }
+ }
+}
+
+void CompositeRow_1bppRgb2Rgb_NoBlend(uint8_t* dest_scan,
+ const uint8_t* src_scan,
+ int src_left,
+ uint32_t* pPalette,
+ int pixel_count,
+ int DestBpp,
+ const uint8_t* clip_scan) {
+ int reset_r, reset_g, reset_b;
+ int set_r, set_g, set_b;
+ reset_r = FXARGB_R(pPalette[0]);
+ reset_g = FXARGB_G(pPalette[0]);
+ reset_b = FXARGB_B(pPalette[0]);
+ set_r = FXARGB_R(pPalette[1]);
+ set_g = FXARGB_G(pPalette[1]);
+ set_b = FXARGB_B(pPalette[1]);
+ for (int col = 0; col < pixel_count; col++) {
+ int src_r, src_g, src_b;
+ if (src_scan[(col + src_left) / 8] & (1 << (7 - (col + src_left) % 8))) {
+ src_r = set_r;
+ src_g = set_g;
+ src_b = set_b;
+ } else {
+ src_r = reset_r;
+ src_g = reset_g;
+ src_b = reset_b;
+ }
+ if (clip_scan && clip_scan[col] < 255) {
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, clip_scan[col]);
+ dest_scan++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, clip_scan[col]);
+ dest_scan++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, clip_scan[col]);
+ dest_scan++;
+ } else {
+ *dest_scan++ = src_b;
+ *dest_scan++ = src_g;
+ *dest_scan++ = src_r;
+ }
+ if (DestBpp == 4) {
+ dest_scan++;
+ }
+ }
+}
+
+void CompositeRow_8bppRgb2Argb_NoBlend(uint8_t* dest_scan,
+ const uint8_t* src_scan,
+ int width,
+ uint32_t* pPalette,
+ const uint8_t* clip_scan,
+ const uint8_t* src_alpha_scan) {
+ if (src_alpha_scan) {
+ for (int col = 0; col < width; col++) {
+ FX_ARGB argb = pPalette[*src_scan];
+ src_scan++;
+ int src_r = FXARGB_R(argb);
+ int src_g = FXARGB_G(argb);
+ int src_b = FXARGB_B(argb);
+ uint8_t back_alpha = dest_scan[3];
+ if (back_alpha == 0) {
+ if (clip_scan) {
+ int src_alpha = clip_scan[col] * (*src_alpha_scan) / 255;
+ FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alpha, src_r, src_g, src_b));
+ } else {
+ FXARGB_SETDIB(dest_scan,
+ FXARGB_MAKE(*src_alpha_scan, src_r, src_g, src_b));
+ }
+ dest_scan += 4;
+ src_alpha_scan++;
+ continue;
+ }
+ uint8_t src_alpha;
+ if (clip_scan) {
+ src_alpha = clip_scan[col] * (*src_alpha_scan++) / 255;
+ } else {
+ src_alpha = *src_alpha_scan++;
+ }
+ if (src_alpha == 0) {
+ dest_scan += 4;
+ continue;
+ }
+ uint8_t dest_alpha =
+ back_alpha + src_alpha - back_alpha * src_alpha / 255;
+ dest_scan[3] = dest_alpha;
+ int alpha_ratio = src_alpha * 255 / dest_alpha;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio);
+ dest_scan++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, alpha_ratio);
+ dest_scan++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, alpha_ratio);
+ dest_scan++;
+ dest_scan++;
+ }
+ } else {
+ for (int col = 0; col < width; col++) {
+ FX_ARGB argb = pPalette[*src_scan];
+ int src_r = FXARGB_R(argb);
+ int src_g = FXARGB_G(argb);
+ int src_b = FXARGB_B(argb);
+ if (!clip_scan || clip_scan[col] == 255) {
+ *dest_scan++ = src_b;
+ *dest_scan++ = src_g;
+ *dest_scan++ = src_r;
+ *dest_scan++ = 255;
+ src_scan++;
+ continue;
+ }
+ int src_alpha = clip_scan[col];
+ if (src_alpha == 0) {
+ dest_scan += 4;
+ src_scan++;
+ continue;
+ }
+ int back_alpha = dest_scan[3];
+ uint8_t dest_alpha =
+ back_alpha + src_alpha - back_alpha * src_alpha / 255;
+ dest_scan[3] = dest_alpha;
+ int alpha_ratio = src_alpha * 255 / dest_alpha;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio);
+ dest_scan++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, alpha_ratio);
+ dest_scan++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, alpha_ratio);
+ dest_scan++;
+ dest_scan++;
+ src_scan++;
+ }
+ }
+}
+
+void CompositeRow_1bppRgb2Argb_NoBlend(uint8_t* dest_scan,
+ const uint8_t* src_scan,
+ int src_left,
+ int width,
+ uint32_t* pPalette,
+ const uint8_t* clip_scan) {
+ int reset_r, reset_g, reset_b;
+ int set_r, set_g, set_b;
+ reset_r = FXARGB_R(pPalette[0]);
+ reset_g = FXARGB_G(pPalette[0]);
+ reset_b = FXARGB_B(pPalette[0]);
+ set_r = FXARGB_R(pPalette[1]);
+ set_g = FXARGB_G(pPalette[1]);
+ set_b = FXARGB_B(pPalette[1]);
+ for (int col = 0; col < width; col++) {
+ int src_r, src_g, src_b;
+ if (src_scan[(col + src_left) / 8] & (1 << (7 - (col + src_left) % 8))) {
+ src_r = set_r;
+ src_g = set_g;
+ src_b = set_b;
+ } else {
+ src_r = reset_r;
+ src_g = reset_g;
+ src_b = reset_b;
+ }
+ if (!clip_scan || clip_scan[col] == 255) {
+ *dest_scan++ = src_b;
+ *dest_scan++ = src_g;
+ *dest_scan++ = src_r;
+ *dest_scan++ = 255;
+ continue;
+ }
+ int src_alpha = clip_scan[col];
+ if (src_alpha == 0) {
+ dest_scan += 4;
+ continue;
+ }
+ int back_alpha = dest_scan[3];
+ uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255;
+ dest_scan[3] = dest_alpha;
+ int alpha_ratio = src_alpha * 255 / dest_alpha;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio);
+ dest_scan++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, alpha_ratio);
+ dest_scan++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, alpha_ratio);
+ dest_scan++;
+ dest_scan++;
+ }
+}
+
+void CompositeRow_1bppRgb2Rgba_NoBlend(uint8_t* dest_scan,
+ const uint8_t* src_scan,
+ int src_left,
+ int width,
+ uint32_t* pPalette,
+ const uint8_t* clip_scan,
+ uint8_t* dest_alpha_scan) {
+ int reset_r, reset_g, reset_b;
+ int set_r, set_g, set_b;
+ reset_r = FXARGB_R(pPalette[0]);
+ reset_g = FXARGB_G(pPalette[0]);
+ reset_b = FXARGB_B(pPalette[0]);
+ set_r = FXARGB_R(pPalette[1]);
+ set_g = FXARGB_G(pPalette[1]);
+ set_b = FXARGB_B(pPalette[1]);
+ for (int col = 0; col < width; col++) {
+ int src_r, src_g, src_b;
+ if (src_scan[(col + src_left) / 8] & (1 << (7 - (col + src_left) % 8))) {
+ src_r = set_r;
+ src_g = set_g;
+ src_b = set_b;
+ } else {
+ src_r = reset_r;
+ src_g = reset_g;
+ src_b = reset_b;
+ }
+ if (!clip_scan || clip_scan[col] == 255) {
+ *dest_scan++ = src_b;
+ *dest_scan++ = src_g;
+ *dest_scan++ = src_r;
+ *dest_alpha_scan++ = 255;
+ continue;
+ }
+ int src_alpha = clip_scan[col];
+ if (src_alpha == 0) {
+ dest_scan += 3;
+ dest_alpha_scan++;
+ continue;
+ }
+ int back_alpha = *dest_alpha_scan;
+ uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255;
+ *dest_alpha_scan++ = dest_alpha;
+ int alpha_ratio = src_alpha * 255 / dest_alpha;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio);
+ dest_scan++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, alpha_ratio);
+ dest_scan++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, alpha_ratio);
+ dest_scan++;
+ }
+}
+
+void CompositeRow_ByteMask2Argb(uint8_t* dest_scan,
+ const uint8_t* src_scan,
+ int mask_alpha,
+ int src_r,
+ int src_g,
+ int src_b,
+ int pixel_count,
+ int blend_type,
+ const uint8_t* clip_scan) {
+ for (int col = 0; col < pixel_count; col++) {
+ int src_alpha;
+ if (clip_scan) {
+ src_alpha = mask_alpha * clip_scan[col] * src_scan[col] / 255 / 255;
+ } else {
+ src_alpha = mask_alpha * src_scan[col] / 255;
+ }
+ uint8_t back_alpha = dest_scan[3];
+ if (back_alpha == 0) {
+ FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alpha, src_r, src_g, src_b));
+ dest_scan += 4;
+ continue;
+ }
+ if (src_alpha == 0) {
+ dest_scan += 4;
+ continue;
+ }
+ uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255;
+ dest_scan[3] = dest_alpha;
+ int alpha_ratio = src_alpha * 255 / dest_alpha;
+ if (blend_type >= FXDIB_BLEND_NONSEPARABLE) {
+ int blended_colors[3];
+ uint8_t scan[3] = {static_cast<uint8_t>(src_b),
+ static_cast<uint8_t>(src_g),
+ static_cast<uint8_t>(src_r)};
+ RGB_Blend(blend_type, scan, dest_scan, blended_colors);
+ *dest_scan =
+ FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[0], alpha_ratio);
+ dest_scan++;
+ *dest_scan =
+ FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[1], alpha_ratio);
+ dest_scan++;
+ *dest_scan =
+ FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[2], alpha_ratio);
+ } else if (blend_type) {
+ int blended = Blend(blend_type, *dest_scan, src_b);
+ blended = FXDIB_ALPHA_MERGE(src_b, blended, back_alpha);
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alpha_ratio);
+ dest_scan++;
+ blended = Blend(blend_type, *dest_scan, src_g);
+ blended = FXDIB_ALPHA_MERGE(src_g, blended, back_alpha);
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alpha_ratio);
+ dest_scan++;
+ blended = Blend(blend_type, *dest_scan, src_r);
+ blended = FXDIB_ALPHA_MERGE(src_r, blended, back_alpha);
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alpha_ratio);
+ } else {
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio);
+ dest_scan++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, alpha_ratio);
+ dest_scan++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, alpha_ratio);
+ }
+ dest_scan += 2;
+ }
+}
+
+void CompositeRow_ByteMask2Rgba(uint8_t* dest_scan,
+ const uint8_t* src_scan,
+ int mask_alpha,
+ int src_r,
+ int src_g,
+ int src_b,
+ int pixel_count,
+ int blend_type,
+ const uint8_t* clip_scan,
+ uint8_t* dest_alpha_scan) {
+ for (int col = 0; col < pixel_count; col++) {
+ int src_alpha;
+ if (clip_scan) {
+ src_alpha = mask_alpha * clip_scan[col] * src_scan[col] / 255 / 255;
+ } else {
+ src_alpha = mask_alpha * src_scan[col] / 255;
+ }
+ uint8_t back_alpha = *dest_alpha_scan;
+ if (back_alpha == 0) {
+ *dest_scan++ = src_b;
+ *dest_scan++ = src_g;
+ *dest_scan++ = src_r;
+ *dest_alpha_scan++ = src_alpha;
+ continue;
+ }
+ if (src_alpha == 0) {
+ dest_scan += 3;
+ dest_alpha_scan++;
+ continue;
+ }
+ uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255;
+ *dest_alpha_scan++ = dest_alpha;
+ int alpha_ratio = src_alpha * 255 / dest_alpha;
+ if (blend_type >= FXDIB_BLEND_NONSEPARABLE) {
+ int blended_colors[3];
+ uint8_t scan[3] = {static_cast<uint8_t>(src_b),
+ static_cast<uint8_t>(src_g),
+ static_cast<uint8_t>(src_r)};
+ RGB_Blend(blend_type, scan, dest_scan, blended_colors);
+ *dest_scan =
+ FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[0], alpha_ratio);
+ dest_scan++;
+ *dest_scan =
+ FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[1], alpha_ratio);
+ dest_scan++;
+ *dest_scan =
+ FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[2], alpha_ratio);
+ dest_scan++;
+ } else if (blend_type) {
+ int blended = Blend(blend_type, *dest_scan, src_b);
+ blended = FXDIB_ALPHA_MERGE(src_b, blended, back_alpha);
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alpha_ratio);
+ dest_scan++;
+ blended = Blend(blend_type, *dest_scan, src_g);
+ blended = FXDIB_ALPHA_MERGE(src_g, blended, back_alpha);
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alpha_ratio);
+ dest_scan++;
+ blended = Blend(blend_type, *dest_scan, src_r);
+ blended = FXDIB_ALPHA_MERGE(src_r, blended, back_alpha);
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alpha_ratio);
+ dest_scan++;
+ } else {
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio);
+ dest_scan++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, alpha_ratio);
+ dest_scan++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, alpha_ratio);
+ dest_scan++;
+ }
+ }
+}
+
+void CompositeRow_ByteMask2Rgb(uint8_t* dest_scan,
+ const uint8_t* src_scan,
+ int mask_alpha,
+ int src_r,
+ int src_g,
+ int src_b,
+ int pixel_count,
+ int blend_type,
+ int Bpp,
+ const uint8_t* clip_scan) {
+ for (int col = 0; col < pixel_count; col++) {
+ int src_alpha;
+ if (clip_scan) {
+ src_alpha = mask_alpha * clip_scan[col] * src_scan[col] / 255 / 255;
+ } else {
+ src_alpha = mask_alpha * src_scan[col] / 255;
+ }
+ if (src_alpha == 0) {
+ dest_scan += Bpp;
+ continue;
+ }
+ if (blend_type >= FXDIB_BLEND_NONSEPARABLE) {
+ int blended_colors[3];
+ uint8_t scan[3] = {static_cast<uint8_t>(src_b),
+ static_cast<uint8_t>(src_g),
+ static_cast<uint8_t>(src_r)};
+ RGB_Blend(blend_type, scan, dest_scan, blended_colors);
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[0], src_alpha);
+ dest_scan++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[1], src_alpha);
+ dest_scan++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[2], src_alpha);
+ } else if (blend_type) {
+ int blended = Blend(blend_type, *dest_scan, src_b);
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, src_alpha);
+ dest_scan++;
+ blended = Blend(blend_type, *dest_scan, src_g);
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, src_alpha);
+ dest_scan++;
+ blended = Blend(blend_type, *dest_scan, src_r);
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, src_alpha);
+ } else {
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, src_alpha);
+ dest_scan++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, src_alpha);
+ dest_scan++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, src_alpha);
+ }
+ dest_scan += Bpp - 2;
+ }
+}
+
+void CompositeRow_ByteMask2Mask(uint8_t* dest_scan,
+ const uint8_t* src_scan,
+ int mask_alpha,
+ int pixel_count,
+ const uint8_t* clip_scan) {
+ for (int col = 0; col < pixel_count; col++) {
+ int src_alpha;
+ if (clip_scan) {
+ src_alpha = mask_alpha * clip_scan[col] * src_scan[col] / 255 / 255;
+ } else {
+ src_alpha = mask_alpha * src_scan[col] / 255;
+ }
+ uint8_t back_alpha = *dest_scan;
+ if (!back_alpha) {
+ *dest_scan = src_alpha;
+ } else if (src_alpha) {
+ *dest_scan = back_alpha + src_alpha - back_alpha * src_alpha / 255;
+ }
+ dest_scan++;
+ }
+}
+
+void CompositeRow_ByteMask2Gray(uint8_t* dest_scan,
+ const uint8_t* src_scan,
+ int mask_alpha,
+ int src_gray,
+ int pixel_count,
+ const uint8_t* clip_scan) {
+ for (int col = 0; col < pixel_count; col++) {
+ int src_alpha;
+ if (clip_scan) {
+ src_alpha = mask_alpha * clip_scan[col] * src_scan[col] / 255 / 255;
+ } else {
+ src_alpha = mask_alpha * src_scan[col] / 255;
+ }
+ if (src_alpha) {
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_gray, src_alpha);
+ }
+ dest_scan++;
+ }
+}
+
+void CompositeRow_ByteMask2Graya(uint8_t* dest_scan,
+ const uint8_t* src_scan,
+ int mask_alpha,
+ int src_gray,
+ int pixel_count,
+ const uint8_t* clip_scan,
+ uint8_t* dest_alpha_scan) {
+ for (int col = 0; col < pixel_count; col++) {
+ int src_alpha;
+ if (clip_scan) {
+ src_alpha = mask_alpha * clip_scan[col] * src_scan[col] / 255 / 255;
+ } else {
+ src_alpha = mask_alpha * src_scan[col] / 255;
+ }
+ uint8_t back_alpha = *dest_alpha_scan;
+ if (back_alpha == 0) {
+ *dest_scan++ = src_gray;
+ *dest_alpha_scan++ = src_alpha;
+ continue;
+ }
+ if (src_alpha == 0) {
+ dest_scan++;
+ dest_alpha_scan++;
+ continue;
+ }
+ uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255;
+ *dest_alpha_scan++ = dest_alpha;
+ int alpha_ratio = src_alpha * 255 / dest_alpha;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_gray, alpha_ratio);
+ dest_scan++;
+ }
+}
+
+void CompositeRow_BitMask2Argb(uint8_t* dest_scan,
+ const uint8_t* src_scan,
+ int mask_alpha,
+ int src_r,
+ int src_g,
+ int src_b,
+ int src_left,
+ int pixel_count,
+ int blend_type,
+ const uint8_t* clip_scan) {
+ if (blend_type == FXDIB_BLEND_NORMAL && !clip_scan && mask_alpha == 255) {
+ FX_ARGB argb = FXARGB_MAKE(0xff, src_r, src_g, src_b);
+ for (int col = 0; col < pixel_count; col++) {
+ if (src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8))) {
+ FXARGB_SETDIB(dest_scan, argb);
+ }
+ dest_scan += 4;
+ }
+ return;
+ }
+ for (int col = 0; col < pixel_count; col++) {
+ if (!(src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8)))) {
+ dest_scan += 4;
+ continue;
+ }
+ int src_alpha;
+ if (clip_scan) {
+ src_alpha = mask_alpha * clip_scan[col] / 255;
+ } else {
+ src_alpha = mask_alpha;
+ }
+ uint8_t back_alpha = dest_scan[3];
+ if (back_alpha == 0) {
+ FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alpha, src_r, src_g, src_b));
+ dest_scan += 4;
+ continue;
+ }
+ uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255;
+ dest_scan[3] = dest_alpha;
+ int alpha_ratio = src_alpha * 255 / dest_alpha;
+ if (blend_type >= FXDIB_BLEND_NONSEPARABLE) {
+ int blended_colors[3];
+ uint8_t scan[3] = {static_cast<uint8_t>(src_b),
+ static_cast<uint8_t>(src_g),
+ static_cast<uint8_t>(src_r)};
+ RGB_Blend(blend_type, scan, dest_scan, blended_colors);
+ *dest_scan =
+ FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[0], alpha_ratio);
+ dest_scan++;
+ *dest_scan =
+ FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[1], alpha_ratio);
+ dest_scan++;
+ *dest_scan =
+ FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[2], alpha_ratio);
+ } else if (blend_type) {
+ int blended = Blend(blend_type, *dest_scan, src_b);
+ blended = FXDIB_ALPHA_MERGE(src_b, blended, back_alpha);
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alpha_ratio);
+ dest_scan++;
+ blended = Blend(blend_type, *dest_scan, src_g);
+ blended = FXDIB_ALPHA_MERGE(src_g, blended, back_alpha);
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alpha_ratio);
+ dest_scan++;
+ blended = Blend(blend_type, *dest_scan, src_r);
+ blended = FXDIB_ALPHA_MERGE(src_r, blended, back_alpha);
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alpha_ratio);
+ } else {
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio);
+ dest_scan++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, alpha_ratio);
+ dest_scan++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, alpha_ratio);
+ }
+ dest_scan += 2;
+ }
+}
+
+void CompositeRow_BitMask2Rgb(uint8_t* dest_scan,
+ const uint8_t* src_scan,
+ int mask_alpha,
+ int src_r,
+ int src_g,
+ int src_b,
+ int src_left,
+ int pixel_count,
+ int blend_type,
+ int Bpp,
+ const uint8_t* clip_scan) {
+ if (blend_type == FXDIB_BLEND_NORMAL && !clip_scan && mask_alpha == 255) {
+ for (int col = 0; col < pixel_count; col++) {
+ if (src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8))) {
+ dest_scan[2] = src_r;
+ dest_scan[1] = src_g;
+ dest_scan[0] = src_b;
+ }
+ dest_scan += Bpp;
+ }
+ return;
+ }
+ for (int col = 0; col < pixel_count; col++) {
+ if (!(src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8)))) {
+ dest_scan += Bpp;
+ continue;
+ }
+ int src_alpha;
+ if (clip_scan) {
+ src_alpha = mask_alpha * clip_scan[col] / 255;
+ } else {
+ src_alpha = mask_alpha;
+ }
+ if (src_alpha == 0) {
+ dest_scan += Bpp;
+ continue;
+ }
+ if (blend_type >= FXDIB_BLEND_NONSEPARABLE) {
+ int blended_colors[3];
+ uint8_t scan[3] = {static_cast<uint8_t>(src_b),
+ static_cast<uint8_t>(src_g),
+ static_cast<uint8_t>(src_r)};
+ RGB_Blend(blend_type, scan, dest_scan, blended_colors);
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[0], src_alpha);
+ dest_scan++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[1], src_alpha);
+ dest_scan++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[2], src_alpha);
+ } else if (blend_type) {
+ int blended = Blend(blend_type, *dest_scan, src_b);
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, src_alpha);
+ dest_scan++;
+ blended = Blend(blend_type, *dest_scan, src_g);
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, src_alpha);
+ dest_scan++;
+ blended = Blend(blend_type, *dest_scan, src_r);
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, src_alpha);
+ } else {
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, src_alpha);
+ dest_scan++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, src_alpha);
+ dest_scan++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, src_alpha);
+ }
+ dest_scan += Bpp - 2;
+ }
+}
+
+void CompositeRow_BitMask2Mask(uint8_t* dest_scan,
+ const uint8_t* src_scan,
+ int mask_alpha,
+ int src_left,
+ int pixel_count,
+ const uint8_t* clip_scan) {
+ for (int col = 0; col < pixel_count; col++) {
+ if (!(src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8)))) {
+ dest_scan++;
+ continue;
+ }
+ int src_alpha;
+ if (clip_scan) {
+ src_alpha = mask_alpha * clip_scan[col] / 255;
+ } else {
+ src_alpha = mask_alpha;
+ }
+ uint8_t back_alpha = *dest_scan;
+ if (!back_alpha) {
+ *dest_scan = src_alpha;
+ } else if (src_alpha) {
+ *dest_scan = back_alpha + src_alpha - back_alpha * src_alpha / 255;
+ }
+ dest_scan++;
+ }
+}
+
+void CompositeRow_BitMask2Gray(uint8_t* dest_scan,
+ const uint8_t* src_scan,
+ int mask_alpha,
+ int src_gray,
+ int src_left,
+ int pixel_count,
+ const uint8_t* clip_scan) {
+ for (int col = 0; col < pixel_count; col++) {
+ if (!(src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8)))) {
+ dest_scan++;
+ continue;
+ }
+ int src_alpha;
+ if (clip_scan) {
+ src_alpha = mask_alpha * clip_scan[col] / 255;
+ } else {
+ src_alpha = mask_alpha;
+ }
+ if (src_alpha) {
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_gray, src_alpha);
+ }
+ dest_scan++;
+ }
+}
+
+void CompositeRow_BitMask2Graya(uint8_t* dest_scan,
+ const uint8_t* src_scan,
+ int mask_alpha,
+ int src_gray,
+ int src_left,
+ int pixel_count,
+ const uint8_t* clip_scan,
+ uint8_t* dest_alpha_scan) {
+ for (int col = 0; col < pixel_count; col++) {
+ if (!(src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8)))) {
+ dest_scan++;
+ dest_alpha_scan++;
+ continue;
+ }
+ int src_alpha;
+ if (clip_scan) {
+ src_alpha = mask_alpha * clip_scan[col] / 255;
+ } else {
+ src_alpha = mask_alpha;
+ }
+ uint8_t back_alpha = *dest_alpha_scan;
+ if (back_alpha == 0) {
+ *dest_scan++ = src_gray;
+ *dest_alpha_scan++ = src_alpha;
+ continue;
+ }
+ if (src_alpha == 0) {
+ dest_scan++;
+ dest_alpha_scan++;
+ continue;
+ }
+ uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255;
+ *dest_alpha_scan++ = dest_alpha;
+ int alpha_ratio = src_alpha * 255 / dest_alpha;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_gray, alpha_ratio);
+ dest_scan++;
+ }
+}
+
+void CompositeRow_Argb2Argb_RgbByteOrder(uint8_t* dest_scan,
+ const uint8_t* src_scan,
+ int pixel_count,
+ int blend_type,
+ const uint8_t* clip_scan) {
+ int blended_colors[3];
+ bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
+ for (int col = 0; col < pixel_count; col++) {
+ uint8_t back_alpha = dest_scan[3];
+ if (back_alpha == 0) {
+ if (clip_scan) {
+ int src_alpha = clip_scan[col] * src_scan[3] / 255;
+ dest_scan[3] = src_alpha;
+ dest_scan[0] = src_scan[2];
+ dest_scan[1] = src_scan[1];
+ dest_scan[2] = src_scan[0];
+ } else {
+ FXARGB_RGBORDERCOPY(dest_scan, src_scan);
+ }
+ dest_scan += 4;
+ src_scan += 4;
+ continue;
+ }
+ uint8_t src_alpha;
+ if (clip_scan) {
+ src_alpha = clip_scan[col] * src_scan[3] / 255;
+ } else {
+ src_alpha = src_scan[3];
+ }
+ if (src_alpha == 0) {
+ dest_scan += 4;
+ src_scan += 4;
+ continue;
+ }
+ uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255;
+ dest_scan[3] = dest_alpha;
+ int alpha_ratio = src_alpha * 255 / dest_alpha;
+ if (bNonseparableBlend) {
+ uint8_t dest_scan_o[3];
+ dest_scan_o[0] = dest_scan[2];
+ dest_scan_o[1] = dest_scan[1];
+ dest_scan_o[2] = dest_scan[0];
+ RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors);
+ }
+ for (int color = 0; color < 3; color++) {
+ int index = 2 - color;
+ if (blend_type) {
+ int blended = bNonseparableBlend
+ ? blended_colors[color]
+ : Blend(blend_type, dest_scan[index], *src_scan);
+ blended = FXDIB_ALPHA_MERGE(*src_scan, blended, back_alpha);
+ dest_scan[index] =
+ FXDIB_ALPHA_MERGE(dest_scan[index], blended, alpha_ratio);
+ } else {
+ dest_scan[index] =
+ FXDIB_ALPHA_MERGE(dest_scan[index], *src_scan, alpha_ratio);
+ }
+ src_scan++;
+ }
+ dest_scan += 4;
+ src_scan++;
+ }
+}
+
+void CompositeRow_Rgb2Argb_Blend_NoClip_RgbByteOrder(uint8_t* dest_scan,
+ const uint8_t* src_scan,
+ int width,
+ int blend_type,
+ int src_Bpp) {
+ int blended_colors[3];
+ bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
+ int src_gap = src_Bpp - 3;
+ for (int col = 0; col < width; col++) {
+ uint8_t back_alpha = dest_scan[3];
+ if (back_alpha == 0) {
+ if (src_Bpp == 4) {
+ FXARGB_SETRGBORDERDIB(dest_scan, 0xff000000 | FXARGB_GETDIB(src_scan));
+ } else {
+ FXARGB_SETRGBORDERDIB(dest_scan, FXARGB_MAKE(0xff, src_scan[2],
+ src_scan[1], src_scan[0]));
+ }
+ dest_scan += 4;
+ src_scan += src_Bpp;
+ continue;
+ }
+ dest_scan[3] = 0xff;
+ if (bNonseparableBlend) {
+ uint8_t dest_scan_o[3];
+ dest_scan_o[0] = dest_scan[2];
+ dest_scan_o[1] = dest_scan[1];
+ dest_scan_o[2] = dest_scan[0];
+ RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors);
+ }
+ for (int color = 0; color < 3; color++) {
+ int index = 2 - color;
+ int src_color = *src_scan;
+ int blended = bNonseparableBlend
+ ? blended_colors[color]
+ : Blend(blend_type, dest_scan[index], src_color);
+ dest_scan[index] = FXDIB_ALPHA_MERGE(src_color, blended, back_alpha);
+ src_scan++;
+ }
+ dest_scan += 4;
+ src_scan += src_gap;
+ }
+}
+
+void CompositeRow_Argb2Rgb_Blend_RgbByteOrder(uint8_t* dest_scan,
+ const uint8_t* src_scan,
+ int width,
+ int blend_type,
+ int dest_Bpp,
+ const uint8_t* clip_scan) {
+ int blended_colors[3];
+ bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
+ for (int col = 0; col < width; col++) {
+ uint8_t src_alpha;
+ if (clip_scan) {
+ src_alpha = src_scan[3] * (*clip_scan++) / 255;
+ } else {
+ src_alpha = src_scan[3];
+ }
+ if (src_alpha == 0) {
+ dest_scan += dest_Bpp;
+ src_scan += 4;
+ continue;
+ }
+ if (bNonseparableBlend) {
+ uint8_t dest_scan_o[3];
+ dest_scan_o[0] = dest_scan[2];
+ dest_scan_o[1] = dest_scan[1];
+ dest_scan_o[2] = dest_scan[0];
+ RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors);
+ }
+ for (int color = 0; color < 3; color++) {
+ int index = 2 - color;
+ int back_color = dest_scan[index];
+ int blended = bNonseparableBlend
+ ? blended_colors[color]
+ : Blend(blend_type, back_color, *src_scan);
+ dest_scan[index] = FXDIB_ALPHA_MERGE(back_color, blended, src_alpha);
+ src_scan++;
+ }
+ dest_scan += dest_Bpp;
+ src_scan++;
+ }
+}
+
+void CompositeRow_Rgb2Argb_NoBlend_NoClip_RgbByteOrder(uint8_t* dest_scan,
+ const uint8_t* src_scan,
+ int width,
+ int src_Bpp) {
+ for (int col = 0; col < width; col++) {
+ if (src_Bpp == 4) {
+ FXARGB_SETRGBORDERDIB(dest_scan, 0xff000000 | FXARGB_GETDIB(src_scan));
+ } else {
+ FXARGB_SETRGBORDERDIB(
+ dest_scan, FXARGB_MAKE(0xff, src_scan[2], src_scan[1], src_scan[0]));
+ }
+ dest_scan += 4;
+ src_scan += src_Bpp;
+ }
+}
+
+void CompositeRow_Rgb2Rgb_Blend_NoClip_RgbByteOrder(uint8_t* dest_scan,
+ const uint8_t* src_scan,
+ int width,
+ int blend_type,
+ int dest_Bpp,
+ int src_Bpp) {
+ int blended_colors[3];
+ bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
+ int src_gap = src_Bpp - 3;
+ for (int col = 0; col < width; col++) {
+ if (bNonseparableBlend) {
+ uint8_t dest_scan_o[3];
+ dest_scan_o[0] = dest_scan[2];
+ dest_scan_o[1] = dest_scan[1];
+ dest_scan_o[2] = dest_scan[0];
+ RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors);
+ }
+ for (int color = 0; color < 3; color++) {
+ int index = 2 - color;
+ int back_color = dest_scan[index];
+ int src_color = *src_scan;
+ int blended = bNonseparableBlend
+ ? blended_colors[color]
+ : Blend(blend_type, back_color, src_color);
+ dest_scan[index] = blended;
+ src_scan++;
+ }
+ dest_scan += dest_Bpp;
+ src_scan += src_gap;
+ }
+}
+
+void CompositeRow_Argb2Rgb_NoBlend_RgbByteOrder(uint8_t* dest_scan,
+ const uint8_t* src_scan,
+ int width,
+ int dest_Bpp,
+ const uint8_t* clip_scan) {
+ for (int col = 0; col < width; col++) {
+ uint8_t src_alpha;
+ if (clip_scan) {
+ src_alpha = src_scan[3] * (*clip_scan++) / 255;
+ } else {
+ src_alpha = src_scan[3];
+ }
+ if (src_alpha == 255) {
+ dest_scan[2] = *src_scan++;
+ dest_scan[1] = *src_scan++;
+ dest_scan[0] = *src_scan++;
+ dest_scan += dest_Bpp;
+ src_scan++;
+ continue;
+ }
+ if (src_alpha == 0) {
+ dest_scan += dest_Bpp;
+ src_scan += 4;
+ continue;
+ }
+ for (int color = 0; color < 3; color++) {
+ int index = 2 - color;
+ dest_scan[index] =
+ FXDIB_ALPHA_MERGE(dest_scan[index], *src_scan, src_alpha);
+ src_scan++;
+ }
+ dest_scan += dest_Bpp;
+ src_scan++;
+ }
+}
+
+void CompositeRow_Rgb2Rgb_NoBlend_NoClip_RgbByteOrder(uint8_t* dest_scan,
+ const uint8_t* src_scan,
+ int width,
+ int dest_Bpp,
+ int src_Bpp) {
+ for (int col = 0; col < width; col++) {
+ dest_scan[2] = src_scan[0];
+ dest_scan[1] = src_scan[1];
+ dest_scan[0] = src_scan[2];
+ dest_scan += dest_Bpp;
+ src_scan += src_Bpp;
+ }
+}
+
+void CompositeRow_Rgb2Argb_Blend_Clip_RgbByteOrder(uint8_t* dest_scan,
+ const uint8_t* src_scan,
+ int width,
+ int blend_type,
+ int src_Bpp,
+ const uint8_t* clip_scan) {
+ int blended_colors[3];
+ bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
+ int src_gap = src_Bpp - 3;
+ for (int col = 0; col < width; col++) {
+ int src_alpha = *clip_scan++;
+ uint8_t back_alpha = dest_scan[3];
+ if (back_alpha == 0) {
+ dest_scan[2] = *src_scan++;
+ dest_scan[1] = *src_scan++;
+ dest_scan[0] = *src_scan++;
+ src_scan += src_gap;
+ dest_scan += 4;
+ continue;
+ }
+ if (src_alpha == 0) {
+ dest_scan += 4;
+ src_scan += src_Bpp;
+ continue;
+ }
+ uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255;
+ dest_scan[3] = dest_alpha;
+ int alpha_ratio = src_alpha * 255 / dest_alpha;
+ if (bNonseparableBlend) {
+ uint8_t dest_scan_o[3];
+ dest_scan_o[0] = dest_scan[2];
+ dest_scan_o[1] = dest_scan[1];
+ dest_scan_o[2] = dest_scan[0];
+ RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors);
+ }
+ for (int color = 0; color < 3; color++) {
+ int index = 2 - color;
+ int src_color = *src_scan;
+ int blended = bNonseparableBlend
+ ? blended_colors[color]
+ : Blend(blend_type, dest_scan[index], src_color);
+ blended = FXDIB_ALPHA_MERGE(src_color, blended, back_alpha);
+ dest_scan[index] =
+ FXDIB_ALPHA_MERGE(dest_scan[index], blended, alpha_ratio);
+ src_scan++;
+ }
+ dest_scan += 4;
+ src_scan += src_gap;
+ }
+}
+
+void CompositeRow_Rgb2Rgb_Blend_Clip_RgbByteOrder(uint8_t* dest_scan,
+ const uint8_t* src_scan,
+ int width,
+ int blend_type,
+ int dest_Bpp,
+ int src_Bpp,
+ const uint8_t* clip_scan) {
+ int blended_colors[3];
+ bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
+ int src_gap = src_Bpp - 3;
+ for (int col = 0; col < width; col++) {
+ uint8_t src_alpha = *clip_scan++;
+ if (src_alpha == 0) {
+ dest_scan += dest_Bpp;
+ src_scan += src_Bpp;
+ continue;
+ }
+ if (bNonseparableBlend) {
+ uint8_t dest_scan_o[3];
+ dest_scan_o[0] = dest_scan[2];
+ dest_scan_o[1] = dest_scan[1];
+ dest_scan_o[2] = dest_scan[0];
+ RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors);
+ }
+ for (int color = 0; color < 3; color++) {
+ int index = 2 - color;
+ int src_color = *src_scan;
+ int back_color = dest_scan[index];
+ int blended = bNonseparableBlend
+ ? blended_colors[color]
+ : Blend(blend_type, back_color, src_color);
+ dest_scan[index] = FXDIB_ALPHA_MERGE(back_color, blended, src_alpha);
+ src_scan++;
+ }
+ dest_scan += dest_Bpp;
+ src_scan += src_gap;
+ }
+}
+
+void CompositeRow_Rgb2Argb_NoBlend_Clip_RgbByteOrder(uint8_t* dest_scan,
+ const uint8_t* src_scan,
+ int width,
+ int src_Bpp,
+ const uint8_t* clip_scan) {
+ int src_gap = src_Bpp - 3;
+ for (int col = 0; col < width; col++) {
+ int src_alpha = clip_scan[col];
+ if (src_alpha == 255) {
+ dest_scan[2] = *src_scan++;
+ dest_scan[1] = *src_scan++;
+ dest_scan[0] = *src_scan++;
+ dest_scan[3] = 255;
+ dest_scan += 4;
+ src_scan += src_gap;
+ continue;
+ }
+ if (src_alpha == 0) {
+ dest_scan += 4;
+ src_scan += src_Bpp;
+ continue;
+ }
+ int back_alpha = dest_scan[3];
+ uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255;
+ dest_scan[3] = dest_alpha;
+ int alpha_ratio = src_alpha * 255 / dest_alpha;
+ for (int color = 0; color < 3; color++) {
+ int index = 2 - color;
+ dest_scan[index] =
+ FXDIB_ALPHA_MERGE(dest_scan[index], *src_scan, alpha_ratio);
+ src_scan++;
+ }
+ dest_scan += 4;
+ src_scan += src_gap;
+ }
+}
+
+void CompositeRow_Rgb2Rgb_NoBlend_Clip_RgbByteOrder(uint8_t* dest_scan,
+ const uint8_t* src_scan,
+ int width,
+ int dest_Bpp,
+ int src_Bpp,
+ const uint8_t* clip_scan) {
+ for (int col = 0; col < width; col++) {
+ int src_alpha = clip_scan[col];
+ if (src_alpha == 255) {
+ dest_scan[2] = src_scan[0];
+ dest_scan[1] = src_scan[1];
+ dest_scan[0] = src_scan[2];
+ } else if (src_alpha) {
+ dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], *src_scan, src_alpha);
+ src_scan++;
+ dest_scan[1] = FXDIB_ALPHA_MERGE(dest_scan[1], *src_scan, src_alpha);
+ src_scan++;
+ dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], *src_scan, src_alpha);
+ dest_scan += dest_Bpp;
+ src_scan += src_Bpp - 2;
+ continue;
+ }
+ dest_scan += dest_Bpp;
+ src_scan += src_Bpp;
+ }
+}
+
+void CompositeRow_8bppRgb2Rgb_NoBlend_RgbByteOrder(uint8_t* dest_scan,
+ const uint8_t* src_scan,
+ FX_ARGB* pPalette,
+ int pixel_count,
+ int DestBpp,
+ const uint8_t* clip_scan) {
+ for (int col = 0; col < pixel_count; col++) {
+ FX_ARGB argb = pPalette ? pPalette[*src_scan] : (*src_scan) * 0x010101;
+ int src_r = FXARGB_R(argb);
+ int src_g = FXARGB_G(argb);
+ int src_b = FXARGB_B(argb);
+ if (clip_scan && clip_scan[col] < 255) {
+ dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], src_b, clip_scan[col]);
+ dest_scan[1] = FXDIB_ALPHA_MERGE(dest_scan[1], src_g, clip_scan[col]);
+ dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], src_r, clip_scan[col]);
+ } else {
+ dest_scan[2] = src_b;
+ dest_scan[1] = src_g;
+ dest_scan[0] = src_r;
+ }
+ dest_scan += DestBpp;
+ src_scan++;
+ }
+}
+
+void CompositeRow_1bppRgb2Rgb_NoBlend_RgbByteOrder(uint8_t* dest_scan,
+ const uint8_t* src_scan,
+ int src_left,
+ FX_ARGB* pPalette,
+ int pixel_count,
+ int DestBpp,
+ const uint8_t* clip_scan) {
+ int reset_r, reset_g, reset_b;
+ int set_r, set_g, set_b;
+ if (pPalette) {
+ reset_r = FXARGB_R(pPalette[0]);
+ reset_g = FXARGB_G(pPalette[0]);
+ reset_b = FXARGB_B(pPalette[0]);
+ set_r = FXARGB_R(pPalette[1]);
+ set_g = FXARGB_G(pPalette[1]);
+ set_b = FXARGB_B(pPalette[1]);
+ } else {
+ reset_r = reset_g = reset_b = 0;
+ set_r = set_g = set_b = 255;
+ }
+ for (int col = 0; col < pixel_count; col++) {
+ int src_r, src_g, src_b;
+ if (src_scan[(col + src_left) / 8] & (1 << (7 - (col + src_left) % 8))) {
+ src_r = set_r;
+ src_g = set_g;
+ src_b = set_b;
+ } else {
+ src_r = reset_r;
+ src_g = reset_g;
+ src_b = reset_b;
+ }
+ if (clip_scan && clip_scan[col] < 255) {
+ dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], src_b, clip_scan[col]);
+ dest_scan[1] = FXDIB_ALPHA_MERGE(dest_scan[1], src_g, clip_scan[col]);
+ dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], src_r, clip_scan[col]);
+ } else {
+ dest_scan[2] = src_b;
+ dest_scan[1] = src_g;
+ dest_scan[0] = src_r;
+ }
+ dest_scan += DestBpp;
+ }
+}
+
+void CompositeRow_8bppRgb2Argb_NoBlend_RgbByteOrder(uint8_t* dest_scan,
+ const uint8_t* src_scan,
+ int width,
+ FX_ARGB* pPalette,
+ const uint8_t* clip_scan) {
+ for (int col = 0; col < width; col++) {
+ int src_r, src_g, src_b;
+ if (pPalette) {
+ FX_ARGB argb = pPalette[*src_scan];
+ src_r = FXARGB_R(argb);
+ src_g = FXARGB_G(argb);
+ src_b = FXARGB_B(argb);
+ } else {
+ src_r = src_g = src_b = *src_scan;
+ }
+ if (!clip_scan || clip_scan[col] == 255) {
+ dest_scan[2] = src_b;
+ dest_scan[1] = src_g;
+ dest_scan[0] = src_r;
+ dest_scan[3] = 255;
+ src_scan++;
+ dest_scan += 4;
+ continue;
+ }
+ int src_alpha = clip_scan[col];
+ if (src_alpha == 0) {
+ dest_scan += 4;
+ src_scan++;
+ continue;
+ }
+ int back_alpha = dest_scan[3];
+ uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255;
+ dest_scan[3] = dest_alpha;
+ int alpha_ratio = src_alpha * 255 / dest_alpha;
+ dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], src_b, alpha_ratio);
+ dest_scan[1] = FXDIB_ALPHA_MERGE(dest_scan[1], src_g, alpha_ratio);
+ dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], src_r, alpha_ratio);
+ dest_scan += 4;
+ src_scan++;
+ }
+}
+
+void CompositeRow_1bppRgb2Argb_NoBlend_RgbByteOrder(uint8_t* dest_scan,
+ const uint8_t* src_scan,
+ int src_left,
+ int width,
+ FX_ARGB* pPalette,
+ const uint8_t* clip_scan) {
+ int reset_r, reset_g, reset_b;
+ int set_r, set_g, set_b;
+ if (pPalette) {
+ reset_r = FXARGB_R(pPalette[0]);
+ reset_g = FXARGB_G(pPalette[0]);
+ reset_b = FXARGB_B(pPalette[0]);
+ set_r = FXARGB_R(pPalette[1]);
+ set_g = FXARGB_G(pPalette[1]);
+ set_b = FXARGB_B(pPalette[1]);
+ } else {
+ reset_r = reset_g = reset_b = 0;
+ set_r = set_g = set_b = 255;
+ }
+ for (int col = 0; col < width; col++) {
+ int src_r, src_g, src_b;
+ if (src_scan[(col + src_left) / 8] & (1 << (7 - (col + src_left) % 8))) {
+ src_r = set_r;
+ src_g = set_g;
+ src_b = set_b;
+ } else {
+ src_r = reset_r;
+ src_g = reset_g;
+ src_b = reset_b;
+ }
+ if (!clip_scan || clip_scan[col] == 255) {
+ dest_scan[2] = src_b;
+ dest_scan[1] = src_g;
+ dest_scan[0] = src_r;
+ dest_scan[3] = 255;
+ dest_scan += 4;
+ continue;
+ }
+ int src_alpha = clip_scan[col];
+ if (src_alpha == 0) {
+ dest_scan += 4;
+ continue;
+ }
+ int back_alpha = dest_scan[3];
+ uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255;
+ dest_scan[3] = dest_alpha;
+ int alpha_ratio = src_alpha * 255 / dest_alpha;
+ dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], src_b, alpha_ratio);
+ dest_scan[1] = FXDIB_ALPHA_MERGE(dest_scan[1], src_g, alpha_ratio);
+ dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], src_r, alpha_ratio);
+ dest_scan += 4;
+ }
+}
+
+void CompositeRow_ByteMask2Argb_RgbByteOrder(uint8_t* dest_scan,
+ const uint8_t* src_scan,
+ int mask_alpha,
+ int src_r,
+ int src_g,
+ int src_b,
+ int pixel_count,
+ int blend_type,
+ const uint8_t* clip_scan) {
+ for (int col = 0; col < pixel_count; col++) {
+ int src_alpha;
+ if (clip_scan) {
+ src_alpha = mask_alpha * clip_scan[col] * src_scan[col] / 255 / 255;
+ } else {
+ src_alpha = mask_alpha * src_scan[col] / 255;
+ }
+ uint8_t back_alpha = dest_scan[3];
+ if (back_alpha == 0) {
+ FXARGB_SETRGBORDERDIB(dest_scan,
+ FXARGB_MAKE(src_alpha, src_r, src_g, src_b));
+ dest_scan += 4;
+ continue;
+ }
+ if (src_alpha == 0) {
+ dest_scan += 4;
+ continue;
+ }
+ uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255;
+ dest_scan[3] = dest_alpha;
+ int alpha_ratio = src_alpha * 255 / dest_alpha;
+ if (blend_type >= FXDIB_BLEND_NONSEPARABLE) {
+ int blended_colors[3];
+ uint8_t scan[3] = {static_cast<uint8_t>(src_b),
+ static_cast<uint8_t>(src_g),
+ static_cast<uint8_t>(src_r)};
+ uint8_t dest_scan_o[3] = {dest_scan[2], dest_scan[1], dest_scan[0]};
+ RGB_Blend(blend_type, scan, dest_scan_o, blended_colors);
+ dest_scan[2] =
+ FXDIB_ALPHA_MERGE(dest_scan[2], blended_colors[0], alpha_ratio);
+ dest_scan[1] =
+ FXDIB_ALPHA_MERGE(dest_scan[1], blended_colors[1], alpha_ratio);
+ dest_scan[0] =
+ FXDIB_ALPHA_MERGE(dest_scan[0], blended_colors[2], alpha_ratio);
+ } else if (blend_type) {
+ int blended = Blend(blend_type, dest_scan[2], src_b);
+ blended = FXDIB_ALPHA_MERGE(src_b, blended, back_alpha);
+ dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], blended, alpha_ratio);
+ blended = Blend(blend_type, dest_scan[1], src_g);
+ blended = FXDIB_ALPHA_MERGE(src_g, blended, back_alpha);
+ dest_scan[1] = FXDIB_ALPHA_MERGE(dest_scan[1], blended, alpha_ratio);
+ blended = Blend(blend_type, dest_scan[0], src_r);
+ blended = FXDIB_ALPHA_MERGE(src_r, blended, back_alpha);
+ dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], blended, alpha_ratio);
+ } else {
+ dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], src_b, alpha_ratio);
+ dest_scan[1] = FXDIB_ALPHA_MERGE(dest_scan[1], src_g, alpha_ratio);
+ dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], src_r, alpha_ratio);
+ }
+ dest_scan += 4;
+ }
+}
+
+void CompositeRow_ByteMask2Rgb_RgbByteOrder(uint8_t* dest_scan,
+ const uint8_t* src_scan,
+ int mask_alpha,
+ int src_r,
+ int src_g,
+ int src_b,
+ int pixel_count,
+ int blend_type,
+ int Bpp,
+ const uint8_t* clip_scan) {
+ for (int col = 0; col < pixel_count; col++) {
+ int src_alpha;
+ if (clip_scan) {
+ src_alpha = mask_alpha * clip_scan[col] * src_scan[col] / 255 / 255;
+ } else {
+ src_alpha = mask_alpha * src_scan[col] / 255;
+ }
+ if (src_alpha == 0) {
+ dest_scan += Bpp;
+ continue;
+ }
+ if (blend_type >= FXDIB_BLEND_NONSEPARABLE) {
+ int blended_colors[3];
+ uint8_t scan[3] = {static_cast<uint8_t>(src_b),
+ static_cast<uint8_t>(src_g),
+ static_cast<uint8_t>(src_r)};
+ uint8_t dest_scan_o[3] = {dest_scan[2], dest_scan[1], dest_scan[0]};
+ RGB_Blend(blend_type, scan, dest_scan_o, blended_colors);
+ dest_scan[2] =
+ FXDIB_ALPHA_MERGE(dest_scan[2], blended_colors[0], src_alpha);
+ dest_scan[1] =
+ FXDIB_ALPHA_MERGE(dest_scan[1], blended_colors[1], src_alpha);
+ dest_scan[0] =
+ FXDIB_ALPHA_MERGE(dest_scan[0], blended_colors[2], src_alpha);
+ } else if (blend_type) {
+ int blended = Blend(blend_type, dest_scan[2], src_b);
+ dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], blended, src_alpha);
+ blended = Blend(blend_type, dest_scan[1], src_g);
+ dest_scan[1] = FXDIB_ALPHA_MERGE(dest_scan[1], blended, src_alpha);
+ blended = Blend(blend_type, dest_scan[0], src_r);
+ dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], blended, src_alpha);
+ } else {
+ dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], src_b, src_alpha);
+ dest_scan[1] = FXDIB_ALPHA_MERGE(dest_scan[1], src_g, src_alpha);
+ dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], src_r, src_alpha);
+ }
+ dest_scan += Bpp;
+ }
+}
+
+void CompositeRow_BitMask2Argb_RgbByteOrder(uint8_t* dest_scan,
+ const uint8_t* src_scan,
+ int mask_alpha,
+ int src_r,
+ int src_g,
+ int src_b,
+ int src_left,
+ int pixel_count,
+ int blend_type,
+ const uint8_t* clip_scan) {
+ if (blend_type == FXDIB_BLEND_NORMAL && !clip_scan && mask_alpha == 255) {
+ FX_ARGB argb = FXARGB_MAKE(0xff, src_r, src_g, src_b);
+ for (int col = 0; col < pixel_count; col++) {
+ if (src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8))) {
+ FXARGB_SETRGBORDERDIB(dest_scan, argb);
+ }
+ dest_scan += 4;
+ }
+ return;
+ }
+ for (int col = 0; col < pixel_count; col++) {
+ if (!(src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8)))) {
+ dest_scan += 4;
+ continue;
+ }
+ int src_alpha;
+ if (clip_scan) {
+ src_alpha = mask_alpha * clip_scan[col] / 255;
+ } else {
+ src_alpha = mask_alpha;
+ }
+ uint8_t back_alpha = dest_scan[3];
+ if (back_alpha == 0) {
+ FXARGB_SETRGBORDERDIB(dest_scan,
+ FXARGB_MAKE(src_alpha, src_r, src_g, src_b));
+ dest_scan += 4;
+ continue;
+ }
+ uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255;
+ dest_scan[3] = dest_alpha;
+ int alpha_ratio = src_alpha * 255 / dest_alpha;
+ if (blend_type >= FXDIB_BLEND_NONSEPARABLE) {
+ int blended_colors[3];
+ uint8_t scan[3] = {static_cast<uint8_t>(src_b),
+ static_cast<uint8_t>(src_g),
+ static_cast<uint8_t>(src_r)};
+ uint8_t dest_scan_o[3] = {dest_scan[2], dest_scan[1], dest_scan[0]};
+ RGB_Blend(blend_type, scan, dest_scan_o, blended_colors);
+ dest_scan[2] =
+ FXDIB_ALPHA_MERGE(dest_scan[2], blended_colors[0], alpha_ratio);
+ dest_scan[1] =
+ FXDIB_ALPHA_MERGE(dest_scan[1], blended_colors[1], alpha_ratio);
+ dest_scan[0] =
+ FXDIB_ALPHA_MERGE(dest_scan[0], blended_colors[2], alpha_ratio);
+ } else if (blend_type) {
+ int blended = Blend(blend_type, dest_scan[2], src_b);
+ blended = FXDIB_ALPHA_MERGE(src_b, blended, back_alpha);
+ dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], blended, alpha_ratio);
+ blended = Blend(blend_type, dest_scan[1], src_g);
+ blended = FXDIB_ALPHA_MERGE(src_g, blended, back_alpha);
+ dest_scan[1] = FXDIB_ALPHA_MERGE(dest_scan[1], blended, alpha_ratio);
+ blended = Blend(blend_type, dest_scan[0], src_r);
+ blended = FXDIB_ALPHA_MERGE(src_r, blended, back_alpha);
+ dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], blended, alpha_ratio);
+ } else {
+ dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], src_b, alpha_ratio);
+ dest_scan[1] = FXDIB_ALPHA_MERGE(dest_scan[1], src_g, alpha_ratio);
+ dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], src_r, alpha_ratio);
+ }
+ dest_scan += 4;
+ }
+}
+
+void CompositeRow_BitMask2Rgb_RgbByteOrder(uint8_t* dest_scan,
+ const uint8_t* src_scan,
+ int mask_alpha,
+ int src_r,
+ int src_g,
+ int src_b,
+ int src_left,
+ int pixel_count,
+ int blend_type,
+ int Bpp,
+ const uint8_t* clip_scan) {
+ if (blend_type == FXDIB_BLEND_NORMAL && !clip_scan && mask_alpha == 255) {
+ for (int col = 0; col < pixel_count; col++) {
+ if (src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8))) {
+ dest_scan[2] = src_b;
+ dest_scan[1] = src_g;
+ dest_scan[0] = src_r;
+ }
+ dest_scan += Bpp;
+ }
+ return;
+ }
+ for (int col = 0; col < pixel_count; col++) {
+ if (!(src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8)))) {
+ dest_scan += Bpp;
+ continue;
+ }
+ int src_alpha;
+ if (clip_scan) {
+ src_alpha = mask_alpha * clip_scan[col] / 255;
+ } else {
+ src_alpha = mask_alpha;
+ }
+ if (src_alpha == 0) {
+ dest_scan += Bpp;
+ continue;
+ }
+ if (blend_type >= FXDIB_BLEND_NONSEPARABLE) {
+ int blended_colors[3];
+ uint8_t scan[3] = {static_cast<uint8_t>(src_b),
+ static_cast<uint8_t>(src_g),
+ static_cast<uint8_t>(src_r)};
+ uint8_t dest_scan_o[3] = {dest_scan[2], dest_scan[1], dest_scan[0]};
+ RGB_Blend(blend_type, scan, dest_scan_o, blended_colors);
+ dest_scan[2] =
+ FXDIB_ALPHA_MERGE(dest_scan[2], blended_colors[0], src_alpha);
+ dest_scan[1] =
+ FXDIB_ALPHA_MERGE(dest_scan[1], blended_colors[1], src_alpha);
+ dest_scan[0] =
+ FXDIB_ALPHA_MERGE(dest_scan[0], blended_colors[2], src_alpha);
+ } else if (blend_type) {
+ int back_color = dest_scan[2];
+ int blended = Blend(blend_type, back_color, src_b);
+ dest_scan[2] = FXDIB_ALPHA_MERGE(back_color, blended, src_alpha);
+ back_color = dest_scan[1];
+ blended = Blend(blend_type, back_color, src_g);
+ dest_scan[1] = FXDIB_ALPHA_MERGE(back_color, blended, src_alpha);
+ back_color = dest_scan[0];
+ blended = Blend(blend_type, back_color, src_r);
+ dest_scan[0] = FXDIB_ALPHA_MERGE(back_color, blended, src_alpha);
+ } else {
+ dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], src_b, src_alpha);
+ dest_scan[1] = FXDIB_ALPHA_MERGE(dest_scan[1], src_g, src_alpha);
+ dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], src_r, src_alpha);
+ }
+ dest_scan += Bpp;
+ }
+}
+
+bool ScanlineCompositor_InitSourceMask(FXDIB_Format dest_format,
+ int alpha_flag,
+ uint32_t mask_color,
+ int& mask_alpha,
+ int& mask_red,
+ int& mask_green,
+ int& mask_blue,
+ int& mask_black) {
+ if (alpha_flag >> 8) {
+ mask_alpha = alpha_flag & 0xff;
+ mask_red = FXSYS_GetCValue(mask_color);
+ mask_green = FXSYS_GetMValue(mask_color);
+ mask_blue = FXSYS_GetYValue(mask_color);
+ mask_black = FXSYS_GetKValue(mask_color);
+ } else {
+ mask_alpha = FXARGB_A(mask_color);
+ mask_red = FXARGB_R(mask_color);
+ mask_green = FXARGB_G(mask_color);
+ mask_blue = FXARGB_B(mask_color);
+ }
+ if (dest_format == FXDIB_8bppMask) {
+ return true;
+ }
+ if ((dest_format & 0xff) == 8) {
+ if (alpha_flag >> 8) {
+ uint8_t r, g, b;
+ AdobeCMYK_to_sRGB1(mask_red, mask_green, mask_blue, mask_black, r, g, b);
+ mask_red = FXRGB2GRAY(r, g, b);
+ } else {
+ mask_red = FXRGB2GRAY(mask_red, mask_green, mask_blue);
+ }
+ if (dest_format & 0x0400)
+ mask_red = FX_CCOLOR(mask_red);
+ } else {
+ uint8_t* mask_color_p = (uint8_t*)&mask_color;
+ mask_color =
+ (alpha_flag >> 8) ? FXCMYK_TODIB(mask_color) : FXARGB_TODIB(mask_color);
+ if (alpha_flag >> 8) {
+ AdobeCMYK_to_sRGB1(mask_color_p[0], mask_color_p[1], mask_color_p[2],
+ mask_color_p[3], mask_color_p[2], mask_color_p[1],
+ mask_color_p[0]);
+ mask_red = mask_color_p[2];
+ mask_green = mask_color_p[1];
+ mask_blue = mask_color_p[0];
+ }
+ }
+ return true;
+}
+
+void ScanlineCompositor_InitSourcePalette(FXDIB_Format src_format,
+ FXDIB_Format dest_format,
+ uint32_t*& pDestPalette,
+ uint32_t* pSrcPalette) {
+ bool isSrcCmyk = !!(src_format & 0x0400);
+ bool isDstCmyk = !!(dest_format & 0x0400);
+ pDestPalette = nullptr;
+ if (pSrcPalette) {
+ if ((dest_format & 0xff) == 8) {
+ int pal_count = 1 << (src_format & 0xff);
+ uint8_t* gray_pal = FX_Alloc(uint8_t, pal_count);
+ pDestPalette = (uint32_t*)gray_pal;
+ if (isSrcCmyk) {
+ for (int i = 0; i < pal_count; i++) {
+ FX_CMYK cmyk = pSrcPalette[i];
+ uint8_t r, g, b;
+ AdobeCMYK_to_sRGB1(FXSYS_GetCValue(cmyk), FXSYS_GetMValue(cmyk),
+ FXSYS_GetYValue(cmyk), FXSYS_GetKValue(cmyk), r, g,
+ b);
+ *gray_pal++ = FXRGB2GRAY(r, g, b);
+ }
+ } else {
+ for (int i = 0; i < pal_count; i++) {
+ FX_ARGB argb = pSrcPalette[i];
+ *gray_pal++ =
+ FXRGB2GRAY(FXARGB_R(argb), FXARGB_G(argb), FXARGB_B(argb));
+ }
+ }
+ } else {
+ int palsize = 1 << (src_format & 0xff);
+ pDestPalette = FX_Alloc(uint32_t, palsize);
+ if (isDstCmyk == isSrcCmyk) {
+ memcpy(pDestPalette, pSrcPalette, palsize * sizeof(uint32_t));
+ } else {
+ for (int i = 0; i < palsize; i++) {
+ FX_CMYK cmyk = pSrcPalette[i];
+ uint8_t r, g, b;
+ AdobeCMYK_to_sRGB1(FXSYS_GetCValue(cmyk), FXSYS_GetMValue(cmyk),
+ FXSYS_GetYValue(cmyk), FXSYS_GetKValue(cmyk), r, g,
+ b);
+ pDestPalette[i] = FXARGB_MAKE(0xff, r, g, b);
+ }
+ }
+ }
+ } else {
+ if ((dest_format & 0xff) == 8) {
+ int pal_count = 1 << (src_format & 0xff);
+ uint8_t* gray_pal = FX_Alloc(uint8_t, pal_count);
+ if (pal_count == 2) {
+ gray_pal[0] = 0;
+ gray_pal[1] = 255;
+ } else {
+ for (int i = 0; i < pal_count; i++) {
+ gray_pal[i] = i;
+ }
+ }
+ pDestPalette = (uint32_t*)gray_pal;
+ } else {
+ int palsize = 1 << (src_format & 0xff);
+ pDestPalette = FX_Alloc(uint32_t, palsize);
+ if (palsize == 2) {
+ pDestPalette[0] = isSrcCmyk ? 255 : 0xff000000;
+ pDestPalette[1] = isSrcCmyk ? 0 : 0xffffffff;
+ } else {
+ for (int i = 0; i < palsize; i++) {
+ pDestPalette[i] = isSrcCmyk ? FX_CCOLOR(i) : (i * 0x10101);
+ }
+ }
+ if (isSrcCmyk != isDstCmyk) {
+ for (int i = 0; i < palsize; i++) {
+ FX_CMYK cmyk = pDestPalette[i];
+ uint8_t r, g, b;
+ AdobeCMYK_to_sRGB1(FXSYS_GetCValue(cmyk), FXSYS_GetMValue(cmyk),
+ FXSYS_GetYValue(cmyk), FXSYS_GetKValue(cmyk), r, g,
+ b);
+ pDestPalette[i] = FXARGB_MAKE(0xff, r, g, b);
+ }
+ }
+ }
+ }
+}
+
+} // namespace
+
+CFX_ScanlineCompositor::CFX_ScanlineCompositor() {
+ m_pSrcPalette = nullptr;
+ m_pCacheScanline = nullptr;
+ m_CacheSize = 0;
+ m_bRgbByteOrder = false;
+ m_BlendType = FXDIB_BLEND_NORMAL;
+}
+
+CFX_ScanlineCompositor::~CFX_ScanlineCompositor() {
+ FX_Free(m_pSrcPalette);
+ FX_Free(m_pCacheScanline);
+}
+
+bool CFX_ScanlineCompositor::Init(FXDIB_Format dest_format,
+ FXDIB_Format src_format,
+ int32_t width,
+ uint32_t* pSrcPalette,
+ uint32_t mask_color,
+ int blend_type,
+ bool bClip,
+ bool bRgbByteOrder,
+ int alpha_flag) {
+ m_SrcFormat = src_format;
+ m_DestFormat = dest_format;
+ m_BlendType = blend_type;
+ m_bRgbByteOrder = bRgbByteOrder;
+ if ((dest_format & 0xff) == 1)
+ return false;
+ if (m_SrcFormat == FXDIB_1bppMask || m_SrcFormat == FXDIB_8bppMask) {
+ return ScanlineCompositor_InitSourceMask(
+ dest_format, alpha_flag, mask_color, m_MaskAlpha, m_MaskRed,
+ m_MaskGreen, m_MaskBlue, m_MaskBlack);
+ }
+ if ((~src_format & 0x0400) && (dest_format & 0x0400))
+ return false;
+ if ((m_SrcFormat & 0xff) <= 8) {
+ if (dest_format == FXDIB_8bppMask)
+ return true;
+
+ ScanlineCompositor_InitSourcePalette(src_format, dest_format, m_pSrcPalette,
+ pSrcPalette);
+ m_Transparency =
+ (dest_format == FXDIB_Argb ? 1 : 0) + (dest_format & 0x0200 ? 2 : 0) +
+ (dest_format & 0x0400 ? 4 : 0) + ((src_format & 0xff) == 1 ? 8 : 0);
+ return true;
+ }
+ m_Transparency =
+ (src_format & 0x0200 ? 0 : 1) + (dest_format & 0x0200 ? 0 : 2) +
+ (blend_type == FXDIB_BLEND_NORMAL ? 4 : 0) + (bClip ? 8 : 0) +
+ (src_format & 0x0400 ? 16 : 0) + (dest_format & 0x0400 ? 32 : 0);
+ return true;
+}
+
+void CFX_ScanlineCompositor::CompositeRgbBitmapLine(
+ uint8_t* dest_scan,
+ const uint8_t* src_scan,
+ int width,
+ const uint8_t* clip_scan,
+ const uint8_t* src_extra_alpha,
+ uint8_t* dst_extra_alpha) {
+ int src_Bpp = (m_SrcFormat & 0xff) >> 3;
+ int dest_Bpp = (m_DestFormat & 0xff) >> 3;
+ if (m_bRgbByteOrder) {
+ switch (m_Transparency) {
+ case 0:
+ case 4:
+ case 8:
+ case 12:
+ CompositeRow_Argb2Argb_RgbByteOrder(dest_scan, src_scan, width,
+ m_BlendType, clip_scan);
+ break;
+ case 1:
+ CompositeRow_Rgb2Argb_Blend_NoClip_RgbByteOrder(
+ dest_scan, src_scan, width, m_BlendType, src_Bpp);
+ break;
+ case 2:
+ case 10:
+ CompositeRow_Argb2Rgb_Blend_RgbByteOrder(
+ dest_scan, src_scan, width, m_BlendType, dest_Bpp, clip_scan);
+ break;
+ case 3:
+ CompositeRow_Rgb2Rgb_Blend_NoClip_RgbByteOrder(
+ dest_scan, src_scan, width, m_BlendType, dest_Bpp, src_Bpp);
+ break;
+ case 5:
+ CompositeRow_Rgb2Argb_NoBlend_NoClip_RgbByteOrder(dest_scan, src_scan,
+ width, src_Bpp);
+ break;
+ case 6:
+ case 14:
+ CompositeRow_Argb2Rgb_NoBlend_RgbByteOrder(dest_scan, src_scan, width,
+ dest_Bpp, clip_scan);
+ break;
+ case 7:
+ CompositeRow_Rgb2Rgb_NoBlend_NoClip_RgbByteOrder(
+ dest_scan, src_scan, width, dest_Bpp, src_Bpp);
+ break;
+ case 9:
+ CompositeRow_Rgb2Argb_Blend_Clip_RgbByteOrder(
+ dest_scan, src_scan, width, m_BlendType, src_Bpp, clip_scan);
+ break;
+ case 11:
+ CompositeRow_Rgb2Rgb_Blend_Clip_RgbByteOrder(dest_scan, src_scan, width,
+ m_BlendType, dest_Bpp,
+ src_Bpp, clip_scan);
+ break;
+ case 13:
+ CompositeRow_Rgb2Argb_NoBlend_Clip_RgbByteOrder(
+ dest_scan, src_scan, width, src_Bpp, clip_scan);
+ break;
+ case 15:
+ CompositeRow_Rgb2Rgb_NoBlend_Clip_RgbByteOrder(
+ dest_scan, src_scan, width, dest_Bpp, src_Bpp, clip_scan);
+ break;
+ }
+ return;
+ }
+ if (m_DestFormat == FXDIB_8bppMask) {
+ if (m_SrcFormat & 0x0200) {
+ if (m_SrcFormat == FXDIB_Argb) {
+ CompositeRow_AlphaToMask(dest_scan, src_scan, width, clip_scan, 4);
+ } else {
+ CompositeRow_AlphaToMask(dest_scan, src_extra_alpha, width, clip_scan,
+ 1);
+ }
+ } else {
+ CompositeRow_Rgb2Mask(dest_scan, src_scan, width, clip_scan);
+ }
+ } else if ((m_DestFormat & 0xff) == 8) {
+ if (m_DestFormat & 0x0400) {
+ for (int i = 0; i < width; i++) {
+ *dest_scan = ~*dest_scan;
+ dest_scan++;
+ }
+ }
+ if (m_SrcFormat & 0x0200) {
+ if (m_DestFormat & 0x0200) {
+ CompositeRow_Argb2Graya(dest_scan, src_scan, width, m_BlendType,
+ clip_scan, src_extra_alpha, dst_extra_alpha);
+ } else {
+ CompositeRow_Argb2Gray(dest_scan, src_scan, width, m_BlendType,
+ clip_scan, src_extra_alpha);
+ }
+ } else {
+ if (m_DestFormat & 0x0200) {
+ CompositeRow_Rgb2Graya(dest_scan, src_scan, src_Bpp, width, m_BlendType,
+ clip_scan, dst_extra_alpha);
+ } else {
+ CompositeRow_Rgb2Gray(dest_scan, src_scan, src_Bpp, width, m_BlendType,
+ clip_scan);
+ }
+ }
+ if (m_DestFormat & 0x0400) {
+ for (int i = 0; i < width; i++) {
+ *dest_scan = ~*dest_scan;
+ dest_scan++;
+ }
+ }
+ } else {
+ int dest_Size = width * dest_Bpp + 4;
+ if (dest_Size > m_CacheSize) {
+ m_pCacheScanline = FX_Realloc(uint8_t, m_pCacheScanline, dest_Size);
+ if (!m_pCacheScanline) {
+ return;
+ }
+ m_CacheSize = dest_Size;
+ }
+ switch (m_Transparency) {
+ case 0:
+ case 4:
+ case 8:
+ case 4 + 8: {
+ CompositeRow_Argb2Argb(dest_scan, src_scan, width, m_BlendType,
+ clip_scan, dst_extra_alpha, src_extra_alpha);
+ } break;
+ case 1:
+ CompositeRow_Rgb2Argb_Blend_NoClip(
+ dest_scan, src_scan, width, m_BlendType, src_Bpp, dst_extra_alpha);
+ break;
+ case 1 + 8:
+ CompositeRow_Rgb2Argb_Blend_Clip(dest_scan, src_scan, width,
+ m_BlendType, src_Bpp, clip_scan,
+ dst_extra_alpha);
+ break;
+ case 1 + 4:
+ CompositeRow_Rgb2Argb_NoBlend_NoClip(dest_scan, src_scan, width,
+ src_Bpp, dst_extra_alpha);
+ break;
+ case 1 + 4 + 8:
+ CompositeRow_Rgb2Argb_NoBlend_Clip(dest_scan, src_scan, width, src_Bpp,
+ clip_scan, dst_extra_alpha);
+ break;
+ case 2:
+ case 2 + 8:
+ CompositeRow_Argb2Rgb_Blend(dest_scan, src_scan, width, m_BlendType,
+ dest_Bpp, clip_scan, src_extra_alpha);
+ break;
+ case 2 + 4:
+ case 2 + 4 + 8:
+ CompositeRow_Argb2Rgb_NoBlend(dest_scan, src_scan, width, dest_Bpp,
+ clip_scan, src_extra_alpha);
+ break;
+ case 1 + 2:
+ CompositeRow_Rgb2Rgb_Blend_NoClip(dest_scan, src_scan, width,
+ m_BlendType, dest_Bpp, src_Bpp);
+ break;
+ case 1 + 2 + 8:
+ CompositeRow_Rgb2Rgb_Blend_Clip(dest_scan, src_scan, width, m_BlendType,
+ dest_Bpp, src_Bpp, clip_scan);
+ break;
+ case 1 + 2 + 4:
+ CompositeRow_Rgb2Rgb_NoBlend_NoClip(dest_scan, src_scan, width,
+ dest_Bpp, src_Bpp);
+ break;
+ case 1 + 2 + 4 + 8:
+ CompositeRow_Rgb2Rgb_NoBlend_Clip(dest_scan, src_scan, width, dest_Bpp,
+ src_Bpp, clip_scan);
+ break;
+ }
+ }
+}
+
+void CFX_ScanlineCompositor::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,
+ uint8_t* dst_extra_alpha) {
+ if (m_bRgbByteOrder) {
+ if (m_SrcFormat == FXDIB_1bppRgb) {
+ if (m_DestFormat == FXDIB_8bppRgb) {
+ return;
+ }
+ if (m_DestFormat == FXDIB_Argb) {
+ CompositeRow_1bppRgb2Argb_NoBlend_RgbByteOrder(
+ dest_scan, src_scan, src_left, width, m_pSrcPalette, clip_scan);
+ } else {
+ CompositeRow_1bppRgb2Rgb_NoBlend_RgbByteOrder(
+ dest_scan, src_scan, src_left, m_pSrcPalette, width,
+ (m_DestFormat & 0xff) >> 3, clip_scan);
+ }
+ } else {
+ if (m_DestFormat == FXDIB_8bppRgb) {
+ return;
+ }
+ if (m_DestFormat == FXDIB_Argb) {
+ CompositeRow_8bppRgb2Argb_NoBlend_RgbByteOrder(
+ dest_scan, src_scan, width, m_pSrcPalette, clip_scan);
+ } else {
+ CompositeRow_8bppRgb2Rgb_NoBlend_RgbByteOrder(
+ dest_scan, src_scan, m_pSrcPalette, width,
+ (m_DestFormat & 0xff) >> 3, clip_scan);
+ }
+ }
+ return;
+ }
+ if (m_DestFormat == FXDIB_8bppMask) {
+ CompositeRow_Rgb2Mask(dest_scan, src_scan, width, clip_scan);
+ return;
+ }
+ if ((m_DestFormat & 0xff) == 8) {
+ if (m_Transparency & 8) {
+ if (m_DestFormat & 0x0200) {
+ CompositeRow_1bppPal2Graya(dest_scan, src_scan, src_left,
+ (const uint8_t*)m_pSrcPalette, width,
+ m_BlendType, clip_scan, dst_extra_alpha);
+ } else {
+ CompositeRow_1bppPal2Gray(dest_scan, src_scan, src_left,
+ (const uint8_t*)m_pSrcPalette, width,
+ m_BlendType, clip_scan);
+ }
+ } else {
+ if (m_DestFormat & 0x0200)
+ CompositeRow_8bppPal2Graya(
+ dest_scan, src_scan, (const uint8_t*)m_pSrcPalette, width,
+ m_BlendType, clip_scan, dst_extra_alpha, src_extra_alpha);
+ else
+ CompositeRow_8bppPal2Gray(dest_scan, src_scan,
+ (const uint8_t*)m_pSrcPalette, width,
+ m_BlendType, clip_scan, src_extra_alpha);
+ }
+ } else {
+ switch (m_Transparency) {
+ case 1 + 2:
+ CompositeRow_8bppRgb2Argb_NoBlend(dest_scan, src_scan, width,
+ m_pSrcPalette, clip_scan,
+ src_extra_alpha);
+ break;
+ case 1 + 2 + 8:
+ CompositeRow_1bppRgb2Argb_NoBlend(dest_scan, src_scan, src_left, width,
+ m_pSrcPalette, clip_scan);
+ break;
+ case 0:
+ CompositeRow_8bppRgb2Rgb_NoBlend(dest_scan, src_scan, m_pSrcPalette,
+ width, (m_DestFormat & 0xff) >> 3,
+ clip_scan, src_extra_alpha);
+ break;
+ case 0 + 8:
+ CompositeRow_1bppRgb2Rgb_NoBlend(dest_scan, src_scan, src_left,
+ m_pSrcPalette, width,
+ (m_DestFormat & 0xff) >> 3, clip_scan);
+ break;
+ case 0 + 2:
+ CompositeRow_8bppRgb2Rgb_NoBlend(dest_scan, src_scan, m_pSrcPalette,
+ width, (m_DestFormat & 0xff) >> 3,
+ clip_scan, src_extra_alpha);
+ break;
+ case 0 + 2 + 8:
+ CompositeRow_1bppRgb2Rgba_NoBlend(dest_scan, src_scan, src_left, width,
+ m_pSrcPalette, clip_scan,
+ dst_extra_alpha);
+ break;
+ break;
+ }
+ }
+}
+
+void CFX_ScanlineCompositor::CompositeByteMaskLine(uint8_t* dest_scan,
+ const uint8_t* src_scan,
+ int width,
+ const uint8_t* clip_scan,
+ uint8_t* dst_extra_alpha) {
+ if (m_DestFormat == FXDIB_8bppMask) {
+ CompositeRow_ByteMask2Mask(dest_scan, src_scan, m_MaskAlpha, width,
+ clip_scan);
+ } else if ((m_DestFormat & 0xff) == 8) {
+ if (m_DestFormat & 0x0200) {
+ CompositeRow_ByteMask2Graya(dest_scan, src_scan, m_MaskAlpha, m_MaskRed,
+ width, clip_scan, dst_extra_alpha);
+ } else {
+ CompositeRow_ByteMask2Gray(dest_scan, src_scan, m_MaskAlpha, m_MaskRed,
+ width, clip_scan);
+ }
+ } else if (m_bRgbByteOrder) {
+ if (m_DestFormat == FXDIB_Argb) {
+ CompositeRow_ByteMask2Argb_RgbByteOrder(
+ dest_scan, src_scan, m_MaskAlpha, m_MaskRed, m_MaskGreen, m_MaskBlue,
+ width, m_BlendType, clip_scan);
+ } else {
+ CompositeRow_ByteMask2Rgb_RgbByteOrder(
+ dest_scan, src_scan, m_MaskAlpha, m_MaskRed, m_MaskGreen, m_MaskBlue,
+ width, m_BlendType, (m_DestFormat & 0xff) >> 3, clip_scan);
+ }
+ return;
+ } else if (m_DestFormat == FXDIB_Argb) {
+ CompositeRow_ByteMask2Argb(dest_scan, src_scan, m_MaskAlpha, m_MaskRed,
+ m_MaskGreen, m_MaskBlue, width, m_BlendType,
+ clip_scan);
+ } else if (m_DestFormat == FXDIB_Rgb || m_DestFormat == FXDIB_Rgb32) {
+ CompositeRow_ByteMask2Rgb(dest_scan, src_scan, m_MaskAlpha, m_MaskRed,
+ m_MaskGreen, m_MaskBlue, width, m_BlendType,
+ (m_DestFormat & 0xff) >> 3, clip_scan);
+ } else if (m_DestFormat == FXDIB_Rgba) {
+ CompositeRow_ByteMask2Rgba(dest_scan, src_scan, m_MaskAlpha, m_MaskRed,
+ m_MaskGreen, m_MaskBlue, width, m_BlendType,
+ clip_scan, dst_extra_alpha);
+ }
+}
+
+void CFX_ScanlineCompositor::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) {
+ if (m_DestFormat == FXDIB_8bppMask) {
+ CompositeRow_BitMask2Mask(dest_scan, src_scan, m_MaskAlpha, src_left, width,
+ clip_scan);
+ } else if ((m_DestFormat & 0xff) == 8) {
+ if (m_DestFormat & 0x0200) {
+ CompositeRow_BitMask2Graya(dest_scan, src_scan, m_MaskAlpha, m_MaskRed,
+ src_left, width, clip_scan, dst_extra_alpha);
+ } else {
+ CompositeRow_BitMask2Gray(dest_scan, src_scan, m_MaskAlpha, m_MaskRed,
+ src_left, width, clip_scan);
+ }
+ } else if (m_bRgbByteOrder) {
+ if (m_DestFormat == FXDIB_Argb) {
+ CompositeRow_BitMask2Argb_RgbByteOrder(
+ dest_scan, src_scan, m_MaskAlpha, m_MaskRed, m_MaskGreen, m_MaskBlue,
+ src_left, width, m_BlendType, clip_scan);
+ } else {
+ CompositeRow_BitMask2Rgb_RgbByteOrder(
+ dest_scan, src_scan, m_MaskAlpha, m_MaskRed, m_MaskGreen, m_MaskBlue,
+ src_left, width, m_BlendType, (m_DestFormat & 0xff) >> 3, clip_scan);
+ }
+ return;
+ } else if (m_DestFormat == FXDIB_Argb) {
+ CompositeRow_BitMask2Argb(dest_scan, src_scan, m_MaskAlpha, m_MaskRed,
+ m_MaskGreen, m_MaskBlue, src_left, width,
+ m_BlendType, clip_scan);
+ } else if (m_DestFormat == FXDIB_Rgb || m_DestFormat == FXDIB_Rgb32) {
+ CompositeRow_BitMask2Rgb(
+ dest_scan, src_scan, m_MaskAlpha, m_MaskRed, m_MaskGreen, m_MaskBlue,
+ src_left, width, m_BlendType, (m_DestFormat & 0xff) >> 3, clip_scan);
+ }
+}
diff --git a/chromium/third_party/pdfium/core/fxge/dib/cfx_scanlinecompositor.h b/chromium/third_party/pdfium/core/fxge/dib/cfx_scanlinecompositor.h
new file mode 100644
index 00000000000..a933a89b46d
--- /dev/null
+++ b/chromium/third_party/pdfium/core/fxge/dib/cfx_scanlinecompositor.h
@@ -0,0 +1,72 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef CORE_FXGE_DIB_CFX_SCANLINECOMPOSITOR_H_
+#define CORE_FXGE_DIB_CFX_SCANLINECOMPOSITOR_H_
+
+#include "core/fxge/dib/cfx_dibsource.h"
+
+class CFX_ScanlineCompositor {
+ public:
+ CFX_ScanlineCompositor();
+
+ ~CFX_ScanlineCompositor();
+
+ bool Init(FXDIB_Format dest_format,
+ FXDIB_Format src_format,
+ int32_t width,
+ uint32_t* pSrcPalette,
+ uint32_t mask_color,
+ int blend_type,
+ bool bClip,
+ bool bRgbByteOrder = false,
+ int alpha_flag = 0);
+
+ void CompositeRgbBitmapLine(uint8_t* dest_scan,
+ const uint8_t* src_scan,
+ int width,
+ const uint8_t* clip_scan,
+ const uint8_t* src_extra_alpha = nullptr,
+ uint8_t* dst_extra_alpha = nullptr);
+
+ 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 = nullptr,
+ uint8_t* dst_extra_alpha = nullptr);
+
+ void CompositeByteMaskLine(uint8_t* dest_scan,
+ const uint8_t* src_scan,
+ int width,
+ const uint8_t* clip_scan,
+ uint8_t* dst_extra_alpha = nullptr);
+
+ 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 = nullptr);
+
+ private:
+ int m_Transparency;
+ FXDIB_Format m_SrcFormat;
+ FXDIB_Format m_DestFormat;
+ uint32_t* m_pSrcPalette;
+ int m_MaskAlpha;
+ int m_MaskRed;
+ int m_MaskGreen;
+ int m_MaskBlue;
+ int m_MaskBlack;
+ int m_BlendType;
+ uint8_t* m_pCacheScanline;
+ int m_CacheSize;
+ bool m_bRgbByteOrder;
+};
+
+#endif // CORE_FXGE_DIB_CFX_SCANLINECOMPOSITOR_H_
diff --git a/chromium/third_party/pdfium/core/fxge/dib/cstretchengine.cpp b/chromium/third_party/pdfium/core/fxge/dib/cstretchengine.cpp
new file mode 100644
index 00000000000..00253314867
--- /dev/null
+++ b/chromium/third_party/pdfium/core/fxge/dib/cstretchengine.cpp
@@ -0,0 +1,830 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "core/fxge/dib/cstretchengine.h"
+
+#include "core/fxge/dib/cfx_dibitmap.h"
+#include "core/fxge/dib/cfx_dibsource.h"
+#include "core/fxge/dib/ifx_scanlinecomposer.h"
+#include "core/fxge/fx_dib.h"
+
+CStretchEngine::CWeightTable::CWeightTable()
+ : m_DestMin(0),
+ m_ItemSize(0),
+ m_pWeightTables(nullptr),
+ m_dwWeightTablesSize(0) {}
+
+CStretchEngine::CWeightTable::~CWeightTable() {
+ FX_Free(m_pWeightTables);
+}
+
+size_t CStretchEngine::CWeightTable::GetPixelWeightSize() const {
+ return m_ItemSize / sizeof(int) - 2;
+}
+
+bool CStretchEngine::CWeightTable::Calc(int dest_len,
+ int dest_min,
+ int dest_max,
+ int src_len,
+ int src_min,
+ int src_max,
+ int flags) {
+ FX_Free(m_pWeightTables);
+ m_pWeightTables = nullptr;
+ m_dwWeightTablesSize = 0;
+ const double scale = (float)src_len / (float)dest_len;
+ const double base = dest_len < 0 ? (float)(src_len) : 0;
+ const int ext_size = flags & FXDIB_BICUBIC_INTERPOL ? 3 : 1;
+ m_ItemSize = sizeof(int) * 2 +
+ (int)(sizeof(int) * (ceil(fabs((float)scale)) + ext_size));
+ m_DestMin = dest_min;
+ if ((dest_max - dest_min) > (int)((1U << 30) - 4) / m_ItemSize)
+ return false;
+
+ m_dwWeightTablesSize = (dest_max - dest_min) * m_ItemSize + 4;
+ m_pWeightTables = FX_TryAlloc(uint8_t, m_dwWeightTablesSize);
+ if (!m_pWeightTables)
+ return false;
+
+ if ((flags & FXDIB_NOSMOOTH) != 0 || fabs((float)scale) < 1.0f) {
+ for (int dest_pixel = dest_min; dest_pixel < dest_max; dest_pixel++) {
+ PixelWeight& pixel_weights = *GetPixelWeight(dest_pixel);
+ double src_pos = dest_pixel * scale + scale / 2 + base;
+ if (flags & FXDIB_INTERPOL) {
+ pixel_weights.m_SrcStart = (int)floor((float)src_pos - 1.0f / 2);
+ pixel_weights.m_SrcEnd = (int)floor((float)src_pos + 1.0f / 2);
+ if (pixel_weights.m_SrcStart < src_min) {
+ pixel_weights.m_SrcStart = src_min;
+ }
+ if (pixel_weights.m_SrcEnd >= src_max) {
+ pixel_weights.m_SrcEnd = src_max - 1;
+ }
+ if (pixel_weights.m_SrcStart == pixel_weights.m_SrcEnd) {
+ pixel_weights.m_Weights[0] = 65536;
+ } else {
+ pixel_weights.m_Weights[1] = FXSYS_round(
+ (float)(src_pos - pixel_weights.m_SrcStart - 1.0f / 2) * 65536);
+ pixel_weights.m_Weights[0] = 65536 - pixel_weights.m_Weights[1];
+ }
+ } else if (flags & FXDIB_BICUBIC_INTERPOL) {
+ pixel_weights.m_SrcStart = (int)floor((float)src_pos - 1.0f / 2);
+ pixel_weights.m_SrcEnd = (int)floor((float)src_pos + 1.0f / 2);
+ int start = pixel_weights.m_SrcStart - 1;
+ int end = pixel_weights.m_SrcEnd + 1;
+ if (start < src_min) {
+ start = src_min;
+ }
+ if (end >= src_max) {
+ end = src_max - 1;
+ }
+ if (pixel_weights.m_SrcStart < src_min) {
+ src_pos += src_min - pixel_weights.m_SrcStart;
+ pixel_weights.m_SrcStart = src_min;
+ }
+ if (pixel_weights.m_SrcEnd >= src_max) {
+ pixel_weights.m_SrcEnd = src_max - 1;
+ }
+ int weight;
+ weight = FXSYS_round(
+ (float)(src_pos - pixel_weights.m_SrcStart - 1.0f / 2) * 256);
+ if (start == end) {
+ pixel_weights.m_Weights[0] =
+ (SDP_Table[256 + weight] + SDP_Table[weight] +
+ SDP_Table[256 - weight] + SDP_Table[512 - weight])
+ << 8;
+ } else if ((start == pixel_weights.m_SrcStart &&
+ (pixel_weights.m_SrcStart == pixel_weights.m_SrcEnd ||
+ end == pixel_weights.m_SrcEnd) &&
+ start < end) ||
+ (start < pixel_weights.m_SrcStart &&
+ pixel_weights.m_SrcStart == pixel_weights.m_SrcEnd &&
+ end == pixel_weights.m_SrcEnd)) {
+ if (start < pixel_weights.m_SrcStart) {
+ pixel_weights.m_Weights[0] = SDP_Table[256 + weight] << 8;
+ pixel_weights.m_Weights[1] =
+ (SDP_Table[weight] + SDP_Table[256 - weight] +
+ SDP_Table[512 - weight])
+ << 8;
+ } else {
+ if (pixel_weights.m_SrcStart == pixel_weights.m_SrcEnd) {
+ pixel_weights.m_Weights[0] =
+ (SDP_Table[256 + weight] + SDP_Table[weight] +
+ SDP_Table[256 - weight])
+ << 8;
+ pixel_weights.m_Weights[1] = SDP_Table[512 - weight] << 8;
+ } else {
+ pixel_weights.m_Weights[0] =
+ (SDP_Table[256 + weight] + SDP_Table[weight]) << 8;
+ pixel_weights.m_Weights[1] =
+ (SDP_Table[256 - weight] + SDP_Table[512 - weight]) << 8;
+ }
+ }
+ if (pixel_weights.m_SrcStart == pixel_weights.m_SrcEnd) {
+ pixel_weights.m_SrcEnd = end;
+ }
+ if (start < pixel_weights.m_SrcStart) {
+ pixel_weights.m_SrcStart = start;
+ }
+ } else if (start == pixel_weights.m_SrcStart &&
+ start < pixel_weights.m_SrcEnd &&
+ pixel_weights.m_SrcEnd < end) {
+ pixel_weights.m_Weights[0] =
+ (SDP_Table[256 + weight] + SDP_Table[weight]) << 8;
+ pixel_weights.m_Weights[1] = SDP_Table[256 - weight] << 8;
+ pixel_weights.m_Weights[2] = SDP_Table[512 - weight] << 8;
+ pixel_weights.m_SrcEnd = end;
+ } else if (start < pixel_weights.m_SrcStart &&
+ pixel_weights.m_SrcStart < pixel_weights.m_SrcEnd &&
+ pixel_weights.m_SrcEnd == end) {
+ pixel_weights.m_Weights[0] = SDP_Table[256 + weight] << 8;
+ pixel_weights.m_Weights[1] = SDP_Table[weight] << 8;
+ pixel_weights.m_Weights[2] =
+ (SDP_Table[256 - weight] + SDP_Table[512 - weight]) << 8;
+ pixel_weights.m_SrcStart = start;
+ } else {
+ pixel_weights.m_Weights[0] = SDP_Table[256 + weight] << 8;
+ pixel_weights.m_Weights[1] = SDP_Table[weight] << 8;
+ pixel_weights.m_Weights[2] = SDP_Table[256 - weight] << 8;
+ pixel_weights.m_Weights[3] = SDP_Table[512 - weight] << 8;
+ pixel_weights.m_SrcStart = start;
+ pixel_weights.m_SrcEnd = end;
+ }
+ } else {
+ pixel_weights.m_SrcStart = pixel_weights.m_SrcEnd =
+ (int)floor((float)src_pos);
+ if (pixel_weights.m_SrcStart < src_min) {
+ pixel_weights.m_SrcStart = src_min;
+ }
+ if (pixel_weights.m_SrcEnd >= src_max) {
+ pixel_weights.m_SrcEnd = src_max - 1;
+ }
+ pixel_weights.m_Weights[0] = 65536;
+ }
+ }
+ return true;
+ }
+
+ for (int dest_pixel = dest_min; dest_pixel < dest_max; dest_pixel++) {
+ PixelWeight& pixel_weights = *GetPixelWeight(dest_pixel);
+ double src_start = dest_pixel * scale + base;
+ double src_end = src_start + scale;
+ int start_i, end_i;
+ if (src_start < src_end) {
+ start_i = (int)floor((float)src_start);
+ end_i = (int)ceil((float)src_end);
+ } else {
+ start_i = (int)floor((float)src_end);
+ end_i = (int)ceil((float)src_start);
+ }
+ if (start_i < src_min) {
+ start_i = src_min;
+ }
+ if (end_i >= src_max) {
+ end_i = src_max - 1;
+ }
+ if (start_i > end_i) {
+ if (start_i >= src_max) {
+ start_i = src_max - 1;
+ }
+ pixel_weights.m_SrcStart = start_i;
+ pixel_weights.m_SrcEnd = start_i;
+ continue;
+ }
+ pixel_weights.m_SrcStart = start_i;
+ pixel_weights.m_SrcEnd = end_i;
+ for (int j = start_i; j <= end_i; j++) {
+ double dest_start = ((float)j - base) / scale;
+ double dest_end = ((float)(j + 1) - base) / scale;
+ if (dest_start > dest_end) {
+ double temp = dest_start;
+ dest_start = dest_end;
+ dest_end = temp;
+ }
+ double area_start =
+ dest_start > (float)(dest_pixel) ? dest_start : (float)(dest_pixel);
+ double area_end = dest_end > (float)(dest_pixel + 1)
+ ? (float)(dest_pixel + 1)
+ : dest_end;
+ double weight = area_start >= area_end ? 0.0f : area_end - area_start;
+ if (weight == 0 && j == end_i) {
+ pixel_weights.m_SrcEnd--;
+ break;
+ }
+ size_t idx = j - start_i;
+ if (idx >= GetPixelWeightSize())
+ return false;
+ pixel_weights.m_Weights[idx] = FXSYS_round((float)(weight * 65536));
+ }
+ }
+ return true;
+}
+
+PixelWeight* CStretchEngine::CWeightTable::GetPixelWeight(int pixel) const {
+ ASSERT(pixel >= m_DestMin);
+ return reinterpret_cast<PixelWeight*>(m_pWeightTables +
+ (pixel - m_DestMin) * m_ItemSize);
+}
+
+int* CStretchEngine::CWeightTable::GetValueFromPixelWeight(PixelWeight* pWeight,
+ int index) const {
+ if (index < pWeight->m_SrcStart)
+ return nullptr;
+
+ size_t idx = index - pWeight->m_SrcStart;
+ return idx < GetPixelWeightSize() ? &pWeight->m_Weights[idx] : nullptr;
+}
+
+CStretchEngine::CStretchEngine(IFX_ScanlineComposer* pDestBitmap,
+ FXDIB_Format dest_format,
+ int dest_width,
+ int dest_height,
+ const FX_RECT& clip_rect,
+ const CFX_RetainPtr<CFX_DIBSource>& pSrcBitmap,
+ int flags) {
+ m_State = 0;
+ m_DestFormat = dest_format;
+ m_DestBpp = dest_format & 0xff;
+ m_SrcBpp = pSrcBitmap->GetFormat() & 0xff;
+ m_bHasAlpha = pSrcBitmap->GetFormat() & 0x200;
+ m_pSrcPalette = pSrcBitmap->GetPalette();
+ m_pDestBitmap = pDestBitmap;
+ m_DestWidth = dest_width;
+ m_DestHeight = dest_height;
+ m_pInterBuf = nullptr;
+ m_pExtraAlphaBuf = nullptr;
+ m_pDestMaskScanline = nullptr;
+ m_DestClip = clip_rect;
+ uint32_t size = clip_rect.Width();
+ if (size && m_DestBpp > (int)(INT_MAX / size)) {
+ return;
+ }
+ size *= m_DestBpp;
+ if (size > INT_MAX - 31) {
+ return;
+ }
+ size += 31;
+ size = size / 32 * 4;
+ m_pDestScanline = FX_TryAlloc(uint8_t, size);
+ if (!m_pDestScanline) {
+ return;
+ }
+ if (dest_format == FXDIB_Rgb32) {
+ memset(m_pDestScanline, 255, size);
+ }
+ m_InterPitch = (m_DestClip.Width() * m_DestBpp + 31) / 32 * 4;
+ m_ExtraMaskPitch = (m_DestClip.Width() * 8 + 31) / 32 * 4;
+ m_pInterBuf = nullptr;
+ m_pSource = pSrcBitmap;
+ m_SrcWidth = pSrcBitmap->GetWidth();
+ m_SrcHeight = pSrcBitmap->GetHeight();
+ m_SrcPitch = (m_SrcWidth * m_SrcBpp + 31) / 32 * 4;
+ if ((flags & FXDIB_NOSMOOTH) == 0) {
+ bool bInterpol = flags & FXDIB_INTERPOL || flags & FXDIB_BICUBIC_INTERPOL;
+ if (!bInterpol && abs(dest_width) != 0 &&
+ abs(dest_height) / 8 < static_cast<long long>(m_SrcWidth) *
+ m_SrcHeight / abs(dest_width)) {
+ flags = FXDIB_INTERPOL;
+ }
+ m_Flags = flags;
+ } else {
+ m_Flags = FXDIB_NOSMOOTH;
+ if (flags & FXDIB_DOWNSAMPLE) {
+ m_Flags |= FXDIB_DOWNSAMPLE;
+ }
+ }
+ double scale_x = (float)m_SrcWidth / (float)m_DestWidth;
+ double scale_y = (float)m_SrcHeight / (float)m_DestHeight;
+ double base_x = m_DestWidth > 0 ? 0.0f : (float)(m_DestWidth);
+ double base_y = m_DestHeight > 0 ? 0.0f : (float)(m_DestHeight);
+ double src_left = scale_x * ((float)(clip_rect.left) + base_x);
+ double src_right = scale_x * ((float)(clip_rect.right) + base_x);
+ double src_top = scale_y * ((float)(clip_rect.top) + base_y);
+ double src_bottom = scale_y * ((float)(clip_rect.bottom) + base_y);
+ if (src_left > src_right) {
+ double temp = src_left;
+ src_left = src_right;
+ src_right = temp;
+ }
+ if (src_top > src_bottom) {
+ double temp = src_top;
+ src_top = src_bottom;
+ src_bottom = temp;
+ }
+ m_SrcClip.left = (int)floor((float)src_left);
+ m_SrcClip.right = (int)ceil((float)src_right);
+ m_SrcClip.top = (int)floor((float)src_top);
+ m_SrcClip.bottom = (int)ceil((float)src_bottom);
+ FX_RECT src_rect(0, 0, m_SrcWidth, m_SrcHeight);
+ m_SrcClip.Intersect(src_rect);
+ if (m_SrcBpp == 1) {
+ if (m_DestBpp == 8) {
+ m_TransMethod = 1;
+ } else {
+ m_TransMethod = 2;
+ }
+ } else if (m_SrcBpp == 8) {
+ if (m_DestBpp == 8) {
+ if (!m_bHasAlpha) {
+ m_TransMethod = 3;
+ } else {
+ m_TransMethod = 4;
+ }
+ } else {
+ if (!m_bHasAlpha) {
+ m_TransMethod = 5;
+ } else {
+ m_TransMethod = 6;
+ }
+ }
+ } else {
+ if (!m_bHasAlpha) {
+ m_TransMethod = 7;
+ } else {
+ m_TransMethod = 8;
+ }
+ }
+}
+
+CStretchEngine::~CStretchEngine() {
+ FX_Free(m_pDestScanline);
+ FX_Free(m_pInterBuf);
+ FX_Free(m_pExtraAlphaBuf);
+ FX_Free(m_pDestMaskScanline);
+}
+
+bool CStretchEngine::Continue(IFX_Pause* pPause) {
+ while (m_State == 1) {
+ if (ContinueStretchHorz(pPause)) {
+ return true;
+ }
+ m_State = 2;
+ StretchVert();
+ }
+ return false;
+}
+
+bool CStretchEngine::StartStretchHorz() {
+ if (m_DestWidth == 0 || m_InterPitch == 0 || !m_pDestScanline)
+ return false;
+
+ if (m_SrcClip.Height() == 0 ||
+ m_SrcClip.Height() > (1 << 29) / m_InterPitch) {
+ return false;
+ }
+
+ m_pInterBuf = FX_TryAlloc(unsigned char, m_SrcClip.Height() * m_InterPitch);
+ if (!m_pInterBuf)
+ return false;
+
+ if (m_pSource && m_bHasAlpha && m_pSource->m_pAlphaMask) {
+ m_pExtraAlphaBuf =
+ FX_Alloc2D(unsigned char, m_SrcClip.Height(), m_ExtraMaskPitch);
+ uint32_t size = (m_DestClip.Width() * 8 + 31) / 32 * 4;
+ m_pDestMaskScanline = FX_TryAlloc(unsigned char, size);
+ if (!m_pDestMaskScanline)
+ return false;
+ }
+ bool ret =
+ m_WeightTable.Calc(m_DestWidth, m_DestClip.left, m_DestClip.right,
+ m_SrcWidth, m_SrcClip.left, m_SrcClip.right, m_Flags);
+ if (!ret)
+ return false;
+
+ m_CurRow = m_SrcClip.top;
+ m_State = 1;
+ return true;
+}
+
+bool CStretchEngine::ContinueStretchHorz(IFX_Pause* pPause) {
+ if (!m_DestWidth)
+ return false;
+
+ if (m_pSource->SkipToScanline(m_CurRow, pPause))
+ return true;
+
+ int Bpp = m_DestBpp / 8;
+ static const int kStrechPauseRows = 10;
+ int rows_to_go = kStrechPauseRows;
+ for (; m_CurRow < m_SrcClip.bottom; m_CurRow++) {
+ if (rows_to_go == 0) {
+ if (pPause && pPause->NeedToPauseNow())
+ return true;
+
+ rows_to_go = kStrechPauseRows;
+ }
+
+ const uint8_t* src_scan = m_pSource->GetScanline(m_CurRow);
+ uint8_t* dest_scan =
+ m_pInterBuf + (m_CurRow - m_SrcClip.top) * m_InterPitch;
+ const uint8_t* src_scan_mask = nullptr;
+ uint8_t* dest_scan_mask = nullptr;
+ if (m_pExtraAlphaBuf) {
+ src_scan_mask = m_pSource->m_pAlphaMask->GetScanline(m_CurRow);
+ dest_scan_mask =
+ m_pExtraAlphaBuf + (m_CurRow - m_SrcClip.top) * m_ExtraMaskPitch;
+ }
+ switch (m_TransMethod) {
+ case 1:
+ case 2: {
+ for (int col = m_DestClip.left; col < m_DestClip.right; col++) {
+ PixelWeight* pPixelWeights = m_WeightTable.GetPixelWeight(col);
+ int dest_a = 0;
+ for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd;
+ j++) {
+ int* pWeight =
+ m_WeightTable.GetValueFromPixelWeight(pPixelWeights, j);
+ if (!pWeight)
+ return false;
+
+ int pixel_weight = *pWeight;
+ if (src_scan[j / 8] & (1 << (7 - j % 8))) {
+ dest_a += pixel_weight * 255;
+ }
+ }
+ if (m_Flags & FXDIB_BICUBIC_INTERPOL) {
+ dest_a = dest_a < 0 ? 0 : dest_a > 16711680 ? 16711680 : dest_a;
+ }
+ *dest_scan++ = (uint8_t)(dest_a >> 16);
+ }
+ break;
+ }
+ case 3: {
+ for (int col = m_DestClip.left; col < m_DestClip.right; col++) {
+ PixelWeight* pPixelWeights = m_WeightTable.GetPixelWeight(col);
+ int dest_a = 0;
+ for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd;
+ j++) {
+ int* pWeight =
+ m_WeightTable.GetValueFromPixelWeight(pPixelWeights, j);
+ if (!pWeight)
+ return false;
+
+ int pixel_weight = *pWeight;
+ dest_a += pixel_weight * src_scan[j];
+ }
+ if (m_Flags & FXDIB_BICUBIC_INTERPOL) {
+ dest_a = dest_a < 0 ? 0 : dest_a > 16711680 ? 16711680 : dest_a;
+ }
+ *dest_scan++ = (uint8_t)(dest_a >> 16);
+ }
+ break;
+ }
+ case 4: {
+ for (int col = m_DestClip.left; col < m_DestClip.right; col++) {
+ PixelWeight* pPixelWeights = m_WeightTable.GetPixelWeight(col);
+ int dest_a = 0, dest_r = 0;
+ for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd;
+ j++) {
+ int* pWeight =
+ m_WeightTable.GetValueFromPixelWeight(pPixelWeights, j);
+ if (!pWeight)
+ return false;
+
+ int pixel_weight = *pWeight;
+ pixel_weight = pixel_weight * src_scan_mask[j] / 255;
+ dest_r += pixel_weight * src_scan[j];
+ dest_a += pixel_weight;
+ }
+ if (m_Flags & FXDIB_BICUBIC_INTERPOL) {
+ dest_r = dest_r < 0 ? 0 : dest_r > 16711680 ? 16711680 : dest_r;
+ dest_a = dest_a < 0 ? 0 : dest_a > 65536 ? 65536 : dest_a;
+ }
+ *dest_scan++ = (uint8_t)(dest_r >> 16);
+ *dest_scan_mask++ = (uint8_t)((dest_a * 255) >> 16);
+ }
+ break;
+ }
+ case 5: {
+ for (int col = m_DestClip.left; col < m_DestClip.right; col++) {
+ PixelWeight* pPixelWeights = m_WeightTable.GetPixelWeight(col);
+ int dest_r_y = 0, dest_g_m = 0, dest_b_c = 0;
+ for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd;
+ j++) {
+ int* pWeight =
+ m_WeightTable.GetValueFromPixelWeight(pPixelWeights, j);
+ if (!pWeight)
+ return false;
+
+ int pixel_weight = *pWeight;
+ unsigned long argb_cmyk = m_pSrcPalette[src_scan[j]];
+ if (m_DestFormat == FXDIB_Rgb) {
+ dest_r_y += pixel_weight * (uint8_t)(argb_cmyk >> 16);
+ dest_g_m += pixel_weight * (uint8_t)(argb_cmyk >> 8);
+ dest_b_c += pixel_weight * (uint8_t)argb_cmyk;
+ } else {
+ dest_b_c += pixel_weight * (uint8_t)(argb_cmyk >> 24);
+ dest_g_m += pixel_weight * (uint8_t)(argb_cmyk >> 16);
+ dest_r_y += pixel_weight * (uint8_t)(argb_cmyk >> 8);
+ }
+ }
+ if (m_Flags & FXDIB_BICUBIC_INTERPOL) {
+ dest_r_y =
+ dest_r_y < 0 ? 0 : dest_r_y > 16711680 ? 16711680 : dest_r_y;
+ dest_g_m =
+ dest_g_m < 0 ? 0 : dest_g_m > 16711680 ? 16711680 : dest_g_m;
+ dest_b_c =
+ dest_b_c < 0 ? 0 : dest_b_c > 16711680 ? 16711680 : dest_b_c;
+ }
+ *dest_scan++ = (uint8_t)(dest_b_c >> 16);
+ *dest_scan++ = (uint8_t)(dest_g_m >> 16);
+ *dest_scan++ = (uint8_t)(dest_r_y >> 16);
+ }
+ break;
+ }
+ case 6: {
+ for (int col = m_DestClip.left; col < m_DestClip.right; col++) {
+ PixelWeight* pPixelWeights = m_WeightTable.GetPixelWeight(col);
+ int dest_a = 0, dest_r_y = 0, dest_g_m = 0, dest_b_c = 0;
+ for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd;
+ j++) {
+ int* pWeight =
+ m_WeightTable.GetValueFromPixelWeight(pPixelWeights, j);
+ if (!pWeight)
+ return false;
+
+ int pixel_weight = *pWeight;
+ pixel_weight = pixel_weight * src_scan_mask[j] / 255;
+ unsigned long argb_cmyk = m_pSrcPalette[src_scan[j]];
+ if (m_DestFormat == FXDIB_Rgba) {
+ dest_r_y += pixel_weight * (uint8_t)(argb_cmyk >> 16);
+ dest_g_m += pixel_weight * (uint8_t)(argb_cmyk >> 8);
+ dest_b_c += pixel_weight * (uint8_t)argb_cmyk;
+ } else {
+ dest_b_c += pixel_weight * (uint8_t)(argb_cmyk >> 24);
+ dest_g_m += pixel_weight * (uint8_t)(argb_cmyk >> 16);
+ dest_r_y += pixel_weight * (uint8_t)(argb_cmyk >> 8);
+ }
+ dest_a += pixel_weight;
+ }
+ if (m_Flags & FXDIB_BICUBIC_INTERPOL) {
+ dest_b_c =
+ dest_b_c < 0 ? 0 : dest_b_c > 16711680 ? 16711680 : dest_b_c;
+ dest_g_m =
+ dest_g_m < 0 ? 0 : dest_g_m > 16711680 ? 16711680 : dest_g_m;
+ dest_r_y =
+ dest_r_y < 0 ? 0 : dest_r_y > 16711680 ? 16711680 : dest_r_y;
+ dest_a = dest_a < 0 ? 0 : dest_a > 65536 ? 65536 : dest_a;
+ }
+ *dest_scan++ = (uint8_t)(dest_b_c >> 16);
+ *dest_scan++ = (uint8_t)(dest_g_m >> 16);
+ *dest_scan++ = (uint8_t)(dest_r_y >> 16);
+ *dest_scan_mask++ = (uint8_t)((dest_a * 255) >> 16);
+ }
+ break;
+ }
+ case 7: {
+ for (int col = m_DestClip.left; col < m_DestClip.right; col++) {
+ PixelWeight* pPixelWeights = m_WeightTable.GetPixelWeight(col);
+ int dest_r_y = 0, dest_g_m = 0, dest_b_c = 0;
+ for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd;
+ j++) {
+ int* pWeight =
+ m_WeightTable.GetValueFromPixelWeight(pPixelWeights, j);
+ if (!pWeight)
+ return false;
+
+ int pixel_weight = *pWeight;
+ const uint8_t* src_pixel = src_scan + j * Bpp;
+ dest_b_c += pixel_weight * (*src_pixel++);
+ dest_g_m += pixel_weight * (*src_pixel++);
+ dest_r_y += pixel_weight * (*src_pixel);
+ }
+ if (m_Flags & FXDIB_BICUBIC_INTERPOL) {
+ dest_b_c =
+ dest_b_c < 0 ? 0 : dest_b_c > 16711680 ? 16711680 : dest_b_c;
+ dest_g_m =
+ dest_g_m < 0 ? 0 : dest_g_m > 16711680 ? 16711680 : dest_g_m;
+ dest_r_y =
+ dest_r_y < 0 ? 0 : dest_r_y > 16711680 ? 16711680 : dest_r_y;
+ }
+ *dest_scan++ = (uint8_t)((dest_b_c) >> 16);
+ *dest_scan++ = (uint8_t)((dest_g_m) >> 16);
+ *dest_scan++ = (uint8_t)((dest_r_y) >> 16);
+ dest_scan += Bpp - 3;
+ }
+ break;
+ }
+ case 8: {
+ for (int col = m_DestClip.left; col < m_DestClip.right; col++) {
+ PixelWeight* pPixelWeights = m_WeightTable.GetPixelWeight(col);
+ int dest_a = 0, dest_r_y = 0, dest_g_m = 0, dest_b_c = 0;
+ for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd;
+ j++) {
+ int* pWeight =
+ m_WeightTable.GetValueFromPixelWeight(pPixelWeights, j);
+ if (!pWeight)
+ return false;
+
+ int pixel_weight = *pWeight;
+ const uint8_t* src_pixel = src_scan + j * Bpp;
+ if (m_DestFormat == FXDIB_Argb) {
+ pixel_weight = pixel_weight * src_pixel[3] / 255;
+ } else {
+ pixel_weight = pixel_weight * src_scan_mask[j] / 255;
+ }
+ dest_b_c += pixel_weight * (*src_pixel++);
+ dest_g_m += pixel_weight * (*src_pixel++);
+ dest_r_y += pixel_weight * (*src_pixel);
+ dest_a += pixel_weight;
+ }
+ if (m_Flags & FXDIB_BICUBIC_INTERPOL) {
+ dest_r_y =
+ dest_r_y < 0 ? 0 : dest_r_y > 16711680 ? 16711680 : dest_r_y;
+ dest_g_m =
+ dest_g_m < 0 ? 0 : dest_g_m > 16711680 ? 16711680 : dest_g_m;
+ dest_b_c =
+ dest_b_c < 0 ? 0 : dest_b_c > 16711680 ? 16711680 : dest_b_c;
+ dest_a = dest_a < 0 ? 0 : dest_a > 65536 ? 65536 : dest_a;
+ }
+ *dest_scan++ = (uint8_t)((dest_b_c) >> 16);
+ *dest_scan++ = (uint8_t)((dest_g_m) >> 16);
+ *dest_scan++ = (uint8_t)((dest_r_y) >> 16);
+ if (m_DestFormat == FXDIB_Argb) {
+ *dest_scan = (uint8_t)((dest_a * 255) >> 16);
+ }
+ if (dest_scan_mask) {
+ *dest_scan_mask++ = (uint8_t)((dest_a * 255) >> 16);
+ }
+ dest_scan += Bpp - 3;
+ }
+ break;
+ }
+ }
+ rows_to_go--;
+ }
+ return false;
+}
+
+void CStretchEngine::StretchVert() {
+ if (m_DestHeight == 0)
+ return;
+
+ CWeightTable table;
+ bool ret = table.Calc(m_DestHeight, m_DestClip.top, m_DestClip.bottom,
+ m_SrcHeight, m_SrcClip.top, m_SrcClip.bottom, m_Flags);
+ if (!ret)
+ return;
+
+ const int DestBpp = m_DestBpp / 8;
+ for (int row = m_DestClip.top; row < m_DestClip.bottom; row++) {
+ unsigned char* dest_scan = m_pDestScanline;
+ unsigned char* dest_scan_mask = m_pDestMaskScanline;
+ PixelWeight* pPixelWeights = table.GetPixelWeight(row);
+ switch (m_TransMethod) {
+ case 1:
+ case 2:
+ case 3: {
+ for (int col = m_DestClip.left; col < m_DestClip.right; col++) {
+ unsigned char* src_scan =
+ m_pInterBuf + (col - m_DestClip.left) * DestBpp;
+ int dest_a = 0;
+ for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd;
+ j++) {
+ int* pWeight = table.GetValueFromPixelWeight(pPixelWeights, j);
+ if (!pWeight)
+ return;
+
+ int pixel_weight = *pWeight;
+ dest_a +=
+ pixel_weight * src_scan[(j - m_SrcClip.top) * m_InterPitch];
+ }
+ if (m_Flags & FXDIB_BICUBIC_INTERPOL) {
+ dest_a = dest_a < 0 ? 0 : dest_a > 16711680 ? 16711680 : dest_a;
+ }
+ *dest_scan = (uint8_t)(dest_a >> 16);
+ dest_scan += DestBpp;
+ }
+ break;
+ }
+ case 4: {
+ for (int col = m_DestClip.left; col < m_DestClip.right; col++) {
+ unsigned char* src_scan =
+ m_pInterBuf + (col - m_DestClip.left) * DestBpp;
+ unsigned char* src_scan_mask =
+ m_pExtraAlphaBuf + (col - m_DestClip.left);
+ int dest_a = 0, dest_k = 0;
+ for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd;
+ j++) {
+ int* pWeight = table.GetValueFromPixelWeight(pPixelWeights, j);
+ if (!pWeight)
+ return;
+
+ int pixel_weight = *pWeight;
+ dest_k +=
+ pixel_weight * src_scan[(j - m_SrcClip.top) * m_InterPitch];
+ dest_a += pixel_weight *
+ src_scan_mask[(j - m_SrcClip.top) * m_ExtraMaskPitch];
+ }
+ if (m_Flags & FXDIB_BICUBIC_INTERPOL) {
+ dest_k = dest_k < 0 ? 0 : dest_k > 16711680 ? 16711680 : dest_k;
+ dest_a = dest_a < 0 ? 0 : dest_a > 16711680 ? 16711680 : dest_a;
+ }
+ *dest_scan = (uint8_t)(dest_k >> 16);
+ dest_scan += DestBpp;
+ *dest_scan_mask++ = (uint8_t)(dest_a >> 16);
+ }
+ break;
+ }
+ case 5:
+ case 7: {
+ for (int col = m_DestClip.left; col < m_DestClip.right; col++) {
+ unsigned char* src_scan =
+ m_pInterBuf + (col - m_DestClip.left) * DestBpp;
+ int dest_r_y = 0, dest_g_m = 0, dest_b_c = 0;
+ for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd;
+ j++) {
+ int* pWeight = table.GetValueFromPixelWeight(pPixelWeights, j);
+ if (!pWeight)
+ return;
+
+ int pixel_weight = *pWeight;
+ const uint8_t* src_pixel =
+ src_scan + (j - m_SrcClip.top) * m_InterPitch;
+ dest_b_c += pixel_weight * (*src_pixel++);
+ dest_g_m += pixel_weight * (*src_pixel++);
+ dest_r_y += pixel_weight * (*src_pixel);
+ }
+ if (m_Flags & FXDIB_BICUBIC_INTERPOL) {
+ dest_r_y =
+ dest_r_y < 0 ? 0 : dest_r_y > 16711680 ? 16711680 : dest_r_y;
+ dest_g_m =
+ dest_g_m < 0 ? 0 : dest_g_m > 16711680 ? 16711680 : dest_g_m;
+ dest_b_c =
+ dest_b_c < 0 ? 0 : dest_b_c > 16711680 ? 16711680 : dest_b_c;
+ }
+ dest_scan[0] = (uint8_t)((dest_b_c) >> 16);
+ dest_scan[1] = (uint8_t)((dest_g_m) >> 16);
+ dest_scan[2] = (uint8_t)((dest_r_y) >> 16);
+ dest_scan += DestBpp;
+ }
+ break;
+ }
+ case 6:
+ case 8: {
+ for (int col = m_DestClip.left; col < m_DestClip.right; col++) {
+ unsigned char* src_scan =
+ m_pInterBuf + (col - m_DestClip.left) * DestBpp;
+ unsigned char* src_scan_mask = nullptr;
+ if (m_DestFormat != FXDIB_Argb) {
+ src_scan_mask = m_pExtraAlphaBuf + (col - m_DestClip.left);
+ }
+ int dest_a = 0, dest_r_y = 0, dest_g_m = 0, dest_b_c = 0;
+ for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd;
+ j++) {
+ int* pWeight = table.GetValueFromPixelWeight(pPixelWeights, j);
+ if (!pWeight)
+ return;
+
+ int pixel_weight = *pWeight;
+ const uint8_t* src_pixel =
+ src_scan + (j - m_SrcClip.top) * m_InterPitch;
+ int mask_v = 255;
+ if (src_scan_mask) {
+ mask_v = src_scan_mask[(j - m_SrcClip.top) * m_ExtraMaskPitch];
+ }
+ dest_b_c += pixel_weight * (*src_pixel++);
+ dest_g_m += pixel_weight * (*src_pixel++);
+ dest_r_y += pixel_weight * (*src_pixel);
+ if (m_DestFormat == FXDIB_Argb) {
+ dest_a += pixel_weight * (*(src_pixel + 1));
+ } else {
+ dest_a += pixel_weight * mask_v;
+ }
+ }
+ if (m_Flags & FXDIB_BICUBIC_INTERPOL) {
+ dest_r_y =
+ dest_r_y < 0 ? 0 : dest_r_y > 16711680 ? 16711680 : dest_r_y;
+ dest_g_m =
+ dest_g_m < 0 ? 0 : dest_g_m > 16711680 ? 16711680 : dest_g_m;
+ dest_b_c =
+ dest_b_c < 0 ? 0 : dest_b_c > 16711680 ? 16711680 : dest_b_c;
+ dest_a = dest_a < 0 ? 0 : dest_a > 16711680 ? 16711680 : dest_a;
+ }
+ if (dest_a) {
+ int r = ((uint32_t)dest_r_y) * 255 / dest_a;
+ int g = ((uint32_t)dest_g_m) * 255 / dest_a;
+ int b = ((uint32_t)dest_b_c) * 255 / dest_a;
+ dest_scan[0] = b > 255 ? 255 : b < 0 ? 0 : b;
+ dest_scan[1] = g > 255 ? 255 : g < 0 ? 0 : g;
+ dest_scan[2] = r > 255 ? 255 : r < 0 ? 0 : r;
+ }
+ if (m_DestFormat == FXDIB_Argb) {
+ dest_scan[3] = (uint8_t)((dest_a) >> 16);
+ } else {
+ *dest_scan_mask = (uint8_t)((dest_a) >> 16);
+ }
+ dest_scan += DestBpp;
+ if (dest_scan_mask) {
+ dest_scan_mask++;
+ }
+ }
+ break;
+ }
+ }
+ m_pDestBitmap->ComposeScanline(row - m_DestClip.top, m_pDestScanline,
+ m_pDestMaskScanline);
+ }
+}
diff --git a/chromium/third_party/pdfium/core/fxge/dib/cstretchengine.h b/chromium/third_party/pdfium/core/fxge/dib/cstretchengine.h
new file mode 100644
index 00000000000..0d9457fb9db
--- /dev/null
+++ b/chromium/third_party/pdfium/core/fxge/dib/cstretchengine.h
@@ -0,0 +1,81 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef CORE_FXGE_DIB_CSTRETCHENGINE_H_
+#define CORE_FXGE_DIB_CSTRETCHENGINE_H_
+
+#include "core/fxcrt/fx_coordinates.h"
+#include "core/fxge/fx_dib.h"
+
+class IFX_ScanlineComposer;
+
+class CStretchEngine {
+ public:
+ CStretchEngine(IFX_ScanlineComposer* pDestBitmap,
+ FXDIB_Format dest_format,
+ int dest_width,
+ int dest_height,
+ const FX_RECT& clip_rect,
+ const CFX_RetainPtr<CFX_DIBSource>& pSrcBitmap,
+ int flags);
+ ~CStretchEngine();
+
+ bool Continue(IFX_Pause* pPause);
+
+ bool StartStretchHorz();
+ bool ContinueStretchHorz(IFX_Pause* pPause);
+ void StretchVert();
+
+ class CWeightTable {
+ public:
+ CWeightTable();
+ ~CWeightTable();
+
+ bool Calc(int dest_len,
+ int dest_min,
+ int dest_max,
+ int src_len,
+ int src_min,
+ int src_max,
+ int flags);
+ PixelWeight* GetPixelWeight(int pixel) const;
+ int* GetValueFromPixelWeight(PixelWeight* pWeight, int index) const;
+ size_t GetPixelWeightSize() const;
+
+ private:
+ int m_DestMin;
+ int m_ItemSize;
+ uint8_t* m_pWeightTables;
+ size_t m_dwWeightTablesSize;
+ };
+
+ FXDIB_Format m_DestFormat;
+ int m_DestBpp;
+ int m_SrcBpp;
+ int m_bHasAlpha;
+ IFX_ScanlineComposer* m_pDestBitmap;
+ int m_DestWidth, m_DestHeight;
+ FX_RECT m_DestClip;
+ uint8_t* m_pDestScanline;
+ uint8_t* m_pDestMaskScanline;
+ FX_RECT m_SrcClip;
+ CFX_RetainPtr<CFX_DIBSource> m_pSource;
+ uint32_t* m_pSrcPalette;
+ int m_SrcWidth;
+ int m_SrcHeight;
+ int m_SrcPitch;
+ int m_InterPitch;
+ int m_ExtraMaskPitch;
+ uint8_t* m_pInterBuf;
+ uint8_t* m_pExtraAlphaBuf;
+ int m_TransMethod;
+ int m_Flags;
+ CWeightTable m_WeightTable;
+ int m_CurRow;
+ int m_State;
+};
+
+#endif // CORE_FXGE_DIB_CSTRETCHENGINE_H_
diff --git a/chromium/third_party/pdfium/core/fxge/dib/cstretchengine_unittest.cpp b/chromium/third_party/pdfium/core/fxge/dib/cstretchengine_unittest.cpp
new file mode 100644
index 00000000000..2c7e0342deb
--- /dev/null
+++ b/chromium/third_party/pdfium/core/fxge/dib/cstretchengine_unittest.cpp
@@ -0,0 +1,32 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "core/fxge/dib/cstretchengine.h"
+
+#include <memory>
+#include <utility>
+
+#include "core/fpdfapi/parser/cpdf_dictionary.h"
+#include "core/fpdfapi/parser/cpdf_number.h"
+#include "core/fpdfapi/parser/cpdf_stream.h"
+#include "core/fpdfapi/render/cpdf_dibsource.h"
+#include "core/fxcrt/fx_memory.h"
+#include "core/fxge/fx_dib.h"
+#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/base/ptr_util.h"
+
+TEST(CStretchEngine, OverflowInCtor) {
+ FX_RECT clip_rect;
+ std::unique_ptr<CPDF_Dictionary> dict_obj =
+ pdfium::MakeUnique<CPDF_Dictionary>();
+ dict_obj->SetNewFor<CPDF_Number>("Width", 71000);
+ dict_obj->SetNewFor<CPDF_Number>("Height", 12500);
+ std::unique_ptr<CPDF_Stream> stream =
+ pdfium::MakeUnique<CPDF_Stream>(nullptr, 0, std::move(dict_obj));
+ auto dib_source = pdfium::MakeRetain<CPDF_DIBSource>();
+ dib_source->Load(nullptr, stream.get());
+ CStretchEngine engine(nullptr, FXDIB_8bppRgb, 500, 500, clip_rect, dib_source,
+ 0);
+ EXPECT_EQ(FXDIB_INTERPOL, engine.m_Flags);
+}
diff --git a/chromium/third_party/pdfium/core/fxge/dib/dib_int.h b/chromium/third_party/pdfium/core/fxge/dib/dib_int.h
deleted file mode 100644
index 000003a9c6e..00000000000
--- a/chromium/third_party/pdfium/core/fxge/dib/dib_int.h
+++ /dev/null
@@ -1,116 +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_FXGE_DIB_DIB_INT_H_
-#define CORE_FXGE_DIB_DIB_INT_H_
-
-#include <stdint.h>
-
-#include "core/fxcrt/fx_coordinates.h"
-#include "core/fxge/fx_dib.h"
-
-class IFX_ScanlineComposer;
-
-extern const int16_t SDP_Table[513];
-
-class CPDF_FixedMatrix {
- public:
- CPDF_FixedMatrix(const CFX_Matrix& src, int bits) {
- base = 1 << bits;
- a = FXSYS_round(src.a * base);
- b = FXSYS_round(src.b * base);
- c = FXSYS_round(src.c * base);
- d = FXSYS_round(src.d * base);
- e = FXSYS_round(src.e * base);
- f = FXSYS_round(src.f * base);
- }
- inline void Transform(int x, int y, int& x1, int& y1) {
- x1 = (a * x + c * y + e + base / 2) / base;
- y1 = (b * x + d * y + f + base / 2) / base;
- }
- int a, b, c, d, e, f;
- int base;
-};
-#define FPDF_HUGE_IMAGE_SIZE 60000000
-struct PixelWeight {
- int m_SrcStart;
- int m_SrcEnd;
- int m_Weights[1];
-};
-
-class CWeightTable {
- public:
- CWeightTable();
- ~CWeightTable();
-
- bool Calc(int dest_len,
- int dest_min,
- int dest_max,
- int src_len,
- int src_min,
- int src_max,
- int flags);
- PixelWeight* GetPixelWeight(int pixel) const;
- int* GetValueFromPixelWeight(PixelWeight* pWeight, int index) const;
- size_t GetPixelWeightSize() const;
-
- private:
- int m_DestMin;
- int m_ItemSize;
- uint8_t* m_pWeightTables;
- size_t m_dwWeightTablesSize;
-};
-
-class CStretchEngine {
- public:
- CStretchEngine(IFX_ScanlineComposer* pDestBitmap,
- FXDIB_Format dest_format,
- int dest_width,
- int dest_height,
- const FX_RECT& clip_rect,
- const CFX_DIBSource* pSrcBitmap,
- int flags);
- ~CStretchEngine();
-
- bool Continue(IFX_Pause* pPause);
-
- bool StartStretchHorz();
- bool ContinueStretchHorz(IFX_Pause* pPause);
- void StretchVert();
-
- FXDIB_Format m_DestFormat;
- int m_DestBpp;
- int m_SrcBpp;
- int m_bHasAlpha;
- IFX_ScanlineComposer* m_pDestBitmap;
- int m_DestWidth, m_DestHeight;
- FX_RECT m_DestClip;
- uint8_t* m_pDestScanline;
- uint8_t* m_pDestMaskScanline;
- FX_RECT m_SrcClip;
- const CFX_DIBSource* m_pSource;
- uint32_t* m_pSrcPalette;
- int m_SrcWidth;
- int m_SrcHeight;
- int m_SrcPitch;
- int m_InterPitch;
- int m_ExtraMaskPitch;
- uint8_t* m_pInterBuf;
- uint8_t* m_pExtraAlphaBuf;
- int m_TransMethod;
- int m_Flags;
- CWeightTable m_WeightTable;
- int m_CurRow;
- int m_State;
-};
-
-FX_RECT FXDIB_SwapClipBox(FX_RECT& clip,
- int width,
- int height,
- bool bFlipX,
- bool bFlipY);
-
-#endif // CORE_FXGE_DIB_DIB_INT_H_
diff --git a/chromium/third_party/pdfium/core/fxge/dib/fx_dib_composite.cpp b/chromium/third_party/pdfium/core/fxge/dib/fx_dib_composite.cpp
deleted file mode 100644
index 072ebbddd59..00000000000
--- a/chromium/third_party/pdfium/core/fxge/dib/fx_dib_composite.cpp
+++ /dev/null
@@ -1,5040 +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
-
-#include "core/fxcodec/fx_codec.h"
-#include "core/fxge/cfx_gemodule.h"
-#include "core/fxge/dib/dib_int.h"
-#include "core/fxge/ge/cfx_cliprgn.h"
-
-namespace {
-
-const uint8_t color_sqrt[256] = {
- 0x00, 0x03, 0x07, 0x0B, 0x0F, 0x12, 0x16, 0x19, 0x1D, 0x20, 0x23, 0x26,
- 0x29, 0x2C, 0x2F, 0x32, 0x35, 0x37, 0x3A, 0x3C, 0x3F, 0x41, 0x43, 0x46,
- 0x48, 0x4A, 0x4C, 0x4E, 0x50, 0x52, 0x54, 0x56, 0x57, 0x59, 0x5B, 0x5C,
- 0x5E, 0x60, 0x61, 0x63, 0x64, 0x65, 0x67, 0x68, 0x69, 0x6B, 0x6C, 0x6D,
- 0x6E, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A,
- 0x7B, 0x7C, 0x7D, 0x7E, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
- 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, 0x90, 0x91, 0x91,
- 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x97, 0x98, 0x99, 0x9A, 0x9B, 0x9C,
- 0x9C, 0x9D, 0x9E, 0x9F, 0xA0, 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA4, 0xA5,
- 0xA6, 0xA7, 0xA7, 0xA8, 0xA9, 0xAA, 0xAA, 0xAB, 0xAC, 0xAD, 0xAD, 0xAE,
- 0xAF, 0xB0, 0xB0, 0xB1, 0xB2, 0xB3, 0xB3, 0xB4, 0xB5, 0xB5, 0xB6, 0xB7,
- 0xB7, 0xB8, 0xB9, 0xBA, 0xBA, 0xBB, 0xBC, 0xBC, 0xBD, 0xBE, 0xBE, 0xBF,
- 0xC0, 0xC0, 0xC1, 0xC2, 0xC2, 0xC3, 0xC4, 0xC4, 0xC5, 0xC6, 0xC6, 0xC7,
- 0xC7, 0xC8, 0xC9, 0xC9, 0xCA, 0xCB, 0xCB, 0xCC, 0xCC, 0xCD, 0xCE, 0xCE,
- 0xCF, 0xD0, 0xD0, 0xD1, 0xD1, 0xD2, 0xD3, 0xD3, 0xD4, 0xD4, 0xD5, 0xD6,
- 0xD6, 0xD7, 0xD7, 0xD8, 0xD9, 0xD9, 0xDA, 0xDA, 0xDB, 0xDC, 0xDC, 0xDD,
- 0xDD, 0xDE, 0xDE, 0xDF, 0xE0, 0xE0, 0xE1, 0xE1, 0xE2, 0xE2, 0xE3, 0xE4,
- 0xE4, 0xE5, 0xE5, 0xE6, 0xE6, 0xE7, 0xE7, 0xE8, 0xE9, 0xE9, 0xEA, 0xEA,
- 0xEB, 0xEB, 0xEC, 0xEC, 0xED, 0xED, 0xEE, 0xEE, 0xEF, 0xF0, 0xF0, 0xF1,
- 0xF1, 0xF2, 0xF2, 0xF3, 0xF3, 0xF4, 0xF4, 0xF5, 0xF5, 0xF6, 0xF6, 0xF7,
- 0xF7, 0xF8, 0xF8, 0xF9, 0xF9, 0xFA, 0xFA, 0xFB, 0xFB, 0xFC, 0xFC, 0xFD,
- 0xFD, 0xFE, 0xFE, 0xFF};
-
-int Blend(int blend_mode, int back_color, int src_color) {
- switch (blend_mode) {
- case FXDIB_BLEND_NORMAL:
- return src_color;
- case FXDIB_BLEND_MULTIPLY:
- return src_color * back_color / 255;
- case FXDIB_BLEND_SCREEN:
- return src_color + back_color - src_color * back_color / 255;
- case FXDIB_BLEND_OVERLAY:
- return Blend(FXDIB_BLEND_HARDLIGHT, src_color, back_color);
- case FXDIB_BLEND_DARKEN:
- return src_color < back_color ? src_color : back_color;
- case FXDIB_BLEND_LIGHTEN:
- return src_color > back_color ? src_color : back_color;
- case FXDIB_BLEND_COLORDODGE: {
- if (src_color == 255) {
- return src_color;
- }
- int result = back_color * 255 / (255 - src_color);
- if (result > 255) {
- return 255;
- }
- return result;
- }
- case FXDIB_BLEND_COLORBURN: {
- if (src_color == 0) {
- return src_color;
- }
- int result = (255 - back_color) * 255 / src_color;
- if (result > 255) {
- result = 255;
- }
- return 255 - result;
- }
- case FXDIB_BLEND_HARDLIGHT:
- if (src_color < 128) {
- return (src_color * back_color * 2) / 255;
- }
- return Blend(FXDIB_BLEND_SCREEN, back_color, 2 * src_color - 255);
- case FXDIB_BLEND_SOFTLIGHT: {
- if (src_color < 128) {
- return back_color -
- (255 - 2 * src_color) * back_color * (255 - back_color) / 255 /
- 255;
- }
- return back_color +
- (2 * src_color - 255) * (color_sqrt[back_color] - back_color) /
- 255;
- }
- case FXDIB_BLEND_DIFFERENCE:
- return back_color < src_color ? src_color - back_color
- : back_color - src_color;
- case FXDIB_BLEND_EXCLUSION:
- return back_color + src_color - 2 * back_color * src_color / 255;
- }
- return src_color;
-}
-
-struct RGB {
- int red;
- int green;
- int blue;
-};
-
-int Lum(RGB color) {
- return (color.red * 30 + color.green * 59 + color.blue * 11) / 100;
-}
-
-RGB ClipColor(RGB color) {
- int l = Lum(color);
- int n = color.red;
- if (color.green < n) {
- n = color.green;
- }
- if (color.blue < n) {
- n = color.blue;
- }
- int x = color.red;
- if (color.green > x) {
- x = color.green;
- }
- if (color.blue > x) {
- x = color.blue;
- }
- if (n < 0) {
- color.red = l + ((color.red - l) * l / (l - n));
- color.green = l + ((color.green - l) * l / (l - n));
- color.blue = l + ((color.blue - l) * l / (l - n));
- }
- if (x > 255) {
- color.red = l + ((color.red - l) * (255 - l) / (x - l));
- color.green = l + ((color.green - l) * (255 - l) / (x - l));
- color.blue = l + ((color.blue - l) * (255 - l) / (x - l));
- }
- return color;
-}
-
-RGB SetLum(RGB color, int l) {
- int d = l - Lum(color);
- color.red += d;
- color.green += d;
- color.blue += d;
- return ClipColor(color);
-}
-
-int Sat(RGB color) {
- int n = color.red;
- if (color.green < n) {
- n = color.green;
- }
- if (color.blue < n) {
- n = color.blue;
- }
- int x = color.red;
- if (color.green > x) {
- x = color.green;
- }
- if (color.blue > x) {
- x = color.blue;
- }
- return x - n;
-}
-
-RGB SetSat(RGB color, int s) {
- int* max = &color.red;
- int* mid = &color.red;
- int* min = &color.red;
- if (color.green > *max) {
- max = &color.green;
- }
- if (color.blue > *max) {
- max = &color.blue;
- }
- if (color.green < *min) {
- min = &color.green;
- }
- if (color.blue < *min) {
- min = &color.blue;
- }
- if (*max == *min) {
- color.red = 0;
- color.green = 0;
- color.blue = 0;
- return color;
- }
- if (max == &color.red) {
- if (min == &color.green) {
- mid = &color.blue;
- } else {
- mid = &color.green;
- }
- } else if (max == &color.green) {
- if (min == &color.red) {
- mid = &color.blue;
- } else {
- mid = &color.red;
- }
- } else {
- if (min == &color.green) {
- mid = &color.red;
- } else {
- mid = &color.green;
- }
- }
- if (*max > *min) {
- *mid = (*mid - *min) * s / (*max - *min);
- *max = s;
- *min = 0;
- }
- return color;
-}
-
-void RGB_Blend(int blend_mode,
- const uint8_t* src_scan,
- uint8_t* dest_scan,
- int results[3]) {
- RGB src;
- RGB back;
- RGB result = {0, 0, 0};
- src.red = src_scan[2];
- src.green = src_scan[1];
- src.blue = src_scan[0];
- back.red = dest_scan[2];
- back.green = dest_scan[1];
- back.blue = dest_scan[0];
- switch (blend_mode) {
- case FXDIB_BLEND_HUE:
- result = SetLum(SetSat(src, Sat(back)), Lum(back));
- break;
- case FXDIB_BLEND_SATURATION:
- result = SetLum(SetSat(back, Sat(src)), Lum(back));
- break;
- case FXDIB_BLEND_COLOR:
- result = SetLum(src, Lum(back));
- break;
- case FXDIB_BLEND_LUMINOSITY:
- result = SetLum(back, Lum(src));
- break;
- }
- results[0] = result.blue;
- results[1] = result.green;
- results[2] = result.red;
-}
-
-void CompositeRow_Argb2Mask(uint8_t* dest_scan,
- const uint8_t* src_scan,
- int pixel_count,
- const uint8_t* clip_scan) {
- src_scan += 3;
- for (int col = 0; col < pixel_count; col++) {
- int src_alpha = *src_scan;
- if (clip_scan) {
- src_alpha = clip_scan[col] * src_alpha / 255;
- }
- uint8_t back_alpha = *dest_scan;
- if (!back_alpha) {
- *dest_scan = src_alpha;
- } else if (src_alpha) {
- *dest_scan = back_alpha + src_alpha - back_alpha * src_alpha / 255;
- }
- dest_scan++;
- src_scan += 4;
- }
-}
-
-void CompositeRow_Rgba2Mask(uint8_t* dest_scan,
- const uint8_t* src_alpha_scan,
- int pixel_count,
- const uint8_t* clip_scan) {
- for (int col = 0; col < pixel_count; col++) {
- int src_alpha = *src_alpha_scan++;
- if (clip_scan) {
- src_alpha = clip_scan[col] * src_alpha / 255;
- }
- uint8_t back_alpha = *dest_scan;
- if (!back_alpha) {
- *dest_scan = src_alpha;
- } else if (src_alpha) {
- *dest_scan = back_alpha + src_alpha - back_alpha * src_alpha / 255;
- }
- dest_scan++;
- }
-}
-
-void CompositeRow_Rgb2Mask(uint8_t* dest_scan,
- const uint8_t* src_scan,
- int width,
- const uint8_t* clip_scan) {
- if (clip_scan) {
- for (int i = 0; i < width; i++) {
- *dest_scan = FXDIB_ALPHA_UNION(*dest_scan, *clip_scan);
- dest_scan++;
- clip_scan++;
- }
- } else {
- FXSYS_memset(dest_scan, 0xff, width);
- }
-}
-
-void CompositeRow_Argb2Graya(uint8_t* dest_scan,
- const uint8_t* src_scan,
- int pixel_count,
- int blend_type,
- const uint8_t* clip_scan,
- const uint8_t* src_alpha_scan,
- uint8_t* dst_alpha_scan,
- void* pIccTransform) {
- CCodec_IccModule* pIccModule = nullptr;
- if (pIccTransform)
- pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule();
-
- if (blend_type) {
- bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
- if (src_alpha_scan) {
- for (int col = 0; col < pixel_count; col++) {
- uint8_t back_alpha = *dst_alpha_scan;
- if (back_alpha == 0) {
- int src_alpha = *src_alpha_scan++;
- if (clip_scan)
- src_alpha = clip_scan[col] * src_alpha / 255;
-
- if (src_alpha) {
- if (pIccTransform) {
- pIccModule->TranslateScanline(pIccTransform, dest_scan, src_scan,
- 1);
- } else {
- *dest_scan = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan);
- }
- *dst_alpha_scan = src_alpha;
- }
- dest_scan++;
- dst_alpha_scan++;
- src_scan += 3;
- continue;
- }
- uint8_t src_alpha = *src_alpha_scan++;
- if (clip_scan)
- src_alpha = clip_scan[col] * src_alpha / 255;
-
- if (src_alpha == 0) {
- dest_scan++;
- dst_alpha_scan++;
- src_scan += 3;
- continue;
- }
- *dst_alpha_scan = FXDIB_ALPHA_UNION(back_alpha, src_alpha);
- int alpha_ratio = src_alpha * 255 / (*dst_alpha_scan);
- uint8_t gray;
- if (pIccTransform) {
- pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1);
- } else {
- gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan);
- }
- if (bNonseparableBlend)
- gray = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan;
- else
- gray = Blend(blend_type, *dest_scan, gray);
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio);
- dest_scan++;
- dst_alpha_scan++;
- src_scan += 3;
- }
- } else {
- for (int col = 0; col < pixel_count; col++) {
- uint8_t back_alpha = *dst_alpha_scan;
- if (back_alpha == 0) {
- int src_alpha = src_scan[3];
- if (clip_scan)
- src_alpha = clip_scan[col] * src_alpha / 255;
-
- if (src_alpha) {
- if (pIccTransform) {
- pIccModule->TranslateScanline(pIccTransform, dest_scan, src_scan,
- 1);
- } else {
- *dest_scan = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan);
- }
- *dst_alpha_scan = src_alpha;
- }
- dest_scan++;
- dst_alpha_scan++;
- src_scan += 4;
- continue;
- }
- uint8_t src_alpha = src_scan[3];
- if (clip_scan)
- src_alpha = clip_scan[col] * src_alpha / 255;
-
- if (src_alpha == 0) {
- dest_scan++;
- dst_alpha_scan++;
- src_scan += 4;
- continue;
- }
- *dst_alpha_scan = FXDIB_ALPHA_UNION(back_alpha, src_alpha);
- int alpha_ratio = src_alpha * 255 / (*dst_alpha_scan);
- uint8_t gray;
- if (pIccTransform)
- pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1);
- else
- gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan);
-
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio);
- dest_scan++;
- dst_alpha_scan++;
- src_scan += 4;
- }
- }
- return;
- }
- if (src_alpha_scan) {
- for (int col = 0; col < pixel_count; col++) {
- uint8_t back_alpha = *dst_alpha_scan;
- if (back_alpha == 0) {
- int src_alpha = *src_alpha_scan++;
- if (clip_scan)
- src_alpha = clip_scan[col] * src_alpha / 255;
-
- if (src_alpha) {
- if (pIccTransform) {
- pIccModule->TranslateScanline(pIccTransform, dest_scan, src_scan,
- 1);
- } else {
- *dest_scan = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan);
- }
- *dst_alpha_scan = src_alpha;
- }
- dest_scan++;
- dst_alpha_scan++;
- src_scan += 3;
- continue;
- }
- uint8_t src_alpha = *src_alpha_scan++;
- if (clip_scan)
- src_alpha = clip_scan[col] * src_alpha / 255;
-
- if (src_alpha == 0) {
- dest_scan++;
- dst_alpha_scan++;
- src_scan += 3;
- continue;
- }
- *dst_alpha_scan = FXDIB_ALPHA_UNION(back_alpha, src_alpha);
- int alpha_ratio = src_alpha * 255 / (*dst_alpha_scan);
- uint8_t gray;
- if (pIccTransform)
- pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1);
- else
- gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan);
-
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio);
- dest_scan++;
- dst_alpha_scan++;
- src_scan += 3;
- }
- } else {
- for (int col = 0; col < pixel_count; col++) {
- uint8_t back_alpha = *dst_alpha_scan;
- if (back_alpha == 0) {
- int src_alpha = src_scan[3];
- if (clip_scan)
- src_alpha = clip_scan[col] * src_alpha / 255;
-
- if (src_alpha) {
- if (pIccTransform) {
- pIccModule->TranslateScanline(pIccTransform, dest_scan, src_scan,
- 1);
- } else {
- *dest_scan = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan);
- }
- *dst_alpha_scan = src_alpha;
- }
- dest_scan++;
- dst_alpha_scan++;
- src_scan += 4;
- continue;
- }
- uint8_t src_alpha = src_scan[3];
- if (clip_scan)
- src_alpha = clip_scan[col] * src_alpha / 255;
-
- if (src_alpha == 0) {
- dest_scan++;
- dst_alpha_scan++;
- src_scan += 4;
- continue;
- }
- *dst_alpha_scan = FXDIB_ALPHA_UNION(back_alpha, src_alpha);
- int alpha_ratio = src_alpha * 255 / (*dst_alpha_scan);
- uint8_t gray;
- if (pIccTransform)
- pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1);
- else
- gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan);
-
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio);
- dest_scan++;
- dst_alpha_scan++;
- src_scan += 4;
- }
- }
-}
-
-void CompositeRow_Argb2Gray(uint8_t* dest_scan,
- const uint8_t* src_scan,
- int pixel_count,
- int blend_type,
- const uint8_t* clip_scan,
- const uint8_t* src_alpha_scan,
- void* pIccTransform) {
- CCodec_IccModule* pIccModule = nullptr;
- uint8_t gray;
- if (pIccTransform)
- pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule();
-
- if (blend_type) {
- bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
- if (src_alpha_scan) {
- for (int col = 0; col < pixel_count; col++) {
- int src_alpha = *src_alpha_scan++;
- if (clip_scan)
- src_alpha = clip_scan[col] * src_alpha / 255;
-
- if (src_alpha) {
- if (pIccTransform)
- pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1);
- else
- gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan);
-
- if (bNonseparableBlend)
- gray = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan;
- else
- gray = Blend(blend_type, *dest_scan, gray);
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, src_alpha);
- }
- dest_scan++;
- src_scan += 3;
- }
- } else {
- for (int col = 0; col < pixel_count; col++) {
- int src_alpha = src_scan[3];
- if (clip_scan)
- src_alpha = clip_scan[col] * src_alpha / 255;
-
- if (src_alpha) {
- if (pIccTransform)
- pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1);
- else
- gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan);
-
- if (bNonseparableBlend)
- gray = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan;
- else
- gray = Blend(blend_type, *dest_scan, gray);
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, src_alpha);
- }
- dest_scan++;
- src_scan += 4;
- }
- }
- return;
- }
- if (src_alpha_scan) {
- for (int col = 0; col < pixel_count; col++) {
- int src_alpha = *src_alpha_scan++;
- if (clip_scan)
- src_alpha = clip_scan[col] * src_alpha / 255;
-
- if (src_alpha) {
- if (pIccTransform)
- pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1);
- else
- gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan);
-
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, src_alpha);
- }
- dest_scan++;
- src_scan += 3;
- }
- } else {
- for (int col = 0; col < pixel_count; col++) {
- int src_alpha = src_scan[3];
- if (clip_scan)
- src_alpha = clip_scan[col] * src_alpha / 255;
-
- if (src_alpha) {
- if (pIccTransform)
- pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1);
- else
- gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan);
-
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, src_alpha);
- }
- dest_scan++;
- src_scan += 4;
- }
- }
-}
-
-void CompositeRow_Rgb2Gray(uint8_t* dest_scan,
- const uint8_t* src_scan,
- int src_Bpp,
- int pixel_count,
- int blend_type,
- const uint8_t* clip_scan,
- void* pIccTransform) {
- CCodec_IccModule* pIccModule = nullptr;
- uint8_t gray;
- if (pIccTransform) {
- pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule();
- }
- if (blend_type) {
- bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
- for (int col = 0; col < pixel_count; col++) {
- if (pIccTransform) {
- pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1);
- } else {
- gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan);
- }
- if (bNonseparableBlend)
- gray = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan;
- else
- gray = Blend(blend_type, *dest_scan, gray);
- if (clip_scan && clip_scan[col] < 255) {
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, clip_scan[col]);
- } else {
- *dest_scan = gray;
- }
- dest_scan++;
- src_scan += src_Bpp;
- }
- return;
- }
- for (int col = 0; col < pixel_count; col++) {
- if (pIccTransform) {
- pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1);
- } else {
- gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan);
- }
- if (clip_scan && clip_scan[col] < 255) {
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, clip_scan[col]);
- } else {
- *dest_scan = gray;
- }
- dest_scan++;
- src_scan += src_Bpp;
- }
-}
-
-void CompositeRow_Rgb2Graya(uint8_t* dest_scan,
- const uint8_t* src_scan,
- int src_Bpp,
- int pixel_count,
- int blend_type,
- const uint8_t* clip_scan,
- uint8_t* dest_alpha_scan,
- void* pIccTransform) {
- CCodec_IccModule* pIccModule = nullptr;
- if (pIccTransform) {
- pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule();
- }
- if (blend_type) {
- bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
- for (int col = 0; col < pixel_count; col++) {
- int back_alpha = *dest_alpha_scan;
- if (back_alpha == 0) {
- if (pIccTransform) {
- pIccModule->TranslateScanline(pIccTransform, dest_scan, src_scan, 1);
- } else {
- *dest_scan = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan);
- }
- dest_scan++;
- dest_alpha_scan++;
- src_scan += src_Bpp;
- continue;
- }
- int src_alpha = 255;
- if (clip_scan) {
- src_alpha = clip_scan[col];
- }
- if (src_alpha == 0) {
- dest_scan++;
- dest_alpha_scan++;
- src_scan += src_Bpp;
- continue;
- }
- uint8_t dest_alpha =
- back_alpha + src_alpha - back_alpha * src_alpha / 255;
- *dest_alpha_scan++ = dest_alpha;
- int alpha_ratio = src_alpha * 255 / dest_alpha;
- uint8_t gray;
- if (pIccTransform) {
- pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1);
- } else {
- gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan);
- }
- if (bNonseparableBlend)
- gray = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan;
- else
- gray = Blend(blend_type, *dest_scan, gray);
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio);
- dest_scan++;
- src_scan += src_Bpp;
- }
- return;
- }
- for (int col = 0; col < pixel_count; col++) {
- int src_alpha = 255;
- if (clip_scan) {
- src_alpha = clip_scan[col];
- }
- if (src_alpha == 255) {
- if (pIccTransform) {
- pIccModule->TranslateScanline(pIccTransform, dest_scan, src_scan, 1);
- } else {
- *dest_scan = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan);
- }
- dest_scan++;
- *dest_alpha_scan++ = 255;
- src_scan += src_Bpp;
- continue;
- }
- if (src_alpha == 0) {
- dest_scan++;
- dest_alpha_scan++;
- src_scan += src_Bpp;
- continue;
- }
- int back_alpha = *dest_alpha_scan;
- uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255;
- *dest_alpha_scan++ = dest_alpha;
- int alpha_ratio = src_alpha * 255 / dest_alpha;
- uint8_t gray;
- if (pIccTransform) {
- pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1);
- } else {
- gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan);
- }
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio);
- dest_scan++;
- src_scan += src_Bpp;
- }
-}
-
-void CompositeRow_Argb2Argb(uint8_t* dest_scan,
- const uint8_t* src_scan,
- int pixel_count,
- int blend_type,
- const uint8_t* clip_scan,
- uint8_t* dest_alpha_scan,
- const uint8_t* src_alpha_scan) {
- int blended_colors[3];
- bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
- if (!dest_alpha_scan) {
- if (!src_alpha_scan) {
- uint8_t back_alpha = 0;
- for (int col = 0; col < pixel_count; col++) {
- back_alpha = dest_scan[3];
- if (back_alpha == 0) {
- if (clip_scan) {
- int src_alpha = clip_scan[col] * src_scan[3] / 255;
- FXARGB_SETDIB(dest_scan, (FXARGB_GETDIB(src_scan) & 0xffffff) |
- (src_alpha << 24));
- } else {
- FXARGB_COPY(dest_scan, src_scan);
- }
- dest_scan += 4;
- src_scan += 4;
- continue;
- }
- uint8_t src_alpha;
- if (clip_scan) {
- src_alpha = clip_scan[col] * src_scan[3] / 255;
- } else {
- src_alpha = src_scan[3];
- }
- if (src_alpha == 0) {
- dest_scan += 4;
- src_scan += 4;
- continue;
- }
- uint8_t dest_alpha =
- back_alpha + src_alpha - back_alpha * src_alpha / 255;
- dest_scan[3] = dest_alpha;
- int alpha_ratio = src_alpha * 255 / dest_alpha;
- if (bNonseparableBlend) {
- RGB_Blend(blend_type, src_scan, dest_scan, blended_colors);
- }
- for (int color = 0; color < 3; color++) {
- if (blend_type) {
- int blended = bNonseparableBlend
- ? blended_colors[color]
- : Blend(blend_type, *dest_scan, *src_scan);
- blended = FXDIB_ALPHA_MERGE(*src_scan, blended, back_alpha);
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alpha_ratio);
- } else {
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, *src_scan, alpha_ratio);
- }
- dest_scan++;
- src_scan++;
- }
- dest_scan++;
- src_scan++;
- }
- } else {
- for (int col = 0; col < pixel_count; col++) {
- uint8_t back_alpha = dest_scan[3];
- if (back_alpha == 0) {
- if (clip_scan) {
- int src_alpha = clip_scan[col] * (*src_alpha_scan) / 255;
- FXARGB_SETDIB(dest_scan, FXARGB_MAKE((src_alpha << 24), src_scan[2],
- src_scan[1], *src_scan));
- } else {
- FXARGB_SETDIB(dest_scan,
- FXARGB_MAKE((*src_alpha_scan << 24), src_scan[2],
- src_scan[1], *src_scan));
- }
- dest_scan += 4;
- src_scan += 3;
- src_alpha_scan++;
- continue;
- }
- uint8_t src_alpha;
- if (clip_scan) {
- src_alpha = clip_scan[col] * (*src_alpha_scan++) / 255;
- } else {
- src_alpha = *src_alpha_scan++;
- }
- if (src_alpha == 0) {
- dest_scan += 4;
- src_scan += 3;
- continue;
- }
- uint8_t dest_alpha =
- back_alpha + src_alpha - back_alpha * src_alpha / 255;
- dest_scan[3] = dest_alpha;
- int alpha_ratio = src_alpha * 255 / dest_alpha;
- if (bNonseparableBlend) {
- RGB_Blend(blend_type, src_scan, dest_scan, blended_colors);
- }
- for (int color = 0; color < 3; color++) {
- if (blend_type) {
- int blended = bNonseparableBlend
- ? blended_colors[color]
- : Blend(blend_type, *dest_scan, *src_scan);
- blended = FXDIB_ALPHA_MERGE(*src_scan, blended, back_alpha);
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alpha_ratio);
- } else {
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, *src_scan, alpha_ratio);
- }
- dest_scan++;
- src_scan++;
- }
- dest_scan++;
- }
- }
- } else {
- if (src_alpha_scan) {
- for (int col = 0; col < pixel_count; col++) {
- uint8_t back_alpha = *dest_alpha_scan;
- if (back_alpha == 0) {
- if (clip_scan) {
- int src_alpha = clip_scan[col] * (*src_alpha_scan) / 255;
- *dest_alpha_scan = src_alpha;
- *dest_scan++ = *src_scan++;
- *dest_scan++ = *src_scan++;
- *dest_scan++ = *src_scan++;
- } else {
- *dest_alpha_scan = *src_alpha_scan;
- *dest_scan++ = *src_scan++;
- *dest_scan++ = *src_scan++;
- *dest_scan++ = *src_scan++;
- }
- dest_alpha_scan++;
- src_alpha_scan++;
- continue;
- }
- uint8_t src_alpha;
- if (clip_scan) {
- src_alpha = clip_scan[col] * (*src_alpha_scan++) / 255;
- } else {
- src_alpha = *src_alpha_scan++;
- }
- if (src_alpha == 0) {
- dest_scan += 3;
- src_scan += 3;
- dest_alpha_scan++;
- continue;
- }
- uint8_t dest_alpha =
- back_alpha + src_alpha - back_alpha * src_alpha / 255;
- *dest_alpha_scan++ = dest_alpha;
- int alpha_ratio = src_alpha * 255 / dest_alpha;
- if (bNonseparableBlend) {
- RGB_Blend(blend_type, src_scan, dest_scan, blended_colors);
- }
- for (int color = 0; color < 3; color++) {
- if (blend_type) {
- int blended = bNonseparableBlend
- ? blended_colors[color]
- : Blend(blend_type, *dest_scan, *src_scan);
- blended = FXDIB_ALPHA_MERGE(*src_scan, blended, back_alpha);
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alpha_ratio);
- } else {
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, *src_scan, alpha_ratio);
- }
- dest_scan++;
- src_scan++;
- }
- }
- } else {
- for (int col = 0; col < pixel_count; col++) {
- uint8_t back_alpha = *dest_alpha_scan;
- if (back_alpha == 0) {
- if (clip_scan) {
- int src_alpha = clip_scan[col] * src_scan[3] / 255;
- *dest_alpha_scan = src_alpha;
- *dest_scan++ = *src_scan++;
- *dest_scan++ = *src_scan++;
- *dest_scan++ = *src_scan++;
- } else {
- *dest_alpha_scan = src_scan[3];
- *dest_scan++ = *src_scan++;
- *dest_scan++ = *src_scan++;
- *dest_scan++ = *src_scan++;
- }
- dest_alpha_scan++;
- src_scan++;
- continue;
- }
- uint8_t src_alpha;
- if (clip_scan) {
- src_alpha = clip_scan[col] * src_scan[3] / 255;
- } else {
- src_alpha = src_scan[3];
- }
- if (src_alpha == 0) {
- dest_scan += 3;
- src_scan += 4;
- dest_alpha_scan++;
- continue;
- }
- uint8_t dest_alpha =
- back_alpha + src_alpha - back_alpha * src_alpha / 255;
- *dest_alpha_scan++ = dest_alpha;
- int alpha_ratio = src_alpha * 255 / dest_alpha;
- if (bNonseparableBlend) {
- RGB_Blend(blend_type, src_scan, dest_scan, blended_colors);
- }
- for (int color = 0; color < 3; color++) {
- if (blend_type) {
- int blended = bNonseparableBlend
- ? blended_colors[color]
- : Blend(blend_type, *dest_scan, *src_scan);
- blended = FXDIB_ALPHA_MERGE(*src_scan, blended, back_alpha);
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alpha_ratio);
- } else {
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, *src_scan, alpha_ratio);
- }
- dest_scan++;
- src_scan++;
- }
- src_scan++;
- }
- }
- }
-}
-
-void CompositeRow_Rgb2Argb_Blend_NoClip(uint8_t* dest_scan,
- const uint8_t* src_scan,
- int width,
- int blend_type,
- int src_Bpp,
- uint8_t* dest_alpha_scan) {
- int blended_colors[3];
- bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
- int src_gap = src_Bpp - 3;
- if (dest_alpha_scan) {
- for (int col = 0; col < width; col++) {
- uint8_t back_alpha = *dest_alpha_scan;
- if (back_alpha == 0) {
- *dest_scan++ = *src_scan++;
- *dest_scan++ = *src_scan++;
- *dest_scan++ = *src_scan++;
- *dest_alpha_scan++ = 0xff;
- src_scan += src_gap;
- continue;
- }
- *dest_alpha_scan++ = 0xff;
- if (bNonseparableBlend) {
- RGB_Blend(blend_type, src_scan, dest_scan, blended_colors);
- }
- for (int color = 0; color < 3; color++) {
- int src_color = *src_scan;
- int blended = bNonseparableBlend
- ? blended_colors[color]
- : Blend(blend_type, *dest_scan, src_color);
- *dest_scan = FXDIB_ALPHA_MERGE(src_color, blended, back_alpha);
- dest_scan++;
- src_scan++;
- }
- src_scan += src_gap;
- }
- } else {
- for (int col = 0; col < width; col++) {
- uint8_t back_alpha = dest_scan[3];
- if (back_alpha == 0) {
- if (src_Bpp == 4) {
- FXARGB_SETDIB(dest_scan, 0xff000000 | FXARGB_GETDIB(src_scan));
- } else {
- FXARGB_SETDIB(dest_scan, FXARGB_MAKE(0xff, src_scan[2], src_scan[1],
- src_scan[0]));
- }
- dest_scan += 4;
- src_scan += src_Bpp;
- continue;
- }
- dest_scan[3] = 0xff;
- if (bNonseparableBlend) {
- RGB_Blend(blend_type, src_scan, dest_scan, blended_colors);
- }
- for (int color = 0; color < 3; color++) {
- int src_color = *src_scan;
- int blended = bNonseparableBlend
- ? blended_colors[color]
- : Blend(blend_type, *dest_scan, src_color);
- *dest_scan = FXDIB_ALPHA_MERGE(src_color, blended, back_alpha);
- dest_scan++;
- src_scan++;
- }
- dest_scan++;
- src_scan += src_gap;
- }
- }
-}
-
-void CompositeRow_Rgb2Argb_Blend_Clip(uint8_t* dest_scan,
- const uint8_t* src_scan,
- int width,
- int blend_type,
- int src_Bpp,
- const uint8_t* clip_scan,
- uint8_t* dest_alpha_scan) {
- int blended_colors[3];
- bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
- int src_gap = src_Bpp - 3;
- if (dest_alpha_scan) {
- for (int col = 0; col < width; col++) {
- int src_alpha = *clip_scan++;
- uint8_t back_alpha = *dest_alpha_scan;
- if (back_alpha == 0) {
- *dest_scan++ = *src_scan++;
- *dest_scan++ = *src_scan++;
- *dest_scan++ = *src_scan++;
- src_scan += src_gap;
- dest_alpha_scan++;
- continue;
- }
- if (src_alpha == 0) {
- dest_scan += 3;
- dest_alpha_scan++;
- src_scan += src_Bpp;
- continue;
- }
- uint8_t dest_alpha =
- back_alpha + src_alpha - back_alpha * src_alpha / 255;
- *dest_alpha_scan++ = dest_alpha;
- int alpha_ratio = src_alpha * 255 / dest_alpha;
- if (bNonseparableBlend) {
- RGB_Blend(blend_type, src_scan, dest_scan, blended_colors);
- }
- for (int color = 0; color < 3; color++) {
- int src_color = *src_scan;
- int blended = bNonseparableBlend
- ? blended_colors[color]
- : Blend(blend_type, *dest_scan, src_color);
- blended = FXDIB_ALPHA_MERGE(src_color, blended, back_alpha);
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alpha_ratio);
- dest_scan++;
- src_scan++;
- }
- src_scan += src_gap;
- }
- } else {
- for (int col = 0; col < width; col++) {
- int src_alpha = *clip_scan++;
- uint8_t back_alpha = dest_scan[3];
- if (back_alpha == 0) {
- *dest_scan++ = *src_scan++;
- *dest_scan++ = *src_scan++;
- *dest_scan++ = *src_scan++;
- src_scan += src_gap;
- dest_scan++;
- continue;
- }
- if (src_alpha == 0) {
- dest_scan += 4;
- src_scan += src_Bpp;
- continue;
- }
- uint8_t dest_alpha =
- back_alpha + src_alpha - back_alpha * src_alpha / 255;
- dest_scan[3] = dest_alpha;
- int alpha_ratio = src_alpha * 255 / dest_alpha;
- if (bNonseparableBlend) {
- RGB_Blend(blend_type, src_scan, dest_scan, blended_colors);
- }
- for (int color = 0; color < 3; color++) {
- int src_color = *src_scan;
- int blended = bNonseparableBlend
- ? blended_colors[color]
- : Blend(blend_type, *dest_scan, src_color);
- blended = FXDIB_ALPHA_MERGE(src_color, blended, back_alpha);
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alpha_ratio);
- dest_scan++;
- src_scan++;
- }
- dest_scan++;
- src_scan += src_gap;
- }
- }
-}
-
-void CompositeRow_Rgb2Argb_NoBlend_Clip(uint8_t* dest_scan,
- const uint8_t* src_scan,
- int width,
- int src_Bpp,
- const uint8_t* clip_scan,
- uint8_t* dest_alpha_scan) {
- int src_gap = src_Bpp - 3;
- if (dest_alpha_scan) {
- for (int col = 0; col < width; col++) {
- int src_alpha = clip_scan[col];
- if (src_alpha == 255) {
- *dest_scan++ = *src_scan++;
- *dest_scan++ = *src_scan++;
- *dest_scan++ = *src_scan++;
- *dest_alpha_scan++ = 255;
- src_scan += src_gap;
- continue;
- }
- if (src_alpha == 0) {
- dest_scan += 3;
- dest_alpha_scan++;
- src_scan += src_Bpp;
- continue;
- }
- int back_alpha = *dest_alpha_scan;
- uint8_t dest_alpha =
- back_alpha + src_alpha - back_alpha * src_alpha / 255;
- *dest_alpha_scan++ = dest_alpha;
- int alpha_ratio = src_alpha * 255 / dest_alpha;
- for (int color = 0; color < 3; color++) {
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, *src_scan, alpha_ratio);
- dest_scan++;
- src_scan++;
- }
- src_scan += src_gap;
- }
- } else {
- for (int col = 0; col < width; col++) {
- int src_alpha = clip_scan[col];
- if (src_alpha == 255) {
- *dest_scan++ = *src_scan++;
- *dest_scan++ = *src_scan++;
- *dest_scan++ = *src_scan++;
- *dest_scan++ = 255;
- src_scan += src_gap;
- continue;
- }
- if (src_alpha == 0) {
- dest_scan += 4;
- src_scan += src_Bpp;
- continue;
- }
- int back_alpha = dest_scan[3];
- uint8_t dest_alpha =
- back_alpha + src_alpha - back_alpha * src_alpha / 255;
- dest_scan[3] = dest_alpha;
- int alpha_ratio = src_alpha * 255 / dest_alpha;
- for (int color = 0; color < 3; color++) {
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, *src_scan, alpha_ratio);
- dest_scan++;
- src_scan++;
- }
- dest_scan++;
- src_scan += src_gap;
- }
- }
-}
-
-void CompositeRow_Rgb2Argb_NoBlend_NoClip(uint8_t* dest_scan,
- const uint8_t* src_scan,
- int width,
- int src_Bpp,
- uint8_t* dest_alpha_scan) {
- if (dest_alpha_scan) {
- int src_gap = src_Bpp - 3;
- for (int col = 0; col < width; col++) {
- *dest_scan++ = *src_scan++;
- *dest_scan++ = *src_scan++;
- *dest_scan++ = *src_scan++;
- *dest_alpha_scan++ = 0xff;
- src_scan += src_gap;
- }
- } else {
- for (int col = 0; col < width; col++) {
- if (src_Bpp == 4) {
- FXARGB_SETDIB(dest_scan, 0xff000000 | FXARGB_GETDIB(src_scan));
- } else {
- FXARGB_SETDIB(dest_scan,
- FXARGB_MAKE(0xff, src_scan[2], src_scan[1], src_scan[0]));
- }
- dest_scan += 4;
- src_scan += src_Bpp;
- }
- }
-}
-
-void CompositeRow_Argb2Rgb_Blend(uint8_t* dest_scan,
- const uint8_t* src_scan,
- int width,
- int blend_type,
- int dest_Bpp,
- const uint8_t* clip_scan,
- const uint8_t* src_alpha_scan) {
- int blended_colors[3];
- bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
- int dest_gap = dest_Bpp - 3;
- if (src_alpha_scan) {
- for (int col = 0; col < width; col++) {
- uint8_t src_alpha;
- if (clip_scan) {
- src_alpha = (*src_alpha_scan++) * (*clip_scan++) / 255;
- } else {
- src_alpha = *src_alpha_scan++;
- }
- if (src_alpha == 0) {
- dest_scan += dest_Bpp;
- src_scan += 3;
- continue;
- }
- if (bNonseparableBlend) {
- RGB_Blend(blend_type, src_scan, dest_scan, blended_colors);
- }
- for (int color = 0; color < 3; color++) {
- int back_color = *dest_scan;
- int blended = bNonseparableBlend
- ? blended_colors[color]
- : Blend(blend_type, back_color, *src_scan);
- *dest_scan = FXDIB_ALPHA_MERGE(back_color, blended, src_alpha);
- dest_scan++;
- src_scan++;
- }
- dest_scan += dest_gap;
- }
- } else {
- for (int col = 0; col < width; col++) {
- uint8_t src_alpha;
- if (clip_scan) {
- src_alpha = src_scan[3] * (*clip_scan++) / 255;
- } else {
- src_alpha = src_scan[3];
- }
- if (src_alpha == 0) {
- dest_scan += dest_Bpp;
- src_scan += 4;
- continue;
- }
- if (bNonseparableBlend) {
- RGB_Blend(blend_type, src_scan, dest_scan, blended_colors);
- }
- for (int color = 0; color < 3; color++) {
- int back_color = *dest_scan;
- int blended = bNonseparableBlend
- ? blended_colors[color]
- : Blend(blend_type, back_color, *src_scan);
- *dest_scan = FXDIB_ALPHA_MERGE(back_color, blended, src_alpha);
- dest_scan++;
- src_scan++;
- }
- dest_scan += dest_gap;
- src_scan++;
- }
- }
-}
-
-void CompositeRow_Argb2Rgb_NoBlend(uint8_t* dest_scan,
- const uint8_t* src_scan,
- int width,
- int dest_Bpp,
- const uint8_t* clip_scan,
- const uint8_t* src_alpha_scan) {
- int dest_gap = dest_Bpp - 3;
- if (src_alpha_scan) {
- for (int col = 0; col < width; col++) {
- uint8_t src_alpha;
- if (clip_scan) {
- src_alpha = (*src_alpha_scan++) * (*clip_scan++) / 255;
- } else {
- src_alpha = *src_alpha_scan++;
- }
- if (src_alpha == 255) {
- *dest_scan++ = *src_scan++;
- *dest_scan++ = *src_scan++;
- *dest_scan++ = *src_scan++;
- dest_scan += dest_gap;
- continue;
- }
- if (src_alpha == 0) {
- dest_scan += dest_Bpp;
- src_scan += 3;
- continue;
- }
- for (int color = 0; color < 3; color++) {
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, *src_scan, src_alpha);
- dest_scan++;
- src_scan++;
- }
- dest_scan += dest_gap;
- }
- } else {
- for (int col = 0; col < width; col++) {
- uint8_t src_alpha;
- if (clip_scan) {
- src_alpha = src_scan[3] * (*clip_scan++) / 255;
- } else {
- src_alpha = src_scan[3];
- }
- if (src_alpha == 255) {
- *dest_scan++ = *src_scan++;
- *dest_scan++ = *src_scan++;
- *dest_scan++ = *src_scan++;
- dest_scan += dest_gap;
- src_scan++;
- continue;
- }
- if (src_alpha == 0) {
- dest_scan += dest_Bpp;
- src_scan += 4;
- continue;
- }
- for (int color = 0; color < 3; color++) {
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, *src_scan, src_alpha);
- dest_scan++;
- src_scan++;
- }
- dest_scan += dest_gap;
- src_scan++;
- }
- }
-}
-
-void CompositeRow_Rgb2Rgb_Blend_NoClip(uint8_t* dest_scan,
- const uint8_t* src_scan,
- int width,
- int blend_type,
- int dest_Bpp,
- int src_Bpp) {
- int blended_colors[3];
- bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
- int dest_gap = dest_Bpp - 3;
- int src_gap = src_Bpp - 3;
- for (int col = 0; col < width; col++) {
- if (bNonseparableBlend) {
- RGB_Blend(blend_type, src_scan, dest_scan, blended_colors);
- }
- for (int color = 0; color < 3; color++) {
- int back_color = *dest_scan;
- int src_color = *src_scan;
- int blended = bNonseparableBlend
- ? blended_colors[color]
- : Blend(blend_type, back_color, src_color);
- *dest_scan = blended;
- dest_scan++;
- src_scan++;
- }
- dest_scan += dest_gap;
- src_scan += src_gap;
- }
-}
-
-void CompositeRow_Rgb2Rgb_Blend_Clip(uint8_t* dest_scan,
- const uint8_t* src_scan,
- int width,
- int blend_type,
- int dest_Bpp,
- int src_Bpp,
- const uint8_t* clip_scan) {
- int blended_colors[3];
- bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
- int dest_gap = dest_Bpp - 3;
- int src_gap = src_Bpp - 3;
- for (int col = 0; col < width; col++) {
- uint8_t src_alpha = *clip_scan++;
- if (src_alpha == 0) {
- dest_scan += dest_Bpp;
- src_scan += src_Bpp;
- continue;
- }
- if (bNonseparableBlend) {
- RGB_Blend(blend_type, src_scan, dest_scan, blended_colors);
- }
- for (int color = 0; color < 3; color++) {
- int src_color = *src_scan;
- int back_color = *dest_scan;
- int blended = bNonseparableBlend
- ? blended_colors[color]
- : Blend(blend_type, back_color, src_color);
- *dest_scan = FXDIB_ALPHA_MERGE(back_color, blended, src_alpha);
- dest_scan++;
- src_scan++;
- }
- dest_scan += dest_gap;
- src_scan += src_gap;
- }
-}
-
-void CompositeRow_Rgb2Rgb_NoBlend_NoClip(uint8_t* dest_scan,
- const uint8_t* src_scan,
- int width,
- int dest_Bpp,
- int src_Bpp) {
- if (dest_Bpp == src_Bpp) {
- FXSYS_memcpy(dest_scan, src_scan, width * dest_Bpp);
- return;
- }
- for (int col = 0; col < width; col++) {
- dest_scan[0] = src_scan[0];
- dest_scan[1] = src_scan[1];
- dest_scan[2] = src_scan[2];
- dest_scan += dest_Bpp;
- src_scan += src_Bpp;
- }
-}
-
-void CompositeRow_Rgb2Rgb_NoBlend_Clip(uint8_t* dest_scan,
- const uint8_t* src_scan,
- int width,
- int dest_Bpp,
- int src_Bpp,
- const uint8_t* clip_scan) {
- for (int col = 0; col < width; col++) {
- int src_alpha = clip_scan[col];
- if (src_alpha == 255) {
- dest_scan[0] = src_scan[0];
- dest_scan[1] = src_scan[1];
- dest_scan[2] = src_scan[2];
- } else if (src_alpha) {
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, *src_scan, src_alpha);
- dest_scan++;
- src_scan++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, *src_scan, src_alpha);
- dest_scan++;
- src_scan++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, *src_scan, src_alpha);
- dest_scan += dest_Bpp - 2;
- src_scan += src_Bpp - 2;
- continue;
- }
- dest_scan += dest_Bpp;
- src_scan += src_Bpp;
- }
-}
-
-void CompositeRow_Argb2Argb_Transform(uint8_t* dest_scan,
- const uint8_t* src_scan,
- int pixel_count,
- int blend_type,
- const uint8_t* clip_scan,
- uint8_t* dest_alpha_scan,
- const uint8_t* src_alpha_scan,
- uint8_t* src_cache_scan,
- void* pIccTransform) {
- uint8_t* dp = src_cache_scan;
- CCodec_IccModule* pIccModule =
- CFX_GEModule::Get()->GetCodecModule()->GetIccModule();
- if (src_alpha_scan) {
- if (dest_alpha_scan) {
- pIccModule->TranslateScanline(pIccTransform, dp, src_scan, pixel_count);
- } else {
- for (int col = 0; col < pixel_count; col++) {
- pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1);
- dp[3] = *src_alpha_scan++;
- src_scan += 3;
- dp += 4;
- }
- src_alpha_scan = nullptr;
- }
- } else {
- if (dest_alpha_scan) {
- int blended_colors[3];
- bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
- for (int col = 0; col < pixel_count; col++) {
- pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan,
- 1);
- uint8_t back_alpha = *dest_alpha_scan;
- if (back_alpha == 0) {
- if (clip_scan) {
- int src_alpha = clip_scan[col] * src_scan[3] / 255;
- *dest_alpha_scan = src_alpha;
- *dest_scan++ = *src_cache_scan++;
- *dest_scan++ = *src_cache_scan++;
- *dest_scan++ = *src_cache_scan++;
- } else {
- *dest_alpha_scan = src_scan[3];
- *dest_scan++ = *src_cache_scan++;
- *dest_scan++ = *src_cache_scan++;
- *dest_scan++ = *src_cache_scan++;
- }
- dest_alpha_scan++;
- src_scan += 4;
- continue;
- }
- uint8_t src_alpha;
- if (clip_scan) {
- src_alpha = clip_scan[col] * src_scan[3] / 255;
- } else {
- src_alpha = src_scan[3];
- }
- src_scan += 4;
- if (src_alpha == 0) {
- dest_scan += 3;
- src_cache_scan += 3;
- dest_alpha_scan++;
- continue;
- }
- uint8_t dest_alpha =
- back_alpha + src_alpha - back_alpha * src_alpha / 255;
- *dest_alpha_scan++ = dest_alpha;
- int alpha_ratio = src_alpha * 255 / dest_alpha;
- if (bNonseparableBlend) {
- RGB_Blend(blend_type, src_cache_scan, dest_scan, blended_colors);
- }
- for (int color = 0; color < 3; color++) {
- if (blend_type) {
- int blended = bNonseparableBlend
- ? blended_colors[color]
- : Blend(blend_type, *dest_scan, *src_cache_scan);
- blended = FXDIB_ALPHA_MERGE(*src_cache_scan, blended, back_alpha);
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alpha_ratio);
- } else {
- *dest_scan =
- FXDIB_ALPHA_MERGE(*dest_scan, *src_cache_scan, alpha_ratio);
- }
- dest_scan++;
- src_cache_scan++;
- }
- }
- return;
- }
- for (int col = 0; col < pixel_count; col++) {
- pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1);
- dp[3] = src_scan[3];
- src_scan += 4;
- dp += 4;
- }
- }
- CompositeRow_Argb2Argb(dest_scan, src_cache_scan, pixel_count, blend_type,
- clip_scan, dest_alpha_scan, src_alpha_scan);
-}
-
-void CompositeRow_Rgb2Argb_Blend_NoClip_Transform(uint8_t* dest_scan,
- const uint8_t* src_scan,
- int width,
- int blend_type,
- int src_Bpp,
- uint8_t* dest_alpha_scan,
- uint8_t* src_cache_scan,
- void* pIccTransform) {
- CCodec_IccModule* pIccModule =
- CFX_GEModule::Get()->GetCodecModule()->GetIccModule();
- if (src_Bpp == 3) {
- pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan,
- width);
- } else {
- uint8_t* dp = src_cache_scan;
- for (int col = 0; col < width; col++) {
- pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1);
- src_scan += 4;
- dp += 3;
- }
- }
- CompositeRow_Rgb2Argb_Blend_NoClip(dest_scan, src_cache_scan, width,
- blend_type, 3, dest_alpha_scan);
-}
-
-void CompositeRow_Rgb2Argb_Blend_Clip_Transform(uint8_t* dest_scan,
- const uint8_t* src_scan,
- int width,
- int blend_type,
- int src_Bpp,
- const uint8_t* clip_scan,
- uint8_t* dest_alpha_scan,
- uint8_t* src_cache_scan,
- void* pIccTransform) {
- CCodec_IccModule* pIccModule =
- CFX_GEModule::Get()->GetCodecModule()->GetIccModule();
- if (src_Bpp == 3) {
- pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan,
- width);
- } else {
- uint8_t* dp = src_cache_scan;
- for (int col = 0; col < width; col++) {
- pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1);
- src_scan += 4;
- dp += 3;
- }
- }
- CompositeRow_Rgb2Argb_Blend_Clip(dest_scan, src_cache_scan, width, blend_type,
- 3, clip_scan, dest_alpha_scan);
-}
-
-void CompositeRow_Rgb2Argb_NoBlend_Clip_Transform(uint8_t* dest_scan,
- const uint8_t* src_scan,
- int width,
- int src_Bpp,
- const uint8_t* clip_scan,
- uint8_t* dest_alpha_scan,
- uint8_t* src_cache_scan,
- void* pIccTransform) {
- CCodec_IccModule* pIccModule =
- CFX_GEModule::Get()->GetCodecModule()->GetIccModule();
- if (src_Bpp == 3) {
- pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan,
- width);
- } else {
- uint8_t* dp = src_cache_scan;
- for (int col = 0; col < width; col++) {
- pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1);
- src_scan += 4;
- dp += 3;
- }
- }
- CompositeRow_Rgb2Argb_NoBlend_Clip(dest_scan, src_cache_scan, width, 3,
- clip_scan, dest_alpha_scan);
-}
-
-void CompositeRow_Rgb2Argb_NoBlend_NoClip_Transform(uint8_t* dest_scan,
- const uint8_t* src_scan,
- int width,
- int src_Bpp,
- uint8_t* dest_alpha_scan,
- uint8_t* src_cache_scan,
- void* pIccTransform) {
- CCodec_IccModule* pIccModule =
- CFX_GEModule::Get()->GetCodecModule()->GetIccModule();
- if (src_Bpp == 3) {
- pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan,
- width);
- } else {
- uint8_t* dp = src_cache_scan;
- for (int col = 0; col < width; col++) {
- pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1);
- src_scan += 4;
- dp += 3;
- }
- }
- CompositeRow_Rgb2Argb_NoBlend_NoClip(dest_scan, src_cache_scan, width, 3,
- dest_alpha_scan);
-}
-
-void CompositeRow_Argb2Rgb_Blend_Transform(uint8_t* dest_scan,
- const uint8_t* src_scan,
- int width,
- int blend_type,
- int dest_Bpp,
- const uint8_t* clip_scan,
- const uint8_t* src_alpha_scan,
- uint8_t* src_cache_scan,
- void* pIccTransform) {
- CCodec_IccModule* pIccModule =
- CFX_GEModule::Get()->GetCodecModule()->GetIccModule();
- if (src_alpha_scan) {
- pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan,
- width);
- } else {
- int blended_colors[3];
- bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
- int dest_gap = dest_Bpp - 3;
- for (int col = 0; col < width; col++) {
- pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, 1);
- uint8_t src_alpha;
- if (clip_scan) {
- src_alpha = src_scan[3] * (*clip_scan++) / 255;
- } else {
- src_alpha = src_scan[3];
- }
- src_scan += 4;
- if (src_alpha == 0) {
- dest_scan += dest_Bpp;
- src_cache_scan += 3;
- continue;
- }
- if (bNonseparableBlend) {
- RGB_Blend(blend_type, src_cache_scan, dest_scan, blended_colors);
- }
- for (int color = 0; color < 3; color++) {
- int back_color = *dest_scan;
- int blended = bNonseparableBlend
- ? blended_colors[color]
- : Blend(blend_type, back_color, *src_cache_scan);
- *dest_scan = FXDIB_ALPHA_MERGE(back_color, blended, src_alpha);
- dest_scan++;
- src_cache_scan++;
- }
- dest_scan += dest_gap;
- }
- return;
- }
- CompositeRow_Argb2Rgb_Blend(dest_scan, src_cache_scan, width, blend_type,
- dest_Bpp, clip_scan, src_alpha_scan);
-}
-
-void CompositeRow_Argb2Rgb_NoBlend_Transform(uint8_t* dest_scan,
- const uint8_t* src_scan,
- int width,
- int dest_Bpp,
- const uint8_t* clip_scan,
- const uint8_t* src_alpha_scan,
- uint8_t* src_cache_scan,
- void* pIccTransform) {
- CCodec_IccModule* pIccModule =
- CFX_GEModule::Get()->GetCodecModule()->GetIccModule();
- if (src_alpha_scan) {
- pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan,
- width);
- } else {
- int dest_gap = dest_Bpp - 3;
- for (int col = 0; col < width; col++) {
- pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, 1);
- uint8_t src_alpha;
- if (clip_scan) {
- src_alpha = src_scan[3] * (*clip_scan++) / 255;
- } else {
- src_alpha = src_scan[3];
- }
- src_scan += 4;
- if (src_alpha == 255) {
- *dest_scan++ = *src_cache_scan++;
- *dest_scan++ = *src_cache_scan++;
- *dest_scan++ = *src_cache_scan++;
- dest_scan += dest_gap;
- continue;
- }
- if (src_alpha == 0) {
- dest_scan += dest_Bpp;
- src_cache_scan += 3;
- continue;
- }
- for (int color = 0; color < 3; color++) {
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, *src_cache_scan, src_alpha);
- dest_scan++;
- src_cache_scan++;
- }
- dest_scan += dest_gap;
- }
- return;
- }
- CompositeRow_Argb2Rgb_NoBlend(dest_scan, src_cache_scan, width, dest_Bpp,
- clip_scan, src_alpha_scan);
-}
-
-void CompositeRow_Rgb2Rgb_Blend_NoClip_Transform(uint8_t* dest_scan,
- const uint8_t* src_scan,
- int width,
- int blend_type,
- int dest_Bpp,
- int src_Bpp,
- uint8_t* src_cache_scan,
- void* pIccTransform) {
- CCodec_IccModule* pIccModule =
- CFX_GEModule::Get()->GetCodecModule()->GetIccModule();
- if (src_Bpp == 3) {
- pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan,
- width);
- } else {
- uint8_t* dp = src_cache_scan;
- for (int col = 0; col < width; col++) {
- pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1);
- src_scan += 4;
- dp += 3;
- }
- }
- CompositeRow_Rgb2Rgb_Blend_NoClip(dest_scan, src_cache_scan, width,
- blend_type, dest_Bpp, 3);
-}
-
-void CompositeRow_Rgb2Rgb_Blend_Clip_Transform(uint8_t* dest_scan,
- const uint8_t* src_scan,
- int width,
- int blend_type,
- int dest_Bpp,
- int src_Bpp,
- const uint8_t* clip_scan,
- uint8_t* src_cache_scan,
- void* pIccTransform) {
- CCodec_IccModule* pIccModule =
- CFX_GEModule::Get()->GetCodecModule()->GetIccModule();
- if (src_Bpp == 3) {
- pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan,
- width);
- } else {
- uint8_t* dp = src_cache_scan;
- for (int col = 0; col < width; col++) {
- pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1);
- src_scan += 4;
- dp += 3;
- }
- }
- CompositeRow_Rgb2Rgb_Blend_Clip(dest_scan, src_cache_scan, width, blend_type,
- dest_Bpp, 3, clip_scan);
-}
-
-void CompositeRow_Rgb2Rgb_NoBlend_NoClip_Transform(uint8_t* dest_scan,
- const uint8_t* src_scan,
- int width,
- int dest_Bpp,
- int src_Bpp,
- uint8_t* src_cache_scan,
- void* pIccTransform) {
- CCodec_IccModule* pIccModule =
- CFX_GEModule::Get()->GetCodecModule()->GetIccModule();
- if (src_Bpp == 3) {
- pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan,
- width);
- } else {
- uint8_t* dp = src_cache_scan;
- for (int col = 0; col < width; col++) {
- pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1);
- src_scan += 4;
- dp += 3;
- }
- }
- CompositeRow_Rgb2Rgb_NoBlend_NoClip(dest_scan, src_cache_scan, width,
- dest_Bpp, 3);
-}
-
-void CompositeRow_Rgb2Rgb_NoBlend_Clip_Transform(uint8_t* dest_scan,
- const uint8_t* src_scan,
- int width,
- int dest_Bpp,
- int src_Bpp,
- const uint8_t* clip_scan,
- uint8_t* src_cache_scan,
- void* pIccTransform) {
- CCodec_IccModule* pIccModule =
- CFX_GEModule::Get()->GetCodecModule()->GetIccModule();
- if (src_Bpp == 3) {
- pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan,
- width);
- } else {
- uint8_t* dp = src_cache_scan;
- for (int col = 0; col < width; col++) {
- pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1);
- src_scan += 4;
- dp += 3;
- }
- }
- CompositeRow_Rgb2Rgb_NoBlend_Clip(dest_scan, src_cache_scan, width, dest_Bpp,
- 3, clip_scan);
-}
-
-void CompositeRow_8bppPal2Gray(uint8_t* dest_scan,
- const uint8_t* src_scan,
- const uint8_t* pPalette,
- int pixel_count,
- int blend_type,
- const uint8_t* clip_scan,
- const uint8_t* src_alpha_scan) {
- if (src_alpha_scan) {
- if (blend_type) {
- bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
- for (int col = 0; col < pixel_count; col++) {
- uint8_t gray = pPalette[*src_scan];
- int src_alpha = *src_alpha_scan++;
- if (clip_scan) {
- src_alpha = clip_scan[col] * src_alpha / 255;
- }
- if (bNonseparableBlend)
- gray = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan;
- else
- gray = Blend(blend_type, *dest_scan, gray);
- if (src_alpha) {
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, src_alpha);
- } else {
- *dest_scan = gray;
- }
- dest_scan++;
- src_scan++;
- }
- return;
- }
- for (int col = 0; col < pixel_count; col++) {
- uint8_t gray = pPalette[*src_scan];
- int src_alpha = *src_alpha_scan++;
- if (clip_scan) {
- src_alpha = clip_scan[col] * src_alpha / 255;
- }
- if (src_alpha) {
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, src_alpha);
- } else {
- *dest_scan = gray;
- }
- dest_scan++;
- src_scan++;
- }
- } else {
- if (blend_type) {
- bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
- for (int col = 0; col < pixel_count; col++) {
- uint8_t gray = pPalette[*src_scan];
- if (bNonseparableBlend)
- gray = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan;
- else
- gray = Blend(blend_type, *dest_scan, gray);
- if (clip_scan && clip_scan[col] < 255) {
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, clip_scan[col]);
- } else {
- *dest_scan = gray;
- }
- dest_scan++;
- src_scan++;
- }
- return;
- }
- for (int col = 0; col < pixel_count; col++) {
- uint8_t gray = pPalette[*src_scan];
- if (clip_scan && clip_scan[col] < 255) {
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, clip_scan[col]);
- } else {
- *dest_scan = gray;
- }
- dest_scan++;
- src_scan++;
- }
- }
-}
-
-void CompositeRow_8bppPal2Graya(uint8_t* dest_scan,
- const uint8_t* src_scan,
- const uint8_t* pPalette,
- int pixel_count,
- int blend_type,
- const uint8_t* clip_scan,
- uint8_t* dest_alpha_scan,
- const uint8_t* src_alpha_scan) {
- if (src_alpha_scan) {
- if (blend_type) {
- bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
- for (int col = 0; col < pixel_count; col++) {
- uint8_t gray = pPalette[*src_scan];
- src_scan++;
- uint8_t back_alpha = *dest_alpha_scan;
- if (back_alpha == 0) {
- int src_alpha = *src_alpha_scan++;
- if (clip_scan) {
- src_alpha = clip_scan[col] * src_alpha / 255;
- }
- if (src_alpha) {
- *dest_scan = gray;
- *dest_alpha_scan = src_alpha;
- }
- dest_scan++;
- dest_alpha_scan++;
- continue;
- }
- uint8_t src_alpha = *src_alpha_scan++;
- if (clip_scan) {
- src_alpha = clip_scan[col] * src_alpha / 255;
- }
- if (src_alpha == 0) {
- dest_scan++;
- dest_alpha_scan++;
- continue;
- }
- *dest_alpha_scan =
- back_alpha + src_alpha - back_alpha * src_alpha / 255;
- int alpha_ratio = src_alpha * 255 / (*dest_alpha_scan);
- if (bNonseparableBlend)
- gray = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan;
- else
- gray = Blend(blend_type, *dest_scan, gray);
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio);
- dest_alpha_scan++;
- dest_scan++;
- }
- return;
- }
- for (int col = 0; col < pixel_count; col++) {
- uint8_t gray = pPalette[*src_scan];
- src_scan++;
- uint8_t back_alpha = *dest_alpha_scan;
- if (back_alpha == 0) {
- int src_alpha = *src_alpha_scan++;
- if (clip_scan) {
- src_alpha = clip_scan[col] * src_alpha / 255;
- }
- if (src_alpha) {
- *dest_scan = gray;
- *dest_alpha_scan = src_alpha;
- }
- dest_scan++;
- dest_alpha_scan++;
- continue;
- }
- uint8_t src_alpha = *src_alpha_scan++;
- if (clip_scan) {
- src_alpha = clip_scan[col] * src_alpha / 255;
- }
- if (src_alpha == 0) {
- dest_scan++;
- dest_alpha_scan++;
- continue;
- }
- *dest_alpha_scan = back_alpha + src_alpha - back_alpha * src_alpha / 255;
- int alpha_ratio = src_alpha * 255 / (*dest_alpha_scan);
- dest_alpha_scan++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio);
- dest_scan++;
- }
- } else {
- if (blend_type) {
- bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
- for (int col = 0; col < pixel_count; col++) {
- uint8_t gray = pPalette[*src_scan];
- src_scan++;
- if (!clip_scan || clip_scan[col] == 255) {
- *dest_scan++ = gray;
- *dest_alpha_scan++ = 255;
- continue;
- }
- int src_alpha = clip_scan[col];
- if (src_alpha == 0) {
- dest_scan++;
- dest_alpha_scan++;
- continue;
- }
- int back_alpha = *dest_alpha_scan;
- uint8_t dest_alpha =
- back_alpha + src_alpha - back_alpha * src_alpha / 255;
- *dest_alpha_scan++ = dest_alpha;
- int alpha_ratio = src_alpha * 255 / dest_alpha;
- if (bNonseparableBlend)
- gray = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan;
- else
- gray = Blend(blend_type, *dest_scan, gray);
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio);
- dest_scan++;
- }
- return;
- }
- for (int col = 0; col < pixel_count; col++) {
- uint8_t gray = pPalette[*src_scan];
- src_scan++;
- if (!clip_scan || clip_scan[col] == 255) {
- *dest_scan++ = gray;
- *dest_alpha_scan++ = 255;
- continue;
- }
- int src_alpha = clip_scan[col];
- if (src_alpha == 0) {
- dest_scan++;
- dest_alpha_scan++;
- continue;
- }
- int back_alpha = *dest_alpha_scan;
- uint8_t dest_alpha =
- back_alpha + src_alpha - back_alpha * src_alpha / 255;
- *dest_alpha_scan++ = dest_alpha;
- int alpha_ratio = src_alpha * 255 / dest_alpha;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio);
- dest_scan++;
- }
- }
-}
-
-void CompositeRow_1bppPal2Gray(uint8_t* dest_scan,
- const uint8_t* src_scan,
- int src_left,
- const uint8_t* pPalette,
- int pixel_count,
- int blend_type,
- const uint8_t* clip_scan) {
- int reset_gray = pPalette[0];
- int set_gray = pPalette[1];
- if (blend_type) {
- bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
- for (int col = 0; col < pixel_count; col++) {
- uint8_t gray =
- (src_scan[(col + src_left) / 8] & (1 << (7 - (col + src_left) % 8)))
- ? set_gray
- : reset_gray;
- if (bNonseparableBlend)
- gray = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan;
- else
- gray = Blend(blend_type, *dest_scan, gray);
- if (clip_scan && clip_scan[col] < 255) {
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, clip_scan[col]);
- } else {
- *dest_scan = gray;
- }
- dest_scan++;
- }
- return;
- }
- for (int col = 0; col < pixel_count; col++) {
- uint8_t gray =
- (src_scan[(col + src_left) / 8] & (1 << (7 - (col + src_left) % 8)))
- ? set_gray
- : reset_gray;
- if (clip_scan && clip_scan[col] < 255) {
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, clip_scan[col]);
- } else {
- *dest_scan = gray;
- }
- dest_scan++;
- }
-}
-
-void CompositeRow_1bppPal2Graya(uint8_t* dest_scan,
- const uint8_t* src_scan,
- int src_left,
- const uint8_t* pPalette,
- int pixel_count,
- int blend_type,
- const uint8_t* clip_scan,
- uint8_t* dest_alpha_scan) {
- int reset_gray = pPalette[0];
- int set_gray = pPalette[1];
- if (blend_type) {
- bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
- for (int col = 0; col < pixel_count; col++) {
- uint8_t gray =
- (src_scan[(col + src_left) / 8] & (1 << (7 - (col + src_left) % 8)))
- ? set_gray
- : reset_gray;
- if (!clip_scan || clip_scan[col] == 255) {
- *dest_scan++ = gray;
- *dest_alpha_scan++ = 255;
- continue;
- }
- int src_alpha = clip_scan[col];
- if (src_alpha == 0) {
- dest_scan++;
- dest_alpha_scan++;
- continue;
- }
- int back_alpha = *dest_alpha_scan;
- uint8_t dest_alpha =
- back_alpha + src_alpha - back_alpha * src_alpha / 255;
- *dest_alpha_scan++ = dest_alpha;
- int alpha_ratio = src_alpha * 255 / dest_alpha;
- if (bNonseparableBlend)
- gray = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan;
- else
- gray = Blend(blend_type, *dest_scan, gray);
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio);
- dest_scan++;
- }
- return;
- }
- for (int col = 0; col < pixel_count; col++) {
- uint8_t gray =
- (src_scan[(col + src_left) / 8] & (1 << (7 - (col + src_left) % 8)))
- ? set_gray
- : reset_gray;
- if (!clip_scan || clip_scan[col] == 255) {
- *dest_scan++ = gray;
- *dest_alpha_scan++ = 255;
- continue;
- }
- int src_alpha = clip_scan[col];
- if (src_alpha == 0) {
- dest_scan++;
- dest_alpha_scan++;
- continue;
- }
- int back_alpha = *dest_alpha_scan;
- uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255;
- *dest_alpha_scan++ = dest_alpha;
- int alpha_ratio = src_alpha * 255 / dest_alpha;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio);
- dest_scan++;
- }
-}
-
-void CompositeRow_8bppRgb2Rgb_NoBlend(uint8_t* dest_scan,
- const uint8_t* src_scan,
- uint32_t* pPalette,
- int pixel_count,
- int DestBpp,
- const uint8_t* clip_scan,
- const uint8_t* src_alpha_scan) {
- if (src_alpha_scan) {
- int dest_gap = DestBpp - 3;
- FX_ARGB argb = 0;
- for (int col = 0; col < pixel_count; col++) {
- argb = pPalette[*src_scan];
- int src_r = FXARGB_R(argb);
- int src_g = FXARGB_G(argb);
- int src_b = FXARGB_B(argb);
- src_scan++;
- uint8_t src_alpha = 0;
- if (clip_scan) {
- src_alpha = (*src_alpha_scan++) * (*clip_scan++) / 255;
- } else {
- src_alpha = *src_alpha_scan++;
- }
- if (src_alpha == 255) {
- *dest_scan++ = src_b;
- *dest_scan++ = src_g;
- *dest_scan++ = src_r;
- dest_scan += dest_gap;
- continue;
- }
- if (src_alpha == 0) {
- dest_scan += DestBpp;
- continue;
- }
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, src_alpha);
- dest_scan++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, src_alpha);
- dest_scan++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, src_alpha);
- dest_scan++;
- dest_scan += dest_gap;
- }
- } else {
- FX_ARGB argb = 0;
- for (int col = 0; col < pixel_count; col++) {
- argb = pPalette[*src_scan];
- int src_r = FXARGB_R(argb);
- int src_g = FXARGB_G(argb);
- int src_b = FXARGB_B(argb);
- if (clip_scan && clip_scan[col] < 255) {
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, clip_scan[col]);
- dest_scan++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, clip_scan[col]);
- dest_scan++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, clip_scan[col]);
- dest_scan++;
- } else {
- *dest_scan++ = src_b;
- *dest_scan++ = src_g;
- *dest_scan++ = src_r;
- }
- if (DestBpp == 4) {
- dest_scan++;
- }
- src_scan++;
- }
- }
-}
-
-void CompositeRow_1bppRgb2Rgb_NoBlend(uint8_t* dest_scan,
- const uint8_t* src_scan,
- int src_left,
- uint32_t* pPalette,
- int pixel_count,
- int DestBpp,
- const uint8_t* clip_scan) {
- int reset_r, reset_g, reset_b;
- int set_r, set_g, set_b;
- reset_r = FXARGB_R(pPalette[0]);
- reset_g = FXARGB_G(pPalette[0]);
- reset_b = FXARGB_B(pPalette[0]);
- set_r = FXARGB_R(pPalette[1]);
- set_g = FXARGB_G(pPalette[1]);
- set_b = FXARGB_B(pPalette[1]);
- for (int col = 0; col < pixel_count; col++) {
- int src_r, src_g, src_b;
- if (src_scan[(col + src_left) / 8] & (1 << (7 - (col + src_left) % 8))) {
- src_r = set_r;
- src_g = set_g;
- src_b = set_b;
- } else {
- src_r = reset_r;
- src_g = reset_g;
- src_b = reset_b;
- }
- if (clip_scan && clip_scan[col] < 255) {
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, clip_scan[col]);
- dest_scan++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, clip_scan[col]);
- dest_scan++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, clip_scan[col]);
- dest_scan++;
- } else {
- *dest_scan++ = src_b;
- *dest_scan++ = src_g;
- *dest_scan++ = src_r;
- }
- if (DestBpp == 4) {
- dest_scan++;
- }
- }
-}
-
-void CompositeRow_8bppRgb2Argb_NoBlend(uint8_t* dest_scan,
- const uint8_t* src_scan,
- int width,
- uint32_t* pPalette,
- const uint8_t* clip_scan,
- const uint8_t* src_alpha_scan) {
- if (src_alpha_scan) {
- for (int col = 0; col < width; col++) {
- FX_ARGB argb = pPalette[*src_scan];
- src_scan++;
- int src_r = FXARGB_R(argb);
- int src_g = FXARGB_G(argb);
- int src_b = FXARGB_B(argb);
- uint8_t back_alpha = dest_scan[3];
- if (back_alpha == 0) {
- if (clip_scan) {
- int src_alpha = clip_scan[col] * (*src_alpha_scan) / 255;
- FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alpha, src_r, src_g, src_b));
- } else {
- FXARGB_SETDIB(dest_scan,
- FXARGB_MAKE(*src_alpha_scan, src_r, src_g, src_b));
- }
- dest_scan += 4;
- src_alpha_scan++;
- continue;
- }
- uint8_t src_alpha;
- if (clip_scan) {
- src_alpha = clip_scan[col] * (*src_alpha_scan++) / 255;
- } else {
- src_alpha = *src_alpha_scan++;
- }
- if (src_alpha == 0) {
- dest_scan += 4;
- continue;
- }
- uint8_t dest_alpha =
- back_alpha + src_alpha - back_alpha * src_alpha / 255;
- dest_scan[3] = dest_alpha;
- int alpha_ratio = src_alpha * 255 / dest_alpha;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio);
- dest_scan++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, alpha_ratio);
- dest_scan++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, alpha_ratio);
- dest_scan++;
- dest_scan++;
- }
- } else {
- for (int col = 0; col < width; col++) {
- FX_ARGB argb = pPalette[*src_scan];
- int src_r = FXARGB_R(argb);
- int src_g = FXARGB_G(argb);
- int src_b = FXARGB_B(argb);
- if (!clip_scan || clip_scan[col] == 255) {
- *dest_scan++ = src_b;
- *dest_scan++ = src_g;
- *dest_scan++ = src_r;
- *dest_scan++ = 255;
- src_scan++;
- continue;
- }
- int src_alpha = clip_scan[col];
- if (src_alpha == 0) {
- dest_scan += 4;
- src_scan++;
- continue;
- }
- int back_alpha = dest_scan[3];
- uint8_t dest_alpha =
- back_alpha + src_alpha - back_alpha * src_alpha / 255;
- dest_scan[3] = dest_alpha;
- int alpha_ratio = src_alpha * 255 / dest_alpha;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio);
- dest_scan++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, alpha_ratio);
- dest_scan++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, alpha_ratio);
- dest_scan++;
- dest_scan++;
- src_scan++;
- }
- }
-}
-
-void CompositeRow_1bppRgb2Argb_NoBlend(uint8_t* dest_scan,
- const uint8_t* src_scan,
- int src_left,
- int width,
- uint32_t* pPalette,
- const uint8_t* clip_scan) {
- int reset_r, reset_g, reset_b;
- int set_r, set_g, set_b;
- reset_r = FXARGB_R(pPalette[0]);
- reset_g = FXARGB_G(pPalette[0]);
- reset_b = FXARGB_B(pPalette[0]);
- set_r = FXARGB_R(pPalette[1]);
- set_g = FXARGB_G(pPalette[1]);
- set_b = FXARGB_B(pPalette[1]);
- for (int col = 0; col < width; col++) {
- int src_r, src_g, src_b;
- if (src_scan[(col + src_left) / 8] & (1 << (7 - (col + src_left) % 8))) {
- src_r = set_r;
- src_g = set_g;
- src_b = set_b;
- } else {
- src_r = reset_r;
- src_g = reset_g;
- src_b = reset_b;
- }
- if (!clip_scan || clip_scan[col] == 255) {
- *dest_scan++ = src_b;
- *dest_scan++ = src_g;
- *dest_scan++ = src_r;
- *dest_scan++ = 255;
- continue;
- }
- int src_alpha = clip_scan[col];
- if (src_alpha == 0) {
- dest_scan += 4;
- continue;
- }
- int back_alpha = dest_scan[3];
- uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255;
- dest_scan[3] = dest_alpha;
- int alpha_ratio = src_alpha * 255 / dest_alpha;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio);
- dest_scan++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, alpha_ratio);
- dest_scan++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, alpha_ratio);
- dest_scan++;
- dest_scan++;
- }
-}
-
-void CompositeRow_1bppRgb2Rgba_NoBlend(uint8_t* dest_scan,
- const uint8_t* src_scan,
- int src_left,
- int width,
- uint32_t* pPalette,
- const uint8_t* clip_scan,
- uint8_t* dest_alpha_scan) {
- int reset_r, reset_g, reset_b;
- int set_r, set_g, set_b;
- reset_r = FXARGB_R(pPalette[0]);
- reset_g = FXARGB_G(pPalette[0]);
- reset_b = FXARGB_B(pPalette[0]);
- set_r = FXARGB_R(pPalette[1]);
- set_g = FXARGB_G(pPalette[1]);
- set_b = FXARGB_B(pPalette[1]);
- for (int col = 0; col < width; col++) {
- int src_r, src_g, src_b;
- if (src_scan[(col + src_left) / 8] & (1 << (7 - (col + src_left) % 8))) {
- src_r = set_r;
- src_g = set_g;
- src_b = set_b;
- } else {
- src_r = reset_r;
- src_g = reset_g;
- src_b = reset_b;
- }
- if (!clip_scan || clip_scan[col] == 255) {
- *dest_scan++ = src_b;
- *dest_scan++ = src_g;
- *dest_scan++ = src_r;
- *dest_alpha_scan++ = 255;
- continue;
- }
- int src_alpha = clip_scan[col];
- if (src_alpha == 0) {
- dest_scan += 3;
- dest_alpha_scan++;
- continue;
- }
- int back_alpha = *dest_alpha_scan;
- uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255;
- *dest_alpha_scan++ = dest_alpha;
- int alpha_ratio = src_alpha * 255 / dest_alpha;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio);
- dest_scan++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, alpha_ratio);
- dest_scan++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, alpha_ratio);
- dest_scan++;
- }
-}
-
-void CompositeRow_ByteMask2Argb(uint8_t* dest_scan,
- const uint8_t* src_scan,
- int mask_alpha,
- int src_r,
- int src_g,
- int src_b,
- int pixel_count,
- int blend_type,
- const uint8_t* clip_scan) {
- for (int col = 0; col < pixel_count; col++) {
- int src_alpha;
- if (clip_scan) {
- src_alpha = mask_alpha * clip_scan[col] * src_scan[col] / 255 / 255;
- } else {
- src_alpha = mask_alpha * src_scan[col] / 255;
- }
- uint8_t back_alpha = dest_scan[3];
- if (back_alpha == 0) {
- FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alpha, src_r, src_g, src_b));
- dest_scan += 4;
- continue;
- }
- if (src_alpha == 0) {
- dest_scan += 4;
- continue;
- }
- uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255;
- dest_scan[3] = dest_alpha;
- int alpha_ratio = src_alpha * 255 / dest_alpha;
- if (blend_type >= FXDIB_BLEND_NONSEPARABLE) {
- int blended_colors[3];
- uint8_t scan[3] = {static_cast<uint8_t>(src_b),
- static_cast<uint8_t>(src_g),
- static_cast<uint8_t>(src_r)};
- RGB_Blend(blend_type, scan, dest_scan, blended_colors);
- *dest_scan =
- FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[0], alpha_ratio);
- dest_scan++;
- *dest_scan =
- FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[1], alpha_ratio);
- dest_scan++;
- *dest_scan =
- FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[2], alpha_ratio);
- } else if (blend_type) {
- int blended = Blend(blend_type, *dest_scan, src_b);
- blended = FXDIB_ALPHA_MERGE(src_b, blended, back_alpha);
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alpha_ratio);
- dest_scan++;
- blended = Blend(blend_type, *dest_scan, src_g);
- blended = FXDIB_ALPHA_MERGE(src_g, blended, back_alpha);
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alpha_ratio);
- dest_scan++;
- blended = Blend(blend_type, *dest_scan, src_r);
- blended = FXDIB_ALPHA_MERGE(src_r, blended, back_alpha);
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alpha_ratio);
- } else {
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio);
- dest_scan++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, alpha_ratio);
- dest_scan++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, alpha_ratio);
- }
- dest_scan += 2;
- }
-}
-
-void CompositeRow_ByteMask2Rgba(uint8_t* dest_scan,
- const uint8_t* src_scan,
- int mask_alpha,
- int src_r,
- int src_g,
- int src_b,
- int pixel_count,
- int blend_type,
- const uint8_t* clip_scan,
- uint8_t* dest_alpha_scan) {
- for (int col = 0; col < pixel_count; col++) {
- int src_alpha;
- if (clip_scan) {
- src_alpha = mask_alpha * clip_scan[col] * src_scan[col] / 255 / 255;
- } else {
- src_alpha = mask_alpha * src_scan[col] / 255;
- }
- uint8_t back_alpha = *dest_alpha_scan;
- if (back_alpha == 0) {
- *dest_scan++ = src_b;
- *dest_scan++ = src_g;
- *dest_scan++ = src_r;
- *dest_alpha_scan++ = src_alpha;
- continue;
- }
- if (src_alpha == 0) {
- dest_scan += 3;
- dest_alpha_scan++;
- continue;
- }
- uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255;
- *dest_alpha_scan++ = dest_alpha;
- int alpha_ratio = src_alpha * 255 / dest_alpha;
- if (blend_type >= FXDIB_BLEND_NONSEPARABLE) {
- int blended_colors[3];
- uint8_t scan[3] = {static_cast<uint8_t>(src_b),
- static_cast<uint8_t>(src_g),
- static_cast<uint8_t>(src_r)};
- RGB_Blend(blend_type, scan, dest_scan, blended_colors);
- *dest_scan =
- FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[0], alpha_ratio);
- dest_scan++;
- *dest_scan =
- FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[1], alpha_ratio);
- dest_scan++;
- *dest_scan =
- FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[2], alpha_ratio);
- dest_scan++;
- } else if (blend_type) {
- int blended = Blend(blend_type, *dest_scan, src_b);
- blended = FXDIB_ALPHA_MERGE(src_b, blended, back_alpha);
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alpha_ratio);
- dest_scan++;
- blended = Blend(blend_type, *dest_scan, src_g);
- blended = FXDIB_ALPHA_MERGE(src_g, blended, back_alpha);
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alpha_ratio);
- dest_scan++;
- blended = Blend(blend_type, *dest_scan, src_r);
- blended = FXDIB_ALPHA_MERGE(src_r, blended, back_alpha);
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alpha_ratio);
- dest_scan++;
- } else {
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio);
- dest_scan++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, alpha_ratio);
- dest_scan++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, alpha_ratio);
- dest_scan++;
- }
- }
-}
-
-void CompositeRow_ByteMask2Rgb(uint8_t* dest_scan,
- const uint8_t* src_scan,
- int mask_alpha,
- int src_r,
- int src_g,
- int src_b,
- int pixel_count,
- int blend_type,
- int Bpp,
- const uint8_t* clip_scan) {
- for (int col = 0; col < pixel_count; col++) {
- int src_alpha;
- if (clip_scan) {
- src_alpha = mask_alpha * clip_scan[col] * src_scan[col] / 255 / 255;
- } else {
- src_alpha = mask_alpha * src_scan[col] / 255;
- }
- if (src_alpha == 0) {
- dest_scan += Bpp;
- continue;
- }
- if (blend_type >= FXDIB_BLEND_NONSEPARABLE) {
- int blended_colors[3];
- uint8_t scan[3] = {static_cast<uint8_t>(src_b),
- static_cast<uint8_t>(src_g),
- static_cast<uint8_t>(src_r)};
- RGB_Blend(blend_type, scan, dest_scan, blended_colors);
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[0], src_alpha);
- dest_scan++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[1], src_alpha);
- dest_scan++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[2], src_alpha);
- } else if (blend_type) {
- int blended = Blend(blend_type, *dest_scan, src_b);
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, src_alpha);
- dest_scan++;
- blended = Blend(blend_type, *dest_scan, src_g);
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, src_alpha);
- dest_scan++;
- blended = Blend(blend_type, *dest_scan, src_r);
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, src_alpha);
- } else {
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, src_alpha);
- dest_scan++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, src_alpha);
- dest_scan++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, src_alpha);
- }
- dest_scan += Bpp - 2;
- }
-}
-
-void CompositeRow_ByteMask2Mask(uint8_t* dest_scan,
- const uint8_t* src_scan,
- int mask_alpha,
- int pixel_count,
- const uint8_t* clip_scan) {
- for (int col = 0; col < pixel_count; col++) {
- int src_alpha;
- if (clip_scan) {
- src_alpha = mask_alpha * clip_scan[col] * src_scan[col] / 255 / 255;
- } else {
- src_alpha = mask_alpha * src_scan[col] / 255;
- }
- uint8_t back_alpha = *dest_scan;
- if (!back_alpha) {
- *dest_scan = src_alpha;
- } else if (src_alpha) {
- *dest_scan = back_alpha + src_alpha - back_alpha * src_alpha / 255;
- }
- dest_scan++;
- }
-}
-
-void CompositeRow_ByteMask2Gray(uint8_t* dest_scan,
- const uint8_t* src_scan,
- int mask_alpha,
- int src_gray,
- int pixel_count,
- const uint8_t* clip_scan) {
- for (int col = 0; col < pixel_count; col++) {
- int src_alpha;
- if (clip_scan) {
- src_alpha = mask_alpha * clip_scan[col] * src_scan[col] / 255 / 255;
- } else {
- src_alpha = mask_alpha * src_scan[col] / 255;
- }
- if (src_alpha) {
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_gray, src_alpha);
- }
- dest_scan++;
- }
-}
-
-void CompositeRow_ByteMask2Graya(uint8_t* dest_scan,
- const uint8_t* src_scan,
- int mask_alpha,
- int src_gray,
- int pixel_count,
- const uint8_t* clip_scan,
- uint8_t* dest_alpha_scan) {
- for (int col = 0; col < pixel_count; col++) {
- int src_alpha;
- if (clip_scan) {
- src_alpha = mask_alpha * clip_scan[col] * src_scan[col] / 255 / 255;
- } else {
- src_alpha = mask_alpha * src_scan[col] / 255;
- }
- uint8_t back_alpha = *dest_alpha_scan;
- if (back_alpha == 0) {
- *dest_scan++ = src_gray;
- *dest_alpha_scan++ = src_alpha;
- continue;
- }
- if (src_alpha == 0) {
- dest_scan++;
- dest_alpha_scan++;
- continue;
- }
- uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255;
- *dest_alpha_scan++ = dest_alpha;
- int alpha_ratio = src_alpha * 255 / dest_alpha;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_gray, alpha_ratio);
- dest_scan++;
- }
-}
-
-void CompositeRow_BitMask2Argb(uint8_t* dest_scan,
- const uint8_t* src_scan,
- int mask_alpha,
- int src_r,
- int src_g,
- int src_b,
- int src_left,
- int pixel_count,
- int blend_type,
- const uint8_t* clip_scan) {
- if (blend_type == FXDIB_BLEND_NORMAL && !clip_scan && mask_alpha == 255) {
- FX_ARGB argb = FXARGB_MAKE(0xff, src_r, src_g, src_b);
- for (int col = 0; col < pixel_count; col++) {
- if (src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8))) {
- FXARGB_SETDIB(dest_scan, argb);
- }
- dest_scan += 4;
- }
- return;
- }
- for (int col = 0; col < pixel_count; col++) {
- if (!(src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8)))) {
- dest_scan += 4;
- continue;
- }
- int src_alpha;
- if (clip_scan) {
- src_alpha = mask_alpha * clip_scan[col] / 255;
- } else {
- src_alpha = mask_alpha;
- }
- uint8_t back_alpha = dest_scan[3];
- if (back_alpha == 0) {
- FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alpha, src_r, src_g, src_b));
- dest_scan += 4;
- continue;
- }
- uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255;
- dest_scan[3] = dest_alpha;
- int alpha_ratio = src_alpha * 255 / dest_alpha;
- if (blend_type >= FXDIB_BLEND_NONSEPARABLE) {
- int blended_colors[3];
- uint8_t scan[3] = {static_cast<uint8_t>(src_b),
- static_cast<uint8_t>(src_g),
- static_cast<uint8_t>(src_r)};
- RGB_Blend(blend_type, scan, dest_scan, blended_colors);
- *dest_scan =
- FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[0], alpha_ratio);
- dest_scan++;
- *dest_scan =
- FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[1], alpha_ratio);
- dest_scan++;
- *dest_scan =
- FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[2], alpha_ratio);
- } else if (blend_type) {
- int blended = Blend(blend_type, *dest_scan, src_b);
- blended = FXDIB_ALPHA_MERGE(src_b, blended, back_alpha);
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alpha_ratio);
- dest_scan++;
- blended = Blend(blend_type, *dest_scan, src_g);
- blended = FXDIB_ALPHA_MERGE(src_g, blended, back_alpha);
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alpha_ratio);
- dest_scan++;
- blended = Blend(blend_type, *dest_scan, src_r);
- blended = FXDIB_ALPHA_MERGE(src_r, blended, back_alpha);
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alpha_ratio);
- } else {
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio);
- dest_scan++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, alpha_ratio);
- dest_scan++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, alpha_ratio);
- }
- dest_scan += 2;
- }
-}
-
-void CompositeRow_BitMask2Rgb(uint8_t* dest_scan,
- const uint8_t* src_scan,
- int mask_alpha,
- int src_r,
- int src_g,
- int src_b,
- int src_left,
- int pixel_count,
- int blend_type,
- int Bpp,
- const uint8_t* clip_scan) {
- if (blend_type == FXDIB_BLEND_NORMAL && !clip_scan && mask_alpha == 255) {
- for (int col = 0; col < pixel_count; col++) {
- if (src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8))) {
- dest_scan[2] = src_r;
- dest_scan[1] = src_g;
- dest_scan[0] = src_b;
- }
- dest_scan += Bpp;
- }
- return;
- }
- for (int col = 0; col < pixel_count; col++) {
- if (!(src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8)))) {
- dest_scan += Bpp;
- continue;
- }
- int src_alpha;
- if (clip_scan) {
- src_alpha = mask_alpha * clip_scan[col] / 255;
- } else {
- src_alpha = mask_alpha;
- }
- if (src_alpha == 0) {
- dest_scan += Bpp;
- continue;
- }
- if (blend_type >= FXDIB_BLEND_NONSEPARABLE) {
- int blended_colors[3];
- uint8_t scan[3] = {static_cast<uint8_t>(src_b),
- static_cast<uint8_t>(src_g),
- static_cast<uint8_t>(src_r)};
- RGB_Blend(blend_type, scan, dest_scan, blended_colors);
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[0], src_alpha);
- dest_scan++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[1], src_alpha);
- dest_scan++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[2], src_alpha);
- } else if (blend_type) {
- int blended = Blend(blend_type, *dest_scan, src_b);
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, src_alpha);
- dest_scan++;
- blended = Blend(blend_type, *dest_scan, src_g);
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, src_alpha);
- dest_scan++;
- blended = Blend(blend_type, *dest_scan, src_r);
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, src_alpha);
- } else {
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, src_alpha);
- dest_scan++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, src_alpha);
- dest_scan++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, src_alpha);
- }
- dest_scan += Bpp - 2;
- }
-}
-
-void CompositeRow_BitMask2Mask(uint8_t* dest_scan,
- const uint8_t* src_scan,
- int mask_alpha,
- int src_left,
- int pixel_count,
- const uint8_t* clip_scan) {
- for (int col = 0; col < pixel_count; col++) {
- if (!(src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8)))) {
- dest_scan++;
- continue;
- }
- int src_alpha;
- if (clip_scan) {
- src_alpha = mask_alpha * clip_scan[col] / 255;
- } else {
- src_alpha = mask_alpha;
- }
- uint8_t back_alpha = *dest_scan;
- if (!back_alpha) {
- *dest_scan = src_alpha;
- } else if (src_alpha) {
- *dest_scan = back_alpha + src_alpha - back_alpha * src_alpha / 255;
- }
- dest_scan++;
- }
-}
-
-void CompositeRow_BitMask2Gray(uint8_t* dest_scan,
- const uint8_t* src_scan,
- int mask_alpha,
- int src_gray,
- int src_left,
- int pixel_count,
- const uint8_t* clip_scan) {
- for (int col = 0; col < pixel_count; col++) {
- if (!(src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8)))) {
- dest_scan++;
- continue;
- }
- int src_alpha;
- if (clip_scan) {
- src_alpha = mask_alpha * clip_scan[col] / 255;
- } else {
- src_alpha = mask_alpha;
- }
- if (src_alpha) {
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_gray, src_alpha);
- }
- dest_scan++;
- }
-}
-
-void CompositeRow_BitMask2Graya(uint8_t* dest_scan,
- const uint8_t* src_scan,
- int mask_alpha,
- int src_gray,
- int src_left,
- int pixel_count,
- const uint8_t* clip_scan,
- uint8_t* dest_alpha_scan) {
- for (int col = 0; col < pixel_count; col++) {
- if (!(src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8)))) {
- dest_scan++;
- dest_alpha_scan++;
- continue;
- }
- int src_alpha;
- if (clip_scan) {
- src_alpha = mask_alpha * clip_scan[col] / 255;
- } else {
- src_alpha = mask_alpha;
- }
- uint8_t back_alpha = *dest_alpha_scan;
- if (back_alpha == 0) {
- *dest_scan++ = src_gray;
- *dest_alpha_scan++ = src_alpha;
- continue;
- }
- if (src_alpha == 0) {
- dest_scan++;
- dest_alpha_scan++;
- continue;
- }
- uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255;
- *dest_alpha_scan++ = dest_alpha;
- int alpha_ratio = src_alpha * 255 / dest_alpha;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_gray, alpha_ratio);
- dest_scan++;
- }
-}
-
-void CompositeRow_Argb2Argb_RgbByteOrder(uint8_t* dest_scan,
- const uint8_t* src_scan,
- int pixel_count,
- int blend_type,
- const uint8_t* clip_scan) {
- int blended_colors[3];
- bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
- for (int col = 0; col < pixel_count; col++) {
- uint8_t back_alpha = dest_scan[3];
- if (back_alpha == 0) {
- if (clip_scan) {
- int src_alpha = clip_scan[col] * src_scan[3] / 255;
- dest_scan[3] = src_alpha;
- dest_scan[0] = src_scan[2];
- dest_scan[1] = src_scan[1];
- dest_scan[2] = src_scan[0];
- } else {
- FXARGB_RGBORDERCOPY(dest_scan, src_scan);
- }
- dest_scan += 4;
- src_scan += 4;
- continue;
- }
- uint8_t src_alpha;
- if (clip_scan) {
- src_alpha = clip_scan[col] * src_scan[3] / 255;
- } else {
- src_alpha = src_scan[3];
- }
- if (src_alpha == 0) {
- dest_scan += 4;
- src_scan += 4;
- continue;
- }
- uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255;
- dest_scan[3] = dest_alpha;
- int alpha_ratio = src_alpha * 255 / dest_alpha;
- if (bNonseparableBlend) {
- uint8_t dest_scan_o[3];
- dest_scan_o[0] = dest_scan[2];
- dest_scan_o[1] = dest_scan[1];
- dest_scan_o[2] = dest_scan[0];
- RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors);
- }
- for (int color = 0; color < 3; color++) {
- int index = 2 - color;
- if (blend_type) {
- int blended = bNonseparableBlend
- ? blended_colors[color]
- : Blend(blend_type, dest_scan[index], *src_scan);
- blended = FXDIB_ALPHA_MERGE(*src_scan, blended, back_alpha);
- dest_scan[index] =
- FXDIB_ALPHA_MERGE(dest_scan[index], blended, alpha_ratio);
- } else {
- dest_scan[index] =
- FXDIB_ALPHA_MERGE(dest_scan[index], *src_scan, alpha_ratio);
- }
- src_scan++;
- }
- dest_scan += 4;
- src_scan++;
- }
-}
-
-void CompositeRow_Rgb2Argb_Blend_NoClip_RgbByteOrder(uint8_t* dest_scan,
- const uint8_t* src_scan,
- int width,
- int blend_type,
- int src_Bpp) {
- int blended_colors[3];
- bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
- int src_gap = src_Bpp - 3;
- for (int col = 0; col < width; col++) {
- uint8_t back_alpha = dest_scan[3];
- if (back_alpha == 0) {
- if (src_Bpp == 4) {
- FXARGB_SETRGBORDERDIB(dest_scan, 0xff000000 | FXARGB_GETDIB(src_scan));
- } else {
- FXARGB_SETRGBORDERDIB(dest_scan, FXARGB_MAKE(0xff, src_scan[2],
- src_scan[1], src_scan[0]));
- }
- dest_scan += 4;
- src_scan += src_Bpp;
- continue;
- }
- dest_scan[3] = 0xff;
- if (bNonseparableBlend) {
- uint8_t dest_scan_o[3];
- dest_scan_o[0] = dest_scan[2];
- dest_scan_o[1] = dest_scan[1];
- dest_scan_o[2] = dest_scan[0];
- RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors);
- }
- for (int color = 0; color < 3; color++) {
- int index = 2 - color;
- int src_color = *src_scan;
- int blended = bNonseparableBlend
- ? blended_colors[color]
- : Blend(blend_type, dest_scan[index], src_color);
- dest_scan[index] = FXDIB_ALPHA_MERGE(src_color, blended, back_alpha);
- src_scan++;
- }
- dest_scan += 4;
- src_scan += src_gap;
- }
-}
-
-void CompositeRow_Argb2Rgb_Blend_RgbByteOrder(uint8_t* dest_scan,
- const uint8_t* src_scan,
- int width,
- int blend_type,
- int dest_Bpp,
- const uint8_t* clip_scan) {
- int blended_colors[3];
- bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
- for (int col = 0; col < width; col++) {
- uint8_t src_alpha;
- if (clip_scan) {
- src_alpha = src_scan[3] * (*clip_scan++) / 255;
- } else {
- src_alpha = src_scan[3];
- }
- if (src_alpha == 0) {
- dest_scan += dest_Bpp;
- src_scan += 4;
- continue;
- }
- if (bNonseparableBlend) {
- uint8_t dest_scan_o[3];
- dest_scan_o[0] = dest_scan[2];
- dest_scan_o[1] = dest_scan[1];
- dest_scan_o[2] = dest_scan[0];
- RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors);
- }
- for (int color = 0; color < 3; color++) {
- int index = 2 - color;
- int back_color = dest_scan[index];
- int blended = bNonseparableBlend
- ? blended_colors[color]
- : Blend(blend_type, back_color, *src_scan);
- dest_scan[index] = FXDIB_ALPHA_MERGE(back_color, blended, src_alpha);
- src_scan++;
- }
- dest_scan += dest_Bpp;
- src_scan++;
- }
-}
-
-void CompositeRow_Rgb2Argb_NoBlend_NoClip_RgbByteOrder(uint8_t* dest_scan,
- const uint8_t* src_scan,
- int width,
- int src_Bpp) {
- for (int col = 0; col < width; col++) {
- if (src_Bpp == 4) {
- FXARGB_SETRGBORDERDIB(dest_scan, 0xff000000 | FXARGB_GETDIB(src_scan));
- } else {
- FXARGB_SETRGBORDERDIB(
- dest_scan, FXARGB_MAKE(0xff, src_scan[2], src_scan[1], src_scan[0]));
- }
- dest_scan += 4;
- src_scan += src_Bpp;
- }
-}
-
-void CompositeRow_Rgb2Rgb_Blend_NoClip_RgbByteOrder(uint8_t* dest_scan,
- const uint8_t* src_scan,
- int width,
- int blend_type,
- int dest_Bpp,
- int src_Bpp) {
- int blended_colors[3];
- bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
- int src_gap = src_Bpp - 3;
- for (int col = 0; col < width; col++) {
- if (bNonseparableBlend) {
- uint8_t dest_scan_o[3];
- dest_scan_o[0] = dest_scan[2];
- dest_scan_o[1] = dest_scan[1];
- dest_scan_o[2] = dest_scan[0];
- RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors);
- }
- for (int color = 0; color < 3; color++) {
- int index = 2 - color;
- int back_color = dest_scan[index];
- int src_color = *src_scan;
- int blended = bNonseparableBlend
- ? blended_colors[color]
- : Blend(blend_type, back_color, src_color);
- dest_scan[index] = blended;
- src_scan++;
- }
- dest_scan += dest_Bpp;
- src_scan += src_gap;
- }
-}
-
-void CompositeRow_Argb2Rgb_NoBlend_RgbByteOrder(uint8_t* dest_scan,
- const uint8_t* src_scan,
- int width,
- int dest_Bpp,
- const uint8_t* clip_scan) {
- for (int col = 0; col < width; col++) {
- uint8_t src_alpha;
- if (clip_scan) {
- src_alpha = src_scan[3] * (*clip_scan++) / 255;
- } else {
- src_alpha = src_scan[3];
- }
- if (src_alpha == 255) {
- dest_scan[2] = *src_scan++;
- dest_scan[1] = *src_scan++;
- dest_scan[0] = *src_scan++;
- dest_scan += dest_Bpp;
- src_scan++;
- continue;
- }
- if (src_alpha == 0) {
- dest_scan += dest_Bpp;
- src_scan += 4;
- continue;
- }
- for (int color = 0; color < 3; color++) {
- int index = 2 - color;
- dest_scan[index] =
- FXDIB_ALPHA_MERGE(dest_scan[index], *src_scan, src_alpha);
- src_scan++;
- }
- dest_scan += dest_Bpp;
- src_scan++;
- }
-}
-
-void CompositeRow_Rgb2Rgb_NoBlend_NoClip_RgbByteOrder(uint8_t* dest_scan,
- const uint8_t* src_scan,
- int width,
- int dest_Bpp,
- int src_Bpp) {
- for (int col = 0; col < width; col++) {
- dest_scan[2] = src_scan[0];
- dest_scan[1] = src_scan[1];
- dest_scan[0] = src_scan[2];
- dest_scan += dest_Bpp;
- src_scan += src_Bpp;
- }
-}
-
-void CompositeRow_Rgb2Argb_Blend_Clip_RgbByteOrder(uint8_t* dest_scan,
- const uint8_t* src_scan,
- int width,
- int blend_type,
- int src_Bpp,
- const uint8_t* clip_scan) {
- int blended_colors[3];
- bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
- int src_gap = src_Bpp - 3;
- for (int col = 0; col < width; col++) {
- int src_alpha = *clip_scan++;
- uint8_t back_alpha = dest_scan[3];
- if (back_alpha == 0) {
- dest_scan[2] = *src_scan++;
- dest_scan[1] = *src_scan++;
- dest_scan[0] = *src_scan++;
- src_scan += src_gap;
- dest_scan += 4;
- continue;
- }
- if (src_alpha == 0) {
- dest_scan += 4;
- src_scan += src_Bpp;
- continue;
- }
- uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255;
- dest_scan[3] = dest_alpha;
- int alpha_ratio = src_alpha * 255 / dest_alpha;
- if (bNonseparableBlend) {
- uint8_t dest_scan_o[3];
- dest_scan_o[0] = dest_scan[2];
- dest_scan_o[1] = dest_scan[1];
- dest_scan_o[2] = dest_scan[0];
- RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors);
- }
- for (int color = 0; color < 3; color++) {
- int index = 2 - color;
- int src_color = *src_scan;
- int blended = bNonseparableBlend
- ? blended_colors[color]
- : Blend(blend_type, dest_scan[index], src_color);
- blended = FXDIB_ALPHA_MERGE(src_color, blended, back_alpha);
- dest_scan[index] =
- FXDIB_ALPHA_MERGE(dest_scan[index], blended, alpha_ratio);
- src_scan++;
- }
- dest_scan += 4;
- src_scan += src_gap;
- }
-}
-
-void CompositeRow_Rgb2Rgb_Blend_Clip_RgbByteOrder(uint8_t* dest_scan,
- const uint8_t* src_scan,
- int width,
- int blend_type,
- int dest_Bpp,
- int src_Bpp,
- const uint8_t* clip_scan) {
- int blended_colors[3];
- bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
- int src_gap = src_Bpp - 3;
- for (int col = 0; col < width; col++) {
- uint8_t src_alpha = *clip_scan++;
- if (src_alpha == 0) {
- dest_scan += dest_Bpp;
- src_scan += src_Bpp;
- continue;
- }
- if (bNonseparableBlend) {
- uint8_t dest_scan_o[3];
- dest_scan_o[0] = dest_scan[2];
- dest_scan_o[1] = dest_scan[1];
- dest_scan_o[2] = dest_scan[0];
- RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors);
- }
- for (int color = 0; color < 3; color++) {
- int index = 2 - color;
- int src_color = *src_scan;
- int back_color = dest_scan[index];
- int blended = bNonseparableBlend
- ? blended_colors[color]
- : Blend(blend_type, back_color, src_color);
- dest_scan[index] = FXDIB_ALPHA_MERGE(back_color, blended, src_alpha);
- src_scan++;
- }
- dest_scan += dest_Bpp;
- src_scan += src_gap;
- }
-}
-
-void CompositeRow_Rgb2Argb_NoBlend_Clip_RgbByteOrder(uint8_t* dest_scan,
- const uint8_t* src_scan,
- int width,
- int src_Bpp,
- const uint8_t* clip_scan) {
- int src_gap = src_Bpp - 3;
- for (int col = 0; col < width; col++) {
- int src_alpha = clip_scan[col];
- if (src_alpha == 255) {
- dest_scan[2] = *src_scan++;
- dest_scan[1] = *src_scan++;
- dest_scan[0] = *src_scan++;
- dest_scan[3] = 255;
- dest_scan += 4;
- src_scan += src_gap;
- continue;
- }
- if (src_alpha == 0) {
- dest_scan += 4;
- src_scan += src_Bpp;
- continue;
- }
- int back_alpha = dest_scan[3];
- uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255;
- dest_scan[3] = dest_alpha;
- int alpha_ratio = src_alpha * 255 / dest_alpha;
- for (int color = 0; color < 3; color++) {
- int index = 2 - color;
- dest_scan[index] =
- FXDIB_ALPHA_MERGE(dest_scan[index], *src_scan, alpha_ratio);
- src_scan++;
- }
- dest_scan += 4;
- src_scan += src_gap;
- }
-}
-
-void CompositeRow_Rgb2Rgb_NoBlend_Clip_RgbByteOrder(uint8_t* dest_scan,
- const uint8_t* src_scan,
- int width,
- int dest_Bpp,
- int src_Bpp,
- const uint8_t* clip_scan) {
- for (int col = 0; col < width; col++) {
- int src_alpha = clip_scan[col];
- if (src_alpha == 255) {
- dest_scan[2] = src_scan[0];
- dest_scan[1] = src_scan[1];
- dest_scan[0] = src_scan[2];
- } else if (src_alpha) {
- dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], *src_scan, src_alpha);
- src_scan++;
- dest_scan[1] = FXDIB_ALPHA_MERGE(dest_scan[1], *src_scan, src_alpha);
- src_scan++;
- dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], *src_scan, src_alpha);
- dest_scan += dest_Bpp;
- src_scan += src_Bpp - 2;
- continue;
- }
- dest_scan += dest_Bpp;
- src_scan += src_Bpp;
- }
-}
-
-void CompositeRow_8bppRgb2Rgb_NoBlend_RgbByteOrder(uint8_t* dest_scan,
- const uint8_t* src_scan,
- FX_ARGB* pPalette,
- int pixel_count,
- int DestBpp,
- const uint8_t* clip_scan) {
- for (int col = 0; col < pixel_count; col++) {
- FX_ARGB argb = pPalette ? pPalette[*src_scan] : (*src_scan) * 0x010101;
- int src_r = FXARGB_R(argb);
- int src_g = FXARGB_G(argb);
- int src_b = FXARGB_B(argb);
- if (clip_scan && clip_scan[col] < 255) {
- dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], src_b, clip_scan[col]);
- dest_scan[1] = FXDIB_ALPHA_MERGE(dest_scan[1], src_g, clip_scan[col]);
- dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], src_r, clip_scan[col]);
- } else {
- dest_scan[2] = src_b;
- dest_scan[1] = src_g;
- dest_scan[0] = src_r;
- }
- dest_scan += DestBpp;
- src_scan++;
- }
-}
-
-void CompositeRow_1bppRgb2Rgb_NoBlend_RgbByteOrder(uint8_t* dest_scan,
- const uint8_t* src_scan,
- int src_left,
- FX_ARGB* pPalette,
- int pixel_count,
- int DestBpp,
- const uint8_t* clip_scan) {
- int reset_r, reset_g, reset_b;
- int set_r, set_g, set_b;
- if (pPalette) {
- reset_r = FXARGB_R(pPalette[0]);
- reset_g = FXARGB_G(pPalette[0]);
- reset_b = FXARGB_B(pPalette[0]);
- set_r = FXARGB_R(pPalette[1]);
- set_g = FXARGB_G(pPalette[1]);
- set_b = FXARGB_B(pPalette[1]);
- } else {
- reset_r = reset_g = reset_b = 0;
- set_r = set_g = set_b = 255;
- }
- for (int col = 0; col < pixel_count; col++) {
- int src_r, src_g, src_b;
- if (src_scan[(col + src_left) / 8] & (1 << (7 - (col + src_left) % 8))) {
- src_r = set_r;
- src_g = set_g;
- src_b = set_b;
- } else {
- src_r = reset_r;
- src_g = reset_g;
- src_b = reset_b;
- }
- if (clip_scan && clip_scan[col] < 255) {
- dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], src_b, clip_scan[col]);
- dest_scan[1] = FXDIB_ALPHA_MERGE(dest_scan[1], src_g, clip_scan[col]);
- dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], src_r, clip_scan[col]);
- } else {
- dest_scan[2] = src_b;
- dest_scan[1] = src_g;
- dest_scan[0] = src_r;
- }
- dest_scan += DestBpp;
- }
-}
-
-void CompositeRow_8bppRgb2Argb_NoBlend_RgbByteOrder(uint8_t* dest_scan,
- const uint8_t* src_scan,
- int width,
- FX_ARGB* pPalette,
- const uint8_t* clip_scan) {
- for (int col = 0; col < width; col++) {
- int src_r, src_g, src_b;
- if (pPalette) {
- FX_ARGB argb = pPalette[*src_scan];
- src_r = FXARGB_R(argb);
- src_g = FXARGB_G(argb);
- src_b = FXARGB_B(argb);
- } else {
- src_r = src_g = src_b = *src_scan;
- }
- if (!clip_scan || clip_scan[col] == 255) {
- dest_scan[2] = src_b;
- dest_scan[1] = src_g;
- dest_scan[0] = src_r;
- dest_scan[3] = 255;
- src_scan++;
- dest_scan += 4;
- continue;
- }
- int src_alpha = clip_scan[col];
- if (src_alpha == 0) {
- dest_scan += 4;
- src_scan++;
- continue;
- }
- int back_alpha = dest_scan[3];
- uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255;
- dest_scan[3] = dest_alpha;
- int alpha_ratio = src_alpha * 255 / dest_alpha;
- dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], src_b, alpha_ratio);
- dest_scan[1] = FXDIB_ALPHA_MERGE(dest_scan[1], src_g, alpha_ratio);
- dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], src_r, alpha_ratio);
- dest_scan += 4;
- src_scan++;
- }
-}
-
-void CompositeRow_1bppRgb2Argb_NoBlend_RgbByteOrder(uint8_t* dest_scan,
- const uint8_t* src_scan,
- int src_left,
- int width,
- FX_ARGB* pPalette,
- const uint8_t* clip_scan) {
- int reset_r, reset_g, reset_b;
- int set_r, set_g, set_b;
- if (pPalette) {
- reset_r = FXARGB_R(pPalette[0]);
- reset_g = FXARGB_G(pPalette[0]);
- reset_b = FXARGB_B(pPalette[0]);
- set_r = FXARGB_R(pPalette[1]);
- set_g = FXARGB_G(pPalette[1]);
- set_b = FXARGB_B(pPalette[1]);
- } else {
- reset_r = reset_g = reset_b = 0;
- set_r = set_g = set_b = 255;
- }
- for (int col = 0; col < width; col++) {
- int src_r, src_g, src_b;
- if (src_scan[(col + src_left) / 8] & (1 << (7 - (col + src_left) % 8))) {
- src_r = set_r;
- src_g = set_g;
- src_b = set_b;
- } else {
- src_r = reset_r;
- src_g = reset_g;
- src_b = reset_b;
- }
- if (!clip_scan || clip_scan[col] == 255) {
- dest_scan[2] = src_b;
- dest_scan[1] = src_g;
- dest_scan[0] = src_r;
- dest_scan[3] = 255;
- dest_scan += 4;
- continue;
- }
- int src_alpha = clip_scan[col];
- if (src_alpha == 0) {
- dest_scan += 4;
- continue;
- }
- int back_alpha = dest_scan[3];
- uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255;
- dest_scan[3] = dest_alpha;
- int alpha_ratio = src_alpha * 255 / dest_alpha;
- dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], src_b, alpha_ratio);
- dest_scan[1] = FXDIB_ALPHA_MERGE(dest_scan[1], src_g, alpha_ratio);
- dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], src_r, alpha_ratio);
- dest_scan += 4;
- }
-}
-
-void CompositeRow_ByteMask2Argb_RgbByteOrder(uint8_t* dest_scan,
- const uint8_t* src_scan,
- int mask_alpha,
- int src_r,
- int src_g,
- int src_b,
- int pixel_count,
- int blend_type,
- const uint8_t* clip_scan) {
- for (int col = 0; col < pixel_count; col++) {
- int src_alpha;
- if (clip_scan) {
- src_alpha = mask_alpha * clip_scan[col] * src_scan[col] / 255 / 255;
- } else {
- src_alpha = mask_alpha * src_scan[col] / 255;
- }
- uint8_t back_alpha = dest_scan[3];
- if (back_alpha == 0) {
- FXARGB_SETRGBORDERDIB(dest_scan,
- FXARGB_MAKE(src_alpha, src_r, src_g, src_b));
- dest_scan += 4;
- continue;
- }
- if (src_alpha == 0) {
- dest_scan += 4;
- continue;
- }
- uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255;
- dest_scan[3] = dest_alpha;
- int alpha_ratio = src_alpha * 255 / dest_alpha;
- if (blend_type >= FXDIB_BLEND_NONSEPARABLE) {
- int blended_colors[3];
- uint8_t scan[3] = {static_cast<uint8_t>(src_b),
- static_cast<uint8_t>(src_g),
- static_cast<uint8_t>(src_r)};
- uint8_t dest_scan_o[3] = {dest_scan[2], dest_scan[1], dest_scan[0]};
- RGB_Blend(blend_type, scan, dest_scan_o, blended_colors);
- dest_scan[2] =
- FXDIB_ALPHA_MERGE(dest_scan[2], blended_colors[0], alpha_ratio);
- dest_scan[1] =
- FXDIB_ALPHA_MERGE(dest_scan[1], blended_colors[1], alpha_ratio);
- dest_scan[0] =
- FXDIB_ALPHA_MERGE(dest_scan[0], blended_colors[2], alpha_ratio);
- } else if (blend_type) {
- int blended = Blend(blend_type, dest_scan[2], src_b);
- blended = FXDIB_ALPHA_MERGE(src_b, blended, back_alpha);
- dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], blended, alpha_ratio);
- blended = Blend(blend_type, dest_scan[1], src_g);
- blended = FXDIB_ALPHA_MERGE(src_g, blended, back_alpha);
- dest_scan[1] = FXDIB_ALPHA_MERGE(dest_scan[1], blended, alpha_ratio);
- blended = Blend(blend_type, dest_scan[0], src_r);
- blended = FXDIB_ALPHA_MERGE(src_r, blended, back_alpha);
- dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], blended, alpha_ratio);
- } else {
- dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], src_b, alpha_ratio);
- dest_scan[1] = FXDIB_ALPHA_MERGE(dest_scan[1], src_g, alpha_ratio);
- dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], src_r, alpha_ratio);
- }
- dest_scan += 4;
- }
-}
-
-void CompositeRow_ByteMask2Rgb_RgbByteOrder(uint8_t* dest_scan,
- const uint8_t* src_scan,
- int mask_alpha,
- int src_r,
- int src_g,
- int src_b,
- int pixel_count,
- int blend_type,
- int Bpp,
- const uint8_t* clip_scan) {
- for (int col = 0; col < pixel_count; col++) {
- int src_alpha;
- if (clip_scan) {
- src_alpha = mask_alpha * clip_scan[col] * src_scan[col] / 255 / 255;
- } else {
- src_alpha = mask_alpha * src_scan[col] / 255;
- }
- if (src_alpha == 0) {
- dest_scan += Bpp;
- continue;
- }
- if (blend_type >= FXDIB_BLEND_NONSEPARABLE) {
- int blended_colors[3];
- uint8_t scan[3] = {static_cast<uint8_t>(src_b),
- static_cast<uint8_t>(src_g),
- static_cast<uint8_t>(src_r)};
- uint8_t dest_scan_o[3] = {dest_scan[2], dest_scan[1], dest_scan[0]};
- RGB_Blend(blend_type, scan, dest_scan_o, blended_colors);
- dest_scan[2] =
- FXDIB_ALPHA_MERGE(dest_scan[2], blended_colors[0], src_alpha);
- dest_scan[1] =
- FXDIB_ALPHA_MERGE(dest_scan[1], blended_colors[1], src_alpha);
- dest_scan[0] =
- FXDIB_ALPHA_MERGE(dest_scan[0], blended_colors[2], src_alpha);
- } else if (blend_type) {
- int blended = Blend(blend_type, dest_scan[2], src_b);
- dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], blended, src_alpha);
- blended = Blend(blend_type, dest_scan[1], src_g);
- dest_scan[1] = FXDIB_ALPHA_MERGE(dest_scan[1], blended, src_alpha);
- blended = Blend(blend_type, dest_scan[0], src_r);
- dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], blended, src_alpha);
- } else {
- dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], src_b, src_alpha);
- dest_scan[1] = FXDIB_ALPHA_MERGE(dest_scan[1], src_g, src_alpha);
- dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], src_r, src_alpha);
- }
- dest_scan += Bpp;
- }
-}
-
-void CompositeRow_BitMask2Argb_RgbByteOrder(uint8_t* dest_scan,
- const uint8_t* src_scan,
- int mask_alpha,
- int src_r,
- int src_g,
- int src_b,
- int src_left,
- int pixel_count,
- int blend_type,
- const uint8_t* clip_scan) {
- if (blend_type == FXDIB_BLEND_NORMAL && !clip_scan && mask_alpha == 255) {
- FX_ARGB argb = FXARGB_MAKE(0xff, src_r, src_g, src_b);
- for (int col = 0; col < pixel_count; col++) {
- if (src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8))) {
- FXARGB_SETRGBORDERDIB(dest_scan, argb);
- }
- dest_scan += 4;
- }
- return;
- }
- for (int col = 0; col < pixel_count; col++) {
- if (!(src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8)))) {
- dest_scan += 4;
- continue;
- }
- int src_alpha;
- if (clip_scan) {
- src_alpha = mask_alpha * clip_scan[col] / 255;
- } else {
- src_alpha = mask_alpha;
- }
- uint8_t back_alpha = dest_scan[3];
- if (back_alpha == 0) {
- FXARGB_SETRGBORDERDIB(dest_scan,
- FXARGB_MAKE(src_alpha, src_r, src_g, src_b));
- dest_scan += 4;
- continue;
- }
- uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255;
- dest_scan[3] = dest_alpha;
- int alpha_ratio = src_alpha * 255 / dest_alpha;
- if (blend_type >= FXDIB_BLEND_NONSEPARABLE) {
- int blended_colors[3];
- uint8_t scan[3] = {static_cast<uint8_t>(src_b),
- static_cast<uint8_t>(src_g),
- static_cast<uint8_t>(src_r)};
- uint8_t dest_scan_o[3] = {dest_scan[2], dest_scan[1], dest_scan[0]};
- RGB_Blend(blend_type, scan, dest_scan_o, blended_colors);
- dest_scan[2] =
- FXDIB_ALPHA_MERGE(dest_scan[2], blended_colors[0], alpha_ratio);
- dest_scan[1] =
- FXDIB_ALPHA_MERGE(dest_scan[1], blended_colors[1], alpha_ratio);
- dest_scan[0] =
- FXDIB_ALPHA_MERGE(dest_scan[0], blended_colors[2], alpha_ratio);
- } else if (blend_type) {
- int blended = Blend(blend_type, dest_scan[2], src_b);
- blended = FXDIB_ALPHA_MERGE(src_b, blended, back_alpha);
- dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], blended, alpha_ratio);
- blended = Blend(blend_type, dest_scan[1], src_g);
- blended = FXDIB_ALPHA_MERGE(src_g, blended, back_alpha);
- dest_scan[1] = FXDIB_ALPHA_MERGE(dest_scan[1], blended, alpha_ratio);
- blended = Blend(blend_type, dest_scan[0], src_r);
- blended = FXDIB_ALPHA_MERGE(src_r, blended, back_alpha);
- dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], blended, alpha_ratio);
- } else {
- dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], src_b, alpha_ratio);
- dest_scan[1] = FXDIB_ALPHA_MERGE(dest_scan[1], src_g, alpha_ratio);
- dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], src_r, alpha_ratio);
- }
- dest_scan += 4;
- }
-}
-
-void CompositeRow_BitMask2Rgb_RgbByteOrder(uint8_t* dest_scan,
- const uint8_t* src_scan,
- int mask_alpha,
- int src_r,
- int src_g,
- int src_b,
- int src_left,
- int pixel_count,
- int blend_type,
- int Bpp,
- const uint8_t* clip_scan) {
- if (blend_type == FXDIB_BLEND_NORMAL && !clip_scan && mask_alpha == 255) {
- for (int col = 0; col < pixel_count; col++) {
- if (src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8))) {
- dest_scan[2] = src_b;
- dest_scan[1] = src_g;
- dest_scan[0] = src_r;
- }
- dest_scan += Bpp;
- }
- return;
- }
- for (int col = 0; col < pixel_count; col++) {
- if (!(src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8)))) {
- dest_scan += Bpp;
- continue;
- }
- int src_alpha;
- if (clip_scan) {
- src_alpha = mask_alpha * clip_scan[col] / 255;
- } else {
- src_alpha = mask_alpha;
- }
- if (src_alpha == 0) {
- dest_scan += Bpp;
- continue;
- }
- if (blend_type >= FXDIB_BLEND_NONSEPARABLE) {
- int blended_colors[3];
- uint8_t scan[3] = {static_cast<uint8_t>(src_b),
- static_cast<uint8_t>(src_g),
- static_cast<uint8_t>(src_r)};
- uint8_t dest_scan_o[3] = {dest_scan[2], dest_scan[1], dest_scan[0]};
- RGB_Blend(blend_type, scan, dest_scan_o, blended_colors);
- dest_scan[2] =
- FXDIB_ALPHA_MERGE(dest_scan[2], blended_colors[0], src_alpha);
- dest_scan[1] =
- FXDIB_ALPHA_MERGE(dest_scan[1], blended_colors[1], src_alpha);
- dest_scan[0] =
- FXDIB_ALPHA_MERGE(dest_scan[0], blended_colors[2], src_alpha);
- } else if (blend_type) {
- int back_color = dest_scan[2];
- int blended = Blend(blend_type, back_color, src_b);
- dest_scan[2] = FXDIB_ALPHA_MERGE(back_color, blended, src_alpha);
- back_color = dest_scan[1];
- blended = Blend(blend_type, back_color, src_g);
- dest_scan[1] = FXDIB_ALPHA_MERGE(back_color, blended, src_alpha);
- back_color = dest_scan[0];
- blended = Blend(blend_type, back_color, src_r);
- dest_scan[0] = FXDIB_ALPHA_MERGE(back_color, blended, src_alpha);
- } else {
- dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], src_b, src_alpha);
- dest_scan[1] = FXDIB_ALPHA_MERGE(dest_scan[1], src_g, src_alpha);
- dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], src_r, src_alpha);
- }
- dest_scan += Bpp;
- }
-}
-
-bool ScanlineCompositor_InitSourceMask(FXDIB_Format dest_format,
- int alpha_flag,
- uint32_t mask_color,
- int& mask_alpha,
- int& mask_red,
- int& mask_green,
- int& mask_blue,
- int& mask_black,
- CCodec_IccModule* pIccModule,
- void* pIccTransform) {
- if (alpha_flag >> 8) {
- mask_alpha = alpha_flag & 0xff;
- mask_red = FXSYS_GetCValue(mask_color);
- mask_green = FXSYS_GetMValue(mask_color);
- mask_blue = FXSYS_GetYValue(mask_color);
- mask_black = FXSYS_GetKValue(mask_color);
- } else {
- mask_alpha = FXARGB_A(mask_color);
- mask_red = FXARGB_R(mask_color);
- mask_green = FXARGB_G(mask_color);
- mask_blue = FXARGB_B(mask_color);
- }
- if (dest_format == FXDIB_8bppMask) {
- return true;
- }
- if ((dest_format & 0xff) == 8) {
- if (pIccTransform) {
- mask_color = (alpha_flag >> 8) ? FXCMYK_TODIB(mask_color)
- : FXARGB_TODIB(mask_color);
- uint8_t* gray_p = (uint8_t*)&mask_color;
- pIccModule->TranslateScanline(pIccTransform, gray_p, gray_p, 1);
- mask_red = dest_format & 0x0400 ? FX_CCOLOR(gray_p[0]) : gray_p[0];
- } else {
- if (alpha_flag >> 8) {
- uint8_t r, g, b;
- AdobeCMYK_to_sRGB1(mask_red, mask_green, mask_blue, mask_black, r, g,
- b);
- mask_red = FXRGB2GRAY(r, g, b);
- } else {
- mask_red = FXRGB2GRAY(mask_red, mask_green, mask_blue);
- }
- if (dest_format & 0x0400) {
- mask_red = FX_CCOLOR(mask_red);
- }
- }
- } else {
- uint8_t* mask_color_p = (uint8_t*)&mask_color;
- mask_color =
- (alpha_flag >> 8) ? FXCMYK_TODIB(mask_color) : FXARGB_TODIB(mask_color);
- if (pIccTransform) {
- pIccModule->TranslateScanline(pIccTransform, mask_color_p, mask_color_p,
- 1);
- mask_red = mask_color_p[2];
- mask_green = mask_color_p[1];
- mask_blue = mask_color_p[0];
- } else if (alpha_flag >> 8) {
- AdobeCMYK_to_sRGB1(mask_color_p[0], mask_color_p[1], mask_color_p[2],
- mask_color_p[3], mask_color_p[2], mask_color_p[1],
- mask_color_p[0]);
- mask_red = mask_color_p[2];
- mask_green = mask_color_p[1];
- mask_blue = mask_color_p[0];
- }
- }
- return true;
-}
-
-void ScanlineCompositor_InitSourcePalette(FXDIB_Format src_format,
- FXDIB_Format dest_format,
- uint32_t*& pDestPalette,
- uint32_t* pSrcPalette,
- CCodec_IccModule* pIccModule,
- void* pIccTransform) {
- bool isSrcCmyk = !!(src_format & 0x0400);
- bool isDstCmyk = !!(dest_format & 0x0400);
- pDestPalette = nullptr;
- if (pIccTransform) {
- if (pSrcPalette) {
- if ((dest_format & 0xff) == 8) {
- int pal_count = 1 << (src_format & 0xff);
- uint8_t* gray_pal = FX_Alloc(uint8_t, pal_count);
- pDestPalette = (uint32_t*)gray_pal;
- for (int i = 0; i < pal_count; i++) {
- uint32_t color = isSrcCmyk ? FXCMYK_TODIB(pSrcPalette[i])
- : FXARGB_TODIB(pSrcPalette[i]);
- pIccModule->TranslateScanline(pIccTransform, gray_pal,
- (const uint8_t*)&color, 1);
- gray_pal++;
- }
- } else {
- int palsize = 1 << (src_format & 0xff);
- pDestPalette = FX_Alloc(uint32_t, palsize);
- for (int i = 0; i < palsize; i++) {
- uint32_t color = isSrcCmyk ? FXCMYK_TODIB(pSrcPalette[i])
- : FXARGB_TODIB(pSrcPalette[i]);
- pIccModule->TranslateScanline(pIccTransform, (uint8_t*)&color,
- (const uint8_t*)&color, 1);
- pDestPalette[i] =
- isDstCmyk ? FXCMYK_TODIB(color) : FXARGB_TODIB(color);
- }
- }
- } else {
- int pal_count = 1 << (src_format & 0xff);
- uint8_t* gray_pal = FX_Alloc(uint8_t, pal_count);
- if (pal_count == 2) {
- gray_pal[0] = 0;
- gray_pal[1] = 255;
- } else {
- for (int i = 0; i < pal_count; i++) {
- gray_pal[i] = i;
- }
- }
- if ((dest_format & 0xff) == 8) {
- pIccModule->TranslateScanline(pIccTransform, gray_pal, gray_pal,
- pal_count);
- pDestPalette = (uint32_t*)gray_pal;
- } else {
- pDestPalette = FX_Alloc(uint32_t, pal_count);
- for (int i = 0; i < pal_count; i++) {
- pIccModule->TranslateScanline(
- pIccTransform, (uint8_t*)&pDestPalette[i], &gray_pal[i], 1);
- pDestPalette[i] = isDstCmyk ? FXCMYK_TODIB(pDestPalette[i])
- : FXARGB_TODIB(pDestPalette[i]);
- }
- FX_Free(gray_pal);
- }
- }
- } else {
- if (pSrcPalette) {
- if ((dest_format & 0xff) == 8) {
- int pal_count = 1 << (src_format & 0xff);
- uint8_t* gray_pal = FX_Alloc(uint8_t, pal_count);
- pDestPalette = (uint32_t*)gray_pal;
- if (isSrcCmyk) {
- for (int i = 0; i < pal_count; i++) {
- FX_CMYK cmyk = pSrcPalette[i];
- uint8_t r, g, b;
- AdobeCMYK_to_sRGB1(FXSYS_GetCValue(cmyk), FXSYS_GetMValue(cmyk),
- FXSYS_GetYValue(cmyk), FXSYS_GetKValue(cmyk), r,
- g, b);
- *gray_pal++ = FXRGB2GRAY(r, g, b);
- }
- } else {
- for (int i = 0; i < pal_count; i++) {
- FX_ARGB argb = pSrcPalette[i];
- *gray_pal++ =
- FXRGB2GRAY(FXARGB_R(argb), FXARGB_G(argb), FXARGB_B(argb));
- }
- }
- } else {
- int palsize = 1 << (src_format & 0xff);
- pDestPalette = FX_Alloc(uint32_t, palsize);
- if (isDstCmyk == isSrcCmyk) {
- FXSYS_memcpy(pDestPalette, pSrcPalette, palsize * sizeof(uint32_t));
- } else {
- for (int i = 0; i < palsize; i++) {
- FX_CMYK cmyk = pSrcPalette[i];
- uint8_t r, g, b;
- AdobeCMYK_to_sRGB1(FXSYS_GetCValue(cmyk), FXSYS_GetMValue(cmyk),
- FXSYS_GetYValue(cmyk), FXSYS_GetKValue(cmyk), r,
- g, b);
- pDestPalette[i] = FXARGB_MAKE(0xff, r, g, b);
- }
- }
- }
- } else {
- if ((dest_format & 0xff) == 8) {
- int pal_count = 1 << (src_format & 0xff);
- uint8_t* gray_pal = FX_Alloc(uint8_t, pal_count);
- if (pal_count == 2) {
- gray_pal[0] = 0;
- gray_pal[1] = 255;
- } else {
- for (int i = 0; i < pal_count; i++) {
- gray_pal[i] = i;
- }
- }
- pDestPalette = (uint32_t*)gray_pal;
- } else {
- int palsize = 1 << (src_format & 0xff);
- pDestPalette = FX_Alloc(uint32_t, palsize);
- if (palsize == 2) {
- pDestPalette[0] = isSrcCmyk ? 255 : 0xff000000;
- pDestPalette[1] = isSrcCmyk ? 0 : 0xffffffff;
- } else {
- for (int i = 0; i < palsize; i++) {
- pDestPalette[i] = isSrcCmyk ? FX_CCOLOR(i) : (i * 0x10101);
- }
- }
- if (isSrcCmyk != isDstCmyk) {
- for (int i = 0; i < palsize; i++) {
- FX_CMYK cmyk = pDestPalette[i];
- uint8_t r, g, b;
- AdobeCMYK_to_sRGB1(FXSYS_GetCValue(cmyk), FXSYS_GetMValue(cmyk),
- FXSYS_GetYValue(cmyk), FXSYS_GetKValue(cmyk), r,
- g, b);
- pDestPalette[i] = FXARGB_MAKE(0xff, r, g, b);
- }
- }
- }
- }
- }
-}
-
-} // namespace
-
-CFX_ScanlineCompositor::CFX_ScanlineCompositor() {
- m_pSrcPalette = nullptr;
- m_pCacheScanline = nullptr;
- m_CacheSize = 0;
- m_bRgbByteOrder = false;
- m_BlendType = FXDIB_BLEND_NORMAL;
- m_pIccTransform = nullptr;
-}
-
-CFX_ScanlineCompositor::~CFX_ScanlineCompositor() {
- FX_Free(m_pSrcPalette);
- FX_Free(m_pCacheScanline);
-}
-
-bool CFX_ScanlineCompositor::Init(FXDIB_Format dest_format,
- FXDIB_Format src_format,
- int32_t width,
- uint32_t* pSrcPalette,
- uint32_t mask_color,
- int blend_type,
- bool bClip,
- bool bRgbByteOrder,
- int alpha_flag,
- void* pIccTransform) {
- m_SrcFormat = src_format;
- m_DestFormat = dest_format;
- m_BlendType = blend_type;
- m_bRgbByteOrder = bRgbByteOrder;
- CCodec_IccModule* pIccModule = nullptr;
- if (CFX_GEModule::Get()->GetCodecModule()) {
- pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule();
- }
- if (!pIccModule) {
- pIccTransform = nullptr;
- }
- m_pIccTransform = pIccTransform;
- if ((dest_format & 0xff) == 1) {
- return false;
- }
- if (m_SrcFormat == FXDIB_1bppMask || m_SrcFormat == FXDIB_8bppMask) {
- return ScanlineCompositor_InitSourceMask(
- dest_format, alpha_flag, mask_color, m_MaskAlpha, m_MaskRed,
- m_MaskGreen, m_MaskBlue, m_MaskBlack, pIccModule, pIccTransform);
- }
- if (!pIccTransform && (~src_format & 0x0400) && (dest_format & 0x0400)) {
- return false;
- }
- if ((m_SrcFormat & 0xff) <= 8) {
- if (dest_format == FXDIB_8bppMask) {
- return true;
- }
- ScanlineCompositor_InitSourcePalette(src_format, dest_format, m_pSrcPalette,
- pSrcPalette, pIccModule,
- pIccTransform);
- m_Transparency =
- (dest_format == FXDIB_Argb ? 1 : 0) + (dest_format & 0x0200 ? 2 : 0) +
- (dest_format & 0x0400 ? 4 : 0) + ((src_format & 0xff) == 1 ? 8 : 0);
- return true;
- }
- m_Transparency = (src_format & 0x0200 ? 0 : 1) +
- (dest_format & 0x0200 ? 0 : 2) +
- (blend_type == FXDIB_BLEND_NORMAL ? 4 : 0) +
- (bClip ? 8 : 0) + (src_format & 0x0400 ? 16 : 0) +
- (dest_format & 0x0400 ? 32 : 0) + (pIccTransform ? 64 : 0);
- return true;
-}
-
-void CFX_ScanlineCompositor::CompositeRgbBitmapLine(
- uint8_t* dest_scan,
- const uint8_t* src_scan,
- int width,
- const uint8_t* clip_scan,
- const uint8_t* src_extra_alpha,
- uint8_t* dst_extra_alpha) {
- int src_Bpp = (m_SrcFormat & 0xff) >> 3;
- int dest_Bpp = (m_DestFormat & 0xff) >> 3;
- if (m_bRgbByteOrder) {
- switch (m_Transparency) {
- case 0:
- case 4:
- case 8:
- case 12:
- CompositeRow_Argb2Argb_RgbByteOrder(dest_scan, src_scan, width,
- m_BlendType, clip_scan);
- break;
- case 1:
- CompositeRow_Rgb2Argb_Blend_NoClip_RgbByteOrder(
- dest_scan, src_scan, width, m_BlendType, src_Bpp);
- break;
- case 2:
- case 10:
- CompositeRow_Argb2Rgb_Blend_RgbByteOrder(
- dest_scan, src_scan, width, m_BlendType, dest_Bpp, clip_scan);
- break;
- case 3:
- CompositeRow_Rgb2Rgb_Blend_NoClip_RgbByteOrder(
- dest_scan, src_scan, width, m_BlendType, dest_Bpp, src_Bpp);
- break;
- case 5:
- CompositeRow_Rgb2Argb_NoBlend_NoClip_RgbByteOrder(dest_scan, src_scan,
- width, src_Bpp);
- break;
- case 6:
- case 14:
- CompositeRow_Argb2Rgb_NoBlend_RgbByteOrder(dest_scan, src_scan, width,
- dest_Bpp, clip_scan);
- break;
- case 7:
- CompositeRow_Rgb2Rgb_NoBlend_NoClip_RgbByteOrder(
- dest_scan, src_scan, width, dest_Bpp, src_Bpp);
- break;
- case 9:
- CompositeRow_Rgb2Argb_Blend_Clip_RgbByteOrder(
- dest_scan, src_scan, width, m_BlendType, src_Bpp, clip_scan);
- break;
- case 11:
- CompositeRow_Rgb2Rgb_Blend_Clip_RgbByteOrder(dest_scan, src_scan, width,
- m_BlendType, dest_Bpp,
- src_Bpp, clip_scan);
- break;
- case 13:
- CompositeRow_Rgb2Argb_NoBlend_Clip_RgbByteOrder(
- dest_scan, src_scan, width, src_Bpp, clip_scan);
- break;
- case 15:
- CompositeRow_Rgb2Rgb_NoBlend_Clip_RgbByteOrder(
- dest_scan, src_scan, width, dest_Bpp, src_Bpp, clip_scan);
- break;
- }
- return;
- }
- if (m_DestFormat == FXDIB_8bppMask) {
- if (m_SrcFormat & 0x0200) {
- if (m_SrcFormat == FXDIB_Argb) {
- CompositeRow_Argb2Mask(dest_scan, src_scan, width, clip_scan);
- } else {
- CompositeRow_Rgba2Mask(dest_scan, src_extra_alpha, width, clip_scan);
- }
- } else {
- CompositeRow_Rgb2Mask(dest_scan, src_scan, width, clip_scan);
- }
- } else if ((m_DestFormat & 0xff) == 8) {
- if (m_DestFormat & 0x0400) {
- for (int i = 0; i < width; i++) {
- *dest_scan = ~*dest_scan;
- dest_scan++;
- }
- }
- if (m_SrcFormat & 0x0200) {
- if (m_DestFormat & 0x0200) {
- CompositeRow_Argb2Graya(dest_scan, src_scan, width, m_BlendType,
- clip_scan, src_extra_alpha, dst_extra_alpha,
- m_pIccTransform);
- } else {
- CompositeRow_Argb2Gray(dest_scan, src_scan, width, m_BlendType,
- clip_scan, src_extra_alpha, m_pIccTransform);
- }
- } else {
- if (m_DestFormat & 0x0200) {
- CompositeRow_Rgb2Graya(dest_scan, src_scan, src_Bpp, width, m_BlendType,
- clip_scan, dst_extra_alpha, m_pIccTransform);
- } else {
- CompositeRow_Rgb2Gray(dest_scan, src_scan, src_Bpp, width, m_BlendType,
- clip_scan, m_pIccTransform);
- }
- }
- if (m_DestFormat & 0x0400) {
- for (int i = 0; i < width; i++) {
- *dest_scan = ~*dest_scan;
- dest_scan++;
- }
- }
- } else {
- int dest_Size = width * dest_Bpp + 4;
- if (dest_Size > m_CacheSize) {
- m_pCacheScanline = FX_Realloc(uint8_t, m_pCacheScanline, dest_Size);
- if (!m_pCacheScanline) {
- return;
- }
- m_CacheSize = dest_Size;
- }
- switch (m_Transparency) {
- case 0:
- case 4:
- case 8:
- case 4 + 8: {
- CompositeRow_Argb2Argb(dest_scan, src_scan, width, m_BlendType,
- clip_scan, dst_extra_alpha, src_extra_alpha);
- } break;
- case 64:
- case 4 + 64:
- case 8 + 64:
- case 4 + 8 + 64: {
- CompositeRow_Argb2Argb_Transform(
- dest_scan, src_scan, width, m_BlendType, clip_scan, dst_extra_alpha,
- src_extra_alpha, m_pCacheScanline, m_pIccTransform);
- } break;
- case 1:
- CompositeRow_Rgb2Argb_Blend_NoClip(
- dest_scan, src_scan, width, m_BlendType, src_Bpp, dst_extra_alpha);
- break;
- case 1 + 64:
- CompositeRow_Rgb2Argb_Blend_NoClip_Transform(
- dest_scan, src_scan, width, m_BlendType, src_Bpp, dst_extra_alpha,
- m_pCacheScanline, m_pIccTransform);
- break;
- case 1 + 8:
- CompositeRow_Rgb2Argb_Blend_Clip(dest_scan, src_scan, width,
- m_BlendType, src_Bpp, clip_scan,
- dst_extra_alpha);
- break;
- case 1 + 8 + 64:
- CompositeRow_Rgb2Argb_Blend_Clip_Transform(
- dest_scan, src_scan, width, m_BlendType, src_Bpp, clip_scan,
- dst_extra_alpha, m_pCacheScanline, m_pIccTransform);
- break;
- case 1 + 4:
- CompositeRow_Rgb2Argb_NoBlend_NoClip(dest_scan, src_scan, width,
- src_Bpp, dst_extra_alpha);
- break;
- case 1 + 4 + 64:
- CompositeRow_Rgb2Argb_NoBlend_NoClip_Transform(
- dest_scan, src_scan, width, src_Bpp, dst_extra_alpha,
- m_pCacheScanline, m_pIccTransform);
- break;
- case 1 + 4 + 8:
- CompositeRow_Rgb2Argb_NoBlend_Clip(dest_scan, src_scan, width, src_Bpp,
- clip_scan, dst_extra_alpha);
- break;
- case 1 + 4 + 8 + 64:
- CompositeRow_Rgb2Argb_NoBlend_Clip_Transform(
- dest_scan, src_scan, width, src_Bpp, clip_scan, dst_extra_alpha,
- m_pCacheScanline, m_pIccTransform);
- break;
- case 2:
- case 2 + 8:
- CompositeRow_Argb2Rgb_Blend(dest_scan, src_scan, width, m_BlendType,
- dest_Bpp, clip_scan, src_extra_alpha);
- break;
- case 2 + 64:
- case 2 + 8 + 64:
- CompositeRow_Argb2Rgb_Blend_Transform(
- dest_scan, src_scan, width, m_BlendType, dest_Bpp, clip_scan,
- src_extra_alpha, m_pCacheScanline, m_pIccTransform);
- break;
- case 2 + 4:
- case 2 + 4 + 8:
- CompositeRow_Argb2Rgb_NoBlend(dest_scan, src_scan, width, dest_Bpp,
- clip_scan, src_extra_alpha);
- break;
- case 2 + 4 + 64:
- case 2 + 4 + 8 + 64:
- CompositeRow_Argb2Rgb_NoBlend_Transform(
- dest_scan, src_scan, width, dest_Bpp, clip_scan, src_extra_alpha,
- m_pCacheScanline, m_pIccTransform);
- break;
- case 1 + 2:
- CompositeRow_Rgb2Rgb_Blend_NoClip(dest_scan, src_scan, width,
- m_BlendType, dest_Bpp, src_Bpp);
- break;
- case 1 + 2 + 64:
- CompositeRow_Rgb2Rgb_Blend_NoClip_Transform(
- dest_scan, src_scan, width, m_BlendType, dest_Bpp, src_Bpp,
- m_pCacheScanline, m_pIccTransform);
- break;
- case 1 + 2 + 8:
- CompositeRow_Rgb2Rgb_Blend_Clip(dest_scan, src_scan, width, m_BlendType,
- dest_Bpp, src_Bpp, clip_scan);
- break;
- case 1 + 2 + 8 + 64:
- CompositeRow_Rgb2Rgb_Blend_Clip_Transform(
- dest_scan, src_scan, width, m_BlendType, dest_Bpp, src_Bpp,
- clip_scan, m_pCacheScanline, m_pIccTransform);
- break;
- case 1 + 2 + 4:
- CompositeRow_Rgb2Rgb_NoBlend_NoClip(dest_scan, src_scan, width,
- dest_Bpp, src_Bpp);
- break;
- case 1 + 2 + 4 + 64:
- CompositeRow_Rgb2Rgb_NoBlend_NoClip_Transform(
- dest_scan, src_scan, width, dest_Bpp, src_Bpp, m_pCacheScanline,
- m_pIccTransform);
- break;
- case 1 + 2 + 4 + 8:
- CompositeRow_Rgb2Rgb_NoBlend_Clip(dest_scan, src_scan, width, dest_Bpp,
- src_Bpp, clip_scan);
- break;
- case 1 + 2 + 4 + 8 + 64:
- CompositeRow_Rgb2Rgb_NoBlend_Clip_Transform(
- dest_scan, src_scan, width, dest_Bpp, src_Bpp, clip_scan,
- m_pCacheScanline, m_pIccTransform);
- break;
- }
- }
-}
-
-void CFX_ScanlineCompositor::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,
- uint8_t* dst_extra_alpha) {
- if (m_bRgbByteOrder) {
- if (m_SrcFormat == FXDIB_1bppRgb) {
- if (m_DestFormat == FXDIB_8bppRgb) {
- return;
- }
- if (m_DestFormat == FXDIB_Argb) {
- CompositeRow_1bppRgb2Argb_NoBlend_RgbByteOrder(
- dest_scan, src_scan, src_left, width, m_pSrcPalette, clip_scan);
- } else {
- CompositeRow_1bppRgb2Rgb_NoBlend_RgbByteOrder(
- dest_scan, src_scan, src_left, m_pSrcPalette, width,
- (m_DestFormat & 0xff) >> 3, clip_scan);
- }
- } else {
- if (m_DestFormat == FXDIB_8bppRgb) {
- return;
- }
- if (m_DestFormat == FXDIB_Argb) {
- CompositeRow_8bppRgb2Argb_NoBlend_RgbByteOrder(
- dest_scan, src_scan, width, m_pSrcPalette, clip_scan);
- } else {
- CompositeRow_8bppRgb2Rgb_NoBlend_RgbByteOrder(
- dest_scan, src_scan, m_pSrcPalette, width,
- (m_DestFormat & 0xff) >> 3, clip_scan);
- }
- }
- return;
- }
- if (m_DestFormat == FXDIB_8bppMask) {
- CompositeRow_Rgb2Mask(dest_scan, src_scan, width, clip_scan);
- return;
- }
- if ((m_DestFormat & 0xff) == 8) {
- if (m_Transparency & 8) {
- if (m_DestFormat & 0x0200) {
- CompositeRow_1bppPal2Graya(dest_scan, src_scan, src_left,
- (const uint8_t*)m_pSrcPalette, width,
- m_BlendType, clip_scan, dst_extra_alpha);
- } else {
- CompositeRow_1bppPal2Gray(dest_scan, src_scan, src_left,
- (const uint8_t*)m_pSrcPalette, width,
- m_BlendType, clip_scan);
- }
- } else {
- if (m_DestFormat & 0x0200)
- CompositeRow_8bppPal2Graya(
- dest_scan, src_scan, (const uint8_t*)m_pSrcPalette, width,
- m_BlendType, clip_scan, dst_extra_alpha, src_extra_alpha);
- else
- CompositeRow_8bppPal2Gray(dest_scan, src_scan,
- (const uint8_t*)m_pSrcPalette, width,
- m_BlendType, clip_scan, src_extra_alpha);
- }
- } else {
- switch (m_Transparency) {
- case 1 + 2:
- CompositeRow_8bppRgb2Argb_NoBlend(dest_scan, src_scan, width,
- m_pSrcPalette, clip_scan,
- src_extra_alpha);
- break;
- case 1 + 2 + 8:
- CompositeRow_1bppRgb2Argb_NoBlend(dest_scan, src_scan, src_left, width,
- m_pSrcPalette, clip_scan);
- break;
- case 0:
- CompositeRow_8bppRgb2Rgb_NoBlend(dest_scan, src_scan, m_pSrcPalette,
- width, (m_DestFormat & 0xff) >> 3,
- clip_scan, src_extra_alpha);
- break;
- case 0 + 8:
- CompositeRow_1bppRgb2Rgb_NoBlend(dest_scan, src_scan, src_left,
- m_pSrcPalette, width,
- (m_DestFormat & 0xff) >> 3, clip_scan);
- break;
- case 0 + 2:
- CompositeRow_8bppRgb2Rgb_NoBlend(dest_scan, src_scan, m_pSrcPalette,
- width, (m_DestFormat & 0xff) >> 3,
- clip_scan, src_extra_alpha);
- break;
- case 0 + 2 + 8:
- CompositeRow_1bppRgb2Rgba_NoBlend(dest_scan, src_scan, src_left, width,
- m_pSrcPalette, clip_scan,
- dst_extra_alpha);
- break;
- break;
- }
- }
-}
-
-void CFX_ScanlineCompositor::CompositeByteMaskLine(uint8_t* dest_scan,
- const uint8_t* src_scan,
- int width,
- const uint8_t* clip_scan,
- uint8_t* dst_extra_alpha) {
- if (m_DestFormat == FXDIB_8bppMask) {
- CompositeRow_ByteMask2Mask(dest_scan, src_scan, m_MaskAlpha, width,
- clip_scan);
- } else if ((m_DestFormat & 0xff) == 8) {
- if (m_DestFormat & 0x0200) {
- CompositeRow_ByteMask2Graya(dest_scan, src_scan, m_MaskAlpha, m_MaskRed,
- width, clip_scan, dst_extra_alpha);
- } else {
- CompositeRow_ByteMask2Gray(dest_scan, src_scan, m_MaskAlpha, m_MaskRed,
- width, clip_scan);
- }
- } else if (m_bRgbByteOrder) {
- if (m_DestFormat == FXDIB_Argb) {
- CompositeRow_ByteMask2Argb_RgbByteOrder(
- dest_scan, src_scan, m_MaskAlpha, m_MaskRed, m_MaskGreen, m_MaskBlue,
- width, m_BlendType, clip_scan);
- } else {
- CompositeRow_ByteMask2Rgb_RgbByteOrder(
- dest_scan, src_scan, m_MaskAlpha, m_MaskRed, m_MaskGreen, m_MaskBlue,
- width, m_BlendType, (m_DestFormat & 0xff) >> 3, clip_scan);
- }
- return;
- } else if (m_DestFormat == FXDIB_Argb) {
- CompositeRow_ByteMask2Argb(dest_scan, src_scan, m_MaskAlpha, m_MaskRed,
- m_MaskGreen, m_MaskBlue, width, m_BlendType,
- clip_scan);
- } else if (m_DestFormat == FXDIB_Rgb || m_DestFormat == FXDIB_Rgb32) {
- CompositeRow_ByteMask2Rgb(dest_scan, src_scan, m_MaskAlpha, m_MaskRed,
- m_MaskGreen, m_MaskBlue, width, m_BlendType,
- (m_DestFormat & 0xff) >> 3, clip_scan);
- } else if (m_DestFormat == FXDIB_Rgba) {
- CompositeRow_ByteMask2Rgba(dest_scan, src_scan, m_MaskAlpha, m_MaskRed,
- m_MaskGreen, m_MaskBlue, width, m_BlendType,
- clip_scan, dst_extra_alpha);
- }
-}
-
-void CFX_ScanlineCompositor::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) {
- if (m_DestFormat == FXDIB_8bppMask) {
- CompositeRow_BitMask2Mask(dest_scan, src_scan, m_MaskAlpha, src_left, width,
- clip_scan);
- } else if ((m_DestFormat & 0xff) == 8) {
- if (m_DestFormat & 0x0200) {
- CompositeRow_BitMask2Graya(dest_scan, src_scan, m_MaskAlpha, m_MaskRed,
- src_left, width, clip_scan, dst_extra_alpha);
- } else {
- CompositeRow_BitMask2Gray(dest_scan, src_scan, m_MaskAlpha, m_MaskRed,
- src_left, width, clip_scan);
- }
- } else if (m_bRgbByteOrder) {
- if (m_DestFormat == FXDIB_Argb) {
- CompositeRow_BitMask2Argb_RgbByteOrder(
- dest_scan, src_scan, m_MaskAlpha, m_MaskRed, m_MaskGreen, m_MaskBlue,
- src_left, width, m_BlendType, clip_scan);
- } else {
- CompositeRow_BitMask2Rgb_RgbByteOrder(
- dest_scan, src_scan, m_MaskAlpha, m_MaskRed, m_MaskGreen, m_MaskBlue,
- src_left, width, m_BlendType, (m_DestFormat & 0xff) >> 3, clip_scan);
- }
- return;
- } else if (m_DestFormat == FXDIB_Argb) {
- CompositeRow_BitMask2Argb(dest_scan, src_scan, m_MaskAlpha, m_MaskRed,
- m_MaskGreen, m_MaskBlue, src_left, width,
- m_BlendType, clip_scan);
- } else if (m_DestFormat == FXDIB_Rgb || m_DestFormat == FXDIB_Rgb32) {
- CompositeRow_BitMask2Rgb(
- dest_scan, src_scan, m_MaskAlpha, m_MaskRed, m_MaskGreen, m_MaskBlue,
- src_left, width, m_BlendType, (m_DestFormat & 0xff) >> 3, clip_scan);
- }
-}
-
-bool CFX_DIBitmap::CompositeBitmap(int dest_left,
- int dest_top,
- int width,
- int height,
- const CFX_DIBSource* pSrcBitmap,
- int src_left,
- int src_top,
- int blend_type,
- const CFX_ClipRgn* pClipRgn,
- bool bRgbByteOrder,
- void* pIccTransform) {
- if (!m_pBuffer) {
- return false;
- }
- ASSERT(!pSrcBitmap->IsAlphaMask());
- ASSERT(m_bpp >= 8);
- if (pSrcBitmap->IsAlphaMask() || m_bpp < 8) {
- return false;
- }
- GetOverlapRect(dest_left, dest_top, width, height, pSrcBitmap->GetWidth(),
- pSrcBitmap->GetHeight(), src_left, src_top, pClipRgn);
- if (width == 0 || height == 0) {
- return true;
- }
- const CFX_DIBitmap* pClipMask = nullptr;
- FX_RECT clip_box;
- if (pClipRgn && pClipRgn->GetType() != CFX_ClipRgn::RectI) {
- ASSERT(pClipRgn->GetType() == CFX_ClipRgn::MaskF);
- pClipMask = pClipRgn->GetMask().GetObject();
- clip_box = pClipRgn->GetBox();
- }
- CFX_ScanlineCompositor compositor;
- if (!compositor.Init(GetFormat(), pSrcBitmap->GetFormat(), width,
- pSrcBitmap->GetPalette(), 0, blend_type,
- pClipMask != nullptr, bRgbByteOrder, 0, pIccTransform)) {
- return false;
- }
- int dest_Bpp = m_bpp / 8;
- int src_Bpp = pSrcBitmap->GetBPP() / 8;
- bool bRgb = src_Bpp > 1 && !pSrcBitmap->IsCmykImage();
- CFX_DIBitmap* pSrcAlphaMask = pSrcBitmap->m_pAlphaMask;
- for (int row = 0; row < height; row++) {
- uint8_t* dest_scan =
- m_pBuffer + (dest_top + row) * m_Pitch + dest_left * dest_Bpp;
- const uint8_t* src_scan =
- pSrcBitmap->GetScanline(src_top + row) + src_left * src_Bpp;
- const uint8_t* src_scan_extra_alpha =
- pSrcAlphaMask ? pSrcAlphaMask->GetScanline(src_top + row) + src_left
- : nullptr;
- uint8_t* dst_scan_extra_alpha =
- m_pAlphaMask
- ? (uint8_t*)m_pAlphaMask->GetScanline(dest_top + row) + dest_left
- : nullptr;
- const uint8_t* clip_scan = nullptr;
- if (pClipMask) {
- clip_scan = pClipMask->m_pBuffer +
- (dest_top + row - clip_box.top) * pClipMask->m_Pitch +
- (dest_left - clip_box.left);
- }
- if (bRgb) {
- compositor.CompositeRgbBitmapLine(dest_scan, src_scan, width, clip_scan,
- src_scan_extra_alpha,
- dst_scan_extra_alpha);
- } else {
- compositor.CompositePalBitmapLine(dest_scan, src_scan, src_left, width,
- clip_scan, src_scan_extra_alpha,
- dst_scan_extra_alpha);
- }
- }
- return true;
-}
-
-bool CFX_DIBitmap::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,
- const CFX_ClipRgn* pClipRgn,
- bool bRgbByteOrder,
- int alpha_flag,
- void* pIccTransform) {
- if (!m_pBuffer) {
- return false;
- }
- ASSERT(pMask->IsAlphaMask());
- ASSERT(m_bpp >= 8);
- if (!pMask->IsAlphaMask() || m_bpp < 8) {
- return false;
- }
- GetOverlapRect(dest_left, dest_top, width, height, pMask->GetWidth(),
- pMask->GetHeight(), src_left, src_top, pClipRgn);
- if (width == 0 || height == 0) {
- return true;
- }
- int src_alpha =
- (uint8_t)(alpha_flag >> 8) ? (alpha_flag & 0xff) : FXARGB_A(color);
- if (src_alpha == 0) {
- return true;
- }
- const CFX_DIBitmap* pClipMask = nullptr;
- FX_RECT clip_box;
- if (pClipRgn && pClipRgn->GetType() != CFX_ClipRgn::RectI) {
- ASSERT(pClipRgn->GetType() == CFX_ClipRgn::MaskF);
- pClipMask = pClipRgn->GetMask().GetObject();
- clip_box = pClipRgn->GetBox();
- }
- int src_bpp = pMask->GetBPP();
- int Bpp = GetBPP() / 8;
- CFX_ScanlineCompositor compositor;
- if (!compositor.Init(GetFormat(), pMask->GetFormat(), width, nullptr, color,
- blend_type, pClipMask != nullptr, bRgbByteOrder,
- alpha_flag, pIccTransform)) {
- return false;
- }
- for (int row = 0; row < height; row++) {
- uint8_t* dest_scan =
- m_pBuffer + (dest_top + row) * m_Pitch + dest_left * Bpp;
- const uint8_t* src_scan = pMask->GetScanline(src_top + row);
- uint8_t* dst_scan_extra_alpha =
- m_pAlphaMask
- ? (uint8_t*)m_pAlphaMask->GetScanline(dest_top + row) + dest_left
- : nullptr;
- const uint8_t* clip_scan = nullptr;
- if (pClipMask) {
- clip_scan = pClipMask->m_pBuffer +
- (dest_top + row - clip_box.top) * pClipMask->m_Pitch +
- (dest_left - clip_box.left);
- }
- if (src_bpp == 1) {
- compositor.CompositeBitMaskLine(dest_scan, src_scan, src_left, width,
- clip_scan, dst_scan_extra_alpha);
- } else {
- compositor.CompositeByteMaskLine(dest_scan, src_scan + src_left, width,
- clip_scan, dst_scan_extra_alpha);
- }
- }
- return true;
-}
-
-bool CFX_DIBitmap::CompositeRect(int left,
- int top,
- int width,
- int height,
- uint32_t color,
- int alpha_flag,
- void* pIccTransform) {
- if (!m_pBuffer) {
- return false;
- }
- int src_alpha = (alpha_flag >> 8) ? (alpha_flag & 0xff) : FXARGB_A(color);
- if (src_alpha == 0) {
- return true;
- }
- FX_RECT rect(left, top, left + width, top + height);
- rect.Intersect(0, 0, m_Width, m_Height);
- if (rect.IsEmpty()) {
- return true;
- }
- width = rect.Width();
- uint32_t dst_color;
- if (alpha_flag >> 8) {
- dst_color = FXCMYK_TODIB(color);
- } else {
- dst_color = FXARGB_TODIB(color);
- }
- uint8_t* color_p = (uint8_t*)&dst_color;
- if (m_bpp == 8) {
- uint8_t gray = 255;
- if (!IsAlphaMask()) {
- if (pIccTransform && CFX_GEModule::Get()->GetCodecModule() &&
- CFX_GEModule::Get()->GetCodecModule()->GetIccModule()) {
- CCodec_IccModule* pIccModule =
- CFX_GEModule::Get()->GetCodecModule()->GetIccModule();
- pIccModule->TranslateScanline(pIccTransform, &gray, color_p, 1);
- } else {
- if (alpha_flag >> 8) {
- uint8_t r, g, b;
- AdobeCMYK_to_sRGB1(color_p[0], color_p[1], color_p[2], color_p[3], r,
- g, b);
- gray = FXRGB2GRAY(r, g, b);
- } else {
- gray = (uint8_t)FXRGB2GRAY((int)color_p[2], color_p[1], color_p[0]);
- }
- }
- if (IsCmykImage()) {
- gray = ~gray;
- }
- }
- for (int row = rect.top; row < rect.bottom; row++) {
- uint8_t* dest_scan = m_pBuffer + row * m_Pitch + rect.left;
- if (src_alpha == 255) {
- FXSYS_memset(dest_scan, gray, width);
- } else {
- for (int col = 0; col < width; col++) {
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, src_alpha);
- dest_scan++;
- }
- }
- }
- return true;
- }
- if (m_bpp == 1) {
- ASSERT(!IsCmykImage() && (uint8_t)(alpha_flag >> 8) == 0);
- int left_shift = rect.left % 8;
- int right_shift = rect.right % 8;
- int new_width = rect.right / 8 - rect.left / 8;
- int index = 0;
- if (m_pPalette) {
- for (int i = 0; i < 2; i++) {
- if (m_pPalette.get()[i] == color) {
- index = i;
- }
- }
- } else {
- index = ((uint8_t)color == 0xff) ? 1 : 0;
- }
- for (int row = rect.top; row < rect.bottom; row++) {
- uint8_t* dest_scan_top = (uint8_t*)GetScanline(row) + rect.left / 8;
- uint8_t* dest_scan_top_r = (uint8_t*)GetScanline(row) + rect.right / 8;
- uint8_t left_flag = *dest_scan_top & (255 << (8 - left_shift));
- uint8_t right_flag = *dest_scan_top_r & (255 >> right_shift);
- if (new_width) {
- FXSYS_memset(dest_scan_top + 1, index ? 255 : 0, new_width - 1);
- if (!index) {
- *dest_scan_top &= left_flag;
- *dest_scan_top_r &= right_flag;
- } else {
- *dest_scan_top |= ~left_flag;
- *dest_scan_top_r |= ~right_flag;
- }
- } else {
- if (!index) {
- *dest_scan_top &= left_flag | right_flag;
- } else {
- *dest_scan_top |= ~(left_flag | right_flag);
- }
- }
- }
- return true;
- }
- ASSERT(m_bpp >= 24);
- if (m_bpp < 24) {
- return false;
- }
- if (pIccTransform && CFX_GEModule::Get()->GetCodecModule()) {
- CCodec_IccModule* pIccModule =
- CFX_GEModule::Get()->GetCodecModule()->GetIccModule();
- pIccModule->TranslateScanline(pIccTransform, color_p, color_p, 1);
- } else {
- if (alpha_flag >> 8 && !IsCmykImage()) {
- AdobeCMYK_to_sRGB1(FXSYS_GetCValue(color), FXSYS_GetMValue(color),
- FXSYS_GetYValue(color), FXSYS_GetKValue(color),
- color_p[2], color_p[1], color_p[0]);
- } else if (!(alpha_flag >> 8) && IsCmykImage()) {
- return false;
- }
- }
- if (!IsCmykImage()) {
- color_p[3] = (uint8_t)src_alpha;
- }
- int Bpp = m_bpp / 8;
- bool bAlpha = HasAlpha();
- bool bArgb = GetFormat() == FXDIB_Argb;
- if (src_alpha == 255) {
- for (int row = rect.top; row < rect.bottom; row++) {
- uint8_t* dest_scan = m_pBuffer + row * m_Pitch + rect.left * Bpp;
- uint8_t* dest_scan_alpha =
- m_pAlphaMask ? (uint8_t*)m_pAlphaMask->GetScanline(row) + rect.left
- : nullptr;
- if (dest_scan_alpha) {
- FXSYS_memset(dest_scan_alpha, 0xff, width);
- }
- if (Bpp == 4) {
- uint32_t* scan = (uint32_t*)dest_scan;
- for (int col = 0; col < width; col++) {
- *scan++ = dst_color;
- }
- } else {
- for (int col = 0; col < width; col++) {
- *dest_scan++ = color_p[0];
- *dest_scan++ = color_p[1];
- *dest_scan++ = color_p[2];
- }
- }
- }
- return true;
- }
- for (int row = rect.top; row < rect.bottom; row++) {
- uint8_t* dest_scan = m_pBuffer + row * m_Pitch + rect.left * Bpp;
- if (bAlpha) {
- if (bArgb) {
- for (int col = 0; col < width; col++) {
- uint8_t back_alpha = dest_scan[3];
- if (back_alpha == 0) {
- FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alpha, color_p[2],
- color_p[1], color_p[0]));
- dest_scan += 4;
- continue;
- }
- uint8_t dest_alpha =
- back_alpha + src_alpha - back_alpha * src_alpha / 255;
- int alpha_ratio = src_alpha * 255 / dest_alpha;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, color_p[0], alpha_ratio);
- dest_scan++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, color_p[1], alpha_ratio);
- dest_scan++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, color_p[2], alpha_ratio);
- dest_scan++;
- *dest_scan++ = dest_alpha;
- }
- } else {
- uint8_t* dest_scan_alpha =
- (uint8_t*)m_pAlphaMask->GetScanline(row) + rect.left;
- for (int col = 0; col < width; col++) {
- uint8_t back_alpha = *dest_scan_alpha;
- if (back_alpha == 0) {
- *dest_scan_alpha++ = src_alpha;
- FXSYS_memcpy(dest_scan, color_p, Bpp);
- dest_scan += Bpp;
- continue;
- }
- uint8_t dest_alpha =
- back_alpha + src_alpha - back_alpha * src_alpha / 255;
- *dest_scan_alpha++ = dest_alpha;
- int alpha_ratio = src_alpha * 255 / dest_alpha;
- for (int comps = 0; comps < Bpp; comps++) {
- *dest_scan =
- FXDIB_ALPHA_MERGE(*dest_scan, color_p[comps], alpha_ratio);
- dest_scan++;
- }
- }
- }
- } else {
- for (int col = 0; col < width; col++) {
- for (int comps = 0; comps < Bpp; comps++) {
- if (comps == 3) {
- *dest_scan++ = 255;
- continue;
- }
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, color_p[comps], src_alpha);
- dest_scan++;
- }
- }
- }
- }
- return true;
-}
-
-CFX_BitmapComposer::CFX_BitmapComposer() {
- m_pScanlineV = nullptr;
- m_pScanlineAlphaV = nullptr;
- m_pClipScanV = nullptr;
- m_pAddClipScan = nullptr;
- m_bRgbByteOrder = false;
- m_BlendType = FXDIB_BLEND_NORMAL;
-}
-
-CFX_BitmapComposer::~CFX_BitmapComposer() {
- FX_Free(m_pScanlineV);
- FX_Free(m_pScanlineAlphaV);
- FX_Free(m_pClipScanV);
- FX_Free(m_pAddClipScan);
-}
-
-void CFX_BitmapComposer::Compose(CFX_DIBitmap* pDest,
- const CFX_ClipRgn* pClipRgn,
- int bitmap_alpha,
- uint32_t mask_color,
- FX_RECT& dest_rect,
- bool bVertical,
- bool bFlipX,
- bool bFlipY,
- bool bRgbByteOrder,
- int alpha_flag,
- void* pIccTransform,
- int blend_type) {
- m_pBitmap = pDest;
- m_pClipRgn = pClipRgn;
- m_DestLeft = dest_rect.left;
- m_DestTop = dest_rect.top;
- m_DestWidth = dest_rect.Width();
- m_DestHeight = dest_rect.Height();
- m_BitmapAlpha = bitmap_alpha;
- m_MaskColor = mask_color;
- m_pClipMask = nullptr;
- if (pClipRgn && pClipRgn->GetType() != CFX_ClipRgn::RectI) {
- m_pClipMask = pClipRgn->GetMask().GetObject();
- }
- m_bVertical = bVertical;
- m_bFlipX = bFlipX;
- m_bFlipY = bFlipY;
- m_AlphaFlag = alpha_flag;
- m_pIccTransform = pIccTransform;
- m_bRgbByteOrder = bRgbByteOrder;
- m_BlendType = blend_type;
-}
-bool CFX_BitmapComposer::SetInfo(int width,
- int height,
- FXDIB_Format src_format,
- uint32_t* pSrcPalette) {
- m_SrcFormat = src_format;
- if (!m_Compositor.Init(m_pBitmap->GetFormat(), src_format, width, pSrcPalette,
- m_MaskColor, FXDIB_BLEND_NORMAL,
- m_pClipMask != nullptr || (m_BitmapAlpha < 255),
- m_bRgbByteOrder, m_AlphaFlag, m_pIccTransform)) {
- return false;
- }
- if (m_bVertical) {
- m_pScanlineV = FX_Alloc(uint8_t, m_pBitmap->GetBPP() / 8 * width + 4);
- m_pClipScanV = FX_Alloc(uint8_t, m_pBitmap->GetHeight());
- if (m_pBitmap->m_pAlphaMask) {
- m_pScanlineAlphaV = FX_Alloc(uint8_t, width + 4);
- }
- }
- if (m_BitmapAlpha < 255) {
- m_pAddClipScan = FX_Alloc(
- uint8_t, m_bVertical ? m_pBitmap->GetHeight() : m_pBitmap->GetWidth());
- }
- return true;
-}
-
-void CFX_BitmapComposer::DoCompose(uint8_t* dest_scan,
- const uint8_t* src_scan,
- int dest_width,
- const uint8_t* clip_scan,
- const uint8_t* src_extra_alpha,
- uint8_t* dst_extra_alpha) {
- if (m_BitmapAlpha < 255) {
- if (clip_scan) {
- for (int i = 0; i < dest_width; i++) {
- m_pAddClipScan[i] = clip_scan[i] * m_BitmapAlpha / 255;
- }
- } else {
- FXSYS_memset(m_pAddClipScan, m_BitmapAlpha, dest_width);
- }
- clip_scan = m_pAddClipScan;
- }
- if (m_SrcFormat == FXDIB_8bppMask) {
- m_Compositor.CompositeByteMaskLine(dest_scan, src_scan, dest_width,
- clip_scan, dst_extra_alpha);
- } else if ((m_SrcFormat & 0xff) == 8) {
- m_Compositor.CompositePalBitmapLine(dest_scan, src_scan, 0, dest_width,
- clip_scan, src_extra_alpha,
- dst_extra_alpha);
- } else {
- m_Compositor.CompositeRgbBitmapLine(dest_scan, src_scan, dest_width,
- clip_scan, src_extra_alpha,
- dst_extra_alpha);
- }
-}
-
-void CFX_BitmapComposer::ComposeScanline(int line,
- const uint8_t* scanline,
- const uint8_t* scan_extra_alpha) {
- if (m_bVertical) {
- ComposeScanlineV(line, scanline, scan_extra_alpha);
- return;
- }
- const uint8_t* clip_scan = nullptr;
- if (m_pClipMask)
- clip_scan = m_pClipMask->GetBuffer() +
- (m_DestTop + line - m_pClipRgn->GetBox().top) *
- m_pClipMask->GetPitch() +
- (m_DestLeft - m_pClipRgn->GetBox().left);
- uint8_t* dest_scan = (uint8_t*)m_pBitmap->GetScanline(line + m_DestTop) +
- m_DestLeft * m_pBitmap->GetBPP() / 8;
- uint8_t* dest_alpha_scan =
- m_pBitmap->m_pAlphaMask
- ? (uint8_t*)m_pBitmap->m_pAlphaMask->GetScanline(line + m_DestTop) +
- m_DestLeft
- : nullptr;
- DoCompose(dest_scan, scanline, m_DestWidth, clip_scan, scan_extra_alpha,
- dest_alpha_scan);
-}
-
-void CFX_BitmapComposer::ComposeScanlineV(int line,
- const uint8_t* scanline,
- const uint8_t* scan_extra_alpha) {
- int i;
- int Bpp = m_pBitmap->GetBPP() / 8;
- int dest_pitch = m_pBitmap->GetPitch();
- int dest_alpha_pitch =
- m_pBitmap->m_pAlphaMask ? m_pBitmap->m_pAlphaMask->GetPitch() : 0;
- int dest_x = m_DestLeft + (m_bFlipX ? (m_DestWidth - line - 1) : line);
- uint8_t* dest_buf =
- m_pBitmap->GetBuffer() + dest_x * Bpp + m_DestTop * dest_pitch;
- uint8_t* dest_alpha_buf = m_pBitmap->m_pAlphaMask
- ? m_pBitmap->m_pAlphaMask->GetBuffer() +
- dest_x + m_DestTop * dest_alpha_pitch
- : nullptr;
- if (m_bFlipY) {
- dest_buf += dest_pitch * (m_DestHeight - 1);
- dest_alpha_buf += dest_alpha_pitch * (m_DestHeight - 1);
- }
- int y_step = dest_pitch;
- int y_alpha_step = dest_alpha_pitch;
- if (m_bFlipY) {
- y_step = -y_step;
- y_alpha_step = -y_alpha_step;
- }
- uint8_t* src_scan = m_pScanlineV;
- uint8_t* dest_scan = dest_buf;
- for (i = 0; i < m_DestHeight; i++) {
- for (int j = 0; j < Bpp; j++) {
- *src_scan++ = dest_scan[j];
- }
- dest_scan += y_step;
- }
- uint8_t* src_alpha_scan = m_pScanlineAlphaV;
- uint8_t* dest_alpha_scan = dest_alpha_buf;
- if (dest_alpha_scan) {
- for (i = 0; i < m_DestHeight; i++) {
- *src_alpha_scan++ = *dest_alpha_scan;
- dest_alpha_scan += y_alpha_step;
- }
- }
- uint8_t* clip_scan = nullptr;
- if (m_pClipMask) {
- clip_scan = m_pClipScanV;
- int clip_pitch = m_pClipMask->GetPitch();
- const uint8_t* src_clip =
- m_pClipMask->GetBuffer() +
- (m_DestTop - m_pClipRgn->GetBox().top) * clip_pitch +
- (dest_x - m_pClipRgn->GetBox().left);
- if (m_bFlipY) {
- src_clip += clip_pitch * (m_DestHeight - 1);
- clip_pitch = -clip_pitch;
- }
- for (i = 0; i < m_DestHeight; i++) {
- clip_scan[i] = *src_clip;
- src_clip += clip_pitch;
- }
- }
- DoCompose(m_pScanlineV, scanline, m_DestHeight, clip_scan, scan_extra_alpha,
- m_pScanlineAlphaV);
- src_scan = m_pScanlineV;
- dest_scan = dest_buf;
- for (i = 0; i < m_DestHeight; i++) {
- for (int j = 0; j < Bpp; j++) {
- dest_scan[j] = *src_scan++;
- }
- dest_scan += y_step;
- }
- src_alpha_scan = m_pScanlineAlphaV;
- dest_alpha_scan = dest_alpha_buf;
- if (dest_alpha_scan) {
- for (i = 0; i < m_DestHeight; i++) {
- *dest_alpha_scan = *src_alpha_scan++;
- dest_alpha_scan += y_alpha_step;
- }
- }
-}
diff --git a/chromium/third_party/pdfium/core/fxge/dib/fx_dib_convert.cpp b/chromium/third_party/pdfium/core/fxge/dib/fx_dib_convert.cpp
deleted file mode 100644
index aad3f343e20..00000000000
--- a/chromium/third_party/pdfium/core/fxge/dib/fx_dib_convert.cpp
+++ /dev/null
@@ -1,911 +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
-
-#include <memory>
-#include <utility>
-
-#include "core/fxcodec/fx_codec.h"
-#include "core/fxcrt/cfx_maybe_owned.h"
-#include "core/fxge/fx_dib.h"
-#include "third_party/base/ptr_util.h"
-
-class CFX_Palette {
- public:
- CFX_Palette();
- ~CFX_Palette();
-
- bool BuildPalette(const CFX_DIBSource* pBitmap);
- uint32_t* GetPalette() const { return m_pPalette; }
- uint32_t* GetColorLut() const { return m_cLut; }
- uint32_t* GetAmountLut() const { return m_aLut; }
- int32_t Getlut() const { return m_lut; }
-
- protected:
- uint32_t* m_pPalette;
- uint32_t* m_cLut;
- uint32_t* m_aLut;
- int m_lut;
-};
-int _Partition(uint32_t* alut, uint32_t* clut, int l, int r) {
- uint32_t p_a = alut[l];
- uint32_t p_c = clut[l];
- while (l < r) {
- while (l < r && alut[r] >= p_a) {
- r--;
- }
- if (l < r) {
- alut[l] = alut[r];
- clut[l++] = clut[r];
- }
- while (l < r && alut[l] <= p_a) {
- l++;
- }
- if (l < r) {
- alut[r] = alut[l];
- clut[r--] = clut[l];
- }
- }
- alut[l] = p_a;
- clut[l] = p_c;
- return l;
-}
-
-void _Qsort(uint32_t* alut, uint32_t* clut, int l, int r) {
- if (l < r) {
- int pI = _Partition(alut, clut, l, r);
- _Qsort(alut, clut, l, pI - 1);
- _Qsort(alut, clut, pI + 1, r);
- }
-}
-
-void _ColorDecode(uint32_t pal_v, uint8_t& r, uint8_t& g, uint8_t& b) {
- r = (uint8_t)((pal_v & 0xf00) >> 4);
- g = (uint8_t)(pal_v & 0x0f0);
- b = (uint8_t)((pal_v & 0x00f) << 4);
-}
-
-void _Obtain_Pal(uint32_t* aLut,
- uint32_t* cLut,
- uint32_t* dest_pal,
- uint32_t lut) {
- uint32_t lut_1 = lut - 1;
- for (int row = 0; row < 256; row++) {
- int lut_offset = lut_1 - row;
- if (lut_offset < 0) {
- lut_offset += 256;
- }
- uint32_t color = cLut[lut_offset];
- uint8_t r;
- uint8_t g;
- uint8_t b;
- _ColorDecode(color, r, g, b);
- dest_pal[row] = ((uint32_t)r << 16) | ((uint32_t)g << 8) | b | 0xff000000;
- aLut[lut_offset] = row;
- }
-}
-
-CFX_Palette::CFX_Palette() {
- m_pPalette = nullptr;
- m_cLut = nullptr;
- m_aLut = nullptr;
- m_lut = 0;
-}
-
-CFX_Palette::~CFX_Palette() {
- FX_Free(m_pPalette);
- FX_Free(m_cLut);
- FX_Free(m_aLut);
- m_lut = 0;
-}
-
-bool CFX_Palette::BuildPalette(const CFX_DIBSource* pBitmap) {
- if (!pBitmap) {
- return false;
- }
- FX_Free(m_pPalette);
- m_pPalette = FX_Alloc(uint32_t, 256);
- int bpp = pBitmap->GetBPP() / 8;
- int width = pBitmap->GetWidth();
- int height = pBitmap->GetHeight();
- FX_Free(m_cLut);
- m_cLut = nullptr;
- FX_Free(m_aLut);
- m_aLut = nullptr;
- m_cLut = FX_Alloc(uint32_t, 4096);
- m_aLut = FX_Alloc(uint32_t, 4096);
- int row, col;
- m_lut = 0;
- for (row = 0; row < height; row++) {
- uint8_t* scan_line = (uint8_t*)pBitmap->GetScanline(row);
- for (col = 0; col < width; col++) {
- uint8_t* src_port = scan_line + col * bpp;
- uint32_t b = src_port[0] & 0xf0;
- uint32_t g = src_port[1] & 0xf0;
- uint32_t r = src_port[2] & 0xf0;
- uint32_t index = (r << 4) + g + (b >> 4);
- m_aLut[index]++;
- }
- }
- for (row = 0; row < 4096; row++) {
- if (m_aLut[row] != 0) {
- m_aLut[m_lut] = m_aLut[row];
- m_cLut[m_lut] = row;
- m_lut++;
- }
- }
- _Qsort(m_aLut, m_cLut, 0, m_lut - 1);
- _Obtain_Pal(m_aLut, m_cLut, m_pPalette, m_lut);
- return true;
-}
-
-bool ConvertBuffer_1bppMask2Gray(uint8_t* dest_buf,
- int dest_pitch,
- int width,
- int height,
- const CFX_DIBSource* pSrcBitmap,
- int src_left,
- int src_top) {
- uint8_t set_gray, reset_gray;
- set_gray = 0xff;
- reset_gray = 0x00;
- for (int row = 0; row < height; row++) {
- uint8_t* dest_scan = dest_buf + row * dest_pitch;
- FXSYS_memset(dest_scan, reset_gray, width);
- const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row);
- for (int col = src_left; col < src_left + width; col++) {
- if (src_scan[col / 8] & (1 << (7 - col % 8))) {
- *dest_scan = set_gray;
- }
- dest_scan++;
- }
- }
- return true;
-}
-
-bool ConvertBuffer_8bppMask2Gray(uint8_t* dest_buf,
- int dest_pitch,
- int width,
- int height,
- const CFX_DIBSource* pSrcBitmap,
- int src_left,
- int src_top) {
- for (int row = 0; row < height; row++) {
- uint8_t* dest_scan = dest_buf + row * dest_pitch;
- const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left;
- FXSYS_memcpy(dest_scan, src_scan, width);
- }
- return true;
-}
-
-bool ConvertBuffer_1bppPlt2Gray(uint8_t* dest_buf,
- int dest_pitch,
- int width,
- int height,
- const CFX_DIBSource* pSrcBitmap,
- int src_left,
- int src_top) {
- uint32_t* src_plt = pSrcBitmap->GetPalette();
- uint8_t gray[2];
- uint8_t reset_r;
- uint8_t reset_g;
- uint8_t reset_b;
- uint8_t set_r;
- uint8_t set_g;
- uint8_t set_b;
- if (pSrcBitmap->IsCmykImage()) {
- AdobeCMYK_to_sRGB1(FXSYS_GetCValue(src_plt[0]), FXSYS_GetMValue(src_plt[0]),
- FXSYS_GetYValue(src_plt[0]), FXSYS_GetKValue(src_plt[0]),
- reset_r, reset_g, reset_b);
- AdobeCMYK_to_sRGB1(FXSYS_GetCValue(src_plt[1]), FXSYS_GetMValue(src_plt[1]),
- FXSYS_GetYValue(src_plt[1]), FXSYS_GetKValue(src_plt[1]),
- set_r, set_g, set_b);
- } else {
- reset_r = FXARGB_R(src_plt[0]);
- reset_g = FXARGB_G(src_plt[0]);
- reset_b = FXARGB_B(src_plt[0]);
- set_r = FXARGB_R(src_plt[1]);
- set_g = FXARGB_G(src_plt[1]);
- set_b = FXARGB_B(src_plt[1]);
- }
- gray[0] = FXRGB2GRAY(reset_r, reset_g, reset_b);
- gray[1] = FXRGB2GRAY(set_r, set_g, set_b);
-
- for (int row = 0; row < height; row++) {
- uint8_t* dest_scan = dest_buf + row * dest_pitch;
- FXSYS_memset(dest_scan, gray[0], width);
- const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row);
- for (int col = src_left; col < src_left + width; col++) {
- if (src_scan[col / 8] & (1 << (7 - col % 8))) {
- *dest_scan = gray[1];
- }
- dest_scan++;
- }
- }
- return true;
-}
-
-bool ConvertBuffer_8bppPlt2Gray(uint8_t* dest_buf,
- int dest_pitch,
- int width,
- int height,
- const CFX_DIBSource* pSrcBitmap,
- int src_left,
- int src_top) {
- uint32_t* src_plt = pSrcBitmap->GetPalette();
- uint8_t gray[256];
- if (pSrcBitmap->IsCmykImage()) {
- uint8_t r;
- uint8_t g;
- uint8_t b;
- for (size_t i = 0; i < FX_ArraySize(gray); i++) {
- AdobeCMYK_to_sRGB1(
- FXSYS_GetCValue(src_plt[i]), FXSYS_GetMValue(src_plt[i]),
- FXSYS_GetYValue(src_plt[i]), FXSYS_GetKValue(src_plt[i]), r, g, b);
- gray[i] = FXRGB2GRAY(r, g, b);
- }
- } else {
- for (size_t i = 0; i < FX_ArraySize(gray); i++) {
- gray[i] = FXRGB2GRAY(FXARGB_R(src_plt[i]), FXARGB_G(src_plt[i]),
- FXARGB_B(src_plt[i]));
- }
- }
-
- for (int row = 0; row < height; row++) {
- uint8_t* dest_scan = dest_buf + row * dest_pitch;
- const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left;
- for (int col = 0; col < width; col++) {
- *dest_scan++ = gray[*src_scan++];
- }
- }
- return true;
-}
-
-bool ConvertBuffer_RgbOrCmyk2Gray(uint8_t* dest_buf,
- int dest_pitch,
- int width,
- int height,
- const CFX_DIBSource* pSrcBitmap,
- int src_left,
- int src_top) {
- int Bpp = pSrcBitmap->GetBPP() / 8;
- if (pSrcBitmap->IsCmykImage()) {
- for (int row = 0; row < height; row++) {
- uint8_t* dest_scan = dest_buf + row * dest_pitch;
- const uint8_t* src_scan =
- pSrcBitmap->GetScanline(src_top + row) + src_left * 4;
- for (int col = 0; col < width; col++) {
- uint8_t r, g, b;
- AdobeCMYK_to_sRGB1(FXSYS_GetCValue((uint32_t)src_scan[0]),
- FXSYS_GetMValue((uint32_t)src_scan[1]),
- FXSYS_GetYValue((uint32_t)src_scan[2]),
- FXSYS_GetKValue((uint32_t)src_scan[3]), r, g, b);
- *dest_scan++ = FXRGB2GRAY(r, g, b);
- src_scan += 4;
- }
- }
- } else {
- for (int row = 0; row < height; row++) {
- uint8_t* dest_scan = dest_buf + row * dest_pitch;
- const uint8_t* src_scan =
- pSrcBitmap->GetScanline(src_top + row) + src_left * Bpp;
- for (int col = 0; col < width; col++) {
- *dest_scan++ = FXRGB2GRAY(src_scan[2], src_scan[1], src_scan[0]);
- src_scan += Bpp;
- }
- }
- }
- return true;
-}
-
-void ConvertBuffer_IndexCopy(uint8_t* dest_buf,
- int dest_pitch,
- int width,
- int height,
- const CFX_DIBSource* pSrcBitmap,
- int src_left,
- int src_top) {
- if (pSrcBitmap->GetBPP() == 1) {
- for (int row = 0; row < height; row++) {
- uint8_t* dest_scan = dest_buf + row * dest_pitch;
- FXSYS_memset(dest_scan, 0, width);
- const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row);
- for (int col = src_left; col < src_left + width; col++) {
- if (src_scan[col / 8] & (1 << (7 - col % 8))) {
- *dest_scan = 1;
- }
- dest_scan++;
- }
- }
- } else {
- for (int row = 0; row < height; row++) {
- uint8_t* dest_scan = dest_buf + row * dest_pitch;
- const uint8_t* src_scan =
- pSrcBitmap->GetScanline(src_top + row) + src_left;
- FXSYS_memcpy(dest_scan, src_scan, width);
- }
- }
-}
-
-bool ConvertBuffer_Plt2PltRgb8(uint8_t* dest_buf,
- int dest_pitch,
- int width,
- int height,
- const CFX_DIBSource* pSrcBitmap,
- int src_left,
- int src_top,
- uint32_t* dst_plt) {
- ConvertBuffer_IndexCopy(dest_buf, dest_pitch, width, height, pSrcBitmap,
- src_left, src_top);
- uint32_t* src_plt = pSrcBitmap->GetPalette();
- int plt_size = pSrcBitmap->GetPaletteSize();
- if (pSrcBitmap->IsCmykImage()) {
- for (int i = 0; i < plt_size; i++) {
- uint8_t r;
- uint8_t g;
- uint8_t b;
- AdobeCMYK_to_sRGB1(
- FXSYS_GetCValue(src_plt[i]), FXSYS_GetMValue(src_plt[i]),
- FXSYS_GetYValue(src_plt[i]), FXSYS_GetKValue(src_plt[i]), r, g, b);
- dst_plt[i] = FXARGB_MAKE(0xff, r, g, b);
- }
- } else {
- FXSYS_memcpy(dst_plt, src_plt, plt_size * 4);
- }
- return true;
-}
-
-bool ConvertBuffer_Rgb2PltRgb8(uint8_t* dest_buf,
- int dest_pitch,
- int width,
- int height,
- const CFX_DIBSource* pSrcBitmap,
- int src_left,
- int src_top,
- uint32_t* dst_plt) {
- int bpp = pSrcBitmap->GetBPP() / 8;
- CFX_Palette palette;
- palette.BuildPalette(pSrcBitmap);
- uint32_t* cLut = palette.GetColorLut();
- uint32_t* aLut = palette.GetAmountLut();
- if (!cLut || !aLut) {
- return false;
- }
- int lut = palette.Getlut();
- uint32_t* pPalette = palette.GetPalette();
- if (lut > 256) {
- int err, min_err;
- int lut_256 = lut - 256;
- for (int row = 0; row < lut_256; row++) {
- min_err = 1000000;
- uint8_t r, g, b;
- _ColorDecode(cLut[row], r, g, b);
- int clrindex = 0;
- for (int col = 0; col < 256; col++) {
- uint32_t p_color = *(pPalette + col);
- int d_r = r - (uint8_t)(p_color >> 16);
- int d_g = g - (uint8_t)(p_color >> 8);
- int d_b = b - (uint8_t)(p_color);
- err = d_r * d_r + d_g * d_g + d_b * d_b;
- if (err < min_err) {
- min_err = err;
- clrindex = col;
- }
- }
- aLut[row] = clrindex;
- }
- }
- int32_t lut_1 = lut - 1;
- for (int row = 0; row < height; row++) {
- uint8_t* src_scan =
- (uint8_t*)pSrcBitmap->GetScanline(src_top + row) + src_left;
- uint8_t* dest_scan = dest_buf + row * dest_pitch;
- for (int col = 0; col < width; col++) {
- uint8_t* src_port = src_scan + col * bpp;
- int r = src_port[2] & 0xf0;
- int g = src_port[1] & 0xf0;
- int b = src_port[0] & 0xf0;
- uint32_t clrindex = (r << 4) + g + (b >> 4);
- for (int i = lut_1; i >= 0; i--)
- if (clrindex == cLut[i]) {
- *(dest_scan + col) = (uint8_t)(aLut[i]);
- break;
- }
- }
- }
- FXSYS_memcpy(dst_plt, pPalette, sizeof(uint32_t) * 256);
- return true;
-}
-
-bool ConvertBuffer_1bppMask2Rgb(FXDIB_Format dst_format,
- uint8_t* dest_buf,
- int dest_pitch,
- int width,
- int height,
- const CFX_DIBSource* pSrcBitmap,
- int src_left,
- int src_top) {
- int comps = (dst_format & 0xff) / 8;
- uint8_t set_gray, reset_gray;
- set_gray = 0xff;
- reset_gray = 0x00;
- for (int row = 0; row < height; row++) {
- uint8_t* dest_scan = dest_buf + row * dest_pitch;
- const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row);
- for (int col = src_left; col < src_left + width; col++) {
- if (src_scan[col / 8] & (1 << (7 - col % 8))) {
- dest_scan[0] = set_gray;
- dest_scan[1] = set_gray;
- dest_scan[2] = set_gray;
- } else {
- dest_scan[0] = reset_gray;
- dest_scan[1] = reset_gray;
- dest_scan[2] = reset_gray;
- }
- dest_scan += comps;
- }
- }
- return true;
-}
-
-bool ConvertBuffer_8bppMask2Rgb(FXDIB_Format dst_format,
- uint8_t* dest_buf,
- int dest_pitch,
- int width,
- int height,
- const CFX_DIBSource* pSrcBitmap,
- int src_left,
- int src_top) {
- int comps = (dst_format & 0xff) / 8;
- for (int row = 0; row < height; row++) {
- uint8_t* dest_scan = dest_buf + row * dest_pitch;
- const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left;
- uint8_t src_pixel;
- for (int col = 0; col < width; col++) {
- src_pixel = *src_scan++;
- *dest_scan++ = src_pixel;
- *dest_scan++ = src_pixel;
- *dest_scan = src_pixel;
- dest_scan += comps - 2;
- }
- }
- return true;
-}
-
-bool ConvertBuffer_1bppPlt2Rgb(FXDIB_Format dst_format,
- uint8_t* dest_buf,
- int dest_pitch,
- int width,
- int height,
- const CFX_DIBSource* pSrcBitmap,
- int src_left,
- int src_top) {
- int comps = (dst_format & 0xff) / 8;
- uint32_t* src_plt = pSrcBitmap->GetPalette();
- uint32_t plt[2];
- uint8_t* bgr_ptr = (uint8_t*)plt;
- if (pSrcBitmap->IsCmykImage()) {
- plt[0] = FXCMYK_TODIB(src_plt[0]);
- plt[1] = FXCMYK_TODIB(src_plt[1]);
- } else {
- bgr_ptr[0] = FXARGB_B(src_plt[0]);
- bgr_ptr[1] = FXARGB_G(src_plt[0]);
- bgr_ptr[2] = FXARGB_R(src_plt[0]);
- bgr_ptr[3] = FXARGB_B(src_plt[1]);
- bgr_ptr[4] = FXARGB_G(src_plt[1]);
- bgr_ptr[5] = FXARGB_R(src_plt[1]);
- }
-
- if (pSrcBitmap->IsCmykImage()) {
- AdobeCMYK_to_sRGB1(FXSYS_GetCValue(src_plt[0]), FXSYS_GetMValue(src_plt[0]),
- FXSYS_GetYValue(src_plt[0]), FXSYS_GetKValue(src_plt[0]),
- bgr_ptr[2], bgr_ptr[1], bgr_ptr[0]);
- AdobeCMYK_to_sRGB1(FXSYS_GetCValue(src_plt[1]), FXSYS_GetMValue(src_plt[1]),
- FXSYS_GetYValue(src_plt[1]), FXSYS_GetKValue(src_plt[1]),
- bgr_ptr[5], bgr_ptr[4], bgr_ptr[3]);
- }
-
- for (int row = 0; row < height; row++) {
- uint8_t* dest_scan = dest_buf + row * dest_pitch;
- const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row);
- for (int col = src_left; col < src_left + width; col++) {
- if (src_scan[col / 8] & (1 << (7 - col % 8))) {
- *dest_scan++ = bgr_ptr[3];
- *dest_scan++ = bgr_ptr[4];
- *dest_scan = bgr_ptr[5];
- } else {
- *dest_scan++ = bgr_ptr[0];
- *dest_scan++ = bgr_ptr[1];
- *dest_scan = bgr_ptr[2];
- }
- dest_scan += comps - 2;
- }
- }
- return true;
-}
-
-bool ConvertBuffer_8bppPlt2Rgb(FXDIB_Format dst_format,
- uint8_t* dest_buf,
- int dest_pitch,
- int width,
- int height,
- const CFX_DIBSource* pSrcBitmap,
- int src_left,
- int src_top) {
- int comps = (dst_format & 0xff) / 8;
- uint32_t* src_plt = pSrcBitmap->GetPalette();
- uint32_t plt[256];
- uint8_t* bgr_ptr = (uint8_t*)plt;
- if (!pSrcBitmap->IsCmykImage()) {
- for (int i = 0; i < 256; i++) {
- *bgr_ptr++ = FXARGB_B(src_plt[i]);
- *bgr_ptr++ = FXARGB_G(src_plt[i]);
- *bgr_ptr++ = FXARGB_R(src_plt[i]);
- }
- bgr_ptr = (uint8_t*)plt;
- }
-
- if (pSrcBitmap->IsCmykImage()) {
- for (int i = 0; i < 256; i++) {
- AdobeCMYK_to_sRGB1(
- FXSYS_GetCValue(src_plt[i]), FXSYS_GetMValue(src_plt[i]),
- FXSYS_GetYValue(src_plt[i]), FXSYS_GetKValue(src_plt[i]), bgr_ptr[2],
- bgr_ptr[1], bgr_ptr[0]);
- bgr_ptr += 3;
- }
- bgr_ptr = (uint8_t*)plt;
- }
-
- for (int row = 0; row < height; row++) {
- uint8_t* dest_scan = dest_buf + row * dest_pitch;
- const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left;
- for (int col = 0; col < width; col++) {
- uint8_t* src_pixel = bgr_ptr + 3 * (*src_scan++);
- *dest_scan++ = *src_pixel++;
- *dest_scan++ = *src_pixel++;
- *dest_scan = *src_pixel++;
- dest_scan += comps - 2;
- }
- }
- return true;
-}
-
-bool ConvertBuffer_24bppRgb2Rgb24(uint8_t* dest_buf,
- int dest_pitch,
- int width,
- int height,
- const CFX_DIBSource* pSrcBitmap,
- int src_left,
- int src_top) {
- for (int row = 0; row < height; row++) {
- uint8_t* dest_scan = dest_buf + row * dest_pitch;
- const uint8_t* src_scan =
- pSrcBitmap->GetScanline(src_top + row) + src_left * 3;
- FXSYS_memcpy(dest_scan, src_scan, width * 3);
- }
- return true;
-}
-
-bool ConvertBuffer_32bppRgb2Rgb24(uint8_t* dest_buf,
- int dest_pitch,
- int width,
- int height,
- const CFX_DIBSource* pSrcBitmap,
- int src_left,
- int src_top) {
- for (int row = 0; row < height; row++) {
- uint8_t* dest_scan = dest_buf + row * dest_pitch;
- const uint8_t* src_scan =
- pSrcBitmap->GetScanline(src_top + row) + src_left * 4;
- for (int col = 0; col < width; col++) {
- *dest_scan++ = *src_scan++;
- *dest_scan++ = *src_scan++;
- *dest_scan++ = *src_scan++;
- src_scan++;
- }
- }
- return true;
-}
-
-bool ConvertBuffer_Rgb2Rgb32(uint8_t* dest_buf,
- int dest_pitch,
- int width,
- int height,
- const CFX_DIBSource* pSrcBitmap,
- int src_left,
- int src_top) {
- int comps = pSrcBitmap->GetBPP() / 8;
- for (int row = 0; row < height; row++) {
- uint8_t* dest_scan = dest_buf + row * dest_pitch;
- const uint8_t* src_scan =
- pSrcBitmap->GetScanline(src_top + row) + src_left * comps;
- for (int col = 0; col < width; col++) {
- *dest_scan++ = *src_scan++;
- *dest_scan++ = *src_scan++;
- *dest_scan++ = *src_scan++;
- dest_scan++;
- src_scan += comps - 3;
- }
- }
- return true;
-}
-
-bool ConvertBuffer_32bppCmyk2Rgb32(uint8_t* dest_buf,
- int dest_pitch,
- int width,
- int height,
- const CFX_DIBSource* pSrcBitmap,
- int src_left,
- int src_top) {
- for (int row = 0; row < height; row++) {
- uint8_t* dest_scan = dest_buf + row * dest_pitch;
- const uint8_t* src_scan =
- pSrcBitmap->GetScanline(src_top + row) + src_left * 4;
- for (int col = 0; col < width; col++) {
- AdobeCMYK_to_sRGB1(src_scan[0], src_scan[1], src_scan[2], src_scan[3],
- dest_scan[2], dest_scan[1], dest_scan[0]);
- dest_scan += 4;
- src_scan += 4;
- }
- }
- return true;
-}
-
-bool ConvertBuffer(FXDIB_Format dest_format,
- uint8_t* dest_buf,
- int dest_pitch,
- int width,
- int height,
- const CFX_DIBSource* pSrcBitmap,
- int src_left,
- int src_top,
- std::unique_ptr<uint32_t, FxFreeDeleter>* p_pal) {
- FXDIB_Format src_format = pSrcBitmap->GetFormat();
- switch (dest_format) {
- case FXDIB_Invalid:
- case FXDIB_1bppCmyk:
- case FXDIB_1bppMask:
- case FXDIB_1bppRgb:
- ASSERT(false);
- return false;
- case FXDIB_8bppMask: {
- if ((src_format & 0xff) == 1) {
- if (pSrcBitmap->GetPalette()) {
- return ConvertBuffer_1bppPlt2Gray(dest_buf, dest_pitch, width, height,
- pSrcBitmap, src_left, src_top);
- }
- return ConvertBuffer_1bppMask2Gray(dest_buf, dest_pitch, width, height,
- pSrcBitmap, src_left, src_top);
- }
- if ((src_format & 0xff) == 8) {
- if (pSrcBitmap->GetPalette()) {
- return ConvertBuffer_8bppPlt2Gray(dest_buf, dest_pitch, width, height,
- pSrcBitmap, src_left, src_top);
- }
- return ConvertBuffer_8bppMask2Gray(dest_buf, dest_pitch, width, height,
- pSrcBitmap, src_left, src_top);
- }
- if ((src_format & 0xff) >= 24) {
- return ConvertBuffer_RgbOrCmyk2Gray(dest_buf, dest_pitch, width, height,
- pSrcBitmap, src_left, src_top);
- }
- return false;
- }
- case FXDIB_8bppRgb:
- case FXDIB_8bppRgba: {
- if ((src_format & 0xff) == 8 && !pSrcBitmap->GetPalette()) {
- return ConvertBuffer(FXDIB_8bppMask, dest_buf, dest_pitch, width,
- height, pSrcBitmap, src_left, src_top, p_pal);
- }
- p_pal->reset(FX_Alloc(uint32_t, 256));
- if (((src_format & 0xff) == 1 || (src_format & 0xff) == 8) &&
- pSrcBitmap->GetPalette()) {
- return ConvertBuffer_Plt2PltRgb8(dest_buf, dest_pitch, width, height,
- pSrcBitmap, src_left, src_top,
- p_pal->get());
- }
- if ((src_format & 0xff) >= 24) {
- return ConvertBuffer_Rgb2PltRgb8(dest_buf, dest_pitch, width, height,
- pSrcBitmap, src_left, src_top,
- p_pal->get());
- }
- return false;
- }
- case FXDIB_Rgb:
- case FXDIB_Rgba: {
- if ((src_format & 0xff) == 1) {
- if (pSrcBitmap->GetPalette()) {
- return ConvertBuffer_1bppPlt2Rgb(dest_format, dest_buf, dest_pitch,
- width, height, pSrcBitmap, src_left,
- src_top);
- }
- return ConvertBuffer_1bppMask2Rgb(dest_format, dest_buf, dest_pitch,
- width, height, pSrcBitmap, src_left,
- src_top);
- }
- if ((src_format & 0xff) == 8) {
- if (pSrcBitmap->GetPalette()) {
- return ConvertBuffer_8bppPlt2Rgb(dest_format, dest_buf, dest_pitch,
- width, height, pSrcBitmap, src_left,
- src_top);
- }
- return ConvertBuffer_8bppMask2Rgb(dest_format, dest_buf, dest_pitch,
- width, height, pSrcBitmap, src_left,
- src_top);
- }
- if ((src_format & 0xff) == 24) {
- return ConvertBuffer_24bppRgb2Rgb24(dest_buf, dest_pitch, width, height,
- pSrcBitmap, src_left, src_top);
- }
- if ((src_format & 0xff) == 32) {
- return ConvertBuffer_32bppRgb2Rgb24(dest_buf, dest_pitch, width, height,
- pSrcBitmap, src_left, src_top);
- }
- return false;
- }
- case FXDIB_Argb:
- case FXDIB_Rgb32: {
- if ((src_format & 0xff) == 1) {
- if (pSrcBitmap->GetPalette()) {
- return ConvertBuffer_1bppPlt2Rgb(dest_format, dest_buf, dest_pitch,
- width, height, pSrcBitmap, src_left,
- src_top);
- }
- return ConvertBuffer_1bppMask2Rgb(dest_format, dest_buf, dest_pitch,
- width, height, pSrcBitmap, src_left,
- src_top);
- }
- if ((src_format & 0xff) == 8) {
- if (pSrcBitmap->GetPalette()) {
- return ConvertBuffer_8bppPlt2Rgb(dest_format, dest_buf, dest_pitch,
- width, height, pSrcBitmap, src_left,
- src_top);
- }
- return ConvertBuffer_8bppMask2Rgb(dest_format, dest_buf, dest_pitch,
- width, height, pSrcBitmap, src_left,
- src_top);
- }
- if ((src_format & 0xff) >= 24) {
- if (src_format & 0x0400) {
- return ConvertBuffer_32bppCmyk2Rgb32(dest_buf, dest_pitch, width,
- height, pSrcBitmap, src_left,
- src_top);
- }
- return ConvertBuffer_Rgb2Rgb32(dest_buf, dest_pitch, width, height,
- pSrcBitmap, src_left, src_top);
- }
- return false;
- }
- default:
- return false;
- }
-}
-
-std::unique_ptr<CFX_DIBitmap> CFX_DIBSource::CloneConvert(
- FXDIB_Format dest_format) const {
- if (dest_format == GetFormat())
- return Clone(nullptr);
-
- std::unique_ptr<CFX_DIBitmap> pClone = pdfium::MakeUnique<CFX_DIBitmap>();
- if (!pClone->Create(m_Width, m_Height, dest_format))
- return nullptr;
-
- CFX_MaybeOwned<CFX_DIBitmap> pSrcAlpha;
- if (HasAlpha()) {
- if (GetFormat() == FXDIB_Argb)
- pSrcAlpha = CloneAlphaMask();
- else
- pSrcAlpha = m_pAlphaMask;
-
- if (!pSrcAlpha)
- return nullptr;
- }
- bool ret = true;
- if (dest_format & 0x0200) {
- if (dest_format == FXDIB_Argb) {
- ret = pSrcAlpha
- ? pClone->LoadChannel(FXDIB_Alpha, pSrcAlpha.Get(), FXDIB_Alpha)
- : pClone->LoadChannel(FXDIB_Alpha, 0xff);
- } else {
- ret = pClone->SetAlphaMask(pSrcAlpha.Get());
- }
- }
- if (!ret)
- return nullptr;
-
- std::unique_ptr<uint32_t, FxFreeDeleter> pal_8bpp;
- if (!ConvertBuffer(dest_format, pClone->GetBuffer(), pClone->GetPitch(),
- m_Width, m_Height, this, 0, 0, &pal_8bpp)) {
- return nullptr;
- }
- if (pal_8bpp)
- pClone->SetPalette(pal_8bpp.get());
-
- return pClone;
-}
-
-bool CFX_DIBitmap::ConvertFormat(FXDIB_Format dest_format) {
- FXDIB_Format src_format = GetFormat();
- if (dest_format == src_format)
- return true;
-
- if (dest_format == FXDIB_8bppMask && src_format == FXDIB_8bppRgb &&
- !m_pPalette) {
- m_AlphaFlag = 1;
- return true;
- }
- if (dest_format == FXDIB_Argb && src_format == FXDIB_Rgb32) {
- m_AlphaFlag = 2;
- for (int row = 0; row < m_Height; row++) {
- uint8_t* scanline = m_pBuffer + row * m_Pitch + 3;
- for (int col = 0; col < m_Width; col++) {
- *scanline = 0xff;
- scanline += 4;
- }
- }
- return true;
- }
- int dest_bpp = dest_format & 0xff;
- int dest_pitch = (dest_bpp * m_Width + 31) / 32 * 4;
- uint8_t* dest_buf = FX_TryAlloc(uint8_t, dest_pitch * m_Height + 4);
- if (!dest_buf) {
- return false;
- }
- CFX_DIBitmap* pAlphaMask = nullptr;
- if (dest_format == FXDIB_Argb) {
- FXSYS_memset(dest_buf, 0xff, dest_pitch * m_Height + 4);
- if (m_pAlphaMask) {
- for (int row = 0; row < m_Height; row++) {
- uint8_t* pDstScanline = dest_buf + row * dest_pitch + 3;
- const uint8_t* pSrcScanline = m_pAlphaMask->GetScanline(row);
- for (int col = 0; col < m_Width; col++) {
- *pDstScanline = *pSrcScanline++;
- pDstScanline += 4;
- }
- }
- }
- } else if (dest_format & 0x0200) {
- if (src_format == FXDIB_Argb) {
- pAlphaMask = CloneAlphaMask().release();
- if (!pAlphaMask) {
- FX_Free(dest_buf);
- return false;
- }
- } else {
- if (!m_pAlphaMask) {
- if (!BuildAlphaMask()) {
- FX_Free(dest_buf);
- return false;
- }
- pAlphaMask = m_pAlphaMask;
- m_pAlphaMask = nullptr;
- } else {
- pAlphaMask = m_pAlphaMask;
- }
- }
- }
- bool ret = false;
- std::unique_ptr<uint32_t, FxFreeDeleter> pal_8bpp;
- ret = ConvertBuffer(dest_format, dest_buf, dest_pitch, m_Width, m_Height,
- this, 0, 0, &pal_8bpp);
- if (!ret) {
- if (pAlphaMask != m_pAlphaMask)
- delete pAlphaMask;
- FX_Free(dest_buf);
- return false;
- }
- if (m_pAlphaMask && pAlphaMask != m_pAlphaMask)
- delete m_pAlphaMask;
- m_pAlphaMask = pAlphaMask;
- m_pPalette = std::move(pal_8bpp);
- if (!m_bExtBuf)
- FX_Free(m_pBuffer);
- m_bExtBuf = false;
- m_pBuffer = dest_buf;
- m_bpp = (uint8_t)dest_format;
- m_AlphaFlag = (uint8_t)(dest_format >> 8);
- m_Pitch = dest_pitch;
- return true;
-}
diff --git a/chromium/third_party/pdfium/core/fxge/dib/fx_dib_engine.cpp b/chromium/third_party/pdfium/core/fxge/dib/fx_dib_engine.cpp
deleted file mode 100644
index c004aac538d..00000000000
--- a/chromium/third_party/pdfium/core/fxge/dib/fx_dib_engine.cpp
+++ /dev/null
@@ -1,1007 +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
-
-#include <limits.h>
-
-#include <algorithm>
-
-#include "core/fxge/dib/dib_int.h"
-#include "core/fxge/fx_dib.h"
-#include "third_party/base/ptr_util.h"
-
-namespace {
-
-bool SourceSizeWithinLimit(int width, int height) {
- const int kMaxProgressiveStretchPixels = 1000000;
- return !height || width < kMaxProgressiveStretchPixels / height;
-}
-
-FXDIB_Format GetStretchedFormat(const CFX_DIBSource& src) {
- FXDIB_Format format = src.GetFormat();
- if (format == FXDIB_1bppMask)
- return FXDIB_8bppMask;
- if (format == FXDIB_1bppRgb)
- return FXDIB_8bppRgb;
- if (format == FXDIB_8bppRgb && src.GetPalette())
- return FXDIB_Rgb;
- return format;
-}
-
-} // namespace
-
-CWeightTable::CWeightTable()
- : m_DestMin(0),
- m_ItemSize(0),
- m_pWeightTables(nullptr),
- m_dwWeightTablesSize(0) {}
-
-CWeightTable::~CWeightTable() {
- FX_Free(m_pWeightTables);
-}
-
-size_t CWeightTable::GetPixelWeightSize() const {
- return m_ItemSize / sizeof(int) - 2;
-}
-
-bool CWeightTable::Calc(int dest_len,
- int dest_min,
- int dest_max,
- int src_len,
- int src_min,
- int src_max,
- int flags) {
- FX_Free(m_pWeightTables);
- m_pWeightTables = nullptr;
- m_dwWeightTablesSize = 0;
- const double scale = (FX_FLOAT)src_len / (FX_FLOAT)dest_len;
- const double base = dest_len < 0 ? (FX_FLOAT)(src_len) : 0;
- const int ext_size = flags & FXDIB_BICUBIC_INTERPOL ? 3 : 1;
- m_ItemSize =
- sizeof(int) * 2 +
- (int)(sizeof(int) * (FXSYS_ceil(FXSYS_fabs((FX_FLOAT)scale)) + ext_size));
- m_DestMin = dest_min;
- if ((dest_max - dest_min) > (int)((1U << 30) - 4) / m_ItemSize)
- return false;
-
- m_dwWeightTablesSize = (dest_max - dest_min) * m_ItemSize + 4;
- m_pWeightTables = FX_TryAlloc(uint8_t, m_dwWeightTablesSize);
- if (!m_pWeightTables)
- return false;
-
- if ((flags & FXDIB_NOSMOOTH) != 0 || FXSYS_fabs((FX_FLOAT)scale) < 1.0f) {
- for (int dest_pixel = dest_min; dest_pixel < dest_max; dest_pixel++) {
- PixelWeight& pixel_weights = *GetPixelWeight(dest_pixel);
- double src_pos = dest_pixel * scale + scale / 2 + base;
- if (flags & FXDIB_INTERPOL) {
- pixel_weights.m_SrcStart =
- (int)FXSYS_floor((FX_FLOAT)src_pos - 1.0f / 2);
- pixel_weights.m_SrcEnd = (int)FXSYS_floor((FX_FLOAT)src_pos + 1.0f / 2);
- if (pixel_weights.m_SrcStart < src_min) {
- pixel_weights.m_SrcStart = src_min;
- }
- if (pixel_weights.m_SrcEnd >= src_max) {
- pixel_weights.m_SrcEnd = src_max - 1;
- }
- if (pixel_weights.m_SrcStart == pixel_weights.m_SrcEnd) {
- pixel_weights.m_Weights[0] = 65536;
- } else {
- pixel_weights.m_Weights[1] = FXSYS_round(
- (FX_FLOAT)(src_pos - pixel_weights.m_SrcStart - 1.0f / 2) *
- 65536);
- pixel_weights.m_Weights[0] = 65536 - pixel_weights.m_Weights[1];
- }
- } else if (flags & FXDIB_BICUBIC_INTERPOL) {
- pixel_weights.m_SrcStart =
- (int)FXSYS_floor((FX_FLOAT)src_pos - 1.0f / 2);
- pixel_weights.m_SrcEnd = (int)FXSYS_floor((FX_FLOAT)src_pos + 1.0f / 2);
- int start = pixel_weights.m_SrcStart - 1;
- int end = pixel_weights.m_SrcEnd + 1;
- if (start < src_min) {
- start = src_min;
- }
- if (end >= src_max) {
- end = src_max - 1;
- }
- if (pixel_weights.m_SrcStart < src_min) {
- src_pos += src_min - pixel_weights.m_SrcStart;
- pixel_weights.m_SrcStart = src_min;
- }
- if (pixel_weights.m_SrcEnd >= src_max) {
- pixel_weights.m_SrcEnd = src_max - 1;
- }
- int weight;
- weight = FXSYS_round(
- (FX_FLOAT)(src_pos - pixel_weights.m_SrcStart - 1.0f / 2) * 256);
- if (start == end) {
- pixel_weights.m_Weights[0] =
- (SDP_Table[256 + weight] + SDP_Table[weight] +
- SDP_Table[256 - weight] + SDP_Table[512 - weight])
- << 8;
- } else if ((start == pixel_weights.m_SrcStart &&
- (pixel_weights.m_SrcStart == pixel_weights.m_SrcEnd ||
- end == pixel_weights.m_SrcEnd) &&
- start < end) ||
- (start < pixel_weights.m_SrcStart &&
- pixel_weights.m_SrcStart == pixel_weights.m_SrcEnd &&
- end == pixel_weights.m_SrcEnd)) {
- if (start < pixel_weights.m_SrcStart) {
- pixel_weights.m_Weights[0] = SDP_Table[256 + weight] << 8;
- pixel_weights.m_Weights[1] =
- (SDP_Table[weight] + SDP_Table[256 - weight] +
- SDP_Table[512 - weight])
- << 8;
- } else {
- if (pixel_weights.m_SrcStart == pixel_weights.m_SrcEnd) {
- pixel_weights.m_Weights[0] =
- (SDP_Table[256 + weight] + SDP_Table[weight] +
- SDP_Table[256 - weight])
- << 8;
- pixel_weights.m_Weights[1] = SDP_Table[512 - weight] << 8;
- } else {
- pixel_weights.m_Weights[0] =
- (SDP_Table[256 + weight] + SDP_Table[weight]) << 8;
- pixel_weights.m_Weights[1] =
- (SDP_Table[256 - weight] + SDP_Table[512 - weight]) << 8;
- }
- }
- if (pixel_weights.m_SrcStart == pixel_weights.m_SrcEnd) {
- pixel_weights.m_SrcEnd = end;
- }
- if (start < pixel_weights.m_SrcStart) {
- pixel_weights.m_SrcStart = start;
- }
- } else if (start == pixel_weights.m_SrcStart &&
- start < pixel_weights.m_SrcEnd &&
- pixel_weights.m_SrcEnd < end) {
- pixel_weights.m_Weights[0] =
- (SDP_Table[256 + weight] + SDP_Table[weight]) << 8;
- pixel_weights.m_Weights[1] = SDP_Table[256 - weight] << 8;
- pixel_weights.m_Weights[2] = SDP_Table[512 - weight] << 8;
- pixel_weights.m_SrcEnd = end;
- } else if (start < pixel_weights.m_SrcStart &&
- pixel_weights.m_SrcStart < pixel_weights.m_SrcEnd &&
- pixel_weights.m_SrcEnd == end) {
- pixel_weights.m_Weights[0] = SDP_Table[256 + weight] << 8;
- pixel_weights.m_Weights[1] = SDP_Table[weight] << 8;
- pixel_weights.m_Weights[2] =
- (SDP_Table[256 - weight] + SDP_Table[512 - weight]) << 8;
- pixel_weights.m_SrcStart = start;
- } else {
- pixel_weights.m_Weights[0] = SDP_Table[256 + weight] << 8;
- pixel_weights.m_Weights[1] = SDP_Table[weight] << 8;
- pixel_weights.m_Weights[2] = SDP_Table[256 - weight] << 8;
- pixel_weights.m_Weights[3] = SDP_Table[512 - weight] << 8;
- pixel_weights.m_SrcStart = start;
- pixel_weights.m_SrcEnd = end;
- }
- } else {
- pixel_weights.m_SrcStart = pixel_weights.m_SrcEnd =
- (int)FXSYS_floor((FX_FLOAT)src_pos);
- if (pixel_weights.m_SrcStart < src_min) {
- pixel_weights.m_SrcStart = src_min;
- }
- if (pixel_weights.m_SrcEnd >= src_max) {
- pixel_weights.m_SrcEnd = src_max - 1;
- }
- pixel_weights.m_Weights[0] = 65536;
- }
- }
- return true;
- }
-
- for (int dest_pixel = dest_min; dest_pixel < dest_max; dest_pixel++) {
- PixelWeight& pixel_weights = *GetPixelWeight(dest_pixel);
- double src_start = dest_pixel * scale + base;
- double src_end = src_start + scale;
- int start_i, end_i;
- if (src_start < src_end) {
- start_i = (int)FXSYS_floor((FX_FLOAT)src_start);
- end_i = (int)FXSYS_ceil((FX_FLOAT)src_end);
- } else {
- start_i = (int)FXSYS_floor((FX_FLOAT)src_end);
- end_i = (int)FXSYS_ceil((FX_FLOAT)src_start);
- }
- if (start_i < src_min) {
- start_i = src_min;
- }
- if (end_i >= src_max) {
- end_i = src_max - 1;
- }
- if (start_i > end_i) {
- if (start_i >= src_max) {
- start_i = src_max - 1;
- }
- pixel_weights.m_SrcStart = start_i;
- pixel_weights.m_SrcEnd = start_i;
- continue;
- }
- pixel_weights.m_SrcStart = start_i;
- pixel_weights.m_SrcEnd = end_i;
- for (int j = start_i; j <= end_i; j++) {
- double dest_start = ((FX_FLOAT)j - base) / scale;
- double dest_end = ((FX_FLOAT)(j + 1) - base) / scale;
- if (dest_start > dest_end) {
- double temp = dest_start;
- dest_start = dest_end;
- dest_end = temp;
- }
- double area_start = dest_start > (FX_FLOAT)(dest_pixel)
- ? dest_start
- : (FX_FLOAT)(dest_pixel);
- double area_end = dest_end > (FX_FLOAT)(dest_pixel + 1)
- ? (FX_FLOAT)(dest_pixel + 1)
- : dest_end;
- double weight = area_start >= area_end ? 0.0f : area_end - area_start;
- if (weight == 0 && j == end_i) {
- pixel_weights.m_SrcEnd--;
- break;
- }
- size_t idx = j - start_i;
- if (idx >= GetPixelWeightSize())
- return false;
- pixel_weights.m_Weights[idx] = FXSYS_round((FX_FLOAT)(weight * 65536));
- }
- }
- return true;
-}
-
-PixelWeight* CWeightTable::GetPixelWeight(int pixel) const {
- ASSERT(pixel >= m_DestMin);
- return reinterpret_cast<PixelWeight*>(m_pWeightTables +
- (pixel - m_DestMin) * m_ItemSize);
-}
-
-int* CWeightTable::GetValueFromPixelWeight(PixelWeight* pWeight,
- int index) const {
- if (index < pWeight->m_SrcStart)
- return nullptr;
-
- size_t idx = index - pWeight->m_SrcStart;
- return idx < GetPixelWeightSize() ? &pWeight->m_Weights[idx] : nullptr;
-}
-
-CStretchEngine::CStretchEngine(IFX_ScanlineComposer* pDestBitmap,
- FXDIB_Format dest_format,
- int dest_width,
- int dest_height,
- const FX_RECT& clip_rect,
- const CFX_DIBSource* pSrcBitmap,
- int flags) {
- m_State = 0;
- m_DestFormat = dest_format;
- m_DestBpp = dest_format & 0xff;
- m_SrcBpp = pSrcBitmap->GetFormat() & 0xff;
- m_bHasAlpha = pSrcBitmap->GetFormat() & 0x200;
- m_pSrcPalette = pSrcBitmap->GetPalette();
- m_pDestBitmap = pDestBitmap;
- m_DestWidth = dest_width;
- m_DestHeight = dest_height;
- m_pInterBuf = nullptr;
- m_pExtraAlphaBuf = nullptr;
- m_pDestMaskScanline = nullptr;
- m_DestClip = clip_rect;
- uint32_t size = clip_rect.Width();
- if (size && m_DestBpp > (int)(INT_MAX / size)) {
- return;
- }
- size *= m_DestBpp;
- if (size > INT_MAX - 31) {
- return;
- }
- size += 31;
- size = size / 32 * 4;
- m_pDestScanline = FX_TryAlloc(uint8_t, size);
- if (!m_pDestScanline) {
- return;
- }
- if (dest_format == FXDIB_Rgb32) {
- FXSYS_memset(m_pDestScanline, 255, size);
- }
- m_InterPitch = (m_DestClip.Width() * m_DestBpp + 31) / 32 * 4;
- m_ExtraMaskPitch = (m_DestClip.Width() * 8 + 31) / 32 * 4;
- m_pInterBuf = nullptr;
- m_pSource = pSrcBitmap;
- m_SrcWidth = pSrcBitmap->GetWidth();
- m_SrcHeight = pSrcBitmap->GetHeight();
- m_SrcPitch = (m_SrcWidth * m_SrcBpp + 31) / 32 * 4;
- if ((flags & FXDIB_NOSMOOTH) == 0) {
- bool bInterpol = flags & FXDIB_INTERPOL || flags & FXDIB_BICUBIC_INTERPOL;
- if (!bInterpol && FXSYS_abs(dest_width) != 0 &&
- FXSYS_abs(dest_height) / 8 < static_cast<long long>(m_SrcWidth) *
- m_SrcHeight / FXSYS_abs(dest_width)) {
- flags = FXDIB_INTERPOL;
- }
- m_Flags = flags;
- } else {
- m_Flags = FXDIB_NOSMOOTH;
- if (flags & FXDIB_DOWNSAMPLE) {
- m_Flags |= FXDIB_DOWNSAMPLE;
- }
- }
- double scale_x = (FX_FLOAT)m_SrcWidth / (FX_FLOAT)m_DestWidth;
- double scale_y = (FX_FLOAT)m_SrcHeight / (FX_FLOAT)m_DestHeight;
- double base_x = m_DestWidth > 0 ? 0.0f : (FX_FLOAT)(m_DestWidth);
- double base_y = m_DestHeight > 0 ? 0.0f : (FX_FLOAT)(m_DestHeight);
- double src_left = scale_x * ((FX_FLOAT)(clip_rect.left) + base_x);
- double src_right = scale_x * ((FX_FLOAT)(clip_rect.right) + base_x);
- double src_top = scale_y * ((FX_FLOAT)(clip_rect.top) + base_y);
- double src_bottom = scale_y * ((FX_FLOAT)(clip_rect.bottom) + base_y);
- if (src_left > src_right) {
- double temp = src_left;
- src_left = src_right;
- src_right = temp;
- }
- if (src_top > src_bottom) {
- double temp = src_top;
- src_top = src_bottom;
- src_bottom = temp;
- }
- m_SrcClip.left = (int)FXSYS_floor((FX_FLOAT)src_left);
- m_SrcClip.right = (int)FXSYS_ceil((FX_FLOAT)src_right);
- m_SrcClip.top = (int)FXSYS_floor((FX_FLOAT)src_top);
- m_SrcClip.bottom = (int)FXSYS_ceil((FX_FLOAT)src_bottom);
- FX_RECT src_rect(0, 0, m_SrcWidth, m_SrcHeight);
- m_SrcClip.Intersect(src_rect);
- if (m_SrcBpp == 1) {
- if (m_DestBpp == 8) {
- m_TransMethod = 1;
- } else {
- m_TransMethod = 2;
- }
- } else if (m_SrcBpp == 8) {
- if (m_DestBpp == 8) {
- if (!m_bHasAlpha) {
- m_TransMethod = 3;
- } else {
- m_TransMethod = 4;
- }
- } else {
- if (!m_bHasAlpha) {
- m_TransMethod = 5;
- } else {
- m_TransMethod = 6;
- }
- }
- } else {
- if (!m_bHasAlpha) {
- m_TransMethod = 7;
- } else {
- m_TransMethod = 8;
- }
- }
-}
-
-CStretchEngine::~CStretchEngine() {
- FX_Free(m_pDestScanline);
- FX_Free(m_pInterBuf);
- FX_Free(m_pExtraAlphaBuf);
- FX_Free(m_pDestMaskScanline);
-}
-
-bool CStretchEngine::Continue(IFX_Pause* pPause) {
- while (m_State == 1) {
- if (ContinueStretchHorz(pPause)) {
- return true;
- }
- m_State = 2;
- StretchVert();
- }
- return false;
-}
-
-bool CStretchEngine::StartStretchHorz() {
- if (m_DestWidth == 0 || m_InterPitch == 0 || !m_pDestScanline)
- return false;
-
- if (m_SrcClip.Height() == 0 ||
- m_SrcClip.Height() > (1 << 29) / m_InterPitch) {
- return false;
- }
-
- m_pInterBuf = FX_TryAlloc(unsigned char, m_SrcClip.Height() * m_InterPitch);
- if (!m_pInterBuf)
- return false;
-
- if (m_pSource && m_bHasAlpha && m_pSource->m_pAlphaMask) {
- m_pExtraAlphaBuf =
- FX_Alloc2D(unsigned char, m_SrcClip.Height(), m_ExtraMaskPitch);
- uint32_t size = (m_DestClip.Width() * 8 + 31) / 32 * 4;
- m_pDestMaskScanline = FX_TryAlloc(unsigned char, size);
- if (!m_pDestMaskScanline)
- return false;
- }
- bool ret =
- m_WeightTable.Calc(m_DestWidth, m_DestClip.left, m_DestClip.right,
- m_SrcWidth, m_SrcClip.left, m_SrcClip.right, m_Flags);
- if (!ret)
- return false;
-
- m_CurRow = m_SrcClip.top;
- m_State = 1;
- return true;
-}
-
-bool CStretchEngine::ContinueStretchHorz(IFX_Pause* pPause) {
- if (!m_DestWidth)
- return false;
-
- if (m_pSource->SkipToScanline(m_CurRow, pPause))
- return true;
-
- int Bpp = m_DestBpp / 8;
- static const int kStrechPauseRows = 10;
- int rows_to_go = kStrechPauseRows;
- for (; m_CurRow < m_SrcClip.bottom; m_CurRow++) {
- if (rows_to_go == 0) {
- if (pPause && pPause->NeedToPauseNow())
- return true;
-
- rows_to_go = kStrechPauseRows;
- }
-
- const uint8_t* src_scan = m_pSource->GetScanline(m_CurRow);
- uint8_t* dest_scan =
- m_pInterBuf + (m_CurRow - m_SrcClip.top) * m_InterPitch;
- const uint8_t* src_scan_mask = nullptr;
- uint8_t* dest_scan_mask = nullptr;
- if (m_pExtraAlphaBuf) {
- src_scan_mask = m_pSource->m_pAlphaMask->GetScanline(m_CurRow);
- dest_scan_mask =
- m_pExtraAlphaBuf + (m_CurRow - m_SrcClip.top) * m_ExtraMaskPitch;
- }
- switch (m_TransMethod) {
- case 1:
- case 2: {
- for (int col = m_DestClip.left; col < m_DestClip.right; col++) {
- PixelWeight* pPixelWeights = m_WeightTable.GetPixelWeight(col);
- int dest_a = 0;
- for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd;
- j++) {
- int* pWeight =
- m_WeightTable.GetValueFromPixelWeight(pPixelWeights, j);
- if (!pWeight)
- return false;
-
- int pixel_weight = *pWeight;
- if (src_scan[j / 8] & (1 << (7 - j % 8))) {
- dest_a += pixel_weight * 255;
- }
- }
- if (m_Flags & FXDIB_BICUBIC_INTERPOL) {
- dest_a = dest_a < 0 ? 0 : dest_a > 16711680 ? 16711680 : dest_a;
- }
- *dest_scan++ = (uint8_t)(dest_a >> 16);
- }
- break;
- }
- case 3: {
- for (int col = m_DestClip.left; col < m_DestClip.right; col++) {
- PixelWeight* pPixelWeights = m_WeightTable.GetPixelWeight(col);
- int dest_a = 0;
- for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd;
- j++) {
- int* pWeight =
- m_WeightTable.GetValueFromPixelWeight(pPixelWeights, j);
- if (!pWeight)
- return false;
-
- int pixel_weight = *pWeight;
- dest_a += pixel_weight * src_scan[j];
- }
- if (m_Flags & FXDIB_BICUBIC_INTERPOL) {
- dest_a = dest_a < 0 ? 0 : dest_a > 16711680 ? 16711680 : dest_a;
- }
- *dest_scan++ = (uint8_t)(dest_a >> 16);
- }
- break;
- }
- case 4: {
- for (int col = m_DestClip.left; col < m_DestClip.right; col++) {
- PixelWeight* pPixelWeights = m_WeightTable.GetPixelWeight(col);
- int dest_a = 0, dest_r = 0;
- for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd;
- j++) {
- int* pWeight =
- m_WeightTable.GetValueFromPixelWeight(pPixelWeights, j);
- if (!pWeight)
- return false;
-
- int pixel_weight = *pWeight;
- pixel_weight = pixel_weight * src_scan_mask[j] / 255;
- dest_r += pixel_weight * src_scan[j];
- dest_a += pixel_weight;
- }
- if (m_Flags & FXDIB_BICUBIC_INTERPOL) {
- dest_r = dest_r < 0 ? 0 : dest_r > 16711680 ? 16711680 : dest_r;
- dest_a = dest_a < 0 ? 0 : dest_a > 65536 ? 65536 : dest_a;
- }
- *dest_scan++ = (uint8_t)(dest_r >> 16);
- *dest_scan_mask++ = (uint8_t)((dest_a * 255) >> 16);
- }
- break;
- }
- case 5: {
- for (int col = m_DestClip.left; col < m_DestClip.right; col++) {
- PixelWeight* pPixelWeights = m_WeightTable.GetPixelWeight(col);
- int dest_r_y = 0, dest_g_m = 0, dest_b_c = 0;
- for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd;
- j++) {
- int* pWeight =
- m_WeightTable.GetValueFromPixelWeight(pPixelWeights, j);
- if (!pWeight)
- return false;
-
- int pixel_weight = *pWeight;
- unsigned long argb_cmyk = m_pSrcPalette[src_scan[j]];
- if (m_DestFormat == FXDIB_Rgb) {
- dest_r_y += pixel_weight * (uint8_t)(argb_cmyk >> 16);
- dest_g_m += pixel_weight * (uint8_t)(argb_cmyk >> 8);
- dest_b_c += pixel_weight * (uint8_t)argb_cmyk;
- } else {
- dest_b_c += pixel_weight * (uint8_t)(argb_cmyk >> 24);
- dest_g_m += pixel_weight * (uint8_t)(argb_cmyk >> 16);
- dest_r_y += pixel_weight * (uint8_t)(argb_cmyk >> 8);
- }
- }
- if (m_Flags & FXDIB_BICUBIC_INTERPOL) {
- dest_r_y =
- dest_r_y < 0 ? 0 : dest_r_y > 16711680 ? 16711680 : dest_r_y;
- dest_g_m =
- dest_g_m < 0 ? 0 : dest_g_m > 16711680 ? 16711680 : dest_g_m;
- dest_b_c =
- dest_b_c < 0 ? 0 : dest_b_c > 16711680 ? 16711680 : dest_b_c;
- }
- *dest_scan++ = (uint8_t)(dest_b_c >> 16);
- *dest_scan++ = (uint8_t)(dest_g_m >> 16);
- *dest_scan++ = (uint8_t)(dest_r_y >> 16);
- }
- break;
- }
- case 6: {
- for (int col = m_DestClip.left; col < m_DestClip.right; col++) {
- PixelWeight* pPixelWeights = m_WeightTable.GetPixelWeight(col);
- int dest_a = 0, dest_r_y = 0, dest_g_m = 0, dest_b_c = 0;
- for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd;
- j++) {
- int* pWeight =
- m_WeightTable.GetValueFromPixelWeight(pPixelWeights, j);
- if (!pWeight)
- return false;
-
- int pixel_weight = *pWeight;
- pixel_weight = pixel_weight * src_scan_mask[j] / 255;
- unsigned long argb_cmyk = m_pSrcPalette[src_scan[j]];
- if (m_DestFormat == FXDIB_Rgba) {
- dest_r_y += pixel_weight * (uint8_t)(argb_cmyk >> 16);
- dest_g_m += pixel_weight * (uint8_t)(argb_cmyk >> 8);
- dest_b_c += pixel_weight * (uint8_t)argb_cmyk;
- } else {
- dest_b_c += pixel_weight * (uint8_t)(argb_cmyk >> 24);
- dest_g_m += pixel_weight * (uint8_t)(argb_cmyk >> 16);
- dest_r_y += pixel_weight * (uint8_t)(argb_cmyk >> 8);
- }
- dest_a += pixel_weight;
- }
- if (m_Flags & FXDIB_BICUBIC_INTERPOL) {
- dest_b_c =
- dest_b_c < 0 ? 0 : dest_b_c > 16711680 ? 16711680 : dest_b_c;
- dest_g_m =
- dest_g_m < 0 ? 0 : dest_g_m > 16711680 ? 16711680 : dest_g_m;
- dest_r_y =
- dest_r_y < 0 ? 0 : dest_r_y > 16711680 ? 16711680 : dest_r_y;
- dest_a = dest_a < 0 ? 0 : dest_a > 65536 ? 65536 : dest_a;
- }
- *dest_scan++ = (uint8_t)(dest_b_c >> 16);
- *dest_scan++ = (uint8_t)(dest_g_m >> 16);
- *dest_scan++ = (uint8_t)(dest_r_y >> 16);
- *dest_scan_mask++ = (uint8_t)((dest_a * 255) >> 16);
- }
- break;
- }
- case 7: {
- for (int col = m_DestClip.left; col < m_DestClip.right; col++) {
- PixelWeight* pPixelWeights = m_WeightTable.GetPixelWeight(col);
- int dest_r_y = 0, dest_g_m = 0, dest_b_c = 0;
- for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd;
- j++) {
- int* pWeight =
- m_WeightTable.GetValueFromPixelWeight(pPixelWeights, j);
- if (!pWeight)
- return false;
-
- int pixel_weight = *pWeight;
- const uint8_t* src_pixel = src_scan + j * Bpp;
- dest_b_c += pixel_weight * (*src_pixel++);
- dest_g_m += pixel_weight * (*src_pixel++);
- dest_r_y += pixel_weight * (*src_pixel);
- }
- if (m_Flags & FXDIB_BICUBIC_INTERPOL) {
- dest_b_c =
- dest_b_c < 0 ? 0 : dest_b_c > 16711680 ? 16711680 : dest_b_c;
- dest_g_m =
- dest_g_m < 0 ? 0 : dest_g_m > 16711680 ? 16711680 : dest_g_m;
- dest_r_y =
- dest_r_y < 0 ? 0 : dest_r_y > 16711680 ? 16711680 : dest_r_y;
- }
- *dest_scan++ = (uint8_t)((dest_b_c) >> 16);
- *dest_scan++ = (uint8_t)((dest_g_m) >> 16);
- *dest_scan++ = (uint8_t)((dest_r_y) >> 16);
- dest_scan += Bpp - 3;
- }
- break;
- }
- case 8: {
- for (int col = m_DestClip.left; col < m_DestClip.right; col++) {
- PixelWeight* pPixelWeights = m_WeightTable.GetPixelWeight(col);
- int dest_a = 0, dest_r_y = 0, dest_g_m = 0, dest_b_c = 0;
- for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd;
- j++) {
- int* pWeight =
- m_WeightTable.GetValueFromPixelWeight(pPixelWeights, j);
- if (!pWeight)
- return false;
-
- int pixel_weight = *pWeight;
- const uint8_t* src_pixel = src_scan + j * Bpp;
- if (m_DestFormat == FXDIB_Argb) {
- pixel_weight = pixel_weight * src_pixel[3] / 255;
- } else {
- pixel_weight = pixel_weight * src_scan_mask[j] / 255;
- }
- dest_b_c += pixel_weight * (*src_pixel++);
- dest_g_m += pixel_weight * (*src_pixel++);
- dest_r_y += pixel_weight * (*src_pixel);
- dest_a += pixel_weight;
- }
- if (m_Flags & FXDIB_BICUBIC_INTERPOL) {
- dest_r_y =
- dest_r_y < 0 ? 0 : dest_r_y > 16711680 ? 16711680 : dest_r_y;
- dest_g_m =
- dest_g_m < 0 ? 0 : dest_g_m > 16711680 ? 16711680 : dest_g_m;
- dest_b_c =
- dest_b_c < 0 ? 0 : dest_b_c > 16711680 ? 16711680 : dest_b_c;
- dest_a = dest_a < 0 ? 0 : dest_a > 65536 ? 65536 : dest_a;
- }
- *dest_scan++ = (uint8_t)((dest_b_c) >> 16);
- *dest_scan++ = (uint8_t)((dest_g_m) >> 16);
- *dest_scan++ = (uint8_t)((dest_r_y) >> 16);
- if (m_DestFormat == FXDIB_Argb) {
- *dest_scan = (uint8_t)((dest_a * 255) >> 16);
- }
- if (dest_scan_mask) {
- *dest_scan_mask++ = (uint8_t)((dest_a * 255) >> 16);
- }
- dest_scan += Bpp - 3;
- }
- break;
- }
- }
- rows_to_go--;
- }
- return false;
-}
-
-void CStretchEngine::StretchVert() {
- if (m_DestHeight == 0)
- return;
-
- CWeightTable table;
- bool ret = table.Calc(m_DestHeight, m_DestClip.top, m_DestClip.bottom,
- m_SrcHeight, m_SrcClip.top, m_SrcClip.bottom, m_Flags);
- if (!ret)
- return;
-
- const int DestBpp = m_DestBpp / 8;
- for (int row = m_DestClip.top; row < m_DestClip.bottom; row++) {
- unsigned char* dest_scan = m_pDestScanline;
- unsigned char* dest_scan_mask = m_pDestMaskScanline;
- PixelWeight* pPixelWeights = table.GetPixelWeight(row);
- switch (m_TransMethod) {
- case 1:
- case 2:
- case 3: {
- for (int col = m_DestClip.left; col < m_DestClip.right; col++) {
- unsigned char* src_scan =
- m_pInterBuf + (col - m_DestClip.left) * DestBpp;
- int dest_a = 0;
- for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd;
- j++) {
- int* pWeight = table.GetValueFromPixelWeight(pPixelWeights, j);
- if (!pWeight)
- return;
-
- int pixel_weight = *pWeight;
- dest_a +=
- pixel_weight * src_scan[(j - m_SrcClip.top) * m_InterPitch];
- }
- if (m_Flags & FXDIB_BICUBIC_INTERPOL) {
- dest_a = dest_a < 0 ? 0 : dest_a > 16711680 ? 16711680 : dest_a;
- }
- *dest_scan = (uint8_t)(dest_a >> 16);
- dest_scan += DestBpp;
- }
- break;
- }
- case 4: {
- for (int col = m_DestClip.left; col < m_DestClip.right; col++) {
- unsigned char* src_scan =
- m_pInterBuf + (col - m_DestClip.left) * DestBpp;
- unsigned char* src_scan_mask =
- m_pExtraAlphaBuf + (col - m_DestClip.left);
- int dest_a = 0, dest_k = 0;
- for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd;
- j++) {
- int* pWeight = table.GetValueFromPixelWeight(pPixelWeights, j);
- if (!pWeight)
- return;
-
- int pixel_weight = *pWeight;
- dest_k +=
- pixel_weight * src_scan[(j - m_SrcClip.top) * m_InterPitch];
- dest_a += pixel_weight *
- src_scan_mask[(j - m_SrcClip.top) * m_ExtraMaskPitch];
- }
- if (m_Flags & FXDIB_BICUBIC_INTERPOL) {
- dest_k = dest_k < 0 ? 0 : dest_k > 16711680 ? 16711680 : dest_k;
- dest_a = dest_a < 0 ? 0 : dest_a > 16711680 ? 16711680 : dest_a;
- }
- *dest_scan = (uint8_t)(dest_k >> 16);
- dest_scan += DestBpp;
- *dest_scan_mask++ = (uint8_t)(dest_a >> 16);
- }
- break;
- }
- case 5:
- case 7: {
- for (int col = m_DestClip.left; col < m_DestClip.right; col++) {
- unsigned char* src_scan =
- m_pInterBuf + (col - m_DestClip.left) * DestBpp;
- int dest_r_y = 0, dest_g_m = 0, dest_b_c = 0;
- for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd;
- j++) {
- int* pWeight = table.GetValueFromPixelWeight(pPixelWeights, j);
- if (!pWeight)
- return;
-
- int pixel_weight = *pWeight;
- const uint8_t* src_pixel =
- src_scan + (j - m_SrcClip.top) * m_InterPitch;
- dest_b_c += pixel_weight * (*src_pixel++);
- dest_g_m += pixel_weight * (*src_pixel++);
- dest_r_y += pixel_weight * (*src_pixel);
- }
- if (m_Flags & FXDIB_BICUBIC_INTERPOL) {
- dest_r_y =
- dest_r_y < 0 ? 0 : dest_r_y > 16711680 ? 16711680 : dest_r_y;
- dest_g_m =
- dest_g_m < 0 ? 0 : dest_g_m > 16711680 ? 16711680 : dest_g_m;
- dest_b_c =
- dest_b_c < 0 ? 0 : dest_b_c > 16711680 ? 16711680 : dest_b_c;
- }
- dest_scan[0] = (uint8_t)((dest_b_c) >> 16);
- dest_scan[1] = (uint8_t)((dest_g_m) >> 16);
- dest_scan[2] = (uint8_t)((dest_r_y) >> 16);
- dest_scan += DestBpp;
- }
- break;
- }
- case 6:
- case 8: {
- for (int col = m_DestClip.left; col < m_DestClip.right; col++) {
- unsigned char* src_scan =
- m_pInterBuf + (col - m_DestClip.left) * DestBpp;
- unsigned char* src_scan_mask = nullptr;
- if (m_DestFormat != FXDIB_Argb) {
- src_scan_mask = m_pExtraAlphaBuf + (col - m_DestClip.left);
- }
- int dest_a = 0, dest_r_y = 0, dest_g_m = 0, dest_b_c = 0;
- for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd;
- j++) {
- int* pWeight = table.GetValueFromPixelWeight(pPixelWeights, j);
- if (!pWeight)
- return;
-
- int pixel_weight = *pWeight;
- const uint8_t* src_pixel =
- src_scan + (j - m_SrcClip.top) * m_InterPitch;
- int mask_v = 255;
- if (src_scan_mask) {
- mask_v = src_scan_mask[(j - m_SrcClip.top) * m_ExtraMaskPitch];
- }
- dest_b_c += pixel_weight * (*src_pixel++);
- dest_g_m += pixel_weight * (*src_pixel++);
- dest_r_y += pixel_weight * (*src_pixel);
- if (m_DestFormat == FXDIB_Argb) {
- dest_a += pixel_weight * (*(src_pixel + 1));
- } else {
- dest_a += pixel_weight * mask_v;
- }
- }
- if (m_Flags & FXDIB_BICUBIC_INTERPOL) {
- dest_r_y =
- dest_r_y < 0 ? 0 : dest_r_y > 16711680 ? 16711680 : dest_r_y;
- dest_g_m =
- dest_g_m < 0 ? 0 : dest_g_m > 16711680 ? 16711680 : dest_g_m;
- dest_b_c =
- dest_b_c < 0 ? 0 : dest_b_c > 16711680 ? 16711680 : dest_b_c;
- dest_a = dest_a < 0 ? 0 : dest_a > 16711680 ? 16711680 : dest_a;
- }
- if (dest_a) {
- int r = ((uint32_t)dest_r_y) * 255 / dest_a;
- int g = ((uint32_t)dest_g_m) * 255 / dest_a;
- int b = ((uint32_t)dest_b_c) * 255 / dest_a;
- dest_scan[0] = b > 255 ? 255 : b < 0 ? 0 : b;
- dest_scan[1] = g > 255 ? 255 : g < 0 ? 0 : g;
- dest_scan[2] = r > 255 ? 255 : r < 0 ? 0 : r;
- }
- if (m_DestFormat == FXDIB_Argb) {
- dest_scan[3] = (uint8_t)((dest_a) >> 16);
- } else {
- *dest_scan_mask = (uint8_t)((dest_a) >> 16);
- }
- dest_scan += DestBpp;
- if (dest_scan_mask) {
- dest_scan_mask++;
- }
- }
- break;
- }
- }
- m_pDestBitmap->ComposeScanline(row - m_DestClip.top, m_pDestScanline,
- m_pDestMaskScanline);
- }
-}
-
-CFX_ImageStretcher::CFX_ImageStretcher(IFX_ScanlineComposer* pDest,
- const CFX_DIBSource* pSource,
- int dest_width,
- int dest_height,
- const FX_RECT& bitmap_rect,
- uint32_t flags)
- : m_pDest(pDest),
- m_pSource(pSource),
- m_Flags(flags),
- m_bFlipX(false),
- m_bFlipY(false),
- m_DestWidth(dest_width),
- m_DestHeight(dest_height),
- m_ClipRect(bitmap_rect),
- m_DestFormat(GetStretchedFormat(*pSource)),
- m_DestBPP(m_DestFormat & 0xff),
- m_LineIndex(0) {}
-
-CFX_ImageStretcher::~CFX_ImageStretcher() {
-}
-
-bool CFX_ImageStretcher::Start() {
- if (m_DestWidth == 0 || m_DestHeight == 0)
- return false;
-
- if (m_pSource->GetFormat() == FXDIB_1bppRgb && m_pSource->GetPalette()) {
- FX_ARGB pal[256];
- int a0, r0, g0, b0, a1, r1, g1, b1;
- ArgbDecode(m_pSource->GetPaletteEntry(0), a0, r0, g0, b0);
- ArgbDecode(m_pSource->GetPaletteEntry(1), a1, r1, g1, b1);
- for (int i = 0; i < 256; i++) {
- int a = a0 + (a1 - a0) * i / 255;
- int r = r0 + (r1 - r0) * i / 255;
- int g = g0 + (g1 - g0) * i / 255;
- int b = b0 + (b1 - b0) * i / 255;
- pal[i] = ArgbEncode(a, r, g, b);
- }
- if (!m_pDest->SetInfo(m_ClipRect.Width(), m_ClipRect.Height(), m_DestFormat,
- pal)) {
- return false;
- }
- } else if (m_pSource->GetFormat() == FXDIB_1bppCmyk &&
- m_pSource->GetPalette()) {
- FX_CMYK pal[256];
- int c0, m0, y0, k0, c1, m1, y1, k1;
- CmykDecode(m_pSource->GetPaletteEntry(0), c0, m0, y0, k0);
- CmykDecode(m_pSource->GetPaletteEntry(1), c1, m1, y1, k1);
- for (int i = 0; i < 256; i++) {
- int c = c0 + (c1 - c0) * i / 255;
- int m = m0 + (m1 - m0) * i / 255;
- int y = y0 + (y1 - y0) * i / 255;
- int k = k0 + (k1 - k0) * i / 255;
- pal[i] = CmykEncode(c, m, y, k);
- }
- if (!m_pDest->SetInfo(m_ClipRect.Width(), m_ClipRect.Height(), m_DestFormat,
- pal)) {
- return false;
- }
- } else if (!m_pDest->SetInfo(m_ClipRect.Width(), m_ClipRect.Height(),
- m_DestFormat, nullptr)) {
- return false;
- }
-
- if (m_Flags & FXDIB_DOWNSAMPLE)
- return StartQuickStretch();
- return StartStretch();
-}
-
-bool CFX_ImageStretcher::Continue(IFX_Pause* pPause) {
- if (m_Flags & FXDIB_DOWNSAMPLE)
- return ContinueQuickStretch(pPause);
- return ContinueStretch(pPause);
-}
-
-bool CFX_ImageStretcher::StartStretch() {
- m_pStretchEngine = pdfium::MakeUnique<CStretchEngine>(
- m_pDest, m_DestFormat, m_DestWidth, m_DestHeight, m_ClipRect, m_pSource,
- m_Flags);
- m_pStretchEngine->StartStretchHorz();
- if (SourceSizeWithinLimit(m_pSource->GetWidth(), m_pSource->GetHeight())) {
- m_pStretchEngine->Continue(nullptr);
- return false;
- }
- return true;
-}
-
-bool CFX_ImageStretcher::ContinueStretch(IFX_Pause* pPause) {
- return m_pStretchEngine && m_pStretchEngine->Continue(pPause);
-}
-
-bool CFX_ImageStretcher::StartQuickStretch() {
- if (m_DestWidth < 0) {
- m_bFlipX = true;
- m_DestWidth = -m_DestWidth;
- }
- if (m_DestHeight < 0) {
- m_bFlipY = true;
- m_DestHeight = -m_DestHeight;
- }
- uint32_t size = m_ClipRect.Width();
- if (size && m_DestBPP > (int)(INT_MAX / size)) {
- return false;
- }
- size *= m_DestBPP;
- m_pScanline.reset(FX_Alloc(uint8_t, (size / 8 + 3) / 4 * 4));
- if (m_pSource->m_pAlphaMask)
- m_pMaskScanline.reset(FX_Alloc(uint8_t, (m_ClipRect.Width() + 3) / 4 * 4));
-
- if (SourceSizeWithinLimit(m_pSource->GetWidth(), m_pSource->GetHeight())) {
- ContinueQuickStretch(nullptr);
- return false;
- }
- return true;
-}
-
-bool CFX_ImageStretcher::ContinueQuickStretch(IFX_Pause* pPause) {
- if (!m_pScanline)
- return false;
-
- int result_width = m_ClipRect.Width();
- int result_height = m_ClipRect.Height();
- int src_height = m_pSource->GetHeight();
- for (; m_LineIndex < result_height; m_LineIndex++) {
- int dest_y;
- int src_y;
- if (m_bFlipY) {
- dest_y = result_height - m_LineIndex - 1;
- src_y = (m_DestHeight - (dest_y + m_ClipRect.top) - 1) * src_height /
- m_DestHeight;
- } else {
- dest_y = m_LineIndex;
- src_y = (dest_y + m_ClipRect.top) * src_height / m_DestHeight;
- }
- src_y = std::max(std::min(src_y, src_height - 1), 0);
-
- if (m_pSource->SkipToScanline(src_y, pPause))
- return true;
-
- m_pSource->DownSampleScanline(src_y, m_pScanline.get(), m_DestBPP,
- m_DestWidth, m_bFlipX, m_ClipRect.left,
- result_width);
- if (m_pMaskScanline) {
- m_pSource->m_pAlphaMask->DownSampleScanline(
- src_y, m_pMaskScanline.get(), 1, m_DestWidth, m_bFlipX,
- m_ClipRect.left, result_width);
- }
- m_pDest->ComposeScanline(dest_y, m_pScanline.get(), m_pMaskScanline.get());
- }
- return false;
-}
diff --git a/chromium/third_party/pdfium/core/fxge/dib/fx_dib_engine_unittest.cpp b/chromium/third_party/pdfium/core/fxge/dib/fx_dib_engine_unittest.cpp
deleted file mode 100644
index 705d761ca83..00000000000
--- a/chromium/third_party/pdfium/core/fxge/dib/fx_dib_engine_unittest.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright 2016 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include <memory>
-#include <utility>
-
-#include "core/fpdfapi/parser/cpdf_dictionary.h"
-#include "core/fpdfapi/parser/cpdf_number.h"
-#include "core/fpdfapi/parser/cpdf_stream.h"
-#include "core/fpdfapi/render/cpdf_dibsource.h"
-#include "core/fxcrt/fx_memory.h"
-#include "core/fxge/dib/dib_int.h"
-#include "core/fxge/fx_dib.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/base/ptr_util.h"
-
-TEST(CStretchEngine, OverflowInCtor) {
- FX_RECT clip_rect;
- std::unique_ptr<CPDF_Dictionary> dict_obj =
- pdfium::MakeUnique<CPDF_Dictionary>();
- dict_obj->SetNewFor<CPDF_Number>("Width", 71000);
- dict_obj->SetNewFor<CPDF_Number>("Height", 12500);
- std::unique_ptr<CPDF_Stream> stream =
- pdfium::MakeUnique<CPDF_Stream>(nullptr, 0, std::move(dict_obj));
- CPDF_DIBSource dib_source;
- dib_source.Load(nullptr, stream.get());
- CStretchEngine engine(nullptr, FXDIB_8bppRgb, 500, 500, clip_rect,
- &dib_source, 0);
- EXPECT_EQ(FXDIB_INTERPOL, engine.m_Flags);
-}
diff --git a/chromium/third_party/pdfium/core/fxge/dib/fx_dib_main.cpp b/chromium/third_party/pdfium/core/fxge/dib/fx_dib_main.cpp
index 96cae9d4e7b..97b1aa7ccab 100644
--- a/chromium/third_party/pdfium/core/fxge/dib/fx_dib_main.cpp
+++ b/chromium/third_party/pdfium/core/fxge/dib/fx_dib_main.cpp
@@ -6,24 +6,70 @@
#include "core/fxge/fx_dib.h"
-#include <limits.h>
-
-#include <algorithm>
-#include <memory>
#include <utility>
-#include "core/fxcodec/fx_codec.h"
-#include "core/fxcrt/cfx_maybe_owned.h"
-#include "core/fxge/cfx_gemodule.h"
-#include "core/fxge/dib/dib_int.h"
-#include "core/fxge/ge/cfx_cliprgn.h"
#include "third_party/base/ptr_util.h"
-void CmykDecode(uint32_t cmyk, int& c, int& m, int& y, int& k) {
- c = FXSYS_GetCValue(cmyk);
- m = FXSYS_GetMValue(cmyk);
- y = FXSYS_GetYValue(cmyk);
- k = FXSYS_GetKValue(cmyk);
+const int16_t SDP_Table[513] = {
+ 256, 256, 256, 256, 256, 256, 256, 256, 256, 255, 255, 255, 255, 255, 255,
+ 254, 254, 254, 254, 253, 253, 253, 252, 252, 252, 251, 251, 251, 250, 250,
+ 249, 249, 249, 248, 248, 247, 247, 246, 246, 245, 244, 244, 243, 243, 242,
+ 242, 241, 240, 240, 239, 238, 238, 237, 236, 236, 235, 234, 233, 233, 232,
+ 231, 230, 230, 229, 228, 227, 226, 226, 225, 224, 223, 222, 221, 220, 219,
+ 218, 218, 217, 216, 215, 214, 213, 212, 211, 210, 209, 208, 207, 206, 205,
+ 204, 203, 202, 201, 200, 199, 198, 196, 195, 194, 193, 192, 191, 190, 189,
+ 188, 186, 185, 184, 183, 182, 181, 179, 178, 177, 176, 175, 173, 172, 171,
+ 170, 169, 167, 166, 165, 164, 162, 161, 160, 159, 157, 156, 155, 154, 152,
+ 151, 150, 149, 147, 146, 145, 143, 142, 141, 140, 138, 137, 136, 134, 133,
+ 132, 130, 129, 128, 126, 125, 124, 122, 121, 120, 119, 117, 116, 115, 113,
+ 112, 111, 109, 108, 107, 105, 104, 103, 101, 100, 99, 97, 96, 95, 93,
+ 92, 91, 89, 88, 87, 85, 84, 83, 81, 80, 79, 77, 76, 75, 73,
+ 72, 71, 69, 68, 67, 66, 64, 63, 62, 60, 59, 58, 57, 55, 54,
+ 53, 52, 50, 49, 48, 47, 45, 44, 43, 42, 40, 39, 38, 37, 36,
+ 34, 33, 32, 31, 30, 28, 27, 26, 25, 24, 23, 21, 20, 19, 18,
+ 17, 16, 15, 14, 13, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2,
+ 1, 0, 0, -1, -2, -3, -4, -5, -6, -7, -7, -8, -9, -10, -11,
+ -12, -12, -13, -14, -15, -15, -16, -17, -17, -18, -19, -19, -20, -21, -21,
+ -22, -22, -23, -24, -24, -25, -25, -26, -26, -27, -27, -27, -28, -28, -29,
+ -29, -30, -30, -30, -31, -31, -31, -32, -32, -32, -33, -33, -33, -33, -34,
+ -34, -34, -34, -35, -35, -35, -35, -35, -36, -36, -36, -36, -36, -36, -36,
+ -36, -36, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37,
+ -37, -37, -37, -37, -37, -37, -37, -37, -36, -36, -36, -36, -36, -36, -36,
+ -36, -36, -35, -35, -35, -35, -35, -35, -34, -34, -34, -34, -34, -33, -33,
+ -33, -33, -33, -32, -32, -32, -32, -31, -31, -31, -31, -30, -30, -30, -30,
+ -29, -29, -29, -29, -28, -28, -28, -27, -27, -27, -27, -26, -26, -26, -25,
+ -25, -25, -24, -24, -24, -23, -23, -23, -22, -22, -22, -22, -21, -21, -21,
+ -20, -20, -20, -19, -19, -19, -18, -18, -18, -17, -17, -17, -16, -16, -16,
+ -15, -15, -15, -14, -14, -14, -13, -13, -13, -12, -12, -12, -11, -11, -11,
+ -10, -10, -10, -9, -9, -9, -9, -8, -8, -8, -7, -7, -7, -7, -6,
+ -6, -6, -6, -5, -5, -5, -5, -4, -4, -4, -4, -3, -3, -3, -3,
+ -3, -2, -2, -2, -2, -2, -1, -1, -1, -1, -1, -1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0,
+};
+
+FX_RECT FXDIB_SwapClipBox(FX_RECT& clip,
+ int width,
+ int height,
+ bool bFlipX,
+ bool bFlipY) {
+ FX_RECT rect;
+ if (bFlipY) {
+ rect.left = height - clip.top;
+ rect.right = height - clip.bottom;
+ } else {
+ rect.left = clip.top;
+ rect.right = clip.bottom;
+ }
+ if (bFlipX) {
+ rect.top = width - clip.left;
+ rect.bottom = width - clip.right;
+ } else {
+ rect.top = clip.left;
+ rect.bottom = clip.right;
+ }
+ rect.Normalize();
+ return rect;
}
void ArgbDecode(uint32_t argb, int& a, int& r, int& g, int& b) {
@@ -42,1606 +88,3 @@ uint32_t ArgbEncode(int a, FX_COLORREF rgb) {
return FXARGB_MAKE(a, FXSYS_GetRValue(rgb), FXSYS_GetGValue(rgb),
FXSYS_GetBValue(rgb));
}
-
-CFX_DIBSource::CFX_DIBSource()
- : m_pAlphaMask(nullptr),
- m_Width(0),
- m_Height(0),
- m_bpp(0),
- m_AlphaFlag(0),
- m_Pitch(0) {}
-
-CFX_DIBSource::~CFX_DIBSource() {
- delete m_pAlphaMask;
-}
-
-uint8_t* CFX_DIBSource::GetBuffer() const {
- return nullptr;
-}
-
-bool CFX_DIBSource::SkipToScanline(int line, IFX_Pause* pPause) const {
- return false;
-}
-
-CFX_DIBitmap::CFX_DIBitmap() {
- m_bExtBuf = false;
- m_pBuffer = nullptr;
- m_pPalette = nullptr;
-#ifdef _SKIA_SUPPORT_PATHS_
- m_nFormat = Format::kCleared;
-#endif
-}
-
-#define _MAX_OOM_LIMIT_ 12000000
-bool CFX_DIBitmap::Create(int width,
- int height,
- FXDIB_Format format,
- uint8_t* pBuffer,
- int pitch) {
- m_pBuffer = nullptr;
- m_bpp = (uint8_t)format;
- m_AlphaFlag = (uint8_t)(format >> 8);
- m_Width = m_Height = m_Pitch = 0;
- if (width <= 0 || height <= 0 || pitch < 0) {
- return false;
- }
- if ((INT_MAX - 31) / width < (format & 0xff)) {
- return false;
- }
- if (!pitch) {
- pitch = (width * (format & 0xff) + 31) / 32 * 4;
- }
- if ((1 << 30) / pitch < height) {
- return false;
- }
- if (pBuffer) {
- m_pBuffer = pBuffer;
- m_bExtBuf = true;
- } else {
- int size = pitch * height + 4;
- int oomlimit = _MAX_OOM_LIMIT_;
- if (oomlimit >= 0 && size >= oomlimit) {
- m_pBuffer = FX_TryAlloc(uint8_t, size);
- if (!m_pBuffer) {
- return false;
- }
- } else {
- m_pBuffer = FX_Alloc(uint8_t, size);
- }
- }
- m_Width = width;
- m_Height = height;
- m_Pitch = pitch;
- if (HasAlpha() && format != FXDIB_Argb) {
- bool ret = true;
- ret = BuildAlphaMask();
- if (!ret) {
- if (!m_bExtBuf) {
- FX_Free(m_pBuffer);
- m_pBuffer = nullptr;
- m_Width = m_Height = m_Pitch = 0;
- return false;
- }
- }
- }
- return true;
-}
-
-bool CFX_DIBitmap::Copy(const CFX_DIBSource* pSrc) {
- if (m_pBuffer)
- return false;
-
- if (!Create(pSrc->GetWidth(), pSrc->GetHeight(), pSrc->GetFormat()))
- return false;
-
- SetPalette(pSrc->GetPalette());
- SetAlphaMask(pSrc->m_pAlphaMask);
- for (int row = 0; row < pSrc->GetHeight(); row++)
- FXSYS_memcpy(m_pBuffer + row * m_Pitch, pSrc->GetScanline(row), m_Pitch);
-
- return true;
-}
-
-CFX_DIBitmap::~CFX_DIBitmap() {
- if (!m_bExtBuf)
- FX_Free(m_pBuffer);
-
- m_pBuffer = nullptr;
-}
-
-uint8_t* CFX_DIBitmap::GetBuffer() const {
- return m_pBuffer;
-}
-
-const uint8_t* CFX_DIBitmap::GetScanline(int line) const {
- return m_pBuffer ? m_pBuffer + line * m_Pitch : nullptr;
-}
-
-void CFX_DIBitmap::TakeOver(CFX_DIBitmap* pSrcBitmap) {
- if (!m_bExtBuf)
- FX_Free(m_pBuffer);
-
- delete m_pAlphaMask;
- m_pBuffer = pSrcBitmap->m_pBuffer;
- m_pPalette = std::move(pSrcBitmap->m_pPalette);
- m_pAlphaMask = pSrcBitmap->m_pAlphaMask;
- pSrcBitmap->m_pBuffer = nullptr;
- pSrcBitmap->m_pAlphaMask = nullptr;
- m_bpp = pSrcBitmap->m_bpp;
- m_bExtBuf = pSrcBitmap->m_bExtBuf;
- m_AlphaFlag = pSrcBitmap->m_AlphaFlag;
- m_Width = pSrcBitmap->m_Width;
- m_Height = pSrcBitmap->m_Height;
- m_Pitch = pSrcBitmap->m_Pitch;
-}
-
-std::unique_ptr<CFX_DIBitmap> CFX_DIBSource::Clone(const FX_RECT* pClip) const {
- FX_RECT rect(0, 0, m_Width, m_Height);
- if (pClip) {
- rect.Intersect(*pClip);
- if (rect.IsEmpty())
- return nullptr;
- }
- auto pNewBitmap = pdfium::MakeUnique<CFX_DIBitmap>();
- if (!pNewBitmap->Create(rect.Width(), rect.Height(), GetFormat()))
- return nullptr;
-
- pNewBitmap->SetPalette(m_pPalette.get());
- pNewBitmap->SetAlphaMask(m_pAlphaMask, pClip);
- if (GetBPP() == 1 && rect.left % 8 != 0) {
- int left_shift = rect.left % 32;
- int right_shift = 32 - left_shift;
- int dword_count = pNewBitmap->m_Pitch / 4;
- for (int row = rect.top; row < rect.bottom; row++) {
- uint32_t* src_scan = (uint32_t*)GetScanline(row) + rect.left / 32;
- uint32_t* dest_scan = (uint32_t*)pNewBitmap->GetScanline(row - rect.top);
- for (int i = 0; i < dword_count; i++) {
- dest_scan[i] =
- (src_scan[i] << left_shift) | (src_scan[i + 1] >> right_shift);
- }
- }
- } else {
- int copy_len = (pNewBitmap->GetWidth() * pNewBitmap->GetBPP() + 7) / 8;
- if (m_Pitch < (uint32_t)copy_len)
- copy_len = m_Pitch;
-
- for (int row = rect.top; row < rect.bottom; row++) {
- const uint8_t* src_scan = GetScanline(row) + rect.left * m_bpp / 8;
- uint8_t* dest_scan = (uint8_t*)pNewBitmap->GetScanline(row - rect.top);
- FXSYS_memcpy(dest_scan, src_scan, copy_len);
- }
- }
- return pNewBitmap;
-}
-
-void CFX_DIBSource::BuildPalette() {
- if (m_pPalette)
- return;
-
- if (GetBPP() == 1) {
- m_pPalette.reset(FX_Alloc(uint32_t, 2));
- if (IsCmykImage()) {
- m_pPalette.get()[0] = 0xff;
- m_pPalette.get()[1] = 0;
- } else {
- m_pPalette.get()[0] = 0xff000000;
- m_pPalette.get()[1] = 0xffffffff;
- }
- } else if (GetBPP() == 8) {
- m_pPalette.reset(FX_Alloc(uint32_t, 256));
- if (IsCmykImage()) {
- for (int i = 0; i < 256; i++)
- m_pPalette.get()[i] = 0xff - i;
- } else {
- for (int i = 0; i < 256; i++)
- m_pPalette.get()[i] = 0xff000000 | (i * 0x10101);
- }
- }
-}
-
-bool CFX_DIBSource::BuildAlphaMask() {
- if (m_pAlphaMask) {
- return true;
- }
- m_pAlphaMask = new CFX_DIBitmap;
- if (!m_pAlphaMask->Create(m_Width, m_Height, FXDIB_8bppMask)) {
- delete m_pAlphaMask;
- m_pAlphaMask = nullptr;
- return false;
- }
- FXSYS_memset(m_pAlphaMask->GetBuffer(), 0xff,
- m_pAlphaMask->GetHeight() * m_pAlphaMask->GetPitch());
- return true;
-}
-
-uint32_t CFX_DIBSource::GetPaletteEntry(int index) const {
- ASSERT((GetBPP() == 1 || GetBPP() == 8) && !IsAlphaMask());
- if (m_pPalette) {
- return m_pPalette.get()[index];
- }
- if (IsCmykImage()) {
- if (GetBPP() == 1) {
- return index ? 0 : 0xff;
- }
- return 0xff - index;
- }
- if (GetBPP() == 1) {
- return index ? 0xffffffff : 0xff000000;
- }
- return index * 0x10101 | 0xff000000;
-}
-
-void CFX_DIBSource::SetPaletteEntry(int index, uint32_t color) {
- ASSERT((GetBPP() == 1 || GetBPP() == 8) && !IsAlphaMask());
- if (!m_pPalette) {
- BuildPalette();
- }
- m_pPalette.get()[index] = color;
-}
-
-int CFX_DIBSource::FindPalette(uint32_t color) const {
- ASSERT((GetBPP() == 1 || GetBPP() == 8) && !IsAlphaMask());
- if (!m_pPalette) {
- if (IsCmykImage()) {
- if (GetBPP() == 1) {
- return ((uint8_t)color == 0xff) ? 0 : 1;
- }
- return 0xff - (uint8_t)color;
- }
- if (GetBPP() == 1) {
- return ((uint8_t)color == 0xff) ? 1 : 0;
- }
- return (uint8_t)color;
- }
- int palsize = (1 << GetBPP());
- for (int i = 0; i < palsize; i++)
- if (m_pPalette.get()[i] == color) {
- return i;
- }
- return -1;
-}
-
-void CFX_DIBitmap::Clear(uint32_t color) {
- if (!m_pBuffer) {
- return;
- }
- switch (GetFormat()) {
- case FXDIB_1bppMask:
- FXSYS_memset(m_pBuffer, (color & 0xff000000) ? 0xff : 0,
- m_Pitch * m_Height);
- break;
- case FXDIB_1bppRgb: {
- int index = FindPalette(color);
- FXSYS_memset(m_pBuffer, index ? 0xff : 0, m_Pitch * m_Height);
- break;
- }
- case FXDIB_8bppMask:
- FXSYS_memset(m_pBuffer, color >> 24, m_Pitch * m_Height);
- break;
- case FXDIB_8bppRgb: {
- int index = FindPalette(color);
- FXSYS_memset(m_pBuffer, index, m_Pitch * m_Height);
- break;
- }
- case FXDIB_Rgb:
- case FXDIB_Rgba: {
- int a, r, g, b;
- ArgbDecode(color, a, r, g, b);
- if (r == g && g == b) {
- FXSYS_memset(m_pBuffer, r, m_Pitch * m_Height);
- } else {
- int byte_pos = 0;
- for (int col = 0; col < m_Width; col++) {
- m_pBuffer[byte_pos++] = b;
- m_pBuffer[byte_pos++] = g;
- m_pBuffer[byte_pos++] = r;
- }
- for (int row = 1; row < m_Height; row++) {
- FXSYS_memcpy(m_pBuffer + row * m_Pitch, m_pBuffer, m_Pitch);
- }
- }
- break;
- }
- case FXDIB_Rgb32:
- case FXDIB_Argb: {
- color = IsCmykImage() ? FXCMYK_TODIB(color) : FXARGB_TODIB(color);
-#ifdef _SKIA_SUPPORT_
- if (FXDIB_Rgb32 == GetFormat() && !IsCmykImage()) {
- color |= 0xFF000000;
- }
-#endif
- for (int i = 0; i < m_Width; i++) {
- ((uint32_t*)m_pBuffer)[i] = color;
- }
- for (int row = 1; row < m_Height; row++) {
- FXSYS_memcpy(m_pBuffer + row * m_Pitch, m_pBuffer, m_Pitch);
- }
- break;
- }
- default:
- break;
- }
-}
-
-void CFX_DIBSource::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) {
- if (width == 0 || height == 0) {
- return;
- }
- ASSERT(width > 0 && height > 0);
- if (dest_left > m_Width || dest_top > m_Height) {
- width = 0;
- height = 0;
- return;
- }
- int x_offset = dest_left - src_left;
- int y_offset = dest_top - src_top;
- FX_RECT src_rect(src_left, src_top, src_left + width, src_top + height);
- FX_RECT src_bound(0, 0, src_width, src_height);
- src_rect.Intersect(src_bound);
- FX_RECT dest_rect(src_rect.left + x_offset, src_rect.top + y_offset,
- src_rect.right + x_offset, src_rect.bottom + y_offset);
- FX_RECT dest_bound(0, 0, m_Width, m_Height);
- dest_rect.Intersect(dest_bound);
- if (pClipRgn) {
- dest_rect.Intersect(pClipRgn->GetBox());
- }
- dest_left = dest_rect.left;
- dest_top = dest_rect.top;
- src_left = dest_left - x_offset;
- src_top = dest_top - y_offset;
- width = dest_rect.right - dest_rect.left;
- height = dest_rect.bottom - dest_rect.top;
-}
-
-bool CFX_DIBitmap::TransferBitmap(int dest_left,
- int dest_top,
- int width,
- int height,
- const CFX_DIBSource* pSrcBitmap,
- int src_left,
- int src_top) {
- if (!m_pBuffer)
- return false;
-
- GetOverlapRect(dest_left, dest_top, width, height, pSrcBitmap->GetWidth(),
- pSrcBitmap->GetHeight(), src_left, src_top, nullptr);
- if (width == 0 || height == 0)
- return true;
-
- FXDIB_Format dest_format = GetFormat();
- FXDIB_Format src_format = pSrcBitmap->GetFormat();
- if (dest_format == src_format) {
- if (GetBPP() == 1) {
- for (int row = 0; row < height; row++) {
- uint8_t* dest_scan = m_pBuffer + (dest_top + row) * m_Pitch;
- const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row);
- for (int col = 0; col < width; col++) {
- if (src_scan[(src_left + col) / 8] &
- (1 << (7 - (src_left + col) % 8))) {
- dest_scan[(dest_left + col) / 8] |= 1
- << (7 - (dest_left + col) % 8);
- } else {
- dest_scan[(dest_left + col) / 8] &=
- ~(1 << (7 - (dest_left + col) % 8));
- }
- }
- }
- } else {
- int Bpp = GetBPP() / 8;
- for (int row = 0; row < height; row++) {
- uint8_t* dest_scan =
- m_pBuffer + (dest_top + row) * m_Pitch + dest_left * Bpp;
- const uint8_t* src_scan =
- pSrcBitmap->GetScanline(src_top + row) + src_left * Bpp;
- FXSYS_memcpy(dest_scan, src_scan, width * Bpp);
- }
- }
- } else {
- if (m_pPalette)
- return false;
-
- if (m_bpp == 8)
- dest_format = FXDIB_8bppMask;
-
- uint8_t* dest_buf =
- m_pBuffer + dest_top * m_Pitch + dest_left * GetBPP() / 8;
- std::unique_ptr<uint32_t, FxFreeDeleter> d_plt;
- if (!ConvertBuffer(dest_format, dest_buf, m_Pitch, width, height,
- pSrcBitmap, src_left, src_top, &d_plt)) {
- return false;
- }
- }
- return true;
-}
-
-bool CFX_DIBitmap::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,
- void* pIccTransform) {
- if (!m_pBuffer) {
- return false;
- }
- ASSERT(HasAlpha() && (m_bpp >= 24));
- ASSERT(pMask->IsAlphaMask());
- if (!HasAlpha() || !pMask->IsAlphaMask() || m_bpp < 24) {
- return false;
- }
- GetOverlapRect(dest_left, dest_top, width, height, pMask->GetWidth(),
- pMask->GetHeight(), src_left, src_top, nullptr);
- if (width == 0 || height == 0) {
- return true;
- }
- int src_bpp = pMask->GetBPP();
- int alpha;
- uint32_t dst_color;
- if (alpha_flag >> 8) {
- alpha = alpha_flag & 0xff;
- dst_color = FXCMYK_TODIB(color);
- } else {
- alpha = FXARGB_A(color);
- dst_color = FXARGB_TODIB(color);
- }
- uint8_t* color_p = (uint8_t*)&dst_color;
- if (pIccTransform && CFX_GEModule::Get()->GetCodecModule() &&
- CFX_GEModule::Get()->GetCodecModule()->GetIccModule()) {
- CCodec_IccModule* pIccModule =
- CFX_GEModule::Get()->GetCodecModule()->GetIccModule();
- pIccModule->TranslateScanline(pIccTransform, color_p, color_p, 1);
- } else {
- if (alpha_flag >> 8 && !IsCmykImage()) {
- AdobeCMYK_to_sRGB1(FXSYS_GetCValue(color), FXSYS_GetMValue(color),
- FXSYS_GetYValue(color), FXSYS_GetKValue(color),
- color_p[2], color_p[1], color_p[0]);
- } else if (!(alpha_flag >> 8) && IsCmykImage()) {
- return false;
- }
- }
- if (!IsCmykImage()) {
- color_p[3] = (uint8_t)alpha;
- }
- if (GetFormat() == FXDIB_Argb) {
- for (int row = 0; row < height; row++) {
- uint32_t* dest_pos =
- (uint32_t*)(m_pBuffer + (dest_top + row) * m_Pitch + dest_left * 4);
- const uint8_t* src_scan = pMask->GetScanline(src_top + row);
- if (src_bpp == 1) {
- for (int col = 0; col < width; col++) {
- int src_bitpos = src_left + col;
- if (src_scan[src_bitpos / 8] & (1 << (7 - src_bitpos % 8))) {
- *dest_pos = dst_color;
- } else {
- *dest_pos = 0;
- }
- dest_pos++;
- }
- } else {
- src_scan += src_left;
- dst_color = FXARGB_TODIB(dst_color);
- dst_color &= 0xffffff;
- for (int col = 0; col < width; col++) {
- FXARGB_SETDIB(dest_pos++,
- dst_color | ((alpha * (*src_scan++) / 255) << 24));
- }
- }
- }
- } else {
- int comps = m_bpp / 8;
- for (int row = 0; row < height; row++) {
- uint8_t* dest_color_pos =
- m_pBuffer + (dest_top + row) * m_Pitch + dest_left * comps;
- uint8_t* dest_alpha_pos =
- (uint8_t*)m_pAlphaMask->GetScanline(dest_top + row) + dest_left;
- const uint8_t* src_scan = pMask->GetScanline(src_top + row);
- if (src_bpp == 1) {
- for (int col = 0; col < width; col++) {
- int src_bitpos = src_left + col;
- if (src_scan[src_bitpos / 8] & (1 << (7 - src_bitpos % 8))) {
- FXSYS_memcpy(dest_color_pos, color_p, comps);
- *dest_alpha_pos = 0xff;
- } else {
- FXSYS_memset(dest_color_pos, 0, comps);
- *dest_alpha_pos = 0;
- }
- dest_color_pos += comps;
- dest_alpha_pos++;
- }
- } else {
- src_scan += src_left;
- for (int col = 0; col < width; col++) {
- FXSYS_memcpy(dest_color_pos, color_p, comps);
- dest_color_pos += comps;
- *dest_alpha_pos++ = (alpha * (*src_scan++) / 255);
- }
- }
- }
- }
- return true;
-}
-
-void CFX_DIBSource::SetPalette(const uint32_t* pSrc) {
- static const uint32_t kPaletteSize = 256;
- if (!pSrc || GetBPP() > 8) {
- m_pPalette.reset();
- return;
- }
- uint32_t pal_size = 1 << GetBPP();
- if (!m_pPalette)
- m_pPalette.reset(FX_Alloc(uint32_t, pal_size));
- pal_size = std::min(pal_size, kPaletteSize);
- FXSYS_memcpy(m_pPalette.get(), pSrc, pal_size * sizeof(uint32_t));
-}
-
-void CFX_DIBSource::GetPalette(uint32_t* pal, int alpha) const {
- ASSERT(GetBPP() <= 8 && !IsCmykImage());
- if (GetBPP() == 1) {
- pal[0] = ((m_pPalette ? m_pPalette.get()[0] : 0xff000000) & 0xffffff) |
- (alpha << 24);
- pal[1] = ((m_pPalette ? m_pPalette.get()[1] : 0xffffffff) & 0xffffff) |
- (alpha << 24);
- return;
- }
- if (m_pPalette) {
- for (int i = 0; i < 256; i++) {
- pal[i] = (m_pPalette.get()[i] & 0x00ffffff) | (alpha << 24);
- }
- } else {
- for (int i = 0; i < 256; i++) {
- pal[i] = (i * 0x10101) | (alpha << 24);
- }
- }
-}
-
-std::unique_ptr<CFX_DIBitmap> CFX_DIBSource::CloneAlphaMask(
- const FX_RECT* pClip) const {
- ASSERT(GetFormat() == FXDIB_Argb);
- FX_RECT rect(0, 0, m_Width, m_Height);
- if (pClip) {
- rect.Intersect(*pClip);
- if (rect.IsEmpty())
- return nullptr;
- }
- auto pMask = pdfium::MakeUnique<CFX_DIBitmap>();
- if (!pMask->Create(rect.Width(), rect.Height(), FXDIB_8bppMask))
- return nullptr;
-
- for (int row = rect.top; row < rect.bottom; row++) {
- const uint8_t* src_scan = GetScanline(row) + rect.left * 4 + 3;
- uint8_t* dest_scan =
- const_cast<uint8_t*>(pMask->GetScanline(row - rect.top));
- for (int col = rect.left; col < rect.right; col++) {
- *dest_scan++ = *src_scan;
- src_scan += 4;
- }
- }
- return pMask;
-}
-
-bool CFX_DIBSource::SetAlphaMask(const CFX_DIBSource* pAlphaMask,
- const FX_RECT* pClip) {
- if (!HasAlpha() || GetFormat() == FXDIB_Argb)
- return false;
-
- if (!pAlphaMask) {
- m_pAlphaMask->Clear(0xff000000);
- return true;
- }
- FX_RECT rect(0, 0, pAlphaMask->m_Width, pAlphaMask->m_Height);
- if (pClip) {
- rect.Intersect(*pClip);
- if (rect.IsEmpty() || rect.Width() != m_Width ||
- rect.Height() != m_Height) {
- return false;
- }
- } else {
- if (pAlphaMask->m_Width != m_Width || pAlphaMask->m_Height != m_Height)
- return false;
- }
- for (int row = 0; row < m_Height; row++) {
- FXSYS_memcpy(const_cast<uint8_t*>(m_pAlphaMask->GetScanline(row)),
- pAlphaMask->GetScanline(row + rect.top) + rect.left,
- m_pAlphaMask->m_Pitch);
- }
- return true;
-}
-
-const int g_ChannelOffset[] = {0, 2, 1, 0, 0, 1, 2, 3, 3};
-bool CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel,
- CFX_DIBSource* pSrcBitmap,
- FXDIB_Channel srcChannel) {
- if (!m_pBuffer)
- return false;
-
- CFX_MaybeOwned<CFX_DIBSource> pSrcClone(pSrcBitmap);
- int srcOffset;
- if (srcChannel == FXDIB_Alpha) {
- if (!pSrcBitmap->HasAlpha() && !pSrcBitmap->IsAlphaMask())
- return false;
-
- if (pSrcBitmap->GetBPP() == 1) {
- pSrcClone = pSrcBitmap->CloneConvert(FXDIB_8bppMask);
- if (!pSrcClone)
- return false;
- }
- srcOffset = pSrcBitmap->GetFormat() == FXDIB_Argb ? 3 : 0;
- } else {
- if (pSrcBitmap->IsAlphaMask())
- return false;
-
- if (pSrcBitmap->GetBPP() < 24) {
- if (pSrcBitmap->IsCmykImage()) {
- pSrcClone = pSrcBitmap->CloneConvert(static_cast<FXDIB_Format>(
- (pSrcBitmap->GetFormat() & 0xff00) | 0x20));
- } else {
- pSrcClone = pSrcBitmap->CloneConvert(static_cast<FXDIB_Format>(
- (pSrcBitmap->GetFormat() & 0xff00) | 0x18));
- }
- if (!pSrcClone)
- return false;
- }
- srcOffset = g_ChannelOffset[srcChannel];
- }
- int destOffset = 0;
- if (destChannel == FXDIB_Alpha) {
- if (IsAlphaMask()) {
- if (!ConvertFormat(FXDIB_8bppMask))
- return false;
- } else {
- if (!ConvertFormat(IsCmykImage() ? FXDIB_Cmyka : FXDIB_Argb))
- return false;
-
- if (GetFormat() == FXDIB_Argb)
- destOffset = 3;
- }
- } else {
- if (IsAlphaMask())
- return false;
-
- if (GetBPP() < 24) {
- if (HasAlpha()) {
- if (!ConvertFormat(IsCmykImage() ? FXDIB_Cmyka : FXDIB_Argb))
- return false;
-#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
- } else if (!ConvertFormat(IsCmykImage() ? FXDIB_Cmyk : FXDIB_Rgb32)) {
-#else
- } else if (!ConvertFormat(IsCmykImage() ? FXDIB_Cmyk : FXDIB_Rgb)) {
-#endif
- return false;
- }
- }
- destOffset = g_ChannelOffset[destChannel];
- }
- if (srcChannel == FXDIB_Alpha && pSrcClone->m_pAlphaMask) {
- CFX_MaybeOwned<CFX_DIBSource> pAlphaMask(pSrcClone->m_pAlphaMask);
- if (pSrcClone->GetWidth() != m_Width ||
- pSrcClone->GetHeight() != m_Height) {
- if (pAlphaMask) {
- pAlphaMask = pAlphaMask->StretchTo(m_Width, m_Height);
- if (!pAlphaMask)
- return false;
- }
- }
- pSrcClone = std::move(pAlphaMask);
- srcOffset = 0;
- } else if (pSrcClone->GetWidth() != m_Width ||
- pSrcClone->GetHeight() != m_Height) {
- std::unique_ptr<CFX_DIBitmap> pSrcMatched =
- pSrcClone->StretchTo(m_Width, m_Height);
- if (!pSrcMatched)
- return false;
-
- pSrcClone = std::move(pSrcMatched);
- }
- CFX_DIBitmap* pDst = this;
- if (destChannel == FXDIB_Alpha && m_pAlphaMask) {
- pDst = m_pAlphaMask;
- destOffset = 0;
- }
- int srcBytes = pSrcClone->GetBPP() / 8;
- int destBytes = pDst->GetBPP() / 8;
- for (int row = 0; row < m_Height; row++) {
- uint8_t* dest_pos = (uint8_t*)pDst->GetScanline(row) + destOffset;
- const uint8_t* src_pos = pSrcClone->GetScanline(row) + srcOffset;
- for (int col = 0; col < m_Width; col++) {
- *dest_pos = *src_pos;
- dest_pos += destBytes;
- src_pos += srcBytes;
- }
- }
- return true;
-}
-
-bool CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel, int value) {
- if (!m_pBuffer) {
- return false;
- }
- int destOffset;
- if (destChannel == FXDIB_Alpha) {
- if (IsAlphaMask()) {
- if (!ConvertFormat(FXDIB_8bppMask)) {
- return false;
- }
- destOffset = 0;
- } else {
- destOffset = 0;
- if (!ConvertFormat(IsCmykImage() ? FXDIB_Cmyka : FXDIB_Argb)) {
- return false;
- }
- if (GetFormat() == FXDIB_Argb) {
- destOffset = 3;
- }
- }
- } else {
- if (IsAlphaMask()) {
- return false;
- }
- if (GetBPP() < 24) {
- if (HasAlpha()) {
- if (!ConvertFormat(IsCmykImage() ? FXDIB_Cmyka : FXDIB_Argb)) {
- return false;
- }
-#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
- } else if (!ConvertFormat(IsCmykImage() ? FXDIB_Cmyk : FXDIB_Rgb)) {
-#else
- } else if (!ConvertFormat(IsCmykImage() ? FXDIB_Cmyk : FXDIB_Rgb32)) {
-#endif
- return false;
- }
- }
- destOffset = g_ChannelOffset[destChannel];
- }
- int Bpp = GetBPP() / 8;
- if (Bpp == 1) {
- FXSYS_memset(m_pBuffer, value, m_Height * m_Pitch);
- return true;
- }
- if (destChannel == FXDIB_Alpha && m_pAlphaMask) {
- FXSYS_memset(m_pAlphaMask->GetBuffer(), value,
- m_pAlphaMask->GetHeight() * m_pAlphaMask->GetPitch());
- return true;
- }
- for (int row = 0; row < m_Height; row++) {
- uint8_t* scan_line = m_pBuffer + row * m_Pitch + destOffset;
- for (int col = 0; col < m_Width; col++) {
- *scan_line = value;
- scan_line += Bpp;
- }
- }
- return true;
-}
-
-bool CFX_DIBitmap::MultiplyAlpha(CFX_DIBSource* pSrcBitmap) {
- if (!m_pBuffer)
- return false;
-
- ASSERT(pSrcBitmap->IsAlphaMask());
- if (!pSrcBitmap->IsAlphaMask())
- return false;
-
- if (!IsAlphaMask() && !HasAlpha())
- return LoadChannel(FXDIB_Alpha, pSrcBitmap, FXDIB_Alpha);
-
- CFX_MaybeOwned<CFX_DIBitmap> pSrcClone(
- static_cast<CFX_DIBitmap*>(pSrcBitmap));
- if (pSrcBitmap->GetWidth() != m_Width ||
- pSrcBitmap->GetHeight() != m_Height) {
- pSrcClone = pSrcBitmap->StretchTo(m_Width, m_Height);
- if (!pSrcClone)
- return false;
- }
- if (IsAlphaMask()) {
- if (!ConvertFormat(FXDIB_8bppMask))
- return false;
-
- for (int row = 0; row < m_Height; row++) {
- uint8_t* dest_scan = m_pBuffer + m_Pitch * row;
- uint8_t* src_scan = pSrcClone->m_pBuffer + pSrcClone->m_Pitch * row;
- if (pSrcClone->GetBPP() == 1) {
- for (int col = 0; col < m_Width; col++) {
- if (!((1 << (7 - col % 8)) & src_scan[col / 8]))
- dest_scan[col] = 0;
- }
- } else {
- for (int col = 0; col < m_Width; col++) {
- *dest_scan = (*dest_scan) * src_scan[col] / 255;
- dest_scan++;
- }
- }
- }
- } else {
- if (GetFormat() == FXDIB_Argb) {
- if (pSrcClone->GetBPP() == 1)
- return false;
-
- for (int row = 0; row < m_Height; row++) {
- uint8_t* dest_scan = m_pBuffer + m_Pitch * row + 3;
- uint8_t* src_scan = pSrcClone->m_pBuffer + pSrcClone->m_Pitch * row;
- for (int col = 0; col < m_Width; col++) {
- *dest_scan = (*dest_scan) * src_scan[col] / 255;
- dest_scan += 4;
- }
- }
- } else {
- m_pAlphaMask->MultiplyAlpha(pSrcClone.Get());
- }
- }
- return true;
-}
-
-bool CFX_DIBitmap::GetGrayData(void* pIccTransform) {
- if (!m_pBuffer) {
- return false;
- }
- switch (GetFormat()) {
- case FXDIB_1bppRgb: {
- if (!m_pPalette) {
- return false;
- }
- uint8_t gray[2];
- for (int i = 0; i < 2; i++) {
- int r = static_cast<uint8_t>(m_pPalette.get()[i] >> 16);
- int g = static_cast<uint8_t>(m_pPalette.get()[i] >> 8);
- int b = static_cast<uint8_t>(m_pPalette.get()[i]);
- gray[i] = static_cast<uint8_t>(FXRGB2GRAY(r, g, b));
- }
- CFX_DIBitmap* pMask = new CFX_DIBitmap;
- if (!pMask->Create(m_Width, m_Height, FXDIB_8bppMask)) {
- delete pMask;
- return false;
- }
- FXSYS_memset(pMask->GetBuffer(), gray[0], pMask->GetPitch() * m_Height);
- for (int row = 0; row < m_Height; row++) {
- uint8_t* src_pos = m_pBuffer + row * m_Pitch;
- uint8_t* dest_pos = (uint8_t*)pMask->GetScanline(row);
- for (int col = 0; col < m_Width; col++) {
- if (src_pos[col / 8] & (1 << (7 - col % 8))) {
- *dest_pos = gray[1];
- }
- dest_pos++;
- }
- }
- TakeOver(pMask);
- delete pMask;
- break;
- }
- case FXDIB_8bppRgb: {
- if (!m_pPalette) {
- return false;
- }
- uint8_t gray[256];
- for (int i = 0; i < 256; i++) {
- int r = static_cast<uint8_t>(m_pPalette.get()[i] >> 16);
- int g = static_cast<uint8_t>(m_pPalette.get()[i] >> 8);
- int b = static_cast<uint8_t>(m_pPalette.get()[i]);
- gray[i] = static_cast<uint8_t>(FXRGB2GRAY(r, g, b));
- }
- CFX_DIBitmap* pMask = new CFX_DIBitmap;
- if (!pMask->Create(m_Width, m_Height, FXDIB_8bppMask)) {
- delete pMask;
- return false;
- }
- for (int row = 0; row < m_Height; row++) {
- uint8_t* dest_pos = pMask->GetBuffer() + row * pMask->GetPitch();
- uint8_t* src_pos = m_pBuffer + row * m_Pitch;
- for (int col = 0; col < m_Width; col++) {
- *dest_pos++ = gray[*src_pos++];
- }
- }
- TakeOver(pMask);
- delete pMask;
- break;
- }
- case FXDIB_Rgb: {
- CFX_DIBitmap* pMask = new CFX_DIBitmap;
- if (!pMask->Create(m_Width, m_Height, FXDIB_8bppMask)) {
- delete pMask;
- return false;
- }
- for (int row = 0; row < m_Height; row++) {
- uint8_t* src_pos = m_pBuffer + row * m_Pitch;
- uint8_t* dest_pos = pMask->GetBuffer() + row * pMask->GetPitch();
- for (int col = 0; col < m_Width; col++) {
- *dest_pos++ = FXRGB2GRAY(src_pos[2], src_pos[1], *src_pos);
- src_pos += 3;
- }
- }
- TakeOver(pMask);
- delete pMask;
- break;
- }
- case FXDIB_Rgb32: {
- CFX_DIBitmap* pMask = new CFX_DIBitmap;
- if (!pMask->Create(m_Width, m_Height, FXDIB_8bppMask)) {
- delete pMask;
- return false;
- }
- for (int row = 0; row < m_Height; row++) {
- uint8_t* src_pos = m_pBuffer + row * m_Pitch;
- uint8_t* dest_pos = pMask->GetBuffer() + row * pMask->GetPitch();
- for (int col = 0; col < m_Width; col++) {
- *dest_pos++ = FXRGB2GRAY(src_pos[2], src_pos[1], *src_pos);
- src_pos += 4;
- }
- }
- TakeOver(pMask);
- delete pMask;
- break;
- }
- default:
- return false;
- }
- return true;
-}
-
-bool CFX_DIBitmap::MultiplyAlpha(int alpha) {
- if (!m_pBuffer) {
- return false;
- }
- switch (GetFormat()) {
- case FXDIB_1bppMask:
- if (!ConvertFormat(FXDIB_8bppMask)) {
- return false;
- }
- MultiplyAlpha(alpha);
- break;
- case FXDIB_8bppMask: {
- for (int row = 0; row < m_Height; row++) {
- uint8_t* scan_line = m_pBuffer + row * m_Pitch;
- for (int col = 0; col < m_Width; col++) {
- scan_line[col] = scan_line[col] * alpha / 255;
- }
- }
- break;
- }
- case FXDIB_Argb: {
- for (int row = 0; row < m_Height; row++) {
- uint8_t* scan_line = m_pBuffer + row * m_Pitch + 3;
- for (int col = 0; col < m_Width; col++) {
- *scan_line = (*scan_line) * alpha / 255;
- scan_line += 4;
- }
- }
- break;
- }
- default:
- if (HasAlpha()) {
- m_pAlphaMask->MultiplyAlpha(alpha);
- } else if (IsCmykImage()) {
- if (!ConvertFormat((FXDIB_Format)(GetFormat() | 0x0200))) {
- return false;
- }
- m_pAlphaMask->MultiplyAlpha(alpha);
- } else {
- if (!ConvertFormat(FXDIB_Argb)) {
- return false;
- }
- MultiplyAlpha(alpha);
- }
- break;
- }
- return true;
-}
-
-uint32_t CFX_DIBitmap::GetPixel(int x, int y) const {
- if (!m_pBuffer) {
- return 0;
- }
- uint8_t* pos = m_pBuffer + y * m_Pitch + x * GetBPP() / 8;
- switch (GetFormat()) {
- case FXDIB_1bppMask: {
- if ((*pos) & (1 << (7 - x % 8))) {
- return 0xff000000;
- }
- return 0;
- }
- case FXDIB_1bppRgb: {
- if ((*pos) & (1 << (7 - x % 8))) {
- return m_pPalette ? m_pPalette.get()[1] : 0xffffffff;
- }
- return m_pPalette ? m_pPalette.get()[0] : 0xff000000;
- }
- case FXDIB_8bppMask:
- return (*pos) << 24;
- case FXDIB_8bppRgb:
- return m_pPalette ? m_pPalette.get()[*pos]
- : (0xff000000 | ((*pos) * 0x10101));
- case FXDIB_Rgb:
- case FXDIB_Rgba:
- case FXDIB_Rgb32:
- return FXARGB_GETDIB(pos) | 0xff000000;
- case FXDIB_Argb:
- return FXARGB_GETDIB(pos);
- default:
- break;
- }
- return 0;
-}
-
-void CFX_DIBitmap::SetPixel(int x, int y, uint32_t color) {
- if (!m_pBuffer) {
- return;
- }
- if (x < 0 || x >= m_Width || y < 0 || y >= m_Height) {
- return;
- }
- uint8_t* pos = m_pBuffer + y * m_Pitch + x * GetBPP() / 8;
- switch (GetFormat()) {
- case FXDIB_1bppMask:
- if (color >> 24) {
- *pos |= 1 << (7 - x % 8);
- } else {
- *pos &= ~(1 << (7 - x % 8));
- }
- break;
- case FXDIB_1bppRgb:
- if (m_pPalette) {
- if (color == m_pPalette.get()[1]) {
- *pos |= 1 << (7 - x % 8);
- } else {
- *pos &= ~(1 << (7 - x % 8));
- }
- } else {
- if (color == 0xffffffff) {
- *pos |= 1 << (7 - x % 8);
- } else {
- *pos &= ~(1 << (7 - x % 8));
- }
- }
- break;
- case FXDIB_8bppMask:
- *pos = (uint8_t)(color >> 24);
- break;
- case FXDIB_8bppRgb: {
- if (m_pPalette) {
- for (int i = 0; i < 256; i++) {
- if (m_pPalette.get()[i] == color) {
- *pos = (uint8_t)i;
- return;
- }
- }
- *pos = 0;
- } else {
- *pos = FXRGB2GRAY(FXARGB_R(color), FXARGB_G(color), FXARGB_B(color));
- }
- break;
- }
- case FXDIB_Rgb:
- case FXDIB_Rgb32: {
- int alpha = FXARGB_A(color);
- pos[0] = (FXARGB_B(color) * alpha + pos[0] * (255 - alpha)) / 255;
- pos[1] = (FXARGB_G(color) * alpha + pos[1] * (255 - alpha)) / 255;
- pos[2] = (FXARGB_R(color) * alpha + pos[2] * (255 - alpha)) / 255;
- break;
- }
- case FXDIB_Rgba: {
- pos[0] = FXARGB_B(color);
- pos[1] = FXARGB_G(color);
- pos[2] = FXARGB_R(color);
- break;
- }
- case FXDIB_Argb:
- FXARGB_SETDIB(pos, color);
- break;
- default:
- break;
- }
-}
-
-void CFX_DIBitmap::DownSampleScanline(int line,
- uint8_t* dest_scan,
- int dest_bpp,
- int dest_width,
- bool bFlipX,
- int clip_left,
- int clip_width) const {
- if (!m_pBuffer) {
- return;
- }
- int src_Bpp = m_bpp / 8;
- uint8_t* scanline = m_pBuffer + line * m_Pitch;
- if (src_Bpp == 0) {
- for (int i = 0; i < clip_width; i++) {
- uint32_t dest_x = clip_left + i;
- uint32_t src_x = dest_x * m_Width / dest_width;
- if (bFlipX) {
- src_x = m_Width - src_x - 1;
- }
- src_x %= m_Width;
- dest_scan[i] = (scanline[src_x / 8] & (1 << (7 - src_x % 8))) ? 255 : 0;
- }
- } else if (src_Bpp == 1) {
- for (int i = 0; i < clip_width; i++) {
- uint32_t dest_x = clip_left + i;
- uint32_t src_x = dest_x * m_Width / dest_width;
- if (bFlipX) {
- src_x = m_Width - src_x - 1;
- }
- src_x %= m_Width;
- int dest_pos = i;
- if (m_pPalette) {
- if (!IsCmykImage()) {
- dest_pos *= 3;
- FX_ARGB argb = m_pPalette.get()[scanline[src_x]];
- dest_scan[dest_pos] = FXARGB_B(argb);
- dest_scan[dest_pos + 1] = FXARGB_G(argb);
- dest_scan[dest_pos + 2] = FXARGB_R(argb);
- } else {
- dest_pos *= 4;
- FX_CMYK cmyk = m_pPalette.get()[scanline[src_x]];
- dest_scan[dest_pos] = FXSYS_GetCValue(cmyk);
- dest_scan[dest_pos + 1] = FXSYS_GetMValue(cmyk);
- dest_scan[dest_pos + 2] = FXSYS_GetYValue(cmyk);
- dest_scan[dest_pos + 3] = FXSYS_GetKValue(cmyk);
- }
- } else {
- dest_scan[dest_pos] = scanline[src_x];
- }
- }
- } else {
- for (int i = 0; i < clip_width; i++) {
- uint32_t dest_x = clip_left + i;
- uint32_t src_x =
- bFlipX ? (m_Width - dest_x * m_Width / dest_width - 1) * src_Bpp
- : (dest_x * m_Width / dest_width) * src_Bpp;
- src_x %= m_Width * src_Bpp;
- int dest_pos = i * src_Bpp;
- for (int b = 0; b < src_Bpp; b++) {
- dest_scan[dest_pos + b] = scanline[src_x + b];
- }
- }
- }
-}
-
-// TODO(weili): Split this function into two for handling CMYK and RGB
-// colors separately.
-bool CFX_DIBitmap::ConvertColorScale(uint32_t forecolor, uint32_t backcolor) {
- ASSERT(!IsAlphaMask());
- if (!m_pBuffer || IsAlphaMask()) {
- return false;
- }
- // Values used for CMYK colors.
- int fc = 0;
- int fm = 0;
- int fy = 0;
- int fk = 0;
- int bc = 0;
- int bm = 0;
- int by = 0;
- int bk = 0;
- // Values used for RGB colors.
- int fr = 0;
- int fg = 0;
- int fb = 0;
- int br = 0;
- int bg = 0;
- int bb = 0;
- bool isCmykImage = IsCmykImage();
- if (isCmykImage) {
- fc = FXSYS_GetCValue(forecolor);
- fm = FXSYS_GetMValue(forecolor);
- fy = FXSYS_GetYValue(forecolor);
- fk = FXSYS_GetKValue(forecolor);
- bc = FXSYS_GetCValue(backcolor);
- bm = FXSYS_GetMValue(backcolor);
- by = FXSYS_GetYValue(backcolor);
- bk = FXSYS_GetKValue(backcolor);
- } else {
- fr = FXSYS_GetRValue(forecolor);
- fg = FXSYS_GetGValue(forecolor);
- fb = FXSYS_GetBValue(forecolor);
- br = FXSYS_GetRValue(backcolor);
- bg = FXSYS_GetGValue(backcolor);
- bb = FXSYS_GetBValue(backcolor);
- }
- if (m_bpp <= 8) {
- if (isCmykImage) {
- if (forecolor == 0xff && backcolor == 0 && !m_pPalette) {
- return true;
- }
- } else if (forecolor == 0 && backcolor == 0xffffff && !m_pPalette) {
- return true;
- }
- if (!m_pPalette) {
- BuildPalette();
- }
- int size = 1 << m_bpp;
- if (isCmykImage) {
- for (int i = 0; i < size; i++) {
- uint8_t b, g, r;
- AdobeCMYK_to_sRGB1(FXSYS_GetCValue(m_pPalette.get()[i]),
- FXSYS_GetMValue(m_pPalette.get()[i]),
- FXSYS_GetYValue(m_pPalette.get()[i]),
- FXSYS_GetKValue(m_pPalette.get()[i]), r, g, b);
- int gray = 255 - FXRGB2GRAY(r, g, b);
- m_pPalette.get()[i] = CmykEncode(
- bc + (fc - bc) * gray / 255, bm + (fm - bm) * gray / 255,
- by + (fy - by) * gray / 255, bk + (fk - bk) * gray / 255);
- }
- } else {
- for (int i = 0; i < size; i++) {
- int gray = FXRGB2GRAY(FXARGB_R(m_pPalette.get()[i]),
- FXARGB_G(m_pPalette.get()[i]),
- FXARGB_B(m_pPalette.get()[i]));
- m_pPalette.get()[i] = FXARGB_MAKE(0xff, br + (fr - br) * gray / 255,
- bg + (fg - bg) * gray / 255,
- bb + (fb - bb) * gray / 255);
- }
- }
- return true;
- }
- if (isCmykImage) {
- if (forecolor == 0xff && backcolor == 0x00) {
- for (int row = 0; row < m_Height; row++) {
- uint8_t* scanline = m_pBuffer + row * m_Pitch;
- for (int col = 0; col < m_Width; col++) {
- uint8_t b, g, r;
- AdobeCMYK_to_sRGB1(scanline[0], scanline[1], scanline[2], scanline[3],
- r, g, b);
- *scanline++ = 0;
- *scanline++ = 0;
- *scanline++ = 0;
- *scanline++ = 255 - FXRGB2GRAY(r, g, b);
- }
- }
- return true;
- }
- } else if (forecolor == 0 && backcolor == 0xffffff) {
- for (int row = 0; row < m_Height; row++) {
- uint8_t* scanline = m_pBuffer + row * m_Pitch;
- int gap = m_bpp / 8 - 2;
- for (int col = 0; col < m_Width; col++) {
- int gray = FXRGB2GRAY(scanline[2], scanline[1], scanline[0]);
- *scanline++ = gray;
- *scanline++ = gray;
- *scanline = gray;
- scanline += gap;
- }
- }
- return true;
- }
- if (isCmykImage) {
- for (int row = 0; row < m_Height; row++) {
- uint8_t* scanline = m_pBuffer + row * m_Pitch;
- for (int col = 0; col < m_Width; col++) {
- uint8_t b, g, r;
- AdobeCMYK_to_sRGB1(scanline[0], scanline[1], scanline[2], scanline[3],
- r, g, b);
- int gray = 255 - FXRGB2GRAY(r, g, b);
- *scanline++ = bc + (fc - bc) * gray / 255;
- *scanline++ = bm + (fm - bm) * gray / 255;
- *scanline++ = by + (fy - by) * gray / 255;
- *scanline++ = bk + (fk - bk) * gray / 255;
- }
- }
- } else {
- for (int row = 0; row < m_Height; row++) {
- uint8_t* scanline = m_pBuffer + row * m_Pitch;
- int gap = m_bpp / 8 - 2;
- for (int col = 0; col < m_Width; col++) {
- int gray = FXRGB2GRAY(scanline[2], scanline[1], scanline[0]);
- *scanline++ = bb + (fb - bb) * gray / 255;
- *scanline++ = bg + (fg - bg) * gray / 255;
- *scanline = br + (fr - br) * gray / 255;
- scanline += gap;
- }
- }
- }
- return true;
-}
-
-std::unique_ptr<CFX_DIBitmap> CFX_DIBSource::FlipImage(bool bXFlip,
- bool bYFlip) const {
- auto pFlipped = pdfium::MakeUnique<CFX_DIBitmap>();
- if (!pFlipped->Create(m_Width, m_Height, GetFormat()))
- return nullptr;
-
- pFlipped->SetPalette(m_pPalette.get());
- uint8_t* pDestBuffer = pFlipped->GetBuffer();
- int Bpp = m_bpp / 8;
- for (int row = 0; row < m_Height; row++) {
- const uint8_t* src_scan = GetScanline(row);
- uint8_t* dest_scan =
- pDestBuffer + m_Pitch * (bYFlip ? (m_Height - row - 1) : row);
- if (!bXFlip) {
- FXSYS_memcpy(dest_scan, src_scan, m_Pitch);
- continue;
- }
- if (m_bpp == 1) {
- FXSYS_memset(dest_scan, 0, m_Pitch);
- for (int col = 0; col < m_Width; col++)
- if (src_scan[col / 8] & (1 << (7 - col % 8))) {
- int dest_col = m_Width - col - 1;
- dest_scan[dest_col / 8] |= (1 << (7 - dest_col % 8));
- }
- } else {
- dest_scan += (m_Width - 1) * Bpp;
- if (Bpp == 1) {
- for (int col = 0; col < m_Width; col++) {
- *dest_scan = *src_scan;
- dest_scan--;
- src_scan++;
- }
- } else if (Bpp == 3) {
- for (int col = 0; col < m_Width; col++) {
- dest_scan[0] = src_scan[0];
- dest_scan[1] = src_scan[1];
- dest_scan[2] = src_scan[2];
- dest_scan -= 3;
- src_scan += 3;
- }
- } else {
- ASSERT(Bpp == 4);
- for (int col = 0; col < m_Width; col++) {
- *(uint32_t*)dest_scan = *(uint32_t*)src_scan;
- dest_scan -= 4;
- src_scan += 4;
- }
- }
- }
- }
- if (m_pAlphaMask) {
- pDestBuffer = pFlipped->m_pAlphaMask->GetBuffer();
- uint32_t dest_pitch = pFlipped->m_pAlphaMask->GetPitch();
- for (int row = 0; row < m_Height; row++) {
- const uint8_t* src_scan = m_pAlphaMask->GetScanline(row);
- uint8_t* dest_scan =
- pDestBuffer + dest_pitch * (bYFlip ? (m_Height - row - 1) : row);
- if (!bXFlip) {
- FXSYS_memcpy(dest_scan, src_scan, dest_pitch);
- continue;
- }
- dest_scan += (m_Width - 1);
- for (int col = 0; col < m_Width; col++) {
- *dest_scan = *src_scan;
- dest_scan--;
- src_scan++;
- }
- }
- }
- return pFlipped;
-}
-
-CFX_DIBExtractor::CFX_DIBExtractor(const CFX_DIBSource* pSrc) {
- if (pSrc->GetBuffer()) {
- m_pBitmap = pdfium::MakeUnique<CFX_DIBitmap>();
- if (!m_pBitmap->Create(pSrc->GetWidth(), pSrc->GetHeight(),
- pSrc->GetFormat(), pSrc->GetBuffer())) {
- m_pBitmap.reset();
- return;
- }
- m_pBitmap->SetPalette(pSrc->GetPalette());
- m_pBitmap->SetAlphaMask(pSrc->m_pAlphaMask);
- } else {
- m_pBitmap = pSrc->Clone();
- }
-}
-
-CFX_DIBExtractor::~CFX_DIBExtractor() {}
-
-CFX_FilteredDIB::CFX_FilteredDIB() : m_pSrc(nullptr) {}
-
-CFX_FilteredDIB::~CFX_FilteredDIB() {
- if (m_bAutoDropSrc) {
- delete m_pSrc;
- }
-}
-
-void CFX_FilteredDIB::LoadSrc(const CFX_DIBSource* pSrc, bool bAutoDropSrc) {
- m_pSrc = pSrc;
- m_bAutoDropSrc = bAutoDropSrc;
- m_Width = pSrc->GetWidth();
- m_Height = pSrc->GetHeight();
- FXDIB_Format format = GetDestFormat();
- m_bpp = (uint8_t)format;
- m_AlphaFlag = (uint8_t)(format >> 8);
- m_Pitch = (m_Width * (format & 0xff) + 31) / 32 * 4;
- m_pPalette.reset(GetDestPalette());
- m_Scanline.resize(m_Pitch);
-}
-
-const uint8_t* CFX_FilteredDIB::GetScanline(int line) const {
- TranslateScanline(m_pSrc->GetScanline(line), &m_Scanline);
- return m_Scanline.data();
-}
-
-void CFX_FilteredDIB::DownSampleScanline(int line,
- uint8_t* dest_scan,
- int dest_bpp,
- int dest_width,
- bool bFlipX,
- int clip_left,
- int clip_width) const {
- m_pSrc->DownSampleScanline(line, dest_scan, dest_bpp, dest_width, bFlipX,
- clip_left, clip_width);
- TranslateDownSamples(dest_scan, dest_scan, clip_width, dest_bpp);
-}
-
-CFX_ImageRenderer::CFX_ImageRenderer() {
- m_Status = 0;
- m_pIccTransform = nullptr;
- m_bRgbByteOrder = false;
- m_BlendType = FXDIB_BLEND_NORMAL;
-}
-
-CFX_ImageRenderer::~CFX_ImageRenderer() {}
-
-bool CFX_ImageRenderer::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,
- bool bRgbByteOrder,
- int alpha_flag,
- void* pIccTransform,
- int blend_type) {
- m_Matrix = *pMatrix;
- CFX_FloatRect image_rect_f = m_Matrix.GetUnitRect();
- FX_RECT image_rect = image_rect_f.GetOuterRect();
- m_ClipBox = pClipRgn ? pClipRgn->GetBox() : FX_RECT(0, 0, pDevice->GetWidth(),
- pDevice->GetHeight());
- m_ClipBox.Intersect(image_rect);
- if (m_ClipBox.IsEmpty())
- return false;
-
- m_pDevice = pDevice;
- m_pClipRgn = pClipRgn;
- m_MaskColor = mask_color;
- m_BitmapAlpha = bitmap_alpha;
- m_Matrix = *pMatrix;
- m_Flags = dib_flags;
- m_AlphaFlag = alpha_flag;
- m_pIccTransform = pIccTransform;
- m_bRgbByteOrder = bRgbByteOrder;
- m_BlendType = blend_type;
-
- if ((FXSYS_fabs(m_Matrix.b) >= 0.5f || m_Matrix.a == 0) ||
- (FXSYS_fabs(m_Matrix.c) >= 0.5f || m_Matrix.d == 0)) {
- if (FXSYS_fabs(m_Matrix.a) < FXSYS_fabs(m_Matrix.b) / 20 &&
- FXSYS_fabs(m_Matrix.d) < FXSYS_fabs(m_Matrix.c) / 20 &&
- FXSYS_fabs(m_Matrix.a) < 0.5f && FXSYS_fabs(m_Matrix.d) < 0.5f) {
- int dest_width = image_rect.Width();
- int dest_height = image_rect.Height();
- FX_RECT bitmap_clip = m_ClipBox;
- bitmap_clip.Offset(-image_rect.left, -image_rect.top);
- bitmap_clip = FXDIB_SwapClipBox(bitmap_clip, dest_width, dest_height,
- m_Matrix.c > 0, m_Matrix.b < 0);
- m_Composer.Compose(pDevice, pClipRgn, bitmap_alpha, mask_color, m_ClipBox,
- true, m_Matrix.c > 0, m_Matrix.b < 0, m_bRgbByteOrder,
- alpha_flag, pIccTransform, m_BlendType);
- m_Stretcher = pdfium::MakeUnique<CFX_ImageStretcher>(
- &m_Composer, pSource, dest_height, dest_width, bitmap_clip,
- dib_flags);
- if (!m_Stretcher->Start())
- return false;
-
- m_Status = 1;
- return true;
- }
- m_Status = 2;
- m_pTransformer.reset(
- new CFX_ImageTransformer(pSource, &m_Matrix, dib_flags, &m_ClipBox));
- m_pTransformer->Start();
- return true;
- }
-
- int dest_width = image_rect.Width();
- if (m_Matrix.a < 0)
- dest_width = -dest_width;
-
- int dest_height = image_rect.Height();
- if (m_Matrix.d > 0)
- dest_height = -dest_height;
-
- if (dest_width == 0 || dest_height == 0)
- return false;
-
- FX_RECT bitmap_clip = m_ClipBox;
- bitmap_clip.Offset(-image_rect.left, -image_rect.top);
- m_Composer.Compose(pDevice, pClipRgn, bitmap_alpha, mask_color, m_ClipBox,
- false, false, false, m_bRgbByteOrder, alpha_flag,
- pIccTransform, m_BlendType);
- m_Status = 1;
- m_Stretcher = pdfium::MakeUnique<CFX_ImageStretcher>(
- &m_Composer, pSource, dest_width, dest_height, bitmap_clip, dib_flags);
- return m_Stretcher->Start();
-}
-
-bool CFX_ImageRenderer::Continue(IFX_Pause* pPause) {
- if (m_Status == 1)
- return m_Stretcher->Continue(pPause);
-
- if (m_Status == 2) {
- if (m_pTransformer->Continue(pPause))
- return true;
-
- std::unique_ptr<CFX_DIBitmap> pBitmap(m_pTransformer->DetachBitmap());
- if (!pBitmap || !pBitmap->GetBuffer())
- return false;
-
- if (pBitmap->IsAlphaMask()) {
- if (m_BitmapAlpha != 255) {
- if (m_AlphaFlag >> 8) {
- m_AlphaFlag =
- (((uint8_t)((m_AlphaFlag & 0xff) * m_BitmapAlpha / 255)) |
- ((m_AlphaFlag >> 8) << 8));
- } else {
- m_MaskColor = FXARGB_MUL_ALPHA(m_MaskColor, m_BitmapAlpha);
- }
- }
- m_pDevice->CompositeMask(
- m_pTransformer->result().left, m_pTransformer->result().top,
- pBitmap->GetWidth(), pBitmap->GetHeight(), pBitmap.get(), m_MaskColor,
- 0, 0, m_BlendType, m_pClipRgn, m_bRgbByteOrder, m_AlphaFlag,
- m_pIccTransform);
- } else {
- if (m_BitmapAlpha != 255)
- pBitmap->MultiplyAlpha(m_BitmapAlpha);
- m_pDevice->CompositeBitmap(
- m_pTransformer->result().left, m_pTransformer->result().top,
- pBitmap->GetWidth(), pBitmap->GetHeight(), pBitmap.get(), 0, 0,
- m_BlendType, m_pClipRgn, m_bRgbByteOrder, m_pIccTransform);
- }
- return false;
- }
- return false;
-}
-
-CFX_BitmapStorer::CFX_BitmapStorer() {
-}
-
-CFX_BitmapStorer::~CFX_BitmapStorer() {
-}
-
-std::unique_ptr<CFX_DIBitmap> CFX_BitmapStorer::Detach() {
- return std::move(m_pBitmap);
-}
-
-void CFX_BitmapStorer::Replace(std::unique_ptr<CFX_DIBitmap> pBitmap) {
- m_pBitmap = std::move(pBitmap);
-}
-
-void CFX_BitmapStorer::ComposeScanline(int line,
- const uint8_t* scanline,
- const uint8_t* scan_extra_alpha) {
- uint8_t* dest_buf = const_cast<uint8_t*>(m_pBitmap->GetScanline(line));
- uint8_t* dest_alpha_buf =
- m_pBitmap->m_pAlphaMask
- ? const_cast<uint8_t*>(m_pBitmap->m_pAlphaMask->GetScanline(line))
- : nullptr;
- if (dest_buf)
- FXSYS_memcpy(dest_buf, scanline, m_pBitmap->GetPitch());
-
- if (dest_alpha_buf) {
- FXSYS_memcpy(dest_alpha_buf, scan_extra_alpha,
- m_pBitmap->m_pAlphaMask->GetPitch());
- }
-}
-
-bool CFX_BitmapStorer::SetInfo(int width,
- int height,
- FXDIB_Format src_format,
- uint32_t* pSrcPalette) {
- m_pBitmap = pdfium::MakeUnique<CFX_DIBitmap>();
- if (!m_pBitmap->Create(width, height, src_format)) {
- m_pBitmap.reset();
- return false;
- }
- if (pSrcPalette)
- m_pBitmap->SetPalette(pSrcPalette);
- return true;
-}
diff --git a/chromium/third_party/pdfium/core/fxge/dib/fx_dib_transform.cpp b/chromium/third_party/pdfium/core/fxge/dib/fx_dib_transform.cpp
deleted file mode 100644
index bd882729413..00000000000
--- a/chromium/third_party/pdfium/core/fxge/dib/fx_dib_transform.cpp
+++ /dev/null
@@ -1,963 +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
-
-#include "core/fxge/dib/dib_int.h"
-
-#include <memory>
-#include <utility>
-
-#include "core/fxge/fx_dib.h"
-#include "third_party/base/ptr_util.h"
-
-namespace {
-
-uint8_t bilinear_interpol(const uint8_t* buf,
- int row_offset_l,
- int row_offset_r,
- int src_col_l,
- int src_col_r,
- int res_x,
- int res_y,
- int bpp,
- int c_offset) {
- int i_resx = 255 - res_x;
- int col_bpp_l = src_col_l * bpp;
- int col_bpp_r = src_col_r * bpp;
- const uint8_t* buf_u = buf + row_offset_l + c_offset;
- const uint8_t* buf_d = buf + row_offset_r + c_offset;
- const uint8_t* src_pos0 = buf_u + col_bpp_l;
- const uint8_t* src_pos1 = buf_u + col_bpp_r;
- const uint8_t* src_pos2 = buf_d + col_bpp_l;
- const uint8_t* src_pos3 = buf_d + col_bpp_r;
- uint8_t r_pos_0 = (*src_pos0 * i_resx + *src_pos1 * res_x) >> 8;
- uint8_t r_pos_1 = (*src_pos2 * i_resx + *src_pos3 * res_x) >> 8;
- return (r_pos_0 * (255 - res_y) + r_pos_1 * res_y) >> 8;
-}
-
-uint8_t bicubic_interpol(const uint8_t* buf,
- int pitch,
- int pos_pixel[],
- int u_w[],
- int v_w[],
- int res_x,
- int res_y,
- int bpp,
- int c_offset) {
- int s_result = 0;
- for (int i = 0; i < 4; i++) {
- int a_result = 0;
- for (int j = 0; j < 4; j++) {
- a_result += u_w[j] * (*(uint8_t*)(buf + pos_pixel[i + 4] * pitch +
- pos_pixel[j] * bpp + c_offset));
- }
- s_result += a_result * v_w[i];
- }
- s_result >>= 16;
- return (uint8_t)(s_result < 0 ? 0 : s_result > 255 ? 255 : s_result);
-}
-
-void bicubic_get_pos_weight(int pos_pixel[],
- int u_w[],
- int v_w[],
- int src_col_l,
- int src_row_l,
- int res_x,
- int res_y,
- int stretch_width,
- int stretch_height) {
- pos_pixel[0] = src_col_l - 1;
- pos_pixel[1] = src_col_l;
- pos_pixel[2] = src_col_l + 1;
- pos_pixel[3] = src_col_l + 2;
- pos_pixel[4] = src_row_l - 1;
- pos_pixel[5] = src_row_l;
- pos_pixel[6] = src_row_l + 1;
- pos_pixel[7] = src_row_l + 2;
- for (int i = 0; i < 4; i++) {
- if (pos_pixel[i] < 0) {
- pos_pixel[i] = 0;
- }
- if (pos_pixel[i] >= stretch_width) {
- pos_pixel[i] = stretch_width - 1;
- }
- if (pos_pixel[i + 4] < 0) {
- pos_pixel[i + 4] = 0;
- }
- if (pos_pixel[i + 4] >= stretch_height) {
- pos_pixel[i + 4] = stretch_height - 1;
- }
- }
- u_w[0] = SDP_Table[256 + res_x];
- u_w[1] = SDP_Table[res_x];
- u_w[2] = SDP_Table[256 - res_x];
- u_w[3] = SDP_Table[512 - res_x];
- v_w[0] = SDP_Table[256 + res_y];
- v_w[1] = SDP_Table[res_y];
- v_w[2] = SDP_Table[256 - res_y];
- v_w[3] = SDP_Table[512 - res_y];
-}
-
-FXDIB_Format GetTransformedFormat(const CFX_DIBSource* pDrc) {
- FXDIB_Format format = pDrc->GetFormat();
- if (pDrc->IsAlphaMask()) {
- format = FXDIB_8bppMask;
- } else if (format >= 1025) {
- format = FXDIB_Cmyka;
- } else if (format <= 32 || format == FXDIB_Argb) {
- format = FXDIB_Argb;
- } else {
- format = FXDIB_Rgba;
- }
- return format;
-}
-
-} // namespace
-
-const int16_t SDP_Table[513] = {
- 256, 256, 256, 256, 256, 256, 256, 256, 256, 255, 255, 255, 255, 255, 255,
- 254, 254, 254, 254, 253, 253, 253, 252, 252, 252, 251, 251, 251, 250, 250,
- 249, 249, 249, 248, 248, 247, 247, 246, 246, 245, 244, 244, 243, 243, 242,
- 242, 241, 240, 240, 239, 238, 238, 237, 236, 236, 235, 234, 233, 233, 232,
- 231, 230, 230, 229, 228, 227, 226, 226, 225, 224, 223, 222, 221, 220, 219,
- 218, 218, 217, 216, 215, 214, 213, 212, 211, 210, 209, 208, 207, 206, 205,
- 204, 203, 202, 201, 200, 199, 198, 196, 195, 194, 193, 192, 191, 190, 189,
- 188, 186, 185, 184, 183, 182, 181, 179, 178, 177, 176, 175, 173, 172, 171,
- 170, 169, 167, 166, 165, 164, 162, 161, 160, 159, 157, 156, 155, 154, 152,
- 151, 150, 149, 147, 146, 145, 143, 142, 141, 140, 138, 137, 136, 134, 133,
- 132, 130, 129, 128, 126, 125, 124, 122, 121, 120, 119, 117, 116, 115, 113,
- 112, 111, 109, 108, 107, 105, 104, 103, 101, 100, 99, 97, 96, 95, 93,
- 92, 91, 89, 88, 87, 85, 84, 83, 81, 80, 79, 77, 76, 75, 73,
- 72, 71, 69, 68, 67, 66, 64, 63, 62, 60, 59, 58, 57, 55, 54,
- 53, 52, 50, 49, 48, 47, 45, 44, 43, 42, 40, 39, 38, 37, 36,
- 34, 33, 32, 31, 30, 28, 27, 26, 25, 24, 23, 21, 20, 19, 18,
- 17, 16, 15, 14, 13, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2,
- 1, 0, 0, -1, -2, -3, -4, -5, -6, -7, -7, -8, -9, -10, -11,
- -12, -12, -13, -14, -15, -15, -16, -17, -17, -18, -19, -19, -20, -21, -21,
- -22, -22, -23, -24, -24, -25, -25, -26, -26, -27, -27, -27, -28, -28, -29,
- -29, -30, -30, -30, -31, -31, -31, -32, -32, -32, -33, -33, -33, -33, -34,
- -34, -34, -34, -35, -35, -35, -35, -35, -36, -36, -36, -36, -36, -36, -36,
- -36, -36, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37,
- -37, -37, -37, -37, -37, -37, -37, -37, -36, -36, -36, -36, -36, -36, -36,
- -36, -36, -35, -35, -35, -35, -35, -35, -34, -34, -34, -34, -34, -33, -33,
- -33, -33, -33, -32, -32, -32, -32, -31, -31, -31, -31, -30, -30, -30, -30,
- -29, -29, -29, -29, -28, -28, -28, -27, -27, -27, -27, -26, -26, -26, -25,
- -25, -25, -24, -24, -24, -23, -23, -23, -22, -22, -22, -22, -21, -21, -21,
- -20, -20, -20, -19, -19, -19, -18, -18, -18, -17, -17, -17, -16, -16, -16,
- -15, -15, -15, -14, -14, -14, -13, -13, -13, -12, -12, -12, -11, -11, -11,
- -10, -10, -10, -9, -9, -9, -9, -8, -8, -8, -7, -7, -7, -7, -6,
- -6, -6, -6, -5, -5, -5, -5, -4, -4, -4, -4, -3, -3, -3, -3,
- -3, -2, -2, -2, -2, -2, -1, -1, -1, -1, -1, -1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0,
-};
-
-class CFX_BilinearMatrix : public CPDF_FixedMatrix {
- public:
- CFX_BilinearMatrix(const CFX_Matrix& src, int bits)
- : CPDF_FixedMatrix(src, bits) {}
- inline void Transform(int x,
- int y,
- int& x1,
- int& y1,
- int& res_x,
- int& res_y) {
- x1 = a * x + c * y + e + base / 2;
- y1 = b * x + d * y + f + base / 2;
- res_x = x1 % base;
- res_y = y1 % base;
- if (res_x < 0 && res_x > -base) {
- res_x = base + res_x;
- }
- if (res_y < 0 && res_x > -base) {
- res_y = base + res_y;
- }
- x1 /= base;
- y1 /= base;
- }
-};
-
-std::unique_ptr<CFX_DIBitmap> CFX_DIBSource::SwapXY(
- bool bXFlip,
- bool bYFlip,
- const FX_RECT* pDestClip) const {
- FX_RECT dest_clip(0, 0, m_Height, m_Width);
- if (pDestClip)
- dest_clip.Intersect(*pDestClip);
- if (dest_clip.IsEmpty())
- return nullptr;
-
- auto pTransBitmap = pdfium::MakeUnique<CFX_DIBitmap>();
- int result_height = dest_clip.Height();
- int result_width = dest_clip.Width();
- if (!pTransBitmap->Create(result_width, result_height, GetFormat()))
- return nullptr;
-
- pTransBitmap->SetPalette(m_pPalette.get());
- int dest_pitch = pTransBitmap->GetPitch();
- uint8_t* dest_buf = pTransBitmap->GetBuffer();
- int row_start = bXFlip ? m_Height - dest_clip.right : dest_clip.left;
- int row_end = bXFlip ? m_Height - dest_clip.left : dest_clip.right;
- int col_start = bYFlip ? m_Width - dest_clip.bottom : dest_clip.top;
- int col_end = bYFlip ? m_Width - dest_clip.top : dest_clip.bottom;
- if (GetBPP() == 1) {
- FXSYS_memset(dest_buf, 0xff, dest_pitch * result_height);
- for (int row = row_start; row < row_end; row++) {
- const uint8_t* src_scan = GetScanline(row);
- int dest_col = (bXFlip ? dest_clip.right - (row - row_start) - 1 : row) -
- dest_clip.left;
- uint8_t* dest_scan = dest_buf;
- if (bYFlip) {
- dest_scan += (result_height - 1) * dest_pitch;
- }
- int dest_step = bYFlip ? -dest_pitch : dest_pitch;
- for (int col = col_start; col < col_end; col++) {
- if (!(src_scan[col / 8] & (1 << (7 - col % 8)))) {
- dest_scan[dest_col / 8] &= ~(1 << (7 - dest_col % 8));
- }
- dest_scan += dest_step;
- }
- }
- } else {
- int nBytes = GetBPP() / 8;
- int dest_step = bYFlip ? -dest_pitch : dest_pitch;
- if (nBytes == 3) {
- dest_step -= 2;
- }
- for (int row = row_start; row < row_end; row++) {
- int dest_col = (bXFlip ? dest_clip.right - (row - row_start) - 1 : row) -
- dest_clip.left;
- uint8_t* dest_scan = dest_buf + dest_col * nBytes;
- if (bYFlip) {
- dest_scan += (result_height - 1) * dest_pitch;
- }
- if (nBytes == 4) {
- uint32_t* src_scan = (uint32_t*)GetScanline(row) + col_start;
- for (int col = col_start; col < col_end; col++) {
- *(uint32_t*)dest_scan = *src_scan++;
- dest_scan += dest_step;
- }
- } else {
- const uint8_t* src_scan = GetScanline(row) + col_start * nBytes;
- if (nBytes == 1) {
- for (int col = col_start; col < col_end; col++) {
- *dest_scan = *src_scan++;
- dest_scan += dest_step;
- }
- } else {
- for (int col = col_start; col < col_end; col++) {
- *dest_scan++ = *src_scan++;
- *dest_scan++ = *src_scan++;
- *dest_scan = *src_scan++;
- dest_scan += dest_step;
- }
- }
- }
- }
- }
- if (m_pAlphaMask) {
- dest_pitch = pTransBitmap->m_pAlphaMask->GetPitch();
- dest_buf = pTransBitmap->m_pAlphaMask->GetBuffer();
- int dest_step = bYFlip ? -dest_pitch : dest_pitch;
- for (int row = row_start; row < row_end; row++) {
- int dest_col = (bXFlip ? dest_clip.right - (row - row_start) - 1 : row) -
- dest_clip.left;
- uint8_t* dest_scan = dest_buf + dest_col;
- if (bYFlip) {
- dest_scan += (result_height - 1) * dest_pitch;
- }
- const uint8_t* src_scan = m_pAlphaMask->GetScanline(row) + col_start;
- for (int col = col_start; col < col_end; col++) {
- *dest_scan = *src_scan++;
- dest_scan += dest_step;
- }
- }
- }
- return pTransBitmap;
-}
-
-#define FIX16_005 0.05f
-FX_RECT FXDIB_SwapClipBox(FX_RECT& clip,
- int width,
- int height,
- bool bFlipX,
- bool bFlipY) {
- FX_RECT rect;
- if (bFlipY) {
- rect.left = height - clip.top;
- rect.right = height - clip.bottom;
- } else {
- rect.left = clip.top;
- rect.right = clip.bottom;
- }
- if (bFlipX) {
- rect.top = width - clip.left;
- rect.bottom = width - clip.right;
- } else {
- rect.top = clip.left;
- rect.bottom = clip.right;
- }
- rect.Normalize();
- return rect;
-}
-
-std::unique_ptr<CFX_DIBitmap> CFX_DIBSource::TransformTo(
- const CFX_Matrix* pDestMatrix,
- int& result_left,
- int& result_top,
- uint32_t flags,
- const FX_RECT* pDestClip) const {
- CFX_ImageTransformer transformer(this, pDestMatrix, flags, pDestClip);
- transformer.Start();
- transformer.Continue(nullptr);
- result_left = transformer.result().left;
- result_top = transformer.result().top;
- return transformer.DetachBitmap();
-}
-
-std::unique_ptr<CFX_DIBitmap> CFX_DIBSource::StretchTo(
- int dest_width,
- int dest_height,
- uint32_t flags,
- const FX_RECT* pClip) const {
- FX_RECT clip_rect(0, 0, FXSYS_abs(dest_width), FXSYS_abs(dest_height));
- if (pClip)
- clip_rect.Intersect(*pClip);
-
- if (clip_rect.IsEmpty())
- return nullptr;
-
- if (dest_width == m_Width && dest_height == m_Height)
- return Clone(&clip_rect);
-
- CFX_BitmapStorer storer;
- CFX_ImageStretcher stretcher(&storer, this, dest_width, dest_height,
- clip_rect, flags);
- if (stretcher.Start())
- stretcher.Continue(nullptr);
-
- return storer.Detach();
-}
-
-CFX_ImageTransformer::CFX_ImageTransformer(const CFX_DIBSource* pSrc,
- const CFX_Matrix* pMatrix,
- int flags,
- const FX_RECT* pClip)
- : m_pSrc(pSrc),
- m_pMatrix(pMatrix),
- m_pClip(pClip),
- m_Flags(flags),
- m_Status(0) {}
-
-CFX_ImageTransformer::~CFX_ImageTransformer() {}
-
-bool CFX_ImageTransformer::Start() {
- CFX_FloatRect unit_rect = m_pMatrix->GetUnitRect();
- FX_RECT result_rect = unit_rect.GetClosestRect();
- FX_RECT result_clip = result_rect;
- if (m_pClip)
- result_clip.Intersect(*m_pClip);
-
- if (result_clip.IsEmpty())
- return false;
-
- m_result = result_clip;
- if (FXSYS_fabs(m_pMatrix->a) < FXSYS_fabs(m_pMatrix->b) / 20 &&
- FXSYS_fabs(m_pMatrix->d) < FXSYS_fabs(m_pMatrix->c) / 20 &&
- FXSYS_fabs(m_pMatrix->a) < 0.5f && FXSYS_fabs(m_pMatrix->d) < 0.5f) {
- int dest_width = result_rect.Width();
- int dest_height = result_rect.Height();
- result_clip.Offset(-result_rect.left, -result_rect.top);
- result_clip = FXDIB_SwapClipBox(result_clip, dest_width, dest_height,
- m_pMatrix->c > 0, m_pMatrix->b < 0);
- m_Stretcher = pdfium::MakeUnique<CFX_ImageStretcher>(
- &m_Storer, m_pSrc, dest_height, dest_width, result_clip, m_Flags);
- m_Stretcher->Start();
- m_Status = 1;
- return true;
- }
- if (FXSYS_fabs(m_pMatrix->b) < FIX16_005 &&
- FXSYS_fabs(m_pMatrix->c) < FIX16_005) {
- int dest_width = m_pMatrix->a > 0 ? (int)FXSYS_ceil(m_pMatrix->a)
- : (int)FXSYS_floor(m_pMatrix->a);
- int dest_height = m_pMatrix->d > 0 ? (int)-FXSYS_ceil(m_pMatrix->d)
- : (int)-FXSYS_floor(m_pMatrix->d);
- result_clip.Offset(-result_rect.left, -result_rect.top);
- m_Stretcher = pdfium::MakeUnique<CFX_ImageStretcher>(
- &m_Storer, m_pSrc, dest_width, dest_height, result_clip, m_Flags);
- m_Stretcher->Start();
- m_Status = 2;
- return true;
- }
- int stretch_width = (int)FXSYS_ceil(FXSYS_sqrt2(m_pMatrix->a, m_pMatrix->b));
- int stretch_height = (int)FXSYS_ceil(FXSYS_sqrt2(m_pMatrix->c, m_pMatrix->d));
- CFX_Matrix stretch2dest(1.0f, 0.0f, 0.0f, -1.0f, 0.0f,
- (FX_FLOAT)(stretch_height));
- stretch2dest.Concat(
- CFX_Matrix(m_pMatrix->a / stretch_width, m_pMatrix->b / stretch_width,
- m_pMatrix->c / stretch_height, m_pMatrix->d / stretch_height,
- m_pMatrix->e, m_pMatrix->f));
- m_dest2stretch.SetReverse(stretch2dest);
-
- CFX_FloatRect clip_rect_f(result_clip);
- m_dest2stretch.TransformRect(clip_rect_f);
- m_StretchClip = clip_rect_f.GetOuterRect();
- m_StretchClip.Intersect(0, 0, stretch_width, stretch_height);
- m_Stretcher = pdfium::MakeUnique<CFX_ImageStretcher>(
- &m_Storer, m_pSrc, stretch_width, stretch_height, m_StretchClip, m_Flags);
- m_Stretcher->Start();
- m_Status = 3;
- return true;
-}
-
-bool CFX_ImageTransformer::Continue(IFX_Pause* pPause) {
- if (m_Status == 1) {
- if (m_Stretcher->Continue(pPause))
- return true;
-
- if (m_Storer.GetBitmap()) {
- m_Storer.Replace(
- m_Storer.GetBitmap()->SwapXY(m_pMatrix->c > 0, m_pMatrix->b < 0));
- }
- return false;
- }
-
- if (m_Status == 2)
- return m_Stretcher->Continue(pPause);
-
- if (m_Status != 3)
- return false;
-
- if (m_Stretcher->Continue(pPause))
- return true;
-
- int stretch_width = m_StretchClip.Width();
- int stretch_height = m_StretchClip.Height();
- if (!m_Storer.GetBitmap())
- return false;
-
- const uint8_t* stretch_buf = m_Storer.GetBitmap()->GetBuffer();
- const uint8_t* stretch_buf_mask = nullptr;
- if (m_Storer.GetBitmap()->m_pAlphaMask)
- stretch_buf_mask = m_Storer.GetBitmap()->m_pAlphaMask->GetBuffer();
-
- int stretch_pitch = m_Storer.GetBitmap()->GetPitch();
- std::unique_ptr<CFX_DIBitmap> pTransformed(new CFX_DIBitmap);
- FXDIB_Format transformF = GetTransformedFormat(m_Stretcher->source());
- if (!pTransformed->Create(m_result.Width(), m_result.Height(), transformF))
- return false;
-
- pTransformed->Clear(0);
- if (pTransformed->m_pAlphaMask)
- pTransformed->m_pAlphaMask->Clear(0);
-
- CFX_Matrix result2stretch(1.0f, 0.0f, 0.0f, 1.0f, (FX_FLOAT)(m_result.left),
- (FX_FLOAT)(m_result.top));
- result2stretch.Concat(m_dest2stretch);
- result2stretch.Translate(-m_StretchClip.left, -m_StretchClip.top);
- if (!stretch_buf_mask && pTransformed->m_pAlphaMask) {
- pTransformed->m_pAlphaMask->Clear(0xff000000);
- } else if (pTransformed->m_pAlphaMask) {
- int stretch_pitch_mask = m_Storer.GetBitmap()->m_pAlphaMask->GetPitch();
- if (!(m_Flags & FXDIB_DOWNSAMPLE) && !(m_Flags & FXDIB_BICUBIC_INTERPOL)) {
- CFX_BilinearMatrix result2stretch_fix(result2stretch, 8);
- for (int row = 0; row < m_result.Height(); row++) {
- uint8_t* dest_pos_mask =
- (uint8_t*)pTransformed->m_pAlphaMask->GetScanline(row);
- for (int col = 0; col < m_result.Width(); col++) {
- int src_col_l, src_row_l, res_x, res_y;
- result2stretch_fix.Transform(col, row, src_col_l, src_row_l, res_x,
- res_y);
- if (src_col_l >= 0 && src_col_l <= stretch_width && src_row_l >= 0 &&
- src_row_l <= stretch_height) {
- if (src_col_l == stretch_width) {
- src_col_l--;
- }
- if (src_row_l == stretch_height) {
- src_row_l--;
- }
- int src_col_r = src_col_l + 1;
- int src_row_r = src_row_l + 1;
- if (src_col_r == stretch_width) {
- src_col_r--;
- }
- if (src_row_r == stretch_height) {
- src_row_r--;
- }
- int row_offset_l = src_row_l * stretch_pitch_mask;
- int row_offset_r = src_row_r * stretch_pitch_mask;
- *dest_pos_mask =
- bilinear_interpol(stretch_buf_mask, row_offset_l, row_offset_r,
- src_col_l, src_col_r, res_x, res_y, 1, 0);
- }
- dest_pos_mask++;
- }
- }
- } else if (m_Flags & FXDIB_BICUBIC_INTERPOL) {
- CFX_BilinearMatrix result2stretch_fix(result2stretch, 8);
- for (int row = 0; row < m_result.Height(); row++) {
- uint8_t* dest_pos_mask =
- (uint8_t*)pTransformed->m_pAlphaMask->GetScanline(row);
- for (int col = 0; col < m_result.Width(); col++) {
- int src_col_l, src_row_l, res_x, res_y;
- result2stretch_fix.Transform(col, row, src_col_l, src_row_l, res_x,
- res_y);
- if (src_col_l >= 0 && src_col_l <= stretch_width && src_row_l >= 0 &&
- src_row_l <= stretch_height) {
- int pos_pixel[8];
- int u_w[4], v_w[4];
- if (src_col_l == stretch_width) {
- src_col_l--;
- }
- if (src_row_l == stretch_height) {
- src_row_l--;
- }
- bicubic_get_pos_weight(pos_pixel, u_w, v_w, src_col_l, src_row_l,
- res_x, res_y, stretch_width, stretch_height);
- *dest_pos_mask =
- bicubic_interpol(stretch_buf_mask, stretch_pitch_mask,
- pos_pixel, u_w, v_w, res_x, res_y, 1, 0);
- }
- dest_pos_mask++;
- }
- }
- } else {
- CPDF_FixedMatrix result2stretch_fix(result2stretch, 8);
- for (int row = 0; row < m_result.Height(); row++) {
- uint8_t* dest_pos_mask =
- (uint8_t*)pTransformed->m_pAlphaMask->GetScanline(row);
- for (int col = 0; col < m_result.Width(); col++) {
- int src_col, src_row;
- result2stretch_fix.Transform(col, row, src_col, src_row);
- if (src_col >= 0 && src_col <= stretch_width && src_row >= 0 &&
- src_row <= stretch_height) {
- if (src_col == stretch_width) {
- src_col--;
- }
- if (src_row == stretch_height) {
- src_row--;
- }
- *dest_pos_mask =
- stretch_buf_mask[src_row * stretch_pitch_mask + src_col];
- }
- dest_pos_mask++;
- }
- }
- }
- }
- if (m_Storer.GetBitmap()->IsAlphaMask()) {
- if (!(m_Flags & FXDIB_DOWNSAMPLE) && !(m_Flags & FXDIB_BICUBIC_INTERPOL)) {
- CFX_BilinearMatrix result2stretch_fix(result2stretch, 8);
- for (int row = 0; row < m_result.Height(); row++) {
- uint8_t* dest_scan = (uint8_t*)pTransformed->GetScanline(row);
- for (int col = 0; col < m_result.Width(); col++) {
- int src_col_l, src_row_l, res_x, res_y;
- result2stretch_fix.Transform(col, row, src_col_l, src_row_l, res_x,
- res_y);
- if (src_col_l >= 0 && src_col_l <= stretch_width && src_row_l >= 0 &&
- src_row_l <= stretch_height) {
- if (src_col_l == stretch_width) {
- src_col_l--;
- }
- if (src_row_l == stretch_height) {
- src_row_l--;
- }
- int src_col_r = src_col_l + 1;
- int src_row_r = src_row_l + 1;
- if (src_col_r == stretch_width) {
- src_col_r--;
- }
- if (src_row_r == stretch_height) {
- src_row_r--;
- }
- int row_offset_l = src_row_l * stretch_pitch;
- int row_offset_r = src_row_r * stretch_pitch;
- *dest_scan =
- bilinear_interpol(stretch_buf, row_offset_l, row_offset_r,
- src_col_l, src_col_r, res_x, res_y, 1, 0);
- }
- dest_scan++;
- }
- }
- } else if (m_Flags & FXDIB_BICUBIC_INTERPOL) {
- CFX_BilinearMatrix result2stretch_fix(result2stretch, 8);
- for (int row = 0; row < m_result.Height(); row++) {
- uint8_t* dest_scan = (uint8_t*)pTransformed->GetScanline(row);
- for (int col = 0; col < m_result.Width(); col++) {
- int src_col_l, src_row_l, res_x, res_y;
- result2stretch_fix.Transform(col, row, src_col_l, src_row_l, res_x,
- res_y);
- if (src_col_l >= 0 && src_col_l <= stretch_width && src_row_l >= 0 &&
- src_row_l <= stretch_height) {
- int pos_pixel[8];
- int u_w[4], v_w[4];
- if (src_col_l == stretch_width) {
- src_col_l--;
- }
- if (src_row_l == stretch_height) {
- src_row_l--;
- }
- bicubic_get_pos_weight(pos_pixel, u_w, v_w, src_col_l, src_row_l,
- res_x, res_y, stretch_width, stretch_height);
- *dest_scan = bicubic_interpol(stretch_buf, stretch_pitch, pos_pixel,
- u_w, v_w, res_x, res_y, 1, 0);
- }
- dest_scan++;
- }
- }
- } else {
- CPDF_FixedMatrix result2stretch_fix(result2stretch, 8);
- for (int row = 0; row < m_result.Height(); row++) {
- uint8_t* dest_scan = (uint8_t*)pTransformed->GetScanline(row);
- for (int col = 0; col < m_result.Width(); col++) {
- int src_col, src_row;
- result2stretch_fix.Transform(col, row, src_col, src_row);
- if (src_col >= 0 && src_col <= stretch_width && src_row >= 0 &&
- src_row <= stretch_height) {
- if (src_col == stretch_width) {
- src_col--;
- }
- if (src_row == stretch_height) {
- src_row--;
- }
- const uint8_t* src_pixel =
- stretch_buf + stretch_pitch * src_row + src_col;
- *dest_scan = *src_pixel;
- }
- dest_scan++;
- }
- }
- }
- } else {
- int Bpp = m_Storer.GetBitmap()->GetBPP() / 8;
- if (Bpp == 1) {
- uint32_t argb[256];
- FX_ARGB* pPal = m_Storer.GetBitmap()->GetPalette();
- if (pPal) {
- for (int i = 0; i < 256; i++) {
- argb[i] = pPal[i];
- }
- } else {
- if (m_Storer.GetBitmap()->IsCmykImage()) {
- for (int i = 0; i < 256; i++) {
- argb[i] = 255 - i;
- }
- } else {
- for (int i = 0; i < 256; i++) {
- argb[i] = 0xff000000 | (i * 0x010101);
- }
- }
- }
- int destBpp = pTransformed->GetBPP() / 8;
- if (!(m_Flags & FXDIB_DOWNSAMPLE) &&
- !(m_Flags & FXDIB_BICUBIC_INTERPOL)) {
- CFX_BilinearMatrix result2stretch_fix(result2stretch, 8);
- for (int row = 0; row < m_result.Height(); row++) {
- uint8_t* dest_pos = (uint8_t*)pTransformed->GetScanline(row);
- for (int col = 0; col < m_result.Width(); col++) {
- int src_col_l, src_row_l, res_x, res_y;
- result2stretch_fix.Transform(col, row, src_col_l, src_row_l, res_x,
- res_y);
- if (src_col_l >= 0 && src_col_l <= stretch_width &&
- src_row_l >= 0 && src_row_l <= stretch_height) {
- if (src_col_l == stretch_width) {
- src_col_l--;
- }
- if (src_row_l == stretch_height) {
- src_row_l--;
- }
- int src_col_r = src_col_l + 1;
- int src_row_r = src_row_l + 1;
- if (src_col_r == stretch_width) {
- src_col_r--;
- }
- if (src_row_r == stretch_height) {
- src_row_r--;
- }
- int row_offset_l = src_row_l * stretch_pitch;
- int row_offset_r = src_row_r * stretch_pitch;
- uint32_t r_bgra_cmyk = argb[bilinear_interpol(
- stretch_buf, row_offset_l, row_offset_r, src_col_l, src_col_r,
- res_x, res_y, 1, 0)];
- if (transformF == FXDIB_Rgba) {
- dest_pos[0] = (uint8_t)(r_bgra_cmyk >> 24);
- dest_pos[1] = (uint8_t)(r_bgra_cmyk >> 16);
- dest_pos[2] = (uint8_t)(r_bgra_cmyk >> 8);
- } else {
- *(uint32_t*)dest_pos = r_bgra_cmyk;
- }
- }
- dest_pos += destBpp;
- }
- }
- } else if (m_Flags & FXDIB_BICUBIC_INTERPOL) {
- CFX_BilinearMatrix result2stretch_fix(result2stretch, 8);
- for (int row = 0; row < m_result.Height(); row++) {
- uint8_t* dest_pos = (uint8_t*)pTransformed->GetScanline(row);
- for (int col = 0; col < m_result.Width(); col++) {
- int src_col_l, src_row_l, res_x, res_y;
- result2stretch_fix.Transform(col, row, src_col_l, src_row_l, res_x,
- res_y);
- if (src_col_l >= 0 && src_col_l <= stretch_width &&
- src_row_l >= 0 && src_row_l <= stretch_height) {
- int pos_pixel[8];
- int u_w[4], v_w[4];
- if (src_col_l == stretch_width) {
- src_col_l--;
- }
- if (src_row_l == stretch_height) {
- src_row_l--;
- }
- bicubic_get_pos_weight(pos_pixel, u_w, v_w, src_col_l, src_row_l,
- res_x, res_y, stretch_width,
- stretch_height);
- uint32_t r_bgra_cmyk =
- argb[bicubic_interpol(stretch_buf, stretch_pitch, pos_pixel,
- u_w, v_w, res_x, res_y, 1, 0)];
- if (transformF == FXDIB_Rgba) {
- dest_pos[0] = (uint8_t)(r_bgra_cmyk >> 24);
- dest_pos[1] = (uint8_t)(r_bgra_cmyk >> 16);
- dest_pos[2] = (uint8_t)(r_bgra_cmyk >> 8);
- } else {
- *(uint32_t*)dest_pos = r_bgra_cmyk;
- }
- }
- dest_pos += destBpp;
- }
- }
- } else {
- CPDF_FixedMatrix result2stretch_fix(result2stretch, 8);
- for (int row = 0; row < m_result.Height(); row++) {
- uint8_t* dest_pos = (uint8_t*)pTransformed->GetScanline(row);
- for (int col = 0; col < m_result.Width(); col++) {
- int src_col, src_row;
- result2stretch_fix.Transform(col, row, src_col, src_row);
- if (src_col >= 0 && src_col <= stretch_width && src_row >= 0 &&
- src_row <= stretch_height) {
- if (src_col == stretch_width) {
- src_col--;
- }
- if (src_row == stretch_height) {
- src_row--;
- }
- uint32_t r_bgra_cmyk =
- argb[stretch_buf[src_row * stretch_pitch + src_col]];
- if (transformF == FXDIB_Rgba) {
- dest_pos[0] = (uint8_t)(r_bgra_cmyk >> 24);
- dest_pos[1] = (uint8_t)(r_bgra_cmyk >> 16);
- dest_pos[2] = (uint8_t)(r_bgra_cmyk >> 8);
- } else {
- *(uint32_t*)dest_pos = r_bgra_cmyk;
- }
- }
- dest_pos += destBpp;
- }
- }
- }
- } else {
- bool bHasAlpha = m_Storer.GetBitmap()->HasAlpha();
- int destBpp = pTransformed->GetBPP() / 8;
- if (!(m_Flags & FXDIB_DOWNSAMPLE) &&
- !(m_Flags & FXDIB_BICUBIC_INTERPOL)) {
- CFX_BilinearMatrix result2stretch_fix(result2stretch, 8);
- for (int row = 0; row < m_result.Height(); row++) {
- uint8_t* dest_pos = (uint8_t*)pTransformed->GetScanline(row);
- for (int col = 0; col < m_result.Width(); col++) {
- int src_col_l, src_row_l, res_x, res_y, r_pos_k_r = 0;
- result2stretch_fix.Transform(col, row, src_col_l, src_row_l, res_x,
- res_y);
- if (src_col_l >= 0 && src_col_l <= stretch_width &&
- src_row_l >= 0 && src_row_l <= stretch_height) {
- if (src_col_l == stretch_width) {
- src_col_l--;
- }
- if (src_row_l == stretch_height) {
- src_row_l--;
- }
- int src_col_r = src_col_l + 1;
- int src_row_r = src_row_l + 1;
- if (src_col_r == stretch_width) {
- src_col_r--;
- }
- if (src_row_r == stretch_height) {
- src_row_r--;
- }
- int row_offset_l = src_row_l * stretch_pitch;
- int row_offset_r = src_row_r * stretch_pitch;
- uint8_t r_pos_red_y_r =
- bilinear_interpol(stretch_buf, row_offset_l, row_offset_r,
- src_col_l, src_col_r, res_x, res_y, Bpp, 2);
- uint8_t r_pos_green_m_r =
- bilinear_interpol(stretch_buf, row_offset_l, row_offset_r,
- src_col_l, src_col_r, res_x, res_y, Bpp, 1);
- uint8_t r_pos_blue_c_r =
- bilinear_interpol(stretch_buf, row_offset_l, row_offset_r,
- src_col_l, src_col_r, res_x, res_y, Bpp, 0);
- if (bHasAlpha) {
- if (transformF != FXDIB_Argb) {
- if (transformF == FXDIB_Rgba) {
- dest_pos[0] = r_pos_blue_c_r;
- dest_pos[1] = r_pos_green_m_r;
- dest_pos[2] = r_pos_red_y_r;
- } else {
- r_pos_k_r = bilinear_interpol(
- stretch_buf, row_offset_l, row_offset_r, src_col_l,
- src_col_r, res_x, res_y, Bpp, 3);
- *(uint32_t*)dest_pos =
- FXCMYK_TODIB(CmykEncode(r_pos_blue_c_r, r_pos_green_m_r,
- r_pos_red_y_r, r_pos_k_r));
- }
- } else {
- uint8_t r_pos_a_r = bilinear_interpol(
- stretch_buf, row_offset_l, row_offset_r, src_col_l,
- src_col_r, res_x, res_y, Bpp, 3);
- *(uint32_t*)dest_pos = FXARGB_TODIB(
- FXARGB_MAKE(r_pos_a_r, r_pos_red_y_r, r_pos_green_m_r,
- r_pos_blue_c_r));
- }
- } else {
- r_pos_k_r = 0xff;
- if (transformF == FXDIB_Cmyka) {
- r_pos_k_r = bilinear_interpol(
- stretch_buf, row_offset_l, row_offset_r, src_col_l,
- src_col_r, res_x, res_y, Bpp, 3);
- *(uint32_t*)dest_pos =
- FXCMYK_TODIB(CmykEncode(r_pos_blue_c_r, r_pos_green_m_r,
- r_pos_red_y_r, r_pos_k_r));
- } else {
- *(uint32_t*)dest_pos = FXARGB_TODIB(
- FXARGB_MAKE(r_pos_k_r, r_pos_red_y_r, r_pos_green_m_r,
- r_pos_blue_c_r));
- }
- }
- }
- dest_pos += destBpp;
- }
- }
- } else if (m_Flags & FXDIB_BICUBIC_INTERPOL) {
- CFX_BilinearMatrix result2stretch_fix(result2stretch, 8);
- for (int row = 0; row < m_result.Height(); row++) {
- uint8_t* dest_pos = (uint8_t*)pTransformed->GetScanline(row);
- for (int col = 0; col < m_result.Width(); col++) {
- int src_col_l, src_row_l, res_x, res_y, r_pos_k_r = 0;
- result2stretch_fix.Transform(col, row, src_col_l, src_row_l, res_x,
- res_y);
- if (src_col_l >= 0 && src_col_l <= stretch_width &&
- src_row_l >= 0 && src_row_l <= stretch_height) {
- int pos_pixel[8];
- int u_w[4], v_w[4];
- if (src_col_l == stretch_width) {
- src_col_l--;
- }
- if (src_row_l == stretch_height) {
- src_row_l--;
- }
- bicubic_get_pos_weight(pos_pixel, u_w, v_w, src_col_l, src_row_l,
- res_x, res_y, stretch_width,
- stretch_height);
- uint8_t r_pos_red_y_r =
- bicubic_interpol(stretch_buf, stretch_pitch, pos_pixel, u_w,
- v_w, res_x, res_y, Bpp, 2);
- uint8_t r_pos_green_m_r =
- bicubic_interpol(stretch_buf, stretch_pitch, pos_pixel, u_w,
- v_w, res_x, res_y, Bpp, 1);
- uint8_t r_pos_blue_c_r =
- bicubic_interpol(stretch_buf, stretch_pitch, pos_pixel, u_w,
- v_w, res_x, res_y, Bpp, 0);
- if (bHasAlpha) {
- if (transformF != FXDIB_Argb) {
- if (transformF == FXDIB_Rgba) {
- dest_pos[0] = r_pos_blue_c_r;
- dest_pos[1] = r_pos_green_m_r;
- dest_pos[2] = r_pos_red_y_r;
- } else {
- r_pos_k_r =
- bicubic_interpol(stretch_buf, stretch_pitch, pos_pixel,
- u_w, v_w, res_x, res_y, Bpp, 3);
- *(uint32_t*)dest_pos =
- FXCMYK_TODIB(CmykEncode(r_pos_blue_c_r, r_pos_green_m_r,
- r_pos_red_y_r, r_pos_k_r));
- }
- } else {
- uint8_t r_pos_a_r =
- bicubic_interpol(stretch_buf, stretch_pitch, pos_pixel,
- u_w, v_w, res_x, res_y, Bpp, 3);
- *(uint32_t*)dest_pos = FXARGB_TODIB(
- FXARGB_MAKE(r_pos_a_r, r_pos_red_y_r, r_pos_green_m_r,
- r_pos_blue_c_r));
- }
- } else {
- r_pos_k_r = 0xff;
- if (transformF == FXDIB_Cmyka) {
- r_pos_k_r =
- bicubic_interpol(stretch_buf, stretch_pitch, pos_pixel,
- u_w, v_w, res_x, res_y, Bpp, 3);
- *(uint32_t*)dest_pos =
- FXCMYK_TODIB(CmykEncode(r_pos_blue_c_r, r_pos_green_m_r,
- r_pos_red_y_r, r_pos_k_r));
- } else {
- *(uint32_t*)dest_pos = FXARGB_TODIB(
- FXARGB_MAKE(r_pos_k_r, r_pos_red_y_r, r_pos_green_m_r,
- r_pos_blue_c_r));
- }
- }
- }
- dest_pos += destBpp;
- }
- }
- } else {
- CPDF_FixedMatrix result2stretch_fix(result2stretch, 8);
- for (int row = 0; row < m_result.Height(); row++) {
- uint8_t* dest_pos = (uint8_t*)pTransformed->GetScanline(row);
- for (int col = 0; col < m_result.Width(); col++) {
- int src_col, src_row;
- result2stretch_fix.Transform(col, row, src_col, src_row);
- if (src_col >= 0 && src_col <= stretch_width && src_row >= 0 &&
- src_row <= stretch_height) {
- if (src_col == stretch_width) {
- src_col--;
- }
- if (src_row == stretch_height) {
- src_row--;
- }
- const uint8_t* src_pos =
- stretch_buf + src_row * stretch_pitch + src_col * Bpp;
- if (bHasAlpha) {
- if (transformF != FXDIB_Argb) {
- if (transformF == FXDIB_Rgba) {
- dest_pos[0] = src_pos[0];
- dest_pos[1] = src_pos[1];
- dest_pos[2] = src_pos[2];
- } else {
- *(uint32_t*)dest_pos = FXCMYK_TODIB(CmykEncode(
- src_pos[0], src_pos[1], src_pos[2], src_pos[3]));
- }
- } else {
- *(uint32_t*)dest_pos = FXARGB_TODIB(FXARGB_MAKE(
- src_pos[3], src_pos[2], src_pos[1], src_pos[0]));
- }
- } else {
- if (transformF == FXDIB_Cmyka) {
- *(uint32_t*)dest_pos = FXCMYK_TODIB(CmykEncode(
- src_pos[0], src_pos[1], src_pos[2], src_pos[3]));
- } else {
- *(uint32_t*)dest_pos = FXARGB_TODIB(
- FXARGB_MAKE(0xff, src_pos[2], src_pos[1], src_pos[0]));
- }
- }
- }
- dest_pos += destBpp;
- }
- }
- }
- }
- }
- m_Storer.Replace(std::move(pTransformed));
- return false;
-}
-
-std::unique_ptr<CFX_DIBitmap> CFX_ImageTransformer::DetachBitmap() {
- return m_Storer.Detach();
-}
diff --git a/chromium/third_party/pdfium/core/fxge/dib/ifx_scanlinecomposer.h b/chromium/third_party/pdfium/core/fxge/dib/ifx_scanlinecomposer.h
new file mode 100644
index 00000000000..7b070c02ff8
--- /dev/null
+++ b/chromium/third_party/pdfium/core/fxge/dib/ifx_scanlinecomposer.h
@@ -0,0 +1,26 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef CORE_FXGE_DIB_IFX_SCANLINECOMPOSER_H_
+#define CORE_FXGE_DIB_IFX_SCANLINECOMPOSER_H_
+
+#include "core/fxge/fx_dib.h"
+
+class IFX_ScanlineComposer {
+ public:
+ virtual ~IFX_ScanlineComposer() {}
+
+ virtual void ComposeScanline(int line,
+ const uint8_t* scanline,
+ const uint8_t* scan_extra_alpha) = 0;
+
+ virtual bool SetInfo(int width,
+ int height,
+ FXDIB_Format src_format,
+ uint32_t* pSrcPalette) = 0;
+};
+
+#endif // CORE_FXGE_DIB_IFX_SCANLINECOMPOSER_H_
diff --git a/chromium/third_party/pdfium/core/fxge/freetype/DEPS b/chromium/third_party/pdfium/core/fxge/freetype/DEPS
index 26546f7920c..38478a5b4a5 100644
--- a/chromium/third_party/pdfium/core/fxge/freetype/DEPS
+++ b/chromium/third_party/pdfium/core/fxge/freetype/DEPS
@@ -1,3 +1,3 @@
include_rules = [
- '+third_party/freetype/src'
+ '+third_party/freetype/src/src'
]
diff --git a/chromium/third_party/pdfium/core/fxge/freetype/fx_freetype.cpp b/chromium/third_party/pdfium/core/fxge/freetype/fx_freetype.cpp
index 6aa59fee68a..0ae207b0212 100644
--- a/chromium/third_party/pdfium/core/fxge/freetype/fx_freetype.cpp
+++ b/chromium/third_party/pdfium/core/fxge/freetype/fx_freetype.cpp
@@ -6,7 +6,7 @@
#include "core/fxge/fx_freetype.h"
-#include "third_party/freetype/src/psnames/pstables.h"
+#include "third_party/freetype/src/src/psnames/pstables.h"
static int xyq_search_node(char* glyph_name,
int name_offset,
diff --git a/chromium/third_party/pdfium/core/fxge/fx_dib.h b/chromium/third_party/pdfium/core/fxge/fx_dib.h
index 14be05fafe8..17c7c8fd0a2 100644
--- a/chromium/third_party/pdfium/core/fxge/fx_dib.h
+++ b/chromium/third_party/pdfium/core/fxge/fx_dib.h
@@ -7,42 +7,41 @@
#ifndef CORE_FXGE_FX_DIB_H_
#define CORE_FXGE_FX_DIB_H_
-#include <memory>
-#include <vector>
-
-#include "core/fxcrt/cfx_shared_copy_on_write.h"
-#include "core/fxcrt/fx_basic.h"
#include "core/fxcrt/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_1bppMask = 0x101,
+ FXDIB_8bppMask = 0x108,
+ FXDIB_8bppRgba = 0x208,
+ FXDIB_Rgba = 0x218,
FXDIB_Argb = 0x220,
+ FXDIB_1bppCmyk = 0x401,
+ FXDIB_8bppCmyk = 0x408,
FXDIB_Cmyk = 0x420,
+ FXDIB_8bppCmyka = 0x608,
FXDIB_Cmyka = 0x620,
};
-enum FXDIB_Channel {
- FXDIB_Red = 1,
- FXDIB_Green,
- FXDIB_Blue,
- FXDIB_Cyan,
- FXDIB_Magenta,
- FXDIB_Yellow,
- FXDIB_Black,
- FXDIB_Alpha
+struct PixelWeight {
+ int m_SrcStart;
+ int m_SrcEnd;
+ int m_Weights[1];
};
+typedef uint32_t FX_ARGB;
+typedef uint32_t FX_COLORREF;
+typedef uint32_t FX_CMYK;
+class CFX_ClipRgn;
+class CFX_DIBSource;
+class CStretchEngine;
+
+extern const int16_t SDP_Table[513];
+
#define FXDIB_DOWNSAMPLE 0x04
#define FXDIB_INTERPOL 0x20
#define FXDIB_BICUBIC_INTERPOL 0x80
@@ -66,28 +65,21 @@ enum FXDIB_Channel {
#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) {
@@ -102,21 +94,10 @@ FX_ARGB ArgbEncode(int a, FX_COLORREF rgb);
(((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))
@@ -125,29 +106,11 @@ FX_ARGB ArgbEncode(int a, FX_COLORREF rgb);
((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 | \
@@ -158,540 +121,10 @@ FX_ARGB ArgbEncode(int a, FX_COLORREF rgb);
#define FXGETFLAG_COLORTYPE(flag) (uint8_t)((flag) >> 8)
#define FXGETFLAG_ALPHA_FILL(flag) (uint8_t)(flag)
-bool ConvertBuffer(FXDIB_Format dest_format,
- uint8_t* dest_buf,
- int dest_pitch,
- int width,
- int height,
- const CFX_DIBSource* pSrcBitmap,
- int src_left,
- int src_top,
- std::unique_ptr<uint32_t, FxFreeDeleter>* pal);
-
-class CFX_DIBSource {
- public:
- virtual ~CFX_DIBSource();
-
- virtual uint8_t* GetBuffer() const;
- virtual const uint8_t* GetScanline(int line) const = 0;
- virtual bool SkipToScanline(int line, IFX_Pause* pPause) const;
- virtual void DownSampleScanline(int line,
- uint8_t* dest_scan,
- int dest_bpp,
- int dest_width,
- bool bFlipX,
- int clip_left,
- int clip_width) const = 0;
-
- 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.get(); }
- 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);
- }
-
- // Copies into internally-owned palette.
- void SetPalette(const uint32_t* pSrcPal);
-
- std::unique_ptr<CFX_DIBitmap> Clone(const FX_RECT* pClip = nullptr) const;
- std::unique_ptr<CFX_DIBitmap> CloneConvert(FXDIB_Format format) const;
- std::unique_ptr<CFX_DIBitmap> StretchTo(int dest_width,
- int dest_height,
- uint32_t flags = 0,
- const FX_RECT* pClip = nullptr) const;
- std::unique_ptr<CFX_DIBitmap> TransformTo(
- const CFX_Matrix* pMatrix,
- int& left,
- int& top,
- uint32_t flags = 0,
- const FX_RECT* pClip = nullptr) const;
- std::unique_ptr<CFX_DIBitmap> SwapXY(bool bXFlip,
- bool bYFlip,
- const FX_RECT* pClip = nullptr) const;
- std::unique_ptr<CFX_DIBitmap> FlipImage(bool bXFlip, bool bYFlip) const;
-
- std::unique_ptr<CFX_DIBitmap> CloneAlphaMask(
- const FX_RECT* pClip = nullptr) const;
-
- // Copies into internally-owned mask.
- bool SetAlphaMask(const CFX_DIBSource* pAlphaMask,
- const FX_RECT* pClip = nullptr);
-
-
- 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);
-
-#if defined _SKIA_SUPPORT_ || defined _SKIA_SUPPORT_PATHS_
- void DebugVerifyBitmapIsPreMultiplied(void* buffer = nullptr) const;
-#endif
-
- CFX_DIBitmap* m_pAlphaMask;
-
- protected:
- CFX_DIBSource();
-
- void BuildPalette();
- bool BuildAlphaMask();
- int FindPalette(uint32_t color) const;
- void GetPalette(uint32_t* pal, int alpha) const;
-
- int m_Width;
- int m_Height;
- int m_bpp;
- uint32_t m_AlphaFlag;
- uint32_t m_Pitch;
- // TODO(weili): Use std::vector for this.
- std::unique_ptr<uint32_t, FxFreeDeleter> m_pPalette;
-};
-
-class CFX_DIBitmap : public CFX_DIBSource {
- public:
- CFX_DIBitmap();
- explicit CFX_DIBitmap(const CFX_DIBitmap& src);
- ~CFX_DIBitmap() override;
-
- bool Create(int width,
- int height,
- FXDIB_Format format,
- uint8_t* pBuffer = nullptr,
- int pitch = 0);
-
- 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,
- bool bFlipX,
- int clip_left,
- int clip_width) const override;
-
- void TakeOver(CFX_DIBitmap* pSrcBitmap);
-
- bool ConvertFormat(FXDIB_Format format);
-
- void Clear(uint32_t color);
-
- uint32_t GetPixel(int x, int y) const;
-
- void SetPixel(int x, int y, uint32_t color);
-
- bool LoadChannel(FXDIB_Channel destChannel,
- CFX_DIBSource* pSrcBitmap,
- FXDIB_Channel srcChannel);
-
- bool LoadChannel(FXDIB_Channel destChannel, int value);
-
- bool MultiplyAlpha(int alpha);
-
- bool MultiplyAlpha(CFX_DIBSource* pAlphaMask);
-
- bool TransferBitmap(int dest_left,
- int dest_top,
- int width,
- int height,
- const CFX_DIBSource* pSrcBitmap,
- int src_left,
- int src_top);
-
- 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 = nullptr,
- bool bRgbByteOrder = false,
- void* pIccTransform = nullptr);
-
- 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 = nullptr);
-
- 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 = nullptr,
- bool bRgbByteOrder = false,
- int alpha_flag = 0,
- void* pIccTransform = nullptr);
-
- bool CompositeRect(int dest_left,
- int dest_top,
- int width,
- int height,
- uint32_t color,
- int alpha_flag = 0,
- void* pIccTransform = nullptr);
-
- bool ConvertColorScale(uint32_t forecolor, uint32_t backcolor);
-
-#if defined _SKIA_SUPPORT_ || _SKIA_SUPPORT_PATHS_
- void PreMultiply();
-#endif
-#if defined _SKIA_SUPPORT_PATHS_
- void UnPreMultiply();
-#endif
-
- protected:
- bool GetGrayData(void* pIccTransform = nullptr);
-
-#if defined _SKIA_SUPPORT_PATHS_
- enum class Format { kCleared, kPreMultiplied, kUnPreMultiplied };
-#endif
-
- uint8_t* m_pBuffer;
-#if defined _SKIA_SUPPORT_PATHS_
- Format m_nFormat;
-#endif
- bool m_bExtBuf;
-};
-
-class CFX_DIBExtractor {
- public:
- explicit CFX_DIBExtractor(const CFX_DIBSource* pSrc);
- ~CFX_DIBExtractor();
-
- CFX_DIBitmap* GetBitmap() { return m_pBitmap.get(); }
-
- private:
- std::unique_ptr<CFX_DIBitmap> m_pBitmap;
-};
-
-typedef CFX_SharedCopyOnWrite<CFX_DIBitmap> CFX_DIBitmapRef;
-
-class CFX_FilteredDIB : public CFX_DIBSource {
- public:
- CFX_FilteredDIB();
- ~CFX_FilteredDIB() override;
-
- void LoadSrc(const CFX_DIBSource* pSrc, bool bAutoDropSrc = false);
-
- virtual FXDIB_Format GetDestFormat() = 0;
-
- virtual uint32_t* GetDestPalette() = 0;
-
- virtual void TranslateScanline(const uint8_t* src_buf,
- std::vector<uint8_t>* dest_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_RECT FXDIB_SwapClipBox(FX_RECT& clip,
+ int width,
+ int height,
bool bFlipX,
- int clip_left,
- int clip_width) const override;
-
- const CFX_DIBSource* m_pSrc;
- bool m_bAutoDropSrc;
- mutable std::vector<uint8_t> m_Scanline;
-};
-
-class IFX_ScanlineComposer {
- public:
- virtual ~IFX_ScanlineComposer() {}
-
- virtual void ComposeScanline(int line,
- const uint8_t* scanline,
- const uint8_t* scan_extra_alpha = nullptr) = 0;
-
- virtual bool SetInfo(int width,
- int height,
- FXDIB_Format src_format,
- uint32_t* pSrcPalette) = 0;
-};
-
-class CFX_ScanlineCompositor {
- public:
- CFX_ScanlineCompositor();
-
- ~CFX_ScanlineCompositor();
-
- bool Init(FXDIB_Format dest_format,
- FXDIB_Format src_format,
- int32_t width,
- uint32_t* pSrcPalette,
- uint32_t mask_color,
- int blend_type,
- bool bClip,
- bool bRgbByteOrder = false,
- int alpha_flag = 0,
- void* pIccTransform = nullptr);
-
- void CompositeRgbBitmapLine(uint8_t* dest_scan,
- const uint8_t* src_scan,
- int width,
- const uint8_t* clip_scan,
- const uint8_t* src_extra_alpha = nullptr,
- uint8_t* dst_extra_alpha = nullptr);
-
- 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 = nullptr,
- uint8_t* dst_extra_alpha = nullptr);
-
- void CompositeByteMaskLine(uint8_t* dest_scan,
- const uint8_t* src_scan,
- int width,
- const uint8_t* clip_scan,
- uint8_t* dst_extra_alpha = nullptr);
-
- 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 = nullptr);
-
- 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;
- 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,
- bool bVertical,
- bool bFlipX,
- bool bFlipY,
- bool bRgbByteOrder = false,
- int alpha_flag = 0,
- void* pIccTransform = nullptr,
- int blend_type = FXDIB_BLEND_NORMAL);
-
- // IFX_ScanlineComposer
- 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 = nullptr,
- uint8_t* dst_extra_alpha = nullptr);
- 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;
- bool m_bVertical, m_bFlipX, m_bFlipY;
- int m_AlphaFlag;
- void* m_pIccTransform;
- bool m_bRgbByteOrder;
- int m_BlendType;
- void ComposeScanlineV(int line,
- const uint8_t* scanline,
- const uint8_t* scan_extra_alpha = nullptr);
- 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;
- bool SetInfo(int width,
- int height,
- FXDIB_Format src_format,
- uint32_t* pSrcPalette) override;
-
- CFX_DIBitmap* GetBitmap() { return m_pBitmap.get(); }
- std::unique_ptr<CFX_DIBitmap> Detach();
- void Replace(std::unique_ptr<CFX_DIBitmap> pBitmap);
-
- private:
- std::unique_ptr<CFX_DIBitmap> m_pBitmap;
-};
-
-class CFX_ImageStretcher {
- public:
- CFX_ImageStretcher(IFX_ScanlineComposer* pDest,
- const CFX_DIBSource* pSource,
- int dest_width,
- int dest_height,
- const FX_RECT& bitmap_rect,
- uint32_t flags);
- ~CFX_ImageStretcher();
-
- bool Start();
- bool Continue(IFX_Pause* pPause);
-
- const CFX_DIBSource* source() { return m_pSource; }
-
- private:
- bool StartQuickStretch();
- bool StartStretch();
- bool ContinueQuickStretch(IFX_Pause* pPause);
- bool ContinueStretch(IFX_Pause* pPause);
-
- IFX_ScanlineComposer* const m_pDest;
- const CFX_DIBSource* const m_pSource;
- std::unique_ptr<CStretchEngine> m_pStretchEngine;
- std::unique_ptr<uint8_t, FxFreeDeleter> m_pScanline;
- std::unique_ptr<uint8_t, FxFreeDeleter> m_pMaskScanline;
- const uint32_t m_Flags;
- bool m_bFlipX;
- bool m_bFlipY;
- int m_DestWidth;
- int m_DestHeight;
- FX_RECT m_ClipRect;
- const FXDIB_Format m_DestFormat;
- const int m_DestBPP;
- int m_LineIndex;
-};
-
-class CFX_ImageTransformer {
- public:
- CFX_ImageTransformer(const CFX_DIBSource* pSrc,
- const CFX_Matrix* pMatrix,
- int flags,
- const FX_RECT* pClip);
- ~CFX_ImageTransformer();
-
- bool Start();
- bool Continue(IFX_Pause* pPause);
-
- const FX_RECT& result() const { return m_result; }
- std::unique_ptr<CFX_DIBitmap> DetachBitmap();
-
- private:
- const CFX_DIBSource* const m_pSrc;
- const CFX_Matrix* const m_pMatrix;
- const FX_RECT* const m_pClip;
- FX_RECT m_StretchClip;
- FX_RECT m_result;
- CFX_Matrix m_dest2stretch;
- std::unique_ptr<CFX_ImageStretcher> m_Stretcher;
- CFX_BitmapStorer m_Storer;
- const uint32_t m_Flags;
- int m_Status;
-};
-
-class CFX_ImageRenderer {
- public:
- CFX_ImageRenderer();
- ~CFX_ImageRenderer();
-
- 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,
- bool bRgbByteOrder = false,
- int alpha_flag = 0,
- void* pIccTransform = nullptr,
- int blend_type = FXDIB_BLEND_NORMAL);
-
- 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;
- std::unique_ptr<CFX_ImageTransformer> m_pTransformer;
- std::unique_ptr<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;
- bool m_bRgbByteOrder;
- int m_BlendType;
-};
+ bool bFlipY);
#endif // CORE_FXGE_FX_DIB_H_
diff --git a/chromium/third_party/pdfium/core/fxge/fx_font.h b/chromium/third_party/pdfium/core/fxge/fx_font.h
index 07392fa07f3..87f36060b78 100644
--- a/chromium/third_party/pdfium/core/fxge/fx_font.h
+++ b/chromium/third_party/pdfium/core/fxge/fx_font.h
@@ -13,6 +13,7 @@
#include "core/fxcrt/fx_system.h"
#include "core/fxge/cfx_substfont.h"
+#include "core/fxge/dib/cfx_dibitmap.h"
#include "core/fxge/fx_dib.h"
#include "core/fxge/fx_freetype.h"
@@ -222,11 +223,19 @@ class CFX_FontFaceInfo {
class CFX_GlyphBitmap {
public:
+ CFX_GlyphBitmap();
+ ~CFX_GlyphBitmap();
+
int m_Top;
int m_Left;
- CFX_DIBitmap m_Bitmap;
+ CFX_RetainPtr<CFX_DIBitmap> m_pBitmap;
};
+inline CFX_GlyphBitmap::CFX_GlyphBitmap()
+ : m_pBitmap(pdfium::MakeRetain<CFX_DIBitmap>()) {}
+
+inline CFX_GlyphBitmap::~CFX_GlyphBitmap() {}
+
class FXTEXT_GLYPHPOS {
public:
FXTEXT_GLYPHPOS();
@@ -240,8 +249,8 @@ class FXTEXT_GLYPHPOS {
FX_RECT FXGE_GetGlyphsBBox(const std::vector<FXTEXT_GLYPHPOS>& glyphs,
int anti_alias,
- FX_FLOAT retinaScaleX = 1.0f,
- FX_FLOAT retinaScaleY = 1.0f);
+ float retinaScaleX = 1.0f,
+ float retinaScaleY = 1.0f);
CFX_ByteString GetNameFromTT(const uint8_t* name_table,
uint32_t name_table_size,
diff --git a/chromium/third_party/pdfium/core/fxge/ge/cfx_cliprgn.cpp b/chromium/third_party/pdfium/core/fxge/ge/cfx_cliprgn.cpp
index ea3eb51f182..d2f065dba76 100644
--- a/chromium/third_party/pdfium/core/fxge/ge/cfx_cliprgn.cpp
+++ b/chromium/third_party/pdfium/core/fxge/ge/cfx_cliprgn.cpp
@@ -6,6 +6,10 @@
#include "core/fxge/ge/cfx_cliprgn.h"
+#include <utility>
+
+#include "core/fxge/dib/cfx_dibitmap.h"
+
CFX_ClipRgn::CFX_ClipRgn(int width, int height)
: m_Type(RectI), m_Box(0, 0, width, height) {}
@@ -20,7 +24,7 @@ CFX_ClipRgn::~CFX_ClipRgn() {}
void CFX_ClipRgn::Reset(const FX_RECT& rect) {
m_Type = RectI;
m_Box = rect;
- m_Mask.SetNull();
+ m_Mask = nullptr;
}
void CFX_ClipRgn::IntersectRect(const FX_RECT& rect) {
@@ -36,8 +40,7 @@ void CFX_ClipRgn::IntersectRect(const FX_RECT& rect) {
void CFX_ClipRgn::IntersectMaskRect(FX_RECT rect,
FX_RECT mask_rect,
- CFX_DIBitmapRef Mask) {
- const CFX_DIBitmap* mask_dib = Mask.GetObject();
+ const CFX_RetainPtr<CFX_DIBitmap>& pMask) {
m_Type = MaskF;
m_Box = rect;
m_Box.Intersect(mask_rect);
@@ -46,28 +49,30 @@ void CFX_ClipRgn::IntersectMaskRect(FX_RECT rect,
return;
}
if (m_Box == mask_rect) {
- m_Mask = Mask;
+ m_Mask = pMask;
return;
}
- CFX_DIBitmap* new_dib = m_Mask.Emplace();
- new_dib->Create(m_Box.Width(), m_Box.Height(), FXDIB_8bppMask);
+ CFX_RetainPtr<CFX_DIBitmap> pOldMask(pMask);
+ m_Mask = pdfium::MakeRetain<CFX_DIBitmap>();
+ m_Mask->Create(m_Box.Width(), m_Box.Height(), FXDIB_8bppMask);
for (int row = m_Box.top; row < m_Box.bottom; row++) {
uint8_t* dest_scan =
- new_dib->GetBuffer() + new_dib->GetPitch() * (row - m_Box.top);
+ m_Mask->GetBuffer() + m_Mask->GetPitch() * (row - m_Box.top);
uint8_t* src_scan =
- mask_dib->GetBuffer() + mask_dib->GetPitch() * (row - mask_rect.top);
+ pOldMask->GetBuffer() + pOldMask->GetPitch() * (row - mask_rect.top);
for (int col = m_Box.left; col < m_Box.right; col++)
dest_scan[col - m_Box.left] = src_scan[col - mask_rect.left];
}
}
-void CFX_ClipRgn::IntersectMaskF(int left, int top, CFX_DIBitmapRef Mask) {
- const CFX_DIBitmap* mask_dib = Mask.GetObject();
- ASSERT(mask_dib->GetFormat() == FXDIB_8bppMask);
- FX_RECT mask_box(left, top, left + mask_dib->GetWidth(),
- top + mask_dib->GetHeight());
+void CFX_ClipRgn::IntersectMaskF(int left,
+ int top,
+ const CFX_RetainPtr<CFX_DIBitmap>& pMask) {
+ ASSERT(pMask->GetFormat() == FXDIB_8bppMask);
+ FX_RECT mask_box(left, top, left + pMask->GetWidth(),
+ top + pMask->GetHeight());
if (m_Type == RectI) {
- IntersectMaskRect(m_Box, mask_box, Mask);
+ IntersectMaskRect(m_Box, mask_box, pMask);
return;
}
if (m_Type == MaskF) {
@@ -75,19 +80,16 @@ void CFX_ClipRgn::IntersectMaskF(int left, int top, CFX_DIBitmapRef Mask) {
new_box.Intersect(mask_box);
if (new_box.IsEmpty()) {
m_Type = RectI;
- m_Mask.SetNull();
+ m_Mask = nullptr;
m_Box = new_box;
return;
}
- CFX_DIBitmapRef new_mask;
- CFX_DIBitmap* new_dib = new_mask.Emplace();
+ auto new_dib = pdfium::MakeRetain<CFX_DIBitmap>();
new_dib->Create(new_box.Width(), new_box.Height(), FXDIB_8bppMask);
- const CFX_DIBitmap* old_dib = m_Mask.GetObject();
for (int row = new_box.top; row < new_box.bottom; row++) {
uint8_t* old_scan =
- old_dib->GetBuffer() + (row - m_Box.top) * old_dib->GetPitch();
- uint8_t* mask_scan =
- mask_dib->GetBuffer() + (row - top) * mask_dib->GetPitch();
+ m_Mask->GetBuffer() + (row - m_Box.top) * m_Mask->GetPitch();
+ uint8_t* mask_scan = pMask->GetBuffer() + (row - top) * pMask->GetPitch();
uint8_t* new_scan =
new_dib->GetBuffer() + (row - new_box.top) * new_dib->GetPitch();
for (int col = new_box.left; col < new_box.right; col++) {
@@ -96,7 +98,7 @@ void CFX_ClipRgn::IntersectMaskF(int left, int top, CFX_DIBitmapRef Mask) {
}
}
m_Box = new_box;
- m_Mask = new_mask;
+ m_Mask = std::move(new_dib);
return;
}
ASSERT(false);
diff --git a/chromium/third_party/pdfium/core/fxge/ge/cfx_cliprgn.h b/chromium/third_party/pdfium/core/fxge/ge/cfx_cliprgn.h
index f3fd5856b6e..800e6ddbeef 100644
--- a/chromium/third_party/pdfium/core/fxge/ge/cfx_cliprgn.h
+++ b/chromium/third_party/pdfium/core/fxge/ge/cfx_cliprgn.h
@@ -7,7 +7,9 @@
#ifndef CORE_FXGE_GE_CFX_CLIPRGN_H_
#define CORE_FXGE_GE_CFX_CLIPRGN_H_
-#include "core/fxge/fx_dib.h"
+#include "core/fxcrt/fx_coordinates.h"
+
+class CFX_DIBitmap;
class CFX_ClipRgn {
public:
@@ -19,18 +21,22 @@ class CFX_ClipRgn {
ClipType GetType() const { return m_Type; }
const FX_RECT& GetBox() const { return m_Box; }
- CFX_DIBitmapRef GetMask() const { return m_Mask; }
+ CFX_RetainPtr<CFX_DIBitmap> GetMask() const { return m_Mask; }
void Reset(const FX_RECT& rect);
void IntersectRect(const FX_RECT& rect);
- void IntersectMaskF(int left, int top, CFX_DIBitmapRef Mask);
+ void IntersectMaskF(int left,
+ int top,
+ const CFX_RetainPtr<CFX_DIBitmap>& Mask);
private:
- void IntersectMaskRect(FX_RECT rect, FX_RECT mask_box, CFX_DIBitmapRef Mask);
+ void IntersectMaskRect(FX_RECT rect,
+ FX_RECT mask_box,
+ const CFX_RetainPtr<CFX_DIBitmap>& Mask);
ClipType m_Type;
FX_RECT m_Box;
- CFX_DIBitmapRef m_Mask;
+ CFX_RetainPtr<CFX_DIBitmap> m_Mask;
};
#endif // CORE_FXGE_GE_CFX_CLIPRGN_H_
diff --git a/chromium/third_party/pdfium/core/fxge/ge/cfx_facecache.cpp b/chromium/third_party/pdfium/core/fxge/ge/cfx_facecache.cpp
index 314c95b8b20..2a8e71acf53 100644
--- a/chromium/third_party/pdfium/core/fxge/ge/cfx_facecache.cpp
+++ b/chromium/third_party/pdfium/core/fxge/ge/cfx_facecache.cpp
@@ -21,6 +21,11 @@
#if defined _SKIA_SUPPORT_ || _SKIA_SUPPORT_PATHS_
#include "third_party/skia/include/core/SkStream.h"
#include "third_party/skia/include/core/SkTypeface.h"
+
+#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
+#include "third_party/skia/include/ports/SkFontMgr.h"
+#include "third_party/skia/include/ports/SkFontMgr_empty.h"
+#endif
#endif
namespace {
@@ -44,7 +49,7 @@ void ContrastAdjust(uint8_t* pDataIn,
int nDstRowBytes) {
int col, row, temp;
int max = 0, min = 255;
- FX_FLOAT rate;
+ float rate;
for (row = 0; row < nHeight; row++) {
uint8_t* pRow = pDataIn + row * nSrcRowBytes;
for (col = 0; col < nWidth; col++) {
@@ -55,10 +60,10 @@ void ContrastAdjust(uint8_t* pDataIn,
}
temp = max - min;
if (temp == 0 || temp == 255) {
- int rowbytes = std::min(FXSYS_abs(nSrcRowBytes), nDstRowBytes);
+ int rowbytes = std::min(abs(nSrcRowBytes), nDstRowBytes);
for (row = 0; row < nHeight; row++) {
- FXSYS_memcpy(pDataOut + row * nDstRowBytes, pDataIn + row * nSrcRowBytes,
- rowbytes);
+ memcpy(pDataOut + row * nDstRowBytes, pDataIn + row * nSrcRowBytes,
+ rowbytes);
}
return;
}
@@ -165,8 +170,9 @@ CFX_GlyphBitmap* CFX_FaceCache::RenderGlyph(const CFX_Font* pFont,
else
level = CFX_Font::s_WeightPow_11[index];
- level = level * (FXSYS_abs(static_cast<int>(ft_matrix.xx)) +
- FXSYS_abs(static_cast<int>(ft_matrix.xy))) /
+ level = level *
+ (abs(static_cast<int>(ft_matrix.xx)) +
+ abs(static_cast<int>(ft_matrix.xy))) /
36655;
FXFT_Outline_Embolden(FXFT_Get_Glyph_Outline(m_Face),
level.ValueOrDefault(0));
@@ -182,14 +188,14 @@ CFX_GlyphBitmap* CFX_FaceCache::RenderGlyph(const CFX_Font* pFont,
return nullptr;
int dib_width = bmwidth;
CFX_GlyphBitmap* pGlyphBitmap = new CFX_GlyphBitmap;
- pGlyphBitmap->m_Bitmap.Create(
+ pGlyphBitmap->m_pBitmap->Create(
dib_width, bmheight,
anti_alias == FXFT_RENDER_MODE_MONO ? FXDIB_1bppMask : FXDIB_8bppMask);
pGlyphBitmap->m_Left = FXFT_Get_Glyph_BitmapLeft(m_Face);
pGlyphBitmap->m_Top = FXFT_Get_Glyph_BitmapTop(m_Face);
- int dest_pitch = pGlyphBitmap->m_Bitmap.GetPitch();
+ int dest_pitch = pGlyphBitmap->m_pBitmap->GetPitch();
int src_pitch = FXFT_Get_Bitmap_Pitch(FXFT_Get_Glyph_Bitmap(m_Face));
- uint8_t* pDestBuf = pGlyphBitmap->m_Bitmap.GetBuffer();
+ uint8_t* pDestBuf = pGlyphBitmap->m_pBitmap->GetBuffer();
uint8_t* pSrcBuf =
(uint8_t*)FXFT_Get_Bitmap_Buffer(FXFT_Get_Glyph_Bitmap(m_Face));
if (anti_alias != FXFT_RENDER_MODE_MONO &&
@@ -205,15 +211,14 @@ CFX_GlyphBitmap* CFX_FaceCache::RenderGlyph(const CFX_Font* pFont,
}
}
} else {
- FXSYS_memset(pDestBuf, 0, dest_pitch * bmheight);
+ memset(pDestBuf, 0, dest_pitch * bmheight);
if (anti_alias == FXFT_RENDER_MODE_MONO &&
FXFT_Get_Bitmap_PixelMode(FXFT_Get_Glyph_Bitmap(m_Face)) ==
FXFT_PIXEL_MODE_MONO) {
- int rowbytes =
- FXSYS_abs(src_pitch) > dest_pitch ? dest_pitch : FXSYS_abs(src_pitch);
+ int rowbytes = abs(src_pitch) > dest_pitch ? dest_pitch : abs(src_pitch);
for (int row = 0; row < bmheight; row++) {
- FXSYS_memcpy(pDestBuf + row * dest_pitch, pSrcBuf + row * src_pitch,
- rowbytes);
+ memcpy(pDestBuf + row * dest_pitch, pSrcBuf + row * src_pitch,
+ rowbytes);
}
} else {
ContrastAdjust(pSrcBuf, pDestBuf, bmwidth, bmheight, src_pitch,
@@ -359,6 +364,13 @@ CFX_TypeFace* CFX_FaceCache::GetDeviceCache(const CFX_Font* pFont) {
new SkMemoryStream(pFont->GetFontData(), pFont->GetSize()))
.release();
}
+#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
+ if (!m_pTypeface) {
+ sk_sp<SkFontMgr> customMgr(SkFontMgr_New_Custom_Empty());
+ m_pTypeface = customMgr->createFromStream(
+ new SkMemoryStream(pFont->GetFontData(), pFont->GetSize()));
+ }
+#endif
return m_pTypeface;
}
#endif
diff --git a/chromium/third_party/pdfium/core/fxge/ge/cfx_folderfontinfo.cpp b/chromium/third_party/pdfium/core/fxge/ge/cfx_folderfontinfo.cpp
index 776a37319b3..ff8cc4c29f0 100644
--- a/chromium/third_party/pdfium/core/fxge/ge/cfx_folderfontinfo.cpp
+++ b/chromium/third_party/pdfium/core/fxge/ge/cfx_folderfontinfo.cpp
@@ -16,8 +16,8 @@
namespace {
const struct {
- const FX_CHAR* m_pName;
- const FX_CHAR* m_pSubstName;
+ const char* m_pName;
+ const char* m_pSubstName;
} Base14Substs[] = {
{"Courier", "Courier New"},
{"Courier-Bold", "Courier New Bold"},
@@ -33,15 +33,15 @@ const struct {
{"Times-Italic", "Times New Roman Italic"},
};
-CFX_ByteString FPDF_ReadStringFromFile(FXSYS_FILE* pFile, uint32_t size) {
+CFX_ByteString FPDF_ReadStringFromFile(FILE* pFile, uint32_t size) {
CFX_ByteString buffer;
- if (!FXSYS_fread(buffer.GetBuffer(size), size, 1, pFile))
+ if (!fread(buffer.GetBuffer(size), size, 1, pFile))
return CFX_ByteString();
buffer.ReleaseBuffer(size);
return buffer;
}
-CFX_ByteString FPDF_LoadTableFromTT(FXSYS_FILE* pFile,
+CFX_ByteString FPDF_LoadTableFromTT(FILE* pFile,
const uint8_t* pTables,
uint32_t nTables,
uint32_t tag) {
@@ -50,7 +50,7 @@ CFX_ByteString FPDF_LoadTableFromTT(FXSYS_FILE* pFile,
if (GET_TT_LONG(p) == tag) {
uint32_t offset = GET_TT_LONG(p + 8);
uint32_t size = GET_TT_LONG(p + 12);
- FXSYS_fseek(pFile, offset, FXSYS_SEEK_SET);
+ fseek(pFile, offset, SEEK_SET);
return FPDF_ReadStringFromFile(pFile, size);
}
}
@@ -149,34 +149,34 @@ void CFX_FolderFontInfo::ScanPath(const CFX_ByteString& path) {
}
void CFX_FolderFontInfo::ScanFile(const CFX_ByteString& path) {
- FXSYS_FILE* pFile = FXSYS_fopen(path.c_str(), "rb");
+ FILE* pFile = fopen(path.c_str(), "rb");
if (!pFile)
return;
- FXSYS_fseek(pFile, 0, FXSYS_SEEK_END);
+ fseek(pFile, 0, SEEK_END);
- uint32_t filesize = FXSYS_ftell(pFile);
+ uint32_t filesize = ftell(pFile);
uint8_t buffer[16];
- FXSYS_fseek(pFile, 0, FXSYS_SEEK_SET);
+ fseek(pFile, 0, SEEK_SET);
- size_t readCnt = FXSYS_fread(buffer, 12, 1, pFile);
+ size_t readCnt = fread(buffer, 12, 1, pFile);
if (readCnt != 1) {
- FXSYS_fclose(pFile);
+ fclose(pFile);
return;
}
if (GET_TT_LONG(buffer) == kTableTTCF) {
uint32_t nFaces = GET_TT_LONG(buffer + 8);
if (nFaces > std::numeric_limits<uint32_t>::max() / 4) {
- FXSYS_fclose(pFile);
+ fclose(pFile);
return;
}
uint32_t face_bytes = nFaces * 4;
uint8_t* offsets = FX_Alloc(uint8_t, face_bytes);
- readCnt = FXSYS_fread(offsets, 1, face_bytes, pFile);
+ readCnt = fread(offsets, 1, face_bytes, pFile);
if (readCnt != face_bytes) {
FX_Free(offsets);
- FXSYS_fclose(pFile);
+ fclose(pFile);
return;
}
for (uint32_t i = 0; i < nFaces; i++) {
@@ -187,16 +187,16 @@ void CFX_FolderFontInfo::ScanFile(const CFX_ByteString& path) {
} else {
ReportFace(path, pFile, filesize, 0);
}
- FXSYS_fclose(pFile);
+ fclose(pFile);
}
void CFX_FolderFontInfo::ReportFace(const CFX_ByteString& path,
- FXSYS_FILE* pFile,
+ FILE* pFile,
uint32_t filesize,
uint32_t offset) {
- FXSYS_fseek(pFile, offset, FXSYS_SEEK_SET);
+ fseek(pFile, offset, SEEK_SET);
char buffer[16];
- if (!FXSYS_fread(buffer, 12, 1, pFile))
+ if (!fread(buffer, 12, 1, pFile))
return;
uint32_t nTables = GET_TT_SHORT(buffer + 4);
@@ -275,7 +275,7 @@ void* CFX_FolderFontInfo::FindFont(int weight,
bool bItalic,
int charset,
int pitch_family,
- const FX_CHAR* family,
+ const char* family,
bool bMatchName) {
CFX_FontFaceInfo* pFind = nullptr;
if (charset == FXFONT_ANSI_CHARSET && (pitch_family & FXFONT_FF_FIXEDPITCH))
@@ -306,7 +306,7 @@ void* CFX_FolderFontInfo::MapFont(int weight,
bool bItalic,
int charset,
int pitch_family,
- const FX_CHAR* family,
+ const char* family,
int& iExact) {
return nullptr;
}
@@ -320,7 +320,7 @@ void* CFX_FolderFontInfo::MapFontByUnicode(uint32_t dwUnicode,
}
#endif // PDF_ENABLE_XFA
-void* CFX_FolderFontInfo::GetFont(const FX_CHAR* face) {
+void* CFX_FolderFontInfo::GetFont(const char* face) {
auto it = m_FontList.find(face);
return it != m_FontList.end() ? it->second : nullptr;
}
@@ -353,27 +353,27 @@ uint32_t CFX_FolderFontInfo::GetFontData(void* hFont,
if (!datasize || size < datasize)
return datasize;
- FXSYS_FILE* pFile = FXSYS_fopen(pFont->m_FilePath.c_str(), "rb");
+ FILE* pFile = fopen(pFont->m_FilePath.c_str(), "rb");
if (!pFile)
return 0;
- if (FXSYS_fseek(pFile, offset, FXSYS_SEEK_SET) < 0 ||
- FXSYS_fread(buffer, datasize, 1, pFile) != 1) {
+ if (fseek(pFile, offset, SEEK_SET) < 0 ||
+ fread(buffer, datasize, 1, pFile) != 1) {
datasize = 0;
}
- FXSYS_fclose(pFile);
+ fclose(pFile);
return datasize;
}
void CFX_FolderFontInfo::DeleteFont(void* hFont) {}
-bool CFX_FolderFontInfo::GetFaceName(void* hFont, CFX_ByteString& name) {
+
+bool CFX_FolderFontInfo::GetFaceName(void* hFont, CFX_ByteString* name) {
if (!hFont)
return false;
- CFX_FontFaceInfo* pFont = (CFX_FontFaceInfo*)hFont;
- name = pFont->m_FaceName;
+ *name = static_cast<CFX_FontFaceInfo*>(hFont)->m_FaceName;
return true;
}
-bool CFX_FolderFontInfo::GetFontCharset(void* hFont, int& charset) {
+bool CFX_FolderFontInfo::GetFontCharset(void* hFont, int* charset) {
return false;
}
diff --git a/chromium/third_party/pdfium/core/fxge/ge/cfx_folderfontinfo.h b/chromium/third_party/pdfium/core/fxge/ge/cfx_folderfontinfo.h
index d031eef3d06..ab2468ade0b 100644
--- a/chromium/third_party/pdfium/core/fxge/ge/cfx_folderfontinfo.h
+++ b/chromium/third_party/pdfium/core/fxge/ge/cfx_folderfontinfo.h
@@ -27,7 +27,7 @@ class CFX_FolderFontInfo : public IFX_SystemFontInfo {
bool bItalic,
int charset,
int pitch_family,
- const FX_CHAR* face,
+ const char* face,
int& bExact) override;
#ifdef PDF_ENABLE_XFA
void* MapFontByUnicode(uint32_t dwUnicode,
@@ -35,20 +35,20 @@ class CFX_FolderFontInfo : public IFX_SystemFontInfo {
bool bItalic,
int pitch_family) override;
#endif // PDF_ENABLE_XFA
- void* GetFont(const FX_CHAR* face) override;
+ void* GetFont(const char* face) override;
uint32_t GetFontData(void* hFont,
uint32_t table,
uint8_t* buffer,
uint32_t size) override;
void DeleteFont(void* hFont) override;
- bool GetFaceName(void* hFont, CFX_ByteString& name) override;
- bool GetFontCharset(void* hFont, int& charset) override;
+ bool GetFaceName(void* hFont, CFX_ByteString* name) override;
+ bool GetFontCharset(void* hFont, int* charset) override;
protected:
void ScanPath(const CFX_ByteString& path);
void ScanFile(const CFX_ByteString& path);
void ReportFace(const CFX_ByteString& path,
- FXSYS_FILE* pFile,
+ FILE* pFile,
uint32_t filesize,
uint32_t offset);
void* GetSubstFont(const CFX_ByteString& face);
@@ -56,7 +56,7 @@ class CFX_FolderFontInfo : public IFX_SystemFontInfo {
bool bItalic,
int charset,
int pitch_family,
- const FX_CHAR* family,
+ const char* family,
bool bMatchName);
std::map<CFX_ByteString, CFX_FontFaceInfo*> m_FontList;
diff --git a/chromium/third_party/pdfium/core/fxge/ge/cfx_font.cpp b/chromium/third_party/pdfium/core/fxge/ge/cfx_font.cpp
index 87157b01011..068f0b032ca 100644
--- a/chromium/third_party/pdfium/core/fxge/ge/cfx_font.cpp
+++ b/chromium/third_party/pdfium/core/fxge/ge/cfx_font.cpp
@@ -31,7 +31,7 @@ typedef struct {
CFX_PathData* m_pPath;
int m_CurX;
int m_CurY;
- FX_FLOAT m_CoordUnit;
+ float m_CoordUnit;
} OUTLINE_PARAMS;
#ifdef PDF_ENABLE_XFA
diff --git a/chromium/third_party/pdfium/core/fxge/ge/cfx_fontcache.cpp b/chromium/third_party/pdfium/core/fxge/ge/cfx_fontcache.cpp
index 58cee06d42c..1599c30b933 100644
--- a/chromium/third_party/pdfium/core/fxge/ge/cfx_fontcache.cpp
+++ b/chromium/third_party/pdfium/core/fxge/ge/cfx_fontcache.cpp
@@ -12,6 +12,7 @@
#include "core/fxge/cfx_facecache.h"
#include "core/fxge/fx_font.h"
#include "core/fxge/fx_freetype.h"
+#include "third_party/base/ptr_util.h"
CFX_FontCache::CountedFaceCache::CountedFaceCache() {}
@@ -35,7 +36,7 @@ CFX_FaceCache* CFX_FontCache::GetCachedFace(const CFX_Font* pFont) {
return counted_face_cache->m_Obj.get();
}
- std::unique_ptr<CountedFaceCache> counted_face_cache(new CountedFaceCache);
+ auto counted_face_cache = pdfium::MakeUnique<CountedFaceCache>();
counted_face_cache->m_nCount = 2;
CFX_FaceCache* face_cache = new CFX_FaceCache(bExternal ? nullptr : face);
counted_face_cache->m_Obj.reset(face_cache);
diff --git a/chromium/third_party/pdfium/core/fxge/ge/cfx_fontmapper.cpp b/chromium/third_party/pdfium/core/fxge/ge/cfx_fontmapper.cpp
index 064fc9610aa..0cff3445991 100644
--- a/chromium/third_party/pdfium/core/fxge/ge/cfx_fontmapper.cpp
+++ b/chromium/third_party/pdfium/core/fxge/ge/cfx_fontmapper.cpp
@@ -25,7 +25,7 @@ namespace {
const int kNumStandardFonts = 14;
-const FX_CHAR* const g_Base14FontNames[kNumStandardFonts] = {
+const char* const g_Base14FontNames[kNumStandardFonts] = {
"Courier",
"Courier-Bold",
"Courier-BoldOblique",
@@ -43,7 +43,7 @@ const FX_CHAR* const g_Base14FontNames[kNumStandardFonts] = {
};
const struct AltFontName {
- const FX_CHAR* m_pName;
+ const char* m_pName;
int m_Index;
} g_AltFontNames[] = {
{"Arial", 4},
@@ -138,8 +138,8 @@ const struct AltFontName {
};
const struct AltFontFamily {
- const FX_CHAR* m_pFontName;
- const FX_CHAR* m_pFontFamily;
+ const char* m_pFontName;
+ const char* m_pFontFamily;
} g_AltFontFamilies[] = {
{"AGaramondPro", "Adobe Garamond Pro"},
{"BankGothicBT-Medium", "BankGothic Md BT"},
@@ -147,7 +147,7 @@ const struct AltFontFamily {
};
const struct FX_FontStyle {
- const FX_CHAR* style;
+ const char* style;
int32_t len;
} g_FontStyles[] = {
{"Bold", 4}, {"Italic", 6}, {"BoldItalic", 10}, {"Reg", 3}, {"Regular", 7},
@@ -167,20 +167,19 @@ const struct CODEPAGE_MAP {
};
int CompareFontFamilyString(const void* key, const void* element) {
- CFX_ByteString str_key((const FX_CHAR*)key);
+ CFX_ByteString str_key((const char*)key);
const AltFontFamily* family = reinterpret_cast<const AltFontFamily*>(element);
if (str_key.Find(family->m_pFontName) != -1)
return 0;
- return FXSYS_stricmp(reinterpret_cast<const FX_CHAR*>(key),
- family->m_pFontName);
+ return FXSYS_stricmp(reinterpret_cast<const char*>(key), family->m_pFontName);
}
int CompareString(const void* key, const void* element) {
- return FXSYS_stricmp(reinterpret_cast<const FX_CHAR*>(key),
+ return FXSYS_stricmp(reinterpret_cast<const char*>(key),
reinterpret_cast<const AltFontName*>(element)->m_pName);
}
-CFX_ByteString TT_NormalizeName(const FX_CHAR* family) {
+CFX_ByteString TT_NormalizeName(const char* family) {
CFX_ByteString norm(family);
norm.Remove(' ');
norm.Remove('-');
@@ -217,13 +216,13 @@ CFX_ByteString GetFontFamily(CFX_ByteString fontName, int nStyle) {
fontName = "FreeStyleScript";
return fontName;
}
- AltFontFamily* found = reinterpret_cast<AltFontFamily*>(FXSYS_bsearch(
+ AltFontFamily* found = reinterpret_cast<AltFontFamily*>(bsearch(
fontName.c_str(), g_AltFontFamilies, FX_ArraySize(g_AltFontFamilies),
sizeof(AltFontFamily), CompareFontFamilyString));
return found ? CFX_ByteString(found->m_pFontFamily) : fontName;
}
-CFX_ByteString ParseStyle(const FX_CHAR* pStyle, int iLen, int iIndex) {
+CFX_ByteString ParseStyle(const char* pStyle, int iLen, int iIndex) {
CFX_ByteTextBuf buf;
if (!iLen || iLen <= iIndex)
return buf.MakeString();
@@ -281,7 +280,7 @@ CFX_FontMapper::CFX_FontMapper(CFX_FontMgr* mgr)
: m_bListLoaded(false), m_pFontMgr(mgr) {
m_MMFaces[0] = nullptr;
m_MMFaces[1] = nullptr;
- FXSYS_memset(m_FoxitFaces, 0, sizeof(m_FoxitFaces));
+ memset(m_FoxitFaces, 0, sizeof(m_FoxitFaces));
}
CFX_FontMapper::~CFX_FontMapper() {
@@ -505,7 +504,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name,
}
if (!style.IsEmpty()) {
int nLen = style.GetLength();
- const FX_CHAR* pStyle = style.c_str();
+ const char* pStyle = style.c_str();
int i = 0;
bool bFirstItem = true;
CFX_ByteString buf;
@@ -678,9 +677,9 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name,
if (!hFont)
return nullptr;
- m_pFontInfo->GetFaceName(hFont, SubstName);
+ m_pFontInfo->GetFaceName(hFont, &SubstName);
if (Charset == FXFONT_DEFAULT_CHARSET)
- m_pFontInfo->GetFontCharset(hFont, Charset);
+ m_pFontInfo->GetFontCharset(hFont, &Charset);
uint32_t ttc_size = m_pFontInfo->GetFontData(hFont, kTableTTCF, nullptr, 0);
uint32_t font_size = m_pFontInfo->GetFontData(hFont, 0, nullptr, 0);
if (font_size == 0 && ttc_size == 0) {
@@ -708,7 +707,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name,
if (bItalic && !FXFT_Is_Face_Italic(face)) {
if (italic_angle == 0)
italic_angle = -12;
- else if (FXSYS_abs(italic_angle) < 5)
+ else if (abs(italic_angle) < 5)
italic_angle = 0;
pSubstFont->m_ItalicAngle = italic_angle;
}
@@ -743,7 +742,7 @@ FXFT_Face CFX_FontMapper::FindSubstFontByUnicode(uint32_t dwUnicode,
face = GetCachedTTCFace(hFont, 0x74746366, ttc_size, font_size);
} else {
CFX_ByteString SubstName;
- m_pFontInfo->GetFaceName(hFont, SubstName);
+ m_pFontInfo->GetFaceName(hFont, &SubstName);
face = GetCachedFace(hFont, SubstName, weight, bItalic, font_size);
}
m_pFontInfo->DeleteFont(hFont);
@@ -810,8 +809,8 @@ FXFT_Face CFX_FontMapper::GetCachedFace(void* hFont,
int PDF_GetStandardFontName(CFX_ByteString* name) {
AltFontName* found = static_cast<AltFontName*>(
- FXSYS_bsearch(name->c_str(), g_AltFontNames, FX_ArraySize(g_AltFontNames),
- sizeof(AltFontName), CompareString));
+ bsearch(name->c_str(), g_AltFontNames, FX_ArraySize(g_AltFontNames),
+ sizeof(AltFontName), CompareString));
if (!found)
return -1;
diff --git a/chromium/third_party/pdfium/core/fxge/ge/cfx_fontmgr.cpp b/chromium/third_party/pdfium/core/fxge/ge/cfx_fontmgr.cpp
index 64f647e3f60..97d143804ba 100644
--- a/chromium/third_party/pdfium/core/fxge/ge/cfx_fontmgr.cpp
+++ b/chromium/third_party/pdfium/core/fxge/ge/cfx_fontmgr.cpp
@@ -215,7 +215,7 @@ FXFT_Face CFX_FontMgr::GetFixedFace(const uint8_t* pData,
return FXFT_Set_Pixel_Sizes(face, 64, 64) ? nullptr : face;
}
-FXFT_Face CFX_FontMgr::GetFileFace(const FX_CHAR* filename, int face_index) {
+FXFT_Face CFX_FontMgr::GetFileFace(const char* filename, int face_index) {
InitFTLibrary();
FXFT_Library library = m_FTLibrary;
FXFT_Face face = nullptr;
diff --git a/chromium/third_party/pdfium/core/fxge/ge/cfx_gemodule.cpp b/chromium/third_party/pdfium/core/fxge/ge/cfx_gemodule.cpp
index ed6d6cb32e6..790b670e4f5 100644
--- a/chromium/third_party/pdfium/core/fxge/ge/cfx_gemodule.cpp
+++ b/chromium/third_party/pdfium/core/fxge/ge/cfx_gemodule.cpp
@@ -59,11 +59,11 @@ CFX_FontCache* CFX_GEModule::GetFontCache() {
return m_pFontCache;
}
-void CFX_GEModule::SetTextGamma(FX_FLOAT gammaValue) {
+void CFX_GEModule::SetTextGamma(float gammaValue) {
gammaValue /= 2.2f;
for (int i = 0; i < 256; ++i) {
m_GammaValue[i] = static_cast<uint8_t>(
- FXSYS_pow(static_cast<FX_FLOAT>(i) / 255, gammaValue) * 255.0f + 0.5f);
+ FXSYS_pow(static_cast<float>(i) / 255, gammaValue) * 255.0f + 0.5f);
}
}
diff --git a/chromium/third_party/pdfium/core/fxge/ge/cfx_graphstate.cpp b/chromium/third_party/pdfium/core/fxge/ge/cfx_graphstate.cpp
index 6357aa51a41..54443b96365 100644
--- a/chromium/third_party/pdfium/core/fxge/ge/cfx_graphstate.cpp
+++ b/chromium/third_party/pdfium/core/fxge/ge/cfx_graphstate.cpp
@@ -19,9 +19,7 @@ void CFX_GraphState::Emplace() {
m_Ref.Emplace();
}
-void CFX_GraphState::SetLineDash(CPDF_Array* pArray,
- FX_FLOAT phase,
- FX_FLOAT scale) {
+void CFX_GraphState::SetLineDash(CPDF_Array* pArray, float phase, float scale) {
CFX_GraphStateData* pData = m_Ref.GetPrivateCopy();
pData->m_DashPhase = phase * scale;
pData->SetDashCount(static_cast<int>(pArray->GetCount()));
@@ -29,11 +27,11 @@ void CFX_GraphState::SetLineDash(CPDF_Array* pArray,
pData->m_DashArray[i] = pArray->GetNumberAt(i) * scale;
}
-FX_FLOAT CFX_GraphState::GetLineWidth() const {
+float CFX_GraphState::GetLineWidth() const {
return m_Ref.GetObject() ? m_Ref.GetObject()->m_LineWidth : 1.f;
}
-void CFX_GraphState::SetLineWidth(FX_FLOAT width) {
+void CFX_GraphState::SetLineWidth(float width) {
m_Ref.GetPrivateCopy()->m_LineWidth = width;
}
@@ -52,10 +50,10 @@ void CFX_GraphState::SetLineJoin(CFX_GraphStateData::LineJoin join) {
m_Ref.GetPrivateCopy()->m_LineJoin = join;
}
-FX_FLOAT CFX_GraphState::GetMiterLimit() const {
+float CFX_GraphState::GetMiterLimit() const {
return m_Ref.GetObject() ? m_Ref.GetObject()->m_MiterLimit : 10.f;
}
-void CFX_GraphState::SetMiterLimit(FX_FLOAT limit) {
+void CFX_GraphState::SetMiterLimit(float limit) {
m_Ref.GetPrivateCopy()->m_MiterLimit = limit;
}
diff --git a/chromium/third_party/pdfium/core/fxge/ge/cfx_graphstatedata.cpp b/chromium/third_party/pdfium/core/fxge/ge/cfx_graphstatedata.cpp
index 03798a63200..82fede176a5 100644
--- a/chromium/third_party/pdfium/core/fxge/ge/cfx_graphstatedata.cpp
+++ b/chromium/third_party/pdfium/core/fxge/ge/cfx_graphstatedata.cpp
@@ -33,8 +33,8 @@ void CFX_GraphStateData::Copy(const CFX_GraphStateData& src) {
m_MiterLimit = src.m_MiterLimit;
m_LineWidth = src.m_LineWidth;
if (m_DashCount) {
- m_DashArray = FX_Alloc(FX_FLOAT, m_DashCount);
- FXSYS_memcpy(m_DashArray, src.m_DashArray, m_DashCount * sizeof(FX_FLOAT));
+ m_DashArray = FX_Alloc(float, m_DashCount);
+ memcpy(m_DashArray, src.m_DashArray, m_DashCount * sizeof(float));
}
}
@@ -48,5 +48,5 @@ void CFX_GraphStateData::SetDashCount(int count) {
m_DashCount = count;
if (count == 0)
return;
- m_DashArray = FX_Alloc(FX_FLOAT, count);
+ m_DashArray = FX_Alloc(float, count);
}
diff --git a/chromium/third_party/pdfium/core/fxge/ge/cfx_pathdata.cpp b/chromium/third_party/pdfium/core/fxge/ge/cfx_pathdata.cpp
index 9fa2cd2aacf..75e4faf0ef2 100644
--- a/chromium/third_party/pdfium/core/fxge/ge/cfx_pathdata.cpp
+++ b/chromium/third_party/pdfium/core/fxge/ge/cfx_pathdata.cpp
@@ -14,7 +14,7 @@ namespace {
void UpdateLineEndPoints(CFX_FloatRect* rect,
const CFX_PointF& start_pos,
const CFX_PointF& end_pos,
- FX_FLOAT hw) {
+ float hw) {
if (start_pos.x == end_pos.x) {
if (start_pos.y == end_pos.y) {
rect->UpdateRect(end_pos.x + hw, end_pos.y + hw);
@@ -22,7 +22,7 @@ void UpdateLineEndPoints(CFX_FloatRect* rect,
return;
}
- FX_FLOAT point_y;
+ float point_y;
if (end_pos.y < start_pos.y)
point_y = end_pos.y - hw;
else
@@ -34,7 +34,7 @@ void UpdateLineEndPoints(CFX_FloatRect* rect,
}
if (start_pos.y == end_pos.y) {
- FX_FLOAT point_x;
+ float point_x;
if (end_pos.x < start_pos.x)
point_x = end_pos.x - hw;
else
@@ -46,11 +46,11 @@ void UpdateLineEndPoints(CFX_FloatRect* rect,
}
CFX_PointF diff = end_pos - start_pos;
- FX_FLOAT ll = FXSYS_sqrt2(diff.x, diff.y);
- FX_FLOAT mx = end_pos.x + hw * diff.x / ll;
- FX_FLOAT my = end_pos.y + hw * diff.y / ll;
- FX_FLOAT dx1 = hw * diff.y / ll;
- FX_FLOAT dy1 = hw * diff.x / ll;
+ float ll = FXSYS_sqrt2(diff.x, diff.y);
+ float mx = end_pos.x + hw * diff.x / ll;
+ float my = end_pos.y + hw * diff.y / ll;
+ float dx1 = hw * diff.y / ll;
+ float dy1 = hw * diff.x / ll;
rect->UpdateRect(mx - dx1, my + dy1);
rect->UpdateRect(mx + dx1, my - dy1);
}
@@ -59,23 +59,23 @@ void UpdateLineJoinPoints(CFX_FloatRect* rect,
const CFX_PointF& start_pos,
const CFX_PointF& mid_pos,
const CFX_PointF& end_pos,
- FX_FLOAT half_width,
- FX_FLOAT miter_limit) {
- FX_FLOAT start_k = 0;
- FX_FLOAT start_c = 0;
- FX_FLOAT end_k = 0;
- FX_FLOAT end_c = 0;
- FX_FLOAT start_len = 0;
- FX_FLOAT start_dc = 0;
- FX_FLOAT end_len = 0;
- FX_FLOAT end_dc = 0;
- FX_FLOAT one_twentieth = 1.0f / 20;
-
- bool bStartVert = FXSYS_fabs(start_pos.x - mid_pos.x) < one_twentieth;
- bool bEndVert = FXSYS_fabs(mid_pos.x - end_pos.x) < one_twentieth;
+ float half_width,
+ float miter_limit) {
+ float start_k = 0;
+ float start_c = 0;
+ float end_k = 0;
+ float end_c = 0;
+ float start_len = 0;
+ float start_dc = 0;
+ float end_len = 0;
+ float end_dc = 0;
+ float one_twentieth = 1.0f / 20;
+
+ bool bStartVert = fabs(start_pos.x - mid_pos.x) < one_twentieth;
+ bool bEndVert = fabs(mid_pos.x - end_pos.x) < one_twentieth;
if (bStartVert && bEndVert) {
int start_dir = mid_pos.y > start_pos.y ? 1 : -1;
- FX_FLOAT point_y = mid_pos.y + half_width * start_dir;
+ float point_y = mid_pos.y + half_width * start_dir;
rect->UpdateRect(mid_pos.x + half_width, point_y);
rect->UpdateRect(mid_pos.x - half_width, point_y);
return;
@@ -86,16 +86,15 @@ void UpdateLineJoinPoints(CFX_FloatRect* rect,
start_k = (mid_pos.y - start_pos.y) / (mid_pos.x - start_pos.x);
start_c = mid_pos.y - (start_k * mid_pos.x);
start_len = FXSYS_sqrt2(start_to_mid.x, start_to_mid.y);
- start_dc = static_cast<FX_FLOAT>(
- FXSYS_fabs(half_width * start_len / start_to_mid.x));
+ start_dc =
+ static_cast<float>(fabs(half_width * start_len / start_to_mid.x));
}
if (!bEndVert) {
CFX_PointF end_to_mid = end_pos - mid_pos;
end_k = end_to_mid.y / end_to_mid.x;
end_c = mid_pos.y - (end_k * mid_pos.x);
end_len = FXSYS_sqrt2(end_to_mid.x, end_to_mid.y);
- end_dc =
- static_cast<FX_FLOAT>(FXSYS_fabs(half_width * end_len / end_to_mid.x));
+ end_dc = static_cast<float>(fabs(half_width * end_len / end_to_mid.x));
}
if (bStartVert) {
CFX_PointF outside(start_pos.x, 0);
@@ -129,7 +128,7 @@ void UpdateLineJoinPoints(CFX_FloatRect* rect,
return;
}
- if (FXSYS_fabs(start_k - end_k) < one_twentieth) {
+ if (fabs(start_k - end_k) < one_twentieth) {
int start_dir = mid_pos.x > start_pos.x ? 1 : -1;
int end_dir = end_pos.x > mid_pos.x ? 1 : -1;
if (start_dir == end_dir)
@@ -139,20 +138,20 @@ void UpdateLineJoinPoints(CFX_FloatRect* rect,
return;
}
- FX_FLOAT start_outside_c = start_c;
+ float start_outside_c = start_c;
if (end_pos.y < (start_k * end_pos.x) + start_c)
start_outside_c += start_dc;
else
start_outside_c -= start_dc;
- FX_FLOAT end_outside_c = end_c;
+ float end_outside_c = end_c;
if (start_pos.y < (end_k * start_pos.x) + end_c)
end_outside_c += end_dc;
else
end_outside_c -= end_dc;
- FX_FLOAT join_x = (end_outside_c - start_outside_c) / (start_k - end_k);
- FX_FLOAT join_y = start_k * join_x + start_outside_c;
+ float join_x = (end_outside_c - start_outside_c) / (start_k - end_k);
+ float join_y = start_k * join_x + start_outside_c;
rect->UpdateRect(join_x, join_y);
}
@@ -203,10 +202,10 @@ void CFX_PathData::AppendPoint(const CFX_PointF& point,
m_Points.push_back(FX_PATHPOINT(point, type, closeFigure));
}
-void CFX_PathData::AppendRect(FX_FLOAT left,
- FX_FLOAT bottom,
- FX_FLOAT right,
- FX_FLOAT top) {
+void CFX_PathData::AppendRect(float left,
+ float bottom,
+ float right,
+ float top) {
m_Points.push_back(
FX_PATHPOINT(CFX_PointF(left, bottom), FXPT_TYPE::MoveTo, false));
m_Points.push_back(
@@ -230,11 +229,11 @@ CFX_FloatRect CFX_PathData::GetBoundingBox() const {
return rect;
}
-CFX_FloatRect CFX_PathData::GetBoundingBox(FX_FLOAT line_width,
- FX_FLOAT miter_limit) const {
+CFX_FloatRect CFX_PathData::GetBoundingBox(float line_width,
+ float miter_limit) const {
CFX_FloatRect rect(100000.0f, 100000.0f, -100000.0f, -100000.0f);
size_t iPoint = 0;
- FX_FLOAT half_width = line_width;
+ float half_width = line_width;
int iStartPoint = 0;
int iEndPoint = 0;
int iMiddlePoint = 0;
@@ -360,8 +359,8 @@ bool CFX_PathData::GetZeroAreaPath(const CFX_Matrix* pMatrix,
(m_Points[i].m_Point.y - m_Points[next].m_Point.y) >
0)) {
int pre = i;
- if (FXSYS_fabs(m_Points[i].m_Point.y - m_Points[i - 1].m_Point.y) <
- FXSYS_fabs(m_Points[i].m_Point.y - m_Points[next].m_Point.y)) {
+ if (fabs(m_Points[i].m_Point.y - m_Points[i - 1].m_Point.y) <
+ fabs(m_Points[i].m_Point.y - m_Points[next].m_Point.y)) {
pre--;
next--;
}
@@ -375,8 +374,8 @@ bool CFX_PathData::GetZeroAreaPath(const CFX_Matrix* pMatrix,
(m_Points[i].m_Point.x - m_Points[next].m_Point.x) >
0)) {
int pre = i;
- if (FXSYS_fabs(m_Points[i].m_Point.x - m_Points[i - 1].m_Point.x) <
- FXSYS_fabs(m_Points[i].m_Point.x - m_Points[next].m_Point.x)) {
+ if (fabs(m_Points[i].m_Point.x - m_Points[i - 1].m_Point.x) <
+ fabs(m_Points[i].m_Point.x - m_Points[next].m_Point.x)) {
pre--;
next--;
}
diff --git a/chromium/third_party/pdfium/core/fxge/ge/cfx_renderdevice.cpp b/chromium/third_party/pdfium/core/fxge/ge/cfx_renderdevice.cpp
index daa67ccc91b..46127ccb07a 100644
--- a/chromium/third_party/pdfium/core/fxge/ge/cfx_renderdevice.cpp
+++ b/chromium/third_party/pdfium/core/fxge/ge/cfx_renderdevice.cpp
@@ -16,6 +16,7 @@
#include "core/fxge/cfx_fxgedevice.h"
#include "core/fxge/cfx_graphstatedata.h"
#include "core/fxge/cfx_pathdata.h"
+#include "core/fxge/dib/cfx_imagerenderer.h"
#include "core/fxge/ifx_renderdevicedriver.h"
#if defined _SKIA_SUPPORT_ || defined _SKIA_SUPPORT_PATHS_
@@ -34,17 +35,16 @@ void AdjustGlyphSpace(std::vector<FXTEXT_GLYPHPOS>* pGlyphAndPos) {
for (size_t i = glyphs.size() - 1; i > 1; --i) {
FXTEXT_GLYPHPOS& next = glyphs[i];
int next_origin = bVertical ? next.m_Origin.y : next.m_Origin.x;
- FX_FLOAT next_origin_f = bVertical ? next.m_fOrigin.y : next.m_fOrigin.x;
+ float next_origin_f = bVertical ? next.m_fOrigin.y : next.m_fOrigin.x;
FXTEXT_GLYPHPOS& current = glyphs[i - 1];
int& current_origin = bVertical ? current.m_Origin.y : current.m_Origin.x;
- FX_FLOAT current_origin_f =
+ float current_origin_f =
bVertical ? current.m_fOrigin.y : current.m_fOrigin.x;
int space = next_origin - current_origin;
- FX_FLOAT space_f = next_origin_f - current_origin_f;
- FX_FLOAT error =
- FXSYS_fabs(space_f) - FXSYS_fabs(static_cast<FX_FLOAT>(space));
+ float space_f = next_origin_f - current_origin_f;
+ float error = fabs(space_f) - fabs(static_cast<float>(space));
if (error > 0.5f)
current_origin += space > 0 ? -1 : 1;
}
@@ -195,8 +195,8 @@ void SetAlpha(uint8_t* alpha) {
void SetAlphaDoNothing(uint8_t* alpha) {}
-void DrawNormalTextHelper(CFX_DIBitmap* bitmap,
- const CFX_DIBitmap* pGlyph,
+void DrawNormalTextHelper(const CFX_RetainPtr<CFX_DIBitmap>& bitmap,
+ const CFX_RetainPtr<CFX_DIBitmap>& pGlyph,
int nrows,
int left,
int top,
@@ -417,9 +417,10 @@ CFX_Matrix CFX_RenderDevice::GetCTM() const {
return m_pDeviceDriver->GetCTM();
}
-bool CFX_RenderDevice::CreateCompatibleBitmap(CFX_DIBitmap* pDIB,
- int width,
- int height) const {
+bool CFX_RenderDevice::CreateCompatibleBitmap(
+ const CFX_RetainPtr<CFX_DIBitmap>& pDIB,
+ int width,
+ int height) const {
if (m_RenderCaps & FXRC_CMYK_OUTPUT) {
return pDIB->Create(width, height, m_RenderCaps & FXRC_ALPHA_OUTPUT
? FXDIB_Cmyka
@@ -513,29 +514,29 @@ bool CFX_RenderDevice::DrawPathWithBlend(const CFX_PathData* pPathData,
if (!rect_i.Valid())
return false;
- int width = (int)FXSYS_ceil(rect_f.right - rect_f.left);
+ int width = (int)ceil(rect_f.right - rect_f.left);
if (width < 1) {
width = 1;
if (rect_i.left == rect_i.right)
rect_i.right++;
}
- int height = (int)FXSYS_ceil(rect_f.top - rect_f.bottom);
+ int height = (int)ceil(rect_f.top - rect_f.bottom);
if (height < 1) {
height = 1;
if (rect_i.bottom == rect_i.top)
rect_i.bottom++;
}
if (rect_i.Width() >= width + 1) {
- if (rect_f.left - (FX_FLOAT)(rect_i.left) >
- (FX_FLOAT)(rect_i.right) - rect_f.right) {
+ if (rect_f.left - (float)(rect_i.left) >
+ (float)(rect_i.right) - rect_f.right) {
rect_i.left++;
} else {
rect_i.right--;
}
}
if (rect_i.Height() >= height + 1) {
- if (rect_f.top - (FX_FLOAT)(rect_i.top) >
- (FX_FLOAT)(rect_i.bottom) - rect_f.bottom) {
+ if (rect_f.top - (float)(rect_i.top) >
+ (float)(rect_i.bottom) - rect_f.bottom) {
rect_i.top++;
} else {
rect_i.bottom--;
@@ -608,24 +609,26 @@ bool CFX_RenderDevice::DrawFillStrokePath(const CFX_PathData* pPathData,
pObject2Device->TransformRect(bbox);
CFX_Matrix ctm = GetCTM();
- FX_FLOAT fScaleX = FXSYS_fabs(ctm.a);
- FX_FLOAT fScaleY = FXSYS_fabs(ctm.d);
+ float fScaleX = fabs(ctm.a);
+ float fScaleY = fabs(ctm.d);
FX_RECT rect = bbox.GetOuterRect();
- CFX_DIBitmap bitmap, Backdrop;
- if (!CreateCompatibleBitmap(&bitmap, FXSYS_round(rect.Width() * fScaleX),
+ auto bitmap = pdfium::MakeRetain<CFX_DIBitmap>();
+ auto Backdrop = pdfium::MakeRetain<CFX_DIBitmap>();
+ if (!CreateCompatibleBitmap(bitmap, FXSYS_round(rect.Width() * fScaleX),
FXSYS_round(rect.Height() * fScaleY))) {
return false;
}
- if (bitmap.HasAlpha()) {
- bitmap.Clear(0);
- Backdrop.Copy(&bitmap);
+ if (bitmap->HasAlpha()) {
+ bitmap->Clear(0);
+ Backdrop->Copy(bitmap);
} else {
- if (!m_pDeviceDriver->GetDIBits(&bitmap, rect.left, rect.top))
+ if (!m_pDeviceDriver->GetDIBits(bitmap, rect.left, rect.top))
return false;
- Backdrop.Copy(&bitmap);
+ Backdrop->Copy(bitmap);
}
CFX_FxgeDevice bitmap_device;
- bitmap_device.Attach(&bitmap, false, &Backdrop, true);
+ bitmap_device.Attach(bitmap, false, Backdrop, true);
+
CFX_Matrix matrix;
if (pObject2Device)
matrix = *pObject2Device;
@@ -641,7 +644,7 @@ bool CFX_RenderDevice::DrawFillStrokePath(const CFX_PathData* pPathData,
#endif
FX_RECT src_rect(0, 0, FXSYS_round(rect.Width() * fScaleX),
FXSYS_round(rect.Height() * fScaleY));
- return m_pDeviceDriver->SetDIBits(&bitmap, 0, &src_rect, rect.left, rect.top,
+ return m_pDeviceDriver->SetDIBits(bitmap, 0, &src_rect, rect.left, rect.top,
FXDIB_BLEND_NORMAL);
}
@@ -662,27 +665,27 @@ bool CFX_RenderDevice::FillRectWithBlend(const FX_RECT* pRect,
if (!(m_RenderCaps & FXRC_GET_BITS))
return false;
- CFX_DIBitmap bitmap;
- if (!CreateCompatibleBitmap(&bitmap, pRect->Width(), pRect->Height()))
+ auto bitmap = pdfium::MakeRetain<CFX_DIBitmap>();
+ if (!CreateCompatibleBitmap(bitmap, pRect->Width(), pRect->Height()))
return false;
- if (!m_pDeviceDriver->GetDIBits(&bitmap, pRect->left, pRect->top))
+ if (!m_pDeviceDriver->GetDIBits(bitmap, pRect->left, pRect->top))
return false;
- if (!bitmap.CompositeRect(0, 0, pRect->Width(), pRect->Height(), fill_color,
- 0, nullptr)) {
+ if (!bitmap->CompositeRect(0, 0, pRect->Width(), pRect->Height(), fill_color,
+ 0)) {
return false;
}
FX_RECT src_rect(0, 0, pRect->Width(), pRect->Height());
- m_pDeviceDriver->SetDIBits(&bitmap, 0, &src_rect, pRect->left, pRect->top,
+ m_pDeviceDriver->SetDIBits(bitmap, 0, &src_rect, pRect->left, pRect->top,
FXDIB_BLEND_NORMAL);
return true;
}
-bool CFX_RenderDevice::DrawCosmeticLine(FX_FLOAT x1,
- FX_FLOAT y1,
- FX_FLOAT x2,
- FX_FLOAT y2,
+bool CFX_RenderDevice::DrawCosmeticLine(float x1,
+ float y1,
+ float x2,
+ float y2,
uint32_t color,
int fill_mode,
int blend_type) {
@@ -698,30 +701,34 @@ bool CFX_RenderDevice::DrawCosmeticLine(FX_FLOAT x1,
fill_mode, blend_type);
}
-bool CFX_RenderDevice::GetDIBits(CFX_DIBitmap* pBitmap, int left, int top) {
+bool CFX_RenderDevice::GetDIBits(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
+ int left,
+ int top) {
if (!(m_RenderCaps & FXRC_GET_BITS))
return false;
return m_pDeviceDriver->GetDIBits(pBitmap, left, top);
}
-CFX_DIBitmap* CFX_RenderDevice::GetBackDrop() {
+CFX_RetainPtr<CFX_DIBitmap> CFX_RenderDevice::GetBackDrop() {
return m_pDeviceDriver->GetBackDrop();
}
-bool CFX_RenderDevice::SetDIBitsWithBlend(const CFX_DIBSource* pBitmap,
- int left,
- int top,
- int blend_mode) {
+bool CFX_RenderDevice::SetDIBitsWithBlend(
+ const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
+ int left,
+ int top,
+ int blend_mode) {
ASSERT(!pBitmap->IsAlphaMask());
CFX_Matrix ctm = GetCTM();
- FX_FLOAT fScaleX = FXSYS_fabs(ctm.a);
- FX_FLOAT fScaleY = FXSYS_fabs(ctm.d);
+ float fScaleX = fabs(ctm.a);
+ float fScaleY = fabs(ctm.d);
FX_RECT dest_rect(left, top,
FXSYS_round(left + pBitmap->GetWidth() / fScaleX),
FXSYS_round(top + pBitmap->GetHeight() / fScaleY));
dest_rect.Intersect(m_ClipBox);
if (dest_rect.IsEmpty())
return true;
+
FX_RECT src_rect(dest_rect.left - left, dest_rect.top - top,
dest_rect.left - left + dest_rect.Width(),
dest_rect.top - top + dest_rect.Height());
@@ -733,25 +740,26 @@ bool CFX_RenderDevice::SetDIBitsWithBlend(const CFX_DIBSource* pBitmap,
(pBitmap->HasAlpha() && !(m_RenderCaps & FXRC_ALPHA_IMAGE))) {
if (!(m_RenderCaps & FXRC_GET_BITS))
return false;
+
int bg_pixel_width = FXSYS_round(dest_rect.Width() * fScaleX);
int bg_pixel_height = FXSYS_round(dest_rect.Height() * fScaleY);
- CFX_DIBitmap background;
- if (!background.Create(
+ auto background = pdfium::MakeRetain<CFX_DIBitmap>();
+ if (!background->Create(
bg_pixel_width, bg_pixel_height,
(m_RenderCaps & FXRC_CMYK_OUTPUT) ? FXDIB_Cmyk : FXDIB_Rgb32)) {
return false;
}
- if (!m_pDeviceDriver->GetDIBits(&background, dest_rect.left,
+ if (!m_pDeviceDriver->GetDIBits(background, dest_rect.left,
dest_rect.top)) {
return false;
}
- if (!background.CompositeBitmap(0, 0, bg_pixel_width, bg_pixel_height,
- pBitmap, src_rect.left, src_rect.top,
- blend_mode, nullptr, false, nullptr)) {
+ if (!background->CompositeBitmap(0, 0, bg_pixel_width, bg_pixel_height,
+ pBitmap, src_rect.left, src_rect.top,
+ blend_mode, nullptr, false)) {
return false;
}
FX_RECT rect(0, 0, bg_pixel_width, bg_pixel_height);
- return m_pDeviceDriver->SetDIBits(&background, 0, &rect, dest_rect.left,
+ return m_pDeviceDriver->SetDIBits(background, 0, &rect, dest_rect.left,
dest_rect.top, FXDIB_BLEND_NORMAL);
}
return m_pDeviceDriver->SetDIBits(pBitmap, 0, &src_rect, dest_rect.left,
@@ -759,7 +767,7 @@ bool CFX_RenderDevice::SetDIBitsWithBlend(const CFX_DIBSource* pBitmap,
}
bool CFX_RenderDevice::StretchDIBitsWithFlagsAndBlend(
- const CFX_DIBSource* pBitmap,
+ const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
int left,
int top,
int dest_width,
@@ -776,7 +784,7 @@ bool CFX_RenderDevice::StretchDIBitsWithFlagsAndBlend(
blend_mode);
}
-bool CFX_RenderDevice::SetBitMask(const CFX_DIBSource* pBitmap,
+bool CFX_RenderDevice::SetBitMask(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
int left,
int top,
uint32_t argb) {
@@ -785,23 +793,25 @@ bool CFX_RenderDevice::SetBitMask(const CFX_DIBSource* pBitmap,
FXDIB_BLEND_NORMAL);
}
-bool CFX_RenderDevice::StretchBitMask(const CFX_DIBSource* pBitmap,
- int left,
- int top,
- int dest_width,
- int dest_height,
- uint32_t color) {
+bool CFX_RenderDevice::StretchBitMask(
+ const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
+ int left,
+ int top,
+ int dest_width,
+ int dest_height,
+ uint32_t color) {
return StretchBitMaskWithFlags(pBitmap, left, top, dest_width, dest_height,
color, 0);
}
-bool CFX_RenderDevice::StretchBitMaskWithFlags(const CFX_DIBSource* pBitmap,
- int left,
- int top,
- int dest_width,
- int dest_height,
- uint32_t argb,
- uint32_t flags) {
+bool CFX_RenderDevice::StretchBitMaskWithFlags(
+ const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
+ int left,
+ int top,
+ int dest_width,
+ int dest_height,
+ uint32_t argb,
+ uint32_t flags) {
FX_RECT dest_rect(left, top, left + dest_width, top + dest_height);
FX_RECT clip_box = m_ClipBox;
clip_box.Intersect(dest_rect);
@@ -810,36 +820,35 @@ bool CFX_RenderDevice::StretchBitMaskWithFlags(const CFX_DIBSource* pBitmap,
FXDIB_BLEND_NORMAL);
}
-bool CFX_RenderDevice::StartDIBitsWithBlend(const CFX_DIBSource* pBitmap,
- int bitmap_alpha,
- uint32_t argb,
- const CFX_Matrix* pMatrix,
- uint32_t flags,
- void*& handle,
- int blend_mode) {
+bool CFX_RenderDevice::StartDIBitsWithBlend(
+ const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
+ int bitmap_alpha,
+ uint32_t argb,
+ const CFX_Matrix* pMatrix,
+ uint32_t flags,
+ std::unique_ptr<CFX_ImageRenderer>* handle,
+ int blend_mode) {
return m_pDeviceDriver->StartDIBits(pBitmap, bitmap_alpha, argb, pMatrix,
flags, handle, blend_mode);
}
-bool CFX_RenderDevice::ContinueDIBits(void* handle, IFX_Pause* pPause) {
+bool CFX_RenderDevice::ContinueDIBits(CFX_ImageRenderer* handle,
+ IFX_Pause* pPause) {
return m_pDeviceDriver->ContinueDIBits(handle, pPause);
}
-void CFX_RenderDevice::CancelDIBits(void* handle) {
- m_pDeviceDriver->CancelDIBits(handle);
-}
-
#ifdef _SKIA_SUPPORT_
void CFX_RenderDevice::DebugVerifyBitmapIsPreMultiplied() const {
SkASSERT(0);
}
-bool CFX_RenderDevice::SetBitsWithMask(const CFX_DIBSource* pBitmap,
- const CFX_DIBSource* pMask,
- int left,
- int top,
- int bitmap_alpha,
- int blend_type) {
+bool CFX_RenderDevice::SetBitsWithMask(
+ const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
+ const CFX_RetainPtr<CFX_DIBSource>& pMask,
+ int left,
+ int top,
+ int bitmap_alpha,
+ int blend_type) {
return m_pDeviceDriver->SetBitsWithMask(pBitmap, pMask, left, top,
bitmap_alpha, blend_type);
}
@@ -848,7 +857,7 @@ bool CFX_RenderDevice::SetBitsWithMask(const CFX_DIBSource* pBitmap,
bool CFX_RenderDevice::DrawNormalText(int nChars,
const FXTEXT_CHARPOS* pCharPos,
CFX_Font* pFont,
- FX_FLOAT font_size,
+ float font_size,
const CFX_Matrix* pText2Device,
uint32_t fill_color,
uint32_t text_flags) {
@@ -878,7 +887,7 @@ bool CFX_RenderDevice::DrawNormalText(int nChars,
}
char2device.Scale(font_size, -font_size);
- if (FXSYS_fabs(char2device.a) + FXSYS_fabs(char2device.b) > 50 * 1.0f ||
+ if (fabs(char2device.a) + fabs(char2device.b) > 50 * 1.0f ||
((m_DeviceClass == FXDC_PRINTER) &&
!(text_flags & FXTEXT_PRINTIMAGETEXT))) {
if (pFont->GetFace()) {
@@ -916,8 +925,8 @@ bool CFX_RenderDevice::DrawNormalText(int nChars,
}
std::vector<FXTEXT_GLYPHPOS> glyphs(nChars);
CFX_Matrix matrixCTM = GetCTM();
- FX_FLOAT scale_x = FXSYS_fabs(matrixCTM.a);
- FX_FLOAT scale_y = FXSYS_fabs(matrixCTM.d);
+ float scale_x = fabs(matrixCTM.a);
+ float scale_y = fabs(matrixCTM.d);
CFX_Matrix deviceCtm = char2device;
CFX_Matrix m(scale_x, 0, 0, scale_y, 0, 0);
deviceCtm.Concat(m);
@@ -931,7 +940,7 @@ bool CFX_RenderDevice::DrawNormalText(int nChars,
if (anti_alias < FXFT_RENDER_MODE_LCD)
glyph.m_Origin.x = FXSYS_round(glyph.m_fOrigin.x);
else
- glyph.m_Origin.x = static_cast<int>(FXSYS_floor(glyph.m_fOrigin.x));
+ glyph.m_Origin.x = static_cast<int>(floor(glyph.m_fOrigin.x));
glyph.m_Origin.y = FXSYS_round(glyph.m_fOrigin.y);
if (charpos.m_bGlyphAdjust) {
@@ -958,49 +967,50 @@ bool CFX_RenderDevice::DrawNormalText(int nChars,
bmp_rect1.right++;
bmp_rect1.bottom++;
}
- FX_RECT bmp_rect(FXSYS_round((FX_FLOAT)(bmp_rect1.left) / scale_x),
- FXSYS_round((FX_FLOAT)(bmp_rect1.top) / scale_y),
- FXSYS_round((FX_FLOAT)bmp_rect1.right / scale_x),
- FXSYS_round((FX_FLOAT)bmp_rect1.bottom / scale_y));
+ FX_RECT bmp_rect(FXSYS_round((float)(bmp_rect1.left) / scale_x),
+ FXSYS_round((float)(bmp_rect1.top) / scale_y),
+ FXSYS_round((float)bmp_rect1.right / scale_x),
+ FXSYS_round((float)bmp_rect1.bottom / scale_y));
bmp_rect.Intersect(m_ClipBox);
if (bmp_rect.IsEmpty())
return true;
+
int pixel_width = FXSYS_round(bmp_rect.Width() * scale_x);
int pixel_height = FXSYS_round(bmp_rect.Height() * scale_y);
int pixel_left = FXSYS_round(bmp_rect.left * scale_x);
int pixel_top = FXSYS_round(bmp_rect.top * scale_y);
if (anti_alias == FXFT_RENDER_MODE_MONO) {
- CFX_DIBitmap bitmap;
- if (!bitmap.Create(pixel_width, pixel_height, FXDIB_1bppMask))
+ auto bitmap = pdfium::MakeRetain<CFX_DIBitmap>();
+ if (!bitmap->Create(pixel_width, pixel_height, FXDIB_1bppMask))
return false;
- bitmap.Clear(0);
+ bitmap->Clear(0);
for (const FXTEXT_GLYPHPOS& glyph : glyphs) {
if (!glyph.m_pGlyph)
continue;
- const CFX_DIBitmap* pGlyph = &glyph.m_pGlyph->m_Bitmap;
- bitmap.TransferBitmap(
+ CFX_RetainPtr<CFX_DIBitmap> pGlyph = glyph.m_pGlyph->m_pBitmap;
+ bitmap->TransferBitmap(
glyph.m_Origin.x + glyph.m_pGlyph->m_Left - pixel_left,
glyph.m_Origin.y - glyph.m_pGlyph->m_Top - pixel_top,
pGlyph->GetWidth(), pGlyph->GetHeight(), pGlyph, 0, 0);
}
- return SetBitMask(&bitmap, bmp_rect.left, bmp_rect.top, fill_color);
+ return SetBitMask(bitmap, bmp_rect.left, bmp_rect.top, fill_color);
}
- CFX_DIBitmap bitmap;
+ auto bitmap = pdfium::MakeRetain<CFX_DIBitmap>();
if (m_bpp == 8) {
- if (!bitmap.Create(pixel_width, pixel_height, FXDIB_8bppMask))
+ if (!bitmap->Create(pixel_width, pixel_height, FXDIB_8bppMask))
return false;
} else {
- if (!CreateCompatibleBitmap(&bitmap, pixel_width, pixel_height))
+ if (!CreateCompatibleBitmap(bitmap, pixel_width, pixel_height))
return false;
}
- if (!bitmap.HasAlpha() && !bitmap.IsAlphaMask()) {
- bitmap.Clear(0xFFFFFFFF);
- if (!GetDIBits(&bitmap, bmp_rect.left, bmp_rect.top))
+ if (!bitmap->HasAlpha() && !bitmap->IsAlphaMask()) {
+ bitmap->Clear(0xFFFFFFFF);
+ if (!GetDIBits(bitmap, bmp_rect.left, bmp_rect.top))
return false;
} else {
- bitmap.Clear(0);
- if (bitmap.m_pAlphaMask)
- bitmap.m_pAlphaMask->Clear(0);
+ bitmap->Clear(0);
+ if (bitmap->m_pAlphaMask)
+ bitmap->m_pAlphaMask->Clear(0);
}
int dest_width = pixel_width;
int a = 0;
@@ -1026,14 +1036,13 @@ bool CFX_RenderDevice::DrawNormalText(int nChars,
if (!top.IsValid())
return false;
- const CFX_DIBitmap* pGlyph = &glyph.m_pGlyph->m_Bitmap;
+ CFX_RetainPtr<CFX_DIBitmap> pGlyph = glyph.m_pGlyph->m_pBitmap;
int ncols = pGlyph->GetWidth();
int nrows = pGlyph->GetHeight();
if (anti_alias == FXFT_RENDER_MODE_NORMAL) {
- if (!bitmap.CompositeMask(left.ValueOrDie(), top.ValueOrDie(), ncols,
- nrows, pGlyph, fill_color, 0, 0,
- FXDIB_BLEND_NORMAL, nullptr, false, 0,
- nullptr)) {
+ if (!bitmap->CompositeMask(left.ValueOrDie(), top.ValueOrDie(), ncols,
+ nrows, pGlyph, fill_color, 0, 0,
+ FXDIB_BLEND_NORMAL, nullptr, false, 0)) {
return false;
}
continue;
@@ -1053,21 +1062,21 @@ bool CFX_RenderDevice::DrawNormalText(int nChars,
if (start_col >= end_col)
continue;
- DrawNormalTextHelper(&bitmap, pGlyph, nrows, left.ValueOrDie(),
+ DrawNormalTextHelper(bitmap, pGlyph, nrows, left.ValueOrDie(),
top.ValueOrDie(), start_col, end_col, bNormal,
bBGRStripe, x_subpixel, a, r, g, b);
}
- if (bitmap.IsAlphaMask())
- SetBitMask(&bitmap, bmp_rect.left, bmp_rect.top, fill_color);
+ if (bitmap->IsAlphaMask())
+ SetBitMask(bitmap, bmp_rect.left, bmp_rect.top, fill_color);
else
- SetDIBits(&bitmap, bmp_rect.left, bmp_rect.top);
+ SetDIBits(bitmap, bmp_rect.left, bmp_rect.top);
return true;
}
bool CFX_RenderDevice::DrawTextPath(int nChars,
const FXTEXT_CHARPOS* pCharPos,
CFX_Font* pFont,
- FX_FLOAT font_size,
+ float font_size,
const CFX_Matrix* pText2User,
const CFX_Matrix* pUser2Device,
const CFX_GraphStateData* pGraphState,
diff --git a/chromium/third_party/pdfium/core/fxge/ge/cfx_unicodeencodingex.cpp b/chromium/third_party/pdfium/core/fxge/ge/cfx_unicodeencodingex.cpp
index c7e3303f026..cd7625fb17d 100644
--- a/chromium/third_party/pdfium/core/fxge/ge/cfx_unicodeencodingex.cpp
+++ b/chromium/third_party/pdfium/core/fxge/ge/cfx_unicodeencodingex.cpp
@@ -62,7 +62,7 @@ uint32_t CFX_UnicodeEncodingEx::GlyphFromCharCode(uint32_t charcode) {
return 0;
}
-uint32_t CFX_UnicodeEncodingEx::CharCodeFromUnicode(FX_WCHAR Unicode) const {
+uint32_t CFX_UnicodeEncodingEx::CharCodeFromUnicode(wchar_t Unicode) const {
if (m_nEncodingID == FXFM_ENCODING_UNICODE ||
m_nEncodingID == FXFM_ENCODING_MS_SYMBOL) {
return Unicode;
diff --git a/chromium/third_party/pdfium/core/fxge/ge/fx_ge_linux.cpp b/chromium/third_party/pdfium/core/fxge/ge/fx_ge_linux.cpp
index e7086bb4e0a..502a3674aba 100644
--- a/chromium/third_party/pdfium/core/fxge/ge/fx_ge_linux.cpp
+++ b/chromium/third_party/pdfium/core/fxge/ge/fx_ge_linux.cpp
@@ -15,7 +15,7 @@ namespace {
const size_t kLinuxGpNameSize = 6;
-const FX_CHAR* const g_LinuxGpFontList[][kLinuxGpNameSize] = {
+const char* const g_LinuxGpFontList[][kLinuxGpNameSize] = {
{"TakaoPGothic", "VL PGothic", "IPAPGothic", "VL Gothic", "Kochi Gothic",
"VL Gothic regular"},
{"TakaoGothic", "VL Gothic", "IPAGothic", "Kochi Gothic", nullptr,
@@ -26,19 +26,19 @@ const FX_CHAR* const g_LinuxGpFontList[][kLinuxGpNameSize] = {
"VL Gothic regular"},
};
-const FX_CHAR* const g_LinuxGbFontList[] = {
+const char* const g_LinuxGbFontList[] = {
"AR PL UMing CN Light", "WenQuanYi Micro Hei", "AR PL UKai CN",
};
-const FX_CHAR* const g_LinuxB5FontList[] = {
+const char* const g_LinuxB5FontList[] = {
"AR PL UMing TW Light", "WenQuanYi Micro Hei", "AR PL UKai TW",
};
-const FX_CHAR* const g_LinuxHGFontList[] = {
+const char* const g_LinuxHGFontList[] = {
"UnDotum",
};
-size_t GetJapanesePreference(const FX_CHAR* facearr,
+size_t GetJapanesePreference(const char* facearr,
int weight,
int pitch_family) {
CFX_ByteString face = facearr;
@@ -72,7 +72,7 @@ class CFX_LinuxFontInfo : public CFX_FolderFontInfo {
bool bItalic,
int charset,
int pitch_family,
- const FX_CHAR* family,
+ const char* family,
int& iExact) override;
bool ParseFontCfg(const char** pUserPaths);
};
@@ -81,7 +81,7 @@ void* CFX_LinuxFontInfo::MapFont(int weight,
bool bItalic,
int charset,
int pitch_family,
- const FX_CHAR* cstr_face,
+ const char* cstr_face,
int& iExact) {
void* font = GetSubstFont(cstr_face);
if (font) {
diff --git a/chromium/third_party/pdfium/core/fxge/ge/fx_ge_text.cpp b/chromium/third_party/pdfium/core/fxge/ge/fx_ge_text.cpp
index 669969db0bc..b451b543fcd 100644
--- a/chromium/third_party/pdfium/core/fxge/ge/fx_ge_text.cpp
+++ b/chromium/third_party/pdfium/core/fxge/ge/fx_ge_text.cpp
@@ -45,8 +45,8 @@ ScopedFontTransform::~ScopedFontTransform() {
FX_RECT FXGE_GetGlyphsBBox(const std::vector<FXTEXT_GLYPHPOS>& glyphs,
int anti_alias,
- FX_FLOAT retinaScaleX,
- FX_FLOAT retinaScaleY) {
+ float retinaScaleX,
+ float retinaScaleY) {
FX_RECT rect(0, 0, 0, 0);
bool bStarted = false;
for (const FXTEXT_GLYPHPOS& glyph : glyphs) {
@@ -59,7 +59,7 @@ FX_RECT FXGE_GetGlyphsBBox(const std::vector<FXTEXT_GLYPHPOS>& glyphs,
if (!char_left.IsValid())
continue;
- FX_SAFE_INT32 char_width = pGlyph->m_Bitmap.GetWidth();
+ FX_SAFE_INT32 char_width = pGlyph->m_pBitmap->GetWidth();
char_width /= retinaScaleX;
if (anti_alias == FXFT_RENDER_MODE_LCD)
char_width /= 3;
@@ -75,7 +75,7 @@ FX_RECT FXGE_GetGlyphsBBox(const std::vector<FXTEXT_GLYPHPOS>& glyphs,
if (!char_top.IsValid())
continue;
- FX_SAFE_INT32 char_height = pGlyph->m_Bitmap.GetHeight();
+ FX_SAFE_INT32 char_height = pGlyph->m_pBitmap->GetHeight();
char_height /= retinaScaleY;
if (!char_height.IsValid())
continue;
diff --git a/chromium/third_party/pdfium/core/fxge/ge/fx_text_int.h b/chromium/third_party/pdfium/core/fxge/ge/fx_text_int.h
index 4de6587d411..8ea01f91d67 100644
--- a/chromium/third_party/pdfium/core/fxge/ge/fx_text_int.h
+++ b/chromium/third_party/pdfium/core/fxge/ge/fx_text_int.h
@@ -14,7 +14,7 @@
struct _CFX_UniqueKeyGen {
void Generate(int count, ...);
- FX_CHAR m_Key[128];
+ char m_Key[128];
int m_KeyLen;
};
diff --git a/chromium/third_party/pdfium/core/fxge/ifx_renderdevicedriver.cpp b/chromium/third_party/pdfium/core/fxge/ifx_renderdevicedriver.cpp
index 77af00f4306..fae86cbfc65 100644
--- a/chromium/third_party/pdfium/core/fxge/ifx_renderdevicedriver.cpp
+++ b/chromium/third_party/pdfium/core/fxge/ifx_renderdevicedriver.cpp
@@ -39,36 +39,36 @@ bool IFX_RenderDeviceDriver::FillRectWithBlend(const FX_RECT* pRect,
return false;
}
-bool IFX_RenderDeviceDriver::DrawCosmeticLine(FX_FLOAT x1,
- FX_FLOAT y1,
- FX_FLOAT x2,
- FX_FLOAT y2,
+bool IFX_RenderDeviceDriver::DrawCosmeticLine(float x1,
+ float y1,
+ float x2,
+ float y2,
uint32_t color,
int blend_type) {
return false;
}
-bool IFX_RenderDeviceDriver::GetDIBits(CFX_DIBitmap* pBitmap,
- int left,
- int top) {
+bool IFX_RenderDeviceDriver::GetDIBits(
+ const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
+ int left,
+ int top) {
return false;
}
-CFX_DIBitmap* IFX_RenderDeviceDriver::GetBackDrop() {
- return nullptr;
+CFX_RetainPtr<CFX_DIBitmap> IFX_RenderDeviceDriver::GetBackDrop() {
+ return CFX_RetainPtr<CFX_DIBitmap>();
}
-bool IFX_RenderDeviceDriver::ContinueDIBits(void* handle, IFX_Pause* pPause) {
+bool IFX_RenderDeviceDriver::ContinueDIBits(CFX_ImageRenderer* handle,
+ IFX_Pause* pPause) {
return false;
}
-void IFX_RenderDeviceDriver::CancelDIBits(void* handle) {}
-
bool IFX_RenderDeviceDriver::DrawDeviceText(int nChars,
const FXTEXT_CHARPOS* pCharPos,
CFX_Font* pFont,
const CFX_Matrix* pObject2Device,
- FX_FLOAT font_size,
+ float font_size,
uint32_t color) {
return false;
}
@@ -91,12 +91,13 @@ bool IFX_RenderDeviceDriver::DrawShading(const CPDF_ShadingPattern* pPattern,
return false;
}
-bool IFX_RenderDeviceDriver::SetBitsWithMask(const CFX_DIBSource* pBitmap,
- const CFX_DIBSource* pMask,
- int left,
- int top,
- int bitmap_alpha,
- int blend_type) {
+bool IFX_RenderDeviceDriver::SetBitsWithMask(
+ const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
+ const CFX_RetainPtr<CFX_DIBSource>& pMask,
+ int left,
+ int top,
+ int bitmap_alpha,
+ int blend_type) {
return false;
}
diff --git a/chromium/third_party/pdfium/core/fxge/ifx_renderdevicedriver.h b/chromium/third_party/pdfium/core/fxge/ifx_renderdevicedriver.h
index fd35149e42e..97f35b641b3 100644
--- a/chromium/third_party/pdfium/core/fxge/ifx_renderdevicedriver.h
+++ b/chromium/third_party/pdfium/core/fxge/ifx_renderdevicedriver.h
@@ -7,12 +7,16 @@
#ifndef CORE_FXGE_IFX_RENDERDEVICEDRIVER_H_
#define CORE_FXGE_IFX_RENDERDEVICEDRIVER_H_
+#include <memory>
+
+#include "core/fxcrt/cfx_retain_ptr.h"
#include "core/fxcrt/fx_system.h"
class CFX_DIBitmap;
class CFX_DIBSource;
class CFX_Font;
class CFX_GraphStateData;
+class CFX_ImageRenderer;
class CFX_Matrix;
class CFX_PathData;
class CPDF_ShadingPattern;
@@ -49,23 +53,25 @@ class IFX_RenderDeviceDriver {
virtual bool FillRectWithBlend(const FX_RECT* pRect,
uint32_t fill_color,
int blend_type);
- virtual bool DrawCosmeticLine(FX_FLOAT x1,
- FX_FLOAT y1,
- FX_FLOAT x2,
- FX_FLOAT y2,
+ virtual bool DrawCosmeticLine(float x1,
+ float y1,
+ float x2,
+ float y2,
uint32_t color,
int blend_type);
virtual bool GetClipBox(FX_RECT* pRect) = 0;
- virtual bool GetDIBits(CFX_DIBitmap* pBitmap, int left, int top);
- virtual CFX_DIBitmap* GetBackDrop();
- virtual bool SetDIBits(const CFX_DIBSource* pBitmap,
+ virtual bool GetDIBits(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
+ int left,
+ int top);
+ virtual CFX_RetainPtr<CFX_DIBitmap> GetBackDrop();
+ virtual bool SetDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
uint32_t color,
const FX_RECT* pSrcRect,
int dest_left,
int dest_top,
int blend_type) = 0;
- virtual bool StretchDIBits(const CFX_DIBSource* pBitmap,
+ virtual bool StretchDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
uint32_t color,
int dest_left,
int dest_top,
@@ -74,20 +80,19 @@ class IFX_RenderDeviceDriver {
const FX_RECT* pClipRect,
uint32_t flags,
int blend_type) = 0;
- virtual bool StartDIBits(const CFX_DIBSource* pBitmap,
+ virtual bool StartDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
int bitmap_alpha,
uint32_t color,
const CFX_Matrix* pMatrix,
uint32_t flags,
- void*& handle,
+ std::unique_ptr<CFX_ImageRenderer>* handle,
int blend_type) = 0;
- virtual bool ContinueDIBits(void* handle, IFX_Pause* pPause);
- virtual void CancelDIBits(void* handle);
+ virtual bool ContinueDIBits(CFX_ImageRenderer* handle, IFX_Pause* pPause);
virtual bool DrawDeviceText(int nChars,
const FXTEXT_CHARPOS* pCharPos,
CFX_Font* pFont,
const CFX_Matrix* pObject2Device,
- FX_FLOAT font_size,
+ float font_size,
uint32_t color);
virtual void* GetPlatformSurface() const;
virtual int GetDriverType() const;
@@ -97,8 +102,8 @@ class IFX_RenderDeviceDriver {
const FX_RECT& clip_rect,
int alpha,
bool bAlphaMode);
- virtual bool SetBitsWithMask(const CFX_DIBSource* pBitmap,
- const CFX_DIBSource* pMask,
+ virtual bool SetBitsWithMask(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
+ const CFX_RetainPtr<CFX_DIBSource>& pMask,
int left,
int top,
int bitmap_alpha,
diff --git a/chromium/third_party/pdfium/core/fxge/ifx_systemfontinfo.h b/chromium/third_party/pdfium/core/fxge/ifx_systemfontinfo.h
index 1ab0ab677c5..ca7ca2c4557 100644
--- a/chromium/third_party/pdfium/core/fxge/ifx_systemfontinfo.h
+++ b/chromium/third_party/pdfium/core/fxge/ifx_systemfontinfo.h
@@ -27,7 +27,7 @@ class IFX_SystemFontInfo {
bool bItalic,
int charset,
int pitch_family,
- const FX_CHAR* face,
+ const char* face,
int& iExact) = 0;
#ifdef PDF_ENABLE_XFA
@@ -37,13 +37,13 @@ class IFX_SystemFontInfo {
int pitch_family);
#endif // PDF_ENABLE_XFA
- virtual void* GetFont(const FX_CHAR* face) = 0;
+ virtual void* GetFont(const char* face) = 0;
virtual uint32_t GetFontData(void* hFont,
uint32_t table,
uint8_t* buffer,
uint32_t size) = 0;
- virtual bool GetFaceName(void* hFont, CFX_ByteString& name) = 0;
- virtual bool GetFontCharset(void* hFont, int& charset) = 0;
+ virtual bool GetFaceName(void* hFont, CFX_ByteString* name) = 0;
+ virtual bool GetFontCharset(void* hFont, int* charset) = 0;
virtual int GetFaceIndex(void* hFont);
virtual void DeleteFont(void* hFont) = 0;
};
diff --git a/chromium/third_party/pdfium/core/fxge/skia/fx_skia_device.cpp b/chromium/third_party/pdfium/core/fxge/skia/fx_skia_device.cpp
index 7e23f97287c..df43c18fcc8 100644
--- a/chromium/third_party/pdfium/core/fxge/skia/fx_skia_device.cpp
+++ b/chromium/third_party/pdfium/core/fxge/skia/fx_skia_device.cpp
@@ -19,6 +19,9 @@
#include "core/fxge/cfx_graphstatedata.h"
#include "core/fxge/cfx_pathdata.h"
#include "core/fxge/cfx_renderdevice.h"
+#include "core/fxge/dib/cfx_bitmapcomposer.h"
+#include "core/fxge/dib/cfx_imagerenderer.h"
+#include "core/fxge/dib/cfx_imagestretcher.h"
#include "core/fxge/skia/fx_skia_device.h"
#ifdef _SKIA_SUPPORT_PATHS_
@@ -48,12 +51,12 @@
namespace {
#ifdef _SKIA_SUPPORT_PATHS_
-void RgbByteOrderTransferBitmap(CFX_DIBitmap* pBitmap,
+void RgbByteOrderTransferBitmap(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
int dest_left,
int dest_top,
int width,
int height,
- const CFX_DIBSource* pSrcBitmap,
+ const CFX_RetainPtr<CFX_DIBSource>& pSrcBitmap,
int src_left,
int src_top) {
if (!pBitmap)
@@ -150,6 +153,9 @@ void RgbByteOrderTransferBitmap(CFX_DIBitmap* pBitmap,
#endif // _SKIA_SUPPORT_PATHS_
#define SHOW_SKIA_PATH 0 // set to 1 to print the path contents
+#if SHOW_SKIA_PATH
+#define SHOW_SKIA_PATH_SHORTHAND 0 // set to 1 for abbreviated path contents
+#endif
#define DRAW_SKIA_CLIP 0 // set to 1 to draw a green rectangle around the clip
#if SHOW_SKIA_PATH
@@ -173,38 +179,31 @@ void DebugShowCanvasMatrix(const SkCanvas* canvas) {
void DebugShowSkiaPath(const SkPath& path) {
#if SHOW_SKIA_PATH
- char buffer[4096];
- sk_bzero(buffer, sizeof(buffer));
- SkMemoryWStream stream(buffer, sizeof(buffer));
+#if SHOW_SKIA_PATH_SHORTHAND
+ printf(" **\n");
+#else
+ SkDynamicMemoryWStream stream;
path.dump(&stream, false, false);
- printf("%s", buffer);
+ std::unique_ptr<char, FxFreeDeleter> storage;
+ storage.reset(FX_Alloc(char, stream.bytesWritten()));
+ stream.copyTo(storage.get());
+ printf("%.*s", (int)stream.bytesWritten(), storage.get());
+#endif // SHOW_SKIA_PATH_SHORTHAND
#endif // SHOW_SKIA_PATH
}
void DebugShowCanvasClip(const SkCanvas* canvas) {
#if SHOW_SKIA_PATH
- SkRect local;
- SkIRect device;
- canvas->getClipBounds(&local);
+ SkRect local = canvas->getLocalClipBounds();
+ SkIRect device = canvas->getDeviceClipBounds();
+
printf("local bounds %g %g %g %g\n", local.fLeft, local.fTop, local.fRight,
local.fBottom);
- canvas->getClipDeviceBounds(&device);
printf("device bounds %d %d %d %d\n", device.fLeft, device.fTop,
device.fRight, device.fBottom);
#endif // SHOW_SKIA_PATH
}
-#if SHOW_SKIA_PATH
-void DebugShowSkiaPaint(const SkPaint& paint) {
- if (SkPaint::kFill_Style == paint.getStyle()) {
- printf("fill 0x%08x\n", paint.getColor());
- } else {
- printf("stroke 0x%08x width %g\n", paint.getColor(),
- paint.getStrokeWidth());
- }
-}
-#endif // SHOW_SKIA_PATH
-
void DebugShowSkiaDrawPath(const SkCanvas* canvas,
const SkPaint& paint,
const SkPath& path) {
@@ -258,8 +257,8 @@ void DebugDrawSkiaClipPath(SkCanvas* canvas, const SkPath& path) {}
#endif // DRAW_SKIA_CLIP
#ifdef _SKIA_SUPPORT_
-static void DebugValidate(const CFX_DIBitmap* bitmap,
- const CFX_DIBitmap* device) {
+static void DebugValidate(const CFX_RetainPtr<CFX_DIBitmap>& bitmap,
+ const CFX_RetainPtr<CFX_DIBitmap>& device) {
if (bitmap) {
SkASSERT(bitmap->GetBPP() == 8 || bitmap->GetBPP() == 32);
if (bitmap->GetBPP() == 32) {
@@ -368,7 +367,7 @@ bool AddColors(const CPDF_ExpIntFunc* pFunc, SkTDArray<SkColor>* skColors) {
return true;
}
-uint8_t FloatToByte(FX_FLOAT f) {
+uint8_t FloatToByte(float f) {
ASSERT(0 <= f && f <= 1);
return (uint8_t)(f * 255.99f);
}
@@ -395,25 +394,25 @@ bool AddSamples(const CPDF_SampledFunc* pFunc,
if (pFunc->GetSampleStream()->GetSize() < sampleCount * 3 * sampleSize / 8)
return false;
- FX_FLOAT colorsMin[3];
- FX_FLOAT colorsMax[3];
+ float colorsMin[3];
+ float colorsMax[3];
for (int i = 0; i < 3; ++i) {
colorsMin[i] = pFunc->GetRange(i * 2);
colorsMax[i] = pFunc->GetRange(i * 2 + 1);
}
const uint8_t* pSampleData = pFunc->GetSampleStream()->GetData();
for (uint32_t i = 0; i < sampleCount; ++i) {
- FX_FLOAT floatColors[3];
+ float floatColors[3];
for (uint32_t j = 0; j < 3; ++j) {
int sample = GetBits32(pSampleData, (i * 3 + j) * sampleSize, sampleSize);
- FX_FLOAT interp = (FX_FLOAT)sample / (sampleCount - 1);
+ float interp = (float)sample / (sampleCount - 1);
floatColors[j] = colorsMin[j] + (colorsMax[j] - colorsMin[j]) * interp;
}
SkColor color =
SkPackARGB32(0xFF, FloatToByte(floatColors[0]),
FloatToByte(floatColors[1]), FloatToByte(floatColors[2]));
skColors->push(color);
- skPos->push((FX_FLOAT)i / (sampleCount - 1));
+ skPos->push((float)i / (sampleCount - 1));
}
return true;
}
@@ -421,7 +420,7 @@ bool AddSamples(const CPDF_SampledFunc* pFunc,
bool AddStitching(const CPDF_StitchFunc* pFunc,
SkTDArray<SkColor>* skColors,
SkTDArray<SkScalar>* skPos) {
- FX_FLOAT boundsStart = pFunc->GetDomain(0);
+ float boundsStart = pFunc->GetDomain(0);
const auto& subFunctions = pFunc->GetSubFunctions();
int subFunctionCount = subFunctions.size();
@@ -431,7 +430,7 @@ bool AddStitching(const CPDF_StitchFunc* pFunc,
return false;
if (!AddColors(pSubFunc, skColors))
return false;
- FX_FLOAT boundsEnd =
+ float boundsEnd =
i < subFunctionCount - 1 ? pFunc->GetBound(i + 1) : pFunc->GetDomain(1);
skPos->push(boundsStart);
skPos->push(boundsEnd);
@@ -523,7 +522,9 @@ void ClipAngledGradient(const SkPoint pts[2],
}
}
ASSERT(minBounds >= 0);
- ASSERT(maxBounds != minBounds && maxBounds >= 0);
+ ASSERT(maxBounds >= 0);
+ if (minBounds == maxBounds)
+ return;
// construct a clip parallel to the gradient that goes through
// rectPts[minBounds] and rectPts[maxBounds] and perpendicular to the
// gradient that goes through startEdgePt, endEdgePt.
@@ -558,7 +559,7 @@ void SetBitmapPaint(bool isAlphaMask,
paint->setAlpha(bitmap_alpha);
}
-bool Upsample(const CFX_DIBSource* pSource,
+bool Upsample(const CFX_RetainPtr<CFX_DIBSource>& pSource,
std::unique_ptr<uint8_t, FxFreeDeleter>& dst8Storage,
std::unique_ptr<uint32_t, FxFreeDeleter>& dst32Storage,
SkColorTable** ctPtr,
@@ -657,7 +658,7 @@ class SkiaState {
// mark all cached state as uninitialized
explicit SkiaState(CFX_SkiaDeviceDriver* pDriver)
: m_pDriver(pDriver),
- m_pFont(nullptr),
+ m_pTypeFace(nullptr),
m_fontSize(0),
m_fillColor(0),
m_strokeColor(0),
@@ -771,7 +772,7 @@ class SkiaState {
const FXTEXT_CHARPOS* pCharPos,
CFX_Font* pFont,
const CFX_Matrix* pMatrix,
- FX_FLOAT font_size,
+ float font_size,
uint32_t color) {
if (m_debugDisable)
return false;
@@ -785,7 +786,7 @@ class SkiaState {
if (Accumulator::kText != m_type) {
m_positions.setCount(0);
m_glyphs.setCount(0);
- m_pFont = pFont;
+ m_pTypeFace = pFont->GetFace() ? pFont->GetDeviceCache() : nullptr;
m_fontSize = font_size;
m_fillColor = color;
m_drawMatrix = *pMatrix;
@@ -818,8 +819,8 @@ class SkiaState {
SkPaint skPaint;
skPaint.setAntiAlias(true);
skPaint.setColor(m_fillColor);
- if (m_pFont->GetFace()) { // exclude placeholder test fonts
- sk_sp<SkTypeface> typeface(SkSafeRef(m_pFont->GetDeviceCache()));
+ if (m_pTypeFace) { // exclude placeholder test fonts
+ sk_sp<SkTypeface> typeface(SkSafeRef(m_pTypeFace));
skPaint.setTypeface(typeface);
}
skPaint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
@@ -841,6 +842,8 @@ class SkiaState {
m_type = Accumulator::kNone;
}
+ bool IsEmpty() { return !m_commands.count(); }
+
bool SetClipFill(const CFX_PathData* pPathData,
const CFX_Matrix* pMatrix,
int fill_mode) {
@@ -929,20 +932,20 @@ class SkiaState {
Dump(__func__);
int count = m_commands.count();
if (m_commandIndex < count - 1) {
- if (Clip::kSave == m_commands[m_commandIndex + 1]) {
+ if (Clip::kSave == m_commands[m_commandIndex]) {
++m_commandIndex;
return true;
}
Flush();
AdjustClip(m_commandIndex);
- m_commands[++m_commandIndex] = Clip::kSave;
+ m_commands[m_commandIndex] = Clip::kSave;
m_clips[m_commandIndex] = m_skEmptyPath;
} else {
AdjustClip(m_commandIndex);
m_commands.push(Clip::kSave);
m_clips.push_back(m_skEmptyPath);
- ++m_commandIndex;
}
+ ++m_commandIndex;
return true;
}
@@ -973,9 +976,11 @@ class SkiaState {
bool FontChanged(CFX_Font* pFont,
const CFX_Matrix* pMatrix,
- FX_FLOAT font_size,
+ float font_size,
uint32_t color) const {
- return pFont != m_pFont || MatrixChanged(pMatrix, m_drawMatrix) ||
+ CFX_TypeFace* typeface =
+ pFont->GetFace() ? pFont->GetDeviceCache() : nullptr;
+ return typeface != m_pTypeFace || MatrixChanged(pMatrix, m_drawMatrix) ||
font_size != m_fontSize || color != m_fillColor;
}
@@ -1077,34 +1082,177 @@ class SkiaState {
void Dump(const char* where) const {
#if SHOW_SKIA_PATH
- printf("\n%s\nSkia Save Count %d:\n", where,
- m_pDriver->m_pCanvas->getSaveCount());
+ if (m_debugDisable)
+ return;
+ printf(
+ "\n%s\nSkia Save Count %d Agg Save Count %d"
+ " Cache Save Count %d\n",
+ where, m_pDriver->m_pCanvas->getSaveCount(),
+ (int)m_pDriver->m_StateStack.size(), m_commandIndex);
printf("Cache:\n");
+#if SHOW_SKIA_PATH_SHORTHAND
+ bool dumpedPath = false;
+#endif
for (int index = 0; index < m_commands.count(); ++index) {
+#if SHOW_SKIA_PATH_SHORTHAND
+ if (Clip::kSave == m_commands[index] && dumpedPath) {
+ printf("\n");
+ dumpedPath = false;
+ }
+#endif
DumpPrefix(index);
switch (m_commands[index]) {
case Clip::kSave:
printf("Save %d\n", ++m_debugSaveCounter);
break;
case Clip::kPath:
+#if SHOW_SKIA_PATH_SHORTHAND
+ printf("*");
+ dumpedPath = true;
+#else
m_clips[index].dump();
+#endif
break;
default:
printf("unknown\n");
}
}
+#if SHOW_SKIA_PATH_SHORTHAND
+ if (dumpedPath)
+ printf("\n");
+#endif
DumpEndPrefix();
-#endif // SHOW_SKIA_PATH
-#ifdef SK_DEBUG
int skCanvasSaveCount = m_pDriver->m_pCanvas->getSaveCount();
int cacheSaveCount = 1;
SkASSERT(m_clipIndex <= m_commands.count());
for (int index = 0; index < m_clipIndex; ++index)
cacheSaveCount += Clip::kSave == m_commands[index];
SkASSERT(skCanvasSaveCount == cacheSaveCount);
-#endif
+#endif // SHOW_SKIA_PATH
+ }
+
+ void DebugCheckClip() {
+#if SHOW_SKIA_PATH
+ if (m_debugDisable)
+ return;
+ int aggSaveCount = 0;
+ FX_RECT last;
+ bool foundLast = false;
+ for (int index = 0; index < (int)m_pDriver->m_StateStack.size(); ++index) {
+ if (!m_pDriver->m_StateStack[index]) {
+ continue;
+ }
+ if (m_pDriver->m_StateStack[index]->GetType() != CFX_ClipRgn::RectI) {
+ aggSaveCount += 1;
+ foundLast = false;
+ continue;
+ }
+ if (!foundLast || memcmp(&last, &m_pDriver->m_StateStack[index]->GetBox(),
+ sizeof(FX_RECT))) {
+ aggSaveCount += 1;
+ foundLast = true;
+ last = m_pDriver->m_StateStack[index]->GetBox();
+ }
+ }
+ if (m_pDriver->m_pClipRgn) {
+ CFX_ClipRgn::ClipType clipType = m_pDriver->m_pClipRgn->GetType();
+ if (clipType != CFX_ClipRgn::RectI || !foundLast ||
+ memcmp(&last, &m_pDriver->m_pClipRgn->GetBox(), sizeof(FX_RECT))) {
+ aggSaveCount += 1;
+ }
+ }
+ int cacheSaveCount = 0;
+ SkASSERT(m_clipIndex <= m_commands.count());
+ bool newPath = false;
+ for (int index = 0; index < m_commandIndex; ++index) {
+ if (Clip::kSave == m_commands[index]) {
+ newPath = true;
+ } else if (newPath) {
+ ++cacheSaveCount;
+ newPath = false;
+ }
+ }
+ if (aggSaveCount != cacheSaveCount) {
+ DumpClipStacks();
+ SkASSERT(0);
+ return;
+ }
+ for (int aggIndex = 0; aggIndex < (int)m_pDriver->m_StateStack.size();
+ ++aggIndex) {
+ if (!m_pDriver->m_StateStack[aggIndex])
+ continue;
+ if (m_pDriver->m_StateStack[aggIndex]->GetType() != CFX_ClipRgn::RectI)
+ continue;
+ const FX_RECT& aggRect = m_pDriver->m_StateStack[aggIndex]->GetBox();
+ SkRect skRect = SkRect::MakeLTRB(aggRect.left, aggRect.top, aggRect.right,
+ aggRect.bottom);
+ bool foundMatch = false;
+ for (int skIndex = 0; skIndex < m_commandIndex; ++skIndex) {
+ if (Clip::kPath != m_commands[skIndex])
+ continue;
+ const SkPath& clip = m_clips[skIndex];
+ SkRect bounds;
+ if (!clip.isRect(&bounds))
+ continue;
+ bounds.roundOut(&bounds);
+ if (skRect == bounds) {
+ foundMatch = true;
+ break;
+ }
+ }
+ if (!foundMatch) {
+ DumpClipStacks();
+ SkASSERT(0);
+ }
+ }
+#endif // SHOW_SKIA_PATH
}
+#if SHOW_SKIA_PATH
+ void DumpClipStacks() const {
+ if (m_debugDisable)
+ return;
+ printf("\ncache\n");
+ for (int index = 0; index < m_commandIndex; ++index) {
+ DumpPrefix(index);
+ switch (m_commands[index]) {
+ case Clip::kSave:
+ printf("Save\n");
+ break;
+ case Clip::kPath:
+ m_clips[index].dump();
+ break;
+ default:
+ printf("unknown\n");
+ }
+ }
+ printf("\nagg\n");
+ for (int index = 0; index < (int)m_pDriver->m_StateStack.size(); ++index) {
+ if (!m_pDriver->m_StateStack[index]) {
+ printf("null\n");
+ continue;
+ }
+ CFX_ClipRgn::ClipType clipType =
+ m_pDriver->m_StateStack[index]->GetType();
+ const FX_RECT& box = m_pDriver->m_StateStack[index]->GetBox();
+ printf("stack rect: %d,%d,%d,%d mask=%s\n", box.left, box.top, box.right,
+ box.bottom,
+ CFX_ClipRgn::MaskF == clipType
+ ? "1"
+ : CFX_ClipRgn::RectI == clipType ? "0" : "?");
+ }
+ if (m_pDriver->m_pClipRgn) {
+ const FX_RECT& box = m_pDriver->m_pClipRgn->GetBox();
+ CFX_ClipRgn::ClipType clipType = m_pDriver->m_pClipRgn->GetType();
+ printf("clip rect: %d,%d,%d,%d mask=%s\n", box.left, box.top, box.right,
+ box.bottom,
+ CFX_ClipRgn::MaskF == clipType
+ ? "1"
+ : CFX_ClipRgn::RectI == clipType ? "0" : "?");
+ }
+ }
+#endif // SHOW_SKIA_PATH
+
private:
SkTArray<SkPath> m_clips; // stack of clips that may be reused
SkTDArray<Clip> m_commands; // stack of clip-related commands
@@ -1117,8 +1265,8 @@ class SkiaState {
CFX_GraphStateData m_drawState;
CFX_Matrix m_clipMatrix;
CFX_SkiaDeviceDriver* m_pDriver;
- CFX_Font* m_pFont;
- FX_FLOAT m_fontSize;
+ CFX_TypeFace* m_pTypeFace;
+ float m_fontSize;
uint32_t m_fillColor;
uint32_t m_strokeColor;
int m_blendType;
@@ -1131,10 +1279,16 @@ class SkiaState {
bool m_groupKnockout;
bool m_debugDisable; // turn off cache for debugging
#if SHOW_SKIA_PATH
+ public:
mutable int m_debugSaveCounter;
+ static int m_debugInitCounter;
#endif
};
+#if SHOW_SKIA_PATH
+int SkiaState::m_debugInitCounter;
+#endif
+
// convert a stroking path to scanlines
void CFX_SkiaDeviceDriver::PaintStroke(SkPaint* spaint,
const CFX_GraphStateData* pGraphState,
@@ -1170,27 +1324,28 @@ void CFX_SkiaDeviceDriver::PaintStroke(SkPaint* spaint,
inverse.set(SkMatrix::kMTransY, 0);
SkVector deviceUnits[2] = {{0, 1}, {1, 0}};
inverse.mapPoints(deviceUnits, SK_ARRAY_COUNT(deviceUnits));
- FX_FLOAT width =
+ float width =
SkTMax(pGraphState->m_LineWidth,
SkTMin(deviceUnits[0].length(), deviceUnits[1].length()));
if (pGraphState->m_DashArray) {
int count = (pGraphState->m_DashCount + 1) / 2;
- SkScalar* intervals = FX_Alloc2D(SkScalar, count, sizeof(SkScalar));
+ std::unique_ptr<SkScalar, FxFreeDeleter> intervals(
+ FX_Alloc2D(SkScalar, count, sizeof(SkScalar)));
// Set dash pattern
for (int i = 0; i < count; i++) {
- FX_FLOAT on = pGraphState->m_DashArray[i * 2];
+ float on = pGraphState->m_DashArray[i * 2];
if (on <= 0.000001f)
on = 1.f / 10;
- FX_FLOAT off = i * 2 + 1 == pGraphState->m_DashCount
- ? on
- : pGraphState->m_DashArray[i * 2 + 1];
+ float off = i * 2 + 1 == pGraphState->m_DashCount
+ ? on
+ : pGraphState->m_DashArray[i * 2 + 1];
if (off < 0)
off = 0;
- intervals[i * 2] = on;
- intervals[i * 2 + 1] = off;
+ intervals.get()[i * 2] = on;
+ intervals.get()[i * 2 + 1] = off;
}
- spaint->setPathEffect(
- SkDashPathEffect::Make(intervals, count * 2, pGraphState->m_DashPhase));
+ spaint->setPathEffect(SkDashPathEffect::Make(intervals.get(), count * 2,
+ pGraphState->m_DashPhase));
}
spaint->setStyle(SkPaint::kStroke_Style);
spaint->setAntiAlias(true);
@@ -1200,10 +1355,11 @@ void CFX_SkiaDeviceDriver::PaintStroke(SkPaint* spaint,
spaint->setStrokeJoin(join);
}
-CFX_SkiaDeviceDriver::CFX_SkiaDeviceDriver(CFX_DIBitmap* pBitmap,
- bool bRgbByteOrder,
- CFX_DIBitmap* pOriDevice,
- bool bGroupKnockout)
+CFX_SkiaDeviceDriver::CFX_SkiaDeviceDriver(
+ const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
+ bool bRgbByteOrder,
+ const CFX_RetainPtr<CFX_DIBitmap>& pOriDevice,
+ bool bGroupKnockout)
: m_pBitmap(pBitmap),
m_pOriDevice(pOriDevice),
m_pRecorder(nullptr),
@@ -1261,7 +1417,7 @@ bool CFX_SkiaDeviceDriver::DrawDeviceText(int nChars,
const FXTEXT_CHARPOS* pCharPos,
CFX_Font* pFont,
const CFX_Matrix* pObject2Device,
- FX_FLOAT font_size,
+ float font_size,
uint32_t color) {
if (m_pCache->DrawText(nChars, pCharPos, pFont, pObject2Device, font_size,
color)) {
@@ -1354,10 +1510,14 @@ int CFX_SkiaDeviceDriver::GetDeviceCaps(int caps_id) const {
}
void CFX_SkiaDeviceDriver::SaveState() {
+ m_pCache->DebugCheckClip();
if (!m_pCache->ClipSave())
m_pCanvas->save();
#ifdef _SKIA_SUPPORT_PATHS_
+#if SHOW_SKIA_PATH
+ printf("SaveState %zd\n", m_StateStack.size());
+#endif
std::unique_ptr<CFX_ClipRgn> pClip;
if (m_pClipRgn)
pClip = pdfium::MakeUnique<CFX_ClipRgn>(*m_pClipRgn);
@@ -1366,16 +1526,24 @@ void CFX_SkiaDeviceDriver::SaveState() {
}
void CFX_SkiaDeviceDriver::RestoreState(bool bKeepSaved) {
- if (!m_pCache->ClipRestore())
- m_pCanvas->restore();
- if (bKeepSaved && !m_pCache->ClipSave())
- m_pCanvas->save();
#ifdef _SKIA_SUPPORT_PATHS_
m_pClipRgn.reset();
if (m_StateStack.empty())
return;
-
+#else
+ if (m_pCache->IsEmpty())
+ return;
+#endif
+ if (!m_pCache->ClipRestore())
+ m_pCanvas->restore();
+ if (bKeepSaved && !m_pCache->ClipSave())
+ m_pCanvas->save();
+#ifdef _SKIA_SUPPORT_PATHS_
+#if SHOW_SKIA_PATH
+ printf("RestoreState %zd %s\n", m_StateStack.size(),
+ bKeepSaved ? "bKeepSaved" : "");
+#endif
if (bKeepSaved) {
if (m_StateStack.back())
m_pClipRgn = pdfium::MakeUnique<CFX_ClipRgn>(*m_StateStack.back());
@@ -1383,6 +1551,7 @@ void CFX_SkiaDeviceDriver::RestoreState(bool bKeepSaved) {
m_pClipRgn = std::move(m_StateStack.back());
m_StateStack.pop_back();
}
+ m_pCache->DebugCheckClip();
#endif // _SKIA_SUPPORT_PATHS_
}
@@ -1392,8 +1561,7 @@ void CFX_SkiaDeviceDriver::SetClipMask(const FX_RECT& clipBox,
FX_RECT path_rect(clipBox.left, clipBox.top, clipBox.right + 1,
clipBox.bottom + 1);
path_rect.Intersect(m_pClipRgn->GetBox());
- CFX_DIBitmapRef mask;
- CFX_DIBitmap* pThisLayer = mask.Emplace();
+ auto pThisLayer = pdfium::MakeRetain<CFX_DIBitmap>();
pThisLayer->Create(path_rect.Width(), path_rect.Height(), FXDIB_8bppMask);
pThisLayer->Clear(0);
@@ -1403,15 +1571,14 @@ void CFX_SkiaDeviceDriver::SetClipMask(const FX_RECT& clipBox,
SkBitmap bitmap;
bitmap.installPixels(imageInfo, pThisLayer->GetBuffer(),
pThisLayer->GetPitch(), nullptr, nullptr, nullptr);
- SkCanvas* canvas = new SkCanvas(bitmap);
+ auto canvas = pdfium::MakeUnique<SkCanvas>(bitmap);
canvas->translate(
-path_rect.left,
-path_rect.top); // FIXME(caryclark) wrong sign(s)? upside down?
SkPaint paint;
paint.setAntiAlias((m_FillFlags & FXFILL_NOPATHSMOOTH) == 0);
canvas->drawPath(path, paint);
- m_pClipRgn->IntersectMaskF(path_rect.left, path_rect.top, mask);
- delete canvas;
+ m_pClipRgn->IntersectMaskF(path_rect.left, path_rect.top, pThisLayer);
}
#endif // _SKIA_SUPPORT_PATHS_
@@ -1435,9 +1602,9 @@ bool CFX_SkiaDeviceDriver::SetClip_PathFill(
pPathData->GetPoints().size() == 4) {
CFX_FloatRect rectf;
if (pPathData->IsRect(deviceMatrix, &rectf)) {
- rectf.Intersect(
- CFX_FloatRect(0, 0, (FX_FLOAT)GetDeviceCaps(FXDC_PIXEL_WIDTH),
- (FX_FLOAT)GetDeviceCaps(FXDC_PIXEL_HEIGHT)));
+ rectf.Intersect(CFX_FloatRect(0, 0,
+ (float)GetDeviceCaps(FXDC_PIXEL_WIDTH),
+ (float)GetDeviceCaps(FXDC_PIXEL_HEIGHT)));
// note that PDF's y-axis goes up; Skia's y-axis goes down
if (!cached) {
SkRect skClipRect =
@@ -1573,10 +1740,10 @@ bool CFX_SkiaDeviceDriver::DrawPath(
return true;
}
-bool CFX_SkiaDeviceDriver::DrawCosmeticLine(FX_FLOAT x1,
- FX_FLOAT y1,
- FX_FLOAT x2,
- FX_FLOAT y2,
+bool CFX_SkiaDeviceDriver::DrawCosmeticLine(float x1,
+ float y1,
+ float x2,
+ float y2,
uint32_t color,
int blend_type) {
return false;
@@ -1661,10 +1828,10 @@ bool CFX_SkiaDeviceDriver::DrawShading(const CPDF_ShadingPattern* pPattern,
SkPath skClip;
SkPath skPath;
if (kAxialShading == shadingType) {
- FX_FLOAT start_x = pCoords->GetNumberAt(0);
- FX_FLOAT start_y = pCoords->GetNumberAt(1);
- FX_FLOAT end_x = pCoords->GetNumberAt(2);
- FX_FLOAT end_y = pCoords->GetNumberAt(3);
+ float start_x = pCoords->GetNumberAt(0);
+ float start_y = pCoords->GetNumberAt(1);
+ float end_x = pCoords->GetNumberAt(2);
+ float end_y = pCoords->GetNumberAt(3);
SkPoint pts[] = {{start_x, start_y}, {end_x, end_y}};
skMatrix.mapPoints(pts, SK_ARRAY_COUNT(pts));
paint.setShader(SkGradientShader::MakeLinear(
@@ -1701,12 +1868,12 @@ bool CFX_SkiaDeviceDriver::DrawShading(const CPDF_ShadingPattern* pPattern,
skPath.addRect(skRect);
skMatrix.setIdentity();
} else if (kRadialShading == shadingType) {
- FX_FLOAT start_x = pCoords->GetNumberAt(0);
- FX_FLOAT start_y = pCoords->GetNumberAt(1);
- FX_FLOAT start_r = pCoords->GetNumberAt(2);
- FX_FLOAT end_x = pCoords->GetNumberAt(3);
- FX_FLOAT end_y = pCoords->GetNumberAt(4);
- FX_FLOAT end_r = pCoords->GetNumberAt(5);
+ float start_x = pCoords->GetNumberAt(0);
+ float start_y = pCoords->GetNumberAt(1);
+ float start_r = pCoords->GetNumberAt(2);
+ float end_x = pCoords->GetNumberAt(3);
+ float end_y = pCoords->GetNumberAt(4);
+ float end_r = pCoords->GetNumberAt(5);
SkPoint pts[] = {{start_x, start_y}, {end_x, end_y}};
paint.setShader(SkGradientShader::MakeTwoPointConical(
@@ -1749,11 +1916,11 @@ bool CFX_SkiaDeviceDriver::DrawShading(const CPDF_ShadingPattern* pPattern,
SkPoint tempCubics[4];
for (int i = 0; i < (int)SK_ARRAY_COUNT(tempCubics); i++)
tempCubics[i] = cubics[(flag * 3 + i) % 12];
- FXSYS_memcpy(cubics, tempCubics, sizeof(tempCubics));
+ memcpy(cubics, tempCubics, sizeof(tempCubics));
SkColor tempColors[2];
tempColors[0] = colors[flag];
tempColors[1] = colors[(flag + 1) % 4];
- FXSYS_memcpy(colors, tempColors, sizeof(tempColors));
+ memcpy(colors, tempColors, sizeof(tempColors));
}
for (int i = iStartPoint; i < (int)SK_ARRAY_COUNT(cubics); i++) {
CFX_PointF point = stream.ReadCoords();
@@ -1761,9 +1928,9 @@ bool CFX_SkiaDeviceDriver::DrawShading(const CPDF_ShadingPattern* pPattern,
cubics[i].fY = point.y;
}
for (int i = iStartColor; i < (int)SK_ARRAY_COUNT(colors); i++) {
- FX_FLOAT r;
- FX_FLOAT g;
- FX_FLOAT b;
+ float r;
+ float g;
+ float b;
std::tie(r, g, b) = stream.ReadColor();
colors[i] = SkColorSetARGBInline(0xFF, (U8CPU)(r * 255),
(U8CPU)(g * 255), (U8CPU)(b * 255));
@@ -1796,7 +1963,9 @@ bool CFX_SkiaDeviceDriver::GetClipBox(FX_RECT* pRect) {
return true;
}
-bool CFX_SkiaDeviceDriver::GetDIBits(CFX_DIBitmap* pBitmap, int left, int top) {
+bool CFX_SkiaDeviceDriver::GetDIBits(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
+ int left,
+ int top) {
if (!m_pBitmap)
return true;
uint8_t* srcBuffer = m_pBitmap->GetBuffer();
@@ -1833,7 +2002,7 @@ bool CFX_SkiaDeviceDriver::GetDIBits(CFX_DIBitmap* pBitmap, int left, int top) {
m_pBitmap->UnPreMultiply();
FX_RECT rect(left, top, left + pBitmap->GetWidth(),
top + pBitmap->GetHeight());
- std::unique_ptr<CFX_DIBitmap> pBack;
+ CFX_RetainPtr<CFX_DIBitmap> pBack;
if (m_pOriDevice) {
pBack = m_pOriDevice->Clone(&rect);
if (!pBack)
@@ -1852,58 +2021,60 @@ bool CFX_SkiaDeviceDriver::GetDIBits(CFX_DIBitmap* pBitmap, int left, int top) {
top = std::min(top, 0);
if (m_bRgbByteOrder) {
RgbByteOrderTransferBitmap(pBitmap, 0, 0, rect.Width(), rect.Height(),
- pBack.get(), left, top);
+ pBack, left, top);
} else {
- bRet = pBitmap->TransferBitmap(0, 0, rect.Width(), rect.Height(),
- pBack.get(), left, top);
+ bRet = pBitmap->TransferBitmap(0, 0, rect.Width(), rect.Height(), pBack,
+ left, top);
}
return bRet;
#endif // _SKIA_SUPPORT_PATHS_
}
-CFX_DIBitmap* CFX_SkiaDeviceDriver::GetBackDrop() {
+CFX_RetainPtr<CFX_DIBitmap> CFX_SkiaDeviceDriver::GetBackDrop() {
return m_pOriDevice;
}
-bool CFX_SkiaDeviceDriver::SetDIBits(const CFX_DIBSource* pBitmap,
- uint32_t argb,
- const FX_RECT* pSrcRect,
- int left,
- int top,
- int blend_type) {
+bool CFX_SkiaDeviceDriver::SetDIBits(
+ const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
+ uint32_t argb,
+ const FX_RECT* pSrcRect,
+ int left,
+ int top,
+ int blend_type) {
if (!m_pBitmap || !m_pBitmap->GetBuffer())
return true;
#ifdef _SKIA_SUPPORT_
CFX_Matrix m(pBitmap->GetWidth(), 0, 0, -pBitmap->GetHeight(), left,
top + pBitmap->GetHeight());
- void* dummy;
- return StartDIBits(pBitmap, 0xFF, argb, &m, 0, dummy, blend_type);
+ std::unique_ptr<CFX_ImageRenderer> dummy;
+ return StartDIBits(pBitmap, 0xFF, argb, &m, 0, &dummy, blend_type);
#endif // _SKIA_SUPPORT_
#ifdef _SKIA_SUPPORT_PATHS_
Flush();
if (pBitmap->IsAlphaMask()) {
- return m_pBitmap->CompositeMask(
- left, top, pSrcRect->Width(), pSrcRect->Height(), pBitmap, argb,
- pSrcRect->left, pSrcRect->top, blend_type, m_pClipRgn.get(),
- m_bRgbByteOrder, 0, nullptr);
+ return m_pBitmap->CompositeMask(left, top, pSrcRect->Width(),
+ pSrcRect->Height(), pBitmap, argb,
+ pSrcRect->left, pSrcRect->top, blend_type,
+ m_pClipRgn.get(), m_bRgbByteOrder, 0);
}
return m_pBitmap->CompositeBitmap(
left, top, pSrcRect->Width(), pSrcRect->Height(), pBitmap, pSrcRect->left,
- pSrcRect->top, blend_type, m_pClipRgn.get(), m_bRgbByteOrder, nullptr);
+ pSrcRect->top, blend_type, m_pClipRgn.get(), m_bRgbByteOrder);
#endif // _SKIA_SUPPORT_PATHS_
}
-bool CFX_SkiaDeviceDriver::StretchDIBits(const CFX_DIBSource* pSource,
- uint32_t argb,
- int dest_left,
- int dest_top,
- int dest_width,
- int dest_height,
- const FX_RECT* pClipRect,
- uint32_t flags,
- int blend_type) {
+bool CFX_SkiaDeviceDriver::StretchDIBits(
+ const CFX_RetainPtr<CFX_DIBSource>& pSource,
+ uint32_t argb,
+ int dest_left,
+ int dest_top,
+ int dest_width,
+ int dest_height,
+ const FX_RECT* pClipRect,
+ uint32_t flags,
+ int blend_type) {
#ifdef _SKIA_SUPPORT_
m_pCache->FlushForDraw();
if (!m_pBitmap->GetBuffer())
@@ -1915,8 +2086,8 @@ bool CFX_SkiaDeviceDriver::StretchDIBits(const CFX_DIBSource* pSource,
SkRect skClipRect = SkRect::MakeLTRB(pClipRect->left, pClipRect->bottom,
pClipRect->right, pClipRect->top);
m_pCanvas->clipRect(skClipRect, SkClipOp::kIntersect, true);
- void* dummy;
- bool result = StartDIBits(pSource, 0xFF, argb, &m, 0, dummy, blend_type);
+ std::unique_ptr<CFX_ImageRenderer> dummy;
+ bool result = StartDIBits(pSource, 0xFF, argb, &m, 0, &dummy, blend_type);
m_pCanvas->restore();
return result;
@@ -1936,7 +2107,7 @@ bool CFX_SkiaDeviceDriver::StretchDIBits(const CFX_DIBSource* pSource,
dest_clip.Intersect(*pClipRect);
CFX_BitmapComposer composer;
composer.Compose(m_pBitmap, m_pClipRgn.get(), 255, argb, dest_clip, false,
- false, false, m_bRgbByteOrder, 0, nullptr, blend_type);
+ false, false, m_bRgbByteOrder, 0, blend_type);
dest_clip.Offset(-dest_rect.left, -dest_rect.top);
CFX_ImageStretcher stretcher(&composer, pSource, dest_width, dest_height,
dest_clip, flags);
@@ -1946,13 +2117,14 @@ bool CFX_SkiaDeviceDriver::StretchDIBits(const CFX_DIBSource* pSource,
#endif // _SKIA_SUPPORT_PATHS_
}
-bool CFX_SkiaDeviceDriver::StartDIBits(const CFX_DIBSource* pSource,
- int bitmap_alpha,
- uint32_t argb,
- const CFX_Matrix* pMatrix,
- uint32_t render_flags,
- void*& handle,
- int blend_type) {
+bool CFX_SkiaDeviceDriver::StartDIBits(
+ const CFX_RetainPtr<CFX_DIBSource>& pSource,
+ int bitmap_alpha,
+ uint32_t argb,
+ const CFX_Matrix* pMatrix,
+ uint32_t render_flags,
+ std::unique_ptr<CFX_ImageRenderer>* handle,
+ int blend_type) {
#ifdef _SKIA_SUPPORT_
m_pCache->FlushForDraw();
DebugValidate(m_pBitmap, m_pOriDevice);
@@ -2000,15 +2172,15 @@ bool CFX_SkiaDeviceDriver::StartDIBits(const CFX_DIBSource* pSource,
if (!m_pBitmap->GetBuffer())
return true;
m_pBitmap->UnPreMultiply();
- CFX_ImageRenderer* pRenderer = new CFX_ImageRenderer;
- pRenderer->Start(m_pBitmap, m_pClipRgn.get(), pSource, bitmap_alpha, argb,
- pMatrix, render_flags, m_bRgbByteOrder, 0, nullptr);
- handle = pRenderer;
+ *handle = pdfium::MakeUnique<CFX_ImageRenderer>();
+ (*handle)->Start(m_pBitmap, m_pClipRgn.get(), pSource, bitmap_alpha, argb,
+ pMatrix, render_flags, m_bRgbByteOrder);
#endif // _SKIA_SUPPORT_PATHS_
return true;
}
-bool CFX_SkiaDeviceDriver::ContinueDIBits(void* handle, IFX_Pause* pPause) {
+bool CFX_SkiaDeviceDriver::ContinueDIBits(CFX_ImageRenderer* handle,
+ IFX_Pause* pPause) {
#ifdef _SKIA_SUPPORT_
m_pCache->FlushForDraw();
return false;
@@ -2019,12 +2191,13 @@ bool CFX_SkiaDeviceDriver::ContinueDIBits(void* handle, IFX_Pause* pPause) {
if (!m_pBitmap->GetBuffer()) {
return true;
}
- return static_cast<CFX_ImageRenderer*>(handle)->Continue(pPause);
+ return handle->Continue(pPause);
#endif // _SKIA_SUPPORT_PATHS_
}
#if defined _SKIA_SUPPORT_
-void CFX_SkiaDeviceDriver::PreMultiply(CFX_DIBitmap* pDIBitmap) {
+void CFX_SkiaDeviceDriver::PreMultiply(
+ const CFX_RetainPtr<CFX_DIBitmap>& pDIBitmap) {
pDIBitmap->PreMultiply();
}
#endif // _SKIA_SUPPORT_
@@ -2080,11 +2253,12 @@ void CFX_DIBitmap::UnPreMultiply() {
#endif // _SKIA_SUPPORT_PATHS_
#ifdef _SKIA_SUPPORT_
-bool CFX_SkiaDeviceDriver::DrawBitsWithMask(const CFX_DIBSource* pSource,
- const CFX_DIBSource* pMask,
- int bitmap_alpha,
- const CFX_Matrix* pMatrix,
- int blend_type) {
+bool CFX_SkiaDeviceDriver::DrawBitsWithMask(
+ const CFX_RetainPtr<CFX_DIBSource>& pSource,
+ const CFX_RetainPtr<CFX_DIBSource>& pMask,
+ int bitmap_alpha,
+ const CFX_Matrix* pMatrix,
+ int blend_type) {
DebugValidate(m_pBitmap, m_pOriDevice);
SkColorTable* srcCt = nullptr;
SkColorTable* maskCt = nullptr;
@@ -2124,12 +2298,13 @@ bool CFX_SkiaDeviceDriver::DrawBitsWithMask(const CFX_DIBSource* pSource,
return true;
}
-bool CFX_SkiaDeviceDriver::SetBitsWithMask(const CFX_DIBSource* pBitmap,
- const CFX_DIBSource* pMask,
- int dest_left,
- int dest_top,
- int bitmap_alpha,
- int blend_type) {
+bool CFX_SkiaDeviceDriver::SetBitsWithMask(
+ const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
+ const CFX_RetainPtr<CFX_DIBSource>& pMask,
+ int dest_left,
+ int dest_top,
+ int bitmap_alpha,
+ int blend_type) {
if (!m_pBitmap || !m_pBitmap->GetBuffer())
return true;
CFX_Matrix m(pBitmap->GetWidth(), 0, 0, -pBitmap->GetHeight(), dest_left,
@@ -2156,11 +2331,7 @@ void CFX_SkiaDeviceDriver::DebugVerifyBitmapIsPreMultiplied() const {
}
#endif // _SKIA_SUPPORT_
-CFX_FxgeDevice::CFX_FxgeDevice() {
-#ifdef _SKIA_SUPPORT_
- m_bOwnedBitmap = false;
-#endif // _SKIA_SUPPORT_
-}
+CFX_FxgeDevice::CFX_FxgeDevice() {}
#ifdef _SKIA_SUPPORT_
void CFX_FxgeDevice::Clear(uint32_t color) {
@@ -2176,9 +2347,9 @@ SkPictureRecorder* CFX_FxgeDevice::CreateRecorder(int size_x, int size_y) {
}
#endif // _SKIA_SUPPORT_
-bool CFX_FxgeDevice::Attach(CFX_DIBitmap* pBitmap,
+bool CFX_FxgeDevice::Attach(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
bool bRgbByteOrder,
- CFX_DIBitmap* pOriDevice,
+ const CFX_RetainPtr<CFX_DIBitmap>& pOriDevice,
bool bGroupKnockout) {
if (!pBitmap)
return false;
@@ -2200,11 +2371,9 @@ bool CFX_FxgeDevice::AttachRecorder(SkPictureRecorder* recorder) {
bool CFX_FxgeDevice::Create(int width,
int height,
FXDIB_Format format,
- CFX_DIBitmap* pOriDevice) {
- m_bOwnedBitmap = true;
- CFX_DIBitmap* pBitmap = new CFX_DIBitmap;
+ const CFX_RetainPtr<CFX_DIBitmap>& pOriDevice) {
+ auto pBitmap = pdfium::MakeRetain<CFX_DIBitmap>();
if (!pBitmap->Create(width, height, format)) {
- delete pBitmap;
return false;
}
SetBitmap(pBitmap);
@@ -2214,12 +2383,7 @@ bool CFX_FxgeDevice::Create(int width,
}
CFX_FxgeDevice::~CFX_FxgeDevice() {
-#ifdef _SKIA_SUPPORT_
Flush();
- // call destructor of CFX_RenderDevice / CFX_SkiaDeviceDriver immediately
- if (m_bOwnedBitmap && GetBitmap())
- delete GetBitmap();
-#endif // _SKIA_SUPPORT_
}
#ifdef _SKIA_SUPPORT_
@@ -2232,12 +2396,13 @@ void CFX_FxgeDevice::DebugVerifyBitmapIsPreMultiplied() const {
#endif // SK_DEBUG
}
-bool CFX_FxgeDevice::SetBitsWithMask(const CFX_DIBSource* pBitmap,
- const CFX_DIBSource* pMask,
- int left,
- int top,
- int bitmap_alpha,
- int blend_type) {
+bool CFX_FxgeDevice::SetBitsWithMask(
+ const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
+ const CFX_RetainPtr<CFX_DIBSource>& pMask,
+ int left,
+ int top,
+ int bitmap_alpha,
+ int blend_type) {
CFX_SkiaDeviceDriver* skDriver =
static_cast<CFX_SkiaDeviceDriver*>(GetDeviceDriver());
if (skDriver)
@@ -2277,10 +2442,10 @@ class CFX_Renderer {
uint32_t m_Color;
bool m_bFullCover;
bool m_bRgbByteOrder;
- CFX_DIBitmap* m_pOriDevice;
+ CFX_RetainPtr<CFX_DIBitmap> m_pOriDevice;
FX_RECT m_ClipBox;
- const CFX_DIBitmap* m_pClipMask;
- CFX_DIBitmap* m_pDevice;
+ CFX_RetainPtr<CFX_DIBitmap> m_pClipMask;
+ CFX_RetainPtr<CFX_DIBitmap> m_pDevice;
const CFX_ClipRgn* m_pClipRgn;
void (CFX_Renderer::*composite_span)(uint8_t*,
int,
@@ -2919,7 +3084,7 @@ class CFX_Renderer {
}
uint8_t* dest_scan = m_pDevice->GetBuffer() + m_pDevice->GetPitch() * y;
uint8_t* dest_scan_extra_alpha = nullptr;
- CFX_DIBitmap* pAlphaMask = m_pDevice->m_pAlphaMask;
+ CFX_RetainPtr<CFX_DIBitmap> pAlphaMask = m_pDevice->m_pAlphaMask;
if (pAlphaMask) {
dest_scan_extra_alpha =
pAlphaMask->GetBuffer() + pAlphaMask->GetPitch() * y;
@@ -2968,8 +3133,8 @@ class CFX_Renderer {
}
}
- bool Init(CFX_DIBitmap* pDevice,
- CFX_DIBitmap* pOriDevice,
+ bool Init(const CFX_RetainPtr<CFX_DIBitmap>& pDevice,
+ const CFX_RetainPtr<CFX_DIBitmap>& pOriDevice,
const CFX_ClipRgn* pClipRgn,
uint32_t color,
bool bFullCover,
@@ -2990,7 +3155,7 @@ class CFX_Renderer {
}
m_pClipMask = nullptr;
if (m_pClipRgn && m_pClipRgn->GetType() == CFX_ClipRgn::MaskF) {
- m_pClipMask = m_pClipRgn->GetMask().GetObject();
+ m_pClipMask = m_pClipRgn->GetMask();
}
m_bFullCover = bFullCover;
bool bObjectCMYK = !!FXGETFLAG_COLORTYPE(alpha_flag);
diff --git a/chromium/third_party/pdfium/core/fxge/skia/fx_skia_device.h b/chromium/third_party/pdfium/core/fxge/skia/fx_skia_device.h
index ecb11045182..cde05eba67d 100644
--- a/chromium/third_party/pdfium/core/fxge/skia/fx_skia_device.h
+++ b/chromium/third_party/pdfium/core/fxge/skia/fx_skia_device.h
@@ -24,9 +24,9 @@ struct SkIRect;
class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver {
public:
- CFX_SkiaDeviceDriver(CFX_DIBitmap* pBitmap,
+ CFX_SkiaDeviceDriver(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
bool bRgbByteOrder,
- CFX_DIBitmap* pOriDevice,
+ const CFX_RetainPtr<CFX_DIBitmap>& pOriDevice,
bool bGroupKnockout);
#ifdef _SKIA_SUPPORT_
explicit CFX_SkiaDeviceDriver(SkPictureRecorder* recorder);
@@ -69,29 +69,31 @@ class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver {
int blend_type) override;
/** Draw a single pixel (device dependant) line */
- bool DrawCosmeticLine(FX_FLOAT x1,
- FX_FLOAT y1,
- FX_FLOAT x2,
- FX_FLOAT y2,
+ bool DrawCosmeticLine(float x1,
+ float y1,
+ float x2,
+ float y2,
uint32_t color,
int blend_type) override;
bool GetClipBox(FX_RECT* pRect) override;
/** Load device buffer into a DIB */
- bool GetDIBits(CFX_DIBitmap* pBitmap, int left, int top) override;
+ bool GetDIBits(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
+ int left,
+ int top) override;
- CFX_DIBitmap* GetBackDrop() override;
+ CFX_RetainPtr<CFX_DIBitmap> GetBackDrop() override;
- bool SetDIBits(const CFX_DIBSource* pBitmap,
+ bool SetDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
uint32_t color,
const FX_RECT* pSrcRect,
int dest_left,
int dest_top,
int blend_type) override;
#ifdef _SKIA_SUPPORT_
- bool SetBitsWithMask(const CFX_DIBSource* pBitmap,
- const CFX_DIBSource* pMask,
+ bool SetBitsWithMask(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
+ const CFX_RetainPtr<CFX_DIBSource>& pMask,
int dest_left,
int dest_top,
int bitmap_alpha,
@@ -102,7 +104,7 @@ class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver {
void SetClipMask(const FX_RECT& clipBox, const SkPath& skClipPath);
#endif
- bool StretchDIBits(const CFX_DIBSource* pBitmap,
+ bool StretchDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
uint32_t color,
int dest_left,
int dest_top,
@@ -112,20 +114,18 @@ class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver {
uint32_t flags,
int blend_type) override;
- bool StartDIBits(const CFX_DIBSource* pBitmap,
+ bool StartDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
int bitmap_alpha,
uint32_t color,
const CFX_Matrix* pMatrix,
uint32_t flags,
- void*& handle,
+ std::unique_ptr<CFX_ImageRenderer>* handle,
int blend_type) override;
- bool ContinueDIBits(void* handle, IFX_Pause* pPause) override;
+ bool ContinueDIBits(CFX_ImageRenderer* handle, IFX_Pause* pPause) override;
- void CancelDIBits(void* handle) override {}
-
- bool DrawBitsWithMask(const CFX_DIBSource* pBitmap,
- const CFX_DIBSource* pMask,
+ bool DrawBitsWithMask(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
+ const CFX_RetainPtr<CFX_DIBSource>& pMask,
int bitmap_alpha,
const CFX_Matrix* pMatrix,
int blend_type);
@@ -134,7 +134,7 @@ class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver {
const FXTEXT_CHARPOS* pCharPos,
CFX_Font* pFont,
const CFX_Matrix* pObject2Device,
- FX_FLOAT font_size,
+ float font_size,
uint32_t color) override;
bool DrawShading(const CPDF_ShadingPattern* pPattern,
@@ -152,7 +152,7 @@ class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver {
void Flush() override;
SkPictureRecorder* GetRecorder() const { return m_pRecorder; }
void PreMultiply() { m_pBitmap->PreMultiply(); }
- static void PreMultiply(CFX_DIBitmap* pDIBitmap);
+ static void PreMultiply(const CFX_RetainPtr<CFX_DIBitmap>& pDIBitmap);
SkCanvas* SkiaCanvas() { return m_pCanvas; }
void DebugVerifyBitmapIsPreMultiplied() const;
void Dump() const;
@@ -160,8 +160,8 @@ class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver {
private:
friend class SkiaState;
- CFX_DIBitmap* m_pBitmap;
- CFX_DIBitmap* m_pOriDevice;
+ CFX_RetainPtr<CFX_DIBitmap> m_pBitmap;
+ CFX_RetainPtr<CFX_DIBitmap> m_pOriDevice;
SkCanvas* m_pCanvas;
SkPictureRecorder* const m_pRecorder;
std::unique_ptr<SkiaState> m_pCache;
diff --git a/chromium/third_party/pdfium/core/fxge/skia/fx_skia_device_unittest.cpp b/chromium/third_party/pdfium/core/fxge/skia/fx_skia_device_unittest.cpp
index afd47780d7f..a47a50c8369 100644
--- a/chromium/third_party/pdfium/core/fxge/skia/fx_skia_device_unittest.cpp
+++ b/chromium/third_party/pdfium/core/fxge/skia/fx_skia_device_unittest.cpp
@@ -41,7 +41,7 @@ void CommonTest(CFX_SkiaDeviceDriver* driver, const State& state) {
charPos[0].m_FontCharWidth = 4;
CFX_Font font;
- FX_FLOAT fontSize = 1;
+ float fontSize = 1;
CFX_PathData clipPath, clipPath2;
clipPath.AppendRect(0, 0, 3, 1);
clipPath2.AppendRect(0, 0, 2, 1);
@@ -125,7 +125,7 @@ void Harness(void (*Test)(CFX_SkiaDeviceDriver*, const State&),
return;
FPDFBitmap_FillRect(bitmap, 0, 0, w, h, 0x00000000);
CFX_FxgeDevice geDevice;
- CFX_DIBitmap* pBitmap = CFXBitmapFromFPDFBitmap(bitmap);
+ CFX_RetainPtr<CFX_DIBitmap> pBitmap(CFXBitmapFromFPDFBitmap(bitmap));
geDevice.Attach(pBitmap, false, nullptr, false);
CFX_SkiaDeviceDriver* driver =
static_cast<CFX_SkiaDeviceDriver*>(geDevice.GetDeviceDriver());
diff --git a/chromium/third_party/pdfium/core/fxge/win32/cfx_psrenderer.cpp b/chromium/third_party/pdfium/core/fxge/win32/cfx_psrenderer.cpp
index 74fae088d98..46af33710c7 100644
--- a/chromium/third_party/pdfium/core/fxge/win32/cfx_psrenderer.cpp
+++ b/chromium/third_party/pdfium/core/fxge/win32/cfx_psrenderer.cpp
@@ -14,6 +14,7 @@
#include "core/fxge/cfx_fontcache.h"
#include "core/fxge/cfx_pathdata.h"
#include "core/fxge/cfx_renderdevice.h"
+#include "core/fxge/dib/cfx_dibextractor.h"
#include "core/fxge/ge/fx_text_int.h"
#include "core/fxge/win32/cpsoutput.h"
#include "third_party/base/ptr_util.h"
@@ -22,7 +23,7 @@ struct PSGlyph {
CFX_Font* m_pFont;
uint32_t m_GlyphIndex;
bool m_bGlyphAdjust;
- FX_FLOAT m_AdjustMatrix[4];
+ float m_AdjustMatrix[4];
};
class CPSFont {
@@ -147,7 +148,7 @@ void CFX_PSRenderer::OutputPath(const CFX_PathData* pPathData,
}
}
}
- m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize());
+ m_pOutput->OutputPS((const char*)buf.GetBuffer(), buf.GetSize());
}
void CFX_PSRenderer::SetClip_PathFill(const CFX_PathData* pPathData,
@@ -180,7 +181,7 @@ void CFX_PSRenderer::SetClip_PathStroke(const CFX_PathData* pPathData,
buf << "mx Cm [" << pObject2Device->a << " " << pObject2Device->b << " "
<< pObject2Device->c << " " << pObject2Device->d << " "
<< pObject2Device->e << " " << pObject2Device->f << "]cm ";
- m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize());
+ m_pOutput->OutputPS((const char*)buf.GetBuffer(), buf.GetSize());
}
OutputPath(pPathData, nullptr);
CFX_FloatRect rect = pPathData->GetBoundingBox(pGraphState->m_LineWidth,
@@ -219,7 +220,7 @@ bool CFX_PSRenderer::DrawPath(const CFX_PathData* pPathData,
buf << "mx Cm [" << pObject2Device->a << " " << pObject2Device->b << " "
<< pObject2Device->c << " " << pObject2Device->d << " "
<< pObject2Device->e << " " << pObject2Device->f << "]cm ";
- m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize());
+ m_pOutput->OutputPS((const char*)buf.GetBuffer(), buf.GetSize());
}
}
OutputPath(pPathData, stroke_alpha ? nullptr : pObject2Device);
@@ -259,8 +260,8 @@ void CFX_PSRenderer::SetGraphState(const CFX_GraphStateData* pGraphState) {
}
if (!m_bGraphStateSet ||
m_CurGraphState.m_DashCount != pGraphState->m_DashCount ||
- FXSYS_memcmp(m_CurGraphState.m_DashArray, pGraphState->m_DashArray,
- sizeof(FX_FLOAT) * m_CurGraphState.m_DashCount)) {
+ memcmp(m_CurGraphState.m_DashArray, pGraphState->m_DashArray,
+ sizeof(float) * m_CurGraphState.m_DashCount)) {
buf << "[";
for (int i = 0; i < pGraphState->m_DashCount; ++i) {
buf << pGraphState->m_DashArray[i] << " ";
@@ -282,7 +283,7 @@ void CFX_PSRenderer::SetGraphState(const CFX_GraphStateData* pGraphState) {
m_CurGraphState.Copy(*pGraphState);
m_bGraphStateSet = true;
if (buf.GetSize()) {
- m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize());
+ m_pOutput->OutputPS((const char*)buf.GetBuffer(), buf.GetSize());
}
}
@@ -306,7 +307,7 @@ static void PSCompressData(int PSLevel,
uint32_t src_size,
uint8_t** output_buf,
uint32_t* output_size,
- const FX_CHAR** filter) {
+ const char** filter) {
*output_buf = src_buf;
*output_size = src_size;
*filter = "";
@@ -338,18 +339,18 @@ static void PSCompressData(int PSLevel,
}
}
-bool CFX_PSRenderer::SetDIBits(const CFX_DIBSource* pSource,
+bool CFX_PSRenderer::SetDIBits(const CFX_RetainPtr<CFX_DIBSource>& pSource,
uint32_t color,
int left,
int top) {
StartRendering();
- CFX_Matrix matrix((FX_FLOAT)(pSource->GetWidth()), 0.0f, 0.0f,
- -(FX_FLOAT)(pSource->GetHeight()), (FX_FLOAT)(left),
- (FX_FLOAT)(top + pSource->GetHeight()));
+ CFX_Matrix matrix((float)(pSource->GetWidth()), 0.0f, 0.0f,
+ -(float)(pSource->GetHeight()), (float)(left),
+ (float)(top + pSource->GetHeight()));
return DrawDIBits(pSource, color, &matrix, 0);
}
-bool CFX_PSRenderer::StretchDIBits(const CFX_DIBSource* pSource,
+bool CFX_PSRenderer::StretchDIBits(const CFX_RetainPtr<CFX_DIBSource>& pSource,
uint32_t color,
int dest_left,
int dest_top,
@@ -357,13 +358,12 @@ bool CFX_PSRenderer::StretchDIBits(const CFX_DIBSource* pSource,
int dest_height,
uint32_t flags) {
StartRendering();
- CFX_Matrix matrix((FX_FLOAT)(dest_width), 0.0f, 0.0f,
- (FX_FLOAT)(-dest_height), (FX_FLOAT)(dest_left),
- (FX_FLOAT)(dest_top + dest_height));
+ CFX_Matrix matrix((float)(dest_width), 0.0f, 0.0f, (float)(-dest_height),
+ (float)(dest_left), (float)(dest_top + dest_height));
return DrawDIBits(pSource, color, &matrix, flags);
}
-bool CFX_PSRenderer::DrawDIBits(const CFX_DIBSource* pSource,
+bool CFX_PSRenderer::DrawDIBits(const CFX_RetainPtr<CFX_DIBSource>& pSource,
uint32_t color,
const CFX_Matrix* pMatrix,
uint32_t flags) {
@@ -392,7 +392,7 @@ bool CFX_PSRenderer::DrawDIBits(const CFX_DIBSource* pSource,
uint8_t* src_buf = FX_Alloc(uint8_t, src_size);
for (int row = 0; row < height; row++) {
const uint8_t* src_scan = pSource->GetScanline(row);
- FXSYS_memcpy(src_buf + row * pitch, src_scan, pitch);
+ memcpy(src_buf + row * pitch, src_scan, pitch);
}
std::unique_ptr<uint8_t, FxFreeDeleter> output_buf;
uint32_t output_size;
@@ -415,30 +415,30 @@ bool CFX_PSRenderer::DrawDIBits(const CFX_DIBSource* pSource,
} else {
buf << "false 1 colorimage\n";
}
- m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize());
+ m_pOutput->OutputPS((const char*)buf.GetBuffer(), buf.GetSize());
WritePSBinary(output_buf.get(), output_size);
output_buf.release();
} else {
CFX_DIBExtractor source_extractor(pSource);
- CFX_MaybeOwned<CFX_DIBSource> pConverted(source_extractor.GetBitmap());
- if (!pConverted.Get())
+ CFX_RetainPtr<CFX_DIBSource> pConverted = source_extractor.GetBitmap();
+ if (!pConverted)
return false;
switch (pSource->GetFormat()) {
case FXDIB_1bppRgb:
case FXDIB_Rgb32:
- pConverted = pConverted->CloneConvert(FXDIB_Rgb).release();
+ pConverted = pConverted->CloneConvert(FXDIB_Rgb);
break;
case FXDIB_8bppRgb:
if (pSource->GetPalette()) {
- pConverted = pConverted->CloneConvert(FXDIB_Rgb).release();
+ pConverted = pConverted->CloneConvert(FXDIB_Rgb);
}
break;
case FXDIB_1bppCmyk:
- pConverted = pConverted->CloneConvert(FXDIB_Cmyk).release();
+ pConverted = pConverted->CloneConvert(FXDIB_Cmyk);
break;
case FXDIB_8bppCmyk:
if (pSource->GetPalette()) {
- pConverted = pConverted->CloneConvert(FXDIB_Cmyk).release();
+ pConverted = pConverted->CloneConvert(FXDIB_Cmyk);
}
break;
default:
@@ -451,10 +451,9 @@ bool CFX_PSRenderer::DrawDIBits(const CFX_DIBSource* pSource,
int bpp = pConverted->GetBPP() / 8;
uint8_t* output_buf = nullptr;
FX_STRSIZE output_size = 0;
- const FX_CHAR* filter = nullptr;
+ const char* filter = nullptr;
if ((m_PSLevel == 2 || flags & FXRENDER_IMAGE_LOSSY) &&
- CCodec_JpegModule::JpegEncode(pConverted.Get(), &output_buf,
- &output_size)) {
+ CCodec_JpegModule::JpegEncode(pConverted, &output_buf, &output_size)) {
filter = "/DCTDecode filter ";
}
if (!filter) {
@@ -472,7 +471,7 @@ bool CFX_PSRenderer::DrawDIBits(const CFX_DIBSource* pSource,
src_scan += 3;
}
} else {
- FXSYS_memcpy(dest_scan, src_scan, src_pitch);
+ memcpy(dest_scan, src_scan, src_pitch);
}
}
uint8_t* compressed_buf;
@@ -493,7 +492,7 @@ bool CFX_PSRenderer::DrawDIBits(const CFX_DIBSource* pSource,
}
buf << "false " << bpp;
buf << " colorimage\n";
- m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize());
+ m_pOutput->OutputPS((const char*)buf.GetBuffer(), buf.GetSize());
WritePSBinary(output_buf, output_size);
FX_Free(output_buf);
}
@@ -518,7 +517,7 @@ void CFX_PSRenderer::SetColor(uint32_t color) {
m_bColorSet = true;
m_LastColor = color;
}
- m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize());
+ m_pOutput->OutputPS((const char*)buf.GetBuffer(), buf.GetSize());
}
}
@@ -534,14 +533,14 @@ void CFX_PSRenderer::FindPSFontGlyph(CFX_FaceCache* pFaceCache,
pPSFont->m_Glyphs[j].m_GlyphIndex == charpos.m_GlyphIndex &&
((!pPSFont->m_Glyphs[j].m_bGlyphAdjust && !charpos.m_bGlyphAdjust) ||
(pPSFont->m_Glyphs[j].m_bGlyphAdjust && charpos.m_bGlyphAdjust &&
- (FXSYS_fabs(pPSFont->m_Glyphs[j].m_AdjustMatrix[0] -
- charpos.m_AdjustMatrix[0]) < 0.01 &&
- FXSYS_fabs(pPSFont->m_Glyphs[j].m_AdjustMatrix[1] -
- charpos.m_AdjustMatrix[1]) < 0.01 &&
- FXSYS_fabs(pPSFont->m_Glyphs[j].m_AdjustMatrix[2] -
- charpos.m_AdjustMatrix[2]) < 0.01 &&
- FXSYS_fabs(pPSFont->m_Glyphs[j].m_AdjustMatrix[3] -
- charpos.m_AdjustMatrix[3]) < 0.01)))) {
+ (fabs(pPSFont->m_Glyphs[j].m_AdjustMatrix[0] -
+ charpos.m_AdjustMatrix[0]) < 0.01 &&
+ fabs(pPSFont->m_Glyphs[j].m_AdjustMatrix[1] -
+ charpos.m_AdjustMatrix[1]) < 0.01 &&
+ fabs(pPSFont->m_Glyphs[j].m_AdjustMatrix[2] -
+ charpos.m_AdjustMatrix[2]) < 0.01 &&
+ fabs(pPSFont->m_Glyphs[j].m_AdjustMatrix[3] -
+ charpos.m_AdjustMatrix[3]) < 0.01)))) {
*ps_fontnum = i;
*ps_glyphindex = j;
return;
@@ -564,7 +563,7 @@ void CFX_PSRenderer::FindPSFontGlyph(CFX_FaceCache* pFaceCache,
"currentdict end\n";
buf << "/X" << static_cast<uint32_t>(m_PSFontList.size() - 1)
<< " exch definefont pop\n";
- m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize());
+ m_pOutput->OutputPS((const char*)buf.GetBuffer(), buf.GetSize());
buf.Clear();
}
*ps_fontnum = m_PSFontList.size() - 1;
@@ -625,14 +624,14 @@ void CFX_PSRenderer::FindPSFontGlyph(CFX_FaceCache* pFaceCache,
buf << "f}bind def end\n";
buf << "/X" << *ps_fontnum << " Ff/Encoding get " << glyphindex << "/"
<< glyphindex << " put\n";
- m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize());
+ m_pOutput->OutputPS((const char*)buf.GetBuffer(), buf.GetSize());
}
bool CFX_PSRenderer::DrawText(int nChars,
const FXTEXT_CHARPOS* pCharPos,
CFX_Font* pFont,
const CFX_Matrix* pObject2Device,
- FX_FLOAT font_size,
+ float font_size,
uint32_t color) {
StartRendering();
int alpha = FXARGB_A(color);
@@ -666,7 +665,7 @@ bool CFX_PSRenderer::DrawText(int nChars,
buf << hex.AsStringC() << "Tj\n";
}
buf << "Q\n";
- m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize());
+ m_pOutput->OutputPS((const char*)buf.GetBuffer(), buf.GetSize());
pCache->ReleaseCachedFace(pFont);
return true;
}
@@ -678,9 +677,9 @@ void CFX_PSRenderer::WritePSBinary(const uint8_t* data, int len) {
if (pEncoders &&
pEncoders->GetBasicModule()->A85Encode(data, len, &dest_buf,
&dest_size)) {
- m_pOutput->OutputPS((const FX_CHAR*)dest_buf, dest_size);
+ m_pOutput->OutputPS((const char*)dest_buf, dest_size);
FX_Free(dest_buf);
} else {
- m_pOutput->OutputPS((const FX_CHAR*)data, len);
+ m_pOutput->OutputPS((const char*)data, len);
}
}
diff --git a/chromium/third_party/pdfium/core/fxge/win32/cfx_psrenderer.h b/chromium/third_party/pdfium/core/fxge/win32/cfx_psrenderer.h
index 163c6180af4..5768d0770f4 100644
--- a/chromium/third_party/pdfium/core/fxge/win32/cfx_psrenderer.h
+++ b/chromium/third_party/pdfium/core/fxge/win32/cfx_psrenderer.h
@@ -51,18 +51,18 @@ class CFX_PSRenderer {
uint32_t fill_color,
uint32_t stroke_color,
int fill_mode);
- bool SetDIBits(const CFX_DIBSource* pBitmap,
+ bool SetDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
uint32_t color,
int dest_left,
int dest_top);
- bool StretchDIBits(const CFX_DIBSource* pBitmap,
+ bool StretchDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
uint32_t color,
int dest_left,
int dest_top,
int dest_width,
int dest_height,
uint32_t flags);
- bool DrawDIBits(const CFX_DIBSource* pBitmap,
+ bool DrawDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
uint32_t color,
const CFX_Matrix* pMatrix,
uint32_t flags);
@@ -70,7 +70,7 @@ class CFX_PSRenderer {
const FXTEXT_CHARPOS* pCharPos,
CFX_Font* pFont,
const CFX_Matrix* pObject2Device,
- FX_FLOAT font_size,
+ float font_size,
uint32_t color);
private:
diff --git a/chromium/third_party/pdfium/core/fxge/win32/cfx_windowsdib.h b/chromium/third_party/pdfium/core/fxge/win32/cfx_windowsdib.h
index 2564b7fa36a..e59e9d60a4e 100644
--- a/chromium/third_party/pdfium/core/fxge/win32/cfx_windowsdib.h
+++ b/chromium/third_party/pdfium/core/fxge/win32/cfx_windowsdib.h
@@ -10,6 +10,9 @@
#ifndef _WINDOWS_
#include <windows.h>
#endif
+
+#include "core/fxge/fx_dib.h"
+
#define WINDIB_OPEN_MEMORY 0x1
#define WINDIB_OPEN_PATHNAME 0x2
@@ -20,20 +23,25 @@ typedef struct WINDIB_Open_Args_ {
size_t memory_size;
- const FX_WCHAR* path_name;
+ const wchar_t* path_name;
} WINDIB_Open_Args_;
class CFX_WindowsDIB : public CFX_DIBitmap {
public:
- CFX_WindowsDIB(HDC hDC, int width, int height);
+ template <typename T, typename... Args>
+ friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args);
+
~CFX_WindowsDIB() override;
- 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* LoadFromFile(const FX_WCHAR* filename);
- static CFX_DIBitmap* LoadFromFile(const FX_CHAR* filename);
- static CFX_DIBitmap* LoadDIBitmap(WINDIB_Open_Args_ args);
+ static CFX_ByteString GetBitmapInfo(
+ const CFX_RetainPtr<CFX_DIBitmap>& pBitmap);
+ static HBITMAP GetDDBitmap(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
+ HDC hDC);
+
+ static CFX_RetainPtr<CFX_DIBitmap> LoadFromBuf(BITMAPINFO* pbmi, void* pData);
+ static CFX_RetainPtr<CFX_DIBitmap> LoadFromFile(const wchar_t* filename);
+ static CFX_RetainPtr<CFX_DIBitmap> LoadFromFile(const char* filename);
+ static CFX_RetainPtr<CFX_DIBitmap> LoadDIBitmap(WINDIB_Open_Args_ args);
HDC GetDC() const { return m_hMemDC; }
HBITMAP GetWindowsBitmap() const { return m_hBitmap; }
@@ -42,6 +50,8 @@ class CFX_WindowsDIB : public CFX_DIBitmap {
void SetToDevice(HDC hDC, int left, int top);
protected:
+ CFX_WindowsDIB(HDC hDC, int width, int height);
+
HDC m_hMemDC;
HBITMAP m_hBitmap;
HBITMAP m_hOldBitmap;
diff --git a/chromium/third_party/pdfium/core/fxge/win32/cpsoutput.cpp b/chromium/third_party/pdfium/core/fxge/win32/cpsoutput.cpp
index 76b37d7dacf..7a8434ec33a 100644
--- a/chromium/third_party/pdfium/core/fxge/win32/cpsoutput.cpp
+++ b/chromium/third_party/pdfium/core/fxge/win32/cpsoutput.cpp
@@ -20,16 +20,16 @@ void CPSOutput::Release() {
delete this;
}
-void CPSOutput::OutputPS(const FX_CHAR* str, int len) {
+void CPSOutput::OutputPS(const char* str, int len) {
if (len < 0)
len = static_cast<int>(FXSYS_strlen(str));
int sent_len = 0;
while (len > 0) {
- FX_CHAR buffer[1026];
+ char buffer[1026];
int send_len = std::min(len, 1024);
*(reinterpret_cast<uint16_t*>(buffer)) = send_len;
- FXSYS_memcpy(buffer + 2, str + sent_len, send_len);
+ memcpy(buffer + 2, str + sent_len, send_len);
// TODO(thestig/rbpotter): Do PASSTHROUGH for non-Chromium usage.
// ExtEscape(m_hDC, PASSTHROUGH, send_len + 2, buffer, 0, nullptr);
diff --git a/chromium/third_party/pdfium/core/fxge/win32/cpsoutput.h b/chromium/third_party/pdfium/core/fxge/win32/cpsoutput.h
index bc9225bd7e8..1a4709b36b5 100644
--- a/chromium/third_party/pdfium/core/fxge/win32/cpsoutput.h
+++ b/chromium/third_party/pdfium/core/fxge/win32/cpsoutput.h
@@ -18,7 +18,7 @@ class CPSOutput {
// IFX_PSOutput
void Release();
- void OutputPS(const FX_CHAR* str, int len);
+ void OutputPS(const char* str, int len);
HDC m_hDC;
};
diff --git a/chromium/third_party/pdfium/core/fxge/win32/dwrite_int.h b/chromium/third_party/pdfium/core/fxge/win32/dwrite_int.h
index 86ead89947a..16be7b7d4fa 100644
--- a/chromium/third_party/pdfium/core/fxge/win32/dwrite_int.h
+++ b/chromium/third_party/pdfium/core/fxge/win32/dwrite_int.h
@@ -7,6 +7,10 @@
#ifndef CORE_FXGE_WIN32_DWRITE_INT_H_
#define CORE_FXGE_WIN32_DWRITE_INT_H_
+#include "core/fxcrt/fx_coordinates.h"
+#include "core/fxge/dib/cfx_dibitmap.h"
+#include "core/fxge/fx_dib.h"
+
#ifndef DECLSPEC_UUID
#if (_MSC_VER >= 1100) && defined(__cplusplus)
#define DECLSPEC_UUID(x) __declspec(uuid(x))
@@ -39,21 +43,22 @@ class CDWriteExt {
void* DwCreateFontFaceFromStream(uint8_t* pData,
uint32_t size,
int simulation_style);
- bool DwCreateRenderingTarget(CFX_DIBitmap* pSrc, void** renderTarget);
+ bool DwCreateRenderingTarget(const CFX_RetainPtr<CFX_DIBitmap>& pSrc,
+ void** renderTarget);
void DwDeleteRenderingTarget(void* renderTarget);
bool DwRendingString(void* renderTarget,
CFX_ClipRgn* pClipRgn,
FX_RECT& stringRect,
CFX_Matrix* pMatrix,
void* font,
- FX_FLOAT font_size,
+ float font_size,
FX_ARGB text_color,
int glyph_count,
unsigned short* glyph_indices,
- FX_FLOAT baselineOriginX,
- FX_FLOAT baselineOriginY,
+ float baselineOriginX,
+ float baselineOriginY,
void* glyph_offsets,
- FX_FLOAT* glyph_advances);
+ float* glyph_advances);
void DwDeleteFont(void* pFont);
protected:
diff --git a/chromium/third_party/pdfium/core/fxge/win32/fx_win32_device.cpp b/chromium/third_party/pdfium/core/fxge/win32/fx_win32_device.cpp
index 92e9b41e064..73a1ac6a0e8 100644
--- a/chromium/third_party/pdfium/core/fxge/win32/fx_win32_device.cpp
+++ b/chromium/third_party/pdfium/core/fxge/win32/fx_win32_device.cpp
@@ -15,7 +15,9 @@
#include "core/fxcrt/fx_memory.h"
#include "core/fxcrt/fx_system.h"
#include "core/fxge/cfx_windowsdevice.h"
-#include "core/fxge/dib/dib_int.h"
+#include "core/fxge/dib/cfx_dibextractor.h"
+#include "core/fxge/dib/cfx_imagerenderer.h"
+#include "core/fxge/dib/cstretchengine.h"
#include "core/fxge/fx_font.h"
#include "core/fxge/fx_freetype.h"
#include "core/fxge/ge/cfx_folderfontinfo.h"
@@ -34,15 +36,15 @@
namespace {
const struct {
- const FX_CHAR* m_pFaceName;
- const FX_CHAR* m_pVariantName;
+ const char* m_pFaceName;
+ const char* m_pVariantName;
} g_VariantNames[] = {
{"DFKai-SB", "\x19\x6A\x77\x69\xD4\x9A"},
};
const struct {
- const FX_CHAR* m_pName;
- const FX_CHAR* m_pWinName;
+ const char* m_pName;
+ const char* m_pWinName;
bool m_bBold;
bool m_bItalic;
} g_Base14Substs[] = {
@@ -61,8 +63,8 @@ const struct {
};
struct FontNameMap {
- const FX_CHAR* m_pSubFontName;
- const FX_CHAR* m_pSrcFontName;
+ const char* m_pSubFontName;
+ const char* m_pSrcFontName;
};
const FontNameMap g_JpFontNameMap[] = {
{"MS Mincho", "Heiseimin-W3"},
@@ -91,12 +93,11 @@ bool IsGDIEnabled() {
HPEN CreatePen(const CFX_GraphStateData* pGraphState,
const CFX_Matrix* pMatrix,
uint32_t argb) {
- FX_FLOAT width;
- FX_FLOAT scale = 1.f;
+ float width;
+ float scale = 1.f;
if (pMatrix)
- scale = FXSYS_fabs(pMatrix->a) > FXSYS_fabs(pMatrix->b)
- ? FXSYS_fabs(pMatrix->a)
- : FXSYS_fabs(pMatrix->b);
+ scale = fabs(pMatrix->a) > fabs(pMatrix->b) ? fabs(pMatrix->a)
+ : fabs(pMatrix->b);
if (pGraphState) {
width = scale * pGraphState->m_LineWidth;
} else {
@@ -150,7 +151,7 @@ HPEN CreatePen(const CFX_GraphStateData* pGraphState,
dashes[i] = std::max(dashes[i], 1U);
}
}
- return ExtCreatePen(PenStyle, (DWORD)FXSYS_ceil(width), &lb,
+ return ExtCreatePen(PenStyle, (DWORD)ceil(width), &lb,
pGraphState->m_DashCount,
reinterpret_cast<const DWORD*>(dashes.data()));
}
@@ -215,26 +216,26 @@ void SetPathToDC(HDC hDC,
// altogether and replace by Skia code.
struct rect_base {
- FX_FLOAT x1;
- FX_FLOAT y1;
- FX_FLOAT x2;
- FX_FLOAT y2;
+ float x1;
+ float y1;
+ float x2;
+ float y2;
};
-unsigned clip_liang_barsky(FX_FLOAT x1,
- FX_FLOAT y1,
- FX_FLOAT x2,
- FX_FLOAT y2,
+unsigned clip_liang_barsky(float x1,
+ float y1,
+ float x2,
+ float y2,
const rect_base& clip_box,
- FX_FLOAT* x,
- FX_FLOAT* y) {
- const FX_FLOAT nearzero = 1e-30f;
- FX_FLOAT deltax = x2 - x1;
- FX_FLOAT deltay = y2 - y1;
+ float* x,
+ float* y) {
+ const float nearzero = 1e-30f;
+ float deltax = x2 - x1;
+ float deltay = y2 - y1;
unsigned np = 0;
if (deltax == 0)
deltax = (x1 > clip_box.x1) ? -nearzero : nearzero;
- FX_FLOAT xin, xout;
+ float xin, xout;
if (deltax > 0) {
xin = clip_box.x1;
xout = clip_box.x2;
@@ -242,10 +243,10 @@ unsigned clip_liang_barsky(FX_FLOAT x1,
xin = clip_box.x2;
xout = clip_box.x1;
}
- FX_FLOAT tinx = (xin - x1) / deltax;
+ float tinx = (xin - x1) / deltax;
if (deltay == 0)
deltay = (y1 > clip_box.y1) ? -nearzero : nearzero;
- FX_FLOAT yin, yout;
+ float yin, yout;
if (deltay > 0) {
yin = clip_box.y1;
yout = clip_box.y2;
@@ -253,8 +254,8 @@ unsigned clip_liang_barsky(FX_FLOAT x1,
yin = clip_box.y2;
yout = clip_box.y1;
}
- FX_FLOAT tiny = (yin - y1) / deltay;
- FX_FLOAT tin1, tin2;
+ float tiny = (yin - y1) / deltay;
+ float tin1, tin2;
if (tinx < tiny) {
tin1 = tinx;
tin2 = tiny;
@@ -269,9 +270,9 @@ unsigned clip_liang_barsky(FX_FLOAT x1,
++np;
}
if (tin2 <= 1.0f) {
- FX_FLOAT toutx = (xout - x1) / deltax;
- FX_FLOAT touty = (yout - y1) / deltay;
- FX_FLOAT tout1 = (toutx < touty) ? toutx : touty;
+ float toutx = (xout - x1) / deltax;
+ float touty = (yout - y1) / deltay;
+ float tout1 = (toutx < touty) ? toutx : touty;
if (tin2 > 0 || tout1 > 0) {
if (tin2 <= tout1) {
if (tin2 > 0) {
@@ -324,7 +325,7 @@ class CFX_Win32FallbackFontInfo final : public CFX_FolderFontInfo {
bool bItalic,
int charset,
int pitch_family,
- const FX_CHAR* family,
+ const char* family,
int& iExact) override;
};
@@ -339,15 +340,15 @@ class CFX_Win32FontInfo final : public IFX_SystemFontInfo {
bool bItalic,
int charset,
int pitch_family,
- const FX_CHAR* face,
+ const char* face,
int& iExact) override;
- void* GetFont(const FX_CHAR* face) override { return nullptr; }
+ void* GetFont(const char* face) override { return nullptr; }
uint32_t GetFontData(void* hFont,
uint32_t table,
uint8_t* buffer,
uint32_t size) override;
- bool GetFaceName(void* hFont, CFX_ByteString& name) override;
- bool GetFontCharset(void* hFont, int& charset) override;
+ bool GetFaceName(void* hFont, CFX_ByteString* name) override;
+ bool GetFontCharset(void* hFont, int* charset) override;
void DeleteFont(void* hFont) override;
bool IsOpenTypeFromDiv(const LOGFONTA* plf);
@@ -446,7 +447,7 @@ void CFX_Win32FontInfo::AddInstalledFont(const LOGFONTA* plf,
bool CFX_Win32FontInfo::EnumFontList(CFX_FontMapper* pMapper) {
m_pMapper = pMapper;
LOGFONTA lf;
- FXSYS_memset(&lf, 0, sizeof(LOGFONTA));
+ memset(&lf, 0, sizeof(LOGFONTA));
lf.lfCharSet = FXFONT_DEFAULT_CHARSET;
lf.lfFaceName[0] = 0;
lf.lfPitchAndFamily = 0;
@@ -476,7 +477,7 @@ void* CFX_Win32FallbackFontInfo::MapFont(int weight,
bool bItalic,
int charset,
int pitch_family,
- const FX_CHAR* cstr_face,
+ const char* cstr_face,
int& iExact) {
void* font = GetSubstFont(cstr_face);
if (font) {
@@ -569,7 +570,7 @@ void* CFX_Win32FontInfo::MapFont(int weight,
bool bItalic,
int charset,
int pitch_family,
- const FX_CHAR* cstr_face,
+ const char* cstr_face,
int& iExact) {
CFX_ByteString face = cstr_face;
int iBaseFont;
@@ -663,7 +664,7 @@ uint32_t CFX_Win32FontInfo::GetFontData(void* hFont,
return size;
}
-bool CFX_Win32FontInfo::GetFaceName(void* hFont, CFX_ByteString& name) {
+bool CFX_Win32FontInfo::GetFaceName(void* hFont, CFX_ByteString* name) {
char facebuf[100];
HFONT hOldFont = (HFONT)::SelectObject(m_hDC, (HFONT)hFont);
int ret = ::GetTextFaceA(m_hDC, 100, facebuf);
@@ -671,16 +672,16 @@ bool CFX_Win32FontInfo::GetFaceName(void* hFont, CFX_ByteString& name) {
if (ret == 0) {
return false;
}
- name = facebuf;
+ *name = facebuf;
return true;
}
-bool CFX_Win32FontInfo::GetFontCharset(void* hFont, int& charset) {
+bool CFX_Win32FontInfo::GetFontCharset(void* hFont, int* charset) {
TEXTMETRIC tm;
HFONT hOldFont = (HFONT)::SelectObject(m_hDC, (HFONT)hFont);
::GetTextMetrics(m_hDC, &tm);
::SelectObject(m_hDC, hOldFont);
- charset = tm.tmCharSet;
+ *charset = tm.tmCharSet;
return true;
}
@@ -782,12 +783,13 @@ void CGdiDeviceDriver::RestoreState(bool bKeepSaved) {
SaveDC(m_hDC);
}
-bool CGdiDeviceDriver::GDI_SetDIBits(CFX_DIBitmap* pBitmap1,
- const FX_RECT* pSrcRect,
- int left,
- int top) {
+bool CGdiDeviceDriver::GDI_SetDIBits(
+ const CFX_RetainPtr<CFX_DIBitmap>& pBitmap1,
+ const FX_RECT* pSrcRect,
+ int left,
+ int top) {
if (m_DeviceClass == FXDC_PRINTER) {
- std::unique_ptr<CFX_DIBitmap> pBitmap = pBitmap1->FlipImage(false, true);
+ CFX_RetainPtr<CFX_DIBitmap> pBitmap = pBitmap1->FlipImage(false, true);
if (!pBitmap)
return false;
@@ -796,7 +798,7 @@ bool CGdiDeviceDriver::GDI_SetDIBits(CFX_DIBitmap* pBitmap1,
int width = pSrcRect->Width(), height = pSrcRect->Height();
LPBYTE pBuffer = pBitmap->GetBuffer();
- CFX_ByteString info = CFX_WindowsDIB::GetBitmapInfo(pBitmap.get());
+ CFX_ByteString info = CFX_WindowsDIB::GetBitmapInfo(pBitmap);
((BITMAPINFOHEADER*)info.c_str())->biHeight *= -1;
FX_RECT dst_rect(0, 0, width, height);
dst_rect.Intersect(0, 0, pBitmap->GetWidth(), pBitmap->GetHeight());
@@ -806,15 +808,15 @@ bool CGdiDeviceDriver::GDI_SetDIBits(CFX_DIBitmap* pBitmap1,
dst_height, pBuffer, (BITMAPINFO*)info.c_str(),
DIB_RGB_COLORS, SRCCOPY);
} else {
- CFX_MaybeOwned<CFX_DIBitmap> pBitmap(pBitmap1);
+ CFX_RetainPtr<CFX_DIBitmap> pBitmap = pBitmap1;
if (pBitmap->IsCmykImage()) {
- pBitmap = pBitmap->CloneConvert(FXDIB_Rgb).release();
+ pBitmap = pBitmap->CloneConvert(FXDIB_Rgb);
if (!pBitmap)
return false;
}
int width = pSrcRect->Width(), height = pSrcRect->Height();
LPBYTE pBuffer = pBitmap->GetBuffer();
- CFX_ByteString info = CFX_WindowsDIB::GetBitmapInfo(pBitmap.Get());
+ CFX_ByteString info = CFX_WindowsDIB::GetBitmapInfo(pBitmap);
::SetDIBitsToDevice(m_hDC, left, top, width, height, pSrcRect->left,
pBitmap->GetHeight() - pSrcRect->bottom, 0,
pBitmap->GetHeight(), pBuffer,
@@ -823,13 +825,14 @@ bool CGdiDeviceDriver::GDI_SetDIBits(CFX_DIBitmap* pBitmap1,
return true;
}
-bool CGdiDeviceDriver::GDI_StretchDIBits(CFX_DIBitmap* pBitmap1,
- int dest_left,
- int dest_top,
- int dest_width,
- int dest_height,
- uint32_t flags) {
- CFX_DIBitmap* pBitmap = pBitmap1;
+bool CGdiDeviceDriver::GDI_StretchDIBits(
+ const CFX_RetainPtr<CFX_DIBitmap>& pBitmap1,
+ int dest_left,
+ int dest_top,
+ int dest_width,
+ int dest_height,
+ uint32_t flags) {
+ CFX_RetainPtr<CFX_DIBitmap> pBitmap = pBitmap1;
if (!pBitmap || dest_width == 0 || dest_height == 0)
return false;
@@ -844,14 +847,14 @@ bool CGdiDeviceDriver::GDI_StretchDIBits(CFX_DIBitmap* pBitmap1,
} else {
SetStretchBltMode(m_hDC, COLORONCOLOR);
}
- CFX_MaybeOwned<CFX_DIBitmap> pToStrechBitmap(pBitmap);
+ CFX_RetainPtr<CFX_DIBitmap> pToStrechBitmap = pBitmap;
if (m_DeviceClass == FXDC_PRINTER &&
((int64_t)pBitmap->GetWidth() * pBitmap->GetHeight() >
(int64_t)abs(dest_width) * abs(dest_height))) {
pToStrechBitmap = pBitmap->StretchTo(dest_width, dest_height);
}
CFX_ByteString toStrechBitmapInfo =
- CFX_WindowsDIB::GetBitmapInfo(pToStrechBitmap.Get());
+ CFX_WindowsDIB::GetBitmapInfo(pToStrechBitmap);
::StretchDIBits(m_hDC, dest_left, dest_top, dest_width, dest_height, 0, 0,
pToStrechBitmap->GetWidth(), pToStrechBitmap->GetHeight(),
pToStrechBitmap->GetBuffer(),
@@ -860,14 +863,15 @@ bool CGdiDeviceDriver::GDI_StretchDIBits(CFX_DIBitmap* pBitmap1,
return true;
}
-bool CGdiDeviceDriver::GDI_StretchBitMask(CFX_DIBitmap* pBitmap1,
- int dest_left,
- int dest_top,
- int dest_width,
- int dest_height,
- uint32_t bitmap_color,
- uint32_t flags) {
- CFX_DIBitmap* pBitmap = pBitmap1;
+bool CGdiDeviceDriver::GDI_StretchBitMask(
+ const CFX_RetainPtr<CFX_DIBitmap>& pBitmap1,
+ int dest_left,
+ int dest_top,
+ int dest_width,
+ int dest_height,
+ uint32_t bitmap_color,
+ uint32_t flags) {
+ CFX_RetainPtr<CFX_DIBitmap> pBitmap = pBitmap1;
if (!pBitmap || dest_width == 0 || dest_height == 0)
return false;
@@ -876,7 +880,7 @@ bool CGdiDeviceDriver::GDI_StretchBitMask(CFX_DIBitmap* pBitmap1,
BITMAPINFOHEADER bmiHeader;
uint32_t bmiColors[2];
} bmi;
- FXSYS_memset(&bmi.bmiHeader, 0, sizeof(BITMAPINFOHEADER));
+ memset(&bmi.bmiHeader, 0, sizeof(BITMAPINFOHEADER));
bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bmi.bmiHeader.biBitCount = 1;
bmi.bmiHeader.biCompression = BI_RGB;
@@ -928,10 +932,7 @@ void* CGdiDeviceDriver::GetPlatformSurface() const {
return (void*)m_hDC;
}
-void CGdiDeviceDriver::DrawLine(FX_FLOAT x1,
- FX_FLOAT y1,
- FX_FLOAT x2,
- FX_FLOAT y2) {
+void CGdiDeviceDriver::DrawLine(float x1, float y1, float x2, float y2) {
if (!m_bMetafileDCType) { // EMF drawing is not bound to the DC.
int startOutOfBoundsFlag = (x1 < 0) | ((x1 > m_Width) << 1) |
((y1 < 0) << 2) | ((y1 > m_Height) << 3);
@@ -941,18 +942,18 @@ void CGdiDeviceDriver::DrawLine(FX_FLOAT x1,
return;
if (startOutOfBoundsFlag || endOutOfBoundsFlag) {
- FX_FLOAT x[2];
- FX_FLOAT y[2];
+ float x[2];
+ float y[2];
int np;
#ifdef _SKIA_SUPPORT_
// TODO(caryclark) temporary replacement of antigrain in line function
// to permit removing antigrain altogether
- rect_base rect = {0.0f, 0.0f, (FX_FLOAT)(m_Width), (FX_FLOAT)(m_Height)};
+ rect_base rect = {0.0f, 0.0f, (float)(m_Width), (float)(m_Height)};
np = clip_liang_barsky(x1, y1, x2, y2, rect, x, y);
#else
- agg::rect_base<FX_FLOAT> rect(0.0f, 0.0f, (FX_FLOAT)(m_Width),
- (FX_FLOAT)(m_Height));
- np = agg::clip_liang_barsky<FX_FLOAT>(x1, y1, x2, y2, rect, x, y);
+ agg::rect_base<float> rect(0.0f, 0.0f, (float)(m_Width),
+ (float)(m_Height));
+ np = agg::clip_liang_barsky<float>(x1, y1, x2, y2, rect, x, y);
#endif
if (np == 0)
return;
@@ -994,13 +995,13 @@ bool CGdiDeviceDriver::DrawPath(const CFX_PathData* pPathData,
FX_RECT bbox = bbox_f.GetInnerRect();
if (bbox.Width() <= 0) {
- return DrawCosmeticLine(
- (FX_FLOAT)(bbox.left), (FX_FLOAT)(bbox.top), (FX_FLOAT)(bbox.left),
- (FX_FLOAT)(bbox.bottom + 1), fill_color, FXDIB_BLEND_NORMAL);
+ return DrawCosmeticLine((float)(bbox.left), (float)(bbox.top),
+ (float)(bbox.left), (float)(bbox.bottom + 1),
+ fill_color, FXDIB_BLEND_NORMAL);
}
if (bbox.Height() <= 0) {
- return DrawCosmeticLine((FX_FLOAT)(bbox.left), (FX_FLOAT)(bbox.top),
- (FX_FLOAT)(bbox.right + 1), (FX_FLOAT)(bbox.top),
+ return DrawCosmeticLine((float)(bbox.left), (float)(bbox.top),
+ (float)(bbox.right + 1), (float)(bbox.top),
fill_color, FXDIB_BLEND_NORMAL);
}
}
@@ -1133,10 +1134,10 @@ bool CGdiDeviceDriver::SetClip_PathStroke(
return ret;
}
-bool CGdiDeviceDriver::DrawCosmeticLine(FX_FLOAT x1,
- FX_FLOAT y1,
- FX_FLOAT x2,
- FX_FLOAT y2,
+bool CGdiDeviceDriver::DrawCosmeticLine(float x1,
+ float y1,
+ float x2,
+ float y2,
uint32_t color,
int blend_type) {
if (blend_type != FXDIB_BLEND_NORMAL)
@@ -1168,7 +1169,9 @@ CGdiDisplayDriver::CGdiDisplayDriver(HDC hDC)
CGdiDisplayDriver::~CGdiDisplayDriver() {}
-bool CGdiDisplayDriver::GetDIBits(CFX_DIBitmap* pBitmap, int left, int top) {
+bool CGdiDisplayDriver::GetDIBits(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
+ int left,
+ int top) {
bool ret = false;
int width = pBitmap->GetWidth();
int height = pBitmap->GetHeight();
@@ -1178,7 +1181,7 @@ bool CGdiDisplayDriver::GetDIBits(CFX_DIBitmap* pBitmap, int left, int top) {
BitBlt(hDCMemory, 0, 0, width, height, m_hDC, left, top, SRCCOPY);
SelectObject(hDCMemory, holdbmp);
BITMAPINFO bmi;
- FXSYS_memset(&bmi, 0, sizeof bmi);
+ memset(&bmi, 0, sizeof bmi);
bmi.bmiHeader.biSize = sizeof bmi.bmiHeader;
bmi.bmiHeader.biBitCount = pBitmap->GetBPP();
bmi.bmiHeader.biHeight = -height;
@@ -1188,12 +1191,12 @@ bool CGdiDisplayDriver::GetDIBits(CFX_DIBitmap* pBitmap, int left, int top) {
ret = ::GetDIBits(hDCMemory, hbmp, 0, height, pBitmap->GetBuffer(), &bmi,
DIB_RGB_COLORS) == height;
} else {
- CFX_DIBitmap bitmap;
- if (bitmap.Create(width, height, FXDIB_Rgb)) {
+ auto bitmap = pdfium::MakeRetain<CFX_DIBitmap>();
+ if (bitmap->Create(width, height, FXDIB_Rgb)) {
bmi.bmiHeader.biBitCount = 24;
- ::GetDIBits(hDCMemory, hbmp, 0, height, bitmap.GetBuffer(), &bmi,
+ ::GetDIBits(hDCMemory, hbmp, 0, height, bitmap->GetBuffer(), &bmi,
DIB_RGB_COLORS);
- ret = pBitmap->TransferBitmap(0, 0, width, height, &bitmap, 0, 0);
+ ret = pBitmap->TransferBitmap(0, 0, width, height, bitmap, 0, 0);
} else {
ret = false;
}
@@ -1206,7 +1209,7 @@ bool CGdiDisplayDriver::GetDIBits(CFX_DIBitmap* pBitmap, int left, int top) {
return ret;
}
-bool CGdiDisplayDriver::SetDIBits(const CFX_DIBSource* pSource,
+bool CGdiDisplayDriver::SetDIBits(const CFX_RetainPtr<CFX_DIBSource>& pSource,
uint32_t color,
const FX_RECT* pSrcRect,
int left,
@@ -1217,17 +1220,15 @@ bool CGdiDisplayDriver::SetDIBits(const CFX_DIBSource* pSource,
int width = pSource->GetWidth(), height = pSource->GetHeight();
int alpha = FXARGB_A(color);
if (pSource->GetBPP() != 1 || alpha != 255) {
- CFX_DIBitmap background;
- if (!background.Create(width, height, FXDIB_Rgb32) ||
- !GetDIBits(&background, left, top) ||
- !background.CompositeMask(0, 0, width, height, pSource, color, 0, 0,
- FXDIB_BLEND_NORMAL, nullptr, false, 0,
- nullptr)) {
+ auto background = pdfium::MakeRetain<CFX_DIBitmap>();
+ if (!background->Create(width, height, FXDIB_Rgb32) ||
+ !GetDIBits(background, left, top) ||
+ !background->CompositeMask(0, 0, width, height, pSource, color, 0, 0,
+ FXDIB_BLEND_NORMAL, nullptr, false, 0)) {
return false;
}
FX_RECT src_rect(0, 0, width, height);
- return SetDIBits(&background, 0, &src_rect, left, top,
- FXDIB_BLEND_NORMAL);
+ return SetDIBits(background, 0, &src_rect, left, top, FXDIB_BLEND_NORMAL);
}
FX_RECT clip_rect(left, top, left + pSrcRect->Width(),
top + pSrcRect->Height());
@@ -1237,32 +1238,33 @@ bool CGdiDisplayDriver::SetDIBits(const CFX_DIBSource* pSource,
}
int width = pSrcRect->Width(), height = pSrcRect->Height();
if (pSource->HasAlpha()) {
- CFX_DIBitmap bitmap;
- if (!bitmap.Create(width, height, FXDIB_Rgb) ||
- !GetDIBits(&bitmap, left, top) ||
- !bitmap.CompositeBitmap(0, 0, width, height, pSource, pSrcRect->left,
- pSrcRect->top, FXDIB_BLEND_NORMAL, nullptr,
- false, nullptr)) {
+ auto bitmap = pdfium::MakeRetain<CFX_DIBitmap>();
+ if (!bitmap->Create(width, height, FXDIB_Rgb) ||
+ !GetDIBits(bitmap, left, top) ||
+ !bitmap->CompositeBitmap(0, 0, width, height, pSource, pSrcRect->left,
+ pSrcRect->top, FXDIB_BLEND_NORMAL, nullptr,
+ false)) {
return false;
}
FX_RECT src_rect(0, 0, width, height);
- return SetDIBits(&bitmap, 0, &src_rect, left, top, FXDIB_BLEND_NORMAL);
+ return SetDIBits(bitmap, 0, &src_rect, left, top, FXDIB_BLEND_NORMAL);
}
CFX_DIBExtractor temp(pSource);
- CFX_DIBitmap* pBitmap = temp.GetBitmap();
+ CFX_RetainPtr<CFX_DIBitmap> pBitmap = temp.GetBitmap();
if (!pBitmap)
return false;
return GDI_SetDIBits(pBitmap, pSrcRect, left, top);
}
-bool CGdiDisplayDriver::UseFoxitStretchEngine(const CFX_DIBSource* pSource,
- uint32_t color,
- int dest_left,
- int dest_top,
- int dest_width,
- int dest_height,
- const FX_RECT* pClipRect,
- int render_flags) {
+bool CGdiDisplayDriver::UseFoxitStretchEngine(
+ const CFX_RetainPtr<CFX_DIBSource>& pSource,
+ uint32_t color,
+ int dest_left,
+ int dest_top,
+ int dest_width,
+ int dest_height,
+ const FX_RECT* pClipRect,
+ int render_flags) {
FX_RECT bitmap_clip = *pClipRect;
if (dest_width < 0)
dest_left += dest_width;
@@ -1271,25 +1273,26 @@ bool CGdiDisplayDriver::UseFoxitStretchEngine(const CFX_DIBSource* pSource,
dest_top += dest_height;
bitmap_clip.Offset(-dest_left, -dest_top);
- std::unique_ptr<CFX_DIBitmap> pStretched(
- pSource->StretchTo(dest_width, dest_height, render_flags, &bitmap_clip));
+ CFX_RetainPtr<CFX_DIBitmap> pStretched =
+ pSource->StretchTo(dest_width, dest_height, render_flags, &bitmap_clip);
if (!pStretched)
return true;
FX_RECT src_rect(0, 0, pStretched->GetWidth(), pStretched->GetHeight());
- return SetDIBits(pStretched.get(), color, &src_rect, pClipRect->left,
+ return SetDIBits(pStretched, color, &src_rect, pClipRect->left,
pClipRect->top, FXDIB_BLEND_NORMAL);
}
-bool CGdiDisplayDriver::StretchDIBits(const CFX_DIBSource* pSource,
- uint32_t color,
- int dest_left,
- int dest_top,
- int dest_width,
- int dest_height,
- const FX_RECT* pClipRect,
- uint32_t flags,
- int blend_type) {
+bool CGdiDisplayDriver::StretchDIBits(
+ const CFX_RetainPtr<CFX_DIBSource>& pSource,
+ uint32_t color,
+ int dest_left,
+ int dest_top,
+ int dest_width,
+ int dest_height,
+ const FX_RECT* pClipRect,
+ uint32_t flags,
+ int blend_type) {
ASSERT(pSource && pClipRect);
if (flags || dest_width > 10000 || dest_width < -10000 ||
dest_height > 10000 || dest_height < -10000) {
@@ -1306,24 +1309,23 @@ bool CGdiDisplayDriver::StretchDIBits(const CFX_DIBSource* pSource,
clip_rect.Intersect(*pClipRect);
clip_rect.Offset(-image_rect.left, -image_rect.top);
int clip_width = clip_rect.Width(), clip_height = clip_rect.Height();
- std::unique_ptr<CFX_DIBitmap> pStretched(
+ CFX_RetainPtr<CFX_DIBitmap> pStretched(
pSource->StretchTo(dest_width, dest_height, flags, &clip_rect));
if (!pStretched)
return true;
- CFX_DIBitmap background;
- if (!background.Create(clip_width, clip_height, FXDIB_Rgb32) ||
- !GetDIBits(&background, image_rect.left + clip_rect.left,
+ auto background = pdfium::MakeRetain<CFX_DIBitmap>();
+ if (!background->Create(clip_width, clip_height, FXDIB_Rgb32) ||
+ !GetDIBits(background, image_rect.left + clip_rect.left,
image_rect.top + clip_rect.top) ||
- !background.CompositeMask(
- 0, 0, clip_width, clip_height, pStretched.get(), color, 0, 0,
- FXDIB_BLEND_NORMAL, nullptr, false, 0, nullptr)) {
+ !background->CompositeMask(0, 0, clip_width, clip_height, pStretched,
+ color, 0, 0, FXDIB_BLEND_NORMAL, nullptr,
+ false, 0)) {
return false;
}
FX_RECT src_rect(0, 0, clip_width, clip_height);
- return SetDIBits(&background, 0, &src_rect,
- image_rect.left + clip_rect.left,
+ return SetDIBits(background, 0, &src_rect, image_rect.left + clip_rect.left,
image_rect.top + clip_rect.top, FXDIB_BLEND_NORMAL);
}
if (pSource->HasAlpha()) {
@@ -1331,7 +1333,7 @@ bool CGdiDisplayDriver::StretchDIBits(const CFX_DIBSource* pSource,
(CWin32Platform*)CFX_GEModule::Get()->GetPlatformData();
if (pPlatform->m_GdiplusExt.IsAvailable() && !pSource->IsCmykImage()) {
CFX_DIBExtractor temp(pSource);
- CFX_DIBitmap* pBitmap = temp.GetBitmap();
+ CFX_RetainPtr<CFX_DIBitmap> pBitmap = temp.GetBitmap();
if (!pBitmap)
return false;
return pPlatform->m_GdiplusExt.StretchDIBits(
@@ -1342,19 +1344,19 @@ bool CGdiDisplayDriver::StretchDIBits(const CFX_DIBSource* pSource,
dest_width, dest_height, pClipRect, flags);
}
CFX_DIBExtractor temp(pSource);
- CFX_DIBitmap* pBitmap = temp.GetBitmap();
+ CFX_RetainPtr<CFX_DIBitmap> pBitmap = temp.GetBitmap();
if (!pBitmap)
return false;
return GDI_StretchDIBits(pBitmap, dest_left, dest_top, dest_width,
dest_height, flags);
}
-bool CGdiDisplayDriver::StartDIBits(const CFX_DIBSource* pBitmap,
+bool CGdiDisplayDriver::StartDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
int bitmap_alpha,
uint32_t color,
const CFX_Matrix* pMatrix,
uint32_t render_flags,
- void*& handle,
+ std::unique_ptr<CFX_ImageRenderer>* handle,
int blend_type) {
return false;
}
diff --git a/chromium/third_party/pdfium/core/fxge/win32/fx_win32_dib.cpp b/chromium/third_party/pdfium/core/fxge/win32/fx_win32_dib.cpp
index 40c9ca6e311..677fb3ab806 100644
--- a/chromium/third_party/pdfium/core/fxge/win32/fx_win32_dib.cpp
+++ b/chromium/third_party/pdfium/core/fxge/win32/fx_win32_dib.cpp
@@ -11,14 +11,15 @@
#include "core/fxge/win32/cfx_windowsdib.h"
#include "core/fxge/win32/win32_int.h"
-CFX_ByteString CFX_WindowsDIB::GetBitmapInfo(const CFX_DIBitmap* pBitmap) {
+CFX_ByteString CFX_WindowsDIB::GetBitmapInfo(
+ const CFX_RetainPtr<CFX_DIBitmap>& pBitmap) {
CFX_ByteString result;
int len = sizeof(BITMAPINFOHEADER);
if (pBitmap->GetBPP() == 1 || pBitmap->GetBPP() == 8) {
len += sizeof(DWORD) * (int)(1 << pBitmap->GetBPP());
}
BITMAPINFOHEADER* pbmih = (BITMAPINFOHEADER*)result.GetBuffer(len);
- FXSYS_memset(pbmih, 0, sizeof(BITMAPINFOHEADER));
+ memset(pbmih, 0, sizeof(BITMAPINFOHEADER));
pbmih->biSize = sizeof(BITMAPINFOHEADER);
pbmih->biBitCount = pBitmap->GetBPP();
pbmih->biCompression = BI_RGB;
@@ -51,9 +52,9 @@ CFX_ByteString CFX_WindowsDIB::GetBitmapInfo(const CFX_DIBitmap* pBitmap) {
return result;
}
-CFX_DIBitmap* _FX_WindowsDIB_LoadFromBuf(BITMAPINFO* pbmi,
- LPVOID pData,
- bool bAlpha) {
+CFX_RetainPtr<CFX_DIBitmap> _FX_WindowsDIB_LoadFromBuf(BITMAPINFO* pbmi,
+ LPVOID pData,
+ bool bAlpha) {
int width = pbmi->bmiHeader.biWidth;
int height = pbmi->bmiHeader.biHeight;
BOOL bBottomUp = true;
@@ -62,24 +63,22 @@ CFX_DIBitmap* _FX_WindowsDIB_LoadFromBuf(BITMAPINFO* pbmi,
bBottomUp = false;
}
int pitch = (width * pbmi->bmiHeader.biBitCount + 31) / 32 * 4;
- CFX_DIBitmap* pBitmap = new CFX_DIBitmap;
+ auto pBitmap = pdfium::MakeRetain<CFX_DIBitmap>();
FXDIB_Format format = bAlpha
? (FXDIB_Format)(pbmi->bmiHeader.biBitCount + 0x200)
: (FXDIB_Format)pbmi->bmiHeader.biBitCount;
- bool ret = pBitmap->Create(width, height, format);
- if (!ret) {
- delete pBitmap;
+ if (!pBitmap->Create(width, height, format))
return nullptr;
- }
- FXSYS_memcpy(pBitmap->GetBuffer(), pData, pitch * height);
+
+ memcpy(pBitmap->GetBuffer(), pData, pitch * height);
if (bBottomUp) {
uint8_t* temp_buf = FX_Alloc(uint8_t, pitch);
int top = 0, bottom = height - 1;
while (top < bottom) {
- FXSYS_memcpy(temp_buf, pBitmap->GetBuffer() + top * pitch, pitch);
- FXSYS_memcpy(pBitmap->GetBuffer() + top * pitch,
- pBitmap->GetBuffer() + bottom * pitch, pitch);
- FXSYS_memcpy(pBitmap->GetBuffer() + bottom * pitch, temp_buf, pitch);
+ memcpy(temp_buf, pBitmap->GetBuffer() + top * pitch, pitch);
+ memcpy(pBitmap->GetBuffer() + top * pitch,
+ pBitmap->GetBuffer() + bottom * pitch, pitch);
+ memcpy(pBitmap->GetBuffer() + bottom * pitch, temp_buf, pitch);
top++;
bottom--;
}
@@ -98,11 +97,13 @@ CFX_DIBitmap* _FX_WindowsDIB_LoadFromBuf(BITMAPINFO* pbmi,
return pBitmap;
}
-CFX_DIBitmap* CFX_WindowsDIB::LoadFromBuf(BITMAPINFO* pbmi, LPVOID pData) {
+CFX_RetainPtr<CFX_DIBitmap> CFX_WindowsDIB::LoadFromBuf(BITMAPINFO* pbmi,
+ LPVOID pData) {
return _FX_WindowsDIB_LoadFromBuf(pbmi, pData, false);
}
-HBITMAP CFX_WindowsDIB::GetDDBitmap(const CFX_DIBitmap* pBitmap, HDC hDC) {
+HBITMAP CFX_WindowsDIB::GetDDBitmap(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
+ HDC hDC) {
CFX_ByteString info = GetBitmapInfo(pBitmap);
return CreateDIBitmap(hDC, (BITMAPINFOHEADER*)info.c_str(), CBM_INIT,
pBitmap->GetBuffer(), (BITMAPINFO*)info.c_str(),
@@ -116,7 +117,8 @@ void GetBitmapSize(HBITMAP hBitmap, int& w, int& h) {
h = bmp.bmHeight;
}
-CFX_DIBitmap* CFX_WindowsDIB::LoadFromFile(const FX_WCHAR* filename) {
+CFX_RetainPtr<CFX_DIBitmap> CFX_WindowsDIB::LoadFromFile(
+ const wchar_t* filename) {
CWin32Platform* pPlatform =
(CWin32Platform*)CFX_GEModule::Get()->GetPlatformData();
if (pPlatform->m_GdiplusExt.IsAvailable()) {
@@ -131,30 +133,29 @@ CFX_DIBitmap* CFX_WindowsDIB::LoadFromFile(const FX_WCHAR* filename) {
return nullptr;
}
HDC hDC = CreateCompatibleDC(nullptr);
- int width, height;
+ int width;
+ int height;
GetBitmapSize(hBitmap, width, height);
- CFX_DIBitmap* pDIBitmap = new CFX_DIBitmap;
+ auto pDIBitmap = pdfium::MakeRetain<CFX_DIBitmap>();
if (!pDIBitmap->Create(width, height, FXDIB_Rgb)) {
- delete pDIBitmap;
DeleteDC(hDC);
return nullptr;
}
CFX_ByteString info = GetBitmapInfo(pDIBitmap);
int ret = GetDIBits(hDC, hBitmap, 0, height, pDIBitmap->GetBuffer(),
(BITMAPINFO*)info.c_str(), DIB_RGB_COLORS);
- if (!ret) {
- delete pDIBitmap;
- pDIBitmap = nullptr;
- }
DeleteDC(hDC);
+ if (!ret)
+ return nullptr;
return pDIBitmap;
}
-CFX_DIBitmap* CFX_WindowsDIB::LoadFromFile(const FX_CHAR* filename) {
+CFX_RetainPtr<CFX_DIBitmap> CFX_WindowsDIB::LoadFromFile(const char* filename) {
return LoadFromFile(CFX_WideString::FromLocal(filename).c_str());
}
-CFX_DIBitmap* CFX_WindowsDIB::LoadDIBitmap(WINDIB_Open_Args_ args) {
+CFX_RetainPtr<CFX_DIBitmap> CFX_WindowsDIB::LoadDIBitmap(
+ WINDIB_Open_Args_ args) {
CWin32Platform* pPlatform =
(CWin32Platform*)CFX_GEModule::Get()->GetPlatformData();
if (pPlatform->m_GdiplusExt.IsAvailable()) {
@@ -171,34 +172,33 @@ CFX_DIBitmap* CFX_WindowsDIB::LoadDIBitmap(WINDIB_Open_Args_ args) {
HDC hDC = CreateCompatibleDC(nullptr);
int width, height;
GetBitmapSize(hBitmap, width, height);
- CFX_DIBitmap* pDIBitmap = new CFX_DIBitmap;
+ auto pDIBitmap = pdfium::MakeRetain<CFX_DIBitmap>();
if (!pDIBitmap->Create(width, height, FXDIB_Rgb)) {
- delete pDIBitmap;
DeleteDC(hDC);
return nullptr;
}
CFX_ByteString info = GetBitmapInfo(pDIBitmap);
int ret = GetDIBits(hDC, hBitmap, 0, height, pDIBitmap->GetBuffer(),
(BITMAPINFO*)info.c_str(), DIB_RGB_COLORS);
- if (!ret) {
- delete pDIBitmap;
- pDIBitmap = nullptr;
- }
DeleteDC(hDC);
+ if (!ret)
+ return nullptr;
return pDIBitmap;
}
CFX_WindowsDIB::CFX_WindowsDIB(HDC hDC, int width, int height) {
Create(width, height, FXDIB_Rgb, (uint8_t*)1);
BITMAPINFOHEADER bmih;
- FXSYS_memset(&bmih, 0, sizeof bmih);
+ memset(&bmih, 0, sizeof bmih);
bmih.biSize = sizeof bmih;
bmih.biBitCount = 24;
bmih.biHeight = -height;
bmih.biPlanes = 1;
bmih.biWidth = width;
- m_hBitmap = CreateDIBSection(hDC, (BITMAPINFO*)&bmih, DIB_RGB_COLORS,
- (LPVOID*)&m_pBuffer, nullptr, 0);
+ LPVOID pData = nullptr;
+ m_hBitmap = CreateDIBSection(hDC, (BITMAPINFO*)&bmih, DIB_RGB_COLORS, &pData,
+ nullptr, 0);
+ m_pBuffer.Reset(static_cast<uint8_t*>(pData));
m_hMemDC = CreateCompatibleDC(hDC);
m_hOldBitmap = (HBITMAP)SelectObject(m_hMemDC, m_hBitmap);
}
diff --git a/chromium/third_party/pdfium/core/fxge/win32/fx_win32_dwrite.cpp b/chromium/third_party/pdfium/core/fxge/win32/fx_win32_dwrite.cpp
index dc0f5ed7459..91fb465af4c 100644
--- a/chromium/third_party/pdfium/core/fxge/win32/fx_win32_dwrite.cpp
+++ b/chromium/third_party/pdfium/core/fxge/win32/fx_win32_dwrite.cpp
@@ -103,7 +103,7 @@ class CDwFontContext {
class CDwGdiTextRenderer {
public:
- CDwGdiTextRenderer(CFX_DIBitmap* pBitmap,
+ CDwGdiTextRenderer(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
IDWriteBitmapRenderTarget* bitmapRenderTarget,
IDWriteRenderingParams* renderingParams);
~CDwGdiTextRenderer();
@@ -118,7 +118,7 @@ class CDwGdiTextRenderer {
const COLORREF& textColor);
private:
- CFX_DIBitmap* pBitmap_;
+ CFX_RetainPtr<CFX_DIBitmap> pBitmap_;
IDWriteBitmapRenderTarget* pRenderTarget_;
IDWriteRenderingParams* pRenderingParams_;
};
@@ -180,8 +180,9 @@ failed:
return nullptr;
}
-bool CDWriteExt::DwCreateRenderingTarget(CFX_DIBitmap* pBitmap,
- void** renderTarget) {
+bool CDWriteExt::DwCreateRenderingTarget(
+ const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
+ void** renderTarget) {
if (pBitmap->GetFormat() > FXDIB_Argb) {
return false;
}
@@ -227,14 +228,14 @@ bool CDWriteExt::DwRendingString(void* renderTarget,
FX_RECT& stringRect,
CFX_Matrix* pMatrix,
void* font,
- FX_FLOAT font_size,
+ float font_size,
FX_ARGB text_color,
int glyph_count,
unsigned short* glyph_indices,
- FX_FLOAT baselineOriginX,
- FX_FLOAT baselineOriginY,
+ float baselineOriginX,
+ float baselineOriginY,
void* glyph_offsets,
- FX_FLOAT* glyph_advances) {
+ float* glyph_advances) {
if (!renderTarget) {
return true;
}
@@ -395,7 +396,7 @@ HRESULT CDwFontContext::Initialize() {
}
CDwGdiTextRenderer::CDwGdiTextRenderer(
- CFX_DIBitmap* pBitmap,
+ const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
IDWriteBitmapRenderTarget* bitmapRenderTarget,
IDWriteRenderingParams* renderingParams)
: pBitmap_(pBitmap),
@@ -426,13 +427,13 @@ STDMETHODIMP CDwGdiTextRenderer::DrawGlyphRun(
HBITMAP hBitmap = (HBITMAP)::GetCurrentObject(hDC, OBJ_BITMAP);
BITMAP bitmap;
GetObject(hBitmap, sizeof bitmap, &bitmap);
- CFX_DIBitmap dib;
- dib.Create(bitmap.bmWidth, bitmap.bmHeight,
- bitmap.bmBitsPixel == 24 ? FXDIB_Rgb : FXDIB_Rgb32,
- (uint8_t*)bitmap.bmBits);
- dib.CompositeBitmap(text_bbox.left, text_bbox.top, text_bbox.Width(),
- text_bbox.Height(), pBitmap_, text_bbox.left,
- text_bbox.top, FXDIB_BLEND_NORMAL, nullptr);
+ auto dib = pdfium::MakeRetain<CFX_DIBitmap>();
+ dib->Create(bitmap.bmWidth, bitmap.bmHeight,
+ bitmap.bmBitsPixel == 24 ? FXDIB_Rgb : FXDIB_Rgb32,
+ (uint8_t*)bitmap.bmBits);
+ dib->CompositeBitmap(text_bbox.left, text_bbox.top, text_bbox.Width(),
+ text_bbox.Height(), pBitmap_, text_bbox.left,
+ text_bbox.top, FXDIB_BLEND_NORMAL, nullptr);
hr = pRenderTarget_->DrawGlyphRun(baselineOriginX, baselineOriginY,
measuringMode, glyphRun, pRenderingParams_,
textColor);
@@ -440,7 +441,7 @@ STDMETHODIMP CDwGdiTextRenderer::DrawGlyphRun(
return hr;
}
pBitmap_->CompositeBitmap(text_bbox.left, text_bbox.top, text_bbox.Width(),
- text_bbox.Height(), &dib, text_bbox.left,
+ text_bbox.Height(), dib, text_bbox.left,
text_bbox.top, FXDIB_BLEND_NORMAL, pClipRgn);
return hr;
}
diff --git a/chromium/third_party/pdfium/core/fxge/win32/fx_win32_gdipext.cpp b/chromium/third_party/pdfium/core/fxge/win32/fx_win32_gdipext.cpp
index 1be2a54b18f..6a3527f3933 100644
--- a/chromium/third_party/pdfium/core/fxge/win32/fx_win32_gdipext.cpp
+++ b/chromium/third_party/pdfium/core/fxge/win32/fx_win32_gdipext.cpp
@@ -461,10 +461,10 @@ static GpBrush* _GdipCreateBrush(DWORD argb) {
return solidBrush;
}
-static std::unique_ptr<CFX_DIBitmap> StretchMonoToGray(
+static CFX_RetainPtr<CFX_DIBitmap> StretchMonoToGray(
int dest_width,
int dest_height,
- const CFX_DIBitmap* pSource,
+ const CFX_RetainPtr<CFX_DIBitmap>& pSource,
FX_RECT* pClipRect) {
bool bFlipX = dest_width < 0;
if (bFlipX)
@@ -477,7 +477,7 @@ static std::unique_ptr<CFX_DIBitmap> StretchMonoToGray(
int result_width = pClipRect->Width();
int result_height = pClipRect->Height();
int result_pitch = (result_width + 3) / 4 * 4;
- auto pStretched = pdfium::MakeUnique<CFX_DIBitmap>();
+ auto pStretched = pdfium::MakeRetain<CFX_DIBitmap>();
if (!pStretched->Create(result_width, result_height, FXDIB_8bppRgb))
return nullptr;
@@ -518,7 +518,7 @@ static std::unique_ptr<CFX_DIBitmap> StretchMonoToGray(
static void OutputImageMask(GpGraphics* pGraphics,
BOOL bMonoDevice,
- const CFX_DIBitmap* pBitmap,
+ const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
int dest_left,
int dest_top,
int dest_width,
@@ -562,7 +562,7 @@ static void OutputImageMask(GpGraphics* pGraphics,
return;
}
image_clip.Offset(-image_rect.left, -image_rect.top);
- std::unique_ptr<CFX_DIBitmap> pStretched;
+ CFX_RetainPtr<CFX_DIBitmap> pStretched;
if (src_width * src_height > 10000) {
pStretched =
StretchMonoToGray(dest_width, dest_height, pBitmap, &image_clip);
@@ -602,7 +602,7 @@ static void OutputImageMask(GpGraphics* pGraphics,
CallFunc(GdipDisposeImage)(bitmap);
}
static void OutputImage(GpGraphics* pGraphics,
- const CFX_DIBitmap* pBitmap,
+ const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
const FX_RECT* pSrcRect,
int dest_left,
int dest_top,
@@ -613,11 +613,11 @@ static void OutputImage(GpGraphics* pGraphics,
((CWin32Platform*)CFX_GEModule::Get()->GetPlatformData())->m_GdiplusExt;
if (pBitmap->GetBPP() == 1 && (pSrcRect->left % 8)) {
FX_RECT new_rect(0, 0, src_width, src_height);
- std::unique_ptr<CFX_DIBitmap> pCloned = pBitmap->Clone(pSrcRect);
+ CFX_RetainPtr<CFX_DIBitmap> pCloned = pBitmap->Clone(pSrcRect);
if (!pCloned)
return;
- OutputImage(pGraphics, pCloned.get(), &new_rect, dest_left, dest_top,
- dest_width, dest_height);
+ OutputImage(pGraphics, pCloned, &new_rect, dest_left, dest_top, dest_width,
+ dest_height);
return;
}
int src_pitch = pBitmap->GetPitch();
@@ -680,7 +680,7 @@ CGdiplusExt::CGdiplusExt() {
}
void CGdiplusExt::Load() {
CFX_ByteString strPlusPath = "";
- FX_CHAR buf[MAX_PATH];
+ char buf[MAX_PATH];
GetSystemDirectoryA(buf, MAX_PATH);
strPlusPath += buf;
strPlusPath += "\\";
@@ -730,7 +730,8 @@ void CGdiplusExt::DeleteMemFont(LPVOID pCollection) {
((CWin32Platform*)CFX_GEModule::Get()->GetPlatformData())->m_GdiplusExt;
CallFunc(GdipDeletePrivateFontCollection)((GpFontCollection**)&pCollection);
}
-bool CGdiplusExt::GdipCreateBitmap(CFX_DIBitmap* pBitmap, void** bitmap) {
+bool CGdiplusExt::GdipCreateBitmap(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
+ void** bitmap) {
CGdiplusExt& GdiplusExt =
((CWin32Platform*)CFX_GEModule::Get()->GetPlatformData())->m_GdiplusExt;
PixelFormat format;
@@ -765,7 +766,7 @@ bool CGdiplusExt::GdipCreateFromImage(void* bitmap, void** graphics) {
}
return false;
}
-bool CGdiplusExt::GdipCreateFontFamilyFromName(const FX_WCHAR* name,
+bool CGdiplusExt::GdipCreateFontFamilyFromName(const wchar_t* name,
void* pFontCollection,
void** pFamily) {
CGdiplusExt& GdiplusExt =
@@ -779,7 +780,7 @@ bool CGdiplusExt::GdipCreateFontFamilyFromName(const FX_WCHAR* name,
return false;
}
bool CGdiplusExt::GdipCreateFontFromFamily(void* pFamily,
- FX_FLOAT font_size,
+ float font_size,
int fontstyle,
int flag,
void** pFont) {
@@ -793,13 +794,13 @@ bool CGdiplusExt::GdipCreateFontFromFamily(void* pFamily,
}
return false;
}
-void CGdiplusExt::GdipGetFontSize(void* pFont, FX_FLOAT* size) {
+void CGdiplusExt::GdipGetFontSize(void* pFont, float* size) {
REAL get_size;
CGdiplusExt& GdiplusExt =
((CWin32Platform*)CFX_GEModule::Get()->GetPlatformData())->m_GdiplusExt;
GpStatus status = CallFunc(GdipGetFontSize)((GpFont*)pFont, (REAL*)&get_size);
if (status == Ok) {
- *size = (FX_FLOAT)get_size;
+ *size = (float)get_size;
} else {
*size = 0;
}
@@ -845,7 +846,7 @@ void CGdiplusExt::GdipDeleteBrush(void* pBrush) {
CallFunc(GdipDeleteBrush)((GpSolidFill*)pBrush);
}
void* CGdiplusExt::GdipCreateFontFromCollection(void* pFontCollection,
- FX_FLOAT font_size,
+ float font_size,
int fontstyle) {
CGdiplusExt& GdiplusExt =
((CWin32Platform*)CFX_GEModule::Get()->GetPlatformData())->m_GdiplusExt;
@@ -869,12 +870,12 @@ void* CGdiplusExt::GdipCreateFontFromCollection(void* pFontCollection,
}
return pFont;
}
-void CGdiplusExt::GdipCreateMatrix(FX_FLOAT a,
- FX_FLOAT b,
- FX_FLOAT c,
- FX_FLOAT d,
- FX_FLOAT e,
- FX_FLOAT f,
+void CGdiplusExt::GdipCreateMatrix(float a,
+ float b,
+ float c,
+ float d,
+ float e,
+ float f,
void** matrix) {
CGdiplusExt& GdiplusExt =
((CWin32Platform*)CFX_GEModule::Get()->GetPlatformData())->m_GdiplusExt;
@@ -912,7 +913,7 @@ void CGdiplusExt::GdipDeleteGraphics(void* graphics) {
}
bool CGdiplusExt::StretchBitMask(HDC hDC,
BOOL bMonoDevice,
- const CFX_DIBitmap* pBitmap,
+ const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
int dest_left,
int dest_top,
int dest_width,
@@ -938,7 +939,7 @@ bool CGdiplusExt::StretchBitMask(HDC hDC,
return true;
}
bool CGdiplusExt::StretchDIBits(HDC hDC,
- const CFX_DIBitmap* pBitmap,
+ const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
int dest_left,
int dest_top,
int dest_width,
@@ -972,11 +973,11 @@ static GpPen* _GdipCreatePen(const CFX_GraphStateData* pGraphState,
bool bTextMode = false) {
CGdiplusExt& GdiplusExt =
((CWin32Platform*)CFX_GEModule::Get()->GetPlatformData())->m_GdiplusExt;
- FX_FLOAT width = pGraphState ? pGraphState->m_LineWidth : 1.0f;
+ float width = pGraphState ? pGraphState->m_LineWidth : 1.0f;
if (!bTextMode) {
- FX_FLOAT unit =
- pMatrix ? 1.0f / ((pMatrix->GetXUnit() + pMatrix->GetYUnit()) / 2)
- : 1.0f;
+ float unit = pMatrix
+ ? 1.0f / ((pMatrix->GetXUnit() + pMatrix->GetYUnit()) / 2)
+ : 1.0f;
if (width < unit) {
width = unit;
}
@@ -1015,13 +1016,13 @@ static GpPen* _GdipCreatePen(const CFX_GraphStateData* pGraphState,
}
CallFunc(GdipSetPenLineJoin)(pPen, lineJoin);
if (pGraphState->m_DashCount) {
- FX_FLOAT* pDashArray = FX_Alloc(
- FX_FLOAT, pGraphState->m_DashCount + pGraphState->m_DashCount % 2);
+ float* pDashArray = FX_Alloc(
+ float, pGraphState->m_DashCount + pGraphState->m_DashCount % 2);
int nCount = 0;
- FX_FLOAT on_leftover = 0, off_leftover = 0;
+ float on_leftover = 0, off_leftover = 0;
for (int i = 0; i < pGraphState->m_DashCount; i += 2) {
- FX_FLOAT on_phase = pGraphState->m_DashArray[i];
- FX_FLOAT off_phase;
+ float on_phase = pGraphState->m_DashArray[i];
+ float off_phase;
if (i == pGraphState->m_DashCount - 1) {
off_phase = on_phase;
} else {
@@ -1057,7 +1058,7 @@ static GpPen* _GdipCreatePen(const CFX_GraphStateData* pGraphState,
}
}
CallFunc(GdipSetPenDashArray)(pPen, pDashArray, nCount);
- FX_FLOAT phase = pGraphState->m_DashPhase;
+ float phase = pGraphState->m_DashPhase;
if (bDashExtend) {
if (phase < 0.5f) {
phase = 0;
@@ -1089,7 +1090,7 @@ static bool IsSmallTriangle(PointF* points,
}
CFX_PointF diff = p1 - p2;
- FX_FLOAT distance_square = (diff.x * diff.x) + (diff.y * diff.y);
+ float distance_square = (diff.x * diff.x) + (diff.y * diff.y);
if (distance_square < (1.0f * 2 + 1.0f / 4)) {
v1 = i;
v2 = pair1;
@@ -1296,7 +1297,7 @@ class GpStream final : public IStream {
}
bytes_left = m_InterStream.GetLength() - m_ReadPos;
bytes_out = std::min(pdfium::base::checked_cast<size_t>(cb), bytes_left);
- FXSYS_memcpy(Output, m_InterStream.GetBuffer() + m_ReadPos, bytes_out);
+ memcpy(Output, m_InterStream.GetBuffer() + m_ReadPos, bytes_out);
m_ReadPos += (int32_t)bytes_out;
if (pcbRead) {
*pcbRead = (ULONG)bytes_out;
@@ -1492,27 +1493,29 @@ static void FreeDIBitmap(PREVIEW3_DIBITMAP* pInfo) {
FX_Free(pInfo);
}
-CFX_DIBitmap* _FX_WindowsDIB_LoadFromBuf(BITMAPINFO* pbmi,
- LPVOID pData,
- bool bAlpha);
-CFX_DIBitmap* CGdiplusExt::LoadDIBitmap(WINDIB_Open_Args_ args) {
+// TODO(tsepez): Really? Really? Move to header.
+CFX_RetainPtr<CFX_DIBitmap> _FX_WindowsDIB_LoadFromBuf(BITMAPINFO* pbmi,
+ LPVOID pData,
+ bool bAlpha);
+
+CFX_RetainPtr<CFX_DIBitmap> CGdiplusExt::LoadDIBitmap(WINDIB_Open_Args_ args) {
PREVIEW3_DIBITMAP* pInfo = ::LoadDIBitmap(args);
- if (!pInfo) {
+ if (!pInfo)
return nullptr;
- }
+
int height = abs(pInfo->pbmi->bmiHeader.biHeight);
int width = pInfo->pbmi->bmiHeader.biWidth;
int dest_pitch = (width * pInfo->pbmi->bmiHeader.biBitCount + 31) / 32 * 4;
LPBYTE pData = FX_Alloc2D(BYTE, dest_pitch, height);
if (dest_pitch == pInfo->Stride) {
- FXSYS_memcpy(pData, pInfo->pScan0, dest_pitch * height);
+ memcpy(pData, pInfo->pScan0, dest_pitch * height);
} else {
for (int i = 0; i < height; i++) {
- FXSYS_memcpy(pData + dest_pitch * i, pInfo->pScan0 + pInfo->Stride * i,
- dest_pitch);
+ memcpy(pData + dest_pitch * i, pInfo->pScan0 + pInfo->Stride * i,
+ dest_pitch);
}
}
- CFX_DIBitmap* pDIBitmap = _FX_WindowsDIB_LoadFromBuf(
+ CFX_RetainPtr<CFX_DIBitmap> pDIBitmap = _FX_WindowsDIB_LoadFromBuf(
pInfo->pbmi, pData, pInfo->pbmi->bmiHeader.biBitCount == 32);
FX_Free(pData);
FreeDIBitmap(pInfo);
diff --git a/chromium/third_party/pdfium/core/fxge/win32/fx_win32_print.cpp b/chromium/third_party/pdfium/core/fxge/win32/fx_win32_print.cpp
index cda83ebc95a..e5df6edd418 100644
--- a/chromium/third_party/pdfium/core/fxge/win32/fx_win32_print.cpp
+++ b/chromium/third_party/pdfium/core/fxge/win32/fx_win32_print.cpp
@@ -12,7 +12,9 @@
#include "core/fxcrt/fx_system.h"
#include "core/fxge/cfx_windowsdevice.h"
-#include "core/fxge/dib/dib_int.h"
+#include "core/fxge/dib/cfx_dibextractor.h"
+#include "core/fxge/dib/cfx_imagerenderer.h"
+#include "core/fxge/dib/cstretchengine.h"
#include "core/fxge/fx_freetype.h"
#include "core/fxge/ge/fx_text_int.h"
#include "core/fxge/win32/cpsoutput.h"
@@ -67,7 +69,7 @@ int CGdiPrinterDriver::GetDeviceCaps(int caps_id) const {
return CGdiDeviceDriver::GetDeviceCaps(caps_id);
}
-bool CGdiPrinterDriver::SetDIBits(const CFX_DIBSource* pSource,
+bool CGdiPrinterDriver::SetDIBits(const CFX_RetainPtr<CFX_DIBSource>& pSource,
uint32_t color,
const FX_RECT* pSrcRect,
int left,
@@ -87,29 +89,30 @@ bool CGdiPrinterDriver::SetDIBits(const CFX_DIBSource* pSource,
return false;
CFX_DIBExtractor temp(pSource);
- CFX_DIBitmap* pBitmap = temp.GetBitmap();
+ CFX_RetainPtr<CFX_DIBitmap> pBitmap = temp.GetBitmap();
if (!pBitmap)
return false;
return GDI_SetDIBits(pBitmap, pSrcRect, left, top);
}
-bool CGdiPrinterDriver::StretchDIBits(const CFX_DIBSource* pSource,
- uint32_t color,
- int dest_left,
- int dest_top,
- int dest_width,
- int dest_height,
- const FX_RECT* pClipRect,
- uint32_t flags,
- int blend_type) {
+bool CGdiPrinterDriver::StretchDIBits(
+ const CFX_RetainPtr<CFX_DIBSource>& pSource,
+ uint32_t color,
+ int dest_left,
+ int dest_top,
+ int dest_width,
+ int dest_height,
+ const FX_RECT* pClipRect,
+ uint32_t flags,
+ int blend_type) {
if (pSource->IsAlphaMask()) {
int alpha = FXARGB_A(color);
if (pSource->GetBPP() != 1 || alpha != 255)
return false;
if (dest_width < 0 || dest_height < 0) {
- std::unique_ptr<CFX_DIBitmap> pFlipped =
+ CFX_RetainPtr<CFX_DIBitmap> pFlipped =
pSource->FlipImage(dest_width < 0, dest_height < 0);
if (!pFlipped)
return false;
@@ -119,13 +122,12 @@ bool CGdiPrinterDriver::StretchDIBits(const CFX_DIBSource* pSource,
if (dest_height < 0)
dest_top += dest_height;
- return GDI_StretchBitMask(pFlipped.get(), dest_left, dest_top,
- abs(dest_width), abs(dest_height), color,
- flags);
+ return GDI_StretchBitMask(pFlipped, dest_left, dest_top, abs(dest_width),
+ abs(dest_height), color, flags);
}
CFX_DIBExtractor temp(pSource);
- CFX_DIBitmap* pBitmap = temp.GetBitmap();
+ CFX_RetainPtr<CFX_DIBitmap> pBitmap = temp.GetBitmap();
if (!pBitmap)
return false;
return GDI_StretchBitMask(pBitmap, dest_left, dest_top, dest_width,
@@ -136,7 +138,7 @@ bool CGdiPrinterDriver::StretchDIBits(const CFX_DIBSource* pSource,
return false;
if (dest_width < 0 || dest_height < 0) {
- std::unique_ptr<CFX_DIBitmap> pFlipped =
+ CFX_RetainPtr<CFX_DIBitmap> pFlipped =
pSource->FlipImage(dest_width < 0, dest_height < 0);
if (!pFlipped)
return false;
@@ -146,24 +148,24 @@ bool CGdiPrinterDriver::StretchDIBits(const CFX_DIBSource* pSource,
if (dest_height < 0)
dest_top += dest_height;
- return GDI_StretchDIBits(pFlipped.get(), dest_left, dest_top,
- abs(dest_width), abs(dest_height), flags);
+ return GDI_StretchDIBits(pFlipped, dest_left, dest_top, abs(dest_width),
+ abs(dest_height), flags);
}
CFX_DIBExtractor temp(pSource);
- CFX_DIBitmap* pBitmap = temp.GetBitmap();
+ CFX_RetainPtr<CFX_DIBitmap> pBitmap = temp.GetBitmap();
if (!pBitmap)
return false;
return GDI_StretchDIBits(pBitmap, dest_left, dest_top, dest_width,
dest_height, flags);
}
-bool CGdiPrinterDriver::StartDIBits(const CFX_DIBSource* pSource,
+bool CGdiPrinterDriver::StartDIBits(const CFX_RetainPtr<CFX_DIBSource>& pSource,
int bitmap_alpha,
uint32_t color,
const CFX_Matrix* pMatrix,
uint32_t render_flags,
- void*& handle,
+ std::unique_ptr<CFX_ImageRenderer>* handle,
int blend_type) {
if (bitmap_alpha < 255 || pSource->HasAlpha() ||
(pSource->IsAlphaMask() && (pSource->GetBPP() != 1))) {
@@ -171,8 +173,8 @@ bool CGdiPrinterDriver::StartDIBits(const CFX_DIBSource* pSource,
}
CFX_FloatRect unit_rect = pMatrix->GetUnitRect();
FX_RECT full_rect = unit_rect.GetOuterRect();
- if (FXSYS_fabs(pMatrix->b) < 0.5f && pMatrix->a != 0 &&
- FXSYS_fabs(pMatrix->c) < 0.5f && pMatrix->d != 0) {
+ if (fabs(pMatrix->b) < 0.5f && pMatrix->a != 0 && fabs(pMatrix->c) < 0.5f &&
+ pMatrix->d != 0) {
bool bFlipX = pMatrix->a < 0;
bool bFlipY = pMatrix->d > 0;
return StretchDIBits(pSource, color,
@@ -182,15 +184,15 @@ bool CGdiPrinterDriver::StartDIBits(const CFX_DIBSource* pSource,
bFlipY ? -full_rect.Height() : full_rect.Height(),
nullptr, 0, blend_type);
}
- if (FXSYS_fabs(pMatrix->a) >= 0.5f || FXSYS_fabs(pMatrix->d) >= 0.5f)
+ if (fabs(pMatrix->a) >= 0.5f || fabs(pMatrix->d) >= 0.5f)
return false;
- std::unique_ptr<CFX_DIBitmap> pTransformed =
+ CFX_RetainPtr<CFX_DIBitmap> pTransformed =
pSource->SwapXY(pMatrix->c > 0, pMatrix->b < 0);
if (!pTransformed)
return false;
- return StretchDIBits(pTransformed.get(), color, full_rect.left, full_rect.top,
+ return StretchDIBits(pTransformed, color, full_rect.left, full_rect.top,
full_rect.Width(), full_rect.Height(), nullptr, 0,
blend_type);
}
@@ -199,7 +201,7 @@ bool CGdiPrinterDriver::DrawDeviceText(int nChars,
const FXTEXT_CHARPOS* pCharPos,
CFX_Font* pFont,
const CFX_Matrix* pObject2Device,
- FX_FLOAT font_size,
+ float font_size,
uint32_t color) {
#if defined(PDFIUM_PRINT_TEXT_WITH_GDI)
if (!g_pdfium_print_text_with_gdi)
@@ -287,7 +289,7 @@ bool CGdiPrinterDriver::DrawDeviceText(int nChars,
// Text
CFX_WideString wsText;
std::vector<INT> spacing(nChars);
- FX_FLOAT fPreviousOriginX = 0;
+ float fPreviousOriginX = 0;
for (int i = 0; i < nChars; ++i) {
// Only works with PDFs from Skia's PDF generator. Cannot handle arbitrary
// values from PDFs.
@@ -300,8 +302,8 @@ bool CGdiPrinterDriver::DrawDeviceText(int nChars,
// Round the spacing to the nearest integer, but keep track of the rounding
// error for calculating the next spacing value.
- FX_FLOAT fOriginX = charpos.m_Origin.x * kScaleFactor;
- FX_FLOAT fPixelSpacing = fOriginX - fPreviousOriginX;
+ float fOriginX = charpos.m_Origin.x * kScaleFactor;
+ float fPixelSpacing = fOriginX - fPreviousOriginX;
spacing[i] = FXSYS_round(fPixelSpacing);
fPreviousOriginX = fOriginX - (fPixelSpacing - spacing[i]);
@@ -349,10 +351,10 @@ CPSPrinterDriver::CPSPrinterDriver(HDC hDC, int pslevel, bool bCmykOutput)
for (uint32_t i = 0; i < pData->rdh.nCount; i++) {
RECT* pRect =
reinterpret_cast<RECT*>(pData->Buffer + pData->rdh.nRgnSize * i);
- path.AppendRect(static_cast<FX_FLOAT>(pRect->left),
- static_cast<FX_FLOAT>(pRect->bottom),
- static_cast<FX_FLOAT>(pRect->right),
- static_cast<FX_FLOAT>(pRect->top));
+ path.AppendRect(static_cast<float>(pRect->left),
+ static_cast<float>(pRect->bottom),
+ static_cast<float>(pRect->right),
+ static_cast<float>(pRect->top));
}
m_PSRenderer.SetClip_PathFill(&path, nullptr, FXFILL_WINDING);
}
@@ -436,7 +438,7 @@ bool CPSPrinterDriver::GetClipBox(FX_RECT* pRect) {
return true;
}
-bool CPSPrinterDriver::SetDIBits(const CFX_DIBSource* pBitmap,
+bool CPSPrinterDriver::SetDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
uint32_t color,
const FX_RECT* pSrcRect,
int left,
@@ -447,27 +449,28 @@ bool CPSPrinterDriver::SetDIBits(const CFX_DIBSource* pBitmap,
return m_PSRenderer.SetDIBits(pBitmap, color, left, top);
}
-bool CPSPrinterDriver::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 blend_type) {
+bool CPSPrinterDriver::StretchDIBits(
+ const CFX_RetainPtr<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 blend_type) {
if (blend_type != FXDIB_BLEND_NORMAL)
return false;
return m_PSRenderer.StretchDIBits(pBitmap, color, dest_left, dest_top,
dest_width, dest_height, flags);
}
-bool CPSPrinterDriver::StartDIBits(const CFX_DIBSource* pBitmap,
+bool CPSPrinterDriver::StartDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
int bitmap_alpha,
uint32_t color,
const CFX_Matrix* pMatrix,
uint32_t render_flags,
- void*& handle,
+ std::unique_ptr<CFX_ImageRenderer>* handle,
int blend_type) {
if (blend_type != FXDIB_BLEND_NORMAL)
return false;
@@ -475,7 +478,7 @@ bool CPSPrinterDriver::StartDIBits(const CFX_DIBSource* pBitmap,
if (bitmap_alpha < 255)
return false;
- handle = nullptr;
+ *handle = nullptr;
return m_PSRenderer.DrawDIBits(pBitmap, color, pMatrix, render_flags);
}
@@ -483,7 +486,7 @@ bool CPSPrinterDriver::DrawDeviceText(int nChars,
const FXTEXT_CHARPOS* pCharPos,
CFX_Font* pFont,
const CFX_Matrix* pObject2Device,
- FX_FLOAT font_size,
+ float font_size,
uint32_t color) {
return m_PSRenderer.DrawText(nChars, pCharPos, pFont, pObject2Device,
font_size, color);
diff --git a/chromium/third_party/pdfium/core/fxge/win32/win32_int.h b/chromium/third_party/pdfium/core/fxge/win32/win32_int.h
index f8eae873087..a5fc853de52 100644
--- a/chromium/third_party/pdfium/core/fxge/win32/win32_int.h
+++ b/chromium/third_party/pdfium/core/fxge/win32/win32_int.h
@@ -17,6 +17,7 @@
#include "core/fxge/win32/cpsoutput.h"
#include "core/fxge/win32/dwrite_int.h"
+class CFX_ImageRenderer;
class FXTEXT_CHARPOS;
struct WINDIB_Open_Args_;
@@ -34,7 +35,7 @@ class CGdiplusExt {
bool IsAvailable() { return !!m_hModule; }
bool StretchBitMask(HDC hDC,
BOOL bMonoDevice,
- const CFX_DIBitmap* pBitmap,
+ const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
int dest_left,
int dest_top,
int dest_width,
@@ -43,7 +44,7 @@ class CGdiplusExt {
const FX_RECT* pClipRect,
int flags);
bool StretchDIBits(HDC hDC,
- const CFX_DIBitmap* pBitmap,
+ const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
int dest_left,
int dest_top,
int dest_width,
@@ -75,36 +76,37 @@ class CGdiplusExt {
const void* matrix);
void GdipCreateBrush(uint32_t fill_argb, void** pBrush);
void GdipDeleteBrush(void* pBrush);
- void GdipCreateMatrix(FX_FLOAT a,
- FX_FLOAT b,
- FX_FLOAT c,
- FX_FLOAT d,
- FX_FLOAT e,
- FX_FLOAT f,
+ void GdipCreateMatrix(float a,
+ float b,
+ float c,
+ float d,
+ float e,
+ float f,
void** matrix);
void GdipDeleteMatrix(void* matrix);
- bool GdipCreateFontFamilyFromName(const FX_WCHAR* name,
+ bool GdipCreateFontFamilyFromName(const wchar_t* name,
void* pFontCollection,
void** pFamily);
void GdipDeleteFontFamily(void* pFamily);
bool GdipCreateFontFromFamily(void* pFamily,
- FX_FLOAT font_size,
+ float font_size,
int fontstyle,
int flag,
void** pFont);
void* GdipCreateFontFromCollection(void* pFontCollection,
- FX_FLOAT font_size,
+ float font_size,
int fontstyle);
void GdipDeleteFont(void* pFont);
- bool GdipCreateBitmap(CFX_DIBitmap* pBitmap, void** bitmap);
+ bool GdipCreateBitmap(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
+ void** bitmap);
void GdipDisposeImage(void* bitmap);
- void GdipGetFontSize(void* pFont, FX_FLOAT* size);
+ void GdipGetFontSize(void* pFont, float* size);
void* GdiAddFontMemResourceEx(void* pFontdata,
uint32_t size,
void* pdv,
uint32_t* num_face);
bool GdiRemoveFontMemResourceEx(void* handle);
- CFX_DIBitmap* LoadDIBitmap(WINDIB_Open_Args_ args);
+ CFX_RetainPtr<CFX_DIBitmap> LoadDIBitmap(WINDIB_Open_Args_ args);
FARPROC m_Functions[100];
FuncType_GdiAddFontMemResourceEx m_pGdiAddFontMemResourceEx;
@@ -147,28 +149,28 @@ class CGdiDeviceDriver : public IFX_RenderDeviceDriver {
bool FillRectWithBlend(const FX_RECT* pRect,
uint32_t fill_color,
int blend_type) override;
- bool DrawCosmeticLine(FX_FLOAT x1,
- FX_FLOAT y1,
- FX_FLOAT x2,
- FX_FLOAT y2,
+ bool DrawCosmeticLine(float x1,
+ float y1,
+ float x2,
+ float y2,
uint32_t color,
int blend_type) override;
bool GetClipBox(FX_RECT* pRect) override;
void* GetPlatformSurface() const override;
- void DrawLine(FX_FLOAT x1, FX_FLOAT y1, FX_FLOAT x2, FX_FLOAT y2);
+ void DrawLine(float x1, float y1, float x2, float y2);
- bool GDI_SetDIBits(CFX_DIBitmap* pBitmap,
+ bool GDI_SetDIBits(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
const FX_RECT* pSrcRect,
int left,
int top);
- bool GDI_StretchDIBits(CFX_DIBitmap* pBitmap,
+ bool GDI_StretchDIBits(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
int dest_left,
int dest_top,
int dest_width,
int dest_height,
uint32_t flags);
- bool GDI_StretchBitMask(CFX_DIBitmap* pBitmap,
+ bool GDI_StretchBitMask(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
int dest_left,
int dest_top,
int dest_width,
@@ -191,14 +193,16 @@ class CGdiDisplayDriver : public CGdiDeviceDriver {
~CGdiDisplayDriver() override;
protected:
- bool GetDIBits(CFX_DIBitmap* pBitmap, int left, int top) override;
- bool SetDIBits(const CFX_DIBSource* pBitmap,
+ bool GetDIBits(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
+ int left,
+ int top) override;
+ bool SetDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
uint32_t color,
const FX_RECT* pSrcRect,
int left,
int top,
int blend_type) override;
- bool StretchDIBits(const CFX_DIBSource* pBitmap,
+ bool StretchDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
uint32_t color,
int dest_left,
int dest_top,
@@ -207,14 +211,14 @@ class CGdiDisplayDriver : public CGdiDeviceDriver {
const FX_RECT* pClipRect,
uint32_t flags,
int blend_type) override;
- bool StartDIBits(const CFX_DIBSource* pBitmap,
+ bool StartDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
int bitmap_alpha,
uint32_t color,
const CFX_Matrix* pMatrix,
uint32_t render_flags,
- void*& handle,
+ std::unique_ptr<CFX_ImageRenderer>* handle,
int blend_type) override;
- bool UseFoxitStretchEngine(const CFX_DIBSource* pSource,
+ bool UseFoxitStretchEngine(const CFX_RetainPtr<CFX_DIBSource>& pSource,
uint32_t color,
int dest_left,
int dest_top,
@@ -231,13 +235,13 @@ class CGdiPrinterDriver : public CGdiDeviceDriver {
protected:
int GetDeviceCaps(int caps_id) const override;
- bool SetDIBits(const CFX_DIBSource* pBitmap,
+ bool SetDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
uint32_t color,
const FX_RECT* pSrcRect,
int left,
int top,
int blend_type) override;
- bool StretchDIBits(const CFX_DIBSource* pBitmap,
+ bool StretchDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
uint32_t color,
int dest_left,
int dest_top,
@@ -246,18 +250,18 @@ class CGdiPrinterDriver : public CGdiDeviceDriver {
const FX_RECT* pClipRect,
uint32_t flags,
int blend_type) override;
- bool StartDIBits(const CFX_DIBSource* pBitmap,
+ bool StartDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
int bitmap_alpha,
uint32_t color,
const CFX_Matrix* pMatrix,
uint32_t render_flags,
- void*& handle,
+ std::unique_ptr<CFX_ImageRenderer>* handle,
int blend_type) override;
bool DrawDeviceText(int nChars,
const FXTEXT_CHARPOS* pCharPos,
CFX_Font* pFont,
const CFX_Matrix* pObject2Device,
- FX_FLOAT font_size,
+ float font_size,
uint32_t color) override;
const int m_HorzSize;
@@ -290,13 +294,13 @@ class CPSPrinterDriver : public IFX_RenderDeviceDriver {
int fill_mode,
int blend_type) override;
bool GetClipBox(FX_RECT* pRect) override;
- bool SetDIBits(const CFX_DIBSource* pBitmap,
+ bool SetDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
uint32_t color,
const FX_RECT* pSrcRect,
int left,
int top,
int blend_type) override;
- bool StretchDIBits(const CFX_DIBSource* pBitmap,
+ bool StretchDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
uint32_t color,
int dest_left,
int dest_top,
@@ -305,18 +309,18 @@ class CPSPrinterDriver : public IFX_RenderDeviceDriver {
const FX_RECT* pClipRect,
uint32_t flags,
int blend_type) override;
- bool StartDIBits(const CFX_DIBSource* pBitmap,
+ bool StartDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
int bitmap_alpha,
uint32_t color,
const CFX_Matrix* pMatrix,
uint32_t render_flags,
- void*& handle,
+ std::unique_ptr<CFX_ImageRenderer>* handle,
int blend_type) override;
bool DrawDeviceText(int nChars,
const FXTEXT_CHARPOS* pCharPos,
CFX_Font* pFont,
const CFX_Matrix* pObject2Device,
- FX_FLOAT font_size,
+ float font_size,
uint32_t color) override;
void* GetPlatformSurface() const override;
diff --git a/chromium/third_party/pdfium/docs/getting-started.md b/chromium/third_party/pdfium/docs/getting-started.md
index b80e56683b6..8d218e2e4b1 100644
--- a/chromium/third_party/pdfium/docs/getting-started.md
+++ b/chromium/third_party/pdfium/docs/getting-started.md
@@ -73,8 +73,7 @@ the link line in order to compile. My build line was:
```
PDF_LIBS="-lpdfium -lfpdfapi -lfxge -lfpdfdoc -lfxcrt -lfx_agg \
-lfxcodec -lfx_lpng -lfx_libopenjpeg -lfx_lcms2 -lfx_freetype -ljpeg \
--lfx_zlib -lfdrm -lpdfwindow -lbigint -lformfiller -ljavascript \
--lfxedit"
+-lfdrm -lpdfwindow -lbigint -lformfiller -ljavascript -lfxedit"
PDF_DIR=<path/to/pdfium>
clang -I $PDF_DIR/public -o init init.c -L $PDF_DIR/out/Debug -lstdc++ -framework AppKit $PDF_LIBS
diff --git a/chromium/third_party/pdfium/fpdfsdk/DEPS b/chromium/third_party/pdfium/fpdfsdk/DEPS
index e077225b176..807b3972987 100644
--- a/chromium/third_party/pdfium/fpdfsdk/DEPS
+++ b/chromium/third_party/pdfium/fpdfsdk/DEPS
@@ -3,7 +3,7 @@ include_rules = [
'+public',
'+v8',
'+xfa/fwl',
- '+xfa/fxbarcode',
+ '+fxbarcode',
'+xfa/fxfa',
'+xfa/fxgraphics',
]
diff --git a/chromium/third_party/pdfium/fpdfsdk/cba_annotiterator.cpp b/chromium/third_party/pdfium/fpdfsdk/cba_annotiterator.cpp
index cc842babee2..3e35ff82948 100644
--- a/chromium/third_party/pdfium/fpdfsdk/cba_annotiterator.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/cba_annotiterator.cpp
@@ -73,7 +73,7 @@ CPDFSDK_Annot* CBA_AnnotIterator::GetPrevAnnot(CPDFSDK_Annot* pAnnot) {
}
void CBA_AnnotIterator::CollectAnnots(std::vector<CPDFSDK_Annot*>* pArray) {
- for (auto pAnnot : m_pPageView->GetAnnotList()) {
+ for (auto* pAnnot : m_pPageView->GetAnnotList()) {
if (pAnnot->GetAnnotSubtype() == m_nAnnotSubtype &&
!pAnnot->IsSignatureWidget()) {
pArray->push_back(pAnnot);
@@ -113,7 +113,7 @@ void CBA_AnnotIterator::GenerateResults() {
while (!sa.empty()) {
int nLeftTopIndex = -1;
- FX_FLOAT fTop = 0.0f;
+ float fTop = 0.0f;
for (int i = sa.size() - 1; i >= 0; i--) {
CFX_FloatRect rcAnnot = GetAnnotRect(sa[i]);
if (rcAnnot.top > fTop) {
@@ -129,7 +129,7 @@ void CBA_AnnotIterator::GenerateResults() {
std::vector<size_t> aSelect;
for (size_t i = 0; i < sa.size(); ++i) {
CFX_FloatRect rcAnnot = GetAnnotRect(sa[i]);
- FX_FLOAT fCenterY = (rcAnnot.top + rcAnnot.bottom) / 2.0f;
+ float fCenterY = (rcAnnot.top + rcAnnot.bottom) / 2.0f;
if (fCenterY > rcLeftTop.bottom && fCenterY < rcLeftTop.top)
aSelect.push_back(i);
}
@@ -145,7 +145,7 @@ void CBA_AnnotIterator::GenerateResults() {
while (!sa.empty()) {
int nLeftTopIndex = -1;
- FX_FLOAT fLeft = -1.0f;
+ float fLeft = -1.0f;
for (int i = sa.size() - 1; i >= 0; --i) {
CFX_FloatRect rcAnnot = GetAnnotRect(sa[i]);
if (fLeft < 0) {
@@ -164,7 +164,7 @@ void CBA_AnnotIterator::GenerateResults() {
std::vector<size_t> aSelect;
for (size_t i = 0; i < sa.size(); ++i) {
CFX_FloatRect rcAnnot = GetAnnotRect(sa[i]);
- FX_FLOAT fCenterX = (rcAnnot.left + rcAnnot.right) / 2.0f;
+ float fCenterX = (rcAnnot.left + rcAnnot.right) / 2.0f;
if (fCenterX > rcLeftTop.left && fCenterX < rcLeftTop.right)
aSelect.push_back(i);
}
diff --git a/chromium/third_party/pdfium/fpdfsdk/cfx_systemhandler.cpp b/chromium/third_party/pdfium/fpdfsdk/cfx_systemhandler.cpp
index b6dc19d48f2..906954354b9 100644
--- a/chromium/third_party/pdfium/fpdfsdk/cfx_systemhandler.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/cfx_systemhandler.cpp
@@ -46,10 +46,10 @@ void CFX_SystemHandler::InvalidateRect(CPDFSDK_Widget* widget, FX_RECT rect) {
CFX_Matrix device2page;
device2page.SetReverse(page2device);
- CFX_PointF left_top = device2page.Transform(CFX_PointF(
- static_cast<FX_FLOAT>(rect.left), static_cast<FX_FLOAT>(rect.top)));
+ CFX_PointF left_top = device2page.Transform(
+ CFX_PointF(static_cast<float>(rect.left), static_cast<float>(rect.top)));
CFX_PointF right_bottom = device2page.Transform(CFX_PointF(
- static_cast<FX_FLOAT>(rect.right), static_cast<FX_FLOAT>(rect.bottom)));
+ static_cast<float>(rect.right), static_cast<float>(rect.bottom)));
CFX_FloatRect rcPDF(left_top.x, right_bottom.y, right_bottom.x, left_top.y);
rcPDF.Normalize();
@@ -114,7 +114,7 @@ CPDF_Font* CFX_SystemHandler::AddNativeTrueTypeFontToPDF(
if (!pDoc)
return nullptr;
- std::unique_ptr<CFX_Font> pFXFont(new CFX_Font);
+ auto pFXFont = pdfium::MakeUnique<CFX_Font>();
pFXFont->LoadSubst(sFontFaceName, true, 0, 0, 0, CharSet2CP(nCharset), false);
return pDoc->AddFont(pFXFont.get(), nCharset, false);
}
diff --git a/chromium/third_party/pdfium/fpdfsdk/cpdfsdk_annot.cpp b/chromium/third_party/pdfium/fpdfsdk/cpdfsdk_annot.cpp
index 4dcce484653..dcfcac92fc3 100644
--- a/chromium/third_party/pdfium/fpdfsdk/cpdfsdk_annot.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/cpdfsdk_annot.cpp
@@ -43,11 +43,11 @@ CPDFXFA_Page* CPDFSDK_Annot::GetPDFXFAPage() {
#endif // PDF_ENABLE_XFA
-FX_FLOAT CPDFSDK_Annot::GetMinWidth() const {
+float CPDFSDK_Annot::GetMinWidth() const {
return kMinWidth;
}
-FX_FLOAT CPDFSDK_Annot::GetMinHeight() const {
+float CPDFSDK_Annot::GetMinHeight() const {
return kMinHeight;
}
diff --git a/chromium/third_party/pdfium/fpdfsdk/cpdfsdk_annot.h b/chromium/third_party/pdfium/fpdfsdk/cpdfsdk_annot.h
index 36e7b56612a..1053c00c13e 100644
--- a/chromium/third_party/pdfium/fpdfsdk/cpdfsdk_annot.h
+++ b/chromium/third_party/pdfium/fpdfsdk/cpdfsdk_annot.h
@@ -32,8 +32,8 @@ class CPDFSDK_Annot : public CFX_Observable<CPDFSDK_Annot> {
virtual CXFA_FFWidget* GetXFAWidget() const;
#endif // PDF_ENABLE_XFA
- virtual FX_FLOAT GetMinWidth() const;
- virtual FX_FLOAT GetMinHeight() const;
+ virtual float GetMinWidth() const;
+ virtual float GetMinHeight() const;
virtual int GetLayoutOrder() const;
virtual CPDF_Annot* GetPDFAnnot() const;
virtual CPDF_Annot::Subtype GetAnnotSubtype() const;
diff --git a/chromium/third_party/pdfium/fpdfsdk/cpdfsdk_annothandlermgr.cpp b/chromium/third_party/pdfium/fpdfsdk/cpdfsdk_annothandlermgr.cpp
index c4990674ded..287ee11a4df 100644
--- a/chromium/third_party/pdfium/fpdfsdk/cpdfsdk_annothandlermgr.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/cpdfsdk_annothandlermgr.cpp
@@ -21,8 +21,8 @@
#ifdef PDF_ENABLE_XFA
#include "fpdfsdk/cpdfsdk_xfawidgethandler.h"
#include "fpdfsdk/fpdfxfa/cpdfxfa_page.h"
-#include "xfa/fxfa/xfa_ffpageview.h"
-#include "xfa/fxfa/xfa_ffwidget.h"
+#include "xfa/fxfa/cxfa_ffpageview.h"
+#include "xfa/fxfa/cxfa_ffwidget.h"
#endif // PDF_ENABLE_XFA
CPDFSDK_AnnotHandlerMgr::CPDFSDK_AnnotHandlerMgr(
diff --git a/chromium/third_party/pdfium/fpdfsdk/cpdfsdk_annotiteration.cpp b/chromium/third_party/pdfium/fpdfsdk/cpdfsdk_annotiteration.cpp
index dd99ade5092..d2569506584 100644
--- a/chromium/third_party/pdfium/fpdfsdk/cpdfsdk_annotiteration.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/cpdfsdk_annotiteration.cpp
@@ -33,7 +33,7 @@ CPDFSDK_AnnotIteration::CPDFSDK_AnnotIteration(CPDFSDK_PageView* pPageView,
std::reverse(copiedList.begin(), copiedList.end());
m_List.reserve(copiedList.size());
- for (const auto& pAnnot : copiedList)
+ for (auto* pAnnot : copiedList)
m_List.emplace_back(pAnnot);
}
diff --git a/chromium/third_party/pdfium/fpdfsdk/cpdfsdk_baannot.cpp b/chromium/third_party/pdfium/fpdfsdk/cpdfsdk_baannot.cpp
index 3eedf1502c0..129491c210e 100644
--- a/chromium/third_party/pdfium/fpdfsdk/cpdfsdk_baannot.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/cpdfsdk_baannot.cpp
@@ -71,7 +71,7 @@ bool CPDFSDK_BAAnnot::IsAppearanceValid(CPDF_Annot::AppearanceMode mode) {
return false;
// Choose the right sub-ap
- const FX_CHAR* ap_entry = "N";
+ const char* ap_entry = "N";
if (mode == CPDF_Annot::Down)
ap_entry = "D";
else if (mode == CPDF_Annot::Rollover)
@@ -245,11 +245,11 @@ BorderStyle CPDFSDK_BAAnnot::GetBorderStyle() const {
void CPDFSDK_BAAnnot::SetColor(FX_COLORREF color) {
CPDF_Array* pArray = m_pAnnot->GetAnnotDict()->SetNewFor<CPDF_Array>("C");
- pArray->AddNew<CPDF_Number>(static_cast<FX_FLOAT>(FXSYS_GetRValue(color)) /
+ pArray->AddNew<CPDF_Number>(static_cast<float>(FXSYS_GetRValue(color)) /
255.0f);
- pArray->AddNew<CPDF_Number>(static_cast<FX_FLOAT>(FXSYS_GetGValue(color)) /
+ pArray->AddNew<CPDF_Number>(static_cast<float>(FXSYS_GetGValue(color)) /
255.0f);
- pArray->AddNew<CPDF_Number>(static_cast<FX_FLOAT>(FXSYS_GetBValue(color)) /
+ pArray->AddNew<CPDF_Number>(static_cast<float>(FXSYS_GetBValue(color)) /
255.0f);
}
@@ -261,28 +261,28 @@ bool CPDFSDK_BAAnnot::GetColor(FX_COLORREF& color) const {
if (CPDF_Array* pEntry = m_pAnnot->GetAnnotDict()->GetArrayFor("C")) {
size_t nCount = pEntry->GetCount();
if (nCount == 1) {
- FX_FLOAT g = pEntry->GetNumberAt(0) * 255;
+ float g = pEntry->GetNumberAt(0) * 255;
color = FXSYS_RGB((int)g, (int)g, (int)g);
return true;
} else if (nCount == 3) {
- FX_FLOAT r = pEntry->GetNumberAt(0) * 255;
- FX_FLOAT g = pEntry->GetNumberAt(1) * 255;
- FX_FLOAT b = pEntry->GetNumberAt(2) * 255;
+ float r = pEntry->GetNumberAt(0) * 255;
+ float g = pEntry->GetNumberAt(1) * 255;
+ float b = pEntry->GetNumberAt(2) * 255;
color = FXSYS_RGB((int)r, (int)g, (int)b);
return true;
} else if (nCount == 4) {
- FX_FLOAT c = pEntry->GetNumberAt(0);
- FX_FLOAT m = pEntry->GetNumberAt(1);
- FX_FLOAT y = pEntry->GetNumberAt(2);
- FX_FLOAT k = pEntry->GetNumberAt(3);
-
- FX_FLOAT r = 1.0f - std::min(1.0f, c + k);
- FX_FLOAT g = 1.0f - std::min(1.0f, m + k);
- FX_FLOAT b = 1.0f - std::min(1.0f, y + k);
+ float c = pEntry->GetNumberAt(0);
+ float m = pEntry->GetNumberAt(1);
+ float y = pEntry->GetNumberAt(2);
+ float k = pEntry->GetNumberAt(3);
+
+ float r = 1.0f - std::min(1.0f, c + k);
+ float g = 1.0f - std::min(1.0f, m + k);
+ float b = 1.0f - std::min(1.0f, y + k);
color = FXSYS_RGB((int)(r * 255), (int)(g * 255), (int)(b * 255));
diff --git a/chromium/third_party/pdfium/fpdfsdk/cpdfsdk_datetime.cpp b/chromium/third_party/pdfium/fpdfsdk/cpdfsdk_datetime.cpp
index 72f50a6b44b..e10a2234087 100644
--- a/chromium/third_party/pdfium/fpdfsdk/cpdfsdk_datetime.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/cpdfsdk_datetime.cpp
@@ -143,7 +143,7 @@ CPDFSDK_DateTime& CPDFSDK_DateTime::FromPDFDateTimeString(
int j = 0;
int k = 0;
- FX_CHAR ch;
+ char ch;
while (i < strLength && j < 4) {
ch = dtStr[i];
k = k * 10 + FXSYS_toDecimalDigit(ch);
diff --git a/chromium/third_party/pdfium/fpdfsdk/cpdfsdk_formfillenvironment.cpp b/chromium/third_party/pdfium/fpdfsdk/cpdfsdk_formfillenvironment.cpp
index 4ef766d9f86..6c6e3673e87 100644
--- a/chromium/third_party/pdfium/fpdfsdk/cpdfsdk_formfillenvironment.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/cpdfsdk_formfillenvironment.cpp
@@ -35,7 +35,7 @@ CPDFSDK_FormFillEnvironment::CPDFSDK_FormFillEnvironment(
FPDF_FORMFILLINFO* pFFinfo)
: m_pInfo(pFFinfo),
m_pUnderlyingDoc(pDoc),
- m_pSysHandler(new CFX_SystemHandler(this)),
+ m_pSysHandler(pdfium::MakeUnique<CFX_SystemHandler>(this)),
m_bChangeMask(false),
m_bBeingDestroyed(false) {}
@@ -60,8 +60,8 @@ CPDFSDK_FormFillEnvironment::~CPDFSDK_FormFillEnvironment() {
m_pInfo->Release(m_pInfo);
}
-int CPDFSDK_FormFillEnvironment::JS_appAlert(const FX_WCHAR* Msg,
- const FX_WCHAR* Title,
+int CPDFSDK_FormFillEnvironment::JS_appAlert(const wchar_t* Msg,
+ const wchar_t* Title,
uint32_t Type,
uint32_t Icon) {
if (!m_pInfo || !m_pInfo->m_pJsPlatform ||
@@ -75,10 +75,10 @@ int CPDFSDK_FormFillEnvironment::JS_appAlert(const FX_WCHAR* Msg,
AsFPDFWideString(&bsTitle), Type, Icon);
}
-int CPDFSDK_FormFillEnvironment::JS_appResponse(const FX_WCHAR* Question,
- const FX_WCHAR* Title,
- const FX_WCHAR* Default,
- const FX_WCHAR* cLabel,
+int CPDFSDK_FormFillEnvironment::JS_appResponse(const wchar_t* Question,
+ const wchar_t* Title,
+ const wchar_t* Default,
+ const wchar_t* cLabel,
FPDF_BOOL bPassword,
void* response,
int length) {
@@ -146,7 +146,7 @@ CFX_WideString CPDFSDK_FormFillEnvironment::JS_docGetFilePath() {
void CPDFSDK_FormFillEnvironment::JS_docSubmitForm(void* formData,
int length,
- const FX_WCHAR* URL) {
+ const wchar_t* URL) {
if (!m_pInfo || !m_pInfo->m_pJsPlatform ||
!m_pInfo->m_pJsPlatform->Doc_submitForm) {
return;
@@ -160,11 +160,11 @@ void CPDFSDK_FormFillEnvironment::JS_docSubmitForm(void* formData,
void CPDFSDK_FormFillEnvironment::JS_docmailForm(void* mailData,
int length,
FPDF_BOOL bUI,
- const FX_WCHAR* To,
- const FX_WCHAR* Subject,
- const FX_WCHAR* CC,
- const FX_WCHAR* BCC,
- const FX_WCHAR* Msg) {
+ const wchar_t* To,
+ const wchar_t* Subject,
+ const wchar_t* CC,
+ const wchar_t* BCC,
+ const wchar_t* Msg) {
if (!m_pInfo || !m_pInfo->m_pJsPlatform ||
!m_pInfo->m_pJsPlatform->Doc_mail) {
return;
@@ -313,8 +313,7 @@ FPDF_PAGE CPDFSDK_FormFillEnvironment::GetCurrentPage(FPDF_DOCUMENT document) {
return nullptr;
}
-void CPDFSDK_FormFillEnvironment::ExecuteNamedAction(
- const FX_CHAR* namedAction) {
+void CPDFSDK_FormFillEnvironment::ExecuteNamedAction(const char* namedAction) {
if (m_pInfo && m_pInfo->FFI_ExecuteNamedAction)
m_pInfo->FFI_ExecuteNamedAction(m_pInfo, namedAction);
}
@@ -327,7 +326,7 @@ void CPDFSDK_FormFillEnvironment::OnSetFieldInputFocus(
m_pInfo->FFI_SetTextFieldFocus(m_pInfo, focusText, nTextLen, bFocus);
}
-void CPDFSDK_FormFillEnvironment::DoURIAction(const FX_CHAR* bsURI) {
+void CPDFSDK_FormFillEnvironment::DoURIAction(const char* bsURI) {
if (m_pInfo && m_pInfo->FFI_DoURIAction)
m_pInfo->FFI_DoURIAction(m_pInfo, bsURI);
}
@@ -462,7 +461,7 @@ FPDF_FILEHANDLER* CPDFSDK_FormFillEnvironment::OpenFile(int fileType,
}
CFX_RetainPtr<IFX_SeekableReadStream>
-CPDFSDK_FormFillEnvironment::DownloadFromURL(const FX_WCHAR* url) {
+CPDFSDK_FormFillEnvironment::DownloadFromURL(const wchar_t* url) {
if (!m_pInfo || !m_pInfo->FFI_DownloadFromURL)
return nullptr;
@@ -475,11 +474,11 @@ CPDFSDK_FormFillEnvironment::DownloadFromURL(const FX_WCHAR* url) {
}
CFX_WideString CPDFSDK_FormFillEnvironment::PostRequestURL(
- const FX_WCHAR* wsURL,
- const FX_WCHAR* wsData,
- const FX_WCHAR* wsContentType,
- const FX_WCHAR* wsEncode,
- const FX_WCHAR* wsHeader) {
+ const wchar_t* wsURL,
+ const wchar_t* wsData,
+ const wchar_t* wsContentType,
+ const wchar_t* wsEncode,
+ const wchar_t* wsHeader) {
if (!m_pInfo || !m_pInfo->FFI_PostRequestURL)
return L"";
@@ -513,9 +512,9 @@ CFX_WideString CPDFSDK_FormFillEnvironment::PostRequestURL(
return wsRet;
}
-FPDF_BOOL CPDFSDK_FormFillEnvironment::PutRequestURL(const FX_WCHAR* wsURL,
- const FX_WCHAR* wsData,
- const FX_WCHAR* wsEncode) {
+FPDF_BOOL CPDFSDK_FormFillEnvironment::PutRequestURL(const wchar_t* wsURL,
+ const wchar_t* wsData,
+ const wchar_t* wsEncode) {
if (!m_pInfo || !m_pInfo->FFI_PutRequestURL)
return false;
@@ -610,7 +609,7 @@ void CPDFSDK_FormFillEnvironment::ProcJavascriptFun() {
return;
for (int i = 0; i < iCount; i++) {
CFX_ByteString csJSName;
- CPDF_Action jsAction = docJS.GetJSAction(i, csJSName);
+ CPDF_Action jsAction = docJS.GetJSActionAndName(i, &csJSName);
if (GetActionHander()) {
GetActionHander()->DoAction_JavaScript(
jsAction, CFX_WideString::FromLocal(csJSName.AsStringC()), this);
diff --git a/chromium/third_party/pdfium/fpdfsdk/cpdfsdk_formfillenvironment.h b/chromium/third_party/pdfium/fpdfsdk/cpdfsdk_formfillenvironment.h
index eead8734f11..5aead041912 100644
--- a/chromium/third_party/pdfium/fpdfsdk/cpdfsdk_formfillenvironment.h
+++ b/chromium/third_party/pdfium/fpdfsdk/cpdfsdk_formfillenvironment.h
@@ -84,11 +84,11 @@ class CPDFSDK_FormFillEnvironment
FPDF_PAGE GetPage(FPDF_DOCUMENT document, int nPageIndex);
FPDF_PAGE GetCurrentPage(FPDF_DOCUMENT document);
- void ExecuteNamedAction(const FX_CHAR* namedAction);
+ void ExecuteNamedAction(const char* namedAction);
void OnSetFieldInputFocus(FPDF_WIDESTRING focusText,
FPDF_DWORD nTextLen,
bool bFocus);
- void DoURIAction(const FX_CHAR* bsURI);
+ void DoURIAction(const char* bsURI);
void DoGoToAction(int nPageIndex,
int zoomMode,
float* fPosArray,
@@ -141,15 +141,15 @@ class CPDFSDK_FormFillEnvironment
FPDF_FILEHANDLER* OpenFile(int fileType,
FPDF_WIDESTRING wsURL,
const char* mode);
- CFX_RetainPtr<IFX_SeekableReadStream> DownloadFromURL(const FX_WCHAR* url);
- CFX_WideString PostRequestURL(const FX_WCHAR* wsURL,
- const FX_WCHAR* wsData,
- const FX_WCHAR* wsContentType,
- const FX_WCHAR* wsEncode,
- const FX_WCHAR* wsHeader);
- FPDF_BOOL PutRequestURL(const FX_WCHAR* wsURL,
- const FX_WCHAR* wsData,
- const FX_WCHAR* wsEncode);
+ CFX_RetainPtr<IFX_SeekableReadStream> DownloadFromURL(const wchar_t* url);
+ CFX_WideString PostRequestURL(const wchar_t* wsURL,
+ const wchar_t* wsData,
+ const wchar_t* wsContentType,
+ const wchar_t* wsEncode,
+ const wchar_t* wsHeader);
+ FPDF_BOOL PutRequestURL(const wchar_t* wsURL,
+ const wchar_t* wsData,
+ const wchar_t* wsEncode);
CFX_WideString GetLanguage();
void PageEvent(int iPageCount, uint32_t dwEventType) const;
@@ -157,29 +157,29 @@ class CPDFSDK_FormFillEnvironment
CPDF_Document* GetPDFDocument() const { return m_pUnderlyingDoc; }
#endif // PDF_ENABLE_XFA
- int JS_appAlert(const FX_WCHAR* Msg,
- const FX_WCHAR* Title,
+ int JS_appAlert(const wchar_t* Msg,
+ const wchar_t* Title,
uint32_t Type,
uint32_t Icon);
- int JS_appResponse(const FX_WCHAR* Question,
- const FX_WCHAR* Title,
- const FX_WCHAR* Default,
- const FX_WCHAR* cLabel,
+ int JS_appResponse(const wchar_t* Question,
+ const wchar_t* Title,
+ const wchar_t* Default,
+ const wchar_t* cLabel,
FPDF_BOOL bPassword,
void* response,
int length);
void JS_appBeep(int nType);
CFX_WideString JS_fieldBrowse();
CFX_WideString JS_docGetFilePath();
- void JS_docSubmitForm(void* formData, int length, const FX_WCHAR* URL);
+ void JS_docSubmitForm(void* formData, int length, const wchar_t* URL);
void JS_docmailForm(void* mailData,
int length,
FPDF_BOOL bUI,
- const FX_WCHAR* To,
- const FX_WCHAR* Subject,
- const FX_WCHAR* CC,
- const FX_WCHAR* BCC,
- const FX_WCHAR* Msg);
+ const wchar_t* To,
+ const wchar_t* Subject,
+ const wchar_t* CC,
+ const wchar_t* BCC,
+ const wchar_t* Msg);
void JS_docprint(FPDF_BOOL bUI,
int nStart,
int nEnd,
diff --git a/chromium/third_party/pdfium/fpdfsdk/cpdfsdk_interform.cpp b/chromium/third_party/pdfium/fpdfsdk/cpdfsdk_interform.cpp
index 4ebcf8a2f3d..b44002cef88 100644
--- a/chromium/third_party/pdfium/fpdfsdk/cpdfsdk_interform.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/cpdfsdk_interform.cpp
@@ -40,14 +40,15 @@
#include "fpdfsdk/fpdfxfa/cpdfxfa_context.h"
#include "fpdfsdk/fpdfxfa/cxfa_fwladaptertimermgr.h"
#include "xfa/fxfa/cxfa_eventparam.h"
-#include "xfa/fxfa/xfa_ffdocview.h"
-#include "xfa/fxfa/xfa_ffwidget.h"
-#include "xfa/fxfa/xfa_ffwidgethandler.h"
+#include "xfa/fxfa/cxfa_ffdocview.h"
+#include "xfa/fxfa/cxfa_ffwidget.h"
+#include "xfa/fxfa/cxfa_ffwidgethandler.h"
#endif // PDF_ENABLE_XFA
CPDFSDK_InterForm::CPDFSDK_InterForm(CPDFSDK_FormFillEnvironment* pFormFillEnv)
: m_pFormFillEnv(pFormFillEnv),
- m_pInterForm(new CPDF_InterForm(m_pFormFillEnv->GetPDFDocument())),
+ m_pInterForm(
+ pdfium::MakeUnique<CPDF_InterForm>(m_pFormFillEnv->GetPDFDocument())),
#ifdef PDF_ENABLE_XFA
m_bXfaCalculate(true),
m_bXfaValidationsEnabled(true),
@@ -73,8 +74,8 @@ bool CPDFSDK_InterForm::HighlightWidgets() {
CPDFSDK_Widget* CPDFSDK_InterForm::GetSibling(CPDFSDK_Widget* pWidget,
bool bNext) const {
- std::unique_ptr<CBA_AnnotIterator> pIterator(new CBA_AnnotIterator(
- pWidget->GetPageView(), CPDF_Annot::Subtype::WIDGET));
+ auto pIterator = pdfium::MakeUnique<CBA_AnnotIterator>(
+ pWidget->GetPageView(), CPDF_Annot::Subtype::WIDGET);
if (bNext)
return static_cast<CPDFSDK_Widget*>(pIterator->GetNextAnnot(pWidget));
@@ -321,7 +322,7 @@ void CPDFSDK_InterForm::ResetFieldAppearance(CPDF_FormField* pFormField,
}
void CPDFSDK_InterForm::UpdateField(CPDF_FormField* pFormField) {
- auto formfiller = m_pFormFillEnv->GetInteractiveFormFiller();
+ auto* formfiller = m_pFormFillEnv->GetInteractiveFormFiller();
for (int i = 0, sz = pFormField->CountControls(); i < sz; i++) {
CPDF_FormControl* pFormCtrl = pFormField->GetControl(i);
ASSERT(pFormCtrl);
@@ -493,7 +494,7 @@ bool CPDFSDK_InterForm::FDFToURLEncodedData(uint8_t*& pBuf,
nBufSize = fdfEncodedData.GetLength();
pBuf = FX_Alloc(uint8_t, nBufSize);
- FXSYS_memcpy(pBuf, fdfEncodedData.GetBuffer(), nBufSize);
+ memcpy(pBuf, fdfEncodedData.GetBuffer(), nBufSize);
return true;
}
diff --git a/chromium/third_party/pdfium/fpdfsdk/cpdfsdk_pageview.cpp b/chromium/third_party/pdfium/fpdfsdk/cpdfsdk_pageview.cpp
index c67948da906..946dd84163d 100644
--- a/chromium/third_party/pdfium/fpdfsdk/cpdfsdk_pageview.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/cpdfsdk_pageview.cpp
@@ -22,10 +22,10 @@
#ifdef PDF_ENABLE_XFA
#include "fpdfsdk/fpdfxfa/cpdfxfa_page.h"
-#include "xfa/fxfa/xfa_ffdocview.h"
-#include "xfa/fxfa/xfa_ffpageview.h"
-#include "xfa/fxfa/xfa_ffwidgethandler.h"
-#include "xfa/fxfa/xfa_rendercontext.h"
+#include "xfa/fxfa/cxfa_ffdocview.h"
+#include "xfa/fxfa/cxfa_ffpageview.h"
+#include "xfa/fxfa/cxfa_ffwidgethandler.h"
+#include "xfa/fxfa/cxfa_rendercontext.h"
#include "xfa/fxgraphics/cfx_graphics.h"
#endif // PDF_ENABLE_XFA
@@ -94,14 +94,13 @@ void CPDFSDK_PageView::PageView_OnDraw(CFX_RenderDevice* pDevice,
if (!pPage)
return;
- if (pPage->GetContext()->GetDocType() == DOCTYPE_DYNAMIC_XFA) {
+ if (pPage->GetContext()->GetDocType() == XFA_DocType::Dynamic) {
CFX_Graphics gs(pDevice);
- CFX_RectF rectClip(static_cast<FX_FLOAT>(pClip.left),
- static_cast<FX_FLOAT>(pClip.top),
- static_cast<FX_FLOAT>(pClip.Width()),
- static_cast<FX_FLOAT>(pClip.Height()));
+ CFX_RectF rectClip(
+ static_cast<float>(pClip.left), static_cast<float>(pClip.top),
+ static_cast<float>(pClip.Width()), static_cast<float>(pClip.Height()));
gs.SetClipRect(rectClip);
- std::unique_ptr<CXFA_RenderContext> pRenderContext(new CXFA_RenderContext);
+ auto pRenderContext = pdfium::MakeUnique<CXFA_RenderContext>();
CXFA_RenderOptions renderOptions;
renderOptions.m_bHighlight = true;
CXFA_FFPageView* xfaView = pPage->GetXFAPageView();
@@ -182,9 +181,10 @@ bool CPDFSDK_PageView::DeleteAnnot(CPDFSDK_Annot* pAnnot) {
if (!pAnnot)
return false;
CPDFXFA_Page* pPage = pAnnot->GetPDFXFAPage();
- if (!pPage || (pPage->GetContext()->GetDocType() != DOCTYPE_STATIC_XFA &&
- pPage->GetContext()->GetDocType() != DOCTYPE_DYNAMIC_XFA))
+ if (!pPage || (pPage->GetContext()->GetDocType() != XFA_DocType::Static &&
+ pPage->GetContext()->GetDocType() != XFA_DocType::Dynamic)) {
return false;
+ }
if (GetFocusAnnot() == pAnnot)
m_pFormFillEnv->KillFocusAnnot(0);
@@ -384,7 +384,7 @@ void CPDFSDK_PageView::LoadFXAnnots() {
#ifdef PDF_ENABLE_XFA
CFX_RetainPtr<CPDFXFA_Page> protector(m_page);
- if (m_pFormFillEnv->GetXFAContext()->GetDocType() == DOCTYPE_DYNAMIC_XFA) {
+ if (m_pFormFillEnv->GetXFAContext()->GetDocType() == XFA_DocType::Dynamic) {
CXFA_FFPageView* pageView = m_page->GetXFAPageView();
std::unique_ptr<IXFA_WidgetIterator> pWidgetHander(
pageView->CreateWidgetIterator(
@@ -445,14 +445,13 @@ int CPDFSDK_PageView::GetPageIndex() const {
return -1;
#ifdef PDF_ENABLE_XFA
- int nDocType = m_page->GetContext()->GetDocType();
- switch (nDocType) {
- case DOCTYPE_DYNAMIC_XFA: {
+ switch (m_page->GetContext()->GetDocType()) {
+ case XFA_DocType::Dynamic: {
CXFA_FFPageView* pPageView = m_page->GetXFAPageView();
return pPageView ? pPageView->GetPageIndex() : -1;
}
- case DOCTYPE_STATIC_XFA:
- case DOCTYPE_PDF:
+ case XFA_DocType::Static:
+ case XFA_DocType::PDF:
return GetPageIndexForStaticPDF();
default:
return -1;
diff --git a/chromium/third_party/pdfium/fpdfsdk/cpdfsdk_widget.cpp b/chromium/third_party/pdfium/fpdfsdk/cpdfsdk_widget.cpp
index cd86f7a0b5d..5f0bf1dc17d 100644
--- a/chromium/third_party/pdfium/fpdfsdk/cpdfsdk_widget.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/cpdfsdk_widget.cpp
@@ -35,10 +35,10 @@
#ifdef PDF_ENABLE_XFA
#include "fpdfsdk/fpdfxfa/cpdfxfa_context.h"
#include "xfa/fxfa/cxfa_eventparam.h"
-#include "xfa/fxfa/fxfa_widget.h"
-#include "xfa/fxfa/xfa_ffdocview.h"
-#include "xfa/fxfa/xfa_ffwidget.h"
-#include "xfa/fxfa/xfa_ffwidgethandler.h"
+#include "xfa/fxfa/cxfa_ffdocview.h"
+#include "xfa/fxfa/cxfa_ffwidget.h"
+#include "xfa/fxfa/cxfa_ffwidgethandler.h"
+#include "xfa/fxfa/cxfa_widgetacc.h"
#endif // PDF_ENABLE_XFA
namespace {
@@ -72,7 +72,7 @@ CPDFSDK_Widget::~CPDFSDK_Widget() {}
#ifdef PDF_ENABLE_XFA
CXFA_FFWidget* CPDFSDK_Widget::GetMixXFAWidget() const {
CPDFXFA_Context* pContext = m_pPageView->GetFormFillEnv()->GetXFAContext();
- if (pContext->GetDocType() == DOCTYPE_STATIC_XFA) {
+ if (pContext->GetDocType() == XFA_DocType::Static) {
if (!m_hMixXFAWidget) {
if (CXFA_FFDocView* pDocView = pContext->GetXFADocView()) {
CFX_WideString sName;
@@ -96,28 +96,27 @@ CXFA_FFWidget* CPDFSDK_Widget::GetMixXFAWidget() const {
CXFA_FFWidget* CPDFSDK_Widget::GetGroupMixXFAWidget() {
CPDFXFA_Context* pContext = m_pPageView->GetFormFillEnv()->GetXFAContext();
- if (pContext->GetDocType() == DOCTYPE_STATIC_XFA) {
- if (CXFA_FFDocView* pDocView = pContext->GetXFADocView()) {
- CFX_WideString sName = GetName();
- if (!sName.IsEmpty())
- return pDocView->GetWidgetByName(sName, nullptr);
- }
- }
+ if (pContext->GetDocType() != XFA_DocType::Static)
+ return nullptr;
- return nullptr;
+ CXFA_FFDocView* pDocView = pContext->GetXFADocView();
+ if (!pDocView)
+ return nullptr;
+
+ CFX_WideString sName = GetName();
+ return !sName.IsEmpty() ? pDocView->GetWidgetByName(sName, nullptr) : nullptr;
}
CXFA_FFWidgetHandler* CPDFSDK_Widget::GetXFAWidgetHandler() const {
CPDFXFA_Context* pContext = m_pPageView->GetFormFillEnv()->GetXFAContext();
- if (pContext->GetDocType() == DOCTYPE_STATIC_XFA) {
- if (!m_pWidgetHandler) {
- if (CXFA_FFDocView* pDocView = pContext->GetXFADocView())
- m_pWidgetHandler = pDocView->GetWidgetHandler();
- }
- return m_pWidgetHandler;
- }
+ if (pContext->GetDocType() != XFA_DocType::Static)
+ return nullptr;
- return nullptr;
+ if (!m_pWidgetHandler) {
+ if (CXFA_FFDocView* pDocView = pContext->GetXFADocView())
+ m_pWidgetHandler = pDocView->GetWidgetHandler();
+ }
+ return m_pWidgetHandler;
}
static XFA_EVENTTYPE GetXFAEventType(PDFSDK_XFAAActionType eXFAAAT) {
@@ -302,7 +301,7 @@ void CPDFSDK_Widget::Synchronize(bool bSynchronizeElse) {
for (int i = 0, sz = pFormField->CountSelectedItems(); i < sz; i++) {
int nIndex = pFormField->GetSelectedIndex(i);
- if (nIndex > -1 && nIndex < pWidgetAcc->CountChoiceListItems())
+ if (nIndex > -1 && nIndex < pWidgetAcc->CountChoiceListItems(false))
pWidgetAcc->SetItemState(nIndex, true, false, false, true);
}
break;
@@ -312,7 +311,7 @@ void CPDFSDK_Widget::Synchronize(bool bSynchronizeElse) {
for (int i = 0, sz = pFormField->CountSelectedItems(); i < sz; i++) {
int nIndex = pFormField->GetSelectedIndex(i);
- if (nIndex > -1 && nIndex < pWidgetAcc->CountChoiceListItems())
+ if (nIndex > -1 && nIndex < pWidgetAcc->CountChoiceListItems(false))
pWidgetAcc->SetItemState(nIndex, true, false, false, true);
}
pWidgetAcc->SetValue(pFormField->GetValue(), XFA_VALUEPICTURE_Edit);
@@ -431,9 +430,10 @@ void CPDFSDK_Widget::SynchronizeXFAItems(CXFA_FFDocView* pXFADocView,
pFormField->ClearOptions(true);
if (CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc()) {
- for (int i = 0, sz = pWidgetAcc->CountChoiceListItems(); i < sz; i++) {
+ for (int i = 0, sz = pWidgetAcc->CountChoiceListItems(false); i < sz;
+ i++) {
CFX_WideString swText;
- pWidgetAcc->GetChoiceListItem(swText, i);
+ pWidgetAcc->GetChoiceListItem(swText, i, false);
pFormField->InsertOption(swText, i, true);
}
@@ -445,9 +445,10 @@ void CPDFSDK_Widget::SynchronizeXFAItems(CXFA_FFDocView* pXFADocView,
pFormField->ClearOptions(false);
if (CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc()) {
- for (int i = 0, sz = pWidgetAcc->CountChoiceListItems(); i < sz; i++) {
+ for (int i = 0, sz = pWidgetAcc->CountChoiceListItems(false); i < sz;
+ i++) {
CFX_WideString swText;
- pWidgetAcc->GetChoiceListItem(swText, i);
+ pWidgetAcc->GetChoiceListItem(swText, i, false);
pFormField->InsertOption(swText, i, false);
}
@@ -466,7 +467,7 @@ bool CPDFSDK_Widget::IsWidgetAppearanceValid(CPDF_Annot::AppearanceMode mode) {
return false;
// Choose the right sub-ap
- const FX_CHAR* ap_entry = "N";
+ const char* ap_entry = "N";
if (mode == CPDF_Annot::Down)
ap_entry = "D";
else if (mode == CPDF_Annot::Rollover)
@@ -505,8 +506,8 @@ int CPDFSDK_Widget::GetFieldType() const {
bool CPDFSDK_Widget::IsAppearanceValid() {
#ifdef PDF_ENABLE_XFA
CPDFXFA_Context* pContext = m_pPageView->GetFormFillEnv()->GetXFAContext();
- int nDocType = pContext->GetDocType();
- if (nDocType != DOCTYPE_PDF && nDocType != DOCTYPE_STATIC_XFA)
+ XFA_DocType nDocType = pContext->GetDocType();
+ if (nDocType != XFA_DocType::PDF && nDocType != XFA_DocType::Static)
return true;
#endif // PDF_ENABLE_XFA
return CPDFSDK_BAAnnot::IsAppearanceValid();
@@ -584,13 +585,11 @@ bool CPDFSDK_Widget::GetTextColor(FX_COLORREF& color) const {
return iColorType != COLORTYPE_TRANSPARENT;
}
-FX_FLOAT CPDFSDK_Widget::GetFontSize() const {
+float CPDFSDK_Widget::GetFontSize() const {
CPDF_FormControl* pFormCtrl = GetFormControl();
CPDF_DefaultAppearance pDa = pFormCtrl->GetDefaultAppearance();
- CFX_ByteString csFont = "";
- FX_FLOAT fFontSize = 0.0f;
- pDa.GetFont(csFont, fFontSize);
-
+ float fFontSize;
+ pDa.GetFont(&fFontSize);
return fFontSize;
}
@@ -643,7 +642,7 @@ bool CPDFSDK_Widget::IsOptionSelected(int nIndex) const {
#ifdef PDF_ENABLE_XFA
if (CXFA_FFWidget* hWidget = GetMixXFAWidget()) {
if (CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc()) {
- if (nIndex > -1 && nIndex < pWidgetAcc->CountChoiceListItems())
+ if (nIndex > -1 && nIndex < pWidgetAcc->CountChoiceListItems(false))
return pWidgetAcc->GetItemState(nIndex);
return false;
@@ -892,7 +891,7 @@ void CPDFSDK_Widget::ResetAppearance_PushButton() {
CPWL_Color crBackground;
CPWL_Color crBorder;
int iColorType;
- FX_FLOAT fc[4];
+ float fc[4];
pControl->GetOriginalBackgroundColor(iColorType, fc);
if (iColorType > 0)
crBackground = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]);
@@ -901,7 +900,7 @@ void CPDFSDK_Widget::ResetAppearance_PushButton() {
if (iColorType > 0)
crBorder = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]);
- FX_FLOAT fBorderWidth = (FX_FLOAT)GetBorderWidth();
+ float fBorderWidth = (float)GetBorderWidth();
CPWL_Dash dsBorder(3, 0, 0);
CPWL_Color crLeftTop;
CPWL_Color crRightBottom;
@@ -929,21 +928,20 @@ void CPDFSDK_Widget::ResetAppearance_PushButton() {
CPWL_Color crText(COLORTYPE_GRAY, 0);
- FX_FLOAT fFontSize = 12.0f;
CFX_ByteString csNameTag;
-
CPDF_DefaultAppearance da = pControl->GetDefaultAppearance();
if (da.HasColor()) {
da.GetColor(iColorType, fc);
crText = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]);
}
-
+ float fFontSize = 12.0f;
if (da.HasFont())
- da.GetFont(csNameTag, fFontSize);
+ csNameTag = da.GetFont(&fFontSize);
CFX_WideString csWCaption;
- CFX_WideString csNormalCaption, csRolloverCaption, csDownCaption;
-
+ CFX_WideString csNormalCaption;
+ CFX_WideString csRolloverCaption;
+ CFX_WideString csDownCaption;
if (pControl->HasMKEntry("CA"))
csNormalCaption = pControl->GetNormalCaption();
@@ -956,7 +954,6 @@ void CPDFSDK_Widget::ResetAppearance_PushButton() {
CPDF_Stream* pNormalIcon = nullptr;
CPDF_Stream* pRolloverIcon = nullptr;
CPDF_Stream* pDownIcon = nullptr;
-
if (pControl->HasMKEntry("I"))
pNormalIcon = pControl->GetNormalIcon();
@@ -1071,7 +1068,7 @@ void CPDFSDK_Widget::ResetAppearance_CheckBox() {
CPDF_FormControl* pControl = GetFormControl();
CPWL_Color crBackground, crBorder, crText;
int iColorType;
- FX_FLOAT fc[4];
+ float fc[4];
pControl->GetOriginalBackgroundColor(iColorType, fc);
if (iColorType > 0)
@@ -1081,7 +1078,7 @@ void CPDFSDK_Widget::ResetAppearance_CheckBox() {
if (iColorType > 0)
crBorder = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]);
- FX_FLOAT fBorderWidth = (FX_FLOAT)GetBorderWidth();
+ float fBorderWidth = (float)GetBorderWidth();
CPWL_Dash dsBorder(3, 0, 0);
CPWL_Color crLeftTop, crRightBottom;
@@ -1191,7 +1188,7 @@ void CPDFSDK_Widget::ResetAppearance_RadioButton() {
CPDF_FormControl* pControl = GetFormControl();
CPWL_Color crBackground, crBorder, crText;
int iColorType;
- FX_FLOAT fc[4];
+ float fc[4];
pControl->GetOriginalBackgroundColor(iColorType, fc);
if (iColorType > 0)
@@ -1201,7 +1198,7 @@ void CPDFSDK_Widget::ResetAppearance_RadioButton() {
if (iColorType > 0)
crBorder = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]);
- FX_FLOAT fBorderWidth = (FX_FLOAT)GetBorderWidth();
+ float fBorderWidth = (float)GetBorderWidth();
CPWL_Dash dsBorder(3, 0, 0);
CPWL_Color crLeftTop;
CPWL_Color crRightBottom;
@@ -1356,7 +1353,7 @@ void CPDFSDK_Widget::ResetAppearance_ComboBox(const CFX_WideString* sValue) {
rcButton.left = rcButton.right - 13;
rcButton.Normalize();
- std::unique_ptr<CFX_Edit> pEdit(new CFX_Edit);
+ auto pEdit = pdfium::MakeUnique<CFX_Edit>();
pEdit->EnableRefresh(false);
CBA_FontMap font_map(this, m_pInterForm->GetFormFillEnv()->GetSysHandler());
@@ -1369,7 +1366,7 @@ void CPDFSDK_Widget::ResetAppearance_ComboBox(const CFX_WideString* sValue) {
pEdit->SetPlateRect(rcEdit);
pEdit->SetAlignmentV(1, true);
- FX_FLOAT fFontSize = GetFontSize();
+ float fFontSize = GetFontSize();
if (IsFloatZero(fFontSize))
pEdit->SetAutoFontSize(true, true);
else
@@ -1420,7 +1417,7 @@ void CPDFSDK_Widget::ResetAppearance_ListBox() {
CFX_FloatRect rcClient = GetClientRect();
CFX_ByteTextBuf sBody, sLines;
- std::unique_ptr<CFX_Edit> pEdit(new CFX_Edit);
+ auto pEdit = pdfium::MakeUnique<CFX_Edit>();
pEdit->EnableRefresh(false);
CBA_FontMap font_map(this, m_pInterForm->GetFormFillEnv()->GetSysHandler());
@@ -1428,14 +1425,14 @@ void CPDFSDK_Widget::ResetAppearance_ListBox() {
pEdit->SetPlateRect(CFX_FloatRect(rcClient.left, 0.0f, rcClient.right, 0.0f));
- FX_FLOAT fFontSize = GetFontSize();
+ float fFontSize = GetFontSize();
pEdit->SetFontSize(IsFloatZero(fFontSize) ? 12.0f : fFontSize);
pEdit->Initialize();
CFX_ByteTextBuf sList;
- FX_FLOAT fy = rcClient.top;
+ float fy = rcClient.top;
int32_t nTop = pField->GetTopVisibleIndex();
int32_t nCount = pField->CountOptions();
@@ -1453,7 +1450,7 @@ void CPDFSDK_Widget::ResetAppearance_ListBox() {
pEdit->SetText(pField->GetOptionLabel(i));
CFX_FloatRect rcContent = pEdit->GetContentRect();
- FX_FLOAT fItemHeight = rcContent.Height();
+ float fItemHeight = rcContent.Height();
if (bSelected) {
CFX_FloatRect rcItem =
@@ -1502,7 +1499,7 @@ void CPDFSDK_Widget::ResetAppearance_TextField(const CFX_WideString* sValue) {
CPDF_FormField* pField = pControl->GetField();
CFX_ByteTextBuf sBody, sLines;
- std::unique_ptr<CFX_Edit> pEdit(new CFX_Edit);
+ auto pEdit = pdfium::MakeUnique<CFX_Edit>();
pEdit->EnableRefresh(false);
CBA_FontMap font_map(this, m_pInterForm->GetFormFillEnv()->GetSysHandler());
@@ -1530,7 +1527,7 @@ void CPDFSDK_Widget::ResetAppearance_TextField(const CFX_WideString* sValue) {
int nMaxLen = pField->GetMaxLen();
bool bCharArray = (dwFieldFlags >> 24) & 1;
- FX_FLOAT fFontSize = GetFontSize();
+ float fFontSize = GetFontSize();
#ifdef PDF_ENABLE_XFA
CFX_WideString sValueTmp;
@@ -1642,7 +1639,7 @@ void CPDFSDK_Widget::ResetAppearance_TextField(const CFX_WideString* sValue) {
CFX_FloatRect CPDFSDK_Widget::GetClientRect() const {
CFX_FloatRect rcWindow = GetRotatedRect();
- FX_FLOAT fBorderWidth = (FX_FLOAT)GetBorderWidth();
+ float fBorderWidth = (float)GetBorderWidth();
switch (GetBorderStyle()) {
case BorderStyle::BEVELED:
case BorderStyle::INSET:
@@ -1657,8 +1654,8 @@ CFX_FloatRect CPDFSDK_Widget::GetClientRect() const {
CFX_FloatRect CPDFSDK_Widget::GetRotatedRect() const {
CFX_FloatRect rectAnnot = GetRect();
- FX_FLOAT fWidth = rectAnnot.right - rectAnnot.left;
- FX_FLOAT fHeight = rectAnnot.top - rectAnnot.bottom;
+ float fWidth = rectAnnot.right - rectAnnot.left;
+ float fHeight = rectAnnot.top - rectAnnot.bottom;
CPDF_FormControl* pControl = GetFormControl();
CFX_FloatRect rcPDFWindow;
@@ -1691,7 +1688,7 @@ CFX_ByteString CPDFSDK_Widget::GetBorderAppStream() const {
CPWL_Color crBackground = GetFillPWLColor();
CPWL_Color crLeftTop, crRightBottom;
- FX_FLOAT fBorderWidth = (FX_FLOAT)GetBorderWidth();
+ float fBorderWidth = (float)GetBorderWidth();
CPWL_Dash dsBorder(3, 0, 0);
BorderStyle nBorderStyle = GetBorderStyle();
@@ -1722,8 +1719,8 @@ CFX_Matrix CPDFSDK_Widget::GetMatrix() const {
CFX_Matrix mt;
CPDF_FormControl* pControl = GetFormControl();
CFX_FloatRect rcAnnot = GetRect();
- FX_FLOAT fWidth = rcAnnot.right - rcAnnot.left;
- FX_FLOAT fHeight = rcAnnot.top - rcAnnot.bottom;
+ float fWidth = rcAnnot.right - rcAnnot.left;
+ float fHeight = rcAnnot.top - rcAnnot.bottom;
switch (abs(pControl->GetRotation() % 360)) {
case 0:
@@ -1751,7 +1748,7 @@ CPWL_Color CPDFSDK_Widget::GetTextPWLColor() const {
CPDF_DefaultAppearance da = pFormCtrl->GetDefaultAppearance();
if (da.HasColor()) {
int32_t iColorType;
- FX_FLOAT fc[4];
+ float fc[4];
da.GetColor(iColorType, fc);
crText = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]);
}
@@ -1764,7 +1761,7 @@ CPWL_Color CPDFSDK_Widget::GetBorderPWLColor() const {
CPDF_FormControl* pFormCtrl = GetFormControl();
int32_t iColorType;
- FX_FLOAT fc[4];
+ float fc[4];
pFormCtrl->GetOriginalBorderColor(iColorType, fc);
if (iColorType > 0)
crBorder = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]);
@@ -1777,7 +1774,7 @@ CPWL_Color CPDFSDK_Widget::GetFillPWLColor() const {
CPDF_FormControl* pFormCtrl = GetFormControl();
int32_t iColorType;
- FX_FLOAT fc[4];
+ float fc[4];
pFormCtrl->GetOriginalBackgroundColor(iColorType, fc);
if (iColorType > 0)
crFill = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]);
diff --git a/chromium/third_party/pdfium/fpdfsdk/cpdfsdk_widget.h b/chromium/third_party/pdfium/fpdfsdk/cpdfsdk_widget.h
index 21e51697064..9f58cc1d613 100644
--- a/chromium/third_party/pdfium/fpdfsdk/cpdfsdk_widget.h
+++ b/chromium/third_party/pdfium/fpdfsdk/cpdfsdk_widget.h
@@ -77,7 +77,7 @@ class CPDFSDK_Widget : public CPDFSDK_BAAnnot {
bool GetFillColor(FX_COLORREF& color) const;
bool GetBorderColor(FX_COLORREF& color) const;
bool GetTextColor(FX_COLORREF& color) const;
- FX_FLOAT GetFontSize() const;
+ float GetFontSize() const;
int GetSelectedIndex(int nIndex) const;
#ifndef PDF_ENABLE_XFA
diff --git a/chromium/third_party/pdfium/fpdfsdk/cpdfsdk_widgethandler.cpp b/chromium/third_party/pdfium/fpdfsdk/cpdfsdk_widgethandler.cpp
index e85d24c4e0b..cab210db428 100644
--- a/chromium/third_party/pdfium/fpdfsdk/cpdfsdk_widgethandler.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/cpdfsdk_widgethandler.cpp
@@ -238,7 +238,7 @@ void CPDFSDK_WidgetHandler::OnLoad(CPDFSDK_Annot* pAnnot) {
#ifdef PDF_ENABLE_XFA
CPDFSDK_PageView* pPageView = pAnnot->GetPageView();
CPDFXFA_Context* pContext = pPageView->GetFormFillEnv()->GetXFAContext();
- if (pContext->GetDocType() == DOCTYPE_STATIC_XFA) {
+ if (pContext->GetDocType() == XFA_DocType::Static) {
if (!pWidget->IsAppearanceValid() && !pWidget->GetValue().IsEmpty())
pWidget->ResetAppearance(false);
}
diff --git a/chromium/third_party/pdfium/fpdfsdk/cpdfsdk_xfawidget.cpp b/chromium/third_party/pdfium/fpdfsdk/cpdfsdk_xfawidget.cpp
index b30e5f3ac2e..902ff2a2e8d 100644
--- a/chromium/third_party/pdfium/fpdfsdk/cpdfsdk_xfawidget.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/cpdfsdk_xfawidget.cpp
@@ -7,7 +7,7 @@
#include "fpdfsdk/cpdfsdk_xfawidget.h"
#include "fpdfsdk/ipdfsdk_annothandler.h"
-#include "xfa/fxfa/xfa_ffwidget.h"
+#include "xfa/fxfa/cxfa_ffwidget.h"
CPDFSDK_XFAWidget::CPDFSDK_XFAWidget(CXFA_FFWidget* pAnnot,
CPDFSDK_PageView* pPageView,
diff --git a/chromium/third_party/pdfium/fpdfsdk/cpdfsdk_xfawidgethandler.cpp b/chromium/third_party/pdfium/fpdfsdk/cpdfsdk_xfawidgethandler.cpp
index 653eb8ae434..5e258bc4e56 100644
--- a/chromium/third_party/pdfium/fpdfsdk/cpdfsdk_xfawidgethandler.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/cpdfsdk_xfawidgethandler.cpp
@@ -15,11 +15,11 @@
#include "fpdfsdk/fpdfxfa/cpdfxfa_context.h"
#include "xfa/fwl/cfwl_app.h"
#include "xfa/fwl/fwl_widgethit.h"
+#include "xfa/fxfa/cxfa_ffdocview.h"
+#include "xfa/fxfa/cxfa_ffpageview.h"
+#include "xfa/fxfa/cxfa_ffwidget.h"
+#include "xfa/fxfa/cxfa_ffwidgethandler.h"
#include "xfa/fxfa/fxfa_basic.h"
-#include "xfa/fxfa/xfa_ffdocview.h"
-#include "xfa/fxfa/xfa_ffpageview.h"
-#include "xfa/fxfa/xfa_ffwidget.h"
-#include "xfa/fxfa/xfa_ffwidgethandler.h"
#include "xfa/fxgraphics/cfx_graphics.h"
CPDFSDK_XFAWidgetHandler::CPDFSDK_XFAWidgetHandler(
diff --git a/chromium/third_party/pdfium/fpdfsdk/formfiller/cba_fontmap.cpp b/chromium/third_party/pdfium/fpdfsdk/formfiller/cba_fontmap.cpp
index 750b41627e7..1c380e59c1b 100644
--- a/chromium/third_party/pdfium/fpdfsdk/formfiller/cba_fontmap.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/formfiller/cba_fontmap.cpp
@@ -45,7 +45,7 @@ void CBA_FontMap::Initialize() {
int32_t nCharset = FXFONT_DEFAULT_CHARSET;
if (!m_pDefaultFont) {
- m_pDefaultFont = GetAnnotDefaultFont(m_sDefaultFontName);
+ m_pDefaultFont = GetAnnotDefaultFont(&m_sDefaultFontName);
if (m_pDefaultFont) {
if (const CFX_SubstFont* pSubstFont = m_pDefaultFont->GetSubstFont()) {
nCharset = pSubstFont->m_Charset;
@@ -83,7 +83,7 @@ void CBA_FontMap::SetDefaultFont(CPDF_Font* pFont,
AddFontData(m_pDefaultFont, m_sDefaultFontName, nCharset);
}
-CPDF_Font* CBA_FontMap::FindFontSameCharset(CFX_ByteString& sFontAlias,
+CPDF_Font* CBA_FontMap::FindFontSameCharset(CFX_ByteString* sFontAlias,
int32_t nCharset) {
if (m_pAnnotDict->GetStringFor("Subtype") != "Widget")
return nullptr;
@@ -109,7 +109,7 @@ CPDF_Document* CBA_FontMap::GetDocument() {
}
CPDF_Font* CBA_FontMap::FindResFontSameCharset(CPDF_Dictionary* pResDict,
- CFX_ByteString& sFontAlias,
+ CFX_ByteString* sFontAlias,
int32_t nCharset) {
if (!pResDict)
return nullptr;
@@ -138,7 +138,7 @@ CPDF_Font* CBA_FontMap::FindResFontSameCharset(CPDF_Dictionary* pResDict,
if (!pSubst)
continue;
if (pSubst->m_Charset == nCharset) {
- sFontAlias = csKey;
+ *sFontAlias = csKey;
pFind = pFont;
}
}
@@ -194,7 +194,7 @@ void CBA_FontMap::AddFontToAnnotDict(CPDF_Font* pFont,
}
}
-CPDF_Font* CBA_FontMap::GetAnnotDefaultFont(CFX_ByteString& sAlias) {
+CPDF_Font* CBA_FontMap::GetAnnotDefaultFont(CFX_ByteString* sAlias) {
CPDF_Dictionary* pAcroFormDict = nullptr;
const bool bWidget = (m_pAnnotDict->GetStringFor("Subtype") == "Widget");
if (bWidget) {
@@ -218,27 +218,26 @@ CPDF_Font* CBA_FontMap::GetAnnotDefaultFont(CFX_ByteString& sAlias) {
CPDF_SimpleParser syntax(sDA.AsStringC());
syntax.FindTagParamFromStart("Tf", 2);
+
CFX_ByteString sFontName(syntax.GetWord());
- sAlias = PDF_NameDecode(sFontName).Mid(1);
- CPDF_Dictionary* pFontDict = nullptr;
+ *sAlias = PDF_NameDecode(sFontName).Mid(1);
+ CPDF_Dictionary* pFontDict = nullptr;
if (CPDF_Dictionary* pAPDict = m_pAnnotDict->GetDictFor("AP")) {
if (CPDF_Dictionary* pNormalDict = pAPDict->GetDictFor("N")) {
if (CPDF_Dictionary* pNormalResDict =
pNormalDict->GetDictFor("Resources")) {
if (CPDF_Dictionary* pResFontDict = pNormalResDict->GetDictFor("Font"))
- pFontDict = pResFontDict->GetDictFor(sAlias);
+ pFontDict = pResFontDict->GetDictFor(*sAlias);
}
}
}
-
if (bWidget && !pFontDict && pAcroFormDict) {
if (CPDF_Dictionary* pDRDict = pAcroFormDict->GetDictFor("DR")) {
if (CPDF_Dictionary* pDRFontDict = pDRDict->GetDictFor("Font"))
- pFontDict = pDRFontDict->GetDictFor(sAlias);
+ pFontDict = pDRFontDict->GetDictFor(*sAlias);
}
}
-
return pFontDict ? m_pDocument->LoadFont(pFontDict) : nullptr;
}
diff --git a/chromium/third_party/pdfium/fpdfsdk/formfiller/cba_fontmap.h b/chromium/third_party/pdfium/fpdfsdk/formfiller/cba_fontmap.h
index c0e569a0d3f..09a5a381162 100644
--- a/chromium/third_party/pdfium/fpdfsdk/formfiller/cba_fontmap.h
+++ b/chromium/third_party/pdfium/fpdfsdk/formfiller/cba_fontmap.h
@@ -26,14 +26,14 @@ class CBA_FontMap : public CPWL_FontMap {
// CPWL_FontMap:
void Initialize() override;
CPDF_Document* GetDocument() override;
- CPDF_Font* FindFontSameCharset(CFX_ByteString& sFontAlias,
+ CPDF_Font* FindFontSameCharset(CFX_ByteString* sFontAlias,
int32_t nCharset) override;
void AddedFont(CPDF_Font* pFont, const CFX_ByteString& sFontAlias) override;
CPDF_Font* FindResFontSameCharset(CPDF_Dictionary* pResDict,
- CFX_ByteString& sFontAlias,
+ CFX_ByteString* sFontAlias,
int32_t nCharset);
- CPDF_Font* GetAnnotDefaultFont(CFX_ByteString& csNameTag);
+ CPDF_Font* GetAnnotDefaultFont(CFX_ByteString* csNameTag);
void AddFontToAnnotDict(CPDF_Font* pFont, const CFX_ByteString& sAlias);
CPDF_Document* m_pDocument;
diff --git a/chromium/third_party/pdfium/fpdfsdk/formfiller/cffl_combobox.cpp b/chromium/third_party/pdfium/fpdfsdk/formfiller/cffl_combobox.cpp
index c8438a3a282..7a6d497ad20 100644
--- a/chromium/third_party/pdfium/fpdfsdk/formfiller/cffl_combobox.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/formfiller/cffl_combobox.cpp
@@ -263,18 +263,18 @@ bool CFFL_ComboBox::IsFieldFull(CPDFSDK_PageView* pPageView) {
void CFFL_ComboBox::OnSetFocus(CPWL_Wnd* pWnd) {
ASSERT(m_pFormFillEnv);
- if (pWnd->GetClassName() == PWL_CLASSNAME_EDIT) {
- CPWL_Edit* pEdit = (CPWL_Edit*)pWnd;
- pEdit->SetCharSet(FXFONT_GB2312_CHARSET);
- pEdit->SetCodePage(936);
-
- pEdit->SetReadyToInput();
- CFX_WideString wsText = pEdit->GetText();
- int nCharacters = wsText.GetLength();
- CFX_ByteString bsUTFText = wsText.UTF16LE_Encode();
- unsigned short* pBuffer = (unsigned short*)bsUTFText.c_str();
- m_pFormFillEnv->OnSetFieldInputFocus(pBuffer, nCharacters, true);
- }
+ if (pWnd->GetClassName() != PWL_CLASSNAME_EDIT)
+ return;
+
+ CPWL_Edit* pEdit = (CPWL_Edit*)pWnd;
+ pEdit->SetCharSet(FXFONT_GB2312_CHARSET);
+ pEdit->SetReadyToInput();
+
+ CFX_WideString wsText = pEdit->GetText();
+ int nCharacters = wsText.GetLength();
+ CFX_ByteString bsUTFText = wsText.UTF16LE_Encode();
+ auto* pBuffer = reinterpret_cast<const unsigned short*>(bsUTFText.c_str());
+ m_pFormFillEnv->OnSetFieldInputFocus(pBuffer, nCharacters, true);
}
CFX_WideString CFFL_ComboBox::GetSelectExportText() {
diff --git a/chromium/third_party/pdfium/fpdfsdk/formfiller/cffl_formfiller.cpp b/chromium/third_party/pdfium/fpdfsdk/formfiller/cffl_formfiller.cpp
index da6f9208e04..947c495f192 100644
--- a/chromium/third_party/pdfium/fpdfsdk/formfiller/cffl_formfiller.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/formfiller/cffl_formfiller.cpp
@@ -438,8 +438,8 @@ CFX_WideString CFFL_FormFiller::LoadPopupMenuString(int nIndex) {
CFX_FloatRect CFFL_FormFiller::GetPDFWindowRect() const {
CFX_FloatRect rectAnnot = m_pWidget->GetPDFAnnot()->GetRect();
- FX_FLOAT fWidth = rectAnnot.right - rectAnnot.left;
- FX_FLOAT fHeight = rectAnnot.top - rectAnnot.bottom;
+ float fWidth = rectAnnot.right - rectAnnot.left;
+ float fHeight = rectAnnot.top - rectAnnot.bottom;
if ((m_pWidget->GetRotate() / 90) & 0x01)
return CFX_FloatRect(0, 0, fHeight, fWidth);
diff --git a/chromium/third_party/pdfium/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp b/chromium/third_party/pdfium/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp
index a830d529cba..8a9bd35781d 100644
--- a/chromium/third_party/pdfium/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp
@@ -458,7 +458,7 @@ bool CFFL_InteractiveFormFiller::IsReadOnly(CPDFSDK_Widget* pWidget) {
bool CFFL_InteractiveFormFiller::IsFillingAllowed(CPDFSDK_Widget* pWidget) {
if (pWidget->GetFieldType() == FIELDTYPE_PUSHBUTTON)
- return true;
+ return false;
CPDF_Page* pPage = pWidget->GetPDFPage();
CPDF_Document* pDocument = pPage->m_pDocument;
@@ -527,10 +527,10 @@ void CFFL_InteractiveFormFiller::UnRegisterFormFiller(CPDFSDK_Annot* pAnnot) {
}
void CFFL_InteractiveFormFiller::QueryWherePopup(void* pPrivateData,
- FX_FLOAT fPopupMin,
- FX_FLOAT fPopupMax,
+ float fPopupMin,
+ float fPopupMax,
int32_t& nRet,
- FX_FLOAT& fPopupRet) {
+ float& fPopupRet) {
CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData;
CFX_FloatRect rcPageView(0, 0, 0, 0);
@@ -540,8 +540,8 @@ void CFFL_InteractiveFormFiller::QueryWherePopup(void* pPrivateData,
CFX_FloatRect rcAnnot = pData->pWidget->GetRect();
- FX_FLOAT fTop = 0.0f;
- FX_FLOAT fBottom = 0.0f;
+ float fTop = 0.0f;
+ float fBottom = 0.0f;
CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pData->pWidget;
switch (pWidget->GetRotate() / 90) {
@@ -564,9 +564,9 @@ void CFFL_InteractiveFormFiller::QueryWherePopup(void* pPrivateData,
break;
}
- FX_FLOAT fFactHeight = 0;
+ float fFactHeight = 0;
bool bBottom = true;
- FX_FLOAT fMaxListBoxHeight = 0;
+ float fMaxListBoxHeight = 0;
if (fPopupMax > FFL_MAXLISTBOXHEIGHT) {
if (fPopupMin > FFL_MAXLISTBOXHEIGHT) {
fMaxListBoxHeight = fPopupMin;
diff --git a/chromium/third_party/pdfium/fpdfsdk/formfiller/cffl_interactiveformfiller.h b/chromium/third_party/pdfium/fpdfsdk/formfiller/cffl_interactiveformfiller.h
index 90fd98c0e8c..3c23a6e2f8b 100644
--- a/chromium/third_party/pdfium/fpdfsdk/formfiller/cffl_interactiveformfiller.h
+++ b/chromium/third_party/pdfium/fpdfsdk/formfiller/cffl_interactiveformfiller.h
@@ -139,10 +139,10 @@ class CFFL_InteractiveFormFiller : public IPWL_Filler_Notify {
// IPWL_Filler_Notify:
void QueryWherePopup(void* pPrivateData,
- FX_FLOAT fPopupMin,
- FX_FLOAT fPopupMax,
+ float fPopupMin,
+ float fPopupMax,
int32_t& nRet,
- FX_FLOAT& fPopupRet) override;
+ float& fPopupRet) override;
void OnBeforeKeyStroke(void* pPrivateData,
CFX_WideString& strChange,
const CFX_WideString& strChangeEx,
diff --git a/chromium/third_party/pdfium/fpdfsdk/formfiller/cffl_textfield.cpp b/chromium/third_party/pdfium/fpdfsdk/formfiller/cffl_textfield.cpp
index 91db0959dbe..19a87d04aee 100644
--- a/chromium/third_party/pdfium/fpdfsdk/formfiller/cffl_textfield.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/formfiller/cffl_textfield.cpp
@@ -271,16 +271,16 @@ bool CFFL_TextField::IsFieldFull(CPDFSDK_PageView* pPageView) {
void CFFL_TextField::OnSetFocus(CPWL_Wnd* pWnd) {
ASSERT(m_pFormFillEnv);
- if (pWnd->GetClassName() == PWL_CLASSNAME_EDIT) {
- CPWL_Edit* pEdit = (CPWL_Edit*)pWnd;
- pEdit->SetCharSet(FXFONT_GB2312_CHARSET);
- pEdit->SetCodePage(936);
-
- pEdit->SetReadyToInput();
- CFX_WideString wsText = pEdit->GetText();
- int nCharacters = wsText.GetLength();
- CFX_ByteString bsUTFText = wsText.UTF16LE_Encode();
- unsigned short* pBuffer = (unsigned short*)bsUTFText.c_str();
- m_pFormFillEnv->OnSetFieldInputFocus(pBuffer, nCharacters, true);
- }
+ if (pWnd->GetClassName() != PWL_CLASSNAME_EDIT)
+ return;
+
+ CPWL_Edit* pEdit = (CPWL_Edit*)pWnd;
+ pEdit->SetCharSet(FXFONT_GB2312_CHARSET);
+ pEdit->SetReadyToInput();
+
+ CFX_WideString wsText = pEdit->GetText();
+ int nCharacters = wsText.GetLength();
+ CFX_ByteString bsUTFText = wsText.UTF16LE_Encode();
+ auto* pBuffer = reinterpret_cast<const unsigned short*>(bsUTFText.c_str());
+ m_pFormFillEnv->OnSetFieldInputFocus(pBuffer, nCharacters, true);
}
diff --git a/chromium/third_party/pdfium/fpdfsdk/fpdf_dataavail.cpp b/chromium/third_party/pdfium/fpdfsdk/fpdf_dataavail.cpp
index b1bc1e3bc07..f2358d2e5c8 100644
--- a/chromium/third_party/pdfium/fpdfsdk/fpdf_dataavail.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/fpdf_dataavail.cpp
@@ -60,9 +60,9 @@ class CFPDF_FileAvailWrap : public CPDF_DataAvail::FileAvail {
class CFPDF_FileAccessWrap : public IFX_SeekableReadStream {
public:
- static CFX_RetainPtr<CFPDF_FileAccessWrap> Create() {
- return CFX_RetainPtr<CFPDF_FileAccessWrap>(new CFPDF_FileAccessWrap());
- }
+ template <typename T, typename... Args>
+ friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args);
+
~CFPDF_FileAccessWrap() override {}
void Set(FPDF_FILEACCESS* pFile) { m_pFileAccess = pFile; }
@@ -101,8 +101,8 @@ class CFPDF_DownloadHintsWrap : public CPDF_DataAvail::DownloadHints {
class CFPDF_DataAvail {
public:
CFPDF_DataAvail()
- : m_FileAvail(new CFPDF_FileAvailWrap),
- m_FileRead(CFPDF_FileAccessWrap::Create()) {}
+ : m_FileAvail(pdfium::MakeUnique<CFPDF_FileAvailWrap>()),
+ m_FileRead(pdfium::MakeRetain<CFPDF_FileAccessWrap>()) {}
~CFPDF_DataAvail() {}
std::unique_ptr<CPDF_DataAvail> m_pDataAvail;
@@ -145,11 +145,10 @@ FPDFAvail_GetDocument(FPDF_AVAIL avail, FPDF_BYTESTRING password) {
if (!pDataAvail)
return nullptr;
- std::unique_ptr<CPDF_Parser> pParser(new CPDF_Parser);
+ auto pParser = pdfium::MakeUnique<CPDF_Parser>();
pParser->SetPassword(password);
- std::unique_ptr<CPDF_Document> pDocument(
- new CPDF_Document(std::move(pParser)));
+ auto pDocument = pdfium::MakeUnique<CPDF_Document>(std::move(pParser));
CPDF_Parser::Error error = pDocument->GetParser()->StartLinearizedParse(
pDataAvail->m_pDataAvail->GetFileRead(), pDocument.get());
if (error != CPDF_Parser::SUCCESS) {
diff --git a/chromium/third_party/pdfium/fpdfsdk/fpdf_ext.cpp b/chromium/third_party/pdfium/fpdfsdk/fpdf_ext.cpp
index 3bcb0c04b66..8773d680ea0 100644
--- a/chromium/third_party/pdfium/fpdfsdk/fpdf_ext.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/fpdf_ext.cpp
@@ -16,7 +16,7 @@
#include "core/fpdfdoc/cpdf_metadata.h"
#include "core/fxcrt/fx_basic.h"
#include "core/fxcrt/fx_memory.h"
-#include "core/fxcrt/fx_xml.h"
+#include "core/fxcrt/xml/cxml_element.h"
#include "fpdfsdk/fsdk_define.h"
#include "third_party/base/ptr_util.h"
@@ -79,9 +79,10 @@ bool CheckSharedForm(const CXML_Element* pElement, CFX_ByteString cbName) {
int count = pElement->CountAttrs();
int i = 0;
for (i = 0; i < count; i++) {
- CFX_ByteString space, name;
+ CFX_ByteString space;
+ CFX_ByteString name;
CFX_WideString value;
- pElement->GetAttrByIndex(i, space, name, value);
+ pElement->GetAttrByIndex(i, &space, &name, &value);
if (space == "xmlns" && name == "adhocwf" &&
value == L"http://ns.adobe.com/AcrobatAdhocWorkflow/1.0/") {
CXML_Element* pVersion =
diff --git a/chromium/third_party/pdfium/fpdfsdk/fpdf_flatten.cpp b/chromium/third_party/pdfium/fpdfsdk/fpdf_flatten.cpp
index e649bacf497..31b838cd940 100644
--- a/chromium/third_party/pdfium/fpdfsdk/fpdf_flatten.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/fpdf_flatten.cpp
@@ -51,7 +51,7 @@ bool IsValiableRect(CFX_FloatRect rect, CFX_FloatRect rcPage) {
void GetContentsRect(CPDF_Document* pDoc,
CPDF_Dictionary* pDict,
std::vector<CFX_FloatRect>* pRectArray) {
- std::unique_ptr<CPDF_Page> pPDFPage(new CPDF_Page(pDoc, pDict, false));
+ auto pPDFPage = pdfium::MakeUnique<CPDF_Page>(pDoc, pDict, false);
pPDFPage->ParseContent();
for (const auto& pPageObject : *pPDFPage->GetPageObjectList()) {
@@ -123,14 +123,14 @@ int ParserAnnots(CPDF_Document* pSourceDoc,
return FLATTEN_SUCCESS;
}
-FX_FLOAT GetMinMaxValue(const std::vector<CFX_FloatRect>& array,
- FPDF_TYPE type,
- FPDF_VALUE value) {
+float GetMinMaxValue(const std::vector<CFX_FloatRect>& array,
+ FPDF_TYPE type,
+ FPDF_VALUE value) {
size_t nRects = array.size();
if (nRects <= 0)
return 0.0f;
- std::vector<FX_FLOAT> pArray(nRects);
+ std::vector<float> pArray(nRects);
switch (value) {
case LEFT:
for (size_t i = 0; i < nRects; i++)
@@ -153,7 +153,7 @@ FX_FLOAT GetMinMaxValue(const std::vector<CFX_FloatRect>& array,
return 0.0f;
}
- FX_FLOAT fRet = pArray[0];
+ float fRet = pArray[0];
if (type == MAX) {
for (size_t i = 1; i < nRects; i++)
fRet = std::max(fRet, pArray[i]);
@@ -204,11 +204,11 @@ void SetPageContents(const CFX_ByteString& key,
pPage->ConvertToIndirectObjectFor("Contents", pDocument);
if (!pContentsArray) {
pContentsArray = pDocument->NewIndirect<CPDF_Array>();
- CPDF_StreamAcc acc;
- acc.LoadAllData(pContentsStream);
+ auto pAcc = pdfium::MakeRetain<CPDF_StreamAcc>(pContentsStream);
+ pAcc->LoadAllData();
CFX_ByteString sStream = "q\n";
CFX_ByteString sBody =
- CFX_ByteString((const FX_CHAR*)acc.GetData(), acc.GetSize());
+ CFX_ByteString((const char*)pAcc->GetData(), pAcc->GetSize());
sStream = sStream + sBody + "\nQ";
pContentsStream->SetData(sStream.raw_str(), sStream.GetLength());
pContentsArray->AddNew<CPDF_Reference>(pDocument,
@@ -231,11 +231,11 @@ CFX_Matrix GetMatrix(CFX_FloatRect rcAnnot,
matrix.TransformRect(rcStream);
rcStream.Normalize();
- FX_FLOAT a = rcAnnot.Width() / rcStream.Width();
- FX_FLOAT d = rcAnnot.Height() / rcStream.Height();
+ float a = rcAnnot.Width() / rcStream.Width();
+ float d = rcAnnot.Height() / rcStream.Height();
- FX_FLOAT e = rcAnnot.left - rcStream.left * a;
- FX_FLOAT f = rcAnnot.bottom - rcStream.bottom * d;
+ float e = rcAnnot.left - rcStream.left * a;
+ float f = rcAnnot.bottom - rcStream.bottom * d;
return CFX_Matrix(a, 0, 0, d, e, f);
}
@@ -402,11 +402,9 @@ DLLEXPORT int STDCALL FPDFPage_Flatten(FPDF_PAGE page, int nFlag) {
pXObject->SetNewFor<CPDF_Reference>(sFormName, pDocument,
pObj->GetObjNum());
- CPDF_StreamAcc acc;
- acc.LoadAllData(pNewXObject);
-
- const uint8_t* pData = acc.GetData();
- CFX_ByteString sStream(pData, acc.GetSize());
+ auto pAcc = pdfium::MakeRetain<CPDF_StreamAcc>(pNewXObject);
+ pAcc->LoadAllData();
+ CFX_ByteString sStream(pAcc->GetData(), pAcc->GetSize());
CFX_Matrix matrix = pAPDic->GetMatrixFor("Matrix");
if (matrix.IsIdentity()) {
matrix.a = 1.0f;
diff --git a/chromium/third_party/pdfium/fpdfsdk/fpdf_progressive.cpp b/chromium/third_party/pdfium/fpdfsdk/fpdf_progressive.cpp
index cc09d076380..927bcddd09b 100644
--- a/chromium/third_party/pdfium/fpdfsdk/fpdf_progressive.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/fpdf_progressive.cpp
@@ -6,6 +6,8 @@
#include "public/fpdf_progressive.h"
+#include <utility>
+
#include "core/fpdfapi/cpdf_pagerendercontext.h"
#include "core/fpdfapi/page/cpdf_page.h"
#include "core/fpdfapi/render/cpdf_progressiverenderer.h"
@@ -44,11 +46,14 @@ DLLEXPORT int STDCALL FPDF_RenderPageBitmap_Start(FPDF_BITMAP bitmap,
if (!pPage)
return FPDF_RENDER_FAILED;
- CPDF_PageRenderContext* pContext = new CPDF_PageRenderContext;
- pPage->SetRenderContext(pdfium::WrapUnique(pContext));
- CFX_FxgeDevice* pDevice = new CFX_FxgeDevice;
- pContext->m_pDevice.reset(pDevice);
- CFX_DIBitmap* pBitmap = CFXBitmapFromFPDFBitmap(bitmap);
+ auto pOwnedContext = pdfium::MakeUnique<CPDF_PageRenderContext>();
+ CPDF_PageRenderContext* pContext = pOwnedContext.get();
+ pPage->SetRenderContext(std::move(pOwnedContext));
+
+ CFX_RetainPtr<CFX_DIBitmap> pBitmap(CFXBitmapFromFPDFBitmap(bitmap));
+ auto pOwnedDevice = pdfium::MakeUnique<CFX_FxgeDevice>();
+ CFX_FxgeDevice* pDevice = pOwnedDevice.get();
+ pContext->m_pDevice = std::move(pOwnedDevice);
pDevice->Attach(pBitmap, !!(flags & FPDF_REVERSE_BYTE_ORDER), nullptr, false);
IFSDK_PAUSE_Adapter IPauseAdapter(pause);
diff --git a/chromium/third_party/pdfium/fpdfsdk/fpdf_searchex.cpp b/chromium/third_party/pdfium/fpdfsdk/fpdf_searchex.cpp
index f82db37b5a8..13729167ed8 100644
--- a/chromium/third_party/pdfium/fpdfsdk/fpdf_searchex.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/fpdf_searchex.cpp
@@ -15,3 +15,11 @@ FPDFText_GetCharIndexFromTextIndex(FPDF_TEXTPAGE text_page, int nTextIndex) {
return static_cast<CPDF_TextPage*>(text_page)
->CharIndexFromTextIndex(nTextIndex);
}
+
+DLLEXPORT int STDCALL
+FPDFText_GetTextIndexFromCharIndex(FPDF_TEXTPAGE text_page, int nCharIndex) {
+ if (!text_page)
+ return -1;
+ return static_cast<CPDF_TextPage*>(text_page)->TextIndexFromCharIndex(
+ nCharIndex);
+}
diff --git a/chromium/third_party/pdfium/fpdfsdk/fpdf_structtree.cpp b/chromium/third_party/pdfium/fpdfsdk/fpdf_structtree.cpp
index 5a922a1c3b3..74c44f8083e 100644
--- a/chromium/third_party/pdfium/fpdfsdk/fpdf_structtree.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/fpdf_structtree.cpp
@@ -8,17 +8,31 @@
#include "core/fpdfapi/page/cpdf_page.h"
#include "core/fpdfapi/parser/cpdf_dictionary.h"
-#include "core/fpdfdoc/fpdf_tagged.h"
+#include "core/fpdfdoc/cpdf_structelement.h"
+#include "core/fpdfdoc/cpdf_structtree.h"
#include "fpdfsdk/fsdk_define.h"
namespace {
-IPDF_StructTree* ToStructTree(FPDF_STRUCTTREE struct_tree) {
- return reinterpret_cast<IPDF_StructTree*>(struct_tree);
+CPDF_StructTree* ToStructTree(FPDF_STRUCTTREE struct_tree) {
+ return reinterpret_cast<CPDF_StructTree*>(struct_tree);
}
-IPDF_StructElement* ToStructTreeElement(FPDF_STRUCTELEMENT struct_element) {
- return reinterpret_cast<IPDF_StructElement*>(struct_element);
+CPDF_StructElement* ToStructTreeElement(FPDF_STRUCTELEMENT struct_element) {
+ return reinterpret_cast<CPDF_StructElement*>(struct_element);
+}
+
+unsigned long WideStringToBuffer(const CFX_WideString& str,
+ void* buffer,
+ unsigned long buflen) {
+ if (str.IsEmpty())
+ return 0;
+
+ CFX_ByteString encodedStr = str.UTF16LE_Encode();
+ const unsigned long len = encodedStr.GetLength();
+ if (buffer && len <= buflen)
+ memcpy(buffer, encodedStr.c_str(), len);
+ return len;
}
} // namespace
@@ -27,23 +41,23 @@ DLLEXPORT FPDF_STRUCTTREE STDCALL FPDF_StructTree_GetForPage(FPDF_PAGE page) {
CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
if (!pPage)
return nullptr;
- return IPDF_StructTree::LoadPage(pPage->m_pDocument, pPage->m_pFormDict)
+ return CPDF_StructTree::LoadPage(pPage->m_pDocument, pPage->m_pFormDict)
.release();
}
DLLEXPORT void STDCALL FPDF_StructTree_Close(FPDF_STRUCTTREE struct_tree) {
- std::unique_ptr<IPDF_StructTree>(ToStructTree(struct_tree));
+ std::unique_ptr<CPDF_StructTree>(ToStructTree(struct_tree));
}
DLLEXPORT int STDCALL
FPDF_StructTree_CountChildren(FPDF_STRUCTTREE struct_tree) {
- IPDF_StructTree* tree = ToStructTree(struct_tree);
+ CPDF_StructTree* tree = ToStructTree(struct_tree);
return tree ? tree->CountTopElements() : -1;
}
DLLEXPORT FPDF_STRUCTELEMENT STDCALL
FPDF_StructTree_GetChildAtIndex(FPDF_STRUCTTREE struct_tree, int index) {
- IPDF_StructTree* tree = ToStructTree(struct_tree);
+ CPDF_StructTree* tree = ToStructTree(struct_tree);
if (!tree || index < 0 || index >= tree->CountTopElements())
return nullptr;
return tree->GetTopElement(index);
@@ -53,35 +67,42 @@ DLLEXPORT unsigned long STDCALL
FPDF_StructElement_GetAltText(FPDF_STRUCTELEMENT struct_element,
void* buffer,
unsigned long buflen) {
- IPDF_StructElement* elem = ToStructTreeElement(struct_element);
- if (!elem)
- return 0;
-
- CPDF_Dictionary* dict = elem->GetDict();
- if (!dict)
- return 0;
+ CPDF_StructElement* elem = ToStructTreeElement(struct_element);
+ return (elem && elem->GetDict())
+ ? WideStringToBuffer(elem->GetDict()->GetUnicodeTextFor("Alt"),
+ buffer, buflen)
+ : 0;
+}
- CFX_WideString str = elem->GetDict()->GetUnicodeTextFor("Alt");
- if (str.IsEmpty())
- return 0;
+DLLEXPORT unsigned long STDCALL
+FPDF_StructElement_GetType(FPDF_STRUCTELEMENT struct_element,
+ void* buffer,
+ unsigned long buflen) {
+ CPDF_StructElement* elem = ToStructTreeElement(struct_element);
+ return elem ? WideStringToBuffer(elem->GetType().UTF8Decode(), buffer, buflen)
+ : 0;
+}
- CFX_ByteString encodedStr = str.UTF16LE_Encode();
- const unsigned long len = encodedStr.GetLength();
- if (buffer && len <= buflen)
- FXSYS_memcpy(buffer, encodedStr.c_str(), len);
- return len;
+DLLEXPORT unsigned long STDCALL
+FPDF_StructElement_GetTitle(FPDF_STRUCTELEMENT struct_element,
+ void* buffer,
+ unsigned long buflen) {
+ CPDF_StructElement* elem = ToStructTreeElement(struct_element);
+ return elem
+ ? WideStringToBuffer(elem->GetTitle().UTF8Decode(), buffer, buflen)
+ : 0;
}
DLLEXPORT int STDCALL
FPDF_StructElement_CountChildren(FPDF_STRUCTELEMENT struct_element) {
- IPDF_StructElement* elem = ToStructTreeElement(struct_element);
+ CPDF_StructElement* elem = ToStructTreeElement(struct_element);
return elem ? elem->CountKids() : -1;
}
DLLEXPORT FPDF_STRUCTELEMENT STDCALL
FPDF_StructElement_GetChildAtIndex(FPDF_STRUCTELEMENT struct_element,
int index) {
- IPDF_StructElement* elem = ToStructTreeElement(struct_element);
+ CPDF_StructElement* elem = ToStructTreeElement(struct_element);
if (!elem || index < 0 || index >= elem->CountKids())
return nullptr;
diff --git a/chromium/third_party/pdfium/fpdfsdk/fpdf_structtree_embeddertest.cpp b/chromium/third_party/pdfium/fpdfsdk/fpdf_structtree_embeddertest.cpp
index 58b31720576..3110988d82f 100644
--- a/chromium/third_party/pdfium/fpdfsdk/fpdf_structtree_embeddertest.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/fpdf_structtree_embeddertest.cpp
@@ -56,7 +56,7 @@ TEST_F(FPDFStructTreeEmbeddertest, GetAltText) {
ASSERT_EQ(24U, FPDF_StructElement_GetAltText(gchild_element, buffer,
sizeof(buffer)));
- const FX_WCHAR kExpected[] = L"Black Image";
+ const wchar_t kExpected[] = L"Black Image";
EXPECT_EQ(CFX_WideString(kExpected),
CFX_WideString::FromUTF16LE(buffer, FXSYS_len(kExpected)));
@@ -68,3 +68,32 @@ TEST_F(FPDFStructTreeEmbeddertest, GetAltText) {
FPDF_StructTree_Close(struct_tree);
FPDF_ClosePage(page);
}
+
+TEST_F(FPDFStructTreeEmbeddertest, GetType) {
+ ASSERT_TRUE(OpenDocument("tagged_alt_text.pdf"));
+ FPDF_PAGE page = LoadPage(0);
+ ASSERT_TRUE(page);
+
+ FPDF_STRUCTTREE struct_tree = FPDF_StructTree_GetForPage(page);
+ ASSERT_TRUE(struct_tree);
+ ASSERT_EQ(1, FPDF_StructTree_CountChildren(struct_tree));
+
+ FPDF_STRUCTELEMENT element = FPDF_StructTree_GetChildAtIndex(struct_tree, 0);
+ ASSERT_NE(nullptr, element);
+
+ unsigned short buffer[12];
+ memset(buffer, 0, sizeof(buffer));
+ // Deliberately pass in a small buffer size to make sure |buffer| remains
+ // untouched.
+ ASSERT_EQ(18U, FPDF_StructElement_GetType(element, buffer, 1));
+ for (size_t i = 0; i < FX_ArraySize(buffer); ++i)
+ EXPECT_EQ(0U, buffer[i]);
+
+ ASSERT_EQ(18U, FPDF_StructElement_GetType(element, buffer, sizeof(buffer)));
+ const wchar_t kExpected[] = L"Document";
+ EXPECT_EQ(CFX_WideString(kExpected),
+ CFX_WideString::FromUTF16LE(buffer, FXSYS_len(kExpected)));
+
+ FPDF_StructTree_Close(struct_tree);
+ FPDF_ClosePage(page);
+}
diff --git a/chromium/third_party/pdfium/fpdfsdk/fpdf_sysfontinfo.cpp b/chromium/third_party/pdfium/fpdfsdk/fpdf_sysfontinfo.cpp
index 1b62dc48ac4..6939eba14d3 100644
--- a/chromium/third_party/pdfium/fpdfsdk/fpdf_sysfontinfo.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/fpdf_sysfontinfo.cpp
@@ -35,7 +35,7 @@ class CFX_ExternalFontInfo final : public IFX_SystemFontInfo {
bool bItalic,
int charset,
int pitch_family,
- const FX_CHAR* family,
+ const char* family,
int& iExact) override {
if (!m_pInfo->MapFont)
return nullptr;
@@ -43,7 +43,7 @@ class CFX_ExternalFontInfo final : public IFX_SystemFontInfo {
family, &iExact);
}
- void* GetFont(const FX_CHAR* family) override {
+ void* GetFont(const char* family) override {
if (!m_pInfo->GetFont)
return nullptr;
return m_pInfo->GetFont(m_pInfo, family);
@@ -58,7 +58,7 @@ class CFX_ExternalFontInfo final : public IFX_SystemFontInfo {
return m_pInfo->GetFontData(m_pInfo, hFont, table, buffer, size);
}
- bool GetFaceName(void* hFont, CFX_ByteString& name) override {
+ bool GetFaceName(void* hFont, CFX_ByteString* name) override {
if (!m_pInfo->GetFaceName)
return false;
uint32_t size = m_pInfo->GetFaceName(m_pInfo, hFont, nullptr, 0);
@@ -66,16 +66,16 @@ class CFX_ExternalFontInfo final : public IFX_SystemFontInfo {
return false;
char* buffer = FX_Alloc(char, size);
size = m_pInfo->GetFaceName(m_pInfo, hFont, buffer, size);
- name = CFX_ByteString(buffer, size);
+ *name = CFX_ByteString(buffer, size);
FX_Free(buffer);
return true;
}
- bool GetFontCharset(void* hFont, int& charset) override {
+ bool GetFontCharset(void* hFont, int* charset) override {
if (!m_pInfo->GetFontCharset)
return false;
- charset = m_pInfo->GetFontCharset(m_pInfo, hFont);
+ *charset = m_pInfo->GetFontCharset(m_pInfo, hFont);
return true;
}
@@ -155,18 +155,20 @@ static unsigned long DefaultGetFaceName(struct _FPDF_SYSFONTINFO* pThis,
unsigned long buf_size) {
CFX_ByteString name;
auto* pDefault = static_cast<FPDF_SYSFONTINFO_DEFAULT*>(pThis);
- if (!pDefault->m_pFontInfo->GetFaceName(hFont, name))
+ if (!pDefault->m_pFontInfo->GetFaceName(hFont, &name))
return 0;
if (name.GetLength() >= (long)buf_size)
return name.GetLength() + 1;
- FXSYS_strcpy(buffer, name.c_str());
+
+ strncpy(buffer, name.c_str(),
+ (name.GetLength() + 1) * sizeof(CFX_ByteString::CharType));
return name.GetLength() + 1;
}
static int DefaultGetFontCharset(struct _FPDF_SYSFONTINFO* pThis, void* hFont) {
int charset;
auto* pDefault = static_cast<FPDF_SYSFONTINFO_DEFAULT*>(pThis);
- if (!pDefault->m_pFontInfo->GetFontCharset(hFont, charset))
+ if (!pDefault->m_pFontInfo->GetFontCharset(hFont, &charset))
return 0;
return charset;
}
diff --git a/chromium/third_party/pdfium/fpdfsdk/fpdf_transformpage.cpp b/chromium/third_party/pdfium/fpdfsdk/fpdf_transformpage.cpp
index 3427f4ea585..32ba3a7525f 100644
--- a/chromium/third_party/pdfium/fpdfsdk/fpdf_transformpage.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/fpdf_transformpage.cpp
@@ -206,8 +206,7 @@ FPDFPageObj_TransformClipPath(FPDF_PAGEOBJECT page_object,
CPDF_PageObject* pPageObj = (CPDF_PageObject*)page_object;
if (!pPageObj)
return;
- CFX_Matrix matrix((FX_FLOAT)a, (FX_FLOAT)b, (FX_FLOAT)c, (FX_FLOAT)d,
- (FX_FLOAT)e, (FX_FLOAT)f);
+ CFX_Matrix matrix((float)a, (float)b, (float)c, (float)d, (float)e, (float)f);
// Special treatment to shading object, because the ClipPath for shading
// object is already transformed.
diff --git a/chromium/third_party/pdfium/fpdfsdk/fpdfdoc.cpp b/chromium/third_party/pdfium/fpdfsdk/fpdfdoc.cpp
index f7d94c2f97c..0c8e26ceacd 100644
--- a/chromium/third_party/pdfium/fpdfsdk/fpdfdoc.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/fpdfdoc.cpp
@@ -66,7 +66,7 @@ unsigned long Utf16EncodeMaybeCopyAndReturnLength(const CFX_WideString& text,
CFX_ByteString encodedText = text.UTF16LE_Encode();
unsigned long len = encodedText.GetLength();
if (buffer && len <= buflen)
- FXSYS_memcpy(buffer, encodedText.c_str(), len);
+ memcpy(buffer, encodedText.c_str(), len);
return len;
}
@@ -188,7 +188,7 @@ DLLEXPORT unsigned long STDCALL FPDFAction_GetFilePath(FPDF_ACTION pDict,
CFX_ByteString path = action.GetFilePath().UTF8Encode();
unsigned long len = path.GetLength() + 1;
if (buffer && len <= buflen)
- FXSYS_memcpy(buffer, path.c_str(), len);
+ memcpy(buffer, path.c_str(), len);
return len;
}
@@ -205,7 +205,7 @@ DLLEXPORT unsigned long STDCALL FPDFAction_GetURIPath(FPDF_DOCUMENT document,
CFX_ByteString path = action.GetURI(pDoc);
unsigned long len = path.GetLength() + 1;
if (buffer && len <= buflen)
- FXSYS_memcpy(buffer, path.c_str(), len);
+ memcpy(buffer, path.c_str(), len);
return len;
}
@@ -258,9 +258,9 @@ DLLEXPORT FPDF_LINK STDCALL FPDFLink_GetLinkAtPoint(FPDF_PAGE page,
return nullptr;
return pLinkList
- ->GetLinkAtPoint(
- pPage, CFX_PointF(static_cast<FX_FLOAT>(x), static_cast<FX_FLOAT>(y)),
- nullptr)
+ ->GetLinkAtPoint(pPage,
+ CFX_PointF(static_cast<float>(x), static_cast<float>(y)),
+ nullptr)
.GetDict();
}
@@ -277,7 +277,7 @@ DLLEXPORT int STDCALL FPDFLink_GetLinkZOrderAtPoint(FPDF_PAGE page,
int z_order = -1;
pLinkList->GetLinkAtPoint(
- pPage, CFX_PointF(static_cast<FX_FLOAT>(x), static_cast<FX_FLOAT>(y)),
+ pPage, CFX_PointF(static_cast<float>(x), static_cast<float>(y)),
&z_order);
return z_order;
}
diff --git a/chromium/third_party/pdfium/fpdfsdk/fpdfdoc_embeddertest.cpp b/chromium/third_party/pdfium/fpdfsdk/fpdfdoc_embeddertest.cpp
index 3666687d4da..2472db9746f 100644
--- a/chromium/third_party/pdfium/fpdfsdk/fpdfdoc_embeddertest.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/fpdfdoc_embeddertest.cpp
@@ -198,37 +198,37 @@ TEST_F(FPDFDocEmbeddertest, GetPageLabels) {
EXPECT_EQ(0u, FPDF_GetPageLabel(document(), -2, buf, sizeof(buf)));
EXPECT_EQ(0u, FPDF_GetPageLabel(document(), -1, buf, sizeof(buf)));
- const FX_WCHAR kExpectedPageLabel0[] = L"i";
+ const wchar_t kExpectedPageLabel0[] = L"i";
ASSERT_EQ(4u, FPDF_GetPageLabel(document(), 0, buf, sizeof(buf)));
EXPECT_EQ(CFX_WideString(kExpectedPageLabel0),
CFX_WideString::FromUTF16LE(buf, FXSYS_len(kExpectedPageLabel0)));
- const FX_WCHAR kExpectedPageLabel1[] = L"ii";
+ const wchar_t kExpectedPageLabel1[] = L"ii";
ASSERT_EQ(6u, FPDF_GetPageLabel(document(), 1, buf, sizeof(buf)));
EXPECT_EQ(CFX_WideString(kExpectedPageLabel1),
CFX_WideString::FromUTF16LE(buf, FXSYS_len(kExpectedPageLabel1)));
- const FX_WCHAR kExpectedPageLabel2[] = L"1";
+ const wchar_t kExpectedPageLabel2[] = L"1";
ASSERT_EQ(4u, FPDF_GetPageLabel(document(), 2, buf, sizeof(buf)));
EXPECT_EQ(CFX_WideString(kExpectedPageLabel2),
CFX_WideString::FromUTF16LE(buf, FXSYS_len(kExpectedPageLabel2)));
- const FX_WCHAR kExpectedPageLabel3[] = L"2";
+ const wchar_t kExpectedPageLabel3[] = L"2";
ASSERT_EQ(4u, FPDF_GetPageLabel(document(), 3, buf, sizeof(buf)));
EXPECT_EQ(CFX_WideString(kExpectedPageLabel3),
CFX_WideString::FromUTF16LE(buf, FXSYS_len(kExpectedPageLabel3)));
- const FX_WCHAR kExpectedPageLabel4[] = L"zzA";
+ const wchar_t kExpectedPageLabel4[] = L"zzA";
ASSERT_EQ(8u, FPDF_GetPageLabel(document(), 4, buf, sizeof(buf)));
EXPECT_EQ(CFX_WideString(kExpectedPageLabel4),
CFX_WideString::FromUTF16LE(buf, FXSYS_len(kExpectedPageLabel4)));
- const FX_WCHAR kExpectedPageLabel5[] = L"zzB";
+ const wchar_t kExpectedPageLabel5[] = L"zzB";
ASSERT_EQ(8u, FPDF_GetPageLabel(document(), 5, buf, sizeof(buf)));
EXPECT_EQ(CFX_WideString(kExpectedPageLabel5),
CFX_WideString::FromUTF16LE(buf, FXSYS_len(kExpectedPageLabel5)));
- const FX_WCHAR kExpectedPageLabel6[] = L"";
+ const wchar_t kExpectedPageLabel6[] = L"";
ASSERT_EQ(2u, FPDF_GetPageLabel(document(), 6, buf, sizeof(buf)));
EXPECT_EQ(CFX_WideString(kExpectedPageLabel6),
CFX_WideString::FromUTF16LE(buf, FXSYS_len(kExpectedPageLabel6)));
diff --git a/chromium/third_party/pdfium/fpdfsdk/fpdfedit_embeddertest.cpp b/chromium/third_party/pdfium/fpdfsdk/fpdfedit_embeddertest.cpp
index 53554a18223..6454c34df17 100644
--- a/chromium/third_party/pdfium/fpdfsdk/fpdfedit_embeddertest.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/fpdfedit_embeddertest.cpp
@@ -4,11 +4,13 @@
#include <memory>
#include <string>
+#include <utility>
#include "core/fpdfapi/font/cpdf_font.h"
#include "core/fpdfapi/page/cpdf_page.h"
#include "core/fpdfapi/parser/cpdf_array.h"
#include "core/fpdfapi/parser/cpdf_dictionary.h"
+#include "core/fpdfapi/parser/cpdf_number.h"
#include "core/fpdfapi/parser/cpdf_stream.h"
#include "core/fxcrt/fx_system.h"
#include "fpdfsdk/fsdk_define.h"
@@ -19,7 +21,106 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/test_support.h"
-class FPDFEditEmbeddertest : public EmbedderTest, public TestSaver {};
+class FPDFEditEmbeddertest : public EmbedderTest, public TestSaver {
+ protected:
+ FPDF_DOCUMENT CreateNewDocument() {
+ document_ = FPDF_CreateNewDocument();
+ cpdf_doc_ = reinterpret_cast<CPDF_Document*>(document_);
+ return document_;
+ }
+
+ void CheckFontDescriptor(CPDF_Dictionary* font_dict,
+ int font_type,
+ bool bold,
+ bool italic,
+ uint32_t size,
+ const uint8_t* data) {
+ CPDF_Dictionary* font_desc = font_dict->GetDictFor("FontDescriptor");
+ ASSERT_TRUE(font_desc);
+ EXPECT_EQ("FontDescriptor", font_desc->GetStringFor("Type"));
+ EXPECT_EQ(font_dict->GetStringFor("BaseFont"),
+ font_desc->GetStringFor("FontName"));
+
+ // Check that the font descriptor has the required keys according to spec
+ // 1.7 Table 5.19
+ ASSERT_TRUE(font_desc->KeyExist("Flags"));
+ int font_flags = font_desc->GetIntegerFor("Flags");
+ if (bold)
+ EXPECT_TRUE(font_flags & FXFONT_BOLD);
+ else
+ EXPECT_FALSE(font_flags & FXFONT_BOLD);
+ if (italic)
+ EXPECT_TRUE(font_flags & FXFONT_ITALIC);
+ else
+ EXPECT_FALSE(font_flags & FXFONT_ITALIC);
+ EXPECT_TRUE(font_flags & FXFONT_NONSYMBOLIC);
+ ASSERT_TRUE(font_desc->KeyExist("FontBBox"));
+ EXPECT_EQ(4U, font_desc->GetArrayFor("FontBBox")->GetCount());
+ EXPECT_TRUE(font_desc->KeyExist("ItalicAngle"));
+ EXPECT_TRUE(font_desc->KeyExist("Ascent"));
+ EXPECT_TRUE(font_desc->KeyExist("Descent"));
+ EXPECT_TRUE(font_desc->KeyExist("CapHeight"));
+ EXPECT_TRUE(font_desc->KeyExist("StemV"));
+ CFX_ByteString present("FontFile");
+ CFX_ByteString absent("FontFile2");
+ if (font_type == FPDF_FONT_TRUETYPE)
+ std::swap(present, absent);
+ EXPECT_TRUE(font_desc->KeyExist(present));
+ EXPECT_FALSE(font_desc->KeyExist(absent));
+
+ // Check that the font stream is the one that was provided
+ CPDF_Stream* font_stream = font_desc->GetStreamFor(present);
+ ASSERT_EQ(size, font_stream->GetRawSize());
+ uint8_t* stream_data = font_stream->GetRawData();
+ for (size_t j = 0; j < size; j++)
+ EXPECT_EQ(data[j], stream_data[j]) << " at byte " << j;
+ }
+
+ void CheckCompositeFontWidths(CPDF_Array* widths_array,
+ CPDF_Font* typed_font) {
+ // Check that W array is in a format that conforms to PDF spec 1.7 section
+ // "Glyph Metrics in CIDFonts" (these checks are not
+ // implementation-specific).
+ EXPECT_GT(widths_array->GetCount(), 1U);
+ int num_cids_checked = 0;
+ int cur_cid = 0;
+ for (size_t idx = 0; idx < widths_array->GetCount(); idx++) {
+ int cid = widths_array->GetNumberAt(idx);
+ EXPECT_GE(cid, cur_cid);
+ ASSERT_FALSE(++idx == widths_array->GetCount());
+ CPDF_Object* next = widths_array->GetObjectAt(idx);
+ if (next->IsArray()) {
+ // We are in the c [w1 w2 ...] case
+ CPDF_Array* arr = next->AsArray();
+ int cnt = static_cast<int>(arr->GetCount());
+ size_t inner_idx = 0;
+ for (cur_cid = cid; cur_cid < cid + cnt; cur_cid++) {
+ int width = arr->GetNumberAt(inner_idx++);
+ EXPECT_EQ(width, typed_font->GetCharWidthF(cur_cid)) << " at cid "
+ << cur_cid;
+ }
+ num_cids_checked += cnt;
+ continue;
+ }
+ // Otherwise, are in the c_first c_last w case.
+ ASSERT_TRUE(next->IsNumber());
+ int last_cid = next->AsNumber()->GetInteger();
+ ASSERT_FALSE(++idx == widths_array->GetCount());
+ int width = widths_array->GetNumberAt(idx);
+ for (cur_cid = cid; cur_cid <= last_cid; cur_cid++) {
+ EXPECT_EQ(width, typed_font->GetCharWidthF(cur_cid)) << " at cid "
+ << cur_cid;
+ }
+ num_cids_checked += last_cid - cid + 1;
+ }
+ // Make sure we have a good amount of cids described
+ EXPECT_GT(num_cids_checked, 900);
+ }
+ CPDF_Document* cpdf_doc() { return cpdf_doc_; }
+
+ private:
+ CPDF_Document* cpdf_doc_;
+};
namespace {
@@ -119,7 +220,7 @@ TEST_F(FPDFEditEmbeddertest, RasterizePDF) {
// Add the bitmap to an image object and add the image object to the output
// page.
- FPDF_PAGEOBJECT temp_img = FPDFPageObj_NewImgeObj(temp_doc);
+ FPDF_PAGEOBJECT temp_img = FPDFPageObj_NewImageObj(temp_doc);
EXPECT_TRUE(FPDFImageObj_SetBitmap(&temp_page, 1, temp_img, orig_bitmap));
EXPECT_TRUE(FPDFImageObj_SetMatrix(temp_img, 612, 0, 0, 792, 0, 0));
FPDFPage_InsertObject(temp_page, temp_img);
@@ -157,8 +258,7 @@ TEST_F(FPDFEditEmbeddertest, RasterizePDF) {
TEST_F(FPDFEditEmbeddertest, AddPaths) {
// Start with a blank page
- FPDF_DOCUMENT doc = FPDF_CreateNewDocument();
- FPDF_PAGE page = FPDFPage_New(doc, 0, 612, 792);
+ FPDF_PAGE page = FPDFPage_New(CreateNewDocument(), 0, 612, 792);
// We will first add a red rectangle
FPDF_PAGEOBJECT red_rect = FPDFPageObj_CreateNewRect(10, 10, 20, 20);
@@ -179,6 +279,18 @@ TEST_F(FPDFEditEmbeddertest, AddPaths) {
// Now add to that a green rectangle with some medium alpha
FPDF_PAGEOBJECT green_rect = FPDFPageObj_CreateNewRect(100, 100, 40, 40);
EXPECT_TRUE(FPDFPath_SetFillColor(green_rect, 0, 255, 0, 128));
+
+ // Make sure we get back the same color we set previously.
+ unsigned int R;
+ unsigned int G;
+ unsigned int B;
+ unsigned int A;
+ EXPECT_TRUE(FPDFPath_GetFillColor(green_rect, &R, &G, &B, &A));
+ EXPECT_EQ(0U, R);
+ EXPECT_EQ(255U, G);
+ EXPECT_EQ(0U, B);
+ EXPECT_EQ(128U, A);
+
EXPECT_TRUE(FPDFPath_SetDrawMode(green_rect, FPDF_FILLMODE_WINDING, 0));
FPDFPage_InsertObject(page, green_rect);
EXPECT_TRUE(FPDFPage_GenerateContent(page));
@@ -216,9 +328,8 @@ TEST_F(FPDFEditEmbeddertest, AddPaths) {
FPDFBitmap_Destroy(page_bitmap);
// Now save the result, closing the page and document
- EXPECT_TRUE(FPDF_SaveAsCopy(doc, this, 0));
+ EXPECT_TRUE(FPDF_SaveAsCopy(document(), this, 0));
FPDF_ClosePage(page);
- FPDF_CloseDocument(doc);
std::string new_file = GetString();
// Render the saved result
@@ -265,9 +376,9 @@ TEST_F(FPDFEditEmbeddertest, PathOnTopOfText) {
// Render and check the result. Text is slightly different on Mac.
FPDF_BITMAP bitmap = RenderPage(page);
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
- const char md5[] = "2f7c0deee10a9490538e195af64beb67";
+ const char md5[] = "f9e6fa74230f234286bfcada9f7606d8";
#else
- const char md5[] = "17c942c76ff229200f2c98073bb60d85";
+ const char md5[] = "2fdfc5dda29374cfba4349362e38ebdb";
#endif
CompareBitmap(bitmap, 200, 200, md5);
FPDFBitmap_Destroy(bitmap);
@@ -276,8 +387,7 @@ TEST_F(FPDFEditEmbeddertest, PathOnTopOfText) {
TEST_F(FPDFEditEmbeddertest, AddStrokedPaths) {
// Start with a blank page
- FPDF_DOCUMENT doc = FPDF_CreateNewDocument();
- FPDF_PAGE page = FPDFPage_New(doc, 0, 612, 792);
+ FPDF_PAGE page = FPDFPage_New(CreateNewDocument(), 0, 612, 792);
// Add a large stroked rectangle (fill color should not affect it).
FPDF_PAGEOBJECT rect = FPDFPageObj_CreateNewRect(20, 20, 200, 400);
@@ -322,16 +432,14 @@ TEST_F(FPDFEditEmbeddertest, AddStrokedPaths) {
CompareBitmap(page_bitmap, 612, 792, "ff3e6a22326754944cc6e56609acd73b");
FPDFBitmap_Destroy(page_bitmap);
FPDF_ClosePage(page);
- FPDF_CloseDocument(doc);
}
TEST_F(FPDFEditEmbeddertest, AddStandardFontText) {
// Start with a blank page
- FPDF_DOCUMENT doc = FPDF_CreateNewDocument();
- FPDF_PAGE page = FPDFPage_New(doc, 0, 612, 792);
+ FPDF_PAGE page = FPDFPage_New(CreateNewDocument(), 0, 612, 792);
// Add some text to the page
- FPDF_PAGEOBJECT text1 = FPDFPageObj_NewTextObj(doc, "Arial", 12.0f);
+ FPDF_PAGEOBJECT text1 = FPDFPageObj_NewTextObj(document(), "Arial", 12.0f);
EXPECT_TRUE(text1);
EXPECT_TRUE(FPDFText_SetText(text1, "I'm at the bottom of the page"));
FPDFPageObj_Transform(text1, 1, 0, 0, 1, 20, 20);
@@ -339,16 +447,16 @@ TEST_F(FPDFEditEmbeddertest, AddStandardFontText) {
EXPECT_TRUE(FPDFPage_GenerateContent(page));
FPDF_BITMAP page_bitmap = RenderPage(page);
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
- const char md5[] = "e19c90395d73cb9f37a6c3b0e8b18a9e";
+ const char md5[] = "a4dddc1a3930fa694bbff9789dab4161";
#else
- const char md5[] = "7c3a36ba7cec01688a16a14bfed9ecfc";
+ const char md5[] = "6e8a9b0682f60fd3ff1bf087b093d30d";
#endif
CompareBitmap(page_bitmap, 612, 792, md5);
FPDFBitmap_Destroy(page_bitmap);
// Try another font
FPDF_PAGEOBJECT text2 =
- FPDFPageObj_NewTextObj(doc, "TimesNewRomanBold", 15.0f);
+ FPDFPageObj_NewTextObj(document(), "TimesNewRomanBold", 15.0f);
EXPECT_TRUE(text2);
EXPECT_TRUE(FPDFText_SetText(text2, "Hi, I'm Bold. Times New Roman Bold."));
FPDFPageObj_Transform(text2, 1, 0, 0, 1, 100, 600);
@@ -356,15 +464,18 @@ TEST_F(FPDFEditEmbeddertest, AddStandardFontText) {
EXPECT_TRUE(FPDFPage_GenerateContent(page));
page_bitmap = RenderPage(page);
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
- const char md5_2[] = "8e1c43dca6be68d364dbc283f5521041";
+ const char md5_2[] = "a5c4ace4c6f27644094813fe1441a21c";
+#elif _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
+ const char md5_2[] = "56863642d4d8b418cfd810fdb5a5d92f";
#else
- const char md5_2[] = "e0e0873e3a2634a6394a431a51ce90ff";
+ const char md5_2[] = "0c83875429688bda45a55a692d5aa781";
#endif
CompareBitmap(page_bitmap, 612, 792, md5_2);
FPDFBitmap_Destroy(page_bitmap);
// And some randomly transformed text
- FPDF_PAGEOBJECT text3 = FPDFPageObj_NewTextObj(doc, "Courier-Bold", 20.0f);
+ FPDF_PAGEOBJECT text3 =
+ FPDFPageObj_NewTextObj(document(), "Courier-Bold", 20.0f);
EXPECT_TRUE(text3);
EXPECT_TRUE(FPDFText_SetText(text3, "Can you read me? <:)>"));
FPDFPageObj_Transform(text3, 1, 1.5, 2, 0.5, 200, 200);
@@ -372,9 +483,11 @@ TEST_F(FPDFEditEmbeddertest, AddStandardFontText) {
EXPECT_TRUE(FPDFPage_GenerateContent(page));
page_bitmap = RenderPage(page);
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
- const char md5_3[] = "c6e5df448428793c7e4b0c820bd8c85e";
+ const char md5_3[] = "40b3ef04f915ff4c4208948001763544";
+#elif _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
+ const char md5_3[] = "174f30c36c73adb265c0f6ddb3a61c87";
#else
- const char md5_3[] = "903ee10b6a9f0be51ecad0a1a0eeb171";
+ const char md5_3[] = "abfa9246d60f821b5b7638efd32dfd92";
#endif
CompareBitmap(page_bitmap, 612, 792, md5_3);
FPDFBitmap_Destroy(page_bitmap);
@@ -382,13 +495,11 @@ TEST_F(FPDFEditEmbeddertest, AddStandardFontText) {
// TODO(npm): Why are there issues with text rotated by 90 degrees?
// TODO(npm): FPDF_SaveAsCopy not giving the desired result after this.
FPDF_ClosePage(page);
- FPDF_CloseDocument(doc);
}
TEST_F(FPDFEditEmbeddertest, DoubleGenerating) {
// Start with a blank page
- FPDF_DOCUMENT doc = FPDF_CreateNewDocument();
- FPDF_PAGE page = FPDFPage_New(doc, 0, 612, 792);
+ FPDF_PAGE page = FPDFPage_New(CreateNewDocument(), 0, 612, 792);
// Add a red rectangle with some non-default alpha
FPDF_PAGEOBJECT rect = FPDFPageObj_CreateNewRect(10, 10, 100, 100);
@@ -427,7 +538,7 @@ TEST_F(FPDFEditEmbeddertest, DoubleGenerating) {
FPDFBitmap_Destroy(page_bitmap);
// Add some text to the page
- FPDF_PAGEOBJECT text = FPDFPageObj_NewTextObj(doc, "Arial", 12.0f);
+ FPDF_PAGEOBJECT text = FPDFPageObj_NewTextObj(document(), "Arial", 12.0f);
EXPECT_TRUE(FPDFText_SetText(text, "Something something #text# something"));
FPDFPageObj_Transform(text, 1, 0, 0, 1, 300, 300);
FPDFPage_InsertObject(page, text);
@@ -441,65 +552,161 @@ TEST_F(FPDFEditEmbeddertest, DoubleGenerating) {
EXPECT_EQ(2, static_cast<int>(graphics_dict->GetCount()));
EXPECT_EQ(1, static_cast<int>(font_dict->GetCount()));
FPDF_ClosePage(page);
- FPDF_CloseDocument(doc);
}
-TEST_F(FPDFEditEmbeddertest, Type1Font) {
- // Create a new document
- FPDF_DOCUMENT doc = FPDF_CreateNewDocument();
- CPDF_Document* document = reinterpret_cast<CPDF_Document*>(doc);
-
- // Get Times New Roman Bold as a Type 1 font
- CPDF_Font* times_bold = CPDF_Font::GetStockFont(document, "Times-Bold");
- uint8_t* data = times_bold->m_Font.GetFontData();
- uint32_t size = times_bold->m_Font.GetSize();
- FPDF_FONT font = FPDFText_LoadType1Font(doc, data, size);
+TEST_F(FPDFEditEmbeddertest, LoadSimpleType1Font) {
+ CreateNewDocument();
+ // TODO(npm): use other fonts after disallowing loading any font as any type
+ const CPDF_Font* stock_font =
+ CPDF_Font::GetStockFont(cpdf_doc(), "Times-Bold");
+ const uint8_t* data = stock_font->m_Font.GetFontData();
+ const uint32_t size = stock_font->m_Font.GetSize();
+ FPDF_FONT font =
+ FPDFText_LoadFont(document(), data, size, FPDF_FONT_TYPE1, false);
ASSERT_TRUE(font);
- CPDF_Font* type1_font = reinterpret_cast<CPDF_Font*>(font);
- EXPECT_TRUE(type1_font->IsType1Font());
+ CPDF_Font* typed_font = reinterpret_cast<CPDF_Font*>(font);
+ EXPECT_TRUE(typed_font->IsType1Font());
- // Check that the font dictionary has the required keys according to the spec
- CPDF_Dictionary* font_dict = type1_font->GetFontDict();
+ CPDF_Dictionary* font_dict = typed_font->GetFontDict();
EXPECT_EQ("Font", font_dict->GetStringFor("Type"));
EXPECT_EQ("Type1", font_dict->GetStringFor("Subtype"));
EXPECT_EQ("Times New Roman Bold", font_dict->GetStringFor("BaseFont"));
ASSERT_TRUE(font_dict->KeyExist("FirstChar"));
ASSERT_TRUE(font_dict->KeyExist("LastChar"));
EXPECT_EQ(32, font_dict->GetIntegerFor("FirstChar"));
- EXPECT_EQ(65532, font_dict->GetIntegerFor("LastChar"));
- ASSERT_TRUE(font_dict->KeyExist("Widths"));
+ EXPECT_EQ(255, font_dict->GetIntegerFor("LastChar"));
+
CPDF_Array* widths_array = font_dict->GetArrayFor("Widths");
- EXPECT_EQ(65501U, widths_array->GetCount());
+ ASSERT_TRUE(widths_array);
+ ASSERT_EQ(224U, widths_array->GetCount());
EXPECT_EQ(250, widths_array->GetNumberAt(0));
- EXPECT_EQ(0, widths_array->GetNumberAt(8172));
- EXPECT_EQ(1000, widths_array->GetNumberAt(65500));
- ASSERT_TRUE(font_dict->KeyExist("FontDescriptor"));
- CPDF_Dictionary* font_desc = font_dict->GetDictFor("FontDescriptor");
- EXPECT_EQ("FontDescriptor", font_desc->GetStringFor("Type"));
- EXPECT_EQ(font_dict->GetStringFor("BaseFont"),
- font_desc->GetStringFor("FontName"));
-
- // Check that the font descriptor has the required keys according to the spec
- ASSERT_TRUE(font_desc->KeyExist("Flags"));
- int font_flags = font_desc->GetIntegerFor("Flags");
- EXPECT_TRUE(font_flags & FXFONT_BOLD);
- EXPECT_TRUE(font_flags & FXFONT_NONSYMBOLIC);
- ASSERT_TRUE(font_desc->KeyExist("FontBBox"));
- EXPECT_EQ(4U, font_desc->GetArrayFor("FontBBox")->GetCount());
- EXPECT_TRUE(font_desc->KeyExist("ItalicAngle"));
- EXPECT_TRUE(font_desc->KeyExist("Ascent"));
- EXPECT_TRUE(font_desc->KeyExist("Descent"));
- EXPECT_TRUE(font_desc->KeyExist("CapHeight"));
- EXPECT_TRUE(font_desc->KeyExist("StemV"));
- ASSERT_TRUE(font_desc->KeyExist("FontFile"));
-
- // Check that the font stream is the one that was provided
- CPDF_Stream* font_stream = font_desc->GetStreamFor("FontFile");
- ASSERT_EQ(size, font_stream->GetRawSize());
- uint8_t* stream_data = font_stream->GetRawData();
- for (size_t i = 0; i < size; i++)
- EXPECT_EQ(data[i], stream_data[i]);
-
- // Close document
- FPDF_CloseDocument(doc);
+ EXPECT_EQ(569, widths_array->GetNumberAt(11));
+ EXPECT_EQ(500, widths_array->GetNumberAt(223));
+ CheckFontDescriptor(font_dict, FPDF_FONT_TYPE1, true, false, size, data);
+}
+
+TEST_F(FPDFEditEmbeddertest, LoadSimpleTrueTypeFont) {
+ CreateNewDocument();
+ const CPDF_Font* stock_font = CPDF_Font::GetStockFont(cpdf_doc(), "Courier");
+ const uint8_t* data = stock_font->m_Font.GetFontData();
+ const uint32_t size = stock_font->m_Font.GetSize();
+ FPDF_FONT font =
+ FPDFText_LoadFont(document(), data, size, FPDF_FONT_TRUETYPE, false);
+ ASSERT_TRUE(font);
+ CPDF_Font* typed_font = reinterpret_cast<CPDF_Font*>(font);
+ EXPECT_TRUE(typed_font->IsTrueTypeFont());
+
+ CPDF_Dictionary* font_dict = typed_font->GetFontDict();
+ EXPECT_EQ("Font", font_dict->GetStringFor("Type"));
+ EXPECT_EQ("TrueType", font_dict->GetStringFor("Subtype"));
+ EXPECT_EQ("Courier New", font_dict->GetStringFor("BaseFont"));
+ ASSERT_TRUE(font_dict->KeyExist("FirstChar"));
+ ASSERT_TRUE(font_dict->KeyExist("LastChar"));
+ EXPECT_EQ(32, font_dict->GetIntegerFor("FirstChar"));
+ EXPECT_EQ(255, font_dict->GetIntegerFor("LastChar"));
+
+ CPDF_Array* widths_array = font_dict->GetArrayFor("Widths");
+ ASSERT_TRUE(widths_array);
+ ASSERT_EQ(224U, widths_array->GetCount());
+ EXPECT_EQ(600, widths_array->GetNumberAt(33));
+ EXPECT_EQ(600, widths_array->GetNumberAt(74));
+ EXPECT_EQ(600, widths_array->GetNumberAt(223));
+ CheckFontDescriptor(font_dict, FPDF_FONT_TRUETYPE, false, false, size, data);
+}
+
+TEST_F(FPDFEditEmbeddertest, LoadCIDType0Font) {
+ CreateNewDocument();
+ const CPDF_Font* stock_font =
+ CPDF_Font::GetStockFont(cpdf_doc(), "Times-Roman");
+ const uint8_t* data = stock_font->m_Font.GetFontData();
+ const uint32_t size = stock_font->m_Font.GetSize();
+ FPDF_FONT font =
+ FPDFText_LoadFont(document(), data, size, FPDF_FONT_TYPE1, 1);
+ ASSERT_TRUE(font);
+ CPDF_Font* typed_font = reinterpret_cast<CPDF_Font*>(font);
+ EXPECT_TRUE(typed_font->IsCIDFont());
+
+ // Check font dictionary entries
+ CPDF_Dictionary* font_dict = typed_font->GetFontDict();
+ EXPECT_EQ("Font", font_dict->GetStringFor("Type"));
+ EXPECT_EQ("Type0", font_dict->GetStringFor("Subtype"));
+ EXPECT_EQ("Times New Roman-Identity-H", font_dict->GetStringFor("BaseFont"));
+ EXPECT_EQ("Identity-H", font_dict->GetStringFor("Encoding"));
+ CPDF_Array* descendant_array = font_dict->GetArrayFor("DescendantFonts");
+ ASSERT_TRUE(descendant_array);
+ EXPECT_EQ(1U, descendant_array->GetCount());
+
+ // Check the CIDFontDict
+ CPDF_Dictionary* cidfont_dict = descendant_array->GetDictAt(0);
+ EXPECT_EQ("Font", cidfont_dict->GetStringFor("Type"));
+ EXPECT_EQ("CIDFontType0", cidfont_dict->GetStringFor("Subtype"));
+ EXPECT_EQ("Times New Roman", cidfont_dict->GetStringFor("BaseFont"));
+ CPDF_Dictionary* cidinfo_dict = cidfont_dict->GetDictFor("CIDSystemInfo");
+ ASSERT_TRUE(cidinfo_dict);
+ EXPECT_EQ("Adobe", cidinfo_dict->GetStringFor("Registry"));
+ EXPECT_EQ("Identity", cidinfo_dict->GetStringFor("Ordering"));
+ EXPECT_EQ(0, cidinfo_dict->GetNumberFor("Supplement"));
+ CheckFontDescriptor(cidfont_dict, FPDF_FONT_TYPE1, false, false, size, data);
+
+ // Check widths
+ CPDF_Array* widths_array = cidfont_dict->GetArrayFor("W");
+ ASSERT_TRUE(widths_array);
+ // Note: widths can be described in different ways in the widths array. The
+ // following checks are specific to our current implementation.
+ EXPECT_EQ(32, widths_array->GetNumberAt(0));
+ CPDF_Array* arr = widths_array->GetArrayAt(1);
+ ASSERT_TRUE(arr);
+ // This font support chars 32 to 126
+ EXPECT_EQ(95U, arr->GetCount());
+ EXPECT_EQ(250, arr->GetNumberAt(0));
+ EXPECT_EQ(610, arr->GetNumberAt(44));
+ EXPECT_EQ(541, arr->GetNumberAt(94));
+ // Next range: 160 - 383
+ EXPECT_EQ(160, widths_array->GetNumberAt(2));
+ arr = widths_array->GetArrayAt(3);
+ ASSERT_TRUE(arr);
+
+ CheckCompositeFontWidths(widths_array, typed_font);
+}
+
+TEST_F(FPDFEditEmbeddertest, LoadCIDType2Font) {
+ CreateNewDocument();
+ const CPDF_Font* stock_font =
+ CPDF_Font::GetStockFont(cpdf_doc(), "Helvetica-Oblique");
+ const uint8_t* data = stock_font->m_Font.GetFontData();
+ const uint32_t size = stock_font->m_Font.GetSize();
+
+ FPDF_FONT font =
+ FPDFText_LoadFont(document(), data, size, FPDF_FONT_TRUETYPE, 1);
+ ASSERT_TRUE(font);
+ CPDF_Font* typed_font = reinterpret_cast<CPDF_Font*>(font);
+ EXPECT_TRUE(typed_font->IsCIDFont());
+
+ // Check font dictionary entries
+ CPDF_Dictionary* font_dict = typed_font->GetFontDict();
+ EXPECT_EQ("Font", font_dict->GetStringFor("Type"));
+ EXPECT_EQ("Type0", font_dict->GetStringFor("Subtype"));
+ EXPECT_EQ("Arial Italic", font_dict->GetStringFor("BaseFont"));
+ EXPECT_EQ("Identity-H", font_dict->GetStringFor("Encoding"));
+ CPDF_Array* descendant_array = font_dict->GetArrayFor("DescendantFonts");
+ ASSERT_TRUE(descendant_array);
+ EXPECT_EQ(1U, descendant_array->GetCount());
+
+ // Check the CIDFontDict
+ CPDF_Dictionary* cidfont_dict = descendant_array->GetDictAt(0);
+ EXPECT_EQ("Font", cidfont_dict->GetStringFor("Type"));
+ EXPECT_EQ("CIDFontType2", cidfont_dict->GetStringFor("Subtype"));
+ EXPECT_EQ("Arial Italic", cidfont_dict->GetStringFor("BaseFont"));
+ CPDF_Dictionary* cidinfo_dict = cidfont_dict->GetDictFor("CIDSystemInfo");
+ ASSERT_TRUE(cidinfo_dict);
+ EXPECT_EQ("Adobe", cidinfo_dict->GetStringFor("Registry"));
+ EXPECT_EQ("Identity", cidinfo_dict->GetStringFor("Ordering"));
+ EXPECT_EQ(0, cidinfo_dict->GetNumberFor("Supplement"));
+ CheckFontDescriptor(cidfont_dict, FPDF_FONT_TRUETYPE, false, true, size,
+ data);
+
+ // Check widths
+ CPDF_Array* widths_array = cidfont_dict->GetArrayFor("W");
+ ASSERT_TRUE(widths_array);
+ CheckCompositeFontWidths(widths_array, typed_font);
}
diff --git a/chromium/third_party/pdfium/fpdfsdk/fpdfeditimg.cpp b/chromium/third_party/pdfium/fpdfsdk/fpdfeditimg.cpp
index 56875e233e1..4738bd13250 100644
--- a/chromium/third_party/pdfium/fpdfsdk/fpdfeditimg.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/fpdfeditimg.cpp
@@ -13,22 +13,13 @@
#include "fpdfsdk/fsdk_define.h"
#include "third_party/base/ptr_util.h"
-DLLEXPORT FPDF_PAGEOBJECT STDCALL
-FPDFPageObj_NewImgeObj(FPDF_DOCUMENT document) {
- CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
- if (!pDoc)
- return nullptr;
+namespace {
- CPDF_ImageObject* pImageObj = new CPDF_ImageObject;
- pImageObj->SetOwnedImage(pdfium::MakeUnique<CPDF_Image>(pDoc));
- return pImageObj;
-}
-
-FPDF_BOOL FPDFImageObj_LoadJpegHelper(FPDF_PAGE* pages,
- int nCount,
- FPDF_PAGEOBJECT image_object,
- FPDF_FILEACCESS* fileAccess,
- bool inlineJpeg) {
+bool LoadJpegHelper(FPDF_PAGE* pages,
+ int nCount,
+ FPDF_PAGEOBJECT image_object,
+ FPDF_FILEACCESS* fileAccess,
+ bool inlineJpeg) {
if (!image_object || !fileAccess || !pages)
return false;
@@ -49,13 +40,30 @@ FPDF_BOOL FPDFImageObj_LoadJpegHelper(FPDF_PAGE* pages,
return true;
}
+} // namespace
+
+DLLEXPORT FPDF_PAGEOBJECT STDCALL
+FPDFPageObj_NewImageObj(FPDF_DOCUMENT document) {
+ CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
+ if (!pDoc)
+ return nullptr;
+
+ auto pImageObj = pdfium::MakeUnique<CPDF_ImageObject>();
+ pImageObj->SetImage(pdfium::MakeRetain<CPDF_Image>(pDoc));
+ return pImageObj.release();
+}
+
+DLLEXPORT FPDF_PAGEOBJECT STDCALL
+FPDFPageObj_NewImgeObj(FPDF_DOCUMENT document) {
+ return FPDFPageObj_NewImageObj(document);
+}
+
DLLEXPORT FPDF_BOOL STDCALL
FPDFImageObj_LoadJpegFile(FPDF_PAGE* pages,
int nCount,
FPDF_PAGEOBJECT image_object,
FPDF_FILEACCESS* fileAccess) {
- return FPDFImageObj_LoadJpegHelper(pages, nCount, image_object, fileAccess,
- false);
+ return LoadJpegHelper(pages, nCount, image_object, fileAccess, false);
}
DLLEXPORT FPDF_BOOL STDCALL
@@ -63,8 +71,7 @@ FPDFImageObj_LoadJpegFileInline(FPDF_PAGE* pages,
int nCount,
FPDF_PAGEOBJECT image_object,
FPDF_FILEACCESS* fileAccess) {
- return FPDFImageObj_LoadJpegHelper(pages, nCount, image_object, fileAccess,
- true);
+ return LoadJpegHelper(pages, nCount, image_object, fileAccess, true);
}
DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_SetMatrix(FPDF_PAGEOBJECT image_object,
@@ -78,10 +85,9 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_SetMatrix(FPDF_PAGEOBJECT image_object,
return false;
CPDF_ImageObject* pImgObj = reinterpret_cast<CPDF_ImageObject*>(image_object);
- pImgObj->set_matrix(
- CFX_Matrix(static_cast<FX_FLOAT>(a), static_cast<FX_FLOAT>(b),
- static_cast<FX_FLOAT>(c), static_cast<FX_FLOAT>(d),
- static_cast<FX_FLOAT>(e), static_cast<FX_FLOAT>(f)));
+ pImgObj->set_matrix(CFX_Matrix(static_cast<float>(a), static_cast<float>(b),
+ static_cast<float>(c), static_cast<float>(d),
+ static_cast<float>(e), static_cast<float>(f)));
pImgObj->CalcBoundingBox();
return true;
}
@@ -99,7 +105,8 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_SetBitmap(FPDF_PAGE* pages,
if (pPage)
pImgObj->GetImage()->ResetCache(pPage, nullptr);
}
- pImgObj->GetImage()->SetImage(reinterpret_cast<CFX_DIBitmap*>(bitmap));
+ CFX_RetainPtr<CFX_DIBitmap> holder(CFXBitmapFromFPDFBitmap(bitmap));
+ pImgObj->GetImage()->SetImage(holder);
pImgObj->CalcBoundingBox();
return true;
}
diff --git a/chromium/third_party/pdfium/fpdfsdk/fpdfeditimg_unittest.cpp b/chromium/third_party/pdfium/fpdfsdk/fpdfeditimg_unittest.cpp
index ae4af2591e0..da6930caed0 100644
--- a/chromium/third_party/pdfium/fpdfsdk/fpdfeditimg_unittest.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/fpdfeditimg_unittest.cpp
@@ -27,7 +27,7 @@ TEST_F(PDFEditTest, InsertObjectWithInvalidPage) {
FPDFPage_InsertObject(page, nullptr);
EXPECT_EQ(0, FPDFPage_CountObject(page));
- FPDF_PAGEOBJECT page_image = FPDFPageObj_NewImgeObj(doc);
+ FPDF_PAGEOBJECT page_image = FPDFPageObj_NewImageObj(doc);
FPDFPage_InsertObject(nullptr, page_image);
EXPECT_EQ(0, FPDFPage_CountObject(page));
@@ -35,12 +35,12 @@ TEST_F(PDFEditTest, InsertObjectWithInvalidPage) {
FPDF_CloseDocument(doc);
}
-TEST_F(PDFEditTest, NewImgeObj) {
+TEST_F(PDFEditTest, NewImageObj) {
FPDF_DOCUMENT doc = FPDF_CreateNewDocument();
FPDF_PAGE page = FPDFPage_New(doc, 0, 100, 100);
EXPECT_EQ(0, FPDFPage_CountObject(page));
- FPDF_PAGEOBJECT page_image = FPDFPageObj_NewImgeObj(doc);
+ FPDF_PAGEOBJECT page_image = FPDFPageObj_NewImageObj(doc);
FPDFPage_InsertObject(page, page_image);
EXPECT_EQ(1, FPDFPage_CountObject(page));
EXPECT_TRUE(FPDFPage_GenerateContent(page));
@@ -49,7 +49,7 @@ TEST_F(PDFEditTest, NewImgeObj) {
FPDF_CloseDocument(doc);
}
-TEST_F(PDFEditTest, NewImgeObjGenerateContent) {
+TEST_F(PDFEditTest, NewImageObjGenerateContent) {
FPDF_DOCUMENT doc = FPDF_CreateNewDocument();
FPDF_PAGE page = FPDFPage_New(doc, 0, 100, 100);
EXPECT_EQ(0, FPDFPage_CountObject(page));
@@ -60,7 +60,7 @@ TEST_F(PDFEditTest, NewImgeObjGenerateContent) {
EXPECT_EQ(kBitmapSize, FPDFBitmap_GetWidth(bitmap));
EXPECT_EQ(kBitmapSize, FPDFBitmap_GetHeight(bitmap));
- FPDF_PAGEOBJECT page_image = FPDFPageObj_NewImgeObj(doc);
+ FPDF_PAGEOBJECT page_image = FPDFPageObj_NewImageObj(doc);
ASSERT_TRUE(FPDFImageObj_SetBitmap(&page, 0, page_image, bitmap));
ASSERT_TRUE(
FPDFImageObj_SetMatrix(page_image, kBitmapSize, 0, 0, kBitmapSize, 0, 0));
diff --git a/chromium/third_party/pdfium/fpdfsdk/fpdfeditpage.cpp b/chromium/third_party/pdfium/fpdfsdk/fpdfeditpage.cpp
index 63740ba083f..511b7f5b4b0 100644
--- a/chromium/third_party/pdfium/fpdfsdk/fpdfeditpage.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/fpdfeditpage.cpp
@@ -104,7 +104,7 @@ DLLEXPORT FPDF_PAGE STDCALL FPDFPage_New(FPDF_DOCUMENT document,
if (!pDoc)
return nullptr;
- page_index = std::min(std::max(page_index, 0), pDoc->GetPageCount());
+ page_index = pdfium::clamp(page_index, 0, pDoc->GetPageCount());
CPDF_Dictionary* pPageDict = pDoc->CreateNewPage(page_index);
if (!pPageDict)
return nullptr;
@@ -112,8 +112,8 @@ DLLEXPORT FPDF_PAGE STDCALL FPDFPage_New(FPDF_DOCUMENT document,
CPDF_Array* pMediaBoxArray = pPageDict->SetNewFor<CPDF_Array>("MediaBox");
pMediaBoxArray->AddNew<CPDF_Number>(0);
pMediaBoxArray->AddNew<CPDF_Number>(0);
- pMediaBoxArray->AddNew<CPDF_Number>(static_cast<FX_FLOAT>(width));
- pMediaBoxArray->AddNew<CPDF_Number>(static_cast<FX_FLOAT>(height));
+ pMediaBoxArray->AddNew<CPDF_Number>(static_cast<float>(width));
+ pMediaBoxArray->AddNew<CPDF_Number>(static_cast<float>(height));
pPageDict->SetNewFor<CPDF_Number>("Rotate", 0);
pPageDict->SetNewFor<CPDF_Dictionary>("Resources");
@@ -246,6 +246,14 @@ FPDFPageObj_HasTransparency(FPDF_PAGEOBJECT pageObject) {
return false;
}
+DLLEXPORT int STDCALL FPDFPageObj_GetType(FPDF_PAGEOBJECT pageObject) {
+ if (!pageObject)
+ return FPDF_PAGEOBJ_UNKNOWN;
+
+ CPDF_PageObject* pPageObj = reinterpret_cast<CPDF_PageObject*>(pageObject);
+ return pPageObj->GetType();
+}
+
DLLEXPORT FPDF_BOOL STDCALL FPDFPage_GenerateContent(FPDF_PAGE page) {
CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
if (!IsPageObject(pPage))
@@ -267,8 +275,7 @@ DLLEXPORT void STDCALL FPDFPageObj_Transform(FPDF_PAGEOBJECT page_object,
if (!pPageObj)
return;
- CFX_Matrix matrix((FX_FLOAT)a, (FX_FLOAT)b, (FX_FLOAT)c, (FX_FLOAT)d,
- (FX_FLOAT)e, (FX_FLOAT)f);
+ CFX_Matrix matrix((float)a, (float)b, (float)c, (float)d, (float)e, (float)f);
pPageObj->Transform(matrix);
}
@@ -287,8 +294,8 @@ DLLEXPORT void STDCALL FPDFPage_TransformAnnots(FPDF_PAGE page,
for (size_t i = 0; i < AnnotList.Count(); ++i) {
CPDF_Annot* pAnnot = AnnotList.GetAt(i);
CFX_FloatRect rect = pAnnot->GetRect(); // transformAnnots Rectangle
- CFX_Matrix matrix((FX_FLOAT)a, (FX_FLOAT)b, (FX_FLOAT)c, (FX_FLOAT)d,
- (FX_FLOAT)e, (FX_FLOAT)f);
+ CFX_Matrix matrix((float)a, (float)b, (float)c, (float)d, (float)e,
+ (float)f);
matrix.TransformRect(rect);
CPDF_Array* pRectArray = pAnnot->GetAnnotDict()->GetArrayFor("Rect");
diff --git a/chromium/third_party/pdfium/fpdfsdk/fpdfeditpath.cpp b/chromium/third_party/pdfium/fpdfsdk/fpdfeditpath.cpp
index 074f083bb18..155dda5c7de 100644
--- a/chromium/third_party/pdfium/fpdfsdk/fpdfeditpath.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/fpdfeditpath.cpp
@@ -33,9 +33,9 @@ DLLEXPORT FPDF_BOOL FPDFPath_SetStrokeColor(FPDF_PAGEOBJECT path,
if (!path || R > 255 || G > 255 || B > 255 || A > 255)
return false;
- auto pPathObj = reinterpret_cast<CPDF_PathObject*>(path);
+ auto* pPathObj = reinterpret_cast<CPDF_PathObject*>(path);
pPathObj->m_GeneralState.SetStrokeAlpha(A / 255.f);
- FX_FLOAT rgb[3] = {R / 255.f, G / 255.f, B / 255.f};
+ float rgb[3] = {R / 255.f, G / 255.f, B / 255.f};
pPathObj->m_ColorState.SetStrokeColor(
CPDF_ColorSpace::GetStockCS(PDFCS_DEVICERGB), rgb, 3);
return true;
@@ -45,7 +45,7 @@ DLLEXPORT FPDF_BOOL FPDFPath_SetStrokeWidth(FPDF_PAGEOBJECT path, float width) {
if (!path || width < 0.0f)
return false;
- auto pPathObj = reinterpret_cast<CPDF_PathObject*>(path);
+ auto* pPathObj = reinterpret_cast<CPDF_PathObject*>(path);
pPathObj->m_GraphState.SetLineWidth(width);
return true;
}
@@ -58,19 +58,37 @@ DLLEXPORT FPDF_BOOL FPDFPath_SetFillColor(FPDF_PAGEOBJECT path,
if (!path || R > 255 || G > 255 || B > 255 || A > 255)
return false;
- auto pPathObj = reinterpret_cast<CPDF_PathObject*>(path);
+ auto* pPathObj = reinterpret_cast<CPDF_PathObject*>(path);
pPathObj->m_GeneralState.SetFillAlpha(A / 255.f);
- FX_FLOAT rgb[3] = {R / 255.f, G / 255.f, B / 255.f};
+ float rgb[3] = {R / 255.f, G / 255.f, B / 255.f};
pPathObj->m_ColorState.SetFillColor(
CPDF_ColorSpace::GetStockCS(PDFCS_DEVICERGB), rgb, 3);
return true;
}
+DLLEXPORT FPDF_BOOL FPDFPath_GetFillColor(FPDF_PAGEOBJECT path,
+ unsigned int* R,
+ unsigned int* G,
+ unsigned int* B,
+ unsigned int* A) {
+ if (!path || !R || !G || !B || !A)
+ return false;
+
+ auto* pPathObj = reinterpret_cast<CPDF_PathObject*>(path);
+ uint32_t fillRGB = pPathObj->m_ColorState.GetFillRGB();
+ *R = FXSYS_GetRValue(fillRGB);
+ *G = FXSYS_GetGValue(fillRGB);
+ *B = FXSYS_GetBValue(fillRGB);
+ *A = static_cast<unsigned int>(pPathObj->m_GeneralState.GetFillAlpha() *
+ 255.f);
+ return true;
+}
+
DLLEXPORT FPDF_BOOL FPDFPath_MoveTo(FPDF_PAGEOBJECT path, float x, float y) {
if (!path)
return false;
- auto pPathObj = reinterpret_cast<CPDF_PathObject*>(path);
+ auto* pPathObj = reinterpret_cast<CPDF_PathObject*>(path);
pPathObj->m_Path.AppendPoint(CFX_PointF(x, y), FXPT_TYPE::MoveTo, false);
return true;
}
@@ -79,7 +97,7 @@ DLLEXPORT FPDF_BOOL FPDFPath_LineTo(FPDF_PAGEOBJECT path, float x, float y) {
if (!path)
return false;
- auto pPathObj = reinterpret_cast<CPDF_PathObject*>(path);
+ auto* pPathObj = reinterpret_cast<CPDF_PathObject*>(path);
pPathObj->m_Path.AppendPoint(CFX_PointF(x, y), FXPT_TYPE::LineTo, false);
return true;
}
@@ -94,7 +112,7 @@ DLLEXPORT FPDF_BOOL FPDFPath_BezierTo(FPDF_PAGEOBJECT path,
if (!path)
return false;
- auto pPathObj = reinterpret_cast<CPDF_PathObject*>(path);
+ auto* pPathObj = reinterpret_cast<CPDF_PathObject*>(path);
pPathObj->m_Path.AppendPoint(CFX_PointF(x1, y1), FXPT_TYPE::BezierTo, false);
pPathObj->m_Path.AppendPoint(CFX_PointF(x2, y2), FXPT_TYPE::BezierTo, false);
pPathObj->m_Path.AppendPoint(CFX_PointF(x3, y3), FXPT_TYPE::BezierTo, false);
@@ -105,7 +123,7 @@ DLLEXPORT FPDF_BOOL FPDFPath_Close(FPDF_PAGEOBJECT path) {
if (!path)
return false;
- auto pPathObj = reinterpret_cast<CPDF_PathObject*>(path);
+ auto* pPathObj = reinterpret_cast<CPDF_PathObject*>(path);
if (pPathObj->m_Path.GetPoints().empty())
return false;
@@ -119,7 +137,7 @@ DLLEXPORT FPDF_BOOL FPDFPath_SetDrawMode(FPDF_PAGEOBJECT path,
if (!path)
return false;
- auto pPathObj = reinterpret_cast<CPDF_PathObject*>(path);
+ auto* pPathObj = reinterpret_cast<CPDF_PathObject*>(path);
if (fillmode == FPDF_FILLMODE_ALTERNATE)
pPathObj->m_FillType = FXFILL_ALTERNATE;
diff --git a/chromium/third_party/pdfium/fpdfsdk/fpdfedittext.cpp b/chromium/third_party/pdfium/fpdfsdk/fpdfedittext.cpp
index 8bf0a0ac467..aec6050d216 100644
--- a/chromium/third_party/pdfium/fpdfsdk/fpdfedittext.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/fpdfedittext.cpp
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <memory>
#include <utility>
#include "core/fpdfapi/cpdf_modulemgr.h"
@@ -20,87 +21,28 @@
#include "fpdfsdk/fsdk_define.h"
#include "public/fpdf_edit.h"
-DLLEXPORT FPDF_PAGEOBJECT STDCALL FPDFPageObj_NewTextObj(FPDF_DOCUMENT document,
- FPDF_BYTESTRING font,
- float font_size) {
- CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
- if (!pDoc)
- return nullptr;
-
- CPDF_Font* pFont = CPDF_Font::GetStockFont(pDoc, CFX_ByteStringC(font));
- if (!pFont)
- return nullptr;
-
- CPDF_TextObject* pTextObj = new CPDF_TextObject;
- pTextObj->m_TextState.SetFont(pFont);
- pTextObj->m_TextState.SetFontSize(font_size);
- pTextObj->DefaultStates();
- return pTextObj;
-}
-
-DLLEXPORT FPDF_BOOL STDCALL FPDFText_SetText(FPDF_PAGEOBJECT text_object,
- FPDF_BYTESTRING text) {
- if (!text_object)
- return false;
-
- auto pTextObj = reinterpret_cast<CPDF_TextObject*>(text_object);
- pTextObj->SetText(CFX_ByteString(text));
- return true;
-}
-
-DLLEXPORT FPDF_FONT STDCALL FPDFText_LoadType1Font(FPDF_DOCUMENT document,
- const uint8_t* data,
- uint32_t size) {
- CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
- if (!pDoc || !data || size == 0)
- return nullptr;
-
- auto pFont = pdfium::MakeUnique<CFX_Font>();
-
- // TODO(npm): Maybe use FT_Get_X11_Font_Format to check format?
- if (!pFont->LoadEmbedded(data, size))
- return nullptr;
-
- CPDF_Dictionary* fontDict = pDoc->NewIndirect<CPDF_Dictionary>();
- fontDict->SetNewFor<CPDF_Name>("Type", "Font");
- fontDict->SetNewFor<CPDF_Name>("Subtype", "Type1");
- CFX_ByteString name = pFont->GetFaceName();
- if (name.IsEmpty())
- name = "Unnamed";
- fontDict->SetNewFor<CPDF_Name>("BaseFont", name);
+namespace {
- uint32_t glyphIndex;
- int currentChar = FXFT_Get_First_Char(pFont->GetFace(), &glyphIndex);
- fontDict->SetNewFor<CPDF_Number>("FirstChar", currentChar);
- int nextChar;
- CPDF_Array* widthsArray = pDoc->NewIndirect<CPDF_Array>();
- while (true) {
- int width = pFont->GetGlyphWidth(glyphIndex);
- widthsArray->AddNew<CPDF_Number>(width);
- nextChar = FXFT_Get_Next_Char(pFont->GetFace(), currentChar, &glyphIndex);
- if (glyphIndex == 0)
- break;
- for (int i = currentChar + 1; i < nextChar; i++)
- widthsArray->AddNew<CPDF_Number>(0);
- currentChar = nextChar;
- }
- fontDict->SetNewFor<CPDF_Number>("LastChar", currentChar);
- fontDict->SetNewFor<CPDF_Reference>("Widths", pDoc, widthsArray->GetObjNum());
+CPDF_Dictionary* LoadFontDesc(CPDF_Document* pDoc,
+ const CFX_ByteString& font_name,
+ CFX_Font* pFont,
+ const uint8_t* data,
+ uint32_t size,
+ int font_type) {
CPDF_Dictionary* fontDesc = pDoc->NewIndirect<CPDF_Dictionary>();
fontDesc->SetNewFor<CPDF_Name>("Type", "FontDescriptor");
- fontDesc->SetNewFor<CPDF_Name>("FontName", name);
+ fontDesc->SetNewFor<CPDF_Name>("FontName", font_name);
int flags = 0;
if (FXFT_Is_Face_fixedwidth(pFont->GetFace()))
flags |= FXFONT_FIXED_PITCH;
- if (name.Find("Serif") > -1)
+ if (font_name.Find("Serif") > -1)
flags |= FXFONT_SERIF;
if (FXFT_Is_Face_Italic(pFont->GetFace()))
flags |= FXFONT_ITALIC;
if (FXFT_Is_Face_Bold(pFont->GetFace()))
flags |= FXFONT_BOLD;
- // TODO(npm): How do I know if a Type1 font is symbolic, script, allcap,
- // smallcap
+ // TODO(npm): How do I know if a font is symbolic, script, allcap, smallcap
flags |= FXFONT_NONSYMBOLIC;
fontDesc->SetNewFor<CPDF_Number>("Flags", flags);
@@ -125,8 +67,203 @@ DLLEXPORT FPDF_FONT STDCALL FPDFText_LoadType1Font(FPDF_DOCUMENT document,
CPDF_Stream* pStream = pDoc->NewIndirect<CPDF_Stream>();
pStream->SetData(data, size);
- fontDesc->SetNewFor<CPDF_Reference>("FontFile", pDoc, pStream->GetObjNum());
+ CFX_ByteString fontFile =
+ font_type == FPDF_FONT_TYPE1 ? "FontFile" : "FontFile2";
+ fontDesc->SetNewFor<CPDF_Reference>(fontFile, pDoc, pStream->GetObjNum());
+ return fontDesc;
+}
+
+void* LoadSimpleFont(CPDF_Document* pDoc,
+ std::unique_ptr<CFX_Font> pFont,
+ const uint8_t* data,
+ uint32_t size,
+ int font_type) {
+ CPDF_Dictionary* fontDict = pDoc->NewIndirect<CPDF_Dictionary>();
+ fontDict->SetNewFor<CPDF_Name>("Type", "Font");
+ fontDict->SetNewFor<CPDF_Name>(
+ "Subtype", font_type == FPDF_FONT_TYPE1 ? "Type1" : "TrueType");
+ CFX_ByteString name = pFont->GetFaceName();
+ if (name.IsEmpty())
+ name = "Unnamed";
+ fontDict->SetNewFor<CPDF_Name>("BaseFont", name);
+
+ uint32_t glyphIndex;
+ int currentChar = FXFT_Get_First_Char(pFont->GetFace(), &glyphIndex);
+ fontDict->SetNewFor<CPDF_Number>("FirstChar", currentChar);
+ CPDF_Array* widthsArray = pDoc->NewIndirect<CPDF_Array>();
+ while (true) {
+ int width = pFont->GetGlyphWidth(glyphIndex);
+ widthsArray->AddNew<CPDF_Number>(width);
+ int nextChar =
+ FXFT_Get_Next_Char(pFont->GetFace(), currentChar, &glyphIndex);
+ // Simple fonts have 1-byte charcodes only.
+ if (nextChar > 0xff || glyphIndex == 0)
+ break;
+ for (int i = currentChar + 1; i < nextChar; i++)
+ widthsArray->AddNew<CPDF_Number>(0);
+ currentChar = nextChar;
+ }
+ fontDict->SetNewFor<CPDF_Number>("LastChar", currentChar);
+ fontDict->SetNewFor<CPDF_Reference>("Widths", pDoc, widthsArray->GetObjNum());
+ CPDF_Dictionary* fontDesc =
+ LoadFontDesc(pDoc, name, pFont.get(), data, size, font_type);
+
fontDict->SetNewFor<CPDF_Reference>("FontDescriptor", pDoc,
fontDesc->GetObjNum());
return pDoc->LoadFont(fontDict);
}
+
+void* LoadCompositeFont(CPDF_Document* pDoc,
+ std::unique_ptr<CFX_Font> pFont,
+ const uint8_t* data,
+ uint32_t size,
+ int font_type) {
+ CPDF_Dictionary* fontDict = pDoc->NewIndirect<CPDF_Dictionary>();
+ fontDict->SetNewFor<CPDF_Name>("Type", "Font");
+ fontDict->SetNewFor<CPDF_Name>("Subtype", "Type0");
+ // TODO(npm): Get the correct encoding, if it's not identity.
+ CFX_ByteString encoding = "Identity-H";
+ fontDict->SetNewFor<CPDF_Name>("Encoding", encoding);
+ CFX_ByteString name = pFont->GetFaceName();
+ if (name.IsEmpty())
+ name = "Unnamed";
+ fontDict->SetNewFor<CPDF_Name>(
+ "BaseFont", font_type == FPDF_FONT_TYPE1 ? name + "-" + encoding : name);
+
+ CPDF_Dictionary* pCIDFont = pDoc->NewIndirect<CPDF_Dictionary>();
+ pCIDFont->SetNewFor<CPDF_Name>("Type", "Font");
+ pCIDFont->SetNewFor<CPDF_Name>("Subtype", font_type == FPDF_FONT_TYPE1
+ ? "CIDFontType0"
+ : "CIDFontType2");
+ pCIDFont->SetNewFor<CPDF_Name>("BaseFont", name);
+
+ // TODO(npm): Maybe use FT_Get_CID_Registry_Ordering_Supplement to get the
+ // CIDSystemInfo
+ CPDF_Dictionary* pCIDSystemInfo = pDoc->NewIndirect<CPDF_Dictionary>();
+ pCIDSystemInfo->SetNewFor<CPDF_Name>("Registry", "Adobe");
+ pCIDSystemInfo->SetNewFor<CPDF_Name>("Ordering", "Identity");
+ pCIDSystemInfo->SetNewFor<CPDF_Number>("Supplement", 0);
+ pCIDFont->SetNewFor<CPDF_Reference>("CIDSystemInfo", pDoc,
+ pCIDSystemInfo->GetObjNum());
+
+ CPDF_Dictionary* fontDesc =
+ LoadFontDesc(pDoc, name, pFont.get(), data, size, font_type);
+ pCIDFont->SetNewFor<CPDF_Reference>("FontDescriptor", pDoc,
+ fontDesc->GetObjNum());
+
+ uint32_t glyphIndex;
+ int currentChar = FXFT_Get_First_Char(pFont->GetFace(), &glyphIndex);
+ CPDF_Array* widthsArray = pDoc->NewIndirect<CPDF_Array>();
+ while (true) {
+ int width = pFont->GetGlyphWidth(glyphIndex);
+ int nextChar =
+ FXFT_Get_Next_Char(pFont->GetFace(), currentChar, &glyphIndex);
+ if (glyphIndex == 0) {
+ // Only one char left, use format c [w]
+ auto oneW = pdfium::MakeUnique<CPDF_Array>();
+ oneW->AddNew<CPDF_Number>(width);
+ widthsArray->AddNew<CPDF_Number>(currentChar);
+ widthsArray->Add(std::move(oneW));
+ break;
+ }
+ int nextWidth = pFont->GetGlyphWidth(glyphIndex);
+ if (nextChar == currentChar + 1 && nextWidth == width) {
+ // The array can have a group c_first c_last w: all CIDs in the range from
+ // c_first to c_last will have width w
+ widthsArray->AddNew<CPDF_Number>(currentChar);
+ currentChar = nextChar;
+ while (true) {
+ nextChar =
+ FXFT_Get_Next_Char(pFont->GetFace(), currentChar, &glyphIndex);
+ if (glyphIndex == 0)
+ break;
+ nextWidth = pFont->GetGlyphWidth(glyphIndex);
+ if (nextChar != currentChar + 1 || nextWidth != width)
+ break;
+ currentChar = nextChar;
+ }
+ widthsArray->AddNew<CPDF_Number>(currentChar);
+ widthsArray->AddNew<CPDF_Number>(width);
+ } else {
+ // Otherwise we can have a group of the form c [w1 w2 ...]: c has width
+ // w1, c+1 has width w2, etc.
+ widthsArray->AddNew<CPDF_Number>(currentChar);
+ auto curWidthArray = pdfium::MakeUnique<CPDF_Array>();
+ curWidthArray->AddNew<CPDF_Number>(width);
+ while (nextChar == currentChar + 1) {
+ curWidthArray->AddNew<CPDF_Number>(nextWidth);
+ currentChar = nextChar;
+ nextChar =
+ FXFT_Get_Next_Char(pFont->GetFace(), currentChar, &glyphIndex);
+ if (glyphIndex == 0)
+ break;
+ nextWidth = pFont->GetGlyphWidth(glyphIndex);
+ }
+ widthsArray->Add(std::move(curWidthArray));
+ }
+ if (glyphIndex == 0)
+ break;
+ currentChar = nextChar;
+ }
+ pCIDFont->SetNewFor<CPDF_Reference>("W", pDoc, widthsArray->GetObjNum());
+ // TODO(npm): Support vertical writing
+
+ auto pDescendant = pdfium::MakeUnique<CPDF_Array>();
+ pDescendant->AddNew<CPDF_Reference>(pDoc, pCIDFont->GetObjNum());
+ fontDict->SetFor("DescendantFonts", std::move(pDescendant));
+ // TODO(npm): do we need a ToUnicode?
+ return pDoc->LoadFont(fontDict);
+}
+
+} // namespace
+
+DLLEXPORT FPDF_PAGEOBJECT STDCALL FPDFPageObj_NewTextObj(FPDF_DOCUMENT document,
+ FPDF_BYTESTRING font,
+ float font_size) {
+ CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
+ if (!pDoc)
+ return nullptr;
+
+ CPDF_Font* pFont = CPDF_Font::GetStockFont(pDoc, CFX_ByteStringC(font));
+ if (!pFont)
+ return nullptr;
+
+ CPDF_TextObject* pTextObj = new CPDF_TextObject;
+ pTextObj->m_TextState.SetFont(pFont);
+ pTextObj->m_TextState.SetFontSize(font_size);
+ pTextObj->DefaultStates();
+ return pTextObj;
+}
+
+DLLEXPORT FPDF_BOOL STDCALL FPDFText_SetText(FPDF_PAGEOBJECT text_object,
+ FPDF_BYTESTRING text) {
+ if (!text_object)
+ return false;
+
+ auto* pTextObj = reinterpret_cast<CPDF_TextObject*>(text_object);
+ pTextObj->SetText(CFX_ByteString(text));
+ return true;
+}
+
+DLLEXPORT FPDF_FONT STDCALL FPDFText_LoadFont(FPDF_DOCUMENT document,
+ const uint8_t* data,
+ uint32_t size,
+ int font_type,
+ FPDF_BOOL cid) {
+ CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
+ if (!pDoc || !data || size == 0 ||
+ (font_type != FPDF_FONT_TYPE1 && font_type != FPDF_FONT_TRUETYPE)) {
+ return nullptr;
+ }
+
+ auto pFont = pdfium::MakeUnique<CFX_Font>();
+
+ // TODO(npm): Maybe use FT_Get_X11_Font_Format to check format? Otherwise, we
+ // are allowing giving any font that can be loaded on freetype and setting it
+ // as any font type.
+ if (!pFont->LoadEmbedded(data, size))
+ return nullptr;
+
+ return cid ? LoadCompositeFont(pDoc, std::move(pFont), data, size, font_type)
+ : LoadSimpleFont(pDoc, std::move(pFont), data, size, font_type);
+}
diff --git a/chromium/third_party/pdfium/fpdfsdk/fpdfformfill.cpp b/chromium/third_party/pdfium/fpdfsdk/fpdfformfill.cpp
index 57ff6b669c9..6610f81c652 100644
--- a/chromium/third_party/pdfium/fpdfsdk/fpdfformfill.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/fpdfformfill.cpp
@@ -29,9 +29,16 @@
#ifdef PDF_ENABLE_XFA
#include "fpdfsdk/fpdfxfa/cpdfxfa_context.h"
#include "fpdfsdk/fpdfxfa/cpdfxfa_page.h"
-#include "xfa/fxfa/xfa_ffdocview.h"
-#include "xfa/fxfa/xfa_ffpageview.h"
-#include "xfa/fxfa/xfa_ffwidget.h"
+#include "xfa/fxfa/cxfa_ffdocview.h"
+#include "xfa/fxfa/cxfa_ffpageview.h"
+#include "xfa/fxfa/cxfa_ffwidget.h"
+
+static_assert(static_cast<int>(XFA_DocType::PDF) == DOCTYPE_PDF,
+ "PDF doctype must match");
+static_assert(static_cast<int>(XFA_DocType::Dynamic) == DOCTYPE_DYNAMIC_XFA,
+ "Dynamic XFA doctype must match");
+static_assert(static_cast<int>(XFA_DocType::Static) == DOCTYPE_STATIC_XFA,
+ "Static XFA doctype must match");
#endif // PDF_ENABLE_XFA
namespace {
@@ -102,11 +109,12 @@ void FFLCommon(FPDF_FORMHANDLE hHandle,
pPage->GetDisplayMatrix(start_x, start_y, size_x, size_y, rotate);
FX_RECT clip(start_x, start_y, start_x + size_x, start_y + size_y);
- std::unique_ptr<CFX_FxgeDevice> pDevice(new CFX_FxgeDevice);
+ auto pDevice = pdfium::MakeUnique<CFX_FxgeDevice>();
#ifdef _SKIA_SUPPORT_
pDevice->AttachRecorder(static_cast<SkPictureRecorder*>(recorder));
#endif
- pDevice->Attach(CFXBitmapFromFPDFBitmap(bitmap), false, nullptr, false);
+ CFX_RetainPtr<CFX_DIBitmap> holder(CFXBitmapFromFPDFBitmap(bitmap));
+ pDevice->Attach(holder, false, nullptr, false);
pDevice->SaveState();
pDevice->SetClip_Rect(clip);
@@ -140,7 +148,7 @@ void FFLCommon(FPDF_FORMHANDLE hHandle,
pDevice->RestoreState(false);
#ifdef _SKIA_SUPPORT_PATHS_
pDevice->Flush();
- CFXBitmapFromFPDFBitmap(bitmap)->UnPreMultiply();
+ holder->UnPreMultiply();
#endif
}
@@ -156,8 +164,8 @@ DLLEXPORT int STDCALL FPDFPage_HasFormFieldAtPoint(FPDF_FORMHANDLE hHandle,
if (pPage) {
CPDF_InterForm interform(pPage->m_pDocument);
CPDF_FormControl* pFormCtrl = interform.GetControlAtPoint(
- pPage, CFX_PointF(static_cast<FX_FLOAT>(page_x),
- static_cast<FX_FLOAT>(page_y)),
+ pPage,
+ CFX_PointF(static_cast<float>(page_x), static_cast<float>(page_y)),
nullptr);
if (!pFormCtrl)
return -1;
@@ -198,8 +206,8 @@ DLLEXPORT int STDCALL FPDFPage_HasFormFieldAtPoint(FPDF_FORMHANDLE hHandle,
rcWidget.bottom -= 1.0f;
rcWidget.top += 1.0f;
- if (rcWidget.Contains(CFX_PointF(static_cast<FX_FLOAT>(page_x),
- static_cast<FX_FLOAT>(page_y)))) {
+ if (rcWidget.Contains(CFX_PointF(static_cast<float>(page_x),
+ static_cast<float>(page_y)))) {
return FPDF_FORMFIELD_XFA;
}
pXFAAnnot = pWidgetIterator->MoveToNext();
@@ -227,8 +235,7 @@ DLLEXPORT int STDCALL FPDFPage_FormFieldZOrderAtPoint(FPDF_FORMHANDLE hHandle,
CPDF_InterForm interform(pPage->m_pDocument);
int z_order = -1;
(void)interform.GetControlAtPoint(
- pPage,
- CFX_PointF(static_cast<FX_FLOAT>(page_x), static_cast<FX_FLOAT>(page_y)),
+ pPage, CFX_PointF(static_cast<float>(page_x), static_cast<float>(page_y)),
&z_order);
return z_order;
}
@@ -318,7 +325,7 @@ DLLEXPORT FPDF_BOOL STDCALL FORM_OnLButtonUp(FPDF_FORMHANDLE hHandle,
if (!pPageView)
return false;
- CFX_PointF pt((FX_FLOAT)page_x, (FX_FLOAT)page_y);
+ CFX_PointF pt((float)page_x, (float)page_y);
return pPageView->OnLButtonUp(pt, modifier);
}
@@ -343,7 +350,7 @@ DLLEXPORT FPDF_BOOL STDCALL FORM_OnRButtonUp(FPDF_FORMHANDLE hHandle,
if (!pPageView)
return false;
- CFX_PointF pt((FX_FLOAT)page_x, (FX_FLOAT)page_y);
+ CFX_PointF pt((float)page_x, (float)page_y);
return pPageView->OnRButtonUp(pt, modifier);
}
#endif // PDF_ENABLE_XFA
@@ -424,9 +431,10 @@ DLLEXPORT void STDCALL FPDF_Widget_Undo(FPDF_DOCUMENT document,
return;
CPDFXFA_Context* pContext = static_cast<CPDFXFA_Context*>(document);
- if (pContext->GetDocType() != XFA_DOCTYPE_Dynamic &&
- pContext->GetDocType() != XFA_DOCTYPE_Static)
+ if (pContext->GetDocType() != XFA_DocType::Dynamic &&
+ pContext->GetDocType() != XFA_DocType::Static) {
return;
+ }
static_cast<CXFA_FFWidget*>(hWidget)->Undo();
}
@@ -437,8 +445,8 @@ DLLEXPORT void STDCALL FPDF_Widget_Redo(FPDF_DOCUMENT document,
return;
CPDFXFA_Context* pContext = static_cast<CPDFXFA_Context*>(document);
- if (pContext->GetDocType() != XFA_DOCTYPE_Dynamic &&
- pContext->GetDocType() != XFA_DOCTYPE_Static)
+ if (pContext->GetDocType() != XFA_DocType::Dynamic &&
+ pContext->GetDocType() != XFA_DocType::Static)
return;
static_cast<CXFA_FFWidget*>(hWidget)->Redo();
@@ -450,8 +458,8 @@ DLLEXPORT void STDCALL FPDF_Widget_SelectAll(FPDF_DOCUMENT document,
return;
CPDFXFA_Context* pContext = static_cast<CPDFXFA_Context*>(document);
- if (pContext->GetDocType() != XFA_DOCTYPE_Dynamic &&
- pContext->GetDocType() != XFA_DOCTYPE_Static)
+ if (pContext->GetDocType() != XFA_DocType::Dynamic &&
+ pContext->GetDocType() != XFA_DocType::Static)
return;
static_cast<CXFA_FFWidget*>(hWidget)->SelectAll();
@@ -465,8 +473,8 @@ DLLEXPORT void STDCALL FPDF_Widget_Copy(FPDF_DOCUMENT document,
return;
CPDFXFA_Context* pContext = static_cast<CPDFXFA_Context*>(document);
- if (pContext->GetDocType() != XFA_DOCTYPE_Dynamic &&
- pContext->GetDocType() != XFA_DOCTYPE_Static)
+ if (pContext->GetDocType() != XFA_DocType::Dynamic &&
+ pContext->GetDocType() != XFA_DocType::Static)
return;
CFX_WideString wsCpText;
@@ -481,9 +489,9 @@ DLLEXPORT void STDCALL FPDF_Widget_Copy(FPDF_DOCUMENT document,
uint32_t real_size = len < *size ? len : *size;
if (real_size > 0) {
- FXSYS_memcpy((void*)wsText,
- bsCpText.GetBuffer(real_size * sizeof(unsigned short)),
- real_size * sizeof(unsigned short));
+ memcpy((void*)wsText,
+ bsCpText.GetBuffer(real_size * sizeof(unsigned short)),
+ real_size * sizeof(unsigned short));
bsCpText.ReleaseBuffer(real_size * sizeof(unsigned short));
}
*size = real_size;
@@ -497,8 +505,8 @@ DLLEXPORT void STDCALL FPDF_Widget_Cut(FPDF_DOCUMENT document,
return;
CPDFXFA_Context* pContext = static_cast<CPDFXFA_Context*>(document);
- if (pContext->GetDocType() != XFA_DOCTYPE_Dynamic &&
- pContext->GetDocType() != XFA_DOCTYPE_Static)
+ if (pContext->GetDocType() != XFA_DocType::Dynamic &&
+ pContext->GetDocType() != XFA_DocType::Static)
return;
CFX_WideString wsCpText;
@@ -513,9 +521,9 @@ DLLEXPORT void STDCALL FPDF_Widget_Cut(FPDF_DOCUMENT document,
uint32_t real_size = len < *size ? len : *size;
if (real_size > 0) {
- FXSYS_memcpy((void*)wsText,
- bsCpText.GetBuffer(real_size * sizeof(unsigned short)),
- real_size * sizeof(unsigned short));
+ memcpy((void*)wsText,
+ bsCpText.GetBuffer(real_size * sizeof(unsigned short)),
+ real_size * sizeof(unsigned short));
bsCpText.ReleaseBuffer(real_size * sizeof(unsigned short));
}
*size = real_size;
@@ -529,8 +537,8 @@ DLLEXPORT void STDCALL FPDF_Widget_Paste(FPDF_DOCUMENT document,
return;
CPDFXFA_Context* pContext = static_cast<CPDFXFA_Context*>(document);
- if (pContext->GetDocType() != XFA_DOCTYPE_Dynamic &&
- pContext->GetDocType() != XFA_DOCTYPE_Static)
+ if (pContext->GetDocType() != XFA_DocType::Dynamic &&
+ pContext->GetDocType() != XFA_DocType::Static)
return;
CFX_WideString wstr = CFX_WideString::FromUTF16LE(wsText, size);
@@ -547,8 +555,8 @@ FPDF_Widget_ReplaceSpellCheckWord(FPDF_DOCUMENT document,
return;
CPDFXFA_Context* pContext = static_cast<CPDFXFA_Context*>(document);
- if (pContext->GetDocType() != XFA_DOCTYPE_Dynamic &&
- pContext->GetDocType() != XFA_DOCTYPE_Static)
+ if (pContext->GetDocType() != XFA_DocType::Dynamic &&
+ pContext->GetDocType() != XFA_DocType::Static)
return;
CFX_PointF ptPopup;
@@ -568,8 +576,8 @@ FPDF_Widget_GetSpellCheckWords(FPDF_DOCUMENT document,
return;
CPDFXFA_Context* pContext = static_cast<CPDFXFA_Context*>(document);
- if (pContext->GetDocType() != XFA_DOCTYPE_Dynamic &&
- pContext->GetDocType() != XFA_DOCTYPE_Static)
+ if (pContext->GetDocType() != XFA_DocType::Dynamic &&
+ pContext->GetDocType() != XFA_DocType::Static)
return;
std::vector<CFX_ByteString>* sSuggestWords = new std::vector<CFX_ByteString>;
@@ -607,7 +615,7 @@ FPDF_StringHandleGetStringByIndex(FPDF_STRINGHANDLE sHandle,
uint32_t real_size = len < *size ? len : *size;
if (real_size > 0)
- FXSYS_memcpy((void*)bsText, (*sSuggestWords)[index].c_str(), real_size);
+ memcpy((void*)bsText, (*sSuggestWords)[index].c_str(), real_size);
*size = real_size;
return true;
}
diff --git a/chromium/third_party/pdfium/fpdfsdk/fpdfppo.cpp b/chromium/third_party/pdfium/fpdfsdk/fpdfppo.cpp
index 4e06856455c..e2ef406b058 100644
--- a/chromium/third_party/pdfium/fpdfsdk/fpdfppo.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/fpdfppo.cpp
@@ -210,16 +210,18 @@ bool CPDF_PageOrganizer::ExportPage(const std::vector<uint16_t>& pageNums,
}
// inheritable item
+ // Even though some entries are required by the PDF spec, there exist
+ // PDFs that omit them. Set some defaults in this case.
// 1 MediaBox - required
if (!CopyInheritable(pCurPageDict, pSrcPageDict, "MediaBox")) {
- // Search for "CropBox" in the source page dictionary,
- // if it does not exists, use the default letter size.
+ // Search for "CropBox" in the source page dictionary.
+ // If it does not exist, use the default letter size.
CPDF_Object* pInheritable =
PageDictGetInheritableTag(pSrcPageDict, "CropBox");
if (pInheritable) {
pCurPageDict->SetFor("MediaBox", pInheritable->Clone());
} else {
- // Make the default size to be letter size (8.5'x11')
+ // Make the default size letter size (8.5"x11")
CPDF_Array* pArray = pCurPageDict->SetNewFor<CPDF_Array>("MediaBox");
pArray->AddNew<CPDF_Number>(0);
pArray->AddNew<CPDF_Number>(0);
@@ -229,8 +231,10 @@ bool CPDF_PageOrganizer::ExportPage(const std::vector<uint16_t>& pageNums,
}
// 2 Resources - required
- if (!CopyInheritable(pCurPageDict, pSrcPageDict, "Resources"))
- return false;
+ if (!CopyInheritable(pCurPageDict, pSrcPageDict, "Resources")) {
+ // Use a default empty resources if it does not exist.
+ pCurPageDict->SetNewFor<CPDF_Dictionary>("Resources");
+ }
// 3 CropBox - optional
CopyInheritable(pCurPageDict, pSrcPageDict, "CropBox");
diff --git a/chromium/third_party/pdfium/fpdfsdk/fpdfppo_embeddertest.cpp b/chromium/third_party/pdfium/fpdfsdk/fpdfppo_embeddertest.cpp
index 09723165341..7e6ff33fc3c 100644
--- a/chromium/third_party/pdfium/fpdfsdk/fpdfppo_embeddertest.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/fpdfppo_embeddertest.cpp
@@ -1,11 +1,11 @@
// Copyright 2016 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-
-#include "public/fpdf_ppo.h"
+#include <string>
#include "core/fxcrt/fx_basic.h"
#include "public/fpdf_edit.h"
+#include "public/fpdf_ppo.h"
#include "public/fpdfview.h"
#include "testing/embedder_test.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -15,6 +15,12 @@ namespace {
class FPDFPPOEmbeddertest : public EmbedderTest {};
+int FakeBlockWriter(FPDF_FILEWRITE* pThis,
+ const void* pData,
+ unsigned long size) {
+ return size;
+}
+
} // namespace
TEST_F(FPDFPPOEmbeddertest, NoViewerPreferences) {
@@ -36,13 +42,13 @@ TEST_F(FPDFPPOEmbeddertest, ViewerPreferences) {
}
TEST_F(FPDFPPOEmbeddertest, ImportPages) {
- EXPECT_TRUE(OpenDocument("viewer_ref.pdf"));
+ ASSERT_TRUE(OpenDocument("viewer_ref.pdf"));
FPDF_PAGE page = LoadPage(0);
EXPECT_TRUE(page);
FPDF_DOCUMENT output_doc = FPDF_CreateNewDocument();
- EXPECT_TRUE(output_doc);
+ ASSERT_TRUE(output_doc);
EXPECT_TRUE(FPDF_CopyViewerPreferences(output_doc, document()));
EXPECT_TRUE(FPDF_ImportPages(output_doc, document(), "1", 0));
EXPECT_EQ(1, FPDF_GetPageCount(output_doc));
@@ -51,6 +57,36 @@ TEST_F(FPDFPPOEmbeddertest, ImportPages) {
UnloadPage(page);
}
+TEST_F(FPDFPPOEmbeddertest, BadRepeatViewerPref) {
+ ASSERT_TRUE(OpenDocument("repeat_viewer_ref.pdf"));
+
+ FPDF_DOCUMENT output_doc = FPDF_CreateNewDocument();
+ EXPECT_TRUE(output_doc);
+ EXPECT_TRUE(FPDF_CopyViewerPreferences(output_doc, document()));
+
+ FPDF_FILEWRITE writer;
+ writer.version = 1;
+ writer.WriteBlock = FakeBlockWriter;
+
+ EXPECT_TRUE(FPDF_SaveAsCopy(output_doc, &writer, 0));
+ FPDF_CloseDocument(output_doc);
+}
+
+TEST_F(FPDFPPOEmbeddertest, BadCircularViewerPref) {
+ ASSERT_TRUE(OpenDocument("circular_viewer_ref.pdf"));
+
+ FPDF_DOCUMENT output_doc = FPDF_CreateNewDocument();
+ EXPECT_TRUE(output_doc);
+ EXPECT_TRUE(FPDF_CopyViewerPreferences(output_doc, document()));
+
+ FPDF_FILEWRITE writer;
+ writer.version = 1;
+ writer.WriteBlock = FakeBlockWriter;
+
+ EXPECT_TRUE(FPDF_SaveAsCopy(output_doc, &writer, 0));
+ FPDF_CloseDocument(output_doc);
+}
+
TEST_F(FPDFPPOEmbeddertest, BadRanges) {
EXPECT_TRUE(OpenDocument("viewer_ref.pdf"));
@@ -95,7 +131,7 @@ TEST_F(FPDFPPOEmbeddertest, BUG_664284) {
EXPECT_TRUE(OpenDocument("bug_664284.pdf"));
FPDF_PAGE page = LoadPage(0);
- EXPECT_TRUE(page);
+ ASSERT_NE(nullptr, page);
FPDF_DOCUMENT output_doc = FPDF_CreateNewDocument();
EXPECT_TRUE(output_doc);
@@ -104,3 +140,37 @@ TEST_F(FPDFPPOEmbeddertest, BUG_664284) {
UnloadPage(page);
}
+
+TEST_F(FPDFPPOEmbeddertest, ImportWithZeroLengthStream) {
+ EXPECT_TRUE(OpenDocument("zero_length_stream.pdf"));
+ FPDF_PAGE page = LoadPage(0);
+ ASSERT_NE(nullptr, page);
+
+ FPDF_BITMAP bitmap = RenderPage(page);
+ ASSERT_EQ(200, FPDFBitmap_GetWidth(bitmap));
+ ASSERT_EQ(200, FPDFBitmap_GetHeight(bitmap));
+ ASSERT_EQ(800, FPDFBitmap_GetStride(bitmap));
+
+ std::string digest = HashBitmap(bitmap, 200, 200);
+ FPDFBitmap_Destroy(bitmap);
+ FPDF_ClosePage(page);
+
+ FPDF_DOCUMENT new_doc = FPDF_CreateNewDocument();
+ EXPECT_TRUE(new_doc);
+ EXPECT_TRUE(FPDF_ImportPages(new_doc, document(), "1", 0));
+
+ EXPECT_EQ(1, FPDF_GetPageCount(new_doc));
+ FPDF_PAGE new_page = FPDF_LoadPage(new_doc, 0);
+ ASSERT_NE(nullptr, new_page);
+ FPDF_BITMAP new_bitmap = RenderPage(new_page);
+ ASSERT_EQ(200, FPDFBitmap_GetWidth(new_bitmap));
+ ASSERT_EQ(200, FPDFBitmap_GetHeight(new_bitmap));
+ ASSERT_EQ(800, FPDFBitmap_GetStride(new_bitmap));
+
+ std::string new_digest = HashBitmap(new_bitmap, 200, 200);
+ FPDFBitmap_Destroy(new_bitmap);
+ FPDF_ClosePage(new_page);
+ FPDF_CloseDocument(new_doc);
+
+ EXPECT_EQ(digest, new_digest);
+}
diff --git a/chromium/third_party/pdfium/fpdfsdk/fpdfsave.cpp b/chromium/third_party/pdfium/fpdfsdk/fpdfsave.cpp
index 0cfcd4af577..004c921a523 100644
--- a/chromium/third_party/pdfium/fpdfsdk/fpdfsave.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/fpdfsave.cpp
@@ -21,14 +21,15 @@
#include "public/fpdf_edit.h"
#ifdef PDF_ENABLE_XFA
+#include "core/fxcrt/cfx_checksumcontext.h"
#include "fpdfsdk/fpdfxfa/cpdfxfa_context.h"
#include "fpdfsdk/fpdfxfa/cxfa_fwladaptertimermgr.h"
#include "public/fpdf_formfill.h"
#include "xfa/fxfa/cxfa_eventparam.h"
-#include "xfa/fxfa/xfa_checksum.h"
-#include "xfa/fxfa/xfa_ffapp.h"
-#include "xfa/fxfa/xfa_ffdocview.h"
-#include "xfa/fxfa/xfa_ffwidgethandler.h"
+#include "xfa/fxfa/cxfa_ffapp.h"
+#include "xfa/fxfa/cxfa_ffdocview.h"
+#include "xfa/fxfa/cxfa_ffwidgethandler.h"
+#include "xfa/fxfa/cxfa_widgetacciterator.h"
#endif
#if _FX_OS_ == _FX_ANDROID_
@@ -40,10 +41,14 @@
class CFX_IFileWrite final : public IFX_WriteStream {
public:
static CFX_RetainPtr<CFX_IFileWrite> Create();
+
bool Init(FPDF_FILEWRITE* pFileWriteStruct);
bool WriteBlock(const void* pData, size_t size) override;
protected:
+ template <typename T, typename... Args>
+ friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args);
+
CFX_IFileWrite();
~CFX_IFileWrite() override {}
@@ -51,7 +56,7 @@ class CFX_IFileWrite final : public IFX_WriteStream {
};
CFX_RetainPtr<CFX_IFileWrite> CFX_IFileWrite::Create() {
- return CFX_RetainPtr<CFX_IFileWrite>(new CFX_IFileWrite());
+ return pdfium::MakeRetain<CFX_IFileWrite>();
}
CFX_IFileWrite::CFX_IFileWrite() : m_pFileWriteStruct(nullptr) {}
@@ -81,9 +86,10 @@ bool SaveXFADocumentData(
if (!pContext)
return false;
- if (pContext->GetDocType() != DOCTYPE_DYNAMIC_XFA &&
- pContext->GetDocType() != DOCTYPE_STATIC_XFA)
+ if (pContext->GetDocType() != XFA_DocType::Dynamic &&
+ pContext->GetDocType() != XFA_DocType::Static) {
return true;
+ }
CXFA_FFDocView* pXFADocView = pContext->GetXFADocView();
if (!pXFADocView)
@@ -125,18 +131,16 @@ bool SaveXFADocumentData(
else if (pPDFObj->GetString() == "template")
iTemplate = i + 1;
}
- std::unique_ptr<CXFA_ChecksumContext> pChecksum(new CXFA_ChecksumContext);
+ auto pChecksum = pdfium::MakeUnique<CFX_ChecksumContext>();
pChecksum->StartChecksum();
// template
if (iTemplate > -1) {
CPDF_Stream* pTemplateStream = pArray->GetStreamAt(iTemplate);
- CPDF_StreamAcc streamAcc;
- streamAcc.LoadAllData(pTemplateStream);
- uint8_t* pData = (uint8_t*)streamAcc.GetData();
- uint32_t dwSize2 = streamAcc.GetSize();
- CFX_RetainPtr<IFX_SeekableStream> pTemplate =
- IFX_MemoryStream::Create(pData, dwSize2);
+ auto pAcc = pdfium::MakeRetain<CPDF_StreamAcc>(pTemplateStream);
+ pAcc->LoadAllData();
+ CFX_RetainPtr<IFX_SeekableStream> pTemplate = IFX_MemoryStream::Create(
+ const_cast<uint8_t*>(pAcc->GetData()), pAcc->GetSize());
pChecksum->UpdateChecksum(pTemplate);
}
CPDF_Stream* pFormStream = nullptr;
@@ -223,8 +227,8 @@ bool SendPostSaveToXFADoc(CPDFXFA_Context* pContext) {
if (!pContext)
return false;
- if (pContext->GetDocType() != DOCTYPE_DYNAMIC_XFA &&
- pContext->GetDocType() != DOCTYPE_STATIC_XFA)
+ if (pContext->GetDocType() != XFA_DocType::Dynamic &&
+ pContext->GetDocType() != XFA_DocType::Static)
return true;
CXFA_FFDocView* pXFADocView = pContext->GetXFADocView();
@@ -247,8 +251,8 @@ bool SendPostSaveToXFADoc(CPDFXFA_Context* pContext) {
bool SendPreSaveToXFADoc(
CPDFXFA_Context* pContext,
std::vector<CFX_RetainPtr<IFX_SeekableStream>>* fileList) {
- if (pContext->GetDocType() != DOCTYPE_DYNAMIC_XFA &&
- pContext->GetDocType() != DOCTYPE_STATIC_XFA)
+ if (pContext->GetDocType() != XFA_DocType::Dynamic &&
+ pContext->GetDocType() != XFA_DocType::Static)
return true;
CXFA_FFDocView* pXFADocView = pContext->GetXFADocView();
diff --git a/chromium/third_party/pdfium/fpdfsdk/fpdftext.cpp b/chromium/third_party/pdfium/fpdfsdk/fpdftext.cpp
index 0432afd7079..5abd232b53c 100644
--- a/chromium/third_party/pdfium/fpdfsdk/fpdftext.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/fpdftext.cpp
@@ -134,9 +134,9 @@ DLLEXPORT int STDCALL FPDFText_GetCharIndexAtPos(FPDF_TEXTPAGE text_page,
CPDF_TextPage* textpage = CPDFTextPageFromFPDFTextPage(text_page);
return textpage->GetIndexAtPos(
- CFX_PointF(static_cast<FX_FLOAT>(x), static_cast<FX_FLOAT>(y)),
- CFX_SizeF(static_cast<FX_FLOAT>(xTolerance),
- static_cast<FX_FLOAT>(yTolerance)));
+ CFX_PointF(static_cast<float>(x), static_cast<float>(y)),
+ CFX_SizeF(static_cast<float>(xTolerance),
+ static_cast<float>(yTolerance)));
}
DLLEXPORT int STDCALL FPDFText_GetText(FPDF_TEXTPAGE text_page,
@@ -155,8 +155,8 @@ DLLEXPORT int STDCALL FPDFText_GetText(FPDF_TEXTPAGE text_page,
str = str.Left(count);
CFX_ByteString cbUTF16str = str.UTF16LE_Encode();
- FXSYS_memcpy(result, cbUTF16str.GetBuffer(cbUTF16str.GetLength()),
- cbUTF16str.GetLength());
+ memcpy(result, cbUTF16str.GetBuffer(cbUTF16str.GetLength()),
+ cbUTF16str.GetLength());
cbUTF16str.ReleaseBuffer(cbUTF16str.GetLength());
return cbUTF16str.GetLength() / sizeof(unsigned short);
@@ -201,8 +201,7 @@ DLLEXPORT int STDCALL FPDFText_GetBoundedText(FPDF_TEXTPAGE text_page,
return 0;
CPDF_TextPage* textpage = CPDFTextPageFromFPDFTextPage(text_page);
- CFX_FloatRect rect((FX_FLOAT)left, (FX_FLOAT)bottom, (FX_FLOAT)right,
- (FX_FLOAT)top);
+ CFX_FloatRect rect((float)left, (float)bottom, (float)right, (float)top);
CFX_WideString str = textpage->GetTextByRect(rect);
if (buflen <= 0 || !buffer)
@@ -211,8 +210,8 @@ DLLEXPORT int STDCALL FPDFText_GetBoundedText(FPDF_TEXTPAGE text_page,
CFX_ByteString cbUTF16Str = str.UTF16LE_Encode();
int len = cbUTF16Str.GetLength() / sizeof(unsigned short);
int size = buflen > len ? len : buflen;
- FXSYS_memcpy(buffer, cbUTF16Str.GetBuffer(size * sizeof(unsigned short)),
- size * sizeof(unsigned short));
+ memcpy(buffer, cbUTF16Str.GetBuffer(size * sizeof(unsigned short)),
+ size * sizeof(unsigned short));
cbUTF16Str.ReleaseBuffer(size * sizeof(unsigned short));
return size;
@@ -312,7 +311,7 @@ DLLEXPORT int STDCALL FPDFLink_GetURL(FPDF_PAGELINK link_page,
int size = std::min(required, buflen);
if (size > 0) {
int buf_size = size * sizeof(unsigned short);
- FXSYS_memcpy(buffer, cbUTF16URL.GetBuffer(buf_size), buf_size);
+ memcpy(buffer, cbUTF16URL.GetBuffer(buf_size), buf_size);
}
return size;
}
diff --git a/chromium/third_party/pdfium/fpdfsdk/fpdftext_embeddertest.cpp b/chromium/third_party/pdfium/fpdfsdk/fpdftext_embeddertest.cpp
index 198ef8a7f2f..3d496bc06fb 100644
--- a/chromium/third_party/pdfium/fpdfsdk/fpdftext_embeddertest.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/fpdftext_embeddertest.cpp
@@ -370,6 +370,74 @@ TEST_F(FPDFTextEmbeddertest, WebLinks) {
UnloadPage(page);
}
+TEST_F(FPDFTextEmbeddertest, WebLinksAcrossLines) {
+ EXPECT_TRUE(OpenDocument("weblinks_across_lines.pdf"));
+ FPDF_PAGE page = LoadPage(0);
+ EXPECT_TRUE(page);
+
+ FPDF_TEXTPAGE textpage = FPDFText_LoadPage(page);
+ EXPECT_TRUE(textpage);
+
+ FPDF_PAGELINK pagelink = FPDFLink_LoadWebLinks(textpage);
+ EXPECT_TRUE(pagelink);
+
+ static const char* const kExpectedUrls[] = {
+ "http://example.com?", // from "http://www.example.com?\r\nfoo"
+ "http://example.com/", // from "http://www.example.com/\r\nfoo"
+ "http://example.com/test-foo", // from "http://example.com/test-\r\nfoo"
+ "http://abc.com/test-foo", // from "http://abc.com/test-\r\n\r\nfoo"
+ // Next two links from "http://www.example.com/\r\nhttp://www.abc.com/"
+ "http://example.com/", "http://www.abc.com",
+ };
+ static const int kNumLinks = static_cast<int>(FX_ArraySize(kExpectedUrls));
+
+ EXPECT_EQ(kNumLinks, FPDFLink_CountWebLinks(pagelink));
+
+ unsigned short fixed_buffer[128];
+ for (int i = 0; i < kNumLinks; i++) {
+ const size_t expected_len = strlen(kExpectedUrls[i]) + 1;
+ memset(fixed_buffer, 0, FX_ArraySize(fixed_buffer));
+ EXPECT_EQ(static_cast<int>(expected_len),
+ FPDFLink_GetURL(pagelink, i, nullptr, 0));
+ EXPECT_EQ(
+ static_cast<int>(expected_len),
+ FPDFLink_GetURL(pagelink, i, fixed_buffer, FX_ArraySize(fixed_buffer)));
+ EXPECT_TRUE(
+ check_unsigned_shorts(kExpectedUrls[i], fixed_buffer, expected_len));
+ }
+
+ FPDFLink_CloseWebLinks(pagelink);
+ FPDFText_ClosePage(textpage);
+ UnloadPage(page);
+}
+
+TEST_F(FPDFTextEmbeddertest, WebLinksAcrossLinesBug) {
+ EXPECT_TRUE(OpenDocument("bug_650.pdf"));
+ FPDF_PAGE page = LoadPage(0);
+ EXPECT_TRUE(page);
+
+ FPDF_TEXTPAGE textpage = FPDFText_LoadPage(page);
+ EXPECT_TRUE(textpage);
+
+ FPDF_PAGELINK pagelink = FPDFLink_LoadWebLinks(textpage);
+ EXPECT_TRUE(pagelink);
+
+ EXPECT_EQ(2, FPDFLink_CountWebLinks(pagelink));
+ unsigned short fixed_buffer[128] = {0};
+ static const char kExpectedUrl[] =
+ "http://tutorial45.com/learn-autocad-basics-day-166/";
+ static const int kUrlSize = static_cast<int>(sizeof(kExpectedUrl));
+
+ EXPECT_EQ(kUrlSize, FPDFLink_GetURL(pagelink, 1, nullptr, 0));
+ EXPECT_EQ(kUrlSize, FPDFLink_GetURL(pagelink, 1, fixed_buffer,
+ FX_ArraySize(fixed_buffer)));
+ EXPECT_TRUE(check_unsigned_shorts(kExpectedUrl, fixed_buffer, kUrlSize));
+
+ FPDFLink_CloseWebLinks(pagelink);
+ FPDFText_ClosePage(textpage);
+ UnloadPage(page);
+}
+
TEST_F(FPDFTextEmbeddertest, GetFontSize) {
EXPECT_TRUE(OpenDocument("hello_world.pdf"));
FPDF_PAGE page = LoadPage(0);
diff --git a/chromium/third_party/pdfium/fpdfsdk/fpdfview.cpp b/chromium/third_party/pdfium/fpdfsdk/fpdfview.cpp
index 1e7a651aa82..5010c17ceb8 100644
--- a/chromium/third_party/pdfium/fpdfsdk/fpdfview.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/fpdfview.cpp
@@ -33,6 +33,7 @@
#include "fpdfsdk/javascript/ijs_runtime.h"
#include "public/fpdf_ext.h"
#include "public/fpdf_progressive.h"
+#include "third_party/base/allocator/partition_allocator/partition_alloc.h"
#include "third_party/base/numerics/safe_conversions_impl.h"
#include "third_party/base/ptr_util.h"
@@ -40,8 +41,8 @@
#include "fpdfsdk/fpdfxfa/cpdfxfa_context.h"
#include "fpdfsdk/fpdfxfa/cpdfxfa_page.h"
#include "fpdfsdk/fpdfxfa/cxfa_fwladaptertimermgr.h"
+#include "fxbarcode/BC_Library.h"
#include "public/fpdf_formfill.h"
-#include "xfa/fxbarcode/BC_Library.h"
#endif // PDF_ENABLE_XFA
#ifdef PDF_ENABLE_XFA_BMP
@@ -367,6 +368,7 @@ FPDF_InitLibraryWithConfig(const FPDF_LIBRARY_CONFIG* cfg) {
if (g_pCodecModule)
return;
+ FXMEM_InitalizePartitionAlloc();
g_pCodecModule = new CCodec_ModuleMgr();
CFX_GEModule* pModule = CFX_GEModule::Get();
@@ -490,7 +492,7 @@ DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadDocument(FPDF_STRING file_path,
// NOTE: the creation of the file needs to be by the embedder on the
// other side of this API.
CFX_RetainPtr<IFX_SeekableReadStream> pFileAccess =
- IFX_SeekableReadStream::CreateFromFilename((const FX_CHAR*)file_path);
+ IFX_SeekableReadStream::CreateFromFilename((const char*)file_path);
if (!pFileAccess)
return nullptr;
@@ -556,7 +558,7 @@ class CMemFile final : public IFX_SeekableReadStream {
if (!newPos.IsValid() || newPos.ValueOrDie() > m_size)
return false;
- FXSYS_memcpy(buffer, m_pBuf + offset, size);
+ memcpy(buffer, m_pBuf + offset, size);
return true;
}
@@ -700,41 +702,39 @@ DLLEXPORT void STDCALL FPDF_RenderPage(HDC dc,
CPDF_PageRenderContext* pContext = new CPDF_PageRenderContext;
pPage->SetRenderContext(pdfium::WrapUnique(pContext));
- std::unique_ptr<CFX_DIBitmap> pBitmap;
+ CFX_RetainPtr<CFX_DIBitmap> pBitmap;
// TODO: This results in unnecessary rasterization of some PDFs due to
// HasImageMask() returning true. If any image on the page is a mask, the
// entire page gets rasterized and the spool size gets huge.
const bool bNewBitmap =
pPage->BackgroundAlphaNeeded() || pPage->HasImageMask();
if (bNewBitmap) {
- pBitmap = pdfium::MakeUnique<CFX_DIBitmap>();
+ pBitmap = pdfium::MakeRetain<CFX_DIBitmap>();
pBitmap->Create(size_x, size_y, FXDIB_Argb);
pBitmap->Clear(0x00ffffff);
CFX_FxgeDevice* pDevice = new CFX_FxgeDevice;
pContext->m_pDevice = pdfium::WrapUnique(pDevice);
- pDevice->Attach(pBitmap.get(), false, nullptr, false);
+ pDevice->Attach(pBitmap, false, nullptr, false);
} else {
pContext->m_pDevice = pdfium::MakeUnique<CFX_WindowsDevice>(dc);
}
-
FPDF_RenderPage_Retail(pContext, page, start_x, start_y, size_x, size_y,
rotate, flags, true, nullptr);
if (bNewBitmap) {
CFX_WindowsDevice WinDC(dc);
if (WinDC.GetDeviceCaps(FXDC_DEVICE_CLASS) == FXDC_PRINTER) {
- std::unique_ptr<CFX_DIBitmap> pDst = pdfium::MakeUnique<CFX_DIBitmap>();
+ auto pDst = pdfium::MakeRetain<CFX_DIBitmap>();
int pitch = pBitmap->GetPitch();
pDst->Create(size_x, size_y, FXDIB_Rgb32);
- FXSYS_memset(pDst->GetBuffer(), -1, pitch * size_y);
- pDst->CompositeBitmap(0, 0, size_x, size_y, pBitmap.get(), 0, 0,
- FXDIB_BLEND_NORMAL, nullptr, false, nullptr);
- WinDC.StretchDIBits(pDst.get(), 0, 0, size_x, size_y);
+ memset(pDst->GetBuffer(), -1, pitch * size_y);
+ pDst->CompositeBitmap(0, 0, size_x, size_y, pBitmap, 0, 0,
+ FXDIB_BLEND_NORMAL, nullptr, false);
+ WinDC.StretchDIBits(pDst, 0, 0, size_x, size_y);
} else {
- WinDC.SetDIBits(pBitmap.get(), 0, 0);
+ WinDC.SetDIBits(pBitmap, 0, 0);
}
}
-
pPage->SetRenderContext(nullptr);
}
#endif // defined(_WIN32)
@@ -756,11 +756,12 @@ DLLEXPORT void STDCALL FPDF_RenderPageBitmap(FPDF_BITMAP bitmap,
CPDF_PageRenderContext* pContext = new CPDF_PageRenderContext;
pPage->SetRenderContext(pdfium::WrapUnique(pContext));
+
CFX_FxgeDevice* pDevice = new CFX_FxgeDevice;
pContext->m_pDevice.reset(pDevice);
- CFX_DIBitmap* pBitmap = CFXBitmapFromFPDFBitmap(bitmap);
- pDevice->Attach(pBitmap, !!(flags & FPDF_REVERSE_BYTE_ORDER), nullptr, false);
+ CFX_RetainPtr<CFX_DIBitmap> pBitmap(CFXBitmapFromFPDFBitmap(bitmap));
+ pDevice->Attach(pBitmap, !!(flags & FPDF_REVERSE_BYTE_ORDER), nullptr, false);
FPDF_RenderPage_Retail(pContext, page, start_x, start_y, size_x, size_y,
rotate, flags, true, nullptr);
@@ -785,9 +786,11 @@ DLLEXPORT void STDCALL FPDF_RenderPageBitmapWithMatrix(FPDF_BITMAP bitmap,
CPDF_PageRenderContext* pContext = new CPDF_PageRenderContext;
pPage->SetRenderContext(pdfium::WrapUnique(pContext));
+
CFX_FxgeDevice* pDevice = new CFX_FxgeDevice;
pContext->m_pDevice.reset(pDevice);
- CFX_DIBitmap* pBitmap = CFXBitmapFromFPDFBitmap(bitmap);
+
+ CFX_RetainPtr<CFX_DIBitmap> pBitmap(CFXBitmapFromFPDFBitmap(bitmap));
pDevice->Attach(pBitmap, !!(flags & FPDF_REVERSE_BYTE_ORDER), nullptr, false);
CFX_Matrix transform_matrix = pPage->GetPageMatrix();
@@ -891,8 +894,8 @@ DLLEXPORT void STDCALL FPDF_DeviceToPage(FPDF_PAGE page,
CFX_Matrix device2page;
device2page.SetReverse(page2device);
- CFX_PointF pos = device2page.Transform(CFX_PointF(
- static_cast<FX_FLOAT>(device_x), static_cast<FX_FLOAT>(device_y)));
+ CFX_PointF pos = device2page.Transform(
+ CFX_PointF(static_cast<float>(device_x), static_cast<float>(device_y)));
*page_x = pos.x;
*page_y = pos.y;
@@ -921,7 +924,7 @@ DLLEXPORT void STDCALL FPDF_PageToDevice(FPDF_PAGE page,
CFX_Matrix page2device =
pPage->GetDisplayMatrix(start_x, start_y, size_x, size_y, rotate);
CFX_PointF pos = page2device.Transform(
- CFX_PointF(static_cast<FX_FLOAT>(page_x), static_cast<FX_FLOAT>(page_y)));
+ CFX_PointF(static_cast<float>(page_x), static_cast<float>(page_y)));
*device_x = FXSYS_round(pos.x);
*device_y = FXSYS_round(pos.y);
@@ -931,11 +934,11 @@ DLLEXPORT void STDCALL FPDF_PageToDevice(FPDF_PAGE page,
DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_Create(int width,
int height,
int alpha) {
- auto pBitmap = pdfium::MakeUnique<CFX_DIBitmap>();
+ auto pBitmap = pdfium::MakeRetain<CFX_DIBitmap>();
if (!pBitmap->Create(width, height, alpha ? FXDIB_Argb : FXDIB_Rgb32))
return nullptr;
- return pBitmap.release();
+ return pBitmap.Leak();
}
DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_CreateEx(int width,
@@ -960,9 +963,9 @@ DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_CreateEx(int width,
default:
return nullptr;
}
- CFX_DIBitmap* pBitmap = new CFX_DIBitmap;
+ auto pBitmap = pdfium::MakeRetain<CFX_DIBitmap>();
pBitmap->Create(width, height, fx_format, (uint8_t*)first_scan, stride);
- return pBitmap;
+ return pBitmap.Leak();
}
DLLEXPORT void STDCALL FPDFBitmap_FillRect(FPDF_BITMAP bitmap,
@@ -975,7 +978,7 @@ DLLEXPORT void STDCALL FPDFBitmap_FillRect(FPDF_BITMAP bitmap,
return;
CFX_FxgeDevice device;
- CFX_DIBitmap* pBitmap = CFXBitmapFromFPDFBitmap(bitmap);
+ CFX_RetainPtr<CFX_DIBitmap> pBitmap(CFXBitmapFromFPDFBitmap(bitmap));
device.Attach(pBitmap, false, nullptr, false);
if (!pBitmap->HasAlpha())
color |= 0xFF000000;
@@ -1000,7 +1003,8 @@ DLLEXPORT int STDCALL FPDFBitmap_GetStride(FPDF_BITMAP bitmap) {
}
DLLEXPORT void STDCALL FPDFBitmap_Destroy(FPDF_BITMAP bitmap) {
- delete CFXBitmapFromFPDFBitmap(bitmap);
+ CFX_RetainPtr<CFX_DIBitmap> destroyer;
+ destroyer.Unleak(CFXBitmapFromFPDFBitmap(bitmap));
}
void FPDF_RenderPage_Retail(CPDF_PageRenderContext* pContext,
@@ -1153,7 +1157,7 @@ DLLEXPORT FPDF_RESULT STDCALL FPDF_BStr_Init(FPDF_BSTR* str) {
if (!str)
return -1;
- FXSYS_memset(str, 0, sizeof(FPDF_BSTR));
+ memset(str, 0, sizeof(FPDF_BSTR));
return 0;
}
@@ -1182,7 +1186,7 @@ DLLEXPORT FPDF_RESULT STDCALL FPDF_BStr_Set(FPDF_BSTR* str,
str->str = FX_Alloc(char, length + 1);
str->str[length] = 0;
- FXSYS_memcpy(str->str, bstr, length);
+ memcpy(str->str, bstr, length);
str->len = length;
return 0;
@@ -1245,7 +1249,7 @@ DLLEXPORT FPDF_DEST STDCALL FPDF_GetNamedDest(FPDF_DOCUMENT document,
i++;
}
} else {
- pDestObj = nameTree.LookupValue(index, bsName);
+ pDestObj = nameTree.LookupValueAndName(index, &bsName);
}
if (!pDestObj)
return nullptr;
diff --git a/chromium/third_party/pdfium/fpdfsdk/fpdfview_c_api_test.c b/chromium/third_party/pdfium/fpdfsdk/fpdfview_c_api_test.c
index 54a33252b36..b4da951947a 100644
--- a/chromium/third_party/pdfium/fpdfsdk/fpdfview_c_api_test.c
+++ b/chromium/third_party/pdfium/fpdfsdk/fpdfview_c_api_test.c
@@ -79,8 +79,10 @@ int CheckPDFiumCApi() {
CHK(FPDFPage_HasTransparency);
CHK(FPDFPage_GenerateContent);
CHK(FPDFPageObj_HasTransparency);
+ CHK(FPDFPageObj_GetType);
CHK(FPDFPageObj_Transform);
CHK(FPDFPage_TransformAnnots);
+ CHK(FPDFPageObj_NewImageObj);
CHK(FPDFPageObj_NewImgeObj);
CHK(FPDFImageObj_LoadJpegFile);
CHK(FPDFImageObj_LoadJpegFileInline);
@@ -91,6 +93,7 @@ int CheckPDFiumCApi() {
CHK(FPDFPath_SetStrokeColor);
CHK(FPDFPath_SetStrokeWidth);
CHK(FPDFPath_SetFillColor);
+ CHK(FPDFPath_GetFillColor);
CHK(FPDFPath_MoveTo);
CHK(FPDFPath_LineTo);
CHK(FPDFPath_BezierTo);
@@ -98,7 +101,7 @@ int CheckPDFiumCApi() {
CHK(FPDFPath_SetDrawMode);
CHK(FPDFPageObj_NewTextObj);
CHK(FPDFText_SetText);
- CHK(FPDFText_LoadType1Font);
+ CHK(FPDFText_LoadFont);
// fpdf_ext.h
CHK(FSDK_SetUnSpObjProcessHandler);
@@ -168,6 +171,7 @@ int CheckPDFiumCApi() {
// fpdf_searchex.h
CHK(FPDFText_GetCharIndexFromTextIndex);
+ CHK(FPDFText_GetTextIndexFromCharIndex);
// fpdf_structtree.h
CHK(FPDF_StructTree_GetForPage);
@@ -175,6 +179,7 @@ int CheckPDFiumCApi() {
CHK(FPDF_StructTree_CountChildren);
CHK(FPDF_StructTree_GetChildAtIndex);
CHK(FPDF_StructElement_GetAltText);
+ CHK(FPDF_StructElement_GetType);
CHK(FPDF_StructElement_CountChildren);
CHK(FPDF_StructElement_GetChildAtIndex);
diff --git a/chromium/third_party/pdfium/fpdfsdk/fpdfxfa/DEPS b/chromium/third_party/pdfium/fpdfsdk/fpdfxfa/DEPS
index 1687e308b57..b437883ba99 100644
--- a/chromium/third_party/pdfium/fpdfsdk/fpdfxfa/DEPS
+++ b/chromium/third_party/pdfium/fpdfsdk/fpdfxfa/DEPS
@@ -1,4 +1,4 @@
include_rules = [
'+fxjs',
- '+xfa/fxbarcode',
+ '+fxbarcode',
]
diff --git a/chromium/third_party/pdfium/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp b/chromium/third_party/pdfium/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp
index 88c88a17480..57735426e73 100644
--- a/chromium/third_party/pdfium/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp
@@ -20,13 +20,14 @@
#include "public/fpdf_formfill.h"
#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
+#include "xfa/fxfa/cxfa_deffontmgr.h"
#include "xfa/fxfa/cxfa_eventparam.h"
-#include "xfa/fxfa/xfa_ffapp.h"
-#include "xfa/fxfa/xfa_ffdoc.h"
-#include "xfa/fxfa/xfa_ffdocview.h"
-#include "xfa/fxfa/xfa_ffpageview.h"
-#include "xfa/fxfa/xfa_ffwidgethandler.h"
-#include "xfa/fxfa/xfa_fontmgr.h"
+#include "xfa/fxfa/cxfa_ffapp.h"
+#include "xfa/fxfa/cxfa_ffdoc.h"
+#include "xfa/fxfa/cxfa_ffdocview.h"
+#include "xfa/fxfa/cxfa_ffpageview.h"
+#include "xfa/fxfa/cxfa_ffwidgethandler.h"
+#include "xfa/fxfa/cxfa_fontmgr.h"
#ifndef _WIN32
extern void SetLastError(int err);
@@ -34,7 +35,7 @@ extern int GetLastError();
#endif
CPDFXFA_Context::CPDFXFA_Context(std::unique_ptr<CPDF_Document> pPDFDoc)
- : m_iDocType(DOCTYPE_PDF),
+ : m_iDocType(XFA_DocType::PDF),
m_pPDFDoc(std::move(pPDFDoc)),
m_pFormFillEnv(nullptr),
m_pXFADocView(nullptr),
@@ -114,12 +115,12 @@ bool CPDFXFA_Context::LoadXFADoc() {
m_pXFADoc->StopLoad();
m_pXFADoc->GetXFADoc()->InitScriptContext(GetJSERuntime());
- if (m_pXFADoc->GetDocType() == XFA_DOCTYPE_Dynamic)
- m_iDocType = DOCTYPE_DYNAMIC_XFA;
+ if (m_pXFADoc->GetDocType() == XFA_DocType::Dynamic)
+ m_iDocType = XFA_DocType::Dynamic;
else
- m_iDocType = DOCTYPE_STATIC_XFA;
+ m_iDocType = XFA_DocType::Static;
- m_pXFADocView = m_pXFADoc->CreateDocView(XFA_DOCVIEW_View);
+ m_pXFADocView = m_pXFADoc->CreateDocView();
if (m_pXFADocView->StartLayout() < 0) {
CloseXFADoc();
SetLastError(FPDF_ERR_XFALAYOUT);
@@ -138,11 +139,11 @@ int CPDFXFA_Context::GetPageCount() const {
return 0;
switch (m_iDocType) {
- case DOCTYPE_PDF:
- case DOCTYPE_STATIC_XFA:
+ case XFA_DocType::PDF:
+ case XFA_DocType::Static:
if (m_pPDFDoc)
return m_pPDFDoc->GetPageCount();
- case DOCTYPE_DYNAMIC_XFA:
+ case XFA_DocType::Dynamic:
if (m_pXFADoc)
return m_pXFADocView->CountPageViews();
default:
@@ -172,10 +173,8 @@ CPDFXFA_Page* CPDFXFA_Context::GetXFAPage(int page_index) {
pPage->Release();
return nullptr;
}
- if (page_index >= 0 &&
- page_index < pdfium::CollectionSize<int>(m_XFAPageList)) {
+ if (pdfium::IndexInBounds(m_XFAPageList, page_index))
m_XFAPageList[page_index] = pPage;
- }
return pPage;
}
@@ -186,7 +185,7 @@ CPDFXFA_Page* CPDFXFA_Context::GetXFAPage(CXFA_FFPageView* pPage) const {
if (!m_pXFADoc)
return nullptr;
- if (m_iDocType != DOCTYPE_DYNAMIC_XFA)
+ if (m_iDocType != XFA_DocType::Dynamic)
return nullptr;
for (CPDFXFA_Page* pTempPage : m_XFAPageList) {
@@ -203,20 +202,17 @@ void CPDFXFA_Context::DeletePage(int page_index) {
if (m_pPDFDoc)
m_pPDFDoc->DeletePage(page_index);
- if (page_index < 0 ||
- page_index >= pdfium::CollectionSize<int>(m_XFAPageList)) {
+ if (!pdfium::IndexInBounds(m_XFAPageList, page_index))
return;
- }
+
if (CPDFXFA_Page* pPage = m_XFAPageList[page_index])
pPage->Release();
}
void CPDFXFA_Context::RemovePage(CPDFXFA_Page* page) {
int page_index = page->GetPageIndex();
- if (page_index >= 0 &&
- page_index < pdfium::CollectionSize<int>(m_XFAPageList)) {
+ if (pdfium::IndexInBounds(m_XFAPageList, page_index))
m_XFAPageList[page_index] = nullptr;
- }
}
void CPDFXFA_Context::ClearChangeMark() {
diff --git a/chromium/third_party/pdfium/fpdfsdk/fpdfxfa/cpdfxfa_context.h b/chromium/third_party/pdfium/fpdfsdk/fpdfxfa/cpdfxfa_context.h
index 9a2a517fb5a..8e6b2198af8 100644
--- a/chromium/third_party/pdfium/fpdfsdk/fpdfxfa/cpdfxfa_context.h
+++ b/chromium/third_party/pdfium/fpdfsdk/fpdfxfa/cpdfxfa_context.h
@@ -11,7 +11,7 @@
#include <vector>
#include "fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h"
-#include "xfa/fxfa/xfa_ffdoc.h"
+#include "xfa/fxfa/cxfa_ffdoc.h"
class CJS_Runtime;
class CPDFSDK_FormFillEnvironment;
@@ -37,7 +37,7 @@ class CPDFXFA_Context : public IXFA_AppProvider {
CPDF_Document* GetPDFDoc() { return m_pPDFDoc.get(); }
CXFA_FFDoc* GetXFADoc() { return m_pXFADoc.get(); }
CXFA_FFDocView* GetXFADocView() { return m_pXFADocView; }
- int GetDocType() const { return m_iDocType; }
+ XFA_DocType GetDocType() const { return m_iDocType; }
v8::Isolate* GetJSERuntime() const;
CXFA_FFApp* GetXFAApp() { return m_pXFAApp.get(); }
@@ -98,7 +98,7 @@ class CPDFXFA_Context : public IXFA_AppProvider {
private:
void CloseXFADoc();
- int m_iDocType;
+ XFA_DocType m_iDocType;
std::unique_ptr<CPDF_Document> m_pPDFDoc;
std::unique_ptr<CXFA_FFDoc> m_pXFADoc;
diff --git a/chromium/third_party/pdfium/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp b/chromium/third_party/pdfium/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
index 731b0cc2967..bd16f43ffc8 100644
--- a/chromium/third_party/pdfium/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
@@ -18,9 +18,10 @@
#include "fpdfsdk/fpdfxfa/cpdfxfa_context.h"
#include "fpdfsdk/fpdfxfa/cpdfxfa_page.h"
#include "fpdfsdk/javascript/ijs_runtime.h"
-#include "xfa/fxfa/xfa_ffdocview.h"
-#include "xfa/fxfa/xfa_ffwidget.h"
-#include "xfa/fxfa/xfa_ffwidgethandler.h"
+#include "xfa/fxfa/cxfa_ffdocview.h"
+#include "xfa/fxfa/cxfa_ffwidget.h"
+#include "xfa/fxfa/cxfa_ffwidgethandler.h"
+#include "xfa/fxfa/cxfa_widgetacciterator.h"
#define IDS_XFA_Validate_Input \
"At least one required field was empty. Please fill in the required " \
@@ -55,12 +56,11 @@ void CPDFXFA_DocEnvironment::SetChangeMark(CXFA_FFDoc* hDoc) {
}
void CPDFXFA_DocEnvironment::InvalidateRect(CXFA_FFPageView* pPageView,
- const CFX_RectF& rt,
- uint32_t dwFlags /* = 0 */) {
+ const CFX_RectF& rt) {
if (!m_pContext->GetXFADoc() || !m_pContext->GetFormFillEnv())
return;
- if (m_pContext->GetDocType() != DOCTYPE_DYNAMIC_XFA)
+ if (m_pContext->GetDocType() != XFA_DocType::Dynamic)
return;
CPDFXFA_Page* pPage = m_pContext->GetXFAPage(pPageView);
@@ -82,7 +82,7 @@ void CPDFXFA_DocEnvironment::DisplayCaret(CXFA_FFWidget* hWidget,
!m_pContext->GetFormFillEnv() || !m_pContext->GetXFADocView())
return;
- if (m_pContext->GetDocType() != DOCTYPE_DYNAMIC_XFA)
+ if (m_pContext->GetDocType() != XFA_DocType::Dynamic)
return;
CXFA_FFWidgetHandler* pWidgetHandler =
@@ -108,8 +108,8 @@ void CPDFXFA_DocEnvironment::DisplayCaret(CXFA_FFWidget* hWidget,
}
bool CPDFXFA_DocEnvironment::GetPopupPos(CXFA_FFWidget* hWidget,
- FX_FLOAT fMinPopup,
- FX_FLOAT fMaxPopup,
+ float fMinPopup,
+ float fMaxPopup,
const CFX_RectF& rtAnchor,
CFX_RectF& rtPopup) {
if (!hWidget)
@@ -185,13 +185,13 @@ bool CPDFXFA_DocEnvironment::GetPopupPos(CXFA_FFWidget* hWidget,
dwPos = 1;
}
- FX_FLOAT fPopupHeight;
+ float fPopupHeight;
if (t < fMinPopup)
fPopupHeight = fMinPopup;
else if (t > fMaxPopup)
fPopupHeight = fMaxPopup;
else
- fPopupHeight = static_cast<FX_FLOAT>(t);
+ fPopupHeight = static_cast<float>(t);
switch (nRotate) {
case 0:
@@ -289,14 +289,14 @@ void CPDFXFA_DocEnvironment::PageViewEvent(CXFA_FFPageView* pPageView,
int flag = (nNewCount < m_pContext->GetOriginalPageCount())
? FXFA_PAGEVIEWEVENT_POSTREMOVED
: FXFA_PAGEVIEWEVENT_POSTADDED;
- int count = FXSYS_abs(nNewCount - m_pContext->GetOriginalPageCount());
+ int count = abs(nNewCount - m_pContext->GetOriginalPageCount());
m_pContext->SetOriginalPageCount(nNewCount);
pFormFillEnv->PageEvent(count, flag);
}
void CPDFXFA_DocEnvironment::WidgetPostAdd(CXFA_FFWidget* hWidget,
CXFA_WidgetAcc* pWidgetData) {
- if (m_pContext->GetDocType() != DOCTYPE_DYNAMIC_XFA || !hWidget)
+ if (m_pContext->GetDocType() != XFA_DocType::Dynamic || !hWidget)
return;
CXFA_FFPageView* pPageView = hWidget->GetPageView();
@@ -312,7 +312,7 @@ void CPDFXFA_DocEnvironment::WidgetPostAdd(CXFA_FFWidget* hWidget,
void CPDFXFA_DocEnvironment::WidgetPreRemove(CXFA_FFWidget* hWidget,
CXFA_WidgetAcc* pWidgetData) {
- if (m_pContext->GetDocType() != DOCTYPE_DYNAMIC_XFA || !hWidget)
+ if (m_pContext->GetDocType() != XFA_DocType::Dynamic || !hWidget)
return;
CXFA_FFPageView* pPageView = hWidget->GetPageView();
@@ -338,7 +338,7 @@ int32_t CPDFXFA_DocEnvironment::CountPages(CXFA_FFDoc* hDoc) {
int32_t CPDFXFA_DocEnvironment::GetCurrentPage(CXFA_FFDoc* hDoc) {
if (hDoc != m_pContext->GetXFADoc() || !m_pContext->GetFormFillEnv())
return -1;
- if (m_pContext->GetDocType() != DOCTYPE_DYNAMIC_XFA)
+ if (m_pContext->GetDocType() != XFA_DocType::Dynamic)
return -1;
CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv();
@@ -351,7 +351,7 @@ int32_t CPDFXFA_DocEnvironment::GetCurrentPage(CXFA_FFDoc* hDoc) {
void CPDFXFA_DocEnvironment::SetCurrentPage(CXFA_FFDoc* hDoc,
int32_t iCurPage) {
if (hDoc != m_pContext->GetXFADoc() || !m_pContext->GetFormFillEnv() ||
- m_pContext->GetDocType() != DOCTYPE_DYNAMIC_XFA || iCurPage < 0 ||
+ m_pContext->GetDocType() != XFA_DocType::Dynamic || iCurPage < 0 ||
iCurPage >= m_pContext->GetFormFillEnv()->GetPageCount()) {
return;
}
@@ -411,8 +411,8 @@ void CPDFXFA_DocEnvironment::ExportData(CXFA_FFDoc* hDoc,
if (hDoc != m_pContext->GetXFADoc())
return;
- if (m_pContext->GetDocType() != DOCTYPE_DYNAMIC_XFA &&
- m_pContext->GetDocType() != DOCTYPE_STATIC_XFA) {
+ if (m_pContext->GetDocType() != XFA_DocType::Dynamic &&
+ m_pContext->GetDocType() != XFA_DocType::Static) {
return;
}
@@ -497,8 +497,8 @@ void CPDFXFA_DocEnvironment::ExportData(CXFA_FFDoc* hDoc,
fileWrite->WriteBlock(content.c_str(), fileWrite->GetSize(),
content.GetLength());
}
- std::unique_ptr<CPDF_StreamAcc> pAcc(new CPDF_StreamAcc);
- pAcc->LoadAllData(pStream);
+ auto pAcc = pdfium::MakeRetain<CPDF_StreamAcc>(pStream);
+ pAcc->LoadAllData();
fileWrite->WriteBlock(pAcc->GetData(), fileWrite->GetSize(),
pAcc->GetSize());
}
@@ -511,7 +511,7 @@ void CPDFXFA_DocEnvironment::GotoURL(CXFA_FFDoc* hDoc,
if (hDoc != m_pContext->GetXFADoc())
return;
- if (m_pContext->GetDocType() != DOCTYPE_DYNAMIC_XFA)
+ if (m_pContext->GetDocType() != XFA_DocType::Dynamic)
return;
CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv();
@@ -611,8 +611,8 @@ bool CPDFXFA_DocEnvironment::NotifySubmit(bool bPrevOrPost) {
}
bool CPDFXFA_DocEnvironment::OnBeforeNotifySubmit() {
- if (m_pContext->GetDocType() != DOCTYPE_DYNAMIC_XFA &&
- m_pContext->GetDocType() != DOCTYPE_STATIC_XFA) {
+ if (m_pContext->GetDocType() != XFA_DocType::Dynamic &&
+ m_pContext->GetDocType() != XFA_DocType::Static) {
return true;
}
@@ -664,8 +664,8 @@ bool CPDFXFA_DocEnvironment::OnBeforeNotifySubmit() {
}
void CPDFXFA_DocEnvironment::OnAfterNotifySubmit() {
- if (m_pContext->GetDocType() != DOCTYPE_DYNAMIC_XFA &&
- m_pContext->GetDocType() != DOCTYPE_STATIC_XFA)
+ if (m_pContext->GetDocType() != XFA_DocType::Dynamic &&
+ m_pContext->GetDocType() != XFA_DocType::Static)
return;
if (!m_pContext->GetXFADocView())
diff --git a/chromium/third_party/pdfium/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h b/chromium/third_party/pdfium/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h
index dc18d9a0c61..8f1d2381039 100644
--- a/chromium/third_party/pdfium/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h
+++ b/chromium/third_party/pdfium/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h
@@ -21,18 +21,16 @@ class CPDFXFA_DocEnvironment : public IXFA_DocEnvironment {
// IXFA_DocEnvironment
void SetChangeMark(CXFA_FFDoc* hDoc) override;
- // used in dynamic xfa, dwFlags refer to XFA_INVALIDATE_XXX macros.
- void InvalidateRect(CXFA_FFPageView* pPageView,
- const CFX_RectF& rt,
- uint32_t dwFlags) override;
- // show or hide caret
+ // Used in dynamic xfa.
+ void InvalidateRect(CXFA_FFPageView* pPageView, const CFX_RectF& rt) override;
+ // Show or hide caret.
void DisplayCaret(CXFA_FFWidget* hWidget,
bool bVisible,
const CFX_RectF* pRtAnchor) override;
// dwPos: (0:bottom 1:top)
bool GetPopupPos(CXFA_FFWidget* hWidget,
- FX_FLOAT fMinPopup,
- FX_FLOAT fMaxPopup,
+ float fMinPopup,
+ float fMaxPopup,
const CFX_RectF& rtAnchor,
CFX_RectF& rtPopup) override;
bool PopupMenu(CXFA_FFWidget* hWidget, CFX_PointF ptPopup) override;
diff --git a/chromium/third_party/pdfium/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp b/chromium/third_party/pdfium/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp
index 8b5bb3d2791..e5ab9d357f9 100644
--- a/chromium/third_party/pdfium/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp
@@ -13,8 +13,8 @@
#include "fpdfsdk/fsdk_define.h"
#include "public/fpdf_formfill.h"
#include "third_party/base/ptr_util.h"
-#include "xfa/fxfa/xfa_ffdocview.h"
-#include "xfa/fxfa/xfa_ffpageview.h"
+#include "xfa/fxfa/cxfa_ffdocview.h"
+#include "xfa/fxfa/cxfa_ffpageview.h"
CPDFXFA_Page::CPDFXFA_Page(CPDFXFA_Context* pContext, int page_index)
: m_pXFAPageView(nullptr),
@@ -70,15 +70,12 @@ bool CPDFXFA_Page::LoadPage() {
if (!m_pContext || m_iPageIndex < 0)
return false;
- int iDocType = m_pContext->GetDocType();
- switch (iDocType) {
- case DOCTYPE_PDF:
- case DOCTYPE_STATIC_XFA: {
+ switch (m_pContext->GetDocType()) {
+ case XFA_DocType::PDF:
+ case XFA_DocType::Static:
return LoadPDFPage();
- }
- case DOCTYPE_DYNAMIC_XFA: {
+ case XFA_DocType::Dynamic:
return LoadXFAPageView();
- }
default:
return false;
}
@@ -94,19 +91,18 @@ bool CPDFXFA_Page::LoadPDFPage(CPDF_Dictionary* pageDict) {
return true;
}
-FX_FLOAT CPDFXFA_Page::GetPageWidth() const {
+float CPDFXFA_Page::GetPageWidth() const {
if (!m_pPDFPage && !m_pXFAPageView)
return 0.0f;
- int nDocType = m_pContext->GetDocType();
- switch (nDocType) {
- case DOCTYPE_DYNAMIC_XFA: {
+ switch (m_pContext->GetDocType()) {
+ case XFA_DocType::Dynamic: {
if (m_pXFAPageView)
return m_pXFAPageView->GetPageViewRect().width;
break;
}
- case DOCTYPE_STATIC_XFA:
- case DOCTYPE_PDF: {
+ case XFA_DocType::Static:
+ case XFA_DocType::PDF: {
if (m_pPDFPage)
return m_pPDFPage->GetPageWidth();
break;
@@ -118,19 +114,18 @@ FX_FLOAT CPDFXFA_Page::GetPageWidth() const {
return 0.0f;
}
-FX_FLOAT CPDFXFA_Page::GetPageHeight() const {
+float CPDFXFA_Page::GetPageHeight() const {
if (!m_pPDFPage && !m_pXFAPageView)
return 0.0f;
- int nDocType = m_pContext->GetDocType();
- switch (nDocType) {
- case DOCTYPE_PDF:
- case DOCTYPE_STATIC_XFA: {
+ switch (m_pContext->GetDocType()) {
+ case XFA_DocType::PDF:
+ case XFA_DocType::Static: {
if (m_pPDFPage)
return m_pPDFPage->GetPageHeight();
break;
}
- case DOCTYPE_DYNAMIC_XFA: {
+ case XFA_DocType::Dynamic: {
if (m_pXFAPageView)
return m_pXFAPageView->GetPageViewRect().height;
break;
@@ -158,8 +153,8 @@ void CPDFXFA_Page::DeviceToPage(int start_x,
device2page.SetReverse(
GetDisplayMatrix(start_x, start_y, size_x, size_y, rotate));
- CFX_PointF pos = device2page.Transform(CFX_PointF(
- static_cast<FX_FLOAT>(device_x), static_cast<FX_FLOAT>(device_y)));
+ CFX_PointF pos = device2page.Transform(
+ CFX_PointF(static_cast<float>(device_x), static_cast<float>(device_y)));
*page_x = pos.x;
*page_y = pos.y;
@@ -181,7 +176,7 @@ void CPDFXFA_Page::PageToDevice(int start_x,
GetDisplayMatrix(start_x, start_y, size_x, size_y, rotate);
CFX_PointF pos = page2device.Transform(
- CFX_PointF(static_cast<FX_FLOAT>(page_x), static_cast<FX_FLOAT>(page_y)));
+ CFX_PointF(static_cast<float>(page_x), static_cast<float>(page_y)));
*device_x = FXSYS_round(pos.x);
*device_y = FXSYS_round(pos.y);
@@ -195,17 +190,16 @@ CFX_Matrix CPDFXFA_Page::GetDisplayMatrix(int xPos,
if (!m_pPDFPage && !m_pXFAPageView)
return CFX_Matrix();
- int nDocType = m_pContext->GetDocType();
- switch (nDocType) {
- case DOCTYPE_DYNAMIC_XFA: {
+ switch (m_pContext->GetDocType()) {
+ case XFA_DocType::Dynamic: {
if (m_pXFAPageView) {
return m_pXFAPageView->GetDisplayMatrix(
CFX_Rect(xPos, yPos, xSize, ySize), iRotate);
}
break;
}
- case DOCTYPE_PDF:
- case DOCTYPE_STATIC_XFA: {
+ case XFA_DocType::PDF:
+ case XFA_DocType::Static: {
if (m_pPDFPage)
return m_pPDFPage->GetDisplayMatrix(xPos, yPos, xSize, ySize, iRotate);
break;
diff --git a/chromium/third_party/pdfium/fpdfsdk/fpdfxfa/cpdfxfa_page.h b/chromium/third_party/pdfium/fpdfsdk/fpdfxfa/cpdfxfa_page.h
index 993885d59e9..05b9238eb77 100644
--- a/chromium/third_party/pdfium/fpdfsdk/fpdfxfa/cpdfxfa_page.h
+++ b/chromium/third_party/pdfium/fpdfsdk/fpdfxfa/cpdfxfa_page.h
@@ -38,8 +38,8 @@ class CPDFXFA_Page {
m_pXFAPageView = pPageView;
}
- FX_FLOAT GetPageWidth() const;
- FX_FLOAT GetPageHeight() const;
+ float GetPageWidth() const;
+ float GetPageHeight() const;
void DeviceToPage(int start_x,
int start_y,
diff --git a/chromium/third_party/pdfium/fpdfsdk/fpdfxfa/cxfa_fwladaptertimermgr.cpp b/chromium/third_party/pdfium/fpdfsdk/fpdfxfa/cxfa_fwladaptertimermgr.cpp
index 39aa72be870..c03ee45ac49 100644
--- a/chromium/third_party/pdfium/fpdfsdk/fpdfxfa/cxfa_fwladaptertimermgr.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/fpdfxfa/cxfa_fwladaptertimermgr.cpp
@@ -66,7 +66,7 @@ void CXFA_FWLAdapterTimerMgr::TimerProc(int32_t idEvent) {
if (!s_TimerArray)
return;
- for (const auto info : *s_TimerArray) {
+ for (auto* info : *s_TimerArray) {
CFWL_FWLAdapterTimerInfo* pInfo =
static_cast<CFWL_FWLAdapterTimerInfo*>(info);
if (pInfo->idEvent == idEvent) {
diff --git a/chromium/third_party/pdfium/fpdfsdk/fsdk_define.h b/chromium/third_party/pdfium/fpdfsdk/fsdk_define.h
index 9a115966dbb..b7691bbdd90 100644
--- a/chromium/third_party/pdfium/fpdfsdk/fsdk_define.h
+++ b/chromium/third_party/pdfium/fpdfsdk/fsdk_define.h
@@ -8,6 +8,7 @@
#define FPDFSDK_FSDK_DEFINE_H_
#include "core/fpdfapi/parser/cpdf_parser.h"
+#include "core/fxge/dib/cfx_dibitmap.h"
#include "core/fxge/fx_dib.h"
#include "public/fpdfview.h"
diff --git a/chromium/third_party/pdfium/fpdfsdk/fxedit/fxet_ap.cpp b/chromium/third_party/pdfium/fpdfsdk/fxedit/fxet_ap.cpp
index 448a539581c..1576efa89ae 100644
--- a/chromium/third_party/pdfium/fpdfsdk/fxedit/fxet_ap.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/fxedit/fxet_ap.cpp
@@ -26,13 +26,11 @@ CFX_ByteString GetPDFWordString(IPVT_FontMap* pFontMap,
uint32_t dwCharCode = pPDFFont->IsUnicodeCompatible()
? pPDFFont->CharCodeFromUnicode(Word)
: pFontMap->CharCodeFromUnicode(nFontIndex, Word);
-
if (dwCharCode > 0) {
- pPDFFont->AppendChar(sWord, dwCharCode);
+ pPDFFont->AppendChar(&sWord, dwCharCode);
return sWord;
}
}
-
- pPDFFont->AppendChar(sWord, Word);
+ pPDFFont->AppendChar(&sWord, Word);
return sWord;
}
diff --git a/chromium/third_party/pdfium/fpdfsdk/fxedit/fxet_edit.cpp b/chromium/third_party/pdfium/fpdfsdk/fxedit/fxet_edit.cpp
index 1acc57795a0..7e2cf04b3f9 100644
--- a/chromium/third_party/pdfium/fpdfsdk/fxedit/fxet_edit.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/fxedit/fxet_edit.cpp
@@ -43,7 +43,7 @@ CFX_ByteString GetWordRenderString(const CFX_ByteString& strWords) {
CFX_ByteString GetFontSetString(IPVT_FontMap* pFontMap,
int32_t nFontIndex,
- FX_FLOAT fFontSize) {
+ float fFontSize) {
if (!pFontMap)
return CFX_ByteString();
@@ -59,7 +59,7 @@ CFX_ByteString GetFontSetString(IPVT_FontMap* pFontMap,
void DrawTextString(CFX_RenderDevice* pDevice,
const CFX_PointF& pt,
CPDF_Font* pFont,
- FX_FLOAT fFontSize,
+ float fFontSize,
CFX_Matrix* pUser2Device,
const CFX_ByteString& str,
FX_ARGB crTextFill,
@@ -125,16 +125,6 @@ bool CFX_Edit_Iterator::GetLine(CPVT_Line& line) const {
return false;
}
-bool CFX_Edit_Iterator::GetSection(CPVT_Section& section) const {
- ASSERT(m_pEdit);
-
- if (m_pVTIterator->GetSection(section)) {
- section.rcSection = m_pEdit->VTToEdit(section.rcSection);
- return true;
- }
- return false;
-}
-
void CFX_Edit_Iterator::SetAt(int32_t nWordIndex) {
m_pVTIterator->SetAt(nWordIndex);
}
@@ -230,10 +220,6 @@ void CFX_Edit_Refresh::NoAnalyse() {
}
}
-void CFX_Edit_Refresh::AddRefresh(const CFX_FloatRect& rect) {
- m_RefreshRects.Add(rect);
-}
-
const CFX_Edit_RectArray* CFX_Edit_Refresh::GetRefreshRects() const {
return &m_RefreshRects;
}
@@ -245,8 +231,6 @@ void CFX_Edit_Refresh::EndRefresh() {
CFX_Edit_Undo::CFX_Edit_Undo(int32_t nBufsize)
: m_nCurUndoPos(0),
m_nBufSize(nBufsize),
- m_bModified(false),
- m_bVirgin(true),
m_bWorking(false) {}
CFX_Edit_Undo::~CFX_Edit_Undo() {
@@ -262,7 +246,6 @@ void CFX_Edit_Undo::Undo() {
if (m_nCurUndoPos > 0) {
m_UndoItemStack[m_nCurUndoPos - 1]->Undo();
m_nCurUndoPos--;
- m_bModified = (m_nCurUndoPos != 0);
}
m_bWorking = false;
}
@@ -276,7 +259,6 @@ void CFX_Edit_Undo::Redo() {
if (m_nCurUndoPos < m_UndoItemStack.size()) {
m_UndoItemStack[m_nCurUndoPos]->Redo();
m_nCurUndoPos++;
- m_bModified = true;
}
m_bWorking = false;
}
@@ -288,18 +270,11 @@ void CFX_Edit_Undo::AddItem(std::unique_ptr<IFX_Edit_UndoItem> pItem) {
if (m_nCurUndoPos < m_UndoItemStack.size())
RemoveTails();
- if (m_UndoItemStack.size() >= m_nBufSize) {
+ if (m_UndoItemStack.size() >= m_nBufSize)
RemoveHeads();
- m_bVirgin = false;
- }
m_UndoItemStack.push_back(std::move(pItem));
m_nCurUndoPos = m_UndoItemStack.size();
- m_bModified = true;
-}
-
-bool CFX_Edit_Undo::IsModified() const {
- return m_bVirgin ? m_bModified : true;
}
void CFX_Edit_Undo::RemoveHeads() {
@@ -337,42 +312,6 @@ bool CFX_Edit_UndoItem::IsLast() {
return m_bLast;
}
-CFX_Edit_GroupUndoItem::CFX_Edit_GroupUndoItem(const CFX_WideString& sTitle)
- : m_sTitle(sTitle) {}
-
-CFX_Edit_GroupUndoItem::~CFX_Edit_GroupUndoItem() {}
-
-void CFX_Edit_GroupUndoItem::AddUndoItem(
- std::unique_ptr<CFX_Edit_UndoItem> pUndoItem) {
- pUndoItem->SetFirst(false);
- pUndoItem->SetLast(false);
- if (m_sTitle.IsEmpty())
- m_sTitle = pUndoItem->GetUndoTitle();
-
- m_Items.push_back(std::move(pUndoItem));
-}
-
-void CFX_Edit_GroupUndoItem::UpdateItems() {
- if (!m_Items.empty()) {
- m_Items.front()->SetFirst(true);
- m_Items.back()->SetLast(true);
- }
-}
-
-void CFX_Edit_GroupUndoItem::Undo() {
- for (auto iter = m_Items.rbegin(); iter != m_Items.rend(); ++iter)
- (*iter)->Undo();
-}
-
-void CFX_Edit_GroupUndoItem::Redo() {
- for (auto iter = m_Items.begin(); iter != m_Items.end(); ++iter)
- (*iter)->Redo();
-}
-
-CFX_WideString CFX_Edit_GroupUndoItem::GetUndoTitle() const {
- return m_sTitle;
-}
-
CFXEU_InsertWord::CFXEU_InsertWord(CFX_Edit* pEdit,
const CPVT_WordPlace& wpOldPlace,
const CPVT_WordPlace& wpNewPlace,
@@ -459,23 +398,24 @@ CFXEU_Backspace::CFXEU_Backspace(CFX_Edit* pEdit,
CFXEU_Backspace::~CFXEU_Backspace() {}
void CFXEU_Backspace::Redo() {
- if (m_pEdit) {
- m_pEdit->SelectNone();
- m_pEdit->SetCaret(m_wpOld);
- m_pEdit->Backspace(false, true);
- }
+ if (!m_pEdit)
+ return;
+
+ m_pEdit->SelectNone();
+ m_pEdit->SetCaret(m_wpOld);
+ m_pEdit->Backspace(false, true);
}
void CFXEU_Backspace::Undo() {
- if (m_pEdit) {
- m_pEdit->SelectNone();
- m_pEdit->SetCaret(m_wpNew);
- if (m_wpNew.SecCmp(m_wpOld) != 0) {
- m_pEdit->InsertReturn(&m_SecProps, &m_WordProps, false, true);
- } else {
- m_pEdit->InsertWord(m_Word, m_nCharset, &m_WordProps, false, true);
- }
- }
+ if (!m_pEdit)
+ return;
+
+ m_pEdit->SelectNone();
+ m_pEdit->SetCaret(m_wpNew);
+ if (m_wpNew.nSecIndex != m_wpOld.nSecIndex)
+ m_pEdit->InsertReturn(&m_SecProps, &m_WordProps, false, true);
+ else
+ m_pEdit->InsertWord(m_Word, m_nCharset, &m_WordProps, false, true);
}
CFXEU_Delete::CFXEU_Delete(CFX_Edit* pEdit,
@@ -591,7 +531,7 @@ CFX_ByteString CFX_Edit::GetEditAppearanceStream(CFX_Edit* pEdit,
while (pIterator->NextWord()) {
CPVT_WordPlace place = pIterator->GetAt();
- if (pRange && place.WordCmp(pRange->EndPos) > 0)
+ if (pRange && place > pRange->EndPos)
break;
if (bContinuous) {
@@ -673,7 +613,7 @@ CFX_ByteString CFX_Edit::GetEditAppearanceStream(CFX_Edit* pEdit,
sAppStream << nHorzScale << " Tz\n";
}
- FX_FLOAT fCharSpace = pEdit->GetCharSpace();
+ float fCharSpace = pEdit->GetCharSpace();
if (!IsFloatZero(fCharSpace)) {
sAppStream << fCharSpace << " Tc\n";
}
@@ -689,7 +629,7 @@ CFX_ByteString CFX_Edit::GetSelectAppearanceStream(
CFX_Edit* pEdit,
const CFX_PointF& ptOffset,
const CPVT_WordRange* pRange) {
- if (!pRange || !pRange->IsExist())
+ if (!pRange || pRange->IsEmpty())
return CFX_ByteString();
CFX_Edit_Iterator* pIterator = pEdit->GetIterator();
@@ -698,7 +638,7 @@ CFX_ByteString CFX_Edit::GetSelectAppearanceStream(
CFX_ByteTextBuf sRet;
while (pIterator->NextWord()) {
CPVT_WordPlace place = pIterator->GetAt();
- if (place.WordCmp(pRange->EndPos) > 0)
+ if (place > pRange->EndPos)
break;
CPVT_Word word;
@@ -726,7 +666,7 @@ void CFX_Edit::DrawEdit(CFX_RenderDevice* pDevice,
const bool bContinuous =
pEdit->GetCharArray() == 0 && pEdit->GetCharSpace() <= 0.0f;
uint16_t SubWord = pEdit->GetPasswordChar();
- FX_FLOAT fFontSize = pEdit->GetFontSize();
+ float fFontSize = pEdit->GetFontSize();
CPVT_WordRange wrSelect = pEdit->GetSelectWordRange();
int32_t nHorzScale = pEdit->GetHorzScale();
@@ -757,12 +697,11 @@ void CFX_Edit::DrawEdit(CFX_RenderDevice* pDevice,
CPVT_WordPlace oldplace;
while (pIterator->NextWord()) {
CPVT_WordPlace place = pIterator->GetAt();
- if (pRange && place.WordCmp(pRange->EndPos) > 0)
+ if (pRange && place > pRange->EndPos)
break;
- if (wrSelect.IsExist()) {
- bSelect = place.WordCmp(wrSelect.BeginPos) > 0 &&
- place.WordCmp(wrSelect.EndPos) <= 0;
+ if (!wrSelect.IsEmpty()) {
+ bSelect = place > wrSelect.BeginPos && place <= wrSelect.EndPos;
crCurFill = bSelect ? crWhite : crTextFill;
}
if (pSystemHandler && pSystemHandler->IsSelectionImplemented()) {
@@ -849,12 +788,9 @@ CFX_Edit::CFX_Edit()
m_bEnableRefresh(true),
m_rcOldContent(0.0f, 0.0f, 0.0f, 0.0f),
m_bEnableUndo(true),
- m_bOprNotify(false),
- m_pGroupUndoItem(nullptr) {}
+ m_bOprNotify(false) {}
-CFX_Edit::~CFX_Edit() {
- ASSERT(!m_pGroupUndoItem);
-}
+CFX_Edit::~CFX_Edit() {}
void CFX_Edit::Initialize() {
m_pVT->Initialize();
@@ -921,7 +857,7 @@ void CFX_Edit::SetCharArray(int32_t nCharArray) {
Paint();
}
-void CFX_Edit::SetCharSpace(FX_FLOAT fCharSpace) {
+void CFX_Edit::SetCharSpace(float fCharSpace) {
m_pVT->SetCharSpace(fCharSpace);
Paint();
}
@@ -944,7 +880,7 @@ void CFX_Edit::SetAutoFontSize(bool bAuto, bool bPaint) {
Paint();
}
-void CFX_Edit::SetFontSize(FX_FLOAT fFontSize) {
+void CFX_Edit::SetFontSize(float fFontSize) {
m_pVT->SetFontSize(fFontSize);
Paint();
}
@@ -980,42 +916,36 @@ void CFX_Edit::SetSel(int32_t nStartChar, int32_t nEndChar) {
}
void CFX_Edit::SetSel(const CPVT_WordPlace& begin, const CPVT_WordPlace& end) {
- if (m_pVT->IsValid()) {
- SelectNone();
-
- m_SelState.Set(begin, end);
-
- SetCaret(m_SelState.EndPos);
+ if (!m_pVT->IsValid())
+ return;
- if (m_SelState.IsExist()) {
- ScrollToCaret();
- Refresh();
- SetCaretInfo();
- } else {
- ScrollToCaret();
- SetCaretInfo();
- }
- }
+ SelectNone();
+ m_SelState.Set(begin, end);
+ SetCaret(m_SelState.EndPos);
+ ScrollToCaret();
+ if (!m_SelState.IsEmpty())
+ Refresh();
+ SetCaretInfo();
}
void CFX_Edit::GetSel(int32_t& nStartChar, int32_t& nEndChar) const {
nStartChar = -1;
nEndChar = -1;
+ if (!m_pVT->IsValid())
+ return;
- if (m_pVT->IsValid()) {
- if (m_SelState.IsExist()) {
- if (m_SelState.BeginPos.WordCmp(m_SelState.EndPos) < 0) {
- nStartChar = m_pVT->WordPlaceToWordIndex(m_SelState.BeginPos);
- nEndChar = m_pVT->WordPlaceToWordIndex(m_SelState.EndPos);
- } else {
- nStartChar = m_pVT->WordPlaceToWordIndex(m_SelState.EndPos);
- nEndChar = m_pVT->WordPlaceToWordIndex(m_SelState.BeginPos);
- }
- } else {
- nStartChar = m_pVT->WordPlaceToWordIndex(m_wpCaret);
- nEndChar = m_pVT->WordPlaceToWordIndex(m_wpCaret);
- }
+ if (m_SelState.IsEmpty()) {
+ nStartChar = m_pVT->WordPlaceToWordIndex(m_wpCaret);
+ nEndChar = m_pVT->WordPlaceToWordIndex(m_wpCaret);
+ return;
+ }
+ if (m_SelState.BeginPos < m_SelState.EndPos) {
+ nStartChar = m_pVT->WordPlaceToWordIndex(m_SelState.BeginPos);
+ nEndChar = m_pVT->WordPlaceToWordIndex(m_SelState.EndPos);
+ return;
}
+ nStartChar = m_pVT->WordPlaceToWordIndex(m_SelState.EndPos);
+ nEndChar = m_pVT->WordPlaceToWordIndex(m_SelState.BeginPos);
}
int32_t CFX_Edit::GetCaret() const {
@@ -1031,7 +961,6 @@ CPVT_WordPlace CFX_Edit::GetCaretWordPlace() const {
CFX_WideString CFX_Edit::GetText() const {
CFX_WideString swRet;
-
if (!m_pVT->IsValid())
return swRet;
@@ -1042,22 +971,17 @@ CFX_WideString CFX_Edit::GetText() const {
CPVT_WordPlace oldplace = pIterator->GetAt();
while (pIterator->NextWord()) {
CPVT_WordPlace place = pIterator->GetAt();
-
if (pIterator->GetWord(wordinfo))
swRet += wordinfo.Word;
-
- if (oldplace.SecCmp(place) != 0)
+ if (oldplace.nSecIndex != place.nSecIndex)
swRet += L"\r\n";
-
oldplace = place;
}
-
return swRet;
}
CFX_WideString CFX_Edit::GetRangeText(const CPVT_WordRange& range) const {
CFX_WideString swRet;
-
if (!m_pVT->IsValid())
return swRet;
@@ -1071,18 +995,14 @@ CFX_WideString CFX_Edit::GetRangeText(const CPVT_WordRange& range) const {
CPVT_WordPlace oldplace = wrTemp.BeginPos;
while (pIterator->NextWord()) {
CPVT_WordPlace place = pIterator->GetAt();
- if (place.WordCmp(wrTemp.EndPos) > 0)
+ if (place > wrTemp.EndPos)
break;
-
if (pIterator->GetWord(wordinfo))
swRet += wordinfo.Word;
-
- if (oldplace.SecCmp(place) != 0)
+ if (oldplace.nSecIndex != place.nSecIndex)
swRet += L"\r\n";
-
oldplace = place;
}
-
return swRet;
}
@@ -1090,10 +1010,6 @@ CFX_WideString CFX_Edit::GetSelText() const {
return GetRangeText(m_SelState.ConvertToWordRange());
}
-int32_t CFX_Edit::GetTotalWords() const {
- return m_pVT->GetTotalWords();
-}
-
int32_t CFX_Edit::GetTotalLines() const {
int32_t nLines = 1;
@@ -1139,7 +1055,7 @@ bool CFX_Edit::InsertText(const CFX_WideString& sText, int32_t charset) {
return InsertText(sText, charset, true, true);
}
-FX_FLOAT CFX_Edit::GetFontSize() const {
+float CFX_Edit::GetFontSize() const {
return m_pVT->GetFontSize();
}
@@ -1159,7 +1075,7 @@ int32_t CFX_Edit::GetHorzScale() const {
return m_pVT->GetHorzScale();
}
-FX_FLOAT CFX_Edit::GetCharSpace() const {
+float CFX_Edit::GetCharSpace() const {
return m_pVT->GetCharSpace();
}
@@ -1231,45 +1147,38 @@ void CFX_Edit::SetContentChanged() {
CFX_FloatRect rcContent = m_pVT->GetContentRect();
if (rcContent.Width() != m_rcOldContent.Width() ||
rcContent.Height() != m_rcOldContent.Height()) {
- if (!m_bNotifyFlag) {
- m_bNotifyFlag = true;
- m_pNotify->IOnContentChange(rcContent);
- m_bNotifyFlag = false;
- }
m_rcOldContent = rcContent;
}
}
}
void CFX_Edit::SelectAll() {
- if (m_pVT->IsValid()) {
- m_SelState = CFX_Edit_Select(GetWholeWordRange());
- SetCaret(m_SelState.EndPos);
-
- ScrollToCaret();
- Refresh();
- SetCaretInfo();
- }
+ if (!m_pVT->IsValid())
+ return;
+ m_SelState = CFX_Edit_Select(GetWholeWordRange());
+ SetCaret(m_SelState.EndPos);
+ ScrollToCaret();
+ Refresh();
+ SetCaretInfo();
}
void CFX_Edit::SelectNone() {
- if (m_pVT->IsValid()) {
- if (m_SelState.IsExist()) {
- m_SelState.Default();
- Refresh();
- }
- }
+ if (!m_pVT->IsValid() || m_SelState.IsEmpty())
+ return;
+
+ m_SelState.Reset();
+ Refresh();
}
bool CFX_Edit::IsSelected() const {
- return m_SelState.IsExist();
+ return !m_SelState.IsEmpty();
}
CFX_PointF CFX_Edit::VTToEdit(const CFX_PointF& point) const {
CFX_FloatRect rcContent = m_pVT->GetContentRect();
CFX_FloatRect rcPlate = m_pVT->GetPlateRect();
- FX_FLOAT fPadding = 0.0f;
+ float fPadding = 0.0f;
switch (m_nAlignment) {
case 0:
@@ -1291,7 +1200,7 @@ CFX_PointF CFX_Edit::EditToVT(const CFX_PointF& point) const {
CFX_FloatRect rcContent = m_pVT->GetContentRect();
CFX_FloatRect rcPlate = m_pVT->GetPlateRect();
- FX_FLOAT fPadding = 0.0f;
+ float fPadding = 0.0f;
switch (m_nAlignment) {
case 0:
@@ -1323,16 +1232,16 @@ void CFX_Edit::SetScrollInfo() {
CFX_FloatRect rcContent = m_pVT->GetContentRect();
if (!m_bNotifyFlag) {
+ CFX_AutoRestorer<bool> restorer(&m_bNotifyFlag);
m_bNotifyFlag = true;
m_pNotify->IOnSetScrollInfoY(rcPlate.bottom, rcPlate.top,
rcContent.bottom, rcContent.top,
rcPlate.Height() / 3, rcPlate.Height());
- m_bNotifyFlag = false;
}
}
}
-void CFX_Edit::SetScrollPosX(FX_FLOAT fx) {
+void CFX_Edit::SetScrollPosX(float fx) {
if (!m_bEnableScroll)
return;
@@ -1344,7 +1253,7 @@ void CFX_Edit::SetScrollPosX(FX_FLOAT fx) {
}
}
-void CFX_Edit::SetScrollPosY(FX_FLOAT fy) {
+void CFX_Edit::SetScrollPosY(float fy) {
if (!m_bEnableScroll)
return;
@@ -1355,9 +1264,9 @@ void CFX_Edit::SetScrollPosY(FX_FLOAT fy) {
if (m_pNotify) {
if (!m_bNotifyFlag) {
+ CFX_AutoRestorer<bool> restorer(&m_bNotifyFlag);
m_bNotifyFlag = true;
m_pNotify->IOnSetScrollPosY(fy);
- m_bNotifyFlag = false;
}
}
}
@@ -1465,12 +1374,12 @@ void CFX_Edit::Refresh() {
if (m_pNotify) {
if (!m_bNotifyFlag) {
+ CFX_AutoRestorer<bool> restorer(&m_bNotifyFlag);
m_bNotifyFlag = true;
if (const CFX_Edit_RectArray* pRects = m_Refresh.GetRefreshRects()) {
for (int32_t i = 0, sz = pRects->GetSize(); i < sz; i++)
m_pNotify->IOnInvalidateRect(pRects->GetAt(i));
}
- m_bNotifyFlag = false;
}
}
@@ -1520,12 +1429,11 @@ void CFX_Edit::RefreshWordRange(const CPVT_WordRange& wr) {
while (pIterator->NextWord()) {
place = pIterator->GetAt();
- if (place.WordCmp(wrTemp.EndPos) > 0)
+ if (place > wrTemp.EndPos)
break;
pIterator->GetWord(wordinfo);
pIterator->GetLine(lineinfo);
-
if (place.LineCmp(wrTemp.BeginPos) == 0 ||
place.LineCmp(wrTemp.EndPos) == 0) {
CFX_FloatRect rcWord(wordinfo.ptWord.x,
@@ -1535,10 +1443,10 @@ void CFX_Edit::RefreshWordRange(const CPVT_WordRange& wr) {
if (m_pNotify) {
if (!m_bNotifyFlag) {
+ CFX_AutoRestorer<bool> restorer(&m_bNotifyFlag);
m_bNotifyFlag = true;
CFX_FloatRect rcRefresh = VTToEdit(rcWord);
m_pNotify->IOnInvalidateRect(&rcRefresh);
- m_bNotifyFlag = false;
}
}
} else {
@@ -1549,10 +1457,10 @@ void CFX_Edit::RefreshWordRange(const CPVT_WordRange& wr) {
if (m_pNotify) {
if (!m_bNotifyFlag) {
+ CFX_AutoRestorer<bool> restorer(&m_bNotifyFlag);
m_bNotifyFlag = true;
CFX_FloatRect rcRefresh = VTToEdit(rcLine);
m_pNotify->IOnInvalidateRect(&rcRefresh);
- m_bNotifyFlag = false;
}
}
@@ -1588,265 +1496,243 @@ void CFX_Edit::SetCaretInfo() {
ptFoot.y = line.ptLine.y + line.fLineDescent;
}
+ CFX_AutoRestorer<bool> restorer(&m_bNotifyFlag);
m_bNotifyFlag = true;
- m_pNotify->IOnSetCaret(!m_SelState.IsExist(), VTToEdit(ptHead),
+ m_pNotify->IOnSetCaret(m_SelState.IsEmpty(), VTToEdit(ptHead),
VTToEdit(ptFoot), m_wpCaret);
- m_bNotifyFlag = false;
}
}
}
-void CFX_Edit::SetCaret(int32_t nPos) {
- if (m_pVT->IsValid()) {
- SelectNone();
- SetCaret(m_pVT->WordIndexToWordPlace(nPos));
- m_SelState.Set(m_wpCaret, m_wpCaret);
-
- ScrollToCaret();
- SetCaretOrigin();
- SetCaretInfo();
- }
-}
-
void CFX_Edit::OnMouseDown(const CFX_PointF& point, bool bShift, bool bCtrl) {
- if (m_pVT->IsValid()) {
- SelectNone();
- SetCaret(m_pVT->SearchWordPlace(EditToVT(point)));
- m_SelState.Set(m_wpCaret, m_wpCaret);
+ if (!m_pVT->IsValid())
+ return;
- ScrollToCaret();
- SetCaretOrigin();
- SetCaretInfo();
- }
+ SelectNone();
+ SetCaret(m_pVT->SearchWordPlace(EditToVT(point)));
+ m_SelState.Set(m_wpCaret, m_wpCaret);
+ ScrollToCaret();
+ SetCaretOrigin();
+ SetCaretInfo();
}
void CFX_Edit::OnMouseMove(const CFX_PointF& point, bool bShift, bool bCtrl) {
- if (m_pVT->IsValid()) {
- SetCaret(m_pVT->SearchWordPlace(EditToVT(point)));
+ if (!m_pVT->IsValid())
+ return;
- if (m_wpCaret != m_wpOldCaret) {
- m_SelState.SetEndPos(m_wpCaret);
+ SetCaret(m_pVT->SearchWordPlace(EditToVT(point)));
+ if (m_wpCaret == m_wpOldCaret)
+ return;
- ScrollToCaret();
- Refresh();
- SetCaretOrigin();
- SetCaretInfo();
- }
- }
+ m_SelState.SetEndPos(m_wpCaret);
+ ScrollToCaret();
+ Refresh();
+ SetCaretOrigin();
+ SetCaretInfo();
}
void CFX_Edit::OnVK_UP(bool bShift, bool bCtrl) {
- if (m_pVT->IsValid()) {
- SetCaret(m_pVT->GetUpWordPlace(m_wpCaret, m_ptCaret));
-
- if (bShift) {
- if (m_SelState.IsExist())
- m_SelState.SetEndPos(m_wpCaret);
- else
- m_SelState.Set(m_wpOldCaret, m_wpCaret);
+ if (!m_pVT->IsValid())
+ return;
- if (m_wpOldCaret != m_wpCaret) {
- ScrollToCaret();
- Refresh();
- SetCaretInfo();
- }
- } else {
- SelectNone();
+ SetCaret(m_pVT->GetUpWordPlace(m_wpCaret, m_ptCaret));
+ if (bShift) {
+ if (m_SelState.IsEmpty())
+ m_SelState.Set(m_wpOldCaret, m_wpCaret);
+ else
+ m_SelState.SetEndPos(m_wpCaret);
+ if (m_wpOldCaret != m_wpCaret) {
ScrollToCaret();
+ Refresh();
SetCaretInfo();
}
+ } else {
+ SelectNone();
+ ScrollToCaret();
+ SetCaretInfo();
}
}
void CFX_Edit::OnVK_DOWN(bool bShift, bool bCtrl) {
- if (m_pVT->IsValid()) {
- SetCaret(m_pVT->GetDownWordPlace(m_wpCaret, m_ptCaret));
-
- if (bShift) {
- if (m_SelState.IsExist())
- m_SelState.SetEndPos(m_wpCaret);
- else
- m_SelState.Set(m_wpOldCaret, m_wpCaret);
+ if (!m_pVT->IsValid())
+ return;
- if (m_wpOldCaret != m_wpCaret) {
- ScrollToCaret();
- Refresh();
- SetCaretInfo();
- }
- } else {
- SelectNone();
+ SetCaret(m_pVT->GetDownWordPlace(m_wpCaret, m_ptCaret));
+ if (bShift) {
+ if (m_SelState.IsEmpty())
+ m_SelState.Set(m_wpOldCaret, m_wpCaret);
+ else
+ m_SelState.SetEndPos(m_wpCaret);
+ if (m_wpOldCaret != m_wpCaret) {
ScrollToCaret();
+ Refresh();
SetCaretInfo();
}
+ } else {
+ SelectNone();
+ ScrollToCaret();
+ SetCaretInfo();
}
}
void CFX_Edit::OnVK_LEFT(bool bShift, bool bCtrl) {
- if (m_pVT->IsValid()) {
- if (bShift) {
- if (m_wpCaret == m_pVT->GetLineBeginPlace(m_wpCaret) &&
- m_wpCaret != m_pVT->GetSectionBeginPlace(m_wpCaret))
- SetCaret(m_pVT->GetPrevWordPlace(m_wpCaret));
+ if (!m_pVT->IsValid())
+ return;
+ if (bShift) {
+ if (m_wpCaret == m_pVT->GetLineBeginPlace(m_wpCaret) &&
+ m_wpCaret != m_pVT->GetSectionBeginPlace(m_wpCaret)) {
SetCaret(m_pVT->GetPrevWordPlace(m_wpCaret));
+ }
+ SetCaret(m_pVT->GetPrevWordPlace(m_wpCaret));
+ if (m_SelState.IsEmpty())
+ m_SelState.Set(m_wpOldCaret, m_wpCaret);
+ else
+ m_SelState.SetEndPos(m_wpCaret);
- if (m_SelState.IsExist())
- m_SelState.SetEndPos(m_wpCaret);
+ if (m_wpOldCaret != m_wpCaret) {
+ ScrollToCaret();
+ Refresh();
+ SetCaretInfo();
+ }
+ } else {
+ if (!m_SelState.IsEmpty()) {
+ if (m_SelState.BeginPos < m_SelState.EndPos)
+ SetCaret(m_SelState.BeginPos);
else
- m_SelState.Set(m_wpOldCaret, m_wpCaret);
+ SetCaret(m_SelState.EndPos);
- if (m_wpOldCaret != m_wpCaret) {
- ScrollToCaret();
- Refresh();
- SetCaretInfo();
- }
+ SelectNone();
+ ScrollToCaret();
+ SetCaretInfo();
} else {
- if (m_SelState.IsExist()) {
- if (m_SelState.BeginPos.WordCmp(m_SelState.EndPos) < 0)
- SetCaret(m_SelState.BeginPos);
- else
- SetCaret(m_SelState.EndPos);
-
- SelectNone();
- ScrollToCaret();
- SetCaretInfo();
- } else {
- if (m_wpCaret == m_pVT->GetLineBeginPlace(m_wpCaret) &&
- m_wpCaret != m_pVT->GetSectionBeginPlace(m_wpCaret))
- SetCaret(m_pVT->GetPrevWordPlace(m_wpCaret));
-
+ if (m_wpCaret == m_pVT->GetLineBeginPlace(m_wpCaret) &&
+ m_wpCaret != m_pVT->GetSectionBeginPlace(m_wpCaret)) {
SetCaret(m_pVT->GetPrevWordPlace(m_wpCaret));
-
- ScrollToCaret();
- SetCaretOrigin();
- SetCaretInfo();
}
+ SetCaret(m_pVT->GetPrevWordPlace(m_wpCaret));
+ ScrollToCaret();
+ SetCaretOrigin();
+ SetCaretInfo();
}
}
}
void CFX_Edit::OnVK_RIGHT(bool bShift, bool bCtrl) {
- if (m_pVT->IsValid()) {
- if (bShift) {
+ if (!m_pVT->IsValid())
+ return;
+
+ if (bShift) {
+ SetCaret(m_pVT->GetNextWordPlace(m_wpCaret));
+ if (m_wpCaret == m_pVT->GetLineEndPlace(m_wpCaret) &&
+ m_wpCaret != m_pVT->GetSectionEndPlace(m_wpCaret))
SetCaret(m_pVT->GetNextWordPlace(m_wpCaret));
- if (m_wpCaret == m_pVT->GetLineEndPlace(m_wpCaret) &&
- m_wpCaret != m_pVT->GetSectionEndPlace(m_wpCaret))
- SetCaret(m_pVT->GetNextWordPlace(m_wpCaret));
+ if (m_SelState.IsEmpty())
+ m_SelState.Set(m_wpOldCaret, m_wpCaret);
+ else
+ m_SelState.SetEndPos(m_wpCaret);
- if (m_SelState.IsExist())
- m_SelState.SetEndPos(m_wpCaret);
+ if (m_wpOldCaret != m_wpCaret) {
+ ScrollToCaret();
+ Refresh();
+ SetCaretInfo();
+ }
+ } else {
+ if (!m_SelState.IsEmpty()) {
+ if (m_SelState.BeginPos > m_SelState.EndPos)
+ SetCaret(m_SelState.BeginPos);
else
- m_SelState.Set(m_wpOldCaret, m_wpCaret);
+ SetCaret(m_SelState.EndPos);
- if (m_wpOldCaret != m_wpCaret) {
- ScrollToCaret();
- Refresh();
- SetCaretInfo();
- }
+ SelectNone();
+ ScrollToCaret();
+ SetCaretInfo();
} else {
- if (m_SelState.IsExist()) {
- if (m_SelState.BeginPos.WordCmp(m_SelState.EndPos) > 0)
- SetCaret(m_SelState.BeginPos);
- else
- SetCaret(m_SelState.EndPos);
-
- SelectNone();
- ScrollToCaret();
- SetCaretInfo();
- } else {
+ SetCaret(m_pVT->GetNextWordPlace(m_wpCaret));
+ if (m_wpCaret == m_pVT->GetLineEndPlace(m_wpCaret) &&
+ m_wpCaret != m_pVT->GetSectionEndPlace(m_wpCaret)) {
SetCaret(m_pVT->GetNextWordPlace(m_wpCaret));
-
- if (m_wpCaret == m_pVT->GetLineEndPlace(m_wpCaret) &&
- m_wpCaret != m_pVT->GetSectionEndPlace(m_wpCaret))
- SetCaret(m_pVT->GetNextWordPlace(m_wpCaret));
-
- ScrollToCaret();
- SetCaretOrigin();
- SetCaretInfo();
}
+ ScrollToCaret();
+ SetCaretOrigin();
+ SetCaretInfo();
}
}
}
void CFX_Edit::OnVK_HOME(bool bShift, bool bCtrl) {
- if (m_pVT->IsValid()) {
- if (bShift) {
+ if (!m_pVT->IsValid())
+ return;
+
+ if (bShift) {
+ if (bCtrl)
+ SetCaret(m_pVT->GetBeginWordPlace());
+ else
+ SetCaret(m_pVT->GetLineBeginPlace(m_wpCaret));
+
+ if (m_SelState.IsEmpty())
+ m_SelState.Set(m_wpOldCaret, m_wpCaret);
+ else
+ m_SelState.SetEndPos(m_wpCaret);
+
+ ScrollToCaret();
+ Refresh();
+ SetCaretInfo();
+ } else {
+ if (!m_SelState.IsEmpty()) {
+ SetCaret(std::min(m_SelState.BeginPos, m_SelState.EndPos));
+ SelectNone();
+ ScrollToCaret();
+ SetCaretInfo();
+ } else {
if (bCtrl)
SetCaret(m_pVT->GetBeginWordPlace());
else
SetCaret(m_pVT->GetLineBeginPlace(m_wpCaret));
- if (m_SelState.IsExist())
- m_SelState.SetEndPos(m_wpCaret);
- else
- m_SelState.Set(m_wpOldCaret, m_wpCaret);
-
ScrollToCaret();
- Refresh();
+ SetCaretOrigin();
SetCaretInfo();
- } else {
- if (m_SelState.IsExist()) {
- if (m_SelState.BeginPos.WordCmp(m_SelState.EndPos) < 0)
- SetCaret(m_SelState.BeginPos);
- else
- SetCaret(m_SelState.EndPos);
-
- SelectNone();
- ScrollToCaret();
- SetCaretInfo();
- } else {
- if (bCtrl)
- SetCaret(m_pVT->GetBeginWordPlace());
- else
- SetCaret(m_pVT->GetLineBeginPlace(m_wpCaret));
-
- ScrollToCaret();
- SetCaretOrigin();
- SetCaretInfo();
- }
}
}
}
void CFX_Edit::OnVK_END(bool bShift, bool bCtrl) {
- if (m_pVT->IsValid()) {
- if (bShift) {
+ if (!m_pVT->IsValid())
+ return;
+
+ if (bShift) {
+ if (bCtrl)
+ SetCaret(m_pVT->GetEndWordPlace());
+ else
+ SetCaret(m_pVT->GetLineEndPlace(m_wpCaret));
+
+ if (m_SelState.IsEmpty())
+ m_SelState.Set(m_wpOldCaret, m_wpCaret);
+ else
+ m_SelState.SetEndPos(m_wpCaret);
+
+ ScrollToCaret();
+ Refresh();
+ SetCaretInfo();
+ } else {
+ if (!m_SelState.IsEmpty()) {
+ SetCaret(std::max(m_SelState.BeginPos, m_SelState.EndPos));
+ SelectNone();
+ ScrollToCaret();
+ SetCaretInfo();
+ } else {
if (bCtrl)
SetCaret(m_pVT->GetEndWordPlace());
else
SetCaret(m_pVT->GetLineEndPlace(m_wpCaret));
- if (m_SelState.IsExist())
- m_SelState.SetEndPos(m_wpCaret);
- else
- m_SelState.Set(m_wpOldCaret, m_wpCaret);
-
ScrollToCaret();
- Refresh();
+ SetCaretOrigin();
SetCaretInfo();
- } else {
- if (m_SelState.IsExist()) {
- if (m_SelState.BeginPos.WordCmp(m_SelState.EndPos) > 0)
- SetCaret(m_SelState.BeginPos);
- else
- SetCaret(m_SelState.EndPos);
-
- SelectNone();
- ScrollToCaret();
- SetCaretInfo();
- } else {
- if (bCtrl)
- SetCaret(m_pVT->GetEndWordPlace());
- else
- SetCaret(m_pVT->GetLineEndPlace(m_wpCaret));
-
- ScrollToCaret();
- SetCaretOrigin();
- SetCaretInfo();
- }
}
}
}
@@ -1928,7 +1814,7 @@ bool CFX_Edit::Backspace(bool bAddUndo, bool bPaint) {
return false;
if (bAddUndo && m_bEnableUndo) {
- if (m_wpCaret.SecCmp(m_wpOldCaret) != 0) {
+ if (m_wpCaret.nSecIndex != m_wpOldCaret.nSecIndex) {
AddEditUndoItem(pdfium::MakeUnique<CFXEU_Backspace>(
this, m_wpOldCaret, m_wpCaret, word.Word, word.nCharset,
section.SecProps, section.WordProps));
@@ -2003,7 +1889,7 @@ bool CFX_Edit::Empty() {
}
bool CFX_Edit::Clear(bool bAddUndo, bool bPaint) {
- if (!m_pVT->IsValid() || !m_SelState.IsExist())
+ if (!m_pVT->IsValid() || m_SelState.IsEmpty())
return false;
CPVT_WordRange range = m_SelState.ConvertToWordRange();
@@ -2102,13 +1988,6 @@ void CFX_Edit::SetCaretOrigin() {
}
}
-int32_t CFX_Edit::WordPlaceToWordIndex(const CPVT_WordPlace& place) const {
- if (m_pVT->IsValid())
- return m_pVT->WordPlaceToWordIndex(place);
-
- return -1;
-}
-
CPVT_WordPlace CFX_Edit::WordIndexToWordPlace(int32_t index) const {
if (m_pVT->IsValid())
return m_pVT->WordIndexToWordPlace(index);
@@ -2210,10 +2089,7 @@ int32_t CFX_Edit::GetCharSetFromUnicode(uint16_t word, int32_t nOldCharset) {
void CFX_Edit::AddEditUndoItem(
std::unique_ptr<CFX_Edit_UndoItem> pEditUndoItem) {
- if (m_pGroupUndoItem)
- m_pGroupUndoItem->AddUndoItem(std::move(pEditUndoItem));
- else
- m_Undo.AddItem(std::move(pEditUndoItem));
+ m_Undo.AddItem(std::move(pEditUndoItem));
}
CFX_Edit_LineRectArray::CFX_Edit_LineRectArray() {}
@@ -2242,11 +2118,6 @@ CFX_Edit_LineRect* CFX_Edit_LineRectArray::GetAt(int32_t nIndex) const {
CFX_Edit_Select::CFX_Edit_Select() {}
-CFX_Edit_Select::CFX_Edit_Select(const CPVT_WordPlace& begin,
- const CPVT_WordPlace& end) {
- Set(begin, end);
-}
-
CFX_Edit_Select::CFX_Edit_Select(const CPVT_WordRange& range) {
Set(range.BeginPos, range.EndPos);
}
@@ -2255,9 +2126,9 @@ CPVT_WordRange CFX_Edit_Select::ConvertToWordRange() const {
return CPVT_WordRange(BeginPos, EndPos);
}
-void CFX_Edit_Select::Default() {
- BeginPos.Default();
- EndPos.Default();
+void CFX_Edit_Select::Reset() {
+ BeginPos.Reset();
+ EndPos.Reset();
}
void CFX_Edit_Select::Set(const CPVT_WordPlace& begin,
@@ -2266,16 +2137,12 @@ void CFX_Edit_Select::Set(const CPVT_WordPlace& begin,
EndPos = end;
}
-void CFX_Edit_Select::SetBeginPos(const CPVT_WordPlace& begin) {
- BeginPos = begin;
-}
-
void CFX_Edit_Select::SetEndPos(const CPVT_WordPlace& end) {
EndPos = end;
}
-bool CFX_Edit_Select::IsExist() const {
- return BeginPos != EndPos;
+bool CFX_Edit_Select::IsEmpty() const {
+ return BeginPos == EndPos;
}
CFX_Edit_RectArray::CFX_Edit_RectArray() {}
diff --git a/chromium/third_party/pdfium/fpdfsdk/fxedit/fxet_edit.h b/chromium/third_party/pdfium/fpdfsdk/fxedit/fxet_edit.h
index ab83af2e3bc..ebc326f5a9e 100644
--- a/chromium/third_party/pdfium/fpdfsdk/fxedit/fxet_edit.h
+++ b/chromium/third_party/pdfium/fpdfsdk/fxedit/fxet_edit.h
@@ -21,11 +21,8 @@ class CFX_Edit_Iterator;
class CFX_Edit_Provider;
class CFX_RenderDevice;
class CFX_SystemHandler;
-class CPDF_PageObjectHolder;
-class CPDF_TextObject;
class CPWL_Edit;
class CPWL_EditCtrl;
-
class IFX_Edit_UndoItem;
struct CFX_Edit_LineRect {
@@ -39,7 +36,7 @@ struct CFX_Edit_LineRect {
class CFX_Edit_LineRectArray {
public:
CFX_Edit_LineRectArray();
- virtual ~CFX_Edit_LineRectArray();
+ ~CFX_Edit_LineRectArray();
void operator=(CFX_Edit_LineRectArray&& rects);
void Add(const CPVT_WordRange& wrLine, const CFX_FloatRect& rcLine);
@@ -54,7 +51,7 @@ class CFX_Edit_LineRectArray {
class CFX_Edit_RectArray {
public:
CFX_Edit_RectArray();
- virtual ~CFX_Edit_RectArray();
+ ~CFX_Edit_RectArray();
void Clear();
void Add(const CFX_FloatRect& rect);
@@ -69,12 +66,11 @@ class CFX_Edit_RectArray {
class CFX_Edit_Refresh {
public:
CFX_Edit_Refresh();
- virtual ~CFX_Edit_Refresh();
+ ~CFX_Edit_Refresh();
void BeginRefresh();
void Push(const CPVT_WordRange& linerange, const CFX_FloatRect& rect);
void NoAnalyse();
- void AddRefresh(const CFX_FloatRect& rect);
const CFX_Edit_RectArray* GetRefreshRects() const;
void EndRefresh();
@@ -87,16 +83,14 @@ class CFX_Edit_Refresh {
class CFX_Edit_Select {
public:
CFX_Edit_Select();
- CFX_Edit_Select(const CPVT_WordPlace& begin, const CPVT_WordPlace& end);
explicit CFX_Edit_Select(const CPVT_WordRange& range);
- void Default();
+ void Reset();
void Set(const CPVT_WordPlace& begin, const CPVT_WordPlace& end);
- void SetBeginPos(const CPVT_WordPlace& begin);
void SetEndPos(const CPVT_WordPlace& end);
CPVT_WordRange ConvertToWordRange() const;
- bool IsExist() const;
+ bool IsEmpty() const;
CPVT_WordPlace BeginPos;
CPVT_WordPlace EndPos;
@@ -105,14 +99,13 @@ class CFX_Edit_Select {
class CFX_Edit_Undo {
public:
explicit CFX_Edit_Undo(int32_t nBufsize);
- virtual ~CFX_Edit_Undo();
+ ~CFX_Edit_Undo();
void AddItem(std::unique_ptr<IFX_Edit_UndoItem> pItem);
void Undo();
void Redo();
bool CanUndo() const;
bool CanRedo() const;
- bool IsModified() const;
void Reset();
private:
@@ -122,8 +115,6 @@ class CFX_Edit_Undo {
std::deque<std::unique_ptr<IFX_Edit_UndoItem>> m_UndoItemStack;
size_t m_nCurUndoPos;
size_t m_nBufSize;
- bool m_bModified;
- bool m_bVirgin;
bool m_bWorking;
};
@@ -152,24 +143,6 @@ class CFX_Edit_UndoItem : public IFX_Edit_UndoItem {
bool m_bLast;
};
-class CFX_Edit_GroupUndoItem : public IFX_Edit_UndoItem {
- public:
- explicit CFX_Edit_GroupUndoItem(const CFX_WideString& sTitle);
- ~CFX_Edit_GroupUndoItem() override;
-
- // IFX_Edit_UndoItem
- void Undo() override;
- void Redo() override;
- CFX_WideString GetUndoTitle() const override;
-
- void AddUndoItem(std::unique_ptr<CFX_Edit_UndoItem> pUndoItem);
- void UpdateItems();
-
- private:
- CFX_WideString m_sTitle;
- std::vector<std::unique_ptr<CFX_Edit_UndoItem>> m_Items;
-};
-
class CFXEU_InsertWord : public CFX_Edit_UndoItem {
public:
CFXEU_InsertWord(CFX_Edit* pEdit,
@@ -357,12 +330,12 @@ class CFX_Edit {
// Set the maximum number of words in the text.
void SetLimitChar(int32_t nLimitChar);
void SetCharArray(int32_t nCharArray);
- void SetCharSpace(FX_FLOAT fCharSpace);
+ void SetCharSpace(float fCharSpace);
void SetMultiLine(bool bMultiLine, bool bPaint);
void SetAutoReturn(bool bAuto, bool bPaint);
void SetAutoFontSize(bool bAuto, bool bPaint);
void SetAutoScroll(bool bAuto, bool bPaint);
- void SetFontSize(FX_FLOAT fFontSize);
+ void SetFontSize(float fFontSize);
void SetTextOverflow(bool bAllowed, bool bPaint);
void OnMouseDown(const CFX_PointF& point, bool bShift, bool bCtrl);
void OnMouseMove(const CFX_PointF& point, bool bShift, bool bCtrl);
@@ -381,22 +354,20 @@ class CFX_Edit {
bool InsertText(const CFX_WideString& sText, int32_t charset);
bool Redo();
bool Undo();
- int32_t WordPlaceToWordIndex(const CPVT_WordPlace& place) const;
CPVT_WordPlace WordIndexToWordPlace(int32_t index) const;
CPVT_WordPlace SearchWordPlace(const CFX_PointF& point) const;
int32_t GetCaret() const;
CPVT_WordPlace GetCaretWordPlace() const;
CFX_WideString GetSelText() const;
CFX_WideString GetText() const;
- FX_FLOAT GetFontSize() const;
+ float GetFontSize() const;
uint16_t GetPasswordChar() const;
CFX_PointF GetScrollPos() const;
int32_t GetCharArray() const;
CFX_FloatRect GetContentRect() const;
CFX_WideString GetRangeText(const CPVT_WordRange& range) const;
int32_t GetHorzScale() const;
- FX_FLOAT GetCharSpace() const;
- int32_t GetTotalWords() const;
+ float GetCharSpace() const;
void SetSel(int32_t nStartChar, int32_t nEndChar);
void GetSel(int32_t& nStartChar, int32_t& nEndChar) const;
void SelectAll();
@@ -405,7 +376,6 @@ class CFX_Edit {
void Paint();
void EnableRefresh(bool bRefresh);
void RefreshWordRange(const CPVT_WordRange& wr);
- void SetCaret(int32_t nPos);
CPVT_WordRange GetWholeWordRange() const;
CPVT_WordRange GetSelectWordRange() const;
void EnableUndo(bool bUndo);
@@ -440,8 +410,8 @@ class CFX_Edit {
void RearrangePart(const CPVT_WordRange& range);
void ScrollToCaret();
void SetScrollInfo();
- void SetScrollPosX(FX_FLOAT fx);
- void SetScrollPosY(FX_FLOAT fy);
+ void SetScrollPosX(float fx);
+ void SetScrollPosY(float fy);
void SetScrollLimit();
void SetContentChanged();
@@ -499,7 +469,6 @@ class CFX_Edit {
CFX_FloatRect m_rcOldContent;
bool m_bEnableUndo;
bool m_bOprNotify;
- CFX_Edit_GroupUndoItem* m_pGroupUndoItem;
};
class CFX_Edit_Iterator {
@@ -511,7 +480,6 @@ class CFX_Edit_Iterator {
bool PrevWord();
bool GetWord(CPVT_Word& word) const;
bool GetLine(CPVT_Line& line) const;
- bool GetSection(CPVT_Section& section) const;
void SetAt(int32_t nWordIndex);
void SetAt(const CPVT_WordPlace& place);
const CPVT_WordPlace& GetAt() const;
diff --git a/chromium/third_party/pdfium/fpdfsdk/fxedit/fxet_list.cpp b/chromium/third_party/pdfium/fpdfsdk/fxedit/fxet_list.cpp
index 39877c955fe..c10b6a205ec 100644
--- a/chromium/third_party/pdfium/fpdfsdk/fxedit/fxet_list.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/fxedit/fxet_list.cpp
@@ -6,9 +6,13 @@
#include "fpdfsdk/fxedit/fxet_list.h"
+#include <algorithm>
+#include <utility>
+
#include "core/fpdfdoc/cpvt_word.h"
#include "fpdfsdk/fxedit/fxet_edit.h"
#include "fpdfsdk/pdfwindow/PWL_ListBox.h"
+#include "third_party/base/stl_util.h"
CFX_ListItem::CFX_ListItem()
: m_pEdit(new CFX_Edit),
@@ -53,11 +57,11 @@ void CFX_ListItem::SetText(const CFX_WideString& text) {
m_pEdit->SetText(text);
}
-void CFX_ListItem::SetFontSize(FX_FLOAT fFontSize) {
+void CFX_ListItem::SetFontSize(float fFontSize) {
m_pEdit->SetFontSize(fFontSize);
}
-FX_FLOAT CFX_ListItem::GetItemHeight() const {
+float CFX_ListItem::GetItemHeight() const {
return m_pEdit->GetContentRect().Height();
}
@@ -83,108 +87,46 @@ void CFX_ListContainer::SetPlateRect(const CFX_FloatRect& rect) {
CPLST_Select::CPLST_Select() {}
-CPLST_Select::~CPLST_Select() {
- for (int32_t i = 0, sz = m_aItems.GetSize(); i < sz; i++)
- delete m_aItems.GetAt(i);
-
- m_aItems.RemoveAll();
-}
+CPLST_Select::~CPLST_Select() {}
void CPLST_Select::Add(int32_t nItemIndex) {
- int32_t nIndex = Find(nItemIndex);
-
- if (nIndex < 0) {
- m_aItems.Add(new CPLST_Select_Item(nItemIndex, 1));
- } else {
- if (CPLST_Select_Item* pItem = m_aItems.GetAt(nIndex)) {
- pItem->nState = 1;
- }
- }
+ m_Items[nItemIndex] = SELECTING;
}
void CPLST_Select::Add(int32_t nBeginIndex, int32_t nEndIndex) {
- if (nBeginIndex > nEndIndex) {
- int32_t nTemp = nEndIndex;
- nEndIndex = nBeginIndex;
- nBeginIndex = nTemp;
- }
+ if (nBeginIndex > nEndIndex)
+ std::swap(nBeginIndex, nEndIndex);
- for (int32_t i = nBeginIndex; i <= nEndIndex; i++)
+ for (int32_t i = nBeginIndex; i <= nEndIndex; ++i)
Add(i);
}
void CPLST_Select::Sub(int32_t nItemIndex) {
- for (int32_t i = m_aItems.GetSize() - 1; i >= 0; i--) {
- if (CPLST_Select_Item* pItem = m_aItems.GetAt(i))
- if (pItem->nItemIndex == nItemIndex)
- pItem->nState = -1;
- }
+ auto it = m_Items.find(nItemIndex);
+ if (it != m_Items.end())
+ it->second = DESELECTING;
}
void CPLST_Select::Sub(int32_t nBeginIndex, int32_t nEndIndex) {
- if (nBeginIndex > nEndIndex) {
- int32_t nTemp = nEndIndex;
- nEndIndex = nBeginIndex;
- nBeginIndex = nTemp;
- }
+ if (nBeginIndex > nEndIndex)
+ std::swap(nBeginIndex, nEndIndex);
- for (int32_t i = nBeginIndex; i <= nEndIndex; i++)
+ for (int32_t i = nBeginIndex; i <= nEndIndex; ++i)
Sub(i);
}
-int32_t CPLST_Select::Find(int32_t nItemIndex) const {
- for (int32_t i = 0, sz = m_aItems.GetSize(); i < sz; i++) {
- if (CPLST_Select_Item* pItem = m_aItems.GetAt(i)) {
- if (pItem->nItemIndex == nItemIndex)
- return i;
- }
- }
-
- return -1;
-}
-
-bool CPLST_Select::IsExist(int32_t nItemIndex) const {
- return Find(nItemIndex) >= 0;
-}
-
-int32_t CPLST_Select::GetCount() const {
- return m_aItems.GetSize();
-}
-
-int32_t CPLST_Select::GetItemIndex(int32_t nIndex) const {
- if (nIndex >= 0 && nIndex < m_aItems.GetSize())
- if (CPLST_Select_Item* pItem = m_aItems.GetAt(nIndex))
- return pItem->nItemIndex;
-
- return -1;
-}
-
-int32_t CPLST_Select::GetState(int32_t nIndex) const {
- if (nIndex >= 0 && nIndex < m_aItems.GetSize())
- if (CPLST_Select_Item* pItem = m_aItems.GetAt(nIndex))
- return pItem->nState;
-
- return 0;
-}
-
void CPLST_Select::DeselectAll() {
- for (int32_t i = 0, sz = m_aItems.GetSize(); i < sz; i++) {
- if (CPLST_Select_Item* pItem = m_aItems.GetAt(i)) {
- pItem->nState = -1;
- }
- }
+ for (auto& item : m_Items)
+ item.second = DESELECTING;
}
void CPLST_Select::Done() {
- for (int32_t i = m_aItems.GetSize() - 1; i >= 0; i--) {
- if (CPLST_Select_Item* pItem = m_aItems.GetAt(i)) {
- if (pItem->nState == -1) {
- delete pItem;
- m_aItems.RemoveAt(i);
- } else {
- pItem->nState = 0;
- }
- }
+ auto it = m_Items.begin();
+ while (it != m_Items.end()) {
+ if (it->second == DESELECTING)
+ it = m_Items.erase(it);
+ else
+ (it++)->second = NORMAL;
}
}
@@ -373,14 +315,13 @@ CFX_FloatRect CFX_ListCtrl::GetItemRect(int32_t nIndex) const {
}
CFX_FloatRect CFX_ListCtrl::GetItemRectInternal(int32_t nIndex) const {
- if (CFX_ListItem* pListItem = m_aListItems.GetAt(nIndex)) {
- CFX_FloatRect rcItem = pListItem->GetRect();
- rcItem.left = 0.0f;
- rcItem.right = GetPlateRect().Width();
- return InnerToOuter(CLST_Rect(rcItem));
- }
+ if (!pdfium::IndexInBounds(m_ListItems, nIndex) || !m_ListItems[nIndex])
+ return CFX_FloatRect();
- return CFX_FloatRect();
+ CFX_FloatRect rcItem = m_ListItems[nIndex]->GetRect();
+ rcItem.left = 0.0f;
+ rcItem.right = GetPlateRect().Width();
+ return InnerToOuter(CLST_Rect(rcItem));
}
int32_t CFX_ListCtrl::GetCaret() const {
@@ -468,20 +409,10 @@ void CFX_ListCtrl::InvalidateItem(int32_t nItemIndex) {
}
void CFX_ListCtrl::SelectItems() {
- for (int32_t i = 0, sz = m_aSelItems.GetCount(); i < sz; i++) {
- int32_t nItemIndex = m_aSelItems.GetItemIndex(i);
- int32_t nState = m_aSelItems.GetState(i);
-
- switch (nState) {
- case 1:
- SetMultipleSelect(nItemIndex, true);
- break;
- case -1:
- SetMultipleSelect(nItemIndex, false);
- break;
- }
+ for (const auto& item : m_aSelItems) {
+ if (item.second != CPLST_Select::NORMAL)
+ SetMultipleSelect(item.first, item.second == CPLST_Select::SELECTING);
}
-
m_aSelItems.Done();
}
@@ -542,7 +473,7 @@ void CFX_ListCtrl::SetScrollPos(const CFX_PointF& point) {
SetScrollPosY(point.y);
}
-void CFX_ListCtrl::SetScrollPosY(FX_FLOAT fy) {
+void CFX_ListCtrl::SetScrollPosY(float fy) {
if (!IsFloatEqual(m_ptScrollPos.y, fy)) {
CFX_FloatRect rcPlate = GetPlateRect();
CFX_FloatRect rcContent = GetContentRectInternal();
@@ -579,19 +510,18 @@ CFX_FloatRect CFX_ListCtrl::GetContentRect() const {
}
void CFX_ListCtrl::ReArrange(int32_t nItemIndex) {
- FX_FLOAT fPosY = 0.0f;
-
- if (CFX_ListItem* pPrevItem = m_aListItems.GetAt(nItemIndex - 1))
- fPosY = pPrevItem->GetRect().bottom;
-
- for (int32_t i = nItemIndex, sz = m_aListItems.GetSize(); i < sz; i++) {
- if (CFX_ListItem* pListItem = m_aListItems.GetAt(i)) {
- FX_FLOAT fListItemHeight = pListItem->GetItemHeight();
+ float fPosY = 0.0f;
+ if (pdfium::IndexInBounds(m_ListItems, nItemIndex - 1) &&
+ m_ListItems[nItemIndex - 1]) {
+ fPosY = m_ListItems[nItemIndex - 1]->GetRect().bottom;
+ }
+ for (const auto& pListItem : m_ListItems) {
+ if (pListItem) {
+ float fListItemHeight = pListItem->GetItemHeight();
pListItem->SetRect(CLST_Rect(0.0f, fPosY, 0.0f, fPosY + fListItemHeight));
fPosY += fListItemHeight;
}
}
-
SetContentRect(CLST_Rect(0.0f, 0.0f, 0.0f, fPosY));
SetScrollInfo();
}
@@ -606,7 +536,6 @@ void CFX_ListCtrl::SetTopItem(int32_t nIndex) {
int32_t CFX_ListCtrl::GetTopItem() const {
int32_t nItemIndex = GetItemIndex(GetBTPoint());
-
if (!IsItemVisible(nItemIndex) && IsItemVisible(nItemIndex + 1))
nItemIndex += 1;
@@ -614,11 +543,7 @@ int32_t CFX_ListCtrl::GetTopItem() const {
}
void CFX_ListCtrl::Empty() {
- for (int32_t i = 0, sz = m_aListItems.GetSize(); i < sz; i++)
- delete m_aListItems.GetAt(i);
-
- m_aListItems.RemoveAll();
-
+ m_ListItems.clear();
InvalidateItem(-1);
}
@@ -628,33 +553,23 @@ void CFX_ListCtrl::Cancel() {
int32_t CFX_ListCtrl::GetItemIndex(const CFX_PointF& point) const {
CFX_PointF pt = OuterToInner(OutToIn(point));
-
bool bFirst = true;
bool bLast = true;
-
- for (int32_t i = 0, sz = m_aListItems.GetSize(); i < sz; i++) {
- if (CFX_ListItem* pListItem = m_aListItems.GetAt(i)) {
- CLST_Rect rcListItem = pListItem->GetRect();
-
- if (IsFloatBigger(pt.y, rcListItem.top)) {
- bFirst = false;
- }
-
- if (IsFloatSmaller(pt.y, rcListItem.bottom)) {
- bLast = false;
- }
-
- if (pt.y >= rcListItem.top && pt.y < rcListItem.bottom) {
- return i;
- }
- }
+ for (const auto& pListItem : m_ListItems) {
+ if (!pListItem)
+ continue;
+ CLST_Rect rcListItem = pListItem->GetRect();
+ if (IsFloatBigger(pt.y, rcListItem.top))
+ bFirst = false;
+ if (IsFloatSmaller(pt.y, rcListItem.bottom))
+ bLast = false;
+ if (pt.y >= rcListItem.top && pt.y < rcListItem.bottom)
+ return &pListItem - &m_ListItems.front();
}
-
if (bFirst)
return 0;
if (bLast)
- return m_aListItems.GetSize() - 1;
-
+ return pdfium::CollectionSize<int32_t>(m_ListItems) - 1;
return -1;
}
@@ -668,81 +583,76 @@ void CFX_ListCtrl::SetFontMap(IPVT_FontMap* pFontMap) {
m_pFontMap = pFontMap;
}
-void CFX_ListCtrl::SetFontSize(FX_FLOAT fFontSize) {
+void CFX_ListCtrl::SetFontSize(float fFontSize) {
m_fFontSize = fFontSize;
}
void CFX_ListCtrl::AddItem(const CFX_WideString& str) {
- CFX_ListItem* pListItem = new CFX_ListItem();
+ auto pListItem = pdfium::MakeUnique<CFX_ListItem>();
pListItem->SetFontMap(m_pFontMap);
pListItem->SetFontSize(m_fFontSize);
pListItem->SetText(str);
- m_aListItems.Add(pListItem);
+ m_ListItems.push_back(std::move(pListItem));
}
CFX_Edit* CFX_ListCtrl::GetItemEdit(int32_t nIndex) const {
- if (CFX_ListItem* pListItem = m_aListItems.GetAt(nIndex)) {
- return pListItem->GetEdit();
- }
-
- return nullptr;
+ if (!pdfium::IndexInBounds(m_ListItems, nIndex) || !m_ListItems[nIndex])
+ return nullptr;
+ return m_ListItems[nIndex]->GetEdit();
}
int32_t CFX_ListCtrl::GetCount() const {
- return m_aListItems.GetSize();
+ return pdfium::CollectionSize<int32_t>(m_ListItems);
}
CFX_FloatRect CFX_ListCtrl::GetPlateRect() const {
return CFX_ListContainer::GetPlateRect();
}
-FX_FLOAT CFX_ListCtrl::GetFontSize() const {
+float CFX_ListCtrl::GetFontSize() const {
return m_fFontSize;
}
-FX_FLOAT CFX_ListCtrl::GetFirstHeight() const {
- if (CFX_ListItem* pListItem = m_aListItems.GetAt(0)) {
- return pListItem->GetItemHeight();
- }
+float CFX_ListCtrl::GetFirstHeight() const {
+ if (m_ListItems.empty() || !m_ListItems.front())
+ return 1.0f;
- return 1.0f;
+ return m_ListItems.front()->GetItemHeight();
}
int32_t CFX_ListCtrl::GetFirstSelected() const {
- for (int32_t i = 0, sz = m_aListItems.GetSize(); i < sz; i++) {
- if (CFX_ListItem* pListItem = m_aListItems.GetAt(i)) {
- if (pListItem->IsSelected())
- return i;
- }
+ int32_t i = 0;
+ for (const auto& pListItem : m_ListItems) {
+ if (pListItem && pListItem->IsSelected())
+ return i;
+ ++i;
}
return -1;
}
int32_t CFX_ListCtrl::GetLastSelected() const {
- for (int32_t i = m_aListItems.GetSize() - 1; i >= 0; i--) {
- if (CFX_ListItem* pListItem = m_aListItems.GetAt(i)) {
- if (pListItem->IsSelected())
- return i;
- }
+ for (auto iter = m_ListItems.rbegin(); iter != m_ListItems.rend(); ++iter) {
+ if (*iter && (*iter)->IsSelected())
+ return &*iter - &m_ListItems.front();
}
return -1;
}
-FX_WCHAR CFX_ListCtrl::Toupper(FX_WCHAR c) const {
+wchar_t CFX_ListCtrl::Toupper(wchar_t c) const {
if ((c >= 'a') && (c <= 'z'))
c = c - ('a' - 'A');
return c;
}
-int32_t CFX_ListCtrl::FindNext(int32_t nIndex, FX_WCHAR nChar) const {
+int32_t CFX_ListCtrl::FindNext(int32_t nIndex, wchar_t nChar) const {
int32_t nCircleIndex = nIndex;
-
- for (int32_t i = 0, sz = m_aListItems.GetSize(); i < sz; i++) {
+ int32_t sz = pdfium::CollectionSize<int32_t>(m_ListItems);
+ for (int32_t i = 0; i < sz; i++) {
nCircleIndex++;
if (nCircleIndex >= sz)
nCircleIndex = 0;
- if (CFX_ListItem* pListItem = m_aListItems.GetAt(nCircleIndex)) {
+ if (CFX_ListItem* pListItem = m_ListItems[nCircleIndex].get()) {
if (Toupper(pListItem->GetFirstChar()) == Toupper(nChar))
return nCircleIndex;
}
@@ -752,15 +662,13 @@ int32_t CFX_ListCtrl::FindNext(int32_t nIndex, FX_WCHAR nChar) const {
}
bool CFX_ListCtrl::IsItemSelected(int32_t nIndex) const {
- if (CFX_ListItem* pListItem = m_aListItems.GetAt(nIndex))
- return pListItem->IsSelected();
- return false;
+ return pdfium::IndexInBounds(m_ListItems, nIndex) && m_ListItems[nIndex] &&
+ m_ListItems[nIndex]->IsSelected();
}
-void CFX_ListCtrl::SetItemSelect(int32_t nItemIndex, bool bSelected) {
- if (CFX_ListItem* pListItem = m_aListItems.GetAt(nItemIndex)) {
- pListItem->SetSelect(bSelected);
- }
+void CFX_ListCtrl::SetItemSelect(int32_t nIndex, bool bSelected) {
+ if (pdfium::IndexInBounds(m_ListItems, nIndex) && m_ListItems[nIndex])
+ m_ListItems[nIndex]->SetSelect(bSelected);
}
void CFX_ListCtrl::SetMultipleSel(bool bMultiple) {
@@ -772,13 +680,12 @@ bool CFX_ListCtrl::IsMultipleSel() const {
}
bool CFX_ListCtrl::IsValid(int32_t nItemIndex) const {
- return nItemIndex >= 0 && nItemIndex < m_aListItems.GetSize();
+ return pdfium::IndexInBounds(m_ListItems, nItemIndex);
}
CFX_WideString CFX_ListCtrl::GetItemText(int32_t nIndex) const {
- if (CFX_ListItem* pListItem = m_aListItems.GetAt(nIndex)) {
- return pListItem->GetText();
- }
+ if (pdfium::IndexInBounds(m_ListItems, nIndex) && m_ListItems[nIndex])
+ return m_ListItems[nIndex]->GetText();
return L"";
}
diff --git a/chromium/third_party/pdfium/fpdfsdk/fxedit/fxet_list.h b/chromium/third_party/pdfium/fpdfsdk/fxedit/fxet_list.h
index 01e18bc000c..50e43c9d2f2 100644
--- a/chromium/third_party/pdfium/fpdfsdk/fxedit/fxet_list.h
+++ b/chromium/third_party/pdfium/fpdfsdk/fxedit/fxet_list.h
@@ -7,7 +7,9 @@
#ifndef FPDFSDK_FXEDIT_FXET_LIST_H_
#define FPDFSDK_FXEDIT_FXET_LIST_H_
+#include <map>
#include <memory>
+#include <vector>
#include "core/fxcrt/fx_coordinates.h"
#include "fpdfsdk/fxedit/fx_edit.h"
@@ -20,10 +22,10 @@ class CLST_Rect : public CFX_FloatRect {
public:
CLST_Rect() { left = top = right = bottom = 0.0f; }
- CLST_Rect(FX_FLOAT other_left,
- FX_FLOAT other_top,
- FX_FLOAT other_right,
- FX_FLOAT other_bottom) {
+ CLST_Rect(float other_left,
+ float other_top,
+ float other_right,
+ float other_bottom) {
left = other_left;
top = other_top;
right = other_right;
@@ -51,14 +53,14 @@ class CLST_Rect : public CFX_FloatRect {
}
bool operator==(const CLST_Rect& rect) const {
- return FXSYS_memcmp(this, &rect, sizeof(CLST_Rect)) == 0;
+ return memcmp(this, &rect, sizeof(CLST_Rect)) == 0;
}
bool operator!=(const CLST_Rect& rect) const { return !(*this == rect); }
- FX_FLOAT Width() const { return right - left; }
+ float Width() const { return right - left; }
- FX_FLOAT Height() const {
+ float Height() const {
if (top > bottom)
return top - bottom;
return bottom - top;
@@ -108,12 +110,12 @@ class CFX_ListItem final {
void SetRect(const CLST_Rect& rect);
void SetSelect(bool bSelected);
void SetText(const CFX_WideString& text);
- void SetFontSize(FX_FLOAT fFontSize);
+ void SetFontSize(float fFontSize);
CFX_WideString GetText() const;
CLST_Rect GetRect() const;
bool IsSelected() const;
- FX_FLOAT GetItemHeight() const;
+ float GetItemHeight() const;
uint16_t GetFirstChar() const;
private:
@@ -168,51 +170,26 @@ class CFX_ListContainer {
CLST_Rect m_rcContent; // positive forever!
};
-template <class TYPE>
-class CLST_ArrayTemplate : public CFX_ArrayTemplate<TYPE> {
- public:
- bool IsEmpty() { return CFX_ArrayTemplate<TYPE>::GetSize() <= 0; }
- TYPE GetAt(int32_t nIndex) const {
- if (nIndex >= 0 && nIndex < CFX_ArrayTemplate<TYPE>::GetSize())
- return CFX_ArrayTemplate<TYPE>::GetAt(nIndex);
- return nullptr;
- }
- void RemoveAt(int32_t nIndex) {
- if (nIndex >= 0 && nIndex < CFX_ArrayTemplate<TYPE>::GetSize())
- CFX_ArrayTemplate<TYPE>::RemoveAt(nIndex);
- }
-};
-
-struct CPLST_Select_Item {
- CPLST_Select_Item(int32_t other_nItemIndex, int32_t other_nState) {
- nItemIndex = other_nItemIndex;
- nState = other_nState;
- }
-
- int32_t nItemIndex;
- int32_t nState; // 0:normal select -1:to deselect 1: to select
-};
-
class CPLST_Select {
public:
+ enum State { DESELECTING = -1, NORMAL = 0, SELECTING = 1 };
+ using const_iterator = std::map<int32_t, State>::const_iterator;
+
CPLST_Select();
virtual ~CPLST_Select();
- public:
void Add(int32_t nItemIndex);
void Add(int32_t nBeginIndex, int32_t nEndIndex);
void Sub(int32_t nItemIndex);
void Sub(int32_t nBeginIndex, int32_t nEndIndex);
- bool IsExist(int32_t nItemIndex) const;
- int32_t Find(int32_t nItemIndex) const;
- int32_t GetCount() const;
- int32_t GetItemIndex(int32_t nIndex) const;
- int32_t GetState(int32_t nIndex) const;
- void Done();
void DeselectAll();
+ void Done();
+
+ const_iterator begin() const { return m_Items.begin(); }
+ const_iterator end() const { return m_Items.end(); }
private:
- CFX_ArrayTemplate<CPLST_Select_Item*> m_aItems;
+ std::map<int32_t, State> m_Items;
};
class CFX_ListCtrl : protected CFX_ListContainer {
@@ -252,17 +229,17 @@ class CFX_ListCtrl : protected CFX_ListContainer {
CFX_WideString GetText() const;
void SetFontMap(IPVT_FontMap* pFontMap);
- void SetFontSize(FX_FLOAT fFontSize);
+ void SetFontSize(float fFontSize);
CFX_FloatRect GetPlateRect() const;
- FX_FLOAT GetFontSize() const;
+ float GetFontSize() const;
CFX_Edit* GetItemEdit(int32_t nIndex) const;
int32_t GetCount() const;
bool IsItemSelected(int32_t nIndex) const;
- FX_FLOAT GetFirstHeight() const;
+ float GetFirstHeight() const;
void SetMultipleSel(bool bMultiple);
bool IsMultipleSel() const;
bool IsValid(int32_t nItemIndex) const;
- int32_t FindNext(int32_t nIndex, FX_WCHAR nChar) const;
+ int32_t FindNext(int32_t nIndex, wchar_t nChar) const;
int32_t GetFirstSelected() const;
CFX_PointF InToOut(const CFX_PointF& point) const;
@@ -280,12 +257,12 @@ class CFX_ListCtrl : protected CFX_ListContainer {
void SelectItems();
bool IsItemVisible(int32_t nItemIndex) const;
void SetScrollInfo();
- void SetScrollPosY(FX_FLOAT fy);
+ void SetScrollPosY(float fy);
void AddItem(const CFX_WideString& str);
CFX_WideString GetItemText(int32_t nIndex) const;
void SetItemSelect(int32_t nItemIndex, bool bSelected);
int32_t GetLastSelected() const;
- FX_WCHAR Toupper(FX_WCHAR c) const;
+ wchar_t Toupper(wchar_t c) const;
CPWL_List_Notify* m_pNotify;
bool m_bNotifyFlag;
@@ -295,8 +272,8 @@ class CFX_ListCtrl : protected CFX_ListContainer {
int32_t m_nFootIndex; // for multiple
bool m_bCtrlSel; // for multiple
int32_t m_nCaretIndex; // for multiple
- CLST_ArrayTemplate<CFX_ListItem*> m_aListItems;
- FX_FLOAT m_fFontSize;
+ std::vector<std::unique_ptr<CFX_ListItem>> m_ListItems;
+ float m_fFontSize;
IPVT_FontMap* m_pFontMap;
bool m_bMultiple;
};
diff --git a/chromium/third_party/pdfium/fpdfsdk/javascript/Consts.cpp b/chromium/third_party/pdfium/fpdfsdk/javascript/Consts.cpp
index 82f9b4c9457..8c01ae0d485 100644
--- a/chromium/third_party/pdfium/fpdfsdk/javascript/Consts.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/javascript/Consts.cpp
@@ -139,7 +139,7 @@ void CJS_GlobalConsts::DefineJSObjects(CJS_Runtime* pRuntime) {
#define GLOBAL_ARRAY(rt, name, ...) \
{ \
- const FX_WCHAR* values[] = {__VA_ARGS__}; \
+ const wchar_t* values[] = {__VA_ARGS__}; \
v8::Local<v8::Array> array = (rt)->NewArray(); \
for (size_t i = 0; i < FX_ArraySize(values); ++i) \
array->Set(i, (rt)->NewString(values[i])); \
diff --git a/chromium/third_party/pdfium/fpdfsdk/javascript/Document.cpp b/chromium/third_party/pdfium/fpdfsdk/javascript/Document.cpp
index a45b8b9ea7c..45c22b106c6 100644
--- a/chromium/third_party/pdfium/fpdfsdk/javascript/Document.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/javascript/Document.cpp
@@ -1468,7 +1468,7 @@ int Document::CountWords(CPDF_TextObject* pTextObj) {
for (int i = 0, sz = pTextObj->CountChars(); i < sz; i++) {
uint32_t charcode = CPDF_Font::kInvalidCharCode;
- FX_FLOAT kerning;
+ float kerning;
pTextObj->GetCharInfo(i, &charcode, &kerning);
CFX_WideString swUnicode = pFont->UnicodeFromCharCode(charcode);
@@ -1501,7 +1501,7 @@ CFX_WideString Document::GetObjWordStr(CPDF_TextObject* pTextObj,
for (int i = 0, sz = pTextObj->CountChars(); i < sz; i++) {
uint32_t charcode = CPDF_Font::kInvalidCharCode;
- FX_FLOAT kerning;
+ float kerning;
pTextObj->GetCharInfo(i, &charcode, &kerning);
CFX_WideString swUnicode = pFont->UnicodeFromCharCode(charcode);
diff --git a/chromium/third_party/pdfium/fpdfsdk/javascript/Field.cpp b/chromium/third_party/pdfium/fpdfsdk/javascript/Field.cpp
index f37b3d486bc..c7dc2608ca5 100644
--- a/chromium/third_party/pdfium/fpdfsdk/javascript/Field.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/javascript/Field.cpp
@@ -575,7 +575,7 @@ bool Field::buttonAlignX(CJS_Runtime* pRuntime,
CPDF_IconFit IconFit = pFormControl->GetIconFit();
- FX_FLOAT fLeft, fBottom;
+ float fLeft, fBottom;
IconFit.GetIconPosition(fLeft, fBottom);
vp << (int32_t)fLeft;
@@ -624,7 +624,7 @@ bool Field::buttonAlignY(CJS_Runtime* pRuntime,
CPDF_IconFit IconFit = pFormControl->GetIconFit();
- FX_FLOAT fLeft, fBottom;
+ float fLeft, fBottom;
IconFit.GetIconPosition(fLeft, fBottom);
vp << (int32_t)fBottom;
@@ -1816,7 +1816,7 @@ bool Field::page(CJS_Runtime* pRuntime,
return false;
}
- auto pWidget = static_cast<CPDFSDK_Widget*>(pObserved.Get());
+ auto* pWidget = static_cast<CPDFSDK_Widget*>(pObserved.Get());
CPDFSDK_PageView* pPageView = pWidget->GetPageView();
if (!pPageView)
return false;
@@ -2003,11 +2003,11 @@ bool Field::rect(CJS_Runtime* pRuntime,
rcArray.GetElement(pRuntime, 2, Lower_Rightx);
rcArray.GetElement(pRuntime, 3, Lower_Righty);
- FX_FLOAT pArray[4] = {0.0f, 0.0f, 0.0f, 0.0f};
- pArray[0] = static_cast<FX_FLOAT>(Upper_Leftx.ToInt(pRuntime));
- pArray[1] = static_cast<FX_FLOAT>(Lower_Righty.ToInt(pRuntime));
- pArray[2] = static_cast<FX_FLOAT>(Lower_Rightx.ToInt(pRuntime));
- pArray[3] = static_cast<FX_FLOAT>(Upper_Lefty.ToInt(pRuntime));
+ float pArray[4] = {0.0f, 0.0f, 0.0f, 0.0f};
+ pArray[0] = static_cast<float>(Upper_Leftx.ToInt(pRuntime));
+ pArray[1] = static_cast<float>(Lower_Righty.ToInt(pRuntime));
+ pArray[2] = static_cast<float>(Lower_Rightx.ToInt(pRuntime));
+ pArray[3] = static_cast<float>(Upper_Lefty.ToInt(pRuntime));
CFX_FloatRect crRect(pArray);
if (m_bDelay) {
@@ -2482,12 +2482,10 @@ bool Field::textSize(CJS_Runtime* pRuntime,
if (!pFormControl)
return false;
+ float fFontSize;
CPDF_DefaultAppearance FieldAppearance = pFormControl->GetDefaultAppearance();
-
- CFX_ByteString csFontNameTag;
- FX_FLOAT fFontSize;
- FieldAppearance.GetFont(csFontNameTag, fFontSize);
- vp << (int)fFontSize;
+ FieldAppearance.GetFont(&fFontSize);
+ vp << static_cast<int>(fFontSize);
return true;
}
diff --git a/chromium/third_party/pdfium/fpdfsdk/javascript/JS_Define.h b/chromium/third_party/pdfium/fpdfsdk/javascript/JS_Define.h
index 375ca3ac357..fb901dc7148 100644
--- a/chromium/third_party/pdfium/fpdfsdk/javascript/JS_Define.h
+++ b/chromium/third_party/pdfium/fpdfsdk/javascript/JS_Define.h
@@ -222,7 +222,7 @@ void JSMethod(const char* method_name_string,
v8::Local<v8::Object> obj) { \
CJS_Object* pObj = new js_class_name(obj); \
pObj->SetEmbedObject(new class_alternate(pObj)); \
- pEngine->SetObjectPrivate(obj, (void*)pObj); \
+ pEngine->SetObjectPrivate(obj, pObj); \
pObj->InitInstance(static_cast<CJS_Runtime*>(pEngine)); \
} \
void js_class_name::JSDestructor(CFXJS_Engine* pEngine, \
diff --git a/chromium/third_party/pdfium/fpdfsdk/javascript/JS_EventHandler.cpp b/chromium/third_party/pdfium/fpdfsdk/javascript/JS_EventHandler.cpp
index bd1c8e29d0d..a63b7a82fe9 100644
--- a/chromium/third_party/pdfium/fpdfsdk/javascript/JS_EventHandler.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/javascript/JS_EventHandler.cpp
@@ -435,7 +435,7 @@ bool CJS_EventHandler::Modifier() {
return m_bModifier;
}
-const FX_WCHAR* CJS_EventHandler::Name() {
+const wchar_t* CJS_EventHandler::Name() {
switch (m_eEventType) {
case JET_APP_INIT:
return L"Init";
@@ -506,7 +506,7 @@ const FX_WCHAR* CJS_EventHandler::Name() {
}
}
-const FX_WCHAR* CJS_EventHandler::Type() {
+const wchar_t* CJS_EventHandler::Type() {
switch (m_eEventType) {
case JET_APP_INIT:
return L"App";
diff --git a/chromium/third_party/pdfium/fpdfsdk/javascript/JS_EventHandler.h b/chromium/third_party/pdfium/fpdfsdk/javascript/JS_EventHandler.h
index b9836b04e47..1e70a358bc7 100644
--- a/chromium/third_party/pdfium/fpdfsdk/javascript/JS_EventHandler.h
+++ b/chromium/third_party/pdfium/fpdfsdk/javascript/JS_EventHandler.h
@@ -150,8 +150,8 @@ class CJS_EventHandler {
bool FieldFull();
bool KeyDown();
bool Modifier();
- const FX_WCHAR* Name();
- const FX_WCHAR* Type();
+ const wchar_t* Name();
+ const wchar_t* Type();
bool& Rc();
int& SelEnd();
int& SelStart();
diff --git a/chromium/third_party/pdfium/fpdfsdk/javascript/JS_GlobalData.cpp b/chromium/third_party/pdfium/fpdfsdk/javascript/JS_GlobalData.cpp
index 68d929fb3a6..14202646c55 100644
--- a/chromium/third_party/pdfium/fpdfsdk/javascript/JS_GlobalData.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/javascript/JS_GlobalData.cpp
@@ -9,6 +9,7 @@
#include <utility>
#include "core/fdrm/crypto/fx_crypt.h"
+#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
#define JS_MAXGLOBALDATA (1024 * 4 - 8)
@@ -104,7 +105,7 @@ void CJS_GlobalData::SetGlobalVariableNumber(const CFX_ByteString& propname,
pData->data.dData = dData;
return;
}
- std::unique_ptr<CJS_GlobalData_Element> pNewData(new CJS_GlobalData_Element);
+ auto pNewData = pdfium::MakeUnique<CJS_GlobalData_Element>();
pNewData->data.sKey = sPropName;
pNewData->data.nType = JS_GlobalDataType::NUMBER;
pNewData->data.dData = dData;
@@ -122,7 +123,7 @@ void CJS_GlobalData::SetGlobalVariableBoolean(const CFX_ByteString& propname,
pData->data.bData = bData;
return;
}
- std::unique_ptr<CJS_GlobalData_Element> pNewData(new CJS_GlobalData_Element);
+ auto pNewData = pdfium::MakeUnique<CJS_GlobalData_Element>();
pNewData->data.sKey = sPropName;
pNewData->data.nType = JS_GlobalDataType::BOOLEAN;
pNewData->data.bData = bData;
@@ -140,7 +141,7 @@ void CJS_GlobalData::SetGlobalVariableString(const CFX_ByteString& propname,
pData->data.sData = sData;
return;
}
- std::unique_ptr<CJS_GlobalData_Element> pNewData(new CJS_GlobalData_Element);
+ auto pNewData = pdfium::MakeUnique<CJS_GlobalData_Element>();
pNewData->data.sKey = sPropName;
pNewData->data.nType = JS_GlobalDataType::STRING;
pNewData->data.sData = sData;
@@ -159,7 +160,7 @@ void CJS_GlobalData::SetGlobalVariableObject(
pData->data.objData.Copy(array);
return;
}
- std::unique_ptr<CJS_GlobalData_Element> pNewData(new CJS_GlobalData_Element);
+ auto pNewData = pdfium::MakeUnique<CJS_GlobalData_Element>();
pNewData->data.sKey = sPropName;
pNewData->data.nType = JS_GlobalDataType::OBJECT;
pNewData->data.objData.Copy(array);
@@ -175,7 +176,7 @@ void CJS_GlobalData::SetGlobalVariableNull(const CFX_ByteString& propname) {
pData->data.nType = JS_GlobalDataType::NULLOBJ;
return;
}
- std::unique_ptr<CJS_GlobalData_Element> pNewData(new CJS_GlobalData_Element);
+ auto pNewData = pdfium::MakeUnique<CJS_GlobalData_Element>();
pNewData->data.sKey = sPropName;
pNewData->data.nType = JS_GlobalDataType::NULLOBJ;
m_arrayGlobalData.push_back(std::move(pNewData));
@@ -336,18 +337,18 @@ void CJS_GlobalData::SaveGlobalPersisitentVariables() {
CRYPT_ArcFourCryptBlock(sFile.GetBuffer(), sFile.GetSize(), JS_RC4KEY,
sizeof(JS_RC4KEY));
- WriteFileBuffer(m_sFilePath.c_str(), (const FX_CHAR*)sFile.GetBuffer(),
+ WriteFileBuffer(m_sFilePath.c_str(), (const char*)sFile.GetBuffer(),
sFile.GetSize());
}
-void CJS_GlobalData::LoadFileBuffer(const FX_WCHAR* sFilePath,
+void CJS_GlobalData::LoadFileBuffer(const wchar_t* sFilePath,
uint8_t*& pBuffer,
int32_t& nLength) {
// UnSupport.
}
-void CJS_GlobalData::WriteFileBuffer(const FX_WCHAR* sFilePath,
- const FX_CHAR* pBuffer,
+void CJS_GlobalData::WriteFileBuffer(const wchar_t* sFilePath,
+ const char* pBuffer,
int32_t nLength) {
// UnSupport.
}
diff --git a/chromium/third_party/pdfium/fpdfsdk/javascript/JS_GlobalData.h b/chromium/third_party/pdfium/fpdfsdk/javascript/JS_GlobalData.h
index c8947cd5807..c4e8e48b361 100644
--- a/chromium/third_party/pdfium/fpdfsdk/javascript/JS_GlobalData.h
+++ b/chromium/third_party/pdfium/fpdfsdk/javascript/JS_GlobalData.h
@@ -59,11 +59,11 @@ class CJS_GlobalData {
iterator FindGlobalVariable(const CFX_ByteString& sPropname);
const_iterator FindGlobalVariable(const CFX_ByteString& sPropname) const;
- void LoadFileBuffer(const FX_WCHAR* sFilePath,
+ void LoadFileBuffer(const wchar_t* sFilePath,
uint8_t*& pBuffer,
int32_t& nLength);
- void WriteFileBuffer(const FX_WCHAR* sFilePath,
- const FX_CHAR* pBuffer,
+ void WriteFileBuffer(const wchar_t* sFilePath,
+ const char* pBuffer,
int32_t nLength);
void MakeByteString(const CFX_ByteString& name,
CJS_KeyValue* pData,
diff --git a/chromium/third_party/pdfium/fpdfsdk/javascript/JS_Value.cpp b/chromium/third_party/pdfium/fpdfsdk/javascript/JS_Value.cpp
index b0588475647..e9fa9a0fbed 100644
--- a/chromium/third_party/pdfium/fpdfsdk/javascript/JS_Value.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/javascript/JS_Value.cpp
@@ -55,10 +55,10 @@ CJS_Value::CJS_Value(CJS_Runtime* pRuntime, CJS_Object* pObj) {
m_pValue = pObj->ToV8Object();
}
-CJS_Value::CJS_Value(CJS_Runtime* pRuntime, const FX_WCHAR* pWstr)
+CJS_Value::CJS_Value(CJS_Runtime* pRuntime, const wchar_t* pWstr)
: m_pValue(pRuntime->NewString(pWstr)) {}
-CJS_Value::CJS_Value(CJS_Runtime* pRuntime, const FX_CHAR* pStr)
+CJS_Value::CJS_Value(CJS_Runtime* pRuntime, const char* pStr)
: m_pValue(pRuntime->NewString(CFX_WideString::FromLocal(pStr).c_str())) {}
CJS_Value::CJS_Value(CJS_Runtime* pRuntime, const CJS_Array& array)
@@ -267,7 +267,7 @@ void CJS_PropValue::operator>>(CFX_ByteString& str) const {
str = m_Value.ToCFXByteString(m_pJSRuntime);
}
-void CJS_PropValue::operator<<(const FX_WCHAR* str) {
+void CJS_PropValue::operator<<(const wchar_t* str) {
ASSERT(!m_bIsSetting);
m_Value = CJS_Value(m_pJSRuntime, str);
}
@@ -501,7 +501,7 @@ int _isfinite(double v) {
}
double _toInteger(double n) {
- return (n >= 0) ? FXSYS_floor(n) : -FXSYS_floor(-n);
+ return (n >= 0) ? floor(n) : -floor(-n);
}
bool _isLeapYear(int year) {
@@ -509,9 +509,8 @@ bool _isLeapYear(int year) {
}
int _DayFromYear(int y) {
- return (int)(365 * (y - 1970.0) + FXSYS_floor((y - 1969.0) / 4) -
- FXSYS_floor((y - 1901.0) / 100) +
- FXSYS_floor((y - 1601.0) / 400));
+ return (int)(365 * (y - 1970.0) + floor((y - 1969.0) / 4) -
+ floor((y - 1901.0) / 100) + floor((y - 1601.0) / 400));
}
double _TimeFromYear(int y) {
@@ -529,7 +528,7 @@ double _TimeFromYearMonth(int y, int m) {
}
int _Day(double t) {
- return (int)FXSYS_floor(t / 86400000);
+ return (int)floor(t / 86400000);
}
int _YearFromTime(double t) {
@@ -699,7 +698,7 @@ double JS_MakeDay(int nYear, int nMonth, int nDate) {
double y = _toInteger(nYear);
double m = _toInteger(nMonth);
double dt = _toInteger(nDate);
- double ym = y + FXSYS_floor((double)m / 12);
+ double ym = y + floor((double)m / 12);
double mn = _Mod(m, 12);
double t = _TimeFromYearMonth((int)ym, (int)mn);
diff --git a/chromium/third_party/pdfium/fpdfsdk/javascript/JS_Value.h b/chromium/third_party/pdfium/fpdfsdk/javascript/JS_Value.h
index 313f0c3e7b7..0c19701587a 100644
--- a/chromium/third_party/pdfium/fpdfsdk/javascript/JS_Value.h
+++ b/chromium/third_party/pdfium/fpdfsdk/javascript/JS_Value.h
@@ -38,8 +38,8 @@ class CJS_Value {
CJS_Value(CJS_Runtime* pRuntime, const float& fValue);
CJS_Value(CJS_Runtime* pRuntime, const bool& bValue);
CJS_Value(CJS_Runtime* pRuntime, CJS_Object* pObj);
- CJS_Value(CJS_Runtime* pRuntime, const FX_CHAR* pStr);
- CJS_Value(CJS_Runtime* pRuntime, const FX_WCHAR* pWstr);
+ CJS_Value(CJS_Runtime* pRuntime, const char* pStr);
+ CJS_Value(CJS_Runtime* pRuntime, const wchar_t* pWstr);
CJS_Value(CJS_Runtime* pRuntime, const CJS_Array& array);
CJS_Value(CJS_Runtime* pRuntime, const CJS_Date& date);
CJS_Value(CJS_Runtime* pRuntime, const CJS_Object* object);
@@ -107,7 +107,7 @@ class CJS_PropValue {
void operator>>(CFX_ByteString&) const;
void operator<<(CFX_WideString);
void operator>>(CFX_WideString&) const;
- void operator<<(const FX_WCHAR* c_string);
+ void operator<<(const wchar_t* c_string);
void operator<<(v8::Local<v8::Object>);
void operator>>(v8::Local<v8::Object>&) const;
void operator>>(CJS_Array& array) const;
diff --git a/chromium/third_party/pdfium/fpdfsdk/javascript/PublicMethods.cpp b/chromium/third_party/pdfium/fpdfsdk/javascript/PublicMethods.cpp
index 3bcbc341acf..f479527ef69 100644
--- a/chromium/third_party/pdfium/fpdfsdk/javascript/PublicMethods.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/javascript/PublicMethods.cpp
@@ -59,14 +59,14 @@ IMPLEMENT_JS_STATIC_GLOBAL_FUN(CJS_PublicMethods)
namespace {
-const FX_WCHAR* const months[] = {L"Jan", L"Feb", L"Mar", L"Apr",
- L"May", L"Jun", L"Jul", L"Aug",
- L"Sep", L"Oct", L"Nov", L"Dec"};
+const wchar_t* const months[] = {L"Jan", L"Feb", L"Mar", L"Apr",
+ L"May", L"Jun", L"Jul", L"Aug",
+ L"Sep", L"Oct", L"Nov", L"Dec"};
-const FX_WCHAR* const fullmonths[] = {L"January", L"February", L"March",
- L"April", L"May", L"June",
- L"July", L"August", L"September",
- L"October", L"November", L"December"};
+const wchar_t* const fullmonths[] = {L"January", L"February", L"March",
+ L"April", L"May", L"June",
+ L"July", L"August", L"September",
+ L"October", L"November", L"December"};
CFX_ByteString StrTrim(const CFX_ByteString& pStr) {
CFX_ByteString result(pStr);
@@ -82,7 +82,7 @@ CFX_WideString StrTrim(const CFX_WideString& pStr) {
return result;
}
-void AlertIfPossible(CJS_EventContext* pContext, const FX_WCHAR* swMsg) {
+void AlertIfPossible(CJS_EventContext* pContext, const wchar_t* swMsg) {
CPDFSDK_FormFillEnvironment* pFormFillEnv = pContext->GetFormFillEnv();
if (pFormFillEnv)
pFormFillEnv->JS_appAlert(swMsg, nullptr, 0, 3);
@@ -115,8 +115,8 @@ CFX_ByteString CalculateString(double dValue,
bool CJS_PublicMethods::IsNumber(const CFX_WideString& str) {
CFX_WideString sTrim = StrTrim(str);
- const FX_WCHAR* pTrim = sTrim.c_str();
- const FX_WCHAR* p = pTrim;
+ const wchar_t* pTrim = sTrim.c_str();
+ const wchar_t* p = pTrim;
bool bDot = false;
bool bKXJS = false;
@@ -168,7 +168,7 @@ bool CJS_PublicMethods::isReservedMaskChar(wchar_t ch) {
return ch == L'9' || ch == L'A' || ch == L'O' || ch == L'X';
}
-double CJS_PublicMethods::AF_Simple(const FX_WCHAR* sFuction,
+double CJS_PublicMethods::AF_Simple(const wchar_t* sFuction,
double dValue1,
double dValue2) {
if (FXSYS_wcsicmp(sFuction, L"AVG") == 0 ||
@@ -235,7 +235,7 @@ int CJS_PublicMethods::ParseStringInteger(const CFX_WideString& str,
if (i - nStart > 10)
break;
- FX_WCHAR c = str.GetAt(i);
+ wchar_t c = str.GetAt(i);
if (!FXSYS_iswdigit(c))
break;
@@ -254,7 +254,7 @@ CFX_WideString CJS_PublicMethods::ParseStringString(const CFX_WideString& str,
CFX_WideString swRet;
nSkip = 0;
for (int i = nStart, sz = str.GetLength(); i < sz; i++) {
- FX_WCHAR c = str.GetAt(i);
+ wchar_t c = str.GetAt(i);
if (!FXSYS_iswdigit(c))
break;
@@ -286,7 +286,7 @@ double CJS_PublicMethods::ParseNormalDate(const CFX_WideString& value,
if (nIndex > 2)
break;
- FX_WCHAR c = value.GetAt(i);
+ wchar_t c = value.GetAt(i);
if (FXSYS_iswdigit(c)) {
number[nIndex++] = ParseStringInteger(value, i, nSkip, 4);
i += nSkip;
@@ -373,7 +373,7 @@ double CJS_PublicMethods::MakeRegularDate(const CFX_WideString& value,
if (bExit)
break;
- FX_WCHAR c = format.GetAt(i);
+ wchar_t c = format.GetAt(i);
switch (c) {
case ':':
case '.':
@@ -630,7 +630,7 @@ CFX_WideString CJS_PublicMethods::MakeFormatDate(double dDate,
int i = 0;
while (i < format.GetLength()) {
- FX_WCHAR c = format.GetAt(i);
+ wchar_t c = format.GetAt(i);
int remaining = format.GetLength() - i - 1;
sPart = L"";
switch (c) {
@@ -946,7 +946,7 @@ bool CJS_PublicMethods::AFNumber_Keystroke(CJS_Runtime* pRuntime,
int iSepStyle = params[1].ToInt(pRuntime);
if (iSepStyle < 0 || iSepStyle > 3)
iSepStyle = 0;
- const FX_WCHAR cSep = iSepStyle < 2 ? L'.' : L',';
+ const wchar_t cSep = iSepStyle < 2 ? L'.' : L',';
bool bHasSep = wstrValue.Find(cSep) != -1;
for (FX_STRSIZE i = 0; i < wstrChange.GetLength(); ++i) {
@@ -1142,7 +1142,7 @@ double CJS_PublicMethods::MakeInterDate(const CFX_WideString& strValue) {
std::vector<CFX_WideString> wsArray;
CFX_WideString sTemp = L"";
for (int i = 0; i < strValue.GetLength(); ++i) {
- FX_WCHAR c = strValue.GetAt(i);
+ wchar_t c = strValue.GetAt(i);
if (c == L' ' || c == L':') {
wsArray.push_back(sTemp);
sTemp = L"";
@@ -1239,20 +1239,20 @@ bool CJS_PublicMethods::AFDate_Format(CJS_Runtime* pRuntime,
}
int iIndex = params[0].ToInt(pRuntime);
- const FX_WCHAR* cFormats[] = {L"m/d",
- L"m/d/yy",
- L"mm/dd/yy",
- L"mm/yy",
- L"d-mmm",
- L"d-mmm-yy",
- L"dd-mmm-yy",
- L"yy-mm-dd",
- L"mmm-yy",
- L"mmmm-yy",
- L"mmm d, yyyy",
- L"mmmm d, yyyy",
- L"m/d/yy h:MM tt",
- L"m/d/yy HH:MM"};
+ const wchar_t* cFormats[] = {L"m/d",
+ L"m/d/yy",
+ L"mm/dd/yy",
+ L"mm/yy",
+ L"d-mmm",
+ L"d-mmm-yy",
+ L"dd-mmm-yy",
+ L"yy-mm-dd",
+ L"mmm-yy",
+ L"mmmm-yy",
+ L"mmm d, yyyy",
+ L"mmmm d, yyyy",
+ L"m/d/yy h:MM tt",
+ L"m/d/yy HH:MM"};
if (iIndex < 0 || (static_cast<size_t>(iIndex) >= FX_ArraySize(cFormats)))
iIndex = 0;
@@ -1273,20 +1273,20 @@ bool CJS_PublicMethods::AFDate_Keystroke(CJS_Runtime* pRuntime,
}
int iIndex = params[0].ToInt(pRuntime);
- const FX_WCHAR* cFormats[] = {L"m/d",
- L"m/d/yy",
- L"mm/dd/yy",
- L"mm/yy",
- L"d-mmm",
- L"d-mmm-yy",
- L"dd-mmm-yy",
- L"yy-mm-dd",
- L"mmm-yy",
- L"mmmm-yy",
- L"mmm d, yyyy",
- L"mmmm d, yyyy",
- L"m/d/yy h:MM tt",
- L"m/d/yy HH:MM"};
+ const wchar_t* cFormats[] = {L"m/d",
+ L"m/d/yy",
+ L"mm/dd/yy",
+ L"mm/yy",
+ L"d-mmm",
+ L"d-mmm-yy",
+ L"dd-mmm-yy",
+ L"yy-mm-dd",
+ L"mmm-yy",
+ L"mmmm-yy",
+ L"mmm d, yyyy",
+ L"mmmm d, yyyy",
+ L"m/d/yy h:MM tt",
+ L"m/d/yy HH:MM"};
if (iIndex < 0 || (static_cast<size_t>(iIndex) >= FX_ArraySize(cFormats)))
iIndex = 0;
@@ -1307,8 +1307,8 @@ bool CJS_PublicMethods::AFTime_Format(CJS_Runtime* pRuntime,
}
int iIndex = params[0].ToInt(pRuntime);
- const FX_WCHAR* cFormats[] = {L"HH:MM", L"h:MM tt", L"HH:MM:ss",
- L"h:MM:ss tt"};
+ const wchar_t* cFormats[] = {L"HH:MM", L"h:MM tt", L"HH:MM:ss",
+ L"h:MM:ss tt"};
if (iIndex < 0 || (static_cast<size_t>(iIndex) >= FX_ArraySize(cFormats)))
iIndex = 0;
@@ -1328,8 +1328,8 @@ bool CJS_PublicMethods::AFTime_Keystroke(CJS_Runtime* pRuntime,
}
int iIndex = params[0].ToInt(pRuntime);
- const FX_WCHAR* cFormats[] = {L"HH:MM", L"h:MM tt", L"HH:MM:ss",
- L"h:MM:ss tt"};
+ const wchar_t* cFormats[] = {L"HH:MM", L"h:MM tt", L"HH:MM:ss",
+ L"h:MM:ss tt"};
if (iIndex < 0 || (static_cast<size_t>(iIndex) >= FX_ArraySize(cFormats)))
iIndex = 0;
@@ -1461,7 +1461,7 @@ bool CJS_PublicMethods::AFSpecial_KeystrokeEx(
pEvent->Rc() = false;
return true;
}
- FX_WCHAR wMask = wstrMask[iIndexMask];
+ wchar_t wMask = wstrMask[iIndexMask];
if (!isReservedMaskChar(wMask))
wChange.SetAt(i, wMask);
@@ -1776,7 +1776,7 @@ bool CJS_PublicMethods::AFExtractNums(CJS_Runtime* pRuntime,
CJS_Array nums;
int nIndex = 0;
for (int i = 0, sz = str.GetLength(); i < sz; i++) {
- FX_WCHAR wc = str.GetAt(i);
+ wchar_t wc = str.GetAt(i);
if (FXSYS_iswdigit(wc)) {
sPart += wc;
} else {
diff --git a/chromium/third_party/pdfium/fpdfsdk/javascript/PublicMethods.h b/chromium/third_party/pdfium/fpdfsdk/javascript/PublicMethods.h
index 060c74303a8..0f6123cd17e 100644
--- a/chromium/third_party/pdfium/fpdfsdk/javascript/PublicMethods.h
+++ b/chromium/third_party/pdfium/fpdfsdk/javascript/PublicMethods.h
@@ -153,7 +153,7 @@ class CJS_PublicMethods : public CJS_Object {
static bool maskSatisfied(wchar_t c_Change, wchar_t c_Mask);
static bool isReservedMaskChar(wchar_t ch);
- static double AF_Simple(const FX_WCHAR* sFuction,
+ static double AF_Simple(const wchar_t* sFuction,
double dValue1,
double dValue2);
static CJS_Array AF_MakeArrayFromList(CJS_Runtime* pRuntime, CJS_Value val);
diff --git a/chromium/third_party/pdfium/fpdfsdk/javascript/app.cpp b/chromium/third_party/pdfium/fpdfsdk/javascript/app.cpp
index 3a8bf088f36..400340e38d7 100644
--- a/chromium/third_party/pdfium/fpdfsdk/javascript/app.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/javascript/app.cpp
@@ -283,7 +283,8 @@ bool app::viewerVersion(CJS_Runtime* pRuntime,
return false;
#ifdef PDF_ENABLE_XFA
CPDFXFA_Context* pXFAContext = pRuntime->GetFormFillEnv()->GetXFAContext();
- if (pXFAContext->GetDocType() == 1 || pXFAContext->GetDocType() == 2) {
+ if (pXFAContext->GetDocType() == XFA_DocType::Dynamic ||
+ pXFAContext->GetDocType() == XFA_DocType::Static) {
vp << JS_NUM_VIEWERVERSION_XFA;
return true;
}
diff --git a/chromium/third_party/pdfium/fpdfsdk/javascript/cjs_runtime.cpp b/chromium/third_party/pdfium/fpdfsdk/javascript/cjs_runtime.cpp
index 1ece0b6f79d..cb8f69f9da0 100644
--- a/chromium/third_party/pdfium/fpdfsdk/javascript/cjs_runtime.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/javascript/cjs_runtime.cpp
@@ -147,8 +147,7 @@ void CJS_Runtime::DefineJSObjects() {
}
IJS_EventContext* CJS_Runtime::NewEventContext() {
- m_EventContextArray.push_back(
- std::unique_ptr<CJS_EventContext>(new CJS_EventContext(this)));
+ m_EventContextArray.push_back(pdfium::MakeUnique<CJS_EventContext>(this));
return m_EventContextArray.back().get();
}
@@ -221,7 +220,7 @@ CFX_WideString ChangeObjName(const CFX_WideString& str) {
}
bool CJS_Runtime::GetValueByName(const CFX_ByteStringC& utf8Name,
CFXJSE_Value* pValue) {
- const FX_CHAR* name = utf8Name.c_str();
+ const char* name = utf8Name.c_str();
v8::Isolate::Scope isolate_scope(GetIsolate());
v8::HandleScope handle_scope(GetIsolate());
@@ -243,7 +242,7 @@ bool CJS_Runtime::SetValueByName(const CFX_ByteStringC& utf8Name,
CFXJSE_Value* pValue) {
if (utf8Name.IsEmpty() || !pValue)
return false;
- const FX_CHAR* name = utf8Name.c_str();
+ const char* name = utf8Name.c_str();
v8::Isolate* pIsolate = GetIsolate();
v8::Isolate::Scope isolate_scope(pIsolate);
v8::HandleScope handle_scope(pIsolate);
diff --git a/chromium/third_party/pdfium/fpdfsdk/javascript/color.cpp b/chromium/third_party/pdfium/fpdfsdk/javascript/color.cpp
index b5ccbadabf1..376eefa248d 100644
--- a/chromium/third_party/pdfium/fpdfsdk/javascript/color.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/javascript/color.cpp
@@ -121,13 +121,12 @@ void color::ConvertArrayToPWLColor(CJS_Runtime* pRuntime,
if (sSpace == "T") {
*color = CPWL_Color(COLORTYPE_TRANSPARENT);
} else if (sSpace == "G") {
- *color = CPWL_Color(COLORTYPE_GRAY, (FX_FLOAT)d1);
+ *color = CPWL_Color(COLORTYPE_GRAY, (float)d1);
} else if (sSpace == "RGB") {
- *color =
- CPWL_Color(COLORTYPE_RGB, (FX_FLOAT)d1, (FX_FLOAT)d2, (FX_FLOAT)d3);
+ *color = CPWL_Color(COLORTYPE_RGB, (float)d1, (float)d2, (float)d3);
} else if (sSpace == "CMYK") {
- *color = CPWL_Color(COLORTYPE_CMYK, (FX_FLOAT)d1, (FX_FLOAT)d2,
- (FX_FLOAT)d3, (FX_FLOAT)d4);
+ *color =
+ CPWL_Color(COLORTYPE_CMYK, (float)d1, (float)d2, (float)d3, (float)d4);
}
}
diff --git a/chromium/third_party/pdfium/fpdfsdk/javascript/global.cpp b/chromium/third_party/pdfium/fpdfsdk/javascript/global.cpp
index a450606b1a4..92fbc9eec6e 100644
--- a/chromium/third_party/pdfium/fpdfsdk/javascript/global.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/javascript/global.cpp
@@ -60,12 +60,12 @@ void JSGlobalAlternate::Initial(CPDFSDK_FormFillEnvironment* pFormFillEnv) {
UpdateGlobalPersistentVariables();
}
-bool JSGlobalAlternate::QueryProperty(const FX_WCHAR* propname) {
+bool JSGlobalAlternate::QueryProperty(const wchar_t* propname) {
return CFX_WideString(propname) != L"setPersistent";
}
bool JSGlobalAlternate::DelProperty(CJS_Runtime* pRuntime,
- const FX_WCHAR* propname,
+ const wchar_t* propname,
CFX_WideString& sError) {
auto it = m_mapGlobal.find(CFX_ByteString::FromUnicode(propname));
if (it == m_mapGlobal.end())
@@ -76,7 +76,7 @@ bool JSGlobalAlternate::DelProperty(CJS_Runtime* pRuntime,
}
bool JSGlobalAlternate::DoProperty(CJS_Runtime* pRuntime,
- const FX_WCHAR* propname,
+ const wchar_t* propname,
CJS_PropValue& vp,
CFX_WideString& sError) {
if (vp.IsSetting()) {
diff --git a/chromium/third_party/pdfium/fpdfsdk/javascript/global.h b/chromium/third_party/pdfium/fpdfsdk/javascript/global.h
index e313929beac..7c002488d26 100644
--- a/chromium/third_party/pdfium/fpdfsdk/javascript/global.h
+++ b/chromium/third_party/pdfium/fpdfsdk/javascript/global.h
@@ -39,13 +39,13 @@ class JSGlobalAlternate : public CJS_EmbedObj {
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError);
- bool QueryProperty(const FX_WCHAR* propname);
+ bool QueryProperty(const wchar_t* propname);
bool DoProperty(CJS_Runtime* pRuntime,
- const FX_WCHAR* propname,
+ const wchar_t* propname,
CJS_PropValue& vp,
CFX_WideString& sError);
bool DelProperty(CJS_Runtime* pRuntime,
- const FX_WCHAR* propname,
+ const wchar_t* propname,
CFX_WideString& sError);
void Initial(CPDFSDK_FormFillEnvironment* pFormFillEnv);
diff --git a/chromium/third_party/pdfium/fpdfsdk/javascript/util.cpp b/chromium/third_party/pdfium/fpdfsdk/javascript/util.cpp
index 3221cfb0cbb..f88cdc615d4 100644
--- a/chromium/third_party/pdfium/fpdfsdk/javascript/util.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/javascript/util.cpp
@@ -46,14 +46,14 @@ namespace {
// Map PDF-style directives to equivalent wcsftime directives. Not
// all have direct equivalents, though.
struct TbConvert {
- const FX_WCHAR* lpszJSMark;
- const FX_WCHAR* lpszCppMark;
+ const wchar_t* lpszJSMark;
+ const wchar_t* lpszCppMark;
};
// Map PDF-style directives lacking direct wcsftime directives to
// the value with which they will be replaced.
struct TbConvertAdditional {
- const FX_WCHAR* lpszJSMark;
+ const wchar_t* lpszJSMark;
int iValue;
};
@@ -113,9 +113,10 @@ bool util::printf(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError) {
- int iSize = params.size();
+ const size_t iSize = params.size();
if (iSize < 1)
return false;
+
std::wstring c_ConvChar(params[0].ToCFXWideString(pRuntime).c_str());
std::vector<std::wstring> c_strConvers;
int iOffset = 0;
@@ -134,19 +135,19 @@ bool util::printf(CJS_Runtime* pRuntime,
std::wstring c_strResult;
std::wstring c_strFormat;
- for (int iIndex = 0; iIndex < (int)c_strConvers.size(); iIndex++) {
+ for (size_t iIndex = 0; iIndex < c_strConvers.size(); ++iIndex) {
c_strFormat = c_strConvers[iIndex];
if (iIndex == 0) {
c_strResult = c_strFormat;
continue;
}
- CFX_WideString strSegment;
if (iIndex >= iSize) {
c_strResult += c_strFormat;
continue;
}
+ CFX_WideString strSegment;
switch (ParseDataType(&c_strFormat)) {
case UTIL_INT:
strSegment.Format(c_strFormat.c_str(), params[iIndex].ToInt(pRuntime));
@@ -175,12 +176,12 @@ bool util::printd(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError) {
- int iSize = params.size();
+ const size_t iSize = params.size();
if (iSize < 2)
return false;
- CJS_Value p1 = params[0];
- CJS_Value p2 = params[1];
+ const CJS_Value& p1 = params[0];
+ const CJS_Value& p2 = params[1];
CJS_Date jsDate;
if (!p2.ConvertToDate(pRuntime, jsDate)) {
sError = JSGetStringFromID(IDS_STRING_JSPRINT1);
@@ -318,7 +319,7 @@ bool util::printx(CJS_Runtime* pRuntime,
enum CaseMode { kPreserveCase, kUpperCase, kLowerCase };
-static FX_WCHAR TranslateCase(FX_WCHAR input, CaseMode eMode) {
+static wchar_t TranslateCase(wchar_t input, CaseMode eMode) {
if (eMode == kLowerCase && input >= 'A' && input <= 'Z')
return input | 0x20;
if (eMode == kUpperCase && input >= 'a' && input <= 'z')
@@ -421,8 +422,7 @@ bool util::scand(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError) {
- int iSize = params.size();
- if (iSize < 2)
+ if (params.size() < 2)
return false;
CFX_WideString sFormat = params[0].ToCFXWideString(pRuntime);
@@ -456,7 +456,7 @@ bool util::byteToChar(CJS_Runtime* pRuntime,
return false;
}
- CFX_WideString wStr(static_cast<FX_WCHAR>(arg));
+ CFX_WideString wStr(static_cast<wchar_t>(arg));
vRet = CJS_Value(pRuntime, wStr.c_str());
return true;
}
diff --git a/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_Caret.cpp b/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_Caret.cpp
index 3360bbf62a5..3658fbc23ae 100644
--- a/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_Caret.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_Caret.cpp
@@ -35,9 +35,9 @@ void CPWL_Caret::DrawThisAppearance(CFX_RenderDevice* pDevice,
CFX_FloatRect rcClip = GetClipRect();
CFX_PathData path;
- FX_FLOAT fCaretX = rcRect.left + m_fWidth * 0.5f;
- FX_FLOAT fCaretTop = rcRect.top;
- FX_FLOAT fCaretBottom = rcRect.bottom;
+ float fCaretX = rcRect.left + m_fWidth * 0.5f;
+ float fCaretTop = rcRect.top;
+ float fCaretBottom = rcRect.bottom;
if (!rcClip.IsEmpty()) {
rcRect.Intersect(rcClip);
if (rcRect.IsEmpty())
diff --git a/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_Caret.h b/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_Caret.h
index 60ebbdc8e1e..7c041f4f5ed 100644
--- a/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_Caret.h
+++ b/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_Caret.h
@@ -45,7 +45,7 @@ class CPWL_Caret : public CPWL_Wnd {
bool m_bFlash;
CFX_PointF m_ptHead;
CFX_PointF m_ptFoot;
- FX_FLOAT m_fWidth;
+ float m_fWidth;
int32_t m_nDelay;
CFX_FloatRect m_rcInvalid;
};
diff --git a/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_ComboBox.cpp b/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_ComboBox.cpp
index bc6909a07dd..5adf4561f29 100644
--- a/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_ComboBox.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_ComboBox.cpp
@@ -339,8 +339,8 @@ void CPWL_ComboBox::RePosChildWnd() {
CFX_FloatRect rcEdit = rcClient;
CFX_FloatRect rcList = CPWL_Wnd::GetWindowRect();
- FX_FLOAT fOldWindowHeight = m_rcOldWindow.Height();
- FX_FLOAT fOldClientHeight = fOldWindowHeight - GetBorderWidth() * 2;
+ float fOldWindowHeight = m_rcOldWindow.Height();
+ float fOldClientHeight = fOldWindowHeight - GetBorderWidth() * 2;
switch (m_nPopupWhere) {
case 0:
@@ -440,7 +440,7 @@ void CPWL_ComboBox::SetPopup(bool bPopup) {
return;
if (bPopup == m_bPopup)
return;
- FX_FLOAT fListHeight = m_pList->GetContentRect().Height();
+ float fListHeight = m_pList->GetContentRect().Height();
if (!IsFloatBigger(fListHeight, 0.0f))
return;
@@ -453,12 +453,12 @@ void CPWL_ComboBox::SetPopup(bool bPopup) {
return;
#endif // PDF_ENABLE_XFA
int32_t nWhere = 0;
- FX_FLOAT fPopupRet = 0.0f;
- FX_FLOAT fPopupMin = 0.0f;
+ float fPopupRet = 0.0f;
+ float fPopupMin = 0.0f;
if (m_pList->GetCount() > 3)
fPopupMin =
m_pList->GetFirstHeight() * 3 + m_pList->GetBorderWidth() * 2;
- FX_FLOAT fPopupMax = fListHeight + m_pList->GetBorderWidth() * 2;
+ float fPopupMax = fListHeight + m_pList->GetBorderWidth() * 2;
m_pFillerNotify->QueryWherePopup(GetAttachedData(), fPopupMin, fPopupMax,
nWhere, fPopupRet);
diff --git a/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_Edit.cpp b/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_Edit.cpp
index b77aad9ab04..1212d7f8531 100644
--- a/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_Edit.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_Edit.cpp
@@ -6,13 +6,14 @@
#include "fpdfsdk/pdfwindow/PWL_Edit.h"
+#include <algorithm>
#include <memory>
#include <vector>
#include "core/fpdfapi/font/cpdf_font.h"
#include "core/fpdfdoc/cpvt_word.h"
#include "core/fxcrt/fx_safe_types.h"
-#include "core/fxcrt/fx_xml.h"
+#include "core/fxcrt/xml/cxml_element.h"
#include "core/fxge/cfx_graphstatedata.h"
#include "core/fxge/cfx_pathdata.h"
#include "core/fxge/cfx_renderdevice.h"
@@ -101,7 +102,7 @@ void CPWL_Edit::RePosChildWnd() {
CFX_FloatRect CPWL_Edit::GetClientRect() const {
CFX_FloatRect rcClient = CPWL_Utils::DeflateRect(
- GetWindowRect(), (FX_FLOAT)(GetBorderWidth() + GetInnerBorderWidth()));
+ GetWindowRect(), (float)(GetBorderWidth() + GetInnerBorderWidth()));
if (CPWL_ScrollBar* pVSB = GetVScrollBar()) {
if (pVSB->IsVisible()) {
@@ -329,7 +330,7 @@ void CPWL_Edit::DrawThisAppearance(CFX_RenderDevice* pDevice,
switch (GetBorderStyle()) {
case BorderStyle::SOLID: {
CFX_GraphStateData gsd;
- gsd.m_LineWidth = (FX_FLOAT)GetBorderWidth();
+ gsd.m_LineWidth = (float)GetBorderWidth();
CFX_PathData path;
@@ -355,12 +356,12 @@ void CPWL_Edit::DrawThisAppearance(CFX_RenderDevice* pDevice,
}
case BorderStyle::DASH: {
CFX_GraphStateData gsd;
- gsd.m_LineWidth = (FX_FLOAT)GetBorderWidth();
+ gsd.m_LineWidth = (float)GetBorderWidth();
gsd.SetDashCount(2);
- gsd.m_DashArray[0] = (FX_FLOAT)GetBorderDash().nDash;
- gsd.m_DashArray[1] = (FX_FLOAT)GetBorderDash().nGap;
- gsd.m_DashPhase = (FX_FLOAT)GetBorderDash().nPhase;
+ gsd.m_DashArray[0] = (float)GetBorderDash().nDash;
+ gsd.m_DashArray[1] = (float)GetBorderDash().nGap;
+ gsd.m_DashPhase = (float)GetBorderDash().nPhase;
CFX_PathData path;
for (int32_t i = 0; i < nCharArray - 1; i++) {
@@ -463,7 +464,7 @@ void CPWL_Edit::OnKillFocus() {
m_bFocus = false;
}
-void CPWL_Edit::SetCharSpace(FX_FLOAT fCharSpace) {
+void CPWL_Edit::SetCharSpace(float fCharSpace) {
m_pEdit->SetCharSpace(fCharSpace);
}
@@ -527,16 +528,16 @@ bool CPWL_Edit::IsTextFull() const {
return m_pEdit->IsTextFull();
}
-FX_FLOAT CPWL_Edit::GetCharArrayAutoFontSize(CPDF_Font* pFont,
- const CFX_FloatRect& rcPlate,
- int32_t nCharArray) {
+float CPWL_Edit::GetCharArrayAutoFontSize(CPDF_Font* pFont,
+ const CFX_FloatRect& rcPlate,
+ int32_t nCharArray) {
if (pFont && !pFont->IsStandardFont()) {
FX_RECT rcBBox;
pFont->GetFontBBox(rcBBox);
CFX_FloatRect rcCell = rcPlate;
- FX_FLOAT xdiv = rcCell.Width() / nCharArray * 1000.0f / rcBBox.Width();
- FX_FLOAT ydiv = -rcCell.Height() * 1000.0f / rcBBox.Height();
+ float xdiv = rcCell.Width() / nCharArray * 1000.0f / rcBBox.Width();
+ float ydiv = -rcCell.Height() * 1000.0f / rcBBox.Height();
return xdiv < ydiv ? xdiv : ydiv;
}
@@ -551,8 +552,8 @@ void CPWL_Edit::SetCharArray(int32_t nCharArray) {
if (HasFlag(PWS_AUTOFONTSIZE)) {
if (IPVT_FontMap* pFontMap = GetFontMap()) {
- FX_FLOAT fFontSize = GetCharArrayAutoFontSize(
- pFontMap->GetPDFFont(0), GetClientRect(), nCharArray);
+ float fFontSize = GetCharArrayAutoFontSize(pFontMap->GetPDFFont(0),
+ GetClientRect(), nCharArray);
if (fFontSize > 0.0f) {
m_pEdit->SetAutoFontSize(false, true);
m_pEdit->SetFontSize(fFontSize);
@@ -791,21 +792,8 @@ void CPWL_Edit::OnInsertText(const CPVT_WordPlace& place,
CPVT_WordRange CPWL_Edit::CombineWordRange(const CPVT_WordRange& wr1,
const CPVT_WordRange& wr2) {
- CPVT_WordRange wrRet;
-
- if (wr1.BeginPos.WordCmp(wr2.BeginPos) < 0) {
- wrRet.BeginPos = wr1.BeginPos;
- } else {
- wrRet.BeginPos = wr2.BeginPos;
- }
-
- if (wr1.EndPos.WordCmp(wr2.EndPos) < 0) {
- wrRet.EndPos = wr2.EndPos;
- } else {
- wrRet.EndPos = wr1.EndPos;
- }
-
- return wrRet;
+ return CPVT_WordRange(std::min(wr1.BeginPos, wr2.BeginPos),
+ std::max(wr1.EndPos, wr2.EndPos));
}
CPVT_WordRange CPWL_Edit::GetLatinWordsRange(const CFX_PointF& point) const {
diff --git a/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_Edit.h b/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_Edit.h
index b6d01300f04..5e1a36610d2 100644
--- a/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_Edit.h
+++ b/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_Edit.h
@@ -21,12 +21,11 @@ class IFX_Edit_UndoItem;
class IPWL_Filler_Notify {
public:
virtual ~IPWL_Filler_Notify() {}
- virtual void QueryWherePopup(
- void* pPrivateData,
- FX_FLOAT fPopupMin,
- FX_FLOAT fPopupMax,
- int32_t& nRet,
- FX_FLOAT& fPopupRet) = 0; // nRet: (0:bottom 1:top)
+ virtual void QueryWherePopup(void* pPrivateData,
+ float fPopupMin,
+ float fPopupMax,
+ int32_t& nRet,
+ float& fPopupRet) = 0; // nRet: (0:bottom 1:top)
virtual void OnBeforeKeyStroke(void* pPrivateData,
CFX_WideString& strChange,
const CFX_WideString& strChangeEx,
@@ -78,7 +77,7 @@ class CPWL_Edit : public CPWL_EditCtrl {
void SetCharArray(int32_t nCharArray);
void SetLimitChar(int32_t nLimitChar);
- void SetCharSpace(FX_FLOAT fCharSpace);
+ void SetCharSpace(float fCharSpace);
bool CanSelectAll() const;
bool CanClear() const;
@@ -96,9 +95,9 @@ class CPWL_Edit : public CPWL_EditCtrl {
bool IsTextFull() const;
- static FX_FLOAT GetCharArrayAutoFontSize(CPDF_Font* pFont,
- const CFX_FloatRect& rcPlate,
- int32_t nCharArray);
+ static float GetCharArrayAutoFontSize(CPDF_Font* pFont,
+ const CFX_FloatRect& rcPlate,
+ int32_t nCharArray);
void SetFillerNotify(IPWL_Filler_Notify* pNotify) {
m_pFillerNotify = pNotify;
@@ -123,7 +122,7 @@ class CPWL_Edit : public CPWL_EditCtrl {
bool IsVScrollBarVisible() const;
void SetParamByFlag();
- FX_FLOAT GetCharArrayAutoFontSize(int32_t nCharArray);
+ float GetCharArrayAutoFontSize(int32_t nCharArray);
CFX_PointF GetWordRightBottomPoint(const CPVT_WordPlace& wpWord);
CPVT_WordRange CombineWordRange(const CPVT_WordRange& wr1,
diff --git a/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp b/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp
index 4921ab7a08b..19daae14139 100644
--- a/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp
@@ -21,8 +21,7 @@ CPWL_EditCtrl::CPWL_EditCtrl()
: m_pEdit(new CFX_Edit),
m_pEditCaret(nullptr),
m_bMouseDown(false),
- m_nCharSet(FXFONT_DEFAULT_CHARSET),
- m_nCodePage(0) {}
+ m_nCharSet(FXFONT_DEFAULT_CHARSET) {}
CPWL_EditCtrl::~CPWL_EditCtrl() {}
@@ -84,7 +83,7 @@ void CPWL_EditCtrl::OnNotify(CPWL_Wnd* pWnd,
}
break;
case PNM_SCROLLWINDOW: {
- FX_FLOAT fPos = *(FX_FLOAT*)lParam;
+ float fPos = *(float*)lParam;
switch (wParam) {
case SBT_VSCROLL:
m_pEdit->SetScrollPos(CFX_PointF(m_pEdit->GetScrollPos().x, fPos));
@@ -121,11 +120,11 @@ void CPWL_EditCtrl::CreateEditCaret(const PWL_CREATEPARAM& cp) {
m_pEditCaret->Create(ecp);
}
-void CPWL_EditCtrl::SetFontSize(FX_FLOAT fFontSize) {
+void CPWL_EditCtrl::SetFontSize(float fFontSize) {
m_pEdit->SetFontSize(fFontSize);
}
-FX_FLOAT CPWL_EditCtrl::GetFontSize() const {
+float CPWL_EditCtrl::GetFontSize() const {
return m_pEdit->GetFontSize();
}
@@ -314,10 +313,6 @@ bool CPWL_EditCtrl::OnMouseMove(const CFX_PointF& point, uint32_t nFlag) {
return true;
}
-CFX_FloatRect CPWL_EditCtrl::GetContentRect() const {
- return m_pEdit->GetContentRect();
-}
-
void CPWL_EditCtrl::SetEditCaret(bool bVisible) {
CFX_PointF ptHead;
CFX_PointF ptFoot;
@@ -378,26 +373,6 @@ void CPWL_EditCtrl::SelectAll() {
m_pEdit->SelectAll();
}
-void CPWL_EditCtrl::Paint() {
- m_pEdit->Paint();
-}
-
-void CPWL_EditCtrl::EnableRefresh(bool bRefresh) {
- m_pEdit->EnableRefresh(bRefresh);
-}
-
-int32_t CPWL_EditCtrl::GetCaret() const {
- return m_pEdit->GetCaret();
-}
-
-void CPWL_EditCtrl::SetCaret(int32_t nPos) {
- m_pEdit->SetCaret(nPos);
-}
-
-int32_t CPWL_EditCtrl::GetTotalWords() const {
- return m_pEdit->GetTotalWords();
-}
-
void CPWL_EditCtrl::SetScrollPos(const CFX_PointF& point) {
m_pEdit->SetScrollPos(point);
}
@@ -406,49 +381,6 @@ CFX_PointF CPWL_EditCtrl::GetScrollPos() const {
return m_pEdit->GetScrollPos();
}
-CPDF_Font* CPWL_EditCtrl::GetCaretFont() const {
- int32_t nFontIndex = 0;
-
- CFX_Edit_Iterator* pIterator = m_pEdit->GetIterator();
- pIterator->SetAt(m_pEdit->GetCaret());
- CPVT_Word word;
- CPVT_Section section;
- if (pIterator->GetWord(word)) {
- nFontIndex = word.nFontIndex;
- } else if (HasFlag(PES_RICH)) {
- if (pIterator->GetSection(section)) {
- nFontIndex = section.WordProps.nFontIndex;
- }
- }
-
- if (IPVT_FontMap* pFontMap = GetFontMap())
- return pFontMap->GetPDFFont(nFontIndex);
-
- return nullptr;
-}
-
-FX_FLOAT CPWL_EditCtrl::GetCaretFontSize() const {
- FX_FLOAT fFontSize = GetFontSize();
-
- CFX_Edit_Iterator* pIterator = m_pEdit->GetIterator();
- pIterator->SetAt(m_pEdit->GetCaret());
- CPVT_Word word;
- CPVT_Section section;
- if (pIterator->GetWord(word)) {
- fFontSize = word.fFontSize;
- } else if (HasFlag(PES_RICH)) {
- if (pIterator->GetSection(section)) {
- fFontSize = section.WordProps.fFontSize;
- }
- }
-
- return fFontSize;
-}
-
-void CPWL_EditCtrl::SetText(const CFX_WideString& wsText) {
- m_pEdit->SetText(wsText);
-}
-
void CPWL_EditCtrl::CopyText() {}
void CPWL_EditCtrl::PasteText() {}
@@ -457,11 +389,6 @@ void CPWL_EditCtrl::CutText() {}
void CPWL_EditCtrl::ShowVScrollBar(bool bShow) {}
-void CPWL_EditCtrl::InsertText(const CFX_WideString& wsText) {
- if (!IsReadOnly())
- m_pEdit->InsertText(wsText, FXFONT_DEFAULT_CHARSET);
-}
-
void CPWL_EditCtrl::InsertWord(uint16_t word, int32_t nCharset) {
if (!IsReadOnly())
m_pEdit->InsertWord(word, nCharset);
@@ -500,12 +427,12 @@ void CPWL_EditCtrl::Undo() {
m_pEdit->Undo();
}
-void CPWL_EditCtrl::IOnSetScrollInfoY(FX_FLOAT fPlateMin,
- FX_FLOAT fPlateMax,
- FX_FLOAT fContentMin,
- FX_FLOAT fContentMax,
- FX_FLOAT fSmallStep,
- FX_FLOAT fBigStep) {
+void CPWL_EditCtrl::IOnSetScrollInfoY(float fPlateMin,
+ float fPlateMax,
+ float fContentMin,
+ float fContentMax,
+ float fSmallStep,
+ float fBigStep) {
PWL_SCROLL_INFO Info;
Info.fPlateWidth = fPlateMax - fPlateMin;
@@ -524,7 +451,7 @@ void CPWL_EditCtrl::IOnSetScrollInfoY(FX_FLOAT fPlateMin,
}
}
-void CPWL_EditCtrl::IOnSetScrollPosY(FX_FLOAT fy) {
+void CPWL_EditCtrl::IOnSetScrollPosY(float fy) {
OnNotify(this, PNM_SETSCROLLPOS, SBT_VSCROLL, (intptr_t)&fy);
}
@@ -540,11 +467,6 @@ void CPWL_EditCtrl::IOnSetCaret(bool bVisible,
OnNotify(this, PNM_SETCARETINFO, (intptr_t)&cInfo, (intptr_t) nullptr);
}
-void CPWL_EditCtrl::IOnCaretChange(const CPVT_SecProps& secProps,
- const CPVT_WordProps& wordProps) {}
-
-void CPWL_EditCtrl::IOnContentChange(const CFX_FloatRect& rcContent) {}
-
void CPWL_EditCtrl::IOnInvalidateRect(CFX_FloatRect* pRect) {
InvalidateRect(pRect);
}
@@ -553,22 +475,6 @@ int32_t CPWL_EditCtrl::GetCharSet() const {
return m_nCharSet < 0 ? FXFONT_DEFAULT_CHARSET : m_nCharSet;
}
-void CPWL_EditCtrl::GetTextRange(const CFX_FloatRect& rect,
- int32_t& nStartChar,
- int32_t& nEndChar) const {
- nStartChar = m_pEdit->WordPlaceToWordIndex(
- m_pEdit->SearchWordPlace(CFX_PointF(rect.left, rect.top)));
- nEndChar = m_pEdit->WordPlaceToWordIndex(
- m_pEdit->SearchWordPlace(CFX_PointF(rect.right, rect.bottom)));
-}
-
-CFX_WideString CPWL_EditCtrl::GetText(int32_t& nStartChar,
- int32_t& nEndChar) const {
- CPVT_WordPlace wpStart = m_pEdit->WordIndexToWordPlace(nStartChar);
- CPVT_WordPlace wpEnd = m_pEdit->WordIndexToWordPlace(nEndChar);
- return m_pEdit->GetRangeText(CPVT_WordRange(wpStart, wpEnd));
-}
-
void CPWL_EditCtrl::SetReadyToInput() {
if (m_bMouseDown) {
ReleaseCapture();
diff --git a/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_EditCtrl.h b/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_EditCtrl.h
index 498570b3b08..0f2487bc261 100644
--- a/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_EditCtrl.h
+++ b/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_EditCtrl.h
@@ -33,37 +33,18 @@ class CPWL_EditCtrl : public CPWL_Wnd {
CPWL_EditCtrl();
~CPWL_EditCtrl() override;
- CFX_FloatRect GetContentRect() const;
-
CFX_WideString GetText() const;
void SetSel(int32_t nStartChar, int32_t nEndChar);
void GetSel(int32_t& nStartChar, int32_t& nEndChar) const;
- void GetTextRange(const CFX_FloatRect& rect,
- int32_t& nStartChar,
- int32_t& nEndChar) const;
- CFX_WideString GetText(int32_t& nStartChar, int32_t& nEndChar) const;
void Clear();
void SelectAll();
- int32_t GetCaret() const;
- void SetCaret(int32_t nPos);
- int32_t GetTotalWords() const;
-
- void Paint();
-
- void EnableRefresh(bool bRefresh);
CFX_PointF GetScrollPos() const;
void SetScrollPos(const CFX_PointF& point);
void SetCharSet(uint8_t nCharSet) { m_nCharSet = nCharSet; }
int32_t GetCharSet() const;
- void SetCodePage(int32_t nCodePage) { m_nCodePage = nCodePage; }
- int32_t GetCodePage() const { return m_nCodePage; }
-
- CPDF_Font* GetCaretFont() const;
- FX_FLOAT GetCaretFontSize() const;
-
bool CanUndo() const;
bool CanRedo() const;
void Redo();
@@ -85,29 +66,24 @@ class CPWL_EditCtrl : public CPWL_Wnd {
intptr_t lParam = 0) override;
void CreateChildWnd(const PWL_CREATEPARAM& cp) override;
void RePosChildWnd() override;
- void SetFontSize(FX_FLOAT fFontSize) override;
- FX_FLOAT GetFontSize() const override;
+ void SetFontSize(float fFontSize) override;
+ float GetFontSize() const override;
void SetCursor() override;
- void IOnSetScrollInfoY(FX_FLOAT fPlateMin,
- FX_FLOAT fPlateMax,
- FX_FLOAT fContentMin,
- FX_FLOAT fContentMax,
- FX_FLOAT fSmallStep,
- FX_FLOAT fBigStep);
- void IOnSetScrollPosY(FX_FLOAT fy);
+ void IOnSetScrollInfoY(float fPlateMin,
+ float fPlateMax,
+ float fContentMin,
+ float fContentMax,
+ float fSmallStep,
+ float fBigStep);
+ void IOnSetScrollPosY(float fy);
void IOnSetCaret(bool bVisible,
const CFX_PointF& ptHead,
const CFX_PointF& ptFoot,
const CPVT_WordPlace& place);
- void IOnCaretChange(const CPVT_SecProps& secProps,
- const CPVT_WordProps& wordProps);
- void IOnContentChange(const CFX_FloatRect& rcContent);
void IOnInvalidateRect(CFX_FloatRect* pRect);
protected:
- void InsertText(const CFX_WideString& wsText);
- void SetText(const CFX_WideString& wsText);
void CopyText();
void PasteText();
void CutText();
@@ -135,7 +111,6 @@ class CPWL_EditCtrl : public CPWL_Wnd {
void CreateEditCaret(const PWL_CREATEPARAM& cp);
int32_t m_nCharSet;
- int32_t m_nCodePage;
};
#endif // FPDFSDK_PDFWINDOW_PWL_EDITCTRL_H_
diff --git a/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_FontMap.cpp b/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_FontMap.cpp
index 9a2962cd567..ddf496fbb03 100644
--- a/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_FontMap.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_FontMap.cpp
@@ -55,32 +55,26 @@ CPDF_Document* CPWL_FontMap::GetDocument() {
m_pPDFDoc->CreateNewDoc();
}
}
-
return m_pPDFDoc.get();
}
CPDF_Font* CPWL_FontMap::GetPDFFont(int32_t nFontIndex) {
- if (nFontIndex >= 0 && nFontIndex < pdfium::CollectionSize<int32_t>(m_Data)) {
- if (m_Data[nFontIndex])
- return m_Data[nFontIndex]->pFont;
- }
+ if (pdfium::IndexInBounds(m_Data, nFontIndex) && m_Data[nFontIndex])
+ return m_Data[nFontIndex]->pFont;
+
return nullptr;
}
CFX_ByteString CPWL_FontMap::GetPDFFontAlias(int32_t nFontIndex) {
- if (nFontIndex >= 0 && nFontIndex < pdfium::CollectionSize<int32_t>(m_Data)) {
- if (m_Data[nFontIndex])
- return m_Data[nFontIndex]->sFontName;
- }
+ if (pdfium::IndexInBounds(m_Data, nFontIndex) && m_Data[nFontIndex])
+ return m_Data[nFontIndex]->sFontName;
+
return CFX_ByteString();
}
bool CPWL_FontMap::KnowWord(int32_t nFontIndex, uint16_t word) {
- if (nFontIndex >= 0 && nFontIndex < pdfium::CollectionSize<int32_t>(m_Data)) {
- if (m_Data[nFontIndex])
- return CharCodeFromUnicode(nFontIndex, word) >= 0;
- }
- return false;
+ return pdfium::IndexInBounds(m_Data, nFontIndex) && m_Data[nFontIndex] &&
+ CharCodeFromUnicode(nFontIndex, word) >= 0;
}
int32_t CPWL_FontMap::GetWordFontIndex(uint16_t word,
@@ -116,7 +110,7 @@ int32_t CPWL_FontMap::GetWordFontIndex(uint16_t word,
}
int32_t CPWL_FontMap::CharCodeFromUnicode(int32_t nFontIndex, uint16_t word) {
- if (nFontIndex < 0 || nFontIndex >= pdfium::CollectionSize<int32_t>(m_Data))
+ if (!pdfium::IndexInBounds(m_Data, nFontIndex))
return -1;
CPWL_FontMap_Data* pData = m_Data[nFontIndex].get();
@@ -186,10 +180,7 @@ int32_t CPWL_FontMap::GetFontIndex(const CFX_ByteString& sFontName,
return nFontIndex;
CFX_ByteString sAlias;
- CPDF_Font* pFont = nullptr;
- if (bFind)
- pFont = FindFontSameCharset(sAlias, nCharset);
-
+ CPDF_Font* pFont = bFind ? FindFontSameCharset(&sAlias, nCharset) : nullptr;
if (!pFont) {
CFX_ByteString sTemp = sFontName;
pFont = AddFontToDocument(GetDocument(), sTemp, nCharset);
@@ -199,7 +190,7 @@ int32_t CPWL_FontMap::GetFontIndex(const CFX_ByteString& sFontName,
return AddFontData(pFont, sAlias, nCharset);
}
-CPDF_Font* CPWL_FontMap::FindFontSameCharset(CFX_ByteString& sFontAlias,
+CPDF_Font* CPWL_FontMap::FindFontSameCharset(CFX_ByteString* sFontAlias,
int32_t nCharset) {
return nullptr;
}
@@ -284,10 +275,7 @@ CFX_ByteString CPWL_FontMap::EncodeFontAlias(const CFX_ByteString& sFontName) {
}
const CPWL_FontMap_Data* CPWL_FontMap::GetFontMapData(int32_t nIndex) const {
- if (nIndex < 0 || nIndex >= pdfium::CollectionSize<int32_t>(m_Data))
- return nullptr;
-
- return m_Data[nIndex].get();
+ return pdfium::IndexInBounds(m_Data, nIndex) ? m_Data[nIndex].get() : nullptr;
}
int32_t CPWL_FontMap::GetNativeCharset() {
diff --git a/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_FontMap.h b/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_FontMap.h
index c14fcd7cd34..21535305ae2 100644
--- a/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_FontMap.h
+++ b/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_FontMap.h
@@ -53,7 +53,7 @@ class CPWL_FontMap : public IPVT_FontMap {
protected:
virtual void Initialize();
virtual CPDF_Document* GetDocument();
- virtual CPDF_Font* FindFontSameCharset(CFX_ByteString& sFontAlias,
+ virtual CPDF_Font* FindFontSameCharset(CFX_ByteString* sFontAlias,
int32_t nCharset);
virtual void AddedFont(CPDF_Font* pFont, const CFX_ByteString& sFontAlias);
diff --git a/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_Icon.cpp b/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_Icon.cpp
index b0d0c7686d9..3ae7244552f 100644
--- a/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_Icon.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_Icon.cpp
@@ -25,12 +25,12 @@ CFX_ByteString CPWL_Image::GetImageAppStream() {
CFX_Matrix mt;
mt.SetReverse(GetImageMatrix());
- FX_FLOAT fHScale = 1.0f;
- FX_FLOAT fVScale = 1.0f;
+ float fHScale = 1.0f;
+ float fVScale = 1.0f;
GetScale(fHScale, fVScale);
- FX_FLOAT fx = 0.0f;
- FX_FLOAT fy = 0.0f;
+ float fx = 0.0f;
+ float fy = 0.0f;
GetImageOffset(fx, fy);
if (m_pPDFStream && sAlias.GetLength() > 0) {
@@ -59,7 +59,7 @@ CPDF_Stream* CPWL_Image::GetPDFStream() {
return m_pPDFStream;
}
-void CPWL_Image::GetImageSize(FX_FLOAT& fWidth, FX_FLOAT& fHeight) {
+void CPWL_Image::GetImageSize(float& fWidth, float& fHeight) {
fWidth = 0.0f;
fHeight = 0.0f;
@@ -96,16 +96,16 @@ CFX_ByteString CPWL_Image::GetImageAlias() {
return CFX_ByteString();
}
-void CPWL_Image::SetImageAlias(const FX_CHAR* sImageAlias) {
+void CPWL_Image::SetImageAlias(const char* sImageAlias) {
m_sImageAlias = sImageAlias;
}
-void CPWL_Image::GetScale(FX_FLOAT& fHScale, FX_FLOAT& fVScale) {
+void CPWL_Image::GetScale(float& fHScale, float& fVScale) {
fHScale = 1.0f;
fVScale = 1.0f;
}
-void CPWL_Image::GetImageOffset(FX_FLOAT& x, FX_FLOAT& y) {
+void CPWL_Image::GetImageOffset(float& x, float& y) {
x = 0.0f;
y = 0.0f;
}
@@ -132,7 +132,7 @@ bool CPWL_Icon::IsProportionalScale() {
return false;
}
-void CPWL_Icon::GetIconPosition(FX_FLOAT& fLeft, FX_FLOAT& fBottom) {
+void CPWL_Icon::GetIconPosition(float& fLeft, float& fBottom) {
if (m_pIconFit) {
fLeft = 0.0f;
fBottom = 0.0f;
@@ -152,13 +152,13 @@ void CPWL_Icon::GetIconPosition(FX_FLOAT& fLeft, FX_FLOAT& fBottom) {
}
}
-void CPWL_Icon::GetScale(FX_FLOAT& fHScale, FX_FLOAT& fVScale) {
+void CPWL_Icon::GetScale(float& fHScale, float& fVScale) {
fHScale = 1.0f;
fVScale = 1.0f;
if (m_pPDFStream) {
- FX_FLOAT fImageWidth, fImageHeight;
- FX_FLOAT fPlateWidth, fPlateHeight;
+ float fImageWidth, fImageHeight;
+ float fPlateWidth, fPlateHeight;
CFX_FloatRect rcPlate = GetClientRect();
fPlateWidth = rcPlate.right - rcPlate.left;
@@ -190,7 +190,7 @@ void CPWL_Icon::GetScale(FX_FLOAT& fHScale, FX_FLOAT& fVScale) {
break;
}
- FX_FLOAT fMinScale;
+ float fMinScale;
if (IsProportionalScale()) {
fMinScale = std::min(fHScale, fVScale);
fHScale = fMinScale;
@@ -199,23 +199,23 @@ void CPWL_Icon::GetScale(FX_FLOAT& fHScale, FX_FLOAT& fVScale) {
}
}
-void CPWL_Icon::GetImageOffset(FX_FLOAT& x, FX_FLOAT& y) {
- FX_FLOAT fLeft, fBottom;
+void CPWL_Icon::GetImageOffset(float& x, float& y) {
+ float fLeft, fBottom;
GetIconPosition(fLeft, fBottom);
x = 0.0f;
y = 0.0f;
- FX_FLOAT fImageWidth, fImageHeight;
+ float fImageWidth, fImageHeight;
GetImageSize(fImageWidth, fImageHeight);
- FX_FLOAT fHScale, fVScale;
+ float fHScale, fVScale;
GetScale(fHScale, fVScale);
- FX_FLOAT fImageFactWidth = fImageWidth * fHScale;
- FX_FLOAT fImageFactHeight = fImageHeight * fVScale;
+ float fImageFactWidth = fImageWidth * fHScale;
+ float fImageFactHeight = fImageHeight * fVScale;
- FX_FLOAT fPlateWidth, fPlateHeight;
+ float fPlateWidth, fPlateHeight;
CFX_FloatRect rcPlate = GetClientRect();
fPlateWidth = rcPlate.right - rcPlate.left;
fPlateHeight = rcPlate.top - rcPlate.bottom;
diff --git a/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_Icon.h b/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_Icon.h
index 4b62db4c990..49ac1f3f3d9 100644
--- a/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_Icon.h
+++ b/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_Icon.h
@@ -17,16 +17,16 @@ class CPWL_Image : public CPWL_Wnd {
virtual CFX_ByteString GetImageAppStream();
- virtual void GetScale(FX_FLOAT& fHScale, FX_FLOAT& fVScale);
- virtual void GetImageOffset(FX_FLOAT& x, FX_FLOAT& y);
+ virtual void GetScale(float& fHScale, float& fVScale);
+ virtual void GetImageOffset(float& x, float& y);
virtual CPDF_Stream* GetPDFStream();
public:
void SetPDFStream(CPDF_Stream* pStream);
- void GetImageSize(FX_FLOAT& fWidth, FX_FLOAT& fHeight);
+ void GetImageSize(float& fWidth, float& fHeight);
CFX_Matrix GetImageMatrix();
CFX_ByteString GetImageAlias();
- void SetImageAlias(const FX_CHAR* sImageAlias);
+ void SetImageAlias(const char* sImageAlias);
protected:
CPDF_Stream* m_pPDFStream;
@@ -41,12 +41,12 @@ class CPWL_Icon : public CPWL_Image {
virtual CPDF_IconFit* GetIconFit();
// CPWL_Image
- void GetScale(FX_FLOAT& fHScale, FX_FLOAT& fVScale) override;
- void GetImageOffset(FX_FLOAT& x, FX_FLOAT& y) override;
+ void GetScale(float& fHScale, float& fVScale) override;
+ void GetImageOffset(float& x, float& y) override;
int32_t GetScaleMethod();
bool IsProportionalScale();
- void GetIconPosition(FX_FLOAT& fLeft, FX_FLOAT& fBottom);
+ void GetIconPosition(float& fLeft, float& fBottom);
void SetIconFit(CPDF_IconFit* pIconFit) { m_pIconFit = pIconFit; }
diff --git a/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_ListBox.cpp b/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_ListBox.cpp
index ed96e203fdf..8448204a74c 100644
--- a/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_ListBox.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_ListBox.cpp
@@ -22,12 +22,12 @@ CPWL_List_Notify::CPWL_List_Notify(CPWL_ListBox* pList) : m_pList(pList) {
CPWL_List_Notify::~CPWL_List_Notify() {}
-void CPWL_List_Notify::IOnSetScrollInfoY(FX_FLOAT fPlateMin,
- FX_FLOAT fPlateMax,
- FX_FLOAT fContentMin,
- FX_FLOAT fContentMax,
- FX_FLOAT fSmallStep,
- FX_FLOAT fBigStep) {
+void CPWL_List_Notify::IOnSetScrollInfoY(float fPlateMin,
+ float fPlateMax,
+ float fContentMin,
+ float fContentMax,
+ float fSmallStep,
+ float fBigStep) {
PWL_SCROLL_INFO Info;
Info.fPlateWidth = fPlateMax - fPlateMin;
@@ -54,7 +54,7 @@ void CPWL_List_Notify::IOnSetScrollInfoY(FX_FLOAT fPlateMin,
}
}
-void CPWL_List_Notify::IOnSetScrollPosY(FX_FLOAT fy) {
+void CPWL_List_Notify::IOnSetScrollPosY(float fy) {
m_pList->OnNotify(m_pList, PNM_SETSCROLLPOS, SBT_VSCROLL, (intptr_t)&fy);
}
@@ -295,7 +295,7 @@ void CPWL_ListBox::OnNotify(CPWL_Wnd* pWnd,
intptr_t lParam) {
CPWL_Wnd::OnNotify(pWnd, msg, wParam, lParam);
- FX_FLOAT fPos;
+ float fPos;
switch (msg) {
case PNM_SETSCROLLINFO:
@@ -317,7 +317,7 @@ void CPWL_ListBox::OnNotify(CPWL_Wnd* pWnd,
}
break;
case PNM_SCROLLWINDOW:
- fPos = *(FX_FLOAT*)lParam;
+ fPos = *(float*)lParam;
switch (wParam) {
case SBT_VSCROLL:
m_pList->SetScrollPos(CFX_PointF(0, fPos));
@@ -371,11 +371,11 @@ CFX_WideString CPWL_ListBox::GetText() const {
return m_pList->GetText();
}
-void CPWL_ListBox::SetFontSize(FX_FLOAT fFontSize) {
+void CPWL_ListBox::SetFontSize(float fFontSize) {
m_pList->SetFontSize(fFontSize);
}
-FX_FLOAT CPWL_ListBox::GetFontSize() const {
+float CPWL_ListBox::GetFontSize() const {
return m_pList->GetFontSize();
}
@@ -428,7 +428,7 @@ int32_t CPWL_ListBox::GetCount() const {
return m_pList->GetCount();
}
-int32_t CPWL_ListBox::FindNext(int32_t nIndex, FX_WCHAR nChar) const {
+int32_t CPWL_ListBox::FindNext(int32_t nIndex, wchar_t nChar) const {
return m_pList->FindNext(nIndex, nChar);
}
@@ -436,13 +436,13 @@ CFX_FloatRect CPWL_ListBox::GetContentRect() const {
return m_pList->GetContentRect();
}
-FX_FLOAT CPWL_ListBox::GetFirstHeight() const {
+float CPWL_ListBox::GetFirstHeight() const {
return m_pList->GetFirstHeight();
}
CFX_FloatRect CPWL_ListBox::GetListRect() const {
return CPWL_Utils::DeflateRect(
- GetWindowRect(), (FX_FLOAT)(GetBorderWidth() + GetInnerBorderWidth()));
+ GetWindowRect(), (float)(GetBorderWidth() + GetInnerBorderWidth()));
}
bool CPWL_ListBox::OnMouseWheel(short zDelta,
diff --git a/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_ListBox.h b/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_ListBox.h
index f9108a17de0..9f8f464efb9 100644
--- a/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_ListBox.h
+++ b/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_ListBox.h
@@ -25,13 +25,13 @@ class CPWL_List_Notify {
explicit CPWL_List_Notify(CPWL_ListBox* pList);
~CPWL_List_Notify();
- void IOnSetScrollInfoY(FX_FLOAT fPlateMin,
- FX_FLOAT fPlateMax,
- FX_FLOAT fContentMin,
- FX_FLOAT fContentMax,
- FX_FLOAT fSmallStep,
- FX_FLOAT fBigStep);
- void IOnSetScrollPosY(FX_FLOAT fy);
+ void IOnSetScrollInfoY(float fPlateMin,
+ float fPlateMax,
+ float fContentMin,
+ float fContentMax,
+ float fSmallStep,
+ float fBigStep);
+ void IOnSetScrollPosY(float fy);
void IOnInvalidateRect(CFX_FloatRect* pRect);
void IOnSetCaret(bool bVisible,
@@ -70,8 +70,8 @@ class CPWL_ListBox : public CPWL_Wnd {
intptr_t lParam = 0) override;
void RePosChildWnd() override;
CFX_FloatRect GetFocusRect() const override;
- void SetFontSize(FX_FLOAT fFontSize) override;
- FX_FLOAT GetFontSize() const override;
+ void SetFontSize(float fFontSize) override;
+ float GetFontSize() const override;
virtual CFX_WideString GetText() const;
@@ -92,9 +92,9 @@ class CPWL_ListBox : public CPWL_Wnd {
int32_t GetCurSel() const;
bool IsItemSelected(int32_t nItemIndex) const;
int32_t GetTopVisibleIndex() const;
- int32_t FindNext(int32_t nIndex, FX_WCHAR nChar) const;
+ int32_t FindNext(int32_t nIndex, wchar_t nChar) const;
CFX_FloatRect GetContentRect() const;
- FX_FLOAT GetFirstHeight() const;
+ float GetFirstHeight() const;
CFX_FloatRect GetListRect() const;
void SetFillerNotify(IPWL_Filler_Notify* pNotify) {
diff --git a/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_ScrollBar.cpp b/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_ScrollBar.cpp
index e3799366a57..1c3efb1faa8 100644
--- a/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_ScrollBar.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_ScrollBar.cpp
@@ -15,7 +15,7 @@ PWL_FLOATRANGE::PWL_FLOATRANGE() {
Default();
}
-PWL_FLOATRANGE::PWL_FLOATRANGE(FX_FLOAT min, FX_FLOAT max) {
+PWL_FLOATRANGE::PWL_FLOATRANGE(float min, float max) {
Set(min, max);
}
@@ -24,7 +24,7 @@ void PWL_FLOATRANGE::Default() {
fMax = 0;
}
-void PWL_FLOATRANGE::Set(FX_FLOAT min, FX_FLOAT max) {
+void PWL_FLOATRANGE::Set(float min, float max) {
if (min > max) {
fMin = max;
fMax = min;
@@ -34,12 +34,12 @@ void PWL_FLOATRANGE::Set(FX_FLOAT min, FX_FLOAT max) {
}
}
-bool PWL_FLOATRANGE::In(FX_FLOAT x) const {
+bool PWL_FLOATRANGE::In(float x) const {
return (IsFloatBigger(x, fMin) || IsFloatEqual(x, fMin)) &&
(IsFloatSmaller(x, fMax) || IsFloatEqual(x, fMax));
}
-FX_FLOAT PWL_FLOATRANGE::GetWidth() const {
+float PWL_FLOATRANGE::GetWidth() const {
return fMax - fMin;
}
@@ -55,7 +55,7 @@ void PWL_SCROLL_PRIVATEDATA::Default() {
fSmallStep = 1;
}
-void PWL_SCROLL_PRIVATEDATA::SetScrollRange(FX_FLOAT min, FX_FLOAT max) {
+void PWL_SCROLL_PRIVATEDATA::SetScrollRange(float min, float max) {
ScrollRange.Set(min, max);
if (IsFloatSmaller(fScrollPos, ScrollRange.fMin))
@@ -64,19 +64,19 @@ void PWL_SCROLL_PRIVATEDATA::SetScrollRange(FX_FLOAT min, FX_FLOAT max) {
fScrollPos = ScrollRange.fMax;
}
-void PWL_SCROLL_PRIVATEDATA::SetClientWidth(FX_FLOAT width) {
+void PWL_SCROLL_PRIVATEDATA::SetClientWidth(float width) {
fClientWidth = width;
}
-void PWL_SCROLL_PRIVATEDATA::SetSmallStep(FX_FLOAT step) {
+void PWL_SCROLL_PRIVATEDATA::SetSmallStep(float step) {
fSmallStep = step;
}
-void PWL_SCROLL_PRIVATEDATA::SetBigStep(FX_FLOAT step) {
+void PWL_SCROLL_PRIVATEDATA::SetBigStep(float step) {
fBigStep = step;
}
-bool PWL_SCROLL_PRIVATEDATA::SetPos(FX_FLOAT pos) {
+bool PWL_SCROLL_PRIVATEDATA::SetPos(float pos) {
if (ScrollRange.In(pos)) {
fScrollPos = pos;
return true;
@@ -320,8 +320,8 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice,
// draw arrow
if (rectWnd.top - rectWnd.bottom > 6.0f) {
- FX_FLOAT fX = rectWnd.left + 1.5f;
- FX_FLOAT fY = rectWnd.bottom;
+ float fX = rectWnd.left + 1.5f;
+ float fY = rectWnd.bottom;
CFX_PointF pts[7] = {CFX_PointF(fX + 2.5f, fY + 4.0f),
CFX_PointF(fX + 2.5f, fY + 3.0f),
CFX_PointF(fX + 4.5f, fY + 5.0f),
@@ -365,8 +365,8 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice,
// draw arrow
if (rectWnd.top - rectWnd.bottom > 6.0f) {
- FX_FLOAT fX = rectWnd.left + 1.5f;
- FX_FLOAT fY = rectWnd.bottom;
+ float fX = rectWnd.left + 1.5f;
+ float fY = rectWnd.bottom;
CFX_PointF pts[7] = {CFX_PointF(fX + 2.5f, fY + 5.0f),
CFX_PointF(fX + 2.5f, fY + 6.0f),
@@ -487,8 +487,8 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice,
if (!IsEnabled())
crStroke = PWL_DEFAULT_HEAVYGRAYCOLOR.ToFXColor(255);
- FX_FLOAT nFrictionWidth = 5.0f;
- FX_FLOAT nFrictionHeight = 5.5f;
+ float nFrictionWidth = 5.0f;
+ float nFrictionHeight = 5.5f;
CFX_PointF ptLeft =
CFX_PointF(ptCenter.x - nFrictionWidth / 2.0f,
@@ -578,7 +578,7 @@ void CPWL_ScrollBar::OnCreate(PWL_CREATEPARAM& cp) {
void CPWL_ScrollBar::RePosChildWnd() {
CFX_FloatRect rcClient = GetClientRect();
CFX_FloatRect rcMinButton, rcMaxButton;
- FX_FLOAT fBWidth = 0;
+ float fBWidth = 0;
switch (m_sbType) {
case SBT_HSCROLL:
@@ -802,7 +802,7 @@ void CPWL_ScrollBar::OnNotify(CPWL_Wnd* pWnd,
PWL_SCROLL_INFO* pInfo = reinterpret_cast<PWL_SCROLL_INFO*>(lParam);
if (pInfo && *pInfo != m_OriginInfo) {
m_OriginInfo = *pInfo;
- FX_FLOAT fMax =
+ float fMax =
pInfo->fContentMax - pInfo->fContentMin - pInfo->fPlateWidth;
fMax = fMax > 0.0f ? fMax : 0.0f;
SetScrollRange(0, fMax, pInfo->fPlateWidth);
@@ -810,7 +810,7 @@ void CPWL_ScrollBar::OnNotify(CPWL_Wnd* pWnd,
}
} break;
case PNM_SETSCROLLPOS: {
- FX_FLOAT fPos = *(FX_FLOAT*)lParam;
+ float fPos = *(float*)lParam;
switch (m_sbType) {
case SBT_HSCROLL:
fPos = fPos - m_OriginInfo.fContentMin;
@@ -850,16 +850,16 @@ void CPWL_ScrollBar::CreateButtons(const PWL_CREATEPARAM& cp) {
}
}
-FX_FLOAT CPWL_ScrollBar::GetScrollBarWidth() const {
+float CPWL_ScrollBar::GetScrollBarWidth() const {
if (!IsVisible())
return 0;
return PWL_SCROLLBAR_WIDTH;
}
-void CPWL_ScrollBar::SetScrollRange(FX_FLOAT fMin,
- FX_FLOAT fMax,
- FX_FLOAT fClientWidth) {
+void CPWL_ScrollBar::SetScrollRange(float fMin,
+ float fMax,
+ float fClientWidth) {
if (m_pPosButton) {
m_sData.SetScrollRange(fMin, fMax);
m_sData.SetClientWidth(fClientWidth);
@@ -873,8 +873,8 @@ void CPWL_ScrollBar::SetScrollRange(FX_FLOAT fMin,
}
}
-void CPWL_ScrollBar::SetScrollPos(FX_FLOAT fPos) {
- FX_FLOAT fOldPos = m_sData.fScrollPos;
+void CPWL_ScrollBar::SetScrollPos(float fPos) {
+ float fOldPos = m_sData.fScrollPos;
m_sData.SetPos(fPos);
@@ -882,7 +882,7 @@ void CPWL_ScrollBar::SetScrollPos(FX_FLOAT fPos) {
MovePosButton(true);
}
-void CPWL_ScrollBar::SetScrollStep(FX_FLOAT fBigStep, FX_FLOAT fSmallStep) {
+void CPWL_ScrollBar::SetScrollStep(float fBigStep, float fSmallStep) {
m_sData.SetBigStep(fBigStep);
m_sData.SetSmallStep(fSmallStep);
}
@@ -898,7 +898,7 @@ void CPWL_ScrollBar::MovePosButton(bool bRefresh) {
rcClient = GetClientRect();
rcPosArea = GetScrollArea();
- FX_FLOAT fLeft, fRight, fTop, fBottom;
+ float fLeft, fRight, fTop, fBottom;
switch (m_sbType) {
case SBT_HSCROLL:
@@ -997,18 +997,18 @@ void CPWL_ScrollBar::OnPosButtonLBUp(const CFX_PointF& point) {
}
void CPWL_ScrollBar::OnPosButtonMouseMove(const CFX_PointF& point) {
- FX_FLOAT fOldScrollPos = m_sData.fScrollPos;
+ float fOldScrollPos = m_sData.fScrollPos;
- FX_FLOAT fNewPos = 0;
+ float fNewPos = 0;
switch (m_sbType) {
case SBT_HSCROLL:
- if (FXSYS_fabs(point.x - m_nOldPos) < 1)
+ if (fabs(point.x - m_nOldPos) < 1)
return;
fNewPos = FaceToTrue(m_fOldPosButton + point.x - m_nOldPos);
break;
case SBT_VSCROLL:
- if (FXSYS_fabs(point.y - m_nOldPos) < 1)
+ if (fabs(point.y - m_nOldPos) < 1)
return;
fNewPos = FaceToTrue(m_fOldPosButton + point.y - m_nOldPos);
break;
@@ -1055,7 +1055,7 @@ void CPWL_ScrollBar::OnPosButtonMouseMove(const CFX_PointF& point) {
void CPWL_ScrollBar::NotifyScrollWindow() {
if (CPWL_Wnd* pParent = GetParentWindow()) {
- FX_FLOAT fPos;
+ float fPos;
switch (m_sbType) {
case SBT_HSCROLL:
fPos = m_OriginInfo.fContentMin + m_sData.fScrollPos;
@@ -1079,10 +1079,10 @@ CFX_FloatRect CPWL_ScrollBar::GetScrollArea() const {
CFX_FloatRect rcMin = m_pMinButton->GetWindowRect();
CFX_FloatRect rcMax = m_pMaxButton->GetWindowRect();
- FX_FLOAT fMinWidth = rcMin.right - rcMin.left;
- FX_FLOAT fMinHeight = rcMin.top - rcMin.bottom;
- FX_FLOAT fMaxWidth = rcMax.right - rcMax.left;
- FX_FLOAT fMaxHeight = rcMax.top - rcMax.bottom;
+ float fMinWidth = rcMin.right - rcMin.left;
+ float fMinHeight = rcMin.top - rcMin.bottom;
+ float fMaxWidth = rcMax.right - rcMax.left;
+ float fMaxHeight = rcMax.top - rcMax.bottom;
switch (m_sbType) {
case SBT_HSCROLL:
@@ -1111,14 +1111,14 @@ CFX_FloatRect CPWL_ScrollBar::GetScrollArea() const {
return rcArea;
}
-FX_FLOAT CPWL_ScrollBar::TrueToFace(FX_FLOAT fTrue) {
+float CPWL_ScrollBar::TrueToFace(float fTrue) {
CFX_FloatRect rcPosArea;
rcPosArea = GetScrollArea();
- FX_FLOAT fFactWidth = m_sData.ScrollRange.GetWidth() + m_sData.fClientWidth;
+ float fFactWidth = m_sData.ScrollRange.GetWidth() + m_sData.fClientWidth;
fFactWidth = fFactWidth == 0 ? 1 : fFactWidth;
- FX_FLOAT fFace = 0;
+ float fFace = 0;
switch (m_sbType) {
case SBT_HSCROLL:
@@ -1134,14 +1134,14 @@ FX_FLOAT CPWL_ScrollBar::TrueToFace(FX_FLOAT fTrue) {
return fFace;
}
-FX_FLOAT CPWL_ScrollBar::FaceToTrue(FX_FLOAT fFace) {
+float CPWL_ScrollBar::FaceToTrue(float fFace) {
CFX_FloatRect rcPosArea;
rcPosArea = GetScrollArea();
- FX_FLOAT fFactWidth = m_sData.ScrollRange.GetWidth() + m_sData.fClientWidth;
+ float fFactWidth = m_sData.ScrollRange.GetWidth() + m_sData.fClientWidth;
fFactWidth = fFactWidth == 0 ? 1 : fFactWidth;
- FX_FLOAT fTrue = 0;
+ float fTrue = 0;
switch (m_sbType) {
case SBT_HSCROLL:
diff --git a/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_ScrollBar.h b/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_ScrollBar.h
index 9546a9e577c..50b0801ca36 100644
--- a/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_ScrollBar.h
+++ b/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_ScrollBar.h
@@ -30,11 +30,11 @@ struct PWL_SCROLL_INFO {
return !(*this == that);
}
- FX_FLOAT fContentMin;
- FX_FLOAT fContentMax;
- FX_FLOAT fPlateWidth;
- FX_FLOAT fBigStep;
- FX_FLOAT fSmallStep;
+ float fContentMin;
+ float fContentMax;
+ float fPlateWidth;
+ float fBigStep;
+ float fSmallStep;
};
enum PWL_SCROLLBAR_TYPE { SBT_HSCROLL, SBT_VSCROLL };
@@ -67,7 +67,7 @@ class CPWL_SBButton : public CPWL_Wnd {
struct PWL_FLOATRANGE {
public:
PWL_FLOATRANGE();
- PWL_FLOATRANGE(FX_FLOAT min, FX_FLOAT max);
+ PWL_FLOATRANGE(float min, float max);
bool operator==(const PWL_FLOATRANGE& that) const {
return fMin == that.fMin && fMax == that.fMax;
@@ -75,12 +75,12 @@ struct PWL_FLOATRANGE {
bool operator!=(const PWL_FLOATRANGE& that) const { return !(*this == that); }
void Default();
- void Set(FX_FLOAT min, FX_FLOAT max);
- bool In(FX_FLOAT x) const;
- FX_FLOAT GetWidth() const;
+ void Set(float min, float max);
+ bool In(float x) const;
+ float GetWidth() const;
- FX_FLOAT fMin;
- FX_FLOAT fMax;
+ float fMin;
+ float fMax;
};
struct PWL_SCROLL_PRIVATEDATA {
@@ -97,11 +97,11 @@ struct PWL_SCROLL_PRIVATEDATA {
}
void Default();
- void SetScrollRange(FX_FLOAT min, FX_FLOAT max);
- void SetClientWidth(FX_FLOAT width);
- void SetSmallStep(FX_FLOAT step);
- void SetBigStep(FX_FLOAT step);
- bool SetPos(FX_FLOAT pos);
+ void SetScrollRange(float min, float max);
+ void SetClientWidth(float width);
+ void SetSmallStep(float step);
+ void SetBigStep(float step);
+ bool SetPos(float pos);
void AddSmall();
void SubSmall();
@@ -109,10 +109,10 @@ struct PWL_SCROLL_PRIVATEDATA {
void SubBig();
PWL_FLOATRANGE ScrollRange;
- FX_FLOAT fClientWidth;
- FX_FLOAT fScrollPos;
- FX_FLOAT fBigStep;
- FX_FLOAT fSmallStep;
+ float fClientWidth;
+ float fScrollPos;
+ float fBigStep;
+ float fSmallStep;
};
class CPWL_ScrollBar : public CPWL_Wnd {
@@ -136,16 +136,16 @@ class CPWL_ScrollBar : public CPWL_Wnd {
void CreateChildWnd(const PWL_CREATEPARAM& cp) override;
void TimerProc() override;
- FX_FLOAT GetScrollBarWidth() const;
+ float GetScrollBarWidth() const;
PWL_SCROLLBAR_TYPE GetScrollBarType() const { return m_sbType; }
void SetNotifyForever(bool bForever) { m_bNotifyForever = bForever; }
protected:
- void SetScrollRange(FX_FLOAT fMin, FX_FLOAT fMax, FX_FLOAT fClientWidth);
- void SetScrollPos(FX_FLOAT fPos);
+ void SetScrollRange(float fMin, float fMax, float fClientWidth);
+ void SetScrollPos(float fPos);
void MovePosButton(bool bRefresh);
- void SetScrollStep(FX_FLOAT fBigStep, FX_FLOAT fSmallStep);
+ void SetScrollStep(float fBigStep, float fSmallStep);
void NotifyScrollWindow();
CFX_FloatRect GetScrollArea() const;
@@ -164,8 +164,8 @@ class CPWL_ScrollBar : public CPWL_Wnd {
void OnPosButtonLBUp(const CFX_PointF& point);
void OnPosButtonMouseMove(const CFX_PointF& point);
- FX_FLOAT TrueToFace(FX_FLOAT);
- FX_FLOAT FaceToTrue(FX_FLOAT);
+ float TrueToFace(float);
+ float FaceToTrue(float);
PWL_SCROLLBAR_TYPE m_sbType;
PWL_SCROLL_INFO m_OriginInfo;
@@ -176,8 +176,8 @@ class CPWL_ScrollBar : public CPWL_Wnd {
bool m_bMouseDown;
bool m_bMinOrMax;
bool m_bNotifyForever;
- FX_FLOAT m_nOldPos;
- FX_FLOAT m_fOldPosButton;
+ float m_nOldPos;
+ float m_fOldPosButton;
};
#endif // FPDFSDK_PDFWINDOW_PWL_SCROLLBAR_H_
diff --git a/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_SpecialButton.cpp b/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_SpecialButton.cpp
index 1c46c375a9d..d2a13219d2b 100644
--- a/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_SpecialButton.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_SpecialButton.cpp
@@ -18,7 +18,7 @@ CFX_ByteString CPWL_PushButton::GetClassName() const {
}
CFX_FloatRect CPWL_PushButton::GetFocusRect() const {
- return CPWL_Utils::DeflateRect(GetWindowRect(), (FX_FLOAT)GetBorderWidth());
+ return CPWL_Utils::DeflateRect(GetWindowRect(), (float)GetBorderWidth());
}
CPWL_CheckBox::CPWL_CheckBox() : m_bChecked(false) {}
diff --git a/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_Utils.cpp b/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_Utils.cpp
index 45668b6a25f..dbac6ad8bc9 100644
--- a/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_Utils.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_Utils.cpp
@@ -18,41 +18,26 @@
#include "fpdfsdk/pdfwindow/PWL_Wnd.h"
CFX_FloatRect CPWL_Utils::OffsetRect(const CFX_FloatRect& rect,
- FX_FLOAT x,
- FX_FLOAT y) {
+ float x,
+ float y) {
return CFX_FloatRect(rect.left + x, rect.bottom + y, rect.right + x,
rect.top + y);
}
CPVT_WordRange CPWL_Utils::OverlapWordRange(const CPVT_WordRange& wr1,
const CPVT_WordRange& wr2) {
- CPVT_WordRange wrRet;
-
- if (wr2.EndPos.WordCmp(wr1.BeginPos) < 0 ||
- wr2.BeginPos.WordCmp(wr1.EndPos) > 0)
- return wrRet;
- if (wr1.EndPos.WordCmp(wr2.BeginPos) < 0 ||
- wr1.BeginPos.WordCmp(wr2.EndPos) > 0)
- return wrRet;
-
- if (wr1.BeginPos.WordCmp(wr2.BeginPos) < 0) {
- wrRet.BeginPos = wr2.BeginPos;
- } else {
- wrRet.BeginPos = wr1.BeginPos;
+ if (wr2.EndPos < wr1.BeginPos || wr2.BeginPos > wr1.EndPos ||
+ wr1.EndPos < wr2.BeginPos || wr1.BeginPos > wr2.EndPos) {
+ return CPVT_WordRange();
}
- if (wr1.EndPos.WordCmp(wr2.EndPos) < 0) {
- wrRet.EndPos = wr1.EndPos;
- } else {
- wrRet.EndPos = wr2.EndPos;
- }
-
- return wrRet;
+ return CPVT_WordRange(std::max(wr1.BeginPos, wr2.BeginPos),
+ std::min(wr1.EndPos, wr2.EndPos));
}
CFX_ByteString CPWL_Utils::GetAP_Check(const CFX_FloatRect& crBBox) {
- const FX_FLOAT fWidth = crBBox.right - crBBox.left;
- const FX_FLOAT fHeight = crBBox.top - crBBox.bottom;
+ const float fWidth = crBBox.right - crBBox.left;
+ const float fHeight = crBBox.top - crBBox.bottom;
CFX_PointF pts[8][3] = {{CFX_PointF(0.28f, 0.52f), CFX_PointF(0.27f, 0.48f),
CFX_PointF(0.29f, 0.40f)},
@@ -84,10 +69,10 @@ CFX_ByteString CPWL_Utils::GetAP_Check(const CFX_FloatRect& crBBox) {
for (size_t i = 0; i < FX_ArraySize(pts); ++i) {
size_t nNext = i < FX_ArraySize(pts) - 1 ? i + 1 : 0;
- FX_FLOAT px1 = pts[i][1].x - pts[i][0].x;
- FX_FLOAT py1 = pts[i][1].y - pts[i][0].y;
- FX_FLOAT px2 = pts[i][2].x - pts[nNext][0].x;
- FX_FLOAT py2 = pts[i][2].y - pts[nNext][0].y;
+ float px1 = pts[i][1].x - pts[i][0].x;
+ float py1 = pts[i][1].y - pts[i][0].y;
+ float px2 = pts[i][2].x - pts[nNext][0].x;
+ float py2 = pts[i][2].y - pts[nNext][0].y;
csAP << pts[i][0].x + px1 * FX_BEZIER << " "
<< pts[i][0].y + py1 * FX_BEZIER << " "
@@ -102,8 +87,8 @@ CFX_ByteString CPWL_Utils::GetAP_Check(const CFX_FloatRect& crBBox) {
CFX_ByteString CPWL_Utils::GetAP_Circle(const CFX_FloatRect& crBBox) {
CFX_ByteTextBuf csAP;
- FX_FLOAT fWidth = crBBox.right - crBBox.left;
- FX_FLOAT fHeight = crBBox.top - crBBox.bottom;
+ float fWidth = crBBox.right - crBBox.left;
+ float fHeight = crBBox.top - crBBox.bottom;
CFX_PointF pt1(crBBox.left, crBBox.bottom + fHeight / 2);
CFX_PointF pt2(crBBox.left + fWidth / 2, crBBox.top);
@@ -112,8 +97,8 @@ CFX_ByteString CPWL_Utils::GetAP_Circle(const CFX_FloatRect& crBBox) {
csAP << pt1.x << " " << pt1.y << " m\n";
- FX_FLOAT px = pt2.x - pt1.x;
- FX_FLOAT py = pt2.y - pt1.y;
+ float px = pt2.x - pt1.x;
+ float py = pt2.y - pt1.y;
csAP << pt1.x << " " << pt1.y + py * FX_BEZIER << " "
<< pt2.x - px * FX_BEZIER << " " << pt2.y << " " << pt2.x << " " << pt2.y
@@ -155,8 +140,8 @@ CFX_ByteString CPWL_Utils::GetAP_Cross(const CFX_FloatRect& crBBox) {
CFX_ByteString CPWL_Utils::GetAP_Diamond(const CFX_FloatRect& crBBox) {
CFX_ByteTextBuf csAP;
- FX_FLOAT fWidth = crBBox.right - crBBox.left;
- FX_FLOAT fHeight = crBBox.top - crBBox.bottom;
+ float fWidth = crBBox.right - crBBox.left;
+ float fHeight = crBBox.top - crBBox.bottom;
CFX_PointF pt1(crBBox.left, crBBox.bottom + fHeight / 2);
CFX_PointF pt2(crBBox.left + fWidth / 2, crBBox.top);
@@ -187,18 +172,17 @@ CFX_ByteString CPWL_Utils::GetAP_Square(const CFX_FloatRect& crBBox) {
CFX_ByteString CPWL_Utils::GetAP_Star(const CFX_FloatRect& crBBox) {
CFX_ByteTextBuf csAP;
- FX_FLOAT fRadius =
- (crBBox.top - crBBox.bottom) / (1 + (FX_FLOAT)cos(FX_PI / 5.0f));
+ float fRadius = (crBBox.top - crBBox.bottom) / (1 + (float)cos(FX_PI / 5.0f));
CFX_PointF ptCenter = CFX_PointF((crBBox.left + crBBox.right) / 2.0f,
(crBBox.top + crBBox.bottom) / 2.0f);
- FX_FLOAT px[5], py[5];
+ float px[5], py[5];
- FX_FLOAT fAngel = FX_PI / 10.0f;
+ float fAngel = FX_PI / 10.0f;
for (int32_t i = 0; i < 5; i++) {
- px[i] = ptCenter.x + fRadius * (FX_FLOAT)cos(fAngel);
- py[i] = ptCenter.y + fRadius * (FX_FLOAT)sin(fAngel);
+ px[i] = ptCenter.x + fRadius * (float)cos(fAngel);
+ py[i] = ptCenter.y + fRadius * (float)sin(fAngel);
fAngel += FX_PI * 2 / 5.0f;
}
@@ -217,17 +201,17 @@ CFX_ByteString CPWL_Utils::GetAP_Star(const CFX_FloatRect& crBBox) {
}
CFX_ByteString CPWL_Utils::GetAP_HalfCircle(const CFX_FloatRect& crBBox,
- FX_FLOAT fRotate) {
+ float fRotate) {
CFX_ByteTextBuf csAP;
- FX_FLOAT fWidth = crBBox.right - crBBox.left;
- FX_FLOAT fHeight = crBBox.top - crBBox.bottom;
+ float fWidth = crBBox.right - crBBox.left;
+ float fHeight = crBBox.top - crBBox.bottom;
CFX_PointF pt1(-fWidth / 2, 0);
CFX_PointF pt2(0, fHeight / 2);
CFX_PointF pt3(fWidth / 2, 0);
- FX_FLOAT px, py;
+ float px, py;
csAP << cos(fRotate) << " " << sin(fRotate) << " " << -sin(fRotate) << " "
<< cos(fRotate) << " " << crBBox.left + fWidth / 2 << " "
@@ -252,7 +236,7 @@ CFX_ByteString CPWL_Utils::GetAP_HalfCircle(const CFX_FloatRect& crBBox,
}
CFX_FloatRect CPWL_Utils::InflateRect(const CFX_FloatRect& rcRect,
- FX_FLOAT fSize) {
+ float fSize) {
if (rcRect.IsEmpty())
return rcRect;
@@ -263,7 +247,7 @@ CFX_FloatRect CPWL_Utils::InflateRect(const CFX_FloatRect& rcRect,
}
CFX_FloatRect CPWL_Utils::DeflateRect(const CFX_FloatRect& rcRect,
- FX_FLOAT fSize) {
+ float fSize) {
if (rcRect.IsEmpty())
return rcRect;
@@ -273,10 +257,9 @@ CFX_FloatRect CPWL_Utils::DeflateRect(const CFX_FloatRect& rcRect,
return rcNew;
}
-CFX_FloatRect CPWL_Utils::ScaleRect(const CFX_FloatRect& rcRect,
- FX_FLOAT fScale) {
- FX_FLOAT fHalfWidth = (rcRect.right - rcRect.left) / 2.0f;
- FX_FLOAT fHalfHeight = (rcRect.top - rcRect.bottom) / 2.0f;
+CFX_FloatRect CPWL_Utils::ScaleRect(const CFX_FloatRect& rcRect, float fScale) {
+ float fHalfWidth = (rcRect.right - rcRect.left) / 2.0f;
+ float fHalfHeight = (rcRect.top - rcRect.bottom) / 2.0f;
CFX_PointF ptCenter = CFX_PointF((rcRect.left + rcRect.right) / 2,
(rcRect.top + rcRect.bottom) / 2);
@@ -311,13 +294,13 @@ CFX_ByteString CPWL_Utils::GetCircleFillAppStream(const CFX_FloatRect& rect,
}
CFX_FloatRect CPWL_Utils::GetCenterSquare(const CFX_FloatRect& rect) {
- FX_FLOAT fWidth = rect.right - rect.left;
- FX_FLOAT fHeight = rect.top - rect.bottom;
+ float fWidth = rect.right - rect.left;
+ float fHeight = rect.top - rect.bottom;
- FX_FLOAT fCenterX = (rect.left + rect.right) / 2.0f;
- FX_FLOAT fCenterY = (rect.top + rect.bottom) / 2.0f;
+ float fCenterX = (rect.left + rect.right) / 2.0f;
+ float fCenterY = (rect.top + rect.bottom) / 2.0f;
- FX_FLOAT fRadius = (fWidth > fHeight) ? fHeight / 2 : fWidth / 2;
+ float fRadius = (fWidth > fHeight) ? fHeight / 2 : fWidth / 2;
return CFX_FloatRect(fCenterX - fRadius, fCenterY - fRadius,
fCenterX + fRadius, fCenterY + fRadius);
@@ -344,11 +327,11 @@ CFX_ByteString CPWL_Utils::GetPushButtonAppStream(const CFX_FloatRect& rcBBox,
CPDF_IconFit& IconFit,
const CFX_WideString& sLabel,
const CPWL_Color& crText,
- FX_FLOAT fFontSize,
+ float fFontSize,
int32_t nLayOut) {
- const FX_FLOAT fAutoFontScale = 1.0f / 3.0f;
+ const float fAutoFontScale = 1.0f / 3.0f;
- std::unique_ptr<CFX_Edit> pEdit(new CFX_Edit);
+ auto pEdit = pdfium::MakeUnique<CFX_Edit>();
pEdit->SetFontMap(pFontMap);
pEdit->SetAlignmentH(1, true);
pEdit->SetAlignmentV(1, true);
@@ -372,8 +355,8 @@ CFX_ByteString CPWL_Utils::GetPushButtonAppStream(const CFX_FloatRect& rcBBox,
CFX_FloatRect rcLabel = CFX_FloatRect(0, 0, 0, 0);
CFX_FloatRect rcIcon = CFX_FloatRect(0, 0, 0, 0);
- FX_FLOAT fWidth = 0.0f;
- FX_FLOAT fHeight = 0.0f;
+ float fWidth = 0.0f;
+ float fHeight = 0.0f;
switch (nLayOut) {
case PPBL_LABEL:
@@ -585,7 +568,7 @@ CFX_ByteString CPWL_Utils::GetColorAppStream(const CPWL_Color& color,
}
CFX_ByteString CPWL_Utils::GetBorderAppStream(const CFX_FloatRect& rect,
- FX_FLOAT fWidth,
+ float fWidth,
const CPWL_Color& color,
const CPWL_Color& crLeftTop,
const CPWL_Color& crRightBottom,
@@ -594,13 +577,13 @@ CFX_ByteString CPWL_Utils::GetBorderAppStream(const CFX_FloatRect& rect,
CFX_ByteTextBuf sAppStream;
CFX_ByteString sColor;
- FX_FLOAT fLeft = rect.left;
- FX_FLOAT fRight = rect.right;
- FX_FLOAT fTop = rect.top;
- FX_FLOAT fBottom = rect.bottom;
+ float fLeft = rect.left;
+ float fRight = rect.right;
+ float fTop = rect.top;
+ float fBottom = rect.bottom;
if (fWidth > 0.0f) {
- FX_FLOAT fHalfWidth = fWidth / 2.0f;
+ float fHalfWidth = fWidth / 2.0f;
sAppStream << "q\n";
@@ -702,7 +685,7 @@ CFX_ByteString CPWL_Utils::GetBorderAppStream(const CFX_FloatRect& rect,
CFX_ByteString CPWL_Utils::GetCircleBorderAppStream(
const CFX_FloatRect& rect,
- FX_FLOAT fWidth,
+ float fWidth,
const CPWL_Color& color,
const CPWL_Color& crLeftTop,
const CPWL_Color& crRightBottom,
@@ -738,7 +721,7 @@ CFX_ByteString CPWL_Utils::GetCircleBorderAppStream(
}
} break;
case BorderStyle::BEVELED: {
- FX_FLOAT fHalfWidth = fWidth / 2.0f;
+ float fHalfWidth = fWidth / 2.0f;
sColor = CPWL_Utils::GetColorAppStream(color, false);
if (sColor.GetLength() > 0) {
@@ -765,7 +748,7 @@ CFX_ByteString CPWL_Utils::GetCircleBorderAppStream(
}
} break;
case BorderStyle::INSET: {
- FX_FLOAT fHalfWidth = fWidth / 2.0f;
+ float fHalfWidth = fWidth / 2.0f;
sColor = CPWL_Utils::GetColorAppStream(color, false);
if (sColor.GetLength() > 0) {
@@ -961,7 +944,7 @@ void CPWL_Utils::DrawStrokeRect(CFX_RenderDevice* pDevice,
CFX_Matrix* pUser2Device,
const CFX_FloatRect& rect,
const FX_COLORREF& color,
- FX_FLOAT fWidth) {
+ float fWidth) {
CFX_PathData path;
CFX_FloatRect rcTemp(rect);
path.AppendRect(rcTemp.left, rcTemp.bottom, rcTemp.right, rcTemp.top);
@@ -977,7 +960,7 @@ void CPWL_Utils::DrawStrokeLine(CFX_RenderDevice* pDevice,
const CFX_PointF& ptMoveTo,
const CFX_PointF& ptLineTo,
const FX_COLORREF& color,
- FX_FLOAT fWidth) {
+ float fWidth) {
CFX_PathData path;
path.AppendPoint(ptMoveTo, FXPT_TYPE::MoveTo, false);
path.AppendPoint(ptLineTo, FXPT_TYPE::LineTo, false);
@@ -1005,12 +988,12 @@ void CPWL_Utils::DrawShadow(CFX_RenderDevice* pDevice,
int32_t nTransparency,
int32_t nStartGray,
int32_t nEndGray) {
- FX_FLOAT fStepGray = 1.0f;
+ float fStepGray = 1.0f;
if (bVertical) {
fStepGray = (nEndGray - nStartGray) / rect.Height();
- for (FX_FLOAT fy = rect.bottom + 0.5f; fy <= rect.top - 0.5f; fy += 1.0f) {
+ for (float fy = rect.bottom + 0.5f; fy <= rect.top - 0.5f; fy += 1.0f) {
int32_t nGray = nStartGray + (int32_t)(fStepGray * (fy - rect.bottom));
CPWL_Utils::DrawStrokeLine(
pDevice, pUser2Device, CFX_PointF(rect.left, fy),
@@ -1022,7 +1005,7 @@ void CPWL_Utils::DrawShadow(CFX_RenderDevice* pDevice,
if (bHorizontal) {
fStepGray = (nEndGray - nStartGray) / rect.Width();
- for (FX_FLOAT fx = rect.left + 0.5f; fx <= rect.right - 0.5f; fx += 1.0f) {
+ for (float fx = rect.left + 0.5f; fx <= rect.right - 0.5f; fx += 1.0f) {
int32_t nGray = nStartGray + (int32_t)(fStepGray * (fx - rect.left));
CPWL_Utils::DrawStrokeLine(
pDevice, pUser2Device, CFX_PointF(fx, rect.bottom),
@@ -1035,19 +1018,19 @@ void CPWL_Utils::DrawShadow(CFX_RenderDevice* pDevice,
void CPWL_Utils::DrawBorder(CFX_RenderDevice* pDevice,
CFX_Matrix* pUser2Device,
const CFX_FloatRect& rect,
- FX_FLOAT fWidth,
+ float fWidth,
const CPWL_Color& color,
const CPWL_Color& crLeftTop,
const CPWL_Color& crRightBottom,
BorderStyle nStyle,
int32_t nTransparency) {
- FX_FLOAT fLeft = rect.left;
- FX_FLOAT fRight = rect.right;
- FX_FLOAT fTop = rect.top;
- FX_FLOAT fBottom = rect.bottom;
+ float fLeft = rect.left;
+ float fRight = rect.right;
+ float fTop = rect.top;
+ float fBottom = rect.bottom;
if (fWidth > 0.0f) {
- FX_FLOAT fHalfWidth = fWidth / 2.0f;
+ float fHalfWidth = fWidth / 2.0f;
switch (nStyle) {
default:
diff --git a/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_Utils.h b/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_Utils.h
index a4ecc19ee52..29fe2396356 100644
--- a/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_Utils.h
+++ b/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_Utils.h
@@ -35,21 +35,19 @@ struct CPWL_Color;
class CPWL_Utils {
public:
- static CFX_FloatRect InflateRect(const CFX_FloatRect& rcRect, FX_FLOAT fSize);
- static CFX_FloatRect DeflateRect(const CFX_FloatRect& rcRect, FX_FLOAT fSize);
+ static CFX_FloatRect InflateRect(const CFX_FloatRect& rcRect, float fSize);
+ static CFX_FloatRect DeflateRect(const CFX_FloatRect& rcRect, float fSize);
static CPVT_WordRange OverlapWordRange(const CPVT_WordRange& wr1,
const CPVT_WordRange& wr2);
static CFX_FloatRect GetCenterSquare(const CFX_FloatRect& rect);
- static CFX_FloatRect OffsetRect(const CFX_FloatRect& rect,
- FX_FLOAT x,
- FX_FLOAT y);
+ static CFX_FloatRect OffsetRect(const CFX_FloatRect& rect, float x, float y);
static CFX_ByteString GetColorAppStream(const CPWL_Color& color,
const bool& bFillOrStroke = true);
static CFX_ByteString GetBorderAppStream(const CFX_FloatRect& rect,
- FX_FLOAT fWidth,
+ float fWidth,
const CPWL_Color& color,
const CPWL_Color& crLeftTop,
const CPWL_Color& crRightBottom,
@@ -57,7 +55,7 @@ class CPWL_Utils {
const CPWL_Dash& dash);
static CFX_ByteString GetCircleBorderAppStream(
const CFX_FloatRect& rect,
- FX_FLOAT fWidth,
+ float fWidth,
const CPWL_Color& color,
const CPWL_Color& crLeftTop,
const CPWL_Color& crRightBottom,
@@ -73,7 +71,7 @@ class CPWL_Utils {
CPDF_IconFit& IconFit,
const CFX_WideString& sLabel,
const CPWL_Color& crText,
- FX_FLOAT fFontSize,
+ float fFontSize,
int32_t nLayOut);
static CFX_ByteString GetCheckBoxAppStream(const CFX_FloatRect& rcBBox,
int32_t nStyle,
@@ -105,17 +103,17 @@ class CPWL_Utils {
CFX_Matrix* pUser2Device,
const CFX_FloatRect& rect,
const FX_COLORREF& color,
- FX_FLOAT fWidth);
+ float fWidth);
static void DrawStrokeLine(CFX_RenderDevice* pDevice,
CFX_Matrix* pUser2Device,
const CFX_PointF& ptMoveTo,
const CFX_PointF& ptLineTo,
const FX_COLORREF& color,
- FX_FLOAT fWidth);
+ float fWidth);
static void DrawBorder(CFX_RenderDevice* pDevice,
CFX_Matrix* pUser2Device,
const CFX_FloatRect& rect,
- FX_FLOAT fWidth,
+ float fWidth,
const CPWL_Color& color,
const CPWL_Color& crLeftTop,
const CPWL_Color& crRightBottom,
@@ -136,7 +134,7 @@ class CPWL_Utils {
int32_t nEndGray);
private:
- static CFX_FloatRect ScaleRect(const CFX_FloatRect& rcRect, FX_FLOAT fScale);
+ static CFX_FloatRect ScaleRect(const CFX_FloatRect& rcRect, float fScale);
static CFX_ByteString GetAppStream_Check(const CFX_FloatRect& rcBBox,
const CPWL_Color& crText);
@@ -158,7 +156,7 @@ class CPWL_Utils {
static CFX_ByteString GetAP_Square(const CFX_FloatRect& crBBox);
static CFX_ByteString GetAP_Star(const CFX_FloatRect& crBBox);
static CFX_ByteString GetAP_HalfCircle(const CFX_FloatRect& crBBox,
- FX_FLOAT fRotate);
+ float fRotate);
};
#endif // FPDFSDK_PDFWINDOW_PWL_UTILS_H_
diff --git a/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_Wnd.cpp b/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_Wnd.cpp
index 14024dd5d42..075b74651b0 100644
--- a/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_Wnd.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_Wnd.cpp
@@ -15,7 +15,7 @@
static std::map<int32_t, CPWL_Timer*>& GetPWLTimeMap() {
// Leak the object at shutdown.
- static auto timeMap = new std::map<int32_t, CPWL_Timer*>;
+ static auto* timeMap = new std::map<int32_t, CPWL_Timer*>;
return *timeMap;
}
@@ -319,7 +319,7 @@ void CPWL_Wnd::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) {
if (HasFlag(PWS_BORDER)) {
sThis << CPWL_Utils::GetBorderAppStream(
- rectWnd, (FX_FLOAT)GetBorderWidth(), GetBorderColor(),
+ rectWnd, (float)GetBorderWidth(), GetBorderColor(),
GetBorderLeftTopColor(GetBorderStyle()),
GetBorderRightBottomColor(GetBorderStyle()), GetBorderStyle(),
GetBorderDash());
@@ -350,14 +350,14 @@ void CPWL_Wnd::DrawThisAppearance(CFX_RenderDevice* pDevice,
if (!rectWnd.IsEmpty()) {
if (HasFlag(PWS_BACKGROUND)) {
CFX_FloatRect rcClient = CPWL_Utils::DeflateRect(
- rectWnd, (FX_FLOAT)(GetBorderWidth() + GetInnerBorderWidth()));
+ rectWnd, (float)(GetBorderWidth() + GetInnerBorderWidth()));
CPWL_Utils::DrawFillRect(pDevice, pUser2Device, rcClient,
GetBackgroundColor(), GetTransparency());
}
if (HasFlag(PWS_BORDER))
CPWL_Utils::DrawBorder(pDevice, pUser2Device, rectWnd,
- (FX_FLOAT)GetBorderWidth(), GetBorderColor(),
+ (float)GetBorderWidth(), GetBorderColor(),
GetBorderLeftTopColor(GetBorderStyle()),
GetBorderRightBottomColor(GetBorderStyle()),
GetBorderStyle(), GetTransparency());
@@ -412,7 +412,7 @@ void CPWL_Wnd::InvalidateRect(CFX_FloatRect* pRect) {
return false; \
if (!IsWndCaptureKeyboard(this)) \
return false; \
- for (const auto& pChild : m_Children) { \
+ for (auto* pChild : m_Children) { \
if (pChild && IsWndCaptureKeyboard(pChild)) \
return pChild->key_method_name(nChar, nFlag); \
} \
@@ -428,7 +428,7 @@ PWL_IMPLEMENT_KEY_METHOD(OnChar)
if (!IsValid() || !IsVisible() || !IsEnabled()) \
return false; \
if (IsWndCaptureMouse(this)) { \
- for (const auto& pChild : m_Children) { \
+ for (auto* pChild : m_Children) { \
if (pChild && IsWndCaptureMouse(pChild)) { \
return pChild->mouse_method_name(pChild->ParentToChild(point), \
nFlag); \
@@ -437,7 +437,7 @@ PWL_IMPLEMENT_KEY_METHOD(OnChar)
SetCursor(); \
return false; \
} \
- for (const auto& pChild : m_Children) { \
+ for (auto* pChild : m_Children) { \
if (pChild && pChild->WndHitTest(pChild->ParentToChild(point))) { \
return pChild->mouse_method_name(pChild->ParentToChild(point), nFlag); \
} \
@@ -465,7 +465,7 @@ bool CPWL_Wnd::OnMouseWheel(short zDelta,
if (!IsWndCaptureKeyboard(this))
return false;
- for (const auto& pChild : m_Children) {
+ for (auto* pChild : m_Children) {
if (pChild && IsWndCaptureKeyboard(pChild))
return pChild->OnMouseWheel(zDelta, pChild->ParentToChild(point), nFlag);
}
@@ -520,7 +520,7 @@ CFX_FloatRect CPWL_Wnd::GetWindowRect() const {
CFX_FloatRect CPWL_Wnd::GetClientRect() const {
CFX_FloatRect rcWindow = GetWindowRect();
CFX_FloatRect rcClient = CPWL_Utils::DeflateRect(
- rcWindow, (FX_FLOAT)(GetBorderWidth() + GetInnerBorderWidth()));
+ rcWindow, (float)(GetBorderWidth() + GetInnerBorderWidth()));
if (CPWL_ScrollBar* pVSB = GetVScrollBar())
rcClient.right -= pVSB->GetScrollBarWidth();
@@ -628,7 +628,7 @@ void CPWL_Wnd::SetCapture() {
}
void CPWL_Wnd::ReleaseCapture() {
- for (const auto& pChild : m_Children) {
+ for (auto* pChild : m_Children) {
if (pChild)
pChild->ReleaseCapture();
}
@@ -674,7 +674,7 @@ void CPWL_Wnd::SetVisible(bool bVisible) {
if (!IsValid())
return;
- for (const auto& pChild : m_Children) {
+ for (auto* pChild : m_Children) {
if (pChild)
pChild->SetVisible(bVisible);
}
@@ -700,7 +700,7 @@ bool CPWL_Wnd::IsReadOnly() const {
void CPWL_Wnd::RePosChildWnd() {
CFX_FloatRect rcContent = CPWL_Utils::DeflateRect(
- GetWindowRect(), (FX_FLOAT)(GetBorderWidth() + GetInnerBorderWidth()));
+ GetWindowRect(), (float)(GetBorderWidth() + GetInnerBorderWidth()));
CPWL_ScrollBar* pVSB = GetVScrollBar();
@@ -767,11 +767,11 @@ CFX_FloatRect CPWL_Wnd::GetFocusRect() const {
return CPWL_Utils::InflateRect(GetWindowRect(), 1);
}
-FX_FLOAT CPWL_Wnd::GetFontSize() const {
+float CPWL_Wnd::GetFontSize() const {
return m_sPrivateParam.fFontSize;
}
-void CPWL_Wnd::SetFontSize(FX_FLOAT fFontSize) {
+void CPWL_Wnd::SetFontSize(float fFontSize) {
m_sPrivateParam.fFontSize = fFontSize;
}
@@ -818,7 +818,7 @@ int32_t CPWL_Wnd::GetTransparency() {
}
void CPWL_Wnd::SetTransparency(int32_t nTransparency) {
- for (const auto& pChild : m_Children) {
+ for (auto* pChild : m_Children) {
if (pChild)
pChild->SetTransparency(nTransparency);
}
@@ -892,7 +892,7 @@ void CPWL_Wnd::EnableWindow(bool bEnable) {
if (m_bEnabled == bEnable)
return;
- for (const auto& pChild : m_Children) {
+ for (auto* pChild : m_Children) {
if (pChild)
pChild->EnableWindow(bEnable);
}
diff --git a/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_Wnd.h b/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_Wnd.h
index 55836d43a2e..ded003c31b0 100644
--- a/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_Wnd.h
+++ b/chromium/third_party/pdfium/fpdfsdk/pdfwindow/PWL_Wnd.h
@@ -204,7 +204,7 @@ struct PWL_CREATEPARAM {
CPWL_Color sBorderColor; // optional
CPWL_Color sTextColor; // optional
int32_t nTransparency; // optional
- FX_FLOAT fFontSize; // optional
+ float fFontSize; // optional
CPWL_Dash sDash; // optional
void* pAttachedData; // optional
CPWL_Wnd* pParentWnd; // ignore
@@ -269,8 +269,8 @@ class CPWL_Wnd : public CPWL_TimerHandler {
virtual void KillFocus();
virtual void SetCursor();
virtual void SetVisible(bool bVisible);
- virtual void SetFontSize(FX_FLOAT fFontSize);
- virtual FX_FLOAT GetFontSize() const;
+ virtual void SetFontSize(float fFontSize);
+ virtual float GetFontSize() const;
virtual CFX_FloatRect GetFocusRect() const;
virtual CFX_FloatRect GetClientRect() const;
diff --git a/chromium/third_party/pdfium/fpdfsdk/pdfwindow/cpwl_color.cpp b/chromium/third_party/pdfium/fpdfsdk/pdfwindow/cpwl_color.cpp
index 9c9ca3eff02..689c3dec452 100644
--- a/chromium/third_party/pdfium/fpdfsdk/pdfwindow/cpwl_color.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/pdfwindow/cpwl_color.cpp
@@ -10,14 +10,11 @@
namespace {
-bool InRange(FX_FLOAT comp) {
+bool InRange(float comp) {
return comp >= 0.0f && comp <= 1.0f;
}
-CPWL_Color ConvertCMYK2GRAY(FX_FLOAT dC,
- FX_FLOAT dM,
- FX_FLOAT dY,
- FX_FLOAT dK) {
+CPWL_Color ConvertCMYK2GRAY(float dC, float dM, float dY, float dK) {
if (!InRange(dC) || !InRange(dM) || !InRange(dY) || !InRange(dK))
return CPWL_Color(COLORTYPE_GRAY);
return CPWL_Color(
@@ -25,25 +22,25 @@ CPWL_Color ConvertCMYK2GRAY(FX_FLOAT dC,
1.0f - std::min(1.0f, 0.3f * dC + 0.59f * dM + 0.11f * dY + dK));
}
-CPWL_Color ConvertGRAY2CMYK(FX_FLOAT dGray) {
+CPWL_Color ConvertGRAY2CMYK(float dGray) {
if (!InRange(dGray))
return CPWL_Color(COLORTYPE_CMYK);
return CPWL_Color(COLORTYPE_CMYK, 0.0f, 0.0f, 0.0f, 1.0f - dGray);
}
-CPWL_Color ConvertGRAY2RGB(FX_FLOAT dGray) {
+CPWL_Color ConvertGRAY2RGB(float dGray) {
if (!InRange(dGray))
return CPWL_Color(COLORTYPE_RGB);
return CPWL_Color(COLORTYPE_RGB, dGray, dGray, dGray);
}
-CPWL_Color ConvertRGB2GRAY(FX_FLOAT dR, FX_FLOAT dG, FX_FLOAT dB) {
+CPWL_Color ConvertRGB2GRAY(float dR, float dG, float dB) {
if (!InRange(dR) || !InRange(dG) || !InRange(dB))
return CPWL_Color(COLORTYPE_GRAY);
return CPWL_Color(COLORTYPE_GRAY, 0.3f * dR + 0.59f * dG + 0.11f * dB);
}
-CPWL_Color ConvertCMYK2RGB(FX_FLOAT dC, FX_FLOAT dM, FX_FLOAT dY, FX_FLOAT dK) {
+CPWL_Color ConvertCMYK2RGB(float dC, float dM, float dY, float dK) {
if (!InRange(dC) || !InRange(dM) || !InRange(dY) || !InRange(dK))
return CPWL_Color(COLORTYPE_RGB);
return CPWL_Color(COLORTYPE_RGB, 1.0f - std::min(1.0f, dC + dK),
@@ -51,13 +48,13 @@ CPWL_Color ConvertCMYK2RGB(FX_FLOAT dC, FX_FLOAT dM, FX_FLOAT dY, FX_FLOAT dK) {
1.0f - std::min(1.0f, dY + dK));
}
-CPWL_Color ConvertRGB2CMYK(FX_FLOAT dR, FX_FLOAT dG, FX_FLOAT dB) {
+CPWL_Color ConvertRGB2CMYK(float dR, float dG, float dB) {
if (!InRange(dR) || !InRange(dG) || !InRange(dB))
return CPWL_Color(COLORTYPE_CMYK);
- FX_FLOAT c = 1.0f - dR;
- FX_FLOAT m = 1.0f - dG;
- FX_FLOAT y = 1.0f - dB;
+ float c = 1.0f - dR;
+ float m = 1.0f - dG;
+ float y = 1.0f - dB;
return CPWL_Color(COLORTYPE_CMYK, c, m, y, std::min(c, std::min(m, y)));
}
@@ -135,7 +132,7 @@ FX_COLORREF CPWL_Color::ToFXColor(int32_t nTransparency) const {
static_cast<int32_t>(ret.fColor3 * 255));
}
-CPWL_Color CPWL_Color::operator-(FX_FLOAT fColorSub) const {
+CPWL_Color CPWL_Color::operator-(float fColorSub) const {
CPWL_Color sRet(nColorType);
switch (nColorType) {
case COLORTYPE_TRANSPARENT:
@@ -156,7 +153,7 @@ CPWL_Color CPWL_Color::operator-(FX_FLOAT fColorSub) const {
return sRet;
}
-CPWL_Color CPWL_Color::operator/(FX_FLOAT fColorDivide) const {
+CPWL_Color CPWL_Color::operator/(float fColorDivide) const {
CPWL_Color sRet(nColorType);
switch (nColorType) {
case COLORTYPE_TRANSPARENT:
diff --git a/chromium/third_party/pdfium/fpdfsdk/pdfwindow/cpwl_color.h b/chromium/third_party/pdfium/fpdfsdk/pdfwindow/cpwl_color.h
index f1b34c7eb83..6eae48738fc 100644
--- a/chromium/third_party/pdfium/fpdfsdk/pdfwindow/cpwl_color.h
+++ b/chromium/third_party/pdfium/fpdfsdk/pdfwindow/cpwl_color.h
@@ -11,10 +11,10 @@
struct CPWL_Color {
CPWL_Color(int32_t type = COLORTYPE_TRANSPARENT,
- FX_FLOAT color1 = 0.0f,
- FX_FLOAT color2 = 0.0f,
- FX_FLOAT color3 = 0.0f,
- FX_FLOAT color4 = 0.0f)
+ float color1 = 0.0f,
+ float color2 = 0.0f,
+ float color3 = 0.0f,
+ float color4 = 0.0f)
: nColorType(type),
fColor1(color1),
fColor2(color2),
@@ -28,8 +28,8 @@ struct CPWL_Color {
fColor3(b / 255.0f),
fColor4(0) {}
- CPWL_Color operator/(FX_FLOAT fColorDivide) const;
- CPWL_Color operator-(FX_FLOAT fColorSub) const;
+ CPWL_Color operator/(float fColorDivide) const;
+ CPWL_Color operator-(float fColorSub) const;
CPWL_Color ConvertColorType(int32_t other_nColorType) const;
@@ -44,10 +44,10 @@ struct CPWL_Color {
}
int32_t nColorType;
- FX_FLOAT fColor1;
- FX_FLOAT fColor2;
- FX_FLOAT fColor3;
- FX_FLOAT fColor4;
+ float fColor1;
+ float fColor2;
+ float fColor3;
+ float fColor4;
};
#endif // FPDFSDK_PDFWINDOW_CPWL_COLOR_H_
diff --git a/chromium/third_party/pdfium/fxbarcode/BC_Dimension.cpp b/chromium/third_party/pdfium/fxbarcode/BC_Dimension.cpp
new file mode 100644
index 00000000000..03cfa7eced5
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/BC_Dimension.cpp
@@ -0,0 +1,46 @@
+// 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
+// Original code is licensed as follows:
+/*
+ * Copyright 2012 ZXing authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "fxbarcode/BC_Dimension.h"
+#include "fxbarcode/datamatrix/BC_Encoder.h"
+
+CBC_Dimension::CBC_Dimension() {}
+CBC_Dimension::CBC_Dimension(int32_t width, int32_t height, int32_t& e) {
+ if (width < 0 || height < 0) {
+ e = BCExceptionHeightAndWidthMustBeAtLeast1;
+ }
+ m_width = width;
+ m_height = height;
+}
+CBC_Dimension::~CBC_Dimension() {}
+int32_t CBC_Dimension::getWidth() {
+ return m_width;
+}
+int32_t CBC_Dimension::getHeight() {
+ return m_height;
+}
+int32_t CBC_Dimension::hashCode() {
+ return m_width * 32713 + m_height;
+}
+CFX_WideString CBC_Dimension::toString() {
+ return (wchar_t)(m_width + (wchar_t)'x' + m_height);
+}
diff --git a/chromium/third_party/pdfium/fxbarcode/BC_Dimension.h b/chromium/third_party/pdfium/fxbarcode/BC_Dimension.h
new file mode 100644
index 00000000000..fc24bf9e6ab
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/BC_Dimension.h
@@ -0,0 +1,29 @@
+// 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 FXBARCODE_BC_DIMENSION_H_
+#define FXBARCODE_BC_DIMENSION_H_
+
+#include <cstdint>
+
+#include "core/fxcrt/fx_string.h"
+
+class CBC_Dimension {
+ public:
+ CBC_Dimension();
+ CBC_Dimension(int32_t width, int32_t height, int32_t& e);
+ virtual ~CBC_Dimension();
+ int32_t getWidth();
+ int32_t getHeight();
+ int32_t hashCode();
+ CFX_WideString toString();
+
+ private:
+ int32_t m_width;
+ int32_t m_height;
+};
+
+#endif // FXBARCODE_BC_DIMENSION_H_
diff --git a/chromium/third_party/pdfium/fxbarcode/BC_Library.cpp b/chromium/third_party/pdfium/fxbarcode/BC_Library.cpp
new file mode 100644
index 00000000000..c52e92a1913
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/BC_Library.cpp
@@ -0,0 +1,36 @@
+// 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
+
+#include "fxbarcode/BC_Library.h"
+
+#include <stdint.h>
+
+#include "fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.h"
+#include "fxbarcode/datamatrix/BC_ErrorCorrection.h"
+#include "fxbarcode/datamatrix/BC_SymbolInfo.h"
+#include "fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h"
+#include "fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.h"
+#include "fxbarcode/qrcode/BC_QRCoderMode.h"
+#include "fxbarcode/qrcode/BC_QRCoderVersion.h"
+
+void BC_Library_Init() {
+ CBC_QRCoderErrorCorrectionLevel::Initialize();
+ CBC_QRCoderMode::Initialize();
+ CBC_QRCoderVersion::Initialize();
+ CBC_ReedSolomonGF256::Initialize();
+ CBC_SymbolInfo::Initialize();
+ CBC_ErrorCorrection::Initialize();
+ CBC_PDF417HighLevelEncoder::Initialize();
+}
+void BC_Library_Destory() {
+ CBC_QRCoderErrorCorrectionLevel::Finalize();
+ CBC_QRCoderMode::Finalize();
+ CBC_QRCoderVersion::Finalize();
+ CBC_ReedSolomonGF256::Finalize();
+ CBC_SymbolInfo::Finalize();
+ CBC_ErrorCorrection::Finalize();
+ CBC_PDF417HighLevelEncoder::Finalize();
+}
diff --git a/chromium/third_party/pdfium/fxbarcode/BC_Library.h b/chromium/third_party/pdfium/fxbarcode/BC_Library.h
new file mode 100644
index 00000000000..7be4646c68b
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/BC_Library.h
@@ -0,0 +1,38 @@
+// Copyright 2016 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef FXBARCODE_BC_LIBRARY_H_
+#define FXBARCODE_BC_LIBRARY_H_
+
+enum BC_TEXT_LOC {
+ BC_TEXT_LOC_NONE = 0,
+ BC_TEXT_LOC_ABOVE,
+ BC_TEXT_LOC_BELOW,
+ BC_TEXT_LOC_ABOVEEMBED,
+ BC_TEXT_LOC_BELOWEMBED
+};
+
+enum BC_CHAR_ENCODING { CHAR_ENCODING_UTF8 = 0, CHAR_ENCODING_UNICODE };
+
+enum BC_TYPE {
+ BC_UNKNOWN = -1,
+ BC_CODE39 = 0,
+ BC_CODABAR,
+ BC_CODE128,
+ BC_CODE128_B,
+ BC_CODE128_C,
+ BC_EAN8,
+ BC_UPCA,
+ BC_EAN13,
+ BC_QR_CODE,
+ BC_PDF417,
+ BC_DATAMATRIX
+};
+
+void BC_Library_Init();
+void BC_Library_Destory();
+
+#endif // FXBARCODE_BC_LIBRARY_H_
diff --git a/chromium/third_party/pdfium/fxbarcode/BC_TwoDimWriter.cpp b/chromium/third_party/pdfium/fxbarcode/BC_TwoDimWriter.cpp
new file mode 100644
index 00000000000..8043244b2b2
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/BC_TwoDimWriter.cpp
@@ -0,0 +1,145 @@
+// 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
+
+#include <algorithm>
+
+#include "core/fxge/cfx_graphstatedata.h"
+#include "core/fxge/cfx_pathdata.h"
+#include "core/fxge/cfx_renderdevice.h"
+#include "fxbarcode/BC_TwoDimWriter.h"
+#include "fxbarcode/BC_Writer.h"
+#include "fxbarcode/common/BC_CommonBitMatrix.h"
+#include "third_party/base/numerics/safe_math.h"
+#include "third_party/base/ptr_util.h"
+
+CBC_TwoDimWriter::CBC_TwoDimWriter() : m_iCorrectLevel(1), m_bFixedSize(true) {}
+
+CBC_TwoDimWriter::~CBC_TwoDimWriter() {}
+
+void CBC_TwoDimWriter::RenderDeviceResult(CFX_RenderDevice* device,
+ const CFX_Matrix* matrix) {
+ CFX_GraphStateData stateData;
+ CFX_PathData path;
+ path.AppendRect(0, 0, (float)m_Width, (float)m_Height);
+ device->DrawPath(&path, matrix, &stateData, m_backgroundColor,
+ m_backgroundColor, FXFILL_ALTERNATE);
+ int32_t leftPos = 0;
+ int32_t topPos = 0;
+ if (m_bFixedSize) {
+ leftPos = (m_Width - m_output->GetWidth()) / 2;
+ topPos = (m_Height - m_output->GetHeight()) / 2;
+ }
+ CFX_Matrix matri = *matrix;
+ if (m_Width < m_output->GetWidth() && m_Height < m_output->GetHeight()) {
+ CFX_Matrix matriScale((float)m_Width / (float)m_output->GetWidth(), 0.0,
+ 0.0, (float)m_Height / (float)m_output->GetHeight(),
+ 0.0, 0.0);
+ matriScale.Concat(*matrix);
+ matri = matriScale;
+ }
+ for (int32_t x = 0; x < m_output->GetWidth(); x++) {
+ for (int32_t y = 0; y < m_output->GetHeight(); y++) {
+ CFX_PathData rect;
+ rect.AppendRect((float)leftPos + x, (float)topPos + y,
+ (float)(leftPos + x + 1), (float)(topPos + y + 1));
+ if (m_output->Get(x, y)) {
+ CFX_GraphStateData data;
+ device->DrawPath(&rect, &matri, &data, m_barColor, 0, FXFILL_WINDING);
+ }
+ }
+ }
+}
+
+int32_t CBC_TwoDimWriter::GetErrorCorrectionLevel() const {
+ return m_iCorrectLevel;
+}
+
+void CBC_TwoDimWriter::RenderBitmapResult(
+ CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
+ int32_t& e) {
+ if (m_bFixedSize) {
+ pOutBitmap = CreateDIBitmap(m_Width, m_Height);
+ } else {
+ pOutBitmap = CreateDIBitmap(m_output->GetWidth(), m_output->GetHeight());
+ }
+ if (!pOutBitmap) {
+ e = BCExceptionFailToCreateBitmap;
+ return;
+ }
+ pOutBitmap->Clear(m_backgroundColor);
+ int32_t leftPos = 0;
+ int32_t topPos = 0;
+ if (m_bFixedSize) {
+ leftPos = (m_Width - m_output->GetWidth()) / 2;
+ topPos = (m_Height - m_output->GetHeight()) / 2;
+ }
+ for (int32_t x = 0; x < m_output->GetWidth(); x++) {
+ for (int32_t y = 0; y < m_output->GetHeight(); y++) {
+ if (m_output->Get(x, y)) {
+ pOutBitmap->SetPixel(leftPos + x, topPos + y, m_barColor);
+ }
+ }
+ }
+ if (!m_bFixedSize)
+ pOutBitmap = pOutBitmap->StretchTo(m_Width, m_Height);
+}
+
+void CBC_TwoDimWriter::RenderResult(uint8_t* code,
+ int32_t codeWidth,
+ int32_t codeHeight,
+ int32_t& e) {
+ int32_t inputWidth = codeWidth;
+ int32_t inputHeight = codeHeight;
+ int32_t tempWidth = inputWidth + 2;
+ int32_t tempHeight = inputHeight + 2;
+ float moduleHSize = std::min(m_ModuleWidth, m_ModuleHeight);
+ moduleHSize = std::min(moduleHSize, 8.0f);
+ moduleHSize = std::max(moduleHSize, 1.0f);
+ pdfium::base::CheckedNumeric<int32_t> scaledWidth = tempWidth;
+ pdfium::base::CheckedNumeric<int32_t> scaledHeight = tempHeight;
+ scaledWidth *= moduleHSize;
+ scaledHeight *= moduleHSize;
+
+ int32_t outputWidth = scaledWidth.ValueOrDie();
+ int32_t outputHeight = scaledHeight.ValueOrDie();
+ if (m_bFixedSize) {
+ if (m_Width < outputWidth || m_Height < outputHeight) {
+ e = BCExceptionBitmapSizeError;
+ return;
+ }
+ } else {
+ if (m_Width > outputWidth || m_Height > outputHeight) {
+ outputWidth =
+ (int32_t)(outputWidth * ceil((float)m_Width / (float)outputWidth));
+ outputHeight =
+ (int32_t)(outputHeight * ceil((float)m_Height / (float)outputHeight));
+ }
+ }
+ int32_t multiX = (int32_t)ceil((float)outputWidth / (float)tempWidth);
+ int32_t multiY = (int32_t)ceil((float)outputHeight / (float)tempHeight);
+ if (m_bFixedSize) {
+ multiX = std::min(multiX, multiY);
+ multiY = multiX;
+ }
+ int32_t leftPadding = std::max((outputWidth - (inputWidth * multiX)) / 2, 0);
+ int32_t topPadding = std::max((outputHeight - (inputHeight * multiY)) / 2, 0);
+ m_output = pdfium::MakeUnique<CBC_CommonBitMatrix>();
+ m_output->Init(outputWidth, outputHeight);
+ for (int32_t inputY = 0, outputY = topPadding;
+ (inputY < inputHeight) && (outputY < outputHeight - multiY);
+ inputY++, outputY += multiY) {
+ for (int32_t inputX = 0, outputX = leftPadding;
+ (inputX < inputWidth) && (outputX < outputWidth - multiX);
+ inputX++, outputX += multiX) {
+ if (code[inputX + inputY * inputWidth] == 1) {
+ if (!m_output->SetRegion(outputX, outputY, multiX, multiY)) {
+ e = BCExceptionGeneric;
+ return;
+ }
+ }
+ }
+ }
+}
diff --git a/chromium/third_party/pdfium/fxbarcode/BC_TwoDimWriter.h b/chromium/third_party/pdfium/fxbarcode/BC_TwoDimWriter.h
new file mode 100644
index 00000000000..f77546ee079
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/BC_TwoDimWriter.h
@@ -0,0 +1,40 @@
+// 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 FXBARCODE_BC_TWODIMWRITER_H_
+#define FXBARCODE_BC_TWODIMWRITER_H_
+
+#include <memory>
+
+#include "core/fxcrt/fx_coordinates.h"
+#include "fxbarcode/BC_Writer.h"
+
+class CBC_CommonBitMatrix;
+class CFX_RenderDevice;
+
+class CBC_TwoDimWriter : public CBC_Writer {
+ public:
+ CBC_TwoDimWriter();
+ ~CBC_TwoDimWriter() override;
+
+ virtual void RenderResult(uint8_t* code,
+ int32_t codeWidth,
+ int32_t codeHeight,
+ int32_t& e);
+ virtual void RenderBitmapResult(CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
+ int32_t& e);
+ virtual void RenderDeviceResult(CFX_RenderDevice* device,
+ const CFX_Matrix* matrix);
+ virtual bool SetErrorCorrectionLevel(int32_t level) = 0;
+ int32_t GetErrorCorrectionLevel() const;
+
+ protected:
+ int32_t m_iCorrectLevel;
+ bool m_bFixedSize;
+ std::unique_ptr<CBC_CommonBitMatrix> m_output;
+};
+
+#endif // FXBARCODE_BC_TWODIMWRITER_H_
diff --git a/chromium/third_party/pdfium/fxbarcode/BC_UtilCodingConvert.cpp b/chromium/third_party/pdfium/fxbarcode/BC_UtilCodingConvert.cpp
new file mode 100644
index 00000000000..f1dea885c3d
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/BC_UtilCodingConvert.cpp
@@ -0,0 +1,54 @@
+// 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
+
+#include "fxbarcode/BC_UtilCodingConvert.h"
+
+CBC_UtilCodingConvert::CBC_UtilCodingConvert() {}
+
+CBC_UtilCodingConvert::~CBC_UtilCodingConvert() {}
+
+void CBC_UtilCodingConvert::UnicodeToLocale(const CFX_WideString& src,
+ CFX_ByteString& dst) {
+ dst = CFX_ByteString::FromUnicode(src);
+}
+
+void CBC_UtilCodingConvert::LocaleToUtf8(const CFX_ByteString& src,
+ CFX_ByteString& dst) {
+ CFX_WideString unicode = CFX_WideString::FromLocal(src.AsStringC());
+ dst = unicode.UTF8Encode();
+}
+
+void CBC_UtilCodingConvert::LocaleToUtf8(const CFX_ByteString& src,
+ std::vector<uint8_t>& dst) {
+ CFX_WideString unicode = CFX_WideString::FromLocal(src.AsStringC());
+ CFX_ByteString utf8 = unicode.UTF8Encode();
+ for (int32_t i = 0; i < utf8.GetLength(); i++) {
+ dst.push_back(utf8[i]);
+ }
+}
+
+void CBC_UtilCodingConvert::Utf8ToLocale(const std::vector<uint8_t>& src,
+ CFX_ByteString& dst) {
+ CFX_ByteString utf8;
+ for (uint8_t value : src)
+ utf8 += value;
+
+ CFX_WideString unicode = CFX_WideString::FromUTF8(utf8.AsStringC());
+ dst = CFX_ByteString::FromUnicode(unicode);
+}
+
+void CBC_UtilCodingConvert::Utf8ToLocale(const uint8_t* src,
+ int32_t count,
+ CFX_ByteString& dst) {
+ CFX_WideString unicode =
+ CFX_WideString::FromUTF8(CFX_ByteStringC(src, count));
+ dst = CFX_ByteString::FromUnicode(unicode);
+}
+
+void CBC_UtilCodingConvert::UnicodeToUTF8(const CFX_WideString& src,
+ CFX_ByteString& dst) {
+ dst = src.UTF8Encode();
+}
diff --git a/chromium/third_party/pdfium/fxbarcode/BC_UtilCodingConvert.h b/chromium/third_party/pdfium/fxbarcode/BC_UtilCodingConvert.h
new file mode 100644
index 00000000000..5aaa53c726a
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/BC_UtilCodingConvert.h
@@ -0,0 +1,33 @@
+// 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 FXBARCODE_BC_UTILCODINGCONVERT_H_
+#define FXBARCODE_BC_UTILCODINGCONVERT_H_
+
+#include <vector>
+
+#include "core/fxcrt/fx_basic.h"
+
+class CBC_UtilCodingConvert {
+ public:
+ CBC_UtilCodingConvert();
+ virtual ~CBC_UtilCodingConvert();
+ static void UnicodeToLocale(const CFX_WideString& source,
+ CFX_ByteString& result);
+ static void LocaleToUtf8(const CFX_ByteString& source,
+ CFX_ByteString& result);
+ static void LocaleToUtf8(const CFX_ByteString& source,
+ std::vector<uint8_t>& result);
+ static void Utf8ToLocale(const std::vector<uint8_t>& source,
+ CFX_ByteString& result);
+ static void Utf8ToLocale(const uint8_t* source,
+ int32_t count,
+ CFX_ByteString& result);
+ static void UnicodeToUTF8(const CFX_WideString& source,
+ CFX_ByteString& result);
+};
+
+#endif // FXBARCODE_BC_UTILCODINGCONVERT_H_
diff --git a/chromium/third_party/pdfium/fxbarcode/BC_Utils.cpp b/chromium/third_party/pdfium/fxbarcode/BC_Utils.cpp
new file mode 100644
index 00000000000..3c754064250
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/BC_Utils.cpp
@@ -0,0 +1,35 @@
+// 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
+
+#include <vector>
+
+#include "core/fxcrt/fx_basic.h"
+#include "fxbarcode/utils.h"
+
+bool BC_FX_ByteString_Replace(CFX_ByteString& dst,
+ uint32_t first,
+ uint32_t last,
+ int32_t count,
+ char c) {
+ if (first > last || count <= 0) {
+ return false;
+ }
+ dst.Delete(first, last - first);
+ for (int32_t i = 0; i < count; i++) {
+ dst.Insert(0, c);
+ }
+ return true;
+}
+
+void BC_FX_ByteString_Append(CFX_ByteString& dst, int32_t count, char c) {
+ for (int32_t i = 0; i < count; i++)
+ dst += c;
+}
+void BC_FX_ByteString_Append(CFX_ByteString& dst,
+ const std::vector<uint8_t>& ba) {
+ for (uint8_t value : ba)
+ dst += value;
+}
diff --git a/chromium/third_party/pdfium/fxbarcode/BC_Writer.cpp b/chromium/third_party/pdfium/fxbarcode/BC_Writer.cpp
new file mode 100644
index 00000000000..9a109bfbdd7
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/BC_Writer.cpp
@@ -0,0 +1,58 @@
+// 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
+
+#include "fxbarcode/BC_Writer.h"
+
+CBC_Writer::CBC_Writer() {
+ m_CharEncoding = 0;
+ m_ModuleHeight = 1;
+ m_ModuleWidth = 1;
+ m_Height = 320;
+ m_Width = 640;
+ m_colorSpace = FXDIB_Argb;
+ m_barColor = 0xff000000;
+ m_backgroundColor = 0xffffffff;
+}
+CBC_Writer::~CBC_Writer() {}
+bool CBC_Writer::SetCharEncoding(int32_t encoding) {
+ m_CharEncoding = encoding;
+ return true;
+}
+bool CBC_Writer::SetModuleHeight(int32_t moduleHeight) {
+ if (moduleHeight > 10 || moduleHeight < 1) {
+ return false;
+ }
+ m_ModuleHeight = moduleHeight;
+ return true;
+}
+bool CBC_Writer::SetModuleWidth(int32_t moduleWidth) {
+ if (moduleWidth > 10 || moduleWidth < 1) {
+ return false;
+ }
+ m_ModuleWidth = moduleWidth;
+ return true;
+}
+bool CBC_Writer::SetHeight(int32_t height) {
+ m_Height = height;
+ return true;
+}
+bool CBC_Writer::SetWidth(int32_t width) {
+ m_Width = width;
+ return true;
+}
+void CBC_Writer::SetBackgroundColor(FX_ARGB backgroundColor) {
+ m_backgroundColor = backgroundColor;
+}
+void CBC_Writer::SetBarcodeColor(FX_ARGB foregroundColor) {
+ m_barColor = foregroundColor;
+}
+
+CFX_RetainPtr<CFX_DIBitmap> CBC_Writer::CreateDIBitmap(int32_t width,
+ int32_t height) {
+ auto pDIBitmap = pdfium::MakeRetain<CFX_DIBitmap>();
+ pDIBitmap->Create(width, height, m_colorSpace);
+ return pDIBitmap;
+}
diff --git a/chromium/third_party/pdfium/fxbarcode/BC_Writer.h b/chromium/third_party/pdfium/fxbarcode/BC_Writer.h
new file mode 100644
index 00000000000..fc98a4cfd41
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/BC_Writer.h
@@ -0,0 +1,39 @@
+// 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 FXBARCODE_BC_WRITER_H_
+#define FXBARCODE_BC_WRITER_H_
+
+#include "core/fxcrt/fx_string.h"
+#include "core/fxge/dib/cfx_dibitmap.h"
+#include "core/fxge/fx_dib.h"
+#include "fxbarcode/utils.h"
+
+class CBC_Writer {
+ public:
+ CBC_Writer();
+ virtual ~CBC_Writer();
+ virtual bool SetCharEncoding(int32_t encoding);
+ virtual bool SetModuleHeight(int32_t moduleHeight);
+ virtual bool SetModuleWidth(int32_t moduleWidth);
+ virtual bool SetHeight(int32_t height);
+ virtual bool SetWidth(int32_t width);
+ virtual void SetBackgroundColor(FX_ARGB backgroundColor);
+ virtual void SetBarcodeColor(FX_ARGB foregroundColor);
+
+ protected:
+ CFX_RetainPtr<CFX_DIBitmap> CreateDIBitmap(int32_t width, int32_t height);
+ int32_t m_CharEncoding;
+ int32_t m_ModuleHeight;
+ int32_t m_ModuleWidth;
+ int32_t m_Height;
+ int32_t m_Width;
+ FXDIB_Format m_colorSpace;
+ FX_ARGB m_barColor;
+ FX_ARGB m_backgroundColor;
+};
+
+#endif // FXBARCODE_BC_WRITER_H_
diff --git a/chromium/third_party/pdfium/fxbarcode/DEPS b/chromium/third_party/pdfium/fxbarcode/DEPS
new file mode 100644
index 00000000000..35a265a6c35
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/DEPS
@@ -0,0 +1,6 @@
+include_rules = [
+ '+core/fxcodec',
+ '+core/fxcrt',
+ '+core/fxge',
+ '+third_party/bigint',
+]
diff --git a/chromium/third_party/pdfium/fxbarcode/cbc_codabar.cpp b/chromium/third_party/pdfium/fxbarcode/cbc_codabar.cpp
new file mode 100644
index 00000000000..4072f32712b
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/cbc_codabar.cpp
@@ -0,0 +1,110 @@
+// Copyright 2016 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+/*
+ * Copyright 2011 ZXing authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "fxbarcode/cbc_codabar.h"
+
+#include "fxbarcode/oned/BC_OnedCodaBarWriter.h"
+
+CBC_Codabar::CBC_Codabar() : CBC_OneCode(new CBC_OnedCodaBarWriter) {}
+
+CBC_Codabar::~CBC_Codabar() {}
+
+bool CBC_Codabar::SetStartChar(char start) {
+ if (!m_pBCWriter)
+ return false;
+ return static_cast<CBC_OnedCodaBarWriter*>(m_pBCWriter.get())
+ ->SetStartChar(start);
+}
+
+bool CBC_Codabar::SetEndChar(char end) {
+ if (m_pBCWriter)
+ return static_cast<CBC_OnedCodaBarWriter*>(m_pBCWriter.get())
+ ->SetEndChar(end);
+ return false;
+}
+
+bool CBC_Codabar::SetTextLocation(BC_TEXT_LOC location) {
+ return static_cast<CBC_OnedCodaBarWriter*>(m_pBCWriter.get())
+ ->SetTextLocation(location);
+}
+
+bool CBC_Codabar::SetWideNarrowRatio(int32_t ratio) {
+ if (m_pBCWriter)
+ return static_cast<CBC_OnedCodaBarWriter*>(m_pBCWriter.get())
+ ->SetWideNarrowRatio(ratio);
+ return false;
+}
+
+bool CBC_Codabar::Encode(const CFX_WideStringC& contents,
+ bool isDevice,
+ int32_t& e) {
+ if (contents.IsEmpty()) {
+ e = BCExceptionNoContents;
+ return false;
+ }
+ BCFORMAT format = BCFORMAT_CODABAR;
+ int32_t outWidth = 0;
+ int32_t outHeight = 0;
+ CFX_WideString filtercontents =
+ static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())
+ ->FilterContents(contents);
+ CFX_ByteString byteString = filtercontents.UTF8Encode();
+ m_renderContents = filtercontents;
+ uint8_t* data = static_cast<CBC_OnedCodaBarWriter*>(m_pBCWriter.get())
+ ->Encode(byteString, format, outWidth, outHeight, e);
+ if (e != BCExceptionNO)
+ return false;
+ static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())
+ ->RenderResult(filtercontents.AsStringC(), data, outWidth, isDevice, e);
+ FX_Free(data);
+ if (e != BCExceptionNO)
+ return false;
+ return true;
+}
+
+bool CBC_Codabar::RenderDevice(CFX_RenderDevice* device,
+ const CFX_Matrix* matrix,
+ int32_t& e) {
+ CFX_WideString renderCon =
+ static_cast<CBC_OnedCodaBarWriter*>(m_pBCWriter.get())
+ ->encodedContents(m_renderContents.AsStringC());
+ static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())
+ ->RenderDeviceResult(device, matrix, renderCon.AsStringC(), e);
+ if (e != BCExceptionNO)
+ return false;
+ return true;
+}
+
+bool CBC_Codabar::RenderBitmap(CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
+ int32_t& e) {
+ CFX_WideString renderCon =
+ static_cast<CBC_OnedCodaBarWriter*>(m_pBCWriter.get())
+ ->encodedContents(m_renderContents.AsStringC());
+ static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())
+ ->RenderBitmapResult(pOutBitmap, renderCon.AsStringC(), e);
+ if (e != BCExceptionNO)
+ return false;
+ return true;
+}
+
+BC_TYPE CBC_Codabar::GetType() {
+ return BC_CODABAR;
+}
diff --git a/chromium/third_party/pdfium/fxbarcode/cbc_codabar.h b/chromium/third_party/pdfium/fxbarcode/cbc_codabar.h
new file mode 100644
index 00000000000..64b7ae8f450
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/cbc_codabar.h
@@ -0,0 +1,40 @@
+// Copyright 2016 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef FXBARCODE_CBC_CODABAR_H_
+#define FXBARCODE_CBC_CODABAR_H_
+
+#include "core/fxcrt/fx_coordinates.h"
+#include "core/fxcrt/fx_system.h"
+#include "core/fxge/fx_dib.h"
+#include "fxbarcode/cbc_onecode.h"
+
+class CBC_Codabar : public CBC_OneCode {
+ public:
+ CBC_Codabar();
+ ~CBC_Codabar() override;
+
+ // CBC_OneCode:
+ bool Encode(const CFX_WideStringC& contents,
+ bool isDevice,
+ int32_t& e) override;
+ bool RenderDevice(CFX_RenderDevice* device,
+ const CFX_Matrix* matrix,
+ int32_t& e) override;
+ bool RenderBitmap(CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
+ int32_t& e) override;
+ BC_TYPE GetType() override;
+
+ bool SetStartChar(char start);
+ bool SetEndChar(char end);
+ bool SetTextLocation(BC_TEXT_LOC location);
+ bool SetWideNarrowRatio(int32_t ratio);
+
+ private:
+ CFX_WideString m_renderContents;
+};
+
+#endif // FXBARCODE_CBC_CODABAR_H_
diff --git a/chromium/third_party/pdfium/fxbarcode/cbc_code128.cpp b/chromium/third_party/pdfium/fxbarcode/cbc_code128.cpp
new file mode 100644
index 00000000000..91d53d462b7
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/cbc_code128.cpp
@@ -0,0 +1,90 @@
+// Copyright 2016 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+/*
+ * Copyright 2011 ZXing authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "fxbarcode/cbc_code128.h"
+
+#include "fxbarcode/oned/BC_OnedCode128Writer.h"
+
+CBC_Code128::CBC_Code128(BC_TYPE type)
+ : CBC_OneCode(new CBC_OnedCode128Writer(type)) {}
+
+CBC_Code128::~CBC_Code128() {}
+
+bool CBC_Code128::SetTextLocation(BC_TEXT_LOC location) {
+ if (m_pBCWriter)
+ return static_cast<CBC_OnedCode128Writer*>(m_pBCWriter.get())
+ ->SetTextLocation(location);
+ return false;
+}
+
+bool CBC_Code128::Encode(const CFX_WideStringC& contents,
+ bool isDevice,
+ int32_t& e) {
+ if (contents.IsEmpty()) {
+ e = BCExceptionNoContents;
+ return false;
+ }
+ BCFORMAT format = BCFORMAT_CODE_128;
+ int32_t outWidth = 0;
+ int32_t outHeight = 0;
+ CFX_WideString content(contents);
+ if (contents.GetLength() % 2 &&
+ static_cast<CBC_OnedCode128Writer*>(m_pBCWriter.get())->GetType() ==
+ BC_CODE128_C) {
+ content += '0';
+ }
+ CFX_WideString encodeContents =
+ static_cast<CBC_OnedCode128Writer*>(m_pBCWriter.get())
+ ->FilterContents(content.AsStringC());
+ m_renderContents = encodeContents;
+ CFX_ByteString byteString = encodeContents.UTF8Encode();
+ uint8_t* data = static_cast<CBC_OnedCode128Writer*>(m_pBCWriter.get())
+ ->Encode(byteString, format, outWidth, outHeight, e);
+ if (e != BCExceptionNO)
+ return false;
+ static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())
+ ->RenderResult(encodeContents.AsStringC(), data, outWidth, isDevice, e);
+ FX_Free(data);
+ if (e != BCExceptionNO)
+ return false;
+ return true;
+}
+
+bool CBC_Code128::RenderDevice(CFX_RenderDevice* device,
+ const CFX_Matrix* matrix,
+ int32_t& e) {
+ static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())
+ ->RenderDeviceResult(device, matrix, m_renderContents.AsStringC(), e);
+ if (e != BCExceptionNO)
+ return false;
+ return true;
+}
+
+bool CBC_Code128::RenderBitmap(CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
+ int32_t& e) {
+ static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())
+ ->RenderBitmapResult(pOutBitmap, m_renderContents.AsStringC(), e);
+ return e == BCExceptionNO;
+}
+
+BC_TYPE CBC_Code128::GetType() {
+ return BC_CODE128;
+}
diff --git a/chromium/third_party/pdfium/fxbarcode/cbc_code128.h b/chromium/third_party/pdfium/fxbarcode/cbc_code128.h
new file mode 100644
index 00000000000..6cd6ac56aae
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/cbc_code128.h
@@ -0,0 +1,37 @@
+// Copyright 2016 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef FXBARCODE_CBC_CODE128_H_
+#define FXBARCODE_CBC_CODE128_H_
+
+#include "core/fxcrt/fx_coordinates.h"
+#include "core/fxcrt/fx_system.h"
+#include "core/fxge/fx_dib.h"
+#include "fxbarcode/cbc_onecode.h"
+
+class CBC_Code128 : public CBC_OneCode {
+ public:
+ explicit CBC_Code128(BC_TYPE type);
+ ~CBC_Code128() override;
+
+ // CBC_OneCode:
+ bool Encode(const CFX_WideStringC& contents,
+ bool isDevice,
+ int32_t& e) override;
+ bool RenderDevice(CFX_RenderDevice* device,
+ const CFX_Matrix* matrix,
+ int32_t& e) override;
+ bool RenderBitmap(CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
+ int32_t& e) override;
+ BC_TYPE GetType() override;
+
+ bool SetTextLocation(BC_TEXT_LOC loction);
+
+ private:
+ CFX_WideString m_renderContents;
+};
+
+#endif // FXBARCODE_CBC_CODE128_H_
diff --git a/chromium/third_party/pdfium/fxbarcode/cbc_code39.cpp b/chromium/third_party/pdfium/fxbarcode/cbc_code39.cpp
new file mode 100644
index 00000000000..58e78daadde
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/cbc_code39.cpp
@@ -0,0 +1,99 @@
+// Copyright 2016 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+/*
+ * Copyright 2011 ZXing authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "fxbarcode/cbc_code39.h"
+
+#include "fxbarcode/oned/BC_OnedCode39Writer.h"
+
+CBC_Code39::CBC_Code39() : CBC_OneCode(new CBC_OnedCode39Writer) {}
+
+CBC_Code39::~CBC_Code39() {}
+
+bool CBC_Code39::Encode(const CFX_WideStringC& contents,
+ bool isDevice,
+ int32_t& e) {
+ if (contents.IsEmpty()) {
+ e = BCExceptionNoContents;
+ return false;
+ }
+ BCFORMAT format = BCFORMAT_CODE_39;
+ int32_t outWidth = 0;
+ int32_t outHeight = 0;
+ CFX_WideString filtercontents =
+ static_cast<CBC_OnedCode39Writer*>(m_pBCWriter.get())
+ ->FilterContents(contents);
+ CFX_WideString renderContents =
+ static_cast<CBC_OnedCode39Writer*>(m_pBCWriter.get())
+ ->RenderTextContents(contents);
+ m_renderContents = renderContents;
+ CFX_ByteString byteString = filtercontents.UTF8Encode();
+ uint8_t* data = static_cast<CBC_OnedCode39Writer*>(m_pBCWriter.get())
+ ->Encode(byteString, format, outWidth, outHeight, e);
+ if (e != BCExceptionNO)
+ return false;
+ static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())
+ ->RenderResult(renderContents.AsStringC(), data, outWidth, isDevice, e);
+ FX_Free(data);
+ if (e != BCExceptionNO)
+ return false;
+ return true;
+}
+
+bool CBC_Code39::RenderDevice(CFX_RenderDevice* device,
+ const CFX_Matrix* matrix,
+ int32_t& e) {
+ CFX_WideString renderCon =
+ static_cast<CBC_OnedCode39Writer*>(m_pBCWriter.get())
+ ->encodedContents(m_renderContents.AsStringC(), e);
+ static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())
+ ->RenderDeviceResult(device, matrix, renderCon.AsStringC(), e);
+ if (e != BCExceptionNO)
+ return false;
+ return true;
+}
+
+bool CBC_Code39::RenderBitmap(CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
+ int32_t& e) {
+ CFX_WideString renderCon =
+ static_cast<CBC_OnedCode39Writer*>(m_pBCWriter.get())
+ ->encodedContents(m_renderContents.AsStringC(), e);
+ static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())
+ ->RenderBitmapResult(pOutBitmap, renderCon.AsStringC(), e);
+ return e == BCExceptionNO;
+}
+
+BC_TYPE CBC_Code39::GetType() {
+ return BC_CODE39;
+}
+
+bool CBC_Code39::SetTextLocation(BC_TEXT_LOC location) {
+ if (m_pBCWriter)
+ return static_cast<CBC_OnedCode39Writer*>(m_pBCWriter.get())
+ ->SetTextLocation(location);
+ return false;
+}
+
+bool CBC_Code39::SetWideNarrowRatio(int32_t ratio) {
+ if (m_pBCWriter)
+ return static_cast<CBC_OnedCode39Writer*>(m_pBCWriter.get())
+ ->SetWideNarrowRatio(ratio);
+ return false;
+}
diff --git a/chromium/third_party/pdfium/fxbarcode/cbc_code39.h b/chromium/third_party/pdfium/fxbarcode/cbc_code39.h
new file mode 100644
index 00000000000..a83a7b77e64
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/cbc_code39.h
@@ -0,0 +1,39 @@
+// Copyright 2016 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef FXBARCODE_CBC_CODE39_H_
+#define FXBARCODE_CBC_CODE39_H_
+
+#include "core/fxcrt/fx_coordinates.h"
+#include "core/fxcrt/fx_string.h"
+#include "core/fxcrt/fx_system.h"
+#include "core/fxge/fx_dib.h"
+#include "fxbarcode/cbc_onecode.h"
+
+class CBC_Code39 : public CBC_OneCode {
+ public:
+ CBC_Code39();
+ ~CBC_Code39() override;
+
+ // CBC_OneCode:
+ bool Encode(const CFX_WideStringC& contents,
+ bool isDevice,
+ int32_t& e) override;
+ bool RenderDevice(CFX_RenderDevice* device,
+ const CFX_Matrix* matrix,
+ int32_t& e) override;
+ bool RenderBitmap(CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
+ int32_t& e) override;
+ BC_TYPE GetType() override;
+
+ bool SetTextLocation(BC_TEXT_LOC location);
+ bool SetWideNarrowRatio(int32_t ratio);
+
+ private:
+ CFX_WideString m_renderContents;
+};
+
+#endif // FXBARCODE_CBC_CODE39_H_
diff --git a/chromium/third_party/pdfium/fxbarcode/cbc_codebase.cpp b/chromium/third_party/pdfium/fxbarcode/cbc_codebase.cpp
new file mode 100644
index 00000000000..df237c91364
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/cbc_codebase.cpp
@@ -0,0 +1,58 @@
+// Copyright 2016 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+/*
+ * Copyright 2011 ZXing authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "fxbarcode/cbc_codebase.h"
+
+#include "fxbarcode/BC_Writer.h"
+
+CBC_CodeBase::CBC_CodeBase(CBC_Writer* pWriter) : m_pBCWriter(pWriter) {}
+
+CBC_CodeBase::~CBC_CodeBase() {}
+
+bool CBC_CodeBase::SetCharEncoding(int32_t encoding) {
+ return m_pBCWriter && m_pBCWriter->SetCharEncoding(encoding);
+}
+
+bool CBC_CodeBase::SetModuleHeight(int32_t moduleHeight) {
+ return m_pBCWriter && m_pBCWriter->SetModuleHeight(moduleHeight);
+}
+
+bool CBC_CodeBase::SetModuleWidth(int32_t moduleWidth) {
+ return m_pBCWriter && m_pBCWriter->SetModuleWidth(moduleWidth);
+}
+
+bool CBC_CodeBase::SetHeight(int32_t height) {
+ return m_pBCWriter && m_pBCWriter->SetHeight(height);
+}
+
+bool CBC_CodeBase::SetWidth(int32_t width) {
+ return m_pBCWriter && m_pBCWriter->SetWidth(width);
+}
+
+void CBC_CodeBase::SetBackgroundColor(FX_ARGB backgroundColor) {
+ if (m_pBCWriter)
+ m_pBCWriter->SetBackgroundColor(backgroundColor);
+}
+
+void CBC_CodeBase::SetBarcodeColor(FX_ARGB foregroundColor) {
+ if (m_pBCWriter)
+ m_pBCWriter->SetBarcodeColor(foregroundColor);
+}
diff --git a/chromium/third_party/pdfium/fxbarcode/cbc_codebase.h b/chromium/third_party/pdfium/fxbarcode/cbc_codebase.h
new file mode 100644
index 00000000000..559f64e4f1a
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/cbc_codebase.h
@@ -0,0 +1,49 @@
+// Copyright 2016 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef FXBARCODE_CBC_CODEBASE_H_
+#define FXBARCODE_CBC_CODEBASE_H_
+
+#include <memory>
+
+#include "core/fxcrt/fx_coordinates.h"
+#include "core/fxcrt/fx_system.h"
+#include "core/fxge/fx_dib.h"
+#include "fxbarcode/BC_Library.h"
+
+class CBC_Writer;
+class CBC_Reader;
+class CFX_DIBitmap;
+class CFX_RenderDevice;
+
+class CBC_CodeBase {
+ public:
+ explicit CBC_CodeBase(CBC_Writer* pWriter);
+ virtual ~CBC_CodeBase();
+
+ virtual BC_TYPE GetType() = 0;
+ virtual bool Encode(const CFX_WideStringC& contents,
+ bool isDevice,
+ int32_t& e) = 0;
+ virtual bool RenderDevice(CFX_RenderDevice* device,
+ const CFX_Matrix* matrix,
+ int32_t& e) = 0;
+ virtual bool RenderBitmap(CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
+ int32_t& e) = 0;
+
+ bool SetCharEncoding(int32_t encoding);
+ bool SetModuleHeight(int32_t moduleHeight);
+ bool SetModuleWidth(int32_t moduleWidth);
+ bool SetHeight(int32_t height);
+ bool SetWidth(int32_t width);
+ void SetBackgroundColor(FX_ARGB backgroundColor);
+ void SetBarcodeColor(FX_ARGB foregroundColor);
+
+ protected:
+ std::unique_ptr<CBC_Writer> m_pBCWriter;
+};
+
+#endif // FXBARCODE_CBC_CODEBASE_H_
diff --git a/chromium/third_party/pdfium/fxbarcode/cbc_datamatrix.cpp b/chromium/third_party/pdfium/fxbarcode/cbc_datamatrix.cpp
new file mode 100644
index 00000000000..ea123151029
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/cbc_datamatrix.cpp
@@ -0,0 +1,65 @@
+// Copyright 2016 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+/*
+ * Copyright 2011 ZXing authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "fxbarcode/cbc_datamatrix.h"
+
+#include "fxbarcode/datamatrix/BC_DataMatrixWriter.h"
+
+CBC_DataMatrix::CBC_DataMatrix() : CBC_CodeBase(new CBC_DataMatrixWriter) {}
+
+CBC_DataMatrix::~CBC_DataMatrix() {}
+
+bool CBC_DataMatrix::Encode(const CFX_WideStringC& contents,
+ bool isDevice,
+ int32_t& e) {
+ int32_t outWidth = 0;
+ int32_t outHeight = 0;
+ uint8_t* data =
+ static_cast<CBC_DataMatrixWriter*>(m_pBCWriter.get())
+ ->Encode(CFX_WideString(contents), outWidth, outHeight, e);
+ if (e != BCExceptionNO)
+ return false;
+ static_cast<CBC_TwoDimWriter*>(m_pBCWriter.get())
+ ->RenderResult(data, outWidth, outHeight, e);
+ FX_Free(data);
+ if (e != BCExceptionNO)
+ return false;
+ return true;
+}
+
+bool CBC_DataMatrix::RenderDevice(CFX_RenderDevice* device,
+ const CFX_Matrix* matrix,
+ int32_t& e) {
+ static_cast<CBC_TwoDimWriter*>(m_pBCWriter.get())
+ ->RenderDeviceResult(device, matrix);
+ return true;
+}
+
+bool CBC_DataMatrix::RenderBitmap(CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
+ int32_t& e) {
+ static_cast<CBC_TwoDimWriter*>(m_pBCWriter.get())
+ ->RenderBitmapResult(pOutBitmap, e);
+ return e == BCExceptionNO;
+}
+
+BC_TYPE CBC_DataMatrix::GetType() {
+ return BC_DATAMATRIX;
+}
diff --git a/chromium/third_party/pdfium/fxbarcode/cbc_datamatrix.h b/chromium/third_party/pdfium/fxbarcode/cbc_datamatrix.h
new file mode 100644
index 00000000000..b03467974af
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/cbc_datamatrix.h
@@ -0,0 +1,33 @@
+// Copyright 2016 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef FXBARCODE_CBC_DATAMATRIX_H_
+#define FXBARCODE_CBC_DATAMATRIX_H_
+
+#include "core/fxcrt/fx_coordinates.h"
+#include "core/fxcrt/fx_string.h"
+#include "core/fxcrt/fx_system.h"
+#include "core/fxge/fx_dib.h"
+#include "fxbarcode/cbc_codebase.h"
+
+class CBC_DataMatrix : public CBC_CodeBase {
+ public:
+ CBC_DataMatrix();
+ ~CBC_DataMatrix() override;
+
+ // CBC_OneCode:
+ bool Encode(const CFX_WideStringC& contents,
+ bool isDevice,
+ int32_t& e) override;
+ bool RenderDevice(CFX_RenderDevice* device,
+ const CFX_Matrix* matrix,
+ int32_t& e) override;
+ bool RenderBitmap(CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
+ int32_t& e) override;
+ BC_TYPE GetType() override;
+};
+
+#endif // FXBARCODE_CBC_DATAMATRIX_H_
diff --git a/chromium/third_party/pdfium/fxbarcode/cbc_ean13.cpp b/chromium/third_party/pdfium/fxbarcode/cbc_ean13.cpp
new file mode 100644
index 00000000000..0366e03523d
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/cbc_ean13.cpp
@@ -0,0 +1,95 @@
+// Copyright 2016 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+/*
+ * Copyright 2011 ZXing authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "fxbarcode/cbc_ean13.h"
+
+#include "fxbarcode/oned/BC_OnedEAN13Writer.h"
+
+CBC_EAN13::CBC_EAN13() : CBC_OneCode(new CBC_OnedEAN13Writer) {}
+
+CBC_EAN13::~CBC_EAN13() {}
+
+CFX_WideString CBC_EAN13::Preprocess(const CFX_WideStringC& contents) {
+ CFX_WideString encodeContents =
+ static_cast<CBC_OnedEAN13Writer*>(m_pBCWriter.get())
+ ->FilterContents(contents);
+ int32_t length = encodeContents.GetLength();
+ if (length <= 12) {
+ for (int32_t i = 0; i < 12 - length; i++)
+ encodeContents = wchar_t('0') + encodeContents;
+
+ CFX_ByteString byteString = encodeContents.UTF8Encode();
+ int32_t checksum = static_cast<CBC_OnedEAN13Writer*>(m_pBCWriter.get())
+ ->CalcChecksum(byteString);
+ byteString += checksum - 0 + '0';
+ encodeContents = byteString.UTF8Decode();
+ }
+ if (length > 13)
+ encodeContents = encodeContents.Mid(0, 13);
+
+ return encodeContents;
+}
+
+bool CBC_EAN13::Encode(const CFX_WideStringC& contents,
+ bool isDevice,
+ int32_t& e) {
+ if (contents.IsEmpty()) {
+ e = BCExceptionNoContents;
+ return false;
+ }
+ BCFORMAT format = BCFORMAT_EAN_13;
+ int32_t outWidth = 0;
+ int32_t outHeight = 0;
+ CFX_WideString encodeContents = Preprocess(contents);
+ CFX_ByteString byteString = encodeContents.UTF8Encode();
+ m_renderContents = encodeContents;
+ uint8_t* data = static_cast<CBC_OnedEAN13Writer*>(m_pBCWriter.get())
+ ->Encode(byteString, format, outWidth, outHeight, e);
+ if (e != BCExceptionNO)
+ return false;
+ static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())
+ ->RenderResult(encodeContents.AsStringC(), data, outWidth, isDevice, e);
+ FX_Free(data);
+ if (e != BCExceptionNO)
+ return false;
+ return true;
+}
+
+bool CBC_EAN13::RenderDevice(CFX_RenderDevice* device,
+ const CFX_Matrix* matrix,
+ int32_t& e) {
+ static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())
+ ->RenderDeviceResult(device, matrix, m_renderContents.AsStringC(), e);
+ if (e != BCExceptionNO)
+ return false;
+ return true;
+}
+
+bool CBC_EAN13::RenderBitmap(CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
+ int32_t& e) {
+ static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())
+ ->RenderBitmapResult(pOutBitmap, m_renderContents.AsStringC(), e);
+ return e == BCExceptionNO;
+}
+
+BC_TYPE CBC_EAN13::GetType() {
+ return BC_EAN13;
+}
diff --git a/chromium/third_party/pdfium/fxbarcode/cbc_ean13.h b/chromium/third_party/pdfium/fxbarcode/cbc_ean13.h
new file mode 100644
index 00000000000..105ded27c78
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/cbc_ean13.h
@@ -0,0 +1,37 @@
+// Copyright 2016 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef FXBARCODE_CBC_EAN13_H_
+#define FXBARCODE_CBC_EAN13_H_
+
+#include "core/fxcrt/fx_coordinates.h"
+#include "core/fxcrt/fx_string.h"
+#include "core/fxcrt/fx_system.h"
+#include "core/fxge/fx_dib.h"
+#include "fxbarcode/cbc_onecode.h"
+
+class CBC_EAN13 : public CBC_OneCode {
+ public:
+ CBC_EAN13();
+ ~CBC_EAN13() override;
+
+ // CBC_OneCode:
+ bool Encode(const CFX_WideStringC& contents,
+ bool isDevice,
+ int32_t& e) override;
+ bool RenderDevice(CFX_RenderDevice* device,
+ const CFX_Matrix* matrix,
+ int32_t& e) override;
+ bool RenderBitmap(CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
+ int32_t& e) override;
+ BC_TYPE GetType() override;
+
+ private:
+ CFX_WideString Preprocess(const CFX_WideStringC& contents);
+ CFX_WideString m_renderContents;
+};
+
+#endif // FXBARCODE_CBC_EAN13_H_
diff --git a/chromium/third_party/pdfium/fxbarcode/cbc_ean8.cpp b/chromium/third_party/pdfium/fxbarcode/cbc_ean8.cpp
new file mode 100644
index 00000000000..0ba9b209046
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/cbc_ean8.cpp
@@ -0,0 +1,94 @@
+// Copyright 2016 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+/*
+ * Copyright 2011 ZXing authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "fxbarcode/cbc_ean8.h"
+
+#include "fxbarcode/oned/BC_OnedEAN8Writer.h"
+
+CBC_EAN8::CBC_EAN8() : CBC_OneCode(new CBC_OnedEAN8Writer) {}
+
+CBC_EAN8::~CBC_EAN8() {}
+
+CFX_WideString CBC_EAN8::Preprocess(const CFX_WideStringC& contents) {
+ CFX_WideString encodeContents =
+ static_cast<CBC_OnedEAN8Writer*>(m_pBCWriter.get())
+ ->FilterContents(contents);
+ int32_t length = encodeContents.GetLength();
+ if (length <= 7) {
+ for (int32_t i = 0; i < 7 - length; i++)
+ encodeContents = wchar_t('0') + encodeContents;
+
+ CFX_ByteString byteString = encodeContents.UTF8Encode();
+ int32_t checksum = static_cast<CBC_OnedEAN8Writer*>(m_pBCWriter.get())
+ ->CalcChecksum(byteString);
+ encodeContents += wchar_t(checksum - 0 + '0');
+ }
+ if (length > 8)
+ encodeContents = encodeContents.Mid(0, 8);
+
+ return encodeContents;
+}
+
+bool CBC_EAN8::Encode(const CFX_WideStringC& contents,
+ bool isDevice,
+ int32_t& e) {
+ if (contents.IsEmpty()) {
+ e = BCExceptionNoContents;
+ return false;
+ }
+ BCFORMAT format = BCFORMAT_EAN_8;
+ int32_t outWidth = 0;
+ int32_t outHeight = 0;
+ CFX_WideString encodeContents = Preprocess(contents);
+ CFX_ByteString byteString = encodeContents.UTF8Encode();
+ m_renderContents = encodeContents;
+ uint8_t* data = static_cast<CBC_OnedEAN8Writer*>(m_pBCWriter.get())
+ ->Encode(byteString, format, outWidth, outHeight, e);
+ if (e != BCExceptionNO)
+ return false;
+ static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())
+ ->RenderResult(encodeContents.AsStringC(), data, outWidth, isDevice, e);
+ FX_Free(data);
+ if (e != BCExceptionNO)
+ return false;
+ return true;
+}
+
+bool CBC_EAN8::RenderDevice(CFX_RenderDevice* device,
+ const CFX_Matrix* matrix,
+ int32_t& e) {
+ static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())
+ ->RenderDeviceResult(device, matrix, m_renderContents.AsStringC(), e);
+ if (e != BCExceptionNO)
+ return false;
+ return true;
+}
+
+bool CBC_EAN8::RenderBitmap(CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
+ int32_t& e) {
+ static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())
+ ->RenderBitmapResult(pOutBitmap, m_renderContents.AsStringC(), e);
+ return e == BCExceptionNO;
+}
+
+BC_TYPE CBC_EAN8::GetType() {
+ return BC_EAN8;
+}
diff --git a/chromium/third_party/pdfium/fxbarcode/cbc_ean8.h b/chromium/third_party/pdfium/fxbarcode/cbc_ean8.h
new file mode 100644
index 00000000000..16480ef2986
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/cbc_ean8.h
@@ -0,0 +1,36 @@
+// Copyright 2016 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef FXBARCODE_CBC_EAN8_H_
+#define FXBARCODE_CBC_EAN8_H_
+
+#include "core/fxcrt/fx_string.h"
+#include "core/fxcrt/fx_system.h"
+#include "core/fxge/fx_dib.h"
+#include "fxbarcode/cbc_onecode.h"
+
+class CBC_EAN8 : public CBC_OneCode {
+ public:
+ CBC_EAN8();
+ ~CBC_EAN8() override;
+
+ // CBC_OneCode:
+ bool Encode(const CFX_WideStringC& contents,
+ bool isDevice,
+ int32_t& e) override;
+ bool RenderDevice(CFX_RenderDevice* device,
+ const CFX_Matrix* matrix,
+ int32_t& e) override;
+ bool RenderBitmap(CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
+ int32_t& e) override;
+ BC_TYPE GetType() override;
+
+ private:
+ CFX_WideString Preprocess(const CFX_WideStringC& contents);
+ CFX_WideString m_renderContents;
+};
+
+#endif // FXBARCODE_CBC_EAN8_H_
diff --git a/chromium/third_party/pdfium/fxbarcode/cbc_onecode.cpp b/chromium/third_party/pdfium/fxbarcode/cbc_onecode.cpp
new file mode 100644
index 00000000000..1b4db0a1707
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/cbc_onecode.cpp
@@ -0,0 +1,78 @@
+// Copyright 2016 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+/*
+ * Copyright 2011 ZXing authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "fxbarcode/cbc_onecode.h"
+
+#include "fxbarcode/oned/BC_OneDimWriter.h"
+
+CBC_OneCode::CBC_OneCode(CBC_Writer* pWriter) : CBC_CodeBase(pWriter) {}
+
+CBC_OneCode::~CBC_OneCode() {}
+
+bool CBC_OneCode::CheckContentValidity(const CFX_WideStringC& contents) {
+ return m_pBCWriter &&
+ static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())
+ ->CheckContentValidity(contents);
+}
+
+CFX_WideString CBC_OneCode::FilterContents(const CFX_WideStringC& contents) {
+ if (!m_pBCWriter)
+ return CFX_WideString();
+ return static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())
+ ->FilterContents(contents);
+}
+
+void CBC_OneCode::SetPrintChecksum(bool checksum) {
+ if (m_pBCWriter)
+ static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())
+ ->SetPrintChecksum(checksum);
+}
+
+void CBC_OneCode::SetDataLength(int32_t length) {
+ if (m_pBCWriter)
+ static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())->SetDataLength(length);
+}
+
+void CBC_OneCode::SetCalChecksum(bool calc) {
+ if (m_pBCWriter)
+ static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())->SetCalcChecksum(calc);
+}
+
+bool CBC_OneCode::SetFont(CFX_Font* cFont) {
+ if (m_pBCWriter)
+ return static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())->SetFont(cFont);
+ return false;
+}
+
+void CBC_OneCode::SetFontSize(float size) {
+ if (m_pBCWriter)
+ static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())->SetFontSize(size);
+}
+
+void CBC_OneCode::SetFontStyle(int32_t style) {
+ if (m_pBCWriter)
+ static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())->SetFontStyle(style);
+}
+
+void CBC_OneCode::SetFontColor(FX_ARGB color) {
+ if (m_pBCWriter)
+ static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())->SetFontColor(color);
+}
diff --git a/chromium/third_party/pdfium/fxbarcode/cbc_onecode.h b/chromium/third_party/pdfium/fxbarcode/cbc_onecode.h
new file mode 100644
index 00000000000..8da46113db9
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/cbc_onecode.h
@@ -0,0 +1,35 @@
+// Copyright 2016 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef FXBARCODE_CBC_ONECODE_H_
+#define FXBARCODE_CBC_ONECODE_H_
+
+#include "core/fxcrt/fx_string.h"
+#include "core/fxcrt/fx_system.h"
+#include "fxbarcode/cbc_codebase.h"
+
+class CFX_DIBitmap;
+class CFX_Font;
+class CFX_RenderDevice;
+
+class CBC_OneCode : public CBC_CodeBase {
+ public:
+ explicit CBC_OneCode(CBC_Writer* pWriter);
+ ~CBC_OneCode() override;
+
+ virtual bool CheckContentValidity(const CFX_WideStringC& contents);
+ virtual CFX_WideString FilterContents(const CFX_WideStringC& contents);
+
+ virtual void SetPrintChecksum(bool checksum);
+ virtual void SetDataLength(int32_t length);
+ virtual void SetCalChecksum(bool calc);
+ virtual bool SetFont(CFX_Font* cFont);
+ virtual void SetFontSize(float size);
+ virtual void SetFontStyle(int32_t style);
+ virtual void SetFontColor(FX_ARGB color);
+};
+
+#endif // FXBARCODE_CBC_ONECODE_H_
diff --git a/chromium/third_party/pdfium/fxbarcode/cbc_pdf417i.cpp b/chromium/third_party/pdfium/fxbarcode/cbc_pdf417i.cpp
new file mode 100644
index 00000000000..6a79aa3f572
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/cbc_pdf417i.cpp
@@ -0,0 +1,75 @@
+// Copyright 2016 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+/*
+ * Copyright 2011 ZXing authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "fxbarcode/cbc_pdf417i.h"
+
+#include "fxbarcode/pdf417/BC_PDF417Writer.h"
+
+CBC_PDF417I::CBC_PDF417I() : CBC_CodeBase(new CBC_PDF417Writer) {}
+
+CBC_PDF417I::~CBC_PDF417I() {}
+
+bool CBC_PDF417I::SetErrorCorrectionLevel(int32_t level) {
+ static_cast<CBC_PDF417Writer*>(m_pBCWriter.get())
+ ->SetErrorCorrectionLevel(level);
+ return true;
+}
+
+void CBC_PDF417I::SetTruncated(bool truncated) {
+ static_cast<CBC_PDF417Writer*>(m_pBCWriter.get())->SetTruncated(truncated);
+}
+
+bool CBC_PDF417I::Encode(const CFX_WideStringC& contents,
+ bool isDevice,
+ int32_t& e) {
+ int32_t outWidth = 0;
+ int32_t outHeight = 0;
+ uint8_t* data =
+ static_cast<CBC_PDF417Writer*>(m_pBCWriter.get())
+ ->Encode(CFX_WideString(contents), outWidth, outHeight, e);
+ if (e != BCExceptionNO)
+ return false;
+ static_cast<CBC_TwoDimWriter*>(m_pBCWriter.get())
+ ->RenderResult(data, outWidth, outHeight, e);
+ FX_Free(data);
+ if (e != BCExceptionNO)
+ return false;
+ return true;
+}
+
+bool CBC_PDF417I::RenderDevice(CFX_RenderDevice* device,
+ const CFX_Matrix* matrix,
+ int32_t& e) {
+ static_cast<CBC_TwoDimWriter*>(m_pBCWriter.get())
+ ->RenderDeviceResult(device, matrix);
+ return true;
+}
+
+bool CBC_PDF417I::RenderBitmap(CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
+ int32_t& e) {
+ static_cast<CBC_TwoDimWriter*>(m_pBCWriter.get())
+ ->RenderBitmapResult(pOutBitmap, e);
+ return e == BCExceptionNO;
+}
+
+BC_TYPE CBC_PDF417I::GetType() {
+ return BC_PDF417;
+}
diff --git a/chromium/third_party/pdfium/fxbarcode/cbc_pdf417i.h b/chromium/third_party/pdfium/fxbarcode/cbc_pdf417i.h
new file mode 100644
index 00000000000..da1c88d3f20
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/cbc_pdf417i.h
@@ -0,0 +1,35 @@
+// Copyright 2016 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef FXBARCODE_CBC_PDF417I_H_
+#define FXBARCODE_CBC_PDF417I_H_
+
+#include "core/fxcrt/fx_string.h"
+#include "core/fxcrt/fx_system.h"
+#include "core/fxge/fx_dib.h"
+#include "fxbarcode/cbc_codebase.h"
+
+class CBC_PDF417I : public CBC_CodeBase {
+ public:
+ CBC_PDF417I();
+ ~CBC_PDF417I() override;
+
+ // CBC_CodeBase::
+ bool Encode(const CFX_WideStringC& contents,
+ bool isDevice,
+ int32_t& e) override;
+ bool RenderDevice(CFX_RenderDevice* device,
+ const CFX_Matrix* matrix,
+ int32_t& e) override;
+ bool RenderBitmap(CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
+ int32_t& e) override;
+ BC_TYPE GetType() override;
+
+ bool SetErrorCorrectionLevel(int32_t level);
+ void SetTruncated(bool truncated);
+};
+
+#endif // FXBARCODE_CBC_PDF417I_H_
diff --git a/chromium/third_party/pdfium/fxbarcode/cbc_qrcode.cpp b/chromium/third_party/pdfium/fxbarcode/cbc_qrcode.cpp
new file mode 100644
index 00000000000..0e0191dc3e0
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/cbc_qrcode.cpp
@@ -0,0 +1,72 @@
+// Copyright 2016 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+/*
+ * Copyright 2011 ZXing authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "fxbarcode/cbc_qrcode.h"
+
+#include <memory>
+
+#include "fxbarcode/qrcode/BC_QRCodeWriter.h"
+
+CBC_QRCode::CBC_QRCode() : CBC_CodeBase(new CBC_QRCodeWriter) {}
+
+CBC_QRCode::~CBC_QRCode() {}
+
+bool CBC_QRCode::SetErrorCorrectionLevel(int32_t level) {
+ if (level < 0 || level > 3)
+ return false;
+ return m_pBCWriter && writer()->SetErrorCorrectionLevel(level);
+}
+
+bool CBC_QRCode::Encode(const CFX_WideStringC& contents,
+ bool isDevice,
+ int32_t& e) {
+ int32_t outWidth = 0;
+ int32_t outHeight = 0;
+ CBC_QRCodeWriter* pWriter = writer();
+ std::unique_ptr<uint8_t, FxFreeDeleter> data(pWriter->Encode(
+ CFX_WideString(contents), pWriter->GetErrorCorrectionLevel(), outWidth,
+ outHeight, e));
+ if (e != BCExceptionNO)
+ return false;
+ pWriter->RenderResult(data.get(), outWidth, outHeight, e);
+ return e == BCExceptionNO;
+}
+
+bool CBC_QRCode::RenderDevice(CFX_RenderDevice* device,
+ const CFX_Matrix* matrix,
+ int32_t& e) {
+ writer()->RenderDeviceResult(device, matrix);
+ return true;
+}
+
+bool CBC_QRCode::RenderBitmap(CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
+ int32_t& e) {
+ writer()->RenderBitmapResult(pOutBitmap, e);
+ return e == BCExceptionNO;
+}
+
+BC_TYPE CBC_QRCode::GetType() {
+ return BC_QR_CODE;
+}
+
+CBC_QRCodeWriter* CBC_QRCode::writer() {
+ return static_cast<CBC_QRCodeWriter*>(m_pBCWriter.get());
+}
diff --git a/chromium/third_party/pdfium/fxbarcode/cbc_qrcode.h b/chromium/third_party/pdfium/fxbarcode/cbc_qrcode.h
new file mode 100644
index 00000000000..d8d871203df
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/cbc_qrcode.h
@@ -0,0 +1,39 @@
+// Copyright 2016 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef FXBARCODE_CBC_QRCODE_H_
+#define FXBARCODE_CBC_QRCODE_H_
+
+#include "core/fxcrt/fx_string.h"
+#include "core/fxcrt/fx_system.h"
+#include "core/fxge/fx_dib.h"
+#include "fxbarcode/cbc_codebase.h"
+
+class CBC_QRCodeWriter;
+
+class CBC_QRCode : public CBC_CodeBase {
+ public:
+ CBC_QRCode();
+ ~CBC_QRCode() override;
+
+ // CBC_CodeBase:
+ bool Encode(const CFX_WideStringC& contents,
+ bool isDevice,
+ int32_t& e) override;
+ bool RenderDevice(CFX_RenderDevice* device,
+ const CFX_Matrix* matrix,
+ int32_t& e) override;
+ bool RenderBitmap(CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
+ int32_t& e) override;
+ BC_TYPE GetType() override;
+
+ bool SetErrorCorrectionLevel(int32_t level);
+
+ private:
+ CBC_QRCodeWriter* writer();
+};
+
+#endif // FXBARCODE_CBC_QRCODE_H_
diff --git a/chromium/third_party/pdfium/fxbarcode/cbc_upca.cpp b/chromium/third_party/pdfium/fxbarcode/cbc_upca.cpp
new file mode 100644
index 00000000000..6c8e821a10e
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/cbc_upca.cpp
@@ -0,0 +1,98 @@
+// Copyright 2016 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+/*
+ * Copyright 2011 ZXing authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "fxbarcode/cbc_upca.h"
+
+#include "fxbarcode/oned/BC_OnedUPCAWriter.h"
+
+CBC_UPCA::CBC_UPCA() : CBC_OneCode(new CBC_OnedUPCAWriter) {}
+
+CBC_UPCA::~CBC_UPCA() {}
+
+CFX_WideString CBC_UPCA::Preprocess(const CFX_WideStringC& contents) {
+ CBC_OnedUPCAWriter* pWriter =
+ static_cast<CBC_OnedUPCAWriter*>(m_pBCWriter.get());
+ CFX_WideString encodeContents = pWriter->FilterContents(contents);
+ int32_t length = encodeContents.GetLength();
+ if (length <= 11) {
+ for (int32_t i = 0; i < 11 - length; i++)
+ encodeContents = wchar_t('0') + encodeContents;
+
+ CFX_ByteString byteString = encodeContents.UTF8Encode();
+ int32_t checksum = pWriter->CalcChecksum(byteString);
+ byteString += checksum - 0 + '0';
+ encodeContents = byteString.UTF8Decode();
+ }
+ if (length > 12)
+ encodeContents = encodeContents.Mid(0, 12);
+
+ return encodeContents;
+}
+
+bool CBC_UPCA::Encode(const CFX_WideStringC& contents,
+ bool isDevice,
+ int32_t& e) {
+ if (contents.IsEmpty()) {
+ e = BCExceptionNoContents;
+ return false;
+ }
+ BCFORMAT format = BCFORMAT_UPC_A;
+ int32_t outWidth = 0;
+ int32_t outHeight = 0;
+ CFX_WideString encodeContents = Preprocess(contents);
+ CFX_ByteString byteString = encodeContents.UTF8Encode();
+ m_renderContents = encodeContents;
+
+ CBC_OnedUPCAWriter* pWriter =
+ static_cast<CBC_OnedUPCAWriter*>(m_pBCWriter.get());
+
+ pWriter->Init();
+ uint8_t* data = pWriter->Encode(byteString, format, outWidth, outHeight, e);
+ if (e != BCExceptionNO)
+ return false;
+ pWriter->RenderResult(encodeContents.AsStringC(), data, outWidth, isDevice,
+ e);
+ FX_Free(data);
+ if (e != BCExceptionNO)
+ return false;
+ return true;
+}
+
+bool CBC_UPCA::RenderDevice(CFX_RenderDevice* device,
+ const CFX_Matrix* matrix,
+ int32_t& e) {
+ static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())
+ ->RenderDeviceResult(device, matrix, m_renderContents.AsStringC(), e);
+ if (e != BCExceptionNO)
+ return false;
+ return true;
+}
+
+bool CBC_UPCA::RenderBitmap(CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
+ int32_t& e) {
+ static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())
+ ->RenderBitmapResult(pOutBitmap, m_renderContents.AsStringC(), e);
+ return e == BCExceptionNO;
+}
+
+BC_TYPE CBC_UPCA::GetType() {
+ return BC_UPCA;
+}
diff --git a/chromium/third_party/pdfium/fxbarcode/cbc_upca.h b/chromium/third_party/pdfium/fxbarcode/cbc_upca.h
new file mode 100644
index 00000000000..e27596ca9a6
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/cbc_upca.h
@@ -0,0 +1,36 @@
+// Copyright 2016 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef FXBARCODE_CBC_UPCA_H_
+#define FXBARCODE_CBC_UPCA_H_
+
+#include "core/fxcrt/fx_string.h"
+#include "core/fxcrt/fx_system.h"
+#include "core/fxge/fx_dib.h"
+#include "fxbarcode/cbc_onecode.h"
+
+class CBC_UPCA : public CBC_OneCode {
+ public:
+ CBC_UPCA();
+ ~CBC_UPCA() override;
+
+ // CBC_CodeBase
+ bool Encode(const CFX_WideStringC& contents,
+ bool isDevice,
+ int32_t& e) override;
+ bool RenderDevice(CFX_RenderDevice* device,
+ const CFX_Matrix* matrix,
+ int32_t& e) override;
+ bool RenderBitmap(CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
+ int32_t& e) override;
+ BC_TYPE GetType() override;
+
+ private:
+ CFX_WideString Preprocess(const CFX_WideStringC& contents);
+ CFX_WideString m_renderContents;
+};
+
+#endif // FXBARCODE_CBC_UPCA_H_
diff --git a/chromium/third_party/pdfium/fxbarcode/common/BC_CommonBitArray.cpp b/chromium/third_party/pdfium/fxbarcode/common/BC_CommonBitArray.cpp
new file mode 100644
index 00000000000..10da9bef1b4
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/common/BC_CommonBitArray.cpp
@@ -0,0 +1,90 @@
+// 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
+// Original code is licensed as follows:
+/*
+ * Copyright 2007 ZXing authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "fxbarcode/common/BC_CommonBitArray.h"
+
+#include <utility>
+
+#include "fxbarcode/utils.h"
+
+CBC_CommonBitArray::CBC_CommonBitArray(CBC_CommonBitArray* array) {
+ m_size = array->GetSize();
+ m_bits = array->GetBits();
+}
+
+CBC_CommonBitArray::CBC_CommonBitArray() {
+ m_bits.resize(1);
+ m_size = 0;
+}
+
+CBC_CommonBitArray::CBC_CommonBitArray(int32_t size) {
+ m_bits.resize((size + 31) >> 5);
+ m_size = size;
+}
+
+CBC_CommonBitArray::~CBC_CommonBitArray() {}
+
+size_t CBC_CommonBitArray::GetSize() {
+ return m_size;
+}
+
+std::vector<int32_t>& CBC_CommonBitArray::GetBits() {
+ return m_bits;
+}
+
+size_t CBC_CommonBitArray::GetSizeInBytes() {
+ return (m_size + 7) >> 3;
+}
+
+bool CBC_CommonBitArray::Get(size_t i) {
+ return (m_bits[i >> 5] & (1 << (i & 0x1f))) != 0;
+}
+
+void CBC_CommonBitArray::Set(size_t i) {
+ m_bits[i >> 5] |= 1 << (i & 0x1F);
+}
+
+void CBC_CommonBitArray::Flip(size_t i) {
+ m_bits[i >> 5] ^= 1 << (i & 0x1F);
+}
+
+void CBC_CommonBitArray::SetBulk(size_t i, int32_t newBits) {
+ m_bits[i >> 5] = newBits;
+}
+
+void CBC_CommonBitArray::Clear() {
+ for (auto& value : m_bits)
+ value = 0;
+}
+
+int32_t* CBC_CommonBitArray::GetBitArray() {
+ return m_bits.data();
+}
+
+void CBC_CommonBitArray::Reverse() {
+ std::vector<int32_t> newBits(m_bits.size());
+ for (size_t i = 0; i < m_size; i++) {
+ if (Get(m_size - i - 1))
+ newBits[i >> 5] |= 1 << (i & 0x1F);
+ }
+ m_bits = std::move(newBits);
+}
diff --git a/chromium/third_party/pdfium/fxbarcode/common/BC_CommonBitArray.h b/chromium/third_party/pdfium/fxbarcode/common/BC_CommonBitArray.h
new file mode 100644
index 00000000000..f3d0a5ed830
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/common/BC_CommonBitArray.h
@@ -0,0 +1,37 @@
+// 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 FXBARCODE_COMMON_BC_COMMONBITARRAY_H_
+#define FXBARCODE_COMMON_BC_COMMONBITARRAY_H_
+
+#include <vector>
+
+#include "core/fxcrt/fx_basic.h"
+
+class CBC_CommonBitArray {
+ public:
+ explicit CBC_CommonBitArray(CBC_CommonBitArray* array);
+ explicit CBC_CommonBitArray(int32_t size);
+ CBC_CommonBitArray();
+ virtual ~CBC_CommonBitArray();
+
+ size_t GetSize();
+ size_t GetSizeInBytes();
+ std::vector<int32_t>& GetBits();
+ int32_t* GetBitArray();
+ bool Get(size_t i);
+ void Set(size_t i);
+ void Flip(size_t i);
+ void SetBulk(size_t i, int32_t newBits);
+ void Reverse();
+ void Clear();
+
+ private:
+ size_t m_size;
+ std::vector<int32_t> m_bits;
+};
+
+#endif // FXBARCODE_COMMON_BC_COMMONBITARRAY_H_
diff --git a/chromium/third_party/pdfium/fxbarcode/common/BC_CommonBitMatrix.cpp b/chromium/third_party/pdfium/fxbarcode/common/BC_CommonBitMatrix.cpp
new file mode 100644
index 00000000000..fe3546156e2
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/common/BC_CommonBitMatrix.cpp
@@ -0,0 +1,133 @@
+// 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
+// Original code is licensed as follows:
+/*
+ * Copyright 2007 ZXing authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "fxbarcode/common/BC_CommonBitArray.h"
+#include "fxbarcode/common/BC_CommonBitMatrix.h"
+#include "fxbarcode/utils.h"
+
+CBC_CommonBitMatrix::CBC_CommonBitMatrix() {}
+
+void CBC_CommonBitMatrix::Init(int32_t dimension) {
+ m_width = dimension;
+ m_height = dimension;
+ int32_t rowSize = (m_height + 31) >> 5;
+ m_rowSize = rowSize;
+ m_bits = FX_Alloc2D(int32_t, m_rowSize, m_height);
+ memset(m_bits, 0, m_rowSize * m_height * sizeof(int32_t));
+}
+
+void CBC_CommonBitMatrix::Init(int32_t width, int32_t height) {
+ m_width = width;
+ m_height = height;
+ int32_t rowSize = (width + 31) >> 5;
+ m_rowSize = rowSize;
+ m_bits = FX_Alloc2D(int32_t, m_rowSize, m_height);
+ memset(m_bits, 0, m_rowSize * m_height * sizeof(int32_t));
+}
+
+CBC_CommonBitMatrix::~CBC_CommonBitMatrix() {
+ FX_Free(m_bits);
+}
+
+bool CBC_CommonBitMatrix::Get(int32_t x, int32_t y) const {
+ int32_t offset = y * m_rowSize + (x >> 5);
+ if (offset >= m_rowSize * m_height || offset < 0)
+ return false;
+ return ((((uint32_t)m_bits[offset]) >> (x & 0x1f)) & 1) != 0;
+}
+
+int32_t* CBC_CommonBitMatrix::GetBits() {
+ return m_bits;
+}
+
+void CBC_CommonBitMatrix::Set(int32_t x, int32_t y) {
+ int32_t offset = y * m_rowSize + (x >> 5);
+ if (offset >= m_rowSize * m_height || offset < 0)
+ return;
+ m_bits[offset] |= 1 << (x & 0x1f);
+}
+
+void CBC_CommonBitMatrix::Flip(int32_t x, int32_t y) {
+ int32_t offset = y * m_rowSize + (x >> 5);
+ m_bits[offset] ^= 1 << (x & 0x1f);
+}
+
+void CBC_CommonBitMatrix::Clear() {
+ memset(m_bits, 0, m_rowSize * m_height * sizeof(int32_t));
+}
+
+bool CBC_CommonBitMatrix::SetRegion(int32_t left,
+ int32_t top,
+ int32_t width,
+ int32_t height) {
+ if (top < 0 || left < 0 || height < 1 || width < 1)
+ return false;
+
+ int32_t right = left + width;
+ int32_t bottom = top + height;
+ if (m_height < bottom || m_width < right)
+ return false;
+
+ for (int32_t y = top; y < bottom; y++) {
+ int32_t offset = y * m_rowSize;
+ for (int32_t x = left; x < right; x++)
+ m_bits[offset + (x >> 5)] |= 1 << (x & 0x1f);
+ }
+ return true;
+}
+
+CBC_CommonBitArray* CBC_CommonBitMatrix::GetRow(int32_t y,
+ CBC_CommonBitArray* row) {
+ CBC_CommonBitArray* rowArray = nullptr;
+ if (!row || static_cast<int32_t>(row->GetSize()) < m_width) {
+ rowArray = new CBC_CommonBitArray(m_width);
+ } else {
+ rowArray = new CBC_CommonBitArray(row);
+ }
+ int32_t offset = y * m_rowSize;
+ for (int32_t x = 0; x < m_rowSize; x++)
+ rowArray->SetBulk(x << 5, m_bits[offset + x]);
+ return rowArray;
+}
+
+void CBC_CommonBitMatrix::SetRow(int32_t y, CBC_CommonBitArray* row) {
+ int32_t l = y * m_rowSize;
+ for (int32_t i = 0; i < m_rowSize; i++) {
+ m_bits[l] = row->GetBitArray()[i];
+ l++;
+ }
+}
+
+void CBC_CommonBitMatrix::SetCol(int32_t y, CBC_CommonBitArray* col) {
+ for (size_t i = 0; i < col->GetBits().size(); ++i)
+ m_bits[i * m_rowSize + y] = col->GetBitArray()[i];
+}
+
+int32_t CBC_CommonBitMatrix::GetWidth() const {
+ return m_width;
+}
+int32_t CBC_CommonBitMatrix::GetHeight() const {
+ return m_height;
+}
+int32_t CBC_CommonBitMatrix::GetRowSize() const {
+ return m_rowSize;
+}
diff --git a/chromium/third_party/pdfium/fxbarcode/common/BC_CommonBitMatrix.h b/chromium/third_party/pdfium/fxbarcode/common/BC_CommonBitMatrix.h
new file mode 100644
index 00000000000..744461903d8
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/common/BC_CommonBitMatrix.h
@@ -0,0 +1,43 @@
+// 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 FXBARCODE_COMMON_BC_COMMONBITMATRIX_H_
+#define FXBARCODE_COMMON_BC_COMMONBITMATRIX_H_
+
+#include "core/fxcrt/fx_system.h"
+
+class CBC_CommonBitArray;
+
+class CBC_CommonBitMatrix {
+ public:
+ CBC_CommonBitMatrix();
+ ~CBC_CommonBitMatrix();
+
+ void Init(int32_t dimension);
+ void Init(int32_t width, int32_t height);
+
+ bool Get(int32_t x, int32_t y) const;
+ void Set(int32_t x, int32_t y);
+ void Flip(int32_t x, int32_t y);
+ void Clear();
+ bool SetRegion(int32_t left, int32_t top, int32_t width, int32_t height);
+ CBC_CommonBitArray* GetRow(int32_t y, CBC_CommonBitArray* row);
+ void SetRow(int32_t y, CBC_CommonBitArray* row);
+ CBC_CommonBitArray* GetCol(int32_t y, CBC_CommonBitArray* row);
+ void SetCol(int32_t y, CBC_CommonBitArray* col);
+ int32_t GetWidth() const;
+ int32_t GetHeight() const;
+ int32_t GetRowSize() const;
+ int32_t* GetBits();
+
+ private:
+ int32_t m_width = 0;
+ int32_t m_height = 0;
+ int32_t m_rowSize = 0;
+ int32_t* m_bits = nullptr;
+};
+
+#endif // FXBARCODE_COMMON_BC_COMMONBITMATRIX_H_
diff --git a/chromium/third_party/pdfium/fxbarcode/common/BC_CommonByteArray.cpp b/chromium/third_party/pdfium/fxbarcode/common/BC_CommonByteArray.cpp
new file mode 100644
index 00000000000..80ae07d1ad1
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/common/BC_CommonByteArray.cpp
@@ -0,0 +1,101 @@
+// 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
+// Original code is licensed as follows:
+/*
+ * Copyright 2008 ZXing authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <algorithm>
+
+#include "fxbarcode/common/BC_CommonByteArray.h"
+
+CBC_CommonByteArray::CBC_CommonByteArray() {
+ m_bytes = nullptr;
+ m_size = 0;
+ m_index = 0;
+}
+CBC_CommonByteArray::CBC_CommonByteArray(int32_t size) {
+ m_size = size;
+ m_bytes = FX_Alloc(uint8_t, size);
+ memset(m_bytes, 0, size);
+ m_index = 0;
+}
+CBC_CommonByteArray::CBC_CommonByteArray(uint8_t* byteArray, int32_t size) {
+ m_size = size;
+ m_bytes = FX_Alloc(uint8_t, size);
+ memcpy(m_bytes, byteArray, size);
+ m_index = size;
+}
+CBC_CommonByteArray::~CBC_CommonByteArray() {
+ FX_Free(m_bytes);
+}
+int32_t CBC_CommonByteArray::At(int32_t index) const {
+ return m_bytes[index] & 0xff;
+}
+void CBC_CommonByteArray::Set(int32_t index, int32_t value) {
+ m_bytes[index] = (uint8_t)value;
+}
+int32_t CBC_CommonByteArray::Size() const {
+ return m_size;
+}
+bool CBC_CommonByteArray::IsEmpty() const {
+ return m_size == 0;
+}
+void CBC_CommonByteArray::AppendByte(int32_t value) {
+ if (m_size == 0 || m_index >= m_size) {
+ int32_t newSize = std::max(32, m_size << 1);
+ Reserve(newSize);
+ }
+ m_bytes[m_index] = (uint8_t)value;
+ m_index++;
+}
+void CBC_CommonByteArray::Reserve(int32_t capacity) {
+ if (!m_bytes || m_size < capacity) {
+ uint8_t* newArray = FX_Alloc(uint8_t, capacity);
+ if (m_bytes) {
+ memcpy(newArray, m_bytes, m_size);
+ memset(newArray + m_size, 0, capacity - m_size);
+ } else {
+ memset(newArray, 0, capacity);
+ }
+ FX_Free(m_bytes);
+ m_bytes = newArray;
+ m_size = capacity;
+ }
+}
+void CBC_CommonByteArray::Set(const uint8_t* source,
+ int32_t offset,
+ int32_t count) {
+ FX_Free(m_bytes);
+ m_bytes = FX_Alloc(uint8_t, count);
+ m_size = count;
+ memcpy(m_bytes, source + offset, count);
+ m_index = count;
+}
+void CBC_CommonByteArray::Set(std::vector<uint8_t>* source,
+ int32_t offset,
+ int32_t count) {
+ FX_Free(m_bytes);
+ m_bytes = FX_Alloc(uint8_t, count);
+ m_size = count;
+ int32_t i;
+ for (i = 0; i < count; i++) {
+ m_bytes[i] = source->operator[](i + offset);
+ }
+ m_index = m_size;
+}
diff --git a/chromium/third_party/pdfium/fxbarcode/common/BC_CommonByteArray.h b/chromium/third_party/pdfium/fxbarcode/common/BC_CommonByteArray.h
new file mode 100644
index 00000000000..9270adcf42e
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/common/BC_CommonByteArray.h
@@ -0,0 +1,38 @@
+// 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 FXBARCODE_COMMON_BC_COMMONBYTEARRAY_H_
+#define FXBARCODE_COMMON_BC_COMMONBYTEARRAY_H_
+
+#include <vector>
+
+#include "core/fxcrt/fx_basic.h"
+
+// TODO(weili): The usage of this class should be replaced by
+// std::vector<uint8_t>.
+class CBC_CommonByteArray {
+ public:
+ CBC_CommonByteArray();
+ explicit CBC_CommonByteArray(int32_t size);
+ CBC_CommonByteArray(uint8_t* byteArray, int32_t size);
+ virtual ~CBC_CommonByteArray();
+
+ int32_t At(int32_t index) const;
+ int32_t Size() const;
+ bool IsEmpty() const;
+ void Set(int32_t index, int32_t value);
+ void AppendByte(int32_t value);
+ void Reserve(int32_t capacity);
+ void Set(const uint8_t* source, int32_t offset, int32_t count);
+ void Set(std::vector<uint8_t>* source, int32_t offset, int32_t count);
+
+ private:
+ int32_t m_size;
+ int32_t m_index;
+ uint8_t* m_bytes;
+};
+
+#endif // FXBARCODE_COMMON_BC_COMMONBYTEARRAY_H_
diff --git a/chromium/third_party/pdfium/fxbarcode/common/BC_CommonByteMatrix.cpp b/chromium/third_party/pdfium/fxbarcode/common/BC_CommonByteMatrix.cpp
new file mode 100644
index 00000000000..2ab1e9ac506
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/common/BC_CommonByteMatrix.cpp
@@ -0,0 +1,64 @@
+// 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
+// Original code is licensed as follows:
+/*
+ * Copyright 2008 ZXing authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "core/fxcrt/fx_memory.h"
+#include "fxbarcode/common/BC_CommonByteMatrix.h"
+
+CBC_CommonByteMatrix::CBC_CommonByteMatrix(int32_t width, int32_t height) {
+ m_height = height;
+ m_width = width;
+ m_bytes = nullptr;
+}
+void CBC_CommonByteMatrix::Init() {
+ m_bytes = FX_Alloc2D(uint8_t, m_height, m_width);
+ memset(m_bytes, 0xff, m_height * m_width);
+}
+CBC_CommonByteMatrix::~CBC_CommonByteMatrix() {
+ FX_Free(m_bytes);
+}
+int32_t CBC_CommonByteMatrix::GetHeight() {
+ return m_height;
+}
+int32_t CBC_CommonByteMatrix::GetWidth() {
+ return m_width;
+}
+uint8_t CBC_CommonByteMatrix::Get(int32_t x, int32_t y) {
+ return m_bytes[y * m_width + x];
+}
+void CBC_CommonByteMatrix::Set(int32_t x, int32_t y, int32_t value) {
+ m_bytes[y * m_width + x] = (uint8_t)value;
+}
+void CBC_CommonByteMatrix::Set(int32_t x, int32_t y, uint8_t value) {
+ m_bytes[y * m_width + x] = value;
+}
+void CBC_CommonByteMatrix::clear(uint8_t value) {
+ int32_t y;
+ for (y = 0; y < m_height; y++) {
+ int32_t x;
+ for (x = 0; x < m_width; x++) {
+ m_bytes[y * m_width + x] = value;
+ }
+ }
+}
+uint8_t* CBC_CommonByteMatrix::GetArray() {
+ return m_bytes;
+}
diff --git a/chromium/third_party/pdfium/fxbarcode/common/BC_CommonByteMatrix.h b/chromium/third_party/pdfium/fxbarcode/common/BC_CommonByteMatrix.h
new file mode 100644
index 00000000000..9f13a376d10
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/common/BC_CommonByteMatrix.h
@@ -0,0 +1,35 @@
+// 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 FXBARCODE_COMMON_BC_COMMONBYTEMATRIX_H_
+#define FXBARCODE_COMMON_BC_COMMONBYTEMATRIX_H_
+
+#include <stdint.h>
+
+#include "core/fxcrt/fx_system.h"
+
+class CBC_CommonByteMatrix {
+ public:
+ CBC_CommonByteMatrix(int32_t width, int32_t height);
+ virtual ~CBC_CommonByteMatrix();
+
+ int32_t GetHeight();
+ int32_t GetWidth();
+ uint8_t Get(int32_t x, int32_t y);
+ uint8_t* GetArray();
+
+ void Set(int32_t x, int32_t y, int32_t value);
+ void Set(int32_t x, int32_t y, uint8_t value);
+ void clear(uint8_t value);
+ virtual void Init();
+
+ private:
+ uint8_t* m_bytes;
+ int32_t m_width;
+ int32_t m_height;
+};
+
+#endif // FXBARCODE_COMMON_BC_COMMONBYTEMATRIX_H_
diff --git a/chromium/third_party/pdfium/fxbarcode/common/reedsolomon/BC_ReedSolomon.cpp b/chromium/third_party/pdfium/fxbarcode/common/reedsolomon/BC_ReedSolomon.cpp
new file mode 100644
index 00000000000..ca65f720432
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/common/reedsolomon/BC_ReedSolomon.cpp
@@ -0,0 +1,100 @@
+// 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
+// Original code is licensed as follows:
+/*
+ * Copyright 2007 ZXing authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "fxbarcode/common/reedsolomon/BC_ReedSolomon.h"
+
+#include <memory>
+#include <utility>
+
+#include "fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.h"
+#include "fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.h"
+#include "third_party/base/ptr_util.h"
+
+CBC_ReedSolomonEncoder::CBC_ReedSolomonEncoder(CBC_ReedSolomonGF256* field)
+ : m_field(field) {}
+
+CBC_ReedSolomonEncoder::~CBC_ReedSolomonEncoder() {}
+
+void CBC_ReedSolomonEncoder::Init() {
+ m_cachedGenerators.push_back(
+ pdfium::MakeUnique<CBC_ReedSolomonGF256Poly>(m_field, 1));
+}
+
+CBC_ReedSolomonGF256Poly* CBC_ReedSolomonEncoder::BuildGenerator(
+ size_t degree) {
+ if (degree >= m_cachedGenerators.size()) {
+ CBC_ReedSolomonGF256Poly* lastGenerator = m_cachedGenerators.back().get();
+ for (size_t d = m_cachedGenerators.size(); d <= degree; ++d) {
+ std::vector<int32_t> temp = {1, m_field->Exp(d - 1)};
+ CBC_ReedSolomonGF256Poly temp_poly;
+ if (!temp_poly.Init(m_field, &temp))
+ return nullptr;
+
+ auto nextGenerator = lastGenerator->Multiply(&temp_poly);
+ if (!nextGenerator)
+ return nullptr;
+
+ lastGenerator = nextGenerator.get();
+ m_cachedGenerators.push_back(std::move(nextGenerator));
+ }
+ }
+ return m_cachedGenerators[degree].get();
+}
+
+bool CBC_ReedSolomonEncoder::Encode(std::vector<int32_t>* toEncode,
+ size_t ecBytes) {
+ if (ecBytes == 0)
+ return false;
+
+ if (toEncode->size() <= ecBytes)
+ return false;
+
+ CBC_ReedSolomonGF256Poly* generator = BuildGenerator(ecBytes);
+ if (!generator)
+ return false;
+
+ size_t dataBytes = toEncode->size() - ecBytes;
+ std::vector<int32_t> infoCoefficients(dataBytes);
+ for (size_t x = 0; x < dataBytes; x++)
+ infoCoefficients[x] = (*toEncode)[x];
+
+ CBC_ReedSolomonGF256Poly info;
+ if (!info.Init(m_field, &infoCoefficients))
+ return false;
+
+ auto infoTemp = info.MultiplyByMonomial(ecBytes, 1);
+ if (!infoTemp)
+ return false;
+
+ auto remainder = infoTemp->Divide(generator);
+ if (!remainder)
+ return false;
+
+ const auto& coefficients = remainder->GetCoefficients();
+ size_t numZeroCoefficients =
+ ecBytes > coefficients.size() ? ecBytes - coefficients.size() : 0;
+ for (size_t i = 0; i < numZeroCoefficients; i++)
+ (*toEncode)[dataBytes + i] = 0;
+ for (size_t y = 0; y < coefficients.size(); y++)
+ (*toEncode)[dataBytes + numZeroCoefficients + y] = coefficients[y];
+ return true;
+}
diff --git a/chromium/third_party/pdfium/fxbarcode/common/reedsolomon/BC_ReedSolomon.h b/chromium/third_party/pdfium/fxbarcode/common/reedsolomon/BC_ReedSolomon.h
new file mode 100644
index 00000000000..68d4ee06242
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/common/reedsolomon/BC_ReedSolomon.h
@@ -0,0 +1,33 @@
+// 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 FXBARCODE_COMMON_REEDSOLOMON_BC_REEDSOLOMON_H_
+#define FXBARCODE_COMMON_REEDSOLOMON_BC_REEDSOLOMON_H_
+
+#include <memory>
+#include <vector>
+
+#include "core/fxcrt/fx_basic.h"
+
+class CBC_ReedSolomonGF256;
+class CBC_ReedSolomonGF256Poly;
+
+class CBC_ReedSolomonEncoder {
+ public:
+ explicit CBC_ReedSolomonEncoder(CBC_ReedSolomonGF256* field);
+ ~CBC_ReedSolomonEncoder();
+
+ void Init();
+ bool Encode(std::vector<int32_t>* toEncode, size_t ecBytes);
+
+ private:
+ CBC_ReedSolomonGF256Poly* BuildGenerator(size_t degree);
+
+ CBC_ReedSolomonGF256* const m_field;
+ std::vector<std::unique_ptr<CBC_ReedSolomonGF256Poly>> m_cachedGenerators;
+};
+
+#endif // FXBARCODE_COMMON_REEDSOLOMON_BC_REEDSOLOMON_H_
diff --git a/chromium/third_party/pdfium/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp b/chromium/third_party/pdfium/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp
new file mode 100644
index 00000000000..3f761054c4c
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp
@@ -0,0 +1,136 @@
+// 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
+// Original code is licensed as follows:
+/*
+ * Copyright 2007 ZXing authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.h"
+
+#include <vector>
+
+#include "fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.h"
+#include "third_party/base/ptr_util.h"
+
+CBC_ReedSolomonGF256* CBC_ReedSolomonGF256::QRCodeField = nullptr;
+CBC_ReedSolomonGF256* CBC_ReedSolomonGF256::DataMatrixField = nullptr;
+
+void CBC_ReedSolomonGF256::Initialize() {
+ QRCodeField = new CBC_ReedSolomonGF256(0x011D);
+ QRCodeField->Init();
+ DataMatrixField = new CBC_ReedSolomonGF256(0x012D);
+ DataMatrixField->Init();
+}
+
+void CBC_ReedSolomonGF256::Finalize() {
+ delete QRCodeField;
+ QRCodeField = nullptr;
+ delete DataMatrixField;
+ DataMatrixField = nullptr;
+}
+
+CBC_ReedSolomonGF256::CBC_ReedSolomonGF256(int32_t primitive) {
+ int32_t x = 1;
+ for (int32_t j = 0; j < 256; j++) {
+ m_expTable[j] = x;
+ x <<= 1;
+ if (x >= 0x100) {
+ x ^= primitive;
+ }
+ }
+ for (int32_t i = 0; i < 255; i++) {
+ m_logTable[m_expTable[i]] = i;
+ }
+ m_logTable[0] = 0;
+}
+
+void CBC_ReedSolomonGF256::Init() {
+ m_zero = pdfium::MakeUnique<CBC_ReedSolomonGF256Poly>(this, 0);
+ m_one = pdfium::MakeUnique<CBC_ReedSolomonGF256Poly>(this, 1);
+}
+
+CBC_ReedSolomonGF256::~CBC_ReedSolomonGF256() {}
+
+CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256::GetZero() const {
+ return m_zero.get();
+}
+
+CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256::GetOne() const {
+ return m_one.get();
+}
+
+std::unique_ptr<CBC_ReedSolomonGF256Poly> CBC_ReedSolomonGF256::BuildMonomial(
+ int32_t degree,
+ int32_t coefficient,
+ int32_t& e) {
+ if (degree < 0) {
+ e = BCExceptionDegreeIsNegative;
+ return nullptr;
+ }
+ if (coefficient == 0) {
+ auto temp = m_zero->Clone();
+ if (!temp)
+ e = BCExceptionGeneric;
+ return temp;
+ }
+ std::vector<int32_t> coefficients(degree + 1);
+ coefficients[0] = coefficient;
+ auto temp = pdfium::MakeUnique<CBC_ReedSolomonGF256Poly>();
+ if (!temp->Init(this, &coefficients)) {
+ e = BCExceptionGeneric;
+ return nullptr;
+ }
+ return temp;
+}
+
+int32_t CBC_ReedSolomonGF256::AddOrSubtract(int32_t a, int32_t b) {
+ return a ^ b;
+}
+
+int32_t CBC_ReedSolomonGF256::Exp(int32_t a) {
+ return m_expTable[a];
+}
+
+int32_t CBC_ReedSolomonGF256::Log(int32_t a, int32_t& e) {
+ if (a == 0) {
+ e = BCExceptionAIsZero;
+ return 0;
+ }
+ return m_logTable[a];
+}
+
+int32_t CBC_ReedSolomonGF256::Inverse(int32_t a, int32_t& e) {
+ if (a == 0) {
+ e = BCExceptionAIsZero;
+ return 0;
+ }
+ return m_expTable[255 - m_logTable[a]];
+}
+
+int32_t CBC_ReedSolomonGF256::Multiply(int32_t a, int32_t b) {
+ if (a == 0 || b == 0) {
+ return 0;
+ }
+ if (a == 1) {
+ return b;
+ }
+ if (b == 1) {
+ return a;
+ }
+ return m_expTable[(m_logTable[a] + m_logTable[b]) % 255];
+}
diff --git a/chromium/third_party/pdfium/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.h b/chromium/third_party/pdfium/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.h
new file mode 100644
index 00000000000..6d8225dfb08
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.h
@@ -0,0 +1,47 @@
+// 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 FXBARCODE_COMMON_REEDSOLOMON_BC_REEDSOLOMONGF256_H_
+#define FXBARCODE_COMMON_REEDSOLOMON_BC_REEDSOLOMONGF256_H_
+
+#include <memory>
+
+#include "core/fxcrt/fx_basic.h"
+#include "fxbarcode/utils.h"
+
+class CBC_ReedSolomonGF256Poly;
+
+class CBC_ReedSolomonGF256 {
+ public:
+ explicit CBC_ReedSolomonGF256(int32_t primitive);
+ ~CBC_ReedSolomonGF256();
+
+ static void Initialize();
+ static void Finalize();
+
+ CBC_ReedSolomonGF256Poly* GetZero() const;
+ CBC_ReedSolomonGF256Poly* GetOne() const;
+ std::unique_ptr<CBC_ReedSolomonGF256Poly> BuildMonomial(int32_t degree,
+ int32_t coefficient,
+ int32_t& e);
+ static int32_t AddOrSubtract(int32_t a, int32_t b);
+ int32_t Exp(int32_t a);
+ int32_t Log(int32_t a, int32_t& e);
+ int32_t Inverse(int32_t a, int32_t& e);
+ int32_t Multiply(int32_t a, int32_t b);
+ void Init();
+
+ static CBC_ReedSolomonGF256* QRCodeField;
+ static CBC_ReedSolomonGF256* DataMatrixField;
+
+ private:
+ int32_t m_expTable[256];
+ int32_t m_logTable[256];
+ std::unique_ptr<CBC_ReedSolomonGF256Poly> m_zero;
+ std::unique_ptr<CBC_ReedSolomonGF256Poly> m_one;
+};
+
+#endif // FXBARCODE_COMMON_REEDSOLOMON_BC_REEDSOLOMONGF256_H_
diff --git a/chromium/third_party/pdfium/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp b/chromium/third_party/pdfium/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp
new file mode 100644
index 00000000000..5c26188f53c
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp
@@ -0,0 +1,240 @@
+// 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
+// Original code is licensed as follows:
+/*
+ * Copyright 2007 ZXing authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.h"
+
+#include <memory>
+#include <utility>
+
+#include "fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.h"
+#include "third_party/base/ptr_util.h"
+#include "third_party/base/stl_util.h"
+
+CBC_ReedSolomonGF256Poly::CBC_ReedSolomonGF256Poly(CBC_ReedSolomonGF256* field,
+ int32_t coefficients) {
+ if (!field)
+ return;
+
+ m_field = field;
+ m_coefficients.push_back(coefficients);
+}
+
+CBC_ReedSolomonGF256Poly::CBC_ReedSolomonGF256Poly() {
+ m_field = nullptr;
+}
+
+bool CBC_ReedSolomonGF256Poly::Init(CBC_ReedSolomonGF256* field,
+ const std::vector<int32_t>* coefficients) {
+ if (!coefficients || coefficients->empty())
+ return false;
+
+ m_field = field;
+ size_t coefficientsLength = coefficients->size();
+ if (coefficientsLength > 1 && coefficients->front() == 0) {
+ size_t firstNonZero = 1;
+ while (firstNonZero < coefficientsLength &&
+ (*coefficients)[firstNonZero] == 0) {
+ firstNonZero++;
+ }
+ if (firstNonZero == coefficientsLength) {
+ m_coefficients = m_field->GetZero()->GetCoefficients();
+ } else {
+ m_coefficients.resize(coefficientsLength - firstNonZero);
+ for (size_t i = firstNonZero, j = 0; i < coefficientsLength; i++, j++)
+ m_coefficients[j] = (*coefficients)[i];
+ }
+ } else {
+ m_coefficients = *coefficients;
+ }
+ return true;
+}
+
+const std::vector<int32_t>& CBC_ReedSolomonGF256Poly::GetCoefficients() const {
+ return m_coefficients;
+}
+
+int32_t CBC_ReedSolomonGF256Poly::GetDegree() const {
+ return pdfium::CollectionSize<int32_t>(m_coefficients) - 1;
+}
+
+bool CBC_ReedSolomonGF256Poly::IsZero() const {
+ return m_coefficients.front() == 0;
+}
+
+int32_t CBC_ReedSolomonGF256Poly::GetCoefficients(int32_t degree) const {
+ return m_coefficients[m_coefficients.size() - 1 - degree];
+}
+
+int32_t CBC_ReedSolomonGF256Poly::EvaluateAt(int32_t a) {
+ if (a == 0)
+ return GetCoefficients(0);
+
+ size_t size = m_coefficients.size();
+ if (a == 1) {
+ int32_t result = 0;
+ for (size_t i = 0; i < size; i++)
+ result = CBC_ReedSolomonGF256::AddOrSubtract(result, m_coefficients[i]);
+ return result;
+ }
+ int32_t result = m_coefficients[0];
+ for (size_t j = 1; j < size; j++) {
+ result = CBC_ReedSolomonGF256::AddOrSubtract(m_field->Multiply(a, result),
+ m_coefficients[j]);
+ }
+ return result;
+}
+
+std::unique_ptr<CBC_ReedSolomonGF256Poly> CBC_ReedSolomonGF256Poly::Clone()
+ const {
+ auto temp = pdfium::MakeUnique<CBC_ReedSolomonGF256Poly>();
+ if (!temp->Init(m_field, &m_coefficients))
+ return nullptr;
+ return temp;
+}
+
+std::unique_ptr<CBC_ReedSolomonGF256Poly>
+CBC_ReedSolomonGF256Poly::AddOrSubtract(const CBC_ReedSolomonGF256Poly* other) {
+ if (IsZero())
+ return other->Clone();
+ if (other->IsZero())
+ return Clone();
+
+ std::vector<int32_t> smallerCoefficients = m_coefficients;
+ std::vector<int32_t> largerCoefficients = other->GetCoefficients();
+ if (smallerCoefficients.size() > largerCoefficients.size())
+ std::swap(smallerCoefficients, largerCoefficients);
+
+ std::vector<int32_t> sumDiff(largerCoefficients.size());
+ size_t lengthDiff = largerCoefficients.size() - smallerCoefficients.size();
+ for (size_t i = 0; i < lengthDiff; i++)
+ sumDiff[i] = largerCoefficients[i];
+
+ for (size_t j = lengthDiff; j < largerCoefficients.size(); j++) {
+ sumDiff[j] = CBC_ReedSolomonGF256::AddOrSubtract(
+ smallerCoefficients[j - lengthDiff], largerCoefficients[j]);
+ }
+ auto temp = pdfium::MakeUnique<CBC_ReedSolomonGF256Poly>();
+ if (!temp->Init(m_field, &sumDiff))
+ return nullptr;
+ return temp;
+}
+
+std::unique_ptr<CBC_ReedSolomonGF256Poly> CBC_ReedSolomonGF256Poly::Multiply(
+ const CBC_ReedSolomonGF256Poly* other) {
+ if (IsZero() || other->IsZero())
+ return m_field->GetZero()->Clone();
+
+ const std::vector<int32_t>& aCoefficients = m_coefficients;
+ const std::vector<int32_t>& bCoefficients = other->GetCoefficients();
+ size_t aLength = aCoefficients.size();
+ size_t bLength = bCoefficients.size();
+ std::vector<int32_t> product(aLength + bLength - 1);
+ for (size_t i = 0; i < aLength; i++) {
+ int32_t aCoeff = aCoefficients[i];
+ for (size_t j = 0; j < bLength; j++) {
+ product[i + j] = CBC_ReedSolomonGF256::AddOrSubtract(
+ product[i + j], m_field->Multiply(aCoeff, bCoefficients[j]));
+ }
+ }
+ auto temp = pdfium::MakeUnique<CBC_ReedSolomonGF256Poly>();
+ if (!temp->Init(m_field, &product))
+ return nullptr;
+ return temp;
+}
+
+std::unique_ptr<CBC_ReedSolomonGF256Poly> CBC_ReedSolomonGF256Poly::Multiply(
+ int32_t scalar) {
+ if (scalar == 0)
+ return m_field->GetZero()->Clone();
+ if (scalar == 1)
+ return Clone();
+
+ size_t size = m_coefficients.size();
+ std::vector<int32_t> product(size);
+ for (size_t i = 0; i < size; i++)
+ product[i] = m_field->Multiply(m_coefficients[i], scalar);
+
+ auto temp = pdfium::MakeUnique<CBC_ReedSolomonGF256Poly>();
+ if (!temp->Init(m_field, &product))
+ return nullptr;
+ return temp;
+}
+
+std::unique_ptr<CBC_ReedSolomonGF256Poly>
+CBC_ReedSolomonGF256Poly::MultiplyByMonomial(int32_t degree,
+ int32_t coefficient) const {
+ if (degree < 0)
+ return nullptr;
+ if (coefficient == 0)
+ return m_field->GetZero()->Clone();
+
+ size_t size = m_coefficients.size();
+ std::vector<int32_t> product(size + degree);
+ for (size_t i = 0; i < size; i++)
+ product[i] = m_field->Multiply(m_coefficients[i], coefficient);
+
+ auto temp = pdfium::MakeUnique<CBC_ReedSolomonGF256Poly>();
+ if (!temp->Init(m_field, &product))
+ return nullptr;
+ return temp;
+}
+
+std::unique_ptr<CBC_ReedSolomonGF256Poly> CBC_ReedSolomonGF256Poly::Divide(
+ const CBC_ReedSolomonGF256Poly* other) {
+ if (other->IsZero())
+ return nullptr;
+
+ auto quotient = m_field->GetZero()->Clone();
+ if (!quotient)
+ return nullptr;
+ auto remainder = Clone();
+ if (!remainder)
+ return nullptr;
+
+ int e = BCExceptionNO;
+ int32_t denominatorLeadingTerm = other->GetCoefficients(other->GetDegree());
+ int32_t inverseDenominatorLeadingTeam =
+ m_field->Inverse(denominatorLeadingTerm, e);
+ if (e != BCExceptionNO)
+ return nullptr;
+ while (remainder->GetDegree() >= other->GetDegree() && !remainder->IsZero()) {
+ int32_t degreeDifference = remainder->GetDegree() - other->GetDegree();
+ int32_t scale =
+ m_field->Multiply(remainder->GetCoefficients((remainder->GetDegree())),
+ inverseDenominatorLeadingTeam);
+ auto term = other->MultiplyByMonomial(degreeDifference, scale);
+ if (!term)
+ return nullptr;
+ auto iteratorQuotient = m_field->BuildMonomial(degreeDifference, scale, e);
+ if (e != BCExceptionNO)
+ return nullptr;
+ quotient = quotient->AddOrSubtract(iteratorQuotient.get());
+ if (!quotient)
+ return nullptr;
+ remainder = remainder->AddOrSubtract(term.get());
+ if (!remainder)
+ return nullptr;
+ }
+ return remainder;
+}
+
+CBC_ReedSolomonGF256Poly::~CBC_ReedSolomonGF256Poly() {}
diff --git a/chromium/third_party/pdfium/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.h b/chromium/third_party/pdfium/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.h
new file mode 100644
index 00000000000..ce8a5727048
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.h
@@ -0,0 +1,47 @@
+// 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 FXBARCODE_COMMON_REEDSOLOMON_BC_REEDSOLOMONGF256POLY_H_
+#define FXBARCODE_COMMON_REEDSOLOMON_BC_REEDSOLOMONGF256POLY_H_
+
+#include <memory>
+#include <vector>
+
+#include "core/fxcrt/fx_basic.h"
+
+class CBC_ReedSolomonGF256;
+
+class CBC_ReedSolomonGF256Poly final {
+ public:
+ CBC_ReedSolomonGF256Poly(CBC_ReedSolomonGF256* field, int32_t coefficients);
+ CBC_ReedSolomonGF256Poly();
+ ~CBC_ReedSolomonGF256Poly();
+ bool Init(CBC_ReedSolomonGF256* field,
+ const std::vector<int32_t>* coefficients);
+
+ int32_t GetCoefficients(int32_t degree) const;
+ const std::vector<int32_t>& GetCoefficients() const;
+ int32_t GetDegree() const;
+ bool IsZero() const;
+ int32_t EvaluateAt(int32_t a);
+ std::unique_ptr<CBC_ReedSolomonGF256Poly> AddOrSubtract(
+ const CBC_ReedSolomonGF256Poly* other);
+ std::unique_ptr<CBC_ReedSolomonGF256Poly> Multiply(
+ const CBC_ReedSolomonGF256Poly* other);
+ std::unique_ptr<CBC_ReedSolomonGF256Poly> Multiply(int32_t scalar);
+ std::unique_ptr<CBC_ReedSolomonGF256Poly> MultiplyByMonomial(
+ int32_t degree,
+ int32_t coefficient) const;
+ std::unique_ptr<CBC_ReedSolomonGF256Poly> Divide(
+ const CBC_ReedSolomonGF256Poly* other);
+ std::unique_ptr<CBC_ReedSolomonGF256Poly> Clone() const;
+
+ private:
+ CBC_ReedSolomonGF256* m_field;
+ std::vector<int32_t> m_coefficients;
+};
+
+#endif // FXBARCODE_COMMON_REEDSOLOMON_BC_REEDSOLOMONGF256POLY_H_
diff --git a/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_ASCIIEncoder.cpp b/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_ASCIIEncoder.cpp
new file mode 100644
index 00000000000..2d7b9d7995d
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_ASCIIEncoder.cpp
@@ -0,0 +1,97 @@
+// 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
+// Original code is licensed as follows:
+/*
+ * Copyright 2006-2007 Jeremias Maerki.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "fxbarcode/BC_Dimension.h"
+#include "fxbarcode/datamatrix/BC_ASCIIEncoder.h"
+#include "fxbarcode/datamatrix/BC_Encoder.h"
+#include "fxbarcode/datamatrix/BC_EncoderContext.h"
+#include "fxbarcode/datamatrix/BC_HighLevelEncoder.h"
+#include "fxbarcode/datamatrix/BC_SymbolInfo.h"
+#include "fxbarcode/datamatrix/BC_SymbolShapeHint.h"
+
+CBC_ASCIIEncoder::CBC_ASCIIEncoder() {}
+CBC_ASCIIEncoder::~CBC_ASCIIEncoder() {}
+int32_t CBC_ASCIIEncoder::getEncodingMode() {
+ return ASCII_ENCODATION;
+}
+void CBC_ASCIIEncoder::Encode(CBC_EncoderContext& context, int32_t& e) {
+ int32_t n = CBC_HighLevelEncoder::determineConsecutiveDigitCount(
+ context.m_msg, context.m_pos);
+ if (n >= 2) {
+ wchar_t code = encodeASCIIDigits(context.m_msg.GetAt(context.m_pos),
+ context.m_msg.GetAt(context.m_pos + 1), e);
+ if (e != BCExceptionNO) {
+ return;
+ }
+ context.writeCodeword(code);
+ context.m_pos += 2;
+ } else {
+ wchar_t c = context.getCurrentChar();
+ int32_t newMode = CBC_HighLevelEncoder::lookAheadTest(
+ context.m_msg, context.m_pos, getEncodingMode());
+ if (newMode != getEncodingMode()) {
+ switch (newMode) {
+ case BASE256_ENCODATION:
+ context.writeCodeword(CBC_HighLevelEncoder::LATCH_TO_BASE256);
+ context.signalEncoderChange(BASE256_ENCODATION);
+ return;
+ case C40_ENCODATION:
+ context.writeCodeword(CBC_HighLevelEncoder::LATCH_TO_C40);
+ context.signalEncoderChange(C40_ENCODATION);
+ return;
+ case X12_ENCODATION:
+ context.writeCodeword(CBC_HighLevelEncoder::LATCH_TO_ANSIX12);
+ context.signalEncoderChange(X12_ENCODATION);
+ break;
+ case TEXT_ENCODATION:
+ context.writeCodeword(CBC_HighLevelEncoder::LATCH_TO_TEXT);
+ context.signalEncoderChange(TEXT_ENCODATION);
+ break;
+ case EDIFACT_ENCODATION:
+ context.writeCodeword(CBC_HighLevelEncoder::LATCH_TO_EDIFACT);
+ context.signalEncoderChange(EDIFACT_ENCODATION);
+ break;
+ default:
+ e = BCExceptionIllegalStateIllegalMode;
+ return;
+ }
+ } else if (CBC_HighLevelEncoder::isExtendedASCII(c)) {
+ context.writeCodeword(CBC_HighLevelEncoder::UPPER_SHIFT);
+ context.writeCodeword((wchar_t)(c - 128 + 1));
+ context.m_pos++;
+ } else {
+ context.writeCodeword((wchar_t)(c + 1));
+ context.m_pos++;
+ }
+ }
+}
+wchar_t CBC_ASCIIEncoder::encodeASCIIDigits(wchar_t digit1,
+ wchar_t digit2,
+ int32_t& e) {
+ if (CBC_HighLevelEncoder::isDigit(digit1) &&
+ CBC_HighLevelEncoder::isDigit(digit2)) {
+ int32_t num = (digit1 - 48) * 10 + (digit2 - 48);
+ return (wchar_t)(num + 130);
+ }
+ e = BCExceptionIllegalArgumentNotGigits;
+ return 0;
+}
diff --git a/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_ASCIIEncoder.h b/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_ASCIIEncoder.h
new file mode 100644
index 00000000000..6eb3a50669d
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_ASCIIEncoder.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 FXBARCODE_DATAMATRIX_BC_ASCIIENCODER_H_
+#define FXBARCODE_DATAMATRIX_BC_ASCIIENCODER_H_
+
+#include "fxbarcode/datamatrix/BC_Encoder.h"
+
+class CBC_EncoderContext;
+
+class CBC_ASCIIEncoder : public CBC_Encoder {
+ public:
+ CBC_ASCIIEncoder();
+ ~CBC_ASCIIEncoder() override;
+
+ // CBC_Encoder
+ int32_t getEncodingMode() override;
+ void Encode(CBC_EncoderContext& context, int32_t& e) override;
+
+ private:
+ static wchar_t encodeASCIIDigits(wchar_t digit1, wchar_t digit2, int32_t& e);
+};
+
+#endif // FXBARCODE_DATAMATRIX_BC_ASCIIENCODER_H_
diff --git a/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_Base256Encoder.cpp b/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_Base256Encoder.cpp
new file mode 100644
index 00000000000..1b8db85bdd9
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_Base256Encoder.cpp
@@ -0,0 +1,87 @@
+// 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
+// Original code is licensed as follows:
+/*
+ * Copyright 2006-2007 Jeremias Maerki.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "fxbarcode/BC_Dimension.h"
+#include "fxbarcode/datamatrix/BC_Base256Encoder.h"
+#include "fxbarcode/datamatrix/BC_Encoder.h"
+#include "fxbarcode/datamatrix/BC_EncoderContext.h"
+#include "fxbarcode/datamatrix/BC_HighLevelEncoder.h"
+#include "fxbarcode/datamatrix/BC_SymbolInfo.h"
+#include "fxbarcode/datamatrix/BC_SymbolShapeHint.h"
+
+CBC_Base256Encoder::CBC_Base256Encoder() {}
+CBC_Base256Encoder::~CBC_Base256Encoder() {}
+int32_t CBC_Base256Encoder::getEncodingMode() {
+ return BASE256_ENCODATION;
+}
+void CBC_Base256Encoder::Encode(CBC_EncoderContext& context, int32_t& e) {
+ CFX_WideString buffer;
+ buffer += (wchar_t)'\0';
+ while (context.hasMoreCharacters()) {
+ wchar_t c = context.getCurrentChar();
+ buffer += c;
+ context.m_pos++;
+ int32_t newMode = CBC_HighLevelEncoder::lookAheadTest(
+ context.m_msg, context.m_pos, getEncodingMode());
+ if (newMode != getEncodingMode()) {
+ context.signalEncoderChange(newMode);
+ break;
+ }
+ }
+ int32_t dataCount = buffer.GetLength() - 1;
+ char buf[128];
+ FXSYS_itoa(dataCount, buf, 10);
+ buffer.SetAt(0, wchar_t(*buf) - '0');
+ int32_t lengthFieldSize = 1;
+ int32_t currentSize =
+ context.getCodewordCount() + dataCount + lengthFieldSize;
+ context.updateSymbolInfo(currentSize, e);
+ if (e != BCExceptionNO) {
+ return;
+ }
+ bool mustPad = (context.m_symbolInfo->m_dataCapacity - currentSize) > 0;
+ if (context.hasMoreCharacters() || mustPad) {
+ if (dataCount <= 249) {
+ buffer.SetAt(0, (wchar_t)dataCount);
+ } else if (dataCount > 249 && dataCount <= 1555) {
+ buffer.SetAt(0, (wchar_t)((dataCount / 250) + 249));
+ buffer.Insert(1, (wchar_t)(dataCount % 250));
+ } else {
+ e = BCExceptionIllegalStateMessageLengthInvalid;
+ return;
+ }
+ }
+ for (int32_t i = 0, c = buffer.GetLength(); i < c; i++) {
+ context.writeCodeword(
+ randomize255State(buffer.GetAt(i), context.getCodewordCount() + 1));
+ }
+}
+wchar_t CBC_Base256Encoder::randomize255State(wchar_t ch,
+ int32_t codewordPosition) {
+ int32_t pseudoRandom = ((149 * codewordPosition) % 255) + 1;
+ int32_t tempVariable = ch + pseudoRandom;
+ if (tempVariable <= 255) {
+ return (wchar_t)tempVariable;
+ } else {
+ return (wchar_t)(tempVariable - 256);
+ }
+}
diff --git a/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_Base256Encoder.h b/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_Base256Encoder.h
new file mode 100644
index 00000000000..65abf596623
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_Base256Encoder.h
@@ -0,0 +1,25 @@
+// 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 FXBARCODE_DATAMATRIX_BC_BASE256ENCODER_H_
+#define FXBARCODE_DATAMATRIX_BC_BASE256ENCODER_H_
+
+#include "fxbarcode/datamatrix/BC_Encoder.h"
+
+class CBC_Base256Encoder : public CBC_Encoder {
+ public:
+ CBC_Base256Encoder();
+ ~CBC_Base256Encoder() override;
+
+ // CBC_Encoder
+ int32_t getEncodingMode() override;
+ void Encode(CBC_EncoderContext& context, int32_t& e) override;
+
+ private:
+ static wchar_t randomize255State(wchar_t ch, int32_t codewordPosition);
+};
+
+#endif // FXBARCODE_DATAMATRIX_BC_BASE256ENCODER_H_
diff --git a/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_C40Encoder.cpp b/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_C40Encoder.cpp
new file mode 100644
index 00000000000..7c3f4e7d7a0
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_C40Encoder.cpp
@@ -0,0 +1,200 @@
+// 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
+// Original code is licensed as follows:
+/*
+ * Copyright 2006-2007 Jeremias Maerki.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "fxbarcode/BC_Dimension.h"
+#include "fxbarcode/common/BC_CommonBitMatrix.h"
+#include "fxbarcode/datamatrix/BC_C40Encoder.h"
+#include "fxbarcode/datamatrix/BC_Encoder.h"
+#include "fxbarcode/datamatrix/BC_EncoderContext.h"
+#include "fxbarcode/datamatrix/BC_HighLevelEncoder.h"
+#include "fxbarcode/datamatrix/BC_SymbolInfo.h"
+#include "fxbarcode/datamatrix/BC_SymbolShapeHint.h"
+
+CBC_C40Encoder::CBC_C40Encoder() {}
+CBC_C40Encoder::~CBC_C40Encoder() {}
+int32_t CBC_C40Encoder::getEncodingMode() {
+ return C40_ENCODATION;
+}
+void CBC_C40Encoder::Encode(CBC_EncoderContext& context, int32_t& e) {
+ CFX_WideString buffer;
+ while (context.hasMoreCharacters()) {
+ wchar_t c = context.getCurrentChar();
+ context.m_pos++;
+ int32_t lastCharSize = encodeChar(c, buffer, e);
+ if (e != BCExceptionNO) {
+ return;
+ }
+ int32_t unwritten = (buffer.GetLength() / 3) * 2;
+ int32_t curCodewordCount = context.getCodewordCount() + unwritten;
+ context.updateSymbolInfo(curCodewordCount, e);
+ if (e != BCExceptionNO) {
+ return;
+ }
+ int32_t available = context.m_symbolInfo->m_dataCapacity - curCodewordCount;
+ if (!context.hasMoreCharacters()) {
+ CFX_WideString removed;
+ if ((buffer.GetLength() % 3) == 2) {
+ if (available < 2 || available > 2) {
+ lastCharSize =
+ backtrackOneCharacter(context, buffer, removed, lastCharSize, e);
+ if (e != BCExceptionNO) {
+ return;
+ }
+ }
+ }
+ while ((buffer.GetLength() % 3) == 1 &&
+ ((lastCharSize <= 3 && available != 1) || lastCharSize > 3)) {
+ lastCharSize =
+ backtrackOneCharacter(context, buffer, removed, lastCharSize, e);
+ if (e != BCExceptionNO) {
+ return;
+ }
+ }
+ break;
+ }
+ int32_t count = buffer.GetLength();
+ if ((count % 3) == 0) {
+ int32_t newMode = CBC_HighLevelEncoder::lookAheadTest(
+ context.m_msg, context.m_pos, getEncodingMode());
+ if (newMode != getEncodingMode()) {
+ context.signalEncoderChange(newMode);
+ break;
+ }
+ }
+ }
+ handleEOD(context, buffer, e);
+}
+void CBC_C40Encoder::writeNextTriplet(CBC_EncoderContext& context,
+ CFX_WideString& buffer) {
+ context.writeCodewords(encodeToCodewords(buffer, 0));
+ buffer.Delete(0, 3);
+}
+void CBC_C40Encoder::handleEOD(CBC_EncoderContext& context,
+ CFX_WideString& buffer,
+ int32_t& e) {
+ int32_t unwritten = (buffer.GetLength() / 3) * 2;
+ int32_t rest = buffer.GetLength() % 3;
+ int32_t curCodewordCount = context.getCodewordCount() + unwritten;
+ context.updateSymbolInfo(curCodewordCount, e);
+ if (e != BCExceptionNO) {
+ return;
+ }
+ int32_t available = context.m_symbolInfo->m_dataCapacity - curCodewordCount;
+ if (rest == 2) {
+ buffer += (wchar_t)'\0';
+ while (buffer.GetLength() >= 3) {
+ writeNextTriplet(context, buffer);
+ }
+ if (context.hasMoreCharacters()) {
+ context.writeCodeword(CBC_HighLevelEncoder::C40_UNLATCH);
+ }
+ } else if (available == 1 && rest == 1) {
+ while (buffer.GetLength() >= 3) {
+ writeNextTriplet(context, buffer);
+ }
+ if (context.hasMoreCharacters()) {
+ context.writeCodeword(CBC_HighLevelEncoder::C40_UNLATCH);
+ }
+ context.m_pos--;
+ } else if (rest == 0) {
+ while (buffer.GetLength() >= 3) {
+ writeNextTriplet(context, buffer);
+ }
+ if (available > 0 || context.hasMoreCharacters()) {
+ context.writeCodeword(CBC_HighLevelEncoder::C40_UNLATCH);
+ }
+ } else {
+ e = BCExceptionIllegalStateUnexpectedCase;
+ return;
+ }
+ context.signalEncoderChange(ASCII_ENCODATION);
+}
+int32_t CBC_C40Encoder::encodeChar(wchar_t c, CFX_WideString& sb, int32_t& e) {
+ if (c == ' ') {
+ sb += (wchar_t)'\3';
+ return 1;
+ } else if ((c >= '0') && (c <= '9')) {
+ sb += (wchar_t)(c - 48 + 4);
+ return 1;
+ } else if ((c >= 'A') && (c <= 'Z')) {
+ sb += (wchar_t)(c - 65 + 14);
+ return 1;
+ } else if (c <= 0x1f) {
+ sb += (wchar_t)'\0';
+ sb += c;
+ return 2;
+ } else if ((c >= '!') && (c <= '/')) {
+ sb += (wchar_t)'\1';
+ sb += (wchar_t)(c - 33);
+ return 2;
+ } else if ((c >= ':') && (c <= '@')) {
+ sb += (wchar_t)'\1';
+ sb += (wchar_t)(c - 58 + 15);
+ return 2;
+ } else if ((c >= '[') && (c <= '_')) {
+ sb += (wchar_t)'\1';
+ sb += (wchar_t)(c - 91 + 22);
+ return 2;
+ } else if ((c >= 60) && (c <= 0x7f)) {
+ sb += (wchar_t)'\2';
+ sb += (wchar_t)(c - 96);
+ return 2;
+ } else if (c >= 80) {
+ sb += (wchar_t)'\1';
+ sb += (wchar_t)0x001e;
+ int32_t len = 2;
+ len += encodeChar((c - 128), sb, e);
+ if (e != BCExceptionNO)
+ return 0;
+ return len;
+ } else {
+ e = BCExceptionIllegalArgument;
+ return 0;
+ }
+}
+int32_t CBC_C40Encoder::backtrackOneCharacter(CBC_EncoderContext& context,
+ CFX_WideString& buffer,
+ CFX_WideString& removed,
+ int32_t lastCharSize,
+ int32_t& e) {
+ int32_t count = buffer.GetLength();
+ buffer.Delete(count - lastCharSize, count);
+ context.m_pos--;
+ wchar_t c = context.getCurrentChar();
+ lastCharSize = encodeChar(c, removed, e);
+ if (e != BCExceptionNO)
+ return -1;
+ context.resetSymbolInfo();
+ return lastCharSize;
+}
+CFX_WideString CBC_C40Encoder::encodeToCodewords(CFX_WideString sb,
+ int32_t startPos) {
+ wchar_t c1 = sb.GetAt(startPos);
+ wchar_t c2 = sb.GetAt(startPos + 1);
+ wchar_t c3 = sb.GetAt(startPos + 2);
+ int32_t v = (1600 * c1) + (40 * c2) + c3 + 1;
+ wchar_t cw1 = (wchar_t)(v / 256);
+ wchar_t cw2 = (wchar_t)(v % 256);
+ CFX_WideString b1(cw1);
+ CFX_WideString b2(cw2);
+ return b1 + b2;
+}
diff --git a/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_C40Encoder.h b/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_C40Encoder.h
new file mode 100644
index 00000000000..217404913e0
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_C40Encoder.h
@@ -0,0 +1,38 @@
+// 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 FXBARCODE_DATAMATRIX_BC_C40ENCODER_H_
+#define FXBARCODE_DATAMATRIX_BC_C40ENCODER_H_
+
+#include "fxbarcode/datamatrix/BC_Encoder.h"
+
+class CBC_C40Encoder : public CBC_Encoder {
+ public:
+ CBC_C40Encoder();
+ ~CBC_C40Encoder() override;
+
+ // CBC_Encoder
+ int32_t getEncodingMode() override;
+ void Encode(CBC_EncoderContext& context, int32_t& e) override;
+
+ static void writeNextTriplet(CBC_EncoderContext& context,
+ CFX_WideString& buffer);
+
+ virtual void handleEOD(CBC_EncoderContext& context,
+ CFX_WideString& buffer,
+ int32_t& e);
+ virtual int32_t encodeChar(wchar_t c, CFX_WideString& sb, int32_t& e);
+
+ private:
+ int32_t backtrackOneCharacter(CBC_EncoderContext& context,
+ CFX_WideString& buffer,
+ CFX_WideString& removed,
+ int32_t lastCharSize,
+ int32_t& e);
+ static CFX_WideString encodeToCodewords(CFX_WideString sb, int32_t startPos);
+};
+
+#endif // FXBARCODE_DATAMATRIX_BC_C40ENCODER_H_
diff --git a/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_DataMatrixSymbolInfo144.cpp b/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_DataMatrixSymbolInfo144.cpp
new file mode 100644
index 00000000000..d0ccfc2f1e1
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_DataMatrixSymbolInfo144.cpp
@@ -0,0 +1,40 @@
+// 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
+// Original code is licensed as follows:
+/*
+ * Copyright 2006 Jeremias Maerki
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "fxbarcode/datamatrix/BC_DataMatrixSymbolInfo144.h"
+#include "fxbarcode/datamatrix/BC_Encoder.h"
+#include "fxbarcode/datamatrix/BC_SymbolInfo.h"
+#include "fxbarcode/datamatrix/BC_SymbolShapeHint.h"
+
+CBC_DataMatrixSymbolInfo144::CBC_DataMatrixSymbolInfo144()
+ : CBC_SymbolInfo(false, 1558, 620, 22, 22, 36) {
+ m_rsBlockData = -1;
+ m_rsBlockError = 62;
+}
+CBC_DataMatrixSymbolInfo144::~CBC_DataMatrixSymbolInfo144() {}
+int32_t CBC_DataMatrixSymbolInfo144::getInterleavedBlockCount() {
+ return 10;
+}
+int32_t CBC_DataMatrixSymbolInfo144getDataLengthForInterleavedBlock(
+ int32_t index) {
+ return (index <= 8) ? 156 : 155;
+}
diff --git a/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_DataMatrixSymbolInfo144.h b/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_DataMatrixSymbolInfo144.h
new file mode 100644
index 00000000000..18ef9791418
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_DataMatrixSymbolInfo144.h
@@ -0,0 +1,20 @@
+// 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 FXBARCODE_DATAMATRIX_BC_DATAMATRIXSYMBOLINFO144_H_
+#define FXBARCODE_DATAMATRIX_BC_DATAMATRIXSYMBOLINFO144_H_
+
+#include "fxbarcode/datamatrix/BC_SymbolInfo.h"
+
+class CBC_DataMatrixSymbolInfo144 : public CBC_SymbolInfo {
+ public:
+ CBC_DataMatrixSymbolInfo144();
+ ~CBC_DataMatrixSymbolInfo144() override;
+
+ int32_t getInterleavedBlockCount();
+};
+
+#endif // FXBARCODE_DATAMATRIX_BC_DATAMATRIXSYMBOLINFO144_H_
diff --git a/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_DataMatrixWriter.cpp b/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_DataMatrixWriter.cpp
new file mode 100644
index 00000000000..0dcba849796
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_DataMatrixWriter.cpp
@@ -0,0 +1,143 @@
+// 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
+// Original code is licensed as follows:
+/*
+ * Copyright 2008 ZXing authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "fxbarcode/BC_Dimension.h"
+#include "fxbarcode/BC_TwoDimWriter.h"
+#include "fxbarcode/BC_UtilCodingConvert.h"
+#include "fxbarcode/BC_Writer.h"
+#include "fxbarcode/common/BC_CommonBitMatrix.h"
+#include "fxbarcode/common/BC_CommonByteMatrix.h"
+#include "fxbarcode/datamatrix/BC_ASCIIEncoder.h"
+#include "fxbarcode/datamatrix/BC_Base256Encoder.h"
+#include "fxbarcode/datamatrix/BC_C40Encoder.h"
+#include "fxbarcode/datamatrix/BC_DataMatrixSymbolInfo144.h"
+#include "fxbarcode/datamatrix/BC_DataMatrixWriter.h"
+#include "fxbarcode/datamatrix/BC_DefaultPlacement.h"
+#include "fxbarcode/datamatrix/BC_EdifactEncoder.h"
+#include "fxbarcode/datamatrix/BC_Encoder.h"
+#include "fxbarcode/datamatrix/BC_EncoderContext.h"
+#include "fxbarcode/datamatrix/BC_ErrorCorrection.h"
+#include "fxbarcode/datamatrix/BC_HighLevelEncoder.h"
+#include "fxbarcode/datamatrix/BC_SymbolInfo.h"
+#include "fxbarcode/datamatrix/BC_SymbolShapeHint.h"
+#include "fxbarcode/datamatrix/BC_TextEncoder.h"
+#include "fxbarcode/datamatrix/BC_X12Encoder.h"
+
+CBC_DataMatrixWriter::CBC_DataMatrixWriter() {}
+CBC_DataMatrixWriter::~CBC_DataMatrixWriter() {}
+bool CBC_DataMatrixWriter::SetErrorCorrectionLevel(int32_t level) {
+ m_iCorrectLevel = level;
+ return true;
+}
+uint8_t* CBC_DataMatrixWriter::Encode(const CFX_WideString& contents,
+ int32_t& outWidth,
+ int32_t& outHeight,
+ int32_t& e) {
+ if (outWidth < 0 || outHeight < 0) {
+ e = BCExceptionHeightAndWidthMustBeAtLeast1;
+ return nullptr;
+ }
+ CBC_SymbolShapeHint::SymbolShapeHint shape =
+ CBC_SymbolShapeHint::FORCE_SQUARE;
+ CBC_Dimension* minSize = nullptr;
+ CBC_Dimension* maxSize = nullptr;
+ CFX_WideString ecLevel;
+ CFX_WideString encoded = CBC_HighLevelEncoder::encodeHighLevel(
+ contents, ecLevel, shape, minSize, maxSize, e);
+ if (e != BCExceptionNO)
+ return nullptr;
+ CBC_SymbolInfo* symbolInfo = CBC_SymbolInfo::lookup(
+ encoded.GetLength(), shape, minSize, maxSize, true, e);
+ if (e != BCExceptionNO)
+ return nullptr;
+ CFX_WideString codewords =
+ CBC_ErrorCorrection::encodeECC200(encoded, symbolInfo, e);
+ if (e != BCExceptionNO)
+ return nullptr;
+ CBC_DefaultPlacement* placement =
+ new CBC_DefaultPlacement(codewords, symbolInfo->getSymbolDataWidth(e),
+ symbolInfo->getSymbolDataHeight(e));
+ if (e != BCExceptionNO)
+ return nullptr;
+ placement->place();
+ CBC_CommonByteMatrix* bytematrix = encodeLowLevel(placement, symbolInfo, e);
+ if (e != BCExceptionNO)
+ return nullptr;
+ outWidth = bytematrix->GetWidth();
+ outHeight = bytematrix->GetHeight();
+ uint8_t* result = FX_Alloc2D(uint8_t, outWidth, outHeight);
+ memcpy(result, bytematrix->GetArray(), outWidth * outHeight);
+ delete bytematrix;
+ delete placement;
+ return result;
+}
+CBC_CommonByteMatrix* CBC_DataMatrixWriter::encodeLowLevel(
+ CBC_DefaultPlacement* placement,
+ CBC_SymbolInfo* symbolInfo,
+ int32_t& e) {
+ int32_t symbolWidth = symbolInfo->getSymbolDataWidth(e);
+ if (e != BCExceptionNO)
+ return nullptr;
+ int32_t symbolHeight = symbolInfo->getSymbolDataHeight(e);
+ if (e != BCExceptionNO)
+ return nullptr;
+ CBC_CommonByteMatrix* matrix = new CBC_CommonByteMatrix(
+ symbolInfo->getSymbolWidth(e), symbolInfo->getSymbolHeight(e));
+ if (e != BCExceptionNO)
+ return nullptr;
+ matrix->Init();
+ int32_t matrixY = 0;
+ for (int32_t y = 0; y < symbolHeight; y++) {
+ int32_t matrixX;
+ if ((y % symbolInfo->m_matrixHeight) == 0) {
+ matrixX = 0;
+ for (int32_t x = 0; x < symbolInfo->getSymbolWidth(e); x++) {
+ matrix->Set(matrixX, matrixY, (x % 2) == 0);
+ matrixX++;
+ }
+ matrixY++;
+ }
+ matrixX = 0;
+ for (int32_t x = 0; x < symbolWidth; x++) {
+ if ((x % symbolInfo->m_matrixWidth) == 0) {
+ matrix->Set(matrixX, matrixY, true);
+ matrixX++;
+ }
+ matrix->Set(matrixX, matrixY, placement->getBit(x, y));
+ matrixX++;
+ if ((x % symbolInfo->m_matrixWidth) == symbolInfo->m_matrixWidth - 1) {
+ matrix->Set(matrixX, matrixY, (y % 2) == 0);
+ matrixX++;
+ }
+ }
+ matrixY++;
+ if ((y % symbolInfo->m_matrixHeight) == symbolInfo->m_matrixHeight - 1) {
+ matrixX = 0;
+ for (int32_t x = 0; x < symbolInfo->getSymbolWidth(e); x++) {
+ matrix->Set(matrixX, matrixY, true);
+ matrixX++;
+ }
+ matrixY++;
+ }
+ }
+ return matrix;
+}
diff --git a/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_DataMatrixWriter.h b/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_DataMatrixWriter.h
new file mode 100644
index 00000000000..cf5f6e4c4d9
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_DataMatrixWriter.h
@@ -0,0 +1,36 @@
+// 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 FXBARCODE_DATAMATRIX_BC_DATAMATRIXWRITER_H_
+#define FXBARCODE_DATAMATRIX_BC_DATAMATRIXWRITER_H_
+
+#include "fxbarcode/BC_TwoDimWriter.h"
+
+class CBC_CommonByteMatrix;
+class CBC_DefaultPlacement;
+class CBC_SymbolInfo;
+
+class CBC_DataMatrixWriter : public CBC_TwoDimWriter {
+ public:
+ CBC_DataMatrixWriter();
+ ~CBC_DataMatrixWriter() override;
+
+ virtual uint8_t* Encode(const CFX_WideString& contents,
+ int32_t& outWidth,
+ int32_t& outHeight,
+ int32_t& e);
+
+ // CBC_TwoDimWriter
+ bool SetErrorCorrectionLevel(int32_t level) override;
+
+ private:
+ static CBC_CommonByteMatrix* encodeLowLevel(CBC_DefaultPlacement* placement,
+ CBC_SymbolInfo* symbolInfo,
+ int32_t& e);
+ int32_t m_iCorrectLevel;
+};
+
+#endif // FXBARCODE_DATAMATRIX_BC_DATAMATRIXWRITER_H_
diff --git a/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_DefaultPlacement.cpp b/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_DefaultPlacement.cpp
new file mode 100644
index 00000000000..405b4f72a17
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_DefaultPlacement.cpp
@@ -0,0 +1,163 @@
+// 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
+// Original code is licensed as follows:
+/*
+ * Copyright 2006 Jeremias Maerki.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "fxbarcode/datamatrix/BC_DefaultPlacement.h"
+#include "fxbarcode/datamatrix/BC_Encoder.h"
+
+CBC_DefaultPlacement::CBC_DefaultPlacement(CFX_WideString codewords,
+ int32_t numcols,
+ int32_t numrows) {
+ m_codewords = codewords;
+ m_numcols = numcols;
+ m_numrows = numrows;
+ m_bits.resize(numcols * numrows);
+ for (int32_t i = 0; i < numcols * numrows; i++) {
+ m_bits[i] = (uint8_t)2;
+ }
+}
+CBC_DefaultPlacement::~CBC_DefaultPlacement() {}
+
+int32_t CBC_DefaultPlacement::getNumrows() {
+ return m_numrows;
+}
+int32_t CBC_DefaultPlacement::getNumcols() {
+ return m_numcols;
+}
+std::vector<uint8_t>& CBC_DefaultPlacement::getBits() {
+ return m_bits;
+}
+bool CBC_DefaultPlacement::getBit(int32_t col, int32_t row) {
+ return m_bits[row * m_numcols + col] == 1;
+}
+void CBC_DefaultPlacement::setBit(int32_t col, int32_t row, bool bit) {
+ m_bits[row * m_numcols + col] = bit ? (uint8_t)1 : (uint8_t)0;
+}
+bool CBC_DefaultPlacement::hasBit(int32_t col, int32_t row) {
+ return m_bits[row * m_numcols + col] != 2;
+}
+void CBC_DefaultPlacement::place() {
+ int32_t pos = 0;
+ int32_t row = 4;
+ int32_t col = 0;
+ do {
+ if ((row == m_numrows) && (col == 0)) {
+ corner1(pos++);
+ }
+ if ((row == m_numrows - 2) && (col == 0) && ((m_numcols % 4) != 0)) {
+ corner2(pos++);
+ }
+ if ((row == m_numrows - 2) && (col == 0) && (m_numcols % 8 == 4)) {
+ corner3(pos++);
+ }
+ if ((row == m_numrows + 4) && (col == 2) && ((m_numcols % 8) == 0)) {
+ corner4(pos++);
+ }
+ do {
+ if ((row < m_numrows) && (col >= 0) && !hasBit(col, row)) {
+ utah(row, col, pos++);
+ }
+ row -= 2;
+ col += 2;
+ } while (row >= 0 && (col < m_numcols));
+ row++;
+ col += 3;
+ do {
+ if ((row >= 0) && (col < m_numcols) && !hasBit(col, row)) {
+ utah(row, col, pos++);
+ }
+ row += 2;
+ col -= 2;
+ } while ((row < m_numrows) && (col >= 0));
+ row += 3;
+ col++;
+ } while ((row < m_numrows) || (col < m_numcols));
+ if (!hasBit(m_numcols - 1, m_numrows - 1)) {
+ setBit(m_numcols - 1, m_numrows - 1, true);
+ setBit(m_numcols - 2, m_numrows - 2, true);
+ }
+}
+void CBC_DefaultPlacement::module(int32_t row,
+ int32_t col,
+ int32_t pos,
+ int32_t bit) {
+ if (row < 0) {
+ row += m_numrows;
+ col += 4 - ((m_numrows + 4) % 8);
+ }
+ if (col < 0) {
+ col += m_numcols;
+ row += 4 - ((m_numcols + 4) % 8);
+ }
+ int32_t v = m_codewords.GetAt(pos);
+ v &= 1 << (8 - bit);
+ setBit(col, row, v != 0);
+}
+void CBC_DefaultPlacement::utah(int32_t row, int32_t col, int32_t pos) {
+ module(row - 2, col - 2, pos, 1);
+ module(row - 2, col - 1, pos, 2);
+ module(row - 1, col - 2, pos, 3);
+ module(row - 1, col - 1, pos, 4);
+ module(row - 1, col, pos, 5);
+ module(row, col - 2, pos, 6);
+ module(row, col - 1, pos, 7);
+ module(row, col, pos, 8);
+}
+void CBC_DefaultPlacement::corner1(int32_t pos) {
+ module(m_numrows - 1, 0, pos, 1);
+ module(m_numrows - 1, 1, pos, 2);
+ module(m_numrows - 1, 2, pos, 3);
+ module(0, m_numcols - 2, pos, 4);
+ module(0, m_numcols - 1, pos, 5);
+ module(1, m_numcols - 1, pos, 6);
+ module(2, m_numcols - 1, pos, 7);
+ module(3, m_numcols - 1, pos, 8);
+}
+void CBC_DefaultPlacement::corner2(int32_t pos) {
+ module(m_numrows - 3, 0, pos, 1);
+ module(m_numrows - 2, 0, pos, 2);
+ module(m_numrows - 1, 0, pos, 3);
+ module(0, m_numcols - 4, pos, 4);
+ module(0, m_numcols - 3, pos, 5);
+ module(0, m_numcols - 2, pos, 6);
+ module(0, m_numcols - 1, pos, 7);
+ module(1, m_numcols - 1, pos, 8);
+}
+void CBC_DefaultPlacement::corner3(int32_t pos) {
+ module(m_numrows - 3, 0, pos, 1);
+ module(m_numrows - 2, 0, pos, 2);
+ module(m_numrows - 1, 0, pos, 3);
+ module(0, m_numcols - 2, pos, 4);
+ module(0, m_numcols - 1, pos, 5);
+ module(1, m_numcols - 1, pos, 6);
+ module(2, m_numcols - 1, pos, 7);
+ module(3, m_numcols - 1, pos, 8);
+}
+void CBC_DefaultPlacement::corner4(int32_t pos) {
+ module(m_numrows - 1, 0, pos, 1);
+ module(m_numrows - 1, m_numcols - 1, pos, 2);
+ module(0, m_numcols - 3, pos, 3);
+ module(0, m_numcols - 2, pos, 4);
+ module(0, m_numcols - 1, pos, 5);
+ module(1, m_numcols - 3, pos, 6);
+ module(1, m_numcols - 2, pos, 7);
+ module(1, m_numcols - 1, pos, 8);
+}
diff --git a/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_DefaultPlacement.h b/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_DefaultPlacement.h
new file mode 100644
index 00000000000..5036b121e54
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_DefaultPlacement.h
@@ -0,0 +1,42 @@
+// 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 FXBARCODE_DATAMATRIX_BC_DEFAULTPLACEMENT_H_
+#define FXBARCODE_DATAMATRIX_BC_DEFAULTPLACEMENT_H_
+
+#include <vector>
+
+#include "core/fxcrt/fx_basic.h"
+
+class CBC_DefaultPlacement {
+ public:
+ CBC_DefaultPlacement(CFX_WideString codewords,
+ int32_t numcols,
+ int32_t numrows);
+ virtual ~CBC_DefaultPlacement();
+
+ int32_t getNumrows();
+ int32_t getNumcols();
+ std::vector<uint8_t>& getBits();
+ bool getBit(int32_t col, int32_t row);
+ void setBit(int32_t col, int32_t row, bool bit);
+ bool hasBit(int32_t col, int32_t row);
+ void place();
+
+ private:
+ CFX_WideString m_codewords;
+ int32_t m_numrows;
+ int32_t m_numcols;
+ std::vector<uint8_t> m_bits;
+ void module(int32_t row, int32_t col, int32_t pos, int32_t bit);
+ void utah(int32_t row, int32_t col, int32_t pos);
+ void corner1(int32_t pos);
+ void corner2(int32_t pos);
+ void corner3(int32_t pos);
+ void corner4(int32_t pos);
+};
+
+#endif // FXBARCODE_DATAMATRIX_BC_DEFAULTPLACEMENT_H_
diff --git a/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_EdifactEncoder.cpp b/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_EdifactEncoder.cpp
new file mode 100644
index 00000000000..61eea93d337
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_EdifactEncoder.cpp
@@ -0,0 +1,152 @@
+// 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
+// Original code is licensed as follows:
+/*
+ * Copyright 2006-2007 Jeremias Maerki.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "fxbarcode/BC_Dimension.h"
+#include "fxbarcode/common/BC_CommonBitMatrix.h"
+#include "fxbarcode/datamatrix/BC_EdifactEncoder.h"
+#include "fxbarcode/datamatrix/BC_Encoder.h"
+#include "fxbarcode/datamatrix/BC_EncoderContext.h"
+#include "fxbarcode/datamatrix/BC_HighLevelEncoder.h"
+#include "fxbarcode/datamatrix/BC_SymbolInfo.h"
+#include "fxbarcode/datamatrix/BC_SymbolShapeHint.h"
+
+CBC_EdifactEncoder::CBC_EdifactEncoder() {}
+CBC_EdifactEncoder::~CBC_EdifactEncoder() {}
+int32_t CBC_EdifactEncoder::getEncodingMode() {
+ return EDIFACT_ENCODATION;
+}
+void CBC_EdifactEncoder::Encode(CBC_EncoderContext& context, int32_t& e) {
+ CFX_WideString buffer;
+ while (context.hasMoreCharacters()) {
+ wchar_t c = context.getCurrentChar();
+ encodeChar(c, buffer, e);
+ if (e != BCExceptionNO) {
+ return;
+ }
+ context.m_pos++;
+ int32_t count = buffer.GetLength();
+ if (count >= 4) {
+ context.writeCodewords(encodeToCodewords(buffer, 0, e));
+ if (e != BCExceptionNO) {
+ return;
+ }
+ buffer.Delete(0, 4);
+ int32_t newMode = CBC_HighLevelEncoder::lookAheadTest(
+ context.m_msg, context.m_pos, getEncodingMode());
+ if (newMode != getEncodingMode()) {
+ context.signalEncoderChange(ASCII_ENCODATION);
+ break;
+ }
+ }
+ }
+ buffer += (wchar_t)31;
+ handleEOD(context, buffer, e);
+}
+void CBC_EdifactEncoder::handleEOD(CBC_EncoderContext& context,
+ CFX_WideString buffer,
+ int32_t& e) {
+ int32_t count = buffer.GetLength();
+ if (count == 0) {
+ return;
+ }
+ if (count == 1) {
+ context.updateSymbolInfo(e);
+ if (e != BCExceptionNO) {
+ return;
+ }
+ int32_t available =
+ context.m_symbolInfo->m_dataCapacity - context.getCodewordCount();
+ int32_t remaining = context.getRemainingCharacters();
+ if (remaining == 0 && available <= 2) {
+ return;
+ }
+ }
+ if (count > 4) {
+ e = BCExceptionIllegalStateCountMustNotExceed4;
+ return;
+ }
+ int32_t restChars = count - 1;
+ CFX_WideString encoded = encodeToCodewords(buffer, 0, e);
+ if (e != BCExceptionNO) {
+ return;
+ }
+ bool endOfSymbolReached = !context.hasMoreCharacters();
+ bool restInAscii = endOfSymbolReached && restChars <= 2;
+ if (restChars <= 2) {
+ context.updateSymbolInfo(context.getCodewordCount() + restChars, e);
+ if (e != BCExceptionNO) {
+ return;
+ }
+ int32_t available =
+ context.m_symbolInfo->m_dataCapacity - context.getCodewordCount();
+ if (available >= 3) {
+ restInAscii = false;
+ context.updateSymbolInfo(context.getCodewordCount() + encoded.GetLength(),
+ e);
+ if (e != BCExceptionNO) {
+ return;
+ }
+ }
+ }
+ if (restInAscii) {
+ context.resetSymbolInfo();
+ context.m_pos -= restChars;
+ } else {
+ context.writeCodewords(encoded);
+ }
+ context.signalEncoderChange(ASCII_ENCODATION);
+}
+void CBC_EdifactEncoder::encodeChar(wchar_t c, CFX_WideString& sb, int32_t& e) {
+ if (c >= ' ' && c <= '?') {
+ sb += c;
+ } else if (c >= '@' && c <= '^') {
+ sb += (wchar_t)(c - 64);
+ } else {
+ CBC_HighLevelEncoder::illegalCharacter(c, e);
+ }
+}
+CFX_WideString CBC_EdifactEncoder::encodeToCodewords(CFX_WideString sb,
+ int32_t startPos,
+ int32_t& e) {
+ int32_t len = sb.GetLength() - startPos;
+ if (len == 0) {
+ e = BCExceptionNoContents;
+ return CFX_WideString();
+ }
+ wchar_t c1 = sb.GetAt(startPos);
+ wchar_t c2 = len >= 2 ? sb.GetAt(startPos + 1) : 0;
+ wchar_t c3 = len >= 3 ? sb.GetAt(startPos + 2) : 0;
+ wchar_t c4 = len >= 4 ? sb.GetAt(startPos + 3) : 0;
+ int32_t v = (c1 << 18) + (c2 << 12) + (c3 << 6) + c4;
+ wchar_t cw1 = (wchar_t)((v >> 16) & 255);
+ wchar_t cw2 = (wchar_t)((v >> 8) & 255);
+ wchar_t cw3 = (wchar_t)(v & 255);
+ CFX_WideString res;
+ res += cw1;
+ if (len >= 2) {
+ res += cw2;
+ }
+ if (len >= 3) {
+ res += cw3;
+ }
+ return res;
+}
diff --git a/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_EdifactEncoder.h b/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_EdifactEncoder.h
new file mode 100644
index 00000000000..6fe0934de17
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_EdifactEncoder.h
@@ -0,0 +1,31 @@
+// 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 FXBARCODE_DATAMATRIX_BC_EDIFACTENCODER_H_
+#define FXBARCODE_DATAMATRIX_BC_EDIFACTENCODER_H_
+
+#include "fxbarcode/datamatrix/BC_Encoder.h"
+
+class CBC_EdifactEncoder : public CBC_Encoder {
+ public:
+ CBC_EdifactEncoder();
+ ~CBC_EdifactEncoder() override;
+
+ // CBC_Encoder
+ int32_t getEncodingMode() override;
+ void Encode(CBC_EncoderContext& context, int32_t& e) override;
+
+ private:
+ static void handleEOD(CBC_EncoderContext& context,
+ CFX_WideString buffer,
+ int32_t& e);
+ static void encodeChar(wchar_t c, CFX_WideString& sb, int32_t& e);
+ static CFX_WideString encodeToCodewords(CFX_WideString sb,
+ int32_t startPos,
+ int32_t& e);
+};
+
+#endif // FXBARCODE_DATAMATRIX_BC_EDIFACTENCODER_H_
diff --git a/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_Encoder.cpp b/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_Encoder.cpp
new file mode 100644
index 00000000000..9403904f325
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_Encoder.cpp
@@ -0,0 +1,10 @@
+// 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
+
+#include "fxbarcode/datamatrix/BC_Encoder.h"
+
+CBC_Encoder::CBC_Encoder() {}
+CBC_Encoder::~CBC_Encoder() {}
diff --git a/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_Encoder.h b/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_Encoder.h
new file mode 100644
index 00000000000..40d491c2cd2
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_Encoder.h
@@ -0,0 +1,23 @@
+// 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 FXBARCODE_DATAMATRIX_BC_ENCODER_H_
+#define FXBARCODE_DATAMATRIX_BC_ENCODER_H_
+
+#include "fxbarcode/utils.h"
+
+class CBC_EncoderContext;
+
+class CBC_Encoder {
+ public:
+ CBC_Encoder();
+ virtual ~CBC_Encoder();
+
+ virtual int32_t getEncodingMode() = 0;
+ virtual void Encode(CBC_EncoderContext& context, int32_t& e) = 0;
+};
+
+#endif // FXBARCODE_DATAMATRIX_BC_ENCODER_H_
diff --git a/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_EncoderContext.cpp b/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_EncoderContext.cpp
new file mode 100644
index 00000000000..8fe5bf5b268
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_EncoderContext.cpp
@@ -0,0 +1,112 @@
+// 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
+// Original code is licensed as follows:
+/*
+ * Copyright 2006-2007 Jeremias Maerki.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "fxbarcode/BC_Dimension.h"
+#include "fxbarcode/BC_UtilCodingConvert.h"
+#include "fxbarcode/common/BC_CommonBitMatrix.h"
+#include "fxbarcode/datamatrix/BC_Encoder.h"
+#include "fxbarcode/datamatrix/BC_EncoderContext.h"
+#include "fxbarcode/datamatrix/BC_SymbolInfo.h"
+#include "fxbarcode/datamatrix/BC_SymbolShapeHint.h"
+
+CBC_EncoderContext::CBC_EncoderContext(const CFX_WideString msg,
+ CFX_WideString ecLevel,
+ int32_t& e) {
+ CFX_ByteString dststr;
+ CBC_UtilCodingConvert::UnicodeToUTF8(msg, dststr);
+ CFX_WideString sb;
+ int32_t c = dststr.GetLength();
+ for (int32_t i = 0; i < c; i++) {
+ wchar_t ch = (wchar_t)(dststr.GetAt(i) & 0xff);
+ if (ch == '?' && dststr.GetAt(i) != '?') {
+ e = BCExceptionCharactersOutsideISO88591Encoding;
+ }
+ sb += ch;
+ }
+ m_msg = sb;
+ m_shape = FORCE_NONE;
+ m_newEncoding = -1;
+ m_pos = 0;
+ m_symbolInfo = nullptr;
+ m_skipAtEnd = 0;
+ m_maxSize = nullptr;
+ m_minSize = nullptr;
+}
+CBC_EncoderContext::~CBC_EncoderContext() {}
+void CBC_EncoderContext::setSymbolShape(SymbolShapeHint shape) {
+ m_shape = shape;
+}
+void CBC_EncoderContext::setSizeConstraints(CBC_Dimension* minSize,
+ CBC_Dimension* maxSize) {
+ m_maxSize = maxSize;
+ m_minSize = minSize;
+}
+CFX_WideString CBC_EncoderContext::getMessage() {
+ return m_msg;
+}
+void CBC_EncoderContext::setSkipAtEnd(int32_t count) {
+ m_skipAtEnd = count;
+}
+wchar_t CBC_EncoderContext::getCurrentChar() {
+ return m_msg.GetAt(m_pos);
+}
+wchar_t CBC_EncoderContext::getCurrent() {
+ return m_msg.GetAt(m_pos);
+}
+void CBC_EncoderContext::writeCodewords(CFX_WideString codewords) {
+ m_codewords += codewords;
+}
+void CBC_EncoderContext::writeCodeword(wchar_t codeword) {
+ m_codewords += codeword;
+}
+int32_t CBC_EncoderContext::getCodewordCount() {
+ return m_codewords.GetLength();
+}
+void CBC_EncoderContext::signalEncoderChange(int32_t encoding) {
+ m_newEncoding = encoding;
+}
+void CBC_EncoderContext::resetEncoderSignal() {
+ m_newEncoding = -1;
+}
+bool CBC_EncoderContext::hasMoreCharacters() {
+ return m_pos < getTotalMessageCharCount();
+}
+int32_t CBC_EncoderContext::getRemainingCharacters() {
+ return getTotalMessageCharCount() - m_pos;
+}
+void CBC_EncoderContext::updateSymbolInfo(int32_t& e) {
+ updateSymbolInfo(getCodewordCount(), e);
+}
+void CBC_EncoderContext::updateSymbolInfo(int32_t len, int32_t& e) {
+ if (!m_symbolInfo || len > m_symbolInfo->m_dataCapacity) {
+ m_symbolInfo =
+ CBC_SymbolInfo::lookup(len, m_shape, m_minSize, m_maxSize, true, e);
+ if (e != BCExceptionNO)
+ return;
+ }
+}
+void CBC_EncoderContext::resetSymbolInfo() {
+ m_shape = FORCE_NONE;
+}
+int32_t CBC_EncoderContext::getTotalMessageCharCount() {
+ return m_msg.GetLength() - m_skipAtEnd;
+}
diff --git a/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_EncoderContext.h b/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_EncoderContext.h
new file mode 100644
index 00000000000..6be824116f5
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_EncoderContext.h
@@ -0,0 +1,56 @@
+// 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 FXBARCODE_DATAMATRIX_BC_ENCODERCONTEXT_H_
+#define FXBARCODE_DATAMATRIX_BC_ENCODERCONTEXT_H_
+
+#include "fxbarcode/datamatrix/BC_SymbolShapeHint.h"
+
+class CBC_SymbolInfo;
+class CBC_Dimension;
+
+class CBC_EncoderContext : public CBC_SymbolShapeHint {
+ public:
+ CBC_EncoderContext(const CFX_WideString msg,
+ CFX_WideString ecLevel,
+ int32_t& e);
+ ~CBC_EncoderContext() override;
+
+ void setSymbolShape(SymbolShapeHint shape);
+ void setSizeConstraints(CBC_Dimension* minSize, CBC_Dimension* maxSize);
+ CFX_WideString getMessage();
+ void setSkipAtEnd(int32_t count);
+ wchar_t getCurrentChar();
+ wchar_t getCurrent();
+ void writeCodewords(CFX_WideString codewords);
+ void writeCodeword(wchar_t codeword);
+ int32_t getCodewordCount();
+ void signalEncoderChange(int32_t encoding);
+ void resetEncoderSignal();
+ bool hasMoreCharacters();
+ int32_t getRemainingCharacters();
+ void updateSymbolInfo(int32_t& e);
+ void updateSymbolInfo(int32_t len, int32_t& e);
+ void resetSymbolInfo();
+
+ public:
+ CFX_WideString m_msg;
+ CFX_WideString m_codewords;
+ int32_t m_pos;
+ int32_t m_newEncoding;
+ CBC_SymbolInfo* m_symbolInfo;
+
+ private:
+ int32_t getTotalMessageCharCount();
+
+ private:
+ SymbolShapeHint m_shape;
+ CBC_Dimension* m_minSize;
+ CBC_Dimension* m_maxSize;
+ int32_t m_skipAtEnd;
+};
+
+#endif // FXBARCODE_DATAMATRIX_BC_ENCODERCONTEXT_H_
diff --git a/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_ErrorCorrection.cpp b/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_ErrorCorrection.cpp
new file mode 100644
index 00000000000..43bdc245341
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_ErrorCorrection.cpp
@@ -0,0 +1,209 @@
+// 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
+// Original code is licensed as follows:
+/*
+ * Copyright 2006 Jeremias Maerki.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <vector>
+
+#include "fxbarcode/datamatrix/BC_Encoder.h"
+#include "fxbarcode/datamatrix/BC_ErrorCorrection.h"
+#include "fxbarcode/datamatrix/BC_SymbolInfo.h"
+#include "fxbarcode/datamatrix/BC_SymbolShapeHint.h"
+
+namespace {
+
+const uint8_t FACTOR_SETS[] = {5, 7, 10, 11, 12, 14, 18, 20,
+ 24, 28, 36, 42, 48, 56, 62, 68};
+
+const uint8_t FACTORS_0[5] = {228, 48, 15, 111, 62};
+const uint8_t FACTORS_1[7] = {23, 68, 144, 134, 240, 92, 254};
+const uint8_t FACTORS_2[10] = {28, 24, 185, 166, 223, 248, 116, 255, 110, 61};
+const uint8_t FACTORS_3[11] = {175, 138, 205, 12, 194, 168,
+ 39, 245, 60, 97, 120};
+
+const uint8_t FACTORS_4[12] = {41, 153, 158, 91, 61, 42,
+ 142, 213, 97, 178, 100, 242};
+
+const uint8_t FACTORS_5[14] = {156, 97, 192, 252, 95, 9, 157,
+ 119, 138, 45, 18, 186, 83, 185};
+
+const uint8_t FACTORS_6[18] = {83, 195, 100, 39, 188, 75, 66, 61, 241,
+ 213, 109, 129, 94, 254, 225, 48, 90, 188};
+
+const uint8_t FACTORS_7[20] = {15, 195, 244, 9, 233, 71, 168, 2, 188, 160,
+ 153, 145, 253, 79, 108, 82, 27, 174, 186, 172};
+
+const uint8_t FACTORS_8[24] = {52, 190, 88, 205, 109, 39, 176, 21,
+ 155, 197, 251, 223, 155, 21, 5, 172,
+ 254, 124, 12, 181, 184, 96, 50, 193};
+
+const uint8_t FACTORS_9[28] = {211, 231, 43, 97, 71, 96, 103, 174, 37, 151,
+ 170, 53, 75, 34, 249, 121, 17, 138, 110, 213,
+ 141, 136, 120, 151, 233, 168, 93, 255};
+
+const uint8_t FACTORS_10[36] = {245, 127, 242, 218, 130, 250, 162, 181, 102,
+ 120, 84, 179, 220, 251, 80, 182, 229, 18,
+ 2, 4, 68, 33, 101, 137, 95, 119, 115,
+ 44, 175, 184, 59, 25, 225, 98, 81, 112};
+
+const uint8_t FACTORS_11[42] = {
+ 77, 193, 137, 31, 19, 38, 22, 153, 247, 105, 122, 2, 245, 133,
+ 242, 8, 175, 95, 100, 9, 167, 105, 214, 111, 57, 121, 21, 1,
+ 253, 57, 54, 101, 248, 202, 69, 50, 150, 177, 226, 5, 9, 5};
+
+const uint8_t FACTORS_12[48] = {
+ 245, 132, 172, 223, 96, 32, 117, 22, 238, 133, 238, 231,
+ 205, 188, 237, 87, 191, 106, 16, 147, 118, 23, 37, 90,
+ 170, 205, 131, 88, 120, 100, 66, 138, 186, 240, 82, 44,
+ 176, 87, 187, 147, 160, 175, 69, 213, 92, 253, 225, 19};
+
+const uint8_t FACTORS_13[56] = {
+ 175, 9, 223, 238, 12, 17, 220, 208, 100, 29, 175, 170, 230, 192,
+ 215, 235, 150, 159, 36, 223, 38, 200, 132, 54, 228, 146, 218, 234,
+ 117, 203, 29, 232, 144, 238, 22, 150, 201, 117, 62, 207, 164, 13,
+ 137, 245, 127, 67, 247, 28, 155, 43, 203, 107, 233, 53, 143, 46};
+
+const uint8_t FACTORS_14[62] = {
+ 242, 93, 169, 50, 144, 210, 39, 118, 202, 188, 201, 189, 143,
+ 108, 196, 37, 185, 112, 134, 230, 245, 63, 197, 190, 250, 106,
+ 185, 221, 175, 64, 114, 71, 161, 44, 147, 6, 27, 218, 51,
+ 63, 87, 10, 40, 130, 188, 17, 163, 31, 176, 170, 4, 107,
+ 232, 7, 94, 166, 224, 124, 86, 47, 11, 204};
+
+const uint8_t FACTORS_15[68] = {
+ 220, 228, 173, 89, 251, 149, 159, 56, 89, 33, 147, 244, 154, 36,
+ 73, 127, 213, 136, 248, 180, 234, 197, 158, 177, 68, 122, 93, 213,
+ 15, 160, 227, 236, 66, 139, 153, 185, 202, 167, 179, 25, 220, 232,
+ 96, 210, 231, 136, 223, 239, 181, 241, 59, 52, 172, 25, 49, 232,
+ 211, 189, 64, 54, 108, 153, 132, 63, 96, 103, 82, 186};
+
+const uint8_t* const FACTORS[16] = {
+ FACTORS_0, FACTORS_1, FACTORS_2, FACTORS_3, FACTORS_4, FACTORS_5,
+ FACTORS_6, FACTORS_7, FACTORS_8, FACTORS_9, FACTORS_10, FACTORS_11,
+ FACTORS_12, FACTORS_13, FACTORS_14, FACTORS_15};
+
+} // namespace
+
+int32_t CBC_ErrorCorrection::MODULO_VALUE = 0x12D;
+int32_t CBC_ErrorCorrection::LOG[256] = {0};
+int32_t CBC_ErrorCorrection::ALOG[256] = {0};
+void CBC_ErrorCorrection::Initialize() {
+ int32_t p = 1;
+ for (int32_t i = 0; i < 255; i++) {
+ ALOG[i] = p;
+ LOG[p] = i;
+ p <<= 1;
+ if (p >= 256) {
+ p ^= MODULO_VALUE;
+ }
+ }
+}
+void CBC_ErrorCorrection::Finalize() {}
+CBC_ErrorCorrection::CBC_ErrorCorrection() {}
+CBC_ErrorCorrection::~CBC_ErrorCorrection() {}
+CFX_WideString CBC_ErrorCorrection::encodeECC200(CFX_WideString codewords,
+ CBC_SymbolInfo* symbolInfo,
+ int32_t& e) {
+ if (codewords.GetLength() != symbolInfo->m_dataCapacity) {
+ e = BCExceptionIllegalArgument;
+ return CFX_WideString();
+ }
+ CFX_WideString sb;
+ sb += codewords;
+ int32_t blockCount = symbolInfo->getInterleavedBlockCount();
+ if (blockCount == 1) {
+ CFX_WideString ecc =
+ createECCBlock(codewords, symbolInfo->m_errorCodewords, e);
+ if (e != BCExceptionNO)
+ return CFX_WideString();
+ sb += ecc;
+ } else {
+ std::vector<int32_t> dataSizes(blockCount);
+ std::vector<int32_t> errorSizes(blockCount);
+ std::vector<int32_t> startPos(blockCount);
+ for (int32_t i = 0; i < blockCount; i++) {
+ dataSizes[i] = symbolInfo->getDataLengthForInterleavedBlock(i + 1);
+ errorSizes[i] = symbolInfo->getErrorLengthForInterleavedBlock(i + 1);
+ startPos[i] = 0;
+ if (i > 0) {
+ startPos[i] = startPos[i - 1] + dataSizes[i];
+ }
+ }
+ for (int32_t block = 0; block < blockCount; block++) {
+ CFX_WideString temp;
+ for (int32_t d = block; d < symbolInfo->m_dataCapacity; d += blockCount) {
+ temp += (wchar_t)codewords.GetAt(d);
+ }
+ CFX_WideString ecc = createECCBlock(temp, errorSizes[block], e);
+ if (e != BCExceptionNO)
+ return CFX_WideString();
+ int32_t pos = 0;
+ for (int32_t l = block; l < errorSizes[block] * blockCount;
+ l += blockCount) {
+ sb.SetAt(symbolInfo->m_dataCapacity + l, ecc.GetAt(pos++));
+ }
+ }
+ }
+ return sb;
+}
+CFX_WideString CBC_ErrorCorrection::createECCBlock(CFX_WideString codewords,
+ int32_t numECWords,
+ int32_t& e) {
+ return createECCBlock(codewords, 0, codewords.GetLength(), numECWords, e);
+}
+CFX_WideString CBC_ErrorCorrection::createECCBlock(CFX_WideString codewords,
+ int32_t start,
+ int32_t len,
+ int32_t numECWords,
+ int32_t& e) {
+ static const size_t kFactorTableNum = sizeof(FACTOR_SETS) / sizeof(int32_t);
+ size_t table = 0;
+ while (table < kFactorTableNum && FACTOR_SETS[table] != numECWords)
+ table++;
+
+ if (table >= kFactorTableNum) {
+ e = BCExceptionIllegalArgument;
+ return CFX_WideString();
+ }
+ uint16_t* ecc = FX_Alloc(uint16_t, numECWords);
+ memset(ecc, 0, numECWords * sizeof(uint16_t));
+ for (int32_t l = start; l < start + len; l++) {
+ uint16_t m = ecc[numECWords - 1] ^ codewords.GetAt(l);
+ for (int32_t k = numECWords - 1; k > 0; k--) {
+ if (m != 0 && FACTORS[table][k] != 0) {
+ ecc[k] = (uint16_t)(ecc[k - 1] ^
+ ALOG[(LOG[m] + LOG[FACTORS[table][k]]) % 255]);
+ } else {
+ ecc[k] = ecc[k - 1];
+ }
+ }
+ if (m != 0 && FACTORS[table][0] != 0) {
+ ecc[0] = (uint16_t)ALOG[(LOG[m] + LOG[FACTORS[table][0]]) % 255];
+ } else {
+ ecc[0] = 0;
+ }
+ }
+ CFX_WideString strecc;
+ for (int32_t j = 0; j < numECWords; j++) {
+ strecc += (wchar_t)ecc[numECWords - j - 1];
+ }
+ FX_Free(ecc);
+ return strecc;
+}
diff --git a/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_ErrorCorrection.h b/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_ErrorCorrection.h
new file mode 100644
index 00000000000..f09763da2b6
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_ErrorCorrection.h
@@ -0,0 +1,39 @@
+// 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 FXBARCODE_DATAMATRIX_BC_ERRORCORRECTION_H_
+#define FXBARCODE_DATAMATRIX_BC_ERRORCORRECTION_H_
+
+class CBC_SymbolInfo;
+
+class CBC_ErrorCorrection {
+ public:
+ CBC_ErrorCorrection();
+ virtual ~CBC_ErrorCorrection();
+
+ static void Initialize();
+ static void Finalize();
+ static CFX_WideString encodeECC200(CFX_WideString codewords,
+ CBC_SymbolInfo* symbolInfo,
+ int32_t& e);
+
+ private:
+ static int32_t MODULO_VALUE;
+ static int32_t LOG[256];
+ static int32_t ALOG[256];
+
+ private:
+ static CFX_WideString createECCBlock(CFX_WideString codewords,
+ int32_t numECWords,
+ int32_t& e);
+ static CFX_WideString createECCBlock(CFX_WideString codewords,
+ int32_t start,
+ int32_t len,
+ int32_t numECWords,
+ int32_t& e);
+};
+
+#endif // FXBARCODE_DATAMATRIX_BC_ERRORCORRECTION_H_
diff --git a/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp b/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp
new file mode 100644
index 00000000000..041272ef8cd
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp
@@ -0,0 +1,361 @@
+// 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
+// Original code is licensed as follows:
+/*
+ * Copyright 2006-2007 Jeremias Maerki.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <limits>
+#include <memory>
+#include <vector>
+
+#include "fxbarcode/BC_Dimension.h"
+#include "fxbarcode/BC_UtilCodingConvert.h"
+#include "fxbarcode/common/BC_CommonBitMatrix.h"
+#include "fxbarcode/datamatrix/BC_ASCIIEncoder.h"
+#include "fxbarcode/datamatrix/BC_Base256Encoder.h"
+#include "fxbarcode/datamatrix/BC_C40Encoder.h"
+#include "fxbarcode/datamatrix/BC_EdifactEncoder.h"
+#include "fxbarcode/datamatrix/BC_Encoder.h"
+#include "fxbarcode/datamatrix/BC_EncoderContext.h"
+#include "fxbarcode/datamatrix/BC_HighLevelEncoder.h"
+#include "fxbarcode/datamatrix/BC_SymbolInfo.h"
+#include "fxbarcode/datamatrix/BC_SymbolShapeHint.h"
+#include "fxbarcode/datamatrix/BC_TextEncoder.h"
+#include "fxbarcode/datamatrix/BC_X12Encoder.h"
+#include "fxbarcode/utils.h"
+#include "third_party/base/ptr_util.h"
+
+wchar_t CBC_HighLevelEncoder::LATCH_TO_C40 = 230;
+wchar_t CBC_HighLevelEncoder::LATCH_TO_BASE256 = 231;
+wchar_t CBC_HighLevelEncoder::UPPER_SHIFT = 235;
+wchar_t CBC_HighLevelEncoder::LATCH_TO_ANSIX12 = 238;
+wchar_t CBC_HighLevelEncoder::LATCH_TO_TEXT = 239;
+wchar_t CBC_HighLevelEncoder::LATCH_TO_EDIFACT = 240;
+wchar_t CBC_HighLevelEncoder::C40_UNLATCH = 254;
+wchar_t CBC_HighLevelEncoder::X12_UNLATCH = 254;
+wchar_t CBC_HighLevelEncoder::PAD = 129;
+wchar_t CBC_HighLevelEncoder::MACRO_05 = 236;
+wchar_t CBC_HighLevelEncoder::MACRO_06 = 237;
+const wchar_t* CBC_HighLevelEncoder::MACRO_05_HEADER = L"[)>05";
+const wchar_t* CBC_HighLevelEncoder::MACRO_06_HEADER = L"[)>06";
+const wchar_t CBC_HighLevelEncoder::MACRO_TRAILER = 0x0004;
+
+CBC_HighLevelEncoder::CBC_HighLevelEncoder() {}
+CBC_HighLevelEncoder::~CBC_HighLevelEncoder() {}
+
+std::vector<uint8_t>& CBC_HighLevelEncoder::getBytesForMessage(
+ CFX_WideString msg) {
+ CFX_ByteString bytestr;
+ CBC_UtilCodingConvert::UnicodeToUTF8(msg, bytestr);
+ for (int32_t i = 0; i < bytestr.GetLength(); i++)
+ m_bytearray.push_back(bytestr.GetAt(i));
+ return m_bytearray;
+}
+CFX_WideString CBC_HighLevelEncoder::encodeHighLevel(CFX_WideString msg,
+ CFX_WideString ecLevel,
+ int32_t& e) {
+ return encodeHighLevel(msg, ecLevel, FORCE_NONE, nullptr, nullptr, e);
+}
+CFX_WideString CBC_HighLevelEncoder::encodeHighLevel(CFX_WideString msg,
+ CFX_WideString ecLevel,
+ SymbolShapeHint shape,
+ CBC_Dimension* minSize,
+ CBC_Dimension* maxSize,
+ int32_t& e) {
+ CBC_EncoderContext context(msg, ecLevel, e);
+ if (e != BCExceptionNO)
+ return CFX_WideString();
+ context.setSymbolShape(shape);
+ context.setSizeConstraints(minSize, maxSize);
+ if ((msg.Mid(0, 6) == MACRO_05_HEADER) &&
+ (msg.Mid(msg.GetLength() - 1, 1) == MACRO_TRAILER)) {
+ context.writeCodeword(MACRO_05);
+ context.setSkipAtEnd(2);
+ context.m_pos += 6;
+ } else if ((msg.Mid(0, 6) == MACRO_06_HEADER) &&
+ (msg.Mid(msg.GetLength() - 1, 1) == MACRO_TRAILER)) {
+ context.writeCodeword(MACRO_06);
+ context.setSkipAtEnd(2);
+ context.m_pos += 6;
+ }
+
+ std::vector<std::unique_ptr<CBC_Encoder>> encoders;
+ encoders.push_back(pdfium::MakeUnique<CBC_ASCIIEncoder>());
+ encoders.push_back(pdfium::MakeUnique<CBC_C40Encoder>());
+ encoders.push_back(pdfium::MakeUnique<CBC_TextEncoder>());
+ encoders.push_back(pdfium::MakeUnique<CBC_X12Encoder>());
+ encoders.push_back(pdfium::MakeUnique<CBC_EdifactEncoder>());
+ encoders.push_back(pdfium::MakeUnique<CBC_Base256Encoder>());
+ int32_t encodingMode = ASCII_ENCODATION;
+ while (context.hasMoreCharacters()) {
+ encoders[encodingMode]->Encode(context, e);
+ if (e != BCExceptionNO)
+ return L"";
+
+ if (context.m_newEncoding >= 0) {
+ encodingMode = context.m_newEncoding;
+ context.resetEncoderSignal();
+ }
+ }
+ int32_t len = context.m_codewords.GetLength();
+ context.updateSymbolInfo(e);
+ if (e != BCExceptionNO)
+ return L"";
+
+ int32_t capacity = context.m_symbolInfo->m_dataCapacity;
+ if (len < capacity) {
+ if (encodingMode != ASCII_ENCODATION &&
+ encodingMode != BASE256_ENCODATION) {
+ context.writeCodeword(0x00fe);
+ }
+ }
+ CFX_WideString codewords = context.m_codewords;
+ if (codewords.GetLength() < capacity) {
+ codewords += PAD;
+ }
+ while (codewords.GetLength() < capacity) {
+ codewords += (randomize253State(PAD, codewords.GetLength() + 1));
+ }
+ return codewords;
+}
+int32_t CBC_HighLevelEncoder::lookAheadTest(CFX_WideString msg,
+ int32_t startpos,
+ int32_t currentMode) {
+ if (startpos >= msg.GetLength()) {
+ return currentMode;
+ }
+ std::vector<float> charCounts;
+ if (currentMode == ASCII_ENCODATION) {
+ charCounts.push_back(0);
+ charCounts.push_back(1);
+ charCounts.push_back(1);
+ charCounts.push_back(1);
+ charCounts.push_back(1);
+ charCounts.push_back(1.25f);
+ } else {
+ charCounts.push_back(1);
+ charCounts.push_back(2);
+ charCounts.push_back(2);
+ charCounts.push_back(2);
+ charCounts.push_back(2);
+ charCounts.push_back(2.25f);
+ charCounts[currentMode] = 0;
+ }
+ int32_t charsProcessed = 0;
+ while (true) {
+ if ((startpos + charsProcessed) == msg.GetLength()) {
+ int32_t min = std::numeric_limits<int32_t>::max();
+ std::vector<uint8_t> mins(6);
+ std::vector<int32_t> intCharCounts(6);
+ min = findMinimums(charCounts, intCharCounts, min, mins);
+ int32_t minCount = getMinimumCount(mins);
+ if (intCharCounts[ASCII_ENCODATION] == min) {
+ return ASCII_ENCODATION;
+ }
+ if (minCount == 1 && mins[BASE256_ENCODATION] > 0) {
+ return BASE256_ENCODATION;
+ }
+ if (minCount == 1 && mins[EDIFACT_ENCODATION] > 0) {
+ return EDIFACT_ENCODATION;
+ }
+ if (minCount == 1 && mins[TEXT_ENCODATION] > 0) {
+ return TEXT_ENCODATION;
+ }
+ if (minCount == 1 && mins[X12_ENCODATION] > 0) {
+ return X12_ENCODATION;
+ }
+ return C40_ENCODATION;
+ }
+ wchar_t c = msg.GetAt(startpos + charsProcessed);
+ charsProcessed++;
+ if (isDigit(c)) {
+ charCounts[ASCII_ENCODATION] += 0.5;
+ } else if (isExtendedASCII(c)) {
+ charCounts[ASCII_ENCODATION] = (float)ceil(charCounts[ASCII_ENCODATION]);
+ charCounts[ASCII_ENCODATION] += 2;
+ } else {
+ charCounts[ASCII_ENCODATION] = (float)ceil(charCounts[ASCII_ENCODATION]);
+ charCounts[ASCII_ENCODATION]++;
+ }
+ if (isNativeC40(c)) {
+ charCounts[C40_ENCODATION] += 2.0f / 3.0f;
+ } else if (isExtendedASCII(c)) {
+ charCounts[C40_ENCODATION] += 8.0f / 3.0f;
+ } else {
+ charCounts[C40_ENCODATION] += 4.0f / 3.0f;
+ }
+ if (isNativeText(c)) {
+ charCounts[TEXT_ENCODATION] += 2.0f / 3.0f;
+ } else if (isExtendedASCII(c)) {
+ charCounts[TEXT_ENCODATION] += 8.0f / 3.0f;
+ } else {
+ charCounts[TEXT_ENCODATION] += 4.0f / 3.0f;
+ }
+ if (isNativeX12(c)) {
+ charCounts[X12_ENCODATION] += 2.0f / 3.0f;
+ } else if (isExtendedASCII(c)) {
+ charCounts[X12_ENCODATION] += 13.0f / 3.0f;
+ } else {
+ charCounts[X12_ENCODATION] += 10.0f / 3.0f;
+ }
+ if (isNativeEDIFACT(c)) {
+ charCounts[EDIFACT_ENCODATION] += 3.0f / 4.0f;
+ } else if (isExtendedASCII(c)) {
+ charCounts[EDIFACT_ENCODATION] += 17.0f / 4.0f;
+ } else {
+ charCounts[EDIFACT_ENCODATION] += 13.0f / 4.0f;
+ }
+ if (isSpecialB256(c)) {
+ charCounts[BASE256_ENCODATION] += 4;
+ } else {
+ charCounts[BASE256_ENCODATION]++;
+ }
+ if (charsProcessed >= 4) {
+ std::vector<int32_t> intCharCounts(6);
+ std::vector<uint8_t> mins(6);
+ findMinimums(charCounts, intCharCounts,
+ std::numeric_limits<int32_t>::max(), mins);
+ int32_t minCount = getMinimumCount(mins);
+ if (intCharCounts[ASCII_ENCODATION] < intCharCounts[BASE256_ENCODATION] &&
+ intCharCounts[ASCII_ENCODATION] < intCharCounts[C40_ENCODATION] &&
+ intCharCounts[ASCII_ENCODATION] < intCharCounts[TEXT_ENCODATION] &&
+ intCharCounts[ASCII_ENCODATION] < intCharCounts[X12_ENCODATION] &&
+ intCharCounts[ASCII_ENCODATION] < intCharCounts[EDIFACT_ENCODATION]) {
+ return ASCII_ENCODATION;
+ }
+ if (intCharCounts[BASE256_ENCODATION] < intCharCounts[ASCII_ENCODATION] ||
+ (mins[C40_ENCODATION] + mins[TEXT_ENCODATION] + mins[X12_ENCODATION] +
+ mins[EDIFACT_ENCODATION]) == 0) {
+ return BASE256_ENCODATION;
+ }
+ if (minCount == 1 && mins[EDIFACT_ENCODATION] > 0) {
+ return EDIFACT_ENCODATION;
+ }
+ if (minCount == 1 && mins[TEXT_ENCODATION] > 0) {
+ return TEXT_ENCODATION;
+ }
+ if (minCount == 1 && mins[X12_ENCODATION] > 0) {
+ return X12_ENCODATION;
+ }
+ if (intCharCounts[C40_ENCODATION] + 1 < intCharCounts[ASCII_ENCODATION] &&
+ intCharCounts[C40_ENCODATION] + 1 <
+ intCharCounts[BASE256_ENCODATION] &&
+ intCharCounts[C40_ENCODATION] + 1 <
+ intCharCounts[EDIFACT_ENCODATION] &&
+ intCharCounts[C40_ENCODATION] + 1 < intCharCounts[TEXT_ENCODATION]) {
+ if (intCharCounts[C40_ENCODATION] < intCharCounts[X12_ENCODATION]) {
+ return C40_ENCODATION;
+ }
+ if (intCharCounts[C40_ENCODATION] == intCharCounts[X12_ENCODATION]) {
+ int32_t p = startpos + charsProcessed + 1;
+ while (p < msg.GetLength()) {
+ wchar_t tc = msg.GetAt(p);
+ if (isX12TermSep(tc)) {
+ return X12_ENCODATION;
+ }
+ if (!isNativeX12(tc)) {
+ break;
+ }
+ p++;
+ }
+ return C40_ENCODATION;
+ }
+ }
+ }
+ }
+}
+bool CBC_HighLevelEncoder::isDigit(wchar_t ch) {
+ return ch >= '0' && ch <= '9';
+}
+bool CBC_HighLevelEncoder::isExtendedASCII(wchar_t ch) {
+ return ch >= 128 && ch <= 255;
+}
+int32_t CBC_HighLevelEncoder::determineConsecutiveDigitCount(CFX_WideString msg,
+ int32_t startpos) {
+ int32_t count = 0;
+ int32_t len = msg.GetLength();
+ int32_t idx = startpos;
+ if (idx < len) {
+ wchar_t ch = msg.GetAt(idx);
+ while (isDigit(ch) && idx < len) {
+ count++;
+ idx++;
+ if (idx < len) {
+ ch = msg.GetAt(idx);
+ }
+ }
+ }
+ return count;
+}
+void CBC_HighLevelEncoder::illegalCharacter(wchar_t c, int32_t& e) {
+ e = BCExceptionIllegalArgument;
+}
+wchar_t CBC_HighLevelEncoder::randomize253State(wchar_t ch,
+ int32_t codewordPosition) {
+ int32_t pseudoRandom = ((149 * codewordPosition) % 253) + 1;
+ int32_t tempVariable = ch + pseudoRandom;
+ return tempVariable <= 254 ? (wchar_t)tempVariable
+ : (wchar_t)(tempVariable - 254);
+}
+int32_t CBC_HighLevelEncoder::findMinimums(std::vector<float>& charCounts,
+ std::vector<int32_t>& intCharCounts,
+ int32_t min,
+ std::vector<uint8_t>& mins) {
+ for (size_t l = 0; l < mins.size(); l++)
+ mins[l] = 0;
+
+ for (size_t i = 0; i < 6; i++) {
+ intCharCounts[i] = static_cast<int32_t>(ceil(charCounts[i]));
+ int32_t current = intCharCounts[i];
+ if (min > current) {
+ min = current;
+ for (size_t j = 0; j < mins.size(); j++)
+ mins[j] = 0;
+ }
+ if (min == current)
+ mins[i]++;
+ }
+ return min;
+}
+int32_t CBC_HighLevelEncoder::getMinimumCount(std::vector<uint8_t>& mins) {
+ int32_t minCount = 0;
+ for (int32_t i = 0; i < 6; i++) {
+ minCount += mins[i];
+ }
+ return minCount;
+}
+bool CBC_HighLevelEncoder::isNativeC40(wchar_t ch) {
+ return (ch == ' ') || (ch >= '0' && ch <= '9') || (ch >= 'A' && ch <= 'Z');
+}
+bool CBC_HighLevelEncoder::isNativeText(wchar_t ch) {
+ return (ch == ' ') || (ch >= '0' && ch <= '9') || (ch >= 'a' && ch <= 'z');
+}
+bool CBC_HighLevelEncoder::isNativeX12(wchar_t ch) {
+ return isX12TermSep(ch) || (ch == ' ') || (ch >= '0' && ch <= '9') ||
+ (ch >= 'A' && ch <= 'Z');
+}
+bool CBC_HighLevelEncoder::isX12TermSep(wchar_t ch) {
+ return (ch == '\r') || (ch == '*') || (ch == '>');
+}
+bool CBC_HighLevelEncoder::isNativeEDIFACT(wchar_t ch) {
+ return ch >= ' ' && ch <= '^';
+}
+bool CBC_HighLevelEncoder::isSpecialB256(wchar_t ch) {
+ return false;
+}
diff --git a/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_HighLevelEncoder.h b/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_HighLevelEncoder.h
new file mode 100644
index 00000000000..83136be2f4d
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_HighLevelEncoder.h
@@ -0,0 +1,79 @@
+// 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 FXBARCODE_DATAMATRIX_BC_HIGHLEVELENCODER_H_
+#define FXBARCODE_DATAMATRIX_BC_HIGHLEVELENCODER_H_
+
+#include <vector>
+
+#include "fxbarcode/datamatrix/BC_SymbolShapeHint.h"
+
+#define ASCII_ENCODATION 0
+#define C40_ENCODATION 1
+#define TEXT_ENCODATION 2
+#define X12_ENCODATION 3
+#define EDIFACT_ENCODATION 4
+#define BASE256_ENCODATION 5
+
+class CBC_HighLevelEncoder : public CBC_SymbolShapeHint {
+ public:
+ CBC_HighLevelEncoder();
+ ~CBC_HighLevelEncoder() override;
+
+ std::vector<uint8_t>& getBytesForMessage(CFX_WideString msg);
+ static CFX_WideString encodeHighLevel(CFX_WideString msg,
+ CFX_WideString ecLevel,
+ int32_t& e);
+ static CFX_WideString encodeHighLevel(CFX_WideString msg,
+ CFX_WideString ecLevel,
+ SymbolShapeHint shape,
+ CBC_Dimension* minSize,
+ CBC_Dimension* maxSize,
+ int32_t& e);
+ static int32_t lookAheadTest(CFX_WideString msg,
+ int32_t startpos,
+ int32_t currentMode);
+ static bool isDigit(wchar_t ch);
+ static bool isExtendedASCII(wchar_t ch);
+ static int32_t determineConsecutiveDigitCount(CFX_WideString msg,
+ int32_t startpos);
+ static void illegalCharacter(wchar_t c, int32_t& e);
+
+ public:
+ static wchar_t LATCH_TO_C40;
+ static wchar_t LATCH_TO_BASE256;
+ static wchar_t UPPER_SHIFT;
+ static wchar_t LATCH_TO_ANSIX12;
+ static wchar_t LATCH_TO_TEXT;
+ static wchar_t LATCH_TO_EDIFACT;
+ static wchar_t C40_UNLATCH;
+ static wchar_t X12_UNLATCH;
+
+ private:
+ static wchar_t PAD;
+ static wchar_t MACRO_05;
+ static wchar_t MACRO_06;
+ static const wchar_t* MACRO_05_HEADER;
+ static const wchar_t* MACRO_06_HEADER;
+ static const wchar_t MACRO_TRAILER;
+ std::vector<uint8_t> m_bytearray;
+
+ private:
+ static wchar_t randomize253State(wchar_t ch, int32_t codewordPosition);
+ static int32_t findMinimums(std::vector<float>& charCounts,
+ std::vector<int32_t>& intCharCounts,
+ int32_t min,
+ std::vector<uint8_t>& mins);
+ static int32_t getMinimumCount(std::vector<uint8_t>& mins);
+ static bool isNativeC40(wchar_t ch);
+ static bool isNativeText(wchar_t ch);
+ static bool isNativeX12(wchar_t ch);
+ static bool isX12TermSep(wchar_t ch);
+ static bool isNativeEDIFACT(wchar_t ch);
+ static bool isSpecialB256(wchar_t ch);
+};
+
+#endif // FXBARCODE_DATAMATRIX_BC_HIGHLEVELENCODER_H_
diff --git a/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_SymbolInfo.cpp b/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_SymbolInfo.cpp
new file mode 100644
index 00000000000..f98370b90fe
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_SymbolInfo.cpp
@@ -0,0 +1,230 @@
+// 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
+// Original code is licensed as follows:
+/*
+ * Copyright 2006 Jeremias Maerki
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "fxbarcode/datamatrix/BC_SymbolInfo.h"
+
+#include "fxbarcode/BC_Dimension.h"
+#include "fxbarcode/common/BC_CommonBitMatrix.h"
+#include "fxbarcode/datamatrix/BC_DataMatrixSymbolInfo144.h"
+#include "fxbarcode/datamatrix/BC_Encoder.h"
+#include "fxbarcode/datamatrix/BC_SymbolShapeHint.h"
+
+namespace {
+
+const size_t kSymbolsCount = 30;
+
+CBC_SymbolInfo* g_symbols[kSymbolsCount] = {
+ nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
+ nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
+ nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
+ nullptr, nullptr, nullptr, nullptr, nullptr, nullptr};
+
+} // namespace
+
+void CBC_SymbolInfo::Initialize() {
+ g_symbols[0] = new CBC_SymbolInfo(false, 3, 5, 8, 8, 1);
+ g_symbols[1] = new CBC_SymbolInfo(false, 5, 7, 10, 10, 1);
+ g_symbols[2] = new CBC_SymbolInfo(true, 5, 7, 16, 6, 1);
+ g_symbols[3] = new CBC_SymbolInfo(false, 8, 10, 12, 12, 1);
+ g_symbols[4] = new CBC_SymbolInfo(true, 10, 11, 14, 6, 2);
+ g_symbols[5] = new CBC_SymbolInfo(false, 12, 12, 14, 14, 1);
+ g_symbols[6] = new CBC_SymbolInfo(true, 16, 14, 24, 10, 1);
+ g_symbols[7] = new CBC_SymbolInfo(false, 18, 14, 16, 16, 1);
+ g_symbols[8] = new CBC_SymbolInfo(false, 22, 18, 18, 18, 1);
+ g_symbols[9] = new CBC_SymbolInfo(true, 22, 18, 16, 10, 2);
+ g_symbols[10] = new CBC_SymbolInfo(false, 30, 20, 20, 20, 1);
+ g_symbols[11] = new CBC_SymbolInfo(true, 32, 24, 16, 14, 2);
+ g_symbols[12] = new CBC_SymbolInfo(false, 36, 24, 22, 22, 1);
+ g_symbols[13] = new CBC_SymbolInfo(false, 44, 28, 24, 24, 1);
+ g_symbols[14] = new CBC_SymbolInfo(true, 49, 28, 22, 14, 2);
+ g_symbols[15] = new CBC_SymbolInfo(false, 62, 36, 14, 14, 4);
+ g_symbols[16] = new CBC_SymbolInfo(false, 86, 42, 16, 16, 4);
+ g_symbols[17] = new CBC_SymbolInfo(false, 114, 48, 18, 18, 4);
+ g_symbols[18] = new CBC_SymbolInfo(false, 144, 56, 20, 20, 4);
+ g_symbols[19] = new CBC_SymbolInfo(false, 174, 68, 22, 22, 4);
+ g_symbols[20] = new CBC_SymbolInfo(false, 204, 84, 24, 24, 4, 102, 42);
+ g_symbols[21] = new CBC_SymbolInfo(false, 280, 112, 14, 14, 16, 140, 56);
+ g_symbols[22] = new CBC_SymbolInfo(false, 368, 144, 16, 16, 16, 92, 36);
+ g_symbols[23] = new CBC_SymbolInfo(false, 456, 192, 18, 18, 16, 114, 48);
+ g_symbols[24] = new CBC_SymbolInfo(false, 576, 224, 20, 20, 16, 144, 56);
+ g_symbols[25] = new CBC_SymbolInfo(false, 696, 272, 22, 22, 16, 174, 68);
+ g_symbols[26] = new CBC_SymbolInfo(false, 816, 336, 24, 24, 16, 136, 56);
+ g_symbols[27] = new CBC_SymbolInfo(false, 1050, 408, 18, 18, 36, 175, 68);
+ g_symbols[28] = new CBC_SymbolInfo(false, 1304, 496, 20, 20, 36, 163, 62);
+ g_symbols[29] = new CBC_DataMatrixSymbolInfo144();
+}
+
+void CBC_SymbolInfo::Finalize() {
+ for (size_t i = 0; i < kSymbolsCount; i++) {
+ delete g_symbols[i];
+ g_symbols[i] = nullptr;
+ }
+}
+
+CBC_SymbolInfo::CBC_SymbolInfo(bool rectangular,
+ int32_t dataCapacity,
+ int32_t errorCodewords,
+ int32_t matrixWidth,
+ int32_t matrixHeight,
+ int32_t dataRegions) {
+ m_rectangular = rectangular;
+ m_dataCapacity = dataCapacity;
+ m_errorCodewords = errorCodewords;
+ m_matrixWidth = matrixWidth;
+ m_matrixHeight = matrixHeight;
+ m_dataRegions = dataRegions;
+ m_rsBlockData = dataCapacity;
+ m_rsBlockError = errorCodewords;
+}
+CBC_SymbolInfo::CBC_SymbolInfo(bool rectangular,
+ int32_t dataCapacity,
+ int32_t errorCodewords,
+ int32_t matrixWidth,
+ int32_t matrixHeight,
+ int32_t dataRegions,
+ int32_t rsBlockData,
+ int32_t rsBlockError) {
+ m_rectangular = rectangular;
+ m_dataCapacity = dataCapacity;
+ m_errorCodewords = errorCodewords;
+ m_matrixWidth = matrixWidth;
+ m_matrixHeight = matrixHeight;
+ m_dataRegions = dataRegions;
+ m_rsBlockData = rsBlockData;
+ m_rsBlockError = rsBlockError;
+}
+CBC_SymbolInfo::~CBC_SymbolInfo() {}
+
+CBC_SymbolInfo* CBC_SymbolInfo::lookup(int32_t dataCodewords, int32_t& e) {
+ return lookup(dataCodewords, FORCE_NONE, true, e);
+}
+CBC_SymbolInfo* CBC_SymbolInfo::lookup(int32_t dataCodewords,
+ SymbolShapeHint shape,
+ int32_t& e) {
+ return lookup(dataCodewords, shape, true, e);
+}
+CBC_SymbolInfo* CBC_SymbolInfo::lookup(int32_t dataCodewords,
+ bool allowRectangular,
+ bool fail,
+ int32_t& e) {
+ SymbolShapeHint shape = allowRectangular ? FORCE_NONE : FORCE_SQUARE;
+ return lookup(dataCodewords, shape, fail, e);
+}
+CBC_SymbolInfo* CBC_SymbolInfo::lookup(int32_t dataCodewords,
+ SymbolShapeHint shape,
+ bool fail,
+ int32_t& e) {
+ return lookup(dataCodewords, shape, nullptr, nullptr, fail, e);
+}
+CBC_SymbolInfo* CBC_SymbolInfo::lookup(int32_t dataCodewords,
+ SymbolShapeHint shape,
+ CBC_Dimension* minSize,
+ CBC_Dimension* maxSize,
+ bool fail,
+ int32_t& e) {
+ for (size_t i = 0; i < kSymbolsCount; i++) {
+ CBC_SymbolInfo* symbol = g_symbols[i];
+ if (shape == FORCE_SQUARE && symbol->m_rectangular) {
+ continue;
+ }
+ if (shape == FORCE_RECTANGLE && !symbol->m_rectangular) {
+ continue;
+ }
+ if (minSize && (symbol->getSymbolWidth(e) < minSize->getWidth() ||
+ symbol->getSymbolHeight(e) < minSize->getHeight())) {
+ if (e != BCExceptionNO)
+ return nullptr;
+ continue;
+ }
+ if (maxSize && (symbol->getSymbolWidth(e) > maxSize->getWidth() ||
+ symbol->getSymbolHeight(e) > maxSize->getHeight())) {
+ if (e != BCExceptionNO)
+ return nullptr;
+ continue;
+ }
+ if (dataCodewords <= symbol->m_dataCapacity) {
+ return symbol;
+ }
+ }
+ if (fail)
+ e = BCExceptionIllegalDataCodewords;
+ return nullptr;
+}
+
+int32_t CBC_SymbolInfo::getHorizontalDataRegions(int32_t& e) {
+ switch (m_dataRegions) {
+ case 1:
+ return 1;
+ case 2:
+ return 2;
+ case 4:
+ return 2;
+ case 16:
+ return 4;
+ case 36:
+ return 6;
+ default:
+ e = BCExceptionCannotHandleThisNumberOfDataRegions;
+ return 0;
+ }
+}
+int32_t CBC_SymbolInfo::getVerticalDataRegions(int32_t& e) {
+ switch (m_dataRegions) {
+ case 1:
+ return 1;
+ case 2:
+ return 1;
+ case 4:
+ return 2;
+ case 16:
+ return 4;
+ case 36:
+ return 6;
+ default:
+ e = BCExceptionCannotHandleThisNumberOfDataRegions;
+ return 0;
+ }
+}
+int32_t CBC_SymbolInfo::getSymbolDataWidth(int32_t& e) {
+ return getHorizontalDataRegions(e) * m_matrixWidth;
+}
+int32_t CBC_SymbolInfo::getSymbolDataHeight(int32_t& e) {
+ return getVerticalDataRegions(e) * m_matrixHeight;
+}
+int32_t CBC_SymbolInfo::getSymbolWidth(int32_t& e) {
+ return getSymbolDataWidth(e) + (getHorizontalDataRegions(e) * 2);
+}
+int32_t CBC_SymbolInfo::getSymbolHeight(int32_t& e) {
+ return getSymbolDataHeight(e) + (getVerticalDataRegions(e) * 2);
+}
+int32_t CBC_SymbolInfo::getCodewordCount() {
+ return m_dataCapacity + m_errorCodewords;
+}
+int32_t CBC_SymbolInfo::getInterleavedBlockCount() {
+ return m_dataCapacity / m_rsBlockData;
+}
+int32_t CBC_SymbolInfo::getDataLengthForInterleavedBlock(int32_t index) {
+ return m_rsBlockData;
+}
+int32_t CBC_SymbolInfo::getErrorLengthForInterleavedBlock(int32_t index) {
+ return m_rsBlockError;
+}
diff --git a/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_SymbolInfo.h b/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_SymbolInfo.h
new file mode 100644
index 00000000000..36ed01d7e48
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_SymbolInfo.h
@@ -0,0 +1,79 @@
+// 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 FXBARCODE_DATAMATRIX_BC_SYMBOLINFO_H_
+#define FXBARCODE_DATAMATRIX_BC_SYMBOLINFO_H_
+
+#include "core/fxcrt/fx_string.h"
+#include "core/fxcrt/fx_system.h"
+#include "fxbarcode/datamatrix/BC_SymbolShapeHint.h"
+
+class CBC_Dimension;
+
+class CBC_SymbolInfo : public CBC_SymbolShapeHint {
+ public:
+ CBC_SymbolInfo(bool rectangular,
+ int32_t dataCapacity,
+ int32_t errorCodewords,
+ int32_t matrixWidth,
+ int32_t matrixHeight,
+ int32_t dataRegions);
+ ~CBC_SymbolInfo() override;
+
+ static void Initialize();
+ static void Finalize();
+ static void overrideSymbolSet(CBC_SymbolInfo* override);
+ static CBC_SymbolInfo* lookup(int32_t dataCodewords, int32_t& e);
+ static CBC_SymbolInfo* lookup(int32_t dataCodewords,
+ SymbolShapeHint shape,
+ int32_t& e);
+ static CBC_SymbolInfo* lookup(int32_t dataCodewords,
+ bool allowRectangular,
+ bool fail,
+ int32_t& e);
+ static CBC_SymbolInfo* lookup(int32_t dataCodewords,
+ SymbolShapeHint shape,
+ bool fail,
+ int32_t& e);
+ static CBC_SymbolInfo* lookup(int32_t dataCodewords,
+ SymbolShapeHint shape,
+ CBC_Dimension* minSize,
+ CBC_Dimension* maxSize,
+ bool fail,
+ int32_t& e);
+ int32_t getHorizontalDataRegions(int32_t& e);
+ int32_t getVerticalDataRegions(int32_t& e);
+ int32_t getSymbolDataWidth(int32_t& e);
+ int32_t getSymbolDataHeight(int32_t& e);
+ int32_t getSymbolWidth(int32_t& e);
+ int32_t getSymbolHeight(int32_t& e);
+ int32_t getCodewordCount();
+ int32_t getInterleavedBlockCount();
+ int32_t getDataLengthForInterleavedBlock(int32_t index);
+ int32_t getErrorLengthForInterleavedBlock(int32_t index);
+
+ int32_t m_dataCapacity;
+ int32_t m_errorCodewords;
+ int32_t m_matrixWidth;
+ int32_t m_matrixHeight;
+ int32_t m_rsBlockData;
+ int32_t m_rsBlockError;
+
+ private:
+ CBC_SymbolInfo(bool rectangular,
+ int32_t dataCapacity,
+ int32_t errorCodewords,
+ int32_t matrixWidth,
+ int32_t matrixHeight,
+ int32_t dataRegions,
+ int32_t rsBlockData,
+ int32_t rsBlockError);
+
+ bool m_rectangular;
+ int32_t m_dataRegions;
+};
+
+#endif // FXBARCODE_DATAMATRIX_BC_SYMBOLINFO_H_
diff --git a/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_SymbolShapeHint.cpp b/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_SymbolShapeHint.cpp
new file mode 100644
index 00000000000..294580bb5ac
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_SymbolShapeHint.cpp
@@ -0,0 +1,26 @@
+// 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
+// Original code is licensed as follows:
+/*
+ * Copyright 2007 Jeremias Maerki.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "fxbarcode/datamatrix/BC_SymbolShapeHint.h"
+
+CBC_SymbolShapeHint::CBC_SymbolShapeHint() {}
+CBC_SymbolShapeHint::~CBC_SymbolShapeHint() {}
diff --git a/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_SymbolShapeHint.h b/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_SymbolShapeHint.h
new file mode 100644
index 00000000000..409ee05d75f
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_SymbolShapeHint.h
@@ -0,0 +1,22 @@
+// 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 FXBARCODE_DATAMATRIX_BC_SYMBOLSHAPEHINT_H_
+#define FXBARCODE_DATAMATRIX_BC_SYMBOLSHAPEHINT_H_
+
+class CBC_SymbolShapeHint {
+ public:
+ CBC_SymbolShapeHint();
+ virtual ~CBC_SymbolShapeHint();
+
+ enum SymbolShapeHint {
+ FORCE_NONE,
+ FORCE_SQUARE,
+ FORCE_RECTANGLE,
+ };
+};
+
+#endif // FXBARCODE_DATAMATRIX_BC_SYMBOLSHAPEHINT_H_
diff --git a/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_TextEncoder.cpp b/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_TextEncoder.cpp
new file mode 100644
index 00000000000..a521acb6c3b
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_TextEncoder.cpp
@@ -0,0 +1,97 @@
+// 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
+// Original code is licensed as follows:
+/*
+ * Copyright 2006-2007 Jeremias Maerki.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "fxbarcode/BC_Dimension.h"
+#include "fxbarcode/common/BC_CommonBitMatrix.h"
+#include "fxbarcode/datamatrix/BC_C40Encoder.h"
+#include "fxbarcode/datamatrix/BC_Encoder.h"
+#include "fxbarcode/datamatrix/BC_EncoderContext.h"
+#include "fxbarcode/datamatrix/BC_HighLevelEncoder.h"
+#include "fxbarcode/datamatrix/BC_SymbolInfo.h"
+#include "fxbarcode/datamatrix/BC_SymbolShapeHint.h"
+#include "fxbarcode/datamatrix/BC_TextEncoder.h"
+
+CBC_TextEncoder::CBC_TextEncoder() {}
+CBC_TextEncoder::~CBC_TextEncoder() {}
+int32_t CBC_TextEncoder::getEncodingMode() {
+ return TEXT_ENCODATION;
+}
+int32_t CBC_TextEncoder::encodeChar(wchar_t c, CFX_WideString& sb, int32_t& e) {
+ if (c == ' ') {
+ sb += (wchar_t)'\3';
+ return 1;
+ }
+ if (c >= '0' && c <= '9') {
+ sb += (wchar_t)(c - 48 + 4);
+ return 1;
+ }
+ if (c >= 'a' && c <= 'z') {
+ sb += (wchar_t)(c - 97 + 14);
+ return 1;
+ }
+ if (c <= 0x1f) {
+ sb += (wchar_t)'\0';
+ sb += c;
+ return 2;
+ }
+ if (c >= '!' && c <= '/') {
+ sb += (wchar_t)'\1';
+ sb += (wchar_t)(c - 33);
+ return 2;
+ }
+ if (c >= ':' && c <= '@') {
+ sb += (wchar_t)'\1';
+ sb += (wchar_t)(c - 58 + 15);
+ return 2;
+ }
+ if (c >= '[' && c <= '_') {
+ sb += (wchar_t)'\1';
+ sb += (wchar_t)(c - 91 + 22);
+ return 2;
+ }
+ if (c == 0x0060) {
+ sb += (wchar_t)'\2';
+ sb += (wchar_t)(c - 96);
+ return 2;
+ }
+ if (c >= 'A' && c <= 'Z') {
+ sb += (wchar_t)'\2';
+ sb += (wchar_t)(c - 65 + 1);
+ return 2;
+ }
+ if (c >= '{' && c <= 0x007f) {
+ sb += (wchar_t)'\2';
+ sb += (wchar_t)(c - 123 + 27);
+ return 2;
+ }
+ if (c >= 0x0080) {
+ sb += (wchar_t)'\1';
+ sb += (wchar_t)0x001e;
+ int32_t len = 2;
+ len += encodeChar((wchar_t)(c - 128), sb, e);
+ if (e != BCExceptionNO)
+ return -1;
+ return len;
+ }
+ CBC_HighLevelEncoder::illegalCharacter(c, e);
+ return -1;
+}
diff --git a/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_TextEncoder.h b/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_TextEncoder.h
new file mode 100644
index 00000000000..dde1a7f46e2
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_TextEncoder.h
@@ -0,0 +1,22 @@
+// 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 FXBARCODE_DATAMATRIX_BC_TEXTENCODER_H_
+#define FXBARCODE_DATAMATRIX_BC_TEXTENCODER_H_
+
+class CBC_TextEncoder;
+
+class CBC_TextEncoder : public CBC_C40Encoder {
+ public:
+ CBC_TextEncoder();
+ ~CBC_TextEncoder() override;
+
+ // CBC_C40Encoder
+ int32_t getEncodingMode() override;
+ int32_t encodeChar(wchar_t c, CFX_WideString& sb, int32_t& e) override;
+};
+
+#endif // FXBARCODE_DATAMATRIX_BC_TEXTENCODER_H_
diff --git a/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_X12Encoder.cpp b/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_X12Encoder.cpp
new file mode 100644
index 00000000000..dd8254bff70
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_X12Encoder.cpp
@@ -0,0 +1,101 @@
+// 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
+// Original code is licensed as follows:
+/*
+ * Copyright 2006-2007 Jeremias Maerki.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "fxbarcode/BC_Dimension.h"
+#include "fxbarcode/common/BC_CommonBitMatrix.h"
+#include "fxbarcode/datamatrix/BC_C40Encoder.h"
+#include "fxbarcode/datamatrix/BC_Encoder.h"
+#include "fxbarcode/datamatrix/BC_EncoderContext.h"
+#include "fxbarcode/datamatrix/BC_HighLevelEncoder.h"
+#include "fxbarcode/datamatrix/BC_SymbolInfo.h"
+#include "fxbarcode/datamatrix/BC_SymbolShapeHint.h"
+#include "fxbarcode/datamatrix/BC_X12Encoder.h"
+
+CBC_X12Encoder::CBC_X12Encoder() {}
+CBC_X12Encoder::~CBC_X12Encoder() {}
+int32_t CBC_X12Encoder::getEncodingMode() {
+ return X12_ENCODATION;
+}
+void CBC_X12Encoder::Encode(CBC_EncoderContext& context, int32_t& e) {
+ CFX_WideString buffer;
+ while (context.hasMoreCharacters()) {
+ wchar_t c = context.getCurrentChar();
+ context.m_pos++;
+ encodeChar(c, buffer, e);
+ if (e != BCExceptionNO) {
+ return;
+ }
+ int32_t count = buffer.GetLength();
+ if ((count % 3) == 0) {
+ writeNextTriplet(context, buffer);
+ int32_t newMode = CBC_HighLevelEncoder::lookAheadTest(
+ context.m_msg, context.m_pos, getEncodingMode());
+ if (newMode != getEncodingMode()) {
+ context.signalEncoderChange(newMode);
+ break;
+ }
+ }
+ }
+ handleEOD(context, buffer, e);
+}
+void CBC_X12Encoder::handleEOD(CBC_EncoderContext& context,
+ CFX_WideString& buffer,
+ int32_t& e) {
+ context.updateSymbolInfo(e);
+ if (e != BCExceptionNO) {
+ return;
+ }
+ int32_t available =
+ context.m_symbolInfo->m_dataCapacity - context.getCodewordCount();
+ int32_t count = buffer.GetLength();
+ if (count == 2) {
+ context.writeCodeword(CBC_HighLevelEncoder::X12_UNLATCH);
+ context.m_pos -= 2;
+ context.signalEncoderChange(ASCII_ENCODATION);
+ } else if (count == 1) {
+ context.m_pos--;
+ if (available > 1) {
+ context.writeCodeword(CBC_HighLevelEncoder::X12_UNLATCH);
+ }
+ context.signalEncoderChange(ASCII_ENCODATION);
+ }
+}
+int32_t CBC_X12Encoder::encodeChar(wchar_t c, CFX_WideString& sb, int32_t& e) {
+ if (c == '\r') {
+ sb += (wchar_t)'\0';
+ } else if (c == '*') {
+ sb += (wchar_t)'\1';
+ } else if (c == '>') {
+ sb += (wchar_t)'\2';
+ } else if (c == ' ') {
+ sb += (wchar_t)'\3';
+ } else if (c >= '0' && c <= '9') {
+ sb += (wchar_t)(c - 48 + 4);
+ } else if (c >= 'A' && c <= 'Z') {
+ sb += (wchar_t)(c - 65 + 14);
+ } else {
+ CBC_HighLevelEncoder::illegalCharacter(c, e);
+ if (e != BCExceptionNO)
+ return -1;
+ }
+ return 1;
+}
diff --git a/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_X12Encoder.h b/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_X12Encoder.h
new file mode 100644
index 00000000000..a90dd8c7bad
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/datamatrix/BC_X12Encoder.h
@@ -0,0 +1,26 @@
+// 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 FXBARCODE_DATAMATRIX_BC_X12ENCODER_H_
+#define FXBARCODE_DATAMATRIX_BC_X12ENCODER_H_
+
+class CBC_C40Encoder;
+class CBC_X12Encoder;
+class CBC_X12Encoder : public CBC_C40Encoder {
+ public:
+ CBC_X12Encoder();
+ ~CBC_X12Encoder() override;
+
+ // CBC_C40Encoder
+ int32_t getEncodingMode() override;
+ void Encode(CBC_EncoderContext& context, int32_t& e) override;
+ void handleEOD(CBC_EncoderContext& context,
+ CFX_WideString& buffer,
+ int32_t& e) override;
+ int32_t encodeChar(wchar_t c, CFX_WideString& sb, int32_t& e) override;
+};
+
+#endif // FXBARCODE_DATAMATRIX_BC_X12ENCODER_H_
diff --git a/chromium/third_party/pdfium/fxbarcode/oned/BC_OneDimWriter.cpp b/chromium/third_party/pdfium/fxbarcode/oned/BC_OneDimWriter.cpp
new file mode 100644
index 00000000000..f6b33f37a97
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/oned/BC_OneDimWriter.cpp
@@ -0,0 +1,485 @@
+// 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
+// Original code is licensed as follows:
+/*
+ * Copyright 2011 ZXing authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "fxbarcode/oned/BC_OneDimWriter.h"
+
+#include <algorithm>
+#include <memory>
+
+#include "core/fxge/cfx_fxgedevice.h"
+#include "core/fxge/cfx_gemodule.h"
+#include "core/fxge/cfx_graphstatedata.h"
+#include "core/fxge/cfx_pathdata.h"
+#include "core/fxge/cfx_renderdevice.h"
+#include "core/fxge/cfx_unicodeencodingex.h"
+#include "fxbarcode/BC_Writer.h"
+#include "fxbarcode/common/BC_CommonBitMatrix.h"
+#include "third_party/base/ptr_util.h"
+
+CBC_OneDimWriter::CBC_OneDimWriter() {
+ m_locTextLoc = BC_TEXT_LOC_BELOWEMBED;
+ m_bPrintChecksum = true;
+ m_iDataLenth = 0;
+ m_bCalcChecksum = false;
+ m_pFont = nullptr;
+ m_fFontSize = 10;
+ m_iFontStyle = 0;
+ m_fontColor = 0xff000000;
+ m_iContentLen = 0;
+ m_bLeftPadding = false;
+ m_bRightPadding = false;
+}
+
+CBC_OneDimWriter::~CBC_OneDimWriter() {}
+
+void CBC_OneDimWriter::SetPrintChecksum(bool checksum) {
+ m_bPrintChecksum = checksum;
+}
+
+void CBC_OneDimWriter::SetDataLength(int32_t length) {
+ m_iDataLenth = length;
+}
+
+void CBC_OneDimWriter::SetCalcChecksum(bool state) {
+ m_bCalcChecksum = state;
+}
+
+bool CBC_OneDimWriter::SetFont(CFX_Font* cFont) {
+ if (!cFont)
+ return false;
+
+ m_pFont = cFont;
+ return true;
+}
+
+void CBC_OneDimWriter::SetFontSize(float size) {
+ m_fFontSize = size;
+}
+
+void CBC_OneDimWriter::SetFontStyle(int32_t style) {
+ m_iFontStyle = style;
+}
+
+void CBC_OneDimWriter::SetFontColor(FX_ARGB color) {
+ m_fontColor = color;
+}
+
+wchar_t CBC_OneDimWriter::Upper(wchar_t ch) {
+ if (ch >= 'a' && ch <= 'z') {
+ ch = ch - ('a' - 'A');
+ }
+ return ch;
+}
+
+uint8_t* CBC_OneDimWriter::Encode(const CFX_ByteString& contents,
+ BCFORMAT format,
+ int32_t& outWidth,
+ int32_t& outHeight,
+ int32_t hints,
+ int32_t& e) {
+ uint8_t* ret = nullptr;
+ outHeight = 1;
+ if (m_Width >= 20) {
+ ret = Encode(contents, outWidth, e);
+ } else {
+ ret = Encode(contents, outWidth, e);
+ }
+ if (e != BCExceptionNO)
+ return nullptr;
+ return ret;
+}
+
+uint8_t* CBC_OneDimWriter::Encode(const CFX_ByteString& contents,
+ BCFORMAT format,
+ int32_t& outWidth,
+ int32_t& outHeight,
+ int32_t& e) {
+ uint8_t* ret = Encode(contents, format, outWidth, outHeight, 0, e);
+ if (e != BCExceptionNO)
+ return nullptr;
+ return ret;
+}
+
+uint8_t* CBC_OneDimWriter::Encode(const CFX_ByteString& contents,
+ int32_t& outLength,
+ int32_t& e) {
+ return nullptr;
+}
+
+int32_t CBC_OneDimWriter::AppendPattern(uint8_t* target,
+ int32_t pos,
+ const int32_t* pattern,
+ int32_t patternLength,
+ int32_t startColor,
+ int32_t& e) {
+ if (startColor != 0 && startColor != 1) {
+ e = BCExceptionValueMustBeEither0or1;
+ return 0;
+ }
+ uint8_t color = (uint8_t)startColor;
+ int32_t numAdded = 0;
+ for (int32_t i = 0; i < patternLength; i++) {
+ for (int32_t j = 0; j < pattern[i]; j++) {
+ target[pos] = color;
+ pos += 1;
+ numAdded += 1;
+ }
+ color ^= 1;
+ }
+ return numAdded;
+}
+
+void CBC_OneDimWriter::CalcTextInfo(const CFX_ByteString& text,
+ FXTEXT_CHARPOS* charPos,
+ CFX_Font* cFont,
+ float geWidth,
+ int32_t fontSize,
+ float& charsLen) {
+ std::unique_ptr<CFX_UnicodeEncodingEx> encoding(
+ FX_CreateFontEncodingEx(cFont));
+
+ int32_t length = text.GetLength();
+ uint32_t* pCharCode = FX_Alloc(uint32_t, text.GetLength());
+ float charWidth = 0;
+ for (int32_t j = 0; j < text.GetLength(); j++) {
+ pCharCode[j] = encoding->CharCodeFromUnicode(text[j]);
+ int32_t glyp_code = encoding->GlyphFromCharCode(pCharCode[j]);
+ int32_t glyp_value = cFont->GetGlyphWidth(glyp_code);
+ float temp = (float)((glyp_value)*fontSize / 1000.0);
+ charWidth += temp;
+ }
+ charsLen = charWidth;
+ float leftPositon = (float)(geWidth - charsLen) / 2.0f;
+ if (leftPositon < 0 && geWidth == 0) {
+ leftPositon = 0;
+ }
+ float penX = 0.0;
+ float penY = (float)abs(cFont->GetDescent()) * (float)fontSize / 1000.0f;
+ float left = leftPositon;
+ float top = 0.0;
+ charPos[0].m_Origin = CFX_PointF(penX + left, penY + top);
+ charPos[0].m_GlyphIndex = encoding->GlyphFromCharCode(pCharCode[0]);
+ charPos[0].m_FontCharWidth = cFont->GetGlyphWidth(charPos[0].m_GlyphIndex);
+#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
+ charPos[0].m_ExtGID = charPos[0].m_GlyphIndex;
+#endif
+ penX += (float)(charPos[0].m_FontCharWidth) * (float)fontSize / 1000.0f;
+ for (int32_t i = 1; i < length; i++) {
+ charPos[i].m_Origin = CFX_PointF(penX + left, penY + top);
+ charPos[i].m_GlyphIndex = encoding->GlyphFromCharCode(pCharCode[i]);
+ charPos[i].m_FontCharWidth = cFont->GetGlyphWidth(charPos[i].m_GlyphIndex);
+#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
+ charPos[i].m_ExtGID = charPos[i].m_GlyphIndex;
+#endif
+ penX += (float)(charPos[i].m_FontCharWidth) * (float)fontSize / 1000.0f;
+ }
+ FX_Free(pCharCode);
+}
+
+void CBC_OneDimWriter::ShowDeviceChars(CFX_RenderDevice* device,
+ const CFX_Matrix* matrix,
+ const CFX_ByteString str,
+ float geWidth,
+ FXTEXT_CHARPOS* pCharPos,
+ float locX,
+ float locY,
+ int32_t barWidth) {
+ int32_t iFontSize = (int32_t)fabs(m_fFontSize);
+ int32_t iTextHeight = iFontSize + 1;
+ CFX_FloatRect rect((float)locX, (float)locY, (float)(locX + geWidth),
+ (float)(locY + iTextHeight));
+ if (geWidth != m_Width) {
+ rect.right -= 1;
+ }
+ matrix->TransformRect(rect);
+ FX_RECT re = rect.GetOuterRect();
+ device->FillRect(&re, m_backgroundColor);
+ CFX_Matrix affine_matrix(1.0, 0.0, 0.0, -1.0, (float)locX,
+ (float)(locY + iFontSize));
+ if (matrix) {
+ affine_matrix.Concat(*matrix);
+ }
+ device->DrawNormalText(str.GetLength(), pCharPos, m_pFont,
+ static_cast<float>(iFontSize), &affine_matrix,
+ m_fontColor, FXTEXT_CLEARTYPE);
+}
+
+void CBC_OneDimWriter::ShowBitmapChars(
+ const CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
+ const CFX_ByteString str,
+ float geWidth,
+ FXTEXT_CHARPOS* pCharPos,
+ float locX,
+ float locY,
+ int32_t barWidth) {
+ int32_t iFontSize = (int32_t)fabs(m_fFontSize);
+ int32_t iTextHeight = iFontSize + 1;
+ CFX_FxgeDevice ge;
+ ge.Create((int)geWidth, iTextHeight, m_colorSpace, nullptr);
+ FX_RECT geRect(0, 0, (int)geWidth, iTextHeight);
+ ge.FillRect(&geRect, m_backgroundColor);
+ CFX_Matrix affine_matrix(1.0, 0.0, 0.0, -1.0, 0.0,
+ static_cast<float>(iFontSize));
+ ge.DrawNormalText(str.GetLength(), pCharPos, m_pFont,
+ static_cast<float>(iFontSize), &affine_matrix, m_fontColor,
+ FXTEXT_CLEARTYPE);
+ CFX_FxgeDevice geBitmap;
+ geBitmap.Attach(pOutBitmap, false, nullptr, false);
+ geBitmap.SetDIBits(ge.GetBitmap(), (int)locX, (int)locY);
+}
+
+void CBC_OneDimWriter::ShowChars(const CFX_WideStringC& contents,
+ const CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
+ CFX_RenderDevice* device,
+ const CFX_Matrix* matrix,
+ int32_t barWidth,
+ int32_t multiple,
+ int32_t& e) {
+ if (!device && !pOutBitmap) {
+ e = BCExceptionIllegalArgument;
+ return;
+ }
+ if (!m_pFont) {
+ e = BCExceptionNullPointer;
+ return;
+ }
+ CFX_ByteString str = FX_UTF8Encode(contents);
+ int32_t iLen = str.GetLength();
+ FXTEXT_CHARPOS* pCharPos = FX_Alloc(FXTEXT_CHARPOS, iLen);
+ memset(pCharPos, 0, sizeof(FXTEXT_CHARPOS) * iLen);
+ float charsLen = 0;
+ float geWidth = 0;
+ if (m_locTextLoc == BC_TEXT_LOC_ABOVEEMBED ||
+ m_locTextLoc == BC_TEXT_LOC_BELOWEMBED) {
+ geWidth = 0;
+ } else if (m_locTextLoc == BC_TEXT_LOC_ABOVE ||
+ m_locTextLoc == BC_TEXT_LOC_BELOW) {
+ geWidth = (float)barWidth;
+ }
+ int32_t iFontSize = (int32_t)fabs(m_fFontSize);
+ int32_t iTextHeight = iFontSize + 1;
+ CalcTextInfo(str, pCharPos, m_pFont, geWidth, iFontSize, charsLen);
+ if (charsLen < 1) {
+ return;
+ }
+ int32_t locX = 0;
+ int32_t locY = 0;
+ switch (m_locTextLoc) {
+ case BC_TEXT_LOC_ABOVEEMBED:
+ locX = (int32_t)(barWidth - charsLen) / 2;
+ locY = 0;
+ geWidth = charsLen;
+ break;
+ case BC_TEXT_LOC_ABOVE:
+ locX = 0;
+ locY = 0;
+ geWidth = (float)barWidth;
+ break;
+ case BC_TEXT_LOC_BELOWEMBED:
+ locX = (int32_t)(barWidth - charsLen) / 2;
+ locY = m_Height - iTextHeight;
+ geWidth = charsLen;
+ break;
+ case BC_TEXT_LOC_BELOW:
+ default:
+ locX = 0;
+ locY = m_Height - iTextHeight;
+ geWidth = (float)barWidth;
+ break;
+ }
+ if (device) {
+ ShowDeviceChars(device, matrix, str, geWidth, pCharPos, (float)locX,
+ (float)locY, barWidth);
+ } else {
+ ShowBitmapChars(pOutBitmap, str, geWidth, pCharPos, (float)locX,
+ (float)locY, barWidth);
+ }
+ FX_Free(pCharPos);
+}
+
+void CBC_OneDimWriter::RenderBitmapResult(
+ CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
+ const CFX_WideStringC& contents,
+ int32_t& e) {
+ if (!m_output)
+ if (e != BCExceptionNO)
+ return;
+
+ pOutBitmap = CreateDIBitmap(m_output->GetWidth(), m_output->GetHeight());
+ pOutBitmap->Clear(m_backgroundColor);
+ if (!pOutBitmap) {
+ e = BCExceptionFailToCreateBitmap;
+ return;
+ }
+ for (int32_t x = 0; x < m_output->GetWidth(); x++) {
+ for (int32_t y = 0; y < m_output->GetHeight(); y++) {
+ if (m_output->Get(x, y)) {
+ pOutBitmap->SetPixel(x, y, m_barColor);
+ }
+ }
+ }
+ int32_t i = 0;
+ for (; i < contents.GetLength(); i++) {
+ if (contents.GetAt(i) != ' ')
+ break;
+ }
+ if (m_locTextLoc != BC_TEXT_LOC_NONE && i < contents.GetLength()) {
+ ShowChars(contents, pOutBitmap, nullptr, nullptr, m_barWidth, m_multiple,
+ e);
+ if (e != BCExceptionNO)
+ return;
+ }
+ pOutBitmap = pOutBitmap->StretchTo(m_Width, m_Height);
+}
+
+void CBC_OneDimWriter::RenderDeviceResult(CFX_RenderDevice* device,
+ const CFX_Matrix* matrix,
+ const CFX_WideStringC& contents,
+ int32_t& e) {
+ if (!m_output)
+ if (e != BCExceptionNO)
+ return;
+
+ CFX_GraphStateData stateData;
+ CFX_PathData path;
+ path.AppendRect(0, 0, (float)m_Width, (float)m_Height);
+ device->DrawPath(&path, matrix, &stateData, m_backgroundColor,
+ m_backgroundColor, FXFILL_ALTERNATE);
+ CFX_Matrix matri(m_outputHScale, 0.0, 0.0, (float)m_Height, 0.0, 0.0);
+ matri.Concat(*matrix);
+ for (int32_t x = 0; x < m_output->GetWidth(); x++) {
+ for (int32_t y = 0; y < m_output->GetHeight(); y++) {
+ CFX_PathData rect;
+ rect.AppendRect((float)x, (float)y, (float)(x + 1), (float)(y + 1));
+ if (m_output->Get(x, y)) {
+ CFX_GraphStateData data;
+ device->DrawPath(&rect, &matri, &data, m_barColor, 0, FXFILL_WINDING);
+ }
+ }
+ }
+ int32_t i = 0;
+ for (; i < contents.GetLength(); i++)
+ if (contents.GetAt(i) != ' ') {
+ break;
+ }
+ if (m_locTextLoc != BC_TEXT_LOC_NONE && i < contents.GetLength()) {
+ ShowChars(contents, nullptr, device, matrix, m_barWidth, m_multiple, e);
+ if (e != BCExceptionNO)
+ return;
+ }
+}
+
+void CBC_OneDimWriter::RenderResult(const CFX_WideStringC& contents,
+ uint8_t* code,
+ int32_t codeLength,
+ bool isDevice,
+ int32_t& e) {
+ if (codeLength < 1) {
+ if (e != BCExceptionNO)
+ return;
+ }
+ if (m_ModuleHeight < 20.0) {
+ m_ModuleHeight = 20;
+ }
+ int32_t codeOldLength = codeLength;
+ int32_t leftPadding = 0;
+ int32_t rightPadding = 0;
+ if (m_bLeftPadding) {
+ leftPadding = 7;
+ }
+ if (m_bRightPadding) {
+ rightPadding = 7;
+ }
+ codeLength += leftPadding;
+ codeLength += rightPadding;
+ m_outputHScale = 1.0;
+ if (m_Width > 0) {
+ m_outputHScale = (float)m_Width / (float)codeLength;
+ }
+ if (!isDevice) {
+ m_outputHScale =
+ std::max(m_outputHScale, static_cast<float>(m_ModuleWidth));
+ }
+ float dataLengthScale = 1.0;
+ if (m_iDataLenth > 0 && contents.GetLength() != 0) {
+ dataLengthScale = float(contents.GetLength()) / float(m_iDataLenth);
+ }
+ if (m_iDataLenth > 0 && contents.GetLength() == 0) {
+ dataLengthScale = float(1) / float(m_iDataLenth);
+ }
+ m_multiple = 1;
+ if (!isDevice) {
+ m_multiple = (int32_t)ceil(m_outputHScale * dataLengthScale);
+ }
+ int32_t outputHeight = 1;
+ if (!isDevice) {
+ if (m_Height == 0) {
+ outputHeight = std::max(20, m_ModuleHeight);
+ } else {
+ outputHeight = m_Height;
+ }
+ }
+ int32_t outputWidth = codeLength;
+ if (!isDevice) {
+ outputWidth = (int32_t)(codeLength * m_multiple / dataLengthScale);
+ }
+ m_barWidth = m_Width;
+ if (!isDevice) {
+ m_barWidth = codeLength * m_multiple;
+ }
+ m_output = pdfium::MakeUnique<CBC_CommonBitMatrix>();
+ m_output->Init(outputWidth, outputHeight);
+ int32_t outputX = leftPadding * m_multiple;
+ for (int32_t inputX = 0; inputX < codeOldLength; inputX++) {
+ if (code[inputX] == 1) {
+ if (outputX >= outputWidth) {
+ break;
+ }
+ if (outputX + m_multiple > outputWidth && outputWidth - outputX > 0) {
+ if (!m_output->SetRegion(outputX, 0, outputWidth - outputX,
+ outputHeight)) {
+ e = BCExceptionGeneric;
+ }
+ break;
+ }
+ if (!m_output->SetRegion(outputX, 0, m_multiple, outputHeight)) {
+ e = BCExceptionGeneric;
+ return;
+ }
+ }
+ outputX += m_multiple;
+ }
+}
+
+bool CBC_OneDimWriter::CheckContentValidity(const CFX_WideStringC& contents) {
+ return true;
+}
+
+CFX_WideString CBC_OneDimWriter::FilterContents(
+ const CFX_WideStringC& contents) {
+ return CFX_WideString();
+}
+
+CFX_WideString CBC_OneDimWriter::RenderTextContents(
+ const CFX_WideStringC& contents) {
+ return CFX_WideString();
+}
diff --git a/chromium/third_party/pdfium/fxbarcode/oned/BC_OneDimWriter.h b/chromium/third_party/pdfium/fxbarcode/oned/BC_OneDimWriter.h
new file mode 100644
index 00000000000..11a1ed4fdf0
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/oned/BC_OneDimWriter.h
@@ -0,0 +1,118 @@
+// 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 FXBARCODE_ONED_BC_ONEDIMWRITER_H_
+#define FXBARCODE_ONED_BC_ONEDIMWRITER_H_
+
+#include <memory>
+
+#include "core/fxge/cfx_renderdevice.h"
+#include "fxbarcode/BC_Library.h"
+#include "fxbarcode/BC_Writer.h"
+
+class CBC_CommonBitMatrix;
+class CFX_Font;
+class CFX_RenderDevice;
+
+class CBC_OneDimWriter : public CBC_Writer {
+ public:
+ CBC_OneDimWriter();
+ ~CBC_OneDimWriter() override;
+
+ virtual uint8_t* Encode(const CFX_ByteString& contents,
+ BCFORMAT format,
+ int32_t& outWidth,
+ int32_t& outHeight,
+ int32_t& e);
+ virtual uint8_t* Encode(const CFX_ByteString& contents,
+ BCFORMAT format,
+ int32_t& outWidth,
+ int32_t& outHeight,
+ int32_t hints,
+ int32_t& e);
+ virtual uint8_t* Encode(const CFX_ByteString& contents,
+ int32_t& outLength,
+ int32_t& e);
+
+ virtual void RenderResult(const CFX_WideStringC& contents,
+ uint8_t* code,
+ int32_t codeLength,
+ bool isDevice,
+ int32_t& e);
+ virtual void RenderBitmapResult(CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
+ const CFX_WideStringC& contents,
+ int32_t& e);
+ virtual void RenderDeviceResult(CFX_RenderDevice* device,
+ const CFX_Matrix* matrix,
+ const CFX_WideStringC& contents,
+ int32_t& e);
+ virtual bool CheckContentValidity(const CFX_WideStringC& contents);
+ virtual CFX_WideString FilterContents(const CFX_WideStringC& contents);
+ virtual CFX_WideString RenderTextContents(const CFX_WideStringC& contents);
+ virtual void SetPrintChecksum(bool checksum);
+ virtual void SetDataLength(int32_t length);
+ virtual void SetCalcChecksum(bool state);
+ virtual void SetFontSize(float size);
+ virtual void SetFontStyle(int32_t style);
+ virtual void SetFontColor(FX_ARGB color);
+ bool SetFont(CFX_Font* cFont);
+
+ protected:
+ virtual void CalcTextInfo(const CFX_ByteString& text,
+ FXTEXT_CHARPOS* charPos,
+ CFX_Font* cFont,
+ float geWidth,
+ int32_t fontSize,
+ float& charsLen);
+ virtual void ShowChars(const CFX_WideStringC& contents,
+ const CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
+ CFX_RenderDevice* device,
+ const CFX_Matrix* matrix,
+ int32_t barWidth,
+ int32_t multiple,
+ int32_t& e);
+ virtual void ShowBitmapChars(const CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
+ const CFX_ByteString str,
+ float geWidth,
+ FXTEXT_CHARPOS* pCharPos,
+ float locX,
+ float locY,
+ int32_t barWidth);
+ virtual void ShowDeviceChars(CFX_RenderDevice* device,
+ const CFX_Matrix* matrix,
+ const CFX_ByteString str,
+ float geWidth,
+ FXTEXT_CHARPOS* pCharPos,
+ float locX,
+ float locY,
+ int32_t barWidth);
+ virtual int32_t AppendPattern(uint8_t* target,
+ int32_t pos,
+ const int32_t* pattern,
+ int32_t patternLength,
+ int32_t startColor,
+ int32_t& e);
+
+ wchar_t Upper(wchar_t ch);
+
+ bool m_bPrintChecksum;
+ int32_t m_iDataLenth;
+ bool m_bCalcChecksum;
+ CFX_Font* m_pFont;
+ float m_fFontSize;
+ int32_t m_iFontStyle;
+ uint32_t m_fontColor;
+ BC_TEXT_LOC m_locTextLoc;
+ int32_t m_iContentLen;
+ bool m_bLeftPadding;
+ bool m_bRightPadding;
+ std::unique_ptr<CBC_CommonBitMatrix> m_output;
+ int32_t m_barWidth;
+ int32_t m_multiple;
+ float m_outputHScale;
+};
+
+#endif // FXBARCODE_ONED_BC_ONEDIMWRITER_H_
diff --git a/chromium/third_party/pdfium/fxbarcode/oned/BC_OnedCodaBarWriter.cpp b/chromium/third_party/pdfium/fxbarcode/oned/BC_OnedCodaBarWriter.cpp
new file mode 100644
index 00000000000..6c04cafe7bc
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/oned/BC_OnedCodaBarWriter.cpp
@@ -0,0 +1,239 @@
+// 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
+// Original code is licensed as follows:
+/*
+ * Copyright 2011 ZXing authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "fxbarcode/BC_Writer.h"
+#include "fxbarcode/common/BC_CommonBitArray.h"
+#include "fxbarcode/common/BC_CommonBitMatrix.h"
+#include "fxbarcode/oned/BC_OneDimWriter.h"
+#include "fxbarcode/oned/BC_OnedCodaBarWriter.h"
+
+namespace {
+
+const char ALPHABET_STRING[] = "0123456789-$:/.+ABCDTN";
+
+const int32_t CHARACTER_ENCODINGS[22] = {
+ 0x003, 0x006, 0x009, 0x060, 0x012, 0x042, 0x021, 0x024,
+ 0x030, 0x048, 0x00c, 0x018, 0x045, 0x051, 0x054, 0x015,
+ 0x01A, 0x029, 0x00B, 0x00E, 0x01A, 0x029};
+
+const char START_END_CHARS[] = {'A', 'B', 'C', 'D', 'T', 'N', '*', 'E',
+ 'a', 'b', 'c', 'd', 't', 'n', 'e'};
+const char CONTENT_CHARS[] = {'0', '1', '2', '3', '4', '5', '6', '7',
+ '8', '9', '-', '$', '/', ':', '+', '.'};
+
+} // namespace
+
+CBC_OnedCodaBarWriter::CBC_OnedCodaBarWriter() {
+ m_chStart = 'A';
+ m_chEnd = 'B';
+ m_iWideNarrRatio = 2;
+}
+CBC_OnedCodaBarWriter::~CBC_OnedCodaBarWriter() {}
+bool CBC_OnedCodaBarWriter::SetStartChar(char start) {
+ for (size_t i = 0; i < FX_ArraySize(START_END_CHARS); ++i) {
+ if (START_END_CHARS[i] == start) {
+ m_chStart = start;
+ return true;
+ }
+ }
+ return false;
+}
+
+bool CBC_OnedCodaBarWriter::SetEndChar(char end) {
+ for (size_t i = 0; i < FX_ArraySize(START_END_CHARS); ++i) {
+ if (START_END_CHARS[i] == end) {
+ m_chEnd = end;
+ return true;
+ }
+ }
+ return false;
+}
+void CBC_OnedCodaBarWriter::SetDataLength(int32_t length) {
+ m_iDataLenth = length + 2;
+}
+bool CBC_OnedCodaBarWriter::SetTextLocation(BC_TEXT_LOC location) {
+ if (location < BC_TEXT_LOC_NONE || location > BC_TEXT_LOC_BELOWEMBED) {
+ return false;
+ }
+ m_locTextLoc = location;
+ return true;
+}
+bool CBC_OnedCodaBarWriter::SetWideNarrowRatio(int32_t ratio) {
+ if (ratio < 2 || ratio > 3) {
+ return false;
+ }
+ m_iWideNarrRatio = ratio;
+ return true;
+}
+bool CBC_OnedCodaBarWriter::FindChar(wchar_t ch, bool isContent) {
+ if (isContent) {
+ for (size_t i = 0; i < FX_ArraySize(CONTENT_CHARS); ++i) {
+ if (ch == (wchar_t)CONTENT_CHARS[i]) {
+ return true;
+ }
+ }
+ for (size_t j = 0; j < FX_ArraySize(START_END_CHARS); ++j) {
+ if (ch == (wchar_t)START_END_CHARS[j]) {
+ return true;
+ }
+ }
+ return false;
+ } else {
+ for (size_t i = 0; i < FX_ArraySize(CONTENT_CHARS); ++i) {
+ if (ch == (wchar_t)CONTENT_CHARS[i]) {
+ return true;
+ }
+ }
+ return false;
+ }
+}
+bool CBC_OnedCodaBarWriter::CheckContentValidity(
+ const CFX_WideStringC& contents) {
+ wchar_t ch;
+ int32_t index = 0;
+ for (index = 0; index < contents.GetLength(); index++) {
+ ch = contents.GetAt(index);
+ if (FindChar(ch, false)) {
+ continue;
+ } else {
+ return false;
+ }
+ }
+ return true;
+}
+CFX_WideString CBC_OnedCodaBarWriter::FilterContents(
+ const CFX_WideStringC& contents) {
+ CFX_WideString filtercontents;
+ wchar_t ch;
+ for (int32_t index = 0; index < contents.GetLength(); index++) {
+ ch = contents.GetAt(index);
+ if (ch > 175) {
+ index++;
+ continue;
+ }
+ if (FindChar(ch, true)) {
+ filtercontents += ch;
+ } else {
+ continue;
+ }
+ }
+ return filtercontents;
+}
+uint8_t* CBC_OnedCodaBarWriter::Encode(const CFX_ByteString& contents,
+ BCFORMAT format,
+ int32_t& outWidth,
+ int32_t& outHeight,
+ int32_t& e) {
+ uint8_t* ret = Encode(contents, format, outWidth, outHeight, 0, e);
+ if (e != BCExceptionNO)
+ return nullptr;
+ return ret;
+}
+uint8_t* CBC_OnedCodaBarWriter::Encode(const CFX_ByteString& contents,
+ BCFORMAT format,
+ int32_t& outWidth,
+ int32_t& outHeight,
+ int32_t hints,
+ int32_t& e) {
+ if (format != BCFORMAT_CODABAR) {
+ e = BCExceptionOnlyEncodeCODEBAR;
+ return nullptr;
+ }
+ uint8_t* ret =
+ CBC_OneDimWriter::Encode(contents, format, outWidth, outHeight, hints, e);
+ if (e != BCExceptionNO)
+ return nullptr;
+ return ret;
+}
+uint8_t* CBC_OnedCodaBarWriter::Encode(const CFX_ByteString& contents,
+ int32_t& outLength,
+ int32_t& e) {
+ CFX_ByteString data = m_chStart + contents + m_chEnd;
+ m_iContentLen = data.GetLength();
+ uint8_t* result = FX_Alloc2D(uint8_t, m_iWideNarrRatio * 7, data.GetLength());
+ char ch;
+ int32_t position = 0;
+ for (int32_t index = 0; index < data.GetLength(); index++) {
+ ch = data.GetAt(index);
+ if (((ch >= 'a') && (ch <= 'z'))) {
+ ch = ch - 32;
+ }
+ switch (ch) {
+ case 'T':
+ ch = 'A';
+ break;
+ case 'N':
+ ch = 'B';
+ break;
+ case '*':
+ ch = 'C';
+ break;
+ case 'E':
+ ch = 'D';
+ break;
+ default:
+ break;
+ }
+ int32_t code = 0;
+ int32_t len = (int32_t)strlen(ALPHABET_STRING);
+ for (int32_t i = 0; i < len; i++) {
+ if (ch == ALPHABET_STRING[i]) {
+ code = CHARACTER_ENCODINGS[i];
+ break;
+ }
+ }
+ uint8_t color = 1;
+ int32_t counter = 0;
+ int32_t bit = 0;
+ while (bit < 7) {
+ result[position] = color;
+ position++;
+ if (((code >> (6 - bit)) & 1) == 0 || counter == m_iWideNarrRatio - 1) {
+ color = !color;
+ bit++;
+ counter = 0;
+ } else {
+ counter++;
+ }
+ }
+ if (index < data.GetLength() - 1) {
+ result[position] = 0;
+ position++;
+ }
+ }
+ outLength = position;
+ return result;
+}
+CFX_WideString CBC_OnedCodaBarWriter::encodedContents(
+ const CFX_WideStringC& contents) {
+ CFX_WideString strStart(m_chStart);
+ CFX_WideString strEnd(m_chEnd);
+ return strStart + contents + strEnd;
+}
+void CBC_OnedCodaBarWriter::RenderResult(const CFX_WideStringC& contents,
+ uint8_t* code,
+ int32_t codeLength,
+ bool isDevice,
+ int32_t& e) {
+ CBC_OneDimWriter::RenderResult(encodedContents(contents).AsStringC(), code,
+ codeLength, isDevice, e);
+}
diff --git a/chromium/third_party/pdfium/fxbarcode/oned/BC_OnedCodaBarWriter.h b/chromium/third_party/pdfium/fxbarcode/oned/BC_OnedCodaBarWriter.h
new file mode 100644
index 00000000000..f9ecc1b11ac
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/oned/BC_OnedCodaBarWriter.h
@@ -0,0 +1,58 @@
+// 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 FXBARCODE_ONED_BC_ONEDCODABARWRITER_H_
+#define FXBARCODE_ONED_BC_ONEDCODABARWRITER_H_
+
+#include "core/fxcrt/fx_string.h"
+#include "core/fxcrt/fx_system.h"
+#include "fxbarcode/BC_Library.h"
+#include "fxbarcode/oned/BC_OneDimWriter.h"
+
+class CBC_OnedCodaBarWriter : public CBC_OneDimWriter {
+ public:
+ CBC_OnedCodaBarWriter();
+ ~CBC_OnedCodaBarWriter() override;
+
+ // CBC_OneDimWriter
+ uint8_t* Encode(const CFX_ByteString& contents,
+ int32_t& outLength,
+ int32_t& e) override;
+ uint8_t* Encode(const CFX_ByteString& contents,
+ BCFORMAT format,
+ int32_t& outWidth,
+ int32_t& outHeight,
+ int32_t& e) override;
+ uint8_t* Encode(const CFX_ByteString& contents,
+ BCFORMAT format,
+ int32_t& outWidth,
+ int32_t& outHeight,
+ int32_t hints,
+ int32_t& e) override;
+ bool CheckContentValidity(const CFX_WideStringC& contents) override;
+ CFX_WideString FilterContents(const CFX_WideStringC& contents) override;
+ void SetDataLength(int32_t length) override;
+
+ virtual CFX_WideString encodedContents(const CFX_WideStringC& contents);
+ virtual bool SetStartChar(char start);
+ virtual bool SetEndChar(char end);
+ virtual bool SetTextLocation(BC_TEXT_LOC location);
+ virtual bool SetWideNarrowRatio(int32_t ratio);
+ virtual bool FindChar(wchar_t ch, bool isContent);
+
+ private:
+ void RenderResult(const CFX_WideStringC& contents,
+ uint8_t* code,
+ int32_t codeLength,
+ bool isDevice,
+ int32_t& e) override;
+
+ char m_chStart;
+ char m_chEnd;
+ int32_t m_iWideNarrRatio;
+};
+
+#endif // FXBARCODE_ONED_BC_ONEDCODABARWRITER_H_
diff --git a/chromium/third_party/pdfium/fxbarcode/oned/BC_OnedCode128Writer.cpp b/chromium/third_party/pdfium/fxbarcode/oned/BC_OnedCode128Writer.cpp
new file mode 100644
index 00000000000..53f4d01449a
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/oned/BC_OnedCode128Writer.cpp
@@ -0,0 +1,276 @@
+// 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
+// Original code is licensed as follows:
+/*
+ * Copyright 2010 ZXing authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "fxbarcode/BC_Writer.h"
+#include "fxbarcode/oned/BC_OneDimWriter.h"
+#include "fxbarcode/oned/BC_OnedCode128Writer.h"
+
+namespace {
+
+const int32_t CODE_PATTERNS[107][7] = {
+ {2, 1, 2, 2, 2, 2, 0}, {2, 2, 2, 1, 2, 2, 0}, {2, 2, 2, 2, 2, 1, 0},
+ {1, 2, 1, 2, 2, 3, 0}, {1, 2, 1, 3, 2, 2, 0}, {1, 3, 1, 2, 2, 2, 0},
+ {1, 2, 2, 2, 1, 3, 0}, {1, 2, 2, 3, 1, 2, 0}, {1, 3, 2, 2, 1, 2, 0},
+ {2, 2, 1, 2, 1, 3, 0}, {2, 2, 1, 3, 1, 2, 0}, {2, 3, 1, 2, 1, 2, 0},
+ {1, 1, 2, 2, 3, 2, 0}, {1, 2, 2, 1, 3, 2, 0}, {1, 2, 2, 2, 3, 1, 0},
+ {1, 1, 3, 2, 2, 2, 0}, {1, 2, 3, 1, 2, 2, 0}, {1, 2, 3, 2, 2, 1, 0},
+ {2, 2, 3, 2, 1, 1, 0}, {2, 2, 1, 1, 3, 2, 0}, {2, 2, 1, 2, 3, 1, 0},
+ {2, 1, 3, 2, 1, 2, 0}, {2, 2, 3, 1, 1, 2, 0}, {3, 1, 2, 1, 3, 1, 0},
+ {3, 1, 1, 2, 2, 2, 0}, {3, 2, 1, 1, 2, 2, 0}, {3, 2, 1, 2, 2, 1, 0},
+ {3, 1, 2, 2, 1, 2, 0}, {3, 2, 2, 1, 1, 2, 0}, {3, 2, 2, 2, 1, 1, 0},
+ {2, 1, 2, 1, 2, 3, 0}, {2, 1, 2, 3, 2, 1, 0}, {2, 3, 2, 1, 2, 1, 0},
+ {1, 1, 1, 3, 2, 3, 0}, {1, 3, 1, 1, 2, 3, 0}, {1, 3, 1, 3, 2, 1, 0},
+ {1, 1, 2, 3, 1, 3, 0}, {1, 3, 2, 1, 1, 3, 0}, {1, 3, 2, 3, 1, 1, 0},
+ {2, 1, 1, 3, 1, 3, 0}, {2, 3, 1, 1, 1, 3, 0}, {2, 3, 1, 3, 1, 1, 0},
+ {1, 1, 2, 1, 3, 3, 0}, {1, 1, 2, 3, 3, 1, 0}, {1, 3, 2, 1, 3, 1, 0},
+ {1, 1, 3, 1, 2, 3, 0}, {1, 1, 3, 3, 2, 1, 0}, {1, 3, 3, 1, 2, 1, 0},
+ {3, 1, 3, 1, 2, 1, 0}, {2, 1, 1, 3, 3, 1, 0}, {2, 3, 1, 1, 3, 1, 0},
+ {2, 1, 3, 1, 1, 3, 0}, {2, 1, 3, 3, 1, 1, 0}, {2, 1, 3, 1, 3, 1, 0},
+ {3, 1, 1, 1, 2, 3, 0}, {3, 1, 1, 3, 2, 1, 0}, {3, 3, 1, 1, 2, 1, 0},
+ {3, 1, 2, 1, 1, 3, 0}, {3, 1, 2, 3, 1, 1, 0}, {3, 3, 2, 1, 1, 1, 0},
+ {3, 1, 4, 1, 1, 1, 0}, {2, 2, 1, 4, 1, 1, 0}, {4, 3, 1, 1, 1, 1, 0},
+ {1, 1, 1, 2, 2, 4, 0}, {1, 1, 1, 4, 2, 2, 0}, {1, 2, 1, 1, 2, 4, 0},
+ {1, 2, 1, 4, 2, 1, 0}, {1, 4, 1, 1, 2, 2, 0}, {1, 4, 1, 2, 2, 1, 0},
+ {1, 1, 2, 2, 1, 4, 0}, {1, 1, 2, 4, 1, 2, 0}, {1, 2, 2, 1, 1, 4, 0},
+ {1, 2, 2, 4, 1, 1, 0}, {1, 4, 2, 1, 1, 2, 0}, {1, 4, 2, 2, 1, 1, 0},
+ {2, 4, 1, 2, 1, 1, 0}, {2, 2, 1, 1, 1, 4, 0}, {4, 1, 3, 1, 1, 1, 0},
+ {2, 4, 1, 1, 1, 2, 0}, {1, 3, 4, 1, 1, 1, 0}, {1, 1, 1, 2, 4, 2, 0},
+ {1, 2, 1, 1, 4, 2, 0}, {1, 2, 1, 2, 4, 1, 0}, {1, 1, 4, 2, 1, 2, 0},
+ {1, 2, 4, 1, 1, 2, 0}, {1, 2, 4, 2, 1, 1, 0}, {4, 1, 1, 2, 1, 2, 0},
+ {4, 2, 1, 1, 1, 2, 0}, {4, 2, 1, 2, 1, 1, 0}, {2, 1, 2, 1, 4, 1, 0},
+ {2, 1, 4, 1, 2, 1, 0}, {4, 1, 2, 1, 2, 1, 0}, {1, 1, 1, 1, 4, 3, 0},
+ {1, 1, 1, 3, 4, 1, 0}, {1, 3, 1, 1, 4, 1, 0}, {1, 1, 4, 1, 1, 3, 0},
+ {1, 1, 4, 3, 1, 1, 0}, {4, 1, 1, 1, 1, 3, 0}, {4, 1, 1, 3, 1, 1, 0},
+ {1, 1, 3, 1, 4, 1, 0}, {1, 1, 4, 1, 3, 1, 0}, {3, 1, 1, 1, 4, 1, 0},
+ {4, 1, 1, 1, 3, 1, 0}, {2, 1, 1, 4, 1, 2, 0}, {2, 1, 1, 2, 1, 4, 0},
+ {2, 1, 1, 2, 3, 2, 0}, {2, 3, 3, 1, 1, 1, 2}};
+
+const int32_t CODE_START_B = 104;
+const int32_t CODE_START_C = 105;
+const int32_t CODE_STOP = 106;
+
+} // namespace
+
+CBC_OnedCode128Writer::CBC_OnedCode128Writer() {
+ m_codeFormat = BC_CODE128_B;
+}
+CBC_OnedCode128Writer::CBC_OnedCode128Writer(BC_TYPE type) {
+ m_codeFormat = type;
+}
+CBC_OnedCode128Writer::~CBC_OnedCode128Writer() {}
+BC_TYPE CBC_OnedCode128Writer::GetType() {
+ return m_codeFormat;
+}
+bool CBC_OnedCode128Writer::CheckContentValidity(
+ const CFX_WideStringC& contents) {
+ bool ret = true;
+ int32_t position = 0;
+ int32_t patternIndex = -1;
+ if (m_codeFormat == BC_CODE128_B || m_codeFormat == BC_CODE128_C) {
+ while (position < contents.GetLength()) {
+ patternIndex = (int32_t)contents.GetAt(position);
+ if (patternIndex < 32 || patternIndex > 126 || patternIndex == 34) {
+ ret = false;
+ break;
+ }
+ position++;
+ }
+ } else {
+ ret = false;
+ }
+ return ret;
+}
+CFX_WideString CBC_OnedCode128Writer::FilterContents(
+ const CFX_WideStringC& contents) {
+ CFX_WideString filterChineseChar;
+ wchar_t ch;
+ for (int32_t i = 0; i < contents.GetLength(); i++) {
+ ch = contents.GetAt(i);
+ if (ch > 175) {
+ i++;
+ continue;
+ }
+ filterChineseChar += ch;
+ }
+ CFX_WideString filtercontents;
+ if (m_codeFormat == BC_CODE128_B) {
+ for (int32_t i = 0; i < filterChineseChar.GetLength(); i++) {
+ ch = filterChineseChar.GetAt(i);
+ if (ch >= 32 && ch <= 126) {
+ filtercontents += ch;
+ } else {
+ continue;
+ }
+ }
+ } else if (m_codeFormat == BC_CODE128_C) {
+ for (int32_t i = 0; i < filterChineseChar.GetLength(); i++) {
+ ch = filterChineseChar.GetAt(i);
+ if (ch >= 32 && ch <= 106) {
+ filtercontents += ch;
+ } else {
+ continue;
+ }
+ }
+ } else {
+ filtercontents = contents;
+ }
+ return filtercontents;
+}
+bool CBC_OnedCode128Writer::SetTextLocation(BC_TEXT_LOC location) {
+ if (location < BC_TEXT_LOC_NONE || location > BC_TEXT_LOC_BELOWEMBED) {
+ return false;
+ }
+ m_locTextLoc = location;
+ return true;
+}
+uint8_t* CBC_OnedCode128Writer::Encode(const CFX_ByteString& contents,
+ BCFORMAT format,
+ int32_t& outWidth,
+ int32_t& outHeight,
+ int32_t hints,
+ int32_t& e) {
+ if (format != BCFORMAT_CODE_128) {
+ e = BCExceptionOnlyEncodeCODE_128;
+ return nullptr;
+ }
+ uint8_t* ret =
+ CBC_OneDimWriter::Encode(contents, format, outWidth, outHeight, hints, e);
+ if (e != BCExceptionNO)
+ return nullptr;
+ return ret;
+}
+uint8_t* CBC_OnedCode128Writer::Encode(const CFX_ByteString& contents,
+ BCFORMAT format,
+ int32_t& outWidth,
+ int32_t& outHeight,
+ int32_t& e) {
+ uint8_t* ret = Encode(contents, format, outWidth, outHeight, 0, e);
+ if (e != BCExceptionNO)
+ return nullptr;
+ return ret;
+}
+bool CBC_OnedCode128Writer::IsDigits(const CFX_ByteString& contents,
+ int32_t start,
+ int32_t length) {
+ int32_t end = start + length;
+ for (int32_t i = start; i < end; i++) {
+ if (contents[i] < '0' || contents[i] > '9') {
+ return false;
+ }
+ }
+ return true;
+}
+
+uint8_t* CBC_OnedCode128Writer::Encode(const CFX_ByteString& contents,
+ int32_t& outLength,
+ int32_t& e) {
+ if (contents.GetLength() < 1 || contents.GetLength() > 80) {
+ e = BCExceptionGeneric;
+ return nullptr;
+ }
+ std::vector<const int32_t*> patterns;
+ int32_t checkSum = 0;
+ if (m_codeFormat == BC_CODE128_B) {
+ checkSum = Encode128B(contents, &patterns);
+ } else if (m_codeFormat == BC_CODE128_C) {
+ checkSum = Encode128C(contents, &patterns);
+ } else {
+ e = BCExceptionFormatException;
+ return nullptr;
+ }
+ checkSum %= 103;
+ patterns.push_back(CODE_PATTERNS[checkSum]);
+ patterns.push_back(CODE_PATTERNS[CODE_STOP]);
+ m_iContentLen = contents.GetLength() + 3;
+ int32_t codeWidth = 0;
+ for (size_t k = 0; k < patterns.size(); k++) {
+ const int32_t* pattern = patterns[k];
+ for (size_t j = 0; j < 7; j++) {
+ codeWidth += pattern[j];
+ }
+ }
+ outLength = codeWidth;
+ uint8_t* result = FX_Alloc(uint8_t, outLength);
+ int32_t pos = 0;
+ for (size_t j = 0; j < patterns.size(); j++) {
+ const int32_t* pattern = patterns[j];
+ pos += AppendPattern(result, pos, pattern, 7, 1, e);
+ if (e != BCExceptionNO) {
+ FX_Free(result);
+ return nullptr;
+ }
+ }
+ return result;
+}
+
+int32_t CBC_OnedCode128Writer::Encode128B(
+ const CFX_ByteString& contents,
+ std::vector<const int32_t*>* patterns) {
+ int32_t checkSum = 0;
+ int32_t checkWeight = 1;
+ int32_t position = 0;
+ patterns->push_back(CODE_PATTERNS[CODE_START_B]);
+ checkSum += CODE_START_B * checkWeight;
+ while (position < contents.GetLength()) {
+ int32_t patternIndex = 0;
+ patternIndex = contents[position] - ' ';
+ position += 1;
+ patterns->push_back(CODE_PATTERNS[patternIndex]);
+ checkSum += patternIndex * checkWeight;
+ if (position != 0) {
+ checkWeight++;
+ }
+ }
+ return checkSum;
+}
+
+int32_t CBC_OnedCode128Writer::Encode128C(
+ const CFX_ByteString& contents,
+ std::vector<const int32_t*>* patterns) {
+ int32_t checkSum = 0;
+ int32_t checkWeight = 1;
+ int32_t position = 0;
+ patterns->push_back(CODE_PATTERNS[CODE_START_C]);
+ checkSum += CODE_START_C * checkWeight;
+ while (position < contents.GetLength()) {
+ int32_t patternIndex = 0;
+ char ch = contents.GetAt(position);
+ if (ch < '0' || ch > '9') {
+ patternIndex = (int32_t)ch;
+ position++;
+ } else {
+ patternIndex = FXSYS_atoi(contents.Mid(position, 2).c_str());
+ if (contents.GetAt(position + 1) < '0' ||
+ contents.GetAt(position + 1) > '9') {
+ position += 1;
+ } else {
+ position += 2;
+ }
+ }
+ patterns->push_back(CODE_PATTERNS[patternIndex]);
+ checkSum += patternIndex * checkWeight;
+ if (position != 0) {
+ checkWeight++;
+ }
+ }
+ return checkSum;
+}
diff --git a/chromium/third_party/pdfium/fxbarcode/oned/BC_OnedCode128Writer.h b/chromium/third_party/pdfium/fxbarcode/oned/BC_OnedCode128Writer.h
new file mode 100644
index 00000000000..34b22876b66
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/oned/BC_OnedCode128Writer.h
@@ -0,0 +1,55 @@
+// 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 FXBARCODE_ONED_BC_ONEDCODE128WRITER_H_
+#define FXBARCODE_ONED_BC_ONEDCODE128WRITER_H_
+
+#include <vector>
+
+#include "core/fxcrt/fx_string.h"
+#include "core/fxcrt/fx_system.h"
+#include "fxbarcode/oned/BC_OneDimWriter.h"
+
+class CBC_OnedCode128Writer : public CBC_OneDimWriter {
+ public:
+ CBC_OnedCode128Writer();
+ explicit CBC_OnedCode128Writer(BC_TYPE type);
+ ~CBC_OnedCode128Writer() override;
+
+ // CBC_OneDimWriter
+ uint8_t* Encode(const CFX_ByteString& contents,
+ BCFORMAT format,
+ int32_t& outWidth,
+ int32_t& outHeight,
+ int32_t hints,
+ int32_t& e) override;
+ uint8_t* Encode(const CFX_ByteString& contents,
+ BCFORMAT format,
+ int32_t& outWidth,
+ int32_t& outHeight,
+ int32_t& e) override;
+ uint8_t* Encode(const CFX_ByteString& contents,
+ int32_t& outLength,
+ int32_t& e) override;
+
+ bool CheckContentValidity(const CFX_WideStringC& contents) override;
+ CFX_WideString FilterContents(const CFX_WideStringC& contents) override;
+
+ bool SetTextLocation(BC_TEXT_LOC location);
+
+ BC_TYPE GetType();
+
+ private:
+ bool IsDigits(const CFX_ByteString& contents, int32_t start, int32_t length);
+ int32_t Encode128B(const CFX_ByteString& contents,
+ std::vector<const int32_t*>* patterns);
+ int32_t Encode128C(const CFX_ByteString& contents,
+ std::vector<const int32_t*>* patterns);
+
+ BC_TYPE m_codeFormat;
+};
+
+#endif // FXBARCODE_ONED_BC_ONEDCODE128WRITER_H_
diff --git a/chromium/third_party/pdfium/fxbarcode/oned/BC_OnedCode39Writer.cpp b/chromium/third_party/pdfium/fxbarcode/oned/BC_OnedCode39Writer.cpp
new file mode 100644
index 00000000000..bcc64d83bd0
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/oned/BC_OnedCode39Writer.cpp
@@ -0,0 +1,281 @@
+// 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
+// Original code is licensed as follows:
+/*
+ * Copyright 2010 ZXing authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "fxbarcode/BC_Writer.h"
+#include "fxbarcode/common/BC_CommonBitMatrix.h"
+#include "fxbarcode/oned/BC_OneDimWriter.h"
+#include "fxbarcode/oned/BC_OnedCode39Writer.h"
+
+namespace {
+
+const char ALPHABET_STRING[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. *$/+%";
+
+const char CHECKSUM_STRING[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%";
+
+const int32_t CHARACTER_ENCODINGS[44] = {
+ 0x034, 0x121, 0x061, 0x160, 0x031, 0x130, 0x070, 0x025, 0x124,
+ 0x064, 0x109, 0x049, 0x148, 0x019, 0x118, 0x058, 0x00D, 0x10C,
+ 0x04C, 0x01C, 0x103, 0x043, 0x142, 0x013, 0x112, 0x052, 0x007,
+ 0x106, 0x046, 0x016, 0x181, 0x0C1, 0x1C0, 0x091, 0x190, 0x0D0,
+ 0x085, 0x184, 0x0C4, 0x094, 0x0A8, 0x0A2, 0x08A, 0x02A};
+
+} // namespace
+
+CBC_OnedCode39Writer::CBC_OnedCode39Writer() {
+ m_iWideNarrRatio = 3;
+}
+CBC_OnedCode39Writer::~CBC_OnedCode39Writer() {}
+bool CBC_OnedCode39Writer::CheckContentValidity(
+ const CFX_WideStringC& contents) {
+ for (int32_t i = 0; i < contents.GetLength(); i++) {
+ wchar_t ch = contents.GetAt(i);
+ if ((ch >= (wchar_t)'0' && ch <= (wchar_t)'9') ||
+ (ch >= (wchar_t)'A' && ch <= (wchar_t)'Z') || ch == (wchar_t)'-' ||
+ ch == (wchar_t)'.' || ch == (wchar_t)' ' || ch == (wchar_t)'*' ||
+ ch == (wchar_t)'$' || ch == (wchar_t)'/' || ch == (wchar_t)'+' ||
+ ch == (wchar_t)'%') {
+ continue;
+ }
+ return false;
+ }
+ return true;
+}
+
+CFX_WideString CBC_OnedCode39Writer::FilterContents(
+ const CFX_WideStringC& contents) {
+ CFX_WideString filtercontents;
+ for (int32_t i = 0; i < contents.GetLength(); i++) {
+ wchar_t ch = contents.GetAt(i);
+ if (ch == (wchar_t)'*' && (i == 0 || i == contents.GetLength() - 1)) {
+ continue;
+ }
+ if (ch > 175) {
+ i++;
+ continue;
+ } else {
+ ch = Upper(ch);
+ }
+ if ((ch >= (wchar_t)'0' && ch <= (wchar_t)'9') ||
+ (ch >= (wchar_t)'A' && ch <= (wchar_t)'Z') || ch == (wchar_t)'-' ||
+ ch == (wchar_t)'.' || ch == (wchar_t)' ' || ch == (wchar_t)'*' ||
+ ch == (wchar_t)'$' || ch == (wchar_t)'/' || ch == (wchar_t)'+' ||
+ ch == (wchar_t)'%') {
+ filtercontents += ch;
+ }
+ }
+ return filtercontents;
+}
+
+CFX_WideString CBC_OnedCode39Writer::RenderTextContents(
+ const CFX_WideStringC& contents) {
+ CFX_WideString renderContents;
+ for (int32_t i = 0; i < contents.GetLength(); i++) {
+ wchar_t ch = contents.GetAt(i);
+ if (ch == (wchar_t)'*' && (i == 0 || i == contents.GetLength() - 1)) {
+ continue;
+ }
+ if (ch > 175) {
+ i++;
+ continue;
+ }
+ if ((ch >= (wchar_t)'0' && ch <= (wchar_t)'9') ||
+ (ch >= (wchar_t)'A' && ch <= (wchar_t)'Z') ||
+ (ch >= (wchar_t)'a' && ch <= (wchar_t)'z') || ch == (wchar_t)'-' ||
+ ch == (wchar_t)'.' || ch == (wchar_t)' ' || ch == (wchar_t)'*' ||
+ ch == (wchar_t)'$' || ch == (wchar_t)'/' || ch == (wchar_t)'+' ||
+ ch == (wchar_t)'%') {
+ renderContents += ch;
+ }
+ }
+ return renderContents;
+}
+
+bool CBC_OnedCode39Writer::SetTextLocation(BC_TEXT_LOC location) {
+ if (location < BC_TEXT_LOC_NONE || location > BC_TEXT_LOC_BELOWEMBED) {
+ return false;
+ }
+ m_locTextLoc = location;
+ return true;
+}
+bool CBC_OnedCode39Writer::SetWideNarrowRatio(int32_t ratio) {
+ if (ratio < 2 || ratio > 3) {
+ return false;
+ }
+ m_iWideNarrRatio = ratio;
+ return true;
+}
+uint8_t* CBC_OnedCode39Writer::Encode(const CFX_ByteString& contents,
+ BCFORMAT format,
+ int32_t& outWidth,
+ int32_t& outHeight,
+ int32_t& e) {
+ uint8_t* ret = Encode(contents, format, outWidth, outHeight, 0, e);
+ if (e != BCExceptionNO)
+ return nullptr;
+ return ret;
+}
+uint8_t* CBC_OnedCode39Writer::Encode(const CFX_ByteString& contents,
+ BCFORMAT format,
+ int32_t& outWidth,
+ int32_t& outHeight,
+ int32_t hints,
+ int32_t& e) {
+ if (format != BCFORMAT_CODE_39) {
+ e = BCExceptionOnlyEncodeCODE_39;
+ return nullptr;
+ }
+ uint8_t* ret =
+ CBC_OneDimWriter::Encode(contents, format, outWidth, outHeight, hints, e);
+ if (e != BCExceptionNO)
+ return nullptr;
+ return ret;
+}
+void CBC_OnedCode39Writer::ToIntArray(int32_t a, int32_t* toReturn) {
+ for (int32_t i = 0; i < 9; i++) {
+ toReturn[i] = (a & (1 << i)) == 0 ? 1 : m_iWideNarrRatio;
+ }
+}
+char CBC_OnedCode39Writer::CalcCheckSum(const CFX_ByteString& contents,
+ int32_t& e) {
+ int32_t length = contents.GetLength();
+ if (length > 80) {
+ e = BCExceptionGeneric;
+ return '*';
+ }
+ int32_t checksum = 0;
+ int32_t len = (int32_t)strlen(ALPHABET_STRING);
+ for (int32_t i = 0; i < contents.GetLength(); i++) {
+ int32_t j = 0;
+ for (; j < len; j++) {
+ if (ALPHABET_STRING[j] == contents[i]) {
+ if (contents[i] != '*')
+ checksum += j;
+ break;
+ }
+ }
+ if (j >= len) {
+ e = BCExceptionGeneric;
+ return '*';
+ }
+ }
+ checksum = checksum % 43;
+ return CHECKSUM_STRING[checksum];
+}
+uint8_t* CBC_OnedCode39Writer::Encode(const CFX_ByteString& contents,
+ int32_t& outlength,
+ int32_t& e) {
+ char checksum = CalcCheckSum(contents, e);
+ if (checksum == '*') {
+ return nullptr;
+ }
+ int32_t widths[9] = {0};
+ int32_t wideStrideNum = 3;
+ int32_t narrStrideNum = 9 - wideStrideNum;
+ CFX_ByteString encodedContents = contents;
+ if (m_bCalcChecksum) {
+ encodedContents += checksum;
+ }
+ m_iContentLen = encodedContents.GetLength();
+ int32_t codeWidth = (wideStrideNum * m_iWideNarrRatio + narrStrideNum) * 2 +
+ 1 + m_iContentLen;
+ int32_t len = (int32_t)strlen(ALPHABET_STRING);
+ for (int32_t j = 0; j < m_iContentLen; j++) {
+ for (int32_t i = 0; i < len; i++) {
+ if (ALPHABET_STRING[i] == encodedContents[j]) {
+ ToIntArray(CHARACTER_ENCODINGS[i], widths);
+ for (int32_t k = 0; k < 9; k++) {
+ codeWidth += widths[k];
+ }
+ }
+ }
+ }
+ outlength = codeWidth;
+ uint8_t* result = FX_Alloc(uint8_t, codeWidth);
+ ToIntArray(CHARACTER_ENCODINGS[39], widths);
+ int32_t pos = AppendPattern(result, 0, widths, 9, 1, e);
+ if (e != BCExceptionNO) {
+ FX_Free(result);
+ return nullptr;
+ }
+ int32_t narrowWhite[] = {1};
+ pos += AppendPattern(result, pos, narrowWhite, 1, 0, e);
+ if (e != BCExceptionNO) {
+ FX_Free(result);
+ return nullptr;
+ }
+ for (int32_t l = m_iContentLen - 1; l >= 0; l--) {
+ for (int32_t i = 0; i < len; i++) {
+ if (ALPHABET_STRING[i] == encodedContents[l]) {
+ ToIntArray(CHARACTER_ENCODINGS[i], widths);
+ pos += AppendPattern(result, pos, widths, 9, 1, e);
+ if (e != BCExceptionNO) {
+ FX_Free(result);
+ return nullptr;
+ }
+ }
+ }
+ pos += AppendPattern(result, pos, narrowWhite, 1, 0, e);
+ if (e != BCExceptionNO) {
+ FX_Free(result);
+ return nullptr;
+ }
+ }
+ ToIntArray(CHARACTER_ENCODINGS[39], widths);
+ pos += AppendPattern(result, pos, widths, 9, 1, e);
+ if (e != BCExceptionNO) {
+ FX_Free(result);
+ return nullptr;
+ }
+ for (int32_t i = 0; i < codeWidth / 2; i++) {
+ result[i] ^= result[codeWidth - 1 - i];
+ result[codeWidth - 1 - i] ^= result[i];
+ result[i] ^= result[codeWidth - 1 - i];
+ }
+ return result;
+}
+CFX_WideString CBC_OnedCode39Writer::encodedContents(
+ const CFX_WideStringC& contents,
+ int32_t& e) {
+ CFX_WideString encodedContents(contents);
+ if (m_bCalcChecksum && m_bPrintChecksum) {
+ CFX_WideString checksumContent = FilterContents(contents);
+ CFX_ByteString str = checksumContent.UTF8Encode();
+ char checksum;
+ checksum = CalcCheckSum(str, e);
+ if (e != BCExceptionNO)
+ return CFX_WideString();
+ str += checksum;
+ encodedContents += checksum;
+ }
+ return encodedContents;
+}
+void CBC_OnedCode39Writer::RenderResult(const CFX_WideStringC& contents,
+ uint8_t* code,
+ int32_t codeLength,
+ bool isDevice,
+ int32_t& e) {
+ CFX_WideString encodedCon = encodedContents(contents, e);
+ if (e != BCExceptionNO)
+ return;
+ CBC_OneDimWriter::RenderResult(encodedCon.AsStringC(), code, codeLength,
+ isDevice, e);
+}
diff --git a/chromium/third_party/pdfium/fxbarcode/oned/BC_OnedCode39Writer.h b/chromium/third_party/pdfium/fxbarcode/oned/BC_OnedCode39Writer.h
new file mode 100644
index 00000000000..6926d93f20e
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/oned/BC_OnedCode39Writer.h
@@ -0,0 +1,54 @@
+// 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 FXBARCODE_ONED_BC_ONEDCODE39WRITER_H_
+#define FXBARCODE_ONED_BC_ONEDCODE39WRITER_H_
+
+#include "fxbarcode/BC_Library.h"
+#include "fxbarcode/oned/BC_OneDimWriter.h"
+
+class CBC_OnedCode39Writer : public CBC_OneDimWriter {
+ public:
+ CBC_OnedCode39Writer();
+ ~CBC_OnedCode39Writer() override;
+
+ // CBC_OneDimWriter
+ uint8_t* Encode(const CFX_ByteString& contents,
+ BCFORMAT format,
+ int32_t& outWidth,
+ int32_t& outHeight,
+ int32_t& e) override;
+ uint8_t* Encode(const CFX_ByteString& contents,
+ BCFORMAT format,
+ int32_t& outWidth,
+ int32_t& outHeight,
+ int32_t hints,
+ int32_t& e) override;
+ uint8_t* Encode(const CFX_ByteString& contents,
+ int32_t& outLength,
+ int32_t& e) override;
+ void RenderResult(const CFX_WideStringC& contents,
+ uint8_t* code,
+ int32_t codeLength,
+ bool isDevice,
+ int32_t& e) override;
+ bool CheckContentValidity(const CFX_WideStringC& contents) override;
+ CFX_WideString FilterContents(const CFX_WideStringC& contents) override;
+ CFX_WideString RenderTextContents(const CFX_WideStringC& contents) override;
+
+ virtual CFX_WideString encodedContents(const CFX_WideStringC& contents,
+ int32_t& e);
+ virtual bool SetTextLocation(BC_TEXT_LOC loction);
+ virtual bool SetWideNarrowRatio(int32_t ratio);
+
+ private:
+ void ToIntArray(int32_t a, int32_t* toReturn);
+ char CalcCheckSum(const CFX_ByteString& contents, int32_t& e);
+
+ int32_t m_iWideNarrRatio;
+};
+
+#endif // FXBARCODE_ONED_BC_ONEDCODE39WRITER_H_
diff --git a/chromium/third_party/pdfium/fxbarcode/oned/BC_OnedEAN13Writer.cpp b/chromium/third_party/pdfium/fxbarcode/oned/BC_OnedEAN13Writer.cpp
new file mode 100644
index 00000000000..21b0f9a63f7
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/oned/BC_OnedEAN13Writer.cpp
@@ -0,0 +1,306 @@
+// 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
+// Original code is licensed as follows:
+/*
+ * Copyright 2009 ZXing authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "core/fxge/cfx_fxgedevice.h"
+#include "core/fxge/cfx_gemodule.h"
+#include "fxbarcode/BC_Writer.h"
+#include "fxbarcode/oned/BC_OneDimWriter.h"
+#include "fxbarcode/oned/BC_OnedEAN13Writer.h"
+
+namespace {
+
+const int32_t FIRST_DIGIT_ENCODINGS[10] = {0x00, 0x0B, 0x0D, 0xE, 0x13,
+ 0x19, 0x1C, 0x15, 0x16, 0x1A};
+const int32_t START_END_PATTERN[3] = {1, 1, 1};
+const int32_t MIDDLE_PATTERN[5] = {1, 1, 1, 1, 1};
+const int32_t L_PATTERNS[10][4] = {
+ {3, 2, 1, 1}, {2, 2, 2, 1}, {2, 1, 2, 2}, {1, 4, 1, 1}, {1, 1, 3, 2},
+ {1, 2, 3, 1}, {1, 1, 1, 4}, {1, 3, 1, 2}, {1, 2, 1, 3}, {3, 1, 1, 2}};
+const int32_t L_AND_G_PATTERNS[20][4] = {
+ {3, 2, 1, 1}, {2, 2, 2, 1}, {2, 1, 2, 2}, {1, 4, 1, 1}, {1, 1, 3, 2},
+ {1, 2, 3, 1}, {1, 1, 1, 4}, {1, 3, 1, 2}, {1, 2, 1, 3}, {3, 1, 1, 2},
+ {1, 1, 2, 3}, {1, 2, 2, 2}, {2, 2, 1, 2}, {1, 1, 4, 1}, {2, 3, 1, 1},
+ {1, 3, 2, 1}, {4, 1, 1, 1}, {2, 1, 3, 1}, {3, 1, 2, 1}, {2, 1, 1, 3}};
+
+} // namespace
+
+CBC_OnedEAN13Writer::CBC_OnedEAN13Writer() {
+ m_bLeftPadding = true;
+ m_codeWidth = 3 + (7 * 6) + 5 + (7 * 6) + 3;
+}
+CBC_OnedEAN13Writer::~CBC_OnedEAN13Writer() {}
+bool CBC_OnedEAN13Writer::CheckContentValidity(
+ const CFX_WideStringC& contents) {
+ for (int32_t i = 0; i < contents.GetLength(); i++) {
+ if (contents.GetAt(i) >= '0' && contents.GetAt(i) <= '9') {
+ continue;
+ } else {
+ return false;
+ }
+ }
+ return true;
+}
+CFX_WideString CBC_OnedEAN13Writer::FilterContents(
+ const CFX_WideStringC& contents) {
+ CFX_WideString filtercontents;
+ wchar_t ch;
+ for (int32_t i = 0; i < contents.GetLength(); i++) {
+ ch = contents.GetAt(i);
+ if (ch > 175) {
+ i++;
+ continue;
+ }
+ if (ch >= '0' && ch <= '9') {
+ filtercontents += ch;
+ }
+ }
+ return filtercontents;
+}
+int32_t CBC_OnedEAN13Writer::CalcChecksum(const CFX_ByteString& contents) {
+ int32_t odd = 0;
+ int32_t even = 0;
+ int32_t j = 1;
+ for (int32_t i = contents.GetLength() - 1; i >= 0; i--) {
+ if (j % 2) {
+ odd += FXSYS_atoi(contents.Mid(i, 1).c_str());
+ } else {
+ even += FXSYS_atoi(contents.Mid(i, 1).c_str());
+ }
+ j++;
+ }
+ int32_t checksum = (odd * 3 + even) % 10;
+ checksum = (10 - checksum) % 10;
+ return (checksum);
+}
+uint8_t* CBC_OnedEAN13Writer::Encode(const CFX_ByteString& contents,
+ BCFORMAT format,
+ int32_t& outWidth,
+ int32_t& outHeight,
+ int32_t& e) {
+ uint8_t* ret = Encode(contents, format, outWidth, outHeight, 0, e);
+ if (e != BCExceptionNO)
+ return nullptr;
+ return ret;
+}
+uint8_t* CBC_OnedEAN13Writer::Encode(const CFX_ByteString& contents,
+ BCFORMAT format,
+ int32_t& outWidth,
+ int32_t& outHeight,
+ int32_t hints,
+ int32_t& e) {
+ if (format != BCFORMAT_EAN_13) {
+ e = BCExceptionOnlyEncodeEAN_13;
+ }
+ uint8_t* ret =
+ CBC_OneDimWriter::Encode(contents, format, outWidth, outHeight, hints, e);
+ if (e != BCExceptionNO)
+ return nullptr;
+ return ret;
+}
+uint8_t* CBC_OnedEAN13Writer::Encode(const CFX_ByteString& contents,
+ int32_t& outLength,
+ int32_t& e) {
+ if (contents.GetLength() != 13) {
+ e = BCExceptionDigitLengthShould13;
+ return nullptr;
+ }
+ m_iDataLenth = 13;
+ int32_t firstDigit = FXSYS_atoi(contents.Mid(0, 1).c_str());
+ int32_t parities = FIRST_DIGIT_ENCODINGS[firstDigit];
+ outLength = m_codeWidth;
+ uint8_t* result = FX_Alloc(uint8_t, m_codeWidth);
+ int32_t pos = 0;
+ pos += AppendPattern(result, pos, START_END_PATTERN, 3, 1, e);
+ if (e != BCExceptionNO) {
+ FX_Free(result);
+ return nullptr;
+ }
+ int32_t i = 0;
+ for (i = 1; i <= 6; i++) {
+ int32_t digit = FXSYS_atoi(contents.Mid(i, 1).c_str());
+ if ((parities >> (6 - i) & 1) == 1) {
+ digit += 10;
+ }
+ pos += AppendPattern(result, pos, L_AND_G_PATTERNS[digit], 4, 0, e);
+ if (e != BCExceptionNO) {
+ FX_Free(result);
+ return nullptr;
+ }
+ }
+ pos += AppendPattern(result, pos, MIDDLE_PATTERN, 5, 0, e);
+ if (e != BCExceptionNO) {
+ FX_Free(result);
+ return nullptr;
+ }
+ for (i = 7; i <= 12; i++) {
+ int32_t digit = FXSYS_atoi(contents.Mid(i, 1).c_str());
+ pos += AppendPattern(result, pos, L_PATTERNS[digit], 4, 1, e);
+ if (e != BCExceptionNO) {
+ FX_Free(result);
+ return nullptr;
+ }
+ }
+ pos += AppendPattern(result, pos, START_END_PATTERN, 3, 1, e);
+ if (e != BCExceptionNO) {
+ FX_Free(result);
+ return nullptr;
+ }
+ return result;
+}
+
+void CBC_OnedEAN13Writer::ShowChars(
+ const CFX_WideStringC& contents,
+ const CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
+ CFX_RenderDevice* device,
+ const CFX_Matrix* matrix,
+ int32_t barWidth,
+ int32_t multiple,
+ int32_t& e) {
+ if (!device && !pOutBitmap) {
+ e = BCExceptionIllegalArgument;
+ return;
+ }
+ int32_t leftPadding = 7 * multiple;
+ int32_t leftPosition = 3 * multiple + leftPadding;
+ CFX_ByteString str = FX_UTF8Encode(contents);
+ int32_t iLen = str.GetLength();
+ FXTEXT_CHARPOS* pCharPos = FX_Alloc(FXTEXT_CHARPOS, iLen);
+ memset(pCharPos, 0, sizeof(FXTEXT_CHARPOS) * iLen);
+ CFX_FxgeDevice geBitmap;
+ if (pOutBitmap)
+ geBitmap.Attach(pOutBitmap, false, nullptr, false);
+
+ int32_t iFontSize = (int32_t)fabs(m_fFontSize);
+ int32_t iTextHeight = iFontSize + 1;
+ CFX_ByteString tempStr = str.Mid(1, 6);
+ int32_t strWidth = multiple * 42;
+ if (!pOutBitmap) {
+ CFX_Matrix matr(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0);
+ CFX_FloatRect rect((float)leftPosition, (float)(m_Height - iTextHeight),
+ (float)(leftPosition + strWidth - 0.5), (float)m_Height);
+ matr.Concat(*matrix);
+ matr.TransformRect(rect);
+ FX_RECT re = rect.GetOuterRect();
+ device->FillRect(&re, m_backgroundColor);
+ CFX_FloatRect rect1((float)(leftPosition + 47 * multiple),
+ (float)(m_Height - iTextHeight),
+ (float)(leftPosition + 47 * multiple + strWidth - 0.5),
+ (float)m_Height);
+ CFX_Matrix matr1(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0);
+ matr1.Concat(*matrix);
+ matr1.TransformRect(rect1);
+ re = rect1.GetOuterRect();
+ device->FillRect(&re, m_backgroundColor);
+ int32_t strWidth1 = multiple * 7;
+ CFX_Matrix matr2(m_outputHScale, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f);
+ CFX_FloatRect rect2(0.0f, (float)(m_Height - iTextHeight),
+ (float)strWidth1 - 0.5f, (float)m_Height);
+ matr2.Concat(*matrix);
+ matr2.TransformRect(rect2);
+ re = rect2.GetOuterRect();
+ device->FillRect(&re, m_backgroundColor);
+ }
+ float blank = 0.0;
+ iLen = tempStr.GetLength();
+ if (!pOutBitmap) {
+ strWidth = (int32_t)(strWidth * m_outputHScale);
+ }
+ CalcTextInfo(tempStr, pCharPos + 1, m_pFont, (float)strWidth, iFontSize,
+ blank);
+ CFX_Matrix affine_matrix(1.0, 0.0, 0.0, -1.0, 0.0, (float)iFontSize);
+ CFX_FxgeDevice ge;
+ if (pOutBitmap) {
+ ge.Create(strWidth, iTextHeight, FXDIB_Argb, nullptr);
+ FX_RECT rect(0, 0, strWidth, iTextHeight);
+ ge.FillRect(&rect, m_backgroundColor);
+ ge.DrawNormalText(iLen, pCharPos + 1, m_pFont,
+ static_cast<float>(iFontSize), &affine_matrix,
+ m_fontColor, FXTEXT_CLEARTYPE);
+ geBitmap.SetDIBits(ge.GetBitmap(), leftPosition, m_Height - iTextHeight);
+ } else {
+ CFX_Matrix affine_matrix1(1.0, 0.0, 0.0, -1.0,
+ (float)leftPosition * m_outputHScale,
+ (float)(m_Height - iTextHeight) + iFontSize);
+ if (matrix) {
+ affine_matrix1.Concat(*matrix);
+ }
+ device->DrawNormalText(iLen, pCharPos + 1, m_pFont,
+ static_cast<float>(iFontSize), &affine_matrix1,
+ m_fontColor, FXTEXT_CLEARTYPE);
+ }
+ tempStr = str.Mid(7, 6);
+ iLen = tempStr.GetLength();
+ CalcTextInfo(tempStr, pCharPos + 7, m_pFont, (float)strWidth, iFontSize,
+ blank);
+ if (pOutBitmap) {
+ FX_RECT rect1(0, 0, strWidth, iTextHeight);
+ ge.FillRect(&rect1, m_backgroundColor);
+ ge.DrawNormalText(iLen, pCharPos + 7, m_pFont,
+ static_cast<float>(iFontSize), &affine_matrix,
+ m_fontColor, FXTEXT_CLEARTYPE);
+ geBitmap.SetDIBits(ge.GetBitmap(), leftPosition + 47 * multiple,
+ m_Height - iTextHeight);
+ } else {
+ CFX_Matrix affine_matrix1(
+ 1.0, 0.0, 0.0, -1.0,
+ (float)(leftPosition + 47 * multiple) * m_outputHScale,
+ (float)(m_Height - iTextHeight + iFontSize));
+ if (matrix) {
+ affine_matrix1.Concat(*matrix);
+ }
+ device->DrawNormalText(iLen, pCharPos + 7, m_pFont,
+ static_cast<float>(iFontSize), &affine_matrix1,
+ m_fontColor, FXTEXT_CLEARTYPE);
+ }
+ tempStr = str.Mid(0, 1);
+ iLen = tempStr.GetLength();
+ strWidth = multiple * 7;
+ if (!pOutBitmap)
+ strWidth = (int32_t)(strWidth * m_outputHScale);
+
+ CalcTextInfo(tempStr, pCharPos, m_pFont, (float)strWidth, iFontSize, blank);
+ if (pOutBitmap) {
+ ge.Create(strWidth, iTextHeight, FXDIB_Argb, nullptr);
+ ge.GetBitmap()->Clear(m_backgroundColor);
+ ge.DrawNormalText(iLen, pCharPos, m_pFont, static_cast<float>(iFontSize),
+ &affine_matrix, m_fontColor, FXTEXT_CLEARTYPE);
+ geBitmap.SetDIBits(ge.GetBitmap(), 0, m_Height - iTextHeight);
+ } else {
+ CFX_Matrix affine_matrix1(1.0, 0.0, 0.0, -1.0, 0.0,
+ (float)(m_Height - iTextHeight + iFontSize));
+ if (matrix) {
+ affine_matrix1.Concat(*matrix);
+ }
+ device->DrawNormalText(iLen, pCharPos, m_pFont,
+ static_cast<float>(iFontSize), &affine_matrix1,
+ m_fontColor, FXTEXT_CLEARTYPE);
+ }
+ FX_Free(pCharPos);
+}
+
+void CBC_OnedEAN13Writer::RenderResult(const CFX_WideStringC& contents,
+ uint8_t* code,
+ int32_t codeLength,
+ bool isDevice,
+ int32_t& e) {
+ CBC_OneDimWriter::RenderResult(contents, code, codeLength, isDevice, e);
+}
diff --git a/chromium/third_party/pdfium/fxbarcode/oned/BC_OnedEAN13Writer.h b/chromium/third_party/pdfium/fxbarcode/oned/BC_OnedEAN13Writer.h
new file mode 100644
index 00000000000..1e99159132a
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/oned/BC_OnedEAN13Writer.h
@@ -0,0 +1,60 @@
+// 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 FXBARCODE_ONED_BC_ONEDEAN13WRITER_H_
+#define FXBARCODE_ONED_BC_ONEDEAN13WRITER_H_
+
+#include "core/fxcrt/fx_string.h"
+#include "core/fxcrt/fx_system.h"
+#include "fxbarcode/oned/BC_OneDimWriter.h"
+
+class CFX_DIBitmap;
+class CFX_RenderDevice;
+
+class CBC_OnedEAN13Writer : public CBC_OneDimWriter {
+ public:
+ CBC_OnedEAN13Writer();
+ ~CBC_OnedEAN13Writer() override;
+
+ // CBC_OneDimWriter
+ uint8_t* Encode(const CFX_ByteString& contents,
+ BCFORMAT format,
+ int32_t& outWidth,
+ int32_t& outHeight,
+ int32_t& e) override;
+ uint8_t* Encode(const CFX_ByteString& contents,
+ BCFORMAT format,
+ int32_t& outWidth,
+ int32_t& outHeight,
+ int32_t hints,
+ int32_t& e) override;
+ uint8_t* Encode(const CFX_ByteString& contents,
+ int32_t& outLength,
+ int32_t& e) override;
+ void RenderResult(const CFX_WideStringC& contents,
+ uint8_t* code,
+ int32_t codeLength,
+ bool isDevice,
+ int32_t& e) override;
+ bool CheckContentValidity(const CFX_WideStringC& contents) override;
+ CFX_WideString FilterContents(const CFX_WideStringC& contents) override;
+
+ int32_t CalcChecksum(const CFX_ByteString& contents);
+
+ protected:
+ void ShowChars(const CFX_WideStringC& contents,
+ const CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
+ CFX_RenderDevice* device,
+ const CFX_Matrix* matrix,
+ int32_t barWidth,
+ int32_t multiple,
+ int32_t& e) override;
+
+ private:
+ int32_t m_codeWidth;
+};
+
+#endif // FXBARCODE_ONED_BC_ONEDEAN13WRITER_H_
diff --git a/chromium/third_party/pdfium/fxbarcode/oned/BC_OnedEAN8Writer.cpp b/chromium/third_party/pdfium/fxbarcode/oned/BC_OnedEAN8Writer.cpp
new file mode 100644
index 00000000000..5aea9f3c89d
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/oned/BC_OnedEAN8Writer.cpp
@@ -0,0 +1,268 @@
+// 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
+// Original code is licensed as follows:
+/*
+ * Copyright 2009 ZXing authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "core/fxge/cfx_fxgedevice.h"
+#include "core/fxge/cfx_gemodule.h"
+#include "fxbarcode/BC_Writer.h"
+#include "fxbarcode/common/BC_CommonBitMatrix.h"
+#include "fxbarcode/oned/BC_OneDimWriter.h"
+#include "fxbarcode/oned/BC_OnedEAN8Writer.h"
+
+namespace {
+
+const int32_t START_END_PATTERN[3] = {1, 1, 1};
+const int32_t MIDDLE_PATTERN[5] = {1, 1, 1, 1, 1};
+const int32_t L_PATTERNS[10][4] = {
+ {3, 2, 1, 1}, {2, 2, 2, 1}, {2, 1, 2, 2}, {1, 4, 1, 1}, {1, 1, 3, 2},
+ {1, 2, 3, 1}, {1, 1, 1, 4}, {1, 3, 1, 2}, {1, 2, 1, 3}, {3, 1, 1, 2}};
+
+} // namespace
+
+CBC_OnedEAN8Writer::CBC_OnedEAN8Writer() {
+ m_iDataLenth = 8;
+ m_codeWidth = 3 + (7 * 4) + 5 + (7 * 4) + 3;
+}
+CBC_OnedEAN8Writer::~CBC_OnedEAN8Writer() {}
+void CBC_OnedEAN8Writer::SetDataLength(int32_t length) {
+ m_iDataLenth = 8;
+}
+bool CBC_OnedEAN8Writer::SetTextLocation(BC_TEXT_LOC location) {
+ if (location == BC_TEXT_LOC_BELOWEMBED) {
+ m_locTextLoc = location;
+ return true;
+ }
+ return false;
+}
+bool CBC_OnedEAN8Writer::CheckContentValidity(const CFX_WideStringC& contents) {
+ for (int32_t i = 0; i < contents.GetLength(); i++) {
+ if (contents.GetAt(i) >= '0' && contents.GetAt(i) <= '9') {
+ continue;
+ } else {
+ return false;
+ }
+ }
+ return true;
+}
+CFX_WideString CBC_OnedEAN8Writer::FilterContents(
+ const CFX_WideStringC& contents) {
+ CFX_WideString filtercontents;
+ wchar_t ch;
+ for (int32_t i = 0; i < contents.GetLength(); i++) {
+ ch = contents.GetAt(i);
+ if (ch > 175) {
+ i++;
+ continue;
+ }
+ if (ch >= '0' && ch <= '9') {
+ filtercontents += ch;
+ }
+ }
+ return filtercontents;
+}
+int32_t CBC_OnedEAN8Writer::CalcChecksum(const CFX_ByteString& contents) {
+ int32_t odd = 0;
+ int32_t even = 0;
+ int32_t j = 1;
+ for (int32_t i = contents.GetLength() - 1; i >= 0; i--) {
+ if (j % 2) {
+ odd += FXSYS_atoi(contents.Mid(i, 1).c_str());
+ } else {
+ even += FXSYS_atoi(contents.Mid(i, 1).c_str());
+ }
+ j++;
+ }
+ int32_t checksum = (odd * 3 + even) % 10;
+ checksum = (10 - checksum) % 10;
+ return (checksum);
+}
+uint8_t* CBC_OnedEAN8Writer::Encode(const CFX_ByteString& contents,
+ BCFORMAT format,
+ int32_t& outWidth,
+ int32_t& outHeight,
+ int32_t& e) {
+ uint8_t* ret = Encode(contents, format, outWidth, outHeight, 0, e);
+ if (e != BCExceptionNO)
+ return nullptr;
+ return ret;
+}
+uint8_t* CBC_OnedEAN8Writer::Encode(const CFX_ByteString& contents,
+ BCFORMAT format,
+ int32_t& outWidth,
+ int32_t& outHeight,
+ int32_t hints,
+ int32_t& e) {
+ if (format != BCFORMAT_EAN_8) {
+ e = BCExceptionOnlyEncodeEAN_8;
+ return nullptr;
+ }
+ uint8_t* ret =
+ CBC_OneDimWriter::Encode(contents, format, outWidth, outHeight, hints, e);
+ if (e != BCExceptionNO)
+ return nullptr;
+ return ret;
+}
+uint8_t* CBC_OnedEAN8Writer::Encode(const CFX_ByteString& contents,
+ int32_t& outLength,
+ int32_t& e) {
+ if (contents.GetLength() != 8) {
+ e = BCExceptionDigitLengthMustBe8;
+ return nullptr;
+ }
+ outLength = m_codeWidth;
+ uint8_t* result = FX_Alloc(uint8_t, m_codeWidth);
+ int32_t pos = 0;
+ pos += AppendPattern(result, pos, START_END_PATTERN, 3, 1, e);
+ if (e != BCExceptionNO) {
+ FX_Free(result);
+ return nullptr;
+ }
+ int32_t i = 0;
+ for (i = 0; i <= 3; i++) {
+ int32_t digit = FXSYS_atoi(contents.Mid(i, 1).c_str());
+ pos += AppendPattern(result, pos, L_PATTERNS[digit], 4, 0, e);
+ if (e != BCExceptionNO) {
+ FX_Free(result);
+ return nullptr;
+ }
+ }
+ pos += AppendPattern(result, pos, MIDDLE_PATTERN, 5, 0, e);
+ if (e != BCExceptionNO) {
+ FX_Free(result);
+ return nullptr;
+ }
+ for (i = 4; i <= 7; i++) {
+ int32_t digit = FXSYS_atoi(contents.Mid(i, 1).c_str());
+ pos += AppendPattern(result, pos, L_PATTERNS[digit], 4, 1, e);
+ if (e != BCExceptionNO) {
+ FX_Free(result);
+ return nullptr;
+ }
+ }
+ pos += AppendPattern(result, pos, START_END_PATTERN, 3, 1, e);
+ if (e != BCExceptionNO) {
+ FX_Free(result);
+ return nullptr;
+ }
+ return result;
+}
+
+void CBC_OnedEAN8Writer::ShowChars(
+ const CFX_WideStringC& contents,
+ const CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
+ CFX_RenderDevice* device,
+ const CFX_Matrix* matrix,
+ int32_t barWidth,
+ int32_t multiple,
+ int32_t& e) {
+ if (!device && !pOutBitmap) {
+ e = BCExceptionIllegalArgument;
+ return;
+ }
+
+ int32_t leftPosition = 3 * multiple;
+ CFX_ByteString str = FX_UTF8Encode(contents);
+ int32_t iLength = str.GetLength();
+ FXTEXT_CHARPOS* pCharPos = FX_Alloc(FXTEXT_CHARPOS, iLength);
+ memset(pCharPos, 0, sizeof(FXTEXT_CHARPOS) * iLength);
+ CFX_ByteString tempStr = str.Mid(0, 4);
+ int32_t iLen = tempStr.GetLength();
+ int32_t strWidth = 7 * multiple * 4;
+ float blank = 0.0;
+ CFX_FxgeDevice geBitmap;
+ if (pOutBitmap)
+ geBitmap.Attach(pOutBitmap, false, nullptr, false);
+
+ int32_t iFontSize = (int32_t)fabs(m_fFontSize);
+ int32_t iTextHeight = iFontSize + 1;
+ if (!pOutBitmap) {
+ CFX_Matrix matr(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0);
+ CFX_FloatRect rect((float)leftPosition, (float)(m_Height - iTextHeight),
+ (float)(leftPosition + strWidth - 0.5), (float)m_Height);
+ matr.Concat(*matrix);
+ matr.TransformRect(rect);
+ FX_RECT re = rect.GetOuterRect();
+ device->FillRect(&re, m_backgroundColor);
+ CFX_Matrix matr1(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0);
+ CFX_FloatRect rect1((float)(leftPosition + 33 * multiple),
+ (float)(m_Height - iTextHeight),
+ (float)(leftPosition + 33 * multiple + strWidth - 0.5),
+ (float)m_Height);
+ matr1.Concat(*matrix);
+ matr1.TransformRect(rect1);
+ re = rect1.GetOuterRect();
+ device->FillRect(&re, m_backgroundColor);
+ }
+ if (!pOutBitmap)
+ strWidth = (int32_t)(strWidth * m_outputHScale);
+
+ CalcTextInfo(tempStr, pCharPos, m_pFont, (float)strWidth, iFontSize, blank);
+ CFX_Matrix affine_matrix(1.0, 0.0, 0.0, -1.0, 0.0, (float)iFontSize);
+ CFX_FxgeDevice ge;
+ if (pOutBitmap) {
+ ge.Create(strWidth, iTextHeight, FXDIB_Argb, nullptr);
+ ge.GetBitmap()->Clear(m_backgroundColor);
+ ge.DrawNormalText(iLen, pCharPos, m_pFont, static_cast<float>(iFontSize),
+ &affine_matrix, m_fontColor, FXTEXT_CLEARTYPE);
+ geBitmap.SetDIBits(ge.GetBitmap(), leftPosition, m_Height - iTextHeight);
+ } else {
+ CFX_Matrix affine_matrix1(1.0, 0.0, 0.0, -1.0,
+ (float)leftPosition * m_outputHScale,
+ (float)(m_Height - iTextHeight + iFontSize));
+ affine_matrix1.Concat(*matrix);
+ device->DrawNormalText(iLen, pCharPos, m_pFont,
+ static_cast<float>(iFontSize), &affine_matrix1,
+ m_fontColor, FXTEXT_CLEARTYPE);
+ }
+ tempStr = str.Mid(4, 4);
+ iLen = tempStr.GetLength();
+ CalcTextInfo(tempStr, pCharPos + 4, m_pFont, (float)strWidth, iFontSize,
+ blank);
+ if (pOutBitmap) {
+ ge.Create(strWidth, iTextHeight, FXDIB_Argb, nullptr);
+ ge.GetBitmap()->Clear(m_backgroundColor);
+ ge.DrawNormalText(iLen, pCharPos + 4, m_pFont,
+ static_cast<float>(iFontSize), &affine_matrix,
+ m_fontColor, FXTEXT_CLEARTYPE);
+ geBitmap.SetDIBits(ge.GetBitmap(), leftPosition + 33 * multiple,
+ m_Height - iTextHeight);
+ } else {
+ CFX_Matrix affine_matrix1(
+ 1.0, 0.0, 0.0, -1.0,
+ (float)(leftPosition + 33 * multiple) * m_outputHScale,
+ (float)(m_Height - iTextHeight + iFontSize));
+ if (matrix) {
+ affine_matrix1.Concat(*matrix);
+ }
+ device->DrawNormalText(iLen, pCharPos + 4, m_pFont,
+ static_cast<float>(iFontSize), &affine_matrix1,
+ m_fontColor, FXTEXT_CLEARTYPE);
+ }
+ FX_Free(pCharPos);
+}
+
+void CBC_OnedEAN8Writer::RenderResult(const CFX_WideStringC& contents,
+ uint8_t* code,
+ int32_t codeLength,
+ bool isDevice,
+ int32_t& e) {
+ CBC_OneDimWriter::RenderResult(contents, code, codeLength, isDevice, e);
+}
diff --git a/chromium/third_party/pdfium/fxbarcode/oned/BC_OnedEAN8Writer.h b/chromium/third_party/pdfium/fxbarcode/oned/BC_OnedEAN8Writer.h
new file mode 100644
index 00000000000..1d26d166201
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/oned/BC_OnedEAN8Writer.h
@@ -0,0 +1,64 @@
+// 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 FXBARCODE_ONED_BC_ONEDEAN8WRITER_H_
+#define FXBARCODE_ONED_BC_ONEDEAN8WRITER_H_
+
+#include "core/fxcrt/fx_string.h"
+#include "core/fxcrt/fx_system.h"
+#include "fxbarcode/BC_Library.h"
+#include "fxbarcode/oned/BC_OneDimWriter.h"
+
+class CFX_DIBitmap;
+class CFX_RenderDevice;
+
+class CBC_OnedEAN8Writer : public CBC_OneDimWriter {
+ public:
+ CBC_OnedEAN8Writer();
+ ~CBC_OnedEAN8Writer() override;
+
+ // CBC_OneDimWriter
+ uint8_t* Encode(const CFX_ByteString& contents,
+ BCFORMAT format,
+ int32_t& outWidth,
+ int32_t& outHeight,
+ int32_t& e) override;
+ uint8_t* Encode(const CFX_ByteString& contents,
+ BCFORMAT format,
+ int32_t& outWidth,
+ int32_t& outHeight,
+ int32_t hints,
+ int32_t& e) override;
+ uint8_t* Encode(const CFX_ByteString& contents,
+ int32_t& outLength,
+ int32_t& e) override;
+
+ void RenderResult(const CFX_WideStringC& contents,
+ uint8_t* code,
+ int32_t codeLength,
+ bool isDevice,
+ int32_t& e) override;
+ bool CheckContentValidity(const CFX_WideStringC& contents) override;
+ CFX_WideString FilterContents(const CFX_WideStringC& contents) override;
+ void SetDataLength(int32_t length) override;
+
+ bool SetTextLocation(BC_TEXT_LOC location);
+ int32_t CalcChecksum(const CFX_ByteString& contents);
+
+ protected:
+ void ShowChars(const CFX_WideStringC& contents,
+ const CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
+ CFX_RenderDevice* device,
+ const CFX_Matrix* matrix,
+ int32_t barWidth,
+ int32_t multiple,
+ int32_t& e) override;
+
+ private:
+ int32_t m_codeWidth;
+};
+
+#endif // FXBARCODE_ONED_BC_ONEDEAN8WRITER_H_
diff --git a/chromium/third_party/pdfium/fxbarcode/oned/BC_OnedUPCAWriter.cpp b/chromium/third_party/pdfium/fxbarcode/oned/BC_OnedUPCAWriter.cpp
new file mode 100644
index 00000000000..87c6db12e1f
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/oned/BC_OnedUPCAWriter.cpp
@@ -0,0 +1,286 @@
+// 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
+// Original code is licensed as follows:
+/*
+ * Copyright 2010 ZXing authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "core/fxge/cfx_fxgedevice.h"
+#include "core/fxge/cfx_gemodule.h"
+#include "fxbarcode/BC_Writer.h"
+#include "fxbarcode/oned/BC_OneDimWriter.h"
+#include "fxbarcode/oned/BC_OnedEAN13Writer.h"
+#include "fxbarcode/oned/BC_OnedUPCAWriter.h"
+#include "third_party/base/ptr_util.h"
+
+CBC_OnedUPCAWriter::CBC_OnedUPCAWriter() {
+ m_bLeftPadding = true;
+ m_bRightPadding = true;
+}
+
+void CBC_OnedUPCAWriter::Init() {
+ m_subWriter = pdfium::MakeUnique<CBC_OnedEAN13Writer>();
+}
+
+CBC_OnedUPCAWriter::~CBC_OnedUPCAWriter() {}
+
+bool CBC_OnedUPCAWriter::CheckContentValidity(const CFX_WideStringC& contents) {
+ for (FX_STRSIZE i = 0; i < contents.GetLength(); ++i) {
+ if (contents.GetAt(i) < '0' || contents.GetAt(i) > '9')
+ return false;
+ }
+ return true;
+}
+
+CFX_WideString CBC_OnedUPCAWriter::FilterContents(
+ const CFX_WideStringC& contents) {
+ CFX_WideString filtercontents;
+ wchar_t ch;
+ for (int32_t i = 0; i < contents.GetLength(); i++) {
+ ch = contents.GetAt(i);
+ if (ch > 175) {
+ i++;
+ continue;
+ }
+ if (ch >= '0' && ch <= '9') {
+ filtercontents += ch;
+ }
+ }
+ return filtercontents;
+}
+
+int32_t CBC_OnedUPCAWriter::CalcChecksum(const CFX_ByteString& contents) {
+ int32_t odd = 0;
+ int32_t even = 0;
+ int32_t j = 1;
+ for (int32_t i = contents.GetLength() - 1; i >= 0; i--) {
+ if (j % 2) {
+ odd += FXSYS_atoi(contents.Mid(i, 1).c_str());
+ } else {
+ even += FXSYS_atoi(contents.Mid(i, 1).c_str());
+ }
+ j++;
+ }
+ int32_t checksum = (odd * 3 + even) % 10;
+ checksum = (10 - checksum) % 10;
+ return (checksum);
+}
+
+uint8_t* CBC_OnedUPCAWriter::Encode(const CFX_ByteString& contents,
+ BCFORMAT format,
+ int32_t& outWidth,
+ int32_t& outHeight,
+ int32_t& e) {
+ uint8_t* ret = Encode(contents, format, outWidth, outHeight, 0, e);
+ if (e != BCExceptionNO)
+ return nullptr;
+ return ret;
+}
+
+uint8_t* CBC_OnedUPCAWriter::Encode(const CFX_ByteString& contents,
+ BCFORMAT format,
+ int32_t& outWidth,
+ int32_t& outHeight,
+ int32_t hints,
+ int32_t& e) {
+ if (format != BCFORMAT_UPC_A) {
+ e = BCExceptionOnlyEncodeUPC_A;
+ return nullptr;
+ }
+ CFX_ByteString toEAN13String = '0' + contents;
+ m_iDataLenth = 13;
+ uint8_t* ret = m_subWriter->Encode(toEAN13String, BCFORMAT_EAN_13, outWidth,
+ outHeight, hints, e);
+ if (e != BCExceptionNO)
+ return nullptr;
+ return ret;
+}
+
+uint8_t* CBC_OnedUPCAWriter::Encode(const CFX_ByteString& contents,
+ int32_t& outLength,
+ int32_t& e) {
+ return nullptr;
+}
+
+void CBC_OnedUPCAWriter::ShowChars(
+ const CFX_WideStringC& contents,
+ const CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
+ CFX_RenderDevice* device,
+ const CFX_Matrix* matrix,
+ int32_t barWidth,
+ int32_t multiple,
+ int32_t& e) {
+ if (!device && !pOutBitmap) {
+ e = BCExceptionIllegalArgument;
+ return;
+ }
+
+ int32_t leftPadding = 7 * multiple;
+ int32_t leftPosition = 10 * multiple + leftPadding;
+ CFX_ByteString str = FX_UTF8Encode(contents);
+ int32_t iLen = str.GetLength();
+ FXTEXT_CHARPOS* pCharPos = FX_Alloc(FXTEXT_CHARPOS, iLen);
+ memset(pCharPos, 0, sizeof(FXTEXT_CHARPOS) * iLen);
+ CFX_ByteString tempStr = str.Mid(1, 5);
+ float strWidth = (float)35 * multiple;
+ float blank = 0.0;
+ CFX_FxgeDevice geBitmap;
+ if (pOutBitmap)
+ geBitmap.Attach(pOutBitmap, false, nullptr, false);
+
+ iLen = tempStr.GetLength();
+ int32_t iFontSize = (int32_t)fabs(m_fFontSize);
+ int32_t iTextHeight = iFontSize + 1;
+ if (!pOutBitmap) {
+ CFX_Matrix matr(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0);
+ CFX_FloatRect rect((float)leftPosition, (float)(m_Height - iTextHeight),
+ (float)(leftPosition + strWidth - 0.5), (float)m_Height);
+ matr.Concat(*matrix);
+ matr.TransformRect(rect);
+ FX_RECT re = rect.GetOuterRect();
+ device->FillRect(&re, m_backgroundColor);
+ CFX_Matrix matr1(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0);
+ CFX_FloatRect rect1(
+ (float)(leftPosition + 40 * multiple), (float)(m_Height - iTextHeight),
+ (float)((leftPosition + 40 * multiple) + strWidth - 0.5),
+ (float)m_Height);
+ matr1.Concat(*matrix);
+ matr1.TransformRect(rect1);
+ re = rect1.GetOuterRect();
+ device->FillRect(&re, m_backgroundColor);
+ float strWidth1 = (float)multiple * 7;
+ CFX_Matrix matr2(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0);
+ CFX_FloatRect rect2(0.0, (float)(m_Height - iTextHeight),
+ (float)strWidth1 - 1, (float)m_Height);
+ matr2.Concat(*matrix);
+ matr2.TransformRect(rect2);
+ re = rect2.GetOuterRect();
+ device->FillRect(&re, m_backgroundColor);
+ CFX_Matrix matr3(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0);
+ CFX_FloatRect rect3(
+ (float)(leftPosition + 85 * multiple), (float)(m_Height - iTextHeight),
+ (float)((leftPosition + 85 * multiple) + strWidth1 - 0.5),
+ (float)m_Height);
+ matr3.Concat(*matrix);
+ matr3.TransformRect(rect3);
+ re = rect3.GetOuterRect();
+ device->FillRect(&re, m_backgroundColor);
+ }
+ if (!pOutBitmap)
+ strWidth = strWidth * m_outputHScale;
+
+ CalcTextInfo(tempStr, pCharPos + 1, m_pFont, strWidth, iFontSize, blank);
+ CFX_Matrix affine_matrix(1.0, 0.0, 0.0, -1.0, 0.0, (float)iFontSize);
+ CFX_FxgeDevice ge;
+ if (pOutBitmap) {
+ ge.Create((int)strWidth, iTextHeight, FXDIB_Argb, nullptr);
+ ge.GetBitmap()->Clear(m_backgroundColor);
+ ge.DrawNormalText(iLen, pCharPos + 1, m_pFont,
+ static_cast<float>(iFontSize), &affine_matrix,
+ m_fontColor, FXTEXT_CLEARTYPE);
+ geBitmap.SetDIBits(ge.GetBitmap(), leftPosition, m_Height - iTextHeight);
+ } else {
+ CFX_Matrix affine_matrix1(1.0, 0.0, 0.0, -1.0,
+ (float)leftPosition * m_outputHScale,
+ (float)(m_Height - iTextHeight + iFontSize));
+ if (matrix) {
+ affine_matrix1.Concat(*matrix);
+ }
+ device->DrawNormalText(iLen, pCharPos + 1, m_pFont,
+ static_cast<float>(iFontSize), &affine_matrix1,
+ m_fontColor, FXTEXT_CLEARTYPE);
+ }
+ tempStr = str.Mid(6, 5);
+ iLen = tempStr.GetLength();
+ CalcTextInfo(tempStr, pCharPos + 6, m_pFont, strWidth, iFontSize, blank);
+ if (pOutBitmap) {
+ FX_RECT rect2(0, 0, (int)strWidth, iTextHeight);
+ ge.FillRect(&rect2, m_backgroundColor);
+ ge.DrawNormalText(iLen, pCharPos + 6, m_pFont,
+ static_cast<float>(iFontSize), &affine_matrix,
+ m_fontColor, FXTEXT_CLEARTYPE);
+ geBitmap.SetDIBits(ge.GetBitmap(), leftPosition + 40 * multiple,
+ m_Height - iTextHeight);
+ } else {
+ CFX_Matrix affine_matrix1(
+ 1.0, 0.0, 0.0, -1.0,
+ (float)(leftPosition + 40 * multiple) * m_outputHScale,
+ (float)(m_Height - iTextHeight + iFontSize));
+ if (matrix) {
+ affine_matrix1.Concat(*matrix);
+ }
+ device->DrawNormalText(iLen, pCharPos + 6, m_pFont,
+ static_cast<float>(iFontSize), &affine_matrix1,
+ m_fontColor, FXTEXT_CLEARTYPE);
+ }
+ tempStr = str.Mid(0, 1);
+ iLen = tempStr.GetLength();
+ strWidth = (float)multiple * 7;
+ if (!pOutBitmap)
+ strWidth = strWidth * m_outputHScale;
+
+ CalcTextInfo(tempStr, pCharPos, m_pFont, strWidth, iFontSize, blank);
+ if (pOutBitmap) {
+ ge.Create((int)strWidth, iTextHeight, FXDIB_Argb, nullptr);
+ ge.GetBitmap()->Clear(m_backgroundColor);
+ ge.DrawNormalText(iLen, pCharPos, m_pFont, static_cast<float>(iFontSize),
+ &affine_matrix, m_fontColor, FXTEXT_CLEARTYPE);
+ geBitmap.SetDIBits(ge.GetBitmap(), 0, m_Height - iTextHeight);
+ } else {
+ CFX_Matrix affine_matrix1(1.0, 0.0, 0.0, -1.0, 0,
+ (float)(m_Height - iTextHeight + iFontSize));
+ if (matrix) {
+ affine_matrix1.Concat(*matrix);
+ }
+ device->DrawNormalText(iLen, pCharPos, m_pFont,
+ static_cast<float>(iFontSize), &affine_matrix1,
+ m_fontColor, FXTEXT_CLEARTYPE);
+ }
+ tempStr = str.Mid(11, 1);
+ iLen = tempStr.GetLength();
+ CalcTextInfo(tempStr, pCharPos + 11, m_pFont, strWidth, iFontSize, blank);
+ if (pOutBitmap) {
+ ge.Create((int)strWidth, iTextHeight, FXDIB_Argb, nullptr);
+ ge.GetBitmap()->Clear(m_backgroundColor);
+ ge.DrawNormalText(iLen, pCharPos + 11, m_pFont,
+ static_cast<float>(iFontSize), &affine_matrix,
+ m_fontColor, FXTEXT_CLEARTYPE);
+ geBitmap.SetDIBits(ge.GetBitmap(), leftPosition + 85 * multiple,
+ m_Height - iTextHeight);
+ } else {
+ CFX_Matrix affine_matrix1(
+ 1.0, 0.0, 0.0, -1.0,
+ (float)(leftPosition + 85 * multiple) * m_outputHScale,
+ (float)(m_Height - iTextHeight + iFontSize));
+ if (matrix) {
+ affine_matrix1.Concat(*matrix);
+ }
+ device->DrawNormalText(iLen, pCharPos + 11, m_pFont,
+ static_cast<float>(iFontSize), &affine_matrix1,
+ m_fontColor, FXTEXT_CLEARTYPE);
+ }
+ FX_Free(pCharPos);
+}
+
+void CBC_OnedUPCAWriter::RenderResult(const CFX_WideStringC& contents,
+ uint8_t* code,
+ int32_t codeLength,
+ bool isDevice,
+ int32_t& e) {
+ CBC_OneDimWriter::RenderResult(contents, code, codeLength, isDevice, e);
+}
diff --git a/chromium/third_party/pdfium/fxbarcode/oned/BC_OnedUPCAWriter.h b/chromium/third_party/pdfium/fxbarcode/oned/BC_OnedUPCAWriter.h
new file mode 100644
index 00000000000..83e70302f8d
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/oned/BC_OnedUPCAWriter.h
@@ -0,0 +1,66 @@
+// 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 FXBARCODE_ONED_BC_ONEDUPCAWRITER_H_
+#define FXBARCODE_ONED_BC_ONEDUPCAWRITER_H_
+
+#include <memory>
+
+#include "core/fxcrt/fx_string.h"
+#include "core/fxcrt/fx_system.h"
+#include "fxbarcode/oned/BC_OneDimWriter.h"
+
+class CBC_OnedEAN13Writer;
+class CFX_DIBitmap;
+class CFX_Matrix;
+class CFX_RenderDevice;
+
+class CBC_OnedUPCAWriter : public CBC_OneDimWriter {
+ public:
+ CBC_OnedUPCAWriter();
+ ~CBC_OnedUPCAWriter() override;
+
+ // CBC_OneDimWriter
+ uint8_t* Encode(const CFX_ByteString& contents,
+ BCFORMAT format,
+ int32_t& outWidth,
+ int32_t& outHeight,
+ int32_t& e) override;
+ uint8_t* Encode(const CFX_ByteString& contents,
+ BCFORMAT format,
+ int32_t& outWidth,
+ int32_t& outHeight,
+ int32_t hints,
+ int32_t& e) override;
+ uint8_t* Encode(const CFX_ByteString& contents,
+ int32_t& outLength,
+ int32_t& e) override;
+
+ void RenderResult(const CFX_WideStringC& contents,
+ uint8_t* code,
+ int32_t codeLength,
+ bool isDevice,
+ int32_t& e) override;
+ bool CheckContentValidity(const CFX_WideStringC& contents) override;
+ CFX_WideString FilterContents(const CFX_WideStringC& contents) override;
+
+ void Init();
+ int32_t CalcChecksum(const CFX_ByteString& contents);
+
+ protected:
+ void ShowChars(const CFX_WideStringC& contents,
+ const CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
+ CFX_RenderDevice* device,
+ const CFX_Matrix* matrix,
+ int32_t barWidth,
+ int32_t multiple,
+ int32_t& e) override;
+
+ private:
+ std::unique_ptr<CBC_OnedEAN13Writer> m_subWriter;
+};
+
+#endif // FXBARCODE_ONED_BC_ONEDUPCAWRITER_H_
diff --git a/chromium/third_party/pdfium/fxbarcode/pdf417/BC_PDF417.cpp b/chromium/third_party/pdfium/fxbarcode/pdf417/BC_PDF417.cpp
new file mode 100644
index 00000000000..7907150831a
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/pdf417/BC_PDF417.cpp
@@ -0,0 +1,584 @@
+// 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
+// Original code is licensed as follows:
+/*
+ * Copyright 2006 Jeremias Maerki in part, and ZXing Authors in part
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "fxbarcode/pdf417/BC_PDF417.h"
+
+#include "fxbarcode/pdf417/BC_PDF417BarcodeMatrix.h"
+#include "fxbarcode/pdf417/BC_PDF417BarcodeRow.h"
+#include "fxbarcode/pdf417/BC_PDF417Compaction.h"
+#include "fxbarcode/pdf417/BC_PDF417ErrorCorrection.h"
+#include "fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h"
+#include "fxbarcode/utils.h"
+#include "third_party/base/ptr_util.h"
+
+const int32_t CBC_PDF417::CODEWORD_TABLE[][929] = {
+ {0x1d5c0, 0x1eaf0, 0x1f57c, 0x1d4e0, 0x1ea78, 0x1f53e, 0x1a8c0, 0x1d470,
+ 0x1a860, 0x15040, 0x1a830, 0x15020, 0x1adc0, 0x1d6f0, 0x1eb7c, 0x1ace0,
+ 0x1d678, 0x1eb3e, 0x158c0, 0x1ac70, 0x15860, 0x15dc0, 0x1aef0, 0x1d77c,
+ 0x15ce0, 0x1ae78, 0x1d73e, 0x15c70, 0x1ae3c, 0x15ef0, 0x1af7c, 0x15e78,
+ 0x1af3e, 0x15f7c, 0x1f5fa, 0x1d2e0, 0x1e978, 0x1f4be, 0x1a4c0, 0x1d270,
+ 0x1e93c, 0x1a460, 0x1d238, 0x14840, 0x1a430, 0x1d21c, 0x14820, 0x1a418,
+ 0x14810, 0x1a6e0, 0x1d378, 0x1e9be, 0x14cc0, 0x1a670, 0x1d33c, 0x14c60,
+ 0x1a638, 0x1d31e, 0x14c30, 0x1a61c, 0x14ee0, 0x1a778, 0x1d3be, 0x14e70,
+ 0x1a73c, 0x14e38, 0x1a71e, 0x14f78, 0x1a7be, 0x14f3c, 0x14f1e, 0x1a2c0,
+ 0x1d170, 0x1e8bc, 0x1a260, 0x1d138, 0x1e89e, 0x14440, 0x1a230, 0x1d11c,
+ 0x14420, 0x1a218, 0x14410, 0x14408, 0x146c0, 0x1a370, 0x1d1bc, 0x14660,
+ 0x1a338, 0x1d19e, 0x14630, 0x1a31c, 0x14618, 0x1460c, 0x14770, 0x1a3bc,
+ 0x14738, 0x1a39e, 0x1471c, 0x147bc, 0x1a160, 0x1d0b8, 0x1e85e, 0x14240,
+ 0x1a130, 0x1d09c, 0x14220, 0x1a118, 0x1d08e, 0x14210, 0x1a10c, 0x14208,
+ 0x1a106, 0x14360, 0x1a1b8, 0x1d0de, 0x14330, 0x1a19c, 0x14318, 0x1a18e,
+ 0x1430c, 0x14306, 0x1a1de, 0x1438e, 0x14140, 0x1a0b0, 0x1d05c, 0x14120,
+ 0x1a098, 0x1d04e, 0x14110, 0x1a08c, 0x14108, 0x1a086, 0x14104, 0x141b0,
+ 0x14198, 0x1418c, 0x140a0, 0x1d02e, 0x1a04c, 0x1a046, 0x14082, 0x1cae0,
+ 0x1e578, 0x1f2be, 0x194c0, 0x1ca70, 0x1e53c, 0x19460, 0x1ca38, 0x1e51e,
+ 0x12840, 0x19430, 0x12820, 0x196e0, 0x1cb78, 0x1e5be, 0x12cc0, 0x19670,
+ 0x1cb3c, 0x12c60, 0x19638, 0x12c30, 0x12c18, 0x12ee0, 0x19778, 0x1cbbe,
+ 0x12e70, 0x1973c, 0x12e38, 0x12e1c, 0x12f78, 0x197be, 0x12f3c, 0x12fbe,
+ 0x1dac0, 0x1ed70, 0x1f6bc, 0x1da60, 0x1ed38, 0x1f69e, 0x1b440, 0x1da30,
+ 0x1ed1c, 0x1b420, 0x1da18, 0x1ed0e, 0x1b410, 0x1da0c, 0x192c0, 0x1c970,
+ 0x1e4bc, 0x1b6c0, 0x19260, 0x1c938, 0x1e49e, 0x1b660, 0x1db38, 0x1ed9e,
+ 0x16c40, 0x12420, 0x19218, 0x1c90e, 0x16c20, 0x1b618, 0x16c10, 0x126c0,
+ 0x19370, 0x1c9bc, 0x16ec0, 0x12660, 0x19338, 0x1c99e, 0x16e60, 0x1b738,
+ 0x1db9e, 0x16e30, 0x12618, 0x16e18, 0x12770, 0x193bc, 0x16f70, 0x12738,
+ 0x1939e, 0x16f38, 0x1b79e, 0x16f1c, 0x127bc, 0x16fbc, 0x1279e, 0x16f9e,
+ 0x1d960, 0x1ecb8, 0x1f65e, 0x1b240, 0x1d930, 0x1ec9c, 0x1b220, 0x1d918,
+ 0x1ec8e, 0x1b210, 0x1d90c, 0x1b208, 0x1b204, 0x19160, 0x1c8b8, 0x1e45e,
+ 0x1b360, 0x19130, 0x1c89c, 0x16640, 0x12220, 0x1d99c, 0x1c88e, 0x16620,
+ 0x12210, 0x1910c, 0x16610, 0x1b30c, 0x19106, 0x12204, 0x12360, 0x191b8,
+ 0x1c8de, 0x16760, 0x12330, 0x1919c, 0x16730, 0x1b39c, 0x1918e, 0x16718,
+ 0x1230c, 0x12306, 0x123b8, 0x191de, 0x167b8, 0x1239c, 0x1679c, 0x1238e,
+ 0x1678e, 0x167de, 0x1b140, 0x1d8b0, 0x1ec5c, 0x1b120, 0x1d898, 0x1ec4e,
+ 0x1b110, 0x1d88c, 0x1b108, 0x1d886, 0x1b104, 0x1b102, 0x12140, 0x190b0,
+ 0x1c85c, 0x16340, 0x12120, 0x19098, 0x1c84e, 0x16320, 0x1b198, 0x1d8ce,
+ 0x16310, 0x12108, 0x19086, 0x16308, 0x1b186, 0x16304, 0x121b0, 0x190dc,
+ 0x163b0, 0x12198, 0x190ce, 0x16398, 0x1b1ce, 0x1638c, 0x12186, 0x16386,
+ 0x163dc, 0x163ce, 0x1b0a0, 0x1d858, 0x1ec2e, 0x1b090, 0x1d84c, 0x1b088,
+ 0x1d846, 0x1b084, 0x1b082, 0x120a0, 0x19058, 0x1c82e, 0x161a0, 0x12090,
+ 0x1904c, 0x16190, 0x1b0cc, 0x19046, 0x16188, 0x12084, 0x16184, 0x12082,
+ 0x120d8, 0x161d8, 0x161cc, 0x161c6, 0x1d82c, 0x1d826, 0x1b042, 0x1902c,
+ 0x12048, 0x160c8, 0x160c4, 0x160c2, 0x18ac0, 0x1c570, 0x1e2bc, 0x18a60,
+ 0x1c538, 0x11440, 0x18a30, 0x1c51c, 0x11420, 0x18a18, 0x11410, 0x11408,
+ 0x116c0, 0x18b70, 0x1c5bc, 0x11660, 0x18b38, 0x1c59e, 0x11630, 0x18b1c,
+ 0x11618, 0x1160c, 0x11770, 0x18bbc, 0x11738, 0x18b9e, 0x1171c, 0x117bc,
+ 0x1179e, 0x1cd60, 0x1e6b8, 0x1f35e, 0x19a40, 0x1cd30, 0x1e69c, 0x19a20,
+ 0x1cd18, 0x1e68e, 0x19a10, 0x1cd0c, 0x19a08, 0x1cd06, 0x18960, 0x1c4b8,
+ 0x1e25e, 0x19b60, 0x18930, 0x1c49c, 0x13640, 0x11220, 0x1cd9c, 0x1c48e,
+ 0x13620, 0x19b18, 0x1890c, 0x13610, 0x11208, 0x13608, 0x11360, 0x189b8,
+ 0x1c4de, 0x13760, 0x11330, 0x1cdde, 0x13730, 0x19b9c, 0x1898e, 0x13718,
+ 0x1130c, 0x1370c, 0x113b8, 0x189de, 0x137b8, 0x1139c, 0x1379c, 0x1138e,
+ 0x113de, 0x137de, 0x1dd40, 0x1eeb0, 0x1f75c, 0x1dd20, 0x1ee98, 0x1f74e,
+ 0x1dd10, 0x1ee8c, 0x1dd08, 0x1ee86, 0x1dd04, 0x19940, 0x1ccb0, 0x1e65c,
+ 0x1bb40, 0x19920, 0x1eedc, 0x1e64e, 0x1bb20, 0x1dd98, 0x1eece, 0x1bb10,
+ 0x19908, 0x1cc86, 0x1bb08, 0x1dd86, 0x19902, 0x11140, 0x188b0, 0x1c45c,
+ 0x13340, 0x11120, 0x18898, 0x1c44e, 0x17740, 0x13320, 0x19998, 0x1ccce,
+ 0x17720, 0x1bb98, 0x1ddce, 0x18886, 0x17710, 0x13308, 0x19986, 0x17708,
+ 0x11102, 0x111b0, 0x188dc, 0x133b0, 0x11198, 0x188ce, 0x177b0, 0x13398,
+ 0x199ce, 0x17798, 0x1bbce, 0x11186, 0x13386, 0x111dc, 0x133dc, 0x111ce,
+ 0x177dc, 0x133ce, 0x1dca0, 0x1ee58, 0x1f72e, 0x1dc90, 0x1ee4c, 0x1dc88,
+ 0x1ee46, 0x1dc84, 0x1dc82, 0x198a0, 0x1cc58, 0x1e62e, 0x1b9a0, 0x19890,
+ 0x1ee6e, 0x1b990, 0x1dccc, 0x1cc46, 0x1b988, 0x19884, 0x1b984, 0x19882,
+ 0x1b982, 0x110a0, 0x18858, 0x1c42e, 0x131a0, 0x11090, 0x1884c, 0x173a0,
+ 0x13190, 0x198cc, 0x18846, 0x17390, 0x1b9cc, 0x11084, 0x17388, 0x13184,
+ 0x11082, 0x13182, 0x110d8, 0x1886e, 0x131d8, 0x110cc, 0x173d8, 0x131cc,
+ 0x110c6, 0x173cc, 0x131c6, 0x110ee, 0x173ee, 0x1dc50, 0x1ee2c, 0x1dc48,
+ 0x1ee26, 0x1dc44, 0x1dc42, 0x19850, 0x1cc2c, 0x1b8d0, 0x19848, 0x1cc26,
+ 0x1b8c8, 0x1dc66, 0x1b8c4, 0x19842, 0x1b8c2, 0x11050, 0x1882c, 0x130d0,
+ 0x11048, 0x18826, 0x171d0, 0x130c8, 0x19866, 0x171c8, 0x1b8e6, 0x11042,
+ 0x171c4, 0x130c2, 0x171c2, 0x130ec, 0x171ec, 0x171e6, 0x1ee16, 0x1dc22,
+ 0x1cc16, 0x19824, 0x19822, 0x11028, 0x13068, 0x170e8, 0x11022, 0x13062,
+ 0x18560, 0x10a40, 0x18530, 0x10a20, 0x18518, 0x1c28e, 0x10a10, 0x1850c,
+ 0x10a08, 0x18506, 0x10b60, 0x185b8, 0x1c2de, 0x10b30, 0x1859c, 0x10b18,
+ 0x1858e, 0x10b0c, 0x10b06, 0x10bb8, 0x185de, 0x10b9c, 0x10b8e, 0x10bde,
+ 0x18d40, 0x1c6b0, 0x1e35c, 0x18d20, 0x1c698, 0x18d10, 0x1c68c, 0x18d08,
+ 0x1c686, 0x18d04, 0x10940, 0x184b0, 0x1c25c, 0x11b40, 0x10920, 0x1c6dc,
+ 0x1c24e, 0x11b20, 0x18d98, 0x1c6ce, 0x11b10, 0x10908, 0x18486, 0x11b08,
+ 0x18d86, 0x10902, 0x109b0, 0x184dc, 0x11bb0, 0x10998, 0x184ce, 0x11b98,
+ 0x18dce, 0x11b8c, 0x10986, 0x109dc, 0x11bdc, 0x109ce, 0x11bce, 0x1cea0,
+ 0x1e758, 0x1f3ae, 0x1ce90, 0x1e74c, 0x1ce88, 0x1e746, 0x1ce84, 0x1ce82,
+ 0x18ca0, 0x1c658, 0x19da0, 0x18c90, 0x1c64c, 0x19d90, 0x1cecc, 0x1c646,
+ 0x19d88, 0x18c84, 0x19d84, 0x18c82, 0x19d82, 0x108a0, 0x18458, 0x119a0,
+ 0x10890, 0x1c66e, 0x13ba0, 0x11990, 0x18ccc, 0x18446, 0x13b90, 0x19dcc,
+ 0x10884, 0x13b88, 0x11984, 0x10882, 0x11982, 0x108d8, 0x1846e, 0x119d8,
+ 0x108cc, 0x13bd8, 0x119cc, 0x108c6, 0x13bcc, 0x119c6, 0x108ee, 0x119ee,
+ 0x13bee, 0x1ef50, 0x1f7ac, 0x1ef48, 0x1f7a6, 0x1ef44, 0x1ef42, 0x1ce50,
+ 0x1e72c, 0x1ded0, 0x1ef6c, 0x1e726, 0x1dec8, 0x1ef66, 0x1dec4, 0x1ce42,
+ 0x1dec2, 0x18c50, 0x1c62c, 0x19cd0, 0x18c48, 0x1c626, 0x1bdd0, 0x19cc8,
+ 0x1ce66, 0x1bdc8, 0x1dee6, 0x18c42, 0x1bdc4, 0x19cc2, 0x1bdc2, 0x10850,
+ 0x1842c, 0x118d0, 0x10848, 0x18426, 0x139d0, 0x118c8, 0x18c66, 0x17bd0,
+ 0x139c8, 0x19ce6, 0x10842, 0x17bc8, 0x1bde6, 0x118c2, 0x17bc4, 0x1086c,
+ 0x118ec, 0x10866, 0x139ec, 0x118e6, 0x17bec, 0x139e6, 0x17be6, 0x1ef28,
+ 0x1f796, 0x1ef24, 0x1ef22, 0x1ce28, 0x1e716, 0x1de68, 0x1ef36, 0x1de64,
+ 0x1ce22, 0x1de62, 0x18c28, 0x1c616, 0x19c68, 0x18c24, 0x1bce8, 0x19c64,
+ 0x18c22, 0x1bce4, 0x19c62, 0x1bce2, 0x10828, 0x18416, 0x11868, 0x18c36,
+ 0x138e8, 0x11864, 0x10822, 0x179e8, 0x138e4, 0x11862, 0x179e4, 0x138e2,
+ 0x179e2, 0x11876, 0x179f6, 0x1ef12, 0x1de34, 0x1de32, 0x19c34, 0x1bc74,
+ 0x1bc72, 0x11834, 0x13874, 0x178f4, 0x178f2, 0x10540, 0x10520, 0x18298,
+ 0x10510, 0x10508, 0x10504, 0x105b0, 0x10598, 0x1058c, 0x10586, 0x105dc,
+ 0x105ce, 0x186a0, 0x18690, 0x1c34c, 0x18688, 0x1c346, 0x18684, 0x18682,
+ 0x104a0, 0x18258, 0x10da0, 0x186d8, 0x1824c, 0x10d90, 0x186cc, 0x10d88,
+ 0x186c6, 0x10d84, 0x10482, 0x10d82, 0x104d8, 0x1826e, 0x10dd8, 0x186ee,
+ 0x10dcc, 0x104c6, 0x10dc6, 0x104ee, 0x10dee, 0x1c750, 0x1c748, 0x1c744,
+ 0x1c742, 0x18650, 0x18ed0, 0x1c76c, 0x1c326, 0x18ec8, 0x1c766, 0x18ec4,
+ 0x18642, 0x18ec2, 0x10450, 0x10cd0, 0x10448, 0x18226, 0x11dd0, 0x10cc8,
+ 0x10444, 0x11dc8, 0x10cc4, 0x10442, 0x11dc4, 0x10cc2, 0x1046c, 0x10cec,
+ 0x10466, 0x11dec, 0x10ce6, 0x11de6, 0x1e7a8, 0x1e7a4, 0x1e7a2, 0x1c728,
+ 0x1cf68, 0x1e7b6, 0x1cf64, 0x1c722, 0x1cf62, 0x18628, 0x1c316, 0x18e68,
+ 0x1c736, 0x19ee8, 0x18e64, 0x18622, 0x19ee4, 0x18e62, 0x19ee2, 0x10428,
+ 0x18216, 0x10c68, 0x18636, 0x11ce8, 0x10c64, 0x10422, 0x13de8, 0x11ce4,
+ 0x10c62, 0x13de4, 0x11ce2, 0x10436, 0x10c76, 0x11cf6, 0x13df6, 0x1f7d4,
+ 0x1f7d2, 0x1e794, 0x1efb4, 0x1e792, 0x1efb2, 0x1c714, 0x1cf34, 0x1c712,
+ 0x1df74, 0x1cf32, 0x1df72, 0x18614, 0x18e34, 0x18612, 0x19e74, 0x18e32,
+ 0x1bef4},
+ {0x1f560, 0x1fab8, 0x1ea40, 0x1f530, 0x1fa9c, 0x1ea20, 0x1f518, 0x1fa8e,
+ 0x1ea10, 0x1f50c, 0x1ea08, 0x1f506, 0x1ea04, 0x1eb60, 0x1f5b8, 0x1fade,
+ 0x1d640, 0x1eb30, 0x1f59c, 0x1d620, 0x1eb18, 0x1f58e, 0x1d610, 0x1eb0c,
+ 0x1d608, 0x1eb06, 0x1d604, 0x1d760, 0x1ebb8, 0x1f5de, 0x1ae40, 0x1d730,
+ 0x1eb9c, 0x1ae20, 0x1d718, 0x1eb8e, 0x1ae10, 0x1d70c, 0x1ae08, 0x1d706,
+ 0x1ae04, 0x1af60, 0x1d7b8, 0x1ebde, 0x15e40, 0x1af30, 0x1d79c, 0x15e20,
+ 0x1af18, 0x1d78e, 0x15e10, 0x1af0c, 0x15e08, 0x1af06, 0x15f60, 0x1afb8,
+ 0x1d7de, 0x15f30, 0x1af9c, 0x15f18, 0x1af8e, 0x15f0c, 0x15fb8, 0x1afde,
+ 0x15f9c, 0x15f8e, 0x1e940, 0x1f4b0, 0x1fa5c, 0x1e920, 0x1f498, 0x1fa4e,
+ 0x1e910, 0x1f48c, 0x1e908, 0x1f486, 0x1e904, 0x1e902, 0x1d340, 0x1e9b0,
+ 0x1f4dc, 0x1d320, 0x1e998, 0x1f4ce, 0x1d310, 0x1e98c, 0x1d308, 0x1e986,
+ 0x1d304, 0x1d302, 0x1a740, 0x1d3b0, 0x1e9dc, 0x1a720, 0x1d398, 0x1e9ce,
+ 0x1a710, 0x1d38c, 0x1a708, 0x1d386, 0x1a704, 0x1a702, 0x14f40, 0x1a7b0,
+ 0x1d3dc, 0x14f20, 0x1a798, 0x1d3ce, 0x14f10, 0x1a78c, 0x14f08, 0x1a786,
+ 0x14f04, 0x14fb0, 0x1a7dc, 0x14f98, 0x1a7ce, 0x14f8c, 0x14f86, 0x14fdc,
+ 0x14fce, 0x1e8a0, 0x1f458, 0x1fa2e, 0x1e890, 0x1f44c, 0x1e888, 0x1f446,
+ 0x1e884, 0x1e882, 0x1d1a0, 0x1e8d8, 0x1f46e, 0x1d190, 0x1e8cc, 0x1d188,
+ 0x1e8c6, 0x1d184, 0x1d182, 0x1a3a0, 0x1d1d8, 0x1e8ee, 0x1a390, 0x1d1cc,
+ 0x1a388, 0x1d1c6, 0x1a384, 0x1a382, 0x147a0, 0x1a3d8, 0x1d1ee, 0x14790,
+ 0x1a3cc, 0x14788, 0x1a3c6, 0x14784, 0x14782, 0x147d8, 0x1a3ee, 0x147cc,
+ 0x147c6, 0x147ee, 0x1e850, 0x1f42c, 0x1e848, 0x1f426, 0x1e844, 0x1e842,
+ 0x1d0d0, 0x1e86c, 0x1d0c8, 0x1e866, 0x1d0c4, 0x1d0c2, 0x1a1d0, 0x1d0ec,
+ 0x1a1c8, 0x1d0e6, 0x1a1c4, 0x1a1c2, 0x143d0, 0x1a1ec, 0x143c8, 0x1a1e6,
+ 0x143c4, 0x143c2, 0x143ec, 0x143e6, 0x1e828, 0x1f416, 0x1e824, 0x1e822,
+ 0x1d068, 0x1e836, 0x1d064, 0x1d062, 0x1a0e8, 0x1d076, 0x1a0e4, 0x1a0e2,
+ 0x141e8, 0x1a0f6, 0x141e4, 0x141e2, 0x1e814, 0x1e812, 0x1d034, 0x1d032,
+ 0x1a074, 0x1a072, 0x1e540, 0x1f2b0, 0x1f95c, 0x1e520, 0x1f298, 0x1f94e,
+ 0x1e510, 0x1f28c, 0x1e508, 0x1f286, 0x1e504, 0x1e502, 0x1cb40, 0x1e5b0,
+ 0x1f2dc, 0x1cb20, 0x1e598, 0x1f2ce, 0x1cb10, 0x1e58c, 0x1cb08, 0x1e586,
+ 0x1cb04, 0x1cb02, 0x19740, 0x1cbb0, 0x1e5dc, 0x19720, 0x1cb98, 0x1e5ce,
+ 0x19710, 0x1cb8c, 0x19708, 0x1cb86, 0x19704, 0x19702, 0x12f40, 0x197b0,
+ 0x1cbdc, 0x12f20, 0x19798, 0x1cbce, 0x12f10, 0x1978c, 0x12f08, 0x19786,
+ 0x12f04, 0x12fb0, 0x197dc, 0x12f98, 0x197ce, 0x12f8c, 0x12f86, 0x12fdc,
+ 0x12fce, 0x1f6a0, 0x1fb58, 0x16bf0, 0x1f690, 0x1fb4c, 0x169f8, 0x1f688,
+ 0x1fb46, 0x168fc, 0x1f684, 0x1f682, 0x1e4a0, 0x1f258, 0x1f92e, 0x1eda0,
+ 0x1e490, 0x1fb6e, 0x1ed90, 0x1f6cc, 0x1f246, 0x1ed88, 0x1e484, 0x1ed84,
+ 0x1e482, 0x1ed82, 0x1c9a0, 0x1e4d8, 0x1f26e, 0x1dba0, 0x1c990, 0x1e4cc,
+ 0x1db90, 0x1edcc, 0x1e4c6, 0x1db88, 0x1c984, 0x1db84, 0x1c982, 0x1db82,
+ 0x193a0, 0x1c9d8, 0x1e4ee, 0x1b7a0, 0x19390, 0x1c9cc, 0x1b790, 0x1dbcc,
+ 0x1c9c6, 0x1b788, 0x19384, 0x1b784, 0x19382, 0x1b782, 0x127a0, 0x193d8,
+ 0x1c9ee, 0x16fa0, 0x12790, 0x193cc, 0x16f90, 0x1b7cc, 0x193c6, 0x16f88,
+ 0x12784, 0x16f84, 0x12782, 0x127d8, 0x193ee, 0x16fd8, 0x127cc, 0x16fcc,
+ 0x127c6, 0x16fc6, 0x127ee, 0x1f650, 0x1fb2c, 0x165f8, 0x1f648, 0x1fb26,
+ 0x164fc, 0x1f644, 0x1647e, 0x1f642, 0x1e450, 0x1f22c, 0x1ecd0, 0x1e448,
+ 0x1f226, 0x1ecc8, 0x1f666, 0x1ecc4, 0x1e442, 0x1ecc2, 0x1c8d0, 0x1e46c,
+ 0x1d9d0, 0x1c8c8, 0x1e466, 0x1d9c8, 0x1ece6, 0x1d9c4, 0x1c8c2, 0x1d9c2,
+ 0x191d0, 0x1c8ec, 0x1b3d0, 0x191c8, 0x1c8e6, 0x1b3c8, 0x1d9e6, 0x1b3c4,
+ 0x191c2, 0x1b3c2, 0x123d0, 0x191ec, 0x167d0, 0x123c8, 0x191e6, 0x167c8,
+ 0x1b3e6, 0x167c4, 0x123c2, 0x167c2, 0x123ec, 0x167ec, 0x123e6, 0x167e6,
+ 0x1f628, 0x1fb16, 0x162fc, 0x1f624, 0x1627e, 0x1f622, 0x1e428, 0x1f216,
+ 0x1ec68, 0x1f636, 0x1ec64, 0x1e422, 0x1ec62, 0x1c868, 0x1e436, 0x1d8e8,
+ 0x1c864, 0x1d8e4, 0x1c862, 0x1d8e2, 0x190e8, 0x1c876, 0x1b1e8, 0x1d8f6,
+ 0x1b1e4, 0x190e2, 0x1b1e2, 0x121e8, 0x190f6, 0x163e8, 0x121e4, 0x163e4,
+ 0x121e2, 0x163e2, 0x121f6, 0x163f6, 0x1f614, 0x1617e, 0x1f612, 0x1e414,
+ 0x1ec34, 0x1e412, 0x1ec32, 0x1c834, 0x1d874, 0x1c832, 0x1d872, 0x19074,
+ 0x1b0f4, 0x19072, 0x1b0f2, 0x120f4, 0x161f4, 0x120f2, 0x161f2, 0x1f60a,
+ 0x1e40a, 0x1ec1a, 0x1c81a, 0x1d83a, 0x1903a, 0x1b07a, 0x1e2a0, 0x1f158,
+ 0x1f8ae, 0x1e290, 0x1f14c, 0x1e288, 0x1f146, 0x1e284, 0x1e282, 0x1c5a0,
+ 0x1e2d8, 0x1f16e, 0x1c590, 0x1e2cc, 0x1c588, 0x1e2c6, 0x1c584, 0x1c582,
+ 0x18ba0, 0x1c5d8, 0x1e2ee, 0x18b90, 0x1c5cc, 0x18b88, 0x1c5c6, 0x18b84,
+ 0x18b82, 0x117a0, 0x18bd8, 0x1c5ee, 0x11790, 0x18bcc, 0x11788, 0x18bc6,
+ 0x11784, 0x11782, 0x117d8, 0x18bee, 0x117cc, 0x117c6, 0x117ee, 0x1f350,
+ 0x1f9ac, 0x135f8, 0x1f348, 0x1f9a6, 0x134fc, 0x1f344, 0x1347e, 0x1f342,
+ 0x1e250, 0x1f12c, 0x1e6d0, 0x1e248, 0x1f126, 0x1e6c8, 0x1f366, 0x1e6c4,
+ 0x1e242, 0x1e6c2, 0x1c4d0, 0x1e26c, 0x1cdd0, 0x1c4c8, 0x1e266, 0x1cdc8,
+ 0x1e6e6, 0x1cdc4, 0x1c4c2, 0x1cdc2, 0x189d0, 0x1c4ec, 0x19bd0, 0x189c8,
+ 0x1c4e6, 0x19bc8, 0x1cde6, 0x19bc4, 0x189c2, 0x19bc2, 0x113d0, 0x189ec,
+ 0x137d0, 0x113c8, 0x189e6, 0x137c8, 0x19be6, 0x137c4, 0x113c2, 0x137c2,
+ 0x113ec, 0x137ec, 0x113e6, 0x137e6, 0x1fba8, 0x175f0, 0x1bafc, 0x1fba4,
+ 0x174f8, 0x1ba7e, 0x1fba2, 0x1747c, 0x1743e, 0x1f328, 0x1f996, 0x132fc,
+ 0x1f768, 0x1fbb6, 0x176fc, 0x1327e, 0x1f764, 0x1f322, 0x1767e, 0x1f762,
+ 0x1e228, 0x1f116, 0x1e668, 0x1e224, 0x1eee8, 0x1f776, 0x1e222, 0x1eee4,
+ 0x1e662, 0x1eee2, 0x1c468, 0x1e236, 0x1cce8, 0x1c464, 0x1dde8, 0x1cce4,
+ 0x1c462, 0x1dde4, 0x1cce2, 0x1dde2, 0x188e8, 0x1c476, 0x199e8, 0x188e4,
+ 0x1bbe8, 0x199e4, 0x188e2, 0x1bbe4, 0x199e2, 0x1bbe2, 0x111e8, 0x188f6,
+ 0x133e8, 0x111e4, 0x177e8, 0x133e4, 0x111e2, 0x177e4, 0x133e2, 0x177e2,
+ 0x111f6, 0x133f6, 0x1fb94, 0x172f8, 0x1b97e, 0x1fb92, 0x1727c, 0x1723e,
+ 0x1f314, 0x1317e, 0x1f734, 0x1f312, 0x1737e, 0x1f732, 0x1e214, 0x1e634,
+ 0x1e212, 0x1ee74, 0x1e632, 0x1ee72, 0x1c434, 0x1cc74, 0x1c432, 0x1dcf4,
+ 0x1cc72, 0x1dcf2, 0x18874, 0x198f4, 0x18872, 0x1b9f4, 0x198f2, 0x1b9f2,
+ 0x110f4, 0x131f4, 0x110f2, 0x173f4, 0x131f2, 0x173f2, 0x1fb8a, 0x1717c,
+ 0x1713e, 0x1f30a, 0x1f71a, 0x1e20a, 0x1e61a, 0x1ee3a, 0x1c41a, 0x1cc3a,
+ 0x1dc7a, 0x1883a, 0x1987a, 0x1b8fa, 0x1107a, 0x130fa, 0x171fa, 0x170be,
+ 0x1e150, 0x1f0ac, 0x1e148, 0x1f0a6, 0x1e144, 0x1e142, 0x1c2d0, 0x1e16c,
+ 0x1c2c8, 0x1e166, 0x1c2c4, 0x1c2c2, 0x185d0, 0x1c2ec, 0x185c8, 0x1c2e6,
+ 0x185c4, 0x185c2, 0x10bd0, 0x185ec, 0x10bc8, 0x185e6, 0x10bc4, 0x10bc2,
+ 0x10bec, 0x10be6, 0x1f1a8, 0x1f8d6, 0x11afc, 0x1f1a4, 0x11a7e, 0x1f1a2,
+ 0x1e128, 0x1f096, 0x1e368, 0x1e124, 0x1e364, 0x1e122, 0x1e362, 0x1c268,
+ 0x1e136, 0x1c6e8, 0x1c264, 0x1c6e4, 0x1c262, 0x1c6e2, 0x184e8, 0x1c276,
+ 0x18de8, 0x184e4, 0x18de4, 0x184e2, 0x18de2, 0x109e8, 0x184f6, 0x11be8,
+ 0x109e4, 0x11be4, 0x109e2, 0x11be2, 0x109f6, 0x11bf6, 0x1f9d4, 0x13af8,
+ 0x19d7e, 0x1f9d2, 0x13a7c, 0x13a3e, 0x1f194, 0x1197e, 0x1f3b4, 0x1f192,
+ 0x13b7e, 0x1f3b2, 0x1e114, 0x1e334, 0x1e112, 0x1e774, 0x1e332, 0x1e772,
+ 0x1c234, 0x1c674, 0x1c232, 0x1cef4, 0x1c672, 0x1cef2, 0x18474, 0x18cf4,
+ 0x18472, 0x19df4, 0x18cf2, 0x19df2, 0x108f4, 0x119f4, 0x108f2, 0x13bf4,
+ 0x119f2, 0x13bf2, 0x17af0, 0x1bd7c, 0x17a78, 0x1bd3e, 0x17a3c, 0x17a1e,
+ 0x1f9ca, 0x1397c, 0x1fbda, 0x17b7c, 0x1393e, 0x17b3e, 0x1f18a, 0x1f39a,
+ 0x1f7ba, 0x1e10a, 0x1e31a, 0x1e73a, 0x1ef7a, 0x1c21a, 0x1c63a, 0x1ce7a,
+ 0x1defa, 0x1843a, 0x18c7a, 0x19cfa, 0x1bdfa, 0x1087a, 0x118fa, 0x139fa,
+ 0x17978, 0x1bcbe, 0x1793c, 0x1791e, 0x138be, 0x179be, 0x178bc, 0x1789e,
+ 0x1785e, 0x1e0a8, 0x1e0a4, 0x1e0a2, 0x1c168, 0x1e0b6, 0x1c164, 0x1c162,
+ 0x182e8, 0x1c176, 0x182e4, 0x182e2, 0x105e8, 0x182f6, 0x105e4, 0x105e2,
+ 0x105f6, 0x1f0d4, 0x10d7e, 0x1f0d2, 0x1e094, 0x1e1b4, 0x1e092, 0x1e1b2,
+ 0x1c134, 0x1c374, 0x1c132, 0x1c372, 0x18274, 0x186f4, 0x18272, 0x186f2,
+ 0x104f4, 0x10df4, 0x104f2, 0x10df2, 0x1f8ea, 0x11d7c, 0x11d3e, 0x1f0ca,
+ 0x1f1da, 0x1e08a, 0x1e19a, 0x1e3ba, 0x1c11a, 0x1c33a, 0x1c77a, 0x1823a,
+ 0x1867a, 0x18efa, 0x1047a, 0x10cfa, 0x11dfa, 0x13d78, 0x19ebe, 0x13d3c,
+ 0x13d1e, 0x11cbe, 0x13dbe, 0x17d70, 0x1bebc, 0x17d38, 0x1be9e, 0x17d1c,
+ 0x17d0e, 0x13cbc, 0x17dbc, 0x13c9e, 0x17d9e, 0x17cb8, 0x1be5e, 0x17c9c,
+ 0x17c8e, 0x13c5e, 0x17cde, 0x17c5c, 0x17c4e, 0x17c2e, 0x1c0b4, 0x1c0b2,
+ 0x18174, 0x18172, 0x102f4, 0x102f2, 0x1e0da, 0x1c09a, 0x1c1ba, 0x1813a,
+ 0x1837a, 0x1027a, 0x106fa, 0x10ebe, 0x11ebc, 0x11e9e, 0x13eb8, 0x19f5e,
+ 0x13e9c, 0x13e8e, 0x11e5e, 0x13ede, 0x17eb0, 0x1bf5c, 0x17e98, 0x1bf4e,
+ 0x17e8c, 0x17e86, 0x13e5c, 0x17edc, 0x13e4e, 0x17ece, 0x17e58, 0x1bf2e,
+ 0x17e4c, 0x17e46, 0x13e2e, 0x17e6e, 0x17e2c, 0x17e26, 0x10f5e, 0x11f5c,
+ 0x11f4e, 0x13f58, 0x19fae, 0x13f4c, 0x13f46, 0x11f2e, 0x13f6e, 0x13f2c,
+ 0x13f26},
+ {0x1abe0, 0x1d5f8, 0x153c0, 0x1a9f0, 0x1d4fc, 0x151e0, 0x1a8f8, 0x1d47e,
+ 0x150f0, 0x1a87c, 0x15078, 0x1fad0, 0x15be0, 0x1adf8, 0x1fac8, 0x159f0,
+ 0x1acfc, 0x1fac4, 0x158f8, 0x1ac7e, 0x1fac2, 0x1587c, 0x1f5d0, 0x1faec,
+ 0x15df8, 0x1f5c8, 0x1fae6, 0x15cfc, 0x1f5c4, 0x15c7e, 0x1f5c2, 0x1ebd0,
+ 0x1f5ec, 0x1ebc8, 0x1f5e6, 0x1ebc4, 0x1ebc2, 0x1d7d0, 0x1ebec, 0x1d7c8,
+ 0x1ebe6, 0x1d7c4, 0x1d7c2, 0x1afd0, 0x1d7ec, 0x1afc8, 0x1d7e6, 0x1afc4,
+ 0x14bc0, 0x1a5f0, 0x1d2fc, 0x149e0, 0x1a4f8, 0x1d27e, 0x148f0, 0x1a47c,
+ 0x14878, 0x1a43e, 0x1483c, 0x1fa68, 0x14df0, 0x1a6fc, 0x1fa64, 0x14cf8,
+ 0x1a67e, 0x1fa62, 0x14c7c, 0x14c3e, 0x1f4e8, 0x1fa76, 0x14efc, 0x1f4e4,
+ 0x14e7e, 0x1f4e2, 0x1e9e8, 0x1f4f6, 0x1e9e4, 0x1e9e2, 0x1d3e8, 0x1e9f6,
+ 0x1d3e4, 0x1d3e2, 0x1a7e8, 0x1d3f6, 0x1a7e4, 0x1a7e2, 0x145e0, 0x1a2f8,
+ 0x1d17e, 0x144f0, 0x1a27c, 0x14478, 0x1a23e, 0x1443c, 0x1441e, 0x1fa34,
+ 0x146f8, 0x1a37e, 0x1fa32, 0x1467c, 0x1463e, 0x1f474, 0x1477e, 0x1f472,
+ 0x1e8f4, 0x1e8f2, 0x1d1f4, 0x1d1f2, 0x1a3f4, 0x1a3f2, 0x142f0, 0x1a17c,
+ 0x14278, 0x1a13e, 0x1423c, 0x1421e, 0x1fa1a, 0x1437c, 0x1433e, 0x1f43a,
+ 0x1e87a, 0x1d0fa, 0x14178, 0x1a0be, 0x1413c, 0x1411e, 0x141be, 0x140bc,
+ 0x1409e, 0x12bc0, 0x195f0, 0x1cafc, 0x129e0, 0x194f8, 0x1ca7e, 0x128f0,
+ 0x1947c, 0x12878, 0x1943e, 0x1283c, 0x1f968, 0x12df0, 0x196fc, 0x1f964,
+ 0x12cf8, 0x1967e, 0x1f962, 0x12c7c, 0x12c3e, 0x1f2e8, 0x1f976, 0x12efc,
+ 0x1f2e4, 0x12e7e, 0x1f2e2, 0x1e5e8, 0x1f2f6, 0x1e5e4, 0x1e5e2, 0x1cbe8,
+ 0x1e5f6, 0x1cbe4, 0x1cbe2, 0x197e8, 0x1cbf6, 0x197e4, 0x197e2, 0x1b5e0,
+ 0x1daf8, 0x1ed7e, 0x169c0, 0x1b4f0, 0x1da7c, 0x168e0, 0x1b478, 0x1da3e,
+ 0x16870, 0x1b43c, 0x16838, 0x1b41e, 0x1681c, 0x125e0, 0x192f8, 0x1c97e,
+ 0x16de0, 0x124f0, 0x1927c, 0x16cf0, 0x1b67c, 0x1923e, 0x16c78, 0x1243c,
+ 0x16c3c, 0x1241e, 0x16c1e, 0x1f934, 0x126f8, 0x1937e, 0x1fb74, 0x1f932,
+ 0x16ef8, 0x1267c, 0x1fb72, 0x16e7c, 0x1263e, 0x16e3e, 0x1f274, 0x1277e,
+ 0x1f6f4, 0x1f272, 0x16f7e, 0x1f6f2, 0x1e4f4, 0x1edf4, 0x1e4f2, 0x1edf2,
+ 0x1c9f4, 0x1dbf4, 0x1c9f2, 0x1dbf2, 0x193f4, 0x193f2, 0x165c0, 0x1b2f0,
+ 0x1d97c, 0x164e0, 0x1b278, 0x1d93e, 0x16470, 0x1b23c, 0x16438, 0x1b21e,
+ 0x1641c, 0x1640e, 0x122f0, 0x1917c, 0x166f0, 0x12278, 0x1913e, 0x16678,
+ 0x1b33e, 0x1663c, 0x1221e, 0x1661e, 0x1f91a, 0x1237c, 0x1fb3a, 0x1677c,
+ 0x1233e, 0x1673e, 0x1f23a, 0x1f67a, 0x1e47a, 0x1ecfa, 0x1c8fa, 0x1d9fa,
+ 0x191fa, 0x162e0, 0x1b178, 0x1d8be, 0x16270, 0x1b13c, 0x16238, 0x1b11e,
+ 0x1621c, 0x1620e, 0x12178, 0x190be, 0x16378, 0x1213c, 0x1633c, 0x1211e,
+ 0x1631e, 0x121be, 0x163be, 0x16170, 0x1b0bc, 0x16138, 0x1b09e, 0x1611c,
+ 0x1610e, 0x120bc, 0x161bc, 0x1209e, 0x1619e, 0x160b8, 0x1b05e, 0x1609c,
+ 0x1608e, 0x1205e, 0x160de, 0x1605c, 0x1604e, 0x115e0, 0x18af8, 0x1c57e,
+ 0x114f0, 0x18a7c, 0x11478, 0x18a3e, 0x1143c, 0x1141e, 0x1f8b4, 0x116f8,
+ 0x18b7e, 0x1f8b2, 0x1167c, 0x1163e, 0x1f174, 0x1177e, 0x1f172, 0x1e2f4,
+ 0x1e2f2, 0x1c5f4, 0x1c5f2, 0x18bf4, 0x18bf2, 0x135c0, 0x19af0, 0x1cd7c,
+ 0x134e0, 0x19a78, 0x1cd3e, 0x13470, 0x19a3c, 0x13438, 0x19a1e, 0x1341c,
+ 0x1340e, 0x112f0, 0x1897c, 0x136f0, 0x11278, 0x1893e, 0x13678, 0x19b3e,
+ 0x1363c, 0x1121e, 0x1361e, 0x1f89a, 0x1137c, 0x1f9ba, 0x1377c, 0x1133e,
+ 0x1373e, 0x1f13a, 0x1f37a, 0x1e27a, 0x1e6fa, 0x1c4fa, 0x1cdfa, 0x189fa,
+ 0x1bae0, 0x1dd78, 0x1eebe, 0x174c0, 0x1ba70, 0x1dd3c, 0x17460, 0x1ba38,
+ 0x1dd1e, 0x17430, 0x1ba1c, 0x17418, 0x1ba0e, 0x1740c, 0x132e0, 0x19978,
+ 0x1ccbe, 0x176e0, 0x13270, 0x1993c, 0x17670, 0x1bb3c, 0x1991e, 0x17638,
+ 0x1321c, 0x1761c, 0x1320e, 0x1760e, 0x11178, 0x188be, 0x13378, 0x1113c,
+ 0x17778, 0x1333c, 0x1111e, 0x1773c, 0x1331e, 0x1771e, 0x111be, 0x133be,
+ 0x177be, 0x172c0, 0x1b970, 0x1dcbc, 0x17260, 0x1b938, 0x1dc9e, 0x17230,
+ 0x1b91c, 0x17218, 0x1b90e, 0x1720c, 0x17206, 0x13170, 0x198bc, 0x17370,
+ 0x13138, 0x1989e, 0x17338, 0x1b99e, 0x1731c, 0x1310e, 0x1730e, 0x110bc,
+ 0x131bc, 0x1109e, 0x173bc, 0x1319e, 0x1739e, 0x17160, 0x1b8b8, 0x1dc5e,
+ 0x17130, 0x1b89c, 0x17118, 0x1b88e, 0x1710c, 0x17106, 0x130b8, 0x1985e,
+ 0x171b8, 0x1309c, 0x1719c, 0x1308e, 0x1718e, 0x1105e, 0x130de, 0x171de,
+ 0x170b0, 0x1b85c, 0x17098, 0x1b84e, 0x1708c, 0x17086, 0x1305c, 0x170dc,
+ 0x1304e, 0x170ce, 0x17058, 0x1b82e, 0x1704c, 0x17046, 0x1302e, 0x1706e,
+ 0x1702c, 0x17026, 0x10af0, 0x1857c, 0x10a78, 0x1853e, 0x10a3c, 0x10a1e,
+ 0x10b7c, 0x10b3e, 0x1f0ba, 0x1e17a, 0x1c2fa, 0x185fa, 0x11ae0, 0x18d78,
+ 0x1c6be, 0x11a70, 0x18d3c, 0x11a38, 0x18d1e, 0x11a1c, 0x11a0e, 0x10978,
+ 0x184be, 0x11b78, 0x1093c, 0x11b3c, 0x1091e, 0x11b1e, 0x109be, 0x11bbe,
+ 0x13ac0, 0x19d70, 0x1cebc, 0x13a60, 0x19d38, 0x1ce9e, 0x13a30, 0x19d1c,
+ 0x13a18, 0x19d0e, 0x13a0c, 0x13a06, 0x11970, 0x18cbc, 0x13b70, 0x11938,
+ 0x18c9e, 0x13b38, 0x1191c, 0x13b1c, 0x1190e, 0x13b0e, 0x108bc, 0x119bc,
+ 0x1089e, 0x13bbc, 0x1199e, 0x13b9e, 0x1bd60, 0x1deb8, 0x1ef5e, 0x17a40,
+ 0x1bd30, 0x1de9c, 0x17a20, 0x1bd18, 0x1de8e, 0x17a10, 0x1bd0c, 0x17a08,
+ 0x1bd06, 0x17a04, 0x13960, 0x19cb8, 0x1ce5e, 0x17b60, 0x13930, 0x19c9c,
+ 0x17b30, 0x1bd9c, 0x19c8e, 0x17b18, 0x1390c, 0x17b0c, 0x13906, 0x17b06,
+ 0x118b8, 0x18c5e, 0x139b8, 0x1189c, 0x17bb8, 0x1399c, 0x1188e, 0x17b9c,
+ 0x1398e, 0x17b8e, 0x1085e, 0x118de, 0x139de, 0x17bde, 0x17940, 0x1bcb0,
+ 0x1de5c, 0x17920, 0x1bc98, 0x1de4e, 0x17910, 0x1bc8c, 0x17908, 0x1bc86,
+ 0x17904, 0x17902, 0x138b0, 0x19c5c, 0x179b0, 0x13898, 0x19c4e, 0x17998,
+ 0x1bcce, 0x1798c, 0x13886, 0x17986, 0x1185c, 0x138dc, 0x1184e, 0x179dc,
+ 0x138ce, 0x179ce, 0x178a0, 0x1bc58, 0x1de2e, 0x17890, 0x1bc4c, 0x17888,
+ 0x1bc46, 0x17884, 0x17882, 0x13858, 0x19c2e, 0x178d8, 0x1384c, 0x178cc,
+ 0x13846, 0x178c6, 0x1182e, 0x1386e, 0x178ee, 0x17850, 0x1bc2c, 0x17848,
+ 0x1bc26, 0x17844, 0x17842, 0x1382c, 0x1786c, 0x13826, 0x17866, 0x17828,
+ 0x1bc16, 0x17824, 0x17822, 0x13816, 0x17836, 0x10578, 0x182be, 0x1053c,
+ 0x1051e, 0x105be, 0x10d70, 0x186bc, 0x10d38, 0x1869e, 0x10d1c, 0x10d0e,
+ 0x104bc, 0x10dbc, 0x1049e, 0x10d9e, 0x11d60, 0x18eb8, 0x1c75e, 0x11d30,
+ 0x18e9c, 0x11d18, 0x18e8e, 0x11d0c, 0x11d06, 0x10cb8, 0x1865e, 0x11db8,
+ 0x10c9c, 0x11d9c, 0x10c8e, 0x11d8e, 0x1045e, 0x10cde, 0x11dde, 0x13d40,
+ 0x19eb0, 0x1cf5c, 0x13d20, 0x19e98, 0x1cf4e, 0x13d10, 0x19e8c, 0x13d08,
+ 0x19e86, 0x13d04, 0x13d02, 0x11cb0, 0x18e5c, 0x13db0, 0x11c98, 0x18e4e,
+ 0x13d98, 0x19ece, 0x13d8c, 0x11c86, 0x13d86, 0x10c5c, 0x11cdc, 0x10c4e,
+ 0x13ddc, 0x11cce, 0x13dce, 0x1bea0, 0x1df58, 0x1efae, 0x1be90, 0x1df4c,
+ 0x1be88, 0x1df46, 0x1be84, 0x1be82, 0x13ca0, 0x19e58, 0x1cf2e, 0x17da0,
+ 0x13c90, 0x19e4c, 0x17d90, 0x1becc, 0x19e46, 0x17d88, 0x13c84, 0x17d84,
+ 0x13c82, 0x17d82, 0x11c58, 0x18e2e, 0x13cd8, 0x11c4c, 0x17dd8, 0x13ccc,
+ 0x11c46, 0x17dcc, 0x13cc6, 0x17dc6, 0x10c2e, 0x11c6e, 0x13cee, 0x17dee,
+ 0x1be50, 0x1df2c, 0x1be48, 0x1df26, 0x1be44, 0x1be42, 0x13c50, 0x19e2c,
+ 0x17cd0, 0x13c48, 0x19e26, 0x17cc8, 0x1be66, 0x17cc4, 0x13c42, 0x17cc2,
+ 0x11c2c, 0x13c6c, 0x11c26, 0x17cec, 0x13c66, 0x17ce6, 0x1be28, 0x1df16,
+ 0x1be24, 0x1be22, 0x13c28, 0x19e16, 0x17c68, 0x13c24, 0x17c64, 0x13c22,
+ 0x17c62, 0x11c16, 0x13c36, 0x17c76, 0x1be14, 0x1be12, 0x13c14, 0x17c34,
+ 0x13c12, 0x17c32, 0x102bc, 0x1029e, 0x106b8, 0x1835e, 0x1069c, 0x1068e,
+ 0x1025e, 0x106de, 0x10eb0, 0x1875c, 0x10e98, 0x1874e, 0x10e8c, 0x10e86,
+ 0x1065c, 0x10edc, 0x1064e, 0x10ece, 0x11ea0, 0x18f58, 0x1c7ae, 0x11e90,
+ 0x18f4c, 0x11e88, 0x18f46, 0x11e84, 0x11e82, 0x10e58, 0x1872e, 0x11ed8,
+ 0x18f6e, 0x11ecc, 0x10e46, 0x11ec6, 0x1062e, 0x10e6e, 0x11eee, 0x19f50,
+ 0x1cfac, 0x19f48, 0x1cfa6, 0x19f44, 0x19f42, 0x11e50, 0x18f2c, 0x13ed0,
+ 0x19f6c, 0x18f26, 0x13ec8, 0x11e44, 0x13ec4, 0x11e42, 0x13ec2, 0x10e2c,
+ 0x11e6c, 0x10e26, 0x13eec, 0x11e66, 0x13ee6, 0x1dfa8, 0x1efd6, 0x1dfa4,
+ 0x1dfa2, 0x19f28, 0x1cf96, 0x1bf68, 0x19f24, 0x1bf64, 0x19f22, 0x1bf62,
+ 0x11e28, 0x18f16, 0x13e68, 0x11e24, 0x17ee8, 0x13e64, 0x11e22, 0x17ee4,
+ 0x13e62, 0x17ee2, 0x10e16, 0x11e36, 0x13e76, 0x17ef6, 0x1df94, 0x1df92,
+ 0x19f14, 0x1bf34, 0x19f12, 0x1bf32, 0x11e14, 0x13e34, 0x11e12, 0x17e74,
+ 0x13e32, 0x17e72, 0x1df8a, 0x19f0a, 0x1bf1a, 0x11e0a, 0x13e1a, 0x17e3a,
+ 0x1035c, 0x1034e, 0x10758, 0x183ae, 0x1074c, 0x10746, 0x1032e, 0x1076e,
+ 0x10f50, 0x187ac, 0x10f48, 0x187a6, 0x10f44, 0x10f42, 0x1072c, 0x10f6c,
+ 0x10726, 0x10f66, 0x18fa8, 0x1c7d6, 0x18fa4, 0x18fa2, 0x10f28, 0x18796,
+ 0x11f68, 0x18fb6, 0x11f64, 0x10f22, 0x11f62, 0x10716, 0x10f36, 0x11f76,
+ 0x1cfd4, 0x1cfd2, 0x18f94, 0x19fb4, 0x18f92, 0x19fb2, 0x10f14, 0x11f34,
+ 0x10f12, 0x13f74, 0x11f32, 0x13f72, 0x1cfca, 0x18f8a, 0x19f9a, 0x10f0a,
+ 0x11f1a, 0x13f3a, 0x103ac, 0x103a6, 0x107a8, 0x183d6, 0x107a4, 0x107a2,
+ 0x10396, 0x107b6, 0x187d4, 0x187d2, 0x10794, 0x10fb4, 0x10792, 0x10fb2,
+ 0x1c7ea}};
+
+CBC_PDF417::CBC_PDF417() : CBC_PDF417(false) {}
+
+CBC_PDF417::CBC_PDF417(bool compact)
+ : m_compact(compact),
+ m_compaction(AUTO),
+ m_minCols(1),
+ m_maxCols(30),
+ m_maxRows(90),
+ m_minRows(3) {}
+
+CBC_PDF417::~CBC_PDF417() {}
+
+CBC_BarcodeMatrix* CBC_PDF417::getBarcodeMatrix() {
+ return m_barcodeMatrix.get();
+}
+
+void CBC_PDF417::generateBarcodeLogic(CFX_WideString msg,
+ int32_t errorCorrectionLevel,
+ int32_t& e) {
+ int32_t errorCorrectionCodeWords =
+ CBC_PDF417ErrorCorrection::getErrorCorrectionCodewordCount(
+ errorCorrectionLevel, e);
+ if (e != BCExceptionNO)
+ return;
+ CFX_WideString highLevel =
+ CBC_PDF417HighLevelEncoder::encodeHighLevel(msg, m_compaction, e);
+ if (e != BCExceptionNO)
+ return;
+ int32_t sourceCodeWords = highLevel.GetLength();
+ std::vector<int32_t>* dimension =
+ determineDimensions(sourceCodeWords, errorCorrectionCodeWords, e);
+ if (e != BCExceptionNO)
+ return;
+ int32_t cols = (*dimension)[0];
+ int32_t rows = (*dimension)[1];
+ delete dimension;
+ int32_t pad = getNumberOfPadCodewords(sourceCodeWords,
+ errorCorrectionCodeWords, cols, rows);
+ if (sourceCodeWords + errorCorrectionCodeWords + 1 > 929) {
+ e = BCExceptionEncodedMessageContainsTooManyCodeWords;
+ return;
+ }
+ int32_t n = sourceCodeWords + pad + 1;
+ CFX_WideString sb;
+ sb += (wchar_t)n;
+ sb += highLevel;
+ for (int32_t i = 0; i < pad; i++) {
+ sb += (wchar_t)900;
+ }
+ CFX_WideString dataCodewords(sb);
+ CFX_WideString ec = CBC_PDF417ErrorCorrection::generateErrorCorrection(
+ dataCodewords, errorCorrectionLevel, e);
+ if (e != BCExceptionNO)
+ return;
+ CFX_WideString fullCodewords = dataCodewords + ec;
+ m_barcodeMatrix = pdfium::MakeUnique<CBC_BarcodeMatrix>(rows, cols);
+ encodeLowLevel(fullCodewords, cols, rows, errorCorrectionLevel,
+ m_barcodeMatrix.get());
+}
+
+void CBC_PDF417::setDimensions(int32_t maxCols,
+ int32_t minCols,
+ int32_t maxRows,
+ int32_t minRows) {
+ m_maxCols = maxCols;
+ m_minCols = minCols;
+ m_maxRows = maxRows;
+ m_minRows = minRows;
+}
+
+void CBC_PDF417::setCompaction(Compaction compaction) {
+ m_compaction = compaction;
+}
+
+void CBC_PDF417::setCompact(bool compact) {
+ m_compact = compact;
+}
+
+int32_t CBC_PDF417::calculateNumberOfRows(int32_t m, int32_t k, int32_t c) {
+ int32_t r = ((m + 1 + k) / c) + 1;
+ if (c * r >= (m + 1 + k + c)) {
+ r--;
+ }
+ return r;
+}
+
+int32_t CBC_PDF417::getNumberOfPadCodewords(int32_t m,
+ int32_t k,
+ int32_t c,
+ int32_t r) {
+ int32_t n = c * r - k;
+ return n > m + 1 ? n - m - 1 : 0;
+}
+
+void CBC_PDF417::encodeChar(int32_t pattern,
+ int32_t len,
+ CBC_BarcodeRow* logic) {
+ int32_t map = 1 << (len - 1);
+ bool last = ((pattern & map) != 0);
+ int32_t width = 0;
+ for (int32_t i = 0; i < len; i++) {
+ bool black = ((pattern & map) != 0);
+ if (last == black) {
+ width++;
+ } else {
+ logic->addBar(last, width);
+ last = black;
+ width = 1;
+ }
+ map >>= 1;
+ }
+ logic->addBar(last, width);
+}
+
+void CBC_PDF417::encodeLowLevel(CFX_WideString fullCodewords,
+ int32_t c,
+ int32_t r,
+ int32_t errorCorrectionLevel,
+ CBC_BarcodeMatrix* logic) {
+ int32_t idx = 0;
+ for (int32_t y = 0; y < r; y++) {
+ int32_t cluster = y % 3;
+ logic->startRow();
+ encodeChar(START_PATTERN, 17, logic->getCurrentRow());
+ int32_t left;
+ int32_t right;
+ if (cluster == 0) {
+ left = (30 * (y / 3)) + ((r - 1) / 3);
+ right = (30 * (y / 3)) + (c - 1);
+ } else if (cluster == 1) {
+ left = (30 * (y / 3)) + (errorCorrectionLevel * 3) + ((r - 1) % 3);
+ right = (30 * (y / 3)) + ((r - 1) / 3);
+ } else {
+ left = (30 * (y / 3)) + (c - 1);
+ right = (30 * (y / 3)) + (errorCorrectionLevel * 3) + ((r - 1) % 3);
+ }
+ int32_t pattern = CODEWORD_TABLE[cluster][left];
+ encodeChar(pattern, 17, logic->getCurrentRow());
+ for (int32_t x = 0; x < c; x++) {
+ pattern = CODEWORD_TABLE[cluster][fullCodewords.GetAt(idx)];
+ encodeChar(pattern, 17, logic->getCurrentRow());
+ idx++;
+ }
+ if (m_compact) {
+ encodeChar(STOP_PATTERN, 1, logic->getCurrentRow());
+ } else {
+ pattern = CODEWORD_TABLE[cluster][right];
+ encodeChar(pattern, 17, logic->getCurrentRow());
+ encodeChar(STOP_PATTERN, 18, logic->getCurrentRow());
+ }
+ }
+}
+
+std::vector<int32_t>* CBC_PDF417::determineDimensions(
+ int32_t sourceCodeWords,
+ int32_t errorCorrectionCodeWords,
+ int32_t& e) {
+ float ratio = 0.0f;
+ std::vector<int32_t>* dimension = nullptr;
+ for (int32_t cols = m_minCols; cols <= m_maxCols; cols++) {
+ int32_t rows =
+ calculateNumberOfRows(sourceCodeWords, errorCorrectionCodeWords, cols);
+ if (rows < m_minRows) {
+ break;
+ }
+ if (rows > m_maxRows) {
+ continue;
+ }
+ float newRatio =
+ ((17 * cols + 69) * DEFAULT_MODULE_WIDTH) / (rows * HEIGHT);
+ if (dimension &&
+ fabsf(newRatio - PREFERRED_RATIO) > fabsf(ratio - PREFERRED_RATIO)) {
+ continue;
+ }
+ ratio = newRatio;
+ delete dimension;
+ dimension = new std::vector<int32_t>;
+ dimension->push_back(cols);
+ dimension->push_back(rows);
+ }
+ if (!dimension) {
+ int32_t rows = calculateNumberOfRows(sourceCodeWords,
+ errorCorrectionCodeWords, m_minCols);
+ if (rows < m_minRows) {
+ dimension = new std::vector<int32_t>;
+ dimension->push_back(m_minCols);
+ dimension->push_back(m_minRows);
+ } else if (rows >= 3 && rows <= 90) {
+ dimension = new std::vector<int32_t>;
+ dimension->push_back(m_minCols);
+ dimension->push_back(rows);
+ }
+ }
+ if (!dimension) {
+ e = BCExceptionUnableToFitMessageInColumns;
+ return nullptr;
+ }
+ return dimension;
+}
diff --git a/chromium/third_party/pdfium/fxbarcode/pdf417/BC_PDF417.h b/chromium/third_party/pdfium/fxbarcode/pdf417/BC_PDF417.h
new file mode 100644
index 00000000000..bc36ea50375
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/pdf417/BC_PDF417.h
@@ -0,0 +1,68 @@
+// 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 FXBARCODE_PDF417_BC_PDF417_H_
+#define FXBARCODE_PDF417_BC_PDF417_H_
+
+#include <memory>
+#include <vector>
+
+#include "core/fxcrt/fx_basic.h"
+#include "fxbarcode/pdf417/BC_PDF417Compaction.h"
+
+class CBC_BarcodeRow;
+class CBC_BarcodeMatrix;
+
+class CBC_PDF417 {
+ public:
+ CBC_PDF417();
+ explicit CBC_PDF417(bool compact);
+ virtual ~CBC_PDF417();
+
+ CBC_BarcodeMatrix* getBarcodeMatrix();
+ void generateBarcodeLogic(CFX_WideString msg,
+ int32_t errorCorrectionLevel,
+ int32_t& e);
+ void setDimensions(int32_t maxCols,
+ int32_t minCols,
+ int32_t maxRows,
+ int32_t minRows);
+ void setCompaction(Compaction compaction);
+ void setCompact(bool compact);
+
+ private:
+ static const int32_t START_PATTERN = 0x1fea8;
+ static const int32_t STOP_PATTERN = 0x3fa29;
+ static const int32_t CODEWORD_TABLE[][929];
+ static constexpr float PREFERRED_RATIO = 3.0f;
+ static constexpr float DEFAULT_MODULE_WIDTH = 0.357f;
+ static constexpr float HEIGHT = 2.0f;
+
+ static int32_t calculateNumberOfRows(int32_t m, int32_t k, int32_t c);
+ static int32_t getNumberOfPadCodewords(int32_t m,
+ int32_t k,
+ int32_t c,
+ int32_t r);
+ static void encodeChar(int32_t pattern, int32_t len, CBC_BarcodeRow* logic);
+ void encodeLowLevel(CFX_WideString fullCodewords,
+ int32_t c,
+ int32_t r,
+ int32_t errorCorrectionLevel,
+ CBC_BarcodeMatrix* logic);
+ std::vector<int32_t>* determineDimensions(int32_t sourceCodeWords,
+ int32_t errorCorrectionCodeWords,
+ int32_t& e);
+
+ std::unique_ptr<CBC_BarcodeMatrix> m_barcodeMatrix;
+ bool m_compact;
+ Compaction m_compaction;
+ int32_t m_minCols;
+ int32_t m_maxCols;
+ int32_t m_maxRows;
+ int32_t m_minRows;
+};
+
+#endif // FXBARCODE_PDF417_BC_PDF417_H_
diff --git a/chromium/third_party/pdfium/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.cpp b/chromium/third_party/pdfium/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.cpp
new file mode 100644
index 00000000000..564d7ef0b10
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.cpp
@@ -0,0 +1,84 @@
+// 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
+// Original code is licensed as follows:
+/*
+ * Copyright 2011 ZXing authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "fxbarcode/pdf417/BC_PDF417BarcodeMatrix.h"
+#include "fxbarcode/pdf417/BC_PDF417BarcodeRow.h"
+
+CBC_BarcodeMatrix::CBC_BarcodeMatrix(int32_t height, int32_t width) {
+ m_matrix.resize(height + 2);
+ for (size_t i = 0, matrixLength = m_matrix.size(); i < matrixLength; ++i)
+ m_matrix[i] = new CBC_BarcodeRow((width + 4) * 17 + 1);
+
+ m_width = width * 17;
+ m_height = height + 2;
+ m_currentRow = 0;
+ m_outHeight = 0;
+ m_outWidth = 0;
+}
+
+CBC_BarcodeMatrix::~CBC_BarcodeMatrix() {
+ for (size_t i = 0; i < m_matrix.size(); i++)
+ delete m_matrix[i];
+}
+
+void CBC_BarcodeMatrix::set(int32_t x, int32_t y, uint8_t value) {
+ m_matrix[y]->set(x, value);
+}
+void CBC_BarcodeMatrix::setMatrix(int32_t x, int32_t y, bool black) {
+ set(x, y, (uint8_t)(black ? 1 : 0));
+}
+void CBC_BarcodeMatrix::startRow() {
+ ++m_currentRow;
+}
+CBC_BarcodeRow* CBC_BarcodeMatrix::getCurrentRow() {
+ return m_matrix[m_currentRow];
+}
+int32_t CBC_BarcodeMatrix::getWidth() {
+ return m_outWidth;
+}
+int32_t CBC_BarcodeMatrix::getHeight() {
+ return m_outHeight;
+}
+std::vector<uint8_t>& CBC_BarcodeMatrix::getMatrix() {
+ return getScaledMatrix(1, 1);
+}
+std::vector<uint8_t>& CBC_BarcodeMatrix::getScaledMatrix(int32_t scale) {
+ return getScaledMatrix(scale, scale);
+}
+std::vector<uint8_t>& CBC_BarcodeMatrix::getScaledMatrix(int32_t xScale,
+ int32_t yScale) {
+ size_t yMax = m_height * yScale;
+ std::vector<uint8_t> bytearray = m_matrix[0]->getScaledRow(xScale);
+ size_t xMax = bytearray.size();
+ m_matrixOut.resize(xMax * yMax);
+ m_outWidth = xMax;
+ m_outHeight = yMax;
+ int32_t k = 0;
+ for (size_t i = 0; i < yMax; i++) {
+ if (i != 0)
+ bytearray = m_matrix[i / yScale]->getScaledRow(xScale);
+ k = i * xMax;
+ for (size_t l = 0; l < xMax; l++)
+ m_matrixOut[k + l] = bytearray[l];
+ }
+ return m_matrixOut;
+}
diff --git a/chromium/third_party/pdfium/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.h b/chromium/third_party/pdfium/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.h
new file mode 100644
index 00000000000..964048db9f8
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.h
@@ -0,0 +1,42 @@
+// 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 FXBARCODE_PDF417_BC_PDF417BARCODEMATRIX_H_
+#define FXBARCODE_PDF417_BC_PDF417BARCODEMATRIX_H_
+
+#include <vector>
+
+#include "core/fxcrt/fx_basic.h"
+
+class CBC_BarcodeRow;
+
+class CBC_BarcodeMatrix {
+ public:
+ CBC_BarcodeMatrix();
+ CBC_BarcodeMatrix(int32_t height, int32_t width);
+ virtual ~CBC_BarcodeMatrix();
+
+ void set(int32_t x, int32_t y, uint8_t value);
+ void setMatrix(int32_t x, int32_t y, bool black);
+ void startRow();
+ CBC_BarcodeRow* getCurrentRow();
+ std::vector<uint8_t>& getMatrix();
+ std::vector<uint8_t>& getScaledMatrix(int32_t scale);
+ std::vector<uint8_t>& getScaledMatrix(int32_t xScale, int32_t yScale);
+ int32_t getWidth();
+ int32_t getHeight();
+
+ private:
+ std::vector<CBC_BarcodeRow*> m_matrix;
+ std::vector<uint8_t> m_matrixOut;
+ int32_t m_currentRow;
+ int32_t m_height;
+ int32_t m_width;
+ int32_t m_outWidth;
+ int32_t m_outHeight;
+};
+
+#endif // FXBARCODE_PDF417_BC_PDF417BARCODEMATRIX_H_
diff --git a/chromium/third_party/pdfium/fxbarcode/pdf417/BC_PDF417BarcodeRow.cpp b/chromium/third_party/pdfium/fxbarcode/pdf417/BC_PDF417BarcodeRow.cpp
new file mode 100644
index 00000000000..c0c251f708f
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/pdf417/BC_PDF417BarcodeRow.cpp
@@ -0,0 +1,52 @@
+// 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
+// Original code is licensed as follows:
+/*
+ * Copyright 2011 ZXing authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "fxbarcode/pdf417/BC_PDF417BarcodeRow.h"
+
+CBC_BarcodeRow::CBC_BarcodeRow(size_t width)
+ : m_row(width), m_currentLocation(0) {}
+
+CBC_BarcodeRow::~CBC_BarcodeRow() {}
+
+void CBC_BarcodeRow::set(int32_t x, uint8_t value) {
+ m_row[x] = value;
+}
+
+void CBC_BarcodeRow::set(int32_t x, bool black) {
+ m_row[x] = black ? 1 : 0;
+}
+
+void CBC_BarcodeRow::addBar(bool black, int32_t width) {
+ for (int32_t ii = 0; ii < width; ii++)
+ set(m_currentLocation++, black);
+}
+
+std::vector<uint8_t>& CBC_BarcodeRow::getRow() {
+ return m_row;
+}
+
+std::vector<uint8_t>& CBC_BarcodeRow::getScaledRow(int32_t scale) {
+ m_output.resize(m_row.size() * scale);
+ for (size_t i = 0; i < m_output.size(); i++)
+ m_output[i] = m_row[i / scale];
+ return m_output;
+}
diff --git a/chromium/third_party/pdfium/fxbarcode/pdf417/BC_PDF417BarcodeRow.h b/chromium/third_party/pdfium/fxbarcode/pdf417/BC_PDF417BarcodeRow.h
new file mode 100644
index 00000000000..d9d8f69089c
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/pdf417/BC_PDF417BarcodeRow.h
@@ -0,0 +1,31 @@
+// 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 FXBARCODE_PDF417_BC_PDF417BARCODEROW_H_
+#define FXBARCODE_PDF417_BC_PDF417BARCODEROW_H_
+
+#include <vector>
+
+#include "core/fxcrt/fx_basic.h"
+
+class CBC_BarcodeRow {
+ public:
+ explicit CBC_BarcodeRow(size_t width);
+ virtual ~CBC_BarcodeRow();
+
+ void set(int32_t x, uint8_t value);
+ void set(int32_t x, bool black);
+ void addBar(bool black, int32_t width);
+ std::vector<uint8_t>& getRow();
+ std::vector<uint8_t>& getScaledRow(int32_t scale);
+
+ private:
+ std::vector<uint8_t> m_row;
+ std::vector<uint8_t> m_output;
+ int32_t m_currentLocation;
+};
+
+#endif // FXBARCODE_PDF417_BC_PDF417BARCODEROW_H_
diff --git a/chromium/third_party/pdfium/fxbarcode/pdf417/BC_PDF417Compaction.cpp b/chromium/third_party/pdfium/fxbarcode/pdf417/BC_PDF417Compaction.cpp
new file mode 100644
index 00000000000..d0ed8780fae
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/pdf417/BC_PDF417Compaction.cpp
@@ -0,0 +1,26 @@
+// 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
+// Original code is licensed as follows:
+/*
+ * Copyright 2011 ZXing authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "fxbarcode/pdf417/BC_PDF417Compaction.h"
+
+CBC_Compaction::CBC_Compaction() {}
+CBC_Compaction::~CBC_Compaction() {}
diff --git a/chromium/third_party/pdfium/fxbarcode/pdf417/BC_PDF417Compaction.h b/chromium/third_party/pdfium/fxbarcode/pdf417/BC_PDF417Compaction.h
new file mode 100644
index 00000000000..7f4795a7e5e
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/pdf417/BC_PDF417Compaction.h
@@ -0,0 +1,18 @@
+// 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 FXBARCODE_PDF417_BC_PDF417COMPACTION_H_
+#define FXBARCODE_PDF417_BC_PDF417COMPACTION_H_
+
+class CBC_Compaction;
+enum Compaction { AUTO, TEXT, BYTES, NUMERIC };
+class CBC_Compaction {
+ public:
+ CBC_Compaction();
+ virtual ~CBC_Compaction();
+};
+
+#endif // FXBARCODE_PDF417_BC_PDF417COMPACTION_H_
diff --git a/chromium/third_party/pdfium/fxbarcode/pdf417/BC_PDF417ErrorCorrection.cpp b/chromium/third_party/pdfium/fxbarcode/pdf417/BC_PDF417ErrorCorrection.cpp
new file mode 100644
index 00000000000..abdd1139118
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/pdf417/BC_PDF417ErrorCorrection.cpp
@@ -0,0 +1,191 @@
+// 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
+// Original code is licensed as follows:
+/*
+ * Copyright 2006 Jeremias Maerki in part, and ZXing Authors in part
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "fxbarcode/pdf417/BC_PDF417ErrorCorrection.h"
+#include "fxbarcode/utils.h"
+
+namespace {
+
+const uint16_t EC_LEVEL_0_COEFFICIENTS[2] = {27, 917};
+const uint16_t EC_LEVEL_1_COEFFICIENTS[4] = {522, 568, 723, 809};
+const uint16_t EC_LEVEL_2_COEFFICIENTS[8] = {237, 308, 436, 284,
+ 646, 653, 428, 379};
+
+const uint16_t EC_LEVEL_3_COEFFICIENTS[16] = {274, 562, 232, 755, 599, 524,
+ 801, 132, 295, 116, 442, 428,
+ 295, 42, 176, 65};
+
+const uint16_t EC_LEVEL_4_COEFFICIENTS[32] = {
+ 361, 575, 922, 525, 176, 586, 640, 321, 536, 742, 677,
+ 742, 687, 284, 193, 517, 273, 494, 263, 147, 593, 800,
+ 571, 320, 803, 133, 231, 390, 685, 330, 63, 410};
+
+const uint16_t EC_LEVEL_5_COEFFICIENTS[64] = {
+ 539, 422, 6, 93, 862, 771, 453, 106, 610, 287, 107, 505, 733,
+ 877, 381, 612, 723, 476, 462, 172, 430, 609, 858, 822, 543, 376,
+ 511, 400, 672, 762, 283, 184, 440, 35, 519, 31, 460, 594, 225,
+ 535, 517, 352, 605, 158, 651, 201, 488, 502, 648, 733, 717, 83,
+ 404, 97, 280, 771, 840, 629, 4, 381, 843, 623, 264, 543};
+
+const uint16_t EC_LEVEL_6_COEFFICIENTS[128] = {
+ 521, 310, 864, 547, 858, 580, 296, 379, 53, 779, 897, 444, 400, 925, 749,
+ 415, 822, 93, 217, 208, 928, 244, 583, 620, 246, 148, 447, 631, 292, 908,
+ 490, 704, 516, 258, 457, 907, 594, 723, 674, 292, 272, 96, 684, 432, 686,
+ 606, 860, 569, 193, 219, 129, 186, 236, 287, 192, 775, 278, 173, 40, 379,
+ 712, 463, 646, 776, 171, 491, 297, 763, 156, 732, 95, 270, 447, 90, 507,
+ 48, 228, 821, 808, 898, 784, 663, 627, 378, 382, 262, 380, 602, 754, 336,
+ 89, 614, 87, 432, 670, 616, 157, 374, 242, 726, 600, 269, 375, 898, 845,
+ 454, 354, 130, 814, 587, 804, 34, 211, 330, 539, 297, 827, 865, 37, 517,
+ 834, 315, 550, 86, 801, 4, 108, 539};
+
+const uint16_t EC_LEVEL_7_COEFFICIENTS[256] = {
+ 524, 894, 75, 766, 882, 857, 74, 204, 82, 586, 708, 250, 905, 786, 138,
+ 720, 858, 194, 311, 913, 275, 190, 375, 850, 438, 733, 194, 280, 201, 280,
+ 828, 757, 710, 814, 919, 89, 68, 569, 11, 204, 796, 605, 540, 913, 801,
+ 700, 799, 137, 439, 418, 592, 668, 353, 859, 370, 694, 325, 240, 216, 257,
+ 284, 549, 209, 884, 315, 70, 329, 793, 490, 274, 877, 162, 749, 812, 684,
+ 461, 334, 376, 849, 521, 307, 291, 803, 712, 19, 358, 399, 908, 103, 511,
+ 51, 8, 517, 225, 289, 470, 637, 731, 66, 255, 917, 269, 463, 830, 730,
+ 433, 848, 585, 136, 538, 906, 90, 2, 290, 743, 199, 655, 903, 329, 49,
+ 802, 580, 355, 588, 188, 462, 10, 134, 628, 320, 479, 130, 739, 71, 263,
+ 318, 374, 601, 192, 605, 142, 673, 687, 234, 722, 384, 177, 752, 607, 640,
+ 455, 193, 689, 707, 805, 641, 48, 60, 732, 621, 895, 544, 261, 852, 655,
+ 309, 697, 755, 756, 60, 231, 773, 434, 421, 726, 528, 503, 118, 49, 795,
+ 32, 144, 500, 238, 836, 394, 280, 566, 319, 9, 647, 550, 73, 914, 342,
+ 126, 32, 681, 331, 792, 620, 60, 609, 441, 180, 791, 893, 754, 605, 383,
+ 228, 749, 760, 213, 54, 297, 134, 54, 834, 299, 922, 191, 910, 532, 609,
+ 829, 189, 20, 167, 29, 872, 449, 83, 402, 41, 656, 505, 579, 481, 173,
+ 404, 251, 688, 95, 497, 555, 642, 543, 307, 159, 924, 558, 648, 55, 497,
+ 10};
+
+const uint16_t EC_LEVEL_8_COEFFICIENTS[512] = {
+ 352, 77, 373, 504, 35, 599, 428, 207, 409, 574, 118, 498, 285, 380, 350,
+ 492, 197, 265, 920, 155, 914, 299, 229, 643, 294, 871, 306, 88, 87, 193,
+ 352, 781, 846, 75, 327, 520, 435, 543, 203, 666, 249, 346, 781, 621, 640,
+ 268, 794, 534, 539, 781, 408, 390, 644, 102, 476, 499, 290, 632, 545, 37,
+ 858, 916, 552, 41, 542, 289, 122, 272, 383, 800, 485, 98, 752, 472, 761,
+ 107, 784, 860, 658, 741, 290, 204, 681, 407, 855, 85, 99, 62, 482, 180,
+ 20, 297, 451, 593, 913, 142, 808, 684, 287, 536, 561, 76, 653, 899, 729,
+ 567, 744, 390, 513, 192, 516, 258, 240, 518, 794, 395, 768, 848, 51, 610,
+ 384, 168, 190, 826, 328, 596, 786, 303, 570, 381, 415, 641, 156, 237, 151,
+ 429, 531, 207, 676, 710, 89, 168, 304, 402, 40, 708, 575, 162, 864, 229,
+ 65, 861, 841, 512, 164, 477, 221, 92, 358, 785, 288, 357, 850, 836, 827,
+ 736, 707, 94, 8, 494, 114, 521, 2, 499, 851, 543, 152, 729, 771, 95,
+ 248, 361, 578, 323, 856, 797, 289, 51, 684, 466, 533, 820, 669, 45, 902,
+ 452, 167, 342, 244, 173, 35, 463, 651, 51, 699, 591, 452, 578, 37, 124,
+ 298, 332, 552, 43, 427, 119, 662, 777, 475, 850, 764, 364, 578, 911, 283,
+ 711, 472, 420, 245, 288, 594, 394, 511, 327, 589, 777, 699, 688, 43, 408,
+ 842, 383, 721, 521, 560, 644, 714, 559, 62, 145, 873, 663, 713, 159, 672,
+ 729, 624, 59, 193, 417, 158, 209, 563, 564, 343, 693, 109, 608, 563, 365,
+ 181, 772, 677, 310, 248, 353, 708, 410, 579, 870, 617, 841, 632, 860, 289,
+ 536, 35, 777, 618, 586, 424, 833, 77, 597, 346, 269, 757, 632, 695, 751,
+ 331, 247, 184, 45, 787, 680, 18, 66, 407, 369, 54, 492, 228, 613, 830,
+ 922, 437, 519, 644, 905, 789, 420, 305, 441, 207, 300, 892, 827, 141, 537,
+ 381, 662, 513, 56, 252, 341, 242, 797, 838, 837, 720, 224, 307, 631, 61,
+ 87, 560, 310, 756, 665, 397, 808, 851, 309, 473, 795, 378, 31, 647, 915,
+ 459, 806, 590, 731, 425, 216, 548, 249, 321, 881, 699, 535, 673, 782, 210,
+ 815, 905, 303, 843, 922, 281, 73, 469, 791, 660, 162, 498, 308, 155, 422,
+ 907, 817, 187, 62, 16, 425, 535, 336, 286, 437, 375, 273, 610, 296, 183,
+ 923, 116, 667, 751, 353, 62, 366, 691, 379, 687, 842, 37, 357, 720, 742,
+ 330, 5, 39, 923, 311, 424, 242, 749, 321, 54, 669, 316, 342, 299, 534,
+ 105, 667, 488, 640, 672, 576, 540, 316, 486, 721, 610, 46, 656, 447, 171,
+ 616, 464, 190, 531, 297, 321, 762, 752, 533, 175, 134, 14, 381, 433, 717,
+ 45, 111, 20, 596, 284, 736, 138, 646, 411, 877, 669, 141, 919, 45, 780,
+ 407, 164, 332, 899, 165, 726, 600, 325, 498, 655, 357, 752, 768, 223, 849,
+ 647, 63, 310, 863, 251, 366, 304, 282, 738, 675, 410, 389, 244, 31, 121,
+ 303, 263};
+
+const uint16_t* const EC_COEFFICIENTS[9] = {
+ EC_LEVEL_0_COEFFICIENTS, EC_LEVEL_1_COEFFICIENTS, EC_LEVEL_2_COEFFICIENTS,
+ EC_LEVEL_3_COEFFICIENTS, EC_LEVEL_4_COEFFICIENTS, EC_LEVEL_5_COEFFICIENTS,
+ EC_LEVEL_6_COEFFICIENTS, EC_LEVEL_7_COEFFICIENTS, EC_LEVEL_8_COEFFICIENTS};
+
+} // namespace
+
+CBC_PDF417ErrorCorrection::CBC_PDF417ErrorCorrection() {}
+CBC_PDF417ErrorCorrection::~CBC_PDF417ErrorCorrection() {}
+int32_t CBC_PDF417ErrorCorrection::getErrorCorrectionCodewordCount(
+ int32_t errorCorrectionLevel,
+ int32_t& e) {
+ if (errorCorrectionLevel < 0 || errorCorrectionLevel > 8) {
+ e = BCExceptionErrorCorrectionLevelMustBeBetween0And8;
+ return -1;
+ }
+ return 1 << (errorCorrectionLevel + 1);
+}
+
+int32_t CBC_PDF417ErrorCorrection::getRecommendedMinimumErrorCorrectionLevel(
+ int32_t n,
+ int32_t& e) {
+ if (n <= 0) {
+ e = BCExceptionIllegalArgumentnMustBeAbove0;
+ return -1;
+ }
+ if (n <= 40) {
+ return 2;
+ }
+ if (n <= 160) {
+ return 3;
+ }
+ if (n <= 320) {
+ return 4;
+ }
+ if (n <= 863) {
+ return 5;
+ }
+ e = BCExceptionNoRecommendationPossible;
+ return -1;
+}
+
+CFX_WideString CBC_PDF417ErrorCorrection::generateErrorCorrection(
+ CFX_WideString dataCodewords,
+ int32_t errorCorrectionLevel,
+ int32_t& e) {
+ int32_t k = getErrorCorrectionCodewordCount(errorCorrectionLevel, e);
+ if (e != BCExceptionNO)
+ return L" ";
+ wchar_t* ech = FX_Alloc(wchar_t, k);
+ memset(ech, 0, k * sizeof(wchar_t));
+ int32_t sld = dataCodewords.GetLength();
+ for (int32_t i = 0; i < sld; i++) {
+ int32_t t1 = (dataCodewords.GetAt(i) + ech[k - 1]) % 929;
+ int32_t t2;
+ int32_t t3;
+ for (int32_t j = k - 1; j >= 1; j--) {
+ t2 = (t1 * EC_COEFFICIENTS[errorCorrectionLevel][j]) % 929;
+ t3 = 929 - t2;
+ ech[j] = (wchar_t)((ech[j - 1] + t3) % 929);
+ }
+ t2 = (t1 * EC_COEFFICIENTS[errorCorrectionLevel][0]) % 929;
+ t3 = 929 - t2;
+ ech[0] = (wchar_t)(t3 % 929);
+ }
+ CFX_WideString sb;
+ for (int32_t j = k - 1; j >= 0; j--) {
+ if (ech[j] != 0) {
+ ech[j] = (wchar_t)(929 - ech[j]);
+ }
+ sb += (wchar_t)ech[j];
+ }
+ FX_Free(ech);
+ return sb;
+}
diff --git a/chromium/third_party/pdfium/fxbarcode/pdf417/BC_PDF417ErrorCorrection.h b/chromium/third_party/pdfium/fxbarcode/pdf417/BC_PDF417ErrorCorrection.h
new file mode 100644
index 00000000000..d1c6eed1b37
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/pdf417/BC_PDF417ErrorCorrection.h
@@ -0,0 +1,28 @@
+// 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 FXBARCODE_PDF417_BC_PDF417ERRORCORRECTION_H_
+#define FXBARCODE_PDF417_BC_PDF417ERRORCORRECTION_H_
+
+#include <stdint.h>
+
+#include "core/fxcrt/fx_string.h"
+
+class CBC_PDF417ErrorCorrection {
+ public:
+ CBC_PDF417ErrorCorrection();
+ virtual ~CBC_PDF417ErrorCorrection();
+
+ static int32_t getErrorCorrectionCodewordCount(int32_t errorCorrectionLevel,
+ int32_t& e);
+ static int32_t getRecommendedMinimumErrorCorrectionLevel(int32_t n,
+ int32_t& e);
+ static CFX_WideString generateErrorCorrection(CFX_WideString dataCodewords,
+ int32_t errorCorrectionLevel,
+ int32_t& e);
+};
+
+#endif // FXBARCODE_PDF417_BC_PDF417ERRORCORRECTION_H_
diff --git a/chromium/third_party/pdfium/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp b/chromium/third_party/pdfium/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp
new file mode 100644
index 00000000000..ac8b0186f62
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp
@@ -0,0 +1,430 @@
+// 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
+// Original code is licensed as follows:
+/*
+ * Copyright 2006 Jeremias Maerki in part, and ZXing Authors in part
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h"
+
+#include "fxbarcode/BC_UtilCodingConvert.h"
+#include "fxbarcode/pdf417/BC_PDF417Compaction.h"
+#include "fxbarcode/utils.h"
+#include "third_party/bigint/BigIntegerLibrary.hh"
+
+#define SUBMODE_ALPHA 0
+#define SUBMODE_LOWER 1
+#define SUBMODE_MIXED 2
+
+int32_t CBC_PDF417HighLevelEncoder::TEXT_COMPACTION = 0;
+int32_t CBC_PDF417HighLevelEncoder::BYTE_COMPACTION = 1;
+int32_t CBC_PDF417HighLevelEncoder::NUMERIC_COMPACTION = 2;
+int32_t CBC_PDF417HighLevelEncoder::SUBMODE_PUNCTUATION = 3;
+int32_t CBC_PDF417HighLevelEncoder::LATCH_TO_TEXT = 900;
+int32_t CBC_PDF417HighLevelEncoder::LATCH_TO_BYTE_PADDED = 901;
+int32_t CBC_PDF417HighLevelEncoder::LATCH_TO_NUMERIC = 902;
+int32_t CBC_PDF417HighLevelEncoder::SHIFT_TO_BYTE = 913;
+int32_t CBC_PDF417HighLevelEncoder::LATCH_TO_BYTE = 924;
+uint8_t CBC_PDF417HighLevelEncoder::TEXT_MIXED_RAW[] = {
+ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 38, 13, 9, 44, 58,
+ 35, 45, 46, 36, 47, 43, 37, 42, 61, 94, 0, 32, 0, 0, 0};
+uint8_t CBC_PDF417HighLevelEncoder::TEXT_PUNCTUATION_RAW[] = {
+ 59, 60, 62, 64, 91, 92, 93, 95, 96, 126, 33, 13, 9, 44, 58,
+ 10, 45, 46, 36, 47, 34, 124, 42, 40, 41, 63, 123, 125, 39, 0};
+int32_t CBC_PDF417HighLevelEncoder::MIXED[128] = {0};
+int32_t CBC_PDF417HighLevelEncoder::PUNCTUATION[128] = {0};
+
+void CBC_PDF417HighLevelEncoder::Initialize() {
+ Inverse();
+}
+
+void CBC_PDF417HighLevelEncoder::Finalize() {}
+
+CFX_WideString CBC_PDF417HighLevelEncoder::encodeHighLevel(
+ CFX_WideString wideMsg,
+ Compaction compaction,
+ int32_t& e) {
+ CFX_ByteString bytes;
+ CBC_UtilCodingConvert::UnicodeToUTF8(wideMsg, bytes);
+ CFX_WideString msg;
+ int32_t len = bytes.GetLength();
+ for (int32_t i = 0; i < len; i++) {
+ wchar_t ch = (wchar_t)(bytes.GetAt(i) & 0xff);
+ if (ch == '?' && bytes.GetAt(i) != '?') {
+ e = BCExceptionCharactersOutsideISO88591Encoding;
+ return CFX_WideString();
+ }
+ msg += ch;
+ }
+ std::vector<uint8_t> byteArr;
+ for (int32_t k = 0; k < bytes.GetLength(); k++) {
+ byteArr.push_back(bytes.GetAt(k));
+ }
+ CFX_WideString sb;
+ len = msg.GetLength();
+ int32_t p = 0;
+ int32_t textSubMode = SUBMODE_ALPHA;
+ if (compaction == TEXT) {
+ encodeText(msg, p, len, sb, textSubMode);
+ } else if (compaction == BYTES) {
+ encodeBinary(&byteArr, p, byteArr.size(), BYTE_COMPACTION, sb);
+ } else if (compaction == NUMERIC) {
+ sb += (wchar_t)LATCH_TO_NUMERIC;
+ encodeNumeric(msg, p, len, sb);
+ } else {
+ int32_t encodingMode = LATCH_TO_TEXT;
+ while (p < len) {
+ int32_t n = determineConsecutiveDigitCount(msg, p);
+ if (n >= 13) {
+ sb += (wchar_t)LATCH_TO_NUMERIC;
+ encodingMode = NUMERIC_COMPACTION;
+ textSubMode = SUBMODE_ALPHA;
+ encodeNumeric(msg, p, n, sb);
+ p += n;
+ } else {
+ int32_t t = determineConsecutiveTextCount(msg, p);
+ if (t >= 5 || n == len) {
+ if (encodingMode != TEXT_COMPACTION) {
+ sb += (wchar_t)LATCH_TO_TEXT;
+ encodingMode = TEXT_COMPACTION;
+ textSubMode = SUBMODE_ALPHA;
+ }
+ textSubMode = encodeText(msg, p, t, sb, textSubMode);
+ p += t;
+ } else {
+ int32_t b = determineConsecutiveBinaryCount(msg, &byteArr, p, e);
+ if (e != BCExceptionNO)
+ return L" ";
+ if (b == 0) {
+ b = 1;
+ }
+ if (b == 1 && encodingMode == TEXT_COMPACTION) {
+ encodeBinary(&byteArr, p, 1, TEXT_COMPACTION, sb);
+ } else {
+ encodeBinary(&byteArr, p, b, encodingMode, sb);
+ encodingMode = BYTE_COMPACTION;
+ textSubMode = SUBMODE_ALPHA;
+ }
+ p += b;
+ }
+ }
+ }
+ }
+ return sb;
+}
+
+void CBC_PDF417HighLevelEncoder::Inverse() {
+ for (size_t l = 0; l < FX_ArraySize(MIXED); ++l)
+ MIXED[l] = -1;
+
+ for (uint8_t i = 0; i < FX_ArraySize(TEXT_MIXED_RAW); ++i) {
+ uint8_t b = TEXT_MIXED_RAW[i];
+ if (b != 0)
+ MIXED[b] = i;
+ }
+
+ for (size_t l = 0; l < FX_ArraySize(PUNCTUATION); ++l)
+ PUNCTUATION[l] = -1;
+
+ for (uint8_t i = 0; i < FX_ArraySize(TEXT_PUNCTUATION_RAW); ++i) {
+ uint8_t b = TEXT_PUNCTUATION_RAW[i];
+ if (b != 0)
+ PUNCTUATION[b] = i;
+ }
+}
+
+int32_t CBC_PDF417HighLevelEncoder::encodeText(CFX_WideString msg,
+ int32_t startpos,
+ int32_t count,
+ CFX_WideString& sb,
+ int32_t initialSubmode) {
+ CFX_WideString tmp;
+ int32_t submode = initialSubmode;
+ int32_t idx = 0;
+ while (true) {
+ wchar_t ch = msg.GetAt(startpos + idx);
+ switch (submode) {
+ case SUBMODE_ALPHA:
+ if (isAlphaUpper(ch)) {
+ if (ch == ' ') {
+ tmp += (wchar_t)26;
+ } else {
+ tmp += (wchar_t)(ch - 65);
+ }
+ } else {
+ if (isAlphaLower(ch)) {
+ submode = SUBMODE_LOWER;
+ tmp += (wchar_t)27;
+ continue;
+ } else if (isMixed(ch)) {
+ submode = SUBMODE_MIXED;
+ tmp += (wchar_t)28;
+ continue;
+ } else {
+ tmp += (wchar_t)29;
+ tmp += PUNCTUATION[ch];
+ break;
+ }
+ }
+ break;
+ case SUBMODE_LOWER:
+ if (isAlphaLower(ch)) {
+ if (ch == ' ') {
+ tmp += (wchar_t)26;
+ } else {
+ tmp += (wchar_t)(ch - 97);
+ }
+ } else {
+ if (isAlphaUpper(ch)) {
+ tmp += (wchar_t)27;
+ tmp += (wchar_t)(ch - 65);
+ break;
+ } else if (isMixed(ch)) {
+ submode = SUBMODE_MIXED;
+ tmp += (wchar_t)28;
+ continue;
+ } else {
+ tmp += (wchar_t)29;
+ tmp += PUNCTUATION[ch];
+ break;
+ }
+ }
+ break;
+ case SUBMODE_MIXED:
+ if (isMixed(ch)) {
+ tmp += MIXED[ch];
+ } else {
+ if (isAlphaUpper(ch)) {
+ submode = SUBMODE_ALPHA;
+ tmp += (wchar_t)28;
+ continue;
+ } else if (isAlphaLower(ch)) {
+ submode = SUBMODE_LOWER;
+ tmp += (wchar_t)27;
+ continue;
+ } else {
+ if (startpos + idx + 1 < count) {
+ wchar_t next = msg.GetAt(startpos + idx + 1);
+ if (isPunctuation(next)) {
+ submode = SUBMODE_PUNCTUATION;
+ tmp += (wchar_t)25;
+ continue;
+ }
+ }
+ tmp += (wchar_t)29;
+ tmp += PUNCTUATION[ch];
+ }
+ }
+ break;
+ default:
+ if (isPunctuation(ch)) {
+ tmp += PUNCTUATION[ch];
+ } else {
+ submode = SUBMODE_ALPHA;
+ tmp += (wchar_t)29;
+ continue;
+ }
+ }
+ idx++;
+ if (idx >= count) {
+ break;
+ }
+ }
+ wchar_t h = 0;
+ int32_t len = tmp.GetLength();
+ for (int32_t i = 0; i < len; i++) {
+ bool odd = (i % 2) != 0;
+ if (odd) {
+ h = (wchar_t)((h * 30) + tmp.GetAt(i));
+ sb += h;
+ } else {
+ h = tmp.GetAt(i);
+ }
+ }
+ if ((len % 2) != 0) {
+ sb += (wchar_t)((h * 30) + 29);
+ }
+ return submode;
+}
+void CBC_PDF417HighLevelEncoder::encodeBinary(std::vector<uint8_t>* bytes,
+ int32_t startpos,
+ int32_t count,
+ int32_t startmode,
+ CFX_WideString& sb) {
+ if (count == 1 && startmode == TEXT_COMPACTION) {
+ sb += (wchar_t)SHIFT_TO_BYTE;
+ }
+ int32_t idx = startpos;
+ int32_t i = 0;
+ if (count >= 6) {
+ sb += (wchar_t)LATCH_TO_BYTE;
+ wchar_t chars[5];
+ while ((startpos + count - idx) >= 6) {
+ int64_t t = 0;
+ for (i = 0; i < 6; i++) {
+ t <<= 8;
+ t += (*bytes)[idx + i] & 0xff;
+ }
+ for (i = 0; i < 5; i++) {
+ chars[i] = (wchar_t)(t % 900);
+ t /= 900;
+ }
+ for (i = 4; i >= 0; i--) {
+ sb += (chars[i]);
+ }
+ idx += 6;
+ }
+ }
+ if (idx < startpos + count) {
+ sb += (wchar_t)LATCH_TO_BYTE_PADDED;
+ }
+ for (i = idx; i < startpos + count; i++) {
+ int32_t ch = (*bytes)[i] & 0xff;
+ sb += (wchar_t)ch;
+ }
+}
+void CBC_PDF417HighLevelEncoder::encodeNumeric(CFX_WideString msg,
+ int32_t startpos,
+ int32_t count,
+ CFX_WideString& sb) {
+ int32_t idx = 0;
+ BigInteger num900 = 900;
+ while (idx < count) {
+ CFX_WideString tmp;
+ int32_t len = 44 < count - idx ? 44 : count - idx;
+ CFX_ByteString part =
+ ((wchar_t)'1' + msg.Mid(startpos + idx, len)).UTF8Encode();
+ BigInteger bigint = stringToBigInteger(part.c_str());
+ do {
+ int32_t c = (bigint % num900).toInt();
+ tmp += (wchar_t)(c);
+ bigint = bigint / num900;
+ } while (!bigint.isZero());
+ for (int32_t i = tmp.GetLength() - 1; i >= 0; i--) {
+ sb += tmp.GetAt(i);
+ }
+ idx += len;
+ }
+}
+bool CBC_PDF417HighLevelEncoder::isDigit(wchar_t ch) {
+ return ch >= '0' && ch <= '9';
+}
+bool CBC_PDF417HighLevelEncoder::isAlphaUpper(wchar_t ch) {
+ return ch == ' ' || (ch >= 'A' && ch <= 'Z');
+}
+bool CBC_PDF417HighLevelEncoder::isAlphaLower(wchar_t ch) {
+ return ch == ' ' || (ch >= 'a' && ch <= 'z');
+}
+bool CBC_PDF417HighLevelEncoder::isMixed(wchar_t ch) {
+ return MIXED[ch] != -1;
+}
+bool CBC_PDF417HighLevelEncoder::isPunctuation(wchar_t ch) {
+ return PUNCTUATION[ch] != -1;
+}
+bool CBC_PDF417HighLevelEncoder::isText(wchar_t ch) {
+ return ch == '\t' || ch == '\n' || ch == '\r' || (ch >= 32 && ch <= 126);
+}
+int32_t CBC_PDF417HighLevelEncoder::determineConsecutiveDigitCount(
+ CFX_WideString msg,
+ int32_t startpos) {
+ int32_t count = 0;
+ int32_t len = msg.GetLength();
+ int32_t idx = startpos;
+ if (idx < len) {
+ wchar_t ch = msg.GetAt(idx);
+ while (isDigit(ch) && idx < len) {
+ count++;
+ idx++;
+ if (idx < len) {
+ ch = msg.GetAt(idx);
+ }
+ }
+ }
+ return count;
+}
+int32_t CBC_PDF417HighLevelEncoder::determineConsecutiveTextCount(
+ CFX_WideString msg,
+ int32_t startpos) {
+ int32_t len = msg.GetLength();
+ int32_t idx = startpos;
+ while (idx < len) {
+ wchar_t ch = msg.GetAt(idx);
+ int32_t numericCount = 0;
+ while (numericCount < 13 && isDigit(ch) && idx < len) {
+ numericCount++;
+ idx++;
+ if (idx < len) {
+ ch = msg.GetAt(idx);
+ }
+ }
+ if (numericCount >= 13) {
+ return idx - startpos - numericCount;
+ }
+ if (numericCount > 0) {
+ continue;
+ }
+ ch = msg.GetAt(idx);
+ if (!isText(ch)) {
+ break;
+ }
+ idx++;
+ }
+ return idx - startpos;
+}
+int32_t CBC_PDF417HighLevelEncoder::determineConsecutiveBinaryCount(
+ CFX_WideString msg,
+ std::vector<uint8_t>* bytes,
+ int32_t startpos,
+ int32_t& e) {
+ int32_t len = msg.GetLength();
+ int32_t idx = startpos;
+ while (idx < len) {
+ wchar_t ch = msg.GetAt(idx);
+ int32_t numericCount = 0;
+ while (numericCount < 13 && isDigit(ch)) {
+ numericCount++;
+ int32_t i = idx + numericCount;
+ if (i >= len) {
+ break;
+ }
+ ch = msg.GetAt(i);
+ }
+ if (numericCount >= 13) {
+ return idx - startpos;
+ }
+ int32_t textCount = 0;
+ while (textCount < 5 && isText(ch)) {
+ textCount++;
+ int32_t i = idx + textCount;
+ if (i >= len) {
+ break;
+ }
+ ch = msg.GetAt(i);
+ }
+ if (textCount >= 5) {
+ return idx - startpos;
+ }
+ ch = msg.GetAt(idx);
+ if ((*bytes)[idx] == 63 && ch != '?') {
+ e = BCExceptionNonEncodableCharacterDetected;
+ return -1;
+ }
+ idx++;
+ }
+ return idx - startpos;
+}
diff --git a/chromium/third_party/pdfium/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h b/chromium/third_party/pdfium/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h
new file mode 100644
index 00000000000..023f3dbb254
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h
@@ -0,0 +1,76 @@
+// 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 FXBARCODE_PDF417_BC_PDF417HIGHLEVELENCODER_H_
+#define FXBARCODE_PDF417_BC_PDF417HIGHLEVELENCODER_H_
+
+#include <vector>
+
+#include "core/fxcrt/fx_basic.h"
+#include "core/fxcrt/fx_string.h"
+#include "fxbarcode/pdf417/BC_PDF417Compaction.h"
+
+class CBC_PDF417HighLevelEncoder {
+ public:
+ static CFX_WideString encodeHighLevel(CFX_WideString msg,
+ Compaction compaction,
+ int32_t& e);
+ static void Inverse();
+ static void Initialize();
+ static void Finalize();
+
+ private:
+ static int32_t TEXT_COMPACTION;
+ static int32_t BYTE_COMPACTION;
+ static int32_t NUMERIC_COMPACTION;
+ static int32_t SUBMODE_PUNCTUATION;
+ static int32_t LATCH_TO_TEXT;
+ static int32_t LATCH_TO_BYTE_PADDED;
+ static int32_t LATCH_TO_NUMERIC;
+ static int32_t SHIFT_TO_BYTE;
+ static int32_t LATCH_TO_BYTE;
+ static uint8_t TEXT_MIXED_RAW[];
+ static uint8_t TEXT_PUNCTUATION_RAW[];
+ static int32_t MIXED[128];
+ static int32_t PUNCTUATION[128];
+ static int32_t encodeText(CFX_WideString msg,
+ int32_t startpos,
+ int32_t count,
+ CFX_WideString& sb,
+ int32_t initialSubmode);
+ static void encodeBinary(std::vector<uint8_t>* bytes,
+ int32_t startpos,
+ int32_t count,
+ int32_t startmode,
+ CFX_WideString& sb);
+ static void encodeNumeric(CFX_WideString msg,
+ int32_t startpos,
+ int32_t count,
+ CFX_WideString& sb);
+ static bool isDigit(wchar_t ch);
+ static bool isAlphaUpper(wchar_t ch);
+ static bool isAlphaLower(wchar_t ch);
+ static bool isMixed(wchar_t ch);
+ static bool isPunctuation(wchar_t ch);
+ static bool isText(wchar_t ch);
+ static int32_t determineConsecutiveDigitCount(CFX_WideString msg,
+ int32_t startpos);
+ static int32_t determineConsecutiveTextCount(CFX_WideString msg,
+ int32_t startpos);
+ static int32_t determineConsecutiveBinaryCount(CFX_WideString msg,
+ std::vector<uint8_t>* bytes,
+ int32_t startpos,
+ int32_t& e);
+
+ friend class PDF417HighLevelEncoder_EncodeNumeric_Test;
+ friend class PDF417HighLevelEncoder_EncodeBinary_Test;
+ friend class PDF417HighLevelEncoder_EncodeText_Test;
+ friend class PDF417HighLevelEncoder_ConsecutiveDigitCount_Test;
+ friend class PDF417HighLevelEncoder_ConsecutiveTextCount_Test;
+ friend class PDF417HighLevelEncoder_ConsecutiveBinaryCount_Test;
+};
+
+#endif // FXBARCODE_PDF417_BC_PDF417HIGHLEVELENCODER_H_
diff --git a/chromium/third_party/pdfium/fxbarcode/pdf417/BC_PDF417HighLevelEncoder_unittest.cpp b/chromium/third_party/pdfium/fxbarcode/pdf417/BC_PDF417HighLevelEncoder_unittest.cpp
new file mode 100644
index 00000000000..b4b9396d84e
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/pdf417/BC_PDF417HighLevelEncoder_unittest.cpp
@@ -0,0 +1,231 @@
+// 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.
+
+#include "core/fxcrt/fx_basic.h"
+#include "fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h"
+#include "testing/fx_string_testhelpers.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+TEST(PDF417HighLevelEncoder, EncodeHighLevel) {
+ // TODO(tsepez): implement test cases.
+}
+
+TEST(PDF417HighLevelEncoder, EncodeText) {
+ // TODO(tsepez): implement test cases.
+}
+
+TEST(PDF417HighLevelEncoder, EncodeBinary) {
+ struct EncodeBinaryCase {
+ const char* input;
+ int offset;
+ int count;
+ int startmode;
+ const wchar_t* expected;
+ int expected_length;
+ } encode_binary_cases[] = {
+ // Empty string encodes as empty string.
+ {"", 0, 0, CBC_PDF417HighLevelEncoder::TEXT_COMPACTION, L"", 0},
+
+ // Fewer than 6 characters encodes as prefix without compaction.
+ {"xxxxx", 0, 5, CBC_PDF417HighLevelEncoder::TEXT_COMPACTION,
+ L"\x0385xxxxx", 6},
+
+ // 6 charcters triggerst text encoding compaction.
+ {"xxxxxx", 0, 6, CBC_PDF417HighLevelEncoder::TEXT_COMPACTION,
+ L"\u039c\u00c9\u031f\u012a\u00d2\u02d0", 6},
+
+ // Same result if initially in numeric compaction mode.
+ {"xxxxxx", 0, 6, CBC_PDF417HighLevelEncoder::NUMERIC_COMPACTION,
+ L"\u039c\u00c9\u031f\u012a\u00d2\u02d0", 6},
+ };
+
+ CBC_PDF417HighLevelEncoder::Initialize();
+ for (size_t i = 0; i < FX_ArraySize(encode_binary_cases); ++i) {
+ EncodeBinaryCase* ptr = &encode_binary_cases[i];
+ std::vector<uint8_t> input_array;
+ size_t input_length = strlen(ptr->input);
+ input_array.resize(input_length);
+ for (size_t j = 0; j < input_length; ++j) {
+ input_array[j] = ptr->input[j];
+ }
+ CFX_WideString expected(ptr->expected, ptr->expected_length);
+ CFX_WideString result;
+ CBC_PDF417HighLevelEncoder::encodeBinary(
+ &input_array, ptr->offset, ptr->count, ptr->startmode, result);
+ EXPECT_EQ(expected, result) << " for case number " << i;
+ }
+ CBC_PDF417HighLevelEncoder::Finalize();
+}
+
+TEST(PDF417HighLevelEncoder, EncodeNumeric) {
+ struct EncodeNumericCase {
+ const wchar_t* input;
+ int offset;
+ int count;
+ const wchar_t* expected;
+ int expected_length;
+ } encode_numeric_cases[] = {
+ // Empty string encodes as empty string.
+ {L"", 0, 0, L"", 0},
+
+ // Single 0 should encode as 10 base-900 == a.
+ {L"0", 0, 1, L"\x000a", 1},
+
+ // 800 should encode as 1800 base-900 == 2,0.
+ {L"800", 0, 3, L"\x0002\x0000", 2},
+
+ // Test longer strings and sub-strings.
+ {L"123456", 0, 6, L"\x0001\x015c\x0100", 3},
+ {L"123456", 0, 5, L"\x007c\x02e9", 2},
+ {L"123456", 1, 5, L"\x0089\x009c", 2},
+ {L"123456", 2, 2, L"\x0086", 1},
+
+ // Up to 44 characters encodes as 15 base-900 words.
+ {L"00000000000000000000000000000000000000000000", 0, 44,
+ L"\x01b5\x006f\x02cc\x0084\x01bc\x0076\x00b3\x005c\x01f0\x034f\x01e6"
+ L"\x0090\x020b\x019b\x0064",
+ 15},
+
+ // 45 characters should encode as same 15 words followed by one additional
+ // word.
+ {L"000000000000000000000000000000000000000000000", 0, 45,
+ L"\x01b5\x006f\x02cc\x0084\x01bc\x0076\x00b3\x005c\x01f0\x034f\x01e6"
+ L"\x0090\x020b\x019b\x0064\x000a",
+ 16},
+
+ // 44 characters followed by 800 should encode as 15 words followed by
+ // 1800 base-900 == 2,0.
+ {L"00000000000000000000000000000000000000000000800", 0, 47,
+ L"\x01b5\x006f\x02cc\x0084\x01bc\x0076\x00b3\x005c\x01f0\x034f\x01e6"
+ L"\x0090\x020b\x019b\x0064\x0002\x0000",
+ 17},
+
+ // Even longer input.
+ {L"10000000000000000000000000000000000000000000000000", 0, 50,
+ L"\x01e0\x02f0\x036d\x02ad\x029c\x01ea\x0011\x000b\x02d6\x023c\x0108"
+ L"\x02bb\x0023\x02d2\x00c8\x0001\x00d3\x0064",
+ 18},
+ };
+
+ CBC_PDF417HighLevelEncoder::Initialize();
+ for (size_t i = 0; i < FX_ArraySize(encode_numeric_cases); ++i) {
+ EncodeNumericCase* ptr = &encode_numeric_cases[i];
+ CFX_WideString input(ptr->input);
+ CFX_WideString expected(ptr->expected, ptr->expected_length);
+ CFX_WideString result;
+ CBC_PDF417HighLevelEncoder::encodeNumeric(input, ptr->offset, ptr->count,
+ result);
+ EXPECT_EQ(expected, result) << " for case number " << i;
+ }
+ CBC_PDF417HighLevelEncoder::Finalize();
+}
+
+TEST(PDF417HighLevelEncoder, ConsecutiveDigitCount) {
+ struct ConsecutiveDigitCase {
+ const wchar_t* input;
+ int offset;
+ int expected_count;
+ } consecutive_digit_cases[] = {
+ // Empty string contains 0 consecuitve digits.
+ {L"", 0, 0},
+
+ // Single non-digit character contains 0 consecutive digits.
+ {L"X", 0, 0},
+
+ // Leading non-digit followed by digits contains 0 consecutive.
+ {L"X123", 0, 0},
+
+ // Single digit contains 1 consecutive digit.
+ {L"1", 0, 1},
+
+ // Single digit followe by non-digit contains 1 consecutive digit.
+ {L"1Z", 0, 1},
+
+ // Test longer strings.
+ {L"123FOO45678", 0, 3},
+
+ // Test subtring starting in digits field.
+ {L"123FOO45678", 3, 0},
+
+ // Test subtring starting in non-digits field.
+ {L"123FOO45678", 3, 0},
+
+ // Test substring starting in digits field following non-digit field.
+ {L"123FOO45678", 6, 5},
+ };
+
+ CBC_PDF417HighLevelEncoder::Initialize();
+ for (size_t i = 0; i < FX_ArraySize(consecutive_digit_cases); ++i) {
+ ConsecutiveDigitCase* ptr = &consecutive_digit_cases[i];
+ CFX_WideString input(ptr->input);
+ int actual_count =
+ CBC_PDF417HighLevelEncoder::determineConsecutiveDigitCount(input,
+ ptr->offset);
+ EXPECT_EQ(ptr->expected_count, actual_count) << " for case number " << i;
+ }
+ CBC_PDF417HighLevelEncoder::Finalize();
+}
+
+TEST(PDF417HighLevelEncoder, ConsecutiveTextCount) {
+ struct ConsecutiveTextCase {
+ const wchar_t* input;
+ int offset;
+ int expected_count;
+ } consecutive_text_cases[] = {
+ // Empty string contains 0 consecutive text characters.
+ {L"", 0, 0},
+
+ // Single text character is 1 consecutive text characters.
+ {L"X", 0, 1},
+
+ // Trailing numbers count as text characters.
+ {L"X123", 0, 4},
+
+ // Leading numbers count as text characters.
+ {L"123X", 0, 4},
+
+ // Embedded lo-value binary characters terminate text runs.
+ {L"ABC\x0001XXXX", 0, 3},
+
+ // Embedded hi-value binary characters terminate text runs.
+ {L"ABC\x0100XXXX", 0, 3},
+
+ // Text run still found after indexing past lo-value character.
+ {L"ABC\x0001XXXX", 4, 4},
+
+ // Text run still found after indexing past hi-value character.
+ {L"ABC\x0100XXXX", 4, 4},
+
+ // Leading hi-value character results in 0 consecutive characters.
+ {L"\x0100XXX", 0, 0},
+
+ // Up to 12 numbers count as text.
+ {L"123456789012", 0, 12},
+
+ // 13 or more numbers are compresssed using numeric compression, not text.
+ {L"1234567890123", 0, 0},
+
+ // Leading Text character doesn't affect the 12 character case.
+ {L"X123456789012", 0, 13},
+
+ // Leading Text character doesn't affect the 13 character case.
+ {L"X1234567890123", 0, 1},
+
+ // Jumping between numbers and letters works properly.
+ {L"XXX121XXX12345678901234", 0, 9},
+ };
+
+ CBC_PDF417HighLevelEncoder::Initialize();
+ for (size_t i = 0; i < FX_ArraySize(consecutive_text_cases); ++i) {
+ ConsecutiveTextCase* ptr = &consecutive_text_cases[i];
+ CFX_WideString input(ptr->input);
+ int actual_count =
+ CBC_PDF417HighLevelEncoder::determineConsecutiveTextCount(input,
+ ptr->offset);
+ EXPECT_EQ(ptr->expected_count, actual_count) << " for case number " << i;
+ }
+ CBC_PDF417HighLevelEncoder::Finalize();
+}
+
+TEST(PDF417HighLevelEncoder, ConsecutiveBinaryCount) {}
diff --git a/chromium/third_party/pdfium/fxbarcode/pdf417/BC_PDF417Writer.cpp b/chromium/third_party/pdfium/fxbarcode/pdf417/BC_PDF417Writer.cpp
new file mode 100644
index 00000000000..5344b8aecf6
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/pdf417/BC_PDF417Writer.cpp
@@ -0,0 +1,113 @@
+// 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
+// Original code is licensed as follows:
+/*
+ * Copyright 2012 ZXing authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "fxbarcode/BC_TwoDimWriter.h"
+#include "fxbarcode/common/BC_CommonBitArray.h"
+#include "fxbarcode/common/BC_CommonBitMatrix.h"
+#include "fxbarcode/pdf417/BC_PDF417.h"
+#include "fxbarcode/pdf417/BC_PDF417BarcodeMatrix.h"
+#include "fxbarcode/pdf417/BC_PDF417Compaction.h"
+#include "fxbarcode/pdf417/BC_PDF417Writer.h"
+
+CBC_PDF417Writer::CBC_PDF417Writer() {
+ m_bFixedSize = false;
+}
+CBC_PDF417Writer::~CBC_PDF417Writer() {
+ m_bTruncated = true;
+}
+bool CBC_PDF417Writer::SetErrorCorrectionLevel(int32_t level) {
+ if (level < 0 || level > 8) {
+ return false;
+ }
+ m_iCorrectLevel = level;
+ return true;
+}
+void CBC_PDF417Writer::SetTruncated(bool truncated) {
+ m_bTruncated = truncated;
+}
+uint8_t* CBC_PDF417Writer::Encode(const CFX_WideString& contents,
+ int32_t& outWidth,
+ int32_t& outHeight,
+ int32_t& e) {
+ CBC_PDF417 encoder;
+ int32_t col = (m_Width / m_ModuleWidth - 69) / 17;
+ int32_t row = m_Height / (m_ModuleWidth * 20);
+ if (row >= 3 && row <= 90 && col >= 1 && col <= 30) {
+ encoder.setDimensions(col, col, row, row);
+ } else if (col >= 1 && col <= 30) {
+ encoder.setDimensions(col, col, 90, 3);
+ } else if (row >= 3 && row <= 90) {
+ encoder.setDimensions(30, 1, row, row);
+ }
+ encoder.generateBarcodeLogic(contents, m_iCorrectLevel, e);
+ if (e != BCExceptionNO)
+ return nullptr;
+ int32_t lineThickness = 2;
+ int32_t aspectRatio = 4;
+ CBC_BarcodeMatrix* barcodeMatrix = encoder.getBarcodeMatrix();
+ std::vector<uint8_t> originalScale = barcodeMatrix->getScaledMatrix(
+ lineThickness, aspectRatio * lineThickness);
+ int32_t width = outWidth;
+ int32_t height = outHeight;
+ outWidth = barcodeMatrix->getWidth();
+ outHeight = barcodeMatrix->getHeight();
+ bool rotated = false;
+ if ((height > width) ^ (outWidth < outHeight)) {
+ rotateArray(originalScale, outHeight, outWidth);
+ rotated = true;
+ int32_t temp = outHeight;
+ outHeight = outWidth;
+ outWidth = temp;
+ }
+ int32_t scaleX = width / outWidth;
+ int32_t scaleY = height / outHeight;
+ int32_t scale;
+ if (scaleX < scaleY) {
+ scale = scaleX;
+ } else {
+ scale = scaleY;
+ }
+ if (scale > 1) {
+ originalScale = barcodeMatrix->getScaledMatrix(
+ scale * lineThickness, scale * aspectRatio * lineThickness);
+ if (rotated) {
+ rotateArray(originalScale, outHeight, outWidth);
+ int32_t temp = outHeight;
+ outHeight = outWidth;
+ outWidth = temp;
+ }
+ }
+ uint8_t* result = FX_Alloc2D(uint8_t, outHeight, outWidth);
+ memcpy(result, originalScale.data(), outHeight * outWidth);
+ return result;
+}
+void CBC_PDF417Writer::rotateArray(std::vector<uint8_t>& bitarray,
+ int32_t height,
+ int32_t width) {
+ std::vector<uint8_t> temp = bitarray;
+ for (int32_t ii = 0; ii < height; ii++) {
+ int32_t inverseii = height - ii - 1;
+ for (int32_t jj = 0; jj < width; jj++) {
+ bitarray[jj * height + inverseii] = temp[ii * width + jj];
+ }
+ }
+}
diff --git a/chromium/third_party/pdfium/fxbarcode/pdf417/BC_PDF417Writer.h b/chromium/third_party/pdfium/fxbarcode/pdf417/BC_PDF417Writer.h
new file mode 100644
index 00000000000..ddfdc9be248
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/pdf417/BC_PDF417Writer.h
@@ -0,0 +1,38 @@
+// 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 FXBARCODE_PDF417_BC_PDF417WRITER_H_
+#define FXBARCODE_PDF417_BC_PDF417WRITER_H_
+
+#include <vector>
+
+#include "core/fxcrt/fx_string.h"
+#include "core/fxcrt/fx_system.h"
+#include "fxbarcode/BC_TwoDimWriter.h"
+
+class CBC_PDF417Writer : public CBC_TwoDimWriter {
+ public:
+ CBC_PDF417Writer();
+ ~CBC_PDF417Writer() override;
+
+ uint8_t* Encode(const CFX_WideString& contents,
+ int32_t& outWidth,
+ int32_t& outHeight,
+ int32_t& e);
+
+ // CBC_TwoDimWriter
+ bool SetErrorCorrectionLevel(int32_t level) override;
+
+ void SetTruncated(bool truncated);
+
+ private:
+ void rotateArray(std::vector<uint8_t>& bitarray,
+ int32_t width,
+ int32_t height);
+ bool m_bTruncated;
+};
+
+#endif // FXBARCODE_PDF417_BC_PDF417WRITER_H_
diff --git a/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCodeWriter.cpp b/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCodeWriter.cpp
new file mode 100644
index 00000000000..b7d53598307
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCodeWriter.cpp
@@ -0,0 +1,92 @@
+// 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
+// Original code is licensed as follows:
+/*
+ * Copyright 2008 ZXing authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "fxbarcode/BC_TwoDimWriter.h"
+#include "fxbarcode/common/BC_CommonByteMatrix.h"
+#include "fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.h"
+#include "fxbarcode/qrcode/BC_QRCodeWriter.h"
+#include "fxbarcode/qrcode/BC_QRCoder.h"
+#include "fxbarcode/qrcode/BC_QRCoderEncoder.h"
+#include "fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.h"
+#include "fxbarcode/qrcode/BC_QRCoderMode.h"
+#include "fxbarcode/qrcode/BC_QRCoderVersion.h"
+
+CBC_QRCodeWriter::CBC_QRCodeWriter() {
+ m_bFixedSize = true;
+ m_iCorrectLevel = 1;
+}
+
+CBC_QRCodeWriter::~CBC_QRCodeWriter() {}
+
+void CBC_QRCodeWriter::ReleaseAll() {
+ delete CBC_ReedSolomonGF256::QRCodeField;
+ CBC_ReedSolomonGF256::QRCodeField = nullptr;
+ delete CBC_ReedSolomonGF256::DataMatrixField;
+ CBC_ReedSolomonGF256::DataMatrixField = nullptr;
+ CBC_QRCoderMode::Destroy();
+ CBC_QRCoderErrorCorrectionLevel::Destroy();
+ CBC_QRCoderVersion::Destroy();
+}
+
+bool CBC_QRCodeWriter::SetErrorCorrectionLevel(int32_t level) {
+ if (level < 0 || level > 3) {
+ return false;
+ }
+ m_iCorrectLevel = level;
+ return true;
+}
+
+uint8_t* CBC_QRCodeWriter::Encode(const CFX_WideString& contents,
+ int32_t ecLevel,
+ int32_t& outWidth,
+ int32_t& outHeight,
+ int32_t& e) {
+ CBC_QRCoderErrorCorrectionLevel* ec = nullptr;
+ switch (ecLevel) {
+ case 0:
+ ec = CBC_QRCoderErrorCorrectionLevel::L;
+ break;
+ case 1:
+ ec = CBC_QRCoderErrorCorrectionLevel::M;
+ break;
+ case 2:
+ ec = CBC_QRCoderErrorCorrectionLevel::Q;
+ break;
+ case 3:
+ ec = CBC_QRCoderErrorCorrectionLevel::H;
+ break;
+ default: {
+ e = BCExceptionUnSupportEclevel;
+ return nullptr;
+ }
+ }
+ CBC_QRCoder qr;
+ CBC_QRCoderEncoder::Encode(contents, ec, &qr, e);
+ if (e != BCExceptionNO)
+ return nullptr;
+
+ outWidth = qr.GetMatrixWidth();
+ outHeight = qr.GetMatrixWidth();
+ uint8_t* result = FX_Alloc2D(uint8_t, outWidth, outHeight);
+ memcpy(result, qr.GetMatrix()->GetArray(), outWidth * outHeight);
+ return result;
+}
diff --git a/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCodeWriter.h b/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCodeWriter.h
new file mode 100644
index 00000000000..42d77fc9f2b
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCodeWriter.h
@@ -0,0 +1,30 @@
+// 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 FXBARCODE_QRCODE_BC_QRCODEWRITER_H_
+#define FXBARCODE_QRCODE_BC_QRCODEWRITER_H_
+
+#include "fxbarcode/BC_TwoDimWriter.h"
+
+class CBC_TwoDimWriter;
+class CBC_QRCodeWriter : public CBC_TwoDimWriter {
+ public:
+ CBC_QRCodeWriter();
+ ~CBC_QRCodeWriter() override;
+
+ static void ReleaseAll();
+
+ uint8_t* Encode(const CFX_WideString& contents,
+ int32_t ecLevel,
+ int32_t& outWidth,
+ int32_t& outHeight,
+ int32_t& e);
+
+ // CBC_TwoDimWriter
+ bool SetErrorCorrectionLevel(int32_t level) override;
+};
+
+#endif // FXBARCODE_QRCODE_BC_QRCODEWRITER_H_
diff --git a/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoder.cpp b/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoder.cpp
new file mode 100644
index 00000000000..e3ac763499f
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoder.cpp
@@ -0,0 +1,145 @@
+// 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
+// Original code is licensed as follows:
+/*
+ * Copyright 2008 ZXing authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <utility>
+
+#include "fxbarcode/common/BC_CommonByteMatrix.h"
+#include "fxbarcode/qrcode/BC_QRCoder.h"
+#include "fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.h"
+#include "fxbarcode/qrcode/BC_QRCoderMode.h"
+#include "fxbarcode/utils.h"
+
+CBC_QRCoder::CBC_QRCoder()
+ : m_mode(nullptr),
+ m_ecLevel(nullptr),
+ m_version(-1),
+ m_matrixWidth(-1),
+ m_maskPattern(-1),
+ m_numTotalBytes(-1),
+ m_numDataBytes(-1),
+ m_numECBytes(-1),
+ m_numRSBlocks(-1) {}
+
+CBC_QRCoder::~CBC_QRCoder() {}
+
+CBC_QRCoderMode* CBC_QRCoder::GetMode() const {
+ return m_mode;
+}
+
+const CBC_QRCoderErrorCorrectionLevel* CBC_QRCoder::GetECLevel() const {
+ return m_ecLevel;
+}
+
+int32_t CBC_QRCoder::GetVersion() const {
+ return m_version;
+}
+
+int32_t CBC_QRCoder::GetMatrixWidth() const {
+ return m_matrixWidth;
+}
+
+int32_t CBC_QRCoder::GetMaskPattern() const {
+ return m_maskPattern;
+}
+
+int32_t CBC_QRCoder::GetNumTotalBytes() const {
+ return m_numTotalBytes;
+}
+
+int32_t CBC_QRCoder::GetNumDataBytes() const {
+ return m_numDataBytes;
+}
+
+int32_t CBC_QRCoder::GetNumECBytes() const {
+ return m_numECBytes;
+}
+
+int32_t CBC_QRCoder::GetNumRSBlocks() const {
+ return m_numRSBlocks;
+}
+
+CBC_CommonByteMatrix* CBC_QRCoder::GetMatrix() const {
+ return m_matrix.get();
+}
+
+int32_t CBC_QRCoder::At(int32_t x, int32_t y, int32_t& e) {
+ int32_t value = m_matrix->Get(x, y);
+ if (!(value == 0 || value == 1)) {
+ e = BCExceptionValueMustBeEither0or1;
+ return 0;
+ }
+ return value;
+}
+
+bool CBC_QRCoder::IsValid() {
+ return m_mode && m_ecLevel && m_version != -1 && m_matrixWidth != -1 &&
+ m_maskPattern != -1 && m_numTotalBytes != -1 && m_numDataBytes != -1 &&
+ m_numECBytes != -1 && m_numRSBlocks != -1 &&
+ IsValidMaskPattern(m_maskPattern) &&
+ m_numTotalBytes == m_numDataBytes + m_numECBytes && m_matrix &&
+ m_matrixWidth == m_matrix->GetWidth() &&
+ m_matrix->GetWidth() == m_matrix->GetHeight();
+}
+
+void CBC_QRCoder::SetMode(CBC_QRCoderMode* value) {
+ m_mode = value;
+}
+
+void CBC_QRCoder::SetECLevel(const CBC_QRCoderErrorCorrectionLevel* ecLevel) {
+ m_ecLevel = ecLevel;
+}
+
+void CBC_QRCoder::SetVersion(int32_t version) {
+ m_version = version;
+}
+
+void CBC_QRCoder::SetMatrixWidth(int32_t width) {
+ m_matrixWidth = width;
+}
+
+void CBC_QRCoder::SetMaskPattern(int32_t pattern) {
+ m_maskPattern = pattern;
+}
+
+void CBC_QRCoder::SetNumDataBytes(int32_t bytes) {
+ m_numDataBytes = bytes;
+}
+
+void CBC_QRCoder::SetNumTotalBytes(int32_t value) {
+ m_numTotalBytes = value;
+}
+
+void CBC_QRCoder::SetNumRSBlocks(int32_t block) {
+ m_numRSBlocks = block;
+}
+
+void CBC_QRCoder::SetNumECBytes(int32_t value) {
+ m_numECBytes = value;
+}
+
+bool CBC_QRCoder::IsValidMaskPattern(int32_t maskPattern) {
+ return maskPattern >= 0 && maskPattern < kNumMaskPatterns;
+}
+
+void CBC_QRCoder::SetMatrix(std::unique_ptr<CBC_CommonByteMatrix> pMatrix) {
+ m_matrix = std::move(pMatrix);
+}
diff --git a/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoder.h b/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoder.h
new file mode 100644
index 00000000000..adeae6c5210
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoder.h
@@ -0,0 +1,63 @@
+// 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 FXBARCODE_QRCODE_BC_QRCODER_H_
+#define FXBARCODE_QRCODE_BC_QRCODER_H_
+
+#include <memory>
+
+class CBC_QRCoderErrorCorrectionLevel;
+class CBC_QRCoderMode;
+class CBC_CommonByteMatrix;
+
+class CBC_QRCoder {
+ public:
+ static constexpr int32_t kNumMaskPatterns = 8;
+
+ CBC_QRCoder();
+ virtual ~CBC_QRCoder();
+
+ static bool IsValidMaskPattern(int32_t maskPattern);
+
+ CBC_QRCoderMode* GetMode() const;
+ const CBC_QRCoderErrorCorrectionLevel* GetECLevel() const;
+ int32_t GetVersion() const;
+ int32_t GetMatrixWidth() const;
+ int32_t GetMaskPattern() const;
+ int32_t GetNumTotalBytes() const;
+ int32_t GetNumDataBytes() const;
+ int32_t GetNumECBytes() const;
+ int32_t GetNumRSBlocks() const;
+ CBC_CommonByteMatrix* GetMatrix() const;
+
+ int32_t At(int32_t x, int32_t y, int32_t& e);
+ bool IsValid();
+
+ void SetMode(CBC_QRCoderMode* value);
+ void SetECLevel(const CBC_QRCoderErrorCorrectionLevel* ecLevel);
+ void SetVersion(int32_t version);
+ void SetMatrixWidth(int32_t width);
+ void SetMaskPattern(int32_t pattern);
+ void SetNumDataBytes(int32_t bytes);
+ void SetNumTotalBytes(int32_t value);
+ void SetNumECBytes(int32_t value);
+ void SetNumRSBlocks(int32_t block);
+ void SetMatrix(std::unique_ptr<CBC_CommonByteMatrix> pMatrix);
+
+ private:
+ CBC_QRCoderMode* m_mode;
+ const CBC_QRCoderErrorCorrectionLevel* m_ecLevel;
+ int32_t m_version;
+ int32_t m_matrixWidth;
+ int32_t m_maskPattern;
+ int32_t m_numTotalBytes;
+ int32_t m_numDataBytes;
+ int32_t m_numECBytes;
+ int32_t m_numRSBlocks;
+ std::unique_ptr<CBC_CommonByteMatrix> m_matrix;
+};
+
+#endif // FXBARCODE_QRCODE_BC_QRCODER_H_
diff --git a/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderBitVector.cpp b/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderBitVector.cpp
new file mode 100644
index 00000000000..7a41ad0910d
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderBitVector.cpp
@@ -0,0 +1,105 @@
+// 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
+// Original code is licensed as follows:
+/*
+ * Copyright 2007 ZXing authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "fxbarcode/qrcode/BC_QRCoderBitVector.h"
+
+#include "core/fxcrt/fx_memory.h"
+#include "fxbarcode/utils.h"
+
+CBC_QRCoderBitVector::CBC_QRCoderBitVector() {}
+
+CBC_QRCoderBitVector::~CBC_QRCoderBitVector() {}
+
+int32_t CBC_QRCoderBitVector::At(size_t index, int32_t& e) const {
+ if (index >= m_sizeInBits) {
+ e = BCExceptionBadIndexException;
+ return 0;
+ }
+ int32_t value = m_array[index >> 3] & 0xff;
+ return (value >> (7 - (index & 0x7))) & 1;
+}
+
+size_t CBC_QRCoderBitVector::sizeInBytes() const {
+ return (m_sizeInBits + 7) >> 3;
+}
+
+size_t CBC_QRCoderBitVector::Size() const {
+ return m_sizeInBits;
+}
+
+void CBC_QRCoderBitVector::AppendBit(int32_t bit) {
+ ASSERT(bit == 0 || bit == 1);
+ int32_t numBitsInLastByte = m_sizeInBits & 0x7;
+ if (numBitsInLastByte == 0) {
+ AppendByte(0);
+ m_sizeInBits -= 8;
+ }
+ m_array[m_sizeInBits >> 3] |= (bit << (7 - numBitsInLastByte));
+ ++m_sizeInBits;
+}
+
+void CBC_QRCoderBitVector::AppendBits(int32_t value, int32_t numBits) {
+ ASSERT(numBits > 0);
+ ASSERT(numBits <= 32);
+
+ int32_t numBitsLeft = numBits;
+ while (numBitsLeft > 0) {
+ if ((m_sizeInBits & 0x7) == 0 && numBitsLeft >= 8) {
+ AppendByte(static_cast<int8_t>((value >> (numBitsLeft - 8)) & 0xff));
+ numBitsLeft -= 8;
+ } else {
+ AppendBit((value >> (numBitsLeft - 1)) & 1);
+ --numBitsLeft;
+ }
+ }
+}
+
+void CBC_QRCoderBitVector::AppendBitVector(CBC_QRCoderBitVector* bits) {
+ int32_t size = bits->Size();
+ for (int32_t i = 0; i < size; i++) {
+ int e = BCExceptionNO;
+ int32_t num = bits->At(i, e);
+ ASSERT(e == BCExceptionNO);
+ AppendBit(num);
+ }
+}
+
+bool CBC_QRCoderBitVector::XOR(const CBC_QRCoderBitVector* other) {
+ if (m_sizeInBits != other->Size())
+ return false;
+
+ const auto* pOther = other->GetArray();
+ for (size_t i = 0; i < sizeInBytes(); ++i)
+ m_array[i] ^= pOther[i];
+ return true;
+}
+
+const uint8_t* CBC_QRCoderBitVector::GetArray() const {
+ return m_array.data();
+}
+
+void CBC_QRCoderBitVector::AppendByte(int8_t value) {
+ if ((m_sizeInBits >> 3) == m_array.size())
+ m_array.push_back(0);
+ m_array[m_sizeInBits >> 3] = value;
+ m_sizeInBits += 8;
+}
diff --git a/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderBitVector.h b/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderBitVector.h
new file mode 100644
index 00000000000..0ebeb60ab8a
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderBitVector.h
@@ -0,0 +1,37 @@
+// 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 FXBARCODE_QRCODE_BC_QRCODERBITVECTOR_H_
+#define FXBARCODE_QRCODE_BC_QRCODERBITVECTOR_H_
+
+#include <stddef.h>
+#include <stdint.h>
+
+#include <vector>
+
+class CBC_QRCoderBitVector {
+ public:
+ CBC_QRCoderBitVector();
+ ~CBC_QRCoderBitVector();
+
+ const uint8_t* GetArray() const;
+ int32_t At(size_t index, int32_t& e) const;
+ size_t Size() const;
+ size_t sizeInBytes() const;
+
+ void AppendBit(int32_t bit);
+ void AppendBits(int32_t value, int32_t numBits);
+ void AppendBitVector(CBC_QRCoderBitVector* bits);
+ bool XOR(const CBC_QRCoderBitVector* other);
+
+ private:
+ void AppendByte(int8_t value);
+
+ size_t m_sizeInBits = 0;
+ std::vector<uint8_t> m_array;
+};
+
+#endif // FXBARCODE_QRCODE_BC_QRCODERBITVECTOR_H_
diff --git a/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderBlockPair.cpp b/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderBlockPair.cpp
new file mode 100644
index 00000000000..9ac93e9b14f
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderBlockPair.cpp
@@ -0,0 +1,47 @@
+// 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
+// Original code is licensed as follows:
+/*
+ * Copyright 2008 ZXing authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "fxbarcode/qrcode/BC_QRCoderBlockPair.h"
+
+#include <utility>
+
+#include "fxbarcode/common/BC_CommonByteArray.h"
+
+CBC_QRCoderBlockPair::CBC_QRCoderBlockPair() {}
+
+CBC_QRCoderBlockPair::~CBC_QRCoderBlockPair() {}
+
+const CBC_CommonByteArray* CBC_QRCoderBlockPair::GetDataBytes() const {
+ return m_dataBytes.get();
+}
+
+const CBC_CommonByteArray* CBC_QRCoderBlockPair::GetErrorCorrectionBytes()
+ const {
+ return m_errorCorrectionBytes.get();
+}
+
+void CBC_QRCoderBlockPair::SetData(
+ std::unique_ptr<CBC_CommonByteArray> data,
+ std::unique_ptr<CBC_CommonByteArray> errorCorrection) {
+ m_dataBytes = std::move(data);
+ m_errorCorrectionBytes = std::move(errorCorrection);
+}
diff --git a/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderBlockPair.h b/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderBlockPair.h
new file mode 100644
index 00000000000..9d571f34107
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderBlockPair.h
@@ -0,0 +1,29 @@
+// 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 FXBARCODE_QRCODE_BC_QRCODERBLOCKPAIR_H_
+#define FXBARCODE_QRCODE_BC_QRCODERBLOCKPAIR_H_
+
+#include <memory>
+
+class CBC_CommonByteArray;
+
+class CBC_QRCoderBlockPair {
+ public:
+ CBC_QRCoderBlockPair();
+ ~CBC_QRCoderBlockPair();
+
+ const CBC_CommonByteArray* GetDataBytes() const;
+ const CBC_CommonByteArray* GetErrorCorrectionBytes() const;
+ void SetData(std::unique_ptr<CBC_CommonByteArray> data,
+ std::unique_ptr<CBC_CommonByteArray> errorCorrection);
+
+ private:
+ std::unique_ptr<CBC_CommonByteArray> m_dataBytes;
+ std::unique_ptr<CBC_CommonByteArray> m_errorCorrectionBytes;
+};
+
+#endif // FXBARCODE_QRCODE_BC_QRCODERBLOCKPAIR_H_
diff --git a/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderECBlocks.cpp b/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderECBlocks.cpp
new file mode 100644
index 00000000000..28f46882d9c
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderECBlocks.cpp
@@ -0,0 +1,47 @@
+// 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
+// Original code is licensed as follows:
+/*
+ * Copyright 2007 ZXing authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "fxbarcode/qrcode/BC_QRCoderECBlocks.h"
+
+#include "fxbarcode/qrcode/BC_QRCoderECBlocksData.h"
+
+CBC_QRCoderECBlocks::CBC_QRCoderECBlocks(const CBC_QRCoderECBlockData& data)
+ : m_data(data) {}
+
+CBC_QRCoderECBlocks::~CBC_QRCoderECBlocks() {}
+
+int32_t CBC_QRCoderECBlocks::GetECCodeWordsPerBlock() const {
+ return m_data.ecCodeWordsPerBlock;
+}
+
+int32_t CBC_QRCoderECBlocks::GetNumBlocks() const {
+ return m_data.count1 + m_data.count2;
+}
+
+int32_t CBC_QRCoderECBlocks::GetTotalECCodeWords() const {
+ return GetECCodeWordsPerBlock() * GetNumBlocks();
+}
+
+int32_t CBC_QRCoderECBlocks::GetTotalDataCodeWords() const {
+ return m_data.count1 * (m_data.dataCodeWords1 + GetECCodeWordsPerBlock()) +
+ m_data.count2 * (m_data.dataCodeWords2 + GetECCodeWordsPerBlock());
+}
diff --git a/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderECBlocks.h b/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderECBlocks.h
new file mode 100644
index 00000000000..4ea7a7abd53
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderECBlocks.h
@@ -0,0 +1,31 @@
+// 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 FXBARCODE_QRCODE_BC_QRCODERECBLOCKS_H_
+#define FXBARCODE_QRCODE_BC_QRCODERECBLOCKS_H_
+
+#include <vector>
+
+#include "core/fxcrt/fx_basic.h"
+
+struct CBC_QRCoderECBlockData;
+
+class CBC_QRCoderECBlocks {
+ public:
+ explicit CBC_QRCoderECBlocks(const CBC_QRCoderECBlockData& data);
+ ~CBC_QRCoderECBlocks();
+
+ int32_t GetNumBlocks() const;
+ int32_t GetTotalECCodeWords() const;
+ int32_t GetTotalDataCodeWords() const;
+
+ private:
+ int32_t GetECCodeWordsPerBlock() const;
+
+ const CBC_QRCoderECBlockData& m_data;
+};
+
+#endif // FXBARCODE_QRCODE_BC_QRCODERECBLOCKS_H_
diff --git a/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderECBlocksData.cpp b/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderECBlocksData.cpp
new file mode 100644
index 00000000000..26ff7483734
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderECBlocksData.cpp
@@ -0,0 +1,180 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+// Original code is licensed as follows:
+/*
+ * Copyright 2007 ZXing authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "fxbarcode/qrcode/BC_QRCoderECBlocksData.h"
+
+const CBC_QRCoderECBlockData g_ECBData[40][4] = {
+ {{7, 1, 19, 0, 0}, {10, 1, 16, 0, 0}, {13, 1, 13, 0, 0}, {17, 1, 9, 0, 0}},
+ {{10, 1, 34, 0, 0},
+ {16, 1, 28, 0, 0},
+ {22, 1, 22, 0, 0},
+ {28, 1, 16, 0, 0}},
+ {{15, 1, 55, 0, 0},
+ {26, 1, 44, 0, 0},
+ {18, 2, 17, 0, 0},
+ {22, 2, 13, 0, 0}},
+ {{20, 1, 80, 0, 0}, {18, 2, 32, 0, 0}, {26, 2, 24, 0, 0}, {16, 4, 9, 0, 0}},
+ {{26, 1, 108, 0, 0},
+ {24, 2, 43, 0, 0},
+ {18, 2, 15, 2, 16},
+ {22, 2, 11, 2, 12}},
+ {{18, 2, 68, 0, 0},
+ {16, 4, 27, 0, 0},
+ {24, 4, 19, 0, 0},
+ {28, 4, 15, 0, 0}},
+ {{20, 2, 78, 0, 0},
+ {18, 4, 31, 0, 0},
+ {18, 2, 14, 4, 15},
+ {26, 4, 13, 1, 14}},
+ {{24, 2, 97, 0, 0},
+ {22, 2, 38, 2, 39},
+ {22, 4, 18, 2, 19},
+ {26, 4, 14, 2, 15}},
+ {{30, 2, 116, 0, 0},
+ {22, 3, 36, 2, 37},
+ {20, 4, 16, 4, 17},
+ {24, 4, 12, 4, 13}},
+ {{18, 2, 68, 2, 69},
+ {26, 4, 43, 1, 44},
+ {24, 6, 19, 2, 20},
+ {28, 6, 15, 2, 16}},
+ {{20, 4, 81, 0, 0},
+ {30, 1, 50, 4, 51},
+ {28, 4, 22, 4, 23},
+ {24, 3, 12, 8, 13}},
+ {{24, 2, 92, 2, 93},
+ {22, 6, 36, 2, 37},
+ {26, 4, 20, 6, 21},
+ {28, 7, 14, 4, 15}},
+ {{26, 4, 107, 0, 0},
+ {22, 8, 37, 1, 38},
+ {24, 8, 20, 4, 21},
+ {22, 12, 11, 4, 12}},
+ {{30, 3, 115, 1, 116},
+ {24, 4, 40, 5, 41},
+ {20, 11, 16, 5, 17},
+ {24, 11, 12, 5, 13}},
+ {{22, 5, 87, 1, 88},
+ {24, 5, 41, 5, 42},
+ {30, 5, 24, 7, 25},
+ {24, 11, 12, 7, 13}},
+ {{24, 5, 98, 1, 99},
+ {28, 7, 45, 3, 46},
+ {24, 15, 19, 2, 20},
+ {30, 3, 15, 13, 16}},
+ {{28, 1, 107, 5, 108},
+ {28, 10, 46, 1, 47},
+ {28, 1, 22, 15, 23},
+ {28, 2, 14, 17, 15}},
+ {{30, 5, 120, 1, 121},
+ {26, 9, 43, 4, 44},
+ {28, 17, 22, 1, 23},
+ {28, 2, 14, 19, 15}},
+ {{28, 3, 113, 4, 114},
+ {26, 3, 44, 11, 45},
+ {26, 17, 21, 4, 22},
+ {26, 9, 13, 16, 14}},
+ {{28, 3, 107, 5, 108},
+ {26, 3, 41, 13, 42},
+ {30, 15, 24, 5, 25},
+ {28, 15, 15, 10, 16}},
+ {{28, 4, 116, 4, 117},
+ {26, 17, 42, 0, 0},
+ {28, 17, 22, 6, 23},
+ {30, 19, 16, 6, 17}},
+ {{28, 2, 111, 7, 112},
+ {28, 17, 46, 0, 0},
+ {30, 7, 24, 16, 25},
+ {24, 34, 13, 0, 0}},
+ {{30, 4, 121, 5, 122},
+ {28, 4, 47, 14, 48},
+ {30, 11, 24, 14, 25},
+ {30, 16, 15, 14, 16}},
+ {{30, 6, 117, 4, 118},
+ {28, 6, 45, 14, 46},
+ {30, 11, 24, 16, 25},
+ {30, 30, 16, 2, 17}},
+ {{26, 8, 106, 4, 107},
+ {28, 8, 47, 13, 48},
+ {30, 7, 24, 22, 25},
+ {30, 22, 15, 13, 16}},
+ {{28, 10, 114, 2, 115},
+ {28, 19, 46, 4, 47},
+ {28, 28, 22, 6, 23},
+ {30, 33, 16, 4, 17}},
+ {{30, 8, 122, 4, 123},
+ {28, 22, 45, 3, 46},
+ {30, 8, 23, 26, 24},
+ {30, 12, 15, 28, 16}},
+ {{30, 3, 117, 10, 118},
+ {28, 3, 45, 23, 46},
+ {30, 4, 24, 31, 25},
+ {30, 11, 15, 31, 16}},
+ {{30, 7, 116, 7, 117},
+ {28, 21, 45, 7, 46},
+ {30, 1, 23, 37, 24},
+ {30, 19, 15, 26, 16}},
+ {{30, 5, 115, 10, 116},
+ {28, 19, 47, 10, 48},
+ {30, 15, 24, 25, 25},
+ {30, 23, 15, 25, 16}},
+ {{30, 13, 115, 3, 116},
+ {28, 2, 46, 29, 47},
+ {30, 42, 24, 1, 25},
+ {30, 23, 15, 28, 16}},
+ {{30, 17, 115, 0, 0},
+ {28, 10, 46, 23, 47},
+ {30, 10, 24, 35, 25},
+ {30, 19, 15, 35, 16}},
+ {{30, 17, 115, 1, 116},
+ {28, 14, 46, 21, 47},
+ {30, 29, 24, 19, 25},
+ {30, 11, 15, 46, 16}},
+ {{30, 13, 115, 6, 116},
+ {28, 14, 46, 23, 47},
+ {30, 44, 24, 7, 25},
+ {30, 59, 16, 1, 17}},
+ {{30, 12, 121, 7, 122},
+ {28, 12, 47, 26, 48},
+ {30, 39, 24, 14, 25},
+ {30, 22, 15, 41, 16}},
+ {{30, 6, 121, 14, 122},
+ {28, 6, 47, 34, 48},
+ {30, 46, 24, 10, 25},
+ {30, 2, 15, 64, 16}},
+ {{30, 17, 122, 4, 123},
+ {28, 29, 46, 14, 47},
+ {30, 49, 24, 10, 25},
+ {30, 24, 15, 46, 16}},
+ {{30, 4, 122, 18, 123},
+ {28, 13, 46, 32, 47},
+ {30, 48, 24, 14, 25},
+ {30, 42, 15, 32, 16}},
+ {{30, 20, 117, 4, 118},
+ {28, 40, 47, 7, 48},
+ {30, 43, 24, 22, 25},
+ {30, 10, 15, 67, 16}},
+ {{30, 19, 118, 6, 119},
+ {28, 18, 47, 31, 48},
+ {30, 34, 24, 34, 25},
+ {30, 20, 15, 61, 16}},
+};
diff --git a/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderECBlocksData.h b/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderECBlocksData.h
new file mode 100644
index 00000000000..0f1ae20b84f
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderECBlocksData.h
@@ -0,0 +1,22 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef FXBARCODE_QRCODE_BC_QRCODERECBLOCKSDATA_H_
+#define FXBARCODE_QRCODE_BC_QRCODERECBLOCKSDATA_H_
+
+#include "core/fxcrt/fx_basic.h"
+
+struct CBC_QRCoderECBlockData {
+ uint8_t ecCodeWordsPerBlock;
+ uint8_t count1;
+ uint8_t dataCodeWords1;
+ uint8_t count2;
+ uint8_t dataCodeWords2;
+};
+
+extern const CBC_QRCoderECBlockData g_ECBData[40][4];
+
+#endif // FXBARCODE_QRCODE_BC_QRCODERECBLOCKSDATA_H_
diff --git a/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderEncoder.cpp b/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderEncoder.cpp
new file mode 100644
index 00000000000..a08bf31ea43
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderEncoder.cpp
@@ -0,0 +1,634 @@
+// 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
+// Original code is licensed as follows:
+/*
+ * Copyright 2008 ZXing authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "fxbarcode/qrcode/BC_QRCoderEncoder.h"
+
+#include <algorithm>
+#include <memory>
+#include <utility>
+
+#include "fxbarcode/BC_UtilCodingConvert.h"
+#include "fxbarcode/common/BC_CommonByteArray.h"
+#include "fxbarcode/common/BC_CommonByteMatrix.h"
+#include "fxbarcode/common/reedsolomon/BC_ReedSolomon.h"
+#include "fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.h"
+#include "fxbarcode/qrcode/BC_QRCoder.h"
+#include "fxbarcode/qrcode/BC_QRCoderBitVector.h"
+#include "fxbarcode/qrcode/BC_QRCoderBlockPair.h"
+#include "fxbarcode/qrcode/BC_QRCoderECBlocks.h"
+#include "fxbarcode/qrcode/BC_QRCoderMaskUtil.h"
+#include "fxbarcode/qrcode/BC_QRCoderMatrixUtil.h"
+#include "fxbarcode/qrcode/BC_QRCoderMode.h"
+#include "fxbarcode/qrcode/BC_QRCoderVersion.h"
+#include "third_party/base/ptr_util.h"
+
+using ModeStringPair = std::pair<CBC_QRCoderMode*, CFX_ByteString>;
+
+namespace {
+
+// This is a mapping for an ASCII table, starting at an index of 32.
+const int8_t g_alphaNumericTable[] = {
+ 36, -1, -1, -1, 37, 38, -1, -1, -1, -1, 39, 40, -1, 41, 42, 43, // 32-47
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 44, -1, -1, -1, -1, -1, // 48-63
+ -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, // 64-79
+ 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35};
+
+int32_t GetAlphaNumericCode(int32_t code) {
+ if (code < 32)
+ return -1;
+ size_t code_index = static_cast<size_t>(code - 32);
+ if (code_index >= FX_ArraySize(g_alphaNumericTable))
+ return -1;
+ return g_alphaNumericTable[code_index];
+}
+
+void AppendNumericBytes(const CFX_ByteString& content,
+ CBC_QRCoderBitVector* bits,
+ int32_t& e) {
+ int32_t length = content.GetLength();
+ int32_t i = 0;
+ while (i < length) {
+ int32_t num1 = content[i] - '0';
+ if (i + 2 < length) {
+ int32_t num2 = content[i + 1] - '0';
+ int32_t num3 = content[i + 2] - '0';
+ bits->AppendBits(num1 * 100 + num2 * 10 + num3, 10);
+ i += 3;
+ } else if (i + 1 < length) {
+ int32_t num2 = content[i + 1] - '0';
+ bits->AppendBits(num1 * 10 + num2, 7);
+ i += 2;
+ } else {
+ bits->AppendBits(num1, 4);
+ i++;
+ }
+ }
+}
+
+void AppendAlphaNumericBytes(const CFX_ByteString& content,
+ CBC_QRCoderBitVector* bits,
+ int32_t& e) {
+ int32_t length = content.GetLength();
+ int32_t i = 0;
+ while (i < length) {
+ int32_t code1 = GetAlphaNumericCode(content[i]);
+ if (code1 == -1) {
+ e = BCExceptionInvalidateCharacter;
+ return;
+ }
+ if (i + 1 < length) {
+ int32_t code2 = GetAlphaNumericCode(content[i + 1]);
+ if (code2 == -1) {
+ e = BCExceptionInvalidateCharacter;
+ return;
+ }
+ bits->AppendBits(code1 * 45 + code2, 11);
+ i += 2;
+ } else {
+ bits->AppendBits(code1, 6);
+ i++;
+ }
+ }
+}
+
+void AppendGBKBytes(const CFX_ByteString& content,
+ CBC_QRCoderBitVector* bits,
+ int32_t& e) {
+ int32_t length = content.GetLength();
+ uint32_t value = 0;
+ for (int32_t i = 0; i < length; i += 2) {
+ value = (uint32_t)(content[i] << 8 | content[i + 1]);
+ if (value <= 0xAAFE && value >= 0xA1A1) {
+ value -= 0xA1A1;
+ } else if (value <= 0xFAFE && value >= 0xB0A1) {
+ value -= 0xA6A1;
+ } else {
+ e = BCExceptionInvalidateCharacter;
+ return;
+ }
+ value = (uint32_t)((value >> 8) * 0x60) + (uint32_t)(value & 0xff);
+ bits->AppendBits(value, 13);
+ }
+}
+
+void Append8BitBytes(const CFX_ByteString& content,
+ CBC_QRCoderBitVector* bits,
+ CFX_ByteString encoding,
+ int32_t& e) {
+ for (int32_t i = 0; i < content.GetLength(); i++)
+ bits->AppendBits(content[i], 8);
+}
+
+void AppendKanjiBytes(const CFX_ByteString& content,
+ CBC_QRCoderBitVector* bits,
+ int32_t& e) {
+ std::vector<uint8_t> bytes;
+ uint32_t value = 0;
+ for (size_t i = 0; i < bytes.size(); i += 2) {
+ value = (uint32_t)((content[i] << 8) | content[i + 1]);
+ if (value <= 0x9ffc && value >= 0x8140) {
+ value -= 0x8140;
+ } else if (value <= 0xebbf && value >= 0xe040) {
+ value -= 0xc140;
+ } else {
+ e = BCExceptionInvalidateCharacter;
+ return;
+ }
+ value = (uint32_t)((value >> 8) * 0xc0) + (uint32_t)(value & 0xff);
+ bits->AppendBits(value, 13);
+ }
+}
+
+void AppendModeInfo(CBC_QRCoderMode* mode, CBC_QRCoderBitVector* bits) {
+ bits->AppendBits(mode->GetBits(), 4);
+ if (mode == CBC_QRCoderMode::sGBK)
+ bits->AppendBits(1, 4);
+}
+
+bool AppendLengthInfo(int32_t numLetters,
+ int32_t version,
+ CBC_QRCoderMode* mode,
+ CBC_QRCoderBitVector* bits) {
+ int32_t e = BCExceptionNO;
+ const auto* qcv = CBC_QRCoderVersion::GetVersionForNumber(version);
+ if (!qcv)
+ return false;
+ int32_t numBits = mode->GetCharacterCountBits(qcv->GetVersionNumber(), e);
+ if (e != BCExceptionNO)
+ return false;
+ if (numBits > ((1 << numBits) - 1))
+ return true;
+
+ if (mode == CBC_QRCoderMode::sGBK)
+ bits->AppendBits(numLetters / 2, numBits);
+ bits->AppendBits(numLetters, numBits);
+ return true;
+}
+
+void AppendBytes(const CFX_ByteString& content,
+ CBC_QRCoderMode* mode,
+ CBC_QRCoderBitVector* bits,
+ CFX_ByteString encoding,
+ int32_t& e) {
+ if (mode == CBC_QRCoderMode::sNUMERIC)
+ AppendNumericBytes(content, bits, e);
+ else if (mode == CBC_QRCoderMode::sALPHANUMERIC)
+ AppendAlphaNumericBytes(content, bits, e);
+ else if (mode == CBC_QRCoderMode::sBYTE)
+ Append8BitBytes(content, bits, encoding, e);
+ else if (mode == CBC_QRCoderMode::sKANJI)
+ AppendKanjiBytes(content, bits, e);
+ else if (mode == CBC_QRCoderMode::sGBK)
+ AppendGBKBytes(content, bits, e);
+ else
+ e = BCExceptionUnsupportedMode;
+}
+
+void InitQRCode(int32_t numInputBytes,
+ const CBC_QRCoderErrorCorrectionLevel* ecLevel,
+ CBC_QRCoderMode* mode,
+ CBC_QRCoder* qrCode,
+ int32_t& e) {
+ qrCode->SetECLevel(ecLevel);
+ qrCode->SetMode(mode);
+ for (int32_t i = 1; i <= CBC_QRCoderVersion::kMaxVersion; ++i) {
+ const auto* version = CBC_QRCoderVersion::GetVersionForNumber(i);
+ if (!version)
+ return;
+ int32_t numBytes = version->GetTotalCodeWords();
+ const auto* ecBlocks = version->GetECBlocksForLevel(*ecLevel);
+ int32_t numEcBytes = ecBlocks->GetTotalECCodeWords();
+ int32_t numRSBlocks = ecBlocks->GetNumBlocks();
+ int32_t numDataBytes = numBytes - numEcBytes;
+ if (numDataBytes >= numInputBytes + 3) {
+ qrCode->SetVersion(i);
+ qrCode->SetNumTotalBytes(numBytes);
+ qrCode->SetNumDataBytes(numDataBytes);
+ qrCode->SetNumRSBlocks(numRSBlocks);
+ qrCode->SetNumECBytes(numEcBytes);
+ qrCode->SetMatrixWidth(version->GetDimensionForVersion());
+ return;
+ }
+ }
+ e = BCExceptionCannotFindBlockInfo;
+}
+
+std::unique_ptr<CBC_CommonByteArray> GenerateECBytes(
+ CBC_CommonByteArray* dataBytes,
+ int32_t numEcBytesInBlock) {
+ int32_t numDataBytes = dataBytes->Size();
+ std::vector<int32_t> toEncode(numDataBytes + numEcBytesInBlock);
+ for (int32_t i = 0; i < numDataBytes; ++i)
+ toEncode[i] = dataBytes->At(i);
+ CBC_ReedSolomonEncoder encode(CBC_ReedSolomonGF256::QRCodeField);
+ encode.Init();
+ if (!encode.Encode(&toEncode, numEcBytesInBlock))
+ return nullptr;
+ auto ecBytes = pdfium::MakeUnique<CBC_CommonByteArray>(numEcBytesInBlock);
+ for (int32_t i = 0; i < numEcBytesInBlock; ++i)
+ ecBytes->Set(i, toEncode[numDataBytes + i]);
+ return ecBytes;
+}
+
+int32_t GetSpanByVersion(CBC_QRCoderMode* modeFirst,
+ CBC_QRCoderMode* modeSecond,
+ int32_t versionNum,
+ int32_t& e) {
+ if (versionNum == 0)
+ return 0;
+
+ if (modeFirst == CBC_QRCoderMode::sALPHANUMERIC &&
+ modeSecond == CBC_QRCoderMode::sBYTE) {
+ if (versionNum >= 1 && versionNum <= 9)
+ return 11;
+ if (versionNum >= 10 && versionNum <= 26)
+ return 15;
+ if (versionNum >= 27 && versionNum <= CBC_QRCoderVersion::kMaxVersion)
+ return 16;
+ e = BCExceptionNoSuchVersion;
+ return 0;
+ }
+ if (modeSecond == CBC_QRCoderMode::sALPHANUMERIC &&
+ modeFirst == CBC_QRCoderMode::sNUMERIC) {
+ if (versionNum >= 1 && versionNum <= 9)
+ return 13;
+ if (versionNum >= 10 && versionNum <= 26)
+ return 15;
+ if (versionNum >= 27 && versionNum <= CBC_QRCoderVersion::kMaxVersion)
+ return 17;
+ e = BCExceptionNoSuchVersion;
+ return 0;
+ }
+ if (modeSecond == CBC_QRCoderMode::sBYTE &&
+ modeFirst == CBC_QRCoderMode::sNUMERIC) {
+ if (versionNum >= 1 && versionNum <= 9)
+ return 6;
+ if (versionNum >= 10 && versionNum <= 26)
+ return 8;
+ if (versionNum >= 27 && versionNum <= CBC_QRCoderVersion::kMaxVersion)
+ return 9;
+ e = BCExceptionNoSuchVersion;
+ return 0;
+ }
+ return -1;
+}
+
+int32_t CalculateMaskPenalty(CBC_CommonByteMatrix* matrix) {
+ return CBC_QRCoderMaskUtil::ApplyMaskPenaltyRule1(matrix) +
+ CBC_QRCoderMaskUtil::ApplyMaskPenaltyRule2(matrix) +
+ CBC_QRCoderMaskUtil::ApplyMaskPenaltyRule3(matrix) +
+ CBC_QRCoderMaskUtil::ApplyMaskPenaltyRule4(matrix);
+}
+
+int32_t ChooseMaskPattern(CBC_QRCoderBitVector* bits,
+ const CBC_QRCoderErrorCorrectionLevel* ecLevel,
+ int32_t version,
+ CBC_CommonByteMatrix* matrix,
+ int32_t& e) {
+ int32_t minPenalty = 65535;
+ int32_t bestMaskPattern = -1;
+ for (int32_t maskPattern = 0; maskPattern < CBC_QRCoder::kNumMaskPatterns;
+ maskPattern++) {
+ CBC_QRCoderMatrixUtil::BuildMatrix(bits, ecLevel, version, maskPattern,
+ matrix, e);
+ if (e != BCExceptionNO)
+ return 0;
+ int32_t penalty = CalculateMaskPenalty(matrix);
+ if (penalty < minPenalty) {
+ minPenalty = penalty;
+ bestMaskPattern = maskPattern;
+ }
+ }
+ return bestMaskPattern;
+}
+
+void GetNumDataBytesAndNumECBytesForBlockID(int32_t numTotalBytes,
+ int32_t numDataBytes,
+ int32_t numRSBlocks,
+ int32_t blockID,
+ int32_t& numDataBytesInBlock,
+ int32_t& numECBytesInBlock) {
+ if (blockID >= numRSBlocks)
+ return;
+
+ int32_t numRsBlocksInGroup2 = numTotalBytes % numRSBlocks;
+ int32_t numRsBlocksInGroup1 = numRSBlocks - numRsBlocksInGroup2;
+ int32_t numTotalBytesInGroup1 = numTotalBytes / numRSBlocks;
+ int32_t numTotalBytesInGroup2 = numTotalBytesInGroup1 + 1;
+ int32_t numDataBytesInGroup1 = numDataBytes / numRSBlocks;
+ int32_t numDataBytesInGroup2 = numDataBytesInGroup1 + 1;
+ int32_t numEcBytesInGroup1 = numTotalBytesInGroup1 - numDataBytesInGroup1;
+ int32_t numEcBytesInGroup2 = numTotalBytesInGroup2 - numDataBytesInGroup2;
+ if (blockID < numRsBlocksInGroup1) {
+ numDataBytesInBlock = numDataBytesInGroup1;
+ numECBytesInBlock = numEcBytesInGroup1;
+ } else {
+ numDataBytesInBlock = numDataBytesInGroup2;
+ numECBytesInBlock = numEcBytesInGroup2;
+ }
+}
+
+void TerminateBits(int32_t numDataBytes,
+ CBC_QRCoderBitVector* bits,
+ int32_t& e) {
+ size_t capacity = numDataBytes << 3;
+ if (bits->Size() > capacity) {
+ e = BCExceptionDataTooMany;
+ return;
+ }
+
+ for (int32_t i = 0; i < 4 && bits->Size() < capacity; ++i)
+ bits->AppendBit(0);
+
+ int32_t numBitsInLastByte = bits->Size() % 8;
+ if (numBitsInLastByte > 0) {
+ int32_t numPaddingBits = 8 - numBitsInLastByte;
+ for (int32_t j = 0; j < numPaddingBits; ++j)
+ bits->AppendBit(0);
+ }
+
+ if (bits->Size() % 8 != 0) {
+ e = BCExceptionDigitLengthMustBe8;
+ return;
+ }
+ int32_t numPaddingBytes = numDataBytes - bits->sizeInBytes();
+ for (int32_t k = 0; k < numPaddingBytes; ++k)
+ bits->AppendBits(k % 2 ? 0x11 : 0xec, 8);
+ if (bits->Size() != capacity)
+ e = BCExceptionBitsNotEqualCacity;
+}
+
+void MergeString(std::vector<ModeStringPair>* result,
+ int32_t versionNum,
+ int32_t& e) {
+ size_t mergeNum = 0;
+ for (size_t i = 0; i + 1 < result->size(); i++) {
+ auto& element1 = (*result)[i];
+ auto& element2 = (*result)[i + 1];
+ if (element1.first == CBC_QRCoderMode::sALPHANUMERIC) {
+ int32_t tmp = GetSpanByVersion(CBC_QRCoderMode::sALPHANUMERIC,
+ CBC_QRCoderMode::sBYTE, versionNum, e);
+ if (e != BCExceptionNO)
+ return;
+ if (element2.first == CBC_QRCoderMode::sBYTE &&
+ element1.second.GetLength() < tmp) {
+ element2.second = element1.second + element2.second;
+ result->erase(result->begin() + i);
+ i--;
+ mergeNum++;
+ }
+ } else if (element1.first == CBC_QRCoderMode::sBYTE) {
+ if (element2.first == CBC_QRCoderMode::sBYTE) {
+ element1.second += element2.second;
+ result->erase(result->begin() + i + 1);
+ i--;
+ mergeNum++;
+ }
+ } else if (element1.first == CBC_QRCoderMode::sNUMERIC) {
+ int32_t tmp = GetSpanByVersion(CBC_QRCoderMode::sNUMERIC,
+ CBC_QRCoderMode::sBYTE, versionNum, e);
+ if (e != BCExceptionNO)
+ return;
+ if (element2.first == CBC_QRCoderMode::sBYTE &&
+ element1.second.GetLength() < tmp) {
+ element2.second = element1.second + element2.second;
+ result->erase(result->begin() + i);
+ i--;
+ mergeNum++;
+ }
+ tmp = GetSpanByVersion(CBC_QRCoderMode::sNUMERIC,
+ CBC_QRCoderMode::sALPHANUMERIC, versionNum, e);
+ if (e != BCExceptionNO)
+ return;
+ if (element2.first == CBC_QRCoderMode::sALPHANUMERIC &&
+ element1.second.GetLength() < tmp) {
+ element2.second = element1.second + element2.second;
+ result->erase(result->begin() + i);
+ i--;
+ mergeNum++;
+ }
+ }
+ }
+ if (mergeNum != 0)
+ MergeString(result, versionNum, e);
+}
+
+void SplitString(const CFX_ByteString& content,
+ std::vector<ModeStringPair>* result) {
+ int32_t index = 0;
+ while (index < content.GetLength() &&
+ ((content[index] >= 0xA1 && content[index] <= 0xAA) ||
+ (content[index] >= 0xB0 && content[index] <= 0xFA))) {
+ index += 2;
+ }
+ if (index)
+ result->push_back({CBC_QRCoderMode::sGBK, content.Mid(0, index)});
+ if (index >= content.GetLength())
+ return;
+
+ int32_t flag = index;
+ while (GetAlphaNumericCode(content[index]) == -1 &&
+ index < content.GetLength() &&
+ !((content[index] >= 0xA1 && content[index] <= 0xAA) ||
+ (content[index] >= 0xB0 && content[index] <= 0xFA))) {
+#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
+ bool high = !!IsDBCSLeadByte(content[index]);
+#else
+ bool high = content[index] > 127;
+#endif
+ ++index;
+ if (high)
+ ++index;
+ }
+ if (index != flag) {
+ result->push_back(
+ {CBC_QRCoderMode::sBYTE, content.Mid(flag, index - flag)});
+ }
+ flag = index;
+ if (index >= content.GetLength())
+ return;
+
+ while (index < content.GetLength() && isdigit(content[index]))
+ ++index;
+
+ if (index != flag) {
+ result->push_back(
+ {CBC_QRCoderMode::sNUMERIC, content.Mid(flag, index - flag)});
+ }
+ flag = index;
+ if (index >= content.GetLength())
+ return;
+
+ while (index < content.GetLength() &&
+ GetAlphaNumericCode(content[index]) != -1) {
+ ++index;
+ }
+ if (index != flag) {
+ result->push_back(
+ {CBC_QRCoderMode::sALPHANUMERIC, content.Mid(flag, index - flag)});
+ }
+ flag = index;
+ if (index < content.GetLength())
+ SplitString(content.Mid(index, content.GetLength() - index), result);
+}
+
+CBC_QRCoderMode* ChooseMode(const CFX_ByteString& content,
+ CFX_ByteString encoding) {
+ if (encoding.Compare("SHIFT_JIS") == 0)
+ return CBC_QRCoderMode::sKANJI;
+
+ bool hasNumeric = false;
+ bool hasAlphaNumeric = false;
+ for (int32_t i = 0; i < content.GetLength(); i++) {
+ if (isdigit(content[i])) {
+ hasNumeric = true;
+ } else if (GetAlphaNumericCode(content[i]) != -1) {
+ hasAlphaNumeric = true;
+ } else {
+ return CBC_QRCoderMode::sBYTE;
+ }
+ }
+ if (hasAlphaNumeric)
+ return CBC_QRCoderMode::sALPHANUMERIC;
+ if (hasNumeric)
+ return CBC_QRCoderMode::sNUMERIC;
+ return CBC_QRCoderMode::sBYTE;
+}
+
+void InterleaveWithECBytes(CBC_QRCoderBitVector* bits,
+ int32_t numTotalBytes,
+ int32_t numDataBytes,
+ int32_t numRSBlocks,
+ CBC_QRCoderBitVector* result,
+ int32_t& e) {
+ ASSERT(numTotalBytes >= 0);
+ ASSERT(numDataBytes >= 0);
+ if (bits->sizeInBytes() != static_cast<size_t>(numDataBytes)) {
+ e = BCExceptionBitsBytesNotMatch;
+ return;
+ }
+ int32_t dataBytesOffset = 0;
+ int32_t maxNumDataBytes = 0;
+ int32_t maxNumEcBytes = 0;
+ std::vector<CBC_QRCoderBlockPair> blocks(numRSBlocks);
+ for (int32_t i = 0; i < numRSBlocks; i++) {
+ int32_t numDataBytesInBlock;
+ int32_t numEcBytesInBlosk;
+ GetNumDataBytesAndNumECBytesForBlockID(numTotalBytes, numDataBytes,
+ numRSBlocks, i, numDataBytesInBlock,
+ numEcBytesInBlosk);
+ auto dataBytes = pdfium::MakeUnique<CBC_CommonByteArray>();
+ dataBytes->Set(bits->GetArray(), dataBytesOffset, numDataBytesInBlock);
+ std::unique_ptr<CBC_CommonByteArray> ecBytes =
+ GenerateECBytes(dataBytes.get(), numEcBytesInBlosk);
+ if (!ecBytes) {
+ e = BCExceptionGeneric;
+ return;
+ }
+ maxNumDataBytes = std::max(maxNumDataBytes, dataBytes->Size());
+ maxNumEcBytes = std::max(maxNumEcBytes, ecBytes->Size());
+ blocks[i].SetData(std::move(dataBytes), std::move(ecBytes));
+ dataBytesOffset += numDataBytesInBlock;
+ }
+ if (numDataBytes != dataBytesOffset) {
+ e = BCExceptionBytesNotMatchOffset;
+ return;
+ }
+ for (int32_t x = 0; x < maxNumDataBytes; x++) {
+ for (size_t j = 0; j < blocks.size(); j++) {
+ const CBC_CommonByteArray* dataBytes = blocks[j].GetDataBytes();
+ if (x < dataBytes->Size())
+ result->AppendBits(dataBytes->At(x), 8);
+ }
+ }
+ for (int32_t y = 0; y < maxNumEcBytes; y++) {
+ for (size_t l = 0; l < blocks.size(); l++) {
+ const CBC_CommonByteArray* ecBytes = blocks[l].GetErrorCorrectionBytes();
+ if (y < ecBytes->Size())
+ result->AppendBits(ecBytes->At(y), 8);
+ }
+ }
+ if (static_cast<size_t>(numTotalBytes) != result->sizeInBytes())
+ e = BCExceptionSizeInBytesDiffer;
+}
+
+} // namespace
+
+CBC_QRCoderEncoder::CBC_QRCoderEncoder() {}
+
+CBC_QRCoderEncoder::~CBC_QRCoderEncoder() {}
+
+void CBC_QRCoderEncoder::Encode(const CFX_WideString& content,
+ const CBC_QRCoderErrorCorrectionLevel* ecLevel,
+ CBC_QRCoder* qrCode,
+ int32_t& e) {
+ CFX_ByteString encoding = "utf8";
+ CFX_ByteString utf8Data;
+ CBC_UtilCodingConvert::UnicodeToUTF8(content, utf8Data);
+ CBC_QRCoderMode* mode = ChooseMode(utf8Data, encoding);
+ CBC_QRCoderBitVector dataBits;
+ AppendBytes(utf8Data, mode, &dataBits, encoding, e);
+ if (e != BCExceptionNO)
+ return;
+ int32_t numInputBytes = dataBits.sizeInBytes();
+ InitQRCode(numInputBytes, ecLevel, mode, qrCode, e);
+ if (e != BCExceptionNO)
+ return;
+ CBC_QRCoderBitVector headerAndDataBits;
+ AppendModeInfo(mode, &headerAndDataBits);
+ int32_t numLetters = mode == CBC_QRCoderMode::sBYTE ? dataBits.sizeInBytes()
+ : content.GetLength();
+ if (!AppendLengthInfo(numLetters, qrCode->GetVersion(), mode,
+ &headerAndDataBits)) {
+ e = BCExceptionGeneric;
+ return;
+ }
+ headerAndDataBits.AppendBitVector(&dataBits);
+ TerminateBits(qrCode->GetNumDataBytes(), &headerAndDataBits, e);
+ if (e != BCExceptionNO)
+ return;
+ CBC_QRCoderBitVector finalBits;
+ InterleaveWithECBytes(&headerAndDataBits, qrCode->GetNumTotalBytes(),
+ qrCode->GetNumDataBytes(), qrCode->GetNumRSBlocks(),
+ &finalBits, e);
+ if (e != BCExceptionNO)
+ return;
+
+ auto matrix = pdfium::MakeUnique<CBC_CommonByteMatrix>(
+ qrCode->GetMatrixWidth(), qrCode->GetMatrixWidth());
+ matrix->Init();
+ int32_t maskPattern = ChooseMaskPattern(
+ &finalBits, qrCode->GetECLevel(), qrCode->GetVersion(), matrix.get(), e);
+ if (e != BCExceptionNO)
+ return;
+
+ qrCode->SetMaskPattern(maskPattern);
+ CBC_QRCoderMatrixUtil::BuildMatrix(&finalBits, qrCode->GetECLevel(),
+ qrCode->GetVersion(),
+ qrCode->GetMaskPattern(), matrix.get(), e);
+ if (e != BCExceptionNO)
+ return;
+
+ qrCode->SetMatrix(std::move(matrix));
+ if (!qrCode->IsValid())
+ e = BCExceptionInvalidQRCode;
+}
diff --git a/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderEncoder.h b/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderEncoder.h
new file mode 100644
index 00000000000..46ee05b43b3
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderEncoder.h
@@ -0,0 +1,30 @@
+// 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 FXBARCODE_QRCODE_BC_QRCODERENCODER_H_
+#define FXBARCODE_QRCODE_BC_QRCODERENCODER_H_
+
+#include <utility>
+#include <vector>
+
+#include "core/fxcrt/fx_basic.h"
+#include "core/fxcrt/fx_string.h"
+
+class CBC_QRCoder;
+class CBC_QRCoderErrorCorrectionLevel;
+
+class CBC_QRCoderEncoder {
+ public:
+ CBC_QRCoderEncoder();
+ ~CBC_QRCoderEncoder();
+
+ static void Encode(const CFX_WideString& content,
+ const CBC_QRCoderErrorCorrectionLevel* ecLevel,
+ CBC_QRCoder* qrCode,
+ int32_t& e);
+};
+
+#endif // FXBARCODE_QRCODE_BC_QRCODERENCODER_H_
diff --git a/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.cpp b/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.cpp
new file mode 100644
index 00000000000..6fb32337054
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.cpp
@@ -0,0 +1,84 @@
+// 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
+// Original code is licensed as follows:
+/*
+ * Copyright 2007 ZXing authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.h"
+
+CBC_QRCoderErrorCorrectionLevel* CBC_QRCoderErrorCorrectionLevel::L = nullptr;
+CBC_QRCoderErrorCorrectionLevel* CBC_QRCoderErrorCorrectionLevel::M = nullptr;
+CBC_QRCoderErrorCorrectionLevel* CBC_QRCoderErrorCorrectionLevel::Q = nullptr;
+CBC_QRCoderErrorCorrectionLevel* CBC_QRCoderErrorCorrectionLevel::H = nullptr;
+
+CBC_QRCoderErrorCorrectionLevel::CBC_QRCoderErrorCorrectionLevel(
+ int32_t ordinal,
+ int32_t bits,
+ const char* name)
+ : m_ordinal(ordinal), m_bits(bits), m_name(name) {}
+
+CBC_QRCoderErrorCorrectionLevel::~CBC_QRCoderErrorCorrectionLevel() {}
+
+void CBC_QRCoderErrorCorrectionLevel::Initialize() {
+ L = new CBC_QRCoderErrorCorrectionLevel(0, 0x01, "L");
+ M = new CBC_QRCoderErrorCorrectionLevel(1, 0x00, "M");
+ Q = new CBC_QRCoderErrorCorrectionLevel(2, 0x03, "Q");
+ H = new CBC_QRCoderErrorCorrectionLevel(3, 0x02, "H");
+}
+
+void CBC_QRCoderErrorCorrectionLevel::Finalize() {
+ delete L;
+ delete M;
+ delete Q;
+ delete H;
+}
+
+CBC_QRCoderErrorCorrectionLevel* CBC_QRCoderErrorCorrectionLevel::ForBits(
+ int32_t bits) {
+ switch (bits) {
+ case 0x00:
+ return M;
+ case 0x01:
+ return L;
+ case 0x02:
+ return H;
+ case 0x03:
+ return Q;
+ default:
+ return nullptr;
+ }
+}
+void CBC_QRCoderErrorCorrectionLevel::Destroy() {
+ if (L) {
+ delete CBC_QRCoderErrorCorrectionLevel::L;
+ L = nullptr;
+ }
+ if (M) {
+ delete CBC_QRCoderErrorCorrectionLevel::M;
+ M = nullptr;
+ }
+ if (H) {
+ delete CBC_QRCoderErrorCorrectionLevel::H;
+ H = nullptr;
+ }
+ if (Q) {
+ delete CBC_QRCoderErrorCorrectionLevel::Q;
+ Q = nullptr;
+ }
+}
diff --git a/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.h b/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.h
new file mode 100644
index 00000000000..e153c643954
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.h
@@ -0,0 +1,41 @@
+// 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 FXBARCODE_QRCODE_BC_QRCODERERRORCORRECTIONLEVEL_H_
+#define FXBARCODE_QRCODE_BC_QRCODERERRORCORRECTIONLEVEL_H_
+
+#include "core/fxcrt/fx_string.h"
+
+class CBC_QRCoderErrorCorrectionLevel {
+ public:
+ static CBC_QRCoderErrorCorrectionLevel* L;
+ static CBC_QRCoderErrorCorrectionLevel* M;
+ static CBC_QRCoderErrorCorrectionLevel* Q;
+ static CBC_QRCoderErrorCorrectionLevel* H;
+
+ static void Initialize();
+ static void Finalize();
+ static void Destroy();
+ static CBC_QRCoderErrorCorrectionLevel* ForBits(int32_t bits);
+
+ ~CBC_QRCoderErrorCorrectionLevel();
+
+ int32_t Ordinal() const { return m_ordinal; }
+ int32_t GetBits() const { return m_bits; }
+ CFX_ByteString GetName() const { return m_name; }
+
+ private:
+ CBC_QRCoderErrorCorrectionLevel(int32_t ordinal,
+ int32_t bits,
+ const char* name);
+ CBC_QRCoderErrorCorrectionLevel();
+
+ int32_t m_ordinal;
+ int32_t m_bits;
+ CFX_ByteString m_name;
+};
+
+#endif // FXBARCODE_QRCODE_BC_QRCODERERRORCORRECTIONLEVEL_H_
diff --git a/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderMaskUtil.cpp b/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderMaskUtil.cpp
new file mode 100644
index 00000000000..cdf1e4caf90
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderMaskUtil.cpp
@@ -0,0 +1,198 @@
+// 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
+// Original code is licensed as follows:
+/*
+ * Copyright 2008 ZXing authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "fxbarcode/common/BC_CommonByteMatrix.h"
+#include "fxbarcode/qrcode/BC_QRCoder.h"
+#include "fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.h"
+#include "fxbarcode/qrcode/BC_QRCoderMaskUtil.h"
+#include "fxbarcode/utils.h"
+
+CBC_QRCoderMaskUtil::CBC_QRCoderMaskUtil() {}
+CBC_QRCoderMaskUtil::~CBC_QRCoderMaskUtil() {}
+int32_t CBC_QRCoderMaskUtil::ApplyMaskPenaltyRule1(
+ CBC_CommonByteMatrix* matrix) {
+ return ApplyMaskPenaltyRule1Internal(matrix, true) +
+ ApplyMaskPenaltyRule1Internal(matrix, false);
+}
+
+int32_t CBC_QRCoderMaskUtil::ApplyMaskPenaltyRule2(
+ CBC_CommonByteMatrix* matrix) {
+ int32_t penalty = 0;
+ uint8_t* array = matrix->GetArray();
+ int32_t width = matrix->GetWidth();
+ int32_t height = matrix->GetHeight();
+ for (int32_t y = 0; y < height - 1; y++) {
+ for (int32_t x = 0; x < width - 1; x++) {
+ int32_t value = array[y * width + x];
+ if (value == array[y * width + x + 1] &&
+ value == array[(y + 1) * width + x] &&
+ value == array[(y + 1) * width + x + 1]) {
+ penalty++;
+ }
+ }
+ }
+ return 3 * penalty;
+}
+
+int32_t CBC_QRCoderMaskUtil::ApplyMaskPenaltyRule3(
+ CBC_CommonByteMatrix* matrix) {
+ int32_t penalty = 0;
+ uint8_t* array = matrix->GetArray();
+ int32_t width = matrix->GetWidth();
+ int32_t height = matrix->GetHeight();
+ for (int32_t y = 0; y < height; ++y) {
+ for (int32_t x = 0; x < width; ++x) {
+ if (x == 0 &&
+ ((y >= 0 && y <= 6) || (y >= height - 7 && y <= height - 1))) {
+ continue;
+ }
+ if (x == width - 7 && (y >= 0 && y <= 6)) {
+ continue;
+ }
+ if (y == 0 &&
+ ((x >= 0 && x <= 6) || (x >= width - 7 && x <= width - 1))) {
+ continue;
+ }
+ if (y == height - 7 && (x >= 0 && x <= 6)) {
+ continue;
+ }
+ if (x + 6 < width && array[y * width + x] == 1 &&
+ array[y * width + x + 1] == 0 && array[y * width + x + 2] == 1 &&
+ array[y * width + x + 3] == 1 && array[y * width + x + 4] == 1 &&
+ array[y * width + x + 5] == 0 && array[y * width + x + 6] == 1 &&
+ ((x + 10 < width && array[y * width + x + 7] == 0 &&
+ array[y * width + x + 8] == 0 && array[y * width + x + 9] == 0 &&
+ array[y * width + x + 10] == 0) ||
+ (x - 4 >= 0 && array[y * width + x - 1] == 0 &&
+ array[y * width + x - 2] == 0 && array[y * width + x - 3] == 0 &&
+ array[y * width + x - 4] == 0))) {
+ penalty += 40;
+ }
+ if (y + 6 < height && array[y * width + x] == 1 &&
+ array[(y + 1) * width + x] == 0 && array[(y + 2) * width + x] == 1 &&
+ array[(y + 3) * width + x] == 1 && array[(y + 4) * width + x] == 1 &&
+ array[(y + 5) * width + x] == 0 && array[(y + 6) * width + x] == 1 &&
+ ((y + 10 < height && array[(y + 7) * width + x] == 0 &&
+ array[(y + 8) * width + x] == 0 &&
+ array[(y + 9) * width + x] == 0 &&
+ array[(y + 10) * width + x] == 0) ||
+ (y - 4 >= 0 && array[(y - 1) * width + x] == 0 &&
+ array[(y - 2) * width + x] == 0 &&
+ array[(y - 3) * width + x] == 0 &&
+ array[(y - 4) * width + x] == 0))) {
+ penalty += 40;
+ }
+ }
+ }
+ return penalty;
+}
+int32_t CBC_QRCoderMaskUtil::ApplyMaskPenaltyRule4(
+ CBC_CommonByteMatrix* matrix) {
+ int32_t numDarkCells = 0;
+ uint8_t* array = matrix->GetArray();
+ int32_t width = matrix->GetWidth();
+ int32_t height = matrix->GetHeight();
+ for (int32_t y = 0; y < height; ++y) {
+ for (int32_t x = 0; x < width; ++x) {
+ if (array[y * width + x] == 1) {
+ numDarkCells += 1;
+ }
+ }
+ }
+ int32_t numTotalCells = matrix->GetHeight() * matrix->GetWidth();
+ double darkRatio = (double)numDarkCells / numTotalCells;
+ return abs((int32_t)(darkRatio * 100 - 50) / 5) * 5 * 10;
+}
+bool CBC_QRCoderMaskUtil::GetDataMaskBit(int32_t maskPattern,
+ int32_t x,
+ int32_t y,
+ int32_t& e) {
+ if (!CBC_QRCoder::IsValidMaskPattern(maskPattern)) {
+ e = (BCExceptionInvalidateMaskPattern);
+ return false;
+ }
+ int32_t intermediate = 0, temp = 0;
+ switch (maskPattern) {
+ case 0:
+ intermediate = (y + x) & 0x1;
+ break;
+ case 1:
+ intermediate = y & 0x1;
+ break;
+ case 2:
+ intermediate = x % 3;
+ break;
+ case 3:
+ intermediate = (y + x) % 3;
+ break;
+ case 4:
+ intermediate = ((y >> 1) + (x / 3)) & 0x1;
+ break;
+ case 5:
+ temp = y * x;
+ intermediate = (temp & 0x1) + (temp % 3);
+ break;
+ case 6:
+ temp = y * x;
+ intermediate = (((temp & 0x1) + (temp % 3)) & 0x1);
+ break;
+ case 7:
+ temp = y * x;
+ intermediate = (((temp % 3) + ((y + x) & 0x1)) & 0x1);
+ break;
+ default: {
+ e = BCExceptionInvalidateMaskPattern;
+ return false;
+ }
+ }
+ return intermediate == 0;
+}
+int32_t CBC_QRCoderMaskUtil::ApplyMaskPenaltyRule1Internal(
+ CBC_CommonByteMatrix* matrix,
+ bool isHorizontal) {
+ int32_t penalty = 0;
+ int32_t numSameBitCells = 0;
+ int32_t prevBit = -1;
+ int32_t width = matrix->GetWidth();
+ int32_t height = matrix->GetHeight();
+ int32_t iLimit = isHorizontal ? height : width;
+ int32_t jLimit = isHorizontal ? width : height;
+ uint8_t* array = matrix->GetArray();
+ for (int32_t i = 0; i < iLimit; ++i) {
+ for (int32_t j = 0; j < jLimit; ++j) {
+ int32_t bit = isHorizontal ? array[i * width + j] : array[j * width + i];
+ if (bit == prevBit) {
+ numSameBitCells += 1;
+ if (numSameBitCells == 5) {
+ penalty += 3;
+ } else if (numSameBitCells > 5) {
+ penalty += 1;
+ }
+ } else {
+ numSameBitCells = 1;
+ prevBit = bit;
+ }
+ }
+ numSameBitCells = 0;
+ }
+ return penalty;
+}
diff --git a/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderMaskUtil.h b/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderMaskUtil.h
new file mode 100644
index 00000000000..63fccbb8e45
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderMaskUtil.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 FXBARCODE_QRCODE_BC_QRCODERMASKUTIL_H_
+#define FXBARCODE_QRCODE_BC_QRCODERMASKUTIL_H_
+class CBC_CommonByteMatrix;
+class CBC_QRCoderMaskUtil {
+ public:
+ CBC_QRCoderMaskUtil();
+ virtual ~CBC_QRCoderMaskUtil();
+ static bool GetDataMaskBit(int32_t maskPattern,
+ int32_t x,
+ int32_t y,
+ int32_t& e);
+
+ static int32_t ApplyMaskPenaltyRule1(CBC_CommonByteMatrix* matrix);
+ static int32_t ApplyMaskPenaltyRule2(CBC_CommonByteMatrix* matrix);
+ static int32_t ApplyMaskPenaltyRule3(CBC_CommonByteMatrix* matrix);
+ static int32_t ApplyMaskPenaltyRule4(CBC_CommonByteMatrix* matrix);
+ static int32_t ApplyMaskPenaltyRule1Internal(CBC_CommonByteMatrix* matrix,
+ bool isHorizontal);
+};
+
+#endif // FXBARCODE_QRCODE_BC_QRCODERMASKUTIL_H_
diff --git a/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderMatrixUtil.cpp b/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderMatrixUtil.cpp
new file mode 100644
index 00000000000..d5b7bcd69d0
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderMatrixUtil.cpp
@@ -0,0 +1,494 @@
+// 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
+// Original code is licensed as follows:
+/*
+ * Copyright 2008 ZXing authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "fxbarcode/common/BC_CommonByteMatrix.h"
+#include "fxbarcode/qrcode/BC_QRCoder.h"
+#include "fxbarcode/qrcode/BC_QRCoderBitVector.h"
+#include "fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.h"
+#include "fxbarcode/qrcode/BC_QRCoderMaskUtil.h"
+#include "fxbarcode/qrcode/BC_QRCoderMatrixUtil.h"
+#include "fxbarcode/utils.h"
+
+const int32_t CBC_QRCoderMatrixUtil::POSITION_DETECTION_PATTERN[7][7] = {
+ {1, 1, 1, 1, 1, 1, 1}, {1, 0, 0, 0, 0, 0, 1}, {1, 0, 1, 1, 1, 0, 1},
+ {1, 0, 1, 1, 1, 0, 1}, {1, 0, 1, 1, 1, 0, 1}, {1, 0, 0, 0, 0, 0, 1},
+ {1, 1, 1, 1, 1, 1, 1}};
+const int32_t CBC_QRCoderMatrixUtil::HORIZONTAL_SEPARATION_PATTERN[1][8] = {
+ {0, 0, 0, 0, 0, 0, 0, 0}};
+const int32_t CBC_QRCoderMatrixUtil::VERTICAL_SEPARATION_PATTERN[7][1] = {
+ {0}, {0}, {0}, {0}, {0}, {0}, {0}};
+const int32_t CBC_QRCoderMatrixUtil::POSITION_ADJUSTMENT_PATTERN[5][5] = {
+ {1, 1, 1, 1, 1},
+ {1, 0, 0, 0, 1},
+ {1, 0, 1, 0, 1},
+ {1, 0, 0, 0, 1},
+ {1, 1, 1, 1, 1}};
+const int32_t
+ CBC_QRCoderMatrixUtil::POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[40][7] =
+ // NOLINTNEXTLINE
+ {
+ {-1, -1, -1, -1, -1, -1, -1}, {6, 18, -1, -1, -1, -1, -1},
+ {6, 22, -1, -1, -1, -1, -1}, {6, 26, -1, -1, -1, -1, -1},
+ {6, 30, -1, -1, -1, -1, -1}, {6, 34, -1, -1, -1, -1, -1},
+ {6, 22, 38, -1, -1, -1, -1}, {6, 24, 42, -1, -1, -1, -1},
+ {6, 26, 46, -1, -1, -1, -1}, {6, 28, 50, -1, -1, -1, -1},
+ {6, 30, 54, -1, -1, -1, -1}, {6, 32, 58, -1, -1, -1, -1},
+ {6, 34, 62, -1, -1, -1, -1}, {6, 26, 46, 66, -1, -1, -1},
+ {6, 26, 48, 70, -1, -1, -1}, {6, 26, 50, 74, -1, -1, -1},
+ {6, 30, 54, 78, -1, -1, -1}, {6, 30, 56, 82, -1, -1, -1},
+ {6, 30, 58, 86, -1, -1, -1}, {6, 34, 62, 90, -1, -1, -1},
+ {6, 28, 50, 72, 94, -1, -1}, {6, 26, 50, 74, 98, -1, -1},
+ {6, 30, 54, 78, 102, -1, -1}, {6, 28, 54, 80, 106, -1, -1},
+ {6, 32, 58, 84, 110, -1, -1}, {6, 30, 58, 86, 114, -1, -1},
+ {6, 34, 62, 90, 118, -1, -1}, {6, 26, 50, 74, 98, 122, -1},
+ {6, 30, 54, 78, 102, 126, -1}, {6, 26, 52, 78, 104, 130, -1},
+ {6, 30, 56, 82, 108, 134, -1}, {6, 34, 60, 86, 112, 138, -1},
+ {6, 30, 58, 86, 114, 142, -1}, {6, 34, 62, 90, 118, 146, -1},
+ {6, 30, 54, 78, 102, 126, 150}, {6, 24, 50, 76, 102, 128, 154},
+ {6, 28, 54, 80, 106, 132, 158}, {6, 32, 58, 84, 110, 136, 162},
+ {6, 26, 54, 82, 110, 138, 166}, {6, 30, 58, 86, 114, 142, 170},
+};
+const int32_t CBC_QRCoderMatrixUtil::TYPE_INFO_COORDINATES[15][2] = {
+ {8, 0}, {8, 1}, {8, 2}, {8, 3}, {8, 4}, {8, 5}, {8, 7}, {8, 8},
+ {7, 8}, {5, 8}, {4, 8}, {3, 8}, {2, 8}, {1, 8}, {0, 8},
+};
+const int32_t CBC_QRCoderMatrixUtil::VERSION_INFO_POLY = 0x1f25;
+const int32_t CBC_QRCoderMatrixUtil::TYPE_INFO_POLY = 0x0537;
+const int32_t CBC_QRCoderMatrixUtil::TYPE_INFO_MASK_PATTERN = 0x5412;
+
+void CBC_QRCoderMatrixUtil::ClearMatrix(CBC_CommonByteMatrix* matrix,
+ int32_t& e) {
+ if (!matrix) {
+ e = BCExceptionNullPointer;
+ return;
+ }
+ matrix->clear((uint8_t)-1);
+}
+void CBC_QRCoderMatrixUtil::BuildMatrix(
+ CBC_QRCoderBitVector* dataBits,
+ const CBC_QRCoderErrorCorrectionLevel* ecLevel,
+ int32_t version,
+ int32_t maskPattern,
+ CBC_CommonByteMatrix* matrix,
+ int32_t& e) {
+ if (!matrix) {
+ e = BCExceptionNullPointer;
+ return;
+ }
+ ClearMatrix(matrix, e);
+ if (e != BCExceptionNO)
+ return;
+ EmbedBasicPatterns(version, matrix, e);
+ if (e != BCExceptionNO)
+ return;
+ EmbedTypeInfo(ecLevel, maskPattern, matrix, e);
+ if (e != BCExceptionNO)
+ return;
+ MaybeEmbedVersionInfo(version, matrix, e);
+ if (e != BCExceptionNO)
+ return;
+ EmbedDataBits(dataBits, maskPattern, matrix, e);
+ if (e != BCExceptionNO)
+ return;
+}
+void CBC_QRCoderMatrixUtil::EmbedBasicPatterns(int32_t version,
+ CBC_CommonByteMatrix* matrix,
+ int32_t& e) {
+ if (!matrix) {
+ e = BCExceptionNullPointer;
+ return;
+ }
+ EmbedPositionDetectionPatternsAndSeparators(matrix, e);
+ if (e != BCExceptionNO)
+ return;
+ EmbedDarkDotAtLeftBottomCorner(matrix, e);
+ if (e != BCExceptionNO)
+ return;
+ MaybeEmbedPositionAdjustmentPatterns(version, matrix, e);
+ if (e != BCExceptionNO)
+ return;
+ EmbedTimingPatterns(matrix, e);
+ if (e != BCExceptionNO)
+ return;
+}
+
+void CBC_QRCoderMatrixUtil::EmbedTypeInfo(
+ const CBC_QRCoderErrorCorrectionLevel* ecLevel,
+ int32_t maskPattern,
+ CBC_CommonByteMatrix* matrix,
+ int32_t& e) {
+ if (!matrix) {
+ e = BCExceptionNullPointer;
+ return;
+ }
+ CBC_QRCoderBitVector typeInfoBits;
+ MakeTypeInfoBits(ecLevel, maskPattern, &typeInfoBits, e);
+ if (e != BCExceptionNO)
+ return;
+
+ for (size_t i = 0; i < typeInfoBits.Size(); i++) {
+ int32_t bit = typeInfoBits.At(typeInfoBits.Size() - 1 - i, e);
+ if (e != BCExceptionNO)
+ return;
+ int32_t x1 = TYPE_INFO_COORDINATES[i][0];
+ int32_t y1 = TYPE_INFO_COORDINATES[i][1];
+ matrix->Set(x1, y1, bit);
+ if (i < 8) {
+ int32_t x2 = matrix->GetWidth() - i - 1;
+ int32_t y2 = 8;
+ matrix->Set(x2, y2, bit);
+ } else {
+ int32_t x2 = 8;
+ int32_t y2 = matrix->GetHeight() - 7 + (i - 8);
+ matrix->Set(x2, y2, bit);
+ }
+ }
+}
+
+void CBC_QRCoderMatrixUtil::MaybeEmbedVersionInfo(int32_t version,
+ CBC_CommonByteMatrix* matrix,
+ int32_t& e) {
+ if (!matrix) {
+ e = BCExceptionNullPointer;
+ return;
+ }
+ if (version < 7) {
+ return;
+ }
+ CBC_QRCoderBitVector versionInfoBits;
+ MakeVersionInfoBits(version, &versionInfoBits, e);
+ if (e != BCExceptionNO)
+ return;
+ int32_t bitIndex = 6 * 3 - 1;
+ for (int32_t i = 0; i < 6; i++) {
+ for (int32_t j = 0; j < 3; j++) {
+ int32_t bit = versionInfoBits.At(bitIndex, e);
+ if (e != BCExceptionNO)
+ return;
+ bitIndex--;
+ matrix->Set(i, matrix->GetHeight() - 11 + j, bit);
+ matrix->Set(matrix->GetHeight() - 11 + j, i, bit);
+ }
+ }
+}
+void CBC_QRCoderMatrixUtil::EmbedDataBits(CBC_QRCoderBitVector* dataBits,
+ int32_t maskPattern,
+ CBC_CommonByteMatrix* matrix,
+ int32_t& e) {
+ if (!matrix || !dataBits) {
+ e = BCExceptionNullPointer;
+ return;
+ }
+ size_t bitIndex = 0;
+ int32_t direction = -1;
+ int32_t x = matrix->GetWidth() - 1;
+ int32_t y = matrix->GetHeight() - 1;
+ while (x > 0) {
+ if (x == 6) {
+ x -= 1;
+ }
+ while (y >= 0 && y < matrix->GetHeight()) {
+ if (y == 6) {
+ y += direction;
+ continue;
+ }
+ for (int32_t i = 0; i < 2; i++) {
+ int32_t xx = x - i;
+ if (!IsEmpty(matrix->Get(xx, y))) {
+ continue;
+ }
+ int32_t bit;
+ if (bitIndex < dataBits->Size()) {
+ bit = dataBits->At(bitIndex, e);
+ if (e != BCExceptionNO)
+ return;
+ bitIndex++;
+ } else {
+ bit = 0;
+ }
+ if (maskPattern != -1) {
+ bool bol = CBC_QRCoderMaskUtil::GetDataMaskBit(maskPattern, xx, y, e);
+ if (e != BCExceptionNO)
+ return;
+ if (bol) {
+ bit ^= 0x01;
+ }
+ }
+ matrix->Set(xx, y, bit);
+ }
+ y += direction;
+ }
+ direction = -direction;
+ y += direction;
+ x -= 2;
+ }
+ if (bitIndex != dataBits->Size()) {
+ return;
+ }
+}
+int32_t CBC_QRCoderMatrixUtil::CalculateBCHCode(int32_t value, int32_t poly) {
+ int32_t msbSetInPoly = FindMSBSet(poly);
+ value <<= msbSetInPoly - 1;
+ while (FindMSBSet(value) >= msbSetInPoly) {
+ value ^= poly << (FindMSBSet(value) - msbSetInPoly);
+ }
+ return value;
+}
+void CBC_QRCoderMatrixUtil::MakeTypeInfoBits(
+ const CBC_QRCoderErrorCorrectionLevel* ecLevel,
+ int32_t maskPattern,
+ CBC_QRCoderBitVector* bits,
+ int32_t& e) {
+ if (!bits) {
+ e = BCExceptionNullPointer;
+ return;
+ }
+ if (!CBC_QRCoder::IsValidMaskPattern(maskPattern)) {
+ e = BCExceptionBadMask;
+ return;
+ }
+ int32_t typeInfo = (ecLevel->GetBits() << 3) | maskPattern;
+ bits->AppendBits(typeInfo, 5);
+ int32_t bchCode = CalculateBCHCode(typeInfo, TYPE_INFO_POLY);
+ bits->AppendBits(bchCode, 10);
+ CBC_QRCoderBitVector maskBits;
+ maskBits.AppendBits(TYPE_INFO_MASK_PATTERN, 15);
+ if (!bits->XOR(&maskBits)) {
+ e = BCExceptionGeneric;
+ return;
+ }
+ ASSERT(bits->Size() == 15);
+}
+
+void CBC_QRCoderMatrixUtil::MakeVersionInfoBits(int32_t version,
+ CBC_QRCoderBitVector* bits,
+ int32_t& e) {
+ if (!bits) {
+ e = BCExceptionNullPointer;
+ return;
+ }
+
+ bits->AppendBits(version, 6);
+ int32_t bchCode = CalculateBCHCode(version, VERSION_INFO_POLY);
+ bits->AppendBits(bchCode, 12);
+ ASSERT(bits->Size() == 18);
+}
+
+bool CBC_QRCoderMatrixUtil::IsEmpty(int32_t value) {
+ return (uint8_t)value == 0xff;
+}
+bool CBC_QRCoderMatrixUtil::IsValidValue(int32_t value) {
+ return ((uint8_t)value == 0xff || (uint8_t)value == 0x00 ||
+ (uint8_t)value == 0x01);
+}
+
+void CBC_QRCoderMatrixUtil::EmbedTimingPatterns(CBC_CommonByteMatrix* matrix,
+ int32_t& e) {
+ if (!matrix) {
+ e = BCExceptionNullPointer;
+ return;
+ }
+ for (int32_t i = 8; i < matrix->GetWidth() - 8; i++) {
+ int32_t bit = (i + 1) % 2;
+ if (!IsValidValue(matrix->Get(i, 6))) {
+ e = BCExceptionInvalidateImageData;
+ return;
+ }
+ if (IsEmpty(matrix->Get(i, 6))) {
+ matrix->Set(i, 6, bit);
+ }
+ if (!IsValidValue(matrix->Get(6, i))) {
+ e = BCExceptionInvalidateImageData;
+ return;
+ }
+ if (IsEmpty(matrix->Get(6, i))) {
+ matrix->Set(6, i, bit);
+ }
+ }
+}
+void CBC_QRCoderMatrixUtil::EmbedDarkDotAtLeftBottomCorner(
+ CBC_CommonByteMatrix* matrix,
+ int32_t& e) {
+ if (!matrix) {
+ e = BCExceptionNullPointer;
+ return;
+ }
+ if (matrix->Get(8, matrix->GetHeight() - 8) == 0) {
+ e = BCExceptionHeight_8BeZero;
+ return;
+ }
+ matrix->Set(8, matrix->GetHeight() - 8, 1);
+}
+void CBC_QRCoderMatrixUtil::EmbedHorizontalSeparationPattern(
+ int32_t xStart,
+ int32_t yStart,
+ CBC_CommonByteMatrix* matrix,
+ int32_t& e) {
+ if (!matrix) {
+ e = BCExceptionNullPointer;
+ return;
+ }
+ for (int32_t x = 0; x < 8; x++) {
+ if (!IsEmpty(matrix->Get(xStart + x, yStart))) {
+ e = BCExceptionInvalidateData;
+ return;
+ }
+ matrix->Set(xStart + x, yStart, HORIZONTAL_SEPARATION_PATTERN[0][x]);
+ }
+}
+void CBC_QRCoderMatrixUtil::EmbedVerticalSeparationPattern(
+ int32_t xStart,
+ int32_t yStart,
+ CBC_CommonByteMatrix* matrix,
+ int32_t& e) {
+ if (!matrix) {
+ e = BCExceptionNullPointer;
+ return;
+ }
+ for (int32_t y = 0; y < 7; y++) {
+ if (!IsEmpty(matrix->Get(xStart, yStart + y))) {
+ e = BCExceptionInvalidateData;
+ return;
+ }
+ matrix->Set(xStart, yStart + y, VERTICAL_SEPARATION_PATTERN[y][0]);
+ }
+}
+void CBC_QRCoderMatrixUtil::EmbedPositionAdjustmentPattern(
+ int32_t xStart,
+ int32_t yStart,
+ CBC_CommonByteMatrix* matrix,
+ int32_t& e) {
+ if (!matrix) {
+ e = BCExceptionNullPointer;
+ if (e != BCExceptionNO)
+ return;
+ }
+ for (int32_t y = 0; y < 5; y++) {
+ for (int32_t x = 0; x < 5; x++) {
+ if (!IsEmpty(matrix->Get(xStart + x, y + yStart))) {
+ e = BCExceptionInvalidateData;
+ return;
+ }
+ matrix->Set(xStart + x, yStart + y, POSITION_ADJUSTMENT_PATTERN[y][x]);
+ }
+ }
+}
+void CBC_QRCoderMatrixUtil::EmbedPositionDetectionPattern(
+ int32_t xStart,
+ int32_t yStart,
+ CBC_CommonByteMatrix* matrix,
+ int32_t& e) {
+ if (!matrix) {
+ e = BCExceptionNullPointer;
+ return;
+ }
+ for (int32_t y = 0; y < 7; y++) {
+ for (int32_t x = 0; x < 7; x++) {
+ if (!IsEmpty(matrix->Get(xStart + x, yStart + y))) {
+ e = BCExceptionInvalidateData;
+ return;
+ }
+ matrix->Set(xStart + x, yStart + y, POSITION_DETECTION_PATTERN[y][x]);
+ }
+ }
+}
+void CBC_QRCoderMatrixUtil::EmbedPositionDetectionPatternsAndSeparators(
+ CBC_CommonByteMatrix* matrix,
+ int32_t& e) {
+ if (!matrix) {
+ e = BCExceptionNullPointer;
+ return;
+ }
+ int32_t pdpWidth = 7;
+ EmbedPositionDetectionPattern(0, 0, matrix, e);
+ if (e != BCExceptionNO)
+ return;
+ EmbedPositionDetectionPattern(matrix->GetWidth() - pdpWidth, 0, matrix, e);
+ if (e != BCExceptionNO)
+ return;
+ EmbedPositionDetectionPattern(0, matrix->GetWidth() - pdpWidth, matrix, e);
+ if (e != BCExceptionNO)
+ return;
+ int32_t hspWidth = 8;
+ EmbedHorizontalSeparationPattern(0, hspWidth - 1, matrix, e);
+ if (e != BCExceptionNO)
+ return;
+ EmbedHorizontalSeparationPattern(matrix->GetWidth() - hspWidth, hspWidth - 1,
+ matrix, e);
+ if (e != BCExceptionNO)
+ return;
+ EmbedHorizontalSeparationPattern(0, matrix->GetWidth() - hspWidth, matrix, e);
+ if (e != BCExceptionNO)
+ return;
+ int32_t vspSize = 7;
+ EmbedVerticalSeparationPattern(vspSize, 0, matrix, e);
+ if (e != BCExceptionNO)
+ return;
+ EmbedVerticalSeparationPattern(matrix->GetHeight() - vspSize - 1, 0, matrix,
+ e);
+ if (e != BCExceptionNO)
+ return;
+ EmbedVerticalSeparationPattern(vspSize, matrix->GetHeight() - vspSize, matrix,
+ e);
+ if (e != BCExceptionNO)
+ return;
+}
+void CBC_QRCoderMatrixUtil::MaybeEmbedPositionAdjustmentPatterns(
+ int32_t version,
+ CBC_CommonByteMatrix* matrix,
+ int32_t& e) {
+ if (!matrix) {
+ e = BCExceptionNullPointer;
+ return;
+ }
+ if (version < 2) {
+ return;
+ }
+ int32_t index = version - 1;
+ int32_t const* coordinates =
+ &(POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[index][0]);
+ int32_t numCoordinate = 7;
+ for (int32_t i = 0; i < numCoordinate; i++) {
+ for (int32_t j = 0; j < numCoordinate; j++) {
+ int32_t y = coordinates[i];
+ int32_t x = coordinates[j];
+ if (x == -1 || y == -1) {
+ continue;
+ }
+ if (IsEmpty(matrix->Get(x, y))) {
+ EmbedPositionAdjustmentPattern(x - 2, y - 2, matrix, e);
+ if (e != BCExceptionNO)
+ return;
+ }
+ }
+ }
+}
+int32_t CBC_QRCoderMatrixUtil::FindMSBSet(int32_t value) {
+ int32_t numDigits = 0;
+ while (value != 0) {
+ value >>= 1;
+ ++numDigits;
+ }
+ return numDigits;
+}
+CBC_QRCoderMatrixUtil::CBC_QRCoderMatrixUtil() {}
+CBC_QRCoderMatrixUtil::~CBC_QRCoderMatrixUtil() {}
diff --git a/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderMatrixUtil.h b/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderMatrixUtil.h
new file mode 100644
index 00000000000..23fe0df8dab
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderMatrixUtil.h
@@ -0,0 +1,88 @@
+// 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 FXBARCODE_QRCODE_BC_QRCODERMATRIXUTIL_H_
+#define FXBARCODE_QRCODE_BC_QRCODERMATRIXUTIL_H_
+
+class CBC_CommonByteMatrix;
+class CBC_QRCoderErrorCorrectionLevel;
+class CBC_QRCoderBitVector;
+
+class CBC_QRCoderMatrixUtil {
+ public:
+ CBC_QRCoderMatrixUtil();
+ virtual ~CBC_QRCoderMatrixUtil();
+ static void ClearMatrix(CBC_CommonByteMatrix* matrix, int32_t& e);
+ static void BuildMatrix(CBC_QRCoderBitVector* dataBits,
+ const CBC_QRCoderErrorCorrectionLevel* ecLevel,
+ int32_t version,
+ int32_t maskPattern,
+ CBC_CommonByteMatrix* matrix,
+ int32_t& e);
+ static void EmbedBasicPatterns(int32_t version,
+ CBC_CommonByteMatrix* matrix,
+ int32_t& e);
+ static void EmbedTypeInfo(const CBC_QRCoderErrorCorrectionLevel* ecLevel,
+ int32_t maskPattern,
+ CBC_CommonByteMatrix* matrix,
+ int32_t& e);
+ static void EmbedDataBits(CBC_QRCoderBitVector* dataBits,
+ int32_t maskPattern,
+ CBC_CommonByteMatrix* matrix,
+ int32_t& e);
+ static void MaybeEmbedVersionInfo(int32_t version,
+ CBC_CommonByteMatrix* matrix,
+ int32_t& e);
+ static int32_t FindMSBSet(int32_t value);
+ static int32_t CalculateBCHCode(int32_t code, int32_t poly);
+ static void MakeTypeInfoBits(const CBC_QRCoderErrorCorrectionLevel* ecLevel,
+ int32_t maskPattern,
+ CBC_QRCoderBitVector* bits,
+ int32_t& e);
+ static void MakeVersionInfoBits(int32_t version,
+ CBC_QRCoderBitVector* bits,
+ int32_t& e);
+ static bool IsEmpty(int32_t value);
+ static bool IsValidValue(int32_t value);
+ static void EmbedTimingPatterns(CBC_CommonByteMatrix* matrix, int32_t& e);
+ static void EmbedDarkDotAtLeftBottomCorner(CBC_CommonByteMatrix* matrix,
+ int32_t& e);
+ static void EmbedHorizontalSeparationPattern(int32_t xStart,
+ int32_t yStart,
+ CBC_CommonByteMatrix* matrix,
+ int32_t& e);
+ static void EmbedVerticalSeparationPattern(int32_t xStart,
+ int32_t yStart,
+ CBC_CommonByteMatrix* matrix,
+ int32_t& e);
+ static void EmbedPositionAdjustmentPattern(int32_t xStart,
+ int32_t yStart,
+ CBC_CommonByteMatrix* matrix,
+ int32_t& e);
+ static void EmbedPositionDetectionPattern(int32_t xStart,
+ int32_t yStart,
+ CBC_CommonByteMatrix* matrix,
+ int32_t& e);
+ static void EmbedPositionDetectionPatternsAndSeparators(
+ CBC_CommonByteMatrix* matrix,
+ int32_t& e);
+ static void MaybeEmbedPositionAdjustmentPatterns(int32_t version,
+ CBC_CommonByteMatrix* matrix,
+ int32_t& e);
+
+ private:
+ static const int32_t POSITION_DETECTION_PATTERN[7][7];
+ static const int32_t VERTICAL_SEPARATION_PATTERN[7][1];
+ static const int32_t HORIZONTAL_SEPARATION_PATTERN[1][8];
+ static const int32_t POSITION_ADJUSTMENT_PATTERN[5][5];
+ static const int32_t POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[40][7];
+ static const int32_t TYPE_INFO_COORDINATES[15][2];
+ static const int32_t VERSION_INFO_POLY;
+ static const int32_t TYPE_INFO_POLY;
+ static const int32_t TYPE_INFO_MASK_PATTERN;
+};
+
+#endif // FXBARCODE_QRCODE_BC_QRCODERMATRIXUTIL_H_
diff --git a/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderMode.cpp b/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderMode.cpp
new file mode 100644
index 00000000000..5f9ce5bf250
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderMode.cpp
@@ -0,0 +1,172 @@
+// 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
+// Original code is licensed as follows:
+/*
+ * Copyright 2007 ZXing authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "fxbarcode/qrcode/BC_QRCoderMode.h"
+
+#include <utility>
+
+#include "fxbarcode/utils.h"
+
+CBC_QRCoderMode* CBC_QRCoderMode::sBYTE = nullptr;
+CBC_QRCoderMode* CBC_QRCoderMode::sNUMERIC = nullptr;
+CBC_QRCoderMode* CBC_QRCoderMode::sALPHANUMERIC = nullptr;
+CBC_QRCoderMode* CBC_QRCoderMode::sKANJI = nullptr;
+CBC_QRCoderMode* CBC_QRCoderMode::sECI = nullptr;
+CBC_QRCoderMode* CBC_QRCoderMode::sGBK = nullptr;
+CBC_QRCoderMode* CBC_QRCoderMode::sTERMINATOR = nullptr;
+CBC_QRCoderMode* CBC_QRCoderMode::sFNC1_FIRST_POSITION = nullptr;
+CBC_QRCoderMode* CBC_QRCoderMode::sFNC1_SECOND_POSITION = nullptr;
+CBC_QRCoderMode* CBC_QRCoderMode::sSTRUCTURED_APPEND = nullptr;
+
+CBC_QRCoderMode::CBC_QRCoderMode(std::vector<int32_t> charCountBits,
+ int32_t bits,
+ CFX_ByteString name)
+ : m_characterCountBitsForVersions(std::move(charCountBits)),
+ m_bits(bits),
+ m_name(name) {}
+
+CBC_QRCoderMode::~CBC_QRCoderMode() {}
+
+void CBC_QRCoderMode::Initialize() {
+ sBYTE = new CBC_QRCoderMode({8, 16, 16}, 0x4, "BYTE");
+ sALPHANUMERIC = new CBC_QRCoderMode({9, 11, 13}, 0x2, "ALPHANUMERIC");
+ sECI = new CBC_QRCoderMode(std::vector<int32_t>(), 0x7, "ECI");
+ sKANJI = new CBC_QRCoderMode({8, 10, 12}, 0x8, "KANJI");
+ sNUMERIC = new CBC_QRCoderMode({10, 12, 14}, 0x1, "NUMERIC");
+ sGBK = new CBC_QRCoderMode({8, 10, 12}, 0x0D, "GBK");
+ sTERMINATOR = new CBC_QRCoderMode(std::vector<int32_t>(), 0x00, "TERMINATOR");
+ sFNC1_FIRST_POSITION =
+ new CBC_QRCoderMode(std::vector<int32_t>(), 0x05, "FNC1_FIRST_POSITION");
+ sFNC1_SECOND_POSITION =
+ new CBC_QRCoderMode(std::vector<int32_t>(), 0x09, "FNC1_SECOND_POSITION");
+ sSTRUCTURED_APPEND =
+ new CBC_QRCoderMode(std::vector<int32_t>(), 0x03, "STRUCTURED_APPEND");
+}
+
+void CBC_QRCoderMode::Finalize() {
+ delete sBYTE;
+ delete sALPHANUMERIC;
+ delete sECI;
+ delete sKANJI;
+ delete sNUMERIC;
+ delete sGBK;
+ delete sTERMINATOR;
+ delete sFNC1_FIRST_POSITION;
+ delete sFNC1_SECOND_POSITION;
+ delete sSTRUCTURED_APPEND;
+}
+
+CBC_QRCoderMode* CBC_QRCoderMode::ForBits(int32_t bits, int32_t& e) {
+ switch (bits) {
+ case 0x0:
+ return sTERMINATOR;
+ case 0x1:
+ return sNUMERIC;
+ case 0x2:
+ return sALPHANUMERIC;
+ case 0x3:
+ return sSTRUCTURED_APPEND;
+ case 0x4:
+ return sBYTE;
+ case 0x5:
+ return sFNC1_FIRST_POSITION;
+ case 0x7:
+ return sECI;
+ case 0x8:
+ return sKANJI;
+ case 0x9:
+ return sFNC1_SECOND_POSITION;
+ case 0x0D:
+ return sGBK;
+ default:
+ e = BCExceptionUnsupportedMode;
+ return nullptr;
+ }
+}
+
+int32_t CBC_QRCoderMode::GetBits() const {
+ return m_bits;
+}
+
+CFX_ByteString CBC_QRCoderMode::GetName() const {
+ return m_name;
+}
+
+int32_t CBC_QRCoderMode::GetCharacterCountBits(int32_t number,
+ int32_t& e) const {
+ if (m_characterCountBitsForVersions.empty()) {
+ e = BCExceptionCharacterNotThisMode;
+ return 0;
+ }
+ int32_t offset;
+ if (number <= 9) {
+ offset = 0;
+ } else if (number <= 26) {
+ offset = 1;
+ } else {
+ offset = 2;
+ }
+ return m_characterCountBitsForVersions[offset];
+}
+
+void CBC_QRCoderMode::Destroy() {
+ if (sBYTE) {
+ delete CBC_QRCoderMode::sBYTE;
+ sBYTE = nullptr;
+ }
+ if (sNUMERIC) {
+ delete CBC_QRCoderMode::sNUMERIC;
+ sNUMERIC = nullptr;
+ }
+ if (sALPHANUMERIC) {
+ delete CBC_QRCoderMode::sALPHANUMERIC;
+ sALPHANUMERIC = nullptr;
+ }
+ if (sKANJI) {
+ delete CBC_QRCoderMode::sKANJI;
+ sKANJI = nullptr;
+ }
+ if (sECI) {
+ delete CBC_QRCoderMode::sECI;
+ sECI = nullptr;
+ }
+ if (sGBK) {
+ delete CBC_QRCoderMode::sGBK;
+ sGBK = nullptr;
+ }
+ if (sTERMINATOR) {
+ delete CBC_QRCoderMode::sTERMINATOR;
+ sTERMINATOR = nullptr;
+ }
+ if (sFNC1_FIRST_POSITION) {
+ delete CBC_QRCoderMode::sFNC1_FIRST_POSITION;
+ sFNC1_FIRST_POSITION = nullptr;
+ }
+ if (sFNC1_SECOND_POSITION) {
+ delete CBC_QRCoderMode::sFNC1_SECOND_POSITION;
+ sFNC1_SECOND_POSITION = nullptr;
+ }
+ if (sSTRUCTURED_APPEND) {
+ delete CBC_QRCoderMode::sSTRUCTURED_APPEND;
+ sSTRUCTURED_APPEND = nullptr;
+ }
+}
diff --git a/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderMode.h b/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderMode.h
new file mode 100644
index 00000000000..6669cbfbc96
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderMode.h
@@ -0,0 +1,51 @@
+// 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 FXBARCODE_QRCODE_BC_QRCODERMODE_H_
+#define FXBARCODE_QRCODE_BC_QRCODERMODE_H_
+
+#include <stdint.h>
+
+#include <vector>
+
+#include "core/fxcrt/fx_string.h"
+
+class CBC_QRCoderMode {
+ public:
+ virtual ~CBC_QRCoderMode();
+
+ static void Initialize();
+ static void Finalize();
+ static CBC_QRCoderMode* ForBits(int32_t bits, int32_t& e);
+ static void Destroy();
+
+ int32_t GetCharacterCountBits(int32_t number, int32_t& e) const;
+ int32_t GetBits() const;
+ CFX_ByteString GetName() const;
+
+ static CBC_QRCoderMode* sBYTE;
+ static CBC_QRCoderMode* sNUMERIC;
+ static CBC_QRCoderMode* sALPHANUMERIC;
+ static CBC_QRCoderMode* sKANJI;
+ static CBC_QRCoderMode* sECI;
+ static CBC_QRCoderMode* sGBK;
+ static CBC_QRCoderMode* sTERMINATOR;
+ static CBC_QRCoderMode* sFNC1_FIRST_POSITION;
+ static CBC_QRCoderMode* sFNC1_SECOND_POSITION;
+ static CBC_QRCoderMode* sSTRUCTURED_APPEND;
+
+ private:
+ CBC_QRCoderMode();
+ CBC_QRCoderMode(std::vector<int32_t> charCountBits,
+ int32_t bits,
+ CFX_ByteString name);
+
+ std::vector<int32_t> m_characterCountBitsForVersions;
+ const int32_t m_bits;
+ const CFX_ByteString m_name;
+};
+
+#endif // FXBARCODE_QRCODE_BC_QRCODERMODE_H_
diff --git a/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderVersion.cpp b/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderVersion.cpp
new file mode 100644
index 00000000000..7da603359df
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderVersion.cpp
@@ -0,0 +1,99 @@
+// 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
+// Original code is licensed as follows:
+/*
+ * Copyright 2007 ZXing authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "fxbarcode/qrcode/BC_QRCoderVersion.h"
+
+#include <memory>
+#include <vector>
+
+#include "fxbarcode/common/BC_CommonBitMatrix.h"
+#include "fxbarcode/qrcode/BC_QRCoderBitVector.h"
+#include "fxbarcode/qrcode/BC_QRCoderECBlocksData.h"
+#include "fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.h"
+#include "fxbarcode/utils.h"
+#include "third_party/base/ptr_util.h"
+
+namespace {
+
+std::vector<std::unique_ptr<CBC_QRCoderVersion>>* g_VERSION = nullptr;
+
+} // namespace
+
+CBC_QRCoderVersion::CBC_QRCoderVersion(int32_t versionNumber,
+ const CBC_QRCoderECBlockData data[4])
+ : m_versionNumber(versionNumber) {
+ m_ecBlocksArray[0] = pdfium::MakeUnique<CBC_QRCoderECBlocks>(data[0]);
+ m_ecBlocksArray[1] = pdfium::MakeUnique<CBC_QRCoderECBlocks>(data[1]);
+ m_ecBlocksArray[2] = pdfium::MakeUnique<CBC_QRCoderECBlocks>(data[2]);
+ m_ecBlocksArray[3] = pdfium::MakeUnique<CBC_QRCoderECBlocks>(data[3]);
+ m_totalCodeWords = m_ecBlocksArray[0]->GetTotalDataCodeWords();
+}
+
+CBC_QRCoderVersion::~CBC_QRCoderVersion() {
+}
+
+// static
+void CBC_QRCoderVersion::Initialize() {
+ g_VERSION = new std::vector<std::unique_ptr<CBC_QRCoderVersion>>();
+}
+
+// static
+void CBC_QRCoderVersion::Finalize() {
+ delete g_VERSION;
+ g_VERSION = nullptr;
+}
+
+// static
+const CBC_QRCoderVersion* CBC_QRCoderVersion::GetVersionForNumber(
+ int32_t versionNumber) {
+ if (g_VERSION->empty()) {
+ for (int i = 0; i < kMaxVersion; ++i) {
+ g_VERSION->push_back(
+ pdfium::MakeUnique<CBC_QRCoderVersion>(i + 1, g_ECBData[i]));
+ }
+ }
+ if (versionNumber < 1 || versionNumber > kMaxVersion)
+ return nullptr;
+ return (*g_VERSION)[versionNumber - 1].get();
+}
+
+// static
+void CBC_QRCoderVersion::Destroy() {
+ g_VERSION->clear();
+}
+
+int32_t CBC_QRCoderVersion::GetVersionNumber() const {
+ return m_versionNumber;
+}
+
+int32_t CBC_QRCoderVersion::GetTotalCodeWords() const {
+ return m_totalCodeWords;
+}
+
+int32_t CBC_QRCoderVersion::GetDimensionForVersion() const {
+ return 17 + 4 * m_versionNumber;
+}
+
+const CBC_QRCoderECBlocks* CBC_QRCoderVersion::GetECBlocksForLevel(
+ const CBC_QRCoderErrorCorrectionLevel& ecLevel) const {
+ return m_ecBlocksArray[ecLevel.Ordinal()].get();
+}
diff --git a/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderVersion.h b/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderVersion.h
new file mode 100644
index 00000000000..0c9509b4579
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/qrcode/BC_QRCoderVersion.h
@@ -0,0 +1,44 @@
+// 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 FXBARCODE_QRCODE_BC_QRCODERVERSION_H_
+#define FXBARCODE_QRCODE_BC_QRCODERVERSION_H_
+
+#include <memory>
+#include <vector>
+
+#include "core/fxcrt/fx_basic.h"
+#include "fxbarcode/qrcode/BC_QRCoderECBlocks.h"
+
+class CBC_QRCoderErrorCorrectionLevel;
+
+class CBC_QRCoderVersion {
+ public:
+ static constexpr int32_t kMaxVersion = 40;
+
+ CBC_QRCoderVersion(int32_t versionNumber,
+ const CBC_QRCoderECBlockData data[4]);
+ ~CBC_QRCoderVersion();
+
+ static void Initialize();
+ static void Finalize();
+
+ static const CBC_QRCoderVersion* GetVersionForNumber(int32_t versionNumber);
+ static void Destroy();
+
+ int32_t GetVersionNumber() const;
+ int32_t GetTotalCodeWords() const;
+ int32_t GetDimensionForVersion() const;
+ const CBC_QRCoderECBlocks* GetECBlocksForLevel(
+ const CBC_QRCoderErrorCorrectionLevel& ecLevel) const;
+
+ private:
+ const int32_t m_versionNumber;
+ int32_t m_totalCodeWords;
+ std::unique_ptr<CBC_QRCoderECBlocks> m_ecBlocksArray[4];
+};
+
+#endif // FXBARCODE_QRCODE_BC_QRCODERVERSION_H_
diff --git a/chromium/third_party/pdfium/fxbarcode/utils.h b/chromium/third_party/pdfium/fxbarcode/utils.h
new file mode 100644
index 00000000000..442e3277840
--- /dev/null
+++ b/chromium/third_party/pdfium/fxbarcode/utils.h
@@ -0,0 +1,114 @@
+// 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 FXBARCODE_UTILS_H_
+#define FXBARCODE_UTILS_H_
+
+#include <vector>
+
+#include "core/fxcrt/fx_basic.h"
+
+bool BC_FX_ByteString_Replace(CFX_ByteString& dst,
+ uint32_t first,
+ uint32_t last,
+ int32_t count,
+ char c);
+void BC_FX_ByteString_Append(CFX_ByteString& dst, int32_t count, char c);
+void BC_FX_ByteString_Append(CFX_ByteString& dst,
+ const std::vector<uint8_t>& ba);
+
+#if (_FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_)
+#include <limits>
+#elif(_FX_OS_ == _FX_MACOSX_ || _FX_OS_ == _FX_LINUX_DESKTOP_ || \
+ _FX_OS_ == _FX_IOS_)
+#include <limits.h>
+#endif
+#if (_FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_)
+#define FXSYS_isnan(x) _isnan(x)
+#elif(_FX_OS_ == _FX_MACOSX_ || _FX_OS_ == _FX_IOS_ || \
+ _FX_OS_ == _FX_LINUX_DESKTOP_ || _FX_OS_ == _FX_ANDROID_)
+#include <cmath>
+#define FXSYS_isnan(x) std::isnan(x)
+#endif
+#if (_FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_)
+#define FXSYS_nan() (std::numeric_limits<float>::quiet_NaN())
+#elif(_FX_OS_ == _FX_MACOSX_ || _FX_OS_ == _FX_LINUX_DESKTOP_ || \
+ _FX_OS_ == _FX_IOS_ || _FX_OS_ == _FX_ANDROID_)
+#define FXSYS_nan() NAN
+#endif
+enum BCFORMAT {
+ BCFORMAT_UNSPECIFY = -1,
+ BCFORMAT_CODABAR,
+ BCFORMAT_CODE_39,
+ BCFORMAT_CODE_128,
+ BCFORMAT_CODE_128B,
+ BCFORMAT_CODE_128C,
+ BCFORMAT_EAN_8,
+ BCFORMAT_UPC_A,
+ BCFORMAT_EAN_13,
+ BCFORMAT_PDF_417,
+ BCFORMAT_DATAMATRIX,
+ BCFORMAT_QR_CODE
+};
+#define BCFORMAT_ECLEVEL_L 0
+#define BCFORMAT_ECLEVEL_M 1
+#define BCFORMAT_ECLEVEL_Q 2
+#define BCFORMAT_ECLEVEL_H 3
+#include <ctype.h>
+#define BCExceptionNO 0
+#define BCExceptionHeightAndWidthMustBeAtLeast1 5
+#define BCExceptionFormatException 8
+#define BCExceptionIllegalArgument 16
+#define BCExceptionDigitLengthMustBe8 20
+#define BCExceptionNoContents 26
+#define BCExceptionUnSupportEclevel 27
+#define BCExceptionDegreeIsNegative 31
+#define BCExceptionAIsZero 37
+#define BCExceptionOnlyEncodeCODE_128 41
+#define BCExceptionOnlyEncodeCODE_39 42
+#define BCExceptionOnlyEncodeEAN_13 43
+#define BCExceptionOnlyEncodeEAN_8 44
+#define BCExceptionDigitLengthShould13 46
+#define BCExceptionOnlyEncodeUPC_A 48
+#define BCExceptionValueMustBeEither0or1 50
+#define BCExceptionBadIndexException 52
+#define BCExceptionNoSuchVersion 58
+#define BCExceptionCannotFindBlockInfo 59
+#define BCExceptionInvalidQRCode 61
+#define BCExceptionDataTooMany 62
+#define BCExceptionBitsNotEqualCacity 63
+#define BCExceptionUnsupportedMode 64
+#define BCExceptionInvalidateCharacter 65
+#define BCExceptionBytesNotMatchOffset 66
+#define BCExceptionSizeInBytesDiffer 67
+#define BCExceptionInvalidateMaskPattern 68
+#define BCExceptionNullPointer 69
+#define BCExceptionBadMask 70
+#define BCExceptionInvalidateImageData 73
+#define BCExceptionHeight_8BeZero 74
+#define BCExceptionCharacterNotThisMode 75
+#define BCExceptionBitsBytesNotMatch 76
+#define BCExceptionInvalidateData 77
+#define BCExceptionFailToCreateBitmap 80
+#define BCExceptionOnlyEncodeCODEBAR 82
+#define BCExceptionCharactersOutsideISO88591Encoding 87
+#define BCExceptionIllegalDataCodewords 88
+#define BCExceptionCannotHandleThisNumberOfDataRegions 89
+#define BCExceptionIllegalStateUnexpectedCase 90
+#define BCExceptionIllegalStateCountMustNotExceed4 91
+#define BCExceptionIllegalStateMessageLengthInvalid 92
+#define BCExceptionIllegalArgumentNotGigits 93
+#define BCExceptionIllegalStateIllegalMode 94
+#define BCExceptionNonEncodableCharacterDetected 96
+#define BCExceptionErrorCorrectionLevelMustBeBetween0And8 97
+#define BCExceptionNoRecommendationPossible 98
+#define BCExceptionIllegalArgumentnMustBeAbove0 99
+#define BCExceptionUnableToFitMessageInColumns 100
+#define BCExceptionEncodedMessageContainsTooManyCodeWords 101
+#define BCExceptionBitmapSizeError 102
+#define BCExceptionGeneric 107
+
+#endif // FXBARCODE_UTILS_H_
diff --git a/chromium/third_party/pdfium/fxjs/cfxjse_arguments.cpp b/chromium/third_party/pdfium/fxjs/cfxjse_arguments.cpp
index 75904cbbead..323134dcf5c 100644
--- a/chromium/third_party/pdfium/fxjs/cfxjse_arguments.cpp
+++ b/chromium/third_party/pdfium/fxjs/cfxjse_arguments.cpp
@@ -32,8 +32,8 @@ int32_t CFXJSE_Arguments::GetInt32(int32_t index) const {
return static_cast<int32_t>((*m_pInfo)[index]->NumberValue());
}
-FX_FLOAT CFXJSE_Arguments::GetFloat(int32_t index) const {
- return static_cast<FX_FLOAT>((*m_pInfo)[index]->NumberValue());
+float CFXJSE_Arguments::GetFloat(int32_t index) const {
+ return static_cast<float>((*m_pInfo)[index]->NumberValue());
}
CFX_ByteString CFXJSE_Arguments::GetUTF8String(int32_t index) const {
diff --git a/chromium/third_party/pdfium/fxjs/cfxjse_arguments.h b/chromium/third_party/pdfium/fxjs/cfxjse_arguments.h
index 51e1981d03f..4f18082f847 100644
--- a/chromium/third_party/pdfium/fxjs/cfxjse_arguments.h
+++ b/chromium/third_party/pdfium/fxjs/cfxjse_arguments.h
@@ -24,7 +24,7 @@ class CFXJSE_Arguments {
std::unique_ptr<CFXJSE_Value> GetValue(int32_t index) const;
bool GetBoolean(int32_t index) const;
int32_t GetInt32(int32_t index) const;
- FX_FLOAT GetFloat(int32_t index) const;
+ float GetFloat(int32_t index) const;
CFX_ByteString GetUTF8String(int32_t index) const;
CFXJSE_HostObject* GetObject(int32_t index,
CFXJSE_Class* pClass = nullptr) const;
diff --git a/chromium/third_party/pdfium/fxjs/cfxjse_class.cpp b/chromium/third_party/pdfium/fxjs/cfxjse_class.cpp
index fd97b575ed5..8924a48a47e 100644
--- a/chromium/third_party/pdfium/fxjs/cfxjse_class.cpp
+++ b/chromium/third_party/pdfium/fxjs/cfxjse_class.cpp
@@ -10,6 +10,7 @@
#include "fxjs/cfxjse_context.h"
#include "fxjs/cfxjse_value.h"
+#include "third_party/base/ptr_util.h"
namespace {
@@ -22,10 +23,9 @@ void V8FunctionCallback_Wrapper(
return;
CFX_ByteStringC szFunctionName(lpFunctionInfo->name);
- std::unique_ptr<CFXJSE_Value> lpThisValue(
- new CFXJSE_Value(info.GetIsolate()));
- lpThisValue->ForceSetValue(info.This());
- std::unique_ptr<CFXJSE_Value> lpRetValue(new CFXJSE_Value(info.GetIsolate()));
+ auto lpThisValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
+ lpThisValue->ForceSetValue(info.Holder());
+ auto lpRetValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
CFXJSE_Arguments impl(&info, lpRetValue.get());
lpFunctionInfo->callbackProc(lpThisValue.get(), szFunctionName, impl);
if (!lpRetValue->DirectGetValue().IsEmpty())
@@ -41,10 +41,9 @@ void V8ClassGlobalConstructorCallback_Wrapper(
return;
CFX_ByteStringC szFunctionName(lpClassDefinition->name);
- std::unique_ptr<CFXJSE_Value> lpThisValue(
- new CFXJSE_Value(info.GetIsolate()));
- lpThisValue->ForceSetValue(info.This());
- std::unique_ptr<CFXJSE_Value> lpRetValue(new CFXJSE_Value(info.GetIsolate()));
+ auto lpThisValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
+ lpThisValue->ForceSetValue(info.Holder());
+ auto lpRetValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
CFXJSE_Arguments impl(&info, lpRetValue.get());
lpClassDefinition->constructor(lpThisValue.get(), szFunctionName, impl);
if (!lpRetValue->DirectGetValue().IsEmpty())
@@ -60,11 +59,9 @@ void V8GetterCallback_Wrapper(v8::Local<v8::String> property,
return;
CFX_ByteStringC szPropertyName(lpPropertyInfo->name);
- std::unique_ptr<CFXJSE_Value> lpThisValue(
- new CFXJSE_Value(info.GetIsolate()));
- std::unique_ptr<CFXJSE_Value> lpPropValue(
- new CFXJSE_Value(info.GetIsolate()));
- lpThisValue->ForceSetValue(info.This());
+ auto lpThisValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
+ auto lpPropValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
+ lpThisValue->ForceSetValue(info.Holder());
lpPropertyInfo->getProc(lpThisValue.get(), szPropertyName, lpPropValue.get());
info.GetReturnValue().Set(lpPropValue->DirectGetValue());
}
@@ -79,11 +76,9 @@ void V8SetterCallback_Wrapper(v8::Local<v8::String> property,
return;
CFX_ByteStringC szPropertyName(lpPropertyInfo->name);
- std::unique_ptr<CFXJSE_Value> lpThisValue(
- new CFXJSE_Value(info.GetIsolate()));
- std::unique_ptr<CFXJSE_Value> lpPropValue(
- new CFXJSE_Value(info.GetIsolate()));
- lpThisValue->ForceSetValue(info.This());
+ auto lpThisValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
+ auto lpPropValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
+ lpThisValue->ForceSetValue(info.Holder());
lpPropValue->ForceSetValue(value);
lpPropertyInfo->setProc(lpThisValue.get(), szPropertyName, lpPropValue.get());
}
@@ -99,8 +94,8 @@ void V8ConstructorCallback_Wrapper(
if (!lpClassDefinition)
return;
- ASSERT(info.This()->InternalFieldCount());
- info.This()->SetAlignedPointerInInternalField(0, nullptr);
+ ASSERT(info.Holder()->InternalFieldCount());
+ info.Holder()->SetAlignedPointerInInternalField(0, nullptr);
}
void Context_GlobalObjToString(
@@ -119,7 +114,7 @@ void Context_GlobalObjToString(
return;
}
v8::Local<v8::String> local_str =
- info.This()
+ info.Holder()
->ObjectProtoToString(info.GetIsolate()->GetCurrentContext())
.FromMaybe(v8::Local<v8::String>());
info.GetReturnValue().Set(local_str);
@@ -135,10 +130,9 @@ void DynPropGetterAdapter_MethodCallback(
ASSERT(lpClass && !hPropName.IsEmpty());
v8::String::Utf8Value szPropName(hPropName);
CFX_ByteStringC szFxPropName = *szPropName;
- std::unique_ptr<CFXJSE_Value> lpThisValue(
- new CFXJSE_Value(info.GetIsolate()));
- lpThisValue->ForceSetValue(info.This());
- std::unique_ptr<CFXJSE_Value> lpRetValue(new CFXJSE_Value(info.GetIsolate()));
+ auto lpThisValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
+ lpThisValue->ForceSetValue(info.Holder());
+ auto lpRetValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
CFXJSE_Arguments impl(&info, lpRetValue.get());
lpClass->dynMethodCall(lpThisValue.get(), szFxPropName, impl);
if (!lpRetValue->DirectGetValue().IsEmpty())
@@ -226,15 +220,14 @@ bool DynPropDeleterAdapter(const FXJSE_CLASS_DESCRIPTOR* lpClass,
void NamedPropertyQueryCallback(
v8::Local<v8::Name> property,
const v8::PropertyCallbackInfo<v8::Integer>& info) {
- v8::Local<v8::Object> thisObject = info.This();
+ v8::Local<v8::Object> thisObject = info.Holder();
const FXJSE_CLASS_DESCRIPTOR* lpClass = static_cast<FXJSE_CLASS_DESCRIPTOR*>(
info.Data().As<v8::External>()->Value());
v8::Isolate* pIsolate = info.GetIsolate();
v8::HandleScope scope(pIsolate);
v8::String::Utf8Value szPropName(property);
CFX_ByteStringC szFxPropName(*szPropName, szPropName.length());
- std::unique_ptr<CFXJSE_Value> lpThisValue(
- new CFXJSE_Value(info.GetIsolate()));
+ auto lpThisValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
lpThisValue->ForceSetValue(thisObject);
if (DynPropQueryAdapter(lpClass, lpThisValue.get(), szFxPropName)) {
info.GetReturnValue().Set(v8::DontDelete);
@@ -247,15 +240,14 @@ void NamedPropertyQueryCallback(
void NamedPropertyDeleterCallback(
v8::Local<v8::Name> property,
const v8::PropertyCallbackInfo<v8::Boolean>& info) {
- v8::Local<v8::Object> thisObject = info.This();
+ v8::Local<v8::Object> thisObject = info.Holder();
const FXJSE_CLASS_DESCRIPTOR* lpClass = static_cast<FXJSE_CLASS_DESCRIPTOR*>(
info.Data().As<v8::External>()->Value());
v8::Isolate* pIsolate = info.GetIsolate();
v8::HandleScope scope(pIsolate);
v8::String::Utf8Value szPropName(property);
CFX_ByteStringC szFxPropName(*szPropName, szPropName.length());
- std::unique_ptr<CFXJSE_Value> lpThisValue(
- new CFXJSE_Value(info.GetIsolate()));
+ auto lpThisValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
lpThisValue->ForceSetValue(thisObject);
info.GetReturnValue().Set(
!!DynPropDeleterAdapter(lpClass, lpThisValue.get(), szFxPropName));
@@ -264,15 +256,14 @@ void NamedPropertyDeleterCallback(
void NamedPropertyGetterCallback(
v8::Local<v8::Name> property,
const v8::PropertyCallbackInfo<v8::Value>& info) {
- v8::Local<v8::Object> thisObject = info.This();
+ v8::Local<v8::Object> thisObject = info.Holder();
const FXJSE_CLASS_DESCRIPTOR* lpClass = static_cast<FXJSE_CLASS_DESCRIPTOR*>(
info.Data().As<v8::External>()->Value());
v8::String::Utf8Value szPropName(property);
CFX_ByteStringC szFxPropName(*szPropName, szPropName.length());
- std::unique_ptr<CFXJSE_Value> lpThisValue(
- new CFXJSE_Value(info.GetIsolate()));
+ auto lpThisValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
lpThisValue->ForceSetValue(thisObject);
- std::unique_ptr<CFXJSE_Value> lpNewValue(new CFXJSE_Value(info.GetIsolate()));
+ auto lpNewValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
DynPropGetterAdapter(lpClass, lpThisValue.get(), szFxPropName,
lpNewValue.get());
info.GetReturnValue().Set(lpNewValue->DirectGetValue());
@@ -282,16 +273,15 @@ void NamedPropertySetterCallback(
v8::Local<v8::Name> property,
v8::Local<v8::Value> value,
const v8::PropertyCallbackInfo<v8::Value>& info) {
- v8::Local<v8::Object> thisObject = info.This();
+ v8::Local<v8::Object> thisObject = info.Holder();
const FXJSE_CLASS_DESCRIPTOR* lpClass = static_cast<FXJSE_CLASS_DESCRIPTOR*>(
info.Data().As<v8::External>()->Value());
v8::String::Utf8Value szPropName(property);
CFX_ByteStringC szFxPropName(*szPropName, szPropName.length());
- std::unique_ptr<CFXJSE_Value> lpThisValue(
- new CFXJSE_Value(info.GetIsolate()));
+ auto lpThisValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
lpThisValue->ForceSetValue(thisObject);
- std::unique_ptr<CFXJSE_Value> lpNewValue(new CFXJSE_Value(info.GetIsolate()));
+ auto lpNewValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
lpNewValue->ForceSetValue(value);
DynPropSetterAdapter(lpClass, lpThisValue.get(), szFxPropName,
lpNewValue.get());
diff --git a/chromium/third_party/pdfium/fxjs/cfxjse_context.cpp b/chromium/third_party/pdfium/fxjs/cfxjse_context.cpp
index d82f875e0f0..d3b55ff43ec 100644
--- a/chromium/third_party/pdfium/fxjs/cfxjse_context.cpp
+++ b/chromium/third_party/pdfium/fxjs/cfxjse_context.cpp
@@ -8,10 +8,11 @@
#include "fxjs/cfxjse_class.h"
#include "fxjs/cfxjse_value.h"
+#include "third_party/base/ptr_util.h"
namespace {
-const FX_CHAR szCompatibleModeScript[] =
+const char szCompatibleModeScript[] =
"(function(global, list) {\n"
" 'use strict';\n"
" var objname;\n"
@@ -187,7 +188,7 @@ CFXJSE_Context::CFXJSE_Context(v8::Isolate* pIsolate) : m_pIsolate(pIsolate) {}
CFXJSE_Context::~CFXJSE_Context() {}
std::unique_ptr<CFXJSE_Value> CFXJSE_Context::GetGlobalObject() {
- std::unique_ptr<CFXJSE_Value> pValue(new CFXJSE_Value(m_pIsolate));
+ auto pValue = pdfium::MakeUnique<CFXJSE_Value>(m_pIsolate);
CFXJSE_ScopeUtil_IsolateHandleContext scope(this);
v8::Local<v8::Context> hContext =
@@ -202,7 +203,7 @@ void CFXJSE_Context::EnableCompatibleMode() {
ExecuteScript(szCompatibleModeScript, nullptr, nullptr);
}
-bool CFXJSE_Context::ExecuteScript(const FX_CHAR* szScript,
+bool CFXJSE_Context::ExecuteScript(const char* szScript,
CFXJSE_Value* lpRetValue,
CFXJSE_Value* lpNewThisObject) {
CFXJSE_ScopeUtil_IsolateHandleContext scope(this);
diff --git a/chromium/third_party/pdfium/fxjs/cfxjse_context.h b/chromium/third_party/pdfium/fxjs/cfxjse_context.h
index a6945147704..7b83aee4aaa 100644
--- a/chromium/third_party/pdfium/fxjs/cfxjse_context.h
+++ b/chromium/third_party/pdfium/fxjs/cfxjse_context.h
@@ -30,7 +30,7 @@ class CFXJSE_Context {
v8::Isolate* GetRuntime() { return m_pIsolate; }
std::unique_ptr<CFXJSE_Value> GetGlobalObject();
void EnableCompatibleMode();
- bool ExecuteScript(const FX_CHAR* szScript,
+ bool ExecuteScript(const char* szScript,
CFXJSE_Value* lpRetValue,
CFXJSE_Value* lpNewThisObject = nullptr);
diff --git a/chromium/third_party/pdfium/fxjs/cfxjse_value.cpp b/chromium/third_party/pdfium/fxjs/cfxjse_value.cpp
index 68c82e5deb3..fb7fe20e21b 100644
--- a/chromium/third_party/pdfium/fxjs/cfxjse_value.cpp
+++ b/chromium/third_party/pdfium/fxjs/cfxjse_value.cpp
@@ -13,8 +13,8 @@
namespace {
-double ftod(FX_FLOAT fNumber) {
- static_assert(sizeof(FX_FLOAT) == 4, "FX_FLOAT of incorrect size");
+double ftod(float fNumber) {
+ static_assert(sizeof(float) == 4, "float of incorrect size");
uint32_t nFloatBits = (uint32_t&)fNumber;
uint8_t nExponent = (uint8_t)(nFloatBits >> 23);
@@ -120,7 +120,7 @@ void CFXJSE_Value::SetDate(double dDouble) {
m_hValue.Reset(m_pIsolate, hDate);
}
-void CFXJSE_Value::SetFloat(FX_FLOAT fFloat) {
+void CFXJSE_Value::SetFloat(float fFloat) {
CFXJSE_ScopeUtil_IsolateHandle scope(m_pIsolate);
v8::Local<v8::Value> pValue = v8::Number::New(m_pIsolate, ftod(fFloat));
m_hValue.Reset(m_pIsolate, pValue);
@@ -442,11 +442,11 @@ bool CFXJSE_Value::ToBoolean() const {
return static_cast<bool>(hValue->BooleanValue());
}
-FX_FLOAT CFXJSE_Value::ToFloat() const {
+float CFXJSE_Value::ToFloat() const {
ASSERT(!m_hValue.IsEmpty());
CFXJSE_ScopeUtil_IsolateHandleRootContext scope(m_pIsolate);
v8::Local<v8::Value> hValue = v8::Local<v8::Value>::New(m_pIsolate, m_hValue);
- return static_cast<FX_FLOAT>(hValue->NumberValue());
+ return static_cast<float>(hValue->NumberValue());
}
double CFXJSE_Value::ToDouble() const {
diff --git a/chromium/third_party/pdfium/fxjs/cfxjse_value.h b/chromium/third_party/pdfium/fxjs/cfxjse_value.h
index f2ebdc1c256..31b751da1e8 100644
--- a/chromium/third_party/pdfium/fxjs/cfxjse_value.h
+++ b/chromium/third_party/pdfium/fxjs/cfxjse_value.h
@@ -35,7 +35,7 @@ class CFXJSE_Value {
bool IsFunction() const;
bool IsDate() const;
bool ToBoolean() const;
- FX_FLOAT ToFloat() const;
+ float ToFloat() const;
double ToDouble() const;
int32_t ToInteger() const;
CFX_ByteString ToString() const;
@@ -50,7 +50,7 @@ class CFXJSE_Value {
void SetInteger(int32_t nInteger);
void SetDouble(double dDouble);
void SetString(const CFX_ByteStringC& szString);
- void SetFloat(FX_FLOAT fFloat);
+ void SetFloat(float fFloat);
void SetJSObject();
void SetObject(CFXJSE_HostObject* lpObject, CFXJSE_Class* pClass);
diff --git a/chromium/third_party/pdfium/fxjs/fxjs_v8.cpp b/chromium/third_party/pdfium/fxjs/fxjs_v8.cpp
index b0e1a1b260b..10aa51395ed 100644
--- a/chromium/third_party/pdfium/fxjs/fxjs_v8.cpp
+++ b/chromium/third_party/pdfium/fxjs/fxjs_v8.cpp
@@ -9,6 +9,7 @@
#include <vector>
#include "core/fxcrt/fx_basic.h"
+#include "third_party/base/allocator/partition_allocator/partition_alloc.h"
// Keep this consistent with the values defined in gin/public/context_holder.h
// (without actually requiring a dependency on gin itself for the standalone
@@ -144,15 +145,24 @@ static v8::Local<v8::ObjectTemplate> GetGlobalObjectTemplate(
}
void* FXJS_ArrayBufferAllocator::Allocate(size_t length) {
- return calloc(1, length);
+ if (length > kMaxAllowedBytes)
+ return nullptr;
+ void* p = AllocateUninitialized(length);
+ if (p)
+ memset(p, 0, length);
+ return p;
}
void* FXJS_ArrayBufferAllocator::AllocateUninitialized(size_t length) {
- return malloc(length);
+ if (length > kMaxAllowedBytes)
+ return nullptr;
+ return pdfium::base::PartitionAllocGeneric(
+ gArrayBufferPartitionAllocator.root(), length, "FXJS_ArrayBuffer");
}
void FXJS_ArrayBufferAllocator::Free(void* data, size_t length) {
- free(data);
+ pdfium::base::PartitionFreeGeneric(gArrayBufferPartitionAllocator.root(),
+ data);
}
void V8TemplateMapTraits::Dispose(v8::Isolate* isolate,
diff --git a/chromium/third_party/pdfium/fxjs/fxjs_v8.h b/chromium/third_party/pdfium/fxjs/fxjs_v8.h
index 50b0b2c6d0b..d44af2f8fab 100644
--- a/chromium/third_party/pdfium/fxjs/fxjs_v8.h
+++ b/chromium/third_party/pdfium/fxjs/fxjs_v8.h
@@ -22,6 +22,7 @@
#include <vector>
#include "core/fxcrt/fx_string.h"
+
#ifdef PDF_ENABLE_XFA
// Header for CFXJSE_RuntimeData. FXJS_V8 doesn't interpret this class,
// it is just passed along to XFA.
@@ -111,6 +112,7 @@ class FXJS_PerIsolateData {
};
class FXJS_ArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
+ static const size_t kMaxAllowedBytes = 0x10000000;
void* Allocate(size_t length) override;
void* AllocateUninitialized(size_t length) override;
void Free(void* data, size_t length) override;
diff --git a/chromium/third_party/pdfium/fxjs/fxjse.h b/chromium/third_party/pdfium/fxjs/fxjse.h
index 069a3b29a3d..a29c0893af9 100644
--- a/chromium/third_party/pdfium/fxjs/fxjse.h
+++ b/chromium/third_party/pdfium/fxjs/fxjse.h
@@ -39,18 +39,18 @@ enum FXJSE_ClassPropTypes {
};
struct FXJSE_FUNCTION_DESCRIPTOR {
- const FX_CHAR* name;
+ const char* name;
FXJSE_FuncCallback callbackProc;
};
struct FXJSE_PROPERTY_DESCRIPTOR {
- const FX_CHAR* name;
+ const char* name;
FXJSE_PropAccessor getProc;
FXJSE_PropAccessor setProc;
};
struct FXJSE_CLASS_DESCRIPTOR {
- const FX_CHAR* name;
+ const char* name;
FXJSE_FuncCallback constructor;
const FXJSE_PROPERTY_DESCRIPTOR* properties;
const FXJSE_FUNCTION_DESCRIPTOR* methods;
diff --git a/chromium/third_party/pdfium/pdfium.gni b/chromium/third_party/pdfium/pdfium.gni
index 8ce09f968d7..5fda06f5f03 100644
--- a/chromium/third_party/pdfium/pdfium.gni
+++ b/chromium/third_party/pdfium/pdfium.gni
@@ -7,9 +7,13 @@ import("//build_overrides/pdfium.gni")
# This file contains PDFium-related build flags.
declare_args() {
- # On Android there's no system FreeType. On Windows and Mac, only a few
- # methods are used from it.
- pdfium_bundle_freetype = !is_linux
+ # Build PDFium either:
+ # 1) When set to true, with a bundled FreeType, built from FreeType source
+ # code in //third_party/freetype and PDFium's FreeType configs in
+ # third_party/freetype/include.
+ # 2) When set to false, use whatever FreeType target is defined in
+ # //build/config/freetype.
+ pdf_bundle_freetype = pdf_bundle_freetype_override
# Build PDFium either with or without v8 support.
pdf_enable_v8 = pdf_enable_v8_override
@@ -29,10 +33,12 @@ declare_args() {
# If XFA, also support png codec. Ignored if not XFA.
pdf_enable_xfa_tiff = true
- # Build PDFium against skia (experimental) rather than agg. Use Skia to draw everything.
+ # Build PDFium against skia (experimental) rather than agg. Use Skia to draw
+ # everything.
pdf_use_skia = pdf_use_skia_override
- # Build PDFium against skia (experimental) rather than agg. Use Skia to draw paths.
+ # Build PDFium against skia (experimental) rather than agg. Use Skia to draw
+ # paths.
pdf_use_skia_paths = pdf_use_skia_paths_override
# Build PDFium with or without experimental win32 GDI APIs.
@@ -41,6 +47,9 @@ declare_args() {
# Build PDFium standalone
pdf_is_standalone = false
+ # Build a complete static library
+ pdf_is_complete_lib = false
+
# Enable coverage information
use_coverage = false
}
diff --git a/chromium/third_party/pdfium/public/cpp/fpdf_deleters.h b/chromium/third_party/pdfium/public/cpp/fpdf_deleters.h
new file mode 100644
index 00000000000..d56daf5c55c
--- /dev/null
+++ b/chromium/third_party/pdfium/public/cpp/fpdf_deleters.h
@@ -0,0 +1,46 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PUBLIC_CPP_FPDF_DELETERS_H_
+#define PUBLIC_CPP_FPDF_DELETERS_H_
+
+#include "public/fpdf_dataavail.h"
+#include "public/fpdf_formfill.h"
+#include "public/fpdf_structtree.h"
+#include "public/fpdf_text.h"
+#include "public/fpdfview.h"
+
+// Custom deleters for using FPDF_* types with std::unique_ptr<>.
+
+struct FPDFAvailDeleter {
+ inline void operator()(FPDF_AVAIL avail) { FPDFAvail_Destroy(avail); }
+};
+
+struct FPDFBitmapDeleter {
+ inline void operator()(FPDF_BITMAP bitmap) { FPDFBitmap_Destroy(bitmap); }
+};
+
+struct FPDFDocumentDeleter {
+ inline void operator()(FPDF_DOCUMENT doc) { FPDF_CloseDocument(doc); }
+};
+
+struct FPDFFormHandleDeleter {
+ inline void operator()(FPDF_FORMHANDLE form) {
+ FPDFDOC_ExitFormFillEnvironment(form);
+ }
+};
+
+struct FPDFTextPageDeleter {
+ inline void operator()(FPDF_TEXTPAGE text) { FPDFText_ClosePage(text); }
+};
+
+struct FPDFPageDeleter {
+ inline void operator()(FPDF_PAGE page) { FPDF_ClosePage(page); }
+};
+
+struct FPDFStructTreeDeleter {
+ inline void operator()(FPDF_STRUCTTREE tree) { FPDF_StructTree_Close(tree); }
+};
+
+#endif // PUBLIC_CPP_FPDF_DELETERS_H_
diff --git a/chromium/third_party/pdfium/public/fpdf_edit.h b/chromium/third_party/pdfium/public/fpdf_edit.h
index 3350b5c6a7a..4d06c2a0c87 100644
--- a/chromium/third_party/pdfium/public/fpdf_edit.h
+++ b/chromium/third_party/pdfium/public/fpdf_edit.h
@@ -21,6 +21,7 @@
#define FPDF_GetAValue(argb) ((uint8_t)((argb) >> 24))
// The page object constants.
+#define FPDF_PAGEOBJ_UNKNOWN 0
#define FPDF_PAGEOBJ_TEXT 1
#define FPDF_PAGEOBJ_PATH 2
#define FPDF_PAGEOBJ_IMAGE 3
@@ -30,6 +31,9 @@
#define FPDF_FILLMODE_ALTERNATE 1
#define FPDF_FILLMODE_WINDING 2
+#define FPDF_FONT_TYPE1 1
+#define FPDF_FONT_TRUETYPE 2
+
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
@@ -132,6 +136,14 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFPage_GenerateContent(FPDF_PAGE page);
DLLEXPORT FPDF_BOOL STDCALL
FPDFPageObj_HasTransparency(FPDF_PAGEOBJECT pageObject);
+// Get type of |pageObject|.
+//
+// pageObject - handle to a page object.
+//
+// Returns one of the FPDF_PAGEOBJ_* values on success, FPDF_PAGEOBJ_UNKNOWN on
+// error.
+DLLEXPORT int STDCALL FPDFPageObj_GetType(FPDF_PAGEOBJECT pageObject);
+
// Transform |pageObject| by the given matrix.
//
// page_object - handle to a page object.
@@ -182,6 +194,15 @@ DLLEXPORT void STDCALL FPDFPage_TransformAnnots(FPDF_PAGE page,
//
// Returns a handle to a new image object.
DLLEXPORT FPDF_PAGEOBJECT STDCALL
+FPDFPageObj_NewImageObj(FPDF_DOCUMENT document);
+
+// Create a new image object.
+// DEPRECATED. Please use FPDFPageObj_NewImageObj() above.
+//
+// document - handle to a document.
+//
+// Returns a handle to a new image object.
+DLLEXPORT FPDF_PAGEOBJECT STDCALL
FPDFPageObj_NewImgeObj(FPDF_DOCUMENT document);
// Load an image from a JPEG image file and then set it into |image_object|.
@@ -322,6 +343,21 @@ DLLEXPORT FPDF_BOOL FPDFPath_SetFillColor(FPDF_PAGEOBJECT path,
unsigned int B,
unsigned int A);
+// Get the fill RGBA of a path. Range of values: 0 - 255.
+//
+// path - the handle to the path object.
+// R - the red component of the path fill color.
+// G - the green component of the path fill color.
+// B - the blue component of the path fill color.
+// A - the fill alpha of the path.
+//
+// Returns TRUE on success.
+DLLEXPORT FPDF_BOOL FPDFPath_GetFillColor(FPDF_PAGEOBJECT path,
+ unsigned int* R,
+ unsigned int* G,
+ unsigned int* B,
+ unsigned int* A);
+
// Move a path's current point.
//
// path - the handle to the path object.
@@ -406,17 +442,22 @@ DLLEXPORT FPDF_PAGEOBJECT STDCALL FPDFPageObj_NewTextObj(FPDF_DOCUMENT document,
DLLEXPORT FPDF_BOOL STDCALL FPDFText_SetText(FPDF_PAGEOBJECT text_object,
FPDF_BYTESTRING text);
-// Returns a type 1 font object loaded from a stream of data. The font is loaded
+// Returns a font object loaded from a stream of data. The font is loaded
// into the document. The caller does not need to free the returned object.
//
-// document - handle to the document.
-// data - the stream of data, which will be copied by the font object.
-// size - size of the stream, in bytes.
+// document - handle to the document.
+// data - the stream of data, which will be copied by the font object.
+// size - size of the stream, in bytes.
+// font_type - FPDF_FONT_TYPE1 or FPDF_FONT_TRUETYPE depending on the font
+// type.
+// cid - a boolean specifying if the font is a CID font or not.
//
// Returns NULL on failure
-DLLEXPORT FPDF_FONT STDCALL FPDFText_LoadType1Font(FPDF_DOCUMENT document,
- const uint8_t* data,
- uint32_t size);
+DLLEXPORT FPDF_FONT STDCALL FPDFText_LoadFont(FPDF_DOCUMENT document,
+ const uint8_t* data,
+ uint32_t size,
+ int font_type,
+ FPDF_BOOL cid);
#ifdef __cplusplus
} // extern "C"
diff --git a/chromium/third_party/pdfium/public/fpdf_searchex.h b/chromium/third_party/pdfium/public/fpdf_searchex.h
index 7c1b31848e7..a795a52394e 100644
--- a/chromium/third_party/pdfium/public/fpdf_searchex.h
+++ b/chromium/third_party/pdfium/public/fpdf_searchex.h
@@ -23,6 +23,15 @@ extern "C" {
DLLEXPORT int STDCALL
FPDFText_GetCharIndexFromTextIndex(FPDF_TEXTPAGE text_page, int nTextIndex);
+// Get the text index in |text_page| internal character list.
+//
+// text_page - a text page information structure.
+// nCharIndex - index of the character in internal character list.
+//
+// Returns the index of the text returned from |FPDFText_GetText|. -1 for error.
+DLLEXPORT int STDCALL
+FPDFText_GetTextIndexFromCharIndex(FPDF_TEXTPAGE text_page, int nCharIndex);
+
#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus
diff --git a/chromium/third_party/pdfium/public/fpdf_structtree.h b/chromium/third_party/pdfium/public/fpdf_structtree.h
index 3d4da402aa5..9cf46cc3065 100644
--- a/chromium/third_party/pdfium/public/fpdf_structtree.h
+++ b/chromium/third_party/pdfium/public/fpdf_structtree.h
@@ -73,6 +73,46 @@ FPDF_StructElement_GetAltText(FPDF_STRUCTELEMENT struct_element,
void* buffer,
unsigned long buflen);
+// Function: FPDF_StructElement_GetType
+// Get the type (/S) for a given element.
+// Parameters:
+// struct_element - Handle to the struct element.
+// buffer - A buffer for output. May be NULL.
+// buflen - The length of the buffer, in bytes. May be 0.
+// Return value:
+// The number of bytes in the type, including the terminating NUL
+// character. The number of bytes is returned regardless of the
+// |buffer| and |buflen| parameters.
+// Comments:
+// Regardless of the platform, the |buffer| is always in UTF-16LE
+// encoding. The string is terminated by a UTF16 NUL character. If
+// |buflen| is less than the required length, or |buffer| is NULL,
+// |buffer| will not be modified.
+DLLEXPORT unsigned long STDCALL
+FPDF_StructElement_GetType(FPDF_STRUCTELEMENT struct_element,
+ void* buffer,
+ unsigned long buflen);
+
+// Function: FPDF_StructElement_GetTitle
+// Get the title (/T) for a given element.
+// Parameters:
+// struct_element - Handle to the struct element.
+// buffer - A buffer for output. May be NULL.
+// buflen - The length of the buffer, in bytes. May be 0.
+// Return value:
+// The number of bytes in the title, including the terminating NUL
+// character. The number of bytes is returned regardless of the
+// |buffer| and |buflen| parameters.
+// Comments:
+// Regardless of the platform, the |buffer| is always in UTF-16LE
+// encoding. The string is terminated by a UTF16 NUL character. If
+// |buflen| is less than the required length, or |buffer| is NULL,
+// |buffer| will not be modified.
+DLLEXPORT unsigned long STDCALL
+FPDF_StructElement_GetTitle(FPDF_STRUCTELEMENT struct_element,
+ void* buffer,
+ unsigned long buflen);
+
// Function: FPDF_StructElement_CountChildren
// Count the number of children for the structure element.
// Parameters:
@@ -97,7 +137,7 @@ FPDF_StructElement_GetChildAtIndex(FPDF_STRUCTELEMENT struct_element,
int index);
#ifdef __cplusplus
-}
+} // extern "C"
#endif
#endif // PUBLIC_FPDF_STRUCTTREE_H_
diff --git a/chromium/third_party/pdfium/public/fpdfview.h b/chromium/third_party/pdfium/public/fpdfview.h
index 1c47a366bd0..0ed9187f35f 100644
--- a/chromium/third_party/pdfium/public/fpdfview.h
+++ b/chromium/third_party/pdfium/public/fpdfview.h
@@ -26,17 +26,13 @@ typedef void* FPDF_BITMAP;
typedef void* FPDF_BOOKMARK;
typedef void* FPDF_CLIPPATH;
typedef void* FPDF_DEST;
-typedef void* FPDF_DOCSCHHANDLE;
typedef void* FPDF_DOCUMENT;
typedef void* FPDF_FONT;
-typedef void* FPDF_HMODULE;
typedef void* FPDF_LINK;
-typedef void* FPDF_MODULEMGR;
typedef void* FPDF_PAGE;
typedef void* FPDF_PAGELINK;
typedef void* FPDF_PAGEOBJECT; // Page object(text, path, etc)
typedef void* FPDF_PAGERANGE;
-typedef void* FPDF_PATH;
typedef void* FPDF_RECORDER;
typedef void* FPDF_SCHHANDLE;
typedef void* FPDF_STRUCTELEMENT;
diff --git a/chromium/third_party/pdfium/samples/BUILD.gn b/chromium/third_party/pdfium/samples/BUILD.gn
index 23f4d0ca56a..d658a33cf8f 100644
--- a/chromium/third_party/pdfium/samples/BUILD.gn
+++ b/chromium/third_party/pdfium/samples/BUILD.gn
@@ -55,11 +55,6 @@ executable("pdfium_test") {
"../:test_support",
"//build/config/sanitizers:deps",
"//build/win:default_exe_manifest",
-
- # Regardless of whether the library ships against system freetype,
- # always link this binary against the bundled one for consistency
- # of results across platforms.
- "../third_party:fx_freetype",
]
if (!pdf_enable_xfa) {
deps += [ "../third_party:fx_lpng" ]
diff --git a/chromium/third_party/pdfium/samples/DEPS b/chromium/third_party/pdfium/samples/DEPS
index 4a926a7cf22..fb322dee20f 100644
--- a/chromium/third_party/pdfium/samples/DEPS
+++ b/chromium/third_party/pdfium/samples/DEPS
@@ -2,7 +2,7 @@ include_rules = [
'+public',
'+third_party/libpng16',
'+third_party/skia/include',
- '+third_party/zlib_v128',
+ '+third_party/zlib',
'+v8',
'+core/fdrm/crypto/fx_crypt.h',
]
diff --git a/chromium/third_party/pdfium/samples/image_diff_png.cc b/chromium/third_party/pdfium/samples/image_diff_png.cc
index 18753e25804..3d12b7e948a 100644
--- a/chromium/third_party/pdfium/samples/image_diff_png.cc
+++ b/chromium/third_party/pdfium/samples/image_diff_png.cc
@@ -18,7 +18,7 @@
#include "third_party/base/logging.h"
#include "third_party/libpng16/png.h"
-#include "third_party/zlib_v128/zlib.h"
+#include "third_party/zlib/zlib.h"
namespace image_diff_png {
diff --git a/chromium/third_party/pdfium/samples/pdfium_test.cc b/chromium/third_party/pdfium/samples/pdfium_test.cc
index a0afd4d09c3..d2b3c011963 100644
--- a/chromium/third_party/pdfium/samples/pdfium_test.cc
+++ b/chromium/third_party/pdfium/samples/pdfium_test.cc
@@ -18,10 +18,12 @@
#endif
#include "core/fdrm/crypto/fx_crypt.h"
+#include "public/cpp/fpdf_deleters.h"
#include "public/fpdf_dataavail.h"
#include "public/fpdf_edit.h"
#include "public/fpdf_ext.h"
#include "public/fpdf_formfill.h"
+#include "public/fpdf_structtree.h"
#include "public/fpdf_text.h"
#include "public/fpdfview.h"
#include "samples/image_diff_png.h"
@@ -51,6 +53,7 @@
enum OutputFormat {
OUTPUT_NONE,
+ OUTPUT_STRUCTURE,
OUTPUT_TEXT,
OUTPUT_PPM,
OUTPUT_PNG,
@@ -95,10 +98,6 @@ struct FPDF_FORMFILLINFO_PDFiumTest : public FPDF_FORMFILLINFO {
FPDF_FORMHANDLE form_handle;
};
-struct AvailDeleter {
- inline void operator()(FPDF_AVAIL avail) const { FPDFAvail_Destroy(avail); }
-};
-
static FPDF_FORMFILLINFO_PDFiumTest* ToPDFiumTestFormFillInfo(
FPDF_FORMFILLINFO* form_fill_info) {
return static_cast<FPDF_FORMFILLINFO_PDFiumTest*>(form_fill_info);
@@ -184,14 +183,11 @@ void WriteText(FPDF_PAGE page, const char* pdf_name, int num) {
uint32_t bom = 0x0000FEFF;
fwrite(&bom, sizeof(bom), 1, fp);
- FPDF_TEXTPAGE textpage = FPDFText_LoadPage(page);
- for (int i = 0; i < FPDFText_CountChars(textpage); i++) {
- uint32_t c = FPDFText_GetUnicode(textpage, i);
+ std::unique_ptr<void, FPDFTextPageDeleter> textpage(FPDFText_LoadPage(page));
+ for (int i = 0; i < FPDFText_CountChars(textpage.get()); i++) {
+ uint32_t c = FPDFText_GetUnicode(textpage.get(), i);
fwrite(&c, sizeof(c), 1, fp);
}
-
- FPDFText_ClosePage(textpage);
-
(void)fclose(fp);
}
@@ -504,6 +500,12 @@ bool ParseCommandLine(const std::vector<std::string>& args,
return false;
}
options->scale_factor_as_string = cur_arg.substr(8);
+ } else if (cur_arg == "--show-structure") {
+ if (options->output_format != OUTPUT_NONE) {
+ fprintf(stderr, "Duplicate or conflicting --show-structure argument\n");
+ return false;
+ }
+ options->output_format = OUTPUT_STRUCTURE;
} else if (cur_arg.size() > 8 && cur_arg.compare(0, 8, "--pages=") == 0) {
if (options->pages) {
fprintf(stderr, "Duplicate --pages argument\n");
@@ -609,7 +611,6 @@ FPDF_PAGE GetPageForIndex(FPDF_FORMFILLINFO* param,
FPDF_FORMFILLINFO_PDFiumTest* form_fill_info =
ToPDFiumTestFormFillInfo(param);
auto& loaded_pages = form_fill_info->loaded_pages;
-
auto iter = loaded_pages.find(index);
if (iter != loaded_pages.end())
return iter->second;
@@ -619,47 +620,110 @@ FPDF_PAGE GetPageForIndex(FPDF_FORMFILLINFO* param,
return nullptr;
FPDF_FORMHANDLE& form_handle = form_fill_info->form_handle;
-
FORM_OnAfterLoadPage(page, form_handle);
FORM_DoPageAAction(page, form_handle, FPDFPAGE_AACTION_OPEN);
-
loaded_pages[index] = page;
return page;
}
+std::wstring ConvertToWString(const unsigned short* buf,
+ unsigned long buf_size) {
+ std::wstring result;
+ result.reserve(buf_size);
+ std::copy(buf, buf + buf_size, std::back_inserter(result));
+ return result;
+}
+
+void DumpChildStructure(FPDF_STRUCTELEMENT child, int indent) {
+ static const size_t kBufSize = 1024;
+ unsigned short buf[kBufSize];
+ unsigned long len = FPDF_StructElement_GetType(child, buf, kBufSize);
+ printf("%*s%ls", indent * 2, "", ConvertToWString(buf, len).c_str());
+
+ memset(buf, 0, sizeof(buf));
+ len = FPDF_StructElement_GetTitle(child, buf, kBufSize);
+ if (len > 0)
+ printf(": '%ls'", ConvertToWString(buf, len).c_str());
+
+ memset(buf, 0, sizeof(buf));
+ len = FPDF_StructElement_GetAltText(child, buf, kBufSize);
+ if (len > 0)
+ printf(" (%ls)", ConvertToWString(buf, len).c_str());
+ printf("\n");
+
+ for (int i = 0; i < FPDF_StructElement_CountChildren(child); ++i) {
+ FPDF_STRUCTELEMENT sub_child = FPDF_StructElement_GetChildAtIndex(child, i);
+ // If the child is not an Element then this will return null. This can
+ // happen if the element is things like an object reference or a stream.
+ if (!sub_child)
+ continue;
+
+ DumpChildStructure(sub_child, indent + 1);
+ }
+}
+
+void DumpPageStructure(FPDF_PAGE page, const int page_idx) {
+ std::unique_ptr<void, FPDFStructTreeDeleter> tree(
+ FPDF_StructTree_GetForPage(page));
+ if (!tree) {
+ fprintf(stderr, "Failed to load struct tree for page %d\n", page_idx);
+ return;
+ }
+
+ printf("Structure Tree for Page %d\n", page_idx);
+ for (int i = 0; i < FPDF_StructTree_CountChildren(tree.get()); ++i) {
+ FPDF_STRUCTELEMENT child = FPDF_StructTree_GetChildAtIndex(tree.get(), i);
+ if (!child) {
+ fprintf(stderr, "Failed to load child %d for page %d\n", i, page_idx);
+ continue;
+ }
+ DumpChildStructure(child, 0);
+ }
+ printf("\n\n");
+}
+
bool RenderPage(const std::string& name,
FPDF_DOCUMENT doc,
- FPDF_FORMHANDLE& form,
+ FPDF_FORMHANDLE form,
FPDF_FORMFILLINFO_PDFiumTest& form_fill_info,
const int page_index,
const Options& options,
const std::string& events) {
- FPDF_PAGE page = GetPageForIndex(&form_fill_info, doc, page_index);
- if (!page)
+ std::unique_ptr<void, FPDFPageDeleter> page(
+ GetPageForIndex(&form_fill_info, doc, page_index));
+ if (!page.get())
return false;
-
- FPDF_TEXTPAGE text_page = FPDFText_LoadPage(page);
-
if (options.send_events)
- SendPageEvents(form, page, events);
+ SendPageEvents(form, page.get(), events);
+ if (options.output_format == OUTPUT_STRUCTURE) {
+ DumpPageStructure(page.get(), page_index);
+ return true;
+ }
+
+ std::unique_ptr<void, FPDFTextPageDeleter> text_page(
+ FPDFText_LoadPage(page.get()));
double scale = 1.0;
if (!options.scale_factor_as_string.empty())
std::stringstream(options.scale_factor_as_string) >> scale;
- int width = static_cast<int>(FPDF_GetPageWidth(page) * scale);
- int height = static_cast<int>(FPDF_GetPageHeight(page) * scale);
- int alpha = FPDFPage_HasTransparency(page) ? 1 : 0;
- FPDF_BITMAP bitmap = FPDFBitmap_Create(width, height, alpha);
+ int width = static_cast<int>(FPDF_GetPageWidth(page.get()) * scale);
+ int height = static_cast<int>(FPDF_GetPageHeight(page.get()) * scale);
+ int alpha = FPDFPage_HasTransparency(page.get()) ? 1 : 0;
+ std::unique_ptr<void, FPDFBitmapDeleter> bitmap(
+ FPDFBitmap_Create(width, height, alpha));
+
if (bitmap) {
FPDF_DWORD fill_color = alpha ? 0x00000000 : 0xFFFFFFFF;
- FPDFBitmap_FillRect(bitmap, 0, 0, width, height, fill_color);
- FPDF_RenderPageBitmap(bitmap, page, 0, 0, width, height, 0, FPDF_ANNOT);
+ FPDFBitmap_FillRect(bitmap.get(), 0, 0, width, height, fill_color);
+ FPDF_RenderPageBitmap(bitmap.get(), page.get(), 0, 0, width, height, 0,
+ FPDF_ANNOT);
- FPDF_FFLDraw(form, bitmap, page, 0, 0, width, height, 0, FPDF_ANNOT);
- int stride = FPDFBitmap_GetStride(bitmap);
+ FPDF_FFLDraw(form, bitmap.get(), page.get(), 0, 0, width, height, 0,
+ FPDF_ANNOT);
+ int stride = FPDFBitmap_GetStride(bitmap.get());
const char* buffer =
- reinterpret_cast<const char*>(FPDFBitmap_GetBuffer(bitmap));
+ reinterpret_cast<const char*>(FPDFBitmap_GetBuffer(bitmap.get()));
std::string&& image_file_name = "";
switch (options.output_format) {
@@ -670,11 +734,11 @@ bool RenderPage(const std::string& name,
break;
case OUTPUT_EMF:
- WriteEmf(page, name.c_str(), page_index);
+ WriteEmf(page.get(), name.c_str(), page_index);
break;
#endif
case OUTPUT_TEXT:
- WriteText(page, name.c_str(), page_index);
+ WriteText(page.get(), name.c_str(), page_index);
break;
case OUTPUT_PNG:
@@ -691,8 +755,9 @@ bool RenderPage(const std::string& name,
case OUTPUT_SKP: {
std::unique_ptr<SkPictureRecorder> recorder(
reinterpret_cast<SkPictureRecorder*>(
- FPDF_RenderPageSkp(page, width, height)));
- FPDF_FFLRecord(form, recorder.get(), page, 0, 0, width, height, 0, 0);
+ FPDF_RenderPageSkp(page.get(), width, height)));
+ FPDF_FFLRecord(form, recorder.get(), page.get(), 0, 0, width, height, 0,
+ 0);
image_file_name = WriteSkp(name.c_str(), page_index, recorder.get());
} break;
#endif
@@ -704,18 +769,13 @@ bool RenderPage(const std::string& name,
// file.
if (options.md5 && image_file_name != "")
OutputMD5Hash(image_file_name.c_str(), buffer, stride * height);
-
- FPDFBitmap_Destroy(bitmap);
} else {
fprintf(stderr, "Page was too large to be rendered.\n");
}
form_fill_info.loaded_pages.erase(page_index);
-
- FORM_DoPageAAction(page, form, FPDFPAGE_AACTION_CLOSE);
- FORM_OnBeforeClosePage(page, form);
- FPDFText_ClosePage(text_page);
- FPDF_ClosePage(page);
+ FORM_DoPageAAction(page.get(), form, FPDFPAGE_AACTION_CLOSE);
+ FORM_OnBeforeClosePage(page.get(), form);
return !!bitmap;
}
@@ -758,35 +818,33 @@ void RenderPdf(const std::string& name,
hints.version = 1;
hints.AddSegment = Add_Segment;
- FPDF_DOCUMENT doc;
int nRet = PDF_DATA_NOTAVAIL;
bool bIsLinearized = false;
- FPDF_AVAIL pdf_avail = FPDFAvail_Create(&file_avail, &file_access);
- std::unique_ptr<void, AvailDeleter> scoped_pdf_avail_deleter(pdf_avail);
+ std::unique_ptr<void, FPDFDocumentDeleter> doc;
+ std::unique_ptr<void, FPDFAvailDeleter> pdf_avail(
+ FPDFAvail_Create(&file_avail, &file_access));
- if (FPDFAvail_IsLinearized(pdf_avail) == PDF_LINEARIZED) {
- doc = FPDFAvail_GetDocument(pdf_avail, nullptr);
+ if (FPDFAvail_IsLinearized(pdf_avail.get()) == PDF_LINEARIZED) {
+ doc.reset(FPDFAvail_GetDocument(pdf_avail.get(), nullptr));
if (doc) {
while (nRet == PDF_DATA_NOTAVAIL)
- nRet = FPDFAvail_IsDocAvail(pdf_avail, &hints);
+ nRet = FPDFAvail_IsDocAvail(pdf_avail.get(), &hints);
if (nRet == PDF_DATA_ERROR) {
fprintf(stderr, "Unknown error in checking if doc was available.\n");
- FPDF_CloseDocument(doc);
return;
}
- nRet = FPDFAvail_IsFormAvail(pdf_avail, &hints);
+ nRet = FPDFAvail_IsFormAvail(pdf_avail.get(), &hints);
if (nRet == PDF_FORM_ERROR || nRet == PDF_FORM_NOTAVAIL) {
fprintf(stderr,
"Error %d was returned in checking if form was available.\n",
nRet);
- FPDF_CloseDocument(doc);
return;
}
bIsLinearized = true;
}
} else {
- doc = FPDF_LoadCustomDocument(&file_access, nullptr);
+ doc.reset(FPDF_LoadCustomDocument(&file_access, nullptr));
}
if (!doc) {
@@ -818,29 +876,29 @@ void RenderPdf(const std::string& name,
fprintf(stderr, "Unknown error %ld", err);
}
fprintf(stderr, ".\n");
-
return;
}
- (void)FPDF_GetDocPermissions(doc);
+ (void)FPDF_GetDocPermissions(doc.get());
- FPDF_FORMHANDLE form = FPDFDOC_InitFormFillEnvironment(doc, &form_callbacks);
- form_callbacks.form_handle = form;
+ std::unique_ptr<void, FPDFFormHandleDeleter> form(
+ FPDFDOC_InitFormFillEnvironment(doc.get(), &form_callbacks));
+ form_callbacks.form_handle = form.get();
#ifdef PDF_ENABLE_XFA
int doc_type = DOCTYPE_PDF;
- if (FPDF_HasXFAField(doc, &doc_type) && doc_type != DOCTYPE_PDF &&
- !FPDF_LoadXFA(doc)) {
+ if (FPDF_HasXFAField(doc.get(), &doc_type) && doc_type != DOCTYPE_PDF &&
+ !FPDF_LoadXFA(doc.get())) {
fprintf(stderr, "LoadXFA unsuccessful, continuing anyway.\n");
}
#endif // PDF_ENABLE_XFA
- FPDF_SetFormFieldHighlightColor(form, 0, 0xFFE4DD);
- FPDF_SetFormFieldHighlightAlpha(form, 100);
- FORM_DoDocumentJSAction(form);
- FORM_DoDocumentOpenAction(form);
+ FPDF_SetFormFieldHighlightColor(form.get(), 0, 0xFFE4DD);
+ FPDF_SetFormFieldHighlightAlpha(form.get(), 100);
+ FORM_DoDocumentJSAction(form.get());
+ FORM_DoDocumentOpenAction(form.get());
- int page_count = FPDF_GetPageCount(doc);
+ int page_count = FPDF_GetPageCount(doc.get());
int rendered_pages = 0;
int bad_pages = 0;
int first_page = options.pages ? options.first_page : 0;
@@ -849,27 +907,22 @@ void RenderPdf(const std::string& name,
if (bIsLinearized) {
nRet = PDF_DATA_NOTAVAIL;
while (nRet == PDF_DATA_NOTAVAIL)
- nRet = FPDFAvail_IsPageAvail(pdf_avail, i, &hints);
+ nRet = FPDFAvail_IsPageAvail(pdf_avail.get(), i, &hints);
if (nRet == PDF_DATA_ERROR) {
fprintf(stderr, "Unknown error in checking if page %d is available.\n",
i);
- FPDFDOC_ExitFormFillEnvironment(form);
- FPDF_CloseDocument(doc);
return;
}
}
- if (RenderPage(name, doc, form, form_callbacks, i, options, events))
+ if (RenderPage(name, doc.get(), form.get(), form_callbacks, i, options,
+ events))
++rendered_pages;
else
++bad_pages;
}
- FORM_DoDocumentAAction(form, FPDFDOC_AACTION_WC);
-
- FPDFDOC_ExitFormFillEnvironment(form);
- FPDF_CloseDocument(doc);
-
+ FORM_DoDocumentAAction(form.get(), FPDFDOC_AACTION_WC);
fprintf(stderr, "Rendered %d pages.\n", rendered_pages);
if (bad_pages)
fprintf(stderr, "Skipped %d bad pages.\n", bad_pages);
@@ -904,6 +957,7 @@ static void ShowConfig() {
static const char kUsageString[] =
"Usage: pdfium_test [OPTION] [FILE]...\n"
" --show-config - print build options and exit\n"
+ " --show-structure - print the structure elements from the document\n"
" --send-events - send input described by .evt file\n"
" --bin-dir=<path> - override path to v8 external data\n"
" --font-dir=<path> - override path to external fonts\n"
diff --git a/chromium/third_party/pdfium/skia/BUILD.gn b/chromium/third_party/pdfium/skia/BUILD.gn
index 723e872b0dc..31a851d5764 100644
--- a/chromium/third_party/pdfium/skia/BUILD.gn
+++ b/chromium/third_party/pdfium/skia/BUILD.gn
@@ -33,13 +33,21 @@ config("skia_config") {
"//third_party/skia/include/pipe",
"//third_party/skia/include/ports",
"//third_party/skia/include/utils",
-
- # TODO(dsinclair): Right way to use //third_party/freetype?
- "//third_party/freetype/include",
]
defines = []
+ if (is_win) {
+ defines += [ "SK_FREETYPE_MINIMUM_RUNTIME_VERSION=(((FREETYPE_MAJOR) * 0x01000000) | ((FREETYPE_MINOR) * 0x00010000) | ((FREETYPE_PATCH) * 0x00000100))" ]
+ }
+
+ if (is_component_build) {
+ defines += [
+ "SKIA_DLL",
+ "GR_GL_IGNORE_ES3_MSAA=0",
+ ]
+ }
+
if (skia_support_gpu) {
include_dirs += [
"//third_party/skia/include/gpu",
@@ -93,6 +101,10 @@ config("skia_library_config") {
defines = []
+ if (is_component_build) {
+ defines += [ "SKIA_IMPLEMENTATION=1" ]
+ }
+
if (current_cpu == "arm") {
if (arm_use_neon) {
defines += [ "SK_ARM_HAS_NEON" ]
@@ -225,12 +237,10 @@ component("skia") {
# Remove unused util files include in utils.gypi
sources -= [
- "//third_party/skia/src/utils/SkBoundaryPatch.cpp",
"//third_party/skia/src/utils/SkCamera.cpp",
"//third_party/skia/src/utils/SkDumpCanvas.cpp",
"//third_party/skia/src/utils/SkFrontBufferedStream.cpp",
"//third_party/skia/src/utils/SkInterpolator.cpp",
- "//third_party/skia/src/utils/SkMeshUtils.cpp",
"//third_party/skia/src/utils/SkParsePath.cpp",
]
@@ -306,7 +316,8 @@ component("skia") {
deps = [
":skia_opts",
- "../third_party:fx_zlib",
+ "//:freetype_common",
+ "//third_party/zlib:zlib",
]
if (is_linux) {
diff --git a/chromium/third_party/pdfium/testing/SUPPRESSIONS b/chromium/third_party/pdfium/testing/SUPPRESSIONS
index 447c9fa529b..bccf0d6bd6e 100644
--- a/chromium/third_party/pdfium/testing/SUPPRESSIONS
+++ b/chromium/third_party/pdfium/testing/SUPPRESSIONS
@@ -19,11 +19,6 @@
# Try to keep the file alphabetized within each category of test.
#
-# Pixel tests
-#
-font_size.in mac * *
-
-#
# Corpus tests
#
050_extra_m.pdf mac,win * *
@@ -50,219 +45,28 @@ font_size.in mac * *
8.2_name_dest_f_dest.pdf mac * *
8.2_outline.pdf mac * *
8.3_presentation.pdf mac * *
-FRC_10_8.2.2_Prev_remove_all.pdf mac * *
FRC_10_8.2.2__T8.3_original_file.pdf * * *
-FRC_10_8.2.4_View_C.pdf mac * *
-FRC_10_8.2.4__remove_ModDate_value.pdf mac * *
-FRC_11_8.2.2_Prev_remove_obj.pdf mac * *
FRC_11_8.2.2__T8.3_first_last_exchange.pdf * * *
-FRC_11_8.2.4_View_edit.pdf mac * *
-FRC_11_8.2.4__remove_ModDate_all.pdf mac * *
-FRC_12_8.2.2__Next_remove_value.pdf mac * *
FRC_12_8.2.2__T8.3_first_outline_obj_ID.pdf * * *
-FRC_12_8.2.4_View_remove_all.pdf mac * *
-FRC_12_8.2.4__remove_ModDate_obj_.pdf mac * *
-FRC_13_8.2.2__Next_remove_all.pdf mac * *
FRC_13_8.2.2__T8.3_Count_edit300.pdf * * *
-FRC_13_8.2.4_View_remove_value.pdf mac * *
-FRC_13_8.2.4_remove_Size_value.pdf mac * *
-FRC_14_8.2.2__Next_remove_obj.pdf mac * *
FRC_14_8.2.2__T8.3_Count_edit0.pdf * * *
-FRC_14_8.2.4_Sort_remove_all.pdf mac * *
-FRC_14_8.2.4_remove_Size_all.pdf mac * *
-FRC_15_8.2.2__Next_exchange.pdf mac * *
FRC_15_8.2.2__T8.3_Count_edit1.pdf * * *
-FRC_15_8.2.4_Sort_remove_value.pdf mac * *
-FRC_15_8.2.4_remove_Size_obj.pdf mac * *
-FRC_16_8.2.2__Next_add.pdf mac * *
FRC_16_8.2.2__T8.3_Count_edit_1.pdf * * *
-FRC_16_8.2.4__remove_CompressedSize__value.pdf mac * *
-FRC_17_8.2.2__T8.4_First_remove_value.pdf mac * *
-FRC_17_8.2.4__remove_CompressedSize__all.pdf mac * *
-FRC_18_8.2.2__T8.4_First_remove_all.pdf mac * *
-FRC_18_8.2.4__remove_CompressedSize__obj.pdf mac * *
-FRC_19_8.2.2__T8.4_First_remove_obj.pdf mac * *
-FRC_19_8.2.4__remove_CreationDate_value.pdf mac * *
FRC_1_8.2.2__T8.3_First_empty.pdf * * *
-FRC_1_8.2.2__Title_edit.pdf mac * *
-FRC_1_8.2.4_Type_8.6_.pdf mac * *
-FRC_1_8.2.4__original.pdf mac * *
-FRC_20_8.2.2__T8.4_First_remove_value2.pdf mac * *
-FRC_20_8.2.4__remove_CreationDate_all.pdf mac * *
-FRC_21_8.2.2__T8.4_First_remove_all2.pdf mac * *
-FRC_21_8.2.4__remove_CreationDate_obj.pdf mac * *
-FRC_22_8.2.2__T8.4_First_remove_obj2.pdf mac * *
-FRC_22_8.2.4__remove_Order_value.pdf mac * *
-FRC_23_8.2.2__T8.4_Last_remove_value.pdf mac * *
-FRC_23_8.2.4__remove_Order_all.pdf mac * *
-FRC_24_8.2.2__T8.4_Last_remove_all.pdf mac * *
-FRC_24_8.2.4__remove_Order_obj.pdf mac * *
-FRC_25_8.2.2__T8.4_Last_remove_obj.pdf mac * *
-FRC_26_8.2.2__T8.4_Last_remove_value2.pdf mac * *
-FRC_27_8.2.2__T8.4_Last_remove_all2.pdf mac * *
-FRC_28_8.2.2__T8.4_Last_remove_obj2.pdf mac * *
-FRC_29_8.2.2__T8.4_First_Last_exchange.pdf mac * *
FRC_2_8.2.2__T8.3_Last_empty.pdf * * *
-FRC_2_8.2.2__Title_remove_value.pdf mac * *
-FRC_2_8.2.4_Type_8.6__remove_value.pdf mac * *
-FRC_2_8.2.4__add_type_.pdf mac * *
-FRC_3.5_AuthEvent_EFOpen.pdf mac * *
-FRC_3.5_CFM_AESV2__EncryptMetadata_F.pdf mac * *
-FRC_3.5_CF_EFF_StdCF_Strf_Stmf_Identity.pdf mac * *
-FRC_3.5_CF_Strf_stmf_StdCF.pdf mac * *
-FRC_3.5_EncryptMetadata_None.pdf mac * *
-FRC_3.5_P_4_Password_1.pdf mac * *
-FRC_3.5_P__1852_Password_1.pdf mac * *
-FRC_3.5_P__2584_Password_1.pdf mac * *
-FRC_3.5_P__2616_Password_1.pdf mac * *
-FRC_3.5_P__2880_Password_1.pdf mac * *
-FRC_3.5_P__3376_Password_1.pdf mac * *
-FRC_3.5_P__3392_Password_1.pdf mac * *
-FRC_3.5_P__3608_Password_1.pdf mac * *
FRC_3.5_P__3616_Password_1.pdf mac,win * *
-FRC_3.5_P__3648_Password_1.pdf mac * *
-FRC_3.5_P__3900_Password_1.pdf mac * *
-FRC_3.5_V_4_CFM_V2_.pdf mac * *
-FRC_3.5_V_5_CFM_AESV3.pdf mac * *
-FRC_3.5_v_1_length_40_Filter_standard.pdf mac * *
-FRC_3.5_v_2_length_128_AuthEvent_DocOpen_.pdf mac * *
-FRC_31_8.2.2_add_dest_entry.pdf mac * *
-FRC_32_8.2.2_A_Support_action.pdf mac * *
-FRC_33_8.2.2_A_empty.pdf mac * *
-FRC_34_8.2.2_A_remove.pdf mac * *
-FRC_35_8.2.2_A_remove_A_item.pdf mac * *
-FRC_36_8.2.2_Dest.pdf mac * *
-FRC_37_8.2.2_Dest_empty.pdf mac * *
-FRC_38_8.2.2_Dest_remove.pdf mac * *
-FRC_39_8.2.2_C_edit.pdf mac * *
FRC_3_8.2.2_Type_empty.pdf * * *
-FRC_3_8.2.2__Title_remove_all.pdf mac * *
-FRC_3_8.2.4_Type_8.6__edit_.pdf mac * *
-FRC_3_8.2.4__add_type_value.pdf mac * *
-FRC_4.5.3_DeviceCMYK_k.pdf mac * *
-FRC_4.5.3_DeviceGray_g.pdf mac * *
-FRC_4.5.3_DeviceRGB_rg.pdf mac * *
-FRC_4.5.4_CalGray_gamma.pdf mac * *
-FRC_4.5.4_CalGray_whitepoint.pdf mac * *
-FRC_4.5.4_CalRGB_gamma.pdf mac * *
-FRC_4.5.4_CalRGB_matrix.pdf mac * *
-FRC_4.5.4_CalRGB_whitepoint.pdf mac * *
-FRC_4.5.4_ICCBased.pdf mac * *
-FRC_4.5.4_Lab.pdf mac * *
-FRC_4.5.4_RI_Absolute.pdf mac * *
-FRC_4.5.4_RI_Perceptual.pdf mac * *
-FRC_4.5.4_RI_Relative.pdf mac * *
-FRC_4.5.4_RI_Saturation.pdf mac * *
-FRC_4.5.4_Separation.pdf mac * *
-FRC_4.5.5_DeviceN.pdf mac * *
-FRC_4.5.5_Indexed.pdf mac * *
-FRC_4.5.5_Pattern_tiling.pdf mac * *
-FRC_40_8.2.2_C_empty1.pdf mac * *
-FRC_41_8.2.2_C_empty2.pdf mac * *
-FRC_42_8.2.2_C_empty3.pdf mac * *
-FRC_43_8.2.2_C_empty.pdf mac * *
-FRC_44_8.2.2_C_remove.pdf mac * *
-FRC_45_8.2.2_F_edit_F_1_2_3.pdf mac * *
-FRC_46_8.2.2_F_edit_F__1__2__3.pdf mac * *
-FRC_47_8.2.2_F_edit_F_32__32.pdf mac * *
-FRC_48_8.2.2_F_edit_F_100__100.pdf mac * *
-FRC_49_8.2.2_F_empty.pdf mac * *
-FRC_4_8.2.2_Parent_edit2.pdf mac * *
FRC_4_8.2.2__T8.3_Count_empty.pdf * * *
-FRC_4_8.2.4_Schema_8.6__remove_all.pdf mac * *
-FRC_4_8.2.4__remove_FileName_value.pdf mac * *
-FRC_50_8.2.2_F_remove.pdf mac * *
-FRC_51_8.2.2_T_8.4__Count_edit_count_100.pdf mac * *
-FRC_52_8.2.2_T_8.4__Count_edit_count_0.pdf mac * *
-FRC_53_8.2.2_T_8.4__Count_empty.pdf mac * *
-FRC_54_8.2.2_T_8.4__Count_empty1.pdf mac * *
-FRC_55_8.2.2_T_8.4__Count_remove.pdf mac * *
-FRC_56_8.2.2_C_edit_C__1.pdf mac * *
-FRC_57_8.2.2_C_edit_C_2.pdf mac * *
-FRC_58_8.2.2_Count_edit_count__2.pdf mac * *
-FRC_5_8.2.2_Parent_remove_value.pdf mac * *
FRC_5_8.2.2__T8.3_First_remove.pdf * * *
-FRC_5_8.2.4_Schema_8.6__remove_value.pdf mac * *
-FRC_5_8.2.4__remove_FileName_all.pdf mac * *
-FRC_6_8.2.2_Parent_remove_all.pdf mac * *
FRC_6_8.2.2__T8.3_Last_remove.pdf * * *
-FRC_6_8.2.4_Schema_8.6__remove_obj.pdf mac * *
-FRC_6_8.2.4__remove_FileName_obj.pdf mac * *
-FRC_7_8.2.2_Parent_remove_obj.pdf mac * *
FRC_7_8.2.2_Type_remove.pdf * * *
-FRC_7_8.2.4_View_H.pdf mac * *
-FRC_7_8.2.4__remove_Description_value.pdf mac * *
-FRC_8.4.1_Annotations_AP_N_.pdf mac * *
-FRC_8.4.1_Annotations_AP_N_R.D_.pdf mac * *
-FRC_8.4.1_Annotations_AP_N_R_.pdf mac * *
-FRC_8.4.1_Annotations_AS_Off_.pdf mac * *
-FRC_8.4.1_Annotations_AS_Yes_.pdf mac * *
-FRC_8.4.1_Annotations_Border.pdf mac * *
-FRC_8.4.1_Annotations_C.pdf mac * *
FRC_8.4.1_Annotations_M.pdf * * *
-FRC_8.4.1_Annotations_M_text_string_.pdf mac * *
FRC_8.4.1_Annotations_NM.pdf * * *
-FRC_8.4.1_Annotations_P.pdf mac * *
-FRC_8.4.1_Annotations_Rect.pdf mac * *
-FRC_8.4.1_Annotations_Type.pdf mac * *
-FRC_8.4.2_Annotation_Flags_F_Hidden.pdf mac * *
-FRC_8.4.2_Annotation_Flags_F_Invisible.pdf mac * *
-FRC_8.4.2_Annotation_Flags_F_Locked.pdf mac * *
-FRC_8.4.2_Annotation_Flags_F_LockedContents.pdf mac * *
-FRC_8.4.2_Annotation_Flags_F_NoRotate.pdf mac * *
-FRC_8.4.2_Annotation_Flags_F_NoView.pdf mac * *
-FRC_8.4.2_Annotation_Flags_F_NoZoom.pdf mac * *
-FRC_8.4.2_Annotation_Flags_F_Print.pdf mac * *
-FRC_8.4.2_Annotation_Flags_F_ReadOnly.pdf mac * *
-FRC_8.4.2_Annotation_Flags_F_ToggleNoView.pdf mac * *
-FRC_8.4.3_Border_Stypes_D_different_values.pdf mac * *
-FRC_8.4.3_Border_Stypes_D_remove.pdf mac * *
-FRC_8.4.3_Border_Stypes_I_different_values.pdf mac * *
-FRC_8.4.3_Border_Stypes_I_remove.pdf mac * *
-FRC_8.4.3_Border_Stypes_S_different_values_BE_.pdf mac * *
-FRC_8.4.3_Border_Stypes_S_different_values_BS_.pdf mac * *
-FRC_8.4.3_Border_Stypes_S_not_exist_BS_.pdf mac * *
-FRC_8.4.3_Border_Stypes_S_remove_BE_.pdf mac * *
-FRC_8.4.3_Border_Stypes_S_remove_BS_.pdf mac * *
-FRC_8.4.3_Border_Stypes_Type_add.pdf mac * *
-FRC_8.4.3_Border_Stypes_Type_not_exist_default_.pdf mac * *
-FRC_8.4.3_Border_Stypes_W_different_values.pdf mac * *
-FRC_8.4.3_Border_Stypes_W_remove.pdf mac * *
-FRC_8.5_Bl_Hide.pdf mac * *
-FRC_8.5_Catalog_OpenAction.pdf mac * *
-FRC_8.5_Catalog_WC.pdf mac * *
-FRC_8.5_DP.pdf mac * *
-FRC_8.5_DS.pdf mac * *
-FRC_8.5_E_GoTo_D.pdf mac * *
-FRC_8.5_Fo_URI_Base.pdf mac * *
-FRC_8.5_Link_URL.pdf mac * *
-FRC_8.5_Outline_A.pdf mac * *
FRC_8.5_Page_C_SubmitForm.pdf * * *
-FRC_8.5_Page_O_URI.pdf mac * *
FRC_8.5_Page_PI_ResetForm_Phantom.pdf * * *
-FRC_8.5_Page_PV_Named_Phantom.pdf mac * *
-FRC_8.5_Screen_Fo_JavaScript.pdf mac * *
-FRC_8.5_Screen_Img_D_Launch.pdf mac * *
-FRC_8.5_Screen_Rendition.pdf mac * *
-FRC_8.5_URI_IsMap.pdf mac * *
-FRC_8.5_U_GoToR_NewWindow.pdf mac * *
-FRC_8.5_U_GoToR_NewWindow_2.pdf mac * *
-FRC_8.5_WP.pdf mac * *
-FRC_8.5_WS.pdf mac * *
-FRC_8.5_Widget_C.pdf mac * *
-FRC_8.5_Widget_F.pdf mac * *
FRC_8.5_Widget_F.pdf * nov8 *
-FRC_8.5_Widget_K.pdf mac * *
-FRC_8.5_Widget_V.pdf mac * *
-FRC_8.5_X_GoToR_D.pdf mac * *
-FRC_8_8.2.2_Parent_edit.pdf mac * *
FRC_8_8.2.2__T8.3_Count_remove.pdf * * *
-FRC_8_8.2.4_View_D.pdf mac * *
-FRC_8_8.2.4__remove__Description_all.pdf mac * *
-FRC_9_8.2.2_Prev_remove_value.pdf mac * *
FRC_9_8.2.2__T8.3_remove_first_item.pdf * * *
-FRC_9_8.2.4_View_T.pdf mac * *
-FRC_9_8.2.4__remove__Description_obj.pdf mac * *
action.pdf * * *
action_execute_a_menu_item.pdf mac * *
action_hide_show_form.pdf mac * *
@@ -288,8 +92,6 @@ bookmark.pdf * * *
bookmarkgetcolor.pdf mac * *
bug_0_length_line.pdf mac * *
bug_0_width_line.pdf mac * *
-bug_434.pdf * * noxfa
-bug_434.pdf win * xfa
bug_440132.pdf mac * *
bug_white_space.pdf mac * *
calcorderindex_test.pdf * * *
@@ -487,18 +289,6 @@ zh_shared_document.pdf mac * *
bug_679643.in * * noxfa
bug_679642.in * * noxfa
-### TODO(dsinclair): These need to be fixed ....
-Test_DateField_locale_en_CA.pdf asan * *
-Test_DateField_locale_en_GB.pdf asan * *
-Test_DateField_locale_en_US.pdf asan * *
-Test_DateField_locale_fr_CA.pdf asan * *
-Test_DateField_locale_fr_FR.pdf asan * *
-Test_DateField_locale_nl_NL.pdf asan * *
-Test_DateField_locale_zh_CN.pdf asan * *
-Test_DateField_locale_zh_HK.pdf asan * *
-Test_PasswordField.pdf asan * *
-format_custom_format.pdf asan * *
-
#
# xfa_specific
#
diff --git a/chromium/third_party/pdfium/testing/embedder_test.cpp b/chromium/third_party/pdfium/testing/embedder_test.cpp
index 79074153fbb..f2a27009e17 100644
--- a/chromium/third_party/pdfium/testing/embedder_test.cpp
+++ b/chromium/third_party/pdfium/testing/embedder_test.cpp
@@ -336,6 +336,15 @@ FPDF_PAGE EmbedderTest::GetPageTrampoline(FPDF_FORMFILLINFO* info,
page_index);
}
+std::string EmbedderTest::HashBitmap(FPDF_BITMAP bitmap,
+ int expected_width,
+ int expected_height) {
+ uint8_t digest[16];
+ CRYPT_MD5Generate(static_cast<uint8_t*>(FPDFBitmap_GetBuffer(bitmap)),
+ expected_width * 4 * expected_height, digest);
+ return CRYPT_ToBase16(digest);
+}
+
// static
void EmbedderTest::CompareBitmap(FPDF_BITMAP bitmap,
int expected_width,
@@ -349,10 +358,8 @@ void EmbedderTest::CompareBitmap(FPDF_BITMAP bitmap,
if (!expected_md5sum)
return;
- uint8_t digest[16];
- CRYPT_MD5Generate(static_cast<uint8_t*>(FPDFBitmap_GetBuffer(bitmap)),
- expected_stride * expected_height, digest);
- EXPECT_EQ(expected_md5sum, CRYPT_ToBase16(digest));
+ EXPECT_EQ(expected_md5sum,
+ HashBitmap(bitmap, expected_width, expected_height));
}
// Can't use gtest-provided main since we need to stash the path to the
diff --git a/chromium/third_party/pdfium/testing/embedder_test.h b/chromium/third_party/pdfium/testing/embedder_test.h
index cc0caec8f63..2bb796d905a 100644
--- a/chromium/third_party/pdfium/testing/embedder_test.h
+++ b/chromium/third_party/pdfium/testing/embedder_test.h
@@ -105,15 +105,20 @@ class EmbedderTest : public ::testing::Test,
// is prohibited after this call is made.
virtual void UnloadPage(FPDF_PAGE page);
+ protected:
+ void SetupFormFillEnvironment();
+
+ // Return the hash of |bitmap|.
+ static std::string HashBitmap(FPDF_BITMAP bitmap,
+ int expected_width,
+ int expected_height);
+
// Check |bitmap| to make sure it has the right dimensions and content.
static void CompareBitmap(FPDF_BITMAP bitmap,
int expected_width,
int expected_height,
const char* expected_md5sum);
- protected:
- void SetupFormFillEnvironment();
-
Delegate* delegate_;
std::unique_ptr<Delegate> default_delegate_;
FPDF_DOCUMENT document_;
diff --git a/chromium/third_party/pdfium/testing/libfuzzer/BUILD.gn b/chromium/third_party/pdfium/testing/libfuzzer/BUILD.gn
index 9ba8e32ba6f..d9dc0ee58ff 100644
--- a/chromium/third_party/pdfium/testing/libfuzzer/BUILD.gn
+++ b/chromium/third_party/pdfium/testing/libfuzzer/BUILD.gn
@@ -25,7 +25,7 @@ group("libfuzzer") {
template("pdfium_fuzzer") {
source_set(target_name) {
- sources = invoker.sources
+ sources = invoker.sources + [ "pdf_fuzzer_init.cc" ]
deps = [
"../..:pdfium",
]
diff --git a/chromium/third_party/pdfium/testing/libfuzzer/pdf_cfx_saxreader_fuzzer.cc b/chromium/third_party/pdfium/testing/libfuzzer/pdf_cfx_saxreader_fuzzer.cc
index d99457d360f..31e24e82f2f 100644
--- a/chromium/third_party/pdfium/testing/libfuzzer/pdf_cfx_saxreader_fuzzer.cc
+++ b/chromium/third_party/pdfium/testing/libfuzzer/pdf_cfx_saxreader_fuzzer.cc
@@ -5,25 +5,16 @@
#include <memory>
#include "core/fxcrt/cfx_retain_ptr.h"
-#include "xfa/fde/xml/cfx_saxreader.h"
-#include "xfa/fgas/crt/fgas_stream.h"
-#include "xfa/fxfa/parser/cxfa_widetextread.h"
+#include "core/fxcrt/xml/cfx_saxreader.h"
+#include "xfa/fgas/crt/ifgas_stream.h"
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
- CFX_WideString input = CFX_WideString::FromUTF8(
- CFX_ByteStringC(data, static_cast<FX_STRSIZE>(size)));
- auto stream = pdfium::MakeRetain<CXFA_WideTextRead>(input);
- if (!stream)
- return 0;
-
- CFX_RetainPtr<IFX_SeekableReadStream> fileRead =
- stream->MakeSeekableReadStream();
- if (!fileRead)
- return 0;
-
CFX_SAXReader reader;
- if (reader.StartParse(fileRead, 0, -1, CFX_SaxParseMode_NotSkipSpace) < 0)
+ if (reader.StartParse(
+ IFX_MemoryStream::Create(const_cast<uint8_t*>(data), size), 0, -1,
+ CFX_SaxParseMode_NotSkipSpace) < 0) {
return 0;
+ }
while (1) {
int32_t ret = reader.ContinueParse(nullptr);
diff --git a/chromium/third_party/pdfium/testing/libfuzzer/pdf_cmap_fuzzer.cc b/chromium/third_party/pdfium/testing/libfuzzer/pdf_cmap_fuzzer.cc
index 1e1ade7e192..ef0f6842124 100644
--- a/chromium/third_party/pdfium/testing/libfuzzer/pdf_cmap_fuzzer.cc
+++ b/chromium/third_party/pdfium/testing/libfuzzer/pdf_cmap_fuzzer.cc
@@ -5,9 +5,10 @@
#include <cstdint>
#include "core/fpdfapi/font/font_int.h"
+#include "third_party/base/ptr_util.h"
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
- CPDF_CMap cmap;
- cmap.LoadEmbedded(data, size);
+ auto cmap = pdfium::MakeRetain<CPDF_CMap>();
+ cmap->LoadEmbedded(data, size);
return 0;
}
diff --git a/chromium/third_party/pdfium/testing/libfuzzer/pdf_codec_icc_fuzzer.cc b/chromium/third_party/pdfium/testing/libfuzzer/pdf_codec_icc_fuzzer.cc
index d7bfdba0cfa..c7abdd69a44 100644
--- a/chromium/third_party/pdfium/testing/libfuzzer/pdf_codec_icc_fuzzer.cc
+++ b/chromium/third_party/pdfium/testing/libfuzzer/pdf_codec_icc_fuzzer.cc
@@ -12,8 +12,8 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
void* transform = icc_module.CreateTransform_sRGB(data, size, nComponent);
if (transform) {
- FX_FLOAT src[4];
- FX_FLOAT dst[4];
+ float src[4];
+ float dst[4];
for (int i = 0; i < 4; i++)
src[i] = 0.5f;
icc_module.SetComponents(nComponent);
diff --git a/chromium/third_party/pdfium/testing/libfuzzer/pdf_codec_jbig2_fuzzer.cc b/chromium/third_party/pdfium/testing/libfuzzer/pdf_codec_jbig2_fuzzer.cc
index 1db39751db0..9378141ffab 100644
--- a/chromium/third_party/pdfium/testing/libfuzzer/pdf_codec_jbig2_fuzzer.cc
+++ b/chromium/third_party/pdfium/testing/libfuzzer/pdf_codec_jbig2_fuzzer.cc
@@ -9,7 +9,9 @@
#include "core/fxcodec/JBig2_DocumentContext.h"
#include "core/fxcodec/codec/ccodec_jbig2module.h"
#include "core/fxcodec/jbig2/JBig2_Context.h"
+#include "core/fxge/dib/cfx_dibitmap.h"
#include "core/fxge/fx_dib.h"
+#include "third_party/base/ptr_util.h"
static uint32_t GetInteger(const uint8_t* data) {
return data[0] | data[1] << 8 | data[2] << 16 | data[3] << 24;
@@ -25,20 +27,21 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
size -= kParameterSize;
data += kParameterSize;
- std::unique_ptr<CFX_DIBitmap> bitmap(new CFX_DIBitmap);
+ auto bitmap = pdfium::MakeRetain<CFX_DIBitmap>();
if (!bitmap->Create(width, height, FXDIB_1bppRgb))
return 0;
- std::unique_ptr<CPDF_Object> stream(new CPDF_Stream);
+ auto stream = pdfium::MakeUnique<CPDF_Stream>();
stream->AsStream()->SetData(data, size);
- CPDF_StreamAcc src_stream;
- src_stream.LoadAllData(stream->AsStream(), true);
+
+ auto src_stream = pdfium::MakeRetain<CPDF_StreamAcc>(stream->AsStream());
+ src_stream->LoadAllData(true);
CCodec_Jbig2Module module;
CCodec_Jbig2Context jbig2_context;
std::unique_ptr<JBig2_DocumentContext> document_context;
FXCODEC_STATUS status = module.StartDecode(
- &jbig2_context, &document_context, width, height, &src_stream, nullptr,
+ &jbig2_context, &document_context, width, height, src_stream, nullptr,
bitmap->GetBuffer(), bitmap->GetPitch(), nullptr);
while (status == FXCODEC_STATUS_DECODE_TOBECONTINUE)
diff --git a/chromium/third_party/pdfium/testing/libfuzzer/pdf_css_fuzzer.cc b/chromium/third_party/pdfium/testing/libfuzzer/pdf_css_fuzzer.cc
index f02f006ea03..9f5cdfec451 100644
--- a/chromium/third_party/pdfium/testing/libfuzzer/pdf_css_fuzzer.cc
+++ b/chromium/third_party/pdfium/testing/libfuzzer/pdf_css_fuzzer.cc
@@ -8,8 +8,7 @@
#include "core/fxcrt/fx_string.h"
#include "xfa/fde/css/cfde_csssyntaxparser.h"
#include "xfa/fde/css/fde_css.h"
-#include "xfa/fgas/crt/fgas_stream.h"
-#include "xfa/fxfa/parser/cxfa_widetextread.h"
+#include "xfa/fgas/crt/ifgas_stream.h"
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
CFX_WideString input = CFX_WideString::FromUTF8(
diff --git a/chromium/third_party/pdfium/testing/libfuzzer/pdf_fuzzer_init.cc b/chromium/third_party/pdfium/testing/libfuzzer/pdf_fuzzer_init.cc
new file mode 100644
index 00000000000..4b9790c3f89
--- /dev/null
+++ b/chromium/third_party/pdfium/testing/libfuzzer/pdf_fuzzer_init.cc
@@ -0,0 +1,21 @@
+// Copyright 2017 The 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.
+
+#include <string.h>
+
+#include "public/fpdfview.h"
+
+// Initialize the library once for all runs of the fuzzer.
+struct TestCase {
+ TestCase() {
+ memset(&config, '\0', sizeof(config));
+ config.version = 2;
+ config.m_pUserFontPaths = nullptr;
+ config.m_pIsolate = nullptr;
+ config.m_v8EmbedderSlot = 0;
+ FPDF_InitLibraryWithConfig(&config);
+ }
+ FPDF_LIBRARY_CONFIG config;
+};
+static TestCase* testCase = new TestCase();
diff --git a/chromium/third_party/pdfium/testing/libfuzzer/pdf_jpx_fuzzer.cc b/chromium/third_party/pdfium/testing/libfuzzer/pdf_jpx_fuzzer.cc
index bea7ba2dbef..b48c14068c8 100644
--- a/chromium/third_party/pdfium/testing/libfuzzer/pdf_jpx_fuzzer.cc
+++ b/chromium/third_party/pdfium/testing/libfuzzer/pdf_jpx_fuzzer.cc
@@ -6,18 +6,16 @@
#include <memory>
#include <vector>
+#include "core/fxcodec/codec/cjpx_decoder.h"
#include "core/fxcodec/codec/codec_int.h"
+#include "core/fxge/dib/cfx_dibitmap.h"
#include "core/fxge/fx_dib.h"
CCodec_JpxModule g_module;
-struct DecoderDeleter {
- void operator()(CJPX_Decoder* decoder) { g_module.DestroyDecoder(decoder); }
-};
-
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
- std::unique_ptr<CJPX_Decoder, DecoderDeleter> decoder(
- g_module.CreateDecoder(data, size, nullptr));
+ std::unique_ptr<CJPX_Decoder> decoder =
+ g_module.CreateDecoder(data, size, nullptr);
if (!decoder)
return 0;
@@ -37,8 +35,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
width = (width * components + 2) / 3;
format = FXDIB_Rgb;
}
-
- std::unique_ptr<CFX_DIBitmap> bitmap(new CFX_DIBitmap);
+ auto bitmap = pdfium::MakeRetain<CFX_DIBitmap>();
if (!bitmap->Create(width, height, format))
return 0;
diff --git a/chromium/third_party/pdfium/testing/libfuzzer/pdf_xml_fuzzer.cc b/chromium/third_party/pdfium/testing/libfuzzer/pdf_xml_fuzzer.cc
index e3cd2543449..8284bc6ce7c 100644
--- a/chromium/third_party/pdfium/testing/libfuzzer/pdf_xml_fuzzer.cc
+++ b/chromium/third_party/pdfium/testing/libfuzzer/pdf_xml_fuzzer.cc
@@ -10,9 +10,10 @@
#include "core/fxcrt/fx_safe_types.h"
#include "core/fxcrt/fx_system.h"
#include "third_party/base/ptr_util.h"
-#include "xfa/fde/xml/fde_xml_imp.h"
-#include "xfa/fxfa/parser/cxfa_xml_parser.h"
-#include "xfa/fxfa/parser/cxfa_widetextread.h"
+#include "xfa/fde/xml/cfde_xmldoc.h"
+#include "xfa/fde/xml/cfde_xmlnode.h"
+#include "xfa/fde/xml/cfde_xmlparser.h"
+#include "xfa/fgas/crt/ifgas_stream.h"
namespace {
@@ -52,12 +53,13 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
CFX_WideString input =
CFX_WideString::FromUTF8(CFX_ByteStringC(data, safe_size.ValueOrDie()));
- auto stream = pdfium::MakeRetain<CXFA_WideTextRead>(input);
+ CFX_RetainPtr<IFGAS_Stream> stream =
+ IFGAS_Stream::CreateWideStringReadStream(input);
if (!stream)
return 0;
auto doc = pdfium::MakeUnique<CFDE_XMLDoc>();
- if (!doc->LoadXML(pdfium::MakeUnique<CXFA_XMLParser>(doc->GetRoot(), stream)))
+ if (!doc->LoadXML(pdfium::MakeUnique<CFDE_XMLParser>(doc->GetRoot(), stream)))
return 0;
if (doc->DoLoad(nullptr) < 100)
diff --git a/chromium/third_party/pdfium/testing/libfuzzer/xfa_codec_fuzzer.h b/chromium/third_party/pdfium/testing/libfuzzer/xfa_codec_fuzzer.h
index 9a8b23e3683..88227c91a91 100644
--- a/chromium/third_party/pdfium/testing/libfuzzer/xfa_codec_fuzzer.h
+++ b/chromium/third_party/pdfium/testing/libfuzzer/xfa_codec_fuzzer.h
@@ -14,6 +14,7 @@
#include "core/fxcodec/codec/ccodec_tiffmodule.h"
#include "core/fxcodec/fx_codec.h"
#include "core/fxcrt/fx_stream.h"
+#include "core/fxge/dib/cfx_dibitmap.h"
#include "third_party/base/ptr_util.h"
class XFACodecFuzzer {
@@ -32,7 +33,7 @@ class XFACodecFuzzer {
if (status != FXCODEC_STATUS_FRAME_READY)
return 0;
- std::unique_ptr<CFX_DIBitmap> bitmap(new CFX_DIBitmap);
+ auto bitmap = pdfium::MakeRetain<CFX_DIBitmap>();
bitmap->Create(decoder->GetWidth(), decoder->GetHeight(), FXDIB_Argb);
int32_t frames;
@@ -40,7 +41,7 @@ class XFACodecFuzzer {
frames == 0)
return 0;
- status = decoder->StartDecode(bitmap.get(), 0, 0, bitmap->GetWidth(),
+ status = decoder->StartDecode(bitmap, 0, 0, bitmap->GetWidth(),
bitmap->GetHeight());
while (status == FXCODEC_STATUS_DECODE_TOBECONTINUE)
status = decoder->ContinueDecode();
diff --git a/chromium/third_party/pdfium/testing/resources/bug_650.pdf b/chromium/third_party/pdfium/testing/resources/bug_650.pdf
new file mode 100644
index 00000000000..5e46032f6ca
--- /dev/null
+++ b/chromium/third_party/pdfium/testing/resources/bug_650.pdf
Binary files differ
diff --git a/chromium/third_party/pdfium/testing/resources/circular_viewer_ref.in b/chromium/third_party/pdfium/testing/resources/circular_viewer_ref.in
new file mode 100644
index 00000000000..f791607e91f
--- /dev/null
+++ b/chromium/third_party/pdfium/testing/resources/circular_viewer_ref.in
@@ -0,0 +1,24 @@
+{{header}}
+{{object 1 0}}
+<</Names 1 0 R
+ /ViewerPreferences<<
+ /Names 1 0 R
+ /ViewerPreferences<<
+ /Names 1 0 R
+ /ViewerPreferences<<>>
+ >>>>
+>>
+endobj
+
+{{object 2 0}}
+<</Names[(0) 7 0 R]>>
+endobj
+
+{{object 7 0}}
+<</JS(this.print\({bUI:true,bSilent:false,bShrinkToFit:true}\);)/S/JavaScript>>
+endobj
+
+{{xref}}
+trailer <</Root 1 0 R>>
+{{startxref}}
+%%EOF
diff --git a/chromium/third_party/pdfium/testing/resources/circular_viewer_ref.pdf b/chromium/third_party/pdfium/testing/resources/circular_viewer_ref.pdf
new file mode 100644
index 00000000000..2e5c4dd8abd
--- /dev/null
+++ b/chromium/third_party/pdfium/testing/resources/circular_viewer_ref.pdf
@@ -0,0 +1,35 @@
+%PDF-1.7
+% ò¤ô
+1 0 obj
+<</Names 1 0 R
+ /ViewerPreferences<<
+ /Names 1 0 R
+ /ViewerPreferences<<
+ /Names 1 0 R
+ /ViewerPreferences<<>>
+ >>>>
+>>
+endobj
+
+2 0 obj
+<</Names[(0) 7 0 R]>>
+endobj
+
+7 0 obj
+<</JS(this.print\({bUI:true,bSilent:false,bShrinkToFit:true}\);)/S/JavaScript>>
+endobj
+
+xref
+0 8
+0000000000 65535 f
+0000000015 00000 n
+0000000157 00000 n
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000195 00000 n
+trailer <</Root 1 0 R>>
+startxref
+291
+%%EOF
diff --git a/chromium/third_party/pdfium/testing/resources/javascript/array_buffer.in b/chromium/third_party/pdfium/testing/resources/javascript/array_buffer.in
new file mode 100644
index 00000000000..1f3e32d60d7
--- /dev/null
+++ b/chromium/third_party/pdfium/testing/resources/javascript/array_buffer.in
@@ -0,0 +1,68 @@
+{{header}}
+{{object 1 0}} <<
+ /Type /Catalog
+ /Pages 2 0 R
+ /OpenAction 10 0 R
+>>
+endobj
+{{object 2 0}} <<
+ /Type /Pages
+ /Count 1
+ /Kids [
+ 3 0 R
+ ]
+>>
+endobj
+% Page number 0.
+{{object 3 0}} <<
+ /Type /Page
+ /Parent 2 0 R
+ /Resources <<
+ /Font <</F1 15 0 R>>
+ >>
+ /Contents [21 0 R]
+ /MediaBox [0 0 612 792]
+>>
+% OpenAction action
+{{object 10 0}} <<
+ /Type /Action
+ /S /JavaScript
+ /JS 11 0 R
+>>
+endobj
+% JS program to exexute
+{{object 11 0}} <<
+>>
+stream
+app.alert("This test attempts to make array buffers until exhausted");
+
+function test(size) {
+ var i, ab, ia;
+ app.alert("Trying size " + size);
+ ab = new ArrayBuffer(size);
+ ia = new Int32Array(ab);
+ for (i = 0; i < size / 4; ++i) {
+ ia[i] = i;
+ }
+ for (i = 0; i < size / 4; ++i) {
+ if (ia[i] != i) {
+ throw('aaaaaaah');
+ }
+ }
+}
+
+try {
+ test(1000);
+ test(2000000);
+ test(4000000000);
+} catch (e) {
+ app.alert("Caught error " + e);
+}
+endstream
+endobj
+{{xref}}
+trailer <<
+ /Root 1 0 R
+>>
+{{startxref}}
+%%EOF
diff --git a/chromium/third_party/pdfium/testing/resources/javascript/array_buffer_expected.txt b/chromium/third_party/pdfium/testing/resources/javascript/array_buffer_expected.txt
new file mode 100644
index 00000000000..f8f3bf227c3
--- /dev/null
+++ b/chromium/third_party/pdfium/testing/resources/javascript/array_buffer_expected.txt
@@ -0,0 +1,5 @@
+Alert: This test attempts to make array buffers until exhausted
+Alert: Trying size 1000
+Alert: Trying size 2000000
+Alert: Trying size 4000000000
+Alert: Caught error RangeError: Array buffer allocation failed
diff --git a/chromium/third_party/pdfium/testing/resources/pixel/bug_524043_1_expected.pdf.0.png b/chromium/third_party/pdfium/testing/resources/pixel/bug_524043_1_expected.pdf.0.png
index a044bb0c37a..5a46384d7b4 100644
--- a/chromium/third_party/pdfium/testing/resources/pixel/bug_524043_1_expected.pdf.0.png
+++ b/chromium/third_party/pdfium/testing/resources/pixel/bug_524043_1_expected.pdf.0.png
Binary files differ
diff --git a/chromium/third_party/pdfium/testing/resources/pixel/bug_524043_1_expected_mac.pdf.0.png b/chromium/third_party/pdfium/testing/resources/pixel/bug_524043_1_expected_mac.pdf.0.png
index e4d57103ef1..b85b9d0f967 100644
--- a/chromium/third_party/pdfium/testing/resources/pixel/bug_524043_1_expected_mac.pdf.0.png
+++ b/chromium/third_party/pdfium/testing/resources/pixel/bug_524043_1_expected_mac.pdf.0.png
Binary files differ
diff --git a/chromium/third_party/pdfium/testing/resources/pixel/bug_524043_2_expected.pdf.0.png b/chromium/third_party/pdfium/testing/resources/pixel/bug_524043_2_expected.pdf.0.png
index 19de52a360a..34aa9b428b0 100644
--- a/chromium/third_party/pdfium/testing/resources/pixel/bug_524043_2_expected.pdf.0.png
+++ b/chromium/third_party/pdfium/testing/resources/pixel/bug_524043_2_expected.pdf.0.png
Binary files differ
diff --git a/chromium/third_party/pdfium/testing/resources/pixel/bug_524043_2_expected_mac.pdf.0.png b/chromium/third_party/pdfium/testing/resources/pixel/bug_524043_2_expected_mac.pdf.0.png
index 1136013d885..ecede7d82c0 100644
--- a/chromium/third_party/pdfium/testing/resources/pixel/bug_524043_2_expected_mac.pdf.0.png
+++ b/chromium/third_party/pdfium/testing/resources/pixel/bug_524043_2_expected_mac.pdf.0.png
Binary files differ
diff --git a/chromium/third_party/pdfium/testing/resources/pixel/bug_524043_3_expected.pdf.0.png b/chromium/third_party/pdfium/testing/resources/pixel/bug_524043_3_expected.pdf.0.png
index a044bb0c37a..5a46384d7b4 100644
--- a/chromium/third_party/pdfium/testing/resources/pixel/bug_524043_3_expected.pdf.0.png
+++ b/chromium/third_party/pdfium/testing/resources/pixel/bug_524043_3_expected.pdf.0.png
Binary files differ
diff --git a/chromium/third_party/pdfium/testing/resources/pixel/bug_524043_3_expected_mac.pdf.0.png b/chromium/third_party/pdfium/testing/resources/pixel/bug_524043_3_expected_mac.pdf.0.png
index e4d57103ef1..b85b9d0f967 100644
--- a/chromium/third_party/pdfium/testing/resources/pixel/bug_524043_3_expected_mac.pdf.0.png
+++ b/chromium/third_party/pdfium/testing/resources/pixel/bug_524043_3_expected_mac.pdf.0.png
Binary files differ
diff --git a/chromium/third_party/pdfium/testing/resources/pixel/bug_524043_4_expected.pdf.0.png b/chromium/third_party/pdfium/testing/resources/pixel/bug_524043_4_expected.pdf.0.png
index a044bb0c37a..5a46384d7b4 100644
--- a/chromium/third_party/pdfium/testing/resources/pixel/bug_524043_4_expected.pdf.0.png
+++ b/chromium/third_party/pdfium/testing/resources/pixel/bug_524043_4_expected.pdf.0.png
Binary files differ
diff --git a/chromium/third_party/pdfium/testing/resources/pixel/bug_524043_4_expected_mac.pdf.0.png b/chromium/third_party/pdfium/testing/resources/pixel/bug_524043_4_expected_mac.pdf.0.png
index e4d57103ef1..b85b9d0f967 100644
--- a/chromium/third_party/pdfium/testing/resources/pixel/bug_524043_4_expected_mac.pdf.0.png
+++ b/chromium/third_party/pdfium/testing/resources/pixel/bug_524043_4_expected_mac.pdf.0.png
Binary files differ
diff --git a/chromium/third_party/pdfium/testing/resources/pixel/bug_524043_5_expected.pdf.0.png b/chromium/third_party/pdfium/testing/resources/pixel/bug_524043_5_expected.pdf.0.png
index a044bb0c37a..5a46384d7b4 100644
--- a/chromium/third_party/pdfium/testing/resources/pixel/bug_524043_5_expected.pdf.0.png
+++ b/chromium/third_party/pdfium/testing/resources/pixel/bug_524043_5_expected.pdf.0.png
Binary files differ
diff --git a/chromium/third_party/pdfium/testing/resources/pixel/bug_524043_5_expected_mac.pdf.0.png b/chromium/third_party/pdfium/testing/resources/pixel/bug_524043_5_expected_mac.pdf.0.png
index e4d57103ef1..b85b9d0f967 100644
--- a/chromium/third_party/pdfium/testing/resources/pixel/bug_524043_5_expected_mac.pdf.0.png
+++ b/chromium/third_party/pdfium/testing/resources/pixel/bug_524043_5_expected_mac.pdf.0.png
Binary files differ
diff --git a/chromium/third_party/pdfium/testing/resources/pixel/bug_524043_7_expected.pdf.0.png b/chromium/third_party/pdfium/testing/resources/pixel/bug_524043_7_expected.pdf.0.png
index 19de52a360a..34aa9b428b0 100644
--- a/chromium/third_party/pdfium/testing/resources/pixel/bug_524043_7_expected.pdf.0.png
+++ b/chromium/third_party/pdfium/testing/resources/pixel/bug_524043_7_expected.pdf.0.png
Binary files differ
diff --git a/chromium/third_party/pdfium/testing/resources/pixel/bug_524043_7_expected_mac.pdf.0.png b/chromium/third_party/pdfium/testing/resources/pixel/bug_524043_7_expected_mac.pdf.0.png
index 1136013d885..ecede7d82c0 100644
--- a/chromium/third_party/pdfium/testing/resources/pixel/bug_524043_7_expected_mac.pdf.0.png
+++ b/chromium/third_party/pdfium/testing/resources/pixel/bug_524043_7_expected_mac.pdf.0.png
Binary files differ
diff --git a/chromium/third_party/pdfium/testing/resources/pixel/bug_543018_1_expected.pdf.0.png b/chromium/third_party/pdfium/testing/resources/pixel/bug_543018_1_expected.pdf.0.png
index a044bb0c37a..5a46384d7b4 100644
--- a/chromium/third_party/pdfium/testing/resources/pixel/bug_543018_1_expected.pdf.0.png
+++ b/chromium/third_party/pdfium/testing/resources/pixel/bug_543018_1_expected.pdf.0.png
Binary files differ
diff --git a/chromium/third_party/pdfium/testing/resources/pixel/bug_543018_1_expected_mac.pdf.0.png b/chromium/third_party/pdfium/testing/resources/pixel/bug_543018_1_expected_mac.pdf.0.png
index e4d57103ef1..b85b9d0f967 100644
--- a/chromium/third_party/pdfium/testing/resources/pixel/bug_543018_1_expected_mac.pdf.0.png
+++ b/chromium/third_party/pdfium/testing/resources/pixel/bug_543018_1_expected_mac.pdf.0.png
Binary files differ
diff --git a/chromium/third_party/pdfium/testing/resources/pixel/bug_543018_2_expected.pdf.0.png b/chromium/third_party/pdfium/testing/resources/pixel/bug_543018_2_expected.pdf.0.png
index a044bb0c37a..5a46384d7b4 100644
--- a/chromium/third_party/pdfium/testing/resources/pixel/bug_543018_2_expected.pdf.0.png
+++ b/chromium/third_party/pdfium/testing/resources/pixel/bug_543018_2_expected.pdf.0.png
Binary files differ
diff --git a/chromium/third_party/pdfium/testing/resources/pixel/bug_543018_2_expected_mac.pdf.0.png b/chromium/third_party/pdfium/testing/resources/pixel/bug_543018_2_expected_mac.pdf.0.png
index e4d57103ef1..b85b9d0f967 100644
--- a/chromium/third_party/pdfium/testing/resources/pixel/bug_543018_2_expected_mac.pdf.0.png
+++ b/chromium/third_party/pdfium/testing/resources/pixel/bug_543018_2_expected_mac.pdf.0.png
Binary files differ
diff --git a/chromium/third_party/pdfium/testing/resources/pixel/bug_551258_1_expected.pdf.0.png b/chromium/third_party/pdfium/testing/resources/pixel/bug_551258_1_expected.pdf.0.png
index a044bb0c37a..5a46384d7b4 100644
--- a/chromium/third_party/pdfium/testing/resources/pixel/bug_551258_1_expected.pdf.0.png
+++ b/chromium/third_party/pdfium/testing/resources/pixel/bug_551258_1_expected.pdf.0.png
Binary files differ
diff --git a/chromium/third_party/pdfium/testing/resources/pixel/bug_551258_1_expected_mac.pdf.0.png b/chromium/third_party/pdfium/testing/resources/pixel/bug_551258_1_expected_mac.pdf.0.png
index e4d57103ef1..b85b9d0f967 100644
--- a/chromium/third_party/pdfium/testing/resources/pixel/bug_551258_1_expected_mac.pdf.0.png
+++ b/chromium/third_party/pdfium/testing/resources/pixel/bug_551258_1_expected_mac.pdf.0.png
Binary files differ
diff --git a/chromium/third_party/pdfium/testing/resources/pixel/font_size_expected.pdf.0.png b/chromium/third_party/pdfium/testing/resources/pixel/font_size_expected.pdf.0.png
index a14df36afe0..5950b749f8f 100644
--- a/chromium/third_party/pdfium/testing/resources/pixel/font_size_expected.pdf.0.png
+++ b/chromium/third_party/pdfium/testing/resources/pixel/font_size_expected.pdf.0.png
Binary files differ
diff --git a/chromium/third_party/pdfium/testing/resources/pixel/font_size_expected_mac.pdf.0.png b/chromium/third_party/pdfium/testing/resources/pixel/font_size_expected_mac.pdf.0.png
new file mode 100644
index 00000000000..dfd06901a4b
--- /dev/null
+++ b/chromium/third_party/pdfium/testing/resources/pixel/font_size_expected_mac.pdf.0.png
Binary files differ
diff --git a/chromium/third_party/pdfium/testing/resources/repeat_viewer_ref.in b/chromium/third_party/pdfium/testing/resources/repeat_viewer_ref.in
new file mode 100644
index 00000000000..6b436e535f3
--- /dev/null
+++ b/chromium/third_party/pdfium/testing/resources/repeat_viewer_ref.in
@@ -0,0 +1,19 @@
+{{header}}
+{{object 1 0}}
+<</Names<</JavaScript 2 0 R>>/ViewerPreferences<<
+<</Names<</JavaScript 2 0 R>>/ViewerPreferences<<
+<</Names<</JavaScript 2 0 R>>/ViewerPreferences<<>>
+endobj
+
+{{object 2 0}}
+<</Names[(0) 7 0 R]>>
+endobj
+
+{{object 7 0}}
+<</JS(this.print\({bUI:true,bSilent:false,bShrinkToFit:true}\);)/S/JavaScript>>
+endobj
+
+{{xref}}
+trailer <</Root 1 0 R>>
+{{startxref}}
+%%EOF
diff --git a/chromium/third_party/pdfium/testing/resources/repeat_viewer_ref.pdf b/chromium/third_party/pdfium/testing/resources/repeat_viewer_ref.pdf
new file mode 100644
index 00000000000..3f4ee477243
--- /dev/null
+++ b/chromium/third_party/pdfium/testing/resources/repeat_viewer_ref.pdf
@@ -0,0 +1,30 @@
+%PDF-1.7
+% ò¤ô
+1 0 obj
+<</Names<</JavaScript 2 0 R>>/ViewerPreferences<<
+<</Names<</JavaScript 2 0 R>>/ViewerPreferences<<
+<</Names<</JavaScript 2 0 R>>/ViewerPreferences<<>>
+endobj
+
+2 0 obj
+<</Names[(0) 7 0 R]>>
+endobj
+
+7 0 obj
+<</JS(this.print\({bUI:true,bSilent:false,bShrinkToFit:true}\);)/S/JavaScript>>
+endobj
+
+xref
+0 8
+0000000000 65535 f
+0000000015 00000 n
+0000000183 00000 n
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000221 00000 n
+trailer <</Root 1 0 R>>
+startxref
+317
+%%EOF
diff --git a/chromium/third_party/pdfium/testing/resources/weblinks_across_lines.in b/chromium/third_party/pdfium/testing/resources/weblinks_across_lines.in
new file mode 100644
index 00000000000..bb04b5e9cf2
--- /dev/null
+++ b/chromium/third_party/pdfium/testing/resources/weblinks_across_lines.in
@@ -0,0 +1,74 @@
+{{header}}
+{{object 1 0}} <<
+ /Type /Catalog
+ /Pages 2 0 R
+>>
+{{object 2 0}} <<
+ /Type /Pages
+ /MediaBox [ 0 0 600 600 ]
+ /Count 1
+ /Kids [ 3 0 R ]
+>>
+endobj
+{{object 3 0}} <<
+ /Type /Page
+ /Parent 2 0 R
+ /Resources <<
+ /Font <<
+ /F1 4 0 R
+ /F2 5 0 R
+ >>
+ >>
+ /Contents 6 0 R
+>>
+endobj
+{{object 4 0}} <<
+ /Type /Font
+ /Subtype /Type1
+ /BaseFont /Times-Roman
+>>
+endobj
+{{object 5 0}} <<
+ /Type /Font
+ /Subtype /Type1
+ /BaseFont /Helvetica
+>>
+endobj
+{{object 6 0}} <<
+>>
+stream
+BT
+/F1 12 Tf
+50 50 Td
+(Hello, world! This is not a link.) Tj
+0 50 Td
+(Is this http://example.com?) Tj
+0 50 Td
+(foo a link?) Tj
+/F2 14 Tf
+0 50 Td
+(How about this http://example.com/) Tj
+0 50 Td
+(foo a link?) Tj
+0 50 Td
+(Is this http://example.com/test-) Tj
+0 50 Td
+(foo a link?) Tj
+(Is this http://abc.com/test-) Tj
+0 50 Td
+0 50 Td
+(foo a link?) Tj
+0 50 Td
+(And this http://example.com/) Tj
+0 50 Td
+(http://www.abc.com a link?) Tj
+ET
+endstream
+endobj
+{{xref}}
+trailer <<
+ /Size 6
+ /Root 1 0 R
+>>
+{{startxref}}
+%%EOF
diff --git a/chromium/third_party/pdfium/testing/resources/weblinks_across_lines.pdf b/chromium/third_party/pdfium/testing/resources/weblinks_across_lines.pdf
new file mode 100644
index 00000000000..e9327c4b34b
--- /dev/null
+++ b/chromium/third_party/pdfium/testing/resources/weblinks_across_lines.pdf
@@ -0,0 +1,84 @@
+%PDF-1.7
+% ò¤ô
+1 0 obj <<
+ /Type /Catalog
+ /Pages 2 0 R
+>>
+2 0 obj <<
+ /Type /Pages
+ /MediaBox [ 0 0 600 600 ]
+ /Count 1
+ /Kids [ 3 0 R ]
+>>
+endobj
+3 0 obj <<
+ /Type /Page
+ /Parent 2 0 R
+ /Resources <<
+ /Font <<
+ /F1 4 0 R
+ /F2 5 0 R
+ >>
+ >>
+ /Contents 6 0 R
+>>
+endobj
+4 0 obj <<
+ /Type /Font
+ /Subtype /Type1
+ /BaseFont /Times-Roman
+>>
+endobj
+5 0 obj <<
+ /Type /Font
+ /Subtype /Type1
+ /BaseFont /Helvetica
+>>
+endobj
+6 0 obj <<
+>>
+stream
+BT
+/F1 12 Tf
+50 50 Td
+(Hello, world! This is not a link.) Tj
+0 50 Td
+(Is this http://example.com?) Tj
+0 50 Td
+(foo a link?) Tj
+/F2 14 Tf
+0 50 Td
+(How about this http://example.com/) Tj
+0 50 Td
+(foo a link?) Tj
+0 50 Td
+(Is this http://example.com/test-) Tj
+0 50 Td
+(foo a link?) Tj
+(Is this http://abc.com/test-) Tj
+0 50 Td
+0 50 Td
+(foo a link?) Tj
+0 50 Td
+(And this http://example.com/) Tj
+0 50 Td
+(http://www.abc.com a link?) Tj
+ET
+endstream
+endobj
+xref
+0 7
+0000000000 65535 f
+0000000015 00000 n
+0000000061 00000 n
+0000000154 00000 n
+0000000296 00000 n
+0000000374 00000 n
+0000000450 00000 n
+trailer <<
+ /Size 6
+ /Root 1 0 R
+>>
+startxref
+921
+%%EOF
diff --git a/chromium/third_party/pdfium/testing/resources/zero_length_stream.in b/chromium/third_party/pdfium/testing/resources/zero_length_stream.in
new file mode 100644
index 00000000000..5b258d4d746
--- /dev/null
+++ b/chromium/third_party/pdfium/testing/resources/zero_length_stream.in
@@ -0,0 +1,63 @@
+{{header}}
+{{object 1 0}} <<
+ /Type /Catalog
+ /Pages 2 0 R
+>>
+{{object 2 0}} <<
+ /Type /Pages
+ /MediaBox [ 0 0 200 200 ]
+ /Count 1
+ /Kids [ 3 0 R ]
+>>
+endobj
+{{object 3 0}} <<
+ /Type /Page
+ /Parent 2 0 R
+ /Resources <<
+ /Font <<
+ /F1 4 0 R
+ /F2 5 0 R
+ >>
+ >>
+ /Contents [6 0 R 7 0 R]
+>>
+endobj
+{{object 4 0}} <<
+ /Type /Font
+ /Subtype /Type1
+ /BaseFont /Times-Roman
+>>
+endobj
+{{object 5 0}} <<
+ /Type /Font
+ /Subtype /Type1
+ /BaseFont /Helvetica
+>>
+endobj
+{{object 6 0}} <<
+ /Filter /FlateDecode
+ /Length 0
+>>
+stream
+endstream
+endobj
+{{object 7 0}} <<
+>>
+stream
+BT
+20 50 Td
+/F1 12 Tf
+(Hello, world!) Tj
+0 50 Td
+/F2 16 Tf
+(Goodbye, world!) Tj
+ET
+endstream
+endobj
+{{xref}}
+trailer <<
+ /Size 6
+ /Root 1 0 R
+>>
+{{startxref}}
+%%EOF
diff --git a/chromium/third_party/pdfium/testing/resources/zero_length_stream.pdf b/chromium/third_party/pdfium/testing/resources/zero_length_stream.pdf
new file mode 100644
index 00000000000..90fae5be7f4
--- /dev/null
+++ b/chromium/third_party/pdfium/testing/resources/zero_length_stream.pdf
@@ -0,0 +1,74 @@
+%PDF-1.7
+% ò¤ô
+1 0 obj <<
+ /Type /Catalog
+ /Pages 2 0 R
+>>
+2 0 obj <<
+ /Type /Pages
+ /MediaBox [ 0 0 200 200 ]
+ /Count 1
+ /Kids [ 3 0 R ]
+>>
+endobj
+3 0 obj <<
+ /Type /Page
+ /Parent 2 0 R
+ /Resources <<
+ /Font <<
+ /F1 4 0 R
+ /F2 5 0 R
+ >>
+ >>
+ /Contents [6 0 R 7 0 R]
+>>
+endobj
+4 0 obj <<
+ /Type /Font
+ /Subtype /Type1
+ /BaseFont /Times-Roman
+>>
+endobj
+5 0 obj <<
+ /Type /Font
+ /Subtype /Type1
+ /BaseFont /Helvetica
+>>
+endobj
+6 0 obj <<
+ /Filter /FlateDecode
+ /Length 0
+>>
+stream
+endstream
+endobj
+7 0 obj <<
+>>
+stream
+BT
+20 50 Td
+/F1 12 Tf
+(Hello, world!) Tj
+0 50 Td
+/F2 16 Tf
+(Goodbye, world!) Tj
+ET
+endstream
+endobj
+xref
+0 8
+0000000000 65535 f
+0000000015 00000 n
+0000000061 00000 n
+0000000154 00000 n
+0000000304 00000 n
+0000000382 00000 n
+0000000458 00000 n
+0000000531 00000 n
+trailer <<
+ /Size 6
+ /Root 1 0 R
+>>
+startxref
+652
+%%EOF
diff --git a/chromium/third_party/pdfium/testing/test.gni b/chromium/third_party/pdfium/testing/test.gni
index b6677d45fc4..eeda2724302 100644
--- a/chromium/third_party/pdfium/testing/test.gni
+++ b/chromium/third_party/pdfium/testing/test.gni
@@ -54,9 +54,12 @@ template("test") {
# the default shared_library configs rather than executable configs.
configs -= [
"//build/config:shared_library_config",
- "//build/config/android:hide_native_jni_exports",
+ "//build/config/android:hide_all_but_jni_onload",
+ ]
+ configs += [
+ "//build/config:executable_config",
+ "//build/config/android:hide_all_but_jni",
]
- configs += [ "//build/config:executable_config" ]
# Don't output to the root or else conflict with the group() below.
output_name = rebase_path(_exec_output, root_out_dir)
@@ -185,15 +188,6 @@ template("test") {
deps += [ ":$_apk_target" ]
}
}
-
- # TODO(GYP_GONE): Delete this after we've converted everything to GN.
- # The _run targets exist only for compatibility w/ GYP.
- group("${target_name}_apk_run") {
- testonly = true
- deps = [
- ":${invoker.target_name}",
- ]
- }
} else if (is_ios) {
import("//build/config/ios/rules.gni")
@@ -263,15 +257,6 @@ template("test") {
]
}
- # TODO(GYP_GONE): Delete this after we've converted everything to GN.
- # The _run targets exist only for compatibility with GYP.
- group("${target_name}_run") {
- testonly = true
- deps = [
- ":${invoker.target_name}",
- ]
- }
-
if (defined(invoker.output_name) && target_name != invoker.output_name) {
group("${invoker.output_name}_run") {
testonly = true
diff --git a/chromium/third_party/pdfium/testing/test_support.cpp b/chromium/third_party/pdfium/testing/test_support.cpp
index a530b3ea4c4..20f1cadf095 100644
--- a/chromium/third_party/pdfium/testing/test_support.cpp
+++ b/chromium/third_party/pdfium/testing/test_support.cpp
@@ -9,6 +9,7 @@
#include <string>
+#include "core/fxcrt/fx_memory.h"
#include "testing/utils/path_service.h"
#ifdef PDF_ENABLE_V8
@@ -210,3 +211,14 @@ int TestSaver::WriteBlockCallback(FPDF_FILEWRITE* pFileWrite,
pThis->m_String.append(static_cast<const char*>(data), size);
return 1;
}
+
+namespace pdfium {
+
+void FPDF_Test::SetUp() {
+ FXMEM_InitalizePartitionAlloc();
+}
+
+void FPDF_Test::TearDown() {
+}
+
+} // namespace pdfium
diff --git a/chromium/third_party/pdfium/testing/test_support.h b/chromium/third_party/pdfium/testing/test_support.h
index 4111ca61ed6..b734bc31f08 100644
--- a/chromium/third_party/pdfium/testing/test_support.h
+++ b/chromium/third_party/pdfium/testing/test_support.h
@@ -12,6 +12,7 @@
#include "public/fpdf_save.h"
#include "public/fpdfview.h"
+#include "testing/gtest/include/gtest/gtest.h"
#ifdef PDF_ENABLE_V8
#include "v8/include/v8.h"
@@ -58,6 +59,12 @@ struct FreeDeleter {
inline void operator()(void* ptr) const { free(ptr); }
};
+class FPDF_Test : public ::testing::Test {
+ public:
+ void SetUp() override;
+ void TearDown() override;
+};
+
} // namespace pdfium
// Reads the entire contents of a file into a newly alloc'd buffer.
diff --git a/chromium/third_party/pdfium/testing/tools/gold.py b/chromium/third_party/pdfium/testing/tools/gold.py
index db3bf81b739..bdae9f41952 100644
--- a/chromium/third_party/pdfium/testing/tools/gold.py
+++ b/chromium/third_party/pdfium/testing/tools/gold.py
@@ -56,7 +56,8 @@ class GoldResults(object):
"""
source_type is the source_type (=corpus) field used for all results.
output_dir is the directory where the resulting images are copied and
- the dm.json file is written.
+ the dm.json file is written. If the directory exists it will
+ be removed and recreated.
propertiesStr is a string with space separated key/value pairs that
is used to set the top level fields in the output JSON file.
keyStr is a string with space separated key/value pairs that
@@ -70,9 +71,10 @@ class GoldResults(object):
self._results = []
self._outputDir = outputDir
- # make sure the output directory exists.
- if not os.path.exists(outputDir):
- os.makedirs(outputDir)
+ # make sure the output directory exists and is empty.
+ if os.path.exists(outputDir):
+ shutil.rmtree(outputDir, ignore_errors=True)
+ os.makedirs(outputDir)
self._ignore_hashes = set()
if ignore_hashes_file:
diff --git a/chromium/third_party/pdfium/testing/tools/suppressor.py b/chromium/third_party/pdfium/testing/tools/suppressor.py
index 86d2668adbd..3b2872df95f 100755
--- a/chromium/third_party/pdfium/testing/tools/suppressor.py
+++ b/chromium/third_party/pdfium/testing/tools/suppressor.py
@@ -12,7 +12,6 @@ class Suppressor:
feature_vector = feature_string.strip().split(",")
self.has_v8 = "V8" in feature_vector
self.has_xfa = "XFA" in feature_vector
- self.is_asan = "ASAN" in feature_vector
v8_option = "v8" if self.has_v8 else "nov8"
xfa_option = "xfa" if self.has_xfa else "noxfa"
@@ -33,8 +32,6 @@ class Suppressor:
os_column = item[1].split(",");
js_column = item[2].split(",");
xfa_column = item[3].split(",");
- if self.is_asan and 'asan' in os_column:
- return True
return (('*' in os_column or os in os_column) and
('*' in js_column or js in js_column) and
('*' in xfa_column or xfa in xfa_column))
diff --git a/chromium/third_party/pdfium/third_party/BUILD.gn b/chromium/third_party/pdfium/third_party/BUILD.gn
index 50ab7070588..c270a1063ab 100644
--- a/chromium/third_party/pdfium/third_party/BUILD.gn
+++ b/chromium/third_party/pdfium/third_party/BUILD.gn
@@ -9,9 +9,11 @@ import("../pdfium.gni")
group("third_party") {
deps = [
":bigint",
- ":fx_freetype",
":pdfium_base",
]
+ if (pdf_bundle_freetype) {
+ deps += [ ":fx_freetype" ]
+ }
}
config("pdfium_third_party_config") {
@@ -38,64 +40,148 @@ static_library("bigint") {
]
}
-config("fx_freetype_warnings") {
- visibility = [ ":*" ]
- if (is_clang) {
- # open_face_PS_from_sfnt_stream() and open_face_from_buffer() in
- # ftbase.h are unused.
- cflags = [ "-Wno-unused-function" ]
+if (pdf_bundle_freetype) {
+ config("fx_freetype_warnings") {
+ visibility = [ ":*" ]
+ if (is_clang) {
+ # open_face_PS_from_sfnt_stream() and open_face_from_buffer() in
+ # ftbase.h are unused.
+ #
+ # ttgload.c casts from unsigned int to unsigned long to void*.
+ cflags = [
+ "-Wno-unused-function",
+ "-Wno-int-to-void-pointer-cast",
+ ]
+ }
}
-}
-# Tests may link against this even if the production library doesn't,
-# so it needs to be separate from it.
-static_library("fx_freetype") {
- configs -= [ "//build/config/compiler:chromium_code" ]
- configs += [
- "//build/config/compiler:no_chromium_code",
- ":pdfium_third_party_config",
+ config("freetype_public_includes_config") {
+ # The relative freetype/include path points to PDFium's custom config.
+ # The absolute path points to whatever copy of FreeType is in
+ # //third_party/freetype.
+ include_dirs = [
+ "freetype/include",
+ "//third_party/freetype/src/include",
+ ]
+ defines = [
+ "FT_CONFIG_MODULES_H=<freetype-custom-config/ftmodule.h>",
+ "FT_CONFIG_OPTIONS_H=<freetype-custom-config/ftoption.h>",
+ ]
+ }
- # Must be after no_chromium_code for warning flags to be ordered correctly.
- ":fx_freetype_warnings",
- ]
- defines = [ "FT2_BUILD_LIBRARY" ]
- sources = [
- "freetype/include/freetype/freetype.h",
- "freetype/include/freetype/ftmm.h",
- "freetype/include/freetype/ftotval.h",
- "freetype/include/freetype/ftoutln.h",
- "freetype/include/freetype/internal/ftobjs.h",
- "freetype/include/freetype/internal/ftstream.h",
- "freetype/include/freetype/internal/tttypes.h",
- "freetype/include/freetype/tttables.h",
- "freetype/include/ft2build.h",
- "freetype/src/base/ftbase.c",
- "freetype/src/base/ftbase.h",
- "freetype/src/base/ftbitmap.c",
- "freetype/src/base/ftglyph.c",
- "freetype/src/base/ftinit.c",
- "freetype/src/base/ftlcdfil.c",
- "freetype/src/base/ftmm.c",
- "freetype/src/base/ftsystem.c",
- "freetype/src/cff/cff.c",
- "freetype/src/cff/cffobjs.h",
- "freetype/src/cff/cfftypes.h",
- "freetype/src/cid/type1cid.c",
- "freetype/src/psaux/psaux.c",
- "freetype/src/pshinter/pshinter.c",
- "freetype/src/psnames/psmodule.c",
- "freetype/src/raster/raster.c",
- "freetype/src/sfnt/sfnt.c",
- "freetype/src/smooth/smooth.c",
- "freetype/src/truetype/truetype.c",
- "freetype/src/type1/type1.c",
- ]
- if (pdf_use_skia || pdf_use_skia_paths) {
- sources += [
- "freetype/src/base/ftfntfmt.c",
- "freetype/src/base/ftfstype.c",
- "freetype/src/base/fttype1.c",
+ # Tests may link against this even if the production library doesn't,
+ # so it needs to be separate from it.
+ static_library("fx_freetype") {
+ configs -= [ "//build/config/compiler:chromium_code" ]
+ configs += [
+ "//build/config/compiler:no_chromium_code",
+ ":pdfium_third_party_config",
+
+ # Must be after no_chromium_code for warning flags to be ordered correctly.
+ ":fx_freetype_warnings",
]
+
+ public_configs = [ ":freetype_public_includes_config" ]
+
+ defines = [ "FT2_BUILD_LIBRARY" ]
+ sources = [
+ "//third_party/freetype/src/include/freetype/config/ftconfig.h",
+ "//third_party/freetype/src/include/freetype/config/ftheader.h",
+ "//third_party/freetype/src/include/freetype/config/ftstdlib.h",
+ "//third_party/freetype/src/include/freetype/freetype.h",
+ "//third_party/freetype/src/include/freetype/ftadvanc.h",
+ "//third_party/freetype/src/include/freetype/ftbitmap.h",
+ "//third_party/freetype/src/include/freetype/ftcffdrv.h",
+ "//third_party/freetype/src/include/freetype/fterrdef.h",
+ "//third_party/freetype/src/include/freetype/fterrors.h",
+ "//third_party/freetype/src/include/freetype/ftglyph.h",
+ "//third_party/freetype/src/include/freetype/ftgzip.h",
+ "//third_party/freetype/src/include/freetype/ftimage.h",
+ "//third_party/freetype/src/include/freetype/ftincrem.h",
+ "//third_party/freetype/src/include/freetype/ftlcdfil.h",
+ "//third_party/freetype/src/include/freetype/ftlist.h",
+ "//third_party/freetype/src/include/freetype/ftmm.h",
+ "//third_party/freetype/src/include/freetype/ftmodapi.h",
+ "//third_party/freetype/src/include/freetype/ftmoderror.h",
+ "//third_party/freetype/src/include/freetype/ftobjs.h",
+ "//third_party/freetype/src/include/freetype/ftotval.h",
+ "//third_party/freetype/src/include/freetype/ftoutln.h",
+ "//third_party/freetype/src/include/freetype/ftrender.h",
+ "//third_party/freetype/src/include/freetype/ftsizes.h",
+ "//third_party/freetype/src/include/freetype/ftsnames.h",
+ "//third_party/freetype/src/include/freetype/ftstream.h",
+ "//third_party/freetype/src/include/freetype/ftsystem.h",
+ "//third_party/freetype/src/include/freetype/fttrigon.h",
+ "//third_party/freetype/src/include/freetype/ftttdrv.h",
+ "//third_party/freetype/src/include/freetype/fttypes.h",
+ "//third_party/freetype/src/include/freetype/internal/autohint.h",
+ "//third_party/freetype/src/include/freetype/internal/ftcalc.h",
+ "//third_party/freetype/src/include/freetype/internal/ftdebug.h",
+ "//third_party/freetype/src/include/freetype/internal/ftdriver.h",
+ "//third_party/freetype/src/include/freetype/internal/ftgloadr.h",
+ "//third_party/freetype/src/include/freetype/internal/fthash.h",
+ "//third_party/freetype/src/include/freetype/internal/ftmemory.h",
+ "//third_party/freetype/src/include/freetype/internal/ftobjs.h",
+ "//third_party/freetype/src/include/freetype/internal/ftpic.h",
+ "//third_party/freetype/src/include/freetype/internal/ftrfork.h",
+ "//third_party/freetype/src/include/freetype/internal/ftserv.h",
+ "//third_party/freetype/src/include/freetype/internal/ftstream.h",
+ "//third_party/freetype/src/include/freetype/internal/ftvalid.h",
+ "//third_party/freetype/src/include/freetype/internal/internal.h",
+ "//third_party/freetype/src/include/freetype/internal/psaux.h",
+ "//third_party/freetype/src/include/freetype/internal/pshints.h",
+ "//third_party/freetype/src/include/freetype/internal/services/svcid.h",
+ "//third_party/freetype/src/include/freetype/internal/services/svfntfmt.h",
+ "//third_party/freetype/src/include/freetype/internal/services/svgldict.h",
+ "//third_party/freetype/src/include/freetype/internal/services/svkern.h",
+ "//third_party/freetype/src/include/freetype/internal/services/svmetric.h",
+ "//third_party/freetype/src/include/freetype/internal/services/svmm.h",
+ "//third_party/freetype/src/include/freetype/internal/services/svpostnm.h",
+ "//third_party/freetype/src/include/freetype/internal/services/svprop.h",
+ "//third_party/freetype/src/include/freetype/internal/services/svpscmap.h",
+ "//third_party/freetype/src/include/freetype/internal/services/svpsinfo.h",
+ "//third_party/freetype/src/include/freetype/internal/services/svsfnt.h",
+ "//third_party/freetype/src/include/freetype/internal/services/svttcmap.h",
+ "//third_party/freetype/src/include/freetype/internal/services/svtteng.h",
+ "//third_party/freetype/src/include/freetype/internal/services/svttglyf.h",
+ "//third_party/freetype/src/include/freetype/internal/sfnt.h",
+ "//third_party/freetype/src/include/freetype/internal/t1types.h",
+ "//third_party/freetype/src/include/freetype/internal/tttypes.h",
+ "//third_party/freetype/src/include/freetype/t1tables.h",
+ "//third_party/freetype/src/include/freetype/ttnameid.h",
+ "//third_party/freetype/src/include/freetype/tttables.h",
+ "//third_party/freetype/src/include/freetype/tttags.h",
+ "//third_party/freetype/src/include/ft2build.h",
+ "//third_party/freetype/src/src/base/ftbase.c",
+ "//third_party/freetype/src/src/base/ftbase.h",
+ "//third_party/freetype/src/src/base/ftbitmap.c",
+ "//third_party/freetype/src/src/base/ftglyph.c",
+ "//third_party/freetype/src/src/base/ftinit.c",
+ "//third_party/freetype/src/src/base/ftlcdfil.c",
+ "//third_party/freetype/src/src/base/ftmm.c",
+ "//third_party/freetype/src/src/base/ftsystem.c",
+ "//third_party/freetype/src/src/cff/cff.c",
+ "//third_party/freetype/src/src/cff/cffobjs.h",
+ "//third_party/freetype/src/src/cff/cfftypes.h",
+ "//third_party/freetype/src/src/cid/type1cid.c",
+ "//third_party/freetype/src/src/psaux/psaux.c",
+ "//third_party/freetype/src/src/pshinter/pshinter.c",
+ "//third_party/freetype/src/src/psnames/psmodule.c",
+ "//third_party/freetype/src/src/raster/raster.c",
+ "//third_party/freetype/src/src/sfnt/sfnt.c",
+ "//third_party/freetype/src/src/smooth/smooth.c",
+ "//third_party/freetype/src/src/truetype/truetype.c",
+ "//third_party/freetype/src/src/type1/type1.c",
+ ]
+ if (pdf_use_skia || pdf_use_skia_paths) {
+ sources += [
+ "//third_party/freetype/src/include/freetype/ftfntfmt.h",
+ "//third_party/freetype/src/include/freetype/ftsynth.h",
+ "//third_party/freetype/src/src/base/ftfntfmt.c",
+ "//third_party/freetype/src/src/base/ftfstype.c",
+ "//third_party/freetype/src/src/base/fttype1.c",
+ ]
+ }
}
}
@@ -194,83 +280,42 @@ static_library("fx_lcms2") {
]
}
-# This is only used for standalone builds.
-config("jpeg_warnings") {
- visibility = [ ":*" ]
- if (is_clang) {
- cflags = [ "-Wno-shift-negative-value" ]
+if (!build_with_chromium) {
+ declare_args() {
+ # Uses system libjpeg. If true, overrides use_libjpeg_turbo.
+ use_system_libjpeg = false
+
+ # Uses libjpeg_turbo as the jpeg implementation. Has no effect if
+ # use_system_libjpeg is set.
+ use_libjpeg_turbo = true
}
-}
-static_library("jpeg") {
- configs -= [ "//build/config/compiler:chromium_code" ]
- configs += [
- "//build/config/compiler:no_chromium_code",
- ":pdfium_third_party_config",
+ config("system_libjpeg_config") {
+ libs = [ "jpeg" ]
+ defines = [ "USE_SYSTEM_LIBJPEG" ]
+ }
- # Must be after no_chromium_code for warning flags to be ordered correctly.
- ":jpeg_warnings",
- ]
- sources = [
- "libjpeg/cderror.h",
- "libjpeg/cdjpeg.h",
- "libjpeg/fpdfapi_jcapimin.c",
- "libjpeg/fpdfapi_jcapistd.c",
- "libjpeg/fpdfapi_jccoefct.c",
- "libjpeg/fpdfapi_jccolor.c",
- "libjpeg/fpdfapi_jcdctmgr.c",
- "libjpeg/fpdfapi_jchuff.c",
- "libjpeg/fpdfapi_jcinit.c",
- "libjpeg/fpdfapi_jcmainct.c",
- "libjpeg/fpdfapi_jcmarker.c",
- "libjpeg/fpdfapi_jcmaster.c",
- "libjpeg/fpdfapi_jcomapi.c",
- "libjpeg/fpdfapi_jcparam.c",
- "libjpeg/fpdfapi_jcphuff.c",
- "libjpeg/fpdfapi_jcprepct.c",
- "libjpeg/fpdfapi_jcsample.c",
- "libjpeg/fpdfapi_jctrans.c",
- "libjpeg/fpdfapi_jdapimin.c",
- "libjpeg/fpdfapi_jdapistd.c",
- "libjpeg/fpdfapi_jdcoefct.c",
- "libjpeg/fpdfapi_jdcolor.c",
- "libjpeg/fpdfapi_jddctmgr.c",
- "libjpeg/fpdfapi_jdhuff.c",
- "libjpeg/fpdfapi_jdinput.c",
- "libjpeg/fpdfapi_jdmainct.c",
- "libjpeg/fpdfapi_jdmarker.c",
- "libjpeg/fpdfapi_jdmaster.c",
- "libjpeg/fpdfapi_jdmerge.c",
- "libjpeg/fpdfapi_jdphuff.c",
- "libjpeg/fpdfapi_jdpostct.c",
- "libjpeg/fpdfapi_jdsample.c",
- "libjpeg/fpdfapi_jdtrans.c",
- "libjpeg/fpdfapi_jerror.c",
- "libjpeg/fpdfapi_jfdctfst.c",
- "libjpeg/fpdfapi_jfdctint.c",
- "libjpeg/fpdfapi_jidctfst.c",
- "libjpeg/fpdfapi_jidctint.c",
- "libjpeg/fpdfapi_jidctred.c",
- "libjpeg/fpdfapi_jmemmgr.c",
- "libjpeg/fpdfapi_jmemnobs.c",
- "libjpeg/fpdfapi_jutils.c",
- "libjpeg/jchuff.h",
- "libjpeg/jconfig.h",
- "libjpeg/jdct.h",
- "libjpeg/jdhuff.h",
- "libjpeg/jerror.h",
- "libjpeg/jinclude.h",
- "libjpeg/jmemsys.h",
- "libjpeg/jmorecfg.h",
- "libjpeg/jpegint.h",
- "libjpeg/jpeglib.h",
- "libjpeg/jversion.h",
- "libjpeg/makefile",
- "libjpeg/transupp.h",
- ]
- deps = [
- "..:fxcrt",
- ]
+ config("libjpeg_turbo_config") {
+ defines = [ "USE_LIBJPEG_TURBO=1" ]
+ }
+
+ # This is a meta target that forwards to the system's libjpeg,
+ # third_party/libjpeg, or third_party/libjpeg_turbo depending on the build args
+ # declared in this file.
+ group("jpeg") {
+ if (use_system_libjpeg) {
+ public_configs = [ ":system_libjpeg_config" ]
+ } else if (use_libjpeg_turbo) {
+ public_deps = [
+ "//third_party/libjpeg_turbo:libjpeg",
+ ]
+ public_configs = [ ":libjpeg_turbo_config" ]
+ } else {
+ public_deps = [
+ "//third_party/libjpeg:libjpeg",
+ ]
+ }
+ }
}
config("fx_libopenjpeg_warnings") {
@@ -349,6 +394,9 @@ static_library("fx_lpng") {
defines = []
cflags = []
+ deps = [
+ "//third_party/zlib",
+ ]
if (current_cpu == "x86" || current_cpu == "x64") {
sources += [
@@ -387,6 +435,7 @@ if (pdf_enable_xfa) {
}
deps = [
"//third_party:jpeg",
+ "//third_party/zlib",
]
sources = [
"libtiff/tif_aux.c",
@@ -430,43 +479,6 @@ if (pdf_enable_xfa) {
}
}
-# TODO(dsinclair): Remove if fixed upstream. https://crbug.com/507712
-config("fx_zlib_warnings") {
- visibility = [ ":*" ]
- if (is_clang) {
- cflags = [ "-Wno-shift-negative-value" ]
- }
-}
-
-static_library("fx_zlib") {
- configs -= [ "//build/config/compiler:chromium_code" ]
- configs += [
- "//build/config/compiler:no_chromium_code",
- ":pdfium_third_party_config",
-
- # Must be after no_chromium_code for warning flags to be ordered correctly.
- ":fx_zlib_warnings",
- ]
- sources = [
- "zlib_v128/adler32.c",
- "zlib_v128/compress.c",
- "zlib_v128/crc32.c",
- "zlib_v128/deflate.c",
- "zlib_v128/gzclose.c",
- "zlib_v128/gzlib.c",
- "zlib_v128/gzread.c",
- "zlib_v128/gzwrite.c",
- "zlib_v128/infback.c",
- "zlib_v128/inffast.c",
- "zlib_v128/inflate.c",
- "zlib_v128/inftrees.c",
- "zlib_v128/trees.c",
- "zlib_v128/uncompr.c",
- "zlib_v128/zutil.c",
- ]
-}
-
-# Can not be a static library due to lack of .cc files.
source_set("pdfium_base") {
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [
@@ -474,6 +486,18 @@ source_set("pdfium_base") {
":pdfium_third_party_config",
]
sources = [
+ "base/allocator/partition_allocator/address_space_randomization.cc",
+ "base/allocator/partition_allocator/address_space_randomization.h",
+ "base/allocator/partition_allocator/oom.h",
+ "base/allocator/partition_allocator/page_allocator.cc",
+ "base/allocator/partition_allocator/page_allocator.h",
+ "base/allocator/partition_allocator/partition_alloc.cc",
+ "base/allocator/partition_allocator/partition_alloc.h",
+ "base/allocator/partition_allocator/spin_lock.cc",
+ "base/allocator/partition_allocator/spin_lock.h",
+ "base/base_export.h",
+ "base/bits.h",
+ "base/compiler_specific.h",
"base/logging.h",
"base/macros.h",
"base/numerics/safe_conversions.h",
@@ -482,5 +506,8 @@ source_set("pdfium_base") {
"base/numerics/safe_math_impl.h",
"base/ptr_util.h",
"base/stl_util.h",
+ "base/sys_byteorder.h",
+ "base/template_util.h",
+ "build/build_config.h",
]
}
diff --git a/chromium/third_party/pdfium/third_party/DEPS b/chromium/third_party/pdfium/third_party/DEPS
index c2a3adde7b8..5f26a9665a1 100644
--- a/chromium/third_party/pdfium/third_party/DEPS
+++ b/chromium/third_party/pdfium/third_party/DEPS
@@ -4,4 +4,5 @@ include_rules = [
'+core/fxcrt/fx_coordinates.h',
'+core/fxcrt/fx_memory.h',
'+core/fxcrt/fx_system.h',
+ '+build',
]
diff --git a/chromium/third_party/pdfium/third_party/agg23/0000-bug-466.patch b/chromium/third_party/pdfium/third_party/agg23/0000-bug-466.patch
index 3217b3838a9..e761198a48b 100644
--- a/chromium/third_party/pdfium/third_party/agg23/0000-bug-466.patch
+++ b/chromium/third_party/pdfium/third_party/agg23/0000-bug-466.patch
@@ -4,7 +4,7 @@ index 6d7ba8a..2b06b1b 100644
+++ b/third_party/agg23/agg_math_stroke.h
@@ -60,28 +60,30 @@ void stroke_calc_arc(VertexConsumer& out_vertices,
}
- da = FXSYS_acos(width / (width + ((1.0f / 8) / approximation_scale))) * 2;
+ da = acos(width / (width + ((1.0f / 8) / approximation_scale))) * 2;
out_vertices.add(coord_type(x + dx1, y + dy1));
- if(!ccw) {
- if(a1 > a2) {
@@ -18,8 +18,8 @@ index 6d7ba8a..2b06b1b 100644
a1 += da;
- while(a1 < a2) {
+ while (a1 < a2) {
- out_vertices.add(coord_type(x + (width * FXSYS_cos(a1)),
- y + (width * FXSYS_sin(a1))));
+ out_vertices.add(coord_type(x + (width * cos(a1)),
+ y + (width * sin(a1))));
- a1 += da;
+ a1 += da;
}
@@ -34,8 +34,8 @@ index 6d7ba8a..2b06b1b 100644
a1 -= da;
- while(a1 > a2) {
+ while (a1 > a2) {
- out_vertices.add(coord_type(x + (width * FXSYS_cos(a1)),
- y + (width * FXSYS_sin(a1))));
+ out_vertices.add(coord_type(x + (width * cos(a1)),
+ y + (width * sin(a1))));
- a1 -= da;
+ a1 -= da;
}
diff --git a/chromium/third_party/pdfium/third_party/agg23/0001-gcc-warning.patch b/chromium/third_party/pdfium/third_party/agg23/0001-gcc-warning.patch
index 759696ef034..3bdce6578e1 100644
--- a/chromium/third_party/pdfium/third_party/agg23/0001-gcc-warning.patch
+++ b/chromium/third_party/pdfium/third_party/agg23/0001-gcc-warning.patch
@@ -4,7 +4,7 @@ index dc13851..7f21bac 100644
+++ b/third_party/agg23/agg_path_storage.h
@@ -38,9 +38,9 @@ public:
}
- unsigned vertex(FX_FLOAT* x, FX_FLOAT* y)
+ unsigned vertex(float* x, float* y)
{
- return (m_vertex_idx < m_path->total_vertices()) ?
- m_path->vertex(m_vertex_idx++, x, y) :
diff --git a/chromium/third_party/pdfium/third_party/agg23/0002-ubsan-error-fixes.patch b/chromium/third_party/pdfium/third_party/agg23/0002-ubsan-error-fixes.patch
index 00ced0071cd..58b17dc19cb 100644
--- a/chromium/third_party/pdfium/third_party/agg23/0002-ubsan-error-fixes.patch
+++ b/chromium/third_party/pdfium/third_party/agg23/0002-ubsan-error-fixes.patch
@@ -13,21 +13,21 @@ index db6ca97..5b1261f 100644
@@ -36,8 +37,18 @@ inline unsigned clip_liang_barsky(T x1, T y1, T x2, T y2,
T* x, T* y)
{
- const FX_FLOAT nearzero = 1e-30f;
-- FX_FLOAT deltax = (FX_FLOAT)(x2 - x1);
-- FX_FLOAT deltay = (FX_FLOAT)(y2 - y1);
+ const float nearzero = 1e-30f;
+- float deltax = (float)(x2 - x1);
+- float deltay = (float)(y2 - y1);
+
-+ pdfium::base::CheckedNumeric<FX_FLOAT> width = x2;
++ pdfium::base::CheckedNumeric<float> width = x2;
+ width -= x1;
+ if (!width.IsValid())
+ return 0;
-+ pdfium::base::CheckedNumeric<FX_FLOAT> height = y2;
++ pdfium::base::CheckedNumeric<float> height = y2;
+ height -= y1;
+ if (!height.IsValid())
+ return 0;
+
-+ FX_FLOAT deltax = width.ValueOrDefault(0);
-+ FX_FLOAT deltay = height.ValueOrDefault(0);
++ float deltax = width.ValueOrDefault(0);
++ float deltay = height.ValueOrDefault(0);
unsigned np = 0;
if(deltax == 0) {
deltax = (x1 > clip_box.x1) ? -nearzero : nearzero;
diff --git a/chromium/third_party/pdfium/third_party/agg23/agg_array.h b/chromium/third_party/pdfium/third_party/agg23/agg_array.h
index 204ae2e7a21..d521b046068 100644
--- a/chromium/third_party/pdfium/third_party/agg23/agg_array.h
+++ b/chromium/third_party/pdfium/third_party/agg23/agg_array.h
@@ -40,10 +40,7 @@ public:
}
void allocate(unsigned size, unsigned extra_tail = 0);
void resize(unsigned new_size);
- void zero()
- {
- FXSYS_memset(m_array, 0, sizeof(T) * m_size);
- }
+ void zero() { memset(m_array, 0, sizeof(T) * m_size); }
void add(const T& v)
{
m_array[m_size++] = v;
@@ -130,7 +127,7 @@ void pod_array<T>::resize(unsigned new_size)
if(new_size > m_size) {
if(new_size > m_capacity) {
T* data = FX_Alloc(T, new_size);
- FXSYS_memcpy(data, m_array, m_size * sizeof(T));
+ memcpy(data, m_array, m_size * sizeof(T));
FX_Free(m_array);
m_array = data;
}
@@ -145,14 +142,14 @@ template<class T> pod_array<T>::pod_array(const pod_array<T>& v) :
m_capacity(v.m_capacity),
m_array(v.m_capacity ? FX_Alloc(T, v.m_capacity) : 0)
{
- FXSYS_memcpy(m_array, v.m_array, sizeof(T) * v.m_size);
+ memcpy(m_array, v.m_array, sizeof(T) * v.m_size);
}
template<class T> const pod_array<T>&
pod_array<T>::operator = (const pod_array<T>&v)
{
allocate(v.m_size);
if(v.m_size) {
- FXSYS_memcpy(m_array, v.m_array, sizeof(T) * v.m_size);
+ memcpy(m_array, v.m_array, sizeof(T) * v.m_size);
}
return *this;
}
@@ -322,7 +319,7 @@ pod_deque<T, S>::pod_deque(const pod_deque<T, S>& v) :
unsigned i;
for(i = 0; i < v.m_num_blocks; ++i) {
m_blocks[i] = FX_Alloc(T, block_size);
- FXSYS_memcpy(m_blocks[i], v.m_blocks[i], block_size * sizeof(T));
+ memcpy(m_blocks[i], v.m_blocks[i], block_size * sizeof(T));
}
}
template<class T, unsigned S>
@@ -333,7 +330,7 @@ const pod_deque<T, S>& pod_deque<T, S>::operator = (const pod_deque<T, S>& v)
allocate_block(i);
}
for(i = 0; i < v.m_num_blocks; ++i) {
- FXSYS_memcpy(m_blocks[i], v.m_blocks[i], block_size * sizeof(T));
+ memcpy(m_blocks[i], v.m_blocks[i], block_size * sizeof(T));
}
m_size = v.m_size;
return *this;
@@ -344,10 +341,8 @@ void pod_deque<T, S>::allocate_block(unsigned nb)
if(nb >= m_max_blocks) {
T** new_blocks = FX_Alloc(T*, m_max_blocks + m_block_ptr_inc);
if(m_blocks) {
- FXSYS_memcpy(new_blocks,
- m_blocks,
- m_num_blocks * sizeof(T*));
- FX_Free(m_blocks);
+ memcpy(new_blocks, m_blocks, m_num_blocks * sizeof(T*));
+ FX_Free(m_blocks);
}
m_blocks = new_blocks;
m_max_blocks += m_block_ptr_inc;
@@ -476,10 +471,8 @@ private:
if(m_num_blocks >= m_max_blocks) {
int8u** new_blocks = FX_Alloc(int8u*, m_max_blocks + m_block_ptr_inc);
if(m_blocks) {
- FXSYS_memcpy(new_blocks,
- m_blocks,
- m_num_blocks * sizeof(int8u*));
- FX_Free(m_blocks);
+ memcpy(new_blocks, m_blocks, m_num_blocks * sizeof(int8u*));
+ FX_Free(m_blocks);
}
m_blocks = new_blocks;
m_max_blocks += m_block_ptr_inc;
diff --git a/chromium/third_party/pdfium/third_party/agg23/agg_basics.h b/chromium/third_party/pdfium/third_party/agg23/agg_basics.h
index 52a658ec96f..fc155561e01 100644
--- a/chromium/third_party/pdfium/third_party/agg23/agg_basics.h
+++ b/chromium/third_party/pdfium/third_party/agg23/agg_basics.h
@@ -41,7 +41,7 @@
#endif
#define AGG_INLINE inline
-#include "core/fxcrt/fx_system.h" // For FX_FLOAT
+#include "core/fxcrt/fx_system.h"
namespace agg
{
@@ -143,7 +143,7 @@ inline Rect unite_rectangles(const Rect& r1, const Rect& r2)
return r;
}
typedef rect_base<int> rect;
-typedef rect_base<FX_FLOAT> rect_d;
+typedef rect_base<float> rect_d;
enum path_commands_e {
path_cmd_stop = 0,
path_cmd_move_to = 1,
@@ -261,10 +261,10 @@ inline unsigned set_orientation(unsigned c, unsigned o)
return clear_orientation(c) | o;
}
struct point_type {
- FX_FLOAT x, y;
+ float x, y;
unsigned flag;
point_type() {}
- point_type(FX_FLOAT x_, FX_FLOAT y_, unsigned flag_ = 0) : x(x_), y(y_), flag(flag_) {}
+ point_type(float x_, float y_, unsigned flag_ = 0) : x(x_), y(y_), flag(flag_) {}
};
struct point_type_flag : public point_type {
unsigned flag;
@@ -272,13 +272,13 @@ struct point_type_flag : public point_type {
{
flag = 0;
}
- point_type_flag(FX_FLOAT x_, FX_FLOAT y_, unsigned flag_ = 0) : point_type(x_, y_), flag(flag_) {}
+ point_type_flag(float x_, float y_, unsigned flag_ = 0) : point_type(x_, y_), flag(flag_) {}
};
struct vertex_type {
- FX_FLOAT x, y;
+ float x, y;
unsigned cmd;
vertex_type() {}
- vertex_type(FX_FLOAT x_, FX_FLOAT y_, unsigned cmd_) :
+ vertex_type(float x_, float y_, unsigned cmd_) :
x(x_), y(y_), cmd(cmd_) {}
};
}
diff --git a/chromium/third_party/pdfium/third_party/agg23/agg_clip_liang_barsky.h b/chromium/third_party/pdfium/third_party/agg23/agg_clip_liang_barsky.h
index 5b1261f0040..31b35fe96eb 100644
--- a/chromium/third_party/pdfium/third_party/agg23/agg_clip_liang_barsky.h
+++ b/chromium/third_party/pdfium/third_party/agg23/agg_clip_liang_barsky.h
@@ -36,45 +36,45 @@ inline unsigned clip_liang_barsky(T x1, T y1, T x2, T y2,
const rect_base<T>& clip_box,
T* x, T* y)
{
- const FX_FLOAT nearzero = 1e-30f;
+ const float nearzero = 1e-30f;
- pdfium::base::CheckedNumeric<FX_FLOAT> width = x2;
+ pdfium::base::CheckedNumeric<float> width = x2;
width -= x1;
if (!width.IsValid())
return 0;
- pdfium::base::CheckedNumeric<FX_FLOAT> height = y2;
+ pdfium::base::CheckedNumeric<float> height = y2;
height -= y1;
if (!height.IsValid())
return 0;
- FX_FLOAT deltax = width.ValueOrDefault(0);
- FX_FLOAT deltay = height.ValueOrDefault(0);
+ float deltax = width.ValueOrDefault(0);
+ float deltay = height.ValueOrDefault(0);
unsigned np = 0;
if(deltax == 0) {
deltax = (x1 > clip_box.x1) ? -nearzero : nearzero;
}
- FX_FLOAT xin, xout;
+ float xin, xout;
if(deltax > 0) {
- xin = (FX_FLOAT)clip_box.x1;
- xout = (FX_FLOAT)clip_box.x2;
+ xin = (float)clip_box.x1;
+ xout = (float)clip_box.x2;
} else {
- xin = (FX_FLOAT)clip_box.x2;
- xout = (FX_FLOAT)clip_box.x1;
+ xin = (float)clip_box.x2;
+ xout = (float)clip_box.x1;
}
- FX_FLOAT tinx = (xin - x1) / deltax;
+ float tinx = (xin - x1) / deltax;
if(deltay == 0) {
deltay = (y1 > clip_box.y1) ? -nearzero : nearzero;
}
- FX_FLOAT yin, yout;
+ float yin, yout;
if(deltay > 0) {
- yin = (FX_FLOAT)clip_box.y1;
- yout = (FX_FLOAT)clip_box.y2;
+ yin = (float)clip_box.y1;
+ yout = (float)clip_box.y2;
} else {
- yin = (FX_FLOAT)clip_box.y2;
- yout = (FX_FLOAT)clip_box.y1;
+ yin = (float)clip_box.y2;
+ yout = (float)clip_box.y1;
}
- FX_FLOAT tiny = (yin - y1) / deltay;
- FX_FLOAT tin1, tin2;
+ float tiny = (yin - y1) / deltay;
+ float tin1, tin2;
if (tinx < tiny) {
tin1 = tinx;
tin2 = tiny;
@@ -89,9 +89,9 @@ inline unsigned clip_liang_barsky(T x1, T y1, T x2, T y2,
++np;
}
if(tin2 <= 1.0f) {
- FX_FLOAT toutx = (xout - x1) / deltax;
- FX_FLOAT touty = (yout - y1) / deltay;
- FX_FLOAT tout1 = (toutx < touty) ? toutx : touty;
+ float toutx = (xout - x1) / deltax;
+ float touty = (yout - y1) / deltay;
+ float tout1 = (toutx < touty) ? toutx : touty;
if (tin2 > 0 || tout1 > 0) {
if(tin2 <= tout1) {
if(tin2 > 0) {
diff --git a/chromium/third_party/pdfium/third_party/agg23/agg_conv_adaptor_vcgen.h b/chromium/third_party/pdfium/third_party/agg23/agg_conv_adaptor_vcgen.h
index 0d8d6ff99e0..be4dc2d6095 100644
--- a/chromium/third_party/pdfium/third_party/agg23/agg_conv_adaptor_vcgen.h
+++ b/chromium/third_party/pdfium/third_party/agg23/agg_conv_adaptor_vcgen.h
@@ -20,10 +20,10 @@ namespace agg
{
struct null_markers {
void remove_all() {}
- void add_vertex(FX_FLOAT, FX_FLOAT, unsigned) {}
+ void add_vertex(float, float, unsigned) {}
void prepare_src() {}
void rewind(unsigned) {}
- unsigned vertex(FX_FLOAT*, FX_FLOAT*)
+ unsigned vertex(float*, float*)
{
return path_cmd_stop;
}
@@ -67,7 +67,7 @@ public:
m_source->rewind(path_id);
m_status = initial;
}
- unsigned vertex(FX_FLOAT* x, FX_FLOAT* y);
+ unsigned vertex(float* x, float* y);
private:
conv_adaptor_vcgen(const conv_adaptor_vcgen<VertexSource, Generator, Markers>&);
const conv_adaptor_vcgen<VertexSource, Generator, Markers>&
@@ -77,11 +77,11 @@ private:
Markers m_markers;
status m_status;
unsigned m_last_cmd;
- FX_FLOAT m_start_x;
- FX_FLOAT m_start_y;
+ float m_start_x;
+ float m_start_y;
};
template<class VertexSource, class Generator, class Markers>
-unsigned conv_adaptor_vcgen<VertexSource, Generator, Markers>::vertex(FX_FLOAT* x, FX_FLOAT* y)
+unsigned conv_adaptor_vcgen<VertexSource, Generator, Markers>::vertex(float* x, float* y)
{
unsigned cmd = path_cmd_stop;
bool done = false;
diff --git a/chromium/third_party/pdfium/third_party/agg23/agg_conv_dash.h b/chromium/third_party/pdfium/third_party/agg23/agg_conv_dash.h
index 63b2019dde9..f87eccc3b12 100644
--- a/chromium/third_party/pdfium/third_party/agg23/agg_conv_dash.h
+++ b/chromium/third_party/pdfium/third_party/agg23/agg_conv_dash.h
@@ -36,15 +36,15 @@ struct conv_dash : public conv_adaptor_vcgen<VertexSource, vcgen_dash, Markers>
{
base_type::generator().remove_all_dashes();
}
- void add_dash(FX_FLOAT dash_len, FX_FLOAT gap_len)
+ void add_dash(float dash_len, float gap_len)
{
base_type::generator().add_dash(dash_len, gap_len);
}
- void dash_start(FX_FLOAT ds)
+ void dash_start(float ds)
{
base_type::generator().dash_start(ds);
}
- void shorten(FX_FLOAT s)
+ void shorten(float s)
{
base_type::generator().shorten(s);
}
diff --git a/chromium/third_party/pdfium/third_party/agg23/agg_conv_stroke.h b/chromium/third_party/pdfium/third_party/agg23/agg_conv_stroke.h
index 5a36bd73bb8..82268ddec66 100644
--- a/chromium/third_party/pdfium/third_party/agg23/agg_conv_stroke.h
+++ b/chromium/third_party/pdfium/third_party/agg23/agg_conv_stroke.h
@@ -57,47 +57,47 @@ struct conv_stroke :
{
return base_type::generator().inner_join();
}
- void width(FX_FLOAT w)
+ void width(float w)
{
base_type::generator().width(w);
}
- void miter_limit(FX_FLOAT ml)
+ void miter_limit(float ml)
{
base_type::generator().miter_limit(ml);
}
- void miter_limit_theta(FX_FLOAT t)
+ void miter_limit_theta(float t)
{
base_type::generator().miter_limit_theta(t);
}
- void inner_miter_limit(FX_FLOAT ml)
+ void inner_miter_limit(float ml)
{
base_type::generator().inner_miter_limit(ml);
}
- void approximation_scale(FX_FLOAT as)
+ void approximation_scale(float as)
{
base_type::generator().approximation_scale(as);
}
- FX_FLOAT width() const
+ float width() const
{
return base_type::generator().width();
}
- FX_FLOAT miter_limit() const
+ float miter_limit() const
{
return base_type::generator().miter_limit();
}
- FX_FLOAT inner_miter_limit() const
+ float inner_miter_limit() const
{
return base_type::generator().inner_miter_limit();
}
- FX_FLOAT approximation_scale() const
+ float approximation_scale() const
{
return base_type::generator().approximation_scale();
}
- void shorten(FX_FLOAT s)
+ void shorten(float s)
{
base_type::generator().shorten(s);
}
- FX_FLOAT shorten() const
+ float shorten() const
{
return base_type::generator().shorten();
}
diff --git a/chromium/third_party/pdfium/third_party/agg23/agg_curves.cpp b/chromium/third_party/pdfium/third_party/agg23/agg_curves.cpp
index b86cf630c39..483da701289 100644
--- a/chromium/third_party/pdfium/third_party/agg23/agg_curves.cpp
+++ b/chromium/third_party/pdfium/third_party/agg23/agg_curves.cpp
@@ -25,12 +25,12 @@
namespace agg
{
-const FX_FLOAT curve_collinearity_epsilon = 1e-30f;
+const float curve_collinearity_epsilon = 1e-30f;
enum curve_recursion_limit_e { curve_recursion_limit = 16 };
-void curve4_div::init(FX_FLOAT x1, FX_FLOAT y1,
- FX_FLOAT x2, FX_FLOAT y2,
- FX_FLOAT x3, FX_FLOAT y3,
- FX_FLOAT x4, FX_FLOAT y4)
+void curve4_div::init(float x1, float y1,
+ float x2, float y2,
+ float x3, float y3,
+ float x4, float y4)
{
m_points.remove_all();
m_distance_tolerance_square = 1.0f / 4;
@@ -38,40 +38,39 @@ void curve4_div::init(FX_FLOAT x1, FX_FLOAT y1,
bezier(x1, y1, x2, y2, x3, y3, x4, y4);
m_count = 0;
}
-void curve4_div::recursive_bezier(FX_FLOAT x1, FX_FLOAT y1,
- FX_FLOAT x2, FX_FLOAT y2,
- FX_FLOAT x3, FX_FLOAT y3,
- FX_FLOAT x4, FX_FLOAT y4,
+void curve4_div::recursive_bezier(float x1, float y1,
+ float x2, float y2,
+ float x3, float y3,
+ float x4, float y4,
unsigned level)
{
if(level > curve_recursion_limit) {
return;
}
- FX_FLOAT x12 = (x1 + x2) / 2;
- FX_FLOAT y12 = (y1 + y2) / 2;
- FX_FLOAT x23 = (x2 + x3) / 2;
- FX_FLOAT y23 = (y2 + y3) / 2;
- FX_FLOAT x34 = (x3 + x4) / 2;
- FX_FLOAT y34 = (y3 + y4) / 2;
- FX_FLOAT x123 = (x12 + x23) / 2;
- FX_FLOAT y123 = (y12 + y23) / 2;
- FX_FLOAT x234 = (x23 + x34) / 2;
- FX_FLOAT y234 = (y23 + y34) / 2;
- FX_FLOAT x1234 = (x123 + x234) / 2;
- FX_FLOAT y1234 = (y123 + y234) / 2;
- FX_FLOAT dx = x4 - x1;
- FX_FLOAT dy = y4 - y1;
- FX_FLOAT d2 = FXSYS_fabs(((x2 - x4) * dy) - ((y2 - y4) * dx));
- FX_FLOAT d3 = FXSYS_fabs(((x3 - x4) * dy) - ((y3 - y4) * dx));
+ float x12 = (x1 + x2) / 2;
+ float y12 = (y1 + y2) / 2;
+ float x23 = (x2 + x3) / 2;
+ float y23 = (y2 + y3) / 2;
+ float x34 = (x3 + x4) / 2;
+ float y34 = (y3 + y4) / 2;
+ float x123 = (x12 + x23) / 2;
+ float y123 = (y12 + y23) / 2;
+ float x234 = (x23 + x34) / 2;
+ float y234 = (y23 + y34) / 2;
+ float x1234 = (x123 + x234) / 2;
+ float y1234 = (y123 + y234) / 2;
+ float dx = x4 - x1;
+ float dy = y4 - y1;
+ float d2 = fabs(((x2 - x4) * dy) - ((y2 - y4) * dx));
+ float d3 = fabs(((x3 - x4) * dy) - ((y3 - y4) * dx));
switch((int(d2 > curve_collinearity_epsilon) << 1) +
int(d3 > curve_collinearity_epsilon)) {
case 0:
- if(FXSYS_fabs(x1 + x3 - x2 - x2) +
- FXSYS_fabs(y1 + y3 - y2 - y2) +
- FXSYS_fabs(x2 + x4 - x3 - x3) +
- FXSYS_fabs(y2 + y4 - y3 - y3) <= m_distance_tolerance_manhattan) {
- m_points.add(point_type(x1234, y1234, path_flags_jr));
- return;
+ if (fabs(x1 + x3 - x2 - x2) + fabs(y1 + y3 - y2 - y2) +
+ fabs(x2 + x4 - x3 - x3) + fabs(y2 + y4 - y3 - y3) <=
+ m_distance_tolerance_manhattan) {
+ m_points.add(point_type(x1234, y1234, path_flags_jr));
+ return;
}
break;
case 1:
@@ -99,10 +98,10 @@ void curve4_div::recursive_bezier(FX_FLOAT x1, FX_FLOAT y1,
recursive_bezier(x1, y1, x12, y12, x123, y123, x1234, y1234, level + 1);
recursive_bezier(x1234, y1234, x234, y234, x34, y34, x4, y4, level + 1);
}
-void curve4_div::bezier(FX_FLOAT x1, FX_FLOAT y1,
- FX_FLOAT x2, FX_FLOAT y2,
- FX_FLOAT x3, FX_FLOAT y3,
- FX_FLOAT x4, FX_FLOAT y4)
+void curve4_div::bezier(float x1, float y1,
+ float x2, float y2,
+ float x3, float y3,
+ float x4, float y4)
{
m_points.add(point_type(x1, y1));
recursive_bezier(x1, y1, x2, y2, x3, y3, x4, y4, 0);
diff --git a/chromium/third_party/pdfium/third_party/agg23/agg_curves.h b/chromium/third_party/pdfium/third_party/agg23/agg_curves.h
index 495f7a6a8f4..488db4a1ffa 100644
--- a/chromium/third_party/pdfium/third_party/agg23/agg_curves.h
+++ b/chromium/third_party/pdfium/third_party/agg23/agg_curves.h
@@ -20,12 +20,12 @@
namespace agg
{
struct curve4_points {
- FX_FLOAT cp[8];
+ float cp[8];
curve4_points() {}
- curve4_points(FX_FLOAT x1, FX_FLOAT y1,
- FX_FLOAT x2, FX_FLOAT y2,
- FX_FLOAT x3, FX_FLOAT y3,
- FX_FLOAT x4, FX_FLOAT y4)
+ curve4_points(float x1, float y1,
+ float x2, float y2,
+ float x3, float y3,
+ float x4, float y4)
{
cp[0] = x1;
cp[1] = y1;
@@ -36,10 +36,10 @@ struct curve4_points {
cp[6] = x4;
cp[7] = y4;
}
- void init(FX_FLOAT x1, FX_FLOAT y1,
- FX_FLOAT x2, FX_FLOAT y2,
- FX_FLOAT x3, FX_FLOAT y3,
- FX_FLOAT x4, FX_FLOAT y4)
+ void init(float x1, float y1,
+ float x2, float y2,
+ float x3, float y3,
+ float x4, float y4)
{
cp[0] = x1;
cp[1] = y1;
@@ -50,11 +50,11 @@ struct curve4_points {
cp[6] = x4;
cp[7] = y4;
}
- FX_FLOAT operator [] (unsigned i) const
+ float operator [] (unsigned i) const
{
return cp[i];
}
- FX_FLOAT& operator [] (unsigned i)
+ float& operator [] (unsigned i)
{
return cp[i];
}
@@ -65,10 +65,10 @@ public:
curve4_div() :
m_count(0)
{}
- curve4_div(FX_FLOAT x1, FX_FLOAT y1,
- FX_FLOAT x2, FX_FLOAT y2,
- FX_FLOAT x3, FX_FLOAT y3,
- FX_FLOAT x4, FX_FLOAT y4) :
+ curve4_div(float x1, float y1,
+ float x2, float y2,
+ float x3, float y3,
+ float x4, float y4) :
m_count(0)
{
init(x1, y1, x2, y2, x3, y3, x4, y4);
@@ -83,10 +83,10 @@ public:
m_points.remove_all();
m_count = 0;
}
- void init(FX_FLOAT x1, FX_FLOAT y1,
- FX_FLOAT x2, FX_FLOAT y2,
- FX_FLOAT x3, FX_FLOAT y3,
- FX_FLOAT x4, FX_FLOAT y4);
+ void init(float x1, float y1,
+ float x2, float y2,
+ float x3, float y3,
+ float x4, float y4);
void init(const curve4_points& cp)
{
init(cp[0], cp[1], cp[2], cp[3], cp[4], cp[5], cp[6], cp[7]);
@@ -95,7 +95,7 @@ public:
{
m_count = 0;
}
- unsigned vertex(FX_FLOAT* x, FX_FLOAT* y)
+ unsigned vertex(float* x, float* y)
{
if(m_count >= m_points.size()) {
return path_cmd_stop;
@@ -105,7 +105,7 @@ public:
*y = p.y;
return (m_count == 1) ? path_cmd_move_to : path_cmd_line_to;
}
- unsigned vertex_flag(FX_FLOAT* x, FX_FLOAT* y, int& flag)
+ unsigned vertex_flag(float* x, float* y, int& flag)
{
if(m_count >= m_points.size()) {
return path_cmd_stop;
@@ -121,17 +121,17 @@ public:
return m_points.size();
}
private:
- void bezier(FX_FLOAT x1, FX_FLOAT y1,
- FX_FLOAT x2, FX_FLOAT y2,
- FX_FLOAT x3, FX_FLOAT y3,
- FX_FLOAT x4, FX_FLOAT y4);
- void recursive_bezier(FX_FLOAT x1, FX_FLOAT y1,
- FX_FLOAT x2, FX_FLOAT y2,
- FX_FLOAT x3, FX_FLOAT y3,
- FX_FLOAT x4, FX_FLOAT y4,
+ void bezier(float x1, float y1,
+ float x2, float y2,
+ float x3, float y3,
+ float x4, float y4);
+ void recursive_bezier(float x1, float y1,
+ float x2, float y2,
+ float x3, float y3,
+ float x4, float y4,
unsigned level);
- FX_FLOAT m_distance_tolerance_square;
- FX_FLOAT m_distance_tolerance_manhattan;
+ float m_distance_tolerance_square;
+ float m_distance_tolerance_manhattan;
unsigned m_count;
pod_deque<point_type> m_points;
};
@@ -139,10 +139,10 @@ class curve4
{
public:
curve4() {}
- curve4(FX_FLOAT x1, FX_FLOAT y1,
- FX_FLOAT x2, FX_FLOAT y2,
- FX_FLOAT x3, FX_FLOAT y3,
- FX_FLOAT x4, FX_FLOAT y4)
+ curve4(float x1, float y1,
+ float x2, float y2,
+ float x3, float y3,
+ float x4, float y4)
{
init(x1, y1, x2, y2, x3, y3, x4, y4);
}
@@ -154,10 +154,10 @@ public:
{
m_curve_div.reset();
}
- void init(FX_FLOAT x1, FX_FLOAT y1,
- FX_FLOAT x2, FX_FLOAT y2,
- FX_FLOAT x3, FX_FLOAT y3,
- FX_FLOAT x4, FX_FLOAT y4)
+ void init(float x1, float y1,
+ float x2, float y2,
+ float x3, float y3,
+ float x4, float y4)
{
m_curve_div.init(x1, y1, x2, y2, x3, y3, x4, y4);
}
@@ -169,11 +169,11 @@ public:
{
m_curve_div.rewind(path_id);
}
- unsigned vertex(FX_FLOAT* x, FX_FLOAT* y)
+ unsigned vertex(float* x, float* y)
{
return m_curve_div.vertex(x, y);
}
- unsigned vertex_curve_flag(FX_FLOAT* x, FX_FLOAT* y, int& flag)
+ unsigned vertex_curve_flag(float* x, float* y, int& flag)
{
return m_curve_div.vertex_flag(x, y, flag);
}
diff --git a/chromium/third_party/pdfium/third_party/agg23/agg_math.h b/chromium/third_party/pdfium/third_party/agg23/agg_math.h
index e003297dfff..6d5e39ac3e4 100644
--- a/chromium/third_party/pdfium/third_party/agg23/agg_math.h
+++ b/chromium/third_party/pdfium/third_party/agg23/agg_math.h
@@ -21,39 +21,39 @@
#include "agg_basics.h"
namespace agg
{
-const FX_FLOAT intersection_epsilon = 1.0e-30f;
-AGG_INLINE FX_FLOAT calc_point_location(FX_FLOAT x1, FX_FLOAT y1,
- FX_FLOAT x2, FX_FLOAT y2,
- FX_FLOAT x, FX_FLOAT y)
+const float intersection_epsilon = 1.0e-30f;
+AGG_INLINE float calc_point_location(float x1, float y1,
+ float x2, float y2,
+ float x, float y)
{
return ((x - x2) * (y2 - y1)) - ((y - y2) * (x2 - x1));
}
-AGG_INLINE FX_FLOAT calc_distance(FX_FLOAT x1, FX_FLOAT y1, FX_FLOAT x2, FX_FLOAT y2)
+AGG_INLINE float calc_distance(float x1, float y1, float x2, float y2)
{
- FX_FLOAT dx = x2 - x1;
- FX_FLOAT dy = y2 - y1;
+ float dx = x2 - x1;
+ float dy = y2 - y1;
return FXSYS_sqrt2(dx, dy);
}
-AGG_INLINE FX_FLOAT calc_line_point_distance(FX_FLOAT x1, FX_FLOAT y1,
- FX_FLOAT x2, FX_FLOAT y2,
- FX_FLOAT x, FX_FLOAT y)
+AGG_INLINE float calc_line_point_distance(float x1, float y1,
+ float x2, float y2,
+ float x, float y)
{
- FX_FLOAT dx = x2 - x1;
- FX_FLOAT dy = y2 - y1;
- FX_FLOAT d = FXSYS_sqrt2(dx, dy);
+ float dx = x2 - x1;
+ float dy = y2 - y1;
+ float d = FXSYS_sqrt2(dx, dy);
if(d < intersection_epsilon) {
return calc_distance(x1, y1, x, y);
}
return ((x - x2) * dy / d) - ((y - y2) * dx / d);
}
-AGG_INLINE bool calc_intersection(FX_FLOAT ax, FX_FLOAT ay, FX_FLOAT bx, FX_FLOAT by,
- FX_FLOAT cx, FX_FLOAT cy, FX_FLOAT dx, FX_FLOAT dy,
- FX_FLOAT* x, FX_FLOAT* y)
+AGG_INLINE bool calc_intersection(float ax, float ay, float bx, float by,
+ float cx, float cy, float dx, float dy,
+ float* x, float* y)
{
- FX_FLOAT num = ((ay - cy) * (dx - cx)) - ((ax - cx) * (dy - cy));
- FX_FLOAT den = ((bx - ax) * (dy - cy)) - ((by - ay) * (dx - cx));
- if (FXSYS_fabs(den) < intersection_epsilon) {
- return false;
+ float num = ((ay - cy) * (dx - cx)) - ((ax - cx) * (dy - cy));
+ float den = ((bx - ax) * (dy - cy)) - ((by - ay) * (dx - cx));
+ if (fabs(den) < intersection_epsilon) {
+ return false;
}
*x = ax + ((bx - ax) * num / den);
*y = ay + ((by - ay) * num / den);
diff --git a/chromium/third_party/pdfium/third_party/agg23/agg_math_stroke.h b/chromium/third_party/pdfium/third_party/agg23/agg_math_stroke.h
index 2b06b1bfda7..82df8080cf2 100644
--- a/chromium/third_party/pdfium/third_party/agg23/agg_math_stroke.h
+++ b/chromium/third_party/pdfium/third_party/agg23/agg_math_stroke.h
@@ -41,24 +41,24 @@ enum inner_join_e {
inner_jag,
inner_round
};
-const FX_FLOAT stroke_theta = 1.0f / 1000.0f;
+const float stroke_theta = 1.0f / 1000.0f;
template<class VertexConsumer>
void stroke_calc_arc(VertexConsumer& out_vertices,
- FX_FLOAT x, FX_FLOAT y,
- FX_FLOAT dx1, FX_FLOAT dy1,
- FX_FLOAT dx2, FX_FLOAT dy2,
- FX_FLOAT width,
- FX_FLOAT approximation_scale)
+ float x, float y,
+ float dx1, float dy1,
+ float dx2, float dy2,
+ float width,
+ float approximation_scale)
{
typedef typename VertexConsumer::value_type coord_type;
- FX_FLOAT a1 = FXSYS_atan2(dy1, dx1);
- FX_FLOAT a2 = FXSYS_atan2(dy2, dx2);
- FX_FLOAT da = a1 - a2;
+ float a1 = atan2(dy1, dx1);
+ float a2 = atan2(dy2, dx2);
+ float da = a1 - a2;
bool ccw = da > 0 && da < FX_PI;
if(width < 0) {
width = -width;
}
- da = FXSYS_acos(width / (width + ((1.0f / 8) / approximation_scale))) * 2;
+ da = acos(width / (width + ((1.0f / 8) / approximation_scale))) * 2;
out_vertices.add(coord_type(x + dx1, y + dy1));
if (da > 0) {
if (!ccw) {
@@ -68,8 +68,8 @@ void stroke_calc_arc(VertexConsumer& out_vertices,
a2 -= da / 4;
a1 += da;
while (a1 < a2) {
- out_vertices.add(coord_type(x + (width * FXSYS_cos(a1)),
- y + (width * FXSYS_sin(a1))));
+ out_vertices.add(
+ coord_type(x + (width * cos(a1)), y + (width * sin(a1))));
a1 += da;
}
} else {
@@ -79,8 +79,8 @@ void stroke_calc_arc(VertexConsumer& out_vertices,
a2 += da / 4;
a1 -= da;
while (a1 > a2) {
- out_vertices.add(coord_type(x + (width * FXSYS_cos(a1)),
- y + (width * FXSYS_sin(a1))));
+ out_vertices.add(
+ coord_type(x + (width * cos(a1)), y + (width * sin(a1))));
a1 -= da;
}
}
@@ -92,31 +92,31 @@ void stroke_calc_miter(VertexConsumer& out_vertices,
const vertex_dist& v0,
const vertex_dist& v1,
const vertex_dist& v2,
- FX_FLOAT dx1, FX_FLOAT dy1,
- FX_FLOAT dx2, FX_FLOAT dy2,
- FX_FLOAT width,
+ float dx1, float dy1,
+ float dx2, float dy2,
+ float width,
line_join_e line_join,
- FX_FLOAT miter_limit,
- FX_FLOAT approximation_scale)
+ float miter_limit,
+ float approximation_scale)
{
typedef typename VertexConsumer::value_type coord_type;
- FX_FLOAT xi = v1.x;
- FX_FLOAT yi = v1.y;
+ float xi = v1.x;
+ float yi = v1.y;
bool miter_limit_exceeded = true;
if(calc_intersection(v0.x + dx1, v0.y - dy1,
v1.x + dx1, v1.y - dy1,
v1.x + dx2, v1.y - dy2,
v2.x + dx2, v2.y - dy2,
&xi, &yi)) {
- FX_FLOAT d1 = calc_distance(v1.x, v1.y, xi, yi);
- FX_FLOAT lim = width * miter_limit;
+ float d1 = calc_distance(v1.x, v1.y, xi, yi);
+ float lim = width * miter_limit;
if(d1 <= lim) {
out_vertices.add(coord_type(xi, yi));
miter_limit_exceeded = false;
}
} else {
- FX_FLOAT x2 = v1.x + dx1;
- FX_FLOAT y2 = v1.y - dy1;
+ float x2 = v1.x + dx1;
+ float y2 = v1.y - dy1;
if ((((x2 - v0.x) * dy1) - ((v0.y - y2) * dx1) < 0) !=
(((x2 - v2.x) * dy1) - ((v2.y - y2) * dx1) < 0)) {
out_vertices.add(coord_type(v1.x + dx1, v1.y - dy1));
@@ -147,17 +147,17 @@ template<class VertexConsumer>
void stroke_calc_cap(VertexConsumer& out_vertices,
const vertex_dist& v0,
const vertex_dist& v1,
- FX_FLOAT len,
+ float len,
line_cap_e line_cap,
- FX_FLOAT width,
- FX_FLOAT approximation_scale)
+ float width,
+ float approximation_scale)
{
typedef typename VertexConsumer::value_type coord_type;
out_vertices.remove_all();
- FX_FLOAT dx1 = (v1.y - v0.y) / len;
- FX_FLOAT dy1 = (v1.x - v0.x) / len;
- FX_FLOAT dx2 = 0;
- FX_FLOAT dy2 = 0;
+ float dx1 = (v1.y - v0.y) / len;
+ float dy1 = (v1.x - v0.x) / len;
+ float dx2 = 0;
+ float dy2 = 0;
dx1 = dx1 * width;
dy1 = dy1 * width;
if(line_cap != round_cap) {
@@ -168,18 +168,16 @@ void stroke_calc_cap(VertexConsumer& out_vertices,
out_vertices.add(coord_type(v0.x - dx1 - dx2, v0.y + dy1 - dy2));
out_vertices.add(coord_type(v0.x + dx1 - dx2, v0.y - dy1 - dy2));
} else {
- FX_FLOAT a1 = FXSYS_atan2(dy1, -dx1);
- FX_FLOAT a2 = a1 + FX_PI;
- FX_FLOAT da =
- FXSYS_acos(width / (width + ((1.0f / 8) / approximation_scale))) *
- 2;
- out_vertices.add(coord_type(v0.x - dx1, v0.y + dy1));
+ float a1 = atan2(dy1, -dx1);
+ float a2 = a1 + FX_PI;
+ float da = acos(width / (width + ((1.0f / 8) / approximation_scale))) * 2;
+ out_vertices.add(coord_type(v0.x - dx1, v0.y + dy1));
+ a1 += da;
+ a2 -= da / 4;
+ while (a1 < a2) {
+ out_vertices.add(
+ coord_type(v0.x + (width * cos(a1)), v0.y + (width * sin(a1))));
a1 += da;
- a2 -= da / 4;
- while(a1 < a2) {
- out_vertices.add(coord_type(v0.x + (width * FXSYS_cos(a1)),
- v0.y + (width * FXSYS_sin(a1))));
- a1 += da;
}
out_vertices.add(coord_type(v0.x + dx1, v0.y - dy1));
}
@@ -189,17 +187,17 @@ void stroke_calc_join(VertexConsumer& out_vertices,
const vertex_dist& v0,
const vertex_dist& v1,
const vertex_dist& v2,
- FX_FLOAT len1,
- FX_FLOAT len2,
- FX_FLOAT width,
+ float len1,
+ float len2,
+ float width,
line_join_e line_join,
inner_join_e inner_join,
- FX_FLOAT miter_limit,
- FX_FLOAT inner_miter_limit,
- FX_FLOAT approximation_scale)
+ float miter_limit,
+ float inner_miter_limit,
+ float approximation_scale)
{
typedef typename VertexConsumer::value_type coord_type;
- FX_FLOAT dx1, dy1, dx2, dy2;
+ float dx1, dy1, dx2, dy2;
dx1 = width * (v1.y - v0.y) / len1;
dy1 = width * (v1.x - v0.x) / len1;
dx2 = width * (v2.y - v1.y) / len2;
@@ -221,7 +219,7 @@ void stroke_calc_join(VertexConsumer& out_vertices,
break;
case inner_jag:
case inner_round: {
- FX_FLOAT d = (dx1 - dx2) * (dx1 - dx2) + (dy1 - dy2) * (dy1 - dy2);
+ float d = (dx1 - dx2) * (dx1 - dx2) + (dy1 - dy2) * (dy1 - dy2);
if(d < len1 * len1 && d < len2 * len2) {
stroke_calc_miter(out_vertices,
v0, v1, v2, dx1, dy1, dx2, dy2,
diff --git a/chromium/third_party/pdfium/third_party/agg23/agg_path_storage.cpp b/chromium/third_party/pdfium/third_party/agg23/agg_path_storage.cpp
index 968746738a6..c24f7952ba2 100644
--- a/chromium/third_party/pdfium/third_party/agg23/agg_path_storage.cpp
+++ b/chromium/third_party/pdfium/third_party/agg23/agg_path_storage.cpp
@@ -32,7 +32,7 @@ namespace agg
path_storage::~path_storage()
{
if(m_total_blocks) {
- FX_FLOAT** coord_blk = m_coord_blocks + m_total_blocks - 1;
+ float** coord_blk = m_coord_blocks + m_total_blocks - 1;
while(m_total_blocks--) {
FX_Free(*coord_blk);
--coord_blk;
@@ -52,27 +52,23 @@ path_storage::path_storage() :
void path_storage::allocate_block(unsigned nb)
{
if(nb >= m_max_blocks) {
- FX_FLOAT** new_coords =
- FX_Alloc2D(FX_FLOAT*, m_max_blocks + block_pool, 2);
+ float** new_coords =
+ FX_Alloc2D(float*, m_max_blocks + block_pool, 2);
unsigned char** new_cmds =
(unsigned char**)(new_coords + m_max_blocks + block_pool);
if(m_coord_blocks) {
- FXSYS_memcpy(new_coords,
- m_coord_blocks,
- m_max_blocks * sizeof(FX_FLOAT*));
- FXSYS_memcpy(new_cmds,
- m_cmd_blocks,
- m_max_blocks * sizeof(unsigned char*));
- FX_Free(m_coord_blocks);
+ memcpy(new_coords, m_coord_blocks, m_max_blocks * sizeof(float*));
+ memcpy(new_cmds, m_cmd_blocks, m_max_blocks * sizeof(unsigned char*));
+ FX_Free(m_coord_blocks);
}
m_coord_blocks = new_coords;
m_cmd_blocks = new_cmds;
m_max_blocks += block_pool;
}
m_coord_blocks[nb] =
- FX_Alloc( FX_FLOAT, block_size * 2 +
+ FX_Alloc( float, block_size * 2 +
block_size /
- (sizeof(FX_FLOAT) / sizeof(unsigned char)));
+ (sizeof(float) / sizeof(unsigned char)));
m_cmd_blocks[nb] =
(unsigned char*)(m_coord_blocks[nb] + block_size * 2);
m_total_blocks++;
@@ -81,9 +77,9 @@ void path_storage::rewind(unsigned path_id)
{
m_iterator = path_id;
}
-void path_storage::curve4(FX_FLOAT x_ctrl1, FX_FLOAT y_ctrl1,
- FX_FLOAT x_ctrl2, FX_FLOAT y_ctrl2,
- FX_FLOAT x_to, FX_FLOAT y_to)
+void path_storage::curve4(float x_ctrl1, float y_ctrl1,
+ float x_ctrl2, float y_ctrl2,
+ float x_to, float y_to)
{
add_vertex(x_ctrl1, y_ctrl1, path_cmd_curve4);
add_vertex(x_ctrl2, y_ctrl2, path_cmd_curve4);
diff --git a/chromium/third_party/pdfium/third_party/agg23/agg_path_storage.h b/chromium/third_party/pdfium/third_party/agg23/agg_path_storage.h
index 7f21bacd09c..17e82d73e4c 100644
--- a/chromium/third_party/pdfium/third_party/agg23/agg_path_storage.h
+++ b/chromium/third_party/pdfium/third_party/agg23/agg_path_storage.h
@@ -36,7 +36,7 @@ public:
{
m_vertex_idx = path_id;
}
- unsigned vertex(FX_FLOAT* x, FX_FLOAT* y)
+ unsigned vertex(float* x, float* y)
{
return (m_vertex_idx < m_path->total_vertices())
? m_path->vertex(m_vertex_idx++, x, y)
@@ -48,19 +48,19 @@ public:
};
~path_storage();
path_storage();
- unsigned last_vertex(FX_FLOAT* x, FX_FLOAT* y) const;
- unsigned prev_vertex(FX_FLOAT* x, FX_FLOAT* y) const;
- void move_to(FX_FLOAT x, FX_FLOAT y);
- void line_to(FX_FLOAT x, FX_FLOAT y);
- void curve4(FX_FLOAT x_ctrl1, FX_FLOAT y_ctrl1,
- FX_FLOAT x_ctrl2, FX_FLOAT y_ctrl2,
- FX_FLOAT x_to, FX_FLOAT y_to);
+ unsigned last_vertex(float* x, float* y) const;
+ unsigned prev_vertex(float* x, float* y) const;
+ void move_to(float x, float y);
+ void line_to(float x, float y);
+ void curve4(float x_ctrl1, float y_ctrl1,
+ float x_ctrl2, float y_ctrl2,
+ float x_to, float y_to);
template<class VertexSource>
void add_path(VertexSource& vs,
unsigned path_id = 0,
bool solid_path = true)
{
- FX_FLOAT x, y;
+ float x, y;
unsigned cmd;
vs.rewind(path_id);
while(!is_stop(cmd = vs.vertex(&x, &y))) {
@@ -75,7 +75,7 @@ public:
unsigned path_id = 0,
bool solid_path = true)
{
- FX_FLOAT x, y;
+ float x, y;
unsigned cmd;
int flag;
vs.rewind(path_id);
@@ -90,10 +90,10 @@ public:
{
return m_total_vertices;
}
- unsigned vertex(unsigned idx, FX_FLOAT* x, FX_FLOAT* y) const
+ unsigned vertex(unsigned idx, float* x, float* y) const
{
unsigned nb = idx >> block_shift;
- const FX_FLOAT* pv = m_coord_blocks[nb] + ((idx & block_mask) << 1);
+ const float* pv = m_coord_blocks[nb] + ((idx & block_mask) << 1);
*x = *pv++;
*y = *pv;
return m_cmd_blocks[nb][idx & block_mask];
@@ -107,42 +107,42 @@ public:
return m_cmd_blocks[idx >> block_shift][idx & block_mask] & path_flags_jr;
}
void rewind(unsigned path_id);
- unsigned vertex(FX_FLOAT* x, FX_FLOAT* y);
- void add_vertex(FX_FLOAT x, FX_FLOAT y, unsigned cmd);
+ unsigned vertex(float* x, float* y);
+ void add_vertex(float x, float y, unsigned cmd);
void end_poly();
private:
void allocate_block(unsigned nb);
- unsigned char* storage_ptrs(FX_FLOAT** xy_ptr);
+ unsigned char* storage_ptrs(float** xy_ptr);
private:
unsigned m_total_vertices;
unsigned m_total_blocks;
unsigned m_max_blocks;
- FX_FLOAT** m_coord_blocks;
+ float** m_coord_blocks;
unsigned char** m_cmd_blocks;
unsigned m_iterator;
};
-inline unsigned path_storage::vertex(FX_FLOAT* x, FX_FLOAT* y)
+inline unsigned path_storage::vertex(float* x, float* y)
{
if(m_iterator >= m_total_vertices) {
return path_cmd_stop;
}
return vertex(m_iterator++, x, y);
}
-inline unsigned path_storage::prev_vertex(FX_FLOAT* x, FX_FLOAT* y) const
+inline unsigned path_storage::prev_vertex(float* x, float* y) const
{
if(m_total_vertices > 1) {
return vertex(m_total_vertices - 2, x, y);
}
return path_cmd_stop;
}
-inline unsigned path_storage::last_vertex(FX_FLOAT* x, FX_FLOAT* y) const
+inline unsigned path_storage::last_vertex(float* x, float* y) const
{
if(m_total_vertices) {
return vertex(m_total_vertices - 1, x, y);
}
return path_cmd_stop;
}
-inline unsigned char* path_storage::storage_ptrs(FX_FLOAT** xy_ptr)
+inline unsigned char* path_storage::storage_ptrs(float** xy_ptr)
{
unsigned nb = m_total_vertices >> block_shift;
if(nb >= m_total_blocks) {
@@ -151,20 +151,20 @@ inline unsigned char* path_storage::storage_ptrs(FX_FLOAT** xy_ptr)
*xy_ptr = m_coord_blocks[nb] + ((m_total_vertices & block_mask) << 1);
return m_cmd_blocks[nb] + (m_total_vertices & block_mask);
}
-inline void path_storage::add_vertex(FX_FLOAT x, FX_FLOAT y, unsigned cmd)
+inline void path_storage::add_vertex(float x, float y, unsigned cmd)
{
- FX_FLOAT* coord_ptr = 0;
+ float* coord_ptr = 0;
unsigned char* cmd_ptr = storage_ptrs(&coord_ptr);
*cmd_ptr = (unsigned char)cmd;
*coord_ptr++ = x;
*coord_ptr = y;
m_total_vertices++;
}
-inline void path_storage::move_to(FX_FLOAT x, FX_FLOAT y)
+inline void path_storage::move_to(float x, float y)
{
add_vertex(x, y, path_cmd_move_to);
}
-inline void path_storage::line_to(FX_FLOAT x, FX_FLOAT y)
+inline void path_storage::line_to(float x, float y)
{
add_vertex(x, y, path_cmd_line_to);
}
diff --git a/chromium/third_party/pdfium/third_party/agg23/agg_rasterizer_scanline_aa.cpp b/chromium/third_party/pdfium/third_party/agg23/agg_rasterizer_scanline_aa.cpp
index af6dd58fe30..c90bdafdd07 100644
--- a/chromium/third_party/pdfium/third_party/agg23/agg_rasterizer_scanline_aa.cpp
+++ b/chromium/third_party/pdfium/third_party/agg23/agg_rasterizer_scanline_aa.cpp
@@ -118,8 +118,8 @@ void outline_aa::allocate_block()
if(m_num_blocks >= m_max_blocks) {
cell_aa** new_cells = FX_Alloc( cell_aa*, m_max_blocks + cell_block_pool);
if(m_cells) {
- FXSYS_memcpy(new_cells, m_cells, m_max_blocks * sizeof(cell_aa*));
- FX_Free(m_cells);
+ memcpy(new_cells, m_cells, m_max_blocks * sizeof(cell_aa*));
+ FX_Free(m_cells);
}
m_cells = new_cells;
m_max_blocks += cell_block_pool;
diff --git a/chromium/third_party/pdfium/third_party/agg23/agg_rasterizer_scanline_aa.h b/chromium/third_party/pdfium/third_party/agg23/agg_rasterizer_scanline_aa.h
index fc28290f549..c747ee379e9 100644
--- a/chromium/third_party/pdfium/third_party/agg23/agg_rasterizer_scanline_aa.h
+++ b/chromium/third_party/pdfium/third_party/agg23/agg_rasterizer_scanline_aa.h
@@ -45,7 +45,7 @@ enum poly_base_scale_e {
poly_base_size = 1 << poly_base_shift,
poly_base_mask = poly_base_size - 1
};
-inline int poly_coord(FX_FLOAT c)
+inline int poly_coord(float c)
{
return int(c * poly_base_size);
}
@@ -219,14 +219,14 @@ public:
m_outline.reset();
m_status = status_initial;
}
- void clip_box(FX_FLOAT x1, FX_FLOAT y1, FX_FLOAT x2, FX_FLOAT y2)
+ void clip_box(float x1, float y1, float x2, float y2)
{
m_clip_box = rect(poly_coord(x1), poly_coord(y1),
poly_coord(x2), poly_coord(y2));
m_clip_box.normalize();
m_clipping = true;
}
- void add_vertex(FX_FLOAT x, FX_FLOAT y, unsigned cmd)
+ void add_vertex(float x, float y, unsigned cmd)
{
if(is_close(cmd)) {
close_polygon();
@@ -374,8 +374,8 @@ public:
template<class VertexSource>
void add_path(VertexSource& vs, unsigned path_id = 0)
{
- FX_FLOAT x;
- FX_FLOAT y;
+ float x;
+ float y;
unsigned cmd;
vs.rewind(path_id);
while(!is_stop(cmd = vs.vertex(&x, &y))) {
@@ -385,8 +385,8 @@ public:
template<class VertexSource>
void add_path_transformed(VertexSource& vs, const CFX_Matrix* pMatrix, unsigned path_id = 0)
{
- FX_FLOAT x;
- FX_FLOAT y;
+ float x;
+ float y;
unsigned cmd;
vs.rewind(path_id);
while(!is_stop(cmd = vs.vertex(&x, &y))) {
diff --git a/chromium/third_party/pdfium/third_party/agg23/agg_scanline_u.h b/chromium/third_party/pdfium/third_party/agg23/agg_scanline_u.h
index 21001153290..844dc9aad35 100644
--- a/chromium/third_party/pdfium/third_party/agg23/agg_scanline_u.h
+++ b/chromium/third_party/pdfium/third_party/agg23/agg_scanline_u.h
@@ -83,7 +83,7 @@ public:
void add_cells(int x, unsigned len, const CoverT* covers)
{
x -= m_min_x;
- FXSYS_memcpy(m_covers + x, covers, len * sizeof(CoverT));
+ memcpy(m_covers + x, covers, len * sizeof(CoverT));
if(x == m_last_x + 1) {
m_cur_span->len += (coord_type)len;
} else {
@@ -97,7 +97,7 @@ public:
void add_span(int x, unsigned len, unsigned cover)
{
x -= m_min_x;
- FXSYS_memset(m_covers + x, cover, len);
+ memset(m_covers + x, cover, len);
if(x == m_last_x + 1) {
m_cur_span->len += (coord_type)len;
} else {
diff --git a/chromium/third_party/pdfium/third_party/agg23/agg_shorten_path.h b/chromium/third_party/pdfium/third_party/agg23/agg_shorten_path.h
index d7eb4be018c..2f62ec52d2f 100644
--- a/chromium/third_party/pdfium/third_party/agg23/agg_shorten_path.h
+++ b/chromium/third_party/pdfium/third_party/agg23/agg_shorten_path.h
@@ -20,11 +20,11 @@
namespace agg
{
template<class VertexSequence>
-void shorten_path(VertexSequence& vs, FX_FLOAT s, unsigned closed = 0)
+void shorten_path(VertexSequence& vs, float s, unsigned closed = 0)
{
typedef typename VertexSequence::value_type vertex_type;
if(s > 0 && vs.size() > 1) {
- FX_FLOAT d;
+ float d;
int n = int(vs.size() - 2);
while(n) {
d = vs[n].dist;
@@ -42,8 +42,8 @@ void shorten_path(VertexSequence& vs, FX_FLOAT s, unsigned closed = 0)
vertex_type& prev = vs[n - 1];
vertex_type& last = vs[n];
d = (prev.dist - s) / prev.dist;
- FX_FLOAT x = prev.x + (last.x - prev.x) * d;
- FX_FLOAT y = prev.y + (last.y - prev.y) * d;
+ float x = prev.x + (last.x - prev.x) * d;
+ float y = prev.y + (last.y - prev.y) * d;
last.x = x;
last.y = y;
if(!prev(last)) {
diff --git a/chromium/third_party/pdfium/third_party/agg23/agg_vcgen_dash.cpp b/chromium/third_party/pdfium/third_party/agg23/agg_vcgen_dash.cpp
index bd5a2122a22..74fd901181e 100644
--- a/chromium/third_party/pdfium/third_party/agg23/agg_vcgen_dash.cpp
+++ b/chromium/third_party/pdfium/third_party/agg23/agg_vcgen_dash.cpp
@@ -44,7 +44,7 @@ void vcgen_dash::remove_all_dashes()
m_curr_dash_start = 0;
m_curr_dash = 0;
}
-void vcgen_dash::add_dash(FX_FLOAT dash_len, FX_FLOAT gap_len)
+void vcgen_dash::add_dash(float dash_len, float gap_len)
{
if(m_num_dashes < max_dashes) {
m_total_dash_len += dash_len + gap_len;
@@ -52,12 +52,12 @@ void vcgen_dash::add_dash(FX_FLOAT dash_len, FX_FLOAT gap_len)
m_dashes[m_num_dashes++] = gap_len;
}
}
-void vcgen_dash::dash_start(FX_FLOAT ds)
+void vcgen_dash::dash_start(float ds)
{
m_dash_start = ds;
- calc_dash_start(FXSYS_fabs(ds));
+ calc_dash_start(fabs(ds));
}
-void vcgen_dash::calc_dash_start(FX_FLOAT ds)
+void vcgen_dash::calc_dash_start(float ds)
{
m_curr_dash = 0;
m_curr_dash_start = 0;
@@ -81,7 +81,7 @@ void vcgen_dash::remove_all()
m_src_vertices.remove_all();
m_closed = 0;
}
-void vcgen_dash::add_vertex(FX_FLOAT x, FX_FLOAT y, unsigned cmd)
+void vcgen_dash::add_vertex(float x, float y, unsigned cmd)
{
m_status = initial;
if(is_move_to(cmd)) {
@@ -103,7 +103,7 @@ void vcgen_dash::rewind(unsigned)
m_status = ready;
m_src_vertex = 0;
}
-unsigned vcgen_dash::vertex(FX_FLOAT* x, FX_FLOAT* y)
+unsigned vcgen_dash::vertex(float* x, float* y)
{
unsigned cmd = path_cmd_move_to;
while(!is_stop(cmd)) {
@@ -127,7 +127,7 @@ unsigned vcgen_dash::vertex(FX_FLOAT* x, FX_FLOAT* y)
}
return path_cmd_move_to;
case polyline: {
- FX_FLOAT dash_rest = m_dashes[m_curr_dash] - m_curr_dash_start;
+ float dash_rest = m_dashes[m_curr_dash] - m_curr_dash_start;
unsigned cmd = (m_curr_dash & 1) ?
path_cmd_move_to :
path_cmd_line_to;
diff --git a/chromium/third_party/pdfium/third_party/agg23/agg_vcgen_dash.h b/chromium/third_party/pdfium/third_party/agg23/agg_vcgen_dash.h
index 9c3aa630c20..7702fa7adcf 100644
--- a/chromium/third_party/pdfium/third_party/agg23/agg_vcgen_dash.h
+++ b/chromium/third_party/pdfium/third_party/agg23/agg_vcgen_dash.h
@@ -38,9 +38,9 @@ public:
typedef vertex_sequence<vertex_dist, 6> vertex_storage;
vcgen_dash();
void remove_all_dashes();
- void add_dash(FX_FLOAT dash_len, FX_FLOAT gap_len);
- void dash_start(FX_FLOAT ds);
- void shorten(FX_FLOAT s)
+ void add_dash(float dash_len, float gap_len);
+ void dash_start(float ds);
+ void shorten(float s)
{
m_shorten = s;
}
@@ -49,21 +49,21 @@ public:
return m_shorten;
}
void remove_all();
- void add_vertex(FX_FLOAT x, FX_FLOAT y, unsigned cmd);
+ void add_vertex(float x, float y, unsigned cmd);
void rewind(unsigned path_id);
- unsigned vertex(FX_FLOAT* x, FX_FLOAT* y);
+ unsigned vertex(float* x, float* y);
private:
vcgen_dash(const vcgen_dash&);
const vcgen_dash& operator = (const vcgen_dash&);
- void calc_dash_start(FX_FLOAT ds);
- FX_FLOAT m_dashes[max_dashes];
- FX_FLOAT m_total_dash_len;
+ void calc_dash_start(float ds);
+ float m_dashes[max_dashes];
+ float m_total_dash_len;
unsigned m_num_dashes;
- FX_FLOAT m_dash_start;
- FX_FLOAT m_shorten;
- FX_FLOAT m_curr_dash_start;
+ float m_dash_start;
+ float m_shorten;
+ float m_curr_dash_start;
unsigned m_curr_dash;
- FX_FLOAT m_curr_rest;
+ float m_curr_rest;
const vertex_dist* m_v1;
const vertex_dist* m_v2;
vertex_storage m_src_vertices;
diff --git a/chromium/third_party/pdfium/third_party/agg23/agg_vcgen_stroke.cpp b/chromium/third_party/pdfium/third_party/agg23/agg_vcgen_stroke.cpp
index 03225b16493..a59abf0022c 100644
--- a/chromium/third_party/pdfium/third_party/agg23/agg_vcgen_stroke.cpp
+++ b/chromium/third_party/pdfium/third_party/agg23/agg_vcgen_stroke.cpp
@@ -51,7 +51,7 @@ void vcgen_stroke::remove_all()
m_closed = 0;
m_status = initial;
}
-void vcgen_stroke::add_vertex(FX_FLOAT x, FX_FLOAT y, unsigned cmd)
+void vcgen_stroke::add_vertex(float x, float y, unsigned cmd)
{
m_status = initial;
if(is_move_to(cmd)) {
@@ -64,13 +64,13 @@ void vcgen_stroke::add_vertex(FX_FLOAT x, FX_FLOAT y, unsigned cmd)
}
}
}
-static inline void calc_butt_cap(FX_FLOAT* cap,
+static inline void calc_butt_cap(float* cap,
const vertex_dist& v0,
const vertex_dist& v1,
- FX_FLOAT len,
- FX_FLOAT width) {
- FX_FLOAT dx = (v1.y - v0.y) * width / len;
- FX_FLOAT dy = (v1.x - v0.x) * width / len;
+ float len,
+ float width) {
+ float dx = (v1.y - v0.y) * width / len;
+ float dy = (v1.x - v0.x) * width / len;
cap[0] = v0.x - dx;
cap[1] = v0.y + dy;
cap[2] = v0.x + dx;
@@ -88,7 +88,7 @@ void vcgen_stroke::rewind(unsigned)
m_src_vertex = 0;
m_out_vertex = 0;
}
-unsigned vcgen_stroke::vertex(FX_FLOAT* x, FX_FLOAT* y)
+unsigned vcgen_stroke::vertex(float* x, float* y)
{
unsigned cmd = path_cmd_line_to;
line_join_e curj;
diff --git a/chromium/third_party/pdfium/third_party/agg23/agg_vcgen_stroke.h b/chromium/third_party/pdfium/third_party/agg23/agg_vcgen_stroke.h
index 84fadd6ed8b..23142d37f64 100644
--- a/chromium/third_party/pdfium/third_party/agg23/agg_vcgen_stroke.h
+++ b/chromium/third_party/pdfium/third_party/agg23/agg_vcgen_stroke.h
@@ -61,52 +61,52 @@ public:
{
return m_inner_join;
}
- void width(FX_FLOAT w)
+ void width(float w)
{
m_width = w / 2;
}
- void miter_limit(FX_FLOAT ml)
+ void miter_limit(float ml)
{
m_miter_limit = ml;
}
- void miter_limit_theta(FX_FLOAT t);
- void inner_miter_limit(FX_FLOAT ml)
+ void miter_limit_theta(float t);
+ void inner_miter_limit(float ml)
{
m_inner_miter_limit = ml;
}
- void approximation_scale(FX_FLOAT as)
+ void approximation_scale(float as)
{
m_approx_scale = as;
}
- FX_FLOAT width() const
+ float width() const
{
return m_width * 2;
}
- FX_FLOAT miter_limit() const
+ float miter_limit() const
{
return m_miter_limit;
}
- FX_FLOAT inner_miter_limit() const
+ float inner_miter_limit() const
{
return m_inner_miter_limit;
}
- FX_FLOAT approximation_scale() const
+ float approximation_scale() const
{
return m_approx_scale;
}
void remove_all();
- void add_vertex(FX_FLOAT x, FX_FLOAT y, unsigned cmd);
+ void add_vertex(float x, float y, unsigned cmd);
void rewind(unsigned path_id);
- unsigned vertex(FX_FLOAT* x, FX_FLOAT* y);
+ unsigned vertex(float* x, float* y);
private:
vcgen_stroke(const vcgen_stroke&);
const vcgen_stroke& operator = (const vcgen_stroke&);
vertex_storage m_src_vertices;
coord_storage m_out_vertices;
- FX_FLOAT m_width;
- FX_FLOAT m_miter_limit;
- FX_FLOAT m_inner_miter_limit;
- FX_FLOAT m_approx_scale;
+ float m_width;
+ float m_miter_limit;
+ float m_inner_miter_limit;
+ float m_approx_scale;
line_cap_e m_line_cap;
line_join_e m_line_join;
inner_join_e m_inner_join;
diff --git a/chromium/third_party/pdfium/third_party/agg23/agg_vertex_sequence.h b/chromium/third_party/pdfium/third_party/agg23/agg_vertex_sequence.h
index 6600bf2085f..448e57b04de 100644
--- a/chromium/third_party/pdfium/third_party/agg23/agg_vertex_sequence.h
+++ b/chromium/third_party/pdfium/third_party/agg23/agg_vertex_sequence.h
@@ -69,13 +69,13 @@ void vertex_sequence<T, S>::close(bool closed)
}
}
}
-const FX_FLOAT vertex_dist_epsilon = 1e-14f;
+const float vertex_dist_epsilon = 1e-14f;
struct vertex_dist {
- FX_FLOAT x;
- FX_FLOAT y;
- FX_FLOAT dist;
+ float x;
+ float y;
+ float dist;
vertex_dist() {}
- vertex_dist(FX_FLOAT x_, FX_FLOAT y_) :
+ vertex_dist(float x_, float y_) :
x(x_),
y(y_),
dist(0)
@@ -90,7 +90,7 @@ struct vertex_dist {
struct vertex_dist_cmd : public vertex_dist {
unsigned cmd;
vertex_dist_cmd() {}
- vertex_dist_cmd(FX_FLOAT x_, FX_FLOAT y_, unsigned cmd_) :
+ vertex_dist_cmd(float x_, float y_, unsigned cmd_) :
vertex_dist(x_, y_),
cmd(cmd_)
{
diff --git a/chromium/third_party/pdfium/third_party/base/allocator/partition_allocator/OWNERS b/chromium/third_party/pdfium/third_party/base/allocator/partition_allocator/OWNERS
new file mode 100644
index 00000000000..95d998269a1
--- /dev/null
+++ b/chromium/third_party/pdfium/third_party/base/allocator/partition_allocator/OWNERS
@@ -0,0 +1,2 @@
+palmer@chromium.org
+tsepez@chromium.org
diff --git a/chromium/third_party/pdfium/third_party/base/allocator/partition_allocator/address_space_randomization.cc b/chromium/third_party/pdfium/third_party/base/allocator/partition_allocator/address_space_randomization.cc
new file mode 100644
index 00000000000..08f22be80ab
--- /dev/null
+++ b/chromium/third_party/pdfium/third_party/base/allocator/partition_allocator/address_space_randomization.cc
@@ -0,0 +1,143 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "third_party/base/allocator/partition_allocator/address_space_randomization.h"
+
+#include "third_party/base/allocator/partition_allocator/page_allocator.h"
+#include "third_party/base/allocator/partition_allocator/spin_lock.h"
+#include "third_party/build/build_config.h"
+
+#if defined(OS_WIN)
+#include <windows.h>
+#else
+#include <sys/time.h>
+#include <unistd.h>
+#endif
+
+// VersionHelpers.h must be included after windows.h.
+#if defined(OS_WIN)
+#include <VersionHelpers.h>
+#endif
+
+namespace pdfium {
+namespace base {
+
+namespace {
+
+// This is the same PRNG as used by tcmalloc for mapping address randomness;
+// see http://burtleburtle.net/bob/rand/smallprng.html
+struct ranctx {
+ subtle::SpinLock lock;
+ bool initialized;
+ uint32_t a;
+ uint32_t b;
+ uint32_t c;
+ uint32_t d;
+};
+
+#define rot(x, k) (((x) << (k)) | ((x) >> (32 - (k))))
+
+uint32_t ranvalInternal(ranctx* x) {
+ uint32_t e = x->a - rot(x->b, 27);
+ x->a = x->b ^ rot(x->c, 17);
+ x->b = x->c + x->d;
+ x->c = x->d + e;
+ x->d = e + x->a;
+ return x->d;
+}
+
+#undef rot
+
+uint32_t ranval(ranctx* x) {
+ subtle::SpinLock::Guard guard(x->lock);
+ if (UNLIKELY(!x->initialized)) {
+ x->initialized = true;
+ char c;
+ uint32_t seed = static_cast<uint32_t>(reinterpret_cast<uintptr_t>(&c));
+ uint32_t pid;
+ uint32_t usec;
+#if defined(OS_WIN)
+ pid = GetCurrentProcessId();
+ SYSTEMTIME st;
+ GetSystemTime(&st);
+ usec = static_cast<uint32_t>(st.wMilliseconds * 1000);
+#else
+ pid = static_cast<uint32_t>(getpid());
+ struct timeval tv;
+ gettimeofday(&tv, 0);
+ usec = static_cast<uint32_t>(tv.tv_usec);
+#endif
+ seed ^= pid;
+ seed ^= usec;
+ x->a = 0xf1ea5eed;
+ x->b = x->c = x->d = seed;
+ for (int i = 0; i < 20; ++i) {
+ (void)ranvalInternal(x);
+ }
+ }
+ uint32_t ret = ranvalInternal(x);
+ return ret;
+}
+
+static struct ranctx s_ranctx;
+
+} // namespace
+
+// Calculates a random preferred mapping address. In calculating an address, we
+// balance good ASLR against not fragmenting the address space too badly.
+void* GetRandomPageBase() {
+ uintptr_t random;
+ random = static_cast<uintptr_t>(ranval(&s_ranctx));
+#if defined(ARCH_CPU_X86_64)
+ random <<= 32UL;
+ random |= static_cast<uintptr_t>(ranval(&s_ranctx));
+// This address mask gives a low likelihood of address space collisions. We
+// handle the situation gracefully if there is a collision.
+#if defined(OS_WIN)
+ random &= 0x3ffffffffffUL;
+ // Windows >= 8.1 has the full 47 bits. Use them where available.
+ static bool windows_81 = false;
+ static bool windows_81_initialized = false;
+ if (!windows_81_initialized) {
+ windows_81 = IsWindows8Point1OrGreater();
+ windows_81_initialized = true;
+ }
+ if (!windows_81) {
+ random += 0x10000000000UL;
+ }
+#elif defined(MEMORY_TOOL_REPLACES_ALLOCATOR)
+ // This range is copied from the TSan source, but works for all tools.
+ random &= 0x007fffffffffUL;
+ random += 0x7e8000000000UL;
+#else
+ // Linux and OS X support the full 47-bit user space of x64 processors.
+ random &= 0x3fffffffffffUL;
+#endif
+#elif defined(ARCH_CPU_ARM64)
+ // ARM64 on Linux has 39-bit user space.
+ random &= 0x3fffffffffUL;
+ random += 0x1000000000UL;
+#else // !defined(ARCH_CPU_X86_64) && !defined(ARCH_CPU_ARM64)
+#if defined(OS_WIN)
+ // On win32 host systems the randomization plus huge alignment causes
+ // excessive fragmentation. Plus most of these systems lack ASLR, so the
+ // randomization isn't buying anything. In that case we just skip it.
+ // TODO(jschuh): Just dump the randomization when HE-ASLR is present.
+ static BOOL isWow64 = -1;
+ if (isWow64 == -1 && !IsWow64Process(GetCurrentProcess(), &isWow64))
+ isWow64 = FALSE;
+ if (!isWow64)
+ return nullptr;
+#endif // defined(OS_WIN)
+ // This is a good range on Windows, Linux and Mac.
+ // Allocates in the 0.5-1.5GB region.
+ random &= 0x3fffffff;
+ random += 0x20000000;
+#endif // defined(ARCH_CPU_X86_64)
+ random &= kPageAllocationGranularityBaseMask;
+ return reinterpret_cast<void*>(random);
+}
+
+} // namespace base
+} // namespace pdfium
diff --git a/chromium/third_party/pdfium/third_party/base/allocator/partition_allocator/address_space_randomization.h b/chromium/third_party/pdfium/third_party/base/allocator/partition_allocator/address_space_randomization.h
new file mode 100644
index 00000000000..97c5f606dda
--- /dev/null
+++ b/chromium/third_party/pdfium/third_party/base/allocator/partition_allocator/address_space_randomization.h
@@ -0,0 +1,18 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef BASE_ALLOCATOR_PARTITION_ALLOCATOR_ADDRESS_SPACE_RANDOMIZATION
+#define BASE_ALLOCATOR_PARTITION_ALLOCATOR_ADDRESS_SPACE_RANDOMIZATION
+
+namespace pdfium {
+namespace base {
+
+// Calculates a random preferred mapping address. In calculating an address, we
+// balance good ASLR against not fragmenting the address space too badly.
+void* GetRandomPageBase();
+
+} // namespace base
+} // namespace pdfium
+
+#endif // BASE_ALLOCATOR_PARTITION_ALLOCATOR_ADDRESS_SPACE_RANDOMIZATION
diff --git a/chromium/third_party/pdfium/third_party/base/allocator/partition_allocator/oom.h b/chromium/third_party/pdfium/third_party/base/allocator/partition_allocator/oom.h
new file mode 100644
index 00000000000..41f29b5642b
--- /dev/null
+++ b/chromium/third_party/pdfium/third_party/base/allocator/partition_allocator/oom.h
@@ -0,0 +1,37 @@
+// Copyright (c) 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef BASE_ALLOCATOR_OOM_H
+#define BASE_ALLOCATOR_OOM_H
+
+#include "third_party/base/logging.h"
+
+#if defined(OS_WIN)
+#include <windows.h>
+#endif
+
+// Do not want trivial entry points just calling OOM_CRASH() to be
+// commoned up by linker icf/comdat folding.
+#define OOM_CRASH_PREVENT_ICF() \
+ volatile int oom_crash_inhibit_icf = __LINE__; \
+ ALLOW_UNUSED_LOCAL(oom_crash_inhibit_icf)
+
+// OOM_CRASH() - Specialization of IMMEDIATE_CRASH which will raise a custom
+// exception on Windows to signal this is OOM and not a normal assert.
+#if defined(OS_WIN)
+#define OOM_CRASH() \
+ do { \
+ OOM_CRASH_PREVENT_ICF(); \
+ ::RaiseException(0xE0000008, EXCEPTION_NONCONTINUABLE, 0, nullptr); \
+ IMMEDIATE_CRASH(); \
+ } while (0)
+#else
+#define OOM_CRASH() \
+ do { \
+ OOM_CRASH_PREVENT_ICF(); \
+ IMMEDIATE_CRASH(); \
+ } while (0)
+#endif
+
+#endif // BASE_ALLOCATOR_OOM_H
diff --git a/chromium/third_party/pdfium/third_party/base/allocator/partition_allocator/page_allocator.cc b/chromium/third_party/pdfium/third_party/base/allocator/partition_allocator/page_allocator.cc
new file mode 100644
index 00000000000..abe159b7277
--- /dev/null
+++ b/chromium/third_party/pdfium/third_party/base/allocator/partition_allocator/page_allocator.cc
@@ -0,0 +1,281 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "third_party/base/allocator/partition_allocator/page_allocator.h"
+
+#include <limits.h>
+
+#include <atomic>
+
+#include "third_party/base/allocator/partition_allocator/address_space_randomization.h"
+#include "third_party/base/base_export.h"
+#include "third_party/base/logging.h"
+#include "third_party/build/build_config.h"
+
+#if defined(OS_POSIX)
+
+#include <errno.h>
+#include <sys/mman.h>
+
+#ifndef MADV_FREE
+#define MADV_FREE MADV_DONTNEED
+#endif
+
+#ifndef MAP_ANONYMOUS
+#define MAP_ANONYMOUS MAP_ANON
+#endif
+
+// On POSIX |mmap| uses a nearby address if the hint address is blocked.
+static const bool kHintIsAdvisory = true;
+static std::atomic<int32_t> s_allocPageErrorCode{0};
+
+#elif defined(OS_WIN)
+
+#include <windows.h>
+
+// |VirtualAlloc| will fail if allocation at the hint address is blocked.
+static const bool kHintIsAdvisory = false;
+static std::atomic<int32_t> s_allocPageErrorCode{ERROR_SUCCESS};
+
+#else
+#error Unknown OS
+#endif // defined(OS_POSIX)
+
+namespace pdfium {
+namespace base {
+
+// This internal function wraps the OS-specific page allocation call:
+// |VirtualAlloc| on Windows, and |mmap| on POSIX.
+static void* SystemAllocPages(
+ void* hint,
+ size_t length,
+ PageAccessibilityConfiguration page_accessibility) {
+ DCHECK(!(length & kPageAllocationGranularityOffsetMask));
+ DCHECK(!(reinterpret_cast<uintptr_t>(hint) &
+ kPageAllocationGranularityOffsetMask));
+ void* ret;
+#if defined(OS_WIN)
+ DWORD access_flag =
+ page_accessibility == PageAccessible ? PAGE_READWRITE : PAGE_NOACCESS;
+ ret = VirtualAlloc(hint, length, MEM_RESERVE | MEM_COMMIT, access_flag);
+ if (!ret)
+ s_allocPageErrorCode = GetLastError();
+#else
+ int access_flag = page_accessibility == PageAccessible
+ ? (PROT_READ | PROT_WRITE)
+ : PROT_NONE;
+ ret = mmap(hint, length, access_flag, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
+ if (ret == MAP_FAILED) {
+ s_allocPageErrorCode = errno;
+ ret = 0;
+ }
+#endif
+ return ret;
+}
+
+// Trims base to given length and alignment. Windows returns null on failure and
+// frees base.
+static void* TrimMapping(void* base,
+ size_t base_length,
+ size_t trim_length,
+ uintptr_t align,
+ PageAccessibilityConfiguration page_accessibility) {
+ size_t pre_slack = reinterpret_cast<uintptr_t>(base) & (align - 1);
+ if (pre_slack)
+ pre_slack = align - pre_slack;
+ size_t post_slack = base_length - pre_slack - trim_length;
+ DCHECK(base_length >= trim_length || pre_slack || post_slack);
+ DCHECK(pre_slack < base_length);
+ DCHECK(post_slack < base_length);
+ void* ret = base;
+
+#if defined(OS_POSIX) // On POSIX we can resize the allocation run.
+ (void)page_accessibility;
+ if (pre_slack) {
+ int res = munmap(base, pre_slack);
+ CHECK(!res);
+ ret = reinterpret_cast<char*>(base) + pre_slack;
+ }
+ if (post_slack) {
+ int res = munmap(reinterpret_cast<char*>(ret) + trim_length, post_slack);
+ CHECK(!res);
+ }
+#else // On Windows we can't resize the allocation run.
+ if (pre_slack || post_slack) {
+ ret = reinterpret_cast<char*>(base) + pre_slack;
+ FreePages(base, base_length);
+ ret = SystemAllocPages(ret, trim_length, page_accessibility);
+ }
+#endif
+
+ return ret;
+}
+
+void* AllocPages(void* address,
+ size_t length,
+ size_t align,
+ PageAccessibilityConfiguration page_accessibility) {
+ DCHECK(length >= kPageAllocationGranularity);
+ DCHECK(!(length & kPageAllocationGranularityOffsetMask));
+ DCHECK(align >= kPageAllocationGranularity);
+ DCHECK(!(align & kPageAllocationGranularityOffsetMask));
+ DCHECK(!(reinterpret_cast<uintptr_t>(address) &
+ kPageAllocationGranularityOffsetMask));
+ uintptr_t align_offset_mask = align - 1;
+ uintptr_t align_base_mask = ~align_offset_mask;
+ DCHECK(!(reinterpret_cast<uintptr_t>(address) & align_offset_mask));
+
+ // If the client passed null as the address, choose a good one.
+ if (!address) {
+ address = GetRandomPageBase();
+ address = reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(address) &
+ align_base_mask);
+ }
+
+ // First try to force an exact-size, aligned allocation from our random base.
+ for (int count = 0; count < 3; ++count) {
+ void* ret = SystemAllocPages(address, length, page_accessibility);
+ if (kHintIsAdvisory || ret) {
+ // If the alignment is to our liking, we're done.
+ if (!(reinterpret_cast<uintptr_t>(ret) & align_offset_mask))
+ return ret;
+ FreePages(ret, length);
+#if defined(ARCH_CPU_32_BITS)
+ address = reinterpret_cast<void*>(
+ (reinterpret_cast<uintptr_t>(ret) + align) & align_base_mask);
+#endif
+ } else if (!address) { // We know we're OOM when an unhinted allocation
+ // fails.
+ return nullptr;
+ } else {
+#if defined(ARCH_CPU_32_BITS)
+ address = reinterpret_cast<char*>(address) + align;
+#endif
+ }
+
+#if !defined(ARCH_CPU_32_BITS)
+ // Keep trying random addresses on systems that have a large address space.
+ address = GetRandomPageBase();
+ address = reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(address) &
+ align_base_mask);
+#endif
+ }
+
+ // Map a larger allocation so we can force alignment, but continue randomizing
+ // only on 64-bit POSIX.
+ size_t try_length = length + (align - kPageAllocationGranularity);
+ CHECK(try_length >= length);
+ void* ret;
+
+ do {
+ // Don't continue to burn cycles on mandatory hints (Windows).
+ address = kHintIsAdvisory ? GetRandomPageBase() : nullptr;
+ ret = SystemAllocPages(address, try_length, page_accessibility);
+ // The retries are for Windows, where a race can steal our mapping on
+ // resize.
+ } while (ret &&
+ (ret = TrimMapping(ret, try_length, length, align,
+ page_accessibility)) == nullptr);
+
+ return ret;
+}
+
+void FreePages(void* address, size_t length) {
+ DCHECK(!(reinterpret_cast<uintptr_t>(address) &
+ kPageAllocationGranularityOffsetMask));
+ DCHECK(!(length & kPageAllocationGranularityOffsetMask));
+#if defined(OS_POSIX)
+ int ret = munmap(address, length);
+ CHECK(!ret);
+#else
+ BOOL ret = VirtualFree(address, 0, MEM_RELEASE);
+ CHECK(ret);
+#endif
+}
+
+void SetSystemPagesInaccessible(void* address, size_t length) {
+ DCHECK(!(length & kSystemPageOffsetMask));
+#if defined(OS_POSIX)
+ int ret = mprotect(address, length, PROT_NONE);
+ CHECK(!ret);
+#else
+ BOOL ret = VirtualFree(address, length, MEM_DECOMMIT);
+ CHECK(ret);
+#endif
+}
+
+bool SetSystemPagesAccessible(void* address, size_t length) {
+ DCHECK(!(length & kSystemPageOffsetMask));
+#if defined(OS_POSIX)
+ return !mprotect(address, length, PROT_READ | PROT_WRITE);
+#else
+ return !!VirtualAlloc(address, length, MEM_COMMIT, PAGE_READWRITE);
+#endif
+}
+
+void DecommitSystemPages(void* address, size_t length) {
+ DCHECK(!(length & kSystemPageOffsetMask));
+#if defined(OS_POSIX)
+ int ret = madvise(address, length, MADV_FREE);
+ if (ret != 0 && errno == EINVAL) {
+ // MADV_FREE only works on Linux 4.5+ . If request failed,
+ // retry with older MADV_DONTNEED . Note that MADV_FREE
+ // being defined at compile time doesn't imply runtime support.
+ ret = madvise(address, length, MADV_DONTNEED);
+ }
+ CHECK(!ret);
+#else
+ SetSystemPagesInaccessible(address, length);
+#endif
+}
+
+void RecommitSystemPages(void* address, size_t length) {
+ DCHECK(!(length & kSystemPageOffsetMask));
+#if defined(OS_POSIX)
+ (void)address;
+#else
+ CHECK(SetSystemPagesAccessible(address, length));
+#endif
+}
+
+void DiscardSystemPages(void* address, size_t length) {
+ DCHECK(!(length & kSystemPageOffsetMask));
+#if defined(OS_POSIX)
+ // On POSIX, the implementation detail is that discard and decommit are the
+ // same, and lead to pages that are returned to the system immediately and
+ // get replaced with zeroed pages when touched. So we just call
+ // DecommitSystemPages() here to avoid code duplication.
+ DecommitSystemPages(address, length);
+#else
+ // On Windows discarded pages are not returned to the system immediately and
+ // not guaranteed to be zeroed when returned to the application.
+ using DiscardVirtualMemoryFunction =
+ DWORD(WINAPI*)(PVOID virtualAddress, SIZE_T size);
+ static DiscardVirtualMemoryFunction discard_virtual_memory =
+ reinterpret_cast<DiscardVirtualMemoryFunction>(-1);
+ if (discard_virtual_memory ==
+ reinterpret_cast<DiscardVirtualMemoryFunction>(-1))
+ discard_virtual_memory =
+ reinterpret_cast<DiscardVirtualMemoryFunction>(GetProcAddress(
+ GetModuleHandle(L"Kernel32.dll"), "DiscardVirtualMemory"));
+ // Use DiscardVirtualMemory when available because it releases faster than
+ // MEM_RESET.
+ DWORD ret = 1;
+ if (discard_virtual_memory)
+ ret = discard_virtual_memory(address, length);
+ // DiscardVirtualMemory is buggy in Win10 SP0, so fall back to MEM_RESET on
+ // failure.
+ if (ret) {
+ void* ret = VirtualAlloc(address, length, MEM_RESET, PAGE_READWRITE);
+ CHECK(ret);
+ }
+#endif
+}
+
+uint32_t GetAllocPageErrorCode() {
+ return s_allocPageErrorCode;
+}
+
+} // namespace base
+} // namespace pdfium
diff --git a/chromium/third_party/pdfium/third_party/base/allocator/partition_allocator/page_allocator.h b/chromium/third_party/pdfium/third_party/base/allocator/partition_allocator/page_allocator.h
new file mode 100644
index 00000000000..be733634c79
--- /dev/null
+++ b/chromium/third_party/pdfium/third_party/base/allocator/partition_allocator/page_allocator.h
@@ -0,0 +1,126 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef BASE_ALLOCATOR_PARTITION_ALLOCATOR_PAGE_ALLOCATOR_H
+#define BASE_ALLOCATOR_PARTITION_ALLOCATOR_PAGE_ALLOCATOR_H
+
+#include <stdint.h>
+
+#include <cstddef>
+
+#include "third_party/base/base_export.h"
+#include "third_party/base/compiler_specific.h"
+#include "third_party/build/build_config.h"
+
+namespace pdfium {
+namespace base {
+
+#if defined(OS_WIN)
+static const size_t kPageAllocationGranularityShift = 16; // 64KB
+#else
+static const size_t kPageAllocationGranularityShift = 12; // 4KB
+#endif
+static const size_t kPageAllocationGranularity =
+ 1 << kPageAllocationGranularityShift;
+static const size_t kPageAllocationGranularityOffsetMask =
+ kPageAllocationGranularity - 1;
+static const size_t kPageAllocationGranularityBaseMask =
+ ~kPageAllocationGranularityOffsetMask;
+
+// All Blink-supported systems have 4096 sized system pages and can handle
+// permissions and commit / decommit at this granularity.
+static const size_t kSystemPageSize = 4096;
+static const size_t kSystemPageOffsetMask = kSystemPageSize - 1;
+static const size_t kSystemPageBaseMask = ~kSystemPageOffsetMask;
+
+enum PageAccessibilityConfiguration {
+ PageAccessible,
+ PageInaccessible,
+};
+
+// Allocate one or more pages.
+// The requested address is just a hint; the actual address returned may
+// differ. The returned address will be aligned at least to align bytes.
+// len is in bytes, and must be a multiple of kPageAllocationGranularity.
+// align is in bytes, and must be a power-of-two multiple of
+// kPageAllocationGranularity.
+// If addr is null, then a suitable and randomized address will be chosen
+// automatically.
+// PageAccessibilityConfiguration controls the permission of the
+// allocated pages.
+// This call will return null if the allocation cannot be satisfied.
+BASE_EXPORT void* AllocPages(void* address,
+ size_t len,
+ size_t align,
+ PageAccessibilityConfiguration);
+
+// Free one or more pages.
+// addr and len must match a previous call to allocPages().
+BASE_EXPORT void FreePages(void* address, size_t length);
+
+// Mark one or more system pages as being inaccessible.
+// Subsequently accessing any address in the range will fault, and the
+// addresses will not be re-used by future allocations.
+// len must be a multiple of kSystemPageSize bytes.
+BASE_EXPORT void SetSystemPagesInaccessible(void* address, size_t length);
+
+// Mark one or more system pages as being accessible.
+// The pages will be readable and writeable.
+// len must be a multiple of kSystemPageSize bytes.
+// The result bool value indicates whether the permission
+// change succeeded or not. You must check the result
+// (in most cases you need to CHECK that it is true).
+BASE_EXPORT WARN_UNUSED_RESULT bool SetSystemPagesAccessible(void* address,
+ size_t length);
+
+// Decommit one or more system pages. Decommitted means that the physical memory
+// is released to the system, but the virtual address space remains reserved.
+// System pages are re-committed by calling recommitSystemPages(). Touching
+// a decommitted page _may_ fault.
+// Clients should not make any assumptions about the contents of decommitted
+// system pages, before or after they write to the page. The only guarantee
+// provided is that the contents of the system page will be deterministic again
+// after recommitting and writing to it. In particlar note that system pages are
+// not guaranteed to be zero-filled upon re-commit. len must be a multiple of
+// kSystemPageSize bytes.
+BASE_EXPORT void DecommitSystemPages(void* address, size_t length);
+
+// Recommit one or more system pages. Decommitted system pages must be
+// recommitted before they are read are written again.
+// Note that this operation may be a no-op on some platforms.
+// len must be a multiple of kSystemPageSize bytes.
+BASE_EXPORT void RecommitSystemPages(void* address, size_t length);
+
+// Discard one or more system pages. Discarding is a hint to the system that
+// the page is no longer required. The hint may:
+// - Do nothing.
+// - Discard the page immediately, freeing up physical pages.
+// - Discard the page at some time in the future in response to memory pressure.
+// Only committed pages should be discarded. Discarding a page does not
+// decommit it, and it is valid to discard an already-discarded page.
+// A read or write to a discarded page will not fault.
+// Reading from a discarded page may return the original page content, or a
+// page full of zeroes.
+// Writing to a discarded page is the only guaranteed way to tell the system
+// that the page is required again. Once written to, the content of the page is
+// guaranteed stable once more. After being written to, the page content may be
+// based on the original page content, or a page of zeroes.
+// len must be a multiple of kSystemPageSize bytes.
+BASE_EXPORT void DiscardSystemPages(void* address, size_t length);
+
+ALWAYS_INLINE uintptr_t RoundUpToSystemPage(uintptr_t address) {
+ return (address + kSystemPageOffsetMask) & kSystemPageBaseMask;
+}
+
+ALWAYS_INLINE uintptr_t RoundDownToSystemPage(uintptr_t address) {
+ return address & kSystemPageBaseMask;
+}
+
+// Returns errno (or GetLastError code) when mmap (or VirtualAlloc) fails.
+BASE_EXPORT uint32_t GetAllocPageErrorCode();
+
+} // namespace base
+} // namespace pdfium
+
+#endif // BASE_ALLOCATOR_PARTITION_ALLOCATOR_PAGE_ALLOCATOR_H
diff --git a/chromium/third_party/pdfium/third_party/base/allocator/partition_allocator/partition_alloc.cc b/chromium/third_party/pdfium/third_party/base/allocator/partition_allocator/partition_alloc.cc
new file mode 100644
index 00000000000..a33d7f1d137
--- /dev/null
+++ b/chromium/third_party/pdfium/third_party/base/allocator/partition_allocator/partition_alloc.cc
@@ -0,0 +1,1442 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "third_party/base/allocator/partition_allocator/partition_alloc.h"
+
+#include <string.h>
+
+#include "third_party/base/allocator/partition_allocator/oom.h"
+#include "third_party/base/allocator/partition_allocator/spin_lock.h"
+#include "third_party/base/compiler_specific.h"
+
+// Two partition pages are used as guard / metadata page so make sure the super
+// page size is bigger.
+static_assert(pdfium::base::kPartitionPageSize * 4 <=
+ pdfium::base::kSuperPageSize,
+ "ok super page size");
+static_assert(!(pdfium::base::kSuperPageSize %
+ pdfium::base::kPartitionPageSize),
+ "ok super page multiple");
+// Four system pages gives us room to hack out a still-guard-paged piece
+// of metadata in the middle of a guard partition page.
+static_assert(pdfium::base::kSystemPageSize * 4 <=
+ pdfium::base::kPartitionPageSize,
+ "ok partition page size");
+static_assert(!(pdfium::base::kPartitionPageSize %
+ pdfium::base::kSystemPageSize),
+ "ok partition page multiple");
+static_assert(sizeof(pdfium::base::PartitionPage) <=
+ pdfium::base::kPageMetadataSize,
+ "PartitionPage should not be too big");
+static_assert(sizeof(pdfium::base::PartitionBucket) <=
+ pdfium::base::kPageMetadataSize,
+ "PartitionBucket should not be too big");
+static_assert(sizeof(pdfium::base::PartitionSuperPageExtentEntry) <=
+ pdfium::base::kPageMetadataSize,
+ "PartitionSuperPageExtentEntry should not be too big");
+static_assert(pdfium::base::kPageMetadataSize *
+ pdfium::base::kNumPartitionPagesPerSuperPage <=
+ pdfium::base::kSystemPageSize,
+ "page metadata fits in hole");
+// Check that some of our zanier calculations worked out as expected.
+static_assert(pdfium::base::kGenericSmallestBucket == 8,
+ "generic smallest bucket");
+static_assert(pdfium::base::kGenericMaxBucketed == 983040,
+ "generic max bucketed");
+static_assert(pdfium::base::kMaxSystemPagesPerSlotSpan < (1 << 8),
+ "System pages per slot span must be less than 128.");
+
+namespace pdfium {
+namespace base {
+
+subtle::SpinLock PartitionRootBase::gInitializedLock;
+bool PartitionRootBase::gInitialized = false;
+PartitionPage PartitionRootBase::gSeedPage;
+PartitionBucket PartitionRootBase::gPagedBucket;
+void (*PartitionRootBase::gOomHandlingFunction)() = nullptr;
+PartitionAllocHooks::AllocationHook* PartitionAllocHooks::allocation_hook_ =
+ nullptr;
+PartitionAllocHooks::FreeHook* PartitionAllocHooks::free_hook_ = nullptr;
+
+static uint8_t PartitionBucketNumSystemPages(size_t size) {
+ // This works out reasonably for the current bucket sizes of the generic
+ // allocator, and the current values of partition page size and constants.
+ // Specifically, we have enough room to always pack the slots perfectly into
+ // some number of system pages. The only waste is the waste associated with
+ // unfaulted pages (i.e. wasted address space).
+ // TODO: we end up using a lot of system pages for very small sizes. For
+ // example, we'll use 12 system pages for slot size 24. The slot size is
+ // so small that the waste would be tiny with just 4, or 1, system pages.
+ // Later, we can investigate whether there are anti-fragmentation benefits
+ // to using fewer system pages.
+ double best_waste_ratio = 1.0f;
+ uint16_t best_pages = 0;
+ if (size > kMaxSystemPagesPerSlotSpan * kSystemPageSize) {
+ DCHECK(!(size % kSystemPageSize));
+ best_pages = static_cast<uint16_t>(size / kSystemPageSize);
+ CHECK(best_pages < (1 << 8));
+ return static_cast<uint8_t>(best_pages);
+ }
+ DCHECK(size <= kMaxSystemPagesPerSlotSpan * kSystemPageSize);
+ for (uint16_t i = kNumSystemPagesPerPartitionPage - 1;
+ i <= kMaxSystemPagesPerSlotSpan; ++i) {
+ size_t page_size = kSystemPageSize * i;
+ size_t num_slots = page_size / size;
+ size_t waste = page_size - (num_slots * size);
+ // Leaving a page unfaulted is not free; the page will occupy an empty page
+ // table entry. Make a simple attempt to account for that.
+ size_t num_remainder_pages = i & (kNumSystemPagesPerPartitionPage - 1);
+ size_t num_unfaulted_pages =
+ num_remainder_pages
+ ? (kNumSystemPagesPerPartitionPage - num_remainder_pages)
+ : 0;
+ waste += sizeof(void*) * num_unfaulted_pages;
+ double waste_ratio = (double)waste / (double)page_size;
+ if (waste_ratio < best_waste_ratio) {
+ best_waste_ratio = waste_ratio;
+ best_pages = i;
+ }
+ }
+ DCHECK(best_pages > 0);
+ CHECK(best_pages <= kMaxSystemPagesPerSlotSpan);
+ return static_cast<uint8_t>(best_pages);
+}
+
+static void PartitionAllocBaseInit(PartitionRootBase* root) {
+ DCHECK(!root->initialized);
+ {
+ subtle::SpinLock::Guard guard(PartitionRootBase::gInitializedLock);
+ if (!PartitionRootBase::gInitialized) {
+ PartitionRootBase::gInitialized = true;
+ // We mark the seed page as free to make sure it is skipped by our
+ // logic to find a new active page.
+ PartitionRootBase::gPagedBucket.active_pages_head =
+ &PartitionRootGeneric::gSeedPage;
+ }
+ }
+
+ root->initialized = true;
+ root->total_size_of_committed_pages = 0;
+ root->total_size_of_super_pages = 0;
+ root->total_size_of_direct_mapped_pages = 0;
+ root->next_super_page = 0;
+ root->next_partition_page = 0;
+ root->next_partition_page_end = 0;
+ root->first_extent = 0;
+ root->current_extent = 0;
+ root->direct_map_list = 0;
+
+ memset(&root->global_empty_page_ring, '\0',
+ sizeof(root->global_empty_page_ring));
+ root->global_empty_page_ring_index = 0;
+
+ // This is a "magic" value so we can test if a root pointer is valid.
+ root->inverted_self = ~reinterpret_cast<uintptr_t>(root);
+}
+
+static void PartitionBucketInitBase(PartitionBucket* bucket,
+ PartitionRootBase* root) {
+ bucket->active_pages_head = &PartitionRootGeneric::gSeedPage;
+ bucket->empty_pages_head = 0;
+ bucket->decommitted_pages_head = 0;
+ bucket->num_full_pages = 0;
+ bucket->num_system_pages_per_slot_span =
+ PartitionBucketNumSystemPages(bucket->slot_size);
+}
+
+void PartitionAllocGlobalInit(void (*oom_handling_function)()) {
+ DCHECK(oom_handling_function);
+ PartitionRootBase::gOomHandlingFunction = oom_handling_function;
+}
+
+void PartitionAllocInit(PartitionRoot* root,
+ size_t num_buckets,
+ size_t max_allocation) {
+ PartitionAllocBaseInit(root);
+
+ root->num_buckets = num_buckets;
+ root->max_allocation = max_allocation;
+ size_t i;
+ for (i = 0; i < root->num_buckets; ++i) {
+ PartitionBucket* bucket = &root->buckets()[i];
+ if (!i)
+ bucket->slot_size = kAllocationGranularity;
+ else
+ bucket->slot_size = i << kBucketShift;
+ PartitionBucketInitBase(bucket, root);
+ }
+}
+
+void PartitionAllocGenericInit(PartitionRootGeneric* root) {
+ subtle::SpinLock::Guard guard(root->lock);
+
+ PartitionAllocBaseInit(root);
+
+ // Precalculate some shift and mask constants used in the hot path.
+ // Example: malloc(41) == 101001 binary.
+ // Order is 6 (1 << 6-1) == 32 is highest bit set.
+ // order_index is the next three MSB == 010 == 2.
+ // sub_order_index_mask is a mask for the remaining bits == 11 (masking to 01
+ // for
+ // the sub_order_index).
+ size_t order;
+ for (order = 0; order <= kBitsPerSizeT; ++order) {
+ size_t order_index_shift;
+ if (order < kGenericNumBucketsPerOrderBits + 1)
+ order_index_shift = 0;
+ else
+ order_index_shift = order - (kGenericNumBucketsPerOrderBits + 1);
+ root->order_index_shifts[order] = order_index_shift;
+ size_t sub_order_index_mask;
+ if (order == kBitsPerSizeT) {
+ // This avoids invoking undefined behavior for an excessive shift.
+ sub_order_index_mask =
+ static_cast<size_t>(-1) >> (kGenericNumBucketsPerOrderBits + 1);
+ } else {
+ sub_order_index_mask = ((static_cast<size_t>(1) << order) - 1) >>
+ (kGenericNumBucketsPerOrderBits + 1);
+ }
+ root->order_sub_index_masks[order] = sub_order_index_mask;
+ }
+
+ // Set up the actual usable buckets first.
+ // Note that typical values (i.e. min allocation size of 8) will result in
+ // pseudo buckets (size==9 etc. or more generally, size is not a multiple
+ // of the smallest allocation granularity).
+ // We avoid them in the bucket lookup map, but we tolerate them to keep the
+ // code simpler and the structures more generic.
+ size_t i, j;
+ size_t current_size = kGenericSmallestBucket;
+ size_t currentIncrement =
+ kGenericSmallestBucket >> kGenericNumBucketsPerOrderBits;
+ PartitionBucket* bucket = &root->buckets[0];
+ for (i = 0; i < kGenericNumBucketedOrders; ++i) {
+ for (j = 0; j < kGenericNumBucketsPerOrder; ++j) {
+ bucket->slot_size = current_size;
+ PartitionBucketInitBase(bucket, root);
+ // Disable psuedo buckets so that touching them faults.
+ if (current_size % kGenericSmallestBucket)
+ bucket->active_pages_head = 0;
+ current_size += currentIncrement;
+ ++bucket;
+ }
+ currentIncrement <<= 1;
+ }
+ DCHECK(current_size == 1 << kGenericMaxBucketedOrder);
+ DCHECK(bucket == &root->buckets[0] + kGenericNumBuckets);
+
+ // Then set up the fast size -> bucket lookup table.
+ bucket = &root->buckets[0];
+ PartitionBucket** bucketPtr = &root->bucket_lookups[0];
+ for (order = 0; order <= kBitsPerSizeT; ++order) {
+ for (j = 0; j < kGenericNumBucketsPerOrder; ++j) {
+ if (order < kGenericMinBucketedOrder) {
+ // Use the bucket of the finest granularity for malloc(0) etc.
+ *bucketPtr++ = &root->buckets[0];
+ } else if (order > kGenericMaxBucketedOrder) {
+ *bucketPtr++ = &PartitionRootGeneric::gPagedBucket;
+ } else {
+ PartitionBucket* validBucket = bucket;
+ // Skip over invalid buckets.
+ while (validBucket->slot_size % kGenericSmallestBucket)
+ validBucket++;
+ *bucketPtr++ = validBucket;
+ bucket++;
+ }
+ }
+ }
+ DCHECK(bucket == &root->buckets[0] + kGenericNumBuckets);
+ DCHECK(bucketPtr ==
+ &root->bucket_lookups[0] +
+ ((kBitsPerSizeT + 1) * kGenericNumBucketsPerOrder));
+ // And there's one last bucket lookup that will be hit for e.g. malloc(-1),
+ // which tries to overflow to a non-existant order.
+ *bucketPtr = &PartitionRootGeneric::gPagedBucket;
+}
+
+#if !defined(ARCH_CPU_64_BITS)
+static NOINLINE void PartitionOutOfMemoryWithLotsOfUncommitedPages() {
+ OOM_CRASH();
+}
+#endif
+
+static NOINLINE void PartitionOutOfMemory(const PartitionRootBase* root) {
+#if !defined(ARCH_CPU_64_BITS)
+ // Check whether this OOM is due to a lot of super pages that are allocated
+ // but not committed, probably due to http://crbug.com/421387.
+ if (root->total_size_of_super_pages +
+ root->total_size_of_direct_mapped_pages -
+ root->total_size_of_committed_pages >
+ kReasonableSizeOfUnusedPages) {
+ PartitionOutOfMemoryWithLotsOfUncommitedPages();
+ }
+#endif
+ if (PartitionRootBase::gOomHandlingFunction)
+ (*PartitionRootBase::gOomHandlingFunction)();
+ OOM_CRASH();
+}
+
+static NOINLINE void PartitionExcessiveAllocationSize() {
+ OOM_CRASH();
+}
+
+static NOINLINE void PartitionBucketFull() {
+ OOM_CRASH();
+}
+
+// partitionPageStateIs*
+// Note that it's only valid to call these functions on pages found on one of
+// the page lists. Specifically, you can't call these functions on full pages
+// that were detached from the active list.
+static bool ALWAYS_INLINE
+PartitionPageStateIsActive(const PartitionPage* page) {
+ DCHECK(page != &PartitionRootGeneric::gSeedPage);
+ DCHECK(!page->page_offset);
+ return (page->num_allocated_slots > 0 &&
+ (page->freelist_head || page->num_unprovisioned_slots));
+}
+
+static bool ALWAYS_INLINE PartitionPageStateIsFull(const PartitionPage* page) {
+ DCHECK(page != &PartitionRootGeneric::gSeedPage);
+ DCHECK(!page->page_offset);
+ bool ret = (page->num_allocated_slots == PartitionBucketSlots(page->bucket));
+ if (ret) {
+ DCHECK(!page->freelist_head);
+ DCHECK(!page->num_unprovisioned_slots);
+ }
+ return ret;
+}
+
+static bool ALWAYS_INLINE PartitionPageStateIsEmpty(const PartitionPage* page) {
+ DCHECK(page != &PartitionRootGeneric::gSeedPage);
+ DCHECK(!page->page_offset);
+ return (!page->num_allocated_slots && page->freelist_head);
+}
+
+static bool ALWAYS_INLINE
+PartitionPageStateIsDecommitted(const PartitionPage* page) {
+ DCHECK(page != &PartitionRootGeneric::gSeedPage);
+ DCHECK(!page->page_offset);
+ bool ret = (!page->num_allocated_slots && !page->freelist_head);
+ if (ret) {
+ DCHECK(!page->num_unprovisioned_slots);
+ DCHECK(page->empty_cache_index == -1);
+ }
+ return ret;
+}
+
+static void PartitionIncreaseCommittedPages(PartitionRootBase* root,
+ size_t len) {
+ root->total_size_of_committed_pages += len;
+ DCHECK(root->total_size_of_committed_pages <=
+ root->total_size_of_super_pages +
+ root->total_size_of_direct_mapped_pages);
+}
+
+static void PartitionDecreaseCommittedPages(PartitionRootBase* root,
+ size_t len) {
+ root->total_size_of_committed_pages -= len;
+ DCHECK(root->total_size_of_committed_pages <=
+ root->total_size_of_super_pages +
+ root->total_size_of_direct_mapped_pages);
+}
+
+static ALWAYS_INLINE void PartitionDecommitSystemPages(PartitionRootBase* root,
+ void* address,
+ size_t length) {
+ DecommitSystemPages(address, length);
+ PartitionDecreaseCommittedPages(root, length);
+}
+
+static ALWAYS_INLINE void PartitionRecommitSystemPages(PartitionRootBase* root,
+ void* address,
+ size_t length) {
+ RecommitSystemPages(address, length);
+ PartitionIncreaseCommittedPages(root, length);
+}
+
+static ALWAYS_INLINE void* PartitionAllocPartitionPages(
+ PartitionRootBase* root,
+ int flags,
+ uint16_t num_partition_pages) {
+ DCHECK(!(reinterpret_cast<uintptr_t>(root->next_partition_page) %
+ kPartitionPageSize));
+ DCHECK(!(reinterpret_cast<uintptr_t>(root->next_partition_page_end) %
+ kPartitionPageSize));
+ DCHECK(num_partition_pages <= kNumPartitionPagesPerSuperPage);
+ size_t total_size = kPartitionPageSize * num_partition_pages;
+ size_t num_partition_pages_left =
+ (root->next_partition_page_end - root->next_partition_page) >>
+ kPartitionPageShift;
+ if (LIKELY(num_partition_pages_left >= num_partition_pages)) {
+ // In this case, we can still hand out pages from the current super page
+ // allocation.
+ char* ret = root->next_partition_page;
+ root->next_partition_page += total_size;
+ PartitionIncreaseCommittedPages(root, total_size);
+ return ret;
+ }
+
+ // Need a new super page. We want to allocate super pages in a continguous
+ // address region as much as possible. This is important for not causing
+ // page table bloat and not fragmenting address spaces in 32 bit
+ // architectures.
+ char* requestedAddress = root->next_super_page;
+ char* super_page = reinterpret_cast<char*>(AllocPages(
+ requestedAddress, kSuperPageSize, kSuperPageSize, PageAccessible));
+ if (UNLIKELY(!super_page))
+ return 0;
+
+ root->total_size_of_super_pages += kSuperPageSize;
+ PartitionIncreaseCommittedPages(root, total_size);
+
+ root->next_super_page = super_page + kSuperPageSize;
+ char* ret = super_page + kPartitionPageSize;
+ root->next_partition_page = ret + total_size;
+ root->next_partition_page_end = root->next_super_page - kPartitionPageSize;
+ // Make the first partition page in the super page a guard page, but leave a
+ // hole in the middle.
+ // This is where we put page metadata and also a tiny amount of extent
+ // metadata.
+ SetSystemPagesInaccessible(super_page, kSystemPageSize);
+ SetSystemPagesInaccessible(super_page + (kSystemPageSize * 2),
+ kPartitionPageSize - (kSystemPageSize * 2));
+ // Also make the last partition page a guard page.
+ SetSystemPagesInaccessible(super_page + (kSuperPageSize - kPartitionPageSize),
+ kPartitionPageSize);
+
+ // If we were after a specific address, but didn't get it, assume that
+ // the system chose a lousy address. Here most OS'es have a default
+ // algorithm that isn't randomized. For example, most Linux
+ // distributions will allocate the mapping directly before the last
+ // successful mapping, which is far from random. So we just get fresh
+ // randomness for the next mapping attempt.
+ if (requestedAddress && requestedAddress != super_page)
+ root->next_super_page = 0;
+
+ // We allocated a new super page so update super page metadata.
+ // First check if this is a new extent or not.
+ PartitionSuperPageExtentEntry* latest_extent =
+ reinterpret_cast<PartitionSuperPageExtentEntry*>(
+ PartitionSuperPageToMetadataArea(super_page));
+ // By storing the root in every extent metadata object, we have a fast way
+ // to go from a pointer within the partition to the root object.
+ latest_extent->root = root;
+ // Most new extents will be part of a larger extent, and these three fields
+ // are unused, but we initialize them to 0 so that we get a clear signal
+ // in case they are accidentally used.
+ latest_extent->super_page_base = 0;
+ latest_extent->super_pages_end = 0;
+ latest_extent->next = 0;
+
+ PartitionSuperPageExtentEntry* current_extent = root->current_extent;
+ bool isNewExtent = (super_page != requestedAddress);
+ if (UNLIKELY(isNewExtent)) {
+ if (UNLIKELY(!current_extent)) {
+ DCHECK(!root->first_extent);
+ root->first_extent = latest_extent;
+ } else {
+ DCHECK(current_extent->super_page_base);
+ current_extent->next = latest_extent;
+ }
+ root->current_extent = latest_extent;
+ latest_extent->super_page_base = super_page;
+ latest_extent->super_pages_end = super_page + kSuperPageSize;
+ } else {
+ // We allocated next to an existing extent so just nudge the size up a
+ // little.
+ DCHECK(current_extent->super_pages_end);
+ current_extent->super_pages_end += kSuperPageSize;
+ DCHECK(ret >= current_extent->super_page_base &&
+ ret < current_extent->super_pages_end);
+ }
+ return ret;
+}
+
+static ALWAYS_INLINE uint16_t
+PartitionBucketPartitionPages(const PartitionBucket* bucket) {
+ return (bucket->num_system_pages_per_slot_span +
+ (kNumSystemPagesPerPartitionPage - 1)) /
+ kNumSystemPagesPerPartitionPage;
+}
+
+static ALWAYS_INLINE void PartitionPageReset(PartitionPage* page) {
+ DCHECK(PartitionPageStateIsDecommitted(page));
+
+ page->num_unprovisioned_slots = PartitionBucketSlots(page->bucket);
+ DCHECK(page->num_unprovisioned_slots);
+
+ page->next_page = nullptr;
+}
+
+static ALWAYS_INLINE void PartitionPageSetup(PartitionPage* page,
+ PartitionBucket* bucket) {
+ // The bucket never changes. We set it up once.
+ page->bucket = bucket;
+ page->empty_cache_index = -1;
+
+ PartitionPageReset(page);
+
+ // If this page has just a single slot, do not set up page offsets for any
+ // page metadata other than the first one. This ensures that attempts to
+ // touch invalid page metadata fail.
+ if (page->num_unprovisioned_slots == 1)
+ return;
+
+ uint16_t num_partition_pages = PartitionBucketPartitionPages(bucket);
+ char* page_char_ptr = reinterpret_cast<char*>(page);
+ for (uint16_t i = 1; i < num_partition_pages; ++i) {
+ page_char_ptr += kPageMetadataSize;
+ PartitionPage* secondary_page =
+ reinterpret_cast<PartitionPage*>(page_char_ptr);
+ secondary_page->page_offset = i;
+ }
+}
+
+static ALWAYS_INLINE char* PartitionPageAllocAndFillFreelist(
+ PartitionPage* page) {
+ DCHECK(page != &PartitionRootGeneric::gSeedPage);
+ uint16_t num_slots = page->num_unprovisioned_slots;
+ DCHECK(num_slots);
+ PartitionBucket* bucket = page->bucket;
+ // We should only get here when _every_ slot is either used or unprovisioned.
+ // (The third state is "on the freelist". If we have a non-empty freelist, we
+ // should not get here.)
+ DCHECK(num_slots + page->num_allocated_slots == PartitionBucketSlots(bucket));
+ // Similarly, make explicitly sure that the freelist is empty.
+ DCHECK(!page->freelist_head);
+ DCHECK(page->num_allocated_slots >= 0);
+
+ size_t size = bucket->slot_size;
+ char* base = reinterpret_cast<char*>(PartitionPageToPointer(page));
+ char* return_object = base + (size * page->num_allocated_slots);
+ char* firstFreelistPointer = return_object + size;
+ char* firstFreelistPointerExtent =
+ firstFreelistPointer + sizeof(PartitionFreelistEntry*);
+ // Our goal is to fault as few system pages as possible. We calculate the
+ // page containing the "end" of the returned slot, and then allow freelist
+ // pointers to be written up to the end of that page.
+ char* sub_page_limit = reinterpret_cast<char*>(
+ RoundUpToSystemPage(reinterpret_cast<size_t>(firstFreelistPointer)));
+ char* slots_limit = return_object + (size * num_slots);
+ char* freelist_limit = sub_page_limit;
+ if (UNLIKELY(slots_limit < freelist_limit))
+ freelist_limit = slots_limit;
+
+ uint16_t num_new_freelist_entries = 0;
+ if (LIKELY(firstFreelistPointerExtent <= freelist_limit)) {
+ // Only consider used space in the slot span. If we consider wasted
+ // space, we may get an off-by-one when a freelist pointer fits in the
+ // wasted space, but a slot does not.
+ // We know we can fit at least one freelist pointer.
+ num_new_freelist_entries = 1;
+ // Any further entries require space for the whole slot span.
+ num_new_freelist_entries += static_cast<uint16_t>(
+ (freelist_limit - firstFreelistPointerExtent) / size);
+ }
+
+ // We always return an object slot -- that's the +1 below.
+ // We do not neccessarily create any new freelist entries, because we cross
+ // sub page boundaries frequently for large bucket sizes.
+ DCHECK(num_new_freelist_entries + 1 <= num_slots);
+ num_slots -= (num_new_freelist_entries + 1);
+ page->num_unprovisioned_slots = num_slots;
+ page->num_allocated_slots++;
+
+ if (LIKELY(num_new_freelist_entries)) {
+ char* freelist_pointer = firstFreelistPointer;
+ PartitionFreelistEntry* entry =
+ reinterpret_cast<PartitionFreelistEntry*>(freelist_pointer);
+ page->freelist_head = entry;
+ while (--num_new_freelist_entries) {
+ freelist_pointer += size;
+ PartitionFreelistEntry* next_entry =
+ reinterpret_cast<PartitionFreelistEntry*>(freelist_pointer);
+ entry->next = PartitionFreelistMask(next_entry);
+ entry = next_entry;
+ }
+ entry->next = PartitionFreelistMask(0);
+ } else {
+ page->freelist_head = 0;
+ }
+ return return_object;
+}
+
+// This helper function scans a bucket's active page list for a suitable new
+// active page.
+// When it finds a suitable new active page (one that has free slots and is not
+// empty), it is set as the new active page. If there is no suitable new
+// active page, the current active page is set to the seed page.
+// As potential pages are scanned, they are tidied up according to their state.
+// Empty pages are swept on to the empty page list, decommitted pages on to the
+// decommitted page list and full pages are unlinked from any list.
+static bool PartitionSetNewActivePage(PartitionBucket* bucket) {
+ PartitionPage* page = bucket->active_pages_head;
+ if (page == &PartitionRootBase::gSeedPage)
+ return false;
+
+ PartitionPage* next_page;
+
+ for (; page; page = next_page) {
+ next_page = page->next_page;
+ DCHECK(page->bucket == bucket);
+ DCHECK(page != bucket->empty_pages_head);
+ DCHECK(page != bucket->decommitted_pages_head);
+
+ // Deal with empty and decommitted pages.
+ if (LIKELY(PartitionPageStateIsActive(page))) {
+ // This page is usable because it has freelist entries, or has
+ // unprovisioned slots we can create freelist entries from.
+ bucket->active_pages_head = page;
+ return true;
+ }
+ if (LIKELY(PartitionPageStateIsEmpty(page))) {
+ page->next_page = bucket->empty_pages_head;
+ bucket->empty_pages_head = page;
+ } else if (LIKELY(PartitionPageStateIsDecommitted(page))) {
+ page->next_page = bucket->decommitted_pages_head;
+ bucket->decommitted_pages_head = page;
+ } else {
+ DCHECK(PartitionPageStateIsFull(page));
+ // If we get here, we found a full page. Skip over it too, and also
+ // tag it as full (via a negative value). We need it tagged so that
+ // free'ing can tell, and move it back into the active page list.
+ page->num_allocated_slots = -page->num_allocated_slots;
+ ++bucket->num_full_pages;
+ // num_full_pages is a uint16_t for efficient packing so guard against
+ // overflow to be safe.
+ if (UNLIKELY(!bucket->num_full_pages))
+ PartitionBucketFull();
+ // Not necessary but might help stop accidents.
+ page->next_page = 0;
+ }
+ }
+
+ bucket->active_pages_head = &PartitionRootGeneric::gSeedPage;
+ return false;
+}
+
+static ALWAYS_INLINE PartitionDirectMapExtent* partitionPageToDirectMapExtent(
+ PartitionPage* page) {
+ DCHECK(PartitionBucketIsDirectMapped(page->bucket));
+ return reinterpret_cast<PartitionDirectMapExtent*>(
+ reinterpret_cast<char*>(page) + 3 * kPageMetadataSize);
+}
+
+static ALWAYS_INLINE void PartitionPageSetRawSize(PartitionPage* page,
+ size_t size) {
+ size_t* raw_size_ptr = PartitionPageGetRawSizePtr(page);
+ if (UNLIKELY(raw_size_ptr != nullptr))
+ *raw_size_ptr = size;
+}
+
+static ALWAYS_INLINE PartitionPage* PartitionDirectMap(PartitionRootBase* root,
+ int flags,
+ size_t raw_size) {
+ size_t size = PartitionDirectMapSize(raw_size);
+
+ // Because we need to fake looking like a super page, we need to allocate
+ // a bunch of system pages more than "size":
+ // - The first few system pages are the partition page in which the super
+ // page metadata is stored. We fault just one system page out of a partition
+ // page sized clump.
+ // - We add a trailing guard page on 32-bit (on 64-bit we rely on the
+ // massive address space plus randomization instead).
+ size_t map_size = size + kPartitionPageSize;
+#if !defined(ARCH_CPU_64_BITS)
+ map_size += kSystemPageSize;
+#endif
+ // Round up to the allocation granularity.
+ map_size += kPageAllocationGranularityOffsetMask;
+ map_size &= kPageAllocationGranularityBaseMask;
+
+ // TODO: these pages will be zero-filled. Consider internalizing an
+ // allocZeroed() API so we can avoid a memset() entirely in this case.
+ char* ptr = reinterpret_cast<char*>(
+ AllocPages(0, map_size, kSuperPageSize, PageAccessible));
+ if (UNLIKELY(!ptr))
+ return nullptr;
+
+ size_t committed_page_size = size + kSystemPageSize;
+ root->total_size_of_direct_mapped_pages += committed_page_size;
+ PartitionIncreaseCommittedPages(root, committed_page_size);
+
+ char* slot = ptr + kPartitionPageSize;
+ SetSystemPagesInaccessible(ptr + (kSystemPageSize * 2),
+ kPartitionPageSize - (kSystemPageSize * 2));
+#if !defined(ARCH_CPU_64_BITS)
+ SetSystemPagesInaccessible(ptr, kSystemPageSize);
+ SetSystemPagesInaccessible(slot + size, kSystemPageSize);
+#endif
+
+ PartitionSuperPageExtentEntry* extent =
+ reinterpret_cast<PartitionSuperPageExtentEntry*>(
+ PartitionSuperPageToMetadataArea(ptr));
+ extent->root = root;
+ // The new structures are all located inside a fresh system page so they
+ // will all be zeroed out. These DCHECKs are for documentation.
+ DCHECK(!extent->super_page_base);
+ DCHECK(!extent->super_pages_end);
+ DCHECK(!extent->next);
+ PartitionPage* page = PartitionPointerToPageNoAlignmentCheck(slot);
+ PartitionBucket* bucket = reinterpret_cast<PartitionBucket*>(
+ reinterpret_cast<char*>(page) + (kPageMetadataSize * 2));
+ DCHECK(!page->next_page);
+ DCHECK(!page->num_allocated_slots);
+ DCHECK(!page->num_unprovisioned_slots);
+ DCHECK(!page->page_offset);
+ DCHECK(!page->empty_cache_index);
+ page->bucket = bucket;
+ page->freelist_head = reinterpret_cast<PartitionFreelistEntry*>(slot);
+ PartitionFreelistEntry* next_entry =
+ reinterpret_cast<PartitionFreelistEntry*>(slot);
+ next_entry->next = PartitionFreelistMask(0);
+
+ DCHECK(!bucket->active_pages_head);
+ DCHECK(!bucket->empty_pages_head);
+ DCHECK(!bucket->decommitted_pages_head);
+ DCHECK(!bucket->num_system_pages_per_slot_span);
+ DCHECK(!bucket->num_full_pages);
+ bucket->slot_size = size;
+
+ PartitionDirectMapExtent* map_extent = partitionPageToDirectMapExtent(page);
+ map_extent->map_size = map_size - kPartitionPageSize - kSystemPageSize;
+ map_extent->bucket = bucket;
+
+ // Maintain the doubly-linked list of all direct mappings.
+ map_extent->next_extent = root->direct_map_list;
+ if (map_extent->next_extent)
+ map_extent->next_extent->prev_extent = map_extent;
+ map_extent->prev_extent = nullptr;
+ root->direct_map_list = map_extent;
+
+ return page;
+}
+
+static ALWAYS_INLINE void PartitionDirectUnmap(PartitionPage* page) {
+ PartitionRootBase* root = PartitionPageToRoot(page);
+ const PartitionDirectMapExtent* extent = partitionPageToDirectMapExtent(page);
+ size_t unmap_size = extent->map_size;
+
+ // Maintain the doubly-linked list of all direct mappings.
+ if (extent->prev_extent) {
+ DCHECK(extent->prev_extent->next_extent == extent);
+ extent->prev_extent->next_extent = extent->next_extent;
+ } else {
+ root->direct_map_list = extent->next_extent;
+ }
+ if (extent->next_extent) {
+ DCHECK(extent->next_extent->prev_extent == extent);
+ extent->next_extent->prev_extent = extent->prev_extent;
+ }
+
+ // Add on the size of the trailing guard page and preceeding partition
+ // page.
+ unmap_size += kPartitionPageSize + kSystemPageSize;
+
+ size_t uncommitted_page_size = page->bucket->slot_size + kSystemPageSize;
+ PartitionDecreaseCommittedPages(root, uncommitted_page_size);
+ DCHECK(root->total_size_of_direct_mapped_pages >= uncommitted_page_size);
+ root->total_size_of_direct_mapped_pages -= uncommitted_page_size;
+
+ DCHECK(!(unmap_size & kPageAllocationGranularityOffsetMask));
+
+ char* ptr = reinterpret_cast<char*>(PartitionPageToPointer(page));
+ // Account for the mapping starting a partition page before the actual
+ // allocation address.
+ ptr -= kPartitionPageSize;
+
+ FreePages(ptr, unmap_size);
+}
+
+void* PartitionAllocSlowPath(PartitionRootBase* root,
+ int flags,
+ size_t size,
+ PartitionBucket* bucket) {
+ // The slow path is called when the freelist is empty.
+ DCHECK(!bucket->active_pages_head->freelist_head);
+
+ PartitionPage* new_page = nullptr;
+
+ // For the PartitionAllocGeneric API, we have a bunch of buckets marked
+ // as special cases. We bounce them through to the slow path so that we
+ // can still have a blazing fast hot path due to lack of corner-case
+ // branches.
+ bool returnNull = flags & PartitionAllocReturnNull;
+ if (UNLIKELY(PartitionBucketIsDirectMapped(bucket))) {
+ DCHECK(size > kGenericMaxBucketed);
+ DCHECK(bucket == &PartitionRootBase::gPagedBucket);
+ DCHECK(bucket->active_pages_head == &PartitionRootGeneric::gSeedPage);
+ if (size > kGenericMaxDirectMapped) {
+ if (returnNull)
+ return nullptr;
+ PartitionExcessiveAllocationSize();
+ }
+ new_page = PartitionDirectMap(root, flags, size);
+ } else if (LIKELY(PartitionSetNewActivePage(bucket))) {
+ // First, did we find an active page in the active pages list?
+ new_page = bucket->active_pages_head;
+ DCHECK(PartitionPageStateIsActive(new_page));
+ } else if (LIKELY(bucket->empty_pages_head != nullptr) ||
+ LIKELY(bucket->decommitted_pages_head != nullptr)) {
+ // Second, look in our lists of empty and decommitted pages.
+ // Check empty pages first, which are preferred, but beware that an
+ // empty page might have been decommitted.
+ while (LIKELY((new_page = bucket->empty_pages_head) != nullptr)) {
+ DCHECK(new_page->bucket == bucket);
+ DCHECK(PartitionPageStateIsEmpty(new_page) ||
+ PartitionPageStateIsDecommitted(new_page));
+ bucket->empty_pages_head = new_page->next_page;
+ // Accept the empty page unless it got decommitted.
+ if (new_page->freelist_head) {
+ new_page->next_page = nullptr;
+ break;
+ }
+ DCHECK(PartitionPageStateIsDecommitted(new_page));
+ new_page->next_page = bucket->decommitted_pages_head;
+ bucket->decommitted_pages_head = new_page;
+ }
+ if (UNLIKELY(!new_page) &&
+ LIKELY(bucket->decommitted_pages_head != nullptr)) {
+ new_page = bucket->decommitted_pages_head;
+ DCHECK(new_page->bucket == bucket);
+ DCHECK(PartitionPageStateIsDecommitted(new_page));
+ bucket->decommitted_pages_head = new_page->next_page;
+ void* addr = PartitionPageToPointer(new_page);
+ PartitionRecommitSystemPages(root, addr,
+ PartitionBucketBytes(new_page->bucket));
+ PartitionPageReset(new_page);
+ }
+ DCHECK(new_page);
+ } else {
+ // Third. If we get here, we need a brand new page.
+ uint16_t num_partition_pages = PartitionBucketPartitionPages(bucket);
+ void* rawPages =
+ PartitionAllocPartitionPages(root, flags, num_partition_pages);
+ if (LIKELY(rawPages != nullptr)) {
+ new_page = PartitionPointerToPageNoAlignmentCheck(rawPages);
+ PartitionPageSetup(new_page, bucket);
+ }
+ }
+
+ // Bail if we had a memory allocation failure.
+ if (UNLIKELY(!new_page)) {
+ DCHECK(bucket->active_pages_head == &PartitionRootGeneric::gSeedPage);
+ if (returnNull)
+ return nullptr;
+ PartitionOutOfMemory(root);
+ }
+
+ bucket = new_page->bucket;
+ DCHECK(bucket != &PartitionRootBase::gPagedBucket);
+ bucket->active_pages_head = new_page;
+ PartitionPageSetRawSize(new_page, size);
+
+ // If we found an active page with free slots, or an empty page, we have a
+ // usable freelist head.
+ if (LIKELY(new_page->freelist_head != nullptr)) {
+ PartitionFreelistEntry* entry = new_page->freelist_head;
+ PartitionFreelistEntry* new_head = PartitionFreelistMask(entry->next);
+ new_page->freelist_head = new_head;
+ new_page->num_allocated_slots++;
+ return entry;
+ }
+ // Otherwise, we need to build the freelist.
+ DCHECK(new_page->num_unprovisioned_slots);
+ return PartitionPageAllocAndFillFreelist(new_page);
+}
+
+static ALWAYS_INLINE void PartitionDecommitPage(PartitionRootBase* root,
+ PartitionPage* page) {
+ DCHECK(PartitionPageStateIsEmpty(page));
+ DCHECK(!PartitionBucketIsDirectMapped(page->bucket));
+ void* addr = PartitionPageToPointer(page);
+ PartitionDecommitSystemPages(root, addr, PartitionBucketBytes(page->bucket));
+
+ // We actually leave the decommitted page in the active list. We'll sweep
+ // it on to the decommitted page list when we next walk the active page
+ // list.
+ // Pulling this trick enables us to use a singly-linked page list for all
+ // cases, which is critical in keeping the page metadata structure down to
+ // 32 bytes in size.
+ page->freelist_head = 0;
+ page->num_unprovisioned_slots = 0;
+ DCHECK(PartitionPageStateIsDecommitted(page));
+}
+
+static void PartitionDecommitPageIfPossible(PartitionRootBase* root,
+ PartitionPage* page) {
+ DCHECK(page->empty_cache_index >= 0);
+ DCHECK(static_cast<unsigned>(page->empty_cache_index) < kMaxFreeableSpans);
+ DCHECK(page == root->global_empty_page_ring[page->empty_cache_index]);
+ page->empty_cache_index = -1;
+ if (PartitionPageStateIsEmpty(page))
+ PartitionDecommitPage(root, page);
+}
+
+static ALWAYS_INLINE void PartitionRegisterEmptyPage(PartitionPage* page) {
+ DCHECK(PartitionPageStateIsEmpty(page));
+ PartitionRootBase* root = PartitionPageToRoot(page);
+
+ // If the page is already registered as empty, give it another life.
+ if (page->empty_cache_index != -1) {
+ DCHECK(page->empty_cache_index >= 0);
+ DCHECK(static_cast<unsigned>(page->empty_cache_index) < kMaxFreeableSpans);
+ DCHECK(root->global_empty_page_ring[page->empty_cache_index] == page);
+ root->global_empty_page_ring[page->empty_cache_index] = 0;
+ }
+
+ int16_t current_index = root->global_empty_page_ring_index;
+ PartitionPage* pageToDecommit = root->global_empty_page_ring[current_index];
+ // The page might well have been re-activated, filled up, etc. before we get
+ // around to looking at it here.
+ if (pageToDecommit)
+ PartitionDecommitPageIfPossible(root, pageToDecommit);
+
+ // We put the empty slot span on our global list of "pages that were once
+ // empty". thus providing it a bit of breathing room to get re-used before
+ // we really free it. This improves performance, particularly on Mac OS X
+ // which has subpar memory management performance.
+ root->global_empty_page_ring[current_index] = page;
+ page->empty_cache_index = current_index;
+ ++current_index;
+ if (current_index == kMaxFreeableSpans)
+ current_index = 0;
+ root->global_empty_page_ring_index = current_index;
+}
+
+static void PartitionDecommitEmptyPages(PartitionRootBase* root) {
+ for (size_t i = 0; i < kMaxFreeableSpans; ++i) {
+ PartitionPage* page = root->global_empty_page_ring[i];
+ if (page)
+ PartitionDecommitPageIfPossible(root, page);
+ root->global_empty_page_ring[i] = nullptr;
+ }
+}
+
+void PartitionFreeSlowPath(PartitionPage* page) {
+ PartitionBucket* bucket = page->bucket;
+ DCHECK(page != &PartitionRootGeneric::gSeedPage);
+ if (LIKELY(page->num_allocated_slots == 0)) {
+ // Page became fully unused.
+ if (UNLIKELY(PartitionBucketIsDirectMapped(bucket))) {
+ PartitionDirectUnmap(page);
+ return;
+ }
+ // If it's the current active page, change it. We bounce the page to
+ // the empty list as a force towards defragmentation.
+ if (LIKELY(page == bucket->active_pages_head))
+ (void)PartitionSetNewActivePage(bucket);
+ DCHECK(bucket->active_pages_head != page);
+
+ PartitionPageSetRawSize(page, 0);
+ DCHECK(!PartitionPageGetRawSize(page));
+
+ PartitionRegisterEmptyPage(page);
+ } else {
+ DCHECK(!PartitionBucketIsDirectMapped(bucket));
+ // Ensure that the page is full. That's the only valid case if we
+ // arrive here.
+ DCHECK(page->num_allocated_slots < 0);
+ // A transition of num_allocated_slots from 0 to -1 is not legal, and
+ // likely indicates a double-free.
+ CHECK(page->num_allocated_slots != -1);
+ page->num_allocated_slots = -page->num_allocated_slots - 2;
+ DCHECK(page->num_allocated_slots == PartitionBucketSlots(bucket) - 1);
+ // Fully used page became partially used. It must be put back on the
+ // non-full page list. Also make it the current page to increase the
+ // chances of it being filled up again. The old current page will be
+ // the next page.
+ DCHECK(!page->next_page);
+ if (LIKELY(bucket->active_pages_head != &PartitionRootGeneric::gSeedPage))
+ page->next_page = bucket->active_pages_head;
+ bucket->active_pages_head = page;
+ --bucket->num_full_pages;
+ // Special case: for a partition page with just a single slot, it may
+ // now be empty and we want to run it through the empty logic.
+ if (UNLIKELY(page->num_allocated_slots == 0))
+ PartitionFreeSlowPath(page);
+ }
+}
+
+bool partitionReallocDirectMappedInPlace(PartitionRootGeneric* root,
+ PartitionPage* page,
+ size_t raw_size) {
+ DCHECK(PartitionBucketIsDirectMapped(page->bucket));
+
+ raw_size = PartitionCookieSizeAdjustAdd(raw_size);
+
+ // Note that the new size might be a bucketed size; this function is called
+ // whenever we're reallocating a direct mapped allocation.
+ size_t new_size = PartitionDirectMapSize(raw_size);
+ if (new_size < kGenericMinDirectMappedDownsize)
+ return false;
+
+ // bucket->slot_size is the current size of the allocation.
+ size_t current_size = page->bucket->slot_size;
+ if (new_size == current_size)
+ return true;
+
+ char* char_ptr = static_cast<char*>(PartitionPageToPointer(page));
+
+ if (new_size < current_size) {
+ size_t map_size = partitionPageToDirectMapExtent(page)->map_size;
+
+ // Don't reallocate in-place if new size is less than 80 % of the full
+ // map size, to avoid holding on to too much unused address space.
+ if ((new_size / kSystemPageSize) * 5 < (map_size / kSystemPageSize) * 4)
+ return false;
+
+ // Shrink by decommitting unneeded pages and making them inaccessible.
+ size_t decommitSize = current_size - new_size;
+ PartitionDecommitSystemPages(root, char_ptr + new_size, decommitSize);
+ SetSystemPagesInaccessible(char_ptr + new_size, decommitSize);
+ } else if (new_size <= partitionPageToDirectMapExtent(page)->map_size) {
+ // Grow within the actually allocated memory. Just need to make the
+ // pages accessible again.
+ size_t recommit_size = new_size - current_size;
+ bool ret = SetSystemPagesAccessible(char_ptr + current_size, recommit_size);
+ CHECK(ret);
+ PartitionRecommitSystemPages(root, char_ptr + current_size, recommit_size);
+
+#if DCHECK_IS_ON()
+ memset(char_ptr + current_size, kUninitializedByte, recommit_size);
+#endif
+ } else {
+ // We can't perform the realloc in-place.
+ // TODO: support this too when possible.
+ return false;
+ }
+
+#if DCHECK_IS_ON()
+ // Write a new trailing cookie.
+ PartitionCookieWriteValue(char_ptr + raw_size - kCookieSize);
+#endif
+
+ PartitionPageSetRawSize(page, raw_size);
+ DCHECK(PartitionPageGetRawSize(page) == raw_size);
+
+ page->bucket->slot_size = new_size;
+ return true;
+}
+
+void* PartitionReallocGeneric(PartitionRootGeneric* root,
+ void* ptr,
+ size_t new_size,
+ const char* type_name) {
+#if defined(MEMORY_TOOL_REPLACES_ALLOCATOR)
+ return realloc(ptr, new_size);
+#else
+ if (UNLIKELY(!ptr))
+ return PartitionAllocGeneric(root, new_size, type_name);
+ if (UNLIKELY(!new_size)) {
+ PartitionFreeGeneric(root, ptr);
+ return 0;
+ }
+
+ if (new_size > kGenericMaxDirectMapped)
+ PartitionExcessiveAllocationSize();
+
+ DCHECK(PartitionPointerIsValid(PartitionCookieFreePointerAdjust(ptr)));
+
+ PartitionPage* page =
+ PartitionPointerToPage(PartitionCookieFreePointerAdjust(ptr));
+
+ if (UNLIKELY(PartitionBucketIsDirectMapped(page->bucket))) {
+ // We may be able to perform the realloc in place by changing the
+ // accessibility of memory pages and, if reducing the size, decommitting
+ // them.
+ if (partitionReallocDirectMappedInPlace(root, page, new_size)) {
+ PartitionAllocHooks::ReallocHookIfEnabled(ptr, ptr, new_size, type_name);
+ return ptr;
+ }
+ }
+
+ size_t actual_new_size = PartitionAllocActualSize(root, new_size);
+ size_t actual_old_size = PartitionAllocGetSize(ptr);
+
+ // TODO: note that tcmalloc will "ignore" a downsizing realloc() unless the
+ // new size is a significant percentage smaller. We could do the same if we
+ // determine it is a win.
+ if (actual_new_size == actual_old_size) {
+ // Trying to allocate a block of size new_size would give us a block of
+ // the same size as the one we've already got, so re-use the allocation
+ // after updating statistics (and cookies, if present).
+ PartitionPageSetRawSize(page, PartitionCookieSizeAdjustAdd(new_size));
+#if DCHECK_IS_ON()
+ // Write a new trailing cookie.
+ PartitionCookieWriteValue(static_cast<char*>(ptr) + new_size);
+#endif
+ return ptr;
+ }
+
+ // This realloc cannot be resized in-place. Sadness.
+ void* ret = PartitionAllocGeneric(root, new_size, type_name);
+ size_t copy_size = actual_old_size;
+ if (new_size < copy_size)
+ copy_size = new_size;
+
+ memcpy(ret, ptr, copy_size);
+ PartitionFreeGeneric(root, ptr);
+ return ret;
+#endif
+}
+
+static size_t PartitionPurgePage(PartitionPage* page, bool discard) {
+ const PartitionBucket* bucket = page->bucket;
+ size_t slot_size = bucket->slot_size;
+ if (slot_size < kSystemPageSize || !page->num_allocated_slots)
+ return 0;
+
+ size_t bucket_num_slots = PartitionBucketSlots(bucket);
+ size_t discardable_bytes = 0;
+
+ size_t raw_size = PartitionPageGetRawSize(const_cast<PartitionPage*>(page));
+ if (raw_size) {
+ uint32_t usedBytes = static_cast<uint32_t>(RoundUpToSystemPage(raw_size));
+ discardable_bytes = bucket->slot_size - usedBytes;
+ if (discardable_bytes && discard) {
+ char* ptr = reinterpret_cast<char*>(PartitionPageToPointer(page));
+ ptr += usedBytes;
+ DiscardSystemPages(ptr, discardable_bytes);
+ }
+ return discardable_bytes;
+ }
+
+ const size_t max_slot_count =
+ (kPartitionPageSize * kMaxPartitionPagesPerSlotSpan) / kSystemPageSize;
+ DCHECK(bucket_num_slots <= max_slot_count);
+ DCHECK(page->num_unprovisioned_slots < bucket_num_slots);
+ size_t num_slots = bucket_num_slots - page->num_unprovisioned_slots;
+ char slot_usage[max_slot_count];
+ size_t last_slot = static_cast<size_t>(-1);
+ memset(slot_usage, 1, num_slots);
+ char* ptr = reinterpret_cast<char*>(PartitionPageToPointer(page));
+ PartitionFreelistEntry* entry = page->freelist_head;
+ // First, walk the freelist for this page and make a bitmap of which slots
+ // are not in use.
+ while (entry) {
+ size_t slotIndex = (reinterpret_cast<char*>(entry) - ptr) / slot_size;
+ DCHECK(slotIndex < num_slots);
+ slot_usage[slotIndex] = 0;
+ entry = PartitionFreelistMask(entry->next);
+ // If we have a slot where the masked freelist entry is 0, we can
+ // actually discard that freelist entry because touching a discarded
+ // page is guaranteed to return original content or 0.
+ // (Note that this optimization won't fire on big endian machines
+ // because the masking function is negation.)
+ if (!PartitionFreelistMask(entry))
+ last_slot = slotIndex;
+ }
+
+ // If the slot(s) at the end of the slot span are not in used, we can
+ // truncate them entirely and rewrite the freelist.
+ size_t truncated_slots = 0;
+ while (!slot_usage[num_slots - 1]) {
+ truncated_slots++;
+ num_slots--;
+ DCHECK(num_slots);
+ }
+ // First, do the work of calculating the discardable bytes. Don't actually
+ // discard anything unless the discard flag was passed in.
+ char* begin_ptr = nullptr;
+ char* end_ptr = nullptr;
+ size_t unprovisioned_bytes = 0;
+ if (truncated_slots) {
+ begin_ptr = ptr + (num_slots * slot_size);
+ end_ptr = begin_ptr + (slot_size * truncated_slots);
+ begin_ptr = reinterpret_cast<char*>(
+ RoundUpToSystemPage(reinterpret_cast<size_t>(begin_ptr)));
+ // We round the end pointer here up and not down because we're at the
+ // end of a slot span, so we "own" all the way up the page boundary.
+ end_ptr = reinterpret_cast<char*>(
+ RoundUpToSystemPage(reinterpret_cast<size_t>(end_ptr)));
+ DCHECK(end_ptr <= ptr + PartitionBucketBytes(bucket));
+ if (begin_ptr < end_ptr) {
+ unprovisioned_bytes = end_ptr - begin_ptr;
+ discardable_bytes += unprovisioned_bytes;
+ }
+ }
+ if (unprovisioned_bytes && discard) {
+ DCHECK(truncated_slots > 0);
+ size_t num_new_entries = 0;
+ page->num_unprovisioned_slots += static_cast<uint16_t>(truncated_slots);
+ // Rewrite the freelist.
+ PartitionFreelistEntry** entry_ptr = &page->freelist_head;
+ for (size_t slotIndex = 0; slotIndex < num_slots; ++slotIndex) {
+ if (slot_usage[slotIndex])
+ continue;
+ PartitionFreelistEntry* entry = reinterpret_cast<PartitionFreelistEntry*>(
+ ptr + (slot_size * slotIndex));
+ *entry_ptr = PartitionFreelistMask(entry);
+ entry_ptr = reinterpret_cast<PartitionFreelistEntry**>(entry);
+ num_new_entries++;
+ }
+ // Terminate the freelist chain.
+ *entry_ptr = nullptr;
+ // The freelist head is stored unmasked.
+ page->freelist_head = PartitionFreelistMask(page->freelist_head);
+ DCHECK(num_new_entries == num_slots - page->num_allocated_slots);
+ // Discard the memory.
+ DiscardSystemPages(begin_ptr, unprovisioned_bytes);
+ }
+
+ // Next, walk the slots and for any not in use, consider where the system
+ // page boundaries occur. We can release any system pages back to the
+ // system as long as we don't interfere with a freelist pointer or an
+ // adjacent slot.
+ for (size_t i = 0; i < num_slots; ++i) {
+ if (slot_usage[i])
+ continue;
+ // The first address we can safely discard is just after the freelist
+ // pointer. There's one quirk: if the freelist pointer is actually a
+ // null, we can discard that pointer value too.
+ char* begin_ptr = ptr + (i * slot_size);
+ char* end_ptr = begin_ptr + slot_size;
+ if (i != last_slot)
+ begin_ptr += sizeof(PartitionFreelistEntry);
+ begin_ptr = reinterpret_cast<char*>(
+ RoundUpToSystemPage(reinterpret_cast<size_t>(begin_ptr)));
+ end_ptr = reinterpret_cast<char*>(
+ RoundDownToSystemPage(reinterpret_cast<size_t>(end_ptr)));
+ if (begin_ptr < end_ptr) {
+ size_t partial_slot_bytes = end_ptr - begin_ptr;
+ discardable_bytes += partial_slot_bytes;
+ if (discard)
+ DiscardSystemPages(begin_ptr, partial_slot_bytes);
+ }
+ }
+ return discardable_bytes;
+}
+
+static void PartitionPurgeBucket(PartitionBucket* bucket) {
+ if (bucket->active_pages_head != &PartitionRootGeneric::gSeedPage) {
+ for (PartitionPage* page = bucket->active_pages_head; page;
+ page = page->next_page) {
+ DCHECK(page != &PartitionRootGeneric::gSeedPage);
+ (void)PartitionPurgePage(page, true);
+ }
+ }
+}
+
+void PartitionPurgeMemory(PartitionRoot* root, int flags) {
+ if (flags & PartitionPurgeDecommitEmptyPages)
+ PartitionDecommitEmptyPages(root);
+ // We don't currently do anything for PartitionPurgeDiscardUnusedSystemPages
+ // here because that flag is only useful for allocations >= system page
+ // size. We only have allocations that large inside generic partitions
+ // at the moment.
+}
+
+void PartitionPurgeMemoryGeneric(PartitionRootGeneric* root, int flags) {
+ subtle::SpinLock::Guard guard(root->lock);
+ if (flags & PartitionPurgeDecommitEmptyPages)
+ PartitionDecommitEmptyPages(root);
+ if (flags & PartitionPurgeDiscardUnusedSystemPages) {
+ for (size_t i = 0; i < kGenericNumBuckets; ++i) {
+ PartitionBucket* bucket = &root->buckets[i];
+ if (bucket->slot_size >= kSystemPageSize)
+ PartitionPurgeBucket(bucket);
+ }
+ }
+}
+
+static void PartitionDumpPageStats(PartitionBucketMemoryStats* stats_out,
+ const PartitionPage* page) {
+ uint16_t bucket_num_slots = PartitionBucketSlots(page->bucket);
+
+ if (PartitionPageStateIsDecommitted(page)) {
+ ++stats_out->num_decommitted_pages;
+ return;
+ }
+
+ stats_out->discardable_bytes +=
+ PartitionPurgePage(const_cast<PartitionPage*>(page), false);
+
+ size_t raw_size = PartitionPageGetRawSize(const_cast<PartitionPage*>(page));
+ if (raw_size)
+ stats_out->active_bytes += static_cast<uint32_t>(raw_size);
+ else
+ stats_out->active_bytes +=
+ (page->num_allocated_slots * stats_out->bucket_slot_size);
+
+ size_t page_bytes_resident =
+ RoundUpToSystemPage((bucket_num_slots - page->num_unprovisioned_slots) *
+ stats_out->bucket_slot_size);
+ stats_out->resident_bytes += page_bytes_resident;
+ if (PartitionPageStateIsEmpty(page)) {
+ stats_out->decommittable_bytes += page_bytes_resident;
+ ++stats_out->num_empty_pages;
+ } else if (PartitionPageStateIsFull(page)) {
+ ++stats_out->num_full_pages;
+ } else {
+ DCHECK(PartitionPageStateIsActive(page));
+ ++stats_out->num_active_pages;
+ }
+}
+
+static void PartitionDumpBucketStats(PartitionBucketMemoryStats* stats_out,
+ const PartitionBucket* bucket) {
+ DCHECK(!PartitionBucketIsDirectMapped(bucket));
+ stats_out->is_valid = false;
+ // If the active page list is empty (== &PartitionRootGeneric::gSeedPage),
+ // the bucket might still need to be reported if it has a list of empty,
+ // decommitted or full pages.
+ if (bucket->active_pages_head == &PartitionRootGeneric::gSeedPage &&
+ !bucket->empty_pages_head && !bucket->decommitted_pages_head &&
+ !bucket->num_full_pages)
+ return;
+
+ memset(stats_out, '\0', sizeof(*stats_out));
+ stats_out->is_valid = true;
+ stats_out->is_direct_map = false;
+ stats_out->num_full_pages = static_cast<size_t>(bucket->num_full_pages);
+ stats_out->bucket_slot_size = bucket->slot_size;
+ uint16_t bucket_num_slots = PartitionBucketSlots(bucket);
+ size_t bucket_useful_storage = stats_out->bucket_slot_size * bucket_num_slots;
+ stats_out->allocated_page_size = PartitionBucketBytes(bucket);
+ stats_out->active_bytes = bucket->num_full_pages * bucket_useful_storage;
+ stats_out->resident_bytes =
+ bucket->num_full_pages * stats_out->allocated_page_size;
+
+ for (const PartitionPage* page = bucket->empty_pages_head; page;
+ page = page->next_page) {
+ DCHECK(PartitionPageStateIsEmpty(page) ||
+ PartitionPageStateIsDecommitted(page));
+ PartitionDumpPageStats(stats_out, page);
+ }
+ for (const PartitionPage* page = bucket->decommitted_pages_head; page;
+ page = page->next_page) {
+ DCHECK(PartitionPageStateIsDecommitted(page));
+ PartitionDumpPageStats(stats_out, page);
+ }
+
+ if (bucket->active_pages_head != &PartitionRootGeneric::gSeedPage) {
+ for (const PartitionPage* page = bucket->active_pages_head; page;
+ page = page->next_page) {
+ DCHECK(page != &PartitionRootGeneric::gSeedPage);
+ PartitionDumpPageStats(stats_out, page);
+ }
+ }
+}
+
+void PartitionDumpStatsGeneric(PartitionRootGeneric* partition,
+ const char* partition_name,
+ bool is_light_dump,
+ PartitionStatsDumper* dumper) {
+ PartitionMemoryStats stats = {0};
+ stats.total_mmapped_bytes = partition->total_size_of_super_pages +
+ partition->total_size_of_direct_mapped_pages;
+ stats.total_committed_bytes = partition->total_size_of_committed_pages;
+
+ size_t direct_mapped_allocations_total_size = 0;
+
+ static const size_t kMaxReportableDirectMaps = 4096;
+
+ // Allocate on the heap rather than on the stack to avoid stack overflow
+ // skirmishes (on Windows, in particular).
+ std::unique_ptr<uint32_t[]> direct_map_lengths = nullptr;
+ if (!is_light_dump) {
+ direct_map_lengths =
+ std::unique_ptr<uint32_t[]>(new uint32_t[kMaxReportableDirectMaps]);
+ }
+
+ PartitionBucketMemoryStats bucket_stats[kGenericNumBuckets];
+ size_t num_direct_mapped_allocations = 0;
+ {
+ subtle::SpinLock::Guard guard(partition->lock);
+
+ for (size_t i = 0; i < kGenericNumBuckets; ++i) {
+ const PartitionBucket* bucket = &partition->buckets[i];
+ // Don't report the pseudo buckets that the generic allocator sets up in
+ // order to preserve a fast size->bucket map (see
+ // PartitionAllocGenericInit for details).
+ if (!bucket->active_pages_head)
+ bucket_stats[i].is_valid = false;
+ else
+ PartitionDumpBucketStats(&bucket_stats[i], bucket);
+ if (bucket_stats[i].is_valid) {
+ stats.total_resident_bytes += bucket_stats[i].resident_bytes;
+ stats.total_active_bytes += bucket_stats[i].active_bytes;
+ stats.total_decommittable_bytes += bucket_stats[i].decommittable_bytes;
+ stats.total_discardable_bytes += bucket_stats[i].discardable_bytes;
+ }
+ }
+
+ for (PartitionDirectMapExtent *extent = partition->direct_map_list;
+ extent && num_direct_mapped_allocations < kMaxReportableDirectMaps;
+ extent = extent->next_extent, ++num_direct_mapped_allocations) {
+ DCHECK(!extent->next_extent ||
+ extent->next_extent->prev_extent == extent);
+ size_t slot_size = extent->bucket->slot_size;
+ direct_mapped_allocations_total_size += slot_size;
+ if (is_light_dump)
+ continue;
+ direct_map_lengths[num_direct_mapped_allocations] = slot_size;
+ }
+ }
+
+ if (!is_light_dump) {
+ // Call |PartitionsDumpBucketStats| after collecting stats because it can
+ // try to allocate using |PartitionAllocGeneric| and it can't obtain the
+ // lock.
+ for (size_t i = 0; i < kGenericNumBuckets; ++i) {
+ if (bucket_stats[i].is_valid)
+ dumper->PartitionsDumpBucketStats(partition_name, &bucket_stats[i]);
+ }
+
+ for (size_t i = 0; i < num_direct_mapped_allocations; ++i) {
+ uint32_t size = direct_map_lengths[i];
+
+ PartitionBucketMemoryStats stats;
+ memset(&stats, '\0', sizeof(stats));
+ stats.is_valid = true;
+ stats.is_direct_map = true;
+ stats.num_full_pages = 1;
+ stats.allocated_page_size = size;
+ stats.bucket_slot_size = size;
+ stats.active_bytes = size;
+ stats.resident_bytes = size;
+ dumper->PartitionsDumpBucketStats(partition_name, &stats);
+ }
+ }
+
+ stats.total_resident_bytes += direct_mapped_allocations_total_size;
+ stats.total_active_bytes += direct_mapped_allocations_total_size;
+ dumper->PartitionDumpTotals(partition_name, &stats);
+}
+
+void PartitionDumpStats(PartitionRoot* partition,
+ const char* partition_name,
+ bool is_light_dump,
+ PartitionStatsDumper* dumper) {
+ static const size_t kMaxReportableBuckets = 4096 / sizeof(void*);
+ PartitionBucketMemoryStats memory_stats[kMaxReportableBuckets];
+ const size_t partitionNumBuckets = partition->num_buckets;
+ DCHECK(partitionNumBuckets <= kMaxReportableBuckets);
+
+ for (size_t i = 0; i < partitionNumBuckets; ++i)
+ PartitionDumpBucketStats(&memory_stats[i], &partition->buckets()[i]);
+
+ // PartitionsDumpBucketStats is called after collecting stats because it
+ // can use PartitionAlloc to allocate and this can affect the statistics.
+ PartitionMemoryStats stats = {0};
+ stats.total_mmapped_bytes = partition->total_size_of_super_pages;
+ stats.total_committed_bytes = partition->total_size_of_committed_pages;
+ DCHECK(!partition->total_size_of_direct_mapped_pages);
+ for (size_t i = 0; i < partitionNumBuckets; ++i) {
+ if (memory_stats[i].is_valid) {
+ stats.total_resident_bytes += memory_stats[i].resident_bytes;
+ stats.total_active_bytes += memory_stats[i].active_bytes;
+ stats.total_decommittable_bytes += memory_stats[i].decommittable_bytes;
+ stats.total_discardable_bytes += memory_stats[i].discardable_bytes;
+ if (!is_light_dump)
+ dumper->PartitionsDumpBucketStats(partition_name, &memory_stats[i]);
+ }
+ }
+ dumper->PartitionDumpTotals(partition_name, &stats);
+}
+
+} // namespace base
+} // namespace pdfium
diff --git a/chromium/third_party/pdfium/third_party/base/allocator/partition_allocator/partition_alloc.h b/chromium/third_party/pdfium/third_party/base/allocator/partition_allocator/partition_alloc.h
new file mode 100644
index 00000000000..285f2af5a42
--- /dev/null
+++ b/chromium/third_party/pdfium/third_party/base/allocator/partition_allocator/partition_alloc.h
@@ -0,0 +1,908 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef BASE_ALLOCATOR_PARTITION_ALLOCATOR_PARTITION_ALLOC_H
+#define BASE_ALLOCATOR_PARTITION_ALLOCATOR_PARTITION_ALLOC_H
+
+// DESCRIPTION
+// partitionAlloc() / PartitionAllocGeneric() and PartitionFree() /
+// PartitionFreeGeneric() are approximately analagous to malloc() and free().
+//
+// The main difference is that a PartitionRoot / PartitionRootGeneric object
+// must be supplied to these functions, representing a specific "heap partition"
+// that will be used to satisfy the allocation. Different partitions are
+// guaranteed to exist in separate address spaces, including being separate from
+// the main system heap. If the contained objects are all freed, physical memory
+// is returned to the system but the address space remains reserved.
+// See PartitionAlloc.md for other security properties PartitionAlloc provides.
+//
+// THE ONLY LEGITIMATE WAY TO OBTAIN A PartitionRoot IS THROUGH THE
+// SizeSpecificPartitionAllocator / PartitionAllocatorGeneric classes. To
+// minimize the instruction count to the fullest extent possible, the
+// PartitionRoot is really just a header adjacent to other data areas provided
+// by the allocator class.
+//
+// The partitionAlloc() variant of the API has the following caveats:
+// - Allocations and frees against a single partition must be single threaded.
+// - Allocations must not exceed a max size, chosen at compile-time via a
+// templated parameter to PartitionAllocator.
+// - Allocation sizes must be aligned to the system pointer size.
+// - Allocations are bucketed exactly according to size.
+//
+// And for PartitionAllocGeneric():
+// - Multi-threaded use against a single partition is ok; locking is handled.
+// - Allocations of any arbitrary size can be handled (subject to a limit of
+// INT_MAX bytes for security reasons).
+// - Bucketing is by approximate size, for example an allocation of 4000 bytes
+// might be placed into a 4096-byte bucket. Bucket sizes are chosen to try and
+// keep worst-case waste to ~10%.
+//
+// The allocators are designed to be extremely fast, thanks to the following
+// properties and design:
+// - Just two single (reasonably predicatable) branches in the hot / fast path
+// for both allocating and (significantly) freeing.
+// - A minimal number of operations in the hot / fast path, with the slow paths
+// in separate functions, leading to the possibility of inlining.
+// - Each partition page (which is usually multiple physical pages) has a
+// metadata structure which allows fast mapping of free() address to an
+// underlying bucket.
+// - Supports a lock-free API for fast performance in single-threaded cases.
+// - The freelist for a given bucket is split across a number of partition
+// pages, enabling various simple tricks to try and minimize fragmentation.
+// - Fine-grained bucket sizes leading to less waste and better packing.
+//
+// The following security properties could be investigated in the future:
+// - Per-object bucketing (instead of per-size) is mostly available at the API,
+// but not used yet.
+// - No randomness of freelist entries or bucket position.
+// - Better checking for wild pointers in free().
+// - Better freelist masking function to guarantee fault on 32-bit.
+
+#include <limits.h>
+#include <string.h>
+
+#include "third_party/base/allocator/partition_allocator/page_allocator.h"
+#include "third_party/base/allocator/partition_allocator/spin_lock.h"
+#include "third_party/base/bits.h"
+#include "third_party/base/compiler_specific.h"
+#include "third_party/base/logging.h"
+#include "third_party/base/sys_byteorder.h"
+#include "third_party/build/build_config.h"
+
+#if defined(MEMORY_TOOL_REPLACES_ALLOCATOR)
+#include <stdlib.h>
+#endif
+
+namespace pdfium {
+namespace base {
+
+// Allocation granularity of sizeof(void*) bytes.
+static const size_t kAllocationGranularity = sizeof(void*);
+static const size_t kAllocationGranularityMask = kAllocationGranularity - 1;
+static const size_t kBucketShift = (kAllocationGranularity == 8) ? 3 : 2;
+
+// Underlying partition storage pages are a power-of-two size. It is typical
+// for a partition page to be based on multiple system pages. Most references to
+// "page" refer to partition pages.
+// We also have the concept of "super pages" -- these are the underlying system
+// allocations we make. Super pages contain multiple partition pages inside them
+// and include space for a small amount of metadata per partition page.
+// Inside super pages, we store "slot spans". A slot span is a continguous range
+// of one or more partition pages that stores allocations of the same size.
+// Slot span sizes are adjusted depending on the allocation size, to make sure
+// the packing does not lead to unused (wasted) space at the end of the last
+// system page of the span. For our current max slot span size of 64k and other
+// constant values, we pack _all_ PartitionAllocGeneric() sizes perfectly up
+// against the end of a system page.
+static const size_t kPartitionPageShift = 14; // 16KB
+static const size_t kPartitionPageSize = 1 << kPartitionPageShift;
+static const size_t kPartitionPageOffsetMask = kPartitionPageSize - 1;
+static const size_t kPartitionPageBaseMask = ~kPartitionPageOffsetMask;
+static const size_t kMaxPartitionPagesPerSlotSpan = 4;
+
+// To avoid fragmentation via never-used freelist entries, we hand out partition
+// freelist sections gradually, in units of the dominant system page size.
+// What we're actually doing is avoiding filling the full partition page (16 KB)
+// with freelist pointers right away. Writing freelist pointers will fault and
+// dirty a private page, which is very wasteful if we never actually store
+// objects there.
+static const size_t kNumSystemPagesPerPartitionPage =
+ kPartitionPageSize / kSystemPageSize;
+static const size_t kMaxSystemPagesPerSlotSpan =
+ kNumSystemPagesPerPartitionPage * kMaxPartitionPagesPerSlotSpan;
+
+// We reserve virtual address space in 2MB chunks (aligned to 2MB as well).
+// These chunks are called "super pages". We do this so that we can store
+// metadata in the first few pages of each 2MB aligned section. This leads to
+// a very fast free(). We specifically choose 2MB because this virtual address
+// block represents a full but single PTE allocation on ARM, ia32 and x64.
+//
+// The layout of the super page is as follows. The sizes below are the same
+// for 32 bit and 64 bit.
+//
+// | Guard page (4KB) |
+// | Metadata page (4KB) |
+// | Guard pages (8KB) |
+// | Slot span |
+// | Slot span |
+// | ... |
+// | Slot span |
+// | Guard page (4KB) |
+//
+// - Each slot span is a contiguous range of one or more PartitionPages.
+// - The metadata page has the following format. Note that the PartitionPage
+// that is not at the head of a slot span is "unused". In other words,
+// the metadata for the slot span is stored only in the first PartitionPage
+// of the slot span. Metadata accesses to other PartitionPages are
+// redirected to the first PartitionPage.
+//
+// | SuperPageExtentEntry (32B) |
+// | PartitionPage of slot span 1 (32B, used) |
+// | PartitionPage of slot span 1 (32B, unused) |
+// | PartitionPage of slot span 1 (32B, unused) |
+// | PartitionPage of slot span 2 (32B, used) |
+// | PartitionPage of slot span 3 (32B, used) |
+// | ... |
+// | PartitionPage of slot span N (32B, unused) |
+//
+// A direct mapped page has a similar layout to fake it looking like a super
+// page:
+//
+// | Guard page (4KB) |
+// | Metadata page (4KB) |
+// | Guard pages (8KB) |
+// | Direct mapped object |
+// | Guard page (4KB) |
+//
+// - The metadata page has the following layout:
+//
+// | SuperPageExtentEntry (32B) |
+// | PartitionPage (32B) |
+// | PartitionBucket (32B) |
+// | PartitionDirectMapExtent (8B) |
+static const size_t kSuperPageShift = 21; // 2MB
+static const size_t kSuperPageSize = 1 << kSuperPageShift;
+static const size_t kSuperPageOffsetMask = kSuperPageSize - 1;
+static const size_t kSuperPageBaseMask = ~kSuperPageOffsetMask;
+static const size_t kNumPartitionPagesPerSuperPage =
+ kSuperPageSize / kPartitionPageSize;
+
+static const size_t kPageMetadataShift = 5; // 32 bytes per partition page.
+static const size_t kPageMetadataSize = 1 << kPageMetadataShift;
+
+// The following kGeneric* constants apply to the generic variants of the API.
+// The "order" of an allocation is closely related to the power-of-two size of
+// the allocation. More precisely, the order is the bit index of the
+// most-significant-bit in the allocation size, where the bit numbers starts
+// at index 1 for the least-significant-bit.
+// In terms of allocation sizes, order 0 covers 0, order 1 covers 1, order 2
+// covers 2->3, order 3 covers 4->7, order 4 covers 8->15.
+static const size_t kGenericMinBucketedOrder = 4; // 8 bytes.
+static const size_t kGenericMaxBucketedOrder =
+ 20; // Largest bucketed order is 1<<(20-1) (storing 512KB -> almost 1MB)
+static const size_t kGenericNumBucketedOrders =
+ (kGenericMaxBucketedOrder - kGenericMinBucketedOrder) + 1;
+// Eight buckets per order (for the higher orders), e.g. order 8 is 128, 144,
+// 160, ..., 240:
+static const size_t kGenericNumBucketsPerOrderBits = 3;
+static const size_t kGenericNumBucketsPerOrder =
+ 1 << kGenericNumBucketsPerOrderBits;
+static const size_t kGenericNumBuckets =
+ kGenericNumBucketedOrders * kGenericNumBucketsPerOrder;
+static const size_t kGenericSmallestBucket = 1
+ << (kGenericMinBucketedOrder - 1);
+static const size_t kGenericMaxBucketSpacing =
+ 1 << ((kGenericMaxBucketedOrder - 1) - kGenericNumBucketsPerOrderBits);
+static const size_t kGenericMaxBucketed =
+ (1 << (kGenericMaxBucketedOrder - 1)) +
+ ((kGenericNumBucketsPerOrder - 1) * kGenericMaxBucketSpacing);
+static const size_t kGenericMinDirectMappedDownsize =
+ kGenericMaxBucketed +
+ 1; // Limit when downsizing a direct mapping using realloc().
+static const size_t kGenericMaxDirectMapped = INT_MAX - kSystemPageSize;
+static const size_t kBitsPerSizeT = sizeof(void*) * CHAR_BIT;
+
+// Constants for the memory reclaim logic.
+static const size_t kMaxFreeableSpans = 16;
+
+// If the total size in bytes of allocated but not committed pages exceeds this
+// value (probably it is a "out of virtual address space" crash),
+// a special crash stack trace is generated at |partitionOutOfMemory|.
+// This is to distinguish "out of virtual address space" from
+// "out of physical memory" in crash reports.
+static const size_t kReasonableSizeOfUnusedPages = 1024 * 1024 * 1024; // 1GiB
+
+#if DCHECK_IS_ON()
+// These two byte values match tcmalloc.
+static const unsigned char kUninitializedByte = 0xAB;
+static const unsigned char kFreedByte = 0xCD;
+static const size_t kCookieSize =
+ 16; // Handles alignment up to XMM instructions on Intel.
+static const unsigned char kCookieValue[kCookieSize] = {
+ 0xDE, 0xAD, 0xBE, 0xEF, 0xCA, 0xFE, 0xD0, 0x0D,
+ 0x13, 0x37, 0xF0, 0x05, 0xBA, 0x11, 0xAB, 0x1E};
+#endif
+
+struct PartitionBucket;
+struct PartitionRootBase;
+
+struct PartitionFreelistEntry {
+ PartitionFreelistEntry* next;
+};
+
+// Some notes on page states. A page can be in one of four major states:
+// 1) Active.
+// 2) Full.
+// 3) Empty.
+// 4) Decommitted.
+// An active page has available free slots. A full page has no free slots. An
+// empty page has no free slots, and a decommitted page is an empty page that
+// had its backing memory released back to the system.
+// There are two linked lists tracking the pages. The "active page" list is an
+// approximation of a list of active pages. It is an approximation because
+// full, empty and decommitted pages may briefly be present in the list until
+// we next do a scan over it.
+// The "empty page" list is an accurate list of pages which are either empty
+// or decommitted.
+//
+// The significant page transitions are:
+// - free() will detect when a full page has a slot free()'d and immediately
+// return the page to the head of the active list.
+// - free() will detect when a page is fully emptied. It _may_ add it to the
+// empty list or it _may_ leave it on the active list until a future list scan.
+// - malloc() _may_ scan the active page list in order to fulfil the request.
+// If it does this, full, empty and decommitted pages encountered will be
+// booted out of the active list. If there are no suitable active pages found,
+// an empty or decommitted page (if one exists) will be pulled from the empty
+// list on to the active list.
+struct PartitionPage {
+ PartitionFreelistEntry* freelist_head;
+ PartitionPage* next_page;
+ PartitionBucket* bucket;
+ // Deliberately signed, 0 for empty or decommitted page, -n for full pages:
+ int16_t num_allocated_slots;
+ uint16_t num_unprovisioned_slots;
+ uint16_t page_offset;
+ int16_t empty_cache_index; // -1 if not in the empty cache.
+};
+
+struct PartitionBucket {
+ PartitionPage* active_pages_head; // Accessed most in hot path => goes first.
+ PartitionPage* empty_pages_head;
+ PartitionPage* decommitted_pages_head;
+ uint32_t slot_size;
+ unsigned num_system_pages_per_slot_span : 8;
+ unsigned num_full_pages : 24;
+};
+
+// An "extent" is a span of consecutive superpages. We link to the partition's
+// next extent (if there is one) at the very start of a superpage's metadata
+// area.
+struct PartitionSuperPageExtentEntry {
+ PartitionRootBase* root;
+ char* super_page_base;
+ char* super_pages_end;
+ PartitionSuperPageExtentEntry* next;
+};
+
+struct PartitionDirectMapExtent {
+ PartitionDirectMapExtent* next_extent;
+ PartitionDirectMapExtent* prev_extent;
+ PartitionBucket* bucket;
+ size_t map_size; // Mapped size, not including guard pages and meta-data.
+};
+
+struct BASE_EXPORT PartitionRootBase {
+ size_t total_size_of_committed_pages;
+ size_t total_size_of_super_pages;
+ size_t total_size_of_direct_mapped_pages;
+ // Invariant: total_size_of_committed_pages <=
+ // total_size_of_super_pages +
+ // total_size_of_direct_mapped_pages.
+ unsigned num_buckets;
+ unsigned max_allocation;
+ bool initialized;
+ char* next_super_page;
+ char* next_partition_page;
+ char* next_partition_page_end;
+ PartitionSuperPageExtentEntry* current_extent;
+ PartitionSuperPageExtentEntry* first_extent;
+ PartitionDirectMapExtent* direct_map_list;
+ PartitionPage* global_empty_page_ring[kMaxFreeableSpans];
+ int16_t global_empty_page_ring_index;
+ uintptr_t inverted_self;
+
+ static subtle::SpinLock gInitializedLock;
+ static bool gInitialized;
+ // gSeedPage is used as a sentinel to indicate that there is no page
+ // in the active page list. We can use nullptr, but in that case we need
+ // to add a null-check branch to the hot allocation path. We want to avoid
+ // that.
+ static PartitionPage gSeedPage;
+ static PartitionBucket gPagedBucket;
+ // gOomHandlingFunction is invoked when ParitionAlloc hits OutOfMemory.
+ static void (*gOomHandlingFunction)();
+};
+
+// Never instantiate a PartitionRoot directly, instead use PartitionAlloc.
+struct PartitionRoot : public PartitionRootBase {
+ // The PartitionAlloc templated class ensures the following is correct.
+ ALWAYS_INLINE PartitionBucket* buckets() {
+ return reinterpret_cast<PartitionBucket*>(this + 1);
+ }
+ ALWAYS_INLINE const PartitionBucket* buckets() const {
+ return reinterpret_cast<const PartitionBucket*>(this + 1);
+ }
+};
+
+// Never instantiate a PartitionRootGeneric directly, instead use
+// PartitionAllocatorGeneric.
+struct PartitionRootGeneric : public PartitionRootBase {
+ subtle::SpinLock lock;
+ // Some pre-computed constants.
+ size_t order_index_shifts[kBitsPerSizeT + 1];
+ size_t order_sub_index_masks[kBitsPerSizeT + 1];
+ // The bucket lookup table lets us map a size_t to a bucket quickly.
+ // The trailing +1 caters for the overflow case for very large allocation
+ // sizes. It is one flat array instead of a 2D array because in the 2D
+ // world, we'd need to index array[blah][max+1] which risks undefined
+ // behavior.
+ PartitionBucket*
+ bucket_lookups[((kBitsPerSizeT + 1) * kGenericNumBucketsPerOrder) + 1];
+ PartitionBucket buckets[kGenericNumBuckets];
+};
+
+// Flags for PartitionAllocGenericFlags.
+enum PartitionAllocFlags {
+ PartitionAllocReturnNull = 1 << 0,
+};
+
+// Struct used to retrieve total memory usage of a partition. Used by
+// PartitionStatsDumper implementation.
+struct PartitionMemoryStats {
+ size_t total_mmapped_bytes; // Total bytes mmaped from the system.
+ size_t total_committed_bytes; // Total size of commmitted pages.
+ size_t total_resident_bytes; // Total bytes provisioned by the partition.
+ size_t total_active_bytes; // Total active bytes in the partition.
+ size_t total_decommittable_bytes; // Total bytes that could be decommitted.
+ size_t total_discardable_bytes; // Total bytes that could be discarded.
+};
+
+// Struct used to retrieve memory statistics about a partition bucket. Used by
+// PartitionStatsDumper implementation.
+struct PartitionBucketMemoryStats {
+ bool is_valid; // Used to check if the stats is valid.
+ bool is_direct_map; // True if this is a direct mapping; size will not be
+ // unique.
+ uint32_t bucket_slot_size; // The size of the slot in bytes.
+ uint32_t allocated_page_size; // Total size the partition page allocated from
+ // the system.
+ uint32_t active_bytes; // Total active bytes used in the bucket.
+ uint32_t resident_bytes; // Total bytes provisioned in the bucket.
+ uint32_t decommittable_bytes; // Total bytes that could be decommitted.
+ uint32_t discardable_bytes; // Total bytes that could be discarded.
+ uint32_t num_full_pages; // Number of pages with all slots allocated.
+ uint32_t num_active_pages; // Number of pages that have at least one
+ // provisioned slot.
+ uint32_t num_empty_pages; // Number of pages that are empty
+ // but not decommitted.
+ uint32_t num_decommitted_pages; // Number of pages that are empty
+ // and decommitted.
+};
+
+// Interface that is passed to PartitionDumpStats and
+// PartitionDumpStatsGeneric for using the memory statistics.
+class BASE_EXPORT PartitionStatsDumper {
+ public:
+ // Called to dump total memory used by partition, once per partition.
+ virtual void PartitionDumpTotals(const char* partition_name,
+ const PartitionMemoryStats*) = 0;
+
+ // Called to dump stats about buckets, for each bucket.
+ virtual void PartitionsDumpBucketStats(const char* partition_name,
+ const PartitionBucketMemoryStats*) = 0;
+};
+
+BASE_EXPORT void PartitionAllocGlobalInit(void (*oom_handling_function)());
+BASE_EXPORT void PartitionAllocInit(PartitionRoot*,
+ size_t num_buckets,
+ size_t max_allocation);
+BASE_EXPORT void PartitionAllocGenericInit(PartitionRootGeneric*);
+
+enum PartitionPurgeFlags {
+ // Decommitting the ring list of empty pages is reasonably fast.
+ PartitionPurgeDecommitEmptyPages = 1 << 0,
+ // Discarding unused system pages is slower, because it involves walking all
+ // freelists in all active partition pages of all buckets >= system page
+ // size. It often frees a similar amount of memory to decommitting the empty
+ // pages, though.
+ PartitionPurgeDiscardUnusedSystemPages = 1 << 1,
+};
+
+BASE_EXPORT void PartitionPurgeMemory(PartitionRoot*, int);
+BASE_EXPORT void PartitionPurgeMemoryGeneric(PartitionRootGeneric*, int);
+
+BASE_EXPORT NOINLINE void* PartitionAllocSlowPath(PartitionRootBase*,
+ int,
+ size_t,
+ PartitionBucket*);
+BASE_EXPORT NOINLINE void PartitionFreeSlowPath(PartitionPage*);
+BASE_EXPORT NOINLINE void* PartitionReallocGeneric(PartitionRootGeneric*,
+ void*,
+ size_t,
+ const char* type_name);
+
+BASE_EXPORT void PartitionDumpStats(PartitionRoot*,
+ const char* partition_name,
+ bool is_light_dump,
+ PartitionStatsDumper*);
+BASE_EXPORT void PartitionDumpStatsGeneric(PartitionRootGeneric*,
+ const char* partition_name,
+ bool is_light_dump,
+ PartitionStatsDumper*);
+
+class BASE_EXPORT PartitionAllocHooks {
+ public:
+ typedef void AllocationHook(void* address, size_t, const char* type_name);
+ typedef void FreeHook(void* address);
+
+ static void SetAllocationHook(AllocationHook* hook) {
+ allocation_hook_ = hook;
+ }
+ static void SetFreeHook(FreeHook* hook) { free_hook_ = hook; }
+
+ static void AllocationHookIfEnabled(void* address,
+ size_t size,
+ const char* type_name) {
+ AllocationHook* hook = allocation_hook_;
+ if (UNLIKELY(hook != nullptr))
+ hook(address, size, type_name);
+ }
+
+ static void FreeHookIfEnabled(void* address) {
+ FreeHook* hook = free_hook_;
+ if (UNLIKELY(hook != nullptr))
+ hook(address);
+ }
+
+ static void ReallocHookIfEnabled(void* old_address,
+ void* new_address,
+ size_t size,
+ const char* type_name) {
+ // Report a reallocation as a free followed by an allocation.
+ AllocationHook* allocation_hook = allocation_hook_;
+ FreeHook* free_hook = free_hook_;
+ if (UNLIKELY(allocation_hook && free_hook)) {
+ free_hook(old_address);
+ allocation_hook(new_address, size, type_name);
+ }
+ }
+
+ private:
+ // Pointers to hook functions that PartitionAlloc will call on allocation and
+ // free if the pointers are non-null.
+ static AllocationHook* allocation_hook_;
+ static FreeHook* free_hook_;
+};
+
+ALWAYS_INLINE PartitionFreelistEntry* PartitionFreelistMask(
+ PartitionFreelistEntry* ptr) {
+// We use bswap on little endian as a fast mask for two reasons:
+// 1) If an object is freed and its vtable used where the attacker doesn't
+// get the chance to run allocations between the free and use, the vtable
+// dereference is likely to fault.
+// 2) If the attacker has a linear buffer overflow and elects to try and
+// corrupt a freelist pointer, partial pointer overwrite attacks are
+// thwarted.
+// For big endian, similar guarantees are arrived at with a negation.
+#if defined(ARCH_CPU_BIG_ENDIAN)
+ uintptr_t masked = ~reinterpret_cast<uintptr_t>(ptr);
+#else
+ uintptr_t masked = ByteSwapUintPtrT(reinterpret_cast<uintptr_t>(ptr));
+#endif
+ return reinterpret_cast<PartitionFreelistEntry*>(masked);
+}
+
+ALWAYS_INLINE size_t PartitionCookieSizeAdjustAdd(size_t size) {
+#if DCHECK_IS_ON()
+ // Add space for cookies, checking for integer overflow. TODO(palmer):
+ // Investigate the performance and code size implications of using
+ // CheckedNumeric throughout PA.
+ DCHECK(size + (2 * kCookieSize) > size);
+ size += 2 * kCookieSize;
+#endif
+ return size;
+}
+
+ALWAYS_INLINE size_t PartitionCookieSizeAdjustSubtract(size_t size) {
+#if DCHECK_IS_ON()
+ // Remove space for cookies.
+ DCHECK(size >= 2 * kCookieSize);
+ size -= 2 * kCookieSize;
+#endif
+ return size;
+}
+
+ALWAYS_INLINE void* PartitionCookieFreePointerAdjust(void* ptr) {
+#if DCHECK_IS_ON()
+ // The value given to the application is actually just after the cookie.
+ ptr = static_cast<char*>(ptr) - kCookieSize;
+#endif
+ return ptr;
+}
+
+ALWAYS_INLINE void PartitionCookieWriteValue(void* ptr) {
+#if DCHECK_IS_ON()
+ unsigned char* cookie_ptr = reinterpret_cast<unsigned char*>(ptr);
+ for (size_t i = 0; i < kCookieSize; ++i, ++cookie_ptr)
+ *cookie_ptr = kCookieValue[i];
+#endif
+}
+
+ALWAYS_INLINE void PartitionCookieCheckValue(void* ptr) {
+#if DCHECK_IS_ON()
+ unsigned char* cookie_ptr = reinterpret_cast<unsigned char*>(ptr);
+ for (size_t i = 0; i < kCookieSize; ++i, ++cookie_ptr)
+ DCHECK(*cookie_ptr == kCookieValue[i]);
+#endif
+}
+
+ALWAYS_INLINE char* PartitionSuperPageToMetadataArea(char* ptr) {
+ uintptr_t pointer_as_uint = reinterpret_cast<uintptr_t>(ptr);
+ DCHECK(!(pointer_as_uint & kSuperPageOffsetMask));
+ // The metadata area is exactly one system page (the guard page) into the
+ // super page.
+ return reinterpret_cast<char*>(pointer_as_uint + kSystemPageSize);
+}
+
+ALWAYS_INLINE PartitionPage* PartitionPointerToPageNoAlignmentCheck(void* ptr) {
+ uintptr_t pointer_as_uint = reinterpret_cast<uintptr_t>(ptr);
+ char* super_page_ptr =
+ reinterpret_cast<char*>(pointer_as_uint & kSuperPageBaseMask);
+ uintptr_t partition_page_index =
+ (pointer_as_uint & kSuperPageOffsetMask) >> kPartitionPageShift;
+ // Index 0 is invalid because it is the metadata and guard area and
+ // the last index is invalid because it is a guard page.
+ DCHECK(partition_page_index);
+ DCHECK(partition_page_index < kNumPartitionPagesPerSuperPage - 1);
+ PartitionPage* page = reinterpret_cast<PartitionPage*>(
+ PartitionSuperPageToMetadataArea(super_page_ptr) +
+ (partition_page_index << kPageMetadataShift));
+ // Partition pages in the same slot span can share the same page object.
+ // Adjust for that.
+ size_t delta = page->page_offset << kPageMetadataShift;
+ page =
+ reinterpret_cast<PartitionPage*>(reinterpret_cast<char*>(page) - delta);
+ return page;
+}
+
+ALWAYS_INLINE void* PartitionPageToPointer(const PartitionPage* page) {
+ uintptr_t pointer_as_uint = reinterpret_cast<uintptr_t>(page);
+ uintptr_t super_page_offset = (pointer_as_uint & kSuperPageOffsetMask);
+ DCHECK(super_page_offset > kSystemPageSize);
+ DCHECK(super_page_offset < kSystemPageSize + (kNumPartitionPagesPerSuperPage *
+ kPageMetadataSize));
+ uintptr_t partition_page_index =
+ (super_page_offset - kSystemPageSize) >> kPageMetadataShift;
+ // Index 0 is invalid because it is the metadata area and the last index is
+ // invalid because it is a guard page.
+ DCHECK(partition_page_index);
+ DCHECK(partition_page_index < kNumPartitionPagesPerSuperPage - 1);
+ uintptr_t super_page_base = (pointer_as_uint & kSuperPageBaseMask);
+ void* ret = reinterpret_cast<void*>(
+ super_page_base + (partition_page_index << kPartitionPageShift));
+ return ret;
+}
+
+ALWAYS_INLINE PartitionPage* PartitionPointerToPage(void* ptr) {
+ PartitionPage* page = PartitionPointerToPageNoAlignmentCheck(ptr);
+ // Checks that the pointer is a multiple of bucket size.
+ DCHECK(!((reinterpret_cast<uintptr_t>(ptr) -
+ reinterpret_cast<uintptr_t>(PartitionPageToPointer(page))) %
+ page->bucket->slot_size));
+ return page;
+}
+
+ALWAYS_INLINE bool PartitionBucketIsDirectMapped(
+ const PartitionBucket* bucket) {
+ return !bucket->num_system_pages_per_slot_span;
+}
+
+ALWAYS_INLINE size_t PartitionBucketBytes(const PartitionBucket* bucket) {
+ return bucket->num_system_pages_per_slot_span * kSystemPageSize;
+}
+
+ALWAYS_INLINE uint16_t PartitionBucketSlots(const PartitionBucket* bucket) {
+ return static_cast<uint16_t>(PartitionBucketBytes(bucket) /
+ bucket->slot_size);
+}
+
+ALWAYS_INLINE size_t* PartitionPageGetRawSizePtr(PartitionPage* page) {
+ // For single-slot buckets which span more than one partition page, we
+ // have some spare metadata space to store the raw allocation size. We
+ // can use this to report better statistics.
+ PartitionBucket* bucket = page->bucket;
+ if (bucket->slot_size <= kMaxSystemPagesPerSlotSpan * kSystemPageSize)
+ return nullptr;
+
+ DCHECK((bucket->slot_size % kSystemPageSize) == 0);
+ DCHECK(PartitionBucketIsDirectMapped(bucket) ||
+ PartitionBucketSlots(bucket) == 1);
+ page++;
+ return reinterpret_cast<size_t*>(&page->freelist_head);
+}
+
+ALWAYS_INLINE size_t PartitionPageGetRawSize(PartitionPage* page) {
+ size_t* raw_size_ptr = PartitionPageGetRawSizePtr(page);
+ if (UNLIKELY(raw_size_ptr != nullptr))
+ return *raw_size_ptr;
+ return 0;
+}
+
+ALWAYS_INLINE PartitionRootBase* PartitionPageToRoot(PartitionPage* page) {
+ PartitionSuperPageExtentEntry* extent_entry =
+ reinterpret_cast<PartitionSuperPageExtentEntry*>(
+ reinterpret_cast<uintptr_t>(page) & kSystemPageBaseMask);
+ return extent_entry->root;
+}
+
+ALWAYS_INLINE bool PartitionPointerIsValid(void* ptr) {
+ PartitionPage* page = PartitionPointerToPage(ptr);
+ PartitionRootBase* root = PartitionPageToRoot(page);
+ return root->inverted_self == ~reinterpret_cast<uintptr_t>(root);
+}
+
+ALWAYS_INLINE void* PartitionBucketAlloc(PartitionRootBase* root,
+ int flags,
+ size_t size,
+ PartitionBucket* bucket) {
+ PartitionPage* page = bucket->active_pages_head;
+ // Check that this page is neither full nor freed.
+ DCHECK(page->num_allocated_slots >= 0);
+ void* ret = page->freelist_head;
+ if (LIKELY(ret != 0)) {
+ // If these asserts fire, you probably corrupted memory.
+ DCHECK(PartitionPointerIsValid(ret));
+ // All large allocations must go through the slow path to correctly
+ // update the size metadata.
+ DCHECK(PartitionPageGetRawSize(page) == 0);
+ PartitionFreelistEntry* new_head =
+ PartitionFreelistMask(static_cast<PartitionFreelistEntry*>(ret)->next);
+ page->freelist_head = new_head;
+ page->num_allocated_slots++;
+ } else {
+ ret = PartitionAllocSlowPath(root, flags, size, bucket);
+ DCHECK(!ret || PartitionPointerIsValid(ret));
+ }
+#if DCHECK_IS_ON()
+ if (!ret)
+ return 0;
+ // Fill the uninitialized pattern, and write the cookies.
+ page = PartitionPointerToPage(ret);
+ size_t slot_size = page->bucket->slot_size;
+ size_t raw_size = PartitionPageGetRawSize(page);
+ if (raw_size) {
+ DCHECK(raw_size == size);
+ slot_size = raw_size;
+ }
+ size_t no_cookie_size = PartitionCookieSizeAdjustSubtract(slot_size);
+ char* char_ret = static_cast<char*>(ret);
+ // The value given to the application is actually just after the cookie.
+ ret = char_ret + kCookieSize;
+ memset(ret, kUninitializedByte, no_cookie_size);
+ PartitionCookieWriteValue(char_ret);
+ PartitionCookieWriteValue(char_ret + kCookieSize + no_cookie_size);
+#endif
+ return ret;
+}
+
+ALWAYS_INLINE void* PartitionAlloc(PartitionRoot* root,
+ size_t size,
+ const char* type_name) {
+#if defined(MEMORY_TOOL_REPLACES_ALLOCATOR)
+ void* result = malloc(size);
+ CHECK(result);
+ return result;
+#else
+ size_t requested_size = size;
+ size = PartitionCookieSizeAdjustAdd(size);
+ DCHECK(root->initialized);
+ size_t index = size >> kBucketShift;
+ DCHECK(index < root->num_buckets);
+ DCHECK(size == index << kBucketShift);
+ PartitionBucket* bucket = &root->buckets()[index];
+ void* result = PartitionBucketAlloc(root, 0, size, bucket);
+ PartitionAllocHooks::AllocationHookIfEnabled(result, requested_size,
+ type_name);
+ return result;
+#endif // defined(MEMORY_TOOL_REPLACES_ALLOCATOR)
+}
+
+ALWAYS_INLINE void PartitionFreeWithPage(void* ptr, PartitionPage* page) {
+// If these asserts fire, you probably corrupted memory.
+#if DCHECK_IS_ON()
+ size_t slot_size = page->bucket->slot_size;
+ size_t raw_size = PartitionPageGetRawSize(page);
+ if (raw_size)
+ slot_size = raw_size;
+ PartitionCookieCheckValue(ptr);
+ PartitionCookieCheckValue(reinterpret_cast<char*>(ptr) + slot_size -
+ kCookieSize);
+ memset(ptr, kFreedByte, slot_size);
+#endif
+ DCHECK(page->num_allocated_slots);
+ PartitionFreelistEntry* freelist_head = page->freelist_head;
+ DCHECK(!freelist_head || PartitionPointerIsValid(freelist_head));
+ CHECK(ptr != freelist_head); // Catches an immediate double free.
+ // Look for double free one level deeper in debug.
+ DCHECK(!freelist_head || ptr != PartitionFreelistMask(freelist_head->next));
+ PartitionFreelistEntry* entry = static_cast<PartitionFreelistEntry*>(ptr);
+ entry->next = PartitionFreelistMask(freelist_head);
+ page->freelist_head = entry;
+ --page->num_allocated_slots;
+ if (UNLIKELY(page->num_allocated_slots <= 0)) {
+ PartitionFreeSlowPath(page);
+ } else {
+ // All single-slot allocations must go through the slow path to
+ // correctly update the size metadata.
+ DCHECK(PartitionPageGetRawSize(page) == 0);
+ }
+}
+
+ALWAYS_INLINE void PartitionFree(void* ptr) {
+#if defined(MEMORY_TOOL_REPLACES_ALLOCATOR)
+ free(ptr);
+#else
+ PartitionAllocHooks::FreeHookIfEnabled(ptr);
+ ptr = PartitionCookieFreePointerAdjust(ptr);
+ DCHECK(PartitionPointerIsValid(ptr));
+ PartitionPage* page = PartitionPointerToPage(ptr);
+ PartitionFreeWithPage(ptr, page);
+#endif
+}
+
+ALWAYS_INLINE PartitionBucket* PartitionGenericSizeToBucket(
+ PartitionRootGeneric* root,
+ size_t size) {
+ size_t order = kBitsPerSizeT - bits::CountLeadingZeroBitsSizeT(size);
+ // The order index is simply the next few bits after the most significant bit.
+ size_t order_index = (size >> root->order_index_shifts[order]) &
+ (kGenericNumBucketsPerOrder - 1);
+ // And if the remaining bits are non-zero we must bump the bucket up.
+ size_t sub_order_index = size & root->order_sub_index_masks[order];
+ PartitionBucket* bucket =
+ root->bucket_lookups[(order << kGenericNumBucketsPerOrderBits) +
+ order_index + !!sub_order_index];
+ DCHECK(!bucket->slot_size || bucket->slot_size >= size);
+ DCHECK(!(bucket->slot_size % kGenericSmallestBucket));
+ return bucket;
+}
+
+ALWAYS_INLINE void* PartitionAllocGenericFlags(PartitionRootGeneric* root,
+ int flags,
+ size_t size,
+ const char* type_name) {
+#if defined(MEMORY_TOOL_REPLACES_ALLOCATOR)
+ void* result = malloc(size);
+ CHECK(result || flags & PartitionAllocReturnNull);
+ return result;
+#else
+ DCHECK(root->initialized);
+ size_t requested_size = size;
+ size = PartitionCookieSizeAdjustAdd(size);
+ PartitionBucket* bucket = PartitionGenericSizeToBucket(root, size);
+ void* ret = nullptr;
+ {
+ subtle::SpinLock::Guard guard(root->lock);
+ ret = PartitionBucketAlloc(root, flags, size, bucket);
+ }
+ PartitionAllocHooks::AllocationHookIfEnabled(ret, requested_size, type_name);
+ return ret;
+#endif
+}
+
+ALWAYS_INLINE void* PartitionAllocGeneric(PartitionRootGeneric* root,
+ size_t size,
+ const char* type_name) {
+ return PartitionAllocGenericFlags(root, 0, size, type_name);
+}
+
+ALWAYS_INLINE void PartitionFreeGeneric(PartitionRootGeneric* root, void* ptr) {
+#if defined(MEMORY_TOOL_REPLACES_ALLOCATOR)
+ free(ptr);
+#else
+ DCHECK(root->initialized);
+
+ if (UNLIKELY(!ptr))
+ return;
+
+ PartitionAllocHooks::FreeHookIfEnabled(ptr);
+ ptr = PartitionCookieFreePointerAdjust(ptr);
+ DCHECK(PartitionPointerIsValid(ptr));
+ PartitionPage* page = PartitionPointerToPage(ptr);
+ {
+ subtle::SpinLock::Guard guard(root->lock);
+ PartitionFreeWithPage(ptr, page);
+ }
+#endif
+}
+
+ALWAYS_INLINE size_t PartitionDirectMapSize(size_t size) {
+ // Caller must check that the size is not above the kGenericMaxDirectMapped
+ // limit before calling. This also guards against integer overflow in the
+ // calculation here.
+ DCHECK(size <= kGenericMaxDirectMapped);
+ return (size + kSystemPageOffsetMask) & kSystemPageBaseMask;
+}
+
+ALWAYS_INLINE size_t PartitionAllocActualSize(PartitionRootGeneric* root,
+ size_t size) {
+#if defined(MEMORY_TOOL_REPLACES_ALLOCATOR)
+ return size;
+#else
+ DCHECK(root->initialized);
+ size = PartitionCookieSizeAdjustAdd(size);
+ PartitionBucket* bucket = PartitionGenericSizeToBucket(root, size);
+ if (LIKELY(!PartitionBucketIsDirectMapped(bucket))) {
+ size = bucket->slot_size;
+ } else if (size > kGenericMaxDirectMapped) {
+ // Too large to allocate => return the size unchanged.
+ } else {
+ DCHECK(bucket == &PartitionRootBase::gPagedBucket);
+ size = PartitionDirectMapSize(size);
+ }
+ return PartitionCookieSizeAdjustSubtract(size);
+#endif
+}
+
+ALWAYS_INLINE bool PartitionAllocSupportsGetSize() {
+#if defined(MEMORY_TOOL_REPLACES_ALLOCATOR)
+ return false;
+#else
+ return true;
+#endif
+}
+
+ALWAYS_INLINE size_t PartitionAllocGetSize(void* ptr) {
+ // No need to lock here. Only |ptr| being freed by another thread could
+ // cause trouble, and the caller is responsible for that not happening.
+ DCHECK(PartitionAllocSupportsGetSize());
+ ptr = PartitionCookieFreePointerAdjust(ptr);
+ DCHECK(PartitionPointerIsValid(ptr));
+ PartitionPage* page = PartitionPointerToPage(ptr);
+ size_t size = page->bucket->slot_size;
+ return PartitionCookieSizeAdjustSubtract(size);
+}
+
+// N (or more accurately, N - sizeof(void*)) represents the largest size in
+// bytes that will be handled by a SizeSpecificPartitionAllocator.
+// Attempts to partitionAlloc() more than this amount will fail.
+template <size_t N>
+class SizeSpecificPartitionAllocator {
+ public:
+ static const size_t kMaxAllocation = N - kAllocationGranularity;
+ static const size_t kNumBuckets = N / kAllocationGranularity;
+ void init() {
+ PartitionAllocInit(&partition_root_, kNumBuckets, kMaxAllocation);
+ }
+ ALWAYS_INLINE PartitionRoot* root() { return &partition_root_; }
+
+ private:
+ PartitionRoot partition_root_;
+ PartitionBucket actual_buckets_[kNumBuckets];
+};
+
+class PartitionAllocatorGeneric {
+ public:
+ void init() { PartitionAllocGenericInit(&partition_root_); }
+ ALWAYS_INLINE PartitionRootGeneric* root() { return &partition_root_; }
+
+ private:
+ PartitionRootGeneric partition_root_;
+};
+
+} // namespace base
+} // namespace pdfium
+
+#endif // BASE_ALLOCATOR_PARTITION_ALLOCATOR_PARTITION_ALLOC_H
diff --git a/chromium/third_party/pdfium/third_party/base/allocator/partition_allocator/spin_lock.cc b/chromium/third_party/pdfium/third_party/base/allocator/partition_allocator/spin_lock.cc
new file mode 100644
index 00000000000..803e4d6abcd
--- /dev/null
+++ b/chromium/third_party/pdfium/third_party/base/allocator/partition_allocator/spin_lock.cc
@@ -0,0 +1,84 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "third_party/base/allocator/partition_allocator/spin_lock.h"
+
+#if defined(OS_WIN)
+#include <windows.h>
+#elif defined(OS_POSIX)
+#include <sched.h>
+#endif
+
+// The YIELD_PROCESSOR macro wraps an architecture specific-instruction that
+// informs the processor we're in a busy wait, so it can handle the branch more
+// intelligently and e.g. reduce power to our core or give more resources to the
+// other hyper-thread on this core. See the following for context:
+// https://software.intel.com/en-us/articles/benefitting-power-and-performance-sleep-loops
+//
+// The YIELD_THREAD macro tells the OS to relinquish our quantum. This is
+// basically a worst-case fallback, and if you're hitting it with any frequency
+// you really should be using a proper lock (such as |base::Lock|)rather than
+// these spinlocks.
+#if defined(OS_WIN)
+#define YIELD_PROCESSOR YieldProcessor()
+#define YIELD_THREAD SwitchToThread()
+#elif defined(COMPILER_GCC) || defined(__clang__)
+#if defined(ARCH_CPU_X86_64) || defined(ARCH_CPU_X86)
+#define YIELD_PROCESSOR __asm__ __volatile__("pause")
+#elif defined(ARCH_CPU_ARMEL) || defined(ARCH_CPU_ARM64)
+#define YIELD_PROCESSOR __asm__ __volatile__("yield")
+#elif defined(ARCH_CPU_MIPSEL)
+// The MIPS32 docs state that the PAUSE instruction is a no-op on older
+// architectures (first added in MIPS32r2). To avoid assembler errors when
+// targeting pre-r2, we must encode the instruction manually.
+#define YIELD_PROCESSOR __asm__ __volatile__(".word 0x00000140")
+#elif defined(ARCH_CPU_MIPS64EL) && __mips_isa_rev >= 2
+// Don't bother doing using .word here since r2 is the lowest supported mips64
+// that Chromium supports.
+#define YIELD_PROCESSOR __asm__ __volatile__("pause")
+#endif
+#endif
+
+#ifndef YIELD_PROCESSOR
+#warning "Processor yield not supported on this architecture."
+#define YIELD_PROCESSOR ((void)0)
+#endif
+
+#ifndef YIELD_THREAD
+#if defined(OS_POSIX)
+#define YIELD_THREAD sched_yield()
+#else
+#warning "Thread yield not supported on this OS."
+#define YIELD_THREAD ((void)0)
+#endif
+#endif
+
+namespace pdfium {
+namespace base {
+namespace subtle {
+
+void SpinLock::LockSlow() {
+ // The value of |kYieldProcessorTries| is cargo culted from TCMalloc, Windows
+ // critical section defaults, and various other recommendations.
+ // TODO(jschuh): Further tuning may be warranted.
+ static const int kYieldProcessorTries = 1000;
+ do {
+ do {
+ for (int count = 0; count < kYieldProcessorTries; ++count) {
+ // Let the processor know we're spinning.
+ YIELD_PROCESSOR;
+ if (!lock_.load(std::memory_order_relaxed) &&
+ LIKELY(!lock_.exchange(true, std::memory_order_acquire)))
+ return;
+ }
+
+ // Give the OS a chance to schedule something on this core.
+ YIELD_THREAD;
+ } while (lock_.load(std::memory_order_relaxed));
+ } while (UNLIKELY(lock_.exchange(true, std::memory_order_acquire)));
+}
+
+} // namespace subtle
+} // namespace base
+} // namespace pdfium
diff --git a/chromium/third_party/pdfium/third_party/base/allocator/partition_allocator/spin_lock.h b/chromium/third_party/pdfium/third_party/base/allocator/partition_allocator/spin_lock.h
new file mode 100644
index 00000000000..7a42a29c4ed
--- /dev/null
+++ b/chromium/third_party/pdfium/third_party/base/allocator/partition_allocator/spin_lock.h
@@ -0,0 +1,54 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef BASE_ALLOCATOR_PARTITION_ALLOCATOR_SPIN_LOCK_H
+#define BASE_ALLOCATOR_PARTITION_ALLOCATOR_SPIN_LOCK_H
+
+#include <atomic>
+#include <memory>
+#include <mutex>
+
+#include "third_party/base/base_export.h"
+#include "third_party/base/compiler_specific.h"
+
+// Spinlock is a simple spinlock class based on the standard CPU primitive of
+// atomic increment and decrement of an int at a given memory address. These are
+// intended only for very short duration locks and assume a system with multiple
+// cores. For any potentially longer wait you should use a real lock, such as
+// |base::Lock|.
+//
+// |SpinLock|s MUST be globals. Using them as (e.g.) struct/class members will
+// result in an uninitialized lock, which is dangerously incorrect.
+
+namespace pdfium {
+namespace base {
+namespace subtle {
+
+class SpinLock {
+ public:
+ using Guard = std::lock_guard<SpinLock>;
+
+ ALWAYS_INLINE void lock() {
+ static_assert(sizeof(lock_) == sizeof(int),
+ "int and lock_ are different sizes");
+ if (LIKELY(!lock_.exchange(true, std::memory_order_acquire)))
+ return;
+ LockSlow();
+ }
+
+ ALWAYS_INLINE void unlock() { lock_.store(false, std::memory_order_release); }
+
+ private:
+ // This is called if the initial attempt to acquire the lock fails. It's
+ // slower, but has a much better scheduling and power consumption behavior.
+ BASE_EXPORT void LockSlow();
+
+ std::atomic_int lock_;
+};
+
+} // namespace subtle
+} // namespace base
+} // namespace pdfium
+
+#endif // BASE_ALLOCATOR_PARTITION_ALLOCATOR_SPIN_LOCK_H
diff --git a/chromium/third_party/pdfium/third_party/base/base_export.h b/chromium/third_party/pdfium/third_party/base/base_export.h
new file mode 100644
index 00000000000..a0d6d9bb72e
--- /dev/null
+++ b/chromium/third_party/pdfium/third_party/base/base_export.h
@@ -0,0 +1,3 @@
+#ifndef BASE_EXPORT
+#define BASE_EXPORT
+#endif
diff --git a/chromium/third_party/pdfium/third_party/base/bits.h b/chromium/third_party/pdfium/third_party/base/bits.h
new file mode 100644
index 00000000000..220be4b73c4
--- /dev/null
+++ b/chromium/third_party/pdfium/third_party/base/bits.h
@@ -0,0 +1,114 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// This file defines some bit utilities.
+
+#ifndef BASE_BITS_H_
+#define BASE_BITS_H_
+
+#include <stddef.h>
+#include <stdint.h>
+
+#include "third_party/base/compiler_specific.h"
+#include "third_party/base/logging.h"
+
+#if defined(COMPILER_MSVC)
+#include <intrin.h>
+#endif
+
+namespace pdfium {
+namespace base {
+namespace bits {
+
+// Returns the integer i such as 2^i <= n < 2^(i+1)
+inline int Log2Floor(uint32_t n) {
+ if (n == 0)
+ return -1;
+ int log = 0;
+ uint32_t value = n;
+ for (int i = 4; i >= 0; --i) {
+ int shift = (1 << i);
+ uint32_t x = value >> shift;
+ if (x != 0) {
+ value = x;
+ log += shift;
+ }
+ }
+ DCHECK_EQ(value, 1u);
+ return log;
+}
+
+// Returns the integer i such as 2^(i-1) < n <= 2^i
+inline int Log2Ceiling(uint32_t n) {
+ if (n == 0) {
+ return -1;
+ } else {
+ // Log2Floor returns -1 for 0, so the following works correctly for n=1.
+ return 1 + Log2Floor(n - 1);
+ }
+}
+
+// Round up |size| to a multiple of alignment, which must be a power of two.
+inline size_t Align(size_t size, size_t alignment) {
+ DCHECK_EQ(alignment & (alignment - 1), 0u);
+ return (size + alignment - 1) & ~(alignment - 1);
+}
+
+// These functions count the number of leading zeros in a binary value, starting
+// with the most significant bit. C does not have an operator to do this, but
+// fortunately the various compilers have built-ins that map to fast underlying
+// processor instructions.
+#if defined(COMPILER_MSVC)
+
+ALWAYS_INLINE uint32_t CountLeadingZeroBits32(uint32_t x) {
+ unsigned long index;
+ return LIKELY(_BitScanReverse(&index, x)) ? (31 - index) : 32;
+}
+
+#if defined(ARCH_CPU_64_BITS)
+
+// MSVC only supplies _BitScanForward64 when building for a 64-bit target.
+ALWAYS_INLINE uint64_t CountLeadingZeroBits64(uint64_t x) {
+ unsigned long index;
+ return LIKELY(_BitScanReverse64(&index, x)) ? (63 - index) : 64;
+}
+
+#endif
+
+#elif defined(COMPILER_GCC)
+
+// This is very annoying. __builtin_clz has undefined behaviour for an input of
+// 0, even though there's clearly a return value that makes sense, and even
+// though some processor clz instructions have defined behaviour for 0. We could
+// drop to raw __asm__ to do better, but we'll avoid doing that unless we see
+// proof that we need to.
+ALWAYS_INLINE uint32_t CountLeadingZeroBits32(uint32_t x) {
+ return LIKELY(x) ? __builtin_clz(x) : 32;
+}
+
+ALWAYS_INLINE uint64_t CountLeadingZeroBits64(uint64_t x) {
+ return LIKELY(x) ? __builtin_clzll(x) : 64;
+}
+
+#endif
+
+#if defined(ARCH_CPU_64_BITS)
+
+ALWAYS_INLINE size_t CountLeadingZeroBitsSizeT(size_t x) {
+ return CountLeadingZeroBits64(x);
+}
+
+#else
+
+ALWAYS_INLINE size_t CountLeadingZeroBitsSizeT(size_t x) {
+ return CountLeadingZeroBits32(x);
+}
+
+#endif
+
+} // namespace bits
+} // namespace base
+} // namespace pdfium
+
+#endif // BASE_BITS_H_
diff --git a/chromium/third_party/pdfium/third_party/base/compiler_specific.h b/chromium/third_party/pdfium/third_party/base/compiler_specific.h
new file mode 100644
index 00000000000..832b95bf5f1
--- /dev/null
+++ b/chromium/third_party/pdfium/third_party/base/compiler_specific.h
@@ -0,0 +1,233 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef BASE_COMPILER_SPECIFIC_H_
+#define BASE_COMPILER_SPECIFIC_H_
+
+#include "build/build_config.h"
+
+#if defined(COMPILER_MSVC)
+
+// For _Printf_format_string_.
+#include <sal.h>
+
+// Macros for suppressing and disabling warnings on MSVC.
+//
+// Warning numbers are enumerated at:
+// http://msdn.microsoft.com/en-us/library/8x5x43k7(VS.80).aspx
+//
+// The warning pragma:
+// http://msdn.microsoft.com/en-us/library/2c8f766e(VS.80).aspx
+//
+// Using __pragma instead of #pragma inside macros:
+// http://msdn.microsoft.com/en-us/library/d9x1s805.aspx
+
+// MSVC_SUPPRESS_WARNING disables warning |n| for the remainder of the line and
+// for the next line of the source file.
+#define MSVC_SUPPRESS_WARNING(n) __pragma(warning(suppress : n))
+
+// MSVC_PUSH_DISABLE_WARNING pushes |n| onto a stack of warnings to be disabled.
+// The warning remains disabled until popped by MSVC_POP_WARNING.
+#define MSVC_PUSH_DISABLE_WARNING(n) \
+ __pragma(warning(push)) __pragma(warning(disable : n))
+
+// MSVC_PUSH_WARNING_LEVEL pushes |n| as the global warning level. The level
+// remains in effect until popped by MSVC_POP_WARNING(). Use 0 to disable all
+// warnings.
+#define MSVC_PUSH_WARNING_LEVEL(n) __pragma(warning(push, n))
+
+// Pop effects of innermost MSVC_PUSH_* macro.
+#define MSVC_POP_WARNING() __pragma(warning(pop))
+
+#define MSVC_DISABLE_OPTIMIZE() __pragma(optimize("", off))
+#define MSVC_ENABLE_OPTIMIZE() __pragma(optimize("", on))
+
+// Allows exporting a class that inherits from a non-exported base class.
+// This uses suppress instead of push/pop because the delimiter after the
+// declaration (either "," or "{") has to be placed before the pop macro.
+//
+// Example usage:
+// class EXPORT_API Foo : NON_EXPORTED_BASE(public Bar) {
+//
+// MSVC Compiler warning C4275:
+// non dll-interface class 'Bar' used as base for dll-interface class 'Foo'.
+// Note that this is intended to be used only when no access to the base class'
+// static data is done through derived classes or inline methods. For more info,
+// see http://msdn.microsoft.com/en-us/library/3tdb471s(VS.80).aspx
+#define NON_EXPORTED_BASE(code) \
+ MSVC_SUPPRESS_WARNING(4275) \
+ code
+
+#else // Not MSVC
+
+#define _Printf_format_string_
+#define MSVC_SUPPRESS_WARNING(n)
+#define MSVC_PUSH_DISABLE_WARNING(n)
+#define MSVC_PUSH_WARNING_LEVEL(n)
+#define MSVC_POP_WARNING()
+#define MSVC_DISABLE_OPTIMIZE()
+#define MSVC_ENABLE_OPTIMIZE()
+#define NON_EXPORTED_BASE(code) code
+
+#endif // COMPILER_MSVC
+
+// Annotate a variable indicating it's ok if the variable is not used.
+// (Typically used to silence a compiler warning when the assignment
+// is important for some other reason.)
+// Use like:
+// int x = ...;
+// ALLOW_UNUSED_LOCAL(x);
+#define ALLOW_UNUSED_LOCAL(x) false ? (void)x : (void)0
+
+// Annotate a typedef or function indicating it's ok if it's not used.
+// Use like:
+// typedef Foo Bar ALLOW_UNUSED_TYPE;
+#if defined(COMPILER_GCC) || defined(__clang__)
+#define ALLOW_UNUSED_TYPE __attribute__((unused))
+#else
+#define ALLOW_UNUSED_TYPE
+#endif
+
+// Annotate a function indicating it should not be inlined.
+// Use like:
+// NOINLINE void DoStuff() { ... }
+#if defined(COMPILER_GCC)
+#define NOINLINE __attribute__((noinline))
+#elif defined(COMPILER_MSVC)
+#define NOINLINE __declspec(noinline)
+#else
+#define NOINLINE
+#endif
+
+#if COMPILER_GCC && defined(NDEBUG)
+#define ALWAYS_INLINE inline __attribute__((__always_inline__))
+#elif COMPILER_MSVC && defined(NDEBUG)
+#define ALWAYS_INLINE __forceinline
+#else
+#define ALWAYS_INLINE inline
+#endif
+
+// Specify memory alignment for structs, classes, etc.
+// Use like:
+// class ALIGNAS(16) MyClass { ... }
+// ALIGNAS(16) int array[4];
+#if defined(COMPILER_MSVC)
+#define ALIGNAS(byte_alignment) __declspec(align(byte_alignment))
+#elif defined(COMPILER_GCC)
+#define ALIGNAS(byte_alignment) __attribute__((aligned(byte_alignment)))
+#endif
+
+// Return the byte alignment of the given type (available at compile time).
+// Use like:
+// ALIGNOF(int32_t) // this would be 4
+#if defined(COMPILER_MSVC)
+#define ALIGNOF(type) __alignof(type)
+#elif defined(COMPILER_GCC)
+#define ALIGNOF(type) __alignof__(type)
+#endif
+
+// Annotate a function indicating the caller must examine the return value.
+// Use like:
+// int foo() WARN_UNUSED_RESULT;
+// To explicitly ignore a result, see |ignore_result()| in base/macros.h.
+#undef WARN_UNUSED_RESULT
+#if defined(COMPILER_GCC) || defined(__clang__)
+#define WARN_UNUSED_RESULT __attribute__((warn_unused_result))
+#else
+#define WARN_UNUSED_RESULT
+#endif
+
+// Tell the compiler a function is using a printf-style format string.
+// |format_param| is the one-based index of the format string parameter;
+// |dots_param| is the one-based index of the "..." parameter.
+// For v*printf functions (which take a va_list), pass 0 for dots_param.
+// (This is undocumented but matches what the system C headers do.)
+#if defined(COMPILER_GCC)
+#define PRINTF_FORMAT(format_param, dots_param) \
+ __attribute__((format(printf, format_param, dots_param)))
+#else
+#define PRINTF_FORMAT(format_param, dots_param)
+#endif
+
+// WPRINTF_FORMAT is the same, but for wide format strings.
+// This doesn't appear to yet be implemented in any compiler.
+// See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38308 .
+#define WPRINTF_FORMAT(format_param, dots_param)
+// If available, it would look like:
+// __attribute__((format(wprintf, format_param, dots_param)))
+
+// Sanitizers annotations.
+#if defined(__has_attribute)
+#if __has_attribute(no_sanitize)
+#define NO_SANITIZE(what) __attribute__((no_sanitize(what)))
+#endif
+#endif
+#if !defined(NO_SANITIZE)
+#define NO_SANITIZE(what)
+#endif
+
+// MemorySanitizer annotations.
+#if defined(MEMORY_SANITIZER) && !defined(OS_NACL)
+#include <sanitizer/msan_interface.h>
+
+// Mark a memory region fully initialized.
+// Use this to annotate code that deliberately reads uninitialized data, for
+// example a GC scavenging root set pointers from the stack.
+#define MSAN_UNPOISON(p, size) __msan_unpoison(p, size)
+
+// Check a memory region for initializedness, as if it was being used here.
+// If any bits are uninitialized, crash with an MSan report.
+// Use this to sanitize data which MSan won't be able to track, e.g. before
+// passing data to another process via shared memory.
+#define MSAN_CHECK_MEM_IS_INITIALIZED(p, size) \
+ __msan_check_mem_is_initialized(p, size)
+#else // MEMORY_SANITIZER
+#define MSAN_UNPOISON(p, size)
+#define MSAN_CHECK_MEM_IS_INITIALIZED(p, size)
+#endif // MEMORY_SANITIZER
+
+// DISABLE_CFI_PERF -- Disable Control Flow Integrity for perf reasons.
+#if !defined(DISABLE_CFI_PERF)
+#if defined(__clang__) && defined(OFFICIAL_BUILD)
+#define DISABLE_CFI_PERF __attribute__((no_sanitize("cfi")))
+#else
+#define DISABLE_CFI_PERF
+#endif
+#endif
+
+// Macro useful for writing cross-platform function pointers.
+#if !defined(CDECL)
+#if defined(OS_WIN)
+#define CDECL __cdecl
+#else // defined(OS_WIN)
+#define CDECL
+#endif // defined(OS_WIN)
+#endif // !defined(CDECL)
+
+// Macro for hinting that an expression is likely to be false.
+#if !defined(UNLIKELY)
+#if defined(COMPILER_GCC)
+#define UNLIKELY(x) __builtin_expect(!!(x), 0)
+#else
+#define UNLIKELY(x) (x)
+#endif // defined(COMPILER_GCC)
+#endif // !defined(UNLIKELY)
+
+#if !defined(LIKELY)
+#if defined(COMPILER_GCC)
+#define LIKELY(x) __builtin_expect(!!(x), 1)
+#else
+#define LIKELY(x) (x)
+#endif // defined(COMPILER_GCC)
+#endif // !defined(LIKELY)
+
+// Compiler feature-detection.
+// clang.llvm.org/docs/LanguageExtensions.html#has-feature-and-has-extension
+#if defined(__has_feature)
+#define HAS_FEATURE(FEATURE) __has_feature(FEATURE)
+#else
+#define HAS_FEATURE(FEATURE) 0
+#endif
+
+#endif // BASE_COMPILER_SPECIFIC_H_
diff --git a/chromium/third_party/pdfium/third_party/base/logging.h b/chromium/third_party/pdfium/third_party/base/logging.h
index bf4faea57e0..38b0dd9a17b 100644
--- a/chromium/third_party/pdfium/third_party/base/logging.h
+++ b/chromium/third_party/pdfium/third_party/base/logging.h
@@ -21,6 +21,19 @@
NULL_DEREF_IF_POSSIBLE \
}
+// TODO(palmer): These are quick hacks to import PartitionAlloc with minimum
+// hassle. Look into pulling in the real DCHECK definition. It might be more
+// than we need, or have more dependencies than we want. In the meantime, this
+// is safe, at the cost of some performance.
+#define DCHECK CHECK
+#define DCHECK_EQ(x, y) CHECK((x) == (y))
+#define DCHECK_IS_ON() true
+
+// TODO(palmer): Also a quick hack. IMMEDIATE_CRASH used to be simple in
+// Chromium base/, but it got way more complicated and has lots of base/
+// dependencies now. Sad!
+#define IMMEDIATE_CRASH() abort();
+
#define NOTREACHED() assert(false)
#endif // PDFIUM_THIRD_PARTY_BASE_LOGGING_H_
diff --git a/chromium/third_party/pdfium/third_party/base/macros.h b/chromium/third_party/pdfium/third_party/base/macros.h
index 05c3132e469..b6ec1612041 100644
--- a/chromium/third_party/pdfium/third_party/base/macros.h
+++ b/chromium/third_party/pdfium/third_party/base/macros.h
@@ -28,4 +28,10 @@
#undef COMPILE_ASSERT
#define COMPILE_ASSERT(expr, msg) static_assert(expr, #msg)
+// A macro to disallow the copy constructor and operator= functions.
+// This should be used in the private: declarations for a class.
+#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
+ TypeName(const TypeName&) = delete; \
+ void operator=(const TypeName&) = delete
+
#endif // PDFIUM_THIRD_PARTY_BASE_MACROS_H_
diff --git a/chromium/third_party/pdfium/third_party/base/stl_util.h b/chromium/third_party/pdfium/third_party/base/stl_util.h
index 795414b59f0..9c71530c126 100644
--- a/chromium/third_party/pdfium/third_party/base/stl_util.h
+++ b/chromium/third_party/pdfium/third_party/base/stl_util.h
@@ -10,6 +10,7 @@
#include <set>
#include "third_party/base/numerics/safe_conversions.h"
+#include "third_party/base/stl_util.h"
namespace pdfium {
@@ -44,6 +45,13 @@ ResultType CollectionSize(const Collection& collection) {
return pdfium::base::checked_cast<ResultType>(collection.size());
}
+// Convenience routine for "int-fected" code, to handle signed indicies. The
+// compiler can deduce the type, making this more convenient than the above.
+template <typename IndexType, typename Collection>
+bool IndexInBounds(const Collection& collection, IndexType index) {
+ return index >= 0 && index < CollectionSize<IndexType>(collection);
+}
+
// Track the addition of an object to a set, removing it automatically when
// the ScopedSetInsertion goes out of scope.
template <typename T>
@@ -60,6 +68,12 @@ class ScopedSetInsertion {
const T m_Entry;
};
+// std::clamp(), some day.
+template <class T>
+constexpr const T& clamp(const T& v, const T& lo, const T& hi) {
+ return std::min(std::max(v, lo), hi);
+}
+
} // namespace pdfium
#endif // PDFIUM_THIRD_PARTY_BASE_STL_UTIL_H_
diff --git a/chromium/third_party/pdfium/third_party/base/sys_byteorder.h b/chromium/third_party/pdfium/third_party/base/sys_byteorder.h
new file mode 100644
index 00000000000..593abe17d43
--- /dev/null
+++ b/chromium/third_party/pdfium/third_party/base/sys_byteorder.h
@@ -0,0 +1,141 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// This header defines cross-platform ByteSwap() implementations for 16, 32 and
+// 64-bit values, and NetToHostXX() / HostToNextXX() functions equivalent to
+// the traditional ntohX() and htonX() functions.
+// Use the functions defined here rather than using the platform-specific
+// functions directly.
+
+#ifndef BASE_SYS_BYTEORDER_H_
+#define BASE_SYS_BYTEORDER_H_
+
+#include <stdint.h>
+
+#include "third_party/base/logging.h"
+#include "third_party/build/build_config.h"
+
+#if defined(COMPILER_MSVC)
+#include <stdlib.h>
+#endif
+
+namespace pdfium {
+namespace base {
+
+// Returns a value with all bytes in |x| swapped, i.e. reverses the endianness.
+inline uint16_t ByteSwap(uint16_t x) {
+#if defined(COMPILER_MSVC)
+ return _byteswap_ushort(x);
+#else
+ return __builtin_bswap16(x);
+#endif
+}
+
+inline uint32_t ByteSwap(uint32_t x) {
+#if defined(COMPILER_MSVC)
+ return _byteswap_ulong(x);
+#else
+ return __builtin_bswap32(x);
+#endif
+}
+
+inline uint64_t ByteSwap(uint64_t x) {
+#if defined(COMPILER_MSVC)
+ return _byteswap_uint64(x);
+#else
+ return __builtin_bswap64(x);
+#endif
+}
+
+inline uintptr_t ByteSwapUintPtrT(uintptr_t x) {
+ // We do it this way because some build configurations are ILP32 even when
+ // defined(ARCH_CPU_64_BITS). Unfortunately, we can't use sizeof in #ifs. But,
+ // because these conditionals are constexprs, the irrelevant branches will
+ // likely be optimized away, so this construction should not result in code
+ // bloat.
+ if (sizeof(uintptr_t) == 4) {
+ return ByteSwap(static_cast<uint32_t>(x));
+ } else if (sizeof(uintptr_t) == 8) {
+ return ByteSwap(static_cast<uint64_t>(x));
+ } else {
+ NOTREACHED();
+ }
+}
+
+// Converts the bytes in |x| from host order (endianness) to little endian, and
+// returns the result.
+inline uint16_t ByteSwapToLE16(uint16_t x) {
+#if defined(ARCH_CPU_LITTLE_ENDIAN)
+ return x;
+#else
+ return ByteSwap(x);
+#endif
+}
+inline uint32_t ByteSwapToLE32(uint32_t x) {
+#if defined(ARCH_CPU_LITTLE_ENDIAN)
+ return x;
+#else
+ return ByteSwap(x);
+#endif
+}
+inline uint64_t ByteSwapToLE64(uint64_t x) {
+#if defined(ARCH_CPU_LITTLE_ENDIAN)
+ return x;
+#else
+ return ByteSwap(x);
+#endif
+}
+
+// Converts the bytes in |x| from network to host order (endianness), and
+// returns the result.
+inline uint16_t NetToHost16(uint16_t x) {
+#if defined(ARCH_CPU_LITTLE_ENDIAN)
+ return ByteSwap(x);
+#else
+ return x;
+#endif
+}
+inline uint32_t NetToHost32(uint32_t x) {
+#if defined(ARCH_CPU_LITTLE_ENDIAN)
+ return ByteSwap(x);
+#else
+ return x;
+#endif
+}
+inline uint64_t NetToHost64(uint64_t x) {
+#if defined(ARCH_CPU_LITTLE_ENDIAN)
+ return ByteSwap(x);
+#else
+ return x;
+#endif
+}
+
+// Converts the bytes in |x| from host to network order (endianness), and
+// returns the result.
+inline uint16_t HostToNet16(uint16_t x) {
+#if defined(ARCH_CPU_LITTLE_ENDIAN)
+ return ByteSwap(x);
+#else
+ return x;
+#endif
+}
+inline uint32_t HostToNet32(uint32_t x) {
+#if defined(ARCH_CPU_LITTLE_ENDIAN)
+ return ByteSwap(x);
+#else
+ return x;
+#endif
+}
+inline uint64_t HostToNet64(uint64_t x) {
+#if defined(ARCH_CPU_LITTLE_ENDIAN)
+ return ByteSwap(x);
+#else
+ return x;
+#endif
+}
+
+} // namespace base
+} // namespace pdfium
+
+#endif // BASE_SYS_BYTEORDER_H_
diff --git a/chromium/third_party/pdfium/third_party/base/template_util.h b/chromium/third_party/pdfium/third_party/base/template_util.h
new file mode 100644
index 00000000000..b2463225f8e
--- /dev/null
+++ b/chromium/third_party/pdfium/third_party/base/template_util.h
@@ -0,0 +1,203 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef BASE_TEMPLATE_UTIL_H_
+#define BASE_TEMPLATE_UTIL_H_
+
+#include <stddef.h>
+#include <iosfwd>
+#include <type_traits>
+#include <utility>
+
+#include "third_party/build/build_config.h"
+
+// This hacks around libstdc++ 4.6 missing stuff in type_traits, while we need
+// to support it.
+#define CR_GLIBCXX_4_7_0 20120322
+#define CR_GLIBCXX_4_5_4 20120702
+#define CR_GLIBCXX_4_6_4 20121127
+#if defined(__GLIBCXX__) && \
+ (__GLIBCXX__ < CR_GLIBCXX_4_7_0 || __GLIBCXX__ == CR_GLIBCXX_4_5_4 || \
+ __GLIBCXX__ == CR_GLIBCXX_4_6_4)
+#define CR_USE_FALLBACKS_FOR_OLD_GLIBCXX
+#endif
+
+// Some versions of libstdc++ have partial support for type_traits, but misses
+// a smaller subset while removing some of the older non-standard stuff. Assume
+// that all versions below 5.0 fall in this category, along with one 5.0
+// experimental release. Test for this by consulting compiler major version,
+// the only reliable option available, so theoretically this could fail should
+// you attempt to mix an earlier version of libstdc++ with >= GCC5. But
+// that's unlikely to work out, especially as GCC5 changed ABI.
+#define CR_GLIBCXX_5_0_0 20150123
+#if (defined(__GNUC__) && __GNUC__ < 5) || \
+ (defined(__GLIBCXX__) && __GLIBCXX__ == CR_GLIBCXX_5_0_0)
+#define CR_USE_FALLBACKS_FOR_OLD_EXPERIMENTAL_GLIBCXX
+#endif
+
+// This hacks around using gcc with libc++ which has some incompatibilies.
+// - is_trivially_* doesn't work: https://llvm.org/bugs/show_bug.cgi?id=27538
+// TODO(danakj): Remove this when android builders are all using a newer version
+// of gcc, or the android ndk is updated to a newer libc++ that works with older
+// gcc versions.
+#if !defined(__clang__) && defined(_LIBCPP_VERSION)
+#define CR_USE_FALLBACKS_FOR_GCC_WITH_LIBCXX
+#endif
+
+namespace base {
+
+template <class T>
+struct is_non_const_reference : std::false_type {};
+template <class T>
+struct is_non_const_reference<T&> : std::true_type {};
+template <class T>
+struct is_non_const_reference<const T&> : std::false_type {};
+
+// is_assignable
+
+namespace internal {
+
+template <typename First, typename Second>
+struct SelectSecond {
+ using type = Second;
+};
+
+struct Any {
+ Any(...);
+};
+
+// True case: If |Lvalue| can be assigned to from |Rvalue|, then the return
+// value is a true_type.
+template <class Lvalue, class Rvalue>
+typename internal::SelectSecond<
+ decltype((std::declval<Lvalue>() = std::declval<Rvalue>())),
+ std::true_type>::type
+IsAssignableTest(Lvalue&&, Rvalue&&);
+
+// False case: Otherwise the return value is a false_type.
+template <class Rvalue>
+std::false_type IsAssignableTest(internal::Any, Rvalue&&);
+
+// Default case: Neither Lvalue nor Rvalue is void. Uses IsAssignableTest to
+// determine the type of IsAssignableImpl.
+template <class Lvalue,
+ class Rvalue,
+ bool = std::is_void<Lvalue>::value || std::is_void<Rvalue>::value>
+struct IsAssignableImpl
+ : public std::common_type<decltype(
+ internal::IsAssignableTest(std::declval<Lvalue>(),
+ std::declval<Rvalue>()))>::type {};
+
+// Void case: Either Lvalue or Rvalue is void. Then the type of IsAssignableTest
+// is false_type.
+template <class Lvalue, class Rvalue>
+struct IsAssignableImpl<Lvalue, Rvalue, true> : public std::false_type {};
+
+// Uses expression SFINAE to detect whether using operator<< would work.
+template <typename T, typename = void>
+struct SupportsOstreamOperator : std::false_type {};
+template <typename T>
+struct SupportsOstreamOperator<T,
+ decltype(void(std::declval<std::ostream&>()
+ << std::declval<T>()))>
+ : std::true_type {};
+
+} // namespace internal
+
+// TODO(crbug.com/554293): Remove this when all platforms have this in the std
+// namespace.
+template <class Lvalue, class Rvalue>
+struct is_assignable : public internal::IsAssignableImpl<Lvalue, Rvalue> {};
+
+// is_copy_assignable is true if a T const& is assignable to a T&.
+// TODO(crbug.com/554293): Remove this when all platforms have this in the std
+// namespace.
+template <class T>
+struct is_copy_assignable
+ : public is_assignable<typename std::add_lvalue_reference<T>::type,
+ typename std::add_lvalue_reference<
+ typename std::add_const<T>::type>::type> {};
+
+// is_move_assignable is true if a T&& is assignable to a T&.
+// TODO(crbug.com/554293): Remove this when all platforms have this in the std
+// namespace.
+template <class T>
+struct is_move_assignable
+ : public is_assignable<typename std::add_lvalue_reference<T>::type,
+ const typename std::add_rvalue_reference<T>::type> {
+};
+
+// underlying_type produces the integer type backing an enum type.
+// TODO(crbug.com/554293): Remove this when all platforms have this in the std
+// namespace.
+#if defined(CR_USE_FALLBACKS_FOR_OLD_GLIBCXX)
+template <typename T>
+struct underlying_type {
+ using type = __underlying_type(T);
+};
+#else
+template <typename T>
+using underlying_type = std::underlying_type<T>;
+#endif
+
+// TODO(crbug.com/554293): Remove this when all platforms have this in the std
+// namespace.
+#if defined(CR_USE_FALLBACKS_FOR_OLD_GLIBCXX)
+template <class T>
+using is_trivially_destructible = std::has_trivial_destructor<T>;
+#else
+template <class T>
+using is_trivially_destructible = std::is_trivially_destructible<T>;
+#endif
+
+// is_trivially_copyable is especially hard to get right.
+// - Older versions of libstdc++ will fail to have it like they do for other
+// type traits. In this case we should provide it based on compiler
+// intrinsics. This is covered by the CR_USE_FALLBACKS_FOR_OLD_GLIBCXX define.
+// - An experimental release of gcc includes most of type_traits but misses
+// is_trivially_copyable, so we still have to avoid using libstdc++ in this
+// case, which is covered by CR_USE_FALLBACKS_FOR_OLD_EXPERIMENTAL_GLIBCXX.
+// - When compiling libc++ from before r239653, with a gcc compiler, the
+// std::is_trivially_copyable can fail. So we need to work around that by not
+// using the one in libc++ in this case. This is covered by the
+// CR_USE_FALLBACKS_FOR_GCC_WITH_LIBCXX define, and is discussed in
+// https://llvm.org/bugs/show_bug.cgi?id=27538#c1 where they point out that
+// in libc++'s commit r239653 this is fixed by libc++ checking for gcc 5.1.
+// - In both of the above cases we are using the gcc compiler. When defining
+// this ourselves on compiler intrinsics, the __is_trivially_copyable()
+// intrinsic is not available on gcc before version 5.1 (see the discussion in
+// https://llvm.org/bugs/show_bug.cgi?id=27538#c1 again), so we must check for
+// that version.
+// - When __is_trivially_copyable() is not available because we are on gcc older
+// than 5.1, we need to fall back to something, so we use __has_trivial_copy()
+// instead based on what was done one-off in bit_cast() previously.
+
+// TODO(crbug.com/554293): Remove this when all platforms have this in the std
+// namespace and it works with gcc as needed.
+#if defined(CR_USE_FALLBACKS_FOR_OLD_GLIBCXX) || \
+ defined(CR_USE_FALLBACKS_FOR_OLD_EXPERIMENTAL_GLIBCXX) || \
+ defined(CR_USE_FALLBACKS_FOR_GCC_WITH_LIBCXX)
+template <typename T>
+struct is_trivially_copyable {
+// TODO(danakj): Remove this when android builders are all using a newer version
+// of gcc, or the android ndk is updated to a newer libc++ that does this for
+// us.
+#if _GNUC_VER >= 501
+ static constexpr bool value = __is_trivially_copyable(T);
+#else
+ static constexpr bool value = __has_trivial_copy(T);
+#endif
+};
+#else
+template <class T>
+using is_trivially_copyable = std::is_trivially_copyable<T>;
+#endif
+
+} // namespace base
+
+#undef CR_USE_FALLBACKS_FOR_OLD_GLIBCXX
+#undef CR_USE_FALLBACKS_FOR_GCC_WITH_LIBCXX
+#undef CR_USE_FALLBACKS_FOR_OLD_EXPERIMENTAL_GLIBCXX
+
+#endif // BASE_TEMPLATE_UTIL_H_
diff --git a/chromium/third_party/pdfium/third_party/build/build_config.h b/chromium/third_party/pdfium/third_party/build/build_config.h
new file mode 100644
index 00000000000..d4c66e046d5
--- /dev/null
+++ b/chromium/third_party/pdfium/third_party/build/build_config.h
@@ -0,0 +1,194 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// This file adds defines about the platform we're currently building on.
+// Operating System:
+// OS_WIN / OS_MACOSX / OS_LINUX / OS_POSIX (MACOSX or LINUX) /
+// OS_NACL (NACL_SFI or NACL_NONSFI) / OS_NACL_SFI / OS_NACL_NONSFI
+// OS_CHROMEOS is set by the build system
+// Compiler:
+// COMPILER_MSVC / COMPILER_GCC
+// Processor:
+// ARCH_CPU_X86 / ARCH_CPU_X86_64 / ARCH_CPU_X86_FAMILY (X86 or X86_64)
+// ARCH_CPU_32_BITS / ARCH_CPU_64_BITS
+
+#ifndef BUILD_BUILD_CONFIG_H_
+#define BUILD_BUILD_CONFIG_H_
+
+// A set of macros to use for platform detection.
+#if defined(__native_client__)
+// __native_client__ must be first, so that other OS_ defines are not set.
+#define OS_NACL 1
+// OS_NACL comes in two sandboxing technology flavors, SFI or Non-SFI.
+// PNaCl toolchain defines __native_client_nonsfi__ macro in Non-SFI build
+// mode, while it does not in SFI build mode.
+#if defined(__native_client_nonsfi__)
+#define OS_NACL_NONSFI
+#else
+#define OS_NACL_SFI
+#endif
+#elif defined(ANDROID)
+#define OS_ANDROID 1
+#elif defined(__APPLE__)
+// only include TargetConditions after testing ANDROID as some android builds
+// on mac don't have this header available and it's not needed unless the target
+// is really mac/ios.
+#include <TargetConditionals.h>
+#define OS_MACOSX 1
+#if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
+#define OS_IOS 1
+#endif // defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
+#elif defined(__linux__)
+#define OS_LINUX 1
+// include a system header to pull in features.h for glibc/uclibc macros.
+#include <unistd.h>
+#if defined(__GLIBC__) && !defined(__UCLIBC__)
+// we really are using glibc, not uClibc pretending to be glibc
+#define LIBC_GLIBC 1
+#endif
+#elif defined(_WIN32)
+#define OS_WIN 1
+#elif defined(__FreeBSD__)
+#define OS_FREEBSD 1
+#elif defined(__NetBSD__)
+#define OS_NETBSD 1
+#elif defined(__OpenBSD__)
+#define OS_OPENBSD 1
+#elif defined(__sun)
+#define OS_SOLARIS 1
+#elif defined(__QNXNTO__)
+#define OS_QNX 1
+#else
+#error Please add support for your platform in build/build_config.h
+#endif
+
+#if defined(USE_OPENSSL_CERTS) && defined(USE_NSS_CERTS)
+#error Cannot use both OpenSSL and NSS for certificates
+#endif
+
+// For access to standard BSD features, use OS_BSD instead of a
+// more specific macro.
+#if defined(OS_FREEBSD) || defined(OS_NETBSD) || defined(OS_OPENBSD)
+#define OS_BSD 1
+#endif
+
+// For access to standard POSIXish features, use OS_POSIX instead of a
+// more specific macro.
+#if defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_FREEBSD) || \
+ defined(OS_NETBSD) || defined(OS_OPENBSD) || defined(OS_SOLARIS) || \
+ defined(OS_ANDROID) || defined(OS_OPENBSD) || defined(OS_SOLARIS) || \
+ defined(OS_ANDROID) || defined(OS_NACL) || defined(OS_QNX)
+#define OS_POSIX 1
+#endif
+
+// Use tcmalloc
+#if (defined(OS_WIN) || defined(OS_LINUX) || defined(OS_ANDROID)) && \
+ !defined(NO_TCMALLOC)
+#define USE_TCMALLOC 1
+#endif
+
+// Compiler detection.
+#if defined(__GNUC__)
+#define COMPILER_GCC 1
+#elif defined(_MSC_VER)
+#define COMPILER_MSVC 1
+#else
+#error Please add support for your compiler in build/build_config.h
+#endif
+
+// Processor architecture detection. For more info on what's defined, see:
+// http://msdn.microsoft.com/en-us/library/b0084kay.aspx
+// http://www.agner.org/optimize/calling_conventions.pdf
+// or with gcc, run: "echo | gcc -E -dM -"
+#if defined(_M_X64) || defined(__x86_64__)
+#define ARCH_CPU_X86_FAMILY 1
+#define ARCH_CPU_X86_64 1
+#define ARCH_CPU_64_BITS 1
+#define ARCH_CPU_LITTLE_ENDIAN 1
+#elif defined(_M_IX86) || defined(__i386__)
+#define ARCH_CPU_X86_FAMILY 1
+#define ARCH_CPU_X86 1
+#define ARCH_CPU_32_BITS 1
+#define ARCH_CPU_LITTLE_ENDIAN 1
+#elif defined(__s390x__)
+#define ARCH_CPU_S390_FAMILY 1
+#define ARCH_CPU_S390X 1
+#define ARCH_CPU_64_BITS 1
+#define ARCH_CPU_BIG_ENDIAN 1
+#elif defined(__s390__)
+#define ARCH_CPU_S390_FAMILY 1
+#define ARCH_CPU_S390 1
+#define ARCH_CPU_31_BITS 1
+#define ARCH_CPU_BIG_ENDIAN 1
+#elif defined(__PPC64__) && defined(__BIG_ENDIAN__)
+#define ARCH_CPU_PPC64_FAMILY 1
+#define ARCH_CPU_PPC64 1
+#define ARCH_CPU_64_BITS 1
+#define ARCH_CPU_BIG_ENDIAN 1
+#elif defined(__PPC64__) && defined(__LITTLE_ENDIAN__)
+#define ARCH_CPU_PPC64_FAMILY 1
+#define ARCH_CPU_PPC64 1
+#define ARCH_CPU_64_BITS 1
+#define ARCH_CPU_LITTLE_ENDIAN 1
+#elif defined(__PPC__)
+#define ARCH_CPU_PPC_FAMILY 1
+#define ARCH_CPU_PPC 1
+#define ARCH_CPU_32_BITS 1
+#define ARCH_CPU_BIG_ENDIAN 1
+#elif defined(__ARMEL__)
+#define ARCH_CPU_ARM_FAMILY 1
+#define ARCH_CPU_ARMEL 1
+#define ARCH_CPU_32_BITS 1
+#define ARCH_CPU_LITTLE_ENDIAN 1
+#elif defined(__aarch64__)
+#define ARCH_CPU_ARM_FAMILY 1
+#define ARCH_CPU_ARM64 1
+#define ARCH_CPU_64_BITS 1
+#define ARCH_CPU_LITTLE_ENDIAN 1
+#elif defined(__pnacl__)
+#define ARCH_CPU_32_BITS 1
+#define ARCH_CPU_LITTLE_ENDIAN 1
+#elif defined(__MIPSEL__)
+#if defined(__LP64__)
+#define ARCH_CPU_MIPS_FAMILY 1
+#define ARCH_CPU_MIPS64EL 1
+#define ARCH_CPU_64_BITS 1
+#define ARCH_CPU_LITTLE_ENDIAN 1
+#else
+#define ARCH_CPU_MIPS_FAMILY 1
+#define ARCH_CPU_MIPSEL 1
+#define ARCH_CPU_32_BITS 1
+#define ARCH_CPU_LITTLE_ENDIAN 1
+#endif
+#else
+#error Please add support for your architecture in build/build_config.h
+#endif
+
+// Type detection for wchar_t.
+#if defined(OS_WIN)
+#define WCHAR_T_IS_UTF16
+#elif defined(OS_POSIX) && defined(COMPILER_GCC) && defined(__WCHAR_MAX__) && \
+ (__WCHAR_MAX__ == 0x7fffffff || __WCHAR_MAX__ == 0xffffffff)
+#define WCHAR_T_IS_UTF32
+#elif defined(OS_POSIX) && defined(COMPILER_GCC) && defined(__WCHAR_MAX__) && \
+ (__WCHAR_MAX__ == 0x7fff || __WCHAR_MAX__ == 0xffff)
+// On Posix, we'll detect short wchar_t, but projects aren't guaranteed to
+// compile in this mode (in particular, Chrome doesn't). This is intended for
+// other projects using base who manage their own dependencies and make sure
+// short wchar works for them.
+#define WCHAR_T_IS_UTF16
+#else
+#error Please add support for your compiler in build/build_config.h
+#endif
+
+#if defined(OS_ANDROID)
+// The compiler thinks std::string::const_iterator and "const char*" are
+// equivalent types.
+#define STD_STRING_ITERATOR_IS_CHAR_POINTER
+// The compiler thinks base::string16::const_iterator and "char16*" are
+// equivalent types.
+#define BASE_STRING16_ITERATOR_IS_CHAR16_POINTER
+#endif
+
+#endif // BUILD_BUILD_CONFIG_H_
diff --git a/chromium/third_party/pdfium/third_party/freetype/0000-include.patch b/chromium/third_party/pdfium/third_party/freetype/0000-include.patch
index d7478e78112..d6c837471c5 100644
--- a/chromium/third_party/pdfium/third_party/freetype/0000-include.patch
+++ b/chromium/third_party/pdfium/third_party/freetype/0000-include.patch
@@ -1,28 +1,6 @@
-diff -ru freetype-2.6.1/include/freetype/config/ftmodule.h include/freetype/config/ftmodule.h
---- freetype-2.6.1/include/freetype/config/ftmodule.h 2015-11-05 13:52:36.734733186 -0800
-+++ include/freetype/config/ftmodule.h 2015-11-05 13:44:54.445479822 -0800
-@@ -1,3 +1,20 @@
-+/***************************************************************************/
-+/* */
-+/* ftmodule.h */
-+/* */
-+/* FreeType modules public interface (specification). */
-+/* */
-+/* Copyright 1996-2001, 2002, 2003 by */
-+/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-+/* */
-+/* This file is part of the FreeType project, and may only be used, */
-+/* modified, and distributed under the terms of the FreeType project */
-+/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-+/* this file you indicate that you have read the license and */
-+/* understand and accept it fully. */
-+/* */
-+/***************************************************************************/
-+
- /*
- * This file registers the FreeType modules compiled into the library.
- *
-@@ -10,15 +27,15 @@
+--- third_party/freetype/include/freetype/config/ftmodule.h 2017-03-07 20:15:52.781636524 -0800
++++ third_party/freetype/include/freetype/config/ftmodule.h 2017-03-22 22:57:58.536233071 -0700
+@@ -10,15 +10,15 @@
*
*/
@@ -43,7 +21,7 @@ diff -ru freetype-2.6.1/include/freetype/config/ftmodule.h include/freetype/conf
FT_USE_MODULE( FT_Module_Class, psaux_module_class )
FT_USE_MODULE( FT_Module_Class, psnames_module_class )
FT_USE_MODULE( FT_Module_Class, pshinter_module_class )
-@@ -27,6 +44,6 @@
+@@ -27,6 +27,6 @@
FT_USE_MODULE( FT_Renderer_Class, ft_smooth_renderer_class )
FT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcd_renderer_class )
FT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcdv_renderer_class )
@@ -51,10 +29,9 @@ diff -ru freetype-2.6.1/include/freetype/config/ftmodule.h include/freetype/conf
+//FT_USE_MODULE( FT_Driver_ClassRec, bdf_driver_class )
/* EOF */
-diff -ru freetype-2.6.1/include/freetype/config/ftoption.h include/freetype/config/ftoption.h
---- freetype-2.6.1/include/freetype/config/ftoption.h 2015-11-05 13:52:36.734733186 -0800
-+++ include/freetype/config/ftoption.h 2015-11-05 13:44:54.445479822 -0800
-@@ -92,7 +92,7 @@
+--- third_party/freetype/include/freetype/config/ftoption.h 2017-03-07 20:15:52.781636524 -0800
++++ third_party/freetype/include/freetype/config/ftoption.h 2017-03-22 22:57:58.532233095 -0700
+@@ -122,7 +122,7 @@
/* This is done to allow FreeType clients to run unmodified, forcing */
/* them to display normal gray-level anti-aliased glyphs. */
/* */
@@ -63,16 +40,16 @@ diff -ru freetype-2.6.1/include/freetype/config/ftoption.h include/freetype/conf
/*************************************************************************/
-@@ -163,7 +163,7 @@
+@@ -193,7 +193,7 @@
/* Define this macro if you want to enable this `feature'. See also */
/* the macro FT_CONFIG_OPTION_SYSTEM_ZLIB below. */
/* */
-#define FT_CONFIG_OPTION_USE_ZLIB
-+//#define FT_CONFIG_OPTION_USE_ZLIB
++#undef FT_CONFIG_OPTION_USE_ZLIB
/*************************************************************************/
-@@ -336,7 +336,7 @@
+@@ -366,7 +366,7 @@
/* */
/* Note that the `FOND' resource isn't checked. */
/* */
@@ -81,7 +58,7 @@ diff -ru freetype-2.6.1/include/freetype/config/ftoption.h include/freetype/conf
/*************************************************************************/
-@@ -512,7 +512,7 @@
+@@ -556,7 +556,7 @@
/* embedded bitmaps in all formats using the SFNT module (namely */
/* TrueType & OpenType). */
/* */
@@ -90,7 +67,7 @@ diff -ru freetype-2.6.1/include/freetype/config/ftoption.h include/freetype/conf
/*************************************************************************/
-@@ -681,7 +681,7 @@
+@@ -705,7 +705,7 @@
/* and avar tables). This has many similarities to Type 1 Multiple */
/* Masters support. */
/* */
@@ -99,7 +76,7 @@ diff -ru freetype-2.6.1/include/freetype/config/ftoption.h include/freetype/conf
/*************************************************************************/
-@@ -689,7 +689,7 @@
+@@ -713,7 +713,7 @@
/* Define TT_CONFIG_OPTION_BDF if you want to include support for */
/* an embedded `BDF ' table within SFNT-based bitmap formats. */
/* */
@@ -108,7 +85,7 @@ diff -ru freetype-2.6.1/include/freetype/config/ftoption.h include/freetype/conf
/*************************************************************************/
-@@ -725,7 +725,7 @@
+@@ -767,7 +767,7 @@
/* */
/* The Chinese font MingTiEG-Medium (CNS 11643 character set) needs 256. */
/* */
@@ -117,4 +94,3 @@ diff -ru freetype-2.6.1/include/freetype/config/ftoption.h include/freetype/conf
/*************************************************************************/
-Only in freetype-2.6.1/include/freetype: ftchapters.h
diff --git a/chromium/third_party/pdfium/third_party/freetype/README.pdfium b/chromium/third_party/pdfium/third_party/freetype/README.pdfium
index f8fad6f3b46..2054aab7f1d 100644
--- a/chromium/third_party/pdfium/third_party/freetype/README.pdfium
+++ b/chromium/third_party/pdfium/third_party/freetype/README.pdfium
@@ -1,6 +1,7 @@
Name: FreeType
URL: http://www.freetype.org/
-Version: 2.6.1
+Version: VER-2-7-1-updates
+Revision: 66725768cdf758cfb3f9abf03cbf5e5a77f42088
Security Critical: yes
License: FreeType License (FTL)
License File: FTL.TXT
@@ -11,24 +12,3 @@ FreeType library.
Local Modifications:
0000-include.patch: Modifications to configuration header files.
-
-include/freetype/ftchapers.h is not included.
-
-The following directories in src/ are not included from
-upstream FreeType as they are never used:
-
-autofit
-bdf
-bzip2
-cache
-gxvalid
-gzip
-Jamfile
-lzw
-otvalid
-pcf
-pfr
-tools
-type42
-winfonts
-
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype-custom-config/ftmodule.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype-custom-config/ftmodule.h
new file mode 100644
index 00000000000..0d31ce6932c
--- /dev/null
+++ b/chromium/third_party/pdfium/third_party/freetype/include/freetype-custom-config/ftmodule.h
@@ -0,0 +1,32 @@
+/*
+ * This file registers the FreeType modules compiled into the library.
+ *
+ * If you use GNU make, this file IS NOT USED! Instead, it is created in
+ * the objects directory (normally `<topdir>/objs/') based on information
+ * from `<topdir>/modules.cfg'.
+ *
+ * Please read `docs/INSTALL.ANY' and `docs/CUSTOMIZE' how to compile
+ * FreeType without GNU make.
+ *
+ */
+
+//FT_USE_MODULE( FT_Module_Class, autofit_module_class )
+FT_USE_MODULE( FT_Driver_ClassRec, tt_driver_class )
+FT_USE_MODULE( FT_Driver_ClassRec, t1_driver_class )
+FT_USE_MODULE( FT_Driver_ClassRec, cff_driver_class )
+FT_USE_MODULE( FT_Driver_ClassRec, t1cid_driver_class )
+//FT_USE_MODULE( FT_Driver_ClassRec, pfr_driver_class )
+//FT_USE_MODULE( FT_Driver_ClassRec, t42_driver_class )
+//FT_USE_MODULE( FT_Driver_ClassRec, winfnt_driver_class )
+//FT_USE_MODULE( FT_Driver_ClassRec, pcf_driver_class )
+FT_USE_MODULE( FT_Module_Class, psaux_module_class )
+FT_USE_MODULE( FT_Module_Class, psnames_module_class )
+FT_USE_MODULE( FT_Module_Class, pshinter_module_class )
+FT_USE_MODULE( FT_Renderer_Class, ft_raster1_renderer_class )
+FT_USE_MODULE( FT_Module_Class, sfnt_module_class )
+FT_USE_MODULE( FT_Renderer_Class, ft_smooth_renderer_class )
+FT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcd_renderer_class )
+FT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcdv_renderer_class )
+//FT_USE_MODULE( FT_Driver_ClassRec, bdf_driver_class )
+
+/* EOF */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype-custom-config/ftoption.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype-custom-config/ftoption.h
new file mode 100644
index 00000000000..802beb5036b
--- /dev/null
+++ b/chromium/third_party/pdfium/third_party/freetype/include/freetype-custom-config/ftoption.h
@@ -0,0 +1,960 @@
+/***************************************************************************/
+/* */
+/* ftoption.h */
+/* */
+/* User-selectable configuration macros (specification only). */
+/* */
+/* Copyright 1996-2017 by */
+/* David Turner, Robert Wilhelm, and Werner Lemberg. */
+/* */
+/* This file is part of the FreeType project, and may only be used, */
+/* modified, and distributed under the terms of the FreeType project */
+/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
+/* this file you indicate that you have read the license and */
+/* understand and accept it fully. */
+/* */
+/***************************************************************************/
+
+
+#ifndef FTOPTION_H_
+#define FTOPTION_H_
+
+
+#include <ft2build.h>
+
+
+FT_BEGIN_HEADER
+
+ /*************************************************************************/
+ /* */
+ /* USER-SELECTABLE CONFIGURATION MACROS */
+ /* */
+ /* This file contains the default configuration macro definitions for */
+ /* a standard build of the FreeType library. There are three ways to */
+ /* use this file to build project-specific versions of the library: */
+ /* */
+ /* - You can modify this file by hand, but this is not recommended in */
+ /* cases where you would like to build several versions of the */
+ /* library from a single source directory. */
+ /* */
+ /* - You can put a copy of this file in your build directory, more */
+ /* precisely in `$BUILD/freetype/config/ftoption.h', where `$BUILD' */
+ /* is the name of a directory that is included _before_ the FreeType */
+ /* include path during compilation. */
+ /* */
+ /* The default FreeType Makefiles and Jamfiles use the build */
+ /* directory `builds/<system>' by default, but you can easily change */
+ /* that for your own projects. */
+ /* */
+ /* - Copy the file <ft2build.h> to `$BUILD/ft2build.h' and modify it */
+ /* slightly to pre-define the macro FT_CONFIG_OPTIONS_H used to */
+ /* locate this file during the build. For example, */
+ /* */
+ /* #define FT_CONFIG_OPTIONS_H <myftoptions.h> */
+ /* #include <freetype/config/ftheader.h> */
+ /* */
+ /* will use `$BUILD/myftoptions.h' instead of this file for macro */
+ /* definitions. */
+ /* */
+ /* Note also that you can similarly pre-define the macro */
+ /* FT_CONFIG_MODULES_H used to locate the file listing of the modules */
+ /* that are statically linked to the library at compile time. By */
+ /* default, this file is <freetype/config/ftmodule.h>. */
+ /* */
+ /* We highly recommend using the third method whenever possible. */
+ /* */
+ /*************************************************************************/
+
+
+ /*************************************************************************/
+ /*************************************************************************/
+ /**** ****/
+ /**** G E N E R A L F R E E T Y P E 2 C O N F I G U R A T I O N ****/
+ /**** ****/
+ /*************************************************************************/
+ /*************************************************************************/
+
+
+ /*************************************************************************/
+ /* */
+ /* If you enable this configuration option, FreeType recognizes an */
+ /* environment variable called `FREETYPE_PROPERTIES', which can be used */
+ /* to control the various font drivers and modules. The controllable */
+ /* properties are listed in the section `Controlling FreeType Modules' */
+ /* in the reference's table of contents; currently there are properties */
+ /* for the auto-hinter (file `ftautoh.h'), CFF (file `ftcffdrv.h'), */
+ /* TrueType (file `ftttdrv.h'), and PCF (file `ftpcfdrv.h'). */
+ /* */
+ /* `FREETYPE_PROPERTIES' has the following syntax form (broken here into */
+ /* multiple lines for better readability). */
+ /* */
+ /* <optional whitespace> */
+ /* <module-name1> ':' */
+ /* <property-name1> '=' <property-value1> */
+ /* <whitespace> */
+ /* <module-name2> ':' */
+ /* <property-name2> '=' <property-value2> */
+ /* ... */
+ /* */
+ /* Example: */
+ /* */
+ /* FREETYPE_PROPERTIES=truetype:interpreter-version=35 \ */
+ /* cff:no-stem-darkening=1 \ */
+ /* autofitter:warping=1 */
+ /* */
+#define FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
+
+
+ /*************************************************************************/
+ /* */
+ /* Uncomment the line below if you want to activate sub-pixel rendering */
+ /* (a.k.a. LCD rendering, or ClearType) in this build of the library. */
+ /* */
+ /* Note that this feature is covered by several Microsoft patents */
+ /* and should not be activated in any default build of the library. */
+ /* */
+ /* This macro has no impact on the FreeType API, only on its */
+ /* _implementation_. For example, using FT_RENDER_MODE_LCD when calling */
+ /* FT_Render_Glyph still generates a bitmap that is 3 times wider than */
+ /* the original size in case this macro isn't defined; however, each */
+ /* triplet of subpixels has R=G=B. */
+ /* */
+ /* This is done to allow FreeType clients to run unmodified, forcing */
+ /* them to display normal gray-level anti-aliased glyphs. */
+ /* */
+#define FT_CONFIG_OPTION_SUBPIXEL_RENDERING
+
+
+ /*************************************************************************/
+ /* */
+ /* Many compilers provide a non-ANSI 64-bit data type that can be used */
+ /* by FreeType to speed up some computations. However, this will create */
+ /* some problems when compiling the library in strict ANSI mode. */
+ /* */
+ /* For this reason, the use of 64-bit integers is normally disabled when */
+ /* the __STDC__ macro is defined. You can however disable this by */
+ /* defining the macro FT_CONFIG_OPTION_FORCE_INT64 here. */
+ /* */
+ /* For most compilers, this will only create compilation warnings when */
+ /* building the library. */
+ /* */
+ /* ObNote: The compiler-specific 64-bit integers are detected in the */
+ /* file `ftconfig.h' either statically or through the */
+ /* `configure' script on supported platforms. */
+ /* */
+#undef FT_CONFIG_OPTION_FORCE_INT64
+
+
+ /*************************************************************************/
+ /* */
+ /* If this macro is defined, do not try to use an assembler version of */
+ /* performance-critical functions (e.g. FT_MulFix). You should only do */
+ /* that to verify that the assembler function works properly, or to */
+ /* execute benchmark tests of the various implementations. */
+/* #define FT_CONFIG_OPTION_NO_ASSEMBLER */
+
+
+ /*************************************************************************/
+ /* */
+ /* If this macro is defined, try to use an inlined assembler version of */
+ /* the `FT_MulFix' function, which is a `hotspot' when loading and */
+ /* hinting glyphs, and which should be executed as fast as possible. */
+ /* */
+ /* Note that if your compiler or CPU is not supported, this will default */
+ /* to the standard and portable implementation found in `ftcalc.c'. */
+ /* */
+#define FT_CONFIG_OPTION_INLINE_MULFIX
+
+
+ /*************************************************************************/
+ /* */
+ /* LZW-compressed file support. */
+ /* */
+ /* FreeType now handles font files that have been compressed with the */
+ /* `compress' program. This is mostly used to parse many of the PCF */
+ /* files that come with various X11 distributions. The implementation */
+ /* uses NetBSD's `zopen' to partially uncompress the file on the fly */
+ /* (see src/lzw/ftgzip.c). */
+ /* */
+ /* Define this macro if you want to enable this `feature'. */
+ /* */
+#define FT_CONFIG_OPTION_USE_LZW
+
+
+ /*************************************************************************/
+ /* */
+ /* Gzip-compressed file support. */
+ /* */
+ /* FreeType now handles font files that have been compressed with the */
+ /* `gzip' program. This is mostly used to parse many of the PCF files */
+ /* that come with XFree86. The implementation uses `zlib' to */
+ /* partially uncompress the file on the fly (see src/gzip/ftgzip.c). */
+ /* */
+ /* Define this macro if you want to enable this `feature'. See also */
+ /* the macro FT_CONFIG_OPTION_SYSTEM_ZLIB below. */
+ /* */
+#undef FT_CONFIG_OPTION_USE_ZLIB
+
+
+ /*************************************************************************/
+ /* */
+ /* ZLib library selection */
+ /* */
+ /* This macro is only used when FT_CONFIG_OPTION_USE_ZLIB is defined. */
+ /* It allows FreeType's `ftgzip' component to link to the system's */
+ /* installation of the ZLib library. This is useful on systems like */
+ /* Unix or VMS where it generally is already available. */
+ /* */
+ /* If you let it undefined, the component will use its own copy */
+ /* of the zlib sources instead. These have been modified to be */
+ /* included directly within the component and *not* export external */
+ /* function names. This allows you to link any program with FreeType */
+ /* _and_ ZLib without linking conflicts. */
+ /* */
+ /* Do not #undef this macro here since the build system might define */
+ /* it for certain configurations only. */
+ /* */
+/* #define FT_CONFIG_OPTION_SYSTEM_ZLIB */
+
+
+ /*************************************************************************/
+ /* */
+ /* Bzip2-compressed file support. */
+ /* */
+ /* FreeType now handles font files that have been compressed with the */
+ /* `bzip2' program. This is mostly used to parse many of the PCF */
+ /* files that come with XFree86. The implementation uses `libbz2' to */
+ /* partially uncompress the file on the fly (see src/bzip2/ftbzip2.c). */
+ /* Contrary to gzip, bzip2 currently is not included and need to use */
+ /* the system available bzip2 implementation. */
+ /* */
+ /* Define this macro if you want to enable this `feature'. */
+ /* */
+/* #define FT_CONFIG_OPTION_USE_BZIP2 */
+
+
+ /*************************************************************************/
+ /* */
+ /* Define to disable the use of file stream functions and types, FILE, */
+ /* fopen() etc. Enables the use of smaller system libraries on embedded */
+ /* systems that have multiple system libraries, some with or without */
+ /* file stream support, in the cases where file stream support is not */
+ /* necessary such as memory loading of font files. */
+ /* */
+/* #define FT_CONFIG_OPTION_DISABLE_STREAM_SUPPORT */
+
+
+ /*************************************************************************/
+ /* */
+ /* PNG bitmap support. */
+ /* */
+ /* FreeType now handles loading color bitmap glyphs in the PNG format. */
+ /* This requires help from the external libpng library. Uncompressed */
+ /* color bitmaps do not need any external libraries and will be */
+ /* supported regardless of this configuration. */
+ /* */
+ /* Define this macro if you want to enable this `feature'. */
+ /* */
+/* #define FT_CONFIG_OPTION_USE_PNG */
+
+
+ /*************************************************************************/
+ /* */
+ /* HarfBuzz support. */
+ /* */
+ /* FreeType uses the HarfBuzz library to improve auto-hinting of */
+ /* OpenType fonts. If available, many glyphs not directly addressable */
+ /* by a font's character map will be hinted also. */
+ /* */
+ /* Define this macro if you want to enable this `feature'. */
+ /* */
+/* #define FT_CONFIG_OPTION_USE_HARFBUZZ */
+
+
+ /*************************************************************************/
+ /* */
+ /* DLL export compilation */
+ /* */
+ /* When compiling FreeType as a DLL, some systems/compilers need a */
+ /* special keyword in front OR after the return type of function */
+ /* declarations. */
+ /* */
+ /* Two macros are used within the FreeType source code to define */
+ /* exported library functions: FT_EXPORT and FT_EXPORT_DEF. */
+ /* */
+ /* FT_EXPORT( return_type ) */
+ /* */
+ /* is used in a function declaration, as in */
+ /* */
+ /* FT_EXPORT( FT_Error ) */
+ /* FT_Init_FreeType( FT_Library* alibrary ); */
+ /* */
+ /* */
+ /* FT_EXPORT_DEF( return_type ) */
+ /* */
+ /* is used in a function definition, as in */
+ /* */
+ /* FT_EXPORT_DEF( FT_Error ) */
+ /* FT_Init_FreeType( FT_Library* alibrary ) */
+ /* { */
+ /* ... some code ... */
+ /* return FT_Err_Ok; */
+ /* } */
+ /* */
+ /* You can provide your own implementation of FT_EXPORT and */
+ /* FT_EXPORT_DEF here if you want. If you leave them undefined, they */
+ /* will be later automatically defined as `extern return_type' to */
+ /* allow normal compilation. */
+ /* */
+ /* Do not #undef these macros here since the build system might define */
+ /* them for certain configurations only. */
+ /* */
+/* #define FT_EXPORT(x) extern x */
+/* #define FT_EXPORT_DEF(x) x */
+
+
+ /*************************************************************************/
+ /* */
+ /* Glyph Postscript Names handling */
+ /* */
+ /* By default, FreeType 2 is compiled with the `psnames' module. This */
+ /* module is in charge of converting a glyph name string into a */
+ /* Unicode value, or return a Macintosh standard glyph name for the */
+ /* use with the TrueType `post' table. */
+ /* */
+ /* Undefine this macro if you do not want `psnames' compiled in your */
+ /* build of FreeType. This has the following effects: */
+ /* */
+ /* - The TrueType driver will provide its own set of glyph names, */
+ /* if you build it to support postscript names in the TrueType */
+ /* `post' table. */
+ /* */
+ /* - The Type 1 driver will not be able to synthesize a Unicode */
+ /* charmap out of the glyphs found in the fonts. */
+ /* */
+ /* You would normally undefine this configuration macro when building */
+ /* a version of FreeType that doesn't contain a Type 1 or CFF driver. */
+ /* */
+#define FT_CONFIG_OPTION_POSTSCRIPT_NAMES
+
+
+ /*************************************************************************/
+ /* */
+ /* Postscript Names to Unicode Values support */
+ /* */
+ /* By default, FreeType 2 is built with the `PSNames' module compiled */
+ /* in. Among other things, the module is used to convert a glyph name */
+ /* into a Unicode value. This is especially useful in order to */
+ /* synthesize on the fly a Unicode charmap from the CFF/Type 1 driver */
+ /* through a big table named the `Adobe Glyph List' (AGL). */
+ /* */
+ /* Undefine this macro if you do not want the Adobe Glyph List */
+ /* compiled in your `PSNames' module. The Type 1 driver will not be */
+ /* able to synthesize a Unicode charmap out of the glyphs found in the */
+ /* fonts. */
+ /* */
+#define FT_CONFIG_OPTION_ADOBE_GLYPH_LIST
+
+
+ /*************************************************************************/
+ /* */
+ /* Support for Mac fonts */
+ /* */
+ /* Define this macro if you want support for outline fonts in Mac */
+ /* format (mac dfont, mac resource, macbinary containing a mac */
+ /* resource) on non-Mac platforms. */
+ /* */
+ /* Note that the `FOND' resource isn't checked. */
+ /* */
+#undef FT_CONFIG_OPTION_MAC_FONTS
+
+
+ /*************************************************************************/
+ /* */
+ /* Guessing methods to access embedded resource forks */
+ /* */
+ /* Enable extra Mac fonts support on non-Mac platforms (e.g. */
+ /* GNU/Linux). */
+ /* */
+ /* Resource forks which include fonts data are stored sometimes in */
+ /* locations which users or developers don't expected. In some cases, */
+ /* resource forks start with some offset from the head of a file. In */
+ /* other cases, the actual resource fork is stored in file different */
+ /* from what the user specifies. If this option is activated, */
+ /* FreeType tries to guess whether such offsets or different file */
+ /* names must be used. */
+ /* */
+ /* Note that normal, direct access of resource forks is controlled via */
+ /* the FT_CONFIG_OPTION_MAC_FONTS option. */
+ /* */
+#ifdef FT_CONFIG_OPTION_MAC_FONTS
+#define FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK
+#endif
+
+
+ /*************************************************************************/
+ /* */
+ /* Allow the use of FT_Incremental_Interface to load typefaces that */
+ /* contain no glyph data, but supply it via a callback function. */
+ /* This is required by clients supporting document formats which */
+ /* supply font data incrementally as the document is parsed, such */
+ /* as the Ghostscript interpreter for the PostScript language. */
+ /* */
+#define FT_CONFIG_OPTION_INCREMENTAL
+
+
+ /*************************************************************************/
+ /* */
+ /* The size in bytes of the render pool used by the scan-line converter */
+ /* to do all of its work. */
+ /* */
+#define FT_RENDER_POOL_SIZE 16384L
+
+
+ /*************************************************************************/
+ /* */
+ /* FT_MAX_MODULES */
+ /* */
+ /* The maximum number of modules that can be registered in a single */
+ /* FreeType library object. 32 is the default. */
+ /* */
+#define FT_MAX_MODULES 32
+
+
+ /*************************************************************************/
+ /* */
+ /* Debug level */
+ /* */
+ /* FreeType can be compiled in debug or trace mode. In debug mode, */
+ /* errors are reported through the `ftdebug' component. In trace */
+ /* mode, additional messages are sent to the standard output during */
+ /* execution. */
+ /* */
+ /* Define FT_DEBUG_LEVEL_ERROR to build the library in debug mode. */
+ /* Define FT_DEBUG_LEVEL_TRACE to build it in trace mode. */
+ /* */
+ /* Don't define any of these macros to compile in `release' mode! */
+ /* */
+ /* Do not #undef these macros here since the build system might define */
+ /* them for certain configurations only. */
+ /* */
+/* #define FT_DEBUG_LEVEL_ERROR */
+/* #define FT_DEBUG_LEVEL_TRACE */
+
+
+ /*************************************************************************/
+ /* */
+ /* Autofitter debugging */
+ /* */
+ /* If FT_DEBUG_AUTOFIT is defined, FreeType provides some means to */
+ /* control the autofitter behaviour for debugging purposes with global */
+ /* boolean variables (consequently, you should *never* enable this */
+ /* while compiling in `release' mode): */
+ /* */
+ /* _af_debug_disable_horz_hints */
+ /* _af_debug_disable_vert_hints */
+ /* _af_debug_disable_blue_hints */
+ /* */
+ /* Additionally, the following functions provide dumps of various */
+ /* internal autofit structures to stdout (using `printf'): */
+ /* */
+ /* af_glyph_hints_dump_points */
+ /* af_glyph_hints_dump_segments */
+ /* af_glyph_hints_dump_edges */
+ /* af_glyph_hints_get_num_segments */
+ /* af_glyph_hints_get_segment_offset */
+ /* */
+ /* As an argument, they use another global variable: */
+ /* */
+ /* _af_debug_hints */
+ /* */
+ /* Please have a look at the `ftgrid' demo program to see how those */
+ /* variables and macros should be used. */
+ /* */
+ /* Do not #undef these macros here since the build system might define */
+ /* them for certain configurations only. */
+ /* */
+/* #define FT_DEBUG_AUTOFIT */
+
+
+ /*************************************************************************/
+ /* */
+ /* Memory Debugging */
+ /* */
+ /* FreeType now comes with an integrated memory debugger that is */
+ /* capable of detecting simple errors like memory leaks or double */
+ /* deletes. To compile it within your build of the library, you */
+ /* should define FT_DEBUG_MEMORY here. */
+ /* */
+ /* Note that the memory debugger is only activated at runtime when */
+ /* when the _environment_ variable `FT2_DEBUG_MEMORY' is defined also! */
+ /* */
+ /* Do not #undef this macro here since the build system might define */
+ /* it for certain configurations only. */
+ /* */
+/* #define FT_DEBUG_MEMORY */
+
+
+ /*************************************************************************/
+ /* */
+ /* Module errors */
+ /* */
+ /* If this macro is set (which is _not_ the default), the higher byte */
+ /* of an error code gives the module in which the error has occurred, */
+ /* while the lower byte is the real error code. */
+ /* */
+ /* Setting this macro makes sense for debugging purposes only, since */
+ /* it would break source compatibility of certain programs that use */
+ /* FreeType 2. */
+ /* */
+ /* More details can be found in the files ftmoderr.h and fterrors.h. */
+ /* */
+#undef FT_CONFIG_OPTION_USE_MODULE_ERRORS
+
+
+ /*************************************************************************/
+ /* */
+ /* Position Independent Code */
+ /* */
+ /* If this macro is set (which is _not_ the default), FreeType2 will */
+ /* avoid creating constants that require address fixups. Instead the */
+ /* constants will be moved into a struct and additional intialization */
+ /* code will be used. */
+ /* */
+ /* Setting this macro is needed for systems that prohibit address */
+ /* fixups, such as BREW. [Note that standard compilers like gcc or */
+ /* clang handle PIC generation automatically; you don't have to set */
+ /* FT_CONFIG_OPTION_PIC, which is only necessary for very special */
+ /* compilers.] */
+ /* */
+ /* Note that FT_CONFIG_OPTION_PIC support is not available for all */
+ /* modules (see `modules.cfg' for a complete list). For building with */
+ /* FT_CONFIG_OPTION_PIC support, do the following. */
+ /* */
+ /* 0. Clone the repository. */
+ /* 1. Define FT_CONFIG_OPTION_PIC. */
+ /* 2. Remove all subdirectories in `src' that don't have */
+ /* FT_CONFIG_OPTION_PIC support. */
+ /* 3. Comment out the corresponding modules in `modules.cfg'. */
+ /* 4. Compile. */
+ /* */
+/* #define FT_CONFIG_OPTION_PIC */
+
+
+ /*************************************************************************/
+ /*************************************************************************/
+ /**** ****/
+ /**** S F N T D R I V E R C O N F I G U R A T I O N ****/
+ /**** ****/
+ /*************************************************************************/
+ /*************************************************************************/
+
+
+ /*************************************************************************/
+ /* */
+ /* Define TT_CONFIG_OPTION_EMBEDDED_BITMAPS if you want to support */
+ /* embedded bitmaps in all formats using the SFNT module (namely */
+ /* TrueType & OpenType). */
+ /* */
+#undef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
+
+
+ /*************************************************************************/
+ /* */
+ /* Define TT_CONFIG_OPTION_POSTSCRIPT_NAMES if you want to be able to */
+ /* load and enumerate the glyph Postscript names in a TrueType or */
+ /* OpenType file. */
+ /* */
+ /* Note that when you do not compile the `PSNames' module by undefining */
+ /* the above FT_CONFIG_OPTION_POSTSCRIPT_NAMES, the `sfnt' module will */
+ /* contain additional code used to read the PS Names table from a font. */
+ /* */
+ /* (By default, the module uses `PSNames' to extract glyph names.) */
+ /* */
+#define TT_CONFIG_OPTION_POSTSCRIPT_NAMES
+
+
+ /*************************************************************************/
+ /* */
+ /* Define TT_CONFIG_OPTION_SFNT_NAMES if your applications need to */
+ /* access the internal name table in a SFNT-based format like TrueType */
+ /* or OpenType. The name table contains various strings used to */
+ /* describe the font, like family name, copyright, version, etc. It */
+ /* does not contain any glyph name though. */
+ /* */
+ /* Accessing SFNT names is done through the functions declared in */
+ /* `ftsnames.h'. */
+ /* */
+#define TT_CONFIG_OPTION_SFNT_NAMES
+
+
+ /*************************************************************************/
+ /* */
+ /* TrueType CMap support */
+ /* */
+ /* Here you can fine-tune which TrueType CMap table format shall be */
+ /* supported. */
+#define TT_CONFIG_CMAP_FORMAT_0
+#define TT_CONFIG_CMAP_FORMAT_2
+#define TT_CONFIG_CMAP_FORMAT_4
+#define TT_CONFIG_CMAP_FORMAT_6
+#define TT_CONFIG_CMAP_FORMAT_8
+#define TT_CONFIG_CMAP_FORMAT_10
+#define TT_CONFIG_CMAP_FORMAT_12
+#define TT_CONFIG_CMAP_FORMAT_13
+#define TT_CONFIG_CMAP_FORMAT_14
+
+
+ /*************************************************************************/
+ /*************************************************************************/
+ /**** ****/
+ /**** T R U E T Y P E D R I V E R C O N F I G U R A T I O N ****/
+ /**** ****/
+ /*************************************************************************/
+ /*************************************************************************/
+
+ /*************************************************************************/
+ /* */
+ /* Define TT_CONFIG_OPTION_BYTECODE_INTERPRETER if you want to compile */
+ /* a bytecode interpreter in the TrueType driver. */
+ /* */
+ /* By undefining this, you will only compile the code necessary to load */
+ /* TrueType glyphs without hinting. */
+ /* */
+ /* Do not #undef this macro here, since the build system might */
+ /* define it for certain configurations only. */
+ /* */
+#define TT_CONFIG_OPTION_BYTECODE_INTERPRETER
+
+
+ /*************************************************************************/
+ /* */
+ /* Define TT_CONFIG_OPTION_SUBPIXEL_HINTING if you want to compile */
+ /* subpixel hinting support into the TrueType driver. This modifies the */
+ /* TrueType hinting mechanism when anything but FT_RENDER_MODE_MONO is */
+ /* requested. */
+ /* */
+ /* In particular, it modifies the bytecode interpreter to interpret (or */
+ /* not) instructions in a certain way so that all TrueType fonts look */
+ /* like they do in a Windows ClearType (DirectWrite) environment. See */
+ /* [1] for a technical overview on what this means. See `ttinterp.h' */
+ /* for more details on the LEAN option. */
+ /* */
+ /* There are three options. */
+ /* */
+ /* 1. This option is associated with the `Infinality' moniker. */
+ /* Contributed by an individual nicknamed Infinality with the goal of */
+ /* making TrueType fonts render better than on Windows. A high */
+ /* amount of configurability and flexibility, down to rules for */
+ /* single glyphs in fonts, but also very slow. Its experimental and */
+ /* slow nature and the original developer losing interest meant that */
+ /* this option was never enabled in default builds. */
+ /* */
+ /* 2. The new default mode for the TrueType driver. The Infinality code */
+ /* base was stripped to the bare minimum and all configurability */
+ /* removed in the name of speed and simplicity. The configurability */
+ /* was mainly aimed at legacy fonts like Arial, Times New Roman, or */
+ /* Courier. Legacy fonts are fonts that modify vertical stems to */
+ /* achieve clean black-and-white bitmaps. The new mode focuses on */
+ /* applying a minimal set of rules to all fonts indiscriminately so */
+ /* that modern and web fonts render well while legacy fonts render */
+ /* okay. */
+ /* */
+ /* 3. Compile both. */
+ /* */
+ /* By undefining these, you get rendering behavior like on Windows */
+ /* without ClearType, i.e., Windows XP without ClearType enabled and */
+ /* Win9x (interpreter version v35). Or not, depending on how much */
+ /* hinting blood and testing tears the font designer put into a given */
+ /* font. If you define one or both subpixel hinting options, you can */
+ /* switch between between v35 and the ones you define. */
+ /* */
+ /* This option requires TT_CONFIG_OPTION_BYTECODE_INTERPRETER to be */
+ /* defined. */
+ /* */
+ /* [1] http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx */
+ /* */
+/* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING 1 */
+#define TT_CONFIG_OPTION_SUBPIXEL_HINTING 2
+/* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING ( 1 | 2 ) */
+
+
+ /*************************************************************************/
+ /* */
+ /* Define TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED to compile the */
+ /* TrueType glyph loader to use Apple's definition of how to handle */
+ /* component offsets in composite glyphs. */
+ /* */
+ /* Apple and MS disagree on the default behavior of component offsets */
+ /* in composites. Apple says that they should be scaled by the scaling */
+ /* factors in the transformation matrix (roughly, it's more complex) */
+ /* while MS says they should not. OpenType defines two bits in the */
+ /* composite flags array which can be used to disambiguate, but old */
+ /* fonts will not have them. */
+ /* */
+ /* http://www.microsoft.com/typography/otspec/glyf.htm */
+ /* https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6glyf.html */
+ /* */
+#undef TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED
+
+
+ /*************************************************************************/
+ /* */
+ /* Define TT_CONFIG_OPTION_GX_VAR_SUPPORT if you want to include */
+ /* support for Apple's distortable font technology (fvar, gvar, cvar, */
+ /* and avar tables). This has many similarities to Type 1 Multiple */
+ /* Masters support. */
+ /* */
+#undef TT_CONFIG_OPTION_GX_VAR_SUPPORT
+
+
+ /*************************************************************************/
+ /* */
+ /* Define TT_CONFIG_OPTION_BDF if you want to include support for */
+ /* an embedded `BDF ' table within SFNT-based bitmap formats. */
+ /* */
+#undef TT_CONFIG_OPTION_BDF
+
+
+ /*************************************************************************/
+ /* */
+ /* Option TT_CONFIG_OPTION_MAX_RUNNABLE_OPCODES controls the maximum */
+ /* number of bytecode instructions executed for a single run of the */
+ /* bytecode interpreter, needed to prevent infinite loops. You don't */
+ /* want to change this except for very special situations (e.g., making */
+ /* a library fuzzer spend less time to handle broken fonts). */
+ /* */
+ /* It is not expected that this value is ever modified by a configuring */
+ /* script; instead, it gets surrounded with #ifndef ... #endif so that */
+ /* the value can be set as a preprocessor option on the compiler's */
+ /* command line. */
+ /* */
+#ifndef TT_CONFIG_OPTION_MAX_RUNNABLE_OPCODES
+#define TT_CONFIG_OPTION_MAX_RUNNABLE_OPCODES 1000000L
+#endif
+
+
+ /*************************************************************************/
+ /*************************************************************************/
+ /**** ****/
+ /**** T Y P E 1 D R I V E R C O N F I G U R A T I O N ****/
+ /**** ****/
+ /*************************************************************************/
+ /*************************************************************************/
+
+
+ /*************************************************************************/
+ /* */
+ /* T1_MAX_DICT_DEPTH is the maximum depth of nest dictionaries and */
+ /* arrays in the Type 1 stream (see t1load.c). A minimum of 4 is */
+ /* required. */
+ /* */
+#define T1_MAX_DICT_DEPTH 5
+
+
+ /*************************************************************************/
+ /* */
+ /* T1_MAX_SUBRS_CALLS details the maximum number of nested sub-routine */
+ /* calls during glyph loading. */
+ /* */
+#define T1_MAX_SUBRS_CALLS 16
+
+
+ /*************************************************************************/
+ /* */
+ /* T1_MAX_CHARSTRING_OPERANDS is the charstring stack's capacity. A */
+ /* minimum of 16 is required. */
+ /* */
+ /* The Chinese font MingTiEG-Medium (CNS 11643 character set) needs 256. */
+ /* */
+#define T1_MAX_CHARSTRINGS_OPERANDS 512
+
+
+ /*************************************************************************/
+ /* */
+ /* Define this configuration macro if you want to prevent the */
+ /* compilation of `t1afm', which is in charge of reading Type 1 AFM */
+ /* files into an existing face. Note that if set, the T1 driver will be */
+ /* unable to produce kerning distances. */
+ /* */
+#undef T1_CONFIG_OPTION_NO_AFM
+
+
+ /*************************************************************************/
+ /* */
+ /* Define this configuration macro if you want to prevent the */
+ /* compilation of the Multiple Masters font support in the Type 1 */
+ /* driver. */
+ /* */
+#undef T1_CONFIG_OPTION_NO_MM_SUPPORT
+
+
+ /*************************************************************************/
+ /*************************************************************************/
+ /**** ****/
+ /**** C F F D R I V E R C O N F I G U R A T I O N ****/
+ /**** ****/
+ /*************************************************************************/
+ /*************************************************************************/
+
+
+ /*************************************************************************/
+ /* */
+ /* Using CFF_CONFIG_OPTION_DARKENING_PARAMETER_{X,Y}{1,2,3,4} it is */
+ /* possible to set up the default values of the four control points that */
+ /* define the stem darkening behaviour of the (new) CFF engine. For */
+ /* more details please read the documentation of the */
+ /* `darkening-parameters' property of the cff driver module (file */
+ /* `ftcffdrv.h'), which allows the control at run-time. */
+ /* */
+ /* Do *not* undefine these macros! */
+ /* */
+#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_X1 500
+#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y1 400
+
+#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_X2 1000
+#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y2 275
+
+#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_X3 1667
+#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y3 275
+
+#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_X4 2333
+#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y4 0
+
+
+ /*************************************************************************/
+ /* */
+ /* CFF_CONFIG_OPTION_OLD_ENGINE controls whether the pre-Adobe CFF */
+ /* engine gets compiled into FreeType. If defined, it is possible to */
+ /* switch between the two engines using the `hinting-engine' property of */
+ /* the cff driver module. */
+ /* */
+/* #define CFF_CONFIG_OPTION_OLD_ENGINE */
+
+
+ /*************************************************************************/
+ /*************************************************************************/
+ /**** ****/
+ /**** P C F D R I V E R C O N F I G U R A T I O N ****/
+ /**** ****/
+ /*************************************************************************/
+ /*************************************************************************/
+
+
+ /*************************************************************************/
+ /* */
+ /* There are many PCF fonts just called `Fixed' which look completely */
+ /* different, and which have nothing to do with each other. When */
+ /* selecting `Fixed' in KDE or Gnome one gets results that appear rather */
+ /* random, the style changes often if one changes the size and one */
+ /* cannot select some fonts at all. This option makes the PCF module */
+ /* prepend the foundry name (plus a space) to the family name. */
+ /* */
+ /* We also check whether we have `wide' characters; all put together, we */
+ /* get family names like `Sony Fixed' or `Misc Fixed Wide'. */
+ /* */
+ /* If this option is activated, it can be controlled with the */
+ /* `no-long-family-names' property of the pcf driver module. */
+ /* */
+/* #define PCF_CONFIG_OPTION_LONG_FAMILY_NAMES */
+
+
+ /*************************************************************************/
+ /*************************************************************************/
+ /**** ****/
+ /**** A U T O F I T M O D U L E C O N F I G U R A T I O N ****/
+ /**** ****/
+ /*************************************************************************/
+ /*************************************************************************/
+
+
+ /*************************************************************************/
+ /* */
+ /* Compile autofit module with CJK (Chinese, Japanese, Korean) script */
+ /* support. */
+ /* */
+#define AF_CONFIG_OPTION_CJK
+
+ /*************************************************************************/
+ /* */
+ /* Compile autofit module with Indic script support. */
+ /* */
+#define AF_CONFIG_OPTION_INDIC
+
+ /*************************************************************************/
+ /* */
+ /* Compile autofit module with warp hinting. The idea of the warping */
+ /* code is to slightly scale and shift a glyph within a single dimension */
+ /* so that as much of its segments are aligned (more or less) on the */
+ /* grid. To find out the optimal scaling and shifting value, various */
+ /* parameter combinations are tried and scored. */
+ /* */
+ /* This experimental option is active only if the rendering mode is */
+ /* FT_RENDER_MODE_LIGHT; you can switch warping on and off with the */
+ /* `warping' property of the auto-hinter (see file `ftautoh.h' for more */
+ /* information; by default it is switched off). */
+ /* */
+#define AF_CONFIG_OPTION_USE_WARPER
+
+ /* */
+
+
+ /*
+ * This macro is obsolete. Support has been removed in FreeType
+ * version 2.5.
+ */
+/* #define FT_CONFIG_OPTION_OLD_INTERNALS */
+
+
+ /*
+ * This macro is defined if native TrueType hinting is requested by the
+ * definitions above.
+ */
+#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
+#define TT_USE_BYTECODE_INTERPRETER
+
+#if TT_CONFIG_OPTION_SUBPIXEL_HINTING & 1
+#define TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
+#endif
+
+#if TT_CONFIG_OPTION_SUBPIXEL_HINTING & 2
+#define TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
+#endif
+#endif
+
+
+ /*
+ * Check CFF darkening parameters. The checks are the same as in function
+ * `cff_property_set' in file `cffdrivr.c'.
+ */
+#if CFF_CONFIG_OPTION_DARKENING_PARAMETER_X1 < 0 || \
+ CFF_CONFIG_OPTION_DARKENING_PARAMETER_X2 < 0 || \
+ CFF_CONFIG_OPTION_DARKENING_PARAMETER_X3 < 0 || \
+ CFF_CONFIG_OPTION_DARKENING_PARAMETER_X4 < 0 || \
+ \
+ CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y1 < 0 || \
+ CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y2 < 0 || \
+ CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y3 < 0 || \
+ CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y4 < 0 || \
+ \
+ CFF_CONFIG_OPTION_DARKENING_PARAMETER_X1 > \
+ CFF_CONFIG_OPTION_DARKENING_PARAMETER_X2 || \
+ CFF_CONFIG_OPTION_DARKENING_PARAMETER_X2 > \
+ CFF_CONFIG_OPTION_DARKENING_PARAMETER_X3 || \
+ CFF_CONFIG_OPTION_DARKENING_PARAMETER_X3 > \
+ CFF_CONFIG_OPTION_DARKENING_PARAMETER_X4 || \
+ \
+ CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y1 > 500 || \
+ CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y2 > 500 || \
+ CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y3 > 500 || \
+ CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y4 > 500
+#error "Invalid CFF darkening parameters!"
+#endif
+
+FT_END_HEADER
+
+
+#endif /* FTOPTION_H_ */
+
+
+/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/config/ftconfig.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/config/ftconfig.h
deleted file mode 100644
index d4d79936df1..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/config/ftconfig.h
+++ /dev/null
@@ -1,467 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftconfig.h */
-/* */
-/* ANSI-specific configuration file (specification only). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* This header file contains a number of macro definitions that are used */
- /* by the rest of the engine. Most of the macros here are automatically */
- /* determined at compile time, and you should not need to change it to */
- /* port FreeType, except to compile the library with a non-ANSI */
- /* compiler. */
- /* */
- /* Note however that if some specific modifications are needed, we */
- /* advise you to place a modified copy in your build directory. */
- /* */
- /* The build directory is usually `builds/<system>', and contains */
- /* system-specific files that are always included first when building */
- /* the library. */
- /* */
- /* This ANSI version should stay in `include/config/'. */
- /* */
- /*************************************************************************/
-
-#ifndef __FTCONFIG_H__
-#define __FTCONFIG_H__
-
-#include <ft2build.h>
-#include FT_CONFIG_OPTIONS_H
-#include FT_CONFIG_STANDARD_LIBRARY_H
-
-
-FT_BEGIN_HEADER
-
-
- /*************************************************************************/
- /* */
- /* PLATFORM-SPECIFIC CONFIGURATION MACROS */
- /* */
- /* These macros can be toggled to suit a specific system. The current */
- /* ones are defaults used to compile FreeType in an ANSI C environment */
- /* (16bit compilers are also supported). Copy this file to your own */
- /* `builds/<system>' directory, and edit it to port the engine. */
- /* */
- /*************************************************************************/
-
-
- /* There are systems (like the Texas Instruments 'C54x) where a `char' */
- /* has 16 bits. ANSI C says that sizeof(char) is always 1. Since an */
- /* `int' has 16 bits also for this system, sizeof(int) gives 1 which */
- /* is probably unexpected. */
- /* */
- /* `CHAR_BIT' (defined in limits.h) gives the number of bits in a */
- /* `char' type. */
-
-#ifndef FT_CHAR_BIT
-#define FT_CHAR_BIT CHAR_BIT
-#endif
-
-
- /* The size of an `int' type. */
-#if FT_UINT_MAX == 0xFFFFUL
-#define FT_SIZEOF_INT (16 / FT_CHAR_BIT)
-#elif FT_UINT_MAX == 0xFFFFFFFFUL
-#define FT_SIZEOF_INT (32 / FT_CHAR_BIT)
-#elif FT_UINT_MAX > 0xFFFFFFFFUL && FT_UINT_MAX == 0xFFFFFFFFFFFFFFFFUL
-#define FT_SIZEOF_INT (64 / FT_CHAR_BIT)
-#else
-#error "Unsupported size of `int' type!"
-#endif
-
- /* The size of a `long' type. A five-byte `long' (as used e.g. on the */
- /* DM642) is recognized but avoided. */
-#if FT_ULONG_MAX == 0xFFFFFFFFUL
-#define FT_SIZEOF_LONG (32 / FT_CHAR_BIT)
-#elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFUL
-#define FT_SIZEOF_LONG (32 / FT_CHAR_BIT)
-#elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFFFFFFFUL
-#define FT_SIZEOF_LONG (64 / FT_CHAR_BIT)
-#else
-#error "Unsupported size of `long' type!"
-#endif
-
-
- /* FT_UNUSED is a macro used to indicate that a given parameter is not */
- /* used -- this is only used to get rid of unpleasant compiler warnings */
-#ifndef FT_UNUSED
-#define FT_UNUSED( arg ) ( (arg) = (arg) )
-#endif
-
-
- /*************************************************************************/
- /* */
- /* AUTOMATIC CONFIGURATION MACROS */
- /* */
- /* These macros are computed from the ones defined above. Don't touch */
- /* their definition, unless you know precisely what you are doing. No */
- /* porter should need to mess with them. */
- /* */
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* Mac support */
- /* */
- /* This is the only necessary change, so it is defined here instead */
- /* providing a new configuration file. */
- /* */
-#if defined( __APPLE__ ) || ( defined( __MWERKS__ ) && defined( macintosh ) )
- /* no Carbon frameworks for 64bit 10.4.x */
- /* AvailabilityMacros.h is available since Mac OS X 10.2, */
- /* so guess the system version by maximum errno before inclusion */
-#include <errno.h>
-#ifdef ECANCELED /* defined since 10.2 */
-#include "AvailabilityMacros.h"
-#endif
-#if defined( __LP64__ ) && \
- ( MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4 )
-#undef FT_MACINTOSH
-#endif
-
-#elif defined( __SC__ ) || defined( __MRC__ )
- /* Classic MacOS compilers */
-#include "ConditionalMacros.h"
-#if TARGET_OS_MAC
-#define FT_MACINTOSH 1
-#endif
-
-#endif
-
-
- /*************************************************************************/
- /* */
- /* <Section> */
- /* basic_types */
- /* */
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* FT_Int16 */
- /* */
- /* <Description> */
- /* A typedef for a 16bit signed integer type. */
- /* */
- typedef signed short FT_Int16;
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* FT_UInt16 */
- /* */
- /* <Description> */
- /* A typedef for a 16bit unsigned integer type. */
- /* */
- typedef unsigned short FT_UInt16;
-
- /* */
-
-
- /* this #if 0 ... #endif clause is for documentation purposes */
-#if 0
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* FT_Int32 */
- /* */
- /* <Description> */
- /* A typedef for a 32bit signed integer type. The size depends on */
- /* the configuration. */
- /* */
- typedef signed XXX FT_Int32;
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* FT_UInt32 */
- /* */
- /* A typedef for a 32bit unsigned integer type. The size depends on */
- /* the configuration. */
- /* */
- typedef unsigned XXX FT_UInt32;
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* FT_Int64 */
- /* */
- /* A typedef for a 64bit signed integer type. The size depends on */
- /* the configuration. Only defined if there is real 64bit support; */
- /* otherwise, it gets emulated with a structure (if necessary). */
- /* */
- typedef signed XXX FT_Int64;
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* FT_UInt64 */
- /* */
- /* A typedef for a 64bit unsigned integer type. The size depends on */
- /* the configuration. Only defined if there is real 64bit support; */
- /* otherwise, it gets emulated with a structure (if necessary). */
- /* */
- typedef unsigned XXX FT_UInt64;
-
- /* */
-
-#endif
-
-#if FT_SIZEOF_INT == (32 / FT_CHAR_BIT)
-
- typedef signed int FT_Int32;
- typedef unsigned int FT_UInt32;
-
-#elif FT_SIZEOF_LONG == (32 / FT_CHAR_BIT)
-
- typedef signed long FT_Int32;
- typedef unsigned long FT_UInt32;
-
-#else
-#error "no 32bit type found -- please check your configuration files"
-#endif
-
-
- /* look up an integer type that is at least 32 bits */
-#if FT_SIZEOF_INT >= (32 / FT_CHAR_BIT)
-
- typedef int FT_Fast;
- typedef unsigned int FT_UFast;
-
-#elif FT_SIZEOF_LONG >= (32 / FT_CHAR_BIT)
-
- typedef long FT_Fast;
- typedef unsigned long FT_UFast;
-
-#endif
-
-
- /* determine whether we have a 64-bit int type for platforms without */
- /* Autoconf */
-#if FT_SIZEOF_LONG == (64 / FT_CHAR_BIT)
-
- /* FT_LONG64 must be defined if a 64-bit type is available */
-#define FT_LONG64
-#define FT_INT64 long
-#define FT_UINT64 unsigned long
-
- /*************************************************************************/
- /* */
- /* A 64-bit data type may create compilation problems if you compile */
- /* in strict ANSI mode. To avoid them, we disable other 64-bit data */
- /* types if __STDC__ is defined. You can however ignore this rule */
- /* by defining the FT_CONFIG_OPTION_FORCE_INT64 configuration macro. */
- /* */
-#elif !defined( __STDC__ ) || defined( FT_CONFIG_OPTION_FORCE_INT64 )
-
-#if defined( _MSC_VER ) && _MSC_VER >= 900 /* Visual C++ (and Intel C++) */
-
- /* this compiler provides the __int64 type */
-#define FT_LONG64
-#define FT_INT64 __int64
-#define FT_UINT64 unsigned __int64
-
-#elif defined( __BORLANDC__ ) /* Borland C++ */
-
- /* XXXX: We should probably check the value of __BORLANDC__ in order */
- /* to test the compiler version. */
-
- /* this compiler provides the __int64 type */
-#define FT_LONG64
-#define FT_INT64 __int64
-#define FT_UINT64 unsigned __int64
-
-#elif defined( __WATCOMC__ ) /* Watcom C++ */
-
- /* Watcom doesn't provide 64-bit data types */
-
-#elif defined( __MWERKS__ ) /* Metrowerks CodeWarrior */
-
-#define FT_LONG64
-#define FT_INT64 long long int
-#define FT_UINT64 unsigned long long int
-
-#elif defined( __GNUC__ )
-
- /* GCC provides the `long long' type */
-#define FT_LONG64
-#define FT_INT64 long long int
-#define FT_UINT64 unsigned long long int
-
-#endif /* _MSC_VER */
-
-#endif /* FT_SIZEOF_LONG == (64 / FT_CHAR_BIT) */
-
-#ifdef FT_LONG64
- typedef FT_INT64 FT_Int64;
- typedef FT_UINT64 FT_UInt64;
-#endif
-
-
- /*************************************************************************/
- /* */
- /* miscellaneous */
- /* */
- /*************************************************************************/
-
-
-#define FT_BEGIN_STMNT do {
-#define FT_END_STMNT } while ( 0 )
-#define FT_DUMMY_STMNT FT_BEGIN_STMNT FT_END_STMNT
-
-
- /* typeof condition taken from gnulib's `intprops.h' header file */
-#if ( __GNUC__ >= 2 || \
- defined( __IBM__TYPEOF__ ) || \
- ( __SUNPRO_C >= 0x5110 && !__STDC__ ) )
-#define FT_TYPEOF( type ) (__typeof__ (type))
-#else
-#define FT_TYPEOF( type ) /* empty */
-#endif
-
-
-#ifdef FT_MAKE_OPTION_SINGLE_OBJECT
-
-#define FT_LOCAL( x ) static x
-#define FT_LOCAL_DEF( x ) static x
-
-#else
-
-#ifdef __cplusplus
-#define FT_LOCAL( x ) extern "C" x
-#define FT_LOCAL_DEF( x ) extern "C" x
-#else
-#define FT_LOCAL( x ) extern x
-#define FT_LOCAL_DEF( x ) x
-#endif
-
-#endif /* FT_MAKE_OPTION_SINGLE_OBJECT */
-
-#define FT_LOCAL_ARRAY( x ) extern const x
-#define FT_LOCAL_ARRAY_DEF( x ) const x
-
-
-#ifndef FT_BASE
-
-#ifdef __cplusplus
-#define FT_BASE( x ) extern "C" x
-#else
-#define FT_BASE( x ) extern x
-#endif
-
-#endif /* !FT_BASE */
-
-
-#ifndef FT_BASE_DEF
-
-#ifdef __cplusplus
-#define FT_BASE_DEF( x ) x
-#else
-#define FT_BASE_DEF( x ) x
-#endif
-
-#endif /* !FT_BASE_DEF */
-
-
-#ifndef FT_EXPORT
-
-#ifdef __cplusplus
-#define FT_EXPORT( x ) extern "C" x
-#else
-#define FT_EXPORT( x ) extern x
-#endif
-
-#endif /* !FT_EXPORT */
-
-
-#ifndef FT_EXPORT_DEF
-
-#ifdef __cplusplus
-#define FT_EXPORT_DEF( x ) extern "C" x
-#else
-#define FT_EXPORT_DEF( x ) extern x
-#endif
-
-#endif /* !FT_EXPORT_DEF */
-
-
-#ifndef FT_EXPORT_VAR
-
-#ifdef __cplusplus
-#define FT_EXPORT_VAR( x ) extern "C" x
-#else
-#define FT_EXPORT_VAR( x ) extern x
-#endif
-
-#endif /* !FT_EXPORT_VAR */
-
- /* The following macros are needed to compile the library with a */
- /* C++ compiler and with 16bit compilers. */
- /* */
-
- /* This is special. Within C++, you must specify `extern "C"' for */
- /* functions which are used via function pointers, and you also */
- /* must do that for structures which contain function pointers to */
- /* assure C linkage -- it's not possible to have (local) anonymous */
- /* functions which are accessed by (global) function pointers. */
- /* */
- /* */
- /* FT_CALLBACK_DEF is used to _define_ a callback function. */
- /* */
- /* FT_CALLBACK_TABLE is used to _declare_ a constant variable that */
- /* contains pointers to callback functions. */
- /* */
- /* FT_CALLBACK_TABLE_DEF is used to _define_ a constant variable */
- /* that contains pointers to callback functions. */
- /* */
- /* */
- /* Some 16bit compilers have to redefine these macros to insert */
- /* the infamous `_cdecl' or `__fastcall' declarations. */
- /* */
-#ifndef FT_CALLBACK_DEF
-#ifdef __cplusplus
-#define FT_CALLBACK_DEF( x ) extern "C" x
-#else
-#define FT_CALLBACK_DEF( x ) static x
-#endif
-#endif /* FT_CALLBACK_DEF */
-
-#ifndef FT_CALLBACK_TABLE
-#ifdef __cplusplus
-#define FT_CALLBACK_TABLE extern "C"
-#define FT_CALLBACK_TABLE_DEF extern "C"
-#else
-#define FT_CALLBACK_TABLE extern
-#define FT_CALLBACK_TABLE_DEF /* nothing */
-#endif
-#endif /* FT_CALLBACK_TABLE */
-
-
-FT_END_HEADER
-
-
-#endif /* __FTCONFIG_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/config/ftheader.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/config/ftheader.h
deleted file mode 100644
index 55f833db0fb..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/config/ftheader.h
+++ /dev/null
@@ -1,834 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftheader.h */
-/* */
-/* Build macros of the FreeType 2 library. */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-#ifndef __FT_HEADER_H__
-#define __FT_HEADER_H__
-
-
- /*@***********************************************************************/
- /* */
- /* <Macro> */
- /* FT_BEGIN_HEADER */
- /* */
- /* <Description> */
- /* This macro is used in association with @FT_END_HEADER in header */
- /* files to ensure that the declarations within are properly */
- /* encapsulated in an `extern "C" { .. }' block when included from a */
- /* C++ compiler. */
- /* */
-#ifdef __cplusplus
-#define FT_BEGIN_HEADER extern "C" {
-#else
-#define FT_BEGIN_HEADER /* nothing */
-#endif
-
-
- /*@***********************************************************************/
- /* */
- /* <Macro> */
- /* FT_END_HEADER */
- /* */
- /* <Description> */
- /* This macro is used in association with @FT_BEGIN_HEADER in header */
- /* files to ensure that the declarations within are properly */
- /* encapsulated in an `extern "C" { .. }' block when included from a */
- /* C++ compiler. */
- /* */
-#ifdef __cplusplus
-#define FT_END_HEADER }
-#else
-#define FT_END_HEADER /* nothing */
-#endif
-
-
- /*************************************************************************/
- /* */
- /* Aliases for the FreeType 2 public and configuration files. */
- /* */
- /*************************************************************************/
-
- /*************************************************************************/
- /* */
- /* <Section> */
- /* header_file_macros */
- /* */
- /* <Title> */
- /* Header File Macros */
- /* */
- /* <Abstract> */
- /* Macro definitions used to #include specific header files. */
- /* */
- /* <Description> */
- /* The following macros are defined to the name of specific */
- /* FreeType~2 header files. They can be used directly in #include */
- /* statements as in: */
- /* */
- /* { */
- /* #include FT_FREETYPE_H */
- /* #include FT_MULTIPLE_MASTERS_H */
- /* #include FT_GLYPH_H */
- /* } */
- /* */
- /* There are several reasons why we are now using macros to name */
- /* public header files. The first one is that such macros are not */
- /* limited to the infamous 8.3~naming rule required by DOS (and */
- /* `FT_MULTIPLE_MASTERS_H' is a lot more meaningful than `ftmm.h'). */
- /* */
- /* The second reason is that it allows for more flexibility in the */
- /* way FreeType~2 is installed on a given system. */
- /* */
- /*************************************************************************/
-
-
- /* configuration files */
-
- /*************************************************************************
- *
- * @macro:
- * FT_CONFIG_CONFIG_H
- *
- * @description:
- * A macro used in #include statements to name the file containing
- * FreeType~2 configuration data.
- *
- */
-#ifndef FT_CONFIG_CONFIG_H
-#define FT_CONFIG_CONFIG_H <freetype/config/ftconfig.h>
-#endif
-
-
- /*************************************************************************
- *
- * @macro:
- * FT_CONFIG_STANDARD_LIBRARY_H
- *
- * @description:
- * A macro used in #include statements to name the file containing
- * FreeType~2 interface to the standard C library functions.
- *
- */
-#ifndef FT_CONFIG_STANDARD_LIBRARY_H
-#define FT_CONFIG_STANDARD_LIBRARY_H <freetype/config/ftstdlib.h>
-#endif
-
-
- /*************************************************************************
- *
- * @macro:
- * FT_CONFIG_OPTIONS_H
- *
- * @description:
- * A macro used in #include statements to name the file containing
- * FreeType~2 project-specific configuration options.
- *
- */
-#ifndef FT_CONFIG_OPTIONS_H
-#define FT_CONFIG_OPTIONS_H <freetype/config/ftoption.h>
-#endif
-
-
- /*************************************************************************
- *
- * @macro:
- * FT_CONFIG_MODULES_H
- *
- * @description:
- * A macro used in #include statements to name the file containing the
- * list of FreeType~2 modules that are statically linked to new library
- * instances in @FT_Init_FreeType.
- *
- */
-#ifndef FT_CONFIG_MODULES_H
-#define FT_CONFIG_MODULES_H <freetype/config/ftmodule.h>
-#endif
-
- /* */
-
- /* public headers */
-
- /*************************************************************************
- *
- * @macro:
- * FT_FREETYPE_H
- *
- * @description:
- * A macro used in #include statements to name the file containing the
- * base FreeType~2 API.
- *
- */
-#define FT_FREETYPE_H <freetype/freetype.h>
-
-
- /*************************************************************************
- *
- * @macro:
- * FT_ERRORS_H
- *
- * @description:
- * A macro used in #include statements to name the file containing the
- * list of FreeType~2 error codes (and messages).
- *
- * It is included by @FT_FREETYPE_H.
- *
- */
-#define FT_ERRORS_H <freetype/fterrors.h>
-
-
- /*************************************************************************
- *
- * @macro:
- * FT_MODULE_ERRORS_H
- *
- * @description:
- * A macro used in #include statements to name the file containing the
- * list of FreeType~2 module error offsets (and messages).
- *
- */
-#define FT_MODULE_ERRORS_H <freetype/ftmoderr.h>
-
-
- /*************************************************************************
- *
- * @macro:
- * FT_SYSTEM_H
- *
- * @description:
- * A macro used in #include statements to name the file containing the
- * FreeType~2 interface to low-level operations (i.e., memory management
- * and stream i/o).
- *
- * It is included by @FT_FREETYPE_H.
- *
- */
-#define FT_SYSTEM_H <freetype/ftsystem.h>
-
-
- /*************************************************************************
- *
- * @macro:
- * FT_IMAGE_H
- *
- * @description:
- * A macro used in #include statements to name the file containing type
- * definitions related to glyph images (i.e., bitmaps, outlines,
- * scan-converter parameters).
- *
- * It is included by @FT_FREETYPE_H.
- *
- */
-#define FT_IMAGE_H <freetype/ftimage.h>
-
-
- /*************************************************************************
- *
- * @macro:
- * FT_TYPES_H
- *
- * @description:
- * A macro used in #include statements to name the file containing the
- * basic data types defined by FreeType~2.
- *
- * It is included by @FT_FREETYPE_H.
- *
- */
-#define FT_TYPES_H <freetype/fttypes.h>
-
-
- /*************************************************************************
- *
- * @macro:
- * FT_LIST_H
- *
- * @description:
- * A macro used in #include statements to name the file containing the
- * list management API of FreeType~2.
- *
- * (Most applications will never need to include this file.)
- *
- */
-#define FT_LIST_H <freetype/ftlist.h>
-
-
- /*************************************************************************
- *
- * @macro:
- * FT_OUTLINE_H
- *
- * @description:
- * A macro used in #include statements to name the file containing the
- * scalable outline management API of FreeType~2.
- *
- */
-#define FT_OUTLINE_H <freetype/ftoutln.h>
-
-
- /*************************************************************************
- *
- * @macro:
- * FT_SIZES_H
- *
- * @description:
- * A macro used in #include statements to name the file containing the
- * API which manages multiple @FT_Size objects per face.
- *
- */
-#define FT_SIZES_H <freetype/ftsizes.h>
-
-
- /*************************************************************************
- *
- * @macro:
- * FT_MODULE_H
- *
- * @description:
- * A macro used in #include statements to name the file containing the
- * module management API of FreeType~2.
- *
- */
-#define FT_MODULE_H <freetype/ftmodapi.h>
-
-
- /*************************************************************************
- *
- * @macro:
- * FT_RENDER_H
- *
- * @description:
- * A macro used in #include statements to name the file containing the
- * renderer module management API of FreeType~2.
- *
- */
-#define FT_RENDER_H <freetype/ftrender.h>
-
-
- /*************************************************************************
- *
- * @macro:
- * FT_AUTOHINTER_H
- *
- * @description:
- * A macro used in #include statements to name the file containing
- * structures and macros related to the auto-hinting module.
- *
- */
-#define FT_AUTOHINTER_H <freetype/ftautoh.h>
-
-
- /*************************************************************************
- *
- * @macro:
- * FT_CFF_DRIVER_H
- *
- * @description:
- * A macro used in #include statements to name the file containing
- * structures and macros related to the CFF driver module.
- *
- */
-#define FT_CFF_DRIVER_H <freetype/ftcffdrv.h>
-
-
- /*************************************************************************
- *
- * @macro:
- * FT_TRUETYPE_DRIVER_H
- *
- * @description:
- * A macro used in #include statements to name the file containing
- * structures and macros related to the TrueType driver module.
- *
- */
-#define FT_TRUETYPE_DRIVER_H <freetype/ftttdrv.h>
-
-
- /*************************************************************************
- *
- * @macro:
- * FT_TYPE1_TABLES_H
- *
- * @description:
- * A macro used in #include statements to name the file containing the
- * types and API specific to the Type~1 format.
- *
- */
-#define FT_TYPE1_TABLES_H <freetype/t1tables.h>
-
-
- /*************************************************************************
- *
- * @macro:
- * FT_TRUETYPE_IDS_H
- *
- * @description:
- * A macro used in #include statements to name the file containing the
- * enumeration values which identify name strings, languages, encodings,
- * etc. This file really contains a _large_ set of constant macro
- * definitions, taken from the TrueType and OpenType specifications.
- *
- */
-#define FT_TRUETYPE_IDS_H <freetype/ttnameid.h>
-
-
- /*************************************************************************
- *
- * @macro:
- * FT_TRUETYPE_TABLES_H
- *
- * @description:
- * A macro used in #include statements to name the file containing the
- * types and API specific to the TrueType (as well as OpenType) format.
- *
- */
-#define FT_TRUETYPE_TABLES_H <freetype/tttables.h>
-
-
- /*************************************************************************
- *
- * @macro:
- * FT_TRUETYPE_TAGS_H
- *
- * @description:
- * A macro used in #include statements to name the file containing the
- * definitions of TrueType four-byte `tags' which identify blocks in
- * SFNT-based font formats (i.e., TrueType and OpenType).
- *
- */
-#define FT_TRUETYPE_TAGS_H <freetype/tttags.h>
-
-
- /*************************************************************************
- *
- * @macro:
- * FT_BDF_H
- *
- * @description:
- * A macro used in #include statements to name the file containing the
- * definitions of an API which accesses BDF-specific strings from a
- * face.
- *
- */
-#define FT_BDF_H <freetype/ftbdf.h>
-
-
- /*************************************************************************
- *
- * @macro:
- * FT_CID_H
- *
- * @description:
- * A macro used in #include statements to name the file containing the
- * definitions of an API which access CID font information from a
- * face.
- *
- */
-#define FT_CID_H <freetype/ftcid.h>
-
-
- /*************************************************************************
- *
- * @macro:
- * FT_GZIP_H
- *
- * @description:
- * A macro used in #include statements to name the file containing the
- * definitions of an API which supports gzip-compressed files.
- *
- */
-#define FT_GZIP_H <freetype/ftgzip.h>
-
-
- /*************************************************************************
- *
- * @macro:
- * FT_LZW_H
- *
- * @description:
- * A macro used in #include statements to name the file containing the
- * definitions of an API which supports LZW-compressed files.
- *
- */
-#define FT_LZW_H <freetype/ftlzw.h>
-
-
- /*************************************************************************
- *
- * @macro:
- * FT_BZIP2_H
- *
- * @description:
- * A macro used in #include statements to name the file containing the
- * definitions of an API which supports bzip2-compressed files.
- *
- */
-#define FT_BZIP2_H <freetype/ftbzip2.h>
-
-
- /*************************************************************************
- *
- * @macro:
- * FT_WINFONTS_H
- *
- * @description:
- * A macro used in #include statements to name the file containing the
- * definitions of an API which supports Windows FNT files.
- *
- */
-#define FT_WINFONTS_H <freetype/ftwinfnt.h>
-
-
- /*************************************************************************
- *
- * @macro:
- * FT_GLYPH_H
- *
- * @description:
- * A macro used in #include statements to name the file containing the
- * API of the optional glyph management component.
- *
- */
-#define FT_GLYPH_H <freetype/ftglyph.h>
-
-
- /*************************************************************************
- *
- * @macro:
- * FT_BITMAP_H
- *
- * @description:
- * A macro used in #include statements to name the file containing the
- * API of the optional bitmap conversion component.
- *
- */
-#define FT_BITMAP_H <freetype/ftbitmap.h>
-
-
- /*************************************************************************
- *
- * @macro:
- * FT_BBOX_H
- *
- * @description:
- * A macro used in #include statements to name the file containing the
- * API of the optional exact bounding box computation routines.
- *
- */
-#define FT_BBOX_H <freetype/ftbbox.h>
-
-
- /*************************************************************************
- *
- * @macro:
- * FT_CACHE_H
- *
- * @description:
- * A macro used in #include statements to name the file containing the
- * API of the optional FreeType~2 cache sub-system.
- *
- */
-#define FT_CACHE_H <freetype/ftcache.h>
-
-
- /*************************************************************************
- *
- * @macro:
- * FT_CACHE_IMAGE_H
- *
- * @description:
- * A macro used in #include statements to name the file containing the
- * `glyph image' API of the FreeType~2 cache sub-system.
- *
- * It is used to define a cache for @FT_Glyph elements. You can also
- * use the API defined in @FT_CACHE_SMALL_BITMAPS_H if you only need to
- * store small glyph bitmaps, as it will use less memory.
- *
- * This macro is deprecated. Simply include @FT_CACHE_H to have all
- * glyph image-related cache declarations.
- *
- */
-#define FT_CACHE_IMAGE_H FT_CACHE_H
-
-
- /*************************************************************************
- *
- * @macro:
- * FT_CACHE_SMALL_BITMAPS_H
- *
- * @description:
- * A macro used in #include statements to name the file containing the
- * `small bitmaps' API of the FreeType~2 cache sub-system.
- *
- * It is used to define a cache for small glyph bitmaps in a relatively
- * memory-efficient way. You can also use the API defined in
- * @FT_CACHE_IMAGE_H if you want to cache arbitrary glyph images,
- * including scalable outlines.
- *
- * This macro is deprecated. Simply include @FT_CACHE_H to have all
- * small bitmaps-related cache declarations.
- *
- */
-#define FT_CACHE_SMALL_BITMAPS_H FT_CACHE_H
-
-
- /*************************************************************************
- *
- * @macro:
- * FT_CACHE_CHARMAP_H
- *
- * @description:
- * A macro used in #include statements to name the file containing the
- * `charmap' API of the FreeType~2 cache sub-system.
- *
- * This macro is deprecated. Simply include @FT_CACHE_H to have all
- * charmap-based cache declarations.
- *
- */
-#define FT_CACHE_CHARMAP_H FT_CACHE_H
-
-
- /*************************************************************************
- *
- * @macro:
- * FT_MAC_H
- *
- * @description:
- * A macro used in #include statements to name the file containing the
- * Macintosh-specific FreeType~2 API. The latter is used to access
- * fonts embedded in resource forks.
- *
- * This header file must be explicitly included by client applications
- * compiled on the Mac (note that the base API still works though).
- *
- */
-#define FT_MAC_H <freetype/ftmac.h>
-
-
- /*************************************************************************
- *
- * @macro:
- * FT_MULTIPLE_MASTERS_H
- *
- * @description:
- * A macro used in #include statements to name the file containing the
- * optional multiple-masters management API of FreeType~2.
- *
- */
-#define FT_MULTIPLE_MASTERS_H <freetype/ftmm.h>
-
-
- /*************************************************************************
- *
- * @macro:
- * FT_SFNT_NAMES_H
- *
- * @description:
- * A macro used in #include statements to name the file containing the
- * optional FreeType~2 API which accesses embedded `name' strings in
- * SFNT-based font formats (i.e., TrueType and OpenType).
- *
- */
-#define FT_SFNT_NAMES_H <freetype/ftsnames.h>
-
-
- /*************************************************************************
- *
- * @macro:
- * FT_OPENTYPE_VALIDATE_H
- *
- * @description:
- * A macro used in #include statements to name the file containing the
- * optional FreeType~2 API which validates OpenType tables (BASE, GDEF,
- * GPOS, GSUB, JSTF).
- *
- */
-#define FT_OPENTYPE_VALIDATE_H <freetype/ftotval.h>
-
-
- /*************************************************************************
- *
- * @macro:
- * FT_GX_VALIDATE_H
- *
- * @description:
- * A macro used in #include statements to name the file containing the
- * optional FreeType~2 API which validates TrueTypeGX/AAT tables (feat,
- * mort, morx, bsln, just, kern, opbd, trak, prop).
- *
- */
-#define FT_GX_VALIDATE_H <freetype/ftgxval.h>
-
-
- /*************************************************************************
- *
- * @macro:
- * FT_PFR_H
- *
- * @description:
- * A macro used in #include statements to name the file containing the
- * FreeType~2 API which accesses PFR-specific data.
- *
- */
-#define FT_PFR_H <freetype/ftpfr.h>
-
-
- /*************************************************************************
- *
- * @macro:
- * FT_STROKER_H
- *
- * @description:
- * A macro used in #include statements to name the file containing the
- * FreeType~2 API which provides functions to stroke outline paths.
- */
-#define FT_STROKER_H <freetype/ftstroke.h>
-
-
- /*************************************************************************
- *
- * @macro:
- * FT_SYNTHESIS_H
- *
- * @description:
- * A macro used in #include statements to name the file containing the
- * FreeType~2 API which performs artificial obliquing and emboldening.
- */
-#define FT_SYNTHESIS_H <freetype/ftsynth.h>
-
-
- /*************************************************************************
- *
- * @macro:
- * FT_FONT_FORMATS_H
- *
- * @description:
- * A macro used in #include statements to name the file containing the
- * FreeType~2 API which provides functions specific to font formats.
- */
-#define FT_FONT_FORMATS_H <freetype/ftfntfmt.h>
-
- /* deprecated */
-#define FT_XFREE86_H FT_FONT_FORMATS_H
-
-
- /*************************************************************************
- *
- * @macro:
- * FT_TRIGONOMETRY_H
- *
- * @description:
- * A macro used in #include statements to name the file containing the
- * FreeType~2 API which performs trigonometric computations (e.g.,
- * cosines and arc tangents).
- */
-#define FT_TRIGONOMETRY_H <freetype/fttrigon.h>
-
-
- /*************************************************************************
- *
- * @macro:
- * FT_LCD_FILTER_H
- *
- * @description:
- * A macro used in #include statements to name the file containing the
- * FreeType~2 API which performs color filtering for subpixel rendering.
- */
-#define FT_LCD_FILTER_H <freetype/ftlcdfil.h>
-
-
- /*************************************************************************
- *
- * @macro:
- * FT_UNPATENTED_HINTING_H
- *
- * @description:
- * A macro used in #include statements to name the file containing the
- * FreeType~2 API which performs color filtering for subpixel rendering.
- */
-#define FT_UNPATENTED_HINTING_H <freetype/ttunpat.h>
-
-
- /*************************************************************************
- *
- * @macro:
- * FT_INCREMENTAL_H
- *
- * @description:
- * A macro used in #include statements to name the file containing the
- * FreeType~2 API which performs color filtering for subpixel rendering.
- */
-#define FT_INCREMENTAL_H <freetype/ftincrem.h>
-
-
- /*************************************************************************
- *
- * @macro:
- * FT_GASP_H
- *
- * @description:
- * A macro used in #include statements to name the file containing the
- * FreeType~2 API which returns entries from the TrueType GASP table.
- */
-#define FT_GASP_H <freetype/ftgasp.h>
-
-
- /*************************************************************************
- *
- * @macro:
- * FT_ADVANCES_H
- *
- * @description:
- * A macro used in #include statements to name the file containing the
- * FreeType~2 API which returns individual and ranged glyph advances.
- */
-#define FT_ADVANCES_H <freetype/ftadvanc.h>
-
-
- /* */
-
-#define FT_ERROR_DEFINITIONS_H <freetype/fterrdef.h>
-
-
- /* The internals of the cache sub-system are no longer exposed. We */
- /* default to FT_CACHE_H at the moment just in case, but we know of */
- /* no rogue client that uses them. */
- /* */
-#define FT_CACHE_MANAGER_H <freetype/ftcache.h>
-#define FT_CACHE_INTERNAL_MRU_H <freetype/ftcache.h>
-#define FT_CACHE_INTERNAL_MANAGER_H <freetype/ftcache.h>
-#define FT_CACHE_INTERNAL_CACHE_H <freetype/ftcache.h>
-#define FT_CACHE_INTERNAL_GLYPH_H <freetype/ftcache.h>
-#define FT_CACHE_INTERNAL_IMAGE_H <freetype/ftcache.h>
-#define FT_CACHE_INTERNAL_SBITS_H <freetype/ftcache.h>
-
-
-#define FT_INCREMENTAL_H <freetype/ftincrem.h>
-
-#define FT_TRUETYPE_UNPATENTED_H <freetype/ttunpat.h>
-
-
- /*
- * Include internal headers definitions from <internal/...>
- * only when building the library.
- */
-#ifdef FT2_BUILD_LIBRARY
-#define FT_INTERNAL_INTERNAL_H <freetype/internal/internal.h>
-#include FT_INTERNAL_INTERNAL_H
-#endif /* FT2_BUILD_LIBRARY */
-
-
-#endif /* __FT2_BUILD_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/config/ftmodule.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/config/ftmodule.h
deleted file mode 100644
index fb255743a7d..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/config/ftmodule.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftmodule.h */
-/* */
-/* FreeType modules public interface (specification). */
-/* */
-/* Copyright 1996-2001, 2002, 2003 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-/*
- * This file registers the FreeType modules compiled into the library.
- *
- * If you use GNU make, this file IS NOT USED! Instead, it is created in
- * the objects directory (normally `<topdir>/objs/') based on information
- * from `<topdir>/modules.cfg'.
- *
- * Please read `docs/INSTALL.ANY' and `docs/CUSTOMIZE' how to compile
- * FreeType without GNU make.
- *
- */
-
-//FT_USE_MODULE( FT_Module_Class, autofit_module_class )
-FT_USE_MODULE( FT_Driver_ClassRec, tt_driver_class )
-FT_USE_MODULE( FT_Driver_ClassRec, t1_driver_class )
-FT_USE_MODULE( FT_Driver_ClassRec, cff_driver_class )
-FT_USE_MODULE( FT_Driver_ClassRec, t1cid_driver_class )
-//FT_USE_MODULE( FT_Driver_ClassRec, pfr_driver_class )
-//FT_USE_MODULE( FT_Driver_ClassRec, t42_driver_class )
-//FT_USE_MODULE( FT_Driver_ClassRec, winfnt_driver_class )
-//FT_USE_MODULE( FT_Driver_ClassRec, pcf_driver_class )
-FT_USE_MODULE( FT_Module_Class, psaux_module_class )
-FT_USE_MODULE( FT_Module_Class, psnames_module_class )
-FT_USE_MODULE( FT_Module_Class, pshinter_module_class )
-FT_USE_MODULE( FT_Renderer_Class, ft_raster1_renderer_class )
-FT_USE_MODULE( FT_Module_Class, sfnt_module_class )
-FT_USE_MODULE( FT_Renderer_Class, ft_smooth_renderer_class )
-FT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcd_renderer_class )
-FT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcdv_renderer_class )
-//FT_USE_MODULE( FT_Driver_ClassRec, bdf_driver_class )
-
-/* EOF */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/config/ftoption.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/config/ftoption.h
deleted file mode 100644
index 886e64e9bfa..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/config/ftoption.h
+++ /dev/null
@@ -1,886 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftoption.h */
-/* */
-/* User-selectable configuration macros (specification only). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __FTOPTION_H__
-#define __FTOPTION_H__
-
-
-#include <ft2build.h>
-
-
-FT_BEGIN_HEADER
-
- /*************************************************************************/
- /* */
- /* USER-SELECTABLE CONFIGURATION MACROS */
- /* */
- /* This file contains the default configuration macro definitions for */
- /* a standard build of the FreeType library. There are three ways to */
- /* use this file to build project-specific versions of the library: */
- /* */
- /* - You can modify this file by hand, but this is not recommended in */
- /* cases where you would like to build several versions of the */
- /* library from a single source directory. */
- /* */
- /* - You can put a copy of this file in your build directory, more */
- /* precisely in `$BUILD/freetype/config/ftoption.h', where `$BUILD' */
- /* is the name of a directory that is included _before_ the FreeType */
- /* include path during compilation. */
- /* */
- /* The default FreeType Makefiles and Jamfiles use the build */
- /* directory `builds/<system>' by default, but you can easily change */
- /* that for your own projects. */
- /* */
- /* - Copy the file <ft2build.h> to `$BUILD/ft2build.h' and modify it */
- /* slightly to pre-define the macro FT_CONFIG_OPTIONS_H used to */
- /* locate this file during the build. For example, */
- /* */
- /* #define FT_CONFIG_OPTIONS_H <myftoptions.h> */
- /* #include <freetype/config/ftheader.h> */
- /* */
- /* will use `$BUILD/myftoptions.h' instead of this file for macro */
- /* definitions. */
- /* */
- /* Note also that you can similarly pre-define the macro */
- /* FT_CONFIG_MODULES_H used to locate the file listing of the modules */
- /* that are statically linked to the library at compile time. By */
- /* default, this file is <freetype/config/ftmodule.h>. */
- /* */
- /* We highly recommend using the third method whenever possible. */
- /* */
- /*************************************************************************/
-
-
- /*************************************************************************/
- /*************************************************************************/
- /**** ****/
- /**** G E N E R A L F R E E T Y P E 2 C O N F I G U R A T I O N ****/
- /**** ****/
- /*************************************************************************/
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* Uncomment the line below if you want to activate sub-pixel rendering */
- /* (a.k.a. LCD rendering, or ClearType) in this build of the library. */
- /* */
- /* Note that this feature is covered by several Microsoft patents */
- /* and should not be activated in any default build of the library. */
- /* */
- /* This macro has no impact on the FreeType API, only on its */
- /* _implementation_. For example, using FT_RENDER_MODE_LCD when calling */
- /* FT_Render_Glyph still generates a bitmap that is 3 times wider than */
- /* the original size in case this macro isn't defined; however, each */
- /* triplet of subpixels has R=G=B. */
- /* */
- /* This is done to allow FreeType clients to run unmodified, forcing */
- /* them to display normal gray-level anti-aliased glyphs. */
- /* */
-#define FT_CONFIG_OPTION_SUBPIXEL_RENDERING
-
-
- /*************************************************************************/
- /* */
- /* Many compilers provide a non-ANSI 64-bit data type that can be used */
- /* by FreeType to speed up some computations. However, this will create */
- /* some problems when compiling the library in strict ANSI mode. */
- /* */
- /* For this reason, the use of 64-bit integers is normally disabled when */
- /* the __STDC__ macro is defined. You can however disable this by */
- /* defining the macro FT_CONFIG_OPTION_FORCE_INT64 here. */
- /* */
- /* For most compilers, this will only create compilation warnings when */
- /* building the library. */
- /* */
- /* ObNote: The compiler-specific 64-bit integers are detected in the */
- /* file `ftconfig.h' either statically or through the */
- /* `configure' script on supported platforms. */
- /* */
-#undef FT_CONFIG_OPTION_FORCE_INT64
-
-
- /*************************************************************************/
- /* */
- /* If this macro is defined, do not try to use an assembler version of */
- /* performance-critical functions (e.g. FT_MulFix). You should only do */
- /* that to verify that the assembler function works properly, or to */
- /* execute benchmark tests of the various implementations. */
-/* #define FT_CONFIG_OPTION_NO_ASSEMBLER */
-
-
- /*************************************************************************/
- /* */
- /* If this macro is defined, try to use an inlined assembler version of */
- /* the `FT_MulFix' function, which is a `hotspot' when loading and */
- /* hinting glyphs, and which should be executed as fast as possible. */
- /* */
- /* Note that if your compiler or CPU is not supported, this will default */
- /* to the standard and portable implementation found in `ftcalc.c'. */
- /* */
-#define FT_CONFIG_OPTION_INLINE_MULFIX
-
-
- /*************************************************************************/
- /* */
- /* LZW-compressed file support. */
- /* */
- /* FreeType now handles font files that have been compressed with the */
- /* `compress' program. This is mostly used to parse many of the PCF */
- /* files that come with various X11 distributions. The implementation */
- /* uses NetBSD's `zopen' to partially uncompress the file on the fly */
- /* (see src/lzw/ftgzip.c). */
- /* */
- /* Define this macro if you want to enable this `feature'. */
- /* */
-#define FT_CONFIG_OPTION_USE_LZW
-
-
- /*************************************************************************/
- /* */
- /* Gzip-compressed file support. */
- /* */
- /* FreeType now handles font files that have been compressed with the */
- /* `gzip' program. This is mostly used to parse many of the PCF files */
- /* that come with XFree86. The implementation uses `zlib' to */
- /* partially uncompress the file on the fly (see src/gzip/ftgzip.c). */
- /* */
- /* Define this macro if you want to enable this `feature'. See also */
- /* the macro FT_CONFIG_OPTION_SYSTEM_ZLIB below. */
- /* */
-//#define FT_CONFIG_OPTION_USE_ZLIB
-
-
- /*************************************************************************/
- /* */
- /* ZLib library selection */
- /* */
- /* This macro is only used when FT_CONFIG_OPTION_USE_ZLIB is defined. */
- /* It allows FreeType's `ftgzip' component to link to the system's */
- /* installation of the ZLib library. This is useful on systems like */
- /* Unix or VMS where it generally is already available. */
- /* */
- /* If you let it undefined, the component will use its own copy */
- /* of the zlib sources instead. These have been modified to be */
- /* included directly within the component and *not* export external */
- /* function names. This allows you to link any program with FreeType */
- /* _and_ ZLib without linking conflicts. */
- /* */
- /* Do not #undef this macro here since the build system might define */
- /* it for certain configurations only. */
- /* */
-/* #define FT_CONFIG_OPTION_SYSTEM_ZLIB */
-
-
- /*************************************************************************/
- /* */
- /* Bzip2-compressed file support. */
- /* */
- /* FreeType now handles font files that have been compressed with the */
- /* `bzip2' program. This is mostly used to parse many of the PCF */
- /* files that come with XFree86. The implementation uses `libbz2' to */
- /* partially uncompress the file on the fly (see src/bzip2/ftbzip2.c). */
- /* Contrary to gzip, bzip2 currently is not included and need to use */
- /* the system available bzip2 implementation. */
- /* */
- /* Define this macro if you want to enable this `feature'. */
- /* */
-/* #define FT_CONFIG_OPTION_USE_BZIP2 */
-
-
- /*************************************************************************/
- /* */
- /* Define to disable the use of file stream functions and types, FILE, */
- /* fopen() etc. Enables the use of smaller system libraries on embedded */
- /* systems that have multiple system libraries, some with or without */
- /* file stream support, in the cases where file stream support is not */
- /* necessary such as memory loading of font files. */
- /* */
-/* #define FT_CONFIG_OPTION_DISABLE_STREAM_SUPPORT */
-
-
- /*************************************************************************/
- /* */
- /* PNG bitmap support. */
- /* */
- /* FreeType now handles loading color bitmap glyphs in the PNG format. */
- /* This requires help from the external libpng library. Uncompressed */
- /* color bitmaps do not need any external libraries and will be */
- /* supported regardless of this configuration. */
- /* */
- /* Define this macro if you want to enable this `feature'. */
- /* */
-/* #define FT_CONFIG_OPTION_USE_PNG */
-
-
- /*************************************************************************/
- /* */
- /* HarfBuzz support. */
- /* */
- /* FreeType uses the HarfBuzz library to improve auto-hinting of */
- /* OpenType fonts. If available, many glyphs not directly addressable */
- /* by a font's character map will be hinted also. */
- /* */
- /* Define this macro if you want to enable this `feature'. */
- /* */
-/* #define FT_CONFIG_OPTION_USE_HARFBUZZ */
-
-
- /*************************************************************************/
- /* */
- /* DLL export compilation */
- /* */
- /* When compiling FreeType as a DLL, some systems/compilers need a */
- /* special keyword in front OR after the return type of function */
- /* declarations. */
- /* */
- /* Two macros are used within the FreeType source code to define */
- /* exported library functions: FT_EXPORT and FT_EXPORT_DEF. */
- /* */
- /* FT_EXPORT( return_type ) */
- /* */
- /* is used in a function declaration, as in */
- /* */
- /* FT_EXPORT( FT_Error ) */
- /* FT_Init_FreeType( FT_Library* alibrary ); */
- /* */
- /* */
- /* FT_EXPORT_DEF( return_type ) */
- /* */
- /* is used in a function definition, as in */
- /* */
- /* FT_EXPORT_DEF( FT_Error ) */
- /* FT_Init_FreeType( FT_Library* alibrary ) */
- /* { */
- /* ... some code ... */
- /* return FT_Err_Ok; */
- /* } */
- /* */
- /* You can provide your own implementation of FT_EXPORT and */
- /* FT_EXPORT_DEF here if you want. If you leave them undefined, they */
- /* will be later automatically defined as `extern return_type' to */
- /* allow normal compilation. */
- /* */
- /* Do not #undef these macros here since the build system might define */
- /* them for certain configurations only. */
- /* */
-/* #define FT_EXPORT(x) extern x */
-/* #define FT_EXPORT_DEF(x) x */
-
-
- /*************************************************************************/
- /* */
- /* Glyph Postscript Names handling */
- /* */
- /* By default, FreeType 2 is compiled with the `psnames' module. This */
- /* module is in charge of converting a glyph name string into a */
- /* Unicode value, or return a Macintosh standard glyph name for the */
- /* use with the TrueType `post' table. */
- /* */
- /* Undefine this macro if you do not want `psnames' compiled in your */
- /* build of FreeType. This has the following effects: */
- /* */
- /* - The TrueType driver will provide its own set of glyph names, */
- /* if you build it to support postscript names in the TrueType */
- /* `post' table. */
- /* */
- /* - The Type 1 driver will not be able to synthesize a Unicode */
- /* charmap out of the glyphs found in the fonts. */
- /* */
- /* You would normally undefine this configuration macro when building */
- /* a version of FreeType that doesn't contain a Type 1 or CFF driver. */
- /* */
-#define FT_CONFIG_OPTION_POSTSCRIPT_NAMES
-
-
- /*************************************************************************/
- /* */
- /* Postscript Names to Unicode Values support */
- /* */
- /* By default, FreeType 2 is built with the `PSNames' module compiled */
- /* in. Among other things, the module is used to convert a glyph name */
- /* into a Unicode value. This is especially useful in order to */
- /* synthesize on the fly a Unicode charmap from the CFF/Type 1 driver */
- /* through a big table named the `Adobe Glyph List' (AGL). */
- /* */
- /* Undefine this macro if you do not want the Adobe Glyph List */
- /* compiled in your `PSNames' module. The Type 1 driver will not be */
- /* able to synthesize a Unicode charmap out of the glyphs found in the */
- /* fonts. */
- /* */
-#define FT_CONFIG_OPTION_ADOBE_GLYPH_LIST
-
-
- /*************************************************************************/
- /* */
- /* Support for Mac fonts */
- /* */
- /* Define this macro if you want support for outline fonts in Mac */
- /* format (mac dfont, mac resource, macbinary containing a mac */
- /* resource) on non-Mac platforms. */
- /* */
- /* Note that the `FOND' resource isn't checked. */
- /* */
-#undef FT_CONFIG_OPTION_MAC_FONTS
-
-
- /*************************************************************************/
- /* */
- /* Guessing methods to access embedded resource forks */
- /* */
- /* Enable extra Mac fonts support on non-Mac platforms (e.g. */
- /* GNU/Linux). */
- /* */
- /* Resource forks which include fonts data are stored sometimes in */
- /* locations which users or developers don't expected. In some cases, */
- /* resource forks start with some offset from the head of a file. In */
- /* other cases, the actual resource fork is stored in file different */
- /* from what the user specifies. If this option is activated, */
- /* FreeType tries to guess whether such offsets or different file */
- /* names must be used. */
- /* */
- /* Note that normal, direct access of resource forks is controlled via */
- /* the FT_CONFIG_OPTION_MAC_FONTS option. */
- /* */
-#ifdef FT_CONFIG_OPTION_MAC_FONTS
-#define FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK
-#endif
-
-
- /*************************************************************************/
- /* */
- /* Allow the use of FT_Incremental_Interface to load typefaces that */
- /* contain no glyph data, but supply it via a callback function. */
- /* This is required by clients supporting document formats which */
- /* supply font data incrementally as the document is parsed, such */
- /* as the Ghostscript interpreter for the PostScript language. */
- /* */
-#define FT_CONFIG_OPTION_INCREMENTAL
-
-
- /*************************************************************************/
- /* */
- /* The size in bytes of the render pool used by the scan-line converter */
- /* to do all of its work. */
- /* */
-#define FT_RENDER_POOL_SIZE 16384L
-
-
- /*************************************************************************/
- /* */
- /* FT_MAX_MODULES */
- /* */
- /* The maximum number of modules that can be registered in a single */
- /* FreeType library object. 32 is the default. */
- /* */
-#define FT_MAX_MODULES 32
-
-
- /*************************************************************************/
- /* */
- /* Debug level */
- /* */
- /* FreeType can be compiled in debug or trace mode. In debug mode, */
- /* errors are reported through the `ftdebug' component. In trace */
- /* mode, additional messages are sent to the standard output during */
- /* execution. */
- /* */
- /* Define FT_DEBUG_LEVEL_ERROR to build the library in debug mode. */
- /* Define FT_DEBUG_LEVEL_TRACE to build it in trace mode. */
- /* */
- /* Don't define any of these macros to compile in `release' mode! */
- /* */
- /* Do not #undef these macros here since the build system might define */
- /* them for certain configurations only. */
- /* */
-/* #define FT_DEBUG_LEVEL_ERROR */
-/* #define FT_DEBUG_LEVEL_TRACE */
-
-
- /*************************************************************************/
- /* */
- /* Autofitter debugging */
- /* */
- /* If FT_DEBUG_AUTOFIT is defined, FreeType provides some means to */
- /* control the autofitter behaviour for debugging purposes with global */
- /* boolean variables (consequently, you should *never* enable this */
- /* while compiling in `release' mode): */
- /* */
- /* _af_debug_disable_horz_hints */
- /* _af_debug_disable_vert_hints */
- /* _af_debug_disable_blue_hints */
- /* */
- /* Additionally, the following functions provide dumps of various */
- /* internal autofit structures to stdout (using `printf'): */
- /* */
- /* af_glyph_hints_dump_points */
- /* af_glyph_hints_dump_segments */
- /* af_glyph_hints_dump_edges */
- /* af_glyph_hints_get_num_segments */
- /* af_glyph_hints_get_segment_offset */
- /* */
- /* As an argument, they use another global variable: */
- /* */
- /* _af_debug_hints */
- /* */
- /* Please have a look at the `ftgrid' demo program to see how those */
- /* variables and macros should be used. */
- /* */
- /* Do not #undef these macros here since the build system might define */
- /* them for certain configurations only. */
- /* */
-/* #define FT_DEBUG_AUTOFIT */
-
-
- /*************************************************************************/
- /* */
- /* Memory Debugging */
- /* */
- /* FreeType now comes with an integrated memory debugger that is */
- /* capable of detecting simple errors like memory leaks or double */
- /* deletes. To compile it within your build of the library, you */
- /* should define FT_DEBUG_MEMORY here. */
- /* */
- /* Note that the memory debugger is only activated at runtime when */
- /* when the _environment_ variable `FT2_DEBUG_MEMORY' is defined also! */
- /* */
- /* Do not #undef this macro here since the build system might define */
- /* it for certain configurations only. */
- /* */
-/* #define FT_DEBUG_MEMORY */
-
-
- /*************************************************************************/
- /* */
- /* Module errors */
- /* */
- /* If this macro is set (which is _not_ the default), the higher byte */
- /* of an error code gives the module in which the error has occurred, */
- /* while the lower byte is the real error code. */
- /* */
- /* Setting this macro makes sense for debugging purposes only, since */
- /* it would break source compatibility of certain programs that use */
- /* FreeType 2. */
- /* */
- /* More details can be found in the files ftmoderr.h and fterrors.h. */
- /* */
-#undef FT_CONFIG_OPTION_USE_MODULE_ERRORS
-
-
- /*************************************************************************/
- /* */
- /* Position Independent Code */
- /* */
- /* If this macro is set (which is _not_ the default), FreeType2 will */
- /* avoid creating constants that require address fixups. Instead the */
- /* constants will be moved into a struct and additional intialization */
- /* code will be used. */
- /* */
- /* Setting this macro is needed for systems that prohibit address */
- /* fixups, such as BREW. */
- /* */
-/* #define FT_CONFIG_OPTION_PIC */
-
-
- /*************************************************************************/
- /*************************************************************************/
- /**** ****/
- /**** S F N T D R I V E R C O N F I G U R A T I O N ****/
- /**** ****/
- /*************************************************************************/
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* Define TT_CONFIG_OPTION_EMBEDDED_BITMAPS if you want to support */
- /* embedded bitmaps in all formats using the SFNT module (namely */
- /* TrueType & OpenType). */
- /* */
-#undef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
-
-
- /*************************************************************************/
- /* */
- /* Define TT_CONFIG_OPTION_POSTSCRIPT_NAMES if you want to be able to */
- /* load and enumerate the glyph Postscript names in a TrueType or */
- /* OpenType file. */
- /* */
- /* Note that when you do not compile the `PSNames' module by undefining */
- /* the above FT_CONFIG_OPTION_POSTSCRIPT_NAMES, the `sfnt' module will */
- /* contain additional code used to read the PS Names table from a font. */
- /* */
- /* (By default, the module uses `PSNames' to extract glyph names.) */
- /* */
-#define TT_CONFIG_OPTION_POSTSCRIPT_NAMES
-
-
- /*************************************************************************/
- /* */
- /* Define TT_CONFIG_OPTION_SFNT_NAMES if your applications need to */
- /* access the internal name table in a SFNT-based format like TrueType */
- /* or OpenType. The name table contains various strings used to */
- /* describe the font, like family name, copyright, version, etc. It */
- /* does not contain any glyph name though. */
- /* */
- /* Accessing SFNT names is done through the functions declared in */
- /* `ftsnames.h'. */
- /* */
-#define TT_CONFIG_OPTION_SFNT_NAMES
-
-
- /*************************************************************************/
- /* */
- /* TrueType CMap support */
- /* */
- /* Here you can fine-tune which TrueType CMap table format shall be */
- /* supported. */
-#define TT_CONFIG_CMAP_FORMAT_0
-#define TT_CONFIG_CMAP_FORMAT_2
-#define TT_CONFIG_CMAP_FORMAT_4
-#define TT_CONFIG_CMAP_FORMAT_6
-#define TT_CONFIG_CMAP_FORMAT_8
-#define TT_CONFIG_CMAP_FORMAT_10
-#define TT_CONFIG_CMAP_FORMAT_12
-#define TT_CONFIG_CMAP_FORMAT_13
-#define TT_CONFIG_CMAP_FORMAT_14
-
-
- /*************************************************************************/
- /*************************************************************************/
- /**** ****/
- /**** T R U E T Y P E D R I V E R C O N F I G U R A T I O N ****/
- /**** ****/
- /*************************************************************************/
- /*************************************************************************/
-
- /*************************************************************************/
- /* */
- /* Define TT_CONFIG_OPTION_BYTECODE_INTERPRETER if you want to compile */
- /* a bytecode interpreter in the TrueType driver. */
- /* */
- /* By undefining this, you will only compile the code necessary to load */
- /* TrueType glyphs without hinting. */
- /* */
- /* Do not #undef this macro here, since the build system might */
- /* define it for certain configurations only. */
- /* */
-#define TT_CONFIG_OPTION_BYTECODE_INTERPRETER
-
-
- /*************************************************************************/
- /* */
- /* Define TT_CONFIG_OPTION_SUBPIXEL_HINTING if you want to compile */
- /* EXPERIMENTAL subpixel hinting support into the TrueType driver. This */
- /* replaces the native TrueType hinting mechanism when anything but */
- /* FT_RENDER_MODE_MONO is requested. */
- /* */
- /* Enabling this causes the TrueType driver to ignore instructions under */
- /* certain conditions. This is done in accordance with the guide here, */
- /* with some minor differences: */
- /* */
- /* http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx */
- /* */
- /* By undefining this, you only compile the code necessary to hint */
- /* TrueType glyphs with native TT hinting. */
- /* */
- /* This option requires TT_CONFIG_OPTION_BYTECODE_INTERPRETER to be */
- /* defined. */
- /* */
-/* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING */
-
-
- /*************************************************************************/
- /* */
- /* If you define TT_CONFIG_OPTION_UNPATENTED_HINTING, a special version */
- /* of the TrueType bytecode interpreter is used that doesn't implement */
- /* any of the patented opcodes and algorithms. The patents related to */
- /* TrueType hinting have expired worldwide since May 2010; this option */
- /* is now deprecated. */
- /* */
- /* Note that the TT_CONFIG_OPTION_UNPATENTED_HINTING macro is *ignored* */
- /* if you define TT_CONFIG_OPTION_BYTECODE_INTERPRETER; in other words, */
- /* either define TT_CONFIG_OPTION_BYTECODE_INTERPRETER or */
- /* TT_CONFIG_OPTION_UNPATENTED_HINTING but not both at the same time. */
- /* */
- /* This macro is only useful for a small number of font files (mostly */
- /* for Asian scripts) that require bytecode interpretation to properly */
- /* load glyphs. For all other fonts, this produces unpleasant results, */
- /* thus the unpatented interpreter is never used to load glyphs from */
- /* TrueType fonts unless one of the following two options is used. */
- /* */
- /* - The unpatented interpreter is explicitly activated by the user */
- /* through the FT_PARAM_TAG_UNPATENTED_HINTING parameter tag */
- /* when opening the FT_Face. */
- /* */
- /* - FreeType detects that the FT_Face corresponds to one of the */
- /* `trick' fonts (e.g., `Mingliu') it knows about. The font engine */
- /* contains a hard-coded list of font names and other matching */
- /* parameters (see function `tt_face_init' in file */
- /* `src/truetype/ttobjs.c'). */
- /* */
- /* Here a sample code snippet for using FT_PARAM_TAG_UNPATENTED_HINTING. */
- /* */
- /* { */
- /* FT_Parameter parameter; */
- /* FT_Open_Args open_args; */
- /* */
- /* */
- /* parameter.tag = FT_PARAM_TAG_UNPATENTED_HINTING; */
- /* */
- /* open_args.flags = FT_OPEN_PATHNAME | FT_OPEN_PARAMS; */
- /* open_args.pathname = my_font_pathname; */
- /* open_args.num_params = 1; */
- /* open_args.params = &parameter; */
- /* */
- /* error = FT_Open_Face( library, &open_args, index, &face ); */
- /* ... */
- /* } */
- /* */
-/* #define TT_CONFIG_OPTION_UNPATENTED_HINTING */
-
-
- /*************************************************************************/
- /* */
- /* Define TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED to compile the */
- /* TrueType glyph loader to use Apple's definition of how to handle */
- /* component offsets in composite glyphs. */
- /* */
- /* Apple and MS disagree on the default behavior of component offsets */
- /* in composites. Apple says that they should be scaled by the scaling */
- /* factors in the transformation matrix (roughly, it's more complex) */
- /* while MS says they should not. OpenType defines two bits in the */
- /* composite flags array which can be used to disambiguate, but old */
- /* fonts will not have them. */
- /* */
- /* http://www.microsoft.com/typography/otspec/glyf.htm */
- /* https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6glyf.html */
- /* */
-#undef TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED
-
-
- /*************************************************************************/
- /* */
- /* Define TT_CONFIG_OPTION_GX_VAR_SUPPORT if you want to include */
- /* support for Apple's distortable font technology (fvar, gvar, cvar, */
- /* and avar tables). This has many similarities to Type 1 Multiple */
- /* Masters support. */
- /* */
-#undef TT_CONFIG_OPTION_GX_VAR_SUPPORT
-
-
- /*************************************************************************/
- /* */
- /* Define TT_CONFIG_OPTION_BDF if you want to include support for */
- /* an embedded `BDF ' table within SFNT-based bitmap formats. */
- /* */
-#undef TT_CONFIG_OPTION_BDF
-
-
- /*************************************************************************/
- /*************************************************************************/
- /**** ****/
- /**** T Y P E 1 D R I V E R C O N F I G U R A T I O N ****/
- /**** ****/
- /*************************************************************************/
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* T1_MAX_DICT_DEPTH is the maximum depth of nest dictionaries and */
- /* arrays in the Type 1 stream (see t1load.c). A minimum of 4 is */
- /* required. */
- /* */
-#define T1_MAX_DICT_DEPTH 5
-
-
- /*************************************************************************/
- /* */
- /* T1_MAX_SUBRS_CALLS details the maximum number of nested sub-routine */
- /* calls during glyph loading. */
- /* */
-#define T1_MAX_SUBRS_CALLS 16
-
-
- /*************************************************************************/
- /* */
- /* T1_MAX_CHARSTRING_OPERANDS is the charstring stack's capacity. A */
- /* minimum of 16 is required. */
- /* */
- /* The Chinese font MingTiEG-Medium (CNS 11643 character set) needs 256. */
- /* */
-#define T1_MAX_CHARSTRINGS_OPERANDS 512
-
-
- /*************************************************************************/
- /* */
- /* Define this configuration macro if you want to prevent the */
- /* compilation of `t1afm', which is in charge of reading Type 1 AFM */
- /* files into an existing face. Note that if set, the T1 driver will be */
- /* unable to produce kerning distances. */
- /* */
-#undef T1_CONFIG_OPTION_NO_AFM
-
-
- /*************************************************************************/
- /* */
- /* Define this configuration macro if you want to prevent the */
- /* compilation of the Multiple Masters font support in the Type 1 */
- /* driver. */
- /* */
-#undef T1_CONFIG_OPTION_NO_MM_SUPPORT
-
-
- /*************************************************************************/
- /*************************************************************************/
- /**** ****/
- /**** C F F D R I V E R C O N F I G U R A T I O N ****/
- /**** ****/
- /*************************************************************************/
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* Using CFF_CONFIG_OPTION_DARKENING_PARAMETER_{X,Y}{1,2,3,4} it is */
- /* possible to set up the default values of the four control points that */
- /* define the stem darkening behaviour of the (new) CFF engine. For */
- /* more details please read the documentation of the */
- /* `darkening-parameters' property of the cff driver module (file */
- /* `ftcffdrv.h'), which allows the control at run-time. */
- /* */
- /* Do *not* undefine these macros! */
- /* */
-#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_X1 500
-#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y1 400
-
-#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_X2 1000
-#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y2 275
-
-#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_X3 1667
-#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y3 275
-
-#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_X4 2333
-#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y4 0
-
-
- /*************************************************************************/
- /* */
- /* CFF_CONFIG_OPTION_OLD_ENGINE controls whether the pre-Adobe CFF */
- /* engine gets compiled into FreeType. If defined, it is possible to */
- /* switch between the two engines using the `hinting-engine' property of */
- /* the cff driver module. */
- /* */
-/* #define CFF_CONFIG_OPTION_OLD_ENGINE */
-
-
- /*************************************************************************/
- /*************************************************************************/
- /**** ****/
- /**** A U T O F I T M O D U L E C O N F I G U R A T I O N ****/
- /**** ****/
- /*************************************************************************/
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* Compile autofit module with CJK (Chinese, Japanese, Korean) script */
- /* support. */
- /* */
-#define AF_CONFIG_OPTION_CJK
-
- /*************************************************************************/
- /* */
- /* Compile autofit module with Indic script support. */
- /* */
-#define AF_CONFIG_OPTION_INDIC
-
- /*************************************************************************/
- /* */
- /* Compile autofit module with warp hinting. The idea of the warping */
- /* code is to slightly scale and shift a glyph within a single dimension */
- /* so that as much of its segments are aligned (more or less) on the */
- /* grid. To find out the optimal scaling and shifting value, various */
- /* parameter combinations are tried and scored. */
- /* */
- /* This experimental option is active only if the rendering mode is */
- /* FT_RENDER_MODE_LIGHT; you can switch warping on and off with the */
- /* `warping' property of the auto-hinter (see file `ftautoh.h' for more */
- /* information; by default it is switched off). */
- /* */
-#define AF_CONFIG_OPTION_USE_WARPER
-
- /* */
-
-
- /*
- * This macro is obsolete. Support has been removed in FreeType
- * version 2.5.
- */
-/* #define FT_CONFIG_OPTION_OLD_INTERNALS */
-
-
- /*
- * This macro is defined if either unpatented or native TrueType
- * hinting is requested by the definitions above.
- */
-#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
-#define TT_USE_BYTECODE_INTERPRETER
-#undef TT_CONFIG_OPTION_UNPATENTED_HINTING
-#elif defined TT_CONFIG_OPTION_UNPATENTED_HINTING
-#define TT_USE_BYTECODE_INTERPRETER
-#endif
-
-
- /*
- * Check CFF darkening parameters. The checks are the same as in function
- * `cff_property_set' in file `cffdrivr.c'.
- */
-#if CFF_CONFIG_OPTION_DARKENING_PARAMETER_X1 < 0 || \
- CFF_CONFIG_OPTION_DARKENING_PARAMETER_X2 < 0 || \
- CFF_CONFIG_OPTION_DARKENING_PARAMETER_X3 < 0 || \
- CFF_CONFIG_OPTION_DARKENING_PARAMETER_X4 < 0 || \
- \
- CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y1 < 0 || \
- CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y2 < 0 || \
- CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y3 < 0 || \
- CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y4 < 0 || \
- \
- CFF_CONFIG_OPTION_DARKENING_PARAMETER_X1 > \
- CFF_CONFIG_OPTION_DARKENING_PARAMETER_X2 || \
- CFF_CONFIG_OPTION_DARKENING_PARAMETER_X2 > \
- CFF_CONFIG_OPTION_DARKENING_PARAMETER_X3 || \
- CFF_CONFIG_OPTION_DARKENING_PARAMETER_X3 > \
- CFF_CONFIG_OPTION_DARKENING_PARAMETER_X4 || \
- \
- CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y1 > 500 || \
- CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y2 > 500 || \
- CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y3 > 500 || \
- CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y4 > 500
-#error "Invalid CFF darkening parameters!"
-#endif
-
-FT_END_HEADER
-
-
-#endif /* __FTOPTION_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/config/ftstdlib.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/config/ftstdlib.h
deleted file mode 100644
index 4b471d4d15d..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/config/ftstdlib.h
+++ /dev/null
@@ -1,174 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftstdlib.h */
-/* */
-/* ANSI-specific library and header configuration file (specification */
-/* only). */
-/* */
-/* Copyright 2002-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* This file is used to group all #includes to the ANSI C library that */
- /* FreeType normally requires. It also defines macros to rename the */
- /* standard functions within the FreeType source code. */
- /* */
- /* Load a file which defines __FTSTDLIB_H__ before this one to override */
- /* it. */
- /* */
- /*************************************************************************/
-
-
-#ifndef __FTSTDLIB_H__
-#define __FTSTDLIB_H__
-
-
-#include <stddef.h>
-
-#define ft_ptrdiff_t ptrdiff_t
-
-
- /**********************************************************************/
- /* */
- /* integer limits */
- /* */
- /* UINT_MAX and ULONG_MAX are used to automatically compute the size */
- /* of `int' and `long' in bytes at compile-time. So far, this works */
- /* for all platforms the library has been tested on. */
- /* */
- /* Note that on the extremely rare platforms that do not provide */
- /* integer types that are _exactly_ 16 and 32 bits wide (e.g. some */
- /* old Crays where `int' is 36 bits), we do not make any guarantee */
- /* about the correct behaviour of FT2 with all fonts. */
- /* */
- /* In these case, `ftconfig.h' will refuse to compile anyway with a */
- /* message like `couldn't find 32-bit type' or something similar. */
- /* */
- /**********************************************************************/
-
-
-#include <limits.h>
-
-#define FT_CHAR_BIT CHAR_BIT
-#define FT_USHORT_MAX USHRT_MAX
-#define FT_INT_MAX INT_MAX
-#define FT_INT_MIN INT_MIN
-#define FT_UINT_MAX UINT_MAX
-#define FT_LONG_MAX LONG_MAX
-#define FT_ULONG_MAX ULONG_MAX
-
-
- /**********************************************************************/
- /* */
- /* character and string processing */
- /* */
- /**********************************************************************/
-
-
-#include <string.h>
-
-#define ft_memchr memchr
-#define ft_memcmp memcmp
-#define ft_memcpy memcpy
-#define ft_memmove memmove
-#define ft_memset memset
-#define ft_strcat strcat
-#define ft_strcmp strcmp
-#define ft_strcpy strcpy
-#define ft_strlen strlen
-#define ft_strncmp strncmp
-#define ft_strncpy strncpy
-#define ft_strrchr strrchr
-#define ft_strstr strstr
-
-
- /**********************************************************************/
- /* */
- /* file handling */
- /* */
- /**********************************************************************/
-
-
-#include <stdio.h>
-
-#define FT_FILE FILE
-#define ft_fclose fclose
-#define ft_fopen fopen
-#define ft_fread fread
-#define ft_fseek fseek
-#define ft_ftell ftell
-#define ft_sprintf sprintf
-
-
- /**********************************************************************/
- /* */
- /* sorting */
- /* */
- /**********************************************************************/
-
-
-#include <stdlib.h>
-
-#define ft_qsort qsort
-
-
- /**********************************************************************/
- /* */
- /* memory allocation */
- /* */
- /**********************************************************************/
-
-
-#define ft_scalloc calloc
-#define ft_sfree free
-#define ft_smalloc malloc
-#define ft_srealloc realloc
-
-
- /**********************************************************************/
- /* */
- /* miscellaneous */
- /* */
- /**********************************************************************/
-
-
-#define ft_atol atol
-
-
- /**********************************************************************/
- /* */
- /* execution control */
- /* */
- /**********************************************************************/
-
-
-#include <setjmp.h>
-
-#define ft_jmp_buf jmp_buf /* note: this cannot be a typedef since */
- /* jmp_buf is defined as a macro */
- /* on certain platforms */
-
-#define ft_longjmp longjmp
-#define ft_setjmp( b ) setjmp( *(ft_jmp_buf*) &(b) ) /* same thing here */
-
-
- /* the following is only used for debugging purposes, i.e., if */
- /* FT_DEBUG_LEVEL_ERROR or FT_DEBUG_LEVEL_TRACE are defined */
-
-#include <stdarg.h>
-
-
-#endif /* __FTSTDLIB_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/freetype.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/freetype.h
deleted file mode 100644
index b6247f510f0..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/freetype.h
+++ /dev/null
@@ -1,4204 +0,0 @@
-/***************************************************************************/
-/* */
-/* freetype.h */
-/* */
-/* FreeType high-level API and common types (specification only). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __FREETYPE_H__
-#define __FREETYPE_H__
-
-
-#ifndef FT_FREETYPE_H
-#error "`ft2build.h' hasn't been included yet!"
-#error "Please always use macros to include FreeType header files."
-#error "Example:"
-#error " #include <ft2build.h>"
-#error " #include FT_FREETYPE_H"
-#endif
-
-
-#include <ft2build.h>
-#include FT_CONFIG_CONFIG_H
-#include FT_TYPES_H
-#include FT_ERRORS_H
-
-
-FT_BEGIN_HEADER
-
-
-
- /*************************************************************************/
- /* */
- /* <Section> */
- /* header_inclusion */
- /* */
- /* <Title> */
- /* FreeType's header inclusion scheme */
- /* */
- /* <Abstract> */
- /* How client applications should include FreeType header files. */
- /* */
- /* <Description> */
- /* To be as flexible as possible (and for historical reasons), */
- /* FreeType uses a very special inclusion scheme to load header */
- /* files, for example */
- /* */
- /* { */
- /* #include <ft2build.h> */
- /* */
- /* #include FT_FREETYPE_H */
- /* #include FT_OUTLINE_H */
- /* } */
- /* */
- /* A compiler and its preprocessor only needs an include path to find */
- /* the file `ft2build.h'; the exact locations and names of the other */
- /* FreeType header files are hidden by preprocessor macro names, */
- /* loaded by `ft2build.h'. The API documentation always gives the */
- /* header macro name needed for a particular function. */
- /* */
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* <Section> */
- /* user_allocation */
- /* */
- /* <Title> */
- /* User allocation */
- /* */
- /* <Abstract> */
- /* How client applications should allocate FreeType data structures. */
- /* */
- /* <Description> */
- /* FreeType assumes that structures allocated by the user and passed */
- /* as arguments are zeroed out except for the actual data. In other */
- /* words, it is recommended to use `calloc' (or variants of it) */
- /* instead of `malloc' for allocation. */
- /* */
- /*************************************************************************/
-
-
-
- /*************************************************************************/
- /*************************************************************************/
- /* */
- /* B A S I C T Y P E S */
- /* */
- /*************************************************************************/
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* <Section> */
- /* base_interface */
- /* */
- /* <Title> */
- /* Base Interface */
- /* */
- /* <Abstract> */
- /* The FreeType~2 base font interface. */
- /* */
- /* <Description> */
- /* This section describes the most important public high-level API */
- /* functions of FreeType~2. */
- /* */
- /* <Order> */
- /* FT_Library */
- /* FT_Face */
- /* FT_Size */
- /* FT_GlyphSlot */
- /* FT_CharMap */
- /* FT_Encoding */
- /* FT_ENC_TAG */
- /* */
- /* FT_FaceRec */
- /* */
- /* FT_FACE_FLAG_SCALABLE */
- /* FT_FACE_FLAG_FIXED_SIZES */
- /* FT_FACE_FLAG_FIXED_WIDTH */
- /* FT_FACE_FLAG_HORIZONTAL */
- /* FT_FACE_FLAG_VERTICAL */
- /* FT_FACE_FLAG_COLOR */
- /* FT_FACE_FLAG_SFNT */
- /* FT_FACE_FLAG_CID_KEYED */
- /* FT_FACE_FLAG_TRICKY */
- /* FT_FACE_FLAG_KERNING */
- /* FT_FACE_FLAG_MULTIPLE_MASTERS */
- /* FT_FACE_FLAG_GLYPH_NAMES */
- /* FT_FACE_FLAG_EXTERNAL_STREAM */
- /* FT_FACE_FLAG_HINTER */
- /* FT_FACE_FLAG_TRICKY */
- /* */
- /* FT_HAS_HORIZONTAL */
- /* FT_HAS_VERTICAL */
- /* FT_HAS_KERNING */
- /* FT_HAS_FIXED_SIZES */
- /* FT_HAS_GLYPH_NAMES */
- /* FT_HAS_MULTIPLE_MASTERS */
- /* FT_HAS_COLOR */
- /* */
- /* FT_IS_SFNT */
- /* FT_IS_SCALABLE */
- /* FT_IS_FIXED_WIDTH */
- /* FT_IS_CID_KEYED */
- /* FT_IS_TRICKY */
- /* */
- /* FT_STYLE_FLAG_BOLD */
- /* FT_STYLE_FLAG_ITALIC */
- /* */
- /* FT_SizeRec */
- /* FT_Size_Metrics */
- /* */
- /* FT_GlyphSlotRec */
- /* FT_Glyph_Metrics */
- /* FT_SubGlyph */
- /* */
- /* FT_Bitmap_Size */
- /* */
- /* FT_Init_FreeType */
- /* FT_Done_FreeType */
- /* */
- /* FT_New_Face */
- /* FT_Done_Face */
- /* FT_Reference_Face */
- /* FT_New_Memory_Face */
- /* FT_Open_Face */
- /* FT_Open_Args */
- /* FT_Parameter */
- /* FT_Attach_File */
- /* FT_Attach_Stream */
- /* */
- /* FT_Set_Char_Size */
- /* FT_Set_Pixel_Sizes */
- /* FT_Request_Size */
- /* FT_Select_Size */
- /* FT_Size_Request_Type */
- /* FT_Size_RequestRec */
- /* FT_Size_Request */
- /* FT_Set_Transform */
- /* FT_Load_Glyph */
- /* FT_Get_Char_Index */
- /* FT_Get_First_Char */
- /* FT_Get_Next_Char */
- /* FT_Get_Name_Index */
- /* FT_Load_Char */
- /* */
- /* FT_OPEN_MEMORY */
- /* FT_OPEN_STREAM */
- /* FT_OPEN_PATHNAME */
- /* FT_OPEN_DRIVER */
- /* FT_OPEN_PARAMS */
- /* */
- /* FT_LOAD_DEFAULT */
- /* FT_LOAD_RENDER */
- /* FT_LOAD_MONOCHROME */
- /* FT_LOAD_LINEAR_DESIGN */
- /* FT_LOAD_NO_SCALE */
- /* FT_LOAD_NO_HINTING */
- /* FT_LOAD_NO_BITMAP */
- /* FT_LOAD_NO_AUTOHINT */
- /* FT_LOAD_COLOR */
- /* */
- /* FT_LOAD_VERTICAL_LAYOUT */
- /* FT_LOAD_IGNORE_TRANSFORM */
- /* FT_LOAD_FORCE_AUTOHINT */
- /* FT_LOAD_NO_RECURSE */
- /* FT_LOAD_PEDANTIC */
- /* */
- /* FT_LOAD_TARGET_NORMAL */
- /* FT_LOAD_TARGET_LIGHT */
- /* FT_LOAD_TARGET_MONO */
- /* FT_LOAD_TARGET_LCD */
- /* FT_LOAD_TARGET_LCD_V */
- /* */
- /* FT_LOAD_TARGET_MODE */
- /* */
- /* FT_Render_Glyph */
- /* FT_Render_Mode */
- /* FT_Get_Kerning */
- /* FT_Kerning_Mode */
- /* FT_Get_Track_Kerning */
- /* FT_Get_Glyph_Name */
- /* FT_Get_Postscript_Name */
- /* */
- /* FT_CharMapRec */
- /* FT_Select_Charmap */
- /* FT_Set_Charmap */
- /* FT_Get_Charmap_Index */
- /* */
- /* FT_Get_FSType_Flags */
- /* FT_Get_SubGlyph_Info */
- /* */
- /* FT_Face_Internal */
- /* FT_Size_Internal */
- /* FT_Slot_Internal */
- /* */
- /* FT_FACE_FLAG_XXX */
- /* FT_STYLE_FLAG_XXX */
- /* FT_OPEN_XXX */
- /* FT_LOAD_XXX */
- /* FT_LOAD_TARGET_XXX */
- /* FT_SUBGLYPH_FLAG_XXX */
- /* FT_FSTYPE_XXX */
- /* */
- /* FT_HAS_FAST_GLYPHS */
- /* */
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* FT_Glyph_Metrics */
- /* */
- /* <Description> */
- /* A structure used to model the metrics of a single glyph. The */
- /* values are expressed in 26.6 fractional pixel format; if the flag */
- /* @FT_LOAD_NO_SCALE has been used while loading the glyph, values */
- /* are expressed in font units instead. */
- /* */
- /* <Fields> */
- /* width :: */
- /* The glyph's width. */
- /* */
- /* height :: */
- /* The glyph's height. */
- /* */
- /* horiBearingX :: */
- /* Left side bearing for horizontal layout. */
- /* */
- /* horiBearingY :: */
- /* Top side bearing for horizontal layout. */
- /* */
- /* horiAdvance :: */
- /* Advance width for horizontal layout. */
- /* */
- /* vertBearingX :: */
- /* Left side bearing for vertical layout. */
- /* */
- /* vertBearingY :: */
- /* Top side bearing for vertical layout. Larger positive values */
- /* mean further below the vertical glyph origin. */
- /* */
- /* vertAdvance :: */
- /* Advance height for vertical layout. Positive values mean the */
- /* glyph has a positive advance downward. */
- /* */
- /* <Note> */
- /* If not disabled with @FT_LOAD_NO_HINTING, the values represent */
- /* dimensions of the hinted glyph (in case hinting is applicable). */
- /* */
- /* Stroking a glyph with an outside border does not increase */
- /* `horiAdvance' or `vertAdvance'; you have to manually adjust these */
- /* values to account for the added width and height. */
- /* */
- typedef struct FT_Glyph_Metrics_
- {
- FT_Pos width;
- FT_Pos height;
-
- FT_Pos horiBearingX;
- FT_Pos horiBearingY;
- FT_Pos horiAdvance;
-
- FT_Pos vertBearingX;
- FT_Pos vertBearingY;
- FT_Pos vertAdvance;
-
- } FT_Glyph_Metrics;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* FT_Bitmap_Size */
- /* */
- /* <Description> */
- /* This structure models the metrics of a bitmap strike (i.e., a set */
- /* of glyphs for a given point size and resolution) in a bitmap font. */
- /* It is used for the `available_sizes' field of @FT_Face. */
- /* */
- /* <Fields> */
- /* height :: The vertical distance, in pixels, between two */
- /* consecutive baselines. It is always positive. */
- /* */
- /* width :: The average width, in pixels, of all glyphs in the */
- /* strike. */
- /* */
- /* size :: The nominal size of the strike in 26.6 fractional */
- /* points. This field is not very useful. */
- /* */
- /* x_ppem :: The horizontal ppem (nominal width) in 26.6 fractional */
- /* pixels. */
- /* */
- /* y_ppem :: The vertical ppem (nominal height) in 26.6 fractional */
- /* pixels. */
- /* */
- /* <Note> */
- /* Windows FNT: */
- /* The nominal size given in a FNT font is not reliable. Thus when */
- /* the driver finds it incorrect, it sets `size' to some calculated */
- /* values and sets `x_ppem' and `y_ppem' to the pixel width and */
- /* height given in the font, respectively. */
- /* */
- /* TrueType embedded bitmaps: */
- /* `size', `width', and `height' values are not contained in the */
- /* bitmap strike itself. They are computed from the global font */
- /* parameters. */
- /* */
- typedef struct FT_Bitmap_Size_
- {
- FT_Short height;
- FT_Short width;
-
- FT_Pos size;
-
- FT_Pos x_ppem;
- FT_Pos y_ppem;
-
- } FT_Bitmap_Size;
-
-
- /*************************************************************************/
- /*************************************************************************/
- /* */
- /* O B J E C T C L A S S E S */
- /* */
- /*************************************************************************/
- /*************************************************************************/
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* FT_Library */
- /* */
- /* <Description> */
- /* A handle to a FreeType library instance. Each `library' is */
- /* completely independent from the others; it is the `root' of a set */
- /* of objects like fonts, faces, sizes, etc. */
- /* */
- /* It also embeds a memory manager (see @FT_Memory), as well as a */
- /* scan-line converter object (see @FT_Raster). */
- /* */
- /* In multi-threaded applications it is easiest to use one */
- /* `FT_Library' object per thread. In case this is too cumbersome, */
- /* a single `FT_Library' object across threads is possible also */
- /* (since FreeType version 2.5.6), as long as a mutex lock is used */
- /* around @FT_New_Face and @FT_Done_Face. */
- /* */
- /* <Note> */
- /* Library objects are normally created by @FT_Init_FreeType, and */
- /* destroyed with @FT_Done_FreeType. If you need reference-counting */
- /* (cf. @FT_Reference_Library), use @FT_New_Library and */
- /* @FT_Done_Library. */
- /* */
- typedef struct FT_LibraryRec_ *FT_Library;
-
-
- /*************************************************************************/
- /* */
- /* <Section> */
- /* module_management */
- /* */
- /*************************************************************************/
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* FT_Module */
- /* */
- /* <Description> */
- /* A handle to a given FreeType module object. Each module can be a */
- /* font driver, a renderer, or anything else that provides services */
- /* to the formers. */
- /* */
- typedef struct FT_ModuleRec_* FT_Module;
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* FT_Driver */
- /* */
- /* <Description> */
- /* A handle to a given FreeType font driver object. Each font driver */
- /* is a special module capable of creating faces from font files. */
- /* */
- typedef struct FT_DriverRec_* FT_Driver;
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* FT_Renderer */
- /* */
- /* <Description> */
- /* A handle to a given FreeType renderer. A renderer is a special */
- /* module in charge of converting a glyph image to a bitmap, when */
- /* necessary. Each renderer supports a given glyph image format, and */
- /* one or more target surface depths. */
- /* */
- typedef struct FT_RendererRec_* FT_Renderer;
-
-
- /*************************************************************************/
- /* */
- /* <Section> */
- /* base_interface */
- /* */
- /*************************************************************************/
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* FT_Face */
- /* */
- /* <Description> */
- /* A handle to a given typographic face object. A face object models */
- /* a given typeface, in a given style. */
- /* */
- /* <Note> */
- /* Each face object also owns a single @FT_GlyphSlot object, as well */
- /* as one or more @FT_Size objects. */
- /* */
- /* Use @FT_New_Face or @FT_Open_Face to create a new face object from */
- /* a given filepathname or a custom input stream. */
- /* */
- /* Use @FT_Done_Face to destroy it (along with its slot and sizes). */
- /* */
- /* An `FT_Face' object can only be safely used from one thread at a */
- /* time. Similarly, creation and destruction of `FT_Face' with the */
- /* same @FT_Library object can only be done from one thread at a */
- /* time. On the other hand, functions like @FT_Load_Glyph and its */
- /* siblings are thread-safe and do not need the lock to be held as */
- /* long as the same `FT_Face' object is not used from multiple */
- /* threads at the same time. */
- /* */
- /* <Also> */
- /* See @FT_FaceRec for the publicly accessible fields of a given face */
- /* object. */
- /* */
- typedef struct FT_FaceRec_* FT_Face;
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* FT_Size */
- /* */
- /* <Description> */
- /* A handle to an object used to model a face scaled to a given */
- /* character size. */
- /* */
- /* <Note> */
- /* Each @FT_Face has an _active_ @FT_Size object that is used by */
- /* functions like @FT_Load_Glyph to determine the scaling */
- /* transformation that in turn is used to load and hint glyphs and */
- /* metrics. */
- /* */
- /* You can use @FT_Set_Char_Size, @FT_Set_Pixel_Sizes, */
- /* @FT_Request_Size or even @FT_Select_Size to change the content */
- /* (i.e., the scaling values) of the active @FT_Size. */
- /* */
- /* You can use @FT_New_Size to create additional size objects for a */
- /* given @FT_Face, but they won't be used by other functions until */
- /* you activate it through @FT_Activate_Size. Only one size can be */
- /* activated at any given time per face. */
- /* */
- /* <Also> */
- /* See @FT_SizeRec for the publicly accessible fields of a given size */
- /* object. */
- /* */
- typedef struct FT_SizeRec_* FT_Size;
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* FT_GlyphSlot */
- /* */
- /* <Description> */
- /* A handle to a given `glyph slot'. A slot is a container where it */
- /* is possible to load any of the glyphs contained in its parent */
- /* face. */
- /* */
- /* In other words, each time you call @FT_Load_Glyph or */
- /* @FT_Load_Char, the slot's content is erased by the new glyph data, */
- /* i.e., the glyph's metrics, its image (bitmap or outline), and */
- /* other control information. */
- /* */
- /* <Also> */
- /* See @FT_GlyphSlotRec for the publicly accessible glyph fields. */
- /* */
- typedef struct FT_GlyphSlotRec_* FT_GlyphSlot;
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* FT_CharMap */
- /* */
- /* <Description> */
- /* A handle to a given character map. A charmap is used to translate */
- /* character codes in a given encoding into glyph indexes for its */
- /* parent's face. Some font formats may provide several charmaps per */
- /* font. */
- /* */
- /* Each face object owns zero or more charmaps, but only one of them */
- /* can be `active' and used by @FT_Get_Char_Index or @FT_Load_Char. */
- /* */
- /* The list of available charmaps in a face is available through the */
- /* `face->num_charmaps' and `face->charmaps' fields of @FT_FaceRec. */
- /* */
- /* The currently active charmap is available as `face->charmap'. */
- /* You should call @FT_Set_Charmap to change it. */
- /* */
- /* <Note> */
- /* When a new face is created (either through @FT_New_Face or */
- /* @FT_Open_Face), the library looks for a Unicode charmap within */
- /* the list and automatically activates it. */
- /* */
- /* <Also> */
- /* See @FT_CharMapRec for the publicly accessible fields of a given */
- /* character map. */
- /* */
- typedef struct FT_CharMapRec_* FT_CharMap;
-
-
- /*************************************************************************/
- /* */
- /* <Macro> */
- /* FT_ENC_TAG */
- /* */
- /* <Description> */
- /* This macro converts four-letter tags into an unsigned long. It is */
- /* used to define `encoding' identifiers (see @FT_Encoding). */
- /* */
- /* <Note> */
- /* Since many 16-bit compilers don't like 32-bit enumerations, you */
- /* should redefine this macro in case of problems to something like */
- /* this: */
- /* */
- /* { */
- /* #define FT_ENC_TAG( value, a, b, c, d ) value */
- /* } */
- /* */
- /* to get a simple enumeration without assigning special numbers. */
- /* */
-
-#ifndef FT_ENC_TAG
-#define FT_ENC_TAG( value, a, b, c, d ) \
- value = ( ( (FT_UInt32)(a) << 24 ) | \
- ( (FT_UInt32)(b) << 16 ) | \
- ( (FT_UInt32)(c) << 8 ) | \
- (FT_UInt32)(d) )
-
-#endif /* FT_ENC_TAG */
-
-
- /*************************************************************************/
- /* */
- /* <Enum> */
- /* FT_Encoding */
- /* */
- /* <Description> */
- /* An enumeration used to specify character sets supported by */
- /* charmaps. Used in the @FT_Select_Charmap API function. */
- /* */
- /* <Note> */
- /* Despite the name, this enumeration lists specific character */
- /* repertories (i.e., charsets), and not text encoding methods (e.g., */
- /* UTF-8, UTF-16, etc.). */
- /* */
- /* Other encodings might be defined in the future. */
- /* */
- /* <Values> */
- /* FT_ENCODING_NONE :: */
- /* The encoding value~0 is reserved. */
- /* */
- /* FT_ENCODING_UNICODE :: */
- /* Corresponds to the Unicode character set. This value covers */
- /* all versions of the Unicode repertoire, including ASCII and */
- /* Latin-1. Most fonts include a Unicode charmap, but not all */
- /* of them. */
- /* */
- /* For example, if you want to access Unicode value U+1F028 (and */
- /* the font contains it), use value 0x1F028 as the input value for */
- /* @FT_Get_Char_Index. */
- /* */
- /* FT_ENCODING_MS_SYMBOL :: */
- /* Corresponds to the Microsoft Symbol encoding, used to encode */
- /* mathematical symbols and wingdings. For more information, see */
- /* `http://www.microsoft.com/typography/otspec/recom.htm', */
- /* `http://www.kostis.net/charsets/symbol.htm', and */
- /* `http://www.kostis.net/charsets/wingding.htm'. */
- /* */
- /* This encoding uses character codes from the PUA (Private Unicode */
- /* Area) in the range U+F020-U+F0FF. */
- /* */
- /* FT_ENCODING_SJIS :: */
- /* Corresponds to Japanese SJIS encoding. More info at */
- /* at `http://en.wikipedia.org/wiki/Shift_JIS'. */
- /* See note on multi-byte encodings below. */
- /* */
- /* FT_ENCODING_GB2312 :: */
- /* Corresponds to an encoding system for Simplified Chinese as used */
- /* used in mainland China. */
- /* */
- /* FT_ENCODING_BIG5 :: */
- /* Corresponds to an encoding system for Traditional Chinese as */
- /* used in Taiwan and Hong Kong. */
- /* */
- /* FT_ENCODING_WANSUNG :: */
- /* Corresponds to the Korean encoding system known as Wansung. */
- /* For more information see */
- /* `https://msdn.microsoft.com/en-US/goglobal/cc305154'. */
- /* */
- /* FT_ENCODING_JOHAB :: */
- /* The Korean standard character set (KS~C 5601-1992), which */
- /* corresponds to MS Windows code page 1361. This character set */
- /* includes all possible Hangeul character combinations. */
- /* */
- /* FT_ENCODING_ADOBE_LATIN_1 :: */
- /* Corresponds to a Latin-1 encoding as defined in a Type~1 */
- /* PostScript font. It is limited to 256 character codes. */
- /* */
- /* FT_ENCODING_ADOBE_STANDARD :: */
- /* Corresponds to the Adobe Standard encoding, as found in Type~1, */
- /* CFF, and OpenType/CFF fonts. It is limited to 256 character */
- /* codes. */
- /* */
- /* FT_ENCODING_ADOBE_EXPERT :: */
- /* Corresponds to the Adobe Expert encoding, as found in Type~1, */
- /* CFF, and OpenType/CFF fonts. It is limited to 256 character */
- /* codes. */
- /* */
- /* FT_ENCODING_ADOBE_CUSTOM :: */
- /* Corresponds to a custom encoding, as found in Type~1, CFF, and */
- /* OpenType/CFF fonts. It is limited to 256 character codes. */
- /* */
- /* FT_ENCODING_APPLE_ROMAN :: */
- /* Corresponds to the 8-bit Apple roman encoding. Many TrueType */
- /* and OpenType fonts contain a charmap for this encoding, since */
- /* older versions of Mac OS are able to use it. */
- /* */
- /* FT_ENCODING_OLD_LATIN_2 :: */
- /* This value is deprecated and was never used nor reported by */
- /* FreeType. Don't use or test for it. */
- /* */
- /* FT_ENCODING_MS_SJIS :: */
- /* Same as FT_ENCODING_SJIS. Deprecated. */
- /* */
- /* FT_ENCODING_MS_GB2312 :: */
- /* Same as FT_ENCODING_GB2312. Deprecated. */
- /* */
- /* FT_ENCODING_MS_BIG5 :: */
- /* Same as FT_ENCODING_BIG5. Deprecated. */
- /* */
- /* FT_ENCODING_MS_WANSUNG :: */
- /* Same as FT_ENCODING_WANSUNG. Deprecated. */
- /* */
- /* FT_ENCODING_MS_JOHAB :: */
- /* Same as FT_ENCODING_JOHAB. Deprecated. */
- /* */
- /* <Note> */
- /* By default, FreeType automatically synthesizes a Unicode charmap */
- /* for PostScript fonts, using their glyph names dictionaries. */
- /* However, it also reports the encodings defined explicitly in the */
- /* font file, for the cases when they are needed, with the Adobe */
- /* values as well. */
- /* */
- /* FT_ENCODING_NONE is set by the BDF and PCF drivers if the charmap */
- /* is neither Unicode nor ISO-8859-1 (otherwise it is set to */
- /* FT_ENCODING_UNICODE). Use @FT_Get_BDF_Charset_ID to find out */
- /* which encoding is really present. If, for example, the */
- /* `cs_registry' field is `KOI8' and the `cs_encoding' field is `R', */
- /* the font is encoded in KOI8-R. */
- /* */
- /* FT_ENCODING_NONE is always set (with a single exception) by the */
- /* winfonts driver. Use @FT_Get_WinFNT_Header and examine the */
- /* `charset' field of the @FT_WinFNT_HeaderRec structure to find out */
- /* which encoding is really present. For example, */
- /* @FT_WinFNT_ID_CP1251 (204) means Windows code page 1251 (for */
- /* Russian). */
- /* */
- /* FT_ENCODING_NONE is set if `platform_id' is @TT_PLATFORM_MACINTOSH */
- /* and `encoding_id' is not @TT_MAC_ID_ROMAN (otherwise it is set to */
- /* FT_ENCODING_APPLE_ROMAN). */
- /* */
- /* If `platform_id' is @TT_PLATFORM_MACINTOSH, use the function */
- /* @FT_Get_CMap_Language_ID to query the Mac language ID that may */
- /* be needed to be able to distinguish Apple encoding variants. See */
- /* */
- /* http://www.unicode.org/Public/MAPPINGS/VENDORS/APPLE/Readme.txt */
- /* */
- /* to get an idea how to do that. Basically, if the language ID */
- /* is~0, don't use it, otherwise subtract 1 from the language ID. */
- /* Then examine `encoding_id'. If, for example, `encoding_id' is */
- /* @TT_MAC_ID_ROMAN and the language ID (minus~1) is */
- /* `TT_MAC_LANGID_GREEK', it is the Greek encoding, not Roman. */
- /* @TT_MAC_ID_ARABIC with `TT_MAC_LANGID_FARSI' means the Farsi */
- /* variant the Arabic encoding. */
- /* */
- typedef enum FT_Encoding_
- {
- FT_ENC_TAG( FT_ENCODING_NONE, 0, 0, 0, 0 ),
-
- FT_ENC_TAG( FT_ENCODING_MS_SYMBOL, 's', 'y', 'm', 'b' ),
- FT_ENC_TAG( FT_ENCODING_UNICODE, 'u', 'n', 'i', 'c' ),
-
- FT_ENC_TAG( FT_ENCODING_SJIS, 's', 'j', 'i', 's' ),
- FT_ENC_TAG( FT_ENCODING_GB2312, 'g', 'b', ' ', ' ' ),
- FT_ENC_TAG( FT_ENCODING_BIG5, 'b', 'i', 'g', '5' ),
- FT_ENC_TAG( FT_ENCODING_WANSUNG, 'w', 'a', 'n', 's' ),
- FT_ENC_TAG( FT_ENCODING_JOHAB, 'j', 'o', 'h', 'a' ),
-
- /* for backwards compatibility */
- FT_ENCODING_MS_SJIS = FT_ENCODING_SJIS,
- FT_ENCODING_MS_GB2312 = FT_ENCODING_GB2312,
- FT_ENCODING_MS_BIG5 = FT_ENCODING_BIG5,
- FT_ENCODING_MS_WANSUNG = FT_ENCODING_WANSUNG,
- FT_ENCODING_MS_JOHAB = FT_ENCODING_JOHAB,
-
- FT_ENC_TAG( FT_ENCODING_ADOBE_STANDARD, 'A', 'D', 'O', 'B' ),
- FT_ENC_TAG( FT_ENCODING_ADOBE_EXPERT, 'A', 'D', 'B', 'E' ),
- FT_ENC_TAG( FT_ENCODING_ADOBE_CUSTOM, 'A', 'D', 'B', 'C' ),
- FT_ENC_TAG( FT_ENCODING_ADOBE_LATIN_1, 'l', 'a', 't', '1' ),
-
- FT_ENC_TAG( FT_ENCODING_OLD_LATIN_2, 'l', 'a', 't', '2' ),
-
- FT_ENC_TAG( FT_ENCODING_APPLE_ROMAN, 'a', 'r', 'm', 'n' )
-
- } FT_Encoding;
-
-
- /* these constants are deprecated; use the corresponding `FT_Encoding' */
- /* values instead */
-#define ft_encoding_none FT_ENCODING_NONE
-#define ft_encoding_unicode FT_ENCODING_UNICODE
-#define ft_encoding_symbol FT_ENCODING_MS_SYMBOL
-#define ft_encoding_latin_1 FT_ENCODING_ADOBE_LATIN_1
-#define ft_encoding_latin_2 FT_ENCODING_OLD_LATIN_2
-#define ft_encoding_sjis FT_ENCODING_SJIS
-#define ft_encoding_gb2312 FT_ENCODING_GB2312
-#define ft_encoding_big5 FT_ENCODING_BIG5
-#define ft_encoding_wansung FT_ENCODING_WANSUNG
-#define ft_encoding_johab FT_ENCODING_JOHAB
-
-#define ft_encoding_adobe_standard FT_ENCODING_ADOBE_STANDARD
-#define ft_encoding_adobe_expert FT_ENCODING_ADOBE_EXPERT
-#define ft_encoding_adobe_custom FT_ENCODING_ADOBE_CUSTOM
-#define ft_encoding_apple_roman FT_ENCODING_APPLE_ROMAN
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* FT_CharMapRec */
- /* */
- /* <Description> */
- /* The base charmap structure. */
- /* */
- /* <Fields> */
- /* face :: A handle to the parent face object. */
- /* */
- /* encoding :: An @FT_Encoding tag identifying the charmap. Use */
- /* this with @FT_Select_Charmap. */
- /* */
- /* platform_id :: An ID number describing the platform for the */
- /* following encoding ID. This comes directly from */
- /* the TrueType specification and should be emulated */
- /* for other formats. */
- /* */
- /* encoding_id :: A platform specific encoding number. This also */
- /* comes from the TrueType specification and should be */
- /* emulated similarly. */
- /* */
- typedef struct FT_CharMapRec_
- {
- FT_Face face;
- FT_Encoding encoding;
- FT_UShort platform_id;
- FT_UShort encoding_id;
-
- } FT_CharMapRec;
-
-
- /*************************************************************************/
- /*************************************************************************/
- /* */
- /* B A S E O B J E C T C L A S S E S */
- /* */
- /*************************************************************************/
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* FT_Face_Internal */
- /* */
- /* <Description> */
- /* An opaque handle to an `FT_Face_InternalRec' structure, used to */
- /* model private data of a given @FT_Face object. */
- /* */
- /* This structure might change between releases of FreeType~2 and is */
- /* not generally available to client applications. */
- /* */
- typedef struct FT_Face_InternalRec_* FT_Face_Internal;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* FT_FaceRec */
- /* */
- /* <Description> */
- /* FreeType root face class structure. A face object models a */
- /* typeface in a font file. */
- /* */
- /* <Fields> */
- /* num_faces :: The number of faces in the font file. Some */
- /* font formats can have multiple faces in */
- /* a font file. */
- /* */
- /* face_index :: This field holds two different values. */
- /* Bits 0-15 are the index of the face in the */
- /* font file (starting with value~0). They */
- /* are set to~0 if there is only one face in */
- /* the font file. */
- /* */
- /* Bits 16-30 are relevant to GX variation */
- /* fonts only, holding the named instance */
- /* index for the current face index (starting */
- /* with value~1; value~0 indicates font access */
- /* without GX variation data). For non-GX */
- /* fonts, bits 16-30 are ignored. If we have */
- /* the third named instance of face~4, say, */
- /* `face_index' is set to 0x00030004. */
- /* */
- /* Bit 31 is always zero (this is, */
- /* `face_index' is always a positive value). */
- /* */
- /* face_flags :: A set of bit flags that give important */
- /* information about the face; see */
- /* @FT_FACE_FLAG_XXX for the details. */
- /* */
- /* style_flags :: The lower 16~bits contain a set of bit */
- /* flags indicating the style of the face; see */
- /* @FT_STYLE_FLAG_XXX for the details. Bits */
- /* 16-30 hold the number of named instances */
- /* available for the current face if we have a */
- /* GX variation (sub)font. Bit 31 is always */
- /* zero (this is, `style_flags' is always a */
- /* positive value). */
- /* */
- /* num_glyphs :: The number of glyphs in the face. If the */
- /* face is scalable and has sbits (see */
- /* `num_fixed_sizes'), it is set to the number */
- /* of outline glyphs. */
- /* */
- /* For CID-keyed fonts, this value gives the */
- /* highest CID used in the font. */
- /* */
- /* family_name :: The face's family name. This is an ASCII */
- /* string, usually in English, that describes */
- /* the typeface's family (like `Times New */
- /* Roman', `Bodoni', `Garamond', etc). This */
- /* is a least common denominator used to list */
- /* fonts. Some formats (TrueType & OpenType) */
- /* provide localized and Unicode versions of */
- /* this string. Applications should use the */
- /* format specific interface to access them. */
- /* Can be NULL (e.g., in fonts embedded in a */
- /* PDF file). */
- /* */
- /* In case the font doesn't provide a specific */
- /* family name entry, FreeType tries to */
- /* synthesize one, deriving it from other name */
- /* entries. */
- /* */
- /* style_name :: The face's style name. This is an ASCII */
- /* string, usually in English, that describes */
- /* the typeface's style (like `Italic', */
- /* `Bold', `Condensed', etc). Not all font */
- /* formats provide a style name, so this field */
- /* is optional, and can be set to NULL. As */
- /* for `family_name', some formats provide */
- /* localized and Unicode versions of this */
- /* string. Applications should use the format */
- /* specific interface to access them. */
- /* */
- /* num_fixed_sizes :: The number of bitmap strikes in the face. */
- /* Even if the face is scalable, there might */
- /* still be bitmap strikes, which are called */
- /* `sbits' in that case. */
- /* */
- /* available_sizes :: An array of @FT_Bitmap_Size for all bitmap */
- /* strikes in the face. It is set to NULL if */
- /* there is no bitmap strike. */
- /* */
- /* num_charmaps :: The number of charmaps in the face. */
- /* */
- /* charmaps :: An array of the charmaps of the face. */
- /* */
- /* generic :: A field reserved for client uses. See the */
- /* @FT_Generic type description. */
- /* */
- /* bbox :: The font bounding box. Coordinates are */
- /* expressed in font units (see */
- /* `units_per_EM'). The box is large enough */
- /* to contain any glyph from the font. Thus, */
- /* `bbox.yMax' can be seen as the `maximum */
- /* ascender', and `bbox.yMin' as the `minimum */
- /* descender'. Only relevant for scalable */
- /* formats. */
- /* */
- /* Note that the bounding box might be off by */
- /* (at least) one pixel for hinted fonts. See */
- /* @FT_Size_Metrics for further discussion. */
- /* */
- /* units_per_EM :: The number of font units per EM square for */
- /* this face. This is typically 2048 for */
- /* TrueType fonts, and 1000 for Type~1 fonts. */
- /* Only relevant for scalable formats. */
- /* */
- /* ascender :: The typographic ascender of the face, */
- /* expressed in font units. For font formats */
- /* not having this information, it is set to */
- /* `bbox.yMax'. Only relevant for scalable */
- /* formats. */
- /* */
- /* descender :: The typographic descender of the face, */
- /* expressed in font units. For font formats */
- /* not having this information, it is set to */
- /* `bbox.yMin'. Note that this field is */
- /* usually negative. Only relevant for */
- /* scalable formats. */
- /* */
- /* height :: This value is the vertical distance */
- /* between two consecutive baselines, */
- /* expressed in font units. It is always */
- /* positive. Only relevant for scalable */
- /* formats. */
- /* */
- /* If you want the global glyph height, use */
- /* `ascender - descender'. */
- /* */
- /* max_advance_width :: The maximum advance width, in font units, */
- /* for all glyphs in this face. This can be */
- /* used to make word wrapping computations */
- /* faster. Only relevant for scalable */
- /* formats. */
- /* */
- /* max_advance_height :: The maximum advance height, in font units, */
- /* for all glyphs in this face. This is only */
- /* relevant for vertical layouts, and is set */
- /* to `height' for fonts that do not provide */
- /* vertical metrics. Only relevant for */
- /* scalable formats. */
- /* */
- /* underline_position :: The position, in font units, of the */
- /* underline line for this face. It is the */
- /* center of the underlining stem. Only */
- /* relevant for scalable formats. */
- /* */
- /* underline_thickness :: The thickness, in font units, of the */
- /* underline for this face. Only relevant for */
- /* scalable formats. */
- /* */
- /* glyph :: The face's associated glyph slot(s). */
- /* */
- /* size :: The current active size for this face. */
- /* */
- /* charmap :: The current active charmap for this face. */
- /* */
- /* <Note> */
- /* Fields may be changed after a call to @FT_Attach_File or */
- /* @FT_Attach_Stream. */
- /* */
- typedef struct FT_FaceRec_
- {
- FT_Long num_faces;
- FT_Long face_index;
-
- FT_Long face_flags;
- FT_Long style_flags;
-
- FT_Long num_glyphs;
-
- FT_String* family_name;
- FT_String* style_name;
-
- FT_Int num_fixed_sizes;
- FT_Bitmap_Size* available_sizes;
-
- FT_Int num_charmaps;
- FT_CharMap* charmaps;
-
- FT_Generic generic;
-
- /*# The following member variables (down to `underline_thickness') */
- /*# are only relevant to scalable outlines; cf. @FT_Bitmap_Size */
- /*# for bitmap fonts. */
- FT_BBox bbox;
-
- FT_UShort units_per_EM;
- FT_Short ascender;
- FT_Short descender;
- FT_Short height;
-
- FT_Short max_advance_width;
- FT_Short max_advance_height;
-
- FT_Short underline_position;
- FT_Short underline_thickness;
-
- FT_GlyphSlot glyph;
- FT_Size size;
- FT_CharMap charmap;
-
- /*@private begin */
-
- FT_Driver driver;
- FT_Memory memory;
- FT_Stream stream;
-
- FT_ListRec sizes_list;
-
- FT_Generic autohint; /* face-specific auto-hinter data */
- void* extensions; /* unused */
-
- FT_Face_Internal internal;
-
- /*@private end */
-
- } FT_FaceRec;
-
-
- /*************************************************************************/
- /* */
- /* <Enum> */
- /* FT_FACE_FLAG_XXX */
- /* */
- /* <Description> */
- /* A list of bit flags used in the `face_flags' field of the */
- /* @FT_FaceRec structure. They inform client applications of */
- /* properties of the corresponding face. */
- /* */
- /* <Values> */
- /* FT_FACE_FLAG_SCALABLE :: */
- /* Indicates that the face contains outline glyphs. This doesn't */
- /* prevent bitmap strikes, i.e., a face can have both this and */
- /* and @FT_FACE_FLAG_FIXED_SIZES set. */
- /* */
- /* FT_FACE_FLAG_FIXED_SIZES :: */
- /* Indicates that the face contains bitmap strikes. See also the */
- /* `num_fixed_sizes' and `available_sizes' fields of @FT_FaceRec. */
- /* */
- /* FT_FACE_FLAG_FIXED_WIDTH :: */
- /* Indicates that the face contains fixed-width characters (like */
- /* Courier, Lucido, MonoType, etc.). */
- /* */
- /* FT_FACE_FLAG_SFNT :: */
- /* Indicates that the face uses the `sfnt' storage scheme. For */
- /* now, this means TrueType and OpenType. */
- /* */
- /* FT_FACE_FLAG_HORIZONTAL :: */
- /* Indicates that the face contains horizontal glyph metrics. This */
- /* should be set for all common formats. */
- /* */
- /* FT_FACE_FLAG_VERTICAL :: */
- /* Indicates that the face contains vertical glyph metrics. This */
- /* is only available in some formats, not all of them. */
- /* */
- /* FT_FACE_FLAG_KERNING :: */
- /* Indicates that the face contains kerning information. If set, */
- /* the kerning distance can be retrieved through the function */
- /* @FT_Get_Kerning. Otherwise the function always return the */
- /* vector (0,0). Note that FreeType doesn't handle kerning data */
- /* from the `GPOS' table (as present in some OpenType fonts). */
- /* */
- /* FT_FACE_FLAG_FAST_GLYPHS :: */
- /* THIS FLAG IS DEPRECATED. DO NOT USE OR TEST IT. */
- /* */
- /* FT_FACE_FLAG_MULTIPLE_MASTERS :: */
- /* Indicates that the font contains multiple masters and is capable */
- /* of interpolating between them. See the multiple-masters */
- /* specific API for details. */
- /* */
- /* FT_FACE_FLAG_GLYPH_NAMES :: */
- /* Indicates that the font contains glyph names that can be */
- /* retrieved through @FT_Get_Glyph_Name. Note that some TrueType */
- /* fonts contain broken glyph name tables. Use the function */
- /* @FT_Has_PS_Glyph_Names when needed. */
- /* */
- /* FT_FACE_FLAG_EXTERNAL_STREAM :: */
- /* Used internally by FreeType to indicate that a face's stream was */
- /* provided by the client application and should not be destroyed */
- /* when @FT_Done_Face is called. Don't read or test this flag. */
- /* */
- /* FT_FACE_FLAG_HINTER :: */
- /* Set if the font driver has a hinting machine of its own. For */
- /* example, with TrueType fonts, it makes sense to use data from */
- /* the SFNT `gasp' table only if the native TrueType hinting engine */
- /* (with the bytecode interpreter) is available and active. */
- /* */
- /* FT_FACE_FLAG_CID_KEYED :: */
- /* Set if the font is CID-keyed. In that case, the font is not */
- /* accessed by glyph indices but by CID values. For subsetted */
- /* CID-keyed fonts this has the consequence that not all index */
- /* values are a valid argument to FT_Load_Glyph. Only the CID */
- /* values for which corresponding glyphs in the subsetted font */
- /* exist make FT_Load_Glyph return successfully; in all other cases */
- /* you get an `FT_Err_Invalid_Argument' error. */
- /* */
- /* Note that CID-keyed fonts that are in an SFNT wrapper don't */
- /* have this flag set since the glyphs are accessed in the normal */
- /* way (using contiguous indices); the `CID-ness' isn't visible to */
- /* the application. */
- /* */
- /* FT_FACE_FLAG_TRICKY :: */
- /* Set if the font is `tricky', this is, it always needs the */
- /* font format's native hinting engine to get a reasonable result. */
- /* A typical example is the Chinese font `mingli.ttf' that uses */
- /* TrueType bytecode instructions to move and scale all of its */
- /* subglyphs. */
- /* */
- /* It is not possible to auto-hint such fonts using */
- /* @FT_LOAD_FORCE_AUTOHINT; it will also ignore */
- /* @FT_LOAD_NO_HINTING. You have to set both @FT_LOAD_NO_HINTING */
- /* and @FT_LOAD_NO_AUTOHINT to really disable hinting; however, you */
- /* probably never want this except for demonstration purposes. */
- /* */
- /* Currently, there are about a dozen TrueType fonts in the list of */
- /* tricky fonts; they are hard-coded in file `ttobjs.c'. */
- /* */
- /* FT_FACE_FLAG_COLOR :: */
- /* Set if the font has color glyph tables. To access color glyphs */
- /* use @FT_LOAD_COLOR. */
- /* */
-#define FT_FACE_FLAG_SCALABLE ( 1L << 0 )
-#define FT_FACE_FLAG_FIXED_SIZES ( 1L << 1 )
-#define FT_FACE_FLAG_FIXED_WIDTH ( 1L << 2 )
-#define FT_FACE_FLAG_SFNT ( 1L << 3 )
-#define FT_FACE_FLAG_HORIZONTAL ( 1L << 4 )
-#define FT_FACE_FLAG_VERTICAL ( 1L << 5 )
-#define FT_FACE_FLAG_KERNING ( 1L << 6 )
-#define FT_FACE_FLAG_FAST_GLYPHS ( 1L << 7 )
-#define FT_FACE_FLAG_MULTIPLE_MASTERS ( 1L << 8 )
-#define FT_FACE_FLAG_GLYPH_NAMES ( 1L << 9 )
-#define FT_FACE_FLAG_EXTERNAL_STREAM ( 1L << 10 )
-#define FT_FACE_FLAG_HINTER ( 1L << 11 )
-#define FT_FACE_FLAG_CID_KEYED ( 1L << 12 )
-#define FT_FACE_FLAG_TRICKY ( 1L << 13 )
-#define FT_FACE_FLAG_COLOR ( 1L << 14 )
-
-
- /*************************************************************************
- *
- * @macro:
- * FT_HAS_HORIZONTAL( face )
- *
- * @description:
- * A macro that returns true whenever a face object contains
- * horizontal metrics (this is true for all font formats though).
- *
- * @also:
- * @FT_HAS_VERTICAL can be used to check for vertical metrics.
- *
- */
-#define FT_HAS_HORIZONTAL( face ) \
- ( face->face_flags & FT_FACE_FLAG_HORIZONTAL )
-
-
- /*************************************************************************
- *
- * @macro:
- * FT_HAS_VERTICAL( face )
- *
- * @description:
- * A macro that returns true whenever a face object contains real
- * vertical metrics (and not only synthesized ones).
- *
- */
-#define FT_HAS_VERTICAL( face ) \
- ( face->face_flags & FT_FACE_FLAG_VERTICAL )
-
-
- /*************************************************************************
- *
- * @macro:
- * FT_HAS_KERNING( face )
- *
- * @description:
- * A macro that returns true whenever a face object contains kerning
- * data that can be accessed with @FT_Get_Kerning.
- *
- */
-#define FT_HAS_KERNING( face ) \
- ( face->face_flags & FT_FACE_FLAG_KERNING )
-
-
- /*************************************************************************
- *
- * @macro:
- * FT_IS_SCALABLE( face )
- *
- * @description:
- * A macro that returns true whenever a face object contains a scalable
- * font face (true for TrueType, Type~1, Type~42, CID, OpenType/CFF,
- * and PFR font formats.
- *
- */
-#define FT_IS_SCALABLE( face ) \
- ( face->face_flags & FT_FACE_FLAG_SCALABLE )
-
-
- /*************************************************************************
- *
- * @macro:
- * FT_IS_SFNT( face )
- *
- * @description:
- * A macro that returns true whenever a face object contains a font
- * whose format is based on the SFNT storage scheme. This usually
- * means: TrueType fonts, OpenType fonts, as well as SFNT-based embedded
- * bitmap fonts.
- *
- * If this macro is true, all functions defined in @FT_SFNT_NAMES_H and
- * @FT_TRUETYPE_TABLES_H are available.
- *
- */
-#define FT_IS_SFNT( face ) \
- ( face->face_flags & FT_FACE_FLAG_SFNT )
-
-
- /*************************************************************************
- *
- * @macro:
- * FT_IS_FIXED_WIDTH( face )
- *
- * @description:
- * A macro that returns true whenever a face object contains a font face
- * that contains fixed-width (or `monospace', `fixed-pitch', etc.)
- * glyphs.
- *
- */
-#define FT_IS_FIXED_WIDTH( face ) \
- ( face->face_flags & FT_FACE_FLAG_FIXED_WIDTH )
-
-
- /*************************************************************************
- *
- * @macro:
- * FT_HAS_FIXED_SIZES( face )
- *
- * @description:
- * A macro that returns true whenever a face object contains some
- * embedded bitmaps. See the `available_sizes' field of the
- * @FT_FaceRec structure.
- *
- */
-#define FT_HAS_FIXED_SIZES( face ) \
- ( face->face_flags & FT_FACE_FLAG_FIXED_SIZES )
-
-
- /*************************************************************************
- *
- * @macro:
- * FT_HAS_FAST_GLYPHS( face )
- *
- * @description:
- * Deprecated.
- *
- */
-#define FT_HAS_FAST_GLYPHS( face ) 0
-
-
- /*************************************************************************
- *
- * @macro:
- * FT_HAS_GLYPH_NAMES( face )
- *
- * @description:
- * A macro that returns true whenever a face object contains some glyph
- * names that can be accessed through @FT_Get_Glyph_Name.
- *
- */
-#define FT_HAS_GLYPH_NAMES( face ) \
- ( face->face_flags & FT_FACE_FLAG_GLYPH_NAMES )
-
-
- /*************************************************************************
- *
- * @macro:
- * FT_HAS_MULTIPLE_MASTERS( face )
- *
- * @description:
- * A macro that returns true whenever a face object contains some
- * multiple masters. The functions provided by @FT_MULTIPLE_MASTERS_H
- * are then available to choose the exact design you want.
- *
- */
-#define FT_HAS_MULTIPLE_MASTERS( face ) \
- ( face->face_flags & FT_FACE_FLAG_MULTIPLE_MASTERS )
-
-
- /*************************************************************************
- *
- * @macro:
- * FT_IS_CID_KEYED( face )
- *
- * @description:
- * A macro that returns true whenever a face object contains a CID-keyed
- * font. See the discussion of @FT_FACE_FLAG_CID_KEYED for more
- * details.
- *
- * If this macro is true, all functions defined in @FT_CID_H are
- * available.
- *
- */
-#define FT_IS_CID_KEYED( face ) \
- ( face->face_flags & FT_FACE_FLAG_CID_KEYED )
-
-
- /*************************************************************************
- *
- * @macro:
- * FT_IS_TRICKY( face )
- *
- * @description:
- * A macro that returns true whenever a face represents a `tricky' font.
- * See the discussion of @FT_FACE_FLAG_TRICKY for more details.
- *
- */
-#define FT_IS_TRICKY( face ) \
- ( face->face_flags & FT_FACE_FLAG_TRICKY )
-
-
- /*************************************************************************
- *
- * @macro:
- * FT_HAS_COLOR( face )
- *
- * @description:
- * A macro that returns true whenever a face object contains
- * tables for color glyphs.
- *
- */
-#define FT_HAS_COLOR( face ) \
- ( face->face_flags & FT_FACE_FLAG_COLOR )
-
-
- /*************************************************************************/
- /* */
- /* <Const> */
- /* FT_STYLE_FLAG_XXX */
- /* */
- /* <Description> */
- /* A list of bit flags used to indicate the style of a given face. */
- /* These are used in the `style_flags' field of @FT_FaceRec. */
- /* */
- /* <Values> */
- /* FT_STYLE_FLAG_ITALIC :: */
- /* Indicates that a given face style is italic or oblique. */
- /* */
- /* FT_STYLE_FLAG_BOLD :: */
- /* Indicates that a given face is bold. */
- /* */
- /* <Note> */
- /* The style information as provided by FreeType is very basic. More */
- /* details are beyond the scope and should be done on a higher level */
- /* (for example, by analyzing various fields of the `OS/2' table in */
- /* SFNT based fonts). */
- /* */
-#define FT_STYLE_FLAG_ITALIC ( 1 << 0 )
-#define FT_STYLE_FLAG_BOLD ( 1 << 1 )
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* FT_Size_Internal */
- /* */
- /* <Description> */
- /* An opaque handle to an `FT_Size_InternalRec' structure, used to */
- /* model private data of a given @FT_Size object. */
- /* */
- typedef struct FT_Size_InternalRec_* FT_Size_Internal;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* FT_Size_Metrics */
- /* */
- /* <Description> */
- /* The size metrics structure gives the metrics of a size object. */
- /* */
- /* <Fields> */
- /* x_ppem :: The width of the scaled EM square in pixels, hence */
- /* the term `ppem' (pixels per EM). It is also */
- /* referred to as `nominal width'. */
- /* */
- /* y_ppem :: The height of the scaled EM square in pixels, */
- /* hence the term `ppem' (pixels per EM). It is also */
- /* referred to as `nominal height'. */
- /* */
- /* x_scale :: A 16.16 fractional scaling value used to convert */
- /* horizontal metrics from font units to 26.6 */
- /* fractional pixels. Only relevant for scalable */
- /* font formats. */
- /* */
- /* y_scale :: A 16.16 fractional scaling value used to convert */
- /* vertical metrics from font units to 26.6 */
- /* fractional pixels. Only relevant for scalable */
- /* font formats. */
- /* */
- /* ascender :: The ascender in 26.6 fractional pixels. See */
- /* @FT_FaceRec for the details. */
- /* */
- /* descender :: The descender in 26.6 fractional pixels. See */
- /* @FT_FaceRec for the details. */
- /* */
- /* height :: The height in 26.6 fractional pixels. See */
- /* @FT_FaceRec for the details. */
- /* */
- /* max_advance :: The maximum advance width in 26.6 fractional */
- /* pixels. See @FT_FaceRec for the details. */
- /* */
- /* <Note> */
- /* The scaling values, if relevant, are determined first during a */
- /* size changing operation. The remaining fields are then set by the */
- /* driver. For scalable formats, they are usually set to scaled */
- /* values of the corresponding fields in @FT_FaceRec. */
- /* */
- /* Note that due to glyph hinting, these values might not be exact */
- /* for certain fonts. Thus they must be treated as unreliable */
- /* with an error margin of at least one pixel! */
- /* */
- /* Indeed, the only way to get the exact metrics is to render _all_ */
- /* glyphs. As this would be a definite performance hit, it is up to */
- /* client applications to perform such computations. */
- /* */
- /* The FT_Size_Metrics structure is valid for bitmap fonts also. */
- /* */
- typedef struct FT_Size_Metrics_
- {
- FT_UShort x_ppem; /* horizontal pixels per EM */
- FT_UShort y_ppem; /* vertical pixels per EM */
-
- FT_Fixed x_scale; /* scaling values used to convert font */
- FT_Fixed y_scale; /* units to 26.6 fractional pixels */
-
- FT_Pos ascender; /* ascender in 26.6 frac. pixels */
- FT_Pos descender; /* descender in 26.6 frac. pixels */
- FT_Pos height; /* text height in 26.6 frac. pixels */
- FT_Pos max_advance; /* max horizontal advance, in 26.6 pixels */
-
- } FT_Size_Metrics;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* FT_SizeRec */
- /* */
- /* <Description> */
- /* FreeType root size class structure. A size object models a face */
- /* object at a given size. */
- /* */
- /* <Fields> */
- /* face :: Handle to the parent face object. */
- /* */
- /* generic :: A typeless pointer, unused by the FreeType library or */
- /* any of its drivers. It can be used by client */
- /* applications to link their own data to each size */
- /* object. */
- /* */
- /* metrics :: Metrics for this size object. This field is read-only. */
- /* */
- typedef struct FT_SizeRec_
- {
- FT_Face face; /* parent face object */
- FT_Generic generic; /* generic pointer for client uses */
- FT_Size_Metrics metrics; /* size metrics */
- FT_Size_Internal internal;
-
- } FT_SizeRec;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* FT_SubGlyph */
- /* */
- /* <Description> */
- /* The subglyph structure is an internal object used to describe */
- /* subglyphs (for example, in the case of composites). */
- /* */
- /* <Note> */
- /* The subglyph implementation is not part of the high-level API, */
- /* hence the forward structure declaration. */
- /* */
- /* You can however retrieve subglyph information with */
- /* @FT_Get_SubGlyph_Info. */
- /* */
- typedef struct FT_SubGlyphRec_* FT_SubGlyph;
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* FT_Slot_Internal */
- /* */
- /* <Description> */
- /* An opaque handle to an `FT_Slot_InternalRec' structure, used to */
- /* model private data of a given @FT_GlyphSlot object. */
- /* */
- typedef struct FT_Slot_InternalRec_* FT_Slot_Internal;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* FT_GlyphSlotRec */
- /* */
- /* <Description> */
- /* FreeType root glyph slot class structure. A glyph slot is a */
- /* container where individual glyphs can be loaded, be they in */
- /* outline or bitmap format. */
- /* */
- /* <Fields> */
- /* library :: A handle to the FreeType library instance */
- /* this slot belongs to. */
- /* */
- /* face :: A handle to the parent face object. */
- /* */
- /* next :: In some cases (like some font tools), several */
- /* glyph slots per face object can be a good */
- /* thing. As this is rare, the glyph slots are */
- /* listed through a direct, single-linked list */
- /* using its `next' field. */
- /* */
- /* generic :: A typeless pointer unused by the FreeType */
- /* library or any of its drivers. It can be */
- /* used by client applications to link their own */
- /* data to each glyph slot object. */
- /* */
- /* metrics :: The metrics of the last loaded glyph in the */
- /* slot. The returned values depend on the last */
- /* load flags (see the @FT_Load_Glyph API */
- /* function) and can be expressed either in 26.6 */
- /* fractional pixels or font units. */
- /* */
- /* Note that even when the glyph image is */
- /* transformed, the metrics are not. */
- /* */
- /* linearHoriAdvance :: The advance width of the unhinted glyph. */
- /* Its value is expressed in 16.16 fractional */
- /* pixels, unless @FT_LOAD_LINEAR_DESIGN is set */
- /* when loading the glyph. This field can be */
- /* important to perform correct WYSIWYG layout. */
- /* Only relevant for outline glyphs. */
- /* */
- /* linearVertAdvance :: The advance height of the unhinted glyph. */
- /* Its value is expressed in 16.16 fractional */
- /* pixels, unless @FT_LOAD_LINEAR_DESIGN is set */
- /* when loading the glyph. This field can be */
- /* important to perform correct WYSIWYG layout. */
- /* Only relevant for outline glyphs. */
- /* */
- /* advance :: This shorthand is, depending on */
- /* @FT_LOAD_IGNORE_TRANSFORM, the transformed */
- /* (hinted) advance width for the glyph, in 26.6 */
- /* fractional pixel format. As specified with */
- /* @FT_LOAD_VERTICAL_LAYOUT, it uses either the */
- /* `horiAdvance' or the `vertAdvance' value of */
- /* `metrics' field. */
- /* */
- /* format :: This field indicates the format of the image */
- /* contained in the glyph slot. Typically */
- /* @FT_GLYPH_FORMAT_BITMAP, */
- /* @FT_GLYPH_FORMAT_OUTLINE, or */
- /* @FT_GLYPH_FORMAT_COMPOSITE, but others are */
- /* possible. */
- /* */
- /* bitmap :: This field is used as a bitmap descriptor */
- /* when the slot format is */
- /* @FT_GLYPH_FORMAT_BITMAP. Note that the */
- /* address and content of the bitmap buffer can */
- /* change between calls of @FT_Load_Glyph and a */
- /* few other functions. */
- /* */
- /* bitmap_left :: The bitmap's left bearing expressed in */
- /* integer pixels. Only valid if the format is */
- /* @FT_GLYPH_FORMAT_BITMAP, this is, if the */
- /* glyph slot contains a bitmap. */
- /* */
- /* bitmap_top :: The bitmap's top bearing expressed in integer */
- /* pixels. Remember that this is the distance */
- /* from the baseline to the top-most glyph */
- /* scanline, upwards y~coordinates being */
- /* *positive*. */
- /* */
- /* outline :: The outline descriptor for the current glyph */
- /* image if its format is */
- /* @FT_GLYPH_FORMAT_OUTLINE. Once a glyph is */
- /* loaded, `outline' can be transformed, */
- /* distorted, embolded, etc. However, it must */
- /* not be freed. */
- /* */
- /* num_subglyphs :: The number of subglyphs in a composite glyph. */
- /* This field is only valid for the composite */
- /* glyph format that should normally only be */
- /* loaded with the @FT_LOAD_NO_RECURSE flag. */
- /* */
- /* subglyphs :: An array of subglyph descriptors for */
- /* composite glyphs. There are `num_subglyphs' */
- /* elements in there. Currently internal to */
- /* FreeType. */
- /* */
- /* control_data :: Certain font drivers can also return the */
- /* control data for a given glyph image (e.g. */
- /* TrueType bytecode, Type~1 charstrings, etc.). */
- /* This field is a pointer to such data. */
- /* */
- /* control_len :: This is the length in bytes of the control */
- /* data. */
- /* */
- /* other :: Really wicked formats can use this pointer to */
- /* present their own glyph image to client */
- /* applications. Note that the application */
- /* needs to know about the image format. */
- /* */
- /* lsb_delta :: The difference between hinted and unhinted */
- /* left side bearing while auto-hinting is */
- /* active. Zero otherwise. */
- /* */
- /* rsb_delta :: The difference between hinted and unhinted */
- /* right side bearing while auto-hinting is */
- /* active. Zero otherwise. */
- /* */
- /* <Note> */
- /* If @FT_Load_Glyph is called with default flags (see */
- /* @FT_LOAD_DEFAULT) the glyph image is loaded in the glyph slot in */
- /* its native format (e.g., an outline glyph for TrueType and Type~1 */
- /* formats). */
- /* */
- /* This image can later be converted into a bitmap by calling */
- /* @FT_Render_Glyph. This function finds the current renderer for */
- /* the native image's format, then invokes it. */
- /* */
- /* The renderer is in charge of transforming the native image through */
- /* the slot's face transformation fields, then converting it into a */
- /* bitmap that is returned in `slot->bitmap'. */
- /* */
- /* Note that `slot->bitmap_left' and `slot->bitmap_top' are also used */
- /* to specify the position of the bitmap relative to the current pen */
- /* position (e.g., coordinates (0,0) on the baseline). Of course, */
- /* `slot->format' is also changed to @FT_GLYPH_FORMAT_BITMAP. */
- /* */
- /* <Note> */
- /* Here is a small pseudo code fragment that shows how to use */
- /* `lsb_delta' and `rsb_delta': */
- /* */
- /* { */
- /* FT_Pos origin_x = 0; */
- /* FT_Pos prev_rsb_delta = 0; */
- /* */
- /* */
- /* for all glyphs do */
- /* <compute kern between current and previous glyph and add it to */
- /* `origin_x'> */
- /* */
- /* <load glyph with `FT_Load_Glyph'> */
- /* */
- /* if ( prev_rsb_delta - face->glyph->lsb_delta >= 32 ) */
- /* origin_x -= 64; */
- /* else if ( prev_rsb_delta - face->glyph->lsb_delta < -32 ) */
- /* origin_x += 64; */
- /* */
- /* prev_rsb_delta = face->glyph->rsb_delta; */
- /* */
- /* <save glyph image, or render glyph, or ...> */
- /* */
- /* origin_x += face->glyph->advance.x; */
- /* endfor */
- /* } */
- /* */
- typedef struct FT_GlyphSlotRec_
- {
- FT_Library library;
- FT_Face face;
- FT_GlyphSlot next;
- FT_UInt reserved; /* retained for binary compatibility */
- FT_Generic generic;
-
- FT_Glyph_Metrics metrics;
- FT_Fixed linearHoriAdvance;
- FT_Fixed linearVertAdvance;
- FT_Vector advance;
-
- FT_Glyph_Format format;
-
- FT_Bitmap bitmap;
- FT_Int bitmap_left;
- FT_Int bitmap_top;
-
- FT_Outline outline;
-
- FT_UInt num_subglyphs;
- FT_SubGlyph subglyphs;
-
- void* control_data;
- long control_len;
-
- FT_Pos lsb_delta;
- FT_Pos rsb_delta;
-
- void* other;
-
- FT_Slot_Internal internal;
-
- } FT_GlyphSlotRec;
-
-
- /*************************************************************************/
- /*************************************************************************/
- /* */
- /* F U N C T I O N S */
- /* */
- /*************************************************************************/
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Init_FreeType */
- /* */
- /* <Description> */
- /* Initialize a new FreeType library object. The set of modules */
- /* that are registered by this function is determined at build time. */
- /* */
- /* <Output> */
- /* alibrary :: A handle to a new library object. */
- /* */
- /* <Return> */
- /* FreeType error code. 0~means success. */
- /* */
- /* <Note> */
- /* In case you want to provide your own memory allocating routines, */
- /* use @FT_New_Library instead, followed by a call to */
- /* @FT_Add_Default_Modules (or a series of calls to @FT_Add_Module). */
- /* */
- /* See the documentation of @FT_Library and @FT_Face for */
- /* multi-threading issues. */
- /* */
- /* If you need reference-counting (cf. @FT_Reference_Library), use */
- /* @FT_New_Library and @FT_Done_Library. */
- /* */
- FT_EXPORT( FT_Error )
- FT_Init_FreeType( FT_Library *alibrary );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Done_FreeType */
- /* */
- /* <Description> */
- /* Destroy a given FreeType library object and all of its children, */
- /* including resources, drivers, faces, sizes, etc. */
- /* */
- /* <Input> */
- /* library :: A handle to the target library object. */
- /* */
- /* <Return> */
- /* FreeType error code. 0~means success. */
- /* */
- FT_EXPORT( FT_Error )
- FT_Done_FreeType( FT_Library library );
-
-
- /*************************************************************************/
- /* */
- /* <Enum> */
- /* FT_OPEN_XXX */
- /* */
- /* <Description> */
- /* A list of bit field constants used within the `flags' field of the */
- /* @FT_Open_Args structure. */
- /* */
- /* <Values> */
- /* FT_OPEN_MEMORY :: This is a memory-based stream. */
- /* */
- /* FT_OPEN_STREAM :: Copy the stream from the `stream' field. */
- /* */
- /* FT_OPEN_PATHNAME :: Create a new input stream from a C~path */
- /* name. */
- /* */
- /* FT_OPEN_DRIVER :: Use the `driver' field. */
- /* */
- /* FT_OPEN_PARAMS :: Use the `num_params' and `params' fields. */
- /* */
- /* <Note> */
- /* The `FT_OPEN_MEMORY', `FT_OPEN_STREAM', and `FT_OPEN_PATHNAME' */
- /* flags are mutually exclusive. */
- /* */
-#define FT_OPEN_MEMORY 0x1
-#define FT_OPEN_STREAM 0x2
-#define FT_OPEN_PATHNAME 0x4
-#define FT_OPEN_DRIVER 0x8
-#define FT_OPEN_PARAMS 0x10
-
-
- /* these constants are deprecated; use the corresponding `FT_OPEN_XXX' */
- /* values instead */
-#define ft_open_memory FT_OPEN_MEMORY
-#define ft_open_stream FT_OPEN_STREAM
-#define ft_open_pathname FT_OPEN_PATHNAME
-#define ft_open_driver FT_OPEN_DRIVER
-#define ft_open_params FT_OPEN_PARAMS
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* FT_Parameter */
- /* */
- /* <Description> */
- /* A simple structure used to pass more or less generic parameters to */
- /* @FT_Open_Face. */
- /* */
- /* <Fields> */
- /* tag :: A four-byte identification tag. */
- /* */
- /* data :: A pointer to the parameter data. */
- /* */
- /* <Note> */
- /* The ID and function of parameters are driver-specific. See the */
- /* various FT_PARAM_TAG_XXX flags for more information. */
- /* */
- typedef struct FT_Parameter_
- {
- FT_ULong tag;
- FT_Pointer data;
-
- } FT_Parameter;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* FT_Open_Args */
- /* */
- /* <Description> */
- /* A structure used to indicate how to open a new font file or */
- /* stream. A pointer to such a structure can be used as a parameter */
- /* for the functions @FT_Open_Face and @FT_Attach_Stream. */
- /* */
- /* <Fields> */
- /* flags :: A set of bit flags indicating how to use the */
- /* structure. */
- /* */
- /* memory_base :: The first byte of the file in memory. */
- /* */
- /* memory_size :: The size in bytes of the file in memory. */
- /* */
- /* pathname :: A pointer to an 8-bit file pathname. */
- /* */
- /* stream :: A handle to a source stream object. */
- /* */
- /* driver :: This field is exclusively used by @FT_Open_Face; */
- /* it simply specifies the font driver to use to open */
- /* the face. If set to~0, FreeType tries to load the */
- /* face with each one of the drivers in its list. */
- /* */
- /* num_params :: The number of extra parameters. */
- /* */
- /* params :: Extra parameters passed to the font driver when */
- /* opening a new face. */
- /* */
- /* <Note> */
- /* The stream type is determined by the contents of `flags' that */
- /* are tested in the following order by @FT_Open_Face: */
- /* */
- /* If the @FT_OPEN_MEMORY bit is set, assume that this is a */
- /* memory file of `memory_size' bytes, located at `memory_address'. */
- /* The data are are not copied, and the client is responsible for */
- /* releasing and destroying them _after_ the corresponding call to */
- /* @FT_Done_Face. */
- /* */
- /* Otherwise, if the @FT_OPEN_STREAM bit is set, assume that a */
- /* custom input stream `stream' is used. */
- /* */
- /* Otherwise, if the @FT_OPEN_PATHNAME bit is set, assume that this */
- /* is a normal file and use `pathname' to open it. */
- /* */
- /* If the @FT_OPEN_DRIVER bit is set, @FT_Open_Face only tries to */
- /* open the file with the driver whose handler is in `driver'. */
- /* */
- /* If the @FT_OPEN_PARAMS bit is set, the parameters given by */
- /* `num_params' and `params' is used. They are ignored otherwise. */
- /* */
- /* Ideally, both the `pathname' and `params' fields should be tagged */
- /* as `const'; this is missing for API backwards compatibility. In */
- /* other words, applications should treat them as read-only. */
- /* */
- typedef struct FT_Open_Args_
- {
- FT_UInt flags;
- const FT_Byte* memory_base;
- FT_Long memory_size;
- FT_String* pathname;
- FT_Stream stream;
- FT_Module driver;
- FT_Int num_params;
- FT_Parameter* params;
-
- } FT_Open_Args;
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_New_Face */
- /* */
- /* <Description> */
- /* This function calls @FT_Open_Face to open a font by its pathname. */
- /* */
- /* <InOut> */
- /* library :: A handle to the library resource. */
- /* */
- /* <Input> */
- /* pathname :: A path to the font file. */
- /* */
- /* face_index :: See @FT_Open_Face for a detailed description of this */
- /* parameter. */
- /* */
- /* <Output> */
- /* aface :: A handle to a new face object. If `face_index' is */
- /* greater than or equal to zero, it must be non-NULL. */
- /* */
- /* <Return> */
- /* FreeType error code. 0~means success. */
- /* */
- /* <Note> */
- /* Use @FT_Done_Face to destroy the created @FT_Face object (along */
- /* with its slot and sizes). */
- /* */
- FT_EXPORT( FT_Error )
- FT_New_Face( FT_Library library,
- const char* filepathname,
- FT_Long face_index,
- FT_Face *aface );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_New_Memory_Face */
- /* */
- /* <Description> */
- /* This function calls @FT_Open_Face to open a font that has been */
- /* loaded into memory. */
- /* */
- /* <InOut> */
- /* library :: A handle to the library resource. */
- /* */
- /* <Input> */
- /* file_base :: A pointer to the beginning of the font data. */
- /* */
- /* file_size :: The size of the memory chunk used by the font data. */
- /* */
- /* face_index :: See @FT_Open_Face for a detailed description of this */
- /* parameter. */
- /* */
- /* <Output> */
- /* aface :: A handle to a new face object. If `face_index' is */
- /* greater than or equal to zero, it must be non-NULL. */
- /* */
- /* <Return> */
- /* FreeType error code. 0~means success. */
- /* */
- /* <Note> */
- /* You must not deallocate the memory before calling @FT_Done_Face. */
- /* */
- FT_EXPORT( FT_Error )
- FT_New_Memory_Face( FT_Library library,
- const FT_Byte* file_base,
- FT_Long file_size,
- FT_Long face_index,
- FT_Face *aface );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Open_Face */
- /* */
- /* <Description> */
- /* Create a face object from a given resource described by */
- /* @FT_Open_Args. */
- /* */
- /* <InOut> */
- /* library :: A handle to the library resource. */
- /* */
- /* <Input> */
- /* args :: A pointer to an `FT_Open_Args' structure that must */
- /* be filled by the caller. */
- /* */
- /* face_index :: This field holds two different values. Bits 0-15 */
- /* are the index of the face in the font file (starting */
- /* with value~0). Set it to~0 if there is only one */
- /* face in the font file. */
- /* */
- /* Bits 16-30 are relevant to GX variation fonts only, */
- /* specifying the named instance index for the current */
- /* face index (starting with value~1; value~0 makes */
- /* FreeType ignore named instances). For non-GX fonts, */
- /* bits 16-30 are ignored. Assuming that you want to */
- /* access the third named instance in face~4, */
- /* `face_index' should be set to 0x00030004. If you */
- /* want to access face~4 without GX variation handling, */
- /* simply set `face_index' to value~4. */
- /* */
- /* FT_Open_Face and its siblings can be used to quickly */
- /* check whether the font format of a given font */
- /* resource is supported by FreeType. In general, if */
- /* the `face_index' argument is negative, the */
- /* function's return value is~0 if the font format is */
- /* recognized, or non-zero otherwise. The function */
- /* allocates a more or less empty face handle in */
- /* `*aface' (if `aface' isn't NULL); the only two */
- /* useful fields in this special case are */
- /* `face->num_faces' and `face->style_flags'. For any */
- /* negative value of `face_index', `face->num_faces' */
- /* gives the number of faces within the font file. For */
- /* the negative value `-(N+1)' (with `N' a 16-bit */
- /* value), bits 16-30 in `face->style_flags' give the */
- /* number of named instances in face `N' if we have a */
- /* GX variation font (or zero otherwise). After */
- /* examination, the returned @FT_Face structure should */
- /* be deallocated with a call to @FT_Done_Face. */
- /* */
- /* <Output> */
- /* aface :: A handle to a new face object. If `face_index' is */
- /* greater than or equal to zero, it must be non-NULL. */
- /* */
- /* <Return> */
- /* FreeType error code. 0~means success. */
- /* */
- /* <Note> */
- /* Unlike FreeType 1.x, this function automatically creates a glyph */
- /* slot for the face object that can be accessed directly through */
- /* `face->glyph'. */
- /* */
- /* Each new face object created with this function also owns a */
- /* default @FT_Size object, accessible as `face->size'. */
- /* */
- /* One @FT_Library instance can have multiple face objects, this is, */
- /* @FT_Open_Face and its siblings can be called multiple times using */
- /* the same `library' argument. */
- /* */
- /* See the discussion of reference counters in the description of */
- /* @FT_Reference_Face. */
- /* */
- /* To loop over all faces, use code similar to the following snippet */
- /* (omitting the error handling). */
- /* */
- /* { */
- /* ... */
- /* FT_Face face; */
- /* FT_Long i, num_faces; */
- /* */
- /* */
- /* error = FT_Open_Face( library, args, -1, &face ); */
- /* if ( error ) { ... } */
- /* */
- /* num_faces = face->num_faces; */
- /* FT_Done_Face( face ); */
- /* */
- /* for ( i = 0; i < num_faces; i++ ) */
- /* { */
- /* ... */
- /* error = FT_Open_Face( library, args, i, &face ); */
- /* ... */
- /* FT_Done_Face( face ); */
- /* ... */
- /* } */
- /* } */
- /* */
- /* To loop over all valid values for `face_index', use something */
- /* similar to the following snippet, again without error handling. */
- /* The code accesses all faces immediately (thus only a single call */
- /* of `FT_Open_Face' within the do-loop), with and without named */
- /* instances. */
- /* */
- /* { */
- /* ... */
- /* FT_Face face; */
- /* */
- /* FT_Long num_faces = 0; */
- /* FT_Long num_instances = 0; */
- /* */
- /* FT_Long face_idx = 0; */
- /* FT_Long instance_idx = 0; */
- /* */
- /* */
- /* do */
- /* { */
- /* FT_Long id = ( instance_idx << 16 ) + face_idx; */
- /* */
- /* */
- /* error = FT_Open_Face( library, args, id, &face ); */
- /* if ( error ) { ... } */
- /* */
- /* num_faces = face->num_faces; */
- /* num_instances = face->style_flags >> 16; */
- /* */
- /* ... */
- /* */
- /* FT_Done_Face( face ); */
- /* */
- /* if ( instance_idx < num_instances ) */
- /* instance_idx++; */
- /* else */
- /* { */
- /* face_idx++; */
- /* instance_idx = 0; */
- /* } */
- /* */
- /* } while ( face_idx < num_faces ) */
- /* } */
- /* */
- FT_EXPORT( FT_Error )
- FT_Open_Face( FT_Library library,
- const FT_Open_Args* args,
- FT_Long face_index,
- FT_Face *aface );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Attach_File */
- /* */
- /* <Description> */
- /* This function calls @FT_Attach_Stream to attach a file. */
- /* */
- /* <InOut> */
- /* face :: The target face object. */
- /* */
- /* <Input> */
- /* filepathname :: The pathname. */
- /* */
- /* <Return> */
- /* FreeType error code. 0~means success. */
- /* */
- FT_EXPORT( FT_Error )
- FT_Attach_File( FT_Face face,
- const char* filepathname );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Attach_Stream */
- /* */
- /* <Description> */
- /* `Attach' data to a face object. Normally, this is used to read */
- /* additional information for the face object. For example, you can */
- /* attach an AFM file that comes with a Type~1 font to get the */
- /* kerning values and other metrics. */
- /* */
- /* <InOut> */
- /* face :: The target face object. */
- /* */
- /* <Input> */
- /* parameters :: A pointer to @FT_Open_Args that must be filled by */
- /* the caller. */
- /* */
- /* <Return> */
- /* FreeType error code. 0~means success. */
- /* */
- /* <Note> */
- /* The meaning of the `attach' (i.e., what really happens when the */
- /* new file is read) is not fixed by FreeType itself. It really */
- /* depends on the font format (and thus the font driver). */
- /* */
- /* Client applications are expected to know what they are doing */
- /* when invoking this function. Most drivers simply do not implement */
- /* file attachments. */
- /* */
- FT_EXPORT( FT_Error )
- FT_Attach_Stream( FT_Face face,
- FT_Open_Args* parameters );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Reference_Face */
- /* */
- /* <Description> */
- /* A counter gets initialized to~1 at the time an @FT_Face structure */
- /* is created. This function increments the counter. @FT_Done_Face */
- /* then only destroys a face if the counter is~1, otherwise it simply */
- /* decrements the counter. */
- /* */
- /* This function helps in managing life-cycles of structures that */
- /* reference @FT_Face objects. */
- /* */
- /* <Input> */
- /* face :: A handle to a target face object. */
- /* */
- /* <Return> */
- /* FreeType error code. 0~means success. */
- /* */
- /* <Since> */
- /* 2.4.2 */
- /* */
- FT_EXPORT( FT_Error )
- FT_Reference_Face( FT_Face face );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Done_Face */
- /* */
- /* <Description> */
- /* Discard a given face object, as well as all of its child slots and */
- /* sizes. */
- /* */
- /* <Input> */
- /* face :: A handle to a target face object. */
- /* */
- /* <Return> */
- /* FreeType error code. 0~means success. */
- /* */
- /* <Note> */
- /* See the discussion of reference counters in the description of */
- /* @FT_Reference_Face. */
- /* */
- FT_EXPORT( FT_Error )
- FT_Done_Face( FT_Face face );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Select_Size */
- /* */
- /* <Description> */
- /* Select a bitmap strike. */
- /* */
- /* <InOut> */
- /* face :: A handle to a target face object. */
- /* */
- /* <Input> */
- /* strike_index :: The index of the bitmap strike in the */
- /* `available_sizes' field of @FT_FaceRec structure. */
- /* */
- /* <Return> */
- /* FreeType error code. 0~means success. */
- /* */
- FT_EXPORT( FT_Error )
- FT_Select_Size( FT_Face face,
- FT_Int strike_index );
-
-
- /*************************************************************************/
- /* */
- /* <Enum> */
- /* FT_Size_Request_Type */
- /* */
- /* <Description> */
- /* An enumeration type that lists the supported size request types. */
- /* */
- /* <Values> */
- /* FT_SIZE_REQUEST_TYPE_NOMINAL :: */
- /* The nominal size. The `units_per_EM' field of @FT_FaceRec is */
- /* used to determine both scaling values. */
- /* */
- /* FT_SIZE_REQUEST_TYPE_REAL_DIM :: */
- /* The real dimension. The sum of the the `ascender' and (minus */
- /* of) the `descender' fields of @FT_FaceRec are used to determine */
- /* both scaling values. */
- /* */
- /* FT_SIZE_REQUEST_TYPE_BBOX :: */
- /* The font bounding box. The width and height of the `bbox' field */
- /* of @FT_FaceRec are used to determine the horizontal and vertical */
- /* scaling value, respectively. */
- /* */
- /* FT_SIZE_REQUEST_TYPE_CELL :: */
- /* The `max_advance_width' field of @FT_FaceRec is used to */
- /* determine the horizontal scaling value; the vertical scaling */
- /* value is determined the same way as */
- /* @FT_SIZE_REQUEST_TYPE_REAL_DIM does. Finally, both scaling */
- /* values are set to the smaller one. This type is useful if you */
- /* want to specify the font size for, say, a window of a given */
- /* dimension and 80x24 cells. */
- /* */
- /* FT_SIZE_REQUEST_TYPE_SCALES :: */
- /* Specify the scaling values directly. */
- /* */
- /* <Note> */
- /* The above descriptions only apply to scalable formats. For bitmap */
- /* formats, the behaviour is up to the driver. */
- /* */
- /* See the note section of @FT_Size_Metrics if you wonder how size */
- /* requesting relates to scaling values. */
- /* */
- typedef enum FT_Size_Request_Type_
- {
- FT_SIZE_REQUEST_TYPE_NOMINAL,
- FT_SIZE_REQUEST_TYPE_REAL_DIM,
- FT_SIZE_REQUEST_TYPE_BBOX,
- FT_SIZE_REQUEST_TYPE_CELL,
- FT_SIZE_REQUEST_TYPE_SCALES,
-
- FT_SIZE_REQUEST_TYPE_MAX
-
- } FT_Size_Request_Type;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* FT_Size_RequestRec */
- /* */
- /* <Description> */
- /* A structure used to model a size request. */
- /* */
- /* <Fields> */
- /* type :: See @FT_Size_Request_Type. */
- /* */
- /* width :: The desired width. */
- /* */
- /* height :: The desired height. */
- /* */
- /* horiResolution :: The horizontal resolution. If set to zero, */
- /* `width' is treated as a 26.6 fractional pixel */
- /* value. */
- /* */
- /* vertResolution :: The vertical resolution. If set to zero, */
- /* `height' is treated as a 26.6 fractional pixel */
- /* value. */
- /* */
- /* <Note> */
- /* If `width' is zero, then the horizontal scaling value is set equal */
- /* to the vertical scaling value, and vice versa. */
- /* */
- typedef struct FT_Size_RequestRec_
- {
- FT_Size_Request_Type type;
- FT_Long width;
- FT_Long height;
- FT_UInt horiResolution;
- FT_UInt vertResolution;
-
- } FT_Size_RequestRec;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* FT_Size_Request */
- /* */
- /* <Description> */
- /* A handle to a size request structure. */
- /* */
- typedef struct FT_Size_RequestRec_ *FT_Size_Request;
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Request_Size */
- /* */
- /* <Description> */
- /* Resize the scale of the active @FT_Size object in a face. */
- /* */
- /* <InOut> */
- /* face :: A handle to a target face object. */
- /* */
- /* <Input> */
- /* req :: A pointer to a @FT_Size_RequestRec. */
- /* */
- /* <Return> */
- /* FreeType error code. 0~means success. */
- /* */
- /* <Note> */
- /* Although drivers may select the bitmap strike matching the */
- /* request, you should not rely on this if you intend to select a */
- /* particular bitmap strike. Use @FT_Select_Size instead in that */
- /* case. */
- /* */
- /* The relation between the requested size and the resulting glyph */
- /* size is dependent entirely on how the size is defined in the */
- /* source face. The font designer chooses the final size of each */
- /* glyph relative to this size. For more information refer to */
- /* `http://www.freetype.org/freetype2/docs/glyphs/glyphs-2.html' */
- /* */
- /* Don't use this function if you are using the FreeType cache API. */
- /* */
- FT_EXPORT( FT_Error )
- FT_Request_Size( FT_Face face,
- FT_Size_Request req );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Set_Char_Size */
- /* */
- /* <Description> */
- /* This function calls @FT_Request_Size to request the nominal size */
- /* (in points). */
- /* */
- /* <InOut> */
- /* face :: A handle to a target face object. */
- /* */
- /* <Input> */
- /* char_width :: The nominal width, in 26.6 fractional points. */
- /* */
- /* char_height :: The nominal height, in 26.6 fractional points. */
- /* */
- /* horz_resolution :: The horizontal resolution in dpi. */
- /* */
- /* vert_resolution :: The vertical resolution in dpi. */
- /* */
- /* <Return> */
- /* FreeType error code. 0~means success. */
- /* */
- /* <Note> */
- /* If either the character width or height is zero, it is set equal */
- /* to the other value. */
- /* */
- /* If either the horizontal or vertical resolution is zero, it is set */
- /* equal to the other value. */
- /* */
- /* A character width or height smaller than 1pt is set to 1pt; if */
- /* both resolution values are zero, they are set to 72dpi. */
- /* */
- /* Don't use this function if you are using the FreeType cache API. */
- /* */
- FT_EXPORT( FT_Error )
- FT_Set_Char_Size( FT_Face face,
- FT_F26Dot6 char_width,
- FT_F26Dot6 char_height,
- FT_UInt horz_resolution,
- FT_UInt vert_resolution );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Set_Pixel_Sizes */
- /* */
- /* <Description> */
- /* This function calls @FT_Request_Size to request the nominal size */
- /* (in pixels). */
- /* */
- /* <InOut> */
- /* face :: A handle to the target face object. */
- /* */
- /* <Input> */
- /* pixel_width :: The nominal width, in pixels. */
- /* */
- /* pixel_height :: The nominal height, in pixels. */
- /* */
- /* <Return> */
- /* FreeType error code. 0~means success. */
- /* */
- /* <Note> */
- /* You should not rely on the resulting glyphs matching, or being */
- /* constrained, to this pixel size. Refer to @FT_Request_Size to */
- /* understand how requested sizes relate to actual sizes. */
- /* */
- /* Don't use this function if you are using the FreeType cache API. */
- /* */
- FT_EXPORT( FT_Error )
- FT_Set_Pixel_Sizes( FT_Face face,
- FT_UInt pixel_width,
- FT_UInt pixel_height );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Load_Glyph */
- /* */
- /* <Description> */
- /* A function used to load a single glyph into the glyph slot of a */
- /* face object. */
- /* */
- /* <InOut> */
- /* face :: A handle to the target face object where the glyph */
- /* is loaded. */
- /* */
- /* <Input> */
- /* glyph_index :: The index of the glyph in the font file. For */
- /* CID-keyed fonts (either in PS or in CFF format) */
- /* this argument specifies the CID value. */
- /* */
- /* load_flags :: A flag indicating what to load for this glyph. The */
- /* @FT_LOAD_XXX constants can be used to control the */
- /* glyph loading process (e.g., whether the outline */
- /* should be scaled, whether to load bitmaps or not, */
- /* whether to hint the outline, etc). */
- /* */
- /* <Return> */
- /* FreeType error code. 0~means success. */
- /* */
- /* <Note> */
- /* The loaded glyph may be transformed. See @FT_Set_Transform for */
- /* the details. */
- /* */
- /* For subsetted CID-keyed fonts, `FT_Err_Invalid_Argument' is */
- /* returned for invalid CID values (this is, for CID values that */
- /* don't have a corresponding glyph in the font). See the discussion */
- /* of the @FT_FACE_FLAG_CID_KEYED flag for more details. */
- /* */
- FT_EXPORT( FT_Error )
- FT_Load_Glyph( FT_Face face,
- FT_UInt glyph_index,
- FT_Int32 load_flags );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Load_Char */
- /* */
- /* <Description> */
- /* A function used to load a single glyph into the glyph slot of a */
- /* face object, according to its character code. */
- /* */
- /* <InOut> */
- /* face :: A handle to a target face object where the glyph */
- /* is loaded. */
- /* */
- /* <Input> */
- /* char_code :: The glyph's character code, according to the */
- /* current charmap used in the face. */
- /* */
- /* load_flags :: A flag indicating what to load for this glyph. The */
- /* @FT_LOAD_XXX constants can be used to control the */
- /* glyph loading process (e.g., whether the outline */
- /* should be scaled, whether to load bitmaps or not, */
- /* whether to hint the outline, etc). */
- /* */
- /* <Return> */
- /* FreeType error code. 0~means success. */
- /* */
- /* <Note> */
- /* This function simply calls @FT_Get_Char_Index and @FT_Load_Glyph. */
- /* */
- FT_EXPORT( FT_Error )
- FT_Load_Char( FT_Face face,
- FT_ULong char_code,
- FT_Int32 load_flags );
-
-
- /*************************************************************************
- *
- * @enum:
- * FT_LOAD_XXX
- *
- * @description:
- * A list of bit field constants used with @FT_Load_Glyph to indicate
- * what kind of operations to perform during glyph loading.
- *
- * @values:
- * FT_LOAD_DEFAULT ::
- * Corresponding to~0, this value is used as the default glyph load
- * operation. In this case, the following happens:
- *
- * 1. FreeType looks for a bitmap for the glyph corresponding to the
- * face's current size. If one is found, the function returns.
- * The bitmap data can be accessed from the glyph slot (see note
- * below).
- *
- * 2. If no embedded bitmap is searched or found, FreeType looks for a
- * scalable outline. If one is found, it is loaded from the font
- * file, scaled to device pixels, then `hinted' to the pixel grid
- * in order to optimize it. The outline data can be accessed from
- * the glyph slot (see note below).
- *
- * Note that by default, the glyph loader doesn't render outlines into
- * bitmaps. The following flags are used to modify this default
- * behaviour to more specific and useful cases.
- *
- * FT_LOAD_NO_SCALE ::
- * Don't scale the loaded outline glyph but keep it in font units.
- *
- * This flag implies @FT_LOAD_NO_HINTING and @FT_LOAD_NO_BITMAP, and
- * unsets @FT_LOAD_RENDER.
- *
- * If the font is `tricky' (see @FT_FACE_FLAG_TRICKY for more), using
- * FT_LOAD_NO_SCALE usually yields meaningless outlines because the
- * subglyphs must be scaled and positioned with hinting instructions.
- * This can be solved by loading the font without FT_LOAD_NO_SCALE and
- * setting the character size to `font->units_per_EM'.
- *
- * FT_LOAD_NO_HINTING ::
- * Disable hinting. This generally generates `blurrier' bitmap glyphs
- * when the glyph are rendered in any of the anti-aliased modes. See
- * also the note below.
- *
- * This flag is implied by @FT_LOAD_NO_SCALE.
- *
- * FT_LOAD_RENDER ::
- * Call @FT_Render_Glyph after the glyph is loaded. By default, the
- * glyph is rendered in @FT_RENDER_MODE_NORMAL mode. This can be
- * overridden by @FT_LOAD_TARGET_XXX or @FT_LOAD_MONOCHROME.
- *
- * This flag is unset by @FT_LOAD_NO_SCALE.
- *
- * FT_LOAD_NO_BITMAP ::
- * Ignore bitmap strikes when loading. Bitmap-only fonts ignore this
- * flag.
- *
- * @FT_LOAD_NO_SCALE always sets this flag.
- *
- * FT_LOAD_VERTICAL_LAYOUT ::
- * Load the glyph for vertical text layout. In particular, the
- * `advance' value in the @FT_GlyphSlotRec structure is set to the
- * `vertAdvance' value of the `metrics' field.
- *
- * In case @FT_HAS_VERTICAL doesn't return true, you shouldn't use
- * this flag currently. Reason is that in this case vertical metrics
- * get synthesized, and those values are not always consistent across
- * various font formats.
- *
- * FT_LOAD_FORCE_AUTOHINT ::
- * Indicates that the auto-hinter is preferred over the font's native
- * hinter. See also the note below.
- *
- * FT_LOAD_PEDANTIC ::
- * Indicates that the font driver should perform pedantic verifications
- * during glyph loading. This is mostly used to detect broken glyphs
- * in fonts. By default, FreeType tries to handle broken fonts also.
- *
- * In particular, errors from the TrueType bytecode engine are not
- * passed to the application if this flag is not set; this might
- * result in partially hinted or distorted glyphs in case a glyph's
- * bytecode is buggy.
- *
- * FT_LOAD_NO_RECURSE ::
- * Indicate that the font driver should not load composite glyphs
- * recursively. Instead, it should set the `num_subglyph' and
- * `subglyphs' values of the glyph slot accordingly, and set
- * `glyph->format' to @FT_GLYPH_FORMAT_COMPOSITE. The description of
- * subglyphs can then be accessed with @FT_Get_SubGlyph_Info.
- *
- * This flag implies @FT_LOAD_NO_SCALE and @FT_LOAD_IGNORE_TRANSFORM.
- *
- * FT_LOAD_IGNORE_TRANSFORM ::
- * Indicates that the transform matrix set by @FT_Set_Transform should
- * be ignored.
- *
- * FT_LOAD_MONOCHROME ::
- * This flag is used with @FT_LOAD_RENDER to indicate that you want to
- * render an outline glyph to a 1-bit monochrome bitmap glyph, with
- * 8~pixels packed into each byte of the bitmap data.
- *
- * Note that this has no effect on the hinting algorithm used. You
- * should rather use @FT_LOAD_TARGET_MONO so that the
- * monochrome-optimized hinting algorithm is used.
- *
- * FT_LOAD_LINEAR_DESIGN ::
- * Indicates that the `linearHoriAdvance' and `linearVertAdvance'
- * fields of @FT_GlyphSlotRec should be kept in font units. See
- * @FT_GlyphSlotRec for details.
- *
- * FT_LOAD_NO_AUTOHINT ::
- * Disable auto-hinter. See also the note below.
- *
- * FT_LOAD_COLOR ::
- * This flag is used to request loading of color embedded-bitmap
- * images. The resulting color bitmaps, if available, will have the
- * @FT_PIXEL_MODE_BGRA format. When the flag is not used and color
- * bitmaps are found, they will be converted to 256-level gray
- * bitmaps transparently. Those bitmaps will be in the
- * @FT_PIXEL_MODE_GRAY format.
- *
- * FT_LOAD_COMPUTE_METRICS ::
- * This flag sets computing glyph metrics without the use of bundled
- * metrics tables (for example, the `hdmx' table in TrueType fonts).
- * Well-behaving fonts have optimized bundled metrics and these should
- * be used. This flag is mainly used by font validating or font
- * editing applications, which need to ignore, verify, or edit those
- * tables.
- *
- * Currently, this flag is only implemented for TrueType fonts.
- *
- * FT_LOAD_CROP_BITMAP ::
- * Ignored. Deprecated.
- *
- * FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ::
- * Ignored. Deprecated.
- *
- * @note:
- * By default, hinting is enabled and the font's native hinter (see
- * @FT_FACE_FLAG_HINTER) is preferred over the auto-hinter. You can
- * disable hinting by setting @FT_LOAD_NO_HINTING or change the
- * precedence by setting @FT_LOAD_FORCE_AUTOHINT. You can also set
- * @FT_LOAD_NO_AUTOHINT in case you don't want the auto-hinter to be
- * used at all.
- *
- * See the description of @FT_FACE_FLAG_TRICKY for a special exception
- * (affecting only a handful of Asian fonts).
- *
- * Besides deciding which hinter to use, you can also decide which
- * hinting algorithm to use. See @FT_LOAD_TARGET_XXX for details.
- *
- * Note that the auto-hinter needs a valid Unicode cmap (either a native
- * one or synthesized by FreeType) for producing correct results. If a
- * font provides an incorrect mapping (for example, assigning the
- * character code U+005A, LATIN CAPITAL LETTER Z, to a glyph depicting a
- * mathematical integral sign), the auto-hinter might produce useless
- * results.
- *
- */
-#define FT_LOAD_DEFAULT 0x0
-#define FT_LOAD_NO_SCALE ( 1L << 0 )
-#define FT_LOAD_NO_HINTING ( 1L << 1 )
-#define FT_LOAD_RENDER ( 1L << 2 )
-#define FT_LOAD_NO_BITMAP ( 1L << 3 )
-#define FT_LOAD_VERTICAL_LAYOUT ( 1L << 4 )
-#define FT_LOAD_FORCE_AUTOHINT ( 1L << 5 )
-#define FT_LOAD_CROP_BITMAP ( 1L << 6 )
-#define FT_LOAD_PEDANTIC ( 1L << 7 )
-#define FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ( 1L << 9 )
-#define FT_LOAD_NO_RECURSE ( 1L << 10 )
-#define FT_LOAD_IGNORE_TRANSFORM ( 1L << 11 )
-#define FT_LOAD_MONOCHROME ( 1L << 12 )
-#define FT_LOAD_LINEAR_DESIGN ( 1L << 13 )
-#define FT_LOAD_NO_AUTOHINT ( 1L << 15 )
- /* Bits 16..19 are used by `FT_LOAD_TARGET_' */
-#define FT_LOAD_COLOR ( 1L << 20 )
-#define FT_LOAD_COMPUTE_METRICS ( 1L << 21 )
-
- /* */
-
- /* used internally only by certain font drivers! */
-#define FT_LOAD_ADVANCE_ONLY ( 1L << 8 )
-#define FT_LOAD_SBITS_ONLY ( 1L << 14 )
-
-
- /**************************************************************************
- *
- * @enum:
- * FT_LOAD_TARGET_XXX
- *
- * @description:
- * A list of values that are used to select a specific hinting algorithm
- * to use by the hinter. You should OR one of these values to your
- * `load_flags' when calling @FT_Load_Glyph.
- *
- * Note that font's native hinters may ignore the hinting algorithm you
- * have specified (e.g., the TrueType bytecode interpreter). You can set
- * @FT_LOAD_FORCE_AUTOHINT to ensure that the auto-hinter is used.
- *
- * Also note that @FT_LOAD_TARGET_LIGHT is an exception, in that it
- * always implies @FT_LOAD_FORCE_AUTOHINT.
- *
- * @values:
- * FT_LOAD_TARGET_NORMAL ::
- * This corresponds to the default hinting algorithm, optimized for
- * standard gray-level rendering. For monochrome output, use
- * @FT_LOAD_TARGET_MONO instead.
- *
- * FT_LOAD_TARGET_LIGHT ::
- * A lighter hinting algorithm for non-monochrome modes. Many
- * generated glyphs are more fuzzy but better resemble its original
- * shape. A bit like rendering on Mac OS~X.
- *
- * As a special exception, this target implies @FT_LOAD_FORCE_AUTOHINT.
- *
- * FT_LOAD_TARGET_MONO ::
- * Strong hinting algorithm that should only be used for monochrome
- * output. The result is probably unpleasant if the glyph is rendered
- * in non-monochrome modes.
- *
- * FT_LOAD_TARGET_LCD ::
- * A variant of @FT_LOAD_TARGET_NORMAL optimized for horizontally
- * decimated LCD displays.
- *
- * FT_LOAD_TARGET_LCD_V ::
- * A variant of @FT_LOAD_TARGET_NORMAL optimized for vertically
- * decimated LCD displays.
- *
- * @note:
- * You should use only _one_ of the FT_LOAD_TARGET_XXX values in your
- * `load_flags'. They can't be ORed.
- *
- * If @FT_LOAD_RENDER is also set, the glyph is rendered in the
- * corresponding mode (i.e., the mode that matches the used algorithm
- * best). An exeption is FT_LOAD_TARGET_MONO since it implies
- * @FT_LOAD_MONOCHROME.
- *
- * You can use a hinting algorithm that doesn't correspond to the same
- * rendering mode. As an example, it is possible to use the `light'
- * hinting algorithm and have the results rendered in horizontal LCD
- * pixel mode, with code like
- *
- * {
- * FT_Load_Glyph( face, glyph_index,
- * load_flags | FT_LOAD_TARGET_LIGHT );
- *
- * FT_Render_Glyph( face->glyph, FT_RENDER_MODE_LCD );
- * }
- *
- */
-#define FT_LOAD_TARGET_( x ) ( (FT_Int32)( (x) & 15 ) << 16 )
-
-#define FT_LOAD_TARGET_NORMAL FT_LOAD_TARGET_( FT_RENDER_MODE_NORMAL )
-#define FT_LOAD_TARGET_LIGHT FT_LOAD_TARGET_( FT_RENDER_MODE_LIGHT )
-#define FT_LOAD_TARGET_MONO FT_LOAD_TARGET_( FT_RENDER_MODE_MONO )
-#define FT_LOAD_TARGET_LCD FT_LOAD_TARGET_( FT_RENDER_MODE_LCD )
-#define FT_LOAD_TARGET_LCD_V FT_LOAD_TARGET_( FT_RENDER_MODE_LCD_V )
-
-
- /**************************************************************************
- *
- * @macro:
- * FT_LOAD_TARGET_MODE
- *
- * @description:
- * Return the @FT_Render_Mode corresponding to a given
- * @FT_LOAD_TARGET_XXX value.
- *
- */
-#define FT_LOAD_TARGET_MODE( x ) ( (FT_Render_Mode)( ( (x) >> 16 ) & 15 ) )
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Set_Transform */
- /* */
- /* <Description> */
- /* A function used to set the transformation that is applied to glyph */
- /* images when they are loaded into a glyph slot through */
- /* @FT_Load_Glyph. */
- /* */
- /* <InOut> */
- /* face :: A handle to the source face object. */
- /* */
- /* <Input> */
- /* matrix :: A pointer to the transformation's 2x2 matrix. Use~0 for */
- /* the identity matrix. */
- /* delta :: A pointer to the translation vector. Use~0 for the null */
- /* vector. */
- /* */
- /* <Note> */
- /* The transformation is only applied to scalable image formats after */
- /* the glyph has been loaded. It means that hinting is unaltered by */
- /* the transformation and is performed on the character size given in */
- /* the last call to @FT_Set_Char_Size or @FT_Set_Pixel_Sizes. */
- /* */
- /* Note that this also transforms the `face.glyph.advance' field, but */
- /* *not* the values in `face.glyph.metrics'. */
- /* */
- FT_EXPORT( void )
- FT_Set_Transform( FT_Face face,
- FT_Matrix* matrix,
- FT_Vector* delta );
-
-
- /*************************************************************************/
- /* */
- /* <Enum> */
- /* FT_Render_Mode */
- /* */
- /* <Description> */
- /* An enumeration type that lists the render modes supported by */
- /* FreeType~2. Each mode corresponds to a specific type of scanline */
- /* conversion performed on the outline. */
- /* */
- /* For bitmap fonts and embedded bitmaps the `bitmap->pixel_mode' */
- /* field in the @FT_GlyphSlotRec structure gives the format of the */
- /* returned bitmap. */
- /* */
- /* All modes except @FT_RENDER_MODE_MONO use 256 levels of opacity. */
- /* */
- /* <Values> */
- /* FT_RENDER_MODE_NORMAL :: */
- /* This is the default render mode; it corresponds to 8-bit */
- /* anti-aliased bitmaps. */
- /* */
- /* FT_RENDER_MODE_LIGHT :: */
- /* This is equivalent to @FT_RENDER_MODE_NORMAL. It is only */
- /* defined as a separate value because render modes are also used */
- /* indirectly to define hinting algorithm selectors. See */
- /* @FT_LOAD_TARGET_XXX for details. */
- /* */
- /* FT_RENDER_MODE_MONO :: */
- /* This mode corresponds to 1-bit bitmaps (with 2~levels of */
- /* opacity). */
- /* */
- /* FT_RENDER_MODE_LCD :: */
- /* This mode corresponds to horizontal RGB and BGR sub-pixel */
- /* displays like LCD screens. It produces 8-bit bitmaps that are */
- /* 3~times the width of the original glyph outline in pixels, and */
- /* which use the @FT_PIXEL_MODE_LCD mode. */
- /* */
- /* FT_RENDER_MODE_LCD_V :: */
- /* This mode corresponds to vertical RGB and BGR sub-pixel displays */
- /* (like PDA screens, rotated LCD displays, etc.). It produces */
- /* 8-bit bitmaps that are 3~times the height of the original */
- /* glyph outline in pixels and use the @FT_PIXEL_MODE_LCD_V mode. */
- /* */
- /* <Note> */
- /* The LCD-optimized glyph bitmaps produced by FT_Render_Glyph can be */
- /* filtered to reduce color-fringes by using @FT_Library_SetLcdFilter */
- /* (not active in the default builds). It is up to the caller to */
- /* either call @FT_Library_SetLcdFilter (if available) or do the */
- /* filtering itself. */
- /* */
- /* The selected render mode only affects vector glyphs of a font. */
- /* Embedded bitmaps often have a different pixel mode like */
- /* @FT_PIXEL_MODE_MONO. You can use @FT_Bitmap_Convert to transform */
- /* them into 8-bit pixmaps. */
- /* */
- typedef enum FT_Render_Mode_
- {
- FT_RENDER_MODE_NORMAL = 0,
- FT_RENDER_MODE_LIGHT,
- FT_RENDER_MODE_MONO,
- FT_RENDER_MODE_LCD,
- FT_RENDER_MODE_LCD_V,
-
- FT_RENDER_MODE_MAX
-
- } FT_Render_Mode;
-
-
- /* these constants are deprecated; use the corresponding */
- /* `FT_Render_Mode' values instead */
-#define ft_render_mode_normal FT_RENDER_MODE_NORMAL
-#define ft_render_mode_mono FT_RENDER_MODE_MONO
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Render_Glyph */
- /* */
- /* <Description> */
- /* Convert a given glyph image to a bitmap. It does so by inspecting */
- /* the glyph image format, finding the relevant renderer, and */
- /* invoking it. */
- /* */
- /* <InOut> */
- /* slot :: A handle to the glyph slot containing the image to */
- /* convert. */
- /* */
- /* <Input> */
- /* render_mode :: This is the render mode used to render the glyph */
- /* image into a bitmap. See @FT_Render_Mode for a */
- /* list of possible values. */
- /* */
- /* <Return> */
- /* FreeType error code. 0~means success. */
- /* */
- /* <Note> */
- /* To get meaningful results, font scaling values must be set with */
- /* functions like @FT_Set_Char_Size before calling FT_Render_Glyph. */
- /* */
- FT_EXPORT( FT_Error )
- FT_Render_Glyph( FT_GlyphSlot slot,
- FT_Render_Mode render_mode );
-
-
- /*************************************************************************/
- /* */
- /* <Enum> */
- /* FT_Kerning_Mode */
- /* */
- /* <Description> */
- /* An enumeration used to specify which kerning values to return in */
- /* @FT_Get_Kerning. */
- /* */
- /* <Values> */
- /* FT_KERNING_DEFAULT :: Return grid-fitted kerning distances in */
- /* pixels (value is~0). Whether they are */
- /* scaled depends on @FT_LOAD_NO_SCALE. */
- /* */
- /* FT_KERNING_UNFITTED :: Return un-grid-fitted kerning distances in */
- /* 26.6 fractional pixels. Whether they are */
- /* scaled depends on @FT_LOAD_NO_SCALE. */
- /* */
- /* FT_KERNING_UNSCALED :: Return the kerning vector in original font */
- /* units. */
- /* */
- /* <Note> */
- /* FT_KERNING_DEFAULT returns full pixel values; it also makes */
- /* FreeType heuristically scale down kerning distances at small ppem */
- /* values so that they don't become too big. */
- /* */
- typedef enum FT_Kerning_Mode_
- {
- FT_KERNING_DEFAULT = 0,
- FT_KERNING_UNFITTED,
- FT_KERNING_UNSCALED
-
- } FT_Kerning_Mode;
-
-
- /* these constants are deprecated; use the corresponding */
- /* `FT_Kerning_Mode' values instead */
-#define ft_kerning_default FT_KERNING_DEFAULT
-#define ft_kerning_unfitted FT_KERNING_UNFITTED
-#define ft_kerning_unscaled FT_KERNING_UNSCALED
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Get_Kerning */
- /* */
- /* <Description> */
- /* Return the kerning vector between two glyphs of a same face. */
- /* */
- /* <Input> */
- /* face :: A handle to a source face object. */
- /* */
- /* left_glyph :: The index of the left glyph in the kern pair. */
- /* */
- /* right_glyph :: The index of the right glyph in the kern pair. */
- /* */
- /* kern_mode :: See @FT_Kerning_Mode for more information. */
- /* Determines the scale and dimension of the returned */
- /* kerning vector. */
- /* */
- /* <Output> */
- /* akerning :: The kerning vector. This is either in font units, */
- /* fractional pixels (26.6 format), or pixels for */
- /* scalable formats, and in pixels for fixed-sizes */
- /* formats. */
- /* */
- /* <Return> */
- /* FreeType error code. 0~means success. */
- /* */
- /* <Note> */
- /* Only horizontal layouts (left-to-right & right-to-left) are */
- /* supported by this method. Other layouts, or more sophisticated */
- /* kernings, are out of the scope of this API function -- they can be */
- /* implemented through format-specific interfaces. */
- /* */
- FT_EXPORT( FT_Error )
- FT_Get_Kerning( FT_Face face,
- FT_UInt left_glyph,
- FT_UInt right_glyph,
- FT_UInt kern_mode,
- FT_Vector *akerning );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Get_Track_Kerning */
- /* */
- /* <Description> */
- /* Return the track kerning for a given face object at a given size. */
- /* */
- /* <Input> */
- /* face :: A handle to a source face object. */
- /* */
- /* point_size :: The point size in 16.16 fractional points. */
- /* */
- /* degree :: The degree of tightness. Increasingly negative */
- /* values represent tighter track kerning, while */
- /* increasingly positive values represent looser track */
- /* kerning. Value zero means no track kerning. */
- /* */
- /* <Output> */
- /* akerning :: The kerning in 16.16 fractional points, to be */
- /* uniformly applied between all glyphs. */
- /* */
- /* <Return> */
- /* FreeType error code. 0~means success. */
- /* */
- /* <Note> */
- /* Currently, only the Type~1 font driver supports track kerning, */
- /* using data from AFM files (if attached with @FT_Attach_File or */
- /* @FT_Attach_Stream). */
- /* */
- /* Only very few AFM files come with track kerning data; please refer */
- /* to the Adobe's AFM specification for more details. */
- /* */
- FT_EXPORT( FT_Error )
- FT_Get_Track_Kerning( FT_Face face,
- FT_Fixed point_size,
- FT_Int degree,
- FT_Fixed* akerning );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Get_Glyph_Name */
- /* */
- /* <Description> */
- /* Retrieve the ASCII name of a given glyph in a face. This only */
- /* works for those faces where @FT_HAS_GLYPH_NAMES(face) returns~1. */
- /* */
- /* <Input> */
- /* face :: A handle to a source face object. */
- /* */
- /* glyph_index :: The glyph index. */
- /* */
- /* buffer_max :: The maximum number of bytes available in the */
- /* buffer. */
- /* */
- /* <Output> */
- /* buffer :: A pointer to a target buffer where the name is */
- /* copied to. */
- /* */
- /* <Return> */
- /* FreeType error code. 0~means success. */
- /* */
- /* <Note> */
- /* An error is returned if the face doesn't provide glyph names or if */
- /* the glyph index is invalid. In all cases of failure, the first */
- /* byte of `buffer' is set to~0 to indicate an empty name. */
- /* */
- /* The glyph name is truncated to fit within the buffer if it is too */
- /* long. The returned string is always zero-terminated. */
- /* */
- /* Be aware that FreeType reorders glyph indices internally so that */
- /* glyph index~0 always corresponds to the `missing glyph' (called */
- /* `.notdef'). */
- /* */
- /* This function always returns an error if the config macro */
- /* `FT_CONFIG_OPTION_NO_GLYPH_NAMES' is not defined in `ftoptions.h'. */
- /* */
- FT_EXPORT( FT_Error )
- FT_Get_Glyph_Name( FT_Face face,
- FT_UInt glyph_index,
- FT_Pointer buffer,
- FT_UInt buffer_max );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Get_Postscript_Name */
- /* */
- /* <Description> */
- /* Retrieve the ASCII PostScript name of a given face, if available. */
- /* This only works with PostScript and TrueType fonts. */
- /* */
- /* <Input> */
- /* face :: A handle to the source face object. */
- /* */
- /* <Return> */
- /* A pointer to the face's PostScript name. NULL if unavailable. */
- /* */
- /* <Note> */
- /* The returned pointer is owned by the face and is destroyed with */
- /* it. */
- /* */
- FT_EXPORT( const char* )
- FT_Get_Postscript_Name( FT_Face face );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Select_Charmap */
- /* */
- /* <Description> */
- /* Select a given charmap by its encoding tag (as listed in */
- /* `freetype.h'). */
- /* */
- /* <InOut> */
- /* face :: A handle to the source face object. */
- /* */
- /* <Input> */
- /* encoding :: A handle to the selected encoding. */
- /* */
- /* <Return> */
- /* FreeType error code. 0~means success. */
- /* */
- /* <Note> */
- /* This function returns an error if no charmap in the face */
- /* corresponds to the encoding queried here. */
- /* */
- /* Because many fonts contain more than a single cmap for Unicode */
- /* encoding, this function has some special code to select the one */
- /* that covers Unicode best (`best' in the sense that a UCS-4 cmap is */
- /* preferred to a UCS-2 cmap). It is thus preferable to */
- /* @FT_Set_Charmap in this case. */
- /* */
- FT_EXPORT( FT_Error )
- FT_Select_Charmap( FT_Face face,
- FT_Encoding encoding );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Set_Charmap */
- /* */
- /* <Description> */
- /* Select a given charmap for character code to glyph index mapping. */
- /* */
- /* <InOut> */
- /* face :: A handle to the source face object. */
- /* */
- /* <Input> */
- /* charmap :: A handle to the selected charmap. */
- /* */
- /* <Return> */
- /* FreeType error code. 0~means success. */
- /* */
- /* <Note> */
- /* This function returns an error if the charmap is not part of */
- /* the face (i.e., if it is not listed in the `face->charmaps' */
- /* table). */
- /* */
- /* It also fails if a type~14 charmap is selected. */
- /* */
- FT_EXPORT( FT_Error )
- FT_Set_Charmap( FT_Face face,
- FT_CharMap charmap );
-
-
- /*************************************************************************
- *
- * @function:
- * FT_Get_Charmap_Index
- *
- * @description:
- * Retrieve index of a given charmap.
- *
- * @input:
- * charmap ::
- * A handle to a charmap.
- *
- * @return:
- * The index into the array of character maps within the face to which
- * `charmap' belongs. If an error occurs, -1 is returned.
- *
- */
- FT_EXPORT( FT_Int )
- FT_Get_Charmap_Index( FT_CharMap charmap );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Get_Char_Index */
- /* */
- /* <Description> */
- /* Return the glyph index of a given character code. This function */
- /* uses a charmap object to do the mapping. */
- /* */
- /* <Input> */
- /* face :: A handle to the source face object. */
- /* */
- /* charcode :: The character code. */
- /* */
- /* <Return> */
- /* The glyph index. 0~means `undefined character code'. */
- /* */
- /* <Note> */
- /* If you use FreeType to manipulate the contents of font files */
- /* directly, be aware that the glyph index returned by this function */
- /* doesn't always correspond to the internal indices used within the */
- /* file. This is done to ensure that value~0 always corresponds to */
- /* the `missing glyph'. If the first glyph is not named `.notdef', */
- /* then for Type~1 and Type~42 fonts, `.notdef' will be moved into */
- /* the glyph ID~0 position, and whatever was there will be moved to */
- /* the position `.notdef' had. For Type~1 fonts, if there is no */
- /* `.notdef' glyph at all, then one will be created at index~0 and */
- /* whatever was there will be moved to the last index -- Type~42 */
- /* fonts are considered invalid under this condition. */
- /* */
- FT_EXPORT( FT_UInt )
- FT_Get_Char_Index( FT_Face face,
- FT_ULong charcode );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Get_First_Char */
- /* */
- /* <Description> */
- /* This function is used to return the first character code in the */
- /* current charmap of a given face. It also returns the */
- /* corresponding glyph index. */
- /* */
- /* <Input> */
- /* face :: A handle to the source face object. */
- /* */
- /* <Output> */
- /* agindex :: Glyph index of first character code. 0~if charmap is */
- /* empty. */
- /* */
- /* <Return> */
- /* The charmap's first character code. */
- /* */
- /* <Note> */
- /* You should use this function with @FT_Get_Next_Char to be able to */
- /* parse all character codes available in a given charmap. The code */
- /* should look like this: */
- /* */
- /* { */
- /* FT_ULong charcode; */
- /* FT_UInt gindex; */
- /* */
- /* */
- /* charcode = FT_Get_First_Char( face, &gindex ); */
- /* while ( gindex != 0 ) */
- /* { */
- /* ... do something with (charcode,gindex) pair ... */
- /* */
- /* charcode = FT_Get_Next_Char( face, charcode, &gindex ); */
- /* } */
- /* } */
- /* */
- /* Be aware that character codes can have values up to 0xFFFFFFFF; */
- /* this might happen for non-Unicode or malformed cmaps. However, */
- /* even with regular Unicode encoding, so-called `last resort fonts' */
- /* (using SFNT cmap format 13, see function @FT_Get_CMap_Format) */
- /* normally have entries for all Unicode characters up to 0x1FFFFF, */
- /* which can cause *a lot* of iterations. */
- /* */
- /* Note that `*agindex' is set to~0 if the charmap is empty. The */
- /* result itself can be~0 in two cases: if the charmap is empty or */
- /* if the value~0 is the first valid character code. */
- /* */
- FT_EXPORT( FT_ULong )
- FT_Get_First_Char( FT_Face face,
- FT_UInt *agindex );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Get_Next_Char */
- /* */
- /* <Description> */
- /* This function is used to return the next character code in the */
- /* current charmap of a given face following the value `char_code', */
- /* as well as the corresponding glyph index. */
- /* */
- /* <Input> */
- /* face :: A handle to the source face object. */
- /* char_code :: The starting character code. */
- /* */
- /* <Output> */
- /* agindex :: Glyph index of next character code. 0~if charmap */
- /* is empty. */
- /* */
- /* <Return> */
- /* The charmap's next character code. */
- /* */
- /* <Note> */
- /* You should use this function with @FT_Get_First_Char to walk */
- /* over all character codes available in a given charmap. See the */
- /* note for this function for a simple code example. */
- /* */
- /* Note that `*agindex' is set to~0 when there are no more codes in */
- /* the charmap. */
- /* */
- FT_EXPORT( FT_ULong )
- FT_Get_Next_Char( FT_Face face,
- FT_ULong char_code,
- FT_UInt *agindex );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Get_Name_Index */
- /* */
- /* <Description> */
- /* Return the glyph index of a given glyph name. This function uses */
- /* driver specific objects to do the translation. */
- /* */
- /* <Input> */
- /* face :: A handle to the source face object. */
- /* */
- /* glyph_name :: The glyph name. */
- /* */
- /* <Return> */
- /* The glyph index. 0~means `undefined character code'. */
- /* */
- FT_EXPORT( FT_UInt )
- FT_Get_Name_Index( FT_Face face,
- FT_String* glyph_name );
-
-
- /*************************************************************************
- *
- * @macro:
- * FT_SUBGLYPH_FLAG_XXX
- *
- * @description:
- * A list of constants used to describe subglyphs. Please refer to the
- * TrueType specification for the meaning of the various flags.
- *
- * @values:
- * FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS ::
- * FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES ::
- * FT_SUBGLYPH_FLAG_ROUND_XY_TO_GRID ::
- * FT_SUBGLYPH_FLAG_SCALE ::
- * FT_SUBGLYPH_FLAG_XY_SCALE ::
- * FT_SUBGLYPH_FLAG_2X2 ::
- * FT_SUBGLYPH_FLAG_USE_MY_METRICS ::
- *
- */
-#define FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS 1
-#define FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES 2
-#define FT_SUBGLYPH_FLAG_ROUND_XY_TO_GRID 4
-#define FT_SUBGLYPH_FLAG_SCALE 8
-#define FT_SUBGLYPH_FLAG_XY_SCALE 0x40
-#define FT_SUBGLYPH_FLAG_2X2 0x80
-#define FT_SUBGLYPH_FLAG_USE_MY_METRICS 0x200
-
-
- /*************************************************************************
- *
- * @func:
- * FT_Get_SubGlyph_Info
- *
- * @description:
- * Retrieve a description of a given subglyph. Only use it if
- * `glyph->format' is @FT_GLYPH_FORMAT_COMPOSITE; an error is
- * returned otherwise.
- *
- * @input:
- * glyph ::
- * The source glyph slot.
- *
- * sub_index ::
- * The index of the subglyph. Must be less than
- * `glyph->num_subglyphs'.
- *
- * @output:
- * p_index ::
- * The glyph index of the subglyph.
- *
- * p_flags ::
- * The subglyph flags, see @FT_SUBGLYPH_FLAG_XXX.
- *
- * p_arg1 ::
- * The subglyph's first argument (if any).
- *
- * p_arg2 ::
- * The subglyph's second argument (if any).
- *
- * p_transform ::
- * The subglyph transformation (if any).
- *
- * @return:
- * FreeType error code. 0~means success.
- *
- * @note:
- * The values of `*p_arg1', `*p_arg2', and `*p_transform' must be
- * interpreted depending on the flags returned in `*p_flags'. See the
- * TrueType specification for details.
- *
- */
- FT_EXPORT( FT_Error )
- FT_Get_SubGlyph_Info( FT_GlyphSlot glyph,
- FT_UInt sub_index,
- FT_Int *p_index,
- FT_UInt *p_flags,
- FT_Int *p_arg1,
- FT_Int *p_arg2,
- FT_Matrix *p_transform );
-
-
- /*************************************************************************/
- /* */
- /* <Enum> */
- /* FT_FSTYPE_XXX */
- /* */
- /* <Description> */
- /* A list of bit flags used in the `fsType' field of the OS/2 table */
- /* in a TrueType or OpenType font and the `FSType' entry in a */
- /* PostScript font. These bit flags are returned by */
- /* @FT_Get_FSType_Flags; they inform client applications of embedding */
- /* and subsetting restrictions associated with a font. */
- /* */
- /* See */
- /* http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/FontPolicies.pdf */
- /* for more details. */
- /* */
- /* <Values> */
- /* FT_FSTYPE_INSTALLABLE_EMBEDDING :: */
- /* Fonts with no fsType bit set may be embedded and permanently */
- /* installed on the remote system by an application. */
- /* */
- /* FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING :: */
- /* Fonts that have only this bit set must not be modified, embedded */
- /* or exchanged in any manner without first obtaining permission of */
- /* the font software copyright owner. */
- /* */
- /* FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING :: */
- /* If this bit is set, the font may be embedded and temporarily */
- /* loaded on the remote system. Documents containing Preview & */
- /* Print fonts must be opened `read-only'; no edits can be applied */
- /* to the document. */
- /* */
- /* FT_FSTYPE_EDITABLE_EMBEDDING :: */
- /* If this bit is set, the font may be embedded but must only be */
- /* installed temporarily on other systems. In contrast to Preview */
- /* & Print fonts, documents containing editable fonts may be opened */
- /* for reading, editing is permitted, and changes may be saved. */
- /* */
- /* FT_FSTYPE_NO_SUBSETTING :: */
- /* If this bit is set, the font may not be subsetted prior to */
- /* embedding. */
- /* */
- /* FT_FSTYPE_BITMAP_EMBEDDING_ONLY :: */
- /* If this bit is set, only bitmaps contained in the font may be */
- /* embedded; no outline data may be embedded. If there are no */
- /* bitmaps available in the font, then the font is unembeddable. */
- /* */
- /* <Note> */
- /* The flags are ORed together, thus more than a single value can be */
- /* returned. */
- /* */
- /* While the fsType flags can indicate that a font may be embedded, a */
- /* license with the font vendor may be separately required to use the */
- /* font in this way. */
- /* */
-#define FT_FSTYPE_INSTALLABLE_EMBEDDING 0x0000
-#define FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING 0x0002
-#define FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING 0x0004
-#define FT_FSTYPE_EDITABLE_EMBEDDING 0x0008
-#define FT_FSTYPE_NO_SUBSETTING 0x0100
-#define FT_FSTYPE_BITMAP_EMBEDDING_ONLY 0x0200
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Get_FSType_Flags */
- /* */
- /* <Description> */
- /* Return the fsType flags for a font. */
- /* */
- /* <Input> */
- /* face :: A handle to the source face object. */
- /* */
- /* <Return> */
- /* The fsType flags, @FT_FSTYPE_XXX. */
- /* */
- /* <Note> */
- /* Use this function rather than directly reading the `fs_type' field */
- /* in the @PS_FontInfoRec structure, which is only guaranteed to */
- /* return the correct results for Type~1 fonts. */
- /* */
- /* <Since> */
- /* 2.3.8 */
- /* */
- FT_EXPORT( FT_UShort )
- FT_Get_FSType_Flags( FT_Face face );
-
-
- /*************************************************************************/
- /* */
- /* <Section> */
- /* glyph_variants */
- /* */
- /* <Title> */
- /* Glyph Variants */
- /* */
- /* <Abstract> */
- /* The FreeType~2 interface to Unicode Ideographic Variation */
- /* Sequences (IVS), using the SFNT cmap format~14. */
- /* */
- /* <Description> */
- /* Many CJK characters have variant forms. They are a sort of grey */
- /* area somewhere between being totally irrelevant and semantically */
- /* distinct; for this reason, the Unicode consortium decided to */
- /* introduce Ideographic Variation Sequences (IVS), consisting of a */
- /* Unicode base character and one of 240 variant selectors */
- /* (U+E0100-U+E01EF), instead of further extending the already huge */
- /* code range for CJK characters. */
- /* */
- /* An IVS is registered and unique; for further details please refer */
- /* to Unicode Technical Standard #37, the Ideographic Variation */
- /* Database: */
- /* */
- /* http://www.unicode.org/reports/tr37/ */
- /* */
- /* To date (November 2014), the character with the most variants is */
- /* U+9089, having 32 such IVS. */
- /* */
- /* Adobe and MS decided to support IVS with a new cmap subtable */
- /* (format~14). It is an odd subtable because it is not a mapping of */
- /* input code points to glyphs, but contains lists of all variants */
- /* supported by the font. */
- /* */
- /* A variant may be either `default' or `non-default'. A default */
- /* variant is the one you will get for that code point if you look it */
- /* up in the standard Unicode cmap. A non-default variant is a */
- /* different glyph. */
- /* */
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Face_GetCharVariantIndex */
- /* */
- /* <Description> */
- /* Return the glyph index of a given character code as modified by */
- /* the variation selector. */
- /* */
- /* <Input> */
- /* face :: */
- /* A handle to the source face object. */
- /* */
- /* charcode :: */
- /* The character code point in Unicode. */
- /* */
- /* variantSelector :: */
- /* The Unicode code point of the variation selector. */
- /* */
- /* <Return> */
- /* The glyph index. 0~means either `undefined character code', or */
- /* `undefined selector code', or `no variation selector cmap */
- /* subtable', or `current CharMap is not Unicode'. */
- /* */
- /* <Note> */
- /* If you use FreeType to manipulate the contents of font files */
- /* directly, be aware that the glyph index returned by this function */
- /* doesn't always correspond to the internal indices used within */
- /* the file. This is done to ensure that value~0 always corresponds */
- /* to the `missing glyph'. */
- /* */
- /* This function is only meaningful if */
- /* a) the font has a variation selector cmap sub table, */
- /* and */
- /* b) the current charmap has a Unicode encoding. */
- /* */
- /* <Since> */
- /* 2.3.6 */
- /* */
- FT_EXPORT( FT_UInt )
- FT_Face_GetCharVariantIndex( FT_Face face,
- FT_ULong charcode,
- FT_ULong variantSelector );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Face_GetCharVariantIsDefault */
- /* */
- /* <Description> */
- /* Check whether this variant of this Unicode character is the one to */
- /* be found in the `cmap'. */
- /* */
- /* <Input> */
- /* face :: */
- /* A handle to the source face object. */
- /* */
- /* charcode :: */
- /* The character codepoint in Unicode. */
- /* */
- /* variantSelector :: */
- /* The Unicode codepoint of the variation selector. */
- /* */
- /* <Return> */
- /* 1~if found in the standard (Unicode) cmap, 0~if found in the */
- /* variation selector cmap, or -1 if it is not a variant. */
- /* */
- /* <Note> */
- /* This function is only meaningful if the font has a variation */
- /* selector cmap subtable. */
- /* */
- /* <Since> */
- /* 2.3.6 */
- /* */
- FT_EXPORT( FT_Int )
- FT_Face_GetCharVariantIsDefault( FT_Face face,
- FT_ULong charcode,
- FT_ULong variantSelector );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Face_GetVariantSelectors */
- /* */
- /* <Description> */
- /* Return a zero-terminated list of Unicode variant selectors found */
- /* in the font. */
- /* */
- /* <Input> */
- /* face :: */
- /* A handle to the source face object. */
- /* */
- /* <Return> */
- /* A pointer to an array of selector code points, or NULL if there is */
- /* no valid variant selector cmap subtable. */
- /* */
- /* <Note> */
- /* The last item in the array is~0; the array is owned by the */
- /* @FT_Face object but can be overwritten or released on the next */
- /* call to a FreeType function. */
- /* */
- /* <Since> */
- /* 2.3.6 */
- /* */
- FT_EXPORT( FT_UInt32* )
- FT_Face_GetVariantSelectors( FT_Face face );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Face_GetVariantsOfChar */
- /* */
- /* <Description> */
- /* Return a zero-terminated list of Unicode variant selectors found */
- /* for the specified character code. */
- /* */
- /* <Input> */
- /* face :: */
- /* A handle to the source face object. */
- /* */
- /* charcode :: */
- /* The character codepoint in Unicode. */
- /* */
- /* <Return> */
- /* A pointer to an array of variant selector code points that are */
- /* active for the given character, or NULL if the corresponding list */
- /* is empty. */
- /* */
- /* <Note> */
- /* The last item in the array is~0; the array is owned by the */
- /* @FT_Face object but can be overwritten or released on the next */
- /* call to a FreeType function. */
- /* */
- /* <Since> */
- /* 2.3.6 */
- /* */
- FT_EXPORT( FT_UInt32* )
- FT_Face_GetVariantsOfChar( FT_Face face,
- FT_ULong charcode );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Face_GetCharsOfVariant */
- /* */
- /* <Description> */
- /* Return a zero-terminated list of Unicode character codes found for */
- /* the specified variant selector. */
- /* */
- /* <Input> */
- /* face :: */
- /* A handle to the source face object. */
- /* */
- /* variantSelector :: */
- /* The variant selector code point in Unicode. */
- /* */
- /* <Return> */
- /* A list of all the code points that are specified by this selector */
- /* (both default and non-default codes are returned) or NULL if there */
- /* is no valid cmap or the variant selector is invalid. */
- /* */
- /* <Note> */
- /* The last item in the array is~0; the array is owned by the */
- /* @FT_Face object but can be overwritten or released on the next */
- /* call to a FreeType function. */
- /* */
- /* <Since> */
- /* 2.3.6 */
- /* */
- FT_EXPORT( FT_UInt32* )
- FT_Face_GetCharsOfVariant( FT_Face face,
- FT_ULong variantSelector );
-
-
- /*************************************************************************/
- /* */
- /* <Section> */
- /* computations */
- /* */
- /* <Title> */
- /* Computations */
- /* */
- /* <Abstract> */
- /* Crunching fixed numbers and vectors. */
- /* */
- /* <Description> */
- /* This section contains various functions used to perform */
- /* computations on 16.16 fixed-float numbers or 2d vectors. */
- /* */
- /* <Order> */
- /* FT_MulDiv */
- /* FT_MulFix */
- /* FT_DivFix */
- /* FT_RoundFix */
- /* FT_CeilFix */
- /* FT_FloorFix */
- /* FT_Vector_Transform */
- /* FT_Matrix_Multiply */
- /* FT_Matrix_Invert */
- /* */
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_MulDiv */
- /* */
- /* <Description> */
- /* A very simple function used to perform the computation `(a*b)/c' */
- /* with maximum accuracy (it uses a 64-bit intermediate integer */
- /* whenever necessary). */
- /* */
- /* This function isn't necessarily as fast as some processor specific */
- /* operations, but is at least completely portable. */
- /* */
- /* <Input> */
- /* a :: The first multiplier. */
- /* b :: The second multiplier. */
- /* c :: The divisor. */
- /* */
- /* <Return> */
- /* The result of `(a*b)/c'. This function never traps when trying to */
- /* divide by zero; it simply returns `MaxInt' or `MinInt' depending */
- /* on the signs of `a' and `b'. */
- /* */
- FT_EXPORT( FT_Long )
- FT_MulDiv( FT_Long a,
- FT_Long b,
- FT_Long c );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_MulFix */
- /* */
- /* <Description> */
- /* A very simple function used to perform the computation */
- /* `(a*b)/0x10000' with maximum accuracy. Most of the time this is */
- /* used to multiply a given value by a 16.16 fixed-point factor. */
- /* */
- /* <Input> */
- /* a :: The first multiplier. */
- /* b :: The second multiplier. Use a 16.16 factor here whenever */
- /* possible (see note below). */
- /* */
- /* <Return> */
- /* The result of `(a*b)/0x10000'. */
- /* */
- /* <Note> */
- /* This function has been optimized for the case where the absolute */
- /* value of `a' is less than 2048, and `b' is a 16.16 scaling factor. */
- /* As this happens mainly when scaling from notional units to */
- /* fractional pixels in FreeType, it resulted in noticeable speed */
- /* improvements between versions 2.x and 1.x. */
- /* */
- /* As a conclusion, always try to place a 16.16 factor as the */
- /* _second_ argument of this function; this can make a great */
- /* difference. */
- /* */
- FT_EXPORT( FT_Long )
- FT_MulFix( FT_Long a,
- FT_Long b );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_DivFix */
- /* */
- /* <Description> */
- /* A very simple function used to perform the computation */
- /* `(a*0x10000)/b' with maximum accuracy. Most of the time, this is */
- /* used to divide a given value by a 16.16 fixed-point factor. */
- /* */
- /* <Input> */
- /* a :: The numerator. */
- /* b :: The denominator. Use a 16.16 factor here. */
- /* */
- /* <Return> */
- /* The result of `(a*0x10000)/b'. */
- /* */
- FT_EXPORT( FT_Long )
- FT_DivFix( FT_Long a,
- FT_Long b );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_RoundFix */
- /* */
- /* <Description> */
- /* A very simple function used to round a 16.16 fixed number. */
- /* */
- /* <Input> */
- /* a :: The number to be rounded. */
- /* */
- /* <Return> */
- /* `a' rounded to nearest 16.16 fixed integer, halfway cases away */
- /* from zero. */
- /* */
- FT_EXPORT( FT_Fixed )
- FT_RoundFix( FT_Fixed a );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_CeilFix */
- /* */
- /* <Description> */
- /* A very simple function used to compute the ceiling function of a */
- /* 16.16 fixed number. */
- /* */
- /* <Input> */
- /* a :: The number for which the ceiling function is to be computed. */
- /* */
- /* <Return> */
- /* `a' rounded towards plus infinity. */
- /* */
- FT_EXPORT( FT_Fixed )
- FT_CeilFix( FT_Fixed a );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_FloorFix */
- /* */
- /* <Description> */
- /* A very simple function used to compute the floor function of a */
- /* 16.16 fixed number. */
- /* */
- /* <Input> */
- /* a :: The number for which the floor function is to be computed. */
- /* */
- /* <Return> */
- /* `a' rounded towards minus infinity. */
- /* */
- FT_EXPORT( FT_Fixed )
- FT_FloorFix( FT_Fixed a );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Vector_Transform */
- /* */
- /* <Description> */
- /* Transform a single vector through a 2x2 matrix. */
- /* */
- /* <InOut> */
- /* vector :: The target vector to transform. */
- /* */
- /* <Input> */
- /* matrix :: A pointer to the source 2x2 matrix. */
- /* */
- /* <Note> */
- /* The result is undefined if either `vector' or `matrix' is invalid. */
- /* */
- FT_EXPORT( void )
- FT_Vector_Transform( FT_Vector* vec,
- const FT_Matrix* matrix );
-
-
- /*************************************************************************/
- /* */
- /* <Section> */
- /* version */
- /* */
- /* <Title> */
- /* FreeType Version */
- /* */
- /* <Abstract> */
- /* Functions and macros related to FreeType versions. */
- /* */
- /* <Description> */
- /* Note that those functions and macros are of limited use because */
- /* even a new release of FreeType with only documentation changes */
- /* increases the version number. */
- /* */
- /* <Order> */
- /* FT_Library_Version */
- /* */
- /* FREETYPE_MAJOR */
- /* FREETYPE_MINOR */
- /* FREETYPE_PATCH */
- /* */
- /* FT_Face_CheckTrueTypePatents */
- /* FT_Face_SetUnpatentedHinting */
- /* */
- /* FREETYPE_XXX */
- /* */
- /*************************************************************************/
-
-
- /*************************************************************************
- *
- * @enum:
- * FREETYPE_XXX
- *
- * @description:
- * These three macros identify the FreeType source code version.
- * Use @FT_Library_Version to access them at runtime.
- *
- * @values:
- * FREETYPE_MAJOR :: The major version number.
- * FREETYPE_MINOR :: The minor version number.
- * FREETYPE_PATCH :: The patch level.
- *
- * @note:
- * The version number of FreeType if built as a dynamic link library
- * with the `libtool' package is _not_ controlled by these three
- * macros.
- *
- */
-#define FREETYPE_MAJOR 2
-#define FREETYPE_MINOR 6
-#define FREETYPE_PATCH 1
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Library_Version */
- /* */
- /* <Description> */
- /* Return the version of the FreeType library being used. This is */
- /* useful when dynamically linking to the library, since one cannot */
- /* use the macros @FREETYPE_MAJOR, @FREETYPE_MINOR, and */
- /* @FREETYPE_PATCH. */
- /* */
- /* <Input> */
- /* library :: A source library handle. */
- /* */
- /* <Output> */
- /* amajor :: The major version number. */
- /* */
- /* aminor :: The minor version number. */
- /* */
- /* apatch :: The patch version number. */
- /* */
- /* <Note> */
- /* The reason why this function takes a `library' argument is because */
- /* certain programs implement library initialization in a custom way */
- /* that doesn't use @FT_Init_FreeType. */
- /* */
- /* In such cases, the library version might not be available before */
- /* the library object has been created. */
- /* */
- FT_EXPORT( void )
- FT_Library_Version( FT_Library library,
- FT_Int *amajor,
- FT_Int *aminor,
- FT_Int *apatch );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Face_CheckTrueTypePatents */
- /* */
- /* <Description> */
- /* Parse all bytecode instructions of a TrueType font file to check */
- /* whether any of the patented opcodes are used. This is only useful */
- /* if you want to be able to use the unpatented hinter with */
- /* fonts that do *not* use these opcodes. */
- /* */
- /* Note that this function parses *all* glyph instructions in the */
- /* font file, which may be slow. */
- /* */
- /* <Input> */
- /* face :: A face handle. */
- /* */
- /* <Return> */
- /* 1~if this is a TrueType font that uses one of the patented */
- /* opcodes, 0~otherwise. */
- /* */
- /* <Note> */
- /* Since May 2010, TrueType hinting is no longer patented. */
- /* */
- /* <Since> */
- /* 2.3.5 */
- /* */
- FT_EXPORT( FT_Bool )
- FT_Face_CheckTrueTypePatents( FT_Face face );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Face_SetUnpatentedHinting */
- /* */
- /* <Description> */
- /* Enable or disable the unpatented hinter for a given face. */
- /* Only enable it if you have determined that the face doesn't */
- /* use any patented opcodes (see @FT_Face_CheckTrueTypePatents). */
- /* */
- /* <Input> */
- /* face :: A face handle. */
- /* */
- /* value :: New boolean setting. */
- /* */
- /* <Return> */
- /* The old setting value. This will always be false if this is not */
- /* an SFNT font, or if the unpatented hinter is not compiled in this */
- /* instance of the library. */
- /* */
- /* <Note> */
- /* Since May 2010, TrueType hinting is no longer patented. */
- /* */
- /* <Since> */
- /* 2.3.5 */
- /* */
- FT_EXPORT( FT_Bool )
- FT_Face_SetUnpatentedHinting( FT_Face face,
- FT_Bool value );
-
- /* */
-
-
-FT_END_HEADER
-
-#endif /* __FREETYPE_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftadvanc.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftadvanc.h
deleted file mode 100644
index b4d2aed5677..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftadvanc.h
+++ /dev/null
@@ -1,187 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftadvanc.h */
-/* */
-/* Quick computation of advance widths (specification only). */
-/* */
-/* Copyright 2008-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __FTADVANC_H__
-#define __FTADVANC_H__
-
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-
-#ifdef FREETYPE_H
-#error "freetype.h of FreeType 1 has been loaded!"
-#error "Please fix the directory search order for header files"
-#error "so that freetype.h of FreeType 2 is found first."
-#endif
-
-
-FT_BEGIN_HEADER
-
-
- /**************************************************************************
- *
- * @section:
- * quick_advance
- *
- * @title:
- * Quick retrieval of advance values
- *
- * @abstract:
- * Retrieve horizontal and vertical advance values without processing
- * glyph outlines, if possible.
- *
- * @description:
- * This section contains functions to quickly extract advance values
- * without handling glyph outlines, if possible.
- *
- * @order:
- * FT_Get_Advance
- * FT_Get_Advances
- *
- */
-
-
- /*************************************************************************/
- /* */
- /* <Const> */
- /* FT_ADVANCE_FLAG_FAST_ONLY */
- /* */
- /* <Description> */
- /* A bit-flag to be OR-ed with the `flags' parameter of the */
- /* @FT_Get_Advance and @FT_Get_Advances functions. */
- /* */
- /* If set, it indicates that you want these functions to fail if the */
- /* corresponding hinting mode or font driver doesn't allow for very */
- /* quick advance computation. */
- /* */
- /* Typically, glyphs that are either unscaled, unhinted, bitmapped, */
- /* or light-hinted can have their advance width computed very */
- /* quickly. */
- /* */
- /* Normal and bytecode hinted modes that require loading, scaling, */
- /* and hinting of the glyph outline, are extremely slow by */
- /* comparison. */
- /* */
-#define FT_ADVANCE_FLAG_FAST_ONLY 0x20000000L
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Get_Advance */
- /* */
- /* <Description> */
- /* Retrieve the advance value of a given glyph outline in an */
- /* @FT_Face. */
- /* */
- /* <Input> */
- /* face :: The source @FT_Face handle. */
- /* */
- /* gindex :: The glyph index. */
- /* */
- /* load_flags :: A set of bit flags similar to those used when */
- /* calling @FT_Load_Glyph, used to determine what kind */
- /* of advances you need. */
- /* <Output> */
- /* padvance :: The advance value. If scaling is performed (based on */
- /* the value of `load_flags'), the advance value is in */
- /* 16.16 format. Otherwise, it is in font units. */
- /* */
- /* If @FT_LOAD_VERTICAL_LAYOUT is set, this is the */
- /* vertical advance corresponding to a vertical layout. */
- /* Otherwise, it is the horizontal advance in a */
- /* horizontal layout. */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. */
- /* */
- /* <Note> */
- /* This function may fail if you use @FT_ADVANCE_FLAG_FAST_ONLY and */
- /* if the corresponding font backend doesn't have a quick way to */
- /* retrieve the advances. */
- /* */
- /* A scaled advance is returned in 16.16 format but isn't transformed */
- /* by the affine transformation specified by @FT_Set_Transform. */
- /* */
- FT_EXPORT( FT_Error )
- FT_Get_Advance( FT_Face face,
- FT_UInt gindex,
- FT_Int32 load_flags,
- FT_Fixed *padvance );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Get_Advances */
- /* */
- /* <Description> */
- /* Retrieve the advance values of several glyph outlines in an */
- /* @FT_Face. */
- /* */
- /* <Input> */
- /* face :: The source @FT_Face handle. */
- /* */
- /* start :: The first glyph index. */
- /* */
- /* count :: The number of advance values you want to retrieve. */
- /* */
- /* load_flags :: A set of bit flags similar to those used when */
- /* calling @FT_Load_Glyph. */
- /* */
- /* <Output> */
- /* padvance :: The advance values. This array, to be provided by the */
- /* caller, must contain at least `count' elements. */
- /* */
- /* If scaling is performed (based on the value of */
- /* `load_flags'), the advance values are in 16.16 format. */
- /* Otherwise, they are in font units. */
- /* */
- /* If @FT_LOAD_VERTICAL_LAYOUT is set, these are the */
- /* vertical advances corresponding to a vertical layout. */
- /* Otherwise, they are the horizontal advances in a */
- /* horizontal layout. */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. */
- /* */
- /* <Note> */
- /* This function may fail if you use @FT_ADVANCE_FLAG_FAST_ONLY and */
- /* if the corresponding font backend doesn't have a quick way to */
- /* retrieve the advances. */
- /* */
- /* Scaled advances are returned in 16.16 format but aren't */
- /* transformed by the affine transformation specified by */
- /* @FT_Set_Transform. */
- /* */
- FT_EXPORT( FT_Error )
- FT_Get_Advances( FT_Face face,
- FT_UInt start,
- FT_UInt count,
- FT_Int32 load_flags,
- FT_Fixed *padvances );
-
- /* */
-
-
-FT_END_HEADER
-
-#endif /* __FTADVANC_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftautoh.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftautoh.h
deleted file mode 100644
index ab39c219952..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftautoh.h
+++ /dev/null
@@ -1,450 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftautoh.h */
-/* */
-/* FreeType API for controlling the auto-hinter (specification only). */
-/* */
-/* Copyright 2012-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __FTAUTOH_H__
-#define __FTAUTOH_H__
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-
-#ifdef FREETYPE_H
-#error "freetype.h of FreeType 1 has been loaded!"
-#error "Please fix the directory search order for header files"
-#error "so that freetype.h of FreeType 2 is found first."
-#endif
-
-
-FT_BEGIN_HEADER
-
-
- /**************************************************************************
- *
- * @section:
- * auto_hinter
- *
- * @title:
- * The auto-hinter
- *
- * @abstract:
- * Controlling the auto-hinting module.
- *
- * @description:
- * While FreeType's auto-hinter doesn't expose API functions by itself,
- * it is possible to control its behaviour with @FT_Property_Set and
- * @FT_Property_Get. The following lists the available properties
- * together with the necessary macros and structures.
- *
- * Note that the auto-hinter's module name is `autofitter' for
- * historical reasons.
- *
- */
-
-
- /**************************************************************************
- *
- * @property:
- * glyph-to-script-map
- *
- * @description:
- * *Experimental* *only*
- *
- * The auto-hinter provides various script modules to hint glyphs.
- * Examples of supported scripts are Latin or CJK. Before a glyph is
- * auto-hinted, the Unicode character map of the font gets examined, and
- * the script is then determined based on Unicode character ranges, see
- * below.
- *
- * OpenType fonts, however, often provide much more glyphs than
- * character codes (small caps, superscripts, ligatures, swashes, etc.),
- * to be controlled by so-called `features'. Handling OpenType features
- * can be quite complicated and thus needs a separate library on top of
- * FreeType.
- *
- * The mapping between glyph indices and scripts (in the auto-hinter
- * sense, see the @FT_AUTOHINTER_SCRIPT_XXX values) is stored as an
- * array with `num_glyphs' elements, as found in the font's @FT_Face
- * structure. The `glyph-to-script-map' property returns a pointer to
- * this array, which can be modified as needed. Note that the
- * modification should happen before the first glyph gets processed by
- * the auto-hinter so that the global analysis of the font shapes
- * actually uses the modified mapping.
- *
- * The following example code demonstrates how to access it (omitting
- * the error handling).
- *
- * {
- * FT_Library library;
- * FT_Face face;
- * FT_Prop_GlyphToScriptMap prop;
- *
- *
- * FT_Init_FreeType( &library );
- * FT_New_Face( library, "foo.ttf", 0, &face );
- *
- * prop.face = face;
- *
- * FT_Property_Get( library, "autofitter",
- * "glyph-to-script-map", &prop );
- *
- * // adjust `prop.map' as needed right here
- *
- * FT_Load_Glyph( face, ..., FT_LOAD_FORCE_AUTOHINT );
- * }
- *
- */
-
-
- /**************************************************************************
- *
- * @enum:
- * FT_AUTOHINTER_SCRIPT_XXX
- *
- * @description:
- * *Experimental* *only*
- *
- * A list of constants used for the @glyph-to-script-map property to
- * specify the script submodule the auto-hinter should use for hinting a
- * particular glyph.
- *
- * @values:
- * FT_AUTOHINTER_SCRIPT_NONE ::
- * Don't auto-hint this glyph.
- *
- * FT_AUTOHINTER_SCRIPT_LATIN ::
- * Apply the latin auto-hinter. For the auto-hinter, `latin' is a
- * very broad term, including Cyrillic and Greek also since characters
- * from those scripts share the same design constraints.
- *
- * By default, characters from the following Unicode ranges are
- * assigned to this submodule.
- *
- * {
- * U+0020 - U+007F // Basic Latin (no control characters)
- * U+00A0 - U+00FF // Latin-1 Supplement (no control characters)
- * U+0100 - U+017F // Latin Extended-A
- * U+0180 - U+024F // Latin Extended-B
- * U+0250 - U+02AF // IPA Extensions
- * U+02B0 - U+02FF // Spacing Modifier Letters
- * U+0300 - U+036F // Combining Diacritical Marks
- * U+0370 - U+03FF // Greek and Coptic
- * U+0400 - U+04FF // Cyrillic
- * U+0500 - U+052F // Cyrillic Supplement
- * U+1D00 - U+1D7F // Phonetic Extensions
- * U+1D80 - U+1DBF // Phonetic Extensions Supplement
- * U+1DC0 - U+1DFF // Combining Diacritical Marks Supplement
- * U+1E00 - U+1EFF // Latin Extended Additional
- * U+1F00 - U+1FFF // Greek Extended
- * U+2000 - U+206F // General Punctuation
- * U+2070 - U+209F // Superscripts and Subscripts
- * U+20A0 - U+20CF // Currency Symbols
- * U+2150 - U+218F // Number Forms
- * U+2460 - U+24FF // Enclosed Alphanumerics
- * U+2C60 - U+2C7F // Latin Extended-C
- * U+2DE0 - U+2DFF // Cyrillic Extended-A
- * U+2E00 - U+2E7F // Supplemental Punctuation
- * U+A640 - U+A69F // Cyrillic Extended-B
- * U+A720 - U+A7FF // Latin Extended-D
- * U+FB00 - U+FB06 // Alphab. Present. Forms (Latin Ligatures)
- * U+1D400 - U+1D7FF // Mathematical Alphanumeric Symbols
- * U+1F100 - U+1F1FF // Enclosed Alphanumeric Supplement
- * }
- *
- * FT_AUTOHINTER_SCRIPT_CJK ::
- * Apply the CJK auto-hinter, covering Chinese, Japanese, Korean, old
- * Vietnamese, and some other scripts.
- *
- * By default, characters from the following Unicode ranges are
- * assigned to this submodule.
- *
- * {
- * U+1100 - U+11FF // Hangul Jamo
- * U+2E80 - U+2EFF // CJK Radicals Supplement
- * U+2F00 - U+2FDF // Kangxi Radicals
- * U+2FF0 - U+2FFF // Ideographic Description Characters
- * U+3000 - U+303F // CJK Symbols and Punctuation
- * U+3040 - U+309F // Hiragana
- * U+30A0 - U+30FF // Katakana
- * U+3100 - U+312F // Bopomofo
- * U+3130 - U+318F // Hangul Compatibility Jamo
- * U+3190 - U+319F // Kanbun
- * U+31A0 - U+31BF // Bopomofo Extended
- * U+31C0 - U+31EF // CJK Strokes
- * U+31F0 - U+31FF // Katakana Phonetic Extensions
- * U+3200 - U+32FF // Enclosed CJK Letters and Months
- * U+3300 - U+33FF // CJK Compatibility
- * U+3400 - U+4DBF // CJK Unified Ideographs Extension A
- * U+4DC0 - U+4DFF // Yijing Hexagram Symbols
- * U+4E00 - U+9FFF // CJK Unified Ideographs
- * U+A960 - U+A97F // Hangul Jamo Extended-A
- * U+AC00 - U+D7AF // Hangul Syllables
- * U+D7B0 - U+D7FF // Hangul Jamo Extended-B
- * U+F900 - U+FAFF // CJK Compatibility Ideographs
- * U+FE10 - U+FE1F // Vertical forms
- * U+FE30 - U+FE4F // CJK Compatibility Forms
- * U+FF00 - U+FFEF // Halfwidth and Fullwidth Forms
- * U+1B000 - U+1B0FF // Kana Supplement
- * U+1D300 - U+1D35F // Tai Xuan Hing Symbols
- * U+1F200 - U+1F2FF // Enclosed Ideographic Supplement
- * U+20000 - U+2A6DF // CJK Unified Ideographs Extension B
- * U+2A700 - U+2B73F // CJK Unified Ideographs Extension C
- * U+2B740 - U+2B81F // CJK Unified Ideographs Extension D
- * U+2F800 - U+2FA1F // CJK Compatibility Ideographs Supplement
- * }
- *
- * FT_AUTOHINTER_SCRIPT_INDIC ::
- * Apply the indic auto-hinter, covering all major scripts from the
- * Indian sub-continent and some other related scripts like Thai, Lao,
- * or Tibetan.
- *
- * By default, characters from the following Unicode ranges are
- * assigned to this submodule.
- *
- * {
- * U+0900 - U+0DFF // Indic Range
- * U+0F00 - U+0FFF // Tibetan
- * U+1900 - U+194F // Limbu
- * U+1B80 - U+1BBF // Sundanese
- * U+1C80 - U+1CDF // Meetei Mayak
- * U+A800 - U+A82F // Syloti Nagri
- * U+11800 - U+118DF // Sharada
- * }
- *
- * Note that currently Indic support is rudimentary only, missing blue
- * zone support.
- *
- */
-#define FT_AUTOHINTER_SCRIPT_NONE 0
-#define FT_AUTOHINTER_SCRIPT_LATIN 1
-#define FT_AUTOHINTER_SCRIPT_CJK 2
-#define FT_AUTOHINTER_SCRIPT_INDIC 3
-
-
- /**************************************************************************
- *
- * @struct:
- * FT_Prop_GlyphToScriptMap
- *
- * @description:
- * *Experimental* *only*
- *
- * The data exchange structure for the @glyph-to-script-map property.
- *
- */
- typedef struct FT_Prop_GlyphToScriptMap_
- {
- FT_Face face;
- FT_UShort* map;
-
- } FT_Prop_GlyphToScriptMap;
-
-
- /**************************************************************************
- *
- * @property:
- * fallback-script
- *
- * @description:
- * *Experimental* *only*
- *
- * If no auto-hinter script module can be assigned to a glyph, a
- * fallback script gets assigned to it (see also the
- * @glyph-to-script-map property). By default, this is
- * @FT_AUTOHINTER_SCRIPT_CJK. Using the `fallback-script' property,
- * this fallback value can be changed.
- *
- * {
- * FT_Library library;
- * FT_UInt fallback_script = FT_AUTOHINTER_SCRIPT_NONE;
- *
- *
- * FT_Init_FreeType( &library );
- *
- * FT_Property_Set( library, "autofitter",
- * "fallback-script", &fallback_script );
- * }
- *
- * @note:
- * This property can be used with @FT_Property_Get also.
- *
- * It's important to use the right timing for changing this value: The
- * creation of the glyph-to-script map that eventually uses the
- * fallback script value gets triggered either by setting or reading a
- * face-specific property like @glyph-to-script-map, or by auto-hinting
- * any glyph from that face. In particular, if you have already created
- * an @FT_Face structure but not loaded any glyph (using the
- * auto-hinter), a change of the fallback script will affect this face.
- *
- */
-
-
- /**************************************************************************
- *
- * @property:
- * default-script
- *
- * @description:
- * *Experimental* *only*
- *
- * If FreeType gets compiled with FT_CONFIG_OPTION_USE_HARFBUZZ to make
- * the HarfBuzz library access OpenType features for getting better
- * glyph coverages, this property sets the (auto-fitter) script to be
- * used for the default (OpenType) script data of a font's GSUB table.
- * Features for the default script are intended for all scripts not
- * explicitly handled in GSUB; an example is a `dlig' feature,
- * containing the combination of the characters `T', `E', and `L' to
- * form a `TEL' ligature.
- *
- * By default, this is @FT_AUTOHINTER_SCRIPT_LATIN. Using the
- * `default-script' property, this default value can be changed.
- *
- * {
- * FT_Library library;
- * FT_UInt default_script = FT_AUTOHINTER_SCRIPT_NONE;
- *
- *
- * FT_Init_FreeType( &library );
- *
- * FT_Property_Set( library, "autofitter",
- * "default-script", &default_script );
- * }
- *
- * @note:
- * This property can be used with @FT_Property_Get also.
- *
- * It's important to use the right timing for changing this value: The
- * creation of the glyph-to-script map that eventually uses the
- * default script value gets triggered either by setting or reading a
- * face-specific property like @glyph-to-script-map, or by auto-hinting
- * any glyph from that face. In particular, if you have already created
- * an @FT_Face structure but not loaded any glyph (using the
- * auto-hinter), a change of the default script will affect this face.
- *
- */
-
-
- /**************************************************************************
- *
- * @property:
- * increase-x-height
- *
- * @description:
- * For ppem values in the range 6~<= ppem <= `increase-x-height', round
- * up the font's x~height much more often than normally. If the value
- * is set to~0, which is the default, this feature is switched off. Use
- * this property to improve the legibility of small font sizes if
- * necessary.
- *
- * {
- * FT_Library library;
- * FT_Face face;
- * FT_Prop_IncreaseXHeight prop;
- *
- *
- * FT_Init_FreeType( &library );
- * FT_New_Face( library, "foo.ttf", 0, &face );
- * FT_Set_Char_Size( face, 10 * 64, 0, 72, 0 );
- *
- * prop.face = face;
- * prop.limit = 14;
- *
- * FT_Property_Set( library, "autofitter",
- * "increase-x-height", &prop );
- * }
- *
- * @note:
- * This property can be used with @FT_Property_Get also.
- *
- * Set this value right after calling @FT_Set_Char_Size, but before
- * loading any glyph (using the auto-hinter).
- *
- */
-
-
- /**************************************************************************
- *
- * @struct:
- * FT_Prop_IncreaseXHeight
- *
- * @description:
- * The data exchange structure for the @increase-x-height property.
- *
- */
- typedef struct FT_Prop_IncreaseXHeight_
- {
- FT_Face face;
- FT_UInt limit;
-
- } FT_Prop_IncreaseXHeight;
-
-
- /**************************************************************************
- *
- * @property:
- * warping
- *
- * @description:
- * *Experimental* *only*
- *
- * If FreeType gets compiled with option AF_CONFIG_OPTION_USE_WARPER to
- * activate the warp hinting code in the auto-hinter, this property
- * switches warping on and off.
- *
- * Warping only works in `light' auto-hinting mode. The idea of the
- * code is to slightly scale and shift a glyph along the non-hinted
- * dimension (which is usually the horizontal axis) so that as much of
- * its segments are aligned (more or less) to the grid. To find out a
- * glyph's optimal scaling and shifting value, various parameter
- * combinations are tried and scored.
- *
- * By default, warping is off. The example below shows how to switch on
- * warping (omitting the error handling).
- *
- * {
- * FT_Library library;
- * FT_Bool warping = 1;
- *
- *
- * FT_Init_FreeType( &library );
- *
- * FT_Property_Set( library, "autofitter",
- * "warping", &warping );
- * }
- *
- * @note:
- * This property can be used with @FT_Property_Get also.
- *
- * The warping code can also change advance widths. Have a look at the
- * `lsb_delta' and `rsb_delta' fields in the @FT_GlyphSlotRec structure
- * for details on improving inter-glyph distances while rendering.
- *
- * Since warping is a global property of the auto-hinter it is best to
- * change its value before rendering any face. Otherwise, you should
- * reload all faces that get auto-hinted in `light' hinting mode.
- *
- */
-
-
- /* */
-
-
-FT_END_HEADER
-
-#endif /* __FTAUTOH_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftbbox.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftbbox.h
deleted file mode 100644
index 9d9d0407676..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftbbox.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftbbox.h */
-/* */
-/* FreeType exact bbox computation (specification). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* This component has a _single_ role: to compute exact outline bounding */
- /* boxes. */
- /* */
- /* It is separated from the rest of the engine for various technical */
- /* reasons. It may well be integrated in `ftoutln' later. */
- /* */
- /*************************************************************************/
-
-
-#ifndef __FTBBOX_H__
-#define __FTBBOX_H__
-
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-
-#ifdef FREETYPE_H
-#error "freetype.h of FreeType 1 has been loaded!"
-#error "Please fix the directory search order for header files"
-#error "so that freetype.h of FreeType 2 is found first."
-#endif
-
-
-FT_BEGIN_HEADER
-
-
- /*************************************************************************/
- /* */
- /* <Section> */
- /* outline_processing */
- /* */
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Outline_Get_BBox */
- /* */
- /* <Description> */
- /* Compute the exact bounding box of an outline. This is slower */
- /* than computing the control box. However, it uses an advanced */
- /* algorithm that returns _very_ quickly when the two boxes */
- /* coincide. Otherwise, the outline Bézier arcs are traversed to */
- /* extract their extrema. */
- /* */
- /* <Input> */
- /* outline :: A pointer to the source outline. */
- /* */
- /* <Output> */
- /* abbox :: The outline's exact bounding box. */
- /* */
- /* <Return> */
- /* FreeType error code. 0~means success. */
- /* */
- /* <Note> */
- /* If the font is tricky and the glyph has been loaded with */
- /* @FT_LOAD_NO_SCALE, the resulting BBox is meaningless. To get */
- /* reasonable values for the BBox it is necessary to load the glyph */
- /* at a large ppem value (so that the hinting instructions can */
- /* properly shift and scale the subglyphs), then extracting the BBox, */
- /* which can be eventually converted back to font units. */
- /* */
- FT_EXPORT( FT_Error )
- FT_Outline_Get_BBox( FT_Outline* outline,
- FT_BBox *abbox );
-
- /* */
-
-
-FT_END_HEADER
-
-#endif /* __FTBBOX_H__ */
-
-
-/* END */
-
-
-/* Local Variables: */
-/* coding: utf-8 */
-/* End: */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftbdf.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftbdf.h
deleted file mode 100644
index 0bdabf481cb..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftbdf.h
+++ /dev/null
@@ -1,210 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftbdf.h */
-/* */
-/* FreeType API for accessing BDF-specific strings (specification). */
-/* */
-/* Copyright 2002-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __FTBDF_H__
-#define __FTBDF_H__
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-
-#ifdef FREETYPE_H
-#error "freetype.h of FreeType 1 has been loaded!"
-#error "Please fix the directory search order for header files"
-#error "so that freetype.h of FreeType 2 is found first."
-#endif
-
-
-FT_BEGIN_HEADER
-
-
- /*************************************************************************/
- /* */
- /* <Section> */
- /* bdf_fonts */
- /* */
- /* <Title> */
- /* BDF and PCF Files */
- /* */
- /* <Abstract> */
- /* BDF and PCF specific API. */
- /* */
- /* <Description> */
- /* This section contains the declaration of functions specific to BDF */
- /* and PCF fonts. */
- /* */
- /*************************************************************************/
-
-
- /**********************************************************************
- *
- * @enum:
- * BDF_PropertyType
- *
- * @description:
- * A list of BDF property types.
- *
- * @values:
- * BDF_PROPERTY_TYPE_NONE ::
- * Value~0 is used to indicate a missing property.
- *
- * BDF_PROPERTY_TYPE_ATOM ::
- * Property is a string atom.
- *
- * BDF_PROPERTY_TYPE_INTEGER ::
- * Property is a 32-bit signed integer.
- *
- * BDF_PROPERTY_TYPE_CARDINAL ::
- * Property is a 32-bit unsigned integer.
- */
- typedef enum BDF_PropertyType_
- {
- BDF_PROPERTY_TYPE_NONE = 0,
- BDF_PROPERTY_TYPE_ATOM = 1,
- BDF_PROPERTY_TYPE_INTEGER = 2,
- BDF_PROPERTY_TYPE_CARDINAL = 3
-
- } BDF_PropertyType;
-
-
- /**********************************************************************
- *
- * @type:
- * BDF_Property
- *
- * @description:
- * A handle to a @BDF_PropertyRec structure to model a given
- * BDF/PCF property.
- */
- typedef struct BDF_PropertyRec_* BDF_Property;
-
-
- /**********************************************************************
- *
- * @struct:
- * BDF_PropertyRec
- *
- * @description:
- * This structure models a given BDF/PCF property.
- *
- * @fields:
- * type ::
- * The property type.
- *
- * u.atom ::
- * The atom string, if type is @BDF_PROPERTY_TYPE_ATOM. May be
- * NULL, indicating an empty string.
- *
- * u.integer ::
- * A signed integer, if type is @BDF_PROPERTY_TYPE_INTEGER.
- *
- * u.cardinal ::
- * An unsigned integer, if type is @BDF_PROPERTY_TYPE_CARDINAL.
- */
- typedef struct BDF_PropertyRec_
- {
- BDF_PropertyType type;
- union {
- const char* atom;
- FT_Int32 integer;
- FT_UInt32 cardinal;
-
- } u;
-
- } BDF_PropertyRec;
-
-
- /**********************************************************************
- *
- * @function:
- * FT_Get_BDF_Charset_ID
- *
- * @description:
- * Retrieve a BDF font character set identity, according to
- * the BDF specification.
- *
- * @input:
- * face ::
- * A handle to the input face.
- *
- * @output:
- * acharset_encoding ::
- * Charset encoding, as a C~string, owned by the face.
- *
- * acharset_registry ::
- * Charset registry, as a C~string, owned by the face.
- *
- * @return:
- * FreeType error code. 0~means success.
- *
- * @note:
- * This function only works with BDF faces, returning an error otherwise.
- */
- FT_EXPORT( FT_Error )
- FT_Get_BDF_Charset_ID( FT_Face face,
- const char* *acharset_encoding,
- const char* *acharset_registry );
-
-
- /**********************************************************************
- *
- * @function:
- * FT_Get_BDF_Property
- *
- * @description:
- * Retrieve a BDF property from a BDF or PCF font file.
- *
- * @input:
- * face :: A handle to the input face.
- *
- * name :: The property name.
- *
- * @output:
- * aproperty :: The property.
- *
- * @return:
- * FreeType error code. 0~means success.
- *
- * @note:
- * This function works with BDF _and_ PCF fonts. It returns an error
- * otherwise. It also returns an error if the property is not in the
- * font.
- *
- * A `property' is a either key-value pair within the STARTPROPERTIES
- * ... ENDPROPERTIES block of a BDF font or a key-value pair from the
- * `info->props' array within a `FontRec' structure of a PCF font.
- *
- * Integer properties are always stored as `signed' within PCF fonts;
- * consequently, @BDF_PROPERTY_TYPE_CARDINAL is a possible return value
- * for BDF fonts only.
- *
- * In case of error, `aproperty->type' is always set to
- * @BDF_PROPERTY_TYPE_NONE.
- */
- FT_EXPORT( FT_Error )
- FT_Get_BDF_Property( FT_Face face,
- const char* prop_name,
- BDF_PropertyRec *aproperty );
-
- /* */
-
-FT_END_HEADER
-
-#endif /* __FTBDF_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftbitmap.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftbitmap.h
deleted file mode 100644
index 46cc47b7d1e..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftbitmap.h
+++ /dev/null
@@ -1,240 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftbitmap.h */
-/* */
-/* FreeType utility functions for bitmaps (specification). */
-/* */
-/* Copyright 2004-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __FTBITMAP_H__
-#define __FTBITMAP_H__
-
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-
-#ifdef FREETYPE_H
-#error "freetype.h of FreeType 1 has been loaded!"
-#error "Please fix the directory search order for header files"
-#error "so that freetype.h of FreeType 2 is found first."
-#endif
-
-
-FT_BEGIN_HEADER
-
-
- /*************************************************************************/
- /* */
- /* <Section> */
- /* bitmap_handling */
- /* */
- /* <Title> */
- /* Bitmap Handling */
- /* */
- /* <Abstract> */
- /* Handling FT_Bitmap objects. */
- /* */
- /* <Description> */
- /* This section contains functions for handling @FT_Bitmap objects. */
- /* Note that none of the functions changes the bitmap's `flow' (as */
- /* indicated by the sign of the `pitch' field in `FT_Bitmap'). */
- /* */
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Bitmap_Init */
- /* */
- /* <Description> */
- /* Initialize a pointer to an @FT_Bitmap structure. */
- /* */
- /* <InOut> */
- /* abitmap :: A pointer to the bitmap structure. */
- /* */
- /* <Note> */
- /* A deprecated name for the same function is `FT_Bitmap_New'. */
- /* */
- FT_EXPORT( void )
- FT_Bitmap_Init( FT_Bitmap *abitmap );
-
-
- /* deprecated */
- FT_EXPORT( void )
- FT_Bitmap_New( FT_Bitmap *abitmap );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Bitmap_Copy */
- /* */
- /* <Description> */
- /* Copy a bitmap into another one. */
- /* */
- /* <Input> */
- /* library :: A handle to a library object. */
- /* */
- /* source :: A handle to the source bitmap. */
- /* */
- /* <Output> */
- /* target :: A handle to the target bitmap. */
- /* */
- /* <Return> */
- /* FreeType error code. 0~means success. */
- /* */
- FT_EXPORT( FT_Error )
- FT_Bitmap_Copy( FT_Library library,
- const FT_Bitmap *source,
- FT_Bitmap *target);
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Bitmap_Embolden */
- /* */
- /* <Description> */
- /* Embolden a bitmap. The new bitmap will be about `xStrength' */
- /* pixels wider and `yStrength' pixels higher. The left and bottom */
- /* borders are kept unchanged. */
- /* */
- /* <Input> */
- /* library :: A handle to a library object. */
- /* */
- /* xStrength :: How strong the glyph is emboldened horizontally. */
- /* Expressed in 26.6 pixel format. */
- /* */
- /* yStrength :: How strong the glyph is emboldened vertically. */
- /* Expressed in 26.6 pixel format. */
- /* */
- /* <InOut> */
- /* bitmap :: A handle to the target bitmap. */
- /* */
- /* <Return> */
- /* FreeType error code. 0~means success. */
- /* */
- /* <Note> */
- /* The current implementation restricts `xStrength' to be less than */
- /* or equal to~8 if bitmap is of pixel_mode @FT_PIXEL_MODE_MONO. */
- /* */
- /* If you want to embolden the bitmap owned by a @FT_GlyphSlotRec, */
- /* you should call @FT_GlyphSlot_Own_Bitmap on the slot first. */
- /* */
- /* Bitmaps in @FT_PIXEL_MODE_GRAY2 and @FT_PIXEL_MODE_GRAY@ format */
- /* are converted to @FT_PIXEL_MODE_GRAY format (i.e., 8bpp). */
- /* */
- FT_EXPORT( FT_Error )
- FT_Bitmap_Embolden( FT_Library library,
- FT_Bitmap* bitmap,
- FT_Pos xStrength,
- FT_Pos yStrength );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Bitmap_Convert */
- /* */
- /* <Description> */
- /* Convert a bitmap object with depth 1bpp, 2bpp, 4bpp, 8bpp or 32bpp */
- /* to a bitmap object with depth 8bpp, making the number of used */
- /* bytes line (a.k.a. the `pitch') a multiple of `alignment'. */
- /* */
- /* <Input> */
- /* library :: A handle to a library object. */
- /* */
- /* source :: The source bitmap. */
- /* */
- /* alignment :: The pitch of the bitmap is a multiple of this */
- /* parameter. Common values are 1, 2, or 4. */
- /* */
- /* <Output> */
- /* target :: The target bitmap. */
- /* */
- /* <Return> */
- /* FreeType error code. 0~means success. */
- /* */
- /* <Note> */
- /* It is possible to call @FT_Bitmap_Convert multiple times without */
- /* calling @FT_Bitmap_Done (the memory is simply reallocated). */
- /* */
- /* Use @FT_Bitmap_Done to finally remove the bitmap object. */
- /* */
- /* The `library' argument is taken to have access to FreeType's */
- /* memory handling functions. */
- /* */
- FT_EXPORT( FT_Error )
- FT_Bitmap_Convert( FT_Library library,
- const FT_Bitmap *source,
- FT_Bitmap *target,
- FT_Int alignment );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_GlyphSlot_Own_Bitmap */
- /* */
- /* <Description> */
- /* Make sure that a glyph slot owns `slot->bitmap'. */
- /* */
- /* <Input> */
- /* slot :: The glyph slot. */
- /* */
- /* <Return> */
- /* FreeType error code. 0~means success. */
- /* */
- /* <Note> */
- /* This function is to be used in combination with */
- /* @FT_Bitmap_Embolden. */
- /* */
- FT_EXPORT( FT_Error )
- FT_GlyphSlot_Own_Bitmap( FT_GlyphSlot slot );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Bitmap_Done */
- /* */
- /* <Description> */
- /* Destroy a bitmap object initialized with @FT_Bitmap_Init. */
- /* */
- /* <Input> */
- /* library :: A handle to a library object. */
- /* */
- /* bitmap :: The bitmap object to be freed. */
- /* */
- /* <Return> */
- /* FreeType error code. 0~means success. */
- /* */
- /* <Note> */
- /* The `library' argument is taken to have access to FreeType's */
- /* memory handling functions. */
- /* */
- FT_EXPORT( FT_Error )
- FT_Bitmap_Done( FT_Library library,
- FT_Bitmap *bitmap );
-
-
- /* */
-
-
-FT_END_HEADER
-
-#endif /* __FTBITMAP_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftbzip2.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftbzip2.h
deleted file mode 100644
index c25f9469dff..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftbzip2.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftbzip2.h */
-/* */
-/* Bzip2-compressed stream support. */
-/* */
-/* Copyright 2010-2015 by */
-/* Joel Klinghed. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __FTBZIP2_H__
-#define __FTBZIP2_H__
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-
-#ifdef FREETYPE_H
-#error "freetype.h of FreeType 1 has been loaded!"
-#error "Please fix the directory search order for header files"
-#error "so that freetype.h of FreeType 2 is found first."
-#endif
-
-
-FT_BEGIN_HEADER
-
- /*************************************************************************/
- /* */
- /* <Section> */
- /* bzip2 */
- /* */
- /* <Title> */
- /* BZIP2 Streams */
- /* */
- /* <Abstract> */
- /* Using bzip2-compressed font files. */
- /* */
- /* <Description> */
- /* This section contains the declaration of Bzip2-specific functions. */
- /* */
- /*************************************************************************/
-
-
- /************************************************************************
- *
- * @function:
- * FT_Stream_OpenBzip2
- *
- * @description:
- * Open a new stream to parse bzip2-compressed font files. This is
- * mainly used to support the compressed `*.pcf.bz2' fonts that come
- * with XFree86.
- *
- * @input:
- * stream ::
- * The target embedding stream.
- *
- * source ::
- * The source stream.
- *
- * @return:
- * FreeType error code. 0~means success.
- *
- * @note:
- * The source stream must be opened _before_ calling this function.
- *
- * Calling the internal function `FT_Stream_Close' on the new stream will
- * *not* call `FT_Stream_Close' on the source stream. None of the stream
- * objects will be released to the heap.
- *
- * The stream implementation is very basic and resets the decompression
- * process each time seeking backwards is needed within the stream.
- *
- * In certain builds of the library, bzip2 compression recognition is
- * automatically handled when calling @FT_New_Face or @FT_Open_Face.
- * This means that if no font driver is capable of handling the raw
- * compressed file, the library will try to open a bzip2 compressed stream
- * from it and re-open the face with it.
- *
- * This function may return `FT_Err_Unimplemented_Feature' if your build
- * of FreeType was not compiled with bzip2 support.
- */
- FT_EXPORT( FT_Error )
- FT_Stream_OpenBzip2( FT_Stream stream,
- FT_Stream source );
-
- /* */
-
-
-FT_END_HEADER
-
-#endif /* __FTBZIP2_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftcache.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftcache.h
deleted file mode 100644
index 68525bb8294..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftcache.h
+++ /dev/null
@@ -1,1057 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftcache.h */
-/* */
-/* FreeType Cache subsystem (specification). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __FTCACHE_H__
-#define __FTCACHE_H__
-
-
-#include <ft2build.h>
-#include FT_GLYPH_H
-
-
-FT_BEGIN_HEADER
-
-
- /*************************************************************************
- *
- * <Section>
- * cache_subsystem
- *
- * <Title>
- * Cache Sub-System
- *
- * <Abstract>
- * How to cache face, size, and glyph data with FreeType~2.
- *
- * <Description>
- * This section describes the FreeType~2 cache sub-system, which is used
- * to limit the number of concurrently opened @FT_Face and @FT_Size
- * objects, as well as caching information like character maps and glyph
- * images while limiting their maximum memory usage.
- *
- * Note that all types and functions begin with the `FTC_' prefix.
- *
- * The cache is highly portable and thus doesn't know anything about the
- * fonts installed on your system, or how to access them. This implies
- * the following scheme:
- *
- * First, available or installed font faces are uniquely identified by
- * @FTC_FaceID values, provided to the cache by the client. Note that
- * the cache only stores and compares these values, and doesn't try to
- * interpret them in any way.
- *
- * Second, the cache calls, only when needed, a client-provided function
- * to convert an @FTC_FaceID into a new @FT_Face object. The latter is
- * then completely managed by the cache, including its termination
- * through @FT_Done_Face. To monitor termination of face objects, the
- * finalizer callback in the `generic' field of the @FT_Face object can
- * be used, which might also be used to store the @FTC_FaceID of the
- * face.
- *
- * Clients are free to map face IDs to anything else. The most simple
- * usage is to associate them to a (pathname,face_index) pair that is
- * used to call @FT_New_Face. However, more complex schemes are also
- * possible.
- *
- * Note that for the cache to work correctly, the face ID values must be
- * *persistent*, which means that the contents they point to should not
- * change at runtime, or that their value should not become invalid.
- *
- * If this is unavoidable (e.g., when a font is uninstalled at runtime),
- * you should call @FTC_Manager_RemoveFaceID as soon as possible, to let
- * the cache get rid of any references to the old @FTC_FaceID it may
- * keep internally. Failure to do so will lead to incorrect behaviour
- * or even crashes.
- *
- * To use the cache, start with calling @FTC_Manager_New to create a new
- * @FTC_Manager object, which models a single cache instance. You can
- * then look up @FT_Face and @FT_Size objects with
- * @FTC_Manager_LookupFace and @FTC_Manager_LookupSize, respectively.
- *
- * If you want to use the charmap caching, call @FTC_CMapCache_New, then
- * later use @FTC_CMapCache_Lookup to perform the equivalent of
- * @FT_Get_Char_Index, only much faster.
- *
- * If you want to use the @FT_Glyph caching, call @FTC_ImageCache, then
- * later use @FTC_ImageCache_Lookup to retrieve the corresponding
- * @FT_Glyph objects from the cache.
- *
- * If you need lots of small bitmaps, it is much more memory efficient
- * to call @FTC_SBitCache_New followed by @FTC_SBitCache_Lookup. This
- * returns @FTC_SBitRec structures, which are used to store small
- * bitmaps directly. (A small bitmap is one whose metrics and
- * dimensions all fit into 8-bit integers).
- *
- * We hope to also provide a kerning cache in the near future.
- *
- *
- * <Order>
- * FTC_Manager
- * FTC_FaceID
- * FTC_Face_Requester
- *
- * FTC_Manager_New
- * FTC_Manager_Reset
- * FTC_Manager_Done
- * FTC_Manager_LookupFace
- * FTC_Manager_LookupSize
- * FTC_Manager_RemoveFaceID
- *
- * FTC_Node
- * FTC_Node_Unref
- *
- * FTC_ImageCache
- * FTC_ImageCache_New
- * FTC_ImageCache_Lookup
- *
- * FTC_SBit
- * FTC_SBitCache
- * FTC_SBitCache_New
- * FTC_SBitCache_Lookup
- *
- * FTC_CMapCache
- * FTC_CMapCache_New
- * FTC_CMapCache_Lookup
- *
- *************************************************************************/
-
-
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** BASIC TYPE DEFINITIONS *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
-
-
- /*************************************************************************
- *
- * @type: FTC_FaceID
- *
- * @description:
- * An opaque pointer type that is used to identity face objects. The
- * contents of such objects is application-dependent.
- *
- * These pointers are typically used to point to a user-defined
- * structure containing a font file path, and face index.
- *
- * @note:
- * Never use NULL as a valid @FTC_FaceID.
- *
- * Face IDs are passed by the client to the cache manager that calls,
- * when needed, the @FTC_Face_Requester to translate them into new
- * @FT_Face objects.
- *
- * If the content of a given face ID changes at runtime, or if the value
- * becomes invalid (e.g., when uninstalling a font), you should
- * immediately call @FTC_Manager_RemoveFaceID before any other cache
- * function.
- *
- * Failure to do so will result in incorrect behaviour or even
- * memory leaks and crashes.
- */
- typedef FT_Pointer FTC_FaceID;
-
-
- /************************************************************************
- *
- * @functype:
- * FTC_Face_Requester
- *
- * @description:
- * A callback function provided by client applications. It is used by
- * the cache manager to translate a given @FTC_FaceID into a new valid
- * @FT_Face object, on demand.
- *
- * <Input>
- * face_id ::
- * The face ID to resolve.
- *
- * library ::
- * A handle to a FreeType library object.
- *
- * req_data ::
- * Application-provided request data (see note below).
- *
- * <Output>
- * aface ::
- * A new @FT_Face handle.
- *
- * <Return>
- * FreeType error code. 0~means success.
- *
- * <Note>
- * The third parameter `req_data' is the same as the one passed by the
- * client when @FTC_Manager_New is called.
- *
- * The face requester should not perform funny things on the returned
- * face object, like creating a new @FT_Size for it, or setting a
- * transformation through @FT_Set_Transform!
- */
- typedef FT_Error
- (*FTC_Face_Requester)( FTC_FaceID face_id,
- FT_Library library,
- FT_Pointer req_data,
- FT_Face* aface );
-
- /* */
-
-
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** CACHE MANAGER OBJECT *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* FTC_Manager */
- /* */
- /* <Description> */
- /* This object corresponds to one instance of the cache-subsystem. */
- /* It is used to cache one or more @FT_Face objects, along with */
- /* corresponding @FT_Size objects. */
- /* */
- /* The manager intentionally limits the total number of opened */
- /* @FT_Face and @FT_Size objects to control memory usage. See the */
- /* `max_faces' and `max_sizes' parameters of @FTC_Manager_New. */
- /* */
- /* The manager is also used to cache `nodes' of various types while */
- /* limiting their total memory usage. */
- /* */
- /* All limitations are enforced by keeping lists of managed objects */
- /* in most-recently-used order, and flushing old nodes to make room */
- /* for new ones. */
- /* */
- typedef struct FTC_ManagerRec_* FTC_Manager;
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* FTC_Node */
- /* */
- /* <Description> */
- /* An opaque handle to a cache node object. Each cache node is */
- /* reference-counted. A node with a count of~0 might be flushed */
- /* out of a full cache whenever a lookup request is performed. */
- /* */
- /* If you look up nodes, you have the ability to `acquire' them, */
- /* i.e., to increment their reference count. This will prevent the */
- /* node from being flushed out of the cache until you explicitly */
- /* `release' it (see @FTC_Node_Unref). */
- /* */
- /* See also @FTC_SBitCache_Lookup and @FTC_ImageCache_Lookup. */
- /* */
- typedef struct FTC_NodeRec_* FTC_Node;
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FTC_Manager_New */
- /* */
- /* <Description> */
- /* Create a new cache manager. */
- /* */
- /* <Input> */
- /* library :: The parent FreeType library handle to use. */
- /* */
- /* max_faces :: Maximum number of opened @FT_Face objects managed by */
- /* this cache instance. Use~0 for defaults. */
- /* */
- /* max_sizes :: Maximum number of opened @FT_Size objects managed by */
- /* this cache instance. Use~0 for defaults. */
- /* */
- /* max_bytes :: Maximum number of bytes to use for cached data nodes. */
- /* Use~0 for defaults. Note that this value does not */
- /* account for managed @FT_Face and @FT_Size objects. */
- /* */
- /* requester :: An application-provided callback used to translate */
- /* face IDs into real @FT_Face objects. */
- /* */
- /* req_data :: A generic pointer that is passed to the requester */
- /* each time it is called (see @FTC_Face_Requester). */
- /* */
- /* <Output> */
- /* amanager :: A handle to a new manager object. 0~in case of */
- /* failure. */
- /* */
- /* <Return> */
- /* FreeType error code. 0~means success. */
- /* */
- FT_EXPORT( FT_Error )
- FTC_Manager_New( FT_Library library,
- FT_UInt max_faces,
- FT_UInt max_sizes,
- FT_ULong max_bytes,
- FTC_Face_Requester requester,
- FT_Pointer req_data,
- FTC_Manager *amanager );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FTC_Manager_Reset */
- /* */
- /* <Description> */
- /* Empty a given cache manager. This simply gets rid of all the */
- /* currently cached @FT_Face and @FT_Size objects within the manager. */
- /* */
- /* <InOut> */
- /* manager :: A handle to the manager. */
- /* */
- FT_EXPORT( void )
- FTC_Manager_Reset( FTC_Manager manager );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FTC_Manager_Done */
- /* */
- /* <Description> */
- /* Destroy a given manager after emptying it. */
- /* */
- /* <Input> */
- /* manager :: A handle to the target cache manager object. */
- /* */
- FT_EXPORT( void )
- FTC_Manager_Done( FTC_Manager manager );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FTC_Manager_LookupFace */
- /* */
- /* <Description> */
- /* Retrieve the @FT_Face object that corresponds to a given face ID */
- /* through a cache manager. */
- /* */
- /* <Input> */
- /* manager :: A handle to the cache manager. */
- /* */
- /* face_id :: The ID of the face object. */
- /* */
- /* <Output> */
- /* aface :: A handle to the face object. */
- /* */
- /* <Return> */
- /* FreeType error code. 0~means success. */
- /* */
- /* <Note> */
- /* The returned @FT_Face object is always owned by the manager. You */
- /* should never try to discard it yourself. */
- /* */
- /* The @FT_Face object doesn't necessarily have a current size object */
- /* (i.e., face->size can be~0). If you need a specific `font size', */
- /* use @FTC_Manager_LookupSize instead. */
- /* */
- /* Never change the face's transformation matrix (i.e., never call */
- /* the @FT_Set_Transform function) on a returned face! If you need */
- /* to transform glyphs, do it yourself after glyph loading. */
- /* */
- /* When you perform a lookup, out-of-memory errors are detected */
- /* _within_ the lookup and force incremental flushes of the cache */
- /* until enough memory is released for the lookup to succeed. */
- /* */
- /* If a lookup fails with `FT_Err_Out_Of_Memory' the cache has */
- /* already been completely flushed, and still no memory was available */
- /* for the operation. */
- /* */
- FT_EXPORT( FT_Error )
- FTC_Manager_LookupFace( FTC_Manager manager,
- FTC_FaceID face_id,
- FT_Face *aface );
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* FTC_ScalerRec */
- /* */
- /* <Description> */
- /* A structure used to describe a given character size in either */
- /* pixels or points to the cache manager. See */
- /* @FTC_Manager_LookupSize. */
- /* */
- /* <Fields> */
- /* face_id :: The source face ID. */
- /* */
- /* width :: The character width. */
- /* */
- /* height :: The character height. */
- /* */
- /* pixel :: A Boolean. If 1, the `width' and `height' fields are */
- /* interpreted as integer pixel character sizes. */
- /* Otherwise, they are expressed as 1/64th of points. */
- /* */
- /* x_res :: Only used when `pixel' is value~0 to indicate the */
- /* horizontal resolution in dpi. */
- /* */
- /* y_res :: Only used when `pixel' is value~0 to indicate the */
- /* vertical resolution in dpi. */
- /* */
- /* <Note> */
- /* This type is mainly used to retrieve @FT_Size objects through the */
- /* cache manager. */
- /* */
- typedef struct FTC_ScalerRec_
- {
- FTC_FaceID face_id;
- FT_UInt width;
- FT_UInt height;
- FT_Int pixel;
- FT_UInt x_res;
- FT_UInt y_res;
-
- } FTC_ScalerRec;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* FTC_Scaler */
- /* */
- /* <Description> */
- /* A handle to an @FTC_ScalerRec structure. */
- /* */
- typedef struct FTC_ScalerRec_* FTC_Scaler;
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FTC_Manager_LookupSize */
- /* */
- /* <Description> */
- /* Retrieve the @FT_Size object that corresponds to a given */
- /* @FTC_ScalerRec pointer through a cache manager. */
- /* */
- /* <Input> */
- /* manager :: A handle to the cache manager. */
- /* */
- /* scaler :: A scaler handle. */
- /* */
- /* <Output> */
- /* asize :: A handle to the size object. */
- /* */
- /* <Return> */
- /* FreeType error code. 0~means success. */
- /* */
- /* <Note> */
- /* The returned @FT_Size object is always owned by the manager. You */
- /* should never try to discard it by yourself. */
- /* */
- /* You can access the parent @FT_Face object simply as `size->face' */
- /* if you need it. Note that this object is also owned by the */
- /* manager. */
- /* */
- /* <Note> */
- /* When you perform a lookup, out-of-memory errors are detected */
- /* _within_ the lookup and force incremental flushes of the cache */
- /* until enough memory is released for the lookup to succeed. */
- /* */
- /* If a lookup fails with `FT_Err_Out_Of_Memory' the cache has */
- /* already been completely flushed, and still no memory is available */
- /* for the operation. */
- /* */
- FT_EXPORT( FT_Error )
- FTC_Manager_LookupSize( FTC_Manager manager,
- FTC_Scaler scaler,
- FT_Size *asize );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FTC_Node_Unref */
- /* */
- /* <Description> */
- /* Decrement a cache node's internal reference count. When the count */
- /* reaches 0, it is not destroyed but becomes eligible for subsequent */
- /* cache flushes. */
- /* */
- /* <Input> */
- /* node :: The cache node handle. */
- /* */
- /* manager :: The cache manager handle. */
- /* */
- FT_EXPORT( void )
- FTC_Node_Unref( FTC_Node node,
- FTC_Manager manager );
-
-
- /*************************************************************************
- *
- * @function:
- * FTC_Manager_RemoveFaceID
- *
- * @description:
- * A special function used to indicate to the cache manager that
- * a given @FTC_FaceID is no longer valid, either because its
- * content changed, or because it was deallocated or uninstalled.
- *
- * @input:
- * manager ::
- * The cache manager handle.
- *
- * face_id ::
- * The @FTC_FaceID to be removed.
- *
- * @note:
- * This function flushes all nodes from the cache corresponding to this
- * `face_id', with the exception of nodes with a non-null reference
- * count.
- *
- * Such nodes are however modified internally so as to never appear
- * in later lookups with the same `face_id' value, and to be immediately
- * destroyed when released by all their users.
- *
- */
- FT_EXPORT( void )
- FTC_Manager_RemoveFaceID( FTC_Manager manager,
- FTC_FaceID face_id );
-
-
- /*************************************************************************/
- /* */
- /* <Section> */
- /* cache_subsystem */
- /* */
- /*************************************************************************/
-
- /*************************************************************************
- *
- * @type:
- * FTC_CMapCache
- *
- * @description:
- * An opaque handle used to model a charmap cache. This cache is to
- * hold character codes -> glyph indices mappings.
- *
- */
- typedef struct FTC_CMapCacheRec_* FTC_CMapCache;
-
-
- /*************************************************************************
- *
- * @function:
- * FTC_CMapCache_New
- *
- * @description:
- * Create a new charmap cache.
- *
- * @input:
- * manager ::
- * A handle to the cache manager.
- *
- * @output:
- * acache ::
- * A new cache handle. NULL in case of error.
- *
- * @return:
- * FreeType error code. 0~means success.
- *
- * @note:
- * Like all other caches, this one will be destroyed with the cache
- * manager.
- *
- */
- FT_EXPORT( FT_Error )
- FTC_CMapCache_New( FTC_Manager manager,
- FTC_CMapCache *acache );
-
-
- /************************************************************************
- *
- * @function:
- * FTC_CMapCache_Lookup
- *
- * @description:
- * Translate a character code into a glyph index, using the charmap
- * cache.
- *
- * @input:
- * cache ::
- * A charmap cache handle.
- *
- * face_id ::
- * The source face ID.
- *
- * cmap_index ::
- * The index of the charmap in the source face. Any negative value
- * means to use the cache @FT_Face's default charmap.
- *
- * char_code ::
- * The character code (in the corresponding charmap).
- *
- * @return:
- * Glyph index. 0~means `no glyph'.
- *
- */
- FT_EXPORT( FT_UInt )
- FTC_CMapCache_Lookup( FTC_CMapCache cache,
- FTC_FaceID face_id,
- FT_Int cmap_index,
- FT_UInt32 char_code );
-
-
- /*************************************************************************/
- /* */
- /* <Section> */
- /* cache_subsystem */
- /* */
- /*************************************************************************/
-
-
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** IMAGE CACHE OBJECT *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
-
-
- /*************************************************************************
- *
- * @struct:
- * FTC_ImageTypeRec
- *
- * @description:
- * A structure used to model the type of images in a glyph cache.
- *
- * @fields:
- * face_id ::
- * The face ID.
- *
- * width ::
- * The width in pixels.
- *
- * height ::
- * The height in pixels.
- *
- * flags ::
- * The load flags, as in @FT_Load_Glyph.
- *
- */
- typedef struct FTC_ImageTypeRec_
- {
- FTC_FaceID face_id;
- FT_UInt width;
- FT_UInt height;
- FT_Int32 flags;
-
- } FTC_ImageTypeRec;
-
-
- /*************************************************************************
- *
- * @type:
- * FTC_ImageType
- *
- * @description:
- * A handle to an @FTC_ImageTypeRec structure.
- *
- */
- typedef struct FTC_ImageTypeRec_* FTC_ImageType;
-
-
- /* */
-
-
-#define FTC_IMAGE_TYPE_COMPARE( d1, d2 ) \
- ( (d1)->face_id == (d2)->face_id && \
- (d1)->width == (d2)->width && \
- (d1)->flags == (d2)->flags )
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* FTC_ImageCache */
- /* */
- /* <Description> */
- /* A handle to a glyph image cache object. They are designed to */
- /* hold many distinct glyph images while not exceeding a certain */
- /* memory threshold. */
- /* */
- typedef struct FTC_ImageCacheRec_* FTC_ImageCache;
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FTC_ImageCache_New */
- /* */
- /* <Description> */
- /* Create a new glyph image cache. */
- /* */
- /* <Input> */
- /* manager :: The parent manager for the image cache. */
- /* */
- /* <Output> */
- /* acache :: A handle to the new glyph image cache object. */
- /* */
- /* <Return> */
- /* FreeType error code. 0~means success. */
- /* */
- FT_EXPORT( FT_Error )
- FTC_ImageCache_New( FTC_Manager manager,
- FTC_ImageCache *acache );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FTC_ImageCache_Lookup */
- /* */
- /* <Description> */
- /* Retrieve a given glyph image from a glyph image cache. */
- /* */
- /* <Input> */
- /* cache :: A handle to the source glyph image cache. */
- /* */
- /* type :: A pointer to a glyph image type descriptor. */
- /* */
- /* gindex :: The glyph index to retrieve. */
- /* */
- /* <Output> */
- /* aglyph :: The corresponding @FT_Glyph object. 0~in case of */
- /* failure. */
- /* */
- /* anode :: Used to return the address of of the corresponding cache */
- /* node after incrementing its reference count (see note */
- /* below). */
- /* */
- /* <Return> */
- /* FreeType error code. 0~means success. */
- /* */
- /* <Note> */
- /* The returned glyph is owned and managed by the glyph image cache. */
- /* Never try to transform or discard it manually! You can however */
- /* create a copy with @FT_Glyph_Copy and modify the new one. */
- /* */
- /* If `anode' is _not_ NULL, it receives the address of the cache */
- /* node containing the glyph image, after increasing its reference */
- /* count. This ensures that the node (as well as the @FT_Glyph) will */
- /* always be kept in the cache until you call @FTC_Node_Unref to */
- /* `release' it. */
- /* */
- /* If `anode' is NULL, the cache node is left unchanged, which means */
- /* that the @FT_Glyph could be flushed out of the cache on the next */
- /* call to one of the caching sub-system APIs. Don't assume that it */
- /* is persistent! */
- /* */
- FT_EXPORT( FT_Error )
- FTC_ImageCache_Lookup( FTC_ImageCache cache,
- FTC_ImageType type,
- FT_UInt gindex,
- FT_Glyph *aglyph,
- FTC_Node *anode );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FTC_ImageCache_LookupScaler */
- /* */
- /* <Description> */
- /* A variant of @FTC_ImageCache_Lookup that uses an @FTC_ScalerRec */
- /* to specify the face ID and its size. */
- /* */
- /* <Input> */
- /* cache :: A handle to the source glyph image cache. */
- /* */
- /* scaler :: A pointer to a scaler descriptor. */
- /* */
- /* load_flags :: The corresponding load flags. */
- /* */
- /* gindex :: The glyph index to retrieve. */
- /* */
- /* <Output> */
- /* aglyph :: The corresponding @FT_Glyph object. 0~in case of */
- /* failure. */
- /* */
- /* anode :: Used to return the address of of the corresponding */
- /* cache node after incrementing its reference count */
- /* (see note below). */
- /* */
- /* <Return> */
- /* FreeType error code. 0~means success. */
- /* */
- /* <Note> */
- /* The returned glyph is owned and managed by the glyph image cache. */
- /* Never try to transform or discard it manually! You can however */
- /* create a copy with @FT_Glyph_Copy and modify the new one. */
- /* */
- /* If `anode' is _not_ NULL, it receives the address of the cache */
- /* node containing the glyph image, after increasing its reference */
- /* count. This ensures that the node (as well as the @FT_Glyph) will */
- /* always be kept in the cache until you call @FTC_Node_Unref to */
- /* `release' it. */
- /* */
- /* If `anode' is NULL, the cache node is left unchanged, which means */
- /* that the @FT_Glyph could be flushed out of the cache on the next */
- /* call to one of the caching sub-system APIs. Don't assume that it */
- /* is persistent! */
- /* */
- /* Calls to @FT_Set_Char_Size and friends have no effect on cached */
- /* glyphs; you should always use the FreeType cache API instead. */
- /* */
- FT_EXPORT( FT_Error )
- FTC_ImageCache_LookupScaler( FTC_ImageCache cache,
- FTC_Scaler scaler,
- FT_ULong load_flags,
- FT_UInt gindex,
- FT_Glyph *aglyph,
- FTC_Node *anode );
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* FTC_SBit */
- /* */
- /* <Description> */
- /* A handle to a small bitmap descriptor. See the @FTC_SBitRec */
- /* structure for details. */
- /* */
- typedef struct FTC_SBitRec_* FTC_SBit;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* FTC_SBitRec */
- /* */
- /* <Description> */
- /* A very compact structure used to describe a small glyph bitmap. */
- /* */
- /* <Fields> */
- /* width :: The bitmap width in pixels. */
- /* */
- /* height :: The bitmap height in pixels. */
- /* */
- /* left :: The horizontal distance from the pen position to the */
- /* left bitmap border (a.k.a. `left side bearing', or */
- /* `lsb'). */
- /* */
- /* top :: The vertical distance from the pen position (on the */
- /* baseline) to the upper bitmap border (a.k.a. `top */
- /* side bearing'). The distance is positive for upwards */
- /* y~coordinates. */
- /* */
- /* format :: The format of the glyph bitmap (monochrome or gray). */
- /* */
- /* max_grays :: Maximum gray level value (in the range 1 to~255). */
- /* */
- /* pitch :: The number of bytes per bitmap line. May be positive */
- /* or negative. */
- /* */
- /* xadvance :: The horizontal advance width in pixels. */
- /* */
- /* yadvance :: The vertical advance height in pixels. */
- /* */
- /* buffer :: A pointer to the bitmap pixels. */
- /* */
- typedef struct FTC_SBitRec_
- {
- FT_Byte width;
- FT_Byte height;
- FT_Char left;
- FT_Char top;
-
- FT_Byte format;
- FT_Byte max_grays;
- FT_Short pitch;
- FT_Char xadvance;
- FT_Char yadvance;
-
- FT_Byte* buffer;
-
- } FTC_SBitRec;
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* FTC_SBitCache */
- /* */
- /* <Description> */
- /* A handle to a small bitmap cache. These are special cache objects */
- /* used to store small glyph bitmaps (and anti-aliased pixmaps) in a */
- /* much more efficient way than the traditional glyph image cache */
- /* implemented by @FTC_ImageCache. */
- /* */
- typedef struct FTC_SBitCacheRec_* FTC_SBitCache;
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FTC_SBitCache_New */
- /* */
- /* <Description> */
- /* Create a new cache to store small glyph bitmaps. */
- /* */
- /* <Input> */
- /* manager :: A handle to the source cache manager. */
- /* */
- /* <Output> */
- /* acache :: A handle to the new sbit cache. NULL in case of error. */
- /* */
- /* <Return> */
- /* FreeType error code. 0~means success. */
- /* */
- FT_EXPORT( FT_Error )
- FTC_SBitCache_New( FTC_Manager manager,
- FTC_SBitCache *acache );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FTC_SBitCache_Lookup */
- /* */
- /* <Description> */
- /* Look up a given small glyph bitmap in a given sbit cache and */
- /* `lock' it to prevent its flushing from the cache until needed. */
- /* */
- /* <Input> */
- /* cache :: A handle to the source sbit cache. */
- /* */
- /* type :: A pointer to the glyph image type descriptor. */
- /* */
- /* gindex :: The glyph index. */
- /* */
- /* <Output> */
- /* sbit :: A handle to a small bitmap descriptor. */
- /* */
- /* anode :: Used to return the address of of the corresponding cache */
- /* node after incrementing its reference count (see note */
- /* below). */
- /* */
- /* <Return> */
- /* FreeType error code. 0~means success. */
- /* */
- /* <Note> */
- /* The small bitmap descriptor and its bit buffer are owned by the */
- /* cache and should never be freed by the application. They might */
- /* as well disappear from memory on the next cache lookup, so don't */
- /* treat them as persistent data. */
- /* */
- /* The descriptor's `buffer' field is set to~0 to indicate a missing */
- /* glyph bitmap. */
- /* */
- /* If `anode' is _not_ NULL, it receives the address of the cache */
- /* node containing the bitmap, after increasing its reference count. */
- /* This ensures that the node (as well as the image) will always be */
- /* kept in the cache until you call @FTC_Node_Unref to `release' it. */
- /* */
- /* If `anode' is NULL, the cache node is left unchanged, which means */
- /* that the bitmap could be flushed out of the cache on the next */
- /* call to one of the caching sub-system APIs. Don't assume that it */
- /* is persistent! */
- /* */
- FT_EXPORT( FT_Error )
- FTC_SBitCache_Lookup( FTC_SBitCache cache,
- FTC_ImageType type,
- FT_UInt gindex,
- FTC_SBit *sbit,
- FTC_Node *anode );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FTC_SBitCache_LookupScaler */
- /* */
- /* <Description> */
- /* A variant of @FTC_SBitCache_Lookup that uses an @FTC_ScalerRec */
- /* to specify the face ID and its size. */
- /* */
- /* <Input> */
- /* cache :: A handle to the source sbit cache. */
- /* */
- /* scaler :: A pointer to the scaler descriptor. */
- /* */
- /* load_flags :: The corresponding load flags. */
- /* */
- /* gindex :: The glyph index. */
- /* */
- /* <Output> */
- /* sbit :: A handle to a small bitmap descriptor. */
- /* */
- /* anode :: Used to return the address of of the corresponding */
- /* cache node after incrementing its reference count */
- /* (see note below). */
- /* */
- /* <Return> */
- /* FreeType error code. 0~means success. */
- /* */
- /* <Note> */
- /* The small bitmap descriptor and its bit buffer are owned by the */
- /* cache and should never be freed by the application. They might */
- /* as well disappear from memory on the next cache lookup, so don't */
- /* treat them as persistent data. */
- /* */
- /* The descriptor's `buffer' field is set to~0 to indicate a missing */
- /* glyph bitmap. */
- /* */
- /* If `anode' is _not_ NULL, it receives the address of the cache */
- /* node containing the bitmap, after increasing its reference count. */
- /* This ensures that the node (as well as the image) will always be */
- /* kept in the cache until you call @FTC_Node_Unref to `release' it. */
- /* */
- /* If `anode' is NULL, the cache node is left unchanged, which means */
- /* that the bitmap could be flushed out of the cache on the next */
- /* call to one of the caching sub-system APIs. Don't assume that it */
- /* is persistent! */
- /* */
- FT_EXPORT( FT_Error )
- FTC_SBitCache_LookupScaler( FTC_SBitCache cache,
- FTC_Scaler scaler,
- FT_ULong load_flags,
- FT_UInt gindex,
- FTC_SBit *sbit,
- FTC_Node *anode );
-
- /* */
-
-
-FT_END_HEADER
-
-#endif /* __FTCACHE_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftcffdrv.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftcffdrv.h
deleted file mode 100644
index 6c8e416cee3..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftcffdrv.h
+++ /dev/null
@@ -1,262 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftcffdrv.h */
-/* */
-/* FreeType API for controlling the CFF driver (specification only). */
-/* */
-/* Copyright 2013-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __FTCFFDRV_H__
-#define __FTCFFDRV_H__
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-
-#ifdef FREETYPE_H
-#error "freetype.h of FreeType 1 has been loaded!"
-#error "Please fix the directory search order for header files"
-#error "so that freetype.h of FreeType 2 is found first."
-#endif
-
-
-FT_BEGIN_HEADER
-
-
- /**************************************************************************
- *
- * @section:
- * cff_driver
- *
- * @title:
- * The CFF driver
- *
- * @abstract:
- * Controlling the CFF driver module.
- *
- * @description:
- * While FreeType's CFF driver doesn't expose API functions by itself,
- * it is possible to control its behaviour with @FT_Property_Set and
- * @FT_Property_Get. The list below gives the available properties
- * together with the necessary macros and structures.
- *
- * The CFF driver's module name is `cff'.
- *
- * *Hinting* *and* *antialiasing* *principles* *of* *the* *new* *engine*
- *
- * The rasterizer is positioning horizontal features (e.g., ascender
- * height & x-height, or crossbars) on the pixel grid and minimizing the
- * amount of antialiasing applied to them, while placing vertical
- * features (vertical stems) on the pixel grid without hinting, thus
- * representing the stem position and weight accurately. Sometimes the
- * vertical stems may be only partially black. In this context,
- * `antialiasing' means that stems are not positioned exactly on pixel
- * borders, causing a fuzzy appearance.
- *
- * There are two principles behind this approach.
- *
- * 1) No hinting in the horizontal direction: Unlike `superhinted'
- * TrueType, which changes glyph widths to accommodate regular
- * inter-glyph spacing, Adobe's approach is `faithful to the design' in
- * representing both the glyph width and the inter-glyph spacing
- * designed for the font. This makes the screen display as close as it
- * can be to the result one would get with infinite resolution, while
- * preserving what is considered the key characteristics of each glyph.
- * Note that the distances between unhinted and grid-fitted positions at
- * small sizes are comparable to kerning values and thus would be
- * noticeable (and distracting) while reading if hinting were applied.
- *
- * One of the reasons to not hint horizontally is antialiasing for LCD
- * screens: The pixel geometry of modern displays supplies three
- * vertical sub-pixels as the eye moves horizontally across each visible
- * pixel. On devices where we can be certain this characteristic is
- * present a rasterizer can take advantage of the sub-pixels to add
- * increments of weight. In Western writing systems this turns out to
- * be the more critical direction anyway; the weights and spacing of
- * vertical stems (see above) are central to Armenian, Cyrillic, Greek,
- * and Latin type designs. Even when the rasterizer uses greyscale
- * antialiasing instead of color (a necessary compromise when one
- * doesn't know the screen characteristics), the unhinted vertical
- * features preserve the design's weight and spacing much better than
- * aliased type would.
- *
- * 2) Aligment in the vertical direction: Weights and spacing along the
- * y~axis are less critical; what is much more important is the visual
- * alignment of related features (like cap-height and x-height). The
- * sense of alignment for these is enhanced by the sharpness of grid-fit
- * edges, while the cruder vertical resolution (full pixels instead of
- * 1/3 pixels) is less of a problem.
- *
- * On the technical side, horizontal alignment zones for ascender,
- * x-height, and other important height values (traditionally called
- * `blue zones') as defined in the font are positioned independently,
- * each being rounded to the nearest pixel edge, taking care of
- * overshoot suppression at small sizes, stem darkening, and scaling.
- *
- * Hstems (this is, hint values defined in the font to help align
- * horizontal features) that fall within a blue zone are said to be
- * `captured' and are aligned to that zone. Uncaptured stems are moved
- * in one of four ways, top edge up or down, bottom edge up or down.
- * Unless there are conflicting hstems, the smallest movement is taken
- * to minimize distortion.
- *
- * @order:
- * hinting-engine
- * no-stem-darkening
- * darkening-parameters
- *
- */
-
-
- /**************************************************************************
- *
- * @property:
- * hinting-engine
- *
- * @description:
- * Thanks to Adobe, which contributed a new hinting (and parsing)
- * engine, an application can select between `freetype' and `adobe' if
- * compiled with CFF_CONFIG_OPTION_OLD_ENGINE. If this configuration
- * macro isn't defined, `hinting-engine' does nothing.
- *
- * The default engine is `freetype' if CFF_CONFIG_OPTION_OLD_ENGINE is
- * defined, and `adobe' otherwise.
- *
- * The following example code demonstrates how to select Adobe's hinting
- * engine (omitting the error handling).
- *
- * {
- * FT_Library library;
- * FT_UInt hinting_engine = FT_CFF_HINTING_ADOBE;
- *
- *
- * FT_Init_FreeType( &library );
- *
- * FT_Property_Set( library, "cff",
- * "hinting-engine", &hinting_engine );
- * }
- *
- * @note:
- * This property can be used with @FT_Property_Get also.
- *
- */
-
-
- /**************************************************************************
- *
- * @enum:
- * FT_CFF_HINTING_XXX
- *
- * @description:
- * A list of constants used for the @hinting-engine property to select
- * the hinting engine for CFF fonts.
- *
- * @values:
- * FT_CFF_HINTING_FREETYPE ::
- * Use the old FreeType hinting engine.
- *
- * FT_CFF_HINTING_ADOBE ::
- * Use the hinting engine contributed by Adobe.
- *
- */
-#define FT_CFF_HINTING_FREETYPE 0
-#define FT_CFF_HINTING_ADOBE 1
-
-
- /**************************************************************************
- *
- * @property:
- * no-stem-darkening
- *
- * @description:
- * By default, the Adobe CFF engine darkens stems at smaller sizes,
- * regardless of hinting, to enhance contrast. This feature requires
- * a rendering system with proper gamma correction. Setting this
- * property, stem darkening gets switched off.
- *
- * Note that stem darkening is never applied if @FT_LOAD_NO_SCALE is set.
- *
- * {
- * FT_Library library;
- * FT_Bool no_stem_darkening = TRUE;
- *
- *
- * FT_Init_FreeType( &library );
- *
- * FT_Property_Set( library, "cff",
- * "no-stem-darkening", &no_stem_darkening );
- * }
- *
- * @note:
- * This property can be used with @FT_Property_Get also.
- *
- */
-
-
- /**************************************************************************
- *
- * @property:
- * darkening-parameters
- *
- * @description:
- * By default, the Adobe CFF engine darkens stems as follows (if the
- * `no-stem-darkening' property isn't set):
- *
- * {
- * stem width <= 0.5px: darkening amount = 0.4px
- * stem width = 1px: darkening amount = 0.275px
- * stem width = 1.667px: darkening amount = 0.275px
- * stem width >= 2.333px: darkening amount = 0px
- * }
- *
- * and piecewise linear in-between. At configuration time, these four
- * control points can be set with the macro
- * `CFF_CONFIG_OPTION_DARKENING_PARAMETERS'. At runtime, the control
- * points can be changed using the `darkening-parameters' property, as
- * the following example demonstrates.
- *
- * {
- * FT_Library library;
- * FT_Int darken_params[8] = { 500, 300, // x1, y1
- * 1000, 200, // x2, y2
- * 1500, 100, // x3, y3
- * 2000, 0 }; // x4, y4
- *
- *
- * FT_Init_FreeType( &library );
- *
- * FT_Property_Set( library, "cff",
- * "darkening-parameters", darken_params );
- * }
- *
- * The x~values give the stem width, and the y~values the darkening
- * amount. The unit is 1000th of pixels. All coordinate values must be
- * positive; the x~values must be monotonically increasing; the
- * y~values must be monotonically decreasing and smaller than or
- * equal to 500 (corresponding to half a pixel); the slope of each
- * linear piece must be shallower than -1 (e.g., -.4).
- *
- * @note:
- * This property can be used with @FT_Property_Get also.
- *
- */
-
- /* */
-
-
-FT_END_HEADER
-
-
-#endif /* __FTCFFDRV_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftcid.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftcid.h
deleted file mode 100644
index 05741c85b7a..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftcid.h
+++ /dev/null
@@ -1,168 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftcid.h */
-/* */
-/* FreeType API for accessing CID font information (specification). */
-/* */
-/* Copyright 2007-2015 by */
-/* Dereg Clegg and Michael Toftdal. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __FTCID_H__
-#define __FTCID_H__
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-
-#ifdef FREETYPE_H
-#error "freetype.h of FreeType 1 has been loaded!"
-#error "Please fix the directory search order for header files"
-#error "so that freetype.h of FreeType 2 is found first."
-#endif
-
-
-FT_BEGIN_HEADER
-
-
- /*************************************************************************/
- /* */
- /* <Section> */
- /* cid_fonts */
- /* */
- /* <Title> */
- /* CID Fonts */
- /* */
- /* <Abstract> */
- /* CID-keyed font specific API. */
- /* */
- /* <Description> */
- /* This section contains the declaration of CID-keyed font specific */
- /* functions. */
- /* */
- /*************************************************************************/
-
-
- /**********************************************************************
- *
- * @function:
- * FT_Get_CID_Registry_Ordering_Supplement
- *
- * @description:
- * Retrieve the Registry/Ordering/Supplement triple (also known as the
- * "R/O/S") from a CID-keyed font.
- *
- * @input:
- * face ::
- * A handle to the input face.
- *
- * @output:
- * registry ::
- * The registry, as a C~string, owned by the face.
- *
- * ordering ::
- * The ordering, as a C~string, owned by the face.
- *
- * supplement ::
- * The supplement.
- *
- * @return:
- * FreeType error code. 0~means success.
- *
- * @note:
- * This function only works with CID faces, returning an error
- * otherwise.
- *
- * @since:
- * 2.3.6
- */
- FT_EXPORT( FT_Error )
- FT_Get_CID_Registry_Ordering_Supplement( FT_Face face,
- const char* *registry,
- const char* *ordering,
- FT_Int *supplement);
-
-
- /**********************************************************************
- *
- * @function:
- * FT_Get_CID_Is_Internally_CID_Keyed
- *
- * @description:
- * Retrieve the type of the input face, CID keyed or not. In
- * constrast to the @FT_IS_CID_KEYED macro this function returns
- * successfully also for CID-keyed fonts in an SNFT wrapper.
- *
- * @input:
- * face ::
- * A handle to the input face.
- *
- * @output:
- * is_cid ::
- * The type of the face as an @FT_Bool.
- *
- * @return:
- * FreeType error code. 0~means success.
- *
- * @note:
- * This function only works with CID faces and OpenType fonts,
- * returning an error otherwise.
- *
- * @since:
- * 2.3.9
- */
- FT_EXPORT( FT_Error )
- FT_Get_CID_Is_Internally_CID_Keyed( FT_Face face,
- FT_Bool *is_cid );
-
-
- /**********************************************************************
- *
- * @function:
- * FT_Get_CID_From_Glyph_Index
- *
- * @description:
- * Retrieve the CID of the input glyph index.
- *
- * @input:
- * face ::
- * A handle to the input face.
- *
- * glyph_index ::
- * The input glyph index.
- *
- * @output:
- * cid ::
- * The CID as an @FT_UInt.
- *
- * @return:
- * FreeType error code. 0~means success.
- *
- * @note:
- * This function only works with CID faces and OpenType fonts,
- * returning an error otherwise.
- *
- * @since:
- * 2.3.9
- */
- FT_EXPORT( FT_Error )
- FT_Get_CID_From_Glyph_Index( FT_Face face,
- FT_UInt glyph_index,
- FT_UInt *cid );
-
- /* */
-
-
-FT_END_HEADER
-
-#endif /* __FTCID_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/fterrdef.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/fterrdef.h
deleted file mode 100644
index d865da7127c..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/fterrdef.h
+++ /dev/null
@@ -1,276 +0,0 @@
-/***************************************************************************/
-/* */
-/* fterrdef.h */
-/* */
-/* FreeType error codes (specification). */
-/* */
-/* Copyright 2002-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* <Section> */
- /* error_code_values */
- /* */
- /* <Title> */
- /* Error Code Values */
- /* */
- /* <Abstract> */
- /* All possible error codes returned by FreeType functions. */
- /* */
- /* <Description> */
- /* The list below is taken verbatim from the file `fterrdef.h' */
- /* (loaded automatically by including `FT_FREETYPE_H'). The first */
- /* argument of the `FT_ERROR_DEF_' macro is the error label; by */
- /* default, the prefix `FT_Err_' gets added so that you get error */
- /* names like `FT_Err_Cannot_Open_Resource'. The second argument is */
- /* the error code, and the last argument an error string, which is not */
- /* used by FreeType. */
- /* */
- /* Within your application you should *only* use error names and */
- /* *never* its numeric values! The latter might (and actually do) */
- /* change in forthcoming FreeType versions. */
- /* */
- /* Macro `FT_NOERRORDEF_' defines `FT_Err_Ok', which is always zero. */
- /* See the `Error Enumerations' subsection how to automatically */
- /* generate a list of error strings. */
- /* */
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* <Enum> */
- /* FT_Err_XXX */
- /* */
- /*************************************************************************/
-
- /* generic errors */
-
- FT_NOERRORDEF_( Ok, 0x00,
- "no error" )
-
- FT_ERRORDEF_( Cannot_Open_Resource, 0x01,
- "cannot open resource" )
- FT_ERRORDEF_( Unknown_File_Format, 0x02,
- "unknown file format" )
- FT_ERRORDEF_( Invalid_File_Format, 0x03,
- "broken file" )
- FT_ERRORDEF_( Invalid_Version, 0x04,
- "invalid FreeType version" )
- FT_ERRORDEF_( Lower_Module_Version, 0x05,
- "module version is too low" )
- FT_ERRORDEF_( Invalid_Argument, 0x06,
- "invalid argument" )
- FT_ERRORDEF_( Unimplemented_Feature, 0x07,
- "unimplemented feature" )
- FT_ERRORDEF_( Invalid_Table, 0x08,
- "broken table" )
- FT_ERRORDEF_( Invalid_Offset, 0x09,
- "broken offset within table" )
- FT_ERRORDEF_( Array_Too_Large, 0x0A,
- "array allocation size too large" )
- FT_ERRORDEF_( Missing_Module, 0x0B,
- "missing module" )
- FT_ERRORDEF_( Missing_Property, 0x0C,
- "missing property" )
-
- /* glyph/character errors */
-
- FT_ERRORDEF_( Invalid_Glyph_Index, 0x10,
- "invalid glyph index" )
- FT_ERRORDEF_( Invalid_Character_Code, 0x11,
- "invalid character code" )
- FT_ERRORDEF_( Invalid_Glyph_Format, 0x12,
- "unsupported glyph image format" )
- FT_ERRORDEF_( Cannot_Render_Glyph, 0x13,
- "cannot render this glyph format" )
- FT_ERRORDEF_( Invalid_Outline, 0x14,
- "invalid outline" )
- FT_ERRORDEF_( Invalid_Composite, 0x15,
- "invalid composite glyph" )
- FT_ERRORDEF_( Too_Many_Hints, 0x16,
- "too many hints" )
- FT_ERRORDEF_( Invalid_Pixel_Size, 0x17,
- "invalid pixel size" )
-
- /* handle errors */
-
- FT_ERRORDEF_( Invalid_Handle, 0x20,
- "invalid object handle" )
- FT_ERRORDEF_( Invalid_Library_Handle, 0x21,
- "invalid library handle" )
- FT_ERRORDEF_( Invalid_Driver_Handle, 0x22,
- "invalid module handle" )
- FT_ERRORDEF_( Invalid_Face_Handle, 0x23,
- "invalid face handle" )
- FT_ERRORDEF_( Invalid_Size_Handle, 0x24,
- "invalid size handle" )
- FT_ERRORDEF_( Invalid_Slot_Handle, 0x25,
- "invalid glyph slot handle" )
- FT_ERRORDEF_( Invalid_CharMap_Handle, 0x26,
- "invalid charmap handle" )
- FT_ERRORDEF_( Invalid_Cache_Handle, 0x27,
- "invalid cache manager handle" )
- FT_ERRORDEF_( Invalid_Stream_Handle, 0x28,
- "invalid stream handle" )
-
- /* driver errors */
-
- FT_ERRORDEF_( Too_Many_Drivers, 0x30,
- "too many modules" )
- FT_ERRORDEF_( Too_Many_Extensions, 0x31,
- "too many extensions" )
-
- /* memory errors */
-
- FT_ERRORDEF_( Out_Of_Memory, 0x40,
- "out of memory" )
- FT_ERRORDEF_( Unlisted_Object, 0x41,
- "unlisted object" )
-
- /* stream errors */
-
- FT_ERRORDEF_( Cannot_Open_Stream, 0x51,
- "cannot open stream" )
- FT_ERRORDEF_( Invalid_Stream_Seek, 0x52,
- "invalid stream seek" )
- FT_ERRORDEF_( Invalid_Stream_Skip, 0x53,
- "invalid stream skip" )
- FT_ERRORDEF_( Invalid_Stream_Read, 0x54,
- "invalid stream read" )
- FT_ERRORDEF_( Invalid_Stream_Operation, 0x55,
- "invalid stream operation" )
- FT_ERRORDEF_( Invalid_Frame_Operation, 0x56,
- "invalid frame operation" )
- FT_ERRORDEF_( Nested_Frame_Access, 0x57,
- "nested frame access" )
- FT_ERRORDEF_( Invalid_Frame_Read, 0x58,
- "invalid frame read" )
-
- /* raster errors */
-
- FT_ERRORDEF_( Raster_Uninitialized, 0x60,
- "raster uninitialized" )
- FT_ERRORDEF_( Raster_Corrupted, 0x61,
- "raster corrupted" )
- FT_ERRORDEF_( Raster_Overflow, 0x62,
- "raster overflow" )
- FT_ERRORDEF_( Raster_Negative_Height, 0x63,
- "negative height while rastering" )
-
- /* cache errors */
-
- FT_ERRORDEF_( Too_Many_Caches, 0x70,
- "too many registered caches" )
-
- /* TrueType and SFNT errors */
-
- FT_ERRORDEF_( Invalid_Opcode, 0x80,
- "invalid opcode" )
- FT_ERRORDEF_( Too_Few_Arguments, 0x81,
- "too few arguments" )
- FT_ERRORDEF_( Stack_Overflow, 0x82,
- "stack overflow" )
- FT_ERRORDEF_( Code_Overflow, 0x83,
- "code overflow" )
- FT_ERRORDEF_( Bad_Argument, 0x84,
- "bad argument" )
- FT_ERRORDEF_( Divide_By_Zero, 0x85,
- "division by zero" )
- FT_ERRORDEF_( Invalid_Reference, 0x86,
- "invalid reference" )
- FT_ERRORDEF_( Debug_OpCode, 0x87,
- "found debug opcode" )
- FT_ERRORDEF_( ENDF_In_Exec_Stream, 0x88,
- "found ENDF opcode in execution stream" )
- FT_ERRORDEF_( Nested_DEFS, 0x89,
- "nested DEFS" )
- FT_ERRORDEF_( Invalid_CodeRange, 0x8A,
- "invalid code range" )
- FT_ERRORDEF_( Execution_Too_Long, 0x8B,
- "execution context too long" )
- FT_ERRORDEF_( Too_Many_Function_Defs, 0x8C,
- "too many function definitions" )
- FT_ERRORDEF_( Too_Many_Instruction_Defs, 0x8D,
- "too many instruction definitions" )
- FT_ERRORDEF_( Table_Missing, 0x8E,
- "SFNT font table missing" )
- FT_ERRORDEF_( Horiz_Header_Missing, 0x8F,
- "horizontal header (hhea) table missing" )
- FT_ERRORDEF_( Locations_Missing, 0x90,
- "locations (loca) table missing" )
- FT_ERRORDEF_( Name_Table_Missing, 0x91,
- "name table missing" )
- FT_ERRORDEF_( CMap_Table_Missing, 0x92,
- "character map (cmap) table missing" )
- FT_ERRORDEF_( Hmtx_Table_Missing, 0x93,
- "horizontal metrics (hmtx) table missing" )
- FT_ERRORDEF_( Post_Table_Missing, 0x94,
- "PostScript (post) table missing" )
- FT_ERRORDEF_( Invalid_Horiz_Metrics, 0x95,
- "invalid horizontal metrics" )
- FT_ERRORDEF_( Invalid_CharMap_Format, 0x96,
- "invalid character map (cmap) format" )
- FT_ERRORDEF_( Invalid_PPem, 0x97,
- "invalid ppem value" )
- FT_ERRORDEF_( Invalid_Vert_Metrics, 0x98,
- "invalid vertical metrics" )
- FT_ERRORDEF_( Could_Not_Find_Context, 0x99,
- "could not find context" )
- FT_ERRORDEF_( Invalid_Post_Table_Format, 0x9A,
- "invalid PostScript (post) table format" )
- FT_ERRORDEF_( Invalid_Post_Table, 0x9B,
- "invalid PostScript (post) table" )
-
- /* CFF, CID, and Type 1 errors */
-
- FT_ERRORDEF_( Syntax_Error, 0xA0,
- "opcode syntax error" )
- FT_ERRORDEF_( Stack_Underflow, 0xA1,
- "argument stack underflow" )
- FT_ERRORDEF_( Ignore, 0xA2,
- "ignore" )
- FT_ERRORDEF_( No_Unicode_Glyph_Name, 0xA3,
- "no Unicode glyph name found" )
- FT_ERRORDEF_( Glyph_Too_Big, 0xA4,
- "glyph to big for hinting" )
-
- /* BDF errors */
-
- FT_ERRORDEF_( Missing_Startfont_Field, 0xB0,
- "`STARTFONT' field missing" )
- FT_ERRORDEF_( Missing_Font_Field, 0xB1,
- "`FONT' field missing" )
- FT_ERRORDEF_( Missing_Size_Field, 0xB2,
- "`SIZE' field missing" )
- FT_ERRORDEF_( Missing_Fontboundingbox_Field, 0xB3,
- "`FONTBOUNDINGBOX' field missing" )
- FT_ERRORDEF_( Missing_Chars_Field, 0xB4,
- "`CHARS' field missing" )
- FT_ERRORDEF_( Missing_Startchar_Field, 0xB5,
- "`STARTCHAR' field missing" )
- FT_ERRORDEF_( Missing_Encoding_Field, 0xB6,
- "`ENCODING' field missing" )
- FT_ERRORDEF_( Missing_Bbx_Field, 0xB7,
- "`BBX' field missing" )
- FT_ERRORDEF_( Bbx_Too_Big, 0xB8,
- "`BBX' too big" )
- FT_ERRORDEF_( Corrupted_Font_Header, 0xB9,
- "Font header corrupted or missing fields" )
- FT_ERRORDEF_( Corrupted_Font_Glyphs, 0xBA,
- "Font glyphs corrupted or missing fields" )
-
- /* */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/fterrors.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/fterrors.h
deleted file mode 100644
index 0507b9ad7dc..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/fterrors.h
+++ /dev/null
@@ -1,216 +0,0 @@
-/***************************************************************************/
-/* */
-/* fterrors.h */
-/* */
-/* FreeType error code handling (specification). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* <Section> */
- /* error_enumerations */
- /* */
- /* <Title> */
- /* Error Enumerations */
- /* */
- /* <Abstract> */
- /* How to handle errors and error strings. */
- /* */
- /* <Description> */
- /* The header file `fterrors.h' (which is automatically included by */
- /* `freetype.h' defines the handling of FreeType's enumeration */
- /* constants. It can also be used to generate error message strings */
- /* with a small macro trick explained below. */
- /* */
- /* *Error* *Formats* */
- /* */
- /* The configuration macro FT_CONFIG_OPTION_USE_MODULE_ERRORS can be */
- /* defined in `ftoption.h' in order to make the higher byte indicate */
- /* the module where the error has happened (this is not compatible */
- /* with standard builds of FreeType&nbsp;2, however). See the file */
- /* `ftmoderr.h' for more details. */
- /* */
- /* *Error* *Message* *Strings* */
- /* */
- /* Error definitions are set up with special macros that allow client */
- /* applications to build a table of error message strings. The */
- /* strings are not included in a normal build of FreeType&nbsp;2 to */
- /* save space (most client applications do not use them). */
- /* */
- /* To do so, you have to define the following macros before including */
- /* this file. */
- /* */
- /* { */
- /* FT_ERROR_START_LIST */
- /* } */
- /* */
- /* This macro is called before anything else to define the start of */
- /* the error list. It is followed by several FT_ERROR_DEF calls. */
- /* */
- /* { */
- /* FT_ERROR_DEF( e, v, s ) */
- /* } */
- /* */
- /* This macro is called to define one single error. `e' is the error */
- /* code identifier (e.g., `Invalid_Argument'), `v' is the error's */
- /* numerical value, and `s' is the corresponding error string. */
- /* */
- /* { */
- /* FT_ERROR_END_LIST */
- /* } */
- /* */
- /* This macro ends the list. */
- /* */
- /* Additionally, you have to undefine `__FTERRORS_H__' before */
- /* #including this file. */
- /* */
- /* Here is a simple example. */
- /* */
- /* { */
- /* #undef __FTERRORS_H__ */
- /* #define FT_ERRORDEF( e, v, s ) { e, s }, */
- /* #define FT_ERROR_START_LIST { */
- /* #define FT_ERROR_END_LIST { 0, NULL } }; */
- /* */
- /* const struct */
- /* { */
- /* int err_code; */
- /* const char* err_msg; */
- /* } ft_errors[] = */
- /* */
- /* #include FT_ERRORS_H */
- /* } */
- /* */
- /* Note that `FT_Err_Ok' is _not_ defined with `FT_ERRORDEF' but with */
- /* `FT_NOERRORDEF'; it is always zero. */
- /* */
- /*************************************************************************/
-
- /* */
-
-#ifndef __FTERRORS_H__
-#define __FTERRORS_H__
-
-
- /* include module base error codes */
-#include FT_MODULE_ERRORS_H
-
-
- /*******************************************************************/
- /*******************************************************************/
- /***** *****/
- /***** SETUP MACROS *****/
- /***** *****/
- /*******************************************************************/
- /*******************************************************************/
-
-
-#undef FT_NEED_EXTERN_C
-
-
- /* FT_ERR_PREFIX is used as a prefix for error identifiers. */
- /* By default, we use `FT_Err_'. */
- /* */
-#ifndef FT_ERR_PREFIX
-#define FT_ERR_PREFIX FT_Err_
-#endif
-
-
- /* FT_ERR_BASE is used as the base for module-specific errors. */
- /* */
-#ifdef FT_CONFIG_OPTION_USE_MODULE_ERRORS
-
-#ifndef FT_ERR_BASE
-#define FT_ERR_BASE FT_Mod_Err_Base
-#endif
-
-#else
-
-#undef FT_ERR_BASE
-#define FT_ERR_BASE 0
-
-#endif /* FT_CONFIG_OPTION_USE_MODULE_ERRORS */
-
-
- /* If FT_ERRORDEF is not defined, we need to define a simple */
- /* enumeration type. */
- /* */
-#ifndef FT_ERRORDEF
-
-#define FT_ERRORDEF( e, v, s ) e = v,
-#define FT_ERROR_START_LIST enum {
-#define FT_ERROR_END_LIST FT_ERR_CAT( FT_ERR_PREFIX, Max ) };
-
-#ifdef __cplusplus
-#define FT_NEED_EXTERN_C
- extern "C" {
-#endif
-
-#endif /* !FT_ERRORDEF */
-
-
- /* this macro is used to define an error */
-#define FT_ERRORDEF_( e, v, s ) \
- FT_ERRORDEF( FT_ERR_CAT( FT_ERR_PREFIX, e ), v + FT_ERR_BASE, s )
-
- /* this is only used for <module>_Err_Ok, which must be 0! */
-#define FT_NOERRORDEF_( e, v, s ) \
- FT_ERRORDEF( FT_ERR_CAT( FT_ERR_PREFIX, e ), v, s )
-
-
-#ifdef FT_ERROR_START_LIST
- FT_ERROR_START_LIST
-#endif
-
-
- /* now include the error codes */
-#include FT_ERROR_DEFINITIONS_H
-
-
-#ifdef FT_ERROR_END_LIST
- FT_ERROR_END_LIST
-#endif
-
-
- /*******************************************************************/
- /*******************************************************************/
- /***** *****/
- /***** SIMPLE CLEANUP *****/
- /***** *****/
- /*******************************************************************/
- /*******************************************************************/
-
-#ifdef FT_NEED_EXTERN_C
- }
-#endif
-
-#undef FT_ERROR_START_LIST
-#undef FT_ERROR_END_LIST
-
-#undef FT_ERRORDEF
-#undef FT_ERRORDEF_
-#undef FT_NOERRORDEF_
-
-#undef FT_NEED_EXTERN_C
-#undef FT_ERR_BASE
-
- /* FT_ERR_PREFIX is needed internally */
-#ifndef FT2_BUILD_LIBRARY
-#undef FT_ERR_PREFIX
-#endif
-
-#endif /* __FTERRORS_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftfntfmt.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftfntfmt.h
deleted file mode 100644
index 1f8ff28f104..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftfntfmt.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftfntfmt.h */
-/* */
-/* Support functions for font formats. */
-/* */
-/* Copyright 2002-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __FTFNTFMT_H__
-#define __FTFNTFMT_H__
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-
-#ifdef FREETYPE_H
-#error "freetype.h of FreeType 1 has been loaded!"
-#error "Please fix the directory search order for header files"
-#error "so that freetype.h of FreeType 2 is found first."
-#endif
-
-
-FT_BEGIN_HEADER
-
-
- /*************************************************************************/
- /* */
- /* <Section> */
- /* font_formats */
- /* */
- /* <Title> */
- /* Font Formats */
- /* */
- /* <Abstract> */
- /* Getting the font format. */
- /* */
- /* <Description> */
- /* The single function in this section can be used to get the font */
- /* format. Note that this information is not needed normally; */
- /* however, there are special cases (like in PDF devices) where it is */
- /* important to differentiate, in spite of FreeType's uniform API. */
- /* */
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Get_Font_Format */
- /* */
- /* <Description> */
- /* Return a string describing the format of a given face. Possible */
- /* values are `TrueType', `Type~1', `BDF', `PCF', `Type~42', */
- /* `CID~Type~1', `CFF', `PFR', and `Windows~FNT'. */
- /* */
- /* The return value is suitable to be used as an X11 FONT_PROPERTY. */
- /* */
- /* <Input> */
- /* face :: */
- /* Input face handle. */
- /* */
- /* <Return> */
- /* Font format string. NULL in case of error. */
- /* */
- /* <Note> */
- /* A deprecated name for the same function is */
- /* `FT_Get_X11_Font_Format'. */
- /* */
- FT_EXPORT( const char* )
- FT_Get_Font_Format( FT_Face face );
-
-
- /* deprecated */
- FT_EXPORT( const char* )
- FT_Get_X11_Font_Format( FT_Face face );
-
-
- /* */
-
-
-FT_END_HEADER
-
-#endif /* __FTFNTFMT_H__ */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftgasp.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftgasp.h
deleted file mode 100644
index 9a9b6321b32..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftgasp.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftgasp.h */
-/* */
-/* Access of TrueType's `gasp' table (specification). */
-/* */
-/* Copyright 2007-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef _FT_GASP_H_
-#define _FT_GASP_H_
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-
-#ifdef FREETYPE_H
-#error "freetype.h of FreeType 1 has been loaded!"
-#error "Please fix the directory search order for header files"
-#error "so that freetype.h of FreeType 2 is found first."
-#endif
-
-
- /***************************************************************************
- *
- * @section:
- * gasp_table
- *
- * @title:
- * Gasp Table
- *
- * @abstract:
- * Retrieving TrueType `gasp' table entries.
- *
- * @description:
- * The function @FT_Get_Gasp can be used to query a TrueType or OpenType
- * font for specific entries in its `gasp' table, if any. This is
- * mainly useful when implementing native TrueType hinting with the
- * bytecode interpreter to duplicate the Windows text rendering results.
- */
-
- /*************************************************************************
- *
- * @enum:
- * FT_GASP_XXX
- *
- * @description:
- * A list of values and/or bit-flags returned by the @FT_Get_Gasp
- * function.
- *
- * @values:
- * FT_GASP_NO_TABLE ::
- * This special value means that there is no GASP table in this face.
- * It is up to the client to decide what to do.
- *
- * FT_GASP_DO_GRIDFIT ::
- * Grid-fitting and hinting should be performed at the specified ppem.
- * This *really* means TrueType bytecode interpretation. If this bit
- * is not set, no hinting gets applied.
- *
- * FT_GASP_DO_GRAY ::
- * Anti-aliased rendering should be performed at the specified ppem.
- * If not set, do monochrome rendering.
- *
- * FT_GASP_SYMMETRIC_SMOOTHING ::
- * If set, smoothing along multiple axes must be used with ClearType.
- *
- * FT_GASP_SYMMETRIC_GRIDFIT ::
- * Grid-fitting must be used with ClearType's symmetric smoothing.
- *
- * @note:
- * The bit-flags `FT_GASP_DO_GRIDFIT' and `FT_GASP_DO_GRAY' are to be
- * used for standard font rasterization only. Independently of that,
- * `FT_GASP_SYMMETRIC_SMOOTHING' and `FT_GASP_SYMMETRIC_GRIDFIT' are to
- * be used if ClearType is enabled (and `FT_GASP_DO_GRIDFIT' and
- * `FT_GASP_DO_GRAY' are consequently ignored).
- *
- * `ClearType' is Microsoft's implementation of LCD rendering, partly
- * protected by patents.
- *
- * @since:
- * 2.3.0
- */
-#define FT_GASP_NO_TABLE -1
-#define FT_GASP_DO_GRIDFIT 0x01
-#define FT_GASP_DO_GRAY 0x02
-#define FT_GASP_SYMMETRIC_SMOOTHING 0x08
-#define FT_GASP_SYMMETRIC_GRIDFIT 0x10
-
-
- /*************************************************************************
- *
- * @func:
- * FT_Get_Gasp
- *
- * @description:
- * Read the `gasp' table from a TrueType or OpenType font file and
- * return the entry corresponding to a given character pixel size.
- *
- * @input:
- * face :: The source face handle.
- * ppem :: The vertical character pixel size.
- *
- * @return:
- * Bit flags (see @FT_GASP_XXX), or @FT_GASP_NO_TABLE if there is no
- * `gasp' table in the face.
- *
- * @since:
- * 2.3.0
- */
- FT_EXPORT( FT_Int )
- FT_Get_Gasp( FT_Face face,
- FT_UInt ppem );
-
- /* */
-
-
-#endif /* _FT_GASP_H_ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftglyph.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftglyph.h
deleted file mode 100644
index 803ad396219..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftglyph.h
+++ /dev/null
@@ -1,605 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftglyph.h */
-/* */
-/* FreeType convenience functions to handle glyphs (specification). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* This file contains the definition of several convenience functions */
- /* that can be used by client applications to easily retrieve glyph */
- /* bitmaps and outlines from a given face. */
- /* */
- /* These functions should be optional if you are writing a font server */
- /* or text layout engine on top of FreeType. However, they are pretty */
- /* handy for many other simple uses of the library. */
- /* */
- /*************************************************************************/
-
-
-#ifndef __FTGLYPH_H__
-#define __FTGLYPH_H__
-
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-
-#ifdef FREETYPE_H
-#error "freetype.h of FreeType 1 has been loaded!"
-#error "Please fix the directory search order for header files"
-#error "so that freetype.h of FreeType 2 is found first."
-#endif
-
-
-FT_BEGIN_HEADER
-
-
- /*************************************************************************/
- /* */
- /* <Section> */
- /* glyph_management */
- /* */
- /* <Title> */
- /* Glyph Management */
- /* */
- /* <Abstract> */
- /* Generic interface to manage individual glyph data. */
- /* */
- /* <Description> */
- /* This section contains definitions used to manage glyph data */
- /* through generic FT_Glyph objects. Each of them can contain a */
- /* bitmap, a vector outline, or even images in other formats. */
- /* */
- /*************************************************************************/
-
-
- /* forward declaration to a private type */
- typedef struct FT_Glyph_Class_ FT_Glyph_Class;
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* FT_Glyph */
- /* */
- /* <Description> */
- /* Handle to an object used to model generic glyph images. It is a */
- /* pointer to the @FT_GlyphRec structure and can contain a glyph */
- /* bitmap or pointer. */
- /* */
- /* <Note> */
- /* Glyph objects are not owned by the library. You must thus release */
- /* them manually (through @FT_Done_Glyph) _before_ calling */
- /* @FT_Done_FreeType. */
- /* */
- typedef struct FT_GlyphRec_* FT_Glyph;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* FT_GlyphRec */
- /* */
- /* <Description> */
- /* The root glyph structure contains a given glyph image plus its */
- /* advance width in 16.16 fixed-point format. */
- /* */
- /* <Fields> */
- /* library :: A handle to the FreeType library object. */
- /* */
- /* clazz :: A pointer to the glyph's class. Private. */
- /* */
- /* format :: The format of the glyph's image. */
- /* */
- /* advance :: A 16.16 vector that gives the glyph's advance width. */
- /* */
- typedef struct FT_GlyphRec_
- {
- FT_Library library;
- const FT_Glyph_Class* clazz;
- FT_Glyph_Format format;
- FT_Vector advance;
-
- } FT_GlyphRec;
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* FT_BitmapGlyph */
- /* */
- /* <Description> */
- /* A handle to an object used to model a bitmap glyph image. This is */
- /* a sub-class of @FT_Glyph, and a pointer to @FT_BitmapGlyphRec. */
- /* */
- typedef struct FT_BitmapGlyphRec_* FT_BitmapGlyph;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* FT_BitmapGlyphRec */
- /* */
- /* <Description> */
- /* A structure used for bitmap glyph images. This really is a */
- /* `sub-class' of @FT_GlyphRec. */
- /* */
- /* <Fields> */
- /* root :: The root @FT_Glyph fields. */
- /* */
- /* left :: The left-side bearing, i.e., the horizontal distance */
- /* from the current pen position to the left border of the */
- /* glyph bitmap. */
- /* */
- /* top :: The top-side bearing, i.e., the vertical distance from */
- /* the current pen position to the top border of the glyph */
- /* bitmap. This distance is positive for upwards~y! */
- /* */
- /* bitmap :: A descriptor for the bitmap. */
- /* */
- /* <Note> */
- /* You can typecast an @FT_Glyph to @FT_BitmapGlyph if you have */
- /* `glyph->format == FT_GLYPH_FORMAT_BITMAP'. This lets you access */
- /* the bitmap's contents easily. */
- /* */
- /* The corresponding pixel buffer is always owned by @FT_BitmapGlyph */
- /* and is thus created and destroyed with it. */
- /* */
- typedef struct FT_BitmapGlyphRec_
- {
- FT_GlyphRec root;
- FT_Int left;
- FT_Int top;
- FT_Bitmap bitmap;
-
- } FT_BitmapGlyphRec;
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* FT_OutlineGlyph */
- /* */
- /* <Description> */
- /* A handle to an object used to model an outline glyph image. This */
- /* is a sub-class of @FT_Glyph, and a pointer to @FT_OutlineGlyphRec. */
- /* */
- typedef struct FT_OutlineGlyphRec_* FT_OutlineGlyph;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* FT_OutlineGlyphRec */
- /* */
- /* <Description> */
- /* A structure used for outline (vectorial) glyph images. This */
- /* really is a `sub-class' of @FT_GlyphRec. */
- /* */
- /* <Fields> */
- /* root :: The root @FT_Glyph fields. */
- /* */
- /* outline :: A descriptor for the outline. */
- /* */
- /* <Note> */
- /* You can typecast an @FT_Glyph to @FT_OutlineGlyph if you have */
- /* `glyph->format == FT_GLYPH_FORMAT_OUTLINE'. This lets you access */
- /* the outline's content easily. */
- /* */
- /* As the outline is extracted from a glyph slot, its coordinates are */
- /* expressed normally in 26.6 pixels, unless the flag */
- /* @FT_LOAD_NO_SCALE was used in @FT_Load_Glyph() or @FT_Load_Char(). */
- /* */
- /* The outline's tables are always owned by the object and are */
- /* destroyed with it. */
- /* */
- typedef struct FT_OutlineGlyphRec_
- {
- FT_GlyphRec root;
- FT_Outline outline;
-
- } FT_OutlineGlyphRec;
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Get_Glyph */
- /* */
- /* <Description> */
- /* A function used to extract a glyph image from a slot. Note that */
- /* the created @FT_Glyph object must be released with @FT_Done_Glyph. */
- /* */
- /* <Input> */
- /* slot :: A handle to the source glyph slot. */
- /* */
- /* <Output> */
- /* aglyph :: A handle to the glyph object. */
- /* */
- /* <Return> */
- /* FreeType error code. 0~means success. */
- /* */
- FT_EXPORT( FT_Error )
- FT_Get_Glyph( FT_GlyphSlot slot,
- FT_Glyph *aglyph );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Glyph_Copy */
- /* */
- /* <Description> */
- /* A function used to copy a glyph image. Note that the created */
- /* @FT_Glyph object must be released with @FT_Done_Glyph. */
- /* */
- /* <Input> */
- /* source :: A handle to the source glyph object. */
- /* */
- /* <Output> */
- /* target :: A handle to the target glyph object. 0~in case of */
- /* error. */
- /* */
- /* <Return> */
- /* FreeType error code. 0~means success. */
- /* */
- FT_EXPORT( FT_Error )
- FT_Glyph_Copy( FT_Glyph source,
- FT_Glyph *target );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Glyph_Transform */
- /* */
- /* <Description> */
- /* Transform a glyph image if its format is scalable. */
- /* */
- /* <InOut> */
- /* glyph :: A handle to the target glyph object. */
- /* */
- /* <Input> */
- /* matrix :: A pointer to a 2x2 matrix to apply. */
- /* */
- /* delta :: A pointer to a 2d vector to apply. Coordinates are */
- /* expressed in 1/64th of a pixel. */
- /* */
- /* <Return> */
- /* FreeType error code (if not 0, the glyph format is not scalable). */
- /* */
- /* <Note> */
- /* The 2x2 transformation matrix is also applied to the glyph's */
- /* advance vector. */
- /* */
- FT_EXPORT( FT_Error )
- FT_Glyph_Transform( FT_Glyph glyph,
- FT_Matrix* matrix,
- FT_Vector* delta );
-
-
- /*************************************************************************/
- /* */
- /* <Enum> */
- /* FT_Glyph_BBox_Mode */
- /* */
- /* <Description> */
- /* The mode how the values of @FT_Glyph_Get_CBox are returned. */
- /* */
- /* <Values> */
- /* FT_GLYPH_BBOX_UNSCALED :: */
- /* Return unscaled font units. */
- /* */
- /* FT_GLYPH_BBOX_SUBPIXELS :: */
- /* Return unfitted 26.6 coordinates. */
- /* */
- /* FT_GLYPH_BBOX_GRIDFIT :: */
- /* Return grid-fitted 26.6 coordinates. */
- /* */
- /* FT_GLYPH_BBOX_TRUNCATE :: */
- /* Return coordinates in integer pixels. */
- /* */
- /* FT_GLYPH_BBOX_PIXELS :: */
- /* Return grid-fitted pixel coordinates. */
- /* */
- typedef enum FT_Glyph_BBox_Mode_
- {
- FT_GLYPH_BBOX_UNSCALED = 0,
- FT_GLYPH_BBOX_SUBPIXELS = 0,
- FT_GLYPH_BBOX_GRIDFIT = 1,
- FT_GLYPH_BBOX_TRUNCATE = 2,
- FT_GLYPH_BBOX_PIXELS = 3
-
- } FT_Glyph_BBox_Mode;
-
-
- /* these constants are deprecated; use the corresponding */
- /* `FT_Glyph_BBox_Mode' values instead */
-#define ft_glyph_bbox_unscaled FT_GLYPH_BBOX_UNSCALED
-#define ft_glyph_bbox_subpixels FT_GLYPH_BBOX_SUBPIXELS
-#define ft_glyph_bbox_gridfit FT_GLYPH_BBOX_GRIDFIT
-#define ft_glyph_bbox_truncate FT_GLYPH_BBOX_TRUNCATE
-#define ft_glyph_bbox_pixels FT_GLYPH_BBOX_PIXELS
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Glyph_Get_CBox */
- /* */
- /* <Description> */
- /* Return a glyph's `control box'. The control box encloses all the */
- /* outline's points, including Bézier control points. Though it */
- /* coincides with the exact bounding box for most glyphs, it can be */
- /* slightly larger in some situations (like when rotating an outline */
- /* that contains Bézier outside arcs). */
- /* */
- /* Computing the control box is very fast, while getting the bounding */
- /* box can take much more time as it needs to walk over all segments */
- /* and arcs in the outline. To get the latter, you can use the */
- /* `ftbbox' component, which is dedicated to this single task. */
- /* */
- /* <Input> */
- /* glyph :: A handle to the source glyph object. */
- /* */
- /* mode :: The mode that indicates how to interpret the returned */
- /* bounding box values. */
- /* */
- /* <Output> */
- /* acbox :: The glyph coordinate bounding box. Coordinates are */
- /* expressed in 1/64th of pixels if it is grid-fitted. */
- /* */
- /* <Note> */
- /* Coordinates are relative to the glyph origin, using the y~upwards */
- /* convention. */
- /* */
- /* If the glyph has been loaded with @FT_LOAD_NO_SCALE, `bbox_mode' */
- /* must be set to @FT_GLYPH_BBOX_UNSCALED to get unscaled font */
- /* units in 26.6 pixel format. The value @FT_GLYPH_BBOX_SUBPIXELS */
- /* is another name for this constant. */
- /* */
- /* If the font is tricky and the glyph has been loaded with */
- /* @FT_LOAD_NO_SCALE, the resulting CBox is meaningless. To get */
- /* reasonable values for the CBox it is necessary to load the glyph */
- /* at a large ppem value (so that the hinting instructions can */
- /* properly shift and scale the subglyphs), then extracting the CBox, */
- /* which can be eventually converted back to font units. */
- /* */
- /* Note that the maximum coordinates are exclusive, which means that */
- /* one can compute the width and height of the glyph image (be it in */
- /* integer or 26.6 pixels) as: */
- /* */
- /* { */
- /* width = bbox.xMax - bbox.xMin; */
- /* height = bbox.yMax - bbox.yMin; */
- /* } */
- /* */
- /* Note also that for 26.6 coordinates, if `bbox_mode' is set to */
- /* @FT_GLYPH_BBOX_GRIDFIT, the coordinates will also be grid-fitted, */
- /* which corresponds to: */
- /* */
- /* { */
- /* bbox.xMin = FLOOR(bbox.xMin); */
- /* bbox.yMin = FLOOR(bbox.yMin); */
- /* bbox.xMax = CEILING(bbox.xMax); */
- /* bbox.yMax = CEILING(bbox.yMax); */
- /* } */
- /* */
- /* To get the bbox in pixel coordinates, set `bbox_mode' to */
- /* @FT_GLYPH_BBOX_TRUNCATE. */
- /* */
- /* To get the bbox in grid-fitted pixel coordinates, set `bbox_mode' */
- /* to @FT_GLYPH_BBOX_PIXELS. */
- /* */
- FT_EXPORT( void )
- FT_Glyph_Get_CBox( FT_Glyph glyph,
- FT_UInt bbox_mode,
- FT_BBox *acbox );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Glyph_To_Bitmap */
- /* */
- /* <Description> */
- /* Convert a given glyph object to a bitmap glyph object. */
- /* */
- /* <InOut> */
- /* the_glyph :: A pointer to a handle to the target glyph. */
- /* */
- /* <Input> */
- /* render_mode :: An enumeration that describes how the data is */
- /* rendered. */
- /* */
- /* origin :: A pointer to a vector used to translate the glyph */
- /* image before rendering. Can be~0 (if no */
- /* translation). The origin is expressed in */
- /* 26.6 pixels. */
- /* */
- /* destroy :: A boolean that indicates that the original glyph */
- /* image should be destroyed by this function. It is */
- /* never destroyed in case of error. */
- /* */
- /* <Return> */
- /* FreeType error code. 0~means success. */
- /* */
- /* <Note> */
- /* This function does nothing if the glyph format isn't scalable. */
- /* */
- /* The glyph image is translated with the `origin' vector before */
- /* rendering. */
- /* */
- /* The first parameter is a pointer to an @FT_Glyph handle, that will */
- /* be _replaced_ by this function (with newly allocated data). */
- /* Typically, you would use (omitting error handling): */
- /* */
- /* */
- /* { */
- /* FT_Glyph glyph; */
- /* FT_BitmapGlyph glyph_bitmap; */
- /* */
- /* */
- /* // load glyph */
- /* error = FT_Load_Char( face, glyph_index, FT_LOAD_DEFAUT ); */
- /* */
- /* // extract glyph image */
- /* error = FT_Get_Glyph( face->glyph, &glyph ); */
- /* */
- /* // convert to a bitmap (default render mode + destroying old) */
- /* if ( glyph->format != FT_GLYPH_FORMAT_BITMAP ) */
- /* { */
- /* error = FT_Glyph_To_Bitmap( &glyph, FT_RENDER_MODE_NORMAL, */
- /* 0, 1 ); */
- /* if ( error ) // `glyph' unchanged */
- /* ... */
- /* } */
- /* */
- /* // access bitmap content by typecasting */
- /* glyph_bitmap = (FT_BitmapGlyph)glyph; */
- /* */
- /* // do funny stuff with it, like blitting/drawing */
- /* ... */
- /* */
- /* // discard glyph image (bitmap or not) */
- /* FT_Done_Glyph( glyph ); */
- /* } */
- /* */
- /* */
- /* Here another example, again without error handling: */
- /* */
- /* */
- /* { */
- /* FT_Glyph glyphs[MAX_GLYPHS] */
- /* */
- /* */
- /* ... */
- /* */
- /* for ( idx = 0; i < MAX_GLYPHS; i++ ) */
- /* error = FT_Load_Glyph( face, idx, FT_LOAD_DEFAULT ) || */
- /* FT_Get_Glyph ( face->glyph, &glyph[idx] ); */
- /* */
- /* ... */
- /* */
- /* for ( idx = 0; i < MAX_GLYPHS; i++ ) */
- /* { */
- /* FT_Glyph bitmap = glyphs[idx]; */
- /* */
- /* */
- /* ... */
- /* */
- /* // after this call, `bitmap' no longer points into */
- /* // the `glyphs' array (and the old value isn't destroyed) */
- /* FT_Glyph_To_Bitmap( &bitmap, FT_RENDER_MODE_MONO, 0, 0 ); */
- /* */
- /* ... */
- /* */
- /* FT_Done_Glyph( bitmap ); */
- /* } */
- /* */
- /* ... */
- /* */
- /* for ( idx = 0; i < MAX_GLYPHS; i++ ) */
- /* FT_Done_Glyph( glyphs[idx] ); */
- /* } */
- /* */
- FT_EXPORT( FT_Error )
- FT_Glyph_To_Bitmap( FT_Glyph* the_glyph,
- FT_Render_Mode render_mode,
- FT_Vector* origin,
- FT_Bool destroy );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Done_Glyph */
- /* */
- /* <Description> */
- /* Destroy a given glyph. */
- /* */
- /* <Input> */
- /* glyph :: A handle to the target glyph object. */
- /* */
- FT_EXPORT( void )
- FT_Done_Glyph( FT_Glyph glyph );
-
- /* */
-
-
- /* other helpful functions */
-
- /*************************************************************************/
- /* */
- /* <Section> */
- /* computations */
- /* */
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Matrix_Multiply */
- /* */
- /* <Description> */
- /* Perform the matrix operation `b = a*b'. */
- /* */
- /* <Input> */
- /* a :: A pointer to matrix `a'. */
- /* */
- /* <InOut> */
- /* b :: A pointer to matrix `b'. */
- /* */
- /* <Note> */
- /* The result is undefined if either `a' or `b' is zero. */
- /* */
- FT_EXPORT( void )
- FT_Matrix_Multiply( const FT_Matrix* a,
- FT_Matrix* b );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Matrix_Invert */
- /* */
- /* <Description> */
- /* Invert a 2x2 matrix. Return an error if it can't be inverted. */
- /* */
- /* <InOut> */
- /* matrix :: A pointer to the target matrix. Remains untouched in */
- /* case of error. */
- /* */
- /* <Return> */
- /* FreeType error code. 0~means success. */
- /* */
- FT_EXPORT( FT_Error )
- FT_Matrix_Invert( FT_Matrix* matrix );
-
- /* */
-
-
-FT_END_HEADER
-
-#endif /* __FTGLYPH_H__ */
-
-
-/* END */
-
-
-/* Local Variables: */
-/* coding: utf-8 */
-/* End: */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftgxval.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftgxval.h
deleted file mode 100644
index 0e9ac1dad31..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftgxval.h
+++ /dev/null
@@ -1,357 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftgxval.h */
-/* */
-/* FreeType API for validating TrueTypeGX/AAT tables (specification). */
-/* */
-/* Copyright 2004-2015 by */
-/* Masatake YAMATO, Redhat K.K, */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-/***************************************************************************/
-/* */
-/* gxvalid is derived from both gxlayout module and otvalid module. */
-/* Development of gxlayout is supported by the Information-technology */
-/* Promotion Agency(IPA), Japan. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __FTGXVAL_H__
-#define __FTGXVAL_H__
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-
-#ifdef FREETYPE_H
-#error "freetype.h of FreeType 1 has been loaded!"
-#error "Please fix the directory search order for header files"
-#error "so that freetype.h of FreeType 2 is found first."
-#endif
-
-
-FT_BEGIN_HEADER
-
-
- /*************************************************************************/
- /* */
- /* <Section> */
- /* gx_validation */
- /* */
- /* <Title> */
- /* TrueTypeGX/AAT Validation */
- /* */
- /* <Abstract> */
- /* An API to validate TrueTypeGX/AAT tables. */
- /* */
- /* <Description> */
- /* This section contains the declaration of functions to validate */
- /* some TrueTypeGX tables (feat, mort, morx, bsln, just, kern, opbd, */
- /* trak, prop, lcar). */
- /* */
- /* <Order> */
- /* FT_TrueTypeGX_Validate */
- /* FT_TrueTypeGX_Free */
- /* */
- /* FT_ClassicKern_Validate */
- /* FT_ClassicKern_Free */
- /* */
- /* FT_VALIDATE_GX_LENGTH */
- /* FT_VALIDATE_GXXXX */
- /* FT_VALIDATE_CKERNXXX */
- /* */
- /*************************************************************************/
-
- /*************************************************************************/
- /* */
- /* */
- /* Warning: Use FT_VALIDATE_XXX to validate a table. */
- /* Following definitions are for gxvalid developers. */
- /* */
- /* */
- /*************************************************************************/
-
-#define FT_VALIDATE_feat_INDEX 0
-#define FT_VALIDATE_mort_INDEX 1
-#define FT_VALIDATE_morx_INDEX 2
-#define FT_VALIDATE_bsln_INDEX 3
-#define FT_VALIDATE_just_INDEX 4
-#define FT_VALIDATE_kern_INDEX 5
-#define FT_VALIDATE_opbd_INDEX 6
-#define FT_VALIDATE_trak_INDEX 7
-#define FT_VALIDATE_prop_INDEX 8
-#define FT_VALIDATE_lcar_INDEX 9
-#define FT_VALIDATE_GX_LAST_INDEX FT_VALIDATE_lcar_INDEX
-
-
- /*************************************************************************
- *
- * @macro:
- * FT_VALIDATE_GX_LENGTH
- *
- * @description:
- * The number of tables checked in this module. Use it as a parameter
- * for the `table-length' argument of function @FT_TrueTypeGX_Validate.
- */
-#define FT_VALIDATE_GX_LENGTH (FT_VALIDATE_GX_LAST_INDEX + 1)
-
- /* */
-
- /* Up to 0x1000 is used by otvalid.
- Ox2xxx is reserved for feature OT extension. */
-#define FT_VALIDATE_GX_START 0x4000
-#define FT_VALIDATE_GX_BITFIELD( tag ) \
- ( FT_VALIDATE_GX_START << FT_VALIDATE_##tag##_INDEX )
-
-
- /**********************************************************************
- *
- * @enum:
- * FT_VALIDATE_GXXXX
- *
- * @description:
- * A list of bit-field constants used with @FT_TrueTypeGX_Validate to
- * indicate which TrueTypeGX/AAT Type tables should be validated.
- *
- * @values:
- * FT_VALIDATE_feat ::
- * Validate `feat' table.
- *
- * FT_VALIDATE_mort ::
- * Validate `mort' table.
- *
- * FT_VALIDATE_morx ::
- * Validate `morx' table.
- *
- * FT_VALIDATE_bsln ::
- * Validate `bsln' table.
- *
- * FT_VALIDATE_just ::
- * Validate `just' table.
- *
- * FT_VALIDATE_kern ::
- * Validate `kern' table.
- *
- * FT_VALIDATE_opbd ::
- * Validate `opbd' table.
- *
- * FT_VALIDATE_trak ::
- * Validate `trak' table.
- *
- * FT_VALIDATE_prop ::
- * Validate `prop' table.
- *
- * FT_VALIDATE_lcar ::
- * Validate `lcar' table.
- *
- * FT_VALIDATE_GX ::
- * Validate all TrueTypeGX tables (feat, mort, morx, bsln, just, kern,
- * opbd, trak, prop and lcar).
- *
- */
-
-#define FT_VALIDATE_feat FT_VALIDATE_GX_BITFIELD( feat )
-#define FT_VALIDATE_mort FT_VALIDATE_GX_BITFIELD( mort )
-#define FT_VALIDATE_morx FT_VALIDATE_GX_BITFIELD( morx )
-#define FT_VALIDATE_bsln FT_VALIDATE_GX_BITFIELD( bsln )
-#define FT_VALIDATE_just FT_VALIDATE_GX_BITFIELD( just )
-#define FT_VALIDATE_kern FT_VALIDATE_GX_BITFIELD( kern )
-#define FT_VALIDATE_opbd FT_VALIDATE_GX_BITFIELD( opbd )
-#define FT_VALIDATE_trak FT_VALIDATE_GX_BITFIELD( trak )
-#define FT_VALIDATE_prop FT_VALIDATE_GX_BITFIELD( prop )
-#define FT_VALIDATE_lcar FT_VALIDATE_GX_BITFIELD( lcar )
-
-#define FT_VALIDATE_GX ( FT_VALIDATE_feat | \
- FT_VALIDATE_mort | \
- FT_VALIDATE_morx | \
- FT_VALIDATE_bsln | \
- FT_VALIDATE_just | \
- FT_VALIDATE_kern | \
- FT_VALIDATE_opbd | \
- FT_VALIDATE_trak | \
- FT_VALIDATE_prop | \
- FT_VALIDATE_lcar )
-
-
- /**********************************************************************
- *
- * @function:
- * FT_TrueTypeGX_Validate
- *
- * @description:
- * Validate various TrueTypeGX tables to assure that all offsets and
- * indices are valid. The idea is that a higher-level library that
- * actually does the text layout can access those tables without
- * error checking (which can be quite time consuming).
- *
- * @input:
- * face ::
- * A handle to the input face.
- *
- * validation_flags ::
- * A bit field that specifies the tables to be validated. See
- * @FT_VALIDATE_GXXXX for possible values.
- *
- * table_length ::
- * The size of the `tables' array. Normally, @FT_VALIDATE_GX_LENGTH
- * should be passed.
- *
- * @output:
- * tables ::
- * The array where all validated sfnt tables are stored.
- * The array itself must be allocated by a client.
- *
- * @return:
- * FreeType error code. 0~means success.
- *
- * @note:
- * This function only works with TrueTypeGX fonts, returning an error
- * otherwise.
- *
- * After use, the application should deallocate the buffers pointed to by
- * each `tables' element, by calling @FT_TrueTypeGX_Free. A NULL value
- * indicates that the table either doesn't exist in the font, the
- * application hasn't asked for validation, or the validator doesn't have
- * the ability to validate the sfnt table.
- */
- FT_EXPORT( FT_Error )
- FT_TrueTypeGX_Validate( FT_Face face,
- FT_UInt validation_flags,
- FT_Bytes tables[FT_VALIDATE_GX_LENGTH],
- FT_UInt table_length );
-
-
- /**********************************************************************
- *
- * @function:
- * FT_TrueTypeGX_Free
- *
- * @description:
- * Free the buffer allocated by TrueTypeGX validator.
- *
- * @input:
- * face ::
- * A handle to the input face.
- *
- * table ::
- * The pointer to the buffer allocated by
- * @FT_TrueTypeGX_Validate.
- *
- * @note:
- * This function must be used to free the buffer allocated by
- * @FT_TrueTypeGX_Validate only.
- */
- FT_EXPORT( void )
- FT_TrueTypeGX_Free( FT_Face face,
- FT_Bytes table );
-
-
- /**********************************************************************
- *
- * @enum:
- * FT_VALIDATE_CKERNXXX
- *
- * @description:
- * A list of bit-field constants used with @FT_ClassicKern_Validate
- * to indicate the classic kern dialect or dialects. If the selected
- * type doesn't fit, @FT_ClassicKern_Validate regards the table as
- * invalid.
- *
- * @values:
- * FT_VALIDATE_MS ::
- * Handle the `kern' table as a classic Microsoft kern table.
- *
- * FT_VALIDATE_APPLE ::
- * Handle the `kern' table as a classic Apple kern table.
- *
- * FT_VALIDATE_CKERN ::
- * Handle the `kern' as either classic Apple or Microsoft kern table.
- */
-#define FT_VALIDATE_MS ( FT_VALIDATE_GX_START << 0 )
-#define FT_VALIDATE_APPLE ( FT_VALIDATE_GX_START << 1 )
-
-#define FT_VALIDATE_CKERN ( FT_VALIDATE_MS | FT_VALIDATE_APPLE )
-
-
- /**********************************************************************
- *
- * @function:
- * FT_ClassicKern_Validate
- *
- * @description:
- * Validate classic (16-bit format) kern table to assure that the offsets
- * and indices are valid. The idea is that a higher-level library that
- * actually does the text layout can access those tables without error
- * checking (which can be quite time consuming).
- *
- * The `kern' table validator in @FT_TrueTypeGX_Validate deals with both
- * the new 32-bit format and the classic 16-bit format, while
- * FT_ClassicKern_Validate only supports the classic 16-bit format.
- *
- * @input:
- * face ::
- * A handle to the input face.
- *
- * validation_flags ::
- * A bit field that specifies the dialect to be validated. See
- * @FT_VALIDATE_CKERNXXX for possible values.
- *
- * @output:
- * ckern_table ::
- * A pointer to the kern table.
- *
- * @return:
- * FreeType error code. 0~means success.
- *
- * @note:
- * After use, the application should deallocate the buffers pointed to by
- * `ckern_table', by calling @FT_ClassicKern_Free. A NULL value
- * indicates that the table doesn't exist in the font.
- */
- FT_EXPORT( FT_Error )
- FT_ClassicKern_Validate( FT_Face face,
- FT_UInt validation_flags,
- FT_Bytes *ckern_table );
-
-
- /**********************************************************************
- *
- * @function:
- * FT_ClassicKern_Free
- *
- * @description:
- * Free the buffer allocated by classic Kern validator.
- *
- * @input:
- * face ::
- * A handle to the input face.
- *
- * table ::
- * The pointer to the buffer that is allocated by
- * @FT_ClassicKern_Validate.
- *
- * @note:
- * This function must be used to free the buffer allocated by
- * @FT_ClassicKern_Validate only.
- */
- FT_EXPORT( void )
- FT_ClassicKern_Free( FT_Face face,
- FT_Bytes table );
-
- /* */
-
-
-FT_END_HEADER
-
-#endif /* __FTGXVAL_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftgzip.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftgzip.h
deleted file mode 100644
index b3a532d5e15..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftgzip.h
+++ /dev/null
@@ -1,148 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftgzip.h */
-/* */
-/* Gzip-compressed stream support. */
-/* */
-/* Copyright 2002-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __FTGZIP_H__
-#define __FTGZIP_H__
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-
-#ifdef FREETYPE_H
-#error "freetype.h of FreeType 1 has been loaded!"
-#error "Please fix the directory search order for header files"
-#error "so that freetype.h of FreeType 2 is found first."
-#endif
-
-
-FT_BEGIN_HEADER
-
- /*************************************************************************/
- /* */
- /* <Section> */
- /* gzip */
- /* */
- /* <Title> */
- /* GZIP Streams */
- /* */
- /* <Abstract> */
- /* Using gzip-compressed font files. */
- /* */
- /* <Description> */
- /* This section contains the declaration of Gzip-specific functions. */
- /* */
- /*************************************************************************/
-
-
- /************************************************************************
- *
- * @function:
- * FT_Stream_OpenGzip
- *
- * @description:
- * Open a new stream to parse gzip-compressed font files. This is
- * mainly used to support the compressed `*.pcf.gz' fonts that come
- * with XFree86.
- *
- * @input:
- * stream ::
- * The target embedding stream.
- *
- * source ::
- * The source stream.
- *
- * @return:
- * FreeType error code. 0~means success.
- *
- * @note:
- * The source stream must be opened _before_ calling this function.
- *
- * Calling the internal function `FT_Stream_Close' on the new stream will
- * *not* call `FT_Stream_Close' on the source stream. None of the stream
- * objects will be released to the heap.
- *
- * The stream implementation is very basic and resets the decompression
- * process each time seeking backwards is needed within the stream.
- *
- * In certain builds of the library, gzip compression recognition is
- * automatically handled when calling @FT_New_Face or @FT_Open_Face.
- * This means that if no font driver is capable of handling the raw
- * compressed file, the library will try to open a gzipped stream from
- * it and re-open the face with it.
- *
- * This function may return `FT_Err_Unimplemented_Feature' if your build
- * of FreeType was not compiled with zlib support.
- */
- FT_EXPORT( FT_Error )
- FT_Stream_OpenGzip( FT_Stream stream,
- FT_Stream source );
-
-
- /************************************************************************
- *
- * @function:
- * FT_Gzip_Uncompress
- *
- * @description:
- * Decompress a zipped input buffer into an output buffer. This function
- * is modeled after zlib's `uncompress' function.
- *
- * @input:
- * memory ::
- * A FreeType memory handle.
- *
- * input ::
- * The input buffer.
- *
- * input_len ::
- * The length of the input buffer.
- *
- * @output:
- * output::
- * The output buffer.
- *
- * @inout:
- * output_len ::
- * Before calling the function, this is the the total size of the
- * output buffer, which must be large enough to hold the entire
- * uncompressed data (so the size of the uncompressed data must be
- * known in advance). After calling the function, `output_len' is the
- * size of the used data in `output'.
- *
- * @return:
- * FreeType error code. 0~means success.
- *
- * @note:
- * This function may return `FT_Err_Unimplemented_Feature' if your build
- * of FreeType was not compiled with zlib support.
- */
- FT_EXPORT( FT_Error )
- FT_Gzip_Uncompress( FT_Memory memory,
- FT_Byte* output,
- FT_ULong* output_len,
- const FT_Byte* input,
- FT_ULong input_len );
-
- /* */
-
-
-FT_END_HEADER
-
-#endif /* __FTGZIP_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftimage.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftimage.h
deleted file mode 100644
index 82f284c4f98..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftimage.h
+++ /dev/null
@@ -1,1214 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftimage.h */
-/* */
-/* FreeType glyph image formats and default raster interface */
-/* (specification). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
- /*************************************************************************/
- /* */
- /* Note: A `raster' is simply a scan-line converter, used to render */
- /* FT_Outlines into FT_Bitmaps. */
- /* */
- /*************************************************************************/
-
-
-#ifndef __FTIMAGE_H__
-#define __FTIMAGE_H__
-
-
- /* _STANDALONE_ is from ftgrays.c */
-#ifndef _STANDALONE_
-#include <ft2build.h>
-#endif
-
-
-FT_BEGIN_HEADER
-
-
- /*************************************************************************/
- /* */
- /* <Section> */
- /* basic_types */
- /* */
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* FT_Pos */
- /* */
- /* <Description> */
- /* The type FT_Pos is used to store vectorial coordinates. Depending */
- /* on the context, these can represent distances in integer font */
- /* units, or 16.16, or 26.6 fixed-point pixel coordinates. */
- /* */
- typedef signed long FT_Pos;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* FT_Vector */
- /* */
- /* <Description> */
- /* A simple structure used to store a 2D vector; coordinates are of */
- /* the FT_Pos type. */
- /* */
- /* <Fields> */
- /* x :: The horizontal coordinate. */
- /* y :: The vertical coordinate. */
- /* */
- typedef struct FT_Vector_
- {
- FT_Pos x;
- FT_Pos y;
-
- } FT_Vector;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* FT_BBox */
- /* */
- /* <Description> */
- /* A structure used to hold an outline's bounding box, i.e., the */
- /* coordinates of its extrema in the horizontal and vertical */
- /* directions. */
- /* */
- /* <Fields> */
- /* xMin :: The horizontal minimum (left-most). */
- /* */
- /* yMin :: The vertical minimum (bottom-most). */
- /* */
- /* xMax :: The horizontal maximum (right-most). */
- /* */
- /* yMax :: The vertical maximum (top-most). */
- /* */
- /* <Note> */
- /* The bounding box is specified with the coordinates of the lower */
- /* left and the upper right corner. In PostScript, those values are */
- /* often called (llx,lly) and (urx,ury), respectively. */
- /* */
- /* If `yMin' is negative, this value gives the glyph's descender. */
- /* Otherwise, the glyph doesn't descend below the baseline. */
- /* Similarly, if `ymax' is positive, this value gives the glyph's */
- /* ascender. */
- /* */
- /* `xMin' gives the horizontal distance from the glyph's origin to */
- /* the left edge of the glyph's bounding box. If `xMin' is negative, */
- /* the glyph extends to the left of the origin. */
- /* */
- typedef struct FT_BBox_
- {
- FT_Pos xMin, yMin;
- FT_Pos xMax, yMax;
-
- } FT_BBox;
-
-
- /*************************************************************************/
- /* */
- /* <Enum> */
- /* FT_Pixel_Mode */
- /* */
- /* <Description> */
- /* An enumeration type used to describe the format of pixels in a */
- /* given bitmap. Note that additional formats may be added in the */
- /* future. */
- /* */
- /* <Values> */
- /* FT_PIXEL_MODE_NONE :: */
- /* Value~0 is reserved. */
- /* */
- /* FT_PIXEL_MODE_MONO :: */
- /* A monochrome bitmap, using 1~bit per pixel. Note that pixels */
- /* are stored in most-significant order (MSB), which means that */
- /* the left-most pixel in a byte has value 128. */
- /* */
- /* FT_PIXEL_MODE_GRAY :: */
- /* An 8-bit bitmap, generally used to represent anti-aliased glyph */
- /* images. Each pixel is stored in one byte. Note that the number */
- /* of `gray' levels is stored in the `num_grays' field of the */
- /* @FT_Bitmap structure (it generally is 256). */
- /* */
- /* FT_PIXEL_MODE_GRAY2 :: */
- /* A 2-bit per pixel bitmap, used to represent embedded */
- /* anti-aliased bitmaps in font files according to the OpenType */
- /* specification. We haven't found a single font using this */
- /* format, however. */
- /* */
- /* FT_PIXEL_MODE_GRAY4 :: */
- /* A 4-bit per pixel bitmap, representing embedded anti-aliased */
- /* bitmaps in font files according to the OpenType specification. */
- /* We haven't found a single font using this format, however. */
- /* */
- /* FT_PIXEL_MODE_LCD :: */
- /* An 8-bit bitmap, representing RGB or BGR decimated glyph images */
- /* used for display on LCD displays; the bitmap is three times */
- /* wider than the original glyph image. See also */
- /* @FT_RENDER_MODE_LCD. */
- /* */
- /* FT_PIXEL_MODE_LCD_V :: */
- /* An 8-bit bitmap, representing RGB or BGR decimated glyph images */
- /* used for display on rotated LCD displays; the bitmap is three */
- /* times taller than the original glyph image. See also */
- /* @FT_RENDER_MODE_LCD_V. */
- /* */
- /* FT_PIXEL_MODE_BGRA :: */
- /* An image with four 8-bit channels per pixel, representing a */
- /* color image (such as emoticons) with alpha channel. For each */
- /* pixel, the format is BGRA, which means, the blue channel comes */
- /* first in memory. The color channels are pre-multiplied and in */
- /* the sRGB colorspace. For example, full red at half-translucent */
- /* opacity will be represented as `00,00,80,80', not `00,00,FF,80'. */
- /* See also @FT_LOAD_COLOR. */
- /* */
- typedef enum FT_Pixel_Mode_
- {
- FT_PIXEL_MODE_NONE = 0,
- FT_PIXEL_MODE_MONO,
- FT_PIXEL_MODE_GRAY,
- FT_PIXEL_MODE_GRAY2,
- FT_PIXEL_MODE_GRAY4,
- FT_PIXEL_MODE_LCD,
- FT_PIXEL_MODE_LCD_V,
- FT_PIXEL_MODE_BGRA,
-
- FT_PIXEL_MODE_MAX /* do not remove */
-
- } FT_Pixel_Mode;
-
-
- /* these constants are deprecated; use the corresponding `FT_Pixel_Mode' */
- /* values instead. */
-#define ft_pixel_mode_none FT_PIXEL_MODE_NONE
-#define ft_pixel_mode_mono FT_PIXEL_MODE_MONO
-#define ft_pixel_mode_grays FT_PIXEL_MODE_GRAY
-#define ft_pixel_mode_pal2 FT_PIXEL_MODE_GRAY2
-#define ft_pixel_mode_pal4 FT_PIXEL_MODE_GRAY4
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* FT_Bitmap */
- /* */
- /* <Description> */
- /* A structure used to describe a bitmap or pixmap to the raster. */
- /* Note that we now manage pixmaps of various depths through the */
- /* `pixel_mode' field. */
- /* */
- /* <Fields> */
- /* rows :: The number of bitmap rows. */
- /* */
- /* width :: The number of pixels in bitmap row. */
- /* */
- /* pitch :: The pitch's absolute value is the number of bytes */
- /* taken by one bitmap row, including padding. */
- /* However, the pitch is positive when the bitmap has */
- /* a `down' flow, and negative when it has an `up' */
- /* flow. In all cases, the pitch is an offset to add */
- /* to a bitmap pointer in order to go down one row. */
- /* */
- /* Note that `padding' means the alignment of a */
- /* bitmap to a byte border, and FreeType functions */
- /* normally align to the smallest possible integer */
- /* value. */
- /* */
- /* For the B/W rasterizer, `pitch' is always an even */
- /* number. */
- /* */
- /* To change the pitch of a bitmap (say, to make it a */
- /* multiple of 4), use @FT_Bitmap_Convert. */
- /* Alternatively, you might use callback functions to */
- /* directly render to the application's surface; see */
- /* the file `example2.cpp' in the tutorial for a */
- /* demonstration. */
- /* */
- /* buffer :: A typeless pointer to the bitmap buffer. This */
- /* value should be aligned on 32-bit boundaries in */
- /* most cases. */
- /* */
- /* num_grays :: This field is only used with */
- /* @FT_PIXEL_MODE_GRAY; it gives the number of gray */
- /* levels used in the bitmap. */
- /* */
- /* pixel_mode :: The pixel mode, i.e., how pixel bits are stored. */
- /* See @FT_Pixel_Mode for possible values. */
- /* */
- /* palette_mode :: This field is intended for paletted pixel modes; */
- /* it indicates how the palette is stored. Not */
- /* used currently. */
- /* */
- /* palette :: A typeless pointer to the bitmap palette; this */
- /* field is intended for paletted pixel modes. Not */
- /* used currently. */
- /* */
- typedef struct FT_Bitmap_
- {
- unsigned int rows;
- unsigned int width;
- int pitch;
- unsigned char* buffer;
- unsigned short num_grays;
- unsigned char pixel_mode;
- unsigned char palette_mode;
- void* palette;
-
- } FT_Bitmap;
-
-
- /*************************************************************************/
- /* */
- /* <Section> */
- /* outline_processing */
- /* */
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* FT_Outline */
- /* */
- /* <Description> */
- /* This structure is used to describe an outline to the scan-line */
- /* converter. */
- /* */
- /* <Fields> */
- /* n_contours :: The number of contours in the outline. */
- /* */
- /* n_points :: The number of points in the outline. */
- /* */
- /* points :: A pointer to an array of `n_points' @FT_Vector */
- /* elements, giving the outline's point coordinates. */
- /* */
- /* tags :: A pointer to an array of `n_points' chars, giving */
- /* each outline point's type. */
- /* */
- /* If bit~0 is unset, the point is `off' the curve, */
- /* i.e., a Bézier control point, while it is `on' if */
- /* set. */
- /* */
- /* Bit~1 is meaningful for `off' points only. If set, */
- /* it indicates a third-order Bézier arc control point; */
- /* and a second-order control point if unset. */
- /* */
- /* If bit~2 is set, bits 5-7 contain the drop-out mode */
- /* (as defined in the OpenType specification; the value */
- /* is the same as the argument to the SCANMODE */
- /* instruction). */
- /* */
- /* Bits 3 and~4 are reserved for internal purposes. */
- /* */
- /* contours :: An array of `n_contours' shorts, giving the end */
- /* point of each contour within the outline. For */
- /* example, the first contour is defined by the points */
- /* `0' to `contours[0]', the second one is defined by */
- /* the points `contours[0]+1' to `contours[1]', etc. */
- /* */
- /* flags :: A set of bit flags used to characterize the outline */
- /* and give hints to the scan-converter and hinter on */
- /* how to convert/grid-fit it. See @FT_OUTLINE_XXX. */
- /* */
- /* <Note> */
- /* The B/W rasterizer only checks bit~2 in the `tags' array for the */
- /* first point of each contour. The drop-out mode as given with */
- /* @FT_OUTLINE_IGNORE_DROPOUTS, @FT_OUTLINE_SMART_DROPOUTS, and */
- /* @FT_OUTLINE_INCLUDE_STUBS in `flags' is then overridden. */
- /* */
- typedef struct FT_Outline_
- {
- short n_contours; /* number of contours in glyph */
- short n_points; /* number of points in the glyph */
-
- FT_Vector* points; /* the outline's points */
- char* tags; /* the points flags */
- short* contours; /* the contour end points */
-
- int flags; /* outline masks */
-
- } FT_Outline;
-
- /* */
-
- /* Following limits must be consistent with */
- /* FT_Outline.{n_contours,n_points} */
-#define FT_OUTLINE_CONTOURS_MAX SHRT_MAX
-#define FT_OUTLINE_POINTS_MAX SHRT_MAX
-
-
- /*************************************************************************/
- /* */
- /* <Enum> */
- /* FT_OUTLINE_XXX */
- /* */
- /* <Description> */
- /* A list of bit-field constants use for the flags in an outline's */
- /* `flags' field. */
- /* */
- /* <Values> */
- /* FT_OUTLINE_NONE :: */
- /* Value~0 is reserved. */
- /* */
- /* FT_OUTLINE_OWNER :: */
- /* If set, this flag indicates that the outline's field arrays */
- /* (i.e., `points', `flags', and `contours') are `owned' by the */
- /* outline object, and should thus be freed when it is destroyed. */
- /* */
- /* FT_OUTLINE_EVEN_ODD_FILL :: */
- /* By default, outlines are filled using the non-zero winding rule. */
- /* If set to 1, the outline will be filled using the even-odd fill */
- /* rule (only works with the smooth rasterizer). */
- /* */
- /* FT_OUTLINE_REVERSE_FILL :: */
- /* By default, outside contours of an outline are oriented in */
- /* clock-wise direction, as defined in the TrueType specification. */
- /* This flag is set if the outline uses the opposite direction */
- /* (typically for Type~1 fonts). This flag is ignored by the scan */
- /* converter. */
- /* */
- /* FT_OUTLINE_IGNORE_DROPOUTS :: */
- /* By default, the scan converter will try to detect drop-outs in */
- /* an outline and correct the glyph bitmap to ensure consistent */
- /* shape continuity. If set, this flag hints the scan-line */
- /* converter to ignore such cases. See below for more information. */
- /* */
- /* FT_OUTLINE_SMART_DROPOUTS :: */
- /* Select smart dropout control. If unset, use simple dropout */
- /* control. Ignored if @FT_OUTLINE_IGNORE_DROPOUTS is set. See */
- /* below for more information. */
- /* */
- /* FT_OUTLINE_INCLUDE_STUBS :: */
- /* If set, turn pixels on for `stubs', otherwise exclude them. */
- /* Ignored if @FT_OUTLINE_IGNORE_DROPOUTS is set. See below for */
- /* more information. */
- /* */
- /* FT_OUTLINE_HIGH_PRECISION :: */
- /* This flag indicates that the scan-line converter should try to */
- /* convert this outline to bitmaps with the highest possible */
- /* quality. It is typically set for small character sizes. Note */
- /* that this is only a hint that might be completely ignored by a */
- /* given scan-converter. */
- /* */
- /* FT_OUTLINE_SINGLE_PASS :: */
- /* This flag is set to force a given scan-converter to only use a */
- /* single pass over the outline to render a bitmap glyph image. */
- /* Normally, it is set for very large character sizes. It is only */
- /* a hint that might be completely ignored by a given */
- /* scan-converter. */
- /* */
- /* <Note> */
- /* The flags @FT_OUTLINE_IGNORE_DROPOUTS, @FT_OUTLINE_SMART_DROPOUTS, */
- /* and @FT_OUTLINE_INCLUDE_STUBS are ignored by the smooth */
- /* rasterizer. */
- /* */
- /* There exists a second mechanism to pass the drop-out mode to the */
- /* B/W rasterizer; see the `tags' field in @FT_Outline. */
- /* */
- /* Please refer to the description of the `SCANTYPE' instruction in */
- /* the OpenType specification (in file `ttinst1.doc') how simple */
- /* drop-outs, smart drop-outs, and stubs are defined. */
- /* */
-#define FT_OUTLINE_NONE 0x0
-#define FT_OUTLINE_OWNER 0x1
-#define FT_OUTLINE_EVEN_ODD_FILL 0x2
-#define FT_OUTLINE_REVERSE_FILL 0x4
-#define FT_OUTLINE_IGNORE_DROPOUTS 0x8
-#define FT_OUTLINE_SMART_DROPOUTS 0x10
-#define FT_OUTLINE_INCLUDE_STUBS 0x20
-
-#define FT_OUTLINE_HIGH_PRECISION 0x100
-#define FT_OUTLINE_SINGLE_PASS 0x200
-
-
- /* these constants are deprecated; use the corresponding */
- /* `FT_OUTLINE_XXX' values instead */
-#define ft_outline_none FT_OUTLINE_NONE
-#define ft_outline_owner FT_OUTLINE_OWNER
-#define ft_outline_even_odd_fill FT_OUTLINE_EVEN_ODD_FILL
-#define ft_outline_reverse_fill FT_OUTLINE_REVERSE_FILL
-#define ft_outline_ignore_dropouts FT_OUTLINE_IGNORE_DROPOUTS
-#define ft_outline_high_precision FT_OUTLINE_HIGH_PRECISION
-#define ft_outline_single_pass FT_OUTLINE_SINGLE_PASS
-
- /* */
-
-#define FT_CURVE_TAG( flag ) ( flag & 3 )
-
-#define FT_CURVE_TAG_ON 1
-#define FT_CURVE_TAG_CONIC 0
-#define FT_CURVE_TAG_CUBIC 2
-
-#define FT_CURVE_TAG_HAS_SCANMODE 4
-
-#define FT_CURVE_TAG_TOUCH_X 8 /* reserved for the TrueType hinter */
-#define FT_CURVE_TAG_TOUCH_Y 16 /* reserved for the TrueType hinter */
-
-#define FT_CURVE_TAG_TOUCH_BOTH ( FT_CURVE_TAG_TOUCH_X | \
- FT_CURVE_TAG_TOUCH_Y )
-
-#define FT_Curve_Tag_On FT_CURVE_TAG_ON
-#define FT_Curve_Tag_Conic FT_CURVE_TAG_CONIC
-#define FT_Curve_Tag_Cubic FT_CURVE_TAG_CUBIC
-#define FT_Curve_Tag_Touch_X FT_CURVE_TAG_TOUCH_X
-#define FT_Curve_Tag_Touch_Y FT_CURVE_TAG_TOUCH_Y
-
-
- /*************************************************************************/
- /* */
- /* <FuncType> */
- /* FT_Outline_MoveToFunc */
- /* */
- /* <Description> */
- /* A function pointer type used to describe the signature of a `move */
- /* to' function during outline walking/decomposition. */
- /* */
- /* A `move to' is emitted to start a new contour in an outline. */
- /* */
- /* <Input> */
- /* to :: A pointer to the target point of the `move to'. */
- /* */
- /* user :: A typeless pointer, which is passed from the caller of the */
- /* decomposition function. */
- /* */
- /* <Return> */
- /* Error code. 0~means success. */
- /* */
- typedef int
- (*FT_Outline_MoveToFunc)( const FT_Vector* to,
- void* user );
-
-#define FT_Outline_MoveTo_Func FT_Outline_MoveToFunc
-
-
- /*************************************************************************/
- /* */
- /* <FuncType> */
- /* FT_Outline_LineToFunc */
- /* */
- /* <Description> */
- /* A function pointer type used to describe the signature of a `line */
- /* to' function during outline walking/decomposition. */
- /* */
- /* A `line to' is emitted to indicate a segment in the outline. */
- /* */
- /* <Input> */
- /* to :: A pointer to the target point of the `line to'. */
- /* */
- /* user :: A typeless pointer, which is passed from the caller of the */
- /* decomposition function. */
- /* */
- /* <Return> */
- /* Error code. 0~means success. */
- /* */
- typedef int
- (*FT_Outline_LineToFunc)( const FT_Vector* to,
- void* user );
-
-#define FT_Outline_LineTo_Func FT_Outline_LineToFunc
-
-
- /*************************************************************************/
- /* */
- /* <FuncType> */
- /* FT_Outline_ConicToFunc */
- /* */
- /* <Description> */
- /* A function pointer type used to describe the signature of a `conic */
- /* to' function during outline walking or decomposition. */
- /* */
- /* A `conic to' is emitted to indicate a second-order Bézier arc in */
- /* the outline. */
- /* */
- /* <Input> */
- /* control :: An intermediate control point between the last position */
- /* and the new target in `to'. */
- /* */
- /* to :: A pointer to the target end point of the conic arc. */
- /* */
- /* user :: A typeless pointer, which is passed from the caller of */
- /* the decomposition function. */
- /* */
- /* <Return> */
- /* Error code. 0~means success. */
- /* */
- typedef int
- (*FT_Outline_ConicToFunc)( const FT_Vector* control,
- const FT_Vector* to,
- void* user );
-
-#define FT_Outline_ConicTo_Func FT_Outline_ConicToFunc
-
-
- /*************************************************************************/
- /* */
- /* <FuncType> */
- /* FT_Outline_CubicToFunc */
- /* */
- /* <Description> */
- /* A function pointer type used to describe the signature of a `cubic */
- /* to' function during outline walking or decomposition. */
- /* */
- /* A `cubic to' is emitted to indicate a third-order Bézier arc. */
- /* */
- /* <Input> */
- /* control1 :: A pointer to the first Bézier control point. */
- /* */
- /* control2 :: A pointer to the second Bézier control point. */
- /* */
- /* to :: A pointer to the target end point. */
- /* */
- /* user :: A typeless pointer, which is passed from the caller of */
- /* the decomposition function. */
- /* */
- /* <Return> */
- /* Error code. 0~means success. */
- /* */
- typedef int
- (*FT_Outline_CubicToFunc)( const FT_Vector* control1,
- const FT_Vector* control2,
- const FT_Vector* to,
- void* user );
-
-#define FT_Outline_CubicTo_Func FT_Outline_CubicToFunc
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* FT_Outline_Funcs */
- /* */
- /* <Description> */
- /* A structure to hold various function pointers used during outline */
- /* decomposition in order to emit segments, conic, and cubic Béziers. */
- /* */
- /* <Fields> */
- /* move_to :: The `move to' emitter. */
- /* */
- /* line_to :: The segment emitter. */
- /* */
- /* conic_to :: The second-order Bézier arc emitter. */
- /* */
- /* cubic_to :: The third-order Bézier arc emitter. */
- /* */
- /* shift :: The shift that is applied to coordinates before they */
- /* are sent to the emitter. */
- /* */
- /* delta :: The delta that is applied to coordinates before they */
- /* are sent to the emitter, but after the shift. */
- /* */
- /* <Note> */
- /* The point coordinates sent to the emitters are the transformed */
- /* version of the original coordinates (this is important for high */
- /* accuracy during scan-conversion). The transformation is simple: */
- /* */
- /* { */
- /* x' = (x << shift) - delta */
- /* y' = (x << shift) - delta */
- /* } */
- /* */
- /* Set the values of `shift' and `delta' to~0 to get the original */
- /* point coordinates. */
- /* */
- typedef struct FT_Outline_Funcs_
- {
- FT_Outline_MoveToFunc move_to;
- FT_Outline_LineToFunc line_to;
- FT_Outline_ConicToFunc conic_to;
- FT_Outline_CubicToFunc cubic_to;
-
- int shift;
- FT_Pos delta;
-
- } FT_Outline_Funcs;
-
-
- /*************************************************************************/
- /* */
- /* <Section> */
- /* basic_types */
- /* */
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* <Macro> */
- /* FT_IMAGE_TAG */
- /* */
- /* <Description> */
- /* This macro converts four-letter tags to an unsigned long type. */
- /* */
- /* <Note> */
- /* Since many 16-bit compilers don't like 32-bit enumerations, you */
- /* should redefine this macro in case of problems to something like */
- /* this: */
- /* */
- /* { */
- /* #define FT_IMAGE_TAG( value, _x1, _x2, _x3, _x4 ) value */
- /* } */
- /* */
- /* to get a simple enumeration without assigning special numbers. */
- /* */
-#ifndef FT_IMAGE_TAG
-#define FT_IMAGE_TAG( value, _x1, _x2, _x3, _x4 ) \
- value = ( ( (unsigned long)_x1 << 24 ) | \
- ( (unsigned long)_x2 << 16 ) | \
- ( (unsigned long)_x3 << 8 ) | \
- (unsigned long)_x4 )
-#endif /* FT_IMAGE_TAG */
-
-
- /*************************************************************************/
- /* */
- /* <Enum> */
- /* FT_Glyph_Format */
- /* */
- /* <Description> */
- /* An enumeration type used to describe the format of a given glyph */
- /* image. Note that this version of FreeType only supports two image */
- /* formats, even though future font drivers will be able to register */
- /* their own format. */
- /* */
- /* <Values> */
- /* FT_GLYPH_FORMAT_NONE :: */
- /* The value~0 is reserved. */
- /* */
- /* FT_GLYPH_FORMAT_COMPOSITE :: */
- /* The glyph image is a composite of several other images. This */
- /* format is _only_ used with @FT_LOAD_NO_RECURSE, and is used to */
- /* report compound glyphs (like accented characters). */
- /* */
- /* FT_GLYPH_FORMAT_BITMAP :: */
- /* The glyph image is a bitmap, and can be described as an */
- /* @FT_Bitmap. You generally need to access the `bitmap' field of */
- /* the @FT_GlyphSlotRec structure to read it. */
- /* */
- /* FT_GLYPH_FORMAT_OUTLINE :: */
- /* The glyph image is a vectorial outline made of line segments */
- /* and Bézier arcs; it can be described as an @FT_Outline; you */
- /* generally want to access the `outline' field of the */
- /* @FT_GlyphSlotRec structure to read it. */
- /* */
- /* FT_GLYPH_FORMAT_PLOTTER :: */
- /* The glyph image is a vectorial path with no inside and outside */
- /* contours. Some Type~1 fonts, like those in the Hershey family, */
- /* contain glyphs in this format. These are described as */
- /* @FT_Outline, but FreeType isn't currently capable of rendering */
- /* them correctly. */
- /* */
- typedef enum FT_Glyph_Format_
- {
- FT_IMAGE_TAG( FT_GLYPH_FORMAT_NONE, 0, 0, 0, 0 ),
-
- FT_IMAGE_TAG( FT_GLYPH_FORMAT_COMPOSITE, 'c', 'o', 'm', 'p' ),
- FT_IMAGE_TAG( FT_GLYPH_FORMAT_BITMAP, 'b', 'i', 't', 's' ),
- FT_IMAGE_TAG( FT_GLYPH_FORMAT_OUTLINE, 'o', 'u', 't', 'l' ),
- FT_IMAGE_TAG( FT_GLYPH_FORMAT_PLOTTER, 'p', 'l', 'o', 't' )
-
- } FT_Glyph_Format;
-
-
- /* these constants are deprecated; use the corresponding */
- /* `FT_Glyph_Format' values instead. */
-#define ft_glyph_format_none FT_GLYPH_FORMAT_NONE
-#define ft_glyph_format_composite FT_GLYPH_FORMAT_COMPOSITE
-#define ft_glyph_format_bitmap FT_GLYPH_FORMAT_BITMAP
-#define ft_glyph_format_outline FT_GLYPH_FORMAT_OUTLINE
-#define ft_glyph_format_plotter FT_GLYPH_FORMAT_PLOTTER
-
-
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** R A S T E R D E F I N I T I O N S *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* A raster is a scan converter, in charge of rendering an outline into */
- /* a a bitmap. This section contains the public API for rasters. */
- /* */
- /* Note that in FreeType 2, all rasters are now encapsulated within */
- /* specific modules called `renderers'. See `ftrender.h' for more */
- /* details on renderers. */
- /* */
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* <Section> */
- /* raster */
- /* */
- /* <Title> */
- /* Scanline Converter */
- /* */
- /* <Abstract> */
- /* How vectorial outlines are converted into bitmaps and pixmaps. */
- /* */
- /* <Description> */
- /* This section contains technical definitions. */
- /* */
- /* <Order> */
- /* FT_Raster */
- /* FT_Span */
- /* FT_SpanFunc */
- /* */
- /* FT_Raster_Params */
- /* FT_RASTER_FLAG_XXX */
- /* */
- /* FT_Raster_NewFunc */
- /* FT_Raster_DoneFunc */
- /* FT_Raster_ResetFunc */
- /* FT_Raster_SetModeFunc */
- /* FT_Raster_RenderFunc */
- /* FT_Raster_Funcs */
- /* */
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* FT_Raster */
- /* */
- /* <Description> */
- /* An opaque handle (pointer) to a raster object. Each object can be */
- /* used independently to convert an outline into a bitmap or pixmap. */
- /* */
- typedef struct FT_RasterRec_* FT_Raster;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* FT_Span */
- /* */
- /* <Description> */
- /* A structure used to model a single span of gray pixels when */
- /* rendering an anti-aliased bitmap. */
- /* */
- /* <Fields> */
- /* x :: The span's horizontal start position. */
- /* */
- /* len :: The span's length in pixels. */
- /* */
- /* coverage :: The span color/coverage, ranging from 0 (background) */
- /* to 255 (foreground). */
- /* */
- /* <Note> */
- /* This structure is used by the span drawing callback type named */
- /* @FT_SpanFunc that takes the y~coordinate of the span as a */
- /* parameter. */
- /* */
- /* The coverage value is always between 0 and 255. If you want less */
- /* gray values, the callback function has to reduce them. */
- /* */
- typedef struct FT_Span_
- {
- short x;
- unsigned short len;
- unsigned char coverage;
-
- } FT_Span;
-
-
- /*************************************************************************/
- /* */
- /* <FuncType> */
- /* FT_SpanFunc */
- /* */
- /* <Description> */
- /* A function used as a call-back by the anti-aliased renderer in */
- /* order to let client applications draw themselves the gray pixel */
- /* spans on each scan line. */
- /* */
- /* <Input> */
- /* y :: The scanline's y~coordinate. */
- /* */
- /* count :: The number of spans to draw on this scanline. */
- /* */
- /* spans :: A table of `count' spans to draw on the scanline. */
- /* */
- /* user :: User-supplied data that is passed to the callback. */
- /* */
- /* <Note> */
- /* This callback allows client applications to directly render the */
- /* gray spans of the anti-aliased bitmap to any kind of surfaces. */
- /* */
- /* This can be used to write anti-aliased outlines directly to a */
- /* given background bitmap, and even perform translucency. */
- /* */
- /* Note that the `count' field cannot be greater than a fixed value */
- /* defined by the `FT_MAX_GRAY_SPANS' configuration macro in */
- /* `ftoption.h'. By default, this value is set to~32, which means */
- /* that if there are more than 32~spans on a given scanline, the */
- /* callback is called several times with the same `y' parameter in */
- /* order to draw all callbacks. */
- /* */
- /* Otherwise, the callback is only called once per scan-line, and */
- /* only for those scanlines that do have `gray' pixels on them. */
- /* */
- typedef void
- (*FT_SpanFunc)( int y,
- int count,
- const FT_Span* spans,
- void* user );
-
-#define FT_Raster_Span_Func FT_SpanFunc
-
-
- /*************************************************************************/
- /* */
- /* <FuncType> */
- /* FT_Raster_BitTest_Func */
- /* */
- /* <Description> */
- /* Deprecated, unimplemented. */
- /* */
- typedef int
- (*FT_Raster_BitTest_Func)( int y,
- int x,
- void* user );
-
-
- /*************************************************************************/
- /* */
- /* <FuncType> */
- /* FT_Raster_BitSet_Func */
- /* */
- /* <Description> */
- /* Deprecated, unimplemented. */
- /* */
- typedef void
- (*FT_Raster_BitSet_Func)( int y,
- int x,
- void* user );
-
-
- /*************************************************************************/
- /* */
- /* <Enum> */
- /* FT_RASTER_FLAG_XXX */
- /* */
- /* <Description> */
- /* A list of bit flag constants as used in the `flags' field of a */
- /* @FT_Raster_Params structure. */
- /* */
- /* <Values> */
- /* FT_RASTER_FLAG_DEFAULT :: This value is 0. */
- /* */
- /* FT_RASTER_FLAG_AA :: This flag is set to indicate that an */
- /* anti-aliased glyph image should be */
- /* generated. Otherwise, it will be */
- /* monochrome (1-bit). */
- /* */
- /* FT_RASTER_FLAG_DIRECT :: This flag is set to indicate direct */
- /* rendering. In this mode, client */
- /* applications must provide their own span */
- /* callback. This lets them directly */
- /* draw or compose over an existing bitmap. */
- /* If this bit is not set, the target */
- /* pixmap's buffer _must_ be zeroed before */
- /* rendering. */
- /* */
- /* Direct rendering is only possible with */
- /* anti-aliased glyphs. */
- /* */
- /* FT_RASTER_FLAG_CLIP :: This flag is only used in direct */
- /* rendering mode. If set, the output will */
- /* be clipped to a box specified in the */
- /* `clip_box' field of the */
- /* @FT_Raster_Params structure. */
- /* */
- /* Note that by default, the glyph bitmap */
- /* is clipped to the target pixmap, except */
- /* in direct rendering mode where all spans */
- /* are generated if no clipping box is set. */
- /* */
-#define FT_RASTER_FLAG_DEFAULT 0x0
-#define FT_RASTER_FLAG_AA 0x1
-#define FT_RASTER_FLAG_DIRECT 0x2
-#define FT_RASTER_FLAG_CLIP 0x4
-
- /* these constants are deprecated; use the corresponding */
- /* `FT_RASTER_FLAG_XXX' values instead */
-#define ft_raster_flag_default FT_RASTER_FLAG_DEFAULT
-#define ft_raster_flag_aa FT_RASTER_FLAG_AA
-#define ft_raster_flag_direct FT_RASTER_FLAG_DIRECT
-#define ft_raster_flag_clip FT_RASTER_FLAG_CLIP
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* FT_Raster_Params */
- /* */
- /* <Description> */
- /* A structure to hold the arguments used by a raster's render */
- /* function. */
- /* */
- /* <Fields> */
- /* target :: The target bitmap. */
- /* */
- /* source :: A pointer to the source glyph image (e.g., an */
- /* @FT_Outline). */
- /* */
- /* flags :: The rendering flags. */
- /* */
- /* gray_spans :: The gray span drawing callback. */
- /* */
- /* black_spans :: Unused. */
- /* */
- /* bit_test :: Unused. */
- /* */
- /* bit_set :: Unused. */
- /* */
- /* user :: User-supplied data that is passed to each drawing */
- /* callback. */
- /* */
- /* clip_box :: An optional clipping box. It is only used in */
- /* direct rendering mode. Note that coordinates here */
- /* should be expressed in _integer_ pixels (and not in */
- /* 26.6 fixed-point units). */
- /* */
- /* <Note> */
- /* An anti-aliased glyph bitmap is drawn if the @FT_RASTER_FLAG_AA */
- /* bit flag is set in the `flags' field, otherwise a monochrome */
- /* bitmap is generated. */
- /* */
- /* If the @FT_RASTER_FLAG_DIRECT bit flag is set in `flags', the */
- /* raster will call the `gray_spans' callback to draw gray pixel */
- /* spans. This allows direct composition over a pre-existing bitmap */
- /* through user-provided callbacks to perform the span drawing and */
- /* composition. Not supported by the monochrome rasterizer. */
- /* */
- typedef struct FT_Raster_Params_
- {
- const FT_Bitmap* target;
- const void* source;
- int flags;
- FT_SpanFunc gray_spans;
- FT_SpanFunc black_spans; /* unused */
- FT_Raster_BitTest_Func bit_test; /* unused */
- FT_Raster_BitSet_Func bit_set; /* unused */
- void* user;
- FT_BBox clip_box;
-
- } FT_Raster_Params;
-
-
- /*************************************************************************/
- /* */
- /* <FuncType> */
- /* FT_Raster_NewFunc */
- /* */
- /* <Description> */
- /* A function used to create a new raster object. */
- /* */
- /* <Input> */
- /* memory :: A handle to the memory allocator. */
- /* */
- /* <Output> */
- /* raster :: A handle to the new raster object. */
- /* */
- /* <Return> */
- /* Error code. 0~means success. */
- /* */
- /* <Note> */
- /* The `memory' parameter is a typeless pointer in order to avoid */
- /* un-wanted dependencies on the rest of the FreeType code. In */
- /* practice, it is an @FT_Memory object, i.e., a handle to the */
- /* standard FreeType memory allocator. However, this field can be */
- /* completely ignored by a given raster implementation. */
- /* */
- typedef int
- (*FT_Raster_NewFunc)( void* memory,
- FT_Raster* raster );
-
-#define FT_Raster_New_Func FT_Raster_NewFunc
-
-
- /*************************************************************************/
- /* */
- /* <FuncType> */
- /* FT_Raster_DoneFunc */
- /* */
- /* <Description> */
- /* A function used to destroy a given raster object. */
- /* */
- /* <Input> */
- /* raster :: A handle to the raster object. */
- /* */
- typedef void
- (*FT_Raster_DoneFunc)( FT_Raster raster );
-
-#define FT_Raster_Done_Func FT_Raster_DoneFunc
-
-
- /*************************************************************************/
- /* */
- /* <FuncType> */
- /* FT_Raster_ResetFunc */
- /* */
- /* <Description> */
- /* FreeType used to provide an area of memory called the `render */
- /* pool' available to all registered rasters. This was not thread */
- /* safe however and now FreeType never allocates this pool. NULL */
- /* is always passed in as pool_base. */
- /* */
- /* This function is called each time the render pool changes, or just */
- /* after a new raster object is created. */
- /* */
- /* <Input> */
- /* raster :: A handle to the new raster object. */
- /* */
- /* pool_base :: The address in memory of the render pool. */
- /* */
- /* pool_size :: The size in bytes of the render pool. */
- /* */
- /* <Note> */
- /* Rasters should ignore the render pool and rely on dynamic or stack */
- /* allocation if they want to (a handle to the memory allocator is */
- /* passed to the raster constructor). */
- /* */
- typedef void
- (*FT_Raster_ResetFunc)( FT_Raster raster,
- unsigned char* pool_base,
- unsigned long pool_size );
-
-#define FT_Raster_Reset_Func FT_Raster_ResetFunc
-
-
- /*************************************************************************/
- /* */
- /* <FuncType> */
- /* FT_Raster_SetModeFunc */
- /* */
- /* <Description> */
- /* This function is a generic facility to change modes or attributes */
- /* in a given raster. This can be used for debugging purposes, or */
- /* simply to allow implementation-specific `features' in a given */
- /* raster module. */
- /* */
- /* <Input> */
- /* raster :: A handle to the new raster object. */
- /* */
- /* mode :: A 4-byte tag used to name the mode or property. */
- /* */
- /* args :: A pointer to the new mode/property to use. */
- /* */
- typedef int
- (*FT_Raster_SetModeFunc)( FT_Raster raster,
- unsigned long mode,
- void* args );
-
-#define FT_Raster_Set_Mode_Func FT_Raster_SetModeFunc
-
-
- /*************************************************************************/
- /* */
- /* <FuncType> */
- /* FT_Raster_RenderFunc */
- /* */
- /* <Description> */
- /* Invoke a given raster to scan-convert a given glyph image into a */
- /* target bitmap. */
- /* */
- /* <Input> */
- /* raster :: A handle to the raster object. */
- /* */
- /* params :: A pointer to an @FT_Raster_Params structure used to */
- /* store the rendering parameters. */
- /* */
- /* <Return> */
- /* Error code. 0~means success. */
- /* */
- /* <Note> */
- /* The exact format of the source image depends on the raster's glyph */
- /* format defined in its @FT_Raster_Funcs structure. It can be an */
- /* @FT_Outline or anything else in order to support a large array of */
- /* glyph formats. */
- /* */
- /* Note also that the render function can fail and return a */
- /* `FT_Err_Unimplemented_Feature' error code if the raster used does */
- /* not support direct composition. */
- /* */
- /* XXX: For now, the standard raster doesn't support direct */
- /* composition but this should change for the final release (see */
- /* the files `demos/src/ftgrays.c' and `demos/src/ftgrays2.c' */
- /* for examples of distinct implementations that support direct */
- /* composition). */
- /* */
- typedef int
- (*FT_Raster_RenderFunc)( FT_Raster raster,
- const FT_Raster_Params* params );
-
-#define FT_Raster_Render_Func FT_Raster_RenderFunc
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* FT_Raster_Funcs */
- /* */
- /* <Description> */
- /* A structure used to describe a given raster class to the library. */
- /* */
- /* <Fields> */
- /* glyph_format :: The supported glyph format for this raster. */
- /* */
- /* raster_new :: The raster constructor. */
- /* */
- /* raster_reset :: Used to reset the render pool within the raster. */
- /* */
- /* raster_render :: A function to render a glyph into a given bitmap. */
- /* */
- /* raster_done :: The raster destructor. */
- /* */
- typedef struct FT_Raster_Funcs_
- {
- FT_Glyph_Format glyph_format;
- FT_Raster_NewFunc raster_new;
- FT_Raster_ResetFunc raster_reset;
- FT_Raster_SetModeFunc raster_set_mode;
- FT_Raster_RenderFunc raster_render;
- FT_Raster_DoneFunc raster_done;
-
- } FT_Raster_Funcs;
-
- /* */
-
-
-FT_END_HEADER
-
-#endif /* __FTIMAGE_H__ */
-
-
-/* END */
-
-
-/* Local Variables: */
-/* coding: utf-8 */
-/* End: */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftincrem.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftincrem.h
deleted file mode 100644
index 840af25b059..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftincrem.h
+++ /dev/null
@@ -1,354 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftincrem.h */
-/* */
-/* FreeType incremental loading (specification). */
-/* */
-/* Copyright 2002-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __FTINCREM_H__
-#define __FTINCREM_H__
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-
-#ifdef FREETYPE_H
-#error "freetype.h of FreeType 1 has been loaded!"
-#error "Please fix the directory search order for header files"
-#error "so that freetype.h of FreeType 2 is found first."
-#endif
-
-
-FT_BEGIN_HEADER
-
- /***************************************************************************
- *
- * @section:
- * incremental
- *
- * @title:
- * Incremental Loading
- *
- * @abstract:
- * Custom Glyph Loading.
- *
- * @description:
- * This section contains various functions used to perform so-called
- * `incremental' glyph loading. This is a mode where all glyphs loaded
- * from a given @FT_Face are provided by the client application.
- *
- * Apart from that, all other tables are loaded normally from the font
- * file. This mode is useful when FreeType is used within another
- * engine, e.g., a PostScript Imaging Processor.
- *
- * To enable this mode, you must use @FT_Open_Face, passing an
- * @FT_Parameter with the @FT_PARAM_TAG_INCREMENTAL tag and an
- * @FT_Incremental_Interface value. See the comments for
- * @FT_Incremental_InterfaceRec for an example.
- *
- */
-
-
- /***************************************************************************
- *
- * @type:
- * FT_Incremental
- *
- * @description:
- * An opaque type describing a user-provided object used to implement
- * `incremental' glyph loading within FreeType. This is used to support
- * embedded fonts in certain environments (e.g., PostScript interpreters),
- * where the glyph data isn't in the font file, or must be overridden by
- * different values.
- *
- * @note:
- * It is up to client applications to create and implement @FT_Incremental
- * objects, as long as they provide implementations for the methods
- * @FT_Incremental_GetGlyphDataFunc, @FT_Incremental_FreeGlyphDataFunc
- * and @FT_Incremental_GetGlyphMetricsFunc.
- *
- * See the description of @FT_Incremental_InterfaceRec to understand how
- * to use incremental objects with FreeType.
- *
- */
- typedef struct FT_IncrementalRec_* FT_Incremental;
-
-
- /***************************************************************************
- *
- * @struct:
- * FT_Incremental_MetricsRec
- *
- * @description:
- * A small structure used to contain the basic glyph metrics returned
- * by the @FT_Incremental_GetGlyphMetricsFunc method.
- *
- * @fields:
- * bearing_x ::
- * Left bearing, in font units.
- *
- * bearing_y ::
- * Top bearing, in font units.
- *
- * advance ::
- * Horizontal component of glyph advance, in font units.
- *
- * advance_v ::
- * Vertical component of glyph advance, in font units.
- *
- * @note:
- * These correspond to horizontal or vertical metrics depending on the
- * value of the `vertical' argument to the function
- * @FT_Incremental_GetGlyphMetricsFunc.
- *
- */
- typedef struct FT_Incremental_MetricsRec_
- {
- FT_Long bearing_x;
- FT_Long bearing_y;
- FT_Long advance;
- FT_Long advance_v; /* since 2.3.12 */
-
- } FT_Incremental_MetricsRec;
-
-
- /***************************************************************************
- *
- * @struct:
- * FT_Incremental_Metrics
- *
- * @description:
- * A handle to an @FT_Incremental_MetricsRec structure.
- *
- */
- typedef struct FT_Incremental_MetricsRec_* FT_Incremental_Metrics;
-
-
- /***************************************************************************
- *
- * @type:
- * FT_Incremental_GetGlyphDataFunc
- *
- * @description:
- * A function called by FreeType to access a given glyph's data bytes
- * during @FT_Load_Glyph or @FT_Load_Char if incremental loading is
- * enabled.
- *
- * Note that the format of the glyph's data bytes depends on the font
- * file format. For TrueType, it must correspond to the raw bytes within
- * the `glyf' table. For PostScript formats, it must correspond to the
- * *unencrypted* charstring bytes, without any `lenIV' header. It is
- * undefined for any other format.
- *
- * @input:
- * incremental ::
- * Handle to an opaque @FT_Incremental handle provided by the client
- * application.
- *
- * glyph_index ::
- * Index of relevant glyph.
- *
- * @output:
- * adata ::
- * A structure describing the returned glyph data bytes (which will be
- * accessed as a read-only byte block).
- *
- * @return:
- * FreeType error code. 0~means success.
- *
- * @note:
- * If this function returns successfully the method
- * @FT_Incremental_FreeGlyphDataFunc will be called later to release
- * the data bytes.
- *
- * Nested calls to @FT_Incremental_GetGlyphDataFunc can happen for
- * compound glyphs.
- *
- */
- typedef FT_Error
- (*FT_Incremental_GetGlyphDataFunc)( FT_Incremental incremental,
- FT_UInt glyph_index,
- FT_Data* adata );
-
-
- /***************************************************************************
- *
- * @type:
- * FT_Incremental_FreeGlyphDataFunc
- *
- * @description:
- * A function used to release the glyph data bytes returned by a
- * successful call to @FT_Incremental_GetGlyphDataFunc.
- *
- * @input:
- * incremental ::
- * A handle to an opaque @FT_Incremental handle provided by the client
- * application.
- *
- * data ::
- * A structure describing the glyph data bytes (which will be accessed
- * as a read-only byte block).
- *
- */
- typedef void
- (*FT_Incremental_FreeGlyphDataFunc)( FT_Incremental incremental,
- FT_Data* data );
-
-
- /***************************************************************************
- *
- * @type:
- * FT_Incremental_GetGlyphMetricsFunc
- *
- * @description:
- * A function used to retrieve the basic metrics of a given glyph index
- * before accessing its data. This is necessary because, in certain
- * formats like TrueType, the metrics are stored in a different place from
- * the glyph images proper.
- *
- * @input:
- * incremental ::
- * A handle to an opaque @FT_Incremental handle provided by the client
- * application.
- *
- * glyph_index ::
- * Index of relevant glyph.
- *
- * vertical ::
- * If true, return vertical metrics.
- *
- * ametrics ::
- * This parameter is used for both input and output.
- * The original glyph metrics, if any, in font units. If metrics are
- * not available all the values must be set to zero.
- *
- * @output:
- * ametrics ::
- * The replacement glyph metrics in font units.
- *
- */
- typedef FT_Error
- (*FT_Incremental_GetGlyphMetricsFunc)
- ( FT_Incremental incremental,
- FT_UInt glyph_index,
- FT_Bool vertical,
- FT_Incremental_MetricsRec *ametrics );
-
-
- /**************************************************************************
- *
- * @struct:
- * FT_Incremental_FuncsRec
- *
- * @description:
- * A table of functions for accessing fonts that load data
- * incrementally. Used in @FT_Incremental_InterfaceRec.
- *
- * @fields:
- * get_glyph_data ::
- * The function to get glyph data. Must not be null.
- *
- * free_glyph_data ::
- * The function to release glyph data. Must not be null.
- *
- * get_glyph_metrics ::
- * The function to get glyph metrics. May be null if the font does
- * not provide overriding glyph metrics.
- *
- */
- typedef struct FT_Incremental_FuncsRec_
- {
- FT_Incremental_GetGlyphDataFunc get_glyph_data;
- FT_Incremental_FreeGlyphDataFunc free_glyph_data;
- FT_Incremental_GetGlyphMetricsFunc get_glyph_metrics;
-
- } FT_Incremental_FuncsRec;
-
-
- /***************************************************************************
- *
- * @struct:
- * FT_Incremental_InterfaceRec
- *
- * @description:
- * A structure to be used with @FT_Open_Face to indicate that the user
- * wants to support incremental glyph loading. You should use it with
- * @FT_PARAM_TAG_INCREMENTAL as in the following example:
- *
- * {
- * FT_Incremental_InterfaceRec inc_int;
- * FT_Parameter parameter;
- * FT_Open_Args open_args;
- *
- *
- * // set up incremental descriptor
- * inc_int.funcs = my_funcs;
- * inc_int.object = my_object;
- *
- * // set up optional parameter
- * parameter.tag = FT_PARAM_TAG_INCREMENTAL;
- * parameter.data = &inc_int;
- *
- * // set up FT_Open_Args structure
- * open_args.flags = FT_OPEN_PATHNAME | FT_OPEN_PARAMS;
- * open_args.pathname = my_font_pathname;
- * open_args.num_params = 1;
- * open_args.params = &parameter; // we use one optional argument
- *
- * // open the font
- * error = FT_Open_Face( library, &open_args, index, &face );
- * ...
- * }
- *
- */
- typedef struct FT_Incremental_InterfaceRec_
- {
- const FT_Incremental_FuncsRec* funcs;
- FT_Incremental object;
-
- } FT_Incremental_InterfaceRec;
-
-
- /***************************************************************************
- *
- * @type:
- * FT_Incremental_Interface
- *
- * @description:
- * A pointer to an @FT_Incremental_InterfaceRec structure.
- *
- */
- typedef FT_Incremental_InterfaceRec* FT_Incremental_Interface;
-
-
- /***************************************************************************
- *
- * @constant:
- * FT_PARAM_TAG_INCREMENTAL
- *
- * @description:
- * A constant used as the tag of @FT_Parameter structures to indicate
- * an incremental loading object to be used by FreeType.
- *
- */
-#define FT_PARAM_TAG_INCREMENTAL FT_MAKE_TAG( 'i', 'n', 'c', 'r' )
-
- /* */
-
-
-FT_END_HEADER
-
-#endif /* __FTINCREM_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftlcdfil.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftlcdfil.h
deleted file mode 100644
index 4cd999a4b34..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftlcdfil.h
+++ /dev/null
@@ -1,251 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftlcdfil.h */
-/* */
-/* FreeType API for color filtering of subpixel bitmap glyphs */
-/* (specification). */
-/* */
-/* Copyright 2006-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __FT_LCD_FILTER_H__
-#define __FT_LCD_FILTER_H__
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-
-#ifdef FREETYPE_H
-#error "freetype.h of FreeType 1 has been loaded!"
-#error "Please fix the directory search order for header files"
-#error "so that freetype.h of FreeType 2 is found first."
-#endif
-
-
-FT_BEGIN_HEADER
-
- /***************************************************************************
- *
- * @section:
- * lcd_filtering
- *
- * @title:
- * LCD Filtering
- *
- * @abstract:
- * Reduce color fringes of LCD-optimized bitmaps.
- *
- * @description:
- * The @FT_Library_SetLcdFilter API can be used to specify a low-pass
- * filter, which is then applied to LCD-optimized bitmaps generated
- * through @FT_Render_Glyph. This is useful to reduce color fringes
- * that would occur with unfiltered rendering.
- *
- * Note that no filter is active by default, and that this function is
- * *not* implemented in default builds of the library. You need to
- * #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING in your `ftoption.h' file
- * in order to activate it.
- *
- * FreeType generates alpha coverage maps, which are linear by nature.
- * For instance, the value 0x80 in bitmap representation means that
- * (within numerical precision) 0x80/0xFF fraction of that pixel is
- * covered by the glyph's outline. The blending function for placing
- * text over a background is
- *
- * {
- * dst = alpha * src + (1 - alpha) * dst ,
- * }
- *
- * which is known as OVER. However, when calculating the output of the
- * OVER operator, the source colors should first be transformed to a
- * linear color space, then alpha blended in that space, and transformed
- * back to the output color space.
- *
- * When linear light blending is used, the default FIR5 filtering
- * weights (as given by FT_LCD_FILTER_DEFAULT) are no longer optimal, as
- * they have been designed for black on white rendering while lacking
- * gamma correction. To preserve color neutrality, weights for a FIR5
- * filter should be chosen according to two free parameters `a' and `c',
- * and the FIR weights should be
- *
- * {
- * [a - c, a + c, 2 * a, a + c, a - c] .
- * }
- *
- * This formula generates equal weights for all the color primaries
- * across the filter kernel, which makes it colorless. One suggested
- * set of weights is
- *
- * {
- * [0x10, 0x50, 0x60, 0x50, 0x10] ,
- * }
- *
- * where `a' has value 0x30 and `b' value 0x20. The weights in filter
- * may have a sum larger than 0x100, which increases coloration slightly
- * but also improves contrast.
- */
-
-
- /****************************************************************************
- *
- * @enum:
- * FT_LcdFilter
- *
- * @description:
- * A list of values to identify various types of LCD filters.
- *
- * @values:
- * FT_LCD_FILTER_NONE ::
- * Do not perform filtering. When used with subpixel rendering, this
- * results in sometimes severe color fringes.
- *
- * FT_LCD_FILTER_DEFAULT ::
- * The default filter reduces color fringes considerably, at the cost
- * of a slight blurriness in the output.
- *
- * FT_LCD_FILTER_LIGHT ::
- * The light filter is a variant that produces less blurriness at the
- * cost of slightly more color fringes than the default one. It might
- * be better, depending on taste, your monitor, or your personal vision.
- *
- * FT_LCD_FILTER_LEGACY ::
- * This filter corresponds to the original libXft color filter. It
- * provides high contrast output but can exhibit really bad color
- * fringes if glyphs are not extremely well hinted to the pixel grid.
- * In other words, it only works well if the TrueType bytecode
- * interpreter is enabled *and* high-quality hinted fonts are used.
- *
- * This filter is only provided for comparison purposes, and might be
- * disabled or stay unsupported in the future.
- *
- * @since:
- * 2.3.0
- */
- typedef enum FT_LcdFilter_
- {
- FT_LCD_FILTER_NONE = 0,
- FT_LCD_FILTER_DEFAULT = 1,
- FT_LCD_FILTER_LIGHT = 2,
- FT_LCD_FILTER_LEGACY = 16,
-
- FT_LCD_FILTER_MAX /* do not remove */
-
- } FT_LcdFilter;
-
-
- /**************************************************************************
- *
- * @func:
- * FT_Library_SetLcdFilter
- *
- * @description:
- * This function is used to apply color filtering to LCD decimated
- * bitmaps, like the ones used when calling @FT_Render_Glyph with
- * @FT_RENDER_MODE_LCD or @FT_RENDER_MODE_LCD_V.
- *
- * @input:
- * library ::
- * A handle to the target library instance.
- *
- * filter ::
- * The filter type.
- *
- * You can use @FT_LCD_FILTER_NONE here to disable this feature, or
- * @FT_LCD_FILTER_DEFAULT to use a default filter that should work
- * well on most LCD screens.
- *
- * @return:
- * FreeType error code. 0~means success.
- *
- * @note:
- * This feature is always disabled by default. Clients must make an
- * explicit call to this function with a `filter' value other than
- * @FT_LCD_FILTER_NONE in order to enable it.
- *
- * Due to *PATENTS* covering subpixel rendering, this function doesn't
- * do anything except returning `FT_Err_Unimplemented_Feature' if the
- * configuration macro FT_CONFIG_OPTION_SUBPIXEL_RENDERING is not
- * defined in your build of the library, which should correspond to all
- * default builds of FreeType.
- *
- * The filter affects glyph bitmaps rendered through @FT_Render_Glyph,
- * @FT_Outline_Get_Bitmap, @FT_Load_Glyph, and @FT_Load_Char.
- *
- * It does _not_ affect the output of @FT_Outline_Render and
- * @FT_Outline_Get_Bitmap.
- *
- * If this feature is activated, the dimensions of LCD glyph bitmaps are
- * either larger or taller than the dimensions of the corresponding
- * outline with regards to the pixel grid. For example, for
- * @FT_RENDER_MODE_LCD, the filter adds up to 3~pixels to the left, and
- * up to 3~pixels to the right.
- *
- * The bitmap offset values are adjusted correctly, so clients shouldn't
- * need to modify their layout and glyph positioning code when enabling
- * the filter.
- *
- * @since:
- * 2.3.0
- */
- FT_EXPORT( FT_Error )
- FT_Library_SetLcdFilter( FT_Library library,
- FT_LcdFilter filter );
-
-
- /**************************************************************************
- *
- * @func:
- * FT_Library_SetLcdFilterWeights
- *
- * @description:
- * Use this function to override the filter weights selected by
- * @FT_Library_SetLcdFilter. By default, FreeType uses the quintuple
- * (0x00, 0x55, 0x56, 0x55, 0x00) for FT_LCD_FILTER_LIGHT, and (0x10,
- * 0x40, 0x70, 0x40, 0x10) for FT_LCD_FILTER_DEFAULT and
- * FT_LCD_FILTER_LEGACY.
- *
- * @input:
- * library ::
- * A handle to the target library instance.
- *
- * weights ::
- * A pointer to an array; the function copies the first five bytes and
- * uses them to specify the filter weights.
- *
- * @return:
- * FreeType error code. 0~means success.
- *
- * @note:
- * Due to *PATENTS* covering subpixel rendering, this function doesn't
- * do anything except returning `FT_Err_Unimplemented_Feature' if the
- * configuration macro FT_CONFIG_OPTION_SUBPIXEL_RENDERING is not
- * defined in your build of the library, which should correspond to all
- * default builds of FreeType.
- *
- * This function must be called after @FT_Library_SetLcdFilter to have
- * any effect.
- *
- * @since:
- * 2.4.0
- */
- FT_EXPORT( FT_Error )
- FT_Library_SetLcdFilterWeights( FT_Library library,
- unsigned char *weights );
-
- /* */
-
-
-FT_END_HEADER
-
-#endif /* __FT_LCD_FILTER_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftlist.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftlist.h
deleted file mode 100644
index 12b48c78f70..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftlist.h
+++ /dev/null
@@ -1,276 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftlist.h */
-/* */
-/* Generic list support for FreeType (specification). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* This file implements functions relative to list processing. Its */
- /* data structures are defined in `freetype.h'. */
- /* */
- /*************************************************************************/
-
-
-#ifndef __FTLIST_H__
-#define __FTLIST_H__
-
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-
-#ifdef FREETYPE_H
-#error "freetype.h of FreeType 1 has been loaded!"
-#error "Please fix the directory search order for header files"
-#error "so that freetype.h of FreeType 2 is found first."
-#endif
-
-
-FT_BEGIN_HEADER
-
-
- /*************************************************************************/
- /* */
- /* <Section> */
- /* list_processing */
- /* */
- /* <Title> */
- /* List Processing */
- /* */
- /* <Abstract> */
- /* Simple management of lists. */
- /* */
- /* <Description> */
- /* This section contains various definitions related to list */
- /* processing using doubly-linked nodes. */
- /* */
- /* <Order> */
- /* FT_List */
- /* FT_ListNode */
- /* FT_ListRec */
- /* FT_ListNodeRec */
- /* */
- /* FT_List_Add */
- /* FT_List_Insert */
- /* FT_List_Find */
- /* FT_List_Remove */
- /* FT_List_Up */
- /* FT_List_Iterate */
- /* FT_List_Iterator */
- /* FT_List_Finalize */
- /* FT_List_Destructor */
- /* */
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_List_Find */
- /* */
- /* <Description> */
- /* Find the list node for a given listed object. */
- /* */
- /* <Input> */
- /* list :: A pointer to the parent list. */
- /* data :: The address of the listed object. */
- /* */
- /* <Return> */
- /* List node. NULL if it wasn't found. */
- /* */
- FT_EXPORT( FT_ListNode )
- FT_List_Find( FT_List list,
- void* data );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_List_Add */
- /* */
- /* <Description> */
- /* Append an element to the end of a list. */
- /* */
- /* <InOut> */
- /* list :: A pointer to the parent list. */
- /* node :: The node to append. */
- /* */
- FT_EXPORT( void )
- FT_List_Add( FT_List list,
- FT_ListNode node );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_List_Insert */
- /* */
- /* <Description> */
- /* Insert an element at the head of a list. */
- /* */
- /* <InOut> */
- /* list :: A pointer to parent list. */
- /* node :: The node to insert. */
- /* */
- FT_EXPORT( void )
- FT_List_Insert( FT_List list,
- FT_ListNode node );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_List_Remove */
- /* */
- /* <Description> */
- /* Remove a node from a list. This function doesn't check whether */
- /* the node is in the list! */
- /* */
- /* <Input> */
- /* node :: The node to remove. */
- /* */
- /* <InOut> */
- /* list :: A pointer to the parent list. */
- /* */
- FT_EXPORT( void )
- FT_List_Remove( FT_List list,
- FT_ListNode node );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_List_Up */
- /* */
- /* <Description> */
- /* Move a node to the head/top of a list. Used to maintain LRU */
- /* lists. */
- /* */
- /* <InOut> */
- /* list :: A pointer to the parent list. */
- /* node :: The node to move. */
- /* */
- FT_EXPORT( void )
- FT_List_Up( FT_List list,
- FT_ListNode node );
-
-
- /*************************************************************************/
- /* */
- /* <FuncType> */
- /* FT_List_Iterator */
- /* */
- /* <Description> */
- /* An FT_List iterator function that is called during a list parse */
- /* by @FT_List_Iterate. */
- /* */
- /* <Input> */
- /* node :: The current iteration list node. */
- /* */
- /* user :: A typeless pointer passed to @FT_List_Iterate. */
- /* Can be used to point to the iteration's state. */
- /* */
- typedef FT_Error
- (*FT_List_Iterator)( FT_ListNode node,
- void* user );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_List_Iterate */
- /* */
- /* <Description> */
- /* Parse a list and calls a given iterator function on each element. */
- /* Note that parsing is stopped as soon as one of the iterator calls */
- /* returns a non-zero value. */
- /* */
- /* <Input> */
- /* list :: A handle to the list. */
- /* iterator :: An iterator function, called on each node of the list. */
- /* user :: A user-supplied field that is passed as the second */
- /* argument to the iterator. */
- /* */
- /* <Return> */
- /* The result (a FreeType error code) of the last iterator call. */
- /* */
- FT_EXPORT( FT_Error )
- FT_List_Iterate( FT_List list,
- FT_List_Iterator iterator,
- void* user );
-
-
- /*************************************************************************/
- /* */
- /* <FuncType> */
- /* FT_List_Destructor */
- /* */
- /* <Description> */
- /* An @FT_List iterator function that is called during a list */
- /* finalization by @FT_List_Finalize to destroy all elements in a */
- /* given list. */
- /* */
- /* <Input> */
- /* system :: The current system object. */
- /* */
- /* data :: The current object to destroy. */
- /* */
- /* user :: A typeless pointer passed to @FT_List_Iterate. It can */
- /* be used to point to the iteration's state. */
- /* */
- typedef void
- (*FT_List_Destructor)( FT_Memory memory,
- void* data,
- void* user );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_List_Finalize */
- /* */
- /* <Description> */
- /* Destroy all elements in the list as well as the list itself. */
- /* */
- /* <Input> */
- /* list :: A handle to the list. */
- /* */
- /* destroy :: A list destructor that will be applied to each element */
- /* of the list. Set this to NULL if not needed. */
- /* */
- /* memory :: The current memory object that handles deallocation. */
- /* */
- /* user :: A user-supplied field that is passed as the last */
- /* argument to the destructor. */
- /* */
- /* <Note> */
- /* This function expects that all nodes added by @FT_List_Add or */
- /* @FT_List_Insert have been dynamically allocated. */
- /* */
- FT_EXPORT( void )
- FT_List_Finalize( FT_List list,
- FT_List_Destructor destroy,
- FT_Memory memory,
- void* user );
-
- /* */
-
-
-FT_END_HEADER
-
-#endif /* __FTLIST_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftlzw.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftlzw.h
deleted file mode 100644
index d3ec28e554f..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftlzw.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftlzw.h */
-/* */
-/* LZW-compressed stream support. */
-/* */
-/* Copyright 2004-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __FTLZW_H__
-#define __FTLZW_H__
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-
-#ifdef FREETYPE_H
-#error "freetype.h of FreeType 1 has been loaded!"
-#error "Please fix the directory search order for header files"
-#error "so that freetype.h of FreeType 2 is found first."
-#endif
-
-
-FT_BEGIN_HEADER
-
- /*************************************************************************/
- /* */
- /* <Section> */
- /* lzw */
- /* */
- /* <Title> */
- /* LZW Streams */
- /* */
- /* <Abstract> */
- /* Using LZW-compressed font files. */
- /* */
- /* <Description> */
- /* This section contains the declaration of LZW-specific functions. */
- /* */
- /*************************************************************************/
-
- /************************************************************************
- *
- * @function:
- * FT_Stream_OpenLZW
- *
- * @description:
- * Open a new stream to parse LZW-compressed font files. This is
- * mainly used to support the compressed `*.pcf.Z' fonts that come
- * with XFree86.
- *
- * @input:
- * stream :: The target embedding stream.
- *
- * source :: The source stream.
- *
- * @return:
- * FreeType error code. 0~means success.
- *
- * @note:
- * The source stream must be opened _before_ calling this function.
- *
- * Calling the internal function `FT_Stream_Close' on the new stream will
- * *not* call `FT_Stream_Close' on the source stream. None of the stream
- * objects will be released to the heap.
- *
- * The stream implementation is very basic and resets the decompression
- * process each time seeking backwards is needed within the stream
- *
- * In certain builds of the library, LZW compression recognition is
- * automatically handled when calling @FT_New_Face or @FT_Open_Face.
- * This means that if no font driver is capable of handling the raw
- * compressed file, the library will try to open a LZW stream from it
- * and re-open the face with it.
- *
- * This function may return `FT_Err_Unimplemented_Feature' if your build
- * of FreeType was not compiled with LZW support.
- */
- FT_EXPORT( FT_Error )
- FT_Stream_OpenLZW( FT_Stream stream,
- FT_Stream source );
-
- /* */
-
-
-FT_END_HEADER
-
-#endif /* __FTLZW_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftmac.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftmac.h
deleted file mode 100644
index 14c55cfe2b7..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftmac.h
+++ /dev/null
@@ -1,274 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftmac.h */
-/* */
-/* Additional Mac-specific API. */
-/* */
-/* Copyright 1996-2015 by */
-/* Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-/***************************************************************************/
-/* */
-/* NOTE: Include this file after FT_FREETYPE_H and after any */
-/* Mac-specific headers (because this header uses Mac types such as */
-/* Handle, FSSpec, FSRef, etc.) */
-/* */
-/***************************************************************************/
-
-
-#ifndef __FTMAC_H__
-#define __FTMAC_H__
-
-
-#include <ft2build.h>
-
-
-FT_BEGIN_HEADER
-
-
-/* gcc-3.4.1 and later can warn about functions tagged as deprecated */
-#ifndef FT_DEPRECATED_ATTRIBUTE
-#if defined(__GNUC__) && \
- ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1)))
-#define FT_DEPRECATED_ATTRIBUTE __attribute__((deprecated))
-#else
-#define FT_DEPRECATED_ATTRIBUTE
-#endif
-#endif
-
-
- /*************************************************************************/
- /* */
- /* <Section> */
- /* mac_specific */
- /* */
- /* <Title> */
- /* Mac Specific Interface */
- /* */
- /* <Abstract> */
- /* Only available on the Macintosh. */
- /* */
- /* <Description> */
- /* The following definitions are only available if FreeType is */
- /* compiled on a Macintosh. */
- /* */
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_New_Face_From_FOND */
- /* */
- /* <Description> */
- /* Create a new face object from a FOND resource. */
- /* */
- /* <InOut> */
- /* library :: A handle to the library resource. */
- /* */
- /* <Input> */
- /* fond :: A FOND resource. */
- /* */
- /* face_index :: Only supported for the -1 `sanity check' special */
- /* case. */
- /* */
- /* <Output> */
- /* aface :: A handle to a new face object. */
- /* */
- /* <Return> */
- /* FreeType error code. 0~means success. */
- /* */
- /* <Notes> */
- /* This function can be used to create @FT_Face objects from fonts */
- /* that are installed in the system as follows. */
- /* */
- /* { */
- /* fond = GetResource( 'FOND', fontName ); */
- /* error = FT_New_Face_From_FOND( library, fond, 0, &face ); */
- /* } */
- /* */
- FT_EXPORT( FT_Error )
- FT_New_Face_From_FOND( FT_Library library,
- Handle fond,
- FT_Long face_index,
- FT_Face *aface )
- FT_DEPRECATED_ATTRIBUTE;
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_GetFile_From_Mac_Name */
- /* */
- /* <Description> */
- /* Return an FSSpec for the disk file containing the named font. */
- /* */
- /* <Input> */
- /* fontName :: Mac OS name of the font (e.g., Times New Roman */
- /* Bold). */
- /* */
- /* <Output> */
- /* pathSpec :: FSSpec to the file. For passing to */
- /* @FT_New_Face_From_FSSpec. */
- /* */
- /* face_index :: Index of the face. For passing to */
- /* @FT_New_Face_From_FSSpec. */
- /* */
- /* <Return> */
- /* FreeType error code. 0~means success. */
- /* */
- FT_EXPORT( FT_Error )
- FT_GetFile_From_Mac_Name( const char* fontName,
- FSSpec* pathSpec,
- FT_Long* face_index )
- FT_DEPRECATED_ATTRIBUTE;
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_GetFile_From_Mac_ATS_Name */
- /* */
- /* <Description> */
- /* Return an FSSpec for the disk file containing the named font. */
- /* */
- /* <Input> */
- /* fontName :: Mac OS name of the font in ATS framework. */
- /* */
- /* <Output> */
- /* pathSpec :: FSSpec to the file. For passing to */
- /* @FT_New_Face_From_FSSpec. */
- /* */
- /* face_index :: Index of the face. For passing to */
- /* @FT_New_Face_From_FSSpec. */
- /* */
- /* <Return> */
- /* FreeType error code. 0~means success. */
- /* */
- FT_EXPORT( FT_Error )
- FT_GetFile_From_Mac_ATS_Name( const char* fontName,
- FSSpec* pathSpec,
- FT_Long* face_index )
- FT_DEPRECATED_ATTRIBUTE;
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_GetFilePath_From_Mac_ATS_Name */
- /* */
- /* <Description> */
- /* Return a pathname of the disk file and face index for given font */
- /* name that is handled by ATS framework. */
- /* */
- /* <Input> */
- /* fontName :: Mac OS name of the font in ATS framework. */
- /* */
- /* <Output> */
- /* path :: Buffer to store pathname of the file. For passing */
- /* to @FT_New_Face. The client must allocate this */
- /* buffer before calling this function. */
- /* */
- /* maxPathSize :: Lengths of the buffer `path' that client allocated. */
- /* */
- /* face_index :: Index of the face. For passing to @FT_New_Face. */
- /* */
- /* <Return> */
- /* FreeType error code. 0~means success. */
- /* */
- FT_EXPORT( FT_Error )
- FT_GetFilePath_From_Mac_ATS_Name( const char* fontName,
- UInt8* path,
- UInt32 maxPathSize,
- FT_Long* face_index )
- FT_DEPRECATED_ATTRIBUTE;
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_New_Face_From_FSSpec */
- /* */
- /* <Description> */
- /* Create a new face object from a given resource and typeface index */
- /* using an FSSpec to the font file. */
- /* */
- /* <InOut> */
- /* library :: A handle to the library resource. */
- /* */
- /* <Input> */
- /* spec :: FSSpec to the font file. */
- /* */
- /* face_index :: The index of the face within the resource. The */
- /* first face has index~0. */
- /* <Output> */
- /* aface :: A handle to a new face object. */
- /* */
- /* <Return> */
- /* FreeType error code. 0~means success. */
- /* */
- /* <Note> */
- /* @FT_New_Face_From_FSSpec is identical to @FT_New_Face except */
- /* it accepts an FSSpec instead of a path. */
- /* */
- FT_EXPORT( FT_Error )
- FT_New_Face_From_FSSpec( FT_Library library,
- const FSSpec *spec,
- FT_Long face_index,
- FT_Face *aface )
- FT_DEPRECATED_ATTRIBUTE;
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_New_Face_From_FSRef */
- /* */
- /* <Description> */
- /* Create a new face object from a given resource and typeface index */
- /* using an FSRef to the font file. */
- /* */
- /* <InOut> */
- /* library :: A handle to the library resource. */
- /* */
- /* <Input> */
- /* spec :: FSRef to the font file. */
- /* */
- /* face_index :: The index of the face within the resource. The */
- /* first face has index~0. */
- /* <Output> */
- /* aface :: A handle to a new face object. */
- /* */
- /* <Return> */
- /* FreeType error code. 0~means success. */
- /* */
- /* <Note> */
- /* @FT_New_Face_From_FSRef is identical to @FT_New_Face except */
- /* it accepts an FSRef instead of a path. */
- /* */
- FT_EXPORT( FT_Error )
- FT_New_Face_From_FSRef( FT_Library library,
- const FSRef *ref,
- FT_Long face_index,
- FT_Face *aface )
- FT_DEPRECATED_ATTRIBUTE;
-
- /* */
-
-
-FT_END_HEADER
-
-
-#endif /* __FTMAC_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftmm.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftmm.h
deleted file mode 100644
index 6ef47987e6d..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftmm.h
+++ /dev/null
@@ -1,379 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftmm.h */
-/* */
-/* FreeType Multiple Master font interface (specification). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __FTMM_H__
-#define __FTMM_H__
-
-
-#include <ft2build.h>
-#include FT_TYPE1_TABLES_H
-
-
-FT_BEGIN_HEADER
-
-
- /*************************************************************************/
- /* */
- /* <Section> */
- /* multiple_masters */
- /* */
- /* <Title> */
- /* Multiple Masters */
- /* */
- /* <Abstract> */
- /* How to manage Multiple Masters fonts. */
- /* */
- /* <Description> */
- /* The following types and functions are used to manage Multiple */
- /* Master fonts, i.e., the selection of specific design instances by */
- /* setting design axis coordinates. */
- /* */
- /* George Williams has extended this interface to make it work with */
- /* both Type~1 Multiple Masters fonts and GX distortable (var) */
- /* fonts. Some of these routines only work with MM fonts, others */
- /* will work with both types. They are similar enough that a */
- /* consistent interface makes sense. */
- /* */
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* FT_MM_Axis */
- /* */
- /* <Description> */
- /* A simple structure used to model a given axis in design space for */
- /* Multiple Masters fonts. */
- /* */
- /* This structure can't be used for GX var fonts. */
- /* */
- /* <Fields> */
- /* name :: The axis's name. */
- /* */
- /* minimum :: The axis's minimum design coordinate. */
- /* */
- /* maximum :: The axis's maximum design coordinate. */
- /* */
- typedef struct FT_MM_Axis_
- {
- FT_String* name;
- FT_Long minimum;
- FT_Long maximum;
-
- } FT_MM_Axis;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* FT_Multi_Master */
- /* */
- /* <Description> */
- /* A structure used to model the axes and space of a Multiple Masters */
- /* font. */
- /* */
- /* This structure can't be used for GX var fonts. */
- /* */
- /* <Fields> */
- /* num_axis :: Number of axes. Cannot exceed~4. */
- /* */
- /* num_designs :: Number of designs; should be normally 2^num_axis */
- /* even though the Type~1 specification strangely */
- /* allows for intermediate designs to be present. */
- /* This number cannot exceed~16. */
- /* */
- /* axis :: A table of axis descriptors. */
- /* */
- typedef struct FT_Multi_Master_
- {
- FT_UInt num_axis;
- FT_UInt num_designs;
- FT_MM_Axis axis[T1_MAX_MM_AXIS];
-
- } FT_Multi_Master;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* FT_Var_Axis */
- /* */
- /* <Description> */
- /* A simple structure used to model a given axis in design space for */
- /* Multiple Masters and GX var fonts. */
- /* */
- /* <Fields> */
- /* name :: The axis's name. */
- /* Not always meaningful for GX. */
- /* */
- /* minimum :: The axis's minimum design coordinate. */
- /* */
- /* def :: The axis's default design coordinate. */
- /* FreeType computes meaningful default values for MM; it */
- /* is then an integer value, not in 16.16 format. */
- /* */
- /* maximum :: The axis's maximum design coordinate. */
- /* */
- /* tag :: The axis's tag (the GX equivalent to `name'). */
- /* FreeType provides default values for MM if possible. */
- /* */
- /* strid :: The entry in `name' table (another GX version of */
- /* `name'). */
- /* Not meaningful for MM. */
- /* */
- typedef struct FT_Var_Axis_
- {
- FT_String* name;
-
- FT_Fixed minimum;
- FT_Fixed def;
- FT_Fixed maximum;
-
- FT_ULong tag;
- FT_UInt strid;
-
- } FT_Var_Axis;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* FT_Var_Named_Style */
- /* */
- /* <Description> */
- /* A simple structure used to model a named style in a GX var font. */
- /* */
- /* This structure can't be used for MM fonts. */
- /* */
- /* <Fields> */
- /* coords :: The design coordinates for this style. */
- /* This is an array with one entry for each axis. */
- /* */
- /* strid :: The entry in `name' table identifying this style. */
- /* */
- typedef struct FT_Var_Named_Style_
- {
- FT_Fixed* coords;
- FT_UInt strid;
-
- } FT_Var_Named_Style;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* FT_MM_Var */
- /* */
- /* <Description> */
- /* A structure used to model the axes and space of a Multiple Masters */
- /* or GX var distortable font. */
- /* */
- /* Some fields are specific to one format and not to the other. */
- /* */
- /* <Fields> */
- /* num_axis :: The number of axes. The maximum value is~4 for */
- /* MM; no limit in GX. */
- /* */
- /* num_designs :: The number of designs; should be normally */
- /* 2^num_axis for MM fonts. Not meaningful for GX */
- /* (where every glyph could have a different */
- /* number of designs). */
- /* */
- /* num_namedstyles :: The number of named styles; only meaningful for */
- /* GX that allows certain design coordinates to */
- /* have a string ID (in the `name' table) */
- /* associated with them. The font can tell the */
- /* user that, for example, Weight=1.5 is `Bold'. */
- /* */
- /* axis :: An axis descriptor table. */
- /* GX fonts contain slightly more data than MM. */
- /* */
- /* namedstyle :: A named style table. */
- /* Only meaningful with GX. */
- /* */
- typedef struct FT_MM_Var_
- {
- FT_UInt num_axis;
- FT_UInt num_designs;
- FT_UInt num_namedstyles;
- FT_Var_Axis* axis;
- FT_Var_Named_Style* namedstyle;
-
- } FT_MM_Var;
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Get_Multi_Master */
- /* */
- /* <Description> */
- /* Retrieve the Multiple Master descriptor of a given font. */
- /* */
- /* This function can't be used with GX fonts. */
- /* */
- /* <Input> */
- /* face :: A handle to the source face. */
- /* */
- /* <Output> */
- /* amaster :: The Multiple Masters descriptor. */
- /* */
- /* <Return> */
- /* FreeType error code. 0~means success. */
- /* */
- FT_EXPORT( FT_Error )
- FT_Get_Multi_Master( FT_Face face,
- FT_Multi_Master *amaster );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Get_MM_Var */
- /* */
- /* <Description> */
- /* Retrieve the Multiple Master/GX var descriptor of a given font. */
- /* */
- /* <Input> */
- /* face :: A handle to the source face. */
- /* */
- /* <Output> */
- /* amaster :: The Multiple Masters/GX var descriptor. */
- /* Allocates a data structure, which the user must free. */
- /* */
- /* <Return> */
- /* FreeType error code. 0~means success. */
- /* */
- FT_EXPORT( FT_Error )
- FT_Get_MM_Var( FT_Face face,
- FT_MM_Var* *amaster );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Set_MM_Design_Coordinates */
- /* */
- /* <Description> */
- /* For Multiple Masters fonts, choose an interpolated font design */
- /* through design coordinates. */
- /* */
- /* This function can't be used with GX fonts. */
- /* */
- /* <InOut> */
- /* face :: A handle to the source face. */
- /* */
- /* <Input> */
- /* num_coords :: The number of available design coordinates. If it */
- /* is larger than the number of axes, ignore the excess */
- /* values. If it is smaller than the number of axes, */
- /* use default values for the remaining axes. */
- /* */
- /* coords :: An array of design coordinates. */
- /* */
- /* <Return> */
- /* FreeType error code. 0~means success. */
- /* */
- FT_EXPORT( FT_Error )
- FT_Set_MM_Design_Coordinates( FT_Face face,
- FT_UInt num_coords,
- FT_Long* coords );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Set_Var_Design_Coordinates */
- /* */
- /* <Description> */
- /* For Multiple Master or GX Var fonts, choose an interpolated font */
- /* design through design coordinates. */
- /* */
- /* <InOut> */
- /* face :: A handle to the source face. */
- /* */
- /* <Input> */
- /* num_coords :: The number of available design coordinates. If it */
- /* is larger than the number of axes, ignore the excess */
- /* values. If it is smaller than the number of axes, */
- /* use default values for the remaining axes. */
- /* */
- /* coords :: An array of design coordinates. */
- /* */
- /* <Return> */
- /* FreeType error code. 0~means success. */
- /* */
- FT_EXPORT( FT_Error )
- FT_Set_Var_Design_Coordinates( FT_Face face,
- FT_UInt num_coords,
- FT_Fixed* coords );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Set_MM_Blend_Coordinates */
- /* */
- /* <Description> */
- /* For Multiple Masters and GX var fonts, choose an interpolated font */
- /* design through normalized blend coordinates. */
- /* */
- /* <InOut> */
- /* face :: A handle to the source face. */
- /* */
- /* <Input> */
- /* num_coords :: The number of available design coordinates. If it */
- /* is larger than the number of axes, ignore the excess */
- /* values. If it is smaller than the number of axes, */
- /* use default values for the remaining axes. */
- /* */
- /* coords :: The design coordinates array (each element must be */
- /* between 0 and 1.0). */
- /* */
- /* <Return> */
- /* FreeType error code. 0~means success. */
- /* */
- FT_EXPORT( FT_Error )
- FT_Set_MM_Blend_Coordinates( FT_Face face,
- FT_UInt num_coords,
- FT_Fixed* coords );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Set_Var_Blend_Coordinates */
- /* */
- /* <Description> */
- /* This is another name of @FT_Set_MM_Blend_Coordinates. */
- /* */
- FT_EXPORT( FT_Error )
- FT_Set_Var_Blend_Coordinates( FT_Face face,
- FT_UInt num_coords,
- FT_Fixed* coords );
-
- /* */
-
-
-FT_END_HEADER
-
-#endif /* __FTMM_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftmodapi.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftmodapi.h
deleted file mode 100644
index 544279a68af..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftmodapi.h
+++ /dev/null
@@ -1,669 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftmodapi.h */
-/* */
-/* FreeType modules public interface (specification). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __FTMODAPI_H__
-#define __FTMODAPI_H__
-
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-
-#ifdef FREETYPE_H
-#error "freetype.h of FreeType 1 has been loaded!"
-#error "Please fix the directory search order for header files"
-#error "so that freetype.h of FreeType 2 is found first."
-#endif
-
-
-FT_BEGIN_HEADER
-
-
- /*************************************************************************/
- /* */
- /* <Section> */
- /* module_management */
- /* */
- /* <Title> */
- /* Module Management */
- /* */
- /* <Abstract> */
- /* How to add, upgrade, remove, and control modules from FreeType. */
- /* */
- /* <Description> */
- /* The definitions below are used to manage modules within FreeType. */
- /* Modules can be added, upgraded, and removed at runtime. */
- /* Additionally, some module properties can be controlled also. */
- /* */
- /* Here is a list of possible values of the `module_name' field in */
- /* the @FT_Module_Class structure. */
- /* */
- /* { */
- /* autofitter */
- /* bdf */
- /* cff */
- /* gxvalid */
- /* otvalid */
- /* pcf */
- /* pfr */
- /* psaux */
- /* pshinter */
- /* psnames */
- /* raster1 */
- /* sfnt */
- /* smooth, smooth-lcd, smooth-lcdv */
- /* truetype */
- /* type1 */
- /* type42 */
- /* t1cid */
- /* winfonts */
- /* } */
- /* */
- /* Note that the FreeType Cache sub-system is not a FreeType module. */
- /* */
- /* <Order> */
- /* FT_Module */
- /* FT_Module_Constructor */
- /* FT_Module_Destructor */
- /* FT_Module_Requester */
- /* FT_Module_Class */
- /* */
- /* FT_Add_Module */
- /* FT_Get_Module */
- /* FT_Remove_Module */
- /* FT_Add_Default_Modules */
- /* */
- /* FT_Property_Set */
- /* FT_Property_Get */
- /* */
- /* FT_New_Library */
- /* FT_Done_Library */
- /* FT_Reference_Library */
- /* */
- /* FT_Renderer */
- /* FT_Renderer_Class */
- /* */
- /* FT_Get_Renderer */
- /* FT_Set_Renderer */
- /* */
- /* FT_Set_Debug_Hook */
- /* */
- /*************************************************************************/
-
-
- /* module bit flags */
-#define FT_MODULE_FONT_DRIVER 1 /* this module is a font driver */
-#define FT_MODULE_RENDERER 2 /* this module is a renderer */
-#define FT_MODULE_HINTER 4 /* this module is a glyph hinter */
-#define FT_MODULE_STYLER 8 /* this module is a styler */
-
-#define FT_MODULE_DRIVER_SCALABLE 0x100 /* the driver supports */
- /* scalable fonts */
-#define FT_MODULE_DRIVER_NO_OUTLINES 0x200 /* the driver does not */
- /* support vector outlines */
-#define FT_MODULE_DRIVER_HAS_HINTER 0x400 /* the driver provides its */
- /* own hinter */
-
-
- /* deprecated values */
-#define ft_module_font_driver FT_MODULE_FONT_DRIVER
-#define ft_module_renderer FT_MODULE_RENDERER
-#define ft_module_hinter FT_MODULE_HINTER
-#define ft_module_styler FT_MODULE_STYLER
-
-#define ft_module_driver_scalable FT_MODULE_DRIVER_SCALABLE
-#define ft_module_driver_no_outlines FT_MODULE_DRIVER_NO_OUTLINES
-#define ft_module_driver_has_hinter FT_MODULE_DRIVER_HAS_HINTER
-
-
- typedef FT_Pointer FT_Module_Interface;
-
-
- /*************************************************************************/
- /* */
- /* <FuncType> */
- /* FT_Module_Constructor */
- /* */
- /* <Description> */
- /* A function used to initialize (not create) a new module object. */
- /* */
- /* <Input> */
- /* module :: The module to initialize. */
- /* */
- typedef FT_Error
- (*FT_Module_Constructor)( FT_Module module );
-
-
- /*************************************************************************/
- /* */
- /* <FuncType> */
- /* FT_Module_Destructor */
- /* */
- /* <Description> */
- /* A function used to finalize (not destroy) a given module object. */
- /* */
- /* <Input> */
- /* module :: The module to finalize. */
- /* */
- typedef void
- (*FT_Module_Destructor)( FT_Module module );
-
-
- /*************************************************************************/
- /* */
- /* <FuncType> */
- /* FT_Module_Requester */
- /* */
- /* <Description> */
- /* A function used to query a given module for a specific interface. */
- /* */
- /* <Input> */
- /* module :: The module to be searched. */
- /* */
- /* name :: The name of the interface in the module. */
- /* */
- typedef FT_Module_Interface
- (*FT_Module_Requester)( FT_Module module,
- const char* name );
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* FT_Module_Class */
- /* */
- /* <Description> */
- /* The module class descriptor. */
- /* */
- /* <Fields> */
- /* module_flags :: Bit flags describing the module. */
- /* */
- /* module_size :: The size of one module object/instance in */
- /* bytes. */
- /* */
- /* module_name :: The name of the module. */
- /* */
- /* module_version :: The version, as a 16.16 fixed number */
- /* (major.minor). */
- /* */
- /* module_requires :: The version of FreeType this module requires, */
- /* as a 16.16 fixed number (major.minor). Starts */
- /* at version 2.0, i.e., 0x20000. */
- /* */
- /* module_init :: The initializing function. */
- /* */
- /* module_done :: The finalizing function. */
- /* */
- /* get_interface :: The interface requesting function. */
- /* */
- typedef struct FT_Module_Class_
- {
- FT_ULong module_flags;
- FT_Long module_size;
- const FT_String* module_name;
- FT_Fixed module_version;
- FT_Fixed module_requires;
-
- const void* module_interface;
-
- FT_Module_Constructor module_init;
- FT_Module_Destructor module_done;
- FT_Module_Requester get_interface;
-
- } FT_Module_Class;
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Add_Module */
- /* */
- /* <Description> */
- /* Add a new module to a given library instance. */
- /* */
- /* <InOut> */
- /* library :: A handle to the library object. */
- /* */
- /* <Input> */
- /* clazz :: A pointer to class descriptor for the module. */
- /* */
- /* <Return> */
- /* FreeType error code. 0~means success. */
- /* */
- /* <Note> */
- /* An error will be returned if a module already exists by that name, */
- /* or if the module requires a version of FreeType that is too great. */
- /* */
- FT_EXPORT( FT_Error )
- FT_Add_Module( FT_Library library,
- const FT_Module_Class* clazz );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Get_Module */
- /* */
- /* <Description> */
- /* Find a module by its name. */
- /* */
- /* <Input> */
- /* library :: A handle to the library object. */
- /* */
- /* module_name :: The module's name (as an ASCII string). */
- /* */
- /* <Return> */
- /* A module handle. 0~if none was found. */
- /* */
- /* <Note> */
- /* FreeType's internal modules aren't documented very well, and you */
- /* should look up the source code for details. */
- /* */
- FT_EXPORT( FT_Module )
- FT_Get_Module( FT_Library library,
- const char* module_name );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Remove_Module */
- /* */
- /* <Description> */
- /* Remove a given module from a library instance. */
- /* */
- /* <InOut> */
- /* library :: A handle to a library object. */
- /* */
- /* <Input> */
- /* module :: A handle to a module object. */
- /* */
- /* <Return> */
- /* FreeType error code. 0~means success. */
- /* */
- /* <Note> */
- /* The module object is destroyed by the function in case of success. */
- /* */
- FT_EXPORT( FT_Error )
- FT_Remove_Module( FT_Library library,
- FT_Module module );
-
-
- /**********************************************************************
- *
- * @function:
- * FT_Property_Set
- *
- * @description:
- * Set a property for a given module.
- *
- * @input:
- * library ::
- * A handle to the library the module is part of.
- *
- * module_name ::
- * The module name.
- *
- * property_name ::
- * The property name. Properties are described in the `Synopsis'
- * subsection of the module's documentation.
- *
- * Note that only a few modules have properties.
- *
- * value ::
- * A generic pointer to a variable or structure that gives the new
- * value of the property. The exact definition of `value' is
- * dependent on the property; see the `Synopsis' subsection of the
- * module's documentation.
- *
- * @return:
- * FreeType error code. 0~means success.
- *
- * @note:
- * If `module_name' isn't a valid module name, or `property_name'
- * doesn't specify a valid property, or if `value' doesn't represent a
- * valid value for the given property, an error is returned.
- *
- * The following example sets property `bar' (a simple integer) in
- * module `foo' to value~1.
- *
- * {
- * FT_UInt bar;
- *
- *
- * bar = 1;
- * FT_Property_Set( library, "foo", "bar", &bar );
- * }
- *
- * Note that the FreeType Cache sub-system doesn't recognize module
- * property changes. To avoid glyph lookup confusion within the cache
- * you should call @FTC_Manager_Reset to completely flush the cache if
- * a module property gets changed after @FTC_Manager_New has been
- * called.
- *
- * It is not possible to set properties of the FreeType Cache
- * sub-system itself with FT_Property_Set; use @FTC_Property_Set
- * instead.
- *
- * @since:
- * 2.4.11
- *
- */
- FT_EXPORT( FT_Error )
- FT_Property_Set( FT_Library library,
- const FT_String* module_name,
- const FT_String* property_name,
- const void* value );
-
-
- /**********************************************************************
- *
- * @function:
- * FT_Property_Get
- *
- * @description:
- * Get a module's property value.
- *
- * @input:
- * library ::
- * A handle to the library the module is part of.
- *
- * module_name ::
- * The module name.
- *
- * property_name ::
- * The property name. Properties are described in the `Synopsis'
- * subsection of the module's documentation.
- *
- * @inout:
- * value ::
- * A generic pointer to a variable or structure that gives the
- * value of the property. The exact definition of `value' is
- * dependent on the property; see the `Synopsis' subsection of the
- * module's documentation.
- *
- * @return:
- * FreeType error code. 0~means success.
- *
- * @note:
- * If `module_name' isn't a valid module name, or `property_name'
- * doesn't specify a valid property, or if `value' doesn't represent a
- * valid value for the given property, an error is returned.
- *
- * The following example gets property `baz' (a range) in module `foo'.
- *
- * {
- * typedef range_
- * {
- * FT_Int32 min;
- * FT_Int32 max;
- *
- * } range;
- *
- * range baz;
- *
- *
- * FT_Property_Get( library, "foo", "baz", &baz );
- * }
- *
- * It is not possible to retrieve properties of the FreeType Cache
- * sub-system with FT_Property_Get; use @FTC_Property_Get instead.
- *
- * @since:
- * 2.4.11
- *
- */
- FT_EXPORT( FT_Error )
- FT_Property_Get( FT_Library library,
- const FT_String* module_name,
- const FT_String* property_name,
- void* value );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Reference_Library */
- /* */
- /* <Description> */
- /* A counter gets initialized to~1 at the time an @FT_Library */
- /* structure is created. This function increments the counter. */
- /* @FT_Done_Library then only destroys a library if the counter is~1, */
- /* otherwise it simply decrements the counter. */
- /* */
- /* This function helps in managing life-cycles of structures that */
- /* reference @FT_Library objects. */
- /* */
- /* <Input> */
- /* library :: A handle to a target library object. */
- /* */
- /* <Return> */
- /* FreeType error code. 0~means success. */
- /* */
- /* <Since> */
- /* 2.4.2 */
- /* */
- FT_EXPORT( FT_Error )
- FT_Reference_Library( FT_Library library );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_New_Library */
- /* */
- /* <Description> */
- /* This function is used to create a new FreeType library instance */
- /* from a given memory object. It is thus possible to use libraries */
- /* with distinct memory allocators within the same program. Note, */
- /* however, that the used @FT_Memory structure is expected to remain */
- /* valid for the life of the @FT_Library object. */
- /* */
- /* Normally, you would call this function (followed by a call to */
- /* @FT_Add_Default_Modules or a series of calls to @FT_Add_Module) */
- /* instead of @FT_Init_FreeType to initialize the FreeType library. */
- /* */
- /* Don't use @FT_Done_FreeType but @FT_Done_Library to destroy a */
- /* library instance. */
- /* */
- /* <Input> */
- /* memory :: A handle to the original memory object. */
- /* */
- /* <Output> */
- /* alibrary :: A pointer to handle of a new library object. */
- /* */
- /* <Return> */
- /* FreeType error code. 0~means success. */
- /* */
- /* <Note> */
- /* See the discussion of reference counters in the description of */
- /* @FT_Reference_Library. */
- /* */
- FT_EXPORT( FT_Error )
- FT_New_Library( FT_Memory memory,
- FT_Library *alibrary );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Done_Library */
- /* */
- /* <Description> */
- /* Discard a given library object. This closes all drivers and */
- /* discards all resource objects. */
- /* */
- /* <Input> */
- /* library :: A handle to the target library. */
- /* */
- /* <Return> */
- /* FreeType error code. 0~means success. */
- /* */
- /* <Note> */
- /* See the discussion of reference counters in the description of */
- /* @FT_Reference_Library. */
- /* */
- FT_EXPORT( FT_Error )
- FT_Done_Library( FT_Library library );
-
- /* */
-
- typedef void
- (*FT_DebugHook_Func)( void* arg );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Set_Debug_Hook */
- /* */
- /* <Description> */
- /* Set a debug hook function for debugging the interpreter of a font */
- /* format. */
- /* */
- /* <InOut> */
- /* library :: A handle to the library object. */
- /* */
- /* <Input> */
- /* hook_index :: The index of the debug hook. You should use the */
- /* values defined in `ftobjs.h', e.g., */
- /* `FT_DEBUG_HOOK_TRUETYPE'. */
- /* */
- /* debug_hook :: The function used to debug the interpreter. */
- /* */
- /* <Note> */
- /* Currently, four debug hook slots are available, but only two (for */
- /* the TrueType and the Type~1 interpreter) are defined. */
- /* */
- /* Since the internal headers of FreeType are no longer installed, */
- /* the symbol `FT_DEBUG_HOOK_TRUETYPE' isn't available publicly. */
- /* This is a bug and will be fixed in a forthcoming release. */
- /* */
- FT_EXPORT( void )
- FT_Set_Debug_Hook( FT_Library library,
- FT_UInt hook_index,
- FT_DebugHook_Func debug_hook );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Add_Default_Modules */
- /* */
- /* <Description> */
- /* Add the set of default drivers to a given library object. */
- /* This is only useful when you create a library object with */
- /* @FT_New_Library (usually to plug a custom memory manager). */
- /* */
- /* <InOut> */
- /* library :: A handle to a new library object. */
- /* */
- FT_EXPORT( void )
- FT_Add_Default_Modules( FT_Library library );
-
-
-
- /**************************************************************************
- *
- * @section:
- * truetype_engine
- *
- * @title:
- * The TrueType Engine
- *
- * @abstract:
- * TrueType bytecode support.
- *
- * @description:
- * This section contains a function used to query the level of TrueType
- * bytecode support compiled in this version of the library.
- *
- */
-
-
- /**************************************************************************
- *
- * @enum:
- * FT_TrueTypeEngineType
- *
- * @description:
- * A list of values describing which kind of TrueType bytecode
- * engine is implemented in a given FT_Library instance. It is used
- * by the @FT_Get_TrueType_Engine_Type function.
- *
- * @values:
- * FT_TRUETYPE_ENGINE_TYPE_NONE ::
- * The library doesn't implement any kind of bytecode interpreter.
- *
- * FT_TRUETYPE_ENGINE_TYPE_UNPATENTED ::
- * The library implements a bytecode interpreter that doesn't
- * support the patented operations of the TrueType virtual machine.
- *
- * Its main use is to load certain Asian fonts that position and
- * scale glyph components with bytecode instructions. It produces
- * bad output for most other fonts.
- *
- * FT_TRUETYPE_ENGINE_TYPE_PATENTED ::
- * The library implements a bytecode interpreter that covers
- * the full instruction set of the TrueType virtual machine (this
- * was governed by patents until May 2010, hence the name).
- *
- * @since:
- * 2.2
- *
- */
- typedef enum FT_TrueTypeEngineType_
- {
- FT_TRUETYPE_ENGINE_TYPE_NONE = 0,
- FT_TRUETYPE_ENGINE_TYPE_UNPATENTED,
- FT_TRUETYPE_ENGINE_TYPE_PATENTED
-
- } FT_TrueTypeEngineType;
-
-
- /**************************************************************************
- *
- * @func:
- * FT_Get_TrueType_Engine_Type
- *
- * @description:
- * Return an @FT_TrueTypeEngineType value to indicate which level of
- * the TrueType virtual machine a given library instance supports.
- *
- * @input:
- * library ::
- * A library instance.
- *
- * @return:
- * A value indicating which level is supported.
- *
- * @since:
- * 2.2
- *
- */
- FT_EXPORT( FT_TrueTypeEngineType )
- FT_Get_TrueType_Engine_Type( FT_Library library );
-
- /* */
-
-
-FT_END_HEADER
-
-#endif /* __FTMODAPI_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftmoderr.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftmoderr.h
deleted file mode 100644
index 9d7f9814091..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftmoderr.h
+++ /dev/null
@@ -1,194 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftmoderr.h */
-/* */
-/* FreeType module error offsets (specification). */
-/* */
-/* Copyright 2001-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* This file is used to define the FreeType module error codes. */
- /* */
- /* If the macro FT_CONFIG_OPTION_USE_MODULE_ERRORS in `ftoption.h' is */
- /* set, the lower byte of an error value identifies the error code as */
- /* usual. In addition, the higher byte identifies the module. For */
- /* example, the error `FT_Err_Invalid_File_Format' has value 0x0003, the */
- /* error `TT_Err_Invalid_File_Format' has value 0x1303, the error */
- /* `T1_Err_Invalid_File_Format' has value 0x1403, etc. */
- /* */
- /* Note that `FT_Err_Ok', `TT_Err_Ok', etc. are always equal to zero, */
- /* including the high byte. */
- /* */
- /* If FT_CONFIG_OPTION_USE_MODULE_ERRORS isn't set, the higher byte of */
- /* an error value is set to zero. */
- /* */
- /* To hide the various `XXX_Err_' prefixes in the source code, FreeType */
- /* provides some macros in `fttypes.h'. */
- /* */
- /* FT_ERR( err ) */
- /* Add current error module prefix (as defined with the */
- /* `FT_ERR_PREFIX' macro) to `err'. For example, in the BDF module */
- /* the line */
- /* */
- /* error = FT_ERR( Invalid_Outline ); */
- /* */
- /* expands to */
- /* */
- /* error = BDF_Err_Invalid_Outline; */
- /* */
- /* For simplicity, you can always use `FT_Err_Ok' directly instead */
- /* of `FT_ERR( Ok )'. */
- /* */
- /* FT_ERR_EQ( errcode, err ) */
- /* FT_ERR_NEQ( errcode, err ) */
- /* Compare error code `errcode' with the error `err' for equality */
- /* and inequality, respectively. Example: */
- /* */
- /* if ( FT_ERR_EQ( error, Invalid_Outline ) ) */
- /* ... */
- /* */
- /* Using this macro you don't have to think about error prefixes. */
- /* Of course, if module errors are not active, the above example is */
- /* the same as */
- /* */
- /* if ( error == FT_Err_Invalid_Outline ) */
- /* ... */
- /* */
- /* FT_ERROR_BASE( errcode ) */
- /* FT_ERROR_MODULE( errcode ) */
- /* Get base error and module error code, respectively. */
- /* */
- /* */
- /* It can also be used to create a module error message table easily */
- /* with something like */
- /* */
- /* { */
- /* #undef __FTMODERR_H__ */
- /* #define FT_MODERRDEF( e, v, s ) { FT_Mod_Err_ ## e, s }, */
- /* #define FT_MODERR_START_LIST { */
- /* #define FT_MODERR_END_LIST { 0, 0 } }; */
- /* */
- /* const struct */
- /* { */
- /* int mod_err_offset; */
- /* const char* mod_err_msg */
- /* } ft_mod_errors[] = */
- /* */
- /* #include FT_MODULE_ERRORS_H */
- /* } */
- /* */
- /*************************************************************************/
-
-
-#ifndef __FTMODERR_H__
-#define __FTMODERR_H__
-
-
- /*******************************************************************/
- /*******************************************************************/
- /***** *****/
- /***** SETUP MACROS *****/
- /***** *****/
- /*******************************************************************/
- /*******************************************************************/
-
-
-#undef FT_NEED_EXTERN_C
-
-#ifndef FT_MODERRDEF
-
-#ifdef FT_CONFIG_OPTION_USE_MODULE_ERRORS
-#define FT_MODERRDEF( e, v, s ) FT_Mod_Err_ ## e = v,
-#else
-#define FT_MODERRDEF( e, v, s ) FT_Mod_Err_ ## e = 0,
-#endif
-
-#define FT_MODERR_START_LIST enum {
-#define FT_MODERR_END_LIST FT_Mod_Err_Max };
-
-#ifdef __cplusplus
-#define FT_NEED_EXTERN_C
- extern "C" {
-#endif
-
-#endif /* !FT_MODERRDEF */
-
-
- /*******************************************************************/
- /*******************************************************************/
- /***** *****/
- /***** LIST MODULE ERROR BASES *****/
- /***** *****/
- /*******************************************************************/
- /*******************************************************************/
-
-
-#ifdef FT_MODERR_START_LIST
- FT_MODERR_START_LIST
-#endif
-
-
- FT_MODERRDEF( Base, 0x000, "base module" )
- FT_MODERRDEF( Autofit, 0x100, "autofitter module" )
- FT_MODERRDEF( BDF, 0x200, "BDF module" )
- FT_MODERRDEF( Bzip2, 0x300, "Bzip2 module" )
- FT_MODERRDEF( Cache, 0x400, "cache module" )
- FT_MODERRDEF( CFF, 0x500, "CFF module" )
- FT_MODERRDEF( CID, 0x600, "CID module" )
- FT_MODERRDEF( Gzip, 0x700, "Gzip module" )
- FT_MODERRDEF( LZW, 0x800, "LZW module" )
- FT_MODERRDEF( OTvalid, 0x900, "OpenType validation module" )
- FT_MODERRDEF( PCF, 0xA00, "PCF module" )
- FT_MODERRDEF( PFR, 0xB00, "PFR module" )
- FT_MODERRDEF( PSaux, 0xC00, "PS auxiliary module" )
- FT_MODERRDEF( PShinter, 0xD00, "PS hinter module" )
- FT_MODERRDEF( PSnames, 0xE00, "PS names module" )
- FT_MODERRDEF( Raster, 0xF00, "raster module" )
- FT_MODERRDEF( SFNT, 0x1000, "SFNT module" )
- FT_MODERRDEF( Smooth, 0x1100, "smooth raster module" )
- FT_MODERRDEF( TrueType, 0x1200, "TrueType module" )
- FT_MODERRDEF( Type1, 0x1300, "Type 1 module" )
- FT_MODERRDEF( Type42, 0x1400, "Type 42 module" )
- FT_MODERRDEF( Winfonts, 0x1500, "Windows FON/FNT module" )
- FT_MODERRDEF( GXvalid, 0x1600, "GX validation module" )
-
-
-#ifdef FT_MODERR_END_LIST
- FT_MODERR_END_LIST
-#endif
-
-
- /*******************************************************************/
- /*******************************************************************/
- /***** *****/
- /***** CLEANUP *****/
- /***** *****/
- /*******************************************************************/
- /*******************************************************************/
-
-
-#ifdef FT_NEED_EXTERN_C
- }
-#endif
-
-#undef FT_MODERR_START_LIST
-#undef FT_MODERR_END_LIST
-#undef FT_MODERRDEF
-#undef FT_NEED_EXTERN_C
-
-
-#endif /* __FTMODERR_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftotval.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftotval.h
deleted file mode 100644
index e744b713fbe..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftotval.h
+++ /dev/null
@@ -1,204 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftotval.h */
-/* */
-/* FreeType API for validating OpenType tables (specification). */
-/* */
-/* Copyright 2004-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-/***************************************************************************/
-/* */
-/* */
-/* Warning: This module might be moved to a different library in the */
-/* future to avoid a tight dependency between FreeType and the */
-/* OpenType specification. */
-/* */
-/* */
-/***************************************************************************/
-
-
-#ifndef __FTOTVAL_H__
-#define __FTOTVAL_H__
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-
-#ifdef FREETYPE_H
-#error "freetype.h of FreeType 1 has been loaded!"
-#error "Please fix the directory search order for header files"
-#error "so that freetype.h of FreeType 2 is found first."
-#endif
-
-
-FT_BEGIN_HEADER
-
-
- /*************************************************************************/
- /* */
- /* <Section> */
- /* ot_validation */
- /* */
- /* <Title> */
- /* OpenType Validation */
- /* */
- /* <Abstract> */
- /* An API to validate OpenType tables. */
- /* */
- /* <Description> */
- /* This section contains the declaration of functions to validate */
- /* some OpenType tables (BASE, GDEF, GPOS, GSUB, JSTF, MATH). */
- /* */
- /* <Order> */
- /* FT_OpenType_Validate */
- /* FT_OpenType_Free */
- /* */
- /* FT_VALIDATE_OTXXX */
- /* */
- /*************************************************************************/
-
-
- /**********************************************************************
- *
- * @enum:
- * FT_VALIDATE_OTXXX
- *
- * @description:
- * A list of bit-field constants used with @FT_OpenType_Validate to
- * indicate which OpenType tables should be validated.
- *
- * @values:
- * FT_VALIDATE_BASE ::
- * Validate BASE table.
- *
- * FT_VALIDATE_GDEF ::
- * Validate GDEF table.
- *
- * FT_VALIDATE_GPOS ::
- * Validate GPOS table.
- *
- * FT_VALIDATE_GSUB ::
- * Validate GSUB table.
- *
- * FT_VALIDATE_JSTF ::
- * Validate JSTF table.
- *
- * FT_VALIDATE_MATH ::
- * Validate MATH table.
- *
- * FT_VALIDATE_OT ::
- * Validate all OpenType tables (BASE, GDEF, GPOS, GSUB, JSTF, MATH).
- *
- */
-#define FT_VALIDATE_BASE 0x0100
-#define FT_VALIDATE_GDEF 0x0200
-#define FT_VALIDATE_GPOS 0x0400
-#define FT_VALIDATE_GSUB 0x0800
-#define FT_VALIDATE_JSTF 0x1000
-#define FT_VALIDATE_MATH 0x2000
-
-#define FT_VALIDATE_OT FT_VALIDATE_BASE | \
- FT_VALIDATE_GDEF | \
- FT_VALIDATE_GPOS | \
- FT_VALIDATE_GSUB | \
- FT_VALIDATE_JSTF | \
- FT_VALIDATE_MATH
-
- /**********************************************************************
- *
- * @function:
- * FT_OpenType_Validate
- *
- * @description:
- * Validate various OpenType tables to assure that all offsets and
- * indices are valid. The idea is that a higher-level library that
- * actually does the text layout can access those tables without
- * error checking (which can be quite time consuming).
- *
- * @input:
- * face ::
- * A handle to the input face.
- *
- * validation_flags ::
- * A bit field that specifies the tables to be validated. See
- * @FT_VALIDATE_OTXXX for possible values.
- *
- * @output:
- * BASE_table ::
- * A pointer to the BASE table.
- *
- * GDEF_table ::
- * A pointer to the GDEF table.
- *
- * GPOS_table ::
- * A pointer to the GPOS table.
- *
- * GSUB_table ::
- * A pointer to the GSUB table.
- *
- * JSTF_table ::
- * A pointer to the JSTF table.
- *
- * @return:
- * FreeType error code. 0~means success.
- *
- * @note:
- * This function only works with OpenType fonts, returning an error
- * otherwise.
- *
- * After use, the application should deallocate the five tables with
- * @FT_OpenType_Free. A NULL value indicates that the table either
- * doesn't exist in the font, or the application hasn't asked for
- * validation.
- */
- FT_EXPORT( FT_Error )
- FT_OpenType_Validate( FT_Face face,
- FT_UInt validation_flags,
- FT_Bytes *BASE_table,
- FT_Bytes *GDEF_table,
- FT_Bytes *GPOS_table,
- FT_Bytes *GSUB_table,
- FT_Bytes *JSTF_table );
-
- /**********************************************************************
- *
- * @function:
- * FT_OpenType_Free
- *
- * @description:
- * Free the buffer allocated by OpenType validator.
- *
- * @input:
- * face ::
- * A handle to the input face.
- *
- * table ::
- * The pointer to the buffer that is allocated by
- * @FT_OpenType_Validate.
- *
- * @note:
- * This function must be used to free the buffer allocated by
- * @FT_OpenType_Validate only.
- */
- FT_EXPORT( void )
- FT_OpenType_Free( FT_Face face,
- FT_Bytes table );
-
- /* */
-
-
-FT_END_HEADER
-
-#endif /* __FTOTVAL_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftoutln.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftoutln.h
deleted file mode 100644
index b6ec70de8cf..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftoutln.h
+++ /dev/null
@@ -1,574 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftoutln.h */
-/* */
-/* Support for the FT_Outline type used to store glyph shapes of */
-/* most scalable font formats (specification). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __FTOUTLN_H__
-#define __FTOUTLN_H__
-
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-
-#ifdef FREETYPE_H
-#error "freetype.h of FreeType 1 has been loaded!"
-#error "Please fix the directory search order for header files"
-#error "so that freetype.h of FreeType 2 is found first."
-#endif
-
-
-FT_BEGIN_HEADER
-
-
- /*************************************************************************/
- /* */
- /* <Section> */
- /* outline_processing */
- /* */
- /* <Title> */
- /* Outline Processing */
- /* */
- /* <Abstract> */
- /* Functions to create, transform, and render vectorial glyph images. */
- /* */
- /* <Description> */
- /* This section contains routines used to create and destroy scalable */
- /* glyph images known as `outlines'. These can also be measured, */
- /* transformed, and converted into bitmaps and pixmaps. */
- /* */
- /* <Order> */
- /* FT_Outline */
- /* FT_Outline_New */
- /* FT_Outline_Done */
- /* FT_Outline_Copy */
- /* FT_Outline_Translate */
- /* FT_Outline_Transform */
- /* FT_Outline_Embolden */
- /* FT_Outline_EmboldenXY */
- /* FT_Outline_Reverse */
- /* FT_Outline_Check */
- /* */
- /* FT_Outline_Get_CBox */
- /* FT_Outline_Get_BBox */
- /* */
- /* FT_Outline_Get_Bitmap */
- /* FT_Outline_Render */
- /* FT_Outline_Decompose */
- /* FT_Outline_Funcs */
- /* FT_Outline_MoveToFunc */
- /* FT_Outline_LineToFunc */
- /* FT_Outline_ConicToFunc */
- /* FT_Outline_CubicToFunc */
- /* */
- /* FT_Orientation */
- /* FT_Outline_Get_Orientation */
- /* */
- /* FT_OUTLINE_XXX */
- /* */
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Outline_Decompose */
- /* */
- /* <Description> */
- /* Walk over an outline's structure to decompose it into individual */
- /* segments and Bézier arcs. This function also emits `move to' */
- /* operations to indicate the start of new contours in the outline. */
- /* */
- /* <Input> */
- /* outline :: A pointer to the source target. */
- /* */
- /* func_interface :: A table of `emitters', i.e., function pointers */
- /* called during decomposition to indicate path */
- /* operations. */
- /* */
- /* <InOut> */
- /* user :: A typeless pointer that is passed to each */
- /* emitter during the decomposition. It can be */
- /* used to store the state during the */
- /* decomposition. */
- /* */
- /* <Return> */
- /* FreeType error code. 0~means success. */
- /* */
- /* <Note> */
- /* A contour that contains a single point only is represented by a */
- /* `move to' operation followed by `line to' to the same point. In */
- /* most cases, it is best to filter this out before using the */
- /* outline for stroking purposes (otherwise it would result in a */
- /* visible dot when round caps are used). */
- /* */
- FT_EXPORT( FT_Error )
- FT_Outline_Decompose( FT_Outline* outline,
- const FT_Outline_Funcs* func_interface,
- void* user );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Outline_New */
- /* */
- /* <Description> */
- /* Create a new outline of a given size. */
- /* */
- /* <Input> */
- /* library :: A handle to the library object from where the */
- /* outline is allocated. Note however that the new */
- /* outline will *not* necessarily be *freed*, when */
- /* destroying the library, by @FT_Done_FreeType. */
- /* */
- /* numPoints :: The maximum number of points within the outline. */
- /* Must be smaller than or equal to 0xFFFF (65535). */
- /* */
- /* numContours :: The maximum number of contours within the outline. */
- /* This value must be in the range 0 to `numPoints'. */
- /* */
- /* <Output> */
- /* anoutline :: A handle to the new outline. */
- /* */
- /* <Return> */
- /* FreeType error code. 0~means success. */
- /* */
- /* <Note> */
- /* The reason why this function takes a `library' parameter is simply */
- /* to use the library's memory allocator. */
- /* */
- FT_EXPORT( FT_Error )
- FT_Outline_New( FT_Library library,
- FT_UInt numPoints,
- FT_Int numContours,
- FT_Outline *anoutline );
-
-
- FT_EXPORT( FT_Error )
- FT_Outline_New_Internal( FT_Memory memory,
- FT_UInt numPoints,
- FT_Int numContours,
- FT_Outline *anoutline );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Outline_Done */
- /* */
- /* <Description> */
- /* Destroy an outline created with @FT_Outline_New. */
- /* */
- /* <Input> */
- /* library :: A handle of the library object used to allocate the */
- /* outline. */
- /* */
- /* outline :: A pointer to the outline object to be discarded. */
- /* */
- /* <Return> */
- /* FreeType error code. 0~means success. */
- /* */
- /* <Note> */
- /* If the outline's `owner' field is not set, only the outline */
- /* descriptor will be released. */
- /* */
- /* The reason why this function takes an `library' parameter is */
- /* simply to use ft_mem_free(). */
- /* */
- FT_EXPORT( FT_Error )
- FT_Outline_Done( FT_Library library,
- FT_Outline* outline );
-
-
- FT_EXPORT( FT_Error )
- FT_Outline_Done_Internal( FT_Memory memory,
- FT_Outline* outline );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Outline_Check */
- /* */
- /* <Description> */
- /* Check the contents of an outline descriptor. */
- /* */
- /* <Input> */
- /* outline :: A handle to a source outline. */
- /* */
- /* <Return> */
- /* FreeType error code. 0~means success. */
- /* */
- FT_EXPORT( FT_Error )
- FT_Outline_Check( FT_Outline* outline );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Outline_Get_CBox */
- /* */
- /* <Description> */
- /* Return an outline's `control box'. The control box encloses all */
- /* the outline's points, including Bézier control points. Though it */
- /* coincides with the exact bounding box for most glyphs, it can be */
- /* slightly larger in some situations (like when rotating an outline */
- /* that contains Bézier outside arcs). */
- /* */
- /* Computing the control box is very fast, while getting the bounding */
- /* box can take much more time as it needs to walk over all segments */
- /* and arcs in the outline. To get the latter, you can use the */
- /* `ftbbox' component, which is dedicated to this single task. */
- /* */
- /* <Input> */
- /* outline :: A pointer to the source outline descriptor. */
- /* */
- /* <Output> */
- /* acbox :: The outline's control box. */
- /* */
- /* <Note> */
- /* See @FT_Glyph_Get_CBox for a discussion of tricky fonts. */
- /* */
- FT_EXPORT( void )
- FT_Outline_Get_CBox( const FT_Outline* outline,
- FT_BBox *acbox );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Outline_Translate */
- /* */
- /* <Description> */
- /* Apply a simple translation to the points of an outline. */
- /* */
- /* <InOut> */
- /* outline :: A pointer to the target outline descriptor. */
- /* */
- /* <Input> */
- /* xOffset :: The horizontal offset. */
- /* */
- /* yOffset :: The vertical offset. */
- /* */
- FT_EXPORT( void )
- FT_Outline_Translate( const FT_Outline* outline,
- FT_Pos xOffset,
- FT_Pos yOffset );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Outline_Copy */
- /* */
- /* <Description> */
- /* Copy an outline into another one. Both objects must have the */
- /* same sizes (number of points & number of contours) when this */
- /* function is called. */
- /* */
- /* <Input> */
- /* source :: A handle to the source outline. */
- /* */
- /* <Output> */
- /* target :: A handle to the target outline. */
- /* */
- /* <Return> */
- /* FreeType error code. 0~means success. */
- /* */
- FT_EXPORT( FT_Error )
- FT_Outline_Copy( const FT_Outline* source,
- FT_Outline *target );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Outline_Transform */
- /* */
- /* <Description> */
- /* Apply a simple 2x2 matrix to all of an outline's points. Useful */
- /* for applying rotations, slanting, flipping, etc. */
- /* */
- /* <InOut> */
- /* outline :: A pointer to the target outline descriptor. */
- /* */
- /* <Input> */
- /* matrix :: A pointer to the transformation matrix. */
- /* */
- /* <Note> */
- /* You can use @FT_Outline_Translate if you need to translate the */
- /* outline's points. */
- /* */
- FT_EXPORT( void )
- FT_Outline_Transform( const FT_Outline* outline,
- const FT_Matrix* matrix );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Outline_Embolden */
- /* */
- /* <Description> */
- /* Embolden an outline. The new outline will be at most 4~times */
- /* `strength' pixels wider and higher. You may think of the left and */
- /* bottom borders as unchanged. */
- /* */
- /* Negative `strength' values to reduce the outline thickness are */
- /* possible also. */
- /* */
- /* <InOut> */
- /* outline :: A handle to the target outline. */
- /* */
- /* <Input> */
- /* strength :: How strong the glyph is emboldened. Expressed in */
- /* 26.6 pixel format. */
- /* */
- /* <Return> */
- /* FreeType error code. 0~means success. */
- /* */
- /* <Note> */
- /* The used algorithm to increase or decrease the thickness of the */
- /* glyph doesn't change the number of points; this means that certain */
- /* situations like acute angles or intersections are sometimes */
- /* handled incorrectly. */
- /* */
- /* If you need `better' metrics values you should call */
- /* @FT_Outline_Get_CBox or @FT_Outline_Get_BBox. */
- /* */
- /* Example call: */
- /* */
- /* { */
- /* FT_Load_Glyph( face, index, FT_LOAD_DEFAULT ); */
- /* if ( face->glyph->format == FT_GLYPH_FORMAT_OUTLINE ) */
- /* FT_Outline_Embolden( &face->glyph->outline, strength ); */
- /* } */
- /* */
- /* To get meaningful results, font scaling values must be set with */
- /* functions like @FT_Set_Char_Size before calling FT_Render_Glyph. */
- /* */
- FT_EXPORT( FT_Error )
- FT_Outline_Embolden( FT_Outline* outline,
- FT_Pos strength );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Outline_EmboldenXY */
- /* */
- /* <Description> */
- /* Embolden an outline. The new outline will be `xstrength' pixels */
- /* wider and `ystrength' pixels higher. Otherwise, it is similar to */
- /* @FT_Outline_Embolden, which uses the same strength in both */
- /* directions. */
- /* */
- FT_EXPORT( FT_Error )
- FT_Outline_EmboldenXY( FT_Outline* outline,
- FT_Pos xstrength,
- FT_Pos ystrength );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Outline_Reverse */
- /* */
- /* <Description> */
- /* Reverse the drawing direction of an outline. This is used to */
- /* ensure consistent fill conventions for mirrored glyphs. */
- /* */
- /* <InOut> */
- /* outline :: A pointer to the target outline descriptor. */
- /* */
- /* <Note> */
- /* This function toggles the bit flag @FT_OUTLINE_REVERSE_FILL in */
- /* the outline's `flags' field. */
- /* */
- /* It shouldn't be used by a normal client application, unless it */
- /* knows what it is doing. */
- /* */
- FT_EXPORT( void )
- FT_Outline_Reverse( FT_Outline* outline );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Outline_Get_Bitmap */
- /* */
- /* <Description> */
- /* Render an outline within a bitmap. The outline's image is simply */
- /* OR-ed to the target bitmap. */
- /* */
- /* <Input> */
- /* library :: A handle to a FreeType library object. */
- /* */
- /* outline :: A pointer to the source outline descriptor. */
- /* */
- /* <InOut> */
- /* abitmap :: A pointer to the target bitmap descriptor. */
- /* */
- /* <Return> */
- /* FreeType error code. 0~means success. */
- /* */
- /* <Note> */
- /* This function does NOT CREATE the bitmap, it only renders an */
- /* outline image within the one you pass to it! Consequently, the */
- /* various fields in `abitmap' should be set accordingly. */
- /* */
- /* It will use the raster corresponding to the default glyph format. */
- /* */
- /* The value of the `num_grays' field in `abitmap' is ignored. If */
- /* you select the gray-level rasterizer, and you want less than 256 */
- /* gray levels, you have to use @FT_Outline_Render directly. */
- /* */
- FT_EXPORT( FT_Error )
- FT_Outline_Get_Bitmap( FT_Library library,
- FT_Outline* outline,
- const FT_Bitmap *abitmap );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Outline_Render */
- /* */
- /* <Description> */
- /* Render an outline within a bitmap using the current scan-convert. */
- /* This function uses an @FT_Raster_Params structure as an argument, */
- /* allowing advanced features like direct composition, translucency, */
- /* etc. */
- /* */
- /* <Input> */
- /* library :: A handle to a FreeType library object. */
- /* */
- /* outline :: A pointer to the source outline descriptor. */
- /* */
- /* <InOut> */
- /* params :: A pointer to an @FT_Raster_Params structure used to */
- /* describe the rendering operation. */
- /* */
- /* <Return> */
- /* FreeType error code. 0~means success. */
- /* */
- /* <Note> */
- /* You should know what you are doing and how @FT_Raster_Params works */
- /* to use this function. */
- /* */
- /* The field `params.source' will be set to `outline' before the scan */
- /* converter is called, which means that the value you give to it is */
- /* actually ignored. */
- /* */
- /* The gray-level rasterizer always uses 256 gray levels. If you */
- /* want less gray levels, you have to provide your own span callback. */
- /* See the @FT_RASTER_FLAG_DIRECT value of the `flags' field in the */
- /* @FT_Raster_Params structure for more details. */
- /* */
- FT_EXPORT( FT_Error )
- FT_Outline_Render( FT_Library library,
- FT_Outline* outline,
- FT_Raster_Params* params );
-
-
- /**************************************************************************
- *
- * @enum:
- * FT_Orientation
- *
- * @description:
- * A list of values used to describe an outline's contour orientation.
- *
- * The TrueType and PostScript specifications use different conventions
- * to determine whether outline contours should be filled or unfilled.
- *
- * @values:
- * FT_ORIENTATION_TRUETYPE ::
- * According to the TrueType specification, clockwise contours must
- * be filled, and counter-clockwise ones must be unfilled.
- *
- * FT_ORIENTATION_POSTSCRIPT ::
- * According to the PostScript specification, counter-clockwise contours
- * must be filled, and clockwise ones must be unfilled.
- *
- * FT_ORIENTATION_FILL_RIGHT ::
- * This is identical to @FT_ORIENTATION_TRUETYPE, but is used to
- * remember that in TrueType, everything that is to the right of
- * the drawing direction of a contour must be filled.
- *
- * FT_ORIENTATION_FILL_LEFT ::
- * This is identical to @FT_ORIENTATION_POSTSCRIPT, but is used to
- * remember that in PostScript, everything that is to the left of
- * the drawing direction of a contour must be filled.
- *
- * FT_ORIENTATION_NONE ::
- * The orientation cannot be determined. That is, different parts of
- * the glyph have different orientation.
- *
- */
- typedef enum FT_Orientation_
- {
- FT_ORIENTATION_TRUETYPE = 0,
- FT_ORIENTATION_POSTSCRIPT = 1,
- FT_ORIENTATION_FILL_RIGHT = FT_ORIENTATION_TRUETYPE,
- FT_ORIENTATION_FILL_LEFT = FT_ORIENTATION_POSTSCRIPT,
- FT_ORIENTATION_NONE
-
- } FT_Orientation;
-
-
- /**************************************************************************
- *
- * @function:
- * FT_Outline_Get_Orientation
- *
- * @description:
- * This function analyzes a glyph outline and tries to compute its
- * fill orientation (see @FT_Orientation). This is done by integrating
- * the total area covered by the outline. The positive integral
- * corresponds to the clockwise orientation and @FT_ORIENTATION_POSTSCRIPT
- * is returned. The negative integral corresponds to the counter-clockwise
- * orientation and @FT_ORIENTATION_TRUETYPE is returned.
- *
- * Note that this will return @FT_ORIENTATION_TRUETYPE for empty
- * outlines.
- *
- * @input:
- * outline ::
- * A handle to the source outline.
- *
- * @return:
- * The orientation.
- *
- */
- FT_EXPORT( FT_Orientation )
- FT_Outline_Get_Orientation( FT_Outline* outline );
-
- /* */
-
-
-FT_END_HEADER
-
-#endif /* __FTOUTLN_H__ */
-
-
-/* END */
-
-
-/* Local Variables: */
-/* coding: utf-8 */
-/* End: */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftpfr.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftpfr.h
deleted file mode 100644
index a1c02a2f5ee..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftpfr.h
+++ /dev/null
@@ -1,172 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftpfr.h */
-/* */
-/* FreeType API for accessing PFR-specific data (specification only). */
-/* */
-/* Copyright 2002-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __FTPFR_H__
-#define __FTPFR_H__
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-
-#ifdef FREETYPE_H
-#error "freetype.h of FreeType 1 has been loaded!"
-#error "Please fix the directory search order for header files"
-#error "so that freetype.h of FreeType 2 is found first."
-#endif
-
-
-FT_BEGIN_HEADER
-
-
- /*************************************************************************/
- /* */
- /* <Section> */
- /* pfr_fonts */
- /* */
- /* <Title> */
- /* PFR Fonts */
- /* */
- /* <Abstract> */
- /* PFR/TrueDoc specific API. */
- /* */
- /* <Description> */
- /* This section contains the declaration of PFR-specific functions. */
- /* */
- /*************************************************************************/
-
-
- /**********************************************************************
- *
- * @function:
- * FT_Get_PFR_Metrics
- *
- * @description:
- * Return the outline and metrics resolutions of a given PFR face.
- *
- * @input:
- * face :: Handle to the input face. It can be a non-PFR face.
- *
- * @output:
- * aoutline_resolution ::
- * Outline resolution. This is equivalent to `face->units_per_EM'
- * for non-PFR fonts. Optional (parameter can be NULL).
- *
- * ametrics_resolution ::
- * Metrics resolution. This is equivalent to `outline_resolution'
- * for non-PFR fonts. Optional (parameter can be NULL).
- *
- * ametrics_x_scale ::
- * A 16.16 fixed-point number used to scale distance expressed
- * in metrics units to device sub-pixels. This is equivalent to
- * `face->size->x_scale', but for metrics only. Optional (parameter
- * can be NULL).
- *
- * ametrics_y_scale ::
- * Same as `ametrics_x_scale' but for the vertical direction.
- * optional (parameter can be NULL).
- *
- * @return:
- * FreeType error code. 0~means success.
- *
- * @note:
- * If the input face is not a PFR, this function will return an error.
- * However, in all cases, it will return valid values.
- */
- FT_EXPORT( FT_Error )
- FT_Get_PFR_Metrics( FT_Face face,
- FT_UInt *aoutline_resolution,
- FT_UInt *ametrics_resolution,
- FT_Fixed *ametrics_x_scale,
- FT_Fixed *ametrics_y_scale );
-
-
- /**********************************************************************
- *
- * @function:
- * FT_Get_PFR_Kerning
- *
- * @description:
- * Return the kerning pair corresponding to two glyphs in a PFR face.
- * The distance is expressed in metrics units, unlike the result of
- * @FT_Get_Kerning.
- *
- * @input:
- * face :: A handle to the input face.
- *
- * left :: Index of the left glyph.
- *
- * right :: Index of the right glyph.
- *
- * @output:
- * avector :: A kerning vector.
- *
- * @return:
- * FreeType error code. 0~means success.
- *
- * @note:
- * This function always return distances in original PFR metrics
- * units. This is unlike @FT_Get_Kerning with the @FT_KERNING_UNSCALED
- * mode, which always returns distances converted to outline units.
- *
- * You can use the value of the `x_scale' and `y_scale' parameters
- * returned by @FT_Get_PFR_Metrics to scale these to device sub-pixels.
- */
- FT_EXPORT( FT_Error )
- FT_Get_PFR_Kerning( FT_Face face,
- FT_UInt left,
- FT_UInt right,
- FT_Vector *avector );
-
-
- /**********************************************************************
- *
- * @function:
- * FT_Get_PFR_Advance
- *
- * @description:
- * Return a given glyph advance, expressed in original metrics units,
- * from a PFR font.
- *
- * @input:
- * face :: A handle to the input face.
- *
- * gindex :: The glyph index.
- *
- * @output:
- * aadvance :: The glyph advance in metrics units.
- *
- * @return:
- * FreeType error code. 0~means success.
- *
- * @note:
- * You can use the `x_scale' or `y_scale' results of @FT_Get_PFR_Metrics
- * to convert the advance to device sub-pixels (i.e., 1/64th of pixels).
- */
- FT_EXPORT( FT_Error )
- FT_Get_PFR_Advance( FT_Face face,
- FT_UInt gindex,
- FT_Pos *aadvance );
-
- /* */
-
-
-FT_END_HEADER
-
-#endif /* __FTPFR_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftrender.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftrender.h
deleted file mode 100644
index ec8da700b14..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftrender.h
+++ /dev/null
@@ -1,232 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftrender.h */
-/* */
-/* FreeType renderer modules public interface (specification). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __FTRENDER_H__
-#define __FTRENDER_H__
-
-
-#include <ft2build.h>
-#include FT_MODULE_H
-#include FT_GLYPH_H
-
-
-FT_BEGIN_HEADER
-
-
- /*************************************************************************/
- /* */
- /* <Section> */
- /* module_management */
- /* */
- /*************************************************************************/
-
-
- /* create a new glyph object */
- typedef FT_Error
- (*FT_Glyph_InitFunc)( FT_Glyph glyph,
- FT_GlyphSlot slot );
-
- /* destroys a given glyph object */
- typedef void
- (*FT_Glyph_DoneFunc)( FT_Glyph glyph );
-
- typedef void
- (*FT_Glyph_TransformFunc)( FT_Glyph glyph,
- const FT_Matrix* matrix,
- const FT_Vector* delta );
-
- typedef void
- (*FT_Glyph_GetBBoxFunc)( FT_Glyph glyph,
- FT_BBox* abbox );
-
- typedef FT_Error
- (*FT_Glyph_CopyFunc)( FT_Glyph source,
- FT_Glyph target );
-
- typedef FT_Error
- (*FT_Glyph_PrepareFunc)( FT_Glyph glyph,
- FT_GlyphSlot slot );
-
-/* deprecated */
-#define FT_Glyph_Init_Func FT_Glyph_InitFunc
-#define FT_Glyph_Done_Func FT_Glyph_DoneFunc
-#define FT_Glyph_Transform_Func FT_Glyph_TransformFunc
-#define FT_Glyph_BBox_Func FT_Glyph_GetBBoxFunc
-#define FT_Glyph_Copy_Func FT_Glyph_CopyFunc
-#define FT_Glyph_Prepare_Func FT_Glyph_PrepareFunc
-
-
- struct FT_Glyph_Class_
- {
- FT_Long glyph_size;
- FT_Glyph_Format glyph_format;
- FT_Glyph_InitFunc glyph_init;
- FT_Glyph_DoneFunc glyph_done;
- FT_Glyph_CopyFunc glyph_copy;
- FT_Glyph_TransformFunc glyph_transform;
- FT_Glyph_GetBBoxFunc glyph_bbox;
- FT_Glyph_PrepareFunc glyph_prepare;
- };
-
-
- typedef FT_Error
- (*FT_Renderer_RenderFunc)( FT_Renderer renderer,
- FT_GlyphSlot slot,
- FT_UInt mode,
- const FT_Vector* origin );
-
- typedef FT_Error
- (*FT_Renderer_TransformFunc)( FT_Renderer renderer,
- FT_GlyphSlot slot,
- const FT_Matrix* matrix,
- const FT_Vector* delta );
-
-
- typedef void
- (*FT_Renderer_GetCBoxFunc)( FT_Renderer renderer,
- FT_GlyphSlot slot,
- FT_BBox* cbox );
-
-
- typedef FT_Error
- (*FT_Renderer_SetModeFunc)( FT_Renderer renderer,
- FT_ULong mode_tag,
- FT_Pointer mode_ptr );
-
-/* deprecated identifiers */
-#define FTRenderer_render FT_Renderer_RenderFunc
-#define FTRenderer_transform FT_Renderer_TransformFunc
-#define FTRenderer_getCBox FT_Renderer_GetCBoxFunc
-#define FTRenderer_setMode FT_Renderer_SetModeFunc
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* FT_Renderer_Class */
- /* */
- /* <Description> */
- /* The renderer module class descriptor. */
- /* */
- /* <Fields> */
- /* root :: The root @FT_Module_Class fields. */
- /* */
- /* glyph_format :: The glyph image format this renderer handles. */
- /* */
- /* render_glyph :: A method used to render the image that is in a */
- /* given glyph slot into a bitmap. */
- /* */
- /* transform_glyph :: A method used to transform the image that is in */
- /* a given glyph slot. */
- /* */
- /* get_glyph_cbox :: A method used to access the glyph's cbox. */
- /* */
- /* set_mode :: A method used to pass additional parameters. */
- /* */
- /* raster_class :: For @FT_GLYPH_FORMAT_OUTLINE renderers only. */
- /* This is a pointer to its raster's class. */
- /* */
- typedef struct FT_Renderer_Class_
- {
- FT_Module_Class root;
-
- FT_Glyph_Format glyph_format;
-
- FT_Renderer_RenderFunc render_glyph;
- FT_Renderer_TransformFunc transform_glyph;
- FT_Renderer_GetCBoxFunc get_glyph_cbox;
- FT_Renderer_SetModeFunc set_mode;
-
- FT_Raster_Funcs* raster_class;
-
- } FT_Renderer_Class;
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Get_Renderer */
- /* */
- /* <Description> */
- /* Retrieve the current renderer for a given glyph format. */
- /* */
- /* <Input> */
- /* library :: A handle to the library object. */
- /* */
- /* format :: The glyph format. */
- /* */
- /* <Return> */
- /* A renderer handle. 0~if none found. */
- /* */
- /* <Note> */
- /* An error will be returned if a module already exists by that name, */
- /* or if the module requires a version of FreeType that is too great. */
- /* */
- /* To add a new renderer, simply use @FT_Add_Module. To retrieve a */
- /* renderer by its name, use @FT_Get_Module. */
- /* */
- FT_EXPORT( FT_Renderer )
- FT_Get_Renderer( FT_Library library,
- FT_Glyph_Format format );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Set_Renderer */
- /* */
- /* <Description> */
- /* Set the current renderer to use, and set additional mode. */
- /* */
- /* <InOut> */
- /* library :: A handle to the library object. */
- /* */
- /* <Input> */
- /* renderer :: A handle to the renderer object. */
- /* */
- /* num_params :: The number of additional parameters. */
- /* */
- /* parameters :: Additional parameters. */
- /* */
- /* <Return> */
- /* FreeType error code. 0~means success. */
- /* */
- /* <Note> */
- /* In case of success, the renderer will be used to convert glyph */
- /* images in the renderer's known format into bitmaps. */
- /* */
- /* This doesn't change the current renderer for other formats. */
- /* */
- /* Currently, no FreeType renderer module uses `parameters'; you */
- /* should thus always pass NULL as the value. */
- /* */
- FT_EXPORT( FT_Error )
- FT_Set_Renderer( FT_Library library,
- FT_Renderer renderer,
- FT_UInt num_params,
- FT_Parameter* parameters );
-
- /* */
-
-
-FT_END_HEADER
-
-#endif /* __FTRENDER_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftsizes.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftsizes.h
deleted file mode 100644
index bef8424715f..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftsizes.h
+++ /dev/null
@@ -1,159 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftsizes.h */
-/* */
-/* FreeType size objects management (specification). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* Typical application would normally not need to use these functions. */
- /* However, they have been placed in a public API for the rare cases */
- /* where they are needed. */
- /* */
- /*************************************************************************/
-
-
-#ifndef __FTSIZES_H__
-#define __FTSIZES_H__
-
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-
-#ifdef FREETYPE_H
-#error "freetype.h of FreeType 1 has been loaded!"
-#error "Please fix the directory search order for header files"
-#error "so that freetype.h of FreeType 2 is found first."
-#endif
-
-
-FT_BEGIN_HEADER
-
-
- /*************************************************************************/
- /* */
- /* <Section> */
- /* sizes_management */
- /* */
- /* <Title> */
- /* Size Management */
- /* */
- /* <Abstract> */
- /* Managing multiple sizes per face. */
- /* */
- /* <Description> */
- /* When creating a new face object (e.g., with @FT_New_Face), an */
- /* @FT_Size object is automatically created and used to store all */
- /* pixel-size dependent information, available in the `face->size' */
- /* field. */
- /* */
- /* It is however possible to create more sizes for a given face, */
- /* mostly in order to manage several character pixel sizes of the */
- /* same font family and style. See @FT_New_Size and @FT_Done_Size. */
- /* */
- /* Note that @FT_Set_Pixel_Sizes and @FT_Set_Char_Size only */
- /* modify the contents of the current `active' size; you thus need */
- /* to use @FT_Activate_Size to change it. */
- /* */
- /* 99% of applications won't need the functions provided here, */
- /* especially if they use the caching sub-system, so be cautious */
- /* when using these. */
- /* */
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_New_Size */
- /* */
- /* <Description> */
- /* Create a new size object from a given face object. */
- /* */
- /* <Input> */
- /* face :: A handle to a parent face object. */
- /* */
- /* <Output> */
- /* asize :: A handle to a new size object. */
- /* */
- /* <Return> */
- /* FreeType error code. 0~means success. */
- /* */
- /* <Note> */
- /* You need to call @FT_Activate_Size in order to select the new size */
- /* for upcoming calls to @FT_Set_Pixel_Sizes, @FT_Set_Char_Size, */
- /* @FT_Load_Glyph, @FT_Load_Char, etc. */
- /* */
- FT_EXPORT( FT_Error )
- FT_New_Size( FT_Face face,
- FT_Size* size );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Done_Size */
- /* */
- /* <Description> */
- /* Discard a given size object. Note that @FT_Done_Face */
- /* automatically discards all size objects allocated with */
- /* @FT_New_Size. */
- /* */
- /* <Input> */
- /* size :: A handle to a target size object. */
- /* */
- /* <Return> */
- /* FreeType error code. 0~means success. */
- /* */
- FT_EXPORT( FT_Error )
- FT_Done_Size( FT_Size size );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Activate_Size */
- /* */
- /* <Description> */
- /* Even though it is possible to create several size objects for a */
- /* given face (see @FT_New_Size for details), functions like */
- /* @FT_Load_Glyph or @FT_Load_Char only use the one that has been */
- /* activated last to determine the `current character pixel size'. */
- /* */
- /* This function can be used to `activate' a previously created size */
- /* object. */
- /* */
- /* <Input> */
- /* size :: A handle to a target size object. */
- /* */
- /* <Return> */
- /* FreeType error code. 0~means success. */
- /* */
- /* <Note> */
- /* If `face' is the size's parent face object, this function changes */
- /* the value of `face->size' to the input size handle. */
- /* */
- FT_EXPORT( FT_Error )
- FT_Activate_Size( FT_Size size );
-
- /* */
-
-
-FT_END_HEADER
-
-#endif /* __FTSIZES_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftsnames.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftsnames.h
deleted file mode 100644
index 0f7fbe17445..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftsnames.h
+++ /dev/null
@@ -1,200 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftsnames.h */
-/* */
-/* Simple interface to access SFNT name tables (which are used */
-/* to hold font names, copyright info, notices, etc.) (specification). */
-/* */
-/* This is _not_ used to retrieve glyph names! */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __FT_SFNT_NAMES_H__
-#define __FT_SFNT_NAMES_H__
-
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-
-#ifdef FREETYPE_H
-#error "freetype.h of FreeType 1 has been loaded!"
-#error "Please fix the directory search order for header files"
-#error "so that freetype.h of FreeType 2 is found first."
-#endif
-
-
-FT_BEGIN_HEADER
-
-
- /*************************************************************************/
- /* */
- /* <Section> */
- /* sfnt_names */
- /* */
- /* <Title> */
- /* SFNT Names */
- /* */
- /* <Abstract> */
- /* Access the names embedded in TrueType and OpenType files. */
- /* */
- /* <Description> */
- /* The TrueType and OpenType specifications allow the inclusion of */
- /* a special `names table' in font files. This table contains */
- /* textual (and internationalized) information regarding the font, */
- /* like family name, copyright, version, etc. */
- /* */
- /* The definitions below are used to access them if available. */
- /* */
- /* Note that this has nothing to do with glyph names! */
- /* */
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* FT_SfntName */
- /* */
- /* <Description> */
- /* A structure used to model an SFNT `name' table entry. */
- /* */
- /* <Fields> */
- /* platform_id :: The platform ID for `string'. */
- /* */
- /* encoding_id :: The encoding ID for `string'. */
- /* */
- /* language_id :: The language ID for `string'. */
- /* */
- /* name_id :: An identifier for `string'. */
- /* */
- /* string :: The `name' string. Note that its format differs */
- /* depending on the (platform,encoding) pair. It can */
- /* be a Pascal String, a UTF-16 one, etc. */
- /* */
- /* Generally speaking, the string is not */
- /* zero-terminated. Please refer to the TrueType */
- /* specification for details. */
- /* */
- /* string_len :: The length of `string' in bytes. */
- /* */
- /* <Note> */
- /* Possible values for `platform_id', `encoding_id', `language_id', */
- /* and `name_id' are given in the file `ttnameid.h'. For details */
- /* please refer to the TrueType or OpenType specification. */
- /* */
- /* See also @TT_PLATFORM_XXX, @TT_APPLE_ID_XXX, @TT_MAC_ID_XXX, */
- /* @TT_ISO_ID_XXX, and @TT_MS_ID_XXX. */
- /* */
- typedef struct FT_SfntName_
- {
- FT_UShort platform_id;
- FT_UShort encoding_id;
- FT_UShort language_id;
- FT_UShort name_id;
-
- FT_Byte* string; /* this string is *not* null-terminated! */
- FT_UInt string_len; /* in bytes */
-
- } FT_SfntName;
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Get_Sfnt_Name_Count */
- /* */
- /* <Description> */
- /* Retrieve the number of name strings in the SFNT `name' table. */
- /* */
- /* <Input> */
- /* face :: A handle to the source face. */
- /* */
- /* <Return> */
- /* The number of strings in the `name' table. */
- /* */
- FT_EXPORT( FT_UInt )
- FT_Get_Sfnt_Name_Count( FT_Face face );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Get_Sfnt_Name */
- /* */
- /* <Description> */
- /* Retrieve a string of the SFNT `name' table for a given index. */
- /* */
- /* <Input> */
- /* face :: A handle to the source face. */
- /* */
- /* idx :: The index of the `name' string. */
- /* */
- /* <Output> */
- /* aname :: The indexed @FT_SfntName structure. */
- /* */
- /* <Return> */
- /* FreeType error code. 0~means success. */
- /* */
- /* <Note> */
- /* The `string' array returned in the `aname' structure is not */
- /* null-terminated. The application should deallocate it if it is no */
- /* longer in use. */
- /* */
- /* Use @FT_Get_Sfnt_Name_Count to get the total number of available */
- /* `name' table entries, then do a loop until you get the right */
- /* platform, encoding, and name ID. */
- /* */
- FT_EXPORT( FT_Error )
- FT_Get_Sfnt_Name( FT_Face face,
- FT_UInt idx,
- FT_SfntName *aname );
-
-
- /***************************************************************************
- *
- * @constant:
- * FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY
- *
- * @description:
- * A constant used as the tag of @FT_Parameter structures to make
- * FT_Open_Face() ignore preferred family subfamily names in `name'
- * table since OpenType version 1.4. For backwards compatibility with
- * legacy systems that have a 4-face-per-family restriction.
- *
- */
-#define FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY FT_MAKE_TAG( 'i', 'g', 'p', 'f' )
-
-
- /***************************************************************************
- *
- * @constant:
- * FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY
- *
- * @description:
- * A constant used as the tag of @FT_Parameter structures to make
- * FT_Open_Face() ignore preferred subfamily names in `name' table since
- * OpenType version 1.4. For backwards compatibility with legacy
- * systems that have a 4-face-per-family restriction.
- *
- */
-#define FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY FT_MAKE_TAG( 'i', 'g', 'p', 's' )
-
- /* */
-
-
-FT_END_HEADER
-
-#endif /* __FT_SFNT_NAMES_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftstroke.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftstroke.h
deleted file mode 100644
index 7ebb1e7404e..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftstroke.h
+++ /dev/null
@@ -1,785 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftstroke.h */
-/* */
-/* FreeType path stroker (specification). */
-/* */
-/* Copyright 2002-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __FT_STROKE_H__
-#define __FT_STROKE_H__
-
-#include <ft2build.h>
-#include FT_OUTLINE_H
-#include FT_GLYPH_H
-
-
-FT_BEGIN_HEADER
-
-
- /************************************************************************
- *
- * @section:
- * glyph_stroker
- *
- * @title:
- * Glyph Stroker
- *
- * @abstract:
- * Generating bordered and stroked glyphs.
- *
- * @description:
- * This component generates stroked outlines of a given vectorial
- * glyph. It also allows you to retrieve the `outside' and/or the
- * `inside' borders of the stroke.
- *
- * This can be useful to generate `bordered' glyph, i.e., glyphs
- * displayed with a coloured (and anti-aliased) border around their
- * shape.
- *
- * @order:
- * FT_Stroker
- *
- * FT_Stroker_LineJoin
- * FT_Stroker_LineCap
- * FT_StrokerBorder
- *
- * FT_Outline_GetInsideBorder
- * FT_Outline_GetOutsideBorder
- *
- * FT_Glyph_Stroke
- * FT_Glyph_StrokeBorder
- *
- * FT_Stroker_New
- * FT_Stroker_Set
- * FT_Stroker_Rewind
- * FT_Stroker_ParseOutline
- * FT_Stroker_Done
- *
- * FT_Stroker_BeginSubPath
- * FT_Stroker_EndSubPath
- *
- * FT_Stroker_LineTo
- * FT_Stroker_ConicTo
- * FT_Stroker_CubicTo
- *
- * FT_Stroker_GetBorderCounts
- * FT_Stroker_ExportBorder
- * FT_Stroker_GetCounts
- * FT_Stroker_Export
- *
- */
-
-
- /**************************************************************
- *
- * @type:
- * FT_Stroker
- *
- * @description:
- * Opaque handle to a path stroker object.
- */
- typedef struct FT_StrokerRec_* FT_Stroker;
-
-
- /**************************************************************
- *
- * @enum:
- * FT_Stroker_LineJoin
- *
- * @description:
- * These values determine how two joining lines are rendered
- * in a stroker.
- *
- * @values:
- * FT_STROKER_LINEJOIN_ROUND ::
- * Used to render rounded line joins. Circular arcs are used
- * to join two lines smoothly.
- *
- * FT_STROKER_LINEJOIN_BEVEL ::
- * Used to render beveled line joins. The outer corner of
- * the joined lines is filled by enclosing the triangular
- * region of the corner with a straight line between the
- * outer corners of each stroke.
- *
- * FT_STROKER_LINEJOIN_MITER_FIXED ::
- * Used to render mitered line joins, with fixed bevels if the
- * miter limit is exceeded. The outer edges of the strokes
- * for the two segments are extended until they meet at an
- * angle. If the segments meet at too sharp an angle (such
- * that the miter would extend from the intersection of the
- * segments a distance greater than the product of the miter
- * limit value and the border radius), then a bevel join (see
- * above) is used instead. This prevents long spikes being
- * created. FT_STROKER_LINEJOIN_MITER_FIXED generates a miter
- * line join as used in PostScript and PDF.
- *
- * FT_STROKER_LINEJOIN_MITER_VARIABLE ::
- * FT_STROKER_LINEJOIN_MITER ::
- * Used to render mitered line joins, with variable bevels if
- * the miter limit is exceeded. The intersection of the
- * strokes is clipped at a line perpendicular to the bisector
- * of the angle between the strokes, at the distance from the
- * intersection of the segments equal to the product of the
- * miter limit value and the border radius. This prevents
- * long spikes being created.
- * FT_STROKER_LINEJOIN_MITER_VARIABLE generates a mitered line
- * join as used in XPS. FT_STROKER_LINEJOIN_MITER is an alias
- * for FT_STROKER_LINEJOIN_MITER_VARIABLE, retained for
- * backwards compatibility.
- */
- typedef enum FT_Stroker_LineJoin_
- {
- FT_STROKER_LINEJOIN_ROUND = 0,
- FT_STROKER_LINEJOIN_BEVEL = 1,
- FT_STROKER_LINEJOIN_MITER_VARIABLE = 2,
- FT_STROKER_LINEJOIN_MITER = FT_STROKER_LINEJOIN_MITER_VARIABLE,
- FT_STROKER_LINEJOIN_MITER_FIXED = 3
-
- } FT_Stroker_LineJoin;
-
-
- /**************************************************************
- *
- * @enum:
- * FT_Stroker_LineCap
- *
- * @description:
- * These values determine how the end of opened sub-paths are
- * rendered in a stroke.
- *
- * @values:
- * FT_STROKER_LINECAP_BUTT ::
- * The end of lines is rendered as a full stop on the last
- * point itself.
- *
- * FT_STROKER_LINECAP_ROUND ::
- * The end of lines is rendered as a half-circle around the
- * last point.
- *
- * FT_STROKER_LINECAP_SQUARE ::
- * The end of lines is rendered as a square around the
- * last point.
- */
- typedef enum FT_Stroker_LineCap_
- {
- FT_STROKER_LINECAP_BUTT = 0,
- FT_STROKER_LINECAP_ROUND,
- FT_STROKER_LINECAP_SQUARE
-
- } FT_Stroker_LineCap;
-
-
- /**************************************************************
- *
- * @enum:
- * FT_StrokerBorder
- *
- * @description:
- * These values are used to select a given stroke border
- * in @FT_Stroker_GetBorderCounts and @FT_Stroker_ExportBorder.
- *
- * @values:
- * FT_STROKER_BORDER_LEFT ::
- * Select the left border, relative to the drawing direction.
- *
- * FT_STROKER_BORDER_RIGHT ::
- * Select the right border, relative to the drawing direction.
- *
- * @note:
- * Applications are generally interested in the `inside' and `outside'
- * borders. However, there is no direct mapping between these and the
- * `left' and `right' ones, since this really depends on the glyph's
- * drawing orientation, which varies between font formats.
- *
- * You can however use @FT_Outline_GetInsideBorder and
- * @FT_Outline_GetOutsideBorder to get these.
- */
- typedef enum FT_StrokerBorder_
- {
- FT_STROKER_BORDER_LEFT = 0,
- FT_STROKER_BORDER_RIGHT
-
- } FT_StrokerBorder;
-
-
- /**************************************************************
- *
- * @function:
- * FT_Outline_GetInsideBorder
- *
- * @description:
- * Retrieve the @FT_StrokerBorder value corresponding to the
- * `inside' borders of a given outline.
- *
- * @input:
- * outline ::
- * The source outline handle.
- *
- * @return:
- * The border index. @FT_STROKER_BORDER_RIGHT for empty or invalid
- * outlines.
- */
- FT_EXPORT( FT_StrokerBorder )
- FT_Outline_GetInsideBorder( FT_Outline* outline );
-
-
- /**************************************************************
- *
- * @function:
- * FT_Outline_GetOutsideBorder
- *
- * @description:
- * Retrieve the @FT_StrokerBorder value corresponding to the
- * `outside' borders of a given outline.
- *
- * @input:
- * outline ::
- * The source outline handle.
- *
- * @return:
- * The border index. @FT_STROKER_BORDER_LEFT for empty or invalid
- * outlines.
- */
- FT_EXPORT( FT_StrokerBorder )
- FT_Outline_GetOutsideBorder( FT_Outline* outline );
-
-
- /**************************************************************
- *
- * @function:
- * FT_Stroker_New
- *
- * @description:
- * Create a new stroker object.
- *
- * @input:
- * library ::
- * FreeType library handle.
- *
- * @output:
- * astroker ::
- * A new stroker object handle. NULL in case of error.
- *
- * @return:
- * FreeType error code. 0~means success.
- */
- FT_EXPORT( FT_Error )
- FT_Stroker_New( FT_Library library,
- FT_Stroker *astroker );
-
-
- /**************************************************************
- *
- * @function:
- * FT_Stroker_Set
- *
- * @description:
- * Reset a stroker object's attributes.
- *
- * @input:
- * stroker ::
- * The target stroker handle.
- *
- * radius ::
- * The border radius.
- *
- * line_cap ::
- * The line cap style.
- *
- * line_join ::
- * The line join style.
- *
- * miter_limit ::
- * The miter limit for the FT_STROKER_LINEJOIN_MITER_FIXED and
- * FT_STROKER_LINEJOIN_MITER_VARIABLE line join styles,
- * expressed as 16.16 fixed-point value.
- *
- * @note:
- * The radius is expressed in the same units as the outline
- * coordinates.
- *
- * This function calls @FT_Stroker_Rewind automatically.
- */
- FT_EXPORT( void )
- FT_Stroker_Set( FT_Stroker stroker,
- FT_Fixed radius,
- FT_Stroker_LineCap line_cap,
- FT_Stroker_LineJoin line_join,
- FT_Fixed miter_limit );
-
-
- /**************************************************************
- *
- * @function:
- * FT_Stroker_Rewind
- *
- * @description:
- * Reset a stroker object without changing its attributes.
- * You should call this function before beginning a new
- * series of calls to @FT_Stroker_BeginSubPath or
- * @FT_Stroker_EndSubPath.
- *
- * @input:
- * stroker ::
- * The target stroker handle.
- */
- FT_EXPORT( void )
- FT_Stroker_Rewind( FT_Stroker stroker );
-
-
- /**************************************************************
- *
- * @function:
- * FT_Stroker_ParseOutline
- *
- * @description:
- * A convenience function used to parse a whole outline with
- * the stroker. The resulting outline(s) can be retrieved
- * later by functions like @FT_Stroker_GetCounts and @FT_Stroker_Export.
- *
- * @input:
- * stroker ::
- * The target stroker handle.
- *
- * outline ::
- * The source outline.
- *
- * opened ::
- * A boolean. If~1, the outline is treated as an open path instead
- * of a closed one.
- *
- * @return:
- * FreeType error code. 0~means success.
- *
- * @note:
- * If `opened' is~0 (the default), the outline is treated as a closed
- * path, and the stroker generates two distinct `border' outlines.
- *
- * If `opened' is~1, the outline is processed as an open path, and the
- * stroker generates a single `stroke' outline.
- *
- * This function calls @FT_Stroker_Rewind automatically.
- */
- FT_EXPORT( FT_Error )
- FT_Stroker_ParseOutline( FT_Stroker stroker,
- FT_Outline* outline,
- FT_Bool opened );
-
-
- /**************************************************************
- *
- * @function:
- * FT_Stroker_BeginSubPath
- *
- * @description:
- * Start a new sub-path in the stroker.
- *
- * @input:
- * stroker ::
- * The target stroker handle.
- *
- * to ::
- * A pointer to the start vector.
- *
- * open ::
- * A boolean. If~1, the sub-path is treated as an open one.
- *
- * @return:
- * FreeType error code. 0~means success.
- *
- * @note:
- * This function is useful when you need to stroke a path that is
- * not stored as an @FT_Outline object.
- */
- FT_EXPORT( FT_Error )
- FT_Stroker_BeginSubPath( FT_Stroker stroker,
- FT_Vector* to,
- FT_Bool open );
-
-
- /**************************************************************
- *
- * @function:
- * FT_Stroker_EndSubPath
- *
- * @description:
- * Close the current sub-path in the stroker.
- *
- * @input:
- * stroker ::
- * The target stroker handle.
- *
- * @return:
- * FreeType error code. 0~means success.
- *
- * @note:
- * You should call this function after @FT_Stroker_BeginSubPath.
- * If the subpath was not `opened', this function `draws' a
- * single line segment to the start position when needed.
- */
- FT_EXPORT( FT_Error )
- FT_Stroker_EndSubPath( FT_Stroker stroker );
-
-
- /**************************************************************
- *
- * @function:
- * FT_Stroker_LineTo
- *
- * @description:
- * `Draw' a single line segment in the stroker's current sub-path,
- * from the last position.
- *
- * @input:
- * stroker ::
- * The target stroker handle.
- *
- * to ::
- * A pointer to the destination point.
- *
- * @return:
- * FreeType error code. 0~means success.
- *
- * @note:
- * You should call this function between @FT_Stroker_BeginSubPath and
- * @FT_Stroker_EndSubPath.
- */
- FT_EXPORT( FT_Error )
- FT_Stroker_LineTo( FT_Stroker stroker,
- FT_Vector* to );
-
-
- /**************************************************************
- *
- * @function:
- * FT_Stroker_ConicTo
- *
- * @description:
- * `Draw' a single quadratic Bézier in the stroker's current sub-path,
- * from the last position.
- *
- * @input:
- * stroker ::
- * The target stroker handle.
- *
- * control ::
- * A pointer to a Bézier control point.
- *
- * to ::
- * A pointer to the destination point.
- *
- * @return:
- * FreeType error code. 0~means success.
- *
- * @note:
- * You should call this function between @FT_Stroker_BeginSubPath and
- * @FT_Stroker_EndSubPath.
- */
- FT_EXPORT( FT_Error )
- FT_Stroker_ConicTo( FT_Stroker stroker,
- FT_Vector* control,
- FT_Vector* to );
-
-
- /**************************************************************
- *
- * @function:
- * FT_Stroker_CubicTo
- *
- * @description:
- * `Draw' a single cubic Bézier in the stroker's current sub-path,
- * from the last position.
- *
- * @input:
- * stroker ::
- * The target stroker handle.
- *
- * control1 ::
- * A pointer to the first Bézier control point.
- *
- * control2 ::
- * A pointer to second Bézier control point.
- *
- * to ::
- * A pointer to the destination point.
- *
- * @return:
- * FreeType error code. 0~means success.
- *
- * @note:
- * You should call this function between @FT_Stroker_BeginSubPath and
- * @FT_Stroker_EndSubPath.
- */
- FT_EXPORT( FT_Error )
- FT_Stroker_CubicTo( FT_Stroker stroker,
- FT_Vector* control1,
- FT_Vector* control2,
- FT_Vector* to );
-
-
- /**************************************************************
- *
- * @function:
- * FT_Stroker_GetBorderCounts
- *
- * @description:
- * Call this function once you have finished parsing your paths
- * with the stroker. It returns the number of points and
- * contours necessary to export one of the `border' or `stroke'
- * outlines generated by the stroker.
- *
- * @input:
- * stroker ::
- * The target stroker handle.
- *
- * border ::
- * The border index.
- *
- * @output:
- * anum_points ::
- * The number of points.
- *
- * anum_contours ::
- * The number of contours.
- *
- * @return:
- * FreeType error code. 0~means success.
- *
- * @note:
- * When an outline, or a sub-path, is `closed', the stroker generates
- * two independent `border' outlines, named `left' and `right'.
- *
- * When the outline, or a sub-path, is `opened', the stroker merges
- * the `border' outlines with caps. The `left' border receives all
- * points, while the `right' border becomes empty.
- *
- * Use the function @FT_Stroker_GetCounts instead if you want to
- * retrieve the counts associated to both borders.
- */
- FT_EXPORT( FT_Error )
- FT_Stroker_GetBorderCounts( FT_Stroker stroker,
- FT_StrokerBorder border,
- FT_UInt *anum_points,
- FT_UInt *anum_contours );
-
-
- /**************************************************************
- *
- * @function:
- * FT_Stroker_ExportBorder
- *
- * @description:
- * Call this function after @FT_Stroker_GetBorderCounts to
- * export the corresponding border to your own @FT_Outline
- * structure.
- *
- * Note that this function appends the border points and
- * contours to your outline, but does not try to resize its
- * arrays.
- *
- * @input:
- * stroker ::
- * The target stroker handle.
- *
- * border ::
- * The border index.
- *
- * outline ::
- * The target outline handle.
- *
- * @note:
- * Always call this function after @FT_Stroker_GetBorderCounts to
- * get sure that there is enough room in your @FT_Outline object to
- * receive all new data.
- *
- * When an outline, or a sub-path, is `closed', the stroker generates
- * two independent `border' outlines, named `left' and `right'.
- *
- * When the outline, or a sub-path, is `opened', the stroker merges
- * the `border' outlines with caps. The `left' border receives all
- * points, while the `right' border becomes empty.
- *
- * Use the function @FT_Stroker_Export instead if you want to
- * retrieve all borders at once.
- */
- FT_EXPORT( void )
- FT_Stroker_ExportBorder( FT_Stroker stroker,
- FT_StrokerBorder border,
- FT_Outline* outline );
-
-
- /**************************************************************
- *
- * @function:
- * FT_Stroker_GetCounts
- *
- * @description:
- * Call this function once you have finished parsing your paths
- * with the stroker. It returns the number of points and
- * contours necessary to export all points/borders from the stroked
- * outline/path.
- *
- * @input:
- * stroker ::
- * The target stroker handle.
- *
- * @output:
- * anum_points ::
- * The number of points.
- *
- * anum_contours ::
- * The number of contours.
- *
- * @return:
- * FreeType error code. 0~means success.
- */
- FT_EXPORT( FT_Error )
- FT_Stroker_GetCounts( FT_Stroker stroker,
- FT_UInt *anum_points,
- FT_UInt *anum_contours );
-
-
- /**************************************************************
- *
- * @function:
- * FT_Stroker_Export
- *
- * @description:
- * Call this function after @FT_Stroker_GetBorderCounts to
- * export all borders to your own @FT_Outline structure.
- *
- * Note that this function appends the border points and
- * contours to your outline, but does not try to resize its
- * arrays.
- *
- * @input:
- * stroker ::
- * The target stroker handle.
- *
- * outline ::
- * The target outline handle.
- */
- FT_EXPORT( void )
- FT_Stroker_Export( FT_Stroker stroker,
- FT_Outline* outline );
-
-
- /**************************************************************
- *
- * @function:
- * FT_Stroker_Done
- *
- * @description:
- * Destroy a stroker object.
- *
- * @input:
- * stroker ::
- * A stroker handle. Can be NULL.
- */
- FT_EXPORT( void )
- FT_Stroker_Done( FT_Stroker stroker );
-
-
- /**************************************************************
- *
- * @function:
- * FT_Glyph_Stroke
- *
- * @description:
- * Stroke a given outline glyph object with a given stroker.
- *
- * @inout:
- * pglyph ::
- * Source glyph handle on input, new glyph handle on output.
- *
- * @input:
- * stroker ::
- * A stroker handle.
- *
- * destroy ::
- * A Boolean. If~1, the source glyph object is destroyed
- * on success.
- *
- * @return:
- * FreeType error code. 0~means success.
- *
- * @note:
- * The source glyph is untouched in case of error.
- *
- * Adding stroke may yield a significantly wider and taller glyph
- * depending on how large of a radius was used to stroke the glyph. You
- * may need to manually adjust horizontal and vertical advance amounts
- * to account for this added size.
- */
- FT_EXPORT( FT_Error )
- FT_Glyph_Stroke( FT_Glyph *pglyph,
- FT_Stroker stroker,
- FT_Bool destroy );
-
-
- /**************************************************************
- *
- * @function:
- * FT_Glyph_StrokeBorder
- *
- * @description:
- * Stroke a given outline glyph object with a given stroker, but
- * only return either its inside or outside border.
- *
- * @inout:
- * pglyph ::
- * Source glyph handle on input, new glyph handle on output.
- *
- * @input:
- * stroker ::
- * A stroker handle.
- *
- * inside ::
- * A Boolean. If~1, return the inside border, otherwise
- * the outside border.
- *
- * destroy ::
- * A Boolean. If~1, the source glyph object is destroyed
- * on success.
- *
- * @return:
- * FreeType error code. 0~means success.
- *
- * @note:
- * The source glyph is untouched in case of error.
- *
- * Adding stroke may yield a significantly wider and taller glyph
- * depending on how large of a radius was used to stroke the glyph. You
- * may need to manually adjust horizontal and vertical advance amounts
- * to account for this added size.
- */
- FT_EXPORT( FT_Error )
- FT_Glyph_StrokeBorder( FT_Glyph *pglyph,
- FT_Stroker stroker,
- FT_Bool inside,
- FT_Bool destroy );
-
- /* */
-
-FT_END_HEADER
-
-#endif /* __FT_STROKE_H__ */
-
-
-/* END */
-
-
-/* Local Variables: */
-/* coding: utf-8 */
-/* End: */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftsynth.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftsynth.h
deleted file mode 100644
index fbcbad871a9..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftsynth.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftsynth.h */
-/* */
-/* FreeType synthesizing code for emboldening and slanting */
-/* (specification). */
-/* */
-/* Copyright 2000-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
- /********* *********/
- /********* WARNING, THIS IS ALPHA CODE! THIS API *********/
- /********* IS DUE TO CHANGE UNTIL STRICTLY NOTIFIED BY THE *********/
- /********* FREETYPE DEVELOPMENT TEAM *********/
- /********* *********/
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
-
-
- /* Main reason for not lifting the functions in this module to a */
- /* `standard' API is that the used parameters for emboldening and */
- /* slanting are not configurable. Consider the functions as a */
- /* code resource that should be copied into the application and */
- /* adapted to the particular needs. */
-
-
-#ifndef __FTSYNTH_H__
-#define __FTSYNTH_H__
-
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-
-#ifdef FREETYPE_H
-#error "freetype.h of FreeType 1 has been loaded!"
-#error "Please fix the directory search order for header files"
-#error "so that freetype.h of FreeType 2 is found first."
-#endif
-
-
-FT_BEGIN_HEADER
-
- /* Embolden a glyph by a `reasonable' value (which is highly a matter of */
- /* taste). This function is actually a convenience function, providing */
- /* a wrapper for @FT_Outline_Embolden and @FT_Bitmap_Embolden. */
- /* */
- /* For emboldened outlines the height, width, and advance metrics are */
- /* increased by the strength of the emboldening -- this even affects */
- /* mono-width fonts! */
- /* */
- /* You can also call @FT_Outline_Get_CBox to get precise values. */
- FT_EXPORT( void )
- FT_GlyphSlot_Embolden( FT_GlyphSlot slot );
-
- /* Slant an outline glyph to the right by about 12 degrees. */
- FT_EXPORT( void )
- FT_GlyphSlot_Oblique( FT_GlyphSlot slot );
-
- /* */
-
-
-FT_END_HEADER
-
-#endif /* __FTSYNTH_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftsystem.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftsystem.h
deleted file mode 100644
index 2bc999910b4..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftsystem.h
+++ /dev/null
@@ -1,355 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftsystem.h */
-/* */
-/* FreeType low-level system interface definition (specification). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __FTSYSTEM_H__
-#define __FTSYSTEM_H__
-
-
-#include <ft2build.h>
-
-
-FT_BEGIN_HEADER
-
-
- /*************************************************************************/
- /* */
- /* <Section> */
- /* system_interface */
- /* */
- /* <Title> */
- /* System Interface */
- /* */
- /* <Abstract> */
- /* How FreeType manages memory and i/o. */
- /* */
- /* <Description> */
- /* This section contains various definitions related to memory */
- /* management and i/o access. You need to understand this */
- /* information if you want to use a custom memory manager or you own */
- /* i/o streams. */
- /* */
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* M E M O R Y M A N A G E M E N T */
- /* */
- /*************************************************************************/
-
-
- /*************************************************************************
- *
- * @type:
- * FT_Memory
- *
- * @description:
- * A handle to a given memory manager object, defined with an
- * @FT_MemoryRec structure.
- *
- */
- typedef struct FT_MemoryRec_* FT_Memory;
-
-
- /*************************************************************************
- *
- * @functype:
- * FT_Alloc_Func
- *
- * @description:
- * A function used to allocate `size' bytes from `memory'.
- *
- * @input:
- * memory ::
- * A handle to the source memory manager.
- *
- * size ::
- * The size in bytes to allocate.
- *
- * @return:
- * Address of new memory block. 0~in case of failure.
- *
- */
- typedef void*
- (*FT_Alloc_Func)( FT_Memory memory,
- long size );
-
-
- /*************************************************************************
- *
- * @functype:
- * FT_Free_Func
- *
- * @description:
- * A function used to release a given block of memory.
- *
- * @input:
- * memory ::
- * A handle to the source memory manager.
- *
- * block ::
- * The address of the target memory block.
- *
- */
- typedef void
- (*FT_Free_Func)( FT_Memory memory,
- void* block );
-
-
- /*************************************************************************
- *
- * @functype:
- * FT_Realloc_Func
- *
- * @description:
- * A function used to re-allocate a given block of memory.
- *
- * @input:
- * memory ::
- * A handle to the source memory manager.
- *
- * cur_size ::
- * The block's current size in bytes.
- *
- * new_size ::
- * The block's requested new size.
- *
- * block ::
- * The block's current address.
- *
- * @return:
- * New block address. 0~in case of memory shortage.
- *
- * @note:
- * In case of error, the old block must still be available.
- *
- */
- typedef void*
- (*FT_Realloc_Func)( FT_Memory memory,
- long cur_size,
- long new_size,
- void* block );
-
-
- /*************************************************************************
- *
- * @struct:
- * FT_MemoryRec
- *
- * @description:
- * A structure used to describe a given memory manager to FreeType~2.
- *
- * @fields:
- * user ::
- * A generic typeless pointer for user data.
- *
- * alloc ::
- * A pointer type to an allocation function.
- *
- * free ::
- * A pointer type to an memory freeing function.
- *
- * realloc ::
- * A pointer type to a reallocation function.
- *
- */
- struct FT_MemoryRec_
- {
- void* user;
- FT_Alloc_Func alloc;
- FT_Free_Func free;
- FT_Realloc_Func realloc;
- };
-
-
- /*************************************************************************/
- /* */
- /* I / O M A N A G E M E N T */
- /* */
- /*************************************************************************/
-
-
- /*************************************************************************
- *
- * @type:
- * FT_Stream
- *
- * @description:
- * A handle to an input stream.
- *
- * @also:
- * See @FT_StreamRec for the publicly accessible fields of a given
- * stream object.
- *
- */
- typedef struct FT_StreamRec_* FT_Stream;
-
-
- /*************************************************************************
- *
- * @struct:
- * FT_StreamDesc
- *
- * @description:
- * A union type used to store either a long or a pointer. This is used
- * to store a file descriptor or a `FILE*' in an input stream.
- *
- */
- typedef union FT_StreamDesc_
- {
- long value;
- void* pointer;
-
- } FT_StreamDesc;
-
-
- /*************************************************************************
- *
- * @functype:
- * FT_Stream_IoFunc
- *
- * @description:
- * A function used to seek and read data from a given input stream.
- *
- * @input:
- * stream ::
- * A handle to the source stream.
- *
- * offset ::
- * The offset of read in stream (always from start).
- *
- * buffer ::
- * The address of the read buffer.
- *
- * count ::
- * The number of bytes to read from the stream.
- *
- * @return:
- * The number of bytes effectively read by the stream.
- *
- * @note:
- * This function might be called to perform a seek or skip operation
- * with a `count' of~0. A non-zero return value then indicates an
- * error.
- *
- */
- typedef unsigned long
- (*FT_Stream_IoFunc)( FT_Stream stream,
- unsigned long offset,
- unsigned char* buffer,
- unsigned long count );
-
-
- /*************************************************************************
- *
- * @functype:
- * FT_Stream_CloseFunc
- *
- * @description:
- * A function used to close a given input stream.
- *
- * @input:
- * stream ::
- * A handle to the target stream.
- *
- */
- typedef void
- (*FT_Stream_CloseFunc)( FT_Stream stream );
-
-
- /*************************************************************************
- *
- * @struct:
- * FT_StreamRec
- *
- * @description:
- * A structure used to describe an input stream.
- *
- * @input:
- * base ::
- * For memory-based streams, this is the address of the first stream
- * byte in memory. This field should always be set to NULL for
- * disk-based streams.
- *
- * size ::
- * The stream size in bytes.
- *
- * In case of compressed streams where the size is unknown before
- * actually doing the decompression, the value is set to 0x7FFFFFFF.
- * (Note that this size value can occur for normal streams also; it is
- * thus just a hint.)
- *
- * pos ::
- * The current position within the stream.
- *
- * descriptor ::
- * This field is a union that can hold an integer or a pointer. It is
- * used by stream implementations to store file descriptors or `FILE*'
- * pointers.
- *
- * pathname ::
- * This field is completely ignored by FreeType. However, it is often
- * useful during debugging to use it to store the stream's filename
- * (where available).
- *
- * read ::
- * The stream's input function.
- *
- * close ::
- * The stream's close function.
- *
- * memory ::
- * The memory manager to use to preload frames. This is set
- * internally by FreeType and shouldn't be touched by stream
- * implementations.
- *
- * cursor ::
- * This field is set and used internally by FreeType when parsing
- * frames.
- *
- * limit ::
- * This field is set and used internally by FreeType when parsing
- * frames.
- *
- */
- typedef struct FT_StreamRec_
- {
- unsigned char* base;
- unsigned long size;
- unsigned long pos;
-
- FT_StreamDesc descriptor;
- FT_StreamDesc pathname;
- FT_Stream_IoFunc read;
- FT_Stream_CloseFunc close;
-
- FT_Memory memory;
- unsigned char* cursor;
- unsigned char* limit;
-
- } FT_StreamRec;
-
- /* */
-
-
-FT_END_HEADER
-
-#endif /* __FTSYSTEM_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/fttrigon.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/fttrigon.h
deleted file mode 100644
index 485ec515874..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/fttrigon.h
+++ /dev/null
@@ -1,350 +0,0 @@
-/***************************************************************************/
-/* */
-/* fttrigon.h */
-/* */
-/* FreeType trigonometric functions (specification). */
-/* */
-/* Copyright 2001-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __FTTRIGON_H__
-#define __FTTRIGON_H__
-
-#include FT_FREETYPE_H
-
-#ifdef FREETYPE_H
-#error "freetype.h of FreeType 1 has been loaded!"
-#error "Please fix the directory search order for header files"
-#error "so that freetype.h of FreeType 2 is found first."
-#endif
-
-
-FT_BEGIN_HEADER
-
-
- /*************************************************************************/
- /* */
- /* <Section> */
- /* computations */
- /* */
- /*************************************************************************/
-
-
- /*************************************************************************
- *
- * @type:
- * FT_Angle
- *
- * @description:
- * This type is used to model angle values in FreeType. Note that the
- * angle is a 16.16 fixed-point value expressed in degrees.
- *
- */
- typedef FT_Fixed FT_Angle;
-
-
- /*************************************************************************
- *
- * @macro:
- * FT_ANGLE_PI
- *
- * @description:
- * The angle pi expressed in @FT_Angle units.
- *
- */
-#define FT_ANGLE_PI ( 180L << 16 )
-
-
- /*************************************************************************
- *
- * @macro:
- * FT_ANGLE_2PI
- *
- * @description:
- * The angle 2*pi expressed in @FT_Angle units.
- *
- */
-#define FT_ANGLE_2PI ( FT_ANGLE_PI * 2 )
-
-
- /*************************************************************************
- *
- * @macro:
- * FT_ANGLE_PI2
- *
- * @description:
- * The angle pi/2 expressed in @FT_Angle units.
- *
- */
-#define FT_ANGLE_PI2 ( FT_ANGLE_PI / 2 )
-
-
- /*************************************************************************
- *
- * @macro:
- * FT_ANGLE_PI4
- *
- * @description:
- * The angle pi/4 expressed in @FT_Angle units.
- *
- */
-#define FT_ANGLE_PI4 ( FT_ANGLE_PI / 4 )
-
-
- /*************************************************************************
- *
- * @function:
- * FT_Sin
- *
- * @description:
- * Return the sinus of a given angle in fixed-point format.
- *
- * @input:
- * angle ::
- * The input angle.
- *
- * @return:
- * The sinus value.
- *
- * @note:
- * If you need both the sinus and cosinus for a given angle, use the
- * function @FT_Vector_Unit.
- *
- */
- FT_EXPORT( FT_Fixed )
- FT_Sin( FT_Angle angle );
-
-
- /*************************************************************************
- *
- * @function:
- * FT_Cos
- *
- * @description:
- * Return the cosinus of a given angle in fixed-point format.
- *
- * @input:
- * angle ::
- * The input angle.
- *
- * @return:
- * The cosinus value.
- *
- * @note:
- * If you need both the sinus and cosinus for a given angle, use the
- * function @FT_Vector_Unit.
- *
- */
- FT_EXPORT( FT_Fixed )
- FT_Cos( FT_Angle angle );
-
-
- /*************************************************************************
- *
- * @function:
- * FT_Tan
- *
- * @description:
- * Return the tangent of a given angle in fixed-point format.
- *
- * @input:
- * angle ::
- * The input angle.
- *
- * @return:
- * The tangent value.
- *
- */
- FT_EXPORT( FT_Fixed )
- FT_Tan( FT_Angle angle );
-
-
- /*************************************************************************
- *
- * @function:
- * FT_Atan2
- *
- * @description:
- * Return the arc-tangent corresponding to a given vector (x,y) in
- * the 2d plane.
- *
- * @input:
- * x ::
- * The horizontal vector coordinate.
- *
- * y ::
- * The vertical vector coordinate.
- *
- * @return:
- * The arc-tangent value (i.e. angle).
- *
- */
- FT_EXPORT( FT_Angle )
- FT_Atan2( FT_Fixed x,
- FT_Fixed y );
-
-
- /*************************************************************************
- *
- * @function:
- * FT_Angle_Diff
- *
- * @description:
- * Return the difference between two angles. The result is always
- * constrained to the ]-PI..PI] interval.
- *
- * @input:
- * angle1 ::
- * First angle.
- *
- * angle2 ::
- * Second angle.
- *
- * @return:
- * Constrained value of `value2-value1'.
- *
- */
- FT_EXPORT( FT_Angle )
- FT_Angle_Diff( FT_Angle angle1,
- FT_Angle angle2 );
-
-
- /*************************************************************************
- *
- * @function:
- * FT_Vector_Unit
- *
- * @description:
- * Return the unit vector corresponding to a given angle. After the
- * call, the value of `vec.x' will be `cos(angle)', and the value of
- * `vec.y' will be `sin(angle)'.
- *
- * This function is useful to retrieve both the sinus and cosinus of a
- * given angle quickly.
- *
- * @output:
- * vec ::
- * The address of target vector.
- *
- * @input:
- * angle ::
- * The input angle.
- *
- */
- FT_EXPORT( void )
- FT_Vector_Unit( FT_Vector* vec,
- FT_Angle angle );
-
-
- /*************************************************************************
- *
- * @function:
- * FT_Vector_Rotate
- *
- * @description:
- * Rotate a vector by a given angle.
- *
- * @inout:
- * vec ::
- * The address of target vector.
- *
- * @input:
- * angle ::
- * The input angle.
- *
- */
- FT_EXPORT( void )
- FT_Vector_Rotate( FT_Vector* vec,
- FT_Angle angle );
-
-
- /*************************************************************************
- *
- * @function:
- * FT_Vector_Length
- *
- * @description:
- * Return the length of a given vector.
- *
- * @input:
- * vec ::
- * The address of target vector.
- *
- * @return:
- * The vector length, expressed in the same units that the original
- * vector coordinates.
- *
- */
- FT_EXPORT( FT_Fixed )
- FT_Vector_Length( FT_Vector* vec );
-
-
- /*************************************************************************
- *
- * @function:
- * FT_Vector_Polarize
- *
- * @description:
- * Compute both the length and angle of a given vector.
- *
- * @input:
- * vec ::
- * The address of source vector.
- *
- * @output:
- * length ::
- * The vector length.
- *
- * angle ::
- * The vector angle.
- *
- */
- FT_EXPORT( void )
- FT_Vector_Polarize( FT_Vector* vec,
- FT_Fixed *length,
- FT_Angle *angle );
-
-
- /*************************************************************************
- *
- * @function:
- * FT_Vector_From_Polar
- *
- * @description:
- * Compute vector coordinates from a length and angle.
- *
- * @output:
- * vec ::
- * The address of source vector.
- *
- * @input:
- * length ::
- * The vector length.
- *
- * angle ::
- * The vector angle.
- *
- */
- FT_EXPORT( void )
- FT_Vector_From_Polar( FT_Vector* vec,
- FT_Fixed length,
- FT_Angle angle );
-
- /* */
-
-
-FT_END_HEADER
-
-#endif /* __FTTRIGON_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftttdrv.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftttdrv.h
deleted file mode 100644
index dc0081a0b96..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftttdrv.h
+++ /dev/null
@@ -1,310 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftttdrv.h */
-/* */
-/* FreeType API for controlling the TrueType driver */
-/* (specification only). */
-/* */
-/* Copyright 2013-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __FTTTDRV_H__
-#define __FTTTDRV_H__
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-
-#ifdef FREETYPE_H
-#error "freetype.h of FreeType 1 has been loaded!"
-#error "Please fix the directory search order for header files"
-#error "so that freetype.h of FreeType 2 is found first."
-#endif
-
-
-FT_BEGIN_HEADER
-
-
- /**************************************************************************
- *
- * @section:
- * tt_driver
- *
- * @title:
- * The TrueType driver
- *
- * @abstract:
- * Controlling the TrueType driver module.
- *
- * @description:
- * While FreeType's TrueType driver doesn't expose API functions by
- * itself, it is possible to control its behaviour with @FT_Property_Set
- * and @FT_Property_Get. The following lists the available properties
- * together with the necessary macros and structures.
- *
- * The TrueType driver's module name is `truetype'.
- *
- * We start with a list of definitions, kindly provided by Greg
- * Hitchcock.
- *
- * _Bi-Level_ _Rendering_
- *
- * Monochromatic rendering, exclusively used in the early days of
- * TrueType by both Apple and Microsoft. Microsoft's GDI interface
- * supported hinting of the right-side bearing point, such that the
- * advance width could be non-linear. Most often this was done to
- * achieve some level of glyph symmetry. To enable reasonable
- * performance (e.g., not having to run hinting on all glyphs just to
- * get the widths) there was a bit in the head table indicating if the
- * side bearing was hinted, and additional tables, `hdmx' and `LTSH', to
- * cache hinting widths across multiple sizes and device aspect ratios.
- *
- * _Font_ _Smoothing_
- *
- * Microsoft's GDI implementation of anti-aliasing. Not traditional
- * anti-aliasing as the outlines were hinted before the sampling. The
- * widths matched the bi-level rendering.
- *
- * _ClearType_ _Rendering_
- *
- * Technique that uses physical subpixels to improve rendering on LCD
- * (and other) displays. Because of the higher resolution, many methods
- * of improving symmetry in glyphs through hinting the right-side
- * bearing were no longer necessary. This lead to what GDI calls
- * `natural widths' ClearType, see
- * http://www.beatstamm.com/typography/RTRCh4.htm#Sec21. Since hinting
- * has extra resolution, most non-linearity went away, but it is still
- * possible for hints to change the advance widths in this mode.
- *
- * _ClearType_ _Compatible_ _Widths_
- *
- * One of the earliest challenges with ClearType was allowing the
- * implementation in GDI to be selected without requiring all UI and
- * documents to reflow. To address this, a compatible method of
- * rendering ClearType was added where the font hints are executed once
- * to determine the width in bi-level rendering, and then re-run in
- * ClearType, with the difference in widths being absorbed in the font
- * hints for ClearType (mostly in the white space of hints); see
- * http://www.beatstamm.com/typography/RTRCh4.htm#Sec20. Somewhat by
- * definition, compatible width ClearType allows for non-linear widths,
- * but only when the bi-level version has non-linear widths.
- *
- * _ClearType_ _Subpixel_ _Positioning_
- *
- * One of the nice benefits of ClearType is the ability to more crisply
- * display fractional widths; unfortunately, the GDI model of integer
- * bitmaps did not support this. However, the WPF and Direct Write
- * frameworks do support fractional widths. DWrite calls this `natural
- * mode', not to be confused with GDI's `natural widths'. Subpixel
- * positioning, in the current implementation of Direct Write,
- * unfortunately does not support hinted advance widths, see
- * http://www.beatstamm.com/typography/RTRCh4.htm#Sec22. Note that the
- * TrueType interpreter fully allows the advance width to be adjusted in
- * this mode, just the DWrite client will ignore those changes.
- *
- * _ClearType_ _Backwards_ _Compatibility_
- *
- * This is a set of exceptions made in the TrueType interpreter to
- * minimize hinting techniques that were problematic with the extra
- * resolution of ClearType; see
- * http://www.beatstamm.com/typography/RTRCh4.htm#Sec1 and
- * http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx.
- * This technique is not to be confused with ClearType compatible
- * widths. ClearType backwards compatibility has no direct impact on
- * changing advance widths, but there might be an indirect impact on
- * disabling some deltas. This could be worked around in backwards
- * compatibility mode.
- *
- * _Native_ _ClearType_ _Mode_
- *
- * (Not to be confused with `natural widths'.) This mode removes all
- * the exceptions in the TrueType interpreter when running with
- * ClearType. Any issues on widths would still apply, though.
- *
- */
-
-
- /**************************************************************************
- *
- * @property:
- * interpreter-version
- *
- * @description:
- * Currently, two versions are available, representing the bytecode
- * interpreter with and without subpixel hinting support,
- * respectively. The default is subpixel support if
- * TT_CONFIG_OPTION_SUBPIXEL_HINTING is defined, and no subpixel
- * support otherwise (since it isn't available then).
- *
- * If subpixel hinting is on, many TrueType bytecode instructions behave
- * differently compared to B/W or grayscale rendering (except if `native
- * ClearType' is selected by the font). The main idea is to render at a
- * much increased horizontal resolution, then sampling down the created
- * output to subpixel precision. However, many older fonts are not
- * suited to this and must be specially taken care of by applying
- * (hardcoded) font-specific tweaks.
- *
- * Details on subpixel hinting and some of the necessary tweaks can be
- * found in Greg Hitchcock's whitepaper at
- * `http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx'.
- *
- * The following example code demonstrates how to activate subpixel
- * hinting (omitting the error handling).
- *
- * {
- * FT_Library library;
- * FT_Face face;
- * FT_UInt interpreter_version = TT_INTERPRETER_VERSION_38;
- *
- *
- * FT_Init_FreeType( &library );
- *
- * FT_Property_Set( library, "truetype",
- * "interpreter-version",
- * &interpreter_version );
- * }
- *
- * @note:
- * This property can be used with @FT_Property_Get also.
- *
- */
-
-
- /**************************************************************************
- *
- * @enum:
- * TT_INTERPRETER_VERSION_XXX
- *
- * @description:
- * A list of constants used for the @interpreter-version property to
- * select the hinting engine for Truetype fonts.
- *
- * The numeric value in the constant names represents the version
- * number as returned by the `GETINFO' bytecode instruction.
- *
- * @values:
- * TT_INTERPRETER_VERSION_35 ::
- * Version~35 corresponds to MS rasterizer v.1.7 as used e.g. in
- * Windows~98; only grayscale and B/W rasterizing is supported.
- *
- * TT_INTERPRETER_VERSION_38 ::
- * Version~38 corresponds to MS rasterizer v.1.9; it is roughly
- * equivalent to the hinting provided by DirectWrite ClearType (as
- * can be found, for example, in the Internet Explorer~9 running on
- * Windows~7).
- *
- * @note:
- * This property controls the behaviour of the bytecode interpreter
- * and thus how outlines get hinted. It does *not* control how glyph
- * get rasterized! In particular, it does not control subpixel color
- * filtering.
- *
- * If FreeType has not been compiled with configuration option
- * FT_CONFIG_OPTION_SUBPIXEL_HINTING, selecting version~38 causes an
- * `FT_Err_Unimplemented_Feature' error.
- *
- * Depending on the graphics framework, Microsoft uses different
- * bytecode and rendering engines. As a consequence, the version
- * numbers returned by a call to the `GETINFO' bytecode instruction are
- * more convoluted than desired.
- *
- * Here are two tables that try to shed some light on the possible
- * values for the MS rasterizer engine, together with the additional
- * features introduced by it.
- *
- * {
- * GETINFO framework version feature
- * -------------------------------------------------------------------
- * 3 GDI (Win 3.1), v1.0 16-bit, first version
- * TrueImage
- * 33 GDI (Win NT 3.1), v1.5 32-bit
- * HP Laserjet
- * 34 GDI (Win 95) v1.6 font smoothing,
- * new SCANTYPE opcode
- * 35 GDI (Win 98/2000) v1.7 (UN)SCALED_COMPONENT_OFFSET
- * bits in composite glyphs
- * 36 MGDI (Win CE 2) v1.6+ classic ClearType
- * 37 GDI (XP and later), v1.8 ClearType
- * GDI+ old (before Vista)
- * 38 GDI+ old (Vista, Win 7), v1.9 subpixel ClearType,
- * WPF Y-direction ClearType,
- * additional error checking
- * 39 DWrite (before Win 8) v2.0 subpixel ClearType flags
- * in GETINFO opcode,
- * bug fixes
- * 40 GDI+ (after Win 7), v2.1 Y-direction ClearType flag
- * DWrite (Win 8) in GETINFO opcode,
- * Gray ClearType
- * }
- *
- * The `version' field gives a rough orientation only, since some
- * applications provided certain features much earlier (as an example,
- * Microsoft Reader used subpixel and Y-direction ClearType already in
- * Windows 2000). Similarly, updates to a given framework might include
- * improved hinting support.
- *
- * {
- * version sampling rendering comment
- * x y x y
- * --------------------------------------------------------------
- * v1.0 normal normal B/W B/W bi-level
- * v1.6 high high gray gray grayscale
- * v1.8 high normal color-filter B/W (GDI) ClearType
- * v1.9 high high color-filter gray Color ClearType
- * v2.1 high normal gray B/W Gray ClearType
- * v2.1 high high gray gray Gray ClearType
- * }
- *
- * Color and Gray ClearType are the two available variants of
- * `Y-direction ClearType', meaning grayscale rasterization along the
- * Y-direction; the name used in the TrueType specification for this
- * feature is `symmetric smoothing'. `Classic ClearType' is the
- * original algorithm used before introducing a modified version in
- * Win~XP. Another name for v1.6's grayscale rendering is `font
- * smoothing', and `Color ClearType' is sometimes also called `DWrite
- * ClearType'. To differentiate between today's Color ClearType and the
- * earlier ClearType variant with B/W rendering along the vertical axis,
- * the latter is sometimes called `GDI ClearType'.
- *
- * `Normal' and `high' sampling describe the (virtual) resolution to
- * access the rasterized outline after the hinting process. `Normal'
- * means 1 sample per grid line (i.e., B/W). In the current Microsoft
- * implementation, `high' means an extra virtual resolution of 16x16 (or
- * 16x1) grid lines per pixel for bytecode instructions like `MIRP'.
- * After hinting, these 16 grid lines are mapped to 6x5 (or 6x1) grid
- * lines for color filtering if Color ClearType is activated.
- *
- * Note that `Gray ClearType' is essentially the same as v1.6's
- * grayscale rendering. However, the GETINFO instruction handles it
- * differently: v1.6 returns bit~12 (hinting for grayscale), while v2.1
- * returns bits~13 (hinting for ClearType), 18 (symmetrical smoothing),
- * and~19 (Gray ClearType). Also, this mode respects bits 2 and~3 for
- * the version~1 gasp table exclusively (like Color ClearType), while
- * v1.6 only respects the values of version~0 (bits 0 and~1).
- *
- * FreeType doesn't provide all capabilities of the most recent
- * ClearType incarnation, thus we identify our subpixel support as
- * version~38.
- *
- */
-#define TT_INTERPRETER_VERSION_35 35
-#define TT_INTERPRETER_VERSION_38 38
-
- /* */
-
-
-FT_END_HEADER
-
-
-#endif /* __FTTTDRV_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/fttypes.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/fttypes.h
deleted file mode 100644
index 706a1be4ef9..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/fttypes.h
+++ /dev/null
@@ -1,602 +0,0 @@
-/***************************************************************************/
-/* */
-/* fttypes.h */
-/* */
-/* FreeType simple types definitions (specification only). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __FTTYPES_H__
-#define __FTTYPES_H__
-
-
-#include <ft2build.h>
-#include FT_CONFIG_CONFIG_H
-#include FT_SYSTEM_H
-#include FT_IMAGE_H
-
-#include <stddef.h>
-
-
-FT_BEGIN_HEADER
-
-
- /*************************************************************************/
- /* */
- /* <Section> */
- /* basic_types */
- /* */
- /* <Title> */
- /* Basic Data Types */
- /* */
- /* <Abstract> */
- /* The basic data types defined by the library. */
- /* */
- /* <Description> */
- /* This section contains the basic data types defined by FreeType~2, */
- /* ranging from simple scalar types to bitmap descriptors. More */
- /* font-specific structures are defined in a different section. */
- /* */
- /* <Order> */
- /* FT_Byte */
- /* FT_Bytes */
- /* FT_Char */
- /* FT_Int */
- /* FT_UInt */
- /* FT_Int16 */
- /* FT_UInt16 */
- /* FT_Int32 */
- /* FT_UInt32 */
- /* FT_Int64 */
- /* FT_UInt64 */
- /* FT_Short */
- /* FT_UShort */
- /* FT_Long */
- /* FT_ULong */
- /* FT_Bool */
- /* FT_Offset */
- /* FT_PtrDist */
- /* FT_String */
- /* FT_Tag */
- /* FT_Error */
- /* FT_Fixed */
- /* FT_Pointer */
- /* FT_Pos */
- /* FT_Vector */
- /* FT_BBox */
- /* FT_Matrix */
- /* FT_FWord */
- /* FT_UFWord */
- /* FT_F2Dot14 */
- /* FT_UnitVector */
- /* FT_F26Dot6 */
- /* FT_Data */
- /* */
- /* FT_MAKE_TAG */
- /* */
- /* FT_Generic */
- /* FT_Generic_Finalizer */
- /* */
- /* FT_Bitmap */
- /* FT_Pixel_Mode */
- /* FT_Palette_Mode */
- /* FT_Glyph_Format */
- /* FT_IMAGE_TAG */
- /* */
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* FT_Bool */
- /* */
- /* <Description> */
- /* A typedef of unsigned char, used for simple booleans. As usual, */
- /* values 1 and~0 represent true and false, respectively. */
- /* */
- typedef unsigned char FT_Bool;
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* FT_FWord */
- /* */
- /* <Description> */
- /* A signed 16-bit integer used to store a distance in original font */
- /* units. */
- /* */
- typedef signed short FT_FWord; /* distance in FUnits */
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* FT_UFWord */
- /* */
- /* <Description> */
- /* An unsigned 16-bit integer used to store a distance in original */
- /* font units. */
- /* */
- typedef unsigned short FT_UFWord; /* unsigned distance */
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* FT_Char */
- /* */
- /* <Description> */
- /* A simple typedef for the _signed_ char type. */
- /* */
- typedef signed char FT_Char;
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* FT_Byte */
- /* */
- /* <Description> */
- /* A simple typedef for the _unsigned_ char type. */
- /* */
- typedef unsigned char FT_Byte;
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* FT_Bytes */
- /* */
- /* <Description> */
- /* A typedef for constant memory areas. */
- /* */
- typedef const FT_Byte* FT_Bytes;
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* FT_Tag */
- /* */
- /* <Description> */
- /* A typedef for 32-bit tags (as used in the SFNT format). */
- /* */
- typedef FT_UInt32 FT_Tag;
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* FT_String */
- /* */
- /* <Description> */
- /* A simple typedef for the char type, usually used for strings. */
- /* */
- typedef char FT_String;
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* FT_Short */
- /* */
- /* <Description> */
- /* A typedef for signed short. */
- /* */
- typedef signed short FT_Short;
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* FT_UShort */
- /* */
- /* <Description> */
- /* A typedef for unsigned short. */
- /* */
- typedef unsigned short FT_UShort;
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* FT_Int */
- /* */
- /* <Description> */
- /* A typedef for the int type. */
- /* */
- typedef signed int FT_Int;
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* FT_UInt */
- /* */
- /* <Description> */
- /* A typedef for the unsigned int type. */
- /* */
- typedef unsigned int FT_UInt;
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* FT_Long */
- /* */
- /* <Description> */
- /* A typedef for signed long. */
- /* */
- typedef signed long FT_Long;
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* FT_ULong */
- /* */
- /* <Description> */
- /* A typedef for unsigned long. */
- /* */
- typedef unsigned long FT_ULong;
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* FT_F2Dot14 */
- /* */
- /* <Description> */
- /* A signed 2.14 fixed-point type used for unit vectors. */
- /* */
- typedef signed short FT_F2Dot14;
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* FT_F26Dot6 */
- /* */
- /* <Description> */
- /* A signed 26.6 fixed-point type used for vectorial pixel */
- /* coordinates. */
- /* */
- typedef signed long FT_F26Dot6;
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* FT_Fixed */
- /* */
- /* <Description> */
- /* This type is used to store 16.16 fixed-point values, like scaling */
- /* values or matrix coefficients. */
- /* */
- typedef signed long FT_Fixed;
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* FT_Error */
- /* */
- /* <Description> */
- /* The FreeType error code type. A value of~0 is always interpreted */
- /* as a successful operation. */
- /* */
- typedef int FT_Error;
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* FT_Pointer */
- /* */
- /* <Description> */
- /* A simple typedef for a typeless pointer. */
- /* */
- typedef void* FT_Pointer;
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* FT_Offset */
- /* */
- /* <Description> */
- /* This is equivalent to the ANSI~C `size_t' type, i.e., the largest */
- /* _unsigned_ integer type used to express a file size or position, */
- /* or a memory block size. */
- /* */
- typedef size_t FT_Offset;
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* FT_PtrDist */
- /* */
- /* <Description> */
- /* This is equivalent to the ANSI~C `ptrdiff_t' type, i.e., the */
- /* largest _signed_ integer type used to express the distance */
- /* between two pointers. */
- /* */
- typedef ft_ptrdiff_t FT_PtrDist;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* FT_UnitVector */
- /* */
- /* <Description> */
- /* A simple structure used to store a 2D vector unit vector. Uses */
- /* FT_F2Dot14 types. */
- /* */
- /* <Fields> */
- /* x :: Horizontal coordinate. */
- /* */
- /* y :: Vertical coordinate. */
- /* */
- typedef struct FT_UnitVector_
- {
- FT_F2Dot14 x;
- FT_F2Dot14 y;
-
- } FT_UnitVector;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* FT_Matrix */
- /* */
- /* <Description> */
- /* A simple structure used to store a 2x2 matrix. Coefficients are */
- /* in 16.16 fixed-point format. The computation performed is: */
- /* */
- /* { */
- /* x' = x*xx + y*xy */
- /* y' = x*yx + y*yy */
- /* } */
- /* */
- /* <Fields> */
- /* xx :: Matrix coefficient. */
- /* */
- /* xy :: Matrix coefficient. */
- /* */
- /* yx :: Matrix coefficient. */
- /* */
- /* yy :: Matrix coefficient. */
- /* */
- typedef struct FT_Matrix_
- {
- FT_Fixed xx, xy;
- FT_Fixed yx, yy;
-
- } FT_Matrix;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* FT_Data */
- /* */
- /* <Description> */
- /* Read-only binary data represented as a pointer and a length. */
- /* */
- /* <Fields> */
- /* pointer :: The data. */
- /* */
- /* length :: The length of the data in bytes. */
- /* */
- typedef struct FT_Data_
- {
- const FT_Byte* pointer;
- FT_Int length;
-
- } FT_Data;
-
-
- /*************************************************************************/
- /* */
- /* <FuncType> */
- /* FT_Generic_Finalizer */
- /* */
- /* <Description> */
- /* Describe a function used to destroy the `client' data of any */
- /* FreeType object. See the description of the @FT_Generic type for */
- /* details of usage. */
- /* */
- /* <Input> */
- /* The address of the FreeType object that is under finalization. */
- /* Its client data is accessed through its `generic' field. */
- /* */
- typedef void (*FT_Generic_Finalizer)(void* object);
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* FT_Generic */
- /* */
- /* <Description> */
- /* Client applications often need to associate their own data to a */
- /* variety of FreeType core objects. For example, a text layout API */
- /* might want to associate a glyph cache to a given size object. */
- /* */
- /* Some FreeType object contains a `generic' field, of type */
- /* FT_Generic, which usage is left to client applications and font */
- /* servers. */
- /* */
- /* It can be used to store a pointer to client-specific data, as well */
- /* as the address of a `finalizer' function, which will be called by */
- /* FreeType when the object is destroyed (for example, the previous */
- /* client example would put the address of the glyph cache destructor */
- /* in the `finalizer' field). */
- /* */
- /* <Fields> */
- /* data :: A typeless pointer to any client-specified data. This */
- /* field is completely ignored by the FreeType library. */
- /* */
- /* finalizer :: A pointer to a `generic finalizer' function, which */
- /* will be called when the object is destroyed. If this */
- /* field is set to NULL, no code will be called. */
- /* */
- typedef struct FT_Generic_
- {
- void* data;
- FT_Generic_Finalizer finalizer;
-
- } FT_Generic;
-
-
- /*************************************************************************/
- /* */
- /* <Macro> */
- /* FT_MAKE_TAG */
- /* */
- /* <Description> */
- /* This macro converts four-letter tags that are used to label */
- /* TrueType tables into an unsigned long, to be used within FreeType. */
- /* */
- /* <Note> */
- /* The produced values *must* be 32-bit integers. Don't redefine */
- /* this macro. */
- /* */
-#define FT_MAKE_TAG( _x1, _x2, _x3, _x4 ) \
- (FT_Tag) \
- ( ( (FT_ULong)_x1 << 24 ) | \
- ( (FT_ULong)_x2 << 16 ) | \
- ( (FT_ULong)_x3 << 8 ) | \
- (FT_ULong)_x4 )
-
-
- /*************************************************************************/
- /*************************************************************************/
- /* */
- /* L I S T M A N A G E M E N T */
- /* */
- /*************************************************************************/
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* <Section> */
- /* list_processing */
- /* */
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* FT_ListNode */
- /* */
- /* <Description> */
- /* Many elements and objects in FreeType are listed through an */
- /* @FT_List record (see @FT_ListRec). As its name suggests, an */
- /* FT_ListNode is a handle to a single list element. */
- /* */
- typedef struct FT_ListNodeRec_* FT_ListNode;
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* FT_List */
- /* */
- /* <Description> */
- /* A handle to a list record (see @FT_ListRec). */
- /* */
- typedef struct FT_ListRec_* FT_List;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* FT_ListNodeRec */
- /* */
- /* <Description> */
- /* A structure used to hold a single list element. */
- /* */
- /* <Fields> */
- /* prev :: The previous element in the list. NULL if first. */
- /* */
- /* next :: The next element in the list. NULL if last. */
- /* */
- /* data :: A typeless pointer to the listed object. */
- /* */
- typedef struct FT_ListNodeRec_
- {
- FT_ListNode prev;
- FT_ListNode next;
- void* data;
-
- } FT_ListNodeRec;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* FT_ListRec */
- /* */
- /* <Description> */
- /* A structure used to hold a simple doubly-linked list. These are */
- /* used in many parts of FreeType. */
- /* */
- /* <Fields> */
- /* head :: The head (first element) of doubly-linked list. */
- /* */
- /* tail :: The tail (last element) of doubly-linked list. */
- /* */
- typedef struct FT_ListRec_
- {
- FT_ListNode head;
- FT_ListNode tail;
-
- } FT_ListRec;
-
- /* */
-
-
-#define FT_IS_EMPTY( list ) ( (list).head == 0 )
-#define FT_BOOL( x ) ( (FT_Bool)( x ) )
-
- /* concatenate C tokens */
-#define FT_ERR_XCAT( x, y ) x ## y
-#define FT_ERR_CAT( x, y ) FT_ERR_XCAT( x, y )
-
- /* see `ftmoderr.h' for descriptions of the following macros */
-
-#define FT_ERR( e ) FT_ERR_CAT( FT_ERR_PREFIX, e )
-
-#define FT_ERROR_BASE( x ) ( (x) & 0xFF )
-#define FT_ERROR_MODULE( x ) ( (x) & 0xFF00U )
-
-#define FT_ERR_EQ( x, e ) \
- ( FT_ERROR_BASE( x ) == FT_ERROR_BASE( FT_ERR( e ) ) )
-#define FT_ERR_NEQ( x, e ) \
- ( FT_ERROR_BASE( x ) != FT_ERROR_BASE( FT_ERR( e ) ) )
-
-
-FT_END_HEADER
-
-#endif /* __FTTYPES_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftwinfnt.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftwinfnt.h
deleted file mode 100644
index caedaa1cc76..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ftwinfnt.h
+++ /dev/null
@@ -1,275 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftwinfnt.h */
-/* */
-/* FreeType API for accessing Windows fnt-specific data. */
-/* */
-/* Copyright 2003-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __FTWINFNT_H__
-#define __FTWINFNT_H__
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-
-#ifdef FREETYPE_H
-#error "freetype.h of FreeType 1 has been loaded!"
-#error "Please fix the directory search order for header files"
-#error "so that freetype.h of FreeType 2 is found first."
-#endif
-
-
-FT_BEGIN_HEADER
-
-
- /*************************************************************************/
- /* */
- /* <Section> */
- /* winfnt_fonts */
- /* */
- /* <Title> */
- /* Window FNT Files */
- /* */
- /* <Abstract> */
- /* Windows FNT specific API. */
- /* */
- /* <Description> */
- /* This section contains the declaration of Windows FNT specific */
- /* functions. */
- /* */
- /*************************************************************************/
-
-
- /*************************************************************************
- *
- * @enum:
- * FT_WinFNT_ID_XXX
- *
- * @description:
- * A list of valid values for the `charset' byte in
- * @FT_WinFNT_HeaderRec. Exact mapping tables for the various cpXXXX
- * encodings (except for cp1361) can be found at
- * ftp://ftp.unicode.org/Public in the MAPPINGS/VENDORS/MICSFT/WINDOWS
- * subdirectory. cp1361 is roughly a superset of
- * MAPPINGS/OBSOLETE/EASTASIA/KSC/JOHAB.TXT.
- *
- * @values:
- * FT_WinFNT_ID_DEFAULT ::
- * This is used for font enumeration and font creation as a
- * `don't care' value. Valid font files don't contain this value.
- * When querying for information about the character set of the font
- * that is currently selected into a specified device context, this
- * return value (of the related Windows API) simply denotes failure.
- *
- * FT_WinFNT_ID_SYMBOL ::
- * There is no known mapping table available.
- *
- * FT_WinFNT_ID_MAC ::
- * Mac Roman encoding.
- *
- * FT_WinFNT_ID_OEM ::
- * From Michael Pöttgen <michael@poettgen.de>:
- *
- * The `Windows Font Mapping' article says that FT_WinFNT_ID_OEM
- * is used for the charset of vector fonts, like `modern.fon',
- * `roman.fon', and `script.fon' on Windows.
- *
- * The `CreateFont' documentation says: The FT_WinFNT_ID_OEM value
- * specifies a character set that is operating-system dependent.
- *
- * The `IFIMETRICS' documentation from the `Windows Driver
- * Development Kit' says: This font supports an OEM-specific
- * character set. The OEM character set is system dependent.
- *
- * In general OEM, as opposed to ANSI (i.e., cp1252), denotes the
- * second default codepage that most international versions of
- * Windows have. It is one of the OEM codepages from
- *
- * https://msdn.microsoft.com/en-us/goglobal/bb964655,
- *
- * and is used for the `DOS boxes', to support legacy applications.
- * A German Windows version for example usually uses ANSI codepage
- * 1252 and OEM codepage 850.
- *
- * FT_WinFNT_ID_CP874 ::
- * A superset of Thai TIS 620 and ISO 8859-11.
- *
- * FT_WinFNT_ID_CP932 ::
- * A superset of Japanese Shift-JIS (with minor deviations).
- *
- * FT_WinFNT_ID_CP936 ::
- * A superset of simplified Chinese GB 2312-1980 (with different
- * ordering and minor deviations).
- *
- * FT_WinFNT_ID_CP949 ::
- * A superset of Korean Hangul KS~C 5601-1987 (with different
- * ordering and minor deviations).
- *
- * FT_WinFNT_ID_CP950 ::
- * A superset of traditional Chinese Big~5 ETen (with different
- * ordering and minor deviations).
- *
- * FT_WinFNT_ID_CP1250 ::
- * A superset of East European ISO 8859-2 (with slightly different
- * ordering).
- *
- * FT_WinFNT_ID_CP1251 ::
- * A superset of Russian ISO 8859-5 (with different ordering).
- *
- * FT_WinFNT_ID_CP1252 ::
- * ANSI encoding. A superset of ISO 8859-1.
- *
- * FT_WinFNT_ID_CP1253 ::
- * A superset of Greek ISO 8859-7 (with minor modifications).
- *
- * FT_WinFNT_ID_CP1254 ::
- * A superset of Turkish ISO 8859-9.
- *
- * FT_WinFNT_ID_CP1255 ::
- * A superset of Hebrew ISO 8859-8 (with some modifications).
- *
- * FT_WinFNT_ID_CP1256 ::
- * A superset of Arabic ISO 8859-6 (with different ordering).
- *
- * FT_WinFNT_ID_CP1257 ::
- * A superset of Baltic ISO 8859-13 (with some deviations).
- *
- * FT_WinFNT_ID_CP1258 ::
- * For Vietnamese. This encoding doesn't cover all necessary
- * characters.
- *
- * FT_WinFNT_ID_CP1361 ::
- * Korean (Johab).
- */
-
-#define FT_WinFNT_ID_CP1252 0
-#define FT_WinFNT_ID_DEFAULT 1
-#define FT_WinFNT_ID_SYMBOL 2
-#define FT_WinFNT_ID_MAC 77
-#define FT_WinFNT_ID_CP932 128
-#define FT_WinFNT_ID_CP949 129
-#define FT_WinFNT_ID_CP1361 130
-#define FT_WinFNT_ID_CP936 134
-#define FT_WinFNT_ID_CP950 136
-#define FT_WinFNT_ID_CP1253 161
-#define FT_WinFNT_ID_CP1254 162
-#define FT_WinFNT_ID_CP1258 163
-#define FT_WinFNT_ID_CP1255 177
-#define FT_WinFNT_ID_CP1256 178
-#define FT_WinFNT_ID_CP1257 186
-#define FT_WinFNT_ID_CP1251 204
-#define FT_WinFNT_ID_CP874 222
-#define FT_WinFNT_ID_CP1250 238
-#define FT_WinFNT_ID_OEM 255
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* FT_WinFNT_HeaderRec */
- /* */
- /* <Description> */
- /* Windows FNT Header info. */
- /* */
- typedef struct FT_WinFNT_HeaderRec_
- {
- FT_UShort version;
- FT_ULong file_size;
- FT_Byte copyright[60];
- FT_UShort file_type;
- FT_UShort nominal_point_size;
- FT_UShort vertical_resolution;
- FT_UShort horizontal_resolution;
- FT_UShort ascent;
- FT_UShort internal_leading;
- FT_UShort external_leading;
- FT_Byte italic;
- FT_Byte underline;
- FT_Byte strike_out;
- FT_UShort weight;
- FT_Byte charset;
- FT_UShort pixel_width;
- FT_UShort pixel_height;
- FT_Byte pitch_and_family;
- FT_UShort avg_width;
- FT_UShort max_width;
- FT_Byte first_char;
- FT_Byte last_char;
- FT_Byte default_char;
- FT_Byte break_char;
- FT_UShort bytes_per_row;
- FT_ULong device_offset;
- FT_ULong face_name_offset;
- FT_ULong bits_pointer;
- FT_ULong bits_offset;
- FT_Byte reserved;
- FT_ULong flags;
- FT_UShort A_space;
- FT_UShort B_space;
- FT_UShort C_space;
- FT_UShort color_table_offset;
- FT_ULong reserved1[4];
-
- } FT_WinFNT_HeaderRec;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* FT_WinFNT_Header */
- /* */
- /* <Description> */
- /* A handle to an @FT_WinFNT_HeaderRec structure. */
- /* */
- typedef struct FT_WinFNT_HeaderRec_* FT_WinFNT_Header;
-
-
- /**********************************************************************
- *
- * @function:
- * FT_Get_WinFNT_Header
- *
- * @description:
- * Retrieve a Windows FNT font info header.
- *
- * @input:
- * face :: A handle to the input face.
- *
- * @output:
- * aheader :: The WinFNT header.
- *
- * @return:
- * FreeType error code. 0~means success.
- *
- * @note:
- * This function only works with Windows FNT faces, returning an error
- * otherwise.
- */
- FT_EXPORT( FT_Error )
- FT_Get_WinFNT_Header( FT_Face face,
- FT_WinFNT_HeaderRec *aheader );
-
- /* */
-
-
-FT_END_HEADER
-
-#endif /* __FTWINFNT_H__ */
-
-
-/* END */
-
-
-/* Local Variables: */
-/* coding: utf-8 */
-/* End: */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/autohint.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/autohint.h
deleted file mode 100644
index 8d5a9773cb5..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/autohint.h
+++ /dev/null
@@ -1,244 +0,0 @@
-/***************************************************************************/
-/* */
-/* autohint.h */
-/* */
-/* High-level `autohint' module-specific interface (specification). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* The auto-hinter is used to load and automatically hint glyphs if a */
- /* format-specific hinter isn't available. */
- /* */
- /*************************************************************************/
-
-
-#ifndef __AUTOHINT_H__
-#define __AUTOHINT_H__
-
-
- /*************************************************************************/
- /* */
- /* A small technical note regarding automatic hinting in order to */
- /* clarify this module interface. */
- /* */
- /* An automatic hinter might compute two kinds of data for a given face: */
- /* */
- /* - global hints: Usually some metrics that describe global properties */
- /* of the face. It is computed by scanning more or less */
- /* aggressively the glyphs in the face, and thus can be */
- /* very slow to compute (even if the size of global */
- /* hints is really small). */
- /* */
- /* - glyph hints: These describe some important features of the glyph */
- /* outline, as well as how to align them. They are */
- /* generally much faster to compute than global hints. */
- /* */
- /* The current FreeType auto-hinter does a pretty good job while */
- /* performing fast computations for both global and glyph hints. */
- /* However, we might be interested in introducing more complex and */
- /* powerful algorithms in the future, like the one described in the John */
- /* D. Hobby paper, which unfortunately requires a lot more horsepower. */
- /* */
- /* Because a sufficiently sophisticated font management system would */
- /* typically implement an LRU cache of opened face objects to reduce */
- /* memory usage, it is a good idea to be able to avoid recomputing */
- /* global hints every time the same face is re-opened. */
- /* */
- /* We thus provide the ability to cache global hints outside of the face */
- /* object, in order to speed up font re-opening time. Of course, this */
- /* feature is purely optional, so most client programs won't even notice */
- /* it. */
- /* */
- /* I initially thought that it would be a good idea to cache the glyph */
- /* hints too. However, my general idea now is that if you really need */
- /* to cache these too, you are simply in need of a new font format, */
- /* where all this information could be stored within the font file and */
- /* decoded on the fly. */
- /* */
- /*************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-
-
-FT_BEGIN_HEADER
-
-
- typedef struct FT_AutoHinterRec_ *FT_AutoHinter;
-
-
- /*************************************************************************/
- /* */
- /* <FuncType> */
- /* FT_AutoHinter_GlobalGetFunc */
- /* */
- /* <Description> */
- /* Retrieve the global hints computed for a given face object. The */
- /* resulting data is dissociated from the face and will survive a */
- /* call to FT_Done_Face(). It must be discarded through the API */
- /* FT_AutoHinter_GlobalDoneFunc(). */
- /* */
- /* <Input> */
- /* hinter :: A handle to the source auto-hinter. */
- /* */
- /* face :: A handle to the source face object. */
- /* */
- /* <Output> */
- /* global_hints :: A typeless pointer to the global hints. */
- /* */
- /* global_len :: The size in bytes of the global hints. */
- /* */
- typedef void
- (*FT_AutoHinter_GlobalGetFunc)( FT_AutoHinter hinter,
- FT_Face face,
- void** global_hints,
- long* global_len );
-
-
- /*************************************************************************/
- /* */
- /* <FuncType> */
- /* FT_AutoHinter_GlobalDoneFunc */
- /* */
- /* <Description> */
- /* Discard the global hints retrieved through */
- /* FT_AutoHinter_GlobalGetFunc(). This is the only way these hints */
- /* are freed from memory. */
- /* */
- /* <Input> */
- /* hinter :: A handle to the auto-hinter module. */
- /* */
- /* global :: A pointer to retrieved global hints to discard. */
- /* */
- typedef void
- (*FT_AutoHinter_GlobalDoneFunc)( FT_AutoHinter hinter,
- void* global );
-
-
- /*************************************************************************/
- /* */
- /* <FuncType> */
- /* FT_AutoHinter_GlobalResetFunc */
- /* */
- /* <Description> */
- /* This function is used to recompute the global metrics in a given */
- /* font. This is useful when global font data changes (e.g. Multiple */
- /* Masters fonts where blend coordinates change). */
- /* */
- /* <Input> */
- /* hinter :: A handle to the source auto-hinter. */
- /* */
- /* face :: A handle to the face. */
- /* */
- typedef void
- (*FT_AutoHinter_GlobalResetFunc)( FT_AutoHinter hinter,
- FT_Face face );
-
-
- /*************************************************************************/
- /* */
- /* <FuncType> */
- /* FT_AutoHinter_GlyphLoadFunc */
- /* */
- /* <Description> */
- /* This function is used to load, scale, and automatically hint a */
- /* glyph from a given face. */
- /* */
- /* <Input> */
- /* face :: A handle to the face. */
- /* */
- /* glyph_index :: The glyph index. */
- /* */
- /* load_flags :: The load flags. */
- /* */
- /* <Note> */
- /* This function is capable of loading composite glyphs by hinting */
- /* each sub-glyph independently (which improves quality). */
- /* */
- /* It will call the font driver with @FT_Load_Glyph, with */
- /* @FT_LOAD_NO_SCALE set. */
- /* */
- typedef FT_Error
- (*FT_AutoHinter_GlyphLoadFunc)( FT_AutoHinter hinter,
- FT_GlyphSlot slot,
- FT_Size size,
- FT_UInt glyph_index,
- FT_Int32 load_flags );
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* FT_AutoHinter_InterfaceRec */
- /* */
- /* <Description> */
- /* The auto-hinter module's interface. */
- /* */
- typedef struct FT_AutoHinter_InterfaceRec_
- {
- FT_AutoHinter_GlobalResetFunc reset_face;
- FT_AutoHinter_GlobalGetFunc get_global_hints;
- FT_AutoHinter_GlobalDoneFunc done_global_hints;
- FT_AutoHinter_GlyphLoadFunc load_glyph;
-
- } FT_AutoHinter_InterfaceRec, *FT_AutoHinter_Interface;
-
-
-#ifndef FT_CONFIG_OPTION_PIC
-
-#define FT_DEFINE_AUTOHINTER_INTERFACE( \
- class_, \
- reset_face_, \
- get_global_hints_, \
- done_global_hints_, \
- load_glyph_ ) \
- FT_CALLBACK_TABLE_DEF \
- const FT_AutoHinter_InterfaceRec class_ = \
- { \
- reset_face_, \
- get_global_hints_, \
- done_global_hints_, \
- load_glyph_ \
- };
-
-#else /* FT_CONFIG_OPTION_PIC */
-
-#define FT_DEFINE_AUTOHINTER_INTERFACE( \
- class_, \
- reset_face_, \
- get_global_hints_, \
- done_global_hints_, \
- load_glyph_ ) \
- void \
- FT_Init_Class_ ## class_( FT_Library library, \
- FT_AutoHinter_InterfaceRec* clazz ) \
- { \
- FT_UNUSED( library ); \
- \
- clazz->reset_face = reset_face_; \
- clazz->get_global_hints = get_global_hints_; \
- clazz->done_global_hints = done_global_hints_; \
- clazz->load_glyph = load_glyph_; \
- }
-
-#endif /* FT_CONFIG_OPTION_PIC */
-
-FT_END_HEADER
-
-#endif /* __AUTOHINT_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/ftcalc.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/ftcalc.h
deleted file mode 100644
index 67ade7e5f94..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/ftcalc.h
+++ /dev/null
@@ -1,418 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftcalc.h */
-/* */
-/* Arithmetic computations (specification). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __FTCALC_H__
-#define __FTCALC_H__
-
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-
-
-FT_BEGIN_HEADER
-
-
- /*************************************************************************/
- /* */
- /* FT_MulDiv() and FT_MulFix() are declared in freetype.h. */
- /* */
- /*************************************************************************/
-
-#ifndef FT_CONFIG_OPTION_NO_ASSEMBLER
- /* Provide assembler fragments for performance-critical functions. */
- /* These must be defined `static __inline__' with GCC. */
-
-#if defined( __CC_ARM ) || defined( __ARMCC__ ) /* RVCT */
-
-#define FT_MULFIX_ASSEMBLER FT_MulFix_arm
-
- /* documentation is in freetype.h */
-
- static __inline FT_Int32
- FT_MulFix_arm( FT_Int32 a,
- FT_Int32 b )
- {
- register FT_Int32 t, t2;
-
-
- __asm
- {
- smull t2, t, b, a /* (lo=t2,hi=t) = a*b */
- mov a, t, asr #31 /* a = (hi >> 31) */
- add a, a, #0x8000 /* a += 0x8000 */
- adds t2, t2, a /* t2 += a */
- adc t, t, #0 /* t += carry */
- mov a, t2, lsr #16 /* a = t2 >> 16 */
- orr a, a, t, lsl #16 /* a |= t << 16 */
- }
- return a;
- }
-
-#endif /* __CC_ARM || __ARMCC__ */
-
-
-#ifdef __GNUC__
-
-#if defined( __arm__ ) && \
- ( !defined( __thumb__ ) || defined( __thumb2__ ) ) && \
- !( defined( __CC_ARM ) || defined( __ARMCC__ ) )
-
-#define FT_MULFIX_ASSEMBLER FT_MulFix_arm
-
- /* documentation is in freetype.h */
-
- static __inline__ FT_Int32
- FT_MulFix_arm( FT_Int32 a,
- FT_Int32 b )
- {
- register FT_Int32 t, t2;
-
-
- __asm__ __volatile__ (
- "smull %1, %2, %4, %3\n\t" /* (lo=%1,hi=%2) = a*b */
- "mov %0, %2, asr #31\n\t" /* %0 = (hi >> 31) */
-#if defined( __clang__ ) && defined( __thumb2__ )
- "add.w %0, %0, #0x8000\n\t" /* %0 += 0x8000 */
-#else
- "add %0, %0, #0x8000\n\t" /* %0 += 0x8000 */
-#endif
- "adds %1, %1, %0\n\t" /* %1 += %0 */
- "adc %2, %2, #0\n\t" /* %2 += carry */
- "mov %0, %1, lsr #16\n\t" /* %0 = %1 >> 16 */
- "orr %0, %0, %2, lsl #16\n\t" /* %0 |= %2 << 16 */
- : "=r"(a), "=&r"(t2), "=&r"(t)
- : "r"(a), "r"(b)
- : "cc" );
- return a;
- }
-
-#endif /* __arm__ && */
- /* ( __thumb2__ || !__thumb__ ) && */
- /* !( __CC_ARM || __ARMCC__ ) */
-
-
-#if defined( __i386__ )
-
-#define FT_MULFIX_ASSEMBLER FT_MulFix_i386
-
- /* documentation is in freetype.h */
-
- static __inline__ FT_Int32
- FT_MulFix_i386( FT_Int32 a,
- FT_Int32 b )
- {
- register FT_Int32 result;
-
-
- __asm__ __volatile__ (
- "imul %%edx\n"
- "movl %%edx, %%ecx\n"
- "sarl $31, %%ecx\n"
- "addl $0x8000, %%ecx\n"
- "addl %%ecx, %%eax\n"
- "adcl $0, %%edx\n"
- "shrl $16, %%eax\n"
- "shll $16, %%edx\n"
- "addl %%edx, %%eax\n"
- : "=a"(result), "=d"(b)
- : "a"(a), "d"(b)
- : "%ecx", "cc" );
- return result;
- }
-
-#endif /* i386 */
-
-#endif /* __GNUC__ */
-
-
-#ifdef _MSC_VER /* Visual C++ */
-
-#ifdef _M_IX86
-
-#define FT_MULFIX_ASSEMBLER FT_MulFix_i386
-
- /* documentation is in freetype.h */
-
- static __inline FT_Int32
- FT_MulFix_i386( FT_Int32 a,
- FT_Int32 b )
- {
- register FT_Int32 result;
-
- __asm
- {
- mov eax, a
- mov edx, b
- imul edx
- mov ecx, edx
- sar ecx, 31
- add ecx, 8000h
- add eax, ecx
- adc edx, 0
- shr eax, 16
- shl edx, 16
- add eax, edx
- mov result, eax
- }
- return result;
- }
-
-#endif /* _M_IX86 */
-
-#endif /* _MSC_VER */
-
-
-#if defined( __GNUC__ ) && defined( __x86_64__ )
-
-#define FT_MULFIX_ASSEMBLER FT_MulFix_x86_64
-
- static __inline__ FT_Int32
- FT_MulFix_x86_64( FT_Int32 a,
- FT_Int32 b )
- {
- /* Temporarily disable the warning that C90 doesn't support */
- /* `long long'. */
-#if __GNUC__ > 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ >= 6 )
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wlong-long"
-#endif
-
-#if 1
- /* Technically not an assembly fragment, but GCC does a really good */
- /* job at inlining it and generating good machine code for it. */
- long long ret, tmp;
-
-
- ret = (long long)a * b;
- tmp = ret >> 63;
- ret += 0x8000 + tmp;
-
- return (FT_Int32)( ret >> 16 );
-#else
-
- /* For some reason, GCC 4.6 on Ubuntu 12.04 generates invalid machine */
- /* code from the lines below. The main issue is that `wide_a' is not */
- /* properly initialized by sign-extending `a'. Instead, the generated */
- /* machine code assumes that the register that contains `a' on input */
- /* can be used directly as a 64-bit value, which is wrong most of the */
- /* time. */
- long long wide_a = (long long)a;
- long long wide_b = (long long)b;
- long long result;
-
-
- __asm__ __volatile__ (
- "imul %2, %1\n"
- "mov %1, %0\n"
- "sar $63, %0\n"
- "lea 0x8000(%1, %0), %0\n"
- "sar $16, %0\n"
- : "=&r"(result), "=&r"(wide_a)
- : "r"(wide_b)
- : "cc" );
-
- return (FT_Int32)result;
-#endif
-
-#if __GNUC__ > 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ >= 6 )
-#pragma GCC diagnostic pop
-#endif
- }
-
-#endif /* __GNUC__ && __x86_64__ */
-
-#endif /* !FT_CONFIG_OPTION_NO_ASSEMBLER */
-
-
-#ifdef FT_CONFIG_OPTION_INLINE_MULFIX
-#ifdef FT_MULFIX_ASSEMBLER
-#define FT_MulFix( a, b ) FT_MULFIX_ASSEMBLER( (FT_Int32)(a), (FT_Int32)(b) )
-#endif
-#endif
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_MulDiv_No_Round */
- /* */
- /* <Description> */
- /* A very simple function used to perform the computation `(a*b)/c' */
- /* (without rounding) with maximum accuracy (it uses a 64-bit */
- /* intermediate integer whenever necessary). */
- /* */
- /* This function isn't necessarily as fast as some processor specific */
- /* operations, but is at least completely portable. */
- /* */
- /* <Input> */
- /* a :: The first multiplier. */
- /* b :: The second multiplier. */
- /* c :: The divisor. */
- /* */
- /* <Return> */
- /* The result of `(a*b)/c'. This function never traps when trying to */
- /* divide by zero; it simply returns `MaxInt' or `MinInt' depending */
- /* on the signs of `a' and `b'. */
- /* */
- FT_BASE( FT_Long )
- FT_MulDiv_No_Round( FT_Long a,
- FT_Long b,
- FT_Long c );
-
-
- /*
- * A variant of FT_Matrix_Multiply which scales its result afterwards.
- * The idea is that both `a' and `b' are scaled by factors of 10 so that
- * the values are as precise as possible to get a correct result during
- * the 64bit multiplication. Let `sa' and `sb' be the scaling factors of
- * `a' and `b', respectively, then the scaling factor of the result is
- * `sa*sb'.
- */
- FT_BASE( void )
- FT_Matrix_Multiply_Scaled( const FT_Matrix* a,
- FT_Matrix *b,
- FT_Long scaling );
-
-
- /*
- * A variant of FT_Vector_Transform. See comments for
- * FT_Matrix_Multiply_Scaled.
- */
- FT_BASE( void )
- FT_Vector_Transform_Scaled( FT_Vector* vector,
- const FT_Matrix* matrix,
- FT_Long scaling );
-
-
- /*
- * This function normalizes a vector and returns its original length.
- * The normalized vector is a 16.16 fixed-point unit vector with length
- * close to 0x10000. The accuracy of the returned length is limited to
- * 16 bits also. The function utilizes quick inverse square root
- * approximation without divisions and square roots relying on Newton's
- * iterations instead.
- */
- FT_BASE( FT_UInt32 )
- FT_Vector_NormLen( FT_Vector* vector );
-
-
- /*
- * Return -1, 0, or +1, depending on the orientation of a given corner.
- * We use the Cartesian coordinate system, with positive vertical values
- * going upwards. The function returns +1 if the corner turns to the
- * left, -1 to the right, and 0 for undecidable cases.
- */
- FT_BASE( FT_Int )
- ft_corner_orientation( FT_Pos in_x,
- FT_Pos in_y,
- FT_Pos out_x,
- FT_Pos out_y );
-
-
- /*
- * Return TRUE if a corner is flat or nearly flat. This is equivalent to
- * saying that the corner point is close to its neighbors, or inside an
- * ellipse defined by the neighbor focal points to be more precise.
- */
- FT_BASE( FT_Int )
- ft_corner_is_flat( FT_Pos in_x,
- FT_Pos in_y,
- FT_Pos out_x,
- FT_Pos out_y );
-
-
- /*
- * Return the most significant bit index.
- */
-
-#ifndef FT_CONFIG_OPTION_NO_ASSEMBLER
-#if defined( __GNUC__ ) && \
- ( __GNUC__ > 3 || ( __GNUC__ == 3 && __GNUC_MINOR__ >= 4 ) )
-
-#if FT_SIZEOF_INT == 4
-
-#define FT_MSB( x ) ( 31 - __builtin_clz( x ) )
-
-#elif FT_SIZEOF_LONG == 4
-
-#define FT_MSB( x ) ( 31 - __builtin_clzl( x ) )
-
-#endif
-
-#endif /* __GNUC__ */
-#endif /* !FT_CONFIG_OPTION_NO_ASSEMBLER */
-
-#ifndef FT_MSB
-
- FT_BASE( FT_Int )
- FT_MSB( FT_UInt32 z );
-
-#endif
-
-
- /*
- * Return sqrt(x*x+y*y), which is the same as `FT_Vector_Length' but uses
- * two fixed-point arguments instead.
- */
- FT_BASE( FT_Fixed )
- FT_Hypot( FT_Fixed x,
- FT_Fixed y );
-
-
-#if 0
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_SqrtFixed */
- /* */
- /* <Description> */
- /* Computes the square root of a 16.16 fixed-point value. */
- /* */
- /* <Input> */
- /* x :: The value to compute the root for. */
- /* */
- /* <Return> */
- /* The result of `sqrt(x)'. */
- /* */
- /* <Note> */
- /* This function is not very fast. */
- /* */
- FT_BASE( FT_Int32 )
- FT_SqrtFixed( FT_Int32 x );
-
-#endif /* 0 */
-
-
-#define INT_TO_F26DOT6( x ) ( (FT_Long)(x) << 6 )
-#define INT_TO_F2DOT14( x ) ( (FT_Long)(x) << 14 )
-#define INT_TO_FIXED( x ) ( (FT_Long)(x) << 16 )
-#define F2DOT14_TO_FIXED( x ) ( (FT_Long)(x) << 2 )
-#define FLOAT_TO_FIXED( x ) ( (FT_Long)( x * 65536.0 ) )
-#define FIXED_TO_INT( x ) ( FT_RoundFix( x ) >> 16 )
-
-#define ROUND_F26DOT6( x ) ( x >= 0 ? ( ( (x) + 32 ) & -64 ) \
- : ( -( ( 32 - (x) ) & -64 ) ) )
-
-
-FT_END_HEADER
-
-#endif /* __FTCALC_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/ftdebug.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/ftdebug.h
deleted file mode 100644
index 216c73031eb..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/ftdebug.h
+++ /dev/null
@@ -1,255 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftdebug.h */
-/* */
-/* Debugging and logging component (specification). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/* */
-/* IMPORTANT: A description of FreeType's debugging support can be */
-/* found in `docs/DEBUG.TXT'. Read it if you need to use or */
-/* understand this code. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __FTDEBUG_H__
-#define __FTDEBUG_H__
-
-
-#include <ft2build.h>
-#include FT_CONFIG_CONFIG_H
-#include FT_FREETYPE_H
-
-
-FT_BEGIN_HEADER
-
-
- /* force the definition of FT_DEBUG_LEVEL_ERROR if FT_DEBUG_LEVEL_TRACE */
- /* is already defined; this simplifies the following #ifdefs */
- /* */
-#ifdef FT_DEBUG_LEVEL_TRACE
-#undef FT_DEBUG_LEVEL_ERROR
-#define FT_DEBUG_LEVEL_ERROR
-#endif
-
-
- /*************************************************************************/
- /* */
- /* Define the trace enums as well as the trace levels array when they */
- /* are needed. */
- /* */
- /*************************************************************************/
-
-#ifdef FT_DEBUG_LEVEL_TRACE
-
-#define FT_TRACE_DEF( x ) trace_ ## x ,
-
- /* defining the enumeration */
- typedef enum FT_Trace_
- {
-#include FT_INTERNAL_TRACE_H
- trace_count
-
- } FT_Trace;
-
-
- /* defining the array of trace levels, provided by `src/base/ftdebug.c' */
- extern int ft_trace_levels[trace_count];
-
-#undef FT_TRACE_DEF
-
-#endif /* FT_DEBUG_LEVEL_TRACE */
-
-
- /*************************************************************************/
- /* */
- /* Define the FT_TRACE macro */
- /* */
- /* IMPORTANT! */
- /* */
- /* Each component must define the macro FT_COMPONENT to a valid FT_Trace */
- /* value before using any TRACE macro. */
- /* */
- /*************************************************************************/
-
-#ifdef FT_DEBUG_LEVEL_TRACE
-
-#define FT_TRACE( level, varformat ) \
- do \
- { \
- if ( ft_trace_levels[FT_COMPONENT] >= level ) \
- FT_Message varformat; \
- } while ( 0 )
-
-#else /* !FT_DEBUG_LEVEL_TRACE */
-
-#define FT_TRACE( level, varformat ) do { } while ( 0 ) /* nothing */
-
-#endif /* !FT_DEBUG_LEVEL_TRACE */
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Trace_Get_Count */
- /* */
- /* <Description> */
- /* Return the number of available trace components. */
- /* */
- /* <Return> */
- /* The number of trace components. 0 if FreeType 2 is not built with */
- /* FT_DEBUG_LEVEL_TRACE definition. */
- /* */
- /* <Note> */
- /* This function may be useful if you want to access elements of */
- /* the internal `ft_trace_levels' array by an index. */
- /* */
- FT_BASE( FT_Int )
- FT_Trace_Get_Count( void );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Trace_Get_Name */
- /* */
- /* <Description> */
- /* Return the name of a trace component. */
- /* */
- /* <Input> */
- /* The index of the trace component. */
- /* */
- /* <Return> */
- /* The name of the trace component. This is a statically allocated */
- /* C string, so do not free it after use. NULL if FreeType 2 is not */
- /* built with FT_DEBUG_LEVEL_TRACE definition. */
- /* */
- /* <Note> */
- /* Use @FT_Trace_Get_Count to get the number of available trace */
- /* components. */
- /* */
- /* This function may be useful if you want to control FreeType 2's */
- /* debug level in your application. */
- /* */
- FT_BASE( const char* )
- FT_Trace_Get_Name( FT_Int idx );
-
-
- /*************************************************************************/
- /* */
- /* You need two opening and closing parentheses! */
- /* */
- /* Example: FT_TRACE0(( "Value is %i", foo )) */
- /* */
- /* Output of the FT_TRACEX macros is sent to stderr. */
- /* */
- /*************************************************************************/
-
-#define FT_TRACE0( varformat ) FT_TRACE( 0, varformat )
-#define FT_TRACE1( varformat ) FT_TRACE( 1, varformat )
-#define FT_TRACE2( varformat ) FT_TRACE( 2, varformat )
-#define FT_TRACE3( varformat ) FT_TRACE( 3, varformat )
-#define FT_TRACE4( varformat ) FT_TRACE( 4, varformat )
-#define FT_TRACE5( varformat ) FT_TRACE( 5, varformat )
-#define FT_TRACE6( varformat ) FT_TRACE( 6, varformat )
-#define FT_TRACE7( varformat ) FT_TRACE( 7, varformat )
-
-
- /*************************************************************************/
- /* */
- /* Define the FT_ERROR macro. */
- /* */
- /* Output of this macro is sent to stderr. */
- /* */
- /*************************************************************************/
-
-#ifdef FT_DEBUG_LEVEL_ERROR
-
-#define FT_ERROR( varformat ) FT_Message varformat
-
-#else /* !FT_DEBUG_LEVEL_ERROR */
-
-#define FT_ERROR( varformat ) do { } while ( 0 ) /* nothing */
-
-#endif /* !FT_DEBUG_LEVEL_ERROR */
-
-
- /*************************************************************************/
- /* */
- /* Define the FT_ASSERT and FT_THROW macros. The call to `FT_Throw' */
- /* makes it possible to easily set a breakpoint at this function. */
- /* */
- /*************************************************************************/
-
-#ifdef FT_DEBUG_LEVEL_ERROR
-
-#define FT_ASSERT( condition ) \
- do \
- { \
- if ( !( condition ) ) \
- FT_Panic( "assertion failed on line %d of file %s\n", \
- __LINE__, __FILE__ ); \
- } while ( 0 )
-
-#define FT_THROW( e ) \
- ( FT_Throw( FT_ERR_CAT( FT_ERR_PREFIX, e ), \
- __LINE__, \
- __FILE__ ) | \
- FT_ERR_CAT( FT_ERR_PREFIX, e ) )
-
-#else /* !FT_DEBUG_LEVEL_ERROR */
-
-#define FT_ASSERT( condition ) do { } while ( 0 )
-
-#define FT_THROW( e ) FT_ERR_CAT( FT_ERR_PREFIX, e )
-
-#endif /* !FT_DEBUG_LEVEL_ERROR */
-
-
- /*************************************************************************/
- /* */
- /* Define `FT_Message' and `FT_Panic' when needed. */
- /* */
- /*************************************************************************/
-
-#ifdef FT_DEBUG_LEVEL_ERROR
-
-#include "stdio.h" /* for vfprintf() */
-
- /* print a message */
- FT_BASE( void )
- FT_Message( const char* fmt,
- ... );
-
- /* print a message and exit */
- FT_BASE( void )
- FT_Panic( const char* fmt,
- ... );
-
- /* report file name and line number of an error */
- FT_BASE( int )
- FT_Throw( FT_Error error,
- int line,
- const char* file );
-
-#endif /* FT_DEBUG_LEVEL_ERROR */
-
-
- FT_BASE( void )
- ft_debug_init( void );
-
-FT_END_HEADER
-
-#endif /* __FTDEBUG_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/ftdriver.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/ftdriver.h
deleted file mode 100644
index 16856d3df83..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/ftdriver.h
+++ /dev/null
@@ -1,409 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftdriver.h */
-/* */
-/* FreeType font driver interface (specification). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __FTDRIVER_H__
-#define __FTDRIVER_H__
-
-
-#include <ft2build.h>
-#include FT_MODULE_H
-
-
-FT_BEGIN_HEADER
-
-
- typedef FT_Error
- (*FT_Face_InitFunc)( FT_Stream stream,
- FT_Face face,
- FT_Int typeface_index,
- FT_Int num_params,
- FT_Parameter* parameters );
-
- typedef void
- (*FT_Face_DoneFunc)( FT_Face face );
-
-
- typedef FT_Error
- (*FT_Size_InitFunc)( FT_Size size );
-
- typedef void
- (*FT_Size_DoneFunc)( FT_Size size );
-
-
- typedef FT_Error
- (*FT_Slot_InitFunc)( FT_GlyphSlot slot );
-
- typedef void
- (*FT_Slot_DoneFunc)( FT_GlyphSlot slot );
-
-
- typedef FT_Error
- (*FT_Size_RequestFunc)( FT_Size size,
- FT_Size_Request req );
-
- typedef FT_Error
- (*FT_Size_SelectFunc)( FT_Size size,
- FT_ULong size_index );
-
- typedef FT_Error
- (*FT_Slot_LoadFunc)( FT_GlyphSlot slot,
- FT_Size size,
- FT_UInt glyph_index,
- FT_Int32 load_flags );
-
-
- typedef FT_UInt
- (*FT_CharMap_CharIndexFunc)( FT_CharMap charmap,
- FT_Long charcode );
-
- typedef FT_Long
- (*FT_CharMap_CharNextFunc)( FT_CharMap charmap,
- FT_Long charcode );
-
-
- typedef FT_Error
- (*FT_Face_GetKerningFunc)( FT_Face face,
- FT_UInt left_glyph,
- FT_UInt right_glyph,
- FT_Vector* kerning );
-
-
- typedef FT_Error
- (*FT_Face_AttachFunc)( FT_Face face,
- FT_Stream stream );
-
-
- typedef FT_Error
- (*FT_Face_GetAdvancesFunc)( FT_Face face,
- FT_UInt first,
- FT_UInt count,
- FT_Int32 flags,
- FT_Fixed* advances );
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* FT_Driver_ClassRec */
- /* */
- /* <Description> */
- /* The font driver class. This structure mostly contains pointers to */
- /* driver methods. */
- /* */
- /* <Fields> */
- /* root :: The parent module. */
- /* */
- /* face_object_size :: The size of a face object in bytes. */
- /* */
- /* size_object_size :: The size of a size object in bytes. */
- /* */
- /* slot_object_size :: The size of a glyph object in bytes. */
- /* */
- /* init_face :: The format-specific face constructor. */
- /* */
- /* done_face :: The format-specific face destructor. */
- /* */
- /* init_size :: The format-specific size constructor. */
- /* */
- /* done_size :: The format-specific size destructor. */
- /* */
- /* init_slot :: The format-specific slot constructor. */
- /* */
- /* done_slot :: The format-specific slot destructor. */
- /* */
- /* */
- /* load_glyph :: A function handle to load a glyph to a slot. */
- /* This field is mandatory! */
- /* */
- /* get_kerning :: A function handle to return the unscaled */
- /* kerning for a given pair of glyphs. Can be */
- /* set to 0 if the format doesn't support */
- /* kerning. */
- /* */
- /* attach_file :: This function handle is used to read */
- /* additional data for a face from another */
- /* file/stream. For example, this can be used to */
- /* add data from AFM or PFM files on a Type 1 */
- /* face, or a CIDMap on a CID-keyed face. */
- /* */
- /* get_advances :: A function handle used to return advance */
- /* widths of `count' glyphs (in font units), */
- /* starting at `first'. The `vertical' flag must */
- /* be set to get vertical advance heights. The */
- /* `advances' buffer is caller-allocated. */
- /* The idea of this function is to be able to */
- /* perform device-independent text layout without */
- /* loading a single glyph image. */
- /* */
- /* request_size :: A handle to a function used to request the new */
- /* character size. Can be set to 0 if the */
- /* scaling done in the base layer suffices. */
- /* */
- /* select_size :: A handle to a function used to select a new */
- /* fixed size. It is used only if */
- /* @FT_FACE_FLAG_FIXED_SIZES is set. Can be set */
- /* to 0 if the scaling done in the base layer */
- /* suffices. */
- /* <Note> */
- /* Most function pointers, with the exception of `load_glyph', can be */
- /* set to 0 to indicate a default behaviour. */
- /* */
- typedef struct FT_Driver_ClassRec_
- {
- FT_Module_Class root;
-
- FT_Long face_object_size;
- FT_Long size_object_size;
- FT_Long slot_object_size;
-
- FT_Face_InitFunc init_face;
- FT_Face_DoneFunc done_face;
-
- FT_Size_InitFunc init_size;
- FT_Size_DoneFunc done_size;
-
- FT_Slot_InitFunc init_slot;
- FT_Slot_DoneFunc done_slot;
-
- FT_Slot_LoadFunc load_glyph;
-
- FT_Face_GetKerningFunc get_kerning;
- FT_Face_AttachFunc attach_file;
- FT_Face_GetAdvancesFunc get_advances;
-
- /* since version 2.2 */
- FT_Size_RequestFunc request_size;
- FT_Size_SelectFunc select_size;
-
- } FT_Driver_ClassRec, *FT_Driver_Class;
-
-
- /*************************************************************************/
- /* */
- /* <Macro> */
- /* FT_DECLARE_DRIVER */
- /* */
- /* <Description> */
- /* Used to create a forward declaration of an FT_Driver_ClassRec */
- /* struct instance. */
- /* */
- /* <Macro> */
- /* FT_DEFINE_DRIVER */
- /* */
- /* <Description> */
- /* Used to initialize an instance of FT_Driver_ClassRec struct. */
- /* */
- /* When FT_CONFIG_OPTION_PIC is defined a `create' function has to be */
- /* called with a pointer where the allocated structure is returned. */
- /* And when it is no longer needed a `destroy' function needs to be */
- /* called to release that allocation. */
- /* */
- /* `fcinit.c' (ft_create_default_module_classes) already contains a */
- /* mechanism to call these functions for the default modules */
- /* described in `ftmodule.h'. */
- /* */
- /* Notice that the created `create' and `destroy' functions call */
- /* `pic_init' and `pic_free' to allow you to manually allocate and */
- /* initialize any additional global data, like a module specific */
- /* interface, and put them in the global pic container defined in */
- /* `ftpic.h'. If you don't need them just implement the functions as */
- /* empty to resolve the link error. Also the `pic_init' and */
- /* `pic_free' functions should be declared in `pic.h', to be referred */
- /* by driver definition calling `FT_DEFINE_DRIVER' in following. */
- /* */
- /* When FT_CONFIG_OPTION_PIC is not defined the struct will be */
- /* allocated in the global scope (or the scope where the macro is */
- /* used). */
- /* */
-#ifndef FT_CONFIG_OPTION_PIC
-
-#define FT_DECLARE_DRIVER( class_ ) \
- FT_CALLBACK_TABLE \
- const FT_Driver_ClassRec class_;
-
-#define FT_DEFINE_DRIVER( \
- class_, \
- flags_, \
- size_, \
- name_, \
- version_, \
- requires_, \
- interface_, \
- init_, \
- done_, \
- get_interface_, \
- face_object_size_, \
- size_object_size_, \
- slot_object_size_, \
- init_face_, \
- done_face_, \
- init_size_, \
- done_size_, \
- init_slot_, \
- done_slot_, \
- load_glyph_, \
- get_kerning_, \
- attach_file_, \
- get_advances_, \
- request_size_, \
- select_size_ ) \
- FT_CALLBACK_TABLE_DEF \
- const FT_Driver_ClassRec class_ = \
- { \
- FT_DEFINE_ROOT_MODULE( flags_, \
- size_, \
- name_, \
- version_, \
- requires_, \
- interface_, \
- init_, \
- done_, \
- get_interface_ ) \
- \
- face_object_size_, \
- size_object_size_, \
- slot_object_size_, \
- \
- init_face_, \
- done_face_, \
- \
- init_size_, \
- done_size_, \
- \
- init_slot_, \
- done_slot_, \
- \
- load_glyph_, \
- \
- get_kerning_, \
- attach_file_, \
- get_advances_, \
- \
- request_size_, \
- select_size_ \
- };
-
-#else /* FT_CONFIG_OPTION_PIC */
-
-#define FT_DECLARE_DRIVER( class_ ) FT_DECLARE_MODULE( class_ )
-
-#define FT_DEFINE_DRIVER( \
- class_, \
- flags_, \
- size_, \
- name_, \
- version_, \
- requires_, \
- interface_, \
- init_, \
- done_, \
- get_interface_, \
- face_object_size_, \
- size_object_size_, \
- slot_object_size_, \
- init_face_, \
- done_face_, \
- init_size_, \
- done_size_, \
- init_slot_, \
- done_slot_, \
- load_glyph_, \
- get_kerning_, \
- attach_file_, \
- get_advances_, \
- request_size_, \
- select_size_ ) \
- void \
- FT_Destroy_Class_ ## class_( FT_Library library, \
- FT_Module_Class* clazz ) \
- { \
- FT_Memory memory = library->memory; \
- FT_Driver_Class dclazz = (FT_Driver_Class)clazz; \
- \
- \
- class_ ## _pic_free( library ); \
- if ( dclazz ) \
- FT_FREE( dclazz ); \
- } \
- \
- \
- FT_Error \
- FT_Create_Class_ ## class_( FT_Library library, \
- FT_Module_Class** output_class ) \
- { \
- FT_Driver_Class clazz = NULL; \
- FT_Error error; \
- FT_Memory memory = library->memory; \
- \
- \
- if ( FT_ALLOC( clazz, sizeof ( *clazz ) ) ) \
- return error; \
- \
- error = class_ ## _pic_init( library ); \
- if ( error ) \
- { \
- FT_FREE( clazz ); \
- return error; \
- } \
- \
- FT_DEFINE_ROOT_MODULE( flags_, \
- size_, \
- name_, \
- version_, \
- requires_, \
- interface_, \
- init_, \
- done_, \
- get_interface_ ) \
- \
- clazz->face_object_size = face_object_size_; \
- clazz->size_object_size = size_object_size_; \
- clazz->slot_object_size = slot_object_size_; \
- \
- clazz->init_face = init_face_; \
- clazz->done_face = done_face_; \
- \
- clazz->init_size = init_size_; \
- clazz->done_size = done_size_; \
- \
- clazz->init_slot = init_slot_; \
- clazz->done_slot = done_slot_; \
- \
- clazz->load_glyph = load_glyph_; \
- \
- clazz->get_kerning = get_kerning_; \
- clazz->attach_file = attach_file_; \
- clazz->get_advances = get_advances_; \
- \
- clazz->request_size = request_size_; \
- clazz->select_size = select_size_; \
- \
- *output_class = (FT_Module_Class*)clazz; \
- \
- return FT_Err_Ok; \
- }
-
-
-#endif /* FT_CONFIG_OPTION_PIC */
-
-FT_END_HEADER
-
-#endif /* __FTDRIVER_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/ftgloadr.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/ftgloadr.h
deleted file mode 100644
index 970dd70cc3e..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/ftgloadr.h
+++ /dev/null
@@ -1,172 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftgloadr.h */
-/* */
-/* The FreeType glyph loader (specification). */
-/* */
-/* Copyright 2002-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __FTGLOADR_H__
-#define __FTGLOADR_H__
-
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-
-
-FT_BEGIN_HEADER
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* FT_GlyphLoader */
- /* */
- /* <Description> */
- /* The glyph loader is an internal object used to load several glyphs */
- /* together (for example, in the case of composites). */
- /* */
- /* <Note> */
- /* The glyph loader implementation is not part of the high-level API, */
- /* hence the forward structure declaration. */
- /* */
- typedef struct FT_GlyphLoaderRec_* FT_GlyphLoader ;
-
-
-#if 0 /* moved to freetype.h in version 2.2 */
-#define FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS 1
-#define FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES 2
-#define FT_SUBGLYPH_FLAG_ROUND_XY_TO_GRID 4
-#define FT_SUBGLYPH_FLAG_SCALE 8
-#define FT_SUBGLYPH_FLAG_XY_SCALE 0x40
-#define FT_SUBGLYPH_FLAG_2X2 0x80
-#define FT_SUBGLYPH_FLAG_USE_MY_METRICS 0x200
-#endif
-
-
- typedef struct FT_SubGlyphRec_
- {
- FT_Int index;
- FT_UShort flags;
- FT_Int arg1;
- FT_Int arg2;
- FT_Matrix transform;
-
- } FT_SubGlyphRec;
-
-
- typedef struct FT_GlyphLoadRec_
- {
- FT_Outline outline; /* outline */
- FT_Vector* extra_points; /* extra points table */
- FT_Vector* extra_points2; /* second extra points table */
- FT_UInt num_subglyphs; /* number of subglyphs */
- FT_SubGlyph subglyphs; /* subglyphs */
-
- } FT_GlyphLoadRec, *FT_GlyphLoad;
-
-
- typedef struct FT_GlyphLoaderRec_
- {
- FT_Memory memory;
- FT_UInt max_points;
- FT_UInt max_contours;
- FT_UInt max_subglyphs;
- FT_Bool use_extra;
-
- FT_GlyphLoadRec base;
- FT_GlyphLoadRec current;
-
- void* other; /* for possible future extension? */
-
- } FT_GlyphLoaderRec;
-
-
- /* create new empty glyph loader */
- FT_BASE( FT_Error )
- FT_GlyphLoader_New( FT_Memory memory,
- FT_GlyphLoader *aloader );
-
- /* add an extra points table to a glyph loader */
- FT_BASE( FT_Error )
- FT_GlyphLoader_CreateExtra( FT_GlyphLoader loader );
-
- /* destroy a glyph loader */
- FT_BASE( void )
- FT_GlyphLoader_Done( FT_GlyphLoader loader );
-
- /* reset a glyph loader (frees everything int it) */
- FT_BASE( void )
- FT_GlyphLoader_Reset( FT_GlyphLoader loader );
-
- /* rewind a glyph loader */
- FT_BASE( void )
- FT_GlyphLoader_Rewind( FT_GlyphLoader loader );
-
- /* check that there is enough space to add `n_points' and `n_contours' */
- /* to the glyph loader */
- FT_BASE( FT_Error )
- FT_GlyphLoader_CheckPoints( FT_GlyphLoader loader,
- FT_UInt n_points,
- FT_UInt n_contours );
-
-
-#define FT_GLYPHLOADER_CHECK_P( _loader, _count ) \
- ( (_count) == 0 || \
- ( (FT_UInt)(_loader)->base.outline.n_points + \
- (FT_UInt)(_loader)->current.outline.n_points + \
- (FT_UInt)(_count) ) <= (_loader)->max_points )
-
-#define FT_GLYPHLOADER_CHECK_C( _loader, _count ) \
- ( (_count) == 0 || \
- ( (FT_UInt)(_loader)->base.outline.n_contours + \
- (FT_UInt)(_loader)->current.outline.n_contours + \
- (FT_UInt)(_count) ) <= (_loader)->max_contours )
-
-#define FT_GLYPHLOADER_CHECK_POINTS( _loader, _points, _contours ) \
- ( ( FT_GLYPHLOADER_CHECK_P( _loader, _points ) && \
- FT_GLYPHLOADER_CHECK_C( _loader, _contours ) ) \
- ? 0 \
- : FT_GlyphLoader_CheckPoints( (_loader), \
- (FT_UInt)(_points), \
- (FT_UInt)(_contours) ) )
-
-
- /* check that there is enough space to add `n_subs' sub-glyphs to */
- /* a glyph loader */
- FT_BASE( FT_Error )
- FT_GlyphLoader_CheckSubGlyphs( FT_GlyphLoader loader,
- FT_UInt n_subs );
-
- /* prepare a glyph loader, i.e. empty the current glyph */
- FT_BASE( void )
- FT_GlyphLoader_Prepare( FT_GlyphLoader loader );
-
- /* add the current glyph to the base glyph */
- FT_BASE( void )
- FT_GlyphLoader_Add( FT_GlyphLoader loader );
-
- /* copy points from one glyph loader to another */
- FT_BASE( FT_Error )
- FT_GlyphLoader_CopyPoints( FT_GlyphLoader target,
- FT_GlyphLoader source );
-
- /* */
-
-
-FT_END_HEADER
-
-#endif /* __FTGLOADR_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/ftmemory.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/ftmemory.h
deleted file mode 100644
index c0c553b4fc9..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/ftmemory.h
+++ /dev/null
@@ -1,386 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftmemory.h */
-/* */
-/* The FreeType memory management macros (specification). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __FTMEMORY_H__
-#define __FTMEMORY_H__
-
-
-#include <ft2build.h>
-#include FT_CONFIG_CONFIG_H
-#include FT_TYPES_H
-
-
-FT_BEGIN_HEADER
-
-
- /*************************************************************************/
- /* */
- /* <Macro> */
- /* FT_SET_ERROR */
- /* */
- /* <Description> */
- /* This macro is used to set an implicit `error' variable to a given */
- /* expression's value (usually a function call), and convert it to a */
- /* boolean which is set whenever the value is != 0. */
- /* */
-#undef FT_SET_ERROR
-#define FT_SET_ERROR( expression ) \
- ( ( error = (expression) ) != 0 )
-
-
-
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
- /**** ****/
- /**** ****/
- /**** M E M O R Y ****/
- /**** ****/
- /**** ****/
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
-
-
- /*
- * C++ refuses to handle statements like p = (void*)anything, with `p' a
- * typed pointer. Since we don't have a `typeof' operator in standard
- * C++, we have to use a template to emulate it.
- */
-
-#ifdef __cplusplus
-
- extern "C++"
- template <typename T> inline T*
- cplusplus_typeof( T*,
- void *v )
- {
- return static_cast <T*> ( v );
- }
-
-#define FT_ASSIGNP( p, val ) (p) = cplusplus_typeof( (p), (val) )
-
-#else
-
-#define FT_ASSIGNP( p, val ) (p) = (val)
-
-#endif
-
-
-
-#ifdef FT_DEBUG_MEMORY
-
- FT_BASE( const char* ) _ft_debug_file;
- FT_BASE( long ) _ft_debug_lineno;
-
-#define FT_DEBUG_INNER( exp ) ( _ft_debug_file = __FILE__, \
- _ft_debug_lineno = __LINE__, \
- (exp) )
-
-#define FT_ASSIGNP_INNER( p, exp ) ( _ft_debug_file = __FILE__, \
- _ft_debug_lineno = __LINE__, \
- FT_ASSIGNP( p, exp ) )
-
-#else /* !FT_DEBUG_MEMORY */
-
-#define FT_DEBUG_INNER( exp ) (exp)
-#define FT_ASSIGNP_INNER( p, exp ) FT_ASSIGNP( p, exp )
-
-#endif /* !FT_DEBUG_MEMORY */
-
-
- /*
- * The allocation functions return a pointer, and the error code
- * is written to through the `p_error' parameter. See below for
- * for documentation.
- */
-
- FT_BASE( FT_Pointer )
- ft_mem_alloc( FT_Memory memory,
- FT_Long size,
- FT_Error *p_error );
-
- FT_BASE( FT_Pointer )
- ft_mem_qalloc( FT_Memory memory,
- FT_Long size,
- FT_Error *p_error );
-
- FT_BASE( FT_Pointer )
- ft_mem_realloc( FT_Memory memory,
- FT_Long item_size,
- FT_Long cur_count,
- FT_Long new_count,
- void* block,
- FT_Error *p_error );
-
- FT_BASE( FT_Pointer )
- ft_mem_qrealloc( FT_Memory memory,
- FT_Long item_size,
- FT_Long cur_count,
- FT_Long new_count,
- void* block,
- FT_Error *p_error );
-
- FT_BASE( void )
- ft_mem_free( FT_Memory memory,
- const void* P );
-
-
-#define FT_MEM_ALLOC( ptr, size ) \
- FT_ASSIGNP_INNER( ptr, ft_mem_alloc( memory, \
- (FT_Long)(size), \
- &error ) )
-
-#define FT_MEM_FREE( ptr ) \
- FT_BEGIN_STMNT \
- ft_mem_free( memory, (ptr) ); \
- (ptr) = NULL; \
- FT_END_STMNT
-
-#define FT_MEM_NEW( ptr ) \
- FT_MEM_ALLOC( ptr, sizeof ( *(ptr) ) )
-
-#define FT_MEM_REALLOC( ptr, cursz, newsz ) \
- FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, \
- 1, \
- (FT_Long)(cursz), \
- (FT_Long)(newsz), \
- (ptr), \
- &error ) )
-
-#define FT_MEM_QALLOC( ptr, size ) \
- FT_ASSIGNP_INNER( ptr, ft_mem_qalloc( memory, \
- (FT_Long)(size), \
- &error ) )
-
-#define FT_MEM_QNEW( ptr ) \
- FT_MEM_QALLOC( ptr, sizeof ( *(ptr) ) )
-
-#define FT_MEM_QREALLOC( ptr, cursz, newsz ) \
- FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, \
- 1, \
- (FT_Long)(cursz), \
- (FT_Long)(newsz), \
- (ptr), \
- &error ) )
-
-#define FT_MEM_ALLOC_MULT( ptr, count, item_size ) \
- FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, \
- (FT_Long)(item_size), \
- 0, \
- (FT_Long)(count), \
- NULL, \
- &error ) )
-
-#define FT_MEM_REALLOC_MULT( ptr, oldcnt, newcnt, itmsz ) \
- FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, \
- (FT_Long)(itmsz), \
- (FT_Long)(oldcnt), \
- (FT_Long)(newcnt), \
- (ptr), \
- &error ) )
-
-#define FT_MEM_QALLOC_MULT( ptr, count, item_size ) \
- FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, \
- (FT_Long)(item_size), \
- 0, \
- (FT_Long)(count), \
- NULL, \
- &error ) )
-
-#define FT_MEM_QREALLOC_MULT( ptr, oldcnt, newcnt, itmsz) \
- FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, \
- (FT_Long)(itmsz), \
- (FT_Long)(oldcnt), \
- (FT_Long)(newcnt), \
- (ptr), \
- &error ) )
-
-
-#define FT_MEM_SET_ERROR( cond ) ( (cond), error != 0 )
-
-
-#define FT_MEM_SET( dest, byte, count ) \
- ft_memset( dest, byte, (FT_Offset)(count) )
-
-#define FT_MEM_COPY( dest, source, count ) \
- ft_memcpy( dest, source, (FT_Offset)(count) )
-
-#define FT_MEM_MOVE( dest, source, count ) \
- ft_memmove( dest, source, (FT_Offset)(count) )
-
-
-#define FT_MEM_ZERO( dest, count ) FT_MEM_SET( dest, 0, count )
-
-#define FT_ZERO( p ) FT_MEM_ZERO( p, sizeof ( *(p) ) )
-
-
-#define FT_ARRAY_ZERO( dest, count ) \
- FT_MEM_ZERO( dest, \
- (FT_Offset)(count) * sizeof ( *(dest) ) )
-
-#define FT_ARRAY_COPY( dest, source, count ) \
- FT_MEM_COPY( dest, \
- source, \
- (FT_Offset)(count) * sizeof ( *(dest) ) )
-
-#define FT_ARRAY_MOVE( dest, source, count ) \
- FT_MEM_MOVE( dest, \
- source, \
- (FT_Offset)(count) * sizeof ( *(dest) ) )
-
-
- /*
- * Return the maximum number of addressable elements in an array.
- * We limit ourselves to INT_MAX, rather than UINT_MAX, to avoid
- * any problems.
- */
-#define FT_ARRAY_MAX( ptr ) ( FT_INT_MAX / sizeof ( *(ptr) ) )
-
-#define FT_ARRAY_CHECK( ptr, count ) ( (count) <= FT_ARRAY_MAX( ptr ) )
-
-
- /*************************************************************************/
- /* */
- /* The following functions macros expect that their pointer argument is */
- /* _typed_ in order to automatically compute array element sizes. */
- /* */
-
-#define FT_MEM_NEW_ARRAY( ptr, count ) \
- FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, \
- sizeof ( *(ptr) ), \
- 0, \
- (FT_Long)(count), \
- NULL, \
- &error ) )
-
-#define FT_MEM_RENEW_ARRAY( ptr, cursz, newsz ) \
- FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, \
- sizeof ( *(ptr) ), \
- (FT_Long)(cursz), \
- (FT_Long)(newsz), \
- (ptr), \
- &error ) )
-
-#define FT_MEM_QNEW_ARRAY( ptr, count ) \
- FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, \
- sizeof ( *(ptr) ), \
- 0, \
- (FT_Long)(count), \
- NULL, \
- &error ) )
-
-#define FT_MEM_QRENEW_ARRAY( ptr, cursz, newsz ) \
- FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, \
- sizeof ( *(ptr) ), \
- (FT_Long)(cursz), \
- (FT_Long)(newsz), \
- (ptr), \
- &error ) )
-
-#define FT_ALLOC( ptr, size ) \
- FT_MEM_SET_ERROR( FT_MEM_ALLOC( ptr, size ) )
-
-#define FT_REALLOC( ptr, cursz, newsz ) \
- FT_MEM_SET_ERROR( FT_MEM_REALLOC( ptr, cursz, newsz ) )
-
-#define FT_ALLOC_MULT( ptr, count, item_size ) \
- FT_MEM_SET_ERROR( FT_MEM_ALLOC_MULT( ptr, count, item_size ) )
-
-#define FT_REALLOC_MULT( ptr, oldcnt, newcnt, itmsz ) \
- FT_MEM_SET_ERROR( FT_MEM_REALLOC_MULT( ptr, oldcnt, \
- newcnt, itmsz ) )
-
-#define FT_QALLOC( ptr, size ) \
- FT_MEM_SET_ERROR( FT_MEM_QALLOC( ptr, size ) )
-
-#define FT_QREALLOC( ptr, cursz, newsz ) \
- FT_MEM_SET_ERROR( FT_MEM_QREALLOC( ptr, cursz, newsz ) )
-
-#define FT_QALLOC_MULT( ptr, count, item_size ) \
- FT_MEM_SET_ERROR( FT_MEM_QALLOC_MULT( ptr, count, item_size ) )
-
-#define FT_QREALLOC_MULT( ptr, oldcnt, newcnt, itmsz ) \
- FT_MEM_SET_ERROR( FT_MEM_QREALLOC_MULT( ptr, oldcnt, \
- newcnt, itmsz ) )
-
-#define FT_FREE( ptr ) FT_MEM_FREE( ptr )
-
-#define FT_NEW( ptr ) FT_MEM_SET_ERROR( FT_MEM_NEW( ptr ) )
-
-#define FT_NEW_ARRAY( ptr, count ) \
- FT_MEM_SET_ERROR( FT_MEM_NEW_ARRAY( ptr, count ) )
-
-#define FT_RENEW_ARRAY( ptr, curcnt, newcnt ) \
- FT_MEM_SET_ERROR( FT_MEM_RENEW_ARRAY( ptr, curcnt, newcnt ) )
-
-#define FT_QNEW( ptr ) \
- FT_MEM_SET_ERROR( FT_MEM_QNEW( ptr ) )
-
-#define FT_QNEW_ARRAY( ptr, count ) \
- FT_MEM_SET_ERROR( FT_MEM_NEW_ARRAY( ptr, count ) )
-
-#define FT_QRENEW_ARRAY( ptr, curcnt, newcnt ) \
- FT_MEM_SET_ERROR( FT_MEM_RENEW_ARRAY( ptr, curcnt, newcnt ) )
-
-
- FT_BASE( FT_Pointer )
- ft_mem_strdup( FT_Memory memory,
- const char* str,
- FT_Error *p_error );
-
- FT_BASE( FT_Pointer )
- ft_mem_dup( FT_Memory memory,
- const void* address,
- FT_ULong size,
- FT_Error *p_error );
-
-
-#define FT_MEM_STRDUP( dst, str ) \
- (dst) = (char*)ft_mem_strdup( memory, (const char*)(str), &error )
-
-#define FT_STRDUP( dst, str ) \
- FT_MEM_SET_ERROR( FT_MEM_STRDUP( dst, str ) )
-
-#define FT_MEM_DUP( dst, address, size ) \
- (dst) = ft_mem_dup( memory, (address), (FT_ULong)(size), &error )
-
-#define FT_DUP( dst, address, size ) \
- FT_MEM_SET_ERROR( FT_MEM_DUP( dst, address, size ) )
-
-
- /* Return >= 1 if a truncation occurs. */
- /* Return 0 if the source string fits the buffer. */
- /* This is *not* the same as strlcpy(). */
- FT_BASE( FT_Int )
- ft_mem_strcpyn( char* dst,
- const char* src,
- FT_ULong size );
-
-#define FT_STRCPYN( dst, src, size ) \
- ft_mem_strcpyn( (char*)dst, (const char*)(src), (FT_ULong)(size) )
-
- /* */
-
-
-FT_END_HEADER
-
-#endif /* __FTMEMORY_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/ftobjs.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/ftobjs.h
deleted file mode 100644
index da5582dc3fc..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/ftobjs.h
+++ /dev/null
@@ -1,1571 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftobjs.h */
-/* */
-/* The FreeType private base classes (specification). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* This file contains the definition of all internal FreeType classes. */
- /* */
- /*************************************************************************/
-
-
-#ifndef __FTOBJS_H__
-#define __FTOBJS_H__
-
-#include <ft2build.h>
-#include FT_RENDER_H
-#include FT_SIZES_H
-#include FT_LCD_FILTER_H
-#include FT_INTERNAL_MEMORY_H
-#include FT_INTERNAL_GLYPH_LOADER_H
-#include FT_INTERNAL_DRIVER_H
-#include FT_INTERNAL_AUTOHINT_H
-#include FT_INTERNAL_SERVICE_H
-#include FT_INTERNAL_PIC_H
-
-#ifdef FT_CONFIG_OPTION_INCREMENTAL
-#include FT_INCREMENTAL_H
-#endif
-
-
-FT_BEGIN_HEADER
-
-
- /*************************************************************************/
- /* */
- /* Some generic definitions. */
- /* */
-#ifndef TRUE
-#define TRUE 1
-#endif
-
-#ifndef FALSE
-#define FALSE 0
-#endif
-
-#ifndef NULL
-#define NULL (void*)0
-#endif
-
-
- /*************************************************************************/
- /* */
- /* The min and max functions missing in C. As usual, be careful not to */
- /* write things like FT_MIN( a++, b++ ) to avoid side effects. */
- /* */
-#define FT_MIN( a, b ) ( (a) < (b) ? (a) : (b) )
-#define FT_MAX( a, b ) ( (a) > (b) ? (a) : (b) )
-
-#define FT_ABS( a ) ( (a) < 0 ? -(a) : (a) )
-
- /*
- * Approximate sqrt(x*x+y*y) using the `alpha max plus beta min'
- * algorithm. We use alpha = 1, beta = 3/8, giving us results with a
- * largest error less than 7% compared to the exact value.
- */
-#define FT_HYPOT( x, y ) \
- ( x = FT_ABS( x ), \
- y = FT_ABS( y ), \
- x > y ? x + ( 3 * y >> 3 ) \
- : y + ( 3 * x >> 3 ) )
-
- /* we use FT_TYPEOF to suppress signedness compilation warnings */
-#define FT_PAD_FLOOR( x, n ) ( (x) & ~FT_TYPEOF( x )( (n)-1 ) )
-#define FT_PAD_ROUND( x, n ) FT_PAD_FLOOR( (x) + ((n)/2), n )
-#define FT_PAD_CEIL( x, n ) FT_PAD_FLOOR( (x) + ((n)-1), n )
-
-#define FT_PIX_FLOOR( x ) ( (x) & ~FT_TYPEOF( x )63 )
-#define FT_PIX_ROUND( x ) FT_PIX_FLOOR( (x) + 32 )
-#define FT_PIX_CEIL( x ) FT_PIX_FLOOR( (x) + 63 )
-
-
- /*
- * character classification functions -- since these are used to parse
- * font files, we must not use those in <ctypes.h> which are
- * locale-dependent
- */
-#define ft_isdigit( x ) ( ( (unsigned)(x) - '0' ) < 10U )
-
-#define ft_isxdigit( x ) ( ( (unsigned)(x) - '0' ) < 10U || \
- ( (unsigned)(x) - 'a' ) < 6U || \
- ( (unsigned)(x) - 'A' ) < 6U )
-
- /* the next two macros assume ASCII representation */
-#define ft_isupper( x ) ( ( (unsigned)(x) - 'A' ) < 26U )
-#define ft_islower( x ) ( ( (unsigned)(x) - 'a' ) < 26U )
-
-#define ft_isalpha( x ) ( ft_isupper( x ) || ft_islower( x ) )
-#define ft_isalnum( x ) ( ft_isdigit( x ) || ft_isalpha( x ) )
-
-
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
- /**** ****/
- /**** ****/
- /**** C H A R M A P S ****/
- /**** ****/
- /**** ****/
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
-
- /* handle to internal charmap object */
- typedef struct FT_CMapRec_* FT_CMap;
-
- /* handle to charmap class structure */
- typedef const struct FT_CMap_ClassRec_* FT_CMap_Class;
-
- /* internal charmap object structure */
- typedef struct FT_CMapRec_
- {
- FT_CharMapRec charmap;
- FT_CMap_Class clazz;
-
- } FT_CMapRec;
-
- /* typecase any pointer to a charmap handle */
-#define FT_CMAP( x ) ((FT_CMap)( x ))
-
- /* obvious macros */
-#define FT_CMAP_PLATFORM_ID( x ) FT_CMAP( x )->charmap.platform_id
-#define FT_CMAP_ENCODING_ID( x ) FT_CMAP( x )->charmap.encoding_id
-#define FT_CMAP_ENCODING( x ) FT_CMAP( x )->charmap.encoding
-#define FT_CMAP_FACE( x ) FT_CMAP( x )->charmap.face
-
-
- /* class method definitions */
- typedef FT_Error
- (*FT_CMap_InitFunc)( FT_CMap cmap,
- FT_Pointer init_data );
-
- typedef void
- (*FT_CMap_DoneFunc)( FT_CMap cmap );
-
- typedef FT_UInt
- (*FT_CMap_CharIndexFunc)( FT_CMap cmap,
- FT_UInt32 char_code );
-
- typedef FT_UInt
- (*FT_CMap_CharNextFunc)( FT_CMap cmap,
- FT_UInt32 *achar_code );
-
- typedef FT_UInt
- (*FT_CMap_CharVarIndexFunc)( FT_CMap cmap,
- FT_CMap unicode_cmap,
- FT_UInt32 char_code,
- FT_UInt32 variant_selector );
-
- typedef FT_Bool
- (*FT_CMap_CharVarIsDefaultFunc)( FT_CMap cmap,
- FT_UInt32 char_code,
- FT_UInt32 variant_selector );
-
- typedef FT_UInt32 *
- (*FT_CMap_VariantListFunc)( FT_CMap cmap,
- FT_Memory mem );
-
- typedef FT_UInt32 *
- (*FT_CMap_CharVariantListFunc)( FT_CMap cmap,
- FT_Memory mem,
- FT_UInt32 char_code );
-
- typedef FT_UInt32 *
- (*FT_CMap_VariantCharListFunc)( FT_CMap cmap,
- FT_Memory mem,
- FT_UInt32 variant_selector );
-
-
- typedef struct FT_CMap_ClassRec_
- {
- FT_ULong size;
- FT_CMap_InitFunc init;
- FT_CMap_DoneFunc done;
- FT_CMap_CharIndexFunc char_index;
- FT_CMap_CharNextFunc char_next;
-
- /* Subsequent entries are special ones for format 14 -- the variant */
- /* selector subtable which behaves like no other */
-
- FT_CMap_CharVarIndexFunc char_var_index;
- FT_CMap_CharVarIsDefaultFunc char_var_default;
- FT_CMap_VariantListFunc variant_list;
- FT_CMap_CharVariantListFunc charvariant_list;
- FT_CMap_VariantCharListFunc variantchar_list;
-
- } FT_CMap_ClassRec;
-
-
-#ifndef FT_CONFIG_OPTION_PIC
-
-#define FT_DECLARE_CMAP_CLASS( class_ ) \
- FT_CALLBACK_TABLE const FT_CMap_ClassRec class_;
-
-#define FT_DEFINE_CMAP_CLASS( \
- class_, \
- size_, \
- init_, \
- done_, \
- char_index_, \
- char_next_, \
- char_var_index_, \
- char_var_default_, \
- variant_list_, \
- charvariant_list_, \
- variantchar_list_ ) \
- FT_CALLBACK_TABLE_DEF \
- const FT_CMap_ClassRec class_ = \
- { \
- size_, \
- init_, \
- done_, \
- char_index_, \
- char_next_, \
- char_var_index_, \
- char_var_default_, \
- variant_list_, \
- charvariant_list_, \
- variantchar_list_ \
- };
-
-#else /* FT_CONFIG_OPTION_PIC */
-
-#define FT_DECLARE_CMAP_CLASS( class_ ) \
- void \
- FT_Init_Class_ ## class_( FT_Library library, \
- FT_CMap_ClassRec* clazz );
-
-#define FT_DEFINE_CMAP_CLASS( \
- class_, \
- size_, \
- init_, \
- done_, \
- char_index_, \
- char_next_, \
- char_var_index_, \
- char_var_default_, \
- variant_list_, \
- charvariant_list_, \
- variantchar_list_ ) \
- void \
- FT_Init_Class_ ## class_( FT_Library library, \
- FT_CMap_ClassRec* clazz ) \
- { \
- FT_UNUSED( library ); \
- \
- clazz->size = size_; \
- clazz->init = init_; \
- clazz->done = done_; \
- clazz->char_index = char_index_; \
- clazz->char_next = char_next_; \
- clazz->char_var_index = char_var_index_; \
- clazz->char_var_default = char_var_default_; \
- clazz->variant_list = variant_list_; \
- clazz->charvariant_list = charvariant_list_; \
- clazz->variantchar_list = variantchar_list_; \
- }
-
-#endif /* FT_CONFIG_OPTION_PIC */
-
-
- /* create a new charmap and add it to charmap->face */
- FT_BASE( FT_Error )
- FT_CMap_New( FT_CMap_Class clazz,
- FT_Pointer init_data,
- FT_CharMap charmap,
- FT_CMap *acmap );
-
- /* destroy a charmap and remove it from face's list */
- FT_BASE( void )
- FT_CMap_Done( FT_CMap cmap );
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* FT_Face_InternalRec */
- /* */
- /* <Description> */
- /* This structure contains the internal fields of each FT_Face */
- /* object. These fields may change between different releases of */
- /* FreeType. */
- /* */
- /* <Fields> */
- /* max_points :: */
- /* The maximum number of points used to store the vectorial outline */
- /* of any glyph in this face. If this value cannot be known in */
- /* advance, or if the face isn't scalable, this should be set to 0. */
- /* Only relevant for scalable formats. */
- /* */
- /* max_contours :: */
- /* The maximum number of contours used to store the vectorial */
- /* outline of any glyph in this face. If this value cannot be */
- /* known in advance, or if the face isn't scalable, this should be */
- /* set to 0. Only relevant for scalable formats. */
- /* */
- /* transform_matrix :: */
- /* A 2x2 matrix of 16.16 coefficients used to transform glyph */
- /* outlines after they are loaded from the font. Only used by the */
- /* convenience functions. */
- /* */
- /* transform_delta :: */
- /* A translation vector used to transform glyph outlines after they */
- /* are loaded from the font. Only used by the convenience */
- /* functions. */
- /* */
- /* transform_flags :: */
- /* Some flags used to classify the transform. Only used by the */
- /* convenience functions. */
- /* */
- /* services :: */
- /* A cache for frequently used services. It should be only */
- /* accessed with the macro `FT_FACE_LOOKUP_SERVICE'. */
- /* */
- /* incremental_interface :: */
- /* If non-null, the interface through which glyph data and metrics */
- /* are loaded incrementally for faces that do not provide all of */
- /* this data when first opened. This field exists only if */
- /* @FT_CONFIG_OPTION_INCREMENTAL is defined. */
- /* */
- /* ignore_unpatented_hinter :: */
- /* This boolean flag instructs the glyph loader to ignore the */
- /* native font hinter, if one is found. This is exclusively used */
- /* in the case when the unpatented hinter is compiled within the */
- /* library. */
- /* */
- /* refcount :: */
- /* A counter initialized to~1 at the time an @FT_Face structure is */
- /* created. @FT_Reference_Face increments this counter, and */
- /* @FT_Done_Face only destroys a face if the counter is~1, */
- /* otherwise it simply decrements it. */
- /* */
- typedef struct FT_Face_InternalRec_
- {
- FT_Matrix transform_matrix;
- FT_Vector transform_delta;
- FT_Int transform_flags;
-
- FT_ServiceCacheRec services;
-
-#ifdef FT_CONFIG_OPTION_INCREMENTAL
- FT_Incremental_InterfaceRec* incremental_interface;
-#endif
-
- FT_Bool ignore_unpatented_hinter;
- FT_Int refcount;
-
- } FT_Face_InternalRec;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* FT_Slot_InternalRec */
- /* */
- /* <Description> */
- /* This structure contains the internal fields of each FT_GlyphSlot */
- /* object. These fields may change between different releases of */
- /* FreeType. */
- /* */
- /* <Fields> */
- /* loader :: The glyph loader object used to load outlines */
- /* into the glyph slot. */
- /* */
- /* flags :: Possible values are zero or */
- /* FT_GLYPH_OWN_BITMAP. The latter indicates */
- /* that the FT_GlyphSlot structure owns the */
- /* bitmap buffer. */
- /* */
- /* glyph_transformed :: Boolean. Set to TRUE when the loaded glyph */
- /* must be transformed through a specific */
- /* font transformation. This is _not_ the same */
- /* as the face transform set through */
- /* FT_Set_Transform(). */
- /* */
- /* glyph_matrix :: The 2x2 matrix corresponding to the glyph */
- /* transformation, if necessary. */
- /* */
- /* glyph_delta :: The 2d translation vector corresponding to */
- /* the glyph transformation, if necessary. */
- /* */
- /* glyph_hints :: Format-specific glyph hints management. */
- /* */
-
-#define FT_GLYPH_OWN_BITMAP 0x1U
-
- typedef struct FT_Slot_InternalRec_
- {
- FT_GlyphLoader loader;
- FT_UInt flags;
- FT_Bool glyph_transformed;
- FT_Matrix glyph_matrix;
- FT_Vector glyph_delta;
- void* glyph_hints;
-
- } FT_GlyphSlot_InternalRec;
-
-
-#if 0
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* FT_Size_InternalRec */
- /* */
- /* <Description> */
- /* This structure contains the internal fields of each FT_Size */
- /* object. Currently, it's empty. */
- /* */
- /*************************************************************************/
-
- typedef struct FT_Size_InternalRec_
- {
- /* empty */
-
- } FT_Size_InternalRec;
-
-#endif
-
-
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
- /**** ****/
- /**** ****/
- /**** M O D U L E S ****/
- /**** ****/
- /**** ****/
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* FT_ModuleRec */
- /* */
- /* <Description> */
- /* A module object instance. */
- /* */
- /* <Fields> */
- /* clazz :: A pointer to the module's class. */
- /* */
- /* library :: A handle to the parent library object. */
- /* */
- /* memory :: A handle to the memory manager. */
- /* */
- typedef struct FT_ModuleRec_
- {
- FT_Module_Class* clazz;
- FT_Library library;
- FT_Memory memory;
-
- } FT_ModuleRec;
-
-
- /* typecast an object to an FT_Module */
-#define FT_MODULE( x ) ((FT_Module)( x ))
-#define FT_MODULE_CLASS( x ) FT_MODULE( x )->clazz
-#define FT_MODULE_LIBRARY( x ) FT_MODULE( x )->library
-#define FT_MODULE_MEMORY( x ) FT_MODULE( x )->memory
-
-
-#define FT_MODULE_IS_DRIVER( x ) ( FT_MODULE_CLASS( x )->module_flags & \
- FT_MODULE_FONT_DRIVER )
-
-#define FT_MODULE_IS_RENDERER( x ) ( FT_MODULE_CLASS( x )->module_flags & \
- FT_MODULE_RENDERER )
-
-#define FT_MODULE_IS_HINTER( x ) ( FT_MODULE_CLASS( x )->module_flags & \
- FT_MODULE_HINTER )
-
-#define FT_MODULE_IS_STYLER( x ) ( FT_MODULE_CLASS( x )->module_flags & \
- FT_MODULE_STYLER )
-
-#define FT_DRIVER_IS_SCALABLE( x ) ( FT_MODULE_CLASS( x )->module_flags & \
- FT_MODULE_DRIVER_SCALABLE )
-
-#define FT_DRIVER_USES_OUTLINES( x ) !( FT_MODULE_CLASS( x )->module_flags & \
- FT_MODULE_DRIVER_NO_OUTLINES )
-
-#define FT_DRIVER_HAS_HINTER( x ) ( FT_MODULE_CLASS( x )->module_flags & \
- FT_MODULE_DRIVER_HAS_HINTER )
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Get_Module_Interface */
- /* */
- /* <Description> */
- /* Finds a module and returns its specific interface as a typeless */
- /* pointer. */
- /* */
- /* <Input> */
- /* library :: A handle to the library object. */
- /* */
- /* module_name :: The module's name (as an ASCII string). */
- /* */
- /* <Return> */
- /* A module-specific interface if available, 0 otherwise. */
- /* */
- /* <Note> */
- /* You should better be familiar with FreeType internals to know */
- /* which module to look for, and what its interface is :-) */
- /* */
- FT_BASE( const void* )
- FT_Get_Module_Interface( FT_Library library,
- const char* mod_name );
-
- FT_BASE( FT_Pointer )
- ft_module_get_service( FT_Module module,
- const char* service_id );
-
- /* */
-
-
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
- /**** ****/
- /**** ****/
- /**** F A C E, S I Z E & G L Y P H S L O T O B J E C T S ****/
- /**** ****/
- /**** ****/
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
-
- /* a few macros used to perform easy typecasts with minimal brain damage */
-
-#define FT_FACE( x ) ((FT_Face)(x))
-#define FT_SIZE( x ) ((FT_Size)(x))
-#define FT_SLOT( x ) ((FT_GlyphSlot)(x))
-
-#define FT_FACE_DRIVER( x ) FT_FACE( x )->driver
-#define FT_FACE_LIBRARY( x ) FT_FACE_DRIVER( x )->root.library
-#define FT_FACE_MEMORY( x ) FT_FACE( x )->memory
-#define FT_FACE_STREAM( x ) FT_FACE( x )->stream
-
-#define FT_SIZE_FACE( x ) FT_SIZE( x )->face
-#define FT_SLOT_FACE( x ) FT_SLOT( x )->face
-
-#define FT_FACE_SLOT( x ) FT_FACE( x )->glyph
-#define FT_FACE_SIZE( x ) FT_FACE( x )->size
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_New_GlyphSlot */
- /* */
- /* <Description> */
- /* It is sometimes useful to have more than one glyph slot for a */
- /* given face object. This function is used to create additional */
- /* slots. All of them are automatically discarded when the face is */
- /* destroyed. */
- /* */
- /* <Input> */
- /* face :: A handle to a parent face object. */
- /* */
- /* <Output> */
- /* aslot :: A handle to a new glyph slot object. */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. */
- /* */
- FT_BASE( FT_Error )
- FT_New_GlyphSlot( FT_Face face,
- FT_GlyphSlot *aslot );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Done_GlyphSlot */
- /* */
- /* <Description> */
- /* Destroys a given glyph slot. Remember however that all slots are */
- /* automatically destroyed with its parent. Using this function is */
- /* not always mandatory. */
- /* */
- /* <Input> */
- /* slot :: A handle to a target glyph slot. */
- /* */
- FT_BASE( void )
- FT_Done_GlyphSlot( FT_GlyphSlot slot );
-
- /* */
-
-#define FT_REQUEST_WIDTH( req ) \
- ( (req)->horiResolution \
- ? ( (req)->width * (FT_Pos)(req)->horiResolution + 36 ) / 72 \
- : (req)->width )
-
-#define FT_REQUEST_HEIGHT( req ) \
- ( (req)->vertResolution \
- ? ( (req)->height * (FT_Pos)(req)->vertResolution + 36 ) / 72 \
- : (req)->height )
-
-
- /* Set the metrics according to a bitmap strike. */
- FT_BASE( void )
- FT_Select_Metrics( FT_Face face,
- FT_ULong strike_index );
-
-
- /* Set the metrics according to a size request. */
- FT_BASE( void )
- FT_Request_Metrics( FT_Face face,
- FT_Size_Request req );
-
-
- /* Match a size request against `available_sizes'. */
- FT_BASE( FT_Error )
- FT_Match_Size( FT_Face face,
- FT_Size_Request req,
- FT_Bool ignore_width,
- FT_ULong* size_index );
-
-
- /* Use the horizontal metrics to synthesize the vertical metrics. */
- /* If `advance' is zero, it is also synthesized. */
- FT_BASE( void )
- ft_synthesize_vertical_metrics( FT_Glyph_Metrics* metrics,
- FT_Pos advance );
-
-
- /* Free the bitmap of a given glyphslot when needed (i.e., only when it */
- /* was allocated with ft_glyphslot_alloc_bitmap). */
- FT_BASE( void )
- ft_glyphslot_free_bitmap( FT_GlyphSlot slot );
-
-
- /* Allocate a new bitmap buffer in a glyph slot. */
- FT_BASE( FT_Error )
- ft_glyphslot_alloc_bitmap( FT_GlyphSlot slot,
- FT_ULong size );
-
-
- /* Set the bitmap buffer in a glyph slot to a given pointer. The buffer */
- /* will not be freed by a later call to ft_glyphslot_free_bitmap. */
- FT_BASE( void )
- ft_glyphslot_set_bitmap( FT_GlyphSlot slot,
- FT_Byte* buffer );
-
-
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
- /**** ****/
- /**** ****/
- /**** R E N D E R E R S ****/
- /**** ****/
- /**** ****/
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
-
-
-#define FT_RENDERER( x ) ((FT_Renderer)( x ))
-#define FT_GLYPH( x ) ((FT_Glyph)( x ))
-#define FT_BITMAP_GLYPH( x ) ((FT_BitmapGlyph)( x ))
-#define FT_OUTLINE_GLYPH( x ) ((FT_OutlineGlyph)( x ))
-
-
- typedef struct FT_RendererRec_
- {
- FT_ModuleRec root;
- FT_Renderer_Class* clazz;
- FT_Glyph_Format glyph_format;
- FT_Glyph_Class glyph_class;
-
- FT_Raster raster;
- FT_Raster_Render_Func raster_render;
- FT_Renderer_RenderFunc render;
-
- } FT_RendererRec;
-
-
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
- /**** ****/
- /**** ****/
- /**** F O N T D R I V E R S ****/
- /**** ****/
- /**** ****/
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
-
-
- /* typecast a module into a driver easily */
-#define FT_DRIVER( x ) ((FT_Driver)(x))
-
- /* typecast a module as a driver, and get its driver class */
-#define FT_DRIVER_CLASS( x ) FT_DRIVER( x )->clazz
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* FT_DriverRec */
- /* */
- /* <Description> */
- /* The root font driver class. A font driver is responsible for */
- /* managing and loading font files of a given format. */
- /* */
- /* <Fields> */
- /* root :: Contains the fields of the root module class. */
- /* */
- /* clazz :: A pointer to the font driver's class. Note that */
- /* this is NOT root.clazz. `class' wasn't used */
- /* as it is a reserved word in C++. */
- /* */
- /* faces_list :: The list of faces currently opened by this */
- /* driver. */
- /* */
- /* glyph_loader :: Unused. Used to be glyph loader for all faces */
- /* managed by this driver. */
- /* */
- typedef struct FT_DriverRec_
- {
- FT_ModuleRec root;
- FT_Driver_Class clazz;
- FT_ListRec faces_list;
- FT_GlyphLoader glyph_loader;
-
- } FT_DriverRec;
-
-
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
- /**** ****/
- /**** ****/
- /**** L I B R A R I E S ****/
- /**** ****/
- /**** ****/
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
-
-
- /* This hook is used by the TrueType debugger. It must be set to an */
- /* alternate truetype bytecode interpreter function. */
-#define FT_DEBUG_HOOK_TRUETYPE 0
-
-
- /* Set this debug hook to a non-null pointer to force unpatented hinting */
- /* for all faces when both TT_USE_BYTECODE_INTERPRETER and */
- /* TT_CONFIG_OPTION_UNPATENTED_HINTING are defined. This is only used */
- /* during debugging. */
-#define FT_DEBUG_HOOK_UNPATENTED_HINTING 1
-
-
- typedef void (*FT_Bitmap_LcdFilterFunc)( FT_Bitmap* bitmap,
- FT_Render_Mode render_mode,
- FT_Library library );
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* FT_LibraryRec */
- /* */
- /* <Description> */
- /* The FreeType library class. This is the root of all FreeType */
- /* data. Use FT_New_Library() to create a library object, and */
- /* FT_Done_Library() to discard it and all child objects. */
- /* */
- /* <Fields> */
- /* memory :: The library's memory object. Manages memory */
- /* allocation. */
- /* */
- /* version_major :: The major version number of the library. */
- /* */
- /* version_minor :: The minor version number of the library. */
- /* */
- /* version_patch :: The current patch level of the library. */
- /* */
- /* num_modules :: The number of modules currently registered */
- /* within this library. This is set to 0 for new */
- /* libraries. New modules are added through the */
- /* FT_Add_Module() API function. */
- /* */
- /* modules :: A table used to store handles to the currently */
- /* registered modules. Note that each font driver */
- /* contains a list of its opened faces. */
- /* */
- /* renderers :: The list of renderers currently registered */
- /* within the library. */
- /* */
- /* cur_renderer :: The current outline renderer. This is a */
- /* shortcut used to avoid parsing the list on */
- /* each call to FT_Outline_Render(). It is a */
- /* handle to the current renderer for the */
- /* FT_GLYPH_FORMAT_OUTLINE format. */
- /* */
- /* auto_hinter :: XXX */
- /* */
- /* raster_pool :: The raster object's render pool. This can */
- /* ideally be changed dynamically at run-time. */
- /* */
- /* raster_pool_size :: The size of the render pool in bytes. */
- /* */
- /* debug_hooks :: XXX */
- /* */
- /* lcd_filter :: If subpixel rendering is activated, the */
- /* selected LCD filter mode. */
- /* */
- /* lcd_extra :: If subpixel rendering is activated, the number */
- /* of extra pixels needed for the LCD filter. */
- /* */
- /* lcd_weights :: If subpixel rendering is activated, the LCD */
- /* filter weights, if any. */
- /* */
- /* lcd_filter_func :: If subpixel rendering is activated, the LCD */
- /* filtering callback function. */
- /* */
- /* pic_container :: Contains global structs and tables, instead */
- /* of defining them globallly. */
- /* */
- /* refcount :: A counter initialized to~1 at the time an */
- /* @FT_Library structure is created. */
- /* @FT_Reference_Library increments this counter, */
- /* and @FT_Done_Library only destroys a library */
- /* if the counter is~1, otherwise it simply */
- /* decrements it. */
- /* */
- typedef struct FT_LibraryRec_
- {
- FT_Memory memory; /* library's memory manager */
-
- FT_Int version_major;
- FT_Int version_minor;
- FT_Int version_patch;
-
- FT_UInt num_modules;
- FT_Module modules[FT_MAX_MODULES]; /* module objects */
-
- FT_ListRec renderers; /* list of renderers */
- FT_Renderer cur_renderer; /* current outline renderer */
- FT_Module auto_hinter;
-
- FT_Byte* raster_pool; /* scan-line conversion */
- /* render pool */
- FT_ULong raster_pool_size; /* size of render pool in bytes */
-
- FT_DebugHook_Func debug_hooks[4];
-
-#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
- FT_LcdFilter lcd_filter;
- FT_Int lcd_extra; /* number of extra pixels */
- FT_Byte lcd_weights[7]; /* filter weights, if any */
- FT_Bitmap_LcdFilterFunc lcd_filter_func; /* filtering callback */
-#endif
-
-#ifdef FT_CONFIG_OPTION_PIC
- FT_PIC_Container pic_container;
-#endif
-
- FT_Int refcount;
-
- } FT_LibraryRec;
-
-
- FT_BASE( FT_Renderer )
- FT_Lookup_Renderer( FT_Library library,
- FT_Glyph_Format format,
- FT_ListNode* node );
-
- FT_BASE( FT_Error )
- FT_Render_Glyph_Internal( FT_Library library,
- FT_GlyphSlot slot,
- FT_Render_Mode render_mode );
-
- typedef const char*
- (*FT_Face_GetPostscriptNameFunc)( FT_Face face );
-
- typedef FT_Error
- (*FT_Face_GetGlyphNameFunc)( FT_Face face,
- FT_UInt glyph_index,
- FT_Pointer buffer,
- FT_UInt buffer_max );
-
- typedef FT_UInt
- (*FT_Face_GetGlyphNameIndexFunc)( FT_Face face,
- FT_String* glyph_name );
-
-
-#ifndef FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_New_Memory */
- /* */
- /* <Description> */
- /* Creates a new memory object. */
- /* */
- /* <Return> */
- /* A pointer to the new memory object. 0 in case of error. */
- /* */
- FT_BASE( FT_Memory )
- FT_New_Memory( void );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Done_Memory */
- /* */
- /* <Description> */
- /* Discards memory manager. */
- /* */
- /* <Input> */
- /* memory :: A handle to the memory manager. */
- /* */
- FT_BASE( void )
- FT_Done_Memory( FT_Memory memory );
-
-#endif /* !FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM */
-
-
- /* Define default raster's interface. The default raster is located in */
- /* `src/base/ftraster.c'. */
- /* */
- /* Client applications can register new rasters through the */
- /* FT_Set_Raster() API. */
-
-#ifndef FT_NO_DEFAULT_RASTER
- FT_EXPORT_VAR( FT_Raster_Funcs ) ft_default_raster;
-#endif
-
-
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
- /**** ****/
- /**** ****/
- /**** P I C S U P P O R T ****/
- /**** ****/
- /**** ****/
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
-
-
- /* PIC support macros for ftimage.h */
-
-
- /*************************************************************************/
- /* */
- /* <Macro> */
- /* FT_DEFINE_OUTLINE_FUNCS */
- /* */
- /* <Description> */
- /* Used to initialize an instance of FT_Outline_Funcs struct. */
- /* When FT_CONFIG_OPTION_PIC is defined an init funtion will need to */
- /* be called with a pre-allocated structure to be filled. */
- /* When FT_CONFIG_OPTION_PIC is not defined the struct will be */
- /* allocated in the global scope (or the scope where the macro */
- /* is used). */
- /* */
-#ifndef FT_CONFIG_OPTION_PIC
-
-#define FT_DEFINE_OUTLINE_FUNCS( \
- class_, \
- move_to_, \
- line_to_, \
- conic_to_, \
- cubic_to_, \
- shift_, \
- delta_ ) \
- static const FT_Outline_Funcs class_ = \
- { \
- move_to_, \
- line_to_, \
- conic_to_, \
- cubic_to_, \
- shift_, \
- delta_ \
- };
-
-#else /* FT_CONFIG_OPTION_PIC */
-
-#define FT_DEFINE_OUTLINE_FUNCS( \
- class_, \
- move_to_, \
- line_to_, \
- conic_to_, \
- cubic_to_, \
- shift_, \
- delta_ ) \
- static FT_Error \
- Init_Class_ ## class_( FT_Outline_Funcs* clazz ) \
- { \
- clazz->move_to = move_to_; \
- clazz->line_to = line_to_; \
- clazz->conic_to = conic_to_; \
- clazz->cubic_to = cubic_to_; \
- clazz->shift = shift_; \
- clazz->delta = delta_; \
- \
- return FT_Err_Ok; \
- }
-
-#endif /* FT_CONFIG_OPTION_PIC */
-
-
- /*************************************************************************/
- /* */
- /* <Macro> */
- /* FT_DEFINE_RASTER_FUNCS */
- /* */
- /* <Description> */
- /* Used to initialize an instance of FT_Raster_Funcs struct. */
- /* When FT_CONFIG_OPTION_PIC is defined an init funtion will need to */
- /* be called with a pre-allocated structure to be filled. */
- /* When FT_CONFIG_OPTION_PIC is not defined the struct will be */
- /* allocated in the global scope (or the scope where the macro */
- /* is used). */
- /* */
-#ifndef FT_CONFIG_OPTION_PIC
-
-#define FT_DEFINE_RASTER_FUNCS( \
- class_, \
- glyph_format_, \
- raster_new_, \
- raster_reset_, \
- raster_set_mode_, \
- raster_render_, \
- raster_done_ ) \
- const FT_Raster_Funcs class_ = \
- { \
- glyph_format_, \
- raster_new_, \
- raster_reset_, \
- raster_set_mode_, \
- raster_render_, \
- raster_done_ \
- };
-
-#else /* FT_CONFIG_OPTION_PIC */
-
-#define FT_DEFINE_RASTER_FUNCS( \
- class_, \
- glyph_format_, \
- raster_new_, \
- raster_reset_, \
- raster_set_mode_, \
- raster_render_, \
- raster_done_ ) \
- void \
- FT_Init_Class_ ## class_( FT_Raster_Funcs* clazz ) \
- { \
- clazz->glyph_format = glyph_format_; \
- clazz->raster_new = raster_new_; \
- clazz->raster_reset = raster_reset_; \
- clazz->raster_set_mode = raster_set_mode_; \
- clazz->raster_render = raster_render_; \
- clazz->raster_done = raster_done_; \
- }
-
-#endif /* FT_CONFIG_OPTION_PIC */
-
-
- /* PIC support macros for ftrender.h */
-
-
- /*************************************************************************/
- /* */
- /* <Macro> */
- /* FT_DEFINE_GLYPH */
- /* */
- /* <Description> */
- /* Used to initialize an instance of FT_Glyph_Class struct. */
- /* When FT_CONFIG_OPTION_PIC is defined an init funtion will need to */
- /* be called with a pre-allocated stcture to be filled. */
- /* When FT_CONFIG_OPTION_PIC is not defined the struct will be */
- /* allocated in the global scope (or the scope where the macro */
- /* is used). */
- /* */
-#ifndef FT_CONFIG_OPTION_PIC
-
-#define FT_DEFINE_GLYPH( \
- class_, \
- size_, \
- format_, \
- init_, \
- done_, \
- copy_, \
- transform_, \
- bbox_, \
- prepare_ ) \
- FT_CALLBACK_TABLE_DEF \
- const FT_Glyph_Class class_ = \
- { \
- size_, \
- format_, \
- init_, \
- done_, \
- copy_, \
- transform_, \
- bbox_, \
- prepare_ \
- };
-
-#else /* FT_CONFIG_OPTION_PIC */
-
-#define FT_DEFINE_GLYPH( \
- class_, \
- size_, \
- format_, \
- init_, \
- done_, \
- copy_, \
- transform_, \
- bbox_, \
- prepare_ ) \
- void \
- FT_Init_Class_ ## class_( FT_Glyph_Class* clazz ) \
- { \
- clazz->glyph_size = size_; \
- clazz->glyph_format = format_; \
- clazz->glyph_init = init_; \
- clazz->glyph_done = done_; \
- clazz->glyph_copy = copy_; \
- clazz->glyph_transform = transform_; \
- clazz->glyph_bbox = bbox_; \
- clazz->glyph_prepare = prepare_; \
- }
-
-#endif /* FT_CONFIG_OPTION_PIC */
-
-
- /*************************************************************************/
- /* */
- /* <Macro> */
- /* FT_DECLARE_RENDERER */
- /* */
- /* <Description> */
- /* Used to create a forward declaration of a */
- /* FT_Renderer_Class struct instance. */
- /* */
- /* <Macro> */
- /* FT_DEFINE_RENDERER */
- /* */
- /* <Description> */
- /* Used to initialize an instance of FT_Renderer_Class struct. */
- /* */
- /* When FT_CONFIG_OPTION_PIC is defined a `create' funtion will need */
- /* to be called with a pointer where the allocated structure is */
- /* returned. And when it is no longer needed a `destroy' function */
- /* needs to be called to release that allocation. */
- /* `fcinit.c' (ft_create_default_module_classes) already contains */
- /* a mechanism to call these functions for the default modules */
- /* described in `ftmodule.h'. */
- /* */
- /* Notice that the created `create' and `destroy' functions call */
- /* `pic_init' and `pic_free' to allow you to manually allocate and */
- /* initialize any additional global data, like a module specific */
- /* interface, and put them in the global pic container defined in */
- /* `ftpic.h'. If you don't need them just implement the functions as */
- /* empty to resolve the link error. Also the `pic_init' and */
- /* `pic_free' functions should be declared in `pic.h', to be referred */
- /* by the renderer definition calling `FT_DEFINE_RENDERER' in the */
- /* following. */
- /* */
- /* When FT_CONFIG_OPTION_PIC is not defined the struct will be */
- /* allocated in the global scope (or the scope where the macro */
- /* is used). */
- /* */
-#ifndef FT_CONFIG_OPTION_PIC
-
-#define FT_DECLARE_RENDERER( class_ ) \
- FT_EXPORT_VAR( const FT_Renderer_Class ) class_;
-
-#define FT_DEFINE_RENDERER( \
- class_, \
- flags_, \
- size_, \
- name_, \
- version_, \
- requires_, \
- interface_, \
- init_, \
- done_, \
- get_interface_, \
- glyph_format_, \
- render_glyph_, \
- transform_glyph_, \
- get_glyph_cbox_, \
- set_mode_, \
- raster_class_ ) \
- FT_CALLBACK_TABLE_DEF \
- const FT_Renderer_Class class_ = \
- { \
- FT_DEFINE_ROOT_MODULE( flags_, \
- size_, \
- name_, \
- version_, \
- requires_, \
- interface_, \
- init_, \
- done_, \
- get_interface_ ) \
- glyph_format_, \
- \
- render_glyph_, \
- transform_glyph_, \
- get_glyph_cbox_, \
- set_mode_, \
- \
- raster_class_ \
- };
-
-#else /* FT_CONFIG_OPTION_PIC */
-
-#define FT_DECLARE_RENDERER( class_ ) FT_DECLARE_MODULE( class_ )
-
-#define FT_DEFINE_RENDERER( \
- class_, \
- flags_, \
- size_, \
- name_, \
- version_, \
- requires_, \
- interface_, \
- init_, \
- done_, \
- get_interface_, \
- glyph_format_, \
- render_glyph_, \
- transform_glyph_, \
- get_glyph_cbox_, \
- set_mode_, \
- raster_class_ ) \
- void \
- FT_Destroy_Class_ ## class_( FT_Library library, \
- FT_Module_Class* clazz ) \
- { \
- FT_Renderer_Class* rclazz = (FT_Renderer_Class*)clazz; \
- FT_Memory memory = library->memory; \
- \
- \
- class_ ## _pic_free( library ); \
- if ( rclazz ) \
- FT_FREE( rclazz ); \
- } \
- \
- \
- FT_Error \
- FT_Create_Class_ ## class_( FT_Library library, \
- FT_Module_Class** output_class ) \
- { \
- FT_Renderer_Class* clazz = NULL; \
- FT_Error error; \
- FT_Memory memory = library->memory; \
- \
- \
- if ( FT_ALLOC( clazz, sizeof ( *clazz ) ) ) \
- return error; \
- \
- error = class_ ## _pic_init( library ); \
- if ( error ) \
- { \
- FT_FREE( clazz ); \
- return error; \
- } \
- \
- FT_DEFINE_ROOT_MODULE( flags_, \
- size_, \
- name_, \
- version_, \
- requires_, \
- interface_, \
- init_, \
- done_, \
- get_interface_ ) \
- \
- clazz->glyph_format = glyph_format_; \
- \
- clazz->render_glyph = render_glyph_; \
- clazz->transform_glyph = transform_glyph_; \
- clazz->get_glyph_cbox = get_glyph_cbox_; \
- clazz->set_mode = set_mode_; \
- \
- clazz->raster_class = raster_class_; \
- \
- *output_class = (FT_Module_Class*)clazz; \
- \
- return FT_Err_Ok; \
- }
-
-#endif /* FT_CONFIG_OPTION_PIC */
-
-
- /* PIC support macros for ftmodapi.h **/
-
-
-#ifdef FT_CONFIG_OPTION_PIC
-
- /*************************************************************************/
- /* */
- /* <FuncType> */
- /* FT_Module_Creator */
- /* */
- /* <Description> */
- /* A function used to create (allocate) a new module class object. */
- /* The object's members are initialized, but the module itself is */
- /* not. */
- /* */
- /* <Input> */
- /* memory :: A handle to the memory manager. */
- /* output_class :: Initialized with the newly allocated class. */
- /* */
- typedef FT_Error
- (*FT_Module_Creator)( FT_Memory memory,
- FT_Module_Class** output_class );
-
- /*************************************************************************/
- /* */
- /* <FuncType> */
- /* FT_Module_Destroyer */
- /* */
- /* <Description> */
- /* A function used to destroy (deallocate) a module class object. */
- /* */
- /* <Input> */
- /* memory :: A handle to the memory manager. */
- /* clazz :: Module class to destroy. */
- /* */
- typedef void
- (*FT_Module_Destroyer)( FT_Memory memory,
- FT_Module_Class* clazz );
-
-#endif
-
-
- /*************************************************************************/
- /* */
- /* <Macro> */
- /* FT_DECLARE_MODULE */
- /* */
- /* <Description> */
- /* Used to create a forward declaration of a */
- /* FT_Module_Class struct instance. */
- /* */
- /* <Macro> */
- /* FT_DEFINE_MODULE */
- /* */
- /* <Description> */
- /* Used to initialize an instance of an FT_Module_Class struct. */
- /* */
- /* When FT_CONFIG_OPTION_PIC is defined a `create' funtion needs to */
- /* be called with a pointer where the allocated structure is */
- /* returned. And when it is no longer needed a `destroy' function */
- /* needs to be called to release that allocation. */
- /* `fcinit.c' (ft_create_default_module_classes) already contains */
- /* a mechanism to call these functions for the default modules */
- /* described in `ftmodule.h'. */
- /* */
- /* Notice that the created `create' and `destroy' functions call */
- /* `pic_init' and `pic_free' to allow you to manually allocate and */
- /* initialize any additional global data, like a module specific */
- /* interface, and put them in the global pic container defined in */
- /* `ftpic.h'. If you don't need them just implement the functions as */
- /* empty to resolve the link error. Also the `pic_init' and */
- /* `pic_free' functions should be declared in `pic.h', to be referred */
- /* by the module definition calling `FT_DEFINE_MODULE' in the */
- /* following. */
- /* */
- /* When FT_CONFIG_OPTION_PIC is not defined the struct will be */
- /* allocated in the global scope (or the scope where the macro */
- /* is used). */
- /* */
- /* <Macro> */
- /* FT_DEFINE_ROOT_MODULE */
- /* */
- /* <Description> */
- /* Used to initialize an instance of an FT_Module_Class struct inside */
- /* another struct that contains it or in a function that initializes */
- /* that containing struct. */
- /* */
-#ifndef FT_CONFIG_OPTION_PIC
-
-#define FT_DECLARE_MODULE( class_ ) \
- FT_CALLBACK_TABLE \
- const FT_Module_Class class_;
-
-#define FT_DEFINE_ROOT_MODULE( \
- flags_, \
- size_, \
- name_, \
- version_, \
- requires_, \
- interface_, \
- init_, \
- done_, \
- get_interface_ ) \
- { \
- flags_, \
- size_, \
- \
- name_, \
- version_, \
- requires_, \
- \
- interface_, \
- \
- init_, \
- done_, \
- get_interface_, \
- },
-
-#define FT_DEFINE_MODULE( \
- class_, \
- flags_, \
- size_, \
- name_, \
- version_, \
- requires_, \
- interface_, \
- init_, \
- done_, \
- get_interface_ ) \
- FT_CALLBACK_TABLE_DEF \
- const FT_Module_Class class_ = \
- { \
- flags_, \
- size_, \
- \
- name_, \
- version_, \
- requires_, \
- \
- interface_, \
- \
- init_, \
- done_, \
- get_interface_, \
- };
-
-
-#else /* FT_CONFIG_OPTION_PIC */
-
-#define FT_DECLARE_MODULE( class_ ) \
- FT_Error \
- FT_Create_Class_ ## class_( FT_Library library, \
- FT_Module_Class** output_class ); \
- void \
- FT_Destroy_Class_ ## class_( FT_Library library, \
- FT_Module_Class* clazz );
-
-#define FT_DEFINE_ROOT_MODULE( \
- flags_, \
- size_, \
- name_, \
- version_, \
- requires_, \
- interface_, \
- init_, \
- done_, \
- get_interface_ ) \
- clazz->root.module_flags = flags_; \
- clazz->root.module_size = size_; \
- clazz->root.module_name = name_; \
- clazz->root.module_version = version_; \
- clazz->root.module_requires = requires_; \
- \
- clazz->root.module_interface = interface_; \
- \
- clazz->root.module_init = init_; \
- clazz->root.module_done = done_; \
- clazz->root.get_interface = get_interface_;
-
-#define FT_DEFINE_MODULE( \
- class_, \
- flags_, \
- size_, \
- name_, \
- version_, \
- requires_, \
- interface_, \
- init_, \
- done_, \
- get_interface_ ) \
- void \
- FT_Destroy_Class_ ## class_( FT_Library library, \
- FT_Module_Class* clazz ) \
- { \
- FT_Memory memory = library->memory; \
- \
- \
- class_ ## _pic_free( library ); \
- if ( clazz ) \
- FT_FREE( clazz ); \
- } \
- \
- \
- FT_Error \
- FT_Create_Class_ ## class_( FT_Library library, \
- FT_Module_Class** output_class ) \
- { \
- FT_Memory memory = library->memory; \
- FT_Module_Class* clazz = NULL; \
- FT_Error error; \
- \
- \
- if ( FT_ALLOC( clazz, sizeof ( *clazz ) ) ) \
- return error; \
- error = class_ ## _pic_init( library ); \
- if ( error ) \
- { \
- FT_FREE( clazz ); \
- return error; \
- } \
- \
- clazz->module_flags = flags_; \
- clazz->module_size = size_; \
- clazz->module_name = name_; \
- clazz->module_version = version_; \
- clazz->module_requires = requires_; \
- \
- clazz->module_interface = interface_; \
- \
- clazz->module_init = init_; \
- clazz->module_done = done_; \
- clazz->get_interface = get_interface_; \
- \
- *output_class = clazz; \
- \
- return FT_Err_Ok; \
- }
-
-#endif /* FT_CONFIG_OPTION_PIC */
-
-
-FT_END_HEADER
-
-#endif /* __FTOBJS_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/ftpic.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/ftpic.h
deleted file mode 100644
index 7f9154f419e..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/ftpic.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftpic.h */
-/* */
-/* The FreeType position independent code services (declaration). */
-/* */
-/* Copyright 2009-2015 by */
-/* Oran Agra and Mickey Gabel. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
- /*************************************************************************/
- /* */
- /* Modules that ordinarily have const global data that need address */
- /* can instead define pointers here. */
- /* */
- /*************************************************************************/
-
-
-#ifndef __FTPIC_H__
-#define __FTPIC_H__
-
-
-FT_BEGIN_HEADER
-
-#ifdef FT_CONFIG_OPTION_PIC
-
- typedef struct FT_PIC_Container_
- {
- /* pic containers for base */
- void* base;
-
- /* pic containers for modules */
- void* autofit;
- void* cff;
- void* pshinter;
- void* psnames;
- void* raster;
- void* sfnt;
- void* smooth;
- void* truetype;
-
- } FT_PIC_Container;
-
-
- /* Initialize the various function tables, structs, etc. */
- /* stored in the container. */
- FT_BASE( FT_Error )
- ft_pic_container_init( FT_Library library );
-
-
- /* Destroy the contents of the container. */
- FT_BASE( void )
- ft_pic_container_destroy( FT_Library library );
-
-#endif /* FT_CONFIG_OPTION_PIC */
-
- /* */
-
-FT_END_HEADER
-
-#endif /* __FTPIC_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/ftrfork.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/ftrfork.h
deleted file mode 100644
index da61ca75b53..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/ftrfork.h
+++ /dev/null
@@ -1,266 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftrfork.h */
-/* */
-/* Embedded resource forks accessor (specification). */
-/* */
-/* Copyright 2004-2015 by */
-/* Masatake YAMATO and Redhat K.K. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-/***************************************************************************/
-/* Development of the code in this file is support of */
-/* Information-technology Promotion Agency, Japan. */
-/***************************************************************************/
-
-
-#ifndef __FTRFORK_H__
-#define __FTRFORK_H__
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_OBJECTS_H
-
-
-FT_BEGIN_HEADER
-
-
- /* Number of guessing rules supported in `FT_Raccess_Guess'. */
- /* Don't forget to increment the number if you add a new guessing rule. */
-#define FT_RACCESS_N_RULES 9
-
-
- /* A structure to describe a reference in a resource by its resource ID */
- /* and internal offset. The `POST' resource expects to be concatenated */
- /* by the order of resource IDs instead of its appearance in the file. */
-
- typedef struct FT_RFork_Ref_
- {
- FT_UShort res_id;
- FT_Long offset;
-
- } FT_RFork_Ref;
-
-#ifdef FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK
- typedef FT_Error
- (*ft_raccess_guess_func)( FT_Library library,
- FT_Stream stream,
- char *base_file_name,
- char **result_file_name,
- FT_Long *result_offset );
-
- typedef enum FT_RFork_Rule_ {
- FT_RFork_Rule_invalid = -2,
- FT_RFork_Rule_uknown, /* -1 */
- FT_RFork_Rule_apple_double,
- FT_RFork_Rule_apple_single,
- FT_RFork_Rule_darwin_ufs_export,
- FT_RFork_Rule_darwin_newvfs,
- FT_RFork_Rule_darwin_hfsplus,
- FT_RFork_Rule_vfat,
- FT_RFork_Rule_linux_cap,
- FT_RFork_Rule_linux_double,
- FT_RFork_Rule_linux_netatalk
- } FT_RFork_Rule;
-
- /* For fast translation between rule index and rule type,
- * the macros FT_RFORK_xxx should be kept consistent with
- * the raccess_guess_funcs table
- */
- typedef struct ft_raccess_guess_rec_ {
- ft_raccess_guess_func func;
- FT_RFork_Rule type;
- } ft_raccess_guess_rec;
-
-#ifndef FT_CONFIG_OPTION_PIC
-
- /* this array is a storage in non-PIC mode, so ; is needed in END */
-#define CONST_FT_RFORK_RULE_ARRAY_BEGIN( name, type ) \
- static const type name[] = {
-#define CONST_FT_RFORK_RULE_ARRAY_ENTRY( func_suffix, type_suffix ) \
- { raccess_guess_ ## func_suffix, \
- FT_RFork_Rule_ ## type_suffix },
-#define CONST_FT_RFORK_RULE_ARRAY_END };
-
-#else /* FT_CONFIG_OPTION_PIC */
-
- /* this array is a function in PIC mode, so no ; is needed in END */
-#define CONST_FT_RFORK_RULE_ARRAY_BEGIN( name, type ) \
- void \
- FT_Init_Table_ ## name( type* storage ) \
- { \
- type* local = storage; \
- \
- \
- int i = 0;
-#define CONST_FT_RFORK_RULE_ARRAY_ENTRY( func_suffix, type_suffix ) \
- local[i].func = raccess_guess_ ## func_suffix; \
- local[i].type = FT_RFork_Rule_ ## type_suffix; \
- i++;
-#define CONST_FT_RFORK_RULE_ARRAY_END }
-
-#endif /* FT_CONFIG_OPTION_PIC */
-
-#endif /* FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK */
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Raccess_Guess */
- /* */
- /* <Description> */
- /* Guess a file name and offset where the actual resource fork is */
- /* stored. The macro FT_RACCESS_N_RULES holds the number of */
- /* guessing rules; the guessed result for the Nth rule is */
- /* represented as a triplet: a new file name (new_names[N]), a file */
- /* offset (offsets[N]), and an error code (errors[N]). */
- /* */
- /* <Input> */
- /* library :: */
- /* A FreeType library instance. */
- /* */
- /* stream :: */
- /* A file stream containing the resource fork. */
- /* */
- /* base_name :: */
- /* The (base) file name of the resource fork used for some */
- /* guessing rules. */
- /* */
- /* <Output> */
- /* new_names :: */
- /* An array of guessed file names in which the resource forks may */
- /* exist. If `new_names[N]' is NULL, the guessed file name is */
- /* equal to `base_name'. */
- /* */
- /* offsets :: */
- /* An array of guessed file offsets. `offsets[N]' holds the file */
- /* offset of the possible start of the resource fork in file */
- /* `new_names[N]'. */
- /* */
- /* errors :: */
- /* An array of FreeType error codes. `errors[N]' is the error */
- /* code of Nth guessing rule function. If `errors[N]' is not */
- /* FT_Err_Ok, `new_names[N]' and `offsets[N]' are meaningless. */
- /* */
- FT_BASE( void )
- FT_Raccess_Guess( FT_Library library,
- FT_Stream stream,
- char* base_name,
- char** new_names,
- FT_Long* offsets,
- FT_Error* errors );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Raccess_Get_HeaderInfo */
- /* */
- /* <Description> */
- /* Get the information from the header of resource fork. The */
- /* information includes the file offset where the resource map */
- /* starts, and the file offset where the resource data starts. */
- /* `FT_Raccess_Get_DataOffsets' requires these two data. */
- /* */
- /* <Input> */
- /* library :: */
- /* A FreeType library instance. */
- /* */
- /* stream :: */
- /* A file stream containing the resource fork. */
- /* */
- /* rfork_offset :: */
- /* The file offset where the resource fork starts. */
- /* */
- /* <Output> */
- /* map_offset :: */
- /* The file offset where the resource map starts. */
- /* */
- /* rdata_pos :: */
- /* The file offset where the resource data starts. */
- /* */
- /* <Return> */
- /* FreeType error code. FT_Err_Ok means success. */
- /* */
- FT_BASE( FT_Error )
- FT_Raccess_Get_HeaderInfo( FT_Library library,
- FT_Stream stream,
- FT_Long rfork_offset,
- FT_Long *map_offset,
- FT_Long *rdata_pos );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Raccess_Get_DataOffsets */
- /* */
- /* <Description> */
- /* Get the data offsets for a tag in a resource fork. Offsets are */
- /* stored in an array because, in some cases, resources in a resource */
- /* fork have the same tag. */
- /* */
- /* <Input> */
- /* library :: */
- /* A FreeType library instance. */
- /* */
- /* stream :: */
- /* A file stream containing the resource fork. */
- /* */
- /* map_offset :: */
- /* The file offset where the resource map starts. */
- /* */
- /* rdata_pos :: */
- /* The file offset where the resource data starts. */
- /* */
- /* tag :: */
- /* The resource tag. */
- /* */
- /* sort_by_res_id :: */
- /* A Boolean to sort the fragmented resource by their ids. */
- /* The fragmented resources for `POST' resource should be sorted */
- /* to restore Type1 font properly. For `snft' resources, sorting */
- /* may induce a different order of the faces in comparison to that */
- /* by QuickDraw API. */
- /* */
- /* <Output> */
- /* offsets :: */
- /* The stream offsets for the resource data specified by `tag'. */
- /* This array is allocated by the function, so you have to call */
- /* @ft_mem_free after use. */
- /* */
- /* count :: */
- /* The length of offsets array. */
- /* */
- /* <Return> */
- /* FreeType error code. FT_Err_Ok means success. */
- /* */
- /* <Note> */
- /* Normally you should use `FT_Raccess_Get_HeaderInfo' to get the */
- /* value for `map_offset' and `rdata_pos'. */
- /* */
- FT_BASE( FT_Error )
- FT_Raccess_Get_DataOffsets( FT_Library library,
- FT_Stream stream,
- FT_Long map_offset,
- FT_Long rdata_pos,
- FT_Long tag,
- FT_Bool sort_by_res_id,
- FT_Long **offsets,
- FT_Long *count );
-
-
-FT_END_HEADER
-
-#endif /* __FTRFORK_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/ftserv.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/ftserv.h
deleted file mode 100644
index 11a0c7f3de5..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/ftserv.h
+++ /dev/null
@@ -1,763 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftserv.h */
-/* */
-/* The FreeType services (specification only). */
-/* */
-/* Copyright 2003-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
- /*************************************************************************/
- /* */
- /* Each module can export one or more `services'. Each service is */
- /* identified by a constant string and modeled by a pointer; the latter */
- /* generally corresponds to a structure containing function pointers. */
- /* */
- /* Note that a service's data cannot be a mere function pointer because */
- /* in C it is possible that function pointers might be implemented */
- /* differently than data pointers (e.g. 48 bits instead of 32). */
- /* */
- /*************************************************************************/
-
-
-#ifndef __FTSERV_H__
-#define __FTSERV_H__
-
-
-FT_BEGIN_HEADER
-
- /*
- * @macro:
- * FT_FACE_FIND_SERVICE
- *
- * @description:
- * This macro is used to look up a service from a face's driver module.
- *
- * @input:
- * face ::
- * The source face handle.
- *
- * id ::
- * A string describing the service as defined in the service's
- * header files (e.g. FT_SERVICE_ID_MULTI_MASTERS which expands to
- * `multi-masters'). It is automatically prefixed with
- * `FT_SERVICE_ID_'.
- *
- * @output:
- * ptr ::
- * A variable that receives the service pointer. Will be NULL
- * if not found.
- */
-#ifdef __cplusplus
-
-#define FT_FACE_FIND_SERVICE( face, ptr, id ) \
- FT_BEGIN_STMNT \
- FT_Module module = FT_MODULE( FT_FACE( face )->driver ); \
- FT_Pointer _tmp_ = NULL; \
- FT_Pointer* _pptr_ = (FT_Pointer*)&(ptr); \
- \
- \
- if ( module->clazz->get_interface ) \
- _tmp_ = module->clazz->get_interface( module, FT_SERVICE_ID_ ## id ); \
- *_pptr_ = _tmp_; \
- FT_END_STMNT
-
-#else /* !C++ */
-
-#define FT_FACE_FIND_SERVICE( face, ptr, id ) \
- FT_BEGIN_STMNT \
- FT_Module module = FT_MODULE( FT_FACE( face )->driver ); \
- FT_Pointer _tmp_ = NULL; \
- \
- if ( module->clazz->get_interface ) \
- _tmp_ = module->clazz->get_interface( module, FT_SERVICE_ID_ ## id ); \
- ptr = _tmp_; \
- FT_END_STMNT
-
-#endif /* !C++ */
-
-
- /*
- * @macro:
- * FT_FACE_FIND_GLOBAL_SERVICE
- *
- * @description:
- * This macro is used to look up a service from all modules.
- *
- * @input:
- * face ::
- * The source face handle.
- *
- * id ::
- * A string describing the service as defined in the service's
- * header files (e.g. FT_SERVICE_ID_MULTI_MASTERS which expands to
- * `multi-masters'). It is automatically prefixed with
- * `FT_SERVICE_ID_'.
- *
- * @output:
- * ptr ::
- * A variable that receives the service pointer. Will be NULL
- * if not found.
- */
-#ifdef __cplusplus
-
-#define FT_FACE_FIND_GLOBAL_SERVICE( face, ptr, id ) \
- FT_BEGIN_STMNT \
- FT_Module module = FT_MODULE( FT_FACE( face )->driver ); \
- FT_Pointer _tmp_; \
- FT_Pointer* _pptr_ = (FT_Pointer*)&(ptr); \
- \
- \
- _tmp_ = ft_module_get_service( module, FT_SERVICE_ID_ ## id ); \
- *_pptr_ = _tmp_; \
- FT_END_STMNT
-
-#else /* !C++ */
-
-#define FT_FACE_FIND_GLOBAL_SERVICE( face, ptr, id ) \
- FT_BEGIN_STMNT \
- FT_Module module = FT_MODULE( FT_FACE( face )->driver ); \
- FT_Pointer _tmp_; \
- \
- \
- _tmp_ = ft_module_get_service( module, FT_SERVICE_ID_ ## id ); \
- ptr = _tmp_; \
- FT_END_STMNT
-
-#endif /* !C++ */
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** S E R V I C E D E S C R I P T O R S *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
- /*
- * The following structure is used to _describe_ a given service
- * to the library. This is useful to build simple static service lists.
- */
- typedef struct FT_ServiceDescRec_
- {
- const char* serv_id; /* service name */
- const void* serv_data; /* service pointer/data */
-
- } FT_ServiceDescRec;
-
- typedef const FT_ServiceDescRec* FT_ServiceDesc;
-
-
- /*************************************************************************/
- /* */
- /* <Macro> */
- /* FT_DEFINE_SERVICEDESCREC1 */
- /* FT_DEFINE_SERVICEDESCREC2 */
- /* FT_DEFINE_SERVICEDESCREC3 */
- /* FT_DEFINE_SERVICEDESCREC4 */
- /* FT_DEFINE_SERVICEDESCREC5 */
- /* FT_DEFINE_SERVICEDESCREC6 */
- /* FT_DEFINE_SERVICEDESCREC7 */
- /* */
- /* <Description> */
- /* Used to initialize an array of FT_ServiceDescRec structures. */
- /* */
- /* When FT_CONFIG_OPTION_PIC is defined a `create' function needs to */
- /* be called with a pointer to return an allocated array. As soon as */
- /* it is no longer needed, a `destroy' function needs to be called to */
- /* release that allocation. */
- /* */
- /* These functions should be manually called from the `pic_init' and */
- /* `pic_free' functions of your module (see FT_DEFINE_MODULE). */
- /* */
- /* When FT_CONFIG_OPTION_PIC is not defined the array will be */
- /* allocated in the global scope (or the scope where the macro is */
- /* used). */
- /* */
-#ifndef FT_CONFIG_OPTION_PIC
-
-#define FT_DEFINE_SERVICEDESCREC1( class_, \
- serv_id_1, serv_data_1 ) \
- static const FT_ServiceDescRec class_[] = \
- { \
- { serv_id_1, serv_data_1 }, \
- { NULL, NULL } \
- };
-
-#define FT_DEFINE_SERVICEDESCREC2( class_, \
- serv_id_1, serv_data_1, \
- serv_id_2, serv_data_2 ) \
- static const FT_ServiceDescRec class_[] = \
- { \
- { serv_id_1, serv_data_1 }, \
- { serv_id_2, serv_data_2 }, \
- { NULL, NULL } \
- };
-
-#define FT_DEFINE_SERVICEDESCREC3( class_, \
- serv_id_1, serv_data_1, \
- serv_id_2, serv_data_2, \
- serv_id_3, serv_data_3 ) \
- static const FT_ServiceDescRec class_[] = \
- { \
- { serv_id_1, serv_data_1 }, \
- { serv_id_2, serv_data_2 }, \
- { serv_id_3, serv_data_3 }, \
- { NULL, NULL } \
- };
-
-#define FT_DEFINE_SERVICEDESCREC4( class_, \
- serv_id_1, serv_data_1, \
- serv_id_2, serv_data_2, \
- serv_id_3, serv_data_3, \
- serv_id_4, serv_data_4 ) \
- static const FT_ServiceDescRec class_[] = \
- { \
- { serv_id_1, serv_data_1 }, \
- { serv_id_2, serv_data_2 }, \
- { serv_id_3, serv_data_3 }, \
- { serv_id_4, serv_data_4 }, \
- { NULL, NULL } \
- };
-
-#define FT_DEFINE_SERVICEDESCREC5( class_, \
- serv_id_1, serv_data_1, \
- serv_id_2, serv_data_2, \
- serv_id_3, serv_data_3, \
- serv_id_4, serv_data_4, \
- serv_id_5, serv_data_5 ) \
- static const FT_ServiceDescRec class_[] = \
- { \
- { serv_id_1, serv_data_1 }, \
- { serv_id_2, serv_data_2 }, \
- { serv_id_3, serv_data_3 }, \
- { serv_id_4, serv_data_4 }, \
- { serv_id_5, serv_data_5 }, \
- { NULL, NULL } \
- };
-
-#define FT_DEFINE_SERVICEDESCREC6( class_, \
- serv_id_1, serv_data_1, \
- serv_id_2, serv_data_2, \
- serv_id_3, serv_data_3, \
- serv_id_4, serv_data_4, \
- serv_id_5, serv_data_5, \
- serv_id_6, serv_data_6 ) \
- static const FT_ServiceDescRec class_[] = \
- { \
- { serv_id_1, serv_data_1 }, \
- { serv_id_2, serv_data_2 }, \
- { serv_id_3, serv_data_3 }, \
- { serv_id_4, serv_data_4 }, \
- { serv_id_5, serv_data_5 }, \
- { serv_id_6, serv_data_6 }, \
- { NULL, NULL } \
- };
-
-#define FT_DEFINE_SERVICEDESCREC7( class_, \
- serv_id_1, serv_data_1, \
- serv_id_2, serv_data_2, \
- serv_id_3, serv_data_3, \
- serv_id_4, serv_data_4, \
- serv_id_5, serv_data_5, \
- serv_id_6, serv_data_6, \
- serv_id_7, serv_data_7 ) \
- static const FT_ServiceDescRec class_[] = \
- { \
- { serv_id_1, serv_data_1 }, \
- { serv_id_2, serv_data_2 }, \
- { serv_id_3, serv_data_3 }, \
- { serv_id_4, serv_data_4 }, \
- { serv_id_5, serv_data_5 }, \
- { serv_id_6, serv_data_6 }, \
- { serv_id_7, serv_data_7 }, \
- { NULL, NULL } \
- };
-
-#else /* FT_CONFIG_OPTION_PIC */
-
-#define FT_DEFINE_SERVICEDESCREC1( class_, \
- serv_id_1, serv_data_1 ) \
- void \
- FT_Destroy_Class_ ## class_( FT_Library library, \
- FT_ServiceDescRec* clazz ) \
- { \
- FT_Memory memory = library->memory; \
- \
- \
- if ( clazz ) \
- FT_FREE( clazz ); \
- } \
- \
- FT_Error \
- FT_Create_Class_ ## class_( FT_Library library, \
- FT_ServiceDescRec** output_class ) \
- { \
- FT_ServiceDescRec* clazz = NULL; \
- FT_Error error; \
- FT_Memory memory = library->memory; \
- \
- \
- if ( FT_ALLOC( clazz, sizeof ( *clazz ) * 2 ) ) \
- return error; \
- \
- clazz[0].serv_id = serv_id_1; \
- clazz[0].serv_data = serv_data_1; \
- clazz[1].serv_id = NULL; \
- clazz[1].serv_data = NULL; \
- \
- *output_class = clazz; \
- \
- return FT_Err_Ok; \
- }
-
-#define FT_DEFINE_SERVICEDESCREC2( class_, \
- serv_id_1, serv_data_1, \
- serv_id_2, serv_data_2 ) \
- void \
- FT_Destroy_Class_ ## class_( FT_Library library, \
- FT_ServiceDescRec* clazz ) \
- { \
- FT_Memory memory = library->memory; \
- \
- \
- if ( clazz ) \
- FT_FREE( clazz ); \
- } \
- \
- FT_Error \
- FT_Create_Class_ ## class_( FT_Library library, \
- FT_ServiceDescRec** output_class ) \
- { \
- FT_ServiceDescRec* clazz = NULL; \
- FT_Error error; \
- FT_Memory memory = library->memory; \
- \
- \
- if ( FT_ALLOC( clazz, sizeof ( *clazz ) * 3 ) ) \
- return error; \
- \
- clazz[0].serv_id = serv_id_1; \
- clazz[0].serv_data = serv_data_1; \
- clazz[1].serv_id = serv_id_2; \
- clazz[1].serv_data = serv_data_2; \
- clazz[2].serv_id = NULL; \
- clazz[2].serv_data = NULL; \
- \
- *output_class = clazz; \
- \
- return FT_Err_Ok; \
- }
-
-#define FT_DEFINE_SERVICEDESCREC3( class_, \
- serv_id_1, serv_data_1, \
- serv_id_2, serv_data_2, \
- serv_id_3, serv_data_3 ) \
- void \
- FT_Destroy_Class_ ## class_( FT_Library library, \
- FT_ServiceDescRec* clazz ) \
- { \
- FT_Memory memory = library->memory; \
- \
- \
- if ( clazz ) \
- FT_FREE( clazz ); \
- } \
- \
- FT_Error \
- FT_Create_Class_ ## class_( FT_Library library, \
- FT_ServiceDescRec** output_class ) \
- { \
- FT_ServiceDescRec* clazz = NULL; \
- FT_Error error; \
- FT_Memory memory = library->memory; \
- \
- \
- if ( FT_ALLOC( clazz, sizeof ( *clazz ) * 4 ) ) \
- return error; \
- \
- clazz[0].serv_id = serv_id_1; \
- clazz[0].serv_data = serv_data_1; \
- clazz[1].serv_id = serv_id_2; \
- clazz[1].serv_data = serv_data_2; \
- clazz[2].serv_id = serv_id_3; \
- clazz[2].serv_data = serv_data_3; \
- clazz[3].serv_id = NULL; \
- clazz[3].serv_data = NULL; \
- \
- *output_class = clazz; \
- \
- return FT_Err_Ok; \
- }
-
-#define FT_DEFINE_SERVICEDESCREC4( class_, \
- serv_id_1, serv_data_1, \
- serv_id_2, serv_data_2, \
- serv_id_3, serv_data_3, \
- serv_id_4, serv_data_4 ) \
- void \
- FT_Destroy_Class_ ## class_( FT_Library library, \
- FT_ServiceDescRec* clazz ) \
- { \
- FT_Memory memory = library->memory; \
- \
- \
- if ( clazz ) \
- FT_FREE( clazz ); \
- } \
- \
- FT_Error \
- FT_Create_Class_ ## class_( FT_Library library, \
- FT_ServiceDescRec** output_class ) \
- { \
- FT_ServiceDescRec* clazz = NULL; \
- FT_Error error; \
- FT_Memory memory = library->memory; \
- \
- \
- if ( FT_ALLOC( clazz, sizeof ( *clazz ) * 5 ) ) \
- return error; \
- \
- clazz[0].serv_id = serv_id_1; \
- clazz[0].serv_data = serv_data_1; \
- clazz[1].serv_id = serv_id_2; \
- clazz[1].serv_data = serv_data_2; \
- clazz[2].serv_id = serv_id_3; \
- clazz[2].serv_data = serv_data_3; \
- clazz[3].serv_id = serv_id_4; \
- clazz[3].serv_data = serv_data_4; \
- clazz[4].serv_id = NULL; \
- clazz[4].serv_data = NULL; \
- \
- *output_class = clazz; \
- \
- return FT_Err_Ok; \
- }
-
-#define FT_DEFINE_SERVICEDESCREC5( class_, \
- serv_id_1, serv_data_1, \
- serv_id_2, serv_data_2, \
- serv_id_3, serv_data_3, \
- serv_id_4, serv_data_4, \
- serv_id_5, serv_data_5 ) \
- void \
- FT_Destroy_Class_ ## class_( FT_Library library, \
- FT_ServiceDescRec* clazz ) \
- { \
- FT_Memory memory = library->memory; \
- \
- \
- if ( clazz ) \
- FT_FREE( clazz ); \
- } \
- \
- FT_Error \
- FT_Create_Class_ ## class_( FT_Library library, \
- FT_ServiceDescRec** output_class ) \
- { \
- FT_ServiceDescRec* clazz = NULL; \
- FT_Error error; \
- FT_Memory memory = library->memory; \
- \
- \
- if ( FT_ALLOC( clazz, sizeof ( *clazz ) * 6 ) ) \
- return error; \
- \
- clazz[0].serv_id = serv_id_1; \
- clazz[0].serv_data = serv_data_1; \
- clazz[1].serv_id = serv_id_2; \
- clazz[1].serv_data = serv_data_2; \
- clazz[2].serv_id = serv_id_3; \
- clazz[2].serv_data = serv_data_3; \
- clazz[3].serv_id = serv_id_4; \
- clazz[3].serv_data = serv_data_4; \
- clazz[4].serv_id = serv_id_5; \
- clazz[4].serv_data = serv_data_5; \
- clazz[5].serv_id = NULL; \
- clazz[5].serv_data = NULL; \
- \
- *output_class = clazz; \
- \
- return FT_Err_Ok; \
- }
-
-#define FT_DEFINE_SERVICEDESCREC6( class_, \
- serv_id_1, serv_data_1, \
- serv_id_2, serv_data_2, \
- serv_id_3, serv_data_3, \
- serv_id_4, serv_data_4, \
- serv_id_5, serv_data_5, \
- serv_id_6, serv_data_6 ) \
- void \
- FT_Destroy_Class_ ## class_( FT_Library library, \
- FT_ServiceDescRec* clazz ) \
- { \
- FT_Memory memory = library->memory; \
- \
- \
- if ( clazz ) \
- FT_FREE( clazz ); \
- } \
- \
- FT_Error \
- FT_Create_Class_ ## class_( FT_Library library, \
- FT_ServiceDescRec** output_class) \
- { \
- FT_ServiceDescRec* clazz = NULL; \
- FT_Error error; \
- FT_Memory memory = library->memory; \
- \
- \
- if ( FT_ALLOC( clazz, sizeof ( *clazz ) * 7 ) ) \
- return error; \
- \
- clazz[0].serv_id = serv_id_1; \
- clazz[0].serv_data = serv_data_1; \
- clazz[1].serv_id = serv_id_2; \
- clazz[1].serv_data = serv_data_2; \
- clazz[2].serv_id = serv_id_3; \
- clazz[2].serv_data = serv_data_3; \
- clazz[3].serv_id = serv_id_4; \
- clazz[3].serv_data = serv_data_4; \
- clazz[4].serv_id = serv_id_5; \
- clazz[4].serv_data = serv_data_5; \
- clazz[5].serv_id = serv_id_6; \
- clazz[5].serv_data = serv_data_6; \
- clazz[6].serv_id = NULL; \
- clazz[6].serv_data = NULL; \
- \
- *output_class = clazz; \
- \
- return FT_Err_Ok; \
- }
-
-#define FT_DEFINE_SERVICEDESCREC7( class_, \
- serv_id_1, serv_data_1, \
- serv_id_2, serv_data_2, \
- serv_id_3, serv_data_3, \
- serv_id_4, serv_data_4, \
- serv_id_5, serv_data_5, \
- serv_id_6, serv_data_6, \
- serv_id_7, serv_data_7 ) \
- void \
- FT_Destroy_Class_ ## class_( FT_Library library, \
- FT_ServiceDescRec* clazz ) \
- { \
- FT_Memory memory = library->memory; \
- \
- \
- if ( clazz ) \
- FT_FREE( clazz ); \
- } \
- \
- FT_Error \
- FT_Create_Class_ ## class_( FT_Library library, \
- FT_ServiceDescRec** output_class) \
- { \
- FT_ServiceDescRec* clazz = NULL; \
- FT_Error error; \
- FT_Memory memory = library->memory; \
- \
- \
- if ( FT_ALLOC( clazz, sizeof ( *clazz ) * 8 ) ) \
- return error; \
- \
- clazz[0].serv_id = serv_id_1; \
- clazz[0].serv_data = serv_data_1; \
- clazz[1].serv_id = serv_id_2; \
- clazz[1].serv_data = serv_data_2; \
- clazz[2].serv_id = serv_id_3; \
- clazz[2].serv_data = serv_data_3; \
- clazz[3].serv_id = serv_id_4; \
- clazz[3].serv_data = serv_data_4; \
- clazz[4].serv_id = serv_id_5; \
- clazz[4].serv_data = serv_data_5; \
- clazz[5].serv_id = serv_id_6; \
- clazz[5].serv_data = serv_data_6; \
- clazz[6].serv_id = serv_id_7; \
- clazz[6].serv_data = serv_data_7; \
- clazz[7].serv_id = NULL; \
- clazz[7].serv_data = NULL; \
- \
- *output_class = clazz; \
- \
- return FT_Err_Ok; \
- }
-
-#endif /* FT_CONFIG_OPTION_PIC */
-
-
- /*
- * Parse a list of FT_ServiceDescRec descriptors and look for
- * a specific service by ID. Note that the last element in the
- * array must be { NULL, NULL }, and that the function should
- * return NULL if the service isn't available.
- *
- * This function can be used by modules to implement their
- * `get_service' method.
- */
- FT_BASE( FT_Pointer )
- ft_service_list_lookup( FT_ServiceDesc service_descriptors,
- const char* service_id );
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** S E R V I C E S C A C H E *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
- /*
- * This structure is used to store a cache for several frequently used
- * services. It is the type of `face->internal->services'. You
- * should only use FT_FACE_LOOKUP_SERVICE to access it.
- *
- * All fields should have the type FT_Pointer to relax compilation
- * dependencies. We assume the developer isn't completely stupid.
- *
- * Each field must be named `service_XXXX' where `XXX' corresponds to
- * the correct FT_SERVICE_ID_XXXX macro. See the definition of
- * FT_FACE_LOOKUP_SERVICE below how this is implemented.
- *
- */
- typedef struct FT_ServiceCacheRec_
- {
- FT_Pointer service_POSTSCRIPT_FONT_NAME;
- FT_Pointer service_MULTI_MASTERS;
- FT_Pointer service_GLYPH_DICT;
- FT_Pointer service_PFR_METRICS;
- FT_Pointer service_WINFNT;
-
- } FT_ServiceCacheRec, *FT_ServiceCache;
-
-
- /*
- * A magic number used within the services cache.
- */
-
- /* ensure that value `1' has the same width as a pointer */
-#define FT_SERVICE_UNAVAILABLE ((FT_Pointer)~(FT_PtrDist)1)
-
-
- /*
- * @macro:
- * FT_FACE_LOOKUP_SERVICE
- *
- * @description:
- * This macro is used to lookup a service from a face's driver module
- * using its cache.
- *
- * @input:
- * face::
- * The source face handle containing the cache.
- *
- * field ::
- * The field name in the cache.
- *
- * id ::
- * The service ID.
- *
- * @output:
- * ptr ::
- * A variable receiving the service data. NULL if not available.
- */
-#ifdef __cplusplus
-
-#define FT_FACE_LOOKUP_SERVICE( face, ptr, id ) \
- FT_BEGIN_STMNT \
- FT_Pointer svc; \
- FT_Pointer* Pptr = (FT_Pointer*)&(ptr); \
- \
- \
- svc = FT_FACE( face )->internal->services. service_ ## id; \
- if ( svc == FT_SERVICE_UNAVAILABLE ) \
- svc = NULL; \
- else if ( svc == NULL ) \
- { \
- FT_FACE_FIND_SERVICE( face, svc, id ); \
- \
- FT_FACE( face )->internal->services. service_ ## id = \
- (FT_Pointer)( svc != NULL ? svc \
- : FT_SERVICE_UNAVAILABLE ); \
- } \
- *Pptr = svc; \
- FT_END_STMNT
-
-#else /* !C++ */
-
-#define FT_FACE_LOOKUP_SERVICE( face, ptr, id ) \
- FT_BEGIN_STMNT \
- FT_Pointer svc; \
- \
- \
- svc = FT_FACE( face )->internal->services. service_ ## id; \
- if ( svc == FT_SERVICE_UNAVAILABLE ) \
- svc = NULL; \
- else if ( svc == NULL ) \
- { \
- FT_FACE_FIND_SERVICE( face, svc, id ); \
- \
- FT_FACE( face )->internal->services. service_ ## id = \
- (FT_Pointer)( svc != NULL ? svc \
- : FT_SERVICE_UNAVAILABLE ); \
- } \
- ptr = svc; \
- FT_END_STMNT
-
-#endif /* !C++ */
-
- /*
- * A macro used to define new service structure types.
- */
-
-#define FT_DEFINE_SERVICE( name ) \
- typedef struct FT_Service_ ## name ## Rec_ \
- FT_Service_ ## name ## Rec ; \
- typedef struct FT_Service_ ## name ## Rec_ \
- const * FT_Service_ ## name ; \
- struct FT_Service_ ## name ## Rec_
-
- /* */
-
- /*
- * The header files containing the services.
- */
-
-#define FT_SERVICE_BDF_H <freetype/internal/services/svbdf.h>
-#define FT_SERVICE_CID_H <freetype/internal/services/svcid.h>
-#define FT_SERVICE_GLYPH_DICT_H <freetype/internal/services/svgldict.h>
-#define FT_SERVICE_GX_VALIDATE_H <freetype/internal/services/svgxval.h>
-#define FT_SERVICE_KERNING_H <freetype/internal/services/svkern.h>
-#define FT_SERVICE_MULTIPLE_MASTERS_H <freetype/internal/services/svmm.h>
-#define FT_SERVICE_OPENTYPE_VALIDATE_H <freetype/internal/services/svotval.h>
-#define FT_SERVICE_PFR_H <freetype/internal/services/svpfr.h>
-#define FT_SERVICE_POSTSCRIPT_CMAPS_H <freetype/internal/services/svpscmap.h>
-#define FT_SERVICE_POSTSCRIPT_INFO_H <freetype/internal/services/svpsinfo.h>
-#define FT_SERVICE_POSTSCRIPT_NAME_H <freetype/internal/services/svpostnm.h>
-#define FT_SERVICE_PROPERTIES_H <freetype/internal/services/svprop.h>
-#define FT_SERVICE_SFNT_H <freetype/internal/services/svsfnt.h>
-#define FT_SERVICE_TRUETYPE_ENGINE_H <freetype/internal/services/svtteng.h>
-#define FT_SERVICE_TT_CMAP_H <freetype/internal/services/svttcmap.h>
-#define FT_SERVICE_WINFNT_H <freetype/internal/services/svwinfnt.h>
-#define FT_SERVICE_FONT_FORMAT_H <freetype/internal/services/svfntfmt.h>
-#define FT_SERVICE_TRUETYPE_GLYF_H <freetype/internal/services/svttglyf.h>
-
- /* */
-
-FT_END_HEADER
-
-#endif /* __FTSERV_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/ftstream.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/ftstream.h
deleted file mode 100644
index 384e5df305c..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/ftstream.h
+++ /dev/null
@@ -1,536 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftstream.h */
-/* */
-/* Stream handling (specification). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __FTSTREAM_H__
-#define __FTSTREAM_H__
-
-
-#include <ft2build.h>
-#include FT_SYSTEM_H
-#include FT_INTERNAL_OBJECTS_H
-
-
-FT_BEGIN_HEADER
-
-
- /* format of an 8-bit frame_op value: */
- /* */
- /* bit 76543210 */
- /* xxxxxxes */
- /* */
- /* s is set to 1 if the value is signed. */
- /* e is set to 1 if the value is little-endian. */
- /* xxx is a command. */
-
-#define FT_FRAME_OP_SHIFT 2
-#define FT_FRAME_OP_SIGNED 1
-#define FT_FRAME_OP_LITTLE 2
-#define FT_FRAME_OP_COMMAND( x ) ( x >> FT_FRAME_OP_SHIFT )
-
-#define FT_MAKE_FRAME_OP( command, little, sign ) \
- ( ( command << FT_FRAME_OP_SHIFT ) | ( little << 1 ) | sign )
-
-#define FT_FRAME_OP_END 0
-#define FT_FRAME_OP_START 1 /* start a new frame */
-#define FT_FRAME_OP_BYTE 2 /* read 1-byte value */
-#define FT_FRAME_OP_SHORT 3 /* read 2-byte value */
-#define FT_FRAME_OP_LONG 4 /* read 4-byte value */
-#define FT_FRAME_OP_OFF3 5 /* read 3-byte value */
-#define FT_FRAME_OP_BYTES 6 /* read a bytes sequence */
-
-
- typedef enum FT_Frame_Op_
- {
- ft_frame_end = 0,
- ft_frame_start = FT_MAKE_FRAME_OP( FT_FRAME_OP_START, 0, 0 ),
-
- ft_frame_byte = FT_MAKE_FRAME_OP( FT_FRAME_OP_BYTE, 0, 0 ),
- ft_frame_schar = FT_MAKE_FRAME_OP( FT_FRAME_OP_BYTE, 0, 1 ),
-
- ft_frame_ushort_be = FT_MAKE_FRAME_OP( FT_FRAME_OP_SHORT, 0, 0 ),
- ft_frame_short_be = FT_MAKE_FRAME_OP( FT_FRAME_OP_SHORT, 0, 1 ),
- ft_frame_ushort_le = FT_MAKE_FRAME_OP( FT_FRAME_OP_SHORT, 1, 0 ),
- ft_frame_short_le = FT_MAKE_FRAME_OP( FT_FRAME_OP_SHORT, 1, 1 ),
-
- ft_frame_ulong_be = FT_MAKE_FRAME_OP( FT_FRAME_OP_LONG, 0, 0 ),
- ft_frame_long_be = FT_MAKE_FRAME_OP( FT_FRAME_OP_LONG, 0, 1 ),
- ft_frame_ulong_le = FT_MAKE_FRAME_OP( FT_FRAME_OP_LONG, 1, 0 ),
- ft_frame_long_le = FT_MAKE_FRAME_OP( FT_FRAME_OP_LONG, 1, 1 ),
-
- ft_frame_uoff3_be = FT_MAKE_FRAME_OP( FT_FRAME_OP_OFF3, 0, 0 ),
- ft_frame_off3_be = FT_MAKE_FRAME_OP( FT_FRAME_OP_OFF3, 0, 1 ),
- ft_frame_uoff3_le = FT_MAKE_FRAME_OP( FT_FRAME_OP_OFF3, 1, 0 ),
- ft_frame_off3_le = FT_MAKE_FRAME_OP( FT_FRAME_OP_OFF3, 1, 1 ),
-
- ft_frame_bytes = FT_MAKE_FRAME_OP( FT_FRAME_OP_BYTES, 0, 0 ),
- ft_frame_skip = FT_MAKE_FRAME_OP( FT_FRAME_OP_BYTES, 0, 1 )
-
- } FT_Frame_Op;
-
-
- typedef struct FT_Frame_Field_
- {
- FT_Byte value;
- FT_Byte size;
- FT_UShort offset;
-
- } FT_Frame_Field;
-
-
- /* Construct an FT_Frame_Field out of a structure type and a field name. */
- /* The structure type must be set in the FT_STRUCTURE macro before */
- /* calling the FT_FRAME_START() macro. */
- /* */
-#define FT_FIELD_SIZE( f ) \
- (FT_Byte)sizeof ( ((FT_STRUCTURE*)0)->f )
-
-#define FT_FIELD_SIZE_DELTA( f ) \
- (FT_Byte)sizeof ( ((FT_STRUCTURE*)0)->f[0] )
-
-#define FT_FIELD_OFFSET( f ) \
- (FT_UShort)( offsetof( FT_STRUCTURE, f ) )
-
-#define FT_FRAME_FIELD( frame_op, field ) \
- { \
- frame_op, \
- FT_FIELD_SIZE( field ), \
- FT_FIELD_OFFSET( field ) \
- }
-
-#define FT_MAKE_EMPTY_FIELD( frame_op ) { frame_op, 0, 0 }
-
-#define FT_FRAME_START( size ) { ft_frame_start, 0, size }
-#define FT_FRAME_END { ft_frame_end, 0, 0 }
-
-#define FT_FRAME_LONG( f ) FT_FRAME_FIELD( ft_frame_long_be, f )
-#define FT_FRAME_ULONG( f ) FT_FRAME_FIELD( ft_frame_ulong_be, f )
-#define FT_FRAME_SHORT( f ) FT_FRAME_FIELD( ft_frame_short_be, f )
-#define FT_FRAME_USHORT( f ) FT_FRAME_FIELD( ft_frame_ushort_be, f )
-#define FT_FRAME_OFF3( f ) FT_FRAME_FIELD( ft_frame_off3_be, f )
-#define FT_FRAME_UOFF3( f ) FT_FRAME_FIELD( ft_frame_uoff3_be, f )
-#define FT_FRAME_BYTE( f ) FT_FRAME_FIELD( ft_frame_byte, f )
-#define FT_FRAME_CHAR( f ) FT_FRAME_FIELD( ft_frame_schar, f )
-
-#define FT_FRAME_LONG_LE( f ) FT_FRAME_FIELD( ft_frame_long_le, f )
-#define FT_FRAME_ULONG_LE( f ) FT_FRAME_FIELD( ft_frame_ulong_le, f )
-#define FT_FRAME_SHORT_LE( f ) FT_FRAME_FIELD( ft_frame_short_le, f )
-#define FT_FRAME_USHORT_LE( f ) FT_FRAME_FIELD( ft_frame_ushort_le, f )
-#define FT_FRAME_OFF3_LE( f ) FT_FRAME_FIELD( ft_frame_off3_le, f )
-#define FT_FRAME_UOFF3_LE( f ) FT_FRAME_FIELD( ft_frame_uoff3_le, f )
-
-#define FT_FRAME_SKIP_LONG { ft_frame_long_be, 0, 0 }
-#define FT_FRAME_SKIP_SHORT { ft_frame_short_be, 0, 0 }
-#define FT_FRAME_SKIP_BYTE { ft_frame_byte, 0, 0 }
-
-#define FT_FRAME_BYTES( field, count ) \
- { \
- ft_frame_bytes, \
- count, \
- FT_FIELD_OFFSET( field ) \
- }
-
-#define FT_FRAME_SKIP_BYTES( count ) { ft_frame_skip, count, 0 }
-
-
- /*************************************************************************/
- /* */
- /* Integer extraction macros -- the `buffer' parameter must ALWAYS be of */
- /* type `char*' or equivalent (1-byte elements). */
- /* */
-
-#define FT_BYTE_( p, i ) ( ((const FT_Byte*)(p))[(i)] )
-
-#define FT_INT16( x ) ( (FT_Int16)(x) )
-#define FT_UINT16( x ) ( (FT_UInt16)(x) )
-#define FT_INT32( x ) ( (FT_Int32)(x) )
-#define FT_UINT32( x ) ( (FT_UInt32)(x) )
-
-
-#define FT_BYTE_U16( p, i, s ) ( FT_UINT16( FT_BYTE_( p, i ) ) << (s) )
-#define FT_BYTE_U32( p, i, s ) ( FT_UINT32( FT_BYTE_( p, i ) ) << (s) )
-
-
-#define FT_PEEK_SHORT( p ) FT_INT16( FT_BYTE_U16( p, 0, 8) | \
- FT_BYTE_U16( p, 1, 0) )
-
-#define FT_PEEK_USHORT( p ) FT_UINT16( FT_BYTE_U16( p, 0, 8 ) | \
- FT_BYTE_U16( p, 1, 0 ) )
-
-#define FT_PEEK_LONG( p ) FT_INT32( FT_BYTE_U32( p, 0, 24 ) | \
- FT_BYTE_U32( p, 1, 16 ) | \
- FT_BYTE_U32( p, 2, 8 ) | \
- FT_BYTE_U32( p, 3, 0 ) )
-
-#define FT_PEEK_ULONG( p ) FT_UINT32( FT_BYTE_U32( p, 0, 24 ) | \
- FT_BYTE_U32( p, 1, 16 ) | \
- FT_BYTE_U32( p, 2, 8 ) | \
- FT_BYTE_U32( p, 3, 0 ) )
-
-#define FT_PEEK_OFF3( p ) FT_INT32( FT_BYTE_U32( p, 0, 16 ) | \
- FT_BYTE_U32( p, 1, 8 ) | \
- FT_BYTE_U32( p, 2, 0 ) )
-
-#define FT_PEEK_UOFF3( p ) FT_UINT32( FT_BYTE_U32( p, 0, 16 ) | \
- FT_BYTE_U32( p, 1, 8 ) | \
- FT_BYTE_U32( p, 2, 0 ) )
-
-#define FT_PEEK_SHORT_LE( p ) FT_INT16( FT_BYTE_U16( p, 1, 8 ) | \
- FT_BYTE_U16( p, 0, 0 ) )
-
-#define FT_PEEK_USHORT_LE( p ) FT_UINT16( FT_BYTE_U16( p, 1, 8 ) | \
- FT_BYTE_U16( p, 0, 0 ) )
-
-#define FT_PEEK_LONG_LE( p ) FT_INT32( FT_BYTE_U32( p, 3, 24 ) | \
- FT_BYTE_U32( p, 2, 16 ) | \
- FT_BYTE_U32( p, 1, 8 ) | \
- FT_BYTE_U32( p, 0, 0 ) )
-
-#define FT_PEEK_ULONG_LE( p ) FT_UINT32( FT_BYTE_U32( p, 3, 24 ) | \
- FT_BYTE_U32( p, 2, 16 ) | \
- FT_BYTE_U32( p, 1, 8 ) | \
- FT_BYTE_U32( p, 0, 0 ) )
-
-#define FT_PEEK_OFF3_LE( p ) FT_INT32( FT_BYTE_U32( p, 2, 16 ) | \
- FT_BYTE_U32( p, 1, 8 ) | \
- FT_BYTE_U32( p, 0, 0 ) )
-
-#define FT_PEEK_UOFF3_LE( p ) FT_UINT32( FT_BYTE_U32( p, 2, 16 ) | \
- FT_BYTE_U32( p, 1, 8 ) | \
- FT_BYTE_U32( p, 0, 0 ) )
-
-
-#define FT_NEXT_CHAR( buffer ) \
- ( (signed char)*buffer++ )
-
-#define FT_NEXT_BYTE( buffer ) \
- ( (unsigned char)*buffer++ )
-
-#define FT_NEXT_SHORT( buffer ) \
- ( (short)( buffer += 2, FT_PEEK_SHORT( buffer - 2 ) ) )
-
-#define FT_NEXT_USHORT( buffer ) \
- ( (unsigned short)( buffer += 2, FT_PEEK_USHORT( buffer - 2 ) ) )
-
-#define FT_NEXT_OFF3( buffer ) \
- ( (long)( buffer += 3, FT_PEEK_OFF3( buffer - 3 ) ) )
-
-#define FT_NEXT_UOFF3( buffer ) \
- ( (unsigned long)( buffer += 3, FT_PEEK_UOFF3( buffer - 3 ) ) )
-
-#define FT_NEXT_LONG( buffer ) \
- ( (long)( buffer += 4, FT_PEEK_LONG( buffer - 4 ) ) )
-
-#define FT_NEXT_ULONG( buffer ) \
- ( (unsigned long)( buffer += 4, FT_PEEK_ULONG( buffer - 4 ) ) )
-
-
-#define FT_NEXT_SHORT_LE( buffer ) \
- ( (short)( buffer += 2, FT_PEEK_SHORT_LE( buffer - 2 ) ) )
-
-#define FT_NEXT_USHORT_LE( buffer ) \
- ( (unsigned short)( buffer += 2, FT_PEEK_USHORT_LE( buffer - 2 ) ) )
-
-#define FT_NEXT_OFF3_LE( buffer ) \
- ( (long)( buffer += 3, FT_PEEK_OFF3_LE( buffer - 3 ) ) )
-
-#define FT_NEXT_UOFF3_LE( buffer ) \
- ( (unsigned long)( buffer += 3, FT_PEEK_UOFF3_LE( buffer - 3 ) ) )
-
-#define FT_NEXT_LONG_LE( buffer ) \
- ( (long)( buffer += 4, FT_PEEK_LONG_LE( buffer - 4 ) ) )
-
-#define FT_NEXT_ULONG_LE( buffer ) \
- ( (unsigned long)( buffer += 4, FT_PEEK_ULONG_LE( buffer - 4 ) ) )
-
-
- /*************************************************************************/
- /* */
- /* Each GET_xxxx() macro uses an implicit `stream' variable. */
- /* */
-#if 0
-#define FT_GET_MACRO( type ) FT_NEXT_ ## type ( stream->cursor )
-
-#define FT_GET_CHAR() FT_GET_MACRO( CHAR )
-#define FT_GET_BYTE() FT_GET_MACRO( BYTE )
-#define FT_GET_SHORT() FT_GET_MACRO( SHORT )
-#define FT_GET_USHORT() FT_GET_MACRO( USHORT )
-#define FT_GET_OFF3() FT_GET_MACRO( OFF3 )
-#define FT_GET_UOFF3() FT_GET_MACRO( UOFF3 )
-#define FT_GET_LONG() FT_GET_MACRO( LONG )
-#define FT_GET_ULONG() FT_GET_MACRO( ULONG )
-#define FT_GET_TAG4() FT_GET_MACRO( ULONG )
-
-#define FT_GET_SHORT_LE() FT_GET_MACRO( SHORT_LE )
-#define FT_GET_USHORT_LE() FT_GET_MACRO( USHORT_LE )
-#define FT_GET_LONG_LE() FT_GET_MACRO( LONG_LE )
-#define FT_GET_ULONG_LE() FT_GET_MACRO( ULONG_LE )
-
-#else
-#define FT_GET_MACRO( func, type ) ( (type)func( stream ) )
-
-#define FT_GET_CHAR() FT_GET_MACRO( FT_Stream_GetChar, FT_Char )
-#define FT_GET_BYTE() FT_GET_MACRO( FT_Stream_GetChar, FT_Byte )
-#define FT_GET_SHORT() FT_GET_MACRO( FT_Stream_GetUShort, FT_Short )
-#define FT_GET_USHORT() FT_GET_MACRO( FT_Stream_GetUShort, FT_UShort )
-#define FT_GET_OFF3() FT_GET_MACRO( FT_Stream_GetUOffset, FT_Long )
-#define FT_GET_UOFF3() FT_GET_MACRO( FT_Stream_GetUOffset, FT_ULong )
-#define FT_GET_LONG() FT_GET_MACRO( FT_Stream_GetULong, FT_Long )
-#define FT_GET_ULONG() FT_GET_MACRO( FT_Stream_GetULong, FT_ULong )
-#define FT_GET_TAG4() FT_GET_MACRO( FT_Stream_GetULong, FT_ULong )
-
-#define FT_GET_SHORT_LE() FT_GET_MACRO( FT_Stream_GetUShortLE, FT_Short )
-#define FT_GET_USHORT_LE() FT_GET_MACRO( FT_Stream_GetUShortLE, FT_UShort )
-#define FT_GET_LONG_LE() FT_GET_MACRO( FT_Stream_GetULongLE, FT_Long )
-#define FT_GET_ULONG_LE() FT_GET_MACRO( FT_Stream_GetULongLE, FT_ULong )
-#endif
-
-#define FT_READ_MACRO( func, type, var ) \
- ( var = (type)func( stream, &error ), \
- error != FT_Err_Ok )
-
-#define FT_READ_BYTE( var ) FT_READ_MACRO( FT_Stream_ReadChar, FT_Byte, var )
-#define FT_READ_CHAR( var ) FT_READ_MACRO( FT_Stream_ReadChar, FT_Char, var )
-#define FT_READ_SHORT( var ) FT_READ_MACRO( FT_Stream_ReadUShort, FT_Short, var )
-#define FT_READ_USHORT( var ) FT_READ_MACRO( FT_Stream_ReadUShort, FT_UShort, var )
-#define FT_READ_OFF3( var ) FT_READ_MACRO( FT_Stream_ReadUOffset, FT_Long, var )
-#define FT_READ_UOFF3( var ) FT_READ_MACRO( FT_Stream_ReadUOffset, FT_ULong, var )
-#define FT_READ_LONG( var ) FT_READ_MACRO( FT_Stream_ReadULong, FT_Long, var )
-#define FT_READ_ULONG( var ) FT_READ_MACRO( FT_Stream_ReadULong, FT_ULong, var )
-
-#define FT_READ_SHORT_LE( var ) FT_READ_MACRO( FT_Stream_ReadUShortLE, FT_Short, var )
-#define FT_READ_USHORT_LE( var ) FT_READ_MACRO( FT_Stream_ReadUShortLE, FT_UShort, var )
-#define FT_READ_LONG_LE( var ) FT_READ_MACRO( FT_Stream_ReadULongLE, FT_Long, var )
-#define FT_READ_ULONG_LE( var ) FT_READ_MACRO( FT_Stream_ReadULongLE, FT_ULong, var )
-
-
-#ifndef FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM
-
- /* initialize a stream for reading a regular system stream */
- FT_BASE( FT_Error )
- FT_Stream_Open( FT_Stream stream,
- const char* filepathname );
-
-#endif /* FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM */
-
-
- /* create a new (input) stream from an FT_Open_Args structure */
- FT_BASE( FT_Error )
- FT_Stream_New( FT_Library library,
- const FT_Open_Args* args,
- FT_Stream *astream );
-
- /* free a stream */
- FT_BASE( void )
- FT_Stream_Free( FT_Stream stream,
- FT_Int external );
-
- /* initialize a stream for reading in-memory data */
- FT_BASE( void )
- FT_Stream_OpenMemory( FT_Stream stream,
- const FT_Byte* base,
- FT_ULong size );
-
- /* close a stream (does not destroy the stream structure) */
- FT_BASE( void )
- FT_Stream_Close( FT_Stream stream );
-
-
- /* seek within a stream. position is relative to start of stream */
- FT_BASE( FT_Error )
- FT_Stream_Seek( FT_Stream stream,
- FT_ULong pos );
-
- /* skip bytes in a stream */
- FT_BASE( FT_Error )
- FT_Stream_Skip( FT_Stream stream,
- FT_Long distance );
-
- /* return current stream position */
- FT_BASE( FT_ULong )
- FT_Stream_Pos( FT_Stream stream );
-
- /* read bytes from a stream into a user-allocated buffer, returns an */
- /* error if not all bytes could be read. */
- FT_BASE( FT_Error )
- FT_Stream_Read( FT_Stream stream,
- FT_Byte* buffer,
- FT_ULong count );
-
- /* read bytes from a stream at a given position */
- FT_BASE( FT_Error )
- FT_Stream_ReadAt( FT_Stream stream,
- FT_ULong pos,
- FT_Byte* buffer,
- FT_ULong count );
-
- /* try to read bytes at the end of a stream; return number of bytes */
- /* really available */
- FT_BASE( FT_ULong )
- FT_Stream_TryRead( FT_Stream stream,
- FT_Byte* buffer,
- FT_ULong count );
-
- /* Enter a frame of `count' consecutive bytes in a stream. Returns an */
- /* error if the frame could not be read/accessed. The caller can use */
- /* the FT_Stream_Get_XXX functions to retrieve frame data without */
- /* error checks. */
- /* */
- /* You must _always_ call FT_Stream_ExitFrame() once you have entered */
- /* a stream frame! */
- /* */
- FT_BASE( FT_Error )
- FT_Stream_EnterFrame( FT_Stream stream,
- FT_ULong count );
-
- /* exit a stream frame */
- FT_BASE( void )
- FT_Stream_ExitFrame( FT_Stream stream );
-
- /* Extract a stream frame. If the stream is disk-based, a heap block */
- /* is allocated and the frame bytes are read into it. If the stream */
- /* is memory-based, this function simply set a pointer to the data. */
- /* */
- /* Useful to optimize access to memory-based streams transparently. */
- /* */
- /* All extracted frames must be `freed' with a call to the function */
- /* FT_Stream_ReleaseFrame(). */
- /* */
- FT_BASE( FT_Error )
- FT_Stream_ExtractFrame( FT_Stream stream,
- FT_ULong count,
- FT_Byte** pbytes );
-
- /* release an extract frame (see FT_Stream_ExtractFrame) */
- FT_BASE( void )
- FT_Stream_ReleaseFrame( FT_Stream stream,
- FT_Byte** pbytes );
-
- /* read a byte from an entered frame */
- FT_BASE( FT_Char )
- FT_Stream_GetChar( FT_Stream stream );
-
- /* read a 16-bit big-endian unsigned integer from an entered frame */
- FT_BASE( FT_UShort )
- FT_Stream_GetUShort( FT_Stream stream );
-
- /* read a 24-bit big-endian unsigned integer from an entered frame */
- FT_BASE( FT_ULong )
- FT_Stream_GetUOffset( FT_Stream stream );
-
- /* read a 32-bit big-endian unsigned integer from an entered frame */
- FT_BASE( FT_ULong )
- FT_Stream_GetULong( FT_Stream stream );
-
- /* read a 16-bit little-endian unsigned integer from an entered frame */
- FT_BASE( FT_UShort )
- FT_Stream_GetUShortLE( FT_Stream stream );
-
- /* read a 32-bit little-endian unsigned integer from an entered frame */
- FT_BASE( FT_ULong )
- FT_Stream_GetULongLE( FT_Stream stream );
-
-
- /* read a byte from a stream */
- FT_BASE( FT_Char )
- FT_Stream_ReadChar( FT_Stream stream,
- FT_Error* error );
-
- /* read a 16-bit big-endian unsigned integer from a stream */
- FT_BASE( FT_UShort )
- FT_Stream_ReadUShort( FT_Stream stream,
- FT_Error* error );
-
- /* read a 24-bit big-endian unsigned integer from a stream */
- FT_BASE( FT_ULong )
- FT_Stream_ReadUOffset( FT_Stream stream,
- FT_Error* error );
-
- /* read a 32-bit big-endian integer from a stream */
- FT_BASE( FT_ULong )
- FT_Stream_ReadULong( FT_Stream stream,
- FT_Error* error );
-
- /* read a 16-bit little-endian unsigned integer from a stream */
- FT_BASE( FT_UShort )
- FT_Stream_ReadUShortLE( FT_Stream stream,
- FT_Error* error );
-
- /* read a 32-bit little-endian unsigned integer from a stream */
- FT_BASE( FT_ULong )
- FT_Stream_ReadULongLE( FT_Stream stream,
- FT_Error* error );
-
- /* Read a structure from a stream. The structure must be described */
- /* by an array of FT_Frame_Field records. */
- FT_BASE( FT_Error )
- FT_Stream_ReadFields( FT_Stream stream,
- const FT_Frame_Field* fields,
- void* structure );
-
-
-#define FT_STREAM_POS() \
- FT_Stream_Pos( stream )
-
-#define FT_STREAM_SEEK( position ) \
- FT_SET_ERROR( FT_Stream_Seek( stream, \
- (FT_ULong)(position) ) )
-
-#define FT_STREAM_SKIP( distance ) \
- FT_SET_ERROR( FT_Stream_Skip( stream, \
- (FT_Long)(distance) ) )
-
-#define FT_STREAM_READ( buffer, count ) \
- FT_SET_ERROR( FT_Stream_Read( stream, \
- (FT_Byte*)(buffer), \
- (FT_ULong)(count) ) )
-
-#define FT_STREAM_READ_AT( position, buffer, count ) \
- FT_SET_ERROR( FT_Stream_ReadAt( stream, \
- (FT_ULong)(position), \
- (FT_Byte*)buffer, \
- (FT_ULong)(count) ) )
-
-#define FT_STREAM_READ_FIELDS( fields, object ) \
- FT_SET_ERROR( FT_Stream_ReadFields( stream, fields, object ) )
-
-
-#define FT_FRAME_ENTER( size ) \
- FT_SET_ERROR( \
- FT_DEBUG_INNER( FT_Stream_EnterFrame( stream, \
- (FT_ULong)(size) ) ) )
-
-#define FT_FRAME_EXIT() \
- FT_DEBUG_INNER( FT_Stream_ExitFrame( stream ) )
-
-#define FT_FRAME_EXTRACT( size, bytes ) \
- FT_SET_ERROR( \
- FT_DEBUG_INNER( FT_Stream_ExtractFrame( stream, \
- (FT_ULong)(size), \
- (FT_Byte**)&(bytes) ) ) )
-
-#define FT_FRAME_RELEASE( bytes ) \
- FT_DEBUG_INNER( FT_Stream_ReleaseFrame( stream, \
- (FT_Byte**)&(bytes) ) )
-
-
-FT_END_HEADER
-
-#endif /* __FTSTREAM_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/fttrace.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/fttrace.h
deleted file mode 100644
index 9d28d214d62..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/fttrace.h
+++ /dev/null
@@ -1,154 +0,0 @@
-/***************************************************************************/
-/* */
-/* fttrace.h */
-/* */
-/* Tracing handling (specification only). */
-/* */
-/* Copyright 2002-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
- /* definitions of trace levels for FreeType 2 */
-
- /* the first level must always be `trace_any' */
-FT_TRACE_DEF( any )
-
- /* base components */
-FT_TRACE_DEF( calc ) /* calculations (ftcalc.c) */
-FT_TRACE_DEF( memory ) /* memory manager (ftobjs.c) */
-FT_TRACE_DEF( stream ) /* stream manager (ftstream.c) */
-FT_TRACE_DEF( io ) /* i/o interface (ftsystem.c) */
-FT_TRACE_DEF( list ) /* list management (ftlist.c) */
-FT_TRACE_DEF( init ) /* initialization (ftinit.c) */
-FT_TRACE_DEF( objs ) /* base objects (ftobjs.c) */
-FT_TRACE_DEF( outline ) /* outline management (ftoutln.c) */
-FT_TRACE_DEF( glyph ) /* glyph management (ftglyph.c) */
-FT_TRACE_DEF( gloader ) /* glyph loader (ftgloadr.c) */
-
-FT_TRACE_DEF( raster ) /* monochrome rasterizer (ftraster.c) */
-FT_TRACE_DEF( smooth ) /* anti-aliasing raster (ftgrays.c) */
-FT_TRACE_DEF( mm ) /* MM interface (ftmm.c) */
-FT_TRACE_DEF( raccess ) /* resource fork accessor (ftrfork.c) */
-FT_TRACE_DEF( synth ) /* bold/slant synthesizer (ftsynth.c) */
-FT_TRACE_DEF( bitmap ) /* bitmap checksum (ftobjs.c) */
-
- /* Cache sub-system */
-FT_TRACE_DEF( cache ) /* cache sub-system (ftcache.c, etc.) */
-
- /* SFNT driver components */
-FT_TRACE_DEF( sfdriver ) /* SFNT font driver (sfdriver.c) */
-FT_TRACE_DEF( sfobjs ) /* SFNT object handler (sfobjs.c) */
-FT_TRACE_DEF( ttcmap ) /* charmap handler (ttcmap.c) */
-FT_TRACE_DEF( ttkern ) /* kerning handler (ttkern.c) */
-FT_TRACE_DEF( ttload ) /* basic TrueType tables (ttload.c) */
-FT_TRACE_DEF( ttmtx ) /* metrics-related tables (ttmtx.c) */
-FT_TRACE_DEF( ttpost ) /* PS table processing (ttpost.c) */
-FT_TRACE_DEF( ttsbit ) /* TrueType sbit handling (ttsbit.c) */
-FT_TRACE_DEF( ttbdf ) /* TrueType embedded BDF (ttbdf.c) */
-
- /* TrueType driver components */
-FT_TRACE_DEF( ttdriver ) /* TT font driver (ttdriver.c) */
-FT_TRACE_DEF( ttgload ) /* TT glyph loader (ttgload.c) */
-FT_TRACE_DEF( ttinterp ) /* bytecode interpreter (ttinterp.c) */
-FT_TRACE_DEF( ttobjs ) /* TT objects manager (ttobjs.c) */
-FT_TRACE_DEF( ttpload ) /* TT data/program loader (ttpload.c) */
-FT_TRACE_DEF( ttgxvar ) /* TrueType GX var handler (ttgxvar.c) */
-
- /* Type 1 driver components */
-FT_TRACE_DEF( t1afm )
-FT_TRACE_DEF( t1driver )
-FT_TRACE_DEF( t1gload )
-FT_TRACE_DEF( t1hint )
-FT_TRACE_DEF( t1load )
-FT_TRACE_DEF( t1objs )
-FT_TRACE_DEF( t1parse )
-
- /* PostScript helper module `psaux' */
-FT_TRACE_DEF( t1decode )
-FT_TRACE_DEF( psobjs )
-FT_TRACE_DEF( psconv )
-
- /* PostScript hinting module `pshinter' */
-FT_TRACE_DEF( pshrec )
-FT_TRACE_DEF( pshalgo1 )
-FT_TRACE_DEF( pshalgo2 )
-
- /* Type 2 driver components */
-FT_TRACE_DEF( cffdriver )
-FT_TRACE_DEF( cffgload )
-FT_TRACE_DEF( cffload )
-FT_TRACE_DEF( cffobjs )
-FT_TRACE_DEF( cffparse )
-
-FT_TRACE_DEF( cf2blues )
-FT_TRACE_DEF( cf2hints )
-FT_TRACE_DEF( cf2interp )
-
- /* Type 42 driver component */
-FT_TRACE_DEF( t42 )
-
- /* CID driver components */
-FT_TRACE_DEF( cidafm )
-FT_TRACE_DEF( ciddriver )
-FT_TRACE_DEF( cidgload )
-FT_TRACE_DEF( cidload )
-FT_TRACE_DEF( cidobjs )
-FT_TRACE_DEF( cidparse )
-
- /* Windows font component */
-FT_TRACE_DEF( winfnt )
-
- /* PCF font components */
-FT_TRACE_DEF( pcfdriver )
-FT_TRACE_DEF( pcfread )
-
- /* BDF font components */
-FT_TRACE_DEF( bdfdriver )
-FT_TRACE_DEF( bdflib )
-
- /* PFR font component */
-FT_TRACE_DEF( pfr )
-
- /* OpenType validation components */
-FT_TRACE_DEF( otvmodule )
-FT_TRACE_DEF( otvcommon )
-FT_TRACE_DEF( otvbase )
-FT_TRACE_DEF( otvgdef )
-FT_TRACE_DEF( otvgpos )
-FT_TRACE_DEF( otvgsub )
-FT_TRACE_DEF( otvjstf )
-FT_TRACE_DEF( otvmath )
-
- /* TrueTypeGX/AAT validation components */
-FT_TRACE_DEF( gxvmodule )
-FT_TRACE_DEF( gxvcommon )
-FT_TRACE_DEF( gxvfeat )
-FT_TRACE_DEF( gxvmort )
-FT_TRACE_DEF( gxvmorx )
-FT_TRACE_DEF( gxvbsln )
-FT_TRACE_DEF( gxvjust )
-FT_TRACE_DEF( gxvkern )
-FT_TRACE_DEF( gxvopbd )
-FT_TRACE_DEF( gxvtrak )
-FT_TRACE_DEF( gxvprop )
-FT_TRACE_DEF( gxvlcar )
-
- /* autofit components */
-FT_TRACE_DEF( afmodule )
-FT_TRACE_DEF( afhints )
-FT_TRACE_DEF( afcjk )
-FT_TRACE_DEF( aflatin )
-FT_TRACE_DEF( aflatin2 )
-FT_TRACE_DEF( afwarp )
-FT_TRACE_DEF( afharfbuzz )
-FT_TRACE_DEF( afglobal )
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/ftvalid.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/ftvalid.h
deleted file mode 100644
index 9cda6eef5f6..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/ftvalid.h
+++ /dev/null
@@ -1,159 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftvalid.h */
-/* */
-/* FreeType validation support (specification). */
-/* */
-/* Copyright 2004-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __FTVALID_H__
-#define __FTVALID_H__
-
-#include <ft2build.h>
-#include FT_CONFIG_STANDARD_LIBRARY_H /* for ft_setjmp and ft_longjmp */
-
-
-FT_BEGIN_HEADER
-
-
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
- /**** ****/
- /**** ****/
- /**** V A L I D A T I O N ****/
- /**** ****/
- /**** ****/
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
-
- /* handle to a validation object */
- typedef struct FT_ValidatorRec_ volatile* FT_Validator;
-
-
- /*************************************************************************/
- /* */
- /* There are three distinct validation levels defined here: */
- /* */
- /* FT_VALIDATE_DEFAULT :: */
- /* A table that passes this validation level can be used reliably by */
- /* FreeType. It generally means that all offsets have been checked to */
- /* prevent out-of-bound reads, that array counts are correct, etc. */
- /* */
- /* FT_VALIDATE_TIGHT :: */
- /* A table that passes this validation level can be used reliably and */
- /* doesn't contain invalid data. For example, a charmap table that */
- /* returns invalid glyph indices will not pass, even though it can */
- /* be used with FreeType in default mode (the library will simply */
- /* return an error later when trying to load the glyph). */
- /* */
- /* It also checks that fields which must be a multiple of 2, 4, or 8, */
- /* don't have incorrect values, etc. */
- /* */
- /* FT_VALIDATE_PARANOID :: */
- /* Only for font debugging. Checks that a table follows the */
- /* specification by 100%. Very few fonts will be able to pass this */
- /* level anyway but it can be useful for certain tools like font */
- /* editors/converters. */
- /* */
- typedef enum FT_ValidationLevel_
- {
- FT_VALIDATE_DEFAULT = 0,
- FT_VALIDATE_TIGHT,
- FT_VALIDATE_PARANOID
-
- } FT_ValidationLevel;
-
-
-#if defined( _MSC_VER ) /* Visual C++ (and Intel C++) */
- /* We disable the warning `structure was padded due to */
- /* __declspec(align())' in order to compile cleanly with */
- /* the maximum level of warnings. */
-#pragma warning( push )
-#pragma warning( disable : 4324 )
-#endif /* _MSC_VER */
-
- /* validator structure */
- typedef struct FT_ValidatorRec_
- {
- ft_jmp_buf jump_buffer; /* used for exception handling */
-
- const FT_Byte* base; /* address of table in memory */
- const FT_Byte* limit; /* `base' + sizeof(table) in memory */
- FT_ValidationLevel level; /* validation level */
- FT_Error error; /* error returned. 0 means success */
-
- } FT_ValidatorRec;
-
-#if defined( _MSC_VER )
-#pragma warning( pop )
-#endif
-
-#define FT_VALIDATOR( x ) ( (FT_Validator)( x ) )
-
-
- FT_BASE( void )
- ft_validator_init( FT_Validator valid,
- const FT_Byte* base,
- const FT_Byte* limit,
- FT_ValidationLevel level );
-
- /* Do not use this. It's broken and will cause your validator to crash */
- /* if you run it on an invalid font. */
- FT_BASE( FT_Int )
- ft_validator_run( FT_Validator valid );
-
- /* Sets the error field in a validator, then calls `longjmp' to return */
- /* to high-level caller. Using `setjmp/longjmp' avoids many stupid */
- /* error checks within the validation routines. */
- /* */
- FT_BASE( void )
- ft_validator_error( FT_Validator valid,
- FT_Error error );
-
-
- /* Calls ft_validate_error. Assumes that the `valid' local variable */
- /* holds a pointer to the current validator object. */
- /* */
-#define FT_INVALID( _error ) FT_INVALID_( _error )
-#define FT_INVALID_( _error ) \
- ft_validator_error( valid, FT_THROW( _error ) )
-
- /* called when a broken table is detected */
-#define FT_INVALID_TOO_SHORT \
- FT_INVALID( Invalid_Table )
-
- /* called when an invalid offset is detected */
-#define FT_INVALID_OFFSET \
- FT_INVALID( Invalid_Offset )
-
- /* called when an invalid format/value is detected */
-#define FT_INVALID_FORMAT \
- FT_INVALID( Invalid_Table )
-
- /* called when an invalid glyph index is detected */
-#define FT_INVALID_GLYPH_ID \
- FT_INVALID( Invalid_Glyph_Index )
-
- /* called when an invalid field value is detected */
-#define FT_INVALID_DATA \
- FT_INVALID( Invalid_Table )
-
-
-FT_END_HEADER
-
-#endif /* __FTVALID_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/internal.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/internal.h
deleted file mode 100644
index 809ce59c92f..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/internal.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/***************************************************************************/
-/* */
-/* internal.h */
-/* */
-/* Internal header files (specification only). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* This file is automatically included by `ft2build.h'. */
- /* Do not include it manually! */
- /* */
- /*************************************************************************/
-
-
-#define FT_INTERNAL_OBJECTS_H <freetype/internal/ftobjs.h>
-#define FT_INTERNAL_PIC_H <freetype/internal/ftpic.h>
-#define FT_INTERNAL_STREAM_H <freetype/internal/ftstream.h>
-#define FT_INTERNAL_MEMORY_H <freetype/internal/ftmemory.h>
-#define FT_INTERNAL_DEBUG_H <freetype/internal/ftdebug.h>
-#define FT_INTERNAL_CALC_H <freetype/internal/ftcalc.h>
-#define FT_INTERNAL_DRIVER_H <freetype/internal/ftdriver.h>
-#define FT_INTERNAL_TRACE_H <freetype/internal/fttrace.h>
-#define FT_INTERNAL_GLYPH_LOADER_H <freetype/internal/ftgloadr.h>
-#define FT_INTERNAL_SFNT_H <freetype/internal/sfnt.h>
-#define FT_INTERNAL_SERVICE_H <freetype/internal/ftserv.h>
-#define FT_INTERNAL_RFORK_H <freetype/internal/ftrfork.h>
-#define FT_INTERNAL_VALIDATE_H <freetype/internal/ftvalid.h>
-
-#define FT_INTERNAL_TRUETYPE_TYPES_H <freetype/internal/tttypes.h>
-#define FT_INTERNAL_TYPE1_TYPES_H <freetype/internal/t1types.h>
-
-#define FT_INTERNAL_POSTSCRIPT_AUX_H <freetype/internal/psaux.h>
-#define FT_INTERNAL_POSTSCRIPT_HINTS_H <freetype/internal/pshints.h>
-#define FT_INTERNAL_POSTSCRIPT_GLOBALS_H <freetype/internal/psglobal.h>
-
-#define FT_INTERNAL_AUTOHINT_H <freetype/internal/autohint.h>
-
-
-#if defined( _MSC_VER ) /* Visual C++ (and Intel C++) */
-
- /* We disable the warning `conditional expression is constant' here */
- /* in order to compile cleanly with the maximum level of warnings. */
- /* In particular, the warning complains about stuff like `while(0)' */
- /* which is very useful in macro definitions. There is no benefit */
- /* in having it enabled. */
-#pragma warning( disable : 4127 )
-
-#endif /* _MSC_VER */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/psaux.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/psaux.h
deleted file mode 100644
index 1c5f784f52c..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/psaux.h
+++ /dev/null
@@ -1,877 +0,0 @@
-/***************************************************************************/
-/* */
-/* psaux.h */
-/* */
-/* Auxiliary functions and data structures related to PostScript fonts */
-/* (specification). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __PSAUX_H__
-#define __PSAUX_H__
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_TYPE1_TYPES_H
-#include FT_SERVICE_POSTSCRIPT_CMAPS_H
-
-
-FT_BEGIN_HEADER
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** T1_TABLE *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
-
- typedef struct PS_TableRec_* PS_Table;
- typedef const struct PS_Table_FuncsRec_* PS_Table_Funcs;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* PS_Table_FuncsRec */
- /* */
- /* <Description> */
- /* A set of function pointers to manage PS_Table objects. */
- /* */
- /* <Fields> */
- /* table_init :: Used to initialize a table. */
- /* */
- /* table_done :: Finalizes resp. destroy a given table. */
- /* */
- /* table_add :: Adds a new object to a table. */
- /* */
- /* table_release :: Releases table data, then finalizes it. */
- /* */
- typedef struct PS_Table_FuncsRec_
- {
- FT_Error
- (*init)( PS_Table table,
- FT_Int count,
- FT_Memory memory );
-
- void
- (*done)( PS_Table table );
-
- FT_Error
- (*add)( PS_Table table,
- FT_Int idx,
- void* object,
- FT_UInt length );
-
- void
- (*release)( PS_Table table );
-
- } PS_Table_FuncsRec;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* PS_TableRec */
- /* */
- /* <Description> */
- /* A PS_Table is a simple object used to store an array of objects in */
- /* a single memory block. */
- /* */
- /* <Fields> */
- /* block :: The address in memory of the growheap's block. This */
- /* can change between two object adds, due to */
- /* reallocation. */
- /* */
- /* cursor :: The current top of the grow heap within its block. */
- /* */
- /* capacity :: The current size of the heap block. Increments by */
- /* 1kByte chunks. */
- /* */
- /* init :: Set to 0xDEADBEEF if `elements' and `lengths' have */
- /* been allocated. */
- /* */
- /* max_elems :: The maximum number of elements in table. */
- /* */
- /* num_elems :: The current number of elements in table. */
- /* */
- /* elements :: A table of element addresses within the block. */
- /* */
- /* lengths :: A table of element sizes within the block. */
- /* */
- /* memory :: The object used for memory operations */
- /* (alloc/realloc). */
- /* */
- /* funcs :: A table of method pointers for this object. */
- /* */
- typedef struct PS_TableRec_
- {
- FT_Byte* block; /* current memory block */
- FT_Offset cursor; /* current cursor in memory block */
- FT_Offset capacity; /* current size of memory block */
- FT_ULong init;
-
- FT_Int max_elems;
- FT_Int num_elems;
- FT_Byte** elements; /* addresses of table elements */
- FT_UInt* lengths; /* lengths of table elements */
-
- FT_Memory memory;
- PS_Table_FuncsRec funcs;
-
- } PS_TableRec;
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** T1 FIELDS & TOKENS *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
- typedef struct PS_ParserRec_* PS_Parser;
-
- typedef struct T1_TokenRec_* T1_Token;
-
- typedef struct T1_FieldRec_* T1_Field;
-
-
- /* simple enumeration type used to identify token types */
- typedef enum T1_TokenType_
- {
- T1_TOKEN_TYPE_NONE = 0,
- T1_TOKEN_TYPE_ANY,
- T1_TOKEN_TYPE_STRING,
- T1_TOKEN_TYPE_ARRAY,
- T1_TOKEN_TYPE_KEY, /* aka `name' */
-
- /* do not remove */
- T1_TOKEN_TYPE_MAX
-
- } T1_TokenType;
-
-
- /* a simple structure used to identify tokens */
- typedef struct T1_TokenRec_
- {
- FT_Byte* start; /* first character of token in input stream */
- FT_Byte* limit; /* first character after the token */
- T1_TokenType type; /* type of token */
-
- } T1_TokenRec;
-
-
- /* enumeration type used to identify object fields */
- typedef enum T1_FieldType_
- {
- T1_FIELD_TYPE_NONE = 0,
- T1_FIELD_TYPE_BOOL,
- T1_FIELD_TYPE_INTEGER,
- T1_FIELD_TYPE_FIXED,
- T1_FIELD_TYPE_FIXED_1000,
- T1_FIELD_TYPE_STRING,
- T1_FIELD_TYPE_KEY,
- T1_FIELD_TYPE_BBOX,
- T1_FIELD_TYPE_MM_BBOX,
- T1_FIELD_TYPE_INTEGER_ARRAY,
- T1_FIELD_TYPE_FIXED_ARRAY,
- T1_FIELD_TYPE_CALLBACK,
-
- /* do not remove */
- T1_FIELD_TYPE_MAX
-
- } T1_FieldType;
-
-
- typedef enum T1_FieldLocation_
- {
- T1_FIELD_LOCATION_CID_INFO,
- T1_FIELD_LOCATION_FONT_DICT,
- T1_FIELD_LOCATION_FONT_EXTRA,
- T1_FIELD_LOCATION_FONT_INFO,
- T1_FIELD_LOCATION_PRIVATE,
- T1_FIELD_LOCATION_BBOX,
- T1_FIELD_LOCATION_LOADER,
- T1_FIELD_LOCATION_FACE,
- T1_FIELD_LOCATION_BLEND,
-
- /* do not remove */
- T1_FIELD_LOCATION_MAX
-
- } T1_FieldLocation;
-
-
- typedef void
- (*T1_Field_ParseFunc)( FT_Face face,
- FT_Pointer parser );
-
-
- /* structure type used to model object fields */
- typedef struct T1_FieldRec_
- {
- const char* ident; /* field identifier */
- T1_FieldLocation location;
- T1_FieldType type; /* type of field */
- T1_Field_ParseFunc reader;
- FT_UInt offset; /* offset of field in object */
- FT_Byte size; /* size of field in bytes */
- FT_UInt array_max; /* maximum number of elements for */
- /* array */
- FT_UInt count_offset; /* offset of element count for */
- /* arrays; must not be zero if in */
- /* use -- in other words, a */
- /* `num_FOO' element must not */
- /* start the used structure if we */
- /* parse a `FOO' array */
- FT_UInt dict; /* where we expect it */
- } T1_FieldRec;
-
-#define T1_FIELD_DICT_FONTDICT ( 1 << 0 ) /* also FontInfo and FDArray */
-#define T1_FIELD_DICT_PRIVATE ( 1 << 1 )
-
-
-
-#define T1_NEW_SIMPLE_FIELD( _ident, _type, _fname, _dict ) \
- { \
- _ident, T1CODE, _type, \
- 0, \
- FT_FIELD_OFFSET( _fname ), \
- FT_FIELD_SIZE( _fname ), \
- 0, 0, \
- _dict \
- },
-
-#define T1_NEW_CALLBACK_FIELD( _ident, _reader, _dict ) \
- { \
- _ident, T1CODE, T1_FIELD_TYPE_CALLBACK, \
- (T1_Field_ParseFunc)_reader, \
- 0, 0, \
- 0, 0, \
- _dict \
- },
-
-#define T1_NEW_TABLE_FIELD( _ident, _type, _fname, _max, _dict ) \
- { \
- _ident, T1CODE, _type, \
- 0, \
- FT_FIELD_OFFSET( _fname ), \
- FT_FIELD_SIZE_DELTA( _fname ), \
- _max, \
- FT_FIELD_OFFSET( num_ ## _fname ), \
- _dict \
- },
-
-#define T1_NEW_TABLE_FIELD2( _ident, _type, _fname, _max, _dict ) \
- { \
- _ident, T1CODE, _type, \
- 0, \
- FT_FIELD_OFFSET( _fname ), \
- FT_FIELD_SIZE_DELTA( _fname ), \
- _max, 0, \
- _dict \
- },
-
-
-#define T1_FIELD_BOOL( _ident, _fname, _dict ) \
- T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_BOOL, _fname, _dict )
-
-#define T1_FIELD_NUM( _ident, _fname, _dict ) \
- T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_INTEGER, _fname, _dict )
-
-#define T1_FIELD_FIXED( _ident, _fname, _dict ) \
- T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_FIXED, _fname, _dict )
-
-#define T1_FIELD_FIXED_1000( _ident, _fname, _dict ) \
- T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_FIXED_1000, _fname, \
- _dict )
-
-#define T1_FIELD_STRING( _ident, _fname, _dict ) \
- T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_STRING, _fname, _dict )
-
-#define T1_FIELD_KEY( _ident, _fname, _dict ) \
- T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_KEY, _fname, _dict )
-
-#define T1_FIELD_BBOX( _ident, _fname, _dict ) \
- T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_BBOX, _fname, _dict )
-
-
-#define T1_FIELD_NUM_TABLE( _ident, _fname, _fmax, _dict ) \
- T1_NEW_TABLE_FIELD( _ident, T1_FIELD_TYPE_INTEGER_ARRAY, \
- _fname, _fmax, _dict )
-
-#define T1_FIELD_FIXED_TABLE( _ident, _fname, _fmax, _dict ) \
- T1_NEW_TABLE_FIELD( _ident, T1_FIELD_TYPE_FIXED_ARRAY, \
- _fname, _fmax, _dict )
-
-#define T1_FIELD_NUM_TABLE2( _ident, _fname, _fmax, _dict ) \
- T1_NEW_TABLE_FIELD2( _ident, T1_FIELD_TYPE_INTEGER_ARRAY, \
- _fname, _fmax, _dict )
-
-#define T1_FIELD_FIXED_TABLE2( _ident, _fname, _fmax, _dict ) \
- T1_NEW_TABLE_FIELD2( _ident, T1_FIELD_TYPE_FIXED_ARRAY, \
- _fname, _fmax, _dict )
-
-#define T1_FIELD_CALLBACK( _ident, _name, _dict ) \
- T1_NEW_CALLBACK_FIELD( _ident, _name, _dict )
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** T1 PARSER *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
- typedef const struct PS_Parser_FuncsRec_* PS_Parser_Funcs;
-
- typedef struct PS_Parser_FuncsRec_
- {
- void
- (*init)( PS_Parser parser,
- FT_Byte* base,
- FT_Byte* limit,
- FT_Memory memory );
-
- void
- (*done)( PS_Parser parser );
-
- void
- (*skip_spaces)( PS_Parser parser );
- void
- (*skip_PS_token)( PS_Parser parser );
-
- FT_Long
- (*to_int)( PS_Parser parser );
- FT_Fixed
- (*to_fixed)( PS_Parser parser,
- FT_Int power_ten );
-
- FT_Error
- (*to_bytes)( PS_Parser parser,
- FT_Byte* bytes,
- FT_Offset max_bytes,
- FT_ULong* pnum_bytes,
- FT_Bool delimiters );
-
- FT_Int
- (*to_coord_array)( PS_Parser parser,
- FT_Int max_coords,
- FT_Short* coords );
- FT_Int
- (*to_fixed_array)( PS_Parser parser,
- FT_Int max_values,
- FT_Fixed* values,
- FT_Int power_ten );
-
- void
- (*to_token)( PS_Parser parser,
- T1_Token token );
- void
- (*to_token_array)( PS_Parser parser,
- T1_Token tokens,
- FT_UInt max_tokens,
- FT_Int* pnum_tokens );
-
- FT_Error
- (*load_field)( PS_Parser parser,
- const T1_Field field,
- void** objects,
- FT_UInt max_objects,
- FT_ULong* pflags );
-
- FT_Error
- (*load_field_table)( PS_Parser parser,
- const T1_Field field,
- void** objects,
- FT_UInt max_objects,
- FT_ULong* pflags );
-
- } PS_Parser_FuncsRec;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* PS_ParserRec */
- /* */
- /* <Description> */
- /* A PS_Parser is an object used to parse a Type 1 font very quickly. */
- /* */
- /* <Fields> */
- /* cursor :: The current position in the text. */
- /* */
- /* base :: Start of the processed text. */
- /* */
- /* limit :: End of the processed text. */
- /* */
- /* error :: The last error returned. */
- /* */
- /* memory :: The object used for memory operations (alloc/realloc). */
- /* */
- /* funcs :: A table of functions for the parser. */
- /* */
- typedef struct PS_ParserRec_
- {
- FT_Byte* cursor;
- FT_Byte* base;
- FT_Byte* limit;
- FT_Error error;
- FT_Memory memory;
-
- PS_Parser_FuncsRec funcs;
-
- } PS_ParserRec;
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** T1 BUILDER *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
-
- typedef struct T1_BuilderRec_* T1_Builder;
-
-
- typedef FT_Error
- (*T1_Builder_Check_Points_Func)( T1_Builder builder,
- FT_Int count );
-
- typedef void
- (*T1_Builder_Add_Point_Func)( T1_Builder builder,
- FT_Pos x,
- FT_Pos y,
- FT_Byte flag );
-
- typedef FT_Error
- (*T1_Builder_Add_Point1_Func)( T1_Builder builder,
- FT_Pos x,
- FT_Pos y );
-
- typedef FT_Error
- (*T1_Builder_Add_Contour_Func)( T1_Builder builder );
-
- typedef FT_Error
- (*T1_Builder_Start_Point_Func)( T1_Builder builder,
- FT_Pos x,
- FT_Pos y );
-
- typedef void
- (*T1_Builder_Close_Contour_Func)( T1_Builder builder );
-
-
- typedef const struct T1_Builder_FuncsRec_* T1_Builder_Funcs;
-
- typedef struct T1_Builder_FuncsRec_
- {
- void
- (*init)( T1_Builder builder,
- FT_Face face,
- FT_Size size,
- FT_GlyphSlot slot,
- FT_Bool hinting );
-
- void
- (*done)( T1_Builder builder );
-
- T1_Builder_Check_Points_Func check_points;
- T1_Builder_Add_Point_Func add_point;
- T1_Builder_Add_Point1_Func add_point1;
- T1_Builder_Add_Contour_Func add_contour;
- T1_Builder_Start_Point_Func start_point;
- T1_Builder_Close_Contour_Func close_contour;
-
- } T1_Builder_FuncsRec;
-
-
- /* an enumeration type to handle charstring parsing states */
- typedef enum T1_ParseState_
- {
- T1_Parse_Start,
- T1_Parse_Have_Width,
- T1_Parse_Have_Moveto,
- T1_Parse_Have_Path
-
- } T1_ParseState;
-
-
- /*************************************************************************/
- /* */
- /* <Structure> */
- /* T1_BuilderRec */
- /* */
- /* <Description> */
- /* A structure used during glyph loading to store its outline. */
- /* */
- /* <Fields> */
- /* memory :: The current memory object. */
- /* */
- /* face :: The current face object. */
- /* */
- /* glyph :: The current glyph slot. */
- /* */
- /* loader :: XXX */
- /* */
- /* base :: The base glyph outline. */
- /* */
- /* current :: The current glyph outline. */
- /* */
- /* max_points :: maximum points in builder outline */
- /* */
- /* max_contours :: Maximum number of contours in builder outline. */
- /* */
- /* pos_x :: The horizontal translation (if composite glyph). */
- /* */
- /* pos_y :: The vertical translation (if composite glyph). */
- /* */
- /* left_bearing :: The left side bearing point. */
- /* */
- /* advance :: The horizontal advance vector. */
- /* */
- /* bbox :: Unused. */
- /* */
- /* parse_state :: An enumeration which controls the charstring */
- /* parsing state. */
- /* */
- /* load_points :: If this flag is not set, no points are loaded. */
- /* */
- /* no_recurse :: Set but not used. */
- /* */
- /* metrics_only :: A boolean indicating that we only want to compute */
- /* the metrics of a given glyph, not load all of its */
- /* points. */
- /* */
- /* funcs :: An array of function pointers for the builder. */
- /* */
- typedef struct T1_BuilderRec_
- {
- FT_Memory memory;
- FT_Face face;
- FT_GlyphSlot glyph;
- FT_GlyphLoader loader;
- FT_Outline* base;
- FT_Outline* current;
-
- FT_Pos pos_x;
- FT_Pos pos_y;
-
- FT_Vector left_bearing;
- FT_Vector advance;
-
- FT_BBox bbox; /* bounding box */
- T1_ParseState parse_state;
- FT_Bool load_points;
- FT_Bool no_recurse;
-
- FT_Bool metrics_only;
-
- void* hints_funcs; /* hinter-specific */
- void* hints_globals; /* hinter-specific */
-
- T1_Builder_FuncsRec funcs;
-
- } T1_BuilderRec;
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** T1 DECODER *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
-#if 0
-
- /*************************************************************************/
- /* */
- /* T1_MAX_SUBRS_CALLS details the maximum number of nested sub-routine */
- /* calls during glyph loading. */
- /* */
-#define T1_MAX_SUBRS_CALLS 8
-
-
- /*************************************************************************/
- /* */
- /* T1_MAX_CHARSTRING_OPERANDS is the charstring stack's capacity. A */
- /* minimum of 16 is required. */
- /* */
-#define T1_MAX_CHARSTRINGS_OPERANDS 32
-
-#endif /* 0 */
-
-
- typedef struct T1_Decoder_ZoneRec_
- {
- FT_Byte* cursor;
- FT_Byte* base;
- FT_Byte* limit;
-
- } T1_Decoder_ZoneRec, *T1_Decoder_Zone;
-
-
- typedef struct T1_DecoderRec_* T1_Decoder;
- typedef const struct T1_Decoder_FuncsRec_* T1_Decoder_Funcs;
-
-
- typedef FT_Error
- (*T1_Decoder_Callback)( T1_Decoder decoder,
- FT_UInt glyph_index );
-
-
- typedef struct T1_Decoder_FuncsRec_
- {
- FT_Error
- (*init)( T1_Decoder decoder,
- FT_Face face,
- FT_Size size,
- FT_GlyphSlot slot,
- FT_Byte** glyph_names,
- PS_Blend blend,
- FT_Bool hinting,
- FT_Render_Mode hint_mode,
- T1_Decoder_Callback callback );
-
- void
- (*done)( T1_Decoder decoder );
-
- FT_Error
- (*parse_charstrings)( T1_Decoder decoder,
- FT_Byte* base,
- FT_UInt len );
-
- } T1_Decoder_FuncsRec;
-
-
- typedef struct T1_DecoderRec_
- {
- T1_BuilderRec builder;
-
- FT_Long stack[T1_MAX_CHARSTRINGS_OPERANDS];
- FT_Long* top;
-
- T1_Decoder_ZoneRec zones[T1_MAX_SUBRS_CALLS + 1];
- T1_Decoder_Zone zone;
-
- FT_Service_PsCMaps psnames; /* for seac */
- FT_UInt num_glyphs;
- FT_Byte** glyph_names;
-
- FT_Int lenIV; /* internal for sub routine calls */
- FT_Int num_subrs;
- FT_Byte** subrs;
- FT_UInt* subrs_len; /* array of subrs length (optional) */
-
- FT_Matrix font_matrix;
- FT_Vector font_offset;
-
- FT_Int flex_state;
- FT_Int num_flex_vectors;
- FT_Vector flex_vectors[7];
-
- PS_Blend blend; /* for multiple master support */
-
- FT_Render_Mode hint_mode;
-
- T1_Decoder_Callback parse_callback;
- T1_Decoder_FuncsRec funcs;
-
- FT_Long* buildchar;
- FT_UInt len_buildchar;
-
- FT_Bool seac;
-
- } T1_DecoderRec;
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** AFM PARSER *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
- typedef struct AFM_ParserRec_* AFM_Parser;
-
- typedef struct AFM_Parser_FuncsRec_
- {
- FT_Error
- (*init)( AFM_Parser parser,
- FT_Memory memory,
- FT_Byte* base,
- FT_Byte* limit );
-
- void
- (*done)( AFM_Parser parser );
-
- FT_Error
- (*parse)( AFM_Parser parser );
-
- } AFM_Parser_FuncsRec;
-
-
- typedef struct AFM_StreamRec_* AFM_Stream;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* AFM_ParserRec */
- /* */
- /* <Description> */
- /* An AFM_Parser is a parser for the AFM files. */
- /* */
- /* <Fields> */
- /* memory :: The object used for memory operations (alloc and */
- /* realloc). */
- /* */
- /* stream :: This is an opaque object. */
- /* */
- /* FontInfo :: The result will be stored here. */
- /* */
- /* get_index :: A user provided function to get a glyph index by its */
- /* name. */
- /* */
- typedef struct AFM_ParserRec_
- {
- FT_Memory memory;
- AFM_Stream stream;
-
- AFM_FontInfo FontInfo;
-
- FT_Int
- (*get_index)( const char* name,
- FT_Offset len,
- void* user_data );
-
- void* user_data;
-
- } AFM_ParserRec;
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** TYPE1 CHARMAPS *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
- typedef const struct T1_CMap_ClassesRec_* T1_CMap_Classes;
-
- typedef struct T1_CMap_ClassesRec_
- {
- FT_CMap_Class standard;
- FT_CMap_Class expert;
- FT_CMap_Class custom;
- FT_CMap_Class unicode;
-
- } T1_CMap_ClassesRec;
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** PSAux Module Interface *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
- typedef struct PSAux_ServiceRec_
- {
- /* don't use `PS_Table_Funcs' and friends to avoid compiler warnings */
- const PS_Table_FuncsRec* ps_table_funcs;
- const PS_Parser_FuncsRec* ps_parser_funcs;
- const T1_Builder_FuncsRec* t1_builder_funcs;
- const T1_Decoder_FuncsRec* t1_decoder_funcs;
-
- void
- (*t1_decrypt)( FT_Byte* buffer,
- FT_Offset length,
- FT_UShort seed );
-
- T1_CMap_Classes t1_cmap_classes;
-
- /* fields after this comment line were added after version 2.1.10 */
- const AFM_Parser_FuncsRec* afm_parser_funcs;
-
- } PSAux_ServiceRec, *PSAux_Service;
-
- /* backwards-compatible type definition */
- typedef PSAux_ServiceRec PSAux_Interface;
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** Some convenience functions *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
-#define IS_PS_NEWLINE( ch ) \
- ( (ch) == '\r' || \
- (ch) == '\n' )
-
-#define IS_PS_SPACE( ch ) \
- ( (ch) == ' ' || \
- IS_PS_NEWLINE( ch ) || \
- (ch) == '\t' || \
- (ch) == '\f' || \
- (ch) == '\0' )
-
-#define IS_PS_SPECIAL( ch ) \
- ( (ch) == '/' || \
- (ch) == '(' || (ch) == ')' || \
- (ch) == '<' || (ch) == '>' || \
- (ch) == '[' || (ch) == ']' || \
- (ch) == '{' || (ch) == '}' || \
- (ch) == '%' )
-
-#define IS_PS_DELIM( ch ) \
- ( IS_PS_SPACE( ch ) || \
- IS_PS_SPECIAL( ch ) )
-
-#define IS_PS_DIGIT( ch ) \
- ( (ch) >= '0' && (ch) <= '9' )
-
-#define IS_PS_XDIGIT( ch ) \
- ( IS_PS_DIGIT( ch ) || \
- ( (ch) >= 'A' && (ch) <= 'F' ) || \
- ( (ch) >= 'a' && (ch) <= 'f' ) )
-
-#define IS_PS_BASE85( ch ) \
- ( (ch) >= '!' && (ch) <= 'u' )
-
-#define IS_PS_TOKEN( cur, limit, token ) \
- ( (char)(cur)[0] == (token)[0] && \
- ( (cur) + sizeof ( (token) ) == (limit) || \
- ( (cur) + sizeof( (token) ) < (limit) && \
- IS_PS_DELIM( (cur)[sizeof ( (token) ) - 1] ) ) ) && \
- ft_strncmp( (char*)(cur), (token), sizeof ( (token) ) - 1 ) == 0 )
-
-
-FT_END_HEADER
-
-#endif /* __PSAUX_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/pshints.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/pshints.h
deleted file mode 100644
index 12aaabacd43..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/pshints.h
+++ /dev/null
@@ -1,722 +0,0 @@
-/***************************************************************************/
-/* */
-/* pshints.h */
-/* */
-/* Interface to Postscript-specific (Type 1 and Type 2) hints */
-/* recorders (specification only). These are used to support native */
-/* T1/T2 hints in the `type1', `cid', and `cff' font drivers. */
-/* */
-/* Copyright 2001-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __PSHINTS_H__
-#define __PSHINTS_H__
-
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_TYPE1_TABLES_H
-
-
-FT_BEGIN_HEADER
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** INTERNAL REPRESENTATION OF GLOBALS *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
- typedef struct PSH_GlobalsRec_* PSH_Globals;
-
- typedef FT_Error
- (*PSH_Globals_NewFunc)( FT_Memory memory,
- T1_Private* private_dict,
- PSH_Globals* aglobals );
-
- typedef void
- (*PSH_Globals_SetScaleFunc)( PSH_Globals globals,
- FT_Fixed x_scale,
- FT_Fixed y_scale,
- FT_Fixed x_delta,
- FT_Fixed y_delta );
-
- typedef void
- (*PSH_Globals_DestroyFunc)( PSH_Globals globals );
-
-
- typedef struct PSH_Globals_FuncsRec_
- {
- PSH_Globals_NewFunc create;
- PSH_Globals_SetScaleFunc set_scale;
- PSH_Globals_DestroyFunc destroy;
-
- } PSH_Globals_FuncsRec, *PSH_Globals_Funcs;
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** PUBLIC TYPE 1 HINTS RECORDER *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
- /*************************************************************************
- *
- * @type:
- * T1_Hints
- *
- * @description:
- * This is a handle to an opaque structure used to record glyph hints
- * from a Type 1 character glyph character string.
- *
- * The methods used to operate on this object are defined by the
- * @T1_Hints_FuncsRec structure. Recording glyph hints is normally
- * achieved through the following scheme:
- *
- * - Open a new hint recording session by calling the `open' method.
- * This rewinds the recorder and prepare it for new input.
- *
- * - For each hint found in the glyph charstring, call the corresponding
- * method (`stem', `stem3', or `reset'). Note that these functions do
- * not return an error code.
- *
- * - Close the recording session by calling the `close' method. It
- * returns an error code if the hints were invalid or something
- * strange happened (e.g., memory shortage).
- *
- * The hints accumulated in the object can later be used by the
- * PostScript hinter.
- *
- */
- typedef struct T1_HintsRec_* T1_Hints;
-
-
- /*************************************************************************
- *
- * @type:
- * T1_Hints_Funcs
- *
- * @description:
- * A pointer to the @T1_Hints_FuncsRec structure that defines the API of
- * a given @T1_Hints object.
- *
- */
- typedef const struct T1_Hints_FuncsRec_* T1_Hints_Funcs;
-
-
- /*************************************************************************
- *
- * @functype:
- * T1_Hints_OpenFunc
- *
- * @description:
- * A method of the @T1_Hints class used to prepare it for a new Type 1
- * hints recording session.
- *
- * @input:
- * hints ::
- * A handle to the Type 1 hints recorder.
- *
- * @note:
- * You should always call the @T1_Hints_CloseFunc method in order to
- * close an opened recording session.
- *
- */
- typedef void
- (*T1_Hints_OpenFunc)( T1_Hints hints );
-
-
- /*************************************************************************
- *
- * @functype:
- * T1_Hints_SetStemFunc
- *
- * @description:
- * A method of the @T1_Hints class used to record a new horizontal or
- * vertical stem. This corresponds to the Type 1 `hstem' and `vstem'
- * operators.
- *
- * @input:
- * hints ::
- * A handle to the Type 1 hints recorder.
- *
- * dimension ::
- * 0 for horizontal stems (hstem), 1 for vertical ones (vstem).
- *
- * coords ::
- * Array of 2 coordinates in 16.16 format, used as (position,length)
- * stem descriptor.
- *
- * @note:
- * Use vertical coordinates (y) for horizontal stems (dim=0). Use
- * horizontal coordinates (x) for vertical stems (dim=1).
- *
- * `coords[0]' is the absolute stem position (lowest coordinate);
- * `coords[1]' is the length.
- *
- * The length can be negative, in which case it must be either -20 or
- * -21. It is interpreted as a `ghost' stem, according to the Type 1
- * specification.
- *
- * If the length is -21 (corresponding to a bottom ghost stem), then
- * the real stem position is `coords[0]+coords[1]'.
- *
- */
- typedef void
- (*T1_Hints_SetStemFunc)( T1_Hints hints,
- FT_UInt dimension,
- FT_Fixed* coords );
-
-
- /*************************************************************************
- *
- * @functype:
- * T1_Hints_SetStem3Func
- *
- * @description:
- * A method of the @T1_Hints class used to record three
- * counter-controlled horizontal or vertical stems at once.
- *
- * @input:
- * hints ::
- * A handle to the Type 1 hints recorder.
- *
- * dimension ::
- * 0 for horizontal stems, 1 for vertical ones.
- *
- * coords ::
- * An array of 6 values in 16.16 format, holding 3 (position,length)
- * pairs for the counter-controlled stems.
- *
- * @note:
- * Use vertical coordinates (y) for horizontal stems (dim=0). Use
- * horizontal coordinates (x) for vertical stems (dim=1).
- *
- * The lengths cannot be negative (ghost stems are never
- * counter-controlled).
- *
- */
- typedef void
- (*T1_Hints_SetStem3Func)( T1_Hints hints,
- FT_UInt dimension,
- FT_Fixed* coords );
-
-
- /*************************************************************************
- *
- * @functype:
- * T1_Hints_ResetFunc
- *
- * @description:
- * A method of the @T1_Hints class used to reset the stems hints in a
- * recording session.
- *
- * @input:
- * hints ::
- * A handle to the Type 1 hints recorder.
- *
- * end_point ::
- * The index of the last point in the input glyph in which the
- * previously defined hints apply.
- *
- */
- typedef void
- (*T1_Hints_ResetFunc)( T1_Hints hints,
- FT_UInt end_point );
-
-
- /*************************************************************************
- *
- * @functype:
- * T1_Hints_CloseFunc
- *
- * @description:
- * A method of the @T1_Hints class used to close a hint recording
- * session.
- *
- * @input:
- * hints ::
- * A handle to the Type 1 hints recorder.
- *
- * end_point ::
- * The index of the last point in the input glyph.
- *
- * @return:
- * FreeType error code. 0 means success.
- *
- * @note:
- * The error code is set to indicate that an error occurred during the
- * recording session.
- *
- */
- typedef FT_Error
- (*T1_Hints_CloseFunc)( T1_Hints hints,
- FT_UInt end_point );
-
-
- /*************************************************************************
- *
- * @functype:
- * T1_Hints_ApplyFunc
- *
- * @description:
- * A method of the @T1_Hints class used to apply hints to the
- * corresponding glyph outline. Must be called once all hints have been
- * recorded.
- *
- * @input:
- * hints ::
- * A handle to the Type 1 hints recorder.
- *
- * outline ::
- * A pointer to the target outline descriptor.
- *
- * globals ::
- * The hinter globals for this font.
- *
- * hint_mode ::
- * Hinting information.
- *
- * @return:
- * FreeType error code. 0 means success.
- *
- * @note:
- * On input, all points within the outline are in font coordinates. On
- * output, they are in 1/64th of pixels.
- *
- * The scaling transformation is taken from the `globals' object which
- * must correspond to the same font as the glyph.
- *
- */
- typedef FT_Error
- (*T1_Hints_ApplyFunc)( T1_Hints hints,
- FT_Outline* outline,
- PSH_Globals globals,
- FT_Render_Mode hint_mode );
-
-
- /*************************************************************************
- *
- * @struct:
- * T1_Hints_FuncsRec
- *
- * @description:
- * The structure used to provide the API to @T1_Hints objects.
- *
- * @fields:
- * hints ::
- * A handle to the T1 Hints recorder.
- *
- * open ::
- * The function to open a recording session.
- *
- * close ::
- * The function to close a recording session.
- *
- * stem ::
- * The function to set a simple stem.
- *
- * stem3 ::
- * The function to set counter-controlled stems.
- *
- * reset ::
- * The function to reset stem hints.
- *
- * apply ::
- * The function to apply the hints to the corresponding glyph outline.
- *
- */
- typedef struct T1_Hints_FuncsRec_
- {
- T1_Hints hints;
- T1_Hints_OpenFunc open;
- T1_Hints_CloseFunc close;
- T1_Hints_SetStemFunc stem;
- T1_Hints_SetStem3Func stem3;
- T1_Hints_ResetFunc reset;
- T1_Hints_ApplyFunc apply;
-
- } T1_Hints_FuncsRec;
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** PUBLIC TYPE 2 HINTS RECORDER *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
- /*************************************************************************
- *
- * @type:
- * T2_Hints
- *
- * @description:
- * This is a handle to an opaque structure used to record glyph hints
- * from a Type 2 character glyph character string.
- *
- * The methods used to operate on this object are defined by the
- * @T2_Hints_FuncsRec structure. Recording glyph hints is normally
- * achieved through the following scheme:
- *
- * - Open a new hint recording session by calling the `open' method.
- * This rewinds the recorder and prepare it for new input.
- *
- * - For each hint found in the glyph charstring, call the corresponding
- * method (`stems', `hintmask', `counters'). Note that these
- * functions do not return an error code.
- *
- * - Close the recording session by calling the `close' method. It
- * returns an error code if the hints were invalid or something
- * strange happened (e.g., memory shortage).
- *
- * The hints accumulated in the object can later be used by the
- * Postscript hinter.
- *
- */
- typedef struct T2_HintsRec_* T2_Hints;
-
-
- /*************************************************************************
- *
- * @type:
- * T2_Hints_Funcs
- *
- * @description:
- * A pointer to the @T2_Hints_FuncsRec structure that defines the API of
- * a given @T2_Hints object.
- *
- */
- typedef const struct T2_Hints_FuncsRec_* T2_Hints_Funcs;
-
-
- /*************************************************************************
- *
- * @functype:
- * T2_Hints_OpenFunc
- *
- * @description:
- * A method of the @T2_Hints class used to prepare it for a new Type 2
- * hints recording session.
- *
- * @input:
- * hints ::
- * A handle to the Type 2 hints recorder.
- *
- * @note:
- * You should always call the @T2_Hints_CloseFunc method in order to
- * close an opened recording session.
- *
- */
- typedef void
- (*T2_Hints_OpenFunc)( T2_Hints hints );
-
-
- /*************************************************************************
- *
- * @functype:
- * T2_Hints_StemsFunc
- *
- * @description:
- * A method of the @T2_Hints class used to set the table of stems in
- * either the vertical or horizontal dimension. Equivalent to the
- * `hstem', `vstem', `hstemhm', and `vstemhm' Type 2 operators.
- *
- * @input:
- * hints ::
- * A handle to the Type 2 hints recorder.
- *
- * dimension ::
- * 0 for horizontal stems (hstem), 1 for vertical ones (vstem).
- *
- * count ::
- * The number of stems.
- *
- * coords ::
- * An array of `count' (position,length) pairs in 16.16 format.
- *
- * @note:
- * Use vertical coordinates (y) for horizontal stems (dim=0). Use
- * horizontal coordinates (x) for vertical stems (dim=1).
- *
- * There are `2*count' elements in the `coords' array. Each even
- * element is an absolute position in font units, each odd element is a
- * length in font units.
- *
- * A length can be negative, in which case it must be either -20 or
- * -21. It is interpreted as a `ghost' stem, according to the Type 1
- * specification.
- *
- */
- typedef void
- (*T2_Hints_StemsFunc)( T2_Hints hints,
- FT_UInt dimension,
- FT_Int count,
- FT_Fixed* coordinates );
-
-
- /*************************************************************************
- *
- * @functype:
- * T2_Hints_MaskFunc
- *
- * @description:
- * A method of the @T2_Hints class used to set a given hintmask (this
- * corresponds to the `hintmask' Type 2 operator).
- *
- * @input:
- * hints ::
- * A handle to the Type 2 hints recorder.
- *
- * end_point ::
- * The glyph index of the last point to which the previously defined
- * or activated hints apply.
- *
- * bit_count ::
- * The number of bits in the hint mask.
- *
- * bytes ::
- * An array of bytes modelling the hint mask.
- *
- * @note:
- * If the hintmask starts the charstring (before any glyph point
- * definition), the value of `end_point' should be 0.
- *
- * `bit_count' is the number of meaningful bits in the `bytes' array; it
- * must be equal to the total number of hints defined so far (i.e.,
- * horizontal+verticals).
- *
- * The `bytes' array can come directly from the Type 2 charstring and
- * respects the same format.
- *
- */
- typedef void
- (*T2_Hints_MaskFunc)( T2_Hints hints,
- FT_UInt end_point,
- FT_UInt bit_count,
- const FT_Byte* bytes );
-
-
- /*************************************************************************
- *
- * @functype:
- * T2_Hints_CounterFunc
- *
- * @description:
- * A method of the @T2_Hints class used to set a given counter mask
- * (this corresponds to the `hintmask' Type 2 operator).
- *
- * @input:
- * hints ::
- * A handle to the Type 2 hints recorder.
- *
- * end_point ::
- * A glyph index of the last point to which the previously defined or
- * active hints apply.
- *
- * bit_count ::
- * The number of bits in the hint mask.
- *
- * bytes ::
- * An array of bytes modelling the hint mask.
- *
- * @note:
- * If the hintmask starts the charstring (before any glyph point
- * definition), the value of `end_point' should be 0.
- *
- * `bit_count' is the number of meaningful bits in the `bytes' array; it
- * must be equal to the total number of hints defined so far (i.e.,
- * horizontal+verticals).
- *
- * The `bytes' array can come directly from the Type 2 charstring and
- * respects the same format.
- *
- */
- typedef void
- (*T2_Hints_CounterFunc)( T2_Hints hints,
- FT_UInt bit_count,
- const FT_Byte* bytes );
-
-
- /*************************************************************************
- *
- * @functype:
- * T2_Hints_CloseFunc
- *
- * @description:
- * A method of the @T2_Hints class used to close a hint recording
- * session.
- *
- * @input:
- * hints ::
- * A handle to the Type 2 hints recorder.
- *
- * end_point ::
- * The index of the last point in the input glyph.
- *
- * @return:
- * FreeType error code. 0 means success.
- *
- * @note:
- * The error code is set to indicate that an error occurred during the
- * recording session.
- *
- */
- typedef FT_Error
- (*T2_Hints_CloseFunc)( T2_Hints hints,
- FT_UInt end_point );
-
-
- /*************************************************************************
- *
- * @functype:
- * T2_Hints_ApplyFunc
- *
- * @description:
- * A method of the @T2_Hints class used to apply hints to the
- * corresponding glyph outline. Must be called after the `close'
- * method.
- *
- * @input:
- * hints ::
- * A handle to the Type 2 hints recorder.
- *
- * outline ::
- * A pointer to the target outline descriptor.
- *
- * globals ::
- * The hinter globals for this font.
- *
- * hint_mode ::
- * Hinting information.
- *
- * @return:
- * FreeType error code. 0 means success.
- *
- * @note:
- * On input, all points within the outline are in font coordinates. On
- * output, they are in 1/64th of pixels.
- *
- * The scaling transformation is taken from the `globals' object which
- * must correspond to the same font than the glyph.
- *
- */
- typedef FT_Error
- (*T2_Hints_ApplyFunc)( T2_Hints hints,
- FT_Outline* outline,
- PSH_Globals globals,
- FT_Render_Mode hint_mode );
-
-
- /*************************************************************************
- *
- * @struct:
- * T2_Hints_FuncsRec
- *
- * @description:
- * The structure used to provide the API to @T2_Hints objects.
- *
- * @fields:
- * hints ::
- * A handle to the T2 hints recorder object.
- *
- * open ::
- * The function to open a recording session.
- *
- * close ::
- * The function to close a recording session.
- *
- * stems ::
- * The function to set the dimension's stems table.
- *
- * hintmask ::
- * The function to set hint masks.
- *
- * counter ::
- * The function to set counter masks.
- *
- * apply ::
- * The function to apply the hints on the corresponding glyph outline.
- *
- */
- typedef struct T2_Hints_FuncsRec_
- {
- T2_Hints hints;
- T2_Hints_OpenFunc open;
- T2_Hints_CloseFunc close;
- T2_Hints_StemsFunc stems;
- T2_Hints_MaskFunc hintmask;
- T2_Hints_CounterFunc counter;
- T2_Hints_ApplyFunc apply;
-
- } T2_Hints_FuncsRec;
-
-
- /* */
-
-
- typedef struct PSHinter_Interface_
- {
- PSH_Globals_Funcs (*get_globals_funcs)( FT_Module module );
- T1_Hints_Funcs (*get_t1_funcs) ( FT_Module module );
- T2_Hints_Funcs (*get_t2_funcs) ( FT_Module module );
-
- } PSHinter_Interface;
-
- typedef PSHinter_Interface* PSHinter_Service;
-
-
-#ifndef FT_CONFIG_OPTION_PIC
-
-#define FT_DEFINE_PSHINTER_INTERFACE( \
- class_, \
- get_globals_funcs_, \
- get_t1_funcs_, \
- get_t2_funcs_ ) \
- static const PSHinter_Interface class_ = \
- { \
- get_globals_funcs_, \
- get_t1_funcs_, \
- get_t2_funcs_ \
- };
-
-#else /* FT_CONFIG_OPTION_PIC */
-
-#define FT_DEFINE_PSHINTER_INTERFACE( \
- class_, \
- get_globals_funcs_, \
- get_t1_funcs_, \
- get_t2_funcs_ ) \
- void \
- FT_Init_Class_ ## class_( FT_Library library, \
- PSHinter_Interface* clazz ) \
- { \
- FT_UNUSED( library ); \
- \
- clazz->get_globals_funcs = get_globals_funcs_; \
- clazz->get_t1_funcs = get_t1_funcs_; \
- clazz->get_t2_funcs = get_t2_funcs_; \
- }
-
-#endif /* FT_CONFIG_OPTION_PIC */
-
-FT_END_HEADER
-
-#endif /* __PSHINTS_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svbdf.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svbdf.h
deleted file mode 100644
index 865b53687d0..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svbdf.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/***************************************************************************/
-/* */
-/* svbdf.h */
-/* */
-/* The FreeType BDF services (specification). */
-/* */
-/* Copyright 2003-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __SVBDF_H__
-#define __SVBDF_H__
-
-#include FT_BDF_H
-#include FT_INTERNAL_SERVICE_H
-
-
-FT_BEGIN_HEADER
-
-
-#define FT_SERVICE_ID_BDF "bdf"
-
- typedef FT_Error
- (*FT_BDF_GetCharsetIdFunc)( FT_Face face,
- const char* *acharset_encoding,
- const char* *acharset_registry );
-
- typedef FT_Error
- (*FT_BDF_GetPropertyFunc)( FT_Face face,
- const char* prop_name,
- BDF_PropertyRec *aproperty );
-
-
- FT_DEFINE_SERVICE( BDF )
- {
- FT_BDF_GetCharsetIdFunc get_charset_id;
- FT_BDF_GetPropertyFunc get_property;
- };
-
-
-#ifndef FT_CONFIG_OPTION_PIC
-
-#define FT_DEFINE_SERVICE_BDFRec( class_, \
- get_charset_id_, \
- get_property_ ) \
- static const FT_Service_BDFRec class_ = \
- { \
- get_charset_id_, get_property_ \
- };
-
-#else /* FT_CONFIG_OPTION_PIC */
-
-#define FT_DEFINE_SERVICE_BDFRec( class_, \
- get_charset_id_, \
- get_property_ ) \
- void \
- FT_Init_Class_ ## class_( FT_Service_BDFRec* clazz ) \
- { \
- clazz->get_charset_id = get_charset_id_; \
- clazz->get_property = get_property_; \
- }
-
-#endif /* FT_CONFIG_OPTION_PIC */
-
- /* */
-
-
-FT_END_HEADER
-
-
-#endif /* __SVBDF_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svcid.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svcid.h
deleted file mode 100644
index 4a535a6f424..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svcid.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/***************************************************************************/
-/* */
-/* svcid.h */
-/* */
-/* The FreeType CID font services (specification). */
-/* */
-/* Copyright 2007-2015 by */
-/* Derek Clegg and Michael Toftdal. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __SVCID_H__
-#define __SVCID_H__
-
-#include FT_INTERNAL_SERVICE_H
-
-
-FT_BEGIN_HEADER
-
-
-#define FT_SERVICE_ID_CID "CID"
-
- typedef FT_Error
- (*FT_CID_GetRegistryOrderingSupplementFunc)( FT_Face face,
- const char* *registry,
- const char* *ordering,
- FT_Int *supplement );
- typedef FT_Error
- (*FT_CID_GetIsInternallyCIDKeyedFunc)( FT_Face face,
- FT_Bool *is_cid );
- typedef FT_Error
- (*FT_CID_GetCIDFromGlyphIndexFunc)( FT_Face face,
- FT_UInt glyph_index,
- FT_UInt *cid );
-
- FT_DEFINE_SERVICE( CID )
- {
- FT_CID_GetRegistryOrderingSupplementFunc get_ros;
- FT_CID_GetIsInternallyCIDKeyedFunc get_is_cid;
- FT_CID_GetCIDFromGlyphIndexFunc get_cid_from_glyph_index;
- };
-
-
-#ifndef FT_CONFIG_OPTION_PIC
-
-#define FT_DEFINE_SERVICE_CIDREC( class_, \
- get_ros_, \
- get_is_cid_, \
- get_cid_from_glyph_index_ ) \
- static const FT_Service_CIDRec class_ = \
- { \
- get_ros_, get_is_cid_, get_cid_from_glyph_index_ \
- };
-
-#else /* FT_CONFIG_OPTION_PIC */
-
-#define FT_DEFINE_SERVICE_CIDREC( class_, \
- get_ros_, \
- get_is_cid_, \
- get_cid_from_glyph_index_ ) \
- void \
- FT_Init_Class_ ## class_( FT_Library library, \
- FT_Service_CIDRec* clazz ) \
- { \
- FT_UNUSED( library ); \
- \
- clazz->get_ros = get_ros_; \
- clazz->get_is_cid = get_is_cid_; \
- clazz->get_cid_from_glyph_index = get_cid_from_glyph_index_; \
- }
-
-#endif /* FT_CONFIG_OPTION_PIC */
-
- /* */
-
-
-FT_END_HEADER
-
-
-#endif /* __SVCID_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svfntfmt.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svfntfmt.h
deleted file mode 100644
index f8b3617364c..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svfntfmt.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/***************************************************************************/
-/* */
-/* svfntfmt.h */
-/* */
-/* The FreeType font format service (specification only). */
-/* */
-/* Copyright 2003-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __SVFNTFMT_H__
-#define __SVFNTFMT_H__
-
-#include FT_INTERNAL_SERVICE_H
-
-
-FT_BEGIN_HEADER
-
-
- /*
- * A trivial service used to return the name of a face's font driver,
- * according to the XFree86 nomenclature. Note that the service data
- * is a simple constant string pointer.
- */
-
-#define FT_SERVICE_ID_FONT_FORMAT "font-format"
-
-#define FT_FONT_FORMAT_TRUETYPE "TrueType"
-#define FT_FONT_FORMAT_TYPE_1 "Type 1"
-#define FT_FONT_FORMAT_BDF "BDF"
-#define FT_FONT_FORMAT_PCF "PCF"
-#define FT_FONT_FORMAT_TYPE_42 "Type 42"
-#define FT_FONT_FORMAT_CID "CID Type 1"
-#define FT_FONT_FORMAT_CFF "CFF"
-#define FT_FONT_FORMAT_PFR "PFR"
-#define FT_FONT_FORMAT_WINFNT "Windows FNT"
-
- /* */
-
-
-FT_END_HEADER
-
-
-#endif /* __SVFNTFMT_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svgldict.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svgldict.h
deleted file mode 100644
index f78bca5d776..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svgldict.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/***************************************************************************/
-/* */
-/* svgldict.h */
-/* */
-/* The FreeType glyph dictionary services (specification). */
-/* */
-/* Copyright 2003-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __SVGLDICT_H__
-#define __SVGLDICT_H__
-
-#include FT_INTERNAL_SERVICE_H
-
-
-FT_BEGIN_HEADER
-
-
- /*
- * A service used to retrieve glyph names, as well as to find the
- * index of a given glyph name in a font.
- *
- */
-
-#define FT_SERVICE_ID_GLYPH_DICT "glyph-dict"
-
-
- typedef FT_Error
- (*FT_GlyphDict_GetNameFunc)( FT_Face face,
- FT_UInt glyph_index,
- FT_Pointer buffer,
- FT_UInt buffer_max );
-
- typedef FT_UInt
- (*FT_GlyphDict_NameIndexFunc)( FT_Face face,
- FT_String* glyph_name );
-
-
- FT_DEFINE_SERVICE( GlyphDict )
- {
- FT_GlyphDict_GetNameFunc get_name;
- FT_GlyphDict_NameIndexFunc name_index; /* optional */
- };
-
-
-#ifndef FT_CONFIG_OPTION_PIC
-
-#define FT_DEFINE_SERVICE_GLYPHDICTREC( class_, \
- get_name_, \
- name_index_) \
- static const FT_Service_GlyphDictRec class_ = \
- { \
- get_name_, name_index_ \
- };
-
-#else /* FT_CONFIG_OPTION_PIC */
-
-#define FT_DEFINE_SERVICE_GLYPHDICTREC( class_, \
- get_name_, \
- name_index_) \
- void \
- FT_Init_Class_ ## class_( FT_Library library, \
- FT_Service_GlyphDictRec* clazz ) \
- { \
- FT_UNUSED( library ); \
- \
- clazz->get_name = get_name_; \
- clazz->name_index = name_index_; \
- }
-
-#endif /* FT_CONFIG_OPTION_PIC */
-
- /* */
-
-
-FT_END_HEADER
-
-
-#endif /* __SVGLDICT_H__ */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svgxval.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svgxval.h
deleted file mode 100644
index 59cc3b70489..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svgxval.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/***************************************************************************/
-/* */
-/* svgxval.h */
-/* */
-/* FreeType API for validating TrueTypeGX/AAT tables (specification). */
-/* */
-/* Copyright 2004-2015 by */
-/* Masatake YAMATO, Red Hat K.K., */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-/***************************************************************************/
-/* */
-/* gxvalid is derived from both gxlayout module and otvalid module. */
-/* Development of gxlayout is supported by the Information-technology */
-/* Promotion Agency(IPA), Japan. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __SVGXVAL_H__
-#define __SVGXVAL_H__
-
-#include FT_GX_VALIDATE_H
-#include FT_INTERNAL_VALIDATE_H
-
-FT_BEGIN_HEADER
-
-
-#define FT_SERVICE_ID_GX_VALIDATE "truetypegx-validate"
-#define FT_SERVICE_ID_CLASSICKERN_VALIDATE "classickern-validate"
-
- typedef FT_Error
- (*gxv_validate_func)( FT_Face face,
- FT_UInt gx_flags,
- FT_Bytes tables[FT_VALIDATE_GX_LENGTH],
- FT_UInt table_length );
-
-
- typedef FT_Error
- (*ckern_validate_func)( FT_Face face,
- FT_UInt ckern_flags,
- FT_Bytes *ckern_table );
-
-
- FT_DEFINE_SERVICE( GXvalidate )
- {
- gxv_validate_func validate;
- };
-
- FT_DEFINE_SERVICE( CKERNvalidate )
- {
- ckern_validate_func validate;
- };
-
- /* */
-
-
-FT_END_HEADER
-
-
-#endif /* __SVGXVAL_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svkern.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svkern.h
deleted file mode 100644
index bc26f15941c..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svkern.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/***************************************************************************/
-/* */
-/* svkern.h */
-/* */
-/* The FreeType Kerning service (specification). */
-/* */
-/* Copyright 2006-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __SVKERN_H__
-#define __SVKERN_H__
-
-#include FT_INTERNAL_SERVICE_H
-#include FT_TRUETYPE_TABLES_H
-
-
-FT_BEGIN_HEADER
-
-#define FT_SERVICE_ID_KERNING "kerning"
-
-
- typedef FT_Error
- (*FT_Kerning_TrackGetFunc)( FT_Face face,
- FT_Fixed point_size,
- FT_Int degree,
- FT_Fixed* akerning );
-
- FT_DEFINE_SERVICE( Kerning )
- {
- FT_Kerning_TrackGetFunc get_track;
- };
-
- /* */
-
-
-FT_END_HEADER
-
-
-#endif /* __SVKERN_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svmm.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svmm.h
deleted file mode 100644
index f2cecfbb3bc..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svmm.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/***************************************************************************/
-/* */
-/* svmm.h */
-/* */
-/* The FreeType Multiple Masters and GX var services (specification). */
-/* */
-/* Copyright 2003-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __SVMM_H__
-#define __SVMM_H__
-
-#include FT_INTERNAL_SERVICE_H
-
-
-FT_BEGIN_HEADER
-
-
- /*
- * A service used to manage multiple-masters data in a given face.
- *
- * See the related APIs in `ftmm.h' (FT_MULTIPLE_MASTERS_H).
- *
- */
-
-#define FT_SERVICE_ID_MULTI_MASTERS "multi-masters"
-
-
- typedef FT_Error
- (*FT_Get_MM_Func)( FT_Face face,
- FT_Multi_Master* master );
-
- typedef FT_Error
- (*FT_Get_MM_Var_Func)( FT_Face face,
- FT_MM_Var* *master );
-
- typedef FT_Error
- (*FT_Set_MM_Design_Func)( FT_Face face,
- FT_UInt num_coords,
- FT_Long* coords );
-
- typedef FT_Error
- (*FT_Set_Var_Design_Func)( FT_Face face,
- FT_UInt num_coords,
- FT_Fixed* coords );
-
- typedef FT_Error
- (*FT_Set_MM_Blend_Func)( FT_Face face,
- FT_UInt num_coords,
- FT_Long* coords );
-
-
- FT_DEFINE_SERVICE( MultiMasters )
- {
- FT_Get_MM_Func get_mm;
- FT_Set_MM_Design_Func set_mm_design;
- FT_Set_MM_Blend_Func set_mm_blend;
- FT_Get_MM_Var_Func get_mm_var;
- FT_Set_Var_Design_Func set_var_design;
- };
-
-
-#ifndef FT_CONFIG_OPTION_PIC
-
-#define FT_DEFINE_SERVICE_MULTIMASTERSREC( class_, \
- get_mm_, \
- set_mm_design_, \
- set_mm_blend_, \
- get_mm_var_, \
- set_var_design_ ) \
- static const FT_Service_MultiMastersRec class_ = \
- { \
- get_mm_, set_mm_design_, set_mm_blend_, get_mm_var_, set_var_design_ \
- };
-
-#else /* FT_CONFIG_OPTION_PIC */
-
-#define FT_DEFINE_SERVICE_MULTIMASTERSREC( class_, \
- get_mm_, \
- set_mm_design_, \
- set_mm_blend_, \
- get_mm_var_, \
- set_var_design_ ) \
- void \
- FT_Init_Class_ ## class_( FT_Service_MultiMastersRec* clazz ) \
- { \
- clazz->get_mm = get_mm_; \
- clazz->set_mm_design = set_mm_design_; \
- clazz->set_mm_blend = set_mm_blend_; \
- clazz->get_mm_var = get_mm_var_; \
- clazz->set_var_design = set_var_design_; \
- }
-
-#endif /* FT_CONFIG_OPTION_PIC */
-
- /* */
-
-
-FT_END_HEADER
-
-#endif /* __SVMM_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svotval.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svotval.h
deleted file mode 100644
index a82a6420fd7..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svotval.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/***************************************************************************/
-/* */
-/* svotval.h */
-/* */
-/* The FreeType OpenType validation service (specification). */
-/* */
-/* Copyright 2004-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __SVOTVAL_H__
-#define __SVOTVAL_H__
-
-#include FT_OPENTYPE_VALIDATE_H
-#include FT_INTERNAL_VALIDATE_H
-
-FT_BEGIN_HEADER
-
-
-#define FT_SERVICE_ID_OPENTYPE_VALIDATE "opentype-validate"
-
-
- typedef FT_Error
- (*otv_validate_func)( FT_Face volatile face,
- FT_UInt ot_flags,
- FT_Bytes *base,
- FT_Bytes *gdef,
- FT_Bytes *gpos,
- FT_Bytes *gsub,
- FT_Bytes *jstf );
-
-
- FT_DEFINE_SERVICE( OTvalidate )
- {
- otv_validate_func validate;
- };
-
- /* */
-
-
-FT_END_HEADER
-
-
-#endif /* __SVOTVAL_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svpfr.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svpfr.h
deleted file mode 100644
index d4eb1693d0c..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svpfr.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/***************************************************************************/
-/* */
-/* svpfr.h */
-/* */
-/* Internal PFR service functions (specification). */
-/* */
-/* Copyright 2003-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __SVPFR_H__
-#define __SVPFR_H__
-
-#include FT_PFR_H
-#include FT_INTERNAL_SERVICE_H
-
-
-FT_BEGIN_HEADER
-
-
-#define FT_SERVICE_ID_PFR_METRICS "pfr-metrics"
-
-
- typedef FT_Error
- (*FT_PFR_GetMetricsFunc)( FT_Face face,
- FT_UInt *aoutline,
- FT_UInt *ametrics,
- FT_Fixed *ax_scale,
- FT_Fixed *ay_scale );
-
- typedef FT_Error
- (*FT_PFR_GetKerningFunc)( FT_Face face,
- FT_UInt left,
- FT_UInt right,
- FT_Vector *avector );
-
- typedef FT_Error
- (*FT_PFR_GetAdvanceFunc)( FT_Face face,
- FT_UInt gindex,
- FT_Pos *aadvance );
-
-
- FT_DEFINE_SERVICE( PfrMetrics )
- {
- FT_PFR_GetMetricsFunc get_metrics;
- FT_PFR_GetKerningFunc get_kerning;
- FT_PFR_GetAdvanceFunc get_advance;
-
- };
-
- /* */
-
-FT_END_HEADER
-
-#endif /* __SVPFR_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svpostnm.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svpostnm.h
deleted file mode 100644
index a89f79e4796..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svpostnm.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/***************************************************************************/
-/* */
-/* svpostnm.h */
-/* */
-/* The FreeType PostScript name services (specification). */
-/* */
-/* Copyright 2003-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __SVPOSTNM_H__
-#define __SVPOSTNM_H__
-
-#include FT_INTERNAL_SERVICE_H
-
-
-FT_BEGIN_HEADER
-
- /*
- * A trivial service used to retrieve the PostScript name of a given
- * font when available. The `get_name' field should never be NULL.
- *
- * The corresponding function can return NULL to indicate that the
- * PostScript name is not available.
- *
- * The name is owned by the face and will be destroyed with it.
- */
-
-#define FT_SERVICE_ID_POSTSCRIPT_FONT_NAME "postscript-font-name"
-
-
- typedef const char*
- (*FT_PsName_GetFunc)( FT_Face face );
-
-
- FT_DEFINE_SERVICE( PsFontName )
- {
- FT_PsName_GetFunc get_ps_font_name;
- };
-
-
-#ifndef FT_CONFIG_OPTION_PIC
-
-#define FT_DEFINE_SERVICE_PSFONTNAMEREC( class_, get_ps_font_name_ ) \
- static const FT_Service_PsFontNameRec class_ = \
- { \
- get_ps_font_name_ \
- };
-
-#else /* FT_CONFIG_OPTION_PIC */
-
-#define FT_DEFINE_SERVICE_PSFONTNAMEREC( class_, get_ps_font_name_ ) \
- void \
- FT_Init_Class_ ## class_( FT_Library library, \
- FT_Service_PsFontNameRec* clazz ) \
- { \
- FT_UNUSED( library ); \
- \
- clazz->get_ps_font_name = get_ps_font_name_; \
- }
-
-#endif /* FT_CONFIG_OPTION_PIC */
-
- /* */
-
-
-FT_END_HEADER
-
-
-#endif /* __SVPOSTNM_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svprop.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svprop.h
deleted file mode 100644
index c9f07ce33ac..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svprop.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/***************************************************************************/
-/* */
-/* svprop.h */
-/* */
-/* The FreeType property service (specification). */
-/* */
-/* Copyright 2012-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __SVPROP_H__
-#define __SVPROP_H__
-
-
-FT_BEGIN_HEADER
-
-
-#define FT_SERVICE_ID_PROPERTIES "properties"
-
-
- typedef FT_Error
- (*FT_Properties_SetFunc)( FT_Module module,
- const char* property_name,
- const void* value );
-
- typedef FT_Error
- (*FT_Properties_GetFunc)( FT_Module module,
- const char* property_name,
- void* value );
-
-
- FT_DEFINE_SERVICE( Properties )
- {
- FT_Properties_SetFunc set_property;
- FT_Properties_GetFunc get_property;
- };
-
-
-#ifndef FT_CONFIG_OPTION_PIC
-
-#define FT_DEFINE_SERVICE_PROPERTIESREC( class_, \
- set_property_, \
- get_property_ ) \
- static const FT_Service_PropertiesRec class_ = \
- { \
- set_property_, \
- get_property_ \
- };
-
-#else /* FT_CONFIG_OPTION_PIC */
-
-#define FT_DEFINE_SERVICE_PROPERTIESREC( class_, \
- set_property_, \
- get_property_ ) \
- void \
- FT_Init_Class_ ## class_( FT_Service_PropertiesRec* clazz ) \
- { \
- clazz->set_property = set_property_; \
- clazz->get_property = get_property_; \
- }
-
-#endif /* FT_CONFIG_OPTION_PIC */
-
- /* */
-
-
-FT_END_HEADER
-
-
-#endif /* __SVPROP_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svpscmap.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svpscmap.h
deleted file mode 100644
index 66da6e10438..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svpscmap.h
+++ /dev/null
@@ -1,177 +0,0 @@
-/***************************************************************************/
-/* */
-/* svpscmap.h */
-/* */
-/* The FreeType PostScript charmap service (specification). */
-/* */
-/* Copyright 2003-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __SVPSCMAP_H__
-#define __SVPSCMAP_H__
-
-#include FT_INTERNAL_OBJECTS_H
-
-
-FT_BEGIN_HEADER
-
-
-#define FT_SERVICE_ID_POSTSCRIPT_CMAPS "postscript-cmaps"
-
-
- /*
- * Adobe glyph name to unicode value.
- */
- typedef FT_UInt32
- (*PS_Unicode_ValueFunc)( const char* glyph_name );
-
- /*
- * Macintosh name id to glyph name. NULL if invalid index.
- */
- typedef const char*
- (*PS_Macintosh_NameFunc)( FT_UInt name_index );
-
- /*
- * Adobe standard string ID to glyph name. NULL if invalid index.
- */
- typedef const char*
- (*PS_Adobe_Std_StringsFunc)( FT_UInt string_index );
-
-
- /*
- * Simple unicode -> glyph index charmap built from font glyph names
- * table.
- */
- typedef struct PS_UniMap_
- {
- FT_UInt32 unicode; /* bit 31 set: is glyph variant */
- FT_UInt glyph_index;
-
- } PS_UniMap;
-
-
- typedef struct PS_UnicodesRec_* PS_Unicodes;
-
- typedef struct PS_UnicodesRec_
- {
- FT_CMapRec cmap;
- FT_UInt num_maps;
- PS_UniMap* maps;
-
- } PS_UnicodesRec;
-
-
- /*
- * A function which returns a glyph name for a given index. Returns
- * NULL if invalid index.
- */
- typedef const char*
- (*PS_GetGlyphNameFunc)( FT_Pointer data,
- FT_UInt string_index );
-
- /*
- * A function used to release the glyph name returned by
- * PS_GetGlyphNameFunc, when needed
- */
- typedef void
- (*PS_FreeGlyphNameFunc)( FT_Pointer data,
- const char* name );
-
- typedef FT_Error
- (*PS_Unicodes_InitFunc)( FT_Memory memory,
- PS_Unicodes unicodes,
- FT_UInt num_glyphs,
- PS_GetGlyphNameFunc get_glyph_name,
- PS_FreeGlyphNameFunc free_glyph_name,
- FT_Pointer glyph_data );
-
- typedef FT_UInt
- (*PS_Unicodes_CharIndexFunc)( PS_Unicodes unicodes,
- FT_UInt32 unicode );
-
- typedef FT_UInt32
- (*PS_Unicodes_CharNextFunc)( PS_Unicodes unicodes,
- FT_UInt32 *unicode );
-
-
- FT_DEFINE_SERVICE( PsCMaps )
- {
- PS_Unicode_ValueFunc unicode_value;
-
- PS_Unicodes_InitFunc unicodes_init;
- PS_Unicodes_CharIndexFunc unicodes_char_index;
- PS_Unicodes_CharNextFunc unicodes_char_next;
-
- PS_Macintosh_NameFunc macintosh_name;
- PS_Adobe_Std_StringsFunc adobe_std_strings;
- const unsigned short* adobe_std_encoding;
- const unsigned short* adobe_expert_encoding;
- };
-
-
-#ifndef FT_CONFIG_OPTION_PIC
-
-#define FT_DEFINE_SERVICE_PSCMAPSREC( class_, \
- unicode_value_, \
- unicodes_init_, \
- unicodes_char_index_, \
- unicodes_char_next_, \
- macintosh_name_, \
- adobe_std_strings_, \
- adobe_std_encoding_, \
- adobe_expert_encoding_ ) \
- static const FT_Service_PsCMapsRec class_ = \
- { \
- unicode_value_, unicodes_init_, \
- unicodes_char_index_, unicodes_char_next_, macintosh_name_, \
- adobe_std_strings_, adobe_std_encoding_, adobe_expert_encoding_ \
- };
-
-#else /* FT_CONFIG_OPTION_PIC */
-
-#define FT_DEFINE_SERVICE_PSCMAPSREC( class_, \
- unicode_value_, \
- unicodes_init_, \
- unicodes_char_index_, \
- unicodes_char_next_, \
- macintosh_name_, \
- adobe_std_strings_, \
- adobe_std_encoding_, \
- adobe_expert_encoding_ ) \
- void \
- FT_Init_Class_ ## class_( FT_Library library, \
- FT_Service_PsCMapsRec* clazz ) \
- { \
- FT_UNUSED( library ); \
- \
- clazz->unicode_value = unicode_value_; \
- clazz->unicodes_init = unicodes_init_; \
- clazz->unicodes_char_index = unicodes_char_index_; \
- clazz->unicodes_char_next = unicodes_char_next_; \
- clazz->macintosh_name = macintosh_name_; \
- clazz->adobe_std_strings = adobe_std_strings_; \
- clazz->adobe_std_encoding = adobe_std_encoding_; \
- clazz->adobe_expert_encoding = adobe_expert_encoding_; \
- }
-
-#endif /* FT_CONFIG_OPTION_PIC */
-
- /* */
-
-
-FT_END_HEADER
-
-
-#endif /* __SVPSCMAP_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svpsinfo.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svpsinfo.h
deleted file mode 100644
index 752a2660258..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svpsinfo.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/***************************************************************************/
-/* */
-/* svpsinfo.h */
-/* */
-/* The FreeType PostScript info service (specification). */
-/* */
-/* Copyright 2003-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __SVPSINFO_H__
-#define __SVPSINFO_H__
-
-#include FT_INTERNAL_SERVICE_H
-#include FT_INTERNAL_TYPE1_TYPES_H
-
-
-FT_BEGIN_HEADER
-
-
-#define FT_SERVICE_ID_POSTSCRIPT_INFO "postscript-info"
-
-
- typedef FT_Error
- (*PS_GetFontInfoFunc)( FT_Face face,
- PS_FontInfoRec* afont_info );
-
- typedef FT_Error
- (*PS_GetFontExtraFunc)( FT_Face face,
- PS_FontExtraRec* afont_extra );
-
- typedef FT_Int
- (*PS_HasGlyphNamesFunc)( FT_Face face );
-
- typedef FT_Error
- (*PS_GetFontPrivateFunc)( FT_Face face,
- PS_PrivateRec* afont_private );
-
- typedef FT_Long
- (*PS_GetFontValueFunc)( FT_Face face,
- PS_Dict_Keys key,
- FT_UInt idx,
- void *value,
- FT_Long value_len );
-
-
- FT_DEFINE_SERVICE( PsInfo )
- {
- PS_GetFontInfoFunc ps_get_font_info;
- PS_GetFontExtraFunc ps_get_font_extra;
- PS_HasGlyphNamesFunc ps_has_glyph_names;
- PS_GetFontPrivateFunc ps_get_font_private;
- PS_GetFontValueFunc ps_get_font_value;
- };
-
-
-#ifndef FT_CONFIG_OPTION_PIC
-
-#define FT_DEFINE_SERVICE_PSINFOREC( class_, \
- get_font_info_, \
- ps_get_font_extra_, \
- has_glyph_names_, \
- get_font_private_, \
- get_font_value_ ) \
- static const FT_Service_PsInfoRec class_ = \
- { \
- get_font_info_, ps_get_font_extra_, has_glyph_names_, \
- get_font_private_, get_font_value_ \
- };
-
-#else /* FT_CONFIG_OPTION_PIC */
-
-#define FT_DEFINE_SERVICE_PSINFOREC( class_, \
- get_font_info_, \
- ps_get_font_extra_, \
- has_glyph_names_, \
- get_font_private_, \
- get_font_value_ ) \
- void \
- FT_Init_Class_ ## class_( FT_Library library, \
- FT_Service_PsInfoRec* clazz ) \
- { \
- FT_UNUSED( library ); \
- \
- clazz->ps_get_font_info = get_font_info_; \
- clazz->ps_get_font_extra = ps_get_font_extra_; \
- clazz->ps_has_glyph_names = has_glyph_names_; \
- clazz->ps_get_font_private = get_font_private_; \
- clazz->ps_get_font_value = get_font_value_; \
- }
-
-#endif /* FT_CONFIG_OPTION_PIC */
-
- /* */
-
-
-FT_END_HEADER
-
-
-#endif /* __SVPSINFO_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svsfnt.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svsfnt.h
deleted file mode 100644
index 252ae1cf5eb..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svsfnt.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/***************************************************************************/
-/* */
-/* svsfnt.h */
-/* */
-/* The FreeType SFNT table loading service (specification). */
-/* */
-/* Copyright 2003-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __SVSFNT_H__
-#define __SVSFNT_H__
-
-#include FT_INTERNAL_SERVICE_H
-#include FT_TRUETYPE_TABLES_H
-
-
-FT_BEGIN_HEADER
-
-
- /*
- * SFNT table loading service.
- */
-
-#define FT_SERVICE_ID_SFNT_TABLE "sfnt-table"
-
-
- /*
- * Used to implement FT_Load_Sfnt_Table().
- */
- typedef FT_Error
- (*FT_SFNT_TableLoadFunc)( FT_Face face,
- FT_ULong tag,
- FT_Long offset,
- FT_Byte* buffer,
- FT_ULong* length );
-
- /*
- * Used to implement FT_Get_Sfnt_Table().
- */
- typedef void*
- (*FT_SFNT_TableGetFunc)( FT_Face face,
- FT_Sfnt_Tag tag );
-
-
- /*
- * Used to implement FT_Sfnt_Table_Info().
- */
- typedef FT_Error
- (*FT_SFNT_TableInfoFunc)( FT_Face face,
- FT_UInt idx,
- FT_ULong *tag,
- FT_ULong *offset,
- FT_ULong *length );
-
-
- FT_DEFINE_SERVICE( SFNT_Table )
- {
- FT_SFNT_TableLoadFunc load_table;
- FT_SFNT_TableGetFunc get_table;
- FT_SFNT_TableInfoFunc table_info;
- };
-
-
-#ifndef FT_CONFIG_OPTION_PIC
-
-#define FT_DEFINE_SERVICE_SFNT_TABLEREC( class_, load_, get_, info_ ) \
- static const FT_Service_SFNT_TableRec class_ = \
- { \
- load_, get_, info_ \
- };
-
-#else /* FT_CONFIG_OPTION_PIC */
-
-#define FT_DEFINE_SERVICE_SFNT_TABLEREC( class_, load_, get_, info_ ) \
- void \
- FT_Init_Class_ ## class_( FT_Service_SFNT_TableRec* clazz ) \
- { \
- clazz->load_table = load_; \
- clazz->get_table = get_; \
- clazz->table_info = info_; \
- }
-
-#endif /* FT_CONFIG_OPTION_PIC */
-
- /* */
-
-
-FT_END_HEADER
-
-
-#endif /* __SVSFNT_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svttcmap.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svttcmap.h
deleted file mode 100644
index cd95b9ab81f..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svttcmap.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/***************************************************************************/
-/* */
-/* svttcmap.h */
-/* */
-/* The FreeType TrueType/sfnt cmap extra information service. */
-/* */
-/* Copyright 2003-2015 by */
-/* Masatake YAMATO, Redhat K.K., */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-/* Development of this service is support of
- Information-technology Promotion Agency, Japan. */
-
-#ifndef __SVTTCMAP_H__
-#define __SVTTCMAP_H__
-
-#include FT_INTERNAL_SERVICE_H
-#include FT_TRUETYPE_TABLES_H
-
-
-FT_BEGIN_HEADER
-
-
-#define FT_SERVICE_ID_TT_CMAP "tt-cmaps"
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* TT_CMapInfo */
- /* */
- /* <Description> */
- /* A structure used to store TrueType/sfnt specific cmap information */
- /* which is not covered by the generic @FT_CharMap structure. This */
- /* structure can be accessed with the @FT_Get_TT_CMap_Info function. */
- /* */
- /* <Fields> */
- /* language :: */
- /* The language ID used in Mac fonts. Definitions of values are in */
- /* `ttnameid.h'. */
- /* */
- /* format :: */
- /* The cmap format. OpenType 1.6 defines the formats 0 (byte */
- /* encoding table), 2~(high-byte mapping through table), 4~(segment */
- /* mapping to delta values), 6~(trimmed table mapping), 8~(mixed */
- /* 16-bit and 32-bit coverage), 10~(trimmed array), 12~(segmented */
- /* coverage), 13~(last resort font), and 14 (Unicode Variation */
- /* Sequences). */
- /* */
- typedef struct TT_CMapInfo_
- {
- FT_ULong language;
- FT_Long format;
-
- } TT_CMapInfo;
-
-
- typedef FT_Error
- (*TT_CMap_Info_GetFunc)( FT_CharMap charmap,
- TT_CMapInfo *cmap_info );
-
-
- FT_DEFINE_SERVICE( TTCMaps )
- {
- TT_CMap_Info_GetFunc get_cmap_info;
- };
-
-#ifndef FT_CONFIG_OPTION_PIC
-
-#define FT_DEFINE_SERVICE_TTCMAPSREC( class_, get_cmap_info_ ) \
- static const FT_Service_TTCMapsRec class_ = \
- { \
- get_cmap_info_ \
- };
-
-#else /* FT_CONFIG_OPTION_PIC */
-
-#define FT_DEFINE_SERVICE_TTCMAPSREC( class_, get_cmap_info_ ) \
- void \
- FT_Init_Class_ ## class_( FT_Library library, \
- FT_Service_TTCMapsRec* clazz ) \
- { \
- FT_UNUSED( library ); \
- \
- clazz->get_cmap_info = get_cmap_info_; \
- }
-
-#endif /* FT_CONFIG_OPTION_PIC */
-
- /* */
-
-
-FT_END_HEADER
-
-#endif /* __SVTTCMAP_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svtteng.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svtteng.h
deleted file mode 100644
index 272ee8c0553..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svtteng.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/***************************************************************************/
-/* */
-/* svtteng.h */
-/* */
-/* The FreeType TrueType engine query service (specification). */
-/* */
-/* Copyright 2006-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __SVTTENG_H__
-#define __SVTTENG_H__
-
-#include FT_INTERNAL_SERVICE_H
-#include FT_MODULE_H
-
-
-FT_BEGIN_HEADER
-
-
- /*
- * SFNT table loading service.
- */
-
-#define FT_SERVICE_ID_TRUETYPE_ENGINE "truetype-engine"
-
- /*
- * Used to implement FT_Get_TrueType_Engine_Type
- */
-
- FT_DEFINE_SERVICE( TrueTypeEngine )
- {
- FT_TrueTypeEngineType engine_type;
- };
-
- /* */
-
-
-FT_END_HEADER
-
-
-#endif /* __SVTTENG_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svttglyf.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svttglyf.h
deleted file mode 100644
index f5cb76a9f85..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svttglyf.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/***************************************************************************/
-/* */
-/* svttglyf.h */
-/* */
-/* The FreeType TrueType glyph service. */
-/* */
-/* Copyright 2007-2015 by */
-/* David Turner. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-#ifndef __SVTTGLYF_H__
-#define __SVTTGLYF_H__
-
-#include FT_INTERNAL_SERVICE_H
-#include FT_TRUETYPE_TABLES_H
-
-
-FT_BEGIN_HEADER
-
-
-#define FT_SERVICE_ID_TT_GLYF "tt-glyf"
-
-
- typedef FT_ULong
- (*TT_Glyf_GetLocationFunc)( FT_Face face,
- FT_UInt gindex,
- FT_ULong *psize );
-
- FT_DEFINE_SERVICE( TTGlyf )
- {
- TT_Glyf_GetLocationFunc get_location;
- };
-
-
-#ifndef FT_CONFIG_OPTION_PIC
-
-#define FT_DEFINE_SERVICE_TTGLYFREC( class_, get_location_ ) \
- static const FT_Service_TTGlyfRec class_ = \
- { \
- get_location_ \
- };
-
-#else /* FT_CONFIG_OPTION_PIC */
-
-#define FT_DEFINE_SERVICE_TTGLYFREC( class_, get_location_ ) \
- void \
- FT_Init_Class_ ## class_( FT_Service_TTGlyfRec* clazz ) \
- { \
- clazz->get_location = get_location_; \
- }
-
-#endif /* FT_CONFIG_OPTION_PIC */
-
- /* */
-
-
-FT_END_HEADER
-
-#endif /* __SVTTGLYF_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svwinfnt.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svwinfnt.h
deleted file mode 100644
index 0036929b2f8..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/services/svwinfnt.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/***************************************************************************/
-/* */
-/* svwinfnt.h */
-/* */
-/* The FreeType Windows FNT/FONT service (specification). */
-/* */
-/* Copyright 2003-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __SVWINFNT_H__
-#define __SVWINFNT_H__
-
-#include FT_INTERNAL_SERVICE_H
-#include FT_WINFONTS_H
-
-
-FT_BEGIN_HEADER
-
-
-#define FT_SERVICE_ID_WINFNT "winfonts"
-
- typedef FT_Error
- (*FT_WinFnt_GetHeaderFunc)( FT_Face face,
- FT_WinFNT_HeaderRec *aheader );
-
-
- FT_DEFINE_SERVICE( WinFnt )
- {
- FT_WinFnt_GetHeaderFunc get_header;
- };
-
- /* */
-
-
-FT_END_HEADER
-
-
-#endif /* __SVWINFNT_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/sfnt.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/sfnt.h
deleted file mode 100644
index 30f53bf09ce..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/sfnt.h
+++ /dev/null
@@ -1,748 +0,0 @@
-/***************************************************************************/
-/* */
-/* sfnt.h */
-/* */
-/* High-level `sfnt' driver interface (specification). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __SFNT_H__
-#define __SFNT_H__
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_DRIVER_H
-#include FT_INTERNAL_TRUETYPE_TYPES_H
-
-
-FT_BEGIN_HEADER
-
-
- /*************************************************************************/
- /* */
- /* <FuncType> */
- /* TT_Init_Face_Func */
- /* */
- /* <Description> */
- /* First part of the SFNT face object initialization. This finds */
- /* the face in a SFNT file or collection, and load its format tag in */
- /* face->format_tag. */
- /* */
- /* <Input> */
- /* stream :: The input stream. */
- /* */
- /* face :: A handle to the target face object. */
- /* */
- /* face_index :: The index of the TrueType font, if we are opening a */
- /* collection, in bits 0-15. The numbered instance */
- /* index~+~1 of a GX (sub)font, if applicable, in bits */
- /* 16-30. */
- /* */
- /* num_params :: The number of additional parameters. */
- /* */
- /* params :: Optional additional parameters. */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. */
- /* */
- /* <Note> */
- /* The stream cursor must be at the font file's origin. */
- /* */
- /* This function recognizes fonts embedded in a `TrueType */
- /* collection'. */
- /* */
- /* Once the format tag has been validated by the font driver, it */
- /* should then call the TT_Load_Face_Func() callback to read the rest */
- /* of the SFNT tables in the object. */
- /* */
- typedef FT_Error
- (*TT_Init_Face_Func)( FT_Stream stream,
- TT_Face face,
- FT_Int face_index,
- FT_Int num_params,
- FT_Parameter* params );
-
-
- /*************************************************************************/
- /* */
- /* <FuncType> */
- /* TT_Load_Face_Func */
- /* */
- /* <Description> */
- /* Second part of the SFNT face object initialization. This loads */
- /* the common SFNT tables (head, OS/2, maxp, metrics, etc.) in the */
- /* face object. */
- /* */
- /* <Input> */
- /* stream :: The input stream. */
- /* */
- /* face :: A handle to the target face object. */
- /* */
- /* face_index :: The index of the TrueType font, if we are opening a */
- /* collection, in bits 0-15. The numbered instance */
- /* index~+~1 of a GX (sub)font, if applicable, in bits */
- /* 16-30. */
- /* */
- /* num_params :: The number of additional parameters. */
- /* */
- /* params :: Optional additional parameters. */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. */
- /* */
- /* <Note> */
- /* This function must be called after TT_Init_Face_Func(). */
- /* */
- typedef FT_Error
- (*TT_Load_Face_Func)( FT_Stream stream,
- TT_Face face,
- FT_Int face_index,
- FT_Int num_params,
- FT_Parameter* params );
-
-
- /*************************************************************************/
- /* */
- /* <FuncType> */
- /* TT_Done_Face_Func */
- /* */
- /* <Description> */
- /* A callback used to delete the common SFNT data from a face. */
- /* */
- /* <Input> */
- /* face :: A handle to the target face object. */
- /* */
- /* <Note> */
- /* This function does NOT destroy the face object. */
- /* */
- typedef void
- (*TT_Done_Face_Func)( TT_Face face );
-
-
- /*************************************************************************/
- /* */
- /* <FuncType> */
- /* TT_Load_Any_Func */
- /* */
- /* <Description> */
- /* Load any font table into client memory. */
- /* */
- /* <Input> */
- /* face :: The face object to look for. */
- /* */
- /* tag :: The tag of table to load. Use the value 0 if you want */
- /* to access the whole font file, else set this parameter */
- /* to a valid TrueType table tag that you can forge with */
- /* the MAKE_TT_TAG macro. */
- /* */
- /* offset :: The starting offset in the table (or the file if */
- /* tag == 0). */
- /* */
- /* length :: The address of the decision variable: */
- /* */
- /* If length == NULL: */
- /* Loads the whole table. Returns an error if */
- /* `offset' == 0! */
- /* */
- /* If *length == 0: */
- /* Exits immediately; returning the length of the given */
- /* table or of the font file, depending on the value of */
- /* `tag'. */
- /* */
- /* If *length != 0: */
- /* Loads the next `length' bytes of table or font, */
- /* starting at offset `offset' (in table or font too). */
- /* */
- /* <Output> */
- /* buffer :: The address of target buffer. */
- /* */
- /* <Return> */
- /* TrueType error code. 0 means success. */
- /* */
- typedef FT_Error
- (*TT_Load_Any_Func)( TT_Face face,
- FT_ULong tag,
- FT_Long offset,
- FT_Byte *buffer,
- FT_ULong* length );
-
-
- /*************************************************************************/
- /* */
- /* <FuncType> */
- /* TT_Find_SBit_Image_Func */
- /* */
- /* <Description> */
- /* Check whether an embedded bitmap (an `sbit') exists for a given */
- /* glyph, at a given strike. */
- /* */
- /* <Input> */
- /* face :: The target face object. */
- /* */
- /* glyph_index :: The glyph index. */
- /* */
- /* strike_index :: The current strike index. */
- /* */
- /* <Output> */
- /* arange :: The SBit range containing the glyph index. */
- /* */
- /* astrike :: The SBit strike containing the glyph index. */
- /* */
- /* aglyph_offset :: The offset of the glyph data in `EBDT' table. */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. Returns */
- /* SFNT_Err_Invalid_Argument if no sbit exists for the requested */
- /* glyph. */
- /* */
- typedef FT_Error
- (*TT_Find_SBit_Image_Func)( TT_Face face,
- FT_UInt glyph_index,
- FT_ULong strike_index,
- TT_SBit_Range *arange,
- TT_SBit_Strike *astrike,
- FT_ULong *aglyph_offset );
-
-
- /*************************************************************************/
- /* */
- /* <FuncType> */
- /* TT_Load_SBit_Metrics_Func */
- /* */
- /* <Description> */
- /* Get the big metrics for a given embedded bitmap. */
- /* */
- /* <Input> */
- /* stream :: The input stream. */
- /* */
- /* range :: The SBit range containing the glyph. */
- /* */
- /* <Output> */
- /* big_metrics :: A big SBit metrics structure for the glyph. */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. */
- /* */
- /* <Note> */
- /* The stream cursor must be positioned at the glyph's offset within */
- /* the `EBDT' table before the call. */
- /* */
- /* If the image format uses variable metrics, the stream cursor is */
- /* positioned just after the metrics header in the `EBDT' table on */
- /* function exit. */
- /* */
- typedef FT_Error
- (*TT_Load_SBit_Metrics_Func)( FT_Stream stream,
- TT_SBit_Range range,
- TT_SBit_Metrics metrics );
-
-
- /*************************************************************************/
- /* */
- /* <FuncType> */
- /* TT_Load_SBit_Image_Func */
- /* */
- /* <Description> */
- /* Load a given glyph sbit image from the font resource. This also */
- /* returns its metrics. */
- /* */
- /* <Input> */
- /* face :: */
- /* The target face object. */
- /* */
- /* strike_index :: */
- /* The strike index. */
- /* */
- /* glyph_index :: */
- /* The current glyph index. */
- /* */
- /* load_flags :: */
- /* The current load flags. */
- /* */
- /* stream :: */
- /* The input stream. */
- /* */
- /* <Output> */
- /* amap :: */
- /* The target pixmap. */
- /* */
- /* ametrics :: */
- /* A big sbit metrics structure for the glyph image. */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. Returns an error if no */
- /* glyph sbit exists for the index. */
- /* */
- /* <Note> */
- /* The `map.buffer' field is always freed before the glyph is loaded. */
- /* */
- typedef FT_Error
- (*TT_Load_SBit_Image_Func)( TT_Face face,
- FT_ULong strike_index,
- FT_UInt glyph_index,
- FT_UInt load_flags,
- FT_Stream stream,
- FT_Bitmap *amap,
- TT_SBit_MetricsRec *ametrics );
-
-
- /*************************************************************************/
- /* */
- /* <FuncType> */
- /* TT_Set_SBit_Strike_Func */
- /* */
- /* <Description> */
- /* Select an sbit strike for a given size request. */
- /* */
- /* <Input> */
- /* face :: The target face object. */
- /* */
- /* req :: The size request. */
- /* */
- /* <Output> */
- /* astrike_index :: The index of the sbit strike. */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. Returns an error if no */
- /* sbit strike exists for the selected ppem values. */
- /* */
- typedef FT_Error
- (*TT_Set_SBit_Strike_Func)( TT_Face face,
- FT_Size_Request req,
- FT_ULong* astrike_index );
-
-
- /*************************************************************************/
- /* */
- /* <FuncType> */
- /* TT_Load_Strike_Metrics_Func */
- /* */
- /* <Description> */
- /* Load the metrics of a given strike. */
- /* */
- /* <Input> */
- /* face :: The target face object. */
- /* */
- /* strike_index :: The strike index. */
- /* */
- /* <Output> */
- /* metrics :: the metrics of the strike. */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. Returns an error if no */
- /* such sbit strike exists. */
- /* */
- typedef FT_Error
- (*TT_Load_Strike_Metrics_Func)( TT_Face face,
- FT_ULong strike_index,
- FT_Size_Metrics* metrics );
-
-
- /*************************************************************************/
- /* */
- /* <FuncType> */
- /* TT_Get_PS_Name_Func */
- /* */
- /* <Description> */
- /* Get the PostScript glyph name of a glyph. */
- /* */
- /* <Input> */
- /* idx :: The glyph index. */
- /* */
- /* PSname :: The address of a string pointer. Will be NULL in case */
- /* of error, otherwise it is a pointer to the glyph name. */
- /* */
- /* You must not modify the returned string! */
- /* */
- /* <Output> */
- /* FreeType error code. 0 means success. */
- /* */
- typedef FT_Error
- (*TT_Get_PS_Name_Func)( TT_Face face,
- FT_UInt idx,
- FT_String** PSname );
-
-
- /*************************************************************************/
- /* */
- /* <FuncType> */
- /* TT_Load_Metrics_Func */
- /* */
- /* <Description> */
- /* Load a metrics table, which is a table with a horizontal and a */
- /* vertical version. */
- /* */
- /* <Input> */
- /* face :: A handle to the target face object. */
- /* */
- /* stream :: The input stream. */
- /* */
- /* vertical :: A boolean flag. If set, load the vertical one. */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. */
- /* */
- typedef FT_Error
- (*TT_Load_Metrics_Func)( TT_Face face,
- FT_Stream stream,
- FT_Bool vertical );
-
-
- /*************************************************************************/
- /* */
- /* <FuncType> */
- /* TT_Get_Metrics_Func */
- /* */
- /* <Description> */
- /* Load the horizontal or vertical header in a face object. */
- /* */
- /* <Input> */
- /* face :: A handle to the target face object. */
- /* */
- /* vertical :: A boolean flag. If set, load vertical metrics. */
- /* */
- /* gindex :: The glyph index. */
- /* */
- /* <Output> */
- /* abearing :: The horizontal (or vertical) bearing. Set to zero in */
- /* case of error. */
- /* */
- /* aadvance :: The horizontal (or vertical) advance. Set to zero in */
- /* case of error. */
- /* */
- typedef void
- (*TT_Get_Metrics_Func)( TT_Face face,
- FT_Bool vertical,
- FT_UInt gindex,
- FT_Short* abearing,
- FT_UShort* aadvance );
-
-
- /*************************************************************************/
- /* */
- /* <FuncType> */
- /* TT_Get_Name_Func */
- /* */
- /* <Description> */
- /* From the `name' table, return a given ENGLISH name record in */
- /* ASCII. */
- /* */
- /* <Input> */
- /* face :: A handle to the source face object. */
- /* */
- /* nameid :: The name id of the name record to return. */
- /* */
- /* <InOut> */
- /* name :: The address of an allocated string pointer. NULL if */
- /* no name is present. */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. */
- /* */
- typedef FT_Error
- (*TT_Get_Name_Func)( TT_Face face,
- FT_UShort nameid,
- FT_String** name );
-
-
- /*************************************************************************/
- /* */
- /* <FuncType> */
- /* TT_Load_Table_Func */
- /* */
- /* <Description> */
- /* Load a given TrueType table. */
- /* */
- /* <Input> */
- /* face :: A handle to the target face object. */
- /* */
- /* stream :: The input stream. */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. */
- /* */
- /* <Note> */
- /* The function uses `face->goto_table' to seek the stream to the */
- /* start of the table, except while loading the font directory. */
- /* */
- typedef FT_Error
- (*TT_Load_Table_Func)( TT_Face face,
- FT_Stream stream );
-
-
- /*************************************************************************/
- /* */
- /* <FuncType> */
- /* TT_Free_Table_Func */
- /* */
- /* <Description> */
- /* Free a given TrueType table. */
- /* */
- /* <Input> */
- /* face :: A handle to the target face object. */
- /* */
- typedef void
- (*TT_Free_Table_Func)( TT_Face face );
-
-
- /*
- * @functype:
- * TT_Face_GetKerningFunc
- *
- * @description:
- * Return the horizontal kerning value between two glyphs.
- *
- * @input:
- * face :: A handle to the source face object.
- * left_glyph :: The left glyph index.
- * right_glyph :: The right glyph index.
- *
- * @return:
- * The kerning value in font units.
- */
- typedef FT_Int
- (*TT_Face_GetKerningFunc)( TT_Face face,
- FT_UInt left_glyph,
- FT_UInt right_glyph );
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* SFNT_Interface */
- /* */
- /* <Description> */
- /* This structure holds pointers to the functions used to load and */
- /* free the basic tables that are required in a `sfnt' font file. */
- /* */
- /* <Fields> */
- /* Check the various xxx_Func() descriptions for details. */
- /* */
- typedef struct SFNT_Interface_
- {
- TT_Loader_GotoTableFunc goto_table;
-
- TT_Init_Face_Func init_face;
- TT_Load_Face_Func load_face;
- TT_Done_Face_Func done_face;
- FT_Module_Requester get_interface;
-
- TT_Load_Any_Func load_any;
-
- /* these functions are called by `load_face' but they can also */
- /* be called from external modules, if there is a need to do so */
- TT_Load_Table_Func load_head;
- TT_Load_Metrics_Func load_hhea;
- TT_Load_Table_Func load_cmap;
- TT_Load_Table_Func load_maxp;
- TT_Load_Table_Func load_os2;
- TT_Load_Table_Func load_post;
-
- TT_Load_Table_Func load_name;
- TT_Free_Table_Func free_name;
-
- /* this field was called `load_kerning' up to version 2.1.10 */
- TT_Load_Table_Func load_kern;
-
- TT_Load_Table_Func load_gasp;
- TT_Load_Table_Func load_pclt;
-
- /* see `ttload.h'; this field was called `load_bitmap_header' up to */
- /* version 2.1.10 */
- TT_Load_Table_Func load_bhed;
-
- TT_Load_SBit_Image_Func load_sbit_image;
-
- /* see `ttpost.h' */
- TT_Get_PS_Name_Func get_psname;
- TT_Free_Table_Func free_psnames;
-
- /* starting here, the structure differs from version 2.1.7 */
-
- /* this field was introduced in version 2.1.8, named `get_psname' */
- TT_Face_GetKerningFunc get_kerning;
-
- /* new elements introduced after version 2.1.10 */
-
- /* load the font directory, i.e., the offset table and */
- /* the table directory */
- TT_Load_Table_Func load_font_dir;
- TT_Load_Metrics_Func load_hmtx;
-
- TT_Load_Table_Func load_eblc;
- TT_Free_Table_Func free_eblc;
-
- TT_Set_SBit_Strike_Func set_sbit_strike;
- TT_Load_Strike_Metrics_Func load_strike_metrics;
-
- TT_Get_Metrics_Func get_metrics;
-
- TT_Get_Name_Func get_name;
-
- } SFNT_Interface;
-
-
- /* transitional */
- typedef SFNT_Interface* SFNT_Service;
-
-#ifndef FT_CONFIG_OPTION_PIC
-
-#define FT_DEFINE_SFNT_INTERFACE( \
- class_, \
- goto_table_, \
- init_face_, \
- load_face_, \
- done_face_, \
- get_interface_, \
- load_any_, \
- load_head_, \
- load_hhea_, \
- load_cmap_, \
- load_maxp_, \
- load_os2_, \
- load_post_, \
- load_name_, \
- free_name_, \
- load_kern_, \
- load_gasp_, \
- load_pclt_, \
- load_bhed_, \
- load_sbit_image_, \
- get_psname_, \
- free_psnames_, \
- get_kerning_, \
- load_font_dir_, \
- load_hmtx_, \
- load_eblc_, \
- free_eblc_, \
- set_sbit_strike_, \
- load_strike_metrics_, \
- get_metrics_, \
- get_name_ ) \
- static const SFNT_Interface class_ = \
- { \
- goto_table_, \
- init_face_, \
- load_face_, \
- done_face_, \
- get_interface_, \
- load_any_, \
- load_head_, \
- load_hhea_, \
- load_cmap_, \
- load_maxp_, \
- load_os2_, \
- load_post_, \
- load_name_, \
- free_name_, \
- load_kern_, \
- load_gasp_, \
- load_pclt_, \
- load_bhed_, \
- load_sbit_image_, \
- get_psname_, \
- free_psnames_, \
- get_kerning_, \
- load_font_dir_, \
- load_hmtx_, \
- load_eblc_, \
- free_eblc_, \
- set_sbit_strike_, \
- load_strike_metrics_, \
- get_metrics_, \
- get_name_, \
- };
-
-#else /* FT_CONFIG_OPTION_PIC */
-
-#define FT_INTERNAL( a, a_ ) \
- clazz->a = a_;
-
-#define FT_DEFINE_SFNT_INTERFACE( \
- class_, \
- goto_table_, \
- init_face_, \
- load_face_, \
- done_face_, \
- get_interface_, \
- load_any_, \
- load_head_, \
- load_hhea_, \
- load_cmap_, \
- load_maxp_, \
- load_os2_, \
- load_post_, \
- load_name_, \
- free_name_, \
- load_kern_, \
- load_gasp_, \
- load_pclt_, \
- load_bhed_, \
- load_sbit_image_, \
- get_psname_, \
- free_psnames_, \
- get_kerning_, \
- load_font_dir_, \
- load_hmtx_, \
- load_eblc_, \
- free_eblc_, \
- set_sbit_strike_, \
- load_strike_metrics_, \
- get_metrics_, \
- get_name_ ) \
- void \
- FT_Init_Class_ ## class_( FT_Library library, \
- SFNT_Interface* clazz ) \
- { \
- FT_UNUSED( library ); \
- \
- clazz->goto_table = goto_table_; \
- clazz->init_face = init_face_; \
- clazz->load_face = load_face_; \
- clazz->done_face = done_face_; \
- clazz->get_interface = get_interface_; \
- clazz->load_any = load_any_; \
- clazz->load_head = load_head_; \
- clazz->load_hhea = load_hhea_; \
- clazz->load_cmap = load_cmap_; \
- clazz->load_maxp = load_maxp_; \
- clazz->load_os2 = load_os2_; \
- clazz->load_post = load_post_; \
- clazz->load_name = load_name_; \
- clazz->free_name = free_name_; \
- clazz->load_kern = load_kern_; \
- clazz->load_gasp = load_gasp_; \
- clazz->load_pclt = load_pclt_; \
- clazz->load_bhed = load_bhed_; \
- clazz->load_sbit_image = load_sbit_image_; \
- clazz->get_psname = get_psname_; \
- clazz->free_psnames = free_psnames_; \
- clazz->get_kerning = get_kerning_; \
- clazz->load_font_dir = load_font_dir_; \
- clazz->load_hmtx = load_hmtx_; \
- clazz->load_eblc = load_eblc_; \
- clazz->free_eblc = free_eblc_; \
- clazz->set_sbit_strike = set_sbit_strike_; \
- clazz->load_strike_metrics = load_strike_metrics_; \
- clazz->get_metrics = get_metrics_; \
- clazz->get_name = get_name_; \
- }
-
-#endif /* FT_CONFIG_OPTION_PIC */
-
-FT_END_HEADER
-
-#endif /* __SFNT_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/t1types.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/t1types.h
deleted file mode 100644
index 029acc40093..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/t1types.h
+++ /dev/null
@@ -1,255 +0,0 @@
-/***************************************************************************/
-/* */
-/* t1types.h */
-/* */
-/* Basic Type1/Type2 type definitions and interface (specification */
-/* only). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __T1TYPES_H__
-#define __T1TYPES_H__
-
-
-#include <ft2build.h>
-#include FT_TYPE1_TABLES_H
-#include FT_INTERNAL_POSTSCRIPT_HINTS_H
-#include FT_INTERNAL_SERVICE_H
-#include FT_SERVICE_POSTSCRIPT_CMAPS_H
-
-
-FT_BEGIN_HEADER
-
-
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
- /*** ***/
- /*** ***/
- /*** REQUIRED TYPE1/TYPE2 TABLES DEFINITIONS ***/
- /*** ***/
- /*** ***/
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* T1_EncodingRec */
- /* */
- /* <Description> */
- /* A structure modeling a custom encoding. */
- /* */
- /* <Fields> */
- /* num_chars :: The number of character codes in the encoding. */
- /* Usually 256. */
- /* */
- /* code_first :: The lowest valid character code in the encoding. */
- /* */
- /* code_last :: The highest valid character code in the encoding */
- /* + 1. When equal to code_first there are no valid */
- /* character codes. */
- /* */
- /* char_index :: An array of corresponding glyph indices. */
- /* */
- /* char_name :: An array of corresponding glyph names. */
- /* */
- typedef struct T1_EncodingRecRec_
- {
- FT_Int num_chars;
- FT_Int code_first;
- FT_Int code_last;
-
- FT_UShort* char_index;
- FT_String** char_name;
-
- } T1_EncodingRec, *T1_Encoding;
-
-
- /* used to hold extra data of PS_FontInfoRec that
- * cannot be stored in the publicly defined structure.
- *
- * Note these can't be blended with multiple-masters.
- */
- typedef struct PS_FontExtraRec_
- {
- FT_UShort fs_type;
-
- } PS_FontExtraRec;
-
-
- typedef struct T1_FontRec_
- {
- PS_FontInfoRec font_info; /* font info dictionary */
- PS_FontExtraRec font_extra; /* font info extra fields */
- PS_PrivateRec private_dict; /* private dictionary */
- FT_String* font_name; /* top-level dictionary */
-
- T1_EncodingType encoding_type;
- T1_EncodingRec encoding;
-
- FT_Byte* subrs_block;
- FT_Byte* charstrings_block;
- FT_Byte* glyph_names_block;
-
- FT_Int num_subrs;
- FT_Byte** subrs;
- FT_UInt* subrs_len;
-
- FT_Int num_glyphs;
- FT_String** glyph_names; /* array of glyph names */
- FT_Byte** charstrings; /* array of glyph charstrings */
- FT_UInt* charstrings_len;
-
- FT_Byte paint_type;
- FT_Byte font_type;
- FT_Matrix font_matrix;
- FT_Vector font_offset;
- FT_BBox font_bbox;
- FT_Long font_id;
-
- FT_Fixed stroke_width;
-
- } T1_FontRec, *T1_Font;
-
-
- typedef struct CID_SubrsRec_
- {
- FT_Int num_subrs;
- FT_Byte** code;
-
- } CID_SubrsRec, *CID_Subrs;
-
-
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
- /*** ***/
- /*** ***/
- /*** AFM FONT INFORMATION STRUCTURES ***/
- /*** ***/
- /*** ***/
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
-
- typedef struct AFM_TrackKernRec_
- {
- FT_Int degree;
- FT_Fixed min_ptsize;
- FT_Fixed min_kern;
- FT_Fixed max_ptsize;
- FT_Fixed max_kern;
-
- } AFM_TrackKernRec, *AFM_TrackKern;
-
- typedef struct AFM_KernPairRec_
- {
- FT_UInt index1;
- FT_UInt index2;
- FT_Int x;
- FT_Int y;
-
- } AFM_KernPairRec, *AFM_KernPair;
-
- typedef struct AFM_FontInfoRec_
- {
- FT_Bool IsCIDFont;
- FT_BBox FontBBox;
- FT_Fixed Ascender;
- FT_Fixed Descender;
- AFM_TrackKern TrackKerns; /* free if non-NULL */
- FT_UInt NumTrackKern;
- AFM_KernPair KernPairs; /* free if non-NULL */
- FT_UInt NumKernPair;
-
- } AFM_FontInfoRec, *AFM_FontInfo;
-
-
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
- /*** ***/
- /*** ***/
- /*** ORIGINAL T1_FACE CLASS DEFINITION ***/
- /*** ***/
- /*** ***/
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
-
-
- typedef struct T1_FaceRec_* T1_Face;
- typedef struct CID_FaceRec_* CID_Face;
-
-
- typedef struct T1_FaceRec_
- {
- FT_FaceRec root;
- T1_FontRec type1;
- const void* psnames;
- const void* psaux;
- const void* afm_data;
- FT_CharMapRec charmaprecs[2];
- FT_CharMap charmaps[2];
-
- /* support for Multiple Masters fonts */
- PS_Blend blend;
-
- /* undocumented, optional: indices of subroutines that express */
- /* the NormalizeDesignVector and the ConvertDesignVector procedure, */
- /* respectively, as Type 2 charstrings; -1 if keywords not present */
- FT_Int ndv_idx;
- FT_Int cdv_idx;
-
- /* undocumented, optional: has the same meaning as len_buildchar */
- /* for Type 2 fonts; manipulated by othersubrs 19, 24, and 25 */
- FT_UInt len_buildchar;
- FT_Long* buildchar;
-
- /* since version 2.1 - interface to PostScript hinter */
- const void* pshinter;
-
- } T1_FaceRec;
-
-
- typedef struct CID_FaceRec_
- {
- FT_FaceRec root;
- void* psnames;
- void* psaux;
- CID_FaceInfoRec cid;
- PS_FontExtraRec font_extra;
-#if 0
- void* afm_data;
-#endif
- CID_Subrs subrs;
-
- /* since version 2.1 - interface to PostScript hinter */
- void* pshinter;
-
- /* since version 2.1.8, but was originally positioned after `afm_data' */
- FT_Byte* binary_data; /* used if hex data has been converted */
- FT_Stream cid_stream;
-
- } CID_FaceRec;
-
-
-FT_END_HEADER
-
-#endif /* __T1TYPES_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/tttypes.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/tttypes.h
deleted file mode 100644
index 1507a7c57a0..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/internal/tttypes.h
+++ /dev/null
@@ -1,1526 +0,0 @@
-/***************************************************************************/
-/* */
-/* tttypes.h */
-/* */
-/* Basic SFNT/TrueType type definitions and interface (specification */
-/* only). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __TTTYPES_H__
-#define __TTTYPES_H__
-
-
-#include <ft2build.h>
-#include FT_TRUETYPE_TABLES_H
-#include FT_INTERNAL_OBJECTS_H
-
-#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
-#include FT_MULTIPLE_MASTERS_H
-#endif
-
-
-FT_BEGIN_HEADER
-
-
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
- /*** ***/
- /*** ***/
- /*** REQUIRED TRUETYPE/OPENTYPE TABLES DEFINITIONS ***/
- /*** ***/
- /*** ***/
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* TTC_HeaderRec */
- /* */
- /* <Description> */
- /* TrueType collection header. This table contains the offsets of */
- /* the font headers of each distinct TrueType face in the file. */
- /* */
- /* <Fields> */
- /* tag :: Must be `ttc ' to indicate a TrueType collection. */
- /* */
- /* version :: The version number. */
- /* */
- /* count :: The number of faces in the collection. The */
- /* specification says this should be an unsigned long, but */
- /* we use a signed long since we need the value -1 for */
- /* specific purposes. */
- /* */
- /* offsets :: The offsets of the font headers, one per face. */
- /* */
- typedef struct TTC_HeaderRec_
- {
- FT_ULong tag;
- FT_Fixed version;
- FT_Long count;
- FT_ULong* offsets;
-
- } TTC_HeaderRec;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* SFNT_HeaderRec */
- /* */
- /* <Description> */
- /* SFNT file format header. */
- /* */
- /* <Fields> */
- /* format_tag :: The font format tag. */
- /* */
- /* num_tables :: The number of tables in file. */
- /* */
- /* search_range :: Must be `16 * (max power of 2 <= num_tables)'. */
- /* */
- /* entry_selector :: Must be log2 of `search_range / 16'. */
- /* */
- /* range_shift :: Must be `num_tables * 16 - search_range'. */
- /* */
- typedef struct SFNT_HeaderRec_
- {
- FT_ULong format_tag;
- FT_UShort num_tables;
- FT_UShort search_range;
- FT_UShort entry_selector;
- FT_UShort range_shift;
-
- FT_ULong offset; /* not in file */
-
- } SFNT_HeaderRec, *SFNT_Header;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* TT_TableRec */
- /* */
- /* <Description> */
- /* This structure describes a given table of a TrueType font. */
- /* */
- /* <Fields> */
- /* Tag :: A four-bytes tag describing the table. */
- /* */
- /* CheckSum :: The table checksum. This value can be ignored. */
- /* */
- /* Offset :: The offset of the table from the start of the TrueType */
- /* font in its resource. */
- /* */
- /* Length :: The table length (in bytes). */
- /* */
- typedef struct TT_TableRec_
- {
- FT_ULong Tag; /* table type */
- FT_ULong CheckSum; /* table checksum */
- FT_ULong Offset; /* table file offset */
- FT_ULong Length; /* table length */
-
- } TT_TableRec, *TT_Table;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* WOFF_HeaderRec */
- /* */
- /* <Description> */
- /* WOFF file format header. */
- /* */
- /* <Fields> */
- /* See */
- /* */
- /* http://www.w3.org/TR/WOFF/#WOFFHeader */
- /* */
- typedef struct WOFF_HeaderRec_
- {
- FT_ULong signature;
- FT_ULong flavor;
- FT_ULong length;
- FT_UShort num_tables;
- FT_UShort reserved;
- FT_ULong totalSfntSize;
- FT_UShort majorVersion;
- FT_UShort minorVersion;
- FT_ULong metaOffset;
- FT_ULong metaLength;
- FT_ULong metaOrigLength;
- FT_ULong privOffset;
- FT_ULong privLength;
-
- } WOFF_HeaderRec, *WOFF_Header;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* WOFF_TableRec */
- /* */
- /* <Description> */
- /* This structure describes a given table of a WOFF font. */
- /* */
- /* <Fields> */
- /* Tag :: A four-bytes tag describing the table. */
- /* */
- /* Offset :: The offset of the table from the start of the WOFF */
- /* font in its resource. */
- /* */
- /* CompLength :: Compressed table length (in bytes). */
- /* */
- /* OrigLength :: Unompressed table length (in bytes). */
- /* */
- /* CheckSum :: The table checksum. This value can be ignored. */
- /* */
- /* OrigOffset :: The uncompressed table file offset. This value gets */
- /* computed while constructing the (uncompressed) SFNT */
- /* header. It is not contained in the WOFF file. */
- /* */
- typedef struct WOFF_TableRec_
- {
- FT_ULong Tag; /* table ID */
- FT_ULong Offset; /* table file offset */
- FT_ULong CompLength; /* compressed table length */
- FT_ULong OrigLength; /* uncompressed table length */
- FT_ULong CheckSum; /* uncompressed checksum */
-
- FT_ULong OrigOffset; /* uncompressed table file offset */
- /* (not in the WOFF file) */
- } WOFF_TableRec, *WOFF_Table;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* TT_LongMetricsRec */
- /* */
- /* <Description> */
- /* A structure modeling the long metrics of the `hmtx' and `vmtx' */
- /* TrueType tables. The values are expressed in font units. */
- /* */
- /* <Fields> */
- /* advance :: The advance width or height for the glyph. */
- /* */
- /* bearing :: The left-side or top-side bearing for the glyph. */
- /* */
- typedef struct TT_LongMetricsRec_
- {
- FT_UShort advance;
- FT_Short bearing;
-
- } TT_LongMetricsRec, *TT_LongMetrics;
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* TT_ShortMetrics */
- /* */
- /* <Description> */
- /* A simple type to model the short metrics of the `hmtx' and `vmtx' */
- /* tables. */
- /* */
- typedef FT_Short TT_ShortMetrics;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* TT_NameEntryRec */
- /* */
- /* <Description> */
- /* A structure modeling TrueType name records. Name records are used */
- /* to store important strings like family name, style name, */
- /* copyright, etc. in _localized_ versions (i.e., language, encoding, */
- /* etc). */
- /* */
- /* <Fields> */
- /* platformID :: The ID of the name's encoding platform. */
- /* */
- /* encodingID :: The platform-specific ID for the name's encoding. */
- /* */
- /* languageID :: The platform-specific ID for the name's language. */
- /* */
- /* nameID :: The ID specifying what kind of name this is. */
- /* */
- /* stringLength :: The length of the string in bytes. */
- /* */
- /* stringOffset :: The offset to the string in the `name' table. */
- /* */
- /* string :: A pointer to the string's bytes. Note that these */
- /* are usually UTF-16 encoded characters. */
- /* */
- typedef struct TT_NameEntryRec_
- {
- FT_UShort platformID;
- FT_UShort encodingID;
- FT_UShort languageID;
- FT_UShort nameID;
- FT_UShort stringLength;
- FT_ULong stringOffset;
-
- /* this last field is not defined in the spec */
- /* but used by the FreeType engine */
-
- FT_Byte* string;
-
- } TT_NameEntryRec, *TT_NameEntry;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* TT_NameTableRec */
- /* */
- /* <Description> */
- /* A structure modeling the TrueType name table. */
- /* */
- /* <Fields> */
- /* format :: The format of the name table. */
- /* */
- /* numNameRecords :: The number of names in table. */
- /* */
- /* storageOffset :: The offset of the name table in the `name' */
- /* TrueType table. */
- /* */
- /* names :: An array of name records. */
- /* */
- /* stream :: the file's input stream. */
- /* */
- typedef struct TT_NameTableRec_
- {
- FT_UShort format;
- FT_UInt numNameRecords;
- FT_UInt storageOffset;
- TT_NameEntryRec* names;
- FT_Stream stream;
-
- } TT_NameTableRec, *TT_NameTable;
-
-
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
- /*** ***/
- /*** ***/
- /*** OPTIONAL TRUETYPE/OPENTYPE TABLES DEFINITIONS ***/
- /*** ***/
- /*** ***/
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* TT_GaspRangeRec */
- /* */
- /* <Description> */
- /* A tiny structure used to model a gasp range according to the */
- /* TrueType specification. */
- /* */
- /* <Fields> */
- /* maxPPEM :: The maximum ppem value to which `gaspFlag' applies. */
- /* */
- /* gaspFlag :: A flag describing the grid-fitting and anti-aliasing */
- /* modes to be used. */
- /* */
- typedef struct TT_GaspRangeRec_
- {
- FT_UShort maxPPEM;
- FT_UShort gaspFlag;
-
- } TT_GaspRangeRec, *TT_GaspRange;
-
-
-#define TT_GASP_GRIDFIT 0x01
-#define TT_GASP_DOGRAY 0x02
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* TT_GaspRec */
- /* */
- /* <Description> */
- /* A structure modeling the TrueType `gasp' table used to specify */
- /* grid-fitting and anti-aliasing behaviour. */
- /* */
- /* <Fields> */
- /* version :: The version number. */
- /* */
- /* numRanges :: The number of gasp ranges in table. */
- /* */
- /* gaspRanges :: An array of gasp ranges. */
- /* */
- typedef struct TT_Gasp_
- {
- FT_UShort version;
- FT_UShort numRanges;
- TT_GaspRange gaspRanges;
-
- } TT_GaspRec;
-
-
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
- /*** ***/
- /*** ***/
- /*** EMBEDDED BITMAPS SUPPORT ***/
- /*** ***/
- /*** ***/
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* TT_SBit_MetricsRec */
- /* */
- /* <Description> */
- /* A structure used to hold the big metrics of a given glyph bitmap */
- /* in a TrueType or OpenType font. These are usually found in the */
- /* `EBDT' (Microsoft) or `bloc' (Apple) table. */
- /* */
- /* <Fields> */
- /* height :: The glyph height in pixels. */
- /* */
- /* width :: The glyph width in pixels. */
- /* */
- /* horiBearingX :: The horizontal left bearing. */
- /* */
- /* horiBearingY :: The horizontal top bearing. */
- /* */
- /* horiAdvance :: The horizontal advance. */
- /* */
- /* vertBearingX :: The vertical left bearing. */
- /* */
- /* vertBearingY :: The vertical top bearing. */
- /* */
- /* vertAdvance :: The vertical advance. */
- /* */
- typedef struct TT_SBit_MetricsRec_
- {
- FT_UShort height;
- FT_UShort width;
-
- FT_Short horiBearingX;
- FT_Short horiBearingY;
- FT_UShort horiAdvance;
-
- FT_Short vertBearingX;
- FT_Short vertBearingY;
- FT_UShort vertAdvance;
-
- } TT_SBit_MetricsRec, *TT_SBit_Metrics;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* TT_SBit_SmallMetricsRec */
- /* */
- /* <Description> */
- /* A structure used to hold the small metrics of a given glyph bitmap */
- /* in a TrueType or OpenType font. These are usually found in the */
- /* `EBDT' (Microsoft) or the `bdat' (Apple) table. */
- /* */
- /* <Fields> */
- /* height :: The glyph height in pixels. */
- /* */
- /* width :: The glyph width in pixels. */
- /* */
- /* bearingX :: The left-side bearing. */
- /* */
- /* bearingY :: The top-side bearing. */
- /* */
- /* advance :: The advance width or height. */
- /* */
- typedef struct TT_SBit_Small_Metrics_
- {
- FT_Byte height;
- FT_Byte width;
-
- FT_Char bearingX;
- FT_Char bearingY;
- FT_Byte advance;
-
- } TT_SBit_SmallMetricsRec, *TT_SBit_SmallMetrics;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* TT_SBit_LineMetricsRec */
- /* */
- /* <Description> */
- /* A structure used to describe the text line metrics of a given */
- /* bitmap strike, for either a horizontal or vertical layout. */
- /* */
- /* <Fields> */
- /* ascender :: The ascender in pixels. */
- /* */
- /* descender :: The descender in pixels. */
- /* */
- /* max_width :: The maximum glyph width in pixels. */
- /* */
- /* caret_slope_enumerator :: Rise of the caret slope, typically set */
- /* to 1 for non-italic fonts. */
- /* */
- /* caret_slope_denominator :: Rise of the caret slope, typically set */
- /* to 0 for non-italic fonts. */
- /* */
- /* caret_offset :: Offset in pixels to move the caret for */
- /* proper positioning. */
- /* */
- /* min_origin_SB :: Minimum of horiBearingX (resp. */
- /* vertBearingY). */
- /* min_advance_SB :: Minimum of */
- /* */
- /* horizontal advance - */
- /* ( horiBearingX + width ) */
- /* */
- /* resp. */
- /* */
- /* vertical advance - */
- /* ( vertBearingY + height ) */
- /* */
- /* max_before_BL :: Maximum of horiBearingY (resp. */
- /* vertBearingY). */
- /* */
- /* min_after_BL :: Minimum of */
- /* */
- /* horiBearingY - height */
- /* */
- /* resp. */
- /* */
- /* vertBearingX - width */
- /* */
- /* pads :: Unused (to make the size of the record */
- /* a multiple of 32 bits. */
- /* */
- typedef struct TT_SBit_LineMetricsRec_
- {
- FT_Char ascender;
- FT_Char descender;
- FT_Byte max_width;
- FT_Char caret_slope_numerator;
- FT_Char caret_slope_denominator;
- FT_Char caret_offset;
- FT_Char min_origin_SB;
- FT_Char min_advance_SB;
- FT_Char max_before_BL;
- FT_Char min_after_BL;
- FT_Char pads[2];
-
- } TT_SBit_LineMetricsRec, *TT_SBit_LineMetrics;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* TT_SBit_RangeRec */
- /* */
- /* <Description> */
- /* A TrueType/OpenType subIndexTable as defined in the `EBLC' */
- /* (Microsoft) or `bloc' (Apple) tables. */
- /* */
- /* <Fields> */
- /* first_glyph :: The first glyph index in the range. */
- /* */
- /* last_glyph :: The last glyph index in the range. */
- /* */
- /* index_format :: The format of index table. Valid values are 1 */
- /* to 5. */
- /* */
- /* image_format :: The format of `EBDT' image data. */
- /* */
- /* image_offset :: The offset to image data in `EBDT'. */
- /* */
- /* image_size :: For index formats 2 and 5. This is the size in */
- /* bytes of each glyph bitmap. */
- /* */
- /* big_metrics :: For index formats 2 and 5. This is the big */
- /* metrics for each glyph bitmap. */
- /* */
- /* num_glyphs :: For index formats 4 and 5. This is the number of */
- /* glyphs in the code array. */
- /* */
- /* glyph_offsets :: For index formats 1 and 3. */
- /* */
- /* glyph_codes :: For index formats 4 and 5. */
- /* */
- /* table_offset :: The offset of the index table in the `EBLC' */
- /* table. Only used during strike loading. */
- /* */
- typedef struct TT_SBit_RangeRec_
- {
- FT_UShort first_glyph;
- FT_UShort last_glyph;
-
- FT_UShort index_format;
- FT_UShort image_format;
- FT_ULong image_offset;
-
- FT_ULong image_size;
- TT_SBit_MetricsRec metrics;
- FT_ULong num_glyphs;
-
- FT_ULong* glyph_offsets;
- FT_UShort* glyph_codes;
-
- FT_ULong table_offset;
-
- } TT_SBit_RangeRec, *TT_SBit_Range;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* TT_SBit_StrikeRec */
- /* */
- /* <Description> */
- /* A structure used describe a given bitmap strike in the `EBLC' */
- /* (Microsoft) or `bloc' (Apple) tables. */
- /* */
- /* <Fields> */
- /* num_index_ranges :: The number of index ranges. */
- /* */
- /* index_ranges :: An array of glyph index ranges. */
- /* */
- /* color_ref :: Unused. `color_ref' is put in for future */
- /* enhancements, but these fields are already */
- /* in use by other platforms (e.g. Newton). */
- /* For details, please see */
- /* */
- /* https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6bloc.html */
- /* */
- /* hori :: The line metrics for horizontal layouts. */
- /* */
- /* vert :: The line metrics for vertical layouts. */
- /* */
- /* start_glyph :: The lowest glyph index for this strike. */
- /* */
- /* end_glyph :: The highest glyph index for this strike. */
- /* */
- /* x_ppem :: The number of horizontal pixels per EM. */
- /* */
- /* y_ppem :: The number of vertical pixels per EM. */
- /* */
- /* bit_depth :: The bit depth. Valid values are 1, 2, 4, */
- /* and 8. */
- /* */
- /* flags :: Is this a vertical or horizontal strike? For */
- /* details, please see */
- /* */
- /* https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6bloc.html */
- /* */
- typedef struct TT_SBit_StrikeRec_
- {
- FT_Int num_ranges;
- TT_SBit_Range sbit_ranges;
- FT_ULong ranges_offset;
-
- FT_ULong color_ref;
-
- TT_SBit_LineMetricsRec hori;
- TT_SBit_LineMetricsRec vert;
-
- FT_UShort start_glyph;
- FT_UShort end_glyph;
-
- FT_Byte x_ppem;
- FT_Byte y_ppem;
-
- FT_Byte bit_depth;
- FT_Char flags;
-
- } TT_SBit_StrikeRec, *TT_SBit_Strike;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* TT_SBit_ComponentRec */
- /* */
- /* <Description> */
- /* A simple structure to describe a compound sbit element. */
- /* */
- /* <Fields> */
- /* glyph_code :: The element's glyph index. */
- /* */
- /* x_offset :: The element's left bearing. */
- /* */
- /* y_offset :: The element's top bearing. */
- /* */
- typedef struct TT_SBit_ComponentRec_
- {
- FT_UShort glyph_code;
- FT_Char x_offset;
- FT_Char y_offset;
-
- } TT_SBit_ComponentRec, *TT_SBit_Component;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* TT_SBit_ScaleRec */
- /* */
- /* <Description> */
- /* A structure used describe a given bitmap scaling table, as defined */
- /* in the `EBSC' table. */
- /* */
- /* <Fields> */
- /* hori :: The horizontal line metrics. */
- /* */
- /* vert :: The vertical line metrics. */
- /* */
- /* x_ppem :: The number of horizontal pixels per EM. */
- /* */
- /* y_ppem :: The number of vertical pixels per EM. */
- /* */
- /* x_ppem_substitute :: Substitution x_ppem value. */
- /* */
- /* y_ppem_substitute :: Substitution y_ppem value. */
- /* */
- typedef struct TT_SBit_ScaleRec_
- {
- TT_SBit_LineMetricsRec hori;
- TT_SBit_LineMetricsRec vert;
-
- FT_Byte x_ppem;
- FT_Byte y_ppem;
-
- FT_Byte x_ppem_substitute;
- FT_Byte y_ppem_substitute;
-
- } TT_SBit_ScaleRec, *TT_SBit_Scale;
-
-
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
- /*** ***/
- /*** ***/
- /*** POSTSCRIPT GLYPH NAMES SUPPORT ***/
- /*** ***/
- /*** ***/
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* TT_Post_20Rec */
- /* */
- /* <Description> */
- /* Postscript names sub-table, format 2.0. Stores the PS name of */
- /* each glyph in the font face. */
- /* */
- /* <Fields> */
- /* num_glyphs :: The number of named glyphs in the table. */
- /* */
- /* num_names :: The number of PS names stored in the table. */
- /* */
- /* glyph_indices :: The indices of the glyphs in the names arrays. */
- /* */
- /* glyph_names :: The PS names not in Mac Encoding. */
- /* */
- typedef struct TT_Post_20Rec_
- {
- FT_UShort num_glyphs;
- FT_UShort num_names;
- FT_UShort* glyph_indices;
- FT_Char** glyph_names;
-
- } TT_Post_20Rec, *TT_Post_20;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* TT_Post_25Rec */
- /* */
- /* <Description> */
- /* Postscript names sub-table, format 2.5. Stores the PS name of */
- /* each glyph in the font face. */
- /* */
- /* <Fields> */
- /* num_glyphs :: The number of glyphs in the table. */
- /* */
- /* offsets :: An array of signed offsets in a normal Mac */
- /* Postscript name encoding. */
- /* */
- typedef struct TT_Post_25_
- {
- FT_UShort num_glyphs;
- FT_Char* offsets;
-
- } TT_Post_25Rec, *TT_Post_25;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* TT_Post_NamesRec */
- /* */
- /* <Description> */
- /* Postscript names table, either format 2.0 or 2.5. */
- /* */
- /* <Fields> */
- /* loaded :: A flag to indicate whether the PS names are loaded. */
- /* */
- /* format_20 :: The sub-table used for format 2.0. */
- /* */
- /* format_25 :: The sub-table used for format 2.5. */
- /* */
- typedef struct TT_Post_NamesRec_
- {
- FT_Bool loaded;
-
- union
- {
- TT_Post_20Rec format_20;
- TT_Post_25Rec format_25;
-
- } names;
-
- } TT_Post_NamesRec, *TT_Post_Names;
-
-
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
- /*** ***/
- /*** ***/
- /*** GX VARIATION TABLE SUPPORT ***/
- /*** ***/
- /*** ***/
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
-
-
-#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
- typedef struct GX_BlendRec_ *GX_Blend;
-#endif
-
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
- /*** ***/
- /*** ***/
- /*** EMBEDDED BDF PROPERTIES TABLE SUPPORT ***/
- /*** ***/
- /*** ***/
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
-
- /*
- * These types are used to support a `BDF ' table that isn't part of the
- * official TrueType specification. It is mainly used in SFNT-based
- * bitmap fonts that were generated from a set of BDF fonts.
- *
- * The format of the table is as follows.
- *
- * USHORT version `BDF ' table version number, should be 0x0001.
- * USHORT strikeCount Number of strikes (bitmap sizes) in this table.
- * ULONG stringTable Offset (from start of BDF table) to string
- * table.
- *
- * This is followed by an array of `strikeCount' descriptors, having the
- * following format.
- *
- * USHORT ppem Vertical pixels per EM for this strike.
- * USHORT numItems Number of items for this strike (properties and
- * atoms). Maximum is 255.
- *
- * This array in turn is followed by `strikeCount' value sets. Each
- * `value set' is an array of `numItems' items with the following format.
- *
- * ULONG item_name Offset in string table to item name.
- * USHORT item_type The item type. Possible values are
- * 0 => string (e.g., COMMENT)
- * 1 => atom (e.g., FONT or even SIZE)
- * 2 => int32
- * 3 => uint32
- * 0x10 => A flag to indicate a properties. This
- * is ORed with the above values.
- * ULONG item_value For strings => Offset into string table without
- * the corresponding double quotes.
- * For atoms => Offset into string table.
- * For integers => Direct value.
- *
- * All strings in the string table consist of bytes and are
- * zero-terminated.
- *
- */
-
-#ifdef TT_CONFIG_OPTION_BDF
-
- typedef struct TT_BDFRec_
- {
- FT_Byte* table;
- FT_Byte* table_end;
- FT_Byte* strings;
- FT_ULong strings_size;
- FT_UInt num_strikes;
- FT_Bool loaded;
-
- } TT_BDFRec, *TT_BDF;
-
-#endif /* TT_CONFIG_OPTION_BDF */
-
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
- /*** ***/
- /*** ***/
- /*** ORIGINAL TT_FACE CLASS DEFINITION ***/
- /*** ***/
- /*** ***/
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* This structure/class is defined here because it is common to the */
- /* following formats: TTF, OpenType-TT, and OpenType-CFF. */
- /* */
- /* Note, however, that the classes TT_Size and TT_GlyphSlot are not */
- /* shared between font drivers, and are thus defined in `ttobjs.h'. */
- /* */
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* TT_Face */
- /* */
- /* <Description> */
- /* A handle to a TrueType face/font object. A TT_Face encapsulates */
- /* the resolution and scaling independent parts of a TrueType font */
- /* resource. */
- /* */
- /* <Note> */
- /* The TT_Face structure is also used as a `parent class' for the */
- /* OpenType-CFF class (T2_Face). */
- /* */
- typedef struct TT_FaceRec_* TT_Face;
-
-
- /* a function type used for the truetype bytecode interpreter hooks */
- typedef FT_Error
- (*TT_Interpreter)( void* exec_context );
-
- /* forward declaration */
- typedef struct TT_LoaderRec_* TT_Loader;
-
-
- /*************************************************************************/
- /* */
- /* <FuncType> */
- /* TT_Loader_GotoTableFunc */
- /* */
- /* <Description> */
- /* Seeks a stream to the start of a given TrueType table. */
- /* */
- /* <Input> */
- /* face :: A handle to the target face object. */
- /* */
- /* tag :: A 4-byte tag used to name the table. */
- /* */
- /* stream :: The input stream. */
- /* */
- /* <Output> */
- /* length :: The length of the table in bytes. Set to 0 if not */
- /* needed. */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. */
- /* */
- /* <Note> */
- /* The stream cursor must be at the font file's origin. */
- /* */
- typedef FT_Error
- (*TT_Loader_GotoTableFunc)( TT_Face face,
- FT_ULong tag,
- FT_Stream stream,
- FT_ULong* length );
-
-
- /*************************************************************************/
- /* */
- /* <FuncType> */
- /* TT_Loader_StartGlyphFunc */
- /* */
- /* <Description> */
- /* Seeks a stream to the start of a given glyph element, and opens a */
- /* frame for it. */
- /* */
- /* <Input> */
- /* loader :: The current TrueType glyph loader object. */
- /* */
- /* glyph index :: The index of the glyph to access. */
- /* */
- /* offset :: The offset of the glyph according to the */
- /* `locations' table. */
- /* */
- /* byte_count :: The size of the frame in bytes. */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. */
- /* */
- /* <Note> */
- /* This function is normally equivalent to FT_STREAM_SEEK(offset) */
- /* followed by FT_FRAME_ENTER(byte_count) with the loader's stream, */
- /* but alternative formats (e.g. compressed ones) might use something */
- /* different. */
- /* */
- typedef FT_Error
- (*TT_Loader_StartGlyphFunc)( TT_Loader loader,
- FT_UInt glyph_index,
- FT_ULong offset,
- FT_UInt byte_count );
-
-
- /*************************************************************************/
- /* */
- /* <FuncType> */
- /* TT_Loader_ReadGlyphFunc */
- /* */
- /* <Description> */
- /* Reads one glyph element (its header, a simple glyph, or a */
- /* composite) from the loader's current stream frame. */
- /* */
- /* <Input> */
- /* loader :: The current TrueType glyph loader object. */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. */
- /* */
- typedef FT_Error
- (*TT_Loader_ReadGlyphFunc)( TT_Loader loader );
-
-
- /*************************************************************************/
- /* */
- /* <FuncType> */
- /* TT_Loader_EndGlyphFunc */
- /* */
- /* <Description> */
- /* Closes the current loader stream frame for the glyph. */
- /* */
- /* <Input> */
- /* loader :: The current TrueType glyph loader object. */
- /* */
- typedef void
- (*TT_Loader_EndGlyphFunc)( TT_Loader loader );
-
-
- typedef enum TT_SbitTableType_
- {
- TT_SBIT_TABLE_TYPE_NONE = 0,
- TT_SBIT_TABLE_TYPE_EBLC, /* `EBLC' (Microsoft), */
- /* `bloc' (Apple) */
- TT_SBIT_TABLE_TYPE_CBLC, /* `CBLC' (Google) */
- TT_SBIT_TABLE_TYPE_SBIX, /* `sbix' (Apple) */
-
- /* do not remove */
- TT_SBIT_TABLE_TYPE_MAX
-
- } TT_SbitTableType;
-
-
- /*************************************************************************/
- /* */
- /* TrueType Face Type */
- /* */
- /* <Struct> */
- /* TT_Face */
- /* */
- /* <Description> */
- /* The TrueType face class. These objects model the resolution and */
- /* point-size independent data found in a TrueType font file. */
- /* */
- /* <Fields> */
- /* root :: The base FT_Face structure, managed by the */
- /* base layer. */
- /* */
- /* ttc_header :: The TrueType collection header, used when */
- /* the file is a `ttc' rather than a `ttf'. */
- /* For ordinary font files, the field */
- /* `ttc_header.count' is set to 0. */
- /* */
- /* format_tag :: The font format tag. */
- /* */
- /* num_tables :: The number of TrueType tables in this font */
- /* file. */
- /* */
- /* dir_tables :: The directory of TrueType tables for this */
- /* font file. */
- /* */
- /* header :: The font's font header (`head' table). */
- /* Read on font opening. */
- /* */
- /* horizontal :: The font's horizontal header (`hhea' */
- /* table). This field also contains the */
- /* associated horizontal metrics table */
- /* (`hmtx'). */
- /* */
- /* max_profile :: The font's maximum profile table. Read on */
- /* font opening. Note that some maximum */
- /* values cannot be taken directly from this */
- /* table. We thus define additional fields */
- /* below to hold the computed maxima. */
- /* */
- /* vertical_info :: A boolean which is set when the font file */
- /* contains vertical metrics. If not, the */
- /* value of the `vertical' field is */
- /* undefined. */
- /* */
- /* vertical :: The font's vertical header (`vhea' table). */
- /* This field also contains the associated */
- /* vertical metrics table (`vmtx'), if found. */
- /* IMPORTANT: The contents of this field is */
- /* undefined if the `vertical_info' field is */
- /* unset. */
- /* */
- /* num_names :: The number of name records within this */
- /* TrueType font. */
- /* */
- /* name_table :: The table of name records (`name'). */
- /* */
- /* os2 :: The font's OS/2 table (`OS/2'). */
- /* */
- /* postscript :: The font's PostScript table (`post' */
- /* table). The PostScript glyph names are */
- /* not loaded by the driver on face opening. */
- /* See the `ttpost' module for more details. */
- /* */
- /* cmap_table :: Address of the face's `cmap' SFNT table */
- /* in memory (it's an extracted frame). */
- /* */
- /* cmap_size :: The size in bytes of the `cmap_table' */
- /* described above. */
- /* */
- /* goto_table :: A function called by each TrueType table */
- /* loader to position a stream's cursor to */
- /* the start of a given table according to */
- /* its tag. It defaults to TT_Goto_Face but */
- /* can be different for strange formats (e.g. */
- /* Type 42). */
- /* */
- /* access_glyph_frame :: A function used to access the frame of a */
- /* given glyph within the face's font file. */
- /* */
- /* forget_glyph_frame :: A function used to forget the frame of a */
- /* given glyph when all data has been loaded. */
- /* */
- /* read_glyph_header :: A function used to read a glyph header. */
- /* It must be called between an `access' and */
- /* `forget'. */
- /* */
- /* read_simple_glyph :: A function used to read a simple glyph. */
- /* It must be called after the header was */
- /* read, and before the `forget'. */
- /* */
- /* read_composite_glyph :: A function used to read a composite glyph. */
- /* It must be called after the header was */
- /* read, and before the `forget'. */
- /* */
- /* sfnt :: A pointer to the SFNT service. */
- /* */
- /* psnames :: A pointer to the PostScript names service. */
- /* */
- /* hdmx :: The face's horizontal device metrics */
- /* (`hdmx' table). This table is optional in */
- /* TrueType/OpenType fonts. */
- /* */
- /* gasp :: The grid-fitting and scaling properties */
- /* table (`gasp'). This table is optional in */
- /* TrueType/OpenType fonts. */
- /* */
- /* pclt :: The `pclt' SFNT table. */
- /* */
- /* num_sbit_scales :: The number of sbit scales for this font. */
- /* */
- /* sbit_scales :: Array of sbit scales embedded in this */
- /* font. This table is optional in a */
- /* TrueType/OpenType font. */
- /* */
- /* postscript_names :: A table used to store the Postscript names */
- /* of the glyphs for this font. See the */
- /* file `ttconfig.h' for comments on the */
- /* TT_CONFIG_OPTION_POSTSCRIPT_NAMES option. */
- /* */
- /* num_locations :: The number of glyph locations in this */
- /* TrueType file. This should be */
- /* identical to the number of glyphs. */
- /* Ignored for Type 2 fonts. */
- /* */
- /* glyph_locations :: An array of longs. These are offsets to */
- /* glyph data within the `glyf' table. */
- /* Ignored for Type 2 font faces. */
- /* */
- /* glyf_len :: The length of the `glyf' table. Needed */
- /* for malformed `loca' tables. */
- /* */
- /* font_program_size :: Size in bytecodes of the face's font */
- /* program. 0 if none defined. Ignored for */
- /* Type 2 fonts. */
- /* */
- /* font_program :: The face's font program (bytecode stream) */
- /* executed at load time, also used during */
- /* glyph rendering. Comes from the `fpgm' */
- /* table. Ignored for Type 2 font fonts. */
- /* */
- /* cvt_program_size :: The size in bytecodes of the face's cvt */
- /* program. Ignored for Type 2 fonts. */
- /* */
- /* cvt_program :: The face's cvt program (bytecode stream) */
- /* executed each time an instance/size is */
- /* changed/reset. Comes from the `prep' */
- /* table. Ignored for Type 2 fonts. */
- /* */
- /* cvt_size :: Size of the control value table (in */
- /* entries). Ignored for Type 2 fonts. */
- /* */
- /* cvt :: The face's original control value table. */
- /* Coordinates are expressed in unscaled font */
- /* units. Comes from the `cvt ' table. */
- /* Ignored for Type 2 fonts. */
- /* */
- /* num_kern_pairs :: The number of kerning pairs present in the */
- /* font file. The engine only loads the */
- /* first horizontal format 0 kern table it */
- /* finds in the font file. Ignored for */
- /* Type 2 fonts. */
- /* */
- /* kern_table_index :: The index of the kerning table in the font */
- /* kerning directory. Ignored for Type 2 */
- /* fonts. */
- /* */
- /* interpreter :: A pointer to the TrueType bytecode */
- /* interpreters field is also used to hook */
- /* the debugger in `ttdebug'. */
- /* */
- /* unpatented_hinting :: If true, use only unpatented methods in */
- /* the bytecode interpreter. */
- /* */
- /* doblend :: A boolean which is set if the font should */
- /* be blended (this is for GX var). */
- /* */
- /* blend :: Contains the data needed to control GX */
- /* variation tables (rather like Multiple */
- /* Master data). */
- /* */
- /* extra :: Reserved for third-party font drivers. */
- /* */
- /* postscript_name :: The PS name of the font. Used by the */
- /* postscript name service. */
- /* */
- typedef struct TT_FaceRec_
- {
- FT_FaceRec root;
-
- TTC_HeaderRec ttc_header;
-
- FT_ULong format_tag;
- FT_UShort num_tables;
- TT_Table dir_tables;
-
- TT_Header header; /* TrueType header table */
- TT_HoriHeader horizontal; /* TrueType horizontal header */
-
- TT_MaxProfile max_profile;
-
- FT_Bool vertical_info;
- TT_VertHeader vertical; /* TT Vertical header, if present */
-
- FT_UShort num_names; /* number of name records */
- TT_NameTableRec name_table; /* name table */
-
- TT_OS2 os2; /* TrueType OS/2 table */
- TT_Postscript postscript; /* TrueType Postscript table */
-
- FT_Byte* cmap_table; /* extracted `cmap' table */
- FT_ULong cmap_size;
-
- TT_Loader_GotoTableFunc goto_table;
-
- TT_Loader_StartGlyphFunc access_glyph_frame;
- TT_Loader_EndGlyphFunc forget_glyph_frame;
- TT_Loader_ReadGlyphFunc read_glyph_header;
- TT_Loader_ReadGlyphFunc read_simple_glyph;
- TT_Loader_ReadGlyphFunc read_composite_glyph;
-
- /* a typeless pointer to the SFNT_Interface table used to load */
- /* the basic TrueType tables in the face object */
- void* sfnt;
-
- /* a typeless pointer to the FT_Service_PsCMapsRec table used to */
- /* handle glyph names <-> unicode & Mac values */
- void* psnames;
-
-
- /***********************************************************************/
- /* */
- /* Optional TrueType/OpenType tables */
- /* */
- /***********************************************************************/
-
- /* grid-fitting and scaling table */
- TT_GaspRec gasp; /* the `gasp' table */
-
- /* PCL 5 table */
- TT_PCLT pclt;
-
- /* embedded bitmaps support */
- FT_ULong num_sbit_scales;
- TT_SBit_Scale sbit_scales;
-
- /* postscript names table */
- TT_Post_NamesRec postscript_names;
-
-
- /***********************************************************************/
- /* */
- /* TrueType-specific fields (ignored by the OTF-Type2 driver) */
- /* */
- /***********************************************************************/
-
- /* the font program, if any */
- FT_ULong font_program_size;
- FT_Byte* font_program;
-
- /* the cvt program, if any */
- FT_ULong cvt_program_size;
- FT_Byte* cvt_program;
-
- /* the original, unscaled, control value table */
- FT_ULong cvt_size;
- FT_Short* cvt;
-
- /* A pointer to the bytecode interpreter to use. This is also */
- /* used to hook the debugger for the `ttdebug' utility. */
- TT_Interpreter interpreter;
-
-#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
- /* Use unpatented hinting only. */
- FT_Bool unpatented_hinting;
-#endif
-
- /***********************************************************************/
- /* */
- /* Other tables or fields. This is used by derivative formats like */
- /* OpenType. */
- /* */
- /***********************************************************************/
-
- FT_Generic extra;
-
- const char* postscript_name;
-
- FT_ULong glyf_len;
-
-#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
- FT_Bool doblend;
- GX_Blend blend;
-#endif
-
- /* since version 2.2 */
-
- FT_Byte* horz_metrics;
- FT_ULong horz_metrics_size;
-
- FT_Byte* vert_metrics;
- FT_ULong vert_metrics_size;
-
- FT_ULong num_locations; /* in broken TTF, gid > 0xFFFF */
- FT_Byte* glyph_locations;
-
- FT_Byte* hdmx_table;
- FT_ULong hdmx_table_size;
- FT_UInt hdmx_record_count;
- FT_ULong hdmx_record_size;
- FT_Byte* hdmx_record_sizes;
-
- FT_Byte* sbit_table;
- FT_ULong sbit_table_size;
- TT_SbitTableType sbit_table_type;
- FT_UInt sbit_num_strikes;
-
- FT_Byte* kern_table;
- FT_ULong kern_table_size;
- FT_UInt num_kern_tables;
- FT_UInt32 kern_avail_bits;
- FT_UInt32 kern_order_bits;
-
-#ifdef TT_CONFIG_OPTION_BDF
- TT_BDFRec bdf;
-#endif /* TT_CONFIG_OPTION_BDF */
-
- /* since 2.3.0 */
- FT_ULong horz_metrics_offset;
- FT_ULong vert_metrics_offset;
-
-#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
- /* since 2.4.12 */
- FT_ULong sph_found_func_flags; /* special functions found */
- /* for this face */
- FT_Bool sph_compatibility_mode;
-#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */
-
- } TT_FaceRec;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* TT_GlyphZoneRec */
- /* */
- /* <Description> */
- /* A glyph zone is used to load, scale and hint glyph outline */
- /* coordinates. */
- /* */
- /* <Fields> */
- /* memory :: A handle to the memory manager. */
- /* */
- /* max_points :: The maximum size in points of the zone. */
- /* */
- /* max_contours :: Max size in links contours of the zone. */
- /* */
- /* n_points :: The current number of points in the zone. */
- /* */
- /* n_contours :: The current number of contours in the zone. */
- /* */
- /* org :: The original glyph coordinates (font */
- /* units/scaled). */
- /* */
- /* cur :: The current glyph coordinates (scaled/hinted). */
- /* */
- /* tags :: The point control tags. */
- /* */
- /* contours :: The contours end points. */
- /* */
- /* first_point :: Offset of the current subglyph's first point. */
- /* */
- typedef struct TT_GlyphZoneRec_
- {
- FT_Memory memory;
- FT_UShort max_points;
- FT_Short max_contours;
- FT_UShort n_points; /* number of points in zone */
- FT_Short n_contours; /* number of contours */
-
- FT_Vector* org; /* original point coordinates */
- FT_Vector* cur; /* current point coordinates */
- FT_Vector* orus; /* original (unscaled) point coordinates */
-
- FT_Byte* tags; /* current touch flags */
- FT_UShort* contours; /* contour end points */
-
- FT_UShort first_point; /* offset of first (#0) point */
-
- } TT_GlyphZoneRec, *TT_GlyphZone;
-
-
- /* handle to execution context */
- typedef struct TT_ExecContextRec_* TT_ExecContext;
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* TT_Size */
- /* */
- /* <Description> */
- /* A handle to a TrueType size object. */
- /* */
- typedef struct TT_SizeRec_* TT_Size;
-
-
- /* glyph loader structure */
- typedef struct TT_LoaderRec_
- {
- TT_Face face;
- TT_Size size;
- FT_GlyphSlot glyph;
- FT_GlyphLoader gloader;
-
- FT_ULong load_flags;
- FT_UInt glyph_index;
-
- FT_Stream stream;
- FT_Int byte_len;
-
- FT_Short n_contours;
- FT_BBox bbox;
- FT_Int left_bearing;
- FT_Int advance;
- FT_Int linear;
- FT_Bool linear_def;
- FT_Vector pp1;
- FT_Vector pp2;
-
- FT_ULong glyf_offset;
-
- /* the zone where we load our glyphs */
- TT_GlyphZoneRec base;
- TT_GlyphZoneRec zone;
-
- TT_ExecContext exec;
- FT_Byte* instructions;
- FT_ULong ins_pos;
-
- /* for possible extensibility in other formats */
- void* other;
-
- /* since version 2.1.8 */
- FT_Int top_bearing;
- FT_Int vadvance;
- FT_Vector pp3;
- FT_Vector pp4;
-
- /* since version 2.2.1 */
- FT_Byte* cursor;
- FT_Byte* limit;
-
- } TT_LoaderRec;
-
-
-FT_END_HEADER
-
-#endif /* __TTTYPES_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/t1tables.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/t1tables.h
deleted file mode 100644
index a6ea415af58..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/t1tables.h
+++ /dev/null
@@ -1,761 +0,0 @@
-/***************************************************************************/
-/* */
-/* t1tables.h */
-/* */
-/* Basic Type 1/Type 2 tables definitions and interface (specification */
-/* only). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __T1TABLES_H__
-#define __T1TABLES_H__
-
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-
-#ifdef FREETYPE_H
-#error "freetype.h of FreeType 1 has been loaded!"
-#error "Please fix the directory search order for header files"
-#error "so that freetype.h of FreeType 2 is found first."
-#endif
-
-
-FT_BEGIN_HEADER
-
-
- /*************************************************************************/
- /* */
- /* <Section> */
- /* type1_tables */
- /* */
- /* <Title> */
- /* Type 1 Tables */
- /* */
- /* <Abstract> */
- /* Type~1 (PostScript) specific font tables. */
- /* */
- /* <Description> */
- /* This section contains the definition of Type 1-specific tables, */
- /* including structures related to other PostScript font formats. */
- /* */
- /* <Order> */
- /* PS_FontInfoRec */
- /* PS_FontInfo */
- /* PS_PrivateRec */
- /* PS_Private */
- /* */
- /* CID_FaceDictRec */
- /* CID_FaceDict */
- /* CID_FaceInfoRec */
- /* CID_FaceInfo */
- /* */
- /* FT_Has_PS_Glyph_Names */
- /* FT_Get_PS_Font_Info */
- /* FT_Get_PS_Font_Private */
- /* FT_Get_PS_Font_Value */
- /* */
- /* T1_Blend_Flags */
- /* T1_EncodingType */
- /* PS_Dict_Keys */
- /* */
- /*************************************************************************/
-
-
- /* Note that we separate font data in PS_FontInfoRec and PS_PrivateRec */
- /* structures in order to support Multiple Master fonts. */
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* PS_FontInfoRec */
- /* */
- /* <Description> */
- /* A structure used to model a Type~1 or Type~2 FontInfo dictionary. */
- /* Note that for Multiple Master fonts, each instance has its own */
- /* FontInfo dictionary. */
- /* */
- typedef struct PS_FontInfoRec_
- {
- FT_String* version;
- FT_String* notice;
- FT_String* full_name;
- FT_String* family_name;
- FT_String* weight;
- FT_Long italic_angle;
- FT_Bool is_fixed_pitch;
- FT_Short underline_position;
- FT_UShort underline_thickness;
-
- } PS_FontInfoRec;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* PS_FontInfo */
- /* */
- /* <Description> */
- /* A handle to a @PS_FontInfoRec structure. */
- /* */
- typedef struct PS_FontInfoRec_* PS_FontInfo;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* T1_FontInfo */
- /* */
- /* <Description> */
- /* This type is equivalent to @PS_FontInfoRec. It is deprecated but */
- /* kept to maintain source compatibility between various versions of */
- /* FreeType. */
- /* */
- typedef PS_FontInfoRec T1_FontInfo;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* PS_PrivateRec */
- /* */
- /* <Description> */
- /* A structure used to model a Type~1 or Type~2 private dictionary. */
- /* Note that for Multiple Master fonts, each instance has its own */
- /* Private dictionary. */
- /* */
- typedef struct PS_PrivateRec_
- {
- FT_Int unique_id;
- FT_Int lenIV;
-
- FT_Byte num_blue_values;
- FT_Byte num_other_blues;
- FT_Byte num_family_blues;
- FT_Byte num_family_other_blues;
-
- FT_Short blue_values[14];
- FT_Short other_blues[10];
-
- FT_Short family_blues [14];
- FT_Short family_other_blues[10];
-
- FT_Fixed blue_scale;
- FT_Int blue_shift;
- FT_Int blue_fuzz;
-
- FT_UShort standard_width[1];
- FT_UShort standard_height[1];
-
- FT_Byte num_snap_widths;
- FT_Byte num_snap_heights;
- FT_Bool force_bold;
- FT_Bool round_stem_up;
-
- FT_Short snap_widths [13]; /* including std width */
- FT_Short snap_heights[13]; /* including std height */
-
- FT_Fixed expansion_factor;
-
- FT_Long language_group;
- FT_Long password;
-
- FT_Short min_feature[2];
-
- } PS_PrivateRec;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* PS_Private */
- /* */
- /* <Description> */
- /* A handle to a @PS_PrivateRec structure. */
- /* */
- typedef struct PS_PrivateRec_* PS_Private;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* T1_Private */
- /* */
- /* <Description> */
- /* This type is equivalent to @PS_PrivateRec. It is deprecated but */
- /* kept to maintain source compatibility between various versions of */
- /* FreeType. */
- /* */
- typedef PS_PrivateRec T1_Private;
-
-
- /*************************************************************************/
- /* */
- /* <Enum> */
- /* T1_Blend_Flags */
- /* */
- /* <Description> */
- /* A set of flags used to indicate which fields are present in a */
- /* given blend dictionary (font info or private). Used to support */
- /* Multiple Masters fonts. */
- /* */
- /* <Values> */
- /* T1_BLEND_UNDERLINE_POSITION :: */
- /* T1_BLEND_UNDERLINE_THICKNESS :: */
- /* T1_BLEND_ITALIC_ANGLE :: */
- /* T1_BLEND_BLUE_VALUES :: */
- /* T1_BLEND_OTHER_BLUES :: */
- /* T1_BLEND_STANDARD_WIDTH :: */
- /* T1_BLEND_STANDARD_HEIGHT :: */
- /* T1_BLEND_STEM_SNAP_WIDTHS :: */
- /* T1_BLEND_STEM_SNAP_HEIGHTS :: */
- /* T1_BLEND_BLUE_SCALE :: */
- /* T1_BLEND_BLUE_SHIFT :: */
- /* T1_BLEND_FAMILY_BLUES :: */
- /* T1_BLEND_FAMILY_OTHER_BLUES :: */
- /* T1_BLEND_FORCE_BOLD :: */
- /* */
- typedef enum T1_Blend_Flags_
- {
- /* required fields in a FontInfo blend dictionary */
- T1_BLEND_UNDERLINE_POSITION = 0,
- T1_BLEND_UNDERLINE_THICKNESS,
- T1_BLEND_ITALIC_ANGLE,
-
- /* required fields in a Private blend dictionary */
- T1_BLEND_BLUE_VALUES,
- T1_BLEND_OTHER_BLUES,
- T1_BLEND_STANDARD_WIDTH,
- T1_BLEND_STANDARD_HEIGHT,
- T1_BLEND_STEM_SNAP_WIDTHS,
- T1_BLEND_STEM_SNAP_HEIGHTS,
- T1_BLEND_BLUE_SCALE,
- T1_BLEND_BLUE_SHIFT,
- T1_BLEND_FAMILY_BLUES,
- T1_BLEND_FAMILY_OTHER_BLUES,
- T1_BLEND_FORCE_BOLD,
-
- T1_BLEND_MAX /* do not remove */
-
- } T1_Blend_Flags;
-
-
- /* these constants are deprecated; use the corresponding */
- /* `T1_Blend_Flags' values instead */
-#define t1_blend_underline_position T1_BLEND_UNDERLINE_POSITION
-#define t1_blend_underline_thickness T1_BLEND_UNDERLINE_THICKNESS
-#define t1_blend_italic_angle T1_BLEND_ITALIC_ANGLE
-#define t1_blend_blue_values T1_BLEND_BLUE_VALUES
-#define t1_blend_other_blues T1_BLEND_OTHER_BLUES
-#define t1_blend_standard_widths T1_BLEND_STANDARD_WIDTH
-#define t1_blend_standard_height T1_BLEND_STANDARD_HEIGHT
-#define t1_blend_stem_snap_widths T1_BLEND_STEM_SNAP_WIDTHS
-#define t1_blend_stem_snap_heights T1_BLEND_STEM_SNAP_HEIGHTS
-#define t1_blend_blue_scale T1_BLEND_BLUE_SCALE
-#define t1_blend_blue_shift T1_BLEND_BLUE_SHIFT
-#define t1_blend_family_blues T1_BLEND_FAMILY_BLUES
-#define t1_blend_family_other_blues T1_BLEND_FAMILY_OTHER_BLUES
-#define t1_blend_force_bold T1_BLEND_FORCE_BOLD
-#define t1_blend_max T1_BLEND_MAX
-
- /* */
-
-
- /* maximum number of Multiple Masters designs, as defined in the spec */
-#define T1_MAX_MM_DESIGNS 16
-
- /* maximum number of Multiple Masters axes, as defined in the spec */
-#define T1_MAX_MM_AXIS 4
-
- /* maximum number of elements in a design map */
-#define T1_MAX_MM_MAP_POINTS 20
-
-
- /* this structure is used to store the BlendDesignMap entry for an axis */
- typedef struct PS_DesignMap_
- {
- FT_Byte num_points;
- FT_Long* design_points;
- FT_Fixed* blend_points;
-
- } PS_DesignMapRec, *PS_DesignMap;
-
- /* backwards-compatible definition */
- typedef PS_DesignMapRec T1_DesignMap;
-
-
- typedef struct PS_BlendRec_
- {
- FT_UInt num_designs;
- FT_UInt num_axis;
-
- FT_String* axis_names[T1_MAX_MM_AXIS];
- FT_Fixed* design_pos[T1_MAX_MM_DESIGNS];
- PS_DesignMapRec design_map[T1_MAX_MM_AXIS];
-
- FT_Fixed* weight_vector;
- FT_Fixed* default_weight_vector;
-
- PS_FontInfo font_infos[T1_MAX_MM_DESIGNS + 1];
- PS_Private privates [T1_MAX_MM_DESIGNS + 1];
-
- FT_ULong blend_bitflags;
-
- FT_BBox* bboxes [T1_MAX_MM_DESIGNS + 1];
-
- /* since 2.3.0 */
-
- /* undocumented, optional: the default design instance; */
- /* corresponds to default_weight_vector -- */
- /* num_default_design_vector == 0 means it is not present */
- /* in the font and associated metrics files */
- FT_UInt default_design_vector[T1_MAX_MM_DESIGNS];
- FT_UInt num_default_design_vector;
-
- } PS_BlendRec, *PS_Blend;
-
-
- /* backwards-compatible definition */
- typedef PS_BlendRec T1_Blend;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* CID_FaceDictRec */
- /* */
- /* <Description> */
- /* A structure used to represent data in a CID top-level dictionary. */
- /* */
- typedef struct CID_FaceDictRec_
- {
- PS_PrivateRec private_dict;
-
- FT_UInt len_buildchar;
- FT_Fixed forcebold_threshold;
- FT_Pos stroke_width;
- FT_Fixed expansion_factor;
-
- FT_Byte paint_type;
- FT_Byte font_type;
- FT_Matrix font_matrix;
- FT_Vector font_offset;
-
- FT_UInt num_subrs;
- FT_ULong subrmap_offset;
- FT_Int sd_bytes;
-
- } CID_FaceDictRec;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* CID_FaceDict */
- /* */
- /* <Description> */
- /* A handle to a @CID_FaceDictRec structure. */
- /* */
- typedef struct CID_FaceDictRec_* CID_FaceDict;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* CID_FontDict */
- /* */
- /* <Description> */
- /* This type is equivalent to @CID_FaceDictRec. It is deprecated but */
- /* kept to maintain source compatibility between various versions of */
- /* FreeType. */
- /* */
- typedef CID_FaceDictRec CID_FontDict;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* CID_FaceInfoRec */
- /* */
- /* <Description> */
- /* A structure used to represent CID Face information. */
- /* */
- typedef struct CID_FaceInfoRec_
- {
- FT_String* cid_font_name;
- FT_Fixed cid_version;
- FT_Int cid_font_type;
-
- FT_String* registry;
- FT_String* ordering;
- FT_Int supplement;
-
- PS_FontInfoRec font_info;
- FT_BBox font_bbox;
- FT_ULong uid_base;
-
- FT_Int num_xuid;
- FT_ULong xuid[16];
-
- FT_ULong cidmap_offset;
- FT_Int fd_bytes;
- FT_Int gd_bytes;
- FT_ULong cid_count;
-
- FT_Int num_dicts;
- CID_FaceDict font_dicts;
-
- FT_ULong data_offset;
-
- } CID_FaceInfoRec;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* CID_FaceInfo */
- /* */
- /* <Description> */
- /* A handle to a @CID_FaceInfoRec structure. */
- /* */
- typedef struct CID_FaceInfoRec_* CID_FaceInfo;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* CID_Info */
- /* */
- /* <Description> */
- /* This type is equivalent to @CID_FaceInfoRec. It is deprecated but */
- /* kept to maintain source compatibility between various versions of */
- /* FreeType. */
- /* */
- typedef CID_FaceInfoRec CID_Info;
-
-
- /************************************************************************
- *
- * @function:
- * FT_Has_PS_Glyph_Names
- *
- * @description:
- * Return true if a given face provides reliable PostScript glyph
- * names. This is similar to using the @FT_HAS_GLYPH_NAMES macro,
- * except that certain fonts (mostly TrueType) contain incorrect
- * glyph name tables.
- *
- * When this function returns true, the caller is sure that the glyph
- * names returned by @FT_Get_Glyph_Name are reliable.
- *
- * @input:
- * face ::
- * face handle
- *
- * @return:
- * Boolean. True if glyph names are reliable.
- *
- */
- FT_EXPORT( FT_Int )
- FT_Has_PS_Glyph_Names( FT_Face face );
-
-
- /************************************************************************
- *
- * @function:
- * FT_Get_PS_Font_Info
- *
- * @description:
- * Retrieve the @PS_FontInfoRec structure corresponding to a given
- * PostScript font.
- *
- * @input:
- * face ::
- * PostScript face handle.
- *
- * @output:
- * afont_info ::
- * Output font info structure pointer.
- *
- * @return:
- * FreeType error code. 0~means success.
- *
- * @note:
- * String pointers within the @PS_FontInfoRec structure are owned by
- * the face and don't need to be freed by the caller. Missing entries
- * in the font's FontInfo dictionary are represented by NULL pointers.
- *
- * If the font's format is not PostScript-based, this function will
- * return the `FT_Err_Invalid_Argument' error code.
- *
- */
- FT_EXPORT( FT_Error )
- FT_Get_PS_Font_Info( FT_Face face,
- PS_FontInfo afont_info );
-
-
- /************************************************************************
- *
- * @function:
- * FT_Get_PS_Font_Private
- *
- * @description:
- * Retrieve the @PS_PrivateRec structure corresponding to a given
- * PostScript font.
- *
- * @input:
- * face ::
- * PostScript face handle.
- *
- * @output:
- * afont_private ::
- * Output private dictionary structure pointer.
- *
- * @return:
- * FreeType error code. 0~means success.
- *
- * @note:
- * The string pointers within the @PS_PrivateRec structure are owned by
- * the face and don't need to be freed by the caller.
- *
- * If the font's format is not PostScript-based, this function returns
- * the `FT_Err_Invalid_Argument' error code.
- *
- */
- FT_EXPORT( FT_Error )
- FT_Get_PS_Font_Private( FT_Face face,
- PS_Private afont_private );
-
-
- /*************************************************************************/
- /* */
- /* <Enum> */
- /* T1_EncodingType */
- /* */
- /* <Description> */
- /* An enumeration describing the `Encoding' entry in a Type 1 */
- /* dictionary. */
- /* */
- /* <Values> */
- /* T1_ENCODING_TYPE_NONE :: */
- /* T1_ENCODING_TYPE_ARRAY :: */
- /* T1_ENCODING_TYPE_STANDARD :: */
- /* T1_ENCODING_TYPE_ISOLATIN1 :: */
- /* T1_ENCODING_TYPE_EXPERT :: */
- /* */
- typedef enum T1_EncodingType_
- {
- T1_ENCODING_TYPE_NONE = 0,
- T1_ENCODING_TYPE_ARRAY,
- T1_ENCODING_TYPE_STANDARD,
- T1_ENCODING_TYPE_ISOLATIN1,
- T1_ENCODING_TYPE_EXPERT
-
- } T1_EncodingType;
-
-
- /*************************************************************************/
- /* */
- /* <Enum> */
- /* PS_Dict_Keys */
- /* */
- /* <Description> */
- /* An enumeration used in calls to @FT_Get_PS_Font_Value to identify */
- /* the Type~1 dictionary entry to retrieve. */
- /* */
- /* <Values> */
- /* PS_DICT_FONT_TYPE :: */
- /* PS_DICT_FONT_MATRIX :: */
- /* PS_DICT_FONT_BBOX :: */
- /* PS_DICT_PAINT_TYPE :: */
- /* PS_DICT_FONT_NAME :: */
- /* PS_DICT_UNIQUE_ID :: */
- /* PS_DICT_NUM_CHAR_STRINGS :: */
- /* PS_DICT_CHAR_STRING_KEY :: */
- /* PS_DICT_CHAR_STRING :: */
- /* PS_DICT_ENCODING_TYPE :: */
- /* PS_DICT_ENCODING_ENTRY :: */
- /* PS_DICT_NUM_SUBRS :: */
- /* PS_DICT_SUBR :: */
- /* PS_DICT_STD_HW :: */
- /* PS_DICT_STD_VW :: */
- /* PS_DICT_NUM_BLUE_VALUES :: */
- /* PS_DICT_BLUE_VALUE :: */
- /* PS_DICT_BLUE_FUZZ :: */
- /* PS_DICT_NUM_OTHER_BLUES :: */
- /* PS_DICT_OTHER_BLUE :: */
- /* PS_DICT_NUM_FAMILY_BLUES :: */
- /* PS_DICT_FAMILY_BLUE :: */
- /* PS_DICT_NUM_FAMILY_OTHER_BLUES :: */
- /* PS_DICT_FAMILY_OTHER_BLUE :: */
- /* PS_DICT_BLUE_SCALE :: */
- /* PS_DICT_BLUE_SHIFT :: */
- /* PS_DICT_NUM_STEM_SNAP_H :: */
- /* PS_DICT_STEM_SNAP_H :: */
- /* PS_DICT_NUM_STEM_SNAP_V :: */
- /* PS_DICT_STEM_SNAP_V :: */
- /* PS_DICT_FORCE_BOLD :: */
- /* PS_DICT_RND_STEM_UP :: */
- /* PS_DICT_MIN_FEATURE :: */
- /* PS_DICT_LEN_IV :: */
- /* PS_DICT_PASSWORD :: */
- /* PS_DICT_LANGUAGE_GROUP :: */
- /* PS_DICT_VERSION :: */
- /* PS_DICT_NOTICE :: */
- /* PS_DICT_FULL_NAME :: */
- /* PS_DICT_FAMILY_NAME :: */
- /* PS_DICT_WEIGHT :: */
- /* PS_DICT_IS_FIXED_PITCH :: */
- /* PS_DICT_UNDERLINE_POSITION :: */
- /* PS_DICT_UNDERLINE_THICKNESS :: */
- /* PS_DICT_FS_TYPE :: */
- /* PS_DICT_ITALIC_ANGLE :: */
- /* */
- typedef enum PS_Dict_Keys_
- {
- /* conventionally in the font dictionary */
- PS_DICT_FONT_TYPE, /* FT_Byte */
- PS_DICT_FONT_MATRIX, /* FT_Fixed */
- PS_DICT_FONT_BBOX, /* FT_Fixed */
- PS_DICT_PAINT_TYPE, /* FT_Byte */
- PS_DICT_FONT_NAME, /* FT_String* */
- PS_DICT_UNIQUE_ID, /* FT_Int */
- PS_DICT_NUM_CHAR_STRINGS, /* FT_Int */
- PS_DICT_CHAR_STRING_KEY, /* FT_String* */
- PS_DICT_CHAR_STRING, /* FT_String* */
- PS_DICT_ENCODING_TYPE, /* T1_EncodingType */
- PS_DICT_ENCODING_ENTRY, /* FT_String* */
-
- /* conventionally in the font Private dictionary */
- PS_DICT_NUM_SUBRS, /* FT_Int */
- PS_DICT_SUBR, /* FT_String* */
- PS_DICT_STD_HW, /* FT_UShort */
- PS_DICT_STD_VW, /* FT_UShort */
- PS_DICT_NUM_BLUE_VALUES, /* FT_Byte */
- PS_DICT_BLUE_VALUE, /* FT_Short */
- PS_DICT_BLUE_FUZZ, /* FT_Int */
- PS_DICT_NUM_OTHER_BLUES, /* FT_Byte */
- PS_DICT_OTHER_BLUE, /* FT_Short */
- PS_DICT_NUM_FAMILY_BLUES, /* FT_Byte */
- PS_DICT_FAMILY_BLUE, /* FT_Short */
- PS_DICT_NUM_FAMILY_OTHER_BLUES, /* FT_Byte */
- PS_DICT_FAMILY_OTHER_BLUE, /* FT_Short */
- PS_DICT_BLUE_SCALE, /* FT_Fixed */
- PS_DICT_BLUE_SHIFT, /* FT_Int */
- PS_DICT_NUM_STEM_SNAP_H, /* FT_Byte */
- PS_DICT_STEM_SNAP_H, /* FT_Short */
- PS_DICT_NUM_STEM_SNAP_V, /* FT_Byte */
- PS_DICT_STEM_SNAP_V, /* FT_Short */
- PS_DICT_FORCE_BOLD, /* FT_Bool */
- PS_DICT_RND_STEM_UP, /* FT_Bool */
- PS_DICT_MIN_FEATURE, /* FT_Short */
- PS_DICT_LEN_IV, /* FT_Int */
- PS_DICT_PASSWORD, /* FT_Long */
- PS_DICT_LANGUAGE_GROUP, /* FT_Long */
-
- /* conventionally in the font FontInfo dictionary */
- PS_DICT_VERSION, /* FT_String* */
- PS_DICT_NOTICE, /* FT_String* */
- PS_DICT_FULL_NAME, /* FT_String* */
- PS_DICT_FAMILY_NAME, /* FT_String* */
- PS_DICT_WEIGHT, /* FT_String* */
- PS_DICT_IS_FIXED_PITCH, /* FT_Bool */
- PS_DICT_UNDERLINE_POSITION, /* FT_Short */
- PS_DICT_UNDERLINE_THICKNESS, /* FT_UShort */
- PS_DICT_FS_TYPE, /* FT_UShort */
- PS_DICT_ITALIC_ANGLE, /* FT_Long */
-
- PS_DICT_MAX = PS_DICT_ITALIC_ANGLE
-
- } PS_Dict_Keys;
-
-
- /************************************************************************
- *
- * @function:
- * FT_Get_PS_Font_Value
- *
- * @description:
- * Retrieve the value for the supplied key from a PostScript font.
- *
- * @input:
- * face ::
- * PostScript face handle.
- *
- * key ::
- * An enumeration value representing the dictionary key to retrieve.
- *
- * idx ::
- * For array values, this specifies the index to be returned.
- *
- * value ::
- * A pointer to memory into which to write the value.
- *
- * valen_len ::
- * The size, in bytes, of the memory supplied for the value.
- *
- * @output:
- * value ::
- * The value matching the above key, if it exists.
- *
- * @return:
- * The amount of memory (in bytes) required to hold the requested
- * value (if it exists, -1 otherwise).
- *
- * @note:
- * The values returned are not pointers into the internal structures of
- * the face, but are `fresh' copies, so that the memory containing them
- * belongs to the calling application. This also enforces the
- * `read-only' nature of these values, i.e., this function cannot be
- * used to manipulate the face.
- *
- * `value' is a void pointer because the values returned can be of
- * various types.
- *
- * If either `value' is NULL or `value_len' is too small, just the
- * required memory size for the requested entry is returned.
- *
- * The `idx' parameter is used, not only to retrieve elements of, for
- * example, the FontMatrix or FontBBox, but also to retrieve name keys
- * from the CharStrings dictionary, and the charstrings themselves. It
- * is ignored for atomic values.
- *
- * PS_DICT_BLUE_SCALE returns a value that is scaled up by 1000. To
- * get the value as in the font stream, you need to divide by
- * 65536000.0 (to remove the FT_Fixed scale, and the x1000 scale).
- *
- * IMPORTANT: Only key/value pairs read by the FreeType interpreter can
- * be retrieved. So, for example, PostScript procedures such as NP,
- * ND, and RD are not available. Arbitrary keys are, obviously, not be
- * available either.
- *
- * If the font's format is not PostScript-based, this function returns
- * the `FT_Err_Invalid_Argument' error code.
- *
- */
- FT_EXPORT( FT_Long )
- FT_Get_PS_Font_Value( FT_Face face,
- PS_Dict_Keys key,
- FT_UInt idx,
- void *value,
- FT_Long value_len );
-
- /* */
-
-FT_END_HEADER
-
-#endif /* __T1TABLES_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ttnameid.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/ttnameid.h
deleted file mode 100644
index c9585f24137..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ttnameid.h
+++ /dev/null
@@ -1,1237 +0,0 @@
-/***************************************************************************/
-/* */
-/* ttnameid.h */
-/* */
-/* TrueType name ID definitions (specification only). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __TTNAMEID_H__
-#define __TTNAMEID_H__
-
-
-#include <ft2build.h>
-
-
-FT_BEGIN_HEADER
-
-
- /*************************************************************************/
- /* */
- /* <Section> */
- /* truetype_tables */
- /* */
-
-
- /*************************************************************************/
- /* */
- /* Possible values for the `platform' identifier code in the name */
- /* records of the TTF `name' table. */
- /* */
- /*************************************************************************/
-
-
- /***********************************************************************
- *
- * @enum:
- * TT_PLATFORM_XXX
- *
- * @description:
- * A list of valid values for the `platform_id' identifier code in
- * @FT_CharMapRec and @FT_SfntName structures.
- *
- * @values:
- * TT_PLATFORM_APPLE_UNICODE ::
- * Used by Apple to indicate a Unicode character map and/or name entry.
- * See @TT_APPLE_ID_XXX for corresponding `encoding_id' values. Note
- * that name entries in this format are coded as big-endian UCS-2
- * character codes _only_.
- *
- * TT_PLATFORM_MACINTOSH ::
- * Used by Apple to indicate a MacOS-specific charmap and/or name entry.
- * See @TT_MAC_ID_XXX for corresponding `encoding_id' values. Note that
- * most TrueType fonts contain an Apple roman charmap to be usable on
- * MacOS systems (even if they contain a Microsoft charmap as well).
- *
- * TT_PLATFORM_ISO ::
- * This value was used to specify ISO/IEC 10646 charmaps. It is however
- * now deprecated. See @TT_ISO_ID_XXX for a list of corresponding
- * `encoding_id' values.
- *
- * TT_PLATFORM_MICROSOFT ::
- * Used by Microsoft to indicate Windows-specific charmaps. See
- * @TT_MS_ID_XXX for a list of corresponding `encoding_id' values.
- * Note that most fonts contain a Unicode charmap using
- * (TT_PLATFORM_MICROSOFT, @TT_MS_ID_UNICODE_CS).
- *
- * TT_PLATFORM_CUSTOM ::
- * Used to indicate application-specific charmaps.
- *
- * TT_PLATFORM_ADOBE ::
- * This value isn't part of any font format specification, but is used
- * by FreeType to report Adobe-specific charmaps in an @FT_CharMapRec
- * structure. See @TT_ADOBE_ID_XXX.
- */
-
-#define TT_PLATFORM_APPLE_UNICODE 0
-#define TT_PLATFORM_MACINTOSH 1
-#define TT_PLATFORM_ISO 2 /* deprecated */
-#define TT_PLATFORM_MICROSOFT 3
-#define TT_PLATFORM_CUSTOM 4
-#define TT_PLATFORM_ADOBE 7 /* artificial */
-
-
- /***********************************************************************
- *
- * @enum:
- * TT_APPLE_ID_XXX
- *
- * @description:
- * A list of valid values for the `encoding_id' for
- * @TT_PLATFORM_APPLE_UNICODE charmaps and name entries.
- *
- * @values:
- * TT_APPLE_ID_DEFAULT ::
- * Unicode version 1.0.
- *
- * TT_APPLE_ID_UNICODE_1_1 ::
- * Unicode 1.1; specifies Hangul characters starting at U+34xx.
- *
- * TT_APPLE_ID_ISO_10646 ::
- * Deprecated (identical to preceding).
- *
- * TT_APPLE_ID_UNICODE_2_0 ::
- * Unicode 2.0 and beyond (UTF-16 BMP only).
- *
- * TT_APPLE_ID_UNICODE_32 ::
- * Unicode 3.1 and beyond, using UTF-32.
- *
- * TT_APPLE_ID_VARIANT_SELECTOR ::
- * From Adobe, not Apple. Not a normal cmap. Specifies variations
- * on a real cmap.
- */
-
-#define TT_APPLE_ID_DEFAULT 0 /* Unicode 1.0 */
-#define TT_APPLE_ID_UNICODE_1_1 1 /* specify Hangul at U+34xx */
-#define TT_APPLE_ID_ISO_10646 2 /* deprecated */
-#define TT_APPLE_ID_UNICODE_2_0 3 /* or later */
-#define TT_APPLE_ID_UNICODE_32 4 /* 2.0 or later, full repertoire */
-#define TT_APPLE_ID_VARIANT_SELECTOR 5 /* variation selector data */
-
-
- /***********************************************************************
- *
- * @enum:
- * TT_MAC_ID_XXX
- *
- * @description:
- * A list of valid values for the `encoding_id' for
- * @TT_PLATFORM_MACINTOSH charmaps and name entries.
- *
- * @values:
- * TT_MAC_ID_ROMAN ::
- * TT_MAC_ID_JAPANESE ::
- * TT_MAC_ID_TRADITIONAL_CHINESE ::
- * TT_MAC_ID_KOREAN ::
- * TT_MAC_ID_ARABIC ::
- * TT_MAC_ID_HEBREW ::
- * TT_MAC_ID_GREEK ::
- * TT_MAC_ID_RUSSIAN ::
- * TT_MAC_ID_RSYMBOL ::
- * TT_MAC_ID_DEVANAGARI ::
- * TT_MAC_ID_GURMUKHI ::
- * TT_MAC_ID_GUJARATI ::
- * TT_MAC_ID_ORIYA ::
- * TT_MAC_ID_BENGALI ::
- * TT_MAC_ID_TAMIL ::
- * TT_MAC_ID_TELUGU ::
- * TT_MAC_ID_KANNADA ::
- * TT_MAC_ID_MALAYALAM ::
- * TT_MAC_ID_SINHALESE ::
- * TT_MAC_ID_BURMESE ::
- * TT_MAC_ID_KHMER ::
- * TT_MAC_ID_THAI ::
- * TT_MAC_ID_LAOTIAN ::
- * TT_MAC_ID_GEORGIAN ::
- * TT_MAC_ID_ARMENIAN ::
- * TT_MAC_ID_MALDIVIAN ::
- * TT_MAC_ID_SIMPLIFIED_CHINESE ::
- * TT_MAC_ID_TIBETAN ::
- * TT_MAC_ID_MONGOLIAN ::
- * TT_MAC_ID_GEEZ ::
- * TT_MAC_ID_SLAVIC ::
- * TT_MAC_ID_VIETNAMESE ::
- * TT_MAC_ID_SINDHI ::
- * TT_MAC_ID_UNINTERP ::
- */
-
-#define TT_MAC_ID_ROMAN 0
-#define TT_MAC_ID_JAPANESE 1
-#define TT_MAC_ID_TRADITIONAL_CHINESE 2
-#define TT_MAC_ID_KOREAN 3
-#define TT_MAC_ID_ARABIC 4
-#define TT_MAC_ID_HEBREW 5
-#define TT_MAC_ID_GREEK 6
-#define TT_MAC_ID_RUSSIAN 7
-#define TT_MAC_ID_RSYMBOL 8
-#define TT_MAC_ID_DEVANAGARI 9
-#define TT_MAC_ID_GURMUKHI 10
-#define TT_MAC_ID_GUJARATI 11
-#define TT_MAC_ID_ORIYA 12
-#define TT_MAC_ID_BENGALI 13
-#define TT_MAC_ID_TAMIL 14
-#define TT_MAC_ID_TELUGU 15
-#define TT_MAC_ID_KANNADA 16
-#define TT_MAC_ID_MALAYALAM 17
-#define TT_MAC_ID_SINHALESE 18
-#define TT_MAC_ID_BURMESE 19
-#define TT_MAC_ID_KHMER 20
-#define TT_MAC_ID_THAI 21
-#define TT_MAC_ID_LAOTIAN 22
-#define TT_MAC_ID_GEORGIAN 23
-#define TT_MAC_ID_ARMENIAN 24
-#define TT_MAC_ID_MALDIVIAN 25
-#define TT_MAC_ID_SIMPLIFIED_CHINESE 25
-#define TT_MAC_ID_TIBETAN 26
-#define TT_MAC_ID_MONGOLIAN 27
-#define TT_MAC_ID_GEEZ 28
-#define TT_MAC_ID_SLAVIC 29
-#define TT_MAC_ID_VIETNAMESE 30
-#define TT_MAC_ID_SINDHI 31
-#define TT_MAC_ID_UNINTERP 32
-
-
- /***********************************************************************
- *
- * @enum:
- * TT_ISO_ID_XXX
- *
- * @description:
- * A list of valid values for the `encoding_id' for
- * @TT_PLATFORM_ISO charmaps and name entries.
- *
- * Their use is now deprecated.
- *
- * @values:
- * TT_ISO_ID_7BIT_ASCII ::
- * ASCII.
- * TT_ISO_ID_10646 ::
- * ISO/10646.
- * TT_ISO_ID_8859_1 ::
- * Also known as Latin-1.
- */
-
-#define TT_ISO_ID_7BIT_ASCII 0
-#define TT_ISO_ID_10646 1
-#define TT_ISO_ID_8859_1 2
-
-
- /***********************************************************************
- *
- * @enum:
- * TT_MS_ID_XXX
- *
- * @description:
- * A list of valid values for the `encoding_id' for
- * @TT_PLATFORM_MICROSOFT charmaps and name entries.
- *
- * @values:
- * TT_MS_ID_SYMBOL_CS ::
- * Corresponds to Microsoft symbol encoding. See
- * @FT_ENCODING_MS_SYMBOL.
- *
- * TT_MS_ID_UNICODE_CS ::
- * Corresponds to a Microsoft WGL4 charmap, matching Unicode. See
- * @FT_ENCODING_UNICODE.
- *
- * TT_MS_ID_SJIS ::
- * Corresponds to SJIS Japanese encoding. See @FT_ENCODING_SJIS.
- *
- * TT_MS_ID_GB2312 ::
- * Corresponds to Simplified Chinese as used in Mainland China. See
- * @FT_ENCODING_GB2312.
- *
- * TT_MS_ID_BIG_5 ::
- * Corresponds to Traditional Chinese as used in Taiwan and Hong Kong.
- * See @FT_ENCODING_BIG5.
- *
- * TT_MS_ID_WANSUNG ::
- * Corresponds to Korean Wansung encoding. See @FT_ENCODING_WANSUNG.
- *
- * TT_MS_ID_JOHAB ::
- * Corresponds to Johab encoding. See @FT_ENCODING_JOHAB.
- *
- * TT_MS_ID_UCS_4 ::
- * Corresponds to UCS-4 or UTF-32 charmaps. This has been added to
- * the OpenType specification version 1.4 (mid-2001.)
- */
-
-#define TT_MS_ID_SYMBOL_CS 0
-#define TT_MS_ID_UNICODE_CS 1
-#define TT_MS_ID_SJIS 2
-#define TT_MS_ID_GB2312 3
-#define TT_MS_ID_BIG_5 4
-#define TT_MS_ID_WANSUNG 5
-#define TT_MS_ID_JOHAB 6
-#define TT_MS_ID_UCS_4 10
-
-
- /***********************************************************************
- *
- * @enum:
- * TT_ADOBE_ID_XXX
- *
- * @description:
- * A list of valid values for the `encoding_id' for
- * @TT_PLATFORM_ADOBE charmaps. This is a FreeType-specific extension!
- *
- * @values:
- * TT_ADOBE_ID_STANDARD ::
- * Adobe standard encoding.
- * TT_ADOBE_ID_EXPERT ::
- * Adobe expert encoding.
- * TT_ADOBE_ID_CUSTOM ::
- * Adobe custom encoding.
- * TT_ADOBE_ID_LATIN_1 ::
- * Adobe Latin~1 encoding.
- */
-
-#define TT_ADOBE_ID_STANDARD 0
-#define TT_ADOBE_ID_EXPERT 1
-#define TT_ADOBE_ID_CUSTOM 2
-#define TT_ADOBE_ID_LATIN_1 3
-
-
- /*************************************************************************/
- /* */
- /* Possible values of the language identifier field in the name records */
- /* of the TTF `name' table if the `platform' identifier code is */
- /* TT_PLATFORM_MACINTOSH. These values are also used as return values */
- /* for function @FT_Get_CMap_Language_ID. */
- /* */
- /* The canonical source for the Apple assigned Language ID's is at */
- /* */
- /* https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6name.html */
- /* */
-#define TT_MAC_LANGID_ENGLISH 0
-#define TT_MAC_LANGID_FRENCH 1
-#define TT_MAC_LANGID_GERMAN 2
-#define TT_MAC_LANGID_ITALIAN 3
-#define TT_MAC_LANGID_DUTCH 4
-#define TT_MAC_LANGID_SWEDISH 5
-#define TT_MAC_LANGID_SPANISH 6
-#define TT_MAC_LANGID_DANISH 7
-#define TT_MAC_LANGID_PORTUGUESE 8
-#define TT_MAC_LANGID_NORWEGIAN 9
-#define TT_MAC_LANGID_HEBREW 10
-#define TT_MAC_LANGID_JAPANESE 11
-#define TT_MAC_LANGID_ARABIC 12
-#define TT_MAC_LANGID_FINNISH 13
-#define TT_MAC_LANGID_GREEK 14
-#define TT_MAC_LANGID_ICELANDIC 15
-#define TT_MAC_LANGID_MALTESE 16
-#define TT_MAC_LANGID_TURKISH 17
-#define TT_MAC_LANGID_CROATIAN 18
-#define TT_MAC_LANGID_CHINESE_TRADITIONAL 19
-#define TT_MAC_LANGID_URDU 20
-#define TT_MAC_LANGID_HINDI 21
-#define TT_MAC_LANGID_THAI 22
-#define TT_MAC_LANGID_KOREAN 23
-#define TT_MAC_LANGID_LITHUANIAN 24
-#define TT_MAC_LANGID_POLISH 25
-#define TT_MAC_LANGID_HUNGARIAN 26
-#define TT_MAC_LANGID_ESTONIAN 27
-#define TT_MAC_LANGID_LETTISH 28
-#define TT_MAC_LANGID_SAAMISK 29
-#define TT_MAC_LANGID_FAEROESE 30
-#define TT_MAC_LANGID_FARSI 31
-#define TT_MAC_LANGID_RUSSIAN 32
-#define TT_MAC_LANGID_CHINESE_SIMPLIFIED 33
-#define TT_MAC_LANGID_FLEMISH 34
-#define TT_MAC_LANGID_IRISH 35
-#define TT_MAC_LANGID_ALBANIAN 36
-#define TT_MAC_LANGID_ROMANIAN 37
-#define TT_MAC_LANGID_CZECH 38
-#define TT_MAC_LANGID_SLOVAK 39
-#define TT_MAC_LANGID_SLOVENIAN 40
-#define TT_MAC_LANGID_YIDDISH 41
-#define TT_MAC_LANGID_SERBIAN 42
-#define TT_MAC_LANGID_MACEDONIAN 43
-#define TT_MAC_LANGID_BULGARIAN 44
-#define TT_MAC_LANGID_UKRAINIAN 45
-#define TT_MAC_LANGID_BYELORUSSIAN 46
-#define TT_MAC_LANGID_UZBEK 47
-#define TT_MAC_LANGID_KAZAKH 48
-#define TT_MAC_LANGID_AZERBAIJANI 49
-#define TT_MAC_LANGID_AZERBAIJANI_CYRILLIC_SCRIPT 49
-#define TT_MAC_LANGID_AZERBAIJANI_ARABIC_SCRIPT 50
-#define TT_MAC_LANGID_ARMENIAN 51
-#define TT_MAC_LANGID_GEORGIAN 52
-#define TT_MAC_LANGID_MOLDAVIAN 53
-#define TT_MAC_LANGID_KIRGHIZ 54
-#define TT_MAC_LANGID_TAJIKI 55
-#define TT_MAC_LANGID_TURKMEN 56
-#define TT_MAC_LANGID_MONGOLIAN 57
-#define TT_MAC_LANGID_MONGOLIAN_MONGOLIAN_SCRIPT 57
-#define TT_MAC_LANGID_MONGOLIAN_CYRILLIC_SCRIPT 58
-#define TT_MAC_LANGID_PASHTO 59
-#define TT_MAC_LANGID_KURDISH 60
-#define TT_MAC_LANGID_KASHMIRI 61
-#define TT_MAC_LANGID_SINDHI 62
-#define TT_MAC_LANGID_TIBETAN 63
-#define TT_MAC_LANGID_NEPALI 64
-#define TT_MAC_LANGID_SANSKRIT 65
-#define TT_MAC_LANGID_MARATHI 66
-#define TT_MAC_LANGID_BENGALI 67
-#define TT_MAC_LANGID_ASSAMESE 68
-#define TT_MAC_LANGID_GUJARATI 69
-#define TT_MAC_LANGID_PUNJABI 70
-#define TT_MAC_LANGID_ORIYA 71
-#define TT_MAC_LANGID_MALAYALAM 72
-#define TT_MAC_LANGID_KANNADA 73
-#define TT_MAC_LANGID_TAMIL 74
-#define TT_MAC_LANGID_TELUGU 75
-#define TT_MAC_LANGID_SINHALESE 76
-#define TT_MAC_LANGID_BURMESE 77
-#define TT_MAC_LANGID_KHMER 78
-#define TT_MAC_LANGID_LAO 79
-#define TT_MAC_LANGID_VIETNAMESE 80
-#define TT_MAC_LANGID_INDONESIAN 81
-#define TT_MAC_LANGID_TAGALOG 82
-#define TT_MAC_LANGID_MALAY_ROMAN_SCRIPT 83
-#define TT_MAC_LANGID_MALAY_ARABIC_SCRIPT 84
-#define TT_MAC_LANGID_AMHARIC 85
-#define TT_MAC_LANGID_TIGRINYA 86
-#define TT_MAC_LANGID_GALLA 87
-#define TT_MAC_LANGID_SOMALI 88
-#define TT_MAC_LANGID_SWAHILI 89
-#define TT_MAC_LANGID_RUANDA 90
-#define TT_MAC_LANGID_RUNDI 91
-#define TT_MAC_LANGID_CHEWA 92
-#define TT_MAC_LANGID_MALAGASY 93
-#define TT_MAC_LANGID_ESPERANTO 94
-#define TT_MAC_LANGID_WELSH 128
-#define TT_MAC_LANGID_BASQUE 129
-#define TT_MAC_LANGID_CATALAN 130
-#define TT_MAC_LANGID_LATIN 131
-#define TT_MAC_LANGID_QUECHUA 132
-#define TT_MAC_LANGID_GUARANI 133
-#define TT_MAC_LANGID_AYMARA 134
-#define TT_MAC_LANGID_TATAR 135
-#define TT_MAC_LANGID_UIGHUR 136
-#define TT_MAC_LANGID_DZONGKHA 137
-#define TT_MAC_LANGID_JAVANESE 138
-#define TT_MAC_LANGID_SUNDANESE 139
-
-
-#if 0 /* these seem to be errors that have been dropped */
-
-#define TT_MAC_LANGID_SCOTTISH_GAELIC 140
-#define TT_MAC_LANGID_IRISH_GAELIC 141
-
-#endif
-
-
- /* The following codes are new as of 2000-03-10 */
-#define TT_MAC_LANGID_GALICIAN 140
-#define TT_MAC_LANGID_AFRIKAANS 141
-#define TT_MAC_LANGID_BRETON 142
-#define TT_MAC_LANGID_INUKTITUT 143
-#define TT_MAC_LANGID_SCOTTISH_GAELIC 144
-#define TT_MAC_LANGID_MANX_GAELIC 145
-#define TT_MAC_LANGID_IRISH_GAELIC 146
-#define TT_MAC_LANGID_TONGAN 147
-#define TT_MAC_LANGID_GREEK_POLYTONIC 148
-#define TT_MAC_LANGID_GREELANDIC 149
-#define TT_MAC_LANGID_AZERBAIJANI_ROMAN_SCRIPT 150
-
-
- /*************************************************************************/
- /* */
- /* Possible values of the language identifier field in the name records */
- /* of the TTF `name' table if the `platform' identifier code is */
- /* TT_PLATFORM_MICROSOFT. */
- /* */
- /* The canonical source for the MS assigned LCIDs is */
- /* */
- /* http://www.microsoft.com/globaldev/reference/lcid-all.mspx */
- /* */
-
-#define TT_MS_LANGID_ARABIC_GENERAL 0x0001
-#define TT_MS_LANGID_ARABIC_SAUDI_ARABIA 0x0401
-#define TT_MS_LANGID_ARABIC_IRAQ 0x0801
-#define TT_MS_LANGID_ARABIC_EGYPT 0x0C01
-#define TT_MS_LANGID_ARABIC_LIBYA 0x1001
-#define TT_MS_LANGID_ARABIC_ALGERIA 0x1401
-#define TT_MS_LANGID_ARABIC_MOROCCO 0x1801
-#define TT_MS_LANGID_ARABIC_TUNISIA 0x1C01
-#define TT_MS_LANGID_ARABIC_OMAN 0x2001
-#define TT_MS_LANGID_ARABIC_YEMEN 0x2401
-#define TT_MS_LANGID_ARABIC_SYRIA 0x2801
-#define TT_MS_LANGID_ARABIC_JORDAN 0x2C01
-#define TT_MS_LANGID_ARABIC_LEBANON 0x3001
-#define TT_MS_LANGID_ARABIC_KUWAIT 0x3401
-#define TT_MS_LANGID_ARABIC_UAE 0x3801
-#define TT_MS_LANGID_ARABIC_BAHRAIN 0x3C01
-#define TT_MS_LANGID_ARABIC_QATAR 0x4001
-#define TT_MS_LANGID_BULGARIAN_BULGARIA 0x0402
-#define TT_MS_LANGID_CATALAN_SPAIN 0x0403
-#define TT_MS_LANGID_CHINESE_GENERAL 0x0004
-#define TT_MS_LANGID_CHINESE_TAIWAN 0x0404
-#define TT_MS_LANGID_CHINESE_PRC 0x0804
-#define TT_MS_LANGID_CHINESE_HONG_KONG 0x0C04
-#define TT_MS_LANGID_CHINESE_SINGAPORE 0x1004
-
-#if 1 /* this looks like the correct value */
-#define TT_MS_LANGID_CHINESE_MACAU 0x1404
-#else /* but beware, Microsoft may change its mind...
- the most recent Word reference has the following: */
-#define TT_MS_LANGID_CHINESE_MACAU TT_MS_LANGID_CHINESE_HONG_KONG
-#endif
-
-#if 0 /* used only with .NET `cultures'; commented out */
-#define TT_MS_LANGID_CHINESE_TRADITIONAL 0x7C04
-#endif
-
-#define TT_MS_LANGID_CZECH_CZECH_REPUBLIC 0x0405
-#define TT_MS_LANGID_DANISH_DENMARK 0x0406
-#define TT_MS_LANGID_GERMAN_GERMANY 0x0407
-#define TT_MS_LANGID_GERMAN_SWITZERLAND 0x0807
-#define TT_MS_LANGID_GERMAN_AUSTRIA 0x0C07
-#define TT_MS_LANGID_GERMAN_LUXEMBOURG 0x1007
-#define TT_MS_LANGID_GERMAN_LIECHTENSTEI 0x1407
-#define TT_MS_LANGID_GREEK_GREECE 0x0408
-
- /* don't ask what this one means... It is commented out currently. */
-#if 0
-#define TT_MS_LANGID_GREEK_GREECE2 0x2008
-#endif
-
-#define TT_MS_LANGID_ENGLISH_GENERAL 0x0009
-#define TT_MS_LANGID_ENGLISH_UNITED_STATES 0x0409
-#define TT_MS_LANGID_ENGLISH_UNITED_KINGDOM 0x0809
-#define TT_MS_LANGID_ENGLISH_AUSTRALIA 0x0C09
-#define TT_MS_LANGID_ENGLISH_CANADA 0x1009
-#define TT_MS_LANGID_ENGLISH_NEW_ZEALAND 0x1409
-#define TT_MS_LANGID_ENGLISH_IRELAND 0x1809
-#define TT_MS_LANGID_ENGLISH_SOUTH_AFRICA 0x1C09
-#define TT_MS_LANGID_ENGLISH_JAMAICA 0x2009
-#define TT_MS_LANGID_ENGLISH_CARIBBEAN 0x2409
-#define TT_MS_LANGID_ENGLISH_BELIZE 0x2809
-#define TT_MS_LANGID_ENGLISH_TRINIDAD 0x2C09
-#define TT_MS_LANGID_ENGLISH_ZIMBABWE 0x3009
-#define TT_MS_LANGID_ENGLISH_PHILIPPINES 0x3409
-#define TT_MS_LANGID_ENGLISH_INDONESIA 0x3809
-#define TT_MS_LANGID_ENGLISH_HONG_KONG 0x3C09
-#define TT_MS_LANGID_ENGLISH_INDIA 0x4009
-#define TT_MS_LANGID_ENGLISH_MALAYSIA 0x4409
-#define TT_MS_LANGID_ENGLISH_SINGAPORE 0x4809
-#define TT_MS_LANGID_SPANISH_SPAIN_TRADITIONAL_SORT 0x040A
-#define TT_MS_LANGID_SPANISH_MEXICO 0x080A
-#define TT_MS_LANGID_SPANISH_SPAIN_INTERNATIONAL_SORT 0x0C0A
-#define TT_MS_LANGID_SPANISH_GUATEMALA 0x100A
-#define TT_MS_LANGID_SPANISH_COSTA_RICA 0x140A
-#define TT_MS_LANGID_SPANISH_PANAMA 0x180A
-#define TT_MS_LANGID_SPANISH_DOMINICAN_REPUBLIC 0x1C0A
-#define TT_MS_LANGID_SPANISH_VENEZUELA 0x200A
-#define TT_MS_LANGID_SPANISH_COLOMBIA 0x240A
-#define TT_MS_LANGID_SPANISH_PERU 0x280A
-#define TT_MS_LANGID_SPANISH_ARGENTINA 0x2C0A
-#define TT_MS_LANGID_SPANISH_ECUADOR 0x300A
-#define TT_MS_LANGID_SPANISH_CHILE 0x340A
-#define TT_MS_LANGID_SPANISH_URUGUAY 0x380A
-#define TT_MS_LANGID_SPANISH_PARAGUAY 0x3C0A
-#define TT_MS_LANGID_SPANISH_BOLIVIA 0x400A
-#define TT_MS_LANGID_SPANISH_EL_SALVADOR 0x440A
-#define TT_MS_LANGID_SPANISH_HONDURAS 0x480A
-#define TT_MS_LANGID_SPANISH_NICARAGUA 0x4C0A
-#define TT_MS_LANGID_SPANISH_PUERTO_RICO 0x500A
-#define TT_MS_LANGID_SPANISH_UNITED_STATES 0x540A
- /* The following ID blatantly violate MS specs by using a */
- /* sublanguage > 0x1F. */
-#define TT_MS_LANGID_SPANISH_LATIN_AMERICA 0xE40AU
-#define TT_MS_LANGID_FINNISH_FINLAND 0x040B
-#define TT_MS_LANGID_FRENCH_FRANCE 0x040C
-#define TT_MS_LANGID_FRENCH_BELGIUM 0x080C
-#define TT_MS_LANGID_FRENCH_CANADA 0x0C0C
-#define TT_MS_LANGID_FRENCH_SWITZERLAND 0x100C
-#define TT_MS_LANGID_FRENCH_LUXEMBOURG 0x140C
-#define TT_MS_LANGID_FRENCH_MONACO 0x180C
-#define TT_MS_LANGID_FRENCH_WEST_INDIES 0x1C0C
-#define TT_MS_LANGID_FRENCH_REUNION 0x200C
-#define TT_MS_LANGID_FRENCH_CONGO 0x240C
- /* which was formerly: */
-#define TT_MS_LANGID_FRENCH_ZAIRE TT_MS_LANGID_FRENCH_CONGO
-#define TT_MS_LANGID_FRENCH_SENEGAL 0x280C
-#define TT_MS_LANGID_FRENCH_CAMEROON 0x2C0C
-#define TT_MS_LANGID_FRENCH_COTE_D_IVOIRE 0x300C
-#define TT_MS_LANGID_FRENCH_MALI 0x340C
-#define TT_MS_LANGID_FRENCH_MOROCCO 0x380C
-#define TT_MS_LANGID_FRENCH_HAITI 0x3C0C
- /* and another violation of the spec (see 0xE40AU) */
-#define TT_MS_LANGID_FRENCH_NORTH_AFRICA 0xE40CU
-#define TT_MS_LANGID_HEBREW_ISRAEL 0x040D
-#define TT_MS_LANGID_HUNGARIAN_HUNGARY 0x040E
-#define TT_MS_LANGID_ICELANDIC_ICELAND 0x040F
-#define TT_MS_LANGID_ITALIAN_ITALY 0x0410
-#define TT_MS_LANGID_ITALIAN_SWITZERLAND 0x0810
-#define TT_MS_LANGID_JAPANESE_JAPAN 0x0411
-#define TT_MS_LANGID_KOREAN_EXTENDED_WANSUNG_KOREA 0x0412
-#define TT_MS_LANGID_KOREAN_JOHAB_KOREA 0x0812
-#define TT_MS_LANGID_DUTCH_NETHERLANDS 0x0413
-#define TT_MS_LANGID_DUTCH_BELGIUM 0x0813
-#define TT_MS_LANGID_NORWEGIAN_NORWAY_BOKMAL 0x0414
-#define TT_MS_LANGID_NORWEGIAN_NORWAY_NYNORSK 0x0814
-#define TT_MS_LANGID_POLISH_POLAND 0x0415
-#define TT_MS_LANGID_PORTUGUESE_BRAZIL 0x0416
-#define TT_MS_LANGID_PORTUGUESE_PORTUGAL 0x0816
-#define TT_MS_LANGID_RHAETO_ROMANIC_SWITZERLAND 0x0417
-#define TT_MS_LANGID_ROMANIAN_ROMANIA 0x0418
-#define TT_MS_LANGID_MOLDAVIAN_MOLDAVIA 0x0818
-#define TT_MS_LANGID_RUSSIAN_RUSSIA 0x0419
-#define TT_MS_LANGID_RUSSIAN_MOLDAVIA 0x0819
-#define TT_MS_LANGID_CROATIAN_CROATIA 0x041A
-#define TT_MS_LANGID_SERBIAN_SERBIA_LATIN 0x081A
-#define TT_MS_LANGID_SERBIAN_SERBIA_CYRILLIC 0x0C1A
-
-#if 0 /* this used to be this value, but it looks like we were wrong */
-#define TT_MS_LANGID_BOSNIAN_BOSNIA_HERZEGOVINA 0x101A
-#else /* current sources say */
-#define TT_MS_LANGID_CROATIAN_BOSNIA_HERZEGOVINA 0x101A
-#define TT_MS_LANGID_BOSNIAN_BOSNIA_HERZEGOVINA 0x141A
- /* and XPsp2 Platform SDK added (2004-07-26) */
- /* Names are shortened to be significant within 40 chars. */
-#define TT_MS_LANGID_SERBIAN_BOSNIA_HERZ_LATIN 0x181A
-#define TT_MS_LANGID_SERBIAN_BOSNIA_HERZ_CYRILLIC 0x181A
-#endif
-
-#define TT_MS_LANGID_SLOVAK_SLOVAKIA 0x041B
-#define TT_MS_LANGID_ALBANIAN_ALBANIA 0x041C
-#define TT_MS_LANGID_SWEDISH_SWEDEN 0x041D
-#define TT_MS_LANGID_SWEDISH_FINLAND 0x081D
-#define TT_MS_LANGID_THAI_THAILAND 0x041E
-#define TT_MS_LANGID_TURKISH_TURKEY 0x041F
-#define TT_MS_LANGID_URDU_PAKISTAN 0x0420
-#define TT_MS_LANGID_URDU_INDIA 0x0820
-#define TT_MS_LANGID_INDONESIAN_INDONESIA 0x0421
-#define TT_MS_LANGID_UKRAINIAN_UKRAINE 0x0422
-#define TT_MS_LANGID_BELARUSIAN_BELARUS 0x0423
-#define TT_MS_LANGID_SLOVENE_SLOVENIA 0x0424
-#define TT_MS_LANGID_ESTONIAN_ESTONIA 0x0425
-#define TT_MS_LANGID_LATVIAN_LATVIA 0x0426
-#define TT_MS_LANGID_LITHUANIAN_LITHUANIA 0x0427
-#define TT_MS_LANGID_CLASSIC_LITHUANIAN_LITHUANIA 0x0827
-#define TT_MS_LANGID_TAJIK_TAJIKISTAN 0x0428
-#define TT_MS_LANGID_FARSI_IRAN 0x0429
-#define TT_MS_LANGID_VIETNAMESE_VIET_NAM 0x042A
-#define TT_MS_LANGID_ARMENIAN_ARMENIA 0x042B
-#define TT_MS_LANGID_AZERI_AZERBAIJAN_LATIN 0x042C
-#define TT_MS_LANGID_AZERI_AZERBAIJAN_CYRILLIC 0x082C
-#define TT_MS_LANGID_BASQUE_SPAIN 0x042D
-#define TT_MS_LANGID_SORBIAN_GERMANY 0x042E
-#define TT_MS_LANGID_MACEDONIAN_MACEDONIA 0x042F
-#define TT_MS_LANGID_SUTU_SOUTH_AFRICA 0x0430
-#define TT_MS_LANGID_TSONGA_SOUTH_AFRICA 0x0431
-#define TT_MS_LANGID_TSWANA_SOUTH_AFRICA 0x0432
-#define TT_MS_LANGID_VENDA_SOUTH_AFRICA 0x0433
-#define TT_MS_LANGID_XHOSA_SOUTH_AFRICA 0x0434
-#define TT_MS_LANGID_ZULU_SOUTH_AFRICA 0x0435
-#define TT_MS_LANGID_AFRIKAANS_SOUTH_AFRICA 0x0436
-#define TT_MS_LANGID_GEORGIAN_GEORGIA 0x0437
-#define TT_MS_LANGID_FAEROESE_FAEROE_ISLANDS 0x0438
-#define TT_MS_LANGID_HINDI_INDIA 0x0439
-#define TT_MS_LANGID_MALTESE_MALTA 0x043A
- /* Added by XPsp2 Platform SDK (2004-07-26) */
-#define TT_MS_LANGID_SAMI_NORTHERN_NORWAY 0x043B
-#define TT_MS_LANGID_SAMI_NORTHERN_SWEDEN 0x083B
-#define TT_MS_LANGID_SAMI_NORTHERN_FINLAND 0x0C3B
-#define TT_MS_LANGID_SAMI_LULE_NORWAY 0x103B
-#define TT_MS_LANGID_SAMI_LULE_SWEDEN 0x143B
-#define TT_MS_LANGID_SAMI_SOUTHERN_NORWAY 0x183B
-#define TT_MS_LANGID_SAMI_SOUTHERN_SWEDEN 0x1C3B
-#define TT_MS_LANGID_SAMI_SKOLT_FINLAND 0x203B
-#define TT_MS_LANGID_SAMI_INARI_FINLAND 0x243B
- /* ... and we also keep our old identifier... */
-#define TT_MS_LANGID_SAAMI_LAPONIA 0x043B
-
-#if 0 /* this seems to be a previous inversion */
-#define TT_MS_LANGID_IRISH_GAELIC_IRELAND 0x043C
-#define TT_MS_LANGID_SCOTTISH_GAELIC_UNITED_KINGDOM 0x083C
-#else
-#define TT_MS_LANGID_SCOTTISH_GAELIC_UNITED_KINGDOM 0x083C
-#define TT_MS_LANGID_IRISH_GAELIC_IRELAND 0x043C
-#endif
-
-#define TT_MS_LANGID_YIDDISH_GERMANY 0x043D
-#define TT_MS_LANGID_MALAY_MALAYSIA 0x043E
-#define TT_MS_LANGID_MALAY_BRUNEI_DARUSSALAM 0x083E
-#define TT_MS_LANGID_KAZAK_KAZAKSTAN 0x043F
-#define TT_MS_LANGID_KIRGHIZ_KIRGHIZSTAN /* Cyrillic*/ 0x0440
- /* alias declared in Windows 2000 */
-#define TT_MS_LANGID_KIRGHIZ_KIRGHIZ_REPUBLIC \
- TT_MS_LANGID_KIRGHIZ_KIRGHIZSTAN
-
-#define TT_MS_LANGID_SWAHILI_KENYA 0x0441
-#define TT_MS_LANGID_TURKMEN_TURKMENISTAN 0x0442
-#define TT_MS_LANGID_UZBEK_UZBEKISTAN_LATIN 0x0443
-#define TT_MS_LANGID_UZBEK_UZBEKISTAN_CYRILLIC 0x0843
-#define TT_MS_LANGID_TATAR_TATARSTAN 0x0444
-#define TT_MS_LANGID_BENGALI_INDIA 0x0445
-#define TT_MS_LANGID_BENGALI_BANGLADESH 0x0845
-#define TT_MS_LANGID_PUNJABI_INDIA 0x0446
-#define TT_MS_LANGID_PUNJABI_ARABIC_PAKISTAN 0x0846
-#define TT_MS_LANGID_GUJARATI_INDIA 0x0447
-#define TT_MS_LANGID_ORIYA_INDIA 0x0448
-#define TT_MS_LANGID_TAMIL_INDIA 0x0449
-#define TT_MS_LANGID_TELUGU_INDIA 0x044A
-#define TT_MS_LANGID_KANNADA_INDIA 0x044B
-#define TT_MS_LANGID_MALAYALAM_INDIA 0x044C
-#define TT_MS_LANGID_ASSAMESE_INDIA 0x044D
-#define TT_MS_LANGID_MARATHI_INDIA 0x044E
-#define TT_MS_LANGID_SANSKRIT_INDIA 0x044F
-#define TT_MS_LANGID_MONGOLIAN_MONGOLIA /* Cyrillic */ 0x0450
-#define TT_MS_LANGID_MONGOLIAN_MONGOLIA_MONGOLIAN 0x0850
-#define TT_MS_LANGID_TIBETAN_CHINA 0x0451
- /* Don't use the next constant! It has */
- /* (1) the wrong spelling (Dzonghka) */
- /* (2) Microsoft doesn't officially define it -- */
- /* at least it is not in the List of Local */
- /* ID Values. */
- /* (3) Dzongkha is not the same language as */
- /* Tibetan, so merging it is wrong anyway. */
- /* */
- /* TT_MS_LANGID_TIBETAN_BHUTAN is correct, BTW. */
-#define TT_MS_LANGID_DZONGHKA_BHUTAN 0x0851
-
-#if 0
- /* the following used to be defined */
-#define TT_MS_LANGID_TIBETAN_BHUTAN 0x0451
- /* ... but it was changed; */
-#else
- /* So we will continue to #define it, but with the correct value */
-#define TT_MS_LANGID_TIBETAN_BHUTAN TT_MS_LANGID_DZONGHKA_BHUTAN
-#endif
-
-#define TT_MS_LANGID_WELSH_WALES 0x0452
-#define TT_MS_LANGID_KHMER_CAMBODIA 0x0453
-#define TT_MS_LANGID_LAO_LAOS 0x0454
-#define TT_MS_LANGID_BURMESE_MYANMAR 0x0455
-#define TT_MS_LANGID_GALICIAN_SPAIN 0x0456
-#define TT_MS_LANGID_KONKANI_INDIA 0x0457
-#define TT_MS_LANGID_MANIPURI_INDIA /* Bengali */ 0x0458
-#define TT_MS_LANGID_SINDHI_INDIA /* Arabic */ 0x0459
-#define TT_MS_LANGID_SINDHI_PAKISTAN 0x0859
- /* Missing a LCID for Sindhi in Devanagari script */
-#define TT_MS_LANGID_SYRIAC_SYRIA 0x045A
-#define TT_MS_LANGID_SINHALESE_SRI_LANKA 0x045B
-#define TT_MS_LANGID_CHEROKEE_UNITED_STATES 0x045C
-#define TT_MS_LANGID_INUKTITUT_CANADA 0x045D
-#define TT_MS_LANGID_AMHARIC_ETHIOPIA 0x045E
-#define TT_MS_LANGID_TAMAZIGHT_MOROCCO /* Arabic */ 0x045F
-#define TT_MS_LANGID_TAMAZIGHT_MOROCCO_LATIN 0x085F
- /* Missing a LCID for Tifinagh script */
-#define TT_MS_LANGID_KASHMIRI_PAKISTAN /* Arabic */ 0x0460
- /* Spelled this way by XPsp2 Platform SDK (2004-07-26) */
- /* script is yet unclear... might be Arabic, Nagari or Sharada */
-#define TT_MS_LANGID_KASHMIRI_SASIA 0x0860
- /* ... and aliased (by MS) for compatibility reasons. */
-#define TT_MS_LANGID_KASHMIRI_INDIA TT_MS_LANGID_KASHMIRI_SASIA
-#define TT_MS_LANGID_NEPALI_NEPAL 0x0461
-#define TT_MS_LANGID_NEPALI_INDIA 0x0861
-#define TT_MS_LANGID_FRISIAN_NETHERLANDS 0x0462
-#define TT_MS_LANGID_PASHTO_AFGHANISTAN 0x0463
-#define TT_MS_LANGID_FILIPINO_PHILIPPINES 0x0464
-#define TT_MS_LANGID_DHIVEHI_MALDIVES 0x0465
- /* alias declared in Windows 2000 */
-#define TT_MS_LANGID_DIVEHI_MALDIVES TT_MS_LANGID_DHIVEHI_MALDIVES
-#define TT_MS_LANGID_EDO_NIGERIA 0x0466
-#define TT_MS_LANGID_FULFULDE_NIGERIA 0x0467
-#define TT_MS_LANGID_HAUSA_NIGERIA 0x0468
-#define TT_MS_LANGID_IBIBIO_NIGERIA 0x0469
-#define TT_MS_LANGID_YORUBA_NIGERIA 0x046A
-#define TT_MS_LANGID_QUECHUA_BOLIVIA 0x046B
-#define TT_MS_LANGID_QUECHUA_ECUADOR 0x086B
-#define TT_MS_LANGID_QUECHUA_PERU 0x0C6B
-#define TT_MS_LANGID_SEPEDI_SOUTH_AFRICA 0x046C
- /* Also spelled by XPsp2 Platform SDK (2004-07-26) */
-#define TT_MS_LANGID_SOTHO_SOUTHERN_SOUTH_AFRICA \
- TT_MS_LANGID_SEPEDI_SOUTH_AFRICA
- /* language codes 0x046D, 0x046E and 0x046F are (still) unknown. */
-#define TT_MS_LANGID_IGBO_NIGERIA 0x0470
-#define TT_MS_LANGID_KANURI_NIGERIA 0x0471
-#define TT_MS_LANGID_OROMO_ETHIOPIA 0x0472
-#define TT_MS_LANGID_TIGRIGNA_ETHIOPIA 0x0473
-#define TT_MS_LANGID_TIGRIGNA_ERYTHREA 0x0873
- /* also spelled in the `Passport SDK' list as: */
-#define TT_MS_LANGID_TIGRIGNA_ERYTREA TT_MS_LANGID_TIGRIGNA_ERYTHREA
-#define TT_MS_LANGID_GUARANI_PARAGUAY 0x0474
-#define TT_MS_LANGID_HAWAIIAN_UNITED_STATES 0x0475
-#define TT_MS_LANGID_LATIN 0x0476
-#define TT_MS_LANGID_SOMALI_SOMALIA 0x0477
- /* Note: Yi does not have a (proper) ISO 639-2 code, since it is mostly */
- /* not written (but OTOH the peculiar writing system is worth */
- /* studying). */
-#define TT_MS_LANGID_YI_CHINA 0x0478
-#define TT_MS_LANGID_PAPIAMENTU_NETHERLANDS_ANTILLES 0x0479
- /* language codes from 0x047A to 0x047F are (still) unknown. */
-#define TT_MS_LANGID_UIGHUR_CHINA 0x0480
-#define TT_MS_LANGID_MAORI_NEW_ZEALAND 0x0481
-
-#if 0 /* not deemed useful for fonts */
-#define TT_MS_LANGID_HUMAN_INTERFACE_DEVICE 0x04FF
-#endif
-
-
- /*************************************************************************/
- /* */
- /* Possible values of the `name' identifier field in the name records of */
- /* the TTF `name' table. These values are platform independent. */
- /* */
-#define TT_NAME_ID_COPYRIGHT 0
-#define TT_NAME_ID_FONT_FAMILY 1
-#define TT_NAME_ID_FONT_SUBFAMILY 2
-#define TT_NAME_ID_UNIQUE_ID 3
-#define TT_NAME_ID_FULL_NAME 4
-#define TT_NAME_ID_VERSION_STRING 5
-#define TT_NAME_ID_PS_NAME 6
-#define TT_NAME_ID_TRADEMARK 7
-
- /* the following values are from the OpenType spec */
-#define TT_NAME_ID_MANUFACTURER 8
-#define TT_NAME_ID_DESIGNER 9
-#define TT_NAME_ID_DESCRIPTION 10
-#define TT_NAME_ID_VENDOR_URL 11
-#define TT_NAME_ID_DESIGNER_URL 12
-#define TT_NAME_ID_LICENSE 13
-#define TT_NAME_ID_LICENSE_URL 14
- /* number 15 is reserved */
-#define TT_NAME_ID_PREFERRED_FAMILY 16
-#define TT_NAME_ID_PREFERRED_SUBFAMILY 17
-#define TT_NAME_ID_MAC_FULL_NAME 18
-
- /* The following code is new as of 2000-01-21 */
-#define TT_NAME_ID_SAMPLE_TEXT 19
-
- /* This is new in OpenType 1.3 */
-#define TT_NAME_ID_CID_FINDFONT_NAME 20
-
- /* This is new in OpenType 1.5 */
-#define TT_NAME_ID_WWS_FAMILY 21
-#define TT_NAME_ID_WWS_SUBFAMILY 22
-
-
- /*************************************************************************/
- /* */
- /* Bit mask values for the Unicode Ranges from the TTF `OS2 ' table. */
- /* */
- /* Updated 08-Nov-2008. */
- /* */
-
- /* Bit 0 Basic Latin */
-#define TT_UCR_BASIC_LATIN (1L << 0) /* U+0020-U+007E */
- /* Bit 1 C1 Controls and Latin-1 Supplement */
-#define TT_UCR_LATIN1_SUPPLEMENT (1L << 1) /* U+0080-U+00FF */
- /* Bit 2 Latin Extended-A */
-#define TT_UCR_LATIN_EXTENDED_A (1L << 2) /* U+0100-U+017F */
- /* Bit 3 Latin Extended-B */
-#define TT_UCR_LATIN_EXTENDED_B (1L << 3) /* U+0180-U+024F */
- /* Bit 4 IPA Extensions */
- /* Phonetic Extensions */
- /* Phonetic Extensions Supplement */
-#define TT_UCR_IPA_EXTENSIONS (1L << 4) /* U+0250-U+02AF */
- /* U+1D00-U+1D7F */
- /* U+1D80-U+1DBF */
- /* Bit 5 Spacing Modifier Letters */
- /* Modifier Tone Letters */
-#define TT_UCR_SPACING_MODIFIER (1L << 5) /* U+02B0-U+02FF */
- /* U+A700-U+A71F */
- /* Bit 6 Combining Diacritical Marks */
- /* Combining Diacritical Marks Supplement */
-#define TT_UCR_COMBINING_DIACRITICS (1L << 6) /* U+0300-U+036F */
- /* U+1DC0-U+1DFF */
- /* Bit 7 Greek and Coptic */
-#define TT_UCR_GREEK (1L << 7) /* U+0370-U+03FF */
- /* Bit 8 Coptic */
-#define TT_UCR_COPTIC (1L << 8) /* U+2C80-U+2CFF */
- /* Bit 9 Cyrillic */
- /* Cyrillic Supplement */
- /* Cyrillic Extended-A */
- /* Cyrillic Extended-B */
-#define TT_UCR_CYRILLIC (1L << 9) /* U+0400-U+04FF */
- /* U+0500-U+052F */
- /* U+2DE0-U+2DFF */
- /* U+A640-U+A69F */
- /* Bit 10 Armenian */
-#define TT_UCR_ARMENIAN (1L << 10) /* U+0530-U+058F */
- /* Bit 11 Hebrew */
-#define TT_UCR_HEBREW (1L << 11) /* U+0590-U+05FF */
- /* Bit 12 Vai */
-#define TT_UCR_VAI (1L << 12) /* U+A500-U+A63F */
- /* Bit 13 Arabic */
- /* Arabic Supplement */
-#define TT_UCR_ARABIC (1L << 13) /* U+0600-U+06FF */
- /* U+0750-U+077F */
- /* Bit 14 NKo */
-#define TT_UCR_NKO (1L << 14) /* U+07C0-U+07FF */
- /* Bit 15 Devanagari */
-#define TT_UCR_DEVANAGARI (1L << 15) /* U+0900-U+097F */
- /* Bit 16 Bengali */
-#define TT_UCR_BENGALI (1L << 16) /* U+0980-U+09FF */
- /* Bit 17 Gurmukhi */
-#define TT_UCR_GURMUKHI (1L << 17) /* U+0A00-U+0A7F */
- /* Bit 18 Gujarati */
-#define TT_UCR_GUJARATI (1L << 18) /* U+0A80-U+0AFF */
- /* Bit 19 Oriya */
-#define TT_UCR_ORIYA (1L << 19) /* U+0B00-U+0B7F */
- /* Bit 20 Tamil */
-#define TT_UCR_TAMIL (1L << 20) /* U+0B80-U+0BFF */
- /* Bit 21 Telugu */
-#define TT_UCR_TELUGU (1L << 21) /* U+0C00-U+0C7F */
- /* Bit 22 Kannada */
-#define TT_UCR_KANNADA (1L << 22) /* U+0C80-U+0CFF */
- /* Bit 23 Malayalam */
-#define TT_UCR_MALAYALAM (1L << 23) /* U+0D00-U+0D7F */
- /* Bit 24 Thai */
-#define TT_UCR_THAI (1L << 24) /* U+0E00-U+0E7F */
- /* Bit 25 Lao */
-#define TT_UCR_LAO (1L << 25) /* U+0E80-U+0EFF */
- /* Bit 26 Georgian */
- /* Georgian Supplement */
-#define TT_UCR_GEORGIAN (1L << 26) /* U+10A0-U+10FF */
- /* U+2D00-U+2D2F */
- /* Bit 27 Balinese */
-#define TT_UCR_BALINESE (1L << 27) /* U+1B00-U+1B7F */
- /* Bit 28 Hangul Jamo */
-#define TT_UCR_HANGUL_JAMO (1L << 28) /* U+1100-U+11FF */
- /* Bit 29 Latin Extended Additional */
- /* Latin Extended-C */
- /* Latin Extended-D */
-#define TT_UCR_LATIN_EXTENDED_ADDITIONAL (1L << 29) /* U+1E00-U+1EFF */
- /* U+2C60-U+2C7F */
- /* U+A720-U+A7FF */
- /* Bit 30 Greek Extended */
-#define TT_UCR_GREEK_EXTENDED (1L << 30) /* U+1F00-U+1FFF */
- /* Bit 31 General Punctuation */
- /* Supplemental Punctuation */
-#define TT_UCR_GENERAL_PUNCTUATION (1L << 31) /* U+2000-U+206F */
- /* U+2E00-U+2E7F */
- /* Bit 32 Superscripts And Subscripts */
-#define TT_UCR_SUPERSCRIPTS_SUBSCRIPTS (1L << 0) /* U+2070-U+209F */
- /* Bit 33 Currency Symbols */
-#define TT_UCR_CURRENCY_SYMBOLS (1L << 1) /* U+20A0-U+20CF */
- /* Bit 34 Combining Diacritical Marks For Symbols */
-#define TT_UCR_COMBINING_DIACRITICS_SYMB (1L << 2) /* U+20D0-U+20FF */
- /* Bit 35 Letterlike Symbols */
-#define TT_UCR_LETTERLIKE_SYMBOLS (1L << 3) /* U+2100-U+214F */
- /* Bit 36 Number Forms */
-#define TT_UCR_NUMBER_FORMS (1L << 4) /* U+2150-U+218F */
- /* Bit 37 Arrows */
- /* Supplemental Arrows-A */
- /* Supplemental Arrows-B */
- /* Miscellaneous Symbols and Arrows */
-#define TT_UCR_ARROWS (1L << 5) /* U+2190-U+21FF */
- /* U+27F0-U+27FF */
- /* U+2900-U+297F */
- /* U+2B00-U+2BFF */
- /* Bit 38 Mathematical Operators */
- /* Supplemental Mathematical Operators */
- /* Miscellaneous Mathematical Symbols-A */
- /* Miscellaneous Mathematical Symbols-B */
-#define TT_UCR_MATHEMATICAL_OPERATORS (1L << 6) /* U+2200-U+22FF */
- /* U+2A00-U+2AFF */
- /* U+27C0-U+27EF */
- /* U+2980-U+29FF */
- /* Bit 39 Miscellaneous Technical */
-#define TT_UCR_MISCELLANEOUS_TECHNICAL (1L << 7) /* U+2300-U+23FF */
- /* Bit 40 Control Pictures */
-#define TT_UCR_CONTROL_PICTURES (1L << 8) /* U+2400-U+243F */
- /* Bit 41 Optical Character Recognition */
-#define TT_UCR_OCR (1L << 9) /* U+2440-U+245F */
- /* Bit 42 Enclosed Alphanumerics */
-#define TT_UCR_ENCLOSED_ALPHANUMERICS (1L << 10) /* U+2460-U+24FF */
- /* Bit 43 Box Drawing */
-#define TT_UCR_BOX_DRAWING (1L << 11) /* U+2500-U+257F */
- /* Bit 44 Block Elements */
-#define TT_UCR_BLOCK_ELEMENTS (1L << 12) /* U+2580-U+259F */
- /* Bit 45 Geometric Shapes */
-#define TT_UCR_GEOMETRIC_SHAPES (1L << 13) /* U+25A0-U+25FF */
- /* Bit 46 Miscellaneous Symbols */
-#define TT_UCR_MISCELLANEOUS_SYMBOLS (1L << 14) /* U+2600-U+26FF */
- /* Bit 47 Dingbats */
-#define TT_UCR_DINGBATS (1L << 15) /* U+2700-U+27BF */
- /* Bit 48 CJK Symbols and Punctuation */
-#define TT_UCR_CJK_SYMBOLS (1L << 16) /* U+3000-U+303F */
- /* Bit 49 Hiragana */
-#define TT_UCR_HIRAGANA (1L << 17) /* U+3040-U+309F */
- /* Bit 50 Katakana */
- /* Katakana Phonetic Extensions */
-#define TT_UCR_KATAKANA (1L << 18) /* U+30A0-U+30FF */
- /* U+31F0-U+31FF */
- /* Bit 51 Bopomofo */
- /* Bopomofo Extended */
-#define TT_UCR_BOPOMOFO (1L << 19) /* U+3100-U+312F */
- /* U+31A0-U+31BF */
- /* Bit 52 Hangul Compatibility Jamo */
-#define TT_UCR_HANGUL_COMPATIBILITY_JAMO (1L << 20) /* U+3130-U+318F */
- /* Bit 53 Phags-Pa */
-#define TT_UCR_CJK_MISC (1L << 21) /* U+A840-U+A87F */
-#define TT_UCR_KANBUN TT_UCR_CJK_MISC /* deprecated */
-#define TT_UCR_PHAGSPA
- /* Bit 54 Enclosed CJK Letters and Months */
-#define TT_UCR_ENCLOSED_CJK_LETTERS_MONTHS (1L << 22) /* U+3200-U+32FF */
- /* Bit 55 CJK Compatibility */
-#define TT_UCR_CJK_COMPATIBILITY (1L << 23) /* U+3300-U+33FF */
- /* Bit 56 Hangul Syllables */
-#define TT_UCR_HANGUL (1L << 24) /* U+AC00-U+D7A3 */
- /* Bit 57 High Surrogates */
- /* High Private Use Surrogates */
- /* Low Surrogates */
- /* */
- /* According to OpenType specs v.1.3+, */
- /* setting bit 57 implies that there is */
- /* at least one codepoint beyond the */
- /* Basic Multilingual Plane that is */
- /* supported by this font. So it really */
- /* means >= U+10000 */
-#define TT_UCR_SURROGATES (1L << 25) /* U+D800-U+DB7F */
- /* U+DB80-U+DBFF */
- /* U+DC00-U+DFFF */
-#define TT_UCR_NON_PLANE_0 TT_UCR_SURROGATES
- /* Bit 58 Phoenician */
-#define TT_UCR_PHOENICIAN (1L << 26) /*U+10900-U+1091F*/
- /* Bit 59 CJK Unified Ideographs */
- /* CJK Radicals Supplement */
- /* Kangxi Radicals */
- /* Ideographic Description Characters */
- /* CJK Unified Ideographs Extension A */
- /* CJK Unified Ideographs Extension B */
- /* Kanbun */
-#define TT_UCR_CJK_UNIFIED_IDEOGRAPHS (1L << 27) /* U+4E00-U+9FFF */
- /* U+2E80-U+2EFF */
- /* U+2F00-U+2FDF */
- /* U+2FF0-U+2FFF */
- /* U+3400-U+4DB5 */
- /*U+20000-U+2A6DF*/
- /* U+3190-U+319F */
- /* Bit 60 Private Use */
-#define TT_UCR_PRIVATE_USE (1L << 28) /* U+E000-U+F8FF */
- /* Bit 61 CJK Strokes */
- /* CJK Compatibility Ideographs */
- /* CJK Compatibility Ideographs Supplement */
-#define TT_UCR_CJK_COMPATIBILITY_IDEOGRAPHS (1L << 29) /* U+31C0-U+31EF */
- /* U+F900-U+FAFF */
- /*U+2F800-U+2FA1F*/
- /* Bit 62 Alphabetic Presentation Forms */
-#define TT_UCR_ALPHABETIC_PRESENTATION_FORMS (1L << 30) /* U+FB00-U+FB4F */
- /* Bit 63 Arabic Presentation Forms-A */
-#define TT_UCR_ARABIC_PRESENTATIONS_A (1L << 31) /* U+FB50-U+FDFF */
- /* Bit 64 Combining Half Marks */
-#define TT_UCR_COMBINING_HALF_MARKS (1L << 0) /* U+FE20-U+FE2F */
- /* Bit 65 Vertical forms */
- /* CJK Compatibility Forms */
-#define TT_UCR_CJK_COMPATIBILITY_FORMS (1L << 1) /* U+FE10-U+FE1F */
- /* U+FE30-U+FE4F */
- /* Bit 66 Small Form Variants */
-#define TT_UCR_SMALL_FORM_VARIANTS (1L << 2) /* U+FE50-U+FE6F */
- /* Bit 67 Arabic Presentation Forms-B */
-#define TT_UCR_ARABIC_PRESENTATIONS_B (1L << 3) /* U+FE70-U+FEFE */
- /* Bit 68 Halfwidth and Fullwidth Forms */
-#define TT_UCR_HALFWIDTH_FULLWIDTH_FORMS (1L << 4) /* U+FF00-U+FFEF */
- /* Bit 69 Specials */
-#define TT_UCR_SPECIALS (1L << 5) /* U+FFF0-U+FFFD */
- /* Bit 70 Tibetan */
-#define TT_UCR_TIBETAN (1L << 6) /* U+0F00-U+0FFF */
- /* Bit 71 Syriac */
-#define TT_UCR_SYRIAC (1L << 7) /* U+0700-U+074F */
- /* Bit 72 Thaana */
-#define TT_UCR_THAANA (1L << 8) /* U+0780-U+07BF */
- /* Bit 73 Sinhala */
-#define TT_UCR_SINHALA (1L << 9) /* U+0D80-U+0DFF */
- /* Bit 74 Myanmar */
-#define TT_UCR_MYANMAR (1L << 10) /* U+1000-U+109F */
- /* Bit 75 Ethiopic */
- /* Ethiopic Supplement */
- /* Ethiopic Extended */
-#define TT_UCR_ETHIOPIC (1L << 11) /* U+1200-U+137F */
- /* U+1380-U+139F */
- /* U+2D80-U+2DDF */
- /* Bit 76 Cherokee */
-#define TT_UCR_CHEROKEE (1L << 12) /* U+13A0-U+13FF */
- /* Bit 77 Unified Canadian Aboriginal Syllabics */
-#define TT_UCR_CANADIAN_ABORIGINAL_SYLLABICS (1L << 13) /* U+1400-U+167F */
- /* Bit 78 Ogham */
-#define TT_UCR_OGHAM (1L << 14) /* U+1680-U+169F */
- /* Bit 79 Runic */
-#define TT_UCR_RUNIC (1L << 15) /* U+16A0-U+16FF */
- /* Bit 80 Khmer */
- /* Khmer Symbols */
-#define TT_UCR_KHMER (1L << 16) /* U+1780-U+17FF */
- /* U+19E0-U+19FF */
- /* Bit 81 Mongolian */
-#define TT_UCR_MONGOLIAN (1L << 17) /* U+1800-U+18AF */
- /* Bit 82 Braille Patterns */
-#define TT_UCR_BRAILLE (1L << 18) /* U+2800-U+28FF */
- /* Bit 83 Yi Syllables */
- /* Yi Radicals */
-#define TT_UCR_YI (1L << 19) /* U+A000-U+A48F */
- /* U+A490-U+A4CF */
- /* Bit 84 Tagalog */
- /* Hanunoo */
- /* Buhid */
- /* Tagbanwa */
-#define TT_UCR_PHILIPPINE (1L << 20) /* U+1700-U+171F */
- /* U+1720-U+173F */
- /* U+1740-U+175F */
- /* U+1760-U+177F */
- /* Bit 85 Old Italic */
-#define TT_UCR_OLD_ITALIC (1L << 21) /*U+10300-U+1032F*/
- /* Bit 86 Gothic */
-#define TT_UCR_GOTHIC (1L << 22) /*U+10330-U+1034F*/
- /* Bit 87 Deseret */
-#define TT_UCR_DESERET (1L << 23) /*U+10400-U+1044F*/
- /* Bit 88 Byzantine Musical Symbols */
- /* Musical Symbols */
- /* Ancient Greek Musical Notation */
-#define TT_UCR_MUSICAL_SYMBOLS (1L << 24) /*U+1D000-U+1D0FF*/
- /*U+1D100-U+1D1FF*/
- /*U+1D200-U+1D24F*/
- /* Bit 89 Mathematical Alphanumeric Symbols */
-#define TT_UCR_MATH_ALPHANUMERIC_SYMBOLS (1L << 25) /*U+1D400-U+1D7FF*/
- /* Bit 90 Private Use (plane 15) */
- /* Private Use (plane 16) */
-#define TT_UCR_PRIVATE_USE_SUPPLEMENTARY (1L << 26) /*U+F0000-U+FFFFD*/
- /*U+100000-U+10FFFD*/
- /* Bit 91 Variation Selectors */
- /* Variation Selectors Supplement */
-#define TT_UCR_VARIATION_SELECTORS (1L << 27) /* U+FE00-U+FE0F */
- /*U+E0100-U+E01EF*/
- /* Bit 92 Tags */
-#define TT_UCR_TAGS (1L << 28) /*U+E0000-U+E007F*/
- /* Bit 93 Limbu */
-#define TT_UCR_LIMBU (1L << 29) /* U+1900-U+194F */
- /* Bit 94 Tai Le */
-#define TT_UCR_TAI_LE (1L << 30) /* U+1950-U+197F */
- /* Bit 95 New Tai Lue */
-#define TT_UCR_NEW_TAI_LUE (1L << 31) /* U+1980-U+19DF */
- /* Bit 96 Buginese */
-#define TT_UCR_BUGINESE (1L << 0) /* U+1A00-U+1A1F */
- /* Bit 97 Glagolitic */
-#define TT_UCR_GLAGOLITIC (1L << 1) /* U+2C00-U+2C5F */
- /* Bit 98 Tifinagh */
-#define TT_UCR_TIFINAGH (1L << 2) /* U+2D30-U+2D7F */
- /* Bit 99 Yijing Hexagram Symbols */
-#define TT_UCR_YIJING (1L << 3) /* U+4DC0-U+4DFF */
- /* Bit 100 Syloti Nagri */
-#define TT_UCR_SYLOTI_NAGRI (1L << 4) /* U+A800-U+A82F */
- /* Bit 101 Linear B Syllabary */
- /* Linear B Ideograms */
- /* Aegean Numbers */
-#define TT_UCR_LINEAR_B (1L << 5) /*U+10000-U+1007F*/
- /*U+10080-U+100FF*/
- /*U+10100-U+1013F*/
- /* Bit 102 Ancient Greek Numbers */
-#define TT_UCR_ANCIENT_GREEK_NUMBERS (1L << 6) /*U+10140-U+1018F*/
- /* Bit 103 Ugaritic */
-#define TT_UCR_UGARITIC (1L << 7) /*U+10380-U+1039F*/
- /* Bit 104 Old Persian */
-#define TT_UCR_OLD_PERSIAN (1L << 8) /*U+103A0-U+103DF*/
- /* Bit 105 Shavian */
-#define TT_UCR_SHAVIAN (1L << 9) /*U+10450-U+1047F*/
- /* Bit 106 Osmanya */
-#define TT_UCR_OSMANYA (1L << 10) /*U+10480-U+104AF*/
- /* Bit 107 Cypriot Syllabary */
-#define TT_UCR_CYPRIOT_SYLLABARY (1L << 11) /*U+10800-U+1083F*/
- /* Bit 108 Kharoshthi */
-#define TT_UCR_KHAROSHTHI (1L << 12) /*U+10A00-U+10A5F*/
- /* Bit 109 Tai Xuan Jing Symbols */
-#define TT_UCR_TAI_XUAN_JING (1L << 13) /*U+1D300-U+1D35F*/
- /* Bit 110 Cuneiform */
- /* Cuneiform Numbers and Punctuation */
-#define TT_UCR_CUNEIFORM (1L << 14) /*U+12000-U+123FF*/
- /*U+12400-U+1247F*/
- /* Bit 111 Counting Rod Numerals */
-#define TT_UCR_COUNTING_ROD_NUMERALS (1L << 15) /*U+1D360-U+1D37F*/
- /* Bit 112 Sundanese */
-#define TT_UCR_SUNDANESE (1L << 16) /* U+1B80-U+1BBF */
- /* Bit 113 Lepcha */
-#define TT_UCR_LEPCHA (1L << 17) /* U+1C00-U+1C4F */
- /* Bit 114 Ol Chiki */
-#define TT_UCR_OL_CHIKI (1L << 18) /* U+1C50-U+1C7F */
- /* Bit 115 Saurashtra */
-#define TT_UCR_SAURASHTRA (1L << 19) /* U+A880-U+A8DF */
- /* Bit 116 Kayah Li */
-#define TT_UCR_KAYAH_LI (1L << 20) /* U+A900-U+A92F */
- /* Bit 117 Rejang */
-#define TT_UCR_REJANG (1L << 21) /* U+A930-U+A95F */
- /* Bit 118 Cham */
-#define TT_UCR_CHAM (1L << 22) /* U+AA00-U+AA5F */
- /* Bit 119 Ancient Symbols */
-#define TT_UCR_ANCIENT_SYMBOLS (1L << 23) /*U+10190-U+101CF*/
- /* Bit 120 Phaistos Disc */
-#define TT_UCR_PHAISTOS_DISC (1L << 24) /*U+101D0-U+101FF*/
- /* Bit 121 Carian */
- /* Lycian */
- /* Lydian */
-#define TT_UCR_OLD_ANATOLIAN (1L << 25) /*U+102A0-U+102DF*/
- /*U+10280-U+1029F*/
- /*U+10920-U+1093F*/
- /* Bit 122 Domino Tiles */
- /* Mahjong Tiles */
-#define TT_UCR_GAME_TILES (1L << 26) /*U+1F030-U+1F09F*/
- /*U+1F000-U+1F02F*/
- /* Bit 123-127 Reserved for process-internal usage */
-
-
- /*************************************************************************/
- /* */
- /* Some compilers have a very limited length of identifiers. */
- /* */
-#if defined( __TURBOC__ ) && __TURBOC__ < 0x0410 || defined( __PACIFIC__ )
-#define HAVE_LIMIT_ON_IDENTS
-#endif
-
-
-#ifndef HAVE_LIMIT_ON_IDENTS
-
-
- /*************************************************************************/
- /* */
- /* Here some alias #defines in order to be clearer. */
- /* */
- /* These are not always #defined to stay within the 31~character limit, */
- /* which some compilers have. */
- /* */
- /* Credits go to Dave Hoo <dhoo@flash.net> for pointing out that modern */
- /* Borland compilers (read: from BC++ 3.1 on) can increase this limit. */
- /* If you get a warning with such a compiler, use the -i40 switch. */
- /* */
-#define TT_UCR_ARABIC_PRESENTATION_FORMS_A \
- TT_UCR_ARABIC_PRESENTATIONS_A
-#define TT_UCR_ARABIC_PRESENTATION_FORMS_B \
- TT_UCR_ARABIC_PRESENTATIONS_B
-
-#define TT_UCR_COMBINING_DIACRITICAL_MARKS \
- TT_UCR_COMBINING_DIACRITICS
-#define TT_UCR_COMBINING_DIACRITICAL_MARKS_SYMB \
- TT_UCR_COMBINING_DIACRITICS_SYMB
-
-
-#endif /* !HAVE_LIMIT_ON_IDENTS */
-
-
-FT_END_HEADER
-
-#endif /* __TTNAMEID_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/tttables.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/tttables.h
deleted file mode 100644
index 1568f403647..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/tttables.h
+++ /dev/null
@@ -1,829 +0,0 @@
-/***************************************************************************/
-/* */
-/* tttables.h */
-/* */
-/* Basic SFNT/TrueType tables definitions and interface */
-/* (specification only). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __TTTABLES_H__
-#define __TTTABLES_H__
-
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-
-#ifdef FREETYPE_H
-#error "freetype.h of FreeType 1 has been loaded!"
-#error "Please fix the directory search order for header files"
-#error "so that freetype.h of FreeType 2 is found first."
-#endif
-
-
-FT_BEGIN_HEADER
-
- /*************************************************************************/
- /* */
- /* <Section> */
- /* truetype_tables */
- /* */
- /* <Title> */
- /* TrueType Tables */
- /* */
- /* <Abstract> */
- /* TrueType specific table types and functions. */
- /* */
- /* <Description> */
- /* This section contains the definition of TrueType-specific tables */
- /* as well as some routines used to access and process them. */
- /* */
- /* <Order> */
- /* TT_Header */
- /* TT_HoriHeader */
- /* TT_VertHeader */
- /* TT_OS2 */
- /* TT_Postscript */
- /* TT_PCLT */
- /* TT_MaxProfile */
- /* */
- /* FT_Sfnt_Tag */
- /* FT_Get_Sfnt_Table */
- /* FT_Load_Sfnt_Table */
- /* FT_Sfnt_Table_Info */
- /* */
- /* FT_Get_CMap_Language_ID */
- /* FT_Get_CMap_Format */
- /* */
- /* FT_PARAM_TAG_UNPATENTED_HINTING */
- /* */
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* TT_Header */
- /* */
- /* <Description> */
- /* A structure used to model a TrueType font header table. All */
- /* fields follow the TrueType specification. */
- /* */
- typedef struct TT_Header_
- {
- FT_Fixed Table_Version;
- FT_Fixed Font_Revision;
-
- FT_Long CheckSum_Adjust;
- FT_Long Magic_Number;
-
- FT_UShort Flags;
- FT_UShort Units_Per_EM;
-
- FT_Long Created [2];
- FT_Long Modified[2];
-
- FT_Short xMin;
- FT_Short yMin;
- FT_Short xMax;
- FT_Short yMax;
-
- FT_UShort Mac_Style;
- FT_UShort Lowest_Rec_PPEM;
-
- FT_Short Font_Direction;
- FT_Short Index_To_Loc_Format;
- FT_Short Glyph_Data_Format;
-
- } TT_Header;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* TT_HoriHeader */
- /* */
- /* <Description> */
- /* A structure used to model a TrueType horizontal header, the `hhea' */
- /* table, as well as the corresponding horizontal metrics table, */
- /* i.e., the `hmtx' table. */
- /* */
- /* <Fields> */
- /* Version :: The table version. */
- /* */
- /* Ascender :: The font's ascender, i.e., the distance */
- /* from the baseline to the top-most of all */
- /* glyph points found in the font. */
- /* */
- /* This value is invalid in many fonts, as */
- /* it is usually set by the font designer, */
- /* and often reflects only a portion of the */
- /* glyphs found in the font (maybe ASCII). */
- /* */
- /* You should use the `sTypoAscender' field */
- /* of the OS/2 table instead if you want */
- /* the correct one. */
- /* */
- /* Descender :: The font's descender, i.e., the distance */
- /* from the baseline to the bottom-most of */
- /* all glyph points found in the font. It */
- /* is negative. */
- /* */
- /* This value is invalid in many fonts, as */
- /* it is usually set by the font designer, */
- /* and often reflects only a portion of the */
- /* glyphs found in the font (maybe ASCII). */
- /* */
- /* You should use the `sTypoDescender' */
- /* field of the OS/2 table instead if you */
- /* want the correct one. */
- /* */
- /* Line_Gap :: The font's line gap, i.e., the distance */
- /* to add to the ascender and descender to */
- /* get the BTB, i.e., the */
- /* baseline-to-baseline distance for the */
- /* font. */
- /* */
- /* advance_Width_Max :: This field is the maximum of all advance */
- /* widths found in the font. It can be */
- /* used to compute the maximum width of an */
- /* arbitrary string of text. */
- /* */
- /* min_Left_Side_Bearing :: The minimum left side bearing of all */
- /* glyphs within the font. */
- /* */
- /* min_Right_Side_Bearing :: The minimum right side bearing of all */
- /* glyphs within the font. */
- /* */
- /* xMax_Extent :: The maximum horizontal extent (i.e., the */
- /* `width' of a glyph's bounding box) for */
- /* all glyphs in the font. */
- /* */
- /* caret_Slope_Rise :: The rise coefficient of the cursor's */
- /* slope of the cursor (slope=rise/run). */
- /* */
- /* caret_Slope_Run :: The run coefficient of the cursor's */
- /* slope. */
- /* */
- /* Reserved :: 8~reserved bytes. */
- /* */
- /* metric_Data_Format :: Always~0. */
- /* */
- /* number_Of_HMetrics :: Number of HMetrics entries in the `hmtx' */
- /* table -- this value can be smaller than */
- /* the total number of glyphs in the font. */
- /* */
- /* long_metrics :: A pointer into the `hmtx' table. */
- /* */
- /* short_metrics :: A pointer into the `hmtx' table. */
- /* */
- /* <Note> */
- /* IMPORTANT: The TT_HoriHeader and TT_VertHeader structures should */
- /* be identical except for the names of their fields, */
- /* which are different. */
- /* */
- /* This ensures that a single function in the `ttload' */
- /* module is able to read both the horizontal and vertical */
- /* headers. */
- /* */
- typedef struct TT_HoriHeader_
- {
- FT_Fixed Version;
- FT_Short Ascender;
- FT_Short Descender;
- FT_Short Line_Gap;
-
- FT_UShort advance_Width_Max; /* advance width maximum */
-
- FT_Short min_Left_Side_Bearing; /* minimum left-sb */
- FT_Short min_Right_Side_Bearing; /* minimum right-sb */
- FT_Short xMax_Extent; /* xmax extents */
- FT_Short caret_Slope_Rise;
- FT_Short caret_Slope_Run;
- FT_Short caret_Offset;
-
- FT_Short Reserved[4];
-
- FT_Short metric_Data_Format;
- FT_UShort number_Of_HMetrics;
-
- /* The following fields are not defined by the TrueType specification */
- /* but they are used to connect the metrics header to the relevant */
- /* `HMTX' table. */
-
- void* long_metrics;
- void* short_metrics;
-
- } TT_HoriHeader;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* TT_VertHeader */
- /* */
- /* <Description> */
- /* A structure used to model a TrueType vertical header, the `vhea' */
- /* table, as well as the corresponding vertical metrics table, i.e., */
- /* the `vmtx' table. */
- /* */
- /* <Fields> */
- /* Version :: The table version. */
- /* */
- /* Ascender :: The font's ascender, i.e., the distance */
- /* from the baseline to the top-most of */
- /* all glyph points found in the font. */
- /* */
- /* This value is invalid in many fonts, as */
- /* it is usually set by the font designer, */
- /* and often reflects only a portion of */
- /* the glyphs found in the font (maybe */
- /* ASCII). */
- /* */
- /* You should use the `sTypoAscender' */
- /* field of the OS/2 table instead if you */
- /* want the correct one. */
- /* */
- /* Descender :: The font's descender, i.e., the */
- /* distance from the baseline to the */
- /* bottom-most of all glyph points found */
- /* in the font. It is negative. */
- /* */
- /* This value is invalid in many fonts, as */
- /* it is usually set by the font designer, */
- /* and often reflects only a portion of */
- /* the glyphs found in the font (maybe */
- /* ASCII). */
- /* */
- /* You should use the `sTypoDescender' */
- /* field of the OS/2 table instead if you */
- /* want the correct one. */
- /* */
- /* Line_Gap :: The font's line gap, i.e., the distance */
- /* to add to the ascender and descender to */
- /* get the BTB, i.e., the */
- /* baseline-to-baseline distance for the */
- /* font. */
- /* */
- /* advance_Height_Max :: This field is the maximum of all */
- /* advance heights found in the font. It */
- /* can be used to compute the maximum */
- /* height of an arbitrary string of text. */
- /* */
- /* min_Top_Side_Bearing :: The minimum top side bearing of all */
- /* glyphs within the font. */
- /* */
- /* min_Bottom_Side_Bearing :: The minimum bottom side bearing of all */
- /* glyphs within the font. */
- /* */
- /* yMax_Extent :: The maximum vertical extent (i.e., the */
- /* `height' of a glyph's bounding box) for */
- /* all glyphs in the font. */
- /* */
- /* caret_Slope_Rise :: The rise coefficient of the cursor's */
- /* slope of the cursor (slope=rise/run). */
- /* */
- /* caret_Slope_Run :: The run coefficient of the cursor's */
- /* slope. */
- /* */
- /* caret_Offset :: The cursor's offset for slanted fonts. */
- /* This value is `reserved' in vmtx */
- /* version 1.0. */
- /* */
- /* Reserved :: 8~reserved bytes. */
- /* */
- /* metric_Data_Format :: Always~0. */
- /* */
- /* number_Of_HMetrics :: Number of VMetrics entries in the */
- /* `vmtx' table -- this value can be */
- /* smaller than the total number of glyphs */
- /* in the font. */
- /* */
- /* long_metrics :: A pointer into the `vmtx' table. */
- /* */
- /* short_metrics :: A pointer into the `vmtx' table. */
- /* */
- /* <Note> */
- /* IMPORTANT: The TT_HoriHeader and TT_VertHeader structures should */
- /* be identical except for the names of their fields, */
- /* which are different. */
- /* */
- /* This ensures that a single function in the `ttload' */
- /* module is able to read both the horizontal and vertical */
- /* headers. */
- /* */
- typedef struct TT_VertHeader_
- {
- FT_Fixed Version;
- FT_Short Ascender;
- FT_Short Descender;
- FT_Short Line_Gap;
-
- FT_UShort advance_Height_Max; /* advance height maximum */
-
- FT_Short min_Top_Side_Bearing; /* minimum left-sb or top-sb */
- FT_Short min_Bottom_Side_Bearing; /* minimum right-sb or bottom-sb */
- FT_Short yMax_Extent; /* xmax or ymax extents */
- FT_Short caret_Slope_Rise;
- FT_Short caret_Slope_Run;
- FT_Short caret_Offset;
-
- FT_Short Reserved[4];
-
- FT_Short metric_Data_Format;
- FT_UShort number_Of_VMetrics;
-
- /* The following fields are not defined by the TrueType specification */
- /* but they're used to connect the metrics header to the relevant */
- /* `HMTX' or `VMTX' table. */
-
- void* long_metrics;
- void* short_metrics;
-
- } TT_VertHeader;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* TT_OS2 */
- /* */
- /* <Description> */
- /* A structure used to model a TrueType OS/2 table. All fields */
- /* comply to the OpenType specification. */
- /* */
- /* Note that we now support old Mac fonts that do not include an OS/2 */
- /* table. In this case, the `version' field is always set to 0xFFFF. */
- /* */
- typedef struct TT_OS2_
- {
- FT_UShort version; /* 0x0001 - more or 0xFFFF */
- FT_Short xAvgCharWidth;
- FT_UShort usWeightClass;
- FT_UShort usWidthClass;
- FT_UShort fsType;
- FT_Short ySubscriptXSize;
- FT_Short ySubscriptYSize;
- FT_Short ySubscriptXOffset;
- FT_Short ySubscriptYOffset;
- FT_Short ySuperscriptXSize;
- FT_Short ySuperscriptYSize;
- FT_Short ySuperscriptXOffset;
- FT_Short ySuperscriptYOffset;
- FT_Short yStrikeoutSize;
- FT_Short yStrikeoutPosition;
- FT_Short sFamilyClass;
-
- FT_Byte panose[10];
-
- FT_ULong ulUnicodeRange1; /* Bits 0-31 */
- FT_ULong ulUnicodeRange2; /* Bits 32-63 */
- FT_ULong ulUnicodeRange3; /* Bits 64-95 */
- FT_ULong ulUnicodeRange4; /* Bits 96-127 */
-
- FT_Char achVendID[4];
-
- FT_UShort fsSelection;
- FT_UShort usFirstCharIndex;
- FT_UShort usLastCharIndex;
- FT_Short sTypoAscender;
- FT_Short sTypoDescender;
- FT_Short sTypoLineGap;
- FT_UShort usWinAscent;
- FT_UShort usWinDescent;
-
- /* only version 1 and higher: */
-
- FT_ULong ulCodePageRange1; /* Bits 0-31 */
- FT_ULong ulCodePageRange2; /* Bits 32-63 */
-
- /* only version 2 and higher: */
-
- FT_Short sxHeight;
- FT_Short sCapHeight;
- FT_UShort usDefaultChar;
- FT_UShort usBreakChar;
- FT_UShort usMaxContext;
-
- /* only version 5 and higher: */
-
- FT_UShort usLowerOpticalPointSize; /* in twips (1/20th points) */
- FT_UShort usUpperOpticalPointSize; /* in twips (1/20th points) */
-
- } TT_OS2;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* TT_Postscript */
- /* */
- /* <Description> */
- /* A structure used to model a TrueType PostScript table. All fields */
- /* comply to the TrueType specification. This structure does not */
- /* reference the PostScript glyph names, which can be nevertheless */
- /* accessed with the `ttpost' module. */
- /* */
- typedef struct TT_Postscript_
- {
- FT_Fixed FormatType;
- FT_Fixed italicAngle;
- FT_Short underlinePosition;
- FT_Short underlineThickness;
- FT_ULong isFixedPitch;
- FT_ULong minMemType42;
- FT_ULong maxMemType42;
- FT_ULong minMemType1;
- FT_ULong maxMemType1;
-
- /* Glyph names follow in the file, but we don't */
- /* load them by default. See the ttpost.c file. */
-
- } TT_Postscript;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* TT_PCLT */
- /* */
- /* <Description> */
- /* A structure used to model a TrueType PCLT table. All fields */
- /* comply to the TrueType specification. */
- /* */
- typedef struct TT_PCLT_
- {
- FT_Fixed Version;
- FT_ULong FontNumber;
- FT_UShort Pitch;
- FT_UShort xHeight;
- FT_UShort Style;
- FT_UShort TypeFamily;
- FT_UShort CapHeight;
- FT_UShort SymbolSet;
- FT_Char TypeFace[16];
- FT_Char CharacterComplement[8];
- FT_Char FileName[6];
- FT_Char StrokeWeight;
- FT_Char WidthType;
- FT_Byte SerifStyle;
- FT_Byte Reserved;
-
- } TT_PCLT;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* TT_MaxProfile */
- /* */
- /* <Description> */
- /* The maximum profile is a table containing many max values, which */
- /* can be used to pre-allocate arrays. This ensures that no memory */
- /* allocation occurs during a glyph load. */
- /* */
- /* <Fields> */
- /* version :: The version number. */
- /* */
- /* numGlyphs :: The number of glyphs in this TrueType */
- /* font. */
- /* */
- /* maxPoints :: The maximum number of points in a */
- /* non-composite TrueType glyph. See also */
- /* the structure element */
- /* `maxCompositePoints'. */
- /* */
- /* maxContours :: The maximum number of contours in a */
- /* non-composite TrueType glyph. See also */
- /* the structure element */
- /* `maxCompositeContours'. */
- /* */
- /* maxCompositePoints :: The maximum number of points in a */
- /* composite TrueType glyph. See also the */
- /* structure element `maxPoints'. */
- /* */
- /* maxCompositeContours :: The maximum number of contours in a */
- /* composite TrueType glyph. See also the */
- /* structure element `maxContours'. */
- /* */
- /* maxZones :: The maximum number of zones used for */
- /* glyph hinting. */
- /* */
- /* maxTwilightPoints :: The maximum number of points in the */
- /* twilight zone used for glyph hinting. */
- /* */
- /* maxStorage :: The maximum number of elements in the */
- /* storage area used for glyph hinting. */
- /* */
- /* maxFunctionDefs :: The maximum number of function */
- /* definitions in the TrueType bytecode for */
- /* this font. */
- /* */
- /* maxInstructionDefs :: The maximum number of instruction */
- /* definitions in the TrueType bytecode for */
- /* this font. */
- /* */
- /* maxStackElements :: The maximum number of stack elements used */
- /* during bytecode interpretation. */
- /* */
- /* maxSizeOfInstructions :: The maximum number of TrueType opcodes */
- /* used for glyph hinting. */
- /* */
- /* maxComponentElements :: The maximum number of simple (i.e., non- */
- /* composite) glyphs in a composite glyph. */
- /* */
- /* maxComponentDepth :: The maximum nesting depth of composite */
- /* glyphs. */
- /* */
- /* <Note> */
- /* This structure is only used during font loading. */
- /* */
- typedef struct TT_MaxProfile_
- {
- FT_Fixed version;
- FT_UShort numGlyphs;
- FT_UShort maxPoints;
- FT_UShort maxContours;
- FT_UShort maxCompositePoints;
- FT_UShort maxCompositeContours;
- FT_UShort maxZones;
- FT_UShort maxTwilightPoints;
- FT_UShort maxStorage;
- FT_UShort maxFunctionDefs;
- FT_UShort maxInstructionDefs;
- FT_UShort maxStackElements;
- FT_UShort maxSizeOfInstructions;
- FT_UShort maxComponentElements;
- FT_UShort maxComponentDepth;
-
- } TT_MaxProfile;
-
-
- /*************************************************************************/
- /* */
- /* <Enum> */
- /* FT_Sfnt_Tag */
- /* */
- /* <Description> */
- /* An enumeration used to specify the index of an SFNT table. */
- /* Used in the @FT_Get_Sfnt_Table API function. */
- /* */
- /* <Values> */
- /* FT_SFNT_HEAD :: To access the font's @TT_Header structure. */
- /* */
- /* FT_SFNT_MAXP :: To access the font's @TT_MaxProfile structure. */
- /* */
- /* FT_SFNT_OS2 :: To access the font's @TT_OS2 structure. */
- /* */
- /* FT_SFNT_HHEA :: To access the font's @TT_HoriHeader structure. */
- /* */
- /* FT_SFNT_VHEA :: To access the font's @TT_VertHeader struture. */
- /* */
- /* FT_SFNT_POST :: To access the font's @TT_Postscript structure. */
- /* */
- /* FT_SFNT_PCLT :: To access the font's @TT_PCLT structure. */
- /* */
- typedef enum FT_Sfnt_Tag_
- {
- FT_SFNT_HEAD,
- FT_SFNT_MAXP,
- FT_SFNT_OS2,
- FT_SFNT_HHEA,
- FT_SFNT_VHEA,
- FT_SFNT_POST,
- FT_SFNT_PCLT,
-
- FT_SFNT_MAX
-
- } FT_Sfnt_Tag;
-
- /* these constants are deprecated; use the corresponding `FT_Sfnt_Tag' */
- /* values instead */
-#define ft_sfnt_head FT_SFNT_HEAD
-#define ft_sfnt_maxp FT_SFNT_MAXP
-#define ft_sfnt_os2 FT_SFNT_OS2
-#define ft_sfnt_hhea FT_SFNT_HHEA
-#define ft_sfnt_vhea FT_SFNT_VHEA
-#define ft_sfnt_post FT_SFNT_POST
-#define ft_sfnt_pclt FT_SFNT_PCLT
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Get_Sfnt_Table */
- /* */
- /* <Description> */
- /* Return a pointer to a given SFNT table within a face. */
- /* */
- /* <Input> */
- /* face :: A handle to the source. */
- /* */
- /* tag :: The index of the SFNT table. */
- /* */
- /* <Return> */
- /* A type-less pointer to the table. This will be~0 in case of */
- /* error, or if the corresponding table was not found *OR* loaded */
- /* from the file. */
- /* */
- /* Use a typecast according to `tag' to access the structure */
- /* elements. */
- /* */
- /* <Note> */
- /* The table is owned by the face object and disappears with it. */
- /* */
- /* This function is only useful to access SFNT tables that are loaded */
- /* by the sfnt, truetype, and opentype drivers. See @FT_Sfnt_Tag for */
- /* a list. */
- /* */
- /* Here an example how to access the `vhea' table: */
- /* */
- /* { */
- /* TT_VertHeader* vert_header; */
- /* */
- /* */
- /* vert_header = */
- /* (TT_VertHeader*)FT_Get_Sfnt_Table( face, FT_SFNT_VHEA ); */
- /* } */
- /* */
- FT_EXPORT( void* )
- FT_Get_Sfnt_Table( FT_Face face,
- FT_Sfnt_Tag tag );
-
-
- /**************************************************************************
- *
- * @function:
- * FT_Load_Sfnt_Table
- *
- * @description:
- * Load any font table into client memory.
- *
- * @input:
- * face ::
- * A handle to the source face.
- *
- * tag ::
- * The four-byte tag of the table to load. Use the value~0 if you want
- * to access the whole font file. Otherwise, you can use one of the
- * definitions found in the @FT_TRUETYPE_TAGS_H file, or forge a new
- * one with @FT_MAKE_TAG.
- *
- * offset ::
- * The starting offset in the table (or file if tag == 0).
- *
- * @output:
- * buffer ::
- * The target buffer address. The client must ensure that the memory
- * array is big enough to hold the data.
- *
- * @inout:
- * length ::
- * If the `length' parameter is NULL, then try to load the whole table.
- * Return an error code if it fails.
- *
- * Else, if `*length' is~0, exit immediately while returning the
- * table's (or file) full size in it.
- *
- * Else the number of bytes to read from the table or file, from the
- * starting offset.
- *
- * @return:
- * FreeType error code. 0~means success.
- *
- * @note:
- * If you need to determine the table's length you should first call this
- * function with `*length' set to~0, as in the following example:
- *
- * {
- * FT_ULong length = 0;
- *
- *
- * error = FT_Load_Sfnt_Table( face, tag, 0, NULL, &length );
- * if ( error ) { ... table does not exist ... }
- *
- * buffer = malloc( length );
- * if ( buffer == NULL ) { ... not enough memory ... }
- *
- * error = FT_Load_Sfnt_Table( face, tag, 0, buffer, &length );
- * if ( error ) { ... could not load table ... }
- * }
- *
- * Note that structures like @TT_Header or @TT_OS2 can't be used with
- * this function; they are limited to @FT_Get_Sfnt_Table. Reason is that
- * those structures depend on the processor architecture, with varying
- * size (e.g. 32bit vs. 64bit) or order (big endian vs. little endian).
- *
- */
- FT_EXPORT( FT_Error )
- FT_Load_Sfnt_Table( FT_Face face,
- FT_ULong tag,
- FT_Long offset,
- FT_Byte* buffer,
- FT_ULong* length );
-
-
- /**************************************************************************
- *
- * @function:
- * FT_Sfnt_Table_Info
- *
- * @description:
- * Return information on an SFNT table.
- *
- * @input:
- * face ::
- * A handle to the source face.
- *
- * table_index ::
- * The index of an SFNT table. The function returns
- * FT_Err_Table_Missing for an invalid value.
- *
- * @inout:
- * tag ::
- * The name tag of the SFNT table. If the value is NULL, `table_index'
- * is ignored, and `length' returns the number of SFNT tables in the
- * font.
- *
- * @output:
- * length ::
- * The length of the SFNT table (or the number of SFNT tables, depending
- * on `tag').
- *
- * @return:
- * FreeType error code. 0~means success.
- *
- * @note:
- * While parsing fonts, FreeType handles SFNT tables with length zero as
- * missing.
- *
- */
- FT_EXPORT( FT_Error )
- FT_Sfnt_Table_Info( FT_Face face,
- FT_UInt table_index,
- FT_ULong *tag,
- FT_ULong *length );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Get_CMap_Language_ID */
- /* */
- /* <Description> */
- /* Return TrueType/sfnt specific cmap language ID. Definitions of */
- /* language ID values are in `ttnameid.h'. */
- /* */
- /* <Input> */
- /* charmap :: */
- /* The target charmap. */
- /* */
- /* <Return> */
- /* The language ID of `charmap'. If `charmap' doesn't belong to a */
- /* TrueType/sfnt face, just return~0 as the default value. */
- /* */
- /* For a format~14 cmap (to access Unicode IVS), the return value is */
- /* 0xFFFFFFFF. */
- /* */
- FT_EXPORT( FT_ULong )
- FT_Get_CMap_Language_ID( FT_CharMap charmap );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Get_CMap_Format */
- /* */
- /* <Description> */
- /* Return TrueType/sfnt specific cmap format. */
- /* */
- /* <Input> */
- /* charmap :: */
- /* The target charmap. */
- /* */
- /* <Return> */
- /* The format of `charmap'. If `charmap' doesn't belong to a */
- /* TrueType/sfnt face, return -1. */
- /* */
- FT_EXPORT( FT_Long )
- FT_Get_CMap_Format( FT_CharMap charmap );
-
- /* */
-
-
-FT_END_HEADER
-
-#endif /* __TTTABLES_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/tttags.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/tttags.h
deleted file mode 100644
index 3836c7bbfd5..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/tttags.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/***************************************************************************/
-/* */
-/* tttags.h */
-/* */
-/* Tags for TrueType and OpenType tables (specification only). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __TTAGS_H__
-#define __TTAGS_H__
-
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-
-#ifdef FREETYPE_H
-#error "freetype.h of FreeType 1 has been loaded!"
-#error "Please fix the directory search order for header files"
-#error "so that freetype.h of FreeType 2 is found first."
-#endif
-
-
-FT_BEGIN_HEADER
-
-
-#define TTAG_avar FT_MAKE_TAG( 'a', 'v', 'a', 'r' )
-#define TTAG_BASE FT_MAKE_TAG( 'B', 'A', 'S', 'E' )
-#define TTAG_bdat FT_MAKE_TAG( 'b', 'd', 'a', 't' )
-#define TTAG_BDF FT_MAKE_TAG( 'B', 'D', 'F', ' ' )
-#define TTAG_bhed FT_MAKE_TAG( 'b', 'h', 'e', 'd' )
-#define TTAG_bloc FT_MAKE_TAG( 'b', 'l', 'o', 'c' )
-#define TTAG_bsln FT_MAKE_TAG( 'b', 's', 'l', 'n' )
-#define TTAG_CBDT FT_MAKE_TAG( 'C', 'B', 'D', 'T' )
-#define TTAG_CBLC FT_MAKE_TAG( 'C', 'B', 'L', 'C' )
-#define TTAG_CFF FT_MAKE_TAG( 'C', 'F', 'F', ' ' )
-#define TTAG_CID FT_MAKE_TAG( 'C', 'I', 'D', ' ' )
-#define TTAG_cmap FT_MAKE_TAG( 'c', 'm', 'a', 'p' )
-#define TTAG_cvar FT_MAKE_TAG( 'c', 'v', 'a', 'r' )
-#define TTAG_cvt FT_MAKE_TAG( 'c', 'v', 't', ' ' )
-#define TTAG_DSIG FT_MAKE_TAG( 'D', 'S', 'I', 'G' )
-#define TTAG_EBDT FT_MAKE_TAG( 'E', 'B', 'D', 'T' )
-#define TTAG_EBLC FT_MAKE_TAG( 'E', 'B', 'L', 'C' )
-#define TTAG_EBSC FT_MAKE_TAG( 'E', 'B', 'S', 'C' )
-#define TTAG_feat FT_MAKE_TAG( 'f', 'e', 'a', 't' )
-#define TTAG_FOND FT_MAKE_TAG( 'F', 'O', 'N', 'D' )
-#define TTAG_fpgm FT_MAKE_TAG( 'f', 'p', 'g', 'm' )
-#define TTAG_fvar FT_MAKE_TAG( 'f', 'v', 'a', 'r' )
-#define TTAG_gasp FT_MAKE_TAG( 'g', 'a', 's', 'p' )
-#define TTAG_GDEF FT_MAKE_TAG( 'G', 'D', 'E', 'F' )
-#define TTAG_glyf FT_MAKE_TAG( 'g', 'l', 'y', 'f' )
-#define TTAG_GPOS FT_MAKE_TAG( 'G', 'P', 'O', 'S' )
-#define TTAG_GSUB FT_MAKE_TAG( 'G', 'S', 'U', 'B' )
-#define TTAG_gvar FT_MAKE_TAG( 'g', 'v', 'a', 'r' )
-#define TTAG_hdmx FT_MAKE_TAG( 'h', 'd', 'm', 'x' )
-#define TTAG_head FT_MAKE_TAG( 'h', 'e', 'a', 'd' )
-#define TTAG_hhea FT_MAKE_TAG( 'h', 'h', 'e', 'a' )
-#define TTAG_hmtx FT_MAKE_TAG( 'h', 'm', 't', 'x' )
-#define TTAG_JSTF FT_MAKE_TAG( 'J', 'S', 'T', 'F' )
-#define TTAG_just FT_MAKE_TAG( 'j', 'u', 's', 't' )
-#define TTAG_kern FT_MAKE_TAG( 'k', 'e', 'r', 'n' )
-#define TTAG_lcar FT_MAKE_TAG( 'l', 'c', 'a', 'r' )
-#define TTAG_loca FT_MAKE_TAG( 'l', 'o', 'c', 'a' )
-#define TTAG_LTSH FT_MAKE_TAG( 'L', 'T', 'S', 'H' )
-#define TTAG_LWFN FT_MAKE_TAG( 'L', 'W', 'F', 'N' )
-#define TTAG_MATH FT_MAKE_TAG( 'M', 'A', 'T', 'H' )
-#define TTAG_maxp FT_MAKE_TAG( 'm', 'a', 'x', 'p' )
-#define TTAG_META FT_MAKE_TAG( 'M', 'E', 'T', 'A' )
-#define TTAG_MMFX FT_MAKE_TAG( 'M', 'M', 'F', 'X' )
-#define TTAG_MMSD FT_MAKE_TAG( 'M', 'M', 'S', 'D' )
-#define TTAG_mort FT_MAKE_TAG( 'm', 'o', 'r', 't' )
-#define TTAG_morx FT_MAKE_TAG( 'm', 'o', 'r', 'x' )
-#define TTAG_name FT_MAKE_TAG( 'n', 'a', 'm', 'e' )
-#define TTAG_opbd FT_MAKE_TAG( 'o', 'p', 'b', 'd' )
-#define TTAG_OS2 FT_MAKE_TAG( 'O', 'S', '/', '2' )
-#define TTAG_OTTO FT_MAKE_TAG( 'O', 'T', 'T', 'O' )
-#define TTAG_PCLT FT_MAKE_TAG( 'P', 'C', 'L', 'T' )
-#define TTAG_POST FT_MAKE_TAG( 'P', 'O', 'S', 'T' )
-#define TTAG_post FT_MAKE_TAG( 'p', 'o', 's', 't' )
-#define TTAG_prep FT_MAKE_TAG( 'p', 'r', 'e', 'p' )
-#define TTAG_prop FT_MAKE_TAG( 'p', 'r', 'o', 'p' )
-#define TTAG_sbix FT_MAKE_TAG( 's', 'b', 'i', 'x' )
-#define TTAG_sfnt FT_MAKE_TAG( 's', 'f', 'n', 't' )
-#define TTAG_SING FT_MAKE_TAG( 'S', 'I', 'N', 'G' )
-#define TTAG_trak FT_MAKE_TAG( 't', 'r', 'a', 'k' )
-#define TTAG_true FT_MAKE_TAG( 't', 'r', 'u', 'e' )
-#define TTAG_ttc FT_MAKE_TAG( 't', 't', 'c', ' ' )
-#define TTAG_ttcf FT_MAKE_TAG( 't', 't', 'c', 'f' )
-#define TTAG_TYP1 FT_MAKE_TAG( 'T', 'Y', 'P', '1' )
-#define TTAG_typ1 FT_MAKE_TAG( 't', 'y', 'p', '1' )
-#define TTAG_VDMX FT_MAKE_TAG( 'V', 'D', 'M', 'X' )
-#define TTAG_vhea FT_MAKE_TAG( 'v', 'h', 'e', 'a' )
-#define TTAG_vmtx FT_MAKE_TAG( 'v', 'm', 't', 'x' )
-#define TTAG_wOFF FT_MAKE_TAG( 'w', 'O', 'F', 'F' )
-
-
-FT_END_HEADER
-
-#endif /* __TTAGS_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ttunpat.h b/chromium/third_party/pdfium/third_party/freetype/include/freetype/ttunpat.h
deleted file mode 100644
index 8ea556895c1..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/freetype/ttunpat.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/***************************************************************************/
-/* */
-/* ttunpat.h */
-/* */
-/* Definitions for the unpatented TrueType hinting system */
-/* */
-/* Copyright 2003-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* Written by Graham Asher <graham.asher@btinternet.com> */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __TTUNPAT_H__
-#define __TTUNPAT_H__
-
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-
-#ifdef FREETYPE_H
-#error "freetype.h of FreeType 1 has been loaded!"
-#error "Please fix the directory search order for header files"
-#error "so that freetype.h of FreeType 2 is found first."
-#endif
-
-
-FT_BEGIN_HEADER
-
-
- /***************************************************************************
- *
- * @constant:
- * FT_PARAM_TAG_UNPATENTED_HINTING
- *
- * @description:
- * A constant used as the tag of an @FT_Parameter structure to indicate
- * that unpatented methods only should be used by the TrueType bytecode
- * interpreter for a typeface opened by @FT_Open_Face.
- *
- */
-#define FT_PARAM_TAG_UNPATENTED_HINTING FT_MAKE_TAG( 'u', 'n', 'p', 'a' )
-
- /* */
-
-
-FT_END_HEADER
-
-
-#endif /* __TTUNPAT_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/include/ft2build.h b/chromium/third_party/pdfium/third_party/freetype/include/ft2build.h
deleted file mode 100644
index 419b80ae44d..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/include/ft2build.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/***************************************************************************/
-/* */
-/* ft2build.h */
-/* */
-/* FreeType 2 build and setup macros. */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* This is the `entry point' for FreeType header file inclusions. It is */
- /* the only header file which should be included directly; all other */
- /* FreeType header files should be accessed with macro names (after */
- /* including `ft2build.h'). */
- /* */
- /* A typical example is */
- /* */
- /* #include <ft2build.h> */
- /* #include FT_FREETYPE_H */
- /* */
- /*************************************************************************/
-
-
-#ifndef __FT2BUILD_H__
-#define __FT2BUILD_H__
-
-#include <freetype/config/ftheader.h>
-
-#endif /* __FT2BUILD_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/base/Jamfile b/chromium/third_party/pdfium/third_party/freetype/src/base/Jamfile
deleted file mode 100644
index e39fb096b24..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/base/Jamfile
+++ /dev/null
@@ -1,87 +0,0 @@
-# FreeType 2 src/base Jamfile
-#
-# Copyright 2001-2015 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT. By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-SubDir FT2_TOP $(FT2_SRC_DIR) base ;
-
-
-{
- local _sources ;
-
- if $(FT2_MULTI)
- {
- _sources = basepic
- ftadvanc
- ftcalc
- ftdbgmem
- ftgloadr
- ftobjs
- ftoutln
- ftpic
- ftrfork
- ftsnames
- ftstream
- fttrigon
- ftutil
- ;
- }
- else
- {
- _sources = ftbase ;
- }
-
- Library $(FT2_LIB) : $(_sources).c ;
-}
-
-# Add the optional/replaceable files.
-#
-{
- local _sources = ftapi
- ftbbox
- ftbdf
- ftbitmap
- ftcid
- ftdebug
- ftfntfmt
- ftfstype
- ftgasp
- ftglyph
- ftgxval
- ftinit
- ftlcdfil
- ftmm
- ftotval
- ftpatent
- ftpfr
- ftstroke
- ftsynth
- ftsystem
- fttype1
- ftwinfnt
- ;
-
- Library $(FT2_LIB) : $(_sources).c ;
-}
-
-# Add Macintosh-specific file to the library when necessary.
-#
-if $(MAC)
-{
- Library $(FT2_LIB) : ftmac.c ;
-}
-else if $(OS) = MACOSX
-{
- if $(FT2_MULTI)
- {
- Library $(FT2_LIB) : ftmac.c ;
- }
-}
-
-# end of src/base Jamfile
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/base/basepic.c b/chromium/third_party/pdfium/third_party/freetype/src/base/basepic.c
deleted file mode 100644
index 9850ed96a42..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/base/basepic.c
+++ /dev/null
@@ -1,108 +0,0 @@
-/***************************************************************************/
-/* */
-/* basepic.c */
-/* */
-/* The FreeType position independent code services for base. */
-/* */
-/* Copyright 2009-2015 by */
-/* Oran Agra and Mickey Gabel. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_INTERNAL_OBJECTS_H
-#include "basepic.h"
-
-
-#ifdef FT_CONFIG_OPTION_PIC
-
- /* forward declaration of PIC init functions from ftglyph.c */
- void
- FT_Init_Class_ft_outline_glyph_class( FT_Glyph_Class* clazz );
-
- void
- FT_Init_Class_ft_bitmap_glyph_class( FT_Glyph_Class* clazz );
-
-#ifdef FT_CONFIG_OPTION_MAC_FONTS
- /* forward declaration of PIC init function from ftrfork.c */
- /* (not modularized) */
- void
- FT_Init_Table_ft_raccess_guess_table( ft_raccess_guess_rec* record );
-#endif
-
- /* forward declaration of PIC init functions from ftinit.c */
- FT_Error
- ft_create_default_module_classes( FT_Library library );
-
- void
- ft_destroy_default_module_classes( FT_Library library );
-
-
- void
- ft_base_pic_free( FT_Library library )
- {
- FT_PIC_Container* pic_container = &library->pic_container;
- FT_Memory memory = library->memory;
-
-
- if ( pic_container->base )
- {
- /* destroy default module classes */
- /* (in case FT_Add_Default_Modules was used) */
- ft_destroy_default_module_classes( library );
-
- FT_FREE( pic_container->base );
- pic_container->base = NULL;
- }
- }
-
-
- FT_Error
- ft_base_pic_init( FT_Library library )
- {
- FT_PIC_Container* pic_container = &library->pic_container;
- FT_Error error = FT_Err_Ok;
- BasePIC* container = NULL;
- FT_Memory memory = library->memory;
-
-
- /* allocate pointer, clear and set global container pointer */
- if ( FT_ALLOC( container, sizeof ( *container ) ) )
- return error;
- FT_MEM_SET( container, 0, sizeof ( *container ) );
- pic_container->base = container;
-
- /* initialize default modules list and pointers */
- error = ft_create_default_module_classes( library );
- if ( error )
- goto Exit;
-
- /* initialize pointer table - */
- /* this is how the module usually expects this data */
- FT_Init_Class_ft_outline_glyph_class(
- &container->ft_outline_glyph_class );
- FT_Init_Class_ft_bitmap_glyph_class(
- &container->ft_bitmap_glyph_class );
-#ifdef FT_CONFIG_OPTION_MAC_FONTS
- FT_Init_Table_ft_raccess_guess_table(
- (ft_raccess_guess_rec*)&container->ft_raccess_guess_table );
-#endif
-
- Exit:
- if ( error )
- ft_base_pic_free( library );
- return error;
- }
-
-#endif /* FT_CONFIG_OPTION_PIC */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/base/basepic.h b/chromium/third_party/pdfium/third_party/freetype/src/base/basepic.h
deleted file mode 100644
index c5d7cbf5ab7..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/base/basepic.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/***************************************************************************/
-/* */
-/* basepic.h */
-/* */
-/* The FreeType position independent code services for base. */
-/* */
-/* Copyright 2009-2015 by */
-/* Oran Agra and Mickey Gabel. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __BASEPIC_H__
-#define __BASEPIC_H__
-
-
-#include FT_INTERNAL_PIC_H
-
-
-#ifndef FT_CONFIG_OPTION_PIC
-
-#define FT_OUTLINE_GLYPH_CLASS_GET &ft_outline_glyph_class
-#define FT_BITMAP_GLYPH_CLASS_GET &ft_bitmap_glyph_class
-#define FT_DEFAULT_MODULES_GET ft_default_modules
-
-#ifdef FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK
-#define FT_RACCESS_GUESS_TABLE_GET ft_raccess_guess_table
-#endif
-
-#else /* FT_CONFIG_OPTION_PIC */
-
-#include FT_GLYPH_H
-
-#ifdef FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK
-#include FT_INTERNAL_RFORK_H
-#endif
-
-
-FT_BEGIN_HEADER
-
- typedef struct BasePIC_
- {
- FT_Module_Class** default_module_classes;
- FT_Glyph_Class ft_outline_glyph_class;
- FT_Glyph_Class ft_bitmap_glyph_class;
-
-#ifdef FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK
- ft_raccess_guess_rec ft_raccess_guess_table[FT_RACCESS_N_RULES];
-#endif
-
- } BasePIC;
-
-
-#define GET_PIC( lib ) ( (BasePIC*)( (lib)->pic_container.base ) )
-
-#define FT_OUTLINE_GLYPH_CLASS_GET \
- ( &GET_PIC( library )->ft_outline_glyph_class )
-#define FT_BITMAP_GLYPH_CLASS_GET \
- ( &GET_PIC( library )->ft_bitmap_glyph_class )
-#define FT_DEFAULT_MODULES_GET \
- ( GET_PIC( library )->default_module_classes )
-
-#ifdef FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK
-#define FT_RACCESS_GUESS_TABLE_GET \
- ( GET_PIC( library )->ft_raccess_guess_table )
-#endif
-
-
- /* see basepic.c for the implementation */
- void
- ft_base_pic_free( FT_Library library );
-
- FT_Error
- ft_base_pic_init( FT_Library library );
-
-FT_END_HEADER
-
-#endif /* FT_CONFIG_OPTION_PIC */
-
- /* */
-
-#endif /* __BASEPIC_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/base/ftadvanc.c b/chromium/third_party/pdfium/third_party/freetype/src/base/ftadvanc.c
deleted file mode 100644
index f12908f5181..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/base/ftadvanc.c
+++ /dev/null
@@ -1,168 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftadvanc.c */
-/* */
-/* Quick computation of advance widths (body). */
-/* */
-/* Copyright 2008-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-
-#include FT_ADVANCES_H
-#include FT_INTERNAL_OBJECTS_H
-
-
- static FT_Error
- _ft_face_scale_advances( FT_Face face,
- FT_Fixed* advances,
- FT_UInt count,
- FT_Int32 flags )
- {
- FT_Fixed scale;
- FT_UInt nn;
-
-
- if ( flags & FT_LOAD_NO_SCALE )
- return FT_Err_Ok;
-
- if ( face->size == NULL )
- return FT_THROW( Invalid_Size_Handle );
-
- if ( flags & FT_LOAD_VERTICAL_LAYOUT )
- scale = face->size->metrics.y_scale;
- else
- scale = face->size->metrics.x_scale;
-
- /* this must be the same scaling as to get linear{Hori,Vert}Advance */
- /* (see `FT_Load_Glyph' implementation in src/base/ftobjs.c) */
-
- for ( nn = 0; nn < count; nn++ )
- advances[nn] = FT_MulDiv( advances[nn], scale, 64 );
-
- return FT_Err_Ok;
- }
-
-
- /* at the moment, we can perform fast advance retrieval only in */
- /* the following cases: */
- /* */
- /* - unscaled load */
- /* - unhinted load */
- /* - light-hinted load */
-
-#define LOAD_ADVANCE_FAST_CHECK( flags ) \
- ( flags & ( FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING ) || \
- FT_LOAD_TARGET_MODE( flags ) == FT_RENDER_MODE_LIGHT )
-
-
- /* documentation is in ftadvanc.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Get_Advance( FT_Face face,
- FT_UInt gindex,
- FT_Int32 flags,
- FT_Fixed *padvance )
- {
- FT_Face_GetAdvancesFunc func;
-
-
- if ( !face )
- return FT_THROW( Invalid_Face_Handle );
-
- if ( !padvance )
- return FT_THROW( Invalid_Argument );
-
- if ( gindex >= (FT_UInt)face->num_glyphs )
- return FT_THROW( Invalid_Glyph_Index );
-
- func = face->driver->clazz->get_advances;
- if ( func && LOAD_ADVANCE_FAST_CHECK( flags ) )
- {
- FT_Error error;
-
-
- error = func( face, gindex, 1, flags, padvance );
- if ( !error )
- return _ft_face_scale_advances( face, padvance, 1, flags );
-
- if ( FT_ERR_NEQ( error, Unimplemented_Feature ) )
- return error;
- }
-
- return FT_Get_Advances( face, gindex, 1, flags, padvance );
- }
-
-
- /* documentation is in ftadvanc.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Get_Advances( FT_Face face,
- FT_UInt start,
- FT_UInt count,
- FT_Int32 flags,
- FT_Fixed *padvances )
- {
- FT_Face_GetAdvancesFunc func;
- FT_UInt num, end, nn;
- FT_Error error = FT_Err_Ok;
-
-
- if ( !face )
- return FT_THROW( Invalid_Face_Handle );
-
- if ( !padvances )
- return FT_THROW( Invalid_Argument );
-
- num = (FT_UInt)face->num_glyphs;
- end = start + count;
- if ( start >= num || end < start || end > num )
- return FT_THROW( Invalid_Glyph_Index );
-
- if ( count == 0 )
- return FT_Err_Ok;
-
- func = face->driver->clazz->get_advances;
- if ( func && LOAD_ADVANCE_FAST_CHECK( flags ) )
- {
- error = func( face, start, count, flags, padvances );
- if ( !error )
- return _ft_face_scale_advances( face, padvances, count, flags );
-
- if ( FT_ERR_NEQ( error, Unimplemented_Feature ) )
- return error;
- }
-
- error = FT_Err_Ok;
-
- if ( flags & FT_ADVANCE_FLAG_FAST_ONLY )
- return FT_THROW( Unimplemented_Feature );
-
- flags |= (FT_UInt32)FT_LOAD_ADVANCE_ONLY;
- for ( nn = 0; nn < count; nn++ )
- {
- error = FT_Load_Glyph( face, start + nn, flags );
- if ( error )
- break;
-
- /* scale from 26.6 to 16.16 */
- padvances[nn] = ( flags & FT_LOAD_VERTICAL_LAYOUT )
- ? face->glyph->advance.y << 10
- : face->glyph->advance.x << 10;
- }
-
- return error;
- }
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/base/ftapi.c b/chromium/third_party/pdfium/third_party/freetype/src/base/ftapi.c
deleted file mode 100644
index f22a181b59b..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/base/ftapi.c
+++ /dev/null
@@ -1,121 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftapi.c */
-/* */
-/* The FreeType compatibility functions (body). */
-/* */
-/* Copyright 2002-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_LIST_H
-#include FT_OUTLINE_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_TRUETYPE_TABLES_H
-#include FT_OUTLINE_H
-
-
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
- /**** ****/
- /**** ****/
- /**** C O M P A T I B I L I T Y ****/
- /**** ****/
- /**** ****/
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
-
- /* backwards compatibility API */
-
- FT_BASE_DEF( void )
- FT_New_Memory_Stream( FT_Library library,
- FT_Byte* base,
- FT_ULong size,
- FT_Stream stream )
- {
- FT_UNUSED( library );
-
- FT_Stream_OpenMemory( stream, base, size );
- }
-
-
- FT_BASE_DEF( FT_Error )
- FT_Seek_Stream( FT_Stream stream,
- FT_ULong pos )
- {
- return FT_Stream_Seek( stream, pos );
- }
-
-
- FT_BASE_DEF( FT_Error )
- FT_Skip_Stream( FT_Stream stream,
- FT_Long distance )
- {
- return FT_Stream_Skip( stream, distance );
- }
-
-
- FT_BASE_DEF( FT_Error )
- FT_Read_Stream( FT_Stream stream,
- FT_Byte* buffer,
- FT_ULong count )
- {
- return FT_Stream_Read( stream, buffer, count );
- }
-
-
- FT_BASE_DEF( FT_Error )
- FT_Read_Stream_At( FT_Stream stream,
- FT_ULong pos,
- FT_Byte* buffer,
- FT_ULong count )
- {
- return FT_Stream_ReadAt( stream, pos, buffer, count );
- }
-
-
- FT_BASE_DEF( FT_Error )
- FT_Extract_Frame( FT_Stream stream,
- FT_ULong count,
- FT_Byte** pbytes )
- {
- return FT_Stream_ExtractFrame( stream, count, pbytes );
- }
-
-
- FT_BASE_DEF( void )
- FT_Release_Frame( FT_Stream stream,
- FT_Byte** pbytes )
- {
- FT_Stream_ReleaseFrame( stream, pbytes );
- }
-
- FT_BASE_DEF( FT_Error )
- FT_Access_Frame( FT_Stream stream,
- FT_ULong count )
- {
- return FT_Stream_EnterFrame( stream, count );
- }
-
-
- FT_BASE_DEF( void )
- FT_Forget_Frame( FT_Stream stream )
- {
- FT_Stream_ExitFrame( stream );
- }
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/base/ftbase.c b/chromium/third_party/pdfium/third_party/freetype/src/base/ftbase.c
deleted file mode 100644
index 253dfb72369..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/base/ftbase.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftbase.c */
-/* */
-/* Single object library component (body only). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-
-#define FT_MAKE_OPTION_SINGLE_OBJECT
-
-#include "ftpic.c"
-#include "basepic.c"
-#include "ftadvanc.c"
-#include "ftcalc.c"
-#include "ftdbgmem.c"
-#include "ftgloadr.c"
-#include "ftobjs.c"
-#include "ftoutln.c"
-#include "ftrfork.c"
-#include "ftsnames.c"
-#include "ftstream.c"
-#include "fttrigon.c"
-#include "ftutil.c"
-
-#ifdef FT_MACINTOSH
-#include "ftmac.c"
-#endif
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/base/ftbase.h b/chromium/third_party/pdfium/third_party/freetype/src/base/ftbase.h
deleted file mode 100644
index e37fefa411f..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/base/ftbase.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftbase.h */
-/* */
-/* The FreeType private functions used in base module (specification). */
-/* */
-/* Copyright 2008-2015 by */
-/* David Turner, Robert Wilhelm, Werner Lemberg, and suzuki toshiya. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __FTBASE_H__
-#define __FTBASE_H__
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_OBJECTS_H
-
-
-FT_BEGIN_HEADER
-
-
- /* MacOS resource fork cannot exceed 16MB at least for Carbon code; */
- /* see https://support.microsoft.com/en-us/kb/130437 */
-#define FT_MAC_RFORK_MAX_LEN 0x00FFFFFFUL
-
-
- /* Assume the stream is sfnt-wrapped PS Type1 or sfnt-wrapped CID-keyed */
- /* font, and try to load a face specified by the face_index. */
- FT_LOCAL( FT_Error )
- open_face_PS_from_sfnt_stream( FT_Library library,
- FT_Stream stream,
- FT_Long face_index,
- FT_Int num_params,
- FT_Parameter *params,
- FT_Face *aface );
-
-
- /* Create a new FT_Face given a buffer and a driver name. */
- /* From ftmac.c. */
- FT_LOCAL( FT_Error )
- open_face_from_buffer( FT_Library library,
- FT_Byte* base,
- FT_ULong size,
- FT_Long face_index,
- const char* driver_name,
- FT_Face *aface );
-
-
-#if defined( FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK ) && \
- !defined( FT_MACINTOSH )
- /* Mac OS X/Darwin kernel often changes recommended method to access */
- /* the resource fork and older methods makes the kernel issue the */
- /* warning of deprecated method. To calm it down, the methods based */
- /* on Darwin VFS should be grouped and skip the rest methods after */
- /* the case the resource is opened but found to lack a font in it. */
- FT_LOCAL( FT_Bool )
- ft_raccess_rule_by_darwin_vfs( FT_Library library, FT_UInt rule_index );
-#endif
-
-
-FT_END_HEADER
-
-#endif /* __FTBASE_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/base/ftbbox.c b/chromium/third_party/pdfium/third_party/freetype/src/base/ftbbox.c
deleted file mode 100644
index 10df98de6ad..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/base/ftbbox.c
+++ /dev/null
@@ -1,509 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftbbox.c */
-/* */
-/* FreeType bbox computation (body). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used */
-/* modified and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* This component has a _single_ role: to compute exact outline bounding */
- /* boxes. */
- /* */
- /*************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-
-#include FT_BBOX_H
-#include FT_IMAGE_H
-#include FT_OUTLINE_H
-#include FT_INTERNAL_CALC_H
-#include FT_INTERNAL_OBJECTS_H
-
-
- typedef struct TBBox_Rec_
- {
- FT_Vector last;
- FT_BBox bbox;
-
- } TBBox_Rec;
-
-
-#define FT_UPDATE_BBOX( p, bbox ) \
- FT_BEGIN_STMNT \
- if ( p->x < bbox.xMin ) \
- bbox.xMin = p->x; \
- if ( p->x > bbox.xMax ) \
- bbox.xMax = p->x; \
- if ( p->y < bbox.yMin ) \
- bbox.yMin = p->y; \
- if ( p->y > bbox.yMax ) \
- bbox.yMax = p->y; \
- FT_END_STMNT
-
-#define CHECK_X( p, bbox ) \
- ( p->x < bbox.xMin || p->x > bbox.xMax )
-
-#define CHECK_Y( p, bbox ) \
- ( p->y < bbox.yMin || p->y > bbox.yMax )
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* BBox_Move_To */
- /* */
- /* <Description> */
- /* This function is used as a `move_to' emitter during */
- /* FT_Outline_Decompose(). It simply records the destination point */
- /* in `user->last'. We also update bbox in case contour starts with */
- /* an implicit `on' point. */
- /* */
- /* <Input> */
- /* to :: A pointer to the destination vector. */
- /* */
- /* <InOut> */
- /* user :: A pointer to the current walk context. */
- /* */
- /* <Return> */
- /* Always 0. Needed for the interface only. */
- /* */
- static int
- BBox_Move_To( FT_Vector* to,
- TBBox_Rec* user )
- {
- FT_UPDATE_BBOX( to, user->bbox );
-
- user->last = *to;
-
- return 0;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* BBox_Line_To */
- /* */
- /* <Description> */
- /* This function is used as a `line_to' emitter during */
- /* FT_Outline_Decompose(). It simply records the destination point */
- /* in `user->last'; no further computations are necessary because */
- /* bbox already contains both explicit ends of the line segment. */
- /* */
- /* <Input> */
- /* to :: A pointer to the destination vector. */
- /* */
- /* <InOut> */
- /* user :: A pointer to the current walk context. */
- /* */
- /* <Return> */
- /* Always 0. Needed for the interface only. */
- /* */
- static int
- BBox_Line_To( FT_Vector* to,
- TBBox_Rec* user )
- {
- user->last = *to;
-
- return 0;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* BBox_Conic_Check */
- /* */
- /* <Description> */
- /* Find the extrema of a 1-dimensional conic Bezier curve and update */
- /* a bounding range. This version uses direct computation, as it */
- /* doesn't need square roots. */
- /* */
- /* <Input> */
- /* y1 :: The start coordinate. */
- /* */
- /* y2 :: The coordinate of the control point. */
- /* */
- /* y3 :: The end coordinate. */
- /* */
- /* <InOut> */
- /* min :: The address of the current minimum. */
- /* */
- /* max :: The address of the current maximum. */
- /* */
- static void
- BBox_Conic_Check( FT_Pos y1,
- FT_Pos y2,
- FT_Pos y3,
- FT_Pos* min,
- FT_Pos* max )
- {
- /* This function is only called when a control off-point is outside */
- /* the bbox that contains all on-points. It finds a local extremum */
- /* within the segment, equal to (y1*y3 - y2*y2)/(y1 - 2*y2 + y3). */
- /* Or, offsetting from y2, we get */
-
- y1 -= y2;
- y3 -= y2;
- y2 += FT_MulDiv( y1, y3, y1 + y3 );
-
- if ( y2 < *min )
- *min = y2;
- if ( y2 > *max )
- *max = y2;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* BBox_Conic_To */
- /* */
- /* <Description> */
- /* This function is used as a `conic_to' emitter during */
- /* FT_Outline_Decompose(). It checks a conic Bezier curve with the */
- /* current bounding box, and computes its extrema if necessary to */
- /* update it. */
- /* */
- /* <Input> */
- /* control :: A pointer to a control point. */
- /* */
- /* to :: A pointer to the destination vector. */
- /* */
- /* <InOut> */
- /* user :: The address of the current walk context. */
- /* */
- /* <Return> */
- /* Always 0. Needed for the interface only. */
- /* */
- /* <Note> */
- /* In the case of a non-monotonous arc, we compute directly the */
- /* extremum coordinates, as it is sufficiently fast. */
- /* */
- static int
- BBox_Conic_To( FT_Vector* control,
- FT_Vector* to,
- TBBox_Rec* user )
- {
- /* in case `to' is implicit and not included in bbox yet */
- FT_UPDATE_BBOX( to, user->bbox );
-
- if ( CHECK_X( control, user->bbox ) )
- BBox_Conic_Check( user->last.x,
- control->x,
- to->x,
- &user->bbox.xMin,
- &user->bbox.xMax );
-
- if ( CHECK_Y( control, user->bbox ) )
- BBox_Conic_Check( user->last.y,
- control->y,
- to->y,
- &user->bbox.yMin,
- &user->bbox.yMax );
-
- user->last = *to;
-
- return 0;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* BBox_Cubic_Check */
- /* */
- /* <Description> */
- /* Find the extrema of a 1-dimensional cubic Bezier curve and */
- /* update a bounding range. This version uses iterative splitting */
- /* because it is faster than the exact solution with square roots. */
- /* */
- /* <Input> */
- /* p1 :: The start coordinate. */
- /* */
- /* p2 :: The coordinate of the first control point. */
- /* */
- /* p3 :: The coordinate of the second control point. */
- /* */
- /* p4 :: The end coordinate. */
- /* */
- /* <InOut> */
- /* min :: The address of the current minimum. */
- /* */
- /* max :: The address of the current maximum. */
- /* */
- static FT_Pos
- cubic_peak( FT_Pos q1,
- FT_Pos q2,
- FT_Pos q3,
- FT_Pos q4 )
- {
- FT_Pos peak = 0;
- FT_Int shift;
-
-
- /* This function finds a peak of a cubic segment if it is above 0 */
- /* using iterative bisection of the segment, or returns 0. */
- /* The fixed-point arithmetic of bisection is inherently stable */
- /* but may loose accuracy in the two lowest bits. To compensate, */
- /* we upscale the segment if there is room. Large values may need */
- /* to be downscaled to avoid overflows during bisection. */
- /* It is called with either q2 or q3 positive, which is necessary */
- /* for the peak to exist and avoids undefined FT_MSB. */
-
- shift = 27 - FT_MSB( (FT_UInt32)( FT_ABS( q1 ) |
- FT_ABS( q2 ) |
- FT_ABS( q3 ) |
- FT_ABS( q4 ) ) );
-
- if ( shift > 0 )
- {
- /* upscaling too much just wastes time */
- if ( shift > 2 )
- shift = 2;
-
- q1 <<= shift;
- q2 <<= shift;
- q3 <<= shift;
- q4 <<= shift;
- }
- else
- {
- q1 >>= -shift;
- q2 >>= -shift;
- q3 >>= -shift;
- q4 >>= -shift;
- }
-
- /* for a peak to exist above 0, the cubic segment must have */
- /* at least one of its control off-points above 0. */
- while ( q2 > 0 || q3 > 0 )
- {
- /* determine which half contains the maximum and split */
- if ( q1 + q2 > q3 + q4 ) /* first half */
- {
- q4 = q4 + q3;
- q3 = q3 + q2;
- q2 = q2 + q1;
- q4 = q4 + q3;
- q3 = q3 + q2;
- q4 = ( q4 + q3 ) / 8;
- q3 = q3 / 4;
- q2 = q2 / 2;
- }
- else /* second half */
- {
- q1 = q1 + q2;
- q2 = q2 + q3;
- q3 = q3 + q4;
- q1 = q1 + q2;
- q2 = q2 + q3;
- q1 = ( q1 + q2 ) / 8;
- q2 = q2 / 4;
- q3 = q3 / 2;
- }
-
- /* check whether either end reached the maximum */
- if ( q1 == q2 && q1 >= q3 )
- {
- peak = q1;
- break;
- }
- if ( q3 == q4 && q2 <= q4 )
- {
- peak = q4;
- break;
- }
- }
-
- if ( shift > 0 )
- peak >>= shift;
- else
- peak <<= -shift;
-
- return peak;
- }
-
-
- static void
- BBox_Cubic_Check( FT_Pos p1,
- FT_Pos p2,
- FT_Pos p3,
- FT_Pos p4,
- FT_Pos* min,
- FT_Pos* max )
- {
- /* This function is only called when a control off-point is outside */
- /* the bbox that contains all on-points. So at least one of the */
- /* conditions below holds and cubic_peak is called with at least one */
- /* non-zero argument. */
-
- if ( p2 > *max || p3 > *max )
- *max += cubic_peak( p1 - *max, p2 - *max, p3 - *max, p4 - *max );
-
- /* now flip the signs to update the minimum */
- if ( p2 < *min || p3 < *min )
- *min -= cubic_peak( *min - p1, *min - p2, *min - p3, *min - p4 );
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* BBox_Cubic_To */
- /* */
- /* <Description> */
- /* This function is used as a `cubic_to' emitter during */
- /* FT_Outline_Decompose(). It checks a cubic Bezier curve with the */
- /* current bounding box, and computes its extrema if necessary to */
- /* update it. */
- /* */
- /* <Input> */
- /* control1 :: A pointer to the first control point. */
- /* */
- /* control2 :: A pointer to the second control point. */
- /* */
- /* to :: A pointer to the destination vector. */
- /* */
- /* <InOut> */
- /* user :: The address of the current walk context. */
- /* */
- /* <Return> */
- /* Always 0. Needed for the interface only. */
- /* */
- /* <Note> */
- /* In the case of a non-monotonous arc, we don't compute directly */
- /* extremum coordinates, we subdivide instead. */
- /* */
- static int
- BBox_Cubic_To( FT_Vector* control1,
- FT_Vector* control2,
- FT_Vector* to,
- TBBox_Rec* user )
- {
- /* We don't need to check `to' since it is always an on-point, */
- /* thus within the bbox. Only segments with an off-point outside */
- /* the bbox can possibly reach new extreme values. */
-
- if ( CHECK_X( control1, user->bbox ) ||
- CHECK_X( control2, user->bbox ) )
- BBox_Cubic_Check( user->last.x,
- control1->x,
- control2->x,
- to->x,
- &user->bbox.xMin,
- &user->bbox.xMax );
-
- if ( CHECK_Y( control1, user->bbox ) ||
- CHECK_Y( control2, user->bbox ) )
- BBox_Cubic_Check( user->last.y,
- control1->y,
- control2->y,
- to->y,
- &user->bbox.yMin,
- &user->bbox.yMax );
-
- user->last = *to;
-
- return 0;
- }
-
-
- FT_DEFINE_OUTLINE_FUNCS(bbox_interface,
- (FT_Outline_MoveTo_Func) BBox_Move_To,
- (FT_Outline_LineTo_Func) BBox_Line_To,
- (FT_Outline_ConicTo_Func)BBox_Conic_To,
- (FT_Outline_CubicTo_Func)BBox_Cubic_To,
- 0, 0
- )
-
-
- /* documentation is in ftbbox.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Outline_Get_BBox( FT_Outline* outline,
- FT_BBox *abbox )
- {
- FT_BBox cbox = { 0x7FFFFFFFL, 0x7FFFFFFFL,
- -0x7FFFFFFFL, -0x7FFFFFFFL };
- FT_BBox bbox = { 0x7FFFFFFFL, 0x7FFFFFFFL,
- -0x7FFFFFFFL, -0x7FFFFFFFL };
- FT_Vector* vec;
- FT_UShort n;
-
-
- if ( !abbox )
- return FT_THROW( Invalid_Argument );
-
- if ( !outline )
- return FT_THROW( Invalid_Outline );
-
- /* if outline is empty, return (0,0,0,0) */
- if ( outline->n_points == 0 || outline->n_contours <= 0 )
- {
- abbox->xMin = abbox->xMax = 0;
- abbox->yMin = abbox->yMax = 0;
- return 0;
- }
-
- /* We compute the control box as well as the bounding box of */
- /* all `on' points in the outline. Then, if the two boxes */
- /* coincide, we exit immediately. */
-
- vec = outline->points;
-
- for ( n = 0; n < outline->n_points; n++ )
- {
- FT_UPDATE_BBOX( vec, cbox);
-
- if ( FT_CURVE_TAG( outline->tags[n] ) == FT_CURVE_TAG_ON )
- FT_UPDATE_BBOX( vec, bbox);
-
- vec++;
- }
-
- /* test two boxes for equality */
- if ( cbox.xMin < bbox.xMin || cbox.xMax > bbox.xMax ||
- cbox.yMin < bbox.yMin || cbox.yMax > bbox.yMax )
- {
- /* the two boxes are different, now walk over the outline to */
- /* get the Bezier arc extrema. */
-
- FT_Error error;
- TBBox_Rec user;
-
-#ifdef FT_CONFIG_OPTION_PIC
- FT_Outline_Funcs bbox_interface;
- Init_Class_bbox_interface(&bbox_interface);
-#endif
-
- user.bbox = bbox;
-
- error = FT_Outline_Decompose( outline, &bbox_interface, &user );
- if ( error )
- return error;
-
- *abbox = user.bbox;
- }
- else
- *abbox = bbox;
-
- return FT_Err_Ok;
- }
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/base/ftbdf.c b/chromium/third_party/pdfium/third_party/freetype/src/base/ftbdf.c
deleted file mode 100644
index aa72ddcdf9d..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/base/ftbdf.c
+++ /dev/null
@@ -1,91 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftbdf.c */
-/* */
-/* FreeType API for accessing BDF-specific strings (body). */
-/* */
-/* Copyright 2002-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-
-#include FT_INTERNAL_OBJECTS_H
-#include FT_SERVICE_BDF_H
-
-
- /* documentation is in ftbdf.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Get_BDF_Charset_ID( FT_Face face,
- const char* *acharset_encoding,
- const char* *acharset_registry )
- {
- FT_Error error;
- const char* encoding = NULL;
- const char* registry = NULL;
-
- FT_Service_BDF service;
-
-
- if ( !face )
- return FT_THROW( Invalid_Face_Handle );
-
- FT_FACE_FIND_SERVICE( face, service, BDF );
-
- if ( service && service->get_charset_id )
- error = service->get_charset_id( face, &encoding, &registry );
- else
- error = FT_THROW( Invalid_Argument );
-
- if ( acharset_encoding )
- *acharset_encoding = encoding;
-
- if ( acharset_registry )
- *acharset_registry = registry;
-
- return error;
- }
-
-
- /* documentation is in ftbdf.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Get_BDF_Property( FT_Face face,
- const char* prop_name,
- BDF_PropertyRec *aproperty )
- {
- FT_Error error;
-
- FT_Service_BDF service;
-
-
- if ( !face )
- return FT_THROW( Invalid_Face_Handle );
-
- if ( !aproperty )
- return FT_THROW( Invalid_Argument );
-
- aproperty->type = BDF_PROPERTY_TYPE_NONE;
-
- FT_FACE_FIND_SERVICE( face, service, BDF );
-
- if ( service && service->get_property )
- error = service->get_property( face, prop_name, aproperty );
- else
- error = FT_THROW( Invalid_Argument );
-
- return error;
- }
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/base/ftbitmap.c b/chromium/third_party/pdfium/third_party/freetype/src/base/ftbitmap.c
deleted file mode 100644
index a54572aaa2a..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/base/ftbitmap.c
+++ /dev/null
@@ -1,809 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftbitmap.c */
-/* */
-/* FreeType utility functions for bitmaps (body). */
-/* */
-/* Copyright 2004-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-
-#include FT_BITMAP_H
-#include FT_IMAGE_H
-#include FT_INTERNAL_OBJECTS_H
-
-
- static
- const FT_Bitmap null_bitmap = { 0, 0, 0, 0, 0, 0, 0, 0 };
-
-
- /* documentation is in ftbitmap.h */
-
- FT_EXPORT_DEF( void )
- FT_Bitmap_Init( FT_Bitmap *abitmap )
- {
- if ( abitmap )
- *abitmap = null_bitmap;
- }
-
-
- /* deprecated function name; retained for ABI compatibility */
-
- FT_EXPORT_DEF( void )
- FT_Bitmap_New( FT_Bitmap *abitmap )
- {
- if ( abitmap )
- *abitmap = null_bitmap;
- }
-
-
- /* documentation is in ftbitmap.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Bitmap_Copy( FT_Library library,
- const FT_Bitmap *source,
- FT_Bitmap *target)
- {
- FT_Memory memory;
- FT_Error error = FT_Err_Ok;
-
- FT_Int pitch;
- FT_ULong size;
-
- FT_Int source_pitch_sign, target_pitch_sign;
-
-
- if ( !library )
- return FT_THROW( Invalid_Library_Handle );
-
- if ( !source || !target )
- return FT_THROW( Invalid_Argument );
-
- if ( source == target )
- return FT_Err_Ok;
-
- source_pitch_sign = source->pitch < 0 ? -1 : 1;
- target_pitch_sign = target->pitch < 0 ? -1 : 1;
-
- if ( source->buffer == NULL )
- {
- *target = *source;
- if ( source_pitch_sign != target_pitch_sign )
- target->pitch = -target->pitch;
-
- return FT_Err_Ok;
- }
-
- memory = library->memory;
- pitch = source->pitch;
-
- if ( pitch < 0 )
- pitch = -pitch;
- size = (FT_ULong)pitch * source->rows;
-
- if ( target->buffer )
- {
- FT_Int target_pitch = target->pitch;
- FT_ULong target_size;
-
-
- if ( target_pitch < 0 )
- target_pitch = -target_pitch;
- target_size = (FT_ULong)target_pitch * target->rows;
-
- if ( target_size != size )
- (void)FT_QREALLOC( target->buffer, target_size, size );
- }
- else
- (void)FT_QALLOC( target->buffer, size );
-
- if ( !error )
- {
- unsigned char *p;
-
-
- p = target->buffer;
- *target = *source;
- target->buffer = p;
-
- if ( source_pitch_sign == target_pitch_sign )
- FT_MEM_COPY( target->buffer, source->buffer, size );
- else
- {
- /* take care of bitmap flow */
- FT_UInt i;
- FT_Byte* s = source->buffer;
- FT_Byte* t = target->buffer;
-
-
- t += (FT_ULong)pitch * ( target->rows - 1 );
-
- for ( i = target->rows; i > 0; i-- )
- {
- FT_ARRAY_COPY( t, s, pitch );
-
- s += pitch;
- t -= pitch;
- }
- }
- }
-
- return error;
- }
-
-
- /* Enlarge `bitmap' horizontally and vertically by `xpixels' */
- /* and `ypixels', respectively. */
-
- static FT_Error
- ft_bitmap_assure_buffer( FT_Memory memory,
- FT_Bitmap* bitmap,
- FT_UInt xpixels,
- FT_UInt ypixels )
- {
- FT_Error error;
- int pitch;
- int new_pitch;
- FT_UInt bpp;
- FT_UInt i, width, height;
- unsigned char* buffer = NULL;
-
-
- width = bitmap->width;
- height = bitmap->rows;
- pitch = bitmap->pitch;
- if ( pitch < 0 )
- pitch = -pitch;
-
- switch ( bitmap->pixel_mode )
- {
- case FT_PIXEL_MODE_MONO:
- bpp = 1;
- new_pitch = (int)( ( width + xpixels + 7 ) >> 3 );
- break;
- case FT_PIXEL_MODE_GRAY2:
- bpp = 2;
- new_pitch = (int)( ( width + xpixels + 3 ) >> 2 );
- break;
- case FT_PIXEL_MODE_GRAY4:
- bpp = 4;
- new_pitch = (int)( ( width + xpixels + 1 ) >> 1 );
- break;
- case FT_PIXEL_MODE_GRAY:
- case FT_PIXEL_MODE_LCD:
- case FT_PIXEL_MODE_LCD_V:
- bpp = 8;
- new_pitch = (int)( width + xpixels );
- break;
- default:
- return FT_THROW( Invalid_Glyph_Format );
- }
-
- /* if no need to allocate memory */
- if ( ypixels == 0 && new_pitch <= pitch )
- {
- /* zero the padding */
- FT_UInt bit_width = (FT_UInt)pitch * 8;
- FT_UInt bit_last = ( width + xpixels ) * bpp;
-
-
- if ( bit_last < bit_width )
- {
- FT_Byte* line = bitmap->buffer + ( bit_last >> 3 );
- FT_Byte* end = bitmap->buffer + pitch;
- FT_UInt shift = bit_last & 7;
- FT_UInt mask = 0xFF00U >> shift;
- FT_UInt count = height;
-
-
- for ( ; count > 0; count--, line += pitch, end += pitch )
- {
- FT_Byte* write = line;
-
-
- if ( shift > 0 )
- {
- write[0] = (FT_Byte)( write[0] & mask );
- write++;
- }
- if ( write < end )
- FT_MEM_ZERO( write, end - write );
- }
- }
-
- return FT_Err_Ok;
- }
-
- /* otherwise allocate new buffer */
- if ( FT_QALLOC_MULT( buffer, new_pitch, bitmap->rows + ypixels ) )
- return error;
-
- /* new rows get added at the top of the bitmap, */
- /* thus take care of the flow direction */
- if ( bitmap->pitch > 0 )
- {
- FT_UInt len = ( width * bpp + 7 ) >> 3;
-
-
- for ( i = 0; i < bitmap->rows; i++ )
- FT_MEM_COPY( buffer + (FT_UInt)new_pitch * ( ypixels + i ),
- bitmap->buffer + (FT_UInt)pitch * i,
- len );
- }
- else
- {
- FT_UInt len = ( width * bpp + 7 ) >> 3;
-
-
- for ( i = 0; i < bitmap->rows; i++ )
- FT_MEM_COPY( buffer + (FT_UInt)new_pitch * i,
- bitmap->buffer + (FT_UInt)pitch * i,
- len );
- }
-
- FT_FREE( bitmap->buffer );
- bitmap->buffer = buffer;
-
- if ( bitmap->pitch < 0 )
- new_pitch = -new_pitch;
-
- /* set pitch only, width and height are left untouched */
- bitmap->pitch = new_pitch;
-
- return FT_Err_Ok;
- }
-
-
- /* documentation is in ftbitmap.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Bitmap_Embolden( FT_Library library,
- FT_Bitmap* bitmap,
- FT_Pos xStrength,
- FT_Pos yStrength )
- {
- FT_Error error;
- unsigned char* p;
- FT_Int i, x, pitch;
- FT_UInt y;
- FT_Int xstr, ystr;
-
-
- if ( !library )
- return FT_THROW( Invalid_Library_Handle );
-
- if ( !bitmap || !bitmap->buffer )
- return FT_THROW( Invalid_Argument );
-
- if ( ( ( FT_PIX_ROUND( xStrength ) >> 6 ) > FT_INT_MAX ) ||
- ( ( FT_PIX_ROUND( yStrength ) >> 6 ) > FT_INT_MAX ) )
- return FT_THROW( Invalid_Argument );
-
- xstr = (FT_Int)FT_PIX_ROUND( xStrength ) >> 6;
- ystr = (FT_Int)FT_PIX_ROUND( yStrength ) >> 6;
-
- if ( xstr == 0 && ystr == 0 )
- return FT_Err_Ok;
- else if ( xstr < 0 || ystr < 0 )
- return FT_THROW( Invalid_Argument );
-
- switch ( bitmap->pixel_mode )
- {
- case FT_PIXEL_MODE_GRAY2:
- case FT_PIXEL_MODE_GRAY4:
- {
- FT_Bitmap tmp;
-
-
- /* convert to 8bpp */
- FT_Bitmap_Init( &tmp );
- error = FT_Bitmap_Convert( library, bitmap, &tmp, 1 );
- if ( error )
- return error;
-
- FT_Bitmap_Done( library, bitmap );
- *bitmap = tmp;
- }
- break;
-
- case FT_PIXEL_MODE_MONO:
- if ( xstr > 8 )
- xstr = 8;
- break;
-
- case FT_PIXEL_MODE_LCD:
- xstr *= 3;
- break;
-
- case FT_PIXEL_MODE_LCD_V:
- ystr *= 3;
- break;
-
- case FT_PIXEL_MODE_BGRA:
- /* We don't embolden color glyphs. */
- return FT_Err_Ok;
- }
-
- error = ft_bitmap_assure_buffer( library->memory, bitmap,
- (FT_UInt)xstr, (FT_UInt)ystr );
- if ( error )
- return error;
-
- /* take care of bitmap flow */
- pitch = bitmap->pitch;
- if ( pitch > 0 )
- p = bitmap->buffer + pitch * ystr;
- else
- {
- pitch = -pitch;
- p = bitmap->buffer + (FT_UInt)pitch * ( bitmap->rows - 1 );
- }
-
- /* for each row */
- for ( y = 0; y < bitmap->rows ; y++ )
- {
- /*
- * Horizontally:
- *
- * From the last pixel on, make each pixel or'ed with the
- * `xstr' pixels before it.
- */
- for ( x = pitch - 1; x >= 0; x-- )
- {
- unsigned char tmp;
-
-
- tmp = p[x];
- for ( i = 1; i <= xstr; i++ )
- {
- if ( bitmap->pixel_mode == FT_PIXEL_MODE_MONO )
- {
- p[x] |= tmp >> i;
-
- /* the maximum value of 8 for `xstr' comes from here */
- if ( x > 0 )
- p[x] |= p[x - 1] << ( 8 - i );
-
-#if 0
- if ( p[x] == 0xFF )
- break;
-#endif
- }
- else
- {
- if ( x - i >= 0 )
- {
- if ( p[x] + p[x - i] > bitmap->num_grays - 1 )
- {
- p[x] = (unsigned char)( bitmap->num_grays - 1 );
- break;
- }
- else
- {
- p[x] = (unsigned char)( p[x] + p[x - i] );
- if ( p[x] == bitmap->num_grays - 1 )
- break;
- }
- }
- else
- break;
- }
- }
- }
-
- /*
- * Vertically:
- *
- * Make the above `ystr' rows or'ed with it.
- */
- for ( x = 1; x <= ystr; x++ )
- {
- unsigned char* q;
-
-
- q = p - bitmap->pitch * x;
- for ( i = 0; i < pitch; i++ )
- q[i] |= p[i];
- }
-
- p += bitmap->pitch;
- }
-
- bitmap->width += (FT_UInt)xstr;
- bitmap->rows += (FT_UInt)ystr;
-
- return FT_Err_Ok;
- }
-
-
- static FT_Byte
- ft_gray_for_premultiplied_srgb_bgra( const FT_Byte* bgra )
- {
- FT_UInt a = bgra[3];
- FT_UInt l;
-
-
- /* Short-circuit transparent color to avoid division by zero. */
- if ( !a )
- return 0;
-
- /*
- * Luminosity for sRGB is defined using ~0.2126,0.7152,0.0722
- * coefficients for RGB channels *on the linear colors*.
- * A gamma of 2.2 is fair to assume. And then, we need to
- * undo the premultiplication too.
- *
- * http://accessibility.kde.org/hsl-adjusted.php
- *
- * We do the computation with integers only, applying a gamma of 2.0.
- * We guarantee 32-bit arithmetic to avoid overflow but the resulting
- * luminosity fits into 16 bits.
- *
- */
-
- l = ( 4732UL /* 0.0722 * 65536 */ * bgra[0] * bgra[0] +
- 46871UL /* 0.7152 * 65536 */ * bgra[1] * bgra[1] +
- 13933UL /* 0.2126 * 65536 */ * bgra[2] * bgra[2] ) >> 16;
-
- /*
- * Final transparency can be determined as follows.
- *
- * - If alpha is zero, we want 0.
- * - If alpha is zero and luminosity is zero, we want 255.
- * - If alpha is zero and luminosity is one, we want 0.
- *
- * So the formula is a * (1 - l) = a - l * a.
- *
- * We still need to undo premultiplication by dividing l by a*a.
- *
- */
-
- return (FT_Byte)( a - l / a );
- }
-
-
- /* documentation is in ftbitmap.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Bitmap_Convert( FT_Library library,
- const FT_Bitmap *source,
- FT_Bitmap *target,
- FT_Int alignment )
- {
- FT_Error error = FT_Err_Ok;
- FT_Memory memory;
-
- FT_Byte* s;
- FT_Byte* t;
-
-
- if ( !library )
- return FT_THROW( Invalid_Library_Handle );
-
- if ( !source || !target )
- return FT_THROW( Invalid_Argument );
-
- memory = library->memory;
-
- switch ( source->pixel_mode )
- {
- case FT_PIXEL_MODE_MONO:
- case FT_PIXEL_MODE_GRAY:
- case FT_PIXEL_MODE_GRAY2:
- case FT_PIXEL_MODE_GRAY4:
- case FT_PIXEL_MODE_LCD:
- case FT_PIXEL_MODE_LCD_V:
- case FT_PIXEL_MODE_BGRA:
- {
- FT_Int pad, old_target_pitch, target_pitch;
- FT_ULong old_size;
-
-
- old_target_pitch = target->pitch;
- if ( old_target_pitch < 0 )
- old_target_pitch = -old_target_pitch;
-
- old_size = target->rows * (FT_UInt)old_target_pitch;
-
- target->pixel_mode = FT_PIXEL_MODE_GRAY;
- target->rows = source->rows;
- target->width = source->width;
-
- pad = 0;
- if ( alignment > 0 )
- {
- pad = (FT_Int)source->width % alignment;
- if ( pad != 0 )
- pad = alignment - pad;
- }
-
- target_pitch = (FT_Int)source->width + pad;
-
- if ( target_pitch > 0 &&
- (FT_ULong)target->rows > FT_ULONG_MAX / (FT_ULong)target_pitch )
- return FT_THROW( Invalid_Argument );
-
- if ( target->rows * (FT_ULong)target_pitch > old_size &&
- FT_QREALLOC( target->buffer,
- old_size, target->rows * (FT_UInt)target_pitch ) )
- return error;
-
- target->pitch = target->pitch < 0 ? -target_pitch : target_pitch;
- }
- break;
-
- default:
- error = FT_THROW( Invalid_Argument );
- }
-
- s = source->buffer;
- t = target->buffer;
-
- /* take care of bitmap flow */
- if ( source->pitch < 0 )
- s -= source->pitch * (FT_Int)( source->rows - 1 );
- if ( target->pitch < 0 )
- t -= target->pitch * (FT_Int)( target->rows - 1 );
-
- switch ( source->pixel_mode )
- {
- case FT_PIXEL_MODE_MONO:
- {
- FT_UInt i;
-
-
- target->num_grays = 2;
-
- for ( i = source->rows; i > 0; i-- )
- {
- FT_Byte* ss = s;
- FT_Byte* tt = t;
- FT_UInt j;
-
-
- /* get the full bytes */
- for ( j = source->width >> 3; j > 0; j-- )
- {
- FT_Int val = ss[0]; /* avoid a byte->int cast on each line */
-
-
- tt[0] = (FT_Byte)( ( val & 0x80 ) >> 7 );
- tt[1] = (FT_Byte)( ( val & 0x40 ) >> 6 );
- tt[2] = (FT_Byte)( ( val & 0x20 ) >> 5 );
- tt[3] = (FT_Byte)( ( val & 0x10 ) >> 4 );
- tt[4] = (FT_Byte)( ( val & 0x08 ) >> 3 );
- tt[5] = (FT_Byte)( ( val & 0x04 ) >> 2 );
- tt[6] = (FT_Byte)( ( val & 0x02 ) >> 1 );
- tt[7] = (FT_Byte)( val & 0x01 );
-
- tt += 8;
- ss += 1;
- }
-
- /* get remaining pixels (if any) */
- j = source->width & 7;
- if ( j > 0 )
- {
- FT_Int val = *ss;
-
-
- for ( ; j > 0; j-- )
- {
- tt[0] = (FT_Byte)( ( val & 0x80 ) >> 7);
- val <<= 1;
- tt += 1;
- }
- }
-
- s += source->pitch;
- t += target->pitch;
- }
- }
- break;
-
-
- case FT_PIXEL_MODE_GRAY:
- case FT_PIXEL_MODE_LCD:
- case FT_PIXEL_MODE_LCD_V:
- {
- FT_UInt width = source->width;
- FT_UInt i;
-
-
- target->num_grays = 256;
-
- for ( i = source->rows; i > 0; i-- )
- {
- FT_ARRAY_COPY( t, s, width );
-
- s += source->pitch;
- t += target->pitch;
- }
- }
- break;
-
-
- case FT_PIXEL_MODE_GRAY2:
- {
- FT_UInt i;
-
-
- target->num_grays = 4;
-
- for ( i = source->rows; i > 0; i-- )
- {
- FT_Byte* ss = s;
- FT_Byte* tt = t;
- FT_UInt j;
-
-
- /* get the full bytes */
- for ( j = source->width >> 2; j > 0; j-- )
- {
- FT_Int val = ss[0];
-
-
- tt[0] = (FT_Byte)( ( val & 0xC0 ) >> 6 );
- tt[1] = (FT_Byte)( ( val & 0x30 ) >> 4 );
- tt[2] = (FT_Byte)( ( val & 0x0C ) >> 2 );
- tt[3] = (FT_Byte)( ( val & 0x03 ) );
-
- ss += 1;
- tt += 4;
- }
-
- j = source->width & 3;
- if ( j > 0 )
- {
- FT_Int val = ss[0];
-
-
- for ( ; j > 0; j-- )
- {
- tt[0] = (FT_Byte)( ( val & 0xC0 ) >> 6 );
- val <<= 2;
- tt += 1;
- }
- }
-
- s += source->pitch;
- t += target->pitch;
- }
- }
- break;
-
-
- case FT_PIXEL_MODE_GRAY4:
- {
- FT_UInt i;
-
-
- target->num_grays = 16;
-
- for ( i = source->rows; i > 0; i-- )
- {
- FT_Byte* ss = s;
- FT_Byte* tt = t;
- FT_UInt j;
-
-
- /* get the full bytes */
- for ( j = source->width >> 1; j > 0; j-- )
- {
- FT_Int val = ss[0];
-
-
- tt[0] = (FT_Byte)( ( val & 0xF0 ) >> 4 );
- tt[1] = (FT_Byte)( ( val & 0x0F ) );
-
- ss += 1;
- tt += 2;
- }
-
- if ( source->width & 1 )
- tt[0] = (FT_Byte)( ( ss[0] & 0xF0 ) >> 4 );
-
- s += source->pitch;
- t += target->pitch;
- }
- }
- break;
-
-
- case FT_PIXEL_MODE_BGRA:
- {
- FT_UInt i;
-
-
- target->num_grays = 256;
-
- for ( i = source->rows; i > 0; i-- )
- {
- FT_Byte* ss = s;
- FT_Byte* tt = t;
- FT_UInt j;
-
-
- for ( j = source->width; j > 0; j-- )
- {
- tt[0] = ft_gray_for_premultiplied_srgb_bgra( ss );
-
- ss += 4;
- tt += 1;
- }
-
- s += source->pitch;
- t += target->pitch;
- }
- }
- break;
-
- default:
- ;
- }
-
- return error;
- }
-
-
- /* documentation is in ftbitmap.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_GlyphSlot_Own_Bitmap( FT_GlyphSlot slot )
- {
- if ( slot && slot->format == FT_GLYPH_FORMAT_BITMAP &&
- !( slot->internal->flags & FT_GLYPH_OWN_BITMAP ) )
- {
- FT_Bitmap bitmap;
- FT_Error error;
-
-
- FT_Bitmap_Init( &bitmap );
- error = FT_Bitmap_Copy( slot->library, &slot->bitmap, &bitmap );
- if ( error )
- return error;
-
- slot->bitmap = bitmap;
- slot->internal->flags |= FT_GLYPH_OWN_BITMAP;
- }
-
- return FT_Err_Ok;
- }
-
-
- /* documentation is in ftbitmap.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Bitmap_Done( FT_Library library,
- FT_Bitmap *bitmap )
- {
- FT_Memory memory;
-
-
- if ( !library )
- return FT_THROW( Invalid_Library_Handle );
-
- if ( !bitmap )
- return FT_THROW( Invalid_Argument );
-
- memory = library->memory;
-
- FT_FREE( bitmap->buffer );
- *bitmap = null_bitmap;
-
- return FT_Err_Ok;
- }
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/base/ftcalc.c b/chromium/third_party/pdfium/third_party/freetype/src/base/ftcalc.c
deleted file mode 100644
index 619a08b3a0c..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/base/ftcalc.c
+++ /dev/null
@@ -1,1003 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftcalc.c */
-/* */
-/* Arithmetic computations (body). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
- /*************************************************************************/
- /* */
- /* Support for 1-complement arithmetic has been totally dropped in this */
- /* release. You can still write your own code if you need it. */
- /* */
- /*************************************************************************/
-
- /*************************************************************************/
- /* */
- /* Implementing basic computation routines. */
- /* */
- /* FT_MulDiv(), FT_MulFix(), FT_DivFix(), FT_RoundFix(), FT_CeilFix(), */
- /* and FT_FloorFix() are declared in freetype.h. */
- /* */
- /*************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_GLYPH_H
-#include FT_TRIGONOMETRY_H
-#include FT_INTERNAL_CALC_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_OBJECTS_H
-
-
-#ifdef FT_MULFIX_ASSEMBLER
-#undef FT_MulFix
-#endif
-
-/* we need to emulate a 64-bit data type if a real one isn't available */
-
-#ifndef FT_LONG64
-
- typedef struct FT_Int64_
- {
- FT_UInt32 lo;
- FT_UInt32 hi;
-
- } FT_Int64;
-
-#endif /* !FT_LONG64 */
-
-
- /*************************************************************************/
- /* */
- /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
- /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
- /* messages during execution. */
- /* */
-#undef FT_COMPONENT
-#define FT_COMPONENT trace_calc
-
-
- /* transfer sign leaving a positive number */
-#define FT_MOVE_SIGN( x, s ) \
- FT_BEGIN_STMNT \
- if ( x < 0 ) \
- { \
- x = -x; \
- s = -s; \
- } \
- FT_END_STMNT
-
- /* The following three functions are available regardless of whether */
- /* FT_LONG64 is defined. */
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( FT_Fixed )
- FT_RoundFix( FT_Fixed a )
- {
- return ( a + 0x8000L - ( a < 0 ) ) & ~0xFFFFL;
- }
-
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( FT_Fixed )
- FT_CeilFix( FT_Fixed a )
- {
- return ( a + 0xFFFFL ) & ~0xFFFFL;
- }
-
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( FT_Fixed )
- FT_FloorFix( FT_Fixed a )
- {
- return a & ~0xFFFFL;
- }
-
-#ifndef FT_MSB
-
- FT_BASE_DEF ( FT_Int )
- FT_MSB( FT_UInt32 z )
- {
- FT_Int shift = 0;
-
-
- /* determine msb bit index in `shift' */
- if ( z & 0xFFFF0000UL )
- {
- z >>= 16;
- shift += 16;
- }
- if ( z & 0x0000FF00UL )
- {
- z >>= 8;
- shift += 8;
- }
- if ( z & 0x000000F0UL )
- {
- z >>= 4;
- shift += 4;
- }
- if ( z & 0x0000000CUL )
- {
- z >>= 2;
- shift += 2;
- }
- if ( z & 0x00000002UL )
- {
- /* z >>= 1; */
- shift += 1;
- }
-
- return shift;
- }
-
-#endif /* !FT_MSB */
-
-
- /* documentation is in ftcalc.h */
-
- FT_BASE_DEF( FT_Fixed )
- FT_Hypot( FT_Fixed x,
- FT_Fixed y )
- {
- FT_Vector v;
-
-
- v.x = x;
- v.y = y;
-
- return FT_Vector_Length( &v );
- }
-
-
-#ifdef FT_LONG64
-
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( FT_Long )
- FT_MulDiv( FT_Long a_,
- FT_Long b_,
- FT_Long c_ )
- {
- FT_Int s = 1;
- FT_UInt64 a, b, c, d;
- FT_Long d_;
-
-
- FT_MOVE_SIGN( a_, s );
- FT_MOVE_SIGN( b_, s );
- FT_MOVE_SIGN( c_, s );
-
- a = (FT_UInt64)a_;
- b = (FT_UInt64)b_;
- c = (FT_UInt64)c_;
-
- d = c > 0 ? ( a * b + ( c >> 1 ) ) / c
- : 0x7FFFFFFFUL;
-
- d_ = (FT_Long)d;
-
- return s < 0 ? -d_ : d_;
- }
-
-
- /* documentation is in ftcalc.h */
-
- FT_BASE_DEF( FT_Long )
- FT_MulDiv_No_Round( FT_Long a_,
- FT_Long b_,
- FT_Long c_ )
- {
- FT_Int s = 1;
- FT_UInt64 a, b, c, d;
- FT_Long d_;
-
-
- FT_MOVE_SIGN( a_, s );
- FT_MOVE_SIGN( b_, s );
- FT_MOVE_SIGN( c_, s );
-
- a = (FT_UInt64)a_;
- b = (FT_UInt64)b_;
- c = (FT_UInt64)c_;
-
- d = c > 0 ? a * b / c
- : 0x7FFFFFFFUL;
-
- d_ = (FT_Long)d;
-
- return s < 0 ? -d_ : d_;
- }
-
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( FT_Long )
- FT_MulFix( FT_Long a_,
- FT_Long b_ )
- {
-#ifdef FT_MULFIX_ASSEMBLER
-
- return FT_MULFIX_ASSEMBLER( a_, b_ );
-
-#else
-
- FT_Int64 ab = (FT_Int64)a_ * (FT_Int64)b_;
-
- /* this requires arithmetic right shift of signed numbers */
- return (FT_Long)( ( ab + 0x8000L - ( ab < 0 ) ) >> 16 );
-
-#endif /* FT_MULFIX_ASSEMBLER */
- }
-
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( FT_Long )
- FT_DivFix( FT_Long a_,
- FT_Long b_ )
- {
- FT_Int s = 1;
- FT_UInt64 a, b, q;
- FT_Long q_;
-
-
- FT_MOVE_SIGN( a_, s );
- FT_MOVE_SIGN( b_, s );
-
- a = (FT_UInt64)a_;
- b = (FT_UInt64)b_;
-
- q = b > 0 ? ( ( a << 16 ) + ( b >> 1 ) ) / b
- : 0x7FFFFFFFUL;
-
- q_ = (FT_Long)q;
-
- return s < 0 ? -q_ : q_;
- }
-
-
-#else /* !FT_LONG64 */
-
-
- static void
- ft_multo64( FT_UInt32 x,
- FT_UInt32 y,
- FT_Int64 *z )
- {
- FT_UInt32 lo1, hi1, lo2, hi2, lo, hi, i1, i2;
-
-
- lo1 = x & 0x0000FFFFU; hi1 = x >> 16;
- lo2 = y & 0x0000FFFFU; hi2 = y >> 16;
-
- lo = lo1 * lo2;
- i1 = lo1 * hi2;
- i2 = lo2 * hi1;
- hi = hi1 * hi2;
-
- /* Check carry overflow of i1 + i2 */
- i1 += i2;
- hi += (FT_UInt32)( i1 < i2 ) << 16;
-
- hi += i1 >> 16;
- i1 = i1 << 16;
-
- /* Check carry overflow of i1 + lo */
- lo += i1;
- hi += ( lo < i1 );
-
- z->lo = lo;
- z->hi = hi;
- }
-
-
- static FT_UInt32
- ft_div64by32( FT_UInt32 hi,
- FT_UInt32 lo,
- FT_UInt32 y )
- {
- FT_UInt32 r, q;
- FT_Int i;
-
-
- if ( hi >= y )
- return (FT_UInt32)0x7FFFFFFFL;
-
- /* We shift as many bits as we can into the high register, perform */
- /* 32-bit division with modulo there, then work through the remaining */
- /* bits with long division. This optimization is especially noticeable */
- /* for smaller dividends that barely use the high register. */
-
- i = 31 - FT_MSB( hi );
- r = ( hi << i ) | ( lo >> ( 32 - i ) ); lo <<= i; /* left 64-bit shift */
- q = r / y;
- r -= q * y; /* remainder */
-
- i = 32 - i; /* bits remaining in low register */
- do
- {
- q <<= 1;
- r = ( r << 1 ) | ( lo >> 31 ); lo <<= 1;
-
- if ( r >= y )
- {
- r -= y;
- q |= 1;
- }
- } while ( --i );
-
- return q;
- }
-
-
- static void
- FT_Add64( FT_Int64* x,
- FT_Int64* y,
- FT_Int64 *z )
- {
- FT_UInt32 lo, hi;
-
-
- lo = x->lo + y->lo;
- hi = x->hi + y->hi + ( lo < x->lo );
-
- z->lo = lo;
- z->hi = hi;
- }
-
-
- /* The FT_MulDiv function has been optimized thanks to ideas from */
- /* Graham Asher and Alexei Podtelezhnikov. The trick is to optimize */
- /* a rather common case when everything fits within 32-bits. */
- /* */
- /* We compute 'a*b+c/2', then divide it by 'c' (all positive values). */
- /* */
- /* The product of two positive numbers never exceeds the square of */
- /* its mean values. Therefore, we always avoid the overflow by */
- /* imposing */
- /* */
- /* (a + b) / 2 <= sqrt(X - c/2) , */
- /* */
- /* where X = 2^32 - 1, the maximum unsigned 32-bit value, and using */
- /* unsigned arithmetic. Now we replace `sqrt' with a linear function */
- /* that is smaller or equal for all values of c in the interval */
- /* [0;X/2]; it should be equal to sqrt(X) and sqrt(3X/4) at the */
- /* endpoints. Substituting the linear solution and explicit numbers */
- /* we get */
- /* */
- /* a + b <= 131071.99 - c / 122291.84 . */
- /* */
- /* In practice, we should use a faster and even stronger inequality */
- /* */
- /* a + b <= 131071 - (c >> 16) */
- /* */
- /* or, alternatively, */
- /* */
- /* a + b <= 129894 - (c >> 17) . */
- /* */
- /* FT_MulFix, on the other hand, is optimized for a small value of */
- /* the first argument, when the second argument can be much larger. */
- /* This can be achieved by scaling the second argument and the limit */
- /* in the above inequalities. For example, */
- /* */
- /* a + (b >> 8) <= (131071 >> 4) */
- /* */
- /* covers the practical range of use. The actual test below is a bit */
- /* tighter to avoid the border case overflows. */
- /* */
- /* In the case of FT_DivFix, the exact overflow check */
- /* */
- /* a << 16 <= X - c/2 */
- /* */
- /* is scaled down by 2^16 and we use */
- /* */
- /* a <= 65535 - (c >> 17) . */
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( FT_Long )
- FT_MulDiv( FT_Long a_,
- FT_Long b_,
- FT_Long c_ )
- {
- FT_Int s = 1;
- FT_UInt32 a, b, c;
-
-
- /* XXX: this function does not allow 64-bit arguments */
-
- FT_MOVE_SIGN( a_, s );
- FT_MOVE_SIGN( b_, s );
- FT_MOVE_SIGN( c_, s );
-
- a = (FT_UInt32)a_;
- b = (FT_UInt32)b_;
- c = (FT_UInt32)c_;
-
- if ( c == 0 )
- a = 0x7FFFFFFFUL;
-
- else if ( a + b <= 129894UL - ( c >> 17 ) )
- a = ( a * b + ( c >> 1 ) ) / c;
-
- else
- {
- FT_Int64 temp, temp2;
-
-
- ft_multo64( a, b, &temp );
-
- temp2.hi = 0;
- temp2.lo = c >> 1;
-
- FT_Add64( &temp, &temp2, &temp );
-
- /* last attempt to ditch long division */
- a = temp.hi == 0 ? temp.lo / c
- : ft_div64by32( temp.hi, temp.lo, c );
- }
-
- a_ = (FT_Long)a;
-
- return s < 0 ? -a_ : a_;
- }
-
-
- FT_BASE_DEF( FT_Long )
- FT_MulDiv_No_Round( FT_Long a_,
- FT_Long b_,
- FT_Long c_ )
- {
- FT_Int s = 1;
- FT_UInt32 a, b, c;
-
-
- /* XXX: this function does not allow 64-bit arguments */
-
- FT_MOVE_SIGN( a_, s );
- FT_MOVE_SIGN( b_, s );
- FT_MOVE_SIGN( c_, s );
-
- a = (FT_UInt32)a_;
- b = (FT_UInt32)b_;
- c = (FT_UInt32)c_;
-
- if ( c == 0 )
- a = 0x7FFFFFFFUL;
-
- else if ( a + b <= 131071UL )
- a = a * b / c;
-
- else
- {
- FT_Int64 temp;
-
-
- ft_multo64( a, b, &temp );
-
- /* last attempt to ditch long division */
- a = temp.hi == 0 ? temp.lo / c
- : ft_div64by32( temp.hi, temp.lo, c );
- }
-
- a_ = (FT_Long)a;
-
- return s < 0 ? -a_ : a_;
- }
-
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( FT_Long )
- FT_MulFix( FT_Long a_,
- FT_Long b_ )
- {
-#ifdef FT_MULFIX_ASSEMBLER
-
- return FT_MULFIX_ASSEMBLER( a_, b_ );
-
-#elif 0
-
- /*
- * This code is nonportable. See comment below.
- *
- * However, on a platform where right-shift of a signed quantity fills
- * the leftmost bits by copying the sign bit, it might be faster.
- */
-
- FT_Long sa, sb;
- FT_UInt32 a, b;
-
-
- /*
- * This is a clever way of converting a signed number `a' into its
- * absolute value (stored back into `a') and its sign. The sign is
- * stored in `sa'; 0 means `a' was positive or zero, and -1 means `a'
- * was negative. (Similarly for `b' and `sb').
- *
- * Unfortunately, it doesn't work (at least not portably).
- *
- * It makes the assumption that right-shift on a negative signed value
- * fills the leftmost bits by copying the sign bit. This is wrong.
- * According to K&R 2nd ed, section `A7.8 Shift Operators' on page 206,
- * the result of right-shift of a negative signed value is
- * implementation-defined. At least one implementation fills the
- * leftmost bits with 0s (i.e., it is exactly the same as an unsigned
- * right shift). This means that when `a' is negative, `sa' ends up
- * with the value 1 rather than -1. After that, everything else goes
- * wrong.
- */
- sa = ( a_ >> ( sizeof ( a_ ) * 8 - 1 ) );
- a = ( a_ ^ sa ) - sa;
- sb = ( b_ >> ( sizeof ( b_ ) * 8 - 1 ) );
- b = ( b_ ^ sb ) - sb;
-
- a = (FT_UInt32)a_;
- b = (FT_UInt32)b_;
-
- if ( a + ( b >> 8 ) <= 8190UL )
- a = ( a * b + 0x8000U ) >> 16;
- else
- {
- FT_UInt32 al = a & 0xFFFFUL;
-
-
- a = ( a >> 16 ) * b + al * ( b >> 16 ) +
- ( ( al * ( b & 0xFFFFUL ) + 0x8000UL ) >> 16 );
- }
-
- sa ^= sb;
- a = ( a ^ sa ) - sa;
-
- return (FT_Long)a;
-
-#else /* 0 */
-
- FT_Int s = 1;
- FT_UInt32 a, b;
-
-
- /* XXX: this function does not allow 64-bit arguments */
-
- FT_MOVE_SIGN( a_, s );
- FT_MOVE_SIGN( b_, s );
-
- a = (FT_UInt32)a_;
- b = (FT_UInt32)b_;
-
- if ( a + ( b >> 8 ) <= 8190UL )
- a = ( a * b + 0x8000UL ) >> 16;
- else
- {
- FT_UInt32 al = a & 0xFFFFUL;
-
-
- a = ( a >> 16 ) * b + al * ( b >> 16 ) +
- ( ( al * ( b & 0xFFFFUL ) + 0x8000UL ) >> 16 );
- }
-
- a_ = (FT_Long)a;
-
- return s < 0 ? -a_ : a_;
-
-#endif /* 0 */
-
- }
-
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( FT_Long )
- FT_DivFix( FT_Long a_,
- FT_Long b_ )
- {
- FT_Int s = 1;
- FT_UInt32 a, b, q;
- FT_Long q_;
-
-
- /* XXX: this function does not allow 64-bit arguments */
-
- FT_MOVE_SIGN( a_, s );
- FT_MOVE_SIGN( b_, s );
-
- a = (FT_UInt32)a_;
- b = (FT_UInt32)b_;
-
- if ( b == 0 )
- {
- /* check for division by 0 */
- q = 0x7FFFFFFFUL;
- }
- else if ( a <= 65535UL - ( b >> 17 ) )
- {
- /* compute result directly */
- q = ( ( a << 16 ) + ( b >> 1 ) ) / b;
- }
- else
- {
- /* we need more bits; we have to do it by hand */
- FT_Int64 temp, temp2;
-
-
- temp.hi = a >> 16;
- temp.lo = a << 16;
- temp2.hi = 0;
- temp2.lo = b >> 1;
-
- FT_Add64( &temp, &temp2, &temp );
- q = ft_div64by32( temp.hi, temp.lo, b );
- }
-
- q_ = (FT_Long)q;
-
- return s < 0 ? -q_ : q_;
- }
-
-
-#endif /* !FT_LONG64 */
-
-
- /* documentation is in ftglyph.h */
-
- FT_EXPORT_DEF( void )
- FT_Matrix_Multiply( const FT_Matrix* a,
- FT_Matrix *b )
- {
- FT_Fixed xx, xy, yx, yy;
-
-
- if ( !a || !b )
- return;
-
- xx = FT_MulFix( a->xx, b->xx ) + FT_MulFix( a->xy, b->yx );
- xy = FT_MulFix( a->xx, b->xy ) + FT_MulFix( a->xy, b->yy );
- yx = FT_MulFix( a->yx, b->xx ) + FT_MulFix( a->yy, b->yx );
- yy = FT_MulFix( a->yx, b->xy ) + FT_MulFix( a->yy, b->yy );
-
- b->xx = xx; b->xy = xy;
- b->yx = yx; b->yy = yy;
- }
-
-
- /* documentation is in ftglyph.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Matrix_Invert( FT_Matrix* matrix )
- {
- FT_Pos delta, xx, yy;
-
-
- if ( !matrix )
- return FT_THROW( Invalid_Argument );
-
- /* compute discriminant */
- delta = FT_MulFix( matrix->xx, matrix->yy ) -
- FT_MulFix( matrix->xy, matrix->yx );
-
- if ( !delta )
- return FT_THROW( Invalid_Argument ); /* matrix can't be inverted */
-
- matrix->xy = - FT_DivFix( matrix->xy, delta );
- matrix->yx = - FT_DivFix( matrix->yx, delta );
-
- xx = matrix->xx;
- yy = matrix->yy;
-
- matrix->xx = FT_DivFix( yy, delta );
- matrix->yy = FT_DivFix( xx, delta );
-
- return FT_Err_Ok;
- }
-
-
- /* documentation is in ftcalc.h */
-
- FT_BASE_DEF( void )
- FT_Matrix_Multiply_Scaled( const FT_Matrix* a,
- FT_Matrix *b,
- FT_Long scaling )
- {
- FT_Fixed xx, xy, yx, yy;
-
- FT_Long val = 0x10000L * scaling;
-
-
- if ( !a || !b )
- return;
-
- xx = FT_MulDiv( a->xx, b->xx, val ) + FT_MulDiv( a->xy, b->yx, val );
- xy = FT_MulDiv( a->xx, b->xy, val ) + FT_MulDiv( a->xy, b->yy, val );
- yx = FT_MulDiv( a->yx, b->xx, val ) + FT_MulDiv( a->yy, b->yx, val );
- yy = FT_MulDiv( a->yx, b->xy, val ) + FT_MulDiv( a->yy, b->yy, val );
-
- b->xx = xx; b->xy = xy;
- b->yx = yx; b->yy = yy;
- }
-
-
- /* documentation is in ftcalc.h */
-
- FT_BASE_DEF( void )
- FT_Vector_Transform_Scaled( FT_Vector* vector,
- const FT_Matrix* matrix,
- FT_Long scaling )
- {
- FT_Pos xz, yz;
-
- FT_Long val = 0x10000L * scaling;
-
-
- if ( !vector || !matrix )
- return;
-
- xz = FT_MulDiv( vector->x, matrix->xx, val ) +
- FT_MulDiv( vector->y, matrix->xy, val );
-
- yz = FT_MulDiv( vector->x, matrix->yx, val ) +
- FT_MulDiv( vector->y, matrix->yy, val );
-
- vector->x = xz;
- vector->y = yz;
- }
-
-
- /* documentation is in ftcalc.h */
-
- FT_BASE_DEF( FT_UInt32 )
- FT_Vector_NormLen( FT_Vector* vector )
- {
- FT_Int32 x_ = vector->x;
- FT_Int32 y_ = vector->y;
- FT_Int32 b, z;
- FT_UInt32 x, y, u, v, l;
- FT_Int sx = 1, sy = 1, shift;
-
-
- FT_MOVE_SIGN( x_, sx );
- FT_MOVE_SIGN( y_, sy );
-
- x = (FT_UInt32)x_;
- y = (FT_UInt32)y_;
-
- /* trivial cases */
- if ( x == 0 )
- {
- if ( y > 0 )
- vector->y = sy * 0x10000;
- return y;
- }
- else if ( y == 0 )
- {
- if ( x > 0 )
- vector->x = sx * 0x10000;
- return x;
- }
-
- /* Estimate length and prenormalize by shifting so that */
- /* the new approximate length is between 2/3 and 4/3. */
- /* The magic constant 0xAAAAAAAAUL (2/3 of 2^32) helps */
- /* achieve this in 16.16 fixed-point representation. */
- l = x > y ? x + ( y >> 1 )
- : y + ( x >> 1 );
-
- shift = 31 - FT_MSB( l );
- shift -= 15 + ( l >= ( 0xAAAAAAAAUL >> shift ) );
-
- if ( shift > 0 )
- {
- x <<= shift;
- y <<= shift;
-
- /* re-estimate length for tiny vectors */
- l = x > y ? x + ( y >> 1 )
- : y + ( x >> 1 );
- }
- else
- {
- x >>= -shift;
- y >>= -shift;
- l >>= -shift;
- }
-
- /* lower linear approximation for reciprocal length minus one */
- b = 0x10000 - (FT_Int32)l;
-
- x_ = (FT_Int32)x;
- y_ = (FT_Int32)y;
-
- /* Newton's iterations */
- do
- {
- u = (FT_UInt32)( x_ + ( x_ * b >> 16 ) );
- v = (FT_UInt32)( y_ + ( y_ * b >> 16 ) );
-
- /* Normalized squared length in the parentheses approaches 2^32. */
- /* On two's complement systems, converting to signed gives the */
- /* difference with 2^32 even if the expression wraps around. */
- z = -(FT_Int32)( u * u + v * v ) / 0x200;
- z = z * ( ( 0x10000 + b ) >> 8 ) / 0x10000;
-
- b += z;
-
- } while ( z > 0 );
-
- vector->x = sx < 0 ? -(FT_Pos)u : (FT_Pos)u;
- vector->y = sy < 0 ? -(FT_Pos)v : (FT_Pos)v;
-
- /* Conversion to signed helps to recover from likely wrap around */
- /* in calculating the prenormalized length, because it gives the */
- /* correct difference with 2^32 on two's complement systems. */
- l = (FT_UInt32)( 0x10000 + (FT_Int32)( u * x + v * y ) / 0x10000 );
- if ( shift > 0 )
- l = ( l + ( 1 << ( shift - 1 ) ) ) >> shift;
- else
- l <<= -shift;
-
- return l;
- }
-
-
-#if 0
-
- /* documentation is in ftcalc.h */
-
- FT_BASE_DEF( FT_Int32 )
- FT_SqrtFixed( FT_Int32 x )
- {
- FT_UInt32 root, rem_hi, rem_lo, test_div;
- FT_Int count;
-
-
- root = 0;
-
- if ( x > 0 )
- {
- rem_hi = 0;
- rem_lo = (FT_UInt32)x;
- count = 24;
- do
- {
- rem_hi = ( rem_hi << 2 ) | ( rem_lo >> 30 );
- rem_lo <<= 2;
- root <<= 1;
- test_div = ( root << 1 ) + 1;
-
- if ( rem_hi >= test_div )
- {
- rem_hi -= test_div;
- root += 1;
- }
- } while ( --count );
- }
-
- return (FT_Int32)root;
- }
-
-#endif /* 0 */
-
-
- /* documentation is in ftcalc.h */
-
- FT_BASE_DEF( FT_Int )
- ft_corner_orientation( FT_Pos in_x,
- FT_Pos in_y,
- FT_Pos out_x,
- FT_Pos out_y )
- {
-#ifdef FT_LONG64
-
- FT_Int64 delta = (FT_Int64)in_x * out_y - (FT_Int64)in_y * out_x;
-
-
- return ( delta > 0 ) - ( delta < 0 );
-
-#else
-
- FT_Int result;
-
-
- if ( (FT_ULong)FT_ABS( in_x ) + (FT_ULong)FT_ABS( out_y ) <= 131071UL &&
- (FT_ULong)FT_ABS( in_y ) + (FT_ULong)FT_ABS( out_x ) <= 131071UL )
- {
- FT_Long z1 = in_x * out_y;
- FT_Long z2 = in_y * out_x;
-
-
- if ( z1 > z2 )
- result = +1;
- else if ( z1 < z2 )
- result = -1;
- else
- result = 0;
- }
- else /* products might overflow 32 bits */
- {
- FT_Int64 z1, z2;
-
-
- /* XXX: this function does not allow 64-bit arguments */
- ft_multo64( (FT_UInt32)in_x, (FT_UInt32)out_y, &z1 );
- ft_multo64( (FT_UInt32)in_y, (FT_UInt32)out_x, &z2 );
-
- if ( z1.hi > z2.hi )
- result = +1;
- else if ( z1.hi < z2.hi )
- result = -1;
- else if ( z1.lo > z2.lo )
- result = +1;
- else if ( z1.lo < z2.lo )
- result = -1;
- else
- result = 0;
- }
-
- /* XXX: only the sign of return value, +1/0/-1 must be used */
- return result;
-
-#endif
- }
-
-
- /* documentation is in ftcalc.h */
-
- FT_BASE_DEF( FT_Int )
- ft_corner_is_flat( FT_Pos in_x,
- FT_Pos in_y,
- FT_Pos out_x,
- FT_Pos out_y )
- {
- FT_Pos ax = in_x + out_x;
- FT_Pos ay = in_y + out_y;
-
- FT_Pos d_in, d_out, d_hypot;
-
-
- /* The idea of this function is to compare the length of the */
- /* hypotenuse with the `in' and `out' length. The `corner' */
- /* represented by `in' and `out' is flat if the hypotenuse's */
- /* length isn't too large. */
- /* */
- /* This approach has the advantage that the angle between */
- /* `in' and `out' is not checked. In case one of the two */
- /* vectors is `dominant', this is, much larger than the */
- /* other vector, we thus always have a flat corner. */
- /* */
- /* hypotenuse */
- /* x---------------------------x */
- /* \ / */
- /* \ / */
- /* in \ / out */
- /* \ / */
- /* o */
- /* Point */
-
- d_in = FT_HYPOT( in_x, in_y );
- d_out = FT_HYPOT( out_x, out_y );
- d_hypot = FT_HYPOT( ax, ay );
-
- /* now do a simple length comparison: */
- /* */
- /* d_in + d_out < 17/16 d_hypot */
-
- return ( d_in + d_out - d_hypot ) < ( d_hypot >> 4 );
- }
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/base/ftcid.c b/chromium/third_party/pdfium/third_party/freetype/src/base/ftcid.c
deleted file mode 100644
index 0734881b719..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/base/ftcid.c
+++ /dev/null
@@ -1,118 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftcid.c */
-/* */
-/* FreeType API for accessing CID font information. */
-/* */
-/* Copyright 2007-2015 by */
-/* Derek Clegg and Michael Toftdal. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_CID_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_SERVICE_CID_H
-
-
- /* documentation is in ftcid.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Get_CID_Registry_Ordering_Supplement( FT_Face face,
- const char* *registry,
- const char* *ordering,
- FT_Int *supplement)
- {
- FT_Error error;
- const char* r = NULL;
- const char* o = NULL;
- FT_Int s = 0;
-
-
- error = FT_ERR( Invalid_Argument );
-
- if ( face )
- {
- FT_Service_CID service;
-
-
- FT_FACE_FIND_SERVICE( face, service, CID );
-
- if ( service && service->get_ros )
- error = service->get_ros( face, &r, &o, &s );
- }
-
- if ( registry )
- *registry = r;
-
- if ( ordering )
- *ordering = o;
-
- if ( supplement )
- *supplement = s;
-
- return error;
- }
-
-
- FT_EXPORT_DEF( FT_Error )
- FT_Get_CID_Is_Internally_CID_Keyed( FT_Face face,
- FT_Bool *is_cid )
- {
- FT_Error error = FT_ERR( Invalid_Argument );
- FT_Bool ic = 0;
-
-
- if ( face )
- {
- FT_Service_CID service;
-
-
- FT_FACE_FIND_SERVICE( face, service, CID );
-
- if ( service && service->get_is_cid )
- error = service->get_is_cid( face, &ic);
- }
-
- if ( is_cid )
- *is_cid = ic;
-
- return error;
- }
-
-
- FT_EXPORT_DEF( FT_Error )
- FT_Get_CID_From_Glyph_Index( FT_Face face,
- FT_UInt glyph_index,
- FT_UInt *cid )
- {
- FT_Error error = FT_ERR( Invalid_Argument );
- FT_UInt c = 0;
-
-
- if ( face )
- {
- FT_Service_CID service;
-
-
- FT_FACE_FIND_SERVICE( face, service, CID );
-
- if ( service && service->get_cid_from_glyph_index )
- error = service->get_cid_from_glyph_index( face, glyph_index, &c);
- }
-
- if ( cid )
- *cid = c;
-
- return error;
- }
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/base/ftdbgmem.c b/chromium/third_party/pdfium/third_party/freetype/src/base/ftdbgmem.c
deleted file mode 100644
index 6f20313b345..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/base/ftdbgmem.c
+++ /dev/null
@@ -1,998 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftdbgmem.c */
-/* */
-/* Memory debugger (body). */
-/* */
-/* Copyright 2001-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_CONFIG_CONFIG_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_MEMORY_H
-#include FT_SYSTEM_H
-#include FT_ERRORS_H
-#include FT_TYPES_H
-
-
-#ifdef FT_DEBUG_MEMORY
-
-#define KEEPALIVE /* `Keep alive' means that freed blocks aren't released
- * to the heap. This is useful to detect double-frees
- * or weird heap corruption, but it uses large amounts of
- * memory, however.
- */
-
-#include FT_CONFIG_STANDARD_LIBRARY_H
-
- FT_BASE_DEF( const char* ) _ft_debug_file = NULL;
- FT_BASE_DEF( long ) _ft_debug_lineno = 0;
-
- extern void
- FT_DumpMemory( FT_Memory memory );
-
-
- typedef struct FT_MemSourceRec_* FT_MemSource;
- typedef struct FT_MemNodeRec_* FT_MemNode;
- typedef struct FT_MemTableRec_* FT_MemTable;
-
-
-#define FT_MEM_VAL( addr ) ( (FT_PtrDist)(FT_Pointer)( addr ) )
-
- /*
- * This structure holds statistics for a single allocation/release
- * site. This is useful to know where memory operations happen the
- * most.
- */
- typedef struct FT_MemSourceRec_
- {
- const char* file_name;
- long line_no;
-
- FT_Long cur_blocks; /* current number of allocated blocks */
- FT_Long max_blocks; /* max. number of allocated blocks */
- FT_Long all_blocks; /* total number of blocks allocated */
-
- FT_Long cur_size; /* current cumulative allocated size */
- FT_Long max_size; /* maximum cumulative allocated size */
- FT_Long all_size; /* total cumulative allocated size */
-
- FT_Long cur_max; /* current maximum allocated size */
-
- FT_UInt32 hash;
- FT_MemSource link;
-
- } FT_MemSourceRec;
-
-
- /*
- * We don't need a resizable array for the memory sources because
- * their number is pretty limited within FreeType.
- */
-#define FT_MEM_SOURCE_BUCKETS 128
-
- /*
- * This structure holds information related to a single allocated
- * memory block. If KEEPALIVE is defined, blocks that are freed by
- * FreeType are never released to the system. Instead, their `size'
- * field is set to `-size'. This is mainly useful to detect double
- * frees, at the price of a large memory footprint during execution.
- */
- typedef struct FT_MemNodeRec_
- {
- FT_Byte* address;
- FT_Long size; /* < 0 if the block was freed */
-
- FT_MemSource source;
-
-#ifdef KEEPALIVE
- const char* free_file_name;
- FT_Long free_line_no;
-#endif
-
- FT_MemNode link;
-
- } FT_MemNodeRec;
-
-
- /*
- * The global structure, containing compound statistics and all hash
- * tables.
- */
- typedef struct FT_MemTableRec_
- {
- FT_Long size;
- FT_Long nodes;
- FT_MemNode* buckets;
-
- FT_Long alloc_total;
- FT_Long alloc_current;
- FT_Long alloc_max;
- FT_Long alloc_count;
-
- FT_Bool bound_total;
- FT_Long alloc_total_max;
-
- FT_Bool bound_count;
- FT_Long alloc_count_max;
-
- FT_MemSource sources[FT_MEM_SOURCE_BUCKETS];
-
- FT_Bool keep_alive;
-
- FT_Memory memory;
- FT_Pointer memory_user;
- FT_Alloc_Func alloc;
- FT_Free_Func free;
- FT_Realloc_Func realloc;
-
- } FT_MemTableRec;
-
-
-#define FT_MEM_SIZE_MIN 7
-#define FT_MEM_SIZE_MAX 13845163
-
-#define FT_FILENAME( x ) ( (x) ? (x) : "unknown file" )
-
-
- /*
- * Prime numbers are ugly to handle. It would be better to implement
- * L-Hashing, which is 10% faster and doesn't require divisions.
- */
- static const FT_Int ft_mem_primes[] =
- {
- 7,
- 11,
- 19,
- 37,
- 73,
- 109,
- 163,
- 251,
- 367,
- 557,
- 823,
- 1237,
- 1861,
- 2777,
- 4177,
- 6247,
- 9371,
- 14057,
- 21089,
- 31627,
- 47431,
- 71143,
- 106721,
- 160073,
- 240101,
- 360163,
- 540217,
- 810343,
- 1215497,
- 1823231,
- 2734867,
- 4102283,
- 6153409,
- 9230113,
- 13845163,
- };
-
-
- static FT_Long
- ft_mem_closest_prime( FT_Long num )
- {
- size_t i;
-
-
- for ( i = 0;
- i < sizeof ( ft_mem_primes ) / sizeof ( ft_mem_primes[0] ); i++ )
- if ( ft_mem_primes[i] > num )
- return ft_mem_primes[i];
-
- return FT_MEM_SIZE_MAX;
- }
-
-
- static void
- ft_mem_debug_panic( const char* fmt,
- ... )
- {
- va_list ap;
-
-
- printf( "FreeType.Debug: " );
-
- va_start( ap, fmt );
- vprintf( fmt, ap );
- va_end( ap );
-
- printf( "\n" );
- exit( EXIT_FAILURE );
- }
-
-
- static FT_Pointer
- ft_mem_table_alloc( FT_MemTable table,
- FT_Long size )
- {
- FT_Memory memory = table->memory;
- FT_Pointer block;
-
-
- memory->user = table->memory_user;
- block = table->alloc( memory, size );
- memory->user = table;
-
- return block;
- }
-
-
- static void
- ft_mem_table_free( FT_MemTable table,
- FT_Pointer block )
- {
- FT_Memory memory = table->memory;
-
-
- memory->user = table->memory_user;
- table->free( memory, block );
- memory->user = table;
- }
-
-
- static void
- ft_mem_table_resize( FT_MemTable table )
- {
- FT_Long new_size;
-
-
- new_size = ft_mem_closest_prime( table->nodes );
- if ( new_size != table->size )
- {
- FT_MemNode* new_buckets;
- FT_Long i;
-
-
- new_buckets = (FT_MemNode *)
- ft_mem_table_alloc(
- table,
- new_size * (FT_Long)sizeof ( FT_MemNode ) );
- if ( new_buckets == NULL )
- return;
-
- FT_ARRAY_ZERO( new_buckets, new_size );
-
- for ( i = 0; i < table->size; i++ )
- {
- FT_MemNode node, next, *pnode;
- FT_PtrDist hash;
-
-
- node = table->buckets[i];
- while ( node )
- {
- next = node->link;
- hash = FT_MEM_VAL( node->address ) % (FT_PtrDist)new_size;
- pnode = new_buckets + hash;
-
- node->link = pnode[0];
- pnode[0] = node;
-
- node = next;
- }
- }
-
- if ( table->buckets )
- ft_mem_table_free( table, table->buckets );
-
- table->buckets = new_buckets;
- table->size = new_size;
- }
- }
-
-
- static FT_MemTable
- ft_mem_table_new( FT_Memory memory )
- {
- FT_MemTable table;
-
-
- table = (FT_MemTable)memory->alloc( memory, sizeof ( *table ) );
- if ( table == NULL )
- goto Exit;
-
- FT_ZERO( table );
-
- table->size = FT_MEM_SIZE_MIN;
- table->nodes = 0;
-
- table->memory = memory;
-
- table->memory_user = memory->user;
-
- table->alloc = memory->alloc;
- table->realloc = memory->realloc;
- table->free = memory->free;
-
- table->buckets = (FT_MemNode *)
- memory->alloc(
- memory,
- table->size * (FT_Long)sizeof ( FT_MemNode ) );
- if ( table->buckets )
- FT_ARRAY_ZERO( table->buckets, table->size );
- else
- {
- memory->free( memory, table );
- table = NULL;
- }
-
- Exit:
- return table;
- }
-
-
- static void
- ft_mem_table_destroy( FT_MemTable table )
- {
- FT_Long i;
- FT_Long leak_count = 0;
- FT_Long leaks = 0;
-
-
- FT_DumpMemory( table->memory );
-
- /* remove all blocks from the table, revealing leaked ones */
- for ( i = 0; i < table->size; i++ )
- {
- FT_MemNode *pnode = table->buckets + i, next, node = *pnode;
-
-
- while ( node )
- {
- next = node->link;
- node->link = NULL;
-
- if ( node->size > 0 )
- {
- printf(
- "leaked memory block at address %p, size %8ld in (%s:%ld)\n",
- node->address, node->size,
- FT_FILENAME( node->source->file_name ),
- node->source->line_no );
-
- leak_count++;
- leaks += node->size;
-
- ft_mem_table_free( table, node->address );
- }
-
- node->address = NULL;
- node->size = 0;
-
- ft_mem_table_free( table, node );
- node = next;
- }
- table->buckets[i] = NULL;
- }
-
- ft_mem_table_free( table, table->buckets );
- table->buckets = NULL;
-
- table->size = 0;
- table->nodes = 0;
-
- /* remove all sources */
- for ( i = 0; i < FT_MEM_SOURCE_BUCKETS; i++ )
- {
- FT_MemSource source, next;
-
-
- for ( source = table->sources[i]; source != NULL; source = next )
- {
- next = source->link;
- ft_mem_table_free( table, source );
- }
-
- table->sources[i] = NULL;
- }
-
- printf( "FreeType: total memory allocations = %ld\n",
- table->alloc_total );
- printf( "FreeType: maximum memory footprint = %ld\n",
- table->alloc_max );
-
- ft_mem_table_free( table, table );
-
- if ( leak_count > 0 )
- ft_mem_debug_panic(
- "FreeType: %ld bytes of memory leaked in %ld blocks\n",
- leaks, leak_count );
-
- printf( "FreeType: no memory leaks detected\n" );
- }
-
-
- static FT_MemNode*
- ft_mem_table_get_nodep( FT_MemTable table,
- FT_Byte* address )
- {
- FT_PtrDist hash;
- FT_MemNode *pnode, node;
-
-
- hash = FT_MEM_VAL( address );
- pnode = table->buckets + ( hash % (FT_PtrDist)table->size );
-
- for (;;)
- {
- node = pnode[0];
- if ( !node )
- break;
-
- if ( node->address == address )
- break;
-
- pnode = &node->link;
- }
- return pnode;
- }
-
-
- static FT_MemSource
- ft_mem_table_get_source( FT_MemTable table )
- {
- FT_UInt32 hash;
- FT_MemSource node, *pnode;
-
-
- /* cast to FT_PtrDist first since void* can be larger */
- /* than FT_UInt32 and GCC 4.1.1 emits a warning */
- hash = (FT_UInt32)(FT_PtrDist)(void*)_ft_debug_file +
- (FT_UInt32)( 5 * _ft_debug_lineno );
- pnode = &table->sources[hash % FT_MEM_SOURCE_BUCKETS];
-
- for ( ;; )
- {
- node = *pnode;
- if ( node == NULL )
- break;
-
- if ( node->file_name == _ft_debug_file &&
- node->line_no == _ft_debug_lineno )
- goto Exit;
-
- pnode = &node->link;
- }
-
- node = (FT_MemSource)ft_mem_table_alloc( table, sizeof ( *node ) );
- if ( node == NULL )
- ft_mem_debug_panic(
- "not enough memory to perform memory debugging\n" );
-
- node->file_name = _ft_debug_file;
- node->line_no = _ft_debug_lineno;
-
- node->cur_blocks = 0;
- node->max_blocks = 0;
- node->all_blocks = 0;
-
- node->cur_size = 0;
- node->max_size = 0;
- node->all_size = 0;
-
- node->cur_max = 0;
-
- node->link = NULL;
- node->hash = hash;
- *pnode = node;
-
- Exit:
- return node;
- }
-
-
- static void
- ft_mem_table_set( FT_MemTable table,
- FT_Byte* address,
- FT_Long size,
- FT_Long delta )
- {
- FT_MemNode *pnode, node;
-
-
- if ( table )
- {
- FT_MemSource source;
-
-
- pnode = ft_mem_table_get_nodep( table, address );
- node = *pnode;
- if ( node )
- {
- if ( node->size < 0 )
- {
- /* This block was already freed. Our memory is now completely */
- /* corrupted! */
- /* This can only happen in keep-alive mode. */
- ft_mem_debug_panic(
- "memory heap corrupted (allocating freed block)" );
- }
- else
- {
- /* This block was already allocated. This means that our memory */
- /* is also corrupted! */
- ft_mem_debug_panic(
- "memory heap corrupted (re-allocating allocated block at"
- " %p, of size %ld)\n"
- "org=%s:%d new=%s:%d\n",
- node->address, node->size,
- FT_FILENAME( node->source->file_name ), node->source->line_no,
- FT_FILENAME( _ft_debug_file ), _ft_debug_lineno );
- }
- }
-
- /* we need to create a new node in this table */
- node = (FT_MemNode)ft_mem_table_alloc( table, sizeof ( *node ) );
- if ( node == NULL )
- ft_mem_debug_panic( "not enough memory to run memory tests" );
-
- node->address = address;
- node->size = size;
- node->source = source = ft_mem_table_get_source( table );
-
- if ( delta == 0 )
- {
- /* this is an allocation */
- source->all_blocks++;
- source->cur_blocks++;
- if ( source->cur_blocks > source->max_blocks )
- source->max_blocks = source->cur_blocks;
- }
-
- if ( size > source->cur_max )
- source->cur_max = size;
-
- if ( delta != 0 )
- {
- /* we are growing or shrinking a reallocated block */
- source->cur_size += delta;
- table->alloc_current += delta;
- }
- else
- {
- /* we are allocating a new block */
- source->cur_size += size;
- table->alloc_current += size;
- }
-
- source->all_size += size;
-
- if ( source->cur_size > source->max_size )
- source->max_size = source->cur_size;
-
- node->free_file_name = NULL;
- node->free_line_no = 0;
-
- node->link = pnode[0];
-
- pnode[0] = node;
- table->nodes++;
-
- table->alloc_total += size;
-
- if ( table->alloc_current > table->alloc_max )
- table->alloc_max = table->alloc_current;
-
- if ( table->nodes * 3 < table->size ||
- table->size * 3 < table->nodes )
- ft_mem_table_resize( table );
- }
- }
-
-
- static void
- ft_mem_table_remove( FT_MemTable table,
- FT_Byte* address,
- FT_Long delta )
- {
- if ( table )
- {
- FT_MemNode *pnode, node;
-
-
- pnode = ft_mem_table_get_nodep( table, address );
- node = *pnode;
- if ( node )
- {
- FT_MemSource source;
-
-
- if ( node->size < 0 )
- ft_mem_debug_panic(
- "freeing memory block at %p more than once at (%s:%ld)\n"
- "block allocated at (%s:%ld) and released at (%s:%ld)",
- address,
- FT_FILENAME( _ft_debug_file ), _ft_debug_lineno,
- FT_FILENAME( node->source->file_name ), node->source->line_no,
- FT_FILENAME( node->free_file_name ), node->free_line_no );
-
- /* scramble the node's content for additional safety */
- FT_MEM_SET( address, 0xF3, node->size );
-
- if ( delta == 0 )
- {
- source = node->source;
-
- source->cur_blocks--;
- source->cur_size -= node->size;
-
- table->alloc_current -= node->size;
- }
-
- if ( table->keep_alive )
- {
- /* we simply invert the node's size to indicate that the node */
- /* was freed. */
- node->size = -node->size;
- node->free_file_name = _ft_debug_file;
- node->free_line_no = _ft_debug_lineno;
- }
- else
- {
- table->nodes--;
-
- *pnode = node->link;
-
- node->size = 0;
- node->source = NULL;
-
- ft_mem_table_free( table, node );
-
- if ( table->nodes * 3 < table->size ||
- table->size * 3 < table->nodes )
- ft_mem_table_resize( table );
- }
- }
- else
- ft_mem_debug_panic(
- "trying to free unknown block at %p in (%s:%ld)\n",
- address,
- FT_FILENAME( _ft_debug_file ), _ft_debug_lineno );
- }
- }
-
-
- static FT_Pointer
- ft_mem_debug_alloc( FT_Memory memory,
- FT_Long size )
- {
- FT_MemTable table = (FT_MemTable)memory->user;
- FT_Byte* block;
-
-
- if ( size <= 0 )
- ft_mem_debug_panic( "negative block size allocation (%ld)", size );
-
- /* return NULL if the maximum number of allocations was reached */
- if ( table->bound_count &&
- table->alloc_count >= table->alloc_count_max )
- return NULL;
-
- /* return NULL if this allocation would overflow the maximum heap size */
- if ( table->bound_total &&
- table->alloc_total_max - table->alloc_current > size )
- return NULL;
-
- block = (FT_Byte *)ft_mem_table_alloc( table, size );
- if ( block )
- {
- ft_mem_table_set( table, block, size, 0 );
-
- table->alloc_count++;
- }
-
- _ft_debug_file = "<unknown>";
- _ft_debug_lineno = 0;
-
- return (FT_Pointer)block;
- }
-
-
- static void
- ft_mem_debug_free( FT_Memory memory,
- FT_Pointer block )
- {
- FT_MemTable table = (FT_MemTable)memory->user;
-
-
- if ( block == NULL )
- ft_mem_debug_panic( "trying to free NULL in (%s:%ld)",
- FT_FILENAME( _ft_debug_file ),
- _ft_debug_lineno );
-
- ft_mem_table_remove( table, (FT_Byte*)block, 0 );
-
- if ( !table->keep_alive )
- ft_mem_table_free( table, block );
-
- table->alloc_count--;
-
- _ft_debug_file = "<unknown>";
- _ft_debug_lineno = 0;
- }
-
-
- static FT_Pointer
- ft_mem_debug_realloc( FT_Memory memory,
- FT_Long cur_size,
- FT_Long new_size,
- FT_Pointer block )
- {
- FT_MemTable table = (FT_MemTable)memory->user;
- FT_MemNode node, *pnode;
- FT_Pointer new_block;
- FT_Long delta;
-
- const char* file_name = FT_FILENAME( _ft_debug_file );
- FT_Long line_no = _ft_debug_lineno;
-
-
- /* unlikely, but possible */
- if ( new_size == cur_size )
- return block;
-
- /* the following is valid according to ANSI C */
-#if 0
- if ( block == NULL || cur_size == 0 )
- ft_mem_debug_panic( "trying to reallocate NULL in (%s:%ld)",
- file_name, line_no );
-#endif
-
- /* while the following is allowed in ANSI C also, we abort since */
- /* such case should be handled by FreeType. */
- if ( new_size <= 0 )
- ft_mem_debug_panic(
- "trying to reallocate %p to size 0 (current is %ld) in (%s:%ld)",
- block, cur_size, file_name, line_no );
-
- /* check `cur_size' value */
- pnode = ft_mem_table_get_nodep( table, (FT_Byte*)block );
- node = *pnode;
- if ( !node )
- ft_mem_debug_panic(
- "trying to reallocate unknown block at %p in (%s:%ld)",
- block, file_name, line_no );
-
- if ( node->size <= 0 )
- ft_mem_debug_panic(
- "trying to reallocate freed block at %p in (%s:%ld)",
- block, file_name, line_no );
-
- if ( node->size != cur_size )
- ft_mem_debug_panic( "invalid ft_realloc request for %p. cur_size is "
- "%ld instead of %ld in (%s:%ld)",
- block, cur_size, node->size, file_name, line_no );
-
- /* return NULL if the maximum number of allocations was reached */
- if ( table->bound_count &&
- table->alloc_count >= table->alloc_count_max )
- return NULL;
-
- delta = new_size - cur_size;
-
- /* return NULL if this allocation would overflow the maximum heap size */
- if ( delta > 0 &&
- table->bound_total &&
- table->alloc_current + delta > table->alloc_total_max )
- return NULL;
-
- new_block = (FT_Pointer)ft_mem_table_alloc( table, new_size );
- if ( new_block == NULL )
- return NULL;
-
- ft_mem_table_set( table, (FT_Byte*)new_block, new_size, delta );
-
- ft_memcpy( new_block, block, cur_size < new_size ? (size_t)cur_size
- : (size_t)new_size );
-
- ft_mem_table_remove( table, (FT_Byte*)block, delta );
-
- _ft_debug_file = "<unknown>";
- _ft_debug_lineno = 0;
-
- if ( !table->keep_alive )
- ft_mem_table_free( table, block );
-
- return new_block;
- }
-
-
- extern FT_Int
- ft_mem_debug_init( FT_Memory memory )
- {
- FT_MemTable table;
- FT_Int result = 0;
-
-
- if ( getenv( "FT2_DEBUG_MEMORY" ) )
- {
- table = ft_mem_table_new( memory );
- if ( table )
- {
- const char* p;
-
-
- memory->user = table;
- memory->alloc = ft_mem_debug_alloc;
- memory->realloc = ft_mem_debug_realloc;
- memory->free = ft_mem_debug_free;
-
- p = getenv( "FT2_ALLOC_TOTAL_MAX" );
- if ( p != NULL )
- {
- FT_Long total_max = ft_atol( p );
-
-
- if ( total_max > 0 )
- {
- table->bound_total = 1;
- table->alloc_total_max = total_max;
- }
- }
-
- p = getenv( "FT2_ALLOC_COUNT_MAX" );
- if ( p != NULL )
- {
- FT_Long total_count = ft_atol( p );
-
-
- if ( total_count > 0 )
- {
- table->bound_count = 1;
- table->alloc_count_max = total_count;
- }
- }
-
- p = getenv( "FT2_KEEP_ALIVE" );
- if ( p != NULL )
- {
- FT_Long keep_alive = ft_atol( p );
-
-
- if ( keep_alive > 0 )
- table->keep_alive = 1;
- }
-
- result = 1;
- }
- }
- return result;
- }
-
-
- extern void
- ft_mem_debug_done( FT_Memory memory )
- {
- FT_MemTable table = (FT_MemTable)memory->user;
-
-
- if ( table )
- {
- memory->free = table->free;
- memory->realloc = table->realloc;
- memory->alloc = table->alloc;
-
- ft_mem_table_destroy( table );
- memory->user = NULL;
- }
- }
-
-
- static int
- ft_mem_source_compare( const void* p1,
- const void* p2 )
- {
- FT_MemSource s1 = *(FT_MemSource*)p1;
- FT_MemSource s2 = *(FT_MemSource*)p2;
-
-
- if ( s2->max_size > s1->max_size )
- return 1;
- else if ( s2->max_size < s1->max_size )
- return -1;
- else
- return 0;
- }
-
-
- extern void
- FT_DumpMemory( FT_Memory memory )
- {
- FT_MemTable table = (FT_MemTable)memory->user;
-
-
- if ( table )
- {
- FT_MemSource* bucket = table->sources;
- FT_MemSource* limit = bucket + FT_MEM_SOURCE_BUCKETS;
- FT_MemSource* sources;
- FT_Int nn, count;
- const char* fmt;
-
-
- count = 0;
- for ( ; bucket < limit; bucket++ )
- {
- FT_MemSource source = *bucket;
-
-
- for ( ; source; source = source->link )
- count++;
- }
-
- sources = (FT_MemSource*)
- ft_mem_table_alloc(
- table, count * (FT_Long)sizeof ( *sources ) );
-
- count = 0;
- for ( bucket = table->sources; bucket < limit; bucket++ )
- {
- FT_MemSource source = *bucket;
-
-
- for ( ; source; source = source->link )
- sources[count++] = source;
- }
-
- ft_qsort( sources,
- (size_t)count,
- sizeof ( *sources ),
- ft_mem_source_compare );
-
- printf( "FreeType Memory Dump: "
- "current=%ld max=%ld total=%ld count=%ld\n",
- table->alloc_current, table->alloc_max,
- table->alloc_total, table->alloc_count );
- printf( " block block sizes sizes sizes source\n" );
- printf( " count high sum highsum max location\n" );
- printf( "-------------------------------------------------\n" );
-
- fmt = "%6ld %6ld %8ld %8ld %8ld %s:%d\n";
-
- for ( nn = 0; nn < count; nn++ )
- {
- FT_MemSource source = sources[nn];
-
-
- printf( fmt,
- source->cur_blocks, source->max_blocks,
- source->cur_size, source->max_size, source->cur_max,
- FT_FILENAME( source->file_name ),
- source->line_no );
- }
- printf( "------------------------------------------------\n" );
-
- ft_mem_table_free( table, sources );
- }
- }
-
-#else /* !FT_DEBUG_MEMORY */
-
- /* ANSI C doesn't like empty source files */
- typedef int _debug_mem_dummy;
-
-#endif /* !FT_DEBUG_MEMORY */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/base/ftdebug.c b/chromium/third_party/pdfium/third_party/freetype/src/base/ftdebug.c
deleted file mode 100644
index 03e18a86999..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/base/ftdebug.c
+++ /dev/null
@@ -1,266 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftdebug.c */
-/* */
-/* Debugging and logging component (body). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* This component contains various macros and functions used to ease the */
- /* debugging of the FreeType engine. Its main purpose is in assertion */
- /* checking, tracing, and error detection. */
- /* */
- /* There are now three debugging modes: */
- /* */
- /* - trace mode */
- /* */
- /* Error and trace messages are sent to the log file (which can be the */
- /* standard error output). */
- /* */
- /* - error mode */
- /* */
- /* Only error messages are generated. */
- /* */
- /* - release mode: */
- /* */
- /* No error message is sent or generated. The code is free from any */
- /* debugging parts. */
- /* */
- /*************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_INTERNAL_DEBUG_H
-
-
-#ifdef FT_DEBUG_LEVEL_ERROR
-
- /* documentation is in ftdebug.h */
-
- FT_BASE_DEF( void )
- FT_Message( const char* fmt,
- ... )
- {
- va_list ap;
-
-
- va_start( ap, fmt );
- vfprintf( stderr, fmt, ap );
- va_end( ap );
- }
-
-
- /* documentation is in ftdebug.h */
-
- FT_BASE_DEF( void )
- FT_Panic( const char* fmt,
- ... )
- {
- va_list ap;
-
-
- va_start( ap, fmt );
- vfprintf( stderr, fmt, ap );
- va_end( ap );
-
- exit( EXIT_FAILURE );
- }
-
-
- /* documentation is in ftdebug.h */
-
- FT_BASE_DEF( int )
- FT_Throw( FT_Error error,
- int line,
- const char* file )
- {
- FT_UNUSED( error );
- FT_UNUSED( line );
- FT_UNUSED( file );
-
- return 0;
- }
-
-#endif /* FT_DEBUG_LEVEL_ERROR */
-
-
-
-#ifdef FT_DEBUG_LEVEL_TRACE
-
- /* array of trace levels, initialized to 0 */
- int ft_trace_levels[trace_count];
-
-
- /* define array of trace toggle names */
-#define FT_TRACE_DEF( x ) #x ,
-
- static const char* ft_trace_toggles[trace_count + 1] =
- {
-#include FT_INTERNAL_TRACE_H
- NULL
- };
-
-#undef FT_TRACE_DEF
-
-
- /* documentation is in ftdebug.h */
-
- FT_BASE_DEF( FT_Int )
- FT_Trace_Get_Count( void )
- {
- return trace_count;
- }
-
-
- /* documentation is in ftdebug.h */
-
- FT_BASE_DEF( const char * )
- FT_Trace_Get_Name( FT_Int idx )
- {
- int max = FT_Trace_Get_Count();
-
-
- if ( idx < max )
- return ft_trace_toggles[idx];
- else
- return NULL;
- }
-
-
- /*************************************************************************/
- /* */
- /* Initialize the tracing sub-system. This is done by retrieving the */
- /* value of the `FT2_DEBUG' environment variable. It must be a list of */
- /* toggles, separated by spaces, `;', or `,'. Example: */
- /* */
- /* export FT2_DEBUG="any:3 memory:7 stream:5" */
- /* */
- /* This requests that all levels be set to 3, except the trace level for */
- /* the memory and stream components which are set to 7 and 5, */
- /* respectively. */
- /* */
- /* See the file `include/freetype/internal/fttrace.h' for details of */
- /* the available toggle names. */
- /* */
- /* The level must be between 0 and 7; 0 means quiet (except for serious */
- /* runtime errors), and 7 means _very_ verbose. */
- /* */
- FT_BASE_DEF( void )
- ft_debug_init( void )
- {
- const char* ft2_debug = getenv( "FT2_DEBUG" );
-
-
- if ( ft2_debug )
- {
- const char* p = ft2_debug;
- const char* q;
-
-
- for ( ; *p; p++ )
- {
- /* skip leading whitespace and separators */
- if ( *p == ' ' || *p == '\t' || *p == ',' || *p == ';' || *p == '=' )
- continue;
-
- /* read toggle name, followed by ':' */
- q = p;
- while ( *p && *p != ':' )
- p++;
-
- if ( !*p )
- break;
-
- if ( *p == ':' && p > q )
- {
- FT_Int n, i, len = (FT_Int)( p - q );
- FT_Int level = -1, found = -1;
-
-
- for ( n = 0; n < trace_count; n++ )
- {
- const char* toggle = ft_trace_toggles[n];
-
-
- for ( i = 0; i < len; i++ )
- {
- if ( toggle[i] != q[i] )
- break;
- }
-
- if ( i == len && toggle[i] == 0 )
- {
- found = n;
- break;
- }
- }
-
- /* read level */
- p++;
- if ( *p )
- {
- level = *p - '0';
- if ( level < 0 || level > 7 )
- level = -1;
- }
-
- if ( found >= 0 && level >= 0 )
- {
- if ( found == trace_any )
- {
- /* special case for `any' */
- for ( n = 0; n < trace_count; n++ )
- ft_trace_levels[n] = level;
- }
- else
- ft_trace_levels[found] = level;
- }
- }
- }
- }
- }
-
-
-#else /* !FT_DEBUG_LEVEL_TRACE */
-
-
- FT_BASE_DEF( void )
- ft_debug_init( void )
- {
- /* nothing */
- }
-
-
- FT_BASE_DEF( FT_Int )
- FT_Trace_Get_Count( void )
- {
- return 0;
- }
-
-
- FT_BASE_DEF( const char * )
- FT_Trace_Get_Name( FT_Int idx )
- {
- FT_UNUSED( idx );
-
- return NULL;
- }
-
-
-#endif /* !FT_DEBUG_LEVEL_TRACE */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/base/ftfntfmt.c b/chromium/third_party/pdfium/third_party/freetype/src/base/ftfntfmt.c
deleted file mode 100644
index 98e7431a2b9..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/base/ftfntfmt.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftfntfmt.c */
-/* */
-/* FreeType utility file for font formats (body). */
-/* */
-/* Copyright 2002-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_FONT_FORMATS_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_SERVICE_FONT_FORMAT_H
-
-
- /* documentation is in ftfntfmt.h */
-
- FT_EXPORT_DEF( const char* )
- FT_Get_Font_Format( FT_Face face )
- {
- const char* result = NULL;
-
-
- if ( face )
- FT_FACE_FIND_SERVICE( face, result, FONT_FORMAT );
-
- return result;
- }
-
-
- /* deprecated function name; retained for ABI compatibility */
-
- FT_EXPORT_DEF( const char* )
- FT_Get_X11_Font_Format( FT_Face face )
- {
- const char* result = NULL;
-
-
- if ( face )
- FT_FACE_FIND_SERVICE( face, result, FONT_FORMAT );
-
- return result;
- }
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/base/ftfstype.c b/chromium/third_party/pdfium/third_party/freetype/src/base/ftfstype.c
deleted file mode 100644
index cd3458f73e1..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/base/ftfstype.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftfstype.c */
-/* */
-/* FreeType utility file to access FSType data (body). */
-/* */
-/* Copyright 2008-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-#include <ft2build.h>
-#include FT_TYPE1_TABLES_H
-#include FT_TRUETYPE_TABLES_H
-#include FT_INTERNAL_SERVICE_H
-#include FT_SERVICE_POSTSCRIPT_INFO_H
-
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( FT_UShort )
- FT_Get_FSType_Flags( FT_Face face )
- {
- TT_OS2* os2;
-
-
- /* first, try to get the fs_type directly from the font */
- if ( face )
- {
- FT_Service_PsInfo service = NULL;
-
-
- FT_FACE_FIND_SERVICE( face, service, POSTSCRIPT_INFO );
-
- if ( service && service->ps_get_font_extra )
- {
- PS_FontExtraRec extra;
-
-
- if ( !service->ps_get_font_extra( face, &extra ) &&
- extra.fs_type != 0 )
- return extra.fs_type;
- }
- }
-
- /* look at FSType before fsType for Type42 */
-
- if ( ( os2 = (TT_OS2*)FT_Get_Sfnt_Table( face, FT_SFNT_OS2 ) ) != NULL &&
- os2->version != 0xFFFFU )
- return os2->fsType;
-
- return 0;
- }
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/base/ftgasp.c b/chromium/third_party/pdfium/third_party/freetype/src/base/ftgasp.c
deleted file mode 100644
index bbd257c4795..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/base/ftgasp.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftgasp.c */
-/* */
-/* Access of TrueType's `gasp' table (body). */
-/* */
-/* Copyright 2007-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_GASP_H
-#include FT_INTERNAL_TRUETYPE_TYPES_H
-
-
- FT_EXPORT_DEF( FT_Int )
- FT_Get_Gasp( FT_Face face,
- FT_UInt ppem )
- {
- FT_Int result = FT_GASP_NO_TABLE;
-
-
- if ( face && FT_IS_SFNT( face ) )
- {
- TT_Face ttface = (TT_Face)face;
-
-
- if ( ttface->gasp.numRanges > 0 )
- {
- TT_GaspRange range = ttface->gasp.gaspRanges;
- TT_GaspRange range_end = range + ttface->gasp.numRanges;
-
-
- while ( ppem > range->maxPPEM )
- {
- range++;
- if ( range >= range_end )
- goto Exit;
- }
-
- result = range->gaspFlag;
-
- /* ensure that we don't have spurious bits */
- if ( ttface->gasp.version == 0 )
- result &= 3;
- }
- }
- Exit:
- return result;
- }
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/base/ftgloadr.c b/chromium/third_party/pdfium/third_party/freetype/src/base/ftgloadr.c
deleted file mode 100644
index 7e28638b27f..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/base/ftgloadr.c
+++ /dev/null
@@ -1,406 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftgloadr.c */
-/* */
-/* The FreeType glyph loader (body). */
-/* */
-/* Copyright 2002-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_GLYPH_LOADER_H
-#include FT_INTERNAL_MEMORY_H
-#include FT_INTERNAL_OBJECTS_H
-
-#undef FT_COMPONENT
-#define FT_COMPONENT trace_gloader
-
-
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** *****/
- /***** G L Y P H L O A D E R *****/
- /***** *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
-
- /*************************************************************************/
- /* */
- /* The glyph loader is a simple object which is used to load a set of */
- /* glyphs easily. It is critical for the correct loading of composites. */
- /* */
- /* Ideally, one can see it as a stack of abstract `glyph' objects. */
- /* */
- /* loader.base Is really the bottom of the stack. It describes a */
- /* single glyph image made of the juxtaposition of */
- /* several glyphs (those `in the stack'). */
- /* */
- /* loader.current Describes the top of the stack, on which a new */
- /* glyph can be loaded. */
- /* */
- /* Rewind Clears the stack. */
- /* Prepare Set up `loader.current' for addition of a new glyph */
- /* image. */
- /* Add Add the `current' glyph image to the `base' one, */
- /* and prepare for another one. */
- /* */
- /* The glyph loader is now a base object. Each driver used to */
- /* re-implement it in one way or the other, which wasted code and */
- /* energy. */
- /* */
- /*************************************************************************/
-
-
- /* create a new glyph loader */
- FT_BASE_DEF( FT_Error )
- FT_GlyphLoader_New( FT_Memory memory,
- FT_GlyphLoader *aloader )
- {
- FT_GlyphLoader loader = NULL;
- FT_Error error;
-
-
- if ( !FT_NEW( loader ) )
- {
- loader->memory = memory;
- *aloader = loader;
- }
- return error;
- }
-
-
- /* rewind the glyph loader - reset counters to 0 */
- FT_BASE_DEF( void )
- FT_GlyphLoader_Rewind( FT_GlyphLoader loader )
- {
- FT_GlyphLoad base = &loader->base;
- FT_GlyphLoad current = &loader->current;
-
-
- base->outline.n_points = 0;
- base->outline.n_contours = 0;
- base->num_subglyphs = 0;
-
- *current = *base;
- }
-
-
- /* reset the glyph loader, frees all allocated tables */
- /* and starts from zero */
- FT_BASE_DEF( void )
- FT_GlyphLoader_Reset( FT_GlyphLoader loader )
- {
- FT_Memory memory = loader->memory;
-
-
- FT_FREE( loader->base.outline.points );
- FT_FREE( loader->base.outline.tags );
- FT_FREE( loader->base.outline.contours );
- FT_FREE( loader->base.extra_points );
- FT_FREE( loader->base.subglyphs );
-
- loader->base.extra_points2 = NULL;
-
- loader->max_points = 0;
- loader->max_contours = 0;
- loader->max_subglyphs = 0;
-
- FT_GlyphLoader_Rewind( loader );
- }
-
-
- /* delete a glyph loader */
- FT_BASE_DEF( void )
- FT_GlyphLoader_Done( FT_GlyphLoader loader )
- {
- if ( loader )
- {
- FT_Memory memory = loader->memory;
-
-
- FT_GlyphLoader_Reset( loader );
- FT_FREE( loader );
- }
- }
-
-
- /* re-adjust the `current' outline fields */
- static void
- FT_GlyphLoader_Adjust_Points( FT_GlyphLoader loader )
- {
- FT_Outline* base = &loader->base.outline;
- FT_Outline* current = &loader->current.outline;
-
-
- current->points = base->points + base->n_points;
- current->tags = base->tags + base->n_points;
- current->contours = base->contours + base->n_contours;
-
- /* handle extra points table - if any */
- if ( loader->use_extra )
- {
- loader->current.extra_points = loader->base.extra_points +
- base->n_points;
-
- loader->current.extra_points2 = loader->base.extra_points2 +
- base->n_points;
- }
- }
-
-
- FT_BASE_DEF( FT_Error )
- FT_GlyphLoader_CreateExtra( FT_GlyphLoader loader )
- {
- FT_Error error;
- FT_Memory memory = loader->memory;
-
-
- if ( !FT_NEW_ARRAY( loader->base.extra_points, 2 * loader->max_points ) )
- {
- loader->use_extra = 1;
- loader->base.extra_points2 = loader->base.extra_points +
- loader->max_points;
-
- FT_GlyphLoader_Adjust_Points( loader );
- }
- return error;
- }
-
-
- /* re-adjust the `current' subglyphs field */
- static void
- FT_GlyphLoader_Adjust_Subglyphs( FT_GlyphLoader loader )
- {
- FT_GlyphLoad base = &loader->base;
- FT_GlyphLoad current = &loader->current;
-
-
- current->subglyphs = base->subglyphs + base->num_subglyphs;
- }
-
-
- /* Ensure that we can add `n_points' and `n_contours' to our glyph. */
- /* This function reallocates its outline tables if necessary. Note that */
- /* it DOESN'T change the number of points within the loader! */
- /* */
- FT_BASE_DEF( FT_Error )
- FT_GlyphLoader_CheckPoints( FT_GlyphLoader loader,
- FT_UInt n_points,
- FT_UInt n_contours )
- {
- FT_Memory memory = loader->memory;
- FT_Error error = FT_Err_Ok;
- FT_Outline* base = &loader->base.outline;
- FT_Outline* current = &loader->current.outline;
- FT_Bool adjust = 0;
-
- FT_UInt new_max, old_max;
-
-
- /* check points & tags */
- new_max = (FT_UInt)base->n_points + (FT_UInt)current->n_points +
- n_points;
- old_max = loader->max_points;
-
- if ( new_max > old_max )
- {
- new_max = FT_PAD_CEIL( new_max, 8 );
-
- if ( new_max > FT_OUTLINE_POINTS_MAX )
- return FT_THROW( Array_Too_Large );
-
- if ( FT_RENEW_ARRAY( base->points, old_max, new_max ) ||
- FT_RENEW_ARRAY( base->tags, old_max, new_max ) )
- goto Exit;
-
- if ( loader->use_extra )
- {
- if ( FT_RENEW_ARRAY( loader->base.extra_points,
- old_max * 2, new_max * 2 ) )
- goto Exit;
-
- FT_ARRAY_MOVE( loader->base.extra_points + new_max,
- loader->base.extra_points + old_max,
- old_max );
-
- loader->base.extra_points2 = loader->base.extra_points + new_max;
- }
-
- adjust = 1;
- loader->max_points = new_max;
- }
-
- /* check contours */
- old_max = loader->max_contours;
- new_max = (FT_UInt)base->n_contours + (FT_UInt)current->n_contours +
- n_contours;
- if ( new_max > old_max )
- {
- new_max = FT_PAD_CEIL( new_max, 4 );
-
- if ( new_max > FT_OUTLINE_CONTOURS_MAX )
- return FT_THROW( Array_Too_Large );
-
- if ( FT_RENEW_ARRAY( base->contours, old_max, new_max ) )
- goto Exit;
-
- adjust = 1;
- loader->max_contours = new_max;
- }
-
- if ( adjust )
- FT_GlyphLoader_Adjust_Points( loader );
-
- Exit:
- if ( error )
- FT_GlyphLoader_Reset( loader );
-
- return error;
- }
-
-
- /* Ensure that we can add `n_subglyphs' to our glyph. this function */
- /* reallocates its subglyphs table if necessary. Note that it DOES */
- /* NOT change the number of subglyphs within the loader! */
- /* */
- FT_BASE_DEF( FT_Error )
- FT_GlyphLoader_CheckSubGlyphs( FT_GlyphLoader loader,
- FT_UInt n_subs )
- {
- FT_Memory memory = loader->memory;
- FT_Error error = FT_Err_Ok;
- FT_UInt new_max, old_max;
-
- FT_GlyphLoad base = &loader->base;
- FT_GlyphLoad current = &loader->current;
-
-
- new_max = base->num_subglyphs + current->num_subglyphs + n_subs;
- old_max = loader->max_subglyphs;
- if ( new_max > old_max )
- {
- new_max = FT_PAD_CEIL( new_max, 2 );
- if ( FT_RENEW_ARRAY( base->subglyphs, old_max, new_max ) )
- goto Exit;
-
- loader->max_subglyphs = new_max;
-
- FT_GlyphLoader_Adjust_Subglyphs( loader );
- }
-
- Exit:
- return error;
- }
-
-
- /* prepare loader for the addition of a new glyph on top of the base one */
- FT_BASE_DEF( void )
- FT_GlyphLoader_Prepare( FT_GlyphLoader loader )
- {
- FT_GlyphLoad current = &loader->current;
-
-
- current->outline.n_points = 0;
- current->outline.n_contours = 0;
- current->num_subglyphs = 0;
-
- FT_GlyphLoader_Adjust_Points ( loader );
- FT_GlyphLoader_Adjust_Subglyphs( loader );
- }
-
-
- /* add current glyph to the base image -- and prepare for another */
- FT_BASE_DEF( void )
- FT_GlyphLoader_Add( FT_GlyphLoader loader )
- {
- FT_GlyphLoad base;
- FT_GlyphLoad current;
-
- FT_Int n_curr_contours;
- FT_Int n_base_points;
- FT_Int n;
-
-
- if ( !loader )
- return;
-
- base = &loader->base;
- current = &loader->current;
-
- n_curr_contours = current->outline.n_contours;
- n_base_points = base->outline.n_points;
-
- base->outline.n_points =
- (short)( base->outline.n_points + current->outline.n_points );
- base->outline.n_contours =
- (short)( base->outline.n_contours + current->outline.n_contours );
-
- base->num_subglyphs += current->num_subglyphs;
-
- /* adjust contours count in newest outline */
- for ( n = 0; n < n_curr_contours; n++ )
- current->outline.contours[n] =
- (short)( current->outline.contours[n] + n_base_points );
-
- /* prepare for another new glyph image */
- FT_GlyphLoader_Prepare( loader );
- }
-
-
- FT_BASE_DEF( FT_Error )
- FT_GlyphLoader_CopyPoints( FT_GlyphLoader target,
- FT_GlyphLoader source )
- {
- FT_Error error;
- FT_UInt num_points = (FT_UInt)source->base.outline.n_points;
- FT_UInt num_contours = (FT_UInt)source->base.outline.n_contours;
-
-
- error = FT_GlyphLoader_CheckPoints( target, num_points, num_contours );
- if ( !error )
- {
- FT_Outline* out = &target->base.outline;
- FT_Outline* in = &source->base.outline;
-
-
- FT_ARRAY_COPY( out->points, in->points,
- num_points );
- FT_ARRAY_COPY( out->tags, in->tags,
- num_points );
- FT_ARRAY_COPY( out->contours, in->contours,
- num_contours );
-
- /* do we need to copy the extra points? */
- if ( target->use_extra && source->use_extra )
- {
- FT_ARRAY_COPY( target->base.extra_points, source->base.extra_points,
- num_points );
- FT_ARRAY_COPY( target->base.extra_points2, source->base.extra_points2,
- num_points );
- }
-
- out->n_points = (short)num_points;
- out->n_contours = (short)num_contours;
-
- FT_GlyphLoader_Adjust_Points( target );
- }
-
- return error;
- }
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/base/ftglyph.c b/chromium/third_party/pdfium/third_party/freetype/src/base/ftglyph.c
deleted file mode 100644
index cb7fc37787e..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/base/ftglyph.c
+++ /dev/null
@@ -1,629 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftglyph.c */
-/* */
-/* FreeType convenience functions to handle glyphs (body). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
- /*************************************************************************/
- /* */
- /* This file contains the definition of several convenience functions */
- /* that can be used by client applications to easily retrieve glyph */
- /* bitmaps and outlines from a given face. */
- /* */
- /* These functions should be optional if you are writing a font server */
- /* or text layout engine on top of FreeType. However, they are pretty */
- /* handy for many other simple uses of the library. */
- /* */
- /*************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-
-#include FT_GLYPH_H
-#include FT_OUTLINE_H
-#include FT_BITMAP_H
-#include FT_INTERNAL_OBJECTS_H
-
-#include "basepic.h"
-
- /*************************************************************************/
- /* */
- /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
- /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
- /* messages during execution. */
- /* */
-#undef FT_COMPONENT
-#define FT_COMPONENT trace_glyph
-
-
- /*************************************************************************/
- /*************************************************************************/
- /**** ****/
- /**** FT_BitmapGlyph support ****/
- /**** ****/
- /*************************************************************************/
- /*************************************************************************/
-
- FT_CALLBACK_DEF( FT_Error )
- ft_bitmap_glyph_init( FT_Glyph bitmap_glyph,
- FT_GlyphSlot slot )
- {
- FT_BitmapGlyph glyph = (FT_BitmapGlyph)bitmap_glyph;
- FT_Error error = FT_Err_Ok;
- FT_Library library = FT_GLYPH( glyph )->library;
-
-
- if ( slot->format != FT_GLYPH_FORMAT_BITMAP )
- {
- error = FT_THROW( Invalid_Glyph_Format );
- goto Exit;
- }
-
- glyph->left = slot->bitmap_left;
- glyph->top = slot->bitmap_top;
-
- /* do lazy copying whenever possible */
- if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP )
- {
- glyph->bitmap = slot->bitmap;
- slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP;
- }
- else
- {
- FT_Bitmap_Init( &glyph->bitmap );
- error = FT_Bitmap_Copy( library, &slot->bitmap, &glyph->bitmap );
- }
-
- Exit:
- return error;
- }
-
-
- FT_CALLBACK_DEF( FT_Error )
- ft_bitmap_glyph_copy( FT_Glyph bitmap_source,
- FT_Glyph bitmap_target )
- {
- FT_Library library = bitmap_source->library;
- FT_BitmapGlyph source = (FT_BitmapGlyph)bitmap_source;
- FT_BitmapGlyph target = (FT_BitmapGlyph)bitmap_target;
-
-
- target->left = source->left;
- target->top = source->top;
-
- return FT_Bitmap_Copy( library, &source->bitmap, &target->bitmap );
- }
-
-
- FT_CALLBACK_DEF( void )
- ft_bitmap_glyph_done( FT_Glyph bitmap_glyph )
- {
- FT_BitmapGlyph glyph = (FT_BitmapGlyph)bitmap_glyph;
- FT_Library library = FT_GLYPH( glyph )->library;
-
-
- FT_Bitmap_Done( library, &glyph->bitmap );
- }
-
-
- FT_CALLBACK_DEF( void )
- ft_bitmap_glyph_bbox( FT_Glyph bitmap_glyph,
- FT_BBox* cbox )
- {
- FT_BitmapGlyph glyph = (FT_BitmapGlyph)bitmap_glyph;
-
-
- cbox->xMin = glyph->left << 6;
- cbox->xMax = cbox->xMin + (FT_Pos)( glyph->bitmap.width << 6 );
- cbox->yMax = glyph->top << 6;
- cbox->yMin = cbox->yMax - (FT_Pos)( glyph->bitmap.rows << 6 );
- }
-
-
- FT_DEFINE_GLYPH(ft_bitmap_glyph_class,
- sizeof ( FT_BitmapGlyphRec ),
- FT_GLYPH_FORMAT_BITMAP,
-
- ft_bitmap_glyph_init,
- ft_bitmap_glyph_done,
- ft_bitmap_glyph_copy,
- 0, /* FT_Glyph_TransformFunc */
- ft_bitmap_glyph_bbox,
- 0 /* FT_Glyph_PrepareFunc */
- )
-
-
- /*************************************************************************/
- /*************************************************************************/
- /**** ****/
- /**** FT_OutlineGlyph support ****/
- /**** ****/
- /*************************************************************************/
- /*************************************************************************/
-
-
- FT_CALLBACK_DEF( FT_Error )
- ft_outline_glyph_init( FT_Glyph outline_glyph,
- FT_GlyphSlot slot )
- {
- FT_OutlineGlyph glyph = (FT_OutlineGlyph)outline_glyph;
- FT_Error error = FT_Err_Ok;
- FT_Library library = FT_GLYPH( glyph )->library;
- FT_Outline* source = &slot->outline;
- FT_Outline* target = &glyph->outline;
-
-
- /* check format in glyph slot */
- if ( slot->format != FT_GLYPH_FORMAT_OUTLINE )
- {
- error = FT_THROW( Invalid_Glyph_Format );
- goto Exit;
- }
-
- /* allocate new outline */
- error = FT_Outline_New( library,
- (FT_UInt)source->n_points,
- source->n_contours,
- &glyph->outline );
- if ( error )
- goto Exit;
-
- FT_Outline_Copy( source, target );
-
- Exit:
- return error;
- }
-
-
- FT_CALLBACK_DEF( void )
- ft_outline_glyph_done( FT_Glyph outline_glyph )
- {
- FT_OutlineGlyph glyph = (FT_OutlineGlyph)outline_glyph;
-
-
- FT_Outline_Done( FT_GLYPH( glyph )->library, &glyph->outline );
- }
-
-
- FT_CALLBACK_DEF( FT_Error )
- ft_outline_glyph_copy( FT_Glyph outline_source,
- FT_Glyph outline_target )
- {
- FT_OutlineGlyph source = (FT_OutlineGlyph)outline_source;
- FT_OutlineGlyph target = (FT_OutlineGlyph)outline_target;
- FT_Error error;
- FT_Library library = FT_GLYPH( source )->library;
-
-
- error = FT_Outline_New( library,
- (FT_UInt)source->outline.n_points,
- source->outline.n_contours,
- &target->outline );
- if ( !error )
- FT_Outline_Copy( &source->outline, &target->outline );
-
- return error;
- }
-
-
- FT_CALLBACK_DEF( void )
- ft_outline_glyph_transform( FT_Glyph outline_glyph,
- const FT_Matrix* matrix,
- const FT_Vector* delta )
- {
- FT_OutlineGlyph glyph = (FT_OutlineGlyph)outline_glyph;
-
-
- if ( matrix )
- FT_Outline_Transform( &glyph->outline, matrix );
-
- if ( delta )
- FT_Outline_Translate( &glyph->outline, delta->x, delta->y );
- }
-
-
- FT_CALLBACK_DEF( void )
- ft_outline_glyph_bbox( FT_Glyph outline_glyph,
- FT_BBox* bbox )
- {
- FT_OutlineGlyph glyph = (FT_OutlineGlyph)outline_glyph;
-
-
- FT_Outline_Get_CBox( &glyph->outline, bbox );
- }
-
-
- FT_CALLBACK_DEF( FT_Error )
- ft_outline_glyph_prepare( FT_Glyph outline_glyph,
- FT_GlyphSlot slot )
- {
- FT_OutlineGlyph glyph = (FT_OutlineGlyph)outline_glyph;
-
-
- slot->format = FT_GLYPH_FORMAT_OUTLINE;
- slot->outline = glyph->outline;
- slot->outline.flags &= ~FT_OUTLINE_OWNER;
-
- return FT_Err_Ok;
- }
-
-
- FT_DEFINE_GLYPH( ft_outline_glyph_class,
- sizeof ( FT_OutlineGlyphRec ),
- FT_GLYPH_FORMAT_OUTLINE,
-
- ft_outline_glyph_init,
- ft_outline_glyph_done,
- ft_outline_glyph_copy,
- ft_outline_glyph_transform,
- ft_outline_glyph_bbox,
- ft_outline_glyph_prepare
- )
-
-
- /*************************************************************************/
- /*************************************************************************/
- /**** ****/
- /**** FT_Glyph class and API ****/
- /**** ****/
- /*************************************************************************/
- /*************************************************************************/
-
- static FT_Error
- ft_new_glyph( FT_Library library,
- const FT_Glyph_Class* clazz,
- FT_Glyph* aglyph )
- {
- FT_Memory memory = library->memory;
- FT_Error error;
- FT_Glyph glyph = NULL;
-
-
- *aglyph = NULL;
-
- if ( !FT_ALLOC( glyph, clazz->glyph_size ) )
- {
- glyph->library = library;
- glyph->clazz = clazz;
- glyph->format = clazz->glyph_format;
-
- *aglyph = glyph;
- }
-
- return error;
- }
-
-
- /* documentation is in ftglyph.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Glyph_Copy( FT_Glyph source,
- FT_Glyph *target )
- {
- FT_Glyph copy;
- FT_Error error;
- const FT_Glyph_Class* clazz;
-
-
- /* check arguments */
- if ( !target || !source || !source->clazz )
- {
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- *target = NULL;
-
- if ( !source || !source->clazz )
- {
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- clazz = source->clazz;
- error = ft_new_glyph( source->library, clazz, &copy );
- if ( error )
- goto Exit;
-
- copy->advance = source->advance;
- copy->format = source->format;
-
- if ( clazz->glyph_copy )
- error = clazz->glyph_copy( source, copy );
-
- if ( error )
- FT_Done_Glyph( copy );
- else
- *target = copy;
-
- Exit:
- return error;
- }
-
-
- /* documentation is in ftglyph.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Get_Glyph( FT_GlyphSlot slot,
- FT_Glyph *aglyph )
- {
- FT_Library library;
- FT_Error error;
- FT_Glyph glyph;
-
- const FT_Glyph_Class* clazz = NULL;
-
-
- if ( !slot )
- return FT_THROW( Invalid_Slot_Handle );
-
- library = slot->library;
-
- if ( !aglyph )
- return FT_THROW( Invalid_Argument );
-
- /* if it is a bitmap, that's easy :-) */
- if ( slot->format == FT_GLYPH_FORMAT_BITMAP )
- clazz = FT_BITMAP_GLYPH_CLASS_GET;
-
- /* if it is an outline */
- else if ( slot->format == FT_GLYPH_FORMAT_OUTLINE )
- clazz = FT_OUTLINE_GLYPH_CLASS_GET;
-
- else
- {
- /* try to find a renderer that supports the glyph image format */
- FT_Renderer render = FT_Lookup_Renderer( library, slot->format, 0 );
-
-
- if ( render )
- clazz = &render->glyph_class;
- }
-
- if ( !clazz )
- {
- error = FT_THROW( Invalid_Glyph_Format );
- goto Exit;
- }
-
- /* create FT_Glyph object */
- error = ft_new_glyph( library, clazz, &glyph );
- if ( error )
- goto Exit;
-
- /* copy advance while converting it to 16.16 format */
- glyph->advance.x = slot->advance.x << 10;
- glyph->advance.y = slot->advance.y << 10;
-
- /* now import the image from the glyph slot */
- error = clazz->glyph_init( glyph, slot );
-
- /* if an error occurred, destroy the glyph */
- if ( error )
- FT_Done_Glyph( glyph );
- else
- *aglyph = glyph;
-
- Exit:
- return error;
- }
-
-
- /* documentation is in ftglyph.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Glyph_Transform( FT_Glyph glyph,
- FT_Matrix* matrix,
- FT_Vector* delta )
- {
- FT_Error error = FT_Err_Ok;
-
-
- if ( !glyph || !glyph->clazz )
- error = FT_THROW( Invalid_Argument );
- else
- {
- const FT_Glyph_Class* clazz = glyph->clazz;
-
-
- if ( clazz->glyph_transform )
- {
- /* transform glyph image */
- clazz->glyph_transform( glyph, matrix, delta );
-
- /* transform advance vector */
- if ( matrix )
- FT_Vector_Transform( &glyph->advance, matrix );
- }
- else
- error = FT_THROW( Invalid_Glyph_Format );
- }
- return error;
- }
-
-
- /* documentation is in ftglyph.h */
-
- FT_EXPORT_DEF( void )
- FT_Glyph_Get_CBox( FT_Glyph glyph,
- FT_UInt bbox_mode,
- FT_BBox *acbox )
- {
- const FT_Glyph_Class* clazz;
-
-
- if ( !acbox )
- return;
-
- acbox->xMin = acbox->yMin = acbox->xMax = acbox->yMax = 0;
-
- if ( !glyph || !glyph->clazz )
- return;
-
- clazz = glyph->clazz;
- if ( !clazz->glyph_bbox )
- return;
-
- /* retrieve bbox in 26.6 coordinates */
- clazz->glyph_bbox( glyph, acbox );
-
- /* perform grid fitting if needed */
- if ( bbox_mode == FT_GLYPH_BBOX_GRIDFIT ||
- bbox_mode == FT_GLYPH_BBOX_PIXELS )
- {
- acbox->xMin = FT_PIX_FLOOR( acbox->xMin );
- acbox->yMin = FT_PIX_FLOOR( acbox->yMin );
- acbox->xMax = FT_PIX_CEIL( acbox->xMax );
- acbox->yMax = FT_PIX_CEIL( acbox->yMax );
- }
-
- /* convert to integer pixels if needed */
- if ( bbox_mode == FT_GLYPH_BBOX_TRUNCATE ||
- bbox_mode == FT_GLYPH_BBOX_PIXELS )
- {
- acbox->xMin >>= 6;
- acbox->yMin >>= 6;
- acbox->xMax >>= 6;
- acbox->yMax >>= 6;
- }
- }
-
-
- /* documentation is in ftglyph.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Glyph_To_Bitmap( FT_Glyph* the_glyph,
- FT_Render_Mode render_mode,
- FT_Vector* origin,
- FT_Bool destroy )
- {
- FT_GlyphSlotRec dummy;
- FT_GlyphSlot_InternalRec dummy_internal;
- FT_Error error = FT_Err_Ok;
- FT_Glyph b, glyph;
- FT_BitmapGlyph bitmap = NULL;
- const FT_Glyph_Class* clazz;
-
- /* FT_BITMAP_GLYPH_CLASS_GET dereferences `library' in PIC mode */
- FT_Library library;
-
-
- /* check argument */
- if ( !the_glyph )
- goto Bad;
- glyph = *the_glyph;
- if ( !glyph )
- goto Bad;
-
- clazz = glyph->clazz;
- library = glyph->library;
- if ( !library || !clazz )
- goto Bad;
-
- /* when called with a bitmap glyph, do nothing and return successfully */
- if ( clazz == FT_BITMAP_GLYPH_CLASS_GET )
- goto Exit;
-
- if ( !clazz->glyph_prepare )
- goto Bad;
-
- /* we render the glyph into a glyph bitmap using a `dummy' glyph slot */
- /* then calling FT_Render_Glyph_Internal() */
-
- FT_MEM_ZERO( &dummy, sizeof ( dummy ) );
- FT_MEM_ZERO( &dummy_internal, sizeof ( dummy_internal ) );
- dummy.internal = &dummy_internal;
- dummy.library = library;
- dummy.format = clazz->glyph_format;
-
- /* create result bitmap glyph */
- error = ft_new_glyph( library, FT_BITMAP_GLYPH_CLASS_GET, &b );
- if ( error )
- goto Exit;
- bitmap = (FT_BitmapGlyph)b;
-
-#if 1
- /* if `origin' is set, translate the glyph image */
- if ( origin )
- FT_Glyph_Transform( glyph, 0, origin );
-#else
- FT_UNUSED( origin );
-#endif
-
- /* prepare dummy slot for rendering */
- error = clazz->glyph_prepare( glyph, &dummy );
- if ( !error )
- error = FT_Render_Glyph_Internal( glyph->library, &dummy, render_mode );
-
-#if 1
- if ( !destroy && origin )
- {
- FT_Vector v;
-
-
- v.x = -origin->x;
- v.y = -origin->y;
- FT_Glyph_Transform( glyph, 0, &v );
- }
-#endif
-
- if ( error )
- goto Exit;
-
- /* in case of success, copy the bitmap to the glyph bitmap */
- error = ft_bitmap_glyph_init( (FT_Glyph)bitmap, &dummy );
- if ( error )
- goto Exit;
-
- /* copy advance */
- bitmap->root.advance = glyph->advance;
-
- if ( destroy )
- FT_Done_Glyph( glyph );
-
- *the_glyph = FT_GLYPH( bitmap );
-
- Exit:
- if ( error && bitmap )
- FT_Done_Glyph( FT_GLYPH( bitmap ) );
-
- return error;
-
- Bad:
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
-
- /* documentation is in ftglyph.h */
-
- FT_EXPORT_DEF( void )
- FT_Done_Glyph( FT_Glyph glyph )
- {
- if ( glyph )
- {
- FT_Memory memory = glyph->library->memory;
- const FT_Glyph_Class* clazz = glyph->clazz;
-
-
- if ( clazz->glyph_done )
- clazz->glyph_done( glyph );
-
- FT_FREE( glyph );
- }
- }
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/base/ftgxval.c b/chromium/third_party/pdfium/third_party/freetype/src/base/ftgxval.c
deleted file mode 100644
index 58868f2e86b..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/base/ftgxval.c
+++ /dev/null
@@ -1,142 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftgxval.c */
-/* */
-/* FreeType API for validating TrueTyepGX/AAT tables (body). */
-/* */
-/* Copyright 2004-2015 by */
-/* Masatake YAMATO, Redhat K.K, */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-/***************************************************************************/
-/* */
-/* gxvalid is derived from both gxlayout module and otvalid module. */
-/* Development of gxlayout is supported by the Information-technology */
-/* Promotion Agency(IPA), Japan. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-
-#include FT_INTERNAL_OBJECTS_H
-#include FT_SERVICE_GX_VALIDATE_H
-
-
- /* documentation is in ftgxval.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_TrueTypeGX_Validate( FT_Face face,
- FT_UInt validation_flags,
- FT_Bytes tables[FT_VALIDATE_GX_LENGTH],
- FT_UInt table_length )
- {
- FT_Service_GXvalidate service;
- FT_Error error;
-
-
- if ( !face )
- {
- error = FT_THROW( Invalid_Face_Handle );
- goto Exit;
- }
-
- if ( !tables )
- {
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- FT_FACE_FIND_GLOBAL_SERVICE( face, service, GX_VALIDATE );
-
- if ( service )
- error = service->validate( face,
- validation_flags,
- tables,
- table_length );
- else
- error = FT_THROW( Unimplemented_Feature );
-
- Exit:
- return error;
- }
-
-
- FT_EXPORT_DEF( void )
- FT_TrueTypeGX_Free( FT_Face face,
- FT_Bytes table )
- {
- FT_Memory memory;
-
-
- if ( !face )
- return;
-
- memory = FT_FACE_MEMORY( face );
-
- FT_FREE( table );
- }
-
-
- FT_EXPORT_DEF( FT_Error )
- FT_ClassicKern_Validate( FT_Face face,
- FT_UInt validation_flags,
- FT_Bytes *ckern_table )
- {
- FT_Service_CKERNvalidate service;
- FT_Error error;
-
-
- if ( !face )
- {
- error = FT_THROW( Invalid_Face_Handle );
- goto Exit;
- }
-
- if ( !ckern_table )
- {
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- FT_FACE_FIND_GLOBAL_SERVICE( face, service, CLASSICKERN_VALIDATE );
-
- if ( service )
- error = service->validate( face,
- validation_flags,
- ckern_table );
- else
- error = FT_THROW( Unimplemented_Feature );
-
- Exit:
- return error;
- }
-
-
- FT_EXPORT_DEF( void )
- FT_ClassicKern_Free( FT_Face face,
- FT_Bytes table )
- {
- FT_Memory memory;
-
-
- if ( !face )
- return;
-
- memory = FT_FACE_MEMORY( face );
-
-
- FT_FREE( table );
- }
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/base/ftinit.c b/chromium/third_party/pdfium/third_party/freetype/src/base/ftinit.c
deleted file mode 100644
index b65a91d06c6..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/base/ftinit.c
+++ /dev/null
@@ -1,286 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftinit.c */
-/* */
-/* FreeType initialization layer (body). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
- /*************************************************************************/
- /* */
- /* The purpose of this file is to implement the following two */
- /* functions: */
- /* */
- /* FT_Add_Default_Modules(): */
- /* This function is used to add the set of default modules to a */
- /* fresh new library object. The set is taken from the header file */
- /* `freetype/config/ftmodule.h'. See the document `FreeType 2.0 */
- /* Build System' for more information. */
- /* */
- /* FT_Init_FreeType(): */
- /* This function creates a system object for the current platform, */
- /* builds a library out of it, then calls FT_Default_Drivers(). */
- /* */
- /* Note that even if FT_Init_FreeType() uses the implementation of the */
- /* system object defined at build time, client applications are still */
- /* able to provide their own `ftsystem.c'. */
- /* */
- /*************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_CONFIG_CONFIG_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_MODULE_H
-#include "basepic.h"
-
-
- /*************************************************************************/
- /* */
- /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
- /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
- /* messages during execution. */
- /* */
-#undef FT_COMPONENT
-#define FT_COMPONENT trace_init
-
-
-#ifndef FT_CONFIG_OPTION_PIC
-
-
-#undef FT_USE_MODULE
-#ifdef __cplusplus
-#define FT_USE_MODULE( type, x ) extern "C" const type x;
-#else
-#define FT_USE_MODULE( type, x ) extern const type x;
-#endif
-
-#include FT_CONFIG_MODULES_H
-
-#undef FT_USE_MODULE
-#define FT_USE_MODULE( type, x ) (const FT_Module_Class*)&(x),
-
- static
- const FT_Module_Class* const ft_default_modules[] =
- {
-#include FT_CONFIG_MODULES_H
- 0
- };
-
-
-#else /* FT_CONFIG_OPTION_PIC */
-
-
-#ifdef __cplusplus
-#define FT_EXTERNC extern "C"
-#else
-#define FT_EXTERNC extern
-#endif
-
- /* declare the module's class creation/destruction functions */
-#undef FT_USE_MODULE
-#define FT_USE_MODULE( type, x ) \
- FT_EXTERNC FT_Error \
- FT_Create_Class_ ## x( FT_Library library, \
- FT_Module_Class* *output_class ); \
- FT_EXTERNC void \
- FT_Destroy_Class_ ## x( FT_Library library, \
- FT_Module_Class* clazz );
-
-#include FT_CONFIG_MODULES_H
-
- /* count all module classes */
-#undef FT_USE_MODULE
-#define FT_USE_MODULE( type, x ) MODULE_CLASS_ ## x,
-
- enum
- {
-#include FT_CONFIG_MODULES_H
- FT_NUM_MODULE_CLASSES
- };
-
- /* destroy all module classes */
-#undef FT_USE_MODULE
-#define FT_USE_MODULE( type, x ) \
- if ( classes[i] ) \
- { \
- FT_Destroy_Class_ ## x( library, classes[i] ); \
- } \
- i++;
-
-
- FT_BASE_DEF( void )
- ft_destroy_default_module_classes( FT_Library library )
- {
- FT_Module_Class* *classes;
- FT_Memory memory;
- FT_UInt i;
- BasePIC* pic_container = (BasePIC*)library->pic_container.base;
-
-
- if ( !pic_container->default_module_classes )
- return;
-
- memory = library->memory;
- classes = pic_container->default_module_classes;
- i = 0;
-
-#include FT_CONFIG_MODULES_H
-
- FT_FREE( classes );
- pic_container->default_module_classes = NULL;
- }
-
-
- /* initialize all module classes and the pointer table */
-#undef FT_USE_MODULE
-#define FT_USE_MODULE( type, x ) \
- error = FT_Create_Class_ ## x( library, &clazz ); \
- if ( error ) \
- goto Exit; \
- classes[i++] = clazz;
-
-
- FT_BASE_DEF( FT_Error )
- ft_create_default_module_classes( FT_Library library )
- {
- FT_Error error;
- FT_Memory memory;
- FT_Module_Class* *classes = NULL;
- FT_Module_Class* clazz;
- FT_UInt i;
- BasePIC* pic_container = (BasePIC*)library->pic_container.base;
-
-
- memory = library->memory;
-
- pic_container->default_module_classes = NULL;
-
- if ( FT_ALLOC( classes, sizeof ( FT_Module_Class* ) *
- ( FT_NUM_MODULE_CLASSES + 1 ) ) )
- return error;
-
- /* initialize all pointers to 0, especially the last one */
- for ( i = 0; i < FT_NUM_MODULE_CLASSES; i++ )
- classes[i] = NULL;
- classes[FT_NUM_MODULE_CLASSES] = NULL;
-
- i = 0;
-
-#include FT_CONFIG_MODULES_H
-
- Exit:
- if ( error )
- ft_destroy_default_module_classes( library );
- else
- pic_container->default_module_classes = classes;
-
- return error;
- }
-
-
-#endif /* FT_CONFIG_OPTION_PIC */
-
-
- /* documentation is in ftmodapi.h */
-
- FT_EXPORT_DEF( void )
- FT_Add_Default_Modules( FT_Library library )
- {
- FT_Error error;
- const FT_Module_Class* const* cur;
-
-
- /* FT_DEFAULT_MODULES_GET dereferences `library' in PIC mode */
-#ifdef FT_CONFIG_OPTION_PIC
- if ( !library )
- return;
-#endif
-
- /* GCC 4.6 warns the type difference:
- * FT_Module_Class** != const FT_Module_Class* const*
- */
- cur = (const FT_Module_Class* const*)FT_DEFAULT_MODULES_GET;
-
- /* test for valid `library' delayed to FT_Add_Module() */
- while ( *cur )
- {
- error = FT_Add_Module( library, *cur );
- /* notify errors, but don't stop */
- if ( error )
- FT_TRACE0(( "FT_Add_Default_Module:"
- " Cannot install `%s', error = 0x%x\n",
- (*cur)->module_name, error ));
- cur++;
- }
- }
-
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Init_FreeType( FT_Library *alibrary )
- {
- FT_Error error;
- FT_Memory memory;
-
-
- /* check of `alibrary' delayed to `FT_New_Library' */
-
- /* First of all, allocate a new system object -- this function is part */
- /* of the system-specific component, i.e. `ftsystem.c'. */
-
- memory = FT_New_Memory();
- if ( !memory )
- {
- FT_ERROR(( "FT_Init_FreeType: cannot find memory manager\n" ));
- return FT_THROW( Unimplemented_Feature );
- }
-
- /* build a library out of it, then fill it with the set of */
- /* default drivers. */
-
- error = FT_New_Library( memory, alibrary );
- if ( error )
- FT_Done_Memory( memory );
- else
- FT_Add_Default_Modules( *alibrary );
-
- return error;
- }
-
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Done_FreeType( FT_Library library )
- {
- FT_Memory memory;
-
-
- if ( !library )
- return FT_THROW( Invalid_Library_Handle );
-
- memory = library->memory;
-
- /* Discard the library object */
- FT_Done_Library( library );
-
- /* discard memory manager */
- FT_Done_Memory( memory );
-
- return FT_Err_Ok;
- }
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/base/ftlcdfil.c b/chromium/third_party/pdfium/third_party/freetype/src/base/ftlcdfil.c
deleted file mode 100644
index ff6f7e98ceb..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/base/ftlcdfil.c
+++ /dev/null
@@ -1,398 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftlcdfil.c */
-/* */
-/* FreeType API for color filtering of subpixel bitmap glyphs (body). */
-/* */
-/* Copyright 2006-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-
-#include FT_LCD_FILTER_H
-#include FT_IMAGE_H
-#include FT_INTERNAL_OBJECTS_H
-
-
-#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
-
-/* define USE_LEGACY to implement the legacy filter */
-#define USE_LEGACY
-
- /* FIR filter used by the default and light filters */
- static void
- _ft_lcd_filter_fir( FT_Bitmap* bitmap,
- FT_Render_Mode mode,
- FT_Library library )
- {
- FT_Byte* weights = library->lcd_weights;
- FT_UInt width = (FT_UInt)bitmap->width;
- FT_UInt height = (FT_UInt)bitmap->rows;
-
-
- /* horizontal in-place FIR filter */
- if ( mode == FT_RENDER_MODE_LCD && width >= 4 )
- {
- FT_Byte* line = bitmap->buffer;
-
-
- /* take care of bitmap flow */
- if ( bitmap->pitch < 0 )
- line -= bitmap->pitch * (FT_Int)( bitmap->rows - 1 );
-
- /* `fir' and `pix' must be at least 32 bit wide, since the sum of */
- /* the values in `weights' can exceed 0xFF */
-
- for ( ; height > 0; height--, line += bitmap->pitch )
- {
- FT_UInt fir[4]; /* below, `pix' is used as the 5th element */
- FT_UInt val1, xx;
-
-
- val1 = line[0];
- fir[0] = weights[2] * val1;
- fir[1] = weights[3] * val1;
- fir[2] = weights[4] * val1;
- fir[3] = 0;
-
- val1 = line[1];
- fir[0] += weights[1] * val1;
- fir[1] += weights[2] * val1;
- fir[2] += weights[3] * val1;
- fir[3] += weights[4] * val1;
-
- for ( xx = 2; xx < width; xx++ )
- {
- FT_UInt val, pix;
-
-
- val = line[xx];
- pix = fir[0] + weights[0] * val;
- fir[0] = fir[1] + weights[1] * val;
- fir[1] = fir[2] + weights[2] * val;
- fir[2] = fir[3] + weights[3] * val;
- fir[3] = weights[4] * val;
-
- pix >>= 8;
- pix |= (FT_UInt)-(FT_Int)( pix >> 8 );
- line[xx - 2] = (FT_Byte)pix;
- }
-
- {
- FT_UInt pix;
-
-
- pix = fir[0] >> 8;
- pix |= (FT_UInt)-(FT_Int)( pix >> 8 );
- line[xx - 2] = (FT_Byte)pix;
-
- pix = fir[1] >> 8;
- pix |= (FT_UInt)-(FT_Int)( pix >> 8 );
- line[xx - 1] = (FT_Byte)pix;
- }
- }
- }
-
- /* vertical in-place FIR filter */
- else if ( mode == FT_RENDER_MODE_LCD_V && height >= 4 )
- {
- FT_Byte* column = bitmap->buffer;
- FT_Int pitch = bitmap->pitch;
-
-
- /* take care of bitmap flow */
- if ( bitmap->pitch < 0 )
- column -= bitmap->pitch * (FT_Int)( bitmap->rows - 1 );
-
- for ( ; width > 0; width--, column++ )
- {
- FT_Byte* col = column;
- FT_UInt fir[4]; /* below, `pix' is used as the 5th element */
- FT_UInt val1, yy;
-
-
- val1 = col[0];
- fir[0] = weights[2] * val1;
- fir[1] = weights[3] * val1;
- fir[2] = weights[4] * val1;
- fir[3] = 0;
- col += pitch;
-
- val1 = col[0];
- fir[0] += weights[1] * val1;
- fir[1] += weights[2] * val1;
- fir[2] += weights[3] * val1;
- fir[3] += weights[4] * val1;
- col += pitch;
-
- for ( yy = 2; yy < height; yy++ )
- {
- FT_UInt val, pix;
-
-
- val = col[0];
- pix = fir[0] + weights[0] * val;
- fir[0] = fir[1] + weights[1] * val;
- fir[1] = fir[2] + weights[2] * val;
- fir[2] = fir[3] + weights[3] * val;
- fir[3] = weights[4] * val;
-
- pix >>= 8;
- pix |= (FT_UInt)-(FT_Int)( pix >> 8 );
- col[-2 * pitch] = (FT_Byte)pix;
- col += pitch;
- }
-
- {
- FT_UInt pix;
-
-
- pix = fir[0] >> 8;
- pix |= (FT_UInt)-(FT_Int)( pix >> 8 );
- col[-2 * pitch] = (FT_Byte)pix;
-
- pix = fir[1] >> 8;
- pix |= (FT_UInt)-(FT_Int)( pix >> 8 );
- col[-pitch] = (FT_Byte)pix;
- }
- }
- }
- }
-
-
-#ifdef USE_LEGACY
-
- /* intra-pixel filter used by the legacy filter */
- static void
- _ft_lcd_filter_legacy( FT_Bitmap* bitmap,
- FT_Render_Mode mode,
- FT_Library library )
- {
- FT_UInt width = (FT_UInt)bitmap->width;
- FT_UInt height = (FT_UInt)bitmap->rows;
- FT_Int pitch = bitmap->pitch;
-
- static const unsigned int filters[3][3] =
- {
- { 65538 * 9/13, 65538 * 1/6, 65538 * 1/13 },
- { 65538 * 3/13, 65538 * 4/6, 65538 * 3/13 },
- { 65538 * 1/13, 65538 * 1/6, 65538 * 9/13 }
- };
-
- FT_UNUSED( library );
-
-
- /* horizontal in-place intra-pixel filter */
- if ( mode == FT_RENDER_MODE_LCD && width >= 3 )
- {
- FT_Byte* line = bitmap->buffer;
-
-
- /* take care of bitmap flow */
- if ( bitmap->pitch < 0 )
- line -= bitmap->pitch * (FT_Int)( bitmap->rows - 1 );
-
- for ( ; height > 0; height--, line += pitch )
- {
- FT_UInt xx;
-
-
- for ( xx = 0; xx < width; xx += 3 )
- {
- FT_UInt r = 0;
- FT_UInt g = 0;
- FT_UInt b = 0;
- FT_UInt p;
-
-
- p = line[xx];
- r += filters[0][0] * p;
- g += filters[0][1] * p;
- b += filters[0][2] * p;
-
- p = line[xx + 1];
- r += filters[1][0] * p;
- g += filters[1][1] * p;
- b += filters[1][2] * p;
-
- p = line[xx + 2];
- r += filters[2][0] * p;
- g += filters[2][1] * p;
- b += filters[2][2] * p;
-
- line[xx] = (FT_Byte)( r / 65536 );
- line[xx + 1] = (FT_Byte)( g / 65536 );
- line[xx + 2] = (FT_Byte)( b / 65536 );
- }
- }
- }
- else if ( mode == FT_RENDER_MODE_LCD_V && height >= 3 )
- {
- FT_Byte* column = bitmap->buffer;
-
-
- /* take care of bitmap flow */
- if ( bitmap->pitch < 0 )
- column -= bitmap->pitch * (FT_Int)( bitmap->rows - 1 );
-
- for ( ; width > 0; width--, column++ )
- {
- FT_Byte* col = column;
- FT_Byte* col_end = col + (FT_Int)height * pitch;
-
-
- for ( ; col < col_end; col += 3 * pitch )
- {
- FT_UInt r = 0;
- FT_UInt g = 0;
- FT_UInt b = 0;
- FT_UInt p;
-
-
- p = col[0];
- r += filters[0][0] * p;
- g += filters[0][1] * p;
- b += filters[0][2] * p;
-
- p = col[pitch];
- r += filters[1][0] * p;
- g += filters[1][1] * p;
- b += filters[1][2] * p;
-
- p = col[pitch * 2];
- r += filters[2][0] * p;
- g += filters[2][1] * p;
- b += filters[2][2] * p;
-
- col[0] = (FT_Byte)( r / 65536 );
- col[pitch] = (FT_Byte)( g / 65536 );
- col[2 * pitch] = (FT_Byte)( b / 65536 );
- }
- }
- }
- }
-
-#endif /* USE_LEGACY */
-
-
- FT_EXPORT_DEF( FT_Error )
- FT_Library_SetLcdFilterWeights( FT_Library library,
- unsigned char *weights )
- {
- if ( !library )
- return FT_THROW( Invalid_Library_Handle );
-
- if ( !weights )
- return FT_THROW( Invalid_Argument );
-
- ft_memcpy( library->lcd_weights, weights, 5 );
-
- return FT_Err_Ok;
- }
-
-
- FT_EXPORT_DEF( FT_Error )
- FT_Library_SetLcdFilter( FT_Library library,
- FT_LcdFilter filter )
- {
- static const FT_Byte light_filter[5] =
- { 0x00, 0x55, 0x56, 0x55, 0x00 };
- /* the values here sum up to a value larger than 256, */
- /* providing a cheap gamma correction */
- static const FT_Byte default_filter[5] =
- { 0x10, 0x40, 0x70, 0x40, 0x10 };
-
-
- if ( !library )
- return FT_THROW( Invalid_Library_Handle );
-
- switch ( filter )
- {
- case FT_LCD_FILTER_NONE:
- library->lcd_filter_func = NULL;
- library->lcd_extra = 0;
- break;
-
- case FT_LCD_FILTER_DEFAULT:
-#if defined( FT_FORCE_LEGACY_LCD_FILTER )
-
- library->lcd_filter_func = _ft_lcd_filter_legacy;
- library->lcd_extra = 0;
-
-#elif defined( FT_FORCE_LIGHT_LCD_FILTER )
-
- ft_memcpy( library->lcd_weights, light_filter, 5 );
- library->lcd_filter_func = _ft_lcd_filter_fir;
- library->lcd_extra = 2;
-
-#else
-
- ft_memcpy( library->lcd_weights, default_filter, 5 );
- library->lcd_filter_func = _ft_lcd_filter_fir;
- library->lcd_extra = 2;
-
-#endif
-
- break;
-
- case FT_LCD_FILTER_LIGHT:
- ft_memcpy( library->lcd_weights, light_filter, 5 );
- library->lcd_filter_func = _ft_lcd_filter_fir;
- library->lcd_extra = 2;
- break;
-
-#ifdef USE_LEGACY
-
- case FT_LCD_FILTER_LEGACY:
- library->lcd_filter_func = _ft_lcd_filter_legacy;
- library->lcd_extra = 0;
- break;
-
-#endif
-
- default:
- return FT_THROW( Invalid_Argument );
- }
-
- library->lcd_filter = filter;
-
- return FT_Err_Ok;
- }
-
-#else /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Library_SetLcdFilterWeights( FT_Library library,
- unsigned char *weights )
- {
- FT_UNUSED( library );
- FT_UNUSED( weights );
-
- return FT_THROW( Unimplemented_Feature );
- }
-
-
- FT_EXPORT_DEF( FT_Error )
- FT_Library_SetLcdFilter( FT_Library library,
- FT_LcdFilter filter )
- {
- FT_UNUSED( library );
- FT_UNUSED( filter );
-
- return FT_THROW( Unimplemented_Feature );
- }
-
-#endif /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/base/ftmac.c b/chromium/third_party/pdfium/third_party/freetype/src/base/ftmac.c
deleted file mode 100644
index 114bbb63919..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/base/ftmac.c
+++ /dev/null
@@ -1,1080 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftmac.c */
-/* */
-/* Mac FOND support. Written by just@letterror.com. */
-/* Heavily modified by mpsuzuki, George Williams, and Sean McBride. */
-/* */
-/* This file is for Mac OS X only; see builds/mac/ftoldmac.c for */
-/* classic platforms built by MPW. */
-/* */
-/* Copyright 1996-2015 by */
-/* Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
- /*
- Notes
-
- Mac suitcase files can (and often do!) contain multiple fonts. To
- support this I use the face_index argument of FT_(Open|New)_Face()
- functions, and pretend the suitcase file is a collection.
-
- Warning: fbit and NFNT bitmap resources are not supported yet. In old
- sfnt fonts, bitmap glyph data for each size is stored in each `NFNT'
- resources instead of the `bdat' table in the sfnt resource. Therefore,
- face->num_fixed_sizes is set to 0, because bitmap data in `NFNT'
- resource is unavailable at present.
-
- The Mac FOND support works roughly like this:
-
- - Check whether the offered stream points to a Mac suitcase file. This
- is done by checking the file type: it has to be 'FFIL' or 'tfil'. The
- stream that gets passed to our init_face() routine is a stdio stream,
- which isn't usable for us, since the FOND resources live in the
- resource fork. So we just grab the stream->pathname field.
-
- - Read the FOND resource into memory, then check whether there is a
- TrueType font and/or(!) a Type 1 font available.
-
- - If there is a Type 1 font available (as a separate `LWFN' file), read
- its data into memory, massage it slightly so it becomes PFB data, wrap
- it into a memory stream, load the Type 1 driver and delegate the rest
- of the work to it by calling FT_Open_Face(). (XXX TODO: after this
- has been done, the kerning data from the FOND resource should be
- appended to the face: On the Mac there are usually no AFM files
- available. However, this is tricky since we need to map Mac char
- codes to ps glyph names to glyph ID's...)
-
- - If there is a TrueType font (an `sfnt' resource), read it into memory,
- wrap it into a memory stream, load the TrueType driver and delegate
- the rest of the work to it, by calling FT_Open_Face().
-
- - Some suitcase fonts (notably Onyx) might point the `LWFN' file to
- itself, even though it doesn't contains `POST' resources. To handle
- this special case without opening the file an extra time, we just
- ignore errors from the `LWFN' and fallback to the `sfnt' if both are
- available.
- */
-
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_TRUETYPE_TAGS_H
-#include FT_INTERNAL_STREAM_H
-#include "ftbase.h"
-
- /* This is for Mac OS X. Without redefinition, OS_INLINE */
- /* expands to `static inline' which doesn't survive the */
- /* -ansi compilation flag of GCC. */
-#if !HAVE_ANSI_OS_INLINE
-#undef OS_INLINE
-#define OS_INLINE static __inline__
-#endif
-
- /* `configure' checks the availability of `ResourceIndex' strictly */
- /* and sets HAVE_TYPE_RESOURCE_INDEX 1 or 0 always. If it is */
- /* not set (e.g., a build without `configure'), the availability */
- /* is guessed from the SDK version. */
-#ifndef HAVE_TYPE_RESOURCE_INDEX
-#if !defined( MAC_OS_X_VERSION_10_5 ) || \
- ( MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5 )
-#define HAVE_TYPE_RESOURCE_INDEX 0
-#else
-#define HAVE_TYPE_RESOURCE_INDEX 1
-#endif
-#endif /* !HAVE_TYPE_RESOURCE_INDEX */
-
-#if ( HAVE_TYPE_RESOURCE_INDEX == 0 )
- typedef short ResourceIndex;
-#endif
-
-#include <CoreServices/CoreServices.h>
-#include <ApplicationServices/ApplicationServices.h>
-#include <sys/syslimits.h> /* PATH_MAX */
-
- /* Don't want warnings about our own use of deprecated functions. */
-#define FT_DEPRECATED_ATTRIBUTE
-
-#include FT_MAC_H
-
-#ifndef kATSOptionFlagsUnRestrictedScope /* since Mac OS X 10.1 */
-#define kATSOptionFlagsUnRestrictedScope kATSOptionFlagsDefault
-#endif
-
-
- /* Set PREFER_LWFN to 1 if LWFN (Type 1) is preferred over
- TrueType in case *both* are available (this is not common,
- but it *is* possible). */
-#ifndef PREFER_LWFN
-#define PREFER_LWFN 1
-#endif
-
-
-#ifdef FT_MACINTOSH
-
- /* This function is deprecated because FSSpec is deprecated in Mac OS X */
- FT_EXPORT_DEF( FT_Error )
- FT_GetFile_From_Mac_Name( const char* fontName,
- FSSpec* pathSpec,
- FT_Long* face_index )
- {
- FT_UNUSED( fontName );
- FT_UNUSED( pathSpec );
- FT_UNUSED( face_index );
-
- return FT_THROW( Unimplemented_Feature );
- }
-
-
- /* Private function. */
- /* The FSSpec type has been discouraged for a long time, */
- /* unfortunately an FSRef replacement API for */
- /* ATSFontGetFileSpecification() is only available in */
- /* Mac OS X 10.5 and later. */
- static OSStatus
- FT_ATSFontGetFileReference( ATSFontRef ats_font_id,
- FSRef* ats_font_ref )
- {
-#if defined( MAC_OS_X_VERSION_10_5 ) && \
- ( MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 )
-
- OSStatus err;
-
- err = ATSFontGetFileReference( ats_font_id, ats_font_ref );
-
- return err;
-#elif __LP64__ /* No 64bit Carbon API on legacy platforms */
- FT_UNUSED( ats_font_id );
- FT_UNUSED( ats_font_ref );
-
-
- return fnfErr;
-#else /* 32bit Carbon API on legacy platforms */
- OSStatus err;
- FSSpec spec;
-
-
- err = ATSFontGetFileSpecification( ats_font_id, &spec );
- if ( noErr == err )
- err = FSpMakeFSRef( &spec, ats_font_ref );
-
- return err;
-#endif
- }
-
-
- static FT_Error
- FT_GetFileRef_From_Mac_ATS_Name( const char* fontName,
- FSRef* ats_font_ref,
- FT_Long* face_index )
- {
- CFStringRef cf_fontName;
- ATSFontRef ats_font_id;
-
-
- *face_index = 0;
-
- cf_fontName = CFStringCreateWithCString( NULL, fontName,
- kCFStringEncodingMacRoman );
- ats_font_id = ATSFontFindFromName( cf_fontName,
- kATSOptionFlagsUnRestrictedScope );
- CFRelease( cf_fontName );
-
- if ( ats_font_id == 0 || ats_font_id == 0xFFFFFFFFUL )
- return FT_THROW( Unknown_File_Format );
-
- if ( noErr != FT_ATSFontGetFileReference( ats_font_id, ats_font_ref ) )
- return FT_THROW( Unknown_File_Format );
-
- /* face_index calculation by searching preceding fontIDs */
- /* with same FSRef */
- {
- ATSFontRef id2 = ats_font_id - 1;
- FSRef ref2;
-
-
- while ( id2 > 0 )
- {
- if ( noErr != FT_ATSFontGetFileReference( id2, &ref2 ) )
- break;
- if ( noErr != FSCompareFSRefs( ats_font_ref, &ref2 ) )
- break;
-
- id2 --;
- }
- *face_index = ats_font_id - ( id2 + 1 );
- }
-
- return FT_Err_Ok;
- }
-
-
- FT_EXPORT_DEF( FT_Error )
- FT_GetFilePath_From_Mac_ATS_Name( const char* fontName,
- UInt8* path,
- UInt32 maxPathSize,
- FT_Long* face_index )
- {
- FSRef ref;
- FT_Error err;
-
-
- if ( !fontName || !face_index )
- return FT_THROW( Invalid_Argument) ;
-
- err = FT_GetFileRef_From_Mac_ATS_Name( fontName, &ref, face_index );
- if ( err )
- return err;
-
- if ( noErr != FSRefMakePath( &ref, path, maxPathSize ) )
- return FT_THROW( Unknown_File_Format );
-
- return FT_Err_Ok;
- }
-
-
- /* This function is deprecated because FSSpec is deprecated in Mac OS X */
- FT_EXPORT_DEF( FT_Error )
- FT_GetFile_From_Mac_ATS_Name( const char* fontName,
- FSSpec* pathSpec,
- FT_Long* face_index )
- {
-#if ( __LP64__ ) || ( defined( MAC_OS_X_VERSION_10_5 ) && \
- ( MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 ) )
- FT_UNUSED( fontName );
- FT_UNUSED( pathSpec );
- FT_UNUSED( face_index );
-
- return FT_THROW( Unimplemented_Feature );
-#else
- FSRef ref;
- FT_Error err;
-
-
- if ( !fontName || !face_index )
- return FT_THROW( Invalid_Argument );
-
- err = FT_GetFileRef_From_Mac_ATS_Name( fontName, &ref, face_index );
- if ( err )
- return err;
-
- if ( noErr != FSGetCatalogInfo( &ref, kFSCatInfoNone, NULL, NULL,
- pathSpec, NULL ) )
- return FT_THROW( Unknown_File_Format );
-
- return FT_Err_Ok;
-#endif
- }
-
-
- static OSErr
- FT_FSPathMakeRes( const UInt8* pathname,
- ResFileRefNum* res )
- {
- OSErr err;
- FSRef ref;
-
-
- if ( noErr != FSPathMakeRef( pathname, &ref, FALSE ) )
- return FT_THROW( Cannot_Open_Resource );
-
- /* at present, no support for dfont format */
- err = FSOpenResourceFile( &ref, 0, NULL, fsRdPerm, res );
- if ( noErr == err )
- return err;
-
- /* fallback to original resource-fork font */
- *res = FSOpenResFile( &ref, fsRdPerm );
- err = ResError();
-
- return err;
- }
-
-
- /* Return the file type for given pathname */
- static OSType
- get_file_type_from_path( const UInt8* pathname )
- {
- FSRef ref;
- FSCatalogInfo info;
-
-
- if ( noErr != FSPathMakeRef( pathname, &ref, FALSE ) )
- return ( OSType ) 0;
-
- if ( noErr != FSGetCatalogInfo( &ref, kFSCatInfoFinderInfo, &info,
- NULL, NULL, NULL ) )
- return ( OSType ) 0;
-
- return ((FInfo *)(info.finderInfo))->fdType;
- }
-
-
- /* Given a PostScript font name, create the Macintosh LWFN file name. */
- static void
- create_lwfn_name( char* ps_name,
- Str255 lwfn_file_name )
- {
- int max = 5, count = 0;
- FT_Byte* p = lwfn_file_name;
- FT_Byte* q = (FT_Byte*)ps_name;
-
-
- lwfn_file_name[0] = 0;
-
- while ( *q )
- {
- if ( ft_isupper( *q ) )
- {
- if ( count )
- max = 3;
- count = 0;
- }
- if ( count < max && ( ft_isalnum( *q ) || *q == '_' ) )
- {
- *++p = *q;
- lwfn_file_name[0]++;
- count++;
- }
- q++;
- }
- }
-
-
- static short
- count_faces_sfnt( char* fond_data )
- {
- /* The count is 1 greater than the value in the FOND. */
- /* Isn't that cute? :-) */
-
- return EndianS16_BtoN( *( (short*)( fond_data +
- sizeof ( FamRec ) ) ) ) + 1;
- }
-
-
- static short
- count_faces_scalable( char* fond_data )
- {
- AsscEntry* assoc;
- short i, face, face_all;
-
-
- face_all = EndianS16_BtoN( *( (short *)( fond_data +
- sizeof ( FamRec ) ) ) ) + 1;
- assoc = (AsscEntry*)( fond_data + sizeof ( FamRec ) + 2 );
- face = 0;
-
- for ( i = 0; i < face_all; i++ )
- {
- if ( 0 == EndianS16_BtoN( assoc[i].fontSize ) )
- face++;
- }
- return face;
- }
-
-
- /* Look inside the FOND data, answer whether there should be an SFNT
- resource, and answer the name of a possible LWFN Type 1 file.
-
- Thanks to Paul Miller (paulm@profoundeffects.com) for the fix
- to load a face OTHER than the first one in the FOND!
- */
-
-
- static void
- parse_fond( char* fond_data,
- short* have_sfnt,
- ResID* sfnt_id,
- Str255 lwfn_file_name,
- short face_index )
- {
- AsscEntry* assoc;
- AsscEntry* base_assoc;
- FamRec* fond;
-
-
- *sfnt_id = 0;
- *have_sfnt = 0;
- lwfn_file_name[0] = 0;
-
- fond = (FamRec*)fond_data;
- assoc = (AsscEntry*)( fond_data + sizeof ( FamRec ) + 2 );
- base_assoc = assoc;
-
- /* the maximum faces in a FOND is 48, size of StyleTable.indexes[] */
- if ( 47 < face_index )
- return;
-
- /* Let's do a little range checking before we get too excited here */
- if ( face_index < count_faces_sfnt( fond_data ) )
- {
- assoc += face_index; /* add on the face_index! */
-
- /* if the face at this index is not scalable,
- fall back to the first one (old behavior) */
- if ( EndianS16_BtoN( assoc->fontSize ) == 0 )
- {
- *have_sfnt = 1;
- *sfnt_id = EndianS16_BtoN( assoc->fontID );
- }
- else if ( base_assoc->fontSize == 0 )
- {
- *have_sfnt = 1;
- *sfnt_id = EndianS16_BtoN( base_assoc->fontID );
- }
- }
-
- if ( EndianS32_BtoN( fond->ffStylOff ) )
- {
- unsigned char* p = (unsigned char*)fond_data;
- StyleTable* style;
- unsigned short string_count;
- char ps_name[256];
- unsigned char* names[64];
- int i;
-
-
- p += EndianS32_BtoN( fond->ffStylOff );
- style = (StyleTable*)p;
- p += sizeof ( StyleTable );
- string_count = EndianS16_BtoN( *(short*)(p) );
- string_count = FT_MIN( 64, string_count );
- p += sizeof ( short );
-
- for ( i = 0; i < string_count; i++ )
- {
- names[i] = p;
- p += names[i][0];
- p++;
- }
-
- {
- size_t ps_name_len = (size_t)names[0][0];
-
-
- if ( ps_name_len != 0 )
- {
- ft_memcpy(ps_name, names[0] + 1, ps_name_len);
- ps_name[ps_name_len] = 0;
- }
- if ( style->indexes[face_index] > 1 &&
- style->indexes[face_index] <= string_count )
- {
- unsigned char* suffixes = names[style->indexes[face_index] - 1];
-
-
- for ( i = 1; i <= suffixes[0]; i++ )
- {
- unsigned char* s;
- size_t j = suffixes[i] - 1;
-
-
- if ( j < string_count && ( s = names[j] ) != NULL )
- {
- size_t s_len = (size_t)s[0];
-
-
- if ( s_len != 0 && ps_name_len + s_len < sizeof ( ps_name ) )
- {
- ft_memcpy( ps_name + ps_name_len, s + 1, s_len );
- ps_name_len += s_len;
- ps_name[ps_name_len] = 0;
- }
- }
- }
- }
- }
-
- create_lwfn_name( ps_name, lwfn_file_name );
- }
- }
-
-
- static FT_Error
- lookup_lwfn_by_fond( const UInt8* path_fond,
- ConstStr255Param base_lwfn,
- UInt8* path_lwfn,
- size_t path_size )
- {
- FSRef ref, par_ref;
- size_t dirname_len;
-
-
- /* Pathname for FSRef can be in various formats: HFS, HFS+, and POSIX. */
- /* We should not extract parent directory by string manipulation. */
-
- if ( noErr != FSPathMakeRef( path_fond, &ref, FALSE ) )
- return FT_THROW( Invalid_Argument );
-
- if ( noErr != FSGetCatalogInfo( &ref, kFSCatInfoNone,
- NULL, NULL, NULL, &par_ref ) )
- return FT_THROW( Invalid_Argument );
-
- if ( noErr != FSRefMakePath( &par_ref, path_lwfn, path_size ) )
- return FT_THROW( Invalid_Argument );
-
- if ( ft_strlen( (char *)path_lwfn ) + 1 + base_lwfn[0] > path_size )
- return FT_THROW( Invalid_Argument );
-
- /* now we have absolute dirname in path_lwfn */
- ft_strcat( (char *)path_lwfn, "/" );
- dirname_len = ft_strlen( (char *)path_lwfn );
- ft_strcat( (char *)path_lwfn, (char *)base_lwfn + 1 );
- path_lwfn[dirname_len + base_lwfn[0]] = '\0';
-
- if ( noErr != FSPathMakeRef( path_lwfn, &ref, FALSE ) )
- return FT_THROW( Cannot_Open_Resource );
-
- if ( noErr != FSGetCatalogInfo( &ref, kFSCatInfoNone,
- NULL, NULL, NULL, NULL ) )
- return FT_THROW( Cannot_Open_Resource );
-
- return FT_Err_Ok;
- }
-
-
- static short
- count_faces( Handle fond,
- const UInt8* pathname )
- {
- ResID sfnt_id;
- short have_sfnt, have_lwfn;
- Str255 lwfn_file_name;
- UInt8 buff[PATH_MAX];
- FT_Error err;
- short num_faces;
-
-
- have_sfnt = have_lwfn = 0;
-
- parse_fond( *fond, &have_sfnt, &sfnt_id, lwfn_file_name, 0 );
-
- if ( lwfn_file_name[0] )
- {
- err = lookup_lwfn_by_fond( pathname, lwfn_file_name,
- buff, sizeof ( buff ) );
- if ( !err )
- have_lwfn = 1;
- }
-
- if ( have_lwfn && ( !have_sfnt || PREFER_LWFN ) )
- num_faces = 1;
- else
- num_faces = count_faces_scalable( *fond );
-
- return num_faces;
- }
-
-
- /* Read Type 1 data from the POST resources inside the LWFN file,
- return a PFB buffer. This is somewhat convoluted because the FT2
- PFB parser wants the ASCII header as one chunk, and the LWFN
- chunks are often not organized that way, so we glue chunks
- of the same type together. */
- static FT_Error
- read_lwfn( FT_Memory memory,
- ResFileRefNum res,
- FT_Byte** pfb_data,
- FT_ULong* size )
- {
- FT_Error error = FT_Err_Ok;
- ResID res_id;
- unsigned char *buffer, *p, *size_p = NULL;
- FT_ULong total_size = 0;
- FT_ULong old_total_size = 0;
- FT_ULong post_size, pfb_chunk_size;
- Handle post_data;
- char code, last_code;
-
-
- UseResFile( res );
-
- /* First pass: load all POST resources, and determine the size of */
- /* the output buffer. */
- res_id = 501;
- last_code = -1;
-
- for (;;)
- {
- post_data = Get1Resource( TTAG_POST, res_id++ );
- if ( post_data == NULL )
- break; /* we are done */
-
- code = (*post_data)[0];
-
- if ( code != last_code )
- {
- if ( code == 5 )
- total_size += 2; /* just the end code */
- else
- total_size += 6; /* code + 4 bytes chunk length */
- }
-
- total_size += (FT_ULong)GetHandleSize( post_data ) - 2;
- last_code = code;
-
- /* detect resource fork overflow */
- if ( FT_MAC_RFORK_MAX_LEN < total_size )
- {
- error = FT_THROW( Array_Too_Large );
- goto Error;
- }
-
- old_total_size = total_size;
- }
-
- if ( FT_ALLOC( buffer, (FT_Long)total_size ) )
- goto Error;
-
- /* Second pass: append all POST data to the buffer, add PFB fields. */
- /* Glue all consecutive chunks of the same type together. */
- p = buffer;
- res_id = 501;
- last_code = -1;
- pfb_chunk_size = 0;
-
- for (;;)
- {
- post_data = Get1Resource( TTAG_POST, res_id++ );
- if ( post_data == NULL )
- break; /* we are done */
-
- post_size = (FT_ULong)GetHandleSize( post_data ) - 2;
- code = (*post_data)[0];
-
- if ( code != last_code )
- {
- if ( last_code != -1 )
- {
- /* we are done adding a chunk, fill in the size field */
- if ( size_p != NULL )
- {
- *size_p++ = (FT_Byte)( pfb_chunk_size & 0xFF );
- *size_p++ = (FT_Byte)( ( pfb_chunk_size >> 8 ) & 0xFF );
- *size_p++ = (FT_Byte)( ( pfb_chunk_size >> 16 ) & 0xFF );
- *size_p++ = (FT_Byte)( ( pfb_chunk_size >> 24 ) & 0xFF );
- }
- pfb_chunk_size = 0;
- }
-
- *p++ = 0x80;
- if ( code == 5 )
- *p++ = 0x03; /* the end */
- else if ( code == 2 )
- *p++ = 0x02; /* binary segment */
- else
- *p++ = 0x01; /* ASCII segment */
-
- if ( code != 5 )
- {
- size_p = p; /* save for later */
- p += 4; /* make space for size field */
- }
- }
-
- ft_memcpy( p, *post_data + 2, post_size );
- pfb_chunk_size += post_size;
- p += post_size;
- last_code = code;
- }
-
- *pfb_data = buffer;
- *size = total_size;
-
- Error:
- CloseResFile( res );
- return error;
- }
-
-
- /* Create a new FT_Face from a file path to an LWFN file. */
- static FT_Error
- FT_New_Face_From_LWFN( FT_Library library,
- const UInt8* pathname,
- FT_Long face_index,
- FT_Face* aface )
- {
- FT_Byte* pfb_data;
- FT_ULong pfb_size;
- FT_Error error;
- ResFileRefNum res;
-
-
- if ( noErr != FT_FSPathMakeRes( pathname, &res ) )
- return FT_THROW( Cannot_Open_Resource );
-
- pfb_data = NULL;
- pfb_size = 0;
- error = read_lwfn( library->memory, res, &pfb_data, &pfb_size );
- CloseResFile( res ); /* PFB is already loaded, useless anymore */
- if ( error )
- return error;
-
- return open_face_from_buffer( library,
- pfb_data,
- pfb_size,
- face_index,
- "type1",
- aface );
- }
-
-
- /* Create a new FT_Face from an SFNT resource, specified by res ID. */
- static FT_Error
- FT_New_Face_From_SFNT( FT_Library library,
- ResID sfnt_id,
- FT_Long face_index,
- FT_Face* aface )
- {
- Handle sfnt = NULL;
- FT_Byte* sfnt_data;
- size_t sfnt_size;
- FT_Error error = FT_Err_Ok;
- FT_Memory memory = library->memory;
- int is_cff, is_sfnt_ps;
-
-
- sfnt = GetResource( TTAG_sfnt, sfnt_id );
- if ( sfnt == NULL )
- return FT_THROW( Invalid_Handle );
-
- sfnt_size = (FT_ULong)GetHandleSize( sfnt );
-
- /* detect resource fork overflow */
- if ( FT_MAC_RFORK_MAX_LEN < sfnt_size )
- return FT_THROW( Array_Too_Large );
-
- if ( FT_ALLOC( sfnt_data, (FT_Long)sfnt_size ) )
- {
- ReleaseResource( sfnt );
- return error;
- }
-
- ft_memcpy( sfnt_data, *sfnt, sfnt_size );
- ReleaseResource( sfnt );
-
- is_cff = sfnt_size > 4 && !ft_memcmp( sfnt_data, "OTTO", 4 );
- is_sfnt_ps = sfnt_size > 4 && !ft_memcmp( sfnt_data, "typ1", 4 );
-
- if ( is_sfnt_ps )
- {
- FT_Stream stream;
-
-
- if ( FT_NEW( stream ) )
- goto Try_OpenType;
-
- FT_Stream_OpenMemory( stream, sfnt_data, sfnt_size );
- if ( !open_face_PS_from_sfnt_stream( library,
- stream,
- face_index,
- 0, NULL,
- aface ) )
- {
- FT_Stream_Close( stream );
- FT_FREE( stream );
- FT_FREE( sfnt_data );
- goto Exit;
- }
-
- FT_FREE( stream );
- }
- Try_OpenType:
- error = open_face_from_buffer( library,
- sfnt_data,
- sfnt_size,
- face_index,
- is_cff ? "cff" : "truetype",
- aface );
- Exit:
- return error;
- }
-
-
- /* Create a new FT_Face from a file path to a suitcase file. */
- static FT_Error
- FT_New_Face_From_Suitcase( FT_Library library,
- const UInt8* pathname,
- FT_Long face_index,
- FT_Face* aface )
- {
- FT_Error error = FT_ERR( Cannot_Open_Resource );
- ResFileRefNum res_ref;
- ResourceIndex res_index;
- Handle fond;
- short num_faces_in_res;
-
-
- if ( noErr != FT_FSPathMakeRes( pathname, &res_ref ) )
- return FT_THROW( Cannot_Open_Resource );
-
- UseResFile( res_ref );
- if ( ResError() )
- return FT_THROW( Cannot_Open_Resource );
-
- num_faces_in_res = 0;
- for ( res_index = 1; ; ++res_index )
- {
- short num_faces_in_fond;
-
-
- fond = Get1IndResource( TTAG_FOND, res_index );
- if ( ResError() )
- break;
-
- num_faces_in_fond = count_faces( fond, pathname );
- num_faces_in_res += num_faces_in_fond;
-
- if ( 0 <= face_index && face_index < num_faces_in_fond && error )
- error = FT_New_Face_From_FOND( library, fond, face_index, aface );
-
- face_index -= num_faces_in_fond;
- }
-
- CloseResFile( res_ref );
- if ( !error && aface && *aface )
- (*aface)->num_faces = num_faces_in_res;
- return error;
- }
-
-
- /* documentation is in ftmac.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_New_Face_From_FOND( FT_Library library,
- Handle fond,
- FT_Long face_index,
- FT_Face* aface )
- {
- short have_sfnt, have_lwfn = 0;
- ResID sfnt_id, fond_id;
- OSType fond_type;
- Str255 fond_name;
- Str255 lwfn_file_name;
- UInt8 path_lwfn[PATH_MAX];
- OSErr err;
- FT_Error error = FT_Err_Ok;
-
-
- /* check of `library' and `aface' delayed to `FT_New_Face_From_XXX' */
-
- GetResInfo( fond, &fond_id, &fond_type, fond_name );
- if ( ResError() != noErr || fond_type != TTAG_FOND )
- return FT_THROW( Invalid_File_Format );
-
- parse_fond( *fond, &have_sfnt, &sfnt_id, lwfn_file_name, face_index );
-
- if ( lwfn_file_name[0] )
- {
- ResFileRefNum res;
-
-
- res = HomeResFile( fond );
- if ( noErr != ResError() )
- goto found_no_lwfn_file;
-
- {
- UInt8 path_fond[PATH_MAX];
- FSRef ref;
-
-
- err = FSGetForkCBInfo( res, kFSInvalidVolumeRefNum,
- NULL, NULL, NULL, &ref, NULL );
- if ( noErr != err )
- goto found_no_lwfn_file;
-
- err = FSRefMakePath( &ref, path_fond, sizeof ( path_fond ) );
- if ( noErr != err )
- goto found_no_lwfn_file;
-
- error = lookup_lwfn_by_fond( path_fond, lwfn_file_name,
- path_lwfn, sizeof ( path_lwfn ) );
- if ( !error )
- have_lwfn = 1;
- }
- }
-
- if ( have_lwfn && ( !have_sfnt || PREFER_LWFN ) )
- error = FT_New_Face_From_LWFN( library,
- path_lwfn,
- face_index,
- aface );
- else
- error = FT_THROW( Unknown_File_Format );
-
- found_no_lwfn_file:
- if ( have_sfnt && error )
- error = FT_New_Face_From_SFNT( library,
- sfnt_id,
- face_index,
- aface );
-
- return error;
- }
-
-
- /* Common function to load a new FT_Face from a resource file. */
- static FT_Error
- FT_New_Face_From_Resource( FT_Library library,
- const UInt8* pathname,
- FT_Long face_index,
- FT_Face* aface )
- {
- OSType file_type;
- FT_Error error;
-
-
- /* LWFN is a (very) specific file format, check for it explicitly */
- file_type = get_file_type_from_path( pathname );
- if ( file_type == TTAG_LWFN )
- return FT_New_Face_From_LWFN( library, pathname, face_index, aface );
-
- /* Otherwise the file type doesn't matter (there are more than */
- /* `FFIL' and `tfil'). Just try opening it as a font suitcase; */
- /* if it works, fine. */
-
- error = FT_New_Face_From_Suitcase( library, pathname, face_index, aface );
- if ( error == 0 )
- return error;
-
- /* let it fall through to normal loader (.ttf, .otf, etc.); */
- /* we signal this by returning no error and no FT_Face */
- *aface = NULL;
- return 0;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_New_Face */
- /* */
- /* <Description> */
- /* This is the Mac-specific implementation of FT_New_Face. In */
- /* addition to the standard FT_New_Face() functionality, it also */
- /* accepts pathnames to Mac suitcase files. For further */
- /* documentation see the original FT_New_Face() in freetype.h. */
- /* */
- FT_EXPORT_DEF( FT_Error )
- FT_New_Face( FT_Library library,
- const char* pathname,
- FT_Long face_index,
- FT_Face* aface )
- {
- FT_Open_Args args;
- FT_Error error;
-
-
- /* test for valid `library' and `aface' delayed to FT_Open_Face() */
- if ( !pathname )
- return FT_THROW( Invalid_Argument );
-
- *aface = NULL;
-
- /* try resourcefork based font: LWFN, FFIL */
- error = FT_New_Face_From_Resource( library, (UInt8 *)pathname,
- face_index, aface );
- if ( error != 0 || *aface != NULL )
- return error;
-
- /* let it fall through to normal loader (.ttf, .otf, etc.) */
- args.flags = FT_OPEN_PATHNAME;
- args.pathname = (char*)pathname;
- return FT_Open_Face( library, &args, face_index, aface );
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_New_Face_From_FSRef */
- /* */
- /* <Description> */
- /* FT_New_Face_From_FSRef is identical to FT_New_Face except it */
- /* accepts an FSRef instead of a path. */
- /* */
- /* This function is deprecated because Carbon data types (FSRef) */
- /* are not cross-platform, and thus not suitable for the freetype API. */
- FT_EXPORT_DEF( FT_Error )
- FT_New_Face_From_FSRef( FT_Library library,
- const FSRef* ref,
- FT_Long face_index,
- FT_Face* aface )
- {
- FT_Error error;
- FT_Open_Args args;
-
- OSErr err;
- UInt8 pathname[PATH_MAX];
-
-
- /* check of `library' and `aface' delayed to */
- /* `FT_New_Face_From_Resource' */
-
- if ( !ref )
- return FT_THROW( Invalid_Argument );
-
- err = FSRefMakePath( ref, pathname, sizeof ( pathname ) );
- if ( err )
- error = FT_THROW( Cannot_Open_Resource );
-
- error = FT_New_Face_From_Resource( library, pathname, face_index, aface );
- if ( error != 0 || *aface != NULL )
- return error;
-
- /* fallback to datafork font */
- args.flags = FT_OPEN_PATHNAME;
- args.pathname = (char*)pathname;
- return FT_Open_Face( library, &args, face_index, aface );
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_New_Face_From_FSSpec */
- /* */
- /* <Description> */
- /* FT_New_Face_From_FSSpec is identical to FT_New_Face except it */
- /* accepts an FSSpec instead of a path. */
- /* */
- /* This function is deprecated because FSSpec is deprecated in Mac OS X */
- FT_EXPORT_DEF( FT_Error )
- FT_New_Face_From_FSSpec( FT_Library library,
- const FSSpec* spec,
- FT_Long face_index,
- FT_Face* aface )
- {
-#if ( __LP64__ ) || ( defined( MAC_OS_X_VERSION_10_5 ) && \
- ( MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 ) )
- FT_UNUSED( library );
- FT_UNUSED( spec );
- FT_UNUSED( face_index );
- FT_UNUSED( aface );
-
- return FT_THROW( Unimplemented_Feature );
-#else
- FSRef ref;
-
-
- /* check of `library' and `aface' delayed to `FT_New_Face_From_FSRef' */
-
- if ( !spec || FSpMakeFSRef( spec, &ref ) != noErr )
- return FT_THROW( Invalid_Argument );
- else
- return FT_New_Face_From_FSRef( library, &ref, face_index, aface );
-#endif
- }
-
-#endif /* FT_MACINTOSH */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/base/ftmm.c b/chromium/third_party/pdfium/third_party/freetype/src/base/ftmm.c
deleted file mode 100644
index 7c012aa4386..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/base/ftmm.c
+++ /dev/null
@@ -1,234 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftmm.c */
-/* */
-/* Multiple Master font support (body). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-
-#include FT_MULTIPLE_MASTERS_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_SERVICE_MULTIPLE_MASTERS_H
-
-
- /*************************************************************************/
- /* */
- /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
- /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
- /* messages during execution. */
- /* */
-#undef FT_COMPONENT
-#define FT_COMPONENT trace_mm
-
-
- static FT_Error
- ft_face_get_mm_service( FT_Face face,
- FT_Service_MultiMasters *aservice )
- {
- FT_Error error;
-
-
- *aservice = NULL;
-
- if ( !face )
- return FT_THROW( Invalid_Face_Handle );
-
- error = FT_ERR( Invalid_Argument );
-
- if ( FT_HAS_MULTIPLE_MASTERS( face ) )
- {
- FT_FACE_LOOKUP_SERVICE( face,
- *aservice,
- MULTI_MASTERS );
-
- if ( *aservice )
- error = FT_Err_Ok;
- }
-
- return error;
- }
-
-
- /* documentation is in ftmm.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Get_Multi_Master( FT_Face face,
- FT_Multi_Master *amaster )
- {
- FT_Error error;
- FT_Service_MultiMasters service;
-
-
- /* check of `face' delayed to `ft_face_get_mm_service' */
-
- if ( !amaster )
- return FT_THROW( Invalid_Argument );
-
- error = ft_face_get_mm_service( face, &service );
- if ( !error )
- {
- error = FT_ERR( Invalid_Argument );
- if ( service->get_mm )
- error = service->get_mm( face, amaster );
- }
-
- return error;
- }
-
-
- /* documentation is in ftmm.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Get_MM_Var( FT_Face face,
- FT_MM_Var* *amaster )
- {
- FT_Error error;
- FT_Service_MultiMasters service;
-
-
- /* check of `face' delayed to `ft_face_get_mm_service' */
-
- if ( !amaster )
- return FT_THROW( Invalid_Argument );
-
- error = ft_face_get_mm_service( face, &service );
- if ( !error )
- {
- error = FT_ERR( Invalid_Argument );
- if ( service->get_mm_var )
- error = service->get_mm_var( face, amaster );
- }
-
- return error;
- }
-
-
- /* documentation is in ftmm.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Set_MM_Design_Coordinates( FT_Face face,
- FT_UInt num_coords,
- FT_Long* coords )
- {
- FT_Error error;
- FT_Service_MultiMasters service;
-
-
- /* check of `face' delayed to `ft_face_get_mm_service' */
-
- if ( !coords )
- return FT_THROW( Invalid_Argument );
-
- error = ft_face_get_mm_service( face, &service );
- if ( !error )
- {
- error = FT_ERR( Invalid_Argument );
- if ( service->set_mm_design )
- error = service->set_mm_design( face, num_coords, coords );
- }
-
- return error;
- }
-
-
- /* documentation is in ftmm.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Set_Var_Design_Coordinates( FT_Face face,
- FT_UInt num_coords,
- FT_Fixed* coords )
- {
- FT_Error error;
- FT_Service_MultiMasters service;
-
-
- /* check of `face' delayed to `ft_face_get_mm_service' */
-
- if ( !coords )
- return FT_THROW( Invalid_Argument );
-
- error = ft_face_get_mm_service( face, &service );
- if ( !error )
- {
- error = FT_ERR( Invalid_Argument );
- if ( service->set_var_design )
- error = service->set_var_design( face, num_coords, coords );
- }
-
- return error;
- }
-
-
- /* documentation is in ftmm.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Set_MM_Blend_Coordinates( FT_Face face,
- FT_UInt num_coords,
- FT_Fixed* coords )
- {
- FT_Error error;
- FT_Service_MultiMasters service;
-
-
- /* check of `face' delayed to `ft_face_get_mm_service' */
-
- if ( !coords )
- return FT_THROW( Invalid_Argument );
-
- error = ft_face_get_mm_service( face, &service );
- if ( !error )
- {
- error = FT_ERR( Invalid_Argument );
- if ( service->set_mm_blend )
- error = service->set_mm_blend( face, num_coords, coords );
- }
-
- return error;
- }
-
-
- /* documentation is in ftmm.h */
-
- /* This is exactly the same as the previous function. It exists for */
- /* orthogonality. */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Set_Var_Blend_Coordinates( FT_Face face,
- FT_UInt num_coords,
- FT_Fixed* coords )
- {
- FT_Error error;
- FT_Service_MultiMasters service;
-
-
- /* check of `face' delayed to `ft_face_get_mm_service' */
-
- if ( !coords )
- return FT_THROW( Invalid_Argument );
-
- error = ft_face_get_mm_service( face, &service );
- if ( !error )
- {
- error = FT_ERR( Invalid_Argument );
- if ( service->set_mm_blend )
- error = service->set_mm_blend( face, num_coords, coords );
- }
-
- return error;
- }
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/base/ftobjs.c b/chromium/third_party/pdfium/third_party/freetype/src/base/ftobjs.c
deleted file mode 100644
index f0c2e77fccf..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/base/ftobjs.c
+++ /dev/null
@@ -1,4933 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftobjs.c */
-/* */
-/* The FreeType private base classes (body). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_LIST_H
-#include FT_OUTLINE_H
-#include FT_INTERNAL_VALIDATE_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_RFORK_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_SFNT_H /* for SFNT_Load_Table_Func */
-#include FT_TRUETYPE_TABLES_H
-#include FT_TRUETYPE_TAGS_H
-#include FT_TRUETYPE_IDS_H
-
-#include FT_SERVICE_PROPERTIES_H
-#include FT_SERVICE_SFNT_H
-#include FT_SERVICE_POSTSCRIPT_NAME_H
-#include FT_SERVICE_GLYPH_DICT_H
-#include FT_SERVICE_TT_CMAP_H
-#include FT_SERVICE_KERNING_H
-#include FT_SERVICE_TRUETYPE_ENGINE_H
-
-#ifdef FT_CONFIG_OPTION_MAC_FONTS
-#include "ftbase.h"
-#endif
-
-
-#ifdef FT_DEBUG_LEVEL_TRACE
-
-#include FT_BITMAP_H
-
-#if defined( _MSC_VER ) /* Visual C++ (and Intel C++) */
- /* We disable the warning `conversion from XXX to YYY, */
- /* possible loss of data' in order to compile cleanly with */
- /* the maximum level of warnings: `md5.c' is non-FreeType */
- /* code, and it gets used during development builds only. */
-#pragma warning( push )
-#pragma warning( disable : 4244 )
-#endif /* _MSC_VER */
-
- /* it's easiest to include `md5.c' directly */
-#include "md5.c"
-
-#if defined( _MSC_VER )
-#pragma warning( pop )
-#endif
-
-#endif /* FT_DEBUG_LEVEL_TRACE */
-
-
-#define GRID_FIT_METRICS
-
-
- FT_BASE_DEF( FT_Pointer )
- ft_service_list_lookup( FT_ServiceDesc service_descriptors,
- const char* service_id )
- {
- FT_Pointer result = NULL;
- FT_ServiceDesc desc = service_descriptors;
-
-
- if ( desc && service_id )
- {
- for ( ; desc->serv_id != NULL; desc++ )
- {
- if ( ft_strcmp( desc->serv_id, service_id ) == 0 )
- {
- result = (FT_Pointer)desc->serv_data;
- break;
- }
- }
- }
-
- return result;
- }
-
-
- FT_BASE_DEF( void )
- ft_validator_init( FT_Validator valid,
- const FT_Byte* base,
- const FT_Byte* limit,
- FT_ValidationLevel level )
- {
- valid->base = base;
- valid->limit = limit;
- valid->level = level;
- valid->error = FT_Err_Ok;
- }
-
-
- FT_BASE_DEF( FT_Int )
- ft_validator_run( FT_Validator valid )
- {
- /* This function doesn't work! None should call it. */
- FT_UNUSED( valid );
-
- return -1;
- }
-
-
- FT_BASE_DEF( void )
- ft_validator_error( FT_Validator valid,
- FT_Error error )
- {
- /* since the cast below also disables the compiler's */
- /* type check, we introduce a dummy variable, which */
- /* will be optimized away */
- volatile ft_jmp_buf* jump_buffer = &valid->jump_buffer;
-
-
- valid->error = error;
-
- /* throw away volatileness; use `jump_buffer' or the */
- /* compiler may warn about an unused local variable */
- ft_longjmp( *(ft_jmp_buf*) jump_buffer, 1 );
- }
-
-
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
- /**** ****/
- /**** ****/
- /**** S T R E A M ****/
- /**** ****/
- /**** ****/
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
-
-
- /* create a new input stream from an FT_Open_Args structure */
- /* */
- FT_BASE_DEF( FT_Error )
- FT_Stream_New( FT_Library library,
- const FT_Open_Args* args,
- FT_Stream *astream )
- {
- FT_Error error;
- FT_Memory memory;
- FT_Stream stream = NULL;
-
-
- *astream = NULL;
-
- if ( !library )
- return FT_THROW( Invalid_Library_Handle );
-
- if ( !args )
- return FT_THROW( Invalid_Argument );
-
- memory = library->memory;
-
- if ( FT_NEW( stream ) )
- goto Exit;
-
- stream->memory = memory;
-
- if ( args->flags & FT_OPEN_MEMORY )
- {
- /* create a memory-based stream */
- FT_Stream_OpenMemory( stream,
- (const FT_Byte*)args->memory_base,
- (FT_ULong)args->memory_size );
- }
-
-#ifndef FT_CONFIG_OPTION_DISABLE_STREAM_SUPPORT
-
- else if ( args->flags & FT_OPEN_PATHNAME )
- {
- /* create a normal system stream */
- error = FT_Stream_Open( stream, args->pathname );
- stream->pathname.pointer = args->pathname;
- }
- else if ( ( args->flags & FT_OPEN_STREAM ) && args->stream )
- {
- /* use an existing, user-provided stream */
-
- /* in this case, we do not need to allocate a new stream object */
- /* since the caller is responsible for closing it himself */
- FT_FREE( stream );
- stream = args->stream;
- }
-
-#endif
-
- else
- error = FT_THROW( Invalid_Argument );
-
- if ( error )
- FT_FREE( stream );
- else
- stream->memory = memory; /* just to be certain */
-
- *astream = stream;
-
- Exit:
- return error;
- }
-
-
- FT_BASE_DEF( void )
- FT_Stream_Free( FT_Stream stream,
- FT_Int external )
- {
- if ( stream )
- {
- FT_Memory memory = stream->memory;
-
-
- FT_Stream_Close( stream );
-
- if ( !external )
- FT_FREE( stream );
- }
- }
-
-
- /*************************************************************************/
- /* */
- /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
- /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
- /* messages during execution. */
- /* */
-#undef FT_COMPONENT
-#define FT_COMPONENT trace_objs
-
-
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
- /**** ****/
- /**** ****/
- /**** FACE, SIZE & GLYPH SLOT OBJECTS ****/
- /**** ****/
- /**** ****/
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
-
-
- static FT_Error
- ft_glyphslot_init( FT_GlyphSlot slot )
- {
- FT_Driver driver = slot->face->driver;
- FT_Driver_Class clazz = driver->clazz;
- FT_Memory memory = driver->root.memory;
- FT_Error error = FT_Err_Ok;
- FT_Slot_Internal internal = NULL;
-
-
- slot->library = driver->root.library;
-
- if ( FT_NEW( internal ) )
- goto Exit;
-
- slot->internal = internal;
-
- if ( FT_DRIVER_USES_OUTLINES( driver ) )
- error = FT_GlyphLoader_New( memory, &internal->loader );
-
- if ( !error && clazz->init_slot )
- error = clazz->init_slot( slot );
-
- Exit:
- return error;
- }
-
-
- FT_BASE_DEF( void )
- ft_glyphslot_free_bitmap( FT_GlyphSlot slot )
- {
- if ( slot->internal && ( slot->internal->flags & FT_GLYPH_OWN_BITMAP ) )
- {
- FT_Memory memory = FT_FACE_MEMORY( slot->face );
-
-
- FT_FREE( slot->bitmap.buffer );
- slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP;
- }
- else
- {
- /* assume that the bitmap buffer was stolen or not */
- /* allocated from the heap */
- slot->bitmap.buffer = NULL;
- }
- }
-
-
- FT_BASE_DEF( void )
- ft_glyphslot_set_bitmap( FT_GlyphSlot slot,
- FT_Byte* buffer )
- {
- ft_glyphslot_free_bitmap( slot );
-
- slot->bitmap.buffer = buffer;
-
- FT_ASSERT( (slot->internal->flags & FT_GLYPH_OWN_BITMAP) == 0 );
- }
-
-
- FT_BASE_DEF( FT_Error )
- ft_glyphslot_alloc_bitmap( FT_GlyphSlot slot,
- FT_ULong size )
- {
- FT_Memory memory = FT_FACE_MEMORY( slot->face );
- FT_Error error;
-
-
- if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP )
- FT_FREE( slot->bitmap.buffer );
- else
- slot->internal->flags |= FT_GLYPH_OWN_BITMAP;
-
- (void)FT_ALLOC( slot->bitmap.buffer, size );
- return error;
- }
-
-
- static void
- ft_glyphslot_clear( FT_GlyphSlot slot )
- {
- /* free bitmap if needed */
- ft_glyphslot_free_bitmap( slot );
-
- /* clear all public fields in the glyph slot */
- FT_ZERO( &slot->metrics );
- FT_ZERO( &slot->outline );
-
- slot->bitmap.width = 0;
- slot->bitmap.rows = 0;
- slot->bitmap.pitch = 0;
- slot->bitmap.pixel_mode = 0;
- /* `slot->bitmap.buffer' has been handled by ft_glyphslot_free_bitmap */
-
- slot->bitmap_left = 0;
- slot->bitmap_top = 0;
- slot->num_subglyphs = 0;
- slot->subglyphs = NULL;
- slot->control_data = NULL;
- slot->control_len = 0;
- slot->other = NULL;
- slot->format = FT_GLYPH_FORMAT_NONE;
-
- slot->linearHoriAdvance = 0;
- slot->linearVertAdvance = 0;
- slot->lsb_delta = 0;
- slot->rsb_delta = 0;
- }
-
-
- static void
- ft_glyphslot_done( FT_GlyphSlot slot )
- {
- FT_Driver driver = slot->face->driver;
- FT_Driver_Class clazz = driver->clazz;
- FT_Memory memory = driver->root.memory;
-
-
- if ( clazz->done_slot )
- clazz->done_slot( slot );
-
- /* free bitmap buffer if needed */
- ft_glyphslot_free_bitmap( slot );
-
- /* slot->internal might be NULL in out-of-memory situations */
- if ( slot->internal )
- {
- /* free glyph loader */
- if ( FT_DRIVER_USES_OUTLINES( driver ) )
- {
- FT_GlyphLoader_Done( slot->internal->loader );
- slot->internal->loader = NULL;
- }
-
- FT_FREE( slot->internal );
- }
- }
-
-
- /* documentation is in ftobjs.h */
-
- FT_BASE_DEF( FT_Error )
- FT_New_GlyphSlot( FT_Face face,
- FT_GlyphSlot *aslot )
- {
- FT_Error error;
- FT_Driver driver;
- FT_Driver_Class clazz;
- FT_Memory memory;
- FT_GlyphSlot slot = NULL;
-
-
- if ( !face )
- return FT_THROW( Invalid_Face_Handle );
-
- if ( !face->driver )
- return FT_THROW( Invalid_Argument );
-
- driver = face->driver;
- clazz = driver->clazz;
- memory = driver->root.memory;
-
- FT_TRACE4(( "FT_New_GlyphSlot: Creating new slot object\n" ));
- if ( !FT_ALLOC( slot, clazz->slot_object_size ) )
- {
- slot->face = face;
-
- error = ft_glyphslot_init( slot );
- if ( error )
- {
- ft_glyphslot_done( slot );
- FT_FREE( slot );
- goto Exit;
- }
-
- slot->next = face->glyph;
- face->glyph = slot;
-
- if ( aslot )
- *aslot = slot;
- }
- else if ( aslot )
- *aslot = NULL;
-
-
- Exit:
- FT_TRACE4(( "FT_New_GlyphSlot: Return %d\n", error ));
- return error;
- }
-
-
- /* documentation is in ftobjs.h */
-
- FT_BASE_DEF( void )
- FT_Done_GlyphSlot( FT_GlyphSlot slot )
- {
- if ( slot )
- {
- FT_Driver driver = slot->face->driver;
- FT_Memory memory = driver->root.memory;
- FT_GlyphSlot prev;
- FT_GlyphSlot cur;
-
-
- /* Remove slot from its parent face's list */
- prev = NULL;
- cur = slot->face->glyph;
-
- while ( cur )
- {
- if ( cur == slot )
- {
- if ( !prev )
- slot->face->glyph = cur->next;
- else
- prev->next = cur->next;
-
- /* finalize client-specific data */
- if ( slot->generic.finalizer )
- slot->generic.finalizer( slot );
-
- ft_glyphslot_done( slot );
- FT_FREE( slot );
- break;
- }
- prev = cur;
- cur = cur->next;
- }
- }
- }
-
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( void )
- FT_Set_Transform( FT_Face face,
- FT_Matrix* matrix,
- FT_Vector* delta )
- {
- FT_Face_Internal internal;
-
-
- if ( !face )
- return;
-
- internal = face->internal;
-
- internal->transform_flags = 0;
-
- if ( !matrix )
- {
- internal->transform_matrix.xx = 0x10000L;
- internal->transform_matrix.xy = 0;
- internal->transform_matrix.yx = 0;
- internal->transform_matrix.yy = 0x10000L;
-
- matrix = &internal->transform_matrix;
- }
- else
- internal->transform_matrix = *matrix;
-
- /* set transform_flags bit flag 0 if `matrix' isn't the identity */
- if ( ( matrix->xy | matrix->yx ) ||
- matrix->xx != 0x10000L ||
- matrix->yy != 0x10000L )
- internal->transform_flags |= 1;
-
- if ( !delta )
- {
- internal->transform_delta.x = 0;
- internal->transform_delta.y = 0;
-
- delta = &internal->transform_delta;
- }
- else
- internal->transform_delta = *delta;
-
- /* set transform_flags bit flag 1 if `delta' isn't the null vector */
- if ( delta->x | delta->y )
- internal->transform_flags |= 2;
- }
-
-
- static FT_Renderer
- ft_lookup_glyph_renderer( FT_GlyphSlot slot );
-
-
-#ifdef GRID_FIT_METRICS
- static void
- ft_glyphslot_grid_fit_metrics( FT_GlyphSlot slot,
- FT_Bool vertical )
- {
- FT_Glyph_Metrics* metrics = &slot->metrics;
- FT_Pos right, bottom;
-
-
- if ( vertical )
- {
- metrics->horiBearingX = FT_PIX_FLOOR( metrics->horiBearingX );
- metrics->horiBearingY = FT_PIX_CEIL ( metrics->horiBearingY );
-
- right = FT_PIX_CEIL( metrics->vertBearingX + metrics->width );
- bottom = FT_PIX_CEIL( metrics->vertBearingY + metrics->height );
-
- metrics->vertBearingX = FT_PIX_FLOOR( metrics->vertBearingX );
- metrics->vertBearingY = FT_PIX_FLOOR( metrics->vertBearingY );
-
- metrics->width = right - metrics->vertBearingX;
- metrics->height = bottom - metrics->vertBearingY;
- }
- else
- {
- metrics->vertBearingX = FT_PIX_FLOOR( metrics->vertBearingX );
- metrics->vertBearingY = FT_PIX_FLOOR( metrics->vertBearingY );
-
- right = FT_PIX_CEIL ( metrics->horiBearingX + metrics->width );
- bottom = FT_PIX_FLOOR( metrics->horiBearingY - metrics->height );
-
- metrics->horiBearingX = FT_PIX_FLOOR( metrics->horiBearingX );
- metrics->horiBearingY = FT_PIX_CEIL ( metrics->horiBearingY );
-
- metrics->width = right - metrics->horiBearingX;
- metrics->height = metrics->horiBearingY - bottom;
- }
-
- metrics->horiAdvance = FT_PIX_ROUND( metrics->horiAdvance );
- metrics->vertAdvance = FT_PIX_ROUND( metrics->vertAdvance );
- }
-#endif /* GRID_FIT_METRICS */
-
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Load_Glyph( FT_Face face,
- FT_UInt glyph_index,
- FT_Int32 load_flags )
- {
- FT_Error error;
- FT_Driver driver;
- FT_GlyphSlot slot;
- FT_Library library;
- FT_Bool autohint = FALSE;
- FT_Module hinter;
- TT_Face ttface = (TT_Face)face;
-
-
- if ( !face || !face->size || !face->glyph )
- return FT_THROW( Invalid_Face_Handle );
-
- /* The validity test for `glyph_index' is performed by the */
- /* font drivers. */
-
- slot = face->glyph;
- ft_glyphslot_clear( slot );
-
- driver = face->driver;
- library = driver->root.library;
- hinter = library->auto_hinter;
-
- /* resolve load flags dependencies */
-
- if ( load_flags & FT_LOAD_NO_RECURSE )
- load_flags |= FT_LOAD_NO_SCALE |
- FT_LOAD_IGNORE_TRANSFORM;
-
- if ( load_flags & FT_LOAD_NO_SCALE )
- {
- load_flags |= FT_LOAD_NO_HINTING |
- FT_LOAD_NO_BITMAP;
-
- load_flags &= ~FT_LOAD_RENDER;
- }
-
- /*
- * Determine whether we need to auto-hint or not.
- * The general rules are:
- *
- * - Do only auto-hinting if we have a hinter module, a scalable font
- * format dealing with outlines, and no transforms except simple
- * slants and/or rotations by integer multiples of 90 degrees.
- *
- * - Then, auto-hint if FT_LOAD_FORCE_AUTOHINT is set or if we don't
- * have a native font hinter.
- *
- * - Otherwise, auto-hint for LIGHT hinting mode or if there isn't
- * any hinting bytecode in the TrueType/OpenType font.
- *
- * - Exception: The font is `tricky' and requires the native hinter to
- * load properly.
- */
-
- if ( hinter &&
- !( load_flags & FT_LOAD_NO_HINTING ) &&
- !( load_flags & FT_LOAD_NO_AUTOHINT ) &&
- FT_DRIVER_IS_SCALABLE( driver ) &&
- FT_DRIVER_USES_OUTLINES( driver ) &&
- !FT_IS_TRICKY( face ) &&
- ( ( load_flags & FT_LOAD_IGNORE_TRANSFORM ) ||
- ( face->internal->transform_matrix.yx == 0 &&
- face->internal->transform_matrix.xx != 0 ) ||
- ( face->internal->transform_matrix.xx == 0 &&
- face->internal->transform_matrix.yx != 0 ) ) )
- {
- if ( ( load_flags & FT_LOAD_FORCE_AUTOHINT ) ||
- !FT_DRIVER_HAS_HINTER( driver ) )
- autohint = TRUE;
- else
- {
- FT_Render_Mode mode = FT_LOAD_TARGET_MODE( load_flags );
-
-
- /* the check for `num_locations' assures that we actually */
- /* test for instructions in a TTF and not in a CFF-based OTF */
- /* */
- /* since `maxSizeOfInstructions' might be unreliable, we */
- /* check the size of the `fpgm' and `prep' tables, too -- */
- /* the assumption is that there don't exist real TTFs where */
- /* both `fpgm' and `prep' tables are missing */
- if ( mode == FT_RENDER_MODE_LIGHT ||
- face->internal->ignore_unpatented_hinter ||
- ( FT_IS_SFNT( face ) &&
- ttface->num_locations &&
- ttface->max_profile.maxSizeOfInstructions == 0 &&
- ttface->font_program_size == 0 &&
- ttface->cvt_program_size == 0 ) )
- autohint = TRUE;
- }
- }
-
- if ( autohint )
- {
- FT_AutoHinter_Interface hinting;
-
-
- /* try to load embedded bitmaps first if available */
- /* */
- /* XXX: This is really a temporary hack that should disappear */
- /* promptly with FreeType 2.1! */
- /* */
- if ( FT_HAS_FIXED_SIZES( face ) &&
- ( load_flags & FT_LOAD_NO_BITMAP ) == 0 )
- {
- error = driver->clazz->load_glyph( slot, face->size,
- glyph_index,
- load_flags | FT_LOAD_SBITS_ONLY );
-
- if ( !error && slot->format == FT_GLYPH_FORMAT_BITMAP )
- goto Load_Ok;
- }
-
- {
- FT_Face_Internal internal = face->internal;
- FT_Int transform_flags = internal->transform_flags;
-
-
- /* since the auto-hinter calls FT_Load_Glyph by itself, */
- /* make sure that glyphs aren't transformed */
- internal->transform_flags = 0;
-
- /* load auto-hinted outline */
- hinting = (FT_AutoHinter_Interface)hinter->clazz->module_interface;
-
- error = hinting->load_glyph( (FT_AutoHinter)hinter,
- slot, face->size,
- glyph_index, load_flags );
-
- internal->transform_flags = transform_flags;
- }
- }
- else
- {
- error = driver->clazz->load_glyph( slot,
- face->size,
- glyph_index,
- load_flags );
- if ( error )
- goto Exit;
-
- if ( slot->format == FT_GLYPH_FORMAT_OUTLINE )
- {
- /* check that the loaded outline is correct */
- error = FT_Outline_Check( &slot->outline );
- if ( error )
- goto Exit;
-
-#ifdef GRID_FIT_METRICS
- if ( !( load_flags & FT_LOAD_NO_HINTING ) )
- ft_glyphslot_grid_fit_metrics( slot,
- FT_BOOL( load_flags & FT_LOAD_VERTICAL_LAYOUT ) );
-#endif
- }
- }
-
- Load_Ok:
- /* compute the advance */
- if ( load_flags & FT_LOAD_VERTICAL_LAYOUT )
- {
- slot->advance.x = 0;
- slot->advance.y = slot->metrics.vertAdvance;
- }
- else
- {
- slot->advance.x = slot->metrics.horiAdvance;
- slot->advance.y = 0;
- }
-
- /* compute the linear advance in 16.16 pixels */
- if ( ( load_flags & FT_LOAD_LINEAR_DESIGN ) == 0 &&
- ( FT_IS_SCALABLE( face ) ) )
- {
- FT_Size_Metrics* metrics = &face->size->metrics;
-
-
- /* it's tricky! */
- slot->linearHoriAdvance = FT_MulDiv( slot->linearHoriAdvance,
- metrics->x_scale, 64 );
-
- slot->linearVertAdvance = FT_MulDiv( slot->linearVertAdvance,
- metrics->y_scale, 64 );
- }
-
- if ( ( load_flags & FT_LOAD_IGNORE_TRANSFORM ) == 0 )
- {
- FT_Face_Internal internal = face->internal;
-
-
- /* now, transform the glyph image if needed */
- if ( internal->transform_flags )
- {
- /* get renderer */
- FT_Renderer renderer = ft_lookup_glyph_renderer( slot );
-
-
- if ( renderer )
- error = renderer->clazz->transform_glyph(
- renderer, slot,
- &internal->transform_matrix,
- &internal->transform_delta );
- else if ( slot->format == FT_GLYPH_FORMAT_OUTLINE )
- {
- /* apply `standard' transformation if no renderer is available */
- if ( internal->transform_flags & 1 )
- FT_Outline_Transform( &slot->outline,
- &internal->transform_matrix );
-
- if ( internal->transform_flags & 2 )
- FT_Outline_Translate( &slot->outline,
- internal->transform_delta.x,
- internal->transform_delta.y );
- }
-
- /* transform advance */
- FT_Vector_Transform( &slot->advance, &internal->transform_matrix );
- }
- }
-
- FT_TRACE5(( " x advance: %d\n" , slot->advance.x ));
- FT_TRACE5(( " y advance: %d\n" , slot->advance.y ));
-
- FT_TRACE5(( " linear x advance: %d\n" , slot->linearHoriAdvance ));
- FT_TRACE5(( " linear y advance: %d\n" , slot->linearVertAdvance ));
-
- /* do we need to render the image now? */
- if ( !error &&
- slot->format != FT_GLYPH_FORMAT_BITMAP &&
- slot->format != FT_GLYPH_FORMAT_COMPOSITE &&
- load_flags & FT_LOAD_RENDER )
- {
- FT_Render_Mode mode = FT_LOAD_TARGET_MODE( load_flags );
-
-
- if ( mode == FT_RENDER_MODE_NORMAL &&
- (load_flags & FT_LOAD_MONOCHROME ) )
- mode = FT_RENDER_MODE_MONO;
-
- error = FT_Render_Glyph( slot, mode );
- }
-
- Exit:
- return error;
- }
-
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Load_Char( FT_Face face,
- FT_ULong char_code,
- FT_Int32 load_flags )
- {
- FT_UInt glyph_index;
-
-
- if ( !face )
- return FT_THROW( Invalid_Face_Handle );
-
- glyph_index = (FT_UInt)char_code;
- if ( face->charmap )
- glyph_index = FT_Get_Char_Index( face, char_code );
-
- return FT_Load_Glyph( face, glyph_index, load_flags );
- }
-
-
- /* destructor for sizes list */
- static void
- destroy_size( FT_Memory memory,
- FT_Size size,
- FT_Driver driver )
- {
- /* finalize client-specific data */
- if ( size->generic.finalizer )
- size->generic.finalizer( size );
-
- /* finalize format-specific stuff */
- if ( driver->clazz->done_size )
- driver->clazz->done_size( size );
-
- FT_FREE( size->internal );
- FT_FREE( size );
- }
-
-
- static void
- ft_cmap_done_internal( FT_CMap cmap );
-
-
- static void
- destroy_charmaps( FT_Face face,
- FT_Memory memory )
- {
- FT_Int n;
-
-
- if ( !face )
- return;
-
- for ( n = 0; n < face->num_charmaps; n++ )
- {
- FT_CMap cmap = FT_CMAP( face->charmaps[n] );
-
-
- ft_cmap_done_internal( cmap );
-
- face->charmaps[n] = NULL;
- }
-
- FT_FREE( face->charmaps );
- face->num_charmaps = 0;
- }
-
-
- /* destructor for faces list */
- static void
- destroy_face( FT_Memory memory,
- FT_Face face,
- FT_Driver driver )
- {
- FT_Driver_Class clazz = driver->clazz;
-
-
- /* discard auto-hinting data */
- if ( face->autohint.finalizer )
- face->autohint.finalizer( face->autohint.data );
-
- /* Discard glyph slots for this face. */
- /* Beware! FT_Done_GlyphSlot() changes the field `face->glyph' */
- while ( face->glyph )
- FT_Done_GlyphSlot( face->glyph );
-
- /* discard all sizes for this face */
- FT_List_Finalize( &face->sizes_list,
- (FT_List_Destructor)destroy_size,
- memory,
- driver );
- face->size = NULL;
-
- /* now discard client data */
- if ( face->generic.finalizer )
- face->generic.finalizer( face );
-
- /* discard charmaps */
- destroy_charmaps( face, memory );
-
- /* finalize format-specific stuff */
- if ( clazz->done_face )
- clazz->done_face( face );
-
- /* close the stream for this face if needed */
- FT_Stream_Free(
- face->stream,
- ( face->face_flags & FT_FACE_FLAG_EXTERNAL_STREAM ) != 0 );
-
- face->stream = NULL;
-
- /* get rid of it */
- if ( face->internal )
- {
- FT_FREE( face->internal );
- }
- FT_FREE( face );
- }
-
-
- static void
- Destroy_Driver( FT_Driver driver )
- {
- FT_List_Finalize( &driver->faces_list,
- (FT_List_Destructor)destroy_face,
- driver->root.memory,
- driver );
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* find_unicode_charmap */
- /* */
- /* <Description> */
- /* This function finds a Unicode charmap, if there is one. */
- /* And if there is more than one, it tries to favour the more */
- /* extensive one, i.e., one that supports UCS-4 against those which */
- /* are limited to the BMP (said UCS-2 encoding.) */
- /* */
- /* This function is called from open_face() (just below), and also */
- /* from FT_Select_Charmap( ..., FT_ENCODING_UNICODE ). */
- /* */
- static FT_Error
- find_unicode_charmap( FT_Face face )
- {
- FT_CharMap* first;
- FT_CharMap* cur;
-
-
- /* caller should have already checked that `face' is valid */
- FT_ASSERT( face );
-
- first = face->charmaps;
-
- if ( !first )
- return FT_THROW( Invalid_CharMap_Handle );
-
- /*
- * The original TrueType specification(s) only specified charmap
- * formats that are capable of mapping 8 or 16 bit character codes to
- * glyph indices.
- *
- * However, recent updates to the Apple and OpenType specifications
- * introduced new formats that are capable of mapping 32-bit character
- * codes as well. And these are already used on some fonts, mainly to
- * map non-BMP Asian ideographs as defined in Unicode.
- *
- * For compatibility purposes, these fonts generally come with
- * *several* Unicode charmaps:
- *
- * - One of them in the "old" 16-bit format, that cannot access
- * all glyphs in the font.
- *
- * - Another one in the "new" 32-bit format, that can access all
- * the glyphs.
- *
- * This function has been written to always favor a 32-bit charmap
- * when found. Otherwise, a 16-bit one is returned when found.
- */
-
- /* Since the `interesting' table, with IDs (3,10), is normally the */
- /* last one, we loop backwards. This loses with type1 fonts with */
- /* non-BMP characters (<.0001%), this wins with .ttf with non-BMP */
- /* chars (.01% ?), and this is the same about 99.99% of the time! */
-
- cur = first + face->num_charmaps; /* points after the last one */
-
- for ( ; --cur >= first; )
- {
- if ( cur[0]->encoding == FT_ENCODING_UNICODE )
- {
- /* XXX If some new encodings to represent UCS-4 are added, */
- /* they should be added here. */
- if ( ( cur[0]->platform_id == TT_PLATFORM_MICROSOFT &&
- cur[0]->encoding_id == TT_MS_ID_UCS_4 ) ||
- ( cur[0]->platform_id == TT_PLATFORM_APPLE_UNICODE &&
- cur[0]->encoding_id == TT_APPLE_ID_UNICODE_32 ) )
- {
- face->charmap = cur[0];
- return FT_Err_Ok;
- }
- }
- }
-
- /* We do not have any UCS-4 charmap. */
- /* Do the loop again and search for UCS-2 charmaps. */
- cur = first + face->num_charmaps;
-
- for ( ; --cur >= first; )
- {
- if ( cur[0]->encoding == FT_ENCODING_UNICODE )
- {
- face->charmap = cur[0];
- return FT_Err_Ok;
- }
- }
-
- return FT_THROW( Invalid_CharMap_Handle );
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* find_variant_selector_charmap */
- /* */
- /* <Description> */
- /* This function finds the variant selector charmap, if there is one. */
- /* There can only be one (platform=0, specific=5, format=14). */
- /* */
- static FT_CharMap
- find_variant_selector_charmap( FT_Face face )
- {
- FT_CharMap* first;
- FT_CharMap* end;
- FT_CharMap* cur;
-
-
- /* caller should have already checked that `face' is valid */
- FT_ASSERT( face );
-
- first = face->charmaps;
-
- if ( !first )
- return NULL;
-
- end = first + face->num_charmaps; /* points after the last one */
-
- for ( cur = first; cur < end; ++cur )
- {
- if ( cur[0]->platform_id == TT_PLATFORM_APPLE_UNICODE &&
- cur[0]->encoding_id == TT_APPLE_ID_VARIANT_SELECTOR &&
- FT_Get_CMap_Format( cur[0] ) == 14 )
- return cur[0];
- }
-
- return NULL;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* open_face */
- /* */
- /* <Description> */
- /* This function does some work for FT_Open_Face(). */
- /* */
- static FT_Error
- open_face( FT_Driver driver,
- FT_Stream *astream,
- FT_Bool external_stream,
- FT_Long face_index,
- FT_Int num_params,
- FT_Parameter* params,
- FT_Face *aface )
- {
- FT_Memory memory;
- FT_Driver_Class clazz;
- FT_Face face = NULL;
- FT_Face_Internal internal = NULL;
-
- FT_Error error, error2;
-
-
- clazz = driver->clazz;
- memory = driver->root.memory;
-
- /* allocate the face object and perform basic initialization */
- if ( FT_ALLOC( face, clazz->face_object_size ) )
- goto Fail;
-
- face->driver = driver;
- face->memory = memory;
- face->stream = *astream;
-
- /* set the FT_FACE_FLAG_EXTERNAL_STREAM bit for FT_Done_Face */
- if ( external_stream )
- face->face_flags |= FT_FACE_FLAG_EXTERNAL_STREAM;
-
- if ( FT_NEW( internal ) )
- goto Fail;
-
- face->internal = internal;
-
-#ifdef FT_CONFIG_OPTION_INCREMENTAL
- {
- int i;
-
-
- face->internal->incremental_interface = NULL;
- for ( i = 0; i < num_params && !face->internal->incremental_interface;
- i++ )
- if ( params[i].tag == FT_PARAM_TAG_INCREMENTAL )
- face->internal->incremental_interface =
- (FT_Incremental_Interface)params[i].data;
- }
-#endif
-
- if ( clazz->init_face )
- error = clazz->init_face( *astream,
- face,
- (FT_Int)face_index,
- num_params,
- params );
- *astream = face->stream; /* Stream may have been changed. */
- if ( error )
- goto Fail;
-
- /* select Unicode charmap by default */
- error2 = find_unicode_charmap( face );
-
- /* if no Unicode charmap can be found, FT_Err_Invalid_CharMap_Handle */
- /* is returned. */
-
- /* no error should happen, but we want to play safe */
- if ( error2 && FT_ERR_NEQ( error2, Invalid_CharMap_Handle ) )
- {
- error = error2;
- goto Fail;
- }
-
- *aface = face;
-
- Fail:
- if ( error )
- {
- destroy_charmaps( face, memory );
- if ( clazz->done_face )
- clazz->done_face( face );
- FT_FREE( internal );
- FT_FREE( face );
- *aface = NULL;
- }
-
- return error;
- }
-
-
- /* there's a Mac-specific extended implementation of FT_New_Face() */
- /* in src/base/ftmac.c */
-
-#ifndef FT_MACINTOSH
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_New_Face( FT_Library library,
- const char* pathname,
- FT_Long face_index,
- FT_Face *aface )
- {
- FT_Open_Args args;
-
-
- /* test for valid `library' and `aface' delayed to `FT_Open_Face' */
- if ( !pathname )
- return FT_THROW( Invalid_Argument );
-
- args.flags = FT_OPEN_PATHNAME;
- args.pathname = (char*)pathname;
- args.stream = NULL;
-
- return FT_Open_Face( library, &args, face_index, aface );
- }
-
-#endif
-
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_New_Memory_Face( FT_Library library,
- const FT_Byte* file_base,
- FT_Long file_size,
- FT_Long face_index,
- FT_Face *aface )
- {
- FT_Open_Args args;
-
-
- /* test for valid `library' and `face' delayed to `FT_Open_Face' */
- if ( !file_base )
- return FT_THROW( Invalid_Argument );
-
- args.flags = FT_OPEN_MEMORY;
- args.memory_base = file_base;
- args.memory_size = file_size;
- args.stream = NULL;
-
- return FT_Open_Face( library, &args, face_index, aface );
- }
-
-
-#ifdef FT_CONFIG_OPTION_MAC_FONTS
-
- /* The behavior here is very similar to that in base/ftmac.c, but it */
- /* is designed to work on non-mac systems, so no mac specific calls. */
- /* */
- /* We look at the file and determine if it is a mac dfont file or a mac */
- /* resource file, or a macbinary file containing a mac resource file. */
- /* */
- /* Unlike ftmac I'm not going to look at a `FOND'. I don't really see */
- /* the point, especially since there may be multiple `FOND' resources. */
- /* Instead I'll just look for `sfnt' and `POST' resources, ordered as */
- /* they occur in the file. */
- /* */
- /* Note that multiple `POST' resources do not mean multiple postscript */
- /* fonts; they all get jammed together to make what is essentially a */
- /* pfb file. */
- /* */
- /* We aren't interested in `NFNT' or `FONT' bitmap resources. */
- /* */
- /* As soon as we get an `sfnt' load it into memory and pass it off to */
- /* FT_Open_Face. */
- /* */
- /* If we have a (set of) `POST' resources, massage them into a (memory) */
- /* pfb file and pass that to FT_Open_Face. (As with ftmac.c I'm not */
- /* going to try to save the kerning info. After all that lives in the */
- /* `FOND' which isn't in the file containing the `POST' resources so */
- /* we don't really have access to it. */
-
-
- /* Finalizer for a memory stream; gets called by FT_Done_Face(). */
- /* It frees the memory it uses. */
- /* From ftmac.c. */
- static void
- memory_stream_close( FT_Stream stream )
- {
- FT_Memory memory = stream->memory;
-
-
- FT_FREE( stream->base );
-
- stream->size = 0;
- stream->base = NULL;
- stream->close = NULL;
- }
-
-
- /* Create a new memory stream from a buffer and a size. */
- /* From ftmac.c. */
- static FT_Error
- new_memory_stream( FT_Library library,
- FT_Byte* base,
- FT_ULong size,
- FT_Stream_CloseFunc close,
- FT_Stream *astream )
- {
- FT_Error error;
- FT_Memory memory;
- FT_Stream stream = NULL;
-
-
- if ( !library )
- return FT_THROW( Invalid_Library_Handle );
-
- if ( !base )
- return FT_THROW( Invalid_Argument );
-
- *astream = NULL;
- memory = library->memory;
- if ( FT_NEW( stream ) )
- goto Exit;
-
- FT_Stream_OpenMemory( stream, base, size );
-
- stream->close = close;
-
- *astream = stream;
-
- Exit:
- return error;
- }
-
-
- /* Create a new FT_Face given a buffer and a driver name. */
- /* from ftmac.c */
- FT_LOCAL_DEF( FT_Error )
- open_face_from_buffer( FT_Library library,
- FT_Byte* base,
- FT_ULong size,
- FT_Long face_index,
- const char* driver_name,
- FT_Face *aface )
- {
- FT_Open_Args args;
- FT_Error error;
- FT_Stream stream = NULL;
- FT_Memory memory = library->memory;
-
-
- error = new_memory_stream( library,
- base,
- size,
- memory_stream_close,
- &stream );
- if ( error )
- {
- FT_FREE( base );
- return error;
- }
-
- args.flags = FT_OPEN_STREAM;
- args.stream = stream;
- if ( driver_name )
- {
- args.flags = args.flags | FT_OPEN_DRIVER;
- args.driver = FT_Get_Module( library, driver_name );
- }
-
-#ifdef FT_MACINTOSH
- /* At this point, the face index has served its purpose; */
- /* whoever calls this function has already used it to */
- /* locate the correct font data. We should not propagate */
- /* this index to FT_Open_Face() (unless it is negative). */
-
- if ( face_index > 0 )
- face_index &= 0x7FFF0000L; /* retain GX data */
-#endif
-
- error = FT_Open_Face( library, &args, face_index, aface );
-
- if ( error == FT_Err_Ok )
- (*aface)->face_flags &= ~FT_FACE_FLAG_EXTERNAL_STREAM;
- else
-#ifdef FT_MACINTOSH
- FT_Stream_Free( stream, 0 );
-#else
- {
- FT_Stream_Close( stream );
- FT_FREE( stream );
- }
-#endif
-
- return error;
- }
-
-
- /* Look up `TYP1' or `CID ' table from sfnt table directory. */
- /* `offset' and `length' must exclude the binary header in tables. */
-
- /* Type 1 and CID-keyed font drivers should recognize sfnt-wrapped */
- /* format too. Here, since we can't expect that the TrueType font */
- /* driver is loaded unconditially, we must parse the font by */
- /* ourselves. We are only interested in the name of the table and */
- /* the offset. */
-
- static FT_Error
- ft_lookup_PS_in_sfnt_stream( FT_Stream stream,
- FT_Long face_index,
- FT_ULong* offset,
- FT_ULong* length,
- FT_Bool* is_sfnt_cid )
- {
- FT_Error error;
- FT_UShort numTables;
- FT_Long pstable_index;
- FT_ULong tag;
- int i;
-
-
- *offset = 0;
- *length = 0;
- *is_sfnt_cid = FALSE;
-
- /* TODO: support for sfnt-wrapped PS/CID in TTC format */
-
- /* version check for 'typ1' (should be ignored?) */
- if ( FT_READ_ULONG( tag ) )
- return error;
- if ( tag != TTAG_typ1 )
- return FT_THROW( Unknown_File_Format );
-
- if ( FT_READ_USHORT( numTables ) )
- return error;
- if ( FT_STREAM_SKIP( 2 * 3 ) ) /* skip binary search header */
- return error;
-
- pstable_index = -1;
- *is_sfnt_cid = FALSE;
-
- for ( i = 0; i < numTables; i++ )
- {
- if ( FT_READ_ULONG( tag ) || FT_STREAM_SKIP( 4 ) ||
- FT_READ_ULONG( *offset ) || FT_READ_ULONG( *length ) )
- return error;
-
- if ( tag == TTAG_CID )
- {
- pstable_index++;
- *offset += 22;
- *length -= 22;
- *is_sfnt_cid = TRUE;
- if ( face_index < 0 )
- return FT_Err_Ok;
- }
- else if ( tag == TTAG_TYP1 )
- {
- pstable_index++;
- *offset += 24;
- *length -= 24;
- *is_sfnt_cid = FALSE;
- if ( face_index < 0 )
- return FT_Err_Ok;
- }
- if ( face_index >= 0 && pstable_index == face_index )
- return FT_Err_Ok;
- }
- return FT_THROW( Table_Missing );
- }
-
-
- FT_LOCAL_DEF( FT_Error )
- open_face_PS_from_sfnt_stream( FT_Library library,
- FT_Stream stream,
- FT_Long face_index,
- FT_Int num_params,
- FT_Parameter *params,
- FT_Face *aface )
- {
- FT_Error error;
- FT_Memory memory = library->memory;
- FT_ULong offset, length;
- FT_ULong pos;
- FT_Bool is_sfnt_cid;
- FT_Byte* sfnt_ps = NULL;
-
- FT_UNUSED( num_params );
- FT_UNUSED( params );
-
-
- /* ignore GX stuff */
- if ( face_index > 0 )
- face_index &= 0xFFFFL;
-
- pos = FT_STREAM_POS();
-
- error = ft_lookup_PS_in_sfnt_stream( stream,
- face_index,
- &offset,
- &length,
- &is_sfnt_cid );
- if ( error )
- goto Exit;
-
- if ( FT_Stream_Seek( stream, pos + offset ) )
- goto Exit;
-
- if ( FT_ALLOC( sfnt_ps, (FT_Long)length ) )
- goto Exit;
-
- error = FT_Stream_Read( stream, (FT_Byte *)sfnt_ps, length );
- if ( error ) {
- FT_FREE( sfnt_ps );
- goto Exit;
- }
-
- error = open_face_from_buffer( library,
- sfnt_ps,
- length,
- FT_MIN( face_index, 0 ),
- is_sfnt_cid ? "cid" : "type1",
- aface );
- Exit:
- {
- FT_Error error1;
-
-
- if ( FT_ERR_EQ( error, Unknown_File_Format ) )
- {
- error1 = FT_Stream_Seek( stream, pos );
- if ( error1 )
- return error1;
- }
-
- return error;
- }
- }
-
-
-#ifndef FT_MACINTOSH
-
- /* The resource header says we've got resource_cnt `POST' (type1) */
- /* resources in this file. They all need to be coalesced into */
- /* one lump which gets passed on to the type1 driver. */
- /* Here can be only one PostScript font in a file so face_index */
- /* must be 0 (or -1). */
- /* */
- static FT_Error
- Mac_Read_POST_Resource( FT_Library library,
- FT_Stream stream,
- FT_Long *offsets,
- FT_Long resource_cnt,
- FT_Long face_index,
- FT_Face *aface )
- {
- FT_Error error = FT_ERR( Cannot_Open_Resource );
- FT_Memory memory = library->memory;
- FT_Byte* pfb_data = NULL;
- int i, type, flags;
- FT_ULong len;
- FT_ULong pfb_len, pfb_pos, pfb_lenpos;
- FT_ULong rlen, temp;
-
-
- if ( face_index == -1 )
- face_index = 0;
- if ( face_index != 0 )
- return error;
-
- /* Find the length of all the POST resources, concatenated. Assume */
- /* worst case (each resource in its own section). */
- pfb_len = 0;
- for ( i = 0; i < resource_cnt; ++i )
- {
- error = FT_Stream_Seek( stream, (FT_ULong)offsets[i] );
- if ( error )
- goto Exit;
- if ( FT_READ_ULONG( temp ) )
- goto Exit;
-
- /* FT2 allocator takes signed long buffer length,
- * too large value causing overflow should be checked
- */
- FT_TRACE4(( " POST fragment #%d: length=0x%08x"
- " total pfb_len=0x%08x\n",
- i, temp, pfb_len + temp + 6));
- if ( FT_MAC_RFORK_MAX_LEN < temp ||
- FT_MAC_RFORK_MAX_LEN - temp < pfb_len + 6 )
- {
- FT_TRACE2(( " MacOS resource length cannot exceed"
- " 0x%08x\n", FT_MAC_RFORK_MAX_LEN ));
- error = FT_THROW( Invalid_Offset );
- goto Exit;
- }
-
- pfb_len += temp + 6;
- }
-
- FT_TRACE2(( " total buffer size to concatenate %d"
- " POST fragments: 0x%08x\n",
- resource_cnt, pfb_len + 2));
- if ( pfb_len + 2 < 6 ) {
- FT_TRACE2(( " too long fragment length makes"
- " pfb_len confused: pfb_len=0x%08x\n", pfb_len ));
- error = FT_THROW( Array_Too_Large );
- goto Exit;
- }
- if ( FT_ALLOC( pfb_data, (FT_Long)pfb_len + 2 ) )
- goto Exit;
-
- pfb_data[0] = 0x80;
- pfb_data[1] = 1; /* Ascii section */
- pfb_data[2] = 0; /* 4-byte length, fill in later */
- pfb_data[3] = 0;
- pfb_data[4] = 0;
- pfb_data[5] = 0;
- pfb_pos = 6;
- pfb_lenpos = 2;
-
- len = 0;
- type = 1;
- for ( i = 0; i < resource_cnt; ++i )
- {
- error = FT_Stream_Seek( stream, (FT_ULong)offsets[i] );
- if ( error )
- goto Exit2;
- if ( FT_READ_ULONG( rlen ) )
- goto Exit2;
-
- /* FT2 allocator takes signed long buffer length,
- * too large fragment length causing overflow should be checked
- */
- if ( 0x7FFFFFFFUL < rlen )
- {
- error = FT_THROW( Invalid_Offset );
- goto Exit2;
- }
-
- if ( FT_READ_USHORT( flags ) )
- goto Exit2;
- FT_TRACE3(( "POST fragment[%d]: offsets=0x%08x, rlen=0x%08x, flags=0x%04x\n",
- i, offsets[i], rlen, flags ));
-
- error = FT_ERR( Array_Too_Large );
- /* postpone the check of rlen longer than buffer until FT_Stream_Read() */
- if ( ( flags >> 8 ) == 0 ) /* Comment, should not be loaded */
- {
- FT_TRACE3(( " Skip POST fragment #%d because it is a comment\n", i ));
- continue;
- }
-
- /* the flags are part of the resource, so rlen >= 2. */
- /* but some fonts declare rlen = 0 for empty fragment */
- if ( rlen > 2 )
- rlen -= 2;
- else
- rlen = 0;
-
- if ( ( flags >> 8 ) == type )
- len += rlen;
- else
- {
- FT_TRACE3(( " Write POST fragment #%d header (4-byte) to buffer"
- " %p + 0x%08x\n", i, pfb_data, pfb_lenpos ));
- if ( pfb_lenpos + 3 > pfb_len + 2 )
- goto Exit2;
- pfb_data[pfb_lenpos ] = (FT_Byte)( len );
- pfb_data[pfb_lenpos + 1] = (FT_Byte)( len >> 8 );
- pfb_data[pfb_lenpos + 2] = (FT_Byte)( len >> 16 );
- pfb_data[pfb_lenpos + 3] = (FT_Byte)( len >> 24 );
-
- if ( ( flags >> 8 ) == 5 ) /* End of font mark */
- break;
-
- FT_TRACE3(( " Write POST fragment #%d header (6-byte) to buffer"
- " %p + 0x%08x\n", i, pfb_data, pfb_pos ));
- if ( pfb_pos + 6 > pfb_len + 2 )
- goto Exit2;
- pfb_data[pfb_pos++] = 0x80;
-
- type = flags >> 8;
- len = rlen;
-
- pfb_data[pfb_pos++] = (FT_Byte)type;
- pfb_lenpos = pfb_pos;
- pfb_data[pfb_pos++] = 0; /* 4-byte length, fill in later */
- pfb_data[pfb_pos++] = 0;
- pfb_data[pfb_pos++] = 0;
- pfb_data[pfb_pos++] = 0;
- }
-
- if ( pfb_pos > pfb_len || pfb_pos + rlen > pfb_len )
- goto Exit2;
-
- FT_TRACE3(( " Load POST fragment #%d (%d byte) to buffer"
- " %p + 0x%08x\n", i, rlen, pfb_data, pfb_pos ));
- error = FT_Stream_Read( stream, (FT_Byte *)pfb_data + pfb_pos, rlen );
- if ( error )
- goto Exit2;
- pfb_pos += rlen;
- }
-
- error = FT_ERR( Array_Too_Large );
- if ( pfb_pos + 2 > pfb_len + 2 )
- goto Exit2;
- pfb_data[pfb_pos++] = 0x80;
- pfb_data[pfb_pos++] = 3;
-
- if ( pfb_lenpos + 3 > pfb_len + 2 )
- goto Exit2;
- pfb_data[pfb_lenpos ] = (FT_Byte)( len );
- pfb_data[pfb_lenpos + 1] = (FT_Byte)( len >> 8 );
- pfb_data[pfb_lenpos + 2] = (FT_Byte)( len >> 16 );
- pfb_data[pfb_lenpos + 3] = (FT_Byte)( len >> 24 );
-
- return open_face_from_buffer( library,
- pfb_data,
- pfb_pos,
- face_index,
- "type1",
- aface );
-
- Exit2:
- if ( error == FT_ERR( Array_Too_Large ) )
- FT_TRACE2(( " Abort due to too-short buffer to store"
- " all POST fragments\n" ));
- else if ( error == FT_ERR( Invalid_Offset ) )
- FT_TRACE2(( " Abort due to invalid offset in a POST fragment\n" ));
- if ( error )
- error = FT_ERR( Cannot_Open_Resource );
- FT_FREE( pfb_data );
-
- Exit:
- return error;
- }
-
-
- /* The resource header says we've got resource_cnt `sfnt' */
- /* (TrueType/OpenType) resources in this file. Look through */
- /* them for the one indicated by face_index, load it into mem, */
- /* pass it on to the truetype driver, and return it. */
- /* */
- static FT_Error
- Mac_Read_sfnt_Resource( FT_Library library,
- FT_Stream stream,
- FT_Long *offsets,
- FT_Long resource_cnt,
- FT_Long face_index,
- FT_Face *aface )
- {
- FT_Memory memory = library->memory;
- FT_Byte* sfnt_data = NULL;
- FT_Error error;
- FT_ULong flag_offset;
- FT_Long rlen;
- int is_cff;
- FT_Long face_index_in_resource = 0;
-
-
- if ( face_index == -1 )
- face_index = 0;
- if ( face_index >= resource_cnt )
- return FT_THROW( Cannot_Open_Resource );
-
- flag_offset = (FT_ULong)offsets[face_index];
- error = FT_Stream_Seek( stream, flag_offset );
- if ( error )
- goto Exit;
-
- if ( FT_READ_LONG( rlen ) )
- goto Exit;
- if ( rlen == -1 )
- return FT_THROW( Cannot_Open_Resource );
- if ( (FT_ULong)rlen > FT_MAC_RFORK_MAX_LEN )
- return FT_THROW( Invalid_Offset );
-
- error = open_face_PS_from_sfnt_stream( library,
- stream,
- face_index,
- 0, NULL,
- aface );
- if ( !error )
- goto Exit;
-
- /* rewind sfnt stream before open_face_PS_from_sfnt_stream() */
- if ( FT_Stream_Seek( stream, flag_offset + 4 ) )
- goto Exit;
-
- if ( FT_ALLOC( sfnt_data, rlen ) )
- return error;
- error = FT_Stream_Read( stream, (FT_Byte *)sfnt_data, (FT_ULong)rlen );
- if ( error ) {
- FT_FREE( sfnt_data );
- goto Exit;
- }
-
- is_cff = rlen > 4 && !ft_memcmp( sfnt_data, "OTTO", 4 );
- error = open_face_from_buffer( library,
- sfnt_data,
- (FT_ULong)rlen,
- face_index_in_resource,
- is_cff ? "cff" : "truetype",
- aface );
-
- Exit:
- return error;
- }
-
-
- /* Check for a valid resource fork header, or a valid dfont */
- /* header. In a resource fork the first 16 bytes are repeated */
- /* at the location specified by bytes 4-7. In a dfont bytes */
- /* 4-7 point to 16 bytes of zeroes instead. */
- /* */
- static FT_Error
- IsMacResource( FT_Library library,
- FT_Stream stream,
- FT_Long resource_offset,
- FT_Long face_index,
- FT_Face *aface )
- {
- FT_Memory memory = library->memory;
- FT_Error error;
- FT_Long map_offset, rdara_pos;
- FT_Long *data_offsets;
- FT_Long count;
-
-
- error = FT_Raccess_Get_HeaderInfo( library, stream, resource_offset,
- &map_offset, &rdara_pos );
- if ( error )
- return error;
-
- /* POST resources must be sorted to concatenate properly */
- error = FT_Raccess_Get_DataOffsets( library, stream,
- map_offset, rdara_pos,
- TTAG_POST, TRUE,
- &data_offsets, &count );
- if ( !error )
- {
- error = Mac_Read_POST_Resource( library, stream, data_offsets, count,
- face_index, aface );
- FT_FREE( data_offsets );
- /* POST exists in an LWFN providing a single face */
- if ( !error )
- (*aface)->num_faces = 1;
- return error;
- }
-
- /* sfnt resources should not be sorted to preserve the face order by
- QuickDraw API */
- error = FT_Raccess_Get_DataOffsets( library, stream,
- map_offset, rdara_pos,
- TTAG_sfnt, FALSE,
- &data_offsets, &count );
- if ( !error )
- {
- FT_Long face_index_internal = face_index % count;
-
-
- error = Mac_Read_sfnt_Resource( library, stream, data_offsets, count,
- face_index_internal, aface );
- FT_FREE( data_offsets );
- if ( !error )
- (*aface)->num_faces = count;
- }
-
- return error;
- }
-
-
- /* Check for a valid macbinary header, and if we find one */
- /* check that the (flattened) resource fork in it is valid. */
- /* */
- static FT_Error
- IsMacBinary( FT_Library library,
- FT_Stream stream,
- FT_Long face_index,
- FT_Face *aface )
- {
- unsigned char header[128];
- FT_Error error;
- FT_Long dlen, offset;
-
-
- if ( NULL == stream )
- return FT_THROW( Invalid_Stream_Operation );
-
- error = FT_Stream_Seek( stream, 0 );
- if ( error )
- goto Exit;
-
- error = FT_Stream_Read( stream, (FT_Byte*)header, 128 );
- if ( error )
- goto Exit;
-
- if ( header[ 0] != 0 ||
- header[74] != 0 ||
- header[82] != 0 ||
- header[ 1] == 0 ||
- header[ 1] > 33 ||
- header[63] != 0 ||
- header[2 + header[1]] != 0 ||
- header[0x53] > 0x7F )
- return FT_THROW( Unknown_File_Format );
-
- dlen = ( header[0x53] << 24 ) |
- ( header[0x54] << 16 ) |
- ( header[0x55] << 8 ) |
- header[0x56];
-#if 0
- rlen = ( header[0x57] << 24 ) |
- ( header[0x58] << 16 ) |
- ( header[0x59] << 8 ) |
- header[0x5A];
-#endif /* 0 */
- offset = 128 + ( ( dlen + 127 ) & ~127 );
-
- return IsMacResource( library, stream, offset, face_index, aface );
-
- Exit:
- return error;
- }
-
-
- static FT_Error
- load_face_in_embedded_rfork( FT_Library library,
- FT_Stream stream,
- FT_Long face_index,
- FT_Face *aface,
- const FT_Open_Args *args )
- {
-
-#undef FT_COMPONENT
-#define FT_COMPONENT trace_raccess
-
- FT_Memory memory = library->memory;
- FT_Error error = FT_ERR( Unknown_File_Format );
- FT_UInt i;
-
- char * file_names[FT_RACCESS_N_RULES];
- FT_Long offsets[FT_RACCESS_N_RULES];
- FT_Error errors[FT_RACCESS_N_RULES];
- FT_Bool is_darwin_vfs, vfs_rfork_has_no_font = FALSE; /* not tested */
-
- FT_Open_Args args2;
- FT_Stream stream2 = NULL;
-
-
- FT_Raccess_Guess( library, stream,
- args->pathname, file_names, offsets, errors );
-
- for ( i = 0; i < FT_RACCESS_N_RULES; i++ )
- {
- is_darwin_vfs = ft_raccess_rule_by_darwin_vfs( library, i );
- if ( is_darwin_vfs && vfs_rfork_has_no_font )
- {
- FT_TRACE3(( "Skip rule %d: darwin vfs resource fork"
- " is already checked and"
- " no font is found\n", i ));
- continue;
- }
-
- if ( errors[i] )
- {
- FT_TRACE3(( "Error[%d] has occurred in rule %d\n", errors[i], i ));
- continue;
- }
-
- args2.flags = FT_OPEN_PATHNAME;
- args2.pathname = file_names[i] ? file_names[i] : args->pathname;
-
- FT_TRACE3(( "Try rule %d: %s (offset=%d) ...",
- i, args2.pathname, offsets[i] ));
-
- error = FT_Stream_New( library, &args2, &stream2 );
- if ( is_darwin_vfs && FT_ERR_EQ( error, Cannot_Open_Stream ) )
- vfs_rfork_has_no_font = TRUE;
-
- if ( error )
- {
- FT_TRACE3(( "failed\n" ));
- continue;
- }
-
- error = IsMacResource( library, stream2, offsets[i],
- face_index, aface );
- FT_Stream_Free( stream2, 0 );
-
- FT_TRACE3(( "%s\n", error ? "failed": "successful" ));
-
- if ( !error )
- break;
- else if ( is_darwin_vfs )
- vfs_rfork_has_no_font = TRUE;
- }
-
- for (i = 0; i < FT_RACCESS_N_RULES; i++)
- {
- if ( file_names[i] )
- FT_FREE( file_names[i] );
- }
-
- /* Caller (load_mac_face) requires FT_Err_Unknown_File_Format. */
- if ( error )
- error = FT_ERR( Unknown_File_Format );
-
- return error;
-
-#undef FT_COMPONENT
-#define FT_COMPONENT trace_objs
-
- }
-
-
- /* Check for some macintosh formats without Carbon framework. */
- /* Is this a macbinary file? If so look at the resource fork. */
- /* Is this a mac dfont file? */
- /* Is this an old style resource fork? (in data) */
- /* Else call load_face_in_embedded_rfork to try extra rules */
- /* (defined in `ftrfork.c'). */
- /* */
- static FT_Error
- load_mac_face( FT_Library library,
- FT_Stream stream,
- FT_Long face_index,
- FT_Face *aface,
- const FT_Open_Args *args )
- {
- FT_Error error;
- FT_UNUSED( args );
-
-
- error = IsMacBinary( library, stream, face_index, aface );
- if ( FT_ERR_EQ( error, Unknown_File_Format ) )
- {
-
-#undef FT_COMPONENT
-#define FT_COMPONENT trace_raccess
-
-#ifdef FT_DEBUG_LEVEL_TRACE
- FT_TRACE3(( "Try as dfont: " ));
- if ( !( args->flags & FT_OPEN_MEMORY ) )
- FT_TRACE3(( "%s ...", args->pathname ));
-#endif
-
- error = IsMacResource( library, stream, 0, face_index, aface );
-
- FT_TRACE3(( "%s\n", error ? "failed" : "successful" ));
-
-#undef FT_COMPONENT
-#define FT_COMPONENT trace_objs
-
- }
-
- if ( ( FT_ERR_EQ( error, Unknown_File_Format ) ||
- FT_ERR_EQ( error, Invalid_Stream_Operation ) ) &&
- ( args->flags & FT_OPEN_PATHNAME ) )
- error = load_face_in_embedded_rfork( library, stream,
- face_index, aface, args );
- return error;
- }
-#endif
-
-#endif /* !FT_MACINTOSH && FT_CONFIG_OPTION_MAC_FONTS */
-
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Open_Face( FT_Library library,
- const FT_Open_Args* args,
- FT_Long face_index,
- FT_Face *aface )
- {
- FT_Error error;
- FT_Driver driver = NULL;
- FT_Memory memory = NULL;
- FT_Stream stream = NULL;
- FT_Face face = NULL;
- FT_ListNode node = NULL;
- FT_Bool external_stream;
- FT_Module* cur;
- FT_Module* limit;
-
-
- /* test for valid `library' delayed to `FT_Stream_New' */
-
- if ( ( !aface && face_index >= 0 ) || !args )
- return FT_THROW( Invalid_Argument );
-
- external_stream = FT_BOOL( ( args->flags & FT_OPEN_STREAM ) &&
- args->stream );
-
- /* create input stream */
- error = FT_Stream_New( library, args, &stream );
- if ( error )
- goto Fail3;
-
- memory = library->memory;
-
- /* If the font driver is specified in the `args' structure, use */
- /* it. Otherwise, we scan the list of registered drivers. */
- if ( ( args->flags & FT_OPEN_DRIVER ) && args->driver )
- {
- driver = FT_DRIVER( args->driver );
-
- /* not all modules are drivers, so check... */
- if ( FT_MODULE_IS_DRIVER( driver ) )
- {
- FT_Int num_params = 0;
- FT_Parameter* params = NULL;
-
-
- if ( args->flags & FT_OPEN_PARAMS )
- {
- num_params = args->num_params;
- params = args->params;
- }
-
- error = open_face( driver, &stream, external_stream, face_index,
- num_params, params, &face );
- if ( !error )
- goto Success;
- }
- else
- error = FT_THROW( Invalid_Handle );
-
- FT_Stream_Free( stream, external_stream );
- goto Fail;
- }
- else
- {
- error = FT_ERR( Missing_Module );
-
- /* check each font driver for an appropriate format */
- cur = library->modules;
- limit = cur + library->num_modules;
-
- for ( ; cur < limit; cur++ )
- {
- /* not all modules are font drivers, so check... */
- if ( FT_MODULE_IS_DRIVER( cur[0] ) )
- {
- FT_Int num_params = 0;
- FT_Parameter* params = NULL;
-
-
- driver = FT_DRIVER( cur[0] );
-
- if ( args->flags & FT_OPEN_PARAMS )
- {
- num_params = args->num_params;
- params = args->params;
- }
-
- error = open_face( driver, &stream, external_stream, face_index,
- num_params, params, &face );
- if ( !error )
- goto Success;
-
-#ifdef FT_CONFIG_OPTION_MAC_FONTS
- if ( ft_strcmp( cur[0]->clazz->module_name, "truetype" ) == 0 &&
- FT_ERR_EQ( error, Table_Missing ) )
- {
- /* TrueType but essential tables are missing */
- if ( FT_Stream_Seek( stream, 0 ) )
- break;
-
- error = open_face_PS_from_sfnt_stream( library,
- stream,
- face_index,
- num_params,
- params,
- aface );
- if ( !error )
- {
- FT_Stream_Free( stream, external_stream );
- return error;
- }
- }
-#endif
-
- if ( FT_ERR_NEQ( error, Unknown_File_Format ) )
- goto Fail3;
- }
- }
-
- Fail3:
- /* If we are on the mac, and we get an */
- /* FT_Err_Invalid_Stream_Operation it may be because we have an */
- /* empty data fork, so we need to check the resource fork. */
- if ( FT_ERR_NEQ( error, Cannot_Open_Stream ) &&
- FT_ERR_NEQ( error, Unknown_File_Format ) &&
- FT_ERR_NEQ( error, Invalid_Stream_Operation ) )
- goto Fail2;
-
-#if !defined( FT_MACINTOSH ) && defined( FT_CONFIG_OPTION_MAC_FONTS )
- error = load_mac_face( library, stream, face_index, aface, args );
- if ( !error )
- {
- /* We don't want to go to Success here. We've already done that. */
- /* On the other hand, if we succeeded we still need to close this */
- /* stream (we opened a different stream which extracted the */
- /* interesting information out of this stream here. That stream */
- /* will still be open and the face will point to it). */
- FT_Stream_Free( stream, external_stream );
- return error;
- }
-
- if ( FT_ERR_NEQ( error, Unknown_File_Format ) )
- goto Fail2;
-#endif /* !FT_MACINTOSH && FT_CONFIG_OPTION_MAC_FONTS */
-
- /* no driver is able to handle this format */
- error = FT_THROW( Unknown_File_Format );
-
- Fail2:
- FT_Stream_Free( stream, external_stream );
- goto Fail;
- }
-
- Success:
- FT_TRACE4(( "FT_Open_Face: New face object, adding to list\n" ));
-
- /* add the face object to its driver's list */
- if ( FT_NEW( node ) )
- goto Fail;
-
- node->data = face;
- /* don't assume driver is the same as face->driver, so use */
- /* face->driver instead. */
- FT_List_Add( &face->driver->faces_list, node );
-
- /* now allocate a glyph slot object for the face */
- FT_TRACE4(( "FT_Open_Face: Creating glyph slot\n" ));
-
- if ( face_index >= 0 )
- {
- error = FT_New_GlyphSlot( face, NULL );
- if ( error )
- goto Fail;
-
- /* finally, allocate a size object for the face */
- {
- FT_Size size;
-
-
- FT_TRACE4(( "FT_Open_Face: Creating size object\n" ));
-
- error = FT_New_Size( face, &size );
- if ( error )
- goto Fail;
-
- face->size = size;
- }
- }
-
- /* some checks */
-
- if ( FT_IS_SCALABLE( face ) )
- {
- if ( face->height < 0 )
- face->height = (FT_Short)-face->height;
-
- if ( !FT_HAS_VERTICAL( face ) )
- face->max_advance_height = (FT_Short)face->height;
- }
-
- if ( FT_HAS_FIXED_SIZES( face ) )
- {
- FT_Int i;
-
-
- for ( i = 0; i < face->num_fixed_sizes; i++ )
- {
- FT_Bitmap_Size* bsize = face->available_sizes + i;
-
-
- if ( bsize->height < 0 )
- bsize->height = (FT_Short)-bsize->height;
- if ( bsize->x_ppem < 0 )
- bsize->x_ppem = (FT_Short)-bsize->x_ppem;
- if ( bsize->y_ppem < 0 )
- bsize->y_ppem = -bsize->y_ppem;
- }
- }
-
- /* initialize internal face data */
- {
- FT_Face_Internal internal = face->internal;
-
-
- internal->transform_matrix.xx = 0x10000L;
- internal->transform_matrix.xy = 0;
- internal->transform_matrix.yx = 0;
- internal->transform_matrix.yy = 0x10000L;
-
- internal->transform_delta.x = 0;
- internal->transform_delta.y = 0;
-
- internal->refcount = 1;
- }
-
- if ( aface )
- *aface = face;
- else
- FT_Done_Face( face );
-
- goto Exit;
-
- Fail:
- if ( node )
- FT_Done_Face( face ); /* face must be in the driver's list */
- else if ( face )
- destroy_face( memory, face, driver );
-
- Exit:
- FT_TRACE4(( "FT_Open_Face: Return %d\n", error ));
-
- return error;
- }
-
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Attach_File( FT_Face face,
- const char* filepathname )
- {
- FT_Open_Args open;
-
-
- /* test for valid `face' delayed to `FT_Attach_Stream' */
-
- if ( !filepathname )
- return FT_THROW( Invalid_Argument );
-
- open.stream = NULL;
- open.flags = FT_OPEN_PATHNAME;
- open.pathname = (char*)filepathname;
-
- return FT_Attach_Stream( face, &open );
- }
-
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Attach_Stream( FT_Face face,
- FT_Open_Args* parameters )
- {
- FT_Stream stream;
- FT_Error error;
- FT_Driver driver;
-
- FT_Driver_Class clazz;
-
-
- /* test for valid `parameters' delayed to `FT_Stream_New' */
-
- if ( !face )
- return FT_THROW( Invalid_Face_Handle );
-
- driver = face->driver;
- if ( !driver )
- return FT_THROW( Invalid_Driver_Handle );
-
- error = FT_Stream_New( driver->root.library, parameters, &stream );
- if ( error )
- goto Exit;
-
- /* we implement FT_Attach_Stream in each driver through the */
- /* `attach_file' interface */
-
- error = FT_ERR( Unimplemented_Feature );
- clazz = driver->clazz;
- if ( clazz->attach_file )
- error = clazz->attach_file( face, stream );
-
- /* close the attached stream */
- FT_Stream_Free( stream,
- (FT_Bool)( parameters->stream &&
- ( parameters->flags & FT_OPEN_STREAM ) ) );
-
- Exit:
- return error;
- }
-
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Reference_Face( FT_Face face )
- {
- if ( !face )
- return FT_THROW( Invalid_Face_Handle );
-
- face->internal->refcount++;
-
- return FT_Err_Ok;
- }
-
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Done_Face( FT_Face face )
- {
- FT_Error error;
- FT_Driver driver;
- FT_Memory memory;
- FT_ListNode node;
-
-
- error = FT_ERR( Invalid_Face_Handle );
- if ( face && face->driver )
- {
- face->internal->refcount--;
- if ( face->internal->refcount > 0 )
- error = FT_Err_Ok;
- else
- {
- driver = face->driver;
- memory = driver->root.memory;
-
- /* find face in driver's list */
- node = FT_List_Find( &driver->faces_list, face );
- if ( node )
- {
- /* remove face object from the driver's list */
- FT_List_Remove( &driver->faces_list, node );
- FT_FREE( node );
-
- /* now destroy the object proper */
- destroy_face( memory, face, driver );
- error = FT_Err_Ok;
- }
- }
- }
-
- return error;
- }
-
-
- /* documentation is in ftobjs.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_New_Size( FT_Face face,
- FT_Size *asize )
- {
- FT_Error error;
- FT_Memory memory;
- FT_Driver driver;
- FT_Driver_Class clazz;
-
- FT_Size size = NULL;
- FT_ListNode node = NULL;
-
-
- if ( !face )
- return FT_THROW( Invalid_Face_Handle );
-
- if ( !asize )
- return FT_THROW( Invalid_Argument );
-
- if ( !face->driver )
- return FT_THROW( Invalid_Driver_Handle );
-
- *asize = NULL;
-
- driver = face->driver;
- clazz = driver->clazz;
- memory = face->memory;
-
- /* Allocate new size object and perform basic initialisation */
- if ( FT_ALLOC( size, clazz->size_object_size ) || FT_NEW( node ) )
- goto Exit;
-
- size->face = face;
-
- /* for now, do not use any internal fields in size objects */
- size->internal = NULL;
-
- if ( clazz->init_size )
- error = clazz->init_size( size );
-
- /* in case of success, add to the face's list */
- if ( !error )
- {
- *asize = size;
- node->data = size;
- FT_List_Add( &face->sizes_list, node );
- }
-
- Exit:
- if ( error )
- {
- FT_FREE( node );
- FT_FREE( size );
- }
-
- return error;
- }
-
-
- /* documentation is in ftobjs.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Done_Size( FT_Size size )
- {
- FT_Error error;
- FT_Driver driver;
- FT_Memory memory;
- FT_Face face;
- FT_ListNode node;
-
-
- if ( !size )
- return FT_THROW( Invalid_Size_Handle );
-
- face = size->face;
- if ( !face )
- return FT_THROW( Invalid_Face_Handle );
-
- driver = face->driver;
- if ( !driver )
- return FT_THROW( Invalid_Driver_Handle );
-
- memory = driver->root.memory;
-
- error = FT_Err_Ok;
- node = FT_List_Find( &face->sizes_list, size );
- if ( node )
- {
- FT_List_Remove( &face->sizes_list, node );
- FT_FREE( node );
-
- if ( face->size == size )
- {
- face->size = NULL;
- if ( face->sizes_list.head )
- face->size = (FT_Size)(face->sizes_list.head->data);
- }
-
- destroy_size( memory, size, driver );
- }
- else
- error = FT_THROW( Invalid_Size_Handle );
-
- return error;
- }
-
-
- /* documentation is in ftobjs.h */
-
- FT_BASE_DEF( FT_Error )
- FT_Match_Size( FT_Face face,
- FT_Size_Request req,
- FT_Bool ignore_width,
- FT_ULong* size_index )
- {
- FT_Int i;
- FT_Long w, h;
-
-
- if ( !FT_HAS_FIXED_SIZES( face ) )
- return FT_THROW( Invalid_Face_Handle );
-
- /* FT_Bitmap_Size doesn't provide enough info... */
- if ( req->type != FT_SIZE_REQUEST_TYPE_NOMINAL )
- return FT_THROW( Unimplemented_Feature );
-
- w = FT_REQUEST_WIDTH ( req );
- h = FT_REQUEST_HEIGHT( req );
-
- if ( req->width && !req->height )
- h = w;
- else if ( !req->width && req->height )
- w = h;
-
- w = FT_PIX_ROUND( w );
- h = FT_PIX_ROUND( h );
-
- for ( i = 0; i < face->num_fixed_sizes; i++ )
- {
- FT_Bitmap_Size* bsize = face->available_sizes + i;
-
-
- if ( h != FT_PIX_ROUND( bsize->y_ppem ) )
- continue;
-
- if ( w == FT_PIX_ROUND( bsize->x_ppem ) || ignore_width )
- {
- FT_TRACE3(( "FT_Match_Size: bitmap strike %d matches\n", i ));
-
- if ( size_index )
- *size_index = (FT_ULong)i;
-
- return FT_Err_Ok;
- }
- }
-
- return FT_THROW( Invalid_Pixel_Size );
- }
-
-
- /* documentation is in ftobjs.h */
-
- FT_BASE_DEF( void )
- ft_synthesize_vertical_metrics( FT_Glyph_Metrics* metrics,
- FT_Pos advance )
- {
- FT_Pos height = metrics->height;
-
-
- /* compensate for glyph with bbox above/below the baseline */
- if ( metrics->horiBearingY < 0 )
- {
- if ( height < metrics->horiBearingY )
- height = metrics->horiBearingY;
- }
- else if ( metrics->horiBearingY > 0 )
- height -= metrics->horiBearingY;
-
- /* the factor 1.2 is a heuristical value */
- if ( !advance )
- advance = height * 12 / 10;
-
- metrics->vertBearingX = metrics->horiBearingX - metrics->horiAdvance / 2;
- metrics->vertBearingY = ( advance - height ) / 2;
- metrics->vertAdvance = advance;
- }
-
-
- static void
- ft_recompute_scaled_metrics( FT_Face face,
- FT_Size_Metrics* metrics )
- {
- /* Compute root ascender, descender, test height, and max_advance */
-
-#ifdef GRID_FIT_METRICS
- metrics->ascender = FT_PIX_CEIL( FT_MulFix( face->ascender,
- metrics->y_scale ) );
-
- metrics->descender = FT_PIX_FLOOR( FT_MulFix( face->descender,
- metrics->y_scale ) );
-
- metrics->height = FT_PIX_ROUND( FT_MulFix( face->height,
- metrics->y_scale ) );
-
- metrics->max_advance = FT_PIX_ROUND( FT_MulFix( face->max_advance_width,
- metrics->x_scale ) );
-#else /* !GRID_FIT_METRICS */
- metrics->ascender = FT_MulFix( face->ascender,
- metrics->y_scale );
-
- metrics->descender = FT_MulFix( face->descender,
- metrics->y_scale );
-
- metrics->height = FT_MulFix( face->height,
- metrics->y_scale );
-
- metrics->max_advance = FT_MulFix( face->max_advance_width,
- metrics->x_scale );
-#endif /* !GRID_FIT_METRICS */
- }
-
-
- FT_BASE_DEF( void )
- FT_Select_Metrics( FT_Face face,
- FT_ULong strike_index )
- {
- FT_Size_Metrics* metrics;
- FT_Bitmap_Size* bsize;
-
-
- metrics = &face->size->metrics;
- bsize = face->available_sizes + strike_index;
-
- metrics->x_ppem = (FT_UShort)( ( bsize->x_ppem + 32 ) >> 6 );
- metrics->y_ppem = (FT_UShort)( ( bsize->y_ppem + 32 ) >> 6 );
-
- if ( FT_IS_SCALABLE( face ) )
- {
- metrics->x_scale = FT_DivFix( bsize->x_ppem,
- face->units_per_EM );
- metrics->y_scale = FT_DivFix( bsize->y_ppem,
- face->units_per_EM );
-
- ft_recompute_scaled_metrics( face, metrics );
- }
- else
- {
- metrics->x_scale = 1L << 16;
- metrics->y_scale = 1L << 16;
- metrics->ascender = bsize->y_ppem;
- metrics->descender = 0;
- metrics->height = bsize->height << 6;
- metrics->max_advance = bsize->x_ppem;
- }
-
- FT_TRACE5(( "FT_Select_Metrics:\n" ));
- FT_TRACE5(( " x scale: %d (%f)\n",
- metrics->x_scale, metrics->x_scale / 65536.0 ));
- FT_TRACE5(( " y scale: %d (%f)\n",
- metrics->y_scale, metrics->y_scale / 65536.0 ));
- FT_TRACE5(( " ascender: %f\n", metrics->ascender / 64.0 ));
- FT_TRACE5(( " descender: %f\n", metrics->descender / 64.0 ));
- FT_TRACE5(( " height: %f\n", metrics->height / 64.0 ));
- FT_TRACE5(( " max advance: %f\n", metrics->max_advance / 64.0 ));
- FT_TRACE5(( " x ppem: %d\n", metrics->x_ppem ));
- FT_TRACE5(( " y ppem: %d\n", metrics->y_ppem ));
- }
-
-
- FT_BASE_DEF( void )
- FT_Request_Metrics( FT_Face face,
- FT_Size_Request req )
- {
- FT_Size_Metrics* metrics;
-
-
- metrics = &face->size->metrics;
-
- if ( FT_IS_SCALABLE( face ) )
- {
- FT_Long w = 0, h = 0, scaled_w = 0, scaled_h = 0;
-
-
- switch ( req->type )
- {
- case FT_SIZE_REQUEST_TYPE_NOMINAL:
- w = h = face->units_per_EM;
- break;
-
- case FT_SIZE_REQUEST_TYPE_REAL_DIM:
- w = h = face->ascender - face->descender;
- break;
-
- case FT_SIZE_REQUEST_TYPE_BBOX:
- w = face->bbox.xMax - face->bbox.xMin;
- h = face->bbox.yMax - face->bbox.yMin;
- break;
-
- case FT_SIZE_REQUEST_TYPE_CELL:
- w = face->max_advance_width;
- h = face->ascender - face->descender;
- break;
-
- case FT_SIZE_REQUEST_TYPE_SCALES:
- metrics->x_scale = (FT_Fixed)req->width;
- metrics->y_scale = (FT_Fixed)req->height;
- if ( !metrics->x_scale )
- metrics->x_scale = metrics->y_scale;
- else if ( !metrics->y_scale )
- metrics->y_scale = metrics->x_scale;
- goto Calculate_Ppem;
-
- case FT_SIZE_REQUEST_TYPE_MAX:
- break;
- }
-
- /* to be on the safe side */
- if ( w < 0 )
- w = -w;
-
- if ( h < 0 )
- h = -h;
-
- scaled_w = FT_REQUEST_WIDTH ( req );
- scaled_h = FT_REQUEST_HEIGHT( req );
-
- /* determine scales */
- if ( req->width )
- {
- metrics->x_scale = FT_DivFix( scaled_w, w );
-
- if ( req->height )
- {
- metrics->y_scale = FT_DivFix( scaled_h, h );
-
- if ( req->type == FT_SIZE_REQUEST_TYPE_CELL )
- {
- if ( metrics->y_scale > metrics->x_scale )
- metrics->y_scale = metrics->x_scale;
- else
- metrics->x_scale = metrics->y_scale;
- }
- }
- else
- {
- metrics->y_scale = metrics->x_scale;
- scaled_h = FT_MulDiv( scaled_w, h, w );
- }
- }
- else
- {
- metrics->x_scale = metrics->y_scale = FT_DivFix( scaled_h, h );
- scaled_w = FT_MulDiv( scaled_h, w, h );
- }
-
- Calculate_Ppem:
- /* calculate the ppems */
- if ( req->type != FT_SIZE_REQUEST_TYPE_NOMINAL )
- {
- scaled_w = FT_MulFix( face->units_per_EM, metrics->x_scale );
- scaled_h = FT_MulFix( face->units_per_EM, metrics->y_scale );
- }
-
- metrics->x_ppem = (FT_UShort)( ( scaled_w + 32 ) >> 6 );
- metrics->y_ppem = (FT_UShort)( ( scaled_h + 32 ) >> 6 );
-
- ft_recompute_scaled_metrics( face, metrics );
- }
- else
- {
- FT_ZERO( metrics );
- metrics->x_scale = 1L << 16;
- metrics->y_scale = 1L << 16;
- }
-
- FT_TRACE5(( "FT_Request_Metrics:\n" ));
- FT_TRACE5(( " x scale: %d (%f)\n",
- metrics->x_scale, metrics->x_scale / 65536.0 ));
- FT_TRACE5(( " y scale: %d (%f)\n",
- metrics->y_scale, metrics->y_scale / 65536.0 ));
- FT_TRACE5(( " ascender: %f\n", metrics->ascender / 64.0 ));
- FT_TRACE5(( " descender: %f\n", metrics->descender / 64.0 ));
- FT_TRACE5(( " height: %f\n", metrics->height / 64.0 ));
- FT_TRACE5(( " max advance: %f\n", metrics->max_advance / 64.0 ));
- FT_TRACE5(( " x ppem: %d\n", metrics->x_ppem ));
- FT_TRACE5(( " y ppem: %d\n", metrics->y_ppem ));
- }
-
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Select_Size( FT_Face face,
- FT_Int strike_index )
- {
- FT_Driver_Class clazz;
-
-
- if ( !face || !FT_HAS_FIXED_SIZES( face ) )
- return FT_THROW( Invalid_Face_Handle );
-
- if ( strike_index < 0 || strike_index >= face->num_fixed_sizes )
- return FT_THROW( Invalid_Argument );
-
- clazz = face->driver->clazz;
-
- if ( clazz->select_size )
- {
- FT_Error error;
-
-
- error = clazz->select_size( face->size, (FT_ULong)strike_index );
-
-#ifdef FT_DEBUG_LEVEL_TRACE
- {
- FT_Size_Metrics* metrics = &face->size->metrics;
-
-
- FT_TRACE5(( "FT_Select_Size (font driver's `select_size'):\n" ));
- FT_TRACE5(( " x scale: %d (%f)\n",
- metrics->x_scale, metrics->x_scale / 65536.0 ));
- FT_TRACE5(( " y scale: %d (%f)\n",
- metrics->y_scale, metrics->y_scale / 65536.0 ));
- FT_TRACE5(( " ascender: %f\n", metrics->ascender / 64.0 ));
- FT_TRACE5(( " descender: %f\n", metrics->descender / 64.0 ));
- FT_TRACE5(( " height: %f\n", metrics->height / 64.0 ));
- FT_TRACE5(( " max advance: %f\n", metrics->max_advance / 64.0 ));
- FT_TRACE5(( " x ppem: %d\n", metrics->x_ppem ));
- FT_TRACE5(( " y ppem: %d\n", metrics->y_ppem ));
- }
-#endif
-
- return error;
- }
-
- FT_Select_Metrics( face, (FT_ULong)strike_index );
-
- return FT_Err_Ok;
- }
-
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Request_Size( FT_Face face,
- FT_Size_Request req )
- {
- FT_Driver_Class clazz;
- FT_ULong strike_index;
-
-
- if ( !face )
- return FT_THROW( Invalid_Face_Handle );
-
- if ( !req || req->width < 0 || req->height < 0 ||
- req->type >= FT_SIZE_REQUEST_TYPE_MAX )
- return FT_THROW( Invalid_Argument );
-
- clazz = face->driver->clazz;
-
- if ( clazz->request_size )
- {
- FT_Error error;
-
-
- error = clazz->request_size( face->size, req );
-
-#ifdef FT_DEBUG_LEVEL_TRACE
- {
- FT_Size_Metrics* metrics = &face->size->metrics;
-
-
- FT_TRACE5(( "FT_Request_Size (font driver's `request_size'):\n" ));
- FT_TRACE5(( " x scale: %d (%f)\n",
- metrics->x_scale, metrics->x_scale / 65536.0 ));
- FT_TRACE5(( " y scale: %d (%f)\n",
- metrics->y_scale, metrics->y_scale / 65536.0 ));
- FT_TRACE5(( " ascender: %f\n", metrics->ascender / 64.0 ));
- FT_TRACE5(( " descender: %f\n", metrics->descender / 64.0 ));
- FT_TRACE5(( " height: %f\n", metrics->height / 64.0 ));
- FT_TRACE5(( " max advance: %f\n", metrics->max_advance / 64.0 ));
- FT_TRACE5(( " x ppem: %d\n", metrics->x_ppem ));
- FT_TRACE5(( " y ppem: %d\n", metrics->y_ppem ));
- }
-#endif
-
- return error;
- }
-
- /*
- * The reason that a driver doesn't have `request_size' defined is
- * either that the scaling here suffices or that the supported formats
- * are bitmap-only and size matching is not implemented.
- *
- * In the latter case, a simple size matching is done.
- */
- if ( !FT_IS_SCALABLE( face ) && FT_HAS_FIXED_SIZES( face ) )
- {
- FT_Error error;
-
-
- error = FT_Match_Size( face, req, 0, &strike_index );
- if ( error )
- return error;
-
- return FT_Select_Size( face, (FT_Int)strike_index );
- }
-
- FT_Request_Metrics( face, req );
-
- return FT_Err_Ok;
- }
-
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Set_Char_Size( FT_Face face,
- FT_F26Dot6 char_width,
- FT_F26Dot6 char_height,
- FT_UInt horz_resolution,
- FT_UInt vert_resolution )
- {
- FT_Size_RequestRec req;
-
-
- /* check of `face' delayed to `FT_Request_Size' */
-
- if ( !char_width )
- char_width = char_height;
- else if ( !char_height )
- char_height = char_width;
-
- if ( !horz_resolution )
- horz_resolution = vert_resolution;
- else if ( !vert_resolution )
- vert_resolution = horz_resolution;
-
- if ( char_width < 1 * 64 )
- char_width = 1 * 64;
- if ( char_height < 1 * 64 )
- char_height = 1 * 64;
-
- if ( !horz_resolution )
- horz_resolution = vert_resolution = 72;
-
- req.type = FT_SIZE_REQUEST_TYPE_NOMINAL;
- req.width = char_width;
- req.height = char_height;
- req.horiResolution = horz_resolution;
- req.vertResolution = vert_resolution;
-
- return FT_Request_Size( face, &req );
- }
-
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Set_Pixel_Sizes( FT_Face face,
- FT_UInt pixel_width,
- FT_UInt pixel_height )
- {
- FT_Size_RequestRec req;
-
-
- /* check of `face' delayed to `FT_Request_Size' */
-
- if ( pixel_width == 0 )
- pixel_width = pixel_height;
- else if ( pixel_height == 0 )
- pixel_height = pixel_width;
-
- if ( pixel_width < 1 )
- pixel_width = 1;
- if ( pixel_height < 1 )
- pixel_height = 1;
-
- /* use `>=' to avoid potential compiler warning on 16bit platforms */
- if ( pixel_width >= 0xFFFFU )
- pixel_width = 0xFFFFU;
- if ( pixel_height >= 0xFFFFU )
- pixel_height = 0xFFFFU;
-
- req.type = FT_SIZE_REQUEST_TYPE_NOMINAL;
- req.width = (FT_Long)( pixel_width << 6 );
- req.height = (FT_Long)( pixel_height << 6 );
- req.horiResolution = 0;
- req.vertResolution = 0;
-
- return FT_Request_Size( face, &req );
- }
-
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Get_Kerning( FT_Face face,
- FT_UInt left_glyph,
- FT_UInt right_glyph,
- FT_UInt kern_mode,
- FT_Vector *akerning )
- {
- FT_Error error = FT_Err_Ok;
- FT_Driver driver;
-
-
- if ( !face )
- return FT_THROW( Invalid_Face_Handle );
-
- if ( !akerning )
- return FT_THROW( Invalid_Argument );
-
- driver = face->driver;
-
- akerning->x = 0;
- akerning->y = 0;
-
- if ( driver->clazz->get_kerning )
- {
- error = driver->clazz->get_kerning( face,
- left_glyph,
- right_glyph,
- akerning );
- if ( !error )
- {
- if ( kern_mode != FT_KERNING_UNSCALED )
- {
- akerning->x = FT_MulFix( akerning->x, face->size->metrics.x_scale );
- akerning->y = FT_MulFix( akerning->y, face->size->metrics.y_scale );
-
- if ( kern_mode != FT_KERNING_UNFITTED )
- {
- FT_Pos orig_x = akerning->x;
- FT_Pos orig_y = akerning->y;
-
-
- /* we scale down kerning values for small ppem values */
- /* to avoid that rounding makes them too big. */
- /* `25' has been determined heuristically. */
- if ( face->size->metrics.x_ppem < 25 )
- akerning->x = FT_MulDiv( orig_x,
- face->size->metrics.x_ppem, 25 );
- if ( face->size->metrics.y_ppem < 25 )
- akerning->y = FT_MulDiv( orig_y,
- face->size->metrics.y_ppem, 25 );
-
- akerning->x = FT_PIX_ROUND( akerning->x );
- akerning->y = FT_PIX_ROUND( akerning->y );
-
-#ifdef FT_DEBUG_LEVEL_TRACE
- {
- FT_Pos orig_x_rounded = FT_PIX_ROUND( orig_x );
- FT_Pos orig_y_rounded = FT_PIX_ROUND( orig_y );
-
-
- if ( akerning->x != orig_x_rounded ||
- akerning->y != orig_y_rounded )
- FT_TRACE5(( "FT_Get_Kerning: horizontal kerning"
- " (%d, %d) scaled down to (%d, %d) pixels\n",
- orig_x_rounded / 64, orig_y_rounded / 64,
- akerning->x / 64, akerning->y / 64 ));
- }
-#endif
- }
- }
- }
- }
-
- return error;
- }
-
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Get_Track_Kerning( FT_Face face,
- FT_Fixed point_size,
- FT_Int degree,
- FT_Fixed* akerning )
- {
- FT_Service_Kerning service;
- FT_Error error = FT_Err_Ok;
-
-
- if ( !face )
- return FT_THROW( Invalid_Face_Handle );
-
- if ( !akerning )
- return FT_THROW( Invalid_Argument );
-
- FT_FACE_FIND_SERVICE( face, service, KERNING );
- if ( !service )
- return FT_THROW( Unimplemented_Feature );
-
- error = service->get_track( face,
- point_size,
- degree,
- akerning );
-
- return error;
- }
-
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Select_Charmap( FT_Face face,
- FT_Encoding encoding )
- {
- FT_CharMap* cur;
- FT_CharMap* limit;
-
-
- if ( !face )
- return FT_THROW( Invalid_Face_Handle );
-
- if ( encoding == FT_ENCODING_NONE )
- return FT_THROW( Invalid_Argument );
-
- /* FT_ENCODING_UNICODE is special. We try to find the `best' Unicode */
- /* charmap available, i.e., one with UCS-4 characters, if possible. */
- /* */
- /* This is done by find_unicode_charmap() above, to share code. */
- if ( encoding == FT_ENCODING_UNICODE )
- return find_unicode_charmap( face );
-
- cur = face->charmaps;
- if ( !cur )
- return FT_THROW( Invalid_CharMap_Handle );
-
- limit = cur + face->num_charmaps;
-
- for ( ; cur < limit; cur++ )
- {
- if ( cur[0]->encoding == encoding )
- {
- face->charmap = cur[0];
- return 0;
- }
- }
-
- return FT_THROW( Invalid_Argument );
- }
-
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Set_Charmap( FT_Face face,
- FT_CharMap charmap )
- {
- FT_CharMap* cur;
- FT_CharMap* limit;
-
-
- if ( !face )
- return FT_THROW( Invalid_Face_Handle );
-
- cur = face->charmaps;
- if ( !cur || !charmap )
- return FT_THROW( Invalid_CharMap_Handle );
-
- if ( FT_Get_CMap_Format( charmap ) == 14 )
- return FT_THROW( Invalid_Argument );
-
- limit = cur + face->num_charmaps;
-
- for ( ; cur < limit; cur++ )
- {
- if ( cur[0] == charmap )
- {
- face->charmap = cur[0];
- return FT_Err_Ok;
- }
- }
-
- return FT_THROW( Invalid_Argument );
- }
-
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( FT_Int )
- FT_Get_Charmap_Index( FT_CharMap charmap )
- {
- FT_Int i;
-
-
- if ( !charmap || !charmap->face )
- return -1;
-
- for ( i = 0; i < charmap->face->num_charmaps; i++ )
- if ( charmap->face->charmaps[i] == charmap )
- break;
-
- FT_ASSERT( i < charmap->face->num_charmaps );
-
- return i;
- }
-
-
- static void
- ft_cmap_done_internal( FT_CMap cmap )
- {
- FT_CMap_Class clazz = cmap->clazz;
- FT_Face face = cmap->charmap.face;
- FT_Memory memory = FT_FACE_MEMORY( face );
-
-
- if ( clazz->done )
- clazz->done( cmap );
-
- FT_FREE( cmap );
- }
-
-
- FT_BASE_DEF( void )
- FT_CMap_Done( FT_CMap cmap )
- {
- if ( cmap )
- {
- FT_Face face = cmap->charmap.face;
- FT_Memory memory = FT_FACE_MEMORY( face );
- FT_Error error;
- FT_Int i, j;
-
-
- for ( i = 0; i < face->num_charmaps; i++ )
- {
- if ( (FT_CMap)face->charmaps[i] == cmap )
- {
- FT_CharMap last_charmap = face->charmaps[face->num_charmaps - 1];
-
-
- if ( FT_RENEW_ARRAY( face->charmaps,
- face->num_charmaps,
- face->num_charmaps - 1 ) )
- return;
-
- /* remove it from our list of charmaps */
- for ( j = i + 1; j < face->num_charmaps; j++ )
- {
- if ( j == face->num_charmaps - 1 )
- face->charmaps[j - 1] = last_charmap;
- else
- face->charmaps[j - 1] = face->charmaps[j];
- }
-
- face->num_charmaps--;
-
- if ( (FT_CMap)face->charmap == cmap )
- face->charmap = NULL;
-
- ft_cmap_done_internal( cmap );
-
- break;
- }
- }
- }
- }
-
-
- FT_BASE_DEF( FT_Error )
- FT_CMap_New( FT_CMap_Class clazz,
- FT_Pointer init_data,
- FT_CharMap charmap,
- FT_CMap *acmap )
- {
- FT_Error error = FT_Err_Ok;
- FT_Face face;
- FT_Memory memory;
- FT_CMap cmap = NULL;
-
-
- if ( clazz == NULL || charmap == NULL || charmap->face == NULL )
- return FT_THROW( Invalid_Argument );
-
- face = charmap->face;
- memory = FT_FACE_MEMORY( face );
-
- if ( !FT_ALLOC( cmap, clazz->size ) )
- {
- cmap->charmap = *charmap;
- cmap->clazz = clazz;
-
- if ( clazz->init )
- {
- error = clazz->init( cmap, init_data );
- if ( error )
- goto Fail;
- }
-
- /* add it to our list of charmaps */
- if ( FT_RENEW_ARRAY( face->charmaps,
- face->num_charmaps,
- face->num_charmaps + 1 ) )
- goto Fail;
-
- face->charmaps[face->num_charmaps++] = (FT_CharMap)cmap;
- }
-
- Exit:
- if ( acmap )
- *acmap = cmap;
-
- return error;
-
- Fail:
- ft_cmap_done_internal( cmap );
- cmap = NULL;
- goto Exit;
- }
-
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( FT_UInt )
- FT_Get_Char_Index( FT_Face face,
- FT_ULong charcode )
- {
- FT_UInt result = 0;
-
-
- if ( face && face->charmap )
- {
- FT_CMap cmap = FT_CMAP( face->charmap );
-
-
- if ( charcode > 0xFFFFFFFFUL )
- {
- FT_TRACE1(( "FT_Get_Char_Index: too large charcode" ));
- FT_TRACE1(( " 0x%x is truncated\n", charcode ));
- }
-
- result = cmap->clazz->char_index( cmap, (FT_UInt32)charcode );
- if ( result >= (FT_UInt)face->num_glyphs )
- result = 0;
- }
-
- return result;
- }
-
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( FT_ULong )
- FT_Get_First_Char( FT_Face face,
- FT_UInt *agindex )
- {
- FT_ULong result = 0;
- FT_UInt gindex = 0;
-
-
- /* only do something if we have a charmap, and we have glyphs at all */
- if ( face && face->charmap && face->num_glyphs )
- {
- gindex = FT_Get_Char_Index( face, 0 );
- if ( gindex == 0 )
- result = FT_Get_Next_Char( face, 0, &gindex );
- }
-
- if ( agindex )
- *agindex = gindex;
-
- return result;
- }
-
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( FT_ULong )
- FT_Get_Next_Char( FT_Face face,
- FT_ULong charcode,
- FT_UInt *agindex )
- {
- FT_ULong result = 0;
- FT_UInt gindex = 0;
-
-
- if ( face && face->charmap && face->num_glyphs )
- {
- FT_UInt32 code = (FT_UInt32)charcode;
- FT_CMap cmap = FT_CMAP( face->charmap );
-
-
- do
- {
- gindex = cmap->clazz->char_next( cmap, &code );
-
- } while ( gindex >= (FT_UInt)face->num_glyphs );
-
- result = ( gindex == 0 ) ? 0 : code;
- }
-
- if ( agindex )
- *agindex = gindex;
-
- return result;
- }
-
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( FT_UInt )
- FT_Face_GetCharVariantIndex( FT_Face face,
- FT_ULong charcode,
- FT_ULong variantSelector )
- {
- FT_UInt result = 0;
-
-
- if ( face &&
- face->charmap &&
- face->charmap->encoding == FT_ENCODING_UNICODE )
- {
- FT_CharMap charmap = find_variant_selector_charmap( face );
- FT_CMap ucmap = FT_CMAP( face->charmap );
-
-
- if ( charmap != NULL )
- {
- FT_CMap vcmap = FT_CMAP( charmap );
-
-
- if ( charcode > 0xFFFFFFFFUL )
- {
- FT_TRACE1(( "FT_Get_Char_Index: too large charcode" ));
- FT_TRACE1(( " 0x%x is truncated\n", charcode ));
- }
- if ( variantSelector > 0xFFFFFFFFUL )
- {
- FT_TRACE1(( "FT_Get_Char_Index: too large variantSelector" ));
- FT_TRACE1(( " 0x%x is truncated\n", variantSelector ));
- }
-
- result = vcmap->clazz->char_var_index( vcmap, ucmap,
- (FT_UInt32)charcode,
- (FT_UInt32)variantSelector );
- }
- }
-
- return result;
- }
-
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( FT_Int )
- FT_Face_GetCharVariantIsDefault( FT_Face face,
- FT_ULong charcode,
- FT_ULong variantSelector )
- {
- FT_Int result = -1;
-
-
- if ( face )
- {
- FT_CharMap charmap = find_variant_selector_charmap( face );
-
-
- if ( charmap != NULL )
- {
- FT_CMap vcmap = FT_CMAP( charmap );
-
-
- if ( charcode > 0xFFFFFFFFUL )
- {
- FT_TRACE1(( "FT_Get_Char_Index: too large charcode" ));
- FT_TRACE1(( " 0x%x is truncated\n", charcode ));
- }
- if ( variantSelector > 0xFFFFFFFFUL )
- {
- FT_TRACE1(( "FT_Get_Char_Index: too large variantSelector" ));
- FT_TRACE1(( " 0x%x is truncated\n", variantSelector ));
- }
-
- result = vcmap->clazz->char_var_default( vcmap,
- (FT_UInt32)charcode,
- (FT_UInt32)variantSelector );
- }
- }
-
- return result;
- }
-
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( FT_UInt32* )
- FT_Face_GetVariantSelectors( FT_Face face )
- {
- FT_UInt32 *result = NULL;
-
-
- if ( face )
- {
- FT_CharMap charmap = find_variant_selector_charmap( face );
-
-
- if ( charmap != NULL )
- {
- FT_CMap vcmap = FT_CMAP( charmap );
- FT_Memory memory = FT_FACE_MEMORY( face );
-
-
- result = vcmap->clazz->variant_list( vcmap, memory );
- }
- }
-
- return result;
- }
-
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( FT_UInt32* )
- FT_Face_GetVariantsOfChar( FT_Face face,
- FT_ULong charcode )
- {
- FT_UInt32 *result = NULL;
-
-
- if ( face )
- {
- FT_CharMap charmap = find_variant_selector_charmap( face );
-
-
- if ( charmap != NULL )
- {
- FT_CMap vcmap = FT_CMAP( charmap );
- FT_Memory memory = FT_FACE_MEMORY( face );
-
-
- if ( charcode > 0xFFFFFFFFUL )
- {
- FT_TRACE1(( "FT_Get_Char_Index: too large charcode" ));
- FT_TRACE1(( " 0x%x is truncated\n", charcode ));
- }
-
- result = vcmap->clazz->charvariant_list( vcmap, memory,
- (FT_UInt32)charcode );
- }
- }
- return result;
- }
-
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( FT_UInt32* )
- FT_Face_GetCharsOfVariant( FT_Face face,
- FT_ULong variantSelector )
- {
- FT_UInt32 *result = NULL;
-
-
- if ( face )
- {
- FT_CharMap charmap = find_variant_selector_charmap( face );
-
-
- if ( charmap != NULL )
- {
- FT_CMap vcmap = FT_CMAP( charmap );
- FT_Memory memory = FT_FACE_MEMORY( face );
-
-
- if ( variantSelector > 0xFFFFFFFFUL )
- {
- FT_TRACE1(( "FT_Get_Char_Index: too large variantSelector" ));
- FT_TRACE1(( " 0x%x is truncated\n", variantSelector ));
- }
-
- result = vcmap->clazz->variantchar_list( vcmap, memory,
- (FT_UInt32)variantSelector );
- }
- }
-
- return result;
- }
-
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( FT_UInt )
- FT_Get_Name_Index( FT_Face face,
- FT_String* glyph_name )
- {
- FT_UInt result = 0;
-
-
- if ( face &&
- FT_HAS_GLYPH_NAMES( face ) &&
- glyph_name )
- {
- FT_Service_GlyphDict service;
-
-
- FT_FACE_LOOKUP_SERVICE( face,
- service,
- GLYPH_DICT );
-
- if ( service && service->name_index )
- result = service->name_index( face, glyph_name );
- }
-
- return result;
- }
-
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Get_Glyph_Name( FT_Face face,
- FT_UInt glyph_index,
- FT_Pointer buffer,
- FT_UInt buffer_max )
- {
- FT_Error error;
- FT_Service_GlyphDict service;
-
-
- if ( !face )
- return FT_THROW( Invalid_Face_Handle );
-
- if ( !buffer || buffer_max == 0 )
- return FT_THROW( Invalid_Argument );
-
- /* clean up buffer */
- ((FT_Byte*)buffer)[0] = '\0';
-
- if ( (FT_Long)glyph_index >= face->num_glyphs )
- return FT_THROW( Invalid_Glyph_Index );
-
- if ( !FT_HAS_GLYPH_NAMES( face ) )
- return FT_THROW( Invalid_Argument );
-
- FT_FACE_LOOKUP_SERVICE( face, service, GLYPH_DICT );
- if ( service && service->get_name )
- error = service->get_name( face, glyph_index, buffer, buffer_max );
- else
- error = FT_THROW( Invalid_Argument );
-
- return error;
- }
-
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( const char* )
- FT_Get_Postscript_Name( FT_Face face )
- {
- const char* result = NULL;
-
-
- if ( !face )
- goto Exit;
-
- if ( !result )
- {
- FT_Service_PsFontName service;
-
-
- FT_FACE_LOOKUP_SERVICE( face,
- service,
- POSTSCRIPT_FONT_NAME );
-
- if ( service && service->get_ps_font_name )
- result = service->get_ps_font_name( face );
- }
-
- Exit:
- return result;
- }
-
-
- /* documentation is in tttables.h */
-
- FT_EXPORT_DEF( void* )
- FT_Get_Sfnt_Table( FT_Face face,
- FT_Sfnt_Tag tag )
- {
- void* table = NULL;
- FT_Service_SFNT_Table service;
-
-
- if ( face && FT_IS_SFNT( face ) )
- {
- FT_FACE_FIND_SERVICE( face, service, SFNT_TABLE );
- if ( service != NULL )
- table = service->get_table( face, tag );
- }
-
- return table;
- }
-
-
- /* documentation is in tttables.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Load_Sfnt_Table( FT_Face face,
- FT_ULong tag,
- FT_Long offset,
- FT_Byte* buffer,
- FT_ULong* length )
- {
- FT_Service_SFNT_Table service;
-
-
- if ( !face || !FT_IS_SFNT( face ) )
- return FT_THROW( Invalid_Face_Handle );
-
- FT_FACE_FIND_SERVICE( face, service, SFNT_TABLE );
- if ( service == NULL )
- return FT_THROW( Unimplemented_Feature );
-
- return service->load_table( face, tag, offset, buffer, length );
- }
-
-
- /* documentation is in tttables.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Sfnt_Table_Info( FT_Face face,
- FT_UInt table_index,
- FT_ULong *tag,
- FT_ULong *length )
- {
- FT_Service_SFNT_Table service;
- FT_ULong offset;
-
-
- /* test for valid `length' delayed to `service->table_info' */
-
- if ( !face || !FT_IS_SFNT( face ) )
- return FT_THROW( Invalid_Face_Handle );
-
- FT_FACE_FIND_SERVICE( face, service, SFNT_TABLE );
- if ( service == NULL )
- return FT_THROW( Unimplemented_Feature );
-
- return service->table_info( face, table_index, tag, &offset, length );
- }
-
-
- /* documentation is in tttables.h */
-
- FT_EXPORT_DEF( FT_ULong )
- FT_Get_CMap_Language_ID( FT_CharMap charmap )
- {
- FT_Service_TTCMaps service;
- FT_Face face;
- TT_CMapInfo cmap_info;
-
-
- if ( !charmap || !charmap->face )
- return 0;
-
- face = charmap->face;
- FT_FACE_FIND_SERVICE( face, service, TT_CMAP );
- if ( service == NULL )
- return 0;
- if ( service->get_cmap_info( charmap, &cmap_info ))
- return 0;
-
- return cmap_info.language;
- }
-
-
- /* documentation is in tttables.h */
-
- FT_EXPORT_DEF( FT_Long )
- FT_Get_CMap_Format( FT_CharMap charmap )
- {
- FT_Service_TTCMaps service;
- FT_Face face;
- TT_CMapInfo cmap_info;
-
-
- if ( !charmap || !charmap->face )
- return -1;
-
- face = charmap->face;
- FT_FACE_FIND_SERVICE( face, service, TT_CMAP );
- if ( service == NULL )
- return -1;
- if ( service->get_cmap_info( charmap, &cmap_info ))
- return -1;
-
- return cmap_info.format;
- }
-
-
- /* documentation is in ftsizes.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Activate_Size( FT_Size size )
- {
- FT_Face face;
-
-
- if ( !size )
- return FT_THROW( Invalid_Size_Handle );
-
- face = size->face;
- if ( !face || !face->driver )
- return FT_THROW( Invalid_Face_Handle );
-
- /* we don't need anything more complex than that; all size objects */
- /* are already listed by the face */
- face->size = size;
-
- return FT_Err_Ok;
- }
-
-
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
- /**** ****/
- /**** ****/
- /**** R E N D E R E R S ****/
- /**** ****/
- /**** ****/
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
-
- /* lookup a renderer by glyph format in the library's list */
- FT_BASE_DEF( FT_Renderer )
- FT_Lookup_Renderer( FT_Library library,
- FT_Glyph_Format format,
- FT_ListNode* node )
- {
- FT_ListNode cur;
- FT_Renderer result = NULL;
-
-
- if ( !library )
- goto Exit;
-
- cur = library->renderers.head;
-
- if ( node )
- {
- if ( *node )
- cur = (*node)->next;
- *node = NULL;
- }
-
- while ( cur )
- {
- FT_Renderer renderer = FT_RENDERER( cur->data );
-
-
- if ( renderer->glyph_format == format )
- {
- if ( node )
- *node = cur;
-
- result = renderer;
- break;
- }
- cur = cur->next;
- }
-
- Exit:
- return result;
- }
-
-
- static FT_Renderer
- ft_lookup_glyph_renderer( FT_GlyphSlot slot )
- {
- FT_Face face = slot->face;
- FT_Library library = FT_FACE_LIBRARY( face );
- FT_Renderer result = library->cur_renderer;
-
-
- if ( !result || result->glyph_format != slot->format )
- result = FT_Lookup_Renderer( library, slot->format, 0 );
-
- return result;
- }
-
-
- static void
- ft_set_current_renderer( FT_Library library )
- {
- FT_Renderer renderer;
-
-
- renderer = FT_Lookup_Renderer( library, FT_GLYPH_FORMAT_OUTLINE, 0 );
- library->cur_renderer = renderer;
- }
-
-
- static FT_Error
- ft_add_renderer( FT_Module module )
- {
- FT_Library library = module->library;
- FT_Memory memory = library->memory;
- FT_Error error;
- FT_ListNode node = NULL;
-
-
- if ( FT_NEW( node ) )
- goto Exit;
-
- {
- FT_Renderer render = FT_RENDERER( module );
- FT_Renderer_Class* clazz = (FT_Renderer_Class*)module->clazz;
-
-
- render->clazz = clazz;
- render->glyph_format = clazz->glyph_format;
-
- /* allocate raster object if needed */
- if ( clazz->glyph_format == FT_GLYPH_FORMAT_OUTLINE &&
- clazz->raster_class->raster_new )
- {
- error = clazz->raster_class->raster_new( memory, &render->raster );
- if ( error )
- goto Fail;
-
- render->raster_render = clazz->raster_class->raster_render;
- render->render = clazz->render_glyph;
- }
-
- /* add to list */
- node->data = module;
- FT_List_Add( &library->renderers, node );
-
- ft_set_current_renderer( library );
- }
-
- Fail:
- if ( error )
- FT_FREE( node );
-
- Exit:
- return error;
- }
-
-
- static void
- ft_remove_renderer( FT_Module module )
- {
- FT_Library library;
- FT_Memory memory;
- FT_ListNode node;
-
-
- library = module->library;
- if ( !library )
- return;
-
- memory = library->memory;
-
- node = FT_List_Find( &library->renderers, module );
- if ( node )
- {
- FT_Renderer render = FT_RENDERER( module );
-
-
- /* release raster object, if any */
- if ( render->clazz->glyph_format == FT_GLYPH_FORMAT_OUTLINE &&
- render->raster )
- render->clazz->raster_class->raster_done( render->raster );
-
- /* remove from list */
- FT_List_Remove( &library->renderers, node );
- FT_FREE( node );
-
- ft_set_current_renderer( library );
- }
- }
-
-
- /* documentation is in ftrender.h */
-
- FT_EXPORT_DEF( FT_Renderer )
- FT_Get_Renderer( FT_Library library,
- FT_Glyph_Format format )
- {
- /* test for valid `library' delayed to `FT_Lookup_Renderer' */
-
- return FT_Lookup_Renderer( library, format, 0 );
- }
-
-
- /* documentation is in ftrender.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Set_Renderer( FT_Library library,
- FT_Renderer renderer,
- FT_UInt num_params,
- FT_Parameter* parameters )
- {
- FT_ListNode node;
- FT_Error error = FT_Err_Ok;
-
- FT_Renderer_SetModeFunc set_mode;
-
-
- if ( !library )
- {
- error = FT_THROW( Invalid_Library_Handle );
- goto Exit;
- }
-
- if ( !renderer )
- {
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- if ( num_params > 0 && !parameters )
- {
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- node = FT_List_Find( &library->renderers, renderer );
- if ( !node )
- {
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- FT_List_Up( &library->renderers, node );
-
- if ( renderer->glyph_format == FT_GLYPH_FORMAT_OUTLINE )
- library->cur_renderer = renderer;
-
- set_mode = renderer->clazz->set_mode;
-
- for ( ; num_params > 0; num_params-- )
- {
- error = set_mode( renderer, parameters->tag, parameters->data );
- if ( error )
- break;
- parameters++;
- }
-
- Exit:
- return error;
- }
-
-
- FT_BASE_DEF( FT_Error )
- FT_Render_Glyph_Internal( FT_Library library,
- FT_GlyphSlot slot,
- FT_Render_Mode render_mode )
- {
- FT_Error error = FT_Err_Ok;
- FT_Renderer renderer;
-
-
- /* if it is already a bitmap, no need to do anything */
- switch ( slot->format )
- {
- case FT_GLYPH_FORMAT_BITMAP: /* already a bitmap, don't do anything */
- break;
-
- default:
- {
- FT_ListNode node = NULL;
-
-
- /* small shortcut for the very common case */
- if ( slot->format == FT_GLYPH_FORMAT_OUTLINE )
- {
- renderer = library->cur_renderer;
- node = library->renderers.head;
- }
- else
- renderer = FT_Lookup_Renderer( library, slot->format, &node );
-
- error = FT_ERR( Unimplemented_Feature );
- while ( renderer )
- {
- error = renderer->render( renderer, slot, render_mode, NULL );
- if ( !error ||
- FT_ERR_NEQ( error, Cannot_Render_Glyph ) )
- break;
-
- /* FT_Err_Cannot_Render_Glyph is returned if the render mode */
- /* is unsupported by the current renderer for this glyph image */
- /* format. */
-
- /* now, look for another renderer that supports the same */
- /* format. */
- renderer = FT_Lookup_Renderer( library, slot->format, &node );
- }
- }
- }
-
-#ifdef FT_DEBUG_LEVEL_TRACE
-
-#undef FT_COMPONENT
-#define FT_COMPONENT trace_bitmap
-
- /* we convert to a single bitmap format for computing the checksum */
- if ( !error )
- {
- FT_Bitmap bitmap;
- FT_Error err;
-
-
- FT_Bitmap_Init( &bitmap );
-
- /* this also converts the bitmap flow to `down' (i.e., pitch > 0) */
- err = FT_Bitmap_Convert( library, &slot->bitmap, &bitmap, 1 );
- if ( !err )
- {
- MD5_CTX ctx;
- unsigned char md5[16];
- int i;
- unsigned int rows = bitmap.rows;
- unsigned int pitch = (unsigned int)bitmap.pitch;
-
-
- MD5_Init( &ctx );
- MD5_Update( &ctx, bitmap.buffer, rows * pitch );
- MD5_Final( md5, &ctx );
-
- FT_TRACE3(( "MD5 checksum for %dx%d bitmap:\n"
- " ",
- rows, pitch ));
- for ( i = 0; i < 16; i++ )
- FT_TRACE3(( "%02X", md5[i] ));
- FT_TRACE3(( "\n" ));
- }
-
- FT_Bitmap_Done( library, &bitmap );
- }
-
-#undef FT_COMPONENT
-#define FT_COMPONENT trace_objs
-
-#endif /* FT_DEBUG_LEVEL_TRACE */
-
- return error;
- }
-
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Render_Glyph( FT_GlyphSlot slot,
- FT_Render_Mode render_mode )
- {
- FT_Library library;
-
-
- if ( !slot || !slot->face )
- return FT_THROW( Invalid_Argument );
-
- library = FT_FACE_LIBRARY( slot->face );
-
- return FT_Render_Glyph_Internal( library, slot, render_mode );
- }
-
-
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
- /**** ****/
- /**** ****/
- /**** M O D U L E S ****/
- /**** ****/
- /**** ****/
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* Destroy_Module */
- /* */
- /* <Description> */
- /* Destroys a given module object. For drivers, this also destroys */
- /* all child faces. */
- /* */
- /* <InOut> */
- /* module :: A handle to the target driver object. */
- /* */
- /* <Note> */
- /* The driver _must_ be LOCKED! */
- /* */
- static void
- Destroy_Module( FT_Module module )
- {
- FT_Memory memory = module->memory;
- FT_Module_Class* clazz = module->clazz;
- FT_Library library = module->library;
-
-
- if ( library && library->auto_hinter == module )
- library->auto_hinter = NULL;
-
- /* if the module is a renderer */
- if ( FT_MODULE_IS_RENDERER( module ) )
- ft_remove_renderer( module );
-
- /* if the module is a font driver, add some steps */
- if ( FT_MODULE_IS_DRIVER( module ) )
- Destroy_Driver( FT_DRIVER( module ) );
-
- /* finalize the module object */
- if ( clazz->module_done )
- clazz->module_done( module );
-
- /* discard it */
- FT_FREE( module );
- }
-
-
- /* documentation is in ftmodapi.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Add_Module( FT_Library library,
- const FT_Module_Class* clazz )
- {
- FT_Error error;
- FT_Memory memory;
- FT_Module module;
- FT_UInt nn;
-
-
-#define FREETYPE_VER_FIXED ( ( (FT_Long)FREETYPE_MAJOR << 16 ) | \
- FREETYPE_MINOR )
-
- if ( !library )
- return FT_THROW( Invalid_Library_Handle );
-
- if ( !clazz )
- return FT_THROW( Invalid_Argument );
-
- /* check freetype version */
- if ( clazz->module_requires > FREETYPE_VER_FIXED )
- return FT_THROW( Invalid_Version );
-
- /* look for a module with the same name in the library's table */
- for ( nn = 0; nn < library->num_modules; nn++ )
- {
- module = library->modules[nn];
- if ( ft_strcmp( module->clazz->module_name, clazz->module_name ) == 0 )
- {
- /* this installed module has the same name, compare their versions */
- if ( clazz->module_version <= module->clazz->module_version )
- return FT_THROW( Lower_Module_Version );
-
- /* remove the module from our list, then exit the loop to replace */
- /* it by our new version.. */
- FT_Remove_Module( library, module );
- break;
- }
- }
-
- memory = library->memory;
- error = FT_Err_Ok;
-
- if ( library->num_modules >= FT_MAX_MODULES )
- {
- error = FT_THROW( Too_Many_Drivers );
- goto Exit;
- }
-
- /* allocate module object */
- if ( FT_ALLOC( module, clazz->module_size ) )
- goto Exit;
-
- /* base initialization */
- module->library = library;
- module->memory = memory;
- module->clazz = (FT_Module_Class*)clazz;
-
- /* check whether the module is a renderer - this must be performed */
- /* before the normal module initialization */
- if ( FT_MODULE_IS_RENDERER( module ) )
- {
- /* add to the renderers list */
- error = ft_add_renderer( module );
- if ( error )
- goto Fail;
- }
-
- /* is the module a auto-hinter? */
- if ( FT_MODULE_IS_HINTER( module ) )
- library->auto_hinter = module;
-
- /* if the module is a font driver */
- if ( FT_MODULE_IS_DRIVER( module ) )
- {
- FT_Driver driver = FT_DRIVER( module );
-
-
- driver->clazz = (FT_Driver_Class)module->clazz;
- }
-
- if ( clazz->module_init )
- {
- error = clazz->module_init( module );
- if ( error )
- goto Fail;
- }
-
- /* add module to the library's table */
- library->modules[library->num_modules++] = module;
-
- Exit:
- return error;
-
- Fail:
- if ( FT_MODULE_IS_RENDERER( module ) )
- {
- FT_Renderer renderer = FT_RENDERER( module );
-
-
- if ( renderer->clazz &&
- renderer->clazz->glyph_format == FT_GLYPH_FORMAT_OUTLINE &&
- renderer->raster )
- renderer->clazz->raster_class->raster_done( renderer->raster );
- }
-
- FT_FREE( module );
- goto Exit;
- }
-
-
- /* documentation is in ftmodapi.h */
-
- FT_EXPORT_DEF( FT_Module )
- FT_Get_Module( FT_Library library,
- const char* module_name )
- {
- FT_Module result = NULL;
- FT_Module* cur;
- FT_Module* limit;
-
-
- if ( !library || !module_name )
- return result;
-
- cur = library->modules;
- limit = cur + library->num_modules;
-
- for ( ; cur < limit; cur++ )
- if ( ft_strcmp( cur[0]->clazz->module_name, module_name ) == 0 )
- {
- result = cur[0];
- break;
- }
-
- return result;
- }
-
-
- /* documentation is in ftobjs.h */
-
- FT_BASE_DEF( const void* )
- FT_Get_Module_Interface( FT_Library library,
- const char* mod_name )
- {
- FT_Module module;
-
-
- /* test for valid `library' delayed to FT_Get_Module() */
-
- module = FT_Get_Module( library, mod_name );
-
- return module ? module->clazz->module_interface : 0;
- }
-
-
- FT_BASE_DEF( FT_Pointer )
- ft_module_get_service( FT_Module module,
- const char* service_id )
- {
- FT_Pointer result = NULL;
-
-
- if ( module )
- {
- FT_ASSERT( module->clazz && module->clazz->get_interface );
-
- /* first, look for the service in the module */
- if ( module->clazz->get_interface )
- result = module->clazz->get_interface( module, service_id );
-
- if ( result == NULL )
- {
- /* we didn't find it, look in all other modules then */
- FT_Library library = module->library;
- FT_Module* cur = library->modules;
- FT_Module* limit = cur + library->num_modules;
-
-
- for ( ; cur < limit; cur++ )
- {
- if ( cur[0] != module )
- {
- FT_ASSERT( cur[0]->clazz );
-
- if ( cur[0]->clazz->get_interface )
- {
- result = cur[0]->clazz->get_interface( cur[0], service_id );
- if ( result != NULL )
- break;
- }
- }
- }
- }
- }
-
- return result;
- }
-
-
- /* documentation is in ftmodapi.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Remove_Module( FT_Library library,
- FT_Module module )
- {
- /* try to find the module from the table, then remove it from there */
-
- if ( !library )
- return FT_THROW( Invalid_Library_Handle );
-
- if ( module )
- {
- FT_Module* cur = library->modules;
- FT_Module* limit = cur + library->num_modules;
-
-
- for ( ; cur < limit; cur++ )
- {
- if ( cur[0] == module )
- {
- /* remove it from the table */
- library->num_modules--;
- limit--;
- while ( cur < limit )
- {
- cur[0] = cur[1];
- cur++;
- }
- limit[0] = NULL;
-
- /* destroy the module */
- Destroy_Module( module );
-
- return FT_Err_Ok;
- }
- }
- }
- return FT_THROW( Invalid_Driver_Handle );
- }
-
-
- static FT_Error
- ft_property_do( FT_Library library,
- const FT_String* module_name,
- const FT_String* property_name,
- void* value,
- FT_Bool set )
- {
- FT_Module* cur;
- FT_Module* limit;
- FT_Module_Interface interface;
-
- FT_Service_Properties service;
-
-#ifdef FT_DEBUG_LEVEL_ERROR
- const FT_String* set_name = "FT_Property_Set";
- const FT_String* get_name = "FT_Property_Get";
- const FT_String* func_name = set ? set_name : get_name;
-#endif
-
- FT_Bool missing_func;
-
-
- if ( !library )
- return FT_THROW( Invalid_Library_Handle );
-
- if ( !module_name || !property_name || !value )
- return FT_THROW( Invalid_Argument );
-
- cur = library->modules;
- limit = cur + library->num_modules;
-
- /* search module */
- for ( ; cur < limit; cur++ )
- if ( !ft_strcmp( cur[0]->clazz->module_name, module_name ) )
- break;
-
- if ( cur == limit )
- {
- FT_ERROR(( "%s: can't find module `%s'\n",
- func_name, module_name ));
- return FT_THROW( Missing_Module );
- }
-
- /* check whether we have a service interface */
- if ( !cur[0]->clazz->get_interface )
- {
- FT_ERROR(( "%s: module `%s' doesn't support properties\n",
- func_name, module_name ));
- return FT_THROW( Unimplemented_Feature );
- }
-
- /* search property service */
- interface = cur[0]->clazz->get_interface( cur[0],
- FT_SERVICE_ID_PROPERTIES );
- if ( !interface )
- {
- FT_ERROR(( "%s: module `%s' doesn't support properties\n",
- func_name, module_name ));
- return FT_THROW( Unimplemented_Feature );
- }
-
- service = (FT_Service_Properties)interface;
-
- if ( set )
- missing_func = (FT_Bool)( !service->set_property );
- else
- missing_func = (FT_Bool)( !service->get_property );
-
- if ( missing_func )
- {
- FT_ERROR(( "%s: property service of module `%s' is broken\n",
- func_name, module_name ));
- return FT_THROW( Unimplemented_Feature );
- }
-
- return set ? service->set_property( cur[0], property_name, value )
- : service->get_property( cur[0], property_name, value );
- }
-
-
- /* documentation is in ftmodapi.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Property_Set( FT_Library library,
- const FT_String* module_name,
- const FT_String* property_name,
- const void* value )
- {
- return ft_property_do( library,
- module_name,
- property_name,
- (void*)value,
- TRUE );
- }
-
-
- /* documentation is in ftmodapi.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Property_Get( FT_Library library,
- const FT_String* module_name,
- const FT_String* property_name,
- void* value )
- {
- return ft_property_do( library,
- module_name,
- property_name,
- value,
- FALSE );
- }
-
-
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
- /**** ****/
- /**** ****/
- /**** L I B R A R Y ****/
- /**** ****/
- /**** ****/
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
-
-
- /* documentation is in ftmodapi.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Reference_Library( FT_Library library )
- {
- if ( !library )
- return FT_THROW( Invalid_Library_Handle );
-
- library->refcount++;
-
- return FT_Err_Ok;
- }
-
-
- /* documentation is in ftmodapi.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_New_Library( FT_Memory memory,
- FT_Library *alibrary )
- {
- FT_Library library = NULL;
- FT_Error error;
-
-
- if ( !memory || !alibrary )
- return FT_THROW( Invalid_Argument );
-
-#ifdef FT_DEBUG_LEVEL_ERROR
- /* init debugging support */
- ft_debug_init();
-#endif
-
- /* first of all, allocate the library object */
- if ( FT_NEW( library ) )
- return error;
-
- library->memory = memory;
-
-#ifdef FT_CONFIG_OPTION_PIC
- /* initialize position independent code containers */
- error = ft_pic_container_init( library );
- if ( error )
- goto Fail;
-#endif
-
- /* we don't use raster_pool anymore. */
- library->raster_pool_size = 0;
- library->raster_pool = NULL;
-
- library->version_major = FREETYPE_MAJOR;
- library->version_minor = FREETYPE_MINOR;
- library->version_patch = FREETYPE_PATCH;
-
- library->refcount = 1;
-
- /* That's ok now */
- *alibrary = library;
-
- return FT_Err_Ok;
-
-#ifdef FT_CONFIG_OPTION_PIC
- Fail:
- ft_pic_container_destroy( library );
-#endif
- FT_FREE( library );
- return error;
- }
-
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( void )
- FT_Library_Version( FT_Library library,
- FT_Int *amajor,
- FT_Int *aminor,
- FT_Int *apatch )
- {
- FT_Int major = 0;
- FT_Int minor = 0;
- FT_Int patch = 0;
-
-
- if ( library )
- {
- major = library->version_major;
- minor = library->version_minor;
- patch = library->version_patch;
- }
-
- if ( amajor )
- *amajor = major;
-
- if ( aminor )
- *aminor = minor;
-
- if ( apatch )
- *apatch = patch;
- }
-
-
- /* documentation is in ftmodapi.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Done_Library( FT_Library library )
- {
- FT_Memory memory;
-
-
- if ( !library )
- return FT_THROW( Invalid_Library_Handle );
-
- library->refcount--;
- if ( library->refcount > 0 )
- goto Exit;
-
- memory = library->memory;
-
- /*
- * Close all faces in the library. If we don't do this, we can have
- * some subtle memory leaks.
- *
- * Example:
- *
- * - the cff font driver uses the pshinter module in cff_size_done
- * - if the pshinter module is destroyed before the cff font driver,
- * opened FT_Face objects managed by the driver are not properly
- * destroyed, resulting in a memory leak
- *
- * Some faces are dependent on other faces, like Type42 faces that
- * depend on TrueType faces synthesized internally.
- *
- * The order of drivers should be specified in driver_name[].
- */
- {
- FT_UInt m, n;
- const char* driver_name[] = { "type42", NULL };
-
-
- for ( m = 0;
- m < sizeof ( driver_name ) / sizeof ( driver_name[0] );
- m++ )
- {
- for ( n = 0; n < library->num_modules; n++ )
- {
- FT_Module module = library->modules[n];
- const char* module_name = module->clazz->module_name;
- FT_List faces;
-
-
- if ( driver_name[m] &&
- ft_strcmp( module_name, driver_name[m] ) != 0 )
- continue;
-
- if ( ( module->clazz->module_flags & FT_MODULE_FONT_DRIVER ) == 0 )
- continue;
-
- FT_TRACE7(( "FT_Done_Library: close faces for %s\n", module_name ));
-
- faces = &FT_DRIVER( module )->faces_list;
- while ( faces->head )
- {
- FT_Done_Face( FT_FACE( faces->head->data ) );
- if ( faces->head )
- FT_TRACE0(( "FT_Done_Library: failed to free some faces\n" ));
- }
- }
- }
- }
-
- /* Close all other modules in the library */
-#if 1
- /* XXX Modules are removed in the reversed order so that */
- /* type42 module is removed before truetype module. This */
- /* avoids double free in some occasions. It is a hack. */
- while ( library->num_modules > 0 )
- FT_Remove_Module( library,
- library->modules[library->num_modules - 1] );
-#else
- {
- FT_UInt n;
-
-
- for ( n = 0; n < library->num_modules; n++ )
- {
- FT_Module module = library->modules[n];
-
-
- if ( module )
- {
- Destroy_Module( module );
- library->modules[n] = NULL;
- }
- }
- }
-#endif
-
-#ifdef FT_CONFIG_OPTION_PIC
- /* Destroy pic container contents */
- ft_pic_container_destroy( library );
-#endif
-
- FT_FREE( library );
-
- Exit:
- return FT_Err_Ok;
- }
-
-
- /* documentation is in ftmodapi.h */
-
- FT_EXPORT_DEF( void )
- FT_Set_Debug_Hook( FT_Library library,
- FT_UInt hook_index,
- FT_DebugHook_Func debug_hook )
- {
- if ( library && debug_hook &&
- hook_index <
- ( sizeof ( library->debug_hooks ) / sizeof ( void* ) ) )
- library->debug_hooks[hook_index] = debug_hook;
- }
-
-
- /* documentation is in ftmodapi.h */
-
- FT_EXPORT_DEF( FT_TrueTypeEngineType )
- FT_Get_TrueType_Engine_Type( FT_Library library )
- {
- FT_TrueTypeEngineType result = FT_TRUETYPE_ENGINE_TYPE_NONE;
-
-
- if ( library )
- {
- FT_Module module = FT_Get_Module( library, "truetype" );
-
-
- if ( module )
- {
- FT_Service_TrueTypeEngine service;
-
-
- service = (FT_Service_TrueTypeEngine)
- ft_module_get_service( module,
- FT_SERVICE_ID_TRUETYPE_ENGINE );
- if ( service )
- result = service->engine_type;
- }
- }
-
- return result;
- }
-
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Get_SubGlyph_Info( FT_GlyphSlot glyph,
- FT_UInt sub_index,
- FT_Int *p_index,
- FT_UInt *p_flags,
- FT_Int *p_arg1,
- FT_Int *p_arg2,
- FT_Matrix *p_transform )
- {
- FT_Error error = FT_ERR( Invalid_Argument );
-
-
- if ( glyph &&
- glyph->subglyphs &&
- glyph->format == FT_GLYPH_FORMAT_COMPOSITE &&
- sub_index < glyph->num_subglyphs )
- {
- FT_SubGlyph subg = glyph->subglyphs + sub_index;
-
-
- *p_index = subg->index;
- *p_flags = subg->flags;
- *p_arg1 = subg->arg1;
- *p_arg2 = subg->arg2;
- *p_transform = subg->transform;
-
- error = FT_Err_Ok;
- }
-
- return error;
- }
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/base/ftotval.c b/chromium/third_party/pdfium/third_party/freetype/src/base/ftotval.c
deleted file mode 100644
index 786457ba2af..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/base/ftotval.c
+++ /dev/null
@@ -1,91 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftotval.c */
-/* */
-/* FreeType API for validating OpenType tables (body). */
-/* */
-/* Copyright 2004-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-
-#include FT_INTERNAL_OBJECTS_H
-#include FT_SERVICE_OPENTYPE_VALIDATE_H
-#include FT_OPENTYPE_VALIDATE_H
-
-
- /* documentation is in ftotval.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_OpenType_Validate( FT_Face face,
- FT_UInt validation_flags,
- FT_Bytes *BASE_table,
- FT_Bytes *GDEF_table,
- FT_Bytes *GPOS_table,
- FT_Bytes *GSUB_table,
- FT_Bytes *JSTF_table )
- {
- FT_Service_OTvalidate service;
- FT_Error error;
-
-
- if ( !face )
- {
- error = FT_THROW( Invalid_Face_Handle );
- goto Exit;
- }
-
- if ( !( BASE_table &&
- GDEF_table &&
- GPOS_table &&
- GSUB_table &&
- JSTF_table ) )
- {
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- FT_FACE_FIND_GLOBAL_SERVICE( face, service, OPENTYPE_VALIDATE );
-
- if ( service )
- error = service->validate( face,
- validation_flags,
- BASE_table,
- GDEF_table,
- GPOS_table,
- GSUB_table,
- JSTF_table );
- else
- error = FT_THROW( Unimplemented_Feature );
-
- Exit:
- return error;
- }
-
-
- FT_EXPORT_DEF( void )
- FT_OpenType_Free( FT_Face face,
- FT_Bytes table )
- {
- FT_Memory memory;
-
-
- if ( !face )
- return;
-
- memory = FT_FACE_MEMORY( face );
-
- FT_FREE( table );
- }
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/base/ftoutln.c b/chromium/third_party/pdfium/third_party/freetype/src/base/ftoutln.c
deleted file mode 100644
index 35cc9f55692..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/base/ftoutln.c
+++ /dev/null
@@ -1,1099 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftoutln.c */
-/* */
-/* FreeType outline management (body). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* All functions are declared in freetype.h. */
- /* */
- /*************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_OUTLINE_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_CALC_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_TRIGONOMETRY_H
-
-
- /*************************************************************************/
- /* */
- /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
- /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
- /* messages during execution. */
- /* */
-#undef FT_COMPONENT
-#define FT_COMPONENT trace_outline
-
-
- static
- const FT_Outline null_outline = { 0, 0, 0, 0, 0, 0 };
-
-
- /* documentation is in ftoutln.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Outline_Decompose( FT_Outline* outline,
- const FT_Outline_Funcs* func_interface,
- void* user )
- {
-#undef SCALED
-#define SCALED( x ) ( ( (x) < 0 ? -( -(x) << shift ) \
- : ( (x) << shift ) ) - delta )
-
- FT_Vector v_last;
- FT_Vector v_control;
- FT_Vector v_start;
-
- FT_Vector* point;
- FT_Vector* limit;
- char* tags;
-
- FT_Error error;
-
- FT_Int n; /* index of contour in outline */
- FT_UInt first; /* index of first point in contour */
- FT_Int tag; /* current point's state */
-
- FT_Int shift;
- FT_Pos delta;
-
-
- if ( !outline )
- return FT_THROW( Invalid_Outline );
-
- if ( !func_interface )
- return FT_THROW( Invalid_Argument );
-
- shift = func_interface->shift;
- delta = func_interface->delta;
- first = 0;
-
- for ( n = 0; n < outline->n_contours; n++ )
- {
- FT_Int last; /* index of last point in contour */
-
-
- FT_TRACE5(( "FT_Outline_Decompose: Outline %d\n", n ));
-
- last = outline->contours[n];
- if ( last < 0 )
- goto Invalid_Outline;
- limit = outline->points + last;
-
- v_start = outline->points[first];
- v_start.x = SCALED( v_start.x );
- v_start.y = SCALED( v_start.y );
-
- v_last = outline->points[last];
- v_last.x = SCALED( v_last.x );
- v_last.y = SCALED( v_last.y );
-
- v_control = v_start;
-
- point = outline->points + first;
- tags = outline->tags + first;
- tag = FT_CURVE_TAG( tags[0] );
-
- /* A contour cannot start with a cubic control point! */
- if ( tag == FT_CURVE_TAG_CUBIC )
- goto Invalid_Outline;
-
- /* check first point to determine origin */
- if ( tag == FT_CURVE_TAG_CONIC )
- {
- /* first point is conic control. Yes, this happens. */
- if ( FT_CURVE_TAG( outline->tags[last] ) == FT_CURVE_TAG_ON )
- {
- /* start at last point if it is on the curve */
- v_start = v_last;
- limit--;
- }
- else
- {
- /* if both first and last points are conic, */
- /* start at their middle and record its position */
- /* for closure */
- v_start.x = ( v_start.x + v_last.x ) / 2;
- v_start.y = ( v_start.y + v_last.y ) / 2;
-
- /* v_last = v_start; */
- }
- point--;
- tags--;
- }
-
- FT_TRACE5(( " move to (%.2f, %.2f)\n",
- v_start.x / 64.0, v_start.y / 64.0 ));
- error = func_interface->move_to( &v_start, user );
- if ( error )
- goto Exit;
-
- while ( point < limit )
- {
- point++;
- tags++;
-
- tag = FT_CURVE_TAG( tags[0] );
- switch ( tag )
- {
- case FT_CURVE_TAG_ON: /* emit a single line_to */
- {
- FT_Vector vec;
-
-
- vec.x = SCALED( point->x );
- vec.y = SCALED( point->y );
-
- FT_TRACE5(( " line to (%.2f, %.2f)\n",
- vec.x / 64.0, vec.y / 64.0 ));
- error = func_interface->line_to( &vec, user );
- if ( error )
- goto Exit;
- continue;
- }
-
- case FT_CURVE_TAG_CONIC: /* consume conic arcs */
- v_control.x = SCALED( point->x );
- v_control.y = SCALED( point->y );
-
- Do_Conic:
- if ( point < limit )
- {
- FT_Vector vec;
- FT_Vector v_middle;
-
-
- point++;
- tags++;
- tag = FT_CURVE_TAG( tags[0] );
-
- vec.x = SCALED( point->x );
- vec.y = SCALED( point->y );
-
- if ( tag == FT_CURVE_TAG_ON )
- {
- FT_TRACE5(( " conic to (%.2f, %.2f)"
- " with control (%.2f, %.2f)\n",
- vec.x / 64.0, vec.y / 64.0,
- v_control.x / 64.0, v_control.y / 64.0 ));
- error = func_interface->conic_to( &v_control, &vec, user );
- if ( error )
- goto Exit;
- continue;
- }
-
- if ( tag != FT_CURVE_TAG_CONIC )
- goto Invalid_Outline;
-
- v_middle.x = ( v_control.x + vec.x ) / 2;
- v_middle.y = ( v_control.y + vec.y ) / 2;
-
- FT_TRACE5(( " conic to (%.2f, %.2f)"
- " with control (%.2f, %.2f)\n",
- v_middle.x / 64.0, v_middle.y / 64.0,
- v_control.x / 64.0, v_control.y / 64.0 ));
- error = func_interface->conic_to( &v_control, &v_middle, user );
- if ( error )
- goto Exit;
-
- v_control = vec;
- goto Do_Conic;
- }
-
- FT_TRACE5(( " conic to (%.2f, %.2f)"
- " with control (%.2f, %.2f)\n",
- v_start.x / 64.0, v_start.y / 64.0,
- v_control.x / 64.0, v_control.y / 64.0 ));
- error = func_interface->conic_to( &v_control, &v_start, user );
- goto Close;
-
- default: /* FT_CURVE_TAG_CUBIC */
- {
- FT_Vector vec1, vec2;
-
-
- if ( point + 1 > limit ||
- FT_CURVE_TAG( tags[1] ) != FT_CURVE_TAG_CUBIC )
- goto Invalid_Outline;
-
- point += 2;
- tags += 2;
-
- vec1.x = SCALED( point[-2].x );
- vec1.y = SCALED( point[-2].y );
-
- vec2.x = SCALED( point[-1].x );
- vec2.y = SCALED( point[-1].y );
-
- if ( point <= limit )
- {
- FT_Vector vec;
-
-
- vec.x = SCALED( point->x );
- vec.y = SCALED( point->y );
-
- FT_TRACE5(( " cubic to (%.2f, %.2f)"
- " with controls (%.2f, %.2f) and (%.2f, %.2f)\n",
- vec.x / 64.0, vec.y / 64.0,
- vec1.x / 64.0, vec1.y / 64.0,
- vec2.x / 64.0, vec2.y / 64.0 ));
- error = func_interface->cubic_to( &vec1, &vec2, &vec, user );
- if ( error )
- goto Exit;
- continue;
- }
-
- FT_TRACE5(( " cubic to (%.2f, %.2f)"
- " with controls (%.2f, %.2f) and (%.2f, %.2f)\n",
- v_start.x / 64.0, v_start.y / 64.0,
- vec1.x / 64.0, vec1.y / 64.0,
- vec2.x / 64.0, vec2.y / 64.0 ));
- error = func_interface->cubic_to( &vec1, &vec2, &v_start, user );
- goto Close;
- }
- }
- }
-
- /* close the contour with a line segment */
- FT_TRACE5(( " line to (%.2f, %.2f)\n",
- v_start.x / 64.0, v_start.y / 64.0 ));
- error = func_interface->line_to( &v_start, user );
-
- Close:
- if ( error )
- goto Exit;
-
- first = (FT_UInt)last + 1;
- }
-
- FT_TRACE5(( "FT_Outline_Decompose: Done\n", n ));
- return FT_Err_Ok;
-
- Exit:
- FT_TRACE5(( "FT_Outline_Decompose: Error %d\n", error ));
- return error;
-
- Invalid_Outline:
- return FT_THROW( Invalid_Outline );
- }
-
-
- FT_EXPORT_DEF( FT_Error )
- FT_Outline_New_Internal( FT_Memory memory,
- FT_UInt numPoints,
- FT_Int numContours,
- FT_Outline *anoutline )
- {
- FT_Error error;
-
-
- if ( !anoutline || !memory )
- return FT_THROW( Invalid_Argument );
-
- *anoutline = null_outline;
-
- if ( numContours < 0 ||
- (FT_UInt)numContours > numPoints )
- return FT_THROW( Invalid_Argument );
-
- if ( numPoints > FT_OUTLINE_POINTS_MAX )
- return FT_THROW( Array_Too_Large );
-
- if ( FT_NEW_ARRAY( anoutline->points, numPoints ) ||
- FT_NEW_ARRAY( anoutline->tags, numPoints ) ||
- FT_NEW_ARRAY( anoutline->contours, numContours ) )
- goto Fail;
-
- anoutline->n_points = (FT_Short)numPoints;
- anoutline->n_contours = (FT_Short)numContours;
- anoutline->flags |= FT_OUTLINE_OWNER;
-
- return FT_Err_Ok;
-
- Fail:
- anoutline->flags |= FT_OUTLINE_OWNER;
- FT_Outline_Done_Internal( memory, anoutline );
-
- return error;
- }
-
-
- /* documentation is in ftoutln.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Outline_New( FT_Library library,
- FT_UInt numPoints,
- FT_Int numContours,
- FT_Outline *anoutline )
- {
- if ( !library )
- return FT_THROW( Invalid_Library_Handle );
-
- return FT_Outline_New_Internal( library->memory, numPoints,
- numContours, anoutline );
- }
-
-
- /* documentation is in ftoutln.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Outline_Check( FT_Outline* outline )
- {
- if ( outline )
- {
- FT_Int n_points = outline->n_points;
- FT_Int n_contours = outline->n_contours;
- FT_Int end0, end;
- FT_Int n;
-
-
- /* empty glyph? */
- if ( n_points == 0 && n_contours == 0 )
- return FT_Err_Ok;
-
- /* check point and contour counts */
- if ( n_points <= 0 || n_contours <= 0 )
- goto Bad;
-
- end0 = end = -1;
- for ( n = 0; n < n_contours; n++ )
- {
- end = outline->contours[n];
-
- /* note that we don't accept empty contours */
- if ( end <= end0 || end >= n_points )
- goto Bad;
-
- end0 = end;
- }
-
- if ( end != n_points - 1 )
- goto Bad;
-
- /* XXX: check the tags array */
- return FT_Err_Ok;
- }
-
- Bad:
- return FT_THROW( Invalid_Argument );
- }
-
-
- /* documentation is in ftoutln.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Outline_Copy( const FT_Outline* source,
- FT_Outline *target )
- {
- FT_Int is_owner;
-
-
- if ( !source || !target )
- return FT_THROW( Invalid_Outline );
-
- if ( source->n_points != target->n_points ||
- source->n_contours != target->n_contours )
- return FT_THROW( Invalid_Argument );
-
- if ( source == target )
- return FT_Err_Ok;
-
- FT_ARRAY_COPY( target->points, source->points, source->n_points );
-
- FT_ARRAY_COPY( target->tags, source->tags, source->n_points );
-
- FT_ARRAY_COPY( target->contours, source->contours, source->n_contours );
-
- /* copy all flags, except the `FT_OUTLINE_OWNER' one */
- is_owner = target->flags & FT_OUTLINE_OWNER;
- target->flags = source->flags;
-
- target->flags &= ~FT_OUTLINE_OWNER;
- target->flags |= is_owner;
-
- return FT_Err_Ok;
- }
-
-
- FT_EXPORT_DEF( FT_Error )
- FT_Outline_Done_Internal( FT_Memory memory,
- FT_Outline* outline )
- {
- if ( !outline )
- return FT_THROW( Invalid_Outline );
-
- if ( !memory )
- return FT_THROW( Invalid_Argument );
-
- if ( outline->flags & FT_OUTLINE_OWNER )
- {
- FT_FREE( outline->points );
- FT_FREE( outline->tags );
- FT_FREE( outline->contours );
- }
- *outline = null_outline;
-
- return FT_Err_Ok;
- }
-
-
- /* documentation is in ftoutln.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Outline_Done( FT_Library library,
- FT_Outline* outline )
- {
- /* check for valid `outline' in FT_Outline_Done_Internal() */
-
- if ( !library )
- return FT_THROW( Invalid_Library_Handle );
-
- return FT_Outline_Done_Internal( library->memory, outline );
- }
-
-
- /* documentation is in ftoutln.h */
-
- FT_EXPORT_DEF( void )
- FT_Outline_Get_CBox( const FT_Outline* outline,
- FT_BBox *acbox )
- {
- FT_Pos xMin, yMin, xMax, yMax;
-
-
- if ( outline && acbox )
- {
- if ( outline->n_points == 0 )
- {
- xMin = 0;
- yMin = 0;
- xMax = 0;
- yMax = 0;
- }
- else
- {
- FT_Vector* vec = outline->points;
- FT_Vector* limit = vec + outline->n_points;
-
-
- xMin = xMax = vec->x;
- yMin = yMax = vec->y;
- vec++;
-
- for ( ; vec < limit; vec++ )
- {
- FT_Pos x, y;
-
-
- x = vec->x;
- if ( x < xMin ) xMin = x;
- if ( x > xMax ) xMax = x;
-
- y = vec->y;
- if ( y < yMin ) yMin = y;
- if ( y > yMax ) yMax = y;
- }
- }
- acbox->xMin = xMin;
- acbox->xMax = xMax;
- acbox->yMin = yMin;
- acbox->yMax = yMax;
- }
- }
-
-
- /* documentation is in ftoutln.h */
-
- FT_EXPORT_DEF( void )
- FT_Outline_Translate( const FT_Outline* outline,
- FT_Pos xOffset,
- FT_Pos yOffset )
- {
- FT_UShort n;
- FT_Vector* vec;
-
-
- if ( !outline )
- return;
-
- vec = outline->points;
-
- for ( n = 0; n < outline->n_points; n++ )
- {
- vec->x += xOffset;
- vec->y += yOffset;
- vec++;
- }
- }
-
-
- /* documentation is in ftoutln.h */
-
- FT_EXPORT_DEF( void )
- FT_Outline_Reverse( FT_Outline* outline )
- {
- FT_UShort n;
- FT_Int first, last;
-
-
- if ( !outline )
- return;
-
- first = 0;
-
- for ( n = 0; n < outline->n_contours; n++ )
- {
- last = outline->contours[n];
-
- /* reverse point table */
- {
- FT_Vector* p = outline->points + first;
- FT_Vector* q = outline->points + last;
- FT_Vector swap;
-
-
- while ( p < q )
- {
- swap = *p;
- *p = *q;
- *q = swap;
- p++;
- q--;
- }
- }
-
- /* reverse tags table */
- {
- char* p = outline->tags + first;
- char* q = outline->tags + last;
-
-
- while ( p < q )
- {
- char swap;
-
-
- swap = *p;
- *p = *q;
- *q = swap;
- p++;
- q--;
- }
- }
-
- first = last + 1;
- }
-
- outline->flags ^= FT_OUTLINE_REVERSE_FILL;
- }
-
-
- /* documentation is in ftoutln.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Outline_Render( FT_Library library,
- FT_Outline* outline,
- FT_Raster_Params* params )
- {
- FT_Error error;
- FT_Renderer renderer;
- FT_ListNode node;
-
-
- if ( !library )
- return FT_THROW( Invalid_Library_Handle );
-
- if ( !outline )
- return FT_THROW( Invalid_Outline );
-
- if ( !params )
- return FT_THROW( Invalid_Argument );
-
- renderer = library->cur_renderer;
- node = library->renderers.head;
-
- params->source = (void*)outline;
-
- error = FT_ERR( Cannot_Render_Glyph );
- while ( renderer )
- {
- error = renderer->raster_render( renderer->raster, params );
- if ( !error || FT_ERR_NEQ( error, Cannot_Render_Glyph ) )
- break;
-
- /* FT_Err_Cannot_Render_Glyph is returned if the render mode */
- /* is unsupported by the current renderer for this glyph image */
- /* format */
-
- /* now, look for another renderer that supports the same */
- /* format */
- renderer = FT_Lookup_Renderer( library, FT_GLYPH_FORMAT_OUTLINE,
- &node );
- }
-
- return error;
- }
-
-
- /* documentation is in ftoutln.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Outline_Get_Bitmap( FT_Library library,
- FT_Outline* outline,
- const FT_Bitmap *abitmap )
- {
- FT_Raster_Params params;
-
-
- if ( !abitmap )
- return FT_THROW( Invalid_Argument );
-
- /* other checks are delayed to `FT_Outline_Render' */
-
- params.target = abitmap;
- params.flags = 0;
-
- if ( abitmap->pixel_mode == FT_PIXEL_MODE_GRAY ||
- abitmap->pixel_mode == FT_PIXEL_MODE_LCD ||
- abitmap->pixel_mode == FT_PIXEL_MODE_LCD_V )
- params.flags |= FT_RASTER_FLAG_AA;
-
- return FT_Outline_Render( library, outline, &params );
- }
-
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( void )
- FT_Vector_Transform( FT_Vector* vector,
- const FT_Matrix* matrix )
- {
- FT_Pos xz, yz;
-
-
- if ( !vector || !matrix )
- return;
-
- xz = FT_MulFix( vector->x, matrix->xx ) +
- FT_MulFix( vector->y, matrix->xy );
-
- yz = FT_MulFix( vector->x, matrix->yx ) +
- FT_MulFix( vector->y, matrix->yy );
-
- vector->x = xz;
- vector->y = yz;
- }
-
-
- /* documentation is in ftoutln.h */
-
- FT_EXPORT_DEF( void )
- FT_Outline_Transform( const FT_Outline* outline,
- const FT_Matrix* matrix )
- {
- FT_Vector* vec;
- FT_Vector* limit;
-
-
- if ( !outline || !matrix )
- return;
-
- vec = outline->points;
- limit = vec + outline->n_points;
-
- for ( ; vec < limit; vec++ )
- FT_Vector_Transform( vec, matrix );
- }
-
-
-#if 0
-
-#define FT_OUTLINE_GET_CONTOUR( outline, c, first, last ) \
- do \
- { \
- (first) = ( c > 0 ) ? (outline)->points + \
- (outline)->contours[c - 1] + 1 \
- : (outline)->points; \
- (last) = (outline)->points + (outline)->contours[c]; \
- } while ( 0 )
-
-
- /* Is a point in some contour? */
- /* */
- /* We treat every point of the contour as if it */
- /* it were ON. That is, we allow false positives, */
- /* but disallow false negatives. (XXX really?) */
- static FT_Bool
- ft_contour_has( FT_Outline* outline,
- FT_Short c,
- FT_Vector* point )
- {
- FT_Vector* first;
- FT_Vector* last;
- FT_Vector* a;
- FT_Vector* b;
- FT_UInt n = 0;
-
-
- FT_OUTLINE_GET_CONTOUR( outline, c, first, last );
-
- for ( a = first; a <= last; a++ )
- {
- FT_Pos x;
- FT_Int intersect;
-
-
- b = ( a == last ) ? first : a + 1;
-
- intersect = ( a->y - point->y ) ^ ( b->y - point->y );
-
- /* a and b are on the same side */
- if ( intersect >= 0 )
- {
- if ( intersect == 0 && a->y == point->y )
- {
- if ( ( a->x <= point->x && b->x >= point->x ) ||
- ( a->x >= point->x && b->x <= point->x ) )
- return 1;
- }
-
- continue;
- }
-
- x = a->x + ( b->x - a->x ) * (point->y - a->y ) / ( b->y - a->y );
-
- if ( x < point->x )
- n++;
- else if ( x == point->x )
- return 1;
- }
-
- return n & 1;
- }
-
-
- static FT_Bool
- ft_contour_enclosed( FT_Outline* outline,
- FT_UShort c )
- {
- FT_Vector* first;
- FT_Vector* last;
- FT_Short i;
-
-
- FT_OUTLINE_GET_CONTOUR( outline, c, first, last );
-
- for ( i = 0; i < outline->n_contours; i++ )
- {
- if ( i != c && ft_contour_has( outline, i, first ) )
- {
- FT_Vector* pt;
-
-
- for ( pt = first + 1; pt <= last; pt++ )
- if ( !ft_contour_has( outline, i, pt ) )
- return 0;
-
- return 1;
- }
- }
-
- return 0;
- }
-
-
- /* This version differs from the public one in that each */
- /* part (contour not enclosed in another contour) of the */
- /* outline is checked for orientation. This is */
- /* necessary for some buggy CJK fonts. */
- static FT_Orientation
- ft_outline_get_orientation( FT_Outline* outline )
- {
- FT_Short i;
- FT_Vector* first;
- FT_Vector* last;
- FT_Orientation orient = FT_ORIENTATION_NONE;
-
-
- first = outline->points;
- for ( i = 0; i < outline->n_contours; i++, first = last + 1 )
- {
- FT_Vector* point;
- FT_Vector* xmin_point;
- FT_Pos xmin;
-
-
- last = outline->points + outline->contours[i];
-
- /* skip degenerate contours */
- if ( last < first + 2 )
- continue;
-
- if ( ft_contour_enclosed( outline, i ) )
- continue;
-
- xmin = first->x;
- xmin_point = first;
-
- for ( point = first + 1; point <= last; point++ )
- {
- if ( point->x < xmin )
- {
- xmin = point->x;
- xmin_point = point;
- }
- }
-
- /* check the orientation of the contour */
- {
- FT_Vector* prev;
- FT_Vector* next;
- FT_Orientation o;
-
-
- prev = ( xmin_point == first ) ? last : xmin_point - 1;
- next = ( xmin_point == last ) ? first : xmin_point + 1;
-
- if ( FT_Atan2( prev->x - xmin_point->x, prev->y - xmin_point->y ) >
- FT_Atan2( next->x - xmin_point->x, next->y - xmin_point->y ) )
- o = FT_ORIENTATION_POSTSCRIPT;
- else
- o = FT_ORIENTATION_TRUETYPE;
-
- if ( orient == FT_ORIENTATION_NONE )
- orient = o;
- else if ( orient != o )
- return FT_ORIENTATION_NONE;
- }
- }
-
- return orient;
- }
-
-#endif /* 0 */
-
-
- /* documentation is in ftoutln.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Outline_Embolden( FT_Outline* outline,
- FT_Pos strength )
- {
- return FT_Outline_EmboldenXY( outline, strength, strength );
- }
-
-
- /* documentation is in ftoutln.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Outline_EmboldenXY( FT_Outline* outline,
- FT_Pos xstrength,
- FT_Pos ystrength )
- {
- FT_Vector* points;
- FT_Int c, first, last;
- FT_Int orientation;
-
-
- if ( !outline )
- return FT_THROW( Invalid_Outline );
-
- xstrength /= 2;
- ystrength /= 2;
- if ( xstrength == 0 && ystrength == 0 )
- return FT_Err_Ok;
-
- orientation = FT_Outline_Get_Orientation( outline );
- if ( orientation == FT_ORIENTATION_NONE )
- {
- if ( outline->n_contours )
- return FT_THROW( Invalid_Argument );
- else
- return FT_Err_Ok;
- }
-
- points = outline->points;
-
- first = 0;
- for ( c = 0; c < outline->n_contours; c++ )
- {
- FT_Vector in, out, anchor, shift;
- FT_Fixed l_in, l_out, l_anchor = 0, l, q, d;
- FT_Int i, j, k;
-
-
- l_in = 0;
- last = outline->contours[c];
-
- /* Counter j cycles though the points; counter i advances only */
- /* when points are moved; anchor k marks the first moved point. */
- for ( i = last, j = first, k = -1;
- j != i && i != k;
- j = j < last ? j + 1 : first )
- {
- if ( j != k )
- {
- out.x = points[j].x - points[i].x;
- out.y = points[j].y - points[i].y;
- l_out = (FT_Fixed)FT_Vector_NormLen( &out );
-
- if ( l_out == 0 )
- continue;
- }
- else
- {
- out = anchor;
- l_out = l_anchor;
- }
-
- if ( l_in != 0 )
- {
- if ( k < 0 )
- {
- k = i;
- anchor = in;
- l_anchor = l_in;
- }
-
- d = FT_MulFix( in.x, out.x ) + FT_MulFix( in.y, out.y );
-
- /* shift only if turn is less than ~160 degrees */
- if ( d > -0xF000L )
- {
- d = d + 0x10000L;
-
- /* shift components along lateral bisector in proper orientation */
- shift.x = in.y + out.y;
- shift.y = in.x + out.x;
-
- if ( orientation == FT_ORIENTATION_TRUETYPE )
- shift.x = -shift.x;
- else
- shift.y = -shift.y;
-
- /* restrict shift magnitude to better handle collapsing segments */
- q = FT_MulFix( out.x, in.y ) - FT_MulFix( out.y, in.x );
- if ( orientation == FT_ORIENTATION_TRUETYPE )
- q = -q;
-
- l = FT_MIN( l_in, l_out );
-
- /* non-strict inequalities avoid divide-by-zero when q == l == 0 */
- if ( FT_MulFix( xstrength, q ) <= FT_MulFix( l, d ) )
- shift.x = FT_MulDiv( shift.x, xstrength, d );
- else
- shift.x = FT_MulDiv( shift.x, l, q );
-
-
- if ( FT_MulFix( ystrength, q ) <= FT_MulFix( l, d ) )
- shift.y = FT_MulDiv( shift.y, ystrength, d );
- else
- shift.y = FT_MulDiv( shift.y, l, q );
- }
- else
- shift.x = shift.y = 0;
-
- for ( ;
- i != j;
- i = i < last ? i + 1 : first )
- {
- points[i].x += xstrength + shift.x;
- points[i].y += ystrength + shift.y;
- }
- }
- else
- i = j;
-
- in = out;
- l_in = l_out;
- }
-
- first = last + 1;
- }
-
- return FT_Err_Ok;
- }
-
-
- /* documentation is in ftoutln.h */
-
- FT_EXPORT_DEF( FT_Orientation )
- FT_Outline_Get_Orientation( FT_Outline* outline )
- {
- FT_BBox cbox;
- FT_Int xshift, yshift;
- FT_Vector* points;
- FT_Vector v_prev, v_cur;
- FT_Int c, n, first;
- FT_Pos area = 0;
-
-
- if ( !outline || outline->n_points <= 0 )
- return FT_ORIENTATION_TRUETYPE;
-
- /* We use the nonzero winding rule to find the orientation. */
- /* Since glyph outlines behave much more `regular' than arbitrary */
- /* cubic or quadratic curves, this test deals with the polygon */
- /* only that is spanned up by the control points. */
-
- FT_Outline_Get_CBox( outline, &cbox );
-
- /* Handle collapsed outlines to avoid undefined FT_MSB. */
- if ( cbox.xMin == cbox.xMax || cbox.yMin == cbox.yMax )
- return FT_ORIENTATION_NONE;
-
- xshift = FT_MSB( (FT_UInt32)( FT_ABS( cbox.xMax ) |
- FT_ABS( cbox.xMin ) ) ) - 14;
- xshift = FT_MAX( xshift, 0 );
-
- yshift = FT_MSB( (FT_UInt32)( cbox.yMax - cbox.yMin ) ) - 14;
- yshift = FT_MAX( yshift, 0 );
-
- points = outline->points;
-
- first = 0;
- for ( c = 0; c < outline->n_contours; c++ )
- {
- FT_Int last = outline->contours[c];
-
-
- v_prev = points[last];
-
- for ( n = first; n <= last; n++ )
- {
- v_cur = points[n];
- area += ( ( v_cur.y - v_prev.y ) >> yshift ) *
- ( ( v_cur.x + v_prev.x ) >> xshift );
- v_prev = v_cur;
- }
-
- first = last + 1;
- }
-
- if ( area > 0 )
- return FT_ORIENTATION_POSTSCRIPT;
- else if ( area < 0 )
- return FT_ORIENTATION_TRUETYPE;
- else
- return FT_ORIENTATION_NONE;
- }
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/base/ftpatent.c b/chromium/third_party/pdfium/third_party/freetype/src/base/ftpatent.c
deleted file mode 100644
index bf2b0855c97..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/base/ftpatent.c
+++ /dev/null
@@ -1,287 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftpatent.c */
-/* */
-/* FreeType API for checking patented TrueType bytecode instructions */
-/* (body). */
-/* */
-/* Copyright 2007-2015 by */
-/* David Turner. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_TRUETYPE_TAGS_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_STREAM_H
-#include FT_SERVICE_SFNT_H
-#include FT_SERVICE_TRUETYPE_GLYF_H
-
-
- static FT_Bool
- _tt_check_patents_in_range( FT_Stream stream,
- FT_ULong size )
- {
- FT_Bool result = FALSE;
- FT_Error error;
- FT_Bytes p, end;
-
-
- if ( FT_FRAME_ENTER( size ) )
- return 0;
-
- p = stream->cursor;
- end = p + size;
-
- while ( p < end )
- {
- switch (p[0])
- {
- case 0x06: /* SPvTL // */
- case 0x07: /* SPvTL + */
- case 0x08: /* SFvTL // */
- case 0x09: /* SFvTL + */
- case 0x0A: /* SPvFS */
- case 0x0B: /* SFvFS */
- result = TRUE;
- goto Exit;
-
- case 0x40:
- if ( p + 1 >= end )
- goto Exit;
-
- p += p[1] + 2;
- break;
-
- case 0x41:
- if ( p + 1 >= end )
- goto Exit;
-
- p += p[1] * 2 + 2;
- break;
-
- case 0x71: /* DELTAP2 */
- case 0x72: /* DELTAP3 */
- case 0x73: /* DELTAC0 */
- case 0x74: /* DELTAC1 */
- case 0x75: /* DELTAC2 */
- result = TRUE;
- goto Exit;
-
- case 0xB0:
- case 0xB1:
- case 0xB2:
- case 0xB3:
- case 0xB4:
- case 0xB5:
- case 0xB6:
- case 0xB7:
- p += ( p[0] - 0xB0 ) + 2;
- break;
-
- case 0xB8:
- case 0xB9:
- case 0xBA:
- case 0xBB:
- case 0xBC:
- case 0xBD:
- case 0xBE:
- case 0xBF:
- p += ( p[0] - 0xB8 ) * 2 + 3;
- break;
-
- default:
- p += 1;
- break;
- }
- }
-
- Exit:
- FT_UNUSED( error );
- FT_FRAME_EXIT();
- return result;
- }
-
-
- static FT_Bool
- _tt_check_patents_in_table( FT_Face face,
- FT_ULong tag )
- {
- FT_Stream stream = face->stream;
- FT_Error error = FT_Err_Ok;
- FT_Service_SFNT_Table service;
- FT_Bool result = FALSE;
-
-
- FT_FACE_FIND_SERVICE( face, service, SFNT_TABLE );
-
- if ( service )
- {
- FT_UInt i = 0;
- FT_ULong tag_i = 0, offset_i = 0, length_i = 0;
-
-
- for ( i = 0; !error && tag_i != tag ; i++ )
- error = service->table_info( face, i,
- &tag_i, &offset_i, &length_i );
-
- if ( error ||
- FT_STREAM_SEEK( offset_i ) )
- goto Exit;
-
- result = _tt_check_patents_in_range( stream, length_i );
- }
-
- Exit:
- return result;
- }
-
-
- static FT_Bool
- _tt_face_check_patents( FT_Face face )
- {
- FT_Stream stream = face->stream;
- FT_UInt gindex;
- FT_Error error;
- FT_Bool result;
-
- FT_Service_TTGlyf service;
-
-
- result = _tt_check_patents_in_table( face, TTAG_fpgm );
- if ( result )
- goto Exit;
-
- result = _tt_check_patents_in_table( face, TTAG_prep );
- if ( result )
- goto Exit;
-
- FT_FACE_FIND_SERVICE( face, service, TT_GLYF );
- if ( service == NULL )
- goto Exit;
-
- for ( gindex = 0; gindex < (FT_UInt)face->num_glyphs; gindex++ )
- {
- FT_ULong offset, num_ins, size;
- FT_Int num_contours;
-
-
- offset = service->get_location( face, gindex, &size );
- if ( size == 0 )
- continue;
-
- if ( FT_STREAM_SEEK( offset ) ||
- FT_READ_SHORT( num_contours ) )
- continue;
-
- if ( num_contours >= 0 ) /* simple glyph */
- {
- if ( FT_STREAM_SKIP( 8 + num_contours * 2 ) )
- continue;
- }
- else /* compound glyph */
- {
- FT_Bool has_instr = 0;
-
-
- if ( FT_STREAM_SKIP( 8 ) )
- continue;
-
- /* now read each component */
- for (;;)
- {
- FT_UInt flags, toskip;
-
-
- if( FT_READ_USHORT( flags ) )
- break;
-
- toskip = 2 + 1 + 1;
-
- if ( ( flags & ( 1 << 0 ) ) != 0 ) /* ARGS_ARE_WORDS */
- toskip += 2;
-
- if ( ( flags & ( 1 << 3 ) ) != 0 ) /* WE_HAVE_A_SCALE */
- toskip += 2;
- else if ( ( flags & ( 1 << 6 ) ) != 0 ) /* WE_HAVE_X_Y_SCALE */
- toskip += 4;
- else if ( ( flags & ( 1 << 7 ) ) != 0 ) /* WE_HAVE_A_2x2 */
- toskip += 8;
-
- if ( ( flags & ( 1 << 8 ) ) != 0 ) /* WE_HAVE_INSTRUCTIONS */
- has_instr = 1;
-
- if ( FT_STREAM_SKIP( toskip ) )
- goto NextGlyph;
-
- if ( ( flags & ( 1 << 5 ) ) == 0 ) /* MORE_COMPONENTS */
- break;
- }
-
- if ( !has_instr )
- goto NextGlyph;
- }
-
- if ( FT_READ_USHORT( num_ins ) )
- continue;
-
- result = _tt_check_patents_in_range( stream, num_ins );
- if ( result )
- goto Exit;
-
- NextGlyph:
- ;
- }
-
- Exit:
- return result;
- }
-
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( FT_Bool )
- FT_Face_CheckTrueTypePatents( FT_Face face )
- {
- FT_Bool result = FALSE;
-
-
- if ( face && FT_IS_SFNT( face ) )
- result = _tt_face_check_patents( face );
-
- return result;
- }
-
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( FT_Bool )
- FT_Face_SetUnpatentedHinting( FT_Face face,
- FT_Bool value )
- {
- FT_Bool result = FALSE;
-
-
-#if defined( TT_CONFIG_OPTION_UNPATENTED_HINTING ) && \
- !defined( TT_CONFIG_OPTION_BYTECODE_INTERPRETER )
- if ( face && FT_IS_SFNT( face ) )
- {
- result = !face->internal->ignore_unpatented_hinter;
- face->internal->ignore_unpatented_hinter = !value;
- }
-#else
- FT_UNUSED( face );
- FT_UNUSED( value );
-#endif
-
- return result;
- }
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/base/ftpfr.c b/chromium/third_party/pdfium/third_party/freetype/src/base/ftpfr.c
deleted file mode 100644
index 39f089e3e9d..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/base/ftpfr.c
+++ /dev/null
@@ -1,153 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftpfr.c */
-/* */
-/* FreeType API for accessing PFR-specific data (body). */
-/* */
-/* Copyright 2002-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-
-#include FT_INTERNAL_OBJECTS_H
-#include FT_SERVICE_PFR_H
-
-
- /* check the format */
- static FT_Service_PfrMetrics
- ft_pfr_check( FT_Face face )
- {
- FT_Service_PfrMetrics service = NULL;
-
-
- if ( face )
- FT_FACE_LOOKUP_SERVICE( face, service, PFR_METRICS );
-
- return service;
- }
-
-
- /* documentation is in ftpfr.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Get_PFR_Metrics( FT_Face face,
- FT_UInt *aoutline_resolution,
- FT_UInt *ametrics_resolution,
- FT_Fixed *ametrics_x_scale,
- FT_Fixed *ametrics_y_scale )
- {
- FT_Error error = FT_Err_Ok;
- FT_Service_PfrMetrics service;
-
-
- if ( !face )
- return FT_THROW( Invalid_Face_Handle );
-
- service = ft_pfr_check( face );
- if ( service )
- {
- error = service->get_metrics( face,
- aoutline_resolution,
- ametrics_resolution,
- ametrics_x_scale,
- ametrics_y_scale );
- }
- else
- {
- FT_Fixed x_scale, y_scale;
-
-
- /* this is not a PFR font */
- if ( aoutline_resolution )
- *aoutline_resolution = face->units_per_EM;
-
- if ( ametrics_resolution )
- *ametrics_resolution = face->units_per_EM;
-
- x_scale = y_scale = 0x10000L;
- if ( face->size )
- {
- x_scale = face->size->metrics.x_scale;
- y_scale = face->size->metrics.y_scale;
- }
-
- if ( ametrics_x_scale )
- *ametrics_x_scale = x_scale;
-
- if ( ametrics_y_scale )
- *ametrics_y_scale = y_scale;
-
- error = FT_THROW( Unknown_File_Format );
- }
-
- return error;
- }
-
-
- /* documentation is in ftpfr.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Get_PFR_Kerning( FT_Face face,
- FT_UInt left,
- FT_UInt right,
- FT_Vector *avector )
- {
- FT_Error error;
- FT_Service_PfrMetrics service;
-
-
- if ( !face )
- return FT_THROW( Invalid_Face_Handle );
-
- if ( !avector )
- return FT_THROW( Invalid_Argument );
-
- service = ft_pfr_check( face );
- if ( service )
- error = service->get_kerning( face, left, right, avector );
- else
- error = FT_Get_Kerning( face, left, right,
- FT_KERNING_UNSCALED, avector );
-
- return error;
- }
-
-
- /* documentation is in ftpfr.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Get_PFR_Advance( FT_Face face,
- FT_UInt gindex,
- FT_Pos *aadvance )
- {
- FT_Error error;
- FT_Service_PfrMetrics service;
-
-
- if ( !face )
- return FT_THROW( Invalid_Face_Handle );
-
- if ( !aadvance )
- return FT_THROW( Invalid_Argument );
-
- service = ft_pfr_check( face );
- if ( service )
- error = service->get_advance( face, gindex, aadvance );
- else
- /* XXX: TODO: PROVIDE ADVANCE-LOADING METHOD TO ALL FONT DRIVERS */
- error = FT_THROW( Invalid_Argument );
-
- return error;
- }
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/base/ftpic.c b/chromium/third_party/pdfium/third_party/freetype/src/base/ftpic.c
deleted file mode 100644
index 6c4b1cd4e62..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/base/ftpic.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftpic.c */
-/* */
-/* The FreeType position independent code services (body). */
-/* */
-/* Copyright 2009-2015 by */
-/* Oran Agra and Mickey Gabel. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_INTERNAL_OBJECTS_H
-#include "basepic.h"
-
-#ifdef FT_CONFIG_OPTION_PIC
-
- /* documentation is in ftpic.h */
-
- FT_BASE_DEF( FT_Error )
- ft_pic_container_init( FT_Library library )
- {
- FT_PIC_Container* pic_container = &library->pic_container;
- FT_Error error;
-
-
- FT_MEM_SET( pic_container, 0, sizeof ( *pic_container ) );
-
- error = ft_base_pic_init( library );
- if ( error )
- return error;
-
- return FT_Err_Ok;
- }
-
-
- /* Destroy the contents of the container. */
- FT_BASE_DEF( void )
- ft_pic_container_destroy( FT_Library library )
- {
- ft_base_pic_free( library );
- }
-
-#endif /* FT_CONFIG_OPTION_PIC */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/base/ftrfork.c b/chromium/third_party/pdfium/third_party/freetype/src/base/ftrfork.c
deleted file mode 100644
index c30c76678e6..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/base/ftrfork.c
+++ /dev/null
@@ -1,880 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftrfork.c */
-/* */
-/* Embedded resource forks accessor (body). */
-/* */
-/* Copyright 2004-2015 by */
-/* Masatake YAMATO and Redhat K.K. */
-/* */
-/* FT_Raccess_Get_HeaderInfo() and raccess_guess_darwin_hfsplus() are */
-/* derived from ftobjs.c. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-/***************************************************************************/
-/* Development of the code in this file is support of */
-/* Information-technology Promotion Agency, Japan. */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_RFORK_H
-#include "basepic.h"
-#include "ftbase.h"
-
-#undef FT_COMPONENT
-#define FT_COMPONENT trace_raccess
-
-
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
- /**** ****/
- /**** ****/
- /**** Resource fork directory access ****/
- /**** ****/
- /**** ****/
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
-
- FT_BASE_DEF( FT_Error )
- FT_Raccess_Get_HeaderInfo( FT_Library library,
- FT_Stream stream,
- FT_Long rfork_offset,
- FT_Long *map_offset,
- FT_Long *rdata_pos )
- {
- FT_Error error;
- unsigned char head[16], head2[16];
- FT_Long map_pos, rdata_len;
- int allzeros, allmatch, i;
- FT_Long type_list;
-
- FT_UNUSED( library );
-
-
- error = FT_Stream_Seek( stream, (FT_ULong)rfork_offset );
- if ( error )
- return error;
-
- error = FT_Stream_Read( stream, (FT_Byte *)head, 16 );
- if ( error )
- return error;
-
- /* ensure positive values */
- if ( head[0] >= 0x80 || head[4] >= 0x80 || head[8] >= 0x80 )
- return FT_THROW( Unknown_File_Format );
-
- *rdata_pos = ( head[ 0] << 24 ) |
- ( head[ 1] << 16 ) |
- ( head[ 2] << 8 ) |
- head[ 3];
- map_pos = ( head[ 4] << 24 ) |
- ( head[ 5] << 16 ) |
- ( head[ 6] << 8 ) |
- head[ 7];
- rdata_len = ( head[ 8] << 24 ) |
- ( head[ 9] << 16 ) |
- ( head[10] << 8 ) |
- head[11];
-
- /* map_len = head[12] .. head[15] */
-
- if ( *rdata_pos != map_pos - rdata_len || map_pos == 0 )
- return FT_THROW( Unknown_File_Format );
-
- if ( FT_LONG_MAX - rfork_offset < *rdata_pos ||
- FT_LONG_MAX - rfork_offset < map_pos )
- return FT_THROW( Unknown_File_Format );
-
- *rdata_pos += rfork_offset;
- map_pos += rfork_offset;
-
- error = FT_Stream_Seek( stream, (FT_ULong)map_pos );
- if ( error )
- return error;
-
- head2[15] = (FT_Byte)( head[15] + 1 ); /* make it be different */
-
- error = FT_Stream_Read( stream, (FT_Byte*)head2, 16 );
- if ( error )
- return error;
-
- allzeros = 1;
- allmatch = 1;
- for ( i = 0; i < 16; ++i )
- {
- if ( head2[i] != 0 )
- allzeros = 0;
- if ( head2[i] != head[i] )
- allmatch = 0;
- }
- if ( !allzeros && !allmatch )
- return FT_THROW( Unknown_File_Format );
-
- /* If we have reached this point then it is probably a mac resource */
- /* file. Now, does it contain any interesting resources? */
- /* Skip handle to next resource map, the file resource number, and */
- /* attributes. */
- (void)FT_STREAM_SKIP( 4 /* skip handle to next resource map */
- + 2 /* skip file resource number */
- + 2 ); /* skip attributes */
-
- if ( FT_READ_USHORT( type_list ) )
- return error;
- if ( type_list == -1 )
- return FT_THROW( Unknown_File_Format );
-
- error = FT_Stream_Seek( stream, (FT_ULong)( map_pos + type_list ) );
- if ( error )
- return error;
-
- *map_offset = map_pos + type_list;
- return FT_Err_Ok;
- }
-
-
- static int
- ft_raccess_sort_ref_by_id( FT_RFork_Ref* a,
- FT_RFork_Ref* b )
- {
- if ( a->res_id < b->res_id )
- return -1;
- else if ( a->res_id > b->res_id )
- return 1;
- else
- return 0;
- }
-
-
- FT_BASE_DEF( FT_Error )
- FT_Raccess_Get_DataOffsets( FT_Library library,
- FT_Stream stream,
- FT_Long map_offset,
- FT_Long rdata_pos,
- FT_Long tag,
- FT_Bool sort_by_res_id,
- FT_Long **offsets,
- FT_Long *count )
- {
- FT_Error error;
- int i, j, cnt, subcnt;
- FT_Long tag_internal, rpos;
- FT_Memory memory = library->memory;
- FT_Long temp;
- FT_Long *offsets_internal = NULL;
- FT_RFork_Ref *ref = NULL;
-
-
- FT_TRACE3(( "\n" ));
- error = FT_Stream_Seek( stream, (FT_ULong)map_offset );
- if ( error )
- return error;
-
- if ( FT_READ_USHORT( cnt ) )
- return error;
- cnt++;
-
- for ( i = 0; i < cnt; ++i )
- {
- if ( FT_READ_LONG( tag_internal ) ||
- FT_READ_USHORT( subcnt ) ||
- FT_READ_USHORT( rpos ) )
- return error;
-
- FT_TRACE2(( "Resource tags: %c%c%c%c\n",
- (char)( 0xFF & ( tag_internal >> 24 ) ),
- (char)( 0xFF & ( tag_internal >> 16 ) ),
- (char)( 0xFF & ( tag_internal >> 8 ) ),
- (char)( 0xFF & ( tag_internal >> 0 ) ) ));
- FT_TRACE3(( " : subcount=%d, suboffset=0x%04x\n",
- subcnt, rpos ));
-
- if ( tag_internal == tag )
- {
- *count = subcnt + 1;
- rpos += map_offset;
-
- error = FT_Stream_Seek( stream, (FT_ULong)rpos );
- if ( error )
- return error;
-
- if ( FT_NEW_ARRAY( ref, *count ) )
- return error;
-
- for ( j = 0; j < *count; ++j )
- {
- if ( FT_READ_USHORT( ref[j].res_id ) )
- goto Exit;
- if ( FT_STREAM_SKIP( 2 ) ) /* resource name */
- goto Exit;
- if ( FT_READ_LONG( temp ) )
- goto Exit;
- if ( FT_STREAM_SKIP( 4 ) ) /* mbz */
- goto Exit;
-
- ref[j].offset = temp & 0xFFFFFFL;
- FT_TRACE3(( " [%d]:"
- " resource_id=0x%04x, offset=0x%08x\n",
- j, ref[j].res_id, ref[j].offset ));
- }
-
- if (sort_by_res_id)
- {
- ft_qsort( ref, (size_t)*count, sizeof ( FT_RFork_Ref ),
- ( int(*)(const void*, const void*) )
- ft_raccess_sort_ref_by_id );
-
- FT_TRACE3(( " -- sort resources by their ids --\n" ));
- for ( j = 0; j < *count; ++ j ) {
- FT_TRACE3(( " [%d]:"
- " resource_id=0x%04x, offset=0x%08x\n",
- j, ref[j].res_id, ref[j].offset ));
- }
- }
-
- if ( FT_NEW_ARRAY( offsets_internal, *count ) )
- goto Exit;
-
- /* XXX: duplicated reference ID,
- * gap between reference IDs are acceptable?
- * further investigation on Apple implementation is needed.
- */
- for ( j = 0; j < *count; ++j )
- offsets_internal[j] = rdata_pos + ref[j].offset;
-
- *offsets = offsets_internal;
- error = FT_Err_Ok;
-
- Exit:
- FT_FREE( ref );
- return error;
- }
- }
-
- return FT_THROW( Cannot_Open_Resource );
- }
-
-
-#ifdef FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK
-
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
- /**** ****/
- /**** ****/
- /**** Guessing functions ****/
- /**** ****/
- /**** When you add a new guessing function, ****/
- /**** update FT_RACCESS_N_RULES in ftrfork.h. ****/
- /**** ****/
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
-
- static FT_Error
- raccess_guess_apple_double( FT_Library library,
- FT_Stream stream,
- char *base_file_name,
- char **result_file_name,
- FT_Long *result_offset );
-
- static FT_Error
- raccess_guess_apple_single( FT_Library library,
- FT_Stream stream,
- char *base_file_name,
- char **result_file_name,
- FT_Long *result_offset );
-
- static FT_Error
- raccess_guess_darwin_ufs_export( FT_Library library,
- FT_Stream stream,
- char *base_file_name,
- char **result_file_name,
- FT_Long *result_offset );
-
- static FT_Error
- raccess_guess_darwin_newvfs( FT_Library library,
- FT_Stream stream,
- char *base_file_name,
- char **result_file_name,
- FT_Long *result_offset );
-
- static FT_Error
- raccess_guess_darwin_hfsplus( FT_Library library,
- FT_Stream stream,
- char *base_file_name,
- char **result_file_name,
- FT_Long *result_offset );
-
- static FT_Error
- raccess_guess_vfat( FT_Library library,
- FT_Stream stream,
- char *base_file_name,
- char **result_file_name,
- FT_Long *result_offset );
-
- static FT_Error
- raccess_guess_linux_cap( FT_Library library,
- FT_Stream stream,
- char *base_file_name,
- char **result_file_name,
- FT_Long *result_offset );
-
- static FT_Error
- raccess_guess_linux_double( FT_Library library,
- FT_Stream stream,
- char *base_file_name,
- char **result_file_name,
- FT_Long *result_offset );
-
- static FT_Error
- raccess_guess_linux_netatalk( FT_Library library,
- FT_Stream stream,
- char *base_file_name,
- char **result_file_name,
- FT_Long *result_offset );
-
-
- CONST_FT_RFORK_RULE_ARRAY_BEGIN(ft_raccess_guess_table,
- ft_raccess_guess_rec)
- CONST_FT_RFORK_RULE_ARRAY_ENTRY(apple_double, apple_double)
- CONST_FT_RFORK_RULE_ARRAY_ENTRY(apple_single, apple_single)
- CONST_FT_RFORK_RULE_ARRAY_ENTRY(darwin_ufs_export, darwin_ufs_export)
- CONST_FT_RFORK_RULE_ARRAY_ENTRY(darwin_newvfs, darwin_newvfs)
- CONST_FT_RFORK_RULE_ARRAY_ENTRY(darwin_hfsplus, darwin_hfsplus)
- CONST_FT_RFORK_RULE_ARRAY_ENTRY(vfat, vfat)
- CONST_FT_RFORK_RULE_ARRAY_ENTRY(linux_cap, linux_cap)
- CONST_FT_RFORK_RULE_ARRAY_ENTRY(linux_double, linux_double)
- CONST_FT_RFORK_RULE_ARRAY_ENTRY(linux_netatalk, linux_netatalk)
- CONST_FT_RFORK_RULE_ARRAY_END
-
-
- /*************************************************************************/
- /**** ****/
- /**** Helper functions ****/
- /**** ****/
- /*************************************************************************/
-
- static FT_Error
- raccess_guess_apple_generic( FT_Library library,
- FT_Stream stream,
- char *base_file_name,
- FT_Int32 magic,
- FT_Long *result_offset );
-
- static FT_Error
- raccess_guess_linux_double_from_file_name( FT_Library library,
- char * file_name,
- FT_Long *result_offset );
-
- static char *
- raccess_make_file_name( FT_Memory memory,
- const char *original_name,
- const char *insertion );
-
- FT_BASE_DEF( void )
- FT_Raccess_Guess( FT_Library library,
- FT_Stream stream,
- char* base_name,
- char **new_names,
- FT_Long *offsets,
- FT_Error *errors )
- {
- FT_Int i;
-
-
- for ( i = 0; i < FT_RACCESS_N_RULES; i++ )
- {
- new_names[i] = NULL;
- if ( NULL != stream )
- errors[i] = FT_Stream_Seek( stream, 0 );
- else
- errors[i] = FT_Err_Ok;
-
- if ( errors[i] )
- continue ;
-
- errors[i] = (FT_RACCESS_GUESS_TABLE_GET[i].func)( library,
- stream, base_name,
- &(new_names[i]),
- &(offsets[i]) );
- }
-
- return;
- }
-
-
-#ifndef FT_MACINTOSH
- static FT_RFork_Rule
- raccess_get_rule_type_from_rule_index( FT_Library library,
- FT_UInt rule_index )
- {
- FT_UNUSED( library );
-
- if ( rule_index >= FT_RACCESS_N_RULES )
- return FT_RFork_Rule_invalid;
-
- return FT_RACCESS_GUESS_TABLE_GET[rule_index].type;
- }
-
-
- /*
- * For this function, refer ftbase.h.
- */
- FT_LOCAL_DEF( FT_Bool )
- ft_raccess_rule_by_darwin_vfs( FT_Library library,
- FT_UInt rule_index )
- {
- switch( raccess_get_rule_type_from_rule_index( library, rule_index ) )
- {
- case FT_RFork_Rule_darwin_newvfs:
- case FT_RFork_Rule_darwin_hfsplus:
- return TRUE;
-
- default:
- return FALSE;
- }
- }
-#endif
-
-
- static FT_Error
- raccess_guess_apple_double( FT_Library library,
- FT_Stream stream,
- char *base_file_name,
- char **result_file_name,
- FT_Long *result_offset )
- {
- FT_Int32 magic = ( 0x00 << 24 ) |
- ( 0x05 << 16 ) |
- ( 0x16 << 8 ) |
- 0x07;
-
-
- *result_file_name = NULL;
- if ( NULL == stream )
- return FT_THROW( Cannot_Open_Stream );
-
- return raccess_guess_apple_generic( library, stream, base_file_name,
- magic, result_offset );
- }
-
-
- static FT_Error
- raccess_guess_apple_single( FT_Library library,
- FT_Stream stream,
- char *base_file_name,
- char **result_file_name,
- FT_Long *result_offset )
- {
- FT_Int32 magic = ( 0x00 << 24 ) |
- ( 0x05 << 16 ) |
- ( 0x16 << 8 ) |
- 0x00;
-
-
- *result_file_name = NULL;
- if ( NULL == stream )
- return FT_THROW( Cannot_Open_Stream );
-
- return raccess_guess_apple_generic( library, stream, base_file_name,
- magic, result_offset );
- }
-
-
- static FT_Error
- raccess_guess_darwin_ufs_export( FT_Library library,
- FT_Stream stream,
- char *base_file_name,
- char **result_file_name,
- FT_Long *result_offset )
- {
- char* newpath;
- FT_Error error;
- FT_Memory memory;
-
- FT_UNUSED( stream );
-
-
- memory = library->memory;
- newpath = raccess_make_file_name( memory, base_file_name, "._" );
- if ( !newpath )
- return FT_THROW( Out_Of_Memory );
-
- error = raccess_guess_linux_double_from_file_name( library, newpath,
- result_offset );
- if ( !error )
- *result_file_name = newpath;
- else
- FT_FREE( newpath );
-
- return error;
- }
-
-
- static FT_Error
- raccess_guess_darwin_hfsplus( FT_Library library,
- FT_Stream stream,
- char *base_file_name,
- char **result_file_name,
- FT_Long *result_offset )
- {
- /*
- Only meaningful on systems with hfs+ drivers (or Macs).
- */
- FT_Error error;
- char* newpath = NULL;
- FT_Memory memory;
- FT_Long base_file_len = (FT_Long)ft_strlen( base_file_name );
-
- FT_UNUSED( stream );
-
-
- memory = library->memory;
-
- if ( base_file_len + 6 > FT_INT_MAX )
- return FT_THROW( Array_Too_Large );
-
- if ( FT_ALLOC( newpath, base_file_len + 6 ) )
- return error;
-
- FT_MEM_COPY( newpath, base_file_name, base_file_len );
- FT_MEM_COPY( newpath + base_file_len, "/rsrc", 6 );
-
- *result_file_name = newpath;
- *result_offset = 0;
-
- return FT_Err_Ok;
- }
-
-
- static FT_Error
- raccess_guess_darwin_newvfs( FT_Library library,
- FT_Stream stream,
- char *base_file_name,
- char **result_file_name,
- FT_Long *result_offset )
- {
- /*
- Only meaningful on systems with Mac OS X (> 10.1).
- */
- FT_Error error;
- char* newpath = NULL;
- FT_Memory memory;
- FT_Long base_file_len = (FT_Long)ft_strlen( base_file_name );
-
- FT_UNUSED( stream );
-
-
- memory = library->memory;
-
- if ( base_file_len + 18 > FT_INT_MAX )
- return FT_THROW( Array_Too_Large );
-
- if ( FT_ALLOC( newpath, base_file_len + 18 ) )
- return error;
-
- FT_MEM_COPY( newpath, base_file_name, base_file_len );
- FT_MEM_COPY( newpath + base_file_len, "/..namedfork/rsrc", 18 );
-
- *result_file_name = newpath;
- *result_offset = 0;
-
- return FT_Err_Ok;
- }
-
-
- static FT_Error
- raccess_guess_vfat( FT_Library library,
- FT_Stream stream,
- char *base_file_name,
- char **result_file_name,
- FT_Long *result_offset )
- {
- char* newpath;
- FT_Memory memory;
-
- FT_UNUSED( stream );
-
-
- memory = library->memory;
-
- newpath = raccess_make_file_name( memory, base_file_name,
- "resource.frk/" );
- if ( !newpath )
- return FT_THROW( Out_Of_Memory );
-
- *result_file_name = newpath;
- *result_offset = 0;
-
- return FT_Err_Ok;
- }
-
-
- static FT_Error
- raccess_guess_linux_cap( FT_Library library,
- FT_Stream stream,
- char *base_file_name,
- char **result_file_name,
- FT_Long *result_offset )
- {
- char* newpath;
- FT_Memory memory;
-
- FT_UNUSED( stream );
-
-
- memory = library->memory;
-
- newpath = raccess_make_file_name( memory, base_file_name, ".resource/" );
- if ( !newpath )
- return FT_THROW( Out_Of_Memory );
-
- *result_file_name = newpath;
- *result_offset = 0;
-
- return FT_Err_Ok;
- }
-
-
- static FT_Error
- raccess_guess_linux_double( FT_Library library,
- FT_Stream stream,
- char *base_file_name,
- char **result_file_name,
- FT_Long *result_offset )
- {
- char* newpath;
- FT_Error error;
- FT_Memory memory;
-
- FT_UNUSED( stream );
-
-
- memory = library->memory;
-
- newpath = raccess_make_file_name( memory, base_file_name, "%" );
- if ( !newpath )
- return FT_THROW( Out_Of_Memory );
-
- error = raccess_guess_linux_double_from_file_name( library, newpath,
- result_offset );
- if ( !error )
- *result_file_name = newpath;
- else
- FT_FREE( newpath );
-
- return error;
- }
-
-
- static FT_Error
- raccess_guess_linux_netatalk( FT_Library library,
- FT_Stream stream,
- char *base_file_name,
- char **result_file_name,
- FT_Long *result_offset )
- {
- char* newpath;
- FT_Error error;
- FT_Memory memory;
-
- FT_UNUSED( stream );
-
-
- memory = library->memory;
-
- newpath = raccess_make_file_name( memory, base_file_name,
- ".AppleDouble/" );
- if ( !newpath )
- return FT_THROW( Out_Of_Memory );
-
- error = raccess_guess_linux_double_from_file_name( library, newpath,
- result_offset );
- if ( !error )
- *result_file_name = newpath;
- else
- FT_FREE( newpath );
-
- return error;
- }
-
-
- static FT_Error
- raccess_guess_apple_generic( FT_Library library,
- FT_Stream stream,
- char *base_file_name,
- FT_Int32 magic,
- FT_Long *result_offset )
- {
- FT_Int32 magic_from_stream;
- FT_Error error;
- FT_Int32 version_number = 0;
- FT_UShort n_of_entries;
-
- int i;
- FT_Int32 entry_id, entry_offset, entry_length = 0;
-
- const FT_Int32 resource_fork_entry_id = 0x2;
-
- FT_UNUSED( library );
- FT_UNUSED( base_file_name );
- FT_UNUSED( version_number );
- FT_UNUSED( entry_length );
-
-
- if ( FT_READ_LONG( magic_from_stream ) )
- return error;
- if ( magic_from_stream != magic )
- return FT_THROW( Unknown_File_Format );
-
- if ( FT_READ_LONG( version_number ) )
- return error;
-
- /* filler */
- error = FT_Stream_Skip( stream, 16 );
- if ( error )
- return error;
-
- if ( FT_READ_USHORT( n_of_entries ) )
- return error;
- if ( n_of_entries == 0 )
- return FT_THROW( Unknown_File_Format );
-
- for ( i = 0; i < n_of_entries; i++ )
- {
- if ( FT_READ_LONG( entry_id ) )
- return error;
- if ( entry_id == resource_fork_entry_id )
- {
- if ( FT_READ_LONG( entry_offset ) ||
- FT_READ_LONG( entry_length ) )
- continue;
- *result_offset = entry_offset;
-
- return FT_Err_Ok;
- }
- else
- {
- error = FT_Stream_Skip( stream, 4 + 4 ); /* offset + length */
- if ( error )
- return error;
- }
- }
-
- return FT_THROW( Unknown_File_Format );
- }
-
-
- static FT_Error
- raccess_guess_linux_double_from_file_name( FT_Library library,
- char *file_name,
- FT_Long *result_offset )
- {
- FT_Open_Args args2;
- FT_Stream stream2;
- char * nouse = NULL;
- FT_Error error;
-
-
- args2.flags = FT_OPEN_PATHNAME;
- args2.pathname = file_name;
- error = FT_Stream_New( library, &args2, &stream2 );
- if ( error )
- return error;
-
- error = raccess_guess_apple_double( library, stream2, file_name,
- &nouse, result_offset );
-
- FT_Stream_Free( stream2, 0 );
-
- return error;
- }
-
-
- static char*
- raccess_make_file_name( FT_Memory memory,
- const char *original_name,
- const char *insertion )
- {
- char* new_name = NULL;
- const char* tmp;
- const char* slash;
- size_t new_length;
- FT_Error error = FT_Err_Ok;
-
- FT_UNUSED( error );
-
-
- new_length = ft_strlen( original_name ) + ft_strlen( insertion );
- if ( FT_ALLOC( new_name, new_length + 1 ) )
- return NULL;
-
- tmp = ft_strrchr( original_name, '/' );
- if ( tmp )
- {
- ft_strncpy( new_name,
- original_name,
- (size_t)( tmp - original_name + 1 ) );
- new_name[tmp - original_name + 1] = '\0';
- slash = tmp + 1;
- }
- else
- {
- slash = original_name;
- new_name[0] = '\0';
- }
-
- ft_strcat( new_name, insertion );
- ft_strcat( new_name, slash );
-
- return new_name;
- }
-
-
-#else /* !FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK */
-
-
- /*************************************************************************/
- /* Dummy function; just sets errors */
- /*************************************************************************/
-
- FT_BASE_DEF( void )
- FT_Raccess_Guess( FT_Library library,
- FT_Stream stream,
- char *base_name,
- char **new_names,
- FT_Long *offsets,
- FT_Error *errors )
- {
- FT_Int i;
-
- FT_UNUSED( library );
- FT_UNUSED( stream );
- FT_UNUSED( base_name );
-
-
- for ( i = 0; i < FT_RACCESS_N_RULES; i++ )
- {
- new_names[i] = NULL;
- offsets[i] = 0;
- errors[i] = FT_ERR( Unimplemented_Feature );
- }
- }
-
-
-#endif /* !FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/base/ftsnames.c b/chromium/third_party/pdfium/third_party/freetype/src/base/ftsnames.c
deleted file mode 100644
index 80304e5c859..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/base/ftsnames.c
+++ /dev/null
@@ -1,94 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftsnames.c */
-/* */
-/* Simple interface to access SFNT name tables (which are used */
-/* to hold font names, copyright info, notices, etc.) (body). */
-/* */
-/* This is _not_ used to retrieve glyph names! */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_SFNT_NAMES_H
-#include FT_INTERNAL_TRUETYPE_TYPES_H
-#include FT_INTERNAL_STREAM_H
-
-
-#ifdef TT_CONFIG_OPTION_SFNT_NAMES
-
-
- /* documentation is in ftsnames.h */
-
- FT_EXPORT_DEF( FT_UInt )
- FT_Get_Sfnt_Name_Count( FT_Face face )
- {
- return ( face && FT_IS_SFNT( face ) ) ? ((TT_Face)face)->num_names : 0;
- }
-
-
- /* documentation is in ftsnames.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Get_Sfnt_Name( FT_Face face,
- FT_UInt idx,
- FT_SfntName *aname )
- {
- FT_Error error = FT_ERR( Invalid_Argument );
-
-
- if ( aname && face && FT_IS_SFNT( face ) )
- {
- TT_Face ttface = (TT_Face)face;
-
-
- if ( idx < (FT_UInt)ttface->num_names )
- {
- TT_NameEntryRec* entry = ttface->name_table.names + idx;
-
-
- /* load name on demand */
- if ( entry->stringLength > 0 && entry->string == NULL )
- {
- FT_Memory memory = face->memory;
- FT_Stream stream = face->stream;
-
-
- if ( FT_NEW_ARRAY ( entry->string, entry->stringLength ) ||
- FT_STREAM_SEEK( entry->stringOffset ) ||
- FT_STREAM_READ( entry->string, entry->stringLength ) )
- {
- FT_FREE( entry->string );
- entry->stringLength = 0;
- }
- }
-
- aname->platform_id = entry->platformID;
- aname->encoding_id = entry->encodingID;
- aname->language_id = entry->languageID;
- aname->name_id = entry->nameID;
- aname->string = (FT_Byte*)entry->string;
- aname->string_len = entry->stringLength;
-
- error = FT_Err_Ok;
- }
- }
-
- return error;
- }
-
-
-#endif /* TT_CONFIG_OPTION_SFNT_NAMES */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/base/ftstream.c b/chromium/third_party/pdfium/third_party/freetype/src/base/ftstream.c
deleted file mode 100644
index b68f3f82d27..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/base/ftstream.c
+++ /dev/null
@@ -1,860 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftstream.c */
-/* */
-/* I/O stream support (body). */
-/* */
-/* Copyright 2000-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_DEBUG_H
-
-
- /*************************************************************************/
- /* */
- /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
- /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
- /* messages during execution. */
- /* */
-#undef FT_COMPONENT
-#define FT_COMPONENT trace_stream
-
-
- FT_BASE_DEF( void )
- FT_Stream_OpenMemory( FT_Stream stream,
- const FT_Byte* base,
- FT_ULong size )
- {
- stream->base = (FT_Byte*) base;
- stream->size = size;
- stream->pos = 0;
- stream->cursor = NULL;
- stream->read = NULL;
- stream->close = NULL;
- }
-
-
- FT_BASE_DEF( void )
- FT_Stream_Close( FT_Stream stream )
- {
- if ( stream && stream->close )
- stream->close( stream );
- }
-
-
- FT_BASE_DEF( FT_Error )
- FT_Stream_Seek( FT_Stream stream,
- FT_ULong pos )
- {
- FT_Error error = FT_Err_Ok;
-
-
- if ( stream->read )
- {
- if ( stream->read( stream, pos, 0, 0 ) )
- {
- FT_ERROR(( "FT_Stream_Seek:"
- " invalid i/o; pos = 0x%lx, size = 0x%lx\n",
- pos, stream->size ));
-
- error = FT_THROW( Invalid_Stream_Operation );
- }
- }
- /* note that seeking to the first position after the file is valid */
- else if ( pos > stream->size )
- {
- FT_ERROR(( "FT_Stream_Seek:"
- " invalid i/o; pos = 0x%lx, size = 0x%lx\n",
- pos, stream->size ));
-
- error = FT_THROW( Invalid_Stream_Operation );
- }
-
- if ( !error )
- stream->pos = pos;
-
- return error;
- }
-
-
- FT_BASE_DEF( FT_Error )
- FT_Stream_Skip( FT_Stream stream,
- FT_Long distance )
- {
- if ( distance < 0 )
- return FT_THROW( Invalid_Stream_Operation );
-
- return FT_Stream_Seek( stream, stream->pos + (FT_ULong)distance );
- }
-
-
- FT_BASE_DEF( FT_ULong )
- FT_Stream_Pos( FT_Stream stream )
- {
- return stream->pos;
- }
-
-
- FT_BASE_DEF( FT_Error )
- FT_Stream_Read( FT_Stream stream,
- FT_Byte* buffer,
- FT_ULong count )
- {
- return FT_Stream_ReadAt( stream, stream->pos, buffer, count );
- }
-
-
- FT_BASE_DEF( FT_Error )
- FT_Stream_ReadAt( FT_Stream stream,
- FT_ULong pos,
- FT_Byte* buffer,
- FT_ULong count )
- {
- FT_Error error = FT_Err_Ok;
- FT_ULong read_bytes;
-
-
- if ( pos >= stream->size )
- {
- FT_ERROR(( "FT_Stream_ReadAt:"
- " invalid i/o; pos = 0x%lx, size = 0x%lx\n",
- pos, stream->size ));
-
- return FT_THROW( Invalid_Stream_Operation );
- }
-
- if ( stream->read )
- read_bytes = stream->read( stream, pos, buffer, count );
- else
- {
- read_bytes = stream->size - pos;
- if ( read_bytes > count )
- read_bytes = count;
-
- FT_MEM_COPY( buffer, stream->base + pos, read_bytes );
- }
-
- stream->pos = pos + read_bytes;
-
- if ( read_bytes < count )
- {
- FT_ERROR(( "FT_Stream_ReadAt:"
- " invalid read; expected %lu bytes, got %lu\n",
- count, read_bytes ));
-
- error = FT_THROW( Invalid_Stream_Operation );
- }
-
- return error;
- }
-
-
- FT_BASE_DEF( FT_ULong )
- FT_Stream_TryRead( FT_Stream stream,
- FT_Byte* buffer,
- FT_ULong count )
- {
- FT_ULong read_bytes = 0;
-
-
- if ( stream->pos >= stream->size )
- goto Exit;
-
- if ( stream->read )
- read_bytes = stream->read( stream, stream->pos, buffer, count );
- else
- {
- read_bytes = stream->size - stream->pos;
- if ( read_bytes > count )
- read_bytes = count;
-
- FT_MEM_COPY( buffer, stream->base + stream->pos, read_bytes );
- }
-
- stream->pos += read_bytes;
-
- Exit:
- return read_bytes;
- }
-
-
- FT_BASE_DEF( FT_Error )
- FT_Stream_ExtractFrame( FT_Stream stream,
- FT_ULong count,
- FT_Byte** pbytes )
- {
- FT_Error error;
-
-
- error = FT_Stream_EnterFrame( stream, count );
- if ( !error )
- {
- *pbytes = (FT_Byte*)stream->cursor;
-
- /* equivalent to FT_Stream_ExitFrame(), with no memory block release */
- stream->cursor = NULL;
- stream->limit = NULL;
- }
-
- return error;
- }
-
-
- FT_BASE_DEF( void )
- FT_Stream_ReleaseFrame( FT_Stream stream,
- FT_Byte** pbytes )
- {
- if ( stream && stream->read )
- {
- FT_Memory memory = stream->memory;
-
-#ifdef FT_DEBUG_MEMORY
- ft_mem_free( memory, *pbytes );
- *pbytes = NULL;
-#else
- FT_FREE( *pbytes );
-#endif
- }
- *pbytes = NULL;
- }
-
-
- FT_BASE_DEF( FT_Error )
- FT_Stream_EnterFrame( FT_Stream stream,
- FT_ULong count )
- {
- FT_Error error = FT_Err_Ok;
- FT_ULong read_bytes;
-
-
- /* check for nested frame access */
- FT_ASSERT( stream && stream->cursor == 0 );
-
- if ( stream->read )
- {
- /* allocate the frame in memory */
- FT_Memory memory = stream->memory;
-
-
- /* simple sanity check */
- if ( count > stream->size )
- {
- FT_ERROR(( "FT_Stream_EnterFrame:"
- " frame size (%lu) larger than stream size (%lu)\n",
- count, stream->size ));
-
- error = FT_THROW( Invalid_Stream_Operation );
- goto Exit;
- }
-
-#ifdef FT_DEBUG_MEMORY
- /* assume _ft_debug_file and _ft_debug_lineno are already set */
- stream->base = (unsigned char*)ft_mem_qalloc( memory,
- (FT_Long)count,
- &error );
- if ( error )
- goto Exit;
-#else
- if ( FT_QALLOC( stream->base, count ) )
- goto Exit;
-#endif
- /* read it */
- read_bytes = stream->read( stream, stream->pos,
- stream->base, count );
- if ( read_bytes < count )
- {
- FT_ERROR(( "FT_Stream_EnterFrame:"
- " invalid read; expected %lu bytes, got %lu\n",
- count, read_bytes ));
-
- FT_FREE( stream->base );
- error = FT_THROW( Invalid_Stream_Operation );
- }
- stream->cursor = stream->base;
- stream->limit = stream->cursor + count;
- stream->pos += read_bytes;
- }
- else
- {
- /* check current and new position */
- if ( stream->pos >= stream->size ||
- stream->size - stream->pos < count )
- {
- FT_ERROR(( "FT_Stream_EnterFrame:"
- " invalid i/o; pos = 0x%lx, count = %lu, size = 0x%lx\n",
- stream->pos, count, stream->size ));
-
- error = FT_THROW( Invalid_Stream_Operation );
- goto Exit;
- }
-
- /* set cursor */
- stream->cursor = stream->base + stream->pos;
- stream->limit = stream->cursor + count;
- stream->pos += count;
- }
-
- Exit:
- return error;
- }
-
-
- FT_BASE_DEF( void )
- FT_Stream_ExitFrame( FT_Stream stream )
- {
- /* IMPORTANT: The assertion stream->cursor != 0 was removed, given */
- /* that it is possible to access a frame of length 0 in */
- /* some weird fonts (usually, when accessing an array of */
- /* 0 records, like in some strange kern tables). */
- /* */
- /* In this case, the loader code handles the 0-length table */
- /* gracefully; however, stream.cursor is really set to 0 by the */
- /* FT_Stream_EnterFrame() call, and this is not an error. */
- /* */
- FT_ASSERT( stream );
-
- if ( stream->read )
- {
- FT_Memory memory = stream->memory;
-
-#ifdef FT_DEBUG_MEMORY
- ft_mem_free( memory, stream->base );
- stream->base = NULL;
-#else
- FT_FREE( stream->base );
-#endif
- }
- stream->cursor = NULL;
- stream->limit = NULL;
- }
-
-
- FT_BASE_DEF( FT_Char )
- FT_Stream_GetChar( FT_Stream stream )
- {
- FT_Char result;
-
-
- FT_ASSERT( stream && stream->cursor );
-
- result = 0;
- if ( stream->cursor < stream->limit )
- result = (FT_Char)*stream->cursor++;
-
- return result;
- }
-
-
- FT_BASE_DEF( FT_UShort )
- FT_Stream_GetUShort( FT_Stream stream )
- {
- FT_Byte* p;
- FT_UShort result;
-
-
- FT_ASSERT( stream && stream->cursor );
-
- result = 0;
- p = stream->cursor;
- if ( p + 1 < stream->limit )
- result = FT_NEXT_USHORT( p );
- stream->cursor = p;
-
- return result;
- }
-
-
- FT_BASE_DEF( FT_UShort )
- FT_Stream_GetUShortLE( FT_Stream stream )
- {
- FT_Byte* p;
- FT_UShort result;
-
-
- FT_ASSERT( stream && stream->cursor );
-
- result = 0;
- p = stream->cursor;
- if ( p + 1 < stream->limit )
- result = FT_NEXT_USHORT_LE( p );
- stream->cursor = p;
-
- return result;
- }
-
-
- FT_BASE_DEF( FT_ULong )
- FT_Stream_GetUOffset( FT_Stream stream )
- {
- FT_Byte* p;
- FT_ULong result;
-
-
- FT_ASSERT( stream && stream->cursor );
-
- result = 0;
- p = stream->cursor;
- if ( p + 2 < stream->limit )
- result = FT_NEXT_UOFF3( p );
- stream->cursor = p;
- return result;
- }
-
-
- FT_BASE_DEF( FT_ULong )
- FT_Stream_GetULong( FT_Stream stream )
- {
- FT_Byte* p;
- FT_ULong result;
-
-
- FT_ASSERT( stream && stream->cursor );
-
- result = 0;
- p = stream->cursor;
- if ( p + 3 < stream->limit )
- result = FT_NEXT_ULONG( p );
- stream->cursor = p;
- return result;
- }
-
-
- FT_BASE_DEF( FT_ULong )
- FT_Stream_GetULongLE( FT_Stream stream )
- {
- FT_Byte* p;
- FT_ULong result;
-
-
- FT_ASSERT( stream && stream->cursor );
-
- result = 0;
- p = stream->cursor;
- if ( p + 3 < stream->limit )
- result = FT_NEXT_ULONG_LE( p );
- stream->cursor = p;
- return result;
- }
-
-
- FT_BASE_DEF( FT_Char )
- FT_Stream_ReadChar( FT_Stream stream,
- FT_Error* error )
- {
- FT_Byte result = 0;
-
-
- FT_ASSERT( stream );
-
- *error = FT_Err_Ok;
-
- if ( stream->read )
- {
- if ( stream->read( stream, stream->pos, &result, 1L ) != 1L )
- goto Fail;
- }
- else
- {
- if ( stream->pos < stream->size )
- result = stream->base[stream->pos];
- else
- goto Fail;
- }
- stream->pos++;
-
- return (FT_Char)result;
-
- Fail:
- *error = FT_THROW( Invalid_Stream_Operation );
- FT_ERROR(( "FT_Stream_ReadChar:"
- " invalid i/o; pos = 0x%lx, size = 0x%lx\n",
- stream->pos, stream->size ));
-
- return 0;
- }
-
-
- FT_BASE_DEF( FT_UShort )
- FT_Stream_ReadUShort( FT_Stream stream,
- FT_Error* error )
- {
- FT_Byte reads[2];
- FT_Byte* p = 0;
- FT_UShort result = 0;
-
-
- FT_ASSERT( stream );
-
- *error = FT_Err_Ok;
-
- if ( stream->pos + 1 < stream->size )
- {
- if ( stream->read )
- {
- if ( stream->read( stream, stream->pos, reads, 2L ) != 2L )
- goto Fail;
-
- p = reads;
- }
- else
- p = stream->base + stream->pos;
-
- if ( p )
- result = FT_NEXT_USHORT( p );
- }
- else
- goto Fail;
-
- stream->pos += 2;
-
- return result;
-
- Fail:
- *error = FT_THROW( Invalid_Stream_Operation );
- FT_ERROR(( "FT_Stream_ReadUShort:"
- " invalid i/o; pos = 0x%lx, size = 0x%lx\n",
- stream->pos, stream->size ));
-
- return 0;
- }
-
-
- FT_BASE_DEF( FT_UShort )
- FT_Stream_ReadUShortLE( FT_Stream stream,
- FT_Error* error )
- {
- FT_Byte reads[2];
- FT_Byte* p = 0;
- FT_UShort result = 0;
-
-
- FT_ASSERT( stream );
-
- *error = FT_Err_Ok;
-
- if ( stream->pos + 1 < stream->size )
- {
- if ( stream->read )
- {
- if ( stream->read( stream, stream->pos, reads, 2L ) != 2L )
- goto Fail;
-
- p = reads;
- }
- else
- p = stream->base + stream->pos;
-
- if ( p )
- result = FT_NEXT_USHORT_LE( p );
- }
- else
- goto Fail;
-
- stream->pos += 2;
-
- return result;
-
- Fail:
- *error = FT_THROW( Invalid_Stream_Operation );
- FT_ERROR(( "FT_Stream_ReadUShortLE:"
- " invalid i/o; pos = 0x%lx, size = 0x%lx\n",
- stream->pos, stream->size ));
-
- return 0;
- }
-
-
- FT_BASE_DEF( FT_ULong )
- FT_Stream_ReadUOffset( FT_Stream stream,
- FT_Error* error )
- {
- FT_Byte reads[3];
- FT_Byte* p = 0;
- FT_ULong result = 0;
-
-
- FT_ASSERT( stream );
-
- *error = FT_Err_Ok;
-
- if ( stream->pos + 2 < stream->size )
- {
- if ( stream->read )
- {
- if (stream->read( stream, stream->pos, reads, 3L ) != 3L )
- goto Fail;
-
- p = reads;
- }
- else
- p = stream->base + stream->pos;
-
- if ( p )
- result = FT_NEXT_UOFF3( p );
- }
- else
- goto Fail;
-
- stream->pos += 3;
-
- return result;
-
- Fail:
- *error = FT_THROW( Invalid_Stream_Operation );
- FT_ERROR(( "FT_Stream_ReadUOffset:"
- " invalid i/o; pos = 0x%lx, size = 0x%lx\n",
- stream->pos, stream->size ));
-
- return 0;
- }
-
-
- FT_BASE_DEF( FT_ULong )
- FT_Stream_ReadULong( FT_Stream stream,
- FT_Error* error )
- {
- FT_Byte reads[4];
- FT_Byte* p = 0;
- FT_ULong result = 0;
-
-
- FT_ASSERT( stream );
-
- *error = FT_Err_Ok;
-
- if ( stream->pos + 3 < stream->size )
- {
- if ( stream->read )
- {
- if ( stream->read( stream, stream->pos, reads, 4L ) != 4L )
- goto Fail;
-
- p = reads;
- }
- else
- p = stream->base + stream->pos;
-
- if ( p )
- result = FT_NEXT_ULONG( p );
- }
- else
- goto Fail;
-
- stream->pos += 4;
-
- return result;
-
- Fail:
- *error = FT_THROW( Invalid_Stream_Operation );
- FT_ERROR(( "FT_Stream_ReadULong:"
- " invalid i/o; pos = 0x%lx, size = 0x%lx\n",
- stream->pos, stream->size ));
-
- return 0;
- }
-
-
- FT_BASE_DEF( FT_ULong )
- FT_Stream_ReadULongLE( FT_Stream stream,
- FT_Error* error )
- {
- FT_Byte reads[4];
- FT_Byte* p = 0;
- FT_ULong result = 0;
-
-
- FT_ASSERT( stream );
-
- *error = FT_Err_Ok;
-
- if ( stream->pos + 3 < stream->size )
- {
- if ( stream->read )
- {
- if ( stream->read( stream, stream->pos, reads, 4L ) != 4L )
- goto Fail;
-
- p = reads;
- }
- else
- p = stream->base + stream->pos;
-
- if ( p )
- result = FT_NEXT_ULONG_LE( p );
- }
- else
- goto Fail;
-
- stream->pos += 4;
-
- return result;
-
- Fail:
- *error = FT_THROW( Invalid_Stream_Operation );
- FT_ERROR(( "FT_Stream_ReadULongLE:"
- " invalid i/o; pos = 0x%lx, size = 0x%lx\n",
- stream->pos, stream->size ));
-
- return 0;
- }
-
-
- FT_BASE_DEF( FT_Error )
- FT_Stream_ReadFields( FT_Stream stream,
- const FT_Frame_Field* fields,
- void* structure )
- {
- FT_Error error;
- FT_Bool frame_accessed = 0;
- FT_Byte* cursor;
-
-
- if ( !fields )
- return FT_THROW( Invalid_Argument );
-
- if ( !stream )
- return FT_THROW( Invalid_Stream_Handle );
-
- cursor = stream->cursor;
-
- error = FT_Err_Ok;
- do
- {
- FT_ULong value;
- FT_Int sign_shift;
- FT_Byte* p;
-
-
- switch ( fields->value )
- {
- case ft_frame_start: /* access a new frame */
- error = FT_Stream_EnterFrame( stream, fields->offset );
- if ( error )
- goto Exit;
-
- frame_accessed = 1;
- cursor = stream->cursor;
- fields++;
- continue; /* loop! */
-
- case ft_frame_bytes: /* read a byte sequence */
- case ft_frame_skip: /* skip some bytes */
- {
- FT_UInt len = fields->size;
-
-
- if ( cursor + len > stream->limit )
- {
- error = FT_THROW( Invalid_Stream_Operation );
- goto Exit;
- }
-
- if ( fields->value == ft_frame_bytes )
- {
- p = (FT_Byte*)structure + fields->offset;
- FT_MEM_COPY( p, cursor, len );
- }
- cursor += len;
- fields++;
- continue;
- }
-
- case ft_frame_byte:
- case ft_frame_schar: /* read a single byte */
- value = FT_NEXT_BYTE( cursor );
- sign_shift = 24;
- break;
-
- case ft_frame_short_be:
- case ft_frame_ushort_be: /* read a 2-byte big-endian short */
- value = FT_NEXT_USHORT( cursor) ;
- sign_shift = 16;
- break;
-
- case ft_frame_short_le:
- case ft_frame_ushort_le: /* read a 2-byte little-endian short */
- value = FT_NEXT_USHORT_LE( cursor );
- sign_shift = 16;
- break;
-
- case ft_frame_long_be:
- case ft_frame_ulong_be: /* read a 4-byte big-endian long */
- value = FT_NEXT_ULONG( cursor );
- sign_shift = 0;
- break;
-
- case ft_frame_long_le:
- case ft_frame_ulong_le: /* read a 4-byte little-endian long */
- value = FT_NEXT_ULONG_LE( cursor );
- sign_shift = 0;
- break;
-
- case ft_frame_off3_be:
- case ft_frame_uoff3_be: /* read a 3-byte big-endian long */
- value = FT_NEXT_UOFF3( cursor );
- sign_shift = 8;
- break;
-
- case ft_frame_off3_le:
- case ft_frame_uoff3_le: /* read a 3-byte little-endian long */
- value = FT_NEXT_UOFF3_LE( cursor );
- sign_shift = 8;
- break;
-
- default:
- /* otherwise, exit the loop */
- stream->cursor = cursor;
- goto Exit;
- }
-
- /* now, compute the signed value is necessary */
- if ( fields->value & FT_FRAME_OP_SIGNED )
- value = (FT_ULong)( (FT_Int32)( value << sign_shift ) >> sign_shift );
-
- /* finally, store the value in the object */
-
- p = (FT_Byte*)structure + fields->offset;
- switch ( fields->size )
- {
- case ( 8 / FT_CHAR_BIT ):
- *(FT_Byte*)p = (FT_Byte)value;
- break;
-
- case ( 16 / FT_CHAR_BIT ):
- *(FT_UShort*)p = (FT_UShort)value;
- break;
-
- case ( 32 / FT_CHAR_BIT ):
- *(FT_UInt32*)p = (FT_UInt32)value;
- break;
-
- default: /* for 64-bit systems */
- *(FT_ULong*)p = (FT_ULong)value;
- }
-
- /* go to next field */
- fields++;
- }
- while ( 1 );
-
- Exit:
- /* close the frame if it was opened by this read */
- if ( frame_accessed )
- FT_Stream_ExitFrame( stream );
-
- return error;
- }
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/base/ftstroke.c b/chromium/third_party/pdfium/third_party/freetype/src/base/ftstroke.c
deleted file mode 100644
index fecb3cc25c0..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/base/ftstroke.c
+++ /dev/null
@@ -1,2468 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftstroke.c */
-/* */
-/* FreeType path stroker (body). */
-/* */
-/* Copyright 2002-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_STROKER_H
-#include FT_TRIGONOMETRY_H
-#include FT_OUTLINE_H
-#include FT_INTERNAL_MEMORY_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_OBJECTS_H
-
-#include "basepic.h"
-
-
- /* declare an extern to access `ft_outline_glyph_class' globally */
- /* allocated in `ftglyph.c', and use the FT_OUTLINE_GLYPH_CLASS_GET */
- /* macro to access it when FT_CONFIG_OPTION_PIC is defined */
-#ifndef FT_CONFIG_OPTION_PIC
- FT_CALLBACK_TABLE const FT_Glyph_Class ft_outline_glyph_class;
-#endif
-
-
- /* documentation is in ftstroke.h */
-
- FT_EXPORT_DEF( FT_StrokerBorder )
- FT_Outline_GetInsideBorder( FT_Outline* outline )
- {
- FT_Orientation o = FT_Outline_Get_Orientation( outline );
-
-
- return o == FT_ORIENTATION_TRUETYPE ? FT_STROKER_BORDER_RIGHT
- : FT_STROKER_BORDER_LEFT;
- }
-
-
- /* documentation is in ftstroke.h */
-
- FT_EXPORT_DEF( FT_StrokerBorder )
- FT_Outline_GetOutsideBorder( FT_Outline* outline )
- {
- FT_Orientation o = FT_Outline_Get_Orientation( outline );
-
-
- return o == FT_ORIENTATION_TRUETYPE ? FT_STROKER_BORDER_LEFT
- : FT_STROKER_BORDER_RIGHT;
- }
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** BEZIER COMPUTATIONS *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
-#define FT_SMALL_CONIC_THRESHOLD ( FT_ANGLE_PI / 6 )
-#define FT_SMALL_CUBIC_THRESHOLD ( FT_ANGLE_PI / 8 )
-
-#define FT_EPSILON 2
-
-#define FT_IS_SMALL( x ) ( (x) > -FT_EPSILON && (x) < FT_EPSILON )
-
-
- static FT_Pos
- ft_pos_abs( FT_Pos x )
- {
- return x >= 0 ? x : -x;
- }
-
-
- static void
- ft_conic_split( FT_Vector* base )
- {
- FT_Pos a, b;
-
-
- base[4].x = base[2].x;
- b = base[1].x;
- a = base[3].x = ( base[2].x + b ) / 2;
- b = base[1].x = ( base[0].x + b ) / 2;
- base[2].x = ( a + b ) / 2;
-
- base[4].y = base[2].y;
- b = base[1].y;
- a = base[3].y = ( base[2].y + b ) / 2;
- b = base[1].y = ( base[0].y + b ) / 2;
- base[2].y = ( a + b ) / 2;
- }
-
-
- static FT_Bool
- ft_conic_is_small_enough( FT_Vector* base,
- FT_Angle *angle_in,
- FT_Angle *angle_out )
- {
- FT_Vector d1, d2;
- FT_Angle theta;
- FT_Int close1, close2;
-
-
- d1.x = base[1].x - base[2].x;
- d1.y = base[1].y - base[2].y;
- d2.x = base[0].x - base[1].x;
- d2.y = base[0].y - base[1].y;
-
- close1 = FT_IS_SMALL( d1.x ) && FT_IS_SMALL( d1.y );
- close2 = FT_IS_SMALL( d2.x ) && FT_IS_SMALL( d2.y );
-
- if ( close1 )
- {
- if ( close2 )
- {
- /* basically a point; */
- /* do nothing to retain original direction */
- }
- else
- {
- *angle_in =
- *angle_out = FT_Atan2( d2.x, d2.y );
- }
- }
- else /* !close1 */
- {
- if ( close2 )
- {
- *angle_in =
- *angle_out = FT_Atan2( d1.x, d1.y );
- }
- else
- {
- *angle_in = FT_Atan2( d1.x, d1.y );
- *angle_out = FT_Atan2( d2.x, d2.y );
- }
- }
-
- theta = ft_pos_abs( FT_Angle_Diff( *angle_in, *angle_out ) );
-
- return FT_BOOL( theta < FT_SMALL_CONIC_THRESHOLD );
- }
-
-
- static void
- ft_cubic_split( FT_Vector* base )
- {
- FT_Pos a, b, c, d;
-
-
- base[6].x = base[3].x;
- c = base[1].x;
- d = base[2].x;
- base[1].x = a = ( base[0].x + c ) / 2;
- base[5].x = b = ( base[3].x + d ) / 2;
- c = ( c + d ) / 2;
- base[2].x = a = ( a + c ) / 2;
- base[4].x = b = ( b + c ) / 2;
- base[3].x = ( a + b ) / 2;
-
- base[6].y = base[3].y;
- c = base[1].y;
- d = base[2].y;
- base[1].y = a = ( base[0].y + c ) / 2;
- base[5].y = b = ( base[3].y + d ) / 2;
- c = ( c + d ) / 2;
- base[2].y = a = ( a + c ) / 2;
- base[4].y = b = ( b + c ) / 2;
- base[3].y = ( a + b ) / 2;
- }
-
-
- /* Return the average of `angle1' and `angle2'. */
- /* This gives correct result even if `angle1' and `angle2' */
- /* have opposite signs. */
- static FT_Angle
- ft_angle_mean( FT_Angle angle1,
- FT_Angle angle2 )
- {
- return angle1 + FT_Angle_Diff( angle1, angle2 ) / 2;
- }
-
-
- static FT_Bool
- ft_cubic_is_small_enough( FT_Vector* base,
- FT_Angle *angle_in,
- FT_Angle *angle_mid,
- FT_Angle *angle_out )
- {
- FT_Vector d1, d2, d3;
- FT_Angle theta1, theta2;
- FT_Int close1, close2, close3;
-
-
- d1.x = base[2].x - base[3].x;
- d1.y = base[2].y - base[3].y;
- d2.x = base[1].x - base[2].x;
- d2.y = base[1].y - base[2].y;
- d3.x = base[0].x - base[1].x;
- d3.y = base[0].y - base[1].y;
-
- close1 = FT_IS_SMALL( d1.x ) && FT_IS_SMALL( d1.y );
- close2 = FT_IS_SMALL( d2.x ) && FT_IS_SMALL( d2.y );
- close3 = FT_IS_SMALL( d3.x ) && FT_IS_SMALL( d3.y );
-
- if ( close1 )
- {
- if ( close2 )
- {
- if ( close3 )
- {
- /* basically a point; */
- /* do nothing to retain original direction */
- }
- else /* !close3 */
- {
- *angle_in =
- *angle_mid =
- *angle_out = FT_Atan2( d3.x, d3.y );
- }
- }
- else /* !close2 */
- {
- if ( close3 )
- {
- *angle_in =
- *angle_mid =
- *angle_out = FT_Atan2( d2.x, d2.y );
- }
- else /* !close3 */
- {
- *angle_in =
- *angle_mid = FT_Atan2( d2.x, d2.y );
- *angle_out = FT_Atan2( d3.x, d3.y );
- }
- }
- }
- else /* !close1 */
- {
- if ( close2 )
- {
- if ( close3 )
- {
- *angle_in =
- *angle_mid =
- *angle_out = FT_Atan2( d1.x, d1.y );
- }
- else /* !close3 */
- {
- *angle_in = FT_Atan2( d1.x, d1.y );
- *angle_out = FT_Atan2( d3.x, d3.y );
- *angle_mid = ft_angle_mean( *angle_in, *angle_out );
- }
- }
- else /* !close2 */
- {
- if ( close3 )
- {
- *angle_in = FT_Atan2( d1.x, d1.y );
- *angle_mid =
- *angle_out = FT_Atan2( d2.x, d2.y );
- }
- else /* !close3 */
- {
- *angle_in = FT_Atan2( d1.x, d1.y );
- *angle_mid = FT_Atan2( d2.x, d2.y );
- *angle_out = FT_Atan2( d3.x, d3.y );
- }
- }
- }
-
- theta1 = ft_pos_abs( FT_Angle_Diff( *angle_in, *angle_mid ) );
- theta2 = ft_pos_abs( FT_Angle_Diff( *angle_mid, *angle_out ) );
-
- return FT_BOOL( theta1 < FT_SMALL_CUBIC_THRESHOLD &&
- theta2 < FT_SMALL_CUBIC_THRESHOLD );
- }
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** STROKE BORDERS *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
- typedef enum FT_StrokeTags_
- {
- FT_STROKE_TAG_ON = 1, /* on-curve point */
- FT_STROKE_TAG_CUBIC = 2, /* cubic off-point */
- FT_STROKE_TAG_BEGIN = 4, /* sub-path start */
- FT_STROKE_TAG_END = 8 /* sub-path end */
-
- } FT_StrokeTags;
-
-#define FT_STROKE_TAG_BEGIN_END ( FT_STROKE_TAG_BEGIN | FT_STROKE_TAG_END )
-
- typedef struct FT_StrokeBorderRec_
- {
- FT_UInt num_points;
- FT_UInt max_points;
- FT_Vector* points;
- FT_Byte* tags;
- FT_Bool movable; /* TRUE for ends of lineto borders */
- FT_Int start; /* index of current sub-path start point */
- FT_Memory memory;
- FT_Bool valid;
-
- } FT_StrokeBorderRec, *FT_StrokeBorder;
-
-
- static FT_Error
- ft_stroke_border_grow( FT_StrokeBorder border,
- FT_UInt new_points )
- {
- FT_UInt old_max = border->max_points;
- FT_UInt new_max = border->num_points + new_points;
- FT_Error error = FT_Err_Ok;
-
-
- if ( new_max > old_max )
- {
- FT_UInt cur_max = old_max;
- FT_Memory memory = border->memory;
-
-
- while ( cur_max < new_max )
- cur_max += ( cur_max >> 1 ) + 16;
-
- if ( FT_RENEW_ARRAY( border->points, old_max, cur_max ) ||
- FT_RENEW_ARRAY( border->tags, old_max, cur_max ) )
- goto Exit;
-
- border->max_points = cur_max;
- }
-
- Exit:
- return error;
- }
-
-
- static void
- ft_stroke_border_close( FT_StrokeBorder border,
- FT_Bool reverse )
- {
- FT_UInt start = (FT_UInt)border->start;
- FT_UInt count = border->num_points;
-
-
- FT_ASSERT( border->start >= 0 );
-
- /* don't record empty paths! */
- if ( count <= start + 1U )
- border->num_points = start;
- else
- {
- /* copy the last point to the start of this sub-path, since */
- /* it contains the `adjusted' starting coordinates */
- border->num_points = --count;
- border->points[start] = border->points[count];
-
- if ( reverse )
- {
- /* reverse the points */
- {
- FT_Vector* vec1 = border->points + start + 1;
- FT_Vector* vec2 = border->points + count - 1;
-
-
- for ( ; vec1 < vec2; vec1++, vec2-- )
- {
- FT_Vector tmp;
-
-
- tmp = *vec1;
- *vec1 = *vec2;
- *vec2 = tmp;
- }
- }
-
- /* then the tags */
- {
- FT_Byte* tag1 = border->tags + start + 1;
- FT_Byte* tag2 = border->tags + count - 1;
-
-
- for ( ; tag1 < tag2; tag1++, tag2-- )
- {
- FT_Byte tmp;
-
-
- tmp = *tag1;
- *tag1 = *tag2;
- *tag2 = tmp;
- }
- }
- }
-
- border->tags[start ] |= FT_STROKE_TAG_BEGIN;
- border->tags[count - 1] |= FT_STROKE_TAG_END;
- }
-
- border->start = -1;
- border->movable = FALSE;
- }
-
-
- static FT_Error
- ft_stroke_border_lineto( FT_StrokeBorder border,
- FT_Vector* to,
- FT_Bool movable )
- {
- FT_Error error = FT_Err_Ok;
-
-
- FT_ASSERT( border->start >= 0 );
-
- if ( border->movable )
- {
- /* move last point */
- border->points[border->num_points - 1] = *to;
- }
- else
- {
- /* don't add zero-length lineto */
- if ( border->num_points > 0 &&
- FT_IS_SMALL( border->points[border->num_points - 1].x - to->x ) &&
- FT_IS_SMALL( border->points[border->num_points - 1].y - to->y ) )
- return error;
-
- /* add one point */
- error = ft_stroke_border_grow( border, 1 );
- if ( !error )
- {
- FT_Vector* vec = border->points + border->num_points;
- FT_Byte* tag = border->tags + border->num_points;
-
-
- vec[0] = *to;
- tag[0] = FT_STROKE_TAG_ON;
-
- border->num_points += 1;
- }
- }
- border->movable = movable;
- return error;
- }
-
-
- static FT_Error
- ft_stroke_border_conicto( FT_StrokeBorder border,
- FT_Vector* control,
- FT_Vector* to )
- {
- FT_Error error;
-
-
- FT_ASSERT( border->start >= 0 );
-
- error = ft_stroke_border_grow( border, 2 );
- if ( !error )
- {
- FT_Vector* vec = border->points + border->num_points;
- FT_Byte* tag = border->tags + border->num_points;
-
-
- vec[0] = *control;
- vec[1] = *to;
-
- tag[0] = 0;
- tag[1] = FT_STROKE_TAG_ON;
-
- border->num_points += 2;
- }
-
- border->movable = FALSE;
-
- return error;
- }
-
-
- static FT_Error
- ft_stroke_border_cubicto( FT_StrokeBorder border,
- FT_Vector* control1,
- FT_Vector* control2,
- FT_Vector* to )
- {
- FT_Error error;
-
-
- FT_ASSERT( border->start >= 0 );
-
- error = ft_stroke_border_grow( border, 3 );
- if ( !error )
- {
- FT_Vector* vec = border->points + border->num_points;
- FT_Byte* tag = border->tags + border->num_points;
-
-
- vec[0] = *control1;
- vec[1] = *control2;
- vec[2] = *to;
-
- tag[0] = FT_STROKE_TAG_CUBIC;
- tag[1] = FT_STROKE_TAG_CUBIC;
- tag[2] = FT_STROKE_TAG_ON;
-
- border->num_points += 3;
- }
-
- border->movable = FALSE;
-
- return error;
- }
-
-
-#define FT_ARC_CUBIC_ANGLE ( FT_ANGLE_PI / 2 )
-
-
- static FT_Error
- ft_stroke_border_arcto( FT_StrokeBorder border,
- FT_Vector* center,
- FT_Fixed radius,
- FT_Angle angle_start,
- FT_Angle angle_diff )
- {
- FT_Angle total, angle, step, rotate, next, theta;
- FT_Vector a, b, a2, b2;
- FT_Fixed length;
- FT_Error error = FT_Err_Ok;
-
-
- /* compute start point */
- FT_Vector_From_Polar( &a, radius, angle_start );
- a.x += center->x;
- a.y += center->y;
-
- total = angle_diff;
- angle = angle_start;
- rotate = ( angle_diff >= 0 ) ? FT_ANGLE_PI2 : -FT_ANGLE_PI2;
-
- while ( total != 0 )
- {
- step = total;
- if ( step > FT_ARC_CUBIC_ANGLE )
- step = FT_ARC_CUBIC_ANGLE;
-
- else if ( step < -FT_ARC_CUBIC_ANGLE )
- step = -FT_ARC_CUBIC_ANGLE;
-
- next = angle + step;
- theta = step;
- if ( theta < 0 )
- theta = -theta;
-
- theta >>= 1;
-
- /* compute end point */
- FT_Vector_From_Polar( &b, radius, next );
- b.x += center->x;
- b.y += center->y;
-
- /* compute first and second control points */
- length = FT_MulDiv( radius, FT_Sin( theta ) * 4,
- ( 0x10000L + FT_Cos( theta ) ) * 3 );
-
- FT_Vector_From_Polar( &a2, length, angle + rotate );
- a2.x += a.x;
- a2.y += a.y;
-
- FT_Vector_From_Polar( &b2, length, next - rotate );
- b2.x += b.x;
- b2.y += b.y;
-
- /* add cubic arc */
- error = ft_stroke_border_cubicto( border, &a2, &b2, &b );
- if ( error )
- break;
-
- /* process the rest of the arc ?? */
- a = b;
- total -= step;
- angle = next;
- }
-
- return error;
- }
-
-
- static FT_Error
- ft_stroke_border_moveto( FT_StrokeBorder border,
- FT_Vector* to )
- {
- /* close current open path if any ? */
- if ( border->start >= 0 )
- ft_stroke_border_close( border, FALSE );
-
- border->start = (FT_Int)border->num_points;
- border->movable = FALSE;
-
- return ft_stroke_border_lineto( border, to, FALSE );
- }
-
-
- static void
- ft_stroke_border_init( FT_StrokeBorder border,
- FT_Memory memory )
- {
- border->memory = memory;
- border->points = NULL;
- border->tags = NULL;
-
- border->num_points = 0;
- border->max_points = 0;
- border->start = -1;
- border->valid = FALSE;
- }
-
-
- static void
- ft_stroke_border_reset( FT_StrokeBorder border )
- {
- border->num_points = 0;
- border->start = -1;
- border->valid = FALSE;
- }
-
-
- static void
- ft_stroke_border_done( FT_StrokeBorder border )
- {
- FT_Memory memory = border->memory;
-
-
- FT_FREE( border->points );
- FT_FREE( border->tags );
-
- border->num_points = 0;
- border->max_points = 0;
- border->start = -1;
- border->valid = FALSE;
- }
-
-
- static FT_Error
- ft_stroke_border_get_counts( FT_StrokeBorder border,
- FT_UInt *anum_points,
- FT_UInt *anum_contours )
- {
- FT_Error error = FT_Err_Ok;
- FT_UInt num_points = 0;
- FT_UInt num_contours = 0;
-
- FT_UInt count = border->num_points;
- FT_Vector* point = border->points;
- FT_Byte* tags = border->tags;
- FT_Int in_contour = 0;
-
-
- for ( ; count > 0; count--, num_points++, point++, tags++ )
- {
- if ( tags[0] & FT_STROKE_TAG_BEGIN )
- {
- if ( in_contour != 0 )
- goto Fail;
-
- in_contour = 1;
- }
- else if ( in_contour == 0 )
- goto Fail;
-
- if ( tags[0] & FT_STROKE_TAG_END )
- {
- in_contour = 0;
- num_contours++;
- }
- }
-
- if ( in_contour != 0 )
- goto Fail;
-
- border->valid = TRUE;
-
- Exit:
- *anum_points = num_points;
- *anum_contours = num_contours;
- return error;
-
- Fail:
- num_points = 0;
- num_contours = 0;
- goto Exit;
- }
-
-
- static void
- ft_stroke_border_export( FT_StrokeBorder border,
- FT_Outline* outline )
- {
- /* copy point locations */
- FT_ARRAY_COPY( outline->points + outline->n_points,
- border->points,
- border->num_points );
-
- /* copy tags */
- {
- FT_UInt count = border->num_points;
- FT_Byte* read = border->tags;
- FT_Byte* write = (FT_Byte*)outline->tags + outline->n_points;
-
-
- for ( ; count > 0; count--, read++, write++ )
- {
- if ( *read & FT_STROKE_TAG_ON )
- *write = FT_CURVE_TAG_ON;
- else if ( *read & FT_STROKE_TAG_CUBIC )
- *write = FT_CURVE_TAG_CUBIC;
- else
- *write = FT_CURVE_TAG_CONIC;
- }
- }
-
- /* copy contours */
- {
- FT_UInt count = border->num_points;
- FT_Byte* tags = border->tags;
- FT_Short* write = outline->contours + outline->n_contours;
- FT_Short idx = (FT_Short)outline->n_points;
-
-
- for ( ; count > 0; count--, tags++, idx++ )
- {
- if ( *tags & FT_STROKE_TAG_END )
- {
- *write++ = idx;
- outline->n_contours++;
- }
- }
- }
-
- outline->n_points += (short)border->num_points;
-
- FT_ASSERT( FT_Outline_Check( outline ) == 0 );
- }
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** STROKER *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
-#define FT_SIDE_TO_ROTATE( s ) ( FT_ANGLE_PI2 - (s) * FT_ANGLE_PI )
-
- typedef struct FT_StrokerRec_
- {
- FT_Angle angle_in; /* direction into curr join */
- FT_Angle angle_out; /* direction out of join */
- FT_Vector center; /* current position */
- FT_Fixed line_length; /* length of last lineto */
- FT_Bool first_point; /* is this the start? */
- FT_Bool subpath_open; /* is the subpath open? */
- FT_Angle subpath_angle; /* subpath start direction */
- FT_Vector subpath_start; /* subpath start position */
- FT_Fixed subpath_line_length; /* subpath start lineto len */
- FT_Bool handle_wide_strokes; /* use wide strokes logic? */
-
- FT_Stroker_LineCap line_cap;
- FT_Stroker_LineJoin line_join;
- FT_Stroker_LineJoin line_join_saved;
- FT_Fixed miter_limit;
- FT_Fixed radius;
-
- FT_StrokeBorderRec borders[2];
- FT_Library library;
-
- } FT_StrokerRec;
-
-
- /* documentation is in ftstroke.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Stroker_New( FT_Library library,
- FT_Stroker *astroker )
- {
- FT_Error error; /* assigned in FT_NEW */
- FT_Memory memory;
- FT_Stroker stroker = NULL;
-
-
- if ( !library )
- return FT_THROW( Invalid_Library_Handle );
-
- if ( !astroker )
- return FT_THROW( Invalid_Argument );
-
- memory = library->memory;
-
- if ( !FT_NEW( stroker ) )
- {
- stroker->library = library;
-
- ft_stroke_border_init( &stroker->borders[0], memory );
- ft_stroke_border_init( &stroker->borders[1], memory );
- }
-
- *astroker = stroker;
-
- return error;
- }
-
-
- /* documentation is in ftstroke.h */
-
- FT_EXPORT_DEF( void )
- FT_Stroker_Set( FT_Stroker stroker,
- FT_Fixed radius,
- FT_Stroker_LineCap line_cap,
- FT_Stroker_LineJoin line_join,
- FT_Fixed miter_limit )
- {
- if ( !stroker )
- return;
-
- stroker->radius = radius;
- stroker->line_cap = line_cap;
- stroker->line_join = line_join;
- stroker->miter_limit = miter_limit;
-
- /* ensure miter limit has sensible value */
- if ( stroker->miter_limit < 0x10000L )
- stroker->miter_limit = 0x10000L;
-
- /* save line join style: */
- /* line join style can be temporarily changed when stroking curves */
- stroker->line_join_saved = line_join;
-
- FT_Stroker_Rewind( stroker );
- }
-
-
- /* documentation is in ftstroke.h */
-
- FT_EXPORT_DEF( void )
- FT_Stroker_Rewind( FT_Stroker stroker )
- {
- if ( stroker )
- {
- ft_stroke_border_reset( &stroker->borders[0] );
- ft_stroke_border_reset( &stroker->borders[1] );
- }
- }
-
-
- /* documentation is in ftstroke.h */
-
- FT_EXPORT_DEF( void )
- FT_Stroker_Done( FT_Stroker stroker )
- {
- if ( stroker )
- {
- FT_Memory memory = stroker->library->memory;
-
-
- ft_stroke_border_done( &stroker->borders[0] );
- ft_stroke_border_done( &stroker->borders[1] );
-
- stroker->library = NULL;
- FT_FREE( stroker );
- }
- }
-
-
- /* create a circular arc at a corner or cap */
- static FT_Error
- ft_stroker_arcto( FT_Stroker stroker,
- FT_Int side )
- {
- FT_Angle total, rotate;
- FT_Fixed radius = stroker->radius;
- FT_Error error = FT_Err_Ok;
- FT_StrokeBorder border = stroker->borders + side;
-
-
- rotate = FT_SIDE_TO_ROTATE( side );
-
- total = FT_Angle_Diff( stroker->angle_in, stroker->angle_out );
- if ( total == FT_ANGLE_PI )
- total = -rotate * 2;
-
- error = ft_stroke_border_arcto( border,
- &stroker->center,
- radius,
- stroker->angle_in + rotate,
- total );
- border->movable = FALSE;
- return error;
- }
-
-
- /* add a cap at the end of an opened path */
- static FT_Error
- ft_stroker_cap( FT_Stroker stroker,
- FT_Angle angle,
- FT_Int side )
- {
- FT_Error error = FT_Err_Ok;
-
-
- if ( stroker->line_cap == FT_STROKER_LINECAP_ROUND )
- {
- /* add a round cap */
- stroker->angle_in = angle;
- stroker->angle_out = angle + FT_ANGLE_PI;
-
- error = ft_stroker_arcto( stroker, side );
- }
- else if ( stroker->line_cap == FT_STROKER_LINECAP_SQUARE )
- {
- /* add a square cap */
- FT_Vector delta, delta2;
- FT_Angle rotate = FT_SIDE_TO_ROTATE( side );
- FT_Fixed radius = stroker->radius;
- FT_StrokeBorder border = stroker->borders + side;
-
-
- FT_Vector_From_Polar( &delta2, radius, angle + rotate );
- FT_Vector_From_Polar( &delta, radius, angle );
-
- delta.x += stroker->center.x + delta2.x;
- delta.y += stroker->center.y + delta2.y;
-
- error = ft_stroke_border_lineto( border, &delta, FALSE );
- if ( error )
- goto Exit;
-
- FT_Vector_From_Polar( &delta2, radius, angle - rotate );
- FT_Vector_From_Polar( &delta, radius, angle );
-
- delta.x += delta2.x + stroker->center.x;
- delta.y += delta2.y + stroker->center.y;
-
- error = ft_stroke_border_lineto( border, &delta, FALSE );
- }
- else if ( stroker->line_cap == FT_STROKER_LINECAP_BUTT )
- {
- /* add a butt ending */
- FT_Vector delta;
- FT_Angle rotate = FT_SIDE_TO_ROTATE( side );
- FT_Fixed radius = stroker->radius;
- FT_StrokeBorder border = stroker->borders + side;
-
-
- FT_Vector_From_Polar( &delta, radius, angle + rotate );
-
- delta.x += stroker->center.x;
- delta.y += stroker->center.y;
-
- error = ft_stroke_border_lineto( border, &delta, FALSE );
- if ( error )
- goto Exit;
-
- FT_Vector_From_Polar( &delta, radius, angle - rotate );
-
- delta.x += stroker->center.x;
- delta.y += stroker->center.y;
-
- error = ft_stroke_border_lineto( border, &delta, FALSE );
- }
-
- Exit:
- return error;
- }
-
-
- /* process an inside corner, i.e. compute intersection */
- static FT_Error
- ft_stroker_inside( FT_Stroker stroker,
- FT_Int side,
- FT_Fixed line_length )
- {
- FT_StrokeBorder border = stroker->borders + side;
- FT_Angle phi, theta, rotate;
- FT_Fixed length, thcos;
- FT_Vector delta;
- FT_Error error = FT_Err_Ok;
- FT_Bool intersect; /* use intersection of lines? */
-
-
- rotate = FT_SIDE_TO_ROTATE( side );
-
- theta = FT_Angle_Diff( stroker->angle_in, stroker->angle_out ) / 2;
-
- /* Only intersect borders if between two lineto's and both */
- /* lines are long enough (line_length is zero for curves). */
- /* Also avoid U-turns of nearly 180 degree. */
- if ( !border->movable || line_length == 0 ||
- theta > 0x59C000 || theta < -0x59C000 )
- intersect = FALSE;
- else
- {
- /* compute minimum required length of lines */
- FT_Fixed min_length = ft_pos_abs( FT_MulFix( stroker->radius,
- FT_Tan( theta ) ) );
-
-
- intersect = FT_BOOL( min_length &&
- stroker->line_length >= min_length &&
- line_length >= min_length );
- }
-
- if ( !intersect )
- {
- FT_Vector_From_Polar( &delta, stroker->radius,
- stroker->angle_out + rotate );
- delta.x += stroker->center.x;
- delta.y += stroker->center.y;
-
- border->movable = FALSE;
- }
- else
- {
- /* compute median angle */
- phi = stroker->angle_in + theta;
-
- thcos = FT_Cos( theta );
-
- length = FT_DivFix( stroker->radius, thcos );
-
- FT_Vector_From_Polar( &delta, length, phi + rotate );
- delta.x += stroker->center.x;
- delta.y += stroker->center.y;
- }
-
- error = ft_stroke_border_lineto( border, &delta, FALSE );
-
- return error;
- }
-
-
- /* process an outside corner, i.e. compute bevel/miter/round */
- static FT_Error
- ft_stroker_outside( FT_Stroker stroker,
- FT_Int side,
- FT_Fixed line_length )
- {
- FT_StrokeBorder border = stroker->borders + side;
- FT_Error error;
- FT_Angle rotate;
-
-
- if ( stroker->line_join == FT_STROKER_LINEJOIN_ROUND )
- error = ft_stroker_arcto( stroker, side );
- else
- {
- /* this is a mitered (pointed) or beveled (truncated) corner */
- FT_Fixed sigma = 0, radius = stroker->radius;
- FT_Angle theta = 0, phi = 0;
- FT_Fixed thcos = 0;
- FT_Bool bevel, fixed_bevel;
-
-
- rotate = FT_SIDE_TO_ROTATE( side );
-
- bevel =
- FT_BOOL( stroker->line_join == FT_STROKER_LINEJOIN_BEVEL );
-
- fixed_bevel =
- FT_BOOL( stroker->line_join != FT_STROKER_LINEJOIN_MITER_VARIABLE );
-
- if ( !bevel )
- {
- theta = FT_Angle_Diff( stroker->angle_in, stroker->angle_out );
-
- if ( theta == FT_ANGLE_PI )
- {
- theta = rotate;
- phi = stroker->angle_in;
- }
- else
- {
- theta /= 2;
- phi = stroker->angle_in + theta + rotate;
- }
-
- thcos = FT_Cos( theta );
- sigma = FT_MulFix( stroker->miter_limit, thcos );
-
- /* is miter limit exceeded? */
- if ( sigma < 0x10000L )
- {
- /* don't create variable bevels for very small deviations; */
- /* FT_Sin(x) = 0 for x <= 57 */
- if ( fixed_bevel || ft_pos_abs( theta ) > 57 )
- bevel = TRUE;
- }
- }
-
- if ( bevel ) /* this is a bevel (broken angle) */
- {
- if ( fixed_bevel )
- {
- /* the outer corners are simply joined together */
- FT_Vector delta;
-
-
- /* add bevel */
- FT_Vector_From_Polar( &delta,
- radius,
- stroker->angle_out + rotate );
- delta.x += stroker->center.x;
- delta.y += stroker->center.y;
-
- border->movable = FALSE;
- error = ft_stroke_border_lineto( border, &delta, FALSE );
- }
- else /* variable bevel */
- {
- /* the miter is truncated */
- FT_Vector middle, delta;
- FT_Fixed length;
-
-
- /* compute middle point */
- FT_Vector_From_Polar( &middle,
- FT_MulFix( radius, stroker->miter_limit ),
- phi );
- middle.x += stroker->center.x;
- middle.y += stroker->center.y;
-
- /* compute first angle point */
- length = FT_MulDiv( radius, 0x10000L - sigma,
- ft_pos_abs( FT_Sin( theta ) ) );
-
- FT_Vector_From_Polar( &delta, length, phi + rotate );
- delta.x += middle.x;
- delta.y += middle.y;
-
- error = ft_stroke_border_lineto( border, &delta, FALSE );
- if ( error )
- goto Exit;
-
- /* compute second angle point */
- FT_Vector_From_Polar( &delta, length, phi - rotate );
- delta.x += middle.x;
- delta.y += middle.y;
-
- error = ft_stroke_border_lineto( border, &delta, FALSE );
- if ( error )
- goto Exit;
-
- /* finally, add an end point; only needed if not lineto */
- /* (line_length is zero for curves) */
- if ( line_length == 0 )
- {
- FT_Vector_From_Polar( &delta,
- radius,
- stroker->angle_out + rotate );
-
- delta.x += stroker->center.x;
- delta.y += stroker->center.y;
-
- error = ft_stroke_border_lineto( border, &delta, FALSE );
- }
- }
- }
- else /* this is a miter (intersection) */
- {
- FT_Fixed length;
- FT_Vector delta;
-
-
- length = FT_DivFix( stroker->radius, thcos );
-
- FT_Vector_From_Polar( &delta, length, phi );
- delta.x += stroker->center.x;
- delta.y += stroker->center.y;
-
- error = ft_stroke_border_lineto( border, &delta, FALSE );
- if ( error )
- goto Exit;
-
- /* now add an end point; only needed if not lineto */
- /* (line_length is zero for curves) */
- if ( line_length == 0 )
- {
- FT_Vector_From_Polar( &delta,
- stroker->radius,
- stroker->angle_out + rotate );
- delta.x += stroker->center.x;
- delta.y += stroker->center.y;
-
- error = ft_stroke_border_lineto( border, &delta, FALSE );
- }
- }
- }
-
- Exit:
- return error;
- }
-
-
- static FT_Error
- ft_stroker_process_corner( FT_Stroker stroker,
- FT_Fixed line_length )
- {
- FT_Error error = FT_Err_Ok;
- FT_Angle turn;
- FT_Int inside_side;
-
-
- turn = FT_Angle_Diff( stroker->angle_in, stroker->angle_out );
-
- /* no specific corner processing is required if the turn is 0 */
- if ( turn == 0 )
- goto Exit;
-
- /* when we turn to the right, the inside side is 0 */
- /* otherwise, the inside side is 1 */
- inside_side = ( turn < 0 );
-
- /* process the inside side */
- error = ft_stroker_inside( stroker, inside_side, line_length );
- if ( error )
- goto Exit;
-
- /* process the outside side */
- error = ft_stroker_outside( stroker, !inside_side, line_length );
-
- Exit:
- return error;
- }
-
-
- /* add two points to the left and right borders corresponding to the */
- /* start of the subpath */
- static FT_Error
- ft_stroker_subpath_start( FT_Stroker stroker,
- FT_Angle start_angle,
- FT_Fixed line_length )
- {
- FT_Vector delta;
- FT_Vector point;
- FT_Error error;
- FT_StrokeBorder border;
-
-
- FT_Vector_From_Polar( &delta, stroker->radius,
- start_angle + FT_ANGLE_PI2 );
-
- point.x = stroker->center.x + delta.x;
- point.y = stroker->center.y + delta.y;
-
- border = stroker->borders;
- error = ft_stroke_border_moveto( border, &point );
- if ( error )
- goto Exit;
-
- point.x = stroker->center.x - delta.x;
- point.y = stroker->center.y - delta.y;
-
- border++;
- error = ft_stroke_border_moveto( border, &point );
-
- /* save angle, position, and line length for last join */
- /* (line_length is zero for curves) */
- stroker->subpath_angle = start_angle;
- stroker->first_point = FALSE;
- stroker->subpath_line_length = line_length;
-
- Exit:
- return error;
- }
-
-
- /* documentation is in ftstroke.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Stroker_LineTo( FT_Stroker stroker,
- FT_Vector* to )
- {
- FT_Error error = FT_Err_Ok;
- FT_StrokeBorder border;
- FT_Vector delta;
- FT_Angle angle;
- FT_Int side;
- FT_Fixed line_length;
-
-
- if ( !stroker || !to )
- return FT_THROW( Invalid_Argument );
-
- delta.x = to->x - stroker->center.x;
- delta.y = to->y - stroker->center.y;
-
- /* a zero-length lineto is a no-op; avoid creating a spurious corner */
- if ( delta.x == 0 && delta.y == 0 )
- goto Exit;
-
- /* compute length of line */
- line_length = FT_Vector_Length( &delta );
-
- angle = FT_Atan2( delta.x, delta.y );
- FT_Vector_From_Polar( &delta, stroker->radius, angle + FT_ANGLE_PI2 );
-
- /* process corner if necessary */
- if ( stroker->first_point )
- {
- /* This is the first segment of a subpath. We need to */
- /* add a point to each border at their respective starting */
- /* point locations. */
- error = ft_stroker_subpath_start( stroker, angle, line_length );
- if ( error )
- goto Exit;
- }
- else
- {
- /* process the current corner */
- stroker->angle_out = angle;
- error = ft_stroker_process_corner( stroker, line_length );
- if ( error )
- goto Exit;
- }
-
- /* now add a line segment to both the `inside' and `outside' paths */
- for ( border = stroker->borders, side = 1; side >= 0; side--, border++ )
- {
- FT_Vector point;
-
-
- point.x = to->x + delta.x;
- point.y = to->y + delta.y;
-
- /* the ends of lineto borders are movable */
- error = ft_stroke_border_lineto( border, &point, TRUE );
- if ( error )
- goto Exit;
-
- delta.x = -delta.x;
- delta.y = -delta.y;
- }
-
- stroker->angle_in = angle;
- stroker->center = *to;
- stroker->line_length = line_length;
-
- Exit:
- return error;
- }
-
-
- /* documentation is in ftstroke.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Stroker_ConicTo( FT_Stroker stroker,
- FT_Vector* control,
- FT_Vector* to )
- {
- FT_Error error = FT_Err_Ok;
- FT_Vector bez_stack[34];
- FT_Vector* arc;
- FT_Vector* limit = bez_stack + 30;
- FT_Bool first_arc = TRUE;
-
-
- if ( !stroker || !control || !to )
- {
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- /* if all control points are coincident, this is a no-op; */
- /* avoid creating a spurious corner */
- if ( FT_IS_SMALL( stroker->center.x - control->x ) &&
- FT_IS_SMALL( stroker->center.y - control->y ) &&
- FT_IS_SMALL( control->x - to->x ) &&
- FT_IS_SMALL( control->y - to->y ) )
- {
- stroker->center = *to;
- goto Exit;
- }
-
- arc = bez_stack;
- arc[0] = *to;
- arc[1] = *control;
- arc[2] = stroker->center;
-
- while ( arc >= bez_stack )
- {
- FT_Angle angle_in, angle_out;
-
-
- /* initialize with current direction */
- angle_in = angle_out = stroker->angle_in;
-
- if ( arc < limit &&
- !ft_conic_is_small_enough( arc, &angle_in, &angle_out ) )
- {
- if ( stroker->first_point )
- stroker->angle_in = angle_in;
-
- ft_conic_split( arc );
- arc += 2;
- continue;
- }
-
- if ( first_arc )
- {
- first_arc = FALSE;
-
- /* process corner if necessary */
- if ( stroker->first_point )
- error = ft_stroker_subpath_start( stroker, angle_in, 0 );
- else
- {
- stroker->angle_out = angle_in;
- error = ft_stroker_process_corner( stroker, 0 );
- }
- }
- else if ( ft_pos_abs( FT_Angle_Diff( stroker->angle_in, angle_in ) ) >
- FT_SMALL_CONIC_THRESHOLD / 4 )
- {
- /* if the deviation from one arc to the next is too great, */
- /* add a round corner */
- stroker->center = arc[2];
- stroker->angle_out = angle_in;
- stroker->line_join = FT_STROKER_LINEJOIN_ROUND;
-
- error = ft_stroker_process_corner( stroker, 0 );
-
- /* reinstate line join style */
- stroker->line_join = stroker->line_join_saved;
- }
-
- if ( error )
- goto Exit;
-
- /* the arc's angle is small enough; we can add it directly to each */
- /* border */
- {
- FT_Vector ctrl, end;
- FT_Angle theta, phi, rotate, alpha0 = 0;
- FT_Fixed length;
- FT_StrokeBorder border;
- FT_Int side;
-
-
- theta = FT_Angle_Diff( angle_in, angle_out ) / 2;
- phi = angle_in + theta;
- length = FT_DivFix( stroker->radius, FT_Cos( theta ) );
-
- /* compute direction of original arc */
- if ( stroker->handle_wide_strokes )
- alpha0 = FT_Atan2( arc[0].x - arc[2].x, arc[0].y - arc[2].y );
-
- for ( border = stroker->borders, side = 0;
- side <= 1;
- side++, border++ )
- {
- rotate = FT_SIDE_TO_ROTATE( side );
-
- /* compute control point */
- FT_Vector_From_Polar( &ctrl, length, phi + rotate );
- ctrl.x += arc[1].x;
- ctrl.y += arc[1].y;
-
- /* compute end point */
- FT_Vector_From_Polar( &end, stroker->radius, angle_out + rotate );
- end.x += arc[0].x;
- end.y += arc[0].y;
-
- if ( stroker->handle_wide_strokes )
- {
- FT_Vector start;
- FT_Angle alpha1;
-
-
- /* determine whether the border radius is greater than the */
- /* radius of curvature of the original arc */
- start = border->points[border->num_points - 1];
-
- alpha1 = FT_Atan2( end.x - start.x, end.y - start.y );
-
- /* is the direction of the border arc opposite to */
- /* that of the original arc? */
- if ( ft_pos_abs( FT_Angle_Diff( alpha0, alpha1 ) ) >
- FT_ANGLE_PI / 2 )
- {
- FT_Angle beta, gamma;
- FT_Vector bvec, delta;
- FT_Fixed blen, sinA, sinB, alen;
-
-
- /* use the sine rule to find the intersection point */
- beta = FT_Atan2( arc[2].x - start.x, arc[2].y - start.y );
- gamma = FT_Atan2( arc[0].x - end.x, arc[0].y - end.y );
-
- bvec.x = end.x - start.x;
- bvec.y = end.y - start.y;
-
- blen = FT_Vector_Length( &bvec );
-
- sinA = ft_pos_abs( FT_Sin( alpha1 - gamma ) );
- sinB = ft_pos_abs( FT_Sin( beta - gamma ) );
-
- alen = FT_MulDiv( blen, sinA, sinB );
-
- FT_Vector_From_Polar( &delta, alen, beta );
- delta.x += start.x;
- delta.y += start.y;
-
- /* circumnavigate the negative sector backwards */
- border->movable = FALSE;
- error = ft_stroke_border_lineto( border, &delta, FALSE );
- if ( error )
- goto Exit;
- error = ft_stroke_border_lineto( border, &end, FALSE );
- if ( error )
- goto Exit;
- error = ft_stroke_border_conicto( border, &ctrl, &start );
- if ( error )
- goto Exit;
- /* and then move to the endpoint */
- error = ft_stroke_border_lineto( border, &end, FALSE );
- if ( error )
- goto Exit;
-
- continue;
- }
-
- /* else fall through */
- }
-
- /* simply add an arc */
- error = ft_stroke_border_conicto( border, &ctrl, &end );
- if ( error )
- goto Exit;
- }
- }
-
- arc -= 2;
-
- stroker->angle_in = angle_out;
- }
-
- stroker->center = *to;
-
- Exit:
- return error;
- }
-
-
- /* documentation is in ftstroke.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Stroker_CubicTo( FT_Stroker stroker,
- FT_Vector* control1,
- FT_Vector* control2,
- FT_Vector* to )
- {
- FT_Error error = FT_Err_Ok;
- FT_Vector bez_stack[37];
- FT_Vector* arc;
- FT_Vector* limit = bez_stack + 32;
- FT_Bool first_arc = TRUE;
-
-
- if ( !stroker || !control1 || !control2 || !to )
- {
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- /* if all control points are coincident, this is a no-op; */
- /* avoid creating a spurious corner */
- if ( FT_IS_SMALL( stroker->center.x - control1->x ) &&
- FT_IS_SMALL( stroker->center.y - control1->y ) &&
- FT_IS_SMALL( control1->x - control2->x ) &&
- FT_IS_SMALL( control1->y - control2->y ) &&
- FT_IS_SMALL( control2->x - to->x ) &&
- FT_IS_SMALL( control2->y - to->y ) )
- {
- stroker->center = *to;
- goto Exit;
- }
-
- arc = bez_stack;
- arc[0] = *to;
- arc[1] = *control2;
- arc[2] = *control1;
- arc[3] = stroker->center;
-
- while ( arc >= bez_stack )
- {
- FT_Angle angle_in, angle_mid, angle_out;
-
-
- /* initialize with current direction */
- angle_in = angle_out = angle_mid = stroker->angle_in;
-
- if ( arc < limit &&
- !ft_cubic_is_small_enough( arc, &angle_in,
- &angle_mid, &angle_out ) )
- {
- if ( stroker->first_point )
- stroker->angle_in = angle_in;
-
- ft_cubic_split( arc );
- arc += 3;
- continue;
- }
-
- if ( first_arc )
- {
- first_arc = FALSE;
-
- /* process corner if necessary */
- if ( stroker->first_point )
- error = ft_stroker_subpath_start( stroker, angle_in, 0 );
- else
- {
- stroker->angle_out = angle_in;
- error = ft_stroker_process_corner( stroker, 0 );
- }
- }
- else if ( ft_pos_abs( FT_Angle_Diff( stroker->angle_in, angle_in ) ) >
- FT_SMALL_CUBIC_THRESHOLD / 4 )
- {
- /* if the deviation from one arc to the next is too great, */
- /* add a round corner */
- stroker->center = arc[3];
- stroker->angle_out = angle_in;
- stroker->line_join = FT_STROKER_LINEJOIN_ROUND;
-
- error = ft_stroker_process_corner( stroker, 0 );
-
- /* reinstate line join style */
- stroker->line_join = stroker->line_join_saved;
- }
-
- if ( error )
- goto Exit;
-
- /* the arc's angle is small enough; we can add it directly to each */
- /* border */
- {
- FT_Vector ctrl1, ctrl2, end;
- FT_Angle theta1, phi1, theta2, phi2, rotate, alpha0 = 0;
- FT_Fixed length1, length2;
- FT_StrokeBorder border;
- FT_Int side;
-
-
- theta1 = FT_Angle_Diff( angle_in, angle_mid ) / 2;
- theta2 = FT_Angle_Diff( angle_mid, angle_out ) / 2;
- phi1 = ft_angle_mean( angle_in, angle_mid );
- phi2 = ft_angle_mean( angle_mid, angle_out );
- length1 = FT_DivFix( stroker->radius, FT_Cos( theta1 ) );
- length2 = FT_DivFix( stroker->radius, FT_Cos( theta2 ) );
-
- /* compute direction of original arc */
- if ( stroker->handle_wide_strokes )
- alpha0 = FT_Atan2( arc[0].x - arc[3].x, arc[0].y - arc[3].y );
-
- for ( border = stroker->borders, side = 0;
- side <= 1;
- side++, border++ )
- {
- rotate = FT_SIDE_TO_ROTATE( side );
-
- /* compute control points */
- FT_Vector_From_Polar( &ctrl1, length1, phi1 + rotate );
- ctrl1.x += arc[2].x;
- ctrl1.y += arc[2].y;
-
- FT_Vector_From_Polar( &ctrl2, length2, phi2 + rotate );
- ctrl2.x += arc[1].x;
- ctrl2.y += arc[1].y;
-
- /* compute end point */
- FT_Vector_From_Polar( &end, stroker->radius, angle_out + rotate );
- end.x += arc[0].x;
- end.y += arc[0].y;
-
- if ( stroker->handle_wide_strokes )
- {
- FT_Vector start;
- FT_Angle alpha1;
-
-
- /* determine whether the border radius is greater than the */
- /* radius of curvature of the original arc */
- start = border->points[border->num_points - 1];
-
- alpha1 = FT_Atan2( end.x - start.x, end.y - start.y );
-
- /* is the direction of the border arc opposite to */
- /* that of the original arc? */
- if ( ft_pos_abs( FT_Angle_Diff( alpha0, alpha1 ) ) >
- FT_ANGLE_PI / 2 )
- {
- FT_Angle beta, gamma;
- FT_Vector bvec, delta;
- FT_Fixed blen, sinA, sinB, alen;
-
-
- /* use the sine rule to find the intersection point */
- beta = FT_Atan2( arc[3].x - start.x, arc[3].y - start.y );
- gamma = FT_Atan2( arc[0].x - end.x, arc[0].y - end.y );
-
- bvec.x = end.x - start.x;
- bvec.y = end.y - start.y;
-
- blen = FT_Vector_Length( &bvec );
-
- sinA = ft_pos_abs( FT_Sin( alpha1 - gamma ) );
- sinB = ft_pos_abs( FT_Sin( beta - gamma ) );
-
- alen = FT_MulDiv( blen, sinA, sinB );
-
- FT_Vector_From_Polar( &delta, alen, beta );
- delta.x += start.x;
- delta.y += start.y;
-
- /* circumnavigate the negative sector backwards */
- border->movable = FALSE;
- error = ft_stroke_border_lineto( border, &delta, FALSE );
- if ( error )
- goto Exit;
- error = ft_stroke_border_lineto( border, &end, FALSE );
- if ( error )
- goto Exit;
- error = ft_stroke_border_cubicto( border,
- &ctrl2,
- &ctrl1,
- &start );
- if ( error )
- goto Exit;
- /* and then move to the endpoint */
- error = ft_stroke_border_lineto( border, &end, FALSE );
- if ( error )
- goto Exit;
-
- continue;
- }
-
- /* else fall through */
- }
-
- /* simply add an arc */
- error = ft_stroke_border_cubicto( border, &ctrl1, &ctrl2, &end );
- if ( error )
- goto Exit;
- }
- }
-
- arc -= 3;
-
- stroker->angle_in = angle_out;
- }
-
- stroker->center = *to;
-
- Exit:
- return error;
- }
-
-
- /* documentation is in ftstroke.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Stroker_BeginSubPath( FT_Stroker stroker,
- FT_Vector* to,
- FT_Bool open )
- {
- if ( !stroker || !to )
- return FT_THROW( Invalid_Argument );
-
- /* We cannot process the first point, because there is not enough */
- /* information regarding its corner/cap. The latter will be processed */
- /* in the `FT_Stroker_EndSubPath' routine. */
- /* */
- stroker->first_point = TRUE;
- stroker->center = *to;
- stroker->subpath_open = open;
-
- /* Determine if we need to check whether the border radius is greater */
- /* than the radius of curvature of a curve, to handle this case */
- /* specially. This is only required if bevel joins or butt caps may */
- /* be created, because round & miter joins and round & square caps */
- /* cover the negative sector created with wide strokes. */
- stroker->handle_wide_strokes =
- FT_BOOL( stroker->line_join != FT_STROKER_LINEJOIN_ROUND ||
- ( stroker->subpath_open &&
- stroker->line_cap == FT_STROKER_LINECAP_BUTT ) );
-
- /* record the subpath start point for each border */
- stroker->subpath_start = *to;
-
- stroker->angle_in = 0;
-
- return FT_Err_Ok;
- }
-
-
- static FT_Error
- ft_stroker_add_reverse_left( FT_Stroker stroker,
- FT_Bool open )
- {
- FT_StrokeBorder right = stroker->borders + 0;
- FT_StrokeBorder left = stroker->borders + 1;
- FT_Int new_points;
- FT_Error error = FT_Err_Ok;
-
-
- FT_ASSERT( left->start >= 0 );
-
- new_points = (FT_Int)left->num_points - left->start;
- if ( new_points > 0 )
- {
- error = ft_stroke_border_grow( right, (FT_UInt)new_points );
- if ( error )
- goto Exit;
-
- {
- FT_Vector* dst_point = right->points + right->num_points;
- FT_Byte* dst_tag = right->tags + right->num_points;
- FT_Vector* src_point = left->points + left->num_points - 1;
- FT_Byte* src_tag = left->tags + left->num_points - 1;
-
-
- while ( src_point >= left->points + left->start )
- {
- *dst_point = *src_point;
- *dst_tag = *src_tag;
-
- if ( open )
- dst_tag[0] &= ~FT_STROKE_TAG_BEGIN_END;
- else
- {
- FT_Byte ttag =
- (FT_Byte)( dst_tag[0] & FT_STROKE_TAG_BEGIN_END );
-
-
- /* switch begin/end tags if necessary */
- if ( ttag == FT_STROKE_TAG_BEGIN ||
- ttag == FT_STROKE_TAG_END )
- dst_tag[0] ^= FT_STROKE_TAG_BEGIN_END;
- }
-
- src_point--;
- src_tag--;
- dst_point++;
- dst_tag++;
- }
- }
-
- left->num_points = (FT_UInt)left->start;
- right->num_points += (FT_UInt)new_points;
-
- right->movable = FALSE;
- left->movable = FALSE;
- }
-
- Exit:
- return error;
- }
-
-
- /* documentation is in ftstroke.h */
-
- /* there's a lot of magic in this function! */
- FT_EXPORT_DEF( FT_Error )
- FT_Stroker_EndSubPath( FT_Stroker stroker )
- {
- FT_Error error = FT_Err_Ok;
-
-
- if ( !stroker )
- {
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- if ( stroker->subpath_open )
- {
- FT_StrokeBorder right = stroker->borders;
-
-
- /* All right, this is an opened path, we need to add a cap between */
- /* right & left, add the reverse of left, then add a final cap */
- /* between left & right. */
- error = ft_stroker_cap( stroker, stroker->angle_in, 0 );
- if ( error )
- goto Exit;
-
- /* add reversed points from `left' to `right' */
- error = ft_stroker_add_reverse_left( stroker, TRUE );
- if ( error )
- goto Exit;
-
- /* now add the final cap */
- stroker->center = stroker->subpath_start;
- error = ft_stroker_cap( stroker,
- stroker->subpath_angle + FT_ANGLE_PI, 0 );
- if ( error )
- goto Exit;
-
- /* Now end the right subpath accordingly. The left one is */
- /* rewind and doesn't need further processing. */
- ft_stroke_border_close( right, FALSE );
- }
- else
- {
- FT_Angle turn;
- FT_Int inside_side;
-
-
- /* close the path if needed */
- if ( stroker->center.x != stroker->subpath_start.x ||
- stroker->center.y != stroker->subpath_start.y )
- {
- error = FT_Stroker_LineTo( stroker, &stroker->subpath_start );
- if ( error )
- goto Exit;
- }
-
- /* process the corner */
- stroker->angle_out = stroker->subpath_angle;
- turn = FT_Angle_Diff( stroker->angle_in,
- stroker->angle_out );
-
- /* no specific corner processing is required if the turn is 0 */
- if ( turn != 0 )
- {
- /* when we turn to the right, the inside side is 0 */
- /* otherwise, the inside side is 1 */
- inside_side = ( turn < 0 );
-
- error = ft_stroker_inside( stroker,
- inside_side,
- stroker->subpath_line_length );
- if ( error )
- goto Exit;
-
- /* process the outside side */
- error = ft_stroker_outside( stroker,
- !inside_side,
- stroker->subpath_line_length );
- if ( error )
- goto Exit;
- }
-
- /* then end our two subpaths */
- ft_stroke_border_close( stroker->borders + 0, FALSE );
- ft_stroke_border_close( stroker->borders + 1, TRUE );
- }
-
- Exit:
- return error;
- }
-
-
- /* documentation is in ftstroke.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Stroker_GetBorderCounts( FT_Stroker stroker,
- FT_StrokerBorder border,
- FT_UInt *anum_points,
- FT_UInt *anum_contours )
- {
- FT_UInt num_points = 0, num_contours = 0;
- FT_Error error;
-
-
- if ( !stroker || border > 1 )
- {
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- error = ft_stroke_border_get_counts( stroker->borders + border,
- &num_points, &num_contours );
- Exit:
- if ( anum_points )
- *anum_points = num_points;
-
- if ( anum_contours )
- *anum_contours = num_contours;
-
- return error;
- }
-
-
- /* documentation is in ftstroke.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Stroker_GetCounts( FT_Stroker stroker,
- FT_UInt *anum_points,
- FT_UInt *anum_contours )
- {
- FT_UInt count1, count2, num_points = 0;
- FT_UInt count3, count4, num_contours = 0;
- FT_Error error;
-
-
- if ( !stroker )
- {
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- error = ft_stroke_border_get_counts( stroker->borders + 0,
- &count1, &count2 );
- if ( error )
- goto Exit;
-
- error = ft_stroke_border_get_counts( stroker->borders + 1,
- &count3, &count4 );
- if ( error )
- goto Exit;
-
- num_points = count1 + count3;
- num_contours = count2 + count4;
-
- Exit:
- if ( anum_points )
- *anum_points = num_points;
-
- if ( anum_contours )
- *anum_contours = num_contours;
-
- return error;
- }
-
-
- /* documentation is in ftstroke.h */
-
- FT_EXPORT_DEF( void )
- FT_Stroker_ExportBorder( FT_Stroker stroker,
- FT_StrokerBorder border,
- FT_Outline* outline )
- {
- if ( !stroker || !outline )
- return;
-
- if ( border == FT_STROKER_BORDER_LEFT ||
- border == FT_STROKER_BORDER_RIGHT )
- {
- FT_StrokeBorder sborder = & stroker->borders[border];
-
-
- if ( sborder->valid )
- ft_stroke_border_export( sborder, outline );
- }
- }
-
-
- /* documentation is in ftstroke.h */
-
- FT_EXPORT_DEF( void )
- FT_Stroker_Export( FT_Stroker stroker,
- FT_Outline* outline )
- {
- FT_Stroker_ExportBorder( stroker, FT_STROKER_BORDER_LEFT, outline );
- FT_Stroker_ExportBorder( stroker, FT_STROKER_BORDER_RIGHT, outline );
- }
-
-
- /* documentation is in ftstroke.h */
-
- /*
- * The following is very similar to FT_Outline_Decompose, except
- * that we do support opened paths, and do not scale the outline.
- */
- FT_EXPORT_DEF( FT_Error )
- FT_Stroker_ParseOutline( FT_Stroker stroker,
- FT_Outline* outline,
- FT_Bool opened )
- {
- FT_Vector v_last;
- FT_Vector v_control;
- FT_Vector v_start;
-
- FT_Vector* point;
- FT_Vector* limit;
- char* tags;
-
- FT_Error error;
-
- FT_Int n; /* index of contour in outline */
- FT_UInt first; /* index of first point in contour */
- FT_Int tag; /* current point's state */
-
-
- if ( !outline )
- return FT_THROW( Invalid_Outline );
-
- if ( !stroker )
- return FT_THROW( Invalid_Argument );
-
- FT_Stroker_Rewind( stroker );
-
- first = 0;
-
- for ( n = 0; n < outline->n_contours; n++ )
- {
- FT_UInt last; /* index of last point in contour */
-
-
- last = (FT_UInt)outline->contours[n];
- limit = outline->points + last;
-
- /* skip empty points; we don't stroke these */
- if ( last <= first )
- {
- first = last + 1;
- continue;
- }
-
- v_start = outline->points[first];
- v_last = outline->points[last];
-
- v_control = v_start;
-
- point = outline->points + first;
- tags = outline->tags + first;
- tag = FT_CURVE_TAG( tags[0] );
-
- /* A contour cannot start with a cubic control point! */
- if ( tag == FT_CURVE_TAG_CUBIC )
- goto Invalid_Outline;
-
- /* check first point to determine origin */
- if ( tag == FT_CURVE_TAG_CONIC )
- {
- /* First point is conic control. Yes, this happens. */
- if ( FT_CURVE_TAG( outline->tags[last] ) == FT_CURVE_TAG_ON )
- {
- /* start at last point if it is on the curve */
- v_start = v_last;
- limit--;
- }
- else
- {
- /* if both first and last points are conic, */
- /* start at their middle */
- v_start.x = ( v_start.x + v_last.x ) / 2;
- v_start.y = ( v_start.y + v_last.y ) / 2;
- }
- point--;
- tags--;
- }
-
- error = FT_Stroker_BeginSubPath( stroker, &v_start, opened );
- if ( error )
- goto Exit;
-
- while ( point < limit )
- {
- point++;
- tags++;
-
- tag = FT_CURVE_TAG( tags[0] );
- switch ( tag )
- {
- case FT_CURVE_TAG_ON: /* emit a single line_to */
- {
- FT_Vector vec;
-
-
- vec.x = point->x;
- vec.y = point->y;
-
- error = FT_Stroker_LineTo( stroker, &vec );
- if ( error )
- goto Exit;
- continue;
- }
-
- case FT_CURVE_TAG_CONIC: /* consume conic arcs */
- v_control.x = point->x;
- v_control.y = point->y;
-
- Do_Conic:
- if ( point < limit )
- {
- FT_Vector vec;
- FT_Vector v_middle;
-
-
- point++;
- tags++;
- tag = FT_CURVE_TAG( tags[0] );
-
- vec = point[0];
-
- if ( tag == FT_CURVE_TAG_ON )
- {
- error = FT_Stroker_ConicTo( stroker, &v_control, &vec );
- if ( error )
- goto Exit;
- continue;
- }
-
- if ( tag != FT_CURVE_TAG_CONIC )
- goto Invalid_Outline;
-
- v_middle.x = ( v_control.x + vec.x ) / 2;
- v_middle.y = ( v_control.y + vec.y ) / 2;
-
- error = FT_Stroker_ConicTo( stroker, &v_control, &v_middle );
- if ( error )
- goto Exit;
-
- v_control = vec;
- goto Do_Conic;
- }
-
- error = FT_Stroker_ConicTo( stroker, &v_control, &v_start );
- goto Close;
-
- default: /* FT_CURVE_TAG_CUBIC */
- {
- FT_Vector vec1, vec2;
-
-
- if ( point + 1 > limit ||
- FT_CURVE_TAG( tags[1] ) != FT_CURVE_TAG_CUBIC )
- goto Invalid_Outline;
-
- point += 2;
- tags += 2;
-
- vec1 = point[-2];
- vec2 = point[-1];
-
- if ( point <= limit )
- {
- FT_Vector vec;
-
-
- vec = point[0];
-
- error = FT_Stroker_CubicTo( stroker, &vec1, &vec2, &vec );
- if ( error )
- goto Exit;
- continue;
- }
-
- error = FT_Stroker_CubicTo( stroker, &vec1, &vec2, &v_start );
- goto Close;
- }
- }
- }
-
- Close:
- if ( error )
- goto Exit;
-
- /* don't try to end the path if no segments have been generated */
- if ( !stroker->first_point )
- {
- error = FT_Stroker_EndSubPath( stroker );
- if ( error )
- goto Exit;
- }
-
- first = last + 1;
- }
-
- return FT_Err_Ok;
-
- Exit:
- return error;
-
- Invalid_Outline:
- return FT_THROW( Invalid_Outline );
- }
-
-
- /* documentation is in ftstroke.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Glyph_Stroke( FT_Glyph *pglyph,
- FT_Stroker stroker,
- FT_Bool destroy )
- {
- FT_Error error = FT_ERR( Invalid_Argument );
- FT_Glyph glyph = NULL;
-
- /* for FT_OUTLINE_GLYPH_CLASS_GET (in PIC mode) */
- FT_Library library = stroker->library;
-
- FT_UNUSED( library );
-
-
- if ( !pglyph )
- goto Exit;
-
- glyph = *pglyph;
- if ( !glyph || glyph->clazz != FT_OUTLINE_GLYPH_CLASS_GET )
- goto Exit;
-
- {
- FT_Glyph copy;
-
-
- error = FT_Glyph_Copy( glyph, &copy );
- if ( error )
- goto Exit;
-
- glyph = copy;
- }
-
- {
- FT_OutlineGlyph oglyph = (FT_OutlineGlyph)glyph;
- FT_Outline* outline = &oglyph->outline;
- FT_UInt num_points, num_contours;
-
-
- error = FT_Stroker_ParseOutline( stroker, outline, FALSE );
- if ( error )
- goto Fail;
-
- FT_Stroker_GetCounts( stroker, &num_points, &num_contours );
-
- FT_Outline_Done( glyph->library, outline );
-
- error = FT_Outline_New( glyph->library,
- num_points,
- (FT_Int)num_contours,
- outline );
- if ( error )
- goto Fail;
-
- outline->n_points = 0;
- outline->n_contours = 0;
-
- FT_Stroker_Export( stroker, outline );
- }
-
- if ( destroy )
- FT_Done_Glyph( *pglyph );
-
- *pglyph = glyph;
- goto Exit;
-
- Fail:
- FT_Done_Glyph( glyph );
- glyph = NULL;
-
- if ( !destroy )
- *pglyph = NULL;
-
- Exit:
- return error;
- }
-
-
- /* documentation is in ftstroke.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Glyph_StrokeBorder( FT_Glyph *pglyph,
- FT_Stroker stroker,
- FT_Bool inside,
- FT_Bool destroy )
- {
- FT_Error error = FT_ERR( Invalid_Argument );
- FT_Glyph glyph = NULL;
-
- /* for FT_OUTLINE_GLYPH_CLASS_GET (in PIC mode) */
- FT_Library library = stroker->library;
-
- FT_UNUSED( library );
-
-
- if ( !pglyph )
- goto Exit;
-
- glyph = *pglyph;
- if ( !glyph || glyph->clazz != FT_OUTLINE_GLYPH_CLASS_GET )
- goto Exit;
-
- {
- FT_Glyph copy;
-
-
- error = FT_Glyph_Copy( glyph, &copy );
- if ( error )
- goto Exit;
-
- glyph = copy;
- }
-
- {
- FT_OutlineGlyph oglyph = (FT_OutlineGlyph)glyph;
- FT_StrokerBorder border;
- FT_Outline* outline = &oglyph->outline;
- FT_UInt num_points, num_contours;
-
-
- border = FT_Outline_GetOutsideBorder( outline );
- if ( inside )
- {
- if ( border == FT_STROKER_BORDER_LEFT )
- border = FT_STROKER_BORDER_RIGHT;
- else
- border = FT_STROKER_BORDER_LEFT;
- }
-
- error = FT_Stroker_ParseOutline( stroker, outline, FALSE );
- if ( error )
- goto Fail;
-
- FT_Stroker_GetBorderCounts( stroker, border,
- &num_points, &num_contours );
-
- FT_Outline_Done( glyph->library, outline );
-
- error = FT_Outline_New( glyph->library,
- num_points,
- (FT_Int)num_contours,
- outline );
- if ( error )
- goto Fail;
-
- outline->n_points = 0;
- outline->n_contours = 0;
-
- FT_Stroker_ExportBorder( stroker, border, outline );
- }
-
- if ( destroy )
- FT_Done_Glyph( *pglyph );
-
- *pglyph = glyph;
- goto Exit;
-
- Fail:
- FT_Done_Glyph( glyph );
- glyph = NULL;
-
- if ( !destroy )
- *pglyph = NULL;
-
- Exit:
- return error;
- }
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/base/ftsynth.c b/chromium/third_party/pdfium/third_party/freetype/src/base/ftsynth.c
deleted file mode 100644
index cd685339573..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/base/ftsynth.c
+++ /dev/null
@@ -1,163 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftsynth.c */
-/* */
-/* FreeType synthesizing code for emboldening and slanting (body). */
-/* */
-/* Copyright 2000-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_SYNTHESIS_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_OUTLINE_H
-#include FT_BITMAP_H
-
-
- /*************************************************************************/
- /* */
- /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
- /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
- /* messages during execution. */
- /* */
-#undef FT_COMPONENT
-#define FT_COMPONENT trace_synth
-
-
- /*************************************************************************/
- /*************************************************************************/
- /**** ****/
- /**** EXPERIMENTAL OBLIQUING SUPPORT ****/
- /**** ****/
- /*************************************************************************/
- /*************************************************************************/
-
- /* documentation is in ftsynth.h */
-
- FT_EXPORT_DEF( void )
- FT_GlyphSlot_Oblique( FT_GlyphSlot slot )
- {
- FT_Matrix transform;
- FT_Outline* outline;
-
-
- if ( !slot )
- return;
-
- outline = &slot->outline;
-
- /* only oblique outline glyphs */
- if ( slot->format != FT_GLYPH_FORMAT_OUTLINE )
- return;
-
- /* we don't touch the advance width */
-
- /* For italic, simply apply a shear transform, with an angle */
- /* of about 12 degrees. */
-
- transform.xx = 0x10000L;
- transform.yx = 0x00000L;
-
- transform.xy = 0x0366AL;
- transform.yy = 0x10000L;
-
- FT_Outline_Transform( outline, &transform );
- }
-
-
- /*************************************************************************/
- /*************************************************************************/
- /**** ****/
- /**** EXPERIMENTAL EMBOLDENING SUPPORT ****/
- /**** ****/
- /*************************************************************************/
- /*************************************************************************/
-
-
- /* documentation is in ftsynth.h */
-
- FT_EXPORT_DEF( void )
- FT_GlyphSlot_Embolden( FT_GlyphSlot slot )
- {
- FT_Library library;
- FT_Face face;
- FT_Error error;
- FT_Pos xstr, ystr;
-
-
- if ( !slot )
- return;
-
- library = slot->library;
- face = slot->face;
-
- if ( slot->format != FT_GLYPH_FORMAT_OUTLINE &&
- slot->format != FT_GLYPH_FORMAT_BITMAP )
- return;
-
- /* some reasonable strength */
- xstr = FT_MulFix( face->units_per_EM,
- face->size->metrics.y_scale ) / 24;
- ystr = xstr;
-
- if ( slot->format == FT_GLYPH_FORMAT_OUTLINE )
- FT_Outline_EmboldenXY( &slot->outline, xstr, ystr );
-
- else /* slot->format == FT_GLYPH_FORMAT_BITMAP */
- {
- /* round to full pixels */
- xstr &= ~63;
- if ( xstr == 0 )
- xstr = 1 << 6;
- ystr &= ~63;
-
- /*
- * XXX: overflow check for 16-bit system, for compatibility
- * with FT_GlyphSlot_Embolden() since freetype-2.1.10.
- * unfortunately, this function return no informations
- * about the cause of error.
- */
- if ( ( ystr >> 6 ) > FT_INT_MAX || ( ystr >> 6 ) < FT_INT_MIN )
- {
- FT_TRACE1(( "FT_GlyphSlot_Embolden:" ));
- FT_TRACE1(( "too strong embolding parameter ystr=%d\n", ystr ));
- return;
- }
- error = FT_GlyphSlot_Own_Bitmap( slot );
- if ( error )
- return;
-
- error = FT_Bitmap_Embolden( library, &slot->bitmap, xstr, ystr );
- if ( error )
- return;
- }
-
- if ( slot->advance.x )
- slot->advance.x += xstr;
-
- if ( slot->advance.y )
- slot->advance.y += ystr;
-
- slot->metrics.width += xstr;
- slot->metrics.height += ystr;
- slot->metrics.horiAdvance += xstr;
- slot->metrics.vertAdvance += ystr;
- slot->metrics.horiBearingY += ystr;
-
- /* XXX: 16-bit overflow case must be excluded before here */
- if ( slot->format == FT_GLYPH_FORMAT_BITMAP )
- slot->bitmap_top += (FT_Int)( ystr >> 6 );
- }
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/base/ftsystem.c b/chromium/third_party/pdfium/third_party/freetype/src/base/ftsystem.c
deleted file mode 100644
index 1938fd8917c..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/base/ftsystem.c
+++ /dev/null
@@ -1,320 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftsystem.c */
-/* */
-/* ANSI-specific FreeType low-level system interface (body). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
- /*************************************************************************/
- /* */
- /* This file contains the default interface used by FreeType to access */
- /* low-level, i.e. memory management, i/o access as well as thread */
- /* synchronisation. It can be replaced by user-specific routines if */
- /* necessary. */
- /* */
- /*************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_CONFIG_CONFIG_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_SYSTEM_H
-#include FT_ERRORS_H
-#include FT_TYPES_H
-
-
- /*************************************************************************/
- /* */
- /* MEMORY MANAGEMENT INTERFACE */
- /* */
- /*************************************************************************/
-
- /*************************************************************************/
- /* */
- /* It is not necessary to do any error checking for the */
- /* allocation-related functions. This will be done by the higher level */
- /* routines like ft_mem_alloc() or ft_mem_realloc(). */
- /* */
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* ft_alloc */
- /* */
- /* <Description> */
- /* The memory allocation function. */
- /* */
- /* <Input> */
- /* memory :: A pointer to the memory object. */
- /* */
- /* size :: The requested size in bytes. */
- /* */
- /* <Return> */
- /* The address of newly allocated block. */
- /* */
- FT_CALLBACK_DEF( void* )
- ft_alloc( FT_Memory memory,
- long size )
- {
- FT_UNUSED( memory );
-
- return ft_smalloc( (size_t)size );
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* ft_realloc */
- /* */
- /* <Description> */
- /* The memory reallocation function. */
- /* */
- /* <Input> */
- /* memory :: A pointer to the memory object. */
- /* */
- /* cur_size :: The current size of the allocated memory block. */
- /* */
- /* new_size :: The newly requested size in bytes. */
- /* */
- /* block :: The current address of the block in memory. */
- /* */
- /* <Return> */
- /* The address of the reallocated memory block. */
- /* */
- FT_CALLBACK_DEF( void* )
- ft_realloc( FT_Memory memory,
- long cur_size,
- long new_size,
- void* block )
- {
- FT_UNUSED( memory );
- FT_UNUSED( cur_size );
-
- return ft_srealloc( block, (size_t)new_size );
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* ft_free */
- /* */
- /* <Description> */
- /* The memory release function. */
- /* */
- /* <Input> */
- /* memory :: A pointer to the memory object. */
- /* */
- /* block :: The address of block in memory to be freed. */
- /* */
- FT_CALLBACK_DEF( void )
- ft_free( FT_Memory memory,
- void* block )
- {
- FT_UNUSED( memory );
-
- ft_sfree( block );
- }
-
-
- /*************************************************************************/
- /* */
- /* RESOURCE MANAGEMENT INTERFACE */
- /* */
- /*************************************************************************/
-
-#ifndef FT_CONFIG_OPTION_DISABLE_STREAM_SUPPORT
-
- /*************************************************************************/
- /* */
- /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
- /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
- /* messages during execution. */
- /* */
-#undef FT_COMPONENT
-#define FT_COMPONENT trace_io
-
- /* We use the macro STREAM_FILE for convenience to extract the */
- /* system-specific stream handle from a given FreeType stream object */
-#define STREAM_FILE( stream ) ( (FT_FILE*)stream->descriptor.pointer )
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* ft_ansi_stream_close */
- /* */
- /* <Description> */
- /* The function to close a stream. */
- /* */
- /* <Input> */
- /* stream :: A pointer to the stream object. */
- /* */
- FT_CALLBACK_DEF( void )
- ft_ansi_stream_close( FT_Stream stream )
- {
- ft_fclose( STREAM_FILE( stream ) );
-
- stream->descriptor.pointer = NULL;
- stream->size = 0;
- stream->base = NULL;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* ft_ansi_stream_io */
- /* */
- /* <Description> */
- /* The function to open a stream. */
- /* */
- /* <Input> */
- /* stream :: A pointer to the stream object. */
- /* */
- /* offset :: The position in the data stream to start reading. */
- /* */
- /* buffer :: The address of buffer to store the read data. */
- /* */
- /* count :: The number of bytes to read from the stream. */
- /* */
- /* <Return> */
- /* The number of bytes actually read. If `count' is zero (this is, */
- /* the function is used for seeking), a non-zero return value */
- /* indicates an error. */
- /* */
- FT_CALLBACK_DEF( unsigned long )
- ft_ansi_stream_io( FT_Stream stream,
- unsigned long offset,
- unsigned char* buffer,
- unsigned long count )
- {
- FT_FILE* file;
-
-
- if ( !count && offset > stream->size )
- return 1;
-
- file = STREAM_FILE( stream );
-
- if ( stream->pos != offset )
- ft_fseek( file, (long)offset, SEEK_SET );
-
- return (unsigned long)ft_fread( buffer, 1, count, file );
- }
-
-
- /* documentation is in ftstream.h */
-
- FT_BASE_DEF( FT_Error )
- FT_Stream_Open( FT_Stream stream,
- const char* filepathname )
- {
- FT_FILE* file;
-
-
- if ( !stream )
- return FT_THROW( Invalid_Stream_Handle );
-
- stream->descriptor.pointer = NULL;
- stream->pathname.pointer = (char*)filepathname;
- stream->base = NULL;
- stream->pos = 0;
- stream->read = NULL;
- stream->close = NULL;
-
- file = ft_fopen( filepathname, "rb" );
- if ( !file )
- {
- FT_ERROR(( "FT_Stream_Open:"
- " could not open `%s'\n", filepathname ));
-
- return FT_THROW( Cannot_Open_Resource );
- }
-
- ft_fseek( file, 0, SEEK_END );
- stream->size = (unsigned long)ft_ftell( file );
- if ( !stream->size )
- {
- FT_ERROR(( "FT_Stream_Open:" ));
- FT_ERROR(( " opened `%s' but zero-sized\n", filepathname ));
- ft_fclose( file );
- return FT_THROW( Cannot_Open_Stream );
- }
- ft_fseek( file, 0, SEEK_SET );
-
- stream->descriptor.pointer = file;
- stream->read = ft_ansi_stream_io;
- stream->close = ft_ansi_stream_close;
-
- FT_TRACE1(( "FT_Stream_Open:" ));
- FT_TRACE1(( " opened `%s' (%d bytes) successfully\n",
- filepathname, stream->size ));
-
- return FT_Err_Ok;
- }
-
-#endif /* !FT_CONFIG_OPTION_DISABLE_STREAM_SUPPORT */
-
-#ifdef FT_DEBUG_MEMORY
-
- extern FT_Int
- ft_mem_debug_init( FT_Memory memory );
-
- extern void
- ft_mem_debug_done( FT_Memory memory );
-
-#endif
-
-
- /* documentation is in ftobjs.h */
-
- FT_BASE_DEF( FT_Memory )
- FT_New_Memory( void )
- {
- FT_Memory memory;
-
-
- memory = (FT_Memory)ft_smalloc( sizeof ( *memory ) );
- if ( memory )
- {
- memory->user = NULL;
- memory->alloc = ft_alloc;
- memory->realloc = ft_realloc;
- memory->free = ft_free;
-#ifdef FT_DEBUG_MEMORY
- ft_mem_debug_init( memory );
-#endif
- }
-
- return memory;
- }
-
-
- /* documentation is in ftobjs.h */
-
- FT_BASE_DEF( void )
- FT_Done_Memory( FT_Memory memory )
- {
-#ifdef FT_DEBUG_MEMORY
- ft_mem_debug_done( memory );
-#endif
- ft_sfree( memory );
- }
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/base/fttrigon.c b/chromium/third_party/pdfium/third_party/freetype/src/base/fttrigon.c
deleted file mode 100644
index 5b24304c2fc..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/base/fttrigon.c
+++ /dev/null
@@ -1,525 +0,0 @@
-/***************************************************************************/
-/* */
-/* fttrigon.c */
-/* */
-/* FreeType trigonometric functions (body). */
-/* */
-/* Copyright 2001-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
- /*************************************************************************/
- /* */
- /* This is a fixed-point CORDIC implementation of trigonometric */
- /* functions as well as transformations between Cartesian and polar */
- /* coordinates. The angles are represented as 16.16 fixed-point values */
- /* in degrees, i.e., the angular resolution is 2^-16 degrees. Note that */
- /* only vectors longer than 2^16*180/pi (or at least 22 bits) on a */
- /* discrete Cartesian grid can have the same or better angular */
- /* resolution. Therefore, to maintain this precision, some functions */
- /* require an interim upscaling of the vectors, whereas others operate */
- /* with 24-bit long vectors directly. */
- /* */
- /*************************************************************************/
-
-#include <ft2build.h>
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_CALC_H
-#include FT_TRIGONOMETRY_H
-
-
- /* the Cordic shrink factor 0.858785336480436 * 2^32 */
-#define FT_TRIG_SCALE 0xDBD95B16UL
-
- /* the highest bit in overflow-safe vector components, */
- /* MSB of 0.858785336480436 * sqrt(0.5) * 2^30 */
-#define FT_TRIG_SAFE_MSB 29
-
- /* this table was generated for FT_PI = 180L << 16, i.e. degrees */
-#define FT_TRIG_MAX_ITERS 23
-
- static const FT_Angle
- ft_trig_arctan_table[] =
- {
- 1740967L, 919879L, 466945L, 234379L, 117304L, 58666L, 29335L,
- 14668L, 7334L, 3667L, 1833L, 917L, 458L, 229L, 115L,
- 57L, 29L, 14L, 7L, 4L, 2L, 1L
- };
-
-
-#ifdef FT_LONG64
-
- /* multiply a given value by the CORDIC shrink factor */
- static FT_Fixed
- ft_trig_downscale( FT_Fixed val )
- {
- FT_Int s = 1;
-
-
- if ( val < 0 )
- {
- val = -val;
- s = -1;
- }
-
- /* 0x40000000 comes from regression analysis between true */
- /* and CORDIC hypotenuse, so it minimizes the error */
- val = (FT_Fixed)( ( (FT_Int64)val * FT_TRIG_SCALE + 0x40000000UL ) >> 32 );
-
- return s < 0 ? -val : val;
- }
-
-#else /* !FT_LONG64 */
-
- /* multiply a given value by the CORDIC shrink factor */
- static FT_Fixed
- ft_trig_downscale( FT_Fixed val )
- {
- FT_Int s = 1;
- FT_UInt32 lo1, hi1, lo2, hi2, lo, hi, i1, i2;
-
-
- if ( val < 0 )
- {
- val = -val;
- s = -1;
- }
-
- lo1 = (FT_UInt32)val & 0x0000FFFFU;
- hi1 = (FT_UInt32)val >> 16;
- lo2 = FT_TRIG_SCALE & 0x0000FFFFU;
- hi2 = FT_TRIG_SCALE >> 16;
-
- lo = lo1 * lo2;
- i1 = lo1 * hi2;
- i2 = lo2 * hi1;
- hi = hi1 * hi2;
-
- /* Check carry overflow of i1 + i2 */
- i1 += i2;
- hi += (FT_UInt32)( i1 < i2 ) << 16;
-
- hi += i1 >> 16;
- i1 = i1 << 16;
-
- /* Check carry overflow of i1 + lo */
- lo += i1;
- hi += ( lo < i1 );
-
- /* 0x40000000 comes from regression analysis between true */
- /* and CORDIC hypotenuse, so it minimizes the error */
-
- /* Check carry overflow of lo + 0x40000000 */
- lo += 0x40000000UL;
- hi += ( lo < 0x40000000UL );
-
- val = (FT_Fixed)hi;
-
- return s < 0 ? -val : val;
- }
-
-#endif /* !FT_LONG64 */
-
-
- /* undefined and never called for zero vector */
- static FT_Int
- ft_trig_prenorm( FT_Vector* vec )
- {
- FT_Pos x, y;
- FT_Int shift;
-
-
- x = vec->x;
- y = vec->y;
-
- shift = FT_MSB( (FT_UInt32)( FT_ABS( x ) | FT_ABS( y ) ) );
-
- if ( shift <= FT_TRIG_SAFE_MSB )
- {
- shift = FT_TRIG_SAFE_MSB - shift;
- vec->x = (FT_Pos)( (FT_ULong)x << shift );
- vec->y = (FT_Pos)( (FT_ULong)y << shift );
- }
- else
- {
- shift -= FT_TRIG_SAFE_MSB;
- vec->x = x >> shift;
- vec->y = y >> shift;
- shift = -shift;
- }
-
- return shift;
- }
-
-
- static void
- ft_trig_pseudo_rotate( FT_Vector* vec,
- FT_Angle theta )
- {
- FT_Int i;
- FT_Fixed x, y, xtemp, b;
- const FT_Angle *arctanptr;
-
-
- x = vec->x;
- y = vec->y;
-
- /* Rotate inside [-PI/4,PI/4] sector */
- while ( theta < -FT_ANGLE_PI4 )
- {
- xtemp = y;
- y = -x;
- x = xtemp;
- theta += FT_ANGLE_PI2;
- }
-
- while ( theta > FT_ANGLE_PI4 )
- {
- xtemp = -y;
- y = x;
- x = xtemp;
- theta -= FT_ANGLE_PI2;
- }
-
- arctanptr = ft_trig_arctan_table;
-
- /* Pseudorotations, with right shifts */
- for ( i = 1, b = 1; i < FT_TRIG_MAX_ITERS; b <<= 1, i++ )
- {
- if ( theta < 0 )
- {
- xtemp = x + ( ( y + b ) >> i );
- y = y - ( ( x + b ) >> i );
- x = xtemp;
- theta += *arctanptr++;
- }
- else
- {
- xtemp = x - ( ( y + b ) >> i );
- y = y + ( ( x + b ) >> i );
- x = xtemp;
- theta -= *arctanptr++;
- }
- }
-
- vec->x = x;
- vec->y = y;
- }
-
-
- static void
- ft_trig_pseudo_polarize( FT_Vector* vec )
- {
- FT_Angle theta;
- FT_Int i;
- FT_Fixed x, y, xtemp, b;
- const FT_Angle *arctanptr;
-
-
- x = vec->x;
- y = vec->y;
-
- /* Get the vector into [-PI/4,PI/4] sector */
- if ( y > x )
- {
- if ( y > -x )
- {
- theta = FT_ANGLE_PI2;
- xtemp = y;
- y = -x;
- x = xtemp;
- }
- else
- {
- theta = y > 0 ? FT_ANGLE_PI : -FT_ANGLE_PI;
- x = -x;
- y = -y;
- }
- }
- else
- {
- if ( y < -x )
- {
- theta = -FT_ANGLE_PI2;
- xtemp = -y;
- y = x;
- x = xtemp;
- }
- else
- {
- theta = 0;
- }
- }
-
- arctanptr = ft_trig_arctan_table;
-
- /* Pseudorotations, with right shifts */
- for ( i = 1, b = 1; i < FT_TRIG_MAX_ITERS; b <<= 1, i++ )
- {
- if ( y > 0 )
- {
- xtemp = x + ( ( y + b ) >> i );
- y = y - ( ( x + b ) >> i );
- x = xtemp;
- theta += *arctanptr++;
- }
- else
- {
- xtemp = x - ( ( y + b ) >> i );
- y = y + ( ( x + b ) >> i );
- x = xtemp;
- theta -= *arctanptr++;
- }
- }
-
- /* round theta to acknowledge its error that mostly comes */
- /* from accumulated rounding errors in the arctan table */
- if ( theta >= 0 )
- theta = FT_PAD_ROUND( theta, 16 );
- else
- theta = -FT_PAD_ROUND( -theta, 16 );
-
- vec->x = x;
- vec->y = theta;
- }
-
-
- /* documentation is in fttrigon.h */
-
- FT_EXPORT_DEF( FT_Fixed )
- FT_Cos( FT_Angle angle )
- {
- FT_Vector v;
-
-
- FT_Vector_Unit( &v, angle );
-
- return v.x;
- }
-
-
- /* documentation is in fttrigon.h */
-
- FT_EXPORT_DEF( FT_Fixed )
- FT_Sin( FT_Angle angle )
- {
- FT_Vector v;
-
-
- FT_Vector_Unit( &v, angle );
-
- return v.y;
- }
-
-
- /* documentation is in fttrigon.h */
-
- FT_EXPORT_DEF( FT_Fixed )
- FT_Tan( FT_Angle angle )
- {
- FT_Vector v;
-
-
- FT_Vector_Unit( &v, angle );
-
- return FT_DivFix( v.y, v.x );
- }
-
-
- /* documentation is in fttrigon.h */
-
- FT_EXPORT_DEF( FT_Angle )
- FT_Atan2( FT_Fixed dx,
- FT_Fixed dy )
- {
- FT_Vector v;
-
-
- if ( dx == 0 && dy == 0 )
- return 0;
-
- v.x = dx;
- v.y = dy;
- ft_trig_prenorm( &v );
- ft_trig_pseudo_polarize( &v );
-
- return v.y;
- }
-
-
- /* documentation is in fttrigon.h */
-
- FT_EXPORT_DEF( void )
- FT_Vector_Unit( FT_Vector* vec,
- FT_Angle angle )
- {
- if ( !vec )
- return;
-
- vec->x = FT_TRIG_SCALE >> 8;
- vec->y = 0;
- ft_trig_pseudo_rotate( vec, angle );
- vec->x = ( vec->x + 0x80L ) >> 8;
- vec->y = ( vec->y + 0x80L ) >> 8;
- }
-
-
- /* these macros return 0 for positive numbers,
- and -1 for negative ones */
-#define FT_SIGN_LONG( x ) ( (x) >> ( FT_SIZEOF_LONG * 8 - 1 ) )
-#define FT_SIGN_INT( x ) ( (x) >> ( FT_SIZEOF_INT * 8 - 1 ) )
-#define FT_SIGN_INT32( x ) ( (x) >> 31 )
-#define FT_SIGN_INT16( x ) ( (x) >> 15 )
-
-
- /* documentation is in fttrigon.h */
-
- FT_EXPORT_DEF( void )
- FT_Vector_Rotate( FT_Vector* vec,
- FT_Angle angle )
- {
- FT_Int shift;
- FT_Vector v;
-
-
- if ( !vec || !angle )
- return;
-
- v = *vec;
-
- if ( v.x == 0 && v.y == 0 )
- return;
-
- shift = ft_trig_prenorm( &v );
- ft_trig_pseudo_rotate( &v, angle );
- v.x = ft_trig_downscale( v.x );
- v.y = ft_trig_downscale( v.y );
-
- if ( shift > 0 )
- {
- FT_Int32 half = (FT_Int32)1L << ( shift - 1 );
-
-
- vec->x = ( v.x + half + FT_SIGN_LONG( v.x ) ) >> shift;
- vec->y = ( v.y + half + FT_SIGN_LONG( v.y ) ) >> shift;
- }
- else
- {
- shift = -shift;
- vec->x = (FT_Pos)( (FT_ULong)v.x << shift );
- vec->y = (FT_Pos)( (FT_ULong)v.y << shift );
- }
- }
-
-
- /* documentation is in fttrigon.h */
-
- FT_EXPORT_DEF( FT_Fixed )
- FT_Vector_Length( FT_Vector* vec )
- {
- FT_Int shift;
- FT_Vector v;
-
-
- if ( !vec )
- return 0;
-
- v = *vec;
-
- /* handle trivial cases */
- if ( v.x == 0 )
- {
- return FT_ABS( v.y );
- }
- else if ( v.y == 0 )
- {
- return FT_ABS( v.x );
- }
-
- /* general case */
- shift = ft_trig_prenorm( &v );
- ft_trig_pseudo_polarize( &v );
-
- v.x = ft_trig_downscale( v.x );
-
- if ( shift > 0 )
- return ( v.x + ( 1L << ( shift - 1 ) ) ) >> shift;
-
- return (FT_Fixed)( (FT_UInt32)v.x << -shift );
- }
-
-
- /* documentation is in fttrigon.h */
-
- FT_EXPORT_DEF( void )
- FT_Vector_Polarize( FT_Vector* vec,
- FT_Fixed *length,
- FT_Angle *angle )
- {
- FT_Int shift;
- FT_Vector v;
-
-
- if ( !vec || !length || !angle )
- return;
-
- v = *vec;
-
- if ( v.x == 0 && v.y == 0 )
- return;
-
- shift = ft_trig_prenorm( &v );
- ft_trig_pseudo_polarize( &v );
-
- v.x = ft_trig_downscale( v.x );
-
- *length = shift >= 0 ? ( v.x >> shift )
- : (FT_Fixed)( (FT_UInt32)v.x << -shift );
- *angle = v.y;
- }
-
-
- /* documentation is in fttrigon.h */
-
- FT_EXPORT_DEF( void )
- FT_Vector_From_Polar( FT_Vector* vec,
- FT_Fixed length,
- FT_Angle angle )
- {
- if ( !vec )
- return;
-
- vec->x = length;
- vec->y = 0;
-
- FT_Vector_Rotate( vec, angle );
- }
-
-
- /* documentation is in fttrigon.h */
-
- FT_EXPORT_DEF( FT_Angle )
- FT_Angle_Diff( FT_Angle angle1,
- FT_Angle angle2 )
- {
- FT_Angle delta = angle2 - angle1;
-
-
- while ( delta <= -FT_ANGLE_PI )
- delta += FT_ANGLE_2PI;
-
- while ( delta > FT_ANGLE_PI )
- delta -= FT_ANGLE_2PI;
-
- return delta;
- }
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/base/fttype1.c b/chromium/third_party/pdfium/third_party/freetype/src/base/fttype1.c
deleted file mode 100644
index c549382afdb..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/base/fttype1.c
+++ /dev/null
@@ -1,127 +0,0 @@
-/***************************************************************************/
-/* */
-/* fttype1.c */
-/* */
-/* FreeType utility file for PS names support (body). */
-/* */
-/* Copyright 2002-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_SERVICE_H
-#include FT_SERVICE_POSTSCRIPT_INFO_H
-
-
- /* documentation is in t1tables.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Get_PS_Font_Info( FT_Face face,
- PS_FontInfoRec* afont_info )
- {
- FT_Error error;
- FT_Service_PsInfo service;
-
-
- if ( !face )
- return FT_THROW( Invalid_Face_Handle );
-
- if ( !afont_info )
- return FT_THROW( Invalid_Argument );
-
- FT_FACE_FIND_SERVICE( face, service, POSTSCRIPT_INFO );
-
- if ( service && service->ps_get_font_info )
- error = service->ps_get_font_info( face, afont_info );
- else
- error = FT_THROW( Invalid_Argument );
-
- return error;
- }
-
-
- /* documentation is in t1tables.h */
-
- FT_EXPORT_DEF( FT_Int )
- FT_Has_PS_Glyph_Names( FT_Face face )
- {
- FT_Int result = 0;
- FT_Service_PsInfo service;
-
-
- if ( face )
- {
- FT_FACE_FIND_SERVICE( face, service, POSTSCRIPT_INFO );
-
- if ( service && service->ps_has_glyph_names )
- result = service->ps_has_glyph_names( face );
- }
-
- return result;
- }
-
-
- /* documentation is in t1tables.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Get_PS_Font_Private( FT_Face face,
- PS_PrivateRec* afont_private )
- {
- FT_Error error;
- FT_Service_PsInfo service;
-
-
- if ( !face )
- return FT_THROW( Invalid_Face_Handle );
-
- if ( !afont_private )
- return FT_THROW( Invalid_Argument );
-
- FT_FACE_FIND_SERVICE( face, service, POSTSCRIPT_INFO );
-
- if ( service && service->ps_get_font_private )
- error = service->ps_get_font_private( face, afont_private );
- else
- error = FT_THROW( Invalid_Argument );
-
- return error;
- }
-
-
- /* documentation is in t1tables.h */
-
- FT_EXPORT_DEF( FT_Long )
- FT_Get_PS_Font_Value( FT_Face face,
- PS_Dict_Keys key,
- FT_UInt idx,
- void *value,
- FT_Long value_len )
- {
- FT_Int result = 0;
- FT_Service_PsInfo service = NULL;
-
-
- if ( face )
- {
- FT_FACE_FIND_SERVICE( face, service, POSTSCRIPT_INFO );
-
- if ( service && service->ps_get_font_value )
- result = service->ps_get_font_value( face, key, idx,
- value, value_len );
- }
-
- return result;
- }
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/base/ftutil.c b/chromium/third_party/pdfium/third_party/freetype/src/base/ftutil.c
deleted file mode 100644
index f5b72db7083..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/base/ftutil.c
+++ /dev/null
@@ -1,441 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftutil.c */
-/* */
-/* FreeType utility file for memory and list management (body). */
-/* */
-/* Copyright 2002-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_MEMORY_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_LIST_H
-
-
- /*************************************************************************/
- /* */
- /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
- /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
- /* messages during execution. */
- /* */
-#undef FT_COMPONENT
-#define FT_COMPONENT trace_memory
-
-
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** *****/
- /***** M E M O R Y M A N A G E M E N T *****/
- /***** *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
-
-
- FT_BASE_DEF( FT_Pointer )
- ft_mem_alloc( FT_Memory memory,
- FT_Long size,
- FT_Error *p_error )
- {
- FT_Error error;
- FT_Pointer block = ft_mem_qalloc( memory, size, &error );
-
- if ( !error && size > 0 )
- FT_MEM_ZERO( block, size );
-
- *p_error = error;
- return block;
- }
-
-
- FT_BASE_DEF( FT_Pointer )
- ft_mem_qalloc( FT_Memory memory,
- FT_Long size,
- FT_Error *p_error )
- {
- FT_Error error = FT_Err_Ok;
- FT_Pointer block = NULL;
-
-
- if ( size > 0 )
- {
- block = memory->alloc( memory, size );
- if ( block == NULL )
- error = FT_THROW( Out_Of_Memory );
- }
- else if ( size < 0 )
- {
- /* may help catch/prevent security issues */
- error = FT_THROW( Invalid_Argument );
- }
-
- *p_error = error;
- return block;
- }
-
-
- FT_BASE_DEF( FT_Pointer )
- ft_mem_realloc( FT_Memory memory,
- FT_Long item_size,
- FT_Long cur_count,
- FT_Long new_count,
- void* block,
- FT_Error *p_error )
- {
- FT_Error error = FT_Err_Ok;
-
-
- block = ft_mem_qrealloc( memory, item_size,
- cur_count, new_count, block, &error );
- if ( !error && new_count > cur_count )
- FT_MEM_ZERO( (char*)block + cur_count * item_size,
- ( new_count - cur_count ) * item_size );
-
- *p_error = error;
- return block;
- }
-
-
- FT_BASE_DEF( FT_Pointer )
- ft_mem_qrealloc( FT_Memory memory,
- FT_Long item_size,
- FT_Long cur_count,
- FT_Long new_count,
- void* block,
- FT_Error *p_error )
- {
- FT_Error error = FT_Err_Ok;
-
-
- /* Note that we now accept `item_size == 0' as a valid parameter, in
- * order to cover very weird cases where an ALLOC_MULT macro would be
- * called.
- */
- if ( cur_count < 0 || new_count < 0 || item_size < 0 )
- {
- /* may help catch/prevent nasty security issues */
- error = FT_THROW( Invalid_Argument );
- }
- else if ( new_count == 0 || item_size == 0 )
- {
- ft_mem_free( memory, block );
- block = NULL;
- }
- else if ( new_count > FT_INT_MAX/item_size )
- {
- error = FT_THROW( Array_Too_Large );
- }
- else if ( cur_count == 0 )
- {
- FT_ASSERT( block == NULL );
-
- block = ft_mem_alloc( memory, new_count*item_size, &error );
- }
- else
- {
- FT_Pointer block2;
- FT_Long cur_size = cur_count*item_size;
- FT_Long new_size = new_count*item_size;
-
-
- block2 = memory->realloc( memory, cur_size, new_size, block );
- if ( block2 == NULL )
- error = FT_THROW( Out_Of_Memory );
- else
- block = block2;
- }
-
- *p_error = error;
- return block;
- }
-
-
- FT_BASE_DEF( void )
- ft_mem_free( FT_Memory memory,
- const void *P )
- {
- if ( P )
- memory->free( memory, (void*)P );
- }
-
-
- FT_BASE_DEF( FT_Pointer )
- ft_mem_dup( FT_Memory memory,
- const void* address,
- FT_ULong size,
- FT_Error *p_error )
- {
- FT_Error error;
- FT_Pointer p = ft_mem_qalloc( memory, (FT_Long)size, &error );
-
-
- if ( !error && address )
- ft_memcpy( p, address, size );
-
- *p_error = error;
- return p;
- }
-
-
- FT_BASE_DEF( FT_Pointer )
- ft_mem_strdup( FT_Memory memory,
- const char* str,
- FT_Error *p_error )
- {
- FT_ULong len = str ? (FT_ULong)ft_strlen( str ) + 1
- : 0;
-
-
- return ft_mem_dup( memory, str, len, p_error );
- }
-
-
- FT_BASE_DEF( FT_Int )
- ft_mem_strcpyn( char* dst,
- const char* src,
- FT_ULong size )
- {
- while ( size > 1 && *src != 0 )
- {
- *dst++ = *src++;
- size--;
- }
-
- *dst = 0; /* always zero-terminate */
-
- return *src != 0;
- }
-
-
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** *****/
- /***** D O U B L Y L I N K E D L I S T S *****/
- /***** *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
-
-#undef FT_COMPONENT
-#define FT_COMPONENT trace_list
-
- /* documentation is in ftlist.h */
-
- FT_EXPORT_DEF( FT_ListNode )
- FT_List_Find( FT_List list,
- void* data )
- {
- FT_ListNode cur;
-
-
- if ( !list )
- return NULL;
-
- cur = list->head;
- while ( cur )
- {
- if ( cur->data == data )
- return cur;
-
- cur = cur->next;
- }
-
- return NULL;
- }
-
-
- /* documentation is in ftlist.h */
-
- FT_EXPORT_DEF( void )
- FT_List_Add( FT_List list,
- FT_ListNode node )
- {
- FT_ListNode before;
-
-
- if ( !list || !node )
- return;
-
- before = list->tail;
-
- node->next = NULL;
- node->prev = before;
-
- if ( before )
- before->next = node;
- else
- list->head = node;
-
- list->tail = node;
- }
-
-
- /* documentation is in ftlist.h */
-
- FT_EXPORT_DEF( void )
- FT_List_Insert( FT_List list,
- FT_ListNode node )
- {
- FT_ListNode after;
-
-
- if ( !list || !node )
- return;
-
- after = list->head;
-
- node->next = after;
- node->prev = NULL;
-
- if ( !after )
- list->tail = node;
- else
- after->prev = node;
-
- list->head = node;
- }
-
-
- /* documentation is in ftlist.h */
-
- FT_EXPORT_DEF( void )
- FT_List_Remove( FT_List list,
- FT_ListNode node )
- {
- FT_ListNode before, after;
-
-
- if ( !list || !node )
- return;
-
- before = node->prev;
- after = node->next;
-
- if ( before )
- before->next = after;
- else
- list->head = after;
-
- if ( after )
- after->prev = before;
- else
- list->tail = before;
- }
-
-
- /* documentation is in ftlist.h */
-
- FT_EXPORT_DEF( void )
- FT_List_Up( FT_List list,
- FT_ListNode node )
- {
- FT_ListNode before, after;
-
-
- if ( !list || !node )
- return;
-
- before = node->prev;
- after = node->next;
-
- /* check whether we are already on top of the list */
- if ( !before )
- return;
-
- before->next = after;
-
- if ( after )
- after->prev = before;
- else
- list->tail = before;
-
- node->prev = NULL;
- node->next = list->head;
- list->head->prev = node;
- list->head = node;
- }
-
-
- /* documentation is in ftlist.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_List_Iterate( FT_List list,
- FT_List_Iterator iterator,
- void* user )
- {
- FT_ListNode cur;
- FT_Error error = FT_Err_Ok;
-
-
- if ( !list || !iterator )
- return FT_THROW( Invalid_Argument );
-
- cur = list->head;
-
- while ( cur )
- {
- FT_ListNode next = cur->next;
-
-
- error = iterator( cur, user );
- if ( error )
- break;
-
- cur = next;
- }
-
- return error;
- }
-
-
- /* documentation is in ftlist.h */
-
- FT_EXPORT_DEF( void )
- FT_List_Finalize( FT_List list,
- FT_List_Destructor destroy,
- FT_Memory memory,
- void* user )
- {
- FT_ListNode cur;
-
-
- if ( !list || !memory )
- return;
-
- cur = list->head;
- while ( cur )
- {
- FT_ListNode next = cur->next;
- void* data = cur->data;
-
-
- if ( destroy )
- destroy( memory, data, user );
-
- FT_FREE( cur );
- cur = next;
- }
-
- list->head = NULL;
- list->tail = NULL;
- }
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/base/ftwinfnt.c b/chromium/third_party/pdfium/third_party/freetype/src/base/ftwinfnt.c
deleted file mode 100644
index 76a19af983a..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/base/ftwinfnt.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftwinfnt.c */
-/* */
-/* FreeType API for accessing Windows FNT specific info (body). */
-/* */
-/* Copyright 2003-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_WINFONTS_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_SERVICE_WINFNT_H
-
-
- /* documentation is in ftwinfnt.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Get_WinFNT_Header( FT_Face face,
- FT_WinFNT_HeaderRec *header )
- {
- FT_Service_WinFnt service;
- FT_Error error;
-
-
- if ( !face )
- return FT_THROW( Invalid_Face_Handle );
-
- if ( !header )
- return FT_THROW( Invalid_Argument );
-
- FT_FACE_LOOKUP_SERVICE( face, service, WINFNT );
-
- if ( service )
- error = service->get_header( face, header );
- else
- error = FT_THROW( Invalid_Argument );
-
- return error;
- }
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/base/md5.c b/chromium/third_party/pdfium/third_party/freetype/src/base/md5.c
deleted file mode 100644
index 52d96accd30..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/base/md5.c
+++ /dev/null
@@ -1,296 +0,0 @@
-/*
- * This is an OpenSSL-compatible implementation of the RSA Data Security, Inc.
- * MD5 Message-Digest Algorithm (RFC 1321).
- *
- * Homepage:
- * http://openwall.info/wiki/people/solar/software/public-domain-source-code/md5
- *
- * Author:
- * Alexander Peslyak, better known as Solar Designer <solar at openwall.com>
- *
- * This software was written by Alexander Peslyak in 2001. No copyright is
- * claimed, and the software is hereby placed in the public domain.
- * In case this attempt to disclaim copyright and place the software in the
- * public domain is deemed null and void, then the software is
- * Copyright (c) 2001 Alexander Peslyak and it is hereby released to the
- * general public under the following terms:
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted.
- *
- * There's ABSOLUTELY NO WARRANTY, express or implied.
- *
- * (This is a heavily cut-down "BSD license".)
- *
- * This differs from Colin Plumb's older public domain implementation in that
- * no exactly 32-bit integer data type is required (any 32-bit or wider
- * unsigned integer data type will do), there's no compile-time endianness
- * configuration, and the function prototypes match OpenSSL's. No code from
- * Colin Plumb's implementation has been reused; this comment merely compares
- * the properties of the two independent implementations.
- *
- * The primary goals of this implementation are portability and ease of use.
- * It is meant to be fast, but not as fast as possible. Some known
- * optimizations are not included to reduce source code size and avoid
- * compile-time configuration.
- */
-
-#ifndef HAVE_OPENSSL
-
-#include <string.h>
-
-#include "md5.h"
-
-/*
- * The basic MD5 functions.
- *
- * F and G are optimized compared to their RFC 1321 definitions for
- * architectures that lack an AND-NOT instruction, just like in Colin Plumb's
- * implementation.
- */
-#define F(x, y, z) ((z) ^ ((x) & ((y) ^ (z))))
-#define G(x, y, z) ((y) ^ ((z) & ((x) ^ (y))))
-#define H(x, y, z) (((x) ^ (y)) ^ (z))
-#define H2(x, y, z) ((x) ^ ((y) ^ (z)))
-#define I(x, y, z) ((y) ^ ((x) | ~(z)))
-
-/*
- * The MD5 transformation for all four rounds.
- */
-#define STEP(f, a, b, c, d, x, t, s) \
- (a) += f((b), (c), (d)) + (x) + (t); \
- (a) = (((a) << (s)) | (((a) & 0xffffffff) >> (32 - (s)))); \
- (a) += (b);
-
-/*
- * SET reads 4 input bytes in little-endian byte order and stores them
- * in a properly aligned word in host byte order.
- *
- * The check for little-endian architectures that tolerate unaligned
- * memory accesses is just an optimization. Nothing will break if it
- * doesn't work.
- */
-#if defined(__i386__) || defined(__x86_64__) || defined(__vax__)
-#define SET(n) \
- (*(MD5_u32plus *)&ptr[(n) * 4])
-#define GET(n) \
- SET(n)
-#else
-#define SET(n) \
- (ctx->block[(n)] = \
- (MD5_u32plus)ptr[(n) * 4] | \
- ((MD5_u32plus)ptr[(n) * 4 + 1] << 8) | \
- ((MD5_u32plus)ptr[(n) * 4 + 2] << 16) | \
- ((MD5_u32plus)ptr[(n) * 4 + 3] << 24))
-#define GET(n) \
- (ctx->block[(n)])
-#endif
-
-/*
- * This processes one or more 64-byte data blocks, but does NOT update
- * the bit counters. There are no alignment requirements.
- */
-static const void *body(MD5_CTX *ctx, const void *data, unsigned long size)
-{
- const unsigned char *ptr;
- MD5_u32plus a, b, c, d;
- MD5_u32plus saved_a, saved_b, saved_c, saved_d;
-
- ptr = (const unsigned char *)data;
-
- a = ctx->a;
- b = ctx->b;
- c = ctx->c;
- d = ctx->d;
-
- do {
- saved_a = a;
- saved_b = b;
- saved_c = c;
- saved_d = d;
-
-/* Round 1 */
- STEP(F, a, b, c, d, SET(0), 0xd76aa478, 7)
- STEP(F, d, a, b, c, SET(1), 0xe8c7b756, 12)
- STEP(F, c, d, a, b, SET(2), 0x242070db, 17)
- STEP(F, b, c, d, a, SET(3), 0xc1bdceee, 22)
- STEP(F, a, b, c, d, SET(4), 0xf57c0faf, 7)
- STEP(F, d, a, b, c, SET(5), 0x4787c62a, 12)
- STEP(F, c, d, a, b, SET(6), 0xa8304613, 17)
- STEP(F, b, c, d, a, SET(7), 0xfd469501, 22)
- STEP(F, a, b, c, d, SET(8), 0x698098d8, 7)
- STEP(F, d, a, b, c, SET(9), 0x8b44f7af, 12)
- STEP(F, c, d, a, b, SET(10), 0xffff5bb1, 17)
- STEP(F, b, c, d, a, SET(11), 0x895cd7be, 22)
- STEP(F, a, b, c, d, SET(12), 0x6b901122, 7)
- STEP(F, d, a, b, c, SET(13), 0xfd987193, 12)
- STEP(F, c, d, a, b, SET(14), 0xa679438e, 17)
- STEP(F, b, c, d, a, SET(15), 0x49b40821, 22)
-
-/* Round 2 */
- STEP(G, a, b, c, d, GET(1), 0xf61e2562, 5)
- STEP(G, d, a, b, c, GET(6), 0xc040b340, 9)
- STEP(G, c, d, a, b, GET(11), 0x265e5a51, 14)
- STEP(G, b, c, d, a, GET(0), 0xe9b6c7aa, 20)
- STEP(G, a, b, c, d, GET(5), 0xd62f105d, 5)
- STEP(G, d, a, b, c, GET(10), 0x02441453, 9)
- STEP(G, c, d, a, b, GET(15), 0xd8a1e681, 14)
- STEP(G, b, c, d, a, GET(4), 0xe7d3fbc8, 20)
- STEP(G, a, b, c, d, GET(9), 0x21e1cde6, 5)
- STEP(G, d, a, b, c, GET(14), 0xc33707d6, 9)
- STEP(G, c, d, a, b, GET(3), 0xf4d50d87, 14)
- STEP(G, b, c, d, a, GET(8), 0x455a14ed, 20)
- STEP(G, a, b, c, d, GET(13), 0xa9e3e905, 5)
- STEP(G, d, a, b, c, GET(2), 0xfcefa3f8, 9)
- STEP(G, c, d, a, b, GET(7), 0x676f02d9, 14)
- STEP(G, b, c, d, a, GET(12), 0x8d2a4c8a, 20)
-
-/* Round 3 */
- STEP(H, a, b, c, d, GET(5), 0xfffa3942, 4)
- STEP(H2, d, a, b, c, GET(8), 0x8771f681, 11)
- STEP(H, c, d, a, b, GET(11), 0x6d9d6122, 16)
- STEP(H2, b, c, d, a, GET(14), 0xfde5380c, 23)
- STEP(H, a, b, c, d, GET(1), 0xa4beea44, 4)
- STEP(H2, d, a, b, c, GET(4), 0x4bdecfa9, 11)
- STEP(H, c, d, a, b, GET(7), 0xf6bb4b60, 16)
- STEP(H2, b, c, d, a, GET(10), 0xbebfbc70, 23)
- STEP(H, a, b, c, d, GET(13), 0x289b7ec6, 4)
- STEP(H2, d, a, b, c, GET(0), 0xeaa127fa, 11)
- STEP(H, c, d, a, b, GET(3), 0xd4ef3085, 16)
- STEP(H2, b, c, d, a, GET(6), 0x04881d05, 23)
- STEP(H, a, b, c, d, GET(9), 0xd9d4d039, 4)
- STEP(H2, d, a, b, c, GET(12), 0xe6db99e5, 11)
- STEP(H, c, d, a, b, GET(15), 0x1fa27cf8, 16)
- STEP(H2, b, c, d, a, GET(2), 0xc4ac5665, 23)
-
-/* Round 4 */
- STEP(I, a, b, c, d, GET(0), 0xf4292244, 6)
- STEP(I, d, a, b, c, GET(7), 0x432aff97, 10)
- STEP(I, c, d, a, b, GET(14), 0xab9423a7, 15)
- STEP(I, b, c, d, a, GET(5), 0xfc93a039, 21)
- STEP(I, a, b, c, d, GET(12), 0x655b59c3, 6)
- STEP(I, d, a, b, c, GET(3), 0x8f0ccc92, 10)
- STEP(I, c, d, a, b, GET(10), 0xffeff47d, 15)
- STEP(I, b, c, d, a, GET(1), 0x85845dd1, 21)
- STEP(I, a, b, c, d, GET(8), 0x6fa87e4f, 6)
- STEP(I, d, a, b, c, GET(15), 0xfe2ce6e0, 10)
- STEP(I, c, d, a, b, GET(6), 0xa3014314, 15)
- STEP(I, b, c, d, a, GET(13), 0x4e0811a1, 21)
- STEP(I, a, b, c, d, GET(4), 0xf7537e82, 6)
- STEP(I, d, a, b, c, GET(11), 0xbd3af235, 10)
- STEP(I, c, d, a, b, GET(2), 0x2ad7d2bb, 15)
- STEP(I, b, c, d, a, GET(9), 0xeb86d391, 21)
-
- a += saved_a;
- b += saved_b;
- c += saved_c;
- d += saved_d;
-
- ptr += 64;
- } while (size -= 64);
-
- ctx->a = a;
- ctx->b = b;
- ctx->c = c;
- ctx->d = d;
-
- return ptr;
-}
-
-void MD5_Init(MD5_CTX *ctx)
-{
- ctx->a = 0x67452301;
- ctx->b = 0xefcdab89;
- ctx->c = 0x98badcfe;
- ctx->d = 0x10325476;
-
- ctx->lo = 0;
- ctx->hi = 0;
-}
-
-void MD5_Update(MD5_CTX *ctx, const void *data, unsigned long size)
-{
- MD5_u32plus saved_lo;
- unsigned long used, available;
-
- saved_lo = ctx->lo;
- if ((ctx->lo = (saved_lo + size) & 0x1fffffff) < saved_lo)
- ctx->hi++;
- ctx->hi += size >> 29;
-
- used = saved_lo & 0x3f;
-
- if (used) {
- available = 64 - used;
-
- if (size < available) {
- memcpy(&ctx->buffer[used], data, size);
- return;
- }
-
- memcpy(&ctx->buffer[used], data, available);
- data = (const unsigned char *)data + available;
- size -= available;
- body(ctx, ctx->buffer, 64);
- }
-
- if (size >= 64) {
- data = body(ctx, data, size & ~(unsigned long)0x3f);
- size &= 0x3f;
- }
-
- memcpy(ctx->buffer, data, size);
-}
-
-void MD5_Final(unsigned char *result, MD5_CTX *ctx)
-{
- unsigned long used, available;
-
- used = ctx->lo & 0x3f;
-
- ctx->buffer[used++] = 0x80;
-
- available = 64 - used;
-
- if (available < 8) {
- memset(&ctx->buffer[used], 0, available);
- body(ctx, ctx->buffer, 64);
- used = 0;
- available = 64;
- }
-
- memset(&ctx->buffer[used], 0, available - 8);
-
- ctx->lo <<= 3;
- ctx->buffer[56] = ctx->lo;
- ctx->buffer[57] = ctx->lo >> 8;
- ctx->buffer[58] = ctx->lo >> 16;
- ctx->buffer[59] = ctx->lo >> 24;
- ctx->buffer[60] = ctx->hi;
- ctx->buffer[61] = ctx->hi >> 8;
- ctx->buffer[62] = ctx->hi >> 16;
- ctx->buffer[63] = ctx->hi >> 24;
-
- body(ctx, ctx->buffer, 64);
-
- result[0] = ctx->a;
- result[1] = ctx->a >> 8;
- result[2] = ctx->a >> 16;
- result[3] = ctx->a >> 24;
- result[4] = ctx->b;
- result[5] = ctx->b >> 8;
- result[6] = ctx->b >> 16;
- result[7] = ctx->b >> 24;
- result[8] = ctx->c;
- result[9] = ctx->c >> 8;
- result[10] = ctx->c >> 16;
- result[11] = ctx->c >> 24;
- result[12] = ctx->d;
- result[13] = ctx->d >> 8;
- result[14] = ctx->d >> 16;
- result[15] = ctx->d >> 24;
-
- memset(ctx, 0, sizeof(*ctx));
-}
-
-#endif
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/base/md5.h b/chromium/third_party/pdfium/third_party/freetype/src/base/md5.h
deleted file mode 100644
index 2da44bf355a..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/base/md5.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * This is an OpenSSL-compatible implementation of the RSA Data Security, Inc.
- * MD5 Message-Digest Algorithm (RFC 1321).
- *
- * Homepage:
- * http://openwall.info/wiki/people/solar/software/public-domain-source-code/md5
- *
- * Author:
- * Alexander Peslyak, better known as Solar Designer <solar at openwall.com>
- *
- * This software was written by Alexander Peslyak in 2001. No copyright is
- * claimed, and the software is hereby placed in the public domain.
- * In case this attempt to disclaim copyright and place the software in the
- * public domain is deemed null and void, then the software is
- * Copyright (c) 2001 Alexander Peslyak and it is hereby released to the
- * general public under the following terms:
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted.
- *
- * There's ABSOLUTELY NO WARRANTY, express or implied.
- *
- * See md5.c for more information.
- */
-
-#ifdef HAVE_OPENSSL
-#include <openssl/md5.h>
-#elif !defined(_MD5_H)
-#define _MD5_H
-
-/* Any 32-bit or wider unsigned integer data type will do */
-typedef unsigned int MD5_u32plus;
-
-typedef struct {
- MD5_u32plus lo, hi;
- MD5_u32plus a, b, c, d;
- unsigned char buffer[64];
- MD5_u32plus block[16];
-} MD5_CTX;
-
-extern void MD5_Init(MD5_CTX *ctx);
-extern void MD5_Update(MD5_CTX *ctx, const void *data, unsigned long size);
-extern void MD5_Final(unsigned char *result, MD5_CTX *ctx);
-
-#endif
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/cff/Jamfile b/chromium/third_party/pdfium/third_party/freetype/src/cff/Jamfile
deleted file mode 100644
index deec0792ce4..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/cff/Jamfile
+++ /dev/null
@@ -1,45 +0,0 @@
-# FreeType 2 src/cff Jamfile
-#
-# Copyright 2001-2015 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT. By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-SubDir FT2_TOP $(FT2_SRC_DIR) cff ;
-
-{
- local _sources ;
-
- if $(FT2_MULTI)
- {
- _sources = cffcmap
- cffdrivr
- cffgload
- cffload
- cffobjs
- cffparse
- cffpic
- cf2arrst
- cf2blues
- cf2error
- cf2font
- cf2ft
- cf2hints
- cf2intrp
- cf2read
- cf2stack
- ;
- }
- else
- {
- _sources = cff ;
- }
-
- Library $(FT2_LIB) : $(_sources).c ;
-}
-
-# end of src/cff Jamfile
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/cff/cf2arrst.c b/chromium/third_party/pdfium/third_party/freetype/src/cff/cf2arrst.c
deleted file mode 100644
index 89f3e9f1d74..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/cff/cf2arrst.c
+++ /dev/null
@@ -1,241 +0,0 @@
-/***************************************************************************/
-/* */
-/* cf2arrst.c */
-/* */
-/* Adobe's code for Array Stacks (body). */
-/* */
-/* Copyright 2007-2013 Adobe Systems Incorporated. */
-/* */
-/* This software, and all works of authorship, whether in source or */
-/* object code form as indicated by the copyright notice(s) included */
-/* herein (collectively, the "Work") is made available, and may only be */
-/* used, modified, and distributed under the FreeType Project License, */
-/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */
-/* FreeType Project License, each contributor to the Work hereby grants */
-/* to any individual or legal entity exercising permissions granted by */
-/* the FreeType Project License and this section (hereafter, "You" or */
-/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */
-/* royalty-free, irrevocable (except as stated in this section) patent */
-/* license to make, have made, use, offer to sell, sell, import, and */
-/* otherwise transfer the Work, where such license applies only to those */
-/* patent claims licensable by such contributor that are necessarily */
-/* infringed by their contribution(s) alone or by combination of their */
-/* contribution(s) with the Work to which such contribution(s) was */
-/* submitted. If You institute patent litigation against any entity */
-/* (including a cross-claim or counterclaim in a lawsuit) alleging that */
-/* the Work or a contribution incorporated within the Work constitutes */
-/* direct or contributory patent infringement, then any patent licenses */
-/* granted to You under this License for that Work shall terminate as of */
-/* the date such litigation is filed. */
-/* */
-/* By using, modifying, or distributing the Work you indicate that you */
-/* have read and understood the terms and conditions of the */
-/* FreeType Project License as well as those provided in this section, */
-/* and you accept them fully. */
-/* */
-/***************************************************************************/
-
-
-#include "cf2ft.h"
-#include FT_INTERNAL_DEBUG_H
-
-#include "cf2glue.h"
-#include "cf2arrst.h"
-
-#include "cf2error.h"
-
-
- /*
- * CF2_ArrStack uses an error pointer, to enable shared errors.
- * Shared errors are necessary when multiple objects allow the program
- * to continue after detecting errors. Only the first error should be
- * recorded.
- */
-
- FT_LOCAL_DEF( void )
- cf2_arrstack_init( CF2_ArrStack arrstack,
- FT_Memory memory,
- FT_Error* error,
- size_t sizeItem )
- {
- FT_ASSERT( arrstack != NULL );
-
- /* initialize the structure */
- arrstack->memory = memory;
- arrstack->error = error;
- arrstack->sizeItem = sizeItem;
- arrstack->allocated = 0;
- arrstack->chunk = 10; /* chunks of 10 items */
- arrstack->count = 0;
- arrstack->totalSize = 0;
- arrstack->ptr = NULL;
- }
-
-
- FT_LOCAL_DEF( void )
- cf2_arrstack_finalize( CF2_ArrStack arrstack )
- {
- FT_Memory memory = arrstack->memory; /* for FT_FREE */
-
-
- FT_ASSERT( arrstack != NULL );
-
- arrstack->allocated = 0;
- arrstack->count = 0;
- arrstack->totalSize = 0;
-
- /* free the data buffer */
- FT_FREE( arrstack->ptr );
- }
-
-
- /* allocate or reallocate the buffer size; */
- /* return false on memory error */
- static FT_Bool
- cf2_arrstack_setNumElements( CF2_ArrStack arrstack,
- size_t numElements )
- {
- FT_ASSERT( arrstack != NULL );
-
- {
- FT_Error error = FT_Err_Ok; /* for FT_REALLOC */
- FT_Memory memory = arrstack->memory; /* for FT_REALLOC */
-
- size_t newSize = numElements * arrstack->sizeItem;
-
-
- if ( numElements > FT_LONG_MAX / arrstack->sizeItem )
- goto exit;
-
-
- FT_ASSERT( newSize > 0 ); /* avoid realloc with zero size */
-
- if ( !FT_REALLOC( arrstack->ptr, arrstack->totalSize, newSize ) )
- {
- arrstack->allocated = numElements;
- arrstack->totalSize = newSize;
-
- if ( arrstack->count > numElements )
- {
- /* we truncated the list! */
- CF2_SET_ERROR( arrstack->error, Stack_Overflow );
- arrstack->count = numElements;
- return FALSE;
- }
-
- return TRUE; /* success */
- }
- }
-
- exit:
- /* if there's not already an error, store this one */
- CF2_SET_ERROR( arrstack->error, Out_Of_Memory );
-
- return FALSE;
- }
-
-
- /* set the count, ensuring allocation is sufficient */
- FT_LOCAL_DEF( void )
- cf2_arrstack_setCount( CF2_ArrStack arrstack,
- size_t numElements )
- {
- FT_ASSERT( arrstack != NULL );
-
- if ( numElements > arrstack->allocated )
- {
- /* expand the allocation first */
- if ( !cf2_arrstack_setNumElements( arrstack, numElements ) )
- return;
- }
-
- arrstack->count = numElements;
- }
-
-
- /* clear the count */
- FT_LOCAL_DEF( void )
- cf2_arrstack_clear( CF2_ArrStack arrstack )
- {
- FT_ASSERT( arrstack != NULL );
-
- arrstack->count = 0;
- }
-
-
- /* current number of items */
- FT_LOCAL_DEF( size_t )
- cf2_arrstack_size( const CF2_ArrStack arrstack )
- {
- FT_ASSERT( arrstack != NULL );
-
- return arrstack->count;
- }
-
-
- FT_LOCAL_DEF( void* )
- cf2_arrstack_getBuffer( const CF2_ArrStack arrstack )
- {
- FT_ASSERT( arrstack != NULL );
-
- return arrstack->ptr;
- }
-
-
- /* return pointer to the given element */
- FT_LOCAL_DEF( void* )
- cf2_arrstack_getPointer( const CF2_ArrStack arrstack,
- size_t idx )
- {
- void* newPtr;
-
-
- FT_ASSERT( arrstack != NULL );
-
- if ( idx >= arrstack->count )
- {
- /* overflow */
- CF2_SET_ERROR( arrstack->error, Stack_Overflow );
- idx = 0; /* choose safe default */
- }
-
- newPtr = (FT_Byte*)arrstack->ptr + idx * arrstack->sizeItem;
-
- return newPtr;
- }
-
-
- /* push (append) an element at the end of the list; */
- /* return false on memory error */
- /* TODO: should there be a length param for extra checking? */
- FT_LOCAL_DEF( void )
- cf2_arrstack_push( CF2_ArrStack arrstack,
- const void* ptr )
- {
- FT_ASSERT( arrstack != NULL );
-
- if ( arrstack->count == arrstack->allocated )
- {
- /* grow the buffer by one chunk */
- if ( !cf2_arrstack_setNumElements(
- arrstack, arrstack->allocated + arrstack->chunk ) )
- {
- /* on error, ignore the push */
- return;
- }
- }
-
- FT_ASSERT( ptr != NULL );
-
- {
- size_t offset = arrstack->count * arrstack->sizeItem;
- void* newPtr = (FT_Byte*)arrstack->ptr + offset;
-
-
- FT_MEM_COPY( newPtr, ptr, arrstack->sizeItem );
- arrstack->count += 1;
- }
- }
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/cff/cf2arrst.h b/chromium/third_party/pdfium/third_party/freetype/src/cff/cf2arrst.h
deleted file mode 100644
index ff5ad8b1268..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/cff/cf2arrst.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/***************************************************************************/
-/* */
-/* cf2arrst.h */
-/* */
-/* Adobe's code for Array Stacks (specification). */
-/* */
-/* Copyright 2007-2013 Adobe Systems Incorporated. */
-/* */
-/* This software, and all works of authorship, whether in source or */
-/* object code form as indicated by the copyright notice(s) included */
-/* herein (collectively, the "Work") is made available, and may only be */
-/* used, modified, and distributed under the FreeType Project License, */
-/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */
-/* FreeType Project License, each contributor to the Work hereby grants */
-/* to any individual or legal entity exercising permissions granted by */
-/* the FreeType Project License and this section (hereafter, "You" or */
-/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */
-/* royalty-free, irrevocable (except as stated in this section) patent */
-/* license to make, have made, use, offer to sell, sell, import, and */
-/* otherwise transfer the Work, where such license applies only to those */
-/* patent claims licensable by such contributor that are necessarily */
-/* infringed by their contribution(s) alone or by combination of their */
-/* contribution(s) with the Work to which such contribution(s) was */
-/* submitted. If You institute patent litigation against any entity */
-/* (including a cross-claim or counterclaim in a lawsuit) alleging that */
-/* the Work or a contribution incorporated within the Work constitutes */
-/* direct or contributory patent infringement, then any patent licenses */
-/* granted to You under this License for that Work shall terminate as of */
-/* the date such litigation is filed. */
-/* */
-/* By using, modifying, or distributing the Work you indicate that you */
-/* have read and understood the terms and conditions of the */
-/* FreeType Project License as well as those provided in this section, */
-/* and you accept them fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __CF2ARRST_H__
-#define __CF2ARRST_H__
-
-
-#include "cf2error.h"
-
-
-FT_BEGIN_HEADER
-
-
- /* need to define the struct here (not opaque) so it can be allocated by */
- /* clients */
- typedef struct CF2_ArrStackRec_
- {
- FT_Memory memory;
- FT_Error* error;
-
- size_t sizeItem; /* bytes per element */
- size_t allocated; /* items allocated */
- size_t chunk; /* allocation increment in items */
- size_t count; /* number of elements allocated */
- size_t totalSize; /* total bytes allocated */
-
- void* ptr; /* ptr to data */
-
- } CF2_ArrStackRec, *CF2_ArrStack;
-
-
- FT_LOCAL( void )
- cf2_arrstack_init( CF2_ArrStack arrstack,
- FT_Memory memory,
- FT_Error* error,
- size_t sizeItem );
- FT_LOCAL( void )
- cf2_arrstack_finalize( CF2_ArrStack arrstack );
-
- FT_LOCAL( void )
- cf2_arrstack_setCount( CF2_ArrStack arrstack,
- size_t numElements );
- FT_LOCAL( void )
- cf2_arrstack_clear( CF2_ArrStack arrstack );
- FT_LOCAL( size_t )
- cf2_arrstack_size( const CF2_ArrStack arrstack );
-
- FT_LOCAL( void* )
- cf2_arrstack_getBuffer( const CF2_ArrStack arrstack );
- FT_LOCAL( void* )
- cf2_arrstack_getPointer( const CF2_ArrStack arrstack,
- size_t idx );
-
- FT_LOCAL( void )
- cf2_arrstack_push( CF2_ArrStack arrstack,
- const void* ptr );
-
-
-FT_END_HEADER
-
-
-#endif /* __CF2ARRST_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/cff/cf2blues.c b/chromium/third_party/pdfium/third_party/freetype/src/cff/cf2blues.c
deleted file mode 100644
index 250f89e0df4..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/cff/cf2blues.c
+++ /dev/null
@@ -1,579 +0,0 @@
-/***************************************************************************/
-/* */
-/* cf2blues.c */
-/* */
-/* Adobe's code for handling Blue Zones (body). */
-/* */
-/* Copyright 2009-2014 Adobe Systems Incorporated. */
-/* */
-/* This software, and all works of authorship, whether in source or */
-/* object code form as indicated by the copyright notice(s) included */
-/* herein (collectively, the "Work") is made available, and may only be */
-/* used, modified, and distributed under the FreeType Project License, */
-/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */
-/* FreeType Project License, each contributor to the Work hereby grants */
-/* to any individual or legal entity exercising permissions granted by */
-/* the FreeType Project License and this section (hereafter, "You" or */
-/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */
-/* royalty-free, irrevocable (except as stated in this section) patent */
-/* license to make, have made, use, offer to sell, sell, import, and */
-/* otherwise transfer the Work, where such license applies only to those */
-/* patent claims licensable by such contributor that are necessarily */
-/* infringed by their contribution(s) alone or by combination of their */
-/* contribution(s) with the Work to which such contribution(s) was */
-/* submitted. If You institute patent litigation against any entity */
-/* (including a cross-claim or counterclaim in a lawsuit) alleging that */
-/* the Work or a contribution incorporated within the Work constitutes */
-/* direct or contributory patent infringement, then any patent licenses */
-/* granted to You under this License for that Work shall terminate as of */
-/* the date such litigation is filed. */
-/* */
-/* By using, modifying, or distributing the Work you indicate that you */
-/* have read and understood the terms and conditions of the */
-/* FreeType Project License as well as those provided in this section, */
-/* and you accept them fully. */
-/* */
-/***************************************************************************/
-
-
-#include "cf2ft.h"
-#include FT_INTERNAL_DEBUG_H
-
-#include "cf2blues.h"
-#include "cf2hints.h"
-#include "cf2font.h"
-
-
- /*************************************************************************/
- /* */
- /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
- /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
- /* messages during execution. */
- /* */
-#undef FT_COMPONENT
-#define FT_COMPONENT trace_cf2blues
-
-
- /*
- * For blue values, the FreeType parser produces an array of integers,
- * while the Adobe CFF engine produces an array of fixed.
- * Define a macro to convert FreeType to fixed.
- */
-#define cf2_blueToFixed( x ) cf2_intToFixed( x )
-
-
- FT_LOCAL_DEF( void )
- cf2_blues_init( CF2_Blues blues,
- CF2_Font font )
- {
- /* pointer to parsed font object */
- CFF_Decoder* decoder = font->decoder;
-
- CF2_Fixed zoneHeight;
- CF2_Fixed maxZoneHeight = 0;
- CF2_Fixed csUnitsPerPixel;
-
- size_t numBlueValues;
- size_t numOtherBlues;
- size_t numFamilyBlues;
- size_t numFamilyOtherBlues;
-
- FT_Pos* blueValues;
- FT_Pos* otherBlues;
- FT_Pos* familyBlues;
- FT_Pos* familyOtherBlues;
-
- size_t i;
- CF2_Fixed emBoxBottom, emBoxTop;
-
-#if 0
- CF2_Int unitsPerEm = font->unitsPerEm;
-
-
- if ( unitsPerEm == 0 )
- unitsPerEm = 1000;
-#endif
-
- FT_ZERO( blues );
- blues->scale = font->innerTransform.d;
-
- cf2_getBlueMetrics( decoder,
- &blues->blueScale,
- &blues->blueShift,
- &blues->blueFuzz );
-
- cf2_getBlueValues( decoder, &numBlueValues, &blueValues );
- cf2_getOtherBlues( decoder, &numOtherBlues, &otherBlues );
- cf2_getFamilyBlues( decoder, &numFamilyBlues, &familyBlues );
- cf2_getFamilyOtherBlues( decoder, &numFamilyOtherBlues, &familyOtherBlues );
-
- /*
- * synthetic em box hint heuristic
- *
- * Apply this when ideographic dictionary (LanguageGroup 1) has no
- * real alignment zones. Adobe tools generate dummy zones at -250 and
- * 1100 for a 1000 unit em. Fonts with ICF-based alignment zones
- * should not enable the heuristic. When the heuristic is enabled,
- * the font's blue zones are ignored.
- *
- */
-
- /* get em box from OS/2 typoAscender/Descender */
- /* TODO: FreeType does not parse these metrics. Skip them for now. */
-#if 0
- FCM_getHorizontalLineMetrics( &e,
- font->font,
- &ascender,
- &descender,
- &linegap );
- if ( ascender - descender == unitsPerEm )
- {
- emBoxBottom = cf2_intToFixed( descender );
- emBoxTop = cf2_intToFixed( ascender );
- }
- else
-#endif
- {
- emBoxBottom = CF2_ICF_Bottom;
- emBoxTop = CF2_ICF_Top;
- }
-
- if ( cf2_getLanguageGroup( decoder ) == 1 &&
- ( numBlueValues == 0 ||
- ( numBlueValues == 4 &&
- cf2_blueToFixed( blueValues[0] ) < emBoxBottom &&
- cf2_blueToFixed( blueValues[1] ) < emBoxBottom &&
- cf2_blueToFixed( blueValues[2] ) > emBoxTop &&
- cf2_blueToFixed( blueValues[3] ) > emBoxTop ) ) )
- {
- /*
- * Construct hint edges suitable for synthetic ghost hints at top
- * and bottom of em box. +-CF2_MIN_COUNTER allows for unhinted
- * features above or below the last hinted edge. This also gives a
- * net 1 pixel boost to the height of ideographic glyphs.
- *
- * Note: Adjust synthetic hints outward by epsilon (0x.0001) to
- * avoid interference. E.g., some fonts have real hints at
- * 880 and -120.
- */
-
- blues->emBoxBottomEdge.csCoord = emBoxBottom - CF2_FIXED_EPSILON;
- blues->emBoxBottomEdge.dsCoord = cf2_fixedRound(
- FT_MulFix(
- blues->emBoxBottomEdge.csCoord,
- blues->scale ) ) -
- CF2_MIN_COUNTER;
- blues->emBoxBottomEdge.scale = blues->scale;
- blues->emBoxBottomEdge.flags = CF2_GhostBottom |
- CF2_Locked |
- CF2_Synthetic;
-
- blues->emBoxTopEdge.csCoord = emBoxTop + CF2_FIXED_EPSILON +
- 2 * font->darkenY;
- blues->emBoxTopEdge.dsCoord = cf2_fixedRound(
- FT_MulFix(
- blues->emBoxTopEdge.csCoord,
- blues->scale ) ) +
- CF2_MIN_COUNTER;
- blues->emBoxTopEdge.scale = blues->scale;
- blues->emBoxTopEdge.flags = CF2_GhostTop |
- CF2_Locked |
- CF2_Synthetic;
-
- blues->doEmBoxHints = TRUE; /* enable the heuristic */
-
- return;
- }
-
- /* copy `BlueValues' and `OtherBlues' to a combined array of top and */
- /* bottom zones */
- for ( i = 0; i < numBlueValues; i += 2 )
- {
- blues->zone[blues->count].csBottomEdge =
- cf2_blueToFixed( blueValues[i] );
- blues->zone[blues->count].csTopEdge =
- cf2_blueToFixed( blueValues[i + 1] );
-
- zoneHeight = blues->zone[blues->count].csTopEdge -
- blues->zone[blues->count].csBottomEdge;
-
- if ( zoneHeight < 0 )
- {
- FT_TRACE4(( "cf2_blues_init: ignoring negative zone height\n" ));
- continue; /* reject this zone */
- }
-
- if ( zoneHeight > maxZoneHeight )
- {
- /* take maximum before darkening adjustment */
- /* so overshoot suppression point doesn't change */
- maxZoneHeight = zoneHeight;
- }
-
- /* adjust both edges of top zone upward by twice darkening amount */
- if ( i != 0 )
- {
- blues->zone[blues->count].csTopEdge += 2 * font->darkenY;
- blues->zone[blues->count].csBottomEdge += 2 * font->darkenY;
- }
-
- /* first `BlueValue' is bottom zone; others are top */
- if ( i == 0 )
- {
- blues->zone[blues->count].bottomZone =
- TRUE;
- blues->zone[blues->count].csFlatEdge =
- blues->zone[blues->count].csTopEdge;
- }
- else
- {
- blues->zone[blues->count].bottomZone =
- FALSE;
- blues->zone[blues->count].csFlatEdge =
- blues->zone[blues->count].csBottomEdge;
- }
-
- blues->count += 1;
- }
-
- for ( i = 0; i < numOtherBlues; i += 2 )
- {
- blues->zone[blues->count].csBottomEdge =
- cf2_blueToFixed( otherBlues[i] );
- blues->zone[blues->count].csTopEdge =
- cf2_blueToFixed( otherBlues[i + 1] );
-
- zoneHeight = blues->zone[blues->count].csTopEdge -
- blues->zone[blues->count].csBottomEdge;
-
- if ( zoneHeight < 0 )
- {
- FT_TRACE4(( "cf2_blues_init: ignoring negative zone height\n" ));
- continue; /* reject this zone */
- }
-
- if ( zoneHeight > maxZoneHeight )
- {
- /* take maximum before darkening adjustment */
- /* so overshoot suppression point doesn't change */
- maxZoneHeight = zoneHeight;
- }
-
- /* Note: bottom zones are not adjusted for darkening amount */
-
- /* all OtherBlues are bottom zone */
- blues->zone[blues->count].bottomZone =
- TRUE;
- blues->zone[blues->count].csFlatEdge =
- blues->zone[blues->count].csTopEdge;
-
- blues->count += 1;
- }
-
- /* Adjust for FamilyBlues */
-
- /* Search for the nearest flat edge in `FamilyBlues' or */
- /* `FamilyOtherBlues'. According to the Black Book, any matching edge */
- /* must be within one device pixel */
-
- csUnitsPerPixel = FT_DivFix( cf2_intToFixed( 1 ), blues->scale );
-
- /* loop on all zones in this font */
- for ( i = 0; i < blues->count; i++ )
- {
- size_t j;
- CF2_Fixed minDiff;
- CF2_Fixed flatFamilyEdge, diff;
- /* value for this font */
- CF2_Fixed flatEdge = blues->zone[i].csFlatEdge;
-
-
- if ( blues->zone[i].bottomZone )
- {
- /* In a bottom zone, the top edge is the flat edge. */
- /* Search `FamilyOtherBlues' for bottom zones; look for closest */
- /* Family edge that is within the one pixel threshold. */
-
- minDiff = CF2_FIXED_MAX;
-
- for ( j = 0; j < numFamilyOtherBlues; j += 2 )
- {
- /* top edge */
- flatFamilyEdge = cf2_blueToFixed( familyOtherBlues[j + 1] );
-
- diff = cf2_fixedAbs( flatEdge - flatFamilyEdge );
-
- if ( diff < minDiff && diff < csUnitsPerPixel )
- {
- blues->zone[i].csFlatEdge = flatFamilyEdge;
- minDiff = diff;
-
- if ( diff == 0 )
- break;
- }
- }
-
- /* check the first member of FamilyBlues, which is a bottom zone */
- if ( numFamilyBlues >= 2 )
- {
- /* top edge */
- flatFamilyEdge = cf2_blueToFixed( familyBlues[1] );
-
- diff = cf2_fixedAbs( flatEdge - flatFamilyEdge );
-
- if ( diff < minDiff && diff < csUnitsPerPixel )
- blues->zone[i].csFlatEdge = flatFamilyEdge;
- }
- }
- else
- {
- /* In a top zone, the bottom edge is the flat edge. */
- /* Search `FamilyBlues' for top zones; skip first zone, which is a */
- /* bottom zone; look for closest Family edge that is within the */
- /* one pixel threshold */
-
- minDiff = CF2_FIXED_MAX;
-
- for ( j = 2; j < numFamilyBlues; j += 2 )
- {
- /* bottom edge */
- flatFamilyEdge = cf2_blueToFixed( familyBlues[j] );
-
- /* adjust edges of top zone upward by twice darkening amount */
- flatFamilyEdge += 2 * font->darkenY; /* bottom edge */
-
- diff = cf2_fixedAbs( flatEdge - flatFamilyEdge );
-
- if ( diff < minDiff && diff < csUnitsPerPixel )
- {
- blues->zone[i].csFlatEdge = flatFamilyEdge;
- minDiff = diff;
-
- if ( diff == 0 )
- break;
- }
- }
- }
- }
-
- /* TODO: enforce separation of zones, including BlueFuzz */
-
- /* Adjust BlueScale; similar to AdjustBlueScale() in coretype */
- /* `bcsetup.c'. */
-
- if ( maxZoneHeight > 0 )
- {
- if ( blues->blueScale > FT_DivFix( cf2_intToFixed( 1 ),
- maxZoneHeight ) )
- {
- /* clamp at maximum scale */
- blues->blueScale = FT_DivFix( cf2_intToFixed( 1 ),
- maxZoneHeight );
- }
-
- /*
- * TODO: Revisit the bug fix for 613448. The minimum scale
- * requirement catches a number of library fonts. For
- * example, with default BlueScale (.039625) and 0.4 minimum,
- * the test below catches any font with maxZoneHeight < 10.1.
- * There are library fonts ranging from 2 to 10 that get
- * caught, including e.g., Eurostile LT Std Medium with
- * maxZoneHeight of 6.
- *
- */
-#if 0
- if ( blueScale < .4 / maxZoneHeight )
- {
- tetraphilia_assert( 0 );
- /* clamp at minimum scale, per bug 0613448 fix */
- blueScale = .4 / maxZoneHeight;
- }
-#endif
-
- }
-
- /*
- * Suppress overshoot and boost blue zones at small sizes. Boost
- * amount varies linearly from 0.5 pixel near 0 to 0 pixel at
- * blueScale cutoff.
- * Note: This boost amount is different from the coretype heuristic.
- *
- */
-
- if ( blues->scale < blues->blueScale )
- {
- blues->suppressOvershoot = TRUE;
-
- /* Change rounding threshold for `dsFlatEdge'. */
- /* Note: constant changed from 0.5 to 0.6 to avoid a problem with */
- /* 10ppem Arial */
-
- blues->boost = cf2_floatToFixed( .6 ) -
- FT_MulDiv( cf2_floatToFixed ( .6 ),
- blues->scale,
- blues->blueScale );
- if ( blues->boost > 0x7FFF )
- {
- /* boost must remain less than 0.5, or baseline could go negative */
- blues->boost = 0x7FFF;
- }
- }
-
- /* boost and darkening have similar effects; don't do both */
- if ( font->stemDarkened )
- blues->boost = 0;
-
- /* set device space alignment for each zone; */
- /* apply boost amount before rounding flat edge */
-
- for ( i = 0; i < blues->count; i++ )
- {
- if ( blues->zone[i].bottomZone )
- blues->zone[i].dsFlatEdge = cf2_fixedRound(
- FT_MulFix(
- blues->zone[i].csFlatEdge,
- blues->scale ) -
- blues->boost );
- else
- blues->zone[i].dsFlatEdge = cf2_fixedRound(
- FT_MulFix(
- blues->zone[i].csFlatEdge,
- blues->scale ) +
- blues->boost );
- }
- }
-
-
- /*
- * Check whether `stemHint' is captured by one of the blue zones.
- *
- * Zero, one or both edges may be valid; only valid edges can be
- * captured. For compatibility with CoolType, search top and bottom
- * zones in the same pass (see `BlueLock'). If a hint is captured,
- * return true and position the edge(s) in one of 3 ways:
- *
- * 1) If `BlueScale' suppresses overshoot, position the captured edge
- * at the flat edge of the zone.
- * 2) If overshoot is not suppressed and `BlueShift' requires
- * overshoot, position the captured edge a minimum of 1 device pixel
- * from the flat edge.
- * 3) If overshoot is not suppressed or required, position the captured
- * edge at the nearest device pixel.
- *
- */
- FT_LOCAL_DEF( FT_Bool )
- cf2_blues_capture( const CF2_Blues blues,
- CF2_Hint bottomHintEdge,
- CF2_Hint topHintEdge )
- {
- /* TODO: validate? */
- CF2_Fixed csFuzz = blues->blueFuzz;
-
- /* new position of captured edge */
- CF2_Fixed dsNew;
-
- /* amount that hint is moved when positioned */
- CF2_Fixed dsMove = 0;
-
- FT_Bool captured = FALSE;
- CF2_UInt i;
-
-
- /* assert edge flags are consistent */
- FT_ASSERT( !cf2_hint_isTop( bottomHintEdge ) &&
- !cf2_hint_isBottom( topHintEdge ) );
-
- /* TODO: search once without blue fuzz for compatibility with coretype? */
- for ( i = 0; i < blues->count; i++ )
- {
- if ( blues->zone[i].bottomZone &&
- cf2_hint_isBottom( bottomHintEdge ) )
- {
- if ( ( blues->zone[i].csBottomEdge - csFuzz ) <=
- bottomHintEdge->csCoord &&
- bottomHintEdge->csCoord <=
- ( blues->zone[i].csTopEdge + csFuzz ) )
- {
- /* bottom edge captured by bottom zone */
-
- if ( blues->suppressOvershoot )
- dsNew = blues->zone[i].dsFlatEdge;
-
- else if ( ( blues->zone[i].csTopEdge - bottomHintEdge->csCoord ) >=
- blues->blueShift )
- {
- /* guarantee minimum of 1 pixel overshoot */
- dsNew = FT_MIN(
- cf2_fixedRound( bottomHintEdge->dsCoord ),
- blues->zone[i].dsFlatEdge - cf2_intToFixed( 1 ) );
- }
-
- else
- {
- /* simply round captured edge */
- dsNew = cf2_fixedRound( bottomHintEdge->dsCoord );
- }
-
- dsMove = dsNew - bottomHintEdge->dsCoord;
- captured = TRUE;
-
- break;
- }
- }
-
- if ( !blues->zone[i].bottomZone && cf2_hint_isTop( topHintEdge ) )
- {
- if ( ( blues->zone[i].csBottomEdge - csFuzz ) <=
- topHintEdge->csCoord &&
- topHintEdge->csCoord <=
- ( blues->zone[i].csTopEdge + csFuzz ) )
- {
- /* top edge captured by top zone */
-
- if ( blues->suppressOvershoot )
- dsNew = blues->zone[i].dsFlatEdge;
-
- else if ( ( topHintEdge->csCoord - blues->zone[i].csBottomEdge ) >=
- blues->blueShift )
- {
- /* guarantee minimum of 1 pixel overshoot */
- dsNew = FT_MAX(
- cf2_fixedRound( topHintEdge->dsCoord ),
- blues->zone[i].dsFlatEdge + cf2_intToFixed( 1 ) );
- }
-
- else
- {
- /* simply round captured edge */
- dsNew = cf2_fixedRound( topHintEdge->dsCoord );
- }
-
- dsMove = dsNew - topHintEdge->dsCoord;
- captured = TRUE;
-
- break;
- }
- }
- }
-
- if ( captured )
- {
- /* move both edges and flag them `locked' */
- if ( cf2_hint_isValid( bottomHintEdge ) )
- {
- bottomHintEdge->dsCoord += dsMove;
- cf2_hint_lock( bottomHintEdge );
- }
-
- if ( cf2_hint_isValid( topHintEdge ) )
- {
- topHintEdge->dsCoord += dsMove;
- cf2_hint_lock( topHintEdge );
- }
- }
-
- return captured;
- }
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/cff/cf2blues.h b/chromium/third_party/pdfium/third_party/freetype/src/cff/cf2blues.h
deleted file mode 100644
index 2f38fcad8f5..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/cff/cf2blues.h
+++ /dev/null
@@ -1,185 +0,0 @@
-/***************************************************************************/
-/* */
-/* cf2blues.h */
-/* */
-/* Adobe's code for handling Blue Zones (specification). */
-/* */
-/* Copyright 2009-2013 Adobe Systems Incorporated. */
-/* */
-/* This software, and all works of authorship, whether in source or */
-/* object code form as indicated by the copyright notice(s) included */
-/* herein (collectively, the "Work") is made available, and may only be */
-/* used, modified, and distributed under the FreeType Project License, */
-/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */
-/* FreeType Project License, each contributor to the Work hereby grants */
-/* to any individual or legal entity exercising permissions granted by */
-/* the FreeType Project License and this section (hereafter, "You" or */
-/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */
-/* royalty-free, irrevocable (except as stated in this section) patent */
-/* license to make, have made, use, offer to sell, sell, import, and */
-/* otherwise transfer the Work, where such license applies only to those */
-/* patent claims licensable by such contributor that are necessarily */
-/* infringed by their contribution(s) alone or by combination of their */
-/* contribution(s) with the Work to which such contribution(s) was */
-/* submitted. If You institute patent litigation against any entity */
-/* (including a cross-claim or counterclaim in a lawsuit) alleging that */
-/* the Work or a contribution incorporated within the Work constitutes */
-/* direct or contributory patent infringement, then any patent licenses */
-/* granted to You under this License for that Work shall terminate as of */
-/* the date such litigation is filed. */
-/* */
-/* By using, modifying, or distributing the Work you indicate that you */
-/* have read and understood the terms and conditions of the */
-/* FreeType Project License as well as those provided in this section, */
-/* and you accept them fully. */
-/* */
-/***************************************************************************/
-
-
- /*
- * A `CF2_Blues' object stores the blue zones (horizontal alignment
- * zones) of a font. These are specified in the CFF private dictionary
- * by `BlueValues', `OtherBlues', `FamilyBlues', and `FamilyOtherBlues'.
- * Each zone is defined by a top and bottom edge in character space.
- * Further, each zone is either a top zone or a bottom zone, as recorded
- * by `bottomZone'.
- *
- * The maximum number of `BlueValues' and `FamilyBlues' is 7 each.
- * However, these are combined to produce a total of 7 zones.
- * Similarly, the maximum number of `OtherBlues' and `FamilyOtherBlues'
- * is 5 and these are combined to produce an additional 5 zones.
- *
- * Blue zones are used to `capture' hints and force them to a common
- * alignment point. This alignment is recorded in device space in
- * `dsFlatEdge'. Except for this value, a `CF2_Blues' object could be
- * constructed independently of scaling. Construction may occur once
- * the matrix is known. Other features implemented in the Capture
- * method are overshoot suppression, overshoot enforcement, and Blue
- * Boost.
- *
- * Capture is determined by `BlueValues' and `OtherBlues', but the
- * alignment point may be adjusted to the scaled flat edge of
- * `FamilyBlues' or `FamilyOtherBlues'. No alignment is done to the
- * curved edge of a zone.
- *
- */
-
-
-#ifndef __CF2BLUES_H__
-#define __CF2BLUES_H__
-
-
-#include "cf2glue.h"
-
-
-FT_BEGIN_HEADER
-
-
- /*
- * `CF2_Hint' is shared by `cf2hints.h' and
- * `cf2blues.h', but `cf2blues.h' depends on
- * `cf2hints.h', so define it here. Note: The typedef is in
- * `cf2glue.h'.
- *
- */
- enum
- {
- CF2_GhostBottom = 0x1, /* a single bottom edge */
- CF2_GhostTop = 0x2, /* a single top edge */
- CF2_PairBottom = 0x4, /* the bottom edge of a stem hint */
- CF2_PairTop = 0x8, /* the top edge of a stem hint */
- CF2_Locked = 0x10, /* this edge has been aligned */
- /* by a blue zone */
- CF2_Synthetic = 0x20 /* this edge was synthesized */
- };
-
-
- /*
- * Default value for OS/2 typoAscender/Descender when their difference
- * is not equal to `unitsPerEm'. The default is based on -250 and 1100
- * in `CF2_Blues', assuming 1000 units per em here.
- *
- */
- enum
- {
- CF2_ICF_Top = cf2_intToFixed( 880 ),
- CF2_ICF_Bottom = cf2_intToFixed( -120 )
- };
-
-
- /*
- * Constant used for hint adjustment and for synthetic em box hint
- * placement.
- */
-#define CF2_MIN_COUNTER cf2_floatToFixed( 0.5 )
-
-
- /* shared typedef is in cf2glue.h */
- struct CF2_HintRec_
- {
- CF2_UInt flags; /* attributes of the edge */
- size_t index; /* index in original stem hint array */
- /* (if not synthetic) */
- CF2_Fixed csCoord;
- CF2_Fixed dsCoord;
- CF2_Fixed scale;
- };
-
-
- typedef struct CF2_BlueRec_
- {
- CF2_Fixed csBottomEdge;
- CF2_Fixed csTopEdge;
- CF2_Fixed csFlatEdge; /* may be from either local or Family zones */
- CF2_Fixed dsFlatEdge; /* top edge of bottom zone or bottom edge */
- /* of top zone (rounded) */
- FT_Bool bottomZone;
-
- } CF2_BlueRec;
-
-
- /* max total blue zones is 12 */
- enum
- {
- CF2_MAX_BLUES = 7,
- CF2_MAX_OTHERBLUES = 5
- };
-
-
- typedef struct CF2_BluesRec_
- {
- CF2_Fixed scale;
- CF2_UInt count;
- FT_Bool suppressOvershoot;
- FT_Bool doEmBoxHints;
-
- CF2_Fixed blueScale;
- CF2_Fixed blueShift;
- CF2_Fixed blueFuzz;
-
- CF2_Fixed boost;
-
- CF2_HintRec emBoxTopEdge;
- CF2_HintRec emBoxBottomEdge;
-
- CF2_BlueRec zone[CF2_MAX_BLUES + CF2_MAX_OTHERBLUES];
-
- } CF2_BluesRec, *CF2_Blues;
-
-
- FT_LOCAL( void )
- cf2_blues_init( CF2_Blues blues,
- CF2_Font font );
- FT_LOCAL( FT_Bool )
- cf2_blues_capture( const CF2_Blues blues,
- CF2_Hint bottomHintEdge,
- CF2_Hint topHintEdge );
-
-
-FT_END_HEADER
-
-
-#endif /* __CF2BLUES_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/cff/cf2error.c b/chromium/third_party/pdfium/third_party/freetype/src/cff/cf2error.c
deleted file mode 100644
index b5595a3d1f3..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/cff/cf2error.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/***************************************************************************/
-/* */
-/* cf2error.c */
-/* */
-/* Adobe's code for error handling (body). */
-/* */
-/* Copyright 2006-2013 Adobe Systems Incorporated. */
-/* */
-/* This software, and all works of authorship, whether in source or */
-/* object code form as indicated by the copyright notice(s) included */
-/* herein (collectively, the "Work") is made available, and may only be */
-/* used, modified, and distributed under the FreeType Project License, */
-/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */
-/* FreeType Project License, each contributor to the Work hereby grants */
-/* to any individual or legal entity exercising permissions granted by */
-/* the FreeType Project License and this section (hereafter, "You" or */
-/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */
-/* royalty-free, irrevocable (except as stated in this section) patent */
-/* license to make, have made, use, offer to sell, sell, import, and */
-/* otherwise transfer the Work, where such license applies only to those */
-/* patent claims licensable by such contributor that are necessarily */
-/* infringed by their contribution(s) alone or by combination of their */
-/* contribution(s) with the Work to which such contribution(s) was */
-/* submitted. If You institute patent litigation against any entity */
-/* (including a cross-claim or counterclaim in a lawsuit) alleging that */
-/* the Work or a contribution incorporated within the Work constitutes */
-/* direct or contributory patent infringement, then any patent licenses */
-/* granted to You under this License for that Work shall terminate as of */
-/* the date such litigation is filed. */
-/* */
-/* By using, modifying, or distributing the Work you indicate that you */
-/* have read and understood the terms and conditions of the */
-/* FreeType Project License as well as those provided in this section, */
-/* and you accept them fully. */
-/* */
-/***************************************************************************/
-
-
-#include "cf2ft.h"
-#include "cf2error.h"
-
-
- FT_LOCAL_DEF( void )
- cf2_setError( FT_Error* error,
- FT_Error value )
- {
- if ( error && *error == 0 )
- *error = value;
- }
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/cff/cf2error.h b/chromium/third_party/pdfium/third_party/freetype/src/cff/cf2error.h
deleted file mode 100644
index 6453ebcb7b8..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/cff/cf2error.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/***************************************************************************/
-/* */
-/* cf2error.h */
-/* */
-/* Adobe's code for error handling (specification). */
-/* */
-/* Copyright 2006-2013 Adobe Systems Incorporated. */
-/* */
-/* This software, and all works of authorship, whether in source or */
-/* object code form as indicated by the copyright notice(s) included */
-/* herein (collectively, the "Work") is made available, and may only be */
-/* used, modified, and distributed under the FreeType Project License, */
-/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */
-/* FreeType Project License, each contributor to the Work hereby grants */
-/* to any individual or legal entity exercising permissions granted by */
-/* the FreeType Project License and this section (hereafter, "You" or */
-/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */
-/* royalty-free, irrevocable (except as stated in this section) patent */
-/* license to make, have made, use, offer to sell, sell, import, and */
-/* otherwise transfer the Work, where such license applies only to those */
-/* patent claims licensable by such contributor that are necessarily */
-/* infringed by their contribution(s) alone or by combination of their */
-/* contribution(s) with the Work to which such contribution(s) was */
-/* submitted. If You institute patent litigation against any entity */
-/* (including a cross-claim or counterclaim in a lawsuit) alleging that */
-/* the Work or a contribution incorporated within the Work constitutes */
-/* direct or contributory patent infringement, then any patent licenses */
-/* granted to You under this License for that Work shall terminate as of */
-/* the date such litigation is filed. */
-/* */
-/* By using, modifying, or distributing the Work you indicate that you */
-/* have read and understood the terms and conditions of the */
-/* FreeType Project License as well as those provided in this section, */
-/* and you accept them fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __CF2ERROR_H__
-#define __CF2ERROR_H__
-
-
-#include FT_MODULE_ERRORS_H
-
-#undef __FTERRORS_H__
-
-#undef FT_ERR_PREFIX
-#define FT_ERR_PREFIX CF2_Err_
-#define FT_ERR_BASE FT_Mod_Err_CF2
-
-
-#include FT_ERRORS_H
-#include "cf2ft.h"
-
-
-FT_BEGIN_HEADER
-
-
- /*
- * A poor-man error facility.
- *
- * This code being written in vanilla C, doesn't have the luxury of a
- * language-supported exception mechanism such as the one available in
- * Java. Instead, we are stuck with using error codes that must be
- * carefully managed and preserved. However, it is convenient for us to
- * model our error mechanism on a Java-like exception mechanism.
- * When we assign an error code we are thus `throwing' an error.
- *
- * The perservation of an error code is done by coding convention.
- * Upon a function call if the error code is anything other than
- * `FT_Err_Ok', which is guaranteed to be zero, we
- * will return without altering that error. This will allow the
- * error to propogate and be handled at the appropriate location in
- * the code.
- *
- * This allows a style of code where the error code is initialized
- * up front and a block of calls are made with the error code only
- * being checked after the block. If a new error occurs, the original
- * error will be preserved and a functional no-op should result in any
- * subsequent function that has an initial error code not equal to
- * `FT_Err_Ok'.
- *
- * Errors are encoded by calling the `FT_THROW' macro. For example,
- *
- * {
- * FT_Error e;
- *
- *
- * ...
- * e = FT_THROW( Out_Of_Memory );
- * }
- *
- */
-
-
- /* Set error code to a particular value. */
- FT_LOCAL( void )
- cf2_setError( FT_Error* error,
- FT_Error value );
-
-
- /*
- * A macro that conditionally sets an error code.
- *
- * This macro will first check whether `error' is set;
- * if not, it will set it to `e'.
- *
- */
-#define CF2_SET_ERROR( error, e ) \
- cf2_setError( error, FT_THROW( e ) )
-
-
-FT_END_HEADER
-
-
-#endif /* __CF2ERROR_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/cff/cf2fixed.h b/chromium/third_party/pdfium/third_party/freetype/src/cff/cf2fixed.h
deleted file mode 100644
index d6d9faf8e54..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/cff/cf2fixed.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/***************************************************************************/
-/* */
-/* cf2fixed.h */
-/* */
-/* Adobe's code for Fixed Point Mathematics (specification only). */
-/* */
-/* Copyright 2007-2013 Adobe Systems Incorporated. */
-/* */
-/* This software, and all works of authorship, whether in source or */
-/* object code form as indicated by the copyright notice(s) included */
-/* herein (collectively, the "Work") is made available, and may only be */
-/* used, modified, and distributed under the FreeType Project License, */
-/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */
-/* FreeType Project License, each contributor to the Work hereby grants */
-/* to any individual or legal entity exercising permissions granted by */
-/* the FreeType Project License and this section (hereafter, "You" or */
-/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */
-/* royalty-free, irrevocable (except as stated in this section) patent */
-/* license to make, have made, use, offer to sell, sell, import, and */
-/* otherwise transfer the Work, where such license applies only to those */
-/* patent claims licensable by such contributor that are necessarily */
-/* infringed by their contribution(s) alone or by combination of their */
-/* contribution(s) with the Work to which such contribution(s) was */
-/* submitted. If You institute patent litigation against any entity */
-/* (including a cross-claim or counterclaim in a lawsuit) alleging that */
-/* the Work or a contribution incorporated within the Work constitutes */
-/* direct or contributory patent infringement, then any patent licenses */
-/* granted to You under this License for that Work shall terminate as of */
-/* the date such litigation is filed. */
-/* */
-/* By using, modifying, or distributing the Work you indicate that you */
-/* have read and understood the terms and conditions of the */
-/* FreeType Project License as well as those provided in this section, */
-/* and you accept them fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __CF2FIXED_H__
-#define __CF2FIXED_H__
-
-
-FT_BEGIN_HEADER
-
-
- /* rasterizer integer and fixed point arithmetic must be 32-bit */
-
-#define CF2_Fixed CF2_F16Dot16
- typedef FT_Int32 CF2_Frac; /* 2.30 fixed point */
-
-
-#define CF2_FIXED_MAX ( (CF2_Fixed)0x7FFFFFFFL )
-#define CF2_FIXED_MIN ( (CF2_Fixed)0x80000000L )
-#define CF2_FIXED_ONE 0x10000L
-#define CF2_FIXED_EPSILON 0x0001
-
- /* in C 89, left and right shift of negative numbers is */
- /* implementation specific behaviour in the general case */
-
-#define cf2_intToFixed( i ) \
- ( (CF2_Fixed)( (FT_UInt32)(i) << 16 ) )
-#define cf2_fixedToInt( x ) \
- ( (FT_Short)( ( (FT_UInt32)(x) + 0x8000U ) >> 16 ) )
-#define cf2_fixedRound( x ) \
- ( (CF2_Fixed)( ( (FT_UInt32)(x) + 0x8000U ) & 0xFFFF0000UL ) )
-#define cf2_floatToFixed( f ) \
- ( (CF2_Fixed)( (f) * 65536.0 + 0.5 ) )
-#define cf2_fixedAbs( x ) \
- ( (x) < 0 ? -(x) : (x) )
-#define cf2_fixedFloor( x ) \
- ( (CF2_Fixed)( (FT_UInt32)(x) & 0xFFFF0000UL ) )
-#define cf2_fixedFraction( x ) \
- ( (x) - cf2_fixedFloor( x ) )
-#define cf2_fracToFixed( x ) \
- ( (x) < 0 ? -( ( -(x) + 0x2000 ) >> 14 ) \
- : ( ( (x) + 0x2000 ) >> 14 ) )
-
-
- /* signed numeric types */
- typedef enum CF2_NumberType_
- {
- CF2_NumberFixed, /* 16.16 */
- CF2_NumberFrac, /* 2.30 */
- CF2_NumberInt /* 32.0 */
-
- } CF2_NumberType;
-
-
-FT_END_HEADER
-
-
-#endif /* __CF2FIXED_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/cff/cf2font.c b/chromium/third_party/pdfium/third_party/freetype/src/cff/cf2font.c
deleted file mode 100644
index 83fd348f2db..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/cff/cf2font.c
+++ /dev/null
@@ -1,512 +0,0 @@
-/***************************************************************************/
-/* */
-/* cf2font.c */
-/* */
-/* Adobe's code for font instances (body). */
-/* */
-/* Copyright 2007-2014 Adobe Systems Incorporated. */
-/* */
-/* This software, and all works of authorship, whether in source or */
-/* object code form as indicated by the copyright notice(s) included */
-/* herein (collectively, the "Work") is made available, and may only be */
-/* used, modified, and distributed under the FreeType Project License, */
-/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */
-/* FreeType Project License, each contributor to the Work hereby grants */
-/* to any individual or legal entity exercising permissions granted by */
-/* the FreeType Project License and this section (hereafter, "You" or */
-/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */
-/* royalty-free, irrevocable (except as stated in this section) patent */
-/* license to make, have made, use, offer to sell, sell, import, and */
-/* otherwise transfer the Work, where such license applies only to those */
-/* patent claims licensable by such contributor that are necessarily */
-/* infringed by their contribution(s) alone or by combination of their */
-/* contribution(s) with the Work to which such contribution(s) was */
-/* submitted. If You institute patent litigation against any entity */
-/* (including a cross-claim or counterclaim in a lawsuit) alleging that */
-/* the Work or a contribution incorporated within the Work constitutes */
-/* direct or contributory patent infringement, then any patent licenses */
-/* granted to You under this License for that Work shall terminate as of */
-/* the date such litigation is filed. */
-/* */
-/* By using, modifying, or distributing the Work you indicate that you */
-/* have read and understood the terms and conditions of the */
-/* FreeType Project License as well as those provided in this section, */
-/* and you accept them fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_CALC_H
-
-#include "cf2ft.h"
-
-#include "cf2glue.h"
-#include "cf2font.h"
-#include "cf2error.h"
-#include "cf2intrp.h"
-
-
- /* Compute a stem darkening amount in character space. */
- static void
- cf2_computeDarkening( CF2_Fixed emRatio,
- CF2_Fixed ppem,
- CF2_Fixed stemWidth,
- CF2_Fixed* darkenAmount,
- CF2_Fixed boldenAmount,
- FT_Bool stemDarkened,
- FT_Int* darkenParams )
- {
- /*
- * Total darkening amount is computed in 1000 unit character space
- * using the modified 5 part curve as Adobe's Avalon rasterizer.
- * The darkening amount is smaller for thicker stems.
- * It becomes zero when the stem is thicker than 2.333 pixels.
- *
- * By default, we use
- *
- * darkenAmount = 0.4 pixels if scaledStem <= 0.5 pixels,
- * darkenAmount = 0.275 pixels if 1 <= scaledStem <= 1.667 pixels,
- * darkenAmount = 0 pixel if scaledStem >= 2.333 pixels,
- *
- * and piecewise linear in-between:
- *
- *
- * darkening
- * ^
- * |
- * | (x1,y1)
- * |--------+
- * | \
- * | \
- * | \ (x3,y3)
- * | +----------+
- * | (x2,y2) \
- * | \
- * | \
- * | +-----------------
- * | (x4,y4)
- * +---------------------------------------------> stem
- * thickness
- *
- *
- * This corresponds to the following values for the
- * `darkening-parameters' property:
- *
- * (x1, y1) = (500, 400)
- * (x2, y2) = (1000, 275)
- * (x3, y3) = (1667, 275)
- * (x4, y4) = (2333, 0)
- *
- */
-
- /* Internal calculations are done in units per thousand for */
- /* convenience. The x axis is scaled stem width in */
- /* thousandths of a pixel. That is, 1000 is 1 pixel. */
- /* The y axis is darkening amount in thousandths of a pixel.*/
- /* In the code, below, dividing by ppem and */
- /* adjusting for emRatio converts darkenAmount to character */
- /* space (font units). */
- CF2_Fixed stemWidthPer1000, scaledStem;
- FT_Int logBase2;
-
-
- *darkenAmount = 0;
-
- if ( boldenAmount == 0 && !stemDarkened )
- return;
-
- /* protect against range problems and divide by zero */
- if ( emRatio < cf2_floatToFixed( .01 ) )
- return;
-
- if ( stemDarkened )
- {
- FT_Int x1 = darkenParams[0];
- FT_Int y1 = darkenParams[1];
- FT_Int x2 = darkenParams[2];
- FT_Int y2 = darkenParams[3];
- FT_Int x3 = darkenParams[4];
- FT_Int y3 = darkenParams[5];
- FT_Int x4 = darkenParams[6];
- FT_Int y4 = darkenParams[7];
-
-
- /* convert from true character space to 1000 unit character space; */
- /* add synthetic emboldening effect */
-
- /* `stemWidthPer1000' will not overflow for a legitimate font */
-
- stemWidthPer1000 = FT_MulFix( stemWidth + boldenAmount, emRatio );
-
- /* `scaledStem' can easily overflow, so we must clamp its maximum */
- /* value; the test doesn't need to be precise, but must be */
- /* conservative. The clamp value (default 2333) where */
- /* `darkenAmount' is zero is well below the overflow value of */
- /* 32767. */
- /* */
- /* FT_MSB computes the integer part of the base 2 logarithm. The */
- /* number of bits for the product is 1 or 2 more than the sum of */
- /* logarithms; remembering that the 16 lowest bits of the fraction */
- /* are dropped this is correct to within a factor of almost 4. */
- /* For example, 0x80.0000 * 0x80.0000 = 0x4000.0000 is 23+23 and */
- /* is flagged as possible overflow because 0xFF.FFFF * 0xFF.FFFF = */
- /* 0xFFFF.FE00 is also 23+23. */
-
- logBase2 = FT_MSB( (FT_UInt32)stemWidthPer1000 ) +
- FT_MSB( (FT_UInt32)ppem );
-
- if ( logBase2 >= 46 )
- /* possible overflow */
- scaledStem = cf2_intToFixed( x4 );
- else
- scaledStem = FT_MulFix( stemWidthPer1000, ppem );
-
- /* now apply the darkening parameters */
-
- if ( scaledStem < cf2_intToFixed( x1 ) )
- *darkenAmount = FT_DivFix( cf2_intToFixed( y1 ), ppem );
-
- else if ( scaledStem < cf2_intToFixed( x2 ) )
- {
- FT_Int xdelta = x2 - x1;
- FT_Int ydelta = y2 - y1;
- FT_Int x = stemWidthPer1000 -
- FT_DivFix( cf2_intToFixed( x1 ), ppem );
-
-
- if ( !xdelta )
- goto Try_x3;
-
- *darkenAmount = FT_MulDiv( x, ydelta, xdelta ) +
- FT_DivFix( cf2_intToFixed( y1 ), ppem );
- }
-
- else if ( scaledStem < cf2_intToFixed( x3 ) )
- {
- Try_x3:
- {
- FT_Int xdelta = x3 - x2;
- FT_Int ydelta = y3 - y2;
- FT_Int x = stemWidthPer1000 -
- FT_DivFix( cf2_intToFixed( x2 ), ppem );
-
-
- if ( !xdelta )
- goto Try_x4;
-
- *darkenAmount = FT_MulDiv( x, ydelta, xdelta ) +
- FT_DivFix( cf2_intToFixed( y2 ), ppem );
- }
- }
-
- else if ( scaledStem < cf2_intToFixed( x4 ) )
- {
- Try_x4:
- {
- FT_Int xdelta = x4 - x3;
- FT_Int ydelta = y4 - y3;
- FT_Int x = stemWidthPer1000 -
- FT_DivFix( cf2_intToFixed( x3 ), ppem );
-
-
- if ( !xdelta )
- goto Use_y4;
-
- *darkenAmount = FT_MulDiv( x, ydelta, xdelta ) +
- FT_DivFix( cf2_intToFixed( y3 ), ppem );
- }
- }
-
- else
- {
- Use_y4:
- *darkenAmount = FT_DivFix( cf2_intToFixed( y4 ), ppem );
- }
-
- /* use half the amount on each side and convert back to true */
- /* character space */
- *darkenAmount = FT_DivFix( *darkenAmount, 2 * emRatio );
- }
-
- /* add synthetic emboldening effect in character space */
- *darkenAmount += boldenAmount / 2;
- }
-
-
- /* set up values for the current FontDict and matrix */
-
- /* caller's transform is adjusted for subpixel positioning */
- static void
- cf2_font_setup( CF2_Font font,
- const CF2_Matrix* transform )
- {
- /* pointer to parsed font object */
- CFF_Decoder* decoder = font->decoder;
-
- FT_Bool needExtraSetup = FALSE;
-
- /* character space units */
- CF2_Fixed boldenX = font->syntheticEmboldeningAmountX;
- CF2_Fixed boldenY = font->syntheticEmboldeningAmountY;
-
- CFF_SubFont subFont;
- CF2_Fixed ppem;
-
-
- /* clear previous error */
- font->error = FT_Err_Ok;
-
- /* if a CID fontDict has changed, we need to recompute some cached */
- /* data */
- subFont = cf2_getSubfont( decoder );
- if ( font->lastSubfont != subFont )
- {
- font->lastSubfont = subFont;
- needExtraSetup = TRUE;
- }
-
- /* if ppem has changed, we need to recompute some cached data */
- /* note: because of CID font matrix concatenation, ppem and transform */
- /* do not necessarily track. */
- ppem = cf2_getPpemY( decoder );
- if ( font->ppem != ppem )
- {
- font->ppem = ppem;
- needExtraSetup = TRUE;
- }
-
- /* copy hinted flag on each call */
- font->hinted = (FT_Bool)( font->renderingFlags & CF2_FlagsHinted );
-
- /* determine if transform has changed; */
- /* include Fontmatrix but ignore translation */
- if ( ft_memcmp( transform,
- &font->currentTransform,
- 4 * sizeof ( CF2_Fixed ) ) != 0 )
- {
- /* save `key' information for `cache of one' matrix data; */
- /* save client transform, without the translation */
- font->currentTransform = *transform;
- font->currentTransform.tx =
- font->currentTransform.ty = cf2_intToFixed( 0 );
-
- /* TODO: FreeType transform is simple scalar; for now, use identity */
- /* for outer */
- font->innerTransform = *transform;
- font->outerTransform.a =
- font->outerTransform.d = cf2_intToFixed( 1 );
- font->outerTransform.b =
- font->outerTransform.c = cf2_intToFixed( 0 );
-
- needExtraSetup = TRUE;
- }
-
- /*
- * font->darkened is set to true if there is a stem darkening request or
- * the font is synthetic emboldened.
- * font->darkened controls whether to adjust blue zones, winding order,
- * and hinting.
- *
- */
- if ( font->stemDarkened != ( font->renderingFlags & CF2_FlagsDarkened ) )
- {
- font->stemDarkened =
- (FT_Bool)( font->renderingFlags & CF2_FlagsDarkened );
-
- /* blue zones depend on darkened flag */
- needExtraSetup = TRUE;
- }
-
- /* recompute variables that are dependent on transform or FontDict or */
- /* darken flag */
- if ( needExtraSetup )
- {
- /* StdVW is found in the private dictionary; */
- /* recompute darkening amounts whenever private dictionary or */
- /* transform change */
- /* Note: a rendering flag turns darkening on or off, so we want to */
- /* store the `on' amounts; */
- /* darkening amount is computed in character space */
- /* TODO: testing size-dependent darkening here; */
- /* what to do for rotations? */
-
- CF2_Fixed emRatio;
- CF2_Fixed stdHW;
- CF2_Int unitsPerEm = font->unitsPerEm;
-
-
- if ( unitsPerEm == 0 )
- unitsPerEm = 1000;
-
- ppem = FT_MAX( cf2_intToFixed( 4 ),
- font->ppem ); /* use minimum ppem of 4 */
-
-#if 0
- /* since vstem is measured in the x-direction, we use the `a' member */
- /* of the fontMatrix */
- emRatio = cf2_fixedFracMul( cf2_intToFixed( 1000 ), fontMatrix->a );
-#endif
-
- /* Freetype does not preserve the fontMatrix when parsing; use */
- /* unitsPerEm instead. */
- /* TODO: check precision of this */
- emRatio = cf2_intToFixed( 1000 ) / unitsPerEm;
- font->stdVW = cf2_getStdVW( decoder );
-
- if ( font->stdVW <= 0 )
- font->stdVW = FT_DivFix( cf2_intToFixed( 75 ), emRatio );
-
- if ( boldenX > 0 )
- {
- /* Ensure that boldenX is at least 1 pixel for synthetic bold font */
- /* (similar to what Avalon does) */
- boldenX = FT_MAX( boldenX,
- FT_DivFix( cf2_intToFixed( unitsPerEm ), ppem ) );
-
- /* Synthetic emboldening adds at least 1 pixel to darkenX, while */
- /* stem darkening adds at most half pixel. Since the purpose of */
- /* stem darkening (readability at small sizes) is met with */
- /* synthetic emboldening, no need to add stem darkening for a */
- /* synthetic bold font. */
- cf2_computeDarkening( emRatio,
- ppem,
- font->stdVW,
- &font->darkenX,
- boldenX,
- FALSE,
- font->darkenParams );
- }
- else
- cf2_computeDarkening( emRatio,
- ppem,
- font->stdVW,
- &font->darkenX,
- 0,
- font->stemDarkened,
- font->darkenParams );
-
-#if 0
- /* since hstem is measured in the y-direction, we use the `d' member */
- /* of the fontMatrix */
- /* TODO: use the same units per em as above; check this */
- emRatio = cf2_fixedFracMul( cf2_intToFixed( 1000 ), fontMatrix->d );
-#endif
-
- /* set the default stem width, because it must be the same for all */
- /* family members; */
- /* choose a constant for StdHW that depends on font contrast */
- stdHW = cf2_getStdHW( decoder );
-
- if ( stdHW > 0 && font->stdVW > 2 * stdHW )
- font->stdHW = FT_DivFix( cf2_intToFixed( 75 ), emRatio );
- else
- {
- /* low contrast font gets less hstem darkening */
- font->stdHW = FT_DivFix( cf2_intToFixed( 110 ), emRatio );
- }
-
- cf2_computeDarkening( emRatio,
- ppem,
- font->stdHW,
- &font->darkenY,
- boldenY,
- font->stemDarkened,
- font->darkenParams );
-
- if ( font->darkenX != 0 || font->darkenY != 0 )
- font->darkened = TRUE;
- else
- font->darkened = FALSE;
-
- font->reverseWinding = FALSE; /* initial expectation is CCW */
-
- /* compute blue zones for this instance */
- cf2_blues_init( &font->blues, font );
- }
- }
-
-
- /* equivalent to AdobeGetOutline */
- FT_LOCAL_DEF( FT_Error )
- cf2_getGlyphOutline( CF2_Font font,
- CF2_Buffer charstring,
- const CF2_Matrix* transform,
- CF2_F16Dot16* glyphWidth )
- {
- FT_Error lastError = FT_Err_Ok;
-
- FT_Vector translation;
-
-#if 0
- FT_Vector advancePoint;
-#endif
-
- CF2_Fixed advWidth = 0;
- FT_Bool needWinding;
-
-
- /* Note: use both integer and fraction for outlines. This allows bbox */
- /* to come out directly. */
-
- translation.x = transform->tx;
- translation.y = transform->ty;
-
- /* set up values based on transform */
- cf2_font_setup( font, transform );
- if ( font->error )
- goto exit; /* setup encountered an error */
-
- /* reset darken direction */
- font->reverseWinding = FALSE;
-
- /* winding order only affects darkening */
- needWinding = font->darkened;
-
- while ( 1 )
- {
- /* reset output buffer */
- cf2_outline_reset( &font->outline );
-
- /* build the outline, passing the full translation */
- cf2_interpT2CharString( font,
- charstring,
- (CF2_OutlineCallbacks)&font->outline,
- &translation,
- FALSE,
- 0,
- 0,
- &advWidth );
-
- if ( font->error )
- goto exit;
-
- if ( !needWinding )
- break;
-
- /* check winding order */
- if ( font->outline.root.windingMomentum >= 0 ) /* CFF is CCW */
- break;
-
- /* invert darkening and render again */
- /* TODO: this should be a parameter to getOutline-computeOffset */
- font->reverseWinding = TRUE;
-
- needWinding = FALSE; /* exit after next iteration */
- }
-
- /* finish storing client outline */
- cf2_outline_close( &font->outline );
-
- exit:
- /* FreeType just wants the advance width; there is no translation */
- *glyphWidth = advWidth;
-
- /* free resources and collect errors from objects we've used */
- cf2_setError( &font->error, lastError );
-
- return font->error;
- }
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/cff/cf2font.h b/chromium/third_party/pdfium/third_party/freetype/src/cff/cf2font.h
deleted file mode 100644
index 86cf02f49d1..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/cff/cf2font.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/***************************************************************************/
-/* */
-/* cf2font.h */
-/* */
-/* Adobe's code for font instances (specification). */
-/* */
-/* Copyright 2007-2013 Adobe Systems Incorporated. */
-/* */
-/* This software, and all works of authorship, whether in source or */
-/* object code form as indicated by the copyright notice(s) included */
-/* herein (collectively, the "Work") is made available, and may only be */
-/* used, modified, and distributed under the FreeType Project License, */
-/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */
-/* FreeType Project License, each contributor to the Work hereby grants */
-/* to any individual or legal entity exercising permissions granted by */
-/* the FreeType Project License and this section (hereafter, "You" or */
-/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */
-/* royalty-free, irrevocable (except as stated in this section) patent */
-/* license to make, have made, use, offer to sell, sell, import, and */
-/* otherwise transfer the Work, where such license applies only to those */
-/* patent claims licensable by such contributor that are necessarily */
-/* infringed by their contribution(s) alone or by combination of their */
-/* contribution(s) with the Work to which such contribution(s) was */
-/* submitted. If You institute patent litigation against any entity */
-/* (including a cross-claim or counterclaim in a lawsuit) alleging that */
-/* the Work or a contribution incorporated within the Work constitutes */
-/* direct or contributory patent infringement, then any patent licenses */
-/* granted to You under this License for that Work shall terminate as of */
-/* the date such litigation is filed. */
-/* */
-/* By using, modifying, or distributing the Work you indicate that you */
-/* have read and understood the terms and conditions of the */
-/* FreeType Project License as well as those provided in this section, */
-/* and you accept them fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __CF2FONT_H__
-#define __CF2FONT_H__
-
-
-#include "cf2ft.h"
-#include "cf2blues.h"
-
-
-FT_BEGIN_HEADER
-
-
-#define CF2_OPERAND_STACK_SIZE 48
-#define CF2_MAX_SUBR 16 /* maximum subroutine nesting; */
- /* only 10 are allowed but there exist */
- /* fonts like `HiraKakuProN-W3.ttf' */
- /* (Hiragino Kaku Gothic ProN W3; */
- /* 8.2d6e1; 2014-12-19) that exceed */
- /* this limit */
-
-
- /* typedef is in `cf2glue.h' */
- struct CF2_FontRec_
- {
- FT_Memory memory;
- FT_Error error; /* shared error for this instance */
-
- CF2_RenderingFlags renderingFlags;
-
- /* variables that depend on Transform: */
- /* the following have zero translation; */
- /* inner * outer = font * original */
-
- CF2_Matrix currentTransform; /* original client matrix */
- CF2_Matrix innerTransform; /* for hinting; erect, scaled */
- CF2_Matrix outerTransform; /* post hinting; includes rotations */
- CF2_Fixed ppem; /* transform-dependent */
-
- CF2_Int unitsPerEm;
-
- CF2_Fixed syntheticEmboldeningAmountX; /* character space units */
- CF2_Fixed syntheticEmboldeningAmountY; /* character space units */
-
- /* FreeType related members */
- CF2_OutlineRec outline; /* freetype glyph outline functions */
- CFF_Decoder* decoder;
- CFF_SubFont lastSubfont; /* FreeType parsed data; */
- /* top font or subfont */
-
- /* these flags can vary from one call to the next */
- FT_Bool hinted;
- FT_Bool darkened; /* true if stemDarkened or synthetic bold */
- /* i.e. darkenX != 0 || darkenY != 0 */
- FT_Bool stemDarkened;
-
- FT_Int darkenParams[8]; /* 1000 unit character space */
-
- /* variables that depend on both FontDict and Transform */
- CF2_Fixed stdVW; /* in character space; depends on dict entry */
- CF2_Fixed stdHW; /* in character space; depends on dict entry */
- CF2_Fixed darkenX; /* character space units */
- CF2_Fixed darkenY; /* depends on transform */
- /* and private dict (StdVW) */
- FT_Bool reverseWinding; /* darken assuming */
- /* counterclockwise winding */
-
- CF2_BluesRec blues; /* computed zone data */
- };
-
-
- FT_LOCAL( FT_Error )
- cf2_getGlyphOutline( CF2_Font font,
- CF2_Buffer charstring,
- const CF2_Matrix* transform,
- CF2_F16Dot16* glyphWidth );
-
-
-FT_END_HEADER
-
-
-#endif /* __CF2FONT_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/cff/cf2ft.c b/chromium/third_party/pdfium/third_party/freetype/src/cff/cf2ft.c
deleted file mode 100644
index d2544a23451..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/cff/cf2ft.c
+++ /dev/null
@@ -1,700 +0,0 @@
-/***************************************************************************/
-/* */
-/* cf2ft.c */
-/* */
-/* FreeType Glue Component to Adobe's Interpreter (body). */
-/* */
-/* Copyright 2013-2014 Adobe Systems Incorporated. */
-/* */
-/* This software, and all works of authorship, whether in source or */
-/* object code form as indicated by the copyright notice(s) included */
-/* herein (collectively, the "Work") is made available, and may only be */
-/* used, modified, and distributed under the FreeType Project License, */
-/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */
-/* FreeType Project License, each contributor to the Work hereby grants */
-/* to any individual or legal entity exercising permissions granted by */
-/* the FreeType Project License and this section (hereafter, "You" or */
-/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */
-/* royalty-free, irrevocable (except as stated in this section) patent */
-/* license to make, have made, use, offer to sell, sell, import, and */
-/* otherwise transfer the Work, where such license applies only to those */
-/* patent claims licensable by such contributor that are necessarily */
-/* infringed by their contribution(s) alone or by combination of their */
-/* contribution(s) with the Work to which such contribution(s) was */
-/* submitted. If You institute patent litigation against any entity */
-/* (including a cross-claim or counterclaim in a lawsuit) alleging that */
-/* the Work or a contribution incorporated within the Work constitutes */
-/* direct or contributory patent infringement, then any patent licenses */
-/* granted to You under this License for that Work shall terminate as of */
-/* the date such litigation is filed. */
-/* */
-/* By using, modifying, or distributing the Work you indicate that you */
-/* have read and understood the terms and conditions of the */
-/* FreeType Project License as well as those provided in this section, */
-/* and you accept them fully. */
-/* */
-/***************************************************************************/
-
-
-#include "cf2ft.h"
-#include FT_INTERNAL_DEBUG_H
-
-#include "cf2font.h"
-#include "cf2error.h"
-
-
-#define CF2_MAX_SIZE cf2_intToFixed( 2000 ) /* max ppem */
-
-
- /*
- * This check should avoid most internal overflow cases. Clients should
- * generally respond to `Glyph_Too_Big' by getting a glyph outline
- * at EM size, scaling it and filling it as a graphics operation.
- *
- */
- static FT_Error
- cf2_checkTransform( const CF2_Matrix* transform,
- CF2_Int unitsPerEm )
- {
- CF2_Fixed maxScale;
-
-
- FT_ASSERT( unitsPerEm > 0 );
-
- if ( transform->a <= 0 || transform->d <= 0 )
- return FT_THROW( Invalid_Size_Handle );
-
- FT_ASSERT( transform->b == 0 && transform->c == 0 );
- FT_ASSERT( transform->tx == 0 && transform->ty == 0 );
-
- if ( unitsPerEm > 0x7FFF )
- return FT_THROW( Glyph_Too_Big );
-
- maxScale = FT_DivFix( CF2_MAX_SIZE, cf2_intToFixed( unitsPerEm ) );
-
- if ( transform->a > maxScale || transform->d > maxScale )
- return FT_THROW( Glyph_Too_Big );
-
- return FT_Err_Ok;
- }
-
-
- static void
- cf2_setGlyphWidth( CF2_Outline outline,
- CF2_Fixed width )
- {
- CFF_Decoder* decoder = outline->decoder;
-
-
- FT_ASSERT( decoder );
-
- decoder->glyph_width = cf2_fixedToInt( width );
- }
-
-
- /* Clean up font instance. */
- static void
- cf2_free_instance( void* ptr )
- {
- CF2_Font font = (CF2_Font)ptr;
-
-
- if ( font )
- {
- FT_Memory memory = font->memory;
-
-
- (void)memory;
- }
- }
-
-
- /********************************************/
- /* */
- /* functions for handling client outline; */
- /* FreeType uses coordinates in 26.6 format */
- /* */
- /********************************************/
-
- static void
- cf2_builder_moveTo( CF2_OutlineCallbacks callbacks,
- const CF2_CallbackParams params )
- {
- /* downcast the object pointer */
- CF2_Outline outline = (CF2_Outline)callbacks;
- CFF_Builder* builder;
-
- (void)params; /* only used in debug mode */
-
-
- FT_ASSERT( outline && outline->decoder );
- FT_ASSERT( params->op == CF2_PathOpMoveTo );
-
- builder = &outline->decoder->builder;
-
- /* note: two successive moves simply close the contour twice */
- cff_builder_close_contour( builder );
- builder->path_begun = 0;
- }
-
-
- static void
- cf2_builder_lineTo( CF2_OutlineCallbacks callbacks,
- const CF2_CallbackParams params )
- {
- FT_Error error;
-
- /* downcast the object pointer */
- CF2_Outline outline = (CF2_Outline)callbacks;
- CFF_Builder* builder;
-
-
- FT_ASSERT( outline && outline->decoder );
- FT_ASSERT( params->op == CF2_PathOpLineTo );
-
- builder = &outline->decoder->builder;
-
- if ( !builder->path_begun )
- {
- /* record the move before the line; also check points and set */
- /* `path_begun' */
- error = cff_builder_start_point( builder,
- params->pt0.x,
- params->pt0.y );
- if ( error )
- {
- if ( !*callbacks->error )
- *callbacks->error = error;
- return;
- }
- }
-
- /* `cff_builder_add_point1' includes a check_points call for one point */
- error = cff_builder_add_point1( builder,
- params->pt1.x,
- params->pt1.y );
- if ( error )
- {
- if ( !*callbacks->error )
- *callbacks->error = error;
- return;
- }
- }
-
-
- static void
- cf2_builder_cubeTo( CF2_OutlineCallbacks callbacks,
- const CF2_CallbackParams params )
- {
- FT_Error error;
-
- /* downcast the object pointer */
- CF2_Outline outline = (CF2_Outline)callbacks;
- CFF_Builder* builder;
-
-
- FT_ASSERT( outline && outline->decoder );
- FT_ASSERT( params->op == CF2_PathOpCubeTo );
-
- builder = &outline->decoder->builder;
-
- if ( !builder->path_begun )
- {
- /* record the move before the line; also check points and set */
- /* `path_begun' */
- error = cff_builder_start_point( builder,
- params->pt0.x,
- params->pt0.y );
- if ( error )
- {
- if ( !*callbacks->error )
- *callbacks->error = error;
- return;
- }
- }
-
- /* prepare room for 3 points: 2 off-curve, 1 on-curve */
- error = cff_check_points( builder, 3 );
- if ( error )
- {
- if ( !*callbacks->error )
- *callbacks->error = error;
- return;
- }
-
- cff_builder_add_point( builder,
- params->pt1.x,
- params->pt1.y, 0 );
- cff_builder_add_point( builder,
- params->pt2.x,
- params->pt2.y, 0 );
- cff_builder_add_point( builder,
- params->pt3.x,
- params->pt3.y, 1 );
- }
-
-
- static void
- cf2_outline_init( CF2_Outline outline,
- FT_Memory memory,
- FT_Error* error )
- {
- FT_MEM_ZERO( outline, sizeof ( CF2_OutlineRec ) );
-
- outline->root.memory = memory;
- outline->root.error = error;
-
- outline->root.moveTo = cf2_builder_moveTo;
- outline->root.lineTo = cf2_builder_lineTo;
- outline->root.cubeTo = cf2_builder_cubeTo;
- }
-
-
- /* get scaling and hint flag from GlyphSlot */
- static void
- cf2_getScaleAndHintFlag( CFF_Decoder* decoder,
- CF2_Fixed* x_scale,
- CF2_Fixed* y_scale,
- FT_Bool* hinted,
- FT_Bool* scaled )
- {
- FT_ASSERT( decoder && decoder->builder.glyph );
-
- /* note: FreeType scale includes a factor of 64 */
- *hinted = decoder->builder.glyph->hint;
- *scaled = decoder->builder.glyph->scaled;
-
- if ( *hinted )
- {
- *x_scale = ( decoder->builder.glyph->x_scale + 32 ) / 64;
- *y_scale = ( decoder->builder.glyph->y_scale + 32 ) / 64;
- }
- else
- {
- /* for unhinted outlines, `cff_slot_load' does the scaling, */
- /* thus render at `unity' scale */
-
- *x_scale = 0x0400; /* 1/64 as 16.16 */
- *y_scale = 0x0400;
- }
- }
-
-
- /* get units per em from `FT_Face' */
- /* TODO: should handle font matrix concatenation? */
- static FT_UShort
- cf2_getUnitsPerEm( CFF_Decoder* decoder )
- {
- FT_ASSERT( decoder && decoder->builder.face );
- FT_ASSERT( decoder->builder.face->root.units_per_EM );
-
- return decoder->builder.face->root.units_per_EM;
- }
-
-
- /* Main entry point: Render one glyph. */
- FT_LOCAL_DEF( FT_Error )
- cf2_decoder_parse_charstrings( CFF_Decoder* decoder,
- FT_Byte* charstring_base,
- FT_ULong charstring_len )
- {
- FT_Memory memory;
- FT_Error error = FT_Err_Ok;
- CF2_Font font;
-
-
- FT_ASSERT( decoder && decoder->cff );
-
- memory = decoder->builder.memory;
-
- /* CF2 data is saved here across glyphs */
- font = (CF2_Font)decoder->cff->cf2_instance.data;
-
- /* on first glyph, allocate instance structure */
- if ( decoder->cff->cf2_instance.data == NULL )
- {
- decoder->cff->cf2_instance.finalizer =
- (FT_Generic_Finalizer)cf2_free_instance;
-
- if ( FT_ALLOC( decoder->cff->cf2_instance.data,
- sizeof ( CF2_FontRec ) ) )
- return FT_THROW( Out_Of_Memory );
-
- font = (CF2_Font)decoder->cff->cf2_instance.data;
-
- font->memory = memory;
-
- /* initialize a client outline, to be shared by each glyph rendered */
- cf2_outline_init( &font->outline, font->memory, &font->error );
- }
-
- /* save decoder; it is a stack variable and will be different on each */
- /* call */
- font->decoder = decoder;
- font->outline.decoder = decoder;
-
- {
- /* build parameters for Adobe engine */
-
- CFF_Builder* builder = &decoder->builder;
- CFF_Driver driver = (CFF_Driver)FT_FACE_DRIVER( builder->face );
-
- /* local error */
- FT_Error error2 = FT_Err_Ok;
- CF2_BufferRec buf;
- CF2_Matrix transform;
- CF2_F16Dot16 glyphWidth;
-
- FT_Bool hinted;
- FT_Bool scaled;
-
-
- /* FreeType has already looked up the GID; convert to */
- /* `RegionBuffer', assuming that the input has been validated */
- FT_ASSERT( charstring_base + charstring_len >= charstring_base );
-
- FT_ZERO( &buf );
- buf.start =
- buf.ptr = charstring_base;
- buf.end = charstring_base + charstring_len;
-
- FT_ZERO( &transform );
-
- cf2_getScaleAndHintFlag( decoder,
- &transform.a,
- &transform.d,
- &hinted,
- &scaled );
-
- font->renderingFlags = 0;
- if ( hinted )
- font->renderingFlags |= CF2_FlagsHinted;
- if ( scaled && !driver->no_stem_darkening )
- font->renderingFlags |= CF2_FlagsDarkened;
-
- font->darkenParams[0] = driver->darken_params[0];
- font->darkenParams[1] = driver->darken_params[1];
- font->darkenParams[2] = driver->darken_params[2];
- font->darkenParams[3] = driver->darken_params[3];
- font->darkenParams[4] = driver->darken_params[4];
- font->darkenParams[5] = driver->darken_params[5];
- font->darkenParams[6] = driver->darken_params[6];
- font->darkenParams[7] = driver->darken_params[7];
-
- /* now get an outline for this glyph; */
- /* also get units per em to validate scale */
- font->unitsPerEm = (CF2_Int)cf2_getUnitsPerEm( decoder );
-
- if ( scaled )
- {
- error2 = cf2_checkTransform( &transform, font->unitsPerEm );
- if ( error2 )
- return error2;
- }
-
- error2 = cf2_getGlyphOutline( font, &buf, &transform, &glyphWidth );
- if ( error2 )
- return FT_ERR( Invalid_File_Format );
-
- cf2_setGlyphWidth( &font->outline, glyphWidth );
-
- return FT_Err_Ok;
- }
- }
-
-
- /* get pointer to current FreeType subfont (based on current glyphID) */
- FT_LOCAL_DEF( CFF_SubFont )
- cf2_getSubfont( CFF_Decoder* decoder )
- {
- FT_ASSERT( decoder && decoder->current_subfont );
-
- return decoder->current_subfont;
- }
-
-
- /* get `y_ppem' from `CFF_Size' */
- FT_LOCAL_DEF( CF2_Fixed )
- cf2_getPpemY( CFF_Decoder* decoder )
- {
- FT_ASSERT( decoder &&
- decoder->builder.face &&
- decoder->builder.face->root.size );
-
- /*
- * Note that `y_ppem' can be zero if there wasn't a call to
- * `FT_Set_Char_Size' or something similar. However, this isn't a
- * problem since we come to this place in the code only if
- * FT_LOAD_NO_SCALE is set (the other case gets caught by
- * `cf2_checkTransform'). The ppem value is needed to compute the stem
- * darkening, which is disabled for getting the unscaled outline.
- *
- */
- return cf2_intToFixed(
- decoder->builder.face->root.size->metrics.y_ppem );
- }
-
-
- /* get standard stem widths for the current subfont; */
- /* FreeType stores these as integer font units */
- /* (note: variable names seem swapped) */
- FT_LOCAL_DEF( CF2_Fixed )
- cf2_getStdVW( CFF_Decoder* decoder )
- {
- FT_ASSERT( decoder && decoder->current_subfont );
-
- return cf2_intToFixed(
- decoder->current_subfont->private_dict.standard_height );
- }
-
-
- FT_LOCAL_DEF( CF2_Fixed )
- cf2_getStdHW( CFF_Decoder* decoder )
- {
- FT_ASSERT( decoder && decoder->current_subfont );
-
- return cf2_intToFixed(
- decoder->current_subfont->private_dict.standard_width );
- }
-
-
- /* note: FreeType stores 1000 times the actual value for `BlueScale' */
- FT_LOCAL_DEF( void )
- cf2_getBlueMetrics( CFF_Decoder* decoder,
- CF2_Fixed* blueScale,
- CF2_Fixed* blueShift,
- CF2_Fixed* blueFuzz )
- {
- FT_ASSERT( decoder && decoder->current_subfont );
-
- *blueScale = FT_DivFix(
- decoder->current_subfont->private_dict.blue_scale,
- cf2_intToFixed( 1000 ) );
- *blueShift = cf2_intToFixed(
- decoder->current_subfont->private_dict.blue_shift );
- *blueFuzz = cf2_intToFixed(
- decoder->current_subfont->private_dict.blue_fuzz );
- }
-
-
- /* get blue values counts and arrays; the FreeType parser has validated */
- /* the counts and verified that each is an even number */
- FT_LOCAL_DEF( void )
- cf2_getBlueValues( CFF_Decoder* decoder,
- size_t* count,
- FT_Pos* *data )
- {
- FT_ASSERT( decoder && decoder->current_subfont );
-
- *count = decoder->current_subfont->private_dict.num_blue_values;
- *data = (FT_Pos*)
- &decoder->current_subfont->private_dict.blue_values;
- }
-
-
- FT_LOCAL_DEF( void )
- cf2_getOtherBlues( CFF_Decoder* decoder,
- size_t* count,
- FT_Pos* *data )
- {
- FT_ASSERT( decoder && decoder->current_subfont );
-
- *count = decoder->current_subfont->private_dict.num_other_blues;
- *data = (FT_Pos*)
- &decoder->current_subfont->private_dict.other_blues;
- }
-
-
- FT_LOCAL_DEF( void )
- cf2_getFamilyBlues( CFF_Decoder* decoder,
- size_t* count,
- FT_Pos* *data )
- {
- FT_ASSERT( decoder && decoder->current_subfont );
-
- *count = decoder->current_subfont->private_dict.num_family_blues;
- *data = (FT_Pos*)
- &decoder->current_subfont->private_dict.family_blues;
- }
-
-
- FT_LOCAL_DEF( void )
- cf2_getFamilyOtherBlues( CFF_Decoder* decoder,
- size_t* count,
- FT_Pos* *data )
- {
- FT_ASSERT( decoder && decoder->current_subfont );
-
- *count = decoder->current_subfont->private_dict.num_family_other_blues;
- *data = (FT_Pos*)
- &decoder->current_subfont->private_dict.family_other_blues;
- }
-
-
- FT_LOCAL_DEF( CF2_Int )
- cf2_getLanguageGroup( CFF_Decoder* decoder )
- {
- FT_ASSERT( decoder && decoder->current_subfont );
-
- return decoder->current_subfont->private_dict.language_group;
- }
-
-
- /* convert unbiased subroutine index to `CF2_Buffer' and */
- /* return 0 on success */
- FT_LOCAL_DEF( CF2_Int )
- cf2_initGlobalRegionBuffer( CFF_Decoder* decoder,
- CF2_UInt idx,
- CF2_Buffer buf )
- {
- FT_ASSERT( decoder );
-
- FT_ZERO( buf );
-
- idx += (CF2_UInt)decoder->globals_bias;
- if ( idx >= decoder->num_globals )
- return TRUE; /* error */
-
- FT_ASSERT( decoder->globals );
-
- buf->start =
- buf->ptr = decoder->globals[idx];
- buf->end = decoder->globals[idx + 1];
-
- return FALSE; /* success */
- }
-
-
- /* convert AdobeStandardEncoding code to CF2_Buffer; */
- /* used for seac component */
- FT_LOCAL_DEF( FT_Error )
- cf2_getSeacComponent( CFF_Decoder* decoder,
- CF2_Int code,
- CF2_Buffer buf )
- {
- CF2_Int gid;
- FT_Byte* charstring;
- FT_ULong len;
- FT_Error error;
-
-
- FT_ASSERT( decoder );
-
- FT_ZERO( buf );
-
-#ifdef FT_CONFIG_OPTION_INCREMENTAL
- /* Incremental fonts don't necessarily have valid charsets. */
- /* They use the character code, not the glyph index, in this case. */
- if ( decoder->builder.face->root.internal->incremental_interface )
- gid = code;
- else
-#endif /* FT_CONFIG_OPTION_INCREMENTAL */
- {
- gid = cff_lookup_glyph_by_stdcharcode( decoder->cff, code );
- if ( gid < 0 )
- return FT_THROW( Invalid_Glyph_Format );
- }
-
- error = cff_get_glyph_data( decoder->builder.face,
- (CF2_UInt)gid,
- &charstring,
- &len );
- /* TODO: for now, just pass the FreeType error through */
- if ( error )
- return error;
-
- /* assume input has been validated */
- FT_ASSERT( charstring + len >= charstring );
-
- buf->start = charstring;
- buf->end = charstring + len;
- buf->ptr = buf->start;
-
- return FT_Err_Ok;
- }
-
-
- FT_LOCAL_DEF( void )
- cf2_freeSeacComponent( CFF_Decoder* decoder,
- CF2_Buffer buf )
- {
- FT_ASSERT( decoder );
-
- cff_free_glyph_data( decoder->builder.face,
- (FT_Byte**)&buf->start,
- (FT_ULong)( buf->end - buf->start ) );
- }
-
-
- FT_LOCAL_DEF( CF2_Int )
- cf2_initLocalRegionBuffer( CFF_Decoder* decoder,
- CF2_UInt idx,
- CF2_Buffer buf )
- {
- FT_ASSERT( decoder );
-
- FT_ZERO( buf );
-
- idx += (CF2_UInt)decoder->locals_bias;
- if ( idx >= decoder->num_locals )
- return TRUE; /* error */
-
- FT_ASSERT( decoder->locals );
-
- buf->start =
- buf->ptr = decoder->locals[idx];
- buf->end = decoder->locals[idx + 1];
-
- return FALSE; /* success */
- }
-
-
- FT_LOCAL_DEF( CF2_Fixed )
- cf2_getDefaultWidthX( CFF_Decoder* decoder )
- {
- FT_ASSERT( decoder && decoder->current_subfont );
-
- return cf2_intToFixed(
- decoder->current_subfont->private_dict.default_width );
- }
-
-
- FT_LOCAL_DEF( CF2_Fixed )
- cf2_getNominalWidthX( CFF_Decoder* decoder )
- {
- FT_ASSERT( decoder && decoder->current_subfont );
-
- return cf2_intToFixed(
- decoder->current_subfont->private_dict.nominal_width );
- }
-
-
- FT_LOCAL_DEF( void )
- cf2_outline_reset( CF2_Outline outline )
- {
- CFF_Decoder* decoder = outline->decoder;
-
-
- FT_ASSERT( decoder );
-
- outline->root.windingMomentum = 0;
-
- FT_GlyphLoader_Rewind( decoder->builder.loader );
- }
-
-
- FT_LOCAL_DEF( void )
- cf2_outline_close( CF2_Outline outline )
- {
- CFF_Decoder* decoder = outline->decoder;
-
-
- FT_ASSERT( decoder );
-
- cff_builder_close_contour( &decoder->builder );
-
- FT_GlyphLoader_Add( decoder->builder.loader );
- }
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/cff/cf2ft.h b/chromium/third_party/pdfium/third_party/freetype/src/cff/cf2ft.h
deleted file mode 100644
index 3073df382f7..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/cff/cf2ft.h
+++ /dev/null
@@ -1,147 +0,0 @@
-/***************************************************************************/
-/* */
-/* cf2ft.h */
-/* */
-/* FreeType Glue Component to Adobe's Interpreter (specification). */
-/* */
-/* Copyright 2013 Adobe Systems Incorporated. */
-/* */
-/* This software, and all works of authorship, whether in source or */
-/* object code form as indicated by the copyright notice(s) included */
-/* herein (collectively, the "Work") is made available, and may only be */
-/* used, modified, and distributed under the FreeType Project License, */
-/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */
-/* FreeType Project License, each contributor to the Work hereby grants */
-/* to any individual or legal entity exercising permissions granted by */
-/* the FreeType Project License and this section (hereafter, "You" or */
-/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */
-/* royalty-free, irrevocable (except as stated in this section) patent */
-/* license to make, have made, use, offer to sell, sell, import, and */
-/* otherwise transfer the Work, where such license applies only to those */
-/* patent claims licensable by such contributor that are necessarily */
-/* infringed by their contribution(s) alone or by combination of their */
-/* contribution(s) with the Work to which such contribution(s) was */
-/* submitted. If You institute patent litigation against any entity */
-/* (including a cross-claim or counterclaim in a lawsuit) alleging that */
-/* the Work or a contribution incorporated within the Work constitutes */
-/* direct or contributory patent infringement, then any patent licenses */
-/* granted to You under this License for that Work shall terminate as of */
-/* the date such litigation is filed. */
-/* */
-/* By using, modifying, or distributing the Work you indicate that you */
-/* have read and understood the terms and conditions of the */
-/* FreeType Project License as well as those provided in this section, */
-/* and you accept them fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __CF2FT_H__
-#define __CF2FT_H__
-
-
-#include "cf2types.h"
-
-
- /* TODO: disable asserts for now */
-#define CF2_NDEBUG
-
-
-#include FT_SYSTEM_H
-
-#include "cf2glue.h"
-#include "cffgload.h" /* for CFF_Decoder */
-
-
-FT_BEGIN_HEADER
-
-
- FT_LOCAL( FT_Error )
- cf2_decoder_parse_charstrings( CFF_Decoder* decoder,
- FT_Byte* charstring_base,
- FT_ULong charstring_len );
-
- FT_LOCAL( CFF_SubFont )
- cf2_getSubfont( CFF_Decoder* decoder );
-
-
- FT_LOCAL( CF2_Fixed )
- cf2_getPpemY( CFF_Decoder* decoder );
- FT_LOCAL( CF2_Fixed )
- cf2_getStdVW( CFF_Decoder* decoder );
- FT_LOCAL( CF2_Fixed )
- cf2_getStdHW( CFF_Decoder* decoder );
-
- FT_LOCAL( void )
- cf2_getBlueMetrics( CFF_Decoder* decoder,
- CF2_Fixed* blueScale,
- CF2_Fixed* blueShift,
- CF2_Fixed* blueFuzz );
- FT_LOCAL( void )
- cf2_getBlueValues( CFF_Decoder* decoder,
- size_t* count,
- FT_Pos* *data );
- FT_LOCAL( void )
- cf2_getOtherBlues( CFF_Decoder* decoder,
- size_t* count,
- FT_Pos* *data );
- FT_LOCAL( void )
- cf2_getFamilyBlues( CFF_Decoder* decoder,
- size_t* count,
- FT_Pos* *data );
- FT_LOCAL( void )
- cf2_getFamilyOtherBlues( CFF_Decoder* decoder,
- size_t* count,
- FT_Pos* *data );
-
- FT_LOCAL( CF2_Int )
- cf2_getLanguageGroup( CFF_Decoder* decoder );
-
- FT_LOCAL( CF2_Int )
- cf2_initGlobalRegionBuffer( CFF_Decoder* decoder,
- CF2_UInt idx,
- CF2_Buffer buf );
- FT_LOCAL( FT_Error )
- cf2_getSeacComponent( CFF_Decoder* decoder,
- CF2_Int code,
- CF2_Buffer buf );
- FT_LOCAL( void )
- cf2_freeSeacComponent( CFF_Decoder* decoder,
- CF2_Buffer buf );
- FT_LOCAL( CF2_Int )
- cf2_initLocalRegionBuffer( CFF_Decoder* decoder,
- CF2_UInt idx,
- CF2_Buffer buf );
-
- FT_LOCAL( CF2_Fixed )
- cf2_getDefaultWidthX( CFF_Decoder* decoder );
- FT_LOCAL( CF2_Fixed )
- cf2_getNominalWidthX( CFF_Decoder* decoder );
-
-
- /*
- * FreeType client outline
- *
- * process output from the charstring interpreter
- */
- typedef struct CF2_OutlineRec_
- {
- CF2_OutlineCallbacksRec root; /* base class must be first */
- CFF_Decoder* decoder;
-
- } CF2_OutlineRec, *CF2_Outline;
-
-
- FT_LOCAL( void )
- cf2_outline_reset( CF2_Outline outline );
- FT_LOCAL( void )
- cf2_outline_close( CF2_Outline outline );
-
-
-FT_END_HEADER
-
-
-#endif /* __CF2FT_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/cff/cf2glue.h b/chromium/third_party/pdfium/third_party/freetype/src/cff/cf2glue.h
deleted file mode 100644
index a24da39e93c..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/cff/cf2glue.h
+++ /dev/null
@@ -1,144 +0,0 @@
-/***************************************************************************/
-/* */
-/* cf2glue.h */
-/* */
-/* Adobe's code for shared stuff (specification only). */
-/* */
-/* Copyright 2007-2013 Adobe Systems Incorporated. */
-/* */
-/* This software, and all works of authorship, whether in source or */
-/* object code form as indicated by the copyright notice(s) included */
-/* herein (collectively, the "Work") is made available, and may only be */
-/* used, modified, and distributed under the FreeType Project License, */
-/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */
-/* FreeType Project License, each contributor to the Work hereby grants */
-/* to any individual or legal entity exercising permissions granted by */
-/* the FreeType Project License and this section (hereafter, "You" or */
-/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */
-/* royalty-free, irrevocable (except as stated in this section) patent */
-/* license to make, have made, use, offer to sell, sell, import, and */
-/* otherwise transfer the Work, where such license applies only to those */
-/* patent claims licensable by such contributor that are necessarily */
-/* infringed by their contribution(s) alone or by combination of their */
-/* contribution(s) with the Work to which such contribution(s) was */
-/* submitted. If You institute patent litigation against any entity */
-/* (including a cross-claim or counterclaim in a lawsuit) alleging that */
-/* the Work or a contribution incorporated within the Work constitutes */
-/* direct or contributory patent infringement, then any patent licenses */
-/* granted to You under this License for that Work shall terminate as of */
-/* the date such litigation is filed. */
-/* */
-/* By using, modifying, or distributing the Work you indicate that you */
-/* have read and understood the terms and conditions of the */
-/* FreeType Project License as well as those provided in this section, */
-/* and you accept them fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __CF2GLUE_H__
-#define __CF2GLUE_H__
-
-
-/* common includes for other modules */
-#include "cf2error.h"
-#include "cf2fixed.h"
-#include "cf2arrst.h"
-#include "cf2read.h"
-
-
-FT_BEGIN_HEADER
-
-
- /* rendering parameters */
-
- /* apply hints to rendered glyphs */
-#define CF2_FlagsHinted 1
- /* for testing */
-#define CF2_FlagsDarkened 2
-
- /* type for holding the flags */
- typedef CF2_Int CF2_RenderingFlags;
-
-
- /* elements of a glyph outline */
- typedef enum CF2_PathOp_
- {
- CF2_PathOpMoveTo = 1, /* change the current point */
- CF2_PathOpLineTo = 2, /* line */
- CF2_PathOpQuadTo = 3, /* quadratic curve */
- CF2_PathOpCubeTo = 4 /* cubic curve */
-
- } CF2_PathOp;
-
-
- /* a matrix of fixed point values */
- typedef struct CF2_Matrix_
- {
- CF2_F16Dot16 a;
- CF2_F16Dot16 b;
- CF2_F16Dot16 c;
- CF2_F16Dot16 d;
- CF2_F16Dot16 tx;
- CF2_F16Dot16 ty;
-
- } CF2_Matrix;
-
-
- /* these typedefs are needed by more than one header file */
- /* and gcc compiler doesn't allow redefinition */
- typedef struct CF2_FontRec_ CF2_FontRec, *CF2_Font;
- typedef struct CF2_HintRec_ CF2_HintRec, *CF2_Hint;
-
-
- /* A common structure for all callback parameters. */
- /* */
- /* Some members may be unused. For example, `pt0' is not used for */
- /* `moveTo' and `pt3' is not used for `quadTo'. The initial point `pt0' */
- /* is included for each path element for generality; curve conversions */
- /* need it. The `op' parameter allows one function to handle multiple */
- /* element types. */
-
- typedef struct CF2_CallbackParamsRec_
- {
- FT_Vector pt0;
- FT_Vector pt1;
- FT_Vector pt2;
- FT_Vector pt3;
-
- CF2_Int op;
-
- } CF2_CallbackParamsRec, *CF2_CallbackParams;
-
-
- /* forward reference */
- typedef struct CF2_OutlineCallbacksRec_ CF2_OutlineCallbacksRec,
- *CF2_OutlineCallbacks;
-
- /* callback function pointers */
- typedef void
- (*CF2_Callback_Type)( CF2_OutlineCallbacks callbacks,
- const CF2_CallbackParams params );
-
-
- struct CF2_OutlineCallbacksRec_
- {
- CF2_Callback_Type moveTo;
- CF2_Callback_Type lineTo;
- CF2_Callback_Type quadTo;
- CF2_Callback_Type cubeTo;
-
- CF2_Int windingMomentum; /* for winding order detection */
-
- FT_Memory memory;
- FT_Error* error;
- };
-
-
-FT_END_HEADER
-
-
-#endif /* __CF2GLUE_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/cff/cf2hints.c b/chromium/third_party/pdfium/third_party/freetype/src/cff/cf2hints.c
deleted file mode 100644
index 0e27000210d..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/cff/cf2hints.c
+++ /dev/null
@@ -1,1847 +0,0 @@
-/***************************************************************************/
-/* */
-/* cf2hints.c */
-/* */
-/* Adobe's code for handling CFF hints (body). */
-/* */
-/* Copyright 2007-2014 Adobe Systems Incorporated. */
-/* */
-/* This software, and all works of authorship, whether in source or */
-/* object code form as indicated by the copyright notice(s) included */
-/* herein (collectively, the "Work") is made available, and may only be */
-/* used, modified, and distributed under the FreeType Project License, */
-/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */
-/* FreeType Project License, each contributor to the Work hereby grants */
-/* to any individual or legal entity exercising permissions granted by */
-/* the FreeType Project License and this section (hereafter, "You" or */
-/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */
-/* royalty-free, irrevocable (except as stated in this section) patent */
-/* license to make, have made, use, offer to sell, sell, import, and */
-/* otherwise transfer the Work, where such license applies only to those */
-/* patent claims licensable by such contributor that are necessarily */
-/* infringed by their contribution(s) alone or by combination of their */
-/* contribution(s) with the Work to which such contribution(s) was */
-/* submitted. If You institute patent litigation against any entity */
-/* (including a cross-claim or counterclaim in a lawsuit) alleging that */
-/* the Work or a contribution incorporated within the Work constitutes */
-/* direct or contributory patent infringement, then any patent licenses */
-/* granted to You under this License for that Work shall terminate as of */
-/* the date such litigation is filed. */
-/* */
-/* By using, modifying, or distributing the Work you indicate that you */
-/* have read and understood the terms and conditions of the */
-/* FreeType Project License as well as those provided in this section, */
-/* and you accept them fully. */
-/* */
-/***************************************************************************/
-
-
-#include "cf2ft.h"
-#include FT_INTERNAL_DEBUG_H
-
-#include "cf2glue.h"
-#include "cf2font.h"
-#include "cf2hints.h"
-#include "cf2intrp.h"
-
-
- /*************************************************************************/
- /* */
- /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
- /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
- /* messages during execution. */
- /* */
-#undef FT_COMPONENT
-#define FT_COMPONENT trace_cf2hints
-
-
- typedef struct CF2_HintMoveRec_
- {
- size_t j; /* index of upper hint map edge */
- CF2_Fixed moveUp; /* adjustment to optimum position */
-
- } CF2_HintMoveRec, *CF2_HintMove;
-
-
- /* Compute angular momentum for winding order detection. It is called */
- /* for all lines and curves, but not necessarily in element order. */
- static CF2_Int
- cf2_getWindingMomentum( CF2_Fixed x1,
- CF2_Fixed y1,
- CF2_Fixed x2,
- CF2_Fixed y2 )
- {
- /* cross product of pt1 position from origin with pt2 position from */
- /* pt1; we reduce the precision so that the result fits into 32 bits */
-
- return ( x1 >> 16 ) * ( ( y2 - y1 ) >> 16 ) -
- ( y1 >> 16 ) * ( ( x2 - x1 ) >> 16 );
- }
-
-
- /*
- * Construct from a StemHint; this is used as a parameter to
- * `cf2_blues_capture'.
- * `hintOrigin' is the character space displacement of a seac accent.
- * Adjust stem hint for darkening here.
- *
- */
- static void
- cf2_hint_init( CF2_Hint hint,
- const CF2_ArrStack stemHintArray,
- size_t indexStemHint,
- const CF2_Font font,
- CF2_Fixed hintOrigin,
- CF2_Fixed scale,
- FT_Bool bottom )
- {
- CF2_Fixed width;
- const CF2_StemHintRec* stemHint;
-
-
- FT_ZERO( hint );
-
- stemHint = (const CF2_StemHintRec*)cf2_arrstack_getPointer(
- stemHintArray,
- indexStemHint );
-
- width = stemHint->max - stemHint->min;
-
- if ( width == cf2_intToFixed( -21 ) )
- {
- /* ghost bottom */
-
- if ( bottom )
- {
- hint->csCoord = stemHint->max;
- hint->flags = CF2_GhostBottom;
- }
- else
- hint->flags = 0;
- }
-
- else if ( width == cf2_intToFixed( -20 ) )
- {
- /* ghost top */
-
- if ( bottom )
- hint->flags = 0;
- else
- {
- hint->csCoord = stemHint->min;
- hint->flags = CF2_GhostTop;
- }
- }
-
- else if ( width < 0 )
- {
- /* inverted pair */
-
- /*
- * Hints with negative widths were produced by an early version of a
- * non-Adobe font tool. The Type 2 spec allows edge (ghost) hints
- * with negative widths, but says
- *
- * All other negative widths have undefined meaning.
- *
- * CoolType has a silent workaround that negates the hint width; for
- * permissive mode, we do the same here.
- *
- * Note: Such fonts cannot use ghost hints, but should otherwise work.
- * Note: Some poor hints in our faux fonts can produce negative
- * widths at some blends. For example, see a light weight of
- * `u' in ASerifMM.
- *
- */
- if ( bottom )
- {
- hint->csCoord = stemHint->max;
- hint->flags = CF2_PairBottom;
- }
- else
- {
- hint->csCoord = stemHint->min;
- hint->flags = CF2_PairTop;
- }
- }
-
- else
- {
- /* normal pair */
-
- if ( bottom )
- {
- hint->csCoord = stemHint->min;
- hint->flags = CF2_PairBottom;
- }
- else
- {
- hint->csCoord = stemHint->max;
- hint->flags = CF2_PairTop;
- }
- }
-
- /* Now that ghost hints have been detected, adjust this edge for */
- /* darkening. Bottoms are not changed; tops are incremented by twice */
- /* `darkenY'. */
- if ( cf2_hint_isTop( hint ) )
- hint->csCoord += 2 * font->darkenY;
-
- hint->csCoord += hintOrigin;
- hint->scale = scale;
- hint->index = indexStemHint; /* index in original stem hint array */
-
- /* if original stem hint has been used, use the same position */
- if ( hint->flags != 0 && stemHint->used )
- {
- if ( cf2_hint_isTop( hint ) )
- hint->dsCoord = stemHint->maxDS;
- else
- hint->dsCoord = stemHint->minDS;
-
- cf2_hint_lock( hint );
- }
- else
- hint->dsCoord = FT_MulFix( hint->csCoord, scale );
- }
-
-
- /* initialize an invalid hint map element */
- static void
- cf2_hint_initZero( CF2_Hint hint )
- {
- FT_ZERO( hint );
- }
-
-
- FT_LOCAL_DEF( FT_Bool )
- cf2_hint_isValid( const CF2_Hint hint )
- {
- return (FT_Bool)( hint->flags != 0 );
- }
-
-
- static FT_Bool
- cf2_hint_isPair( const CF2_Hint hint )
- {
- return (FT_Bool)( ( hint->flags &
- ( CF2_PairBottom | CF2_PairTop ) ) != 0 );
- }
-
-
- static FT_Bool
- cf2_hint_isPairTop( const CF2_Hint hint )
- {
- return (FT_Bool)( ( hint->flags & CF2_PairTop ) != 0 );
- }
-
-
- FT_LOCAL_DEF( FT_Bool )
- cf2_hint_isTop( const CF2_Hint hint )
- {
- return (FT_Bool)( ( hint->flags &
- ( CF2_PairTop | CF2_GhostTop ) ) != 0 );
- }
-
-
- FT_LOCAL_DEF( FT_Bool )
- cf2_hint_isBottom( const CF2_Hint hint )
- {
- return (FT_Bool)( ( hint->flags &
- ( CF2_PairBottom | CF2_GhostBottom ) ) != 0 );
- }
-
-
- static FT_Bool
- cf2_hint_isLocked( const CF2_Hint hint )
- {
- return (FT_Bool)( ( hint->flags & CF2_Locked ) != 0 );
- }
-
-
- static FT_Bool
- cf2_hint_isSynthetic( const CF2_Hint hint )
- {
- return (FT_Bool)( ( hint->flags & CF2_Synthetic ) != 0 );
- }
-
-
- FT_LOCAL_DEF( void )
- cf2_hint_lock( CF2_Hint hint )
- {
- hint->flags |= CF2_Locked;
- }
-
-
- FT_LOCAL_DEF( void )
- cf2_hintmap_init( CF2_HintMap hintmap,
- CF2_Font font,
- CF2_HintMap initialMap,
- CF2_ArrStack hintMoves,
- CF2_Fixed scale )
- {
- FT_ZERO( hintmap );
-
- /* copy parameters from font instance */
- hintmap->hinted = font->hinted;
- hintmap->scale = scale;
- hintmap->font = font;
- hintmap->initialHintMap = initialMap;
- /* will clear in `cf2_hintmap_adjustHints' */
- hintmap->hintMoves = hintMoves;
- }
-
-
- static FT_Bool
- cf2_hintmap_isValid( const CF2_HintMap hintmap )
- {
- return hintmap->isValid;
- }
-
-
- /* transform character space coordinate to device space using hint map */
- static CF2_Fixed
- cf2_hintmap_map( CF2_HintMap hintmap,
- CF2_Fixed csCoord )
- {
- if ( hintmap->count == 0 || ! hintmap->hinted )
- {
- /* there are no hints; use uniform scale and zero offset */
- return FT_MulFix( csCoord, hintmap->scale );
- }
- else
- {
- /* start linear search from last hit */
- CF2_UInt i = hintmap->lastIndex;
-
- FT_ASSERT( hintmap->lastIndex < CF2_MAX_HINT_EDGES );
-
- /* search up */
- while ( i < hintmap->count - 1 &&
- csCoord >= hintmap->edge[i + 1].csCoord )
- i += 1;
-
- /* search down */
- while ( i > 0 && csCoord < hintmap->edge[i].csCoord )
- i -= 1;
-
- hintmap->lastIndex = i;
-
- if ( i == 0 && csCoord < hintmap->edge[0].csCoord )
- {
- /* special case for points below first edge: use uniform scale */
- return FT_MulFix( csCoord - hintmap->edge[0].csCoord,
- hintmap->scale ) +
- hintmap->edge[0].dsCoord;
- }
- else
- {
- /*
- * Note: entries with duplicate csCoord are allowed.
- * Use edge[i], the highest entry where csCoord >= entry[i].csCoord
- */
- return FT_MulFix( csCoord - hintmap->edge[i].csCoord,
- hintmap->edge[i].scale ) +
- hintmap->edge[i].dsCoord;
- }
- }
- }
-
-
- /*
- * This hinting policy moves a hint pair in device space so that one of
- * its two edges is on a device pixel boundary (its fractional part is
- * zero). `cf2_hintmap_insertHint' guarantees no overlap in CS
- * space. Ensure here that there is no overlap in DS.
- *
- * In the first pass, edges are adjusted relative to adjacent hints.
- * Those that are below have already been adjusted. Those that are
- * above have not yet been adjusted. If a hint above blocks an
- * adjustment to an optimal position, we will try again in a second
- * pass. The second pass is top-down.
- *
- */
-
- static void
- cf2_hintmap_adjustHints( CF2_HintMap hintmap )
- {
- size_t i, j;
-
-
- cf2_arrstack_clear( hintmap->hintMoves ); /* working storage */
-
- /*
- * First pass is bottom-up (font hint order) without look-ahead.
- * Locked edges are already adjusted.
- * Unlocked edges begin with dsCoord from `initialHintMap'.
- * Save edges that are not optimally adjusted in `hintMoves' array,
- * and process them in second pass.
- */
-
- for ( i = 0; i < hintmap->count; i++ )
- {
- FT_Bool isPair = cf2_hint_isPair( &hintmap->edge[i] );
-
-
- /* index of upper edge (same value for ghost hint) */
- j = isPair ? i + 1 : i;
-
- FT_ASSERT( j < hintmap->count );
- FT_ASSERT( cf2_hint_isValid( &hintmap->edge[i] ) );
- FT_ASSERT( cf2_hint_isValid( &hintmap->edge[j] ) );
- FT_ASSERT( cf2_hint_isLocked( &hintmap->edge[i] ) ==
- cf2_hint_isLocked( &hintmap->edge[j] ) );
-
- if ( !cf2_hint_isLocked( &hintmap->edge[i] ) )
- {
- /* hint edge is not locked, we can adjust it */
- CF2_Fixed fracDown = cf2_fixedFraction( hintmap->edge[i].dsCoord );
- CF2_Fixed fracUp = cf2_fixedFraction( hintmap->edge[j].dsCoord );
-
- /* calculate all four possibilities; moves down are negative */
- CF2_Fixed downMoveDown = 0 - fracDown;
- CF2_Fixed upMoveDown = 0 - fracUp;
- CF2_Fixed downMoveUp = fracDown == 0
- ? 0
- : cf2_intToFixed( 1 ) - fracDown;
- CF2_Fixed upMoveUp = fracUp == 0
- ? 0
- : cf2_intToFixed( 1 ) - fracUp;
-
- /* smallest move up */
- CF2_Fixed moveUp = FT_MIN( downMoveUp, upMoveUp );
- /* smallest move down */
- CF2_Fixed moveDown = FT_MAX( downMoveDown, upMoveDown );
-
- /* final amount to move edge or edge pair */
- CF2_Fixed move;
-
- CF2_Fixed downMinCounter = CF2_MIN_COUNTER;
- CF2_Fixed upMinCounter = CF2_MIN_COUNTER;
- FT_Bool saveEdge = FALSE;
-
-
- /* minimum counter constraint doesn't apply when adjacent edges */
- /* are synthetic */
- /* TODO: doesn't seem a big effect; for now, reduce the code */
-#if 0
- if ( i == 0 ||
- cf2_hint_isSynthetic( &hintmap->edge[i - 1] ) )
- downMinCounter = 0;
-
- if ( j >= hintmap->count - 1 ||
- cf2_hint_isSynthetic( &hintmap->edge[j + 1] ) )
- upMinCounter = 0;
-#endif
-
- /* is there room to move up? */
- /* there is if we are at top of array or the next edge is at or */
- /* beyond proposed move up? */
- if ( j >= hintmap->count - 1 ||
- hintmap->edge[j + 1].dsCoord >=
- hintmap->edge[j].dsCoord + moveUp + upMinCounter )
- {
- /* there is room to move up; is there also room to move down? */
- if ( i == 0 ||
- hintmap->edge[i - 1].dsCoord <=
- hintmap->edge[i].dsCoord + moveDown - downMinCounter )
- {
- /* move smaller absolute amount */
- move = ( -moveDown < moveUp ) ? moveDown : moveUp; /* optimum */
- }
- else
- move = moveUp;
- }
- else
- {
- /* is there room to move down? */
- if ( i == 0 ||
- hintmap->edge[i - 1].dsCoord <=
- hintmap->edge[i].dsCoord + moveDown - downMinCounter )
- {
- move = moveDown;
- /* true if non-optimum move */
- saveEdge = (FT_Bool)( moveUp < -moveDown );
- }
- else
- {
- /* no room to move either way without overlapping or reducing */
- /* the counter too much */
- move = 0;
- saveEdge = TRUE;
- }
- }
-
- /* Identify non-moves and moves down that aren't optimal, and save */
- /* them for second pass. */
- /* Do this only if there is an unlocked edge above (which could */
- /* possibly move). */
- if ( saveEdge &&
- j < hintmap->count - 1 &&
- !cf2_hint_isLocked( &hintmap->edge[j + 1] ) )
- {
- CF2_HintMoveRec savedMove;
-
-
- savedMove.j = j;
- /* desired adjustment in second pass */
- savedMove.moveUp = moveUp - move;
-
- cf2_arrstack_push( hintmap->hintMoves, &savedMove );
- }
-
- /* move the edge(s) */
- hintmap->edge[i].dsCoord += move;
- if ( isPair )
- hintmap->edge[j].dsCoord += move;
- }
-
- /* assert there are no overlaps in device space */
- FT_ASSERT( i == 0 ||
- hintmap->edge[i - 1].dsCoord <= hintmap->edge[i].dsCoord );
- FT_ASSERT( i < j ||
- hintmap->edge[i].dsCoord <= hintmap->edge[j].dsCoord );
-
- /* adjust the scales, avoiding divide by zero */
- if ( i > 0 )
- {
- if ( hintmap->edge[i].csCoord != hintmap->edge[i - 1].csCoord )
- hintmap->edge[i - 1].scale =
- FT_DivFix(
- hintmap->edge[i].dsCoord - hintmap->edge[i - 1].dsCoord,
- hintmap->edge[i].csCoord - hintmap->edge[i - 1].csCoord );
- }
-
- if ( isPair )
- {
- if ( hintmap->edge[j].csCoord != hintmap->edge[j - 1].csCoord )
- hintmap->edge[j - 1].scale =
- FT_DivFix(
- hintmap->edge[j].dsCoord - hintmap->edge[j - 1].dsCoord,
- hintmap->edge[j].csCoord - hintmap->edge[j - 1].csCoord );
-
- i += 1; /* skip upper edge on next loop */
- }
- }
-
- /* second pass tries to move non-optimal hints up, in case there is */
- /* room now */
- for ( i = cf2_arrstack_size( hintmap->hintMoves ); i > 0; i-- )
- {
- CF2_HintMove hintMove = (CF2_HintMove)
- cf2_arrstack_getPointer( hintmap->hintMoves, i - 1 );
-
-
- j = hintMove->j;
-
- /* this was tested before the push, above */
- FT_ASSERT( j < hintmap->count - 1 );
-
- /* is there room to move up? */
- if ( hintmap->edge[j + 1].dsCoord >=
- hintmap->edge[j].dsCoord + hintMove->moveUp + CF2_MIN_COUNTER )
- {
- /* there is more room now, move edge up */
- hintmap->edge[j].dsCoord += hintMove->moveUp;
-
- if ( cf2_hint_isPair( &hintmap->edge[j] ) )
- {
- FT_ASSERT( j > 0 );
- hintmap->edge[j - 1].dsCoord += hintMove->moveUp;
- }
- }
- }
- }
-
-
- /* insert hint edges into map, sorted by csCoord */
- static void
- cf2_hintmap_insertHint( CF2_HintMap hintmap,
- CF2_Hint bottomHintEdge,
- CF2_Hint topHintEdge )
- {
- CF2_UInt indexInsert;
-
- /* set default values, then check for edge hints */
- FT_Bool isPair = TRUE;
- CF2_Hint firstHintEdge = bottomHintEdge;
- CF2_Hint secondHintEdge = topHintEdge;
-
-
- /* one or none of the input params may be invalid when dealing with */
- /* edge hints; at least one edge must be valid */
- FT_ASSERT( cf2_hint_isValid( bottomHintEdge ) ||
- cf2_hint_isValid( topHintEdge ) );
-
- /* determine how many and which edges to insert */
- if ( !cf2_hint_isValid( bottomHintEdge ) )
- {
- /* insert only the top edge */
- firstHintEdge = topHintEdge;
- isPair = FALSE;
- }
- else if ( !cf2_hint_isValid( topHintEdge ) )
- {
- /* insert only the bottom edge */
- isPair = FALSE;
- }
-
- /* paired edges must be in proper order */
- FT_ASSERT( !isPair ||
- topHintEdge->csCoord >= bottomHintEdge->csCoord );
-
- /* linear search to find index value of insertion point */
- indexInsert = 0;
- for ( ; indexInsert < hintmap->count; indexInsert++ )
- {
- if ( hintmap->edge[indexInsert].csCoord >= firstHintEdge->csCoord )
- break;
- }
-
- /*
- * Discard any hints that overlap in character space. Most often, this
- * is while building the initial map, where captured hints from all
- * zones are combined. Define overlap to include hints that `touch'
- * (overlap zero). Hiragino Sans/Gothic fonts have numerous hints that
- * touch. Some fonts have non-ideographic glyphs that overlap our
- * synthetic hints.
- *
- * Overlap also occurs when darkening stem hints that are close.
- *
- */
- if ( indexInsert < hintmap->count )
- {
- /* we are inserting before an existing edge: */
- /* verify that an existing edge is not the same */
- if ( hintmap->edge[indexInsert].csCoord == firstHintEdge->csCoord )
- return; /* ignore overlapping stem hint */
-
- /* verify that a new pair does not straddle the next edge */
- if ( isPair &&
- hintmap->edge[indexInsert].csCoord <= secondHintEdge->csCoord )
- return; /* ignore overlapping stem hint */
-
- /* verify that we are not inserting between paired edges */
- if ( cf2_hint_isPairTop( &hintmap->edge[indexInsert] ) )
- return; /* ignore overlapping stem hint */
- }
-
- /* recompute device space locations using initial hint map */
- if ( cf2_hintmap_isValid( hintmap->initialHintMap ) &&
- !cf2_hint_isLocked( firstHintEdge ) )
- {
- if ( isPair )
- {
- /* Use hint map to position the center of stem, and nominal scale */
- /* to position the two edges. This preserves the stem width. */
- CF2_Fixed midpoint = cf2_hintmap_map(
- hintmap->initialHintMap,
- ( secondHintEdge->csCoord +
- firstHintEdge->csCoord ) / 2 );
- CF2_Fixed halfWidth = FT_MulFix(
- ( secondHintEdge->csCoord -
- firstHintEdge->csCoord ) / 2,
- hintmap->scale );
-
-
- firstHintEdge->dsCoord = midpoint - halfWidth;
- secondHintEdge->dsCoord = midpoint + halfWidth;
- }
- else
- firstHintEdge->dsCoord = cf2_hintmap_map( hintmap->initialHintMap,
- firstHintEdge->csCoord );
- }
-
- /*
- * Discard any hints that overlap in device space; this can occur
- * because locked hints have been moved to align with blue zones.
- *
- * TODO: Although we might correct this later during adjustment, we
- * don't currently have a way to delete a conflicting hint once it has
- * been inserted. See v2.030 MinionPro-Regular, 12 ppem darkened,
- * initial hint map for second path, glyph 945 (the perispomeni (tilde)
- * in U+1F6E, Greek omega with psili and perispomeni). Darkening is
- * 25. Pair 667,747 initially conflicts in design space with top edge
- * 660. This is because 667 maps to 7.87, and the top edge was
- * captured by a zone at 8.0. The pair is later successfully inserted
- * in a zone without the top edge. In this zone it is adjusted to 8.0,
- * and no longer conflicts with the top edge in design space. This
- * means it can be included in yet a later zone which does have the top
- * edge hint. This produces a small mismatch between the first and
- * last points of this path, even though the hint masks are the same.
- * The density map difference is tiny (1/256).
- *
- */
-
- if ( indexInsert > 0 )
- {
- /* we are inserting after an existing edge */
- if ( firstHintEdge->dsCoord < hintmap->edge[indexInsert - 1].dsCoord )
- return;
- }
-
- if ( indexInsert < hintmap->count )
- {
- /* we are inserting before an existing edge */
- if ( isPair )
- {
- if ( secondHintEdge->dsCoord > hintmap->edge[indexInsert].dsCoord )
- return;
- }
- else
- {
- if ( firstHintEdge->dsCoord > hintmap->edge[indexInsert].dsCoord )
- return;
- }
- }
-
- /* make room to insert */
- {
- CF2_UInt iSrc = hintmap->count - 1;
- CF2_UInt iDst = isPair ? hintmap->count + 1 : hintmap->count;
-
- CF2_UInt count = hintmap->count - indexInsert;
-
-
- if ( iDst >= CF2_MAX_HINT_EDGES )
- {
- FT_TRACE4(( "cf2_hintmap_insertHint: too many hintmaps\n" ));
- return;
- }
-
- while ( count-- )
- hintmap->edge[iDst--] = hintmap->edge[iSrc--];
-
- /* insert first edge */
- hintmap->edge[indexInsert] = *firstHintEdge; /* copy struct */
- hintmap->count += 1;
-
- if ( isPair )
- {
- /* insert second edge */
- hintmap->edge[indexInsert + 1] = *secondHintEdge; /* copy struct */
- hintmap->count += 1;
- }
- }
-
- return;
- }
-
-
- /*
- * Build a map from hints and mask.
- *
- * This function may recur one level if `hintmap->initialHintMap' is not yet
- * valid.
- * If `initialMap' is true, simply build initial map.
- *
- * Synthetic hints are used in two ways. A hint at zero is inserted, if
- * needed, in the initial hint map, to prevent translations from
- * propagating across the origin. If synthetic em box hints are enabled
- * for ideographic dictionaries, then they are inserted in all hint
- * maps, including the initial one.
- *
- */
- FT_LOCAL_DEF( void )
- cf2_hintmap_build( CF2_HintMap hintmap,
- CF2_ArrStack hStemHintArray,
- CF2_ArrStack vStemHintArray,
- CF2_HintMask hintMask,
- CF2_Fixed hintOrigin,
- FT_Bool initialMap )
- {
- FT_Byte* maskPtr;
-
- CF2_Font font = hintmap->font;
- CF2_HintMaskRec tempHintMask;
-
- size_t bitCount, i;
- FT_Byte maskByte;
-
-
- /* check whether initial map is constructed */
- if ( !initialMap && !cf2_hintmap_isValid( hintmap->initialHintMap ) )
- {
- /* make recursive call with initialHintMap and temporary mask; */
- /* temporary mask will get all bits set, below */
- cf2_hintmask_init( &tempHintMask, hintMask->error );
- cf2_hintmap_build( hintmap->initialHintMap,
- hStemHintArray,
- vStemHintArray,
- &tempHintMask,
- hintOrigin,
- TRUE );
- }
-
- if ( !cf2_hintmask_isValid( hintMask ) )
- {
- /* without a hint mask, assume all hints are active */
- cf2_hintmask_setAll( hintMask,
- cf2_arrstack_size( hStemHintArray ) +
- cf2_arrstack_size( vStemHintArray ) );
- if ( !cf2_hintmask_isValid( hintMask ) )
- return; /* too many stem hints */
- }
-
- /* begin by clearing the map */
- hintmap->count = 0;
- hintmap->lastIndex = 0;
-
- /* make a copy of the hint mask so we can modify it */
- tempHintMask = *hintMask;
- maskPtr = cf2_hintmask_getMaskPtr( &tempHintMask );
-
- /* use the hStem hints only, which are first in the mask */
- bitCount = cf2_arrstack_size( hStemHintArray );
-
- /* Defense-in-depth. Should never return here. */
- if ( bitCount > hintMask->bitCount )
- return;
-
- /* synthetic embox hints get highest priority */
- if ( font->blues.doEmBoxHints )
- {
- CF2_HintRec dummy;
-
-
- cf2_hint_initZero( &dummy ); /* invalid hint map element */
-
- /* ghost bottom */
- cf2_hintmap_insertHint( hintmap,
- &font->blues.emBoxBottomEdge,
- &dummy );
- /* ghost top */
- cf2_hintmap_insertHint( hintmap,
- &dummy,
- &font->blues.emBoxTopEdge );
- }
-
- /* insert hints captured by a blue zone or already locked (higher */
- /* priority) */
- for ( i = 0, maskByte = 0x80; i < bitCount; i++ )
- {
- if ( maskByte & *maskPtr )
- {
- /* expand StemHint into two `CF2_Hint' elements */
- CF2_HintRec bottomHintEdge, topHintEdge;
-
-
- cf2_hint_init( &bottomHintEdge,
- hStemHintArray,
- i,
- font,
- hintOrigin,
- hintmap->scale,
- TRUE /* bottom */ );
- cf2_hint_init( &topHintEdge,
- hStemHintArray,
- i,
- font,
- hintOrigin,
- hintmap->scale,
- FALSE /* top */ );
-
- if ( cf2_hint_isLocked( &bottomHintEdge ) ||
- cf2_hint_isLocked( &topHintEdge ) ||
- cf2_blues_capture( &font->blues,
- &bottomHintEdge,
- &topHintEdge ) )
- {
- /* insert captured hint into map */
- cf2_hintmap_insertHint( hintmap, &bottomHintEdge, &topHintEdge );
-
- *maskPtr &= ~maskByte; /* turn off the bit for this hint */
- }
- }
-
- if ( ( i & 7 ) == 7 )
- {
- /* move to next mask byte */
- maskPtr++;
- maskByte = 0x80;
- }
- else
- maskByte >>= 1;
- }
-
- /* initial hint map includes only captured hints plus maybe one at 0 */
-
- /*
- * TODO: There is a problem here because we are trying to build a
- * single hint map containing all captured hints. It is
- * possible for there to be conflicts between captured hints,
- * either because of darkening or because the hints are in
- * separate hint zones (we are ignoring hint zones for the
- * initial map). An example of the latter is MinionPro-Regular
- * v2.030 glyph 883 (Greek Capital Alpha with Psili) at 15ppem.
- * A stem hint for the psili conflicts with the top edge hint
- * for the base character. The stem hint gets priority because
- * of its sort order. In glyph 884 (Greek Capital Alpha with
- * Psili and Oxia), the top of the base character gets a stem
- * hint, and the psili does not. This creates different initial
- * maps for the two glyphs resulting in different renderings of
- * the base character. Will probably defer this either as not
- * worth the cost or as a font bug. I don't think there is any
- * good reason for an accent to be captured by an alignment
- * zone. -darnold 2/12/10
- */
-
- if ( initialMap )
- {
- /* Apply a heuristic that inserts a point for (0,0), unless it's */
- /* already covered by a mapping. This locks the baseline for glyphs */
- /* that have no baseline hints. */
-
- if ( hintmap->count == 0 ||
- hintmap->edge[0].csCoord > 0 ||
- hintmap->edge[hintmap->count - 1].csCoord < 0 )
- {
- /* all edges are above 0 or all edges are below 0; */
- /* construct a locked edge hint at 0 */
-
- CF2_HintRec edge, invalid;
-
-
- cf2_hint_initZero( &edge );
-
- edge.flags = CF2_GhostBottom |
- CF2_Locked |
- CF2_Synthetic;
- edge.scale = hintmap->scale;
-
- cf2_hint_initZero( &invalid );
- cf2_hintmap_insertHint( hintmap, &edge, &invalid );
- }
- }
- else
- {
- /* insert remaining hints */
-
- maskPtr = cf2_hintmask_getMaskPtr( &tempHintMask );
-
- for ( i = 0, maskByte = 0x80; i < bitCount; i++ )
- {
- if ( maskByte & *maskPtr )
- {
- CF2_HintRec bottomHintEdge, topHintEdge;
-
-
- cf2_hint_init( &bottomHintEdge,
- hStemHintArray,
- i,
- font,
- hintOrigin,
- hintmap->scale,
- TRUE /* bottom */ );
- cf2_hint_init( &topHintEdge,
- hStemHintArray,
- i,
- font,
- hintOrigin,
- hintmap->scale,
- FALSE /* top */ );
-
- cf2_hintmap_insertHint( hintmap, &bottomHintEdge, &topHintEdge );
- }
-
- if ( ( i & 7 ) == 7 )
- {
- /* move to next mask byte */
- maskPtr++;
- maskByte = 0x80;
- }
- else
- maskByte >>= 1;
- }
- }
-
- /*
- * Note: The following line is a convenient place to break when
- * debugging hinting. Examine `hintmap->edge' for the list of
- * enabled hints, then step over the call to see the effect of
- * adjustment. We stop here first on the recursive call that
- * creates the initial map, and then on each counter group and
- * hint zone.
- */
-
- /* adjust positions of hint edges that are not locked to blue zones */
- cf2_hintmap_adjustHints( hintmap );
-
- /* save the position of all hints that were used in this hint map; */
- /* if we use them again, we'll locate them in the same position */
- if ( !initialMap )
- {
- for ( i = 0; i < hintmap->count; i++ )
- {
- if ( !cf2_hint_isSynthetic( &hintmap->edge[i] ) )
- {
- /* Note: include both valid and invalid edges */
- /* Note: top and bottom edges are copied back separately */
- CF2_StemHint stemhint = (CF2_StemHint)
- cf2_arrstack_getPointer( hStemHintArray,
- hintmap->edge[i].index );
-
-
- if ( cf2_hint_isTop( &hintmap->edge[i] ) )
- stemhint->maxDS = hintmap->edge[i].dsCoord;
- else
- stemhint->minDS = hintmap->edge[i].dsCoord;
-
- stemhint->used = TRUE;
- }
- }
- }
-
- /* hint map is ready to use */
- hintmap->isValid = TRUE;
-
- /* remember this mask has been used */
- cf2_hintmask_setNew( hintMask, FALSE );
- }
-
-
- FT_LOCAL_DEF( void )
- cf2_glyphpath_init( CF2_GlyphPath glyphpath,
- CF2_Font font,
- CF2_OutlineCallbacks callbacks,
- CF2_Fixed scaleY,
- /* CF2_Fixed hShift, */
- CF2_ArrStack hStemHintArray,
- CF2_ArrStack vStemHintArray,
- CF2_HintMask hintMask,
- CF2_Fixed hintOriginY,
- const CF2_Blues blues,
- const FT_Vector* fractionalTranslation )
- {
- FT_ZERO( glyphpath );
-
- glyphpath->font = font;
- glyphpath->callbacks = callbacks;
-
- cf2_arrstack_init( &glyphpath->hintMoves,
- font->memory,
- &font->error,
- sizeof ( CF2_HintMoveRec ) );
-
- cf2_hintmap_init( &glyphpath->initialHintMap,
- font,
- &glyphpath->initialHintMap,
- &glyphpath->hintMoves,
- scaleY );
- cf2_hintmap_init( &glyphpath->firstHintMap,
- font,
- &glyphpath->initialHintMap,
- &glyphpath->hintMoves,
- scaleY );
- cf2_hintmap_init( &glyphpath->hintMap,
- font,
- &glyphpath->initialHintMap,
- &glyphpath->hintMoves,
- scaleY );
-
- glyphpath->scaleX = font->innerTransform.a;
- glyphpath->scaleC = font->innerTransform.c;
- glyphpath->scaleY = font->innerTransform.d;
-
- glyphpath->fractionalTranslation = *fractionalTranslation;
-
-#if 0
- glyphpath->hShift = hShift; /* for fauxing */
-#endif
-
- glyphpath->hStemHintArray = hStemHintArray;
- glyphpath->vStemHintArray = vStemHintArray;
- glyphpath->hintMask = hintMask; /* ptr to current mask */
- glyphpath->hintOriginY = hintOriginY;
- glyphpath->blues = blues;
- glyphpath->darken = font->darkened; /* TODO: should we make copies? */
- glyphpath->xOffset = font->darkenX;
- glyphpath->yOffset = font->darkenY;
- glyphpath->miterLimit = 2 * FT_MAX(
- cf2_fixedAbs( glyphpath->xOffset ),
- cf2_fixedAbs( glyphpath->yOffset ) );
-
- /* .1 character space unit */
- glyphpath->snapThreshold = cf2_floatToFixed( 0.1f );
-
- glyphpath->moveIsPending = TRUE;
- glyphpath->pathIsOpen = FALSE;
- glyphpath->pathIsClosing = FALSE;
- glyphpath->elemIsQueued = FALSE;
- }
-
-
- FT_LOCAL_DEF( void )
- cf2_glyphpath_finalize( CF2_GlyphPath glyphpath )
- {
- cf2_arrstack_finalize( &glyphpath->hintMoves );
- }
-
-
- /*
- * Hint point in y-direction and apply outerTransform.
- * Input `current' hint map (which is actually delayed by one element).
- * Input x,y point in Character Space.
- * Output x,y point in Device Space, including translation.
- */
- static void
- cf2_glyphpath_hintPoint( CF2_GlyphPath glyphpath,
- CF2_HintMap hintmap,
- FT_Vector* ppt,
- CF2_Fixed x,
- CF2_Fixed y )
- {
- FT_Vector pt; /* hinted point in upright DS */
-
-
- pt.x = FT_MulFix( glyphpath->scaleX, x ) +
- FT_MulFix( glyphpath->scaleC, y );
- pt.y = cf2_hintmap_map( hintmap, y );
-
- ppt->x = FT_MulFix( glyphpath->font->outerTransform.a, pt.x ) +
- FT_MulFix( glyphpath->font->outerTransform.c, pt.y ) +
- glyphpath->fractionalTranslation.x;
- ppt->y = FT_MulFix( glyphpath->font->outerTransform.b, pt.x ) +
- FT_MulFix( glyphpath->font->outerTransform.d, pt.y ) +
- glyphpath->fractionalTranslation.y;
- }
-
-
- /*
- * From two line segments, (u1,u2) and (v1,v2), compute a point of
- * intersection on the corresponding lines.
- * Return false if no intersection is found, or if the intersection is
- * too far away from the ends of the line segments, u2 and v1.
- *
- */
- static FT_Bool
- cf2_glyphpath_computeIntersection( CF2_GlyphPath glyphpath,
- const FT_Vector* u1,
- const FT_Vector* u2,
- const FT_Vector* v1,
- const FT_Vector* v2,
- FT_Vector* intersection )
- {
- /*
- * Let `u' be a zero-based vector from the first segment, `v' from the
- * second segment.
- * Let `w 'be the zero-based vector from `u1' to `v1'.
- * `perp' is the `perpendicular dot product'; see
- * http://mathworld.wolfram.com/PerpDotProduct.html.
- * `s' is the parameter for the parametric line for the first segment
- * (`u').
- *
- * See notation in
- * http://softsurfer.com/Archive/algorithm_0104/algorithm_0104B.htm.
- * Calculations are done in 16.16, but must handle the squaring of
- * line lengths in character space. We scale all vectors by 1/32 to
- * avoid overflow. This allows values up to 4095 to be squared. The
- * scale factor cancels in the divide.
- *
- * TODO: the scale factor could be computed from UnitsPerEm.
- *
- */
-
-#define cf2_perp( a, b ) \
- ( FT_MulFix( a.x, b.y ) - FT_MulFix( a.y, b.x ) )
-
- /* round and divide by 32 */
-#define CF2_CS_SCALE( x ) \
- ( ( (x) + 0x10 ) >> 5 )
-
- FT_Vector u, v, w; /* scaled vectors */
- CF2_Fixed denominator, s;
-
-
- u.x = CF2_CS_SCALE( u2->x - u1->x );
- u.y = CF2_CS_SCALE( u2->y - u1->y );
- v.x = CF2_CS_SCALE( v2->x - v1->x );
- v.y = CF2_CS_SCALE( v2->y - v1->y );
- w.x = CF2_CS_SCALE( v1->x - u1->x );
- w.y = CF2_CS_SCALE( v1->y - u1->y );
-
- denominator = cf2_perp( u, v );
-
- if ( denominator == 0 )
- return FALSE; /* parallel or coincident lines */
-
- s = FT_DivFix( cf2_perp( w, v ), denominator );
-
- intersection->x = u1->x + FT_MulFix( s, u2->x - u1->x );
- intersection->y = u1->y + FT_MulFix( s, u2->y - u1->y );
-
- /*
- * Special case snapping for horizontal and vertical lines.
- * This cleans up intersections and reduces problems with winding
- * order detection.
- * Sample case is sbc cd KozGoPr6N-Medium.otf 20 16685.
- * Note: these calculations are in character space.
- *
- */
-
- if ( u1->x == u2->x &&
- cf2_fixedAbs( intersection->x - u1->x ) < glyphpath->snapThreshold )
- intersection->x = u1->x;
- if ( u1->y == u2->y &&
- cf2_fixedAbs( intersection->y - u1->y ) < glyphpath->snapThreshold )
- intersection->y = u1->y;
-
- if ( v1->x == v2->x &&
- cf2_fixedAbs( intersection->x - v1->x ) < glyphpath->snapThreshold )
- intersection->x = v1->x;
- if ( v1->y == v2->y &&
- cf2_fixedAbs( intersection->y - v1->y ) < glyphpath->snapThreshold )
- intersection->y = v1->y;
-
- /* limit the intersection distance from midpoint of u2 and v1 */
- if ( cf2_fixedAbs( intersection->x - ( u2->x + v1->x ) / 2 ) >
- glyphpath->miterLimit ||
- cf2_fixedAbs( intersection->y - ( u2->y + v1->y ) / 2 ) >
- glyphpath->miterLimit )
- return FALSE;
-
- return TRUE;
- }
-
-
- /*
- * Push the cached element (glyphpath->prevElem*) to the outline
- * consumer. When a darkening offset is used, the end point of the
- * cached element may be adjusted to an intersection point or we may
- * synthesize a connecting line to the current element. If we are
- * closing a subpath, we may also generate a connecting line to the start
- * point.
- *
- * This is where Character Space (CS) is converted to Device Space (DS)
- * using a hint map. This calculation must use a HintMap that was valid
- * at the time the element was saved. For the first point in a subpath,
- * that is a saved HintMap. For most elements, it just means the caller
- * has delayed building a HintMap from the current HintMask.
- *
- * Transform each point with outerTransform and call the outline
- * callbacks. This is a general 3x3 transform:
- *
- * x' = a*x + c*y + tx, y' = b*x + d*y + ty
- *
- * but it uses 4 elements from CF2_Font and the translation part
- * from CF2_GlyphPath.
- *
- */
- static void
- cf2_glyphpath_pushPrevElem( CF2_GlyphPath glyphpath,
- CF2_HintMap hintmap,
- FT_Vector* nextP0,
- FT_Vector nextP1,
- FT_Bool close )
- {
- CF2_CallbackParamsRec params;
-
- FT_Vector* prevP0;
- FT_Vector* prevP1;
-
- FT_Vector intersection = { 0, 0 };
- FT_Bool useIntersection = FALSE;
-
-
- FT_ASSERT( glyphpath->prevElemOp == CF2_PathOpLineTo ||
- glyphpath->prevElemOp == CF2_PathOpCubeTo );
-
- if ( glyphpath->prevElemOp == CF2_PathOpLineTo )
- {
- prevP0 = &glyphpath->prevElemP0;
- prevP1 = &glyphpath->prevElemP1;
- }
- else
- {
- prevP0 = &glyphpath->prevElemP2;
- prevP1 = &glyphpath->prevElemP3;
- }
-
- /* optimization: if previous and next elements are offset by the same */
- /* amount, then there will be no gap, and no need to compute an */
- /* intersection. */
- if ( prevP1->x != nextP0->x || prevP1->y != nextP0->y )
- {
- /* previous element does not join next element: */
- /* adjust end point of previous element to the intersection */
- useIntersection = cf2_glyphpath_computeIntersection( glyphpath,
- prevP0,
- prevP1,
- nextP0,
- &nextP1,
- &intersection );
- if ( useIntersection )
- {
- /* modify the last point of the cached element (either line or */
- /* curve) */
- *prevP1 = intersection;
- }
- }
-
- params.pt0 = glyphpath->currentDS;
-
- switch( glyphpath->prevElemOp )
- {
- case CF2_PathOpLineTo:
- params.op = CF2_PathOpLineTo;
-
- /* note: pt2 and pt3 are unused */
-
- if ( close )
- {
- /* use first hint map if closing */
- cf2_glyphpath_hintPoint( glyphpath,
- &glyphpath->firstHintMap,
- &params.pt1,
- glyphpath->prevElemP1.x,
- glyphpath->prevElemP1.y );
- }
- else
- {
- cf2_glyphpath_hintPoint( glyphpath,
- hintmap,
- &params.pt1,
- glyphpath->prevElemP1.x,
- glyphpath->prevElemP1.y );
- }
-
- /* output only non-zero length lines */
- if ( params.pt0.x != params.pt1.x || params.pt0.y != params.pt1.y )
- {
- glyphpath->callbacks->lineTo( glyphpath->callbacks, &params );
-
- glyphpath->currentDS = params.pt1;
- }
- break;
-
- case CF2_PathOpCubeTo:
- params.op = CF2_PathOpCubeTo;
-
- /* TODO: should we intersect the interior joins (p1-p2 and p2-p3)? */
- cf2_glyphpath_hintPoint( glyphpath,
- hintmap,
- &params.pt1,
- glyphpath->prevElemP1.x,
- glyphpath->prevElemP1.y );
- cf2_glyphpath_hintPoint( glyphpath,
- hintmap,
- &params.pt2,
- glyphpath->prevElemP2.x,
- glyphpath->prevElemP2.y );
- cf2_glyphpath_hintPoint( glyphpath,
- hintmap,
- &params.pt3,
- glyphpath->prevElemP3.x,
- glyphpath->prevElemP3.y );
-
- glyphpath->callbacks->cubeTo( glyphpath->callbacks, &params );
-
- glyphpath->currentDS = params.pt3;
-
- break;
- }
-
- if ( !useIntersection || close )
- {
- /* insert connecting line between end of previous element and start */
- /* of current one */
- /* note: at the end of a subpath, we might do both, so use `nextP0' */
- /* before we change it, below */
-
- if ( close )
- {
- /* if we are closing the subpath, then nextP0 is in the first */
- /* hint zone */
- cf2_glyphpath_hintPoint( glyphpath,
- &glyphpath->firstHintMap,
- &params.pt1,
- nextP0->x,
- nextP0->y );
- }
- else
- {
- cf2_glyphpath_hintPoint( glyphpath,
- hintmap,
- &params.pt1,
- nextP0->x,
- nextP0->y );
- }
-
- if ( params.pt1.x != glyphpath->currentDS.x ||
- params.pt1.y != glyphpath->currentDS.y )
- {
- /* length is nonzero */
- params.op = CF2_PathOpLineTo;
- params.pt0 = glyphpath->currentDS;
-
- /* note: pt2 and pt3 are unused */
- glyphpath->callbacks->lineTo( glyphpath->callbacks, &params );
-
- glyphpath->currentDS = params.pt1;
- }
- }
-
- if ( useIntersection )
- {
- /* return intersection point to caller */
- *nextP0 = intersection;
- }
- }
-
-
- /* push a MoveTo element based on current point and offset of current */
- /* element */
- static void
- cf2_glyphpath_pushMove( CF2_GlyphPath glyphpath,
- FT_Vector start )
- {
- CF2_CallbackParamsRec params;
-
-
- params.op = CF2_PathOpMoveTo;
- params.pt0 = glyphpath->currentDS;
-
- /* Test if move has really happened yet; it would have called */
- /* `cf2_hintmap_build' to set `isValid'. */
- if ( !cf2_hintmap_isValid( &glyphpath->hintMap ) )
- {
- /* we are here iff first subpath is missing a moveto operator: */
- /* synthesize first moveTo to finish initialization of hintMap */
- cf2_glyphpath_moveTo( glyphpath,
- glyphpath->start.x,
- glyphpath->start.y );
- }
-
- cf2_glyphpath_hintPoint( glyphpath,
- &glyphpath->hintMap,
- &params.pt1,
- start.x,
- start.y );
-
- /* note: pt2 and pt3 are unused */
- glyphpath->callbacks->moveTo( glyphpath->callbacks, &params );
-
- glyphpath->currentDS = params.pt1;
- glyphpath->offsetStart0 = start;
- }
-
-
- /*
- * All coordinates are in character space.
- * On input, (x1, y1) and (x2, y2) give line segment.
- * On output, (x, y) give offset vector.
- * We use a piecewise approximation to trig functions.
- *
- * TODO: Offset true perpendicular and proper length
- * supply the y-translation for hinting here, too,
- * that adds yOffset unconditionally to *y.
- */
- static void
- cf2_glyphpath_computeOffset( CF2_GlyphPath glyphpath,
- CF2_Fixed x1,
- CF2_Fixed y1,
- CF2_Fixed x2,
- CF2_Fixed y2,
- CF2_Fixed* x,
- CF2_Fixed* y )
- {
- CF2_Fixed dx = x2 - x1;
- CF2_Fixed dy = y2 - y1;
-
-
- /* note: negative offsets don't work here; negate deltas to change */
- /* quadrants, below */
- if ( glyphpath->font->reverseWinding )
- {
- dx = -dx;
- dy = -dy;
- }
-
- *x = *y = 0;
-
- if ( !glyphpath->darken )
- return;
-
- /* add momentum for this path element */
- glyphpath->callbacks->windingMomentum +=
- cf2_getWindingMomentum( x1, y1, x2, y2 );
-
- /* note: allow mixed integer and fixed multiplication here */
- if ( dx >= 0 )
- {
- if ( dy >= 0 )
- {
- /* first quadrant, +x +y */
-
- if ( dx > 2 * dy )
- {
- /* +x */
- *x = 0;
- *y = 0;
- }
- else if ( dy > 2 * dx )
- {
- /* +y */
- *x = glyphpath->xOffset;
- *y = glyphpath->yOffset;
- }
- else
- {
- /* +x +y */
- *x = FT_MulFix( cf2_floatToFixed( 0.7 ),
- glyphpath->xOffset );
- *y = FT_MulFix( cf2_floatToFixed( 1.0 - 0.7 ),
- glyphpath->yOffset );
- }
- }
- else
- {
- /* fourth quadrant, +x -y */
-
- if ( dx > -2 * dy )
- {
- /* +x */
- *x = 0;
- *y = 0;
- }
- else if ( -dy > 2 * dx )
- {
- /* -y */
- *x = -glyphpath->xOffset;
- *y = glyphpath->yOffset;
- }
- else
- {
- /* +x -y */
- *x = FT_MulFix( cf2_floatToFixed( -0.7 ),
- glyphpath->xOffset );
- *y = FT_MulFix( cf2_floatToFixed( 1.0 - 0.7 ),
- glyphpath->yOffset );
- }
- }
- }
- else
- {
- if ( dy >= 0 )
- {
- /* second quadrant, -x +y */
-
- if ( -dx > 2 * dy )
- {
- /* -x */
- *x = 0;
- *y = 2 * glyphpath->yOffset;
- }
- else if ( dy > -2 * dx )
- {
- /* +y */
- *x = glyphpath->xOffset;
- *y = glyphpath->yOffset;
- }
- else
- {
- /* -x +y */
- *x = FT_MulFix( cf2_floatToFixed( 0.7 ),
- glyphpath->xOffset );
- *y = FT_MulFix( cf2_floatToFixed( 1.0 + 0.7 ),
- glyphpath->yOffset );
- }
- }
- else
- {
- /* third quadrant, -x -y */
-
- if ( -dx > -2 * dy )
- {
- /* -x */
- *x = 0;
- *y = 2 * glyphpath->yOffset;
- }
- else if ( -dy > -2 * dx )
- {
- /* -y */
- *x = -glyphpath->xOffset;
- *y = glyphpath->yOffset;
- }
- else
- {
- /* -x -y */
- *x = FT_MulFix( cf2_floatToFixed( -0.7 ),
- glyphpath->xOffset );
- *y = FT_MulFix( cf2_floatToFixed( 1.0 + 0.7 ),
- glyphpath->yOffset );
- }
- }
- }
- }
-
-
- /*
- * The functions cf2_glyphpath_{moveTo,lineTo,curveTo,closeOpenPath} are
- * called by the interpreter with Character Space (CS) coordinates. Each
- * path element is placed into a queue of length one to await the
- * calculation of the following element. At that time, the darkening
- * offset of the following element is known and joins can be computed,
- * including possible modification of this element, before mapping to
- * Device Space (DS) and passing it on to the outline consumer.
- *
- */
- FT_LOCAL_DEF( void )
- cf2_glyphpath_moveTo( CF2_GlyphPath glyphpath,
- CF2_Fixed x,
- CF2_Fixed y )
- {
- cf2_glyphpath_closeOpenPath( glyphpath );
-
- /* save the parameters of the move for later, when we'll know how to */
- /* offset it; */
- /* also save last move point */
- glyphpath->currentCS.x = glyphpath->start.x = x;
- glyphpath->currentCS.y = glyphpath->start.y = y;
-
- glyphpath->moveIsPending = TRUE;
-
- /* ensure we have a valid map with current mask */
- if ( !cf2_hintmap_isValid( &glyphpath->hintMap ) ||
- cf2_hintmask_isNew( glyphpath->hintMask ) )
- cf2_hintmap_build( &glyphpath->hintMap,
- glyphpath->hStemHintArray,
- glyphpath->vStemHintArray,
- glyphpath->hintMask,
- glyphpath->hintOriginY,
- FALSE );
-
- /* save a copy of current HintMap to use when drawing initial point */
- glyphpath->firstHintMap = glyphpath->hintMap; /* structure copy */
- }
-
-
- FT_LOCAL_DEF( void )
- cf2_glyphpath_lineTo( CF2_GlyphPath glyphpath,
- CF2_Fixed x,
- CF2_Fixed y )
- {
- CF2_Fixed xOffset, yOffset;
- FT_Vector P0, P1;
- FT_Bool newHintMap;
-
- /*
- * New hints will be applied after cf2_glyphpath_pushPrevElem has run.
- * In case this is a synthesized closing line, any new hints should be
- * delayed until this path is closed (`cf2_hintmask_isNew' will be
- * called again before the next line or curve).
- */
-
- /* true if new hint map not on close */
- newHintMap = cf2_hintmask_isNew( glyphpath->hintMask ) &&
- !glyphpath->pathIsClosing;
-
- /*
- * Zero-length lines may occur in the charstring. Because we cannot
- * compute darkening offsets or intersections from zero-length lines,
- * it is best to remove them and avoid artifacts. However, zero-length
- * lines in CS at the start of a new hint map can generate non-zero
- * lines in DS due to hint substitution. We detect a change in hint
- * map here and pass those zero-length lines along.
- */
-
- /*
- * Note: Find explicitly closed paths here with a conditional
- * breakpoint using
- *
- * !gp->pathIsClosing && gp->start.x == x && gp->start.y == y
- *
- */
-
- if ( glyphpath->currentCS.x == x &&
- glyphpath->currentCS.y == y &&
- !newHintMap )
- /*
- * Ignore zero-length lines in CS where the hint map is the same
- * because the line in DS will also be zero length.
- *
- * Ignore zero-length lines when we synthesize a closing line because
- * the close will be handled in cf2_glyphPath_pushPrevElem.
- */
- return;
-
- cf2_glyphpath_computeOffset( glyphpath,
- glyphpath->currentCS.x,
- glyphpath->currentCS.y,
- x,
- y,
- &xOffset,
- &yOffset );
-
- /* construct offset points */
- P0.x = glyphpath->currentCS.x + xOffset;
- P0.y = glyphpath->currentCS.y + yOffset;
- P1.x = x + xOffset;
- P1.y = y + yOffset;
-
- if ( glyphpath->moveIsPending )
- {
- /* emit offset 1st point as MoveTo */
- cf2_glyphpath_pushMove( glyphpath, P0 );
-
- glyphpath->moveIsPending = FALSE; /* adjust state machine */
- glyphpath->pathIsOpen = TRUE;
-
- glyphpath->offsetStart1 = P1; /* record second point */
- }
-
- if ( glyphpath->elemIsQueued )
- {
- FT_ASSERT( cf2_hintmap_isValid( &glyphpath->hintMap ) ||
- glyphpath->hintMap.count == 0 );
-
- cf2_glyphpath_pushPrevElem( glyphpath,
- &glyphpath->hintMap,
- &P0,
- P1,
- FALSE );
- }
-
- /* queue the current element with offset points */
- glyphpath->elemIsQueued = TRUE;
- glyphpath->prevElemOp = CF2_PathOpLineTo;
- glyphpath->prevElemP0 = P0;
- glyphpath->prevElemP1 = P1;
-
- /* update current map */
- if ( newHintMap )
- cf2_hintmap_build( &glyphpath->hintMap,
- glyphpath->hStemHintArray,
- glyphpath->vStemHintArray,
- glyphpath->hintMask,
- glyphpath->hintOriginY,
- FALSE );
-
- glyphpath->currentCS.x = x; /* pre-offset current point */
- glyphpath->currentCS.y = y;
- }
-
-
- FT_LOCAL_DEF( void )
- cf2_glyphpath_curveTo( CF2_GlyphPath glyphpath,
- CF2_Fixed x1,
- CF2_Fixed y1,
- CF2_Fixed x2,
- CF2_Fixed y2,
- CF2_Fixed x3,
- CF2_Fixed y3 )
- {
- CF2_Fixed xOffset1, yOffset1, xOffset3, yOffset3;
- FT_Vector P0, P1, P2, P3;
-
-
- /* TODO: ignore zero length portions of curve?? */
- cf2_glyphpath_computeOffset( glyphpath,
- glyphpath->currentCS.x,
- glyphpath->currentCS.y,
- x1,
- y1,
- &xOffset1,
- &yOffset1 );
- cf2_glyphpath_computeOffset( glyphpath,
- x2,
- y2,
- x3,
- y3,
- &xOffset3,
- &yOffset3 );
-
- /* add momentum from the middle segment */
- glyphpath->callbacks->windingMomentum +=
- cf2_getWindingMomentum( x1, y1, x2, y2 );
-
- /* construct offset points */
- P0.x = glyphpath->currentCS.x + xOffset1;
- P0.y = glyphpath->currentCS.y + yOffset1;
- P1.x = x1 + xOffset1;
- P1.y = y1 + yOffset1;
- /* note: preserve angle of final segment by using offset3 at both ends */
- P2.x = x2 + xOffset3;
- P2.y = y2 + yOffset3;
- P3.x = x3 + xOffset3;
- P3.y = y3 + yOffset3;
-
- if ( glyphpath->moveIsPending )
- {
- /* emit offset 1st point as MoveTo */
- cf2_glyphpath_pushMove( glyphpath, P0 );
-
- glyphpath->moveIsPending = FALSE;
- glyphpath->pathIsOpen = TRUE;
-
- glyphpath->offsetStart1 = P1; /* record second point */
- }
-
- if ( glyphpath->elemIsQueued )
- {
- FT_ASSERT( cf2_hintmap_isValid( &glyphpath->hintMap ) ||
- glyphpath->hintMap.count == 0 );
-
- cf2_glyphpath_pushPrevElem( glyphpath,
- &glyphpath->hintMap,
- &P0,
- P1,
- FALSE );
- }
-
- /* queue the current element with offset points */
- glyphpath->elemIsQueued = TRUE;
- glyphpath->prevElemOp = CF2_PathOpCubeTo;
- glyphpath->prevElemP0 = P0;
- glyphpath->prevElemP1 = P1;
- glyphpath->prevElemP2 = P2;
- glyphpath->prevElemP3 = P3;
-
- /* update current map */
- if ( cf2_hintmask_isNew( glyphpath->hintMask ) )
- cf2_hintmap_build( &glyphpath->hintMap,
- glyphpath->hStemHintArray,
- glyphpath->vStemHintArray,
- glyphpath->hintMask,
- glyphpath->hintOriginY,
- FALSE );
-
- glyphpath->currentCS.x = x3; /* pre-offset current point */
- glyphpath->currentCS.y = y3;
- }
-
-
- FT_LOCAL_DEF( void )
- cf2_glyphpath_closeOpenPath( CF2_GlyphPath glyphpath )
- {
- if ( glyphpath->pathIsOpen )
- {
- /*
- * A closing line in Character Space line is always generated below
- * with `cf2_glyphPath_lineTo'. It may be ignored later if it turns
- * out to be zero length in Device Space.
- */
- glyphpath->pathIsClosing = TRUE;
-
- cf2_glyphpath_lineTo( glyphpath,
- glyphpath->start.x,
- glyphpath->start.y );
-
- /* empty the final element from the queue and close the path */
- if ( glyphpath->elemIsQueued )
- cf2_glyphpath_pushPrevElem( glyphpath,
- &glyphpath->hintMap,
- &glyphpath->offsetStart0,
- glyphpath->offsetStart1,
- TRUE );
-
- /* reset state machine */
- glyphpath->moveIsPending = TRUE;
- glyphpath->pathIsOpen = FALSE;
- glyphpath->pathIsClosing = FALSE;
- glyphpath->elemIsQueued = FALSE;
- }
- }
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/cff/cf2hints.h b/chromium/third_party/pdfium/third_party/freetype/src/cff/cf2hints.h
deleted file mode 100644
index f25d91bf89f..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/cff/cf2hints.h
+++ /dev/null
@@ -1,289 +0,0 @@
-/***************************************************************************/
-/* */
-/* cf2hints.h */
-/* */
-/* Adobe's code for handling CFF hints (body). */
-/* */
-/* Copyright 2007-2013 Adobe Systems Incorporated. */
-/* */
-/* This software, and all works of authorship, whether in source or */
-/* object code form as indicated by the copyright notice(s) included */
-/* herein (collectively, the "Work") is made available, and may only be */
-/* used, modified, and distributed under the FreeType Project License, */
-/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */
-/* FreeType Project License, each contributor to the Work hereby grants */
-/* to any individual or legal entity exercising permissions granted by */
-/* the FreeType Project License and this section (hereafter, "You" or */
-/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */
-/* royalty-free, irrevocable (except as stated in this section) patent */
-/* license to make, have made, use, offer to sell, sell, import, and */
-/* otherwise transfer the Work, where such license applies only to those */
-/* patent claims licensable by such contributor that are necessarily */
-/* infringed by their contribution(s) alone or by combination of their */
-/* contribution(s) with the Work to which such contribution(s) was */
-/* submitted. If You institute patent litigation against any entity */
-/* (including a cross-claim or counterclaim in a lawsuit) alleging that */
-/* the Work or a contribution incorporated within the Work constitutes */
-/* direct or contributory patent infringement, then any patent licenses */
-/* granted to You under this License for that Work shall terminate as of */
-/* the date such litigation is filed. */
-/* */
-/* By using, modifying, or distributing the Work you indicate that you */
-/* have read and understood the terms and conditions of the */
-/* FreeType Project License as well as those provided in this section, */
-/* and you accept them fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __CF2HINTS_H__
-#define __CF2HINTS_H__
-
-
-FT_BEGIN_HEADER
-
-
- enum
- {
- CF2_MAX_HINTS = 96 /* maximum # of hints */
- };
-
-
- /*
- * A HintMask object stores a bit mask that specifies which hints in the
- * charstring are active at a given time. Hints in CFF must be declared
- * at the start, before any drawing operators, with horizontal hints
- * preceding vertical hints. The HintMask is ordered the same way, with
- * horizontal hints immediately followed by vertical hints. Clients are
- * responsible for knowing how many of each type are present.
- *
- * The maximum total number of hints is 96, as specified by the CFF
- * specification.
- *
- * A HintMask is built 0 or more times while interpreting a charstring, by
- * the HintMask operator. There is only one HintMask, but it is built or
- * rebuilt each time there is a hint substitution (HintMask operator) in
- * the charstring. A default HintMask with all bits set is built if there
- * has been no HintMask operator prior to the first drawing operator.
- *
- */
-
- typedef struct CF2_HintMaskRec_
- {
- FT_Error* error;
-
- FT_Bool isValid;
- FT_Bool isNew;
-
- size_t bitCount;
- size_t byteCount;
-
- FT_Byte mask[( CF2_MAX_HINTS + 7 ) / 8];
-
- } CF2_HintMaskRec, *CF2_HintMask;
-
-
- typedef struct CF2_StemHintRec_
- {
- FT_Bool used; /* DS positions are valid */
-
- CF2_Fixed min; /* original character space value */
- CF2_Fixed max;
-
- CF2_Fixed minDS; /* DS position after first use */
- CF2_Fixed maxDS;
-
- } CF2_StemHintRec, *CF2_StemHint;
-
-
- /*
- * A HintMap object stores a piecewise linear function for mapping
- * y-coordinates from character space to device space, providing
- * appropriate pixel alignment to stem edges.
- *
- * The map is implemented as an array of `CF2_Hint' elements, each
- * representing an edge. When edges are paired, as from stem hints, the
- * bottom edge must immediately precede the top edge in the array.
- * Element character space AND device space positions must both increase
- * monotonically in the array. `CF2_Hint' elements are also used as
- * parameters to `cf2_blues_capture'.
- *
- * The `cf2_hintmap_build' method must be called before any drawing
- * operation (beginning with a Move operator) and at each hint
- * substitution (HintMask operator).
- *
- * The `cf2_hintmap_map' method is called to transform y-coordinates at
- * each drawing operation (move, line, curve).
- *
- */
-
- /* TODO: make this a CF2_ArrStack and add a deep copy method */
- enum
- {
- CF2_MAX_HINT_EDGES = CF2_MAX_HINTS * 2
- };
-
-
- typedef struct CF2_HintMapRec_
- {
- CF2_Font font;
-
- /* initial map based on blue zones */
- struct CF2_HintMapRec_* initialHintMap;
-
- /* working storage for 2nd pass adjustHints */
- CF2_ArrStack hintMoves;
-
- FT_Bool isValid;
- FT_Bool hinted;
-
- CF2_Fixed scale;
- CF2_UInt count;
-
- /* start search from this index */
- CF2_UInt lastIndex;
-
- CF2_HintRec edge[CF2_MAX_HINT_EDGES]; /* 192 */
-
- } CF2_HintMapRec, *CF2_HintMap;
-
-
- FT_LOCAL( FT_Bool )
- cf2_hint_isValid( const CF2_Hint hint );
- FT_LOCAL( FT_Bool )
- cf2_hint_isTop( const CF2_Hint hint );
- FT_LOCAL( FT_Bool )
- cf2_hint_isBottom( const CF2_Hint hint );
- FT_LOCAL( void )
- cf2_hint_lock( CF2_Hint hint );
-
-
- FT_LOCAL( void )
- cf2_hintmap_init( CF2_HintMap hintmap,
- CF2_Font font,
- CF2_HintMap initialMap,
- CF2_ArrStack hintMoves,
- CF2_Fixed scale );
- FT_LOCAL( void )
- cf2_hintmap_build( CF2_HintMap hintmap,
- CF2_ArrStack hStemHintArray,
- CF2_ArrStack vStemHintArray,
- CF2_HintMask hintMask,
- CF2_Fixed hintOrigin,
- FT_Bool initialMap );
-
-
- /*
- * GlyphPath is a wrapper for drawing operations that scales the
- * coordinates according to the render matrix and HintMap. It also tracks
- * open paths to control ClosePath and to insert MoveTo for broken fonts.
- *
- */
- typedef struct CF2_GlyphPathRec_
- {
- /* TODO: gather some of these into a hinting context */
-
- CF2_Font font; /* font instance */
- CF2_OutlineCallbacks callbacks; /* outline consumer */
-
-
- CF2_HintMapRec hintMap; /* current hint map */
- CF2_HintMapRec firstHintMap; /* saved copy */
- CF2_HintMapRec initialHintMap; /* based on all captured hints */
-
- CF2_ArrStackRec hintMoves; /* list of hint moves for 2nd pass */
-
- CF2_Fixed scaleX; /* matrix a */
- CF2_Fixed scaleC; /* matrix c */
- CF2_Fixed scaleY; /* matrix d */
-
- FT_Vector fractionalTranslation; /* including deviceXScale */
-#if 0
- CF2_Fixed hShift; /* character space horizontal shift */
- /* (for fauxing) */
-#endif
-
- FT_Bool pathIsOpen; /* true after MoveTo */
- FT_Bool pathIsClosing; /* true when synthesizing closepath line */
- FT_Bool darken; /* true if stem darkening */
- FT_Bool moveIsPending; /* true between MoveTo and offset MoveTo */
-
- /* references used to call `cf2_hintmap_build', if necessary */
- CF2_ArrStack hStemHintArray;
- CF2_ArrStack vStemHintArray;
- CF2_HintMask hintMask; /* ptr to the current mask */
- CF2_Fixed hintOriginY; /* copy of current origin */
- const CF2_BluesRec* blues;
-
- CF2_Fixed xOffset; /* character space offsets */
- CF2_Fixed yOffset;
-
- /* character space miter limit threshold */
- CF2_Fixed miterLimit;
- /* vertical/horzizontal snap distance in character space */
- CF2_Fixed snapThreshold;
-
- FT_Vector offsetStart0; /* first and second points of first */
- FT_Vector offsetStart1; /* element with offset applied */
-
- /* current point, character space, before offset */
- FT_Vector currentCS;
- /* current point, device space */
- FT_Vector currentDS;
- /* start point of subpath, character space */
- FT_Vector start;
-
- /* the following members constitute the `queue' of one element */
- FT_Bool elemIsQueued;
- CF2_Int prevElemOp;
-
- FT_Vector prevElemP0;
- FT_Vector prevElemP1;
- FT_Vector prevElemP2;
- FT_Vector prevElemP3;
-
- } CF2_GlyphPathRec, *CF2_GlyphPath;
-
-
- FT_LOCAL( void )
- cf2_glyphpath_init( CF2_GlyphPath glyphpath,
- CF2_Font font,
- CF2_OutlineCallbacks callbacks,
- CF2_Fixed scaleY,
- /* CF2_Fixed hShift, */
- CF2_ArrStack hStemHintArray,
- CF2_ArrStack vStemHintArray,
- CF2_HintMask hintMask,
- CF2_Fixed hintOrigin,
- const CF2_Blues blues,
- const FT_Vector* fractionalTranslation );
- FT_LOCAL( void )
- cf2_glyphpath_finalize( CF2_GlyphPath glyphpath );
-
- FT_LOCAL( void )
- cf2_glyphpath_moveTo( CF2_GlyphPath glyphpath,
- CF2_Fixed x,
- CF2_Fixed y );
- FT_LOCAL( void )
- cf2_glyphpath_lineTo( CF2_GlyphPath glyphpath,
- CF2_Fixed x,
- CF2_Fixed y );
- FT_LOCAL( void )
- cf2_glyphpath_curveTo( CF2_GlyphPath glyphpath,
- CF2_Fixed x1,
- CF2_Fixed y1,
- CF2_Fixed x2,
- CF2_Fixed y2,
- CF2_Fixed x3,
- CF2_Fixed y3 );
- FT_LOCAL( void )
- cf2_glyphpath_closeOpenPath( CF2_GlyphPath glyphpath );
-
-
-FT_END_HEADER
-
-
-#endif /* __CF2HINTS_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/cff/cf2intrp.c b/chromium/third_party/pdfium/third_party/freetype/src/cff/cf2intrp.c
deleted file mode 100644
index ff3fa9aaaab..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/cff/cf2intrp.c
+++ /dev/null
@@ -1,1571 +0,0 @@
-/***************************************************************************/
-/* */
-/* cf2intrp.c */
-/* */
-/* Adobe's CFF Interpreter (body). */
-/* */
-/* Copyright 2007-2014 Adobe Systems Incorporated. */
-/* */
-/* This software, and all works of authorship, whether in source or */
-/* object code form as indicated by the copyright notice(s) included */
-/* herein (collectively, the "Work") is made available, and may only be */
-/* used, modified, and distributed under the FreeType Project License, */
-/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */
-/* FreeType Project License, each contributor to the Work hereby grants */
-/* to any individual or legal entity exercising permissions granted by */
-/* the FreeType Project License and this section (hereafter, "You" or */
-/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */
-/* royalty-free, irrevocable (except as stated in this section) patent */
-/* license to make, have made, use, offer to sell, sell, import, and */
-/* otherwise transfer the Work, where such license applies only to those */
-/* patent claims licensable by such contributor that are necessarily */
-/* infringed by their contribution(s) alone or by combination of their */
-/* contribution(s) with the Work to which such contribution(s) was */
-/* submitted. If You institute patent litigation against any entity */
-/* (including a cross-claim or counterclaim in a lawsuit) alleging that */
-/* the Work or a contribution incorporated within the Work constitutes */
-/* direct or contributory patent infringement, then any patent licenses */
-/* granted to You under this License for that Work shall terminate as of */
-/* the date such litigation is filed. */
-/* */
-/* By using, modifying, or distributing the Work you indicate that you */
-/* have read and understood the terms and conditions of the */
-/* FreeType Project License as well as those provided in this section, */
-/* and you accept them fully. */
-/* */
-/***************************************************************************/
-
-
-#include "cf2ft.h"
-#include FT_INTERNAL_DEBUG_H
-
-#include "cf2glue.h"
-#include "cf2font.h"
-#include "cf2stack.h"
-#include "cf2hints.h"
-#include "cf2intrp.h"
-
-#include "cf2error.h"
-
-
- /*************************************************************************/
- /* */
- /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
- /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
- /* messages during execution. */
- /* */
-#undef FT_COMPONENT
-#define FT_COMPONENT trace_cf2interp
-
-
- /* some operators are not implemented yet */
-#define CF2_FIXME FT_TRACE4(( "cf2_interpT2CharString:" \
- " operator not implemented yet\n" ))
-
-
-
- FT_LOCAL_DEF( void )
- cf2_hintmask_init( CF2_HintMask hintmask,
- FT_Error* error )
- {
- FT_ZERO( hintmask );
-
- hintmask->error = error;
- }
-
-
- FT_LOCAL_DEF( FT_Bool )
- cf2_hintmask_isValid( const CF2_HintMask hintmask )
- {
- return hintmask->isValid;
- }
-
-
- FT_LOCAL_DEF( FT_Bool )
- cf2_hintmask_isNew( const CF2_HintMask hintmask )
- {
- return hintmask->isNew;
- }
-
-
- FT_LOCAL_DEF( void )
- cf2_hintmask_setNew( CF2_HintMask hintmask,
- FT_Bool val )
- {
- hintmask->isNew = val;
- }
-
-
- /* clients call `getMaskPtr' in order to iterate */
- /* through hint mask */
-
- FT_LOCAL_DEF( FT_Byte* )
- cf2_hintmask_getMaskPtr( CF2_HintMask hintmask )
- {
- return hintmask->mask;
- }
-
-
- static size_t
- cf2_hintmask_setCounts( CF2_HintMask hintmask,
- size_t bitCount )
- {
- if ( bitCount > CF2_MAX_HINTS )
- {
- /* total of h and v stems must be <= 96 */
- CF2_SET_ERROR( hintmask->error, Invalid_Glyph_Format );
- return 0;
- }
-
- hintmask->bitCount = bitCount;
- hintmask->byteCount = ( hintmask->bitCount + 7 ) / 8;
-
- hintmask->isValid = TRUE;
- hintmask->isNew = TRUE;
-
- return bitCount;
- }
-
-
- /* consume the hintmask bytes from the charstring, advancing the src */
- /* pointer */
- static void
- cf2_hintmask_read( CF2_HintMask hintmask,
- CF2_Buffer charstring,
- size_t bitCount )
- {
- size_t i;
-
-#ifndef CF2_NDEBUG
- /* these are the bits in the final mask byte that should be zero */
- /* Note: this variable is only used in an assert expression below */
- /* and then only if CF2_NDEBUG is not defined */
- CF2_UInt mask = ( 1 << ( -(CF2_Int)bitCount & 7 ) ) - 1;
-#endif
-
-
- /* initialize counts and isValid */
- if ( cf2_hintmask_setCounts( hintmask, bitCount ) == 0 )
- return;
-
- FT_ASSERT( hintmask->byteCount > 0 );
-
- FT_TRACE4(( " (maskbytes:" ));
-
- /* set mask and advance interpreter's charstring pointer */
- for ( i = 0; i < hintmask->byteCount; i++ )
- {
- hintmask->mask[i] = (FT_Byte)cf2_buf_readByte( charstring );
- FT_TRACE4(( " 0x%02X", hintmask->mask[i] ));
- }
-
- FT_TRACE4(( ")\n" ));
-
- /* assert any unused bits in last byte are zero unless there's a prior */
- /* error */
- /* bitCount -> mask, 0 -> 0, 1 -> 7f, 2 -> 3f, ... 6 -> 3, 7 -> 1 */
-#ifndef CF2_NDEBUG
- FT_ASSERT( ( hintmask->mask[hintmask->byteCount - 1] & mask ) == 0 ||
- *hintmask->error );
-#endif
- }
-
-
- FT_LOCAL_DEF( void )
- cf2_hintmask_setAll( CF2_HintMask hintmask,
- size_t bitCount )
- {
- size_t i;
- CF2_UInt mask = ( 1 << ( -(CF2_Int)bitCount & 7 ) ) - 1;
-
-
- /* initialize counts and isValid */
- if ( cf2_hintmask_setCounts( hintmask, bitCount ) == 0 )
- return;
-
- FT_ASSERT( hintmask->byteCount > 0 );
- FT_ASSERT( hintmask->byteCount <
- sizeof ( hintmask->mask ) / sizeof ( hintmask->mask[0] ) );
-
- /* set mask to all ones */
- for ( i = 0; i < hintmask->byteCount; i++ )
- hintmask->mask[i] = 0xFF;
-
- /* clear unused bits */
- /* bitCount -> mask, 0 -> 0, 1 -> 7f, 2 -> 3f, ... 6 -> 3, 7 -> 1 */
- hintmask->mask[hintmask->byteCount - 1] &= ~mask;
- }
-
-
- /* Type2 charstring opcodes */
- enum
- {
- cf2_cmdRESERVED_0, /* 0 */
- cf2_cmdHSTEM, /* 1 */
- cf2_cmdRESERVED_2, /* 2 */
- cf2_cmdVSTEM, /* 3 */
- cf2_cmdVMOVETO, /* 4 */
- cf2_cmdRLINETO, /* 5 */
- cf2_cmdHLINETO, /* 6 */
- cf2_cmdVLINETO, /* 7 */
- cf2_cmdRRCURVETO, /* 8 */
- cf2_cmdRESERVED_9, /* 9 */
- cf2_cmdCALLSUBR, /* 10 */
- cf2_cmdRETURN, /* 11 */
- cf2_cmdESC, /* 12 */
- cf2_cmdRESERVED_13, /* 13 */
- cf2_cmdENDCHAR, /* 14 */
- cf2_cmdRESERVED_15, /* 15 */
- cf2_cmdRESERVED_16, /* 16 */
- cf2_cmdRESERVED_17, /* 17 */
- cf2_cmdHSTEMHM, /* 18 */
- cf2_cmdHINTMASK, /* 19 */
- cf2_cmdCNTRMASK, /* 20 */
- cf2_cmdRMOVETO, /* 21 */
- cf2_cmdHMOVETO, /* 22 */
- cf2_cmdVSTEMHM, /* 23 */
- cf2_cmdRCURVELINE, /* 24 */
- cf2_cmdRLINECURVE, /* 25 */
- cf2_cmdVVCURVETO, /* 26 */
- cf2_cmdHHCURVETO, /* 27 */
- cf2_cmdEXTENDEDNMBR, /* 28 */
- cf2_cmdCALLGSUBR, /* 29 */
- cf2_cmdVHCURVETO, /* 30 */
- cf2_cmdHVCURVETO /* 31 */
- };
-
- enum
- {
- cf2_escDOTSECTION, /* 0 */
- cf2_escRESERVED_1, /* 1 */
- cf2_escRESERVED_2, /* 2 */
- cf2_escAND, /* 3 */
- cf2_escOR, /* 4 */
- cf2_escNOT, /* 5 */
- cf2_escRESERVED_6, /* 6 */
- cf2_escRESERVED_7, /* 7 */
- cf2_escRESERVED_8, /* 8 */
- cf2_escABS, /* 9 */
- cf2_escADD, /* 10 like otherADD */
- cf2_escSUB, /* 11 like otherSUB */
- cf2_escDIV, /* 12 */
- cf2_escRESERVED_13, /* 13 */
- cf2_escNEG, /* 14 */
- cf2_escEQ, /* 15 */
- cf2_escRESERVED_16, /* 16 */
- cf2_escRESERVED_17, /* 17 */
- cf2_escDROP, /* 18 */
- cf2_escRESERVED_19, /* 19 */
- cf2_escPUT, /* 20 like otherPUT */
- cf2_escGET, /* 21 like otherGET */
- cf2_escIFELSE, /* 22 like otherIFELSE */
- cf2_escRANDOM, /* 23 like otherRANDOM */
- cf2_escMUL, /* 24 like otherMUL */
- cf2_escRESERVED_25, /* 25 */
- cf2_escSQRT, /* 26 */
- cf2_escDUP, /* 27 like otherDUP */
- cf2_escEXCH, /* 28 like otherEXCH */
- cf2_escINDEX, /* 29 */
- cf2_escROLL, /* 30 */
- cf2_escRESERVED_31, /* 31 */
- cf2_escRESERVED_32, /* 32 */
- cf2_escRESERVED_33, /* 33 */
- cf2_escHFLEX, /* 34 */
- cf2_escFLEX, /* 35 */
- cf2_escHFLEX1, /* 36 */
- cf2_escFLEX1 /* 37 */
- };
-
-
- /* `stemHintArray' does not change once we start drawing the outline. */
- static void
- cf2_doStems( const CF2_Font font,
- CF2_Stack opStack,
- CF2_ArrStack stemHintArray,
- CF2_Fixed* width,
- FT_Bool* haveWidth,
- CF2_Fixed hintOffset )
- {
- CF2_UInt i;
- CF2_UInt count = cf2_stack_count( opStack );
- FT_Bool hasWidthArg = (FT_Bool)( count & 1 );
-
- /* variable accumulates delta values from operand stack */
- CF2_Fixed position = hintOffset;
-
- if ( hasWidthArg && ! *haveWidth )
- *width = cf2_stack_getReal( opStack, 0 ) +
- cf2_getNominalWidthX( font->decoder );
-
- if ( font->decoder->width_only )
- goto exit;
-
- for ( i = hasWidthArg ? 1 : 0; i < count; i += 2 )
- {
- /* construct a CF2_StemHint and push it onto the list */
- CF2_StemHintRec stemhint;
-
-
- stemhint.min =
- position += cf2_stack_getReal( opStack, i );
- stemhint.max =
- position += cf2_stack_getReal( opStack, i + 1 );
-
- stemhint.used = FALSE;
- stemhint.maxDS =
- stemhint.minDS = 0;
-
- cf2_arrstack_push( stemHintArray, &stemhint ); /* defer error check */
- }
-
- cf2_stack_clear( opStack );
-
- exit:
- /* cf2_doStems must define a width (may be default) */
- *haveWidth = TRUE;
- }
-
-
- static void
- cf2_doFlex( CF2_Stack opStack,
- CF2_Fixed* curX,
- CF2_Fixed* curY,
- CF2_GlyphPath glyphPath,
- const FT_Bool* readFromStack,
- FT_Bool doConditionalLastRead )
- {
- CF2_Fixed vals[14];
- CF2_UInt index;
- FT_Bool isHFlex;
- CF2_Int top, i, j;
-
-
- vals[0] = *curX;
- vals[1] = *curY;
- index = 0;
- isHFlex = readFromStack[9] == FALSE;
- top = isHFlex ? 9 : 10;
-
- for ( i = 0; i < top; i++ )
- {
- vals[i + 2] = vals[i];
- if ( readFromStack[i] )
- vals[i + 2] += cf2_stack_getReal( opStack, index++ );
- }
-
- if ( isHFlex )
- vals[9 + 2] = *curY;
-
- if ( doConditionalLastRead )
- {
- FT_Bool lastIsX = (FT_Bool)( cf2_fixedAbs( vals[10] - *curX ) >
- cf2_fixedAbs( vals[11] - *curY ) );
- CF2_Fixed lastVal = cf2_stack_getReal( opStack, index );
-
-
- if ( lastIsX )
- {
- vals[12] = vals[10] + lastVal;
- vals[13] = *curY;
- }
- else
- {
- vals[12] = *curX;
- vals[13] = vals[11] + lastVal;
- }
- }
- else
- {
- if ( readFromStack[10] )
- vals[12] = vals[10] + cf2_stack_getReal( opStack, index++ );
- else
- vals[12] = *curX;
-
- if ( readFromStack[11] )
- vals[13] = vals[11] + cf2_stack_getReal( opStack, index );
- else
- vals[13] = *curY;
- }
-
- for ( j = 0; j < 2; j++ )
- cf2_glyphpath_curveTo( glyphPath, vals[j * 6 + 2],
- vals[j * 6 + 3],
- vals[j * 6 + 4],
- vals[j * 6 + 5],
- vals[j * 6 + 6],
- vals[j * 6 + 7] );
-
- cf2_stack_clear( opStack );
-
- *curX = vals[12];
- *curY = vals[13];
- }
-
-
- /*
- * `error' is a shared error code used by many objects in this
- * routine. Before the code continues from an error, it must check and
- * record the error in `*error'. The idea is that this shared
- * error code will record the first error encountered. If testing
- * for an error anyway, the cost of `goto exit' is small, so we do it,
- * even if continuing would be safe. In this case, `lastError' is
- * set, so the testing and storing can be done in one place, at `exit'.
- *
- * Continuing after an error is intended for objects which do their own
- * testing of `*error', e.g., array stack functions. This allows us to
- * avoid an extra test after the call.
- *
- * Unimplemented opcodes are ignored.
- *
- */
- FT_LOCAL_DEF( void )
- cf2_interpT2CharString( CF2_Font font,
- CF2_Buffer buf,
- CF2_OutlineCallbacks callbacks,
- const FT_Vector* translation,
- FT_Bool doingSeac,
- CF2_Fixed curX,
- CF2_Fixed curY,
- CF2_Fixed* width )
- {
- /* lastError is used for errors that are immediately tested */
- FT_Error lastError = FT_Err_Ok;
-
- /* pointer to parsed font object */
- CFF_Decoder* decoder = font->decoder;
-
- FT_Error* error = &font->error;
- FT_Memory memory = font->memory;
-
- CF2_Fixed scaleY = font->innerTransform.d;
- CF2_Fixed nominalWidthX = cf2_getNominalWidthX( decoder );
-
- /* save this for hinting seac accents */
- CF2_Fixed hintOriginY = curY;
-
- CF2_Stack opStack = NULL;
- FT_Byte op1; /* first opcode byte */
-
- /* instruction limit; 20,000,000 matches Avalon */
- FT_UInt32 instructionLimit = 20000000UL;
-
- CF2_ArrStackRec subrStack;
-
- FT_Bool haveWidth;
- CF2_Buffer charstring = NULL;
-
- CF2_Int charstringIndex = -1; /* initialize to empty */
-
- /* TODO: placeholders for hint structures */
-
- /* objects used for hinting */
- CF2_ArrStackRec hStemHintArray;
- CF2_ArrStackRec vStemHintArray;
-
- CF2_HintMaskRec hintMask;
- CF2_GlyphPathRec glyphPath;
-
-
- /* initialize the remaining objects */
- cf2_arrstack_init( &subrStack,
- memory,
- error,
- sizeof ( CF2_BufferRec ) );
- cf2_arrstack_init( &hStemHintArray,
- memory,
- error,
- sizeof ( CF2_StemHintRec ) );
- cf2_arrstack_init( &vStemHintArray,
- memory,
- error,
- sizeof ( CF2_StemHintRec ) );
-
- /* initialize CF2_StemHint arrays */
- cf2_hintmask_init( &hintMask, error );
-
- /* initialize path map to manage drawing operations */
-
- /* Note: last 4 params are used to handle `MoveToPermissive', which */
- /* may need to call `hintMap.Build' */
- /* TODO: MoveToPermissive is gone; are these still needed? */
- cf2_glyphpath_init( &glyphPath,
- font,
- callbacks,
- scaleY,
- /* hShift, */
- &hStemHintArray,
- &vStemHintArray,
- &hintMask,
- hintOriginY,
- &font->blues,
- translation );
-
- /*
- * Initialize state for width parsing. From the CFF Spec:
- *
- * The first stack-clearing operator, which must be one of hstem,
- * hstemhm, vstem, vstemhm, cntrmask, hintmask, hmoveto, vmoveto,
- * rmoveto, or endchar, takes an additional argument - the width (as
- * described earlier), which may be expressed as zero or one numeric
- * argument.
- *
- * What we implement here uses the first validly specified width, but
- * does not detect errors for specifying more than one width.
- *
- * If one of the above operators occurs without explicitly specifying
- * a width, we assume the default width.
- *
- */
- haveWidth = FALSE;
- *width = cf2_getDefaultWidthX( decoder );
-
- /*
- * Note: at this point, all pointers to resources must be NULL
- * and all local objects must be initialized.
- * There must be no branches to exit: above this point.
- *
- */
-
- /* allocate an operand stack */
- opStack = cf2_stack_init( memory, error );
- if ( !opStack )
- {
- lastError = FT_THROW( Out_Of_Memory );
- goto exit;
- }
-
- /* initialize subroutine stack by placing top level charstring as */
- /* first element (max depth plus one for the charstring) */
- /* Note: Caller owns and must finalize the first charstring. */
- /* Our copy of it does not change that requirement. */
- cf2_arrstack_setCount( &subrStack, CF2_MAX_SUBR + 1 );
-
- charstring = (CF2_Buffer)cf2_arrstack_getBuffer( &subrStack );
- *charstring = *buf; /* structure copy */
-
- charstringIndex = 0; /* entry is valid now */
-
- /* catch errors so far */
- if ( *error )
- goto exit;
-
- /* main interpreter loop */
- while ( 1 )
- {
- if ( cf2_buf_isEnd( charstring ) )
- {
- /* If we've reached the end of the charstring, simulate a */
- /* cf2_cmdRETURN or cf2_cmdENDCHAR. */
- if ( charstringIndex )
- op1 = cf2_cmdRETURN; /* end of buffer for subroutine */
- else
- op1 = cf2_cmdENDCHAR; /* end of buffer for top level charstring */
- }
- else
- op1 = (FT_Byte)cf2_buf_readByte( charstring );
-
- /* check for errors once per loop */
- if ( *error )
- goto exit;
-
- instructionLimit--;
- if ( instructionLimit == 0 )
- {
- lastError = FT_THROW( Invalid_Glyph_Format );
- goto exit;
- }
-
- switch( op1 )
- {
- case cf2_cmdRESERVED_0:
- case cf2_cmdRESERVED_2:
- case cf2_cmdRESERVED_9:
- case cf2_cmdRESERVED_13:
- case cf2_cmdRESERVED_15:
- case cf2_cmdRESERVED_16:
- case cf2_cmdRESERVED_17:
- /* we may get here if we have a prior error */
- FT_TRACE4(( " unknown op (%d)\n", op1 ));
- break;
-
- case cf2_cmdHSTEMHM:
- case cf2_cmdHSTEM:
- FT_TRACE4(( op1 == cf2_cmdHSTEMHM ? " hstemhm\n" : " hstem\n" ));
-
- /* never add hints after the mask is computed */
- if ( cf2_hintmask_isValid( &hintMask ) )
- {
- FT_TRACE4(( "cf2_interpT2CharString:"
- " invalid horizontal hint mask\n" ));
- break;
- }
-
- cf2_doStems( font,
- opStack,
- &hStemHintArray,
- width,
- &haveWidth,
- 0 );
-
- if ( font->decoder->width_only )
- goto exit;
-
- break;
-
- case cf2_cmdVSTEMHM:
- case cf2_cmdVSTEM:
- FT_TRACE4(( op1 == cf2_cmdVSTEMHM ? " vstemhm\n" : " vstem\n" ));
-
- /* never add hints after the mask is computed */
- if ( cf2_hintmask_isValid( &hintMask ) )
- {
- FT_TRACE4(( "cf2_interpT2CharString:"
- " invalid vertical hint mask\n" ));
- break;
- }
-
- cf2_doStems( font,
- opStack,
- &vStemHintArray,
- width,
- &haveWidth,
- 0 );
-
- if ( font->decoder->width_only )
- goto exit;
-
- break;
-
- case cf2_cmdVMOVETO:
- FT_TRACE4(( " vmoveto\n" ));
-
- if ( cf2_stack_count( opStack ) > 1 && !haveWidth )
- *width = cf2_stack_getReal( opStack, 0 ) + nominalWidthX;
-
- /* width is defined or default after this */
- haveWidth = TRUE;
-
- if ( font->decoder->width_only )
- goto exit;
-
- curY += cf2_stack_popFixed( opStack );
-
- cf2_glyphpath_moveTo( &glyphPath, curX, curY );
-
- break;
-
- case cf2_cmdRLINETO:
- {
- CF2_UInt index;
- CF2_UInt count = cf2_stack_count( opStack );
-
-
- FT_TRACE4(( " rlineto\n" ));
-
- for ( index = 0; index < count; index += 2 )
- {
- curX += cf2_stack_getReal( opStack, index + 0 );
- curY += cf2_stack_getReal( opStack, index + 1 );
-
- cf2_glyphpath_lineTo( &glyphPath, curX, curY );
- }
-
- cf2_stack_clear( opStack );
- }
- continue; /* no need to clear stack again */
-
- case cf2_cmdHLINETO:
- case cf2_cmdVLINETO:
- {
- CF2_UInt index;
- CF2_UInt count = cf2_stack_count( opStack );
-
- FT_Bool isX = op1 == cf2_cmdHLINETO;
-
-
- FT_TRACE4(( isX ? " hlineto\n" : " vlineto\n" ));
-
- for ( index = 0; index < count; index++ )
- {
- CF2_Fixed v = cf2_stack_getReal( opStack, index );
-
-
- if ( isX )
- curX += v;
- else
- curY += v;
-
- isX = !isX;
-
- cf2_glyphpath_lineTo( &glyphPath, curX, curY );
- }
-
- cf2_stack_clear( opStack );
- }
- continue;
-
- case cf2_cmdRCURVELINE:
- case cf2_cmdRRCURVETO:
- {
- CF2_UInt count = cf2_stack_count( opStack );
- CF2_UInt index = 0;
-
-
- FT_TRACE4(( op1 == cf2_cmdRCURVELINE ? " rcurveline\n"
- : " rrcurveto\n" ));
-
- while ( index + 6 <= count )
- {
- CF2_Fixed x1 = cf2_stack_getReal( opStack, index + 0 ) + curX;
- CF2_Fixed y1 = cf2_stack_getReal( opStack, index + 1 ) + curY;
- CF2_Fixed x2 = cf2_stack_getReal( opStack, index + 2 ) + x1;
- CF2_Fixed y2 = cf2_stack_getReal( opStack, index + 3 ) + y1;
- CF2_Fixed x3 = cf2_stack_getReal( opStack, index + 4 ) + x2;
- CF2_Fixed y3 = cf2_stack_getReal( opStack, index + 5 ) + y2;
-
-
- cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 );
-
- curX = x3;
- curY = y3;
- index += 6;
- }
-
- if ( op1 == cf2_cmdRCURVELINE )
- {
- curX += cf2_stack_getReal( opStack, index + 0 );
- curY += cf2_stack_getReal( opStack, index + 1 );
-
- cf2_glyphpath_lineTo( &glyphPath, curX, curY );
- }
-
- cf2_stack_clear( opStack );
- }
- continue; /* no need to clear stack again */
-
- case cf2_cmdCALLGSUBR:
- case cf2_cmdCALLSUBR:
- {
- CF2_UInt subrIndex;
-
-
- FT_TRACE4(( op1 == cf2_cmdCALLGSUBR ? " callgsubr"
- : " callsubr" ));
-
- if ( charstringIndex > CF2_MAX_SUBR )
- {
- /* max subr plus one for charstring */
- lastError = FT_THROW( Invalid_Glyph_Format );
- goto exit; /* overflow of stack */
- }
-
- /* push our current CFF charstring region on subrStack */
- charstring = (CF2_Buffer)
- cf2_arrstack_getPointer(
- &subrStack,
- (size_t)charstringIndex + 1 );
-
- /* set up the new CFF region and pointer */
- subrIndex = (CF2_UInt)cf2_stack_popInt( opStack );
-
- switch ( op1 )
- {
- case cf2_cmdCALLGSUBR:
- FT_TRACE4(( " (idx %d, entering level %d)\n",
- subrIndex + (CF2_UInt)decoder->globals_bias,
- charstringIndex + 1 ));
-
- if ( cf2_initGlobalRegionBuffer( decoder,
- subrIndex,
- charstring ) )
- {
- lastError = FT_THROW( Invalid_Glyph_Format );
- goto exit; /* subroutine lookup or stream error */
- }
- break;
-
- default:
- /* cf2_cmdCALLSUBR */
- FT_TRACE4(( " (idx %d, entering level %d)\n",
- subrIndex + (CF2_UInt)decoder->locals_bias,
- charstringIndex + 1 ));
-
- if ( cf2_initLocalRegionBuffer( decoder,
- subrIndex,
- charstring ) )
- {
- lastError = FT_THROW( Invalid_Glyph_Format );
- goto exit; /* subroutine lookup or stream error */
- }
- }
-
- charstringIndex += 1; /* entry is valid now */
- }
- continue; /* do not clear the stack */
-
- case cf2_cmdRETURN:
- FT_TRACE4(( " return (leaving level %d)\n", charstringIndex ));
-
- if ( charstringIndex < 1 )
- {
- /* Note: cannot return from top charstring */
- lastError = FT_THROW( Invalid_Glyph_Format );
- goto exit; /* underflow of stack */
- }
-
- /* restore position in previous charstring */
- charstring = (CF2_Buffer)
- cf2_arrstack_getPointer(
- &subrStack,
- (CF2_UInt)--charstringIndex );
- continue; /* do not clear the stack */
-
- case cf2_cmdESC:
- {
- FT_Byte op2 = (FT_Byte)cf2_buf_readByte( charstring );
-
-
- switch ( op2 )
- {
- case cf2_escDOTSECTION:
- /* something about `flip type of locking' -- ignore it */
- FT_TRACE4(( " dotsection\n" ));
-
- break;
-
- /* TODO: should these operators be supported? */
- case cf2_escAND: /* in spec */
- FT_TRACE4(( " and\n" ));
-
- CF2_FIXME;
- break;
-
- case cf2_escOR: /* in spec */
- FT_TRACE4(( " or\n" ));
-
- CF2_FIXME;
- break;
-
- case cf2_escNOT: /* in spec */
- FT_TRACE4(( " not\n" ));
-
- CF2_FIXME;
- break;
-
- case cf2_escABS: /* in spec */
- FT_TRACE4(( " abs\n" ));
-
- CF2_FIXME;
- break;
-
- case cf2_escADD: /* in spec */
- FT_TRACE4(( " add\n" ));
-
- CF2_FIXME;
- break;
-
- case cf2_escSUB: /* in spec */
- FT_TRACE4(( " sub\n" ));
-
- CF2_FIXME;
- break;
-
- case cf2_escDIV: /* in spec */
- FT_TRACE4(( " div\n" ));
-
- CF2_FIXME;
- break;
-
- case cf2_escNEG: /* in spec */
- FT_TRACE4(( " neg\n" ));
-
- CF2_FIXME;
- break;
-
- case cf2_escEQ: /* in spec */
- FT_TRACE4(( " eq\n" ));
-
- CF2_FIXME;
- break;
-
- case cf2_escDROP: /* in spec */
- FT_TRACE4(( " drop\n" ));
-
- CF2_FIXME;
- break;
-
- case cf2_escPUT: /* in spec */
- FT_TRACE4(( " put\n" ));
-
- CF2_FIXME;
- break;
-
- case cf2_escGET: /* in spec */
- FT_TRACE4(( " get\n" ));
-
- CF2_FIXME;
- break;
-
- case cf2_escIFELSE: /* in spec */
- FT_TRACE4(( " ifelse\n" ));
-
- CF2_FIXME;
- break;
-
- case cf2_escRANDOM: /* in spec */
- FT_TRACE4(( " random\n" ));
-
- CF2_FIXME;
- break;
-
- case cf2_escMUL: /* in spec */
- FT_TRACE4(( " mul\n" ));
-
- CF2_FIXME;
- break;
-
- case cf2_escSQRT: /* in spec */
- FT_TRACE4(( " sqrt\n" ));
-
- CF2_FIXME;
- break;
-
- case cf2_escDUP: /* in spec */
- FT_TRACE4(( " dup\n" ));
-
- CF2_FIXME;
- break;
-
- case cf2_escEXCH: /* in spec */
- FT_TRACE4(( " exch\n" ));
-
- CF2_FIXME;
- break;
-
- case cf2_escINDEX: /* in spec */
- FT_TRACE4(( " index\n" ));
-
- CF2_FIXME;
- break;
-
- case cf2_escROLL: /* in spec */
- FT_TRACE4(( " roll\n" ));
-
- CF2_FIXME;
- break;
-
- case cf2_escHFLEX:
- {
- static const FT_Bool readFromStack[12] =
- {
- TRUE /* dx1 */, FALSE /* dy1 */,
- TRUE /* dx2 */, TRUE /* dy2 */,
- TRUE /* dx3 */, FALSE /* dy3 */,
- TRUE /* dx4 */, FALSE /* dy4 */,
- TRUE /* dx5 */, FALSE /* dy5 */,
- TRUE /* dx6 */, FALSE /* dy6 */
- };
-
-
- FT_TRACE4(( " hflex\n" ));
-
- cf2_doFlex( opStack,
- &curX,
- &curY,
- &glyphPath,
- readFromStack,
- FALSE /* doConditionalLastRead */ );
- }
- continue;
-
- case cf2_escFLEX:
- {
- static const FT_Bool readFromStack[12] =
- {
- TRUE /* dx1 */, TRUE /* dy1 */,
- TRUE /* dx2 */, TRUE /* dy2 */,
- TRUE /* dx3 */, TRUE /* dy3 */,
- TRUE /* dx4 */, TRUE /* dy4 */,
- TRUE /* dx5 */, TRUE /* dy5 */,
- TRUE /* dx6 */, TRUE /* dy6 */
- };
-
-
- FT_TRACE4(( " flex\n" ));
-
- cf2_doFlex( opStack,
- &curX,
- &curY,
- &glyphPath,
- readFromStack,
- FALSE /* doConditionalLastRead */ );
- }
- break; /* TODO: why is this not a continue? */
-
- case cf2_escHFLEX1:
- {
- static const FT_Bool readFromStack[12] =
- {
- TRUE /* dx1 */, TRUE /* dy1 */,
- TRUE /* dx2 */, TRUE /* dy2 */,
- TRUE /* dx3 */, FALSE /* dy3 */,
- TRUE /* dx4 */, FALSE /* dy4 */,
- TRUE /* dx5 */, TRUE /* dy5 */,
- TRUE /* dx6 */, FALSE /* dy6 */
- };
-
-
- FT_TRACE4(( " hflex1\n" ));
-
- cf2_doFlex( opStack,
- &curX,
- &curY,
- &glyphPath,
- readFromStack,
- FALSE /* doConditionalLastRead */ );
- }
- continue;
-
- case cf2_escFLEX1:
- {
- static const FT_Bool readFromStack[12] =
- {
- TRUE /* dx1 */, TRUE /* dy1 */,
- TRUE /* dx2 */, TRUE /* dy2 */,
- TRUE /* dx3 */, TRUE /* dy3 */,
- TRUE /* dx4 */, TRUE /* dy4 */,
- TRUE /* dx5 */, TRUE /* dy5 */,
- FALSE /* dx6 */, FALSE /* dy6 */
- };
-
-
- FT_TRACE4(( " flex1\n" ));
-
- cf2_doFlex( opStack,
- &curX,
- &curY,
- &glyphPath,
- readFromStack,
- TRUE /* doConditionalLastRead */ );
- }
- continue;
-
- case cf2_escRESERVED_1:
- case cf2_escRESERVED_2:
- case cf2_escRESERVED_6:
- case cf2_escRESERVED_7:
- case cf2_escRESERVED_8:
- case cf2_escRESERVED_13:
- case cf2_escRESERVED_16:
- case cf2_escRESERVED_17:
- case cf2_escRESERVED_19:
- case cf2_escRESERVED_25:
- case cf2_escRESERVED_31:
- case cf2_escRESERVED_32:
- case cf2_escRESERVED_33:
- default:
- FT_TRACE4(( " unknown op (12, %d)\n", op2 ));
-
- }; /* end of switch statement checking `op2' */
-
- } /* case cf2_cmdESC */
- break;
-
- case cf2_cmdENDCHAR:
- FT_TRACE4(( " endchar\n" ));
-
- if ( cf2_stack_count( opStack ) == 1 ||
- cf2_stack_count( opStack ) == 5 )
- {
- if ( !haveWidth )
- *width = cf2_stack_getReal( opStack, 0 ) + nominalWidthX;
- }
-
- /* width is defined or default after this */
- haveWidth = TRUE;
-
- if ( font->decoder->width_only )
- goto exit;
-
- /* close path if still open */
- cf2_glyphpath_closeOpenPath( &glyphPath );
-
- if ( cf2_stack_count( opStack ) > 1 )
- {
- /* must be either 4 or 5 -- */
- /* this is a (deprecated) implied `seac' operator */
-
- CF2_Int achar;
- CF2_Int bchar;
- CF2_BufferRec component;
- CF2_Fixed dummyWidth; /* ignore component width */
- FT_Error error2;
-
-
- if ( doingSeac )
- {
- lastError = FT_THROW( Invalid_Glyph_Format );
- goto exit; /* nested seac */
- }
-
- achar = cf2_stack_popInt( opStack );
- bchar = cf2_stack_popInt( opStack );
-
- curY = cf2_stack_popFixed( opStack );
- curX = cf2_stack_popFixed( opStack );
-
- error2 = cf2_getSeacComponent( decoder, achar, &component );
- if ( error2 )
- {
- lastError = error2; /* pass FreeType error through */
- goto exit;
- }
- cf2_interpT2CharString( font,
- &component,
- callbacks,
- translation,
- TRUE,
- curX,
- curY,
- &dummyWidth );
- cf2_freeSeacComponent( decoder, &component );
-
- error2 = cf2_getSeacComponent( decoder, bchar, &component );
- if ( error2 )
- {
- lastError = error2; /* pass FreeType error through */
- goto exit;
- }
- cf2_interpT2CharString( font,
- &component,
- callbacks,
- translation,
- TRUE,
- 0,
- 0,
- &dummyWidth );
- cf2_freeSeacComponent( decoder, &component );
- }
- goto exit;
-
- case cf2_cmdCNTRMASK:
- case cf2_cmdHINTMASK:
- /* the final \n in the tracing message gets added in */
- /* `cf2_hintmask_read' (which also traces the mask bytes) */
- FT_TRACE4(( op1 == cf2_cmdCNTRMASK ? " cntrmask" : " hintmask" ));
-
- /* never add hints after the mask is computed */
- if ( cf2_stack_count( opStack ) > 1 &&
- cf2_hintmask_isValid( &hintMask ) )
- {
- FT_TRACE4(( "cf2_interpT2CharString: invalid hint mask\n" ));
- break;
- }
-
- /* if there are arguments on the stack, there this is an */
- /* implied cf2_cmdVSTEMHM */
- cf2_doStems( font,
- opStack,
- &vStemHintArray,
- width,
- &haveWidth,
- 0 );
-
- if ( font->decoder->width_only )
- goto exit;
-
- if ( op1 == cf2_cmdHINTMASK )
- {
- /* consume the hint mask bytes which follow the operator */
- cf2_hintmask_read( &hintMask,
- charstring,
- cf2_arrstack_size( &hStemHintArray ) +
- cf2_arrstack_size( &vStemHintArray ) );
- }
- else
- {
- /*
- * Consume the counter mask bytes which follow the operator:
- * Build a temporary hint map, just to place and lock those
- * stems participating in the counter mask. These are most
- * likely the dominant hstems, and are grouped together in a
- * few counter groups, not necessarily in correspondence
- * with the hint groups. This reduces the chances of
- * conflicts between hstems that are initially placed in
- * separate hint groups and then brought together. The
- * positions are copied back to `hStemHintArray', so we can
- * discard `counterMask' and `counterHintMap'.
- *
- */
- CF2_HintMapRec counterHintMap;
- CF2_HintMaskRec counterMask;
-
-
- cf2_hintmap_init( &counterHintMap,
- font,
- &glyphPath.initialHintMap,
- &glyphPath.hintMoves,
- scaleY );
- cf2_hintmask_init( &counterMask, error );
-
- cf2_hintmask_read( &counterMask,
- charstring,
- cf2_arrstack_size( &hStemHintArray ) +
- cf2_arrstack_size( &vStemHintArray ) );
- cf2_hintmap_build( &counterHintMap,
- &hStemHintArray,
- &vStemHintArray,
- &counterMask,
- 0,
- FALSE );
- }
- break;
-
- case cf2_cmdRMOVETO:
- FT_TRACE4(( " rmoveto\n" ));
-
- if ( cf2_stack_count( opStack ) > 2 && !haveWidth )
- *width = cf2_stack_getReal( opStack, 0 ) + nominalWidthX;
-
- /* width is defined or default after this */
- haveWidth = TRUE;
-
- if ( font->decoder->width_only )
- goto exit;
-
- curY += cf2_stack_popFixed( opStack );
- curX += cf2_stack_popFixed( opStack );
-
- cf2_glyphpath_moveTo( &glyphPath, curX, curY );
-
- break;
-
- case cf2_cmdHMOVETO:
- FT_TRACE4(( " hmoveto\n" ));
-
- if ( cf2_stack_count( opStack ) > 1 && !haveWidth )
- *width = cf2_stack_getReal( opStack, 0 ) + nominalWidthX;
-
- /* width is defined or default after this */
- haveWidth = TRUE;
-
- if ( font->decoder->width_only )
- goto exit;
-
- curX += cf2_stack_popFixed( opStack );
-
- cf2_glyphpath_moveTo( &glyphPath, curX, curY );
-
- break;
-
- case cf2_cmdRLINECURVE:
- {
- CF2_UInt count = cf2_stack_count( opStack );
- CF2_UInt index = 0;
-
-
- FT_TRACE4(( " rlinecurve\n" ));
-
- while ( index + 6 < count )
- {
- curX += cf2_stack_getReal( opStack, index + 0 );
- curY += cf2_stack_getReal( opStack, index + 1 );
-
- cf2_glyphpath_lineTo( &glyphPath, curX, curY );
- index += 2;
- }
-
- while ( index < count )
- {
- CF2_Fixed x1 = cf2_stack_getReal( opStack, index + 0 ) + curX;
- CF2_Fixed y1 = cf2_stack_getReal( opStack, index + 1 ) + curY;
- CF2_Fixed x2 = cf2_stack_getReal( opStack, index + 2 ) + x1;
- CF2_Fixed y2 = cf2_stack_getReal( opStack, index + 3 ) + y1;
- CF2_Fixed x3 = cf2_stack_getReal( opStack, index + 4 ) + x2;
- CF2_Fixed y3 = cf2_stack_getReal( opStack, index + 5 ) + y2;
-
-
- cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 );
-
- curX = x3;
- curY = y3;
- index += 6;
- }
-
- cf2_stack_clear( opStack );
- }
- continue; /* no need to clear stack again */
-
- case cf2_cmdVVCURVETO:
- {
- CF2_UInt count, count1 = cf2_stack_count( opStack );
- CF2_UInt index = 0;
-
-
- /* if `cf2_stack_count' isn't of the form 4n or 4n+1, */
- /* we enforce it by clearing the second bit */
- /* (and sorting the stack indexing to suit) */
- count = count1 & ~2U;
- index += count1 - count;
-
- FT_TRACE4(( " vvcurveto\n" ));
-
- while ( index < count )
- {
- CF2_Fixed x1, y1, x2, y2, x3, y3;
-
-
- if ( ( count - index ) & 1 )
- {
- x1 = cf2_stack_getReal( opStack, index ) + curX;
-
- ++index;
- }
- else
- x1 = curX;
-
- y1 = cf2_stack_getReal( opStack, index + 0 ) + curY;
- x2 = cf2_stack_getReal( opStack, index + 1 ) + x1;
- y2 = cf2_stack_getReal( opStack, index + 2 ) + y1;
- x3 = x2;
- y3 = cf2_stack_getReal( opStack, index + 3 ) + y2;
-
- cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 );
-
- curX = x3;
- curY = y3;
- index += 4;
- }
-
- cf2_stack_clear( opStack );
- }
- continue; /* no need to clear stack again */
-
- case cf2_cmdHHCURVETO:
- {
- CF2_UInt count, count1 = cf2_stack_count( opStack );
- CF2_UInt index = 0;
-
-
- /* if `cf2_stack_count' isn't of the form 4n or 4n+1, */
- /* we enforce it by clearing the second bit */
- /* (and sorting the stack indexing to suit) */
- count = count1 & ~2U;
- index += count1 - count;
-
- FT_TRACE4(( " hhcurveto\n" ));
-
- while ( index < count )
- {
- CF2_Fixed x1, y1, x2, y2, x3, y3;
-
-
- if ( ( count - index ) & 1 )
- {
- y1 = cf2_stack_getReal( opStack, index ) + curY;
-
- ++index;
- }
- else
- y1 = curY;
-
- x1 = cf2_stack_getReal( opStack, index + 0 ) + curX;
- x2 = cf2_stack_getReal( opStack, index + 1 ) + x1;
- y2 = cf2_stack_getReal( opStack, index + 2 ) + y1;
- x3 = cf2_stack_getReal( opStack, index + 3 ) + x2;
- y3 = y2;
-
- cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 );
-
- curX = x3;
- curY = y3;
- index += 4;
- }
-
- cf2_stack_clear( opStack );
- }
- continue; /* no need to clear stack again */
-
- case cf2_cmdVHCURVETO:
- case cf2_cmdHVCURVETO:
- {
- CF2_UInt count, count1 = cf2_stack_count( opStack );
- CF2_UInt index = 0;
-
- FT_Bool alternate = op1 == cf2_cmdHVCURVETO;
-
-
- /* if `cf2_stack_count' isn't of the form 8n, 8n+1, */
- /* 8n+4, or 8n+5, we enforce it by clearing the */
- /* second bit */
- /* (and sorting the stack indexing to suit) */
- count = count1 & ~2U;
- index += count1 - count;
-
- FT_TRACE4(( alternate ? " hvcurveto\n" : " vhcurveto\n" ));
-
- while ( index < count )
- {
- CF2_Fixed x1, x2, x3, y1, y2, y3;
-
-
- if ( alternate )
- {
- x1 = cf2_stack_getReal( opStack, index + 0 ) + curX;
- y1 = curY;
- x2 = cf2_stack_getReal( opStack, index + 1 ) + x1;
- y2 = cf2_stack_getReal( opStack, index + 2 ) + y1;
- y3 = cf2_stack_getReal( opStack, index + 3 ) + y2;
-
- if ( count - index == 5 )
- {
- x3 = cf2_stack_getReal( opStack, index + 4 ) + x2;
-
- ++index;
- }
- else
- x3 = x2;
-
- alternate = FALSE;
- }
- else
- {
- x1 = curX;
- y1 = cf2_stack_getReal( opStack, index + 0 ) + curY;
- x2 = cf2_stack_getReal( opStack, index + 1 ) + x1;
- y2 = cf2_stack_getReal( opStack, index + 2 ) + y1;
- x3 = cf2_stack_getReal( opStack, index + 3 ) + x2;
-
- if ( count - index == 5 )
- {
- y3 = cf2_stack_getReal( opStack, index + 4 ) + y2;
-
- ++index;
- }
- else
- y3 = y2;
-
- alternate = TRUE;
- }
-
- cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 );
-
- curX = x3;
- curY = y3;
- index += 4;
- }
-
- cf2_stack_clear( opStack );
- }
- continue; /* no need to clear stack again */
-
- case cf2_cmdEXTENDEDNMBR:
- {
- CF2_Int v;
-
-
- v = (FT_Short)( ( cf2_buf_readByte( charstring ) << 8 ) |
- cf2_buf_readByte( charstring ) );
-
- FT_TRACE4(( " %d", v ));
-
- cf2_stack_pushInt( opStack, v );
- }
- continue;
-
- default:
- /* numbers */
- {
- if ( /* op1 >= 32 && */ op1 <= 246 )
- {
- CF2_Int v;
-
-
- v = op1 - 139;
-
- FT_TRACE4(( " %d", v ));
-
- /* -107 .. 107 */
- cf2_stack_pushInt( opStack, v );
- }
-
- else if ( /* op1 >= 247 && */ op1 <= 250 )
- {
- CF2_Int v;
-
-
- v = op1;
- v -= 247;
- v *= 256;
- v += cf2_buf_readByte( charstring );
- v += 108;
-
- FT_TRACE4(( " %d", v ));
-
- /* 108 .. 1131 */
- cf2_stack_pushInt( opStack, v );
- }
-
- else if ( /* op1 >= 251 && */ op1 <= 254 )
- {
- CF2_Int v;
-
-
- v = op1;
- v -= 251;
- v *= 256;
- v += cf2_buf_readByte( charstring );
- v = -v - 108;
-
- FT_TRACE4(( " %d", v ));
-
- /* -1131 .. -108 */
- cf2_stack_pushInt( opStack, v );
- }
-
- else /* op1 == 255 */
- {
- CF2_Fixed v;
-
-
- v = (CF2_Fixed)
- ( ( (FT_UInt32)cf2_buf_readByte( charstring ) << 24 ) |
- ( (FT_UInt32)cf2_buf_readByte( charstring ) << 16 ) |
- ( (FT_UInt32)cf2_buf_readByte( charstring ) << 8 ) |
- (FT_UInt32)cf2_buf_readByte( charstring ) );
-
- FT_TRACE4(( " %.2f", v / 65536.0 ));
-
- cf2_stack_pushFixed( opStack, v );
- }
- }
- continue; /* don't clear stack */
-
- } /* end of switch statement checking `op1' */
-
- cf2_stack_clear( opStack );
-
- } /* end of main interpreter loop */
-
- /* we get here if the charstring ends without cf2_cmdENDCHAR */
- FT_TRACE4(( "cf2_interpT2CharString:"
- " charstring ends without ENDCHAR\n" ));
-
- exit:
- /* check whether last error seen is also the first one */
- cf2_setError( error, lastError );
-
- /* free resources from objects we've used */
- cf2_glyphpath_finalize( &glyphPath );
- cf2_arrstack_finalize( &vStemHintArray );
- cf2_arrstack_finalize( &hStemHintArray );
- cf2_arrstack_finalize( &subrStack );
- cf2_stack_free( opStack );
-
- FT_TRACE4(( "\n" ));
-
- return;
- }
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/cff/cf2intrp.h b/chromium/third_party/pdfium/third_party/freetype/src/cff/cf2intrp.h
deleted file mode 100644
index b5d8947838e..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/cff/cf2intrp.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/***************************************************************************/
-/* */
-/* cf2font.h */
-/* */
-/* Adobe's CFF Interpreter (specification). */
-/* */
-/* Copyright 2007-2013 Adobe Systems Incorporated. */
-/* */
-/* This software, and all works of authorship, whether in source or */
-/* object code form as indicated by the copyright notice(s) included */
-/* herein (collectively, the "Work") is made available, and may only be */
-/* used, modified, and distributed under the FreeType Project License, */
-/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */
-/* FreeType Project License, each contributor to the Work hereby grants */
-/* to any individual or legal entity exercising permissions granted by */
-/* the FreeType Project License and this section (hereafter, "You" or */
-/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */
-/* royalty-free, irrevocable (except as stated in this section) patent */
-/* license to make, have made, use, offer to sell, sell, import, and */
-/* otherwise transfer the Work, where such license applies only to those */
-/* patent claims licensable by such contributor that are necessarily */
-/* infringed by their contribution(s) alone or by combination of their */
-/* contribution(s) with the Work to which such contribution(s) was */
-/* submitted. If You institute patent litigation against any entity */
-/* (including a cross-claim or counterclaim in a lawsuit) alleging that */
-/* the Work or a contribution incorporated within the Work constitutes */
-/* direct or contributory patent infringement, then any patent licenses */
-/* granted to You under this License for that Work shall terminate as of */
-/* the date such litigation is filed. */
-/* */
-/* By using, modifying, or distributing the Work you indicate that you */
-/* have read and understood the terms and conditions of the */
-/* FreeType Project License as well as those provided in this section, */
-/* and you accept them fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __CF2INTRP_H__
-#define __CF2INTRP_H__
-
-
-#include "cf2ft.h"
-#include "cf2hints.h"
-
-
-FT_BEGIN_HEADER
-
-
- FT_LOCAL( void )
- cf2_hintmask_init( CF2_HintMask hintmask,
- FT_Error* error );
- FT_LOCAL( FT_Bool )
- cf2_hintmask_isValid( const CF2_HintMask hintmask );
- FT_LOCAL( FT_Bool )
- cf2_hintmask_isNew( const CF2_HintMask hintmask );
- FT_LOCAL( void )
- cf2_hintmask_setNew( CF2_HintMask hintmask,
- FT_Bool val );
- FT_LOCAL( FT_Byte* )
- cf2_hintmask_getMaskPtr( CF2_HintMask hintmask );
- FT_LOCAL( void )
- cf2_hintmask_setAll( CF2_HintMask hintmask,
- size_t bitCount );
-
- FT_LOCAL( void )
- cf2_interpT2CharString( CF2_Font font,
- CF2_Buffer charstring,
- CF2_OutlineCallbacks callbacks,
- const FT_Vector* translation,
- FT_Bool doingSeac,
- CF2_Fixed curX,
- CF2_Fixed curY,
- CF2_Fixed* width );
-
-
-FT_END_HEADER
-
-
-#endif /* __CF2INTRP_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/cff/cf2read.c b/chromium/third_party/pdfium/third_party/freetype/src/cff/cf2read.c
deleted file mode 100644
index 2b429e3eeb0..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/cff/cf2read.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/***************************************************************************/
-/* */
-/* cf2read.c */
-/* */
-/* Adobe's code for stream handling (body). */
-/* */
-/* Copyright 2007-2013 Adobe Systems Incorporated. */
-/* */
-/* This software, and all works of authorship, whether in source or */
-/* object code form as indicated by the copyright notice(s) included */
-/* herein (collectively, the "Work") is made available, and may only be */
-/* used, modified, and distributed under the FreeType Project License, */
-/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */
-/* FreeType Project License, each contributor to the Work hereby grants */
-/* to any individual or legal entity exercising permissions granted by */
-/* the FreeType Project License and this section (hereafter, "You" or */
-/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */
-/* royalty-free, irrevocable (except as stated in this section) patent */
-/* license to make, have made, use, offer to sell, sell, import, and */
-/* otherwise transfer the Work, where such license applies only to those */
-/* patent claims licensable by such contributor that are necessarily */
-/* infringed by their contribution(s) alone or by combination of their */
-/* contribution(s) with the Work to which such contribution(s) was */
-/* submitted. If You institute patent litigation against any entity */
-/* (including a cross-claim or counterclaim in a lawsuit) alleging that */
-/* the Work or a contribution incorporated within the Work constitutes */
-/* direct or contributory patent infringement, then any patent licenses */
-/* granted to You under this License for that Work shall terminate as of */
-/* the date such litigation is filed. */
-/* */
-/* By using, modifying, or distributing the Work you indicate that you */
-/* have read and understood the terms and conditions of the */
-/* FreeType Project License as well as those provided in this section, */
-/* and you accept them fully. */
-/* */
-/***************************************************************************/
-
-
-#include "cf2ft.h"
-#include FT_INTERNAL_DEBUG_H
-
-#include "cf2glue.h"
-
-#include "cf2error.h"
-
-
- /* Define CF2_IO_FAIL as 1 to enable random errors and random */
- /* value errors in I/O. */
-#define CF2_IO_FAIL 0
-
-
-#if CF2_IO_FAIL
-
- /* set the .00 value to a nonzero probability */
- static int
- randomError2( void )
- {
- /* for region buffer ReadByte (interp) function */
- return (double)rand() / RAND_MAX < .00;
- }
-
- /* set the .00 value to a nonzero probability */
- static CF2_Int
- randomValue()
- {
- return (double)rand() / RAND_MAX < .00 ? rand() : 0;
- }
-
-#endif /* CF2_IO_FAIL */
-
-
- /* Region Buffer */
- /* */
- /* Can be constructed from a copied buffer managed by */
- /* `FCM_getDatablock'. */
- /* Reads bytes with check for end of buffer. */
-
- /* reading past the end of the buffer sets error and returns zero */
- FT_LOCAL_DEF( CF2_Int )
- cf2_buf_readByte( CF2_Buffer buf )
- {
- if ( buf->ptr < buf->end )
- {
-#if CF2_IO_FAIL
- if ( randomError2() )
- {
- CF2_SET_ERROR( buf->error, Invalid_Stream_Operation );
- return 0;
- }
-
- return *(buf->ptr)++ + randomValue();
-#else
- return *(buf->ptr)++;
-#endif
- }
- else
- {
- CF2_SET_ERROR( buf->error, Invalid_Stream_Operation );
- return 0;
- }
- }
-
-
- /* note: end condition can occur without error */
- FT_LOCAL_DEF( FT_Bool )
- cf2_buf_isEnd( CF2_Buffer buf )
- {
- return (FT_Bool)( buf->ptr >= buf->end );
- }
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/cff/cf2read.h b/chromium/third_party/pdfium/third_party/freetype/src/cff/cf2read.h
deleted file mode 100644
index 7ef7c8c1493..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/cff/cf2read.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/***************************************************************************/
-/* */
-/* cf2read.h */
-/* */
-/* Adobe's code for stream handling (specification). */
-/* */
-/* Copyright 2007-2013 Adobe Systems Incorporated. */
-/* */
-/* This software, and all works of authorship, whether in source or */
-/* object code form as indicated by the copyright notice(s) included */
-/* herein (collectively, the "Work") is made available, and may only be */
-/* used, modified, and distributed under the FreeType Project License, */
-/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */
-/* FreeType Project License, each contributor to the Work hereby grants */
-/* to any individual or legal entity exercising permissions granted by */
-/* the FreeType Project License and this section (hereafter, "You" or */
-/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */
-/* royalty-free, irrevocable (except as stated in this section) patent */
-/* license to make, have made, use, offer to sell, sell, import, and */
-/* otherwise transfer the Work, where such license applies only to those */
-/* patent claims licensable by such contributor that are necessarily */
-/* infringed by their contribution(s) alone or by combination of their */
-/* contribution(s) with the Work to which such contribution(s) was */
-/* submitted. If You institute patent litigation against any entity */
-/* (including a cross-claim or counterclaim in a lawsuit) alleging that */
-/* the Work or a contribution incorporated within the Work constitutes */
-/* direct or contributory patent infringement, then any patent licenses */
-/* granted to You under this License for that Work shall terminate as of */
-/* the date such litigation is filed. */
-/* */
-/* By using, modifying, or distributing the Work you indicate that you */
-/* have read and understood the terms and conditions of the */
-/* FreeType Project License as well as those provided in this section, */
-/* and you accept them fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __CF2READ_H__
-#define __CF2READ_H__
-
-
-FT_BEGIN_HEADER
-
-
- typedef struct CF2_BufferRec_
- {
- FT_Error* error;
- const FT_Byte* start;
- const FT_Byte* end;
- const FT_Byte* ptr;
-
- } CF2_BufferRec, *CF2_Buffer;
-
-
- FT_LOCAL( CF2_Int )
- cf2_buf_readByte( CF2_Buffer buf );
- FT_LOCAL( FT_Bool )
- cf2_buf_isEnd( CF2_Buffer buf );
-
-
-FT_END_HEADER
-
-
-#endif /* __CF2READ_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/cff/cf2stack.c b/chromium/third_party/pdfium/third_party/freetype/src/cff/cf2stack.c
deleted file mode 100644
index 8332b5d91aa..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/cff/cf2stack.c
+++ /dev/null
@@ -1,205 +0,0 @@
-/***************************************************************************/
-/* */
-/* cf2stack.c */
-/* */
-/* Adobe's code for emulating a CFF stack (body). */
-/* */
-/* Copyright 2007-2013 Adobe Systems Incorporated. */
-/* */
-/* This software, and all works of authorship, whether in source or */
-/* object code form as indicated by the copyright notice(s) included */
-/* herein (collectively, the "Work") is made available, and may only be */
-/* used, modified, and distributed under the FreeType Project License, */
-/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */
-/* FreeType Project License, each contributor to the Work hereby grants */
-/* to any individual or legal entity exercising permissions granted by */
-/* the FreeType Project License and this section (hereafter, "You" or */
-/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */
-/* royalty-free, irrevocable (except as stated in this section) patent */
-/* license to make, have made, use, offer to sell, sell, import, and */
-/* otherwise transfer the Work, where such license applies only to those */
-/* patent claims licensable by such contributor that are necessarily */
-/* infringed by their contribution(s) alone or by combination of their */
-/* contribution(s) with the Work to which such contribution(s) was */
-/* submitted. If You institute patent litigation against any entity */
-/* (including a cross-claim or counterclaim in a lawsuit) alleging that */
-/* the Work or a contribution incorporated within the Work constitutes */
-/* direct or contributory patent infringement, then any patent licenses */
-/* granted to You under this License for that Work shall terminate as of */
-/* the date such litigation is filed. */
-/* */
-/* By using, modifying, or distributing the Work you indicate that you */
-/* have read and understood the terms and conditions of the */
-/* FreeType Project License as well as those provided in this section, */
-/* and you accept them fully. */
-/* */
-/***************************************************************************/
-
-
-#include "cf2ft.h"
-#include FT_INTERNAL_DEBUG_H
-
-#include "cf2glue.h"
-#include "cf2font.h"
-#include "cf2stack.h"
-
-#include "cf2error.h"
-
-
- /* Allocate and initialize an instance of CF2_Stack. */
- /* Note: This function returns NULL on error (does not set */
- /* `error'). */
- FT_LOCAL_DEF( CF2_Stack )
- cf2_stack_init( FT_Memory memory,
- FT_Error* e )
- {
- FT_Error error = FT_Err_Ok; /* for FT_QNEW */
-
- CF2_Stack stack = NULL;
-
-
- if ( !FT_QNEW( stack ) )
- {
- /* initialize the structure; FT_QNEW zeroes it */
- stack->memory = memory;
- stack->error = e;
- stack->top = &stack->buffer[0]; /* empty stack */
- }
-
- return stack;
- }
-
-
- FT_LOCAL_DEF( void )
- cf2_stack_free( CF2_Stack stack )
- {
- if ( stack )
- {
- FT_Memory memory = stack->memory;
-
-
- /* free the main structure */
- FT_FREE( stack );
- }
- }
-
-
- FT_LOCAL_DEF( CF2_UInt )
- cf2_stack_count( CF2_Stack stack )
- {
- return (CF2_UInt)( stack->top - &stack->buffer[0] );
- }
-
-
- FT_LOCAL_DEF( void )
- cf2_stack_pushInt( CF2_Stack stack,
- CF2_Int val )
- {
- if ( stack->top == &stack->buffer[CF2_OPERAND_STACK_SIZE] )
- {
- CF2_SET_ERROR( stack->error, Stack_Overflow );
- return; /* stack overflow */
- }
-
- stack->top->u.i = val;
- stack->top->type = CF2_NumberInt;
- ++stack->top;
- }
-
-
- FT_LOCAL_DEF( void )
- cf2_stack_pushFixed( CF2_Stack stack,
- CF2_Fixed val )
- {
- if ( stack->top == &stack->buffer[CF2_OPERAND_STACK_SIZE] )
- {
- CF2_SET_ERROR( stack->error, Stack_Overflow );
- return; /* stack overflow */
- }
-
- stack->top->u.r = val;
- stack->top->type = CF2_NumberFixed;
- ++stack->top;
- }
-
-
- /* this function is only allowed to pop an integer type */
- FT_LOCAL_DEF( CF2_Int )
- cf2_stack_popInt( CF2_Stack stack )
- {
- if ( stack->top == &stack->buffer[0] )
- {
- CF2_SET_ERROR( stack->error, Stack_Underflow );
- return 0; /* underflow */
- }
- if ( stack->top[-1].type != CF2_NumberInt )
- {
- CF2_SET_ERROR( stack->error, Syntax_Error );
- return 0; /* type mismatch */
- }
-
- --stack->top;
-
- return stack->top->u.i;
- }
-
-
- /* Note: type mismatch is silently cast */
- /* TODO: check this */
- FT_LOCAL_DEF( CF2_Fixed )
- cf2_stack_popFixed( CF2_Stack stack )
- {
- if ( stack->top == &stack->buffer[0] )
- {
- CF2_SET_ERROR( stack->error, Stack_Underflow );
- return cf2_intToFixed( 0 ); /* underflow */
- }
-
- --stack->top;
-
- switch ( stack->top->type )
- {
- case CF2_NumberInt:
- return cf2_intToFixed( stack->top->u.i );
- case CF2_NumberFrac:
- return cf2_fracToFixed( stack->top->u.f );
- default:
- return stack->top->u.r;
- }
- }
-
-
- /* Note: type mismatch is silently cast */
- /* TODO: check this */
- FT_LOCAL_DEF( CF2_Fixed )
- cf2_stack_getReal( CF2_Stack stack,
- CF2_UInt idx )
- {
- FT_ASSERT( cf2_stack_count( stack ) <= CF2_OPERAND_STACK_SIZE );
-
- if ( idx >= cf2_stack_count( stack ) )
- {
- CF2_SET_ERROR( stack->error, Stack_Overflow );
- return cf2_intToFixed( 0 ); /* bounds error */
- }
-
- switch ( stack->buffer[idx].type )
- {
- case CF2_NumberInt:
- return cf2_intToFixed( stack->buffer[idx].u.i );
- case CF2_NumberFrac:
- return cf2_fracToFixed( stack->buffer[idx].u.f );
- default:
- return stack->buffer[idx].u.r;
- }
- }
-
-
- FT_LOCAL_DEF( void )
- cf2_stack_clear( CF2_Stack stack )
- {
- stack->top = &stack->buffer[0];
- }
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/cff/cf2stack.h b/chromium/third_party/pdfium/third_party/freetype/src/cff/cf2stack.h
deleted file mode 100644
index 7d6d1961fe9..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/cff/cf2stack.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/***************************************************************************/
-/* */
-/* cf2stack.h */
-/* */
-/* Adobe's code for emulating a CFF stack (specification). */
-/* */
-/* Copyright 2007-2013 Adobe Systems Incorporated. */
-/* */
-/* This software, and all works of authorship, whether in source or */
-/* object code form as indicated by the copyright notice(s) included */
-/* herein (collectively, the "Work") is made available, and may only be */
-/* used, modified, and distributed under the FreeType Project License, */
-/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */
-/* FreeType Project License, each contributor to the Work hereby grants */
-/* to any individual or legal entity exercising permissions granted by */
-/* the FreeType Project License and this section (hereafter, "You" or */
-/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */
-/* royalty-free, irrevocable (except as stated in this section) patent */
-/* license to make, have made, use, offer to sell, sell, import, and */
-/* otherwise transfer the Work, where such license applies only to those */
-/* patent claims licensable by such contributor that are necessarily */
-/* infringed by their contribution(s) alone or by combination of their */
-/* contribution(s) with the Work to which such contribution(s) was */
-/* submitted. If You institute patent litigation against any entity */
-/* (including a cross-claim or counterclaim in a lawsuit) alleging that */
-/* the Work or a contribution incorporated within the Work constitutes */
-/* direct or contributory patent infringement, then any patent licenses */
-/* granted to You under this License for that Work shall terminate as of */
-/* the date such litigation is filed. */
-/* */
-/* By using, modifying, or distributing the Work you indicate that you */
-/* have read and understood the terms and conditions of the */
-/* FreeType Project License as well as those provided in this section, */
-/* and you accept them fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __CF2STACK_H__
-#define __CF2STACK_H__
-
-
-FT_BEGIN_HEADER
-
-
- /* CFF operand stack; specified maximum of 48 or 192 values */
- typedef struct CF2_StackNumber_
- {
- union
- {
- CF2_Fixed r; /* 16.16 fixed point */
- CF2_Frac f; /* 2.30 fixed point (for font matrix) */
- CF2_Int i;
- } u;
-
- CF2_NumberType type;
-
- } CF2_StackNumber;
-
-
- typedef struct CF2_StackRec_
- {
- FT_Memory memory;
- FT_Error* error;
- CF2_StackNumber buffer[CF2_OPERAND_STACK_SIZE];
- CF2_StackNumber* top;
-
- } CF2_StackRec, *CF2_Stack;
-
-
- FT_LOCAL( CF2_Stack )
- cf2_stack_init( FT_Memory memory,
- FT_Error* error );
- FT_LOCAL( void )
- cf2_stack_free( CF2_Stack stack );
-
- FT_LOCAL( CF2_UInt )
- cf2_stack_count( CF2_Stack stack );
-
- FT_LOCAL( void )
- cf2_stack_pushInt( CF2_Stack stack,
- CF2_Int val );
- FT_LOCAL( void )
- cf2_stack_pushFixed( CF2_Stack stack,
- CF2_Fixed val );
-
- FT_LOCAL( CF2_Int )
- cf2_stack_popInt( CF2_Stack stack );
- FT_LOCAL( CF2_Fixed )
- cf2_stack_popFixed( CF2_Stack stack );
-
- FT_LOCAL( CF2_Fixed )
- cf2_stack_getReal( CF2_Stack stack,
- CF2_UInt idx );
-
- FT_LOCAL( void )
- cf2_stack_clear( CF2_Stack stack );
-
-
-FT_END_HEADER
-
-
-#endif /* __CF2STACK_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/cff/cf2types.h b/chromium/third_party/pdfium/third_party/freetype/src/cff/cf2types.h
deleted file mode 100644
index ac6a02266e7..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/cff/cf2types.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/***************************************************************************/
-/* */
-/* cf2types.h */
-/* */
-/* Adobe's code for defining data types (specification only). */
-/* */
-/* Copyright 2011-2013 Adobe Systems Incorporated. */
-/* */
-/* This software, and all works of authorship, whether in source or */
-/* object code form as indicated by the copyright notice(s) included */
-/* herein (collectively, the "Work") is made available, and may only be */
-/* used, modified, and distributed under the FreeType Project License, */
-/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */
-/* FreeType Project License, each contributor to the Work hereby grants */
-/* to any individual or legal entity exercising permissions granted by */
-/* the FreeType Project License and this section (hereafter, "You" or */
-/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */
-/* royalty-free, irrevocable (except as stated in this section) patent */
-/* license to make, have made, use, offer to sell, sell, import, and */
-/* otherwise transfer the Work, where such license applies only to those */
-/* patent claims licensable by such contributor that are necessarily */
-/* infringed by their contribution(s) alone or by combination of their */
-/* contribution(s) with the Work to which such contribution(s) was */
-/* submitted. If You institute patent litigation against any entity */
-/* (including a cross-claim or counterclaim in a lawsuit) alleging that */
-/* the Work or a contribution incorporated within the Work constitutes */
-/* direct or contributory patent infringement, then any patent licenses */
-/* granted to You under this License for that Work shall terminate as of */
-/* the date such litigation is filed. */
-/* */
-/* By using, modifying, or distributing the Work you indicate that you */
-/* have read and understood the terms and conditions of the */
-/* FreeType Project License as well as those provided in this section, */
-/* and you accept them fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __CF2TYPES_H__
-#define __CF2TYPES_H__
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-
-
-FT_BEGIN_HEADER
-
-
- /*
- * The data models that we expect to support are as follows:
- *
- * name char short int long long-long pointer example
- * -----------------------------------------------------
- * ILP32 8 16 32 32 64* 32 32-bit MacOS, x86
- * LLP64 8 16 32 32 64 64 x64
- * LP64 8 16 32 64 64 64 64-bit MacOS
- *
- * *) type may be supported by emulation on a 32-bit architecture
- *
- */
-
-
- /* integers at least 32 bits wide */
-#define CF2_UInt FT_UFast
-#define CF2_Int FT_Fast
-
-
- /* fixed-float numbers */
- typedef FT_Int32 CF2_F16Dot16;
-
-
-FT_END_HEADER
-
-
-#endif /* __CF2TYPES_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/cff/cff.c b/chromium/third_party/pdfium/third_party/freetype/src/cff/cff.c
deleted file mode 100644
index bb2cfb52531..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/cff/cff.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/***************************************************************************/
-/* */
-/* cff.c */
-/* */
-/* FreeType OpenType driver component (body only). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#define FT_MAKE_OPTION_SINGLE_OBJECT
-
-#include <ft2build.h>
-
-#include "cffpic.c"
-#include "cffdrivr.c"
-#include "cffparse.c"
-#include "cffload.c"
-#include "cffobjs.c"
-#include "cffgload.c"
-#include "cffcmap.c"
-
-#include "cf2arrst.c"
-#include "cf2blues.c"
-#include "cf2error.c"
-#include "cf2font.c"
-#include "cf2ft.c"
-#include "cf2hints.c"
-#include "cf2intrp.c"
-#include "cf2read.c"
-#include "cf2stack.c"
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/cff/cffcmap.c b/chromium/third_party/pdfium/third_party/freetype/src/cff/cffcmap.c
deleted file mode 100644
index e7538e98405..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/cff/cffcmap.c
+++ /dev/null
@@ -1,216 +0,0 @@
-/***************************************************************************/
-/* */
-/* cffcmap.c */
-/* */
-/* CFF character mapping table (cmap) support (body). */
-/* */
-/* Copyright 2002-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include "cffcmap.h"
-#include "cffload.h"
-
-#include "cfferrs.h"
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** CFF STANDARD (AND EXPERT) ENCODING CMAPS *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
- FT_CALLBACK_DEF( FT_Error )
- cff_cmap_encoding_init( CFF_CMapStd cmap,
- FT_Pointer pointer )
- {
- TT_Face face = (TT_Face)FT_CMAP_FACE( cmap );
- CFF_Font cff = (CFF_Font)face->extra.data;
- CFF_Encoding encoding = &cff->encoding;
-
- FT_UNUSED( pointer );
-
-
- cmap->gids = encoding->codes;
-
- return 0;
- }
-
-
- FT_CALLBACK_DEF( void )
- cff_cmap_encoding_done( CFF_CMapStd cmap )
- {
- cmap->gids = NULL;
- }
-
-
- FT_CALLBACK_DEF( FT_UInt )
- cff_cmap_encoding_char_index( CFF_CMapStd cmap,
- FT_UInt32 char_code )
- {
- FT_UInt result = 0;
-
-
- if ( char_code < 256 )
- result = cmap->gids[char_code];
-
- return result;
- }
-
-
- FT_CALLBACK_DEF( FT_UInt32 )
- cff_cmap_encoding_char_next( CFF_CMapStd cmap,
- FT_UInt32 *pchar_code )
- {
- FT_UInt result = 0;
- FT_UInt32 char_code = *pchar_code;
-
-
- *pchar_code = 0;
-
- if ( char_code < 255 )
- {
- FT_UInt code = (FT_UInt)(char_code + 1);
-
-
- for (;;)
- {
- if ( code >= 256 )
- break;
-
- result = cmap->gids[code];
- if ( result != 0 )
- {
- *pchar_code = code;
- break;
- }
-
- code++;
- }
- }
- return result;
- }
-
-
- FT_DEFINE_CMAP_CLASS(cff_cmap_encoding_class_rec,
- sizeof ( CFF_CMapStdRec ),
-
- (FT_CMap_InitFunc) cff_cmap_encoding_init,
- (FT_CMap_DoneFunc) cff_cmap_encoding_done,
- (FT_CMap_CharIndexFunc)cff_cmap_encoding_char_index,
- (FT_CMap_CharNextFunc) cff_cmap_encoding_char_next,
-
- NULL, NULL, NULL, NULL, NULL
- )
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** CFF SYNTHETIC UNICODE ENCODING CMAP *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
- FT_CALLBACK_DEF( const char* )
- cff_sid_to_glyph_name( TT_Face face,
- FT_UInt idx )
- {
- CFF_Font cff = (CFF_Font)face->extra.data;
- CFF_Charset charset = &cff->charset;
- FT_UInt sid = charset->sids[idx];
-
-
- return cff_index_get_sid_string( cff, sid );
- }
-
-
- FT_CALLBACK_DEF( FT_Error )
- cff_cmap_unicode_init( PS_Unicodes unicodes,
- FT_Pointer pointer )
- {
- TT_Face face = (TT_Face)FT_CMAP_FACE( unicodes );
- FT_Memory memory = FT_FACE_MEMORY( face );
- CFF_Font cff = (CFF_Font)face->extra.data;
- CFF_Charset charset = &cff->charset;
- FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)cff->psnames;
-
- FT_UNUSED( pointer );
-
-
- /* can't build Unicode map for CID-keyed font */
- /* because we don't know glyph names. */
- if ( !charset->sids )
- return FT_THROW( No_Unicode_Glyph_Name );
-
- return psnames->unicodes_init( memory,
- unicodes,
- cff->num_glyphs,
- (PS_GetGlyphNameFunc)&cff_sid_to_glyph_name,
- (PS_FreeGlyphNameFunc)NULL,
- (FT_Pointer)face );
- }
-
-
- FT_CALLBACK_DEF( void )
- cff_cmap_unicode_done( PS_Unicodes unicodes )
- {
- FT_Face face = FT_CMAP_FACE( unicodes );
- FT_Memory memory = FT_FACE_MEMORY( face );
-
-
- FT_FREE( unicodes->maps );
- unicodes->num_maps = 0;
- }
-
-
- FT_CALLBACK_DEF( FT_UInt )
- cff_cmap_unicode_char_index( PS_Unicodes unicodes,
- FT_UInt32 char_code )
- {
- TT_Face face = (TT_Face)FT_CMAP_FACE( unicodes );
- CFF_Font cff = (CFF_Font)face->extra.data;
- FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)cff->psnames;
-
-
- return psnames->unicodes_char_index( unicodes, char_code );
- }
-
-
- FT_CALLBACK_DEF( FT_UInt32 )
- cff_cmap_unicode_char_next( PS_Unicodes unicodes,
- FT_UInt32 *pchar_code )
- {
- TT_Face face = (TT_Face)FT_CMAP_FACE( unicodes );
- CFF_Font cff = (CFF_Font)face->extra.data;
- FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)cff->psnames;
-
-
- return psnames->unicodes_char_next( unicodes, pchar_code );
- }
-
-
- FT_DEFINE_CMAP_CLASS(cff_cmap_unicode_class_rec,
- sizeof ( PS_UnicodesRec ),
-
- (FT_CMap_InitFunc) cff_cmap_unicode_init,
- (FT_CMap_DoneFunc) cff_cmap_unicode_done,
- (FT_CMap_CharIndexFunc)cff_cmap_unicode_char_index,
- (FT_CMap_CharNextFunc) cff_cmap_unicode_char_next,
-
- NULL, NULL, NULL, NULL, NULL
- )
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/cff/cffcmap.h b/chromium/third_party/pdfium/third_party/freetype/src/cff/cffcmap.h
deleted file mode 100644
index 6eaed636ec0..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/cff/cffcmap.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/***************************************************************************/
-/* */
-/* cffcmap.h */
-/* */
-/* CFF character mapping table (cmap) support (specification). */
-/* */
-/* Copyright 2002-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __CFFCMAP_H__
-#define __CFFCMAP_H__
-
-#include "cffobjs.h"
-
-FT_BEGIN_HEADER
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** TYPE1 STANDARD (AND EXPERT) ENCODING CMAPS *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
- /* standard (and expert) encoding cmaps */
- typedef struct CFF_CMapStdRec_* CFF_CMapStd;
-
- typedef struct CFF_CMapStdRec_
- {
- FT_CMapRec cmap;
- FT_UShort* gids; /* up to 256 elements */
-
- } CFF_CMapStdRec;
-
-
- FT_DECLARE_CMAP_CLASS(cff_cmap_encoding_class_rec)
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** CFF SYNTHETIC UNICODE ENCODING CMAP *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
- /* unicode (synthetic) cmaps */
-
- FT_DECLARE_CMAP_CLASS(cff_cmap_unicode_class_rec)
-
-
-FT_END_HEADER
-
-#endif /* __CFFCMAP_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/cff/cffdrivr.c b/chromium/third_party/pdfium/third_party/freetype/src/cff/cffdrivr.c
deleted file mode 100644
index a718b7a0024..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/cff/cffdrivr.c
+++ /dev/null
@@ -1,907 +0,0 @@
-/***************************************************************************/
-/* */
-/* cffdrivr.c */
-/* */
-/* OpenType font driver implementation (body). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_SFNT_H
-#include FT_SERVICE_CID_H
-#include FT_SERVICE_POSTSCRIPT_INFO_H
-#include FT_SERVICE_POSTSCRIPT_NAME_H
-#include FT_SERVICE_TT_CMAP_H
-
-#include "cffdrivr.h"
-#include "cffgload.h"
-#include "cffload.h"
-#include "cffcmap.h"
-#include "cffparse.h"
-
-#include "cfferrs.h"
-#include "cffpic.h"
-
-#include FT_SERVICE_FONT_FORMAT_H
-#include FT_SERVICE_GLYPH_DICT_H
-#include FT_SERVICE_PROPERTIES_H
-#include FT_CFF_DRIVER_H
-
-
- /*************************************************************************/
- /* */
- /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
- /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
- /* messages during execution. */
- /* */
-#undef FT_COMPONENT
-#define FT_COMPONENT trace_cffdriver
-
-
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
- /**** ****/
- /**** ****/
- /**** F A C E S ****/
- /**** ****/
- /**** ****/
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* cff_get_kerning */
- /* */
- /* <Description> */
- /* A driver method used to return the kerning vector between two */
- /* glyphs of the same face. */
- /* */
- /* <Input> */
- /* face :: A handle to the source face object. */
- /* */
- /* left_glyph :: The index of the left glyph in the kern pair. */
- /* */
- /* right_glyph :: The index of the right glyph in the kern pair. */
- /* */
- /* <Output> */
- /* kerning :: The kerning vector. This is in font units for */
- /* scalable formats, and in pixels for fixed-sizes */
- /* formats. */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. */
- /* */
- /* <Note> */
- /* Only horizontal layouts (left-to-right & right-to-left) are */
- /* supported by this function. Other layouts, or more sophisticated */
- /* kernings, are out of scope of this method (the basic driver */
- /* interface is meant to be simple). */
- /* */
- /* They can be implemented by format-specific interfaces. */
- /* */
- FT_CALLBACK_DEF( FT_Error )
- cff_get_kerning( FT_Face ttface, /* TT_Face */
- FT_UInt left_glyph,
- FT_UInt right_glyph,
- FT_Vector* kerning )
- {
- TT_Face face = (TT_Face)ttface;
- SFNT_Service sfnt = (SFNT_Service)face->sfnt;
-
-
- kerning->x = 0;
- kerning->y = 0;
-
- if ( sfnt )
- kerning->x = sfnt->get_kerning( face, left_glyph, right_glyph );
-
- return FT_Err_Ok;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* cff_glyph_load */
- /* */
- /* <Description> */
- /* A driver method used to load a glyph within a given glyph slot. */
- /* */
- /* <Input> */
- /* slot :: A handle to the target slot object where the glyph */
- /* will be loaded. */
- /* */
- /* size :: A handle to the source face size at which the glyph */
- /* must be scaled, loaded, etc. */
- /* */
- /* glyph_index :: The index of the glyph in the font file. */
- /* */
- /* load_flags :: A flag indicating what to load for this glyph. The */
- /* FT_LOAD_??? constants can be used to control the */
- /* glyph loading process (e.g., whether the outline */
- /* should be scaled, whether to load bitmaps or not, */
- /* whether to hint the outline, etc). */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. */
- /* */
- FT_CALLBACK_DEF( FT_Error )
- cff_glyph_load( FT_GlyphSlot cffslot, /* CFF_GlyphSlot */
- FT_Size cffsize, /* CFF_Size */
- FT_UInt glyph_index,
- FT_Int32 load_flags )
- {
- FT_Error error;
- CFF_GlyphSlot slot = (CFF_GlyphSlot)cffslot;
- CFF_Size size = (CFF_Size)cffsize;
-
-
- if ( !slot )
- return FT_THROW( Invalid_Slot_Handle );
-
- FT_TRACE1(( "cff_glyph_load: glyph index %d\n", glyph_index ));
-
- /* check whether we want a scaled outline or bitmap */
- if ( !size )
- load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING;
-
- /* reset the size object if necessary */
- if ( load_flags & FT_LOAD_NO_SCALE )
- size = NULL;
-
- if ( size )
- {
- /* these two objects must have the same parent */
- if ( cffsize->face != cffslot->face )
- return FT_THROW( Invalid_Face_Handle );
- }
-
- /* now load the glyph outline if necessary */
- error = cff_slot_load( slot, size, glyph_index, load_flags );
-
- /* force drop-out mode to 2 - irrelevant now */
- /* slot->outline.dropout_mode = 2; */
-
- return error;
- }
-
-
- FT_CALLBACK_DEF( FT_Error )
- cff_get_advances( FT_Face face,
- FT_UInt start,
- FT_UInt count,
- FT_Int32 flags,
- FT_Fixed* advances )
- {
- FT_UInt nn;
- FT_Error error = FT_Err_Ok;
- FT_GlyphSlot slot = face->glyph;
-
-
- if ( FT_IS_SFNT( face ) )
- {
- /* OpenType 1.7 mandates that the data from `hmtx' table be used; */
- /* it is no longer necessary that those values are identical to */
- /* the values in the `CFF' table */
-
- TT_Face ttface = (TT_Face)face;
- FT_Short dummy;
-
-
- if ( flags & FT_LOAD_VERTICAL_LAYOUT )
- {
- /* check whether we have data from the `vmtx' table at all; */
- /* otherwise we extract the info from the CFF glyphstrings */
- /* (instead of synthesizing a global value using the `OS/2' */
- /* table) */
- if ( !ttface->vertical_info )
- goto Missing_Table;
-
- for ( nn = 0; nn < count; nn++ )
- {
- FT_UShort ah;
-
-
- ( (SFNT_Service)ttface->sfnt )->get_metrics( ttface,
- 1,
- start + nn,
- &dummy,
- &ah );
-
- FT_TRACE5(( " idx %d: advance height %d font units\n",
- start + nn, ah ));
- advances[nn] = ah;
- }
- }
- else
- {
- /* check whether we have data from the `hmtx' table at all */
- if ( !ttface->horizontal.number_Of_HMetrics )
- goto Missing_Table;
-
- for ( nn = 0; nn < count; nn++ )
- {
- FT_UShort aw;
-
-
- ( (SFNT_Service)ttface->sfnt )->get_metrics( ttface,
- 0,
- start + nn,
- &dummy,
- &aw );
-
- FT_TRACE5(( " idx %d: advance width %d font units\n",
- start + nn, aw ));
- advances[nn] = aw;
- }
- }
-
- return error;
- }
-
- Missing_Table:
- flags |= (FT_UInt32)FT_LOAD_ADVANCE_ONLY;
-
- for ( nn = 0; nn < count; nn++ )
- {
- error = cff_glyph_load( slot, face->size, start + nn, flags );
- if ( error )
- break;
-
- advances[nn] = ( flags & FT_LOAD_VERTICAL_LAYOUT )
- ? slot->linearVertAdvance
- : slot->linearHoriAdvance;
- }
-
- return error;
- }
-
-
- /*
- * GLYPH DICT SERVICE
- *
- */
-
- static FT_Error
- cff_get_glyph_name( CFF_Face face,
- FT_UInt glyph_index,
- FT_Pointer buffer,
- FT_UInt buffer_max )
- {
- CFF_Font font = (CFF_Font)face->extra.data;
- FT_String* gname;
- FT_UShort sid;
- FT_Error error;
-
-
- if ( !font->psnames )
- {
- FT_ERROR(( "cff_get_glyph_name:"
- " cannot get glyph name from CFF & CEF fonts\n"
- " "
- " without the `PSNames' module\n" ));
- error = FT_THROW( Missing_Module );
- goto Exit;
- }
-
- /* first, locate the sid in the charset table */
- sid = font->charset.sids[glyph_index];
-
- /* now, lookup the name itself */
- gname = cff_index_get_sid_string( font, sid );
-
- if ( gname )
- FT_STRCPYN( buffer, gname, buffer_max );
-
- error = FT_Err_Ok;
-
- Exit:
- return error;
- }
-
-
- static FT_UInt
- cff_get_name_index( CFF_Face face,
- FT_String* glyph_name )
- {
- CFF_Font cff;
- CFF_Charset charset;
- FT_Service_PsCMaps psnames;
- FT_String* name;
- FT_UShort sid;
- FT_UInt i;
-
-
- cff = (CFF_FontRec *)face->extra.data;
- charset = &cff->charset;
-
- FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS );
- if ( !psnames )
- return 0;
-
- for ( i = 0; i < cff->num_glyphs; i++ )
- {
- sid = charset->sids[i];
-
- if ( sid > 390 )
- name = cff_index_get_string( cff, sid - 391 );
- else
- name = (FT_String *)psnames->adobe_std_strings( sid );
-
- if ( !name )
- continue;
-
- if ( !ft_strcmp( glyph_name, name ) )
- return i;
- }
-
- return 0;
- }
-
-
- FT_DEFINE_SERVICE_GLYPHDICTREC(
- cff_service_glyph_dict,
- (FT_GlyphDict_GetNameFunc) cff_get_glyph_name,
- (FT_GlyphDict_NameIndexFunc)cff_get_name_index
- )
-
-
- /*
- * POSTSCRIPT INFO SERVICE
- *
- */
-
- static FT_Int
- cff_ps_has_glyph_names( FT_Face face )
- {
- return ( face->face_flags & FT_FACE_FLAG_GLYPH_NAMES ) > 0;
- }
-
-
- static FT_Error
- cff_ps_get_font_info( CFF_Face face,
- PS_FontInfoRec* afont_info )
- {
- CFF_Font cff = (CFF_Font)face->extra.data;
- FT_Error error = FT_Err_Ok;
-
-
- if ( cff && cff->font_info == NULL )
- {
- CFF_FontRecDict dict = &cff->top_font.font_dict;
- PS_FontInfoRec *font_info = NULL;
- FT_Memory memory = face->root.memory;
-
-
- if ( FT_ALLOC( font_info, sizeof ( *font_info ) ) )
- goto Fail;
-
- font_info->version = cff_index_get_sid_string( cff,
- dict->version );
- font_info->notice = cff_index_get_sid_string( cff,
- dict->notice );
- font_info->full_name = cff_index_get_sid_string( cff,
- dict->full_name );
- font_info->family_name = cff_index_get_sid_string( cff,
- dict->family_name );
- font_info->weight = cff_index_get_sid_string( cff,
- dict->weight );
- font_info->italic_angle = dict->italic_angle;
- font_info->is_fixed_pitch = dict->is_fixed_pitch;
- font_info->underline_position = (FT_Short)dict->underline_position;
- font_info->underline_thickness = (FT_UShort)dict->underline_thickness;
-
- cff->font_info = font_info;
- }
-
- if ( cff )
- *afont_info = *cff->font_info;
-
- Fail:
- return error;
- }
-
-
- FT_DEFINE_SERVICE_PSINFOREC(
- cff_service_ps_info,
- (PS_GetFontInfoFunc) cff_ps_get_font_info,
- (PS_GetFontExtraFunc) NULL,
- (PS_HasGlyphNamesFunc) cff_ps_has_glyph_names,
- (PS_GetFontPrivateFunc)NULL, /* unsupported with CFF fonts */
- (PS_GetFontValueFunc) NULL /* not implemented */
- )
-
-
- /*
- * POSTSCRIPT NAME SERVICE
- *
- */
-
- static const char*
- cff_get_ps_name( CFF_Face face )
- {
- CFF_Font cff = (CFF_Font)face->extra.data;
- SFNT_Service sfnt = (SFNT_Service)face->sfnt;
-
-
- /* following the OpenType specification 1.7, we return the name stored */
- /* in the `name' table for a CFF wrapped into an SFNT container */
-
- if ( sfnt )
- {
- FT_Library library = FT_FACE_LIBRARY( face );
- FT_Module sfnt_module = FT_Get_Module( library, "sfnt" );
- FT_Service_PsFontName service =
- (FT_Service_PsFontName)ft_module_get_service(
- sfnt_module,
- FT_SERVICE_ID_POSTSCRIPT_FONT_NAME );
-
-
- if ( service && service->get_ps_font_name )
- return service->get_ps_font_name( FT_FACE( face ) );
- }
-
- return (const char*)cff->font_name;
- }
-
-
- FT_DEFINE_SERVICE_PSFONTNAMEREC(
- cff_service_ps_name,
- (FT_PsName_GetFunc)cff_get_ps_name
- )
-
-
- /*
- * TT CMAP INFO
- *
- * If the charmap is a synthetic Unicode encoding cmap or
- * a Type 1 standard (or expert) encoding cmap, hide TT CMAP INFO
- * service defined in SFNT module.
- *
- * Otherwise call the service function in the sfnt module.
- *
- */
- static FT_Error
- cff_get_cmap_info( FT_CharMap charmap,
- TT_CMapInfo *cmap_info )
- {
- FT_CMap cmap = FT_CMAP( charmap );
- FT_Error error = FT_Err_Ok;
-
- FT_Face face = FT_CMAP_FACE( cmap );
- FT_Library library = FT_FACE_LIBRARY( face );
-
-
- cmap_info->language = 0;
- cmap_info->format = 0;
-
- if ( cmap->clazz != &CFF_CMAP_ENCODING_CLASS_REC_GET &&
- cmap->clazz != &CFF_CMAP_UNICODE_CLASS_REC_GET )
- {
- FT_Module sfnt = FT_Get_Module( library, "sfnt" );
- FT_Service_TTCMaps service =
- (FT_Service_TTCMaps)ft_module_get_service( sfnt,
- FT_SERVICE_ID_TT_CMAP );
-
-
- if ( service && service->get_cmap_info )
- error = service->get_cmap_info( charmap, cmap_info );
- }
-
- return error;
- }
-
-
- FT_DEFINE_SERVICE_TTCMAPSREC(
- cff_service_get_cmap_info,
- (TT_CMap_Info_GetFunc)cff_get_cmap_info
- )
-
-
- /*
- * CID INFO SERVICE
- *
- */
- static FT_Error
- cff_get_ros( CFF_Face face,
- const char* *registry,
- const char* *ordering,
- FT_Int *supplement )
- {
- FT_Error error = FT_Err_Ok;
- CFF_Font cff = (CFF_Font)face->extra.data;
-
-
- if ( cff )
- {
- CFF_FontRecDict dict = &cff->top_font.font_dict;
-
-
- if ( dict->cid_registry == 0xFFFFU )
- {
- error = FT_THROW( Invalid_Argument );
- goto Fail;
- }
-
- if ( registry )
- {
- if ( cff->registry == NULL )
- cff->registry = cff_index_get_sid_string( cff,
- dict->cid_registry );
- *registry = cff->registry;
- }
-
- if ( ordering )
- {
- if ( cff->ordering == NULL )
- cff->ordering = cff_index_get_sid_string( cff,
- dict->cid_ordering );
- *ordering = cff->ordering;
- }
-
- /*
- * XXX: According to Adobe TechNote #5176, the supplement in CFF
- * can be a real number. We truncate it to fit public API
- * since freetype-2.3.6.
- */
- if ( supplement )
- {
- if ( dict->cid_supplement < FT_INT_MIN ||
- dict->cid_supplement > FT_INT_MAX )
- FT_TRACE1(( "cff_get_ros: too large supplement %d is truncated\n",
- dict->cid_supplement ));
- *supplement = (FT_Int)dict->cid_supplement;
- }
- }
-
- Fail:
- return error;
- }
-
-
- static FT_Error
- cff_get_is_cid( CFF_Face face,
- FT_Bool *is_cid )
- {
- FT_Error error = FT_Err_Ok;
- CFF_Font cff = (CFF_Font)face->extra.data;
-
-
- *is_cid = 0;
-
- if ( cff )
- {
- CFF_FontRecDict dict = &cff->top_font.font_dict;
-
-
- if ( dict->cid_registry != 0xFFFFU )
- *is_cid = 1;
- }
-
- return error;
- }
-
-
- static FT_Error
- cff_get_cid_from_glyph_index( CFF_Face face,
- FT_UInt glyph_index,
- FT_UInt *cid )
- {
- FT_Error error = FT_Err_Ok;
- CFF_Font cff;
-
-
- cff = (CFF_Font)face->extra.data;
-
- if ( cff )
- {
- FT_UInt c;
- CFF_FontRecDict dict = &cff->top_font.font_dict;
-
-
- if ( dict->cid_registry == 0xFFFFU )
- {
- error = FT_THROW( Invalid_Argument );
- goto Fail;
- }
-
- if ( glyph_index > cff->num_glyphs )
- {
- error = FT_THROW( Invalid_Argument );
- goto Fail;
- }
-
- c = cff->charset.sids[glyph_index];
-
- if ( cid )
- *cid = c;
- }
-
- Fail:
- return error;
- }
-
-
- FT_DEFINE_SERVICE_CIDREC(
- cff_service_cid_info,
- (FT_CID_GetRegistryOrderingSupplementFunc)cff_get_ros,
- (FT_CID_GetIsInternallyCIDKeyedFunc) cff_get_is_cid,
- (FT_CID_GetCIDFromGlyphIndexFunc) cff_get_cid_from_glyph_index
- )
-
-
- /*
- * PROPERTY SERVICE
- *
- */
- static FT_Error
- cff_property_set( FT_Module module, /* CFF_Driver */
- const char* property_name,
- const void* value )
- {
- FT_Error error = FT_Err_Ok;
- CFF_Driver driver = (CFF_Driver)module;
-
-
- if ( !ft_strcmp( property_name, "darkening-parameters" ) )
- {
- FT_Int* darken_params = (FT_Int*)value;
-
- FT_Int x1 = darken_params[0];
- FT_Int y1 = darken_params[1];
- FT_Int x2 = darken_params[2];
- FT_Int y2 = darken_params[3];
- FT_Int x3 = darken_params[4];
- FT_Int y3 = darken_params[5];
- FT_Int x4 = darken_params[6];
- FT_Int y4 = darken_params[7];
-
-
- if ( x1 < 0 || x2 < 0 || x3 < 0 || x4 < 0 ||
- y1 < 0 || y2 < 0 || y3 < 0 || y4 < 0 ||
- x1 > x2 || x2 > x3 || x3 > x4 ||
- y1 > 500 || y2 > 500 || y3 > 500 || y4 > 500 )
- return FT_THROW( Invalid_Argument );
-
- driver->darken_params[0] = x1;
- driver->darken_params[1] = y1;
- driver->darken_params[2] = x2;
- driver->darken_params[3] = y2;
- driver->darken_params[4] = x3;
- driver->darken_params[5] = y3;
- driver->darken_params[6] = x4;
- driver->darken_params[7] = y4;
-
- return error;
- }
- else if ( !ft_strcmp( property_name, "hinting-engine" ) )
- {
- FT_UInt* hinting_engine = (FT_UInt*)value;
-
-
-#ifndef CFF_CONFIG_OPTION_OLD_ENGINE
- if ( *hinting_engine != FT_CFF_HINTING_ADOBE )
- error = FT_ERR( Unimplemented_Feature );
- else
-#endif
- driver->hinting_engine = *hinting_engine;
-
- return error;
- }
- else if ( !ft_strcmp( property_name, "no-stem-darkening" ) )
- {
- FT_Bool* no_stem_darkening = (FT_Bool*)value;
-
-
- driver->no_stem_darkening = *no_stem_darkening;
-
- return error;
- }
-
- FT_TRACE0(( "cff_property_set: missing property `%s'\n",
- property_name ));
- return FT_THROW( Missing_Property );
- }
-
-
- static FT_Error
- cff_property_get( FT_Module module, /* CFF_Driver */
- const char* property_name,
- const void* value )
- {
- FT_Error error = FT_Err_Ok;
- CFF_Driver driver = (CFF_Driver)module;
-
-
- if ( !ft_strcmp( property_name, "darkening-parameters" ) )
- {
- FT_Int* darken_params = driver->darken_params;
- FT_Int* val = (FT_Int*)value;
-
-
- val[0] = darken_params[0];
- val[1] = darken_params[1];
- val[2] = darken_params[2];
- val[3] = darken_params[3];
- val[4] = darken_params[4];
- val[5] = darken_params[5];
- val[6] = darken_params[6];
- val[7] = darken_params[7];
-
- return error;
- }
- else if ( !ft_strcmp( property_name, "hinting-engine" ) )
- {
- FT_UInt hinting_engine = driver->hinting_engine;
- FT_UInt* val = (FT_UInt*)value;
-
-
- *val = hinting_engine;
-
- return error;
- }
- else if ( !ft_strcmp( property_name, "no-stem-darkening" ) )
- {
- FT_Bool no_stem_darkening = driver->no_stem_darkening;
- FT_Bool* val = (FT_Bool*)value;
-
-
- *val = no_stem_darkening;
-
- return error;
- }
-
- FT_TRACE0(( "cff_property_get: missing property `%s'\n",
- property_name ));
- return FT_THROW( Missing_Property );
- }
-
-
- FT_DEFINE_SERVICE_PROPERTIESREC(
- cff_service_properties,
- (FT_Properties_SetFunc)cff_property_set,
- (FT_Properties_GetFunc)cff_property_get )
-
-
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
- /**** ****/
- /**** ****/
- /**** D R I V E R I N T E R F A C E ****/
- /**** ****/
- /**** ****/
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
-
-#ifndef FT_CONFIG_OPTION_NO_GLYPH_NAMES
- FT_DEFINE_SERVICEDESCREC7(
- cff_services,
- FT_SERVICE_ID_FONT_FORMAT, FT_FONT_FORMAT_CFF,
- FT_SERVICE_ID_POSTSCRIPT_INFO, &CFF_SERVICE_PS_INFO_GET,
- FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &CFF_SERVICE_PS_NAME_GET,
- FT_SERVICE_ID_GLYPH_DICT, &CFF_SERVICE_GLYPH_DICT_GET,
- FT_SERVICE_ID_TT_CMAP, &CFF_SERVICE_GET_CMAP_INFO_GET,
- FT_SERVICE_ID_CID, &CFF_SERVICE_CID_INFO_GET,
- FT_SERVICE_ID_PROPERTIES, &CFF_SERVICE_PROPERTIES_GET
- )
-#else
- FT_DEFINE_SERVICEDESCREC6(
- cff_services,
- FT_SERVICE_ID_FONT_FORMAT, FT_FONT_FORMAT_CFF,
- FT_SERVICE_ID_POSTSCRIPT_INFO, &CFF_SERVICE_PS_INFO_GET,
- FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &CFF_SERVICE_PS_NAME_GET,
- FT_SERVICE_ID_TT_CMAP, &CFF_SERVICE_GET_CMAP_INFO_GET,
- FT_SERVICE_ID_CID, &CFF_SERVICE_CID_INFO_GET,
- FT_SERVICE_ID_PROPERTIES, &CFF_SERVICE_PROPERTIES_GET
- )
-#endif
-
-
- FT_CALLBACK_DEF( FT_Module_Interface )
- cff_get_interface( FT_Module driver, /* CFF_Driver */
- const char* module_interface )
- {
- FT_Library library;
- FT_Module sfnt;
- FT_Module_Interface result;
-
-
- /* CFF_SERVICES_GET dereferences `library' in PIC mode */
-#ifdef FT_CONFIG_OPTION_PIC
- if ( !driver )
- return NULL;
- library = driver->library;
- if ( !library )
- return NULL;
-#endif
-
- result = ft_service_list_lookup( CFF_SERVICES_GET, module_interface );
- if ( result != NULL )
- return result;
-
- /* `driver' is not yet evaluated in non-PIC mode */
-#ifndef FT_CONFIG_OPTION_PIC
- if ( !driver )
- return NULL;
- library = driver->library;
- if ( !library )
- return NULL;
-#endif
-
- /* we pass our request to the `sfnt' module */
- sfnt = FT_Get_Module( library, "sfnt" );
-
- return sfnt ? sfnt->clazz->get_interface( sfnt, module_interface ) : 0;
- }
-
-
- /* The FT_DriverInterface structure is defined in ftdriver.h. */
-
-#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
-#define CFF_SIZE_SELECT cff_size_select
-#else
-#define CFF_SIZE_SELECT 0
-#endif
-
- FT_DEFINE_DRIVER(
- cff_driver_class,
-
- FT_MODULE_FONT_DRIVER |
- FT_MODULE_DRIVER_SCALABLE |
- FT_MODULE_DRIVER_HAS_HINTER,
-
- sizeof ( CFF_DriverRec ),
- "cff",
- 0x10000L,
- 0x20000L,
-
- 0, /* module-specific interface */
-
- cff_driver_init,
- cff_driver_done,
- cff_get_interface,
-
- /* now the specific driver fields */
- sizeof ( TT_FaceRec ),
- sizeof ( CFF_SizeRec ),
- sizeof ( CFF_GlyphSlotRec ),
-
- cff_face_init,
- cff_face_done,
- cff_size_init,
- cff_size_done,
- cff_slot_init,
- cff_slot_done,
-
- cff_glyph_load,
-
- cff_get_kerning,
- 0, /* FT_Face_AttachFunc */
- cff_get_advances,
-
- cff_size_request,
-
- CFF_SIZE_SELECT
- )
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/cff/cffdrivr.h b/chromium/third_party/pdfium/third_party/freetype/src/cff/cffdrivr.h
deleted file mode 100644
index 9527f5e1495..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/cff/cffdrivr.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/***************************************************************************/
-/* */
-/* cffdrivr.h */
-/* */
-/* High-level OpenType driver interface (specification). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __CFFDRIVER_H__
-#define __CFFDRIVER_H__
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_DRIVER_H
-
-
-FT_BEGIN_HEADER
-
-
- FT_DECLARE_DRIVER( cff_driver_class )
-
-
-FT_END_HEADER
-
-#endif /* __CFFDRIVER_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/cff/cfferrs.h b/chromium/third_party/pdfium/third_party/freetype/src/cff/cfferrs.h
deleted file mode 100644
index 543bdb07c23..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/cff/cfferrs.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/***************************************************************************/
-/* */
-/* cfferrs.h */
-/* */
-/* CFF error codes (specification only). */
-/* */
-/* Copyright 2001-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* This file is used to define the CFF error enumeration constants. */
- /* */
- /*************************************************************************/
-
-#ifndef __CFFERRS_H__
-#define __CFFERRS_H__
-
-#include FT_MODULE_ERRORS_H
-
-#undef __FTERRORS_H__
-
-#undef FT_ERR_PREFIX
-#define FT_ERR_PREFIX CFF_Err_
-#define FT_ERR_BASE FT_Mod_Err_CFF
-
-
-#include FT_ERRORS_H
-
-#endif /* __CFFERRS_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/cff/cffgload.c b/chromium/third_party/pdfium/third_party/freetype/src/cff/cffgload.c
deleted file mode 100644
index 5f57403e22a..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/cff/cffgload.c
+++ /dev/null
@@ -1,3086 +0,0 @@
-/***************************************************************************/
-/* */
-/* cffgload.c */
-/* */
-/* OpenType Glyph Loader (body). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_SFNT_H
-#include FT_OUTLINE_H
-#include FT_CFF_DRIVER_H
-
-#include "cffobjs.h"
-#include "cffload.h"
-#include "cffgload.h"
-#include "cf2ft.h" /* for cf2_decoder_parse_charstrings */
-
-#include "cfferrs.h"
-
-
- /*************************************************************************/
- /* */
- /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
- /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
- /* messages during execution. */
- /* */
-#undef FT_COMPONENT
-#define FT_COMPONENT trace_cffgload
-
-
-#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
-
- typedef enum CFF_Operator_
- {
- cff_op_unknown = 0,
-
- cff_op_rmoveto,
- cff_op_hmoveto,
- cff_op_vmoveto,
-
- cff_op_rlineto,
- cff_op_hlineto,
- cff_op_vlineto,
-
- cff_op_rrcurveto,
- cff_op_hhcurveto,
- cff_op_hvcurveto,
- cff_op_rcurveline,
- cff_op_rlinecurve,
- cff_op_vhcurveto,
- cff_op_vvcurveto,
-
- cff_op_flex,
- cff_op_hflex,
- cff_op_hflex1,
- cff_op_flex1,
-
- cff_op_endchar,
-
- cff_op_hstem,
- cff_op_vstem,
- cff_op_hstemhm,
- cff_op_vstemhm,
-
- cff_op_hintmask,
- cff_op_cntrmask,
- cff_op_dotsection, /* deprecated, acts as no-op */
-
- cff_op_abs,
- cff_op_add,
- cff_op_sub,
- cff_op_div,
- cff_op_neg,
- cff_op_random,
- cff_op_mul,
- cff_op_sqrt,
-
- cff_op_blend,
-
- cff_op_drop,
- cff_op_exch,
- cff_op_index,
- cff_op_roll,
- cff_op_dup,
-
- cff_op_put,
- cff_op_get,
- cff_op_store,
- cff_op_load,
-
- cff_op_and,
- cff_op_or,
- cff_op_not,
- cff_op_eq,
- cff_op_ifelse,
-
- cff_op_callsubr,
- cff_op_callgsubr,
- cff_op_return,
-
- /* Type 1 opcodes: invalid but seen in real life */
- cff_op_hsbw,
- cff_op_closepath,
- cff_op_callothersubr,
- cff_op_pop,
- cff_op_seac,
- cff_op_sbw,
- cff_op_setcurrentpoint,
-
- /* do not remove */
- cff_op_max
-
- } CFF_Operator;
-
-
-#define CFF_COUNT_CHECK_WIDTH 0x80
-#define CFF_COUNT_EXACT 0x40
-#define CFF_COUNT_CLEAR_STACK 0x20
-
- /* count values which have the `CFF_COUNT_CHECK_WIDTH' flag set are */
- /* used for checking the width and requested numbers of arguments */
- /* only; they are set to zero afterwards */
-
- /* the other two flags are informative only and unused currently */
-
- static const FT_Byte cff_argument_counts[] =
- {
- 0, /* unknown */
-
- 2 | CFF_COUNT_CHECK_WIDTH | CFF_COUNT_EXACT, /* rmoveto */
- 1 | CFF_COUNT_CHECK_WIDTH | CFF_COUNT_EXACT,
- 1 | CFF_COUNT_CHECK_WIDTH | CFF_COUNT_EXACT,
-
- 0 | CFF_COUNT_CLEAR_STACK, /* rlineto */
- 0 | CFF_COUNT_CLEAR_STACK,
- 0 | CFF_COUNT_CLEAR_STACK,
-
- 0 | CFF_COUNT_CLEAR_STACK, /* rrcurveto */
- 0 | CFF_COUNT_CLEAR_STACK,
- 0 | CFF_COUNT_CLEAR_STACK,
- 0 | CFF_COUNT_CLEAR_STACK,
- 0 | CFF_COUNT_CLEAR_STACK,
- 0 | CFF_COUNT_CLEAR_STACK,
- 0 | CFF_COUNT_CLEAR_STACK,
-
- 13, /* flex */
- 7,
- 9,
- 11,
-
- 0 | CFF_COUNT_CHECK_WIDTH, /* endchar */
-
- 2 | CFF_COUNT_CHECK_WIDTH, /* hstem */
- 2 | CFF_COUNT_CHECK_WIDTH,
- 2 | CFF_COUNT_CHECK_WIDTH,
- 2 | CFF_COUNT_CHECK_WIDTH,
-
- 0 | CFF_COUNT_CHECK_WIDTH, /* hintmask */
- 0 | CFF_COUNT_CHECK_WIDTH, /* cntrmask */
- 0, /* dotsection */
-
- 1, /* abs */
- 2,
- 2,
- 2,
- 1,
- 0,
- 2,
- 1,
-
- 1, /* blend */
-
- 1, /* drop */
- 2,
- 1,
- 2,
- 1,
-
- 2, /* put */
- 1,
- 4,
- 3,
-
- 2, /* and */
- 2,
- 1,
- 2,
- 4,
-
- 1, /* callsubr */
- 1,
- 0,
-
- 2, /* hsbw */
- 0,
- 0,
- 0,
- 5, /* seac */
- 4, /* sbw */
- 2 /* setcurrentpoint */
- };
-
-#endif /* CFF_CONFIG_OPTION_OLD_ENGINE */
-
-
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
- /********** *********/
- /********** *********/
- /********** GENERIC CHARSTRING PARSING *********/
- /********** *********/
- /********** *********/
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* cff_builder_init */
- /* */
- /* <Description> */
- /* Initializes a given glyph builder. */
- /* */
- /* <InOut> */
- /* builder :: A pointer to the glyph builder to initialize. */
- /* */
- /* <Input> */
- /* face :: The current face object. */
- /* */
- /* size :: The current size object. */
- /* */
- /* glyph :: The current glyph object. */
- /* */
- /* hinting :: Whether hinting is active. */
- /* */
- static void
- cff_builder_init( CFF_Builder* builder,
- TT_Face face,
- CFF_Size size,
- CFF_GlyphSlot glyph,
- FT_Bool hinting )
- {
- builder->path_begun = 0;
- builder->load_points = 1;
-
- builder->face = face;
- builder->glyph = glyph;
- builder->memory = face->root.memory;
-
- if ( glyph )
- {
- FT_GlyphLoader loader = glyph->root.internal->loader;
-
-
- builder->loader = loader;
- builder->base = &loader->base.outline;
- builder->current = &loader->current.outline;
- FT_GlyphLoader_Rewind( loader );
-
- builder->hints_globals = NULL;
- builder->hints_funcs = NULL;
-
- if ( hinting && size )
- {
- CFF_Internal internal = (CFF_Internal)size->root.internal;
-
-
- builder->hints_globals = (void *)internal->topfont;
- builder->hints_funcs = glyph->root.internal->glyph_hints;
- }
- }
-
- builder->pos_x = 0;
- builder->pos_y = 0;
-
- builder->left_bearing.x = 0;
- builder->left_bearing.y = 0;
- builder->advance.x = 0;
- builder->advance.y = 0;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* cff_builder_done */
- /* */
- /* <Description> */
- /* Finalizes a given glyph builder. Its contents can still be used */
- /* after the call, but the function saves important information */
- /* within the corresponding glyph slot. */
- /* */
- /* <Input> */
- /* builder :: A pointer to the glyph builder to finalize. */
- /* */
- static void
- cff_builder_done( CFF_Builder* builder )
- {
- CFF_GlyphSlot glyph = builder->glyph;
-
-
- if ( glyph )
- glyph->root.outline = *builder->base;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* cff_compute_bias */
- /* */
- /* <Description> */
- /* Computes the bias value in dependence of the number of glyph */
- /* subroutines. */
- /* */
- /* <Input> */
- /* in_charstring_type :: The `CharstringType' value of the top DICT */
- /* dictionary. */
- /* */
- /* num_subrs :: The number of glyph subroutines. */
- /* */
- /* <Return> */
- /* The bias value. */
- static FT_Int
- cff_compute_bias( FT_Int in_charstring_type,
- FT_UInt num_subrs )
- {
- FT_Int result;
-
-
- if ( in_charstring_type == 1 )
- result = 0;
- else if ( num_subrs < 1240 )
- result = 107;
- else if ( num_subrs < 33900U )
- result = 1131;
- else
- result = 32768U;
-
- return result;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* cff_decoder_init */
- /* */
- /* <Description> */
- /* Initializes a given glyph decoder. */
- /* */
- /* <InOut> */
- /* decoder :: A pointer to the glyph builder to initialize. */
- /* */
- /* <Input> */
- /* face :: The current face object. */
- /* */
- /* size :: The current size object. */
- /* */
- /* slot :: The current glyph object. */
- /* */
- /* hinting :: Whether hinting is active. */
- /* */
- /* hint_mode :: The hinting mode. */
- /* */
- FT_LOCAL_DEF( void )
- cff_decoder_init( CFF_Decoder* decoder,
- TT_Face face,
- CFF_Size size,
- CFF_GlyphSlot slot,
- FT_Bool hinting,
- FT_Render_Mode hint_mode )
- {
- CFF_Font cff = (CFF_Font)face->extra.data;
-
-
- /* clear everything */
- FT_MEM_ZERO( decoder, sizeof ( *decoder ) );
-
- /* initialize builder */
- cff_builder_init( &decoder->builder, face, size, slot, hinting );
-
- /* initialize Type2 decoder */
- decoder->cff = cff;
- decoder->num_globals = cff->global_subrs_index.count;
- decoder->globals = cff->global_subrs;
- decoder->globals_bias = cff_compute_bias(
- cff->top_font.font_dict.charstring_type,
- decoder->num_globals );
-
- decoder->hint_mode = hint_mode;
- }
-
-
- /* this function is used to select the subfont */
- /* and the locals subrs array */
- FT_LOCAL_DEF( FT_Error )
- cff_decoder_prepare( CFF_Decoder* decoder,
- CFF_Size size,
- FT_UInt glyph_index )
- {
- CFF_Builder *builder = &decoder->builder;
- CFF_Font cff = (CFF_Font)builder->face->extra.data;
- CFF_SubFont sub = &cff->top_font;
- FT_Error error = FT_Err_Ok;
-
-
- /* manage CID fonts */
- if ( cff->num_subfonts )
- {
- FT_Byte fd_index = cff_fd_select_get( &cff->fd_select, glyph_index );
-
-
- if ( fd_index >= cff->num_subfonts )
- {
- FT_TRACE4(( "cff_decoder_prepare: invalid CID subfont index\n" ));
- error = FT_THROW( Invalid_File_Format );
- goto Exit;
- }
-
- FT_TRACE3(( " in subfont %d:\n", fd_index ));
-
- sub = cff->subfonts[fd_index];
-
- if ( builder->hints_funcs && size )
- {
- CFF_Internal internal = (CFF_Internal)size->root.internal;
-
-
- /* for CFFs without subfonts, this value has already been set */
- builder->hints_globals = (void *)internal->subfonts[fd_index];
- }
- }
-
- decoder->num_locals = sub->local_subrs_index.count;
- decoder->locals = sub->local_subrs;
- decoder->locals_bias = cff_compute_bias(
- decoder->cff->top_font.font_dict.charstring_type,
- decoder->num_locals );
-
- decoder->glyph_width = sub->private_dict.default_width;
- decoder->nominal_width = sub->private_dict.nominal_width;
-
- decoder->current_subfont = sub; /* for Adobe's CFF handler */
-
- Exit:
- return error;
- }
-
-
- /* check that there is enough space for `count' more points */
- FT_LOCAL_DEF( FT_Error )
- cff_check_points( CFF_Builder* builder,
- FT_Int count )
- {
- return FT_GLYPHLOADER_CHECK_POINTS( builder->loader, count, 0 );
- }
-
-
- /* add a new point, do not check space */
- FT_LOCAL_DEF( void )
- cff_builder_add_point( CFF_Builder* builder,
- FT_Pos x,
- FT_Pos y,
- FT_Byte flag )
- {
- FT_Outline* outline = builder->current;
-
-
- if ( builder->load_points )
- {
- FT_Vector* point = outline->points + outline->n_points;
- FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points;
-
-#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
- CFF_Driver driver = (CFF_Driver)FT_FACE_DRIVER( builder->face );
-
-
- if ( driver->hinting_engine == FT_CFF_HINTING_FREETYPE )
- {
- point->x = x >> 16;
- point->y = y >> 16;
- }
- else
-#endif
- {
- /* cf2_decoder_parse_charstrings uses 16.16 coordinates */
- point->x = x >> 10;
- point->y = y >> 10;
- }
- *control = (FT_Byte)( flag ? FT_CURVE_TAG_ON : FT_CURVE_TAG_CUBIC );
- }
-
- outline->n_points++;
- }
-
-
- /* check space for a new on-curve point, then add it */
- FT_LOCAL_DEF( FT_Error )
- cff_builder_add_point1( CFF_Builder* builder,
- FT_Pos x,
- FT_Pos y )
- {
- FT_Error error;
-
-
- error = cff_check_points( builder, 1 );
- if ( !error )
- cff_builder_add_point( builder, x, y, 1 );
-
- return error;
- }
-
-
- /* check space for a new contour, then add it */
- static FT_Error
- cff_builder_add_contour( CFF_Builder* builder )
- {
- FT_Outline* outline = builder->current;
- FT_Error error;
-
-
- if ( !builder->load_points )
- {
- outline->n_contours++;
- return FT_Err_Ok;
- }
-
- error = FT_GLYPHLOADER_CHECK_POINTS( builder->loader, 0, 1 );
- if ( !error )
- {
- if ( outline->n_contours > 0 )
- outline->contours[outline->n_contours - 1] =
- (short)( outline->n_points - 1 );
-
- outline->n_contours++;
- }
-
- return error;
- }
-
-
- /* if a path was begun, add its first on-curve point */
- FT_LOCAL_DEF( FT_Error )
- cff_builder_start_point( CFF_Builder* builder,
- FT_Pos x,
- FT_Pos y )
- {
- FT_Error error = FT_Err_Ok;
-
-
- /* test whether we are building a new contour */
- if ( !builder->path_begun )
- {
- builder->path_begun = 1;
- error = cff_builder_add_contour( builder );
- if ( !error )
- error = cff_builder_add_point1( builder, x, y );
- }
-
- return error;
- }
-
-
- /* close the current contour */
- FT_LOCAL_DEF( void )
- cff_builder_close_contour( CFF_Builder* builder )
- {
- FT_Outline* outline = builder->current;
- FT_Int first;
-
-
- if ( !outline )
- return;
-
- first = outline->n_contours <= 1
- ? 0 : outline->contours[outline->n_contours - 2] + 1;
-
- /* We must not include the last point in the path if it */
- /* is located on the first point. */
- if ( outline->n_points > 1 )
- {
- FT_Vector* p1 = outline->points + first;
- FT_Vector* p2 = outline->points + outline->n_points - 1;
- FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points - 1;
-
-
- /* `delete' last point only if it coincides with the first */
- /* point and if it is not a control point (which can happen). */
- if ( p1->x == p2->x && p1->y == p2->y )
- if ( *control == FT_CURVE_TAG_ON )
- outline->n_points--;
- }
-
- if ( outline->n_contours > 0 )
- {
- /* Don't add contours only consisting of one point, i.e., */
- /* check whether begin point and last point are the same. */
- if ( first == outline->n_points - 1 )
- {
- outline->n_contours--;
- outline->n_points--;
- }
- else
- outline->contours[outline->n_contours - 1] =
- (short)( outline->n_points - 1 );
- }
- }
-
-
- FT_LOCAL_DEF( FT_Int )
- cff_lookup_glyph_by_stdcharcode( CFF_Font cff,
- FT_Int charcode )
- {
- FT_UInt n;
- FT_UShort glyph_sid;
-
-
- /* CID-keyed fonts don't have glyph names */
- if ( !cff->charset.sids )
- return -1;
-
- /* check range of standard char code */
- if ( charcode < 0 || charcode > 255 )
- return -1;
-
- /* Get code to SID mapping from `cff_standard_encoding'. */
- glyph_sid = cff_get_standard_encoding( (FT_UInt)charcode );
-
- for ( n = 0; n < cff->num_glyphs; n++ )
- {
- if ( cff->charset.sids[n] == glyph_sid )
- return (FT_Int)n;
- }
-
- return -1;
- }
-
-
- FT_LOCAL_DEF( FT_Error )
- cff_get_glyph_data( TT_Face face,
- FT_UInt glyph_index,
- FT_Byte** pointer,
- FT_ULong* length )
- {
-#ifdef FT_CONFIG_OPTION_INCREMENTAL
- /* For incremental fonts get the character data using the */
- /* callback function. */
- if ( face->root.internal->incremental_interface )
- {
- FT_Data data;
- FT_Error error =
- face->root.internal->incremental_interface->funcs->get_glyph_data(
- face->root.internal->incremental_interface->object,
- glyph_index, &data );
-
-
- *pointer = (FT_Byte*)data.pointer;
- *length = (FT_ULong)data.length;
-
- return error;
- }
- else
-#endif /* FT_CONFIG_OPTION_INCREMENTAL */
-
- {
- CFF_Font cff = (CFF_Font)(face->extra.data);
-
-
- return cff_index_access_element( &cff->charstrings_index, glyph_index,
- pointer, length );
- }
- }
-
-
- FT_LOCAL_DEF( void )
- cff_free_glyph_data( TT_Face face,
- FT_Byte** pointer,
- FT_ULong length )
- {
-#ifndef FT_CONFIG_OPTION_INCREMENTAL
- FT_UNUSED( length );
-#endif
-
-#ifdef FT_CONFIG_OPTION_INCREMENTAL
- /* For incremental fonts get the character data using the */
- /* callback function. */
- if ( face->root.internal->incremental_interface )
- {
- FT_Data data;
-
-
- data.pointer = *pointer;
- data.length = (FT_Int)length;
-
- face->root.internal->incremental_interface->funcs->free_glyph_data(
- face->root.internal->incremental_interface->object, &data );
- }
- else
-#endif /* FT_CONFIG_OPTION_INCREMENTAL */
-
- {
- CFF_Font cff = (CFF_Font)(face->extra.data);
-
-
- cff_index_forget_element( &cff->charstrings_index, pointer );
- }
- }
-
-
-#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
-
- static FT_Error
- cff_operator_seac( CFF_Decoder* decoder,
- FT_Pos asb,
- FT_Pos adx,
- FT_Pos ady,
- FT_Int bchar,
- FT_Int achar )
- {
- FT_Error error;
- CFF_Builder* builder = &decoder->builder;
- FT_Int bchar_index, achar_index;
- TT_Face face = decoder->builder.face;
- FT_Vector left_bearing, advance;
- FT_Byte* charstring;
- FT_ULong charstring_len;
- FT_Pos glyph_width;
-
-
- if ( decoder->seac )
- {
- FT_ERROR(( "cff_operator_seac: invalid nested seac\n" ));
- return FT_THROW( Syntax_Error );
- }
-
- adx += decoder->builder.left_bearing.x;
- ady += decoder->builder.left_bearing.y;
-
-#ifdef FT_CONFIG_OPTION_INCREMENTAL
- /* Incremental fonts don't necessarily have valid charsets. */
- /* They use the character code, not the glyph index, in this case. */
- if ( face->root.internal->incremental_interface )
- {
- bchar_index = bchar;
- achar_index = achar;
- }
- else
-#endif /* FT_CONFIG_OPTION_INCREMENTAL */
- {
- CFF_Font cff = (CFF_Font)(face->extra.data);
-
-
- bchar_index = cff_lookup_glyph_by_stdcharcode( cff, bchar );
- achar_index = cff_lookup_glyph_by_stdcharcode( cff, achar );
- }
-
- if ( bchar_index < 0 || achar_index < 0 )
- {
- FT_ERROR(( "cff_operator_seac:"
- " invalid seac character code arguments\n" ));
- return FT_THROW( Syntax_Error );
- }
-
- /* If we are trying to load a composite glyph, do not load the */
- /* accent character and return the array of subglyphs. */
- if ( builder->no_recurse )
- {
- FT_GlyphSlot glyph = (FT_GlyphSlot)builder->glyph;
- FT_GlyphLoader loader = glyph->internal->loader;
- FT_SubGlyph subg;
-
-
- /* reallocate subglyph array if necessary */
- error = FT_GlyphLoader_CheckSubGlyphs( loader, 2 );
- if ( error )
- goto Exit;
-
- subg = loader->current.subglyphs;
-
- /* subglyph 0 = base character */
- subg->index = bchar_index;
- subg->flags = FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES |
- FT_SUBGLYPH_FLAG_USE_MY_METRICS;
- subg->arg1 = 0;
- subg->arg2 = 0;
- subg++;
-
- /* subglyph 1 = accent character */
- subg->index = achar_index;
- subg->flags = FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES;
- subg->arg1 = (FT_Int)( adx >> 16 );
- subg->arg2 = (FT_Int)( ady >> 16 );
-
- /* set up remaining glyph fields */
- glyph->num_subglyphs = 2;
- glyph->subglyphs = loader->base.subglyphs;
- glyph->format = FT_GLYPH_FORMAT_COMPOSITE;
-
- loader->current.num_subglyphs = 2;
- }
-
- FT_GlyphLoader_Prepare( builder->loader );
-
- /* First load `bchar' in builder */
- error = cff_get_glyph_data( face, (FT_UInt)bchar_index,
- &charstring, &charstring_len );
- if ( !error )
- {
- /* the seac operator must not be nested */
- decoder->seac = TRUE;
- error = cff_decoder_parse_charstrings( decoder, charstring,
- charstring_len );
- decoder->seac = FALSE;
-
- cff_free_glyph_data( face, &charstring, charstring_len );
-
- if ( error )
- goto Exit;
- }
-
- /* Save the left bearing, advance and glyph width of the base */
- /* character as they will be erased by the next load. */
-
- left_bearing = builder->left_bearing;
- advance = builder->advance;
- glyph_width = decoder->glyph_width;
-
- builder->left_bearing.x = 0;
- builder->left_bearing.y = 0;
-
- builder->pos_x = adx - asb;
- builder->pos_y = ady;
-
- /* Now load `achar' on top of the base outline. */
- error = cff_get_glyph_data( face, (FT_UInt)achar_index,
- &charstring, &charstring_len );
- if ( !error )
- {
- /* the seac operator must not be nested */
- decoder->seac = TRUE;
- error = cff_decoder_parse_charstrings( decoder, charstring,
- charstring_len );
- decoder->seac = FALSE;
-
- cff_free_glyph_data( face, &charstring, charstring_len );
-
- if ( error )
- goto Exit;
- }
-
- /* Restore the left side bearing, advance and glyph width */
- /* of the base character. */
- builder->left_bearing = left_bearing;
- builder->advance = advance;
- decoder->glyph_width = glyph_width;
-
- builder->pos_x = 0;
- builder->pos_y = 0;
-
- Exit:
- return error;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* cff_decoder_parse_charstrings */
- /* */
- /* <Description> */
- /* Parses a given Type 2 charstrings program. */
- /* */
- /* <InOut> */
- /* decoder :: The current Type 1 decoder. */
- /* */
- /* <Input> */
- /* charstring_base :: The base of the charstring stream. */
- /* */
- /* charstring_len :: The length in bytes of the charstring stream. */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. */
- /* */
- FT_LOCAL_DEF( FT_Error )
- cff_decoder_parse_charstrings( CFF_Decoder* decoder,
- FT_Byte* charstring_base,
- FT_ULong charstring_len )
- {
- FT_Error error;
- CFF_Decoder_Zone* zone;
- FT_Byte* ip;
- FT_Byte* limit;
- CFF_Builder* builder = &decoder->builder;
- FT_Pos x, y;
- FT_Fixed seed;
- FT_Fixed* stack;
- FT_Int charstring_type =
- decoder->cff->top_font.font_dict.charstring_type;
-
- T2_Hints_Funcs hinter;
-
-
- /* set default width */
- decoder->num_hints = 0;
- decoder->read_width = 1;
-
- /* compute random seed from stack address of parameter */
- seed = (FT_Fixed)( ( (FT_Offset)(char*)&seed ^
- (FT_Offset)(char*)&decoder ^
- (FT_Offset)(char*)&charstring_base ) &
- FT_ULONG_MAX );
- seed = ( seed ^ ( seed >> 10 ) ^ ( seed >> 20 ) ) & 0xFFFFL;
- if ( seed == 0 )
- seed = 0x7384;
-
- /* initialize the decoder */
- decoder->top = decoder->stack;
- decoder->zone = decoder->zones;
- zone = decoder->zones;
- stack = decoder->top;
-
- hinter = (T2_Hints_Funcs)builder->hints_funcs;
-
- builder->path_begun = 0;
-
- zone->base = charstring_base;
- limit = zone->limit = charstring_base + charstring_len;
- ip = zone->cursor = zone->base;
-
- error = FT_Err_Ok;
-
- x = builder->pos_x;
- y = builder->pos_y;
-
- /* begin hints recording session, if any */
- if ( hinter )
- hinter->open( hinter->hints );
-
- /* now execute loop */
- while ( ip < limit )
- {
- CFF_Operator op;
- FT_Byte v;
-
-
- /********************************************************************/
- /* */
- /* Decode operator or operand */
- /* */
- v = *ip++;
- if ( v >= 32 || v == 28 )
- {
- FT_Int shift = 16;
- FT_Int32 val;
-
-
- /* this is an operand, push it on the stack */
-
- /* if we use shifts, all computations are done with unsigned */
- /* values; the conversion to a signed value is the last step */
- if ( v == 28 )
- {
- if ( ip + 1 >= limit )
- goto Syntax_Error;
- val = (FT_Short)( ( (FT_UShort)ip[0] << 8 ) | ip[1] );
- ip += 2;
- }
- else if ( v < 247 )
- val = (FT_Int32)v - 139;
- else if ( v < 251 )
- {
- if ( ip >= limit )
- goto Syntax_Error;
- val = ( (FT_Int32)v - 247 ) * 256 + *ip++ + 108;
- }
- else if ( v < 255 )
- {
- if ( ip >= limit )
- goto Syntax_Error;
- val = -( (FT_Int32)v - 251 ) * 256 - *ip++ - 108;
- }
- else
- {
- if ( ip + 3 >= limit )
- goto Syntax_Error;
- val = (FT_Int32)( ( (FT_UInt32)ip[0] << 24 ) |
- ( (FT_UInt32)ip[1] << 16 ) |
- ( (FT_UInt32)ip[2] << 8 ) |
- (FT_UInt32)ip[3] );
- ip += 4;
- if ( charstring_type == 2 )
- shift = 0;
- }
- if ( decoder->top - stack >= CFF_MAX_OPERANDS )
- goto Stack_Overflow;
-
- val = (FT_Int32)( (FT_UInt32)val << shift );
- *decoder->top++ = val;
-
-#ifdef FT_DEBUG_LEVEL_TRACE
- if ( !( val & 0xFFFFL ) )
- FT_TRACE4(( " %hd", (FT_Short)( (FT_UInt32)val >> 16 ) ));
- else
- FT_TRACE4(( " %.2f", val / 65536.0 ));
-#endif
-
- }
- else
- {
- /* The specification says that normally arguments are to be taken */
- /* from the bottom of the stack. However, this seems not to be */
- /* correct, at least for Acroread 7.0.8 on GNU/Linux: It pops the */
- /* arguments similar to a PS interpreter. */
-
- FT_Fixed* args = decoder->top;
- FT_Int num_args = (FT_Int)( args - decoder->stack );
- FT_Int req_args;
-
-
- /* find operator */
- op = cff_op_unknown;
-
- switch ( v )
- {
- case 1:
- op = cff_op_hstem;
- break;
- case 3:
- op = cff_op_vstem;
- break;
- case 4:
- op = cff_op_vmoveto;
- break;
- case 5:
- op = cff_op_rlineto;
- break;
- case 6:
- op = cff_op_hlineto;
- break;
- case 7:
- op = cff_op_vlineto;
- break;
- case 8:
- op = cff_op_rrcurveto;
- break;
- case 9:
- op = cff_op_closepath;
- break;
- case 10:
- op = cff_op_callsubr;
- break;
- case 11:
- op = cff_op_return;
- break;
- case 12:
- {
- if ( ip >= limit )
- goto Syntax_Error;
- v = *ip++;
-
- switch ( v )
- {
- case 0:
- op = cff_op_dotsection;
- break;
- case 1: /* this is actually the Type1 vstem3 operator */
- op = cff_op_vstem;
- break;
- case 2: /* this is actually the Type1 hstem3 operator */
- op = cff_op_hstem;
- break;
- case 3:
- op = cff_op_and;
- break;
- case 4:
- op = cff_op_or;
- break;
- case 5:
- op = cff_op_not;
- break;
- case 6:
- op = cff_op_seac;
- break;
- case 7:
- op = cff_op_sbw;
- break;
- case 8:
- op = cff_op_store;
- break;
- case 9:
- op = cff_op_abs;
- break;
- case 10:
- op = cff_op_add;
- break;
- case 11:
- op = cff_op_sub;
- break;
- case 12:
- op = cff_op_div;
- break;
- case 13:
- op = cff_op_load;
- break;
- case 14:
- op = cff_op_neg;
- break;
- case 15:
- op = cff_op_eq;
- break;
- case 16:
- op = cff_op_callothersubr;
- break;
- case 17:
- op = cff_op_pop;
- break;
- case 18:
- op = cff_op_drop;
- break;
- case 20:
- op = cff_op_put;
- break;
- case 21:
- op = cff_op_get;
- break;
- case 22:
- op = cff_op_ifelse;
- break;
- case 23:
- op = cff_op_random;
- break;
- case 24:
- op = cff_op_mul;
- break;
- case 26:
- op = cff_op_sqrt;
- break;
- case 27:
- op = cff_op_dup;
- break;
- case 28:
- op = cff_op_exch;
- break;
- case 29:
- op = cff_op_index;
- break;
- case 30:
- op = cff_op_roll;
- break;
- case 33:
- op = cff_op_setcurrentpoint;
- break;
- case 34:
- op = cff_op_hflex;
- break;
- case 35:
- op = cff_op_flex;
- break;
- case 36:
- op = cff_op_hflex1;
- break;
- case 37:
- op = cff_op_flex1;
- break;
- default:
- FT_TRACE4(( " unknown op (12, %d)\n", v ));
- break;
- }
- }
- break;
- case 13:
- op = cff_op_hsbw;
- break;
- case 14:
- op = cff_op_endchar;
- break;
- case 16:
- op = cff_op_blend;
- break;
- case 18:
- op = cff_op_hstemhm;
- break;
- case 19:
- op = cff_op_hintmask;
- break;
- case 20:
- op = cff_op_cntrmask;
- break;
- case 21:
- op = cff_op_rmoveto;
- break;
- case 22:
- op = cff_op_hmoveto;
- break;
- case 23:
- op = cff_op_vstemhm;
- break;
- case 24:
- op = cff_op_rcurveline;
- break;
- case 25:
- op = cff_op_rlinecurve;
- break;
- case 26:
- op = cff_op_vvcurveto;
- break;
- case 27:
- op = cff_op_hhcurveto;
- break;
- case 29:
- op = cff_op_callgsubr;
- break;
- case 30:
- op = cff_op_vhcurveto;
- break;
- case 31:
- op = cff_op_hvcurveto;
- break;
- default:
- FT_TRACE4(( " unknown op (%d)\n", v ));
- break;
- }
-
- if ( op == cff_op_unknown )
- continue;
-
- /* check arguments */
- req_args = cff_argument_counts[op];
- if ( req_args & CFF_COUNT_CHECK_WIDTH )
- {
- if ( num_args > 0 && decoder->read_width )
- {
- /* If `nominal_width' is non-zero, the number is really a */
- /* difference against `nominal_width'. Else, the number here */
- /* is truly a width, not a difference against `nominal_width'. */
- /* If the font does not set `nominal_width', then */
- /* `nominal_width' defaults to zero, and so we can set */
- /* `glyph_width' to `nominal_width' plus number on the stack */
- /* -- for either case. */
-
- FT_Int set_width_ok;
-
-
- switch ( op )
- {
- case cff_op_hmoveto:
- case cff_op_vmoveto:
- set_width_ok = num_args & 2;
- break;
-
- case cff_op_hstem:
- case cff_op_vstem:
- case cff_op_hstemhm:
- case cff_op_vstemhm:
- case cff_op_rmoveto:
- case cff_op_hintmask:
- case cff_op_cntrmask:
- set_width_ok = num_args & 1;
- break;
-
- case cff_op_endchar:
- /* If there is a width specified for endchar, we either have */
- /* 1 argument or 5 arguments. We like to argue. */
- set_width_ok = ( num_args == 5 ) || ( num_args == 1 );
- break;
-
- default:
- set_width_ok = 0;
- break;
- }
-
- if ( set_width_ok )
- {
- decoder->glyph_width = decoder->nominal_width +
- ( stack[0] >> 16 );
-
- if ( decoder->width_only )
- {
- /* we only want the advance width; stop here */
- break;
- }
-
- /* Consumed an argument. */
- num_args--;
- }
- }
-
- decoder->read_width = 0;
- req_args = 0;
- }
-
- req_args &= 0x000F;
- if ( num_args < req_args )
- goto Stack_Underflow;
- args -= req_args;
- num_args -= req_args;
-
- /* At this point, `args' points to the first argument of the */
- /* operand in case `req_args' isn't zero. Otherwise, we have */
- /* to adjust `args' manually. */
-
- /* Note that we only pop arguments from the stack which we */
- /* really need and can digest so that we can continue in case */
- /* of superfluous stack elements. */
-
- switch ( op )
- {
- case cff_op_hstem:
- case cff_op_vstem:
- case cff_op_hstemhm:
- case cff_op_vstemhm:
- /* the number of arguments is always even here */
- FT_TRACE4((
- op == cff_op_hstem ? " hstem\n" :
- ( op == cff_op_vstem ? " vstem\n" :
- ( op == cff_op_hstemhm ? " hstemhm\n" : " vstemhm\n" ) ) ));
-
- if ( hinter )
- hinter->stems( hinter->hints,
- ( op == cff_op_hstem || op == cff_op_hstemhm ),
- num_args / 2,
- args - ( num_args & ~1 ) );
-
- decoder->num_hints += num_args / 2;
- args = stack;
- break;
-
- case cff_op_hintmask:
- case cff_op_cntrmask:
- FT_TRACE4(( op == cff_op_hintmask ? " hintmask" : " cntrmask" ));
-
- /* implement vstem when needed -- */
- /* the specification doesn't say it, but this also works */
- /* with the 'cntrmask' operator */
- /* */
- if ( num_args > 0 )
- {
- if ( hinter )
- hinter->stems( hinter->hints,
- 0,
- num_args / 2,
- args - ( num_args & ~1 ) );
-
- decoder->num_hints += num_args / 2;
- }
-
- /* In a valid charstring there must be at least one byte */
- /* after `hintmask' or `cntrmask' (e.g., for a `return' */
- /* instruction). Additionally, there must be space for */
- /* `num_hints' bits. */
-
- if ( ( ip + ( ( decoder->num_hints + 7 ) >> 3 ) ) >= limit )
- goto Syntax_Error;
-
- if ( hinter )
- {
- if ( op == cff_op_hintmask )
- hinter->hintmask( hinter->hints,
- (FT_UInt)builder->current->n_points,
- (FT_UInt)decoder->num_hints,
- ip );
- else
- hinter->counter( hinter->hints,
- (FT_UInt)decoder->num_hints,
- ip );
- }
-
-#ifdef FT_DEBUG_LEVEL_TRACE
- {
- FT_UInt maskbyte;
-
-
- FT_TRACE4(( " (maskbytes:" ));
-
- for ( maskbyte = 0;
- maskbyte < (FT_UInt)( ( decoder->num_hints + 7 ) >> 3 );
- maskbyte++, ip++ )
- FT_TRACE4(( " 0x%02X", *ip ));
-
- FT_TRACE4(( ")\n" ));
- }
-#else
- ip += ( decoder->num_hints + 7 ) >> 3;
-#endif
- args = stack;
- break;
-
- case cff_op_rmoveto:
- FT_TRACE4(( " rmoveto\n" ));
-
- cff_builder_close_contour( builder );
- builder->path_begun = 0;
- x += args[-2];
- y += args[-1];
- args = stack;
- break;
-
- case cff_op_vmoveto:
- FT_TRACE4(( " vmoveto\n" ));
-
- cff_builder_close_contour( builder );
- builder->path_begun = 0;
- y += args[-1];
- args = stack;
- break;
-
- case cff_op_hmoveto:
- FT_TRACE4(( " hmoveto\n" ));
-
- cff_builder_close_contour( builder );
- builder->path_begun = 0;
- x += args[-1];
- args = stack;
- break;
-
- case cff_op_rlineto:
- FT_TRACE4(( " rlineto\n" ));
-
- if ( cff_builder_start_point( builder, x, y ) ||
- cff_check_points( builder, num_args / 2 ) )
- goto Fail;
-
- if ( num_args < 2 )
- goto Stack_Underflow;
-
- args -= num_args & ~1;
- while ( args < decoder->top )
- {
- x += args[0];
- y += args[1];
- cff_builder_add_point( builder, x, y, 1 );
- args += 2;
- }
- args = stack;
- break;
-
- case cff_op_hlineto:
- case cff_op_vlineto:
- {
- FT_Int phase = ( op == cff_op_hlineto );
-
-
- FT_TRACE4(( op == cff_op_hlineto ? " hlineto\n"
- : " vlineto\n" ));
-
- if ( num_args < 0 )
- goto Stack_Underflow;
-
- /* there exist subsetted fonts (found in PDFs) */
- /* which call `hlineto' without arguments */
- if ( num_args == 0 )
- break;
-
- if ( cff_builder_start_point( builder, x, y ) ||
- cff_check_points( builder, num_args ) )
- goto Fail;
-
- args = stack;
- while ( args < decoder->top )
- {
- if ( phase )
- x += args[0];
- else
- y += args[0];
-
- if ( cff_builder_add_point1( builder, x, y ) )
- goto Fail;
-
- args++;
- phase ^= 1;
- }
- args = stack;
- }
- break;
-
- case cff_op_rrcurveto:
- {
- FT_Int nargs;
-
-
- FT_TRACE4(( " rrcurveto\n" ));
-
- if ( num_args < 6 )
- goto Stack_Underflow;
-
- nargs = num_args - num_args % 6;
-
- if ( cff_builder_start_point( builder, x, y ) ||
- cff_check_points( builder, nargs / 2 ) )
- goto Fail;
-
- args -= nargs;
- while ( args < decoder->top )
- {
- x += args[0];
- y += args[1];
- cff_builder_add_point( builder, x, y, 0 );
- x += args[2];
- y += args[3];
- cff_builder_add_point( builder, x, y, 0 );
- x += args[4];
- y += args[5];
- cff_builder_add_point( builder, x, y, 1 );
- args += 6;
- }
- args = stack;
- }
- break;
-
- case cff_op_vvcurveto:
- {
- FT_Int nargs;
-
-
- FT_TRACE4(( " vvcurveto\n" ));
-
- if ( num_args < 4 )
- goto Stack_Underflow;
-
- /* if num_args isn't of the form 4n or 4n+1, */
- /* we enforce it by clearing the second bit */
-
- nargs = num_args & ~2;
-
- if ( cff_builder_start_point( builder, x, y ) )
- goto Fail;
-
- args -= nargs;
-
- if ( nargs & 1 )
- {
- x += args[0];
- args++;
- nargs--;
- }
-
- if ( cff_check_points( builder, 3 * ( nargs / 4 ) ) )
- goto Fail;
-
- while ( args < decoder->top )
- {
- y += args[0];
- cff_builder_add_point( builder, x, y, 0 );
- x += args[1];
- y += args[2];
- cff_builder_add_point( builder, x, y, 0 );
- y += args[3];
- cff_builder_add_point( builder, x, y, 1 );
- args += 4;
- }
- args = stack;
- }
- break;
-
- case cff_op_hhcurveto:
- {
- FT_Int nargs;
-
-
- FT_TRACE4(( " hhcurveto\n" ));
-
- if ( num_args < 4 )
- goto Stack_Underflow;
-
- /* if num_args isn't of the form 4n or 4n+1, */
- /* we enforce it by clearing the second bit */
-
- nargs = num_args & ~2;
-
- if ( cff_builder_start_point( builder, x, y ) )
- goto Fail;
-
- args -= nargs;
- if ( nargs & 1 )
- {
- y += args[0];
- args++;
- nargs--;
- }
-
- if ( cff_check_points( builder, 3 * ( nargs / 4 ) ) )
- goto Fail;
-
- while ( args < decoder->top )
- {
- x += args[0];
- cff_builder_add_point( builder, x, y, 0 );
- x += args[1];
- y += args[2];
- cff_builder_add_point( builder, x, y, 0 );
- x += args[3];
- cff_builder_add_point( builder, x, y, 1 );
- args += 4;
- }
- args = stack;
- }
- break;
-
- case cff_op_vhcurveto:
- case cff_op_hvcurveto:
- {
- FT_Int phase;
- FT_Int nargs;
-
-
- FT_TRACE4(( op == cff_op_vhcurveto ? " vhcurveto\n"
- : " hvcurveto\n" ));
-
- if ( cff_builder_start_point( builder, x, y ) )
- goto Fail;
-
- if ( num_args < 4 )
- goto Stack_Underflow;
-
- /* if num_args isn't of the form 8n, 8n+1, 8n+4, or 8n+5, */
- /* we enforce it by clearing the second bit */
-
- nargs = num_args & ~2;
-
- args -= nargs;
- if ( cff_check_points( builder, ( nargs / 4 ) * 3 ) )
- goto Stack_Underflow;
-
- phase = ( op == cff_op_hvcurveto );
-
- while ( nargs >= 4 )
- {
- nargs -= 4;
- if ( phase )
- {
- x += args[0];
- cff_builder_add_point( builder, x, y, 0 );
- x += args[1];
- y += args[2];
- cff_builder_add_point( builder, x, y, 0 );
- y += args[3];
- if ( nargs == 1 )
- x += args[4];
- cff_builder_add_point( builder, x, y, 1 );
- }
- else
- {
- y += args[0];
- cff_builder_add_point( builder, x, y, 0 );
- x += args[1];
- y += args[2];
- cff_builder_add_point( builder, x, y, 0 );
- x += args[3];
- if ( nargs == 1 )
- y += args[4];
- cff_builder_add_point( builder, x, y, 1 );
- }
- args += 4;
- phase ^= 1;
- }
- args = stack;
- }
- break;
-
- case cff_op_rlinecurve:
- {
- FT_Int num_lines;
- FT_Int nargs;
-
-
- FT_TRACE4(( " rlinecurve\n" ));
-
- if ( num_args < 8 )
- goto Stack_Underflow;
-
- nargs = num_args & ~1;
- num_lines = ( nargs - 6 ) / 2;
-
- if ( cff_builder_start_point( builder, x, y ) ||
- cff_check_points( builder, num_lines + 3 ) )
- goto Fail;
-
- args -= nargs;
-
- /* first, add the line segments */
- while ( num_lines > 0 )
- {
- x += args[0];
- y += args[1];
- cff_builder_add_point( builder, x, y, 1 );
- args += 2;
- num_lines--;
- }
-
- /* then the curve */
- x += args[0];
- y += args[1];
- cff_builder_add_point( builder, x, y, 0 );
- x += args[2];
- y += args[3];
- cff_builder_add_point( builder, x, y, 0 );
- x += args[4];
- y += args[5];
- cff_builder_add_point( builder, x, y, 1 );
- args = stack;
- }
- break;
-
- case cff_op_rcurveline:
- {
- FT_Int num_curves;
- FT_Int nargs;
-
-
- FT_TRACE4(( " rcurveline\n" ));
-
- if ( num_args < 8 )
- goto Stack_Underflow;
-
- nargs = num_args - 2;
- nargs = nargs - nargs % 6 + 2;
- num_curves = ( nargs - 2 ) / 6;
-
- if ( cff_builder_start_point( builder, x, y ) ||
- cff_check_points( builder, num_curves * 3 + 2 ) )
- goto Fail;
-
- args -= nargs;
-
- /* first, add the curves */
- while ( num_curves > 0 )
- {
- x += args[0];
- y += args[1];
- cff_builder_add_point( builder, x, y, 0 );
- x += args[2];
- y += args[3];
- cff_builder_add_point( builder, x, y, 0 );
- x += args[4];
- y += args[5];
- cff_builder_add_point( builder, x, y, 1 );
- args += 6;
- num_curves--;
- }
-
- /* then the final line */
- x += args[0];
- y += args[1];
- cff_builder_add_point( builder, x, y, 1 );
- args = stack;
- }
- break;
-
- case cff_op_hflex1:
- {
- FT_Pos start_y;
-
-
- FT_TRACE4(( " hflex1\n" ));
-
- /* adding five more points: 4 control points, 1 on-curve point */
- /* -- make sure we have enough space for the start point if it */
- /* needs to be added */
- if ( cff_builder_start_point( builder, x, y ) ||
- cff_check_points( builder, 6 ) )
- goto Fail;
-
- /* record the starting point's y position for later use */
- start_y = y;
-
- /* first control point */
- x += args[0];
- y += args[1];
- cff_builder_add_point( builder, x, y, 0 );
-
- /* second control point */
- x += args[2];
- y += args[3];
- cff_builder_add_point( builder, x, y, 0 );
-
- /* join point; on curve, with y-value the same as the last */
- /* control point's y-value */
- x += args[4];
- cff_builder_add_point( builder, x, y, 1 );
-
- /* third control point, with y-value the same as the join */
- /* point's y-value */
- x += args[5];
- cff_builder_add_point( builder, x, y, 0 );
-
- /* fourth control point */
- x += args[6];
- y += args[7];
- cff_builder_add_point( builder, x, y, 0 );
-
- /* ending point, with y-value the same as the start */
- x += args[8];
- y = start_y;
- cff_builder_add_point( builder, x, y, 1 );
-
- args = stack;
- break;
- }
-
- case cff_op_hflex:
- {
- FT_Pos start_y;
-
-
- FT_TRACE4(( " hflex\n" ));
-
- /* adding six more points; 4 control points, 2 on-curve points */
- if ( cff_builder_start_point( builder, x, y ) ||
- cff_check_points( builder, 6 ) )
- goto Fail;
-
- /* record the starting point's y-position for later use */
- start_y = y;
-
- /* first control point */
- x += args[0];
- cff_builder_add_point( builder, x, y, 0 );
-
- /* second control point */
- x += args[1];
- y += args[2];
- cff_builder_add_point( builder, x, y, 0 );
-
- /* join point; on curve, with y-value the same as the last */
- /* control point's y-value */
- x += args[3];
- cff_builder_add_point( builder, x, y, 1 );
-
- /* third control point, with y-value the same as the join */
- /* point's y-value */
- x += args[4];
- cff_builder_add_point( builder, x, y, 0 );
-
- /* fourth control point */
- x += args[5];
- y = start_y;
- cff_builder_add_point( builder, x, y, 0 );
-
- /* ending point, with y-value the same as the start point's */
- /* y-value -- we don't add this point, though */
- x += args[6];
- cff_builder_add_point( builder, x, y, 1 );
-
- args = stack;
- break;
- }
-
- case cff_op_flex1:
- {
- FT_Pos start_x, start_y; /* record start x, y values for */
- /* alter use */
- FT_Fixed dx = 0, dy = 0; /* used in horizontal/vertical */
- /* algorithm below */
- FT_Int horizontal, count;
- FT_Fixed* temp;
-
-
- FT_TRACE4(( " flex1\n" ));
-
- /* adding six more points; 4 control points, 2 on-curve points */
- if ( cff_builder_start_point( builder, x, y ) ||
- cff_check_points( builder, 6 ) )
- goto Fail;
-
- /* record the starting point's x, y position for later use */
- start_x = x;
- start_y = y;
-
- /* XXX: figure out whether this is supposed to be a horizontal */
- /* or vertical flex; the Type 2 specification is vague... */
-
- temp = args;
-
- /* grab up to the last argument */
- for ( count = 5; count > 0; count-- )
- {
- dx += temp[0];
- dy += temp[1];
- temp += 2;
- }
-
- if ( dx < 0 )
- dx = -dx;
- if ( dy < 0 )
- dy = -dy;
-
- /* strange test, but here it is... */
- horizontal = ( dx > dy );
-
- for ( count = 5; count > 0; count-- )
- {
- x += args[0];
- y += args[1];
- cff_builder_add_point( builder, x, y,
- (FT_Bool)( count == 3 ) );
- args += 2;
- }
-
- /* is last operand an x- or y-delta? */
- if ( horizontal )
- {
- x += args[0];
- y = start_y;
- }
- else
- {
- x = start_x;
- y += args[0];
- }
-
- cff_builder_add_point( builder, x, y, 1 );
-
- args = stack;
- break;
- }
-
- case cff_op_flex:
- {
- FT_UInt count;
-
-
- FT_TRACE4(( " flex\n" ));
-
- if ( cff_builder_start_point( builder, x, y ) ||
- cff_check_points( builder, 6 ) )
- goto Fail;
-
- for ( count = 6; count > 0; count-- )
- {
- x += args[0];
- y += args[1];
- cff_builder_add_point( builder, x, y,
- (FT_Bool)( count == 4 || count == 1 ) );
- args += 2;
- }
-
- args = stack;
- }
- break;
-
- case cff_op_seac:
- FT_TRACE4(( " seac\n" ));
-
- error = cff_operator_seac( decoder,
- args[0], args[1], args[2],
- (FT_Int)( args[3] >> 16 ),
- (FT_Int)( args[4] >> 16 ) );
-
- /* add current outline to the glyph slot */
- FT_GlyphLoader_Add( builder->loader );
-
- /* return now! */
- FT_TRACE4(( "\n" ));
- return error;
-
- case cff_op_endchar:
- FT_TRACE4(( " endchar\n" ));
-
- /* We are going to emulate the seac operator. */
- if ( num_args >= 4 )
- {
- /* Save glyph width so that the subglyphs don't overwrite it. */
- FT_Pos glyph_width = decoder->glyph_width;
-
-
- error = cff_operator_seac( decoder,
- 0L, args[-4], args[-3],
- (FT_Int)( args[-2] >> 16 ),
- (FT_Int)( args[-1] >> 16 ) );
-
- decoder->glyph_width = glyph_width;
- }
- else
- {
- cff_builder_close_contour( builder );
-
- /* close hints recording session */
- if ( hinter )
- {
- if ( hinter->close( hinter->hints,
- (FT_UInt)builder->current->n_points ) )
- goto Syntax_Error;
-
- /* apply hints to the loaded glyph outline now */
- error = hinter->apply( hinter->hints,
- builder->current,
- (PSH_Globals)builder->hints_globals,
- decoder->hint_mode );
- if ( error )
- goto Fail;
- }
-
- /* add current outline to the glyph slot */
- FT_GlyphLoader_Add( builder->loader );
- }
-
- /* return now! */
- FT_TRACE4(( "\n" ));
- return error;
-
- case cff_op_abs:
- FT_TRACE4(( " abs\n" ));
-
- if ( args[0] < 0 )
- args[0] = -args[0];
- args++;
- break;
-
- case cff_op_add:
- FT_TRACE4(( " add\n" ));
-
- args[0] += args[1];
- args++;
- break;
-
- case cff_op_sub:
- FT_TRACE4(( " sub\n" ));
-
- args[0] -= args[1];
- args++;
- break;
-
- case cff_op_div:
- FT_TRACE4(( " div\n" ));
-
- args[0] = FT_DivFix( args[0], args[1] );
- args++;
- break;
-
- case cff_op_neg:
- FT_TRACE4(( " neg\n" ));
-
- args[0] = -args[0];
- args++;
- break;
-
- case cff_op_random:
- {
- FT_Fixed Rand;
-
-
- FT_TRACE4(( " rand\n" ));
-
- Rand = seed;
- if ( Rand >= 0x8000L )
- Rand++;
-
- args[0] = Rand;
- seed = FT_MulFix( seed, 0x10000L - seed );
- if ( seed == 0 )
- seed += 0x2873;
- args++;
- }
- break;
-
- case cff_op_mul:
- FT_TRACE4(( " mul\n" ));
-
- args[0] = FT_MulFix( args[0], args[1] );
- args++;
- break;
-
- case cff_op_sqrt:
- FT_TRACE4(( " sqrt\n" ));
-
- if ( args[0] > 0 )
- {
- FT_Int count = 9;
- FT_Fixed root = args[0];
- FT_Fixed new_root;
-
-
- for (;;)
- {
- new_root = ( root + FT_DivFix( args[0], root ) + 1 ) >> 1;
- if ( new_root == root || count <= 0 )
- break;
- root = new_root;
- }
- args[0] = new_root;
- }
- else
- args[0] = 0;
- args++;
- break;
-
- case cff_op_drop:
- /* nothing */
- FT_TRACE4(( " drop\n" ));
-
- break;
-
- case cff_op_exch:
- {
- FT_Fixed tmp;
-
-
- FT_TRACE4(( " exch\n" ));
-
- tmp = args[0];
- args[0] = args[1];
- args[1] = tmp;
- args += 2;
- }
- break;
-
- case cff_op_index:
- {
- FT_Int idx = (FT_Int)( args[0] >> 16 );
-
-
- FT_TRACE4(( " index\n" ));
-
- if ( idx < 0 )
- idx = 0;
- else if ( idx > num_args - 2 )
- idx = num_args - 2;
- args[0] = args[-( idx + 1 )];
- args++;
- }
- break;
-
- case cff_op_roll:
- {
- FT_Int count = (FT_Int)( args[0] >> 16 );
- FT_Int idx = (FT_Int)( args[1] >> 16 );
-
-
- FT_TRACE4(( " roll\n" ));
-
- if ( count <= 0 )
- count = 1;
-
- args -= count;
- if ( args < stack )
- goto Stack_Underflow;
-
- if ( idx >= 0 )
- {
- while ( idx > 0 )
- {
- FT_Fixed tmp = args[count - 1];
- FT_Int i;
-
-
- for ( i = count - 2; i >= 0; i-- )
- args[i + 1] = args[i];
- args[0] = tmp;
- idx--;
- }
- }
- else
- {
- while ( idx < 0 )
- {
- FT_Fixed tmp = args[0];
- FT_Int i;
-
-
- for ( i = 0; i < count - 1; i++ )
- args[i] = args[i + 1];
- args[count - 1] = tmp;
- idx++;
- }
- }
- args += count;
- }
- break;
-
- case cff_op_dup:
- FT_TRACE4(( " dup\n" ));
-
- args[1] = args[0];
- args += 2;
- break;
-
- case cff_op_put:
- {
- FT_Fixed val = args[0];
- FT_Int idx = (FT_Int)( args[1] >> 16 );
-
-
- FT_TRACE4(( " put\n" ));
-
- if ( idx >= 0 && idx < CFF_MAX_TRANS_ELEMENTS )
- decoder->buildchar[idx] = val;
- }
- break;
-
- case cff_op_get:
- {
- FT_Int idx = (FT_Int)( args[0] >> 16 );
- FT_Fixed val = 0;
-
-
- FT_TRACE4(( " get\n" ));
-
- if ( idx >= 0 && idx < CFF_MAX_TRANS_ELEMENTS )
- val = decoder->buildchar[idx];
-
- args[0] = val;
- args++;
- }
- break;
-
- case cff_op_store:
- FT_TRACE4(( " store\n"));
-
- goto Unimplemented;
-
- case cff_op_load:
- FT_TRACE4(( " load\n" ));
-
- goto Unimplemented;
-
- case cff_op_dotsection:
- /* this operator is deprecated and ignored by the parser */
- FT_TRACE4(( " dotsection\n" ));
- break;
-
- case cff_op_closepath:
- /* this is an invalid Type 2 operator; however, there */
- /* exist fonts which are incorrectly converted from probably */
- /* Type 1 to CFF, and some parsers seem to accept it */
-
- FT_TRACE4(( " closepath (invalid op)\n" ));
-
- args = stack;
- break;
-
- case cff_op_hsbw:
- /* this is an invalid Type 2 operator; however, there */
- /* exist fonts which are incorrectly converted from probably */
- /* Type 1 to CFF, and some parsers seem to accept it */
-
- FT_TRACE4(( " hsbw (invalid op)\n" ));
-
- decoder->glyph_width = decoder->nominal_width + ( args[1] >> 16 );
-
- decoder->builder.left_bearing.x = args[0];
- decoder->builder.left_bearing.y = 0;
-
- x = decoder->builder.pos_x + args[0];
- y = decoder->builder.pos_y;
- args = stack;
- break;
-
- case cff_op_sbw:
- /* this is an invalid Type 2 operator; however, there */
- /* exist fonts which are incorrectly converted from probably */
- /* Type 1 to CFF, and some parsers seem to accept it */
-
- FT_TRACE4(( " sbw (invalid op)\n" ));
-
- decoder->glyph_width = decoder->nominal_width + ( args[2] >> 16 );
-
- decoder->builder.left_bearing.x = args[0];
- decoder->builder.left_bearing.y = args[1];
-
- x = decoder->builder.pos_x + args[0];
- y = decoder->builder.pos_y + args[1];
- args = stack;
- break;
-
- case cff_op_setcurrentpoint:
- /* this is an invalid Type 2 operator; however, there */
- /* exist fonts which are incorrectly converted from probably */
- /* Type 1 to CFF, and some parsers seem to accept it */
-
- FT_TRACE4(( " setcurrentpoint (invalid op)\n" ));
-
- x = decoder->builder.pos_x + args[0];
- y = decoder->builder.pos_y + args[1];
- args = stack;
- break;
-
- case cff_op_callothersubr:
- /* this is an invalid Type 2 operator; however, there */
- /* exist fonts which are incorrectly converted from probably */
- /* Type 1 to CFF, and some parsers seem to accept it */
-
- FT_TRACE4(( " callothersubr (invalid op)\n" ));
-
- /* subsequent `pop' operands should add the arguments, */
- /* this is the implementation described for `unknown' other */
- /* subroutines in the Type1 spec. */
- /* */
- /* XXX Fix return arguments (see discussion below). */
- args -= 2 + ( args[-2] >> 16 );
- if ( args < stack )
- goto Stack_Underflow;
- break;
-
- case cff_op_pop:
- /* this is an invalid Type 2 operator; however, there */
- /* exist fonts which are incorrectly converted from probably */
- /* Type 1 to CFF, and some parsers seem to accept it */
-
- FT_TRACE4(( " pop (invalid op)\n" ));
-
- /* XXX Increasing `args' is wrong: After a certain number of */
- /* `pop's we get a stack overflow. Reason for doing it is */
- /* code like this (actually found in a CFF font): */
- /* */
- /* 17 1 3 callothersubr */
- /* pop */
- /* callsubr */
- /* */
- /* Since we handle `callothersubr' as a no-op, and */
- /* `callsubr' needs at least one argument, `pop' can't be a */
- /* no-op too as it basically should be. */
- /* */
- /* The right solution would be to provide real support for */
- /* `callothersubr' as done in `t1decode.c', however, given */
- /* the fact that CFF fonts with `pop' are invalid, it is */
- /* questionable whether it is worth the time. */
- args++;
- break;
-
- case cff_op_and:
- {
- FT_Fixed cond = args[0] && args[1];
-
-
- FT_TRACE4(( " and\n" ));
-
- args[0] = cond ? 0x10000L : 0;
- args++;
- }
- break;
-
- case cff_op_or:
- {
- FT_Fixed cond = args[0] || args[1];
-
-
- FT_TRACE4(( " or\n" ));
-
- args[0] = cond ? 0x10000L : 0;
- args++;
- }
- break;
-
- case cff_op_eq:
- {
- FT_Fixed cond = !args[0];
-
-
- FT_TRACE4(( " eq\n" ));
-
- args[0] = cond ? 0x10000L : 0;
- args++;
- }
- break;
-
- case cff_op_ifelse:
- {
- FT_Fixed cond = ( args[2] <= args[3] );
-
-
- FT_TRACE4(( " ifelse\n" ));
-
- if ( !cond )
- args[0] = args[1];
- args++;
- }
- break;
-
- case cff_op_callsubr:
- {
- FT_UInt idx = (FT_UInt)( ( args[0] >> 16 ) +
- decoder->locals_bias );
-
-
- FT_TRACE4(( " callsubr (idx %d, entering level %d)\n",
- idx,
- zone - decoder->zones + 1 ));
-
- if ( idx >= decoder->num_locals )
- {
- FT_ERROR(( "cff_decoder_parse_charstrings:"
- " invalid local subr index\n" ));
- goto Syntax_Error;
- }
-
- if ( zone - decoder->zones >= CFF_MAX_SUBRS_CALLS )
- {
- FT_ERROR(( "cff_decoder_parse_charstrings:"
- " too many nested subrs\n" ));
- goto Syntax_Error;
- }
-
- zone->cursor = ip; /* save current instruction pointer */
-
- zone++;
- zone->base = decoder->locals[idx];
- zone->limit = decoder->locals[idx + 1];
- zone->cursor = zone->base;
-
- if ( !zone->base || zone->limit == zone->base )
- {
- FT_ERROR(( "cff_decoder_parse_charstrings:"
- " invoking empty subrs\n" ));
- goto Syntax_Error;
- }
-
- decoder->zone = zone;
- ip = zone->base;
- limit = zone->limit;
- }
- break;
-
- case cff_op_callgsubr:
- {
- FT_UInt idx = (FT_UInt)( ( args[0] >> 16 ) +
- decoder->globals_bias );
-
-
- FT_TRACE4(( " callgsubr (idx %d, entering level %d)\n",
- idx,
- zone - decoder->zones + 1 ));
-
- if ( idx >= decoder->num_globals )
- {
- FT_ERROR(( "cff_decoder_parse_charstrings:"
- " invalid global subr index\n" ));
- goto Syntax_Error;
- }
-
- if ( zone - decoder->zones >= CFF_MAX_SUBRS_CALLS )
- {
- FT_ERROR(( "cff_decoder_parse_charstrings:"
- " too many nested subrs\n" ));
- goto Syntax_Error;
- }
-
- zone->cursor = ip; /* save current instruction pointer */
-
- zone++;
- zone->base = decoder->globals[idx];
- zone->limit = decoder->globals[idx + 1];
- zone->cursor = zone->base;
-
- if ( !zone->base || zone->limit == zone->base )
- {
- FT_ERROR(( "cff_decoder_parse_charstrings:"
- " invoking empty subrs\n" ));
- goto Syntax_Error;
- }
-
- decoder->zone = zone;
- ip = zone->base;
- limit = zone->limit;
- }
- break;
-
- case cff_op_return:
- FT_TRACE4(( " return (leaving level %d)\n",
- decoder->zone - decoder->zones ));
-
- if ( decoder->zone <= decoder->zones )
- {
- FT_ERROR(( "cff_decoder_parse_charstrings:"
- " unexpected return\n" ));
- goto Syntax_Error;
- }
-
- decoder->zone--;
- zone = decoder->zone;
- ip = zone->cursor;
- limit = zone->limit;
- break;
-
- default:
- Unimplemented:
- FT_ERROR(( "Unimplemented opcode: %d", ip[-1] ));
-
- if ( ip[-1] == 12 )
- FT_ERROR(( " %d", ip[0] ));
- FT_ERROR(( "\n" ));
-
- return FT_THROW( Unimplemented_Feature );
- }
-
- decoder->top = args;
-
- if ( decoder->top - stack >= CFF_MAX_OPERANDS )
- goto Stack_Overflow;
-
- } /* general operator processing */
-
- } /* while ip < limit */
-
- FT_TRACE4(( "..end..\n\n" ));
-
- Fail:
- return error;
-
- Syntax_Error:
- FT_TRACE4(( "cff_decoder_parse_charstrings: syntax error\n" ));
- return FT_THROW( Invalid_File_Format );
-
- Stack_Underflow:
- FT_TRACE4(( "cff_decoder_parse_charstrings: stack underflow\n" ));
- return FT_THROW( Too_Few_Arguments );
-
- Stack_Overflow:
- FT_TRACE4(( "cff_decoder_parse_charstrings: stack overflow\n" ));
- return FT_THROW( Stack_Overflow );
- }
-
-#endif /* CFF_CONFIG_OPTION_OLD_ENGINE */
-
-
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
- /********** *********/
- /********** *********/
- /********** COMPUTE THE MAXIMUM ADVANCE WIDTH *********/
- /********** *********/
- /********** The following code is in charge of computing *********/
- /********** the maximum advance width of the font. It *********/
- /********** quickly processes each glyph charstring to *********/
- /********** extract the value from either a `sbw' or `seac' *********/
- /********** operator. *********/
- /********** *********/
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
-
-
-#if 0 /* unused until we support pure CFF fonts */
-
-
- FT_LOCAL_DEF( FT_Error )
- cff_compute_max_advance( TT_Face face,
- FT_Int* max_advance )
- {
- FT_Error error = FT_Err_Ok;
- CFF_Decoder decoder;
- FT_Int glyph_index;
- CFF_Font cff = (CFF_Font)face->other;
-
-
- *max_advance = 0;
-
- /* Initialize load decoder */
- cff_decoder_init( &decoder, face, 0, 0, 0, 0 );
-
- decoder.builder.metrics_only = 1;
- decoder.builder.load_points = 0;
-
- /* For each glyph, parse the glyph charstring and extract */
- /* the advance width. */
- for ( glyph_index = 0; glyph_index < face->root.num_glyphs;
- glyph_index++ )
- {
- FT_Byte* charstring;
- FT_ULong charstring_len;
-
-
- /* now get load the unscaled outline */
- error = cff_get_glyph_data( face, glyph_index,
- &charstring, &charstring_len );
- if ( !error )
- {
- error = cff_decoder_prepare( &decoder, size, glyph_index );
- if ( !error )
- error = cff_decoder_parse_charstrings( &decoder,
- charstring,
- charstring_len );
-
- cff_free_glyph_data( face, &charstring, &charstring_len );
- }
-
- /* ignore the error if one has occurred -- skip to next glyph */
- error = FT_Err_Ok;
- }
-
- *max_advance = decoder.builder.advance.x;
-
- return FT_Err_Ok;
- }
-
-
-#endif /* 0 */
-
-
- FT_LOCAL_DEF( FT_Error )
- cff_slot_load( CFF_GlyphSlot glyph,
- CFF_Size size,
- FT_UInt glyph_index,
- FT_Int32 load_flags )
- {
- FT_Error error;
- CFF_Decoder decoder;
- TT_Face face = (TT_Face)glyph->root.face;
- FT_Bool hinting, scaled, force_scaling;
- CFF_Font cff = (CFF_Font)face->extra.data;
-
- FT_Matrix font_matrix;
- FT_Vector font_offset;
-
-
- force_scaling = FALSE;
-
- /* in a CID-keyed font, consider `glyph_index' as a CID and map */
- /* it immediately to the real glyph_index -- if it isn't a */
- /* subsetted font, glyph_indices and CIDs are identical, though */
- if ( cff->top_font.font_dict.cid_registry != 0xFFFFU &&
- cff->charset.cids )
- {
- /* don't handle CID 0 (.notdef) which is directly mapped to GID 0 */
- if ( glyph_index != 0 )
- {
- glyph_index = cff_charset_cid_to_gindex( &cff->charset,
- glyph_index );
- if ( glyph_index == 0 )
- return FT_THROW( Invalid_Argument );
- }
- }
- else if ( glyph_index >= cff->num_glyphs )
- return FT_THROW( Invalid_Argument );
-
- if ( load_flags & FT_LOAD_NO_RECURSE )
- load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING;
-
- glyph->x_scale = 0x10000L;
- glyph->y_scale = 0x10000L;
- if ( size )
- {
- glyph->x_scale = size->root.metrics.x_scale;
- glyph->y_scale = size->root.metrics.y_scale;
- }
-
-#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
-
- /* try to load embedded bitmap if any */
- /* */
- /* XXX: The convention should be emphasized in */
- /* the documents because it can be confusing. */
- if ( size )
- {
- CFF_Face cff_face = (CFF_Face)size->root.face;
- SFNT_Service sfnt = (SFNT_Service)cff_face->sfnt;
- FT_Stream stream = cff_face->root.stream;
-
-
- if ( size->strike_index != 0xFFFFFFFFUL &&
- sfnt->load_eblc &&
- ( load_flags & FT_LOAD_NO_BITMAP ) == 0 )
- {
- TT_SBit_MetricsRec metrics;
-
-
- error = sfnt->load_sbit_image( face,
- size->strike_index,
- glyph_index,
- (FT_UInt)load_flags,
- stream,
- &glyph->root.bitmap,
- &metrics );
-
- if ( !error )
- {
- FT_Bool has_vertical_info;
- FT_UShort advance;
- FT_Short dummy;
-
-
- glyph->root.outline.n_points = 0;
- glyph->root.outline.n_contours = 0;
-
- glyph->root.metrics.width = (FT_Pos)metrics.width << 6;
- glyph->root.metrics.height = (FT_Pos)metrics.height << 6;
-
- glyph->root.metrics.horiBearingX = (FT_Pos)metrics.horiBearingX << 6;
- glyph->root.metrics.horiBearingY = (FT_Pos)metrics.horiBearingY << 6;
- glyph->root.metrics.horiAdvance = (FT_Pos)metrics.horiAdvance << 6;
-
- glyph->root.metrics.vertBearingX = (FT_Pos)metrics.vertBearingX << 6;
- glyph->root.metrics.vertBearingY = (FT_Pos)metrics.vertBearingY << 6;
- glyph->root.metrics.vertAdvance = (FT_Pos)metrics.vertAdvance << 6;
-
- glyph->root.format = FT_GLYPH_FORMAT_BITMAP;
-
- if ( load_flags & FT_LOAD_VERTICAL_LAYOUT )
- {
- glyph->root.bitmap_left = metrics.vertBearingX;
- glyph->root.bitmap_top = metrics.vertBearingY;
- }
- else
- {
- glyph->root.bitmap_left = metrics.horiBearingX;
- glyph->root.bitmap_top = metrics.horiBearingY;
- }
-
- /* compute linear advance widths */
-
- (void)( (SFNT_Service)face->sfnt )->get_metrics( face, 0,
- glyph_index,
- &dummy,
- &advance );
- glyph->root.linearHoriAdvance = advance;
-
- has_vertical_info = FT_BOOL(
- face->vertical_info &&
- face->vertical.number_Of_VMetrics > 0 );
-
- /* get the vertical metrics from the vmtx table if we have one */
- if ( has_vertical_info )
- {
- (void)( (SFNT_Service)face->sfnt )->get_metrics( face, 1,
- glyph_index,
- &dummy,
- &advance );
- glyph->root.linearVertAdvance = advance;
- }
- else
- {
- /* make up vertical ones */
- if ( face->os2.version != 0xFFFFU )
- glyph->root.linearVertAdvance = (FT_Pos)
- ( face->os2.sTypoAscender - face->os2.sTypoDescender );
- else
- glyph->root.linearVertAdvance = (FT_Pos)
- ( face->horizontal.Ascender - face->horizontal.Descender );
- }
-
- return error;
- }
- }
- }
-
-#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
-
- /* return immediately if we only want the embedded bitmaps */
- if ( load_flags & FT_LOAD_SBITS_ONLY )
- return FT_THROW( Invalid_Argument );
-
- /* if we have a CID subfont, use its matrix (which has already */
- /* been multiplied with the root matrix) */
-
- /* this scaling is only relevant if the PS hinter isn't active */
- if ( cff->num_subfonts )
- {
- FT_Long top_upm, sub_upm;
- FT_Byte fd_index = cff_fd_select_get( &cff->fd_select,
- glyph_index );
-
-
- if ( fd_index >= cff->num_subfonts )
- fd_index = (FT_Byte)( cff->num_subfonts - 1 );
-
- top_upm = (FT_Long)cff->top_font.font_dict.units_per_em;
- sub_upm = (FT_Long)cff->subfonts[fd_index]->font_dict.units_per_em;
-
-
- font_matrix = cff->subfonts[fd_index]->font_dict.font_matrix;
- font_offset = cff->subfonts[fd_index]->font_dict.font_offset;
-
- if ( top_upm != sub_upm )
- {
- glyph->x_scale = FT_MulDiv( glyph->x_scale, top_upm, sub_upm );
- glyph->y_scale = FT_MulDiv( glyph->y_scale, top_upm, sub_upm );
-
- force_scaling = TRUE;
- }
- }
- else
- {
- font_matrix = cff->top_font.font_dict.font_matrix;
- font_offset = cff->top_font.font_dict.font_offset;
- }
-
- glyph->root.outline.n_points = 0;
- glyph->root.outline.n_contours = 0;
-
- /* top-level code ensures that FT_LOAD_NO_HINTING is set */
- /* if FT_LOAD_NO_SCALE is active */
- hinting = FT_BOOL( ( load_flags & FT_LOAD_NO_HINTING ) == 0 );
- scaled = FT_BOOL( ( load_flags & FT_LOAD_NO_SCALE ) == 0 );
-
- glyph->hint = hinting;
- glyph->scaled = scaled;
- glyph->root.format = FT_GLYPH_FORMAT_OUTLINE; /* by default */
-
- {
-#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
- CFF_Driver driver = (CFF_Driver)FT_FACE_DRIVER( face );
-#endif
-
-
- FT_Byte* charstring;
- FT_ULong charstring_len;
-
-
- cff_decoder_init( &decoder, face, size, glyph, hinting,
- FT_LOAD_TARGET_MODE( load_flags ) );
-
- if ( load_flags & FT_LOAD_ADVANCE_ONLY )
- decoder.width_only = TRUE;
-
- decoder.builder.no_recurse =
- (FT_Bool)( load_flags & FT_LOAD_NO_RECURSE );
-
- /* now load the unscaled outline */
- error = cff_get_glyph_data( face, glyph_index,
- &charstring, &charstring_len );
- if ( error )
- goto Glyph_Build_Finished;
-
- error = cff_decoder_prepare( &decoder, size, glyph_index );
- if ( error )
- goto Glyph_Build_Finished;
-
-#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
- /* choose which CFF renderer to use */
- if ( driver->hinting_engine == FT_CFF_HINTING_FREETYPE )
- error = cff_decoder_parse_charstrings( &decoder,
- charstring,
- charstring_len );
- else
-#endif
- {
- error = cf2_decoder_parse_charstrings( &decoder,
- charstring,
- charstring_len );
-
- /* Adobe's engine uses 16.16 numbers everywhere; */
- /* as a consequence, glyphs larger than 2000ppem get rejected */
- if ( FT_ERR_EQ( error, Glyph_Too_Big ) )
- {
- /* this time, we retry unhinted and scale up the glyph later on */
- /* (the engine uses and sets the hardcoded value 0x10000 / 64 = */
- /* 0x400 for both `x_scale' and `y_scale' in this case) */
- hinting = FALSE;
- force_scaling = TRUE;
- glyph->hint = hinting;
-
- error = cf2_decoder_parse_charstrings( &decoder,
- charstring,
- charstring_len );
- }
- }
-
- cff_free_glyph_data( face, &charstring, charstring_len );
-
- if ( error )
- goto Glyph_Build_Finished;
-
-#ifdef FT_CONFIG_OPTION_INCREMENTAL
- /* Control data and length may not be available for incremental */
- /* fonts. */
- if ( face->root.internal->incremental_interface )
- {
- glyph->root.control_data = NULL;
- glyph->root.control_len = 0;
- }
- else
-#endif /* FT_CONFIG_OPTION_INCREMENTAL */
-
- /* We set control_data and control_len if charstrings is loaded. */
- /* See how charstring loads at cff_index_access_element() in */
- /* cffload.c. */
- {
- CFF_Index csindex = &cff->charstrings_index;
-
-
- if ( csindex->offsets )
- {
- glyph->root.control_data = csindex->bytes +
- csindex->offsets[glyph_index] - 1;
- glyph->root.control_len = (FT_Long)charstring_len;
- }
- }
-
- Glyph_Build_Finished:
- /* save new glyph tables, if no error */
- if ( !error )
- cff_builder_done( &decoder.builder );
- /* XXX: anything to do for broken glyph entry? */
- }
-
-#ifdef FT_CONFIG_OPTION_INCREMENTAL
-
- /* Incremental fonts can optionally override the metrics. */
- if ( !error &&
- face->root.internal->incremental_interface &&
- face->root.internal->incremental_interface->funcs->get_glyph_metrics )
- {
- FT_Incremental_MetricsRec metrics;
-
-
- metrics.bearing_x = decoder.builder.left_bearing.x;
- metrics.bearing_y = 0;
- metrics.advance = decoder.builder.advance.x;
- metrics.advance_v = decoder.builder.advance.y;
-
- error = face->root.internal->incremental_interface->funcs->get_glyph_metrics(
- face->root.internal->incremental_interface->object,
- glyph_index, FALSE, &metrics );
-
- decoder.builder.left_bearing.x = metrics.bearing_x;
- decoder.builder.advance.x = metrics.advance;
- decoder.builder.advance.y = metrics.advance_v;
- }
-
-#endif /* FT_CONFIG_OPTION_INCREMENTAL */
-
- if ( !error )
- {
- /* Now, set the metrics -- this is rather simple, as */
- /* the left side bearing is the xMin, and the top side */
- /* bearing the yMax. */
-
- /* For composite glyphs, return only left side bearing and */
- /* advance width. */
- if ( load_flags & FT_LOAD_NO_RECURSE )
- {
- FT_Slot_Internal internal = glyph->root.internal;
-
-
- glyph->root.metrics.horiBearingX = decoder.builder.left_bearing.x;
- glyph->root.metrics.horiAdvance = decoder.glyph_width;
- internal->glyph_matrix = font_matrix;
- internal->glyph_delta = font_offset;
- internal->glyph_transformed = 1;
- }
- else
- {
- FT_BBox cbox;
- FT_Glyph_Metrics* metrics = &glyph->root.metrics;
- FT_Bool has_vertical_info;
-
-
- if ( face->horizontal.number_Of_HMetrics )
- {
- FT_Short horiBearingX = 0;
- FT_UShort horiAdvance = 0;
-
-
- ( (SFNT_Service)face->sfnt )->get_metrics( face, 0,
- glyph_index,
- &horiBearingX,
- &horiAdvance );
- metrics->horiAdvance = horiAdvance;
- metrics->horiBearingX = horiBearingX;
- glyph->root.linearHoriAdvance = horiAdvance;
- }
- else
- {
- /* copy the _unscaled_ advance width */
- metrics->horiAdvance = decoder.glyph_width;
- glyph->root.linearHoriAdvance = decoder.glyph_width;
- }
-
- glyph->root.internal->glyph_transformed = 0;
-
- has_vertical_info = FT_BOOL( face->vertical_info &&
- face->vertical.number_Of_VMetrics > 0 );
-
- /* get the vertical metrics from the vmtx table if we have one */
- if ( has_vertical_info )
- {
- FT_Short vertBearingY = 0;
- FT_UShort vertAdvance = 0;
-
-
- ( (SFNT_Service)face->sfnt )->get_metrics( face, 1,
- glyph_index,
- &vertBearingY,
- &vertAdvance );
- metrics->vertBearingY = vertBearingY;
- metrics->vertAdvance = vertAdvance;
- }
- else
- {
- /* make up vertical ones */
- if ( face->os2.version != 0xFFFFU )
- metrics->vertAdvance = (FT_Pos)( face->os2.sTypoAscender -
- face->os2.sTypoDescender );
- else
- metrics->vertAdvance = (FT_Pos)( face->horizontal.Ascender -
- face->horizontal.Descender );
- }
-
- glyph->root.linearVertAdvance = metrics->vertAdvance;
-
- glyph->root.format = FT_GLYPH_FORMAT_OUTLINE;
-
- glyph->root.outline.flags = 0;
- if ( size && size->root.metrics.y_ppem < 24 )
- glyph->root.outline.flags |= FT_OUTLINE_HIGH_PRECISION;
-
- glyph->root.outline.flags |= FT_OUTLINE_REVERSE_FILL;
-
- /* apply the font matrix, if any */
- if ( font_matrix.xx != 0x10000L || font_matrix.yy != 0x10000L ||
- font_matrix.xy != 0 || font_matrix.yx != 0 )
- {
- FT_Outline_Transform( &glyph->root.outline, &font_matrix );
-
- metrics->horiAdvance = FT_MulFix( metrics->horiAdvance,
- font_matrix.xx );
- metrics->vertAdvance = FT_MulFix( metrics->vertAdvance,
- font_matrix.yy );
- }
-
- if ( font_offset.x || font_offset.y )
- {
- FT_Outline_Translate( &glyph->root.outline,
- font_offset.x,
- font_offset.y );
-
- metrics->horiAdvance += font_offset.x;
- metrics->vertAdvance += font_offset.y;
- }
-
- if ( ( load_flags & FT_LOAD_NO_SCALE ) == 0 || force_scaling )
- {
- /* scale the outline and the metrics */
- FT_Int n;
- FT_Outline* cur = &glyph->root.outline;
- FT_Vector* vec = cur->points;
- FT_Fixed x_scale = glyph->x_scale;
- FT_Fixed y_scale = glyph->y_scale;
-
-
- /* First of all, scale the points */
- if ( !hinting || !decoder.builder.hints_funcs )
- for ( n = cur->n_points; n > 0; n--, vec++ )
- {
- vec->x = FT_MulFix( vec->x, x_scale );
- vec->y = FT_MulFix( vec->y, y_scale );
- }
-
- /* Then scale the metrics */
- metrics->horiAdvance = FT_MulFix( metrics->horiAdvance, x_scale );
- metrics->vertAdvance = FT_MulFix( metrics->vertAdvance, y_scale );
- }
-
- /* compute the other metrics */
- FT_Outline_Get_CBox( &glyph->root.outline, &cbox );
-
- metrics->width = cbox.xMax - cbox.xMin;
- metrics->height = cbox.yMax - cbox.yMin;
-
- metrics->horiBearingX = cbox.xMin;
- metrics->horiBearingY = cbox.yMax;
-
- if ( has_vertical_info )
- metrics->vertBearingX = metrics->horiBearingX -
- metrics->horiAdvance / 2;
- else
- {
- if ( load_flags & FT_LOAD_VERTICAL_LAYOUT )
- ft_synthesize_vertical_metrics( metrics,
- metrics->vertAdvance );
- }
- }
- }
-
- return error;
- }
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/cff/cffgload.h b/chromium/third_party/pdfium/third_party/freetype/src/cff/cffgload.h
deleted file mode 100644
index 5f2655f3d98..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/cff/cffgload.h
+++ /dev/null
@@ -1,245 +0,0 @@
-/***************************************************************************/
-/* */
-/* cffgload.h */
-/* */
-/* OpenType Glyph Loader (specification). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __CFFGLOAD_H__
-#define __CFFGLOAD_H__
-
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include "cffobjs.h"
-
-
-FT_BEGIN_HEADER
-
-
-#define CFF_MAX_OPERANDS 48
-#define CFF_MAX_SUBRS_CALLS 16 /* maximum subroutine nesting; */
- /* only 10 are allowed but there exist */
- /* fonts like `HiraKakuProN-W3.ttf' */
- /* (Hiragino Kaku Gothic ProN W3; */
- /* 8.2d6e1; 2014-12-19) that exceed */
- /* this limit */
-#define CFF_MAX_TRANS_ELEMENTS 32
-
-
- /*************************************************************************/
- /* */
- /* <Structure> */
- /* CFF_Builder */
- /* */
- /* <Description> */
- /* A structure used during glyph loading to store its outline. */
- /* */
- /* <Fields> */
- /* memory :: The current memory object. */
- /* */
- /* face :: The current face object. */
- /* */
- /* glyph :: The current glyph slot. */
- /* */
- /* loader :: The current glyph loader. */
- /* */
- /* base :: The base glyph outline. */
- /* */
- /* current :: The current glyph outline. */
- /* */
- /* pos_x :: The horizontal translation (if composite glyph). */
- /* */
- /* pos_y :: The vertical translation (if composite glyph). */
- /* */
- /* left_bearing :: The left side bearing point. */
- /* */
- /* advance :: The horizontal advance vector. */
- /* */
- /* bbox :: Unused. */
- /* */
- /* path_begun :: A flag which indicates that a new path has begun. */
- /* */
- /* load_points :: If this flag is not set, no points are loaded. */
- /* */
- /* no_recurse :: Set but not used. */
- /* */
- /* metrics_only :: A boolean indicating that we only want to compute */
- /* the metrics of a given glyph, not load all of its */
- /* points. */
- /* */
- /* hints_funcs :: Auxiliary pointer for hinting. */
- /* */
- /* hints_globals :: Auxiliary pointer for hinting. */
- /* */
- typedef struct CFF_Builder_
- {
- FT_Memory memory;
- TT_Face face;
- CFF_GlyphSlot glyph;
- FT_GlyphLoader loader;
- FT_Outline* base;
- FT_Outline* current;
-
- FT_Pos pos_x;
- FT_Pos pos_y;
-
- FT_Vector left_bearing;
- FT_Vector advance;
-
- FT_BBox bbox; /* bounding box */
- FT_Bool path_begun;
- FT_Bool load_points;
- FT_Bool no_recurse;
-
- FT_Bool metrics_only;
-
- void* hints_funcs; /* hinter-specific */
- void* hints_globals; /* hinter-specific */
-
- } CFF_Builder;
-
-
- FT_LOCAL( FT_Error )
- cff_check_points( CFF_Builder* builder,
- FT_Int count );
-
- FT_LOCAL( void )
- cff_builder_add_point( CFF_Builder* builder,
- FT_Pos x,
- FT_Pos y,
- FT_Byte flag );
- FT_LOCAL( FT_Error )
- cff_builder_add_point1( CFF_Builder* builder,
- FT_Pos x,
- FT_Pos y );
- FT_LOCAL( FT_Error )
- cff_builder_start_point( CFF_Builder* builder,
- FT_Pos x,
- FT_Pos y );
- FT_LOCAL( void )
- cff_builder_close_contour( CFF_Builder* builder );
-
-
- FT_LOCAL( FT_Int )
- cff_lookup_glyph_by_stdcharcode( CFF_Font cff,
- FT_Int charcode );
- FT_LOCAL( FT_Error )
- cff_get_glyph_data( TT_Face face,
- FT_UInt glyph_index,
- FT_Byte** pointer,
- FT_ULong* length );
- FT_LOCAL( void )
- cff_free_glyph_data( TT_Face face,
- FT_Byte** pointer,
- FT_ULong length );
-
-
- /* execution context charstring zone */
-
- typedef struct CFF_Decoder_Zone_
- {
- FT_Byte* base;
- FT_Byte* limit;
- FT_Byte* cursor;
-
- } CFF_Decoder_Zone;
-
-
- typedef struct CFF_Decoder_
- {
- CFF_Builder builder;
- CFF_Font cff;
-
- FT_Fixed stack[CFF_MAX_OPERANDS + 1];
- FT_Fixed* top;
-
- CFF_Decoder_Zone zones[CFF_MAX_SUBRS_CALLS + 1];
- CFF_Decoder_Zone* zone;
-
- FT_Int flex_state;
- FT_Int num_flex_vectors;
- FT_Vector flex_vectors[7];
-
- FT_Pos glyph_width;
- FT_Pos nominal_width;
-
- FT_Bool read_width;
- FT_Bool width_only;
- FT_Int num_hints;
- FT_Fixed buildchar[CFF_MAX_TRANS_ELEMENTS];
-
- FT_UInt num_locals;
- FT_UInt num_globals;
-
- FT_Int locals_bias;
- FT_Int globals_bias;
-
- FT_Byte** locals;
- FT_Byte** globals;
-
- FT_Byte** glyph_names; /* for pure CFF fonts only */
- FT_UInt num_glyphs; /* number of glyphs in font */
-
- FT_Render_Mode hint_mode;
-
- FT_Bool seac;
-
- CFF_SubFont current_subfont; /* for current glyph_index */
-
- } CFF_Decoder;
-
-
- FT_LOCAL( void )
- cff_decoder_init( CFF_Decoder* decoder,
- TT_Face face,
- CFF_Size size,
- CFF_GlyphSlot slot,
- FT_Bool hinting,
- FT_Render_Mode hint_mode );
-
- FT_LOCAL( FT_Error )
- cff_decoder_prepare( CFF_Decoder* decoder,
- CFF_Size size,
- FT_UInt glyph_index );
-
-#if 0 /* unused until we support pure CFF fonts */
-
- /* Compute the maximum advance width of a font through quick parsing */
- FT_LOCAL( FT_Error )
- cff_compute_max_advance( TT_Face face,
- FT_Int* max_advance );
-
-#endif /* 0 */
-
-#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
- FT_LOCAL( FT_Error )
- cff_decoder_parse_charstrings( CFF_Decoder* decoder,
- FT_Byte* charstring_base,
- FT_ULong charstring_len );
-#endif
-
- FT_LOCAL( FT_Error )
- cff_slot_load( CFF_GlyphSlot glyph,
- CFF_Size size,
- FT_UInt glyph_index,
- FT_Int32 load_flags );
-
-
-FT_END_HEADER
-
-#endif /* __CFFGLOAD_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/cff/cffload.c b/chromium/third_party/pdfium/third_party/freetype/src/cff/cffload.c
deleted file mode 100644
index c61222d6519..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/cff/cffload.c
+++ /dev/null
@@ -1,1703 +0,0 @@
-/***************************************************************************/
-/* */
-/* cffload.c */
-/* */
-/* OpenType and CFF data/program tables loader (body). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_STREAM_H
-#include FT_TRUETYPE_TAGS_H
-#include FT_TYPE1_TABLES_H
-
-#include "cffload.h"
-#include "cffparse.h"
-
-#include "cfferrs.h"
-
-
-#if 1
-
- static const FT_UShort cff_isoadobe_charset[229] =
- {
- 0, 1, 2, 3, 4, 5, 6, 7,
- 8, 9, 10, 11, 12, 13, 14, 15,
- 16, 17, 18, 19, 20, 21, 22, 23,
- 24, 25, 26, 27, 28, 29, 30, 31,
- 32, 33, 34, 35, 36, 37, 38, 39,
- 40, 41, 42, 43, 44, 45, 46, 47,
- 48, 49, 50, 51, 52, 53, 54, 55,
- 56, 57, 58, 59, 60, 61, 62, 63,
- 64, 65, 66, 67, 68, 69, 70, 71,
- 72, 73, 74, 75, 76, 77, 78, 79,
- 80, 81, 82, 83, 84, 85, 86, 87,
- 88, 89, 90, 91, 92, 93, 94, 95,
- 96, 97, 98, 99, 100, 101, 102, 103,
- 104, 105, 106, 107, 108, 109, 110, 111,
- 112, 113, 114, 115, 116, 117, 118, 119,
- 120, 121, 122, 123, 124, 125, 126, 127,
- 128, 129, 130, 131, 132, 133, 134, 135,
- 136, 137, 138, 139, 140, 141, 142, 143,
- 144, 145, 146, 147, 148, 149, 150, 151,
- 152, 153, 154, 155, 156, 157, 158, 159,
- 160, 161, 162, 163, 164, 165, 166, 167,
- 168, 169, 170, 171, 172, 173, 174, 175,
- 176, 177, 178, 179, 180, 181, 182, 183,
- 184, 185, 186, 187, 188, 189, 190, 191,
- 192, 193, 194, 195, 196, 197, 198, 199,
- 200, 201, 202, 203, 204, 205, 206, 207,
- 208, 209, 210, 211, 212, 213, 214, 215,
- 216, 217, 218, 219, 220, 221, 222, 223,
- 224, 225, 226, 227, 228
- };
-
- static const FT_UShort cff_expert_charset[166] =
- {
- 0, 1, 229, 230, 231, 232, 233, 234,
- 235, 236, 237, 238, 13, 14, 15, 99,
- 239, 240, 241, 242, 243, 244, 245, 246,
- 247, 248, 27, 28, 249, 250, 251, 252,
- 253, 254, 255, 256, 257, 258, 259, 260,
- 261, 262, 263, 264, 265, 266, 109, 110,
- 267, 268, 269, 270, 271, 272, 273, 274,
- 275, 276, 277, 278, 279, 280, 281, 282,
- 283, 284, 285, 286, 287, 288, 289, 290,
- 291, 292, 293, 294, 295, 296, 297, 298,
- 299, 300, 301, 302, 303, 304, 305, 306,
- 307, 308, 309, 310, 311, 312, 313, 314,
- 315, 316, 317, 318, 158, 155, 163, 319,
- 320, 321, 322, 323, 324, 325, 326, 150,
- 164, 169, 327, 328, 329, 330, 331, 332,
- 333, 334, 335, 336, 337, 338, 339, 340,
- 341, 342, 343, 344, 345, 346, 347, 348,
- 349, 350, 351, 352, 353, 354, 355, 356,
- 357, 358, 359, 360, 361, 362, 363, 364,
- 365, 366, 367, 368, 369, 370, 371, 372,
- 373, 374, 375, 376, 377, 378
- };
-
- static const FT_UShort cff_expertsubset_charset[87] =
- {
- 0, 1, 231, 232, 235, 236, 237, 238,
- 13, 14, 15, 99, 239, 240, 241, 242,
- 243, 244, 245, 246, 247, 248, 27, 28,
- 249, 250, 251, 253, 254, 255, 256, 257,
- 258, 259, 260, 261, 262, 263, 264, 265,
- 266, 109, 110, 267, 268, 269, 270, 272,
- 300, 301, 302, 305, 314, 315, 158, 155,
- 163, 320, 321, 322, 323, 324, 325, 326,
- 150, 164, 169, 327, 328, 329, 330, 331,
- 332, 333, 334, 335, 336, 337, 338, 339,
- 340, 341, 342, 343, 344, 345, 346
- };
-
- static const FT_UShort cff_standard_encoding[256] =
- {
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 2, 3, 4, 5, 6, 7, 8,
- 9, 10, 11, 12, 13, 14, 15, 16,
- 17, 18, 19, 20, 21, 22, 23, 24,
- 25, 26, 27, 28, 29, 30, 31, 32,
- 33, 34, 35, 36, 37, 38, 39, 40,
- 41, 42, 43, 44, 45, 46, 47, 48,
- 49, 50, 51, 52, 53, 54, 55, 56,
- 57, 58, 59, 60, 61, 62, 63, 64,
- 65, 66, 67, 68, 69, 70, 71, 72,
- 73, 74, 75, 76, 77, 78, 79, 80,
- 81, 82, 83, 84, 85, 86, 87, 88,
- 89, 90, 91, 92, 93, 94, 95, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 96, 97, 98, 99, 100, 101, 102,
- 103, 104, 105, 106, 107, 108, 109, 110,
- 0, 111, 112, 113, 114, 0, 115, 116,
- 117, 118, 119, 120, 121, 122, 0, 123,
- 0, 124, 125, 126, 127, 128, 129, 130,
- 131, 0, 132, 133, 0, 134, 135, 136,
- 137, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 138, 0, 139, 0, 0, 0, 0,
- 140, 141, 142, 143, 0, 0, 0, 0,
- 0, 144, 0, 0, 0, 145, 0, 0,
- 146, 147, 148, 149, 0, 0, 0, 0
- };
-
- static const FT_UShort cff_expert_encoding[256] =
- {
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 229, 230, 0, 231, 232, 233, 234,
- 235, 236, 237, 238, 13, 14, 15, 99,
- 239, 240, 241, 242, 243, 244, 245, 246,
- 247, 248, 27, 28, 249, 250, 251, 252,
- 0, 253, 254, 255, 256, 257, 0, 0,
- 0, 258, 0, 0, 259, 260, 261, 262,
- 0, 0, 263, 264, 265, 0, 266, 109,
- 110, 267, 268, 269, 0, 270, 271, 272,
- 273, 274, 275, 276, 277, 278, 279, 280,
- 281, 282, 283, 284, 285, 286, 287, 288,
- 289, 290, 291, 292, 293, 294, 295, 296,
- 297, 298, 299, 300, 301, 302, 303, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 304, 305, 306, 0, 0, 307, 308,
- 309, 310, 311, 0, 312, 0, 0, 312,
- 0, 0, 314, 315, 0, 0, 316, 317,
- 318, 0, 0, 0, 158, 155, 163, 319,
- 320, 321, 322, 323, 324, 325, 0, 0,
- 326, 150, 164, 169, 327, 328, 329, 330,
- 331, 332, 333, 334, 335, 336, 337, 338,
- 339, 340, 341, 342, 343, 344, 345, 346,
- 347, 348, 349, 350, 351, 352, 353, 354,
- 355, 356, 357, 358, 359, 360, 361, 362,
- 363, 364, 365, 366, 367, 368, 369, 370,
- 371, 372, 373, 374, 375, 376, 377, 378
- };
-
-#endif /* 1 */
-
-
- FT_LOCAL_DEF( FT_UShort )
- cff_get_standard_encoding( FT_UInt charcode )
- {
- return (FT_UShort)( charcode < 256 ? cff_standard_encoding[charcode]
- : 0 );
- }
-
-
- /*************************************************************************/
- /* */
- /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
- /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
- /* messages during execution. */
- /* */
-#undef FT_COMPONENT
-#define FT_COMPONENT trace_cffload
-
-
- /* read an offset from the index's stream current position */
- static FT_ULong
- cff_index_read_offset( CFF_Index idx,
- FT_Error *errorp )
- {
- FT_Error error;
- FT_Stream stream = idx->stream;
- FT_Byte tmp[4];
- FT_ULong result = 0;
-
-
- if ( !FT_STREAM_READ( tmp, idx->off_size ) )
- {
- FT_Int nn;
-
-
- for ( nn = 0; nn < idx->off_size; nn++ )
- result = ( result << 8 ) | tmp[nn];
- }
-
- *errorp = error;
- return result;
- }
-
-
- static FT_Error
- cff_index_init( CFF_Index idx,
- FT_Stream stream,
- FT_Bool load )
- {
- FT_Error error;
- FT_Memory memory = stream->memory;
- FT_UShort count;
-
-
- FT_MEM_ZERO( idx, sizeof ( *idx ) );
-
- idx->stream = stream;
- idx->start = FT_STREAM_POS();
- if ( !FT_READ_USHORT( count ) &&
- count > 0 )
- {
- FT_Byte offsize;
- FT_ULong size;
-
-
- /* there is at least one element; read the offset size, */
- /* then access the offset table to compute the index's total size */
- if ( FT_READ_BYTE( offsize ) )
- goto Exit;
-
- if ( offsize < 1 || offsize > 4 )
- {
- error = FT_THROW( Invalid_Table );
- goto Exit;
- }
-
- idx->count = count;
- idx->off_size = offsize;
- size = (FT_ULong)( count + 1 ) * offsize;
-
- idx->data_offset = idx->start + 3 + size;
-
- if ( FT_STREAM_SKIP( size - offsize ) )
- goto Exit;
-
- size = cff_index_read_offset( idx, &error );
- if ( error )
- goto Exit;
-
- if ( size == 0 )
- {
- error = FT_THROW( Invalid_Table );
- goto Exit;
- }
-
- idx->data_size = --size;
-
- if ( load )
- {
- /* load the data */
- if ( FT_FRAME_EXTRACT( size, idx->bytes ) )
- goto Exit;
- }
- else
- {
- /* skip the data */
- if ( FT_STREAM_SKIP( size ) )
- goto Exit;
- }
- }
-
- Exit:
- if ( error )
- FT_FREE( idx->offsets );
-
- return error;
- }
-
-
- static void
- cff_index_done( CFF_Index idx )
- {
- if ( idx->stream )
- {
- FT_Stream stream = idx->stream;
- FT_Memory memory = stream->memory;
-
-
- if ( idx->bytes )
- FT_FRAME_RELEASE( idx->bytes );
-
- FT_FREE( idx->offsets );
- FT_MEM_ZERO( idx, sizeof ( *idx ) );
- }
- }
-
-
- static FT_Error
- cff_index_load_offsets( CFF_Index idx )
- {
- FT_Error error = FT_Err_Ok;
- FT_Stream stream = idx->stream;
- FT_Memory memory = stream->memory;
-
-
- if ( idx->count > 0 && idx->offsets == NULL )
- {
- FT_Byte offsize = idx->off_size;
- FT_ULong data_size;
- FT_Byte* p;
- FT_Byte* p_end;
- FT_ULong* poff;
-
-
- data_size = (FT_ULong)( idx->count + 1 ) * offsize;
-
- if ( FT_NEW_ARRAY( idx->offsets, idx->count + 1 ) ||
- FT_STREAM_SEEK( idx->start + 3 ) ||
- FT_FRAME_ENTER( data_size ) )
- goto Exit;
-
- poff = idx->offsets;
- p = (FT_Byte*)stream->cursor;
- p_end = p + data_size;
-
- switch ( offsize )
- {
- case 1:
- for ( ; p < p_end; p++, poff++ )
- poff[0] = p[0];
- break;
-
- case 2:
- for ( ; p < p_end; p += 2, poff++ )
- poff[0] = FT_PEEK_USHORT( p );
- break;
-
- case 3:
- for ( ; p < p_end; p += 3, poff++ )
- poff[0] = FT_PEEK_UOFF3( p );
- break;
-
- default:
- for ( ; p < p_end; p += 4, poff++ )
- poff[0] = FT_PEEK_ULONG( p );
- }
-
- FT_FRAME_EXIT();
- }
-
- Exit:
- if ( error )
- FT_FREE( idx->offsets );
-
- return error;
- }
-
-
- /* Allocate a table containing pointers to an index's elements. */
- /* The `pool' argument makes this function convert the index */
- /* entries to C-style strings (this is, NULL-terminated). */
- static FT_Error
- cff_index_get_pointers( CFF_Index idx,
- FT_Byte*** table,
- FT_Byte** pool )
- {
- FT_Error error = FT_Err_Ok;
- FT_Memory memory = idx->stream->memory;
-
- FT_Byte** t = NULL;
- FT_Byte* new_bytes = NULL;
-
-
- *table = NULL;
-
- if ( idx->offsets == NULL )
- {
- error = cff_index_load_offsets( idx );
- if ( error )
- goto Exit;
- }
-
- if ( idx->count > 0 &&
- !FT_NEW_ARRAY( t, idx->count + 1 ) &&
- ( !pool || !FT_ALLOC( new_bytes,
- idx->data_size + idx->count ) ) )
- {
- FT_ULong n, cur_offset;
- FT_ULong extra = 0;
- FT_Byte* org_bytes = idx->bytes;
-
-
- /* at this point, `idx->offsets' can't be NULL */
- cur_offset = idx->offsets[0] - 1;
-
- /* sanity check */
- if ( cur_offset != 0 )
- {
- FT_TRACE0(( "cff_index_get_pointers:"
- " invalid first offset value %d set to zero\n",
- cur_offset ));
- cur_offset = 0;
- }
-
- if ( !pool )
- t[0] = org_bytes + cur_offset;
- else
- t[0] = new_bytes + cur_offset;
-
- for ( n = 1; n <= idx->count; n++ )
- {
- FT_ULong next_offset = idx->offsets[n] - 1;
-
-
- /* two sanity checks for invalid offset tables */
- if ( next_offset < cur_offset )
- next_offset = cur_offset;
- else if ( next_offset > idx->data_size )
- next_offset = idx->data_size;
-
- if ( !pool )
- t[n] = org_bytes + next_offset;
- else
- {
- t[n] = new_bytes + next_offset + extra;
-
- if ( next_offset != cur_offset )
- {
- FT_MEM_COPY( t[n - 1], org_bytes + cur_offset, t[n] - t[n - 1] );
- t[n][0] = '\0';
- t[n] += 1;
- extra++;
- }
- }
-
- cur_offset = next_offset;
- }
- *table = t;
-
- if ( pool )
- *pool = new_bytes;
- }
-
- Exit:
- return error;
- }
-
-
- FT_LOCAL_DEF( FT_Error )
- cff_index_access_element( CFF_Index idx,
- FT_UInt element,
- FT_Byte** pbytes,
- FT_ULong* pbyte_len )
- {
- FT_Error error = FT_Err_Ok;
-
-
- if ( idx && idx->count > element )
- {
- /* compute start and end offsets */
- FT_Stream stream = idx->stream;
- FT_ULong off1, off2 = 0;
-
-
- /* load offsets from file or the offset table */
- if ( !idx->offsets )
- {
- FT_ULong pos = element * idx->off_size;
-
-
- if ( FT_STREAM_SEEK( idx->start + 3 + pos ) )
- goto Exit;
-
- off1 = cff_index_read_offset( idx, &error );
- if ( error )
- goto Exit;
-
- if ( off1 != 0 )
- {
- do
- {
- element++;
- off2 = cff_index_read_offset( idx, &error );
- }
- while ( off2 == 0 && element < idx->count );
- }
- }
- else /* use offsets table */
- {
- off1 = idx->offsets[element];
- if ( off1 )
- {
- do
- {
- element++;
- off2 = idx->offsets[element];
-
- } while ( off2 == 0 && element < idx->count );
- }
- }
-
- /* XXX: should check off2 does not exceed the end of this entry; */
- /* at present, only truncate off2 at the end of this stream */
- if ( off2 > stream->size + 1 ||
- idx->data_offset > stream->size - off2 + 1 )
- {
- FT_ERROR(( "cff_index_access_element:"
- " offset to next entry (%d)"
- " exceeds the end of stream (%d)\n",
- off2, stream->size - idx->data_offset + 1 ));
- off2 = stream->size - idx->data_offset + 1;
- }
-
- /* access element */
- if ( off1 && off2 > off1 )
- {
- *pbyte_len = off2 - off1;
-
- if ( idx->bytes )
- {
- /* this index was completely loaded in memory, that's easy */
- *pbytes = idx->bytes + off1 - 1;
- }
- else
- {
- /* this index is still on disk/file, access it through a frame */
- if ( FT_STREAM_SEEK( idx->data_offset + off1 - 1 ) ||
- FT_FRAME_EXTRACT( off2 - off1, *pbytes ) )
- goto Exit;
- }
- }
- else
- {
- /* empty index element */
- *pbytes = 0;
- *pbyte_len = 0;
- }
- }
- else
- error = FT_THROW( Invalid_Argument );
-
- Exit:
- return error;
- }
-
-
- FT_LOCAL_DEF( void )
- cff_index_forget_element( CFF_Index idx,
- FT_Byte** pbytes )
- {
- if ( idx->bytes == 0 )
- {
- FT_Stream stream = idx->stream;
-
-
- FT_FRAME_RELEASE( *pbytes );
- }
- }
-
-
- /* get an entry from Name INDEX */
- FT_LOCAL_DEF( FT_String* )
- cff_index_get_name( CFF_Font font,
- FT_UInt element )
- {
- CFF_Index idx = &font->name_index;
- FT_Memory memory = idx->stream->memory;
- FT_Byte* bytes;
- FT_ULong byte_len;
- FT_Error error;
- FT_String* name = 0;
-
-
- error = cff_index_access_element( idx, element, &bytes, &byte_len );
- if ( error )
- goto Exit;
-
- if ( !FT_ALLOC( name, byte_len + 1 ) )
- {
- FT_MEM_COPY( name, bytes, byte_len );
- name[byte_len] = 0;
- }
- cff_index_forget_element( idx, &bytes );
-
- Exit:
- return name;
- }
-
-
- /* get an entry from String INDEX */
- FT_LOCAL_DEF( FT_String* )
- cff_index_get_string( CFF_Font font,
- FT_UInt element )
- {
- return ( element < font->num_strings )
- ? (FT_String*)font->strings[element]
- : NULL;
- }
-
-
- FT_LOCAL_DEF( FT_String* )
- cff_index_get_sid_string( CFF_Font font,
- FT_UInt sid )
- {
- /* value 0xFFFFU indicates a missing dictionary entry */
- if ( sid == 0xFFFFU )
- return NULL;
-
- /* if it is not a standard string, return it */
- if ( sid > 390 )
- return cff_index_get_string( font, sid - 391 );
-
- /* CID-keyed CFF fonts don't have glyph names */
- if ( !font->psnames )
- return NULL;
-
- /* this is a standard string */
- return (FT_String *)font->psnames->adobe_std_strings( sid );
- }
-
-
- /*************************************************************************/
- /*************************************************************************/
- /*** ***/
- /*** FD Select table support ***/
- /*** ***/
- /*************************************************************************/
- /*************************************************************************/
-
-
- static void
- CFF_Done_FD_Select( CFF_FDSelect fdselect,
- FT_Stream stream )
- {
- if ( fdselect->data )
- FT_FRAME_RELEASE( fdselect->data );
-
- fdselect->data_size = 0;
- fdselect->format = 0;
- fdselect->range_count = 0;
- }
-
-
- static FT_Error
- CFF_Load_FD_Select( CFF_FDSelect fdselect,
- FT_UInt num_glyphs,
- FT_Stream stream,
- FT_ULong offset )
- {
- FT_Error error;
- FT_Byte format;
- FT_UInt num_ranges;
-
-
- /* read format */
- if ( FT_STREAM_SEEK( offset ) || FT_READ_BYTE( format ) )
- goto Exit;
-
- fdselect->format = format;
- fdselect->cache_count = 0; /* clear cache */
-
- switch ( format )
- {
- case 0: /* format 0, that's simple */
- fdselect->data_size = num_glyphs;
- goto Load_Data;
-
- case 3: /* format 3, a tad more complex */
- if ( FT_READ_USHORT( num_ranges ) )
- goto Exit;
-
- if ( !num_ranges )
- {
- FT_TRACE0(( "CFF_Load_FD_Select: empty FDSelect array\n" ));
- error = FT_THROW( Invalid_File_Format );
- goto Exit;
- }
-
- fdselect->data_size = num_ranges * 3 + 2;
-
- Load_Data:
- if ( FT_FRAME_EXTRACT( fdselect->data_size, fdselect->data ) )
- goto Exit;
- break;
-
- default: /* hmm... that's wrong */
- error = FT_THROW( Invalid_File_Format );
- }
-
- Exit:
- return error;
- }
-
-
- FT_LOCAL_DEF( FT_Byte )
- cff_fd_select_get( CFF_FDSelect fdselect,
- FT_UInt glyph_index )
- {
- FT_Byte fd = 0;
-
-
- switch ( fdselect->format )
- {
- case 0:
- fd = fdselect->data[glyph_index];
- break;
-
- case 3:
- /* first, compare to the cache */
- if ( (FT_UInt)( glyph_index - fdselect->cache_first ) <
- fdselect->cache_count )
- {
- fd = fdselect->cache_fd;
- break;
- }
-
- /* then, look up the ranges array */
- {
- FT_Byte* p = fdselect->data;
- FT_Byte* p_limit = p + fdselect->data_size;
- FT_Byte fd2;
- FT_UInt first, limit;
-
-
- first = FT_NEXT_USHORT( p );
- do
- {
- if ( glyph_index < first )
- break;
-
- fd2 = *p++;
- limit = FT_NEXT_USHORT( p );
-
- if ( glyph_index < limit )
- {
- fd = fd2;
-
- /* update cache */
- fdselect->cache_first = first;
- fdselect->cache_count = limit - first;
- fdselect->cache_fd = fd2;
- break;
- }
- first = limit;
-
- } while ( p < p_limit );
- }
- break;
-
- default:
- ;
- }
-
- return fd;
- }
-
-
- /*************************************************************************/
- /*************************************************************************/
- /*** ***/
- /*** CFF font support ***/
- /*** ***/
- /*************************************************************************/
- /*************************************************************************/
-
- static FT_Error
- cff_charset_compute_cids( CFF_Charset charset,
- FT_UInt num_glyphs,
- FT_Memory memory )
- {
- FT_Error error = FT_Err_Ok;
- FT_UInt i;
- FT_Long j;
- FT_UShort max_cid = 0;
-
-
- if ( charset->max_cid > 0 )
- goto Exit;
-
- for ( i = 0; i < num_glyphs; i++ )
- {
- if ( charset->sids[i] > max_cid )
- max_cid = charset->sids[i];
- }
-
- if ( FT_NEW_ARRAY( charset->cids, (FT_ULong)max_cid + 1 ) )
- goto Exit;
-
- /* When multiple GIDs map to the same CID, we choose the lowest */
- /* GID. This is not described in any spec, but it matches the */
- /* behaviour of recent Acroread versions. */
- for ( j = (FT_Long)num_glyphs - 1; j >= 0 ; j-- )
- charset->cids[charset->sids[j]] = (FT_UShort)j;
-
- charset->max_cid = max_cid;
- charset->num_glyphs = num_glyphs;
-
- Exit:
- return error;
- }
-
-
- FT_LOCAL_DEF( FT_UInt )
- cff_charset_cid_to_gindex( CFF_Charset charset,
- FT_UInt cid )
- {
- FT_UInt result = 0;
-
-
- if ( cid <= charset->max_cid )
- result = charset->cids[cid];
-
- return result;
- }
-
-
- static void
- cff_charset_free_cids( CFF_Charset charset,
- FT_Memory memory )
- {
- FT_FREE( charset->cids );
- charset->max_cid = 0;
- }
-
-
- static void
- cff_charset_done( CFF_Charset charset,
- FT_Stream stream )
- {
- FT_Memory memory = stream->memory;
-
-
- cff_charset_free_cids( charset, memory );
-
- FT_FREE( charset->sids );
- charset->format = 0;
- charset->offset = 0;
- }
-
-
- static FT_Error
- cff_charset_load( CFF_Charset charset,
- FT_UInt num_glyphs,
- FT_Stream stream,
- FT_ULong base_offset,
- FT_ULong offset,
- FT_Bool invert )
- {
- FT_Memory memory = stream->memory;
- FT_Error error = FT_Err_Ok;
- FT_UShort glyph_sid;
-
-
- /* If the the offset is greater than 2, we have to parse the */
- /* charset table. */
- if ( offset > 2 )
- {
- FT_UInt j;
-
-
- charset->offset = base_offset + offset;
-
- /* Get the format of the table. */
- if ( FT_STREAM_SEEK( charset->offset ) ||
- FT_READ_BYTE( charset->format ) )
- goto Exit;
-
- /* Allocate memory for sids. */
- if ( FT_NEW_ARRAY( charset->sids, num_glyphs ) )
- goto Exit;
-
- /* assign the .notdef glyph */
- charset->sids[0] = 0;
-
- switch ( charset->format )
- {
- case 0:
- if ( num_glyphs > 0 )
- {
- if ( FT_FRAME_ENTER( ( num_glyphs - 1 ) * 2 ) )
- goto Exit;
-
- for ( j = 1; j < num_glyphs; j++ )
- charset->sids[j] = FT_GET_USHORT();
-
- FT_FRAME_EXIT();
- }
- break;
-
- case 1:
- case 2:
- {
- FT_UInt nleft;
- FT_UInt i;
-
-
- j = 1;
-
- while ( j < num_glyphs )
- {
- /* Read the first glyph sid of the range. */
- if ( FT_READ_USHORT( glyph_sid ) )
- goto Exit;
-
- /* Read the number of glyphs in the range. */
- if ( charset->format == 2 )
- {
- if ( FT_READ_USHORT( nleft ) )
- goto Exit;
- }
- else
- {
- if ( FT_READ_BYTE( nleft ) )
- goto Exit;
- }
-
- /* try to rescue some of the SIDs if `nleft' is too large */
- if ( glyph_sid > 0xFFFFL - nleft )
- {
- FT_ERROR(( "cff_charset_load: invalid SID range trimmed"
- " nleft=%d -> %d\n", nleft, 0xFFFFL - glyph_sid ));
- nleft = ( FT_UInt )( 0xFFFFL - glyph_sid );
- }
-
- /* Fill in the range of sids -- `nleft + 1' glyphs. */
- for ( i = 0; j < num_glyphs && i <= nleft; i++, j++, glyph_sid++ )
- charset->sids[j] = glyph_sid;
- }
- }
- break;
-
- default:
- FT_ERROR(( "cff_charset_load: invalid table format\n" ));
- error = FT_THROW( Invalid_File_Format );
- goto Exit;
- }
- }
- else
- {
- /* Parse default tables corresponding to offset == 0, 1, or 2. */
- /* CFF specification intimates the following: */
- /* */
- /* In order to use a predefined charset, the following must be */
- /* true: The charset constructed for the glyphs in the font's */
- /* charstrings dictionary must match the predefined charset in */
- /* the first num_glyphs. */
-
- charset->offset = offset; /* record charset type */
-
- switch ( (FT_UInt)offset )
- {
- case 0:
- if ( num_glyphs > 229 )
- {
- FT_ERROR(( "cff_charset_load: implicit charset larger than\n"
- "predefined charset (Adobe ISO-Latin)\n" ));
- error = FT_THROW( Invalid_File_Format );
- goto Exit;
- }
-
- /* Allocate memory for sids. */
- if ( FT_NEW_ARRAY( charset->sids, num_glyphs ) )
- goto Exit;
-
- /* Copy the predefined charset into the allocated memory. */
- FT_ARRAY_COPY( charset->sids, cff_isoadobe_charset, num_glyphs );
-
- break;
-
- case 1:
- if ( num_glyphs > 166 )
- {
- FT_ERROR(( "cff_charset_load: implicit charset larger than\n"
- "predefined charset (Adobe Expert)\n" ));
- error = FT_THROW( Invalid_File_Format );
- goto Exit;
- }
-
- /* Allocate memory for sids. */
- if ( FT_NEW_ARRAY( charset->sids, num_glyphs ) )
- goto Exit;
-
- /* Copy the predefined charset into the allocated memory. */
- FT_ARRAY_COPY( charset->sids, cff_expert_charset, num_glyphs );
-
- break;
-
- case 2:
- if ( num_glyphs > 87 )
- {
- FT_ERROR(( "cff_charset_load: implicit charset larger than\n"
- "predefined charset (Adobe Expert Subset)\n" ));
- error = FT_THROW( Invalid_File_Format );
- goto Exit;
- }
-
- /* Allocate memory for sids. */
- if ( FT_NEW_ARRAY( charset->sids, num_glyphs ) )
- goto Exit;
-
- /* Copy the predefined charset into the allocated memory. */
- FT_ARRAY_COPY( charset->sids, cff_expertsubset_charset, num_glyphs );
-
- break;
-
- default:
- error = FT_THROW( Invalid_File_Format );
- goto Exit;
- }
- }
-
- /* we have to invert the `sids' array for subsetted CID-keyed fonts */
- if ( invert )
- error = cff_charset_compute_cids( charset, num_glyphs, memory );
-
- Exit:
- /* Clean up if there was an error. */
- if ( error )
- {
- FT_FREE( charset->sids );
- FT_FREE( charset->cids );
- charset->format = 0;
- charset->offset = 0;
- charset->sids = 0;
- }
-
- return error;
- }
-
-
- static void
- cff_encoding_done( CFF_Encoding encoding )
- {
- encoding->format = 0;
- encoding->offset = 0;
- encoding->count = 0;
- }
-
-
- static FT_Error
- cff_encoding_load( CFF_Encoding encoding,
- CFF_Charset charset,
- FT_UInt num_glyphs,
- FT_Stream stream,
- FT_ULong base_offset,
- FT_ULong offset )
- {
- FT_Error error = FT_Err_Ok;
- FT_UInt count;
- FT_UInt j;
- FT_UShort glyph_sid;
- FT_UInt glyph_code;
-
-
- /* Check for charset->sids. If we do not have this, we fail. */
- if ( !charset->sids )
- {
- error = FT_THROW( Invalid_File_Format );
- goto Exit;
- }
-
- /* Zero out the code to gid/sid mappings. */
- for ( j = 0; j < 256; j++ )
- {
- encoding->sids [j] = 0;
- encoding->codes[j] = 0;
- }
-
- /* Note: The encoding table in a CFF font is indexed by glyph index; */
- /* the first encoded glyph index is 1. Hence, we read the character */
- /* code (`glyph_code') at index j and make the assignment: */
- /* */
- /* encoding->codes[glyph_code] = j + 1 */
- /* */
- /* We also make the assignment: */
- /* */
- /* encoding->sids[glyph_code] = charset->sids[j + 1] */
- /* */
- /* This gives us both a code to GID and a code to SID mapping. */
-
- if ( offset > 1 )
- {
- encoding->offset = base_offset + offset;
-
- /* we need to parse the table to determine its size */
- if ( FT_STREAM_SEEK( encoding->offset ) ||
- FT_READ_BYTE( encoding->format ) ||
- FT_READ_BYTE( count ) )
- goto Exit;
-
- switch ( encoding->format & 0x7F )
- {
- case 0:
- {
- FT_Byte* p;
-
-
- /* By convention, GID 0 is always ".notdef" and is never */
- /* coded in the font. Hence, the number of codes found */
- /* in the table is `count+1'. */
- /* */
- encoding->count = count + 1;
-
- if ( FT_FRAME_ENTER( count ) )
- goto Exit;
-
- p = (FT_Byte*)stream->cursor;
-
- for ( j = 1; j <= count; j++ )
- {
- glyph_code = *p++;
-
- /* Make sure j is not too big. */
- if ( j < num_glyphs )
- {
- /* Assign code to GID mapping. */
- encoding->codes[glyph_code] = (FT_UShort)j;
-
- /* Assign code to SID mapping. */
- encoding->sids[glyph_code] = charset->sids[j];
- }
- }
-
- FT_FRAME_EXIT();
- }
- break;
-
- case 1:
- {
- FT_UInt nleft;
- FT_UInt i = 1;
- FT_UInt k;
-
-
- encoding->count = 0;
-
- /* Parse the Format1 ranges. */
- for ( j = 0; j < count; j++, i += nleft )
- {
- /* Read the first glyph code of the range. */
- if ( FT_READ_BYTE( glyph_code ) )
- goto Exit;
-
- /* Read the number of codes in the range. */
- if ( FT_READ_BYTE( nleft ) )
- goto Exit;
-
- /* Increment nleft, so we read `nleft + 1' codes/sids. */
- nleft++;
-
- /* compute max number of character codes */
- if ( (FT_UInt)nleft > encoding->count )
- encoding->count = nleft;
-
- /* Fill in the range of codes/sids. */
- for ( k = i; k < nleft + i; k++, glyph_code++ )
- {
- /* Make sure k is not too big. */
- if ( k < num_glyphs && glyph_code < 256 )
- {
- /* Assign code to GID mapping. */
- encoding->codes[glyph_code] = (FT_UShort)k;
-
- /* Assign code to SID mapping. */
- encoding->sids[glyph_code] = charset->sids[k];
- }
- }
- }
-
- /* simple check; one never knows what can be found in a font */
- if ( encoding->count > 256 )
- encoding->count = 256;
- }
- break;
-
- default:
- FT_ERROR(( "cff_encoding_load: invalid table format\n" ));
- error = FT_THROW( Invalid_File_Format );
- goto Exit;
- }
-
- /* Parse supplemental encodings, if any. */
- if ( encoding->format & 0x80 )
- {
- FT_UInt gindex;
-
-
- /* count supplements */
- if ( FT_READ_BYTE( count ) )
- goto Exit;
-
- for ( j = 0; j < count; j++ )
- {
- /* Read supplemental glyph code. */
- if ( FT_READ_BYTE( glyph_code ) )
- goto Exit;
-
- /* Read the SID associated with this glyph code. */
- if ( FT_READ_USHORT( glyph_sid ) )
- goto Exit;
-
- /* Assign code to SID mapping. */
- encoding->sids[glyph_code] = glyph_sid;
-
- /* First, look up GID which has been assigned to */
- /* SID glyph_sid. */
- for ( gindex = 0; gindex < num_glyphs; gindex++ )
- {
- if ( charset->sids[gindex] == glyph_sid )
- {
- encoding->codes[glyph_code] = (FT_UShort)gindex;
- break;
- }
- }
- }
- }
- }
- else
- {
- /* We take into account the fact a CFF font can use a predefined */
- /* encoding without containing all of the glyphs encoded by this */
- /* encoding (see the note at the end of section 12 in the CFF */
- /* specification). */
-
- switch ( (FT_UInt)offset )
- {
- case 0:
- /* First, copy the code to SID mapping. */
- FT_ARRAY_COPY( encoding->sids, cff_standard_encoding, 256 );
- goto Populate;
-
- case 1:
- /* First, copy the code to SID mapping. */
- FT_ARRAY_COPY( encoding->sids, cff_expert_encoding, 256 );
-
- Populate:
- /* Construct code to GID mapping from code to SID mapping */
- /* and charset. */
-
- encoding->count = 0;
-
- error = cff_charset_compute_cids( charset, num_glyphs,
- stream->memory );
- if ( error )
- goto Exit;
-
- for ( j = 0; j < 256; j++ )
- {
- FT_UInt sid = encoding->sids[j];
- FT_UInt gid = 0;
-
-
- if ( sid )
- gid = cff_charset_cid_to_gindex( charset, sid );
-
- if ( gid != 0 )
- {
- encoding->codes[j] = (FT_UShort)gid;
- encoding->count = j + 1;
- }
- else
- {
- encoding->codes[j] = 0;
- encoding->sids [j] = 0;
- }
- }
- break;
-
- default:
- FT_ERROR(( "cff_encoding_load: invalid table format\n" ));
- error = FT_THROW( Invalid_File_Format );
- goto Exit;
- }
- }
-
- Exit:
-
- /* Clean up if there was an error. */
- return error;
- }
-
-
- static FT_Error
- cff_subfont_load( CFF_SubFont font,
- CFF_Index idx,
- FT_UInt font_index,
- FT_Stream stream,
- FT_ULong base_offset,
- FT_Library library )
- {
- FT_Error error;
- CFF_ParserRec parser;
- FT_Byte* dict = NULL;
- FT_ULong dict_len;
- CFF_FontRecDict top = &font->font_dict;
- CFF_Private priv = &font->private_dict;
-
-
- cff_parser_init( &parser, CFF_CODE_TOPDICT, &font->font_dict, library );
-
- /* set defaults */
- FT_MEM_ZERO( top, sizeof ( *top ) );
-
- top->underline_position = -( 100L << 16 );
- top->underline_thickness = 50L << 16;
- top->charstring_type = 2;
- top->font_matrix.xx = 0x10000L;
- top->font_matrix.yy = 0x10000L;
- top->cid_count = 8720;
-
- /* we use the implementation specific SID value 0xFFFF to indicate */
- /* missing entries */
- top->version = 0xFFFFU;
- top->notice = 0xFFFFU;
- top->copyright = 0xFFFFU;
- top->full_name = 0xFFFFU;
- top->family_name = 0xFFFFU;
- top->weight = 0xFFFFU;
- top->embedded_postscript = 0xFFFFU;
-
- top->cid_registry = 0xFFFFU;
- top->cid_ordering = 0xFFFFU;
- top->cid_font_name = 0xFFFFU;
-
- error = cff_index_access_element( idx, font_index, &dict, &dict_len );
- if ( !error )
- {
- FT_TRACE4(( " top dictionary:\n" ));
- error = cff_parser_run( &parser, dict, dict + dict_len );
- }
-
- cff_index_forget_element( idx, &dict );
-
- if ( error )
- goto Exit;
-
- /* if it is a CID font, we stop there */
- if ( top->cid_registry != 0xFFFFU )
- goto Exit;
-
- /* parse the private dictionary, if any */
- if ( top->private_offset && top->private_size )
- {
- /* set defaults */
- FT_MEM_ZERO( priv, sizeof ( *priv ) );
-
- priv->blue_shift = 7;
- priv->blue_fuzz = 1;
- priv->lenIV = -1;
- priv->expansion_factor = (FT_Fixed)( 0.06 * 0x10000L );
- priv->blue_scale = (FT_Fixed)( 0.039625 * 0x10000L * 1000 );
-
- cff_parser_init( &parser, CFF_CODE_PRIVATE, priv, library );
-
- if ( FT_STREAM_SEEK( base_offset + font->font_dict.private_offset ) ||
- FT_FRAME_ENTER( font->font_dict.private_size ) )
- goto Exit;
-
- FT_TRACE4(( " private dictionary:\n" ));
- error = cff_parser_run( &parser,
- (FT_Byte*)stream->cursor,
- (FT_Byte*)stream->limit );
- FT_FRAME_EXIT();
- if ( error )
- goto Exit;
-
- /* ensure that `num_blue_values' is even */
- priv->num_blue_values &= ~1;
- }
-
- /* read the local subrs, if any */
- if ( priv->local_subrs_offset )
- {
- if ( FT_STREAM_SEEK( base_offset + top->private_offset +
- priv->local_subrs_offset ) )
- goto Exit;
-
- error = cff_index_init( &font->local_subrs_index, stream, 1 );
- if ( error )
- goto Exit;
-
- error = cff_index_get_pointers( &font->local_subrs_index,
- &font->local_subrs, NULL );
- if ( error )
- goto Exit;
- }
-
- Exit:
- return error;
- }
-
-
- static void
- cff_subfont_done( FT_Memory memory,
- CFF_SubFont subfont )
- {
- if ( subfont )
- {
- cff_index_done( &subfont->local_subrs_index );
- FT_FREE( subfont->local_subrs );
- }
- }
-
-
- FT_LOCAL_DEF( FT_Error )
- cff_font_load( FT_Library library,
- FT_Stream stream,
- FT_Int face_index,
- CFF_Font font,
- FT_Bool pure_cff )
- {
- static const FT_Frame_Field cff_header_fields[] =
- {
-#undef FT_STRUCTURE
-#define FT_STRUCTURE CFF_FontRec
-
- FT_FRAME_START( 4 ),
- FT_FRAME_BYTE( version_major ),
- FT_FRAME_BYTE( version_minor ),
- FT_FRAME_BYTE( header_size ),
- FT_FRAME_BYTE( absolute_offsize ),
- FT_FRAME_END
- };
-
- FT_Error error;
- FT_Memory memory = stream->memory;
- FT_ULong base_offset;
- CFF_FontRecDict dict;
- CFF_IndexRec string_index;
- FT_UInt subfont_index;
-
-
- FT_ZERO( font );
- FT_ZERO( &string_index );
-
- font->stream = stream;
- font->memory = memory;
- dict = &font->top_font.font_dict;
- base_offset = FT_STREAM_POS();
-
- /* read CFF font header */
- if ( FT_STREAM_READ_FIELDS( cff_header_fields, font ) )
- goto Exit;
-
- /* check format */
- if ( font->version_major != 1 ||
- font->header_size < 4 ||
- font->absolute_offsize > 4 )
- {
- FT_TRACE2(( " not a CFF font header\n" ));
- error = FT_THROW( Unknown_File_Format );
- goto Exit;
- }
-
- /* skip the rest of the header */
- if ( FT_STREAM_SKIP( font->header_size - 4 ) )
- goto Exit;
-
- /* read the name, top dict, string and global subrs index */
- if ( FT_SET_ERROR( cff_index_init( &font->name_index,
- stream, 0 ) ) ||
- FT_SET_ERROR( cff_index_init( &font->font_dict_index,
- stream, 0 ) ) ||
- FT_SET_ERROR( cff_index_init( &string_index,
- stream, 1 ) ) ||
- FT_SET_ERROR( cff_index_init( &font->global_subrs_index,
- stream, 1 ) ) ||
- FT_SET_ERROR( cff_index_get_pointers( &string_index,
- &font->strings,
- &font->string_pool ) ) )
- goto Exit;
-
- font->num_strings = string_index.count;
-
- if ( pure_cff )
- {
- /* well, we don't really forget the `disabled' fonts... */
- subfont_index = (FT_UInt)( face_index & 0xFFFF );
-
- if ( face_index > 0 && subfont_index >= font->name_index.count )
- {
- FT_ERROR(( "cff_font_load:"
- " invalid subfont index for pure CFF font (%d)\n",
- subfont_index ));
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- font->num_faces = font->name_index.count;
- }
- else
- {
- subfont_index = 0;
-
- if ( font->name_index.count > 1 )
- {
- FT_ERROR(( "cff_font_load:"
- " invalid CFF font with multiple subfonts\n"
- " "
- " in SFNT wrapper\n" ));
- error = FT_THROW( Invalid_File_Format );
- goto Exit;
- }
- }
-
- /* in case of a font format check, simply exit now */
- if ( face_index < 0 )
- goto Exit;
-
- /* now, parse the top-level font dictionary */
- FT_TRACE4(( "parsing top-level\n" ));
- error = cff_subfont_load( &font->top_font,
- &font->font_dict_index,
- subfont_index,
- stream,
- base_offset,
- library );
- if ( error )
- goto Exit;
-
- if ( FT_STREAM_SEEK( base_offset + dict->charstrings_offset ) )
- goto Exit;
-
- error = cff_index_init( &font->charstrings_index, stream, 0 );
- if ( error )
- goto Exit;
-
- /* now, check for a CID font */
- if ( dict->cid_registry != 0xFFFFU )
- {
- CFF_IndexRec fd_index;
- CFF_SubFont sub = NULL;
- FT_UInt idx;
-
-
- /* this is a CID-keyed font, we must now allocate a table of */
- /* sub-fonts, then load each of them separately */
- if ( FT_STREAM_SEEK( base_offset + dict->cid_fd_array_offset ) )
- goto Exit;
-
- error = cff_index_init( &fd_index, stream, 0 );
- if ( error )
- goto Exit;
-
- if ( fd_index.count > CFF_MAX_CID_FONTS )
- {
- FT_TRACE0(( "cff_font_load: FD array too large in CID font\n" ));
- goto Fail_CID;
- }
-
- /* allocate & read each font dict independently */
- font->num_subfonts = fd_index.count;
- if ( FT_NEW_ARRAY( sub, fd_index.count ) )
- goto Fail_CID;
-
- /* set up pointer table */
- for ( idx = 0; idx < fd_index.count; idx++ )
- font->subfonts[idx] = sub + idx;
-
- /* now load each subfont independently */
- for ( idx = 0; idx < fd_index.count; idx++ )
- {
- sub = font->subfonts[idx];
- FT_TRACE4(( "parsing subfont %u\n", idx ));
- error = cff_subfont_load( sub, &fd_index, idx,
- stream, base_offset, library );
- if ( error )
- goto Fail_CID;
- }
-
- /* now load the FD Select array */
- error = CFF_Load_FD_Select( &font->fd_select,
- font->charstrings_index.count,
- stream,
- base_offset + dict->cid_fd_select_offset );
-
- Fail_CID:
- cff_index_done( &fd_index );
-
- if ( error )
- goto Exit;
- }
- else
- font->num_subfonts = 0;
-
- /* read the charstrings index now */
- if ( dict->charstrings_offset == 0 )
- {
- FT_ERROR(( "cff_font_load: no charstrings offset\n" ));
- error = FT_THROW( Invalid_File_Format );
- goto Exit;
- }
-
- font->num_glyphs = font->charstrings_index.count;
-
- error = cff_index_get_pointers( &font->global_subrs_index,
- &font->global_subrs, NULL );
-
- if ( error )
- goto Exit;
-
- /* read the Charset and Encoding tables if available */
- if ( font->num_glyphs > 0 )
- {
- FT_Bool invert = FT_BOOL( dict->cid_registry != 0xFFFFU && pure_cff );
-
-
- error = cff_charset_load( &font->charset, font->num_glyphs, stream,
- base_offset, dict->charset_offset, invert );
- if ( error )
- goto Exit;
-
- /* CID-keyed CFFs don't have an encoding */
- if ( dict->cid_registry == 0xFFFFU )
- {
- error = cff_encoding_load( &font->encoding,
- &font->charset,
- font->num_glyphs,
- stream,
- base_offset,
- dict->encoding_offset );
- if ( error )
- goto Exit;
- }
- }
-
- /* get the font name (/CIDFontName for CID-keyed fonts, */
- /* /FontName otherwise) */
- font->font_name = cff_index_get_name( font, subfont_index );
-
- Exit:
- cff_index_done( &string_index );
-
- return error;
- }
-
-
- FT_LOCAL_DEF( void )
- cff_font_done( CFF_Font font )
- {
- FT_Memory memory = font->memory;
- FT_UInt idx;
-
-
- cff_index_done( &font->global_subrs_index );
- cff_index_done( &font->font_dict_index );
- cff_index_done( &font->name_index );
- cff_index_done( &font->charstrings_index );
-
- /* release font dictionaries, but only if working with */
- /* a CID keyed CFF font */
- if ( font->num_subfonts > 0 )
- {
- for ( idx = 0; idx < font->num_subfonts; idx++ )
- cff_subfont_done( memory, font->subfonts[idx] );
-
- /* the subfonts array has been allocated as a single block */
- FT_FREE( font->subfonts[0] );
- }
-
- cff_encoding_done( &font->encoding );
- cff_charset_done( &font->charset, font->stream );
-
- cff_subfont_done( memory, &font->top_font );
-
- CFF_Done_FD_Select( &font->fd_select, font->stream );
-
- FT_FREE( font->font_info );
-
- FT_FREE( font->font_name );
- FT_FREE( font->global_subrs );
- FT_FREE( font->strings );
- FT_FREE( font->string_pool );
-
- if ( font->cf2_instance.finalizer )
- {
- font->cf2_instance.finalizer( font->cf2_instance.data );
- FT_FREE( font->cf2_instance.data );
- }
- }
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/cff/cffload.h b/chromium/third_party/pdfium/third_party/freetype/src/cff/cffload.h
deleted file mode 100644
index 459e7b04461..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/cff/cffload.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/***************************************************************************/
-/* */
-/* cffload.h */
-/* */
-/* OpenType & CFF data/program tables loader (specification). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __CFFLOAD_H__
-#define __CFFLOAD_H__
-
-
-#include <ft2build.h>
-#include "cfftypes.h"
-
-
-FT_BEGIN_HEADER
-
- FT_LOCAL( FT_UShort )
- cff_get_standard_encoding( FT_UInt charcode );
-
-
- FT_LOCAL( FT_String* )
- cff_index_get_string( CFF_Font font,
- FT_UInt element );
-
- FT_LOCAL( FT_String* )
- cff_index_get_sid_string( CFF_Font font,
- FT_UInt sid );
-
-
- FT_LOCAL( FT_Error )
- cff_index_access_element( CFF_Index idx,
- FT_UInt element,
- FT_Byte** pbytes,
- FT_ULong* pbyte_len );
-
- FT_LOCAL( void )
- cff_index_forget_element( CFF_Index idx,
- FT_Byte** pbytes );
-
- FT_LOCAL( FT_String* )
- cff_index_get_name( CFF_Font font,
- FT_UInt element );
-
-
- FT_LOCAL( FT_UInt )
- cff_charset_cid_to_gindex( CFF_Charset charset,
- FT_UInt cid );
-
-
- FT_LOCAL( FT_Error )
- cff_font_load( FT_Library library,
- FT_Stream stream,
- FT_Int face_index,
- CFF_Font font,
- FT_Bool pure_cff );
-
- FT_LOCAL( void )
- cff_font_done( CFF_Font font );
-
-
- FT_LOCAL( FT_Byte )
- cff_fd_select_get( CFF_FDSelect fdselect,
- FT_UInt glyph_index );
-
-
-FT_END_HEADER
-
-#endif /* __CFFLOAD_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/cff/cffobjs.c b/chromium/third_party/pdfium/third_party/freetype/src/cff/cffobjs.c
deleted file mode 100644
index 0e0d5b034b6..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/cff/cffobjs.c
+++ /dev/null
@@ -1,1077 +0,0 @@
-/***************************************************************************/
-/* */
-/* cffobjs.c */
-/* */
-/* OpenType objects manager (body). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_CALC_H
-#include FT_INTERNAL_STREAM_H
-#include FT_ERRORS_H
-#include FT_TRUETYPE_IDS_H
-#include FT_TRUETYPE_TAGS_H
-#include FT_INTERNAL_SFNT_H
-#include FT_CFF_DRIVER_H
-
-#include "cffobjs.h"
-#include "cffload.h"
-#include "cffcmap.h"
-#include "cffpic.h"
-
-#include "cfferrs.h"
-
-
- /*************************************************************************/
- /* */
- /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
- /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
- /* messages during execution. */
- /* */
-#undef FT_COMPONENT
-#define FT_COMPONENT trace_cffobjs
-
-
- /*************************************************************************/
- /* */
- /* SIZE FUNCTIONS */
- /* */
- /* Note that we store the global hints in the size's `internal' root */
- /* field. */
- /* */
- /*************************************************************************/
-
-
- static PSH_Globals_Funcs
- cff_size_get_globals_funcs( CFF_Size size )
- {
- CFF_Face face = (CFF_Face)size->root.face;
- CFF_Font font = (CFF_Font)face->extra.data;
- PSHinter_Service pshinter = font->pshinter;
- FT_Module module;
-
-
- module = FT_Get_Module( size->root.face->driver->root.library,
- "pshinter" );
- return ( module && pshinter && pshinter->get_globals_funcs )
- ? pshinter->get_globals_funcs( module )
- : 0;
- }
-
-
- FT_LOCAL_DEF( void )
- cff_size_done( FT_Size cffsize ) /* CFF_Size */
- {
- CFF_Size size = (CFF_Size)cffsize;
- CFF_Face face = (CFF_Face)size->root.face;
- CFF_Font font = (CFF_Font)face->extra.data;
- CFF_Internal internal = (CFF_Internal)cffsize->internal;
-
-
- if ( internal )
- {
- PSH_Globals_Funcs funcs;
-
-
- funcs = cff_size_get_globals_funcs( size );
- if ( funcs )
- {
- FT_UInt i;
-
-
- funcs->destroy( internal->topfont );
-
- for ( i = font->num_subfonts; i > 0; i-- )
- funcs->destroy( internal->subfonts[i - 1] );
- }
-
- /* `internal' is freed by destroy_size (in ftobjs.c) */
- }
- }
-
-
- /* CFF and Type 1 private dictionaries have slightly different */
- /* structures; we need to synthesize a Type 1 dictionary on the fly */
-
- static void
- cff_make_private_dict( CFF_SubFont subfont,
- PS_Private priv )
- {
- CFF_Private cpriv = &subfont->private_dict;
- FT_UInt n, count;
-
-
- FT_MEM_ZERO( priv, sizeof ( *priv ) );
-
- count = priv->num_blue_values = cpriv->num_blue_values;
- for ( n = 0; n < count; n++ )
- priv->blue_values[n] = (FT_Short)cpriv->blue_values[n];
-
- count = priv->num_other_blues = cpriv->num_other_blues;
- for ( n = 0; n < count; n++ )
- priv->other_blues[n] = (FT_Short)cpriv->other_blues[n];
-
- count = priv->num_family_blues = cpriv->num_family_blues;
- for ( n = 0; n < count; n++ )
- priv->family_blues[n] = (FT_Short)cpriv->family_blues[n];
-
- count = priv->num_family_other_blues = cpriv->num_family_other_blues;
- for ( n = 0; n < count; n++ )
- priv->family_other_blues[n] = (FT_Short)cpriv->family_other_blues[n];
-
- priv->blue_scale = cpriv->blue_scale;
- priv->blue_shift = (FT_Int)cpriv->blue_shift;
- priv->blue_fuzz = (FT_Int)cpriv->blue_fuzz;
-
- priv->standard_width[0] = (FT_UShort)cpriv->standard_width;
- priv->standard_height[0] = (FT_UShort)cpriv->standard_height;
-
- count = priv->num_snap_widths = cpriv->num_snap_widths;
- for ( n = 0; n < count; n++ )
- priv->snap_widths[n] = (FT_Short)cpriv->snap_widths[n];
-
- count = priv->num_snap_heights = cpriv->num_snap_heights;
- for ( n = 0; n < count; n++ )
- priv->snap_heights[n] = (FT_Short)cpriv->snap_heights[n];
-
- priv->force_bold = cpriv->force_bold;
- priv->language_group = cpriv->language_group;
- priv->lenIV = cpriv->lenIV;
- }
-
-
- FT_LOCAL_DEF( FT_Error )
- cff_size_init( FT_Size cffsize ) /* CFF_Size */
- {
- CFF_Size size = (CFF_Size)cffsize;
- FT_Error error = FT_Err_Ok;
- PSH_Globals_Funcs funcs = cff_size_get_globals_funcs( size );
-
-
- if ( funcs )
- {
- CFF_Face face = (CFF_Face)cffsize->face;
- CFF_Font font = (CFF_Font)face->extra.data;
- CFF_Internal internal = NULL;
-
- PS_PrivateRec priv;
- FT_Memory memory = cffsize->face->memory;
-
- FT_UInt i;
-
-
- if ( FT_NEW( internal ) )
- goto Exit;
-
- cff_make_private_dict( &font->top_font, &priv );
- error = funcs->create( cffsize->face->memory, &priv,
- &internal->topfont );
- if ( error )
- goto Exit;
-
- for ( i = font->num_subfonts; i > 0; i-- )
- {
- CFF_SubFont sub = font->subfonts[i - 1];
-
-
- cff_make_private_dict( sub, &priv );
- error = funcs->create( cffsize->face->memory, &priv,
- &internal->subfonts[i - 1] );
- if ( error )
- goto Exit;
- }
-
- cffsize->internal = (FT_Size_Internal)(void*)internal;
- }
-
- size->strike_index = 0xFFFFFFFFUL;
-
- Exit:
- return error;
- }
-
-
-#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
-
- FT_LOCAL_DEF( FT_Error )
- cff_size_select( FT_Size size,
- FT_ULong strike_index )
- {
- CFF_Size cffsize = (CFF_Size)size;
- PSH_Globals_Funcs funcs;
-
-
- cffsize->strike_index = strike_index;
-
- FT_Select_Metrics( size->face, strike_index );
-
- funcs = cff_size_get_globals_funcs( cffsize );
-
- if ( funcs )
- {
- CFF_Face face = (CFF_Face)size->face;
- CFF_Font font = (CFF_Font)face->extra.data;
- CFF_Internal internal = (CFF_Internal)size->internal;
-
- FT_Long top_upm = (FT_Long)font->top_font.font_dict.units_per_em;
- FT_UInt i;
-
-
- funcs->set_scale( internal->topfont,
- size->metrics.x_scale, size->metrics.y_scale,
- 0, 0 );
-
- for ( i = font->num_subfonts; i > 0; i-- )
- {
- CFF_SubFont sub = font->subfonts[i - 1];
- FT_Long sub_upm = (FT_Long)sub->font_dict.units_per_em;
- FT_Pos x_scale, y_scale;
-
-
- if ( top_upm != sub_upm )
- {
- x_scale = FT_MulDiv( size->metrics.x_scale, top_upm, sub_upm );
- y_scale = FT_MulDiv( size->metrics.y_scale, top_upm, sub_upm );
- }
- else
- {
- x_scale = size->metrics.x_scale;
- y_scale = size->metrics.y_scale;
- }
-
- funcs->set_scale( internal->subfonts[i - 1],
- x_scale, y_scale, 0, 0 );
- }
- }
-
- return FT_Err_Ok;
- }
-
-#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
-
-
- FT_LOCAL_DEF( FT_Error )
- cff_size_request( FT_Size size,
- FT_Size_Request req )
- {
- CFF_Size cffsize = (CFF_Size)size;
- PSH_Globals_Funcs funcs;
-
-
-#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
-
- if ( FT_HAS_FIXED_SIZES( size->face ) )
- {
- CFF_Face cffface = (CFF_Face)size->face;
- SFNT_Service sfnt = (SFNT_Service)cffface->sfnt;
- FT_ULong strike_index;
-
-
- if ( sfnt->set_sbit_strike( cffface, req, &strike_index ) )
- cffsize->strike_index = 0xFFFFFFFFUL;
- else
- return cff_size_select( size, strike_index );
- }
-
-#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
-
- FT_Request_Metrics( size->face, req );
-
- funcs = cff_size_get_globals_funcs( cffsize );
-
- if ( funcs )
- {
- CFF_Face cffface = (CFF_Face)size->face;
- CFF_Font font = (CFF_Font)cffface->extra.data;
- CFF_Internal internal = (CFF_Internal)size->internal;
-
- FT_Long top_upm = (FT_Long)font->top_font.font_dict.units_per_em;
- FT_UInt i;
-
-
- funcs->set_scale( internal->topfont,
- size->metrics.x_scale, size->metrics.y_scale,
- 0, 0 );
-
- for ( i = font->num_subfonts; i > 0; i-- )
- {
- CFF_SubFont sub = font->subfonts[i - 1];
- FT_Long sub_upm = (FT_Long)sub->font_dict.units_per_em;
- FT_Pos x_scale, y_scale;
-
-
- if ( top_upm != sub_upm )
- {
- x_scale = FT_MulDiv( size->metrics.x_scale, top_upm, sub_upm );
- y_scale = FT_MulDiv( size->metrics.y_scale, top_upm, sub_upm );
- }
- else
- {
- x_scale = size->metrics.x_scale;
- y_scale = size->metrics.y_scale;
- }
-
- funcs->set_scale( internal->subfonts[i - 1],
- x_scale, y_scale, 0, 0 );
- }
- }
-
- return FT_Err_Ok;
- }
-
-
- /*************************************************************************/
- /* */
- /* SLOT FUNCTIONS */
- /* */
- /*************************************************************************/
-
- FT_LOCAL_DEF( void )
- cff_slot_done( FT_GlyphSlot slot )
- {
- slot->internal->glyph_hints = NULL;
- }
-
-
- FT_LOCAL_DEF( FT_Error )
- cff_slot_init( FT_GlyphSlot slot )
- {
- CFF_Face face = (CFF_Face)slot->face;
- CFF_Font font = (CFF_Font)face->extra.data;
- PSHinter_Service pshinter = font->pshinter;
-
-
- if ( pshinter )
- {
- FT_Module module;
-
-
- module = FT_Get_Module( slot->face->driver->root.library,
- "pshinter" );
- if ( module )
- {
- T2_Hints_Funcs funcs;
-
-
- funcs = pshinter->get_t2_funcs( module );
- slot->internal->glyph_hints = (void*)funcs;
- }
- }
-
- return FT_Err_Ok;
- }
-
-
- /*************************************************************************/
- /* */
- /* FACE FUNCTIONS */
- /* */
- /*************************************************************************/
-
- static FT_String*
- cff_strcpy( FT_Memory memory,
- const FT_String* source )
- {
- FT_Error error;
- FT_String* result;
-
-
- (void)FT_STRDUP( result, source );
-
- FT_UNUSED( error );
-
- return result;
- }
-
-
- /* Strip all subset prefixes of the form `ABCDEF+'. Usually, there */
- /* is only one, but font names like `APCOOG+JFABTD+FuturaBQ-Bold' */
- /* have been seen in the wild. */
-
- static void
- remove_subset_prefix( FT_String* name )
- {
- FT_Int32 idx = 0;
- FT_Int32 length = (FT_Int32)strlen( name ) + 1;
- FT_Bool continue_search = 1;
-
-
- while ( continue_search )
- {
- if ( length >= 7 && name[6] == '+' )
- {
- for ( idx = 0; idx < 6; idx++ )
- {
- /* ASCII uppercase letters */
- if ( !( 'A' <= name[idx] && name[idx] <= 'Z' ) )
- continue_search = 0;
- }
-
- if ( continue_search )
- {
- for ( idx = 7; idx < length; idx++ )
- name[idx - 7] = name[idx];
- length -= 7;
- }
- }
- else
- continue_search = 0;
- }
- }
-
-
- /* Remove the style part from the family name (if present). */
-
- static void
- remove_style( FT_String* family_name,
- const FT_String* style_name )
- {
- FT_Int32 family_name_length, style_name_length;
-
-
- family_name_length = (FT_Int32)strlen( family_name );
- style_name_length = (FT_Int32)strlen( style_name );
-
- if ( family_name_length > style_name_length )
- {
- FT_Int idx;
-
-
- for ( idx = 1; idx <= style_name_length; ++idx )
- {
- if ( family_name[family_name_length - idx] !=
- style_name[style_name_length - idx] )
- break;
- }
-
- if ( idx > style_name_length )
- {
- /* family_name ends with style_name; remove it */
- idx = family_name_length - style_name_length - 1;
-
- /* also remove special characters */
- /* between real family name and style */
- while ( idx > 0 &&
- ( family_name[idx] == '-' ||
- family_name[idx] == ' ' ||
- family_name[idx] == '_' ||
- family_name[idx] == '+' ) )
- --idx;
-
- if ( idx > 0 )
- family_name[idx + 1] = '\0';
- }
- }
- }
-
-
- FT_LOCAL_DEF( FT_Error )
- cff_face_init( FT_Stream stream,
- FT_Face cffface, /* CFF_Face */
- FT_Int face_index,
- FT_Int num_params,
- FT_Parameter* params )
- {
- CFF_Face face = (CFF_Face)cffface;
- FT_Error error;
- SFNT_Service sfnt;
- FT_Service_PsCMaps psnames;
- PSHinter_Service pshinter;
- FT_Bool pure_cff = 1;
- FT_Bool sfnt_format = 0;
- FT_Library library = cffface->driver->root.library;
-
-
- sfnt = (SFNT_Service)FT_Get_Module_Interface(
- library, "sfnt" );
- if ( !sfnt )
- {
- FT_ERROR(( "cff_face_init: cannot access `sfnt' module\n" ));
- error = FT_THROW( Missing_Module );
- goto Exit;
- }
-
- FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS );
-
- pshinter = (PSHinter_Service)FT_Get_Module_Interface(
- library, "pshinter" );
-
- FT_TRACE2(( "CFF driver\n" ));
-
- /* create input stream from resource */
- if ( FT_STREAM_SEEK( 0 ) )
- goto Exit;
-
- /* check whether we have a valid OpenType file */
- error = sfnt->init_face( stream, face, face_index, num_params, params );
- if ( !error )
- {
- if ( face->format_tag != TTAG_OTTO ) /* `OTTO'; OpenType/CFF font */
- {
- FT_TRACE2(( " not an OpenType/CFF font\n" ));
- error = FT_THROW( Unknown_File_Format );
- goto Exit;
- }
-
- /* if we are performing a simple font format check, exit immediately */
- if ( face_index < 0 )
- return FT_Err_Ok;
-
- sfnt_format = 1;
-
- /* now, the font can be either an OpenType/CFF font, or an SVG CEF */
- /* font; in the latter case it doesn't have a `head' table */
- error = face->goto_table( face, TTAG_head, stream, 0 );
- if ( !error )
- {
- pure_cff = 0;
-
- /* load font directory */
- error = sfnt->load_face( stream, face, face_index,
- num_params, params );
- if ( error )
- goto Exit;
- }
- else
- {
- /* load the `cmap' table explicitly */
- error = sfnt->load_cmap( face, stream );
- if ( error )
- goto Exit;
- }
-
- /* now load the CFF part of the file */
- error = face->goto_table( face, TTAG_CFF, stream, 0 );
- if ( error )
- goto Exit;
- }
- else
- {
- /* rewind to start of file; we are going to load a pure-CFF font */
- if ( FT_STREAM_SEEK( 0 ) )
- goto Exit;
- error = FT_Err_Ok;
- }
-
- /* now load and parse the CFF table in the file */
- {
- CFF_Font cff = NULL;
- CFF_FontRecDict dict;
- FT_Memory memory = cffface->memory;
- FT_Int32 flags;
- FT_UInt i;
-
-
- if ( FT_NEW( cff ) )
- goto Exit;
-
- face->extra.data = cff;
- error = cff_font_load( library, stream, face_index, cff, pure_cff );
- if ( error )
- goto Exit;
-
- /* if we are performing a simple font format check, exit immediately */
- /* (this is here for pure CFF) */
- if ( face_index < 0 )
- return FT_Err_Ok;
-
- cff->pshinter = pshinter;
- cff->psnames = psnames;
-
- cffface->face_index = face_index & 0xFFFF;
-
- /* Complement the root flags with some interesting information. */
- /* Note that this is only necessary for pure CFF and CEF fonts; */
- /* SFNT based fonts use the `name' table instead. */
-
- cffface->num_glyphs = (FT_Long)cff->num_glyphs;
-
- dict = &cff->top_font.font_dict;
-
- /* we need the `PSNames' module for CFF and CEF formats */
- /* which aren't CID-keyed */
- if ( dict->cid_registry == 0xFFFFU && !psnames )
- {
- FT_ERROR(( "cff_face_init:"
- " cannot open CFF & CEF fonts\n"
- " "
- " without the `PSNames' module\n" ));
- error = FT_THROW( Missing_Module );
- goto Exit;
- }
-
-#ifdef FT_DEBUG_LEVEL_TRACE
- {
- FT_UInt idx;
- FT_String* s;
-
-
- FT_TRACE4(( "SIDs\n" ));
-
- /* dump string index, including default strings for convenience */
- for ( idx = 0; idx < cff->num_strings + 390; idx++ )
- {
- s = cff_index_get_sid_string( cff, idx );
- if ( s )
- FT_TRACE4((" %5d %s\n", idx, s ));
- }
- }
-#endif /* FT_DEBUG_LEVEL_TRACE */
-
- if ( !dict->has_font_matrix )
- dict->units_per_em = pure_cff ? 1000 : face->root.units_per_EM;
-
- /* Normalize the font matrix so that `matrix->yy' is 1; the */
- /* scaling is done with `units_per_em' then (at this point, */
- /* it already contains the scaling factor, but without */
- /* normalization of the matrix). */
- /* */
- /* Note that the offsets must be expressed in integer font */
- /* units. */
-
- {
- FT_Matrix* matrix = &dict->font_matrix;
- FT_Vector* offset = &dict->font_offset;
- FT_ULong* upm = &dict->units_per_em;
- FT_Fixed temp = FT_ABS( matrix->yy );
-
-
- if ( temp != 0x10000L )
- {
- *upm = (FT_ULong)FT_DivFix( (FT_Long)*upm, temp );
-
- matrix->xx = FT_DivFix( matrix->xx, temp );
- matrix->yx = FT_DivFix( matrix->yx, temp );
- matrix->xy = FT_DivFix( matrix->xy, temp );
- matrix->yy = FT_DivFix( matrix->yy, temp );
- offset->x = FT_DivFix( offset->x, temp );
- offset->y = FT_DivFix( offset->y, temp );
- }
-
- offset->x >>= 16;
- offset->y >>= 16;
- }
-
- for ( i = cff->num_subfonts; i > 0; i-- )
- {
- CFF_FontRecDict sub = &cff->subfonts[i - 1]->font_dict;
- CFF_FontRecDict top = &cff->top_font.font_dict;
-
- FT_Matrix* matrix;
- FT_Vector* offset;
- FT_ULong* upm;
- FT_Fixed temp;
-
-
- if ( sub->has_font_matrix )
- {
- FT_Long scaling;
-
-
- /* if we have a top-level matrix, */
- /* concatenate the subfont matrix */
-
- if ( top->has_font_matrix )
- {
- if ( top->units_per_em > 1 && sub->units_per_em > 1 )
- scaling = (FT_Long)FT_MIN( top->units_per_em,
- sub->units_per_em );
- else
- scaling = 1;
-
- FT_Matrix_Multiply_Scaled( &top->font_matrix,
- &sub->font_matrix,
- scaling );
- FT_Vector_Transform_Scaled( &sub->font_offset,
- &top->font_matrix,
- scaling );
-
- sub->units_per_em = (FT_ULong)
- FT_MulDiv( (FT_Long)sub->units_per_em,
- (FT_Long)top->units_per_em,
- scaling );
- }
- }
- else
- {
- sub->font_matrix = top->font_matrix;
- sub->font_offset = top->font_offset;
-
- sub->units_per_em = top->units_per_em;
- }
-
- matrix = &sub->font_matrix;
- offset = &sub->font_offset;
- upm = &sub->units_per_em;
- temp = FT_ABS( matrix->yy );
-
- if ( temp != 0x10000L )
- {
- *upm = (FT_ULong)FT_DivFix( (FT_Long)*upm, temp );
-
- matrix->xx = FT_DivFix( matrix->xx, temp );
- matrix->yx = FT_DivFix( matrix->yx, temp );
- matrix->xy = FT_DivFix( matrix->xy, temp );
- matrix->yy = FT_DivFix( matrix->yy, temp );
- offset->x = FT_DivFix( offset->x, temp );
- offset->y = FT_DivFix( offset->y, temp );
- }
-
- offset->x >>= 16;
- offset->y >>= 16;
- }
-
- if ( pure_cff )
- {
- char* style_name = NULL;
-
-
- /* set up num_faces */
- cffface->num_faces = (FT_Long)cff->num_faces;
-
- /* compute number of glyphs */
- if ( dict->cid_registry != 0xFFFFU )
- cffface->num_glyphs = (FT_Long)( cff->charset.max_cid + 1 );
- else
- cffface->num_glyphs = (FT_Long)cff->charstrings_index.count;
-
- /* set global bbox, as well as EM size */
- cffface->bbox.xMin = dict->font_bbox.xMin >> 16;
- cffface->bbox.yMin = dict->font_bbox.yMin >> 16;
- /* no `U' suffix here to 0xFFFF! */
- cffface->bbox.xMax = ( dict->font_bbox.xMax + 0xFFFF ) >> 16;
- cffface->bbox.yMax = ( dict->font_bbox.yMax + 0xFFFF ) >> 16;
-
- cffface->units_per_EM = (FT_UShort)( dict->units_per_em );
-
- cffface->ascender = (FT_Short)( cffface->bbox.yMax );
- cffface->descender = (FT_Short)( cffface->bbox.yMin );
-
- cffface->height = (FT_Short)( ( cffface->units_per_EM * 12 ) / 10 );
- if ( cffface->height < cffface->ascender - cffface->descender )
- cffface->height = (FT_Short)( cffface->ascender - cffface->descender );
-
- cffface->underline_position =
- (FT_Short)( dict->underline_position >> 16 );
- cffface->underline_thickness =
- (FT_Short)( dict->underline_thickness >> 16 );
-
- /* retrieve font family & style name */
- cffface->family_name = cff_index_get_name(
- cff,
- (FT_UInt)( face_index & 0xFFFF ) );
- if ( cffface->family_name )
- {
- char* full = cff_index_get_sid_string( cff,
- dict->full_name );
- char* fullp = full;
- char* family = cffface->family_name;
- char* family_name = NULL;
-
-
- remove_subset_prefix( cffface->family_name );
-
- if ( dict->family_name )
- {
- family_name = cff_index_get_sid_string( cff,
- dict->family_name );
- if ( family_name )
- family = family_name;
- }
-
- /* We try to extract the style name from the full name. */
- /* We need to ignore spaces and dashes during the search. */
- if ( full && family )
- {
- while ( *fullp )
- {
- /* skip common characters at the start of both strings */
- if ( *fullp == *family )
- {
- family++;
- fullp++;
- continue;
- }
-
- /* ignore spaces and dashes in full name during comparison */
- if ( *fullp == ' ' || *fullp == '-' )
- {
- fullp++;
- continue;
- }
-
- /* ignore spaces and dashes in family name during comparison */
- if ( *family == ' ' || *family == '-' )
- {
- family++;
- continue;
- }
-
- if ( !*family && *fullp )
- {
- /* The full name begins with the same characters as the */
- /* family name, with spaces and dashes removed. In this */
- /* case, the remaining string in `fullp' will be used as */
- /* the style name. */
- style_name = cff_strcpy( memory, fullp );
-
- /* remove the style part from the family name (if present) */
- remove_style( cffface->family_name, style_name );
- }
- break;
- }
- }
- }
- else
- {
- char *cid_font_name =
- cff_index_get_sid_string( cff,
- dict->cid_font_name );
-
-
- /* do we have a `/FontName' for a CID-keyed font? */
- if ( cid_font_name )
- cffface->family_name = cff_strcpy( memory, cid_font_name );
- }
-
- if ( style_name )
- cffface->style_name = style_name;
- else
- /* assume "Regular" style if we don't know better */
- cffface->style_name = cff_strcpy( memory, (char *)"Regular" );
-
- /*******************************************************************/
- /* */
- /* Compute face flags. */
- /* */
- flags = FT_FACE_FLAG_SCALABLE | /* scalable outlines */
- FT_FACE_FLAG_HORIZONTAL | /* horizontal data */
- FT_FACE_FLAG_HINTER; /* has native hinter */
-
- if ( sfnt_format )
- flags |= FT_FACE_FLAG_SFNT;
-
- /* fixed width font? */
- if ( dict->is_fixed_pitch )
- flags |= FT_FACE_FLAG_FIXED_WIDTH;
-
- /* XXX: WE DO NOT SUPPORT KERNING METRICS IN THE GPOS TABLE FOR NOW */
-#if 0
- /* kerning available? */
- if ( face->kern_pairs )
- flags |= FT_FACE_FLAG_KERNING;
-#endif
-
- cffface->face_flags |= flags;
-
- /*******************************************************************/
- /* */
- /* Compute style flags. */
- /* */
- flags = 0;
-
- if ( dict->italic_angle )
- flags |= FT_STYLE_FLAG_ITALIC;
-
- {
- char *weight = cff_index_get_sid_string( cff,
- dict->weight );
-
-
- if ( weight )
- if ( !ft_strcmp( weight, "Bold" ) ||
- !ft_strcmp( weight, "Black" ) )
- flags |= FT_STYLE_FLAG_BOLD;
- }
-
- /* double check */
- if ( !(flags & FT_STYLE_FLAG_BOLD) && cffface->style_name )
- if ( !ft_strncmp( cffface->style_name, "Bold", 4 ) ||
- !ft_strncmp( cffface->style_name, "Black", 5 ) )
- flags |= FT_STYLE_FLAG_BOLD;
-
- cffface->style_flags = flags;
- }
-
-
-#ifndef FT_CONFIG_OPTION_NO_GLYPH_NAMES
- /* CID-keyed CFF fonts don't have glyph names -- the SFNT loader */
- /* has unset this flag because of the 3.0 `post' table. */
- if ( dict->cid_registry == 0xFFFFU )
- cffface->face_flags |= FT_FACE_FLAG_GLYPH_NAMES;
-#endif
-
- if ( dict->cid_registry != 0xFFFFU && pure_cff )
- cffface->face_flags |= FT_FACE_FLAG_CID_KEYED;
-
-
- /*******************************************************************/
- /* */
- /* Compute char maps. */
- /* */
-
- /* Try to synthesize a Unicode charmap if there is none available */
- /* already. If an OpenType font contains a Unicode "cmap", we */
- /* will use it, whatever be in the CFF part of the file. */
- {
- FT_CharMapRec cmaprec;
- FT_CharMap cmap;
- FT_UInt nn;
- CFF_Encoding encoding = &cff->encoding;
-
-
- for ( nn = 0; nn < (FT_UInt)cffface->num_charmaps; nn++ )
- {
- cmap = cffface->charmaps[nn];
-
- /* Windows Unicode? */
- if ( cmap->platform_id == TT_PLATFORM_MICROSOFT &&
- cmap->encoding_id == TT_MS_ID_UNICODE_CS )
- goto Skip_Unicode;
-
- /* Apple Unicode platform id? */
- if ( cmap->platform_id == TT_PLATFORM_APPLE_UNICODE )
- goto Skip_Unicode; /* Apple Unicode */
- }
-
- /* since CID-keyed fonts don't contain glyph names, we can't */
- /* construct a cmap */
- if ( pure_cff && cff->top_font.font_dict.cid_registry != 0xFFFFU )
- goto Exit;
-
- /* we didn't find a Unicode charmap -- synthesize one */
- cmaprec.face = cffface;
- cmaprec.platform_id = TT_PLATFORM_MICROSOFT;
- cmaprec.encoding_id = TT_MS_ID_UNICODE_CS;
- cmaprec.encoding = FT_ENCODING_UNICODE;
-
- nn = (FT_UInt)cffface->num_charmaps;
-
- error = FT_CMap_New( &CFF_CMAP_UNICODE_CLASS_REC_GET, NULL,
- &cmaprec, NULL );
- if ( error &&
- FT_ERR_NEQ( error, No_Unicode_Glyph_Name ) )
- goto Exit;
- error = FT_Err_Ok;
-
- /* if no Unicode charmap was previously selected, select this one */
- if ( cffface->charmap == NULL && nn != (FT_UInt)cffface->num_charmaps )
- cffface->charmap = cffface->charmaps[nn];
-
- Skip_Unicode:
- if ( encoding->count > 0 )
- {
- FT_CMap_Class clazz;
-
-
- cmaprec.face = cffface;
- cmaprec.platform_id = TT_PLATFORM_ADOBE; /* Adobe platform id */
-
- if ( encoding->offset == 0 )
- {
- cmaprec.encoding_id = TT_ADOBE_ID_STANDARD;
- cmaprec.encoding = FT_ENCODING_ADOBE_STANDARD;
- clazz = &CFF_CMAP_ENCODING_CLASS_REC_GET;
- }
- else if ( encoding->offset == 1 )
- {
- cmaprec.encoding_id = TT_ADOBE_ID_EXPERT;
- cmaprec.encoding = FT_ENCODING_ADOBE_EXPERT;
- clazz = &CFF_CMAP_ENCODING_CLASS_REC_GET;
- }
- else
- {
- cmaprec.encoding_id = TT_ADOBE_ID_CUSTOM;
- cmaprec.encoding = FT_ENCODING_ADOBE_CUSTOM;
- clazz = &CFF_CMAP_ENCODING_CLASS_REC_GET;
- }
-
- error = FT_CMap_New( clazz, NULL, &cmaprec, NULL );
- }
- }
- }
-
- Exit:
- return error;
- }
-
-
- FT_LOCAL_DEF( void )
- cff_face_done( FT_Face cffface ) /* CFF_Face */
- {
- CFF_Face face = (CFF_Face)cffface;
- FT_Memory memory;
- SFNT_Service sfnt;
-
-
- if ( !face )
- return;
-
- memory = cffface->memory;
- sfnt = (SFNT_Service)face->sfnt;
-
- if ( sfnt )
- sfnt->done_face( face );
-
- {
- CFF_Font cff = (CFF_Font)face->extra.data;
-
-
- if ( cff )
- {
- cff_font_done( cff );
- FT_FREE( face->extra.data );
- }
- }
- }
-
-
- FT_LOCAL_DEF( FT_Error )
- cff_driver_init( FT_Module module ) /* CFF_Driver */
- {
- CFF_Driver driver = (CFF_Driver)module;
-
-
- /* set default property values, cf. `ftcffdrv.h' */
-#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
- driver->hinting_engine = FT_CFF_HINTING_FREETYPE;
-#else
- driver->hinting_engine = FT_CFF_HINTING_ADOBE;
-#endif
-
- driver->no_stem_darkening = FALSE;
-
- driver->darken_params[0] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_X1;
- driver->darken_params[1] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y1;
- driver->darken_params[2] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_X2;
- driver->darken_params[3] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y2;
- driver->darken_params[4] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_X3;
- driver->darken_params[5] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y3;
- driver->darken_params[6] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_X4;
- driver->darken_params[7] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y4;
-
- return FT_Err_Ok;
- }
-
-
- FT_LOCAL_DEF( void )
- cff_driver_done( FT_Module module ) /* CFF_Driver */
- {
- FT_UNUSED( module );
- }
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/cff/cffobjs.h b/chromium/third_party/pdfium/third_party/freetype/src/cff/cffobjs.h
deleted file mode 100644
index 3cc953143b6..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/cff/cffobjs.h
+++ /dev/null
@@ -1,185 +0,0 @@
-/***************************************************************************/
-/* */
-/* cffobjs.h */
-/* */
-/* OpenType objects manager (specification). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __CFFOBJS_H__
-#define __CFFOBJS_H__
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_OBJECTS_H
-#include "cfftypes.h"
-#include FT_INTERNAL_TRUETYPE_TYPES_H
-#include FT_SERVICE_POSTSCRIPT_CMAPS_H
-#include FT_INTERNAL_POSTSCRIPT_HINTS_H
-
-
-FT_BEGIN_HEADER
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* CFF_Driver */
- /* */
- /* <Description> */
- /* A handle to an OpenType driver object. */
- /* */
- typedef struct CFF_DriverRec_* CFF_Driver;
-
- typedef TT_Face CFF_Face;
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* CFF_Size */
- /* */
- /* <Description> */
- /* A handle to an OpenType size object. */
- /* */
- typedef struct CFF_SizeRec_
- {
- FT_SizeRec root;
- FT_ULong strike_index; /* 0xFFFFFFFF to indicate invalid */
-
- } CFF_SizeRec, *CFF_Size;
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* CFF_GlyphSlot */
- /* */
- /* <Description> */
- /* A handle to an OpenType glyph slot object. */
- /* */
- typedef struct CFF_GlyphSlotRec_
- {
- FT_GlyphSlotRec root;
-
- FT_Bool hint;
- FT_Bool scaled;
-
- FT_Fixed x_scale;
- FT_Fixed y_scale;
-
- } CFF_GlyphSlotRec, *CFF_GlyphSlot;
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* CFF_Internal */
- /* */
- /* <Description> */
- /* The interface to the `internal' field of `FT_Size'. */
- /* */
- typedef struct CFF_InternalRec_
- {
- PSH_Globals topfont;
- PSH_Globals subfonts[CFF_MAX_CID_FONTS];
-
- } CFF_InternalRec, *CFF_Internal;
-
-
- /*************************************************************************/
- /* */
- /* Subglyph transformation record. */
- /* */
- typedef struct CFF_Transform_
- {
- FT_Fixed xx, xy; /* transformation matrix coefficients */
- FT_Fixed yx, yy;
- FT_F26Dot6 ox, oy; /* offsets */
-
- } CFF_Transform;
-
-
- /***********************************************************************/
- /* */
- /* CFF driver class. */
- /* */
- typedef struct CFF_DriverRec_
- {
- FT_DriverRec root;
-
- FT_UInt hinting_engine;
- FT_Bool no_stem_darkening;
-
- FT_Int darken_params[8];
-
- } CFF_DriverRec;
-
-
- FT_LOCAL( FT_Error )
- cff_size_init( FT_Size size ); /* CFF_Size */
-
- FT_LOCAL( void )
- cff_size_done( FT_Size size ); /* CFF_Size */
-
- FT_LOCAL( FT_Error )
- cff_size_request( FT_Size size,
- FT_Size_Request req );
-
-#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
-
- FT_LOCAL( FT_Error )
- cff_size_select( FT_Size size,
- FT_ULong strike_index );
-
-#endif
-
- FT_LOCAL( void )
- cff_slot_done( FT_GlyphSlot slot );
-
- FT_LOCAL( FT_Error )
- cff_slot_init( FT_GlyphSlot slot );
-
-
- /*************************************************************************/
- /* */
- /* Face functions */
- /* */
- FT_LOCAL( FT_Error )
- cff_face_init( FT_Stream stream,
- FT_Face face, /* CFF_Face */
- FT_Int face_index,
- FT_Int num_params,
- FT_Parameter* params );
-
- FT_LOCAL( void )
- cff_face_done( FT_Face face ); /* CFF_Face */
-
-
- /*************************************************************************/
- /* */
- /* Driver functions */
- /* */
- FT_LOCAL( FT_Error )
- cff_driver_init( FT_Module module ); /* CFF_Driver */
-
- FT_LOCAL( void )
- cff_driver_done( FT_Module module ); /* CFF_Driver */
-
-
-FT_END_HEADER
-
-#endif /* __CFFOBJS_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/cff/cffparse.c b/chromium/third_party/pdfium/third_party/freetype/src/cff/cffparse.c
deleted file mode 100644
index 063b3517c53..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/cff/cffparse.c
+++ /dev/null
@@ -1,1193 +0,0 @@
-/***************************************************************************/
-/* */
-/* cffparse.c */
-/* */
-/* CFF token stream parser (body) */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include "cffparse.h"
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_DEBUG_H
-
-#include "cfferrs.h"
-#include "cffpic.h"
-
-
- /*************************************************************************/
- /* */
- /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
- /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
- /* messages during execution. */
- /* */
-#undef FT_COMPONENT
-#define FT_COMPONENT trace_cffparse
-
-
- FT_LOCAL_DEF( void )
- cff_parser_init( CFF_Parser parser,
- FT_UInt code,
- void* object,
- FT_Library library)
- {
- FT_MEM_ZERO( parser, sizeof ( *parser ) );
-
- parser->top = parser->stack;
- parser->object_code = code;
- parser->object = object;
- parser->library = library;
- }
-
-
- /* read an integer */
- static FT_Long
- cff_parse_integer( FT_Byte* start,
- FT_Byte* limit )
- {
- FT_Byte* p = start;
- FT_Int v = *p++;
- FT_Long val = 0;
-
-
- if ( v == 28 )
- {
- if ( p + 2 > limit )
- goto Bad;
-
- val = (FT_Short)( ( (FT_UShort)p[0] << 8 ) | p[1] );
- }
- else if ( v == 29 )
- {
- if ( p + 4 > limit )
- goto Bad;
-
- val = (FT_Long)( ( (FT_ULong)p[0] << 24 ) |
- ( (FT_ULong)p[1] << 16 ) |
- ( (FT_ULong)p[2] << 8 ) |
- (FT_ULong)p[3] );
- }
- else if ( v < 247 )
- {
- val = v - 139;
- }
- else if ( v < 251 )
- {
- if ( p + 1 > limit )
- goto Bad;
-
- val = ( v - 247 ) * 256 + p[0] + 108;
- }
- else
- {
- if ( p + 1 > limit )
- goto Bad;
-
- val = -( v - 251 ) * 256 - p[0] - 108;
- }
-
- Exit:
- return val;
-
- Bad:
- val = 0;
- FT_TRACE4(( "!!!END OF DATA:!!!" ));
- goto Exit;
- }
-
-
- static const FT_Long power_tens[] =
- {
- 1L,
- 10L,
- 100L,
- 1000L,
- 10000L,
- 100000L,
- 1000000L,
- 10000000L,
- 100000000L,
- 1000000000L
- };
-
-
- /* read a real */
- static FT_Fixed
- cff_parse_real( FT_Byte* start,
- FT_Byte* limit,
- FT_Long power_ten,
- FT_Long* scaling )
- {
- FT_Byte* p = start;
- FT_Int nib;
- FT_UInt phase;
-
- FT_Long result, number, exponent;
- FT_Int sign = 0, exponent_sign = 0, have_overflow = 0;
- FT_Long exponent_add, integer_length, fraction_length;
-
-
- if ( scaling )
- *scaling = 0;
-
- result = 0;
-
- number = 0;
- exponent = 0;
-
- exponent_add = 0;
- integer_length = 0;
- fraction_length = 0;
-
- /* First of all, read the integer part. */
- phase = 4;
-
- for (;;)
- {
- /* If we entered this iteration with phase == 4, we need to */
- /* read a new byte. This also skips past the initial 0x1E. */
- if ( phase )
- {
- p++;
-
- /* Make sure we don't read past the end. */
- if ( p >= limit )
- goto Bad;
- }
-
- /* Get the nibble. */
- nib = (FT_Int)( p[0] >> phase ) & 0xF;
- phase = 4 - phase;
-
- if ( nib == 0xE )
- sign = 1;
- else if ( nib > 9 )
- break;
- else
- {
- /* Increase exponent if we can't add the digit. */
- if ( number >= 0xCCCCCCCL )
- exponent_add++;
- /* Skip leading zeros. */
- else if ( nib || number )
- {
- integer_length++;
- number = number * 10 + nib;
- }
- }
- }
-
- /* Read fraction part, if any. */
- if ( nib == 0xA )
- for (;;)
- {
- /* If we entered this iteration with phase == 4, we need */
- /* to read a new byte. */
- if ( phase )
- {
- p++;
-
- /* Make sure we don't read past the end. */
- if ( p >= limit )
- goto Bad;
- }
-
- /* Get the nibble. */
- nib = ( p[0] >> phase ) & 0xF;
- phase = 4 - phase;
- if ( nib >= 10 )
- break;
-
- /* Skip leading zeros if possible. */
- if ( !nib && !number )
- exponent_add--;
- /* Only add digit if we don't overflow. */
- else if ( number < 0xCCCCCCCL && fraction_length < 9 )
- {
- fraction_length++;
- number = number * 10 + nib;
- }
- }
-
- /* Read exponent, if any. */
- if ( nib == 12 )
- {
- exponent_sign = 1;
- nib = 11;
- }
-
- if ( nib == 11 )
- {
- for (;;)
- {
- /* If we entered this iteration with phase == 4, */
- /* we need to read a new byte. */
- if ( phase )
- {
- p++;
-
- /* Make sure we don't read past the end. */
- if ( p >= limit )
- goto Bad;
- }
-
- /* Get the nibble. */
- nib = ( p[0] >> phase ) & 0xF;
- phase = 4 - phase;
- if ( nib >= 10 )
- break;
-
- /* Arbitrarily limit exponent. */
- if ( exponent > 1000 )
- have_overflow = 1;
- else
- exponent = exponent * 10 + nib;
- }
-
- if ( exponent_sign )
- exponent = -exponent;
- }
-
- if ( !number )
- goto Exit;
-
- if ( have_overflow )
- {
- if ( exponent_sign )
- goto Underflow;
- else
- goto Overflow;
- }
-
- /* We don't check `power_ten' and `exponent_add'. */
- exponent += power_ten + exponent_add;
-
- if ( scaling )
- {
- /* Only use `fraction_length'. */
- fraction_length += integer_length;
- exponent += integer_length;
-
- if ( fraction_length <= 5 )
- {
- if ( number > 0x7FFFL )
- {
- result = FT_DivFix( number, 10 );
- *scaling = exponent - fraction_length + 1;
- }
- else
- {
- if ( exponent > 0 )
- {
- FT_Long new_fraction_length, shift;
-
-
- /* Make `scaling' as small as possible. */
- new_fraction_length = FT_MIN( exponent, 5 );
- shift = new_fraction_length - fraction_length;
-
- if ( shift > 0 )
- {
- exponent -= new_fraction_length;
- number *= power_tens[shift];
- if ( number > 0x7FFFL )
- {
- number /= 10;
- exponent += 1;
- }
- }
- else
- exponent -= fraction_length;
- }
- else
- exponent -= fraction_length;
-
- result = (FT_Long)( (FT_ULong)number << 16 );
- *scaling = exponent;
- }
- }
- else
- {
- if ( ( number / power_tens[fraction_length - 5] ) > 0x7FFFL )
- {
- result = FT_DivFix( number, power_tens[fraction_length - 4] );
- *scaling = exponent - 4;
- }
- else
- {
- result = FT_DivFix( number, power_tens[fraction_length - 5] );
- *scaling = exponent - 5;
- }
- }
- }
- else
- {
- integer_length += exponent;
- fraction_length -= exponent;
-
- if ( integer_length > 5 )
- goto Overflow;
- if ( integer_length < -5 )
- goto Underflow;
-
- /* Remove non-significant digits. */
- if ( integer_length < 0 )
- {
- number /= power_tens[-integer_length];
- fraction_length += integer_length;
- }
-
- /* this can only happen if exponent was non-zero */
- if ( fraction_length == 10 )
- {
- number /= 10;
- fraction_length -= 1;
- }
-
- /* Convert into 16.16 format. */
- if ( fraction_length > 0 )
- {
- if ( ( number / power_tens[fraction_length] ) > 0x7FFFL )
- goto Exit;
-
- result = FT_DivFix( number, power_tens[fraction_length] );
- }
- else
- {
- number *= power_tens[-fraction_length];
-
- if ( number > 0x7FFFL )
- goto Overflow;
-
- result = (FT_Long)( (FT_ULong)number << 16 );
- }
- }
-
- Exit:
- if ( sign )
- result = -result;
-
- return result;
-
- Overflow:
- result = 0x7FFFFFFFL;
- FT_TRACE4(( "!!!OVERFLOW:!!!" ));
- goto Exit;
-
- Underflow:
- result = 0;
- FT_TRACE4(( "!!!UNDERFLOW:!!!" ));
- goto Exit;
-
- Bad:
- result = 0;
- FT_TRACE4(( "!!!END OF DATA:!!!" ));
- goto Exit;
- }
-
-
- /* read a number, either integer or real */
- static FT_Long
- cff_parse_num( FT_Byte** d )
- {
- return **d == 30 ? ( cff_parse_real( d[0], d[1], 0, NULL ) >> 16 )
- : cff_parse_integer( d[0], d[1] );
- }
-
-
- /* read a floating point number, either integer or real */
- static FT_Fixed
- do_fixed( FT_Byte** d,
- FT_Long scaling )
- {
- if ( **d == 30 )
- return cff_parse_real( d[0], d[1], scaling, NULL );
- else
- {
- FT_Long val = cff_parse_integer( d[0], d[1] );
-
-
- if ( scaling )
- val *= power_tens[scaling];
-
- if ( val > 0x7FFF )
- {
- val = 0x7FFFFFFFL;
- goto Overflow;
- }
- else if ( val < -0x7FFF )
- {
- val = -0x7FFFFFFFL;
- goto Overflow;
- }
-
- return (FT_Long)( (FT_ULong)val << 16 );
-
- Overflow:
- FT_TRACE4(( "!!!OVERFLOW:!!!" ));
- return val;
- }
- }
-
-
- /* read a floating point number, either integer or real */
- static FT_Fixed
- cff_parse_fixed( FT_Byte** d )
- {
- return do_fixed( d, 0 );
- }
-
-
- /* read a floating point number, either integer or real, */
- /* but return `10^scaling' times the number read in */
- static FT_Fixed
- cff_parse_fixed_scaled( FT_Byte** d,
- FT_Long scaling )
- {
- return do_fixed( d, scaling );
- }
-
-
- /* read a floating point number, either integer or real, */
- /* and return it as precise as possible -- `scaling' returns */
- /* the scaling factor (as a power of 10) */
- static FT_Fixed
- cff_parse_fixed_dynamic( FT_Byte** d,
- FT_Long* scaling )
- {
- FT_ASSERT( scaling );
-
- if ( **d == 30 )
- return cff_parse_real( d[0], d[1], 0, scaling );
- else
- {
- FT_Long number;
- FT_Int integer_length;
-
-
- number = cff_parse_integer( d[0], d[1] );
-
- if ( number > 0x7FFFL )
- {
- for ( integer_length = 5; integer_length < 10; integer_length++ )
- if ( number < power_tens[integer_length] )
- break;
-
- if ( ( number / power_tens[integer_length - 5] ) > 0x7FFFL )
- {
- *scaling = integer_length - 4;
- return FT_DivFix( number, power_tens[integer_length - 4] );
- }
- else
- {
- *scaling = integer_length - 5;
- return FT_DivFix( number, power_tens[integer_length - 5] );
- }
- }
- else
- {
- *scaling = 0;
- return (FT_Long)( (FT_ULong)number << 16 );
- }
- }
- }
-
-
- static FT_Error
- cff_parse_font_matrix( CFF_Parser parser )
- {
- CFF_FontRecDict dict = (CFF_FontRecDict)parser->object;
- FT_Matrix* matrix = &dict->font_matrix;
- FT_Vector* offset = &dict->font_offset;
- FT_ULong* upm = &dict->units_per_em;
- FT_Byte** data = parser->stack;
- FT_Error error = FT_ERR( Stack_Underflow );
-
-
- if ( parser->top >= parser->stack + 6 )
- {
- FT_Long scaling;
-
-
- error = FT_Err_Ok;
-
- dict->has_font_matrix = TRUE;
-
- /* We expect a well-formed font matrix, this is, the matrix elements */
- /* `xx' and `yy' are of approximately the same magnitude. To avoid */
- /* loss of precision, we use the magnitude of element `xx' to scale */
- /* all other elements. The scaling factor is then contained in the */
- /* `units_per_em' value. */
-
- matrix->xx = cff_parse_fixed_dynamic( data++, &scaling );
-
- scaling = -scaling;
-
- if ( scaling < 0 || scaling > 9 )
- {
- /* Return default matrix in case of unlikely values. */
-
- FT_TRACE1(( "cff_parse_font_matrix:"
- " strange scaling value for xx element (%d),\n"
- " "
- " using default matrix\n", scaling ));
-
- matrix->xx = 0x10000L;
- matrix->yx = 0;
- matrix->xy = 0;
- matrix->yy = 0x10000L;
- offset->x = 0;
- offset->y = 0;
- *upm = 1;
-
- goto Exit;
- }
-
- matrix->yx = cff_parse_fixed_scaled( data++, scaling );
- matrix->xy = cff_parse_fixed_scaled( data++, scaling );
- matrix->yy = cff_parse_fixed_scaled( data++, scaling );
- offset->x = cff_parse_fixed_scaled( data++, scaling );
- offset->y = cff_parse_fixed_scaled( data, scaling );
-
- *upm = (FT_ULong)power_tens[scaling];
-
- FT_TRACE4(( " [%f %f %f %f %f %f]\n",
- (double)matrix->xx / *upm / 65536,
- (double)matrix->xy / *upm / 65536,
- (double)matrix->yx / *upm / 65536,
- (double)matrix->yy / *upm / 65536,
- (double)offset->x / *upm / 65536,
- (double)offset->y / *upm / 65536 ));
- }
-
- Exit:
- return error;
- }
-
-
- static FT_Error
- cff_parse_font_bbox( CFF_Parser parser )
- {
- CFF_FontRecDict dict = (CFF_FontRecDict)parser->object;
- FT_BBox* bbox = &dict->font_bbox;
- FT_Byte** data = parser->stack;
- FT_Error error;
-
-
- error = FT_ERR( Stack_Underflow );
-
- if ( parser->top >= parser->stack + 4 )
- {
- bbox->xMin = FT_RoundFix( cff_parse_fixed( data++ ) );
- bbox->yMin = FT_RoundFix( cff_parse_fixed( data++ ) );
- bbox->xMax = FT_RoundFix( cff_parse_fixed( data++ ) );
- bbox->yMax = FT_RoundFix( cff_parse_fixed( data ) );
- error = FT_Err_Ok;
-
- FT_TRACE4(( " [%d %d %d %d]\n",
- bbox->xMin / 65536,
- bbox->yMin / 65536,
- bbox->xMax / 65536,
- bbox->yMax / 65536 ));
- }
-
- return error;
- }
-
-
- static FT_Error
- cff_parse_private_dict( CFF_Parser parser )
- {
- CFF_FontRecDict dict = (CFF_FontRecDict)parser->object;
- FT_Byte** data = parser->stack;
- FT_Error error;
-
-
- error = FT_ERR( Stack_Underflow );
-
- if ( parser->top >= parser->stack + 2 )
- {
- FT_Long tmp;
-
-
- tmp = cff_parse_num( data++ );
- if ( tmp < 0 )
- {
- FT_ERROR(( "cff_parse_private_dict: Invalid dictionary size\n" ));
- error = FT_THROW( Invalid_File_Format );
- goto Fail;
- }
- dict->private_size = (FT_ULong)tmp;
-
- tmp = cff_parse_num( data );
- if ( tmp < 0 )
- {
- FT_ERROR(( "cff_parse_private_dict: Invalid dictionary offset\n" ));
- error = FT_THROW( Invalid_File_Format );
- goto Fail;
- }
- dict->private_offset = (FT_ULong)tmp;
-
- FT_TRACE4(( " %lu %lu\n",
- dict->private_size, dict->private_offset ));
-
- error = FT_Err_Ok;
- }
-
- Fail:
- return error;
- }
-
-
- static FT_Error
- cff_parse_cid_ros( CFF_Parser parser )
- {
- CFF_FontRecDict dict = (CFF_FontRecDict)parser->object;
- FT_Byte** data = parser->stack;
- FT_Error error;
-
-
- error = FT_ERR( Stack_Underflow );
-
- if ( parser->top >= parser->stack + 3 )
- {
- dict->cid_registry = (FT_UInt)cff_parse_num( data++ );
- dict->cid_ordering = (FT_UInt)cff_parse_num( data++ );
- if ( **data == 30 )
- FT_TRACE1(( "cff_parse_cid_ros: real supplement is rounded\n" ));
- dict->cid_supplement = cff_parse_num( data );
- if ( dict->cid_supplement < 0 )
- FT_TRACE1(( "cff_parse_cid_ros: negative supplement %d is found\n",
- dict->cid_supplement ));
- error = FT_Err_Ok;
-
- FT_TRACE4(( " %d %d %d\n",
- dict->cid_registry,
- dict->cid_ordering,
- dict->cid_supplement ));
- }
-
- return error;
- }
-
-
-#define CFF_FIELD_NUM( code, name, id ) \
- CFF_FIELD( code, name, id, cff_kind_num )
-#define CFF_FIELD_FIXED( code, name, id ) \
- CFF_FIELD( code, name, id, cff_kind_fixed )
-#define CFF_FIELD_FIXED_1000( code, name, id ) \
- CFF_FIELD( code, name, id, cff_kind_fixed_thousand )
-#define CFF_FIELD_STRING( code, name, id ) \
- CFF_FIELD( code, name, id, cff_kind_string )
-#define CFF_FIELD_BOOL( code, name, id ) \
- CFF_FIELD( code, name, id, cff_kind_bool )
-
-#define CFFCODE_TOPDICT 0x1000
-#define CFFCODE_PRIVATE 0x2000
-
-
-#ifndef FT_CONFIG_OPTION_PIC
-
-
-#undef CFF_FIELD
-#undef CFF_FIELD_DELTA
-
-
-#ifndef FT_DEBUG_LEVEL_TRACE
-
-
-#define CFF_FIELD_CALLBACK( code, name, id ) \
- { \
- cff_kind_callback, \
- code | CFFCODE, \
- 0, 0, \
- cff_parse_ ## name, \
- 0, 0 \
- },
-
-#define CFF_FIELD( code, name, id, kind ) \
- { \
- kind, \
- code | CFFCODE, \
- FT_FIELD_OFFSET( name ), \
- FT_FIELD_SIZE( name ), \
- 0, 0, 0 \
- },
-
-#define CFF_FIELD_DELTA( code, name, max, id ) \
- { \
- cff_kind_delta, \
- code | CFFCODE, \
- FT_FIELD_OFFSET( name ), \
- FT_FIELD_SIZE_DELTA( name ), \
- 0, \
- max, \
- FT_FIELD_OFFSET( num_ ## name ) \
- },
-
- static const CFF_Field_Handler cff_field_handlers[] =
- {
-
-#include "cfftoken.h"
-
- { 0, 0, 0, 0, 0, 0, 0 }
- };
-
-
-#else /* FT_DEBUG_LEVEL_TRACE */
-
-
-
-#define CFF_FIELD_CALLBACK( code, name, id ) \
- { \
- cff_kind_callback, \
- code | CFFCODE, \
- 0, 0, \
- cff_parse_ ## name, \
- 0, 0, \
- id \
- },
-
-#define CFF_FIELD( code, name, id, kind ) \
- { \
- kind, \
- code | CFFCODE, \
- FT_FIELD_OFFSET( name ), \
- FT_FIELD_SIZE( name ), \
- 0, 0, 0, \
- id \
- },
-
-#define CFF_FIELD_DELTA( code, name, max, id ) \
- { \
- cff_kind_delta, \
- code | CFFCODE, \
- FT_FIELD_OFFSET( name ), \
- FT_FIELD_SIZE_DELTA( name ), \
- 0, \
- max, \
- FT_FIELD_OFFSET( num_ ## name ), \
- id \
- },
-
- static const CFF_Field_Handler cff_field_handlers[] =
- {
-
-#include "cfftoken.h"
-
- { 0, 0, 0, 0, 0, 0, 0, 0 }
- };
-
-
-#endif /* FT_DEBUG_LEVEL_TRACE */
-
-
-#else /* FT_CONFIG_OPTION_PIC */
-
-
- void
- FT_Destroy_Class_cff_field_handlers( FT_Library library,
- CFF_Field_Handler* clazz )
- {
- FT_Memory memory = library->memory;
-
-
- if ( clazz )
- FT_FREE( clazz );
- }
-
-
- FT_Error
- FT_Create_Class_cff_field_handlers( FT_Library library,
- CFF_Field_Handler** output_class )
- {
- CFF_Field_Handler* clazz = NULL;
- FT_Error error;
- FT_Memory memory = library->memory;
-
- int i = 0;
-
-
-#undef CFF_FIELD
-#define CFF_FIELD( code, name, id, kind ) i++;
-#undef CFF_FIELD_DELTA
-#define CFF_FIELD_DELTA( code, name, max, id ) i++;
-#undef CFF_FIELD_CALLBACK
-#define CFF_FIELD_CALLBACK( code, name, id ) i++;
-
-#include "cfftoken.h"
-
- i++; /* { 0, 0, 0, 0, 0, 0, 0 } */
-
- if ( FT_ALLOC( clazz, sizeof ( CFF_Field_Handler ) * i ) )
- return error;
-
- i = 0;
-
-
-#ifndef FT_DEBUG_LEVEL_TRACE
-
-
-#undef CFF_FIELD_CALLBACK
-#define CFF_FIELD_CALLBACK( code_, name_, id_ ) \
- clazz[i].kind = cff_kind_callback; \
- clazz[i].code = code_ | CFFCODE; \
- clazz[i].offset = 0; \
- clazz[i].size = 0; \
- clazz[i].reader = cff_parse_ ## name_; \
- clazz[i].array_max = 0; \
- clazz[i].count_offset = 0; \
- i++;
-
-#undef CFF_FIELD
-#define CFF_FIELD( code_, name_, id_, kind_ ) \
- clazz[i].kind = kind_; \
- clazz[i].code = code_ | CFFCODE; \
- clazz[i].offset = FT_FIELD_OFFSET( name_ ); \
- clazz[i].size = FT_FIELD_SIZE( name_ ); \
- clazz[i].reader = 0; \
- clazz[i].array_max = 0; \
- clazz[i].count_offset = 0; \
- i++; \
-
-#undef CFF_FIELD_DELTA
-#define CFF_FIELD_DELTA( code_, name_, max_, id_ ) \
- clazz[i].kind = cff_kind_delta; \
- clazz[i].code = code_ | CFFCODE; \
- clazz[i].offset = FT_FIELD_OFFSET( name_ ); \
- clazz[i].size = FT_FIELD_SIZE_DELTA( name_ ); \
- clazz[i].reader = 0; \
- clazz[i].array_max = max_; \
- clazz[i].count_offset = FT_FIELD_OFFSET( num_ ## name_ ); \
- i++;
-
-#include "cfftoken.h"
-
- clazz[i].kind = 0;
- clazz[i].code = 0;
- clazz[i].offset = 0;
- clazz[i].size = 0;
- clazz[i].reader = 0;
- clazz[i].array_max = 0;
- clazz[i].count_offset = 0;
-
-
-#else /* FT_DEBUG_LEVEL_TRACE */
-
-
-#undef CFF_FIELD_CALLBACK
-#define CFF_FIELD_CALLBACK( code_, name_, id_ ) \
- clazz[i].kind = cff_kind_callback; \
- clazz[i].code = code_ | CFFCODE; \
- clazz[i].offset = 0; \
- clazz[i].size = 0; \
- clazz[i].reader = cff_parse_ ## name_; \
- clazz[i].array_max = 0; \
- clazz[i].count_offset = 0; \
- clazz[i].id = id_; \
- i++;
-
-#undef CFF_FIELD
-#define CFF_FIELD( code_, name_, id_, kind_ ) \
- clazz[i].kind = kind_; \
- clazz[i].code = code_ | CFFCODE; \
- clazz[i].offset = FT_FIELD_OFFSET( name_ ); \
- clazz[i].size = FT_FIELD_SIZE( name_ ); \
- clazz[i].reader = 0; \
- clazz[i].array_max = 0; \
- clazz[i].count_offset = 0; \
- clazz[i].id = id_; \
- i++; \
-
-#undef CFF_FIELD_DELTA
-#define CFF_FIELD_DELTA( code_, name_, max_, id_ ) \
- clazz[i].kind = cff_kind_delta; \
- clazz[i].code = code_ | CFFCODE; \
- clazz[i].offset = FT_FIELD_OFFSET( name_ ); \
- clazz[i].size = FT_FIELD_SIZE_DELTA( name_ ); \
- clazz[i].reader = 0; \
- clazz[i].array_max = max_; \
- clazz[i].count_offset = FT_FIELD_OFFSET( num_ ## name_ ); \
- clazz[i].id = id_; \
- i++;
-
-#include "cfftoken.h"
-
- clazz[i].kind = 0;
- clazz[i].code = 0;
- clazz[i].offset = 0;
- clazz[i].size = 0;
- clazz[i].reader = 0;
- clazz[i].array_max = 0;
- clazz[i].count_offset = 0;
- clazz[i].id = 0;
-
-
-#endif /* FT_DEBUG_LEVEL_TRACE */
-
-
- *output_class = clazz;
-
- return FT_Err_Ok;
- }
-
-
-#endif /* FT_CONFIG_OPTION_PIC */
-
-
- FT_LOCAL_DEF( FT_Error )
- cff_parser_run( CFF_Parser parser,
- FT_Byte* start,
- FT_Byte* limit )
- {
- FT_Byte* p = start;
- FT_Error error = FT_Err_Ok;
- FT_Library library = parser->library;
- FT_UNUSED( library );
-
-
- parser->top = parser->stack;
- parser->start = start;
- parser->limit = limit;
- parser->cursor = start;
-
- while ( p < limit )
- {
- FT_UInt v = *p;
-
-
- if ( v >= 27 && v != 31 )
- {
- /* it's a number; we will push its position on the stack */
- if ( parser->top - parser->stack >= CFF_MAX_STACK_DEPTH )
- goto Stack_Overflow;
-
- *parser->top ++ = p;
-
- /* now, skip it */
- if ( v == 30 )
- {
- /* skip real number */
- p++;
- for (;;)
- {
- /* An unterminated floating point number at the */
- /* end of a dictionary is invalid but harmless. */
- if ( p >= limit )
- goto Exit;
- v = p[0] >> 4;
- if ( v == 15 )
- break;
- v = p[0] & 0xF;
- if ( v == 15 )
- break;
- p++;
- }
- }
- else if ( v == 28 )
- p += 2;
- else if ( v == 29 )
- p += 4;
- else if ( v > 246 )
- p += 1;
- }
- else
- {
- /* This is not a number, hence it's an operator. Compute its code */
- /* and look for it in our current list. */
-
- FT_UInt code;
- FT_UInt num_args = (FT_UInt)
- ( parser->top - parser->stack );
- const CFF_Field_Handler* field;
-
-
- *parser->top = p;
- code = v;
- if ( v == 12 )
- {
- /* two byte operator */
- p++;
- if ( p >= limit )
- goto Syntax_Error;
-
- code = 0x100 | p[0];
- }
- code = code | parser->object_code;
-
- for ( field = CFF_FIELD_HANDLERS_GET; field->kind; field++ )
- {
- if ( field->code == (FT_Int)code )
- {
- /* we found our field's handler; read it */
- FT_Long val;
- FT_Byte* q = (FT_Byte*)parser->object + field->offset;
-
-
-#ifdef FT_DEBUG_LEVEL_TRACE
- FT_TRACE4(( " %s", field->id ));
-#endif
-
- /* check that we have enough arguments -- except for */
- /* delta encoded arrays, which can be empty */
- if ( field->kind != cff_kind_delta && num_args < 1 )
- goto Stack_Underflow;
-
- switch ( field->kind )
- {
- case cff_kind_bool:
- case cff_kind_string:
- case cff_kind_num:
- val = cff_parse_num( parser->stack );
- goto Store_Number;
-
- case cff_kind_fixed:
- val = cff_parse_fixed( parser->stack );
- goto Store_Number;
-
- case cff_kind_fixed_thousand:
- val = cff_parse_fixed_scaled( parser->stack, 3 );
-
- Store_Number:
- switch ( field->size )
- {
- case (8 / FT_CHAR_BIT):
- *(FT_Byte*)q = (FT_Byte)val;
- break;
-
- case (16 / FT_CHAR_BIT):
- *(FT_Short*)q = (FT_Short)val;
- break;
-
- case (32 / FT_CHAR_BIT):
- *(FT_Int32*)q = (FT_Int)val;
- break;
-
- default: /* for 64-bit systems */
- *(FT_Long*)q = val;
- }
-
-#ifdef FT_DEBUG_LEVEL_TRACE
- switch ( field->kind )
- {
- case cff_kind_bool:
- FT_TRACE4(( " %s\n", val ? "true" : "false" ));
- break;
-
- case cff_kind_string:
- FT_TRACE4(( " %ld (SID)\n", val ));
- break;
-
- case cff_kind_num:
- FT_TRACE4(( " %ld\n", val ));
- break;
-
- case cff_kind_fixed:
- FT_TRACE4(( " %f\n", (double)val / 65536 ));
- break;
-
- case cff_kind_fixed_thousand:
- FT_TRACE4(( " %f\n", (double)val / 65536 / 1000 ));
-
- default:
- ; /* never reached */
- }
-#endif
-
- break;
-
- case cff_kind_delta:
- {
- FT_Byte* qcount = (FT_Byte*)parser->object +
- field->count_offset;
-
- FT_Byte** data = parser->stack;
-
-
- if ( num_args > field->array_max )
- num_args = field->array_max;
-
- FT_TRACE4(( " [" ));
-
- /* store count */
- *qcount = (FT_Byte)num_args;
-
- val = 0;
- while ( num_args > 0 )
- {
- val += cff_parse_num( data++ );
- switch ( field->size )
- {
- case (8 / FT_CHAR_BIT):
- *(FT_Byte*)q = (FT_Byte)val;
- break;
-
- case (16 / FT_CHAR_BIT):
- *(FT_Short*)q = (FT_Short)val;
- break;
-
- case (32 / FT_CHAR_BIT):
- *(FT_Int32*)q = (FT_Int)val;
- break;
-
- default: /* for 64-bit systems */
- *(FT_Long*)q = val;
- }
-
- FT_TRACE4(( " %ld", val ));
-
- q += field->size;
- num_args--;
- }
-
- FT_TRACE4(( "]\n" ));
- }
- break;
-
- default: /* callback */
- error = field->reader( parser );
- if ( error )
- goto Exit;
- }
- goto Found;
- }
- }
-
- /* this is an unknown operator, or it is unsupported; */
- /* we will ignore it for now. */
-
- Found:
- /* clear stack */
- parser->top = parser->stack;
- }
- p++;
- }
-
- Exit:
- return error;
-
- Stack_Overflow:
- error = FT_THROW( Invalid_Argument );
- goto Exit;
-
- Stack_Underflow:
- error = FT_THROW( Invalid_Argument );
- goto Exit;
-
- Syntax_Error:
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/cff/cffparse.h b/chromium/third_party/pdfium/third_party/freetype/src/cff/cffparse.h
deleted file mode 100644
index 8ad02ea1e25..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/cff/cffparse.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/***************************************************************************/
-/* */
-/* cffparse.h */
-/* */
-/* CFF token stream parser (specification) */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __CFF_PARSE_H__
-#define __CFF_PARSE_H__
-
-
-#include <ft2build.h>
-#include "cfftypes.h"
-#include FT_INTERNAL_OBJECTS_H
-
-
-FT_BEGIN_HEADER
-
-
-#define CFF_MAX_STACK_DEPTH 96
-
-#define CFF_CODE_TOPDICT 0x1000
-#define CFF_CODE_PRIVATE 0x2000
-
-
- typedef struct CFF_ParserRec_
- {
- FT_Library library;
- FT_Byte* start;
- FT_Byte* limit;
- FT_Byte* cursor;
-
- FT_Byte* stack[CFF_MAX_STACK_DEPTH + 1];
- FT_Byte** top;
-
- FT_UInt object_code;
- void* object;
-
- } CFF_ParserRec, *CFF_Parser;
-
-
- FT_LOCAL( void )
- cff_parser_init( CFF_Parser parser,
- FT_UInt code,
- void* object,
- FT_Library library);
-
- FT_LOCAL( FT_Error )
- cff_parser_run( CFF_Parser parser,
- FT_Byte* start,
- FT_Byte* limit );
-
-
- enum
- {
- cff_kind_none = 0,
- cff_kind_num,
- cff_kind_fixed,
- cff_kind_fixed_thousand,
- cff_kind_string,
- cff_kind_bool,
- cff_kind_delta,
- cff_kind_callback,
-
- cff_kind_max /* do not remove */
- };
-
-
- /* now generate handlers for the most simple fields */
- typedef FT_Error (*CFF_Field_Reader)( CFF_Parser parser );
-
- typedef struct CFF_Field_Handler_
- {
- int kind;
- int code;
- FT_UInt offset;
- FT_Byte size;
- CFF_Field_Reader reader;
- FT_UInt array_max;
- FT_UInt count_offset;
-
-#ifdef FT_DEBUG_LEVEL_TRACE
- const char* id;
-#endif
-
- } CFF_Field_Handler;
-
-
-FT_END_HEADER
-
-
-#endif /* __CFF_PARSE_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/cff/cffpic.c b/chromium/third_party/pdfium/third_party/freetype/src/cff/cffpic.c
deleted file mode 100644
index d40dec50e9d..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/cff/cffpic.c
+++ /dev/null
@@ -1,138 +0,0 @@
-/***************************************************************************/
-/* */
-/* cffpic.c */
-/* */
-/* The FreeType position independent code services for cff module. */
-/* */
-/* Copyright 2009-2015 by */
-/* Oran Agra and Mickey Gabel. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_INTERNAL_OBJECTS_H
-#include "cffcmap.h"
-#include "cffpic.h"
-#include "cfferrs.h"
-
-
-#ifdef FT_CONFIG_OPTION_PIC
-
- /* forward declaration of PIC init functions from cffdrivr.c */
- FT_Error
- FT_Create_Class_cff_services( FT_Library library,
- FT_ServiceDescRec** output_class );
- void
- FT_Destroy_Class_cff_services( FT_Library library,
- FT_ServiceDescRec* clazz );
- void
- FT_Init_Class_cff_service_ps_info( FT_Library library,
- FT_Service_PsInfoRec* clazz );
- void
- FT_Init_Class_cff_service_glyph_dict( FT_Library library,
- FT_Service_GlyphDictRec* clazz );
- void
- FT_Init_Class_cff_service_ps_name( FT_Library library,
- FT_Service_PsFontNameRec* clazz );
- void
- FT_Init_Class_cff_service_get_cmap_info( FT_Library library,
- FT_Service_TTCMapsRec* clazz );
- void
- FT_Init_Class_cff_service_cid_info( FT_Library library,
- FT_Service_CIDRec* clazz );
-
- /* forward declaration of PIC init functions from cffparse.c */
- FT_Error
- FT_Create_Class_cff_field_handlers( FT_Library library,
- CFF_Field_Handler** output_class );
- void
- FT_Destroy_Class_cff_field_handlers( FT_Library library,
- CFF_Field_Handler* clazz );
-
-
- void
- cff_driver_class_pic_free( FT_Library library )
- {
- FT_PIC_Container* pic_container = &library->pic_container;
- FT_Memory memory = library->memory;
-
-
- if ( pic_container->cff )
- {
- CffModulePIC* container = (CffModulePIC*)pic_container->cff;
-
-
- if ( container->cff_services )
- FT_Destroy_Class_cff_services( library,
- container->cff_services );
- container->cff_services = NULL;
- if ( container->cff_field_handlers )
- FT_Destroy_Class_cff_field_handlers(
- library, container->cff_field_handlers );
- container->cff_field_handlers = NULL;
- FT_FREE( container );
- pic_container->cff = NULL;
- }
- }
-
-
- FT_Error
- cff_driver_class_pic_init( FT_Library library )
- {
- FT_PIC_Container* pic_container = &library->pic_container;
- FT_Error error = FT_Err_Ok;
- CffModulePIC* container = NULL;
- FT_Memory memory = library->memory;
-
-
- /* allocate pointer, clear and set global container pointer */
- if ( FT_ALLOC ( container, sizeof ( *container ) ) )
- return error;
- FT_MEM_SET( container, 0, sizeof ( *container ) );
- pic_container->cff = container;
-
- /* initialize pointer table - */
- /* this is how the module usually expects this data */
- error = FT_Create_Class_cff_services( library,
- &container->cff_services );
- if ( error )
- goto Exit;
-
- error = FT_Create_Class_cff_field_handlers(
- library, &container->cff_field_handlers );
- if ( error )
- goto Exit;
-
- FT_Init_Class_cff_service_ps_info(
- library, &container->cff_service_ps_info );
- FT_Init_Class_cff_service_glyph_dict(
- library, &container->cff_service_glyph_dict );
- FT_Init_Class_cff_service_ps_name(
- library, &container->cff_service_ps_name );
- FT_Init_Class_cff_service_get_cmap_info(
- library, &container->cff_service_get_cmap_info );
- FT_Init_Class_cff_service_cid_info(
- library, &container->cff_service_cid_info );
- FT_Init_Class_cff_cmap_encoding_class_rec(
- library, &container->cff_cmap_encoding_class_rec );
- FT_Init_Class_cff_cmap_unicode_class_rec(
- library, &container->cff_cmap_unicode_class_rec );
-
- Exit:
- if ( error )
- cff_driver_class_pic_free( library );
- return error;
- }
-
-#endif /* FT_CONFIG_OPTION_PIC */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/cff/cffpic.h b/chromium/third_party/pdfium/third_party/freetype/src/cff/cffpic.h
deleted file mode 100644
index 9a221a7b7ee..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/cff/cffpic.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/***************************************************************************/
-/* */
-/* cffpic.h */
-/* */
-/* The FreeType position independent code services for cff module. */
-/* */
-/* Copyright 2009-2015 by */
-/* Oran Agra and Mickey Gabel. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __CFFPIC_H__
-#define __CFFPIC_H__
-
-
-#include FT_INTERNAL_PIC_H
-
-
-#ifndef FT_CONFIG_OPTION_PIC
-
-#define CFF_SERVICE_PS_INFO_GET cff_service_ps_info
-#define CFF_SERVICE_GLYPH_DICT_GET cff_service_glyph_dict
-#define CFF_SERVICE_PS_NAME_GET cff_service_ps_name
-#define CFF_SERVICE_GET_CMAP_INFO_GET cff_service_get_cmap_info
-#define CFF_SERVICE_CID_INFO_GET cff_service_cid_info
-#define CFF_SERVICE_PROPERTIES_GET cff_service_properties
-#define CFF_SERVICES_GET cff_services
-#define CFF_CMAP_ENCODING_CLASS_REC_GET cff_cmap_encoding_class_rec
-#define CFF_CMAP_UNICODE_CLASS_REC_GET cff_cmap_unicode_class_rec
-#define CFF_FIELD_HANDLERS_GET cff_field_handlers
-
-#else /* FT_CONFIG_OPTION_PIC */
-
-#include FT_SERVICE_GLYPH_DICT_H
-#include "cffparse.h"
-#include FT_SERVICE_POSTSCRIPT_INFO_H
-#include FT_SERVICE_POSTSCRIPT_NAME_H
-#include FT_SERVICE_TT_CMAP_H
-#include FT_SERVICE_CID_H
-#include FT_SERVICE_PROPERTIES_H
-
-
-FT_BEGIN_HEADER
-
- typedef struct CffModulePIC_
- {
- FT_ServiceDescRec* cff_services;
- CFF_Field_Handler* cff_field_handlers;
- FT_Service_PsInfoRec cff_service_ps_info;
- FT_Service_GlyphDictRec cff_service_glyph_dict;
- FT_Service_PsFontNameRec cff_service_ps_name;
- FT_Service_TTCMapsRec cff_service_get_cmap_info;
- FT_Service_CIDRec cff_service_cid_info;
- FT_Service_PropertiesRec cff_service_properties;
- FT_CMap_ClassRec cff_cmap_encoding_class_rec;
- FT_CMap_ClassRec cff_cmap_unicode_class_rec;
-
- } CffModulePIC;
-
-
-#define GET_PIC( lib ) \
- ( (CffModulePIC*)( (lib)->pic_container.cff ) )
-
-#define CFF_SERVICE_PS_INFO_GET \
- ( GET_PIC( library )->cff_service_ps_info )
-#define CFF_SERVICE_GLYPH_DICT_GET \
- ( GET_PIC( library )->cff_service_glyph_dict )
-#define CFF_SERVICE_PS_NAME_GET \
- ( GET_PIC( library )->cff_service_ps_name )
-#define CFF_SERVICE_GET_CMAP_INFO_GET \
- ( GET_PIC( library )->cff_service_get_cmap_info )
-#define CFF_SERVICE_CID_INFO_GET \
- ( GET_PIC( library )->cff_service_cid_info )
-#define CFF_SERVICE_PROPERTIES_GET \
- ( GET_PIC( library )->cff_service_properties )
-#define CFF_SERVICES_GET \
- ( GET_PIC( library )->cff_services )
-#define CFF_CMAP_ENCODING_CLASS_REC_GET \
- ( GET_PIC( library )->cff_cmap_encoding_class_rec )
-#define CFF_CMAP_UNICODE_CLASS_REC_GET \
- ( GET_PIC( library )->cff_cmap_unicode_class_rec )
-#define CFF_FIELD_HANDLERS_GET \
- ( GET_PIC( library )->cff_field_handlers )
-
- /* see cffpic.c for the implementation */
- void
- cff_driver_class_pic_free( FT_Library library );
-
- FT_Error
- cff_driver_class_pic_init( FT_Library library );
-
-FT_END_HEADER
-
-#endif /* FT_CONFIG_OPTION_PIC */
-
- /* */
-
-#endif /* __CFFPIC_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/cff/cfftoken.h b/chromium/third_party/pdfium/third_party/freetype/src/cff/cfftoken.h
deleted file mode 100644
index 5b32076ab8f..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/cff/cfftoken.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/***************************************************************************/
-/* */
-/* cfftoken.h */
-/* */
-/* CFF token definitions (specification only). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#undef FT_STRUCTURE
-#define FT_STRUCTURE CFF_FontRecDictRec
-
-#undef CFFCODE
-#define CFFCODE CFFCODE_TOPDICT
-
- CFF_FIELD_STRING ( 0, version, "Version" )
- CFF_FIELD_STRING ( 1, notice, "Notice" )
- CFF_FIELD_STRING ( 0x100, copyright, "Copyright" )
- CFF_FIELD_STRING ( 2, full_name, "FullName" )
- CFF_FIELD_STRING ( 3, family_name, "FamilyName" )
- CFF_FIELD_STRING ( 4, weight, "Weight" )
- CFF_FIELD_BOOL ( 0x101, is_fixed_pitch, "isFixedPitch" )
- CFF_FIELD_FIXED ( 0x102, italic_angle, "ItalicAngle" )
- CFF_FIELD_FIXED ( 0x103, underline_position, "UnderlinePosition" )
- CFF_FIELD_FIXED ( 0x104, underline_thickness, "UnderlineThickness" )
- CFF_FIELD_NUM ( 0x105, paint_type, "PaintType" )
- CFF_FIELD_NUM ( 0x106, charstring_type, "CharstringType" )
- CFF_FIELD_CALLBACK( 0x107, font_matrix, "FontMatrix" )
- CFF_FIELD_NUM ( 13, unique_id, "UniqueID" )
- CFF_FIELD_CALLBACK( 5, font_bbox, "FontBBox" )
- CFF_FIELD_NUM ( 0x108, stroke_width, "StrokeWidth" )
- CFF_FIELD_NUM ( 15, charset_offset, "charset" )
- CFF_FIELD_NUM ( 16, encoding_offset, "Encoding" )
- CFF_FIELD_NUM ( 17, charstrings_offset, "CharStrings" )
- CFF_FIELD_CALLBACK( 18, private_dict, "Private" )
- CFF_FIELD_NUM ( 0x114, synthetic_base, "SyntheticBase" )
- CFF_FIELD_STRING ( 0x115, embedded_postscript, "PostScript" )
-
-#if 0
- CFF_FIELD_STRING ( 0x116, base_font_name, "BaseFontName" )
- CFF_FIELD_DELTA ( 0x117, base_font_blend, 16, "BaseFontBlend" )
- CFF_FIELD_CALLBACK( 0x118, multiple_master, "MultipleMaster" )
- CFF_FIELD_CALLBACK( 0x119, blend_axis_types, "BlendAxisTypes" )
-#endif
-
- CFF_FIELD_CALLBACK( 0x11E, cid_ros, "ROS" )
- CFF_FIELD_NUM ( 0x11F, cid_font_version, "CIDFontVersion" )
- CFF_FIELD_NUM ( 0x120, cid_font_revision, "CIDFontRevision" )
- CFF_FIELD_NUM ( 0x121, cid_font_type, "CIDFontType" )
- CFF_FIELD_NUM ( 0x122, cid_count, "CIDCount" )
- CFF_FIELD_NUM ( 0x123, cid_uid_base, "UIDBase" )
- CFF_FIELD_NUM ( 0x124, cid_fd_array_offset, "FDArray" )
- CFF_FIELD_NUM ( 0x125, cid_fd_select_offset, "FDSelect" )
- CFF_FIELD_STRING ( 0x126, cid_font_name, "FontName" )
-
-#if 0
- CFF_FIELD_NUM ( 0x127, chameleon, "Chameleon" )
-#endif
-
-
-#undef FT_STRUCTURE
-#define FT_STRUCTURE CFF_PrivateRec
-#undef CFFCODE
-#define CFFCODE CFFCODE_PRIVATE
-
- CFF_FIELD_DELTA ( 6, blue_values, 14, "BlueValues" )
- CFF_FIELD_DELTA ( 7, other_blues, 10, "OtherBlues" )
- CFF_FIELD_DELTA ( 8, family_blues, 14, "FamilyBlues" )
- CFF_FIELD_DELTA ( 9, family_other_blues, 10, "FamilyOtherBlues" )
- CFF_FIELD_FIXED_1000( 0x109, blue_scale, "BlueScale" )
- CFF_FIELD_NUM ( 0x10A, blue_shift, "BlueShift" )
- CFF_FIELD_NUM ( 0x10B, blue_fuzz, "BlueFuzz" )
- CFF_FIELD_NUM ( 10, standard_width, "StdHW" )
- CFF_FIELD_NUM ( 11, standard_height, "StdVW" )
- CFF_FIELD_DELTA ( 0x10C, snap_widths, 13, "StemSnapH" )
- CFF_FIELD_DELTA ( 0x10D, snap_heights, 13, "StemSnapV" )
- CFF_FIELD_BOOL ( 0x10E, force_bold, "ForceBold" )
- CFF_FIELD_FIXED ( 0x10F, force_bold_threshold, "ForceBoldThreshold" )
- CFF_FIELD_NUM ( 0x110, lenIV, "lenIV" )
- CFF_FIELD_NUM ( 0x111, language_group, "LanguageGroup" )
- CFF_FIELD_FIXED ( 0x112, expansion_factor, "ExpansionFactor" )
- CFF_FIELD_NUM ( 0x113, initial_random_seed, "initialRandomSeed" )
- CFF_FIELD_NUM ( 19, local_subrs_offset, "Subrs" )
- CFF_FIELD_NUM ( 20, default_width, "defaultWidthX" )
- CFF_FIELD_NUM ( 21, nominal_width, "nominalWidthX" )
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/cff/cfftypes.h b/chromium/third_party/pdfium/third_party/freetype/src/cff/cfftypes.h
deleted file mode 100644
index de8a5ee9b44..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/cff/cfftypes.h
+++ /dev/null
@@ -1,284 +0,0 @@
-/***************************************************************************/
-/* */
-/* cfftypes.h */
-/* */
-/* Basic OpenType/CFF type definitions and interface (specification */
-/* only). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __CFFTYPES_H__
-#define __CFFTYPES_H__
-
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_TYPE1_TABLES_H
-#include FT_INTERNAL_SERVICE_H
-#include FT_SERVICE_POSTSCRIPT_CMAPS_H
-#include FT_INTERNAL_POSTSCRIPT_HINTS_H
-
-
-FT_BEGIN_HEADER
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* CFF_IndexRec */
- /* */
- /* <Description> */
- /* A structure used to model a CFF Index table. */
- /* */
- /* <Fields> */
- /* stream :: The source input stream. */
- /* */
- /* start :: The position of the first index byte in the */
- /* input stream. */
- /* */
- /* count :: The number of elements in the index. */
- /* */
- /* off_size :: The size in bytes of object offsets in index. */
- /* */
- /* data_offset :: The position of first data byte in the index's */
- /* bytes. */
- /* */
- /* data_size :: The size of the data table in this index. */
- /* */
- /* offsets :: A table of element offsets in the index. Must be */
- /* loaded explicitly. */
- /* */
- /* bytes :: If the index is loaded in memory, its bytes. */
- /* */
- typedef struct CFF_IndexRec_
- {
- FT_Stream stream;
- FT_ULong start;
- FT_UInt count;
- FT_Byte off_size;
- FT_ULong data_offset;
- FT_ULong data_size;
-
- FT_ULong* offsets;
- FT_Byte* bytes;
-
- } CFF_IndexRec, *CFF_Index;
-
-
- typedef struct CFF_EncodingRec_
- {
- FT_UInt format;
- FT_ULong offset;
-
- FT_UInt count;
- FT_UShort sids [256]; /* avoid dynamic allocations */
- FT_UShort codes[256];
-
- } CFF_EncodingRec, *CFF_Encoding;
-
-
- typedef struct CFF_CharsetRec_
- {
-
- FT_UInt format;
- FT_ULong offset;
-
- FT_UShort* sids;
- FT_UShort* cids; /* the inverse mapping of `sids'; only needed */
- /* for CID-keyed fonts */
- FT_UInt max_cid;
- FT_UInt num_glyphs;
-
- } CFF_CharsetRec, *CFF_Charset;
-
-
- typedef struct CFF_FontRecDictRec_
- {
- FT_UInt version;
- FT_UInt notice;
- FT_UInt copyright;
- FT_UInt full_name;
- FT_UInt family_name;
- FT_UInt weight;
- FT_Bool is_fixed_pitch;
- FT_Fixed italic_angle;
- FT_Fixed underline_position;
- FT_Fixed underline_thickness;
- FT_Int paint_type;
- FT_Int charstring_type;
- FT_Matrix font_matrix;
- FT_Bool has_font_matrix;
- FT_ULong units_per_em; /* temporarily used as scaling value also */
- FT_Vector font_offset;
- FT_ULong unique_id;
- FT_BBox font_bbox;
- FT_Pos stroke_width;
- FT_ULong charset_offset;
- FT_ULong encoding_offset;
- FT_ULong charstrings_offset;
- FT_ULong private_offset;
- FT_ULong private_size;
- FT_Long synthetic_base;
- FT_UInt embedded_postscript;
-
- /* these should only be used for the top-level font dictionary */
- FT_UInt cid_registry;
- FT_UInt cid_ordering;
- FT_Long cid_supplement;
-
- FT_Long cid_font_version;
- FT_Long cid_font_revision;
- FT_Long cid_font_type;
- FT_ULong cid_count;
- FT_ULong cid_uid_base;
- FT_ULong cid_fd_array_offset;
- FT_ULong cid_fd_select_offset;
- FT_UInt cid_font_name;
-
- } CFF_FontRecDictRec, *CFF_FontRecDict;
-
-
- typedef struct CFF_PrivateRec_
- {
- FT_Byte num_blue_values;
- FT_Byte num_other_blues;
- FT_Byte num_family_blues;
- FT_Byte num_family_other_blues;
-
- FT_Pos blue_values[14];
- FT_Pos other_blues[10];
- FT_Pos family_blues[14];
- FT_Pos family_other_blues[10];
-
- FT_Fixed blue_scale;
- FT_Pos blue_shift;
- FT_Pos blue_fuzz;
- FT_Pos standard_width;
- FT_Pos standard_height;
-
- FT_Byte num_snap_widths;
- FT_Byte num_snap_heights;
- FT_Pos snap_widths[13];
- FT_Pos snap_heights[13];
- FT_Bool force_bold;
- FT_Fixed force_bold_threshold;
- FT_Int lenIV;
- FT_Int language_group;
- FT_Fixed expansion_factor;
- FT_Long initial_random_seed;
- FT_ULong local_subrs_offset;
- FT_Pos default_width;
- FT_Pos nominal_width;
-
- } CFF_PrivateRec, *CFF_Private;
-
-
- typedef struct CFF_FDSelectRec_
- {
- FT_Byte format;
- FT_UInt range_count;
-
- /* that's the table, taken from the file `as is' */
- FT_Byte* data;
- FT_UInt data_size;
-
- /* small cache for format 3 only */
- FT_UInt cache_first;
- FT_UInt cache_count;
- FT_Byte cache_fd;
-
- } CFF_FDSelectRec, *CFF_FDSelect;
-
-
- /* A SubFont packs a font dict and a private dict together. They are */
- /* needed to support CID-keyed CFF fonts. */
- typedef struct CFF_SubFontRec_
- {
- CFF_FontRecDictRec font_dict;
- CFF_PrivateRec private_dict;
-
- CFF_IndexRec local_subrs_index;
- FT_Byte** local_subrs; /* array of pointers into Local Subrs INDEX data */
-
- } CFF_SubFontRec, *CFF_SubFont;
-
-
-#define CFF_MAX_CID_FONTS 256
-
-
- typedef struct CFF_FontRec_
- {
- FT_Stream stream;
- FT_Memory memory;
- FT_UInt num_faces;
- FT_UInt num_glyphs;
-
- FT_Byte version_major;
- FT_Byte version_minor;
- FT_Byte header_size;
- FT_Byte absolute_offsize;
-
-
- CFF_IndexRec name_index;
- CFF_IndexRec top_dict_index;
- CFF_IndexRec global_subrs_index;
-
- CFF_EncodingRec encoding;
- CFF_CharsetRec charset;
-
- CFF_IndexRec charstrings_index;
- CFF_IndexRec font_dict_index;
- CFF_IndexRec private_index;
- CFF_IndexRec local_subrs_index;
-
- FT_String* font_name;
-
- /* array of pointers into Global Subrs INDEX data */
- FT_Byte** global_subrs;
-
- /* array of pointers into String INDEX data stored at string_pool */
- FT_UInt num_strings;
- FT_Byte** strings;
- FT_Byte* string_pool;
-
- CFF_SubFontRec top_font;
- FT_UInt num_subfonts;
- CFF_SubFont subfonts[CFF_MAX_CID_FONTS];
-
- CFF_FDSelectRec fd_select;
-
- /* interface to PostScript hinter */
- PSHinter_Service pshinter;
-
- /* interface to Postscript Names service */
- FT_Service_PsCMaps psnames;
-
- /* since version 2.3.0 */
- PS_FontInfoRec* font_info; /* font info dictionary */
-
- /* since version 2.3.6 */
- FT_String* registry;
- FT_String* ordering;
-
- /* since version 2.4.12 */
- FT_Generic cf2_instance;
-
- } CFF_FontRec, *CFF_Font;
-
-
-FT_END_HEADER
-
-#endif /* __CFFTYPES_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/cid/Jamfile b/chromium/third_party/pdfium/third_party/freetype/src/cid/Jamfile
deleted file mode 100644
index 64e1523157b..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/cid/Jamfile
+++ /dev/null
@@ -1,34 +0,0 @@
-# FreeType 2 src/cid Jamfile
-#
-# Copyright 2001-2015 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT. By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-SubDir FT2_TOP $(FT2_SRC_DIR) cid ;
-
-{
- local _sources ;
-
- if $(FT2_MULTI)
- {
- _sources = cidgload
- cidload
- cidobjs
- cidparse
- cidriver
- ;
- }
- else
- {
- _sources = type1cid ;
- }
-
- Library $(FT2_LIB) : $(_sources).c ;
-}
-
-# end of src/cid Jamfile
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/cid/ciderrs.h b/chromium/third_party/pdfium/third_party/freetype/src/cid/ciderrs.h
deleted file mode 100644
index 5e0e776ee16..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/cid/ciderrs.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/***************************************************************************/
-/* */
-/* ciderrs.h */
-/* */
-/* CID error codes (specification only). */
-/* */
-/* Copyright 2001-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* This file is used to define the CID error enumeration constants. */
- /* */
- /*************************************************************************/
-
-#ifndef __CIDERRS_H__
-#define __CIDERRS_H__
-
-#include FT_MODULE_ERRORS_H
-
-#undef __FTERRORS_H__
-
-#undef FT_ERR_PREFIX
-#define FT_ERR_PREFIX CID_Err_
-#define FT_ERR_BASE FT_Mod_Err_CID
-
-#include FT_ERRORS_H
-
-#endif /* __CIDERRS_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/cid/cidgload.c b/chromium/third_party/pdfium/third_party/freetype/src/cid/cidgload.c
deleted file mode 100644
index d00674fe0d3..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/cid/cidgload.c
+++ /dev/null
@@ -1,446 +0,0 @@
-/***************************************************************************/
-/* */
-/* cidgload.c */
-/* */
-/* CID-keyed Type1 Glyph Loader (body). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include "cidload.h"
-#include "cidgload.h"
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_OUTLINE_H
-#include FT_INTERNAL_CALC_H
-
-#include "ciderrs.h"
-
-
- /*************************************************************************/
- /* */
- /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
- /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
- /* messages during execution. */
- /* */
-#undef FT_COMPONENT
-#define FT_COMPONENT trace_cidgload
-
-
- FT_CALLBACK_DEF( FT_Error )
- cid_load_glyph( T1_Decoder decoder,
- FT_UInt glyph_index )
- {
- CID_Face face = (CID_Face)decoder->builder.face;
- CID_FaceInfo cid = &face->cid;
- FT_Byte* p;
- FT_ULong fd_select;
- FT_Stream stream = face->cid_stream;
- FT_Error error = FT_Err_Ok;
- FT_Byte* charstring = NULL;
- FT_Memory memory = face->root.memory;
- FT_ULong glyph_length = 0;
- PSAux_Service psaux = (PSAux_Service)face->psaux;
-
-#ifdef FT_CONFIG_OPTION_INCREMENTAL
- FT_Incremental_InterfaceRec *inc =
- face->root.internal->incremental_interface;
-#endif
-
-
- FT_TRACE1(( "cid_load_glyph: glyph index %d\n", glyph_index ));
-
-#ifdef FT_CONFIG_OPTION_INCREMENTAL
-
- /* For incremental fonts get the character data using */
- /* the callback function. */
- if ( inc )
- {
- FT_Data glyph_data;
-
-
- error = inc->funcs->get_glyph_data( inc->object,
- glyph_index, &glyph_data );
- if ( error )
- goto Exit;
-
- p = (FT_Byte*)glyph_data.pointer;
- fd_select = cid_get_offset( &p, (FT_Byte)cid->fd_bytes );
-
- if ( glyph_data.length != 0 )
- {
- glyph_length = (FT_ULong)( glyph_data.length - cid->fd_bytes );
- (void)FT_ALLOC( charstring, glyph_length );
- if ( !error )
- ft_memcpy( charstring, glyph_data.pointer + cid->fd_bytes,
- glyph_length );
- }
-
- inc->funcs->free_glyph_data( inc->object, &glyph_data );
-
- if ( error )
- goto Exit;
- }
-
- else
-
-#endif /* FT_CONFIG_OPTION_INCREMENTAL */
-
- /* For ordinary fonts read the CID font dictionary index */
- /* and charstring offset from the CIDMap. */
- {
- FT_UInt entry_len = (FT_UInt)( cid->fd_bytes + cid->gd_bytes );
- FT_ULong off1;
-
-
- if ( FT_STREAM_SEEK( cid->data_offset + cid->cidmap_offset +
- glyph_index * entry_len ) ||
- FT_FRAME_ENTER( 2 * entry_len ) )
- goto Exit;
-
- p = (FT_Byte*)stream->cursor;
- fd_select = cid_get_offset( &p, (FT_Byte)cid->fd_bytes );
- off1 = cid_get_offset( &p, (FT_Byte)cid->gd_bytes );
- p += cid->fd_bytes;
- glyph_length = cid_get_offset( &p, (FT_Byte)cid->gd_bytes ) - off1;
- FT_FRAME_EXIT();
-
- if ( fd_select >= (FT_ULong)cid->num_dicts )
- {
- error = FT_THROW( Invalid_Offset );
- goto Exit;
- }
- if ( glyph_length == 0 )
- goto Exit;
- if ( FT_ALLOC( charstring, glyph_length ) )
- goto Exit;
- if ( FT_STREAM_READ_AT( cid->data_offset + off1,
- charstring, glyph_length ) )
- goto Exit;
- }
-
- /* Now set up the subrs array and parse the charstrings. */
- {
- CID_FaceDict dict;
- CID_Subrs cid_subrs = face->subrs + fd_select;
- FT_UInt cs_offset;
-
-
- /* Set up subrs */
- decoder->num_subrs = cid_subrs->num_subrs;
- decoder->subrs = cid_subrs->code;
- decoder->subrs_len = 0;
-
- /* Set up font matrix */
- dict = cid->font_dicts + fd_select;
-
- decoder->font_matrix = dict->font_matrix;
- decoder->font_offset = dict->font_offset;
- decoder->lenIV = dict->private_dict.lenIV;
-
- /* Decode the charstring. */
-
- /* Adjustment for seed bytes. */
- cs_offset = decoder->lenIV >= 0 ? (FT_UInt)decoder->lenIV : 0;
-
- /* Decrypt only if lenIV >= 0. */
- if ( decoder->lenIV >= 0 )
- psaux->t1_decrypt( charstring, glyph_length, 4330 );
-
- error = decoder->funcs.parse_charstrings(
- decoder, charstring + cs_offset,
- glyph_length - cs_offset );
- }
-
- FT_FREE( charstring );
-
-#ifdef FT_CONFIG_OPTION_INCREMENTAL
-
- /* Incremental fonts can optionally override the metrics. */
- if ( !error && inc && inc->funcs->get_glyph_metrics )
- {
- FT_Incremental_MetricsRec metrics;
-
-
- metrics.bearing_x = FIXED_TO_INT( decoder->builder.left_bearing.x );
- metrics.bearing_y = 0;
- metrics.advance = FIXED_TO_INT( decoder->builder.advance.x );
- metrics.advance_v = FIXED_TO_INT( decoder->builder.advance.y );
-
- error = inc->funcs->get_glyph_metrics( inc->object,
- glyph_index, FALSE, &metrics );
-
- decoder->builder.left_bearing.x = INT_TO_FIXED( metrics.bearing_x );
- decoder->builder.advance.x = INT_TO_FIXED( metrics.advance );
- decoder->builder.advance.y = INT_TO_FIXED( metrics.advance_v );
- }
-
-#endif /* FT_CONFIG_OPTION_INCREMENTAL */
-
- Exit:
- return error;
- }
-
-
-#if 0
-
-
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
- /********** *********/
- /********** *********/
- /********** COMPUTE THE MAXIMUM ADVANCE WIDTH *********/
- /********** *********/
- /********** The following code is in charge of computing *********/
- /********** the maximum advance width of the font. It *********/
- /********** quickly processes each glyph charstring to *********/
- /********** extract the value from either a `sbw' or `seac' *********/
- /********** operator. *********/
- /********** *********/
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
-
-
- FT_LOCAL_DEF( FT_Error )
- cid_face_compute_max_advance( CID_Face face,
- FT_Int* max_advance )
- {
- FT_Error error;
- T1_DecoderRec decoder;
- FT_Int glyph_index;
-
- PSAux_Service psaux = (PSAux_Service)face->psaux;
-
-
- *max_advance = 0;
-
- /* Initialize load decoder */
- error = psaux->t1_decoder_funcs->init( &decoder,
- (FT_Face)face,
- 0, /* size */
- 0, /* glyph slot */
- 0, /* glyph names! XXX */
- 0, /* blend == 0 */
- 0, /* hinting == 0 */
- cid_load_glyph );
- if ( error )
- return error;
-
- /* TODO: initialize decoder.len_buildchar and decoder.buildchar */
- /* if we ever support CID-keyed multiple master fonts */
-
- decoder.builder.metrics_only = 1;
- decoder.builder.load_points = 0;
-
- /* for each glyph, parse the glyph charstring and extract */
- /* the advance width */
- for ( glyph_index = 0; glyph_index < face->root.num_glyphs;
- glyph_index++ )
- {
- /* now get load the unscaled outline */
- error = cid_load_glyph( &decoder, glyph_index );
- /* ignore the error if one occurred - skip to next glyph */
- }
-
- *max_advance = FIXED_TO_INT( decoder.builder.advance.x );
-
- psaux->t1_decoder_funcs->done( &decoder );
-
- return FT_Err_Ok;
- }
-
-
-#endif /* 0 */
-
-
- FT_LOCAL_DEF( FT_Error )
- cid_slot_load_glyph( FT_GlyphSlot cidglyph, /* CID_GlyphSlot */
- FT_Size cidsize, /* CID_Size */
- FT_UInt glyph_index,
- FT_Int32 load_flags )
- {
- CID_GlyphSlot glyph = (CID_GlyphSlot)cidglyph;
- FT_Error error;
- T1_DecoderRec decoder;
- CID_Face face = (CID_Face)cidglyph->face;
- FT_Bool hinting;
-
- PSAux_Service psaux = (PSAux_Service)face->psaux;
- FT_Matrix font_matrix;
- FT_Vector font_offset;
-
-
- if ( glyph_index >= (FT_UInt)face->root.num_glyphs )
- {
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- if ( load_flags & FT_LOAD_NO_RECURSE )
- load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING;
-
- glyph->x_scale = cidsize->metrics.x_scale;
- glyph->y_scale = cidsize->metrics.y_scale;
-
- cidglyph->outline.n_points = 0;
- cidglyph->outline.n_contours = 0;
-
- hinting = FT_BOOL( ( load_flags & FT_LOAD_NO_SCALE ) == 0 &&
- ( load_flags & FT_LOAD_NO_HINTING ) == 0 );
-
- cidglyph->format = FT_GLYPH_FORMAT_OUTLINE;
-
- error = psaux->t1_decoder_funcs->init( &decoder,
- cidglyph->face,
- cidsize,
- cidglyph,
- 0, /* glyph names -- XXX */
- 0, /* blend == 0 */
- hinting,
- FT_LOAD_TARGET_MODE( load_flags ),
- cid_load_glyph );
- if ( error )
- goto Exit;
-
- /* TODO: initialize decoder.len_buildchar and decoder.buildchar */
- /* if we ever support CID-keyed multiple master fonts */
-
- /* set up the decoder */
- decoder.builder.no_recurse = FT_BOOL(
- ( ( load_flags & FT_LOAD_NO_RECURSE ) != 0 ) );
-
- error = cid_load_glyph( &decoder, glyph_index );
- if ( error )
- goto Exit;
-
- font_matrix = decoder.font_matrix;
- font_offset = decoder.font_offset;
-
- /* save new glyph tables */
- psaux->t1_decoder_funcs->done( &decoder );
-
- /* now set the metrics -- this is rather simple, as */
- /* the left side bearing is the xMin, and the top side */
- /* bearing the yMax */
- cidglyph->outline.flags &= FT_OUTLINE_OWNER;
- cidglyph->outline.flags |= FT_OUTLINE_REVERSE_FILL;
-
- /* for composite glyphs, return only left side bearing and */
- /* advance width */
- if ( load_flags & FT_LOAD_NO_RECURSE )
- {
- FT_Slot_Internal internal = cidglyph->internal;
-
-
- cidglyph->metrics.horiBearingX =
- FIXED_TO_INT( decoder.builder.left_bearing.x );
- cidglyph->metrics.horiAdvance =
- FIXED_TO_INT( decoder.builder.advance.x );
-
- internal->glyph_matrix = font_matrix;
- internal->glyph_delta = font_offset;
- internal->glyph_transformed = 1;
- }
- else
- {
- FT_BBox cbox;
- FT_Glyph_Metrics* metrics = &cidglyph->metrics;
-
-
- /* copy the _unscaled_ advance width */
- metrics->horiAdvance =
- FIXED_TO_INT( decoder.builder.advance.x );
- cidglyph->linearHoriAdvance =
- FIXED_TO_INT( decoder.builder.advance.x );
- cidglyph->internal->glyph_transformed = 0;
-
- /* make up vertical ones */
- metrics->vertAdvance = ( face->cid.font_bbox.yMax -
- face->cid.font_bbox.yMin ) >> 16;
- cidglyph->linearVertAdvance = metrics->vertAdvance;
-
- cidglyph->format = FT_GLYPH_FORMAT_OUTLINE;
-
- if ( cidsize->metrics.y_ppem < 24 )
- cidglyph->outline.flags |= FT_OUTLINE_HIGH_PRECISION;
-
- /* apply the font matrix, if any */
- if ( font_matrix.xx != 0x10000L || font_matrix.yy != 0x10000L ||
- font_matrix.xy != 0 || font_matrix.yx != 0 )
- {
- FT_Outline_Transform( &cidglyph->outline, &font_matrix );
-
- metrics->horiAdvance = FT_MulFix( metrics->horiAdvance,
- font_matrix.xx );
- metrics->vertAdvance = FT_MulFix( metrics->vertAdvance,
- font_matrix.yy );
- }
-
- if ( font_offset.x || font_offset.y )
- {
- FT_Outline_Translate( &cidglyph->outline,
- font_offset.x,
- font_offset.y );
-
- metrics->horiAdvance += font_offset.x;
- metrics->vertAdvance += font_offset.y;
- }
-
- if ( ( load_flags & FT_LOAD_NO_SCALE ) == 0 )
- {
- /* scale the outline and the metrics */
- FT_Int n;
- FT_Outline* cur = decoder.builder.base;
- FT_Vector* vec = cur->points;
- FT_Fixed x_scale = glyph->x_scale;
- FT_Fixed y_scale = glyph->y_scale;
-
-
- /* First of all, scale the points */
- if ( !hinting || !decoder.builder.hints_funcs )
- for ( n = cur->n_points; n > 0; n--, vec++ )
- {
- vec->x = FT_MulFix( vec->x, x_scale );
- vec->y = FT_MulFix( vec->y, y_scale );
- }
-
- /* Then scale the metrics */
- metrics->horiAdvance = FT_MulFix( metrics->horiAdvance, x_scale );
- metrics->vertAdvance = FT_MulFix( metrics->vertAdvance, y_scale );
- }
-
- /* compute the other metrics */
- FT_Outline_Get_CBox( &cidglyph->outline, &cbox );
-
- metrics->width = cbox.xMax - cbox.xMin;
- metrics->height = cbox.yMax - cbox.yMin;
-
- metrics->horiBearingX = cbox.xMin;
- metrics->horiBearingY = cbox.yMax;
-
- if ( load_flags & FT_LOAD_VERTICAL_LAYOUT )
- {
- /* make up vertical ones */
- ft_synthesize_vertical_metrics( metrics,
- metrics->vertAdvance );
- }
- }
-
- Exit:
- return error;
- }
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/cid/cidgload.h b/chromium/third_party/pdfium/third_party/freetype/src/cid/cidgload.h
deleted file mode 100644
index 4a10ce505c3..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/cid/cidgload.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/***************************************************************************/
-/* */
-/* cidgload.h */
-/* */
-/* OpenType Glyph Loader (specification). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __CIDGLOAD_H__
-#define __CIDGLOAD_H__
-
-
-#include <ft2build.h>
-#include "cidobjs.h"
-
-
-FT_BEGIN_HEADER
-
-
-#if 0
-
- /* Compute the maximum advance width of a font through quick parsing */
- FT_LOCAL( FT_Error )
- cid_face_compute_max_advance( CID_Face face,
- FT_Int* max_advance );
-
-#endif /* 0 */
-
- FT_LOCAL( FT_Error )
- cid_slot_load_glyph( FT_GlyphSlot glyph, /* CID_Glyph_Slot */
- FT_Size size, /* CID_Size */
- FT_UInt glyph_index,
- FT_Int32 load_flags );
-
-
-FT_END_HEADER
-
-#endif /* __CIDGLOAD_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/cid/cidload.c b/chromium/third_party/pdfium/third_party/freetype/src/cid/cidload.c
deleted file mode 100644
index e23b82f6738..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/cid/cidload.c
+++ /dev/null
@@ -1,705 +0,0 @@
-/***************************************************************************/
-/* */
-/* cidload.c */
-/* */
-/* CID-keyed Type1 font loader (body). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_CONFIG_CONFIG_H
-#include FT_MULTIPLE_MASTERS_H
-#include FT_INTERNAL_TYPE1_TYPES_H
-
-#include "cidload.h"
-
-#include "ciderrs.h"
-
-
- /*************************************************************************/
- /* */
- /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
- /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
- /* messages during execution. */
- /* */
-#undef FT_COMPONENT
-#define FT_COMPONENT trace_cidload
-
-
- /* read a single offset */
- FT_LOCAL_DEF( FT_ULong )
- cid_get_offset( FT_Byte* *start,
- FT_Byte offsize )
- {
- FT_ULong result;
- FT_Byte* p = *start;
-
-
- for ( result = 0; offsize > 0; offsize-- )
- {
- result <<= 8;
- result |= *p++;
- }
-
- *start = p;
- return result;
- }
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** TYPE 1 SYMBOL PARSING *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
-
- static FT_Error
- cid_load_keyword( CID_Face face,
- CID_Loader* loader,
- const T1_Field keyword )
- {
- FT_Error error;
- CID_Parser* parser = &loader->parser;
- FT_Byte* object;
- void* dummy_object;
- CID_FaceInfo cid = &face->cid;
-
-
- /* if the keyword has a dedicated callback, call it */
- if ( keyword->type == T1_FIELD_TYPE_CALLBACK )
- {
- keyword->reader( (FT_Face)face, parser );
- error = parser->root.error;
- goto Exit;
- }
-
- /* we must now compute the address of our target object */
- switch ( keyword->location )
- {
- case T1_FIELD_LOCATION_CID_INFO:
- object = (FT_Byte*)cid;
- break;
-
- case T1_FIELD_LOCATION_FONT_INFO:
- object = (FT_Byte*)&cid->font_info;
- break;
-
- case T1_FIELD_LOCATION_FONT_EXTRA:
- object = (FT_Byte*)&face->font_extra;
- break;
-
- case T1_FIELD_LOCATION_BBOX:
- object = (FT_Byte*)&cid->font_bbox;
- break;
-
- default:
- {
- CID_FaceDict dict;
-
-
- if ( parser->num_dict < 0 || parser->num_dict >= cid->num_dicts )
- {
- FT_ERROR(( "cid_load_keyword: invalid use of `%s'\n",
- keyword->ident ));
- error = FT_THROW( Syntax_Error );
- goto Exit;
- }
-
- dict = cid->font_dicts + parser->num_dict;
- switch ( keyword->location )
- {
- case T1_FIELD_LOCATION_PRIVATE:
- object = (FT_Byte*)&dict->private_dict;
- break;
-
- default:
- object = (FT_Byte*)dict;
- }
- }
- }
-
- dummy_object = object;
-
- /* now, load the keyword data in the object's field(s) */
- if ( keyword->type == T1_FIELD_TYPE_INTEGER_ARRAY ||
- keyword->type == T1_FIELD_TYPE_FIXED_ARRAY )
- error = cid_parser_load_field_table( &loader->parser, keyword,
- &dummy_object );
- else
- error = cid_parser_load_field( &loader->parser,
- keyword, &dummy_object );
- Exit:
- return error;
- }
-
-
- FT_CALLBACK_DEF( FT_Error )
- cid_parse_font_matrix( CID_Face face,
- CID_Parser* parser )
- {
- CID_FaceDict dict;
- FT_Face root = (FT_Face)&face->root;
- FT_Fixed temp[6];
- FT_Fixed temp_scale;
-
-
- if ( parser->num_dict >= 0 && parser->num_dict < face->cid.num_dicts )
- {
- FT_Matrix* matrix;
- FT_Vector* offset;
- FT_Int result;
-
-
- dict = face->cid.font_dicts + parser->num_dict;
- matrix = &dict->font_matrix;
- offset = &dict->font_offset;
-
- /* input is scaled by 1000 to accommodate default FontMatrix */
- result = cid_parser_to_fixed_array( parser, 6, temp, 3 );
-
- if ( result < 6 )
- return FT_THROW( Invalid_File_Format );
-
- temp_scale = FT_ABS( temp[3] );
-
- if ( temp_scale == 0 )
- {
- FT_ERROR(( "cid_parse_font_matrix: invalid font matrix\n" ));
- return FT_THROW( Invalid_File_Format );
- }
-
- /* atypical case */
- if ( temp_scale != 0x10000L )
- {
- /* set units per EM based on FontMatrix values */
- root->units_per_EM = (FT_UShort)FT_DivFix( 1000, temp_scale );
-
- temp[0] = FT_DivFix( temp[0], temp_scale );
- temp[1] = FT_DivFix( temp[1], temp_scale );
- temp[2] = FT_DivFix( temp[2], temp_scale );
- temp[4] = FT_DivFix( temp[4], temp_scale );
- temp[5] = FT_DivFix( temp[5], temp_scale );
- temp[3] = temp[3] < 0 ? -0x10000L : 0x10000L;
- }
-
- matrix->xx = temp[0];
- matrix->yx = temp[1];
- matrix->xy = temp[2];
- matrix->yy = temp[3];
-
- /* note that the font offsets are expressed in integer font units */
- offset->x = temp[4] >> 16;
- offset->y = temp[5] >> 16;
- }
-
- return FT_Err_Ok;
- }
-
-
- FT_CALLBACK_DEF( FT_Error )
- parse_fd_array( CID_Face face,
- CID_Parser* parser )
- {
- CID_FaceInfo cid = &face->cid;
- FT_Memory memory = face->root.memory;
- FT_Error error = FT_Err_Ok;
- FT_Long num_dicts;
-
-
- num_dicts = cid_parser_to_int( parser );
- if ( num_dicts < 0 )
- {
- FT_ERROR(( "parse_fd_array: invalid number of dictionaries\n" ));
- error = FT_THROW( Invalid_File_Format );
- goto Exit;
- }
-
- if ( !cid->font_dicts )
- {
- FT_Int n;
-
-
- if ( FT_NEW_ARRAY( cid->font_dicts, num_dicts ) )
- goto Exit;
-
- cid->num_dicts = num_dicts;
-
- /* don't forget to set a few defaults */
- for ( n = 0; n < cid->num_dicts; n++ )
- {
- CID_FaceDict dict = cid->font_dicts + n;
-
-
- /* default value for lenIV */
- dict->private_dict.lenIV = 4;
- }
- }
-
- Exit:
- return error;
- }
-
-
- /* by mistake, `expansion_factor' appears both in PS_PrivateRec */
- /* and CID_FaceDictRec (both are public header files and can't */
- /* changed); we simply copy the value */
-
- FT_CALLBACK_DEF( FT_Error )
- parse_expansion_factor( CID_Face face,
- CID_Parser* parser )
- {
- CID_FaceDict dict;
-
-
- if ( parser->num_dict >= 0 && parser->num_dict < face->cid.num_dicts )
- {
- dict = face->cid.font_dicts + parser->num_dict;
-
- dict->expansion_factor = cid_parser_to_fixed( parser, 0 );
- dict->private_dict.expansion_factor = dict->expansion_factor;
- }
-
- return FT_Err_Ok;
- }
-
-
- static
- const T1_FieldRec cid_field_records[] =
- {
-
-#include "cidtoken.h"
-
- T1_FIELD_CALLBACK( "FDArray", parse_fd_array, 0 )
- T1_FIELD_CALLBACK( "FontMatrix", cid_parse_font_matrix, 0 )
- T1_FIELD_CALLBACK( "ExpansionFactor", parse_expansion_factor, 0 )
-
- { 0, T1_FIELD_LOCATION_CID_INFO, T1_FIELD_TYPE_NONE, 0, 0, 0, 0, 0, 0 }
- };
-
-
- static FT_Error
- cid_parse_dict( CID_Face face,
- CID_Loader* loader,
- FT_Byte* base,
- FT_ULong size )
- {
- CID_Parser* parser = &loader->parser;
-
-
- parser->root.cursor = base;
- parser->root.limit = base + size;
- parser->root.error = FT_Err_Ok;
-
- {
- FT_Byte* cur = base;
- FT_Byte* limit = cur + size;
-
-
- for (;;)
- {
- FT_Byte* newlimit;
-
-
- parser->root.cursor = cur;
- cid_parser_skip_spaces( parser );
-
- if ( parser->root.cursor >= limit )
- newlimit = limit - 1 - 17;
- else
- newlimit = parser->root.cursor - 17;
-
- /* look for `%ADOBeginFontDict' */
- for ( ; cur < newlimit; cur++ )
- {
- if ( *cur == '%' &&
- ft_strncmp( (char*)cur, "%ADOBeginFontDict", 17 ) == 0 )
- {
- /* if /FDArray was found, then cid->num_dicts is > 0, and */
- /* we can start increasing parser->num_dict */
- if ( face->cid.num_dicts > 0 )
- parser->num_dict++;
- }
- }
-
- cur = parser->root.cursor;
- /* no error can occur in cid_parser_skip_spaces */
- if ( cur >= limit )
- break;
-
- cid_parser_skip_PS_token( parser );
- if ( parser->root.cursor >= limit || parser->root.error )
- break;
-
- /* look for immediates */
- if ( *cur == '/' && cur + 2 < limit )
- {
- FT_UInt len;
-
-
- cur++;
- len = (FT_UInt)( parser->root.cursor - cur );
-
- if ( len > 0 && len < 22 )
- {
- /* now compare the immediate name to the keyword table */
- T1_Field keyword = (T1_Field)cid_field_records;
-
-
- for (;;)
- {
- FT_Byte* name;
-
-
- name = (FT_Byte*)keyword->ident;
- if ( !name )
- break;
-
- if ( cur[0] == name[0] &&
- len == ft_strlen( (const char*)name ) )
- {
- FT_UInt n;
-
-
- for ( n = 1; n < len; n++ )
- if ( cur[n] != name[n] )
- break;
-
- if ( n >= len )
- {
- /* we found it - run the parsing callback */
- parser->root.error = cid_load_keyword( face,
- loader,
- keyword );
- if ( parser->root.error )
- return parser->root.error;
- break;
- }
- }
- keyword++;
- }
- }
- }
-
- cur = parser->root.cursor;
- }
- }
- return parser->root.error;
- }
-
-
- /* read the subrmap and the subrs of each font dict */
- static FT_Error
- cid_read_subrs( CID_Face face )
- {
- CID_FaceInfo cid = &face->cid;
- FT_Memory memory = face->root.memory;
- FT_Stream stream = face->cid_stream;
- FT_Error error;
- FT_Int n;
- CID_Subrs subr;
- FT_UInt max_offsets = 0;
- FT_ULong* offsets = NULL;
- PSAux_Service psaux = (PSAux_Service)face->psaux;
-
-
- if ( FT_NEW_ARRAY( face->subrs, cid->num_dicts ) )
- goto Exit;
-
- subr = face->subrs;
- for ( n = 0; n < cid->num_dicts; n++, subr++ )
- {
- CID_FaceDict dict = cid->font_dicts + n;
- FT_Int lenIV = dict->private_dict.lenIV;
- FT_UInt count, num_subrs = dict->num_subrs;
- FT_ULong data_len;
- FT_Byte* p;
-
-
- /* Check for possible overflow. */
- if ( num_subrs == FT_UINT_MAX )
- {
- error = FT_THROW( Syntax_Error );
- goto Fail;
- }
-
- /* reallocate offsets array if needed */
- if ( num_subrs + 1 > max_offsets )
- {
- FT_UInt new_max = FT_PAD_CEIL( num_subrs + 1, 4 );
-
-
- if ( new_max <= max_offsets )
- {
- error = FT_THROW( Syntax_Error );
- goto Fail;
- }
-
- if ( FT_RENEW_ARRAY( offsets, max_offsets, new_max ) )
- goto Fail;
-
- max_offsets = new_max;
- }
-
- /* read the subrmap's offsets */
- if ( FT_STREAM_SEEK( cid->data_offset + dict->subrmap_offset ) ||
- FT_FRAME_ENTER( ( num_subrs + 1 ) * (FT_UInt)dict->sd_bytes ) )
- goto Fail;
-
- p = (FT_Byte*)stream->cursor;
- for ( count = 0; count <= num_subrs; count++ )
- offsets[count] = cid_get_offset( &p, (FT_Byte)dict->sd_bytes );
-
- FT_FRAME_EXIT();
-
- /* offsets must be ordered */
- for ( count = 1; count <= num_subrs; count++ )
- if ( offsets[count - 1] > offsets[count] )
- goto Fail;
-
- /* now, compute the size of subrs charstrings, */
- /* allocate, and read them */
- data_len = offsets[num_subrs] - offsets[0];
-
- if ( FT_NEW_ARRAY( subr->code, num_subrs + 1 ) ||
- FT_ALLOC( subr->code[0], data_len ) )
- goto Fail;
-
- if ( FT_STREAM_SEEK( cid->data_offset + offsets[0] ) ||
- FT_STREAM_READ( subr->code[0], data_len ) )
- goto Fail;
-
- /* set up pointers */
- for ( count = 1; count <= num_subrs; count++ )
- {
- FT_ULong len;
-
-
- len = offsets[count] - offsets[count - 1];
- subr->code[count] = subr->code[count - 1] + len;
- }
-
- /* decrypt subroutines, but only if lenIV >= 0 */
- if ( lenIV >= 0 )
- {
- for ( count = 0; count < num_subrs; count++ )
- {
- FT_ULong len;
-
-
- len = offsets[count + 1] - offsets[count];
- psaux->t1_decrypt( subr->code[count], len, 4330 );
- }
- }
-
- subr->num_subrs = (FT_Int)num_subrs;
- }
-
- Exit:
- FT_FREE( offsets );
- return error;
-
- Fail:
- if ( face->subrs )
- {
- for ( n = 0; n < cid->num_dicts; n++ )
- {
- if ( face->subrs[n].code )
- FT_FREE( face->subrs[n].code[0] );
-
- FT_FREE( face->subrs[n].code );
- }
- FT_FREE( face->subrs );
- }
- goto Exit;
- }
-
-
- static void
- cid_init_loader( CID_Loader* loader,
- CID_Face face )
- {
- FT_UNUSED( face );
-
- FT_MEM_ZERO( loader, sizeof ( *loader ) );
- }
-
-
- static void
- cid_done_loader( CID_Loader* loader )
- {
- CID_Parser* parser = &loader->parser;
-
-
- /* finalize parser */
- cid_parser_done( parser );
- }
-
-
- static FT_Error
- cid_hex_to_binary( FT_Byte* data,
- FT_ULong data_len,
- FT_ULong offset,
- CID_Face face )
- {
- FT_Stream stream = face->root.stream;
- FT_Error error;
-
- FT_Byte buffer[256];
- FT_Byte *p, *plimit;
- FT_Byte *d, *dlimit;
- FT_Byte val;
-
- FT_Bool upper_nibble, done;
-
-
- if ( FT_STREAM_SEEK( offset ) )
- goto Exit;
-
- d = data;
- dlimit = d + data_len;
- p = buffer;
- plimit = p;
-
- upper_nibble = 1;
- done = 0;
-
- while ( d < dlimit )
- {
- if ( p >= plimit )
- {
- FT_ULong oldpos = FT_STREAM_POS();
- FT_ULong size = stream->size - oldpos;
-
-
- if ( size == 0 )
- {
- error = FT_THROW( Syntax_Error );
- goto Exit;
- }
-
- if ( FT_STREAM_READ( buffer, 256 > size ? size : 256 ) )
- goto Exit;
- p = buffer;
- plimit = p + FT_STREAM_POS() - oldpos;
- }
-
- if ( ft_isdigit( *p ) )
- val = (FT_Byte)( *p - '0' );
- else if ( *p >= 'a' && *p <= 'f' )
- val = (FT_Byte)( *p - 'a' );
- else if ( *p >= 'A' && *p <= 'F' )
- val = (FT_Byte)( *p - 'A' + 10 );
- else if ( *p == ' ' ||
- *p == '\t' ||
- *p == '\r' ||
- *p == '\n' ||
- *p == '\f' ||
- *p == '\0' )
- {
- p++;
- continue;
- }
- else if ( *p == '>' )
- {
- val = 0;
- done = 1;
- }
- else
- {
- error = FT_THROW( Syntax_Error );
- goto Exit;
- }
-
- if ( upper_nibble )
- *d = (FT_Byte)( val << 4 );
- else
- {
- *d = (FT_Byte)( *d + val );
- d++;
- }
-
- upper_nibble = (FT_Byte)( 1 - upper_nibble );
-
- if ( done )
- break;
-
- p++;
- }
-
- error = FT_Err_Ok;
-
- Exit:
- return error;
- }
-
-
- FT_LOCAL_DEF( FT_Error )
- cid_face_open( CID_Face face,
- FT_Int face_index )
- {
- CID_Loader loader;
- CID_Parser* parser;
- FT_Memory memory = face->root.memory;
- FT_Error error;
-
-
- cid_init_loader( &loader, face );
-
- parser = &loader.parser;
- error = cid_parser_new( parser, face->root.stream, face->root.memory,
- (PSAux_Service)face->psaux );
- if ( error )
- goto Exit;
-
- error = cid_parse_dict( face, &loader,
- parser->postscript,
- parser->postscript_len );
- if ( error )
- goto Exit;
-
- if ( face_index < 0 )
- goto Exit;
-
- if ( FT_NEW( face->cid_stream ) )
- goto Exit;
-
- if ( parser->binary_length )
- {
- /* we must convert the data section from hexadecimal to binary */
- if ( FT_ALLOC( face->binary_data, parser->binary_length ) ||
- cid_hex_to_binary( face->binary_data, parser->binary_length,
- parser->data_offset, face ) )
- goto Exit;
-
- FT_Stream_OpenMemory( face->cid_stream,
- face->binary_data, parser->binary_length );
- face->cid.data_offset = 0;
- }
- else
- {
- *face->cid_stream = *face->root.stream;
- face->cid.data_offset = loader.parser.data_offset;
- }
-
- error = cid_read_subrs( face );
-
- Exit:
- cid_done_loader( &loader );
- return error;
- }
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/cid/cidload.h b/chromium/third_party/pdfium/third_party/freetype/src/cid/cidload.h
deleted file mode 100644
index d7776d2f88a..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/cid/cidload.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/***************************************************************************/
-/* */
-/* cidload.h */
-/* */
-/* CID-keyed Type1 font loader (specification). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __CIDLOAD_H__
-#define __CIDLOAD_H__
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_STREAM_H
-#include "cidparse.h"
-
-
-FT_BEGIN_HEADER
-
-
- typedef struct CID_Loader_
- {
- CID_Parser parser; /* parser used to read the stream */
- FT_Int num_chars; /* number of characters in encoding */
-
- } CID_Loader;
-
-
- FT_LOCAL( FT_ULong )
- cid_get_offset( FT_Byte** start,
- FT_Byte offsize );
-
- FT_LOCAL( FT_Error )
- cid_face_open( CID_Face face,
- FT_Int face_index );
-
-
-FT_END_HEADER
-
-#endif /* __CIDLOAD_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/cid/cidobjs.c b/chromium/third_party/pdfium/third_party/freetype/src/cid/cidobjs.c
deleted file mode 100644
index bf1519bc6e7..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/cid/cidobjs.c
+++ /dev/null
@@ -1,492 +0,0 @@
-/***************************************************************************/
-/* */
-/* cidobjs.c */
-/* */
-/* CID objects manager (body). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-
-#include "cidgload.h"
-#include "cidload.h"
-
-#include FT_SERVICE_POSTSCRIPT_CMAPS_H
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
-#include FT_INTERNAL_POSTSCRIPT_HINTS_H
-
-#include "ciderrs.h"
-
-
- /*************************************************************************/
- /* */
- /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
- /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
- /* messages during execution. */
- /* */
-#undef FT_COMPONENT
-#define FT_COMPONENT trace_cidobjs
-
-
- /*************************************************************************/
- /* */
- /* SLOT FUNCTIONS */
- /* */
- /*************************************************************************/
-
- FT_LOCAL_DEF( void )
- cid_slot_done( FT_GlyphSlot slot )
- {
- slot->internal->glyph_hints = NULL;
- }
-
-
- FT_LOCAL_DEF( FT_Error )
- cid_slot_init( FT_GlyphSlot slot )
- {
- CID_Face face;
- PSHinter_Service pshinter;
-
-
- face = (CID_Face)slot->face;
- pshinter = (PSHinter_Service)face->pshinter;
-
- if ( pshinter )
- {
- FT_Module module;
-
-
- module = FT_Get_Module( slot->face->driver->root.library,
- "pshinter" );
- if ( module )
- {
- T1_Hints_Funcs funcs;
-
-
- funcs = pshinter->get_t1_funcs( module );
- slot->internal->glyph_hints = (void*)funcs;
- }
- }
-
- return 0;
- }
-
-
- /*************************************************************************/
- /* */
- /* SIZE FUNCTIONS */
- /* */
- /*************************************************************************/
-
-
- static PSH_Globals_Funcs
- cid_size_get_globals_funcs( CID_Size size )
- {
- CID_Face face = (CID_Face)size->root.face;
- PSHinter_Service pshinter = (PSHinter_Service)face->pshinter;
- FT_Module module;
-
-
- module = FT_Get_Module( size->root.face->driver->root.library,
- "pshinter" );
- return ( module && pshinter && pshinter->get_globals_funcs )
- ? pshinter->get_globals_funcs( module )
- : 0;
- }
-
-
- FT_LOCAL_DEF( void )
- cid_size_done( FT_Size cidsize ) /* CID_Size */
- {
- CID_Size size = (CID_Size)cidsize;
-
-
- if ( cidsize->internal )
- {
- PSH_Globals_Funcs funcs;
-
-
- funcs = cid_size_get_globals_funcs( size );
- if ( funcs )
- funcs->destroy( (PSH_Globals)cidsize->internal );
-
- cidsize->internal = NULL;
- }
- }
-
-
- FT_LOCAL_DEF( FT_Error )
- cid_size_init( FT_Size cidsize ) /* CID_Size */
- {
- CID_Size size = (CID_Size)cidsize;
- FT_Error error = FT_Err_Ok;
- PSH_Globals_Funcs funcs = cid_size_get_globals_funcs( size );
-
-
- if ( funcs )
- {
- PSH_Globals globals;
- CID_Face face = (CID_Face)cidsize->face;
- CID_FaceDict dict = face->cid.font_dicts + face->root.face_index;
- PS_Private priv = &dict->private_dict;
-
-
- error = funcs->create( cidsize->face->memory, priv, &globals );
- if ( !error )
- cidsize->internal = (FT_Size_Internal)(void*)globals;
- }
-
- return error;
- }
-
-
- FT_LOCAL( FT_Error )
- cid_size_request( FT_Size size,
- FT_Size_Request req )
- {
- PSH_Globals_Funcs funcs;
-
-
- FT_Request_Metrics( size->face, req );
-
- funcs = cid_size_get_globals_funcs( (CID_Size)size );
-
- if ( funcs )
- funcs->set_scale( (PSH_Globals)size->internal,
- size->metrics.x_scale,
- size->metrics.y_scale,
- 0, 0 );
-
- return FT_Err_Ok;
- }
-
-
- /*************************************************************************/
- /* */
- /* FACE FUNCTIONS */
- /* */
- /*************************************************************************/
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* cid_face_done */
- /* */
- /* <Description> */
- /* Finalizes a given face object. */
- /* */
- /* <Input> */
- /* face :: A pointer to the face object to destroy. */
- /* */
- FT_LOCAL_DEF( void )
- cid_face_done( FT_Face cidface ) /* CID_Face */
- {
- CID_Face face = (CID_Face)cidface;
- FT_Memory memory;
- CID_FaceInfo cid;
- PS_FontInfo info;
-
-
- if ( !face )
- return;
-
- cid = &face->cid;
- info = &cid->font_info;
- memory = cidface->memory;
-
- /* release subrs */
- if ( face->subrs )
- {
- FT_Int n;
-
-
- for ( n = 0; n < cid->num_dicts; n++ )
- {
- CID_Subrs subr = face->subrs + n;
-
-
- if ( subr->code )
- {
- FT_FREE( subr->code[0] );
- FT_FREE( subr->code );
- }
- }
-
- FT_FREE( face->subrs );
- }
-
- /* release FontInfo strings */
- FT_FREE( info->version );
- FT_FREE( info->notice );
- FT_FREE( info->full_name );
- FT_FREE( info->family_name );
- FT_FREE( info->weight );
-
- /* release font dictionaries */
- FT_FREE( cid->font_dicts );
- cid->num_dicts = 0;
-
- /* release other strings */
- FT_FREE( cid->cid_font_name );
- FT_FREE( cid->registry );
- FT_FREE( cid->ordering );
-
- cidface->family_name = NULL;
- cidface->style_name = NULL;
-
- FT_FREE( face->binary_data );
- FT_FREE( face->cid_stream );
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* cid_face_init */
- /* */
- /* <Description> */
- /* Initializes a given CID face object. */
- /* */
- /* <Input> */
- /* stream :: The source font stream. */
- /* */
- /* face_index :: The index of the font face in the resource. */
- /* */
- /* num_params :: Number of additional generic parameters. Ignored. */
- /* */
- /* params :: Additional generic parameters. Ignored. */
- /* */
- /* <InOut> */
- /* face :: The newly built face object. */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. */
- /* */
- FT_LOCAL_DEF( FT_Error )
- cid_face_init( FT_Stream stream,
- FT_Face cidface, /* CID_Face */
- FT_Int face_index,
- FT_Int num_params,
- FT_Parameter* params )
- {
- CID_Face face = (CID_Face)cidface;
- FT_Error error;
- PSAux_Service psaux;
- PSHinter_Service pshinter;
-
- FT_UNUSED( num_params );
- FT_UNUSED( params );
- FT_UNUSED( stream );
-
-
- cidface->num_faces = 1;
-
- psaux = (PSAux_Service)face->psaux;
- if ( !psaux )
- {
- psaux = (PSAux_Service)FT_Get_Module_Interface(
- FT_FACE_LIBRARY( face ), "psaux" );
-
- if ( !psaux )
- {
- FT_ERROR(( "cid_face_init: cannot access `psaux' module\n" ));
- error = FT_THROW( Missing_Module );
- goto Exit;
- }
-
- face->psaux = psaux;
- }
-
- pshinter = (PSHinter_Service)face->pshinter;
- if ( !pshinter )
- {
- pshinter = (PSHinter_Service)FT_Get_Module_Interface(
- FT_FACE_LIBRARY( face ), "pshinter" );
-
- face->pshinter = pshinter;
- }
-
- FT_TRACE2(( "CID driver\n" ));
-
- /* open the tokenizer; this will also check the font format */
- if ( FT_STREAM_SEEK( 0 ) )
- goto Exit;
-
- error = cid_face_open( face, face_index );
- if ( error )
- goto Exit;
-
- /* if we just wanted to check the format, leave successfully now */
- if ( face_index < 0 )
- goto Exit;
-
- /* check the face index */
- /* XXX: handle CID fonts with more than a single face */
- if ( ( face_index & 0xFFFF ) != 0 )
- {
- FT_ERROR(( "cid_face_init: invalid face index\n" ));
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- /* now load the font program into the face object */
-
- /* initialize the face object fields */
-
- /* set up root face fields */
- {
- CID_FaceInfo cid = &face->cid;
- PS_FontInfo info = &cid->font_info;
-
-
- cidface->num_glyphs = (FT_Long)cid->cid_count;
- cidface->num_charmaps = 0;
-
- cidface->face_index = face_index & 0xFFFF;
-
- cidface->face_flags |= FT_FACE_FLAG_SCALABLE | /* scalable outlines */
- FT_FACE_FLAG_HORIZONTAL | /* horizontal data */
- FT_FACE_FLAG_HINTER; /* has native hinter */
-
- if ( info->is_fixed_pitch )
- cidface->face_flags |= FT_FACE_FLAG_FIXED_WIDTH;
-
- /* XXX: TODO: add kerning with .afm support */
-
- /* get style name -- be careful, some broken fonts only */
- /* have a /FontName dictionary entry! */
- cidface->family_name = info->family_name;
- /* assume "Regular" style if we don't know better */
- cidface->style_name = (char *)"Regular";
- if ( cidface->family_name )
- {
- char* full = info->full_name;
- char* family = cidface->family_name;
-
-
- if ( full )
- {
- while ( *full )
- {
- if ( *full == *family )
- {
- family++;
- full++;
- }
- else
- {
- if ( *full == ' ' || *full == '-' )
- full++;
- else if ( *family == ' ' || *family == '-' )
- family++;
- else
- {
- if ( !*family )
- cidface->style_name = full;
- break;
- }
- }
- }
- }
- }
- else
- {
- /* do we have a `/FontName'? */
- if ( cid->cid_font_name )
- cidface->family_name = cid->cid_font_name;
- }
-
- /* compute style flags */
- cidface->style_flags = 0;
- if ( info->italic_angle )
- cidface->style_flags |= FT_STYLE_FLAG_ITALIC;
- if ( info->weight )
- {
- if ( !ft_strcmp( info->weight, "Bold" ) ||
- !ft_strcmp( info->weight, "Black" ) )
- cidface->style_flags |= FT_STYLE_FLAG_BOLD;
- }
-
- /* no embedded bitmap support */
- cidface->num_fixed_sizes = 0;
- cidface->available_sizes = NULL;
-
- cidface->bbox.xMin = cid->font_bbox.xMin >> 16;
- cidface->bbox.yMin = cid->font_bbox.yMin >> 16;
- /* no `U' suffix here to 0xFFFF! */
- cidface->bbox.xMax = ( cid->font_bbox.xMax + 0xFFFF ) >> 16;
- cidface->bbox.yMax = ( cid->font_bbox.yMax + 0xFFFF ) >> 16;
-
- if ( !cidface->units_per_EM )
- cidface->units_per_EM = 1000;
-
- cidface->ascender = (FT_Short)( cidface->bbox.yMax );
- cidface->descender = (FT_Short)( cidface->bbox.yMin );
-
- cidface->height = (FT_Short)( ( cidface->units_per_EM * 12 ) / 10 );
- if ( cidface->height < cidface->ascender - cidface->descender )
- cidface->height = (FT_Short)( cidface->ascender - cidface->descender );
-
- cidface->underline_position = (FT_Short)info->underline_position;
- cidface->underline_thickness = (FT_Short)info->underline_thickness;
- }
-
- Exit:
- return error;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* cid_driver_init */
- /* */
- /* <Description> */
- /* Initializes a given CID driver object. */
- /* */
- /* <Input> */
- /* driver :: A handle to the target driver object. */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. */
- /* */
- FT_LOCAL_DEF( FT_Error )
- cid_driver_init( FT_Module driver )
- {
- FT_UNUSED( driver );
-
- return FT_Err_Ok;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* cid_driver_done */
- /* */
- /* <Description> */
- /* Finalizes a given CID driver. */
- /* */
- /* <Input> */
- /* driver :: A handle to the target CID driver. */
- /* */
- FT_LOCAL_DEF( void )
- cid_driver_done( FT_Module driver )
- {
- FT_UNUSED( driver );
- }
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/cid/cidobjs.h b/chromium/third_party/pdfium/third_party/freetype/src/cid/cidobjs.h
deleted file mode 100644
index e9095ca68eb..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/cid/cidobjs.h
+++ /dev/null
@@ -1,154 +0,0 @@
-/***************************************************************************/
-/* */
-/* cidobjs.h */
-/* */
-/* CID objects manager (specification). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __CIDOBJS_H__
-#define __CIDOBJS_H__
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_OBJECTS_H
-#include FT_CONFIG_CONFIG_H
-#include FT_INTERNAL_TYPE1_TYPES_H
-
-
-FT_BEGIN_HEADER
-
-
- /* The following structures must be defined by the hinter */
- typedef struct CID_Size_Hints_ CID_Size_Hints;
- typedef struct CID_Glyph_Hints_ CID_Glyph_Hints;
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* CID_Driver */
- /* */
- /* <Description> */
- /* A handle to a Type 1 driver object. */
- /* */
- typedef struct CID_DriverRec_* CID_Driver;
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* CID_Size */
- /* */
- /* <Description> */
- /* A handle to a Type 1 size object. */
- /* */
- typedef struct CID_SizeRec_* CID_Size;
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* CID_GlyphSlot */
- /* */
- /* <Description> */
- /* A handle to a Type 1 glyph slot object. */
- /* */
- typedef struct CID_GlyphSlotRec_* CID_GlyphSlot;
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* CID_CharMap */
- /* */
- /* <Description> */
- /* A handle to a Type 1 character mapping object. */
- /* */
- /* <Note> */
- /* The Type 1 format doesn't use a charmap but an encoding table. */
- /* The driver is responsible for making up charmap objects */
- /* corresponding to these tables. */
- /* */
- typedef struct CID_CharMapRec_* CID_CharMap;
-
-
- /*************************************************************************/
- /* */
- /* HERE BEGINS THE TYPE 1 SPECIFIC STUFF */
- /* */
- /*************************************************************************/
-
-
- typedef struct CID_SizeRec_
- {
- FT_SizeRec root;
- FT_Bool valid;
-
- } CID_SizeRec;
-
-
- typedef struct CID_GlyphSlotRec_
- {
- FT_GlyphSlotRec root;
-
- FT_Bool hint;
- FT_Bool scaled;
-
- FT_Fixed x_scale;
- FT_Fixed y_scale;
-
- } CID_GlyphSlotRec;
-
-
- FT_LOCAL( void )
- cid_slot_done( FT_GlyphSlot slot );
-
- FT_LOCAL( FT_Error )
- cid_slot_init( FT_GlyphSlot slot );
-
-
- FT_LOCAL( void )
- cid_size_done( FT_Size size ); /* CID_Size */
-
- FT_LOCAL( FT_Error )
- cid_size_init( FT_Size size ); /* CID_Size */
-
- FT_LOCAL( FT_Error )
- cid_size_request( FT_Size size, /* CID_Size */
- FT_Size_Request req );
-
- FT_LOCAL( FT_Error )
- cid_face_init( FT_Stream stream,
- FT_Face face, /* CID_Face */
- FT_Int face_index,
- FT_Int num_params,
- FT_Parameter* params );
-
- FT_LOCAL( void )
- cid_face_done( FT_Face face ); /* CID_Face */
-
-
- FT_LOCAL( FT_Error )
- cid_driver_init( FT_Module driver );
-
- FT_LOCAL( void )
- cid_driver_done( FT_Module driver );
-
-
-FT_END_HEADER
-
-#endif /* __CIDOBJS_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/cid/cidparse.c b/chromium/third_party/pdfium/third_party/freetype/src/cid/cidparse.c
deleted file mode 100644
index c276949779b..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/cid/cidparse.c
+++ /dev/null
@@ -1,234 +0,0 @@
-/***************************************************************************/
-/* */
-/* cidparse.c */
-/* */
-/* CID-keyed Type1 parser (body). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_STREAM_H
-
-#include "cidparse.h"
-
-#include "ciderrs.h"
-
-
- /*************************************************************************/
- /* */
- /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
- /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
- /* messages during execution. */
- /* */
-#undef FT_COMPONENT
-#define FT_COMPONENT trace_cidparse
-
-
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** INPUT STREAM PARSER *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
-
-
- FT_LOCAL_DEF( FT_Error )
- cid_parser_new( CID_Parser* parser,
- FT_Stream stream,
- FT_Memory memory,
- PSAux_Service psaux )
- {
- FT_Error error;
- FT_ULong base_offset, offset, ps_len;
- FT_Byte *cur, *limit;
- FT_Byte *arg1, *arg2;
-
-
- FT_MEM_ZERO( parser, sizeof ( *parser ) );
- psaux->ps_parser_funcs->init( &parser->root, 0, 0, memory );
-
- parser->stream = stream;
-
- base_offset = FT_STREAM_POS();
-
- /* first of all, check the font format in the header */
- if ( FT_FRAME_ENTER( 31 ) )
- goto Exit;
-
- if ( ft_strncmp( (char *)stream->cursor,
- "%!PS-Adobe-3.0 Resource-CIDFont", 31 ) )
- {
- FT_TRACE2(( " not a CID-keyed font\n" ));
- error = FT_THROW( Unknown_File_Format );
- }
-
- FT_FRAME_EXIT();
- if ( error )
- goto Exit;
-
- Again:
- /* now, read the rest of the file until we find */
- /* `StartData' or `/sfnts' */
- {
- FT_Byte buffer[256 + 10];
- FT_ULong read_len = 256 + 10;
- FT_Byte* p = buffer;
-
-
- for ( offset = FT_STREAM_POS(); ; offset += 256 )
- {
- FT_ULong stream_len;
-
-
- stream_len = stream->size - FT_STREAM_POS();
- if ( stream_len == 0 )
- {
- FT_TRACE2(( "cid_parser_new: no `StartData' keyword found\n" ));
- error = FT_THROW( Invalid_File_Format );
- goto Exit;
- }
-
- read_len = FT_MIN( read_len, stream_len );
- if ( FT_STREAM_READ( p, read_len ) )
- goto Exit;
-
- if ( read_len < 256 )
- p[read_len] = '\0';
-
- limit = p + read_len - 10;
-
- for ( p = buffer; p < limit; p++ )
- {
- if ( p[0] == 'S' && ft_strncmp( (char*)p, "StartData", 9 ) == 0 )
- {
- /* save offset of binary data after `StartData' */
- offset += (FT_ULong)( p - buffer + 10 );
- goto Found;
- }
- else if ( p[1] == 's' && ft_strncmp( (char*)p, "/sfnts", 6 ) == 0 )
- {
- offset += (FT_ULong)( p - buffer + 7 );
- goto Found;
- }
- }
-
- FT_MEM_MOVE( buffer, p, 10 );
- read_len = 256;
- p = buffer + 10;
- }
- }
-
- Found:
- /* We have found the start of the binary data or the `/sfnts' token. */
- /* Now rewind and extract the frame corresponding to this PostScript */
- /* section. */
-
- ps_len = offset - base_offset;
- if ( FT_STREAM_SEEK( base_offset ) ||
- FT_FRAME_EXTRACT( ps_len, parser->postscript ) )
- goto Exit;
-
- parser->data_offset = offset;
- parser->postscript_len = ps_len;
- parser->root.base = parser->postscript;
- parser->root.cursor = parser->postscript;
- parser->root.limit = parser->root.cursor + ps_len;
- parser->num_dict = -1;
-
- /* Finally, we check whether `StartData' or `/sfnts' was real -- */
- /* it could be in a comment or string. We also get the arguments */
- /* of `StartData' to find out whether the data is represented in */
- /* binary or hex format. */
-
- arg1 = parser->root.cursor;
- cid_parser_skip_PS_token( parser );
- cid_parser_skip_spaces ( parser );
- arg2 = parser->root.cursor;
- cid_parser_skip_PS_token( parser );
- cid_parser_skip_spaces ( parser );
-
- limit = parser->root.limit;
- cur = parser->root.cursor;
-
- while ( cur < limit )
- {
- if ( parser->root.error )
- {
- error = parser->root.error;
- goto Exit;
- }
-
- if ( cur[0] == 'S' && ft_strncmp( (char*)cur, "StartData", 9 ) == 0 )
- {
- if ( ft_strncmp( (char*)arg1, "(Hex)", 5 ) == 0 )
- {
- FT_Long tmp = ft_atol( (const char *)arg2 );
-
-
- if ( tmp < 0 )
- {
- FT_ERROR(( "cid_parser_new: invalid length of hex data\n" ));
- error = FT_THROW( Invalid_File_Format );
- }
- else
- parser->binary_length = (FT_ULong)tmp;
- }
-
- goto Exit;
- }
- else if ( cur[1] == 's' && ft_strncmp( (char*)cur, "/sfnts", 6 ) == 0 )
- {
- FT_TRACE2(( "cid_parser_new: cannot handle Type 11 fonts\n" ));
- error = FT_THROW( Unknown_File_Format );
- goto Exit;
- }
-
- cid_parser_skip_PS_token( parser );
- cid_parser_skip_spaces ( parser );
- arg1 = arg2;
- arg2 = cur;
- cur = parser->root.cursor;
- }
-
- /* we haven't found the correct `StartData'; go back and continue */
- /* searching */
- FT_FRAME_RELEASE( parser->postscript );
- if ( !FT_STREAM_SEEK( offset ) )
- goto Again;
-
- Exit:
- return error;
- }
-
-
- FT_LOCAL_DEF( void )
- cid_parser_done( CID_Parser* parser )
- {
- /* always free the private dictionary */
- if ( parser->postscript )
- {
- FT_Stream stream = parser->stream;
-
-
- FT_FRAME_RELEASE( parser->postscript );
- }
- parser->root.funcs.done( &parser->root );
- }
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/cid/cidparse.h b/chromium/third_party/pdfium/third_party/freetype/src/cid/cidparse.h
deleted file mode 100644
index f581bb43ff3..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/cid/cidparse.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/***************************************************************************/
-/* */
-/* cidparse.h */
-/* */
-/* CID-keyed Type1 parser (specification). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __CIDPARSE_H__
-#define __CIDPARSE_H__
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_TYPE1_TYPES_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
-
-
-FT_BEGIN_HEADER
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* CID_Parser */
- /* */
- /* <Description> */
- /* A CID_Parser is an object used to parse a Type 1 fonts very */
- /* quickly. */
- /* */
- /* <Fields> */
- /* root :: The root PS_ParserRec fields. */
- /* */
- /* stream :: The current input stream. */
- /* */
- /* postscript :: A pointer to the data to be parsed. */
- /* */
- /* postscript_len :: The length of the data to be parsed. */
- /* */
- /* data_offset :: The start position of the binary data (i.e., the */
- /* end of the data to be parsed. */
- /* */
- /* binary_length :: The length of the data after the `StartData' */
- /* command if the data format is hexadecimal. */
- /* */
- /* cid :: A structure which holds the information about */
- /* the current font. */
- /* */
- /* num_dict :: The number of font dictionaries. */
- /* */
- typedef struct CID_Parser_
- {
- PS_ParserRec root;
- FT_Stream stream;
-
- FT_Byte* postscript;
- FT_ULong postscript_len;
-
- FT_ULong data_offset;
-
- FT_ULong binary_length;
-
- CID_FaceInfo cid;
- FT_Int num_dict;
-
- } CID_Parser;
-
-
- FT_LOCAL( FT_Error )
- cid_parser_new( CID_Parser* parser,
- FT_Stream stream,
- FT_Memory memory,
- PSAux_Service psaux );
-
- FT_LOCAL( void )
- cid_parser_done( CID_Parser* parser );
-
-
- /*************************************************************************/
- /* */
- /* PARSING ROUTINES */
- /* */
- /*************************************************************************/
-
-#define cid_parser_skip_spaces( p ) \
- (p)->root.funcs.skip_spaces( &(p)->root )
-#define cid_parser_skip_PS_token( p ) \
- (p)->root.funcs.skip_PS_token( &(p)->root )
-
-#define cid_parser_to_int( p ) (p)->root.funcs.to_int( &(p)->root )
-#define cid_parser_to_fixed( p, t ) (p)->root.funcs.to_fixed( &(p)->root, t )
-
-#define cid_parser_to_coord_array( p, m, c ) \
- (p)->root.funcs.to_coord_array( &(p)->root, m, c )
-#define cid_parser_to_fixed_array( p, m, f, t ) \
- (p)->root.funcs.to_fixed_array( &(p)->root, m, f, t )
-#define cid_parser_to_token( p, t ) \
- (p)->root.funcs.to_token( &(p)->root, t )
-#define cid_parser_to_token_array( p, t, m, c ) \
- (p)->root.funcs.to_token_array( &(p)->root, t, m, c )
-
-#define cid_parser_load_field( p, f, o ) \
- (p)->root.funcs.load_field( &(p)->root, f, o, 0, 0 )
-#define cid_parser_load_field_table( p, f, o ) \
- (p)->root.funcs.load_field_table( &(p)->root, f, o, 0, 0 )
-
-
-FT_END_HEADER
-
-#endif /* __CIDPARSE_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/cid/cidriver.c b/chromium/third_party/pdfium/third_party/freetype/src/cid/cidriver.c
deleted file mode 100644
index 07c4cc410ba..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/cid/cidriver.c
+++ /dev/null
@@ -1,236 +0,0 @@
-/***************************************************************************/
-/* */
-/* cidriver.c */
-/* */
-/* CID driver interface (body). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include "cidriver.h"
-#include "cidgload.h"
-#include FT_INTERNAL_DEBUG_H
-
-#include "ciderrs.h"
-
-#include FT_SERVICE_POSTSCRIPT_NAME_H
-#include FT_SERVICE_FONT_FORMAT_H
-#include FT_SERVICE_POSTSCRIPT_INFO_H
-#include FT_SERVICE_CID_H
-
-
- /*************************************************************************/
- /* */
- /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
- /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
- /* messages during execution. */
- /* */
-#undef FT_COMPONENT
-#define FT_COMPONENT trace_ciddriver
-
-
- /*
- * POSTSCRIPT NAME SERVICE
- *
- */
-
- static const char*
- cid_get_postscript_name( CID_Face face )
- {
- const char* result = face->cid.cid_font_name;
-
-
- if ( result && result[0] == '/' )
- result++;
-
- return result;
- }
-
-
- static const FT_Service_PsFontNameRec cid_service_ps_name =
- {
- (FT_PsName_GetFunc) cid_get_postscript_name
- };
-
-
- /*
- * POSTSCRIPT INFO SERVICE
- *
- */
-
- static FT_Error
- cid_ps_get_font_info( FT_Face face,
- PS_FontInfoRec* afont_info )
- {
- *afont_info = ((CID_Face)face)->cid.font_info;
-
- return FT_Err_Ok;
- }
-
- static FT_Error
- cid_ps_get_font_extra( FT_Face face,
- PS_FontExtraRec* afont_extra )
- {
- *afont_extra = ((CID_Face)face)->font_extra;
-
- return FT_Err_Ok;
- }
-
- static const FT_Service_PsInfoRec cid_service_ps_info =
- {
- (PS_GetFontInfoFunc) cid_ps_get_font_info,
- (PS_GetFontExtraFunc) cid_ps_get_font_extra,
- (PS_HasGlyphNamesFunc) NULL, /* unsupported with CID fonts */
- (PS_GetFontPrivateFunc)NULL, /* unsupported */
- (PS_GetFontValueFunc) NULL /* not implemented */
- };
-
-
- /*
- * CID INFO SERVICE
- *
- */
- static FT_Error
- cid_get_ros( CID_Face face,
- const char* *registry,
- const char* *ordering,
- FT_Int *supplement )
- {
- CID_FaceInfo cid = &face->cid;
-
-
- if ( registry )
- *registry = cid->registry;
-
- if ( ordering )
- *ordering = cid->ordering;
-
- if ( supplement )
- *supplement = cid->supplement;
-
- return FT_Err_Ok;
- }
-
-
- static FT_Error
- cid_get_is_cid( CID_Face face,
- FT_Bool *is_cid )
- {
- FT_Error error = FT_Err_Ok;
- FT_UNUSED( face );
-
-
- if ( is_cid )
- *is_cid = 1; /* cid driver is only used for CID keyed fonts */
-
- return error;
- }
-
-
- static FT_Error
- cid_get_cid_from_glyph_index( CID_Face face,
- FT_UInt glyph_index,
- FT_UInt *cid )
- {
- FT_Error error = FT_Err_Ok;
- FT_UNUSED( face );
-
-
- if ( cid )
- *cid = glyph_index; /* identity mapping */
-
- return error;
- }
-
-
- static const FT_Service_CIDRec cid_service_cid_info =
- {
- (FT_CID_GetRegistryOrderingSupplementFunc)cid_get_ros,
- (FT_CID_GetIsInternallyCIDKeyedFunc) cid_get_is_cid,
- (FT_CID_GetCIDFromGlyphIndexFunc) cid_get_cid_from_glyph_index
- };
-
-
- /*
- * SERVICE LIST
- *
- */
-
- static const FT_ServiceDescRec cid_services[] =
- {
- { FT_SERVICE_ID_FONT_FORMAT, FT_FONT_FORMAT_CID },
- { FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &cid_service_ps_name },
- { FT_SERVICE_ID_POSTSCRIPT_INFO, &cid_service_ps_info },
- { FT_SERVICE_ID_CID, &cid_service_cid_info },
- { NULL, NULL }
- };
-
-
- FT_CALLBACK_DEF( FT_Module_Interface )
- cid_get_interface( FT_Module module,
- const char* cid_interface )
- {
- FT_UNUSED( module );
-
- return ft_service_list_lookup( cid_services, cid_interface );
- }
-
-
-
- FT_CALLBACK_TABLE_DEF
- const FT_Driver_ClassRec t1cid_driver_class =
- {
- /* first of all, the FT_Module_Class fields */
- {
- FT_MODULE_FONT_DRIVER |
- FT_MODULE_DRIVER_SCALABLE |
- FT_MODULE_DRIVER_HAS_HINTER,
-
- sizeof ( FT_DriverRec ),
- "t1cid", /* module name */
- 0x10000L, /* version 1.0 of driver */
- 0x20000L, /* requires FreeType 2.0 */
-
- 0,
-
- cid_driver_init,
- cid_driver_done,
- cid_get_interface
- },
-
- /* then the other font drivers fields */
- sizeof ( CID_FaceRec ),
- sizeof ( CID_SizeRec ),
- sizeof ( CID_GlyphSlotRec ),
-
- cid_face_init,
- cid_face_done,
-
- cid_size_init,
- cid_size_done,
- cid_slot_init,
- cid_slot_done,
-
- cid_slot_load_glyph,
-
- 0, /* FT_Face_GetKerningFunc */
- 0, /* FT_Face_AttachFunc */
-
- 0, /* FT_Face_GetAdvancesFunc */
-
- cid_size_request,
- 0 /* FT_Size_SelectFunc */
- };
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/cid/cidriver.h b/chromium/third_party/pdfium/third_party/freetype/src/cid/cidriver.h
deleted file mode 100644
index e5b8678464d..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/cid/cidriver.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/***************************************************************************/
-/* */
-/* cidriver.h */
-/* */
-/* High-level CID driver interface (specification). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __CIDRIVER_H__
-#define __CIDRIVER_H__
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_DRIVER_H
-
-
-FT_BEGIN_HEADER
-
-#ifdef FT_CONFIG_OPTION_PIC
-#error "this module does not support PIC yet"
-#endif
-
-
- FT_CALLBACK_TABLE
- const FT_Driver_ClassRec t1cid_driver_class;
-
-
-FT_END_HEADER
-
-#endif /* __CIDRIVER_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/cid/cidtoken.h b/chromium/third_party/pdfium/third_party/freetype/src/cid/cidtoken.h
deleted file mode 100644
index 82eae0ca6b0..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/cid/cidtoken.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/***************************************************************************/
-/* */
-/* cidtoken.h */
-/* */
-/* CID token definitions (specification only). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#undef FT_STRUCTURE
-#define FT_STRUCTURE CID_FaceInfoRec
-#undef T1CODE
-#define T1CODE T1_FIELD_LOCATION_CID_INFO
-
- T1_FIELD_KEY ( "CIDFontName", cid_font_name, 0 )
- T1_FIELD_FIXED ( "CIDFontVersion", cid_version, 0 )
- T1_FIELD_NUM ( "CIDFontType", cid_font_type, 0 )
- T1_FIELD_STRING( "Registry", registry, 0 )
- T1_FIELD_STRING( "Ordering", ordering, 0 )
- T1_FIELD_NUM ( "Supplement", supplement, 0 )
- T1_FIELD_NUM ( "UIDBase", uid_base, 0 )
- T1_FIELD_NUM ( "CIDMapOffset", cidmap_offset, 0 )
- T1_FIELD_NUM ( "FDBytes", fd_bytes, 0 )
- T1_FIELD_NUM ( "GDBytes", gd_bytes, 0 )
- T1_FIELD_NUM ( "CIDCount", cid_count, 0 )
-
-
-#undef FT_STRUCTURE
-#define FT_STRUCTURE PS_FontInfoRec
-#undef T1CODE
-#define T1CODE T1_FIELD_LOCATION_FONT_INFO
-
- T1_FIELD_STRING( "version", version, 0 )
- T1_FIELD_STRING( "Notice", notice, 0 )
- T1_FIELD_STRING( "FullName", full_name, 0 )
- T1_FIELD_STRING( "FamilyName", family_name, 0 )
- T1_FIELD_STRING( "Weight", weight, 0 )
- T1_FIELD_NUM ( "ItalicAngle", italic_angle, 0 )
- T1_FIELD_BOOL ( "isFixedPitch", is_fixed_pitch, 0 )
- T1_FIELD_NUM ( "UnderlinePosition", underline_position, 0 )
- T1_FIELD_NUM ( "UnderlineThickness", underline_thickness, 0 )
-
-#undef FT_STRUCTURE
-#define FT_STRUCTURE PS_FontExtraRec
-#undef T1CODE
-#define T1CODE T1_FIELD_LOCATION_FONT_EXTRA
-
- T1_FIELD_NUM ( "FSType", fs_type, 0 )
-
-
-#undef FT_STRUCTURE
-#define FT_STRUCTURE CID_FaceDictRec
-#undef T1CODE
-#define T1CODE T1_FIELD_LOCATION_FONT_DICT
-
- T1_FIELD_NUM ( "PaintType", paint_type, 0 )
- T1_FIELD_NUM ( "FontType", font_type, 0 )
- T1_FIELD_NUM ( "SubrMapOffset", subrmap_offset, 0 )
- T1_FIELD_NUM ( "SDBytes", sd_bytes, 0 )
- T1_FIELD_NUM ( "SubrCount", num_subrs, 0 )
- T1_FIELD_NUM ( "lenBuildCharArray", len_buildchar, 0 )
- T1_FIELD_FIXED( "ForceBoldThreshold", forcebold_threshold, 0 )
- T1_FIELD_FIXED( "StrokeWidth", stroke_width, 0 )
-
-
-#undef FT_STRUCTURE
-#define FT_STRUCTURE PS_PrivateRec
-#undef T1CODE
-#define T1CODE T1_FIELD_LOCATION_PRIVATE
-
- T1_FIELD_NUM ( "UniqueID", unique_id, 0 )
- T1_FIELD_NUM ( "lenIV", lenIV, 0 )
- T1_FIELD_NUM ( "LanguageGroup", language_group, 0 )
- T1_FIELD_NUM ( "password", password, 0 )
-
- T1_FIELD_FIXED_1000( "BlueScale", blue_scale, 0 )
- T1_FIELD_NUM ( "BlueShift", blue_shift, 0 )
- T1_FIELD_NUM ( "BlueFuzz", blue_fuzz, 0 )
-
- T1_FIELD_NUM_TABLE ( "BlueValues", blue_values, 14, 0 )
- T1_FIELD_NUM_TABLE ( "OtherBlues", other_blues, 10, 0 )
- T1_FIELD_NUM_TABLE ( "FamilyBlues", family_blues, 14, 0 )
- T1_FIELD_NUM_TABLE ( "FamilyOtherBlues", family_other_blues, 10, 0 )
-
- T1_FIELD_NUM_TABLE2( "StdHW", standard_width, 1, 0 )
- T1_FIELD_NUM_TABLE2( "StdVW", standard_height, 1, 0 )
- T1_FIELD_NUM_TABLE2( "MinFeature", min_feature, 2, 0 )
-
- T1_FIELD_NUM_TABLE ( "StemSnapH", snap_widths, 12, 0 )
- T1_FIELD_NUM_TABLE ( "StemSnapV", snap_heights, 12, 0 )
-
- T1_FIELD_BOOL ( "ForceBold", force_bold, 0 )
-
-
-#undef FT_STRUCTURE
-#define FT_STRUCTURE FT_BBox
-#undef T1CODE
-#define T1CODE T1_FIELD_LOCATION_BBOX
-
- T1_FIELD_BBOX( "FontBBox", xMin, 0 )
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/cid/type1cid.c b/chromium/third_party/pdfium/third_party/freetype/src/cid/type1cid.c
deleted file mode 100644
index 0d54ca7f44f..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/cid/type1cid.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/***************************************************************************/
-/* */
-/* type1cid.c */
-/* */
-/* FreeType OpenType driver component (body only). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#define FT_MAKE_OPTION_SINGLE_OBJECT
-
-#include <ft2build.h>
-#include "cidparse.c"
-#include "cidload.c"
-#include "cidobjs.c"
-#include "cidriver.c"
-#include "cidgload.c"
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/psaux/Jamfile b/chromium/third_party/pdfium/third_party/freetype/src/psaux/Jamfile
deleted file mode 100644
index 6793f0d5816..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/psaux/Jamfile
+++ /dev/null
@@ -1,35 +0,0 @@
-# FreeType 2 src/psaux Jamfile
-#
-# Copyright 2001-2015 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT. By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-SubDir FT2_TOP $(FT2_SRC_DIR) psaux ;
-
-{
- local _sources ;
-
- if $(FT2_MULTI)
- {
- _sources = afmparse
- psauxmod
- psconv
- psobjs
- t1cmap
- t1decode
- ;
- }
- else
- {
- _sources = psaux ;
- }
-
- Library $(FT2_LIB) : $(_sources).c ;
-}
-
-# end of src/psaux Jamfile
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/psaux/afmparse.c b/chromium/third_party/pdfium/third_party/freetype/src/psaux/afmparse.c
deleted file mode 100644
index 3ad44ec7240..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/psaux/afmparse.c
+++ /dev/null
@@ -1,977 +0,0 @@
-/***************************************************************************/
-/* */
-/* afmparse.c */
-/* */
-/* AFM parser (body). */
-/* */
-/* Copyright 2006-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
-
-#include "afmparse.h"
-#include "psconv.h"
-
-#include "psauxerr.h"
-
-
-/***************************************************************************/
-/* */
-/* AFM_Stream */
-/* */
-/* The use of AFM_Stream is largely inspired by parseAFM.[ch] from t1lib. */
-/* */
-/* */
-
- enum
- {
- AFM_STREAM_STATUS_NORMAL,
- AFM_STREAM_STATUS_EOC,
- AFM_STREAM_STATUS_EOL,
- AFM_STREAM_STATUS_EOF
- };
-
-
- typedef struct AFM_StreamRec_
- {
- FT_Byte* cursor;
- FT_Byte* base;
- FT_Byte* limit;
-
- FT_Int status;
-
- } AFM_StreamRec;
-
-
-#ifndef EOF
-#define EOF -1
-#endif
-
-
- /* this works because empty lines are ignored */
-#define AFM_IS_NEWLINE( ch ) ( (ch) == '\r' || (ch) == '\n' )
-
-#define AFM_IS_EOF( ch ) ( (ch) == EOF || (ch) == '\x1a' )
-#define AFM_IS_SPACE( ch ) ( (ch) == ' ' || (ch) == '\t' )
-
- /* column separator; there is no `column' in the spec actually */
-#define AFM_IS_SEP( ch ) ( (ch) == ';' )
-
-#define AFM_GETC() \
- ( ( (stream)->cursor < (stream)->limit ) ? *(stream)->cursor++ \
- : EOF )
-
-#define AFM_STREAM_KEY_BEGIN( stream ) \
- (char*)( (stream)->cursor - 1 )
-
-#define AFM_STREAM_KEY_LEN( stream, key ) \
- (FT_Offset)( (char*)(stream)->cursor - key - 1 )
-
-#define AFM_STATUS_EOC( stream ) \
- ( (stream)->status >= AFM_STREAM_STATUS_EOC )
-
-#define AFM_STATUS_EOL( stream ) \
- ( (stream)->status >= AFM_STREAM_STATUS_EOL )
-
-#define AFM_STATUS_EOF( stream ) \
- ( (stream)->status >= AFM_STREAM_STATUS_EOF )
-
-
- static int
- afm_stream_skip_spaces( AFM_Stream stream )
- {
- int ch = 0; /* make stupid compiler happy */
-
-
- if ( AFM_STATUS_EOC( stream ) )
- return ';';
-
- while ( 1 )
- {
- ch = AFM_GETC();
- if ( !AFM_IS_SPACE( ch ) )
- break;
- }
-
- if ( AFM_IS_NEWLINE( ch ) )
- stream->status = AFM_STREAM_STATUS_EOL;
- else if ( AFM_IS_SEP( ch ) )
- stream->status = AFM_STREAM_STATUS_EOC;
- else if ( AFM_IS_EOF( ch ) )
- stream->status = AFM_STREAM_STATUS_EOF;
-
- return ch;
- }
-
-
- /* read a key or value in current column */
- static char*
- afm_stream_read_one( AFM_Stream stream )
- {
- char* str;
-
-
- afm_stream_skip_spaces( stream );
- if ( AFM_STATUS_EOC( stream ) )
- return NULL;
-
- str = AFM_STREAM_KEY_BEGIN( stream );
-
- while ( 1 )
- {
- int ch = AFM_GETC();
-
-
- if ( AFM_IS_SPACE( ch ) )
- break;
- else if ( AFM_IS_NEWLINE( ch ) )
- {
- stream->status = AFM_STREAM_STATUS_EOL;
- break;
- }
- else if ( AFM_IS_SEP( ch ) )
- {
- stream->status = AFM_STREAM_STATUS_EOC;
- break;
- }
- else if ( AFM_IS_EOF( ch ) )
- {
- stream->status = AFM_STREAM_STATUS_EOF;
- break;
- }
- }
-
- return str;
- }
-
-
- /* read a string (i.e., read to EOL) */
- static char*
- afm_stream_read_string( AFM_Stream stream )
- {
- char* str;
-
-
- afm_stream_skip_spaces( stream );
- if ( AFM_STATUS_EOL( stream ) )
- return NULL;
-
- str = AFM_STREAM_KEY_BEGIN( stream );
-
- /* scan to eol */
- while ( 1 )
- {
- int ch = AFM_GETC();
-
-
- if ( AFM_IS_NEWLINE( ch ) )
- {
- stream->status = AFM_STREAM_STATUS_EOL;
- break;
- }
- else if ( AFM_IS_EOF( ch ) )
- {
- stream->status = AFM_STREAM_STATUS_EOF;
- break;
- }
- }
-
- return str;
- }
-
-
- /*************************************************************************/
- /* */
- /* AFM_Parser */
- /* */
- /* */
-
- /* all keys defined in Ch. 7-10 of 5004.AFM_Spec.pdf */
- typedef enum AFM_Token_
- {
- AFM_TOKEN_ASCENDER,
- AFM_TOKEN_AXISLABEL,
- AFM_TOKEN_AXISTYPE,
- AFM_TOKEN_B,
- AFM_TOKEN_BLENDAXISTYPES,
- AFM_TOKEN_BLENDDESIGNMAP,
- AFM_TOKEN_BLENDDESIGNPOSITIONS,
- AFM_TOKEN_C,
- AFM_TOKEN_CC,
- AFM_TOKEN_CH,
- AFM_TOKEN_CAPHEIGHT,
- AFM_TOKEN_CHARWIDTH,
- AFM_TOKEN_CHARACTERSET,
- AFM_TOKEN_CHARACTERS,
- AFM_TOKEN_DESCENDER,
- AFM_TOKEN_ENCODINGSCHEME,
- AFM_TOKEN_ENDAXIS,
- AFM_TOKEN_ENDCHARMETRICS,
- AFM_TOKEN_ENDCOMPOSITES,
- AFM_TOKEN_ENDDIRECTION,
- AFM_TOKEN_ENDFONTMETRICS,
- AFM_TOKEN_ENDKERNDATA,
- AFM_TOKEN_ENDKERNPAIRS,
- AFM_TOKEN_ENDTRACKKERN,
- AFM_TOKEN_ESCCHAR,
- AFM_TOKEN_FAMILYNAME,
- AFM_TOKEN_FONTBBOX,
- AFM_TOKEN_FONTNAME,
- AFM_TOKEN_FULLNAME,
- AFM_TOKEN_ISBASEFONT,
- AFM_TOKEN_ISCIDFONT,
- AFM_TOKEN_ISFIXEDPITCH,
- AFM_TOKEN_ISFIXEDV,
- AFM_TOKEN_ITALICANGLE,
- AFM_TOKEN_KP,
- AFM_TOKEN_KPH,
- AFM_TOKEN_KPX,
- AFM_TOKEN_KPY,
- AFM_TOKEN_L,
- AFM_TOKEN_MAPPINGSCHEME,
- AFM_TOKEN_METRICSSETS,
- AFM_TOKEN_N,
- AFM_TOKEN_NOTICE,
- AFM_TOKEN_PCC,
- AFM_TOKEN_STARTAXIS,
- AFM_TOKEN_STARTCHARMETRICS,
- AFM_TOKEN_STARTCOMPOSITES,
- AFM_TOKEN_STARTDIRECTION,
- AFM_TOKEN_STARTFONTMETRICS,
- AFM_TOKEN_STARTKERNDATA,
- AFM_TOKEN_STARTKERNPAIRS,
- AFM_TOKEN_STARTKERNPAIRS0,
- AFM_TOKEN_STARTKERNPAIRS1,
- AFM_TOKEN_STARTTRACKKERN,
- AFM_TOKEN_STDHW,
- AFM_TOKEN_STDVW,
- AFM_TOKEN_TRACKKERN,
- AFM_TOKEN_UNDERLINEPOSITION,
- AFM_TOKEN_UNDERLINETHICKNESS,
- AFM_TOKEN_VV,
- AFM_TOKEN_VVECTOR,
- AFM_TOKEN_VERSION,
- AFM_TOKEN_W,
- AFM_TOKEN_W0,
- AFM_TOKEN_W0X,
- AFM_TOKEN_W0Y,
- AFM_TOKEN_W1,
- AFM_TOKEN_W1X,
- AFM_TOKEN_W1Y,
- AFM_TOKEN_WX,
- AFM_TOKEN_WY,
- AFM_TOKEN_WEIGHT,
- AFM_TOKEN_WEIGHTVECTOR,
- AFM_TOKEN_XHEIGHT,
- N_AFM_TOKENS,
- AFM_TOKEN_UNKNOWN
-
- } AFM_Token;
-
-
- static const char* const afm_key_table[N_AFM_TOKENS] =
- {
- "Ascender",
- "AxisLabel",
- "AxisType",
- "B",
- "BlendAxisTypes",
- "BlendDesignMap",
- "BlendDesignPositions",
- "C",
- "CC",
- "CH",
- "CapHeight",
- "CharWidth",
- "CharacterSet",
- "Characters",
- "Descender",
- "EncodingScheme",
- "EndAxis",
- "EndCharMetrics",
- "EndComposites",
- "EndDirection",
- "EndFontMetrics",
- "EndKernData",
- "EndKernPairs",
- "EndTrackKern",
- "EscChar",
- "FamilyName",
- "FontBBox",
- "FontName",
- "FullName",
- "IsBaseFont",
- "IsCIDFont",
- "IsFixedPitch",
- "IsFixedV",
- "ItalicAngle",
- "KP",
- "KPH",
- "KPX",
- "KPY",
- "L",
- "MappingScheme",
- "MetricsSets",
- "N",
- "Notice",
- "PCC",
- "StartAxis",
- "StartCharMetrics",
- "StartComposites",
- "StartDirection",
- "StartFontMetrics",
- "StartKernData",
- "StartKernPairs",
- "StartKernPairs0",
- "StartKernPairs1",
- "StartTrackKern",
- "StdHW",
- "StdVW",
- "TrackKern",
- "UnderlinePosition",
- "UnderlineThickness",
- "VV",
- "VVector",
- "Version",
- "W",
- "W0",
- "W0X",
- "W0Y",
- "W1",
- "W1X",
- "W1Y",
- "WX",
- "WY",
- "Weight",
- "WeightVector",
- "XHeight"
- };
-
-
- /*
- * `afm_parser_read_vals' and `afm_parser_next_key' provide
- * high-level operations to an AFM_Stream. The rest of the
- * parser functions should use them without accessing the
- * AFM_Stream directly.
- */
-
- FT_LOCAL_DEF( FT_Int )
- afm_parser_read_vals( AFM_Parser parser,
- AFM_Value vals,
- FT_Int n )
- {
- AFM_Stream stream = parser->stream;
- char* str;
- FT_Int i;
-
-
- if ( n > AFM_MAX_ARGUMENTS )
- return 0;
-
- for ( i = 0; i < n; i++ )
- {
- FT_Offset len;
- AFM_Value val = vals + i;
-
-
- if ( val->type == AFM_VALUE_TYPE_STRING )
- str = afm_stream_read_string( stream );
- else
- str = afm_stream_read_one( stream );
-
- if ( !str )
- break;
-
- len = AFM_STREAM_KEY_LEN( stream, str );
-
- switch ( val->type )
- {
- case AFM_VALUE_TYPE_STRING:
- case AFM_VALUE_TYPE_NAME:
- {
- FT_Memory memory = parser->memory;
- FT_Error error;
-
-
- if ( !FT_QALLOC( val->u.s, len + 1 ) )
- {
- ft_memcpy( val->u.s, str, len );
- val->u.s[len] = '\0';
- }
- }
- break;
-
- case AFM_VALUE_TYPE_FIXED:
- val->u.f = PS_Conv_ToFixed( (FT_Byte**)(void*)&str,
- (FT_Byte*)str + len, 0 );
- break;
-
- case AFM_VALUE_TYPE_INTEGER:
- val->u.i = PS_Conv_ToInt( (FT_Byte**)(void*)&str,
- (FT_Byte*)str + len );
- break;
-
- case AFM_VALUE_TYPE_BOOL:
- val->u.b = FT_BOOL( len == 4 &&
- !ft_strncmp( str, "true", 4 ) );
- break;
-
- case AFM_VALUE_TYPE_INDEX:
- if ( parser->get_index )
- val->u.i = parser->get_index( str, len, parser->user_data );
- else
- val->u.i = 0;
- break;
- }
- }
-
- return i;
- }
-
-
- FT_LOCAL_DEF( char* )
- afm_parser_next_key( AFM_Parser parser,
- FT_Bool line,
- FT_Offset* len )
- {
- AFM_Stream stream = parser->stream;
- char* key = NULL; /* make stupid compiler happy */
-
-
- if ( line )
- {
- while ( 1 )
- {
- /* skip current line */
- if ( !AFM_STATUS_EOL( stream ) )
- afm_stream_read_string( stream );
-
- stream->status = AFM_STREAM_STATUS_NORMAL;
- key = afm_stream_read_one( stream );
-
- /* skip empty line */
- if ( !key &&
- !AFM_STATUS_EOF( stream ) &&
- AFM_STATUS_EOL( stream ) )
- continue;
-
- break;
- }
- }
- else
- {
- while ( 1 )
- {
- /* skip current column */
- while ( !AFM_STATUS_EOC( stream ) )
- afm_stream_read_one( stream );
-
- stream->status = AFM_STREAM_STATUS_NORMAL;
- key = afm_stream_read_one( stream );
-
- /* skip empty column */
- if ( !key &&
- !AFM_STATUS_EOF( stream ) &&
- AFM_STATUS_EOC( stream ) )
- continue;
-
- break;
- }
- }
-
- if ( len )
- *len = ( key ) ? (FT_Offset)AFM_STREAM_KEY_LEN( stream, key )
- : 0;
-
- return key;
- }
-
-
- static AFM_Token
- afm_tokenize( const char* key,
- FT_Offset len )
- {
- int n;
-
-
- for ( n = 0; n < N_AFM_TOKENS; n++ )
- {
- if ( *( afm_key_table[n] ) == *key )
- {
- for ( ; n < N_AFM_TOKENS; n++ )
- {
- if ( *( afm_key_table[n] ) != *key )
- return AFM_TOKEN_UNKNOWN;
-
- if ( ft_strncmp( afm_key_table[n], key, len ) == 0 )
- return (AFM_Token) n;
- }
- }
- }
-
- return AFM_TOKEN_UNKNOWN;
- }
-
-
- FT_LOCAL_DEF( FT_Error )
- afm_parser_init( AFM_Parser parser,
- FT_Memory memory,
- FT_Byte* base,
- FT_Byte* limit )
- {
- AFM_Stream stream = NULL;
- FT_Error error;
-
-
- if ( FT_NEW( stream ) )
- return error;
-
- stream->cursor = stream->base = base;
- stream->limit = limit;
-
- /* don't skip the first line during the first call */
- stream->status = AFM_STREAM_STATUS_EOL;
-
- parser->memory = memory;
- parser->stream = stream;
- parser->FontInfo = NULL;
- parser->get_index = NULL;
-
- return FT_Err_Ok;
- }
-
-
- FT_LOCAL( void )
- afm_parser_done( AFM_Parser parser )
- {
- FT_Memory memory = parser->memory;
-
-
- FT_FREE( parser->stream );
- }
-
-
- static FT_Error
- afm_parser_read_int( AFM_Parser parser,
- FT_Int* aint )
- {
- AFM_ValueRec val;
-
-
- val.type = AFM_VALUE_TYPE_INTEGER;
-
- if ( afm_parser_read_vals( parser, &val, 1 ) == 1 )
- {
- *aint = val.u.i;
-
- return FT_Err_Ok;
- }
- else
- return FT_THROW( Syntax_Error );
- }
-
-
- static FT_Error
- afm_parse_track_kern( AFM_Parser parser )
- {
- AFM_FontInfo fi = parser->FontInfo;
- AFM_TrackKern tk;
- char* key;
- FT_Offset len;
- int n = -1;
- FT_Int tmp;
-
-
- if ( afm_parser_read_int( parser, &tmp ) )
- goto Fail;
-
- if ( tmp < 0 )
- goto Fail;
-
- fi->NumTrackKern = (FT_UInt)tmp;
-
- if ( fi->NumTrackKern )
- {
- FT_Memory memory = parser->memory;
- FT_Error error;
-
-
- if ( FT_QNEW_ARRAY( fi->TrackKerns, fi->NumTrackKern ) )
- return error;
- }
-
- while ( ( key = afm_parser_next_key( parser, 1, &len ) ) != 0 )
- {
- AFM_ValueRec shared_vals[5];
-
-
- switch ( afm_tokenize( key, len ) )
- {
- case AFM_TOKEN_TRACKKERN:
- n++;
-
- if ( n >= (int)fi->NumTrackKern )
- goto Fail;
-
- tk = fi->TrackKerns + n;
-
- shared_vals[0].type = AFM_VALUE_TYPE_INTEGER;
- shared_vals[1].type = AFM_VALUE_TYPE_FIXED;
- shared_vals[2].type = AFM_VALUE_TYPE_FIXED;
- shared_vals[3].type = AFM_VALUE_TYPE_FIXED;
- shared_vals[4].type = AFM_VALUE_TYPE_FIXED;
- if ( afm_parser_read_vals( parser, shared_vals, 5 ) != 5 )
- goto Fail;
-
- tk->degree = shared_vals[0].u.i;
- tk->min_ptsize = shared_vals[1].u.f;
- tk->min_kern = shared_vals[2].u.f;
- tk->max_ptsize = shared_vals[3].u.f;
- tk->max_kern = shared_vals[4].u.f;
-
- break;
-
- case AFM_TOKEN_ENDTRACKKERN:
- case AFM_TOKEN_ENDKERNDATA:
- case AFM_TOKEN_ENDFONTMETRICS:
- fi->NumTrackKern = (FT_UInt)( n + 1 );
- return FT_Err_Ok;
-
- case AFM_TOKEN_UNKNOWN:
- break;
-
- default:
- goto Fail;
- }
- }
-
- Fail:
- return FT_THROW( Syntax_Error );
- }
-
-
-#undef KERN_INDEX
-#define KERN_INDEX( g1, g2 ) ( ( (FT_ULong)g1 << 16 ) | g2 )
-
-
- /* compare two kerning pairs */
- FT_CALLBACK_DEF( int )
- afm_compare_kern_pairs( const void* a,
- const void* b )
- {
- AFM_KernPair kp1 = (AFM_KernPair)a;
- AFM_KernPair kp2 = (AFM_KernPair)b;
-
- FT_ULong index1 = KERN_INDEX( kp1->index1, kp1->index2 );
- FT_ULong index2 = KERN_INDEX( kp2->index1, kp2->index2 );
-
-
- if ( index1 > index2 )
- return 1;
- else if ( index1 < index2 )
- return -1;
- else
- return 0;
- }
-
-
- static FT_Error
- afm_parse_kern_pairs( AFM_Parser parser )
- {
- AFM_FontInfo fi = parser->FontInfo;
- AFM_KernPair kp;
- char* key;
- FT_Offset len;
- int n = -1;
- FT_Int tmp;
-
-
- if ( afm_parser_read_int( parser, &tmp ) )
- goto Fail;
-
- if ( tmp < 0 )
- goto Fail;
-
- fi->NumKernPair = (FT_UInt)tmp;
-
- if ( fi->NumKernPair )
- {
- FT_Memory memory = parser->memory;
- FT_Error error;
-
-
- if ( FT_QNEW_ARRAY( fi->KernPairs, fi->NumKernPair ) )
- return error;
- }
-
- while ( ( key = afm_parser_next_key( parser, 1, &len ) ) != 0 )
- {
- AFM_Token token = afm_tokenize( key, len );
-
-
- switch ( token )
- {
- case AFM_TOKEN_KP:
- case AFM_TOKEN_KPX:
- case AFM_TOKEN_KPY:
- {
- FT_Int r;
- AFM_ValueRec shared_vals[4];
-
-
- n++;
-
- if ( n >= (int)fi->NumKernPair )
- goto Fail;
-
- kp = fi->KernPairs + n;
-
- shared_vals[0].type = AFM_VALUE_TYPE_INDEX;
- shared_vals[1].type = AFM_VALUE_TYPE_INDEX;
- shared_vals[2].type = AFM_VALUE_TYPE_INTEGER;
- shared_vals[3].type = AFM_VALUE_TYPE_INTEGER;
- r = afm_parser_read_vals( parser, shared_vals, 4 );
- if ( r < 3 )
- goto Fail;
-
- /* index values can't be negative */
- kp->index1 = shared_vals[0].u.u;
- kp->index2 = shared_vals[1].u.u;
- if ( token == AFM_TOKEN_KPY )
- {
- kp->x = 0;
- kp->y = shared_vals[2].u.i;
- }
- else
- {
- kp->x = shared_vals[2].u.i;
- kp->y = ( token == AFM_TOKEN_KP && r == 4 )
- ? shared_vals[3].u.i : 0;
- }
- }
- break;
-
- case AFM_TOKEN_ENDKERNPAIRS:
- case AFM_TOKEN_ENDKERNDATA:
- case AFM_TOKEN_ENDFONTMETRICS:
- fi->NumKernPair = (FT_UInt)( n + 1 );
- ft_qsort( fi->KernPairs, fi->NumKernPair,
- sizeof ( AFM_KernPairRec ),
- afm_compare_kern_pairs );
- return FT_Err_Ok;
-
- case AFM_TOKEN_UNKNOWN:
- break;
-
- default:
- goto Fail;
- }
- }
-
- Fail:
- return FT_THROW( Syntax_Error );
- }
-
-
- static FT_Error
- afm_parse_kern_data( AFM_Parser parser )
- {
- FT_Error error;
- char* key;
- FT_Offset len;
-
-
- while ( ( key = afm_parser_next_key( parser, 1, &len ) ) != 0 )
- {
- switch ( afm_tokenize( key, len ) )
- {
- case AFM_TOKEN_STARTTRACKKERN:
- error = afm_parse_track_kern( parser );
- if ( error )
- return error;
- break;
-
- case AFM_TOKEN_STARTKERNPAIRS:
- case AFM_TOKEN_STARTKERNPAIRS0:
- error = afm_parse_kern_pairs( parser );
- if ( error )
- return error;
- break;
-
- case AFM_TOKEN_ENDKERNDATA:
- case AFM_TOKEN_ENDFONTMETRICS:
- return FT_Err_Ok;
-
- case AFM_TOKEN_UNKNOWN:
- break;
-
- default:
- goto Fail;
- }
- }
-
- Fail:
- return FT_THROW( Syntax_Error );
- }
-
-
- static FT_Error
- afm_parser_skip_section( AFM_Parser parser,
- FT_Int n,
- AFM_Token end_section )
- {
- char* key;
- FT_Offset len;
-
-
- while ( n-- > 0 )
- {
- key = afm_parser_next_key( parser, 1, NULL );
- if ( !key )
- goto Fail;
- }
-
- while ( ( key = afm_parser_next_key( parser, 1, &len ) ) != 0 )
- {
- AFM_Token token = afm_tokenize( key, len );
-
-
- if ( token == end_section || token == AFM_TOKEN_ENDFONTMETRICS )
- return FT_Err_Ok;
- }
-
- Fail:
- return FT_THROW( Syntax_Error );
- }
-
-
- FT_LOCAL_DEF( FT_Error )
- afm_parser_parse( AFM_Parser parser )
- {
- FT_Memory memory = parser->memory;
- AFM_FontInfo fi = parser->FontInfo;
- FT_Error error = FT_ERR( Syntax_Error );
- char* key;
- FT_Offset len;
- FT_Int metrics_sets = 0;
-
-
- if ( !fi )
- return FT_THROW( Invalid_Argument );
-
- key = afm_parser_next_key( parser, 1, &len );
- if ( !key || len != 16 ||
- ft_strncmp( key, "StartFontMetrics", 16 ) != 0 )
- return FT_THROW( Unknown_File_Format );
-
- while ( ( key = afm_parser_next_key( parser, 1, &len ) ) != 0 )
- {
- AFM_ValueRec shared_vals[4];
-
-
- switch ( afm_tokenize( key, len ) )
- {
- case AFM_TOKEN_METRICSSETS:
- if ( afm_parser_read_int( parser, &metrics_sets ) )
- goto Fail;
-
- if ( metrics_sets != 0 && metrics_sets != 2 )
- {
- error = FT_THROW( Unimplemented_Feature );
-
- goto Fail;
- }
- break;
-
- case AFM_TOKEN_ISCIDFONT:
- shared_vals[0].type = AFM_VALUE_TYPE_BOOL;
- if ( afm_parser_read_vals( parser, shared_vals, 1 ) != 1 )
- goto Fail;
-
- fi->IsCIDFont = shared_vals[0].u.b;
- break;
-
- case AFM_TOKEN_FONTBBOX:
- shared_vals[0].type = AFM_VALUE_TYPE_FIXED;
- shared_vals[1].type = AFM_VALUE_TYPE_FIXED;
- shared_vals[2].type = AFM_VALUE_TYPE_FIXED;
- shared_vals[3].type = AFM_VALUE_TYPE_FIXED;
- if ( afm_parser_read_vals( parser, shared_vals, 4 ) != 4 )
- goto Fail;
-
- fi->FontBBox.xMin = shared_vals[0].u.f;
- fi->FontBBox.yMin = shared_vals[1].u.f;
- fi->FontBBox.xMax = shared_vals[2].u.f;
- fi->FontBBox.yMax = shared_vals[3].u.f;
- break;
-
- case AFM_TOKEN_ASCENDER:
- shared_vals[0].type = AFM_VALUE_TYPE_FIXED;
- if ( afm_parser_read_vals( parser, shared_vals, 1 ) != 1 )
- goto Fail;
-
- fi->Ascender = shared_vals[0].u.f;
- break;
-
- case AFM_TOKEN_DESCENDER:
- shared_vals[0].type = AFM_VALUE_TYPE_FIXED;
- if ( afm_parser_read_vals( parser, shared_vals, 1 ) != 1 )
- goto Fail;
-
- fi->Descender = shared_vals[0].u.f;
- break;
-
- case AFM_TOKEN_STARTCHARMETRICS:
- {
- FT_Int n = 0;
-
-
- if ( afm_parser_read_int( parser, &n ) )
- goto Fail;
-
- error = afm_parser_skip_section( parser, n,
- AFM_TOKEN_ENDCHARMETRICS );
- if ( error )
- return error;
- }
- break;
-
- case AFM_TOKEN_STARTKERNDATA:
- error = afm_parse_kern_data( parser );
- if ( error )
- goto Fail;
- /* fall through since we only support kern data */
-
- case AFM_TOKEN_ENDFONTMETRICS:
- return FT_Err_Ok;
-
- default:
- break;
- }
- }
-
- Fail:
- FT_FREE( fi->TrackKerns );
- fi->NumTrackKern = 0;
-
- FT_FREE( fi->KernPairs );
- fi->NumKernPair = 0;
-
- fi->IsCIDFont = 0;
-
- return error;
- }
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/psaux/afmparse.h b/chromium/third_party/pdfium/third_party/freetype/src/psaux/afmparse.h
deleted file mode 100644
index f922c4ebde6..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/psaux/afmparse.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/***************************************************************************/
-/* */
-/* afmparse.h */
-/* */
-/* AFM parser (specification). */
-/* */
-/* Copyright 2006-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __AFMPARSE_H__
-#define __AFMPARSE_H__
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
-
-
-FT_BEGIN_HEADER
-
-
- FT_LOCAL( FT_Error )
- afm_parser_init( AFM_Parser parser,
- FT_Memory memory,
- FT_Byte* base,
- FT_Byte* limit );
-
-
- FT_LOCAL( void )
- afm_parser_done( AFM_Parser parser );
-
-
- FT_LOCAL( FT_Error )
- afm_parser_parse( AFM_Parser parser );
-
-
- enum AFM_ValueType_
- {
- AFM_VALUE_TYPE_STRING,
- AFM_VALUE_TYPE_NAME,
- AFM_VALUE_TYPE_FIXED, /* real number */
- AFM_VALUE_TYPE_INTEGER,
- AFM_VALUE_TYPE_BOOL,
- AFM_VALUE_TYPE_INDEX /* glyph index */
- };
-
-
- typedef struct AFM_ValueRec_
- {
- enum AFM_ValueType_ type;
- union
- {
- char* s;
- FT_Fixed f;
- FT_Int i;
- FT_UInt u;
- FT_Bool b;
-
- } u;
-
- } AFM_ValueRec, *AFM_Value;
-
-#define AFM_MAX_ARGUMENTS 5
-
- FT_LOCAL( FT_Int )
- afm_parser_read_vals( AFM_Parser parser,
- AFM_Value vals,
- FT_Int n );
-
- /* read the next key from the next line or column */
- FT_LOCAL( char* )
- afm_parser_next_key( AFM_Parser parser,
- FT_Bool line,
- FT_Offset* len );
-
-FT_END_HEADER
-
-#endif /* __AFMPARSE_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/psaux/psaux.c b/chromium/third_party/pdfium/third_party/freetype/src/psaux/psaux.c
deleted file mode 100644
index 7f1d9aa5950..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/psaux/psaux.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/***************************************************************************/
-/* */
-/* psaux.c */
-/* */
-/* FreeType auxiliary PostScript driver component (body only). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#define FT_MAKE_OPTION_SINGLE_OBJECT
-
-#include <ft2build.h>
-#include "psobjs.c"
-#include "psauxmod.c"
-#include "t1decode.c"
-#include "t1cmap.c"
-
-#ifndef T1_CONFIG_OPTION_NO_AFM
-#include "afmparse.c"
-#endif
-
-#include "psconv.c"
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/psaux/psauxerr.h b/chromium/third_party/pdfium/third_party/freetype/src/psaux/psauxerr.h
deleted file mode 100644
index 97712f0795b..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/psaux/psauxerr.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/***************************************************************************/
-/* */
-/* psauxerr.h */
-/* */
-/* PS auxiliary module error codes (specification only). */
-/* */
-/* Copyright 2001-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* This file is used to define the PS auxiliary module error enumeration */
- /* constants. */
- /* */
- /*************************************************************************/
-
-#ifndef __PSAUXERR_H__
-#define __PSAUXERR_H__
-
-#include FT_MODULE_ERRORS_H
-
-#undef __FTERRORS_H__
-
-#undef FT_ERR_PREFIX
-#define FT_ERR_PREFIX PSaux_Err_
-#define FT_ERR_BASE FT_Mod_Err_PSaux
-
-#include FT_ERRORS_H
-
-#endif /* __PSAUXERR_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/psaux/psauxmod.c b/chromium/third_party/pdfium/third_party/freetype/src/psaux/psauxmod.c
deleted file mode 100644
index 06fcab0c4ac..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/psaux/psauxmod.c
+++ /dev/null
@@ -1,139 +0,0 @@
-/***************************************************************************/
-/* */
-/* psauxmod.c */
-/* */
-/* FreeType auxiliary PostScript module implementation (body). */
-/* */
-/* Copyright 2000-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include "psauxmod.h"
-#include "psobjs.h"
-#include "t1decode.h"
-#include "t1cmap.h"
-
-#ifndef T1_CONFIG_OPTION_NO_AFM
-#include "afmparse.h"
-#endif
-
-
- FT_CALLBACK_TABLE_DEF
- const PS_Table_FuncsRec ps_table_funcs =
- {
- ps_table_new,
- ps_table_done,
- ps_table_add,
- ps_table_release
- };
-
-
- FT_CALLBACK_TABLE_DEF
- const PS_Parser_FuncsRec ps_parser_funcs =
- {
- ps_parser_init,
- ps_parser_done,
- ps_parser_skip_spaces,
- ps_parser_skip_PS_token,
- ps_parser_to_int,
- ps_parser_to_fixed,
- ps_parser_to_bytes,
- ps_parser_to_coord_array,
- ps_parser_to_fixed_array,
- ps_parser_to_token,
- ps_parser_to_token_array,
- ps_parser_load_field,
- ps_parser_load_field_table
- };
-
-
- FT_CALLBACK_TABLE_DEF
- const T1_Builder_FuncsRec t1_builder_funcs =
- {
- t1_builder_init,
- t1_builder_done,
- t1_builder_check_points,
- t1_builder_add_point,
- t1_builder_add_point1,
- t1_builder_add_contour,
- t1_builder_start_point,
- t1_builder_close_contour
- };
-
-
- FT_CALLBACK_TABLE_DEF
- const T1_Decoder_FuncsRec t1_decoder_funcs =
- {
- t1_decoder_init,
- t1_decoder_done,
- t1_decoder_parse_charstrings
- };
-
-
-#ifndef T1_CONFIG_OPTION_NO_AFM
- FT_CALLBACK_TABLE_DEF
- const AFM_Parser_FuncsRec afm_parser_funcs =
- {
- afm_parser_init,
- afm_parser_done,
- afm_parser_parse
- };
-#endif
-
-
- FT_CALLBACK_TABLE_DEF
- const T1_CMap_ClassesRec t1_cmap_classes =
- {
- &t1_cmap_standard_class_rec,
- &t1_cmap_expert_class_rec,
- &t1_cmap_custom_class_rec,
- &t1_cmap_unicode_class_rec
- };
-
-
- static
- const PSAux_Interface psaux_interface =
- {
- &ps_table_funcs,
- &ps_parser_funcs,
- &t1_builder_funcs,
- &t1_decoder_funcs,
- t1_decrypt,
-
- (const T1_CMap_ClassesRec*) &t1_cmap_classes,
-
-#ifndef T1_CONFIG_OPTION_NO_AFM
- &afm_parser_funcs,
-#else
- 0,
-#endif
- };
-
-
- FT_CALLBACK_TABLE_DEF
- const FT_Module_Class psaux_module_class =
- {
- 0,
- sizeof ( FT_ModuleRec ),
- "psaux",
- 0x20000L,
- 0x20000L,
-
- &psaux_interface, /* module-specific interface */
-
- (FT_Module_Constructor)0,
- (FT_Module_Destructor) 0,
- (FT_Module_Requester) 0
- };
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/psaux/psauxmod.h b/chromium/third_party/pdfium/third_party/freetype/src/psaux/psauxmod.h
deleted file mode 100644
index ae6a8f9383a..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/psaux/psauxmod.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/***************************************************************************/
-/* */
-/* psauxmod.h */
-/* */
-/* FreeType auxiliary PostScript module implementation (specification). */
-/* */
-/* Copyright 2000-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __PSAUXMOD_H__
-#define __PSAUXMOD_H__
-
-
-#include <ft2build.h>
-#include FT_MODULE_H
-
-
-FT_BEGIN_HEADER
-
-#ifdef FT_CONFIG_OPTION_PIC
-#error "this module does not support PIC yet"
-#endif
-
-
- FT_EXPORT_VAR( const FT_Module_Class ) psaux_driver_class;
-
-
-FT_END_HEADER
-
-#endif /* __PSAUXMOD_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/psaux/psconv.c b/chromium/third_party/pdfium/third_party/freetype/src/psaux/psconv.c
deleted file mode 100644
index aca741204fb..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/psaux/psconv.c
+++ /dev/null
@@ -1,603 +0,0 @@
-/***************************************************************************/
-/* */
-/* psconv.c */
-/* */
-/* Some convenience conversions (body). */
-/* */
-/* Copyright 2006-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
-#include FT_INTERNAL_DEBUG_H
-
-#include "psconv.h"
-#include "psauxerr.h"
-
-
- /*************************************************************************/
- /* */
- /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
- /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
- /* messages during execution. */
- /* */
-#undef FT_COMPONENT
-#define FT_COMPONENT trace_psconv
-
-
- /* The following array is used by various functions to quickly convert */
- /* digits (both decimal and non-decimal) into numbers. */
-
-#if 'A' == 65
- /* ASCII */
-
- static const FT_Char ft_char_table[128] =
- {
- /* 0x00 */
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, -1, -1,
- -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
- 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, -1, -1, -1, -1,
- -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
- 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, -1, -1, -1, -1,
- };
-
- /* no character >= 0x80 can represent a valid number */
-#define OP >=
-
-#endif /* 'A' == 65 */
-
-#if 'A' == 193
- /* EBCDIC */
-
- static const FT_Char ft_char_table[128] =
- {
- /* 0x80 */
- -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, -1, -1, -1, -1, -1, -1,
- -1, 19, 20, 21, 22, 23, 24, 25, 26, 27, -1, -1, -1, -1, -1, -1,
- -1, -1, 28, 29, 30, 31, 32, 33, 34, 35, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, -1, -1, -1, -1, -1, -1,
- -1, 19, 20, 21, 22, 23, 24, 25, 26, 27, -1, -1, -1, -1, -1, -1,
- -1, -1, 28, 29, 30, 31, 32, 33, 34, 35, -1, -1, -1, -1, -1, -1,
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, -1, -1,
- };
-
- /* no character < 0x80 can represent a valid number */
-#define OP <
-
-#endif /* 'A' == 193 */
-
-
- FT_LOCAL_DEF( FT_Long )
- PS_Conv_Strtol( FT_Byte** cursor,
- FT_Byte* limit,
- FT_Long base )
- {
- FT_Byte* p = *cursor;
-
- FT_Long num = 0;
- FT_Bool sign = 0;
- FT_Bool have_overflow = 0;
-
- FT_Long num_limit;
- FT_Char c_limit;
-
-
- if ( p >= limit )
- goto Bad;
-
- if ( base < 2 || base > 36 )
- {
- FT_TRACE4(( "!!!INVALID BASE:!!!" ));
- return 0;
- }
-
- if ( *p == '-' || *p == '+' )
- {
- sign = FT_BOOL( *p == '-' );
-
- p++;
- if ( p == limit )
- goto Bad;
- }
-
- num_limit = 0x7FFFFFFFL / base;
- c_limit = (FT_Char)( 0x7FFFFFFFL % base );
-
- for ( ; p < limit; p++ )
- {
- FT_Char c;
-
-
- if ( IS_PS_SPACE( *p ) || *p OP 0x80 )
- break;
-
- c = ft_char_table[*p & 0x7F];
-
- if ( c < 0 || c >= base )
- break;
-
- if ( num > num_limit || ( num == num_limit && c > c_limit ) )
- have_overflow = 1;
- else
- num = num * base + c;
- }
-
- *cursor = p;
-
- if ( have_overflow )
- {
- num = 0x7FFFFFFFL;
- FT_TRACE4(( "!!!OVERFLOW:!!!" ));
- }
-
- if ( sign )
- num = -num;
-
- return num;
-
- Bad:
- FT_TRACE4(( "!!!END OF DATA:!!!" ));
- return 0;
- }
-
-
- FT_LOCAL_DEF( FT_Long )
- PS_Conv_ToInt( FT_Byte** cursor,
- FT_Byte* limit )
-
- {
- FT_Byte* p = *cursor;
- FT_Byte* curp;
-
- FT_Long num;
-
-
- curp = p;
- num = PS_Conv_Strtol( &p, limit, 10 );
-
- if ( p == curp )
- return 0;
-
- if ( p < limit && *p == '#' )
- {
- p++;
-
- curp = p;
- num = PS_Conv_Strtol( &p, limit, num );
-
- if ( p == curp )
- return 0;
- }
-
- *cursor = p;
-
- return num;
- }
-
-
- FT_LOCAL_DEF( FT_Fixed )
- PS_Conv_ToFixed( FT_Byte** cursor,
- FT_Byte* limit,
- FT_Long power_ten )
- {
- FT_Byte* p = *cursor;
- FT_Byte* curp;
-
- FT_Fixed integral = 0;
- FT_Long decimal = 0;
- FT_Long divider = 1;
-
- FT_Bool sign = 0;
- FT_Bool have_overflow = 0;
- FT_Bool have_underflow = 0;
-
-
- if ( p >= limit )
- goto Bad;
-
- if ( *p == '-' || *p == '+' )
- {
- sign = FT_BOOL( *p == '-' );
-
- p++;
- if ( p == limit )
- goto Bad;
- }
-
- /* read the integer part */
- if ( *p != '.' )
- {
- curp = p;
- integral = PS_Conv_ToInt( &p, limit );
-
- if ( p == curp )
- return 0;
-
- if ( integral > 0x7FFF )
- have_overflow = 1;
- else
- integral = (FT_Fixed)( (FT_UInt32)integral << 16 );
- }
-
- /* read the decimal part */
- if ( p < limit && *p == '.' )
- {
- p++;
-
- for ( ; p < limit; p++ )
- {
- FT_Char c;
-
-
- if ( IS_PS_SPACE( *p ) || *p OP 0x80 )
- break;
-
- c = ft_char_table[*p & 0x7F];
-
- if ( c < 0 || c >= 10 )
- break;
-
- /* only add digit if we don't overflow */
- if ( divider < 0xCCCCCCCL && decimal < 0xCCCCCCCL )
- {
- decimal = decimal * 10 + c;
-
- if ( !integral && power_ten > 0 )
- power_ten--;
- else
- divider *= 10;
- }
- }
- }
-
- /* read exponent, if any */
- if ( p + 1 < limit && ( *p == 'e' || *p == 'E' ) )
- {
- FT_Long exponent;
-
-
- p++;
-
- curp = p;
- exponent = PS_Conv_ToInt( &p, limit );
-
- if ( curp == p )
- return 0;
-
- /* arbitrarily limit exponent */
- if ( exponent > 1000 )
- have_overflow = 1;
- else if ( exponent < -1000 )
- have_underflow = 1;
- else
- power_ten += exponent;
- }
-
- *cursor = p;
-
- if ( !integral && !decimal )
- return 0;
-
- if ( have_overflow )
- goto Overflow;
- if ( have_underflow )
- goto Underflow;
-
- while ( power_ten > 0 )
- {
- if ( integral >= 0xCCCCCCCL )
- goto Overflow;
- integral *= 10;
-
- if ( decimal >= 0xCCCCCCCL )
- {
- if ( divider == 1 )
- goto Overflow;
- divider /= 10;
- }
- else
- decimal *= 10;
-
- power_ten--;
- }
-
- while ( power_ten < 0 )
- {
- integral /= 10;
- if ( divider < 0xCCCCCCCL )
- divider *= 10;
- else
- decimal /= 10;
-
- if ( !integral && !decimal )
- goto Underflow;
-
- power_ten++;
- }
-
- if ( decimal )
- {
- decimal = FT_DivFix( decimal, divider );
- /* it's not necessary to check this addition for overflow */
- /* due to the structure of the real number representation */
- integral += decimal;
- }
-
- Exit:
- if ( sign )
- integral = -integral;
-
- return integral;
-
- Bad:
- FT_TRACE4(( "!!!END OF DATA:!!!" ));
- return 0;
-
- Overflow:
- integral = 0x7FFFFFFFL;
- FT_TRACE4(( "!!!OVERFLOW:!!!" ));
- goto Exit;
-
- Underflow:
- FT_TRACE4(( "!!!UNDERFLOW:!!!" ));
- return 0;
- }
-
-
-#if 0
- FT_LOCAL_DEF( FT_UInt )
- PS_Conv_StringDecode( FT_Byte** cursor,
- FT_Byte* limit,
- FT_Byte* buffer,
- FT_Offset n )
- {
- FT_Byte* p;
- FT_UInt r = 0;
-
-
- for ( p = *cursor; r < n && p < limit; p++ )
- {
- FT_Byte b;
-
-
- if ( *p != '\\' )
- {
- buffer[r++] = *p;
-
- continue;
- }
-
- p++;
-
- switch ( *p )
- {
- case 'n':
- b = '\n';
- break;
- case 'r':
- b = '\r';
- break;
- case 't':
- b = '\t';
- break;
- case 'b':
- b = '\b';
- break;
- case 'f':
- b = '\f';
- break;
- case '\r':
- p++;
- if ( *p != '\n' )
- {
- b = *p;
-
- break;
- }
- /* no break */
- case '\n':
- continue;
- break;
- default:
- if ( IS_PS_DIGIT( *p ) )
- {
- b = *p - '0';
-
- p++;
-
- if ( IS_PS_DIGIT( *p ) )
- {
- b = b * 8 + *p - '0';
-
- p++;
-
- if ( IS_PS_DIGIT( *p ) )
- b = b * 8 + *p - '0';
- else
- {
- buffer[r++] = b;
- b = *p;
- }
- }
- else
- {
- buffer[r++] = b;
- b = *p;
- }
- }
- else
- b = *p;
- break;
- }
-
- buffer[r++] = b;
- }
-
- *cursor = p;
-
- return r;
- }
-#endif /* 0 */
-
-
- FT_LOCAL_DEF( FT_UInt )
- PS_Conv_ASCIIHexDecode( FT_Byte** cursor,
- FT_Byte* limit,
- FT_Byte* buffer,
- FT_Offset n )
- {
- FT_Byte* p;
- FT_UInt r = 0;
- FT_UInt w = 0;
- FT_UInt pad = 0x01;
-
-
- n *= 2;
-
-#if 1
-
- p = *cursor;
-
- if ( p >= limit )
- return 0;
-
- if ( n > (FT_UInt)( limit - p ) )
- n = (FT_UInt)( limit - p );
-
- /* we try to process two nibbles at a time to be as fast as possible */
- for ( ; r < n; r++ )
- {
- FT_UInt c = p[r];
-
-
- if ( IS_PS_SPACE( c ) )
- continue;
-
- if ( c OP 0x80 )
- break;
-
- c = (FT_UInt)ft_char_table[c & 0x7F];
- if ( c >= 16 )
- break;
-
- pad = ( pad << 4 ) | c;
- if ( pad & 0x100 )
- {
- buffer[w++] = (FT_Byte)pad;
- pad = 0x01;
- }
- }
-
- if ( pad != 0x01 )
- buffer[w++] = (FT_Byte)( pad << 4 );
-
- *cursor = p + r;
-
- return w;
-
-#else /* 0 */
-
- for ( r = 0; r < n; r++ )
- {
- FT_Char c;
-
-
- if ( IS_PS_SPACE( *p ) )
- continue;
-
- if ( *p OP 0x80 )
- break;
-
- c = ft_char_table[*p & 0x7F];
-
- if ( (unsigned)c >= 16 )
- break;
-
- if ( r & 1 )
- {
- *buffer = (FT_Byte)(*buffer + c);
- buffer++;
- }
- else
- *buffer = (FT_Byte)(c << 4);
-
- r++;
- }
-
- *cursor = p;
-
- return ( r + 1 ) / 2;
-
-#endif /* 0 */
-
- }
-
-
- FT_LOCAL_DEF( FT_UInt )
- PS_Conv_EexecDecode( FT_Byte** cursor,
- FT_Byte* limit,
- FT_Byte* buffer,
- FT_Offset n,
- FT_UShort* seed )
- {
- FT_Byte* p;
- FT_UInt r;
- FT_UInt s = *seed;
-
-
-#if 1
-
- p = *cursor;
-
- if ( p >= limit )
- return 0;
-
- if ( n > (FT_UInt)(limit - p) )
- n = (FT_UInt)(limit - p);
-
- for ( r = 0; r < n; r++ )
- {
- FT_UInt val = p[r];
- FT_UInt b = ( val ^ ( s >> 8 ) );
-
-
- s = ( (val + s)*52845U + 22719 ) & 0xFFFFU;
- buffer[r] = (FT_Byte) b;
- }
-
- *cursor = p + n;
- *seed = (FT_UShort)s;
-
-#else /* 0 */
-
- for ( r = 0, p = *cursor; r < n && p < limit; r++, p++ )
- {
- FT_Byte b = (FT_Byte)( *p ^ ( s >> 8 ) );
-
-
- s = (FT_UShort)( ( *p + s ) * 52845U + 22719 );
- *buffer++ = b;
- }
- *cursor = p;
- *seed = s;
-
-#endif /* 0 */
-
- return r;
- }
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/psaux/psconv.h b/chromium/third_party/pdfium/third_party/freetype/src/psaux/psconv.h
deleted file mode 100644
index 10f1ff7fb1a..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/psaux/psconv.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/***************************************************************************/
-/* */
-/* psconv.h */
-/* */
-/* Some convenience conversions (specification). */
-/* */
-/* Copyright 2006-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __PSCONV_H__
-#define __PSCONV_H__
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
-
-FT_BEGIN_HEADER
-
-
- FT_LOCAL( FT_Long )
- PS_Conv_Strtol( FT_Byte** cursor,
- FT_Byte* limit,
- FT_Long base );
-
-
- FT_LOCAL( FT_Long )
- PS_Conv_ToInt( FT_Byte** cursor,
- FT_Byte* limit );
-
- FT_LOCAL( FT_Fixed )
- PS_Conv_ToFixed( FT_Byte** cursor,
- FT_Byte* limit,
- FT_Long power_ten );
-
-#if 0
- FT_LOCAL( FT_UInt )
- PS_Conv_StringDecode( FT_Byte** cursor,
- FT_Byte* limit,
- FT_Byte* buffer,
- FT_Offset n );
-#endif
-
- FT_LOCAL( FT_UInt )
- PS_Conv_ASCIIHexDecode( FT_Byte** cursor,
- FT_Byte* limit,
- FT_Byte* buffer,
- FT_Offset n );
-
- FT_LOCAL( FT_UInt )
- PS_Conv_EexecDecode( FT_Byte** cursor,
- FT_Byte* limit,
- FT_Byte* buffer,
- FT_Offset n,
- FT_UShort* seed );
-
-
-FT_END_HEADER
-
-#endif /* __PSCONV_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/psaux/psobjs.c b/chromium/third_party/pdfium/third_party/freetype/src/psaux/psobjs.c
deleted file mode 100644
index 1d3c7e662ce..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/psaux/psobjs.c
+++ /dev/null
@@ -1,1774 +0,0 @@
-/***************************************************************************/
-/* */
-/* psobjs.c */
-/* */
-/* Auxiliary functions for PostScript fonts (body). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_CALC_H
-
-#include "psobjs.h"
-#include "psconv.h"
-
-#include "psauxerr.h"
-
-
- /*************************************************************************/
- /* */
- /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
- /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
- /* messages during execution. */
- /* */
-#undef FT_COMPONENT
-#define FT_COMPONENT trace_psobjs
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** PS_TABLE *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* ps_table_new */
- /* */
- /* <Description> */
- /* Initializes a PS_Table. */
- /* */
- /* <InOut> */
- /* table :: The address of the target table. */
- /* */
- /* <Input> */
- /* count :: The table size = the maximum number of elements. */
- /* */
- /* memory :: The memory object to use for all subsequent */
- /* reallocations. */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. */
- /* */
- FT_LOCAL_DEF( FT_Error )
- ps_table_new( PS_Table table,
- FT_Int count,
- FT_Memory memory )
- {
- FT_Error error;
-
-
- table->memory = memory;
- if ( FT_NEW_ARRAY( table->elements, count ) ||
- FT_NEW_ARRAY( table->lengths, count ) )
- goto Exit;
-
- table->max_elems = count;
- table->init = 0xDEADBEEFUL;
- table->num_elems = 0;
- table->block = NULL;
- table->capacity = 0;
- table->cursor = 0;
-
- *(PS_Table_FuncsRec*)&table->funcs = ps_table_funcs;
-
- Exit:
- if ( error )
- FT_FREE( table->elements );
-
- return error;
- }
-
-
- static void
- shift_elements( PS_Table table,
- FT_Byte* old_base )
- {
- FT_PtrDist delta = table->block - old_base;
- FT_Byte** offset = table->elements;
- FT_Byte** limit = offset + table->max_elems;
-
-
- for ( ; offset < limit; offset++ )
- {
- if ( offset[0] )
- offset[0] += delta;
- }
- }
-
-
- static FT_Error
- reallocate_t1_table( PS_Table table,
- FT_Offset new_size )
- {
- FT_Memory memory = table->memory;
- FT_Byte* old_base = table->block;
- FT_Error error;
-
-
- /* allocate new base block */
- if ( FT_ALLOC( table->block, new_size ) )
- {
- table->block = old_base;
- return error;
- }
-
- /* copy elements and shift offsets */
- if ( old_base )
- {
- FT_MEM_COPY( table->block, old_base, table->capacity );
- shift_elements( table, old_base );
- FT_FREE( old_base );
- }
-
- table->capacity = new_size;
-
- return FT_Err_Ok;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* ps_table_add */
- /* */
- /* <Description> */
- /* Adds an object to a PS_Table, possibly growing its memory block. */
- /* */
- /* <InOut> */
- /* table :: The target table. */
- /* */
- /* <Input> */
- /* idx :: The index of the object in the table. */
- /* */
- /* object :: The address of the object to copy in memory. */
- /* */
- /* length :: The length in bytes of the source object. */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. An error is returned if a */
- /* reallocation fails. */
- /* */
- FT_LOCAL_DEF( FT_Error )
- ps_table_add( PS_Table table,
- FT_Int idx,
- void* object,
- FT_UInt length )
- {
- if ( idx < 0 || idx >= table->max_elems )
- {
- FT_ERROR(( "ps_table_add: invalid index\n" ));
- return FT_THROW( Invalid_Argument );
- }
-
- /* grow the base block if needed */
- if ( table->cursor + length > table->capacity )
- {
- FT_Error error;
- FT_Offset new_size = table->capacity;
- FT_PtrDist in_offset;
-
-
- in_offset = (FT_Byte*)object - table->block;
- if ( in_offset < 0 || (FT_Offset)in_offset >= table->capacity )
- in_offset = -1;
-
- while ( new_size < table->cursor + length )
- {
- /* increase size by 25% and round up to the nearest multiple
- of 1024 */
- new_size += ( new_size >> 2 ) + 1;
- new_size = FT_PAD_CEIL( new_size, 1024 );
- }
-
- error = reallocate_t1_table( table, new_size );
- if ( error )
- return error;
-
- if ( in_offset >= 0 )
- object = table->block + in_offset;
- }
-
- /* add the object to the base block and adjust offset */
- table->elements[idx] = table->block + table->cursor;
- table->lengths [idx] = length;
- FT_MEM_COPY( table->block + table->cursor, object, length );
-
- table->cursor += length;
- return FT_Err_Ok;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* ps_table_done */
- /* */
- /* <Description> */
- /* Finalizes a PS_TableRec (i.e., reallocate it to its current */
- /* cursor). */
- /* */
- /* <InOut> */
- /* table :: The target table. */
- /* */
- /* <Note> */
- /* This function does NOT release the heap's memory block. It is up */
- /* to the caller to clean it, or reference it in its own structures. */
- /* */
- FT_LOCAL_DEF( void )
- ps_table_done( PS_Table table )
- {
- FT_Memory memory = table->memory;
- FT_Error error;
- FT_Byte* old_base = table->block;
-
-
- /* should never fail, because rec.cursor <= rec.size */
- if ( !old_base )
- return;
-
- if ( FT_ALLOC( table->block, table->cursor ) )
- return;
- FT_MEM_COPY( table->block, old_base, table->cursor );
- shift_elements( table, old_base );
-
- table->capacity = table->cursor;
- FT_FREE( old_base );
-
- FT_UNUSED( error );
- }
-
-
- FT_LOCAL_DEF( void )
- ps_table_release( PS_Table table )
- {
- FT_Memory memory = table->memory;
-
-
- if ( (FT_ULong)table->init == 0xDEADBEEFUL )
- {
- FT_FREE( table->block );
- FT_FREE( table->elements );
- FT_FREE( table->lengths );
- table->init = 0;
- }
- }
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** T1 PARSER *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
-
- /* first character must be already part of the comment */
-
- static void
- skip_comment( FT_Byte* *acur,
- FT_Byte* limit )
- {
- FT_Byte* cur = *acur;
-
-
- while ( cur < limit )
- {
- if ( IS_PS_NEWLINE( *cur ) )
- break;
- cur++;
- }
-
- *acur = cur;
- }
-
-
- static void
- skip_spaces( FT_Byte* *acur,
- FT_Byte* limit )
- {
- FT_Byte* cur = *acur;
-
-
- while ( cur < limit )
- {
- if ( !IS_PS_SPACE( *cur ) )
- {
- if ( *cur == '%' )
- /* According to the PLRM, a comment is equal to a space. */
- skip_comment( &cur, limit );
- else
- break;
- }
- cur++;
- }
-
- *acur = cur;
- }
-
-
-#define IS_OCTAL_DIGIT( c ) ( '0' <= (c) && (c) <= '7' )
-
-
- /* first character must be `('; */
- /* *acur is positioned at the character after the closing `)' */
-
- static FT_Error
- skip_literal_string( FT_Byte* *acur,
- FT_Byte* limit )
- {
- FT_Byte* cur = *acur;
- FT_Int embed = 0;
- FT_Error error = FT_ERR( Invalid_File_Format );
- unsigned int i;
-
-
- while ( cur < limit )
- {
- FT_Byte c = *cur;
-
-
- ++cur;
-
- if ( c == '\\' )
- {
- /* Red Book 3rd ed., section `Literal Text Strings', p. 29: */
- /* A backslash can introduce three different types */
- /* of escape sequences: */
- /* - a special escaped char like \r, \n, etc. */
- /* - a one-, two-, or three-digit octal number */
- /* - none of the above in which case the backslash is ignored */
-
- if ( cur == limit )
- /* error (or to be ignored?) */
- break;
-
- switch ( *cur )
- {
- /* skip `special' escape */
- case 'n':
- case 'r':
- case 't':
- case 'b':
- case 'f':
- case '\\':
- case '(':
- case ')':
- ++cur;
- break;
-
- default:
- /* skip octal escape or ignore backslash */
- for ( i = 0; i < 3 && cur < limit; ++i )
- {
- if ( !IS_OCTAL_DIGIT( *cur ) )
- break;
-
- ++cur;
- }
- }
- }
- else if ( c == '(' )
- embed++;
- else if ( c == ')' )
- {
- embed--;
- if ( embed == 0 )
- {
- error = FT_Err_Ok;
- break;
- }
- }
- }
-
- *acur = cur;
-
- return error;
- }
-
-
- /* first character must be `<' */
-
- static FT_Error
- skip_string( FT_Byte* *acur,
- FT_Byte* limit )
- {
- FT_Byte* cur = *acur;
- FT_Error err = FT_Err_Ok;
-
-
- while ( ++cur < limit )
- {
- /* All whitespace characters are ignored. */
- skip_spaces( &cur, limit );
- if ( cur >= limit )
- break;
-
- if ( !IS_PS_XDIGIT( *cur ) )
- break;
- }
-
- if ( cur < limit && *cur != '>' )
- {
- FT_ERROR(( "skip_string: missing closing delimiter `>'\n" ));
- err = FT_THROW( Invalid_File_Format );
- }
- else
- cur++;
-
- *acur = cur;
- return err;
- }
-
-
- /* first character must be the opening brace that */
- /* starts the procedure */
-
- /* NB: [ and ] need not match: */
- /* `/foo {[} def' is a valid PostScript fragment, */
- /* even within a Type1 font */
-
- static FT_Error
- skip_procedure( FT_Byte* *acur,
- FT_Byte* limit )
- {
- FT_Byte* cur;
- FT_Int embed = 0;
- FT_Error error = FT_Err_Ok;
-
-
- FT_ASSERT( **acur == '{' );
-
- for ( cur = *acur; cur < limit && error == FT_Err_Ok; ++cur )
- {
- switch ( *cur )
- {
- case '{':
- ++embed;
- break;
-
- case '}':
- --embed;
- if ( embed == 0 )
- {
- ++cur;
- goto end;
- }
- break;
-
- case '(':
- error = skip_literal_string( &cur, limit );
- break;
-
- case '<':
- error = skip_string( &cur, limit );
- break;
-
- case '%':
- skip_comment( &cur, limit );
- break;
- }
- }
-
- end:
- if ( embed != 0 )
- error = FT_THROW( Invalid_File_Format );
-
- *acur = cur;
-
- return error;
- }
-
-
- /***********************************************************************/
- /* */
- /* All exported parsing routines handle leading whitespace and stop at */
- /* the first character which isn't part of the just handled token. */
- /* */
- /***********************************************************************/
-
-
- FT_LOCAL_DEF( void )
- ps_parser_skip_PS_token( PS_Parser parser )
- {
- /* Note: PostScript allows any non-delimiting, non-whitespace */
- /* character in a name (PS Ref Manual, 3rd ed, p31). */
- /* PostScript delimiters are (, ), <, >, [, ], {, }, /, and %. */
-
- FT_Byte* cur = parser->cursor;
- FT_Byte* limit = parser->limit;
- FT_Error error = FT_Err_Ok;
-
-
- skip_spaces( &cur, limit ); /* this also skips comments */
- if ( cur >= limit )
- goto Exit;
-
- /* self-delimiting, single-character tokens */
- if ( *cur == '[' || *cur == ']' )
- {
- cur++;
- goto Exit;
- }
-
- /* skip balanced expressions (procedures and strings) */
-
- if ( *cur == '{' ) /* {...} */
- {
- error = skip_procedure( &cur, limit );
- goto Exit;
- }
-
- if ( *cur == '(' ) /* (...) */
- {
- error = skip_literal_string( &cur, limit );
- goto Exit;
- }
-
- if ( *cur == '<' ) /* <...> */
- {
- if ( cur + 1 < limit && *(cur + 1) == '<' ) /* << */
- {
- cur++;
- cur++;
- }
- else
- error = skip_string( &cur, limit );
-
- goto Exit;
- }
-
- if ( *cur == '>' )
- {
- cur++;
- if ( cur >= limit || *cur != '>' ) /* >> */
- {
- FT_ERROR(( "ps_parser_skip_PS_token:"
- " unexpected closing delimiter `>'\n" ));
- error = FT_THROW( Invalid_File_Format );
- goto Exit;
- }
- cur++;
- goto Exit;
- }
-
- if ( *cur == '/' )
- cur++;
-
- /* anything else */
- while ( cur < limit )
- {
- /* *cur might be invalid (e.g., ')' or '}'), but this */
- /* is handled by the test `cur == parser->cursor' below */
- if ( IS_PS_DELIM( *cur ) )
- break;
-
- cur++;
- }
-
- Exit:
- if ( cur < limit && cur == parser->cursor )
- {
- FT_ERROR(( "ps_parser_skip_PS_token:"
- " current token is `%c' which is self-delimiting\n"
- " "
- " but invalid at this point\n",
- *cur ));
-
- error = FT_THROW( Invalid_File_Format );
- }
-
- if ( cur > limit )
- cur = limit;
-
- parser->error = error;
- parser->cursor = cur;
- }
-
-
- FT_LOCAL_DEF( void )
- ps_parser_skip_spaces( PS_Parser parser )
- {
- skip_spaces( &parser->cursor, parser->limit );
- }
-
-
- /* `token' here means either something between balanced delimiters */
- /* or the next token; the delimiters are not removed. */
-
- FT_LOCAL_DEF( void )
- ps_parser_to_token( PS_Parser parser,
- T1_Token token )
- {
- FT_Byte* cur;
- FT_Byte* limit;
- FT_Int embed;
-
-
- token->type = T1_TOKEN_TYPE_NONE;
- token->start = NULL;
- token->limit = NULL;
-
- /* first of all, skip leading whitespace */
- ps_parser_skip_spaces( parser );
-
- cur = parser->cursor;
- limit = parser->limit;
-
- if ( cur >= limit )
- return;
-
- switch ( *cur )
- {
- /************* check for literal string *****************/
- case '(':
- token->type = T1_TOKEN_TYPE_STRING;
- token->start = cur;
-
- if ( skip_literal_string( &cur, limit ) == FT_Err_Ok )
- token->limit = cur;
- break;
-
- /************* check for programs/array *****************/
- case '{':
- token->type = T1_TOKEN_TYPE_ARRAY;
- token->start = cur;
-
- if ( skip_procedure( &cur, limit ) == FT_Err_Ok )
- token->limit = cur;
- break;
-
- /************* check for table/array ********************/
- /* XXX: in theory we should also look for "<<" */
- /* since this is semantically equivalent to "["; */
- /* in practice it doesn't matter (?) */
- case '[':
- token->type = T1_TOKEN_TYPE_ARRAY;
- embed = 1;
- token->start = cur++;
-
- /* we need this to catch `[ ]' */
- parser->cursor = cur;
- ps_parser_skip_spaces( parser );
- cur = parser->cursor;
-
- while ( cur < limit && !parser->error )
- {
- /* XXX: this is wrong because it does not */
- /* skip comments, procedures, and strings */
- if ( *cur == '[' )
- embed++;
- else if ( *cur == ']' )
- {
- embed--;
- if ( embed <= 0 )
- {
- token->limit = ++cur;
- break;
- }
- }
-
- parser->cursor = cur;
- ps_parser_skip_PS_token( parser );
- /* we need this to catch `[XXX ]' */
- ps_parser_skip_spaces ( parser );
- cur = parser->cursor;
- }
- break;
-
- /* ************ otherwise, it is any token **************/
- default:
- token->start = cur;
- token->type = ( *cur == '/' ? T1_TOKEN_TYPE_KEY : T1_TOKEN_TYPE_ANY );
- ps_parser_skip_PS_token( parser );
- cur = parser->cursor;
- if ( !parser->error )
- token->limit = cur;
- }
-
- if ( !token->limit )
- {
- token->start = NULL;
- token->type = T1_TOKEN_TYPE_NONE;
- }
-
- parser->cursor = cur;
- }
-
-
- /* NB: `tokens' can be NULL if we only want to count */
- /* the number of array elements */
-
- FT_LOCAL_DEF( void )
- ps_parser_to_token_array( PS_Parser parser,
- T1_Token tokens,
- FT_UInt max_tokens,
- FT_Int* pnum_tokens )
- {
- T1_TokenRec master;
-
-
- *pnum_tokens = -1;
-
- /* this also handles leading whitespace */
- ps_parser_to_token( parser, &master );
-
- if ( master.type == T1_TOKEN_TYPE_ARRAY )
- {
- FT_Byte* old_cursor = parser->cursor;
- FT_Byte* old_limit = parser->limit;
- T1_Token cur = tokens;
- T1_Token limit = cur + max_tokens;
-
-
- /* don't include outermost delimiters */
- parser->cursor = master.start + 1;
- parser->limit = master.limit - 1;
-
- while ( parser->cursor < parser->limit )
- {
- T1_TokenRec token;
-
-
- ps_parser_to_token( parser, &token );
- if ( !token.type )
- break;
-
- if ( tokens != NULL && cur < limit )
- *cur = token;
-
- cur++;
- }
-
- *pnum_tokens = (FT_Int)( cur - tokens );
-
- parser->cursor = old_cursor;
- parser->limit = old_limit;
- }
- }
-
-
- /* first character must be a delimiter or a part of a number */
- /* NB: `coords' can be NULL if we just want to skip the */
- /* array; in this case we ignore `max_coords' */
-
- static FT_Int
- ps_tocoordarray( FT_Byte* *acur,
- FT_Byte* limit,
- FT_Int max_coords,
- FT_Short* coords )
- {
- FT_Byte* cur = *acur;
- FT_Int count = 0;
- FT_Byte c, ender;
-
-
- if ( cur >= limit )
- goto Exit;
-
- /* check for the beginning of an array; otherwise, only one number */
- /* will be read */
- c = *cur;
- ender = 0;
-
- if ( c == '[' )
- ender = ']';
- else if ( c == '{' )
- ender = '}';
-
- if ( ender )
- cur++;
-
- /* now, read the coordinates */
- while ( cur < limit )
- {
- FT_Short dummy;
- FT_Byte* old_cur;
-
-
- /* skip whitespace in front of data */
- skip_spaces( &cur, limit );
- if ( cur >= limit )
- goto Exit;
-
- if ( *cur == ender )
- {
- cur++;
- break;
- }
-
- old_cur = cur;
-
- if ( coords != NULL && count >= max_coords )
- break;
-
- /* call PS_Conv_ToFixed() even if coords == NULL */
- /* to properly parse number at `cur' */
- *( coords != NULL ? &coords[count] : &dummy ) =
- (FT_Short)( PS_Conv_ToFixed( &cur, limit, 0 ) >> 16 );
-
- if ( old_cur == cur )
- {
- count = -1;
- goto Exit;
- }
- else
- count++;
-
- if ( !ender )
- break;
- }
-
- Exit:
- *acur = cur;
- return count;
- }
-
-
- /* first character must be a delimiter or a part of a number */
- /* NB: `values' can be NULL if we just want to skip the */
- /* array; in this case we ignore `max_values' */
- /* */
- /* return number of successfully parsed values */
-
- static FT_Int
- ps_tofixedarray( FT_Byte* *acur,
- FT_Byte* limit,
- FT_Int max_values,
- FT_Fixed* values,
- FT_Int power_ten )
- {
- FT_Byte* cur = *acur;
- FT_Int count = 0;
- FT_Byte c, ender;
-
-
- if ( cur >= limit )
- goto Exit;
-
- /* Check for the beginning of an array. Otherwise, only one number */
- /* will be read. */
- c = *cur;
- ender = 0;
-
- if ( c == '[' )
- ender = ']';
- else if ( c == '{' )
- ender = '}';
-
- if ( ender )
- cur++;
-
- /* now, read the values */
- while ( cur < limit )
- {
- FT_Fixed dummy;
- FT_Byte* old_cur;
-
-
- /* skip whitespace in front of data */
- skip_spaces( &cur, limit );
- if ( cur >= limit )
- goto Exit;
-
- if ( *cur == ender )
- {
- cur++;
- break;
- }
-
- old_cur = cur;
-
- if ( values != NULL && count >= max_values )
- break;
-
- /* call PS_Conv_ToFixed() even if coords == NULL */
- /* to properly parse number at `cur' */
- *( values != NULL ? &values[count] : &dummy ) =
- PS_Conv_ToFixed( &cur, limit, power_ten );
-
- if ( old_cur == cur )
- {
- count = -1;
- goto Exit;
- }
- else
- count++;
-
- if ( !ender )
- break;
- }
-
- Exit:
- *acur = cur;
- return count;
- }
-
-
-#if 0
-
- static FT_String*
- ps_tostring( FT_Byte** cursor,
- FT_Byte* limit,
- FT_Memory memory )
- {
- FT_Byte* cur = *cursor;
- FT_UInt len = 0;
- FT_Int count;
- FT_String* result;
- FT_Error error;
-
-
- /* XXX: some stupid fonts have a `Notice' or `Copyright' string */
- /* that simply doesn't begin with an opening parenthesis, even */
- /* though they have a closing one! E.g. "amuncial.pfb" */
- /* */
- /* We must deal with these ill-fated cases there. Note that */
- /* these fonts didn't work with the old Type 1 driver as the */
- /* notice/copyright was not recognized as a valid string token */
- /* and made the old token parser commit errors. */
-
- while ( cur < limit && ( *cur == ' ' || *cur == '\t' ) )
- cur++;
- if ( cur + 1 >= limit )
- return 0;
-
- if ( *cur == '(' )
- cur++; /* skip the opening parenthesis, if there is one */
-
- *cursor = cur;
- count = 0;
-
- /* then, count its length */
- for ( ; cur < limit; cur++ )
- {
- if ( *cur == '(' )
- count++;
-
- else if ( *cur == ')' )
- {
- count--;
- if ( count < 0 )
- break;
- }
- }
-
- len = (FT_UInt)( cur - *cursor );
- if ( cur >= limit || FT_ALLOC( result, len + 1 ) )
- return 0;
-
- /* now copy the string */
- FT_MEM_COPY( result, *cursor, len );
- result[len] = '\0';
- *cursor = cur;
- return result;
- }
-
-#endif /* 0 */
-
-
- static int
- ps_tobool( FT_Byte* *acur,
- FT_Byte* limit )
- {
- FT_Byte* cur = *acur;
- FT_Bool result = 0;
-
-
- /* return 1 if we find `true', 0 otherwise */
- if ( cur + 3 < limit &&
- cur[0] == 't' &&
- cur[1] == 'r' &&
- cur[2] == 'u' &&
- cur[3] == 'e' )
- {
- result = 1;
- cur += 5;
- }
- else if ( cur + 4 < limit &&
- cur[0] == 'f' &&
- cur[1] == 'a' &&
- cur[2] == 'l' &&
- cur[3] == 's' &&
- cur[4] == 'e' )
- {
- result = 0;
- cur += 6;
- }
-
- *acur = cur;
- return result;
- }
-
-
- /* load a simple field (i.e. non-table) into the current list of objects */
-
- FT_LOCAL_DEF( FT_Error )
- ps_parser_load_field( PS_Parser parser,
- const T1_Field field,
- void** objects,
- FT_UInt max_objects,
- FT_ULong* pflags )
- {
- T1_TokenRec token;
- FT_Byte* cur;
- FT_Byte* limit;
- FT_UInt count;
- FT_UInt idx;
- FT_Error error;
- T1_FieldType type;
-
-
- /* this also skips leading whitespace */
- ps_parser_to_token( parser, &token );
- if ( !token.type )
- goto Fail;
-
- count = 1;
- idx = 0;
- cur = token.start;
- limit = token.limit;
-
- type = field->type;
-
- /* we must detect arrays in /FontBBox */
- if ( type == T1_FIELD_TYPE_BBOX )
- {
- T1_TokenRec token2;
- FT_Byte* old_cur = parser->cursor;
- FT_Byte* old_limit = parser->limit;
-
-
- /* don't include delimiters */
- parser->cursor = token.start + 1;
- parser->limit = token.limit - 1;
-
- ps_parser_to_token( parser, &token2 );
- parser->cursor = old_cur;
- parser->limit = old_limit;
-
- if ( token2.type == T1_TOKEN_TYPE_ARRAY )
- {
- type = T1_FIELD_TYPE_MM_BBOX;
- goto FieldArray;
- }
- }
- else if ( token.type == T1_TOKEN_TYPE_ARRAY )
- {
- count = max_objects;
-
- FieldArray:
- /* if this is an array and we have no blend, an error occurs */
- if ( max_objects == 0 )
- goto Fail;
-
- idx = 1;
-
- /* don't include delimiters */
- cur++;
- limit--;
- }
-
- for ( ; count > 0; count--, idx++ )
- {
- FT_Byte* q = (FT_Byte*)objects[idx] + field->offset;
- FT_Long val;
- FT_String* string;
-
-
- skip_spaces( &cur, limit );
-
- switch ( type )
- {
- case T1_FIELD_TYPE_BOOL:
- val = ps_tobool( &cur, limit );
- goto Store_Integer;
-
- case T1_FIELD_TYPE_FIXED:
- val = PS_Conv_ToFixed( &cur, limit, 0 );
- goto Store_Integer;
-
- case T1_FIELD_TYPE_FIXED_1000:
- val = PS_Conv_ToFixed( &cur, limit, 3 );
- goto Store_Integer;
-
- case T1_FIELD_TYPE_INTEGER:
- val = PS_Conv_ToInt( &cur, limit );
- /* fall through */
-
- Store_Integer:
- switch ( field->size )
- {
- case (8 / FT_CHAR_BIT):
- *(FT_Byte*)q = (FT_Byte)val;
- break;
-
- case (16 / FT_CHAR_BIT):
- *(FT_UShort*)q = (FT_UShort)val;
- break;
-
- case (32 / FT_CHAR_BIT):
- *(FT_UInt32*)q = (FT_UInt32)val;
- break;
-
- default: /* for 64-bit systems */
- *(FT_Long*)q = val;
- }
- break;
-
- case T1_FIELD_TYPE_STRING:
- case T1_FIELD_TYPE_KEY:
- {
- FT_Memory memory = parser->memory;
- FT_UInt len = (FT_UInt)( limit - cur );
-
-
- if ( cur >= limit )
- break;
-
- /* we allow both a string or a name */
- /* for cases like /FontName (foo) def */
- if ( token.type == T1_TOKEN_TYPE_KEY )
- {
- /* don't include leading `/' */
- len--;
- cur++;
- }
- else if ( token.type == T1_TOKEN_TYPE_STRING )
- {
- /* don't include delimiting parentheses */
- /* XXX we don't handle <<...>> here */
- /* XXX should we convert octal escapes? */
- /* if so, what encoding should we use? */
- cur++;
- len -= 2;
- }
- else
- {
- FT_ERROR(( "ps_parser_load_field:"
- " expected a name or string\n"
- " "
- " but found token of type %d instead\n",
- token.type ));
- error = FT_THROW( Invalid_File_Format );
- goto Exit;
- }
-
- /* for this to work (FT_String**)q must have been */
- /* initialized to NULL */
- if ( *(FT_String**)q != NULL )
- {
- FT_TRACE0(( "ps_parser_load_field: overwriting field %s\n",
- field->ident ));
- FT_FREE( *(FT_String**)q );
- *(FT_String**)q = NULL;
- }
-
- if ( FT_ALLOC( string, len + 1 ) )
- goto Exit;
-
- FT_MEM_COPY( string, cur, len );
- string[len] = 0;
-
- *(FT_String**)q = string;
- }
- break;
-
- case T1_FIELD_TYPE_BBOX:
- {
- FT_Fixed temp[4];
- FT_BBox* bbox = (FT_BBox*)q;
- FT_Int result;
-
-
- result = ps_tofixedarray( &cur, limit, 4, temp, 0 );
-
- if ( result < 4 )
- {
- FT_ERROR(( "ps_parser_load_field:"
- " expected four integers in bounding box\n" ));
- error = FT_THROW( Invalid_File_Format );
- goto Exit;
- }
-
- bbox->xMin = FT_RoundFix( temp[0] );
- bbox->yMin = FT_RoundFix( temp[1] );
- bbox->xMax = FT_RoundFix( temp[2] );
- bbox->yMax = FT_RoundFix( temp[3] );
- }
- break;
-
- case T1_FIELD_TYPE_MM_BBOX:
- {
- FT_Memory memory = parser->memory;
- FT_Fixed* temp;
- FT_Int result;
- FT_UInt i;
-
-
- if ( FT_NEW_ARRAY( temp, max_objects * 4 ) )
- goto Exit;
-
- for ( i = 0; i < 4; i++ )
- {
- result = ps_tofixedarray( &cur, limit, (FT_Int)max_objects,
- temp + i * max_objects, 0 );
- if ( result < 0 || (FT_UInt)result < max_objects )
- {
- FT_ERROR(( "ps_parser_load_field:"
- " expected %d integer%s in the %s subarray\n"
- " "
- " of /FontBBox in the /Blend dictionary\n",
- max_objects, max_objects > 1 ? "s" : "",
- i == 0 ? "first"
- : ( i == 1 ? "second"
- : ( i == 2 ? "third"
- : "fourth" ) ) ));
- error = FT_THROW( Invalid_File_Format );
-
- FT_FREE( temp );
- goto Exit;
- }
-
- skip_spaces( &cur, limit );
- }
-
- for ( i = 0; i < max_objects; i++ )
- {
- FT_BBox* bbox = (FT_BBox*)objects[i];
-
-
- bbox->xMin = FT_RoundFix( temp[i ] );
- bbox->yMin = FT_RoundFix( temp[i + max_objects] );
- bbox->xMax = FT_RoundFix( temp[i + 2 * max_objects] );
- bbox->yMax = FT_RoundFix( temp[i + 3 * max_objects] );
- }
-
- FT_FREE( temp );
- }
- break;
-
- default:
- /* an error occurred */
- goto Fail;
- }
- }
-
-#if 0 /* obsolete -- keep for reference */
- if ( pflags )
- *pflags |= 1L << field->flag_bit;
-#else
- FT_UNUSED( pflags );
-#endif
-
- error = FT_Err_Ok;
-
- Exit:
- return error;
-
- Fail:
- error = FT_THROW( Invalid_File_Format );
- goto Exit;
- }
-
-
-#define T1_MAX_TABLE_ELEMENTS 32
-
-
- FT_LOCAL_DEF( FT_Error )
- ps_parser_load_field_table( PS_Parser parser,
- const T1_Field field,
- void** objects,
- FT_UInt max_objects,
- FT_ULong* pflags )
- {
- T1_TokenRec elements[T1_MAX_TABLE_ELEMENTS];
- T1_Token token;
- FT_Int num_elements;
- FT_Error error = FT_Err_Ok;
- FT_Byte* old_cursor;
- FT_Byte* old_limit;
- T1_FieldRec fieldrec = *(T1_Field)field;
-
-
- fieldrec.type = T1_FIELD_TYPE_INTEGER;
- if ( field->type == T1_FIELD_TYPE_FIXED_ARRAY ||
- field->type == T1_FIELD_TYPE_BBOX )
- fieldrec.type = T1_FIELD_TYPE_FIXED;
-
- ps_parser_to_token_array( parser, elements,
- T1_MAX_TABLE_ELEMENTS, &num_elements );
- if ( num_elements < 0 )
- {
- error = FT_ERR( Ignore );
- goto Exit;
- }
- if ( (FT_UInt)num_elements > field->array_max )
- num_elements = (FT_Int)field->array_max;
-
- old_cursor = parser->cursor;
- old_limit = parser->limit;
-
- /* we store the elements count if necessary; */
- /* we further assume that `count_offset' can't be zero */
- if ( field->type != T1_FIELD_TYPE_BBOX && field->count_offset != 0 )
- *(FT_Byte*)( (FT_Byte*)objects[0] + field->count_offset ) =
- (FT_Byte)num_elements;
-
- /* we now load each element, adjusting the field.offset on each one */
- token = elements;
- for ( ; num_elements > 0; num_elements--, token++ )
- {
- parser->cursor = token->start;
- parser->limit = token->limit;
-
- error = ps_parser_load_field( parser,
- &fieldrec,
- objects,
- max_objects,
- 0 );
- if ( error )
- break;
-
- fieldrec.offset += fieldrec.size;
- }
-
-#if 0 /* obsolete -- keep for reference */
- if ( pflags )
- *pflags |= 1L << field->flag_bit;
-#else
- FT_UNUSED( pflags );
-#endif
-
- parser->cursor = old_cursor;
- parser->limit = old_limit;
-
- Exit:
- return error;
- }
-
-
- FT_LOCAL_DEF( FT_Long )
- ps_parser_to_int( PS_Parser parser )
- {
- ps_parser_skip_spaces( parser );
- return PS_Conv_ToInt( &parser->cursor, parser->limit );
- }
-
-
- /* first character must be `<' if `delimiters' is non-zero */
-
- FT_LOCAL_DEF( FT_Error )
- ps_parser_to_bytes( PS_Parser parser,
- FT_Byte* bytes,
- FT_Offset max_bytes,
- FT_ULong* pnum_bytes,
- FT_Bool delimiters )
- {
- FT_Error error = FT_Err_Ok;
- FT_Byte* cur;
-
-
- ps_parser_skip_spaces( parser );
- cur = parser->cursor;
-
- if ( cur >= parser->limit )
- goto Exit;
-
- if ( delimiters )
- {
- if ( *cur != '<' )
- {
- FT_ERROR(( "ps_parser_to_bytes: Missing starting delimiter `<'\n" ));
- error = FT_THROW( Invalid_File_Format );
- goto Exit;
- }
-
- cur++;
- }
-
- *pnum_bytes = PS_Conv_ASCIIHexDecode( &cur,
- parser->limit,
- bytes,
- max_bytes );
-
- if ( delimiters )
- {
- if ( cur < parser->limit && *cur != '>' )
- {
- FT_ERROR(( "ps_parser_to_bytes: Missing closing delimiter `>'\n" ));
- error = FT_THROW( Invalid_File_Format );
- goto Exit;
- }
-
- cur++;
- }
-
- parser->cursor = cur;
-
- Exit:
- return error;
- }
-
-
- FT_LOCAL_DEF( FT_Fixed )
- ps_parser_to_fixed( PS_Parser parser,
- FT_Int power_ten )
- {
- ps_parser_skip_spaces( parser );
- return PS_Conv_ToFixed( &parser->cursor, parser->limit, power_ten );
- }
-
-
- FT_LOCAL_DEF( FT_Int )
- ps_parser_to_coord_array( PS_Parser parser,
- FT_Int max_coords,
- FT_Short* coords )
- {
- ps_parser_skip_spaces( parser );
- return ps_tocoordarray( &parser->cursor, parser->limit,
- max_coords, coords );
- }
-
-
- FT_LOCAL_DEF( FT_Int )
- ps_parser_to_fixed_array( PS_Parser parser,
- FT_Int max_values,
- FT_Fixed* values,
- FT_Int power_ten )
- {
- ps_parser_skip_spaces( parser );
- return ps_tofixedarray( &parser->cursor, parser->limit,
- max_values, values, power_ten );
- }
-
-
-#if 0
-
- FT_LOCAL_DEF( FT_String* )
- T1_ToString( PS_Parser parser )
- {
- return ps_tostring( &parser->cursor, parser->limit, parser->memory );
- }
-
-
- FT_LOCAL_DEF( FT_Bool )
- T1_ToBool( PS_Parser parser )
- {
- return ps_tobool( &parser->cursor, parser->limit );
- }
-
-#endif /* 0 */
-
-
- FT_LOCAL_DEF( void )
- ps_parser_init( PS_Parser parser,
- FT_Byte* base,
- FT_Byte* limit,
- FT_Memory memory )
- {
- parser->error = FT_Err_Ok;
- parser->base = base;
- parser->limit = limit;
- parser->cursor = base;
- parser->memory = memory;
- parser->funcs = ps_parser_funcs;
- }
-
-
- FT_LOCAL_DEF( void )
- ps_parser_done( PS_Parser parser )
- {
- FT_UNUSED( parser );
- }
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** T1 BUILDER *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* t1_builder_init */
- /* */
- /* <Description> */
- /* Initializes a given glyph builder. */
- /* */
- /* <InOut> */
- /* builder :: A pointer to the glyph builder to initialize. */
- /* */
- /* <Input> */
- /* face :: The current face object. */
- /* */
- /* size :: The current size object. */
- /* */
- /* glyph :: The current glyph object. */
- /* */
- /* hinting :: Whether hinting should be applied. */
- /* */
- FT_LOCAL_DEF( void )
- t1_builder_init( T1_Builder builder,
- FT_Face face,
- FT_Size size,
- FT_GlyphSlot glyph,
- FT_Bool hinting )
- {
- builder->parse_state = T1_Parse_Start;
- builder->load_points = 1;
-
- builder->face = face;
- builder->glyph = glyph;
- builder->memory = face->memory;
-
- if ( glyph )
- {
- FT_GlyphLoader loader = glyph->internal->loader;
-
-
- builder->loader = loader;
- builder->base = &loader->base.outline;
- builder->current = &loader->current.outline;
- FT_GlyphLoader_Rewind( loader );
-
- builder->hints_globals = size->internal;
- builder->hints_funcs = NULL;
-
- if ( hinting )
- builder->hints_funcs = glyph->internal->glyph_hints;
- }
-
- builder->pos_x = 0;
- builder->pos_y = 0;
-
- builder->left_bearing.x = 0;
- builder->left_bearing.y = 0;
- builder->advance.x = 0;
- builder->advance.y = 0;
-
- builder->funcs = t1_builder_funcs;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* t1_builder_done */
- /* */
- /* <Description> */
- /* Finalizes a given glyph builder. Its contents can still be used */
- /* after the call, but the function saves important information */
- /* within the corresponding glyph slot. */
- /* */
- /* <Input> */
- /* builder :: A pointer to the glyph builder to finalize. */
- /* */
- FT_LOCAL_DEF( void )
- t1_builder_done( T1_Builder builder )
- {
- FT_GlyphSlot glyph = builder->glyph;
-
-
- if ( glyph )
- glyph->outline = *builder->base;
- }
-
-
- /* check that there is enough space for `count' more points */
- FT_LOCAL_DEF( FT_Error )
- t1_builder_check_points( T1_Builder builder,
- FT_Int count )
- {
- return FT_GLYPHLOADER_CHECK_POINTS( builder->loader, count, 0 );
- }
-
-
- /* add a new point, do not check space */
- FT_LOCAL_DEF( void )
- t1_builder_add_point( T1_Builder builder,
- FT_Pos x,
- FT_Pos y,
- FT_Byte flag )
- {
- FT_Outline* outline = builder->current;
-
-
- if ( builder->load_points )
- {
- FT_Vector* point = outline->points + outline->n_points;
- FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points;
-
-
- point->x = FIXED_TO_INT( x );
- point->y = FIXED_TO_INT( y );
- *control = (FT_Byte)( flag ? FT_CURVE_TAG_ON : FT_CURVE_TAG_CUBIC );
- }
- outline->n_points++;
- }
-
-
- /* check space for a new on-curve point, then add it */
- FT_LOCAL_DEF( FT_Error )
- t1_builder_add_point1( T1_Builder builder,
- FT_Pos x,
- FT_Pos y )
- {
- FT_Error error;
-
-
- error = t1_builder_check_points( builder, 1 );
- if ( !error )
- t1_builder_add_point( builder, x, y, 1 );
-
- return error;
- }
-
-
- /* check space for a new contour, then add it */
- FT_LOCAL_DEF( FT_Error )
- t1_builder_add_contour( T1_Builder builder )
- {
- FT_Outline* outline = builder->current;
- FT_Error error;
-
-
- /* this might happen in invalid fonts */
- if ( !outline )
- {
- FT_ERROR(( "t1_builder_add_contour: no outline to add points to\n" ));
- return FT_THROW( Invalid_File_Format );
- }
-
- if ( !builder->load_points )
- {
- outline->n_contours++;
- return FT_Err_Ok;
- }
-
- error = FT_GLYPHLOADER_CHECK_POINTS( builder->loader, 0, 1 );
- if ( !error )
- {
- if ( outline->n_contours > 0 )
- outline->contours[outline->n_contours - 1] =
- (short)( outline->n_points - 1 );
-
- outline->n_contours++;
- }
-
- return error;
- }
-
-
- /* if a path was begun, add its first on-curve point */
- FT_LOCAL_DEF( FT_Error )
- t1_builder_start_point( T1_Builder builder,
- FT_Pos x,
- FT_Pos y )
- {
- FT_Error error = FT_ERR( Invalid_File_Format );
-
-
- /* test whether we are building a new contour */
-
- if ( builder->parse_state == T1_Parse_Have_Path )
- error = FT_Err_Ok;
- else
- {
- builder->parse_state = T1_Parse_Have_Path;
- error = t1_builder_add_contour( builder );
- if ( !error )
- error = t1_builder_add_point1( builder, x, y );
- }
-
- return error;
- }
-
-
- /* close the current contour */
- FT_LOCAL_DEF( void )
- t1_builder_close_contour( T1_Builder builder )
- {
- FT_Outline* outline = builder->current;
- FT_Int first;
-
-
- if ( !outline )
- return;
-
- first = outline->n_contours <= 1
- ? 0 : outline->contours[outline->n_contours - 2] + 1;
-
- /* We must not include the last point in the path if it */
- /* is located on the first point. */
- if ( outline->n_points > 1 )
- {
- FT_Vector* p1 = outline->points + first;
- FT_Vector* p2 = outline->points + outline->n_points - 1;
- FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points - 1;
-
-
- /* `delete' last point only if it coincides with the first */
- /* point and it is not a control point (which can happen). */
- if ( p1->x == p2->x && p1->y == p2->y )
- if ( *control == FT_CURVE_TAG_ON )
- outline->n_points--;
- }
-
- if ( outline->n_contours > 0 )
- {
- /* Don't add contours only consisting of one point, i.e., */
- /* check whether the first and the last point is the same. */
- if ( first == outline->n_points - 1 )
- {
- outline->n_contours--;
- outline->n_points--;
- }
- else
- outline->contours[outline->n_contours - 1] =
- (short)( outline->n_points - 1 );
- }
- }
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** OTHER *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
- FT_LOCAL_DEF( void )
- t1_decrypt( FT_Byte* buffer,
- FT_Offset length,
- FT_UShort seed )
- {
- PS_Conv_EexecDecode( &buffer,
- buffer + length,
- buffer,
- length,
- &seed );
- }
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/psaux/psobjs.h b/chromium/third_party/pdfium/third_party/freetype/src/psaux/psobjs.h
deleted file mode 100644
index bf879c1faf2..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/psaux/psobjs.h
+++ /dev/null
@@ -1,212 +0,0 @@
-/***************************************************************************/
-/* */
-/* psobjs.h */
-/* */
-/* Auxiliary functions for PostScript fonts (specification). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __PSOBJS_H__
-#define __PSOBJS_H__
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
-
-
-FT_BEGIN_HEADER
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** T1_TABLE *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
-
- FT_CALLBACK_TABLE
- const PS_Table_FuncsRec ps_table_funcs;
-
- FT_CALLBACK_TABLE
- const PS_Parser_FuncsRec ps_parser_funcs;
-
- FT_CALLBACK_TABLE
- const T1_Builder_FuncsRec t1_builder_funcs;
-
-
- FT_LOCAL( FT_Error )
- ps_table_new( PS_Table table,
- FT_Int count,
- FT_Memory memory );
-
- FT_LOCAL( FT_Error )
- ps_table_add( PS_Table table,
- FT_Int idx,
- void* object,
- FT_UInt length );
-
- FT_LOCAL( void )
- ps_table_done( PS_Table table );
-
-
- FT_LOCAL( void )
- ps_table_release( PS_Table table );
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** T1 PARSER *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
-
- FT_LOCAL( void )
- ps_parser_skip_spaces( PS_Parser parser );
-
- FT_LOCAL( void )
- ps_parser_skip_PS_token( PS_Parser parser );
-
- FT_LOCAL( void )
- ps_parser_to_token( PS_Parser parser,
- T1_Token token );
-
- FT_LOCAL( void )
- ps_parser_to_token_array( PS_Parser parser,
- T1_Token tokens,
- FT_UInt max_tokens,
- FT_Int* pnum_tokens );
-
- FT_LOCAL( FT_Error )
- ps_parser_load_field( PS_Parser parser,
- const T1_Field field,
- void** objects,
- FT_UInt max_objects,
- FT_ULong* pflags );
-
- FT_LOCAL( FT_Error )
- ps_parser_load_field_table( PS_Parser parser,
- const T1_Field field,
- void** objects,
- FT_UInt max_objects,
- FT_ULong* pflags );
-
- FT_LOCAL( FT_Long )
- ps_parser_to_int( PS_Parser parser );
-
-
- FT_LOCAL( FT_Error )
- ps_parser_to_bytes( PS_Parser parser,
- FT_Byte* bytes,
- FT_Offset max_bytes,
- FT_ULong* pnum_bytes,
- FT_Bool delimiters );
-
-
- FT_LOCAL( FT_Fixed )
- ps_parser_to_fixed( PS_Parser parser,
- FT_Int power_ten );
-
-
- FT_LOCAL( FT_Int )
- ps_parser_to_coord_array( PS_Parser parser,
- FT_Int max_coords,
- FT_Short* coords );
-
- FT_LOCAL( FT_Int )
- ps_parser_to_fixed_array( PS_Parser parser,
- FT_Int max_values,
- FT_Fixed* values,
- FT_Int power_ten );
-
-
- FT_LOCAL( void )
- ps_parser_init( PS_Parser parser,
- FT_Byte* base,
- FT_Byte* limit,
- FT_Memory memory );
-
- FT_LOCAL( void )
- ps_parser_done( PS_Parser parser );
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** T1 BUILDER *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
- FT_LOCAL( void )
- t1_builder_init( T1_Builder builder,
- FT_Face face,
- FT_Size size,
- FT_GlyphSlot glyph,
- FT_Bool hinting );
-
- FT_LOCAL( void )
- t1_builder_done( T1_Builder builder );
-
- FT_LOCAL( FT_Error )
- t1_builder_check_points( T1_Builder builder,
- FT_Int count );
-
- FT_LOCAL( void )
- t1_builder_add_point( T1_Builder builder,
- FT_Pos x,
- FT_Pos y,
- FT_Byte flag );
-
- FT_LOCAL( FT_Error )
- t1_builder_add_point1( T1_Builder builder,
- FT_Pos x,
- FT_Pos y );
-
- FT_LOCAL( FT_Error )
- t1_builder_add_contour( T1_Builder builder );
-
-
- FT_LOCAL( FT_Error )
- t1_builder_start_point( T1_Builder builder,
- FT_Pos x,
- FT_Pos y );
-
-
- FT_LOCAL( void )
- t1_builder_close_contour( T1_Builder builder );
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** OTHER *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
- FT_LOCAL( void )
- t1_decrypt( FT_Byte* buffer,
- FT_Offset length,
- FT_UShort seed );
-
-
-FT_END_HEADER
-
-#endif /* __PSOBJS_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/psaux/t1cmap.c b/chromium/third_party/pdfium/third_party/freetype/src/psaux/t1cmap.c
deleted file mode 100644
index 2e2d433fc49..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/psaux/t1cmap.c
+++ /dev/null
@@ -1,355 +0,0 @@
-/***************************************************************************/
-/* */
-/* t1cmap.c */
-/* */
-/* Type 1 character map support (body). */
-/* */
-/* Copyright 2002-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include "t1cmap.h"
-
-#include FT_INTERNAL_DEBUG_H
-
-#include "psauxerr.h"
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** TYPE1 STANDARD (AND EXPERT) ENCODING CMAPS *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
- static void
- t1_cmap_std_init( T1_CMapStd cmap,
- FT_Int is_expert )
- {
- T1_Face face = (T1_Face)FT_CMAP_FACE( cmap );
- FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)face->psnames;
-
-
- cmap->num_glyphs = (FT_UInt)face->type1.num_glyphs;
- cmap->glyph_names = (const char* const*)face->type1.glyph_names;
- cmap->sid_to_string = psnames->adobe_std_strings;
- cmap->code_to_sid = is_expert ? psnames->adobe_expert_encoding
- : psnames->adobe_std_encoding;
-
- FT_ASSERT( cmap->code_to_sid != NULL );
- }
-
-
- FT_CALLBACK_DEF( void )
- t1_cmap_std_done( T1_CMapStd cmap )
- {
- cmap->num_glyphs = 0;
- cmap->glyph_names = NULL;
- cmap->sid_to_string = NULL;
- cmap->code_to_sid = NULL;
- }
-
-
- FT_CALLBACK_DEF( FT_UInt )
- t1_cmap_std_char_index( T1_CMapStd cmap,
- FT_UInt32 char_code )
- {
- FT_UInt result = 0;
-
-
- if ( char_code < 256 )
- {
- FT_UInt code, n;
- const char* glyph_name;
-
-
- /* convert character code to Adobe SID string */
- code = cmap->code_to_sid[char_code];
- glyph_name = cmap->sid_to_string( code );
-
- /* look for the corresponding glyph name */
- for ( n = 0; n < cmap->num_glyphs; n++ )
- {
- const char* gname = cmap->glyph_names[n];
-
-
- if ( gname && gname[0] == glyph_name[0] &&
- ft_strcmp( gname, glyph_name ) == 0 )
- {
- result = n;
- break;
- }
- }
- }
-
- return result;
- }
-
-
- FT_CALLBACK_DEF( FT_UInt32 )
- t1_cmap_std_char_next( T1_CMapStd cmap,
- FT_UInt32 *pchar_code )
- {
- FT_UInt result = 0;
- FT_UInt32 char_code = *pchar_code + 1;
-
-
- while ( char_code < 256 )
- {
- result = t1_cmap_std_char_index( cmap, char_code );
- if ( result != 0 )
- goto Exit;
-
- char_code++;
- }
- char_code = 0;
-
- Exit:
- *pchar_code = char_code;
- return result;
- }
-
-
- FT_CALLBACK_DEF( FT_Error )
- t1_cmap_standard_init( T1_CMapStd cmap,
- FT_Pointer pointer )
- {
- FT_UNUSED( pointer );
-
-
- t1_cmap_std_init( cmap, 0 );
- return 0;
- }
-
-
- FT_CALLBACK_TABLE_DEF const FT_CMap_ClassRec
- t1_cmap_standard_class_rec =
- {
- sizeof ( T1_CMapStdRec ),
-
- (FT_CMap_InitFunc) t1_cmap_standard_init,
- (FT_CMap_DoneFunc) t1_cmap_std_done,
- (FT_CMap_CharIndexFunc)t1_cmap_std_char_index,
- (FT_CMap_CharNextFunc) t1_cmap_std_char_next,
-
- NULL, NULL, NULL, NULL, NULL
- };
-
-
- FT_CALLBACK_DEF( FT_Error )
- t1_cmap_expert_init( T1_CMapStd cmap,
- FT_Pointer pointer )
- {
- FT_UNUSED( pointer );
-
-
- t1_cmap_std_init( cmap, 1 );
- return 0;
- }
-
- FT_CALLBACK_TABLE_DEF const FT_CMap_ClassRec
- t1_cmap_expert_class_rec =
- {
- sizeof ( T1_CMapStdRec ),
-
- (FT_CMap_InitFunc) t1_cmap_expert_init,
- (FT_CMap_DoneFunc) t1_cmap_std_done,
- (FT_CMap_CharIndexFunc)t1_cmap_std_char_index,
- (FT_CMap_CharNextFunc) t1_cmap_std_char_next,
-
- NULL, NULL, NULL, NULL, NULL
- };
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** TYPE1 CUSTOM ENCODING CMAP *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
-
- FT_CALLBACK_DEF( FT_Error )
- t1_cmap_custom_init( T1_CMapCustom cmap,
- FT_Pointer pointer )
- {
- T1_Face face = (T1_Face)FT_CMAP_FACE( cmap );
- T1_Encoding encoding = &face->type1.encoding;
-
- FT_UNUSED( pointer );
-
-
- cmap->first = (FT_UInt)encoding->code_first;
- cmap->count = (FT_UInt)encoding->code_last - cmap->first;
- cmap->indices = encoding->char_index;
-
- FT_ASSERT( cmap->indices != NULL );
- FT_ASSERT( encoding->code_first <= encoding->code_last );
-
- return 0;
- }
-
-
- FT_CALLBACK_DEF( void )
- t1_cmap_custom_done( T1_CMapCustom cmap )
- {
- cmap->indices = NULL;
- cmap->first = 0;
- cmap->count = 0;
- }
-
-
- FT_CALLBACK_DEF( FT_UInt )
- t1_cmap_custom_char_index( T1_CMapCustom cmap,
- FT_UInt32 char_code )
- {
- FT_UInt result = 0;
-
-
- if ( ( char_code >= cmap->first ) &&
- ( char_code < ( cmap->first + cmap->count ) ) )
- result = cmap->indices[char_code];
-
- return result;
- }
-
-
- FT_CALLBACK_DEF( FT_UInt32 )
- t1_cmap_custom_char_next( T1_CMapCustom cmap,
- FT_UInt32 *pchar_code )
- {
- FT_UInt result = 0;
- FT_UInt32 char_code = *pchar_code;
-
-
- ++char_code;
-
- if ( char_code < cmap->first )
- char_code = cmap->first;
-
- for ( ; char_code < ( cmap->first + cmap->count ); char_code++ )
- {
- result = cmap->indices[char_code];
- if ( result != 0 )
- goto Exit;
- }
-
- char_code = 0;
-
- Exit:
- *pchar_code = char_code;
- return result;
- }
-
-
- FT_CALLBACK_TABLE_DEF const FT_CMap_ClassRec
- t1_cmap_custom_class_rec =
- {
- sizeof ( T1_CMapCustomRec ),
-
- (FT_CMap_InitFunc) t1_cmap_custom_init,
- (FT_CMap_DoneFunc) t1_cmap_custom_done,
- (FT_CMap_CharIndexFunc)t1_cmap_custom_char_index,
- (FT_CMap_CharNextFunc) t1_cmap_custom_char_next,
-
- NULL, NULL, NULL, NULL, NULL
- };
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** TYPE1 SYNTHETIC UNICODE ENCODING CMAP *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
- FT_CALLBACK_DEF( const char * )
- psaux_get_glyph_name( T1_Face face,
- FT_UInt idx )
- {
- return face->type1.glyph_names[idx];
- }
-
-
- FT_CALLBACK_DEF( FT_Error )
- t1_cmap_unicode_init( PS_Unicodes unicodes,
- FT_Pointer pointer )
- {
- T1_Face face = (T1_Face)FT_CMAP_FACE( unicodes );
- FT_Memory memory = FT_FACE_MEMORY( face );
- FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)face->psnames;
-
- FT_UNUSED( pointer );
-
-
- return psnames->unicodes_init( memory,
- unicodes,
- (FT_UInt)face->type1.num_glyphs,
- (PS_GetGlyphNameFunc)&psaux_get_glyph_name,
- (PS_FreeGlyphNameFunc)NULL,
- (FT_Pointer)face );
- }
-
-
- FT_CALLBACK_DEF( void )
- t1_cmap_unicode_done( PS_Unicodes unicodes )
- {
- FT_Face face = FT_CMAP_FACE( unicodes );
- FT_Memory memory = FT_FACE_MEMORY( face );
-
-
- FT_FREE( unicodes->maps );
- unicodes->num_maps = 0;
- }
-
-
- FT_CALLBACK_DEF( FT_UInt )
- t1_cmap_unicode_char_index( PS_Unicodes unicodes,
- FT_UInt32 char_code )
- {
- T1_Face face = (T1_Face)FT_CMAP_FACE( unicodes );
- FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)face->psnames;
-
-
- return psnames->unicodes_char_index( unicodes, char_code );
- }
-
-
- FT_CALLBACK_DEF( FT_UInt32 )
- t1_cmap_unicode_char_next( PS_Unicodes unicodes,
- FT_UInt32 *pchar_code )
- {
- T1_Face face = (T1_Face)FT_CMAP_FACE( unicodes );
- FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)face->psnames;
-
-
- return psnames->unicodes_char_next( unicodes, pchar_code );
- }
-
-
- FT_CALLBACK_TABLE_DEF const FT_CMap_ClassRec
- t1_cmap_unicode_class_rec =
- {
- sizeof ( PS_UnicodesRec ),
-
- (FT_CMap_InitFunc) t1_cmap_unicode_init,
- (FT_CMap_DoneFunc) t1_cmap_unicode_done,
- (FT_CMap_CharIndexFunc)t1_cmap_unicode_char_index,
- (FT_CMap_CharNextFunc) t1_cmap_unicode_char_next,
-
- NULL, NULL, NULL, NULL, NULL
- };
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/psaux/t1cmap.h b/chromium/third_party/pdfium/third_party/freetype/src/psaux/t1cmap.h
deleted file mode 100644
index b8ba06cc3bc..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/psaux/t1cmap.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/***************************************************************************/
-/* */
-/* t1cmap.h */
-/* */
-/* Type 1 character map support (specification). */
-/* */
-/* Copyright 2002-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __T1CMAP_H__
-#define __T1CMAP_H__
-
-#include <ft2build.h>
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_TYPE1_TYPES_H
-
-FT_BEGIN_HEADER
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** TYPE1 STANDARD (AND EXPERT) ENCODING CMAPS *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
- /* standard (and expert) encoding cmaps */
- typedef struct T1_CMapStdRec_* T1_CMapStd;
-
- typedef struct T1_CMapStdRec_
- {
- FT_CMapRec cmap;
-
- const FT_UShort* code_to_sid;
- PS_Adobe_Std_StringsFunc sid_to_string;
-
- FT_UInt num_glyphs;
- const char* const* glyph_names;
-
- } T1_CMapStdRec;
-
-
- FT_CALLBACK_TABLE const FT_CMap_ClassRec
- t1_cmap_standard_class_rec;
-
- FT_CALLBACK_TABLE const FT_CMap_ClassRec
- t1_cmap_expert_class_rec;
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** TYPE1 CUSTOM ENCODING CMAP *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
- typedef struct T1_CMapCustomRec_* T1_CMapCustom;
-
- typedef struct T1_CMapCustomRec_
- {
- FT_CMapRec cmap;
- FT_UInt first;
- FT_UInt count;
- FT_UShort* indices;
-
- } T1_CMapCustomRec;
-
-
- FT_CALLBACK_TABLE const FT_CMap_ClassRec
- t1_cmap_custom_class_rec;
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** TYPE1 SYNTHETIC UNICODE ENCODING CMAP *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
- /* unicode (synthetic) cmaps */
-
- FT_CALLBACK_TABLE const FT_CMap_ClassRec
- t1_cmap_unicode_class_rec;
-
- /* */
-
-
-FT_END_HEADER
-
-#endif /* __T1CMAP_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/psaux/t1decode.c b/chromium/third_party/pdfium/third_party/freetype/src/psaux/t1decode.c
deleted file mode 100644
index 2e199286f6e..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/psaux/t1decode.c
+++ /dev/null
@@ -1,1624 +0,0 @@
-/***************************************************************************/
-/* */
-/* t1decode.c */
-/* */
-/* PostScript Type 1 decoding routines (body). */
-/* */
-/* Copyright 2000-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_CALC_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_POSTSCRIPT_HINTS_H
-#include FT_OUTLINE_H
-
-#include "t1decode.h"
-#include "psobjs.h"
-
-#include "psauxerr.h"
-
-/* ensure proper sign extension */
-#define Fix2Int( f ) ( (FT_Int)(FT_Short)( (f) >> 16 ) )
-
- /*************************************************************************/
- /* */
- /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
- /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
- /* messages during execution. */
- /* */
-#undef FT_COMPONENT
-#define FT_COMPONENT trace_t1decode
-
-
- typedef enum T1_Operator_
- {
- op_none = 0,
- op_endchar,
- op_hsbw,
- op_seac,
- op_sbw,
- op_closepath,
- op_hlineto,
- op_hmoveto,
- op_hvcurveto,
- op_rlineto,
- op_rmoveto,
- op_rrcurveto,
- op_vhcurveto,
- op_vlineto,
- op_vmoveto,
- op_dotsection,
- op_hstem,
- op_hstem3,
- op_vstem,
- op_vstem3,
- op_div,
- op_callothersubr,
- op_callsubr,
- op_pop,
- op_return,
- op_setcurrentpoint,
- op_unknown15,
-
- op_max /* never remove this one */
-
- } T1_Operator;
-
-
- static
- const FT_Int t1_args_count[op_max] =
- {
- 0, /* none */
- 0, /* endchar */
- 2, /* hsbw */
- 5, /* seac */
- 4, /* sbw */
- 0, /* closepath */
- 1, /* hlineto */
- 1, /* hmoveto */
- 4, /* hvcurveto */
- 2, /* rlineto */
- 2, /* rmoveto */
- 6, /* rrcurveto */
- 4, /* vhcurveto */
- 1, /* vlineto */
- 1, /* vmoveto */
- 0, /* dotsection */
- 2, /* hstem */
- 6, /* hstem3 */
- 2, /* vstem */
- 6, /* vstem3 */
- 2, /* div */
- -1, /* callothersubr */
- 1, /* callsubr */
- 0, /* pop */
- 0, /* return */
- 2, /* setcurrentpoint */
- 2 /* opcode 15 (undocumented and obsolete) */
- };
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* t1_lookup_glyph_by_stdcharcode */
- /* */
- /* <Description> */
- /* Looks up a given glyph by its StandardEncoding charcode. Used to */
- /* implement the SEAC Type 1 operator. */
- /* */
- /* <Input> */
- /* face :: The current face object. */
- /* */
- /* charcode :: The character code to look for. */
- /* */
- /* <Return> */
- /* A glyph index in the font face. Returns -1 if the corresponding */
- /* glyph wasn't found. */
- /* */
- static FT_Int
- t1_lookup_glyph_by_stdcharcode( T1_Decoder decoder,
- FT_Int charcode )
- {
- FT_UInt n;
- const FT_String* glyph_name;
- FT_Service_PsCMaps psnames = decoder->psnames;
-
-
- /* check range of standard char code */
- if ( charcode < 0 || charcode > 255 )
- return -1;
-
- glyph_name = psnames->adobe_std_strings(
- psnames->adobe_std_encoding[charcode]);
-
- for ( n = 0; n < decoder->num_glyphs; n++ )
- {
- FT_String* name = (FT_String*)decoder->glyph_names[n];
-
-
- if ( name &&
- name[0] == glyph_name[0] &&
- ft_strcmp( name, glyph_name ) == 0 )
- return (FT_Int)n;
- }
-
- return -1;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* t1operator_seac */
- /* */
- /* <Description> */
- /* Implements the `seac' Type 1 operator for a Type 1 decoder. */
- /* */
- /* <Input> */
- /* decoder :: The current CID decoder. */
- /* */
- /* asb :: The accent's side bearing. */
- /* */
- /* adx :: The horizontal offset of the accent. */
- /* */
- /* ady :: The vertical offset of the accent. */
- /* */
- /* bchar :: The base character's StandardEncoding charcode. */
- /* */
- /* achar :: The accent character's StandardEncoding charcode. */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. */
- /* */
- static FT_Error
- t1operator_seac( T1_Decoder decoder,
- FT_Pos asb,
- FT_Pos adx,
- FT_Pos ady,
- FT_Int bchar,
- FT_Int achar )
- {
- FT_Error error;
- FT_Int bchar_index, achar_index;
-#if 0
- FT_Int n_base_points;
- FT_Outline* base = decoder->builder.base;
-#endif
- FT_Vector left_bearing, advance;
-
-#ifdef FT_CONFIG_OPTION_INCREMENTAL
- T1_Face face = (T1_Face)decoder->builder.face;
-#endif
-
-
- if ( decoder->seac )
- {
- FT_ERROR(( "t1operator_seac: invalid nested seac\n" ));
- return FT_THROW( Syntax_Error );
- }
-
- if ( decoder->builder.metrics_only )
- {
- FT_ERROR(( "t1operator_seac: unexpected seac\n" ));
- return FT_THROW( Syntax_Error );
- }
-
- /* seac weirdness */
- adx += decoder->builder.left_bearing.x;
-
- /* `glyph_names' is set to 0 for CID fonts which do not */
- /* include an encoding. How can we deal with these? */
-#ifdef FT_CONFIG_OPTION_INCREMENTAL
- if ( decoder->glyph_names == 0 &&
- !face->root.internal->incremental_interface )
-#else
- if ( decoder->glyph_names == 0 )
-#endif /* FT_CONFIG_OPTION_INCREMENTAL */
- {
- FT_ERROR(( "t1operator_seac:"
- " glyph names table not available in this font\n" ));
- return FT_THROW( Syntax_Error );
- }
-
-#ifdef FT_CONFIG_OPTION_INCREMENTAL
- if ( face->root.internal->incremental_interface )
- {
- /* the caller must handle the font encoding also */
- bchar_index = bchar;
- achar_index = achar;
- }
- else
-#endif
- {
- bchar_index = t1_lookup_glyph_by_stdcharcode( decoder, bchar );
- achar_index = t1_lookup_glyph_by_stdcharcode( decoder, achar );
- }
-
- if ( bchar_index < 0 || achar_index < 0 )
- {
- FT_ERROR(( "t1operator_seac:"
- " invalid seac character code arguments\n" ));
- return FT_THROW( Syntax_Error );
- }
-
- /* if we are trying to load a composite glyph, do not load the */
- /* accent character and return the array of subglyphs. */
- if ( decoder->builder.no_recurse )
- {
- FT_GlyphSlot glyph = (FT_GlyphSlot)decoder->builder.glyph;
- FT_GlyphLoader loader = glyph->internal->loader;
- FT_SubGlyph subg;
-
-
- /* reallocate subglyph array if necessary */
- error = FT_GlyphLoader_CheckSubGlyphs( loader, 2 );
- if ( error )
- goto Exit;
-
- subg = loader->current.subglyphs;
-
- /* subglyph 0 = base character */
- subg->index = bchar_index;
- subg->flags = FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES |
- FT_SUBGLYPH_FLAG_USE_MY_METRICS;
- subg->arg1 = 0;
- subg->arg2 = 0;
- subg++;
-
- /* subglyph 1 = accent character */
- subg->index = achar_index;
- subg->flags = FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES;
- subg->arg1 = (FT_Int)FIXED_TO_INT( adx - asb );
- subg->arg2 = (FT_Int)FIXED_TO_INT( ady );
-
- /* set up remaining glyph fields */
- glyph->num_subglyphs = 2;
- glyph->subglyphs = loader->base.subglyphs;
- glyph->format = FT_GLYPH_FORMAT_COMPOSITE;
-
- loader->current.num_subglyphs = 2;
- goto Exit;
- }
-
- /* First load `bchar' in builder */
- /* now load the unscaled outline */
-
- FT_GlyphLoader_Prepare( decoder->builder.loader ); /* prepare loader */
-
- /* the seac operator must not be nested */
- decoder->seac = TRUE;
- error = t1_decoder_parse_glyph( decoder, (FT_UInt)bchar_index );
- decoder->seac = FALSE;
- if ( error )
- goto Exit;
-
- /* save the left bearing and width of the base character */
- /* as they will be erased by the next load. */
-
- left_bearing = decoder->builder.left_bearing;
- advance = decoder->builder.advance;
-
- decoder->builder.left_bearing.x = 0;
- decoder->builder.left_bearing.y = 0;
-
- decoder->builder.pos_x = adx - asb;
- decoder->builder.pos_y = ady;
-
- /* Now load `achar' on top of */
- /* the base outline */
-
- /* the seac operator must not be nested */
- decoder->seac = TRUE;
- error = t1_decoder_parse_glyph( decoder, (FT_UInt)achar_index );
- decoder->seac = FALSE;
- if ( error )
- goto Exit;
-
- /* restore the left side bearing and */
- /* advance width of the base character */
-
- decoder->builder.left_bearing = left_bearing;
- decoder->builder.advance = advance;
-
- decoder->builder.pos_x = 0;
- decoder->builder.pos_y = 0;
-
- Exit:
- return error;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* t1_decoder_parse_charstrings */
- /* */
- /* <Description> */
- /* Parses a given Type 1 charstrings program. */
- /* */
- /* <Input> */
- /* decoder :: The current Type 1 decoder. */
- /* */
- /* charstring_base :: The base address of the charstring stream. */
- /* */
- /* charstring_len :: The length in bytes of the charstring stream. */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. */
- /* */
- FT_LOCAL_DEF( FT_Error )
- t1_decoder_parse_charstrings( T1_Decoder decoder,
- FT_Byte* charstring_base,
- FT_UInt charstring_len )
- {
- FT_Error error;
- T1_Decoder_Zone zone;
- FT_Byte* ip;
- FT_Byte* limit;
- T1_Builder builder = &decoder->builder;
- FT_Pos x, y, orig_x, orig_y;
- FT_Int known_othersubr_result_cnt = 0;
- FT_Int unknown_othersubr_result_cnt = 0;
- FT_Bool large_int;
- FT_Fixed seed;
-
- T1_Hints_Funcs hinter;
-
-#ifdef FT_DEBUG_LEVEL_TRACE
- FT_Bool bol = TRUE;
-#endif
-
-
- /* compute random seed from stack address of parameter */
- seed = (FT_Fixed)( ( (FT_Offset)(char*)&seed ^
- (FT_Offset)(char*)&decoder ^
- (FT_Offset)(char*)&charstring_base ) &
- FT_ULONG_MAX );
- seed = ( seed ^ ( seed >> 10 ) ^ ( seed >> 20 ) ) & 0xFFFFL;
- if ( seed == 0 )
- seed = 0x7384;
-
- /* First of all, initialize the decoder */
- decoder->top = decoder->stack;
- decoder->zone = decoder->zones;
- zone = decoder->zones;
-
- builder->parse_state = T1_Parse_Start;
-
- hinter = (T1_Hints_Funcs)builder->hints_funcs;
-
- /* a font that reads BuildCharArray without setting */
- /* its values first is buggy, but ... */
- FT_ASSERT( ( decoder->len_buildchar == 0 ) ==
- ( decoder->buildchar == NULL ) );
-
- if ( decoder->buildchar && decoder->len_buildchar > 0 )
- ft_memset( &decoder->buildchar[0],
- 0,
- sizeof ( decoder->buildchar[0] ) * decoder->len_buildchar );
-
- FT_TRACE4(( "\n"
- "Start charstring\n" ));
-
- zone->base = charstring_base;
- limit = zone->limit = charstring_base + charstring_len;
- ip = zone->cursor = zone->base;
-
- error = FT_Err_Ok;
-
- x = orig_x = builder->pos_x;
- y = orig_y = builder->pos_y;
-
- /* begin hints recording session, if any */
- if ( hinter )
- hinter->open( hinter->hints );
-
- large_int = FALSE;
-
- /* now, execute loop */
- while ( ip < limit )
- {
- FT_Long* top = decoder->top;
- T1_Operator op = op_none;
- FT_Int32 value = 0;
-
-
- FT_ASSERT( known_othersubr_result_cnt == 0 ||
- unknown_othersubr_result_cnt == 0 );
-
-#ifdef FT_DEBUG_LEVEL_TRACE
- if ( bol )
- {
- FT_TRACE5(( " (%d)", decoder->top - decoder->stack ));
- bol = FALSE;
- }
-#endif
-
- /*********************************************************************/
- /* */
- /* Decode operator or operand */
- /* */
- /* */
-
- /* first of all, decompress operator or value */
- switch ( *ip++ )
- {
- case 1:
- op = op_hstem;
- break;
-
- case 3:
- op = op_vstem;
- break;
- case 4:
- op = op_vmoveto;
- break;
- case 5:
- op = op_rlineto;
- break;
- case 6:
- op = op_hlineto;
- break;
- case 7:
- op = op_vlineto;
- break;
- case 8:
- op = op_rrcurveto;
- break;
- case 9:
- op = op_closepath;
- break;
- case 10:
- op = op_callsubr;
- break;
- case 11:
- op = op_return;
- break;
-
- case 13:
- op = op_hsbw;
- break;
- case 14:
- op = op_endchar;
- break;
-
- case 15: /* undocumented, obsolete operator */
- op = op_unknown15;
- break;
-
- case 21:
- op = op_rmoveto;
- break;
- case 22:
- op = op_hmoveto;
- break;
-
- case 30:
- op = op_vhcurveto;
- break;
- case 31:
- op = op_hvcurveto;
- break;
-
- case 12:
- if ( ip > limit )
- {
- FT_ERROR(( "t1_decoder_parse_charstrings:"
- " invalid escape (12+EOF)\n" ));
- goto Syntax_Error;
- }
-
- switch ( *ip++ )
- {
- case 0:
- op = op_dotsection;
- break;
- case 1:
- op = op_vstem3;
- break;
- case 2:
- op = op_hstem3;
- break;
- case 6:
- op = op_seac;
- break;
- case 7:
- op = op_sbw;
- break;
- case 12:
- op = op_div;
- break;
- case 16:
- op = op_callothersubr;
- break;
- case 17:
- op = op_pop;
- break;
- case 33:
- op = op_setcurrentpoint;
- break;
-
- default:
- FT_ERROR(( "t1_decoder_parse_charstrings:"
- " invalid escape (12+%d)\n",
- ip[-1] ));
- goto Syntax_Error;
- }
- break;
-
- case 255: /* four bytes integer */
- if ( ip + 4 > limit )
- {
- FT_ERROR(( "t1_decoder_parse_charstrings:"
- " unexpected EOF in integer\n" ));
- goto Syntax_Error;
- }
-
- value = (FT_Int32)( ( (FT_UInt32)ip[0] << 24 ) |
- ( (FT_UInt32)ip[1] << 16 ) |
- ( (FT_UInt32)ip[2] << 8 ) |
- (FT_UInt32)ip[3] );
- ip += 4;
-
- /* According to the specification, values > 32000 or < -32000 must */
- /* be followed by a `div' operator to make the result be in the */
- /* range [-32000;32000]. We expect that the second argument of */
- /* `div' is not a large number. Additionally, we don't handle */
- /* stuff like `<large1> <large2> <num> div <num> div' or */
- /* <large1> <large2> <num> div div'. This is probably not allowed */
- /* anyway. */
- if ( value > 32000 || value < -32000 )
- {
- if ( large_int )
- {
- FT_ERROR(( "t1_decoder_parse_charstrings:"
- " no `div' after large integer\n" ));
- }
- else
- large_int = TRUE;
- }
- else
- {
- if ( !large_int )
- value = (FT_Int32)( (FT_UInt32)value << 16 );
- }
-
- break;
-
- default:
- if ( ip[-1] >= 32 )
- {
- if ( ip[-1] < 247 )
- value = (FT_Int32)ip[-1] - 139;
- else
- {
- if ( ++ip > limit )
- {
- FT_ERROR(( "t1_decoder_parse_charstrings:"
- " unexpected EOF in integer\n" ));
- goto Syntax_Error;
- }
-
- if ( ip[-2] < 251 )
- value = ( ( ip[-2] - 247 ) * 256 ) + ip[-1] + 108;
- else
- value = -( ( ( ip[-2] - 251 ) * 256 ) + ip[-1] + 108 );
- }
-
- if ( !large_int )
- value = (FT_Int32)( (FT_UInt32)value << 16 );
- }
- else
- {
- FT_ERROR(( "t1_decoder_parse_charstrings:"
- " invalid byte (%d)\n", ip[-1] ));
- goto Syntax_Error;
- }
- }
-
- if ( unknown_othersubr_result_cnt > 0 )
- {
- switch ( op )
- {
- case op_callsubr:
- case op_return:
- case op_none:
- case op_pop:
- break;
-
- default:
- /* all operands have been transferred by previous pops */
- unknown_othersubr_result_cnt = 0;
- break;
- }
- }
-
- if ( large_int && !( op == op_none || op == op_div ) )
- {
- FT_ERROR(( "t1_decoder_parse_charstrings:"
- " no `div' after large integer\n" ));
-
- large_int = FALSE;
- }
-
- /*********************************************************************/
- /* */
- /* Push value on stack, or process operator */
- /* */
- /* */
- if ( op == op_none )
- {
- if ( top - decoder->stack >= T1_MAX_CHARSTRINGS_OPERANDS )
- {
- FT_ERROR(( "t1_decoder_parse_charstrings: stack overflow\n" ));
- goto Syntax_Error;
- }
-
-#ifdef FT_DEBUG_LEVEL_TRACE
- if ( large_int )
- FT_TRACE4(( " %ld", value ));
- else
- FT_TRACE4(( " %ld", Fix2Int( value ) ));
-#endif
-
- *top++ = value;
- decoder->top = top;
- }
- else if ( op == op_callothersubr ) /* callothersubr */
- {
- FT_Int subr_no;
- FT_Int arg_cnt;
-
-
-#ifdef FT_DEBUG_LEVEL_TRACE
- FT_TRACE4(( " callothersubr\n" ));
- bol = TRUE;
-#endif
-
- if ( top - decoder->stack < 2 )
- goto Stack_Underflow;
-
- top -= 2;
-
- subr_no = Fix2Int( top[1] );
- arg_cnt = Fix2Int( top[0] );
-
- /***********************************************************/
- /* */
- /* remove all operands to callothersubr from the stack */
- /* */
- /* for handled othersubrs, where we know the number of */
- /* arguments, we increase the stack by the value of */
- /* known_othersubr_result_cnt */
- /* */
- /* for unhandled othersubrs the following pops adjust the */
- /* stack pointer as necessary */
-
- if ( arg_cnt > top - decoder->stack )
- goto Stack_Underflow;
-
- top -= arg_cnt;
-
- known_othersubr_result_cnt = 0;
- unknown_othersubr_result_cnt = 0;
-
- /* XXX TODO: The checks to `arg_count == <whatever>' */
- /* might not be correct; an othersubr expects a certain */
- /* number of operands on the PostScript stack (as opposed */
- /* to the T1 stack) but it doesn't have to put them there */
- /* by itself; previous othersubrs might have left the */
- /* operands there if they were not followed by an */
- /* appropriate number of pops */
- /* */
- /* On the other hand, Adobe Reader 7.0.8 for Linux doesn't */
- /* accept a font that contains charstrings like */
- /* */
- /* 100 200 2 20 callothersubr */
- /* 300 1 20 callothersubr pop */
- /* */
- /* Perhaps this is the reason why BuildCharArray exists. */
-
- switch ( subr_no )
- {
- case 0: /* end flex feature */
- if ( arg_cnt != 3 )
- goto Unexpected_OtherSubr;
-
- if ( decoder->flex_state == 0 ||
- decoder->num_flex_vectors != 7 )
- {
- FT_ERROR(( "t1_decoder_parse_charstrings:"
- " unexpected flex end\n" ));
- goto Syntax_Error;
- }
-
- /* the two `results' are popped by the following setcurrentpoint */
- top[0] = x;
- top[1] = y;
- known_othersubr_result_cnt = 2;
- break;
-
- case 1: /* start flex feature */
- if ( arg_cnt != 0 )
- goto Unexpected_OtherSubr;
-
- decoder->flex_state = 1;
- decoder->num_flex_vectors = 0;
- if ( ( error = t1_builder_start_point( builder, x, y ) )
- != FT_Err_Ok ||
- ( error = t1_builder_check_points( builder, 6 ) )
- != FT_Err_Ok )
- goto Fail;
- break;
-
- case 2: /* add flex vectors */
- {
- FT_Int idx;
-
-
- if ( arg_cnt != 0 )
- goto Unexpected_OtherSubr;
-
- if ( decoder->flex_state == 0 )
- {
- FT_ERROR(( "t1_decoder_parse_charstrings:"
- " missing flex start\n" ));
- goto Syntax_Error;
- }
-
- /* note that we should not add a point for index 0; */
- /* this will move our current position to the flex */
- /* point without adding any point to the outline */
- idx = decoder->num_flex_vectors++;
- if ( idx > 0 && idx < 7 )
- t1_builder_add_point( builder,
- x,
- y,
- (FT_Byte)( idx == 3 || idx == 6 ) );
- }
- break;
-
- case 3: /* change hints */
- if ( arg_cnt != 1 )
- goto Unexpected_OtherSubr;
-
- known_othersubr_result_cnt = 1;
-
- if ( hinter )
- hinter->reset( hinter->hints,
- (FT_UInt)builder->current->n_points );
- break;
-
- case 12:
- case 13:
- /* counter control hints, clear stack */
- top = decoder->stack;
- break;
-
- case 14:
- case 15:
- case 16:
- case 17:
- case 18: /* multiple masters */
- {
- PS_Blend blend = decoder->blend;
- FT_UInt num_points, nn, mm;
- FT_Long* delta;
- FT_Long* values;
-
-
- if ( !blend )
- {
- FT_ERROR(( "t1_decoder_parse_charstrings:"
- " unexpected multiple masters operator\n" ));
- goto Syntax_Error;
- }
-
- num_points = (FT_UInt)subr_no - 13 + ( subr_no == 18 );
- if ( arg_cnt != (FT_Int)( num_points * blend->num_designs ) )
- {
- FT_ERROR(( "t1_decoder_parse_charstrings:"
- " incorrect number of multiple masters arguments\n" ));
- goto Syntax_Error;
- }
-
- /* We want to compute */
- /* */
- /* a0*w0 + a1*w1 + ... + ak*wk */
- /* */
- /* but we only have a0, a1-a0, a2-a0, ..., ak-a0. */
- /* */
- /* However, given that w0 + w1 + ... + wk == 1, we can */
- /* rewrite it easily as */
- /* */
- /* a0 + (a1-a0)*w1 + (a2-a0)*w2 + ... + (ak-a0)*wk */
- /* */
- /* where k == num_designs-1. */
- /* */
- /* I guess that's why it's written in this `compact' */
- /* form. */
- /* */
- delta = top + num_points;
- values = top;
- for ( nn = 0; nn < num_points; nn++ )
- {
- FT_Long tmp = values[0];
-
-
- for ( mm = 1; mm < blend->num_designs; mm++ )
- tmp += FT_MulFix( *delta++, blend->weight_vector[mm] );
-
- *values++ = tmp;
- }
-
- known_othersubr_result_cnt = (FT_Int)num_points;
- break;
- }
-
- case 19:
- /* <idx> 1 19 callothersubr */
- /* => replace elements starting from index cvi( <idx> ) */
- /* of BuildCharArray with WeightVector */
- {
- FT_Int idx;
- PS_Blend blend = decoder->blend;
-
-
- if ( arg_cnt != 1 || blend == NULL )
- goto Unexpected_OtherSubr;
-
- idx = Fix2Int( top[0] );
-
- if ( idx < 0 ||
- (FT_UInt)idx + blend->num_designs > decoder->len_buildchar )
- goto Unexpected_OtherSubr;
-
- ft_memcpy( &decoder->buildchar[idx],
- blend->weight_vector,
- blend->num_designs *
- sizeof ( blend->weight_vector[0] ) );
- }
- break;
-
- case 20:
- /* <arg1> <arg2> 2 20 callothersubr pop */
- /* ==> push <arg1> + <arg2> onto T1 stack */
- if ( arg_cnt != 2 )
- goto Unexpected_OtherSubr;
-
- top[0] += top[1]; /* XXX (over|under)flow */
-
- known_othersubr_result_cnt = 1;
- break;
-
- case 21:
- /* <arg1> <arg2> 2 21 callothersubr pop */
- /* ==> push <arg1> - <arg2> onto T1 stack */
- if ( arg_cnt != 2 )
- goto Unexpected_OtherSubr;
-
- top[0] -= top[1]; /* XXX (over|under)flow */
-
- known_othersubr_result_cnt = 1;
- break;
-
- case 22:
- /* <arg1> <arg2> 2 22 callothersubr pop */
- /* ==> push <arg1> * <arg2> onto T1 stack */
- if ( arg_cnt != 2 )
- goto Unexpected_OtherSubr;
-
- top[0] = FT_MulFix( top[0], top[1] );
-
- known_othersubr_result_cnt = 1;
- break;
-
- case 23:
- /* <arg1> <arg2> 2 23 callothersubr pop */
- /* ==> push <arg1> / <arg2> onto T1 stack */
- if ( arg_cnt != 2 || top[1] == 0 )
- goto Unexpected_OtherSubr;
-
- top[0] = FT_DivFix( top[0], top[1] );
-
- known_othersubr_result_cnt = 1;
- break;
-
- case 24:
- /* <val> <idx> 2 24 callothersubr */
- /* ==> set BuildCharArray[cvi( <idx> )] = <val> */
- {
- FT_Int idx;
- PS_Blend blend = decoder->blend;
-
-
- if ( arg_cnt != 2 || blend == NULL )
- goto Unexpected_OtherSubr;
-
- idx = Fix2Int( top[1] );
-
- if ( idx < 0 || (FT_UInt) idx >= decoder->len_buildchar )
- goto Unexpected_OtherSubr;
-
- decoder->buildchar[idx] = top[0];
- }
- break;
-
- case 25:
- /* <idx> 1 25 callothersubr pop */
- /* ==> push BuildCharArray[cvi( idx )] */
- /* onto T1 stack */
- {
- FT_Int idx;
- PS_Blend blend = decoder->blend;
-
-
- if ( arg_cnt != 1 || blend == NULL )
- goto Unexpected_OtherSubr;
-
- idx = Fix2Int( top[0] );
-
- if ( idx < 0 || (FT_UInt) idx >= decoder->len_buildchar )
- goto Unexpected_OtherSubr;
-
- top[0] = decoder->buildchar[idx];
- }
-
- known_othersubr_result_cnt = 1;
- break;
-
-#if 0
- case 26:
- /* <val> mark <idx> ==> set BuildCharArray[cvi( <idx> )] = <val>, */
- /* leave mark on T1 stack */
- /* <val> <idx> ==> set BuildCharArray[cvi( <idx> )] = <val> */
- XXX which routine has left its mark on the (PostScript) stack?;
- break;
-#endif
-
- case 27:
- /* <res1> <res2> <val1> <val2> 4 27 callothersubr pop */
- /* ==> push <res1> onto T1 stack if <val1> <= <val2>, */
- /* otherwise push <res2> */
- if ( arg_cnt != 4 )
- goto Unexpected_OtherSubr;
-
- if ( top[2] > top[3] )
- top[0] = top[1];
-
- known_othersubr_result_cnt = 1;
- break;
-
- case 28:
- /* 0 28 callothersubr pop */
- /* => push random value from interval [0, 1) onto stack */
- if ( arg_cnt != 0 )
- goto Unexpected_OtherSubr;
-
- {
- FT_Fixed Rand;
-
-
- Rand = seed;
- if ( Rand >= 0x8000L )
- Rand++;
-
- top[0] = Rand;
-
- seed = FT_MulFix( seed, 0x10000L - seed );
- if ( seed == 0 )
- seed += 0x2873;
- }
-
- known_othersubr_result_cnt = 1;
- break;
-
- default:
- if ( arg_cnt >= 0 && subr_no >= 0 )
- {
- FT_ERROR(( "t1_decoder_parse_charstrings:"
- " unknown othersubr [%d %d], wish me luck\n",
- arg_cnt, subr_no ));
- unknown_othersubr_result_cnt = arg_cnt;
- break;
- }
- /* fall through */
-
- Unexpected_OtherSubr:
- FT_ERROR(( "t1_decoder_parse_charstrings:"
- " invalid othersubr [%d %d]\n", arg_cnt, subr_no ));
- goto Syntax_Error;
- }
-
- top += known_othersubr_result_cnt;
-
- decoder->top = top;
- }
- else /* general operator */
- {
- FT_Int num_args = t1_args_count[op];
-
-
- FT_ASSERT( num_args >= 0 );
-
- if ( top - decoder->stack < num_args )
- goto Stack_Underflow;
-
- /* XXX Operators usually take their operands from the */
- /* bottom of the stack, i.e., the operands are */
- /* decoder->stack[0], ..., decoder->stack[num_args - 1]; */
- /* only div, callsubr, and callothersubr are different. */
- /* In practice it doesn't matter (?). */
-
-#ifdef FT_DEBUG_LEVEL_TRACE
-
- switch ( op )
- {
- case op_callsubr:
- case op_div:
- case op_callothersubr:
- case op_pop:
- case op_return:
- break;
-
- default:
- if ( top - decoder->stack != num_args )
- FT_TRACE0(( "t1_decoder_parse_charstrings:"
- " too much operands on the stack"
- " (seen %d, expected %d)\n",
- top - decoder->stack, num_args ));
- break;
- }
-
-#endif /* FT_DEBUG_LEVEL_TRACE */
-
- top -= num_args;
-
- switch ( op )
- {
- case op_endchar:
- FT_TRACE4(( " endchar\n" ));
-
- t1_builder_close_contour( builder );
-
- /* close hints recording session */
- if ( hinter )
- {
- if ( hinter->close( hinter->hints,
- (FT_UInt)builder->current->n_points ) )
- goto Syntax_Error;
-
- /* apply hints to the loaded glyph outline now */
- error = hinter->apply( hinter->hints,
- builder->current,
- (PSH_Globals)builder->hints_globals,
- decoder->hint_mode );
- if ( error )
- goto Fail;
- }
-
- /* add current outline to the glyph slot */
- FT_GlyphLoader_Add( builder->loader );
-
- /* the compiler should optimize away this empty loop but ... */
-
-#ifdef FT_DEBUG_LEVEL_TRACE
-
- if ( decoder->len_buildchar > 0 )
- {
- FT_UInt i;
-
-
- FT_TRACE4(( "BuildCharArray = [ " ));
-
- for ( i = 0; i < decoder->len_buildchar; ++i )
- FT_TRACE4(( "%d ", decoder->buildchar[i] ));
-
- FT_TRACE4(( "]\n" ));
- }
-
-#endif /* FT_DEBUG_LEVEL_TRACE */
-
- FT_TRACE4(( "\n" ));
-
- /* return now! */
- return FT_Err_Ok;
-
- case op_hsbw:
- FT_TRACE4(( " hsbw" ));
-
- builder->parse_state = T1_Parse_Have_Width;
-
- builder->left_bearing.x += top[0];
- builder->advance.x = top[1];
- builder->advance.y = 0;
-
- orig_x = x = builder->pos_x + top[0];
- orig_y = y = builder->pos_y;
-
- FT_UNUSED( orig_y );
-
- /* the `metrics_only' indicates that we only want to compute */
- /* the glyph's metrics (lsb + advance width), not load the */
- /* rest of it; so exit immediately */
- if ( builder->metrics_only )
- return FT_Err_Ok;
-
- break;
-
- case op_seac:
- return t1operator_seac( decoder,
- top[0],
- top[1],
- top[2],
- Fix2Int( top[3] ),
- Fix2Int( top[4] ) );
-
- case op_sbw:
- FT_TRACE4(( " sbw" ));
-
- builder->parse_state = T1_Parse_Have_Width;
-
- builder->left_bearing.x += top[0];
- builder->left_bearing.y += top[1];
- builder->advance.x = top[2];
- builder->advance.y = top[3];
-
- x = builder->pos_x + top[0];
- y = builder->pos_y + top[1];
-
- /* the `metrics_only' indicates that we only want to compute */
- /* the glyph's metrics (lsb + advance width), not load the */
- /* rest of it; so exit immediately */
- if ( builder->metrics_only )
- return FT_Err_Ok;
-
- break;
-
- case op_closepath:
- FT_TRACE4(( " closepath" ));
-
- /* if there is no path, `closepath' is a no-op */
- if ( builder->parse_state == T1_Parse_Have_Path ||
- builder->parse_state == T1_Parse_Have_Moveto )
- t1_builder_close_contour( builder );
-
- builder->parse_state = T1_Parse_Have_Width;
- break;
-
- case op_hlineto:
- FT_TRACE4(( " hlineto" ));
-
- if ( ( error = t1_builder_start_point( builder, x, y ) )
- != FT_Err_Ok )
- goto Fail;
-
- x += top[0];
- goto Add_Line;
-
- case op_hmoveto:
- FT_TRACE4(( " hmoveto" ));
-
- x += top[0];
- if ( !decoder->flex_state )
- {
- if ( builder->parse_state == T1_Parse_Start )
- goto Syntax_Error;
- builder->parse_state = T1_Parse_Have_Moveto;
- }
- break;
-
- case op_hvcurveto:
- FT_TRACE4(( " hvcurveto" ));
-
- if ( ( error = t1_builder_start_point( builder, x, y ) )
- != FT_Err_Ok ||
- ( error = t1_builder_check_points( builder, 3 ) )
- != FT_Err_Ok )
- goto Fail;
-
- x += top[0];
- t1_builder_add_point( builder, x, y, 0 );
- x += top[1];
- y += top[2];
- t1_builder_add_point( builder, x, y, 0 );
- y += top[3];
- t1_builder_add_point( builder, x, y, 1 );
- break;
-
- case op_rlineto:
- FT_TRACE4(( " rlineto" ));
-
- if ( ( error = t1_builder_start_point( builder, x, y ) )
- != FT_Err_Ok )
- goto Fail;
-
- x += top[0];
- y += top[1];
-
- Add_Line:
- if ( ( error = t1_builder_add_point1( builder, x, y ) )
- != FT_Err_Ok )
- goto Fail;
- break;
-
- case op_rmoveto:
- FT_TRACE4(( " rmoveto" ));
-
- x += top[0];
- y += top[1];
- if ( !decoder->flex_state )
- {
- if ( builder->parse_state == T1_Parse_Start )
- goto Syntax_Error;
- builder->parse_state = T1_Parse_Have_Moveto;
- }
- break;
-
- case op_rrcurveto:
- FT_TRACE4(( " rrcurveto" ));
-
- if ( ( error = t1_builder_start_point( builder, x, y ) )
- != FT_Err_Ok ||
- ( error = t1_builder_check_points( builder, 3 ) )
- != FT_Err_Ok )
- goto Fail;
-
- x += top[0];
- y += top[1];
- t1_builder_add_point( builder, x, y, 0 );
-
- x += top[2];
- y += top[3];
- t1_builder_add_point( builder, x, y, 0 );
-
- x += top[4];
- y += top[5];
- t1_builder_add_point( builder, x, y, 1 );
- break;
-
- case op_vhcurveto:
- FT_TRACE4(( " vhcurveto" ));
-
- if ( ( error = t1_builder_start_point( builder, x, y ) )
- != FT_Err_Ok ||
- ( error = t1_builder_check_points( builder, 3 ) )
- != FT_Err_Ok )
- goto Fail;
-
- y += top[0];
- t1_builder_add_point( builder, x, y, 0 );
- x += top[1];
- y += top[2];
- t1_builder_add_point( builder, x, y, 0 );
- x += top[3];
- t1_builder_add_point( builder, x, y, 1 );
- break;
-
- case op_vlineto:
- FT_TRACE4(( " vlineto" ));
-
- if ( ( error = t1_builder_start_point( builder, x, y ) )
- != FT_Err_Ok )
- goto Fail;
-
- y += top[0];
- goto Add_Line;
-
- case op_vmoveto:
- FT_TRACE4(( " vmoveto" ));
-
- y += top[0];
- if ( !decoder->flex_state )
- {
- if ( builder->parse_state == T1_Parse_Start )
- goto Syntax_Error;
- builder->parse_state = T1_Parse_Have_Moveto;
- }
- break;
-
- case op_div:
- FT_TRACE4(( " div" ));
-
- /* if `large_int' is set, we divide unscaled numbers; */
- /* otherwise, we divide numbers in 16.16 format -- */
- /* in both cases, it is the same operation */
- *top = FT_DivFix( top[0], top[1] );
- ++top;
-
- large_int = FALSE;
- break;
-
- case op_callsubr:
- {
- FT_Int idx;
-
-
- FT_TRACE4(( " callsubr" ));
-
- idx = Fix2Int( top[0] );
- if ( idx < 0 || idx >= decoder->num_subrs )
- {
- FT_ERROR(( "t1_decoder_parse_charstrings:"
- " invalid subrs index\n" ));
- goto Syntax_Error;
- }
-
- if ( zone - decoder->zones >= T1_MAX_SUBRS_CALLS )
- {
- FT_ERROR(( "t1_decoder_parse_charstrings:"
- " too many nested subrs\n" ));
- goto Syntax_Error;
- }
-
- zone->cursor = ip; /* save current instruction pointer */
-
- zone++;
-
- /* The Type 1 driver stores subroutines without the seed bytes. */
- /* The CID driver stores subroutines with seed bytes. This */
- /* case is taken care of when decoder->subrs_len == 0. */
- zone->base = decoder->subrs[idx];
-
- if ( decoder->subrs_len )
- zone->limit = zone->base + decoder->subrs_len[idx];
- else
- {
- /* We are using subroutines from a CID font. We must adjust */
- /* for the seed bytes. */
- zone->base += ( decoder->lenIV >= 0 ? decoder->lenIV : 0 );
- zone->limit = decoder->subrs[idx + 1];
- }
-
- zone->cursor = zone->base;
-
- if ( !zone->base )
- {
- FT_ERROR(( "t1_decoder_parse_charstrings:"
- " invoking empty subrs\n" ));
- goto Syntax_Error;
- }
-
- decoder->zone = zone;
- ip = zone->base;
- limit = zone->limit;
- break;
- }
-
- case op_pop:
- FT_TRACE4(( " pop" ));
-
- if ( known_othersubr_result_cnt > 0 )
- {
- known_othersubr_result_cnt--;
- /* ignore, we pushed the operands ourselves */
- break;
- }
-
- if ( unknown_othersubr_result_cnt == 0 )
- {
- FT_ERROR(( "t1_decoder_parse_charstrings:"
- " no more operands for othersubr\n" ));
- goto Syntax_Error;
- }
-
- unknown_othersubr_result_cnt--;
- top++; /* `push' the operand to callothersubr onto the stack */
- break;
-
- case op_return:
- FT_TRACE4(( " return" ));
-
- if ( zone <= decoder->zones )
- {
- FT_ERROR(( "t1_decoder_parse_charstrings:"
- " unexpected return\n" ));
- goto Syntax_Error;
- }
-
- zone--;
- ip = zone->cursor;
- limit = zone->limit;
- decoder->zone = zone;
- break;
-
- case op_dotsection:
- FT_TRACE4(( " dotsection" ));
-
- break;
-
- case op_hstem:
- FT_TRACE4(( " hstem" ));
-
- /* record horizontal hint */
- if ( hinter )
- {
- /* top[0] += builder->left_bearing.y; */
- hinter->stem( hinter->hints, 1, top );
- }
- break;
-
- case op_hstem3:
- FT_TRACE4(( " hstem3" ));
-
- /* record horizontal counter-controlled hints */
- if ( hinter )
- hinter->stem3( hinter->hints, 1, top );
- break;
-
- case op_vstem:
- FT_TRACE4(( " vstem" ));
-
- /* record vertical hint */
- if ( hinter )
- {
- top[0] += orig_x;
- hinter->stem( hinter->hints, 0, top );
- }
- break;
-
- case op_vstem3:
- FT_TRACE4(( " vstem3" ));
-
- /* record vertical counter-controlled hints */
- if ( hinter )
- {
- FT_Pos dx = orig_x;
-
-
- top[0] += dx;
- top[2] += dx;
- top[4] += dx;
- hinter->stem3( hinter->hints, 0, top );
- }
- break;
-
- case op_setcurrentpoint:
- FT_TRACE4(( " setcurrentpoint" ));
-
- /* From the T1 specification, section 6.4: */
- /* */
- /* The setcurrentpoint command is used only in */
- /* conjunction with results from OtherSubrs procedures. */
-
- /* known_othersubr_result_cnt != 0 is already handled */
- /* above. */
-
- /* Note, however, that both Ghostscript and Adobe */
- /* Distiller handle this situation by silently ignoring */
- /* the inappropriate `setcurrentpoint' instruction. So */
- /* we do the same. */
-#if 0
-
- if ( decoder->flex_state != 1 )
- {
- FT_ERROR(( "t1_decoder_parse_charstrings:"
- " unexpected `setcurrentpoint'\n" ));
- goto Syntax_Error;
- }
- else
- ...
-#endif
-
- x = top[0];
- y = top[1];
- decoder->flex_state = 0;
- break;
-
- case op_unknown15:
- FT_TRACE4(( " opcode_15" ));
- /* nothing to do except to pop the two arguments */
- break;
-
- default:
- FT_ERROR(( "t1_decoder_parse_charstrings:"
- " unhandled opcode %d\n", op ));
- goto Syntax_Error;
- }
-
- /* XXX Operators usually clear the operand stack; */
- /* only div, callsubr, callothersubr, pop, and */
- /* return are different. */
- /* In practice it doesn't matter (?). */
-
- decoder->top = top;
-
-#ifdef FT_DEBUG_LEVEL_TRACE
- FT_TRACE4(( "\n" ));
- bol = TRUE;
-#endif
-
- } /* general operator processing */
-
- } /* while ip < limit */
-
- FT_TRACE4(( "..end..\n\n" ));
-
- Fail:
- return error;
-
- Syntax_Error:
- return FT_THROW( Syntax_Error );
-
- Stack_Underflow:
- return FT_THROW( Stack_Underflow );
- }
-
-
- /* parse a single Type 1 glyph */
- FT_LOCAL_DEF( FT_Error )
- t1_decoder_parse_glyph( T1_Decoder decoder,
- FT_UInt glyph )
- {
- return decoder->parse_callback( decoder, glyph );
- }
-
-
- /* initialize T1 decoder */
- FT_LOCAL_DEF( FT_Error )
- t1_decoder_init( T1_Decoder decoder,
- FT_Face face,
- FT_Size size,
- FT_GlyphSlot slot,
- FT_Byte** glyph_names,
- PS_Blend blend,
- FT_Bool hinting,
- FT_Render_Mode hint_mode,
- T1_Decoder_Callback parse_callback )
- {
- FT_MEM_ZERO( decoder, sizeof ( *decoder ) );
-
- /* retrieve PSNames interface from list of current modules */
- {
- FT_Service_PsCMaps psnames;
-
-
- FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS );
- if ( !psnames )
- {
- FT_ERROR(( "t1_decoder_init:"
- " the `psnames' module is not available\n" ));
- return FT_THROW( Unimplemented_Feature );
- }
-
- decoder->psnames = psnames;
- }
-
- t1_builder_init( &decoder->builder, face, size, slot, hinting );
-
- /* decoder->buildchar and decoder->len_buildchar have to be */
- /* initialized by the caller since we cannot know the length */
- /* of the BuildCharArray */
-
- decoder->num_glyphs = (FT_UInt)face->num_glyphs;
- decoder->glyph_names = glyph_names;
- decoder->hint_mode = hint_mode;
- decoder->blend = blend;
- decoder->parse_callback = parse_callback;
-
- decoder->funcs = t1_decoder_funcs;
-
- return FT_Err_Ok;
- }
-
-
- /* finalize T1 decoder */
- FT_LOCAL_DEF( void )
- t1_decoder_done( T1_Decoder decoder )
- {
- t1_builder_done( &decoder->builder );
- }
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/psaux/t1decode.h b/chromium/third_party/pdfium/third_party/freetype/src/psaux/t1decode.h
deleted file mode 100644
index e83078f7195..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/psaux/t1decode.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/***************************************************************************/
-/* */
-/* t1decode.h */
-/* */
-/* PostScript Type 1 decoding routines (specification). */
-/* */
-/* Copyright 2000-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __T1DECODE_H__
-#define __T1DECODE_H__
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
-#include FT_INTERNAL_TYPE1_TYPES_H
-
-
-FT_BEGIN_HEADER
-
-
- FT_CALLBACK_TABLE
- const T1_Decoder_FuncsRec t1_decoder_funcs;
-
-
- FT_LOCAL( FT_Error )
- t1_decoder_parse_glyph( T1_Decoder decoder,
- FT_UInt glyph_index );
-
- FT_LOCAL( FT_Error )
- t1_decoder_parse_charstrings( T1_Decoder decoder,
- FT_Byte* base,
- FT_UInt len );
-
- FT_LOCAL( FT_Error )
- t1_decoder_init( T1_Decoder decoder,
- FT_Face face,
- FT_Size size,
- FT_GlyphSlot slot,
- FT_Byte** glyph_names,
- PS_Blend blend,
- FT_Bool hinting,
- FT_Render_Mode hint_mode,
- T1_Decoder_Callback parse_glyph );
-
- FT_LOCAL( void )
- t1_decoder_done( T1_Decoder decoder );
-
-
-FT_END_HEADER
-
-#endif /* __T1DECODE_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/pshinter/Jamfile b/chromium/third_party/pdfium/third_party/freetype/src/pshinter/Jamfile
deleted file mode 100644
index 6fb3be11c70..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/pshinter/Jamfile
+++ /dev/null
@@ -1,34 +0,0 @@
-# FreeType 2 src/pshinter Jamfile
-#
-# Copyright 2001-2015 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT. By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-SubDir FT2_TOP $(FT2_SRC_DIR) pshinter ;
-
-{
- local _sources ;
-
- if $(FT2_MULTI)
- {
- _sources = pshalgo
- pshglob
- pshmod
- pshpic
- pshrec
- ;
- }
- else
- {
- _sources = pshinter ;
- }
-
- Library $(FT2_LIB) : $(_sources).c ;
-}
-
-# end of src/pshinter Jamfile
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/pshinter/pshalgo.c b/chromium/third_party/pdfium/third_party/freetype/src/pshinter/pshalgo.c
deleted file mode 100644
index 6e654cb1ef8..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/pshinter/pshalgo.c
+++ /dev/null
@@ -1,2195 +0,0 @@
-/***************************************************************************/
-/* */
-/* pshalgo.c */
-/* */
-/* PostScript hinting algorithm (body). */
-/* */
-/* Copyright 2001-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used */
-/* modified and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_CALC_H
-#include "pshalgo.h"
-
-#include "pshnterr.h"
-
-
-#undef FT_COMPONENT
-#define FT_COMPONENT trace_pshalgo2
-
-
-#ifdef DEBUG_HINTER
- PSH_Hint_Table ps_debug_hint_table = NULL;
- PSH_HintFunc ps_debug_hint_func = NULL;
- PSH_Glyph ps_debug_glyph = NULL;
-#endif
-
-
-#define COMPUTE_INFLEXS /* compute inflection points to optimize `S' */
- /* and similar glyphs */
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** BASIC HINTS RECORDINGS *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
- /* return true if two stem hints overlap */
- static FT_Int
- psh_hint_overlap( PSH_Hint hint1,
- PSH_Hint hint2 )
- {
- return hint1->org_pos + hint1->org_len >= hint2->org_pos &&
- hint2->org_pos + hint2->org_len >= hint1->org_pos;
- }
-
-
- /* destroy hints table */
- static void
- psh_hint_table_done( PSH_Hint_Table table,
- FT_Memory memory )
- {
- FT_FREE( table->zones );
- table->num_zones = 0;
- table->zone = NULL;
-
- FT_FREE( table->sort );
- FT_FREE( table->hints );
- table->num_hints = 0;
- table->max_hints = 0;
- table->sort_global = NULL;
- }
-
-
- /* deactivate all hints in a table */
- static void
- psh_hint_table_deactivate( PSH_Hint_Table table )
- {
- FT_UInt count = table->max_hints;
- PSH_Hint hint = table->hints;
-
-
- for ( ; count > 0; count--, hint++ )
- {
- psh_hint_deactivate( hint );
- hint->order = -1;
- }
- }
-
-
- /* internal function to record a new hint */
- static void
- psh_hint_table_record( PSH_Hint_Table table,
- FT_UInt idx )
- {
- PSH_Hint hint = table->hints + idx;
-
-
- if ( idx >= table->max_hints )
- {
- FT_TRACE0(( "psh_hint_table_record: invalid hint index %d\n", idx ));
- return;
- }
-
- /* ignore active hints */
- if ( psh_hint_is_active( hint ) )
- return;
-
- psh_hint_activate( hint );
-
- /* now scan the current active hint set to check */
- /* whether `hint' overlaps with another hint */
- {
- PSH_Hint* sorted = table->sort_global;
- FT_UInt count = table->num_hints;
- PSH_Hint hint2;
-
-
- hint->parent = NULL;
- for ( ; count > 0; count--, sorted++ )
- {
- hint2 = sorted[0];
-
- if ( psh_hint_overlap( hint, hint2 ) )
- {
- hint->parent = hint2;
- break;
- }
- }
- }
-
- if ( table->num_hints < table->max_hints )
- table->sort_global[table->num_hints++] = hint;
- else
- FT_TRACE0(( "psh_hint_table_record: too many sorted hints! BUG!\n" ));
- }
-
-
- static void
- psh_hint_table_record_mask( PSH_Hint_Table table,
- PS_Mask hint_mask )
- {
- FT_Int mask = 0, val = 0;
- FT_Byte* cursor = hint_mask->bytes;
- FT_UInt idx, limit;
-
-
- limit = hint_mask->num_bits;
-
- for ( idx = 0; idx < limit; idx++ )
- {
- if ( mask == 0 )
- {
- val = *cursor++;
- mask = 0x80;
- }
-
- if ( val & mask )
- psh_hint_table_record( table, idx );
-
- mask >>= 1;
- }
- }
-
-
- /* create hints table */
- static FT_Error
- psh_hint_table_init( PSH_Hint_Table table,
- PS_Hint_Table hints,
- PS_Mask_Table hint_masks,
- PS_Mask_Table counter_masks,
- FT_Memory memory )
- {
- FT_UInt count;
- FT_Error error;
-
- FT_UNUSED( counter_masks );
-
-
- count = hints->num_hints;
-
- /* allocate our tables */
- if ( FT_NEW_ARRAY( table->sort, 2 * count ) ||
- FT_NEW_ARRAY( table->hints, count ) ||
- FT_NEW_ARRAY( table->zones, 2 * count + 1 ) )
- goto Exit;
-
- table->max_hints = count;
- table->sort_global = table->sort + count;
- table->num_hints = 0;
- table->num_zones = 0;
- table->zone = NULL;
-
- /* initialize the `table->hints' array */
- {
- PSH_Hint write = table->hints;
- PS_Hint read = hints->hints;
-
-
- for ( ; count > 0; count--, write++, read++ )
- {
- write->org_pos = read->pos;
- write->org_len = read->len;
- write->flags = read->flags;
- }
- }
-
- /* we now need to determine the initial `parent' stems; first */
- /* activate the hints that are given by the initial hint masks */
- if ( hint_masks )
- {
- PS_Mask mask = hint_masks->masks;
-
-
- count = hint_masks->num_masks;
- table->hint_masks = hint_masks;
-
- for ( ; count > 0; count--, mask++ )
- psh_hint_table_record_mask( table, mask );
- }
-
- /* finally, do a linear parse in case some hints were left alone */
- if ( table->num_hints != table->max_hints )
- {
- FT_UInt idx;
-
-
- FT_TRACE0(( "psh_hint_table_init: missing/incorrect hint masks\n" ));
-
- count = table->max_hints;
- for ( idx = 0; idx < count; idx++ )
- psh_hint_table_record( table, idx );
- }
-
- Exit:
- return error;
- }
-
-
- static void
- psh_hint_table_activate_mask( PSH_Hint_Table table,
- PS_Mask hint_mask )
- {
- FT_Int mask = 0, val = 0;
- FT_Byte* cursor = hint_mask->bytes;
- FT_UInt idx, limit, count;
-
-
- limit = hint_mask->num_bits;
- count = 0;
-
- psh_hint_table_deactivate( table );
-
- for ( idx = 0; idx < limit; idx++ )
- {
- if ( mask == 0 )
- {
- val = *cursor++;
- mask = 0x80;
- }
-
- if ( val & mask )
- {
- PSH_Hint hint = &table->hints[idx];
-
-
- if ( !psh_hint_is_active( hint ) )
- {
- FT_UInt count2;
-
-#if 0
- PSH_Hint* sort = table->sort;
- PSH_Hint hint2;
-
-
- for ( count2 = count; count2 > 0; count2--, sort++ )
- {
- hint2 = sort[0];
- if ( psh_hint_overlap( hint, hint2 ) )
- FT_TRACE0(( "psh_hint_table_activate_mask:"
- " found overlapping hints\n" ))
- }
-#else
- count2 = 0;
-#endif
-
- if ( count2 == 0 )
- {
- psh_hint_activate( hint );
- if ( count < table->max_hints )
- table->sort[count++] = hint;
- else
- FT_TRACE0(( "psh_hint_tableactivate_mask:"
- " too many active hints\n" ));
- }
- }
- }
-
- mask >>= 1;
- }
- table->num_hints = count;
-
- /* now, sort the hints; they are guaranteed to not overlap */
- /* so we can compare their "org_pos" field directly */
- {
- FT_Int i1, i2;
- PSH_Hint hint1, hint2;
- PSH_Hint* sort = table->sort;
-
-
- /* a simple bubble sort will do, since in 99% of cases, the hints */
- /* will be already sorted -- and the sort will be linear */
- for ( i1 = 1; i1 < (FT_Int)count; i1++ )
- {
- hint1 = sort[i1];
- for ( i2 = i1 - 1; i2 >= 0; i2-- )
- {
- hint2 = sort[i2];
-
- if ( hint2->org_pos < hint1->org_pos )
- break;
-
- sort[i2 + 1] = hint2;
- sort[i2] = hint1;
- }
- }
- }
- }
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** HINTS GRID-FITTING AND OPTIMIZATION *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
-#if 1
- static FT_Pos
- psh_dimension_quantize_len( PSH_Dimension dim,
- FT_Pos len,
- FT_Bool do_snapping )
- {
- if ( len <= 64 )
- len = 64;
- else
- {
- FT_Pos delta = len - dim->stdw.widths[0].cur;
-
-
- if ( delta < 0 )
- delta = -delta;
-
- if ( delta < 40 )
- {
- len = dim->stdw.widths[0].cur;
- if ( len < 48 )
- len = 48;
- }
-
- if ( len < 3 * 64 )
- {
- delta = ( len & 63 );
- len &= -64;
-
- if ( delta < 10 )
- len += delta;
-
- else if ( delta < 32 )
- len += 10;
-
- else if ( delta < 54 )
- len += 54;
-
- else
- len += delta;
- }
- else
- len = FT_PIX_ROUND( len );
- }
-
- if ( do_snapping )
- len = FT_PIX_ROUND( len );
-
- return len;
- }
-#endif /* 0 */
-
-
-#ifdef DEBUG_HINTER
-
- static void
- ps_simple_scale( PSH_Hint_Table table,
- FT_Fixed scale,
- FT_Fixed delta,
- FT_Int dimension )
- {
- FT_UInt count;
-
-
- for ( count = 0; count < table->max_hints; count++ )
- {
- PSH_Hint hint = table->hints + count;
-
-
- hint->cur_pos = FT_MulFix( hint->org_pos, scale ) + delta;
- hint->cur_len = FT_MulFix( hint->org_len, scale );
-
- if ( ps_debug_hint_func )
- ps_debug_hint_func( hint, dimension );
- }
- }
-
-#endif /* DEBUG_HINTER */
-
-
- static FT_Fixed
- psh_hint_snap_stem_side_delta( FT_Fixed pos,
- FT_Fixed len )
- {
- FT_Fixed delta1 = FT_PIX_ROUND( pos ) - pos;
- FT_Fixed delta2 = FT_PIX_ROUND( pos + len ) - pos - len;
-
-
- if ( FT_ABS( delta1 ) <= FT_ABS( delta2 ) )
- return delta1;
- else
- return delta2;
- }
-
-
- static void
- psh_hint_align( PSH_Hint hint,
- PSH_Globals globals,
- FT_Int dimension,
- PSH_Glyph glyph )
- {
- PSH_Dimension dim = &globals->dimension[dimension];
- FT_Fixed scale = dim->scale_mult;
- FT_Fixed delta = dim->scale_delta;
-
-
- if ( !psh_hint_is_fitted( hint ) )
- {
- FT_Pos pos = FT_MulFix( hint->org_pos, scale ) + delta;
- FT_Pos len = FT_MulFix( hint->org_len, scale );
-
- FT_Int do_snapping;
- FT_Pos fit_len;
- PSH_AlignmentRec align;
-
-
- /* ignore stem alignments when requested through the hint flags */
- if ( ( dimension == 0 && !glyph->do_horz_hints ) ||
- ( dimension == 1 && !glyph->do_vert_hints ) )
- {
- hint->cur_pos = pos;
- hint->cur_len = len;
-
- psh_hint_set_fitted( hint );
- return;
- }
-
- /* perform stem snapping when requested - this is necessary
- * for monochrome and LCD hinting modes only
- */
- do_snapping = ( dimension == 0 && glyph->do_horz_snapping ) ||
- ( dimension == 1 && glyph->do_vert_snapping );
-
- hint->cur_len = fit_len = len;
-
- /* check blue zones for horizontal stems */
- align.align = PSH_BLUE_ALIGN_NONE;
- align.align_bot = align.align_top = 0;
-
- if ( dimension == 1 )
- psh_blues_snap_stem( &globals->blues,
- hint->org_pos + hint->org_len,
- hint->org_pos,
- &align );
-
- switch ( align.align )
- {
- case PSH_BLUE_ALIGN_TOP:
- /* the top of the stem is aligned against a blue zone */
- hint->cur_pos = align.align_top - fit_len;
- break;
-
- case PSH_BLUE_ALIGN_BOT:
- /* the bottom of the stem is aligned against a blue zone */
- hint->cur_pos = align.align_bot;
- break;
-
- case PSH_BLUE_ALIGN_TOP | PSH_BLUE_ALIGN_BOT:
- /* both edges of the stem are aligned against blue zones */
- hint->cur_pos = align.align_bot;
- hint->cur_len = align.align_top - align.align_bot;
- break;
-
- default:
- {
- PSH_Hint parent = hint->parent;
-
-
- if ( parent )
- {
- FT_Pos par_org_center, par_cur_center;
- FT_Pos cur_org_center, cur_delta;
-
-
- /* ensure that parent is already fitted */
- if ( !psh_hint_is_fitted( parent ) )
- psh_hint_align( parent, globals, dimension, glyph );
-
- /* keep original relation between hints, this is, use the */
- /* scaled distance between the centers of the hints to */
- /* compute the new position */
- par_org_center = parent->org_pos + ( parent->org_len >> 1 );
- par_cur_center = parent->cur_pos + ( parent->cur_len >> 1 );
- cur_org_center = hint->org_pos + ( hint->org_len >> 1 );
-
- cur_delta = FT_MulFix( cur_org_center - par_org_center, scale );
- pos = par_cur_center + cur_delta - ( len >> 1 );
- }
-
- hint->cur_pos = pos;
- hint->cur_len = fit_len;
-
- /* Stem adjustment tries to snap stem widths to standard
- * ones. This is important to prevent unpleasant rounding
- * artefacts.
- */
- if ( glyph->do_stem_adjust )
- {
- if ( len <= 64 )
- {
- /* the stem is less than one pixel; we will center it
- * around the nearest pixel center
- */
- if ( len >= 32 )
- {
- /* This is a special case where we also widen the stem
- * and align it to the pixel grid.
- *
- * stem_center = pos + (len/2)
- * nearest_pixel_center = FT_ROUND(stem_center-32)+32
- * new_pos = nearest_pixel_center-32
- * = FT_ROUND(stem_center-32)
- * = FT_FLOOR(stem_center-32+32)
- * = FT_FLOOR(stem_center)
- * new_len = 64
- */
- pos = FT_PIX_FLOOR( pos + ( len >> 1 ) );
- len = 64;
- }
- else if ( len > 0 )
- {
- /* This is a very small stem; we simply align it to the
- * pixel grid, trying to find the minimum displacement.
- *
- * left = pos
- * right = pos + len
- * left_nearest_edge = ROUND(pos)
- * right_nearest_edge = ROUND(right)
- *
- * if ( ABS(left_nearest_edge - left) <=
- * ABS(right_nearest_edge - right) )
- * new_pos = left
- * else
- * new_pos = right
- */
- FT_Pos left_nearest = FT_PIX_ROUND( pos );
- FT_Pos right_nearest = FT_PIX_ROUND( pos + len );
- FT_Pos left_disp = left_nearest - pos;
- FT_Pos right_disp = right_nearest - ( pos + len );
-
-
- if ( left_disp < 0 )
- left_disp = -left_disp;
- if ( right_disp < 0 )
- right_disp = -right_disp;
- if ( left_disp <= right_disp )
- pos = left_nearest;
- else
- pos = right_nearest;
- }
- else
- {
- /* this is a ghost stem; we simply round it */
- pos = FT_PIX_ROUND( pos );
- }
- }
- else
- {
- len = psh_dimension_quantize_len( dim, len, 0 );
- }
- }
-
- /* now that we have a good hinted stem width, try to position */
- /* the stem along a pixel grid integer coordinate */
- hint->cur_pos = pos + psh_hint_snap_stem_side_delta( pos, len );
- hint->cur_len = len;
- }
- }
-
- if ( do_snapping )
- {
- pos = hint->cur_pos;
- len = hint->cur_len;
-
- if ( len < 64 )
- len = 64;
- else
- len = FT_PIX_ROUND( len );
-
- switch ( align.align )
- {
- case PSH_BLUE_ALIGN_TOP:
- hint->cur_pos = align.align_top - len;
- hint->cur_len = len;
- break;
-
- case PSH_BLUE_ALIGN_BOT:
- hint->cur_len = len;
- break;
-
- case PSH_BLUE_ALIGN_BOT | PSH_BLUE_ALIGN_TOP:
- /* don't touch */
- break;
-
-
- default:
- hint->cur_len = len;
- if ( len & 64 )
- pos = FT_PIX_FLOOR( pos + ( len >> 1 ) ) + 32;
- else
- pos = FT_PIX_ROUND( pos + ( len >> 1 ) );
-
- hint->cur_pos = pos - ( len >> 1 );
- hint->cur_len = len;
- }
- }
-
- psh_hint_set_fitted( hint );
-
-#ifdef DEBUG_HINTER
- if ( ps_debug_hint_func )
- ps_debug_hint_func( hint, dimension );
-#endif
- }
- }
-
-
-#if 0 /* not used for now, experimental */
-
- /*
- * A variant to perform "light" hinting (i.e. FT_RENDER_MODE_LIGHT)
- * of stems
- */
- static void
- psh_hint_align_light( PSH_Hint hint,
- PSH_Globals globals,
- FT_Int dimension,
- PSH_Glyph glyph )
- {
- PSH_Dimension dim = &globals->dimension[dimension];
- FT_Fixed scale = dim->scale_mult;
- FT_Fixed delta = dim->scale_delta;
-
-
- if ( !psh_hint_is_fitted( hint ) )
- {
- FT_Pos pos = FT_MulFix( hint->org_pos, scale ) + delta;
- FT_Pos len = FT_MulFix( hint->org_len, scale );
-
- FT_Pos fit_len;
-
- PSH_AlignmentRec align;
-
-
- /* ignore stem alignments when requested through the hint flags */
- if ( ( dimension == 0 && !glyph->do_horz_hints ) ||
- ( dimension == 1 && !glyph->do_vert_hints ) )
- {
- hint->cur_pos = pos;
- hint->cur_len = len;
-
- psh_hint_set_fitted( hint );
- return;
- }
-
- fit_len = len;
-
- hint->cur_len = fit_len;
-
- /* check blue zones for horizontal stems */
- align.align = PSH_BLUE_ALIGN_NONE;
- align.align_bot = align.align_top = 0;
-
- if ( dimension == 1 )
- psh_blues_snap_stem( &globals->blues,
- hint->org_pos + hint->org_len,
- hint->org_pos,
- &align );
-
- switch ( align.align )
- {
- case PSH_BLUE_ALIGN_TOP:
- /* the top of the stem is aligned against a blue zone */
- hint->cur_pos = align.align_top - fit_len;
- break;
-
- case PSH_BLUE_ALIGN_BOT:
- /* the bottom of the stem is aligned against a blue zone */
- hint->cur_pos = align.align_bot;
- break;
-
- case PSH_BLUE_ALIGN_TOP | PSH_BLUE_ALIGN_BOT:
- /* both edges of the stem are aligned against blue zones */
- hint->cur_pos = align.align_bot;
- hint->cur_len = align.align_top - align.align_bot;
- break;
-
- default:
- {
- PSH_Hint parent = hint->parent;
-
-
- if ( parent )
- {
- FT_Pos par_org_center, par_cur_center;
- FT_Pos cur_org_center, cur_delta;
-
-
- /* ensure that parent is already fitted */
- if ( !psh_hint_is_fitted( parent ) )
- psh_hint_align_light( parent, globals, dimension, glyph );
-
- par_org_center = parent->org_pos + ( parent->org_len / 2 );
- par_cur_center = parent->cur_pos + ( parent->cur_len / 2 );
- cur_org_center = hint->org_pos + ( hint->org_len / 2 );
-
- cur_delta = FT_MulFix( cur_org_center - par_org_center, scale );
- pos = par_cur_center + cur_delta - ( len >> 1 );
- }
-
- /* Stems less than one pixel wide are easy -- we want to
- * make them as dark as possible, so they must fall within
- * one pixel. If the stem is split between two pixels
- * then snap the edge that is nearer to the pixel boundary
- * to the pixel boundary.
- */
- if ( len <= 64 )
- {
- if ( ( pos + len + 63 ) / 64 != pos / 64 + 1 )
- pos += psh_hint_snap_stem_side_delta ( pos, len );
- }
-
- /* Position stems other to minimize the amount of mid-grays.
- * There are, in general, two positions that do this,
- * illustrated as A) and B) below.
- *
- * + + + +
- *
- * A) |--------------------------------|
- * B) |--------------------------------|
- * C) |--------------------------------|
- *
- * Position A) (split the excess stem equally) should be better
- * for stems of width N + f where f < 0.5.
- *
- * Position B) (split the deficiency equally) should be better
- * for stems of width N + f where f > 0.5.
- *
- * It turns out though that minimizing the total number of lit
- * pixels is also important, so position C), with one edge
- * aligned with a pixel boundary is actually preferable
- * to A). There are also more possibile positions for C) than
- * for A) or B), so it involves less distortion of the overall
- * character shape.
- */
- else /* len > 64 */
- {
- FT_Fixed frac_len = len & 63;
- FT_Fixed center = pos + ( len >> 1 );
- FT_Fixed delta_a, delta_b;
-
-
- if ( ( len / 64 ) & 1 )
- {
- delta_a = FT_PIX_FLOOR( center ) + 32 - center;
- delta_b = FT_PIX_ROUND( center ) - center;
- }
- else
- {
- delta_a = FT_PIX_ROUND( center ) - center;
- delta_b = FT_PIX_FLOOR( center ) + 32 - center;
- }
-
- /* We choose between B) and C) above based on the amount
- * of fractinal stem width; for small amounts, choose
- * C) always, for large amounts, B) always, and inbetween,
- * pick whichever one involves less stem movement.
- */
- if ( frac_len < 32 )
- {
- pos += psh_hint_snap_stem_side_delta ( pos, len );
- }
- else if ( frac_len < 48 )
- {
- FT_Fixed side_delta = psh_hint_snap_stem_side_delta ( pos,
- len );
-
- if ( FT_ABS( side_delta ) < FT_ABS( delta_b ) )
- pos += side_delta;
- else
- pos += delta_b;
- }
- else
- {
- pos += delta_b;
- }
- }
-
- hint->cur_pos = pos;
- }
- } /* switch */
-
- psh_hint_set_fitted( hint );
-
-#ifdef DEBUG_HINTER
- if ( ps_debug_hint_func )
- ps_debug_hint_func( hint, dimension );
-#endif
- }
- }
-
-#endif /* 0 */
-
-
- static void
- psh_hint_table_align_hints( PSH_Hint_Table table,
- PSH_Globals globals,
- FT_Int dimension,
- PSH_Glyph glyph )
- {
- PSH_Hint hint;
- FT_UInt count;
-
-#ifdef DEBUG_HINTER
-
- PSH_Dimension dim = &globals->dimension[dimension];
- FT_Fixed scale = dim->scale_mult;
- FT_Fixed delta = dim->scale_delta;
-
-
- if ( ps_debug_no_vert_hints && dimension == 0 )
- {
- ps_simple_scale( table, scale, delta, dimension );
- return;
- }
-
- if ( ps_debug_no_horz_hints && dimension == 1 )
- {
- ps_simple_scale( table, scale, delta, dimension );
- return;
- }
-
-#endif /* DEBUG_HINTER*/
-
- hint = table->hints;
- count = table->max_hints;
-
- for ( ; count > 0; count--, hint++ )
- psh_hint_align( hint, globals, dimension, glyph );
- }
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** POINTS INTERPOLATION ROUTINES *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
-#define xxDEBUG_ZONES
-
-
-#ifdef DEBUG_ZONES
-
-#include FT_CONFIG_STANDARD_LIBRARY_H
-
- static void
- psh_print_zone( PSH_Zone zone )
- {
- printf( "zone [scale,delta,min,max] = [%.3f,%.3f,%d,%d]\n",
- zone->scale / 65536.0,
- zone->delta / 64.0,
- zone->min,
- zone->max );
- }
-
-#endif /* DEBUG_ZONES */
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** HINTER GLYPH MANAGEMENT *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
-#define psh_corner_is_flat ft_corner_is_flat
-#define psh_corner_orientation ft_corner_orientation
-
-
-#ifdef COMPUTE_INFLEXS
-
- /* compute all inflex points in a given glyph */
- static void
- psh_glyph_compute_inflections( PSH_Glyph glyph )
- {
- FT_UInt n;
-
-
- for ( n = 0; n < glyph->num_contours; n++ )
- {
- PSH_Point first, start, end, before, after;
- FT_Pos in_x, in_y, out_x, out_y;
- FT_Int orient_prev, orient_cur;
- FT_Int finished = 0;
-
-
- /* we need at least 4 points to create an inflection point */
- if ( glyph->contours[n].count < 4 )
- continue;
-
- /* compute first segment in contour */
- first = glyph->contours[n].start;
-
- start = end = first;
- do
- {
- end = end->next;
- if ( end == first )
- goto Skip;
-
- in_x = end->org_u - start->org_u;
- in_y = end->org_v - start->org_v;
-
- } while ( in_x == 0 && in_y == 0 );
-
- /* extend the segment start whenever possible */
- before = start;
- do
- {
- do
- {
- start = before;
- before = before->prev;
- if ( before == first )
- goto Skip;
-
- out_x = start->org_u - before->org_u;
- out_y = start->org_v - before->org_v;
-
- } while ( out_x == 0 && out_y == 0 );
-
- orient_prev = psh_corner_orientation( in_x, in_y, out_x, out_y );
-
- } while ( orient_prev == 0 );
-
- first = start;
- in_x = out_x;
- in_y = out_y;
-
- /* now, process all segments in the contour */
- do
- {
- /* first, extend current segment's end whenever possible */
- after = end;
- do
- {
- do
- {
- end = after;
- after = after->next;
- if ( after == first )
- finished = 1;
-
- out_x = after->org_u - end->org_u;
- out_y = after->org_v - end->org_v;
-
- } while ( out_x == 0 && out_y == 0 );
-
- orient_cur = psh_corner_orientation( in_x, in_y, out_x, out_y );
-
- } while ( orient_cur == 0 );
-
- if ( ( orient_cur ^ orient_prev ) < 0 )
- {
- do
- {
- psh_point_set_inflex( start );
- start = start->next;
- }
- while ( start != end );
-
- psh_point_set_inflex( start );
- }
-
- start = end;
- end = after;
- orient_prev = orient_cur;
- in_x = out_x;
- in_y = out_y;
-
- } while ( !finished );
-
- Skip:
- ;
- }
- }
-
-#endif /* COMPUTE_INFLEXS */
-
-
- static void
- psh_glyph_done( PSH_Glyph glyph )
- {
- FT_Memory memory = glyph->memory;
-
-
- psh_hint_table_done( &glyph->hint_tables[1], memory );
- psh_hint_table_done( &glyph->hint_tables[0], memory );
-
- FT_FREE( glyph->points );
- FT_FREE( glyph->contours );
-
- glyph->num_points = 0;
- glyph->num_contours = 0;
-
- glyph->memory = NULL;
- }
-
-
- static int
- psh_compute_dir( FT_Pos dx,
- FT_Pos dy )
- {
- FT_Pos ax, ay;
- int result = PSH_DIR_NONE;
-
-
- ax = FT_ABS( dx );
- ay = FT_ABS( dy );
-
- if ( ay * 12 < ax )
- {
- /* |dy| <<< |dx| means a near-horizontal segment */
- result = ( dx >= 0 ) ? PSH_DIR_RIGHT : PSH_DIR_LEFT;
- }
- else if ( ax * 12 < ay )
- {
- /* |dx| <<< |dy| means a near-vertical segment */
- result = ( dy >= 0 ) ? PSH_DIR_UP : PSH_DIR_DOWN;
- }
-
- return result;
- }
-
-
- /* load outline point coordinates into hinter glyph */
- static void
- psh_glyph_load_points( PSH_Glyph glyph,
- FT_Int dimension )
- {
- FT_Vector* vec = glyph->outline->points;
- PSH_Point point = glyph->points;
- FT_UInt count = glyph->num_points;
-
-
- for ( ; count > 0; count--, point++, vec++ )
- {
- point->flags2 = 0;
- point->hint = NULL;
- if ( dimension == 0 )
- {
- point->org_u = vec->x;
- point->org_v = vec->y;
- }
- else
- {
- point->org_u = vec->y;
- point->org_v = vec->x;
- }
-
-#ifdef DEBUG_HINTER
- point->org_x = vec->x;
- point->org_y = vec->y;
-#endif
-
- }
- }
-
-
- /* save hinted point coordinates back to outline */
- static void
- psh_glyph_save_points( PSH_Glyph glyph,
- FT_Int dimension )
- {
- FT_UInt n;
- PSH_Point point = glyph->points;
- FT_Vector* vec = glyph->outline->points;
- char* tags = glyph->outline->tags;
-
-
- for ( n = 0; n < glyph->num_points; n++ )
- {
- if ( dimension == 0 )
- vec[n].x = point->cur_u;
- else
- vec[n].y = point->cur_u;
-
- if ( psh_point_is_strong( point ) )
- tags[n] |= (char)( ( dimension == 0 ) ? 32 : 64 );
-
-#ifdef DEBUG_HINTER
-
- if ( dimension == 0 )
- {
- point->cur_x = point->cur_u;
- point->flags_x = point->flags2 | point->flags;
- }
- else
- {
- point->cur_y = point->cur_u;
- point->flags_y = point->flags2 | point->flags;
- }
-
-#endif
-
- point++;
- }
- }
-
-
- static FT_Error
- psh_glyph_init( PSH_Glyph glyph,
- FT_Outline* outline,
- PS_Hints ps_hints,
- PSH_Globals globals )
- {
- FT_Error error;
- FT_Memory memory;
-
-
- /* clear all fields */
- FT_MEM_ZERO( glyph, sizeof ( *glyph ) );
-
- memory = glyph->memory = globals->memory;
-
- /* allocate and setup points + contours arrays */
- if ( FT_NEW_ARRAY( glyph->points, outline->n_points ) ||
- FT_NEW_ARRAY( glyph->contours, outline->n_contours ) )
- goto Exit;
-
- glyph->num_points = (FT_UInt)outline->n_points;
- glyph->num_contours = (FT_UInt)outline->n_contours;
-
- {
- FT_UInt first = 0, next, n;
- PSH_Point points = glyph->points;
- PSH_Contour contour = glyph->contours;
-
-
- for ( n = 0; n < glyph->num_contours; n++ )
- {
- FT_UInt count;
- PSH_Point point;
-
-
- next = (FT_UInt)outline->contours[n] + 1;
- count = next - first;
-
- contour->start = points + first;
- contour->count = count;
-
- if ( count > 0 )
- {
- point = points + first;
-
- point->prev = points + next - 1;
- point->contour = contour;
-
- for ( ; count > 1; count-- )
- {
- point[0].next = point + 1;
- point[1].prev = point;
- point++;
- point->contour = contour;
- }
- point->next = points + first;
- }
-
- contour++;
- first = next;
- }
- }
-
- {
- PSH_Point points = glyph->points;
- PSH_Point point = points;
- FT_Vector* vec = outline->points;
- FT_UInt n;
-
-
- for ( n = 0; n < glyph->num_points; n++, point++ )
- {
- FT_Int n_prev = (FT_Int)( point->prev - points );
- FT_Int n_next = (FT_Int)( point->next - points );
- FT_Pos dxi, dyi, dxo, dyo;
-
-
- if ( !( outline->tags[n] & FT_CURVE_TAG_ON ) )
- point->flags = PSH_POINT_OFF;
-
- dxi = vec[n].x - vec[n_prev].x;
- dyi = vec[n].y - vec[n_prev].y;
-
- point->dir_in = (FT_Char)psh_compute_dir( dxi, dyi );
-
- dxo = vec[n_next].x - vec[n].x;
- dyo = vec[n_next].y - vec[n].y;
-
- point->dir_out = (FT_Char)psh_compute_dir( dxo, dyo );
-
- /* detect smooth points */
- if ( point->flags & PSH_POINT_OFF )
- point->flags |= PSH_POINT_SMOOTH;
-
- else if ( point->dir_in == point->dir_out )
- {
- if ( point->dir_out != PSH_DIR_NONE ||
- psh_corner_is_flat( dxi, dyi, dxo, dyo ) )
- point->flags |= PSH_POINT_SMOOTH;
- }
- }
- }
-
- glyph->outline = outline;
- glyph->globals = globals;
-
-#ifdef COMPUTE_INFLEXS
- psh_glyph_load_points( glyph, 0 );
- psh_glyph_compute_inflections( glyph );
-#endif /* COMPUTE_INFLEXS */
-
- /* now deal with hints tables */
- error = psh_hint_table_init( &glyph->hint_tables [0],
- &ps_hints->dimension[0].hints,
- &ps_hints->dimension[0].masks,
- &ps_hints->dimension[0].counters,
- memory );
- if ( error )
- goto Exit;
-
- error = psh_hint_table_init( &glyph->hint_tables [1],
- &ps_hints->dimension[1].hints,
- &ps_hints->dimension[1].masks,
- &ps_hints->dimension[1].counters,
- memory );
- if ( error )
- goto Exit;
-
- Exit:
- return error;
- }
-
-
- /* compute all extrema in a glyph for a given dimension */
- static void
- psh_glyph_compute_extrema( PSH_Glyph glyph )
- {
- FT_UInt n;
-
-
- /* first of all, compute all local extrema */
- for ( n = 0; n < glyph->num_contours; n++ )
- {
- PSH_Point first = glyph->contours[n].start;
- PSH_Point point, before, after;
-
-
- if ( glyph->contours[n].count == 0 )
- continue;
-
- point = first;
- before = point;
-
- do
- {
- before = before->prev;
- if ( before == first )
- goto Skip;
-
- } while ( before->org_u == point->org_u );
-
- first = point = before->next;
-
- for (;;)
- {
- after = point;
- do
- {
- after = after->next;
- if ( after == first )
- goto Next;
-
- } while ( after->org_u == point->org_u );
-
- if ( before->org_u < point->org_u )
- {
- if ( after->org_u < point->org_u )
- {
- /* local maximum */
- goto Extremum;
- }
- }
- else /* before->org_u > point->org_u */
- {
- if ( after->org_u > point->org_u )
- {
- /* local minimum */
- Extremum:
- do
- {
- psh_point_set_extremum( point );
- point = point->next;
-
- } while ( point != after );
- }
- }
-
- before = after->prev;
- point = after;
-
- } /* for */
-
- Next:
- ;
- }
-
- /* for each extremum, determine its direction along the */
- /* orthogonal axis */
- for ( n = 0; n < glyph->num_points; n++ )
- {
- PSH_Point point, before, after;
-
-
- point = &glyph->points[n];
- before = point;
- after = point;
-
- if ( psh_point_is_extremum( point ) )
- {
- do
- {
- before = before->prev;
- if ( before == point )
- goto Skip;
-
- } while ( before->org_v == point->org_v );
-
- do
- {
- after = after->next;
- if ( after == point )
- goto Skip;
-
- } while ( after->org_v == point->org_v );
- }
-
- if ( before->org_v < point->org_v &&
- after->org_v > point->org_v )
- {
- psh_point_set_positive( point );
- }
- else if ( before->org_v > point->org_v &&
- after->org_v < point->org_v )
- {
- psh_point_set_negative( point );
- }
-
- Skip:
- ;
- }
- }
-
-
- /* major_dir is the direction for points on the bottom/left of the stem; */
- /* Points on the top/right of the stem will have a direction of */
- /* -major_dir. */
-
- static void
- psh_hint_table_find_strong_points( PSH_Hint_Table table,
- PSH_Point point,
- FT_UInt count,
- FT_Int threshold,
- FT_Int major_dir )
- {
- PSH_Hint* sort = table->sort;
- FT_UInt num_hints = table->num_hints;
-
-
- for ( ; count > 0; count--, point++ )
- {
- FT_Int point_dir = 0;
- FT_Pos org_u = point->org_u;
-
-
- if ( psh_point_is_strong( point ) )
- continue;
-
- if ( PSH_DIR_COMPARE( point->dir_in, major_dir ) )
- point_dir = point->dir_in;
-
- else if ( PSH_DIR_COMPARE( point->dir_out, major_dir ) )
- point_dir = point->dir_out;
-
- if ( point_dir )
- {
- if ( point_dir == major_dir )
- {
- FT_UInt nn;
-
-
- for ( nn = 0; nn < num_hints; nn++ )
- {
- PSH_Hint hint = sort[nn];
- FT_Pos d = org_u - hint->org_pos;
-
-
- if ( d < threshold && -d < threshold )
- {
- psh_point_set_strong( point );
- point->flags2 |= PSH_POINT_EDGE_MIN;
- point->hint = hint;
- break;
- }
- }
- }
- else if ( point_dir == -major_dir )
- {
- FT_UInt nn;
-
-
- for ( nn = 0; nn < num_hints; nn++ )
- {
- PSH_Hint hint = sort[nn];
- FT_Pos d = org_u - hint->org_pos - hint->org_len;
-
-
- if ( d < threshold && -d < threshold )
- {
- psh_point_set_strong( point );
- point->flags2 |= PSH_POINT_EDGE_MAX;
- point->hint = hint;
- break;
- }
- }
- }
- }
-
-#if 1
- else if ( psh_point_is_extremum( point ) )
- {
- /* treat extrema as special cases for stem edge alignment */
- FT_UInt nn, min_flag, max_flag;
-
-
- if ( major_dir == PSH_DIR_HORIZONTAL )
- {
- min_flag = PSH_POINT_POSITIVE;
- max_flag = PSH_POINT_NEGATIVE;
- }
- else
- {
- min_flag = PSH_POINT_NEGATIVE;
- max_flag = PSH_POINT_POSITIVE;
- }
-
- if ( point->flags2 & min_flag )
- {
- for ( nn = 0; nn < num_hints; nn++ )
- {
- PSH_Hint hint = sort[nn];
- FT_Pos d = org_u - hint->org_pos;
-
-
- if ( d < threshold && -d < threshold )
- {
- point->flags2 |= PSH_POINT_EDGE_MIN;
- point->hint = hint;
- psh_point_set_strong( point );
- break;
- }
- }
- }
- else if ( point->flags2 & max_flag )
- {
- for ( nn = 0; nn < num_hints; nn++ )
- {
- PSH_Hint hint = sort[nn];
- FT_Pos d = org_u - hint->org_pos - hint->org_len;
-
-
- if ( d < threshold && -d < threshold )
- {
- point->flags2 |= PSH_POINT_EDGE_MAX;
- point->hint = hint;
- psh_point_set_strong( point );
- break;
- }
- }
- }
-
- if ( point->hint == NULL )
- {
- for ( nn = 0; nn < num_hints; nn++ )
- {
- PSH_Hint hint = sort[nn];
-
-
- if ( org_u >= hint->org_pos &&
- org_u <= hint->org_pos + hint->org_len )
- {
- point->hint = hint;
- break;
- }
- }
- }
- }
-
-#endif /* 1 */
- }
- }
-
-
- /* the accepted shift for strong points in fractional pixels */
-#define PSH_STRONG_THRESHOLD 32
-
- /* the maximum shift value in font units */
-#define PSH_STRONG_THRESHOLD_MAXIMUM 30
-
-
- /* find strong points in a glyph */
- static void
- psh_glyph_find_strong_points( PSH_Glyph glyph,
- FT_Int dimension )
- {
- /* a point is `strong' if it is located on a stem edge and */
- /* has an `in' or `out' tangent parallel to the hint's direction */
-
- PSH_Hint_Table table = &glyph->hint_tables[dimension];
- PS_Mask mask = table->hint_masks->masks;
- FT_UInt num_masks = table->hint_masks->num_masks;
- FT_UInt first = 0;
- FT_Int major_dir = dimension == 0 ? PSH_DIR_VERTICAL
- : PSH_DIR_HORIZONTAL;
- PSH_Dimension dim = &glyph->globals->dimension[dimension];
- FT_Fixed scale = dim->scale_mult;
- FT_Int threshold;
-
-
- threshold = (FT_Int)FT_DivFix( PSH_STRONG_THRESHOLD, scale );
- if ( threshold > PSH_STRONG_THRESHOLD_MAXIMUM )
- threshold = PSH_STRONG_THRESHOLD_MAXIMUM;
-
- /* process secondary hints to `selected' points */
- if ( num_masks > 1 && glyph->num_points > 0 )
- {
- /* the `endchar' op can reduce the number of points */
- first = mask->end_point > glyph->num_points
- ? glyph->num_points
- : mask->end_point;
- mask++;
- for ( ; num_masks > 1; num_masks--, mask++ )
- {
- FT_UInt next = FT_MIN( mask->end_point, glyph->num_points );
-
-
- if ( next > first )
- {
- FT_UInt count = next - first;
- PSH_Point point = glyph->points + first;
-
-
- psh_hint_table_activate_mask( table, mask );
-
- psh_hint_table_find_strong_points( table, point, count,
- threshold, major_dir );
- }
- first = next;
- }
- }
-
- /* process primary hints for all points */
- if ( num_masks == 1 )
- {
- FT_UInt count = glyph->num_points;
- PSH_Point point = glyph->points;
-
-
- psh_hint_table_activate_mask( table, table->hint_masks->masks );
-
- psh_hint_table_find_strong_points( table, point, count,
- threshold, major_dir );
- }
-
- /* now, certain points may have been attached to a hint and */
- /* not marked as strong; update their flags then */
- {
- FT_UInt count = glyph->num_points;
- PSH_Point point = glyph->points;
-
-
- for ( ; count > 0; count--, point++ )
- if ( point->hint && !psh_point_is_strong( point ) )
- psh_point_set_strong( point );
- }
- }
-
-
- /* find points in a glyph which are in a blue zone and have `in' or */
- /* `out' tangents parallel to the horizontal axis */
- static void
- psh_glyph_find_blue_points( PSH_Blues blues,
- PSH_Glyph glyph )
- {
- PSH_Blue_Table table;
- PSH_Blue_Zone zone;
- FT_UInt glyph_count = glyph->num_points;
- FT_UInt blue_count;
- PSH_Point point = glyph->points;
-
-
- for ( ; glyph_count > 0; glyph_count--, point++ )
- {
- FT_Pos y;
-
-
- /* check tangents */
- if ( !PSH_DIR_COMPARE( point->dir_in, PSH_DIR_HORIZONTAL ) &&
- !PSH_DIR_COMPARE( point->dir_out, PSH_DIR_HORIZONTAL ) )
- continue;
-
- /* skip strong points */
- if ( psh_point_is_strong( point ) )
- continue;
-
- y = point->org_u;
-
- /* look up top zones */
- table = &blues->normal_top;
- blue_count = table->count;
- zone = table->zones;
-
- for ( ; blue_count > 0; blue_count--, zone++ )
- {
- FT_Pos delta = y - zone->org_bottom;
-
-
- if ( delta < -blues->blue_fuzz )
- break;
-
- if ( y <= zone->org_top + blues->blue_fuzz )
- if ( blues->no_overshoots || delta <= blues->blue_threshold )
- {
- point->cur_u = zone->cur_bottom;
- psh_point_set_strong( point );
- psh_point_set_fitted( point );
- }
- }
-
- /* look up bottom zones */
- table = &blues->normal_bottom;
- blue_count = table->count;
- zone = table->zones + blue_count - 1;
-
- for ( ; blue_count > 0; blue_count--, zone-- )
- {
- FT_Pos delta = zone->org_top - y;
-
-
- if ( delta < -blues->blue_fuzz )
- break;
-
- if ( y >= zone->org_bottom - blues->blue_fuzz )
- if ( blues->no_overshoots || delta < blues->blue_threshold )
- {
- point->cur_u = zone->cur_top;
- psh_point_set_strong( point );
- psh_point_set_fitted( point );
- }
- }
- }
- }
-
-
- /* interpolate strong points with the help of hinted coordinates */
- static void
- psh_glyph_interpolate_strong_points( PSH_Glyph glyph,
- FT_Int dimension )
- {
- PSH_Dimension dim = &glyph->globals->dimension[dimension];
- FT_Fixed scale = dim->scale_mult;
-
- FT_UInt count = glyph->num_points;
- PSH_Point point = glyph->points;
-
-
- for ( ; count > 0; count--, point++ )
- {
- PSH_Hint hint = point->hint;
-
-
- if ( hint )
- {
- FT_Pos delta;
-
-
- if ( psh_point_is_edge_min( point ) )
- point->cur_u = hint->cur_pos;
-
- else if ( psh_point_is_edge_max( point ) )
- point->cur_u = hint->cur_pos + hint->cur_len;
-
- else
- {
- delta = point->org_u - hint->org_pos;
-
- if ( delta <= 0 )
- point->cur_u = hint->cur_pos + FT_MulFix( delta, scale );
-
- else if ( delta >= hint->org_len )
- point->cur_u = hint->cur_pos + hint->cur_len +
- FT_MulFix( delta - hint->org_len, scale );
-
- else /* hint->org_len > 0 */
- point->cur_u = hint->cur_pos +
- FT_MulDiv( delta, hint->cur_len,
- hint->org_len );
- }
- psh_point_set_fitted( point );
- }
- }
- }
-
-
-#define PSH_MAX_STRONG_INTERNAL 16
-
- static void
- psh_glyph_interpolate_normal_points( PSH_Glyph glyph,
- FT_Int dimension )
- {
-
-#if 1
- /* first technique: a point is strong if it is a local extremum */
-
- PSH_Dimension dim = &glyph->globals->dimension[dimension];
- FT_Fixed scale = dim->scale_mult;
- FT_Memory memory = glyph->memory;
-
- PSH_Point* strongs = NULL;
- PSH_Point strongs_0[PSH_MAX_STRONG_INTERNAL];
- FT_UInt num_strongs = 0;
-
- PSH_Point points = glyph->points;
- PSH_Point points_end = points + glyph->num_points;
- PSH_Point point;
-
-
- /* first count the number of strong points */
- for ( point = points; point < points_end; point++ )
- {
- if ( psh_point_is_strong( point ) )
- num_strongs++;
- }
-
- if ( num_strongs == 0 ) /* nothing to do here */
- return;
-
- /* allocate an array to store a list of points, */
- /* stored in increasing org_u order */
- if ( num_strongs <= PSH_MAX_STRONG_INTERNAL )
- strongs = strongs_0;
- else
- {
- FT_Error error;
-
-
- if ( FT_NEW_ARRAY( strongs, num_strongs ) )
- return;
- }
-
- num_strongs = 0;
- for ( point = points; point < points_end; point++ )
- {
- PSH_Point* insert;
-
-
- if ( !psh_point_is_strong( point ) )
- continue;
-
- for ( insert = strongs + num_strongs; insert > strongs; insert-- )
- {
- if ( insert[-1]->org_u <= point->org_u )
- break;
-
- insert[0] = insert[-1];
- }
- insert[0] = point;
- num_strongs++;
- }
-
- /* now try to interpolate all normal points */
- for ( point = points; point < points_end; point++ )
- {
- if ( psh_point_is_strong( point ) )
- continue;
-
- /* sometimes, some local extrema are smooth points */
- if ( psh_point_is_smooth( point ) )
- {
- if ( point->dir_in == PSH_DIR_NONE ||
- point->dir_in != point->dir_out )
- continue;
-
- if ( !psh_point_is_extremum( point ) &&
- !psh_point_is_inflex( point ) )
- continue;
-
- point->flags &= ~PSH_POINT_SMOOTH;
- }
-
- /* find best enclosing point coordinates then interpolate */
- {
- PSH_Point before, after;
- FT_UInt nn;
-
-
- for ( nn = 0; nn < num_strongs; nn++ )
- if ( strongs[nn]->org_u > point->org_u )
- break;
-
- if ( nn == 0 ) /* point before the first strong point */
- {
- after = strongs[0];
-
- point->cur_u = after->cur_u +
- FT_MulFix( point->org_u - after->org_u,
- scale );
- }
- else
- {
- before = strongs[nn - 1];
-
- for ( nn = num_strongs; nn > 0; nn-- )
- if ( strongs[nn - 1]->org_u < point->org_u )
- break;
-
- if ( nn == num_strongs ) /* point is after last strong point */
- {
- before = strongs[nn - 1];
-
- point->cur_u = before->cur_u +
- FT_MulFix( point->org_u - before->org_u,
- scale );
- }
- else
- {
- FT_Pos u;
-
-
- after = strongs[nn];
-
- /* now interpolate point between before and after */
- u = point->org_u;
-
- if ( u == before->org_u )
- point->cur_u = before->cur_u;
-
- else if ( u == after->org_u )
- point->cur_u = after->cur_u;
-
- else
- point->cur_u = before->cur_u +
- FT_MulDiv( u - before->org_u,
- after->cur_u - before->cur_u,
- after->org_u - before->org_u );
- }
- }
- psh_point_set_fitted( point );
- }
- }
-
- if ( strongs != strongs_0 )
- FT_FREE( strongs );
-
-#endif /* 1 */
-
- }
-
-
- /* interpolate other points */
- static void
- psh_glyph_interpolate_other_points( PSH_Glyph glyph,
- FT_Int dimension )
- {
- PSH_Dimension dim = &glyph->globals->dimension[dimension];
- FT_Fixed scale = dim->scale_mult;
- FT_Fixed delta = dim->scale_delta;
- PSH_Contour contour = glyph->contours;
- FT_UInt num_contours = glyph->num_contours;
-
-
- for ( ; num_contours > 0; num_contours--, contour++ )
- {
- PSH_Point start = contour->start;
- PSH_Point first, next, point;
- FT_UInt fit_count;
-
-
- /* count the number of strong points in this contour */
- next = start + contour->count;
- fit_count = 0;
- first = NULL;
-
- for ( point = start; point < next; point++ )
- if ( psh_point_is_fitted( point ) )
- {
- if ( !first )
- first = point;
-
- fit_count++;
- }
-
- /* if there are less than 2 fitted points in the contour, we */
- /* simply scale and eventually translate the contour points */
- if ( fit_count < 2 )
- {
- if ( fit_count == 1 )
- delta = first->cur_u - FT_MulFix( first->org_u, scale );
-
- for ( point = start; point < next; point++ )
- if ( point != first )
- point->cur_u = FT_MulFix( point->org_u, scale ) + delta;
-
- goto Next_Contour;
- }
-
- /* there are more than 2 strong points in this contour; we */
- /* need to interpolate weak points between them */
- start = first;
- do
- {
- /* skip consecutive fitted points */
- for (;;)
- {
- next = first->next;
- if ( next == start )
- goto Next_Contour;
-
- if ( !psh_point_is_fitted( next ) )
- break;
-
- first = next;
- }
-
- /* find next fitted point after unfitted one */
- for (;;)
- {
- next = next->next;
- if ( psh_point_is_fitted( next ) )
- break;
- }
-
- /* now interpolate between them */
- {
- FT_Pos org_a, org_ab, cur_a, cur_ab;
- FT_Pos org_c, org_ac, cur_c;
- FT_Fixed scale_ab;
-
-
- if ( first->org_u <= next->org_u )
- {
- org_a = first->org_u;
- cur_a = first->cur_u;
- org_ab = next->org_u - org_a;
- cur_ab = next->cur_u - cur_a;
- }
- else
- {
- org_a = next->org_u;
- cur_a = next->cur_u;
- org_ab = first->org_u - org_a;
- cur_ab = first->cur_u - cur_a;
- }
-
- scale_ab = 0x10000L;
- if ( org_ab > 0 )
- scale_ab = FT_DivFix( cur_ab, org_ab );
-
- point = first->next;
- do
- {
- org_c = point->org_u;
- org_ac = org_c - org_a;
-
- if ( org_ac <= 0 )
- {
- /* on the left of the interpolation zone */
- cur_c = cur_a + FT_MulFix( org_ac, scale );
- }
- else if ( org_ac >= org_ab )
- {
- /* on the right on the interpolation zone */
- cur_c = cur_a + cur_ab + FT_MulFix( org_ac - org_ab, scale );
- }
- else
- {
- /* within the interpolation zone */
- cur_c = cur_a + FT_MulFix( org_ac, scale_ab );
- }
-
- point->cur_u = cur_c;
-
- point = point->next;
-
- } while ( point != next );
- }
-
- /* keep going until all points in the contours have been processed */
- first = next;
-
- } while ( first != start );
-
- Next_Contour:
- ;
- }
- }
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** HIGH-LEVEL INTERFACE *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
- FT_Error
- ps_hints_apply( PS_Hints ps_hints,
- FT_Outline* outline,
- PSH_Globals globals,
- FT_Render_Mode hint_mode )
- {
- PSH_GlyphRec glyphrec;
- PSH_Glyph glyph = &glyphrec;
- FT_Error error;
-#ifdef DEBUG_HINTER
- FT_Memory memory;
-#endif
- FT_Int dimension;
-
-
- /* something to do? */
- if ( outline->n_points == 0 || outline->n_contours == 0 )
- return FT_Err_Ok;
-
-#ifdef DEBUG_HINTER
-
- memory = globals->memory;
-
- if ( ps_debug_glyph )
- {
- psh_glyph_done( ps_debug_glyph );
- FT_FREE( ps_debug_glyph );
- }
-
- if ( FT_NEW( glyph ) )
- return error;
-
- ps_debug_glyph = glyph;
-
-#endif /* DEBUG_HINTER */
-
- error = psh_glyph_init( glyph, outline, ps_hints, globals );
- if ( error )
- goto Exit;
-
- /* try to optimize the y_scale so that the top of non-capital letters
- * is aligned on a pixel boundary whenever possible
- */
- {
- PSH_Dimension dim_x = &glyph->globals->dimension[0];
- PSH_Dimension dim_y = &glyph->globals->dimension[1];
-
- FT_Fixed x_scale = dim_x->scale_mult;
- FT_Fixed y_scale = dim_y->scale_mult;
-
- FT_Fixed old_x_scale = x_scale;
- FT_Fixed old_y_scale = y_scale;
-
- FT_Fixed scaled;
- FT_Fixed fitted;
-
- FT_Bool rescale = FALSE;
-
-
- scaled = FT_MulFix( globals->blues.normal_top.zones->org_ref, y_scale );
- fitted = FT_PIX_ROUND( scaled );
-
- if ( fitted != 0 && scaled != fitted )
- {
- rescale = TRUE;
-
- y_scale = FT_MulDiv( y_scale, fitted, scaled );
-
- if ( fitted < scaled )
- x_scale -= x_scale / 50;
-
- psh_globals_set_scale( glyph->globals, x_scale, y_scale, 0, 0 );
- }
-
- glyph->do_horz_hints = 1;
- glyph->do_vert_hints = 1;
-
- glyph->do_horz_snapping = FT_BOOL( hint_mode == FT_RENDER_MODE_MONO ||
- hint_mode == FT_RENDER_MODE_LCD );
-
- glyph->do_vert_snapping = FT_BOOL( hint_mode == FT_RENDER_MODE_MONO ||
- hint_mode == FT_RENDER_MODE_LCD_V );
-
- glyph->do_stem_adjust = FT_BOOL( hint_mode != FT_RENDER_MODE_LIGHT );
-
- for ( dimension = 0; dimension < 2; dimension++ )
- {
- /* load outline coordinates into glyph */
- psh_glyph_load_points( glyph, dimension );
-
- /* compute local extrema */
- psh_glyph_compute_extrema( glyph );
-
- /* compute aligned stem/hints positions */
- psh_hint_table_align_hints( &glyph->hint_tables[dimension],
- glyph->globals,
- dimension,
- glyph );
-
- /* find strong points, align them, then interpolate others */
- psh_glyph_find_strong_points( glyph, dimension );
- if ( dimension == 1 )
- psh_glyph_find_blue_points( &globals->blues, glyph );
- psh_glyph_interpolate_strong_points( glyph, dimension );
- psh_glyph_interpolate_normal_points( glyph, dimension );
- psh_glyph_interpolate_other_points( glyph, dimension );
-
- /* save hinted coordinates back to outline */
- psh_glyph_save_points( glyph, dimension );
-
- if ( rescale )
- psh_globals_set_scale( glyph->globals,
- old_x_scale, old_y_scale, 0, 0 );
- }
- }
-
- Exit:
-
-#ifndef DEBUG_HINTER
- psh_glyph_done( glyph );
-#endif
-
- return error;
- }
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/pshinter/pshalgo.h b/chromium/third_party/pdfium/third_party/freetype/src/pshinter/pshalgo.h
deleted file mode 100644
index 8373e5ec29e..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/pshinter/pshalgo.h
+++ /dev/null
@@ -1,241 +0,0 @@
-/***************************************************************************/
-/* */
-/* pshalgo.h */
-/* */
-/* PostScript hinting algorithm (specification). */
-/* */
-/* Copyright 2001-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __PSHALGO_H__
-#define __PSHALGO_H__
-
-
-#include "pshrec.h"
-#include "pshglob.h"
-
-
-FT_BEGIN_HEADER
-
-
- /* handle to Hint structure */
- typedef struct PSH_HintRec_* PSH_Hint;
-
-
- /* hint bit-flags */
-#define PSH_HINT_GHOST PS_HINT_FLAG_GHOST
-#define PSH_HINT_BOTTOM PS_HINT_FLAG_BOTTOM
-#define PSH_HINT_ACTIVE 4U
-#define PSH_HINT_FITTED 8U
-
-
-#define psh_hint_is_active( x ) ( ( (x)->flags & PSH_HINT_ACTIVE ) != 0 )
-#define psh_hint_is_ghost( x ) ( ( (x)->flags & PSH_HINT_GHOST ) != 0 )
-#define psh_hint_is_fitted( x ) ( ( (x)->flags & PSH_HINT_FITTED ) != 0 )
-
-#define psh_hint_activate( x ) (x)->flags |= PSH_HINT_ACTIVE
-#define psh_hint_deactivate( x ) (x)->flags &= ~PSH_HINT_ACTIVE
-#define psh_hint_set_fitted( x ) (x)->flags |= PSH_HINT_FITTED
-
-
- /* hint structure */
- typedef struct PSH_HintRec_
- {
- FT_Int org_pos;
- FT_Int org_len;
- FT_Pos cur_pos;
- FT_Pos cur_len;
- FT_UInt flags;
- PSH_Hint parent;
- FT_Int order;
-
- } PSH_HintRec;
-
-
- /* this is an interpolation zone used for strong points; */
- /* weak points are interpolated according to their strong */
- /* neighbours */
- typedef struct PSH_ZoneRec_
- {
- FT_Fixed scale;
- FT_Fixed delta;
- FT_Pos min;
- FT_Pos max;
-
- } PSH_ZoneRec, *PSH_Zone;
-
-
- typedef struct PSH_Hint_TableRec_
- {
- FT_UInt max_hints;
- FT_UInt num_hints;
- PSH_Hint hints;
- PSH_Hint* sort;
- PSH_Hint* sort_global;
- FT_UInt num_zones;
- PSH_ZoneRec* zones;
- PSH_Zone zone;
- PS_Mask_Table hint_masks;
- PS_Mask_Table counter_masks;
-
- } PSH_Hint_TableRec, *PSH_Hint_Table;
-
-
- typedef struct PSH_PointRec_* PSH_Point;
- typedef struct PSH_ContourRec_* PSH_Contour;
-
- enum
- {
- PSH_DIR_NONE = 4,
- PSH_DIR_UP = -1,
- PSH_DIR_DOWN = 1,
- PSH_DIR_LEFT = -2,
- PSH_DIR_RIGHT = 2
- };
-
-#define PSH_DIR_HORIZONTAL 2
-#define PSH_DIR_VERTICAL 1
-
-#define PSH_DIR_COMPARE( d1, d2 ) ( (d1) == (d2) || (d1) == -(d2) )
-#define PSH_DIR_IS_HORIZONTAL( d ) PSH_DIR_COMPARE( d, PSH_DIR_HORIZONTAL )
-#define PSH_DIR_IS_VERTICAL( d ) PSH_DIR_COMPARE( d, PSH_DIR_VERTICAL )
-
-
- /* the following bit-flags are computed once by the glyph */
- /* analyzer, for both dimensions */
-#define PSH_POINT_OFF 1U /* point is off the curve */
-#define PSH_POINT_SMOOTH 2U /* point is smooth */
-#define PSH_POINT_INFLEX 4U /* point is inflection */
-
-
-#define psh_point_is_smooth( p ) ( (p)->flags & PSH_POINT_SMOOTH )
-#define psh_point_is_off( p ) ( (p)->flags & PSH_POINT_OFF )
-#define psh_point_is_inflex( p ) ( (p)->flags & PSH_POINT_INFLEX )
-
-#define psh_point_set_smooth( p ) (p)->flags |= PSH_POINT_SMOOTH
-#define psh_point_set_off( p ) (p)->flags |= PSH_POINT_OFF
-#define psh_point_set_inflex( p ) (p)->flags |= PSH_POINT_INFLEX
-
-
- /* the following bit-flags are re-computed for each dimension */
-#define PSH_POINT_STRONG 16U /* point is strong */
-#define PSH_POINT_FITTED 32U /* point is already fitted */
-#define PSH_POINT_EXTREMUM 64U /* point is local extremum */
-#define PSH_POINT_POSITIVE 128U /* extremum has positive contour flow */
-#define PSH_POINT_NEGATIVE 256U /* extremum has negative contour flow */
-#define PSH_POINT_EDGE_MIN 512U /* point is aligned to left/bottom stem edge */
-#define PSH_POINT_EDGE_MAX 1024U /* point is aligned to top/right stem edge */
-
-
-#define psh_point_is_strong( p ) ( (p)->flags2 & PSH_POINT_STRONG )
-#define psh_point_is_fitted( p ) ( (p)->flags2 & PSH_POINT_FITTED )
-#define psh_point_is_extremum( p ) ( (p)->flags2 & PSH_POINT_EXTREMUM )
-#define psh_point_is_positive( p ) ( (p)->flags2 & PSH_POINT_POSITIVE )
-#define psh_point_is_negative( p ) ( (p)->flags2 & PSH_POINT_NEGATIVE )
-#define psh_point_is_edge_min( p ) ( (p)->flags2 & PSH_POINT_EDGE_MIN )
-#define psh_point_is_edge_max( p ) ( (p)->flags2 & PSH_POINT_EDGE_MAX )
-
-#define psh_point_set_strong( p ) (p)->flags2 |= PSH_POINT_STRONG
-#define psh_point_set_fitted( p ) (p)->flags2 |= PSH_POINT_FITTED
-#define psh_point_set_extremum( p ) (p)->flags2 |= PSH_POINT_EXTREMUM
-#define psh_point_set_positive( p ) (p)->flags2 |= PSH_POINT_POSITIVE
-#define psh_point_set_negative( p ) (p)->flags2 |= PSH_POINT_NEGATIVE
-#define psh_point_set_edge_min( p ) (p)->flags2 |= PSH_POINT_EDGE_MIN
-#define psh_point_set_edge_max( p ) (p)->flags2 |= PSH_POINT_EDGE_MAX
-
-
- typedef struct PSH_PointRec_
- {
- PSH_Point prev;
- PSH_Point next;
- PSH_Contour contour;
- FT_UInt flags;
- FT_UInt flags2;
- FT_Char dir_in;
- FT_Char dir_out;
- PSH_Hint hint;
- FT_Pos org_u;
- FT_Pos org_v;
- FT_Pos cur_u;
-#ifdef DEBUG_HINTER
- FT_Pos org_x;
- FT_Pos cur_x;
- FT_Pos org_y;
- FT_Pos cur_y;
- FT_UInt flags_x;
- FT_UInt flags_y;
-#endif
-
- } PSH_PointRec;
-
-
- typedef struct PSH_ContourRec_
- {
- PSH_Point start;
- FT_UInt count;
-
- } PSH_ContourRec;
-
-
- typedef struct PSH_GlyphRec_
- {
- FT_UInt num_points;
- FT_UInt num_contours;
-
- PSH_Point points;
- PSH_Contour contours;
-
- FT_Memory memory;
- FT_Outline* outline;
- PSH_Globals globals;
- PSH_Hint_TableRec hint_tables[2];
-
- FT_Bool vertical;
- FT_Int major_dir;
- FT_Int minor_dir;
-
- FT_Bool do_horz_hints;
- FT_Bool do_vert_hints;
- FT_Bool do_horz_snapping;
- FT_Bool do_vert_snapping;
- FT_Bool do_stem_adjust;
-
- } PSH_GlyphRec, *PSH_Glyph;
-
-
-#ifdef DEBUG_HINTER
- extern PSH_Hint_Table ps_debug_hint_table;
-
- typedef void
- (*PSH_HintFunc)( PSH_Hint hint,
- FT_Bool vertical );
-
- extern PSH_HintFunc ps_debug_hint_func;
-
- extern PSH_Glyph ps_debug_glyph;
-#endif
-
-
- extern FT_Error
- ps_hints_apply( PS_Hints ps_hints,
- FT_Outline* outline,
- PSH_Globals globals,
- FT_Render_Mode hint_mode );
-
-
-FT_END_HEADER
-
-
-#endif /* __PSHALGO_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/pshinter/pshglob.c b/chromium/third_party/pdfium/third_party/freetype/src/pshinter/pshglob.c
deleted file mode 100644
index 4616bdc6cf3..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/pshinter/pshglob.c
+++ /dev/null
@@ -1,795 +0,0 @@
-/***************************************************************************/
-/* */
-/* pshglob.c */
-/* */
-/* PostScript hinter global hinting management (body). */
-/* Inspired by the new auto-hinter module. */
-/* */
-/* Copyright 2001-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used */
-/* modified and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_INTERNAL_OBJECTS_H
-#include "pshglob.h"
-
-#ifdef DEBUG_HINTER
- PSH_Globals ps_debug_globals = NULL;
-#endif
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** STANDARD WIDTHS *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
-
- /* scale the widths/heights table */
- static void
- psh_globals_scale_widths( PSH_Globals globals,
- FT_UInt direction )
- {
- PSH_Dimension dim = &globals->dimension[direction];
- PSH_Widths stdw = &dim->stdw;
- FT_UInt count = stdw->count;
- PSH_Width width = stdw->widths;
- PSH_Width stand = width; /* standard width/height */
- FT_Fixed scale = dim->scale_mult;
-
-
- if ( count > 0 )
- {
- width->cur = FT_MulFix( width->org, scale );
- width->fit = FT_PIX_ROUND( width->cur );
-
- width++;
- count--;
-
- for ( ; count > 0; count--, width++ )
- {
- FT_Pos w, dist;
-
-
- w = FT_MulFix( width->org, scale );
- dist = w - stand->cur;
-
- if ( dist < 0 )
- dist = -dist;
-
- if ( dist < 128 )
- w = stand->cur;
-
- width->cur = w;
- width->fit = FT_PIX_ROUND( w );
- }
- }
- }
-
-
-#if 0
-
- /* org_width is is font units, result in device pixels, 26.6 format */
- FT_LOCAL_DEF( FT_Pos )
- psh_dimension_snap_width( PSH_Dimension dimension,
- FT_Int org_width )
- {
- FT_UInt n;
- FT_Pos width = FT_MulFix( org_width, dimension->scale_mult );
- FT_Pos best = 64 + 32 + 2;
- FT_Pos reference = width;
-
-
- for ( n = 0; n < dimension->stdw.count; n++ )
- {
- FT_Pos w;
- FT_Pos dist;
-
-
- w = dimension->stdw.widths[n].cur;
- dist = width - w;
- if ( dist < 0 )
- dist = -dist;
- if ( dist < best )
- {
- best = dist;
- reference = w;
- }
- }
-
- if ( width >= reference )
- {
- width -= 0x21;
- if ( width < reference )
- width = reference;
- }
- else
- {
- width += 0x21;
- if ( width > reference )
- width = reference;
- }
-
- return width;
- }
-
-#endif /* 0 */
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** BLUE ZONES *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
- static void
- psh_blues_set_zones_0( PSH_Blues target,
- FT_Bool is_others,
- FT_UInt read_count,
- FT_Short* read,
- PSH_Blue_Table top_table,
- PSH_Blue_Table bot_table )
- {
- FT_UInt count_top = top_table->count;
- FT_UInt count_bot = bot_table->count;
- FT_Bool first = 1;
-
- FT_UNUSED( target );
-
-
- for ( ; read_count > 1; read_count -= 2 )
- {
- FT_Int reference, delta;
- FT_UInt count;
- PSH_Blue_Zone zones, zone;
- FT_Bool top;
-
-
- /* read blue zone entry, and select target top/bottom zone */
- top = 0;
- if ( first || is_others )
- {
- reference = read[1];
- delta = read[0] - reference;
-
- zones = bot_table->zones;
- count = count_bot;
- first = 0;
- }
- else
- {
- reference = read[0];
- delta = read[1] - reference;
-
- zones = top_table->zones;
- count = count_top;
- top = 1;
- }
-
- /* insert into sorted table */
- zone = zones;
- for ( ; count > 0; count--, zone++ )
- {
- if ( reference < zone->org_ref )
- break;
-
- if ( reference == zone->org_ref )
- {
- FT_Int delta0 = zone->org_delta;
-
-
- /* we have two zones on the same reference position -- */
- /* only keep the largest one */
- if ( delta < 0 )
- {
- if ( delta < delta0 )
- zone->org_delta = delta;
- }
- else
- {
- if ( delta > delta0 )
- zone->org_delta = delta;
- }
- goto Skip;
- }
- }
-
- for ( ; count > 0; count-- )
- zone[count] = zone[count-1];
-
- zone->org_ref = reference;
- zone->org_delta = delta;
-
- if ( top )
- count_top++;
- else
- count_bot++;
-
- Skip:
- read += 2;
- }
-
- top_table->count = count_top;
- bot_table->count = count_bot;
- }
-
-
- /* Re-read blue zones from the original fonts and store them into out */
- /* private structure. This function re-orders, sanitizes and */
- /* fuzz-expands the zones as well. */
- static void
- psh_blues_set_zones( PSH_Blues target,
- FT_UInt count,
- FT_Short* blues,
- FT_UInt count_others,
- FT_Short* other_blues,
- FT_Int fuzz,
- FT_Int family )
- {
- PSH_Blue_Table top_table, bot_table;
- FT_UInt count_top, count_bot;
-
-
- if ( family )
- {
- top_table = &target->family_top;
- bot_table = &target->family_bottom;
- }
- else
- {
- top_table = &target->normal_top;
- bot_table = &target->normal_bottom;
- }
-
- /* read the input blue zones, and build two sorted tables */
- /* (one for the top zones, the other for the bottom zones) */
- top_table->count = 0;
- bot_table->count = 0;
-
- /* first, the blues */
- psh_blues_set_zones_0( target, 0,
- count, blues, top_table, bot_table );
- psh_blues_set_zones_0( target, 1,
- count_others, other_blues, top_table, bot_table );
-
- count_top = top_table->count;
- count_bot = bot_table->count;
-
- /* sanitize top table */
- if ( count_top > 0 )
- {
- PSH_Blue_Zone zone = top_table->zones;
-
-
- for ( count = count_top; count > 0; count--, zone++ )
- {
- FT_Int delta;
-
-
- if ( count > 1 )
- {
- delta = zone[1].org_ref - zone[0].org_ref;
- if ( zone->org_delta > delta )
- zone->org_delta = delta;
- }
-
- zone->org_bottom = zone->org_ref;
- zone->org_top = zone->org_delta + zone->org_ref;
- }
- }
-
- /* sanitize bottom table */
- if ( count_bot > 0 )
- {
- PSH_Blue_Zone zone = bot_table->zones;
-
-
- for ( count = count_bot; count > 0; count--, zone++ )
- {
- FT_Int delta;
-
-
- if ( count > 1 )
- {
- delta = zone[0].org_ref - zone[1].org_ref;
- if ( zone->org_delta < delta )
- zone->org_delta = delta;
- }
-
- zone->org_top = zone->org_ref;
- zone->org_bottom = zone->org_delta + zone->org_ref;
- }
- }
-
- /* expand top and bottom tables with blue fuzz */
- {
- FT_Int dim, top, bot, delta;
- PSH_Blue_Zone zone;
-
-
- zone = top_table->zones;
- count = count_top;
-
- for ( dim = 1; dim >= 0; dim-- )
- {
- if ( count > 0 )
- {
- /* expand the bottom of the lowest zone normally */
- zone->org_bottom -= fuzz;
-
- /* expand the top and bottom of intermediate zones; */
- /* checking that the interval is smaller than the fuzz */
- top = zone->org_top;
-
- for ( count--; count > 0; count-- )
- {
- bot = zone[1].org_bottom;
- delta = bot - top;
-
- if ( delta / 2 < fuzz )
- zone[0].org_top = zone[1].org_bottom = top + delta / 2;
- else
- {
- zone[0].org_top = top + fuzz;
- zone[1].org_bottom = bot - fuzz;
- }
-
- zone++;
- top = zone->org_top;
- }
-
- /* expand the top of the highest zone normally */
- zone->org_top = top + fuzz;
- }
- zone = bot_table->zones;
- count = count_bot;
- }
- }
- }
-
-
- /* reset the blues table when the device transform changes */
- static void
- psh_blues_scale_zones( PSH_Blues blues,
- FT_Fixed scale,
- FT_Pos delta )
- {
- FT_UInt count;
- FT_UInt num;
- PSH_Blue_Table table = NULL;
-
- /* */
- /* Determine whether we need to suppress overshoots or */
- /* not. We simply need to compare the vertical scale */
- /* parameter to the raw bluescale value. Here is why: */
- /* */
- /* We need to suppress overshoots for all pointsizes. */
- /* At 300dpi that satisfies: */
- /* */
- /* pointsize < 240*bluescale + 0.49 */
- /* */
- /* This corresponds to: */
- /* */
- /* pixelsize < 1000*bluescale + 49/24 */
- /* */
- /* scale*EM_Size < 1000*bluescale + 49/24 */
- /* */
- /* However, for normal Type 1 fonts, EM_Size is 1000! */
- /* We thus only check: */
- /* */
- /* scale < bluescale + 49/24000 */
- /* */
- /* which we shorten to */
- /* */
- /* "scale < bluescale" */
- /* */
- /* Note that `blue_scale' is stored 1000 times its real */
- /* value, and that `scale' converts from font units to */
- /* fractional pixels. */
- /* */
-
- /* 1000 / 64 = 125 / 8 */
- if ( scale >= 0x20C49BAL )
- blues->no_overshoots = FT_BOOL( scale < blues->blue_scale * 8 / 125 );
- else
- blues->no_overshoots = FT_BOOL( scale * 125 < blues->blue_scale * 8 );
-
- /* */
- /* The blue threshold is the font units distance under */
- /* which overshoots are suppressed due to the BlueShift */
- /* even if the scale is greater than BlueScale. */
- /* */
- /* It is the smallest distance such that */
- /* */
- /* dist <= BlueShift && dist*scale <= 0.5 pixels */
- /* */
- {
- FT_Int threshold = blues->blue_shift;
-
-
- while ( threshold > 0 && FT_MulFix( threshold, scale ) > 32 )
- threshold--;
-
- blues->blue_threshold = threshold;
- }
-
- for ( num = 0; num < 4; num++ )
- {
- PSH_Blue_Zone zone;
-
-
- switch ( num )
- {
- case 0:
- table = &blues->normal_top;
- break;
- case 1:
- table = &blues->normal_bottom;
- break;
- case 2:
- table = &blues->family_top;
- break;
- default:
- table = &blues->family_bottom;
- break;
- }
-
- zone = table->zones;
- count = table->count;
- for ( ; count > 0; count--, zone++ )
- {
- zone->cur_top = FT_MulFix( zone->org_top, scale ) + delta;
- zone->cur_bottom = FT_MulFix( zone->org_bottom, scale ) + delta;
- zone->cur_ref = FT_MulFix( zone->org_ref, scale ) + delta;
- zone->cur_delta = FT_MulFix( zone->org_delta, scale );
-
- /* round scaled reference position */
- zone->cur_ref = FT_PIX_ROUND( zone->cur_ref );
-
-#if 0
- if ( zone->cur_ref > zone->cur_top )
- zone->cur_ref -= 64;
- else if ( zone->cur_ref < zone->cur_bottom )
- zone->cur_ref += 64;
-#endif
- }
- }
-
- /* process the families now */
-
- for ( num = 0; num < 2; num++ )
- {
- PSH_Blue_Zone zone1, zone2;
- FT_UInt count1, count2;
- PSH_Blue_Table normal, family;
-
-
- switch ( num )
- {
- case 0:
- normal = &blues->normal_top;
- family = &blues->family_top;
- break;
-
- default:
- normal = &blues->normal_bottom;
- family = &blues->family_bottom;
- }
-
- zone1 = normal->zones;
- count1 = normal->count;
-
- for ( ; count1 > 0; count1--, zone1++ )
- {
- /* try to find a family zone whose reference position is less */
- /* than 1 pixel far from the current zone */
- zone2 = family->zones;
- count2 = family->count;
-
- for ( ; count2 > 0; count2--, zone2++ )
- {
- FT_Pos Delta;
-
-
- Delta = zone1->org_ref - zone2->org_ref;
- if ( Delta < 0 )
- Delta = -Delta;
-
- if ( FT_MulFix( Delta, scale ) < 64 )
- {
- zone1->cur_top = zone2->cur_top;
- zone1->cur_bottom = zone2->cur_bottom;
- zone1->cur_ref = zone2->cur_ref;
- zone1->cur_delta = zone2->cur_delta;
- break;
- }
- }
- }
- }
- }
-
-
- /* calculate the maximum height of given blue zones */
- static FT_Short
- psh_calc_max_height( FT_UInt num,
- const FT_Short* values,
- FT_Short cur_max )
- {
- FT_UInt count;
-
-
- for ( count = 0; count < num; count += 2 )
- {
- FT_Short cur_height = values[count + 1] - values[count];
-
-
- if ( cur_height > cur_max )
- cur_max = cur_height;
- }
-
- return cur_max;
- }
-
-
- FT_LOCAL_DEF( void )
- psh_blues_snap_stem( PSH_Blues blues,
- FT_Int stem_top,
- FT_Int stem_bot,
- PSH_Alignment alignment )
- {
- PSH_Blue_Table table;
- FT_UInt count;
- FT_Pos delta;
- PSH_Blue_Zone zone;
- FT_Int no_shoots;
-
-
- alignment->align = PSH_BLUE_ALIGN_NONE;
-
- no_shoots = blues->no_overshoots;
-
- /* look up stem top in top zones table */
- table = &blues->normal_top;
- count = table->count;
- zone = table->zones;
-
- for ( ; count > 0; count--, zone++ )
- {
- delta = stem_top - zone->org_bottom;
- if ( delta < -blues->blue_fuzz )
- break;
-
- if ( stem_top <= zone->org_top + blues->blue_fuzz )
- {
- if ( no_shoots || delta <= blues->blue_threshold )
- {
- alignment->align |= PSH_BLUE_ALIGN_TOP;
- alignment->align_top = zone->cur_ref;
- }
- break;
- }
- }
-
- /* look up stem bottom in bottom zones table */
- table = &blues->normal_bottom;
- count = table->count;
- zone = table->zones + count-1;
-
- for ( ; count > 0; count--, zone-- )
- {
- delta = zone->org_top - stem_bot;
- if ( delta < -blues->blue_fuzz )
- break;
-
- if ( stem_bot >= zone->org_bottom - blues->blue_fuzz )
- {
- if ( no_shoots || delta < blues->blue_threshold )
- {
- alignment->align |= PSH_BLUE_ALIGN_BOT;
- alignment->align_bot = zone->cur_ref;
- }
- break;
- }
- }
- }
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** GLOBAL HINTS *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
- static void
- psh_globals_destroy( PSH_Globals globals )
- {
- if ( globals )
- {
- FT_Memory memory;
-
-
- memory = globals->memory;
- globals->dimension[0].stdw.count = 0;
- globals->dimension[1].stdw.count = 0;
-
- globals->blues.normal_top.count = 0;
- globals->blues.normal_bottom.count = 0;
- globals->blues.family_top.count = 0;
- globals->blues.family_bottom.count = 0;
-
- FT_FREE( globals );
-
-#ifdef DEBUG_HINTER
- ps_debug_globals = NULL;
-#endif
- }
- }
-
-
- static FT_Error
- psh_globals_new( FT_Memory memory,
- T1_Private* priv,
- PSH_Globals *aglobals )
- {
- PSH_Globals globals = NULL;
- FT_Error error;
-
-
- if ( !FT_NEW( globals ) )
- {
- FT_UInt count;
- FT_Short* read;
-
-
- globals->memory = memory;
-
- /* copy standard widths */
- {
- PSH_Dimension dim = &globals->dimension[1];
- PSH_Width write = dim->stdw.widths;
-
-
- write->org = priv->standard_width[0];
- write++;
-
- read = priv->snap_widths;
- for ( count = priv->num_snap_widths; count > 0; count-- )
- {
- write->org = *read;
- write++;
- read++;
- }
-
- dim->stdw.count = priv->num_snap_widths + 1;
- }
-
- /* copy standard heights */
- {
- PSH_Dimension dim = &globals->dimension[0];
- PSH_Width write = dim->stdw.widths;
-
-
- write->org = priv->standard_height[0];
- write++;
- read = priv->snap_heights;
- for ( count = priv->num_snap_heights; count > 0; count-- )
- {
- write->org = *read;
- write++;
- read++;
- }
-
- dim->stdw.count = priv->num_snap_heights + 1;
- }
-
- /* copy blue zones */
- psh_blues_set_zones( &globals->blues, priv->num_blue_values,
- priv->blue_values, priv->num_other_blues,
- priv->other_blues, priv->blue_fuzz, 0 );
-
- psh_blues_set_zones( &globals->blues, priv->num_family_blues,
- priv->family_blues, priv->num_family_other_blues,
- priv->family_other_blues, priv->blue_fuzz, 1 );
-
- /* limit the BlueScale value to `1 / max_of_blue_zone_heights' */
- {
- FT_Fixed max_scale;
- FT_Short max_height = 1;
-
-
- max_height = psh_calc_max_height( priv->num_blue_values,
- priv->blue_values,
- max_height );
- max_height = psh_calc_max_height( priv->num_other_blues,
- priv->other_blues,
- max_height );
- max_height = psh_calc_max_height( priv->num_family_blues,
- priv->family_blues,
- max_height );
- max_height = psh_calc_max_height( priv->num_family_other_blues,
- priv->family_other_blues,
- max_height );
-
- /* BlueScale is scaled 1000 times */
- max_scale = FT_DivFix( 1000, max_height );
- globals->blues.blue_scale = priv->blue_scale < max_scale
- ? priv->blue_scale
- : max_scale;
- }
-
- globals->blues.blue_shift = priv->blue_shift;
- globals->blues.blue_fuzz = priv->blue_fuzz;
-
- globals->dimension[0].scale_mult = 0;
- globals->dimension[0].scale_delta = 0;
- globals->dimension[1].scale_mult = 0;
- globals->dimension[1].scale_delta = 0;
-
-#ifdef DEBUG_HINTER
- ps_debug_globals = globals;
-#endif
- }
-
- *aglobals = globals;
- return error;
- }
-
-
- FT_LOCAL_DEF( void )
- psh_globals_set_scale( PSH_Globals globals,
- FT_Fixed x_scale,
- FT_Fixed y_scale,
- FT_Fixed x_delta,
- FT_Fixed y_delta )
- {
- PSH_Dimension dim;
-
-
- dim = &globals->dimension[0];
- if ( x_scale != dim->scale_mult ||
- x_delta != dim->scale_delta )
- {
- dim->scale_mult = x_scale;
- dim->scale_delta = x_delta;
-
- psh_globals_scale_widths( globals, 0 );
- }
-
- dim = &globals->dimension[1];
- if ( y_scale != dim->scale_mult ||
- y_delta != dim->scale_delta )
- {
- dim->scale_mult = y_scale;
- dim->scale_delta = y_delta;
-
- psh_globals_scale_widths( globals, 1 );
- psh_blues_scale_zones( &globals->blues, y_scale, y_delta );
- }
- }
-
-
- FT_LOCAL_DEF( void )
- psh_globals_funcs_init( PSH_Globals_FuncsRec* funcs )
- {
- funcs->create = psh_globals_new;
- funcs->set_scale = psh_globals_set_scale;
- funcs->destroy = psh_globals_destroy;
- }
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/pshinter/pshglob.h b/chromium/third_party/pdfium/third_party/freetype/src/pshinter/pshglob.h
deleted file mode 100644
index c376df7b9fc..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/pshinter/pshglob.h
+++ /dev/null
@@ -1,196 +0,0 @@
-/***************************************************************************/
-/* */
-/* pshglob.h */
-/* */
-/* PostScript hinter global hinting management. */
-/* */
-/* Copyright 2001-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __PSHGLOB_H__
-#define __PSHGLOB_H__
-
-
-#include FT_FREETYPE_H
-#include FT_INTERNAL_POSTSCRIPT_HINTS_H
-
-
-FT_BEGIN_HEADER
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** GLOBAL HINTS INTERNALS *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* @constant: */
- /* PS_GLOBALS_MAX_BLUE_ZONES */
- /* */
- /* @description: */
- /* The maximum number of blue zones in a font global hints structure. */
- /* See @PS_Globals_BluesRec. */
- /* */
-#define PS_GLOBALS_MAX_BLUE_ZONES 16
-
-
- /*************************************************************************/
- /* */
- /* @constant: */
- /* PS_GLOBALS_MAX_STD_WIDTHS */
- /* */
- /* @description: */
- /* The maximum number of standard and snap widths in either the */
- /* horizontal or vertical direction. See @PS_Globals_WidthsRec. */
- /* */
-#define PS_GLOBALS_MAX_STD_WIDTHS 16
-
-
- /* standard and snap width */
- typedef struct PSH_WidthRec_
- {
- FT_Int org;
- FT_Pos cur;
- FT_Pos fit;
-
- } PSH_WidthRec, *PSH_Width;
-
-
- /* standard and snap widths table */
- typedef struct PSH_WidthsRec_
- {
- FT_UInt count;
- PSH_WidthRec widths[PS_GLOBALS_MAX_STD_WIDTHS];
-
- } PSH_WidthsRec, *PSH_Widths;
-
-
- typedef struct PSH_DimensionRec_
- {
- PSH_WidthsRec stdw;
- FT_Fixed scale_mult;
- FT_Fixed scale_delta;
-
- } PSH_DimensionRec, *PSH_Dimension;
-
-
- /* blue zone descriptor */
- typedef struct PSH_Blue_ZoneRec_
- {
- FT_Int org_ref;
- FT_Int org_delta;
- FT_Int org_top;
- FT_Int org_bottom;
-
- FT_Pos cur_ref;
- FT_Pos cur_delta;
- FT_Pos cur_bottom;
- FT_Pos cur_top;
-
- } PSH_Blue_ZoneRec, *PSH_Blue_Zone;
-
-
- typedef struct PSH_Blue_TableRec_
- {
- FT_UInt count;
- PSH_Blue_ZoneRec zones[PS_GLOBALS_MAX_BLUE_ZONES];
-
- } PSH_Blue_TableRec, *PSH_Blue_Table;
-
-
- /* blue zones table */
- typedef struct PSH_BluesRec_
- {
- PSH_Blue_TableRec normal_top;
- PSH_Blue_TableRec normal_bottom;
- PSH_Blue_TableRec family_top;
- PSH_Blue_TableRec family_bottom;
-
- FT_Fixed blue_scale;
- FT_Int blue_shift;
- FT_Int blue_threshold;
- FT_Int blue_fuzz;
- FT_Bool no_overshoots;
-
- } PSH_BluesRec, *PSH_Blues;
-
-
- /* font globals. */
- /* dimension 0 => X coordinates + vertical hints/stems */
- /* dimension 1 => Y coordinates + horizontal hints/stems */
- typedef struct PSH_GlobalsRec_
- {
- FT_Memory memory;
- PSH_DimensionRec dimension[2];
- PSH_BluesRec blues;
-
- } PSH_GlobalsRec;
-
-
-#define PSH_BLUE_ALIGN_NONE 0
-#define PSH_BLUE_ALIGN_TOP 1
-#define PSH_BLUE_ALIGN_BOT 2
-
-
- typedef struct PSH_AlignmentRec_
- {
- int align;
- FT_Pos align_top;
- FT_Pos align_bot;
-
- } PSH_AlignmentRec, *PSH_Alignment;
-
-
- FT_LOCAL( void )
- psh_globals_funcs_init( PSH_Globals_FuncsRec* funcs );
-
-
-#if 0
- /* snap a stem width to fitter coordinates. `org_width' is in font */
- /* units. The result is in device pixels (26.6 format). */
- FT_LOCAL( FT_Pos )
- psh_dimension_snap_width( PSH_Dimension dimension,
- FT_Int org_width );
-#endif
-
- FT_LOCAL( void )
- psh_globals_set_scale( PSH_Globals globals,
- FT_Fixed x_scale,
- FT_Fixed y_scale,
- FT_Fixed x_delta,
- FT_Fixed y_delta );
-
- /* snap a stem to one or two blue zones */
- FT_LOCAL( void )
- psh_blues_snap_stem( PSH_Blues blues,
- FT_Int stem_top,
- FT_Int stem_bot,
- PSH_Alignment alignment );
- /* */
-
-#ifdef DEBUG_HINTER
- extern PSH_Globals ps_debug_globals;
-#endif
-
-
-FT_END_HEADER
-
-
-#endif /* __PSHGLOB_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/pshinter/pshinter.c b/chromium/third_party/pdfium/third_party/freetype/src/pshinter/pshinter.c
deleted file mode 100644
index 9e65fe2a424..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/pshinter/pshinter.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/***************************************************************************/
-/* */
-/* pshinter.c */
-/* */
-/* FreeType PostScript Hinting module */
-/* */
-/* Copyright 2001-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#define FT_MAKE_OPTION_SINGLE_OBJECT
-
-#include <ft2build.h>
-#include "pshpic.c"
-#include "pshrec.c"
-#include "pshglob.c"
-#include "pshalgo.c"
-#include "pshmod.c"
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/pshinter/pshmod.c b/chromium/third_party/pdfium/third_party/freetype/src/pshinter/pshmod.c
deleted file mode 100644
index 961b4685060..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/pshinter/pshmod.c
+++ /dev/null
@@ -1,119 +0,0 @@
-/***************************************************************************/
-/* */
-/* pshmod.c */
-/* */
-/* FreeType PostScript hinter module implementation (body). */
-/* */
-/* Copyright 2001-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_OBJECTS_H
-#include "pshrec.h"
-#include "pshalgo.h"
-#include "pshpic.h"
-
-
- /* the Postscript Hinter module structure */
- typedef struct PS_Hinter_Module_Rec_
- {
- FT_ModuleRec root;
- PS_HintsRec ps_hints;
-
- PSH_Globals_FuncsRec globals_funcs;
- T1_Hints_FuncsRec t1_funcs;
- T2_Hints_FuncsRec t2_funcs;
-
- } PS_Hinter_ModuleRec, *PS_Hinter_Module;
-
-
- /* finalize module */
- FT_CALLBACK_DEF( void )
- ps_hinter_done( PS_Hinter_Module module )
- {
- module->t1_funcs.hints = NULL;
- module->t2_funcs.hints = NULL;
-
- ps_hints_done( &module->ps_hints );
- }
-
-
- /* initialize module, create hints recorder and the interface */
- FT_CALLBACK_DEF( FT_Error )
- ps_hinter_init( PS_Hinter_Module module )
- {
- FT_Memory memory = module->root.memory;
- void* ph = &module->ps_hints;
-
-
- ps_hints_init( &module->ps_hints, memory );
-
- psh_globals_funcs_init( &module->globals_funcs );
-
- t1_hints_funcs_init( &module->t1_funcs );
- module->t1_funcs.hints = (T1_Hints)ph;
-
- t2_hints_funcs_init( &module->t2_funcs );
- module->t2_funcs.hints = (T2_Hints)ph;
-
- return 0;
- }
-
-
- /* returns global hints interface */
- FT_CALLBACK_DEF( PSH_Globals_Funcs )
- pshinter_get_globals_funcs( FT_Module module )
- {
- return &((PS_Hinter_Module)module)->globals_funcs;
- }
-
-
- /* return Type 1 hints interface */
- FT_CALLBACK_DEF( T1_Hints_Funcs )
- pshinter_get_t1_funcs( FT_Module module )
- {
- return &((PS_Hinter_Module)module)->t1_funcs;
- }
-
-
- /* return Type 2 hints interface */
- FT_CALLBACK_DEF( T2_Hints_Funcs )
- pshinter_get_t2_funcs( FT_Module module )
- {
- return &((PS_Hinter_Module)module)->t2_funcs;
- }
-
-
- FT_DEFINE_PSHINTER_INTERFACE(
- pshinter_interface,
- pshinter_get_globals_funcs,
- pshinter_get_t1_funcs,
- pshinter_get_t2_funcs )
-
-
- FT_DEFINE_MODULE(
- pshinter_module_class,
-
- 0,
- sizeof ( PS_Hinter_ModuleRec ),
- "pshinter",
- 0x10000L,
- 0x20000L,
-
- &PSHINTER_INTERFACE_GET, /* module-specific interface */
-
- (FT_Module_Constructor)ps_hinter_init,
- (FT_Module_Destructor) ps_hinter_done,
- (FT_Module_Requester) NULL ) /* no additional interface for now */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/pshinter/pshmod.h b/chromium/third_party/pdfium/third_party/freetype/src/pshinter/pshmod.h
deleted file mode 100644
index a58d8565337..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/pshinter/pshmod.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/***************************************************************************/
-/* */
-/* pshmod.h */
-/* */
-/* PostScript hinter module interface (specification). */
-/* */
-/* Copyright 2001-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __PSHMOD_H__
-#define __PSHMOD_H__
-
-
-#include <ft2build.h>
-#include FT_MODULE_H
-
-
-FT_BEGIN_HEADER
-
-
- FT_DECLARE_MODULE( pshinter_module_class )
-
-
-FT_END_HEADER
-
-
-#endif /* __PSHMOD_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/pshinter/pshnterr.h b/chromium/third_party/pdfium/third_party/freetype/src/pshinter/pshnterr.h
deleted file mode 100644
index ce790a8ef51..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/pshinter/pshnterr.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/***************************************************************************/
-/* */
-/* pshnterr.h */
-/* */
-/* PS Hinter error codes (specification only). */
-/* */
-/* Copyright 2003-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* This file is used to define the PSHinter error enumeration constants. */
- /* */
- /*************************************************************************/
-
-#ifndef __PSHNTERR_H__
-#define __PSHNTERR_H__
-
-#include FT_MODULE_ERRORS_H
-
-#undef __FTERRORS_H__
-
-#undef FT_ERR_PREFIX
-#define FT_ERR_PREFIX PSH_Err_
-#define FT_ERR_BASE FT_Mod_Err_PShinter
-
-#include FT_ERRORS_H
-
-#endif /* __PSHNTERR_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/pshinter/pshpic.c b/chromium/third_party/pdfium/third_party/freetype/src/pshinter/pshpic.c
deleted file mode 100644
index afd8fb9678e..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/pshinter/pshpic.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/***************************************************************************/
-/* */
-/* pshpic.c */
-/* */
-/* The FreeType position independent code services for pshinter module. */
-/* */
-/* Copyright 2009-2015 by */
-/* Oran Agra and Mickey Gabel. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_INTERNAL_OBJECTS_H
-#include "pshpic.h"
-#include "pshnterr.h"
-
-
-#ifdef FT_CONFIG_OPTION_PIC
-
- /* forward declaration of PIC init functions from pshmod.c */
- void
- FT_Init_Class_pshinter_interface( FT_Library library,
- PSHinter_Interface* clazz );
-
- void
- pshinter_module_class_pic_free( FT_Library library )
- {
- FT_PIC_Container* pic_container = &library->pic_container;
- FT_Memory memory = library->memory;
-
-
- if ( pic_container->pshinter )
- {
- FT_FREE( pic_container->pshinter );
- pic_container->pshinter = NULL;
- }
- }
-
-
- FT_Error
- pshinter_module_class_pic_init( FT_Library library )
- {
- FT_PIC_Container* pic_container = &library->pic_container;
- FT_Error error = FT_Err_Ok;
- PSHinterPIC* container = NULL;
- FT_Memory memory = library->memory;
-
-
- /* allocate pointer, clear and set global container pointer */
- if ( FT_ALLOC( container, sizeof ( *container ) ) )
- return error;
- FT_MEM_SET( container, 0, sizeof ( *container ) );
- pic_container->pshinter = container;
-
- /* add call to initialization function when you add new scripts */
- FT_Init_Class_pshinter_interface(
- library, &container->pshinter_interface );
-
- if ( error )
- pshinter_module_class_pic_free( library );
-
- return error;
- }
-
-#endif /* FT_CONFIG_OPTION_PIC */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/pshinter/pshpic.h b/chromium/third_party/pdfium/third_party/freetype/src/pshinter/pshpic.h
deleted file mode 100644
index ca35cd6fa9f..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/pshinter/pshpic.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/***************************************************************************/
-/* */
-/* pshpic.h */
-/* */
-/* The FreeType position independent code services for pshinter module. */
-/* */
-/* Copyright 2009-2015 by */
-/* Oran Agra and Mickey Gabel. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __PSHPIC_H__
-#define __PSHPIC_H__
-
-
-#include FT_INTERNAL_PIC_H
-
-
-#ifndef FT_CONFIG_OPTION_PIC
-
-#define PSHINTER_INTERFACE_GET pshinter_interface
-
-#else /* FT_CONFIG_OPTION_PIC */
-
-#include FT_INTERNAL_POSTSCRIPT_HINTS_H
-
-FT_BEGIN_HEADER
-
- typedef struct PSHinterPIC_
- {
- PSHinter_Interface pshinter_interface;
-
- } PSHinterPIC;
-
-
-#define GET_PIC( lib ) ( (PSHinterPIC*)( (lib)->pic_container.pshinter ) )
-
-#define PSHINTER_INTERFACE_GET ( GET_PIC( library )->pshinter_interface )
-
- /* see pshpic.c for the implementation */
- void
- pshinter_module_class_pic_free( FT_Library library );
-
- FT_Error
- pshinter_module_class_pic_init( FT_Library library );
-
-FT_END_HEADER
-
-#endif /* FT_CONFIG_OPTION_PIC */
-
- /* */
-
-#endif /* __PSHPIC_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/pshinter/pshrec.c b/chromium/third_party/pdfium/third_party/freetype/src/pshinter/pshrec.c
deleted file mode 100644
index f8895fc8d63..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/pshinter/pshrec.c
+++ /dev/null
@@ -1,1220 +0,0 @@
-/***************************************************************************/
-/* */
-/* pshrec.c */
-/* */
-/* FreeType PostScript hints recorder (body). */
-/* */
-/* Copyright 2001-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_CALC_H
-
-#include "pshrec.h"
-#include "pshalgo.h"
-
-#include "pshnterr.h"
-
-#undef FT_COMPONENT
-#define FT_COMPONENT trace_pshrec
-
-#ifdef DEBUG_HINTER
- PS_Hints ps_debug_hints = NULL;
- int ps_debug_no_horz_hints = 0;
- int ps_debug_no_vert_hints = 0;
-#endif
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** PS_HINT MANAGEMENT *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
- /* destroy hints table */
- static void
- ps_hint_table_done( PS_Hint_Table table,
- FT_Memory memory )
- {
- FT_FREE( table->hints );
- table->num_hints = 0;
- table->max_hints = 0;
- }
-
-
- /* ensure that a table can contain "count" elements */
- static FT_Error
- ps_hint_table_ensure( PS_Hint_Table table,
- FT_UInt count,
- FT_Memory memory )
- {
- FT_UInt old_max = table->max_hints;
- FT_UInt new_max = count;
- FT_Error error = FT_Err_Ok;
-
-
- if ( new_max > old_max )
- {
- /* try to grow the table */
- new_max = FT_PAD_CEIL( new_max, 8 );
- if ( !FT_RENEW_ARRAY( table->hints, old_max, new_max ) )
- table->max_hints = new_max;
- }
- return error;
- }
-
-
- static FT_Error
- ps_hint_table_alloc( PS_Hint_Table table,
- FT_Memory memory,
- PS_Hint *ahint )
- {
- FT_Error error = FT_Err_Ok;
- FT_UInt count;
- PS_Hint hint = NULL;
-
-
- count = table->num_hints;
- count++;
-
- if ( count >= table->max_hints )
- {
- error = ps_hint_table_ensure( table, count, memory );
- if ( error )
- goto Exit;
- }
-
- hint = table->hints + count - 1;
- hint->pos = 0;
- hint->len = 0;
- hint->flags = 0;
-
- table->num_hints = count;
-
- Exit:
- *ahint = hint;
- return error;
- }
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** PS_MASK MANAGEMENT *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
- /* destroy mask */
- static void
- ps_mask_done( PS_Mask mask,
- FT_Memory memory )
- {
- FT_FREE( mask->bytes );
- mask->num_bits = 0;
- mask->max_bits = 0;
- mask->end_point = 0;
- }
-
-
- /* ensure that a mask can contain "count" bits */
- static FT_Error
- ps_mask_ensure( PS_Mask mask,
- FT_UInt count,
- FT_Memory memory )
- {
- FT_UInt old_max = ( mask->max_bits + 7 ) >> 3;
- FT_UInt new_max = ( count + 7 ) >> 3;
- FT_Error error = FT_Err_Ok;
-
-
- if ( new_max > old_max )
- {
- new_max = FT_PAD_CEIL( new_max, 8 );
- if ( !FT_RENEW_ARRAY( mask->bytes, old_max, new_max ) )
- mask->max_bits = new_max * 8;
- }
- return error;
- }
-
-
- /* test a bit value in a given mask */
- static FT_Int
- ps_mask_test_bit( PS_Mask mask,
- FT_Int idx )
- {
- if ( (FT_UInt)idx >= mask->num_bits )
- return 0;
-
- return mask->bytes[idx >> 3] & ( 0x80 >> ( idx & 7 ) );
- }
-
-
- /* clear a given bit */
- static void
- ps_mask_clear_bit( PS_Mask mask,
- FT_UInt idx )
- {
- FT_Byte* p;
-
-
- if ( idx >= mask->num_bits )
- return;
-
- p = mask->bytes + ( idx >> 3 );
- p[0] = (FT_Byte)( p[0] & ~( 0x80 >> ( idx & 7 ) ) );
- }
-
-
- /* set a given bit, possibly grow the mask */
- static FT_Error
- ps_mask_set_bit( PS_Mask mask,
- FT_UInt idx,
- FT_Memory memory )
- {
- FT_Error error = FT_Err_Ok;
- FT_Byte* p;
-
-
- if ( idx >= mask->num_bits )
- {
- error = ps_mask_ensure( mask, idx + 1, memory );
- if ( error )
- goto Exit;
-
- mask->num_bits = idx + 1;
- }
-
- p = mask->bytes + ( idx >> 3 );
- p[0] = (FT_Byte)( p[0] | ( 0x80 >> ( idx & 7 ) ) );
-
- Exit:
- return error;
- }
-
-
- /* destroy mask table */
- static void
- ps_mask_table_done( PS_Mask_Table table,
- FT_Memory memory )
- {
- FT_UInt count = table->max_masks;
- PS_Mask mask = table->masks;
-
-
- for ( ; count > 0; count--, mask++ )
- ps_mask_done( mask, memory );
-
- FT_FREE( table->masks );
- table->num_masks = 0;
- table->max_masks = 0;
- }
-
-
- /* ensure that a mask table can contain "count" masks */
- static FT_Error
- ps_mask_table_ensure( PS_Mask_Table table,
- FT_UInt count,
- FT_Memory memory )
- {
- FT_UInt old_max = table->max_masks;
- FT_UInt new_max = count;
- FT_Error error = FT_Err_Ok;
-
-
- if ( new_max > old_max )
- {
- new_max = FT_PAD_CEIL( new_max, 8 );
- if ( !FT_RENEW_ARRAY( table->masks, old_max, new_max ) )
- table->max_masks = new_max;
- }
- return error;
- }
-
-
- /* allocate a new mask in a table */
- static FT_Error
- ps_mask_table_alloc( PS_Mask_Table table,
- FT_Memory memory,
- PS_Mask *amask )
- {
- FT_UInt count;
- FT_Error error = FT_Err_Ok;
- PS_Mask mask = NULL;
-
-
- count = table->num_masks;
- count++;
-
- if ( count > table->max_masks )
- {
- error = ps_mask_table_ensure( table, count, memory );
- if ( error )
- goto Exit;
- }
-
- mask = table->masks + count - 1;
- mask->num_bits = 0;
- mask->end_point = 0;
- table->num_masks = count;
-
- Exit:
- *amask = mask;
- return error;
- }
-
-
- /* return last hint mask in a table, create one if the table is empty */
- static FT_Error
- ps_mask_table_last( PS_Mask_Table table,
- FT_Memory memory,
- PS_Mask *amask )
- {
- FT_Error error = FT_Err_Ok;
- FT_UInt count;
- PS_Mask mask;
-
-
- count = table->num_masks;
- if ( count == 0 )
- {
- error = ps_mask_table_alloc( table, memory, &mask );
- if ( error )
- goto Exit;
- }
- else
- mask = table->masks + count - 1;
-
- Exit:
- *amask = mask;
- return error;
- }
-
-
- /* set a new mask to a given bit range */
- static FT_Error
- ps_mask_table_set_bits( PS_Mask_Table table,
- const FT_Byte* source,
- FT_UInt bit_pos,
- FT_UInt bit_count,
- FT_Memory memory )
- {
- FT_Error error;
- PS_Mask mask;
-
-
- error = ps_mask_table_last( table, memory, &mask );
- if ( error )
- goto Exit;
-
- error = ps_mask_ensure( mask, bit_count, memory );
- if ( error )
- goto Exit;
-
- mask->num_bits = bit_count;
-
- /* now, copy bits */
- {
- FT_Byte* read = (FT_Byte*)source + ( bit_pos >> 3 );
- FT_Int rmask = 0x80 >> ( bit_pos & 7 );
- FT_Byte* write = mask->bytes;
- FT_Int wmask = 0x80;
- FT_Int val;
-
-
- for ( ; bit_count > 0; bit_count-- )
- {
- val = write[0] & ~wmask;
-
- if ( read[0] & rmask )
- val |= wmask;
-
- write[0] = (FT_Byte)val;
-
- rmask >>= 1;
- if ( rmask == 0 )
- {
- read++;
- rmask = 0x80;
- }
-
- wmask >>= 1;
- if ( wmask == 0 )
- {
- write++;
- wmask = 0x80;
- }
- }
- }
-
- Exit:
- return error;
- }
-
-
- /* test whether two masks in a table intersect */
- static FT_Int
- ps_mask_table_test_intersect( PS_Mask_Table table,
- FT_UInt index1,
- FT_UInt index2 )
- {
- PS_Mask mask1 = table->masks + index1;
- PS_Mask mask2 = table->masks + index2;
- FT_Byte* p1 = mask1->bytes;
- FT_Byte* p2 = mask2->bytes;
- FT_UInt count1 = mask1->num_bits;
- FT_UInt count2 = mask2->num_bits;
- FT_UInt count;
-
-
- count = FT_MIN( count1, count2 );
- for ( ; count >= 8; count -= 8 )
- {
- if ( p1[0] & p2[0] )
- return 1;
-
- p1++;
- p2++;
- }
-
- if ( count == 0 )
- return 0;
-
- return ( p1[0] & p2[0] ) & ~( 0xFF >> count );
- }
-
-
- /* merge two masks, used by ps_mask_table_merge_all */
- static FT_Error
- ps_mask_table_merge( PS_Mask_Table table,
- FT_UInt index1,
- FT_UInt index2,
- FT_Memory memory )
- {
- FT_Error error = FT_Err_Ok;
-
-
- /* swap index1 and index2 so that index1 < index2 */
- if ( index1 > index2 )
- {
- FT_UInt temp;
-
-
- temp = index1;
- index1 = index2;
- index2 = temp;
- }
-
- if ( index1 < index2 && index2 < table->num_masks )
- {
- /* we need to merge the bitsets of index1 and index2 with a */
- /* simple union */
- PS_Mask mask1 = table->masks + index1;
- PS_Mask mask2 = table->masks + index2;
- FT_UInt count1 = mask1->num_bits;
- FT_UInt count2 = mask2->num_bits;
- FT_Int delta;
-
-
- if ( count2 > 0 )
- {
- FT_UInt pos;
- FT_Byte* read;
- FT_Byte* write;
-
-
- /* if "count2" is greater than "count1", we need to grow the */
- /* first bitset, and clear the highest bits */
- if ( count2 > count1 )
- {
- error = ps_mask_ensure( mask1, count2, memory );
- if ( error )
- goto Exit;
-
- for ( pos = count1; pos < count2; pos++ )
- ps_mask_clear_bit( mask1, pos );
- }
-
- /* merge (unite) the bitsets */
- read = mask2->bytes;
- write = mask1->bytes;
- pos = ( count2 + 7 ) >> 3;
-
- for ( ; pos > 0; pos-- )
- {
- write[0] = (FT_Byte)( write[0] | read[0] );
- write++;
- read++;
- }
- }
-
- /* Now, remove "mask2" from the list. We need to keep the masks */
- /* sorted in order of importance, so move table elements. */
- mask2->num_bits = 0;
- mask2->end_point = 0;
-
- /* number of masks to move */
- delta = (FT_Int)( table->num_masks - 1 - index2 );
- if ( delta > 0 )
- {
- /* move to end of table for reuse */
- PS_MaskRec dummy = *mask2;
-
-
- ft_memmove( mask2,
- mask2 + 1,
- (FT_UInt)delta * sizeof ( PS_MaskRec ) );
-
- mask2[delta] = dummy;
- }
-
- table->num_masks--;
- }
- else
- FT_TRACE0(( "ps_mask_table_merge: ignoring invalid indices (%d,%d)\n",
- index1, index2 ));
-
- Exit:
- return error;
- }
-
-
- /* Try to merge all masks in a given table. This is used to merge */
- /* all counter masks into independent counter "paths". */
- /* */
- static FT_Error
- ps_mask_table_merge_all( PS_Mask_Table table,
- FT_Memory memory )
- {
- FT_Int index1, index2;
- FT_Error error = FT_Err_Ok;
-
-
- /* both loops go down to 0, thus FT_Int for index1 and index2 */
- for ( index1 = (FT_Int)table->num_masks - 1; index1 > 0; index1-- )
- {
- for ( index2 = index1 - 1; index2 >= 0; index2-- )
- {
- if ( ps_mask_table_test_intersect( table,
- (FT_UInt)index1,
- (FT_UInt)index2 ) )
- {
- error = ps_mask_table_merge( table,
- (FT_UInt)index2,
- (FT_UInt)index1,
- memory );
- if ( error )
- goto Exit;
-
- break;
- }
- }
- }
-
- Exit:
- return error;
- }
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** PS_DIMENSION MANAGEMENT *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
-
- /* finalize a given dimension */
- static void
- ps_dimension_done( PS_Dimension dimension,
- FT_Memory memory )
- {
- ps_mask_table_done( &dimension->counters, memory );
- ps_mask_table_done( &dimension->masks, memory );
- ps_hint_table_done( &dimension->hints, memory );
- }
-
-
- /* initialize a given dimension */
- static void
- ps_dimension_init( PS_Dimension dimension )
- {
- dimension->hints.num_hints = 0;
- dimension->masks.num_masks = 0;
- dimension->counters.num_masks = 0;
- }
-
-
-#if 0
-
- /* set a bit at a given index in the current hint mask */
- static FT_Error
- ps_dimension_set_mask_bit( PS_Dimension dim,
- FT_UInt idx,
- FT_Memory memory )
- {
- PS_Mask mask;
- FT_Error error = FT_Err_Ok;
-
-
- /* get last hint mask */
- error = ps_mask_table_last( &dim->masks, memory, &mask );
- if ( error )
- goto Exit;
-
- error = ps_mask_set_bit( mask, idx, memory );
-
- Exit:
- return error;
- }
-
-#endif
-
- /* set the end point in a mask, called from "End" & "Reset" methods */
- static void
- ps_dimension_end_mask( PS_Dimension dim,
- FT_UInt end_point )
- {
- FT_UInt count = dim->masks.num_masks;
-
-
- if ( count > 0 )
- {
- PS_Mask mask = dim->masks.masks + count - 1;
-
-
- mask->end_point = end_point;
- }
- }
-
-
- /* set the end point in the current mask, then create a new empty one */
- /* (called by "Reset" method) */
- static FT_Error
- ps_dimension_reset_mask( PS_Dimension dim,
- FT_UInt end_point,
- FT_Memory memory )
- {
- PS_Mask mask;
-
-
- /* end current mask */
- ps_dimension_end_mask( dim, end_point );
-
- /* allocate new one */
- return ps_mask_table_alloc( &dim->masks, memory, &mask );
- }
-
-
- /* set a new mask, called from the "T2Stem" method */
- static FT_Error
- ps_dimension_set_mask_bits( PS_Dimension dim,
- const FT_Byte* source,
- FT_UInt source_pos,
- FT_UInt source_bits,
- FT_UInt end_point,
- FT_Memory memory )
- {
- FT_Error error;
-
-
- /* reset current mask, if any */
- error = ps_dimension_reset_mask( dim, end_point, memory );
- if ( error )
- goto Exit;
-
- /* set bits in new mask */
- error = ps_mask_table_set_bits( &dim->masks, source,
- source_pos, source_bits, memory );
-
- Exit:
- return error;
- }
-
-
- /* add a new single stem (called from "T1Stem" method) */
- static FT_Error
- ps_dimension_add_t1stem( PS_Dimension dim,
- FT_Int pos,
- FT_Int len,
- FT_Memory memory,
- FT_Int *aindex )
- {
- FT_Error error = FT_Err_Ok;
- FT_UInt flags = 0;
-
-
- /* detect ghost stem */
- if ( len < 0 )
- {
- flags |= PS_HINT_FLAG_GHOST;
- if ( len == -21 )
- {
- flags |= PS_HINT_FLAG_BOTTOM;
- pos += len;
- }
- len = 0;
- }
-
- if ( aindex )
- *aindex = -1;
-
- /* now, lookup stem in the current hints table */
- {
- PS_Mask mask;
- FT_UInt idx;
- FT_UInt max = dim->hints.num_hints;
- PS_Hint hint = dim->hints.hints;
-
-
- for ( idx = 0; idx < max; idx++, hint++ )
- {
- if ( hint->pos == pos && hint->len == len )
- break;
- }
-
- /* we need to create a new hint in the table */
- if ( idx >= max )
- {
- error = ps_hint_table_alloc( &dim->hints, memory, &hint );
- if ( error )
- goto Exit;
-
- hint->pos = pos;
- hint->len = len;
- hint->flags = flags;
- }
-
- /* now, store the hint in the current mask */
- error = ps_mask_table_last( &dim->masks, memory, &mask );
- if ( error )
- goto Exit;
-
- error = ps_mask_set_bit( mask, idx, memory );
- if ( error )
- goto Exit;
-
- if ( aindex )
- *aindex = (FT_Int)idx;
- }
-
- Exit:
- return error;
- }
-
-
- /* add a "hstem3/vstem3" counter to our dimension table */
- static FT_Error
- ps_dimension_add_counter( PS_Dimension dim,
- FT_Int hint1,
- FT_Int hint2,
- FT_Int hint3,
- FT_Memory memory )
- {
- FT_Error error = FT_Err_Ok;
- FT_UInt count = dim->counters.num_masks;
- PS_Mask counter = dim->counters.masks;
-
-
- /* try to find an existing counter mask that already uses */
- /* one of these stems here */
- for ( ; count > 0; count--, counter++ )
- {
- if ( ps_mask_test_bit( counter, hint1 ) ||
- ps_mask_test_bit( counter, hint2 ) ||
- ps_mask_test_bit( counter, hint3 ) )
- break;
- }
-
- /* create a new counter when needed */
- if ( count == 0 )
- {
- error = ps_mask_table_alloc( &dim->counters, memory, &counter );
- if ( error )
- goto Exit;
- }
-
- /* now, set the bits for our hints in the counter mask */
- if ( hint1 >= 0 )
- {
- error = ps_mask_set_bit( counter, (FT_UInt)hint1, memory );
- if ( error )
- goto Exit;
- }
-
- if ( hint2 >= 0 )
- {
- error = ps_mask_set_bit( counter, (FT_UInt)hint2, memory );
- if ( error )
- goto Exit;
- }
-
- if ( hint3 >= 0 )
- {
- error = ps_mask_set_bit( counter, (FT_UInt)hint3, memory );
- if ( error )
- goto Exit;
- }
-
- Exit:
- return error;
- }
-
-
- /* end of recording session for a given dimension */
- static FT_Error
- ps_dimension_end( PS_Dimension dim,
- FT_UInt end_point,
- FT_Memory memory )
- {
- /* end hint mask table */
- ps_dimension_end_mask( dim, end_point );
-
- /* merge all counter masks into independent "paths" */
- return ps_mask_table_merge_all( &dim->counters, memory );
- }
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** PS_RECORDER MANAGEMENT *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
-
- /* destroy hints */
- FT_LOCAL( void )
- ps_hints_done( PS_Hints hints )
- {
- FT_Memory memory = hints->memory;
-
-
- ps_dimension_done( &hints->dimension[0], memory );
- ps_dimension_done( &hints->dimension[1], memory );
-
- hints->error = FT_Err_Ok;
- hints->memory = NULL;
- }
-
-
- FT_LOCAL( void )
- ps_hints_init( PS_Hints hints,
- FT_Memory memory )
- {
- FT_MEM_ZERO( hints, sizeof ( *hints ) );
- hints->memory = memory;
- }
-
-
- /* initialize a hints for a new session */
- static void
- ps_hints_open( PS_Hints hints,
- PS_Hint_Type hint_type )
- {
- hints->error = FT_Err_Ok;
- hints->hint_type = hint_type;
-
- ps_dimension_init( &hints->dimension[0] );
- ps_dimension_init( &hints->dimension[1] );
- }
-
-
- /* add one or more stems to the current hints table */
- static void
- ps_hints_stem( PS_Hints hints,
- FT_UInt dimension,
- FT_Int count,
- FT_Long* stems )
- {
- PS_Dimension dim;
-
-
- if ( hints->error )
- return;
-
- /* limit "dimension" to 0..1 */
- if ( dimension > 1 )
- {
- FT_TRACE0(( "ps_hints_stem: invalid dimension (%d) used\n",
- dimension ));
- dimension = ( dimension != 0 );
- }
-
- /* record the stems in the current hints/masks table */
- /* (Type 1 & 2's `hstem' or `vstem' operators) */
- dim = &hints->dimension[dimension];
-
- for ( ; count > 0; count--, stems += 2 )
- {
- FT_Error error;
- FT_Memory memory = hints->memory;
-
-
- error = ps_dimension_add_t1stem( dim,
- (FT_Int)stems[0],
- (FT_Int)stems[1],
- memory,
- NULL );
- if ( error )
- {
- FT_ERROR(( "ps_hints_stem: could not add stem"
- " (%d,%d) to hints table\n", stems[0], stems[1] ));
-
- hints->error = error;
- return;
- }
- }
- }
-
-
- /* add one Type1 counter stem to the current hints table */
- static void
- ps_hints_t1stem3( PS_Hints hints,
- FT_UInt dimension,
- FT_Fixed* stems )
- {
- FT_Error error = FT_Err_Ok;
-
-
- if ( !hints->error )
- {
- PS_Dimension dim;
- FT_Memory memory = hints->memory;
- FT_Int count;
- FT_Int idx[3];
-
-
- /* limit "dimension" to 0..1 */
- if ( dimension > 1 )
- {
- FT_TRACE0(( "ps_hints_t1stem3: invalid dimension (%d) used\n",
- dimension ));
- dimension = ( dimension != 0 );
- }
-
- dim = &hints->dimension[dimension];
-
- /* there must be 6 elements in the 'stem' array */
- if ( hints->hint_type == PS_HINT_TYPE_1 )
- {
- /* add the three stems to our hints/masks table */
- for ( count = 0; count < 3; count++, stems += 2 )
- {
- error = ps_dimension_add_t1stem( dim,
- (FT_Int)FIXED_TO_INT( stems[0] ),
- (FT_Int)FIXED_TO_INT( stems[1] ),
- memory, &idx[count] );
- if ( error )
- goto Fail;
- }
-
- /* now, add the hints to the counters table */
- error = ps_dimension_add_counter( dim, idx[0], idx[1], idx[2],
- memory );
- if ( error )
- goto Fail;
- }
- else
- {
- FT_ERROR(( "ps_hints_t1stem3: called with invalid hint type\n" ));
- error = FT_THROW( Invalid_Argument );
- goto Fail;
- }
- }
-
- return;
-
- Fail:
- FT_ERROR(( "ps_hints_t1stem3: could not add counter stems to table\n" ));
- hints->error = error;
- }
-
-
- /* reset hints (only with Type 1 hints) */
- static void
- ps_hints_t1reset( PS_Hints hints,
- FT_UInt end_point )
- {
- FT_Error error = FT_Err_Ok;
-
-
- if ( !hints->error )
- {
- FT_Memory memory = hints->memory;
-
-
- if ( hints->hint_type == PS_HINT_TYPE_1 )
- {
- error = ps_dimension_reset_mask( &hints->dimension[0],
- end_point, memory );
- if ( error )
- goto Fail;
-
- error = ps_dimension_reset_mask( &hints->dimension[1],
- end_point, memory );
- if ( error )
- goto Fail;
- }
- else
- {
- /* invalid hint type */
- error = FT_THROW( Invalid_Argument );
- goto Fail;
- }
- }
- return;
-
- Fail:
- hints->error = error;
- }
-
-
- /* Type2 "hintmask" operator, add a new hintmask to each direction */
- static void
- ps_hints_t2mask( PS_Hints hints,
- FT_UInt end_point,
- FT_UInt bit_count,
- const FT_Byte* bytes )
- {
- FT_Error error;
-
-
- if ( !hints->error )
- {
- PS_Dimension dim = hints->dimension;
- FT_Memory memory = hints->memory;
- FT_UInt count1 = dim[0].hints.num_hints;
- FT_UInt count2 = dim[1].hints.num_hints;
-
-
- /* check bit count; must be equal to current total hint count */
- if ( bit_count != count1 + count2 )
- {
- FT_TRACE0(( "ps_hints_t2mask:"
- " called with invalid bitcount %d (instead of %d)\n",
- bit_count, count1 + count2 ));
-
- /* simply ignore the operator */
- return;
- }
-
- /* set-up new horizontal and vertical hint mask now */
- error = ps_dimension_set_mask_bits( &dim[0], bytes, count2, count1,
- end_point, memory );
- if ( error )
- goto Fail;
-
- error = ps_dimension_set_mask_bits( &dim[1], bytes, 0, count2,
- end_point, memory );
- if ( error )
- goto Fail;
- }
- return;
-
- Fail:
- hints->error = error;
- }
-
-
- static void
- ps_hints_t2counter( PS_Hints hints,
- FT_UInt bit_count,
- const FT_Byte* bytes )
- {
- FT_Error error;
-
-
- if ( !hints->error )
- {
- PS_Dimension dim = hints->dimension;
- FT_Memory memory = hints->memory;
- FT_UInt count1 = dim[0].hints.num_hints;
- FT_UInt count2 = dim[1].hints.num_hints;
-
-
- /* check bit count, must be equal to current total hint count */
- if ( bit_count != count1 + count2 )
- {
- FT_TRACE0(( "ps_hints_t2counter:"
- " called with invalid bitcount %d (instead of %d)\n",
- bit_count, count1 + count2 ));
-
- /* simply ignore the operator */
- return;
- }
-
- /* set-up new horizontal and vertical hint mask now */
- error = ps_dimension_set_mask_bits( &dim[0], bytes, 0, count1,
- 0, memory );
- if ( error )
- goto Fail;
-
- error = ps_dimension_set_mask_bits( &dim[1], bytes, count1, count2,
- 0, memory );
- if ( error )
- goto Fail;
- }
- return;
-
- Fail:
- hints->error = error;
- }
-
-
- /* end recording session */
- static FT_Error
- ps_hints_close( PS_Hints hints,
- FT_UInt end_point )
- {
- FT_Error error;
-
-
- error = hints->error;
- if ( !error )
- {
- FT_Memory memory = hints->memory;
- PS_Dimension dim = hints->dimension;
-
-
- error = ps_dimension_end( &dim[0], end_point, memory );
- if ( !error )
- {
- error = ps_dimension_end( &dim[1], end_point, memory );
- }
- }
-
-#ifdef DEBUG_HINTER
- if ( !error )
- ps_debug_hints = hints;
-#endif
- return error;
- }
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** TYPE 1 HINTS RECORDING INTERFACE *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
- static void
- t1_hints_open( T1_Hints hints )
- {
- ps_hints_open( (PS_Hints)hints, PS_HINT_TYPE_1 );
- }
-
- static void
- t1_hints_stem( T1_Hints hints,
- FT_UInt dimension,
- FT_Fixed* coords )
- {
- FT_Pos stems[2];
-
-
- stems[0] = FIXED_TO_INT( coords[0] );
- stems[1] = FIXED_TO_INT( coords[1] );
-
- ps_hints_stem( (PS_Hints)hints, dimension, 1, stems );
- }
-
-
- FT_LOCAL_DEF( void )
- t1_hints_funcs_init( T1_Hints_FuncsRec* funcs )
- {
- FT_MEM_ZERO( (char*)funcs, sizeof ( *funcs ) );
-
- funcs->open = (T1_Hints_OpenFunc) t1_hints_open;
- funcs->close = (T1_Hints_CloseFunc) ps_hints_close;
- funcs->stem = (T1_Hints_SetStemFunc) t1_hints_stem;
- funcs->stem3 = (T1_Hints_SetStem3Func)ps_hints_t1stem3;
- funcs->reset = (T1_Hints_ResetFunc) ps_hints_t1reset;
- funcs->apply = (T1_Hints_ApplyFunc) ps_hints_apply;
- }
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** TYPE 2 HINTS RECORDING INTERFACE *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
- static void
- t2_hints_open( T2_Hints hints )
- {
- ps_hints_open( (PS_Hints)hints, PS_HINT_TYPE_2 );
- }
-
-
- static void
- t2_hints_stems( T2_Hints hints,
- FT_UInt dimension,
- FT_Int count,
- FT_Fixed* coords )
- {
- FT_Pos stems[32], y;
- FT_Int total = count, n;
-
-
- y = 0;
- while ( total > 0 )
- {
- /* determine number of stems to write */
- count = total;
- if ( count > 16 )
- count = 16;
-
- /* compute integer stem positions in font units */
- for ( n = 0; n < count * 2; n++ )
- {
- y += coords[n];
- stems[n] = FIXED_TO_INT( y );
- }
-
- /* compute lengths */
- for ( n = 0; n < count * 2; n += 2 )
- stems[n + 1] = stems[n + 1] - stems[n];
-
- /* add them to the current dimension */
- ps_hints_stem( (PS_Hints)hints, dimension, count, stems );
-
- total -= count;
- }
- }
-
-
- FT_LOCAL_DEF( void )
- t2_hints_funcs_init( T2_Hints_FuncsRec* funcs )
- {
- FT_MEM_ZERO( funcs, sizeof ( *funcs ) );
-
- funcs->open = (T2_Hints_OpenFunc) t2_hints_open;
- funcs->close = (T2_Hints_CloseFunc) ps_hints_close;
- funcs->stems = (T2_Hints_StemsFunc) t2_hints_stems;
- funcs->hintmask= (T2_Hints_MaskFunc) ps_hints_t2mask;
- funcs->counter = (T2_Hints_CounterFunc)ps_hints_t2counter;
- funcs->apply = (T2_Hints_ApplyFunc) ps_hints_apply;
- }
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/pshinter/pshrec.h b/chromium/third_party/pdfium/third_party/freetype/src/pshinter/pshrec.h
deleted file mode 100644
index 2b1ad949368..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/pshinter/pshrec.h
+++ /dev/null
@@ -1,172 +0,0 @@
-/***************************************************************************/
-/* */
-/* pshrec.h */
-/* */
-/* Postscript (Type1/Type2) hints recorder (specification). */
-/* */
-/* Copyright 2001-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
- /**************************************************************************/
- /* */
- /* The functions defined here are called from the Type 1, CID and CFF */
- /* font drivers to record the hints of a given character/glyph. */
- /* */
- /* The hints are recorded in a unified format, and are later processed */
- /* by the `optimizer' and `fitter' to adjust the outlines to the pixel */
- /* grid. */
- /* */
- /**************************************************************************/
-
-
-#ifndef __PSHREC_H__
-#define __PSHREC_H__
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_POSTSCRIPT_HINTS_H
-#include "pshglob.h"
-
-
-FT_BEGIN_HEADER
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** GLYPH HINTS RECORDER INTERNALS *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
- /* handle to hint record */
- typedef struct PS_HintRec_* PS_Hint;
-
- /* hint types */
- typedef enum PS_Hint_Type_
- {
- PS_HINT_TYPE_1 = 1,
- PS_HINT_TYPE_2 = 2
-
- } PS_Hint_Type;
-
-
- /* hint flags */
-#define PS_HINT_FLAG_GHOST 1U
-#define PS_HINT_FLAG_BOTTOM 2U
-
-
- /* hint descriptor */
- typedef struct PS_HintRec_
- {
- FT_Int pos;
- FT_Int len;
- FT_UInt flags;
-
- } PS_HintRec;
-
-
-#define ps_hint_is_active( x ) ( (x)->flags & PS_HINT_FLAG_ACTIVE )
-#define ps_hint_is_ghost( x ) ( (x)->flags & PS_HINT_FLAG_GHOST )
-#define ps_hint_is_bottom( x ) ( (x)->flags & PS_HINT_FLAG_BOTTOM )
-
-
- /* hints table descriptor */
- typedef struct PS_Hint_TableRec_
- {
- FT_UInt num_hints;
- FT_UInt max_hints;
- PS_Hint hints;
-
- } PS_Hint_TableRec, *PS_Hint_Table;
-
-
- /* hint and counter mask descriptor */
- typedef struct PS_MaskRec_
- {
- FT_UInt num_bits;
- FT_UInt max_bits;
- FT_Byte* bytes;
- FT_UInt end_point;
-
- } PS_MaskRec, *PS_Mask;
-
-
- /* masks and counters table descriptor */
- typedef struct PS_Mask_TableRec_
- {
- FT_UInt num_masks;
- FT_UInt max_masks;
- PS_Mask masks;
-
- } PS_Mask_TableRec, *PS_Mask_Table;
-
-
- /* dimension-specific hints descriptor */
- typedef struct PS_DimensionRec_
- {
- PS_Hint_TableRec hints;
- PS_Mask_TableRec masks;
- PS_Mask_TableRec counters;
-
- } PS_DimensionRec, *PS_Dimension;
-
-
- /* glyph hints descriptor */
- /* dimension 0 => X coordinates + vertical hints/stems */
- /* dimension 1 => Y coordinates + horizontal hints/stems */
- typedef struct PS_HintsRec_
- {
- FT_Memory memory;
- FT_Error error;
- FT_UInt32 magic;
- PS_Hint_Type hint_type;
- PS_DimensionRec dimension[2];
-
- } PS_HintsRec, *PS_Hints;
-
- /* */
-
- /* initialize hints recorder */
- FT_LOCAL( void )
- ps_hints_init( PS_Hints hints,
- FT_Memory memory );
-
- /* finalize hints recorder */
- FT_LOCAL( void )
- ps_hints_done( PS_Hints hints );
-
- /* initialize Type1 hints recorder interface */
- FT_LOCAL( void )
- t1_hints_funcs_init( T1_Hints_FuncsRec* funcs );
-
- /* initialize Type2 hints recorder interface */
- FT_LOCAL( void )
- t2_hints_funcs_init( T2_Hints_FuncsRec* funcs );
-
-
-#ifdef DEBUG_HINTER
- extern PS_Hints ps_debug_hints;
- extern int ps_debug_no_horz_hints;
- extern int ps_debug_no_vert_hints;
-#endif
-
- /* */
-
-
-FT_END_HEADER
-
-
-#endif /* __PS_HINTER_RECORD_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/psnames/Jamfile b/chromium/third_party/pdfium/third_party/freetype/src/psnames/Jamfile
deleted file mode 100644
index 6dcc8b8e94d..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/psnames/Jamfile
+++ /dev/null
@@ -1,31 +0,0 @@
-# FreeType 2 src/psnames Jamfile
-#
-# Copyright 2001-2015 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT. By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-SubDir FT2_TOP $(FT2_SRC_DIR) psnames ;
-
-{
- local _sources ;
-
- if $(FT2_MULTI)
- {
- _sources = psmodule
- pspic
- ;
- }
- else
- {
- _sources = psnames ;
- }
-
- Library $(FT2_LIB) : $(_sources).c ;
-}
-
-# end of src/psnames Jamfile
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/psnames/psmodule.c b/chromium/third_party/pdfium/third_party/freetype/src/psnames/psmodule.c
deleted file mode 100644
index 0f04c2fa7d2..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/psnames/psmodule.c
+++ /dev/null
@@ -1,609 +0,0 @@
-/***************************************************************************/
-/* */
-/* psmodule.c */
-/* */
-/* PSNames module implementation (body). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_SERVICE_POSTSCRIPT_CMAPS_H
-
-#include "psmodule.h"
-#include "pstables.h"
-
-#include "psnamerr.h"
-#include "pspic.h"
-
-
-#ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES
-
-
-#ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST
-
-
-#define VARIANT_BIT 0x80000000UL
-#define BASE_GLYPH( code ) ( (FT_UInt32)( (code) & ~VARIANT_BIT ) )
-
-
- /* Return the Unicode value corresponding to a given glyph. Note that */
- /* we do deal with glyph variants by detecting a non-initial dot in */
- /* the name, as in `A.swash' or `e.final'; in this case, the */
- /* VARIANT_BIT is set in the return value. */
- /* */
- static FT_UInt32
- ps_unicode_value( const char* glyph_name )
- {
- /* If the name begins with `uni', then the glyph name may be a */
- /* hard-coded unicode character code. */
- if ( glyph_name[0] == 'u' &&
- glyph_name[1] == 'n' &&
- glyph_name[2] == 'i' )
- {
- /* determine whether the next four characters following are */
- /* hexadecimal. */
-
- /* XXX: Add code to deal with ligatures, i.e. glyph names like */
- /* `uniXXXXYYYYZZZZ'... */
-
- FT_Int count;
- FT_UInt32 value = 0;
- const char* p = glyph_name + 3;
-
-
- for ( count = 4; count > 0; count--, p++ )
- {
- char c = *p;
- unsigned int d;
-
-
- d = (unsigned char)c - '0';
- if ( d >= 10 )
- {
- d = (unsigned char)c - 'A';
- if ( d >= 6 )
- d = 16;
- else
- d += 10;
- }
-
- /* Exit if a non-uppercase hexadecimal character was found */
- /* -- this also catches character codes below `0' since such */
- /* negative numbers cast to `unsigned int' are far too big. */
- if ( d >= 16 )
- break;
-
- value = ( value << 4 ) + d;
- }
-
- /* there must be exactly four hex digits */
- if ( count == 0 )
- {
- if ( *p == '\0' )
- return value;
- if ( *p == '.' )
- return (FT_UInt32)( value | VARIANT_BIT );
- }
- }
-
- /* If the name begins with `u', followed by four to six uppercase */
- /* hexadecimal digits, it is a hard-coded unicode character code. */
- if ( glyph_name[0] == 'u' )
- {
- FT_Int count;
- FT_UInt32 value = 0;
- const char* p = glyph_name + 1;
-
-
- for ( count = 6; count > 0; count--, p++ )
- {
- char c = *p;
- unsigned int d;
-
-
- d = (unsigned char)c - '0';
- if ( d >= 10 )
- {
- d = (unsigned char)c - 'A';
- if ( d >= 6 )
- d = 16;
- else
- d += 10;
- }
-
- if ( d >= 16 )
- break;
-
- value = ( value << 4 ) + d;
- }
-
- if ( count <= 2 )
- {
- if ( *p == '\0' )
- return value;
- if ( *p == '.' )
- return (FT_UInt32)( value | VARIANT_BIT );
- }
- }
-
- /* Look for a non-initial dot in the glyph name in order to */
- /* find variants like `A.swash', `e.final', etc. */
- {
- const char* p = glyph_name;
- const char* dot = NULL;
-
-
- for ( ; *p; p++ )
- {
- if ( *p == '.' && p > glyph_name )
- {
- dot = p;
- break;
- }
- }
-
- /* now look up the glyph in the Adobe Glyph List */
- if ( !dot )
- return (FT_UInt32)ft_get_adobe_glyph_index( glyph_name, p );
- else
- return (FT_UInt32)( ft_get_adobe_glyph_index( glyph_name, dot ) |
- VARIANT_BIT );
- }
- }
-
-
- /* ft_qsort callback to sort the unicode map */
- FT_CALLBACK_DEF( int )
- compare_uni_maps( const void* a,
- const void* b )
- {
- PS_UniMap* map1 = (PS_UniMap*)a;
- PS_UniMap* map2 = (PS_UniMap*)b;
- FT_UInt32 unicode1 = BASE_GLYPH( map1->unicode );
- FT_UInt32 unicode2 = BASE_GLYPH( map2->unicode );
-
-
- /* sort base glyphs before glyph variants */
- if ( unicode1 == unicode2 )
- {
- if ( map1->unicode > map2->unicode )
- return 1;
- else if ( map1->unicode < map2->unicode )
- return -1;
- else
- return 0;
- }
- else
- {
- if ( unicode1 > unicode2 )
- return 1;
- else if ( unicode1 < unicode2 )
- return -1;
- else
- return 0;
- }
- }
-
-
- /* support for extra glyphs not handled (well) in AGL; */
- /* we add extra mappings for them if necessary */
-
-#define EXTRA_GLYPH_LIST_SIZE 10
-
- static const FT_UInt32 ft_extra_glyph_unicodes[EXTRA_GLYPH_LIST_SIZE] =
- {
- /* WGL 4 */
- 0x0394,
- 0x03A9,
- 0x2215,
- 0x00AD,
- 0x02C9,
- 0x03BC,
- 0x2219,
- 0x00A0,
- /* Romanian */
- 0x021A,
- 0x021B
- };
-
- static const char ft_extra_glyph_names[] =
- {
- 'D','e','l','t','a',0,
- 'O','m','e','g','a',0,
- 'f','r','a','c','t','i','o','n',0,
- 'h','y','p','h','e','n',0,
- 'm','a','c','r','o','n',0,
- 'm','u',0,
- 'p','e','r','i','o','d','c','e','n','t','e','r','e','d',0,
- 's','p','a','c','e',0,
- 'T','c','o','m','m','a','a','c','c','e','n','t',0,
- 't','c','o','m','m','a','a','c','c','e','n','t',0
- };
-
- static const FT_Int
- ft_extra_glyph_name_offsets[EXTRA_GLYPH_LIST_SIZE] =
- {
- 0,
- 6,
- 12,
- 21,
- 28,
- 35,
- 38,
- 53,
- 59,
- 72
- };
-
-
- static void
- ps_check_extra_glyph_name( const char* gname,
- FT_UInt glyph,
- FT_UInt* extra_glyphs,
- FT_UInt *states )
- {
- FT_UInt n;
-
-
- for ( n = 0; n < EXTRA_GLYPH_LIST_SIZE; n++ )
- {
- if ( ft_strcmp( ft_extra_glyph_names +
- ft_extra_glyph_name_offsets[n], gname ) == 0 )
- {
- if ( states[n] == 0 )
- {
- /* mark this extra glyph as a candidate for the cmap */
- states[n] = 1;
- extra_glyphs[n] = glyph;
- }
-
- return;
- }
- }
- }
-
-
- static void
- ps_check_extra_glyph_unicode( FT_UInt32 uni_char,
- FT_UInt *states )
- {
- FT_UInt n;
-
-
- for ( n = 0; n < EXTRA_GLYPH_LIST_SIZE; n++ )
- {
- if ( uni_char == ft_extra_glyph_unicodes[n] )
- {
- /* disable this extra glyph from being added to the cmap */
- states[n] = 2;
-
- return;
- }
- }
- }
-
-
- /* Build a table that maps Unicode values to glyph indices. */
- static FT_Error
- ps_unicodes_init( FT_Memory memory,
- PS_Unicodes table,
- FT_UInt num_glyphs,
- PS_GetGlyphNameFunc get_glyph_name,
- PS_FreeGlyphNameFunc free_glyph_name,
- FT_Pointer glyph_data )
- {
- FT_Error error;
-
- FT_UInt extra_glyph_list_states[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
- FT_UInt extra_glyphs[EXTRA_GLYPH_LIST_SIZE];
-
-
- /* we first allocate the table */
- table->num_maps = 0;
- table->maps = NULL;
-
- if ( !FT_NEW_ARRAY( table->maps, num_glyphs + EXTRA_GLYPH_LIST_SIZE ) )
- {
- FT_UInt n;
- FT_UInt count;
- PS_UniMap* map;
- FT_UInt32 uni_char;
-
-
- map = table->maps;
-
- for ( n = 0; n < num_glyphs; n++ )
- {
- const char* gname = get_glyph_name( glyph_data, n );
-
-
- if ( gname )
- {
- ps_check_extra_glyph_name( gname, n,
- extra_glyphs, extra_glyph_list_states );
- uni_char = ps_unicode_value( gname );
-
- if ( BASE_GLYPH( uni_char ) != 0 )
- {
- ps_check_extra_glyph_unicode( uni_char,
- extra_glyph_list_states );
- map->unicode = uni_char;
- map->glyph_index = n;
- map++;
- }
-
- if ( free_glyph_name )
- free_glyph_name( glyph_data, gname );
- }
- }
-
- for ( n = 0; n < EXTRA_GLYPH_LIST_SIZE; n++ )
- {
- if ( extra_glyph_list_states[n] == 1 )
- {
- /* This glyph name has an additional representation. */
- /* Add it to the cmap. */
-
- map->unicode = ft_extra_glyph_unicodes[n];
- map->glyph_index = extra_glyphs[n];
- map++;
- }
- }
-
- /* now compress the table a bit */
- count = (FT_UInt)( map - table->maps );
-
- if ( count == 0 )
- {
- /* No unicode chars here! */
- FT_FREE( table->maps );
- if ( !error )
- error = FT_THROW( No_Unicode_Glyph_Name );
- }
- else
- {
- /* Reallocate if the number of used entries is much smaller. */
- if ( count < num_glyphs / 2 )
- {
- (void)FT_RENEW_ARRAY( table->maps, num_glyphs, count );
- error = FT_Err_Ok;
- }
-
- /* Sort the table in increasing order of unicode values, */
- /* taking care of glyph variants. */
- ft_qsort( table->maps, count, sizeof ( PS_UniMap ),
- compare_uni_maps );
- }
-
- table->num_maps = count;
- }
-
- return error;
- }
-
-
- static FT_UInt
- ps_unicodes_char_index( PS_Unicodes table,
- FT_UInt32 unicode )
- {
- PS_UniMap *min, *max, *mid, *result = NULL;
-
-
- /* Perform a binary search on the table. */
-
- min = table->maps;
- max = min + table->num_maps - 1;
-
- while ( min <= max )
- {
- FT_UInt32 base_glyph;
-
-
- mid = min + ( ( max - min ) >> 1 );
-
- if ( mid->unicode == unicode )
- {
- result = mid;
- break;
- }
-
- base_glyph = BASE_GLYPH( mid->unicode );
-
- if ( base_glyph == unicode )
- result = mid; /* remember match but continue search for base glyph */
-
- if ( min == max )
- break;
-
- if ( base_glyph < unicode )
- min = mid + 1;
- else
- max = mid - 1;
- }
-
- if ( result )
- return result->glyph_index;
- else
- return 0;
- }
-
-
- static FT_UInt32
- ps_unicodes_char_next( PS_Unicodes table,
- FT_UInt32 *unicode )
- {
- FT_UInt result = 0;
- FT_UInt32 char_code = *unicode + 1;
-
-
- {
- FT_UInt min = 0;
- FT_UInt max = table->num_maps;
- FT_UInt mid;
- PS_UniMap* map;
- FT_UInt32 base_glyph;
-
-
- while ( min < max )
- {
- mid = min + ( ( max - min ) >> 1 );
- map = table->maps + mid;
-
- if ( map->unicode == char_code )
- {
- result = map->glyph_index;
- goto Exit;
- }
-
- base_glyph = BASE_GLYPH( map->unicode );
-
- if ( base_glyph == char_code )
- result = map->glyph_index;
-
- if ( base_glyph < char_code )
- min = mid + 1;
- else
- max = mid;
- }
-
- if ( result )
- goto Exit; /* we have a variant glyph */
-
- /* we didn't find it; check whether we have a map just above it */
- char_code = 0;
-
- if ( min < table->num_maps )
- {
- map = table->maps + min;
- result = map->glyph_index;
- char_code = BASE_GLYPH( map->unicode );
- }
- }
-
- Exit:
- *unicode = char_code;
- return result;
- }
-
-
-#endif /* FT_CONFIG_OPTION_ADOBE_GLYPH_LIST */
-
-
- static const char*
- ps_get_macintosh_name( FT_UInt name_index )
- {
- if ( name_index >= FT_NUM_MAC_NAMES )
- name_index = 0;
-
- return ft_standard_glyph_names + ft_mac_names[name_index];
- }
-
-
- static const char*
- ps_get_standard_strings( FT_UInt sid )
- {
- if ( sid >= FT_NUM_SID_NAMES )
- return 0;
-
- return ft_standard_glyph_names + ft_sid_names[sid];
- }
-
-
-#ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST
-
- FT_DEFINE_SERVICE_PSCMAPSREC(
- pscmaps_interface,
- (PS_Unicode_ValueFunc) ps_unicode_value,
- (PS_Unicodes_InitFunc) ps_unicodes_init,
- (PS_Unicodes_CharIndexFunc)ps_unicodes_char_index,
- (PS_Unicodes_CharNextFunc) ps_unicodes_char_next,
-
- (PS_Macintosh_NameFunc) ps_get_macintosh_name,
- (PS_Adobe_Std_StringsFunc) ps_get_standard_strings,
-
- t1_standard_encoding,
- t1_expert_encoding )
-
-#else
-
- FT_DEFINE_SERVICE_PSCMAPSREC(
- pscmaps_interface,
- NULL,
- NULL,
- NULL,
- NULL,
-
- (PS_Macintosh_NameFunc) ps_get_macintosh_name,
- (PS_Adobe_Std_StringsFunc) ps_get_standard_strings,
-
- t1_standard_encoding,
- t1_expert_encoding )
-
-#endif /* FT_CONFIG_OPTION_ADOBE_GLYPH_LIST */
-
-
- FT_DEFINE_SERVICEDESCREC1(
- pscmaps_services,
- FT_SERVICE_ID_POSTSCRIPT_CMAPS, &PSCMAPS_INTERFACE_GET )
-
-
- static FT_Pointer
- psnames_get_service( FT_Module module,
- const char* service_id )
- {
- /* PSCMAPS_SERVICES_GET dereferences `library' in PIC mode */
-#ifdef FT_CONFIG_OPTION_PIC
- FT_Library library;
-
-
- if ( !module )
- return NULL;
- library = module->library;
- if ( !library )
- return NULL;
-#else
- FT_UNUSED( module );
-#endif
-
- return ft_service_list_lookup( PSCMAPS_SERVICES_GET, service_id );
- }
-
-#endif /* FT_CONFIG_OPTION_POSTSCRIPT_NAMES */
-
-
-#ifndef FT_CONFIG_OPTION_POSTSCRIPT_NAMES
-#define PUT_PS_NAMES_SERVICE( a ) NULL
-#else
-#define PUT_PS_NAMES_SERVICE( a ) a
-#endif
-
- FT_DEFINE_MODULE(
- psnames_module_class,
-
- 0, /* this is not a font driver, nor a renderer */
- sizeof ( FT_ModuleRec ),
-
- "psnames", /* driver name */
- 0x10000L, /* driver version */
- 0x20000L, /* driver requires FreeType 2 or above */
-
- PUT_PS_NAMES_SERVICE(
- (void*)&PSCMAPS_INTERFACE_GET ), /* module specific interface */
- (FT_Module_Constructor)NULL,
- (FT_Module_Destructor) NULL,
- (FT_Module_Requester) PUT_PS_NAMES_SERVICE( psnames_get_service ) )
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/psnames/psmodule.h b/chromium/third_party/pdfium/third_party/freetype/src/psnames/psmodule.h
deleted file mode 100644
index f85f322193a..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/psnames/psmodule.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/***************************************************************************/
-/* */
-/* psmodule.h */
-/* */
-/* High-level PSNames module interface (specification). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __PSMODULE_H__
-#define __PSMODULE_H__
-
-
-#include <ft2build.h>
-#include FT_MODULE_H
-
-
-FT_BEGIN_HEADER
-
-
- FT_DECLARE_MODULE( psnames_module_class )
-
-
-FT_END_HEADER
-
-#endif /* __PSMODULE_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/psnames/psnamerr.h b/chromium/third_party/pdfium/third_party/freetype/src/psnames/psnamerr.h
deleted file mode 100644
index 09cc247b7d9..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/psnames/psnamerr.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/***************************************************************************/
-/* */
-/* psnamerr.h */
-/* */
-/* PS names module error codes (specification only). */
-/* */
-/* Copyright 2001-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* This file is used to define the PS names module error enumeration */
- /* constants. */
- /* */
- /*************************************************************************/
-
-#ifndef __PSNAMERR_H__
-#define __PSNAMERR_H__
-
-#include FT_MODULE_ERRORS_H
-
-#undef __FTERRORS_H__
-
-#undef FT_ERR_PREFIX
-#define FT_ERR_PREFIX PSnames_Err_
-#define FT_ERR_BASE FT_Mod_Err_PSnames
-
-#include FT_ERRORS_H
-
-#endif /* __PSNAMERR_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/psnames/psnames.c b/chromium/third_party/pdfium/third_party/freetype/src/psnames/psnames.c
deleted file mode 100644
index a4385961e5a..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/psnames/psnames.c
+++ /dev/null
@@ -1,26 +0,0 @@
-/***************************************************************************/
-/* */
-/* psnames.c */
-/* */
-/* FreeType PSNames module component (body only). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#define FT_MAKE_OPTION_SINGLE_OBJECT
-
-#include <ft2build.h>
-#include "pspic.c"
-#include "psmodule.c"
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/psnames/pspic.c b/chromium/third_party/pdfium/third_party/freetype/src/psnames/pspic.c
deleted file mode 100644
index 1394f977e00..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/psnames/pspic.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/***************************************************************************/
-/* */
-/* pspic.c */
-/* */
-/* The FreeType position independent code services for psnames module. */
-/* */
-/* Copyright 2009-2015 by */
-/* Oran Agra and Mickey Gabel. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_INTERNAL_OBJECTS_H
-#include "pspic.h"
-#include "psnamerr.h"
-
-
-#ifdef FT_CONFIG_OPTION_PIC
-
- /* forward declaration of PIC init functions from psmodule.c */
- FT_Error
- FT_Create_Class_pscmaps_services( FT_Library library,
- FT_ServiceDescRec** output_class );
- void
- FT_Destroy_Class_pscmaps_services( FT_Library library,
- FT_ServiceDescRec* clazz );
-
- void
- FT_Init_Class_pscmaps_interface( FT_Library library,
- FT_Service_PsCMapsRec* clazz );
-
-
- void
- psnames_module_class_pic_free( FT_Library library )
- {
- FT_PIC_Container* pic_container = &library->pic_container;
- FT_Memory memory = library->memory;
-
-
- if ( pic_container->psnames )
- {
- PSModulePIC* container = (PSModulePIC*)pic_container->psnames;
-
-
- if ( container->pscmaps_services )
- FT_Destroy_Class_pscmaps_services( library,
- container->pscmaps_services );
- container->pscmaps_services = NULL;
- FT_FREE( container );
- pic_container->psnames = NULL;
- }
- }
-
-
- FT_Error
- psnames_module_class_pic_init( FT_Library library )
- {
- FT_PIC_Container* pic_container = &library->pic_container;
- FT_Error error = FT_Err_Ok;
- PSModulePIC* container = NULL;
- FT_Memory memory = library->memory;
-
-
- /* allocate pointer, clear and set global container pointer */
- if ( FT_ALLOC( container, sizeof ( *container ) ) )
- return error;
- FT_MEM_SET( container, 0, sizeof ( *container ) );
- pic_container->psnames = container;
-
- /* initialize pointer table - */
- /* this is how the module usually expects this data */
- error = FT_Create_Class_pscmaps_services(
- library, &container->pscmaps_services );
- if ( error )
- goto Exit;
- FT_Init_Class_pscmaps_interface( library,
- &container->pscmaps_interface );
-
- Exit:
- if ( error )
- psnames_module_class_pic_free( library );
- return error;
- }
-
-
-#endif /* FT_CONFIG_OPTION_PIC */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/psnames/pspic.h b/chromium/third_party/pdfium/third_party/freetype/src/psnames/pspic.h
deleted file mode 100644
index 443225af615..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/psnames/pspic.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/***************************************************************************/
-/* */
-/* pspic.h */
-/* */
-/* The FreeType position independent code services for psnames module. */
-/* */
-/* Copyright 2009-2015 by */
-/* Oran Agra and Mickey Gabel. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __PSPIC_H__
-#define __PSPIC_H__
-
-
-#include FT_INTERNAL_PIC_H
-
-
-#ifndef FT_CONFIG_OPTION_PIC
-
-#define PSCMAPS_SERVICES_GET pscmaps_services
-#define PSCMAPS_INTERFACE_GET pscmaps_interface
-
-#else /* FT_CONFIG_OPTION_PIC */
-
-#include FT_SERVICE_POSTSCRIPT_CMAPS_H
-
-
-FT_BEGIN_HEADER
-
- typedef struct PSModulePIC_
- {
- FT_ServiceDescRec* pscmaps_services;
- FT_Service_PsCMapsRec pscmaps_interface;
-
- } PSModulePIC;
-
-
-#define GET_PIC( lib ) \
- ( (PSModulePIC*)((lib)->pic_container.psnames) )
-#define PSCMAPS_SERVICES_GET ( GET_PIC( library )->pscmaps_services )
-#define PSCMAPS_INTERFACE_GET ( GET_PIC( library )->pscmaps_interface )
-
-
- /* see pspic.c for the implementation */
- void
- psnames_module_class_pic_free( FT_Library library );
-
- FT_Error
- psnames_module_class_pic_init( FT_Library library );
-
-FT_END_HEADER
-
-#endif /* FT_CONFIG_OPTION_PIC */
-
- /* */
-
-#endif /* __PSPIC_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/psnames/pstables.h b/chromium/third_party/pdfium/third_party/freetype/src/psnames/pstables.h
deleted file mode 100644
index 3f31c31b189..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/psnames/pstables.h
+++ /dev/null
@@ -1,4170 +0,0 @@
-/***************************************************************************/
-/* */
-/* pstables.h */
-/* */
-/* PostScript glyph names. */
-/* */
-/* Copyright 2005-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
- /* This file has been generated automatically -- do not edit! */
-
-
- static const char ft_standard_glyph_names[3696] =
- {
- '.','n','u','l','l', 0,
- 'n','o','n','m','a','r','k','i','n','g','r','e','t','u','r','n', 0,
- 'n','o','t','e','q','u','a','l', 0,
- 'i','n','f','i','n','i','t','y', 0,
- 'l','e','s','s','e','q','u','a','l', 0,
- 'g','r','e','a','t','e','r','e','q','u','a','l', 0,
- 'p','a','r','t','i','a','l','d','i','f','f', 0,
- 's','u','m','m','a','t','i','o','n', 0,
- 'p','r','o','d','u','c','t', 0,
- 'p','i', 0,
- 'i','n','t','e','g','r','a','l', 0,
- 'O','m','e','g','a', 0,
- 'r','a','d','i','c','a','l', 0,
- 'a','p','p','r','o','x','e','q','u','a','l', 0,
- 'D','e','l','t','a', 0,
- 'n','o','n','b','r','e','a','k','i','n','g','s','p','a','c','e', 0,
- 'l','o','z','e','n','g','e', 0,
- 'a','p','p','l','e', 0,
- 'f','r','a','n','c', 0,
- 'G','b','r','e','v','e', 0,
- 'g','b','r','e','v','e', 0,
- 'I','d','o','t','a','c','c','e','n','t', 0,
- 'S','c','e','d','i','l','l','a', 0,
- 's','c','e','d','i','l','l','a', 0,
- 'C','a','c','u','t','e', 0,
- 'c','a','c','u','t','e', 0,
- 'C','c','a','r','o','n', 0,
- 'c','c','a','r','o','n', 0,
- 'd','c','r','o','a','t', 0,
- '.','n','o','t','d','e','f', 0,
- 's','p','a','c','e', 0,
- 'e','x','c','l','a','m', 0,
- 'q','u','o','t','e','d','b','l', 0,
- 'n','u','m','b','e','r','s','i','g','n', 0,
- 'd','o','l','l','a','r', 0,
- 'p','e','r','c','e','n','t', 0,
- 'a','m','p','e','r','s','a','n','d', 0,
- 'q','u','o','t','e','r','i','g','h','t', 0,
- 'p','a','r','e','n','l','e','f','t', 0,
- 'p','a','r','e','n','r','i','g','h','t', 0,
- 'a','s','t','e','r','i','s','k', 0,
- 'p','l','u','s', 0,
- 'c','o','m','m','a', 0,
- 'h','y','p','h','e','n', 0,
- 'p','e','r','i','o','d', 0,
- 's','l','a','s','h', 0,
- 'z','e','r','o', 0,
- 'o','n','e', 0,
- 't','w','o', 0,
- 't','h','r','e','e', 0,
- 'f','o','u','r', 0,
- 'f','i','v','e', 0,
- 's','i','x', 0,
- 's','e','v','e','n', 0,
- 'e','i','g','h','t', 0,
- 'n','i','n','e', 0,
- 'c','o','l','o','n', 0,
- 's','e','m','i','c','o','l','o','n', 0,
- 'l','e','s','s', 0,
- 'e','q','u','a','l', 0,
- 'g','r','e','a','t','e','r', 0,
- 'q','u','e','s','t','i','o','n', 0,
- 'a','t', 0,
- 'A', 0,
- 'B', 0,
- 'C', 0,
- 'D', 0,
- 'E', 0,
- 'F', 0,
- 'G', 0,
- 'H', 0,
- 'I', 0,
- 'J', 0,
- 'K', 0,
- 'L', 0,
- 'M', 0,
- 'N', 0,
- 'O', 0,
- 'P', 0,
- 'Q', 0,
- 'R', 0,
- 'S', 0,
- 'T', 0,
- 'U', 0,
- 'V', 0,
- 'W', 0,
- 'X', 0,
- 'Y', 0,
- 'Z', 0,
- 'b','r','a','c','k','e','t','l','e','f','t', 0,
- 'b','a','c','k','s','l','a','s','h', 0,
- 'b','r','a','c','k','e','t','r','i','g','h','t', 0,
- 'a','s','c','i','i','c','i','r','c','u','m', 0,
- 'u','n','d','e','r','s','c','o','r','e', 0,
- 'q','u','o','t','e','l','e','f','t', 0,
- 'a', 0,
- 'b', 0,
- 'c', 0,
- 'd', 0,
- 'e', 0,
- 'f', 0,
- 'g', 0,
- 'h', 0,
- 'i', 0,
- 'j', 0,
- 'k', 0,
- 'l', 0,
- 'm', 0,
- 'n', 0,
- 'o', 0,
- 'p', 0,
- 'q', 0,
- 'r', 0,
- 's', 0,
- 't', 0,
- 'u', 0,
- 'v', 0,
- 'w', 0,
- 'x', 0,
- 'y', 0,
- 'z', 0,
- 'b','r','a','c','e','l','e','f','t', 0,
- 'b','a','r', 0,
- 'b','r','a','c','e','r','i','g','h','t', 0,
- 'a','s','c','i','i','t','i','l','d','e', 0,
- 'e','x','c','l','a','m','d','o','w','n', 0,
- 'c','e','n','t', 0,
- 's','t','e','r','l','i','n','g', 0,
- 'f','r','a','c','t','i','o','n', 0,
- 'y','e','n', 0,
- 'f','l','o','r','i','n', 0,
- 's','e','c','t','i','o','n', 0,
- 'c','u','r','r','e','n','c','y', 0,
- 'q','u','o','t','e','s','i','n','g','l','e', 0,
- 'q','u','o','t','e','d','b','l','l','e','f','t', 0,
- 'g','u','i','l','l','e','m','o','t','l','e','f','t', 0,
- 'g','u','i','l','s','i','n','g','l','l','e','f','t', 0,
- 'g','u','i','l','s','i','n','g','l','r','i','g','h','t', 0,
- 'f','i', 0,
- 'f','l', 0,
- 'e','n','d','a','s','h', 0,
- 'd','a','g','g','e','r', 0,
- 'd','a','g','g','e','r','d','b','l', 0,
- 'p','e','r','i','o','d','c','e','n','t','e','r','e','d', 0,
- 'p','a','r','a','g','r','a','p','h', 0,
- 'b','u','l','l','e','t', 0,
- 'q','u','o','t','e','s','i','n','g','l','b','a','s','e', 0,
- 'q','u','o','t','e','d','b','l','b','a','s','e', 0,
- 'q','u','o','t','e','d','b','l','r','i','g','h','t', 0,
- 'g','u','i','l','l','e','m','o','t','r','i','g','h','t', 0,
- 'e','l','l','i','p','s','i','s', 0,
- 'p','e','r','t','h','o','u','s','a','n','d', 0,
- 'q','u','e','s','t','i','o','n','d','o','w','n', 0,
- 'g','r','a','v','e', 0,
- 'a','c','u','t','e', 0,
- 'c','i','r','c','u','m','f','l','e','x', 0,
- 't','i','l','d','e', 0,
- 'm','a','c','r','o','n', 0,
- 'b','r','e','v','e', 0,
- 'd','o','t','a','c','c','e','n','t', 0,
- 'd','i','e','r','e','s','i','s', 0,
- 'r','i','n','g', 0,
- 'c','e','d','i','l','l','a', 0,
- 'h','u','n','g','a','r','u','m','l','a','u','t', 0,
- 'o','g','o','n','e','k', 0,
- 'c','a','r','o','n', 0,
- 'e','m','d','a','s','h', 0,
- 'A','E', 0,
- 'o','r','d','f','e','m','i','n','i','n','e', 0,
- 'L','s','l','a','s','h', 0,
- 'O','s','l','a','s','h', 0,
- 'O','E', 0,
- 'o','r','d','m','a','s','c','u','l','i','n','e', 0,
- 'a','e', 0,
- 'd','o','t','l','e','s','s','i', 0,
- 'l','s','l','a','s','h', 0,
- 'o','s','l','a','s','h', 0,
- 'o','e', 0,
- 'g','e','r','m','a','n','d','b','l','s', 0,
- 'o','n','e','s','u','p','e','r','i','o','r', 0,
- 'l','o','g','i','c','a','l','n','o','t', 0,
- 'm','u', 0,
- 't','r','a','d','e','m','a','r','k', 0,
- 'E','t','h', 0,
- 'o','n','e','h','a','l','f', 0,
- 'p','l','u','s','m','i','n','u','s', 0,
- 'T','h','o','r','n', 0,
- 'o','n','e','q','u','a','r','t','e','r', 0,
- 'd','i','v','i','d','e', 0,
- 'b','r','o','k','e','n','b','a','r', 0,
- 'd','e','g','r','e','e', 0,
- 't','h','o','r','n', 0,
- 't','h','r','e','e','q','u','a','r','t','e','r','s', 0,
- 't','w','o','s','u','p','e','r','i','o','r', 0,
- 'r','e','g','i','s','t','e','r','e','d', 0,
- 'm','i','n','u','s', 0,
- 'e','t','h', 0,
- 'm','u','l','t','i','p','l','y', 0,
- 't','h','r','e','e','s','u','p','e','r','i','o','r', 0,
- 'c','o','p','y','r','i','g','h','t', 0,
- 'A','a','c','u','t','e', 0,
- 'A','c','i','r','c','u','m','f','l','e','x', 0,
- 'A','d','i','e','r','e','s','i','s', 0,
- 'A','g','r','a','v','e', 0,
- 'A','r','i','n','g', 0,
- 'A','t','i','l','d','e', 0,
- 'C','c','e','d','i','l','l','a', 0,
- 'E','a','c','u','t','e', 0,
- 'E','c','i','r','c','u','m','f','l','e','x', 0,
- 'E','d','i','e','r','e','s','i','s', 0,
- 'E','g','r','a','v','e', 0,
- 'I','a','c','u','t','e', 0,
- 'I','c','i','r','c','u','m','f','l','e','x', 0,
- 'I','d','i','e','r','e','s','i','s', 0,
- 'I','g','r','a','v','e', 0,
- 'N','t','i','l','d','e', 0,
- 'O','a','c','u','t','e', 0,
- 'O','c','i','r','c','u','m','f','l','e','x', 0,
- 'O','d','i','e','r','e','s','i','s', 0,
- 'O','g','r','a','v','e', 0,
- 'O','t','i','l','d','e', 0,
- 'S','c','a','r','o','n', 0,
- 'U','a','c','u','t','e', 0,
- 'U','c','i','r','c','u','m','f','l','e','x', 0,
- 'U','d','i','e','r','e','s','i','s', 0,
- 'U','g','r','a','v','e', 0,
- 'Y','a','c','u','t','e', 0,
- 'Y','d','i','e','r','e','s','i','s', 0,
- 'Z','c','a','r','o','n', 0,
- 'a','a','c','u','t','e', 0,
- 'a','c','i','r','c','u','m','f','l','e','x', 0,
- 'a','d','i','e','r','e','s','i','s', 0,
- 'a','g','r','a','v','e', 0,
- 'a','r','i','n','g', 0,
- 'a','t','i','l','d','e', 0,
- 'c','c','e','d','i','l','l','a', 0,
- 'e','a','c','u','t','e', 0,
- 'e','c','i','r','c','u','m','f','l','e','x', 0,
- 'e','d','i','e','r','e','s','i','s', 0,
- 'e','g','r','a','v','e', 0,
- 'i','a','c','u','t','e', 0,
- 'i','c','i','r','c','u','m','f','l','e','x', 0,
- 'i','d','i','e','r','e','s','i','s', 0,
- 'i','g','r','a','v','e', 0,
- 'n','t','i','l','d','e', 0,
- 'o','a','c','u','t','e', 0,
- 'o','c','i','r','c','u','m','f','l','e','x', 0,
- 'o','d','i','e','r','e','s','i','s', 0,
- 'o','g','r','a','v','e', 0,
- 'o','t','i','l','d','e', 0,
- 's','c','a','r','o','n', 0,
- 'u','a','c','u','t','e', 0,
- 'u','c','i','r','c','u','m','f','l','e','x', 0,
- 'u','d','i','e','r','e','s','i','s', 0,
- 'u','g','r','a','v','e', 0,
- 'y','a','c','u','t','e', 0,
- 'y','d','i','e','r','e','s','i','s', 0,
- 'z','c','a','r','o','n', 0,
- 'e','x','c','l','a','m','s','m','a','l','l', 0,
- 'H','u','n','g','a','r','u','m','l','a','u','t','s','m','a','l','l', 0,
- 'd','o','l','l','a','r','o','l','d','s','t','y','l','e', 0,
- 'd','o','l','l','a','r','s','u','p','e','r','i','o','r', 0,
- 'a','m','p','e','r','s','a','n','d','s','m','a','l','l', 0,
- 'A','c','u','t','e','s','m','a','l','l', 0,
- 'p','a','r','e','n','l','e','f','t','s','u','p','e','r','i','o','r', 0,
- 'p','a','r','e','n','r','i','g','h','t','s','u','p','e','r','i','o','r', 0,
- 't','w','o','d','o','t','e','n','l','e','a','d','e','r', 0,
- 'o','n','e','d','o','t','e','n','l','e','a','d','e','r', 0,
- 'z','e','r','o','o','l','d','s','t','y','l','e', 0,
- 'o','n','e','o','l','d','s','t','y','l','e', 0,
- 't','w','o','o','l','d','s','t','y','l','e', 0,
- 't','h','r','e','e','o','l','d','s','t','y','l','e', 0,
- 'f','o','u','r','o','l','d','s','t','y','l','e', 0,
- 'f','i','v','e','o','l','d','s','t','y','l','e', 0,
- 's','i','x','o','l','d','s','t','y','l','e', 0,
- 's','e','v','e','n','o','l','d','s','t','y','l','e', 0,
- 'e','i','g','h','t','o','l','d','s','t','y','l','e', 0,
- 'n','i','n','e','o','l','d','s','t','y','l','e', 0,
- 'c','o','m','m','a','s','u','p','e','r','i','o','r', 0,
- 't','h','r','e','e','q','u','a','r','t','e','r','s','e','m','d','a','s','h', 0,
- 'p','e','r','i','o','d','s','u','p','e','r','i','o','r', 0,
- 'q','u','e','s','t','i','o','n','s','m','a','l','l', 0,
- 'a','s','u','p','e','r','i','o','r', 0,
- 'b','s','u','p','e','r','i','o','r', 0,
- 'c','e','n','t','s','u','p','e','r','i','o','r', 0,
- 'd','s','u','p','e','r','i','o','r', 0,
- 'e','s','u','p','e','r','i','o','r', 0,
- 'i','s','u','p','e','r','i','o','r', 0,
- 'l','s','u','p','e','r','i','o','r', 0,
- 'm','s','u','p','e','r','i','o','r', 0,
- 'n','s','u','p','e','r','i','o','r', 0,
- 'o','s','u','p','e','r','i','o','r', 0,
- 'r','s','u','p','e','r','i','o','r', 0,
- 's','s','u','p','e','r','i','o','r', 0,
- 't','s','u','p','e','r','i','o','r', 0,
- 'f','f', 0,
- 'f','f','i', 0,
- 'f','f','l', 0,
- 'p','a','r','e','n','l','e','f','t','i','n','f','e','r','i','o','r', 0,
- 'p','a','r','e','n','r','i','g','h','t','i','n','f','e','r','i','o','r', 0,
- 'C','i','r','c','u','m','f','l','e','x','s','m','a','l','l', 0,
- 'h','y','p','h','e','n','s','u','p','e','r','i','o','r', 0,
- 'G','r','a','v','e','s','m','a','l','l', 0,
- 'A','s','m','a','l','l', 0,
- 'B','s','m','a','l','l', 0,
- 'C','s','m','a','l','l', 0,
- 'D','s','m','a','l','l', 0,
- 'E','s','m','a','l','l', 0,
- 'F','s','m','a','l','l', 0,
- 'G','s','m','a','l','l', 0,
- 'H','s','m','a','l','l', 0,
- 'I','s','m','a','l','l', 0,
- 'J','s','m','a','l','l', 0,
- 'K','s','m','a','l','l', 0,
- 'L','s','m','a','l','l', 0,
- 'M','s','m','a','l','l', 0,
- 'N','s','m','a','l','l', 0,
- 'O','s','m','a','l','l', 0,
- 'P','s','m','a','l','l', 0,
- 'Q','s','m','a','l','l', 0,
- 'R','s','m','a','l','l', 0,
- 'S','s','m','a','l','l', 0,
- 'T','s','m','a','l','l', 0,
- 'U','s','m','a','l','l', 0,
- 'V','s','m','a','l','l', 0,
- 'W','s','m','a','l','l', 0,
- 'X','s','m','a','l','l', 0,
- 'Y','s','m','a','l','l', 0,
- 'Z','s','m','a','l','l', 0,
- 'c','o','l','o','n','m','o','n','e','t','a','r','y', 0,
- 'o','n','e','f','i','t','t','e','d', 0,
- 'r','u','p','i','a','h', 0,
- 'T','i','l','d','e','s','m','a','l','l', 0,
- 'e','x','c','l','a','m','d','o','w','n','s','m','a','l','l', 0,
- 'c','e','n','t','o','l','d','s','t','y','l','e', 0,
- 'L','s','l','a','s','h','s','m','a','l','l', 0,
- 'S','c','a','r','o','n','s','m','a','l','l', 0,
- 'Z','c','a','r','o','n','s','m','a','l','l', 0,
- 'D','i','e','r','e','s','i','s','s','m','a','l','l', 0,
- 'B','r','e','v','e','s','m','a','l','l', 0,
- 'C','a','r','o','n','s','m','a','l','l', 0,
- 'D','o','t','a','c','c','e','n','t','s','m','a','l','l', 0,
- 'M','a','c','r','o','n','s','m','a','l','l', 0,
- 'f','i','g','u','r','e','d','a','s','h', 0,
- 'h','y','p','h','e','n','i','n','f','e','r','i','o','r', 0,
- 'O','g','o','n','e','k','s','m','a','l','l', 0,
- 'R','i','n','g','s','m','a','l','l', 0,
- 'C','e','d','i','l','l','a','s','m','a','l','l', 0,
- 'q','u','e','s','t','i','o','n','d','o','w','n','s','m','a','l','l', 0,
- 'o','n','e','e','i','g','h','t','h', 0,
- 't','h','r','e','e','e','i','g','h','t','h','s', 0,
- 'f','i','v','e','e','i','g','h','t','h','s', 0,
- 's','e','v','e','n','e','i','g','h','t','h','s', 0,
- 'o','n','e','t','h','i','r','d', 0,
- 't','w','o','t','h','i','r','d','s', 0,
- 'z','e','r','o','s','u','p','e','r','i','o','r', 0,
- 'f','o','u','r','s','u','p','e','r','i','o','r', 0,
- 'f','i','v','e','s','u','p','e','r','i','o','r', 0,
- 's','i','x','s','u','p','e','r','i','o','r', 0,
- 's','e','v','e','n','s','u','p','e','r','i','o','r', 0,
- 'e','i','g','h','t','s','u','p','e','r','i','o','r', 0,
- 'n','i','n','e','s','u','p','e','r','i','o','r', 0,
- 'z','e','r','o','i','n','f','e','r','i','o','r', 0,
- 'o','n','e','i','n','f','e','r','i','o','r', 0,
- 't','w','o','i','n','f','e','r','i','o','r', 0,
- 't','h','r','e','e','i','n','f','e','r','i','o','r', 0,
- 'f','o','u','r','i','n','f','e','r','i','o','r', 0,
- 'f','i','v','e','i','n','f','e','r','i','o','r', 0,
- 's','i','x','i','n','f','e','r','i','o','r', 0,
- 's','e','v','e','n','i','n','f','e','r','i','o','r', 0,
- 'e','i','g','h','t','i','n','f','e','r','i','o','r', 0,
- 'n','i','n','e','i','n','f','e','r','i','o','r', 0,
- 'c','e','n','t','i','n','f','e','r','i','o','r', 0,
- 'd','o','l','l','a','r','i','n','f','e','r','i','o','r', 0,
- 'p','e','r','i','o','d','i','n','f','e','r','i','o','r', 0,
- 'c','o','m','m','a','i','n','f','e','r','i','o','r', 0,
- 'A','g','r','a','v','e','s','m','a','l','l', 0,
- 'A','a','c','u','t','e','s','m','a','l','l', 0,
- 'A','c','i','r','c','u','m','f','l','e','x','s','m','a','l','l', 0,
- 'A','t','i','l','d','e','s','m','a','l','l', 0,
- 'A','d','i','e','r','e','s','i','s','s','m','a','l','l', 0,
- 'A','r','i','n','g','s','m','a','l','l', 0,
- 'A','E','s','m','a','l','l', 0,
- 'C','c','e','d','i','l','l','a','s','m','a','l','l', 0,
- 'E','g','r','a','v','e','s','m','a','l','l', 0,
- 'E','a','c','u','t','e','s','m','a','l','l', 0,
- 'E','c','i','r','c','u','m','f','l','e','x','s','m','a','l','l', 0,
- 'E','d','i','e','r','e','s','i','s','s','m','a','l','l', 0,
- 'I','g','r','a','v','e','s','m','a','l','l', 0,
- 'I','a','c','u','t','e','s','m','a','l','l', 0,
- 'I','c','i','r','c','u','m','f','l','e','x','s','m','a','l','l', 0,
- 'I','d','i','e','r','e','s','i','s','s','m','a','l','l', 0,
- 'E','t','h','s','m','a','l','l', 0,
- 'N','t','i','l','d','e','s','m','a','l','l', 0,
- 'O','g','r','a','v','e','s','m','a','l','l', 0,
- 'O','a','c','u','t','e','s','m','a','l','l', 0,
- 'O','c','i','r','c','u','m','f','l','e','x','s','m','a','l','l', 0,
- 'O','t','i','l','d','e','s','m','a','l','l', 0,
- 'O','d','i','e','r','e','s','i','s','s','m','a','l','l', 0,
- 'O','E','s','m','a','l','l', 0,
- 'O','s','l','a','s','h','s','m','a','l','l', 0,
- 'U','g','r','a','v','e','s','m','a','l','l', 0,
- 'U','a','c','u','t','e','s','m','a','l','l', 0,
- 'U','c','i','r','c','u','m','f','l','e','x','s','m','a','l','l', 0,
- 'U','d','i','e','r','e','s','i','s','s','m','a','l','l', 0,
- 'Y','a','c','u','t','e','s','m','a','l','l', 0,
- 'T','h','o','r','n','s','m','a','l','l', 0,
- 'Y','d','i','e','r','e','s','i','s','s','m','a','l','l', 0,
- '0','0','1','.','0','0','0', 0,
- '0','0','1','.','0','0','1', 0,
- '0','0','1','.','0','0','2', 0,
- '0','0','1','.','0','0','3', 0,
- 'B','l','a','c','k', 0,
- 'B','o','l','d', 0,
- 'B','o','o','k', 0,
- 'L','i','g','h','t', 0,
- 'M','e','d','i','u','m', 0,
- 'R','e','g','u','l','a','r', 0,
- 'R','o','m','a','n', 0,
- 'S','e','m','i','b','o','l','d', 0,
- };
-
-
-#define FT_NUM_MAC_NAMES 258
-
- /* Values are offsets into the `ft_standard_glyph_names' table */
-
- static const short ft_mac_names[FT_NUM_MAC_NAMES] =
- {
- 253, 0, 6, 261, 267, 274, 283, 294, 301, 309, 758, 330, 340, 351,
- 360, 365, 371, 378, 385, 391, 396, 400, 404, 410, 415, 420, 424, 430,
- 436, 441, 447, 457, 462, 468, 476, 485, 488, 490, 492, 494, 496, 498,
- 500, 502, 504, 506, 508, 510, 512, 514, 516, 518, 520, 522, 524, 526,
- 528, 530, 532, 534, 536, 538, 540, 552, 562, 575, 587, 979, 608, 610,
- 612, 614, 616, 618, 620, 622, 624, 626, 628, 630, 632, 634, 636, 638,
- 640, 642, 644, 646, 648, 650, 652, 654, 656, 658, 660, 670, 674, 685,
- 1375,1392,1405,1414,1486,1512,1562,1603,1632,1610,1622,1645,1639,1652,
- 1661,1690,1668,1680,1697,1726,1704,1716,1733,1740,1769,1747,1759,1776,
- 1790,1819,1797,1809, 839,1263, 707, 712, 741, 881, 871,1160,1302,1346,
- 1197, 985,1031, 23,1086,1108, 32,1219, 41, 51, 730,1194, 64, 76,
- 86, 94, 97,1089,1118, 106,1131,1150, 966, 696,1183, 112, 734, 120,
- 132, 783, 930, 945, 138,1385,1398,1529,1115,1157, 832,1079, 770, 916,
- 598, 319,1246, 155,1833,1586, 721, 749, 797, 811, 826, 829, 846, 856,
- 888, 903, 954,1363,1421,1356,1433,1443,1450,1457,1469,1479,1493,1500,
- 163,1522,1543,1550,1572,1134, 991,1002,1008,1015,1021,1040,1045,1053,
- 1066,1073,1101,1143,1536,1783,1596,1843,1253,1207,1319,1579,1826,1229,
- 1270,1313,1323,1171,1290,1332,1211,1235,1276, 169, 175, 182, 189, 200,
- 209, 218, 225, 232, 239, 246
- };
-
-
-#define FT_NUM_SID_NAMES 391
-
- /* Values are offsets into the `ft_standard_glyph_names' table */
-
- static const short ft_sid_names[FT_NUM_SID_NAMES] =
- {
- 253, 261, 267, 274, 283, 294, 301, 309, 319, 330, 340, 351, 360, 365,
- 371, 378, 385, 391, 396, 400, 404, 410, 415, 420, 424, 430, 436, 441,
- 447, 457, 462, 468, 476, 485, 488, 490, 492, 494, 496, 498, 500, 502,
- 504, 506, 508, 510, 512, 514, 516, 518, 520, 522, 524, 526, 528, 530,
- 532, 534, 536, 538, 540, 552, 562, 575, 587, 598, 608, 610, 612, 614,
- 616, 618, 620, 622, 624, 626, 628, 630, 632, 634, 636, 638, 640, 642,
- 644, 646, 648, 650, 652, 654, 656, 658, 660, 670, 674, 685, 696, 707,
- 712, 721, 730, 734, 741, 749, 758, 770, 783, 797, 811, 826, 829, 832,
- 839, 846, 856, 871, 881, 888, 903, 916, 930, 945, 954, 966, 979, 985,
- 991,1002,1008,1015,1021,1031,1040,1045,1053,1066,1073,1079,1086,1089,
- 1101,1108,1115,1118,1131,1134,1143,1150,1157,1160,1171,1183,1194,1197,
- 1207,1211,1219,1229,1235,1246,1253,1263,1270,1276,1290,1302,1313,1319,
- 1323,1332,1346,1356,1363,1375,1385,1392,1398,1405,1414,1421,1433,1443,
- 1450,1457,1469,1479,1486,1493,1500,1512,1522,1529,1536,1543,1550,1562,
- 1572,1579,1586,1596,1603,1610,1622,1632,1639,1645,1652,1661,1668,1680,
- 1690,1697,1704,1716,1726,1733,1740,1747,1759,1769,1776,1783,1790,1797,
- 1809,1819,1826,1833,1843,1850,1862,1880,1895,1910,1925,1936,1954,1973,
- 1988,2003,2016,2028,2040,2054,2067,2080,2092,2106,2120,2133,2147,2167,
- 2182,2196,2206,2216,2229,2239,2249,2259,2269,2279,2289,2299,2309,2319,
- 2329,2332,2336,2340,2358,2377,2393,2408,2419,2426,2433,2440,2447,2454,
- 2461,2468,2475,2482,2489,2496,2503,2510,2517,2524,2531,2538,2545,2552,
- 2559,2566,2573,2580,2587,2594,2601,2615,2625,2632,2643,2659,2672,2684,
- 2696,2708,2722,2733,2744,2759,2771,2782,2797,2809,2819,2832,2850,2860,
- 2873,2885,2898,2907,2917,2930,2943,2956,2968,2982,2996,3009,3022,3034,
- 3046,3060,3073,3086,3098,3112,3126,3139,3152,3167,3182,3196,3208,3220,
- 3237,3249,3264,3275,3283,3297,3309,3321,3338,3353,3365,3377,3394,3409,
- 3418,3430,3442,3454,3471,3483,3498,3506,3518,3530,3542,3559,3574,3586,
- 3597,3612,3620,3628,3636,3644,3650,3655,3660,3666,3673,3681,3687
- };
-
-
- /* the following are indices into the SID name table */
- static const unsigned short t1_standard_encoding[256] =
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
- 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
- 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
- 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
- 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
- 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 96, 97, 98, 99,100,101,102,103,104,105,106,107,108,109,110,
- 0,111,112,113,114, 0,115,116,117,118,119,120,121,122, 0,123,
- 0,124,125,126,127,128,129,130,131, 0,132,133, 0,134,135,136,
- 137, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0,138, 0,139, 0, 0, 0, 0,140,141,142,143, 0, 0, 0, 0,
- 0,144, 0, 0, 0,145, 0, 0,146,147,148,149, 0, 0, 0, 0
- };
-
-
- /* the following are indices into the SID name table */
- static const unsigned short t1_expert_encoding[256] =
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1,229,230, 0,231,232,233,234,235,236,237,238, 13, 14, 15, 99,
- 239,240,241,242,243,244,245,246,247,248, 27, 28,249,250,251,252,
- 0,253,254,255,256,257, 0, 0, 0,258, 0, 0,259,260,261,262,
- 0, 0,263,264,265, 0,266,109,110,267,268,269, 0,270,271,272,
- 273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,
- 289,290,291,292,293,294,295,296,297,298,299,300,301,302,303, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0,304,305,306, 0, 0,307,308,309,310,311, 0,312, 0, 0,313,
- 0, 0,314,315, 0, 0,316,317,318, 0, 0, 0,158,155,163,319,
- 320,321,322,323,324,325, 0, 0,326,150,164,169,327,328,329,330,
- 331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,
- 347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,
- 363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378
- };
-
-
- /*
- * This table is a compressed version of the Adobe Glyph List (AGL),
- * optimized for efficient searching. It has been generated by the
- * `glnames.py' python script located in the `src/tools' directory.
- *
- * The lookup function to get the Unicode value for a given string
- * is defined below the table.
- */
-
-#ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST
-
- static const unsigned char ft_adobe_glyph_list[55997L] =
- {
- 0, 52, 0,106, 2,167, 3, 63, 4,220, 6,125, 9,143, 10, 23,
- 11,137, 12,199, 14,246, 15, 87, 16,233, 17,219, 18,104, 19, 88,
- 22,110, 23, 32, 23, 71, 24, 77, 27,156, 29, 73, 31,247, 32,107,
- 32,222, 33, 55, 34,154, 35,218, 58, 10, 64,122, 72,188, 80,109,
- 88,104, 93, 61, 98,168,106, 91,114,111,115,237,122,180,127,255,
- 135,164,143,132,149,213,158,108,161,115,168,175,183,147,197,199,
- 202, 25,204,166,208,209,209, 81,215, 26, 65,143, 0, 65, 0,140,
- 0,175, 0,193, 1, 15, 1,147, 1,233, 1,251, 2, 7, 2, 40,
- 2, 57, 2, 82, 2, 91, 2,128, 2,136, 2,154, 69,131, 0,198,
- 0,150, 0,158, 0,167,225,227,245,244,101,128, 1,252,237,225,
- 227,242,239,110,128, 1,226,243,237,225,236,108,128,247,230,225,
- 227,245,244,101,129, 0,193, 0,185,243,237,225,236,108,128,247,
- 225,226,242,229,246,101,134, 1, 2, 0,213, 0,221, 0,232, 0,
- 243, 0,251, 1, 7,225,227,245,244,101,128, 30,174,227,249,242,
- 233,236,236,233, 99,128, 4,208,228,239,244,226,229,236,239,119,
- 128, 30,182,231,242,225,246,101,128, 30,176,232,239,239,235,225,
- 226,239,246,101,128, 30,178,244,233,236,228,101,128, 30,180, 99,
- 4, 1, 25, 1, 32, 1,121, 1,137,225,242,239,110,128, 1,205,
- 233,242, 99, 2, 1, 40, 1, 45,236,101,128, 36,182,245,237,230,
- 236,229,120,134, 0,194, 1, 66, 1, 74, 1, 85, 1, 93, 1,105,
- 1,113,225,227,245,244,101,128, 30,164,228,239,244,226,229,236,
- 239,119,128, 30,172,231,242,225,246,101,128, 30,166,232,239,239,
- 235,225,226,239,246,101,128, 30,168,243,237,225,236,108,128,247,
- 226,244,233,236,228,101,128, 30,170,245,244,101,129,246,201, 1,
- 129,243,237,225,236,108,128,247,180,249,242,233,236,236,233, 99,
- 128, 4, 16,100, 3, 1,155, 1,165, 1,209,226,236,231,242,225,
- 246,101,128, 2, 0,233,229,242,229,243,233,115,131, 0,196, 1,
- 181, 1,192, 1,201,227,249,242,233,236,236,233, 99,128, 4,210,
- 237,225,227,242,239,110,128, 1,222,243,237,225,236,108,128,247,
- 228,239,116, 2, 1,216, 1,224,226,229,236,239,119,128, 30,160,
- 237,225,227,242,239,110,128, 1,224,231,242,225,246,101,129, 0,
- 192, 1,243,243,237,225,236,108,128,247,224,232,239,239,235,225,
- 226,239,246,101,128, 30,162,105, 2, 2, 13, 2, 25,229,227,249,
- 242,233,236,236,233, 99,128, 4,212,238,246,229,242,244,229,228,
- 226,242,229,246,101,128, 2, 2,236,240,232, 97,129, 3,145, 2,
- 49,244,239,238,239,115,128, 3,134,109, 2, 2, 63, 2, 71,225,
- 227,242,239,110,128, 1, 0,239,238,239,243,240,225,227,101,128,
- 255, 33,239,231,239,238,229,107,128, 1, 4,242,233,238,103,131,
- 0,197, 2,104, 2,112, 2,120,225,227,245,244,101,128, 1,250,
- 226,229,236,239,119,128, 30, 0,243,237,225,236,108,128,247,229,
- 243,237,225,236,108,128,247, 97,244,233,236,228,101,129, 0,195,
- 2,146,243,237,225,236,108,128,247,227,249,226,225,242,237,229,
- 238,233,225,110,128, 5, 49, 66,137, 0, 66, 2,189, 2,198, 2,
- 223, 3, 3, 3, 10, 3, 22, 3, 34, 3, 46, 3, 54,227,233,242,
- 227,236,101,128, 36,183,228,239,116, 2, 2,206, 2,215,225,227,
- 227,229,238,116,128, 30, 2,226,229,236,239,119,128, 30, 4,101,
- 3, 2,231, 2,242, 2,254,227,249,242,233,236,236,233, 99,128,
- 4, 17,238,225,242,237,229,238,233,225,110,128, 5, 50,244, 97,
- 128, 3,146,232,239,239,107,128, 1,129,236,233,238,229,226,229,
- 236,239,119,128, 30, 6,237,239,238,239,243,240,225,227,101,128,
- 255, 34,242,229,246,229,243,237,225,236,108,128,246,244,243,237,
- 225,236,108,128,247, 98,244,239,240,226,225,114,128, 1,130, 67,
- 137, 0, 67, 3, 85, 3,127, 3,193, 3,210, 3,224, 4,171, 4,
- 188, 4,200, 4,212, 97, 3, 3, 93, 3,104, 3,111,225,242,237,
- 229,238,233,225,110,128, 5, 62,227,245,244,101,128, 1, 6,242,
- 239,110,129,246,202, 3,119,243,237,225,236,108,128,246,245, 99,
- 3, 3,135, 3,142, 3,171,225,242,239,110,128, 1, 12,229,228,
- 233,236,236, 97,130, 0,199, 3,155, 3,163,225,227,245,244,101,
- 128, 30, 8,243,237,225,236,108,128,247,231,233,242, 99, 2, 3,
- 179, 3,184,236,101,128, 36,184,245,237,230,236,229,120,128, 1,
- 8,228,239,116,129, 1, 10, 3,201,225,227,227,229,238,116,128,
- 1, 10,229,228,233,236,236,225,243,237,225,236,108,128,247,184,
- 104, 4, 3,234, 3,246, 4,161, 4,165,225,225,242,237,229,238,
- 233,225,110,128, 5, 73,101, 6, 4, 4, 4, 24, 4, 35, 4,103,
- 4,115, 4,136,225,226,235,232,225,243,233,225,238,227,249,242,
- 233,236,236,233, 99,128, 4,188,227,249,242,233,236,236,233, 99,
- 128, 4, 39,100, 2, 4, 41, 4, 85,229,243,227,229,238,228,229,
- 114, 2, 4, 54, 4, 74,225,226,235,232,225,243,233,225,238,227,
- 249,242,233,236,236,233, 99,128, 4,190,227,249,242,233,236,236,
- 233, 99,128, 4,182,233,229,242,229,243,233,243,227,249,242,233,
- 236,236,233, 99,128, 4,244,232,225,242,237,229,238,233,225,110,
- 128, 5, 67,235,232,225,235,225,243,243,233,225,238,227,249,242,
- 233,236,236,233, 99,128, 4,203,246,229,242,244,233,227,225,236,
- 243,244,242,239,235,229,227,249,242,233,236,236,233, 99,128, 4,
- 184,105,128, 3,167,239,239,107,128, 1,135,233,242,227,245,237,
- 230,236,229,248,243,237,225,236,108,128,246,246,237,239,238,239,
- 243,240,225,227,101,128,255, 35,239,225,242,237,229,238,233,225,
- 110,128, 5, 81,243,237,225,236,108,128,247, 99, 68,142, 0, 68,
- 4,252, 5, 10, 5, 36, 5, 96, 5,121, 5,166, 5,173, 5,231,
- 5,244, 6, 0, 6, 12, 6, 28, 6, 48, 6, 57, 90,129, 1,241,
- 5, 2,227,225,242,239,110,128, 1,196, 97, 2, 5, 16, 5, 27,
- 225,242,237,229,238,233,225,110,128, 5, 52,230,242,233,227,225,
- 110,128, 1,137, 99, 4, 5, 46, 5, 53, 5, 62, 5, 89,225,242,
- 239,110,128, 1, 14,229,228,233,236,236, 97,128, 30, 16,233,242,
- 99, 2, 5, 70, 5, 75,236,101,128, 36,185,245,237,230,236,229,
- 248,226,229,236,239,119,128, 30, 18,242,239,225,116,128, 1, 16,
- 228,239,116, 2, 5,104, 5,113,225,227,227,229,238,116,128, 30,
- 10,226,229,236,239,119,128, 30, 12,101, 3, 5,129, 5,140, 5,
- 150,227,249,242,233,236,236,233, 99,128, 4, 20,233,227,239,240,
- 244,233, 99,128, 3,238,236,244, 97,129, 34, 6, 5,158,231,242,
- 229,229,107,128, 3,148,232,239,239,107,128, 1,138,105, 2, 5,
- 179, 5,218,229,242,229,243,233,115,131,246,203, 5,194, 5,202,
- 5,210,193,227,245,244,101,128,246,204,199,242,225,246,101,128,
- 246,205,243,237,225,236,108,128,247,168,231,225,237,237,225,231,
- 242,229,229,107,128, 3,220,234,229,227,249,242,233,236,236,233,
- 99,128, 4, 2,236,233,238,229,226,229,236,239,119,128, 30, 14,
- 237,239,238,239,243,240,225,227,101,128,255, 36,239,244,225,227,
- 227,229,238,244,243,237,225,236,108,128,246,247,115, 2, 6, 34,
- 6, 41,236,225,243,104,128, 1, 16,237,225,236,108,128,247,100,
- 244,239,240,226,225,114,128, 1,139,122,131, 1,242, 6, 67, 6,
- 75, 6,112,227,225,242,239,110,128, 1,197,101, 2, 6, 81, 6,
- 101,225,226,235,232,225,243,233,225,238,227,249,242,233,236,236,
- 233, 99,128, 4,224,227,249,242,233,236,236,233, 99,128, 4, 5,
- 232,229,227,249,242,233,236,236,233, 99,128, 4, 15, 69,146, 0,
- 69, 6,165, 6,183, 6,191, 7, 89, 7,153, 7,165, 7,183, 7,
- 211, 8, 7, 8, 36, 8, 94, 8,169, 8,189, 8,208, 8,248, 9,
- 44, 9,109, 9,115,225,227,245,244,101,129, 0,201, 6,175,243,
- 237,225,236,108,128,247,233,226,242,229,246,101,128, 1, 20, 99,
- 5, 6,203, 6,210, 6,224, 6,236, 7, 79,225,242,239,110,128,
- 1, 26,229,228,233,236,236,225,226,242,229,246,101,128, 30, 28,
- 232,225,242,237,229,238,233,225,110,128, 5, 53,233,242, 99, 2,
- 6,244, 6,249,236,101,128, 36,186,245,237,230,236,229,120,135,
- 0,202, 7, 16, 7, 24, 7, 32, 7, 43, 7, 51, 7, 63, 7, 71,
- 225,227,245,244,101,128, 30,190,226,229,236,239,119,128, 30, 24,
- 228,239,244,226,229,236,239,119,128, 30,198,231,242,225,246,101,
- 128, 30,192,232,239,239,235,225,226,239,246,101,128, 30,194,243,
- 237,225,236,108,128,247,234,244,233,236,228,101,128, 30,196,249,
- 242,233,236,236,233, 99,128, 4, 4,100, 3, 7, 97, 7,107, 7,
- 127,226,236,231,242,225,246,101,128, 2, 4,233,229,242,229,243,
- 233,115,129, 0,203, 7,119,243,237,225,236,108,128,247,235,239,
- 116,130, 1, 22, 7,136, 7,145,225,227,227,229,238,116,128, 1,
- 22,226,229,236,239,119,128, 30,184,230,227,249,242,233,236,236,
- 233, 99,128, 4, 36,231,242,225,246,101,129, 0,200, 7,175,243,
- 237,225,236,108,128,247,232,104, 2, 7,189, 7,200,225,242,237,
- 229,238,233,225,110,128, 5, 55,239,239,235,225,226,239,246,101,
- 128, 30,186,105, 3, 7,219, 7,230, 7,245,231,232,244,242,239,
- 237,225,110,128, 33,103,238,246,229,242,244,229,228,226,242,229,
- 246,101,128, 2, 6,239,244,233,230,233,229,228,227,249,242,233,
- 236,236,233, 99,128, 4,100,108, 2, 8, 13, 8, 24,227,249,242,
- 233,236,236,233, 99,128, 4, 27,229,246,229,238,242,239,237,225,
- 110,128, 33,106,109, 3, 8, 44, 8, 72, 8, 83,225,227,242,239,
- 110,130, 1, 18, 8, 56, 8, 64,225,227,245,244,101,128, 30, 22,
- 231,242,225,246,101,128, 30, 20,227,249,242,233,236,236,233, 99,
- 128, 4, 28,239,238,239,243,240,225,227,101,128,255, 37,110, 4,
- 8,104, 8,115, 8,135, 8,154,227,249,242,233,236,236,233, 99,
- 128, 4, 29,228,229,243,227,229,238,228,229,242,227,249,242,233,
- 236,236,233, 99,128, 4,162,103,129, 1, 74, 8,141,232,229,227,
- 249,242,233,236,236,233, 99,128, 4,164,232,239,239,235,227,249,
- 242,233,236,236,233, 99,128, 4,199,111, 2, 8,175, 8,183,231,
- 239,238,229,107,128, 1, 24,240,229,110,128, 1,144,240,243,233,
- 236,239,110,129, 3,149, 8,200,244,239,238,239,115,128, 3,136,
- 114, 2, 8,214, 8,225,227,249,242,233,236,236,233, 99,128, 4,
- 32,229,246,229,242,243,229,100,129, 1,142, 8,237,227,249,242,
- 233,236,236,233, 99,128, 4, 45,115, 4, 9, 2, 9, 13, 9, 33,
- 9, 37,227,249,242,233,236,236,233, 99,128, 4, 33,228,229,243,
- 227,229,238,228,229,242,227,249,242,233,236,236,233, 99,128, 4,
- 170,104,128, 1,169,237,225,236,108,128,247,101,116, 3, 9, 52,
- 9, 78, 9, 92, 97,130, 3,151, 9, 60, 9, 70,242,237,229,238,
- 233,225,110,128, 5, 56,244,239,238,239,115,128, 3,137,104,129,
- 0,208, 9, 84,243,237,225,236,108,128,247,240,233,236,228,101,
- 129, 30,188, 9,101,226,229,236,239,119,128, 30, 26,245,242,111,
- 128, 32,172,250,104,130, 1,183, 9,124, 9,132,227,225,242,239,
- 110,128, 1,238,242,229,246,229,242,243,229,100,128, 1,184, 70,
- 136, 0, 70, 9,163, 9,172, 9,184, 9,212, 9,219, 9,248, 10,
- 4, 10, 15,227,233,242,227,236,101,128, 36,187,228,239,244,225,
- 227,227,229,238,116,128, 30, 30,101, 2, 9,190, 9,202,232,225,
- 242,237,229,238,233,225,110,128, 5, 86,233,227,239,240,244,233,
- 99,128, 3,228,232,239,239,107,128, 1,145,105, 2, 9,225, 9,
- 238,244,225,227,249,242,233,236,236,233, 99,128, 4,114,246,229,
- 242,239,237,225,110,128, 33,100,237,239,238,239,243,240,225,227,
- 101,128,255, 38,239,245,242,242,239,237,225,110,128, 33, 99,243,
- 237,225,236,108,128,247,102, 71,140, 0, 71, 10, 51, 10, 61, 10,
- 107, 10,115, 10,176, 10,193, 10,205, 11, 39, 11, 52, 11, 65, 11,
- 90, 11,107,194,243,241,245,225,242,101,128, 51,135, 97, 3, 10,
- 69, 10, 76, 10, 94,227,245,244,101,128, 1,244,237,237, 97,129,
- 3,147, 10, 84,225,230,242,233,227,225,110,128, 1,148,238,231,
- 233,225,227,239,240,244,233, 99,128, 3,234,226,242,229,246,101,
- 128, 1, 30, 99, 4, 10,125, 10,132, 10,141, 10,163,225,242,239,
- 110,128, 1,230,229,228,233,236,236, 97,128, 1, 34,233,242, 99,
- 2, 10,149, 10,154,236,101,128, 36,188,245,237,230,236,229,120,
- 128, 1, 28,239,237,237,225,225,227,227,229,238,116,128, 1, 34,
- 228,239,116,129, 1, 32, 10,184,225,227,227,229,238,116,128, 1,
- 32,229,227,249,242,233,236,236,233, 99,128, 4, 19,104, 3, 10,
- 213, 10,226, 11, 33,225,228,225,242,237,229,238,233,225,110,128,
- 5, 66,101, 3, 10,234, 10,255, 11, 16,237,233,228,228,236,229,
- 232,239,239,235,227,249,242,233,236,236,233, 99,128, 4,148,243,
- 244,242,239,235,229,227,249,242,233,236,236,233, 99,128, 4,146,
- 245,240,244,245,242,238,227,249,242,233,236,236,233, 99,128, 4,
- 144,239,239,107,128, 1,147,233,237,225,242,237,229,238,233,225,
- 110,128, 5, 51,234,229,227,249,242,233,236,236,233, 99,128, 4,
- 3,109, 2, 11, 71, 11, 79,225,227,242,239,110,128, 30, 32,239,
- 238,239,243,240,225,227,101,128,255, 39,242,225,246,101,129,246,
- 206, 11, 99,243,237,225,236,108,128,247, 96,115, 2, 11,113, 11,
- 129,237,225,236,108,129,247,103, 11,122,232,239,239,107,128, 2,
- 155,244,242,239,235,101,128, 1,228, 72,140, 0, 72, 11,165, 11,
- 190, 11,198, 11,208, 12, 17, 12, 40, 12, 77, 12,117, 12,129, 12,
- 157, 12,165, 12,189,177,184, 53, 3, 11,175, 11,180, 11,185,179,
- 51,128, 37,207,180, 51,128, 37,170,181, 49,128, 37,171,178,178,
- 176,183, 51,128, 37,161,208,243,241,245,225,242,101,128, 51,203,
- 97, 3, 11,216, 11,236, 12, 0,225,226,235,232,225,243,233,225,
- 238,227,249,242,233,236,236,233, 99,128, 4,168,228,229,243,227,
- 229,238,228,229,242,227,249,242,233,236,236,233, 99,128, 4,178,
- 242,228,243,233,231,238,227,249,242,233,236,236,233, 99,128, 4,
- 42, 98, 2, 12, 23, 12, 28,225,114,128, 1, 38,242,229,246,229,
- 226,229,236,239,119,128, 30, 42, 99, 2, 12, 46, 12, 55,229,228,
- 233,236,236, 97,128, 30, 40,233,242, 99, 2, 12, 63, 12, 68,236,
- 101,128, 36,189,245,237,230,236,229,120,128, 1, 36,100, 2, 12,
- 83, 12, 93,233,229,242,229,243,233,115,128, 30, 38,239,116, 2,
- 12,100, 12,109,225,227,227,229,238,116,128, 30, 34,226,229,236,
- 239,119,128, 30, 36,237,239,238,239,243,240,225,227,101,128,255,
- 40,111, 2, 12,135, 12,146,225,242,237,229,238,233,225,110,128,
- 5, 64,242,233,227,239,240,244,233, 99,128, 3,232,243,237,225,
- 236,108,128,247,104,245,238,231,225,242,245,237,236,225,245,116,
- 129,246,207, 12,181,243,237,225,236,108,128,246,248,250,243,241,
- 245,225,242,101,128, 51,144, 73,146, 0, 73, 12,239, 12,251, 12,
- 255, 13, 11, 13, 29, 13, 37, 13, 94, 13,181, 13,214, 13,224, 13,
- 242, 13,254, 14, 48, 14, 86, 14, 99, 14,166, 14,187, 14,205,193,
- 227,249,242,233,236,236,233, 99,128, 4, 47, 74,128, 1, 50,213,
- 227,249,242,233,236,236,233, 99,128, 4, 46,225,227,245,244,101,
- 129, 0,205, 13, 21,243,237,225,236,108,128,247,237,226,242,229,
- 246,101,128, 1, 44, 99, 3, 13, 45, 13, 52, 13, 84,225,242,239,
- 110,128, 1,207,233,242, 99, 2, 13, 60, 13, 65,236,101,128, 36,
- 190,245,237,230,236,229,120,129, 0,206, 13, 76,243,237,225,236,
- 108,128,247,238,249,242,233,236,236,233, 99,128, 4, 6,100, 3,
- 13,102, 13,112, 13,155,226,236,231,242,225,246,101,128, 2, 8,
- 233,229,242,229,243,233,115,131, 0,207, 13,128, 13,136, 13,147,
- 225,227,245,244,101,128, 30, 46,227,249,242,233,236,236,233, 99,
- 128, 4,228,243,237,225,236,108,128,247,239,239,116,130, 1, 48,
- 13,164, 13,173,225,227,227,229,238,116,128, 1, 48,226,229,236,
- 239,119,128, 30,202,101, 2, 13,187, 13,203,226,242,229,246,229,
- 227,249,242,233,236,236,233, 99,128, 4,214,227,249,242,233,236,
- 236,233, 99,128, 4, 21,230,242,225,235,244,245,114,128, 33, 17,
- 231,242,225,246,101,129, 0,204, 13,234,243,237,225,236,108,128,
- 247,236,232,239,239,235,225,226,239,246,101,128, 30,200,105, 3,
- 14, 6, 14, 17, 14, 32,227,249,242,233,236,236,233, 99,128, 4,
- 24,238,246,229,242,244,229,228,226,242,229,246,101,128, 2, 10,
- 243,232,239,242,244,227,249,242,233,236,236,233, 99,128, 4, 25,
- 109, 2, 14, 54, 14, 75,225,227,242,239,110,129, 1, 42, 14, 64,
- 227,249,242,233,236,236,233, 99,128, 4,226,239,238,239,243,240,
- 225,227,101,128,255, 41,238,233,225,242,237,229,238,233,225,110,
- 128, 5, 59,111, 3, 14,107, 14,118, 14,126,227,249,242,233,236,
- 236,233, 99,128, 4, 1,231,239,238,229,107,128, 1, 46,244, 97,
- 131, 3,153, 14,137, 14,147, 14,158,225,230,242,233,227,225,110,
- 128, 1,150,228,233,229,242,229,243,233,115,128, 3,170,244,239,
- 238,239,115,128, 3,138,115, 2, 14,172, 14,179,237,225,236,108,
- 128,247,105,244,242,239,235,101,128, 1,151,244,233,236,228,101,
- 129, 1, 40, 14,197,226,229,236,239,119,128, 30, 44,250,232,233,
- 244,243, 97, 2, 14,216, 14,227,227,249,242,233,236,236,233, 99,
- 128, 4,116,228,226,236,231,242,225,246,229,227,249,242,233,236,
- 236,233, 99,128, 4,118, 74,134, 0, 74, 15, 6, 15, 18, 15, 41,
- 15, 53, 15, 67, 15, 79,225,225,242,237,229,238,233,225,110,128,
- 5, 65,227,233,242, 99, 2, 15, 27, 15, 32,236,101,128, 36,191,
- 245,237,230,236,229,120,128, 1, 52,229,227,249,242,233,236,236,
- 233, 99,128, 4, 8,232,229,232,225,242,237,229,238,233,225,110,
- 128, 5, 75,237,239,238,239,243,240,225,227,101,128,255, 42,243,
- 237,225,236,108,128,247,106, 75,140, 0, 75, 15,115, 15,125, 15,
- 135, 16, 18, 16, 65, 16, 76, 16,106, 16,143, 16,156, 16,168, 16,
- 180, 16,208,194,243,241,245,225,242,101,128, 51,133,203,243,241,
- 245,225,242,101,128, 51,205, 97, 7, 15,151, 15,169, 15,191, 15,
- 211, 15,226, 15,232, 15,249,226,225,243,232,235,233,242,227,249,
- 242,233,236,236,233, 99,128, 4,160, 99, 2, 15,175, 15,181,245,
- 244,101,128, 30, 48,249,242,233,236,236,233, 99,128, 4, 26,228,
- 229,243,227,229,238,228,229,242,227,249,242,233,236,236,233, 99,
- 128, 4,154,232,239,239,235,227,249,242,233,236,236,233, 99,128,
- 4,195,240,240, 97,128, 3,154,243,244,242,239,235,229,227,249,
- 242,233,236,236,233, 99,128, 4,158,246,229,242,244,233,227,225,
- 236,243,244,242,239,235,229,227,249,242,233,236,236,233, 99,128,
- 4,156, 99, 4, 16, 28, 16, 35, 16, 44, 16, 52,225,242,239,110,
- 128, 1,232,229,228,233,236,236, 97,128, 1, 54,233,242,227,236,
- 101,128, 36,192,239,237,237,225,225,227,227,229,238,116,128, 1,
- 54,228,239,244,226,229,236,239,119,128, 30, 50,101, 2, 16, 82,
- 16, 94,232,225,242,237,229,238,233,225,110,128, 5, 84,238,225,
- 242,237,229,238,233,225,110,128, 5, 63,104, 3, 16,114, 16,126,
- 16,137,225,227,249,242,233,236,236,233, 99,128, 4, 37,229,233,
- 227,239,240,244,233, 99,128, 3,230,239,239,107,128, 1,152,234,
- 229,227,249,242,233,236,236,233, 99,128, 4, 12,236,233,238,229,
- 226,229,236,239,119,128, 30, 52,237,239,238,239,243,240,225,227,
- 101,128,255, 43,239,240,240, 97, 2, 16,189, 16,200,227,249,242,
- 233,236,236,233, 99,128, 4,128,231,242,229,229,107,128, 3,222,
- 115, 2, 16,214, 16,226,233,227,249,242,233,236,236,233, 99,128,
- 4,110,237,225,236,108,128,247,107, 76,138, 0, 76, 17, 1, 17,
- 5, 17, 9, 17, 29, 17, 95, 17,133, 17,147, 17,165, 17,177, 17,
- 189, 74,128, 1,199, 76,128,246,191, 97, 2, 17, 15, 17, 22,227,
- 245,244,101,128, 1, 57,237,226,228, 97,128, 3,155, 99, 4, 17,
- 39, 17, 46, 17, 55, 17, 82,225,242,239,110,128, 1, 61,229,228,
- 233,236,236, 97,128, 1, 59,233,242, 99, 2, 17, 63, 17, 68,236,
- 101,128, 36,193,245,237,230,236,229,248,226,229,236,239,119,128,
- 30, 60,239,237,237,225,225,227,227,229,238,116,128, 1, 59,228,
- 239,116,130, 1, 63, 17,105, 17,114,225,227,227,229,238,116,128,
- 1, 63,226,229,236,239,119,129, 30, 54, 17,124,237,225,227,242,
- 239,110,128, 30, 56,233,247,238,225,242,237,229,238,233,225,110,
- 128, 5, 60,106,129, 1,200, 17,153,229,227,249,242,233,236,236,
- 233, 99,128, 4, 9,236,233,238,229,226,229,236,239,119,128, 30,
- 58,237,239,238,239,243,240,225,227,101,128,255, 44,115, 2, 17,
- 195, 17,212,236,225,243,104,129, 1, 65, 17,204,243,237,225,236,
- 108,128,246,249,237,225,236,108,128,247,108, 77,137, 0, 77, 17,
- 241, 17,251, 18, 24, 18, 33, 18, 58, 18, 71, 18, 83, 18, 91, 18,
- 100,194,243,241,245,225,242,101,128, 51,134,225, 99, 2, 18, 2,
- 18, 18,242,239,110,129,246,208, 18, 10,243,237,225,236,108,128,
- 247,175,245,244,101,128, 30, 62,227,233,242,227,236,101,128, 36,
- 194,228,239,116, 2, 18, 41, 18, 50,225,227,227,229,238,116,128,
- 30, 64,226,229,236,239,119,128, 30, 66,229,238,225,242,237,229,
- 238,233,225,110,128, 5, 68,237,239,238,239,243,240,225,227,101,
- 128,255, 45,243,237,225,236,108,128,247,109,244,245,242,238,229,
- 100,128, 1,156,117,128, 3,156, 78,141, 0, 78, 18,134, 18,138,
- 18,146, 18,212, 18,237, 18,248, 19, 3, 19, 21, 19, 33, 19, 45,
- 19, 58, 19, 66, 19, 84, 74,128, 1,202,225,227,245,244,101,128,
- 1, 67, 99, 4, 18,156, 18,163, 18,172, 18,199,225,242,239,110,
- 128, 1, 71,229,228,233,236,236, 97,128, 1, 69,233,242, 99, 2,
- 18,180, 18,185,236,101,128, 36,195,245,237,230,236,229,248,226,
- 229,236,239,119,128, 30, 74,239,237,237,225,225,227,227,229,238,
- 116,128, 1, 69,228,239,116, 2, 18,220, 18,229,225,227,227,229,
- 238,116,128, 30, 68,226,229,236,239,119,128, 30, 70,232,239,239,
- 235,236,229,230,116,128, 1,157,233,238,229,242,239,237,225,110,
- 128, 33,104,106,129, 1,203, 19, 9,229,227,249,242,233,236,236,
- 233, 99,128, 4, 10,236,233,238,229,226,229,236,239,119,128, 30,
- 72,237,239,238,239,243,240,225,227,101,128,255, 46,239,247,225,
- 242,237,229,238,233,225,110,128, 5, 70,243,237,225,236,108,128,
- 247,110,244,233,236,228,101,129, 0,209, 19, 76,243,237,225,236,
- 108,128,247,241,117,128, 3,157, 79,141, 0, 79, 19,118, 19,132,
- 19,150, 19,203, 20, 78, 20,152, 20,187, 21, 48, 21, 69, 21,213,
- 21,223, 21,254, 22, 53, 69,129, 1, 82, 19,124,243,237,225,236,
- 108,128,246,250,225,227,245,244,101,129, 0,211, 19,142,243,237,
- 225,236,108,128,247,243, 98, 2, 19,156, 19,196,225,242,242,229,
- 100, 2, 19,166, 19,177,227,249,242,233,236,236,233, 99,128, 4,
- 232,228,233,229,242,229,243,233,243,227,249,242,233,236,236,233,
- 99,128, 4,234,242,229,246,101,128, 1, 78, 99, 4, 19,213, 19,
- 220, 19,235, 20, 68,225,242,239,110,128, 1,209,229,238,244,229,
- 242,229,228,244,233,236,228,101,128, 1,159,233,242, 99, 2, 19,
- 243, 19,248,236,101,128, 36,196,245,237,230,236,229,120,134, 0,
- 212, 20, 13, 20, 21, 20, 32, 20, 40, 20, 52, 20, 60,225,227,245,
- 244,101,128, 30,208,228,239,244,226,229,236,239,119,128, 30,216,
- 231,242,225,246,101,128, 30,210,232,239,239,235,225,226,239,246,
- 101,128, 30,212,243,237,225,236,108,128,247,244,244,233,236,228,
- 101,128, 30,214,249,242,233,236,236,233, 99,128, 4, 30,100, 3,
- 20, 86, 20,109, 20,142,226,108, 2, 20, 93, 20,101,225,227,245,
- 244,101,128, 1, 80,231,242,225,246,101,128, 2, 12,233,229,242,
- 229,243,233,115,130, 0,214, 20,123, 20,134,227,249,242,233,236,
- 236,233, 99,128, 4,230,243,237,225,236,108,128,247,246,239,244,
- 226,229,236,239,119,128, 30,204,103, 2, 20,158, 20,170,239,238,
- 229,235,243,237,225,236,108,128,246,251,242,225,246,101,129, 0,
- 210, 20,179,243,237,225,236,108,128,247,242,104, 4, 20,197, 20,
- 208, 20,212, 21, 34,225,242,237,229,238,233,225,110,128, 5, 85,
- 109,128, 33, 38,111, 2, 20,218, 20,228,239,235,225,226,239,246,
- 101,128, 30,206,242,110,133, 1,160, 20,243, 20,251, 21, 6, 21,
- 14, 21, 26,225,227,245,244,101,128, 30,218,228,239,244,226,229,
- 236,239,119,128, 30,226,231,242,225,246,101,128, 30,220,232,239,
- 239,235,225,226,239,246,101,128, 30,222,244,233,236,228,101,128,
- 30,224,245,238,231,225,242,245,237,236,225,245,116,128, 1, 80,
- 105,129, 1,162, 21, 54,238,246,229,242,244,229,228,226,242,229,
- 246,101,128, 2, 14,109, 4, 21, 79, 21,107, 21,184, 21,202,225,
- 227,242,239,110,130, 1, 76, 21, 91, 21, 99,225,227,245,244,101,
- 128, 30, 82,231,242,225,246,101,128, 30, 80,229,231, 97,132, 33,
- 38, 21,121, 21,132, 21,140, 21,156,227,249,242,233,236,236,233,
- 99,128, 4, 96,231,242,229,229,107,128, 3,169,242,239,245,238,
- 228,227,249,242,233,236,236,233, 99,128, 4,122,116, 2, 21,162,
- 21,177,233,244,236,239,227,249,242,233,236,236,233, 99,128, 4,
- 124,239,238,239,115,128, 3,143,233,227,242,239,110,129, 3,159,
- 21,194,244,239,238,239,115,128, 3,140,239,238,239,243,240,225,
- 227,101,128,255, 47,238,229,242,239,237,225,110,128, 33, 96,111,
- 2, 21,229, 21,248,231,239,238,229,107,129, 1,234, 21,239,237,
- 225,227,242,239,110,128, 1,236,240,229,110,128, 1,134,115, 3,
- 22, 6, 22, 33, 22, 40,236,225,243,104,130, 0,216, 22, 17, 22,
- 25,225,227,245,244,101,128, 1,254,243,237,225,236,108,128,247,
- 248,237,225,236,108,128,247,111,244,242,239,235,229,225,227,245,
- 244,101,128, 1,254,116, 2, 22, 59, 22, 70,227,249,242,233,236,
- 236,233, 99,128, 4,126,233,236,228,101,131, 0,213, 22, 83, 22,
- 91, 22,102,225,227,245,244,101,128, 30, 76,228,233,229,242,229,
- 243,233,115,128, 30, 78,243,237,225,236,108,128,247,245, 80,136,
- 0, 80, 22,130, 22,138, 22,147, 22,159, 22,211, 22,227, 22,246,
- 23, 2,225,227,245,244,101,128, 30, 84,227,233,242,227,236,101,
- 128, 36,197,228,239,244,225,227,227,229,238,116,128, 30, 86,101,
- 3, 22,167, 22,178, 22,190,227,249,242,233,236,236,233, 99,128,
- 4, 31,232,225,242,237,229,238,233,225,110,128, 5, 74,237,233,
- 228,228,236,229,232,239,239,235,227,249,242,233,236,236,233, 99,
- 128, 4,166,104, 2, 22,217, 22,221,105,128, 3,166,239,239,107,
- 128, 1,164,105,129, 3,160, 22,233,247,242,225,242,237,229,238,
- 233,225,110,128, 5, 83,237,239,238,239,243,240,225,227,101,128,
- 255, 48,115, 2, 23, 8, 23, 25,105,129, 3,168, 23, 14,227,249,
- 242,233,236,236,233, 99,128, 4,112,237,225,236,108,128,247,112,
- 81,131, 0, 81, 23, 42, 23, 51, 23, 63,227,233,242,227,236,101,
- 128, 36,198,237,239,238,239,243,240,225,227,101,128,255, 49,243,
- 237,225,236,108,128,247,113, 82,138, 0, 82, 23, 95, 23,119, 23,
- 166, 23,217, 23,230, 23,240, 23,245, 24, 19, 24, 31, 24, 43, 97,
- 2, 23,101, 23,112,225,242,237,229,238,233,225,110,128, 5, 76,
- 227,245,244,101,128, 1, 84, 99, 4, 23,129, 23,136, 23,145, 23,
- 153,225,242,239,110,128, 1, 88,229,228,233,236,236, 97,128, 1,
- 86,233,242,227,236,101,128, 36,199,239,237,237,225,225,227,227,
- 229,238,116,128, 1, 86,100, 2, 23,172, 23,182,226,236,231,242,
- 225,246,101,128, 2, 16,239,116, 2, 23,189, 23,198,225,227,227,
- 229,238,116,128, 30, 88,226,229,236,239,119,129, 30, 90, 23,208,
- 237,225,227,242,239,110,128, 30, 92,229,232,225,242,237,229,238,
- 233,225,110,128, 5, 80,230,242,225,235,244,245,114,128, 33, 28,
- 232,111,128, 3,161,233,110, 2, 23,252, 24, 5,231,243,237,225,
- 236,108,128,246,252,246,229,242,244,229,228,226,242,229,246,101,
- 128, 2, 18,236,233,238,229,226,229,236,239,119,128, 30, 94,237,
- 239,238,239,243,240,225,227,101,128,255, 50,243,237,225,236,108,
- 129,247,114, 24, 53,233,238,246,229,242,244,229,100,129, 2,129,
- 24, 66,243,245,240,229,242,233,239,114,128, 2,182, 83,139, 0,
- 83, 24,103, 26, 17, 26, 55, 26,182, 26,221, 26,250, 27, 84, 27,
- 105, 27,117, 27,135, 27,143, 70, 6, 24,117, 24,209, 24,241, 25,
- 77, 25,119, 25,221, 48, 9, 24,137, 24,145, 24,153, 24,161, 24,
- 169, 24,177, 24,185, 24,193, 24,201,177,176,176,176, 48,128, 37,
- 12,178,176,176,176, 48,128, 37, 20,179,176,176,176, 48,128, 37,
- 16,180,176,176,176, 48,128, 37, 24,181,176,176,176, 48,128, 37,
- 60,182,176,176,176, 48,128, 37, 44,183,176,176,176, 48,128, 37,
- 52,184,176,176,176, 48,128, 37, 28,185,176,176,176, 48,128, 37,
- 36, 49, 3, 24,217, 24,225, 24,233,176,176,176,176, 48,128, 37,
- 0,177,176,176,176, 48,128, 37, 2,185,176,176,176, 48,128, 37,
- 97, 50, 9, 25, 5, 25, 13, 25, 21, 25, 29, 25, 37, 25, 45, 25,
- 53, 25, 61, 25, 69,176,176,176,176, 48,128, 37, 98,177,176,176,
- 176, 48,128, 37, 86,178,176,176,176, 48,128, 37, 85,179,176,176,
- 176, 48,128, 37, 99,180,176,176,176, 48,128, 37, 81,181,176,176,
- 176, 48,128, 37, 87,182,176,176,176, 48,128, 37, 93,183,176,176,
- 176, 48,128, 37, 92,184,176,176,176, 48,128, 37, 91, 51, 4, 25,
- 87, 25, 95, 25,103, 25,111,182,176,176,176, 48,128, 37, 94,183,
- 176,176,176, 48,128, 37, 95,184,176,176,176, 48,128, 37, 90,185,
- 176,176,176, 48,128, 37, 84, 52, 10, 25,141, 25,149, 25,157, 25,
- 165, 25,173, 25,181, 25,189, 25,197, 25,205, 25,213,176,176,176,
- 176, 48,128, 37,105,177,176,176,176, 48,128, 37,102,178,176,176,
- 176, 48,128, 37, 96,179,176,176,176, 48,128, 37, 80,180,176,176,
- 176, 48,128, 37,108,181,176,176,176, 48,128, 37,103,182,176,176,
- 176, 48,128, 37,104,183,176,176,176, 48,128, 37,100,184,176,176,
- 176, 48,128, 37,101,185,176,176,176, 48,128, 37, 89, 53, 5, 25,
- 233, 25,241, 25,249, 26, 1, 26, 9,176,176,176,176, 48,128, 37,
- 88,177,176,176,176, 48,128, 37, 82,178,176,176,176, 48,128, 37,
- 83,179,176,176,176, 48,128, 37,107,180,176,176,176, 48,128, 37,
- 106, 97, 2, 26, 23, 26, 44,227,245,244,101,129, 1, 90, 26, 32,
- 228,239,244,225,227,227,229,238,116,128, 30,100,237,240,233,231,
- 242,229,229,107,128, 3,224, 99, 5, 26, 67, 26, 98, 26,107, 26,
- 147, 26,169,225,242,239,110,130, 1, 96, 26, 78, 26, 90,228,239,
- 244,225,227,227,229,238,116,128, 30,102,243,237,225,236,108,128,
- 246,253,229,228,233,236,236, 97,128, 1, 94,232,247, 97,130, 1,
- 143, 26,117, 26,128,227,249,242,233,236,236,233, 99,128, 4,216,
- 228,233,229,242,229,243,233,243,227,249,242,233,236,236,233, 99,
- 128, 4,218,233,242, 99, 2, 26,155, 26,160,236,101,128, 36,200,
- 245,237,230,236,229,120,128, 1, 92,239,237,237,225,225,227,227,
- 229,238,116,128, 2, 24,228,239,116, 2, 26,190, 26,199,225,227,
- 227,229,238,116,128, 30, 96,226,229,236,239,119,129, 30, 98, 26,
- 209,228,239,244,225,227,227,229,238,116,128, 30,104,101, 2, 26,
- 227, 26,239,232,225,242,237,229,238,233,225,110,128, 5, 77,246,
- 229,238,242,239,237,225,110,128, 33,102,104, 5, 27, 6, 27, 34,
- 27, 48, 27, 59, 27, 72, 97, 2, 27, 12, 27, 23,225,242,237,229,
- 238,233,225,110,128, 5, 71,227,249,242,233,236,236,233, 99,128,
- 4, 40,227,232,225,227,249,242,233,236,236,233, 99,128, 4, 41,
- 229,233,227,239,240,244,233, 99,128, 3,226,232,225,227,249,242,
- 233,236,236,233, 99,128, 4,186,233,237,225,227,239,240,244,233,
- 99,128, 3,236,105, 2, 27, 90, 27, 96,231,237, 97,128, 3,163,
- 248,242,239,237,225,110,128, 33,101,237,239,238,239,243,240,225,
- 227,101,128,255, 51,239,230,244,243,233,231,238,227,249,242,233,
- 236,236,233, 99,128, 4, 44,243,237,225,236,108,128,247,115,244,
- 233,231,237,225,231,242,229,229,107,128, 3,218, 84,141, 0, 84,
- 27,186, 27,191, 27,197, 28, 7, 28, 32, 28, 96, 28,147, 28,177,
- 28,189, 28,201, 28,246, 29, 6, 29, 46,225,117,128, 3,164,226,
- 225,114,128, 1,102, 99, 4, 27,207, 27,214, 27,223, 27,250,225,
- 242,239,110,128, 1,100,229,228,233,236,236, 97,128, 1, 98,233,
- 242, 99, 2, 27,231, 27,236,236,101,128, 36,201,245,237,230,236,
- 229,248,226,229,236,239,119,128, 30,112,239,237,237,225,225,227,
- 227,229,238,116,128, 1, 98,228,239,116, 2, 28, 15, 28, 24,225,
- 227,227,229,238,116,128, 30,106,226,229,236,239,119,128, 30,108,
- 101, 4, 28, 42, 28, 53, 28, 73, 28, 82,227,249,242,233,236,236,
- 233, 99,128, 4, 34,228,229,243,227,229,238,228,229,242,227,249,
- 242,233,236,236,233, 99,128, 4,172,238,242,239,237,225,110,128,
- 33,105,244,243,229,227,249,242,233,236,236,233, 99,128, 4,180,
- 104, 3, 28,104, 28,110, 28,136,229,244, 97,128, 3,152,111, 2,
- 28,116, 28,121,239,107,128, 1,172,242,110,129, 0,222, 28,128,
- 243,237,225,236,108,128,247,254,242,229,229,242,239,237,225,110,
- 128, 33, 98,105, 2, 28,153, 28,164,236,228,229,243,237,225,236,
- 108,128,246,254,247,238,225,242,237,229,238,233,225,110,128, 5,
- 79,236,233,238,229,226,229,236,239,119,128, 30,110,237,239,238,
- 239,243,240,225,227,101,128,255, 52,111, 2, 28,207, 28,218,225,
- 242,237,229,238,233,225,110,128, 5, 57,238,101, 3, 28,227, 28,
- 234, 28,240,230,233,246,101,128, 1,188,243,233,120,128, 1,132,
- 244,247,111,128, 1,167,242,229,244,242,239,230,236,229,248,232,
- 239,239,107,128, 1,174,115, 3, 29, 14, 29, 26, 29, 39,229,227,
- 249,242,233,236,236,233, 99,128, 4, 38,232,229,227,249,242,233,
- 236,236,233, 99,128, 4, 11,237,225,236,108,128,247,116,119, 2,
- 29, 52, 29, 64,229,236,246,229,242,239,237,225,110,128, 33,107,
- 239,242,239,237,225,110,128, 33, 97, 85,142, 0, 85, 29,105, 29,
- 123, 29,131, 29,198, 30, 69, 30, 87, 30,198, 30,214, 30,226, 31,
- 21, 31, 30, 31,142, 31,149, 31,219,225,227,245,244,101,129, 0,
- 218, 29,115,243,237,225,236,108,128,247,250,226,242,229,246,101,
- 128, 1,108, 99, 3, 29,139, 29,146, 29,188,225,242,239,110,128,
- 1,211,233,242, 99, 2, 29,154, 29,159,236,101,128, 36,202,245,
- 237,230,236,229,120,130, 0,219, 29,172, 29,180,226,229,236,239,
- 119,128, 30,118,243,237,225,236,108,128,247,251,249,242,233,236,
- 236,233, 99,128, 4, 35,100, 3, 29,206, 29,229, 30, 59,226,108,
- 2, 29,213, 29,221,225,227,245,244,101,128, 1,112,231,242,225,
- 246,101,128, 2, 20,233,229,242,229,243,233,115,134, 0,220, 29,
- 251, 30, 3, 30, 11, 30, 34, 30, 42, 30, 51,225,227,245,244,101,
- 128, 1,215,226,229,236,239,119,128, 30,114, 99, 2, 30, 17, 30,
- 24,225,242,239,110,128, 1,217,249,242,233,236,236,233, 99,128,
- 4,240,231,242,225,246,101,128, 1,219,237,225,227,242,239,110,
- 128, 1,213,243,237,225,236,108,128,247,252,239,244,226,229,236,
- 239,119,128, 30,228,231,242,225,246,101,129, 0,217, 30, 79,243,
- 237,225,236,108,128,247,249,104, 2, 30, 93, 30,171,111, 2, 30,
- 99, 30,109,239,235,225,226,239,246,101,128, 30,230,242,110,133,
- 1,175, 30,124, 30,132, 30,143, 30,151, 30,163,225,227,245,244,
- 101,128, 30,232,228,239,244,226,229,236,239,119,128, 30,240,231,
- 242,225,246,101,128, 30,234,232,239,239,235,225,226,239,246,101,
- 128, 30,236,244,233,236,228,101,128, 30,238,245,238,231,225,242,
- 245,237,236,225,245,116,129, 1,112, 30,187,227,249,242,233,236,
- 236,233, 99,128, 4,242,233,238,246,229,242,244,229,228,226,242,
- 229,246,101,128, 2, 22,235,227,249,242,233,236,236,233, 99,128,
- 4,120,109, 2, 30,232, 31, 10,225,227,242,239,110,130, 1,106,
- 30,244, 30,255,227,249,242,233,236,236,233, 99,128, 4,238,228,
- 233,229,242,229,243,233,115,128, 30,122,239,238,239,243,240,225,
- 227,101,128,255, 53,239,231,239,238,229,107,128, 1,114,240,243,
- 233,236,239,110,133, 3,165, 31, 49, 31, 53, 31, 90, 31,121, 31,
- 134, 49,128, 3,210, 97, 2, 31, 59, 31, 81,227,245,244,229,232,
- 239,239,235,243,249,237,226,239,236,231,242,229,229,107,128, 3,
- 211,230,242,233,227,225,110,128, 1,177,228,233,229,242,229,243,
- 233,115,129, 3,171, 31,103,232,239,239,235,243,249,237,226,239,
- 236,231,242,229,229,107,128, 3,212,232,239,239,235,243,249,237,
- 226,239,108,128, 3,210,244,239,238,239,115,128, 3,142,242,233,
- 238,103,128, 1,110,115, 3, 31,157, 31,172, 31,179,232,239,242,
- 244,227,249,242,233,236,236,233, 99,128, 4, 14,237,225,236,108,
- 128,247,117,244,242,225,233,231,232,116, 2, 31,191, 31,202,227,
- 249,242,233,236,236,233, 99,128, 4,174,243,244,242,239,235,229,
- 227,249,242,233,236,236,233, 99,128, 4,176,244,233,236,228,101,
- 130, 1,104, 31,231, 31,239,225,227,245,244,101,128, 30,120,226,
- 229,236,239,119,128, 30,116, 86,136, 0, 86, 32, 11, 32, 20, 32,
- 31, 32, 60, 32, 67, 32, 79, 32, 91, 32, 99,227,233,242,227,236,
- 101,128, 36,203,228,239,244,226,229,236,239,119,128, 30,126,101,
- 2, 32, 37, 32, 48,227,249,242,233,236,236,233, 99,128, 4, 18,
- 247,225,242,237,229,238,233,225,110,128, 5, 78,232,239,239,107,
- 128, 1,178,237,239,238,239,243,240,225,227,101,128,255, 54,239,
- 225,242,237,229,238,233,225,110,128, 5, 72,243,237,225,236,108,
- 128,247,118,244,233,236,228,101,128, 30,124, 87,134, 0, 87, 32,
- 123, 32,131, 32,154, 32,194, 32,202, 32,214,225,227,245,244,101,
- 128, 30,130,227,233,242, 99, 2, 32,140, 32,145,236,101,128, 36,
- 204,245,237,230,236,229,120,128, 1,116,100, 2, 32,160, 32,170,
- 233,229,242,229,243,233,115,128, 30,132,239,116, 2, 32,177, 32,
- 186,225,227,227,229,238,116,128, 30,134,226,229,236,239,119,128,
- 30,136,231,242,225,246,101,128, 30,128,237,239,238,239,243,240,
- 225,227,101,128,255, 55,243,237,225,236,108,128,247,119, 88,134,
- 0, 88, 32,238, 32,247, 33, 18, 33, 31, 33, 35, 33, 47,227,233,
- 242,227,236,101,128, 36,205,100, 2, 32,253, 33, 7,233,229,242,
- 229,243,233,115,128, 30,140,239,244,225,227,227,229,238,116,128,
- 30,138,229,232,225,242,237,229,238,233,225,110,128, 5, 61,105,
- 128, 3,158,237,239,238,239,243,240,225,227,101,128,255, 56,243,
- 237,225,236,108,128,247,120, 89,139, 0, 89, 33, 81, 33,116, 33,
- 139, 33,189, 33,228, 33,236, 33,253, 34, 40, 34, 52, 34, 60, 34,
- 68, 97, 2, 33, 87, 33,104,227,245,244,101,129, 0,221, 33, 96,
- 243,237,225,236,108,128,247,253,244,227,249,242,233,236,236,233,
- 99,128, 4, 98,227,233,242, 99, 2, 33,125, 33,130,236,101,128,
- 36,206,245,237,230,236,229,120,128, 1,118,100, 2, 33,145, 33,
- 165,233,229,242,229,243,233,115,129, 1,120, 33,157,243,237,225,
- 236,108,128,247,255,239,116, 2, 33,172, 33,181,225,227,227,229,
- 238,116,128, 30,142,226,229,236,239,119,128, 30,244,229,114, 2,
- 33,196, 33,208,233,227,249,242,233,236,236,233, 99,128, 4, 43,
- 245,228,233,229,242,229,243,233,243,227,249,242,233,236,236,233,
- 99,128, 4,248,231,242,225,246,101,128, 30,242,232,239,239,107,
- 129, 1,179, 33,245,225,226,239,246,101,128, 30,246,105, 3, 34,
- 5, 34, 16, 34, 27,225,242,237,229,238,233,225,110,128, 5, 69,
- 227,249,242,233,236,236,233, 99,128, 4, 7,247,238,225,242,237,
- 229,238,233,225,110,128, 5, 82,237,239,238,239,243,240,225,227,
- 101,128,255, 57,243,237,225,236,108,128,247,121,244,233,236,228,
- 101,128, 30,248,245,115, 2, 34, 75, 34,113,226,233,103, 2, 34,
- 83, 34, 94,227,249,242,233,236,236,233, 99,128, 4,106,233,239,
- 244,233,230,233,229,228,227,249,242,233,236,236,233, 99,128, 4,
- 108,236,233,244,244,236,101, 2, 34,124, 34,135,227,249,242,233,
- 236,236,233, 99,128, 4,102,233,239,244,233,230,233,229,228,227,
- 249,242,233,236,236,233, 99,128, 4,104, 90,136, 0, 90, 34,174,
- 34,198, 34,243, 35, 14, 35, 81, 35,173, 35,185, 35,197, 97, 2,
- 34,180, 34,191,225,242,237,229,238,233,225,110,128, 5, 54,227,
- 245,244,101,128, 1,121, 99, 2, 34,204, 34,221,225,242,239,110,
- 129, 1,125, 34,213,243,237,225,236,108,128,246,255,233,242, 99,
- 2, 34,229, 34,234,236,101,128, 36,207,245,237,230,236,229,120,
- 128, 30,144,228,239,116,130, 1,123, 34,253, 35, 6,225,227,227,
- 229,238,116,128, 1,123,226,229,236,239,119,128, 30,146,101, 3,
- 35, 22, 35, 33, 35, 76,227,249,242,233,236,236,233, 99,128, 4,
- 23,100, 2, 35, 39, 35, 58,229,243,227,229,238,228,229,242,227,
- 249,242,233,236,236,233, 99,128, 4,152,233,229,242,229,243,233,
- 243,227,249,242,233,236,236,233, 99,128, 4,222,244, 97,128, 3,
- 150,232,101, 4, 35, 92, 35,103, 35,119, 35,130,225,242,237,229,
- 238,233,225,110,128, 5, 58,226,242,229,246,229,227,249,242,233,
- 236,236,233, 99,128, 4,193,227,249,242,233,236,236,233, 99,128,
- 4, 22,100, 2, 35,136, 35,155,229,243,227,229,238,228,229,242,
- 227,249,242,233,236,236,233, 99,128, 4,150,233,229,242,229,243,
- 233,243,227,249,242,233,236,236,233, 99,128, 4,220,236,233,238,
- 229,226,229,236,239,119,128, 30,148,237,239,238,239,243,240,225,
- 227,101,128,255, 58,115, 2, 35,203, 35,210,237,225,236,108,128,
- 247,122,244,242,239,235,101,128, 1,181, 97,158, 0, 97, 36, 26,
- 38,154, 39, 4, 39, 68, 39,132, 39,196, 40, 4, 40, 68, 40,126,
- 40,190, 41, 70, 41,217, 42,137, 42,237, 43, 17, 49,192, 49,229,
- 50, 0, 50,225, 51, 7, 52, 96, 52,168, 53,123, 53,132, 54, 5,
- 56, 13, 57, 3, 57, 50, 57,201, 57,215, 49,138, 39, 1, 36, 50,
- 36,114, 36,154, 36,218, 37, 26, 37, 90, 37,154, 37,218, 38, 26,
- 38, 90, 48,138, 39, 33, 36, 74, 36, 78, 36, 82, 36, 86, 36, 90,
- 36, 94, 36, 98, 36,102, 36,106, 36,110, 48,128, 39, 94, 49,128,
- 39, 97, 50,128, 39, 98, 51,128, 39, 99, 52,128, 39,100, 53,128,
- 39, 16, 54,128, 39,101, 55,128, 39,102, 56,128, 39,103, 57,128,
- 38, 96, 49,134, 38, 27, 36,130, 36,134, 36,138, 36,142, 36,146,
- 36,150, 48,128, 38,101, 49,128, 38,102, 50,128, 38, 99, 55,128,
- 39, 9, 56,128, 39, 8, 57,128, 39, 7, 50,138, 38, 30, 36,178,
- 36,182, 36,186, 36,190, 36,194, 36,198, 36,202, 36,206, 36,210,
- 36,214, 48,128, 36, 96, 49,128, 36, 97, 50,128, 36, 98, 51,128,
- 36, 99, 52,128, 36,100, 53,128, 36,101, 54,128, 36,102, 55,128,
- 36,103, 56,128, 36,104, 57,128, 36,105, 51,138, 39, 12, 36,242,
- 36,246, 36,250, 36,254, 37, 2, 37, 6, 37, 10, 37, 14, 37, 18,
- 37, 22, 48,128, 39,118, 49,128, 39,119, 50,128, 39,120, 51,128,
- 39,121, 52,128, 39,122, 53,128, 39,123, 54,128, 39,124, 55,128,
- 39,125, 56,128, 39,126, 57,128, 39,127, 52,138, 39, 13, 37, 50,
- 37, 54, 37, 58, 37, 62, 37, 66, 37, 70, 37, 74, 37, 78, 37, 82,
- 37, 86, 48,128, 39,128, 49,128, 39,129, 50,128, 39,130, 51,128,
- 39,131, 52,128, 39,132, 53,128, 39,133, 54,128, 39,134, 55,128,
- 39,135, 56,128, 39,136, 57,128, 39,137, 53,138, 39, 14, 37,114,
- 37,118, 37,122, 37,126, 37,130, 37,134, 37,138, 37,142, 37,146,
- 37,150, 48,128, 39,138, 49,128, 39,139, 50,128, 39,140, 51,128,
- 39,141, 52,128, 39,142, 53,128, 39,143, 54,128, 39,144, 55,128,
- 39,145, 56,128, 39,146, 57,128, 39,147, 54,138, 39, 15, 37,178,
- 37,182, 37,186, 37,190, 37,194, 37,198, 37,202, 37,206, 37,210,
- 37,214, 48,128, 39,148, 49,128, 33,146, 50,128, 39,163, 51,128,
- 33,148, 52,128, 33,149, 53,128, 39,153, 54,128, 39,155, 55,128,
- 39,156, 56,128, 39,157, 57,128, 39,158, 55,138, 39, 17, 37,242,
- 37,246, 37,250, 37,254, 38, 2, 38, 6, 38, 10, 38, 14, 38, 18,
- 38, 22, 48,128, 39,159, 49,128, 39,160, 50,128, 39,161, 51,128,
- 39,162, 52,128, 39,164, 53,128, 39,165, 54,128, 39,166, 55,128,
- 39,167, 56,128, 39,168, 57,128, 39,169, 56,138, 39, 18, 38, 50,
- 38, 54, 38, 58, 38, 62, 38, 66, 38, 70, 38, 74, 38, 78, 38, 82,
- 38, 86, 48,128, 39,171, 49,128, 39,173, 50,128, 39,175, 51,128,
- 39,178, 52,128, 39,179, 53,128, 39,181, 54,128, 39,184, 55,128,
- 39,186, 56,128, 39,187, 57,128, 39,188, 57,138, 39, 19, 38,114,
- 38,118, 38,122, 38,126, 38,130, 38,134, 38,138, 38,142, 38,146,
- 38,150, 48,128, 39,189, 49,128, 39,190, 50,128, 39,154, 51,128,
- 39,170, 52,128, 39,182, 53,128, 39,185, 54,128, 39,152, 55,128,
- 39,180, 56,128, 39,183, 57,128, 39,172, 50,138, 39, 2, 38,178,
- 38,224, 38,228, 38,232, 38,236, 38,240, 38,244, 38,248, 38,252,
- 39, 0, 48,135, 39, 20, 38,196, 38,200, 38,204, 38,208, 38,212,
- 38,216, 38,220, 48,128, 39,174, 49,128, 39,177, 50,128, 39, 3,
- 51,128, 39, 80, 52,128, 39, 82, 53,128, 39,110, 54,128, 39,112,
- 49,128, 39, 21, 50,128, 39, 22, 51,128, 39, 23, 52,128, 39, 24,
- 53,128, 39, 25, 54,128, 39, 26, 55,128, 39, 27, 56,128, 39, 28,
- 57,128, 39, 34, 51,138, 39, 4, 39, 28, 39, 32, 39, 36, 39, 40,
- 39, 44, 39, 48, 39, 52, 39, 56, 39, 60, 39, 64, 48,128, 39, 35,
- 49,128, 39, 36, 50,128, 39, 37, 51,128, 39, 38, 52,128, 39, 39,
- 53,128, 38, 5, 54,128, 39, 41, 55,128, 39, 42, 56,128, 39, 43,
- 57,128, 39, 44, 52,138, 38, 14, 39, 92, 39, 96, 39,100, 39,104,
- 39,108, 39,112, 39,116, 39,120, 39,124, 39,128, 48,128, 39, 45,
- 49,128, 39, 46, 50,128, 39, 47, 51,128, 39, 48, 52,128, 39, 49,
- 53,128, 39, 50, 54,128, 39, 51, 55,128, 39, 52, 56,128, 39, 53,
- 57,128, 39, 54, 53,138, 39, 6, 39,156, 39,160, 39,164, 39,168,
- 39,172, 39,176, 39,180, 39,184, 39,188, 39,192, 48,128, 39, 55,
- 49,128, 39, 56, 50,128, 39, 57, 51,128, 39, 58, 52,128, 39, 59,
- 53,128, 39, 60, 54,128, 39, 61, 55,128, 39, 62, 56,128, 39, 63,
- 57,128, 39, 64, 54,138, 39, 29, 39,220, 39,224, 39,228, 39,232,
- 39,236, 39,240, 39,244, 39,248, 39,252, 40, 0, 48,128, 39, 65,
- 49,128, 39, 66, 50,128, 39, 67, 51,128, 39, 68, 52,128, 39, 69,
- 53,128, 39, 70, 54,128, 39, 71, 55,128, 39, 72, 56,128, 39, 73,
- 57,128, 39, 74, 55,138, 39, 30, 40, 28, 40, 32, 40, 36, 40, 40,
- 40, 44, 40, 48, 40, 52, 40, 56, 40, 60, 40, 64, 48,128, 39, 75,
- 49,128, 37,207, 50,128, 39, 77, 51,128, 37,160, 52,128, 39, 79,
- 53,128, 39, 81, 54,128, 37,178, 55,128, 37,188, 56,128, 37,198,
- 57,128, 39, 86, 56,137, 39, 31, 40, 90, 40, 94, 40, 98, 40,102,
- 40,106, 40,110, 40,114, 40,118, 40,122, 49,128, 37,215, 50,128,
- 39, 88, 51,128, 39, 89, 52,128, 39, 90, 53,128, 39,111, 54,128,
- 39,113, 55,128, 39,114, 56,128, 39,115, 57,128, 39,104, 57,138,
- 39, 32, 40,150, 40,154, 40,158, 40,162, 40,166, 40,170, 40,174,
- 40,178, 40,182, 40,186, 48,128, 39,105, 49,128, 39,108, 50,128,
- 39,109, 51,128, 39,106, 52,128, 39,107, 53,128, 39,116, 54,128,
- 39,117, 55,128, 39, 91, 56,128, 39, 92, 57,128, 39, 93, 97, 7,
- 40,206, 40,216, 40,223, 40,230, 40,255, 41, 15, 41, 26,226,229,
- 238,231,225,236,105,128, 9,134,227,245,244,101,128, 0,225,228,
- 229,246, 97,128, 9, 6,231,117, 2, 40,237, 40,246,234,225,242,
- 225,244,105,128, 10,134,242,237,245,235,232,105,128, 10, 6,237,
- 225,244,242,225,231,245,242,237,245,235,232,105,128, 10, 62,242,
- 245,243,241,245,225,242,101,128, 51, 3,246,239,247,229,236,243,
- 233,231,110, 3, 41, 42, 41, 52, 41, 59,226,229,238,231,225,236,
- 105,128, 9,190,228,229,246, 97,128, 9, 62,231,245,234,225,242,
- 225,244,105,128, 10,190, 98, 4, 41, 80, 41,121, 41,130, 41,140,
- 226,242,229,246,233,225,244,233,239,110, 2, 41, 95, 41,110,237,
- 225,242,235,225,242,237,229,238,233,225,110,128, 5, 95,243,233,
- 231,238,228,229,246, 97,128, 9,112,229,238,231,225,236,105,128,
- 9,133,239,240,239,237,239,230,111,128, 49, 26,242,229,246,101,
- 134, 1, 3, 41,159, 41,167, 41,178, 41,189, 41,197, 41,209,225,
- 227,245,244,101,128, 30,175,227,249,242,233,236,236,233, 99,128,
- 4,209,228,239,244,226,229,236,239,119,128, 30,183,231,242,225,
- 246,101,128, 30,177,232,239,239,235,225,226,239,246,101,128, 30,
- 179,244,233,236,228,101,128, 30,181, 99, 4, 41,227, 41,234, 42,
- 57, 42,127,225,242,239,110,128, 1,206,233,242, 99, 2, 41,242,
- 41,247,236,101,128, 36,208,245,237,230,236,229,120,133, 0,226,
- 42, 10, 42, 18, 42, 29, 42, 37, 42, 49,225,227,245,244,101,128,
- 30,165,228,239,244,226,229,236,239,119,128, 30,173,231,242,225,
- 246,101,128, 30,167,232,239,239,235,225,226,239,246,101,128, 30,
- 169,244,233,236,228,101,128, 30,171,245,244,101,133, 0,180, 42,
- 73, 42, 84, 42,101, 42,108, 42,117,226,229,236,239,247,227,237,
- 98,128, 3, 23, 99, 2, 42, 90, 42, 95,237, 98,128, 3, 1,239,
- 237, 98,128, 3, 1,228,229,246, 97,128, 9, 84,236,239,247,237,
- 239,100,128, 2,207,244,239,238,229,227,237, 98,128, 3, 65,249,
- 242,233,236,236,233, 99,128, 4, 48,100, 5, 42,149, 42,159, 42,
- 173, 42,179, 42,213,226,236,231,242,225,246,101,128, 2, 1,228,
- 225,235,231,245,242,237,245,235,232,105,128, 10,113,229,246, 97,
- 128, 9, 5,233,229,242,229,243,233,115,130, 0,228, 42,193, 42,
- 204,227,249,242,233,236,236,233, 99,128, 4,211,237,225,227,242,
- 239,110,128, 1,223,239,116, 2, 42,220, 42,228,226,229,236,239,
- 119,128, 30,161,237,225,227,242,239,110,128, 1,225,101,131, 0,
- 230, 42,247, 42,255, 43, 8,225,227,245,244,101,128, 1,253,235,
- 239,242,229,225,110,128, 49, 80,237,225,227,242,239,110,128, 1,
- 227,230,233,105, 6, 43, 33, 43, 53, 45,246, 45,252, 46, 11, 49,
- 111, 48, 2, 43, 39, 43, 46,176,178,176, 56,128, 32, 21,184,185,
- 180, 49,128, 32,164,177, 48, 3, 43, 62, 45, 86, 45,221, 48, 9,
- 43, 82, 43,102, 43,164, 43,226, 44, 32, 44, 94, 44,156, 44,218,
- 45, 24, 49, 3, 43, 90, 43, 94, 43, 98, 55,128, 4, 16, 56,128,
- 4, 17, 57,128, 4, 18, 50, 10, 43,124, 43,128, 43,132, 43,136,
- 43,140, 43,144, 43,148, 43,152, 43,156, 43,160, 48,128, 4, 19,
- 49,128, 4, 20, 50,128, 4, 21, 51,128, 4, 1, 52,128, 4, 22,
- 53,128, 4, 23, 54,128, 4, 24, 55,128, 4, 25, 56,128, 4, 26,
- 57,128, 4, 27, 51, 10, 43,186, 43,190, 43,194, 43,198, 43,202,
- 43,206, 43,210, 43,214, 43,218, 43,222, 48,128, 4, 28, 49,128,
- 4, 29, 50,128, 4, 30, 51,128, 4, 31, 52,128, 4, 32, 53,128,
- 4, 33, 54,128, 4, 34, 55,128, 4, 35, 56,128, 4, 36, 57,128,
- 4, 37, 52, 10, 43,248, 43,252, 44, 0, 44, 4, 44, 8, 44, 12,
- 44, 16, 44, 20, 44, 24, 44, 28, 48,128, 4, 38, 49,128, 4, 39,
- 50,128, 4, 40, 51,128, 4, 41, 52,128, 4, 42, 53,128, 4, 43,
- 54,128, 4, 44, 55,128, 4, 45, 56,128, 4, 46, 57,128, 4, 47,
- 53, 10, 44, 54, 44, 58, 44, 62, 44, 66, 44, 70, 44, 74, 44, 78,
- 44, 82, 44, 86, 44, 90, 48,128, 4,144, 49,128, 4, 2, 50,128,
- 4, 3, 51,128, 4, 4, 52,128, 4, 5, 53,128, 4, 6, 54,128,
- 4, 7, 55,128, 4, 8, 56,128, 4, 9, 57,128, 4, 10, 54, 10,
- 44,116, 44,120, 44,124, 44,128, 44,132, 44,136, 44,140, 44,144,
- 44,148, 44,152, 48,128, 4, 11, 49,128, 4, 12, 50,128, 4, 14,
- 51,128,246,196, 52,128,246,197, 53,128, 4, 48, 54,128, 4, 49,
- 55,128, 4, 50, 56,128, 4, 51, 57,128, 4, 52, 55, 10, 44,178,
- 44,182, 44,186, 44,190, 44,194, 44,198, 44,202, 44,206, 44,210,
- 44,214, 48,128, 4, 53, 49,128, 4, 81, 50,128, 4, 54, 51,128,
- 4, 55, 52,128, 4, 56, 53,128, 4, 57, 54,128, 4, 58, 55,128,
- 4, 59, 56,128, 4, 60, 57,128, 4, 61, 56, 10, 44,240, 44,244,
- 44,248, 44,252, 45, 0, 45, 4, 45, 8, 45, 12, 45, 16, 45, 20,
- 48,128, 4, 62, 49,128, 4, 63, 50,128, 4, 64, 51,128, 4, 65,
- 52,128, 4, 66, 53,128, 4, 67, 54,128, 4, 68, 55,128, 4, 69,
- 56,128, 4, 70, 57,128, 4, 71, 57, 10, 45, 46, 45, 50, 45, 54,
- 45, 58, 45, 62, 45, 66, 45, 70, 45, 74, 45, 78, 45, 82, 48,128,
- 4, 72, 49,128, 4, 73, 50,128, 4, 74, 51,128, 4, 75, 52,128,
- 4, 76, 53,128, 4, 77, 54,128, 4, 78, 55,128, 4, 79, 56,128,
- 4,145, 57,128, 4, 82, 49, 4, 45, 96, 45,158, 45,163, 45,189,
- 48, 10, 45,118, 45,122, 45,126, 45,130, 45,134, 45,138, 45,142,
- 45,146, 45,150, 45,154, 48,128, 4, 83, 49,128, 4, 84, 50,128,
- 4, 85, 51,128, 4, 86, 52,128, 4, 87, 53,128, 4, 88, 54,128,
- 4, 89, 55,128, 4, 90, 56,128, 4, 91, 57,128, 4, 92,177, 48,
- 128, 4, 94, 52, 4, 45,173, 45,177, 45,181, 45,185, 53,128, 4,
- 15, 54,128, 4, 98, 55,128, 4,114, 56,128, 4,116, 57, 5, 45,
- 201, 45,205, 45,209, 45,213, 45,217, 50,128,246,198, 51,128, 4,
- 95, 52,128, 4, 99, 53,128, 4,115, 54,128, 4,117, 56, 2, 45,
- 227, 45,241, 51, 2, 45,233, 45,237, 49,128,246,199, 50,128,246,
- 200,180, 54,128, 4,217,178,185, 57,128, 32, 14,179, 48, 2, 46,
- 3, 46, 7, 48,128, 32, 15, 49,128, 32, 13,181, 55, 7, 46, 28,
- 46, 98, 47,163, 47,240, 48,197, 49, 34, 49,105, 51, 2, 46, 34,
- 46, 48, 56, 2, 46, 40, 46, 44, 49,128, 6,106, 56,128, 6, 12,
- 57, 8, 46, 66, 46, 70, 46, 74, 46, 78, 46, 82, 46, 86, 46, 90,
- 46, 94, 50,128, 6, 96, 51,128, 6, 97, 52,128, 6, 98, 53,128,
- 6, 99, 54,128, 6,100, 55,128, 6,101, 56,128, 6,102, 57,128,
- 6,103, 52, 7, 46,114, 46,146, 46,208, 47, 14, 47, 46, 47,102,
- 47,158, 48, 5, 46,126, 46,130, 46,134, 46,138, 46,142, 48,128,
- 6,104, 49,128, 6,105, 51,128, 6, 27, 55,128, 6, 31, 57,128,
- 6, 33, 49, 10, 46,168, 46,172, 46,176, 46,180, 46,184, 46,188,
- 46,192, 46,196, 46,200, 46,204, 48,128, 6, 34, 49,128, 6, 35,
- 50,128, 6, 36, 51,128, 6, 37, 52,128, 6, 38, 53,128, 6, 39,
- 54,128, 6, 40, 55,128, 6, 41, 56,128, 6, 42, 57,128, 6, 43,
- 50, 10, 46,230, 46,234, 46,238, 46,242, 46,246, 46,250, 46,254,
- 47, 2, 47, 6, 47, 10, 48,128, 6, 44, 49,128, 6, 45, 50,128,
- 6, 46, 51,128, 6, 47, 52,128, 6, 48, 53,128, 6, 49, 54,128,
- 6, 50, 55,128, 6, 51, 56,128, 6, 52, 57,128, 6, 53, 51, 5,
- 47, 26, 47, 30, 47, 34, 47, 38, 47, 42, 48,128, 6, 54, 49,128,
- 6, 55, 50,128, 6, 56, 51,128, 6, 57, 52,128, 6, 58, 52, 9,
- 47, 66, 47, 70, 47, 74, 47, 78, 47, 82, 47, 86, 47, 90, 47, 94,
- 47, 98, 48,128, 6, 64, 49,128, 6, 65, 50,128, 6, 66, 51,128,
- 6, 67, 52,128, 6, 68, 53,128, 6, 69, 54,128, 6, 70, 56,128,
- 6, 72, 57,128, 6, 73, 53, 9, 47,122, 47,126, 47,130, 47,134,
- 47,138, 47,142, 47,146, 47,150, 47,154, 48,128, 6, 74, 49,128,
- 6, 75, 50,128, 6, 76, 51,128, 6, 77, 52,128, 6, 78, 53,128,
- 6, 79, 54,128, 6, 80, 55,128, 6, 81, 56,128, 6, 82,183, 48,
- 128, 6, 71, 53, 3, 47,171, 47,203, 47,235, 48, 5, 47,183, 47,
- 187, 47,191, 47,195, 47,199, 53,128, 6,164, 54,128, 6,126, 55,
- 128, 6,134, 56,128, 6,152, 57,128, 6,175, 49, 5, 47,215, 47,
- 219, 47,223, 47,227, 47,231, 49,128, 6,121, 50,128, 6,136, 51,
- 128, 6,145, 52,128, 6,186, 57,128, 6,210,179, 52,128, 6,213,
- 54, 7, 48, 0, 48, 5, 48, 10, 48, 15, 48, 53, 48,115, 48,177,
- 179, 54,128, 32,170,180, 53,128, 5,190,181, 56,128, 5,195, 54,
- 6, 48, 29, 48, 33, 48, 37, 48, 41, 48, 45, 48, 49, 52,128, 5,
- 208, 53,128, 5,209, 54,128, 5,210, 55,128, 5,211, 56,128, 5,
- 212, 57,128, 5,213, 55, 10, 48, 75, 48, 79, 48, 83, 48, 87, 48,
- 91, 48, 95, 48, 99, 48,103, 48,107, 48,111, 48,128, 5,214, 49,
- 128, 5,215, 50,128, 5,216, 51,128, 5,217, 52,128, 5,218, 53,
- 128, 5,219, 54,128, 5,220, 55,128, 5,221, 56,128, 5,222, 57,
- 128, 5,223, 56, 10, 48,137, 48,141, 48,145, 48,149, 48,153, 48,
- 157, 48,161, 48,165, 48,169, 48,173, 48,128, 5,224, 49,128, 5,
- 225, 50,128, 5,226, 51,128, 5,227, 52,128, 5,228, 53,128, 5,
- 229, 54,128, 5,230, 55,128, 5,231, 56,128, 5,232, 57,128, 5,
- 233, 57, 3, 48,185, 48,189, 48,193, 48,128, 5,234, 52,128,251,
- 42, 53,128,251, 43, 55, 4, 48,207, 48,221, 48,241, 48,246, 48,
- 2, 48,213, 48,217, 48,128,251, 75, 53,128,251, 31, 49, 3, 48,
- 229, 48,233, 48,237, 54,128, 5,240, 55,128, 5,241, 56,128, 5,
- 242,178, 51,128,251, 53, 57, 7, 49, 6, 49, 10, 49, 14, 49, 18,
- 49, 22, 49, 26, 49, 30, 51,128, 5,180, 52,128, 5,181, 53,128,
- 5,182, 54,128, 5,187, 55,128, 5,184, 56,128, 5,183, 57,128,
- 5,176, 56, 3, 49, 42, 49, 86, 49, 91, 48, 7, 49, 58, 49, 62,
- 49, 66, 49, 70, 49, 74, 49, 78, 49, 82, 48,128, 5,178, 49,128,
- 5,177, 50,128, 5,179, 51,128, 5,194, 52,128, 5,193, 54,128,
- 5,185, 55,128, 5,188,179, 57,128, 5,189, 52, 2, 49, 97, 49,
- 101, 49,128, 5,191, 50,128, 5,192,185,178, 57,128, 2,188, 54,
- 3, 49,119, 49,178, 49,185, 49, 4, 49,129, 49,145, 49,151, 49,
- 172, 50, 2, 49,135, 49,140,180, 56,128, 33, 5,184, 57,128, 33,
- 19,179,181, 50,128, 33, 22,181, 55, 3, 49,160, 49,164, 49,168,
- 51,128, 32, 44, 52,128, 32, 45, 53,128, 32, 46,182,182, 52,128,
- 32, 12,179,177,182, 55,128, 6,109,180,185,179, 55,128, 2,189,
- 103, 2, 49,198, 49,205,242,225,246,101,128, 0,224,117, 2, 49,
- 211, 49,220,234,225,242,225,244,105,128, 10,133,242,237,245,235,
- 232,105,128, 10, 5,104, 2, 49,235, 49,245,233,242,225,231,225,
- 238, 97,128, 48, 66,239,239,235,225,226,239,246,101,128, 30,163,
- 105, 7, 50, 16, 50, 41, 50, 48, 50, 60, 50, 85, 50,101, 50,181,
- 98, 2, 50, 22, 50, 31,229,238,231,225,236,105,128, 9,144,239,
- 240,239,237,239,230,111,128, 49, 30,228,229,246, 97,128, 9, 16,
- 229,227,249,242,233,236,236,233, 99,128, 4,213,231,117, 2, 50,
- 67, 50, 76,234,225,242,225,244,105,128, 10,144,242,237,245,235,
- 232,105,128, 10, 16,237,225,244,242,225,231,245,242,237,245,235,
- 232,105,128, 10, 72,110, 5, 50,113, 50,122, 50,136, 50,152, 50,
- 167,225,242,225,226,233, 99,128, 6, 57,230,233,238,225,236,225,
- 242,225,226,233, 99,128,254,202,233,238,233,244,233,225,236,225,
- 242,225,226,233, 99,128,254,203,237,229,228,233,225,236,225,242,
- 225,226,233, 99,128,254,204,246,229,242,244,229,228,226,242,229,
- 246,101,128, 2, 3,246,239,247,229,236,243,233,231,110, 3, 50,
- 197, 50,207, 50,214,226,229,238,231,225,236,105,128, 9,200,228,
- 229,246, 97,128, 9, 72,231,245,234,225,242,225,244,105,128, 10,
- 200,107, 2, 50,231, 50,255,225,244,225,235,225,238, 97,129, 48,
- 162, 50,243,232,225,236,230,247,233,228,244,104,128,255,113,239,
- 242,229,225,110,128, 49, 79,108, 3, 51, 15, 52, 71, 52, 80,101,
- 2, 51, 21, 52, 66,102,136, 5,208, 51, 41, 51, 50, 51, 65, 51,
- 79, 51,168, 51,182, 52, 37, 52, 51,225,242,225,226,233, 99,128,
- 6, 39,228,225,231,229,243,232,232,229,226,242,229,119,128,251,
- 48,230,233,238,225,236,225,242,225,226,233, 99,128,254,142,104,
- 2, 51, 85, 51,160,225,237,250, 97, 2, 51, 94, 51,127,225,226,
- 239,246,101, 2, 51,104, 51,113,225,242,225,226,233, 99,128, 6,
- 35,230,233,238,225,236,225,242,225,226,233, 99,128,254,132,226,
- 229,236,239,119, 2, 51,137, 51,146,225,242,225,226,233, 99,128,
- 6, 37,230,233,238,225,236,225,242,225,226,233, 99,128,254,136,
- 229,226,242,229,119,128, 5,208,236,225,237,229,228,232,229,226,
- 242,229,119,128,251, 79,237, 97, 2, 51,189, 51,225,228,228,225,
- 225,226,239,246,101, 2, 51,202, 51,211,225,242,225,226,233, 99,
- 128, 6, 34,230,233,238,225,236,225,242,225,226,233, 99,128,254,
- 130,235,243,245,242, 97, 4, 51,239, 51,248, 52, 6, 52, 22,225,
- 242,225,226,233, 99,128, 6, 73,230,233,238,225,236,225,242,225,
- 226,233, 99,128,254,240,233,238,233,244,233,225,236,225,242,225,
- 226,233, 99,128,254,243,237,229,228,233,225,236,225,242,225,226,
- 233, 99,128,254,244,240,225,244,225,232,232,229,226,242,229,119,
- 128,251, 46,241,225,237,225,244,243,232,229,226,242,229,119,128,
- 251, 47,240,104,128, 33, 53,236,229,241,245,225,108,128, 34, 76,
- 240,232, 97,129, 3,177, 52, 88,244,239,238,239,115,128, 3,172,
- 109, 4, 52,106, 52,114, 52,125, 52,159,225,227,242,239,110,128,
- 1, 1,239,238,239,243,240,225,227,101,128,255, 65,240,229,242,
- 243,225,238,100,130, 0, 38, 52,139, 52,151,237,239,238,239,243,
- 240,225,227,101,128,255, 6,243,237,225,236,108,128,247, 38,243,
- 241,245,225,242,101,128, 51,194,110, 4, 52,178, 52,189, 53, 55,
- 53, 65,226,239,240,239,237,239,230,111,128, 49, 34,103, 4, 52,
- 199, 52,210, 52,224, 53, 47,226,239,240,239,237,239,230,111,128,
- 49, 36,235,232,225,238,235,232,245,244,232,225,105,128, 14, 90,
- 236,101,131, 34, 32, 52,235, 53, 32, 53, 39,226,242,225,227,235,
- 229,116, 2, 52,247, 53, 11,236,229,230,116,129, 48, 8, 53, 0,
- 246,229,242,244,233,227,225,108,128,254, 63,242,233,231,232,116,
- 129, 48, 9, 53, 21,246,229,242,244,233,227,225,108,128,254, 64,
- 236,229,230,116,128, 35, 41,242,233,231,232,116,128, 35, 42,243,
- 244,242,239,109,128, 33, 43,239,244,229,236,229,233, 97,128, 3,
- 135,117, 2, 53, 71, 53, 83,228,225,244,244,225,228,229,246, 97,
- 128, 9, 82,243,246,225,242, 97, 3, 53, 95, 53,105, 53,112,226,
- 229,238,231,225,236,105,128, 9,130,228,229,246, 97,128, 9, 2,
- 231,245,234,225,242,225,244,105,128, 10,130,239,231,239,238,229,
- 107,128, 1, 5,112, 3, 53,140, 53,164, 53,194, 97, 2, 53,146,
- 53,158,225,244,239,243,241,245,225,242,101,128, 51, 0,242,229,
- 110,128, 36,156,239,243,244,242,239,240,232,101, 2, 53,177, 53,
- 188,225,242,237,229,238,233,225,110,128, 5, 90,237,239,100,128,
- 2,188,112, 2, 53,200, 53,205,236,101,128,248,255,242,111, 2,
- 53,212, 53,220,225,227,232,229,115,128, 34, 80,120, 2, 53,226,
- 53,246,229,241,245,225,108,129, 34, 72, 53,236,239,242,233,237,
- 225,231,101,128, 34, 82,233,237,225,244,229,236,249,229,241,245,
- 225,108,128, 34, 69,114, 4, 54, 15, 54, 42, 54, 46, 54, 91,225,
- 229, 97, 2, 54, 23, 54, 33,229,235,239,242,229,225,110,128, 49,
- 142,235,239,242,229,225,110,128, 49,141, 99,128, 35, 18,105, 2,
- 54, 52, 54, 66,231,232,244,232,225,236,230,242,233,238,103,128,
- 30,154,238,103,130, 0,229, 54, 75, 54, 83,225,227,245,244,101,
- 128, 1,251,226,229,236,239,119,128, 30, 1,242,239,119, 8, 54,
- 111, 54,118, 54,247, 55, 57, 55,107, 55,162, 55,185, 56, 4,226,
- 239,244,104,128, 33,148,100, 3, 54,126, 54,165, 54,212,225,243,
- 104, 4, 54,138, 54,145, 54,152, 54,160,228,239,247,110,128, 33,
- 227,236,229,230,116,128, 33,224,242,233,231,232,116,128, 33,226,
- 245,112,128, 33,225,226,108, 5, 54,178, 54,185, 54,192, 54,199,
- 54,207,226,239,244,104,128, 33,212,228,239,247,110,128, 33,211,
- 236,229,230,116,128, 33,208,242,233,231,232,116,128, 33,210,245,
- 112,128, 33,209,239,247,110,131, 33,147, 54,224, 54,231, 54,239,
- 236,229,230,116,128, 33,153,242,233,231,232,116,128, 33,152,247,
- 232,233,244,101,128, 33,233,104, 2, 54,253, 55, 48,229,225,100,
- 4, 55, 9, 55, 19, 55, 29, 55, 40,228,239,247,238,237,239,100,
- 128, 2,197,236,229,230,244,237,239,100,128, 2,194,242,233,231,
- 232,244,237,239,100,128, 2,195,245,240,237,239,100,128, 2,196,
- 239,242,233,250,229,120,128,248,231,236,229,230,116,131, 33,144,
- 55, 70, 55, 87, 55, 99,228,226,108,129, 33,208, 55, 78,243,244,
- 242,239,235,101,128, 33,205,239,246,229,242,242,233,231,232,116,
- 128, 33,198,247,232,233,244,101,128, 33,230,242,233,231,232,116,
- 132, 33,146, 55,123, 55,135, 55,143, 55,154,228,226,236,243,244,
- 242,239,235,101,128, 33,207,232,229,225,246,121,128, 39,158,239,
- 246,229,242,236,229,230,116,128, 33,196,247,232,233,244,101,128,
- 33,232,244,225, 98, 2, 55,170, 55,177,236,229,230,116,128, 33,
- 228,242,233,231,232,116,128, 33,229,245,112,132, 33,145, 55,198,
- 55,226, 55,244, 55,252,100, 2, 55,204, 55,216,110,129, 33,149,
- 55,210,226,243,101,128, 33,168,239,247,238,226,225,243,101,128,
- 33,168,236,229,230,116,129, 33,150, 55,235,239,230,228,239,247,
- 110,128, 33,197,242,233,231,232,116,128, 33,151,247,232,233,244,
- 101,128, 33,231,246,229,242,244,229,120,128,248,230,115, 5, 56,
- 25, 56,101, 56,146, 56,229, 56,239, 99, 2, 56, 31, 56, 83,233,
- 105, 2, 56, 38, 56, 61,227,233,242,227,245,109,129, 0, 94, 56,
- 49,237,239,238,239,243,240,225,227,101,128,255, 62,244,233,236,
- 228,101,129, 0,126, 56, 71,237,239,238,239,243,240,225,227,101,
- 128,255, 94,242,233,240,116,129, 2, 81, 56, 92,244,245,242,238,
- 229,100,128, 2, 82,237,225,236,108, 2, 56,110, 56,121,232,233,
- 242,225,231,225,238, 97,128, 48, 65,235,225,244,225,235,225,238,
- 97,129, 48,161, 56,134,232,225,236,230,247,233,228,244,104,128,
- 255,103,244,229,242,233,115, 2, 56,156, 56,225,107,131, 0, 42,
- 56,166, 56,194, 56,217, 97, 2, 56,172, 56,186,236,244,239,238,
- 229,225,242,225,226,233, 99,128, 6,109,242,225,226,233, 99,128,
- 6,109,109, 2, 56,200, 56,206,225,244,104,128, 34, 23,239,238,
- 239,243,240,225,227,101,128,255, 10,243,237,225,236,108,128,254,
- 97,109,128, 32, 66,245,240,229,242,233,239,114,128,246,233,249,
- 237,240,244,239,244,233,227,225,236,236,249,229,241,245,225,108,
- 128, 34, 67,116,132, 0, 64, 57, 15, 57, 22, 57, 34, 57, 42,233,
- 236,228,101,128, 0,227,237,239,238,239,243,240,225,227,101,128,
- 255, 32,243,237,225,236,108,128,254,107,245,242,238,229,100,128,
- 2, 80,117, 6, 57, 64, 57, 89, 57, 96, 57,121, 57,141, 57,157,
- 98, 2, 57, 70, 57, 79,229,238,231,225,236,105,128, 9,148,239,
- 240,239,237,239,230,111,128, 49, 32,228,229,246, 97,128, 9, 20,
- 231,117, 2, 57,103, 57,112,234,225,242,225,244,105,128, 10,148,
- 242,237,245,235,232,105,128, 10, 20,236,229,238,231,244,232,237,
- 225,242,235,226,229,238,231,225,236,105,128, 9,215,237,225,244,
- 242,225,231,245,242,237,245,235,232,105,128, 10, 76,246,239,247,
- 229,236,243,233,231,110, 3, 57,173, 57,183, 57,190,226,229,238,
- 231,225,236,105,128, 9,204,228,229,246, 97,128, 9, 76,231,245,
- 234,225,242,225,244,105,128, 10,204,246,225,231,242,225,232,225,
- 228,229,246, 97,128, 9, 61,121, 2, 57,221, 57,233,226,225,242,
- 237,229,238,233,225,110,128, 5, 97,233,110,130, 5,226, 57,242,
- 58, 1,225,236,244,239,238,229,232,229,226,242,229,119,128,251,
- 32,232,229,226,242,229,119,128, 5,226, 98,144, 0, 98, 58, 46,
- 58,181, 58,192, 58,201, 58,226, 60, 11, 60, 73, 60,146, 62, 72,
- 62, 84, 62,127, 62,135, 62,145, 64, 15, 64, 39, 64, 48, 97, 7,
- 58, 62, 58, 72, 58, 96, 58,103, 58,128, 58,152, 58,163,226,229,
- 238,231,225,236,105,128, 9,172,227,235,243,236,225,243,104,129,
- 0, 92, 58, 84,237,239,238,239,243,240,225,227,101,128,255, 60,
- 228,229,246, 97,128, 9, 44,231,117, 2, 58,110, 58,119,234,225,
- 242,225,244,105,128, 10,172,242,237,245,235,232,105,128, 10, 44,
- 104, 2, 58,134, 58,144,233,242,225,231,225,238, 97,128, 48,112,
- 244,244,232,225,105,128, 14, 63,235,225,244,225,235,225,238, 97,
- 128, 48,208,114,129, 0,124, 58,169,237,239,238,239,243,240,225,
- 227,101,128,255, 92,226,239,240,239,237,239,230,111,128, 49, 5,
- 227,233,242,227,236,101,128, 36,209,228,239,116, 2, 58,209, 58,
- 218,225,227,227,229,238,116,128, 30, 3,226,229,236,239,119,128,
- 30, 5,101, 6, 58,240, 59, 5, 59, 28, 59,170, 59,181, 59,193,
- 225,237,229,228,243,233,248,244,229,229,238,244,232,238,239,244,
- 229,115,128, 38,108, 99, 2, 59, 11, 59, 18,225,245,243,101,128,
- 34, 53,249,242,233,236,236,233, 99,128, 4, 49,104, 5, 59, 40,
- 59, 49, 59, 63, 59, 93, 59,152,225,242,225,226,233, 99,128, 6,
- 40,230,233,238,225,236,225,242,225,226,233, 99,128,254,144,105,
- 2, 59, 69, 59, 84,238,233,244,233,225,236,225,242,225,226,233,
- 99,128,254,145,242,225,231,225,238, 97,128, 48,121,237,101, 2,
- 59,100, 59,113,228,233,225,236,225,242,225,226,233, 99,128,254,
- 146,229,237,105, 2, 59,121, 59,136,238,233,244,233,225,236,225,
- 242,225,226,233, 99,128,252,159,243,239,236,225,244,229,228,225,
- 242,225,226,233, 99,128,252, 8,238,239,239,238,230,233,238,225,
- 236,225,242,225,226,233, 99,128,252,109,235,225,244,225,235,225,
- 238, 97,128, 48,217,238,225,242,237,229,238,233,225,110,128, 5,
- 98,116,132, 5,209, 59,205, 59,225, 59,245, 59,254, 97,129, 3,
- 178, 59,211,243,249,237,226,239,236,231,242,229,229,107,128, 3,
- 208,228,225,231,229,243,104,129,251, 49, 59,236,232,229,226,242,
- 229,119,128,251, 49,232,229,226,242,229,119,128, 5,209,242,225,
- 230,229,232,229,226,242,229,119,128,251, 76,104, 2, 60, 17, 60,
- 67, 97, 3, 60, 25, 60, 35, 60, 42,226,229,238,231,225,236,105,
- 128, 9,173,228,229,246, 97,128, 9, 45,231,117, 2, 60, 49, 60,
- 58,234,225,242,225,244,105,128, 10,173,242,237,245,235,232,105,
- 128, 10, 45,239,239,107,128, 2, 83,105, 5, 60, 85, 60, 96, 60,
- 107, 60,121, 60,135,232,233,242,225,231,225,238, 97,128, 48,115,
- 235,225,244,225,235,225,238, 97,128, 48,211,236,225,226,233,225,
- 236,227,236,233,227,107,128, 2,152,238,228,233,231,245,242,237,
- 245,235,232,105,128, 10, 2,242,245,243,241,245,225,242,101,128,
- 51, 49,108, 3, 60,154, 62, 55, 62, 66, 97, 2, 60,160, 62, 50,
- 227,107, 6, 60,175, 60,184, 60,221, 61,114, 61,169, 61,221,227,
- 233,242,227,236,101,128, 37,207,100, 2, 60,190, 60,199,233,225,
- 237,239,238,100,128, 37,198,239,247,238,240,239,233,238,244,233,
- 238,231,244,242,233,225,238,231,236,101,128, 37,188,108, 2, 60,
- 227, 61, 74,101, 2, 60,233, 61, 13,230,244,240,239,233,238,244,
- 233,238,103, 2, 60,248, 61, 2,240,239,233,238,244,229,114,128,
- 37,196,244,242,233,225,238,231,236,101,128, 37,192,238,244,233,
- 227,245,236,225,242,226,242,225,227,235,229,116, 2, 61, 33, 61,
- 53,236,229,230,116,129, 48, 16, 61, 42,246,229,242,244,233,227,
- 225,108,128,254, 59,242,233,231,232,116,129, 48, 17, 61, 63,246,
- 229,242,244,233,227,225,108,128,254, 60,239,247,229,114, 2, 61,
- 83, 61, 98,236,229,230,244,244,242,233,225,238,231,236,101,128,
- 37,227,242,233,231,232,244,244,242,233,225,238,231,236,101,128,
- 37,226,114, 2, 61,120, 61,131,229,227,244,225,238,231,236,101,
- 128, 37,172,233,231,232,244,240,239,233,238,244,233,238,103, 2,
- 61,148, 61,158,240,239,233,238,244,229,114,128, 37,186,244,242,
- 233,225,238,231,236,101,128, 37,182,115, 3, 61,177, 61,207, 61,
- 215,109, 2, 61,183, 61,195,225,236,236,243,241,245,225,242,101,
- 128, 37,170,233,236,233,238,231,230,225,227,101,128, 38, 59,241,
- 245,225,242,101,128, 37,160,244,225,114,128, 38, 5,245,240,112,
- 2, 61,229, 62, 11,229,114, 2, 61,236, 61,251,236,229,230,244,
- 244,242,233,225,238,231,236,101,128, 37,228,242,233,231,232,244,
- 244,242,233,225,238,231,236,101,128, 37,229,239,233,238,244,233,
- 238,103, 2, 62, 23, 62, 39,243,237,225,236,236,244,242,233,225,
- 238,231,236,101,128, 37,180,244,242,233,225,238,231,236,101,128,
- 37,178,238,107,128, 36, 35,233,238,229,226,229,236,239,119,128,
- 30, 7,239,227,107,128, 37,136,237,239,238,239,243,240,225,227,
- 101,128,255, 66,111, 3, 62, 92, 62,105, 62,116,226,225,233,237,
- 225,233,244,232,225,105,128, 14, 26,232,233,242,225,231,225,238,
- 97,128, 48,124,235,225,244,225,235,225,238, 97,128, 48,220,240,
- 225,242,229,110,128, 36,157,241,243,241,245,225,242,101,128, 51,
- 195,114, 4, 62,155, 63,149, 63,222, 64, 5,225, 99, 2, 62,162,
- 63, 56,101, 3, 62,170, 62,175, 62,243,229,120,128,248,244,236,
- 229,230,116,133, 0,123, 62,192, 62,197, 62,219, 62,227, 62,232,
- 226,116,128,248,243,109, 2, 62,203, 62,208,233,100,128,248,242,
- 239,238,239,243,240,225,227,101,128,255, 91,243,237,225,236,108,
- 128,254, 91,244,112,128,248,241,246,229,242,244,233,227,225,108,
- 128,254, 55,242,233,231,232,116,133, 0,125, 63, 5, 63, 10, 63,
- 32, 63, 40, 63, 45,226,116,128,248,254,109, 2, 63, 16, 63, 21,
- 233,100,128,248,253,239,238,239,243,240,225,227,101,128,255, 93,
- 243,237,225,236,108,128,254, 92,244,112,128,248,252,246,229,242,
- 244,233,227,225,108,128,254, 56,235,229,116, 2, 63, 64, 63,106,
- 236,229,230,116,132, 0, 91, 63, 79, 63, 84, 63, 89, 63,101,226,
- 116,128,248,240,229,120,128,248,239,237,239,238,239,243,240,225,
- 227,101,128,255, 59,244,112,128,248,238,242,233,231,232,116,132,
- 0, 93, 63,122, 63,127, 63,132, 63,144,226,116,128,248,251,229,
- 120,128,248,250,237,239,238,239,243,240,225,227,101,128,255, 61,
- 244,112,128,248,249,229,246,101,131, 2,216, 63,161, 63,172, 63,
- 178,226,229,236,239,247,227,237, 98,128, 3, 46,227,237, 98,128,
- 3, 6,233,238,246,229,242,244,229,100, 3, 63,193, 63,204, 63,
- 210,226,229,236,239,247,227,237, 98,128, 3, 47,227,237, 98,128,
- 3, 17,228,239,245,226,236,229,227,237, 98,128, 3, 97,233,228,
- 231,101, 2, 63,231, 63,242,226,229,236,239,247,227,237, 98,128,
- 3, 42,233,238,246,229,242,244,229,228,226,229,236,239,247,227,
- 237, 98,128, 3, 58,239,235,229,238,226,225,114,128, 0,166,115,
- 2, 64, 21, 64, 29,244,242,239,235,101,128, 1,128,245,240,229,
- 242,233,239,114,128,246,234,244,239,240,226,225,114,128, 1,131,
- 117, 3, 64, 56, 64, 67, 64, 78,232,233,242,225,231,225,238, 97,
- 128, 48,118,235,225,244,225,235,225,238, 97,128, 48,214,236,108,
- 2, 64, 85, 64,115,229,116,130, 32, 34, 64, 94, 64,104,233,238,
- 246,229,242,243,101,128, 37,216,239,240,229,242,225,244,239,114,
- 128, 34, 25,243,229,249,101,128, 37,206, 99,143, 0, 99, 64,156,
- 65,105, 65,116, 65,180, 65,211, 66, 48, 67,215, 68,199, 69, 43,
- 69, 92, 72, 84, 72, 92, 72,102, 72,114, 72,147, 97, 9, 64,176,
- 64,187, 64,197, 64,204, 64,211, 64,236, 64,246, 65, 42, 65, 51,
- 225,242,237,229,238,233,225,110,128, 5,110,226,229,238,231,225,
- 236,105,128, 9,154,227,245,244,101,128, 1, 7,228,229,246, 97,
- 128, 9, 26,231,117, 2, 64,218, 64,227,234,225,242,225,244,105,
- 128, 10,154,242,237,245,235,232,105,128, 10, 26,236,243,241,245,
- 225,242,101,128, 51,136,238,228,242,225,226,233,238,228,117, 4,
- 65, 8, 65, 18, 65, 24, 65, 31,226,229,238,231,225,236,105,128,
- 9,129,227,237, 98,128, 3, 16,228,229,246, 97,128, 9, 1,231,
- 245,234,225,242,225,244,105,128, 10,129,240,243,236,239,227,107,
- 128, 33,234,114, 3, 65, 59, 65, 65, 65, 91,229,239,102,128, 33,
- 5,239,110,130, 2,199, 65, 74, 65, 85,226,229,236,239,247,227,
- 237, 98,128, 3, 44,227,237, 98,128, 3, 12,242,233,225,231,229,
- 242,229,244,245,242,110,128, 33,181,226,239,240,239,237,239,230,
- 111,128, 49, 24, 99, 4, 65,126, 65,133, 65,152, 65,174,225,242,
- 239,110,128, 1, 13,229,228,233,236,236, 97,129, 0,231, 65,144,
- 225,227,245,244,101,128, 30, 9,233,242, 99, 2, 65,160, 65,165,
- 236,101,128, 36,210,245,237,230,236,229,120,128, 1, 9,245,242,
- 108,128, 2, 85,100, 2, 65,186, 65,202,239,116,129, 1, 11, 65,
- 193,225,227,227,229,238,116,128, 1, 11,243,241,245,225,242,101,
- 128, 51,197,101, 2, 65,217, 65,233,228,233,236,236, 97,129, 0,
- 184, 65,227,227,237, 98,128, 3, 39,238,116,132, 0,162, 65,246,
- 66, 14, 66, 26, 66, 37,105, 2, 65,252, 66, 4,231,242,225,228,
- 101,128, 33, 3,238,230,229,242,233,239,114,128,246,223,237,239,
- 238,239,243,240,225,227,101,128,255,224,239,236,228,243,244,249,
- 236,101,128,247,162,243,245,240,229,242,233,239,114,128,246,224,
- 104, 5, 66, 60, 66,123, 66,134, 67, 62, 67,154, 97, 4, 66, 70,
- 66, 81, 66, 91, 66, 98,225,242,237,229,238,233,225,110,128, 5,
- 121,226,229,238,231,225,236,105,128, 9,155,228,229,246, 97,128,
- 9, 27,231,117, 2, 66,105, 66,114,234,225,242,225,244,105,128,
- 10,155,242,237,245,235,232,105,128, 10, 27,226,239,240,239,237,
- 239,230,111,128, 49, 20,101, 6, 66,148, 66,168, 66,192, 67, 4,
- 67, 16, 67, 37,225,226,235,232,225,243,233,225,238,227,249,242,
- 233,236,236,233, 99,128, 4,189, 99, 2, 66,174, 66,182,235,237,
- 225,242,107,128, 39, 19,249,242,233,236,236,233, 99,128, 4, 71,
- 100, 2, 66,198, 66,242,229,243,227,229,238,228,229,114, 2, 66,
- 211, 66,231,225,226,235,232,225,243,233,225,238,227,249,242,233,
- 236,236,233, 99,128, 4,191,227,249,242,233,236,236,233, 99,128,
- 4,183,233,229,242,229,243,233,243,227,249,242,233,236,236,233,
- 99,128, 4,245,232,225,242,237,229,238,233,225,110,128, 5,115,
- 235,232,225,235,225,243,243,233,225,238,227,249,242,233,236,236,
- 233, 99,128, 4,204,246,229,242,244,233,227,225,236,243,244,242,
- 239,235,229,227,249,242,233,236,236,233, 99,128, 4,185,105,129,
- 3,199, 67, 68,229,245,227,104, 4, 67, 81, 67,116, 67,131, 67,
- 140, 97, 2, 67, 87, 67,102,227,233,242,227,236,229,235,239,242,
- 229,225,110,128, 50,119,240,225,242,229,238,235,239,242,229,225,
- 110,128, 50, 23,227,233,242,227,236,229,235,239,242,229,225,110,
- 128, 50,105,235,239,242,229,225,110,128, 49, 74,240,225,242,229,
- 238,235,239,242,229,225,110,128, 50, 9,111, 2, 67,160, 67,210,
- 227,104, 3, 67,169, 67,191, 67,201,225,110, 2, 67,176, 67,184,
- 231,244,232,225,105,128, 14, 10,244,232,225,105,128, 14, 8,233,
- 238,231,244,232,225,105,128, 14, 9,239,229,244,232,225,105,128,
- 14, 12,239,107,128, 1,136,105, 2, 67,221, 68, 67,229,245, 99,
- 5, 67,235, 68, 14, 68, 29, 68, 38, 68, 52, 97, 2, 67,241, 68,
- 0,227,233,242,227,236,229,235,239,242,229,225,110,128, 50,118,
- 240,225,242,229,238,235,239,242,229,225,110,128, 50, 22,227,233,
- 242,227,236,229,235,239,242,229,225,110,128, 50,104,235,239,242,
- 229,225,110,128, 49, 72,240,225,242,229,238,235,239,242,229,225,
- 110,128, 50, 8,245,240,225,242,229,238,235,239,242,229,225,110,
- 128, 50, 28,242, 99, 2, 68, 74, 68,169,236,101,132, 37,203, 68,
- 87, 68, 98, 68,103, 68,127,237,245,236,244,233,240,236,121,128,
- 34,151,239,116,128, 34,153,112, 2, 68,109, 68,115,236,245,115,
- 128, 34,149,239,243,244,225,236,237,225,242,107,128, 48, 54,247,
- 233,244,104, 2, 68,136, 68,152,236,229,230,244,232,225,236,230,
- 226,236,225,227,107,128, 37,208,242,233,231,232,244,232,225,236,
- 230,226,236,225,227,107,128, 37,209,245,237,230,236,229,120,130,
- 2,198, 68,182, 68,193,226,229,236,239,247,227,237, 98,128, 3,
- 45,227,237, 98,128, 3, 2,108, 3, 68,207, 68,213, 69, 11,229,
- 225,114,128, 35, 39,233,227,107, 4, 68,225, 68,236, 68,245, 68,
- 255,225,236,246,229,239,236,225,114,128, 1,194,228,229,238,244,
- 225,108,128, 1,192,236,225,244,229,242,225,108,128, 1,193,242,
- 229,244,242,239,230,236,229,120,128, 1,195,245, 98,129, 38, 99,
- 69, 18,243,245,233,116, 2, 69, 27, 69, 35,226,236,225,227,107,
- 128, 38, 99,247,232,233,244,101,128, 38,103,109, 3, 69, 51, 69,
- 65, 69, 76,227,245,226,229,228,243,241,245,225,242,101,128, 51,
- 164,239,238,239,243,240,225,227,101,128,255, 67,243,241,245,225,
- 242,229,228,243,241,245,225,242,101,128, 51,160,111, 8, 69,110,
- 69,121, 69,208, 70,150, 71,179, 71,210, 72, 61, 72, 70,225,242,
- 237,229,238,233,225,110,128, 5,129,236,239,110,131, 0, 58, 69,
- 133, 69,158, 69,177,237,239,110, 2, 69,141, 69,149,229,244,225,
- 242,121,128, 32,161,239,243,240,225,227,101,128,255, 26,115, 2,
- 69,164, 69,170,233,231,110,128, 32,161,237,225,236,108,128,254,
- 85,244,242,233,225,238,231,245,236,225,114, 2, 69,192, 69,202,
- 232,225,236,230,237,239,100,128, 2,209,237,239,100,128, 2,208,
- 109, 2, 69,214, 70,143,237, 97,134, 0, 44, 69,231, 70, 39, 70,
- 50, 70, 62, 70, 92, 70,115, 97, 3, 69,239, 70, 9, 70, 17,226,
- 239,246,101, 2, 69,248, 69,254,227,237, 98,128, 3, 19,242,233,
- 231,232,244,227,237, 98,128, 3, 21,227,227,229,238,116,128,246,
- 195,114, 2, 70, 23, 70, 30,225,226,233, 99,128, 6, 12,237,229,
- 238,233,225,110,128, 5, 93,233,238,230,229,242,233,239,114,128,
- 246,225,237,239,238,239,243,240,225,227,101,128,255, 12,242,229,
- 246,229,242,243,229,100, 2, 70, 75, 70, 86,225,226,239,246,229,
- 227,237, 98,128, 3, 20,237,239,100,128, 2,189,115, 2, 70, 98,
- 70,105,237,225,236,108,128,254, 80,245,240,229,242,233,239,114,
- 128,246,226,244,245,242,238,229,100, 2, 70,126, 70,137,225,226,
- 239,246,229,227,237, 98,128, 3, 18,237,239,100,128, 2,187,240,
- 225,243,115,128, 38, 60,110, 2, 70,156, 70,165,231,242,245,229,
- 238,116,128, 34, 69,116, 2, 70,171, 70,185,239,245,242,233,238,
- 244,229,231,242,225,108,128, 34, 46,242,239,108,142, 35, 3, 70,
- 219, 70,225, 70,240, 70,255, 71, 43, 71, 88, 71,102, 71,107, 71,
- 112, 71,117, 71,123, 71,128, 71,169, 71,174,193,195, 75,128, 0,
- 6, 66, 2, 70,231, 70,236,197, 76,128, 0, 7, 83,128, 0, 8,
- 67, 2, 70,246, 70,251,193, 78,128, 0, 24, 82,128, 0, 13, 68,
- 3, 71, 7, 71, 33, 71, 38, 67, 4, 71, 17, 71, 21, 71, 25, 71,
- 29, 49,128, 0, 17, 50,128, 0, 18, 51,128, 0, 19, 52,128, 0,
- 20,197, 76,128, 0,127,204, 69,128, 0, 16, 69, 5, 71, 55, 71,
- 59, 71, 64, 71, 69, 71, 74, 77,128, 0, 25,206, 81,128, 0, 5,
- 207, 84,128, 0, 4,211, 67,128, 0, 27, 84, 2, 71, 80, 71, 84,
- 66,128, 0, 23, 88,128, 0, 3, 70, 2, 71, 94, 71, 98, 70,128,
- 0, 12, 83,128, 0, 28,199, 83,128, 0, 29,200, 84,128, 0, 9,
- 204, 70,128, 0, 10,206,193, 75,128, 0, 21,210, 83,128, 0, 30,
- 83, 5, 71,140, 71,144, 71,154, 71,159, 71,164, 73,128, 0, 15,
- 79,129, 0, 14, 71,150, 84,128, 0, 2,212, 88,128, 0, 1,213,
- 66,128, 0, 26,217, 78,128, 0, 22,213, 83,128, 0, 31,214, 84,
- 128, 0, 11,240,249,242,233,231,232,116,129, 0,169, 71,191,115,
- 2, 71,197, 71,203,225,238,115,128,248,233,229,242,233,102,128,
- 246,217,114, 2, 71,216, 72, 44,238,229,242,226,242,225,227,235,
- 229,116, 2, 71,231, 72, 9,236,229,230,116,130, 48, 12, 71,242,
- 71,254,232,225,236,230,247,233,228,244,104,128,255, 98,246,229,
- 242,244,233,227,225,108,128,254, 65,242,233,231,232,116,130, 48,
- 13, 72, 21, 72, 33,232,225,236,230,247,233,228,244,104,128,255,
- 99,246,229,242,244,233,227,225,108,128,254, 66,240,239,242,225,
- 244,233,239,238,243,241,245,225,242,101,128, 51,127,243,241,245,
- 225,242,101,128, 51,199,246,229,242,235,231,243,241,245,225,242,
- 101,128, 51,198,240,225,242,229,110,128, 36,158,242,245,250,229,
- 233,242,111,128, 32,162,243,244,242,229,244,227,232,229,100,128,
- 2,151,245,114, 2, 72,121, 72,139,236,121, 2, 72,128, 72,134,
- 225,238,100,128, 34,207,239,114,128, 34,206,242,229,238,227,121,
- 128, 0,164,249,114, 4, 72,158, 72,166, 72,173, 72,181,194,242,
- 229,246,101,128,246,209,198,236,229,120,128,246,210,226,242,229,
- 246,101,128,246,212,230,236,229,120,128,246,213,100,146, 0,100,
- 72,228, 74,110, 75,134, 75,194, 76,114, 77, 68, 77,130, 78, 59,
- 78, 72, 78, 81, 78,107, 78,132, 78,141, 79,208, 79,216, 79,227,
- 79,247, 80, 19, 97, 11, 72,252, 73, 7, 73, 17, 73, 89, 73,152,
- 73,163, 73,174, 73,243, 74, 49, 74, 55, 74, 85,225,242,237,229,
- 238,233,225,110,128, 5,100,226,229,238,231,225,236,105,128, 9,
- 166,100, 5, 73, 29, 73, 38, 73, 44, 73, 58, 73, 74,225,242,225,
- 226,233, 99,128, 6, 54,229,246, 97,128, 9, 38,230,233,238,225,
- 236,225,242,225,226,233, 99,128,254,190,233,238,233,244,233,225,
- 236,225,242,225,226,233, 99,128,254,191,237,229,228,233,225,236,
- 225,242,225,226,233, 99,128,254,192,103, 3, 73, 97, 73,114, 73,
- 128,229,243,104,129, 5,188, 73,105,232,229,226,242,229,119,128,
- 5,188,231,229,114,129, 32, 32, 73,122,228,226,108,128, 32, 33,
- 117, 2, 73,134, 73,143,234,225,242,225,244,105,128, 10,166,242,
- 237,245,235,232,105,128, 10, 38,232,233,242,225,231,225,238, 97,
- 128, 48, 96,235,225,244,225,235,225,238, 97,128, 48,192,108, 3,
- 73,182, 73,191, 73,229,225,242,225,226,233, 99,128, 6, 47,229,
- 116,130, 5,211, 73,200, 73,220,228,225,231,229,243,104,129,251,
- 51, 73,211,232,229,226,242,229,119,128,251, 51,232,229,226,242,
- 229,119,128, 5,211,230,233,238,225,236,225,242,225,226,233, 99,
- 128,254,170,237,237, 97, 3, 73,253, 74, 6, 74, 18,225,242,225,
- 226,233, 99,128, 6, 79,236,239,247,225,242,225,226,233, 99,128,
- 6, 79,244,225,238, 97, 2, 74, 27, 74, 41,236,244,239,238,229,
- 225,242,225,226,233, 99,128, 6, 76,242,225,226,233, 99,128, 6,
- 76,238,228, 97,128, 9,100,242,231, 97, 2, 74, 63, 74, 72,232,
- 229,226,242,229,119,128, 5,167,236,229,230,244,232,229,226,242,
- 229,119,128, 5,167,243,233,225,240,238,229,245,237,225,244,225,
- 227,249,242,233,236,236,233,227,227,237, 98,128, 4,133, 98, 3,
- 74,118, 75,115, 75,125,108, 9, 74,138, 74,146, 75, 3, 75, 11,
- 75, 27, 75, 38, 75, 56, 75, 70, 75, 81,199,242,225,246,101,128,
- 246,211, 97, 2, 74,152, 74,209,238,231,236,229,226,242,225,227,
- 235,229,116, 2, 74,168, 74,188,236,229,230,116,129, 48, 10, 74,
- 177,246,229,242,244,233,227,225,108,128,254, 61,242,233,231,232,
- 116,129, 48, 11, 74,198,246,229,242,244,233,227,225,108,128,254,
- 62,114, 2, 74,215, 74,236,227,232,233,238,246,229,242,244,229,
- 228,226,229,236,239,247,227,237, 98,128, 3, 43,242,239,119, 2,
- 74,244, 74,251,236,229,230,116,128, 33,212,242,233,231,232,116,
- 128, 33,210,228,225,238,228, 97,128, 9,101,231,242,225,246,101,
- 129,246,214, 75, 21,227,237, 98,128, 3, 15,233,238,244,229,231,
- 242,225,108,128, 34, 44,236,239,247,236,233,238,101,129, 32, 23,
- 75, 50,227,237, 98,128, 3, 51,239,246,229,242,236,233,238,229,
- 227,237, 98,128, 3, 63,240,242,233,237,229,237,239,100,128, 2,
- 186,246,229,242,244,233,227,225,108, 2, 75, 94, 75,100,226,225,
- 114,128, 32, 22,236,233,238,229,225,226,239,246,229,227,237, 98,
- 128, 3, 14,239,240,239,237,239,230,111,128, 49, 9,243,241,245,
- 225,242,101,128, 51,200, 99, 4, 75,144, 75,151, 75,160, 75,187,
- 225,242,239,110,128, 1, 15,229,228,233,236,236, 97,128, 30, 17,
- 233,242, 99, 2, 75,168, 75,173,236,101,128, 36,211,245,237,230,
- 236,229,248,226,229,236,239,119,128, 30, 19,242,239,225,116,128,
- 1, 17,100, 4, 75,204, 76, 29, 76, 39, 76, 90, 97, 4, 75,214,
- 75,224, 75,231, 76, 0,226,229,238,231,225,236,105,128, 9,161,
- 228,229,246, 97,128, 9, 33,231,117, 2, 75,238, 75,247,234,225,
- 242,225,244,105,128, 10,161,242,237,245,235,232,105,128, 10, 33,
- 108, 2, 76, 6, 76, 15,225,242,225,226,233, 99,128, 6,136,230,
- 233,238,225,236,225,242,225,226,233, 99,128,251,137,228,232,225,
- 228,229,246, 97,128, 9, 92,232, 97, 3, 76, 48, 76, 58, 76, 65,
- 226,229,238,231,225,236,105,128, 9,162,228,229,246, 97,128, 9,
- 34,231,117, 2, 76, 72, 76, 81,234,225,242,225,244,105,128, 10,
- 162,242,237,245,235,232,105,128, 10, 34,239,116, 2, 76, 97, 76,
- 106,225,227,227,229,238,116,128, 30, 11,226,229,236,239,119,128,
- 30, 13,101, 8, 76,132, 76,185, 76,192, 76,217, 76,227, 76,238,
- 77, 27, 77, 63, 99, 2, 76,138, 76,175,233,237,225,236,243,229,
- 240,225,242,225,244,239,114, 2, 76,156, 76,165,225,242,225,226,
- 233, 99,128, 6,107,240,229,242,243,233,225,110,128, 6,107,249,
- 242,233,236,236,233, 99,128, 4, 52,231,242,229,101,128, 0,176,
- 232,105, 2, 76,199, 76,208,232,229,226,242,229,119,128, 5,173,
- 242,225,231,225,238, 97,128, 48,103,233,227,239,240,244,233, 99,
- 128, 3,239,235,225,244,225,235,225,238, 97,128, 48,199,108, 2,
- 76,244, 77, 11,229,244,101, 2, 76,252, 77, 3,236,229,230,116,
- 128, 35, 43,242,233,231,232,116,128, 35, 38,244, 97,129, 3,180,
- 77, 18,244,245,242,238,229,100,128, 1,141,238,239,237,233,238,
- 225,244,239,242,237,233,238,245,243,239,238,229,238,245,237,229,
- 242,225,244,239,242,226,229,238,231,225,236,105,128, 9,248,250,
- 104,128, 2,164,104, 2, 77, 74, 77,124, 97, 3, 77, 82, 77, 92,
- 77, 99,226,229,238,231,225,236,105,128, 9,167,228,229,246, 97,
- 128, 9, 39,231,117, 2, 77,106, 77,115,234,225,242,225,244,105,
- 128, 10,167,242,237,245,235,232,105,128, 10, 39,239,239,107,128,
- 2, 87,105, 6, 77,144, 77,193, 77,253, 78, 8, 78, 19, 78, 29,
- 97, 2, 77,150, 77,172,236,249,244,233,235,225,244,239,238,239,
- 115,129, 3,133, 77,166,227,237, 98,128, 3, 68,237,239,238,100,
- 129, 38,102, 77,181,243,245,233,244,247,232,233,244,101,128, 38,
- 98,229,242,229,243,233,115,133, 0,168, 77,212, 77,220, 77,231,
- 77,237, 77,245,225,227,245,244,101,128,246,215,226,229,236,239,
- 247,227,237, 98,128, 3, 36,227,237, 98,128, 3, 8,231,242,225,
- 246,101,128,246,216,244,239,238,239,115,128, 3,133,232,233,242,
- 225,231,225,238, 97,128, 48, 98,235,225,244,225,235,225,238, 97,
- 128, 48,194,244,244,239,237,225,242,107,128, 48, 3,246,105, 2,
- 78, 36, 78, 47,228,101,129, 0,247, 78, 43,115,128, 34, 35,243,
- 233,239,238,243,236,225,243,104,128, 34, 21,234,229,227,249,242,
- 233,236,236,233, 99,128, 4, 82,235,243,232,225,228,101,128, 37,
- 147,108, 2, 78, 87, 78, 98,233,238,229,226,229,236,239,119,128,
- 30, 15,243,241,245,225,242,101,128, 51,151,109, 2, 78,113, 78,
- 121,225,227,242,239,110,128, 1, 17,239,238,239,243,240,225,227,
- 101,128,255, 68,238,226,236,239,227,107,128, 37,132,111, 10, 78,
- 163, 78,175, 78,185, 78,196, 78,207, 79, 23, 79, 28, 79, 39, 79,
- 154, 79,180,227,232,225,228,225,244,232,225,105,128, 14, 14,228,
- 229,235,244,232,225,105,128, 14, 20,232,233,242,225,231,225,238,
- 97,128, 48,105,235,225,244,225,235,225,238, 97,128, 48,201,236,
- 236,225,114,132, 0, 36, 78,222, 78,233, 78,245, 79, 0,233,238,
- 230,229,242,233,239,114,128,246,227,237,239,238,239,243,240,225,
- 227,101,128,255, 4,239,236,228,243,244,249,236,101,128,247, 36,
- 115, 2, 79, 6, 79, 13,237,225,236,108,128,254,105,245,240,229,
- 242,233,239,114,128,246,228,238,103,128, 32,171,242,245,243,241,
- 245,225,242,101,128, 51, 38,116, 6, 79, 53, 79, 70, 79, 92, 79,
- 103, 79,135, 79,142,225,227,227,229,238,116,129, 2,217, 79, 64,
- 227,237, 98,128, 3, 7,226,229,236,239,247, 99, 2, 79, 81, 79,
- 86,237, 98,128, 3, 35,239,237, 98,128, 3, 35,235,225,244,225,
- 235,225,238, 97,128, 48,251,236,229,243,115, 2, 79,112, 79,116,
- 105,128, 1, 49,106,129,246,190, 79,122,243,244,242,239,235,229,
- 232,239,239,107,128, 2,132,237,225,244,104,128, 34,197,244,229,
- 228,227,233,242,227,236,101,128, 37,204,245,226,236,229,249,239,
- 228,240,225,244,225,104,129,251, 31, 79,171,232,229,226,242,229,
- 119,128,251, 31,247,238,244,225,227,107, 2, 79,191, 79,202,226,
- 229,236,239,247,227,237, 98,128, 3, 30,237,239,100,128, 2,213,
- 240,225,242,229,110,128, 36,159,243,245,240,229,242,233,239,114,
- 128,246,235,116, 2, 79,233, 79,239,225,233,108,128, 2, 86,239,
- 240,226,225,114,128, 1,140,117, 2, 79,253, 80, 8,232,233,242,
- 225,231,225,238, 97,128, 48,101,235,225,244,225,235,225,238, 97,
- 128, 48,197,122,132, 1,243, 80, 31, 80, 40, 80, 59, 80, 96,225,
- 236,244,239,238,101,128, 2,163, 99, 2, 80, 46, 80, 53,225,242,
- 239,110,128, 1,198,245,242,108,128, 2,165,101, 2, 80, 65, 80,
- 85,225,226,235,232,225,243,233,225,238,227,249,242,233,236,236,
- 233, 99,128, 4,225,227,249,242,233,236,236,233, 99,128, 4, 85,
- 232,229,227,249,242,233,236,236,233, 99,128, 4, 95,101,151, 0,
- 101, 80,159, 80,178, 80,212, 81,186, 81,248, 82, 25, 82, 37, 82,
- 60, 82,113, 83,225, 84, 27, 84,129, 84,245, 85,124, 85,199, 85,
- 230, 86, 36, 86, 89, 87, 24, 87,157, 87,177, 87,221, 88, 56, 97,
- 2, 80,165, 80,172,227,245,244,101,128, 0,233,242,244,104,128,
- 38, 65, 98, 3, 80,186, 80,195, 80,205,229,238,231,225,236,105,
- 128, 9,143,239,240,239,237,239,230,111,128, 49, 28,242,229,246,
- 101,128, 1, 21, 99, 5, 80,224, 81, 41, 81, 55, 81, 87, 81,176,
- 97, 2, 80,230, 81, 35,238,228,242, 97, 3, 80,241, 80,248, 81,
- 3,228,229,246, 97,128, 9, 13,231,245,234,225,242,225,244,105,
- 128, 10,141,246,239,247,229,236,243,233,231,110, 2, 81, 17, 81,
- 24,228,229,246, 97,128, 9, 69,231,245,234,225,242,225,244,105,
- 128, 10,197,242,239,110,128, 1, 27,229,228,233,236,236,225,226,
- 242,229,246,101,128, 30, 29,104, 2, 81, 61, 81, 72,225,242,237,
- 229,238,233,225,110,128, 5,101,249,233,247,238,225,242,237,229,
- 238,233,225,110,128, 5,135,233,242, 99, 2, 81, 95, 81,100,236,
- 101,128, 36,212,245,237,230,236,229,120,134, 0,234, 81,121, 81,
- 129, 81,137, 81,148, 81,156, 81,168,225,227,245,244,101,128, 30,
- 191,226,229,236,239,119,128, 30, 25,228,239,244,226,229,236,239,
- 119,128, 30,199,231,242,225,246,101,128, 30,193,232,239,239,235,
- 225,226,239,246,101,128, 30,195,244,233,236,228,101,128, 30,197,
- 249,242,233,236,236,233, 99,128, 4, 84,100, 4, 81,196, 81,206,
- 81,212, 81,222,226,236,231,242,225,246,101,128, 2, 5,229,246,
- 97,128, 9, 15,233,229,242,229,243,233,115,128, 0,235,239,116,
- 130, 1, 23, 81,231, 81,240,225,227,227,229,238,116,128, 1, 23,
- 226,229,236,239,119,128, 30,185,101, 2, 81,254, 82, 9,231,245,
- 242,237,245,235,232,105,128, 10, 15,237,225,244,242,225,231,245,
- 242,237,245,235,232,105,128, 10, 71,230,227,249,242,233,236,236,
- 233, 99,128, 4, 68,103, 2, 82, 43, 82, 50,242,225,246,101,128,
- 0,232,245,234,225,242,225,244,105,128, 10,143,104, 4, 82, 70,
- 82, 81, 82, 92, 82,102,225,242,237,229,238,233,225,110,128, 5,
- 103,226,239,240,239,237,239,230,111,128, 49, 29,233,242,225,231,
- 225,238, 97,128, 48, 72,239,239,235,225,226,239,246,101,128, 30,
- 187,105, 4, 82,123, 82,134, 83,192, 83,207,226,239,240,239,237,
- 239,230,111,128, 49, 31,231,232,116,142, 0, 56, 82,168, 82,177,
- 82,187, 82,217, 82,224, 83, 6, 83, 31, 83, 76, 83,110, 83,122,
- 83,133, 83,166, 83,174, 83,185,225,242,225,226,233, 99,128, 6,
- 104,226,229,238,231,225,236,105,128, 9,238,227,233,242,227,236,
- 101,129, 36,103, 82,198,233,238,246,229,242,243,229,243,225,238,
- 243,243,229,242,233,102,128, 39,145,228,229,246, 97,128, 9,110,
- 229,229,110, 2, 82,232, 82,241,227,233,242,227,236,101,128, 36,
- 113,112, 2, 82,247, 82,254,225,242,229,110,128, 36,133,229,242,
- 233,239,100,128, 36,153,231,117, 2, 83, 13, 83, 22,234,225,242,
- 225,244,105,128, 10,238,242,237,245,235,232,105,128, 10,110,104,
- 2, 83, 37, 83, 63, 97, 2, 83, 43, 83, 54,227,235,225,242,225,
- 226,233, 99,128, 6,104,238,231,250,232,239,117,128, 48, 40,238,
- 239,244,229,226,229,225,237,229,100,128, 38,107,105, 2, 83, 82,
- 83,100,228,229,239,231,242,225,240,232,233,227,240,225,242,229,
- 110,128, 50, 39,238,230,229,242,233,239,114,128, 32,136,237,239,
- 238,239,243,240,225,227,101,128,255, 24,239,236,228,243,244,249,
- 236,101,128,247, 56,112, 2, 83,139, 83,146,225,242,229,110,128,
- 36,123,229,114, 2, 83,153, 83,159,233,239,100,128, 36,143,243,
- 233,225,110,128, 6,248,242,239,237,225,110,128, 33,119,243,245,
- 240,229,242,233,239,114,128, 32,120,244,232,225,105,128, 14, 88,
- 238,246,229,242,244,229,228,226,242,229,246,101,128, 2, 7,239,
- 244,233,230,233,229,228,227,249,242,233,236,236,233, 99,128, 4,
- 101,107, 2, 83,231, 83,255,225,244,225,235,225,238, 97,129, 48,
- 168, 83,243,232,225,236,230,247,233,228,244,104,128,255,116,111,
- 2, 84, 5, 84, 20,238,235,225,242,231,245,242,237,245,235,232,
- 105,128, 10,116,242,229,225,110,128, 49, 84,108, 3, 84, 35, 84,
- 46, 84,107,227,249,242,233,236,236,233, 99,128, 4, 59,101, 2,
- 84, 52, 84, 59,237,229,238,116,128, 34, 8,246,229,110, 3, 84,
- 69, 84, 78, 84, 99,227,233,242,227,236,101,128, 36,106,112, 2,
- 84, 84, 84, 91,225,242,229,110,128, 36,126,229,242,233,239,100,
- 128, 36,146,242,239,237,225,110,128, 33,122,236,233,240,243,233,
- 115,129, 32, 38, 84,118,246,229,242,244,233,227,225,108,128, 34,
- 238,109, 5, 84,141, 84,169, 84,180, 84,200, 84,211,225,227,242,
- 239,110,130, 1, 19, 84,153, 84,161,225,227,245,244,101,128, 30,
- 23,231,242,225,246,101,128, 30, 21,227,249,242,233,236,236,233,
- 99,128, 4, 60,228,225,243,104,129, 32, 20, 84,189,246,229,242,
- 244,233,227,225,108,128,254, 49,239,238,239,243,240,225,227,101,
- 128,255, 69,112, 2, 84,217, 84,237,232,225,243,233,243,237,225,
- 242,235,225,242,237,229,238,233,225,110,128, 5, 91,244,249,243,
- 229,116,128, 34, 5,110, 6, 85, 3, 85, 14, 85, 25, 85, 69, 85,
- 101, 85,116,226,239,240,239,237,239,230,111,128, 49, 35,227,249,
- 242,233,236,236,233, 99,128, 4, 61,100, 2, 85, 31, 85, 50,225,
- 243,104,129, 32, 19, 85, 39,246,229,242,244,233,227,225,108,128,
- 254, 50,229,243,227,229,238,228,229,242,227,249,242,233,236,236,
- 233, 99,128, 4,163,103,130, 1, 75, 85, 77, 85, 88,226,239,240,
- 239,237,239,230,111,128, 49, 37,232,229,227,249,242,233,236,236,
- 233, 99,128, 4,165,232,239,239,235,227,249,242,233,236,236,233,
- 99,128, 4,200,243,240,225,227,101,128, 32, 2,111, 3, 85,132,
- 85,140, 85,149,231,239,238,229,107,128, 1, 25,235,239,242,229,
- 225,110,128, 49, 83,240,229,110,130, 2, 91, 85,159, 85,168,227,
- 236,239,243,229,100,128, 2,154,242,229,246,229,242,243,229,100,
- 130, 2, 92, 85,183, 85,192,227,236,239,243,229,100,128, 2, 94,
- 232,239,239,107,128, 2, 93,112, 2, 85,205, 85,212,225,242,229,
- 110,128, 36,160,243,233,236,239,110,129, 3,181, 85,222,244,239,
- 238,239,115,128, 3,173,241,117, 2, 85,237, 86, 25,225,108,130,
- 0, 61, 85,246, 86, 2,237,239,238,239,243,240,225,227,101,128,
- 255, 29,115, 2, 86, 8, 86, 15,237,225,236,108,128,254,102,245,
- 240,229,242,233,239,114,128, 32,124,233,246,225,236,229,238,227,
- 101,128, 34, 97,114, 3, 86, 44, 86, 55, 86, 66,226,239,240,239,
- 237,239,230,111,128, 49, 38,227,249,242,233,236,236,233, 99,128,
- 4, 64,229,246,229,242,243,229,100,129, 2, 88, 86, 78,227,249,
- 242,233,236,236,233, 99,128, 4, 77,115, 6, 86,103, 86,114, 86,
- 134, 86,215, 87, 4, 87, 14,227,249,242,233,236,236,233, 99,128,
- 4, 65,228,229,243,227,229,238,228,229,242,227,249,242,233,236,
- 236,233, 99,128, 4,171,104,132, 2,131, 86,146, 86,153, 86,184,
- 86,199,227,245,242,108,128, 2,134,239,242,116, 2, 86,161, 86,
- 168,228,229,246, 97,128, 9, 14,246,239,247,229,236,243,233,231,
- 238,228,229,246, 97,128, 9, 70,242,229,246,229,242,243,229,228,
- 236,239,239,112,128, 1,170,243,241,245,225,244,242,229,246,229,
- 242,243,229,100,128, 2,133,237,225,236,108, 2, 86,224, 86,235,
- 232,233,242,225,231,225,238, 97,128, 48, 71,235,225,244,225,235,
- 225,238, 97,129, 48,167, 86,248,232,225,236,230,247,233,228,244,
- 104,128,255,106,244,233,237,225,244,229,100,128, 33, 46,245,240,
- 229,242,233,239,114,128,246,236,116, 5, 87, 36, 87, 62, 87, 66,
- 87, 83, 87,149, 97,130, 3,183, 87, 44, 87, 54,242,237,229,238,
- 233,225,110,128, 5,104,244,239,238,239,115,128, 3,174,104,128,
- 0,240,233,236,228,101,129, 30,189, 87, 75,226,229,236,239,119,
- 128, 30, 27,238,225,232,244, 97, 3, 87, 95, 87,127, 87,136,230,
- 239,245,235,104, 2, 87,105, 87,114,232,229,226,242,229,119,128,
- 5,145,236,229,230,244,232,229,226,242,229,119,128, 5,145,232,
- 229,226,242,229,119,128, 5,145,236,229,230,244,232,229,226,242,
- 229,119,128, 5,145,245,242,238,229,100,128, 1,221,117, 2, 87,
- 163, 87,172,235,239,242,229,225,110,128, 49, 97,242,111,128, 32,
- 172,246,239,247,229,236,243,233,231,110, 3, 87,193, 87,203, 87,
- 210,226,229,238,231,225,236,105,128, 9,199,228,229,246, 97,128,
- 9, 71,231,245,234,225,242,225,244,105,128, 10,199,120, 2, 87,
- 227, 88, 44,227,236,225,109,132, 0, 33, 87,242, 87,253, 88, 24,
- 88, 36,225,242,237,229,238,233,225,110,128, 5, 92,100, 2, 88,
- 3, 88, 8,226,108,128, 32, 60,239,247,110,129, 0,161, 88, 16,
- 243,237,225,236,108,128,247,161,237,239,238,239,243,240,225,227,
- 101,128,255, 1,243,237,225,236,108,128,247, 33,233,243,244,229,
- 238,244,233,225,108,128, 34, 3,250,104,131, 2,146, 88, 67, 88,
- 86, 88, 97, 99, 2, 88, 73, 88, 80,225,242,239,110,128, 1,239,
- 245,242,108,128, 2,147,242,229,246,229,242,243,229,100,128, 1,
- 185,244,225,233,108,128, 1,186,102,140, 0,102, 88,132, 88,214,
- 88,225, 88,234, 88,246, 89, 93, 89,109, 91,117, 91,130, 91,156,
- 93, 33, 93, 41, 97, 4, 88,142, 88,149, 88,160, 88,171,228,229,
- 246, 97,128, 9, 94,231,245,242,237,245,235,232,105,128, 10, 94,
- 232,242,229,238,232,229,233,116,128, 33, 9,244,232, 97, 3, 88,
- 181, 88,190, 88,202,225,242,225,226,233, 99,128, 6, 78,236,239,
- 247,225,242,225,226,233, 99,128, 6, 78,244,225,238,225,242,225,
- 226,233, 99,128, 6, 75,226,239,240,239,237,239,230,111,128, 49,
- 8,227,233,242,227,236,101,128, 36,213,228,239,244,225,227,227,
- 229,238,116,128, 30, 31,101, 3, 88,254, 89, 76, 89, 86,104, 4,
- 89, 8, 89, 31, 89, 45, 89, 61,225,114, 2, 89, 15, 89, 22,225,
- 226,233, 99,128, 6, 65,237,229,238,233,225,110,128, 5,134,230,
- 233,238,225,236,225,242,225,226,233, 99,128,254,210,233,238,233,
- 244,233,225,236,225,242,225,226,233, 99,128,254,211,237,229,228,
- 233,225,236,225,242,225,226,233, 99,128,254,212,233,227,239,240,
- 244,233, 99,128, 3,229,237,225,236,101,128, 38, 64,102,130,251,
- 0, 89,101, 89,105,105,128,251, 3,108,128,251, 4,105,136,251,
- 1, 89,129, 89,169, 89,180, 89,202, 90, 68, 90, 85, 90, 93, 90,
- 106,230,244,229,229,110, 2, 89,139, 89,148,227,233,242,227,236,
- 101,128, 36,110,112, 2, 89,154, 89,161,225,242,229,110,128, 36,
- 130,229,242,233,239,100,128, 36,150,231,245,242,229,228,225,243,
- 104,128, 32, 18,236,236,229,100, 2, 89,189, 89,195,226,239,120,
- 128, 37,160,242,229,227,116,128, 37,172,238,225,108, 5, 89,216,
- 89,255, 90, 16, 90, 33, 90, 49,235,225,102,130, 5,218, 89,226,
- 89,246,228,225,231,229,243,104,129,251, 58, 89,237,232,229,226,
- 242,229,119,128,251, 58,232,229,226,242,229,119,128, 5,218,237,
- 229,109,129, 5,221, 90, 7,232,229,226,242,229,119,128, 5,221,
- 238,245,110,129, 5,223, 90, 24,232,229,226,242,229,119,128, 5,
- 223,240,101,129, 5,227, 90, 40,232,229,226,242,229,119,128, 5,
- 227,244,243,225,228,105,129, 5,229, 90, 59,232,229,226,242,229,
- 119,128, 5,229,242,243,244,244,239,238,229,227,232,233,238,229,
- 243,101,128, 2,201,243,232,229,249,101,128, 37,201,244,225,227,
- 249,242,233,236,236,233, 99,128, 4,115,246,101,142, 0, 53, 90,
- 139, 90,148, 90,158, 90,188, 90,195, 90,205, 90,230, 91, 1, 91,
- 35, 91, 47, 91, 58, 91, 91, 91, 99, 91,110,225,242,225,226,233,
- 99,128, 6,101,226,229,238,231,225,236,105,128, 9,235,227,233,
- 242,227,236,101,129, 36,100, 90,169,233,238,246,229,242,243,229,
- 243,225,238,243,243,229,242,233,102,128, 39,142,228,229,246, 97,
- 128, 9,107,229,233,231,232,244,232,115,128, 33, 93,231,117, 2,
- 90,212, 90,221,234,225,242,225,244,105,128, 10,235,242,237,245,
- 235,232,105,128, 10,107,232, 97, 2, 90,237, 90,248,227,235,225,
- 242,225,226,233, 99,128, 6,101,238,231,250,232,239,117,128, 48,
- 37,105, 2, 91, 7, 91, 25,228,229,239,231,242,225,240,232,233,
- 227,240,225,242,229,110,128, 50, 36,238,230,229,242,233,239,114,
- 128, 32,133,237,239,238,239,243,240,225,227,101,128,255, 21,239,
- 236,228,243,244,249,236,101,128,247, 53,112, 2, 91, 64, 91, 71,
- 225,242,229,110,128, 36,120,229,114, 2, 91, 78, 91, 84,233,239,
- 100,128, 36,140,243,233,225,110,128, 6,245,242,239,237,225,110,
- 128, 33,116,243,245,240,229,242,233,239,114,128, 32,117,244,232,
- 225,105,128, 14, 85,108,129,251, 2, 91,123,239,242,233,110,128,
- 1,146,109, 2, 91,136, 91,147,239,238,239,243,240,225,227,101,
- 128,255, 70,243,241,245,225,242,101,128, 51,153,111, 4, 91,166,
- 91,188, 91,200, 91,207,230, 97, 2, 91,173, 91,181,238,244,232,
- 225,105,128, 14, 31,244,232,225,105,128, 14, 29,238,231,237,225,
- 238,244,232,225,105,128, 14, 79,242,225,236,108,128, 34, 0,245,
- 114,142, 0, 52, 91,240, 91,249, 92, 3, 92, 33, 92, 40, 92, 65,
- 92, 92, 92,126, 92,138, 92,157, 92,168, 92,201, 92,209, 92,220,
- 225,242,225,226,233, 99,128, 6,100,226,229,238,231,225,236,105,
- 128, 9,234,227,233,242,227,236,101,129, 36, 99, 92, 14,233,238,
- 246,229,242,243,229,243,225,238,243,243,229,242,233,102,128, 39,
- 141,228,229,246, 97,128, 9,106,231,117, 2, 92, 47, 92, 56,234,
- 225,242,225,244,105,128, 10,234,242,237,245,235,232,105,128, 10,
- 106,232, 97, 2, 92, 72, 92, 83,227,235,225,242,225,226,233, 99,
- 128, 6,100,238,231,250,232,239,117,128, 48, 36,105, 2, 92, 98,
- 92,116,228,229,239,231,242,225,240,232,233,227,240,225,242,229,
- 110,128, 50, 35,238,230,229,242,233,239,114,128, 32,132,237,239,
- 238,239,243,240,225,227,101,128,255, 20,238,245,237,229,242,225,
- 244,239,242,226,229,238,231,225,236,105,128, 9,247,239,236,228,
- 243,244,249,236,101,128,247, 52,112, 2, 92,174, 92,181,225,242,
- 229,110,128, 36,119,229,114, 2, 92,188, 92,194,233,239,100,128,
- 36,139,243,233,225,110,128, 6,244,242,239,237,225,110,128, 33,
- 115,243,245,240,229,242,233,239,114,128, 32,116,116, 2, 92,226,
- 93, 8,229,229,110, 2, 92,234, 92,243,227,233,242,227,236,101,
- 128, 36,109,112, 2, 92,249, 93, 0,225,242,229,110,128, 36,129,
- 229,242,233,239,100,128, 36,149,104, 2, 93, 14, 93, 19,225,105,
- 128, 14, 84,244,239,238,229,227,232,233,238,229,243,101,128, 2,
- 203,240,225,242,229,110,128, 36,161,242, 97, 2, 93, 48, 93, 56,
- 227,244,233,239,110,128, 32, 68,238, 99,128, 32,163,103,144, 0,
- 103, 93, 97, 94, 43, 94, 66, 94,127, 94,144, 95, 65, 96, 58, 96,
- 143, 96,156, 97, 14, 97, 39, 97, 67, 97, 89, 98, 34, 98, 56, 98,
- 158, 97, 9, 93,117, 93,127, 93,134, 93,141, 93,205, 93,230, 93,
- 241, 93,252, 94, 30,226,229,238,231,225,236,105,128, 9,151,227,
- 245,244,101,128, 1,245,228,229,246, 97,128, 9, 23,102, 4, 93,
- 151, 93,160, 93,174, 93,190,225,242,225,226,233, 99,128, 6,175,
- 230,233,238,225,236,225,242,225,226,233, 99,128,251,147,233,238,
- 233,244,233,225,236,225,242,225,226,233, 99,128,251,148,237,229,
- 228,233,225,236,225,242,225,226,233, 99,128,251,149,231,117, 2,
- 93,212, 93,221,234,225,242,225,244,105,128, 10,151,242,237,245,
- 235,232,105,128, 10, 23,232,233,242,225,231,225,238, 97,128, 48,
- 76,235,225,244,225,235,225,238, 97,128, 48,172,237,237, 97,130,
- 3,179, 94, 6, 94, 19,236,225,244,233,238,243,237,225,236,108,
- 128, 2, 99,243,245,240,229,242,233,239,114,128, 2,224,238,231,
- 233,225,227,239,240,244,233, 99,128, 3,235, 98, 2, 94, 49, 94,
- 59,239,240,239,237,239,230,111,128, 49, 13,242,229,246,101,128,
- 1, 31, 99, 4, 94, 76, 94, 83, 94, 92, 94,114,225,242,239,110,
- 128, 1,231,229,228,233,236,236, 97,128, 1, 35,233,242, 99, 2,
- 94,100, 94,105,236,101,128, 36,214,245,237,230,236,229,120,128,
- 1, 29,239,237,237,225,225,227,227,229,238,116,128, 1, 35,228,
- 239,116,129, 1, 33, 94,135,225,227,227,229,238,116,128, 1, 33,
- 101, 6, 94,158, 94,169, 94,180, 94,191, 94,210, 95, 56,227,249,
- 242,233,236,236,233, 99,128, 4, 51,232,233,242,225,231,225,238,
- 97,128, 48, 82,235,225,244,225,235,225,238, 97,128, 48,178,239,
- 237,229,244,242,233,227,225,236,236,249,229,241,245,225,108,128,
- 34, 81,114, 3, 94,218, 95, 11, 95, 21,229,243,104, 3, 94,228,
- 94,243, 94,252,225,227,227,229,238,244,232,229,226,242,229,119,
- 128, 5,156,232,229,226,242,229,119,128, 5,243,237,245,241,228,
- 225,237,232,229,226,242,229,119,128, 5,157,237,225,238,228,226,
- 236,115,128, 0,223,243,232,225,249,233,109, 2, 95, 32, 95, 47,
- 225,227,227,229,238,244,232,229,226,242,229,119,128, 5,158,232,
- 229,226,242,229,119,128, 5,244,244,225,237,225,242,107,128, 48,
- 19,104, 5, 95, 77, 95,210, 96, 17, 96, 42, 96, 48, 97, 4, 95,
- 87, 95, 97, 95,120, 95,145,226,229,238,231,225,236,105,128, 9,
- 152,100, 2, 95,103, 95,114,225,242,237,229,238,233,225,110,128,
- 5,114,229,246, 97,128, 9, 24,231,117, 2, 95,127, 95,136,234,
- 225,242,225,244,105,128, 10,152,242,237,245,235,232,105,128, 10,
- 24,233,110, 4, 95,156, 95,165, 95,179, 95,195,225,242,225,226,
- 233, 99,128, 6, 58,230,233,238,225,236,225,242,225,226,233, 99,
- 128,254,206,233,238,233,244,233,225,236,225,242,225,226,233, 99,
- 128,254,207,237,229,228,233,225,236,225,242,225,226,233, 99,128,
- 254,208,101, 3, 95,218, 95,239, 96, 0,237,233,228,228,236,229,
- 232,239,239,235,227,249,242,233,236,236,233, 99,128, 4,149,243,
- 244,242,239,235,229,227,249,242,233,236,236,233, 99,128, 4,147,
- 245,240,244,245,242,238,227,249,242,233,236,236,233, 99,128, 4,
- 145,232, 97, 2, 96, 24, 96, 31,228,229,246, 97,128, 9, 90,231,
- 245,242,237,245,235,232,105,128, 10, 90,239,239,107,128, 2, 96,
- 250,243,241,245,225,242,101,128, 51,147,105, 3, 96, 66, 96, 77,
- 96, 88,232,233,242,225,231,225,238, 97,128, 48, 78,235,225,244,
- 225,235,225,238, 97,128, 48,174,109, 2, 96, 94, 96,105,225,242,
- 237,229,238,233,225,110,128, 5, 99,229,108,130, 5,210, 96,114,
- 96,134,228,225,231,229,243,104,129,251, 50, 96,125,232,229,226,
- 242,229,119,128,251, 50,232,229,226,242,229,119,128, 5,210,234,
- 229,227,249,242,233,236,236,233, 99,128, 4, 83,236,239,244,244,
- 225,108, 2, 96,167, 96,184,233,238,246,229,242,244,229,228,243,
- 244,242,239,235,101,128, 1,190,243,244,239,112,132, 2,148, 96,
- 199, 96,210, 96,216, 96,248,233,238,246,229,242,244,229,100,128,
- 2,150,237,239,100,128, 2,192,242,229,246,229,242,243,229,100,
- 130, 2,149, 96,231, 96,237,237,239,100,128, 2,193,243,245,240,
- 229,242,233,239,114,128, 2,228,243,244,242,239,235,101,129, 2,
- 161, 97, 3,242,229,246,229,242,243,229,100,128, 2,162,109, 2,
- 97, 20, 97, 28,225,227,242,239,110,128, 30, 33,239,238,239,243,
- 240,225,227,101,128,255, 71,111, 2, 97, 45, 97, 56,232,233,242,
- 225,231,225,238, 97,128, 48, 84,235,225,244,225,235,225,238, 97,
- 128, 48,180,240, 97, 2, 97, 74, 97, 80,242,229,110,128, 36,162,
- 243,241,245,225,242,101,128, 51,172,114, 2, 97, 95, 97,192, 97,
- 2, 97,101, 97,109,228,233,229,238,116,128, 34, 7,246,101,134,
- 0, 96, 97,126, 97,137, 97,154, 97,161, 97,170, 97,182,226,229,
- 236,239,247,227,237, 98,128, 3, 22, 99, 2, 97,143, 97,148,237,
- 98,128, 3, 0,239,237, 98,128, 3, 0,228,229,246, 97,128, 9,
- 83,236,239,247,237,239,100,128, 2,206,237,239,238,239,243,240,
- 225,227,101,128,255, 64,244,239,238,229,227,237, 98,128, 3, 64,
- 229,225,244,229,114,132, 0, 62, 97,208, 97,227, 97,239, 98, 26,
- 229,241,245,225,108,129, 34,101, 97,218,239,242,236,229,243,115,
- 128, 34,219,237,239,238,239,243,240,225,227,101,128,255, 30,111,
- 2, 97,245, 98, 15,114, 2, 97,251, 98, 8,229,241,245,233,246,
- 225,236,229,238,116,128, 34,115,236,229,243,115,128, 34,119,246,
- 229,242,229,241,245,225,108,128, 34,103,243,237,225,236,108,128,
- 254,101,115, 2, 98, 40, 98, 48,227,242,233,240,116,128, 2, 97,
- 244,242,239,235,101,128, 1,229,117, 4, 98, 66, 98, 77, 98,134,
- 98,145,232,233,242,225,231,225,238, 97,128, 48, 80,233,108, 2,
- 98, 84, 98,109,236,229,237,239,116, 2, 98, 94, 98,101,236,229,
- 230,116,128, 0,171,242,233,231,232,116,128, 0,187,243,233,238,
- 231,108, 2, 98,119, 98,126,236,229,230,116,128, 32, 57,242,233,
- 231,232,116,128, 32, 58,235,225,244,225,235,225,238, 97,128, 48,
- 176,242,225,237,245,243,241,245,225,242,101,128, 51, 24,249,243,
- 241,245,225,242,101,128, 51,201,104,144, 0,104, 98,204,101, 90,
- 101,125,101,162,101,202,103, 90,103,110,104, 75,104, 87,104, 99,
- 105,167,105,175,105,186,105,195,106, 19,106, 23, 97, 13, 98,232,
- 99, 15, 99, 25, 99, 55, 99, 80, 99,158, 99,170, 99,195, 99,210,
- 99,239, 99,252,100, 54,100, 63, 97, 2, 98,238, 99, 1,226,235,
- 232,225,243,233,225,238,227,249,242,233,236,236,233, 99,128, 4,
- 169,236,244,239,238,229,225,242,225,226,233, 99,128, 6,193,226,
- 229,238,231,225,236,105,128, 9,185,228,101, 2, 99, 32, 99, 50,
- 243,227,229,238,228,229,242,227,249,242,233,236,236,233, 99,128,
- 4,179,246, 97,128, 9, 57,231,117, 2, 99, 62, 99, 71,234,225,
- 242,225,244,105,128, 10,185,242,237,245,235,232,105,128, 10, 57,
- 104, 4, 99, 90, 99, 99, 99,113, 99,143,225,242,225,226,233, 99,
- 128, 6, 45,230,233,238,225,236,225,242,225,226,233, 99,128,254,
- 162,105, 2, 99,119, 99,134,238,233,244,233,225,236,225,242,225,
- 226,233, 99,128,254,163,242,225,231,225,238, 97,128, 48,111,237,
- 229,228,233,225,236,225,242,225,226,233, 99,128,254,164,233,244,
- 245,243,241,245,225,242,101,128, 51, 42,235,225,244,225,235,225,
- 238, 97,129, 48,207, 99,183,232,225,236,230,247,233,228,244,104,
- 128,255,138,236,225,238,244,231,245,242,237,245,235,232,105,128,
- 10, 77,237,250, 97, 2, 99,218, 99,227,225,242,225,226,233, 99,
- 128, 6, 33,236,239,247,225,242,225,226,233, 99,128, 6, 33,238,
- 231,245,236,230,233,236,236,229,114,128, 49,100,114, 2,100, 2,
- 100, 18,228,243,233,231,238,227,249,242,233,236,236,233, 99,128,
- 4, 74,240,239,239,110, 2,100, 27,100, 40,236,229,230,244,226,
- 225,242,226,245,112,128, 33,188,242,233,231,232,244,226,225,242,
- 226,245,112,128, 33,192,243,241,245,225,242,101,128, 51,202,244,
- 225,102, 3,100, 73,100,165,101, 0,240,225,244,225,104,134, 5,
- 178,100, 93,100, 98,100,112,100,121,100,136,100,152,177, 54,128,
- 5,178, 50, 2,100,104,100,108, 51,128, 5,178,102,128, 5,178,
- 232,229,226,242,229,119,128, 5,178,238,225,242,242,239,247,232,
- 229,226,242,229,119,128, 5,178,241,245,225,242,244,229,242,232,
- 229,226,242,229,119,128, 5,178,247,233,228,229,232,229,226,242,
- 229,119,128, 5,178,241,225,237,225,244,115,135, 5,179,100,188,
- 100,193,100,198,100,203,100,212,100,227,100,243,177, 98,128, 5,
- 179,178, 56,128, 5,179,179, 52,128, 5,179,232,229,226,242,229,
- 119,128, 5,179,238,225,242,242,239,247,232,229,226,242,229,119,
- 128, 5,179,241,245,225,242,244,229,242,232,229,226,242,229,119,
- 128, 5,179,247,233,228,229,232,229,226,242,229,119,128, 5,179,
- 243,229,231,239,108,135, 5,177,101, 22,101, 27,101, 32,101, 37,
- 101, 46,101, 61,101, 77,177, 55,128, 5,177,178, 52,128, 5,177,
- 179, 48,128, 5,177,232,229,226,242,229,119,128, 5,177,238,225,
- 242,242,239,247,232,229,226,242,229,119,128, 5,177,241,245,225,
- 242,244,229,242,232,229,226,242,229,119,128, 5,177,247,233,228,
- 229,232,229,226,242,229,119,128, 5,177, 98, 3,101, 98,101,103,
- 101,113,225,114,128, 1, 39,239,240,239,237,239,230,111,128, 49,
- 15,242,229,246,229,226,229,236,239,119,128, 30, 43, 99, 2,101,
- 131,101,140,229,228,233,236,236, 97,128, 30, 41,233,242, 99, 2,
- 101,148,101,153,236,101,128, 36,215,245,237,230,236,229,120,128,
- 1, 37,100, 2,101,168,101,178,233,229,242,229,243,233,115,128,
- 30, 39,239,116, 2,101,185,101,194,225,227,227,229,238,116,128,
- 30, 35,226,229,236,239,119,128, 30, 37,101,136, 5,212,101,222,
- 101,255,102, 19,102,248,103, 8,103, 53,103, 62,103, 75,225,242,
- 116,129, 38,101,101,230,243,245,233,116, 2,101,239,101,247,226,
- 236,225,227,107,128, 38,101,247,232,233,244,101,128, 38, 97,228,
- 225,231,229,243,104,129,251, 52,102, 10,232,229,226,242,229,119,
- 128,251, 52,104, 6,102, 33,102, 61,102, 69,102,119,102,165,102,
- 214, 97, 2,102, 39,102, 53,236,244,239,238,229,225,242,225,226,
- 233, 99,128, 6,193,242,225,226,233, 99,128, 6, 71,229,226,242,
- 229,119,128, 5,212,230,233,238,225,236, 97, 2,102, 80,102,111,
- 236,116, 2,102, 87,102, 99,239,238,229,225,242,225,226,233, 99,
- 128,251,167,244,247,239,225,242,225,226,233, 99,128,254,234,242,
- 225,226,233, 99,128,254,234,232,225,237,250,225,225,226,239,246,
- 101, 2,102,134,102,148,230,233,238,225,236,225,242,225,226,233,
- 99,128,251,165,233,243,239,236,225,244,229,228,225,242,225,226,
- 233, 99,128,251,164,105, 2,102,171,102,205,238,233,244,233,225,
- 236, 97, 2,102,183,102,197,236,244,239,238,229,225,242,225,226,
- 233, 99,128,251,168,242,225,226,233, 99,128,254,235,242,225,231,
- 225,238, 97,128, 48,120,237,229,228,233,225,236, 97, 2,102,226,
- 102,240,236,244,239,238,229,225,242,225,226,233, 99,128,251,169,
- 242,225,226,233, 99,128,254,236,233,243,229,233,229,242,225,243,
- 241,245,225,242,101,128, 51,123,107, 2,103, 14,103, 38,225,244,
- 225,235,225,238, 97,129, 48,216,103, 26,232,225,236,230,247,233,
- 228,244,104,128,255,141,245,244,225,225,242,245,243,241,245,225,
- 242,101,128, 51, 54,238,231,232,239,239,107,128, 2,103,242,245,
- 244,245,243,241,245,225,242,101,128, 51, 57,116,129, 5,215,103,
- 81,232,229,226,242,229,119,128, 5,215,232,239,239,107,129, 2,
- 102,103, 99,243,245,240,229,242,233,239,114,128, 2,177,105, 4,
- 103,120,103,205,103,216,103,241,229,245,104, 4,103,132,103,167,
- 103,182,103,191, 97, 2,103,138,103,153,227,233,242,227,236,229,
- 235,239,242,229,225,110,128, 50,123,240,225,242,229,238,235,239,
- 242,229,225,110,128, 50, 27,227,233,242,227,236,229,235,239,242,
- 229,225,110,128, 50,109,235,239,242,229,225,110,128, 49, 78,240,
- 225,242,229,238,235,239,242,229,225,110,128, 50, 13,232,233,242,
- 225,231,225,238, 97,128, 48,114,235,225,244,225,235,225,238, 97,
- 129, 48,210,103,229,232,225,236,230,247,233,228,244,104,128,255,
- 139,242,233,113,134, 5,180,104, 3,104, 8,104, 22,104, 31,104,
- 46,104, 62,177, 52,128, 5,180, 50, 2,104, 14,104, 18, 49,128,
- 5,180,100,128, 5,180,232,229,226,242,229,119,128, 5,180,238,
- 225,242,242,239,247,232,229,226,242,229,119,128, 5,180,241,245,
- 225,242,244,229,242,232,229,226,242,229,119,128, 5,180,247,233,
- 228,229,232,229,226,242,229,119,128, 5,180,236,233,238,229,226,
- 229,236,239,119,128, 30,150,237,239,238,239,243,240,225,227,101,
- 128,255, 72,111, 9,104,119,104,130,104,154,104,179,105, 11,105,
- 24,105,110,105,150,105,161,225,242,237,229,238,233,225,110,128,
- 5,112,232,105, 2,104,137,104,145,240,244,232,225,105,128, 14,
- 43,242,225,231,225,238, 97,128, 48,123,235,225,244,225,235,225,
- 238, 97,129, 48,219,104,167,232,225,236,230,247,233,228,244,104,
- 128,255,142,236,225,109,135, 5,185,104,199,104,204,104,209,104,
- 214,104,223,104,238,104,254,177, 57,128, 5,185,178, 54,128, 5,
- 185,179, 50,128, 5,185,232,229,226,242,229,119,128, 5,185,238,
- 225,242,242,239,247,232,229,226,242,229,119,128, 5,185,241,245,
- 225,242,244,229,242,232,229,226,242,229,119,128, 5,185,247,233,
- 228,229,232,229,226,242,229,119,128, 5,185,238,239,235,232,245,
- 235,244,232,225,105,128, 14, 46,111, 2,105, 30,105,100,107, 4,
- 105, 40,105, 52,105, 58,105, 80,225,226,239,246,229,227,239,237,
- 98,128, 3, 9,227,237, 98,128, 3, 9,240,225,236,225,244,225,
- 236,233,250,229,228,226,229,236,239,247,227,237, 98,128, 3, 33,
- 242,229,244,242,239,230,236,229,248,226,229,236,239,247,227,237,
- 98,128, 3, 34,238,243,241,245,225,242,101,128, 51, 66,114, 2,
- 105,116,105,143,105, 2,105,122,105,131,227,239,240,244,233, 99,
- 128, 3,233,250,239,238,244,225,236,226,225,114,128, 32, 21,238,
- 227,237, 98,128, 3, 27,244,243,240,242,233,238,231,115,128, 38,
- 104,245,243,101,128, 35, 2,240,225,242,229,110,128, 36,163,243,
- 245,240,229,242,233,239,114,128, 2,176,244,245,242,238,229,100,
- 128, 2,101,117, 4,105,205,105,216,105,229,105,254,232,233,242,
- 225,231,225,238, 97,128, 48,117,233,233,244,239,243,241,245,225,
- 242,101,128, 51, 51,235,225,244,225,235,225,238, 97,129, 48,213,
- 105,242,232,225,236,230,247,233,228,244,104,128,255,140,238,231,
- 225,242,245,237,236,225,245,116,129, 2,221,106, 13,227,237, 98,
- 128, 3, 11,118,128, 1,149,249,240,232,229,110,132, 0, 45,106,
- 39,106, 50,106, 62,106, 85,233,238,230,229,242,233,239,114,128,
- 246,229,237,239,238,239,243,240,225,227,101,128,255, 13,115, 2,
- 106, 68,106, 75,237,225,236,108,128,254, 99,245,240,229,242,233,
- 239,114,128,246,230,244,247,111,128, 32, 16,105,149, 0,105,106,
- 137,106,160,106,194,106,241,110,123,110,243,111, 24,111, 51,111,
- 213,111,217,111,255,112, 21,112,105,113, 14,113, 89,113, 97,113,
- 110,113,197,113,254,114, 26,114, 70,225, 99, 2,106,144,106,150,
- 245,244,101,128, 0,237,249,242,233,236,236,233, 99,128, 4, 79,
- 98, 3,106,168,106,177,106,187,229,238,231,225,236,105,128, 9,
- 135,239,240,239,237,239,230,111,128, 49, 39,242,229,246,101,128,
- 1, 45, 99, 3,106,202,106,209,106,231,225,242,239,110,128, 1,
- 208,233,242, 99, 2,106,217,106,222,236,101,128, 36,216,245,237,
- 230,236,229,120,128, 0,238,249,242,233,236,236,233, 99,128, 4,
- 86,100, 4,106,251,107, 5,110, 80,110,113,226,236,231,242,225,
- 246,101,128, 2, 9,101, 2,107, 11,110, 75,239,231,242,225,240,
- 104, 7,107, 32,107, 46,107, 59,109,244,110, 19,110, 32,110, 44,
- 229,225,242,244,232,227,233,242,227,236,101,128, 50,143,230,233,
- 242,229,227,233,242,227,236,101,128, 50,139,233, 99, 14,107, 90,
- 107,106,107,205,108, 3,108, 69,108, 98,108,114,108,171,108,220,
- 108,232,109, 3,109, 70,109,208,109,237,225,236,236,233,225,238,
- 227,229,240,225,242,229,110,128, 50, 63, 99, 4,107,116,107,127,
- 107,141,107,148,225,236,236,240,225,242,229,110,128, 50, 58,229,
- 238,244,242,229,227,233,242,227,236,101,128, 50,165,236,239,243,
- 101,128, 48, 6,111, 3,107,156,107,171,107,191,237,237, 97,129,
- 48, 1,107,164,236,229,230,116,128,255,100,238,231,242,225,244,
- 245,236,225,244,233,239,238,240,225,242,229,110,128, 50, 55,242,
- 242,229,227,244,227,233,242,227,236,101,128, 50,163,101, 3,107,
- 213,107,225,107,242,225,242,244,232,240,225,242,229,110,128, 50,
- 47,238,244,229,242,240,242,233,243,229,240,225,242,229,110,128,
- 50, 61,248,227,229,236,236,229,238,244,227,233,242,227,236,101,
- 128, 50,157,102, 2,108, 9,108, 24,229,243,244,233,246,225,236,
- 240,225,242,229,110,128, 50, 64,105, 2,108, 30,108, 59,238,225,
- 238,227,233,225,108, 2,108, 42,108, 51,227,233,242,227,236,101,
- 128, 50,150,240,225,242,229,110,128, 50, 54,242,229,240,225,242,
- 229,110,128, 50, 43,104, 2,108, 75,108, 86,225,246,229,240,225,
- 242,229,110,128, 50, 50,233,231,232,227,233,242,227,236,101,128,
- 50,164,233,244,229,242,225,244,233,239,238,237,225,242,107,128,
- 48, 5,108, 3,108,122,108,148,108,160,225,226,239,114, 2,108,
- 131,108,140,227,233,242,227,236,101,128, 50,152,240,225,242,229,
- 110,128, 50, 56,229,230,244,227,233,242,227,236,101,128, 50,167,
- 239,247,227,233,242,227,236,101,128, 50,166,109, 2,108,177,108,
- 209,101, 2,108,183,108,198,228,233,227,233,238,229,227,233,242,
- 227,236,101,128, 50,169,244,225,236,240,225,242,229,110,128, 50,
- 46,239,239,238,240,225,242,229,110,128, 50, 42,238,225,237,229,
- 240,225,242,229,110,128, 50, 52,112, 2,108,238,108,246,229,242,
- 233,239,100,128, 48, 2,242,233,238,244,227,233,242,227,236,101,
- 128, 50,158,114, 2,109, 9,109, 57,101, 3,109, 17,109, 28,109,
- 43,225,227,232,240,225,242,229,110,128, 50, 67,240,242,229,243,
- 229,238,244,240,225,242,229,110,128, 50, 57,243,239,245,242,227,
- 229,240,225,242,229,110,128, 50, 62,233,231,232,244,227,233,242,
- 227,236,101,128, 50,168,115, 5,109, 82,109,111,109,125,109,150,
- 109,178,101, 2,109, 88,109,101,227,242,229,244,227,233,242,227,
- 236,101,128, 50,153,236,230,240,225,242,229,110,128, 50, 66,239,
- 227,233,229,244,249,240,225,242,229,110,128, 50, 51,112, 2,109,
- 131,109,137,225,227,101,128, 48, 0,229,227,233,225,236,240,225,
- 242,229,110,128, 50, 53,116, 2,109,156,109,167,239,227,235,240,
- 225,242,229,110,128, 50, 49,245,228,249,240,225,242,229,110,128,
- 50, 59,117, 2,109,184,109,193,238,240,225,242,229,110,128, 50,
- 48,240,229,242,246,233,243,229,240,225,242,229,110,128, 50, 60,
- 119, 2,109,214,109,226,225,244,229,242,240,225,242,229,110,128,
- 50, 44,239,239,228,240,225,242,229,110,128, 50, 45,250,229,242,
- 111,128, 48, 7,109, 2,109,250,110, 7,229,244,225,236,227,233,
- 242,227,236,101,128, 50,142,239,239,238,227,233,242,227,236,101,
- 128, 50,138,238,225,237,229,227,233,242,227,236,101,128, 50,148,
- 243,245,238,227,233,242,227,236,101,128, 50,144,119, 2,110, 50,
- 110, 63,225,244,229,242,227,233,242,227,236,101,128, 50,140,239,
- 239,228,227,233,242,227,236,101,128, 50,141,246, 97,128, 9, 7,
- 233,229,242,229,243,233,115,130, 0,239,110, 94,110,102,225,227,
- 245,244,101,128, 30, 47,227,249,242,233,236,236,233, 99,128, 4,
- 229,239,244,226,229,236,239,119,128, 30,203,101, 3,110,131,110,
- 147,110,158,226,242,229,246,229,227,249,242,233,236,236,233, 99,
- 128, 4,215,227,249,242,233,236,236,233, 99,128, 4, 53,245,238,
- 103, 4,110,170,110,205,110,220,110,229, 97, 2,110,176,110,191,
- 227,233,242,227,236,229,235,239,242,229,225,110,128, 50,117,240,
- 225,242,229,238,235,239,242,229,225,110,128, 50, 21,227,233,242,
- 227,236,229,235,239,242,229,225,110,128, 50,103,235,239,242,229,
- 225,110,128, 49, 71,240,225,242,229,238,235,239,242,229,225,110,
- 128, 50, 7,103, 2,110,249,111, 0,242,225,246,101,128, 0,236,
- 117, 2,111, 6,111, 15,234,225,242,225,244,105,128, 10,135,242,
- 237,245,235,232,105,128, 10, 7,104, 2,111, 30,111, 40,233,242,
- 225,231,225,238, 97,128, 48, 68,239,239,235,225,226,239,246,101,
- 128, 30,201,105, 8,111, 69,111, 79,111, 90,111, 97,111,122,111,
- 138,111,153,111,169,226,229,238,231,225,236,105,128, 9,136,227,
- 249,242,233,236,236,233, 99,128, 4, 56,228,229,246, 97,128, 9,
- 8,231,117, 2,111,104,111,113,234,225,242,225,244,105,128, 10,
- 136,242,237,245,235,232,105,128, 10, 8,237,225,244,242,225,231,
- 245,242,237,245,235,232,105,128, 10, 64,238,246,229,242,244,229,
- 228,226,242,229,246,101,128, 2, 11,243,232,239,242,244,227,249,
- 242,233,236,236,233, 99,128, 4, 57,246,239,247,229,236,243,233,
- 231,110, 3,111,185,111,195,111,202,226,229,238,231,225,236,105,
- 128, 9,192,228,229,246, 97,128, 9, 64,231,245,234,225,242,225,
- 244,105,128, 10,192,106,128, 1, 51,107, 2,111,223,111,247,225,
- 244,225,235,225,238, 97,129, 48,164,111,235,232,225,236,230,247,
- 233,228,244,104,128,255,114,239,242,229,225,110,128, 49, 99,108,
- 2,112, 5,112, 10,228,101,128, 2,220,245,249,232,229,226,242,
- 229,119,128, 5,172,109, 2,112, 27,112, 94, 97, 3,112, 35,112,
- 55,112, 80,227,242,239,110,129, 1, 43,112, 44,227,249,242,233,
- 236,236,233, 99,128, 4,227,231,229,239,242,225,240,240,242,239,
- 248,233,237,225,244,229,236,249,229,241,245,225,108,128, 34, 83,
- 244,242,225,231,245,242,237,245,235,232,105,128, 10, 63,239,238,
- 239,243,240,225,227,101,128,255, 73,110, 5,112,117,112,127,112,
- 136,112,148,112,232,227,242,229,237,229,238,116,128, 34, 6,230,
- 233,238,233,244,121,128, 34, 30,233,225,242,237,229,238,233,225,
- 110,128, 5,107,116, 2,112,154,112,222,101, 2,112,160,112,211,
- 231,242,225,108,131, 34, 43,112,173,112,191,112,196, 98, 2,112,
- 179,112,187,239,244,244,239,109,128, 35, 33,116,128, 35, 33,229,
- 120,128,248,245,116, 2,112,202,112,207,239,112,128, 35, 32,112,
- 128, 35, 32,242,243,229,227,244,233,239,110,128, 34, 41,233,243,
- 241,245,225,242,101,128, 51, 5,118, 3,112,240,112,249,113, 2,
- 226,245,236,236,229,116,128, 37,216,227,233,242,227,236,101,128,
- 37,217,243,237,233,236,229,230,225,227,101,128, 38, 59,111, 3,
- 113, 22,113, 33,113, 41,227,249,242,233,236,236,233, 99,128, 4,
- 81,231,239,238,229,107,128, 1, 47,244, 97,131, 3,185,113, 52,
- 113, 73,113, 81,228,233,229,242,229,243,233,115,129, 3,202,113,
- 65,244,239,238,239,115,128, 3,144,236,225,244,233,110,128, 2,
- 105,244,239,238,239,115,128, 3,175,240,225,242,229,110,128, 36,
- 164,242,233,231,245,242,237,245,235,232,105,128, 10,114,115, 4,
- 113,120,113,165,113,179,113,187,237,225,236,108, 2,113,129,113,
- 140,232,233,242,225,231,225,238, 97,128, 48, 67,235,225,244,225,
- 235,225,238, 97,129, 48,163,113,153,232,225,236,230,247,233,228,
- 244,104,128,255,104,243,232,225,242,226,229,238,231,225,236,105,
- 128, 9,250,244,242,239,235,101,128, 2,104,245,240,229,242,233,
- 239,114,128,246,237,116, 2,113,203,113,237,229,242,225,244,233,
- 239,110, 2,113,215,113,226,232,233,242,225,231,225,238, 97,128,
- 48,157,235,225,244,225,235,225,238, 97,128, 48,253,233,236,228,
- 101,129, 1, 41,113,246,226,229,236,239,119,128, 30, 45,117, 2,
- 114, 4,114, 15,226,239,240,239,237,239,230,111,128, 49, 41,227,
- 249,242,233,236,236,233, 99,128, 4, 78,246,239,247,229,236,243,
- 233,231,110, 3,114, 42,114, 52,114, 59,226,229,238,231,225,236,
- 105,128, 9,191,228,229,246, 97,128, 9, 63,231,245,234,225,242,
- 225,244,105,128, 10,191,250,232,233,244,243, 97, 2,114, 81,114,
- 92,227,249,242,233,236,236,233, 99,128, 4,117,228,226,236,231,
- 242,225,246,229,227,249,242,233,236,236,233, 99,128, 4,119,106,
- 138, 0,106,114,135,114,198,114,209,115, 3,115, 19,115,132,115,
- 201,115,206,115,218,115,226, 97, 4,114,145,114,156,114,166,114,
- 173,225,242,237,229,238,233,225,110,128, 5,113,226,229,238,231,
- 225,236,105,128, 9,156,228,229,246, 97,128, 9, 28,231,117, 2,
- 114,180,114,189,234,225,242,225,244,105,128, 10,156,242,237,245,
- 235,232,105,128, 10, 28,226,239,240,239,237,239,230,111,128, 49,
- 16, 99, 3,114,217,114,224,114,246,225,242,239,110,128, 1,240,
- 233,242, 99, 2,114,232,114,237,236,101,128, 36,217,245,237,230,
- 236,229,120,128, 1, 53,242,239,243,243,229,228,244,225,233,108,
- 128, 2,157,228,239,244,236,229,243,243,243,244,242,239,235,101,
- 128, 2, 95,101, 3,115, 27,115, 38,115,103,227,249,242,233,236,
- 236,233, 99,128, 4, 88,229,109, 4,115, 49,115, 58,115, 72,115,
- 88,225,242,225,226,233, 99,128, 6, 44,230,233,238,225,236,225,
- 242,225,226,233, 99,128,254,158,233,238,233,244,233,225,236,225,
- 242,225,226,233, 99,128,254,159,237,229,228,233,225,236,225,242,
- 225,226,233, 99,128,254,160,104, 2,115,109,115,118,225,242,225,
- 226,233, 99,128, 6,152,230,233,238,225,236,225,242,225,226,233,
- 99,128,251,139,104, 2,115,138,115,188, 97, 3,115,146,115,156,
- 115,163,226,229,238,231,225,236,105,128, 9,157,228,229,246, 97,
- 128, 9, 29,231,117, 2,115,170,115,179,234,225,242,225,244,105,
- 128, 10,157,242,237,245,235,232,105,128, 10, 29,229,232,225,242,
- 237,229,238,233,225,110,128, 5,123,233,115,128, 48, 4,237,239,
- 238,239,243,240,225,227,101,128,255, 74,240,225,242,229,110,128,
- 36,165,243,245,240,229,242,233,239,114,128, 2,178,107,146, 0,
- 107,116, 21,118,110,118,121,118,183,118,194,119, 28,119, 42,120,
- 150,121, 90,121,103,121,129,121,178,122, 60,122, 82,122, 95,122,
- 118,122,160,122,170, 97, 12,116, 47,116, 79,116,101,116,131,116,
- 245,117, 14,117, 44,117, 69,117,175,117,189,118, 56,118, 85, 98,
- 2,116, 53,116, 70,225,243,232,235,233,242,227,249,242,233,236,
- 236,233, 99,128, 4,161,229,238,231,225,236,105,128, 9,149, 99,
- 2,116, 85,116, 91,245,244,101,128, 30, 49,249,242,233,236,236,
- 233, 99,128, 4, 58,228,101, 2,116,108,116,126,243,227,229,238,
- 228,229,242,227,249,242,233,236,236,233, 99,128, 4,155,246, 97,
- 128, 9, 21,102,135, 5,219,116,149,116,158,116,178,116,192,116,
- 201,116,217,116,232,225,242,225,226,233, 99,128, 6, 67,228,225,
- 231,229,243,104,129,251, 59,116,169,232,229,226,242,229,119,128,
- 251, 59,230,233,238,225,236,225,242,225,226,233, 99,128,254,218,
- 232,229,226,242,229,119,128, 5,219,233,238,233,244,233,225,236,
- 225,242,225,226,233, 99,128,254,219,237,229,228,233,225,236,225,
- 242,225,226,233, 99,128,254,220,242,225,230,229,232,229,226,242,
- 229,119,128,251, 77,231,117, 2,116,252,117, 5,234,225,242,225,
- 244,105,128, 10,149,242,237,245,235,232,105,128, 10, 21,104, 2,
- 117, 20,117, 30,233,242,225,231,225,238, 97,128, 48, 75,239,239,
- 235,227,249,242,233,236,236,233, 99,128, 4,196,235,225,244,225,
- 235,225,238, 97,129, 48,171,117, 57,232,225,236,230,247,233,228,
- 244,104,128,255,118,112, 2,117, 75,117, 96,240, 97,129, 3,186,
- 117, 82,243,249,237,226,239,236,231,242,229,229,107,128, 3,240,
- 249,229,239,245,110, 3,117,108,117,122,117,156,237,233,229,245,
- 237,235,239,242,229,225,110,128, 49,113,112, 2,117,128,117,143,
- 232,233,229,245,240,232,235,239,242,229,225,110,128, 49,132,233,
- 229,245,240,235,239,242,229,225,110,128, 49,120,243,243,225,238,
- 231,240,233,229,245,240,235,239,242,229,225,110,128, 49,121,242,
- 239,242,233,233,243,241,245,225,242,101,128, 51, 13,115, 5,117,
- 201,117,245,118, 4,118, 12,118, 40,232,233,228,225,225,245,244,
- 111, 2,117,214,117,223,225,242,225,226,233, 99,128, 6, 64,238,
- 239,243,233,228,229,226,229,225,242,233,238,231,225,242,225,226,
- 233, 99,128, 6, 64,237,225,236,236,235,225,244,225,235,225,238,
- 97,128, 48,245,241,245,225,242,101,128, 51,132,242, 97, 2,118,
- 19,118, 28,225,242,225,226,233, 99,128, 6, 80,244,225,238,225,
- 242,225,226,233, 99,128, 6, 77,244,242,239,235,229,227,249,242,
- 233,236,236,233, 99,128, 4,159,244,225,232,233,242,225,240,242,
- 239,236,239,238,231,237,225,242,235,232,225,236,230,247,233,228,
- 244,104,128,255,112,246,229,242,244,233,227,225,236,243,244,242,
- 239,235,229,227,249,242,233,236,236,233, 99,128, 4,157,226,239,
- 240,239,237,239,230,111,128, 49, 14, 99, 4,118,131,118,153,118,
- 162,118,170, 97, 2,118,137,118,147,236,243,241,245,225,242,101,
- 128, 51,137,242,239,110,128, 1,233,229,228,233,236,236, 97,128,
- 1, 55,233,242,227,236,101,128, 36,218,239,237,237,225,225,227,
- 227,229,238,116,128, 1, 55,228,239,244,226,229,236,239,119,128,
- 30, 51,101, 4,118,204,118,231,119, 0,119, 12,104, 2,118,210,
- 118,221,225,242,237,229,238,233,225,110,128, 5,132,233,242,225,
- 231,225,238, 97,128, 48, 81,235,225,244,225,235,225,238, 97,129,
- 48,177,118,244,232,225,236,230,247,233,228,244,104,128,255,121,
- 238,225,242,237,229,238,233,225,110,128, 5,111,243,237,225,236,
- 236,235,225,244,225,235,225,238, 97,128, 48,246,231,242,229,229,
- 238,236,225,238,228,233, 99,128, 1, 56,104, 6,119, 56,119,185,
- 119,196,119,221,120, 52,120,140, 97, 5,119, 68,119, 78,119, 89,
- 119, 96,119,121,226,229,238,231,225,236,105,128, 9,150,227,249,
- 242,233,236,236,233, 99,128, 4, 69,228,229,246, 97,128, 9, 22,
- 231,117, 2,119,103,119,112,234,225,242,225,244,105,128, 10,150,
- 242,237,245,235,232,105,128, 10, 22,104, 4,119,131,119,140,119,
- 154,119,170,225,242,225,226,233, 99,128, 6, 46,230,233,238,225,
- 236,225,242,225,226,233, 99,128,254,166,233,238,233,244,233,225,
- 236,225,242,225,226,233, 99,128,254,167,237,229,228,233,225,236,
- 225,242,225,226,233, 99,128,254,168,229,233,227,239,240,244,233,
- 99,128, 3,231,232, 97, 2,119,203,119,210,228,229,246, 97,128,
- 9, 89,231,245,242,237,245,235,232,105,128, 10, 89,233,229,245,
- 235,104, 4,119,235,120, 14,120, 29,120, 38, 97, 2,119,241,120,
- 0,227,233,242,227,236,229,235,239,242,229,225,110,128, 50,120,
- 240,225,242,229,238,235,239,242,229,225,110,128, 50, 24,227,233,
- 242,227,236,229,235,239,242,229,225,110,128, 50,106,235,239,242,
- 229,225,110,128, 49, 75,240,225,242,229,238,235,239,242,229,225,
- 110,128, 50, 10,111, 4,120, 62,120,111,120,121,120,126,235,104,
- 4,120, 73,120, 82,120, 91,120,101,225,233,244,232,225,105,128,
- 14, 2,239,238,244,232,225,105,128, 14, 5,245,225,244,244,232,
- 225,105,128, 14, 3,247,225,233,244,232,225,105,128, 14, 4,237,
- 245,244,244,232,225,105,128, 14, 91,239,107,128, 1,153,242,225,
- 235,232,225,238,231,244,232,225,105,128, 14, 6,250,243,241,245,
- 225,242,101,128, 51,145,105, 4,120,160,120,171,120,196,120,245,
- 232,233,242,225,231,225,238, 97,128, 48, 77,235,225,244,225,235,
- 225,238, 97,129, 48,173,120,184,232,225,236,230,247,233,228,244,
- 104,128,255,119,242,111, 3,120,205,120,220,120,236,231,245,242,
- 225,237,245,243,241,245,225,242,101,128, 51, 21,237,229,229,244,
- 239,242,245,243,241,245,225,242,101,128, 51, 22,243,241,245,225,
- 242,101,128, 51, 20,249,229,239,107, 5,121, 4,121, 39,121, 54,
- 121, 63,121, 77, 97, 2,121, 10,121, 25,227,233,242,227,236,229,
- 235,239,242,229,225,110,128, 50,110,240,225,242,229,238,235,239,
- 242,229,225,110,128, 50, 14,227,233,242,227,236,229,235,239,242,
- 229,225,110,128, 50, 96,235,239,242,229,225,110,128, 49, 49,240,
- 225,242,229,238,235,239,242,229,225,110,128, 50, 0,243,233,239,
- 243,235,239,242,229,225,110,128, 49, 51,234,229,227,249,242,233,
- 236,236,233, 99,128, 4, 92,108, 2,121,109,121,120,233,238,229,
- 226,229,236,239,119,128, 30, 53,243,241,245,225,242,101,128, 51,
- 152,109, 3,121,137,121,151,121,162,227,245,226,229,228,243,241,
- 245,225,242,101,128, 51,166,239,238,239,243,240,225,227,101,128,
- 255, 75,243,241,245,225,242,229,228,243,241,245,225,242,101,128,
- 51,162,111, 5,121,190,121,216,121,254,122, 10,122, 24,104, 2,
- 121,196,121,206,233,242,225,231,225,238, 97,128, 48, 83,237,243,
- 241,245,225,242,101,128, 51,192,235, 97, 2,121,223,121,231,233,
- 244,232,225,105,128, 14, 1,244,225,235,225,238, 97,129, 48,179,
- 121,242,232,225,236,230,247,233,228,244,104,128,255,122,239,240,
- 239,243,241,245,225,242,101,128, 51, 30,240,240,225,227,249,242,
- 233,236,236,233, 99,128, 4,129,114, 2,122, 30,122, 50,229,225,
- 238,243,244,225,238,228,225,242,228,243,249,237,226,239,108,128,
- 50,127,239,238,233,243,227,237, 98,128, 3, 67,240, 97, 2,122,
- 67,122, 73,242,229,110,128, 36,166,243,241,245,225,242,101,128,
- 51,170,243,233,227,249,242,233,236,236,233, 99,128, 4,111,116,
- 2,122,101,122,110,243,241,245,225,242,101,128, 51,207,245,242,
- 238,229,100,128, 2,158,117, 2,122,124,122,135,232,233,242,225,
- 231,225,238, 97,128, 48, 79,235,225,244,225,235,225,238, 97,129,
- 48,175,122,148,232,225,236,230,247,233,228,244,104,128,255,120,
- 246,243,241,245,225,242,101,128, 51,184,247,243,241,245,225,242,
- 101,128, 51,190,108,146, 0,108,122,220,124,247,125, 20,125, 86,
- 125,124,126, 20,126, 29,126, 45,126, 69,126, 87,126,205,126,246,
- 127,125,127,133,127,166,127,175,127,183,127,245, 97, 7,122,236,
- 122,246,122,253,123, 4,123, 29,123, 45,124,235,226,229,238,231,
- 225,236,105,128, 9,178,227,245,244,101,128, 1, 58,228,229,246,
- 97,128, 9, 50,231,117, 2,123, 11,123, 20,234,225,242,225,244,
- 105,128, 10,178,242,237,245,235,232,105,128, 10, 50,235,235,232,
- 225,238,231,249,225,239,244,232,225,105,128, 14, 69,109, 10,123,
- 67,124, 6,124, 23,124, 61,124, 75,124, 94,124,110,124,130,124,
- 150,124,173, 97, 2,123, 73,123,254,236,229,102, 4,123, 85,123,
- 99,123,191,123,208,230,233,238,225,236,225,242,225,226,233, 99,
- 128,254,252,232,225,237,250, 97, 2,123,109,123,150,225,226,239,
- 246,101, 2,123,119,123,133,230,233,238,225,236,225,242,225,226,
- 233, 99,128,254,248,233,243,239,236,225,244,229,228,225,242,225,
- 226,233, 99,128,254,247,226,229,236,239,119, 2,123,160,123,174,
- 230,233,238,225,236,225,242,225,226,233, 99,128,254,250,233,243,
- 239,236,225,244,229,228,225,242,225,226,233, 99,128,254,249,233,
- 243,239,236,225,244,229,228,225,242,225,226,233, 99,128,254,251,
- 237,225,228,228,225,225,226,239,246,101, 2,123,223,123,237,230,
- 233,238,225,236,225,242,225,226,233, 99,128,254,246,233,243,239,
- 236,225,244,229,228,225,242,225,226,233, 99,128,254,245,242,225,
- 226,233, 99,128, 6, 68,226,228, 97,129, 3,187,124, 14,243,244,
- 242,239,235,101,128, 1,155,229,100,130, 5,220,124, 32,124, 52,
- 228,225,231,229,243,104,129,251, 60,124, 43,232,229,226,242,229,
- 119,128,251, 60,232,229,226,242,229,119,128, 5,220,230,233,238,
- 225,236,225,242,225,226,233, 99,128,254,222,232,225,232,233,238,
- 233,244,233,225,236,225,242,225,226,233, 99,128,252,202,233,238,
- 233,244,233,225,236,225,242,225,226,233, 99,128,254,223,234,229,
- 229,237,233,238,233,244,233,225,236,225,242,225,226,233, 99,128,
- 252,201,235,232,225,232,233,238,233,244,233,225,236,225,242,225,
- 226,233, 99,128,252,203,236,225,237,232,229,232,233,243,239,236,
- 225,244,229,228,225,242,225,226,233, 99,128,253,242,237,101, 2,
- 124,180,124,193,228,233,225,236,225,242,225,226,233, 99,128,254,
- 224,229,109, 2,124,200,124,219,232,225,232,233,238,233,244,233,
- 225,236,225,242,225,226,233, 99,128,253,136,233,238,233,244,233,
- 225,236,225,242,225,226,233, 99,128,252,204,242,231,229,227,233,
- 242,227,236,101,128, 37,239, 98, 3,124,255,125, 4,125, 10,225,
- 114,128, 1,154,229,236,116,128, 2,108,239,240,239,237,239,230,
- 111,128, 49, 12, 99, 4,125, 30,125, 37,125, 46,125, 73,225,242,
- 239,110,128, 1, 62,229,228,233,236,236, 97,128, 1, 60,233,242,
- 99, 2,125, 54,125, 59,236,101,128, 36,219,245,237,230,236,229,
- 248,226,229,236,239,119,128, 30, 61,239,237,237,225,225,227,227,
- 229,238,116,128, 1, 60,228,239,116,130, 1, 64,125, 96,125,105,
- 225,227,227,229,238,116,128, 1, 64,226,229,236,239,119,129, 30,
- 55,125,115,237,225,227,242,239,110,128, 30, 57,101, 3,125,132,
- 125,170,126, 15,230,116, 2,125,139,125,155,225,238,231,236,229,
- 225,226,239,246,229,227,237, 98,128, 3, 26,244,225,227,235,226,
- 229,236,239,247,227,237, 98,128, 3, 24,243,115,132, 0, 60,125,
- 183,125,205,125,217,126, 7,229,241,245,225,108,129, 34,100,125,
- 193,239,242,231,242,229,225,244,229,114,128, 34,218,237,239,238,
- 239,243,240,225,227,101,128,255, 28,111, 2,125,223,125,252,114,
- 2,125,229,125,242,229,241,245,233,246,225,236,229,238,116,128,
- 34,114,231,242,229,225,244,229,114,128, 34,118,246,229,242,229,
- 241,245,225,108,128, 34,102,243,237,225,236,108,128,254,100,250,
- 104,128, 2,110,230,226,236,239,227,107,128, 37,140,232,239,239,
- 235,242,229,244,242,239,230,236,229,120,128, 2,109,105, 2,126,
- 51,126, 56,242, 97,128, 32,164,247,238,225,242,237,229,238,233,
- 225,110,128, 5,108,106,129, 1,201,126, 75,229,227,249,242,233,
- 236,236,233, 99,128, 4, 89,108,132,246,192,126, 99,126,123,126,
- 134,126,143, 97, 2,126,105,126,112,228,229,246, 97,128, 9, 51,
- 231,245,234,225,242,225,244,105,128, 10,179,233,238,229,226,229,
- 236,239,119,128, 30, 59,236,225,228,229,246, 97,128, 9, 52,246,
- 239,227,225,236,233, 99, 3,126,157,126,167,126,174,226,229,238,
- 231,225,236,105,128, 9,225,228,229,246, 97,128, 9, 97,246,239,
- 247,229,236,243,233,231,110, 2,126,188,126,198,226,229,238,231,
- 225,236,105,128, 9,227,228,229,246, 97,128, 9, 99,109, 3,126,
- 213,126,226,126,237,233,228,228,236,229,244,233,236,228,101,128,
- 2,107,239,238,239,243,240,225,227,101,128,255, 76,243,241,245,
- 225,242,101,128, 51,208,111, 6,127, 4,127, 16,127, 58,127, 69,
- 127, 75,127,117,227,232,245,236,225,244,232,225,105,128, 14, 44,
- 231,233,227,225,108, 3,127, 28,127, 34,127, 53,225,238,100,128,
- 34, 39,238,239,116,129, 0,172,127, 42,242,229,246,229,242,243,
- 229,100,128, 35, 16,239,114,128, 34, 40,236,233,238,231,244,232,
- 225,105,128, 14, 37,238,231,115,128, 1,127,247,236,233,238,101,
- 2,127, 85,127,108, 99, 2,127, 91,127,103,229,238,244,229,242,
- 236,233,238,101,128,254, 78,237, 98,128, 3, 50,228,225,243,232,
- 229,100,128,254, 77,250,229,238,231,101,128, 37,202,240,225,242,
- 229,110,128, 36,167,115, 3,127,141,127,148,127,156,236,225,243,
- 104,128, 1, 66,241,245,225,242,101,128, 33, 19,245,240,229,242,
- 233,239,114,128,246,238,244,243,232,225,228,101,128, 37,145,245,
- 244,232,225,105,128, 14, 38,246,239,227,225,236,233, 99, 3,127,
- 197,127,207,127,214,226,229,238,231,225,236,105,128, 9,140,228,
- 229,246, 97,128, 9, 12,246,239,247,229,236,243,233,231,110, 2,
- 127,228,127,238,226,229,238,231,225,236,105,128, 9,226,228,229,
- 246, 97,128, 9, 98,248,243,241,245,225,242,101,128, 51,211,109,
- 144, 0,109,128, 35,130,144,130,169,130,196,130,221,132, 18,132,
- 40,133, 95,133,125,133,174,134, 25,134, 47,134, 72,134, 81,135,
- 108,135,136, 97, 12,128, 61,128, 71,128,135,128,142,128,167,128,
- 215,130, 51,130, 76,130, 81,130, 95,130,107,130,112,226,229,238,
- 231,225,236,105,128, 9,174, 99, 2,128, 77,128,129,242,239,110,
- 132, 0,175,128, 91,128,102,128,108,128,117,226,229,236,239,247,
- 227,237, 98,128, 3, 49,227,237, 98,128, 3, 4,236,239,247,237,
- 239,100,128, 2,205,237,239,238,239,243,240,225,227,101,128,255,
- 227,245,244,101,128, 30, 63,228,229,246, 97,128, 9, 46,231,117,
- 2,128,149,128,158,234,225,242,225,244,105,128, 10,174,242,237,
- 245,235,232,105,128, 10, 46,104, 2,128,173,128,205,225,240,225,
- 235,104, 2,128,183,128,192,232,229,226,242,229,119,128, 5,164,
- 236,229,230,244,232,229,226,242,229,119,128, 5,164,233,242,225,
- 231,225,238, 97,128, 48,126,105, 5,128,227,129, 40,129,103,129,
- 133,130, 39,227,232,225,244,244,225,247, 97, 3,128,242,129, 17,
- 129, 24,236,239,119, 2,128,250,129, 5,236,229,230,244,244,232,
- 225,105,128,248,149,242,233,231,232,244,244,232,225,105,128,248,
- 148,244,232,225,105,128, 14, 75,245,240,240,229,242,236,229,230,
- 244,244,232,225,105,128,248,147,229,107, 3,129, 49,129, 80,129,
- 87,236,239,119, 2,129, 57,129, 68,236,229,230,244,244,232,225,
- 105,128,248,140,242,233,231,232,244,244,232,225,105,128,248,139,
- 244,232,225,105,128, 14, 72,245,240,240,229,242,236,229,230,244,
- 244,232,225,105,128,248,138,232,225,238,225,235,225,116, 2,129,
- 115,129,126,236,229,230,244,244,232,225,105,128,248,132,244,232,
- 225,105,128, 14, 49,116, 3,129,141,129,169,129,232,225,233,235,
- 232,117, 2,129,151,129,162,236,229,230,244,244,232,225,105,128,
- 248,137,244,232,225,105,128, 14, 71,232,111, 3,129,178,129,209,
- 129,216,236,239,119, 2,129,186,129,197,236,229,230,244,244,232,
- 225,105,128,248,143,242,233,231,232,244,244,232,225,105,128,248,
- 142,244,232,225,105,128, 14, 73,245,240,240,229,242,236,229,230,
- 244,244,232,225,105,128,248,141,242,105, 3,129,241,130, 16,130,
- 23,236,239,119, 2,129,249,130, 4,236,229,230,244,244,232,225,
- 105,128,248,146,242,233,231,232,244,244,232,225,105,128,248,145,
- 244,232,225,105,128, 14, 74,245,240,240,229,242,236,229,230,244,
- 244,232,225,105,128,248,144,249,225,237,239,235,244,232,225,105,
- 128, 14, 70,235,225,244,225,235,225,238, 97,129, 48,222,130, 64,
- 232,225,236,230,247,233,228,244,104,128,255,143,236,101,128, 38,
- 66,238,243,249,239,238,243,241,245,225,242,101,128, 51, 71,241,
- 225,230,232,229,226,242,229,119,128, 5,190,242,115,128, 38, 66,
- 115, 2,130,118,130,136,239,242,225,227,233,242,227,236,229,232,
- 229,226,242,229,119,128, 5,175,241,245,225,242,101,128, 51,131,
- 98, 2,130,150,130,160,239,240,239,237,239,230,111,128, 49, 7,
- 243,241,245,225,242,101,128, 51,212, 99, 2,130,175,130,183,233,
- 242,227,236,101,128, 36,220,245,226,229,228,243,241,245,225,242,
- 101,128, 51,165,228,239,116, 2,130,204,130,213,225,227,227,229,
- 238,116,128, 30, 65,226,229,236,239,119,128, 30, 67,101, 7,130,
- 237,131,108,131,119,131,134,131,159,131,196,131,208,101, 2,130,
- 243,131, 95,109, 4,130,253,131, 6,131, 20,131, 36,225,242,225,
- 226,233, 99,128, 6, 69,230,233,238,225,236,225,242,225,226,233,
- 99,128,254,226,233,238,233,244,233,225,236,225,242,225,226,233,
- 99,128,254,227,237,101, 2,131, 43,131, 56,228,233,225,236,225,
- 242,225,226,233, 99,128,254,228,229,237,105, 2,131, 64,131, 79,
- 238,233,244,233,225,236,225,242,225,226,233, 99,128,252,209,243,
- 239,236,225,244,229,228,225,242,225,226,233, 99,128,252, 72,244,
- 239,242,245,243,241,245,225,242,101,128, 51, 77,232,233,242,225,
- 231,225,238, 97,128, 48,129,233,250,233,229,242,225,243,241,245,
- 225,242,101,128, 51,126,235,225,244,225,235,225,238, 97,129, 48,
- 225,131,147,232,225,236,230,247,233,228,244,104,128,255,146,109,
- 130, 5,222,131,167,131,187,228,225,231,229,243,104,129,251, 62,
- 131,178,232,229,226,242,229,119,128,251, 62,232,229,226,242,229,
- 119,128, 5,222,238,225,242,237,229,238,233,225,110,128, 5,116,
- 242,235,232, 97, 3,131,219,131,228,132, 5,232,229,226,242,229,
- 119,128, 5,165,235,229,230,245,236, 97, 2,131,239,131,248,232,
- 229,226,242,229,119,128, 5,166,236,229,230,244,232,229,226,242,
- 229,119,128, 5,166,236,229,230,244,232,229,226,242,229,119,128,
- 5,165,104, 2,132, 24,132, 30,239,239,107,128, 2,113,250,243,
- 241,245,225,242,101,128, 51,146,105, 6,132, 54,132, 91,132,228,
- 132,239,133, 8,133, 65,228,100, 2,132, 61,132, 86,236,229,228,
- 239,244,235,225,244,225,235,225,238,225,232,225,236,230,247,233,
- 228,244,104,128,255,101,239,116,128, 0,183,229,245,109, 5,132,
- 105,132,140,132,155,132,164,132,215, 97, 2,132,111,132,126,227,
- 233,242,227,236,229,235,239,242,229,225,110,128, 50,114,240,225,
- 242,229,238,235,239,242,229,225,110,128, 50, 18,227,233,242,227,
- 236,229,235,239,242,229,225,110,128, 50,100,235,239,242,229,225,
- 110,128, 49, 65,112, 2,132,170,132,202, 97, 2,132,176,132,190,
- 238,243,233,239,243,235,239,242,229,225,110,128, 49,112,242,229,
- 238,235,239,242,229,225,110,128, 50, 4,233,229,245,240,235,239,
- 242,229,225,110,128, 49,110,243,233,239,243,235,239,242,229,225,
- 110,128, 49,111,232,233,242,225,231,225,238, 97,128, 48,127,235,
- 225,244,225,235,225,238, 97,129, 48,223,132,252,232,225,236,230,
- 247,233,228,244,104,128,255,144,238,117, 2,133, 15,133, 60,115,
- 132, 34, 18,133, 27,133, 38,133, 47,133, 53,226,229,236,239,247,
- 227,237, 98,128, 3, 32,227,233,242,227,236,101,128, 34,150,237,
- 239,100,128, 2,215,240,236,245,115,128, 34, 19,244,101,128, 32,
- 50,242,105, 2,133, 72,133, 86,226,225,225,242,245,243,241,245,
- 225,242,101,128, 51, 74,243,241,245,225,242,101,128, 51, 73,108,
- 2,133,101,133,116,239,238,231,236,229,231,244,245,242,238,229,
- 100,128, 2,112,243,241,245,225,242,101,128, 51,150,109, 3,133,
- 133,133,147,133,158,227,245,226,229,228,243,241,245,225,242,101,
- 128, 51,163,239,238,239,243,240,225,227,101,128,255, 77,243,241,
- 245,225,242,229,228,243,241,245,225,242,101,128, 51,159,111, 5,
- 133,186,133,212,133,237,133,247,134, 0,104, 2,133,192,133,202,
- 233,242,225,231,225,238, 97,128, 48,130,237,243,241,245,225,242,
- 101,128, 51,193,235,225,244,225,235,225,238, 97,129, 48,226,133,
- 225,232,225,236,230,247,233,228,244,104,128,255,147,236,243,241,
- 245,225,242,101,128, 51,214,237,225,244,232,225,105,128, 14, 33,
- 246,229,242,243,243,241,245,225,242,101,129, 51,167,134, 15,228,
- 243,241,245,225,242,101,128, 51,168,240, 97, 2,134, 32,134, 38,
- 242,229,110,128, 36,168,243,241,245,225,242,101,128, 51,171,115,
- 2,134, 53,134, 62,243,241,245,225,242,101,128, 51,179,245,240,
- 229,242,233,239,114,128,246,239,244,245,242,238,229,100,128, 2,
- 111,117,141, 0,181,134,111,134,115,134,125,134,149,134,159,134,
- 181,134,192,134,217,134,240,134,250,135, 24,135, 88,135, 98, 49,
- 128, 0,181,225,243,241,245,225,242,101,128, 51,130,227,104, 2,
- 134,132,134,142,231,242,229,225,244,229,114,128, 34,107,236,229,
- 243,115,128, 34,106,230,243,241,245,225,242,101,128, 51,140,103,
- 2,134,165,134,172,242,229,229,107,128, 3,188,243,241,245,225,
- 242,101,128, 51,141,232,233,242,225,231,225,238, 97,128, 48,128,
- 235,225,244,225,235,225,238, 97,129, 48,224,134,205,232,225,236,
- 230,247,233,228,244,104,128,255,145,108, 2,134,223,134,232,243,
- 241,245,225,242,101,128, 51,149,244,233,240,236,121,128, 0,215,
- 237,243,241,245,225,242,101,128, 51,155,238,225,104, 2,135, 2,
- 135, 11,232,229,226,242,229,119,128, 5,163,236,229,230,244,232,
- 229,226,242,229,119,128, 5,163,115, 2,135, 30,135, 79,233, 99,
- 3,135, 39,135, 56,135, 67,225,236,238,239,244,101,129, 38,106,
- 135, 50,228,226,108,128, 38,107,230,236,225,244,243,233,231,110,
- 128, 38,109,243,232,225,242,240,243,233,231,110,128, 38,111,243,
- 241,245,225,242,101,128, 51,178,246,243,241,245,225,242,101,128,
- 51,182,247,243,241,245,225,242,101,128, 51,188,118, 2,135,114,
- 135,127,237,229,231,225,243,241,245,225,242,101,128, 51,185,243,
- 241,245,225,242,101,128, 51,183,119, 2,135,142,135,155,237,229,
- 231,225,243,241,245,225,242,101,128, 51,191,243,241,245,225,242,
- 101,128, 51,189,110,150, 0,110,135,212,136, 90,136,114,136,180,
- 136,205,137, 7,137, 17,137, 84,137,127,139,161,139,179,139,204,
- 139,235,140, 5,140, 70,142, 52,142, 60,142, 85,142, 93,143, 61,
- 143, 71,143, 81, 97, 8,135,230,135,250,136, 1,136, 8,136, 33,
- 136, 44,136, 69,136, 81, 98, 2,135,236,135,245,229,238,231,225,
- 236,105,128, 9,168,236, 97,128, 34, 7,227,245,244,101,128, 1,
- 68,228,229,246, 97,128, 9, 40,231,117, 2,136, 15,136, 24,234,
- 225,242,225,244,105,128, 10,168,242,237,245,235,232,105,128, 10,
- 40,232,233,242,225,231,225,238, 97,128, 48,106,235,225,244,225,
- 235,225,238, 97,129, 48,202,136, 57,232,225,236,230,247,233,228,
- 244,104,128,255,133,240,239,243,244,242,239,240,232,101,128, 1,
- 73,243,241,245,225,242,101,128, 51,129, 98, 2,136, 96,136,106,
- 239,240,239,237,239,230,111,128, 49, 11,243,240,225,227,101,128,
- 0,160, 99, 4,136,124,136,131,136,140,136,167,225,242,239,110,
- 128, 1, 72,229,228,233,236,236, 97,128, 1, 70,233,242, 99, 2,
- 136,148,136,153,236,101,128, 36,221,245,237,230,236,229,248,226,
- 229,236,239,119,128, 30, 75,239,237,237,225,225,227,227,229,238,
- 116,128, 1, 70,228,239,116, 2,136,188,136,197,225,227,227,229,
- 238,116,128, 30, 69,226,229,236,239,119,128, 30, 71,101, 3,136,
- 213,136,224,136,249,232,233,242,225,231,225,238, 97,128, 48,109,
- 235,225,244,225,235,225,238, 97,129, 48,205,136,237,232,225,236,
- 230,247,233,228,244,104,128,255,136,247,243,232,229,241,229,236,
- 243,233,231,110,128, 32,170,230,243,241,245,225,242,101,128, 51,
- 139,103, 2,137, 23,137, 73, 97, 3,137, 31,137, 41,137, 48,226,
- 229,238,231,225,236,105,128, 9,153,228,229,246, 97,128, 9, 25,
- 231,117, 2,137, 55,137, 64,234,225,242,225,244,105,128, 10,153,
- 242,237,245,235,232,105,128, 10, 25,239,238,231,245,244,232,225,
- 105,128, 14, 7,104, 2,137, 90,137,100,233,242,225,231,225,238,
- 97,128, 48,147,239,239,107, 2,137,108,137,115,236,229,230,116,
- 128, 2,114,242,229,244,242,239,230,236,229,120,128, 2,115,105,
- 4,137,137,138, 50,138, 61,138,119,229,245,110, 7,137,155,137,
- 190,137,222,137,236,137,245,138, 22,138, 35, 97, 2,137,161,137,
- 176,227,233,242,227,236,229,235,239,242,229,225,110,128, 50,111,
- 240,225,242,229,238,235,239,242,229,225,110,128, 50, 15,227,105,
- 2,137,197,137,209,229,245,227,235,239,242,229,225,110,128, 49,
- 53,242,227,236,229,235,239,242,229,225,110,128, 50, 97,232,233,
- 229,245,232,235,239,242,229,225,110,128, 49, 54,235,239,242,229,
- 225,110,128, 49, 52,240, 97, 2,137,252,138, 10,238,243,233,239,
- 243,235,239,242,229,225,110,128, 49,104,242,229,238,235,239,242,
- 229,225,110,128, 50, 1,243,233,239,243,235,239,242,229,225,110,
- 128, 49,103,244,233,235,229,245,244,235,239,242,229,225,110,128,
- 49,102,232,233,242,225,231,225,238, 97,128, 48,107,107, 2,138,
- 67,138, 91,225,244,225,235,225,238, 97,129, 48,203,138, 79,232,
- 225,236,230,247,233,228,244,104,128,255,134,232,225,232,233,116,
- 2,138,101,138,112,236,229,230,244,244,232,225,105,128,248,153,
- 244,232,225,105,128, 14, 77,238,101,141, 0, 57,138,150,138,159,
- 138,169,138,199,138,206,138,231,139, 2,139, 36,139, 48,139, 59,
- 139, 92,139,100,139,111,225,242,225,226,233, 99,128, 6,105,226,
- 229,238,231,225,236,105,128, 9,239,227,233,242,227,236,101,129,
- 36,104,138,180,233,238,246,229,242,243,229,243,225,238,243,243,
- 229,242,233,102,128, 39,146,228,229,246, 97,128, 9,111,231,117,
- 2,138,213,138,222,234,225,242,225,244,105,128, 10,239,242,237,
- 245,235,232,105,128, 10,111,232, 97, 2,138,238,138,249,227,235,
- 225,242,225,226,233, 99,128, 6,105,238,231,250,232,239,117,128,
- 48, 41,105, 2,139, 8,139, 26,228,229,239,231,242,225,240,232,
- 233,227,240,225,242,229,110,128, 50, 40,238,230,229,242,233,239,
- 114,128, 32,137,237,239,238,239,243,240,225,227,101,128,255, 25,
- 239,236,228,243,244,249,236,101,128,247, 57,112, 2,139, 65,139,
- 72,225,242,229,110,128, 36,124,229,114, 2,139, 79,139, 85,233,
- 239,100,128, 36,144,243,233,225,110,128, 6,249,242,239,237,225,
- 110,128, 33,120,243,245,240,229,242,233,239,114,128, 32,121,116,
- 2,139,117,139,155,229,229,110, 2,139,125,139,134,227,233,242,
- 227,236,101,128, 36,114,112, 2,139,140,139,147,225,242,229,110,
- 128, 36,134,229,242,233,239,100,128, 36,154,232,225,105,128, 14,
- 89,106,129, 1,204,139,167,229,227,249,242,233,236,236,233, 99,
- 128, 4, 90,235,225,244,225,235,225,238, 97,129, 48,243,139,192,
- 232,225,236,230,247,233,228,244,104,128,255,157,108, 2,139,210,
- 139,224,229,231,242,233,231,232,244,236,239,238,103,128, 1,158,
- 233,238,229,226,229,236,239,119,128, 30, 73,109, 2,139,241,139,
- 252,239,238,239,243,240,225,227,101,128,255, 78,243,241,245,225,
- 242,101,128, 51,154,110, 2,140, 11,140, 61, 97, 3,140, 19,140,
- 29,140, 36,226,229,238,231,225,236,105,128, 9,163,228,229,246,
- 97,128, 9, 35,231,117, 2,140, 43,140, 52,234,225,242,225,244,
- 105,128, 10,163,242,237,245,235,232,105,128, 10, 35,238,225,228,
- 229,246, 97,128, 9, 41,111, 6,140, 84,140, 95,140,120,140,161,
- 141,113,142, 40,232,233,242,225,231,225,238, 97,128, 48,110,235,
- 225,244,225,235,225,238, 97,129, 48,206,140,108,232,225,236,230,
- 247,233,228,244,104,128,255,137,110, 3,140,128,140,144,140,153,
- 226,242,229,225,235,233,238,231,243,240,225,227,101,128, 0,160,
- 229,238,244,232,225,105,128, 14, 19,245,244,232,225,105,128, 14,
- 25,239,110, 7,140,178,140,187,140,201,140,235,140,251,141, 36,
- 141, 95,225,242,225,226,233, 99,128, 6, 70,230,233,238,225,236,
- 225,242,225,226,233, 99,128,254,230,231,232,245,238,238, 97, 2,
- 140,212,140,221,225,242,225,226,233, 99,128, 6,186,230,233,238,
- 225,236,225,242,225,226,233, 99,128,251,159,233,238,233,244,233,
- 225,236,225,242,225,226,233, 99,128,254,231,234,229,229,237,105,
- 2,141, 5,141, 20,238,233,244,233,225,236,225,242,225,226,233,
- 99,128,252,210,243,239,236,225,244,229,228,225,242,225,226,233,
- 99,128,252, 75,237,101, 2,141, 43,141, 56,228,233,225,236,225,
- 242,225,226,233, 99,128,254,232,229,237,105, 2,141, 64,141, 79,
- 238,233,244,233,225,236,225,242,225,226,233, 99,128,252,213,243,
- 239,236,225,244,229,228,225,242,225,226,233, 99,128,252, 78,238,
- 239,239,238,230,233,238,225,236,225,242,225,226,233, 99,128,252,
- 141,116, 7,141,129,141,140,141,169,141,204,141,216,141,236,142,
- 6,227,239,238,244,225,233,238,115,128, 34, 12,101, 2,141,146,
- 141,162,236,229,237,229,238,116,129, 34, 9,141,157,239,102,128,
- 34, 9,241,245,225,108,128, 34, 96,231,242,229,225,244,229,114,
- 129, 34,111,141,181,238,239,114, 2,141,189,141,197,229,241,245,
- 225,108,128, 34,113,236,229,243,115,128, 34,121,233,228,229,238,
- 244,233,227,225,108,128, 34, 98,236,229,243,115,129, 34,110,141,
- 225,238,239,242,229,241,245,225,108,128, 34,112,112, 2,141,242,
- 141,252,225,242,225,236,236,229,108,128, 34, 38,242,229,227,229,
- 228,229,115,128, 34,128,243,117, 3,142, 15,142, 22,142, 31,226,
- 243,229,116,128, 34,132,227,227,229,229,228,115,128, 34,129,240,
- 229,242,243,229,116,128, 34,133,247,225,242,237,229,238,233,225,
- 110,128, 5,118,240,225,242,229,110,128, 36,169,115, 2,142, 66,
- 142, 75,243,241,245,225,242,101,128, 51,177,245,240,229,242,233,
- 239,114,128, 32,127,244,233,236,228,101,128, 0,241,117,132, 3,
- 189,142,105,142,116,142,197,143, 24,232,233,242,225,231,225,238,
- 97,128, 48,108,107, 2,142,122,142,146,225,244,225,235,225,238,
- 97,129, 48,204,142,134,232,225,236,230,247,233,228,244,104,128,
- 255,135,244, 97, 3,142,155,142,165,142,172,226,229,238,231,225,
- 236,105,128, 9,188,228,229,246, 97,128, 9, 60,231,117, 2,142,
- 179,142,188,234,225,242,225,244,105,128, 10,188,242,237,245,235,
- 232,105,128, 10, 60,109, 2,142,203,142,237,226,229,242,243,233,
- 231,110,130, 0, 35,142,217,142,229,237,239,238,239,243,240,225,
- 227,101,128,255, 3,243,237,225,236,108,128,254, 95,229,114, 2,
- 142,244,143, 20,225,236,243,233,231,110, 2,142,255,143, 7,231,
- 242,229,229,107,128, 3,116,236,239,247,229,242,231,242,229,229,
- 107,128, 3,117,111,128, 33, 22,110,130, 5,224,143, 32,143, 52,
- 228,225,231,229,243,104,129,251, 64,143, 43,232,229,226,242,229,
- 119,128,251, 64,232,229,226,242,229,119,128, 5,224,246,243,241,
- 245,225,242,101,128, 51,181,247,243,241,245,225,242,101,128, 51,
- 187,249, 97, 3,143, 90,143,100,143,107,226,229,238,231,225,236,
- 105,128, 9,158,228,229,246, 97,128, 9, 30,231,117, 2,143,114,
- 143,123,234,225,242,225,244,105,128, 10,158,242,237,245,235,232,
- 105,128, 10, 30,111,147, 0,111,143,174,143,196,144, 18,144,188,
- 145, 4,145, 19,145, 59,145,182,145,203,145,241,145,252,146,174,
- 148, 8,148, 72,148,105,148,151,149, 24,149, 71,149, 83, 97, 2,
- 143,180,143,187,227,245,244,101,128, 0,243,238,231,244,232,225,
- 105,128, 14, 45, 98, 4,143,206,143,248,144, 1,144, 11,225,242,
- 242,229,100,130, 2,117,143,218,143,229,227,249,242,233,236,236,
- 233, 99,128, 4,233,228,233,229,242,229,243,233,243,227,249,242,
- 233,236,236,233, 99,128, 4,235,229,238,231,225,236,105,128, 9,
- 147,239,240,239,237,239,230,111,128, 49, 27,242,229,246,101,128,
- 1, 79, 99, 3,144, 26,144, 99,144,178, 97, 2,144, 32,144, 93,
- 238,228,242, 97, 3,144, 43,144, 50,144, 61,228,229,246, 97,128,
- 9, 17,231,245,234,225,242,225,244,105,128, 10,145,246,239,247,
- 229,236,243,233,231,110, 2,144, 75,144, 82,228,229,246, 97,128,
- 9, 73,231,245,234,225,242,225,244,105,128, 10,201,242,239,110,
- 128, 1,210,233,242, 99, 2,144,107,144,112,236,101,128, 36,222,
- 245,237,230,236,229,120,133, 0,244,144,131,144,139,144,150,144,
- 158,144,170,225,227,245,244,101,128, 30,209,228,239,244,226,229,
- 236,239,119,128, 30,217,231,242,225,246,101,128, 30,211,232,239,
- 239,235,225,226,239,246,101,128, 30,213,244,233,236,228,101,128,
- 30,215,249,242,233,236,236,233, 99,128, 4, 62,100, 4,144,198,
- 144,221,144,227,144,250,226,108, 2,144,205,144,213,225,227,245,
- 244,101,128, 1, 81,231,242,225,246,101,128, 2, 13,229,246, 97,
- 128, 9, 19,233,229,242,229,243,233,115,129, 0,246,144,239,227,
- 249,242,233,236,236,233, 99,128, 4,231,239,244,226,229,236,239,
- 119,128, 30,205,101,129, 1, 83,145, 10,235,239,242,229,225,110,
- 128, 49, 90,103, 3,145, 27,145, 42,145, 49,239,238,229,107,129,
- 2,219,145, 36,227,237, 98,128, 3, 40,242,225,246,101,128, 0,
- 242,245,234,225,242,225,244,105,128, 10,147,104, 4,145, 69,145,
- 80,145, 90,145,168,225,242,237,229,238,233,225,110,128, 5,133,
- 233,242,225,231,225,238, 97,128, 48, 74,111, 2,145, 96,145,106,
- 239,235,225,226,239,246,101,128, 30,207,242,110,133, 1,161,145,
- 121,145,129,145,140,145,148,145,160,225,227,245,244,101,128, 30,
- 219,228,239,244,226,229,236,239,119,128, 30,227,231,242,225,246,
- 101,128, 30,221,232,239,239,235,225,226,239,246,101,128, 30,223,
- 244,233,236,228,101,128, 30,225,245,238,231,225,242,245,237,236,
- 225,245,116,128, 1, 81,105,129, 1,163,145,188,238,246,229,242,
- 244,229,228,226,242,229,246,101,128, 2, 15,107, 2,145,209,145,
- 233,225,244,225,235,225,238, 97,129, 48,170,145,221,232,225,236,
- 230,247,233,228,244,104,128,255,117,239,242,229,225,110,128, 49,
- 87,236,229,232,229,226,242,229,119,128, 5,171,109, 6,146, 10,
- 146, 38,146, 45,146,134,146,145,146,163,225,227,242,239,110,130,
- 1, 77,146, 22,146, 30,225,227,245,244,101,128, 30, 83,231,242,
- 225,246,101,128, 30, 81,228,229,246, 97,128, 9, 80,229,231, 97,
- 133, 3,201,146, 61,146, 65,146, 76,146, 90,146,106, 49,128, 3,
- 214,227,249,242,233,236,236,233, 99,128, 4, 97,236,225,244,233,
- 238,227,236,239,243,229,100,128, 2,119,242,239,245,238,228,227,
- 249,242,233,236,236,233, 99,128, 4,123,116, 2,146,112,146,127,
- 233,244,236,239,227,249,242,233,236,236,233, 99,128, 4,125,239,
- 238,239,115,128, 3,206,231,245,234,225,242,225,244,105,128, 10,
- 208,233,227,242,239,110,129, 3,191,146,155,244,239,238,239,115,
- 128, 3,204,239,238,239,243,240,225,227,101,128,255, 79,238,101,
- 145, 0, 49,146,213,146,222,146,232,147, 6,147, 31,147, 40,147,
- 49,147, 74,147,108,147,142,147,154,147,173,147,184,147,217,147,
- 227,147,235,147,246,225,242,225,226,233, 99,128, 6, 97,226,229,
- 238,231,225,236,105,128, 9,231,227,233,242,227,236,101,129, 36,
- 96,146,243,233,238,246,229,242,243,229,243,225,238,243,243,229,
- 242,233,102,128, 39,138,100, 2,147, 12,147, 18,229,246, 97,128,
- 9,103,239,244,229,238,236,229,225,228,229,114,128, 32, 36,229,
- 233,231,232,244,104,128, 33, 91,230,233,244,244,229,100,128,246,
- 220,231,117, 2,147, 56,147, 65,234,225,242,225,244,105,128, 10,
- 231,242,237,245,235,232,105,128, 10,103,232, 97, 3,147, 83,147,
- 94,147, 99,227,235,225,242,225,226,233, 99,128, 6, 97,236,102,
- 128, 0,189,238,231,250,232,239,117,128, 48, 33,105, 2,147,114,
- 147,132,228,229,239,231,242,225,240,232,233,227,240,225,242,229,
- 110,128, 50, 32,238,230,229,242,233,239,114,128, 32,129,237,239,
- 238,239,243,240,225,227,101,128,255, 17,238,245,237,229,242,225,
- 244,239,242,226,229,238,231,225,236,105,128, 9,244,239,236,228,
- 243,244,249,236,101,128,247, 49,112, 2,147,190,147,197,225,242,
- 229,110,128, 36,116,229,114, 2,147,204,147,210,233,239,100,128,
- 36,136,243,233,225,110,128, 6,241,241,245,225,242,244,229,114,
- 128, 0,188,242,239,237,225,110,128, 33,112,243,245,240,229,242,
- 233,239,114,128, 0,185,244,104, 2,147,253,148, 2,225,105,128,
- 14, 81,233,242,100,128, 33, 83,111, 3,148, 16,148, 50,148, 66,
- 103, 2,148, 22,148, 40,239,238,229,107,129, 1,235,148, 31,237,
- 225,227,242,239,110,128, 1,237,245,242,237,245,235,232,105,128,
- 10, 19,237,225,244,242,225,231,245,242,237,245,235,232,105,128,
- 10, 75,240,229,110,128, 2, 84,112, 3,148, 80,148, 87,148, 98,
- 225,242,229,110,128, 36,170,229,238,226,245,236,236,229,116,128,
- 37,230,244,233,239,110,128, 35, 37,114, 2,148,111,148,140,100,
- 2,148,117,148,128,230,229,237,233,238,233,238,101,128, 0,170,
- 237,225,243,227,245,236,233,238,101,128, 0,186,244,232,239,231,
- 239,238,225,108,128, 34, 31,115, 5,148,163,148,195,148,212,149,
- 1,149, 14,232,239,242,116, 2,148,172,148,179,228,229,246, 97,
- 128, 9, 18,246,239,247,229,236,243,233,231,238,228,229,246, 97,
- 128, 9, 74,236,225,243,104,129, 0,248,148,204,225,227,245,244,
- 101,128, 1,255,237,225,236,108, 2,148,221,148,232,232,233,242,
- 225,231,225,238, 97,128, 48, 73,235,225,244,225,235,225,238, 97,
- 129, 48,169,148,245,232,225,236,230,247,233,228,244,104,128,255,
- 107,244,242,239,235,229,225,227,245,244,101,128, 1,255,245,240,
- 229,242,233,239,114,128,246,240,116, 2,149, 30,149, 41,227,249,
- 242,233,236,236,233, 99,128, 4,127,233,236,228,101,130, 0,245,
- 149, 52,149, 60,225,227,245,244,101,128, 30, 77,228,233,229,242,
- 229,243,233,115,128, 30, 79,245,226,239,240,239,237,239,230,111,
- 128, 49, 33,118, 2,149, 89,149,170,229,114, 2,149, 96,149,162,
- 236,233,238,101,131, 32, 62,149,109,149,132,149,155, 99, 2,149,
- 115,149,127,229,238,244,229,242,236,233,238,101,128,254, 74,237,
- 98,128, 3, 5,100, 2,149,138,149,146,225,243,232,229,100,128,
- 254, 73,226,236,247,225,246,121,128,254, 76,247,225,246,121,128,
- 254, 75,243,227,239,242,101,128, 0,175,239,247,229,236,243,233,
- 231,110, 3,149,185,149,195,149,202,226,229,238,231,225,236,105,
- 128, 9,203,228,229,246, 97,128, 9, 75,231,245,234,225,242,225,
- 244,105,128, 10,203,112,145, 0,112,149,251,152,123,152,134,152,
- 143,152,155,154, 80,154, 90,155, 82,156,101,156,191,156,217,157,
- 92,157,100,158, 2,158, 60,158, 88,158, 98, 97, 14,150, 25,150,
- 57,150, 67,150, 74,150, 81,150,129,150,140,150,154,150,165,150,
- 212,150,226,151,238,152, 21,152,111, 97, 2,150, 31,150, 43,237,
- 240,243,243,241,245,225,242,101,128, 51,128,243,229,238,244,239,
- 243,241,245,225,242,101,128, 51, 43,226,229,238,231,225,236,105,
- 128, 9,170,227,245,244,101,128, 30, 85,228,229,246, 97,128, 9,
- 42,103, 2,150, 87,150,105,101, 2,150, 93,150,100,228,239,247,
- 110,128, 33,223,245,112,128, 33,222,117, 2,150,111,150,120,234,
- 225,242,225,244,105,128, 10,170,242,237,245,235,232,105,128, 10,
- 42,232,233,242,225,231,225,238, 97,128, 48,113,233,249,225,238,
- 238,239,233,244,232,225,105,128, 14, 47,235,225,244,225,235,225,
- 238, 97,128, 48,209,108, 2,150,171,150,196,225,244,225,236,233,
- 250,225,244,233,239,238,227,249,242,233,236,236,233,227,227,237,
- 98,128, 4,132,239,227,232,235,225,227,249,242,233,236,236,233,
- 99,128, 4,192,238,243,233,239,243,235,239,242,229,225,110,128,
- 49,127,114, 3,150,234,150,255,151,227, 97, 2,150,240,150,248,
- 231,242,225,240,104,128, 0,182,236,236,229,108,128, 34, 37,229,
- 110, 2,151, 6,151,116,236,229,230,116,136, 0, 40,151, 29,151,
- 44,151, 49,151, 54,151, 65,151, 77,151,100,151,105,225,236,244,
- 239,238,229,225,242,225,226,233, 99,128,253, 62,226,116,128,248,
- 237,229,120,128,248,236,233,238,230,229,242,233,239,114,128, 32,
- 141,237,239,238,239,243,240,225,227,101,128,255, 8,115, 2,151,
- 83,151, 90,237,225,236,108,128,254, 89,245,240,229,242,233,239,
- 114,128, 32,125,244,112,128,248,235,246,229,242,244,233,227,225,
- 108,128,254, 53,242,233,231,232,116,136, 0, 41,151,140,151,155,
- 151,160,151,165,151,176,151,188,151,211,151,216,225,236,244,239,
- 238,229,225,242,225,226,233, 99,128,253, 63,226,116,128,248,248,
- 229,120,128,248,247,233,238,230,229,242,233,239,114,128, 32,142,
- 237,239,238,239,243,240,225,227,101,128,255, 9,115, 2,151,194,
- 151,201,237,225,236,108,128,254, 90,245,240,229,242,233,239,114,
- 128, 32,126,244,112,128,248,246,246,229,242,244,233,227,225,108,
- 128,254, 54,244,233,225,236,228,233,230,102,128, 34, 2,115, 3,
- 151,246,152, 1,152, 13,229,241,232,229,226,242,229,119,128, 5,
- 192,232,244,225,232,229,226,242,229,119,128, 5,153,241,245,225,
- 242,101,128, 51,169,244,225,104,134, 5,183,152, 39,152, 53,152,
- 58,152, 67,152, 82,152, 98, 49, 2,152, 45,152, 49, 49,128, 5,
- 183,100,128, 5,183,178, 97,128, 5,183,232,229,226,242,229,119,
- 128, 5,183,238,225,242,242,239,247,232,229,226,242,229,119,128,
- 5,183,241,245,225,242,244,229,242,232,229,226,242,229,119,128,
- 5,183,247,233,228,229,232,229,226,242,229,119,128, 5,183,250,
- 229,242,232,229,226,242,229,119,128, 5,161,226,239,240,239,237,
- 239,230,111,128, 49, 6,227,233,242,227,236,101,128, 36,223,228,
- 239,244,225,227,227,229,238,116,128, 30, 87,101,137, 5,228,152,
- 177,152,188,152,208,152,220,152,240,153, 86,153, 97,153,118,154,
- 73,227,249,242,233,236,236,233, 99,128, 4, 63,228,225,231,229,
- 243,104,129,251, 68,152,199,232,229,226,242,229,119,128,251, 68,
- 229,250,233,243,241,245,225,242,101,128, 51, 59,230,233,238,225,
- 236,228,225,231,229,243,232,232,229,226,242,229,119,128,251, 67,
- 104, 5,152,252,153, 19,153, 27,153, 41,153, 71,225,114, 2,153,
- 3,153, 10,225,226,233, 99,128, 6,126,237,229,238,233,225,110,
- 128, 5,122,229,226,242,229,119,128, 5,228,230,233,238,225,236,
- 225,242,225,226,233, 99,128,251, 87,105, 2,153, 47,153, 62,238,
- 233,244,233,225,236,225,242,225,226,233, 99,128,251, 88,242,225,
- 231,225,238, 97,128, 48,122,237,229,228,233,225,236,225,242,225,
- 226,233, 99,128,251, 89,235,225,244,225,235,225,238, 97,128, 48,
- 218,237,233,228,228,236,229,232,239,239,235,227,249,242,233,236,
- 236,233, 99,128, 4,167,114, 5,153,130,153,142,153,184,154, 49,
- 154, 62,225,230,229,232,229,226,242,229,119,128,251, 78,227,229,
- 238,116,131, 0, 37,153,155,153,164,153,176,225,242,225,226,233,
- 99,128, 6,106,237,239,238,239,243,240,225,227,101,128,255, 5,
- 243,237,225,236,108,128,254,106,105, 2,153,190,154, 31,239,100,
- 134, 0, 46,153,207,153,218,153,229,153,241,153,252,154, 8,225,
- 242,237,229,238,233,225,110,128, 5,137,227,229,238,244,229,242,
- 229,100,128, 0,183,232,225,236,230,247,233,228,244,104,128,255,
- 97,233,238,230,229,242,233,239,114,128,246,231,237,239,238,239,
- 243,240,225,227,101,128,255, 14,115, 2,154, 14,154, 21,237,225,
- 236,108,128,254, 82,245,240,229,242,233,239,114,128,246,232,243,
- 240,239,237,229,238,233,231,242,229,229,235,227,237, 98,128, 3,
- 66,240,229,238,228,233,227,245,236,225,114,128, 34,165,244,232,
- 239,245,243,225,238,100,128, 32, 48,243,229,244, 97,128, 32,167,
- 230,243,241,245,225,242,101,128, 51,138,104, 3,154, 98,154,148,
- 155, 29, 97, 3,154,106,154,116,154,123,226,229,238,231,225,236,
- 105,128, 9,171,228,229,246, 97,128, 9, 43,231,117, 2,154,130,
- 154,139,234,225,242,225,244,105,128, 10,171,242,237,245,235,232,
- 105,128, 10, 43,105,133, 3,198,154,162,154,166,154,252,155, 4,
- 155, 15, 49,128, 3,213,229,245,240,104, 4,154,179,154,214,154,
- 229,154,238, 97, 2,154,185,154,200,227,233,242,227,236,229,235,
- 239,242,229,225,110,128, 50,122,240,225,242,229,238,235,239,242,
- 229,225,110,128, 50, 26,227,233,242,227,236,229,235,239,242,229,
- 225,110,128, 50,108,235,239,242,229,225,110,128, 49, 77,240,225,
- 242,229,238,235,239,242,229,225,110,128, 50, 12,236,225,244,233,
- 110,128, 2,120,238,244,232,245,244,232,225,105,128, 14, 58,243,
- 249,237,226,239,236,231,242,229,229,107,128, 3,213,111, 3,155,
- 37,155, 42,155, 68,239,107,128, 1,165,240,104, 2,155, 49,155,
- 58,225,238,244,232,225,105,128, 14, 30,245,238,231,244,232,225,
- 105,128, 14, 28,243,225,237,240,232,225,239,244,232,225,105,128,
- 14, 32,105,133, 3,192,155, 96,156, 52,156, 63,156, 74,156, 88,
- 229,245,112, 6,155,112,155,147,155,179,155,207,155,221,156, 17,
- 97, 2,155,118,155,133,227,233,242,227,236,229,235,239,242,229,
- 225,110,128, 50,115,240,225,242,229,238,235,239,242,229,225,110,
- 128, 50, 19,227,105, 2,155,154,155,166,229,245,227,235,239,242,
- 229,225,110,128, 49,118,242,227,236,229,235,239,242,229,225,110,
- 128, 50,101,107, 2,155,185,155,199,233,249,229,239,235,235,239,
- 242,229,225,110,128, 49,114,239,242,229,225,110,128, 49, 66,240,
- 225,242,229,238,235,239,242,229,225,110,128, 50, 5,243,233,239,
- 115, 2,155,230,156, 2,107, 2,155,236,155,250,233,249,229,239,
- 235,235,239,242,229,225,110,128, 49,116,239,242,229,225,110,128,
- 49, 68,244,233,235,229,245,244,235,239,242,229,225,110,128, 49,
- 117,116, 2,156, 23,156, 38,232,233,229,245,244,232,235,239,242,
- 229,225,110,128, 49,119,233,235,229,245,244,235,239,242,229,225,
- 110,128, 49,115,232,233,242,225,231,225,238, 97,128, 48,116,235,
- 225,244,225,235,225,238, 97,128, 48,212,243,249,237,226,239,236,
- 231,242,229,229,107,128, 3,214,247,242,225,242,237,229,238,233,
- 225,110,128, 5,131,236,245,115,132, 0, 43,156,115,156,126,156,
- 135,156,168,226,229,236,239,247,227,237, 98,128, 3, 31,227,233,
- 242,227,236,101,128, 34,149,109, 2,156,141,156,148,233,238,245,
- 115,128, 0,177,111, 2,156,154,156,158,100,128, 2,214,238,239,
- 243,240,225,227,101,128,255, 11,115, 2,156,174,156,181,237,225,
- 236,108,128,254, 98,245,240,229,242,233,239,114,128, 32,122,109,
- 2,156,197,156,208,239,238,239,243,240,225,227,101,128,255, 80,
- 243,241,245,225,242,101,128, 51,216,111, 5,156,229,156,240,157,
- 51,157, 62,157, 72,232,233,242,225,231,225,238, 97,128, 48,125,
- 233,238,244,233,238,231,233,238,228,229,120, 4,157, 4,157, 16,
- 157, 28,157, 41,228,239,247,238,247,232,233,244,101,128, 38, 31,
- 236,229,230,244,247,232,233,244,101,128, 38, 28,242,233,231,232,
- 244,247,232,233,244,101,128, 38, 30,245,240,247,232,233,244,101,
- 128, 38, 29,235,225,244,225,235,225,238, 97,128, 48,221,240,236,
- 225,244,232,225,105,128, 14, 27,243,244,225,236,237,225,242,107,
- 129, 48, 18,157, 85,230,225,227,101,128, 48, 32,240,225,242,229,
- 110,128, 36,171,114, 3,157,108,157,134,157,159,101, 2,157,114,
- 157,122,227,229,228,229,115,128, 34,122,243,227,242,233,240,244,
- 233,239,110,128, 33, 30,233,237,101, 2,157,142,157,148,237,239,
- 100,128, 2,185,242,229,246,229,242,243,229,100,128, 32, 53,111,
- 4,157,169,157,176,157,186,157,199,228,245,227,116,128, 34, 15,
- 234,229,227,244,233,246,101,128, 35, 5,236,239,238,231,229,228,
- 235,225,238, 97,128, 48,252,112, 2,157,205,157,242,101, 2,157,
- 211,157,218,236,236,239,114,128, 35, 24,242,243,117, 2,157,226,
- 157,233,226,243,229,116,128, 34,130,240,229,242,243,229,116,128,
- 34,131,239,242,244,233,239,110,129, 34, 55,157,253,225,108,128,
- 34, 29,115, 2,158, 8,158, 51,105,130, 3,200,158, 16,158, 27,
- 227,249,242,233,236,236,233, 99,128, 4,113,236,233,240,238,229,
- 245,237,225,244,225,227,249,242,233,236,236,233,227,227,237, 98,
- 128, 4,134,243,241,245,225,242,101,128, 51,176,117, 2,158, 66,
- 158, 77,232,233,242,225,231,225,238, 97,128, 48,119,235,225,244,
- 225,235,225,238, 97,128, 48,215,246,243,241,245,225,242,101,128,
- 51,180,247,243,241,245,225,242,101,128, 51,186,113,136, 0,113,
- 158,128,159,177,159,188,159,197,159,204,159,216,159,254,160, 6,
- 97, 4,158,138,158,161,158,225,159,160,100, 2,158,144,158,150,
- 229,246, 97,128, 9, 88,237,225,232,229,226,242,229,119,128, 5,
- 168,102, 4,158,171,158,180,158,194,158,210,225,242,225,226,233,
- 99,128, 6, 66,230,233,238,225,236,225,242,225,226,233, 99,128,
- 254,214,233,238,233,244,233,225,236,225,242,225,226,233, 99,128,
- 254,215,237,229,228,233,225,236,225,242,225,226,233, 99,128,254,
- 216,237,225,244,115,136, 5,184,158,248,159, 12,159, 26,159, 31,
- 159, 36,159, 45,159, 60,159,147, 49, 3,159, 0,159, 4,159, 8,
- 48,128, 5,184, 97,128, 5,184, 99,128, 5,184, 50, 2,159, 18,
- 159, 22, 55,128, 5,184, 57,128, 5,184,179, 51,128, 5,184,228,
- 101,128, 5,184,232,229,226,242,229,119,128, 5,184,238,225,242,
- 242,239,247,232,229,226,242,229,119,128, 5,184,113, 2,159, 66,
- 159,132,225,244,225,110, 4,159, 79,159, 88,159,103,159,119,232,
- 229,226,242,229,119,128, 5,184,238,225,242,242,239,247,232,229,
- 226,242,229,119,128, 5,184,241,245,225,242,244,229,242,232,229,
- 226,242,229,119,128, 5,184,247,233,228,229,232,229,226,242,229,
- 119,128, 5,184,245,225,242,244,229,242,232,229,226,242,229,119,
- 128, 5,184,247,233,228,229,232,229,226,242,229,119,128, 5,184,
- 242,238,229,249,240,225,242,225,232,229,226,242,229,119,128, 5,
- 159,226,239,240,239,237,239,230,111,128, 49, 17,227,233,242,227,
- 236,101,128, 36,224,232,239,239,107,128, 2,160,237,239,238,239,
- 243,240,225,227,101,128,255, 81,239,102,130, 5,231,159,225,159,
- 245,228,225,231,229,243,104,129,251, 71,159,236,232,229,226,242,
- 229,119,128,251, 71,232,229,226,242,229,119,128, 5,231,240,225,
- 242,229,110,128, 36,172,117, 4,160, 16,160, 28,160,117,160,204,
- 225,242,244,229,242,238,239,244,101,128, 38,105,226,245,244,115,
- 135, 5,187,160, 49,160, 54,160, 59,160, 64,160, 73,160, 88,160,
- 104,177, 56,128, 5,187,178, 53,128, 5,187,179, 49,128, 5,187,
- 232,229,226,242,229,119,128, 5,187,238,225,242,242,239,247,232,
- 229,226,242,229,119,128, 5,187,241,245,225,242,244,229,242,232,
- 229,226,242,229,119,128, 5,187,247,233,228,229,232,229,226,242,
- 229,119,128, 5,187,229,243,244,233,239,110,133, 0, 63,160,136,
- 160,159,160,176,160,184,160,196,225,114, 2,160,143,160,150,225,
- 226,233, 99,128, 6, 31,237,229,238,233,225,110,128, 5, 94,228,
- 239,247,110,129, 0,191,160,168,243,237,225,236,108,128,247,191,
- 231,242,229,229,107,128, 3,126,237,239,238,239,243,240,225,227,
- 101,128,255, 31,243,237,225,236,108,128,247, 63,239,244,101, 4,
- 160,216,161, 31,161, 51,161, 80,228,226,108,133, 0, 34,160,232,
- 160,239,160,246,161, 2,161, 23,226,225,243,101,128, 32, 30,236,
- 229,230,116,128, 32, 28,237,239,238,239,243,240,225,227,101,128,
- 255, 2,240,242,233,237,101,129, 48, 30,161, 12,242,229,246,229,
- 242,243,229,100,128, 48, 29,242,233,231,232,116,128, 32, 29,236,
- 229,230,116,129, 32, 24,161, 40,242,229,246,229,242,243,229,100,
- 128, 32, 27,114, 2,161, 57,161, 67,229,246,229,242,243,229,100,
- 128, 32, 27,233,231,232,116,129, 32, 25,161, 76,110,128, 1, 73,
- 243,233,238,231,108, 2,161, 90,161, 97,226,225,243,101,128, 32,
- 26,101,129, 0, 39,161,103,237,239,238,239,243,240,225,227,101,
- 128,255, 7,114,145, 0,114,161,153,162,157,162,168,162,215,163,
- 10,164, 27,164, 51,164,146,166,180,166,217,166,229,167, 27,167,
- 35,167,197,167,208,167,243,168, 87, 97, 11,161,177,161,188,161,
- 198,161,205,162, 14,162, 30,162, 55,162, 66,162, 91,162,114,162,
- 151,225,242,237,229,238,233,225,110,128, 5,124,226,229,238,231,
- 225,236,105,128, 9,176,227,245,244,101,128, 1, 85,100, 4,161,
- 215,161,221,161,235,162, 5,229,246, 97,128, 9, 48,233,227,225,
- 108,129, 34, 26,161,230,229,120,128,248,229,239,246,229,242,243,
- 243,241,245,225,242,101,129, 51,174,161,251,228,243,241,245,225,
- 242,101,128, 51,175,243,241,245,225,242,101,128, 51,173,230,101,
- 129, 5,191,162, 21,232,229,226,242,229,119,128, 5,191,231,117,
- 2,162, 37,162, 46,234,225,242,225,244,105,128, 10,176,242,237,
- 245,235,232,105,128, 10, 48,232,233,242,225,231,225,238, 97,128,
- 48,137,235,225,244,225,235,225,238, 97,129, 48,233,162, 79,232,
- 225,236,230,247,233,228,244,104,128,255,151,236,239,247,229,242,
- 228,233,225,231,239,238,225,236,226,229,238,231,225,236,105,128,
- 9,241,109, 2,162,120,162,143,233,228,228,236,229,228,233,225,
- 231,239,238,225,236,226,229,238,231,225,236,105,128, 9,240,243,
- 232,239,242,110,128, 2,100,244,233,111,128, 34, 54,226,239,240,
- 239,237,239,230,111,128, 49, 22, 99, 4,162,178,162,185,162,194,
- 162,202,225,242,239,110,128, 1, 89,229,228,233,236,236, 97,128,
- 1, 87,233,242,227,236,101,128, 36,225,239,237,237,225,225,227,
- 227,229,238,116,128, 1, 87,100, 2,162,221,162,231,226,236,231,
- 242,225,246,101,128, 2, 17,239,116, 2,162,238,162,247,225,227,
- 227,229,238,116,128, 30, 89,226,229,236,239,119,129, 30, 91,163,
- 1,237,225,227,242,239,110,128, 30, 93,101, 6,163, 24,163, 69,
- 163,104,163,159,163,184,163,217,102, 2,163, 30,163, 43,229,242,
- 229,238,227,229,237,225,242,107,128, 32, 59,236,229,248,243,117,
- 2,163, 53,163, 60,226,243,229,116,128, 34,134,240,229,242,243,
- 229,116,128, 34,135,231,233,243,244,229,114, 2,163, 80,163, 85,
- 229,100,128, 0,174,115, 2,163, 91,163, 97,225,238,115,128,248,
- 232,229,242,233,102,128,246,218,104, 3,163,112,163,135,163,149,
- 225,114, 2,163,119,163,126,225,226,233, 99,128, 6, 49,237,229,
- 238,233,225,110,128, 5,128,230,233,238,225,236,225,242,225,226,
- 233, 99,128,254,174,233,242,225,231,225,238, 97,128, 48,140,235,
- 225,244,225,235,225,238, 97,129, 48,236,163,172,232,225,236,230,
- 247,233,228,244,104,128,255,154,243,104,130, 5,232,163,193,163,
- 208,228,225,231,229,243,232,232,229,226,242,229,119,128,251, 72,
- 232,229,226,242,229,119,128, 5,232,118, 3,163,225,163,238,164,
- 14,229,242,243,229,228,244,233,236,228,101,128, 34, 61,233, 97,
- 2,163,245,163,254,232,229,226,242,229,119,128, 5,151,237,245,
- 231,242,225,243,232,232,229,226,242,229,119,128, 5,151,236,239,
- 231,233,227,225,236,238,239,116,128, 35, 16,230,233,243,232,232,
- 239,239,107,129, 2,126,164, 40,242,229,246,229,242,243,229,100,
- 128, 2,127,104, 2,164, 57,164, 80, 97, 2,164, 63,164, 73,226,
- 229,238,231,225,236,105,128, 9,221,228,229,246, 97,128, 9, 93,
- 111,131, 3,193,164, 90,164,119,164,133,239,107,129, 2,125,164,
- 97,244,245,242,238,229,100,129, 2,123,164,108,243,245,240,229,
- 242,233,239,114,128, 2,181,243,249,237,226,239,236,231,242,229,
- 229,107,128, 3,241,244,233,227,232,239,239,235,237,239,100,128,
- 2,222,105, 6,164,160,165,204,165,250,166, 5,166, 30,166,166,
- 229,245,108, 9,164,182,164,217,164,232,164,246,165, 36,165, 50,
- 165,136,165,149,165,184, 97, 2,164,188,164,203,227,233,242,227,
- 236,229,235,239,242,229,225,110,128, 50,113,240,225,242,229,238,
- 235,239,242,229,225,110,128, 50, 17,227,233,242,227,236,229,235,
- 239,242,229,225,110,128, 50, 99,232,233,229,245,232,235,239,242,
- 229,225,110,128, 49, 64,107, 2,164,252,165, 28,233,249,229,239,
- 107, 2,165, 6,165, 15,235,239,242,229,225,110,128, 49, 58,243,
- 233,239,243,235,239,242,229,225,110,128, 49,105,239,242,229,225,
- 110,128, 49, 57,237,233,229,245,237,235,239,242,229,225,110,128,
- 49, 59,112, 3,165, 58,165, 90,165,105, 97, 2,165, 64,165, 78,
- 238,243,233,239,243,235,239,242,229,225,110,128, 49,108,242,229,
- 238,235,239,242,229,225,110,128, 50, 3,232,233,229,245,240,232,
- 235,239,242,229,225,110,128, 49, 63,233,229,245,112, 2,165,114,
- 165,123,235,239,242,229,225,110,128, 49, 60,243,233,239,243,235,
- 239,242,229,225,110,128, 49,107,243,233,239,243,235,239,242,229,
- 225,110,128, 49, 61,116, 2,165,155,165,170,232,233,229,245,244,
- 232,235,239,242,229,225,110,128, 49, 62,233,235,229,245,244,235,
- 239,242,229,225,110,128, 49,106,249,229,239,242,233,238,232,233,
- 229,245,232,235,239,242,229,225,110,128, 49,109,231,232,116, 2,
- 165,212,165,220,225,238,231,236,101,128, 34, 31,116, 2,165,226,
- 165,240,225,227,235,226,229,236,239,247,227,237, 98,128, 3, 25,
- 242,233,225,238,231,236,101,128, 34,191,232,233,242,225,231,225,
- 238, 97,128, 48,138,235,225,244,225,235,225,238, 97,129, 48,234,
- 166, 18,232,225,236,230,247,233,228,244,104,128,255,152,110, 2,
- 166, 36,166,152,103,131, 2,218,166, 46,166, 57,166, 63,226,229,
- 236,239,247,227,237, 98,128, 3, 37,227,237, 98,128, 3, 10,232,
- 225,236,102, 2,166, 72,166,118,236,229,230,116,131, 2,191,166,
- 85,166, 96,166,107,225,242,237,229,238,233,225,110,128, 5, 89,
- 226,229,236,239,247,227,237, 98,128, 3, 28,227,229,238,244,229,
- 242,229,100,128, 2,211,242,233,231,232,116,130, 2,190,166,130,
- 166,141,226,229,236,239,247,227,237, 98,128, 3, 57,227,229,238,
- 244,229,242,229,100,128, 2,210,246,229,242,244,229,228,226,242,
- 229,246,101,128, 2, 19,244,244,239,242,245,243,241,245,225,242,
- 101,128, 51, 81,108, 2,166,186,166,197,233,238,229,226,229,236,
- 239,119,128, 30, 95,239,238,231,236,229,103,129, 2,124,166,208,
- 244,245,242,238,229,100,128, 2,122,237,239,238,239,243,240,225,
- 227,101,128,255, 82,111, 3,166,237,166,248,167, 17,232,233,242,
- 225,231,225,238, 97,128, 48,141,235,225,244,225,235,225,238, 97,
- 129, 48,237,167, 5,232,225,236,230,247,233,228,244,104,128,255,
- 155,242,245,225,244,232,225,105,128, 14, 35,240,225,242,229,110,
- 128, 36,173,114, 3,167, 43,167, 79,167,109, 97, 3,167, 51,167,
- 61,167, 68,226,229,238,231,225,236,105,128, 9,220,228,229,246,
- 97,128, 9, 49,231,245,242,237,245,235,232,105,128, 10, 92,229,
- 104, 2,167, 86,167, 95,225,242,225,226,233, 99,128, 6,145,230,
- 233,238,225,236,225,242,225,226,233, 99,128,251,141,246,239,227,
- 225,236,233, 99, 4,167,125,167,135,167,142,167,153,226,229,238,
- 231,225,236,105,128, 9,224,228,229,246, 97,128, 9, 96,231,245,
- 234,225,242,225,244,105,128, 10,224,246,239,247,229,236,243,233,
- 231,110, 3,167,169,167,179,167,186,226,229,238,231,225,236,105,
- 128, 9,196,228,229,246, 97,128, 9, 68,231,245,234,225,242,225,
- 244,105,128, 10,196,243,245,240,229,242,233,239,114,128,246,241,
- 116, 2,167,214,167,222,226,236,239,227,107,128, 37,144,245,242,
- 238,229,100,129, 2,121,167,232,243,245,240,229,242,233,239,114,
- 128, 2,180,117, 4,167,253,168, 8,168, 33,168, 80,232,233,242,
- 225,231,225,238, 97,128, 48,139,235,225,244,225,235,225,238, 97,
- 129, 48,235,168, 21,232,225,236,230,247,233,228,244,104,128,255,
- 153,112, 2,168, 39,168, 74,229,101, 2,168, 46,168, 60,237,225,
- 242,235,226,229,238,231,225,236,105,128, 9,242,243,233,231,238,
- 226,229,238,231,225,236,105,128, 9,243,233,225,104,128,246,221,
- 244,232,225,105,128, 14, 36,246,239,227,225,236,233, 99, 4,168,
- 103,168,113,168,120,168,131,226,229,238,231,225,236,105,128, 9,
- 139,228,229,246, 97,128, 9, 11,231,245,234,225,242,225,244,105,
- 128, 10,139,246,239,247,229,236,243,233,231,110, 3,168,147,168,
- 157,168,164,226,229,238,231,225,236,105,128, 9,195,228,229,246,
- 97,128, 9, 67,231,245,234,225,242,225,244,105,128, 10,195,115,
- 147, 0,115,168,217,170,187,170,198,171, 68,171,107,174, 49,174,
- 60,176,203,179, 85,179,131,179,158,180, 93,180,160,181,193,181,
- 203,182,133,182,206,183,120,183,130, 97, 9,168,237,168,247,169,
- 12,169, 84,169,109,169,120,169,145,169,177,169,217,226,229,238,
- 231,225,236,105,128, 9,184,227,245,244,101,129, 1, 91,169, 0,
- 228,239,244,225,227,227,229,238,116,128, 30,101,100, 5,169, 24,
- 169, 33,169, 39,169, 53,169, 69,225,242,225,226,233, 99,128, 6,
- 53,229,246, 97,128, 9, 56,230,233,238,225,236,225,242,225,226,
- 233, 99,128,254,186,233,238,233,244,233,225,236,225,242,225,226,
- 233, 99,128,254,187,237,229,228,233,225,236,225,242,225,226,233,
- 99,128,254,188,231,117, 2,169, 91,169,100,234,225,242,225,244,
- 105,128, 10,184,242,237,245,235,232,105,128, 10, 56,232,233,242,
- 225,231,225,238, 97,128, 48, 85,235,225,244,225,235,225,238, 97,
- 129, 48,181,169,133,232,225,236,230,247,233,228,244,104,128,255,
- 123,236,236,225,236,236,225,232,239,245,225,236,225,249,232,229,
- 247,225,243,225,236,236,225,237,225,242,225,226,233, 99,128,253,
- 250,237,229,235,104,130, 5,225,169,188,169,208,228,225,231,229,
- 243,104,129,251, 65,169,199,232,229,226,242,229,119,128,251, 65,
- 232,229,226,242,229,119,128, 5,225,242, 97, 5,169,230,170, 48,
- 170, 56,170,106,170,114, 97, 5,169,242,169,250,170, 2,170, 33,
- 170, 41,225,244,232,225,105,128, 14, 50,229,244,232,225,105,128,
- 14, 65,233,237,225,233,109, 2,170, 12,170, 23,225,236,225,233,
- 244,232,225,105,128, 14, 68,245,225,238,244,232,225,105,128, 14,
- 67,237,244,232,225,105,128, 14, 51,244,232,225,105,128, 14, 48,
- 229,244,232,225,105,128, 14, 64,105, 3,170, 64,170, 88,170, 99,
- 105, 2,170, 70,170, 81,236,229,230,244,244,232,225,105,128,248,
- 134,244,232,225,105,128, 14, 53,236,229,230,244,244,232,225,105,
- 128,248,133,244,232,225,105,128, 14, 52,239,244,232,225,105,128,
- 14, 66,117, 3,170,122,170,172,170,179,101, 3,170,130,170,154,
- 170,165,101, 2,170,136,170,147,236,229,230,244,244,232,225,105,
- 128,248,136,244,232,225,105,128, 14, 55,236,229,230,244,244,232,
- 225,105,128,248,135,244,232,225,105,128, 14, 54,244,232,225,105,
- 128, 14, 56,245,244,232,225,105,128, 14, 57,226,239,240,239,237,
- 239,230,111,128, 49, 25, 99, 5,170,210,170,231,170,240,171, 33,
- 171, 55,225,242,239,110,129, 1, 97,170,219,228,239,244,225,227,
- 227,229,238,116,128, 30,103,229,228,233,236,236, 97,128, 1, 95,
- 232,247, 97,131, 2, 89,170,252,171, 7,171, 26,227,249,242,233,
- 236,236,233, 99,128, 4,217,228,233,229,242,229,243,233,243,227,
- 249,242,233,236,236,233, 99,128, 4,219,232,239,239,107,128, 2,
- 90,233,242, 99, 2,171, 41,171, 46,236,101,128, 36,226,245,237,
- 230,236,229,120,128, 1, 93,239,237,237,225,225,227,227,229,238,
- 116,128, 2, 25,228,239,116, 2,171, 76,171, 85,225,227,227,229,
- 238,116,128, 30, 97,226,229,236,239,119,129, 30, 99,171, 95,228,
- 239,244,225,227,227,229,238,116,128, 30,105,101, 9,171,127,171,
- 143,171,178,171,243,172, 90,172,117,172,142,172,223,172,250,225,
- 231,245,236,236,226,229,236,239,247,227,237, 98,128, 3, 60, 99,
- 2,171,149,171,171,239,238,100,129, 32, 51,171,157,244,239,238,
- 229,227,232,233,238,229,243,101,128, 2,202,244,233,239,110,128,
- 0,167,229,110, 4,171,189,171,198,171,212,171,228,225,242,225,
- 226,233, 99,128, 6, 51,230,233,238,225,236,225,242,225,226,233,
- 99,128,254,178,233,238,233,244,233,225,236,225,242,225,226,233,
- 99,128,254,179,237,229,228,233,225,236,225,242,225,226,233, 99,
- 128,254,180,231,239,108,135, 5,182,172, 7,172, 21,172, 26,172,
- 35,172, 50,172, 66,172, 77, 49, 2,172, 13,172, 17, 51,128, 5,
- 182,102,128, 5,182,178, 99,128, 5,182,232,229,226,242,229,119,
- 128, 5,182,238,225,242,242,239,247,232,229,226,242,229,119,128,
- 5,182,241,245,225,242,244,229,242,232,229,226,242,229,119,128,
- 5,182,244,225,232,229,226,242,229,119,128, 5,146,247,233,228,
- 229,232,229,226,242,229,119,128, 5,182,104, 2,172, 96,172,107,
- 225,242,237,229,238,233,225,110,128, 5,125,233,242,225,231,225,
- 238, 97,128, 48, 91,235,225,244,225,235,225,238, 97,129, 48,187,
- 172,130,232,225,236,230,247,233,228,244,104,128,255,126,237,105,
- 2,172,149,172,192,227,239,236,239,110,131, 0, 59,172,163,172,
- 172,172,184,225,242,225,226,233, 99,128, 6, 27,237,239,238,239,
- 243,240,225,227,101,128,255, 27,243,237,225,236,108,128,254, 84,
- 246,239,233,227,229,228,237,225,242,235,235,225,238, 97,129, 48,
- 156,172,211,232,225,236,230,247,233,228,244,104,128,255,159,238,
- 116, 2,172,230,172,240,233,243,241,245,225,242,101,128, 51, 34,
- 239,243,241,245,225,242,101,128, 51, 35,246,229,110,142, 0, 55,
- 173, 28,173, 37,173, 47,173, 77,173, 84,173, 94,173,119,173,146,
- 173,180,173,192,173,203,173,236,173,244,173,255,225,242,225,226,
- 233, 99,128, 6,103,226,229,238,231,225,236,105,128, 9,237,227,
- 233,242,227,236,101,129, 36,102,173, 58,233,238,246,229,242,243,
- 229,243,225,238,243,243,229,242,233,102,128, 39,144,228,229,246,
- 97,128, 9,109,229,233,231,232,244,232,115,128, 33, 94,231,117,
- 2,173,101,173,110,234,225,242,225,244,105,128, 10,237,242,237,
- 245,235,232,105,128, 10,109,232, 97, 2,173,126,173,137,227,235,
- 225,242,225,226,233, 99,128, 6,103,238,231,250,232,239,117,128,
- 48, 39,105, 2,173,152,173,170,228,229,239,231,242,225,240,232,
- 233,227,240,225,242,229,110,128, 50, 38,238,230,229,242,233,239,
- 114,128, 32,135,237,239,238,239,243,240,225,227,101,128,255, 23,
- 239,236,228,243,244,249,236,101,128,247, 55,112, 2,173,209,173,
- 216,225,242,229,110,128, 36,122,229,114, 2,173,223,173,229,233,
- 239,100,128, 36,142,243,233,225,110,128, 6,247,242,239,237,225,
- 110,128, 33,118,243,245,240,229,242,233,239,114,128, 32,119,116,
- 2,174, 5,174, 43,229,229,110, 2,174, 13,174, 22,227,233,242,
- 227,236,101,128, 36,112,112, 2,174, 28,174, 35,225,242,229,110,
- 128, 36,132,229,242,233,239,100,128, 36,152,232,225,105,128, 14,
- 87,230,244,232,249,240,232,229,110,128, 0,173,104, 7,174, 76,
- 175, 50,175, 61,175, 75,176, 20,176, 33,176,197, 97, 6,174, 90,
- 174,101,174,111,174,122,175, 9,175, 34,225,242,237,229,238,233,
- 225,110,128, 5,119,226,229,238,231,225,236,105,128, 9,182,227,
- 249,242,233,236,236,233, 99,128, 4, 72,100, 2,174,128,174,224,
- 228, 97, 4,174,139,174,148,174,179,174,193,225,242,225,226,233,
- 99,128, 6, 81,228,225,237,237, 97, 2,174,158,174,167,225,242,
- 225,226,233, 99,128,252, 97,244,225,238,225,242,225,226,233, 99,
- 128,252, 94,230,225,244,232,225,225,242,225,226,233, 99,128,252,
- 96,235,225,243,242, 97, 2,174,203,174,212,225,242,225,226,233,
- 99,128,252, 98,244,225,238,225,242,225,226,233, 99,128,252, 95,
- 101,132, 37,146,174,236,174,243,174,251,175, 4,228,225,242,107,
- 128, 37,147,236,233,231,232,116,128, 37,145,237,229,228,233,245,
- 109,128, 37,146,246, 97,128, 9, 54,231,117, 2,175, 16,175, 25,
- 234,225,242,225,244,105,128, 10,182,242,237,245,235,232,105,128,
- 10, 54,236,243,232,229,236,229,244,232,229,226,242,229,119,128,
- 5,147,226,239,240,239,237,239,230,111,128, 49, 21,227,232,225,
- 227,249,242,233,236,236,233, 99,128, 4, 73,101, 4,175, 85,175,
- 150,175,160,175,177,229,110, 4,175, 96,175,105,175,119,175,135,
- 225,242,225,226,233, 99,128, 6, 52,230,233,238,225,236,225,242,
- 225,226,233, 99,128,254,182,233,238,233,244,233,225,236,225,242,
- 225,226,233, 99,128,254,183,237,229,228,233,225,236,225,242,225,
- 226,233, 99,128,254,184,233,227,239,240,244,233, 99,128, 3,227,
- 241,229,108,129, 32,170,175,168,232,229,226,242,229,119,128, 32,
- 170,246, 97,134, 5,176,175,194,175,209,175,223,175,232,175,247,
- 176, 7, 49, 2,175,200,175,205,177, 53,128, 5,176, 53,128, 5,
- 176, 50, 2,175,215,175,219, 50,128, 5,176,101,128, 5,176,232,
- 229,226,242,229,119,128, 5,176,238,225,242,242,239,247,232,229,
- 226,242,229,119,128, 5,176,241,245,225,242,244,229,242,232,229,
- 226,242,229,119,128, 5,176,247,233,228,229,232,229,226,242,229,
- 119,128, 5,176,232,225,227,249,242,233,236,236,233, 99,128, 4,
- 187,105, 2,176, 39,176, 50,237,225,227,239,240,244,233, 99,128,
- 3,237,110,131, 5,233,176, 60,176,143,176,152,100, 2,176, 66,
- 176,132,225,231,229,243,104,130,251, 73,176, 78,176, 87,232,229,
- 226,242,229,119,128,251, 73,115, 2,176, 93,176,113,232,233,238,
- 228,239,116,129,251, 44,176,104,232,229,226,242,229,119,128,251,
- 44,233,238,228,239,116,129,251, 45,176,123,232,229,226,242,229,
- 119,128,251, 45,239,244,232,229,226,242,229,119,128, 5,193,232,
- 229,226,242,229,119,128, 5,233,115, 2,176,158,176,178,232,233,
- 238,228,239,116,129,251, 42,176,169,232,229,226,242,229,119,128,
- 251, 42,233,238,228,239,116,129,251, 43,176,188,232,229,226,242,
- 229,119,128,251, 43,239,239,107,128, 2,130,105, 8,176,221,177,
- 9,177, 20,177, 45,177, 75,177, 83,177, 96,178, 11,231,237, 97,
- 131, 3,195,176,233,176,237,176,245, 49,128, 3,194,230,233,238,
- 225,108,128, 3,194,236,245,238,225,244,229,243,249,237,226,239,
- 236,231,242,229,229,107,128, 3,242,232,233,242,225,231,225,238,
- 97,128, 48, 87,235,225,244,225,235,225,238, 97,129, 48,183,177,
- 33,232,225,236,230,247,233,228,244,104,128,255,124,236,245,113,
- 2,177, 53,177, 62,232,229,226,242,229,119,128, 5,189,236,229,
- 230,244,232,229,226,242,229,119,128, 5,189,237,233,236,225,114,
- 128, 34, 60,238,228,239,244,232,229,226,242,229,119,128, 5,194,
- 239,115, 6,177,111,177,146,177,178,177,206,177,220,177,252, 97,
- 2,177,117,177,132,227,233,242,227,236,229,235,239,242,229,225,
- 110,128, 50,116,240,225,242,229,238,235,239,242,229,225,110,128,
- 50, 20,227,105, 2,177,153,177,165,229,245,227,235,239,242,229,
- 225,110,128, 49,126,242,227,236,229,235,239,242,229,225,110,128,
- 50,102,107, 2,177,184,177,198,233,249,229,239,235,235,239,242,
- 229,225,110,128, 49,122,239,242,229,225,110,128, 49, 69,238,233,
- 229,245,238,235,239,242,229,225,110,128, 49,123,112, 2,177,226,
- 177,239,225,242,229,238,235,239,242,229,225,110,128, 50, 6,233,
- 229,245,240,235,239,242,229,225,110,128, 49,125,244,233,235,229,
- 245,244,235,239,242,229,225,110,128, 49,124,120,141, 0, 54,178,
- 41,178, 50,178, 60,178, 90,178, 97,178,122,178,149,178,183,178,
- 195,178,206,178,239,178,247,179, 2,225,242,225,226,233, 99,128,
- 6,102,226,229,238,231,225,236,105,128, 9,236,227,233,242,227,
- 236,101,129, 36,101,178, 71,233,238,246,229,242,243,229,243,225,
- 238,243,243,229,242,233,102,128, 39,143,228,229,246, 97,128, 9,
- 108,231,117, 2,178,104,178,113,234,225,242,225,244,105,128, 10,
- 236,242,237,245,235,232,105,128, 10,108,232, 97, 2,178,129,178,
- 140,227,235,225,242,225,226,233, 99,128, 6,102,238,231,250,232,
- 239,117,128, 48, 38,105, 2,178,155,178,173,228,229,239,231,242,
- 225,240,232,233,227,240,225,242,229,110,128, 50, 37,238,230,229,
- 242,233,239,114,128, 32,134,237,239,238,239,243,240,225,227,101,
- 128,255, 22,239,236,228,243,244,249,236,101,128,247, 54,112, 2,
- 178,212,178,219,225,242,229,110,128, 36,121,229,114, 2,178,226,
- 178,232,233,239,100,128, 36,141,243,233,225,110,128, 6,246,242,
- 239,237,225,110,128, 33,117,243,245,240,229,242,233,239,114,128,
- 32,118,116, 2,179, 8,179, 79,229,229,110, 2,179, 16,179, 58,
- 99, 2,179, 22,179, 30,233,242,227,236,101,128, 36,111,245,242,
- 242,229,238,227,249,228,229,238,239,237,233,238,225,244,239,242,
- 226,229,238,231,225,236,105,128, 9,249,112, 2,179, 64,179, 71,
- 225,242,229,110,128, 36,131,229,242,233,239,100,128, 36,151,232,
- 225,105,128, 14, 86,108, 2,179, 91,179,111,225,243,104,129, 0,
- 47,179, 99,237,239,238,239,243,240,225,227,101,128,255, 15,239,
- 238,103,129, 1,127,179,119,228,239,244,225,227,227,229,238,116,
- 128, 30,155,109, 2,179,137,179,147,233,236,229,230,225,227,101,
- 128, 38, 58,239,238,239,243,240,225,227,101,128,255, 83,111, 6,
- 179,172,179,222,179,233,180, 2,180, 47,180, 58,102, 2,179,178,
- 179,192,240,225,243,245,241,232,229,226,242,229,119,128, 5,195,
- 116, 2,179,198,179,207,232,249,240,232,229,110,128, 0,173,243,
- 233,231,238,227,249,242,233,236,236,233, 99,128, 4, 76,232,233,
- 242,225,231,225,238, 97,128, 48, 93,235,225,244,225,235,225,238,
- 97,129, 48,189,179,246,232,225,236,230,247,233,228,244,104,128,
- 255,127,236,233,228,245,115, 2,180, 12,180, 29,236,239,238,231,
- 239,246,229,242,236,225,249,227,237, 98,128, 3, 56,243,232,239,
- 242,244,239,246,229,242,236,225,249,227,237, 98,128, 3, 55,242,
- 245,243,233,244,232,225,105,128, 14, 41,115, 3,180, 66,180, 76,
- 180, 84,225,236,225,244,232,225,105,128, 14, 40,239,244,232,225,
- 105,128, 14, 11,245,225,244,232,225,105,128, 14, 42,240, 97, 3,
- 180,102,180,122,180,154,227,101,129, 0, 32,180,109,232,225,227,
- 235,225,242,225,226,233, 99,128, 0, 32,228,101,129, 38, 96,180,
- 129,243,245,233,116, 2,180,138,180,146,226,236,225,227,107,128,
- 38, 96,247,232,233,244,101,128, 38,100,242,229,110,128, 36,174,
- 241,245,225,242,101, 11,180,188,180,199,180,213,180,238,180,255,
- 181, 25,181, 40,181, 73,181,100,181,156,181,171,226,229,236,239,
- 247,227,237, 98,128, 3, 59, 99, 2,180,205,180,209, 99,128, 51,
- 196,109,128, 51,157,228,233,225,231,239,238,225,236,227,242,239,
- 243,243,232,225,244,227,232,230,233,236,108,128, 37,169,232,239,
- 242,233,250,239,238,244,225,236,230,233,236,108,128, 37,164,107,
- 2,181, 5,181, 9,103,128, 51,143,109,129, 51,158,181, 15,227,
- 225,240,233,244,225,108,128, 51,206,108, 2,181, 31,181, 35,110,
- 128, 51,209,239,103,128, 51,210,109, 4,181, 50,181, 54,181, 59,
- 181, 63,103,128, 51,142,233,108,128, 51,213,109,128, 51,156,243,
- 241,245,225,242,229,100,128, 51,161,239,242,244,232,239,231,239,
- 238,225,236,227,242,239,243,243,232,225,244,227,232,230,233,236,
- 108,128, 37,166,245,240,240,229,114, 2,181,110,181,133,236,229,
- 230,244,244,239,236,239,247,229,242,242,233,231,232,244,230,233,
- 236,108,128, 37,167,242,233,231,232,244,244,239,236,239,247,229,
- 242,236,229,230,244,230,233,236,108,128, 37,168,246,229,242,244,
- 233,227,225,236,230,233,236,108,128, 37,165,247,232,233,244,229,
- 247,233,244,232,243,237,225,236,236,226,236,225,227,107,128, 37,
- 163,242,243,241,245,225,242,101,128, 51,219,115, 2,181,209,182,
- 123, 97, 4,181,219,181,229,181,236,181,247,226,229,238,231,225,
- 236,105,128, 9,183,228,229,246, 97,128, 9, 55,231,245,234,225,
- 242,225,244,105,128, 10,183,238,103, 8,182, 10,182, 24,182, 38,
- 182, 52,182, 67,182, 81,182, 95,182,108,227,233,229,245,227,235,
- 239,242,229,225,110,128, 49, 73,232,233,229,245,232,235,239,242,
- 229,225,110,128, 49,133,233,229,245,238,231,235,239,242,229,225,
- 110,128, 49,128,235,233,249,229,239,235,235,239,242,229,225,110,
- 128, 49, 50,238,233,229,245,238,235,239,242,229,225,110,128, 49,
- 101,240,233,229,245,240,235,239,242,229,225,110,128, 49, 67,243,
- 233,239,243,235,239,242,229,225,110,128, 49, 70,244,233,235,229,
- 245,244,235,239,242,229,225,110,128, 49, 56,245,240,229,242,233,
- 239,114,128,246,242,116, 2,182,139,182,162,229,242,236,233,238,
- 103,129, 0,163,182,150,237,239,238,239,243,240,225,227,101,128,
- 255,225,242,239,235,101, 2,182,171,182,188,236,239,238,231,239,
- 246,229,242,236,225,249,227,237, 98,128, 3, 54,243,232,239,242,
- 244,239,246,229,242,236,225,249,227,237, 98,128, 3, 53,117, 7,
- 182,222,182,254,183, 20,183, 31,183, 72,183, 82,183, 86,226,243,
- 229,116,130, 34,130,182,233,182,244,238,239,244,229,241,245,225,
- 108,128, 34,138,239,242,229,241,245,225,108,128, 34,134, 99, 2,
- 183, 4,183, 12,227,229,229,228,115,128, 34,123,232,244,232,225,
- 116,128, 34, 11,232,233,242,225,231,225,238, 97,128, 48, 89,107,
- 2,183, 37,183, 61,225,244,225,235,225,238, 97,129, 48,185,183,
- 49,232,225,236,230,247,233,228,244,104,128,255,125,245,238,225,
- 242,225,226,233, 99,128, 6, 82,237,237,225,244,233,239,110,128,
- 34, 17,110,128, 38, 60,240,229,242,243,229,116,130, 34,131,183,
- 99,183,110,238,239,244,229,241,245,225,108,128, 34,139,239,242,
- 229,241,245,225,108,128, 34,135,246,243,241,245,225,242,101,128,
- 51,220,249,239,245,247,225,229,242,225,243,241,245,225,242,101,
- 128, 51,124,116,144, 0,116,183,183,184,192,184,213,185,100,185,
- 140,187,188,191, 70,192,145,192,157,192,169,193,202,193,227,194,
- 57,194,237,195,165,195,255, 97, 10,183,205,183,215,183,236,183,
- 243,184, 12,184, 90,184,107,184,132,184,146,184,150,226,229,238,
- 231,225,236,105,128, 9,164,227,107, 2,183,222,183,229,228,239,
- 247,110,128, 34,164,236,229,230,116,128, 34,163,228,229,246, 97,
- 128, 9, 36,231,117, 2,183,250,184, 3,234,225,242,225,244,105,
- 128, 10,164,242,237,245,235,232,105,128, 10, 36,104, 4,184, 22,
- 184, 31,184, 45,184, 75,225,242,225,226,233, 99,128, 6, 55,230,
- 233,238,225,236,225,242,225,226,233, 99,128,254,194,105, 2,184,
- 51,184, 66,238,233,244,233,225,236,225,242,225,226,233, 99,128,
- 254,195,242,225,231,225,238, 97,128, 48, 95,237,229,228,233,225,
- 236,225,242,225,226,233, 99,128,254,196,233,243,249,239,245,229,
- 242,225,243,241,245,225,242,101,128, 51,125,235,225,244,225,235,
- 225,238, 97,129, 48,191,184,120,232,225,236,230,247,233,228,244,
- 104,128,255,128,244,247,229,229,236,225,242,225,226,233, 99,128,
- 6, 64,117,128, 3,196,118,130, 5,234,184,158,184,183,228,225,
- 231,229,115,129,251, 74,184,168,104,129,251, 74,184,174,232,229,
- 226,242,229,119,128,251, 74,232,229,226,242,229,119,128, 5,234,
- 98, 2,184,198,184,203,225,114,128, 1,103,239,240,239,237,239,
- 230,111,128, 49, 10, 99, 6,184,227,184,234,184,241,184,250,185,
- 60,185, 87,225,242,239,110,128, 1,101,227,245,242,108,128, 2,
- 168,229,228,233,236,236, 97,128, 1, 99,232,229,104, 4,185, 6,
- 185, 15,185, 29,185, 45,225,242,225,226,233, 99,128, 6,134,230,
- 233,238,225,236,225,242,225,226,233, 99,128,251,123,233,238,233,
- 244,233,225,236,225,242,225,226,233, 99,128,251,124,237,229,228,
- 233,225,236,225,242,225,226,233, 99,128,251,125,233,242, 99, 2,
- 185, 68,185, 73,236,101,128, 36,227,245,237,230,236,229,248,226,
- 229,236,239,119,128, 30,113,239,237,237,225,225,227,227,229,238,
- 116,128, 1, 99,100, 2,185,106,185,116,233,229,242,229,243,233,
- 115,128, 30,151,239,116, 2,185,123,185,132,225,227,227,229,238,
- 116,128, 30,107,226,229,236,239,119,128, 30,109,101, 9,185,160,
- 185,171,185,191,186,201,186,226,187, 34,187,101,187,106,187,158,
- 227,249,242,233,236,236,233, 99,128, 4, 66,228,229,243,227,229,
- 238,228,229,242,227,249,242,233,236,236,233, 99,128, 4,173,104,
- 7,185,207,185,216,185,230,186, 14,186, 44,186, 85,186,183,225,
- 242,225,226,233, 99,128, 6, 42,230,233,238,225,236,225,242,225,
- 226,233, 99,128,254,150,232,225,232,105, 2,185,239,185,254,238,
- 233,244,233,225,236,225,242,225,226,233, 99,128,252,162,243,239,
- 236,225,244,229,228,225,242,225,226,233, 99,128,252, 12,105, 2,
- 186, 20,186, 35,238,233,244,233,225,236,225,242,225,226,233, 99,
- 128,254,151,242,225,231,225,238, 97,128, 48,102,234,229,229,237,
- 105, 2,186, 54,186, 69,238,233,244,233,225,236,225,242,225,226,
- 233, 99,128,252,161,243,239,236,225,244,229,228,225,242,225,226,
- 233, 99,128,252, 11,109, 2,186, 91,186,125,225,242,226,245,244,
- 97, 2,186,102,186,111,225,242,225,226,233, 99,128, 6, 41,230,
- 233,238,225,236,225,242,225,226,233, 99,128,254,148,101, 2,186,
- 131,186,144,228,233,225,236,225,242,225,226,233, 99,128,254,152,
- 229,237,105, 2,186,152,186,167,238,233,244,233,225,236,225,242,
- 225,226,233, 99,128,252,164,243,239,236,225,244,229,228,225,242,
- 225,226,233, 99,128,252, 14,238,239,239,238,230,233,238,225,236,
- 225,242,225,226,233, 99,128,252,115,235,225,244,225,235,225,238,
- 97,129, 48,198,186,214,232,225,236,230,247,233,228,244,104,128,
- 255,131,108, 2,186,232,186,251,229,240,232,239,238,101,129, 33,
- 33,186,243,226,236,225,227,107,128, 38, 14,233,243,232, 97, 2,
- 187, 4,187, 19,231,229,228,239,236,225,232,229,226,242,229,119,
- 128, 5,160,241,229,244,225,238,225,232,229,226,242,229,119,128,
- 5,169,110, 4,187, 44,187, 53,187, 72,187, 93,227,233,242,227,
- 236,101,128, 36,105,233,228,229,239,231,242,225,240,232,233,227,
- 240,225,242,229,110,128, 50, 41,112, 2,187, 78,187, 85,225,242,
- 229,110,128, 36,125,229,242,233,239,100,128, 36,145,242,239,237,
- 225,110,128, 33,121,243,104,128, 2,167,116,131, 5,216,187,116,
- 187,136,187,145,228,225,231,229,243,104,129,251, 56,187,127,232,
- 229,226,242,229,119,128,251, 56,232,229,226,242,229,119,128, 5,
- 216,243,229,227,249,242,233,236,236,233, 99,128, 4,181,246,233,
- 114, 2,187,166,187,175,232,229,226,242,229,119,128, 5,155,236,
- 229,230,244,232,229,226,242,229,119,128, 5,155,104, 6,187,202,
- 188, 98,188,220,189, 96,190, 3,191, 60, 97, 5,187,214,187,224,
- 187,231,188, 0,188, 29,226,229,238,231,225,236,105,128, 9,165,
- 228,229,246, 97,128, 9, 37,231,117, 2,187,238,187,247,234,225,
- 242,225,244,105,128, 10,165,242,237,245,235,232,105,128, 10, 37,
- 108, 2,188, 6,188, 15,225,242,225,226,233, 99,128, 6, 48,230,
- 233,238,225,236,225,242,225,226,233, 99,128,254,172,238,244,232,
- 225,235,232,225,116, 3,188, 44,188, 75,188, 82,236,239,119, 2,
- 188, 52,188, 63,236,229,230,244,244,232,225,105,128,248,152,242,
- 233,231,232,244,244,232,225,105,128,248,151,244,232,225,105,128,
- 14, 76,245,240,240,229,242,236,229,230,244,244,232,225,105,128,
- 248,150,101, 3,188,106,188,170,188,193,104, 4,188,116,188,125,
- 188,139,188,155,225,242,225,226,233, 99,128, 6, 43,230,233,238,
- 225,236,225,242,225,226,233, 99,128,254,154,233,238,233,244,233,
- 225,236,225,242,225,226,233, 99,128,254,155,237,229,228,233,225,
- 236,225,242,225,226,233, 99,128,254,156,242,101, 2,188,177,188,
- 186,229,248,233,243,244,115,128, 34, 3,230,239,242,101,128, 34,
- 52,244, 97,130, 3,184,188,202,188,206, 49,128, 3,209,243,249,
- 237,226,239,236,231,242,229,229,107,128, 3,209,105, 2,188,226,
- 189, 56,229,245,244,104, 4,188,239,189, 18,189, 33,189, 42, 97,
- 2,188,245,189, 4,227,233,242,227,236,229,235,239,242,229,225,
- 110,128, 50,121,240,225,242,229,238,235,239,242,229,225,110,128,
- 50, 25,227,233,242,227,236,229,235,239,242,229,225,110,128, 50,
- 107,235,239,242,229,225,110,128, 49, 76,240,225,242,229,238,235,
- 239,242,229,225,110,128, 50, 11,242,244,229,229,110, 2,189, 66,
- 189, 75,227,233,242,227,236,101,128, 36,108,112, 2,189, 81,189,
- 88,225,242,229,110,128, 36,128,229,242,233,239,100,128, 36,148,
- 111, 6,189,110,189,127,189,132,189,146,189,151,189,204,238,225,
- 238,231,237,239,238,244,232,239,244,232,225,105,128, 14, 17,239,
- 107,128, 1,173,240,232,245,244,232,225,239,244,232,225,105,128,
- 14, 18,242,110,128, 0,254,244,104, 3,189,160,189,184,189,194,
- 97, 2,189,166,189,176,232,225,238,244,232,225,105,128, 14, 23,
- 238,244,232,225,105,128, 14, 16,239,238,231,244,232,225,105,128,
- 14, 24,245,238,231,244,232,225,105,128, 14, 22,245,243,225,238,
- 100, 2,189,214,189,225,227,249,242,233,236,236,233, 99,128, 4,
- 130,243,243,229,240,225,242,225,244,239,114, 2,189,240,189,249,
- 225,242,225,226,233, 99,128, 6,108,240,229,242,243,233,225,110,
- 128, 6,108,242,229,101,144, 0, 51,190, 41,190, 50,190, 60,190,
- 90,190, 97,190,107,190,132,190,159,190,193,190,205,190,224,190,
- 235,191, 12,191, 34,191, 42,191, 53,225,242,225,226,233, 99,128,
- 6, 99,226,229,238,231,225,236,105,128, 9,233,227,233,242,227,
- 236,101,129, 36, 98,190, 71,233,238,246,229,242,243,229,243,225,
- 238,243,243,229,242,233,102,128, 39,140,228,229,246, 97,128, 9,
- 105,229,233,231,232,244,232,115,128, 33, 92,231,117, 2,190,114,
- 190,123,234,225,242,225,244,105,128, 10,233,242,237,245,235,232,
- 105,128, 10,105,232, 97, 2,190,139,190,150,227,235,225,242,225,
- 226,233, 99,128, 6, 99,238,231,250,232,239,117,128, 48, 35,105,
- 2,190,165,190,183,228,229,239,231,242,225,240,232,233,227,240,
- 225,242,229,110,128, 50, 34,238,230,229,242,233,239,114,128, 32,
- 131,237,239,238,239,243,240,225,227,101,128,255, 19,238,245,237,
- 229,242,225,244,239,242,226,229,238,231,225,236,105,128, 9,246,
- 239,236,228,243,244,249,236,101,128,247, 51,112, 2,190,241,190,
- 248,225,242,229,110,128, 36,118,229,114, 2,190,255,191, 5,233,
- 239,100,128, 36,138,243,233,225,110,128, 6,243,241,245,225,242,
- 244,229,242,115,129, 0,190,191, 25,229,237,228,225,243,104,128,
- 246,222,242,239,237,225,110,128, 33,114,243,245,240,229,242,233,
- 239,114,128, 0,179,244,232,225,105,128, 14, 83,250,243,241,245,
- 225,242,101,128, 51,148,105, 7,191, 86,191, 97,191,212,192, 54,
- 192, 66,192,115,192,132,232,233,242,225,231,225,238, 97,128, 48,
- 97,107, 2,191,103,191,127,225,244,225,235,225,238, 97,129, 48,
- 193,191,115,232,225,236,230,247,233,228,244,104,128,255,129,229,
- 245,116, 4,191,139,191,174,191,189,191,198, 97, 2,191,145,191,
- 160,227,233,242,227,236,229,235,239,242,229,225,110,128, 50,112,
- 240,225,242,229,238,235,239,242,229,225,110,128, 50, 16,227,233,
- 242,227,236,229,235,239,242,229,225,110,128, 50, 98,235,239,242,
- 229,225,110,128, 49, 55,240,225,242,229,238,235,239,242,229,225,
- 110,128, 50, 2,236,228,101,133, 2,220,191,228,191,239,192, 0,
- 192, 12,192, 40,226,229,236,239,247,227,237, 98,128, 3, 48, 99,
- 2,191,245,191,250,237, 98,128, 3, 3,239,237, 98,128, 3, 3,
- 228,239,245,226,236,229,227,237, 98,128, 3, 96,111, 2,192, 18,
- 192, 28,240,229,242,225,244,239,114,128, 34, 60,246,229,242,236,
- 225,249,227,237, 98,128, 3, 52,246,229,242,244,233,227,225,236,
- 227,237, 98,128, 3, 62,237,229,243,227,233,242,227,236,101,128,
- 34,151,112, 2,192, 72,192,102,229,232, 97, 2,192, 80,192, 89,
- 232,229,226,242,229,119,128, 5,150,236,229,230,244,232,229,226,
- 242,229,119,128, 5,150,240,233,231,245,242,237,245,235,232,105,
- 128, 10,112,244,236,239,227,249,242,233,236,236,233,227,227,237,
- 98,128, 4,131,247,238,225,242,237,229,238,233,225,110,128, 5,
- 127,236,233,238,229,226,229,236,239,119,128, 30,111,237,239,238,
- 239,243,240,225,227,101,128,255, 84,111, 7,192,185,192,196,192,
- 207,192,232,193, 96,193,108,193,192,225,242,237,229,238,233,225,
- 110,128, 5,105,232,233,242,225,231,225,238, 97,128, 48,104,235,
- 225,244,225,235,225,238, 97,129, 48,200,192,220,232,225,236,230,
- 247,233,228,244,104,128,255,132,110, 3,192,240,193, 82,193, 87,
- 101, 4,192,250,193, 63,193, 70,193, 76,226,225,114, 4,193, 6,
- 193, 35,193, 45,193, 54,229,248,244,242, 97, 2,193, 16,193, 26,
- 232,233,231,232,237,239,100,128, 2,229,236,239,247,237,239,100,
- 128, 2,233,232,233,231,232,237,239,100,128, 2,230,236,239,247,
- 237,239,100,128, 2,232,237,233,228,237,239,100,128, 2,231,230,
- 233,246,101,128, 1,189,243,233,120,128, 1,133,244,247,111,128,
- 1,168,239,115,128, 3,132,243,241,245,225,242,101,128, 51, 39,
- 240,225,244,225,235,244,232,225,105,128, 14, 15,242,244,239,233,
- 243,229,243,232,229,236,236,226,242,225,227,235,229,116, 2,193,
- 131,193,161,236,229,230,116,130, 48, 20,193,142,193,150,243,237,
- 225,236,108,128,254, 93,246,229,242,244,233,227,225,108,128,254,
- 57,242,233,231,232,116,130, 48, 21,193,173,193,181,243,237,225,
- 236,108,128,254, 94,246,229,242,244,233,227,225,108,128,254, 58,
- 244,225,239,244,232,225,105,128, 14, 21,240, 97, 2,193,209,193,
- 221,236,225,244,225,236,232,239,239,107,128, 1,171,242,229,110,
- 128, 36,175,114, 3,193,235,194, 10,194, 25,225,228,229,237,225,
- 242,107,129, 33, 34,193,247,115, 2,193,253,194, 3,225,238,115,
- 128,248,234,229,242,233,102,128,246,219,229,244,242,239,230,236,
- 229,248,232,239,239,107,128, 2,136,233,225,103, 4,194, 37,194,
- 42,194, 47,194, 52,228,110,128, 37,188,236,102,128, 37,196,242,
- 116,128, 37,186,245,112,128, 37,178,115,132, 2,166,194, 69,194,
- 108,194,214,194,227,225,228,105,130, 5,230,194, 79,194, 99,228,
- 225,231,229,243,104,129,251, 70,194, 90,232,229,226,242,229,119,
- 128,251, 70,232,229,226,242,229,119,128, 5,230,101, 2,194,114,
- 194,125,227,249,242,233,236,236,233, 99,128, 4, 70,242,101,134,
- 5,181,194,142,194,156,194,161,194,170,194,185,194,201, 49, 2,
- 194,148,194,152, 50,128, 5,181,101,128, 5,181,178, 98,128, 5,
- 181,232,229,226,242,229,119,128, 5,181,238,225,242,242,239,247,
- 232,229,226,242,229,119,128, 5,181,241,245,225,242,244,229,242,
- 232,229,226,242,229,119,128, 5,181,247,233,228,229,232,229,226,
- 242,229,119,128, 5,181,232,229,227,249,242,233,236,236,233, 99,
- 128, 4, 91,245,240,229,242,233,239,114,128,246,243,116, 4,194,
- 247,195, 41,195,106,195,157, 97, 3,194,255,195, 9,195, 16,226,
- 229,238,231,225,236,105,128, 9,159,228,229,246, 97,128, 9, 31,
- 231,117, 2,195, 23,195, 32,234,225,242,225,244,105,128, 10,159,
- 242,237,245,235,232,105,128, 10, 31,229,104, 4,195, 52,195, 61,
- 195, 75,195, 91,225,242,225,226,233, 99,128, 6,121,230,233,238,
- 225,236,225,242,225,226,233, 99,128,251,103,233,238,233,244,233,
- 225,236,225,242,225,226,233, 99,128,251,104,237,229,228,233,225,
- 236,225,242,225,226,233, 99,128,251,105,232, 97, 3,195,115,195,
- 125,195,132,226,229,238,231,225,236,105,128, 9,160,228,229,246,
- 97,128, 9, 32,231,117, 2,195,139,195,148,234,225,242,225,244,
- 105,128, 10,160,242,237,245,235,232,105,128, 10, 32,245,242,238,
- 229,100,128, 2,135,117, 3,195,173,195,184,195,209,232,233,242,
- 225,231,225,238, 97,128, 48,100,235,225,244,225,235,225,238, 97,
- 129, 48,196,195,197,232,225,236,230,247,233,228,244,104,128,255,
- 130,243,237,225,236,108, 2,195,219,195,230,232,233,242,225,231,
- 225,238, 97,128, 48, 99,235,225,244,225,235,225,238, 97,129, 48,
- 195,195,243,232,225,236,230,247,233,228,244,104,128,255,111,119,
- 2,196, 5,196,110,101, 2,196, 11,196, 59,236,246,101, 3,196,
- 21,196, 30,196, 51,227,233,242,227,236,101,128, 36,107,112, 2,
- 196, 36,196, 43,225,242,229,110,128, 36,127,229,242,233,239,100,
- 128, 36,147,242,239,237,225,110,128, 33,123,238,244,121, 3,196,
- 69,196, 78,196, 89,227,233,242,227,236,101,128, 36,115,232,225,
- 238,231,250,232,239,117,128, 83, 68,112, 2,196, 95,196,102,225,
- 242,229,110,128, 36,135,229,242,233,239,100,128, 36,155,111,142,
- 0, 50,196,142,196,151,196,161,196,191,196,243,197, 12,197, 39,
- 197, 73,197, 85,197,104,197,115,197,148,197,156,197,180,225,242,
- 225,226,233, 99,128, 6, 98,226,229,238,231,225,236,105,128, 9,
- 232,227,233,242,227,236,101,129, 36, 97,196,172,233,238,246,229,
- 242,243,229,243,225,238,243,243,229,242,233,102,128, 39,139,100,
- 2,196,197,196,203,229,246, 97,128, 9,104,239,116, 2,196,210,
- 196,221,229,238,236,229,225,228,229,114,128, 32, 37,236,229,225,
- 228,229,114,129, 32, 37,196,232,246,229,242,244,233,227,225,108,
- 128,254, 48,231,117, 2,196,250,197, 3,234,225,242,225,244,105,
- 128, 10,232,242,237,245,235,232,105,128, 10,104,232, 97, 2,197,
- 19,197, 30,227,235,225,242,225,226,233, 99,128, 6, 98,238,231,
- 250,232,239,117,128, 48, 34,105, 2,197, 45,197, 63,228,229,239,
- 231,242,225,240,232,233,227,240,225,242,229,110,128, 50, 33,238,
- 230,229,242,233,239,114,128, 32,130,237,239,238,239,243,240,225,
- 227,101,128,255, 18,238,245,237,229,242,225,244,239,242,226,229,
- 238,231,225,236,105,128, 9,245,239,236,228,243,244,249,236,101,
- 128,247, 50,112, 2,197,121,197,128,225,242,229,110,128, 36,117,
- 229,114, 2,197,135,197,141,233,239,100,128, 36,137,243,233,225,
- 110,128, 6,242,242,239,237,225,110,128, 33,113,115, 2,197,162,
- 197,170,244,242,239,235,101,128, 1,187,245,240,229,242,233,239,
- 114,128, 0,178,244,104, 2,197,187,197,192,225,105,128, 14, 82,
- 233,242,228,115,128, 33, 84,117,145, 0,117,197,237,197,245,198,
- 30,198, 87,198,225,199, 6,199,129,199,145,199,196,200, 10,200,
- 91,200,100,200,219,200,243,201, 95,201,123,201,237,225,227,245,
- 244,101,128, 0,250, 98, 4,197,255,198, 4,198, 13,198, 23,225,
- 114,128, 2,137,229,238,231,225,236,105,128, 9,137,239,240,239,
- 237,239,230,111,128, 49, 40,242,229,246,101,128, 1,109, 99, 3,
- 198, 38,198, 45,198, 77,225,242,239,110,128, 1,212,233,242, 99,
- 2,198, 53,198, 58,236,101,128, 36,228,245,237,230,236,229,120,
- 129, 0,251,198, 69,226,229,236,239,119,128, 30,119,249,242,233,
- 236,236,233, 99,128, 4, 67,100, 5,198, 99,198,110,198,133,198,
- 139,198,215,225,244,244,225,228,229,246, 97,128, 9, 81,226,108,
- 2,198,117,198,125,225,227,245,244,101,128, 1,113,231,242,225,
- 246,101,128, 2, 21,229,246, 97,128, 9, 9,233,229,242,229,243,
- 233,115,133, 0,252,198,159,198,167,198,175,198,198,198,206,225,
- 227,245,244,101,128, 1,216,226,229,236,239,119,128, 30,115, 99,
- 2,198,181,198,188,225,242,239,110,128, 1,218,249,242,233,236,
- 236,233, 99,128, 4,241,231,242,225,246,101,128, 1,220,237,225,
- 227,242,239,110,128, 1,214,239,244,226,229,236,239,119,128, 30,
- 229,103, 2,198,231,198,238,242,225,246,101,128, 0,249,117, 2,
- 198,244,198,253,234,225,242,225,244,105,128, 10,137,242,237,245,
- 235,232,105,128, 10, 9,104, 3,199, 14,199, 24,199,102,233,242,
- 225,231,225,238, 97,128, 48, 70,111, 2,199, 30,199, 40,239,235,
- 225,226,239,246,101,128, 30,231,242,110,133, 1,176,199, 55,199,
- 63,199, 74,199, 82,199, 94,225,227,245,244,101,128, 30,233,228,
- 239,244,226,229,236,239,119,128, 30,241,231,242,225,246,101,128,
- 30,235,232,239,239,235,225,226,239,246,101,128, 30,237,244,233,
- 236,228,101,128, 30,239,245,238,231,225,242,245,237,236,225,245,
- 116,129, 1,113,199,118,227,249,242,233,236,236,233, 99,128, 4,
- 243,233,238,246,229,242,244,229,228,226,242,229,246,101,128, 2,
- 23,107, 3,199,153,199,177,199,188,225,244,225,235,225,238, 97,
- 129, 48,166,199,165,232,225,236,230,247,233,228,244,104,128,255,
- 115,227,249,242,233,236,236,233, 99,128, 4,121,239,242,229,225,
- 110,128, 49, 92,109, 2,199,202,199,255, 97, 2,199,208,199,241,
- 227,242,239,110,130, 1,107,199,219,199,230,227,249,242,233,236,
- 236,233, 99,128, 4,239,228,233,229,242,229,243,233,115,128, 30,
- 123,244,242,225,231,245,242,237,245,235,232,105,128, 10, 65,239,
- 238,239,243,240,225,227,101,128,255, 85,110, 2,200, 16,200, 71,
- 228,229,242,243,227,239,242,101,132, 0, 95,200, 35,200, 41,200,
- 53,200, 64,228,226,108,128, 32, 23,237,239,238,239,243,240,225,
- 227,101,128,255, 63,246,229,242,244,233,227,225,108,128,254, 51,
- 247,225,246,121,128,254, 79,105, 2,200, 77,200, 82,239,110,128,
- 34, 42,246,229,242,243,225,108,128, 34, 0,239,231,239,238,229,
- 107,128, 1,115,112, 5,200,112,200,119,200,127,200,142,200,193,
- 225,242,229,110,128, 36,176,226,236,239,227,107,128, 37,128,240,
- 229,242,228,239,244,232,229,226,242,229,119,128, 5,196,243,233,
- 236,239,110,131, 3,197,200,156,200,177,200,185,228,233,229,242,
- 229,243,233,115,129, 3,203,200,169,244,239,238,239,115,128, 3,
- 176,236,225,244,233,110,128, 2,138,244,239,238,239,115,128, 3,
- 205,244,225,227,107, 2,200,202,200,213,226,229,236,239,247,227,
- 237, 98,128, 3, 29,237,239,100,128, 2,212,114, 2,200,225,200,
- 237,225,231,245,242,237,245,235,232,105,128, 10,115,233,238,103,
- 128, 1,111,115, 3,200,251,201, 10,201, 55,232,239,242,244,227,
- 249,242,233,236,236,233, 99,128, 4, 94,237,225,236,108, 2,201,
- 19,201, 30,232,233,242,225,231,225,238, 97,128, 48, 69,235,225,
- 244,225,235,225,238, 97,129, 48,165,201, 43,232,225,236,230,247,
- 233,228,244,104,128,255,105,244,242,225,233,231,232,116, 2,201,
- 67,201, 78,227,249,242,233,236,236,233, 99,128, 4,175,243,244,
- 242,239,235,229,227,249,242,233,236,236,233, 99,128, 4,177,244,
- 233,236,228,101,130, 1,105,201,107,201,115,225,227,245,244,101,
- 128, 30,121,226,229,236,239,119,128, 30,117,117, 5,201,135,201,
- 145,201,152,201,177,201,193,226,229,238,231,225,236,105,128, 9,
- 138,228,229,246, 97,128, 9, 10,231,117, 2,201,159,201,168,234,
- 225,242,225,244,105,128, 10,138,242,237,245,235,232,105,128, 10,
- 10,237,225,244,242,225,231,245,242,237,245,235,232,105,128, 10,
- 66,246,239,247,229,236,243,233,231,110, 3,201,209,201,219,201,
- 226,226,229,238,231,225,236,105,128, 9,194,228,229,246, 97,128,
- 9, 66,231,245,234,225,242,225,244,105,128, 10,194,246,239,247,
- 229,236,243,233,231,110, 3,201,253,202, 7,202, 14,226,229,238,
- 231,225,236,105,128, 9,193,228,229,246, 97,128, 9, 65,231,245,
- 234,225,242,225,244,105,128, 10,193,118,139, 0,118,202, 51,202,
- 199,202,208,202,219,203,148,203,155,203,253,204, 9,204,109,204,
- 117,204,138, 97, 4,202, 61,202, 68,202, 93,202,104,228,229,246,
- 97,128, 9, 53,231,117, 2,202, 75,202, 84,234,225,242,225,244,
- 105,128, 10,181,242,237,245,235,232,105,128, 10, 53,235,225,244,
- 225,235,225,238, 97,128, 48,247,118,132, 5,213,202,116,202,143,
- 202,175,202,187,228,225,231,229,243,104,130,251, 53,202,129,202,
- 134,182, 53,128,251, 53,232,229,226,242,229,119,128,251, 53,104,
- 2,202,149,202,157,229,226,242,229,119,128, 5,213,239,236,225,
- 109,129,251, 75,202,166,232,229,226,242,229,119,128,251, 75,246,
- 225,246,232,229,226,242,229,119,128, 5,240,249,239,228,232,229,
- 226,242,229,119,128, 5,241,227,233,242,227,236,101,128, 36,229,
- 228,239,244,226,229,236,239,119,128, 30,127,101, 6,202,233,202,
- 244,203, 52,203, 63,203, 69,203,136,227,249,242,233,236,236,233,
- 99,128, 4, 50,104, 4,202,254,203, 7,203, 21,203, 37,225,242,
- 225,226,233, 99,128, 6,164,230,233,238,225,236,225,242,225,226,
- 233, 99,128,251,107,233,238,233,244,233,225,236,225,242,225,226,
- 233, 99,128,251,108,237,229,228,233,225,236,225,242,225,226,233,
- 99,128,251,109,235,225,244,225,235,225,238, 97,128, 48,249,238,
- 245,115,128, 38, 64,242,244,233,227,225,108, 2,203, 80,203, 86,
- 226,225,114,128, 0,124,236,233,238,101, 4,203, 99,203,110,203,
- 121,203,130,225,226,239,246,229,227,237, 98,128, 3, 13,226,229,
- 236,239,247,227,237, 98,128, 3, 41,236,239,247,237,239,100,128,
- 2,204,237,239,100,128, 2,200,247,225,242,237,229,238,233,225,
- 110,128, 5,126,232,239,239,107,128, 2,139,105, 3,203,163,203,
- 174,203,213,235,225,244,225,235,225,238, 97,128, 48,248,242,225,
- 237, 97, 3,203,185,203,195,203,202,226,229,238,231,225,236,105,
- 128, 9,205,228,229,246, 97,128, 9, 77,231,245,234,225,242,225,
- 244,105,128, 10,205,243,225,242,231, 97, 3,203,225,203,235,203,
- 242,226,229,238,231,225,236,105,128, 9,131,228,229,246, 97,128,
- 9, 3,231,245,234,225,242,225,244,105,128, 10,131,237,239,238,
- 239,243,240,225,227,101,128,255, 86,111, 3,204, 17,204, 28,204,
- 98,225,242,237,229,238,233,225,110,128, 5,120,233,227,229,100,
- 2,204, 37,204, 73,233,244,229,242,225,244,233,239,110, 2,204,
- 51,204, 62,232,233,242,225,231,225,238, 97,128, 48,158,235,225,
- 244,225,235,225,238, 97,128, 48,254,237,225,242,235,235,225,238,
- 97,129, 48,155,204, 86,232,225,236,230,247,233,228,244,104,128,
- 255,158,235,225,244,225,235,225,238, 97,128, 48,250,240,225,242,
- 229,110,128, 36,177,116, 2,204,123,204,130,233,236,228,101,128,
- 30,125,245,242,238,229,100,128, 2,140,117, 2,204,144,204,155,
- 232,233,242,225,231,225,238, 97,128, 48,148,235,225,244,225,235,
- 225,238, 97,128, 48,244,119,143, 0,119,204,200,205,177,205,187,
- 205,210,205,250,206, 61,206, 69,208, 40,208, 81,208, 93,208,168,
- 208,176,208,183,208,194,208,203, 97, 8,204,218,204,225,204,235,
- 204,246,205, 28,205, 60,205, 72,205,108,227,245,244,101,128, 30,
- 131,229,235,239,242,229,225,110,128, 49, 89,232,233,242,225,231,
- 225,238, 97,128, 48,143,107, 2,204,252,205, 20,225,244,225,235,
- 225,238, 97,129, 48,239,205, 8,232,225,236,230,247,233,228,244,
- 104,128,255,156,239,242,229,225,110,128, 49, 88,243,237,225,236,
- 108, 2,205, 38,205, 49,232,233,242,225,231,225,238, 97,128, 48,
- 142,235,225,244,225,235,225,238, 97,128, 48,238,244,244,239,243,
- 241,245,225,242,101,128, 51, 87,118, 2,205, 78,205, 86,229,228,
- 225,243,104,128, 48, 28,249,245,238,228,229,242,243,227,239,242,
- 229,246,229,242,244,233,227,225,108,128,254, 52,119, 3,205,116,
- 205,125,205,139,225,242,225,226,233, 99,128, 6, 72,230,233,238,
- 225,236,225,242,225,226,233, 99,128,254,238,232,225,237,250,225,
- 225,226,239,246,101, 2,205,154,205,163,225,242,225,226,233, 99,
- 128, 6, 36,230,233,238,225,236,225,242,225,226,233, 99,128,254,
- 134,226,243,241,245,225,242,101,128, 51,221,227,233,242, 99, 2,
- 205,196,205,201,236,101,128, 36,230,245,237,230,236,229,120,128,
- 1,117,100, 2,205,216,205,226,233,229,242,229,243,233,115,128,
- 30,133,239,116, 2,205,233,205,242,225,227,227,229,238,116,128,
- 30,135,226,229,236,239,119,128, 30,137,101, 4,206, 4,206, 15,
- 206, 27,206, 51,232,233,242,225,231,225,238, 97,128, 48,145,233,
- 229,242,243,244,242,225,243,115,128, 33, 24,107, 2,206, 33,206,
- 43,225,244,225,235,225,238, 97,128, 48,241,239,242,229,225,110,
- 128, 49, 94,239,235,239,242,229,225,110,128, 49, 93,231,242,225,
- 246,101,128, 30,129,232,233,244,101, 8,206, 90,206, 99,206,183,
- 207, 17,207,101,207,146,207,198,207,254,226,245,236,236,229,116,
- 128, 37,230, 99, 2,206,105,206,125,233,242,227,236,101,129, 37,
- 203,206,115,233,238,246,229,242,243,101,128, 37,217,239,242,238,
- 229,242,226,242,225,227,235,229,116, 2,206,142,206,162,236,229,
- 230,116,129, 48, 14,206,151,246,229,242,244,233,227,225,108,128,
- 254, 67,242,233,231,232,116,129, 48, 15,206,172,246,229,242,244,
- 233,227,225,108,128,254, 68,100, 2,206,189,206,230,233,225,237,
- 239,238,100,129, 37,199,206,200,227,239,238,244,225,233,238,233,
- 238,231,226,236,225,227,235,243,237,225,236,236,228,233,225,237,
- 239,238,100,128, 37,200,239,247,238,240,239,233,238,244,233,238,
- 103, 2,206,246,207, 6,243,237,225,236,236,244,242,233,225,238,
- 231,236,101,128, 37,191,244,242,233,225,238,231,236,101,128, 37,
- 189,236,101, 2,207, 24,207, 66,230,244,240,239,233,238,244,233,
- 238,103, 2,207, 39,207, 55,243,237,225,236,236,244,242,233,225,
- 238,231,236,101,128, 37,195,244,242,233,225,238,231,236,101,128,
- 37,193,238,244,233,227,245,236,225,242,226,242,225,227,235,229,
- 116, 2,207, 86,207, 93,236,229,230,116,128, 48, 22,242,233,231,
- 232,116,128, 48, 23,242,233,231,232,244,240,239,233,238,244,233,
- 238,103, 2,207,119,207,135,243,237,225,236,236,244,242,233,225,
- 238,231,236,101,128, 37,185,244,242,233,225,238,231,236,101,128,
- 37,183,115, 3,207,154,207,184,207,192,109, 2,207,160,207,172,
- 225,236,236,243,241,245,225,242,101,128, 37,171,233,236,233,238,
- 231,230,225,227,101,128, 38, 58,241,245,225,242,101,128, 37,161,
- 244,225,114,128, 38, 6,116, 2,207,204,207,215,229,236,229,240,
- 232,239,238,101,128, 38, 15,239,242,244,239,233,243,229,243,232,
- 229,236,236,226,242,225,227,235,229,116, 2,207,239,207,246,236,
- 229,230,116,128, 48, 24,242,233,231,232,116,128, 48, 25,245,240,
- 240,239,233,238,244,233,238,103, 2,208, 13,208, 29,243,237,225,
- 236,236,244,242,233,225,238,231,236,101,128, 37,181,244,242,233,
- 225,238,231,236,101,128, 37,179,105, 2,208, 46,208, 57,232,233,
- 242,225,231,225,238, 97,128, 48,144,107, 2,208, 63,208, 73,225,
- 244,225,235,225,238, 97,128, 48,240,239,242,229,225,110,128, 49,
- 95,237,239,238,239,243,240,225,227,101,128,255, 87,111, 4,208,
- 103,208,114,208,139,208,157,232,233,242,225,231,225,238, 97,128,
- 48,146,235,225,244,225,235,225,238, 97,129, 48,242,208,127,232,
- 225,236,230,247,233,228,244,104,128,255,102,110,129, 32,169,208,
- 145,237,239,238,239,243,240,225,227,101,128,255,230,247,225,229,
- 238,244,232,225,105,128, 14, 39,240,225,242,229,110,128, 36,178,
- 242,233,238,103,128, 30,152,243,245,240,229,242,233,239,114,128,
- 2,183,244,245,242,238,229,100,128, 2,141,249,238,110,128, 1,
- 191,120,137, 0,120,208,231,208,242,208,253,209, 6,209, 33,209,
- 46,209, 50,209, 62,209, 70,225,226,239,246,229,227,237, 98,128,
- 3, 61,226,239,240,239,237,239,230,111,128, 49, 18,227,233,242,
- 227,236,101,128, 36,231,100, 2,209, 12,209, 22,233,229,242,229,
- 243,233,115,128, 30,141,239,244,225,227,227,229,238,116,128, 30,
- 139,229,232,225,242,237,229,238,233,225,110,128, 5,109,105,128,
- 3,190,237,239,238,239,243,240,225,227,101,128,255, 88,240,225,
- 242,229,110,128, 36,179,243,245,240,229,242,233,239,114,128, 2,
- 227,121,143, 0,121,209,115,210, 74,210, 97,210,137,212,103,212,
- 111,212,128,212,192,212,204,213,201,213,241,213,253,214, 8,214,
- 29,215, 2, 97, 11,209,139,209,151,209,161,209,168,209,175,209,
- 185,209,210,209,221,210, 3,210, 16,210, 62,225,228,239,243,241,
- 245,225,242,101,128, 51, 78,226,229,238,231,225,236,105,128, 9,
- 175,227,245,244,101,128, 0,253,228,229,246, 97,128, 9, 47,229,
- 235,239,242,229,225,110,128, 49, 82,231,117, 2,209,192,209,201,
- 234,225,242,225,244,105,128, 10,175,242,237,245,235,232,105,128,
- 10, 47,232,233,242,225,231,225,238, 97,128, 48,132,107, 2,209,
- 227,209,251,225,244,225,235,225,238, 97,129, 48,228,209,239,232,
- 225,236,230,247,233,228,244,104,128,255,148,239,242,229,225,110,
- 128, 49, 81,237,225,235,235,225,238,244,232,225,105,128, 14, 78,
- 243,237,225,236,108, 2,210, 26,210, 37,232,233,242,225,231,225,
- 238, 97,128, 48,131,235,225,244,225,235,225,238, 97,129, 48,227,
- 210, 50,232,225,236,230,247,233,228,244,104,128,255,108,244,227,
- 249,242,233,236,236,233, 99,128, 4, 99,227,233,242, 99, 2,210,
- 83,210, 88,236,101,128, 36,232,245,237,230,236,229,120,128, 1,
- 119,100, 2,210,103,210,113,233,229,242,229,243,233,115,128, 0,
- 255,239,116, 2,210,120,210,129,225,227,227,229,238,116,128, 30,
- 143,226,229,236,239,119,128, 30,245,101, 7,210,153,211,161,211,
- 170,211,188,211,220,212, 40,212, 91,104, 8,210,171,210,180,210,
- 214,210,228,211, 45,211, 61,211,120,211,138,225,242,225,226,233,
- 99,128, 6, 74,226,225,242,242,229,101, 2,210,191,210,200,225,
- 242,225,226,233, 99,128, 6,210,230,233,238,225,236,225,242,225,
- 226,233, 99,128,251,175,230,233,238,225,236,225,242,225,226,233,
- 99,128,254,242,232,225,237,250,225,225,226,239,246,101, 4,210,
- 247,211, 0,211, 14,211, 30,225,242,225,226,233, 99,128, 6, 38,
- 230,233,238,225,236,225,242,225,226,233, 99,128,254,138,233,238,
- 233,244,233,225,236,225,242,225,226,233, 99,128,254,139,237,229,
- 228,233,225,236,225,242,225,226,233, 99,128,254,140,233,238,233,
- 244,233,225,236,225,242,225,226,233, 99,128,254,243,237,101, 2,
- 211, 68,211, 81,228,233,225,236,225,242,225,226,233, 99,128,254,
- 244,229,237,105, 2,211, 89,211,104,238,233,244,233,225,236,225,
- 242,225,226,233, 99,128,252,221,243,239,236,225,244,229,228,225,
- 242,225,226,233, 99,128,252, 88,238,239,239,238,230,233,238,225,
- 236,225,242,225,226,233, 99,128,252,148,244,232,242,229,229,228,
- 239,244,243,226,229,236,239,247,225,242,225,226,233, 99,128, 6,
- 209,235,239,242,229,225,110,128, 49, 86,110,129, 0,165,211,176,
- 237,239,238,239,243,240,225,227,101,128,255,229,111, 2,211,194,
- 211,203,235,239,242,229,225,110,128, 49, 85,242,233,238,232,233,
- 229,245,232,235,239,242,229,225,110,128, 49,134,114, 3,211,228,
- 212, 8,212, 20,225,232,226,229,238,249,239,237,111, 2,211,242,
- 211,251,232,229,226,242,229,119,128, 5,170,236,229,230,244,232,
- 229,226,242,229,119,128, 5,170,233,227,249,242,233,236,236,233,
- 99,128, 4, 75,245,228,233,229,242,229,243,233,243,227,249,242,
- 233,236,236,233, 99,128, 4,249,243,233,229,245,238,103, 3,212,
- 53,212, 62,212, 78,235,239,242,229,225,110,128, 49,129,240,225,
- 238,243,233,239,243,235,239,242,229,225,110,128, 49,131,243,233,
- 239,243,235,239,242,229,225,110,128, 49,130,244,233,246,232,229,
- 226,242,229,119,128, 5,154,231,242,225,246,101,128, 30,243,232,
- 239,239,107,129, 1,180,212,120,225,226,239,246,101,128, 30,247,
- 105, 5,212,140,212,151,212,162,212,171,212,179,225,242,237,229,
- 238,233,225,110,128, 5,117,227,249,242,233,236,236,233, 99,128,
- 4, 87,235,239,242,229,225,110,128, 49, 98,238,249,225,238,103,
- 128, 38, 47,247,238,225,242,237,229,238,233,225,110,128, 5,130,
- 237,239,238,239,243,240,225,227,101,128,255, 89,111, 7,212,220,
- 213, 34,213, 45,213, 55,213, 93,213,139,213,148,100,131, 5,217,
- 212,230,212,250,213, 3,228,225,231,229,243,104,129,251, 57,212,
- 241,232,229,226,242,229,119,128,251, 57,232,229,226,242,229,119,
- 128, 5,217,249,239,100, 2,213, 11,213, 20,232,229,226,242,229,
- 119,128, 5,242,240,225,244,225,232,232,229,226,242,229,119,128,
- 251, 31,232,233,242,225,231,225,238, 97,128, 48,136,233,235,239,
- 242,229,225,110,128, 49,137,107, 2,213, 61,213, 85,225,244,225,
- 235,225,238, 97,129, 48,232,213, 73,232,225,236,230,247,233,228,
- 244,104,128,255,150,239,242,229,225,110,128, 49, 91,243,237,225,
- 236,108, 2,213,103,213,114,232,233,242,225,231,225,238, 97,128,
- 48,135,235,225,244,225,235,225,238, 97,129, 48,231,213,127,232,
- 225,236,230,247,233,228,244,104,128,255,110,244,231,242,229,229,
- 107,128, 3,243,121, 2,213,154,213,191, 97, 2,213,160,213,170,
- 229,235,239,242,229,225,110,128, 49,136,107, 2,213,176,213,184,
- 239,242,229,225,110,128, 49,135,244,232,225,105,128, 14, 34,233,
- 238,231,244,232,225,105,128, 14, 13,112, 2,213,207,213,214,225,
- 242,229,110,128, 36,180,239,231,229,231,242,225,237,237,229,238,
- 105,129, 3,122,213,230,231,242,229,229,235,227,237, 98,128, 3,
- 69,114,129, 1,166,213,247,233,238,103,128, 30,153,243,245,240,
- 229,242,233,239,114,128, 2,184,116, 2,214, 14,214, 21,233,236,
- 228,101,128, 30,249,245,242,238,229,100,128, 2,142,117, 5,214,
- 41,214, 52,214, 62,214,100,214,232,232,233,242,225,231,225,238,
- 97,128, 48,134,233,235,239,242,229,225,110,128, 49,140,107, 2,
- 214, 68,214, 92,225,244,225,235,225,238, 97,129, 48,230,214, 80,
- 232,225,236,230,247,233,228,244,104,128,255,149,239,242,229,225,
- 110,128, 49, 96,115, 3,214,108,214,146,214,187,226,233,103, 2,
- 214,116,214,127,227,249,242,233,236,236,233, 99,128, 4,107,233,
- 239,244,233,230,233,229,228,227,249,242,233,236,236,233, 99,128,
- 4,109,236,233,244,244,236,101, 2,214,157,214,168,227,249,242,
- 233,236,236,233, 99,128, 4,103,233,239,244,233,230,233,229,228,
- 227,249,242,233,236,236,233, 99,128, 4,105,237,225,236,108, 2,
- 214,196,214,207,232,233,242,225,231,225,238, 97,128, 48,133,235,
- 225,244,225,235,225,238, 97,129, 48,229,214,220,232,225,236,230,
- 247,233,228,244,104,128,255,109,249,101, 2,214,239,214,248,235,
- 239,242,229,225,110,128, 49,139,239,235,239,242,229,225,110,128,
- 49,138,249, 97, 2,215, 9,215, 19,226,229,238,231,225,236,105,
- 128, 9,223,228,229,246, 97,128, 9, 95,122,142, 0,122,215, 58,
- 216, 66,216, 77,216,120,216,147,217,182,218, 34,218, 76,218, 88,
- 218,100,218,128,218,136,218,152,218,161, 97, 10,215, 80,215, 91,
- 215, 98,215,105,215,116,215,194,215,224,215,235,216, 15,216, 27,
- 225,242,237,229,238,233,225,110,128, 5,102,227,245,244,101,128,
- 1,122,228,229,246, 97,128, 9, 91,231,245,242,237,245,235,232,
- 105,128, 10, 91,104, 4,215,126,215,135,215,149,215,179,225,242,
- 225,226,233, 99,128, 6, 56,230,233,238,225,236,225,242,225,226,
- 233, 99,128,254,198,105, 2,215,155,215,170,238,233,244,233,225,
- 236,225,242,225,226,233, 99,128,254,199,242,225,231,225,238, 97,
- 128, 48, 86,237,229,228,233,225,236,225,242,225,226,233, 99,128,
- 254,200,233,110, 2,215,201,215,210,225,242,225,226,233, 99,128,
- 6, 50,230,233,238,225,236,225,242,225,226,233, 99,128,254,176,
- 235,225,244,225,235,225,238, 97,128, 48,182,241,229,102, 2,215,
- 243,216, 1,231,225,228,239,236,232,229,226,242,229,119,128, 5,
- 149,241,225,244,225,238,232,229,226,242,229,119,128, 5,148,242,
- 241,225,232,229,226,242,229,119,128, 5,152,249,233,110,130, 5,
- 214,216, 37,216, 57,228,225,231,229,243,104,129,251, 54,216, 48,
- 232,229,226,242,229,119,128,251, 54,232,229,226,242,229,119,128,
- 5,214,226,239,240,239,237,239,230,111,128, 49, 23, 99, 3,216,
- 85,216, 92,216,114,225,242,239,110,128, 1,126,233,242, 99, 2,
- 216,100,216,105,236,101,128, 36,233,245,237,230,236,229,120,128,
- 30,145,245,242,108,128, 2,145,228,239,116,130, 1,124,216,130,
- 216,139,225,227,227,229,238,116,128, 1,124,226,229,236,239,119,
- 128, 30,147,101, 6,216,161,216,172,216,215,216,226,216,237,217,
- 177,227,249,242,233,236,236,233, 99,128, 4, 55,100, 2,216,178,
- 216,197,229,243,227,229,238,228,229,242,227,249,242,233,236,236,
- 233, 99,128, 4,153,233,229,242,229,243,233,243,227,249,242,233,
- 236,236,233, 99,128, 4,223,232,233,242,225,231,225,238, 97,128,
- 48, 92,235,225,244,225,235,225,238, 97,128, 48,188,242,111,140,
- 0, 48,217, 10,217, 19,217, 29,217, 36,217, 61,217, 74,217, 85,
- 217, 97,217,108,217,118,217,129,217,136,225,242,225,226,233, 99,
- 128, 6, 96,226,229,238,231,225,236,105,128, 9,230,228,229,246,
- 97,128, 9,102,231,117, 2,217, 43,217, 52,234,225,242,225,244,
- 105,128, 10,230,242,237,245,235,232,105,128, 10,102,232,225,227,
- 235,225,242,225,226,233, 99,128, 6, 96,233,238,230,229,242,233,
- 239,114,128, 32,128,237,239,238,239,243,240,225,227,101,128,255,
- 16,239,236,228,243,244,249,236,101,128,247, 48,240,229,242,243,
- 233,225,110,128, 6,240,243,245,240,229,242,233,239,114,128, 32,
- 112,244,232,225,105,128, 14, 80,247,233,228,244,104, 3,217,148,
- 217,157,217,169,234,239,233,238,229,114,128,254,255,238,239,238,
- 234,239,233,238,229,114,128, 32, 12,243,240,225,227,101,128, 32,
- 11,244, 97,128, 3,182,104, 2,217,188,217,199,226,239,240,239,
- 237,239,230,111,128, 49, 19,101, 4,217,209,217,220,217,236,217,
- 247,225,242,237,229,238,233,225,110,128, 5,106,226,242,229,246,
- 229,227,249,242,233,236,236,233, 99,128, 4,194,227,249,242,233,
- 236,236,233, 99,128, 4, 54,100, 2,217,253,218, 16,229,243,227,
- 229,238,228,229,242,227,249,242,233,236,236,233, 99,128, 4,151,
- 233,229,242,229,243,233,243,227,249,242,233,236,236,233, 99,128,
- 4,221,105, 3,218, 42,218, 53,218, 64,232,233,242,225,231,225,
- 238, 97,128, 48, 88,235,225,244,225,235,225,238, 97,128, 48,184,
- 238,239,242,232,229,226,242,229,119,128, 5,174,236,233,238,229,
- 226,229,236,239,119,128, 30,149,237,239,238,239,243,240,225,227,
- 101,128,255, 90,111, 2,218,106,218,117,232,233,242,225,231,225,
- 238, 97,128, 48, 94,235,225,244,225,235,225,238, 97,128, 48,190,
- 240,225,242,229,110,128, 36,181,242,229,244,242,239,230,236,229,
- 248,232,239,239,107,128, 2,144,243,244,242,239,235,101,128, 1,
- 182,117, 2,218,167,218,178,232,233,242,225,231,225,238, 97,128,
- 48, 90,235,225,244,225,235,225,238, 97,128, 48,186
- };
-
-
- /*
- * This function searches the compressed table efficiently.
- */
- static unsigned long
- ft_get_adobe_glyph_index( const char* name,
- const char* limit )
- {
- int c = 0;
- int count, min, max;
- const unsigned char* p = ft_adobe_glyph_list;
-
-
- if ( name == 0 || name >= limit )
- goto NotFound;
-
- c = *name++;
- count = p[1];
- p += 2;
-
- min = 0;
- max = count;
-
- while ( min < max )
- {
- int mid = ( min + max ) >> 1;
- const unsigned char* q = p + mid * 2;
- int c2;
-
-
- q = ft_adobe_glyph_list + ( ( (int)q[0] << 8 ) | q[1] );
-
- c2 = q[0] & 127;
- if ( c2 == c )
- {
- p = q;
- goto Found;
- }
- if ( c2 < c )
- min = mid + 1;
- else
- max = mid;
- }
- goto NotFound;
-
- Found:
- for (;;)
- {
- /* assert (*p & 127) == c */
-
- if ( name >= limit )
- {
- if ( (p[0] & 128) == 0 &&
- (p[1] & 128) != 0 )
- return (unsigned long)( ( (int)p[2] << 8 ) | p[3] );
-
- goto NotFound;
- }
- c = *name++;
- if ( p[0] & 128 )
- {
- p++;
- if ( c != (p[0] & 127) )
- goto NotFound;
-
- continue;
- }
-
- p++;
- count = p[0] & 127;
- if ( p[0] & 128 )
- p += 2;
-
- p++;
-
- for ( ; count > 0; count--, p += 2 )
- {
- int offset = ( (int)p[0] << 8 ) | p[1];
- const unsigned char* q = ft_adobe_glyph_list + offset;
-
- if ( c == ( q[0] & 127 ) )
- {
- p = q;
- goto NextIter;
- }
- }
- goto NotFound;
-
- NextIter:
- ;
- }
-
- NotFound:
- return 0;
- }
-
-#endif /* FT_CONFIG_OPTION_ADOBE_GLYPH_LIST */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/raster/Jamfile b/chromium/third_party/pdfium/third_party/freetype/src/raster/Jamfile
deleted file mode 100644
index 71df5689eeb..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/raster/Jamfile
+++ /dev/null
@@ -1,32 +0,0 @@
-# FreeType 2 src/raster Jamfile
-#
-# Copyright 2001-2015 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT. By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-SubDir FT2_TOP $(FT2_SRC_DIR) raster ;
-
-{
- local _sources ;
-
- if $(FT2_MULTI)
- {
- _sources = ftraster
- ftrend1
- rastpic
- ;
- }
- else
- {
- _sources = raster ;
- }
-
- Library $(FT2_LIB) : $(_sources).c ;
-}
-
-# end of src/raster Jamfile
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/raster/ftmisc.h b/chromium/third_party/pdfium/third_party/freetype/src/raster/ftmisc.h
deleted file mode 100644
index b87e0b62b72..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/raster/ftmisc.h
+++ /dev/null
@@ -1,142 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftmisc.h */
-/* */
-/* Miscellaneous macros for stand-alone rasterizer (specification */
-/* only). */
-/* */
-/* Copyright 2005-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used */
-/* modified and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
- /***************************************************/
- /* */
- /* This file is *not* portable! You have to adapt */
- /* its definitions to your platform. */
- /* */
- /***************************************************/
-
-#ifndef __FTMISC_H__
-#define __FTMISC_H__
-
-
- /* memset */
-#include FT_CONFIG_STANDARD_LIBRARY_H
-
-#define FT_BEGIN_HEADER
-#define FT_END_HEADER
-
-#define FT_LOCAL_DEF( x ) static x
-
-
- /* from include/freetype/fttypes.h */
-
- typedef unsigned char FT_Byte;
- typedef signed int FT_Int;
- typedef unsigned int FT_UInt;
- typedef signed long FT_Long;
- typedef unsigned long FT_ULong;
- typedef signed long FT_F26Dot6;
- typedef int FT_Error;
-
-#define FT_MAKE_TAG( _x1, _x2, _x3, _x4 ) \
- ( ( (FT_ULong)_x1 << 24 ) | \
- ( (FT_ULong)_x2 << 16 ) | \
- ( (FT_ULong)_x3 << 8 ) | \
- (FT_ULong)_x4 )
-
-
- /* from include/freetype/ftsystem.h */
-
- typedef struct FT_MemoryRec_* FT_Memory;
-
- typedef void* (*FT_Alloc_Func)( FT_Memory memory,
- long size );
-
- typedef void (*FT_Free_Func)( FT_Memory memory,
- void* block );
-
- typedef void* (*FT_Realloc_Func)( FT_Memory memory,
- long cur_size,
- long new_size,
- void* block );
-
- typedef struct FT_MemoryRec_
- {
- void* user;
-
- FT_Alloc_Func alloc;
- FT_Free_Func free;
- FT_Realloc_Func realloc;
-
- } FT_MemoryRec;
-
-
- /* from src/ftcalc.c */
-
-#if ( defined _WIN32 || defined _WIN64 )
-
- typedef __int64 FT_Int64;
-
-#else
-
-#include "inttypes.h"
-
- typedef int64_t FT_Int64;
-
-#endif
-
-
- static FT_Long
- FT_MulDiv( FT_Long a,
- FT_Long b,
- FT_Long c )
- {
- FT_Int s;
- FT_Long d;
-
-
- s = 1;
- if ( a < 0 ) { a = -a; s = -1; }
- if ( b < 0 ) { b = -b; s = -s; }
- if ( c < 0 ) { c = -c; s = -s; }
-
- d = (FT_Long)( c > 0 ? ( (FT_Int64)a * b + ( c >> 1 ) ) / c
- : 0x7FFFFFFFL );
-
- return ( s > 0 ) ? d : -d;
- }
-
-
- static FT_Long
- FT_MulDiv_No_Round( FT_Long a,
- FT_Long b,
- FT_Long c )
- {
- FT_Int s;
- FT_Long d;
-
-
- s = 1;
- if ( a < 0 ) { a = -a; s = -1; }
- if ( b < 0 ) { b = -b; s = -s; }
- if ( c < 0 ) { c = -c; s = -s; }
-
- d = (FT_Long)( c > 0 ? (FT_Int64)a * b / c
- : 0x7FFFFFFFL );
-
- return ( s > 0 ) ? d : -d;
- }
-
-#endif /* __FTMISC_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/raster/ftraster.c b/chromium/third_party/pdfium/third_party/freetype/src/raster/ftraster.c
deleted file mode 100644
index e4bab987285..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/raster/ftraster.c
+++ /dev/null
@@ -1,3200 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftraster.c */
-/* */
-/* The FreeType glyph rasterizer (body). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
- /*************************************************************************/
- /* */
- /* This file can be compiled without the rest of the FreeType engine, by */
- /* defining the _STANDALONE_ macro when compiling it. You also need to */
- /* put the files `ftimage.h' and `ftmisc.h' into the $(incdir) */
- /* directory. Typically, you should do something like */
- /* */
- /* - copy `src/raster/ftraster.c' (this file) to your current directory */
- /* */
- /* - copy `include/freetype/ftimage.h' and `src/raster/ftmisc.h' to your */
- /* current directory */
- /* */
- /* - compile `ftraster' with the _STANDALONE_ macro defined, as in */
- /* */
- /* cc -c -D_STANDALONE_ ftraster.c */
- /* */
- /* The renderer can be initialized with a call to */
- /* `ft_standard_raster.raster_new'; a bitmap can be generated */
- /* with a call to `ft_standard_raster.raster_render'. */
- /* */
- /* See the comments and documentation in the file `ftimage.h' for more */
- /* details on how the raster works. */
- /* */
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* This is a rewrite of the FreeType 1.x scan-line converter */
- /* */
- /*************************************************************************/
-
-#ifdef _STANDALONE_
-
- /* The size in bytes of the render pool used by the scan-line converter */
- /* to do all of its work. */
-#define FT_RENDER_POOL_SIZE 16384L
-
-#define FT_CONFIG_STANDARD_LIBRARY_H <stdlib.h>
-
-#include <string.h> /* for memset */
-
-#include "ftmisc.h"
-#include "ftimage.h"
-
-#else /* !_STANDALONE_ */
-
-#include <ft2build.h>
-#include "ftraster.h"
-#include FT_INTERNAL_CALC_H /* for FT_MulDiv and FT_MulDiv_No_Round */
-
-#include "rastpic.h"
-
-#endif /* !_STANDALONE_ */
-
-
- /*************************************************************************/
- /* */
- /* A simple technical note on how the raster works */
- /* ----------------------------------------------- */
- /* */
- /* Converting an outline into a bitmap is achieved in several steps: */
- /* */
- /* 1 - Decomposing the outline into successive `profiles'. Each */
- /* profile is simply an array of scanline intersections on a given */
- /* dimension. A profile's main attributes are */
- /* */
- /* o its scanline position boundaries, i.e. `Ymin' and `Ymax' */
- /* */
- /* o an array of intersection coordinates for each scanline */
- /* between `Ymin' and `Ymax' */
- /* */
- /* o a direction, indicating whether it was built going `up' or */
- /* `down', as this is very important for filling rules */
- /* */
- /* o its drop-out mode */
- /* */
- /* 2 - Sweeping the target map's scanlines in order to compute segment */
- /* `spans' which are then filled. Additionally, this pass */
- /* performs drop-out control. */
- /* */
- /* The outline data is parsed during step 1 only. The profiles are */
- /* built from the bottom of the render pool, used as a stack. The */
- /* following graphics shows the profile list under construction: */
- /* */
- /* __________________________________________________________ _ _ */
- /* | | | | | */
- /* | profile | coordinates for | profile | coordinates for |--> */
- /* | 1 | profile 1 | 2 | profile 2 |--> */
- /* |_________|_________________|_________|_________________|__ _ _ */
- /* */
- /* ^ ^ */
- /* | | */
- /* start of render pool top */
- /* */
- /* The top of the profile stack is kept in the `top' variable. */
- /* */
- /* As you can see, a profile record is pushed on top of the render */
- /* pool, which is then followed by its coordinates/intersections. If */
- /* a change of direction is detected in the outline, a new profile is */
- /* generated until the end of the outline. */
- /* */
- /* Note that when all profiles have been generated, the function */
- /* Finalize_Profile_Table() is used to record, for each profile, its */
- /* bottom-most scanline as well as the scanline above its upmost */
- /* boundary. These positions are called `y-turns' because they (sort */
- /* of) correspond to local extrema. They are stored in a sorted list */
- /* built from the top of the render pool as a downwards stack: */
- /* */
- /* _ _ _______________________________________ */
- /* | | */
- /* <--| sorted list of | */
- /* <--| extrema scanlines | */
- /* _ _ __________________|____________________| */
- /* */
- /* ^ ^ */
- /* | | */
- /* maxBuff sizeBuff = end of pool */
- /* */
- /* This list is later used during the sweep phase in order to */
- /* optimize performance (see technical note on the sweep below). */
- /* */
- /* Of course, the raster detects whether the two stacks collide and */
- /* handles the situation properly. */
- /* */
- /*************************************************************************/
-
-
- /*************************************************************************/
- /*************************************************************************/
- /** **/
- /** CONFIGURATION MACROS **/
- /** **/
- /*************************************************************************/
- /*************************************************************************/
-
- /* define DEBUG_RASTER if you want to compile a debugging version */
-/* #define DEBUG_RASTER */
-
-
- /*************************************************************************/
- /*************************************************************************/
- /** **/
- /** OTHER MACROS (do not change) **/
- /** **/
- /*************************************************************************/
- /*************************************************************************/
-
- /*************************************************************************/
- /* */
- /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
- /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
- /* messages during execution. */
- /* */
-#undef FT_COMPONENT
-#define FT_COMPONENT trace_raster
-
-
-#ifdef _STANDALONE_
-
- /* Auxiliary macros for token concatenation. */
-#define FT_ERR_XCAT( x, y ) x ## y
-#define FT_ERR_CAT( x, y ) FT_ERR_XCAT( x, y )
-
-#define FT_MAX( a, b ) ( (a) > (b) ? (a) : (b) )
-
- /* This macro is used to indicate that a function parameter is unused. */
- /* Its purpose is simply to reduce compiler warnings. Note also that */
- /* simply defining it as `(void)x' doesn't avoid warnings with certain */
- /* ANSI compilers (e.g. LCC). */
-#define FT_UNUSED( x ) (x) = (x)
-
- /* Disable the tracing mechanism for simplicity -- developers can */
- /* activate it easily by redefining these macros. */
-#ifndef FT_ERROR
-#define FT_ERROR( x ) do { } while ( 0 ) /* nothing */
-#endif
-
-#ifndef FT_TRACE
-#define FT_TRACE( x ) do { } while ( 0 ) /* nothing */
-#define FT_TRACE1( x ) do { } while ( 0 ) /* nothing */
-#define FT_TRACE6( x ) do { } while ( 0 ) /* nothing */
-#define FT_TRACE7( x ) do { } while ( 0 ) /* nothing */
-#endif
-
-#ifndef FT_THROW
-#define FT_THROW( e ) FT_ERR_CAT( Raster_Err_, e )
-#endif
-
-#define Raster_Err_None 0
-#define Raster_Err_Not_Ini -1
-#define Raster_Err_Overflow -2
-#define Raster_Err_Neg_Height -3
-#define Raster_Err_Invalid -4
-#define Raster_Err_Unsupported -5
-
-#define ft_memset memset
-
-#define FT_DEFINE_RASTER_FUNCS( class_, glyph_format_, raster_new_, \
- raster_reset_, raster_set_mode_, \
- raster_render_, raster_done_ ) \
- const FT_Raster_Funcs class_ = \
- { \
- glyph_format_, \
- raster_new_, \
- raster_reset_, \
- raster_set_mode_, \
- raster_render_, \
- raster_done_ \
- };
-
-#else /* !_STANDALONE_ */
-
-
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_DEBUG_H /* for FT_TRACE, FT_ERROR, and FT_THROW */
-
-#include "rasterrs.h"
-
-#define Raster_Err_None FT_Err_Ok
-#define Raster_Err_Not_Ini Raster_Err_Raster_Uninitialized
-#define Raster_Err_Overflow Raster_Err_Raster_Overflow
-#define Raster_Err_Neg_Height Raster_Err_Raster_Negative_Height
-#define Raster_Err_Invalid Raster_Err_Invalid_Outline
-#define Raster_Err_Unsupported Raster_Err_Cannot_Render_Glyph
-
-
-#endif /* !_STANDALONE_ */
-
-
-#ifndef FT_MEM_SET
-#define FT_MEM_SET( d, s, c ) ft_memset( d, s, c )
-#endif
-
-#ifndef FT_MEM_ZERO
-#define FT_MEM_ZERO( dest, count ) FT_MEM_SET( dest, 0, count )
-#endif
-
- /* FMulDiv means `Fast MulDiv'; it is used in case where `b' is */
- /* typically a small value and the result of a*b is known to fit into */
- /* 32 bits. */
-#define FMulDiv( a, b, c ) ( (a) * (b) / (c) )
-
- /* On the other hand, SMulDiv means `Slow MulDiv', and is used typically */
- /* for clipping computations. It simply uses the FT_MulDiv() function */
- /* defined in `ftcalc.h'. */
-#define SMulDiv FT_MulDiv
-#define SMulDiv_No_Round FT_MulDiv_No_Round
-
- /* The rasterizer is a very general purpose component; please leave */
- /* the following redefinitions there (you never know your target */
- /* environment). */
-
-#ifndef TRUE
-#define TRUE 1
-#endif
-
-#ifndef FALSE
-#define FALSE 0
-#endif
-
-#ifndef NULL
-#define NULL (void*)0
-#endif
-
-#ifndef SUCCESS
-#define SUCCESS 0
-#endif
-
-#ifndef FAILURE
-#define FAILURE 1
-#endif
-
-
-#define MaxBezier 32 /* The maximum number of stacked Bezier curves. */
- /* Setting this constant to more than 32 is a */
- /* pure waste of space. */
-
-#define Pixel_Bits 6 /* fractional bits of *input* coordinates */
-
-
- /*************************************************************************/
- /*************************************************************************/
- /** **/
- /** SIMPLE TYPE DECLARATIONS **/
- /** **/
- /*************************************************************************/
- /*************************************************************************/
-
- typedef int Int;
- typedef unsigned int UInt;
- typedef short Short;
- typedef unsigned short UShort, *PUShort;
- typedef long Long, *PLong;
- typedef unsigned long ULong;
-
- typedef unsigned char Byte, *PByte;
- typedef char Bool;
-
-
- typedef union Alignment_
- {
- Long l;
- void* p;
- void (*f)(void);
-
- } Alignment, *PAlignment;
-
-
- typedef struct TPoint_
- {
- Long x;
- Long y;
-
- } TPoint;
-
-
- /* values for the `flags' bit field */
-#define Flow_Up 0x08U
-#define Overshoot_Top 0x10U
-#define Overshoot_Bottom 0x20U
-
-
- /* States of each line, arc, and profile */
- typedef enum TStates_
- {
- Unknown_State,
- Ascending_State,
- Descending_State,
- Flat_State
-
- } TStates;
-
-
- typedef struct TProfile_ TProfile;
- typedef TProfile* PProfile;
-
- struct TProfile_
- {
- FT_F26Dot6 X; /* current coordinate during sweep */
- PProfile link; /* link to next profile (various purposes) */
- PLong offset; /* start of profile's data in render pool */
- UShort flags; /* Bit 0-2: drop-out mode */
- /* Bit 3: profile orientation (up/down) */
- /* Bit 4: is top profile? */
- /* Bit 5: is bottom profile? */
- Long height; /* profile's height in scanlines */
- Long start; /* profile's starting scanline */
-
- Int countL; /* number of lines to step before this */
- /* profile becomes drawable */
-
- PProfile next; /* next profile in same contour, used */
- /* during drop-out control */
- };
-
- typedef PProfile TProfileList;
- typedef PProfile* PProfileList;
-
-
- /* Simple record used to implement a stack of bands, required */
- /* by the sub-banding mechanism */
- typedef struct black_TBand_
- {
- Short y_min; /* band's minimum */
- Short y_max; /* band's maximum */
-
- } black_TBand;
-
-
-#define AlignProfileSize \
- ( ( sizeof ( TProfile ) + sizeof ( Alignment ) - 1 ) / sizeof ( Long ) )
-
-
-#undef RAS_ARG
-#undef RAS_ARGS
-#undef RAS_VAR
-#undef RAS_VARS
-
-#ifdef FT_STATIC_RASTER
-
-
-#define RAS_ARGS /* void */
-#define RAS_ARG /* void */
-
-#define RAS_VARS /* void */
-#define RAS_VAR /* void */
-
-#define FT_UNUSED_RASTER do { } while ( 0 )
-
-
-#else /* !FT_STATIC_RASTER */
-
-
-#define RAS_ARGS black_PWorker worker,
-#define RAS_ARG black_PWorker worker
-
-#define RAS_VARS worker,
-#define RAS_VAR worker
-
-#define FT_UNUSED_RASTER FT_UNUSED( worker )
-
-
-#endif /* !FT_STATIC_RASTER */
-
-
- typedef struct black_TWorker_ black_TWorker, *black_PWorker;
-
-
- /* prototypes used for sweep function dispatch */
- typedef void
- Function_Sweep_Init( RAS_ARGS Short* min,
- Short* max );
-
- typedef void
- Function_Sweep_Span( RAS_ARGS Short y,
- FT_F26Dot6 x1,
- FT_F26Dot6 x2,
- PProfile left,
- PProfile right );
-
- typedef void
- Function_Sweep_Step( RAS_ARG );
-
-
- /* NOTE: These operations are only valid on 2's complement processors */
-#undef FLOOR
-#undef CEILING
-#undef TRUNC
-#undef SCALED
-
-#define FLOOR( x ) ( (x) & -ras.precision )
-#define CEILING( x ) ( ( (x) + ras.precision - 1 ) & -ras.precision )
-#define TRUNC( x ) ( (Long)(x) >> ras.precision_bits )
-#define FRAC( x ) ( (x) & ( ras.precision - 1 ) )
-#define SCALED( x ) ( ( (x) < 0 ? -( -(x) << ras.scale_shift ) \
- : ( (x) << ras.scale_shift ) ) \
- - ras.precision_half )
-
-#define IS_BOTTOM_OVERSHOOT( x ) \
- (Bool)( CEILING( x ) - x >= ras.precision_half )
-#define IS_TOP_OVERSHOOT( x ) \
- (Bool)( x - FLOOR( x ) >= ras.precision_half )
-
- /* The most used variables are positioned at the top of the structure. */
- /* Thus, their offset can be coded with less opcodes, resulting in a */
- /* smaller executable. */
-
- struct black_TWorker_
- {
- Int precision_bits; /* precision related variables */
- Int precision;
- Int precision_half;
- Int precision_shift;
- Int precision_step;
- Int precision_jitter;
-
- Int scale_shift; /* == precision_shift for bitmaps */
- /* == precision_shift+1 for pixmaps */
-
- PLong buff; /* The profiles buffer */
- PLong sizeBuff; /* Render pool size */
- PLong maxBuff; /* Profiles buffer size */
- PLong top; /* Current cursor in buffer */
-
- FT_Error error;
-
- Int numTurns; /* number of Y-turns in outline */
-
- TPoint* arc; /* current Bezier arc pointer */
-
- UShort bWidth; /* target bitmap width */
- PByte bTarget; /* target bitmap buffer */
- PByte gTarget; /* target pixmap buffer */
-
- Long lastX, lastY;
- Long minY, maxY;
-
- UShort num_Profs; /* current number of profiles */
-
- Bool fresh; /* signals a fresh new profile which */
- /* `start' field must be completed */
- Bool joint; /* signals that the last arc ended */
- /* exactly on a scanline. Allows */
- /* removal of doublets */
- PProfile cProfile; /* current profile */
- PProfile fProfile; /* head of linked list of profiles */
- PProfile gProfile; /* contour's first profile in case */
- /* of impact */
-
- TStates state; /* rendering state */
-
- FT_Bitmap target; /* description of target bit/pixmap */
- FT_Outline outline;
-
- Long traceOfs; /* current offset in target bitmap */
- Long traceG; /* current offset in target pixmap */
-
- Short traceIncr; /* sweep's increment in target bitmap */
-
- /* dispatch variables */
-
- Function_Sweep_Init* Proc_Sweep_Init;
- Function_Sweep_Span* Proc_Sweep_Span;
- Function_Sweep_Span* Proc_Sweep_Drop;
- Function_Sweep_Step* Proc_Sweep_Step;
-
- Byte dropOutControl; /* current drop_out control method */
-
- Bool second_pass; /* indicates whether a horizontal pass */
- /* should be performed to control */
- /* drop-out accurately when calling */
- /* Render_Glyph. */
-
- TPoint arcs[3 * MaxBezier + 1]; /* The Bezier stack */
-
- black_TBand band_stack[16]; /* band stack used for sub-banding */
- Int band_top; /* band stack top */
-
- };
-
-
- typedef struct black_TRaster_
- {
- void* memory;
-
- } black_TRaster, *black_PRaster;
-
-#ifdef FT_STATIC_RASTER
-
- static black_TWorker cur_ras;
-#define ras cur_ras
-
-#else /* !FT_STATIC_RASTER */
-
-#define ras (*worker)
-
-#endif /* !FT_STATIC_RASTER */
-
-
- /*************************************************************************/
- /*************************************************************************/
- /** **/
- /** PROFILES COMPUTATION **/
- /** **/
- /*************************************************************************/
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* Set_High_Precision */
- /* */
- /* <Description> */
- /* Set precision variables according to param flag. */
- /* */
- /* <Input> */
- /* High :: Set to True for high precision (typically for ppem < 24), */
- /* false otherwise. */
- /* */
- static void
- Set_High_Precision( RAS_ARGS Int High )
- {
- /*
- * `precision_step' is used in `Bezier_Up' to decide when to split a
- * given y-monotonous Bezier arc that crosses a scanline before
- * approximating it as a straight segment. The default value of 32 (for
- * low accuracy) corresponds to
- *
- * 32 / 64 == 0.5 pixels,
- *
- * while for the high accuracy case we have
- *
- * 256 / (1 << 12) = 0.0625 pixels.
- *
- * `precision_jitter' is an epsilon threshold used in
- * `Vertical_Sweep_Span' to deal with small imperfections in the Bezier
- * decomposition (after all, we are working with approximations only);
- * it avoids switching on additional pixels which would cause artifacts
- * otherwise.
- *
- * The value of `precision_jitter' has been determined heuristically.
- *
- */
-
- if ( High )
- {
- ras.precision_bits = 12;
- ras.precision_step = 256;
- ras.precision_jitter = 30;
- }
- else
- {
- ras.precision_bits = 6;
- ras.precision_step = 32;
- ras.precision_jitter = 2;
- }
-
- FT_TRACE6(( "Set_High_Precision(%s)\n", High ? "true" : "false" ));
-
- ras.precision = 1 << ras.precision_bits;
- ras.precision_half = ras.precision / 2;
- ras.precision_shift = ras.precision_bits - Pixel_Bits;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* New_Profile */
- /* */
- /* <Description> */
- /* Create a new profile in the render pool. */
- /* */
- /* <Input> */
- /* aState :: The state/orientation of the new profile. */
- /* */
- /* overshoot :: Whether the profile's unrounded start position */
- /* differs by at least a half pixel. */
- /* */
- /* <Return> */
- /* SUCCESS on success. FAILURE in case of overflow or of incoherent */
- /* profile. */
- /* */
- static Bool
- New_Profile( RAS_ARGS TStates aState,
- Bool overshoot )
- {
- if ( !ras.fProfile )
- {
- ras.cProfile = (PProfile)ras.top;
- ras.fProfile = ras.cProfile;
- ras.top += AlignProfileSize;
- }
-
- if ( ras.top >= ras.maxBuff )
- {
- ras.error = FT_THROW( Overflow );
- return FAILURE;
- }
-
- ras.cProfile->flags = 0;
- ras.cProfile->start = 0;
- ras.cProfile->height = 0;
- ras.cProfile->offset = ras.top;
- ras.cProfile->link = (PProfile)0;
- ras.cProfile->next = (PProfile)0;
- ras.cProfile->flags = ras.dropOutControl;
-
- switch ( aState )
- {
- case Ascending_State:
- ras.cProfile->flags |= Flow_Up;
- if ( overshoot )
- ras.cProfile->flags |= Overshoot_Bottom;
-
- FT_TRACE6(( " new ascending profile = %p\n", ras.cProfile ));
- break;
-
- case Descending_State:
- if ( overshoot )
- ras.cProfile->flags |= Overshoot_Top;
- FT_TRACE6(( " new descending profile = %p\n", ras.cProfile ));
- break;
-
- default:
- FT_ERROR(( "New_Profile: invalid profile direction\n" ));
- ras.error = FT_THROW( Invalid );
- return FAILURE;
- }
-
- if ( !ras.gProfile )
- ras.gProfile = ras.cProfile;
-
- ras.state = aState;
- ras.fresh = TRUE;
- ras.joint = FALSE;
-
- return SUCCESS;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* End_Profile */
- /* */
- /* <Description> */
- /* Finalize the current profile. */
- /* */
- /* <Input> */
- /* overshoot :: Whether the profile's unrounded end position differs */
- /* by at least a half pixel. */
- /* */
- /* <Return> */
- /* SUCCESS on success. FAILURE in case of overflow or incoherency. */
- /* */
- static Bool
- End_Profile( RAS_ARGS Bool overshoot )
- {
- Long h;
-
-
- h = (Long)( ras.top - ras.cProfile->offset );
-
- if ( h < 0 )
- {
- FT_ERROR(( "End_Profile: negative height encountered\n" ));
- ras.error = FT_THROW( Neg_Height );
- return FAILURE;
- }
-
- if ( h > 0 )
- {
- PProfile oldProfile;
-
-
- FT_TRACE6(( " ending profile %p, start = %ld, height = %ld\n",
- ras.cProfile, ras.cProfile->start, h ));
-
- ras.cProfile->height = h;
- if ( overshoot )
- {
- if ( ras.cProfile->flags & Flow_Up )
- ras.cProfile->flags |= Overshoot_Top;
- else
- ras.cProfile->flags |= Overshoot_Bottom;
- }
-
- oldProfile = ras.cProfile;
- ras.cProfile = (PProfile)ras.top;
-
- ras.top += AlignProfileSize;
-
- ras.cProfile->height = 0;
- ras.cProfile->offset = ras.top;
-
- oldProfile->next = ras.cProfile;
- ras.num_Profs++;
- }
-
- if ( ras.top >= ras.maxBuff )
- {
- FT_TRACE1(( "overflow in End_Profile\n" ));
- ras.error = FT_THROW( Overflow );
- return FAILURE;
- }
-
- ras.joint = FALSE;
-
- return SUCCESS;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* Insert_Y_Turn */
- /* */
- /* <Description> */
- /* Insert a salient into the sorted list placed on top of the render */
- /* pool. */
- /* */
- /* <Input> */
- /* New y scanline position. */
- /* */
- /* <Return> */
- /* SUCCESS on success. FAILURE in case of overflow. */
- /* */
- static Bool
- Insert_Y_Turn( RAS_ARGS Int y )
- {
- PLong y_turns;
- Int n;
-
-
- n = ras.numTurns - 1;
- y_turns = ras.sizeBuff - ras.numTurns;
-
- /* look for first y value that is <= */
- while ( n >= 0 && y < y_turns[n] )
- n--;
-
- /* if it is <, simply insert it, ignore if == */
- if ( n >= 0 && y > y_turns[n] )
- do
- {
- Int y2 = (Int)y_turns[n];
-
-
- y_turns[n] = y;
- y = y2;
- } while ( --n >= 0 );
-
- if ( n < 0 )
- {
- ras.maxBuff--;
- if ( ras.maxBuff <= ras.top )
- {
- ras.error = FT_THROW( Overflow );
- return FAILURE;
- }
- ras.numTurns++;
- ras.sizeBuff[-ras.numTurns] = y;
- }
-
- return SUCCESS;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* Finalize_Profile_Table */
- /* */
- /* <Description> */
- /* Adjust all links in the profiles list. */
- /* */
- /* <Return> */
- /* SUCCESS on success. FAILURE in case of overflow. */
- /* */
- static Bool
- Finalize_Profile_Table( RAS_ARG )
- {
- UShort n;
- PProfile p;
-
-
- n = ras.num_Profs;
- p = ras.fProfile;
-
- if ( n > 1 && p )
- {
- do
- {
- Int bottom, top;
-
-
- if ( n > 1 )
- p->link = (PProfile)( p->offset + p->height );
- else
- p->link = NULL;
-
- if ( p->flags & Flow_Up )
- {
- bottom = (Int)p->start;
- top = (Int)( p->start + p->height - 1 );
- }
- else
- {
- bottom = (Int)( p->start - p->height + 1 );
- top = (Int)p->start;
- p->start = bottom;
- p->offset += p->height - 1;
- }
-
- if ( Insert_Y_Turn( RAS_VARS bottom ) ||
- Insert_Y_Turn( RAS_VARS top + 1 ) )
- return FAILURE;
-
- p = p->link;
- } while ( --n );
- }
- else
- ras.fProfile = NULL;
-
- return SUCCESS;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* Split_Conic */
- /* */
- /* <Description> */
- /* Subdivide one conic Bezier into two joint sub-arcs in the Bezier */
- /* stack. */
- /* */
- /* <Input> */
- /* None (subdivided Bezier is taken from the top of the stack). */
- /* */
- /* <Note> */
- /* This routine is the `beef' of this component. It is _the_ inner */
- /* loop that should be optimized to hell to get the best performance. */
- /* */
- static void
- Split_Conic( TPoint* base )
- {
- Long a, b;
-
-
- base[4].x = base[2].x;
- b = base[1].x;
- a = base[3].x = ( base[2].x + b ) / 2;
- b = base[1].x = ( base[0].x + b ) / 2;
- base[2].x = ( a + b ) / 2;
-
- base[4].y = base[2].y;
- b = base[1].y;
- a = base[3].y = ( base[2].y + b ) / 2;
- b = base[1].y = ( base[0].y + b ) / 2;
- base[2].y = ( a + b ) / 2;
-
- /* hand optimized. gcc doesn't seem to be too good at common */
- /* expression substitution and instruction scheduling ;-) */
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* Split_Cubic */
- /* */
- /* <Description> */
- /* Subdivide a third-order Bezier arc into two joint sub-arcs in the */
- /* Bezier stack. */
- /* */
- /* <Note> */
- /* This routine is the `beef' of the component. It is one of _the_ */
- /* inner loops that should be optimized like hell to get the best */
- /* performance. */
- /* */
- static void
- Split_Cubic( TPoint* base )
- {
- Long a, b, c, d;
-
-
- base[6].x = base[3].x;
- c = base[1].x;
- d = base[2].x;
- base[1].x = a = ( base[0].x + c + 1 ) >> 1;
- base[5].x = b = ( base[3].x + d + 1 ) >> 1;
- c = ( c + d + 1 ) >> 1;
- base[2].x = a = ( a + c + 1 ) >> 1;
- base[4].x = b = ( b + c + 1 ) >> 1;
- base[3].x = ( a + b + 1 ) >> 1;
-
- base[6].y = base[3].y;
- c = base[1].y;
- d = base[2].y;
- base[1].y = a = ( base[0].y + c + 1 ) >> 1;
- base[5].y = b = ( base[3].y + d + 1 ) >> 1;
- c = ( c + d + 1 ) >> 1;
- base[2].y = a = ( a + c + 1 ) >> 1;
- base[4].y = b = ( b + c + 1 ) >> 1;
- base[3].y = ( a + b + 1 ) >> 1;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* Line_Up */
- /* */
- /* <Description> */
- /* Compute the x-coordinates of an ascending line segment and store */
- /* them in the render pool. */
- /* */
- /* <Input> */
- /* x1 :: The x-coordinate of the segment's start point. */
- /* */
- /* y1 :: The y-coordinate of the segment's start point. */
- /* */
- /* x2 :: The x-coordinate of the segment's end point. */
- /* */
- /* y2 :: The y-coordinate of the segment's end point. */
- /* */
- /* miny :: A lower vertical clipping bound value. */
- /* */
- /* maxy :: An upper vertical clipping bound value. */
- /* */
- /* <Return> */
- /* SUCCESS on success, FAILURE on render pool overflow. */
- /* */
- static Bool
- Line_Up( RAS_ARGS Long x1,
- Long y1,
- Long x2,
- Long y2,
- Long miny,
- Long maxy )
- {
- Long Dx, Dy;
- Int e1, e2, f1, f2, size; /* XXX: is `Short' sufficient? */
- Long Ix, Rx, Ax;
-
- PLong top;
-
-
- Dx = x2 - x1;
- Dy = y2 - y1;
-
- if ( Dy <= 0 || y2 < miny || y1 > maxy )
- return SUCCESS;
-
- if ( y1 < miny )
- {
- /* Take care: miny-y1 can be a very large value; we use */
- /* a slow MulDiv function to avoid clipping bugs */
- x1 += SMulDiv( Dx, miny - y1, Dy );
- e1 = (Int)TRUNC( miny );
- f1 = 0;
- }
- else
- {
- e1 = (Int)TRUNC( y1 );
- f1 = (Int)FRAC( y1 );
- }
-
- if ( y2 > maxy )
- {
- /* x2 += FMulDiv( Dx, maxy - y2, Dy ); UNNECESSARY */
- e2 = (Int)TRUNC( maxy );
- f2 = 0;
- }
- else
- {
- e2 = (Int)TRUNC( y2 );
- f2 = (Int)FRAC( y2 );
- }
-
- if ( f1 > 0 )
- {
- if ( e1 == e2 )
- return SUCCESS;
- else
- {
- x1 += SMulDiv( Dx, ras.precision - f1, Dy );
- e1 += 1;
- }
- }
- else
- if ( ras.joint )
- {
- ras.top--;
- ras.joint = FALSE;
- }
-
- ras.joint = (char)( f2 == 0 );
-
- if ( ras.fresh )
- {
- ras.cProfile->start = e1;
- ras.fresh = FALSE;
- }
-
- size = e2 - e1 + 1;
- if ( ras.top + size >= ras.maxBuff )
- {
- ras.error = FT_THROW( Overflow );
- return FAILURE;
- }
-
- if ( Dx > 0 )
- {
- Ix = SMulDiv_No_Round( ras.precision, Dx, Dy );
- Rx = ( ras.precision * Dx ) % Dy;
- Dx = 1;
- }
- else
- {
- Ix = -SMulDiv_No_Round( ras.precision, -Dx, Dy );
- Rx = ( ras.precision * -Dx ) % Dy;
- Dx = -1;
- }
-
- Ax = -Dy;
- top = ras.top;
-
- while ( size > 0 )
- {
- *top++ = x1;
-
- x1 += Ix;
- Ax += Rx;
- if ( Ax >= 0 )
- {
- Ax -= Dy;
- x1 += Dx;
- }
- size--;
- }
-
- ras.top = top;
- return SUCCESS;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* Line_Down */
- /* */
- /* <Description> */
- /* Compute the x-coordinates of an descending line segment and store */
- /* them in the render pool. */
- /* */
- /* <Input> */
- /* x1 :: The x-coordinate of the segment's start point. */
- /* */
- /* y1 :: The y-coordinate of the segment's start point. */
- /* */
- /* x2 :: The x-coordinate of the segment's end point. */
- /* */
- /* y2 :: The y-coordinate of the segment's end point. */
- /* */
- /* miny :: A lower vertical clipping bound value. */
- /* */
- /* maxy :: An upper vertical clipping bound value. */
- /* */
- /* <Return> */
- /* SUCCESS on success, FAILURE on render pool overflow. */
- /* */
- static Bool
- Line_Down( RAS_ARGS Long x1,
- Long y1,
- Long x2,
- Long y2,
- Long miny,
- Long maxy )
- {
- Bool result, fresh;
-
-
- fresh = ras.fresh;
-
- result = Line_Up( RAS_VARS x1, -y1, x2, -y2, -maxy, -miny );
-
- if ( fresh && !ras.fresh )
- ras.cProfile->start = -ras.cProfile->start;
-
- return result;
- }
-
-
- /* A function type describing the functions used to split Bezier arcs */
- typedef void (*TSplitter)( TPoint* base );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* Bezier_Up */
- /* */
- /* <Description> */
- /* Compute the x-coordinates of an ascending Bezier arc and store */
- /* them in the render pool. */
- /* */
- /* <Input> */
- /* degree :: The degree of the Bezier arc (either 2 or 3). */
- /* */
- /* splitter :: The function to split Bezier arcs. */
- /* */
- /* miny :: A lower vertical clipping bound value. */
- /* */
- /* maxy :: An upper vertical clipping bound value. */
- /* */
- /* <Return> */
- /* SUCCESS on success, FAILURE on render pool overflow. */
- /* */
- static Bool
- Bezier_Up( RAS_ARGS Int degree,
- TSplitter splitter,
- Long miny,
- Long maxy )
- {
- Long y1, y2, e, e2, e0;
- Short f1;
-
- TPoint* arc;
- TPoint* start_arc;
-
- PLong top;
-
-
- arc = ras.arc;
- y1 = arc[degree].y;
- y2 = arc[0].y;
- top = ras.top;
-
- if ( y2 < miny || y1 > maxy )
- goto Fin;
-
- e2 = FLOOR( y2 );
-
- if ( e2 > maxy )
- e2 = maxy;
-
- e0 = miny;
-
- if ( y1 < miny )
- e = miny;
- else
- {
- e = CEILING( y1 );
- f1 = (Short)( FRAC( y1 ) );
- e0 = e;
-
- if ( f1 == 0 )
- {
- if ( ras.joint )
- {
- top--;
- ras.joint = FALSE;
- }
-
- *top++ = arc[degree].x;
-
- e += ras.precision;
- }
- }
-
- if ( ras.fresh )
- {
- ras.cProfile->start = TRUNC( e0 );
- ras.fresh = FALSE;
- }
-
- if ( e2 < e )
- goto Fin;
-
- if ( ( top + TRUNC( e2 - e ) + 1 ) >= ras.maxBuff )
- {
- ras.top = top;
- ras.error = FT_THROW( Overflow );
- return FAILURE;
- }
-
- start_arc = arc;
-
- do
- {
- ras.joint = FALSE;
-
- y2 = arc[0].y;
-
- if ( y2 > e )
- {
- y1 = arc[degree].y;
- if ( y2 - y1 >= ras.precision_step )
- {
- splitter( arc );
- arc += degree;
- }
- else
- {
- *top++ = arc[degree].x + FMulDiv( arc[0].x - arc[degree].x,
- e - y1, y2 - y1 );
- arc -= degree;
- e += ras.precision;
- }
- }
- else
- {
- if ( y2 == e )
- {
- ras.joint = TRUE;
- *top++ = arc[0].x;
-
- e += ras.precision;
- }
- arc -= degree;
- }
- } while ( arc >= start_arc && e <= e2 );
-
- Fin:
- ras.top = top;
- ras.arc -= degree;
- return SUCCESS;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* Bezier_Down */
- /* */
- /* <Description> */
- /* Compute the x-coordinates of an descending Bezier arc and store */
- /* them in the render pool. */
- /* */
- /* <Input> */
- /* degree :: The degree of the Bezier arc (either 2 or 3). */
- /* */
- /* splitter :: The function to split Bezier arcs. */
- /* */
- /* miny :: A lower vertical clipping bound value. */
- /* */
- /* maxy :: An upper vertical clipping bound value. */
- /* */
- /* <Return> */
- /* SUCCESS on success, FAILURE on render pool overflow. */
- /* */
- static Bool
- Bezier_Down( RAS_ARGS Int degree,
- TSplitter splitter,
- Long miny,
- Long maxy )
- {
- TPoint* arc = ras.arc;
- Bool result, fresh;
-
-
- arc[0].y = -arc[0].y;
- arc[1].y = -arc[1].y;
- arc[2].y = -arc[2].y;
- if ( degree > 2 )
- arc[3].y = -arc[3].y;
-
- fresh = ras.fresh;
-
- result = Bezier_Up( RAS_VARS degree, splitter, -maxy, -miny );
-
- if ( fresh && !ras.fresh )
- ras.cProfile->start = -ras.cProfile->start;
-
- arc[0].y = -arc[0].y;
- return result;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* Line_To */
- /* */
- /* <Description> */
- /* Inject a new line segment and adjust the Profiles list. */
- /* */
- /* <Input> */
- /* x :: The x-coordinate of the segment's end point (its start point */
- /* is stored in `lastX'). */
- /* */
- /* y :: The y-coordinate of the segment's end point (its start point */
- /* is stored in `lastY'). */
- /* */
- /* <Return> */
- /* SUCCESS on success, FAILURE on render pool overflow or incorrect */
- /* profile. */
- /* */
- static Bool
- Line_To( RAS_ARGS Long x,
- Long y )
- {
- /* First, detect a change of direction */
-
- switch ( ras.state )
- {
- case Unknown_State:
- if ( y > ras.lastY )
- {
- if ( New_Profile( RAS_VARS Ascending_State,
- IS_BOTTOM_OVERSHOOT( ras.lastY ) ) )
- return FAILURE;
- }
- else
- {
- if ( y < ras.lastY )
- if ( New_Profile( RAS_VARS Descending_State,
- IS_TOP_OVERSHOOT( ras.lastY ) ) )
- return FAILURE;
- }
- break;
-
- case Ascending_State:
- if ( y < ras.lastY )
- {
- if ( End_Profile( RAS_VARS IS_TOP_OVERSHOOT( ras.lastY ) ) ||
- New_Profile( RAS_VARS Descending_State,
- IS_TOP_OVERSHOOT( ras.lastY ) ) )
- return FAILURE;
- }
- break;
-
- case Descending_State:
- if ( y > ras.lastY )
- {
- if ( End_Profile( RAS_VARS IS_BOTTOM_OVERSHOOT( ras.lastY ) ) ||
- New_Profile( RAS_VARS Ascending_State,
- IS_BOTTOM_OVERSHOOT( ras.lastY ) ) )
- return FAILURE;
- }
- break;
-
- default:
- ;
- }
-
- /* Then compute the lines */
-
- switch ( ras.state )
- {
- case Ascending_State:
- if ( Line_Up( RAS_VARS ras.lastX, ras.lastY,
- x, y, ras.minY, ras.maxY ) )
- return FAILURE;
- break;
-
- case Descending_State:
- if ( Line_Down( RAS_VARS ras.lastX, ras.lastY,
- x, y, ras.minY, ras.maxY ) )
- return FAILURE;
- break;
-
- default:
- ;
- }
-
- ras.lastX = x;
- ras.lastY = y;
-
- return SUCCESS;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* Conic_To */
- /* */
- /* <Description> */
- /* Inject a new conic arc and adjust the profile list. */
- /* */
- /* <Input> */
- /* cx :: The x-coordinate of the arc's new control point. */
- /* */
- /* cy :: The y-coordinate of the arc's new control point. */
- /* */
- /* x :: The x-coordinate of the arc's end point (its start point is */
- /* stored in `lastX'). */
- /* */
- /* y :: The y-coordinate of the arc's end point (its start point is */
- /* stored in `lastY'). */
- /* */
- /* <Return> */
- /* SUCCESS on success, FAILURE on render pool overflow or incorrect */
- /* profile. */
- /* */
- static Bool
- Conic_To( RAS_ARGS Long cx,
- Long cy,
- Long x,
- Long y )
- {
- Long y1, y2, y3, x3, ymin, ymax;
- TStates state_bez;
-
-
- ras.arc = ras.arcs;
- ras.arc[2].x = ras.lastX;
- ras.arc[2].y = ras.lastY;
- ras.arc[1].x = cx;
- ras.arc[1].y = cy;
- ras.arc[0].x = x;
- ras.arc[0].y = y;
-
- do
- {
- y1 = ras.arc[2].y;
- y2 = ras.arc[1].y;
- y3 = ras.arc[0].y;
- x3 = ras.arc[0].x;
-
- /* first, categorize the Bezier arc */
-
- if ( y1 <= y3 )
- {
- ymin = y1;
- ymax = y3;
- }
- else
- {
- ymin = y3;
- ymax = y1;
- }
-
- if ( y2 < ymin || y2 > ymax )
- {
- /* this arc has no given direction, split it! */
- Split_Conic( ras.arc );
- ras.arc += 2;
- }
- else if ( y1 == y3 )
- {
- /* this arc is flat, ignore it and pop it from the Bezier stack */
- ras.arc -= 2;
- }
- else
- {
- /* the arc is y-monotonous, either ascending or descending */
- /* detect a change of direction */
- state_bez = y1 < y3 ? Ascending_State : Descending_State;
- if ( ras.state != state_bez )
- {
- Bool o = state_bez == Ascending_State ? IS_BOTTOM_OVERSHOOT( y1 )
- : IS_TOP_OVERSHOOT( y1 );
-
-
- /* finalize current profile if any */
- if ( ras.state != Unknown_State &&
- End_Profile( RAS_VARS o ) )
- goto Fail;
-
- /* create a new profile */
- if ( New_Profile( RAS_VARS state_bez, o ) )
- goto Fail;
- }
-
- /* now call the appropriate routine */
- if ( state_bez == Ascending_State )
- {
- if ( Bezier_Up( RAS_VARS 2, Split_Conic, ras.minY, ras.maxY ) )
- goto Fail;
- }
- else
- if ( Bezier_Down( RAS_VARS 2, Split_Conic, ras.minY, ras.maxY ) )
- goto Fail;
- }
-
- } while ( ras.arc >= ras.arcs );
-
- ras.lastX = x3;
- ras.lastY = y3;
-
- return SUCCESS;
-
- Fail:
- return FAILURE;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* Cubic_To */
- /* */
- /* <Description> */
- /* Inject a new cubic arc and adjust the profile list. */
- /* */
- /* <Input> */
- /* cx1 :: The x-coordinate of the arc's first new control point. */
- /* */
- /* cy1 :: The y-coordinate of the arc's first new control point. */
- /* */
- /* cx2 :: The x-coordinate of the arc's second new control point. */
- /* */
- /* cy2 :: The y-coordinate of the arc's second new control point. */
- /* */
- /* x :: The x-coordinate of the arc's end point (its start point is */
- /* stored in `lastX'). */
- /* */
- /* y :: The y-coordinate of the arc's end point (its start point is */
- /* stored in `lastY'). */
- /* */
- /* <Return> */
- /* SUCCESS on success, FAILURE on render pool overflow or incorrect */
- /* profile. */
- /* */
- static Bool
- Cubic_To( RAS_ARGS Long cx1,
- Long cy1,
- Long cx2,
- Long cy2,
- Long x,
- Long y )
- {
- Long y1, y2, y3, y4, x4, ymin1, ymax1, ymin2, ymax2;
- TStates state_bez;
-
-
- ras.arc = ras.arcs;
- ras.arc[3].x = ras.lastX;
- ras.arc[3].y = ras.lastY;
- ras.arc[2].x = cx1;
- ras.arc[2].y = cy1;
- ras.arc[1].x = cx2;
- ras.arc[1].y = cy2;
- ras.arc[0].x = x;
- ras.arc[0].y = y;
-
- do
- {
- y1 = ras.arc[3].y;
- y2 = ras.arc[2].y;
- y3 = ras.arc[1].y;
- y4 = ras.arc[0].y;
- x4 = ras.arc[0].x;
-
- /* first, categorize the Bezier arc */
-
- if ( y1 <= y4 )
- {
- ymin1 = y1;
- ymax1 = y4;
- }
- else
- {
- ymin1 = y4;
- ymax1 = y1;
- }
-
- if ( y2 <= y3 )
- {
- ymin2 = y2;
- ymax2 = y3;
- }
- else
- {
- ymin2 = y3;
- ymax2 = y2;
- }
-
- if ( ymin2 < ymin1 || ymax2 > ymax1 )
- {
- /* this arc has no given direction, split it! */
- Split_Cubic( ras.arc );
- ras.arc += 3;
- }
- else if ( y1 == y4 )
- {
- /* this arc is flat, ignore it and pop it from the Bezier stack */
- ras.arc -= 3;
- }
- else
- {
- state_bez = ( y1 <= y4 ) ? Ascending_State : Descending_State;
-
- /* detect a change of direction */
- if ( ras.state != state_bez )
- {
- Bool o = state_bez == Ascending_State ? IS_BOTTOM_OVERSHOOT( y1 )
- : IS_TOP_OVERSHOOT( y1 );
-
-
- /* finalize current profile if any */
- if ( ras.state != Unknown_State &&
- End_Profile( RAS_VARS o ) )
- goto Fail;
-
- if ( New_Profile( RAS_VARS state_bez, o ) )
- goto Fail;
- }
-
- /* compute intersections */
- if ( state_bez == Ascending_State )
- {
- if ( Bezier_Up( RAS_VARS 3, Split_Cubic, ras.minY, ras.maxY ) )
- goto Fail;
- }
- else
- if ( Bezier_Down( RAS_VARS 3, Split_Cubic, ras.minY, ras.maxY ) )
- goto Fail;
- }
-
- } while ( ras.arc >= ras.arcs );
-
- ras.lastX = x4;
- ras.lastY = y4;
-
- return SUCCESS;
-
- Fail:
- return FAILURE;
- }
-
-
-#undef SWAP_
-#define SWAP_( x, y ) do \
- { \
- Long swap = x; \
- \
- \
- x = y; \
- y = swap; \
- } while ( 0 )
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* Decompose_Curve */
- /* */
- /* <Description> */
- /* Scan the outline arrays in order to emit individual segments and */
- /* Beziers by calling Line_To() and Bezier_To(). It handles all */
- /* weird cases, like when the first point is off the curve, or when */
- /* there are simply no `on' points in the contour! */
- /* */
- /* <Input> */
- /* first :: The index of the first point in the contour. */
- /* */
- /* last :: The index of the last point in the contour. */
- /* */
- /* flipped :: If set, flip the direction of the curve. */
- /* */
- /* <Return> */
- /* SUCCESS on success, FAILURE on error. */
- /* */
- static Bool
- Decompose_Curve( RAS_ARGS UShort first,
- UShort last,
- Int flipped )
- {
- FT_Vector v_last;
- FT_Vector v_control;
- FT_Vector v_start;
-
- FT_Vector* points;
- FT_Vector* point;
- FT_Vector* limit;
- char* tags;
-
- UInt tag; /* current point's state */
-
-
- points = ras.outline.points;
- limit = points + last;
-
- v_start.x = SCALED( points[first].x );
- v_start.y = SCALED( points[first].y );
- v_last.x = SCALED( points[last].x );
- v_last.y = SCALED( points[last].y );
-
- if ( flipped )
- {
- SWAP_( v_start.x, v_start.y );
- SWAP_( v_last.x, v_last.y );
- }
-
- v_control = v_start;
-
- point = points + first;
- tags = ras.outline.tags + first;
-
- /* set scan mode if necessary */
- if ( tags[0] & FT_CURVE_TAG_HAS_SCANMODE )
- ras.dropOutControl = (Byte)tags[0] >> 5;
-
- tag = FT_CURVE_TAG( tags[0] );
-
- /* A contour cannot start with a cubic control point! */
- if ( tag == FT_CURVE_TAG_CUBIC )
- goto Invalid_Outline;
-
- /* check first point to determine origin */
- if ( tag == FT_CURVE_TAG_CONIC )
- {
- /* first point is conic control. Yes, this happens. */
- if ( FT_CURVE_TAG( ras.outline.tags[last] ) == FT_CURVE_TAG_ON )
- {
- /* start at last point if it is on the curve */
- v_start = v_last;
- limit--;
- }
- else
- {
- /* if both first and last points are conic, */
- /* start at their middle and record its position */
- /* for closure */
- v_start.x = ( v_start.x + v_last.x ) / 2;
- v_start.y = ( v_start.y + v_last.y ) / 2;
-
- /* v_last = v_start; */
- }
- point--;
- tags--;
- }
-
- ras.lastX = v_start.x;
- ras.lastY = v_start.y;
-
- while ( point < limit )
- {
- point++;
- tags++;
-
- tag = FT_CURVE_TAG( tags[0] );
-
- switch ( tag )
- {
- case FT_CURVE_TAG_ON: /* emit a single line_to */
- {
- Long x, y;
-
-
- x = SCALED( point->x );
- y = SCALED( point->y );
- if ( flipped )
- SWAP_( x, y );
-
- if ( Line_To( RAS_VARS x, y ) )
- goto Fail;
- continue;
- }
-
- case FT_CURVE_TAG_CONIC: /* consume conic arcs */
- v_control.x = SCALED( point[0].x );
- v_control.y = SCALED( point[0].y );
-
- if ( flipped )
- SWAP_( v_control.x, v_control.y );
-
- Do_Conic:
- if ( point < limit )
- {
- FT_Vector v_middle;
- Long x, y;
-
-
- point++;
- tags++;
- tag = FT_CURVE_TAG( tags[0] );
-
- x = SCALED( point[0].x );
- y = SCALED( point[0].y );
-
- if ( flipped )
- SWAP_( x, y );
-
- if ( tag == FT_CURVE_TAG_ON )
- {
- if ( Conic_To( RAS_VARS v_control.x, v_control.y, x, y ) )
- goto Fail;
- continue;
- }
-
- if ( tag != FT_CURVE_TAG_CONIC )
- goto Invalid_Outline;
-
- v_middle.x = ( v_control.x + x ) / 2;
- v_middle.y = ( v_control.y + y ) / 2;
-
- if ( Conic_To( RAS_VARS v_control.x, v_control.y,
- v_middle.x, v_middle.y ) )
- goto Fail;
-
- v_control.x = x;
- v_control.y = y;
-
- goto Do_Conic;
- }
-
- if ( Conic_To( RAS_VARS v_control.x, v_control.y,
- v_start.x, v_start.y ) )
- goto Fail;
-
- goto Close;
-
- default: /* FT_CURVE_TAG_CUBIC */
- {
- Long x1, y1, x2, y2, x3, y3;
-
-
- if ( point + 1 > limit ||
- FT_CURVE_TAG( tags[1] ) != FT_CURVE_TAG_CUBIC )
- goto Invalid_Outline;
-
- point += 2;
- tags += 2;
-
- x1 = SCALED( point[-2].x );
- y1 = SCALED( point[-2].y );
- x2 = SCALED( point[-1].x );
- y2 = SCALED( point[-1].y );
-
- if ( flipped )
- {
- SWAP_( x1, y1 );
- SWAP_( x2, y2 );
- }
-
- if ( point <= limit )
- {
- x3 = SCALED( point[0].x );
- y3 = SCALED( point[0].y );
-
- if ( flipped )
- SWAP_( x3, y3 );
-
- if ( Cubic_To( RAS_VARS x1, y1, x2, y2, x3, y3 ) )
- goto Fail;
- continue;
- }
-
- if ( Cubic_To( RAS_VARS x1, y1, x2, y2, v_start.x, v_start.y ) )
- goto Fail;
- goto Close;
- }
- }
- }
-
- /* close the contour with a line segment */
- if ( Line_To( RAS_VARS v_start.x, v_start.y ) )
- goto Fail;
-
- Close:
- return SUCCESS;
-
- Invalid_Outline:
- ras.error = FT_THROW( Invalid );
-
- Fail:
- return FAILURE;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* Convert_Glyph */
- /* */
- /* <Description> */
- /* Convert a glyph into a series of segments and arcs and make a */
- /* profiles list with them. */
- /* */
- /* <Input> */
- /* flipped :: If set, flip the direction of curve. */
- /* */
- /* <Return> */
- /* SUCCESS on success, FAILURE if any error was encountered during */
- /* rendering. */
- /* */
- static Bool
- Convert_Glyph( RAS_ARGS Int flipped )
- {
- Int i;
- UInt start;
-
-
- ras.fProfile = NULL;
- ras.joint = FALSE;
- ras.fresh = FALSE;
-
- ras.maxBuff = ras.sizeBuff - AlignProfileSize;
-
- ras.numTurns = 0;
-
- ras.cProfile = (PProfile)ras.top;
- ras.cProfile->offset = ras.top;
- ras.num_Profs = 0;
-
- start = 0;
-
- for ( i = 0; i < ras.outline.n_contours; i++ )
- {
- PProfile lastProfile;
- Bool o;
-
-
- ras.state = Unknown_State;
- ras.gProfile = NULL;
-
- if ( Decompose_Curve( RAS_VARS (UShort)start,
- (UShort)ras.outline.contours[i],
- flipped ) )
- return FAILURE;
-
- start = (UShort)ras.outline.contours[i] + 1;
-
- /* we must now check whether the extreme arcs join or not */
- if ( FRAC( ras.lastY ) == 0 &&
- ras.lastY >= ras.minY &&
- ras.lastY <= ras.maxY )
- if ( ras.gProfile &&
- ( ras.gProfile->flags & Flow_Up ) ==
- ( ras.cProfile->flags & Flow_Up ) )
- ras.top--;
- /* Note that ras.gProfile can be nil if the contour was too small */
- /* to be drawn. */
-
- lastProfile = ras.cProfile;
- if ( ras.top != ras.cProfile->offset &&
- ( ras.cProfile->flags & Flow_Up ) )
- o = IS_TOP_OVERSHOOT( ras.lastY );
- else
- o = IS_BOTTOM_OVERSHOOT( ras.lastY );
- if ( End_Profile( RAS_VARS o ) )
- return FAILURE;
-
- /* close the `next profile in contour' linked list */
- if ( ras.gProfile )
- lastProfile->next = ras.gProfile;
- }
-
- if ( Finalize_Profile_Table( RAS_VAR ) )
- return FAILURE;
-
- return (Bool)( ras.top < ras.maxBuff ? SUCCESS : FAILURE );
- }
-
-
- /*************************************************************************/
- /*************************************************************************/
- /** **/
- /** SCAN-LINE SWEEPS AND DRAWING **/
- /** **/
- /*************************************************************************/
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* Init_Linked */
- /* */
- /* Initializes an empty linked list. */
- /* */
- static void
- Init_Linked( TProfileList* l )
- {
- *l = NULL;
- }
-
-
- /*************************************************************************/
- /* */
- /* InsNew */
- /* */
- /* Inserts a new profile in a linked list. */
- /* */
- static void
- InsNew( PProfileList list,
- PProfile profile )
- {
- PProfile *old, current;
- Long x;
-
-
- old = list;
- current = *old;
- x = profile->X;
-
- while ( current )
- {
- if ( x < current->X )
- break;
- old = &current->link;
- current = *old;
- }
-
- profile->link = current;
- *old = profile;
- }
-
-
- /*************************************************************************/
- /* */
- /* DelOld */
- /* */
- /* Removes an old profile from a linked list. */
- /* */
- static void
- DelOld( PProfileList list,
- PProfile profile )
- {
- PProfile *old, current;
-
-
- old = list;
- current = *old;
-
- while ( current )
- {
- if ( current == profile )
- {
- *old = current->link;
- return;
- }
-
- old = &current->link;
- current = *old;
- }
-
- /* we should never get there, unless the profile was not part of */
- /* the list. */
- }
-
-
- /*************************************************************************/
- /* */
- /* Sort */
- /* */
- /* Sorts a trace list. In 95%, the list is already sorted. We need */
- /* an algorithm which is fast in this case. Bubble sort is enough */
- /* and simple. */
- /* */
- static void
- Sort( PProfileList list )
- {
- PProfile *old, current, next;
-
-
- /* First, set the new X coordinate of each profile */
- current = *list;
- while ( current )
- {
- current->X = *current->offset;
- current->offset += ( current->flags & Flow_Up ) ? 1 : -1;
- current->height--;
- current = current->link;
- }
-
- /* Then sort them */
- old = list;
- current = *old;
-
- if ( !current )
- return;
-
- next = current->link;
-
- while ( next )
- {
- if ( current->X <= next->X )
- {
- old = &current->link;
- current = *old;
-
- if ( !current )
- return;
- }
- else
- {
- *old = next;
- current->link = next->link;
- next->link = current;
-
- old = list;
- current = *old;
- }
-
- next = current->link;
- }
- }
-
-
- /*************************************************************************/
- /* */
- /* Vertical Sweep Procedure Set */
- /* */
- /* These four routines are used during the vertical black/white sweep */
- /* phase by the generic Draw_Sweep() function. */
- /* */
- /*************************************************************************/
-
- static void
- Vertical_Sweep_Init( RAS_ARGS Short* min,
- Short* max )
- {
- Long pitch = ras.target.pitch;
-
- FT_UNUSED( max );
-
-
- ras.traceIncr = (Short)-pitch;
- ras.traceOfs = -*min * pitch;
- if ( pitch > 0 )
- ras.traceOfs += (Long)( ras.target.rows - 1 ) * pitch;
- }
-
-
- static void
- Vertical_Sweep_Span( RAS_ARGS Short y,
- FT_F26Dot6 x1,
- FT_F26Dot6 x2,
- PProfile left,
- PProfile right )
- {
- Long e1, e2;
- Byte* target;
-
- Int dropOutControl = left->flags & 7;
-
- FT_UNUSED( y );
- FT_UNUSED( left );
- FT_UNUSED( right );
-
-
- /* in high-precision mode, we need 12 digits after the comma to */
- /* represent multiples of 1/(1<<12) = 1/4096 */
- FT_TRACE7(( " y=%d x=[%.12f;%.12f], drop-out=%d",
- y,
- x1 / (double)ras.precision,
- x2 / (double)ras.precision,
- dropOutControl ));
-
- /* Drop-out control */
-
- e1 = TRUNC( CEILING( x1 ) );
-
- if ( dropOutControl != 2 &&
- x2 - x1 - ras.precision <= ras.precision_jitter )
- e2 = e1;
- else
- e2 = TRUNC( FLOOR( x2 ) );
-
- if ( e2 >= 0 && e1 < ras.bWidth )
- {
- Int c1, c2;
- Byte f1, f2;
-
-
- if ( e1 < 0 )
- e1 = 0;
- if ( e2 >= ras.bWidth )
- e2 = ras.bWidth - 1;
-
- FT_TRACE7(( " -> x=[%d;%d]", e1, e2 ));
-
- c1 = (Short)( e1 >> 3 );
- c2 = (Short)( e2 >> 3 );
-
- f1 = (Byte) ( 0xFF >> ( e1 & 7 ) );
- f2 = (Byte) ~( 0x7F >> ( e2 & 7 ) );
-
- target = ras.bTarget + ras.traceOfs + c1;
- c2 -= c1;
-
- if ( c2 > 0 )
- {
- target[0] |= f1;
-
- /* memset() is slower than the following code on many platforms. */
- /* This is due to the fact that, in the vast majority of cases, */
- /* the span length in bytes is relatively small. */
- c2--;
- while ( c2 > 0 )
- {
- *(++target) = 0xFF;
- c2--;
- }
- target[1] |= f2;
- }
- else
- *target |= ( f1 & f2 );
- }
-
- FT_TRACE7(( "\n" ));
- }
-
-
- static void
- Vertical_Sweep_Drop( RAS_ARGS Short y,
- FT_F26Dot6 x1,
- FT_F26Dot6 x2,
- PProfile left,
- PProfile right )
- {
- Long e1, e2, pxl;
- Short c1, f1;
-
-
- FT_TRACE7(( " y=%d x=[%.12f;%.12f]",
- y,
- x1 / (double)ras.precision,
- x2 / (double)ras.precision ));
-
- /* Drop-out control */
-
- /* e2 x2 x1 e1 */
- /* */
- /* ^ | */
- /* | | */
- /* +-------------+---------------------+------------+ */
- /* | | */
- /* | v */
- /* */
- /* pixel contour contour pixel */
- /* center center */
-
- /* drop-out mode scan conversion rules (as defined in OpenType) */
- /* --------------------------------------------------------------- */
- /* 0 1, 2, 3 */
- /* 1 1, 2, 4 */
- /* 2 1, 2 */
- /* 3 same as mode 2 */
- /* 4 1, 2, 5 */
- /* 5 1, 2, 6 */
- /* 6, 7 same as mode 2 */
-
- e1 = CEILING( x1 );
- e2 = FLOOR ( x2 );
- pxl = e1;
-
- if ( e1 > e2 )
- {
- Int dropOutControl = left->flags & 7;
-
-
- FT_TRACE7(( ", drop-out=%d", dropOutControl ));
-
- if ( e1 == e2 + ras.precision )
- {
- switch ( dropOutControl )
- {
- case 0: /* simple drop-outs including stubs */
- pxl = e2;
- break;
-
- case 4: /* smart drop-outs including stubs */
- pxl = FLOOR( ( x1 + x2 - 1 ) / 2 + ras.precision_half );
- break;
-
- case 1: /* simple drop-outs excluding stubs */
- case 5: /* smart drop-outs excluding stubs */
-
- /* Drop-out Control Rules #4 and #6 */
-
- /* The specification neither provides an exact definition */
- /* of a `stub' nor gives exact rules to exclude them. */
- /* */
- /* Here the constraints we use to recognize a stub. */
- /* */
- /* upper stub: */
- /* */
- /* - P_Left and P_Right are in the same contour */
- /* - P_Right is the successor of P_Left in that contour */
- /* - y is the top of P_Left and P_Right */
- /* */
- /* lower stub: */
- /* */
- /* - P_Left and P_Right are in the same contour */
- /* - P_Left is the successor of P_Right in that contour */
- /* - y is the bottom of P_Left */
- /* */
- /* We draw a stub if the following constraints are met. */
- /* */
- /* - for an upper or lower stub, there is top or bottom */
- /* overshoot, respectively */
- /* - the covered interval is greater or equal to a half */
- /* pixel */
-
- /* upper stub test */
- if ( left->next == right &&
- left->height <= 0 &&
- !( left->flags & Overshoot_Top &&
- x2 - x1 >= ras.precision_half ) )
- goto Exit;
-
- /* lower stub test */
- if ( right->next == left &&
- left->start == y &&
- !( left->flags & Overshoot_Bottom &&
- x2 - x1 >= ras.precision_half ) )
- goto Exit;
-
- if ( dropOutControl == 1 )
- pxl = e2;
- else
- pxl = FLOOR( ( x1 + x2 - 1 ) / 2 + ras.precision_half );
- break;
-
- default: /* modes 2, 3, 6, 7 */
- goto Exit; /* no drop-out control */
- }
-
- /* undocumented but confirmed: If the drop-out would result in a */
- /* pixel outside of the bounding box, use the pixel inside of the */
- /* bounding box instead */
- if ( pxl < 0 )
- pxl = e1;
- else if ( TRUNC( pxl ) >= ras.bWidth )
- pxl = e2;
-
- /* check that the other pixel isn't set */
- e1 = pxl == e1 ? e2 : e1;
-
- e1 = TRUNC( e1 );
-
- c1 = (Short)( e1 >> 3 );
- f1 = (Short)( e1 & 7 );
-
- if ( e1 >= 0 && e1 < ras.bWidth &&
- ras.bTarget[ras.traceOfs + c1] & ( 0x80 >> f1 ) )
- goto Exit;
- }
- else
- goto Exit;
- }
-
- e1 = TRUNC( pxl );
-
- if ( e1 >= 0 && e1 < ras.bWidth )
- {
- FT_TRACE7(( " -> x=%d (drop-out)", e1 ));
-
- c1 = (Short)( e1 >> 3 );
- f1 = (Short)( e1 & 7 );
-
- ras.bTarget[ras.traceOfs + c1] |= (char)( 0x80 >> f1 );
- }
-
- Exit:
- FT_TRACE7(( "\n" ));
- }
-
-
- static void
- Vertical_Sweep_Step( RAS_ARG )
- {
- ras.traceOfs += ras.traceIncr;
- }
-
-
- /***********************************************************************/
- /* */
- /* Horizontal Sweep Procedure Set */
- /* */
- /* These four routines are used during the horizontal black/white */
- /* sweep phase by the generic Draw_Sweep() function. */
- /* */
- /***********************************************************************/
-
- static void
- Horizontal_Sweep_Init( RAS_ARGS Short* min,
- Short* max )
- {
- /* nothing, really */
- FT_UNUSED_RASTER;
- FT_UNUSED( min );
- FT_UNUSED( max );
- }
-
-
- static void
- Horizontal_Sweep_Span( RAS_ARGS Short y,
- FT_F26Dot6 x1,
- FT_F26Dot6 x2,
- PProfile left,
- PProfile right )
- {
- FT_UNUSED( left );
- FT_UNUSED( right );
-
-
- if ( x2 - x1 < ras.precision )
- {
- Long e1, e2;
-
-
- FT_TRACE7(( " x=%d y=[%.12f;%.12f]",
- y,
- x1 / (double)ras.precision,
- x2 / (double)ras.precision ));
-
- e1 = CEILING( x1 );
- e2 = FLOOR ( x2 );
-
- if ( e1 == e2 )
- {
- e1 = TRUNC( e1 );
-
- if ( e1 >= 0 && (ULong)e1 < ras.target.rows )
- {
- Byte f1;
- PByte bits;
- PByte p;
-
-
- FT_TRACE7(( " -> y=%d (drop-out)", e1 ));
-
- bits = ras.bTarget + ( y >> 3 );
- f1 = (Byte)( 0x80 >> ( y & 7 ) );
- p = bits - e1 * ras.target.pitch;
-
- if ( ras.target.pitch > 0 )
- p += (Long)( ras.target.rows - 1 ) * ras.target.pitch;
-
- p[0] |= f1;
- }
- }
-
- FT_TRACE7(( "\n" ));
- }
- }
-
-
- static void
- Horizontal_Sweep_Drop( RAS_ARGS Short y,
- FT_F26Dot6 x1,
- FT_F26Dot6 x2,
- PProfile left,
- PProfile right )
- {
- Long e1, e2, pxl;
- PByte bits;
- Byte f1;
-
-
- FT_TRACE7(( " x=%d y=[%.12f;%.12f]",
- y,
- x1 / (double)ras.precision,
- x2 / (double)ras.precision ));
-
- /* During the horizontal sweep, we only take care of drop-outs */
-
- /* e1 + <-- pixel center */
- /* | */
- /* x1 ---+--> <-- contour */
- /* | */
- /* | */
- /* x2 <--+--- <-- contour */
- /* | */
- /* | */
- /* e2 + <-- pixel center */
-
- e1 = CEILING( x1 );
- e2 = FLOOR ( x2 );
- pxl = e1;
-
- if ( e1 > e2 )
- {
- Int dropOutControl = left->flags & 7;
-
-
- FT_TRACE7(( ", dropout=%d", dropOutControl ));
-
- if ( e1 == e2 + ras.precision )
- {
- switch ( dropOutControl )
- {
- case 0: /* simple drop-outs including stubs */
- pxl = e2;
- break;
-
- case 4: /* smart drop-outs including stubs */
- pxl = FLOOR( ( x1 + x2 - 1 ) / 2 + ras.precision_half );
- break;
-
- case 1: /* simple drop-outs excluding stubs */
- case 5: /* smart drop-outs excluding stubs */
- /* see Vertical_Sweep_Drop for details */
-
- /* rightmost stub test */
- if ( left->next == right &&
- left->height <= 0 &&
- !( left->flags & Overshoot_Top &&
- x2 - x1 >= ras.precision_half ) )
- goto Exit;
-
- /* leftmost stub test */
- if ( right->next == left &&
- left->start == y &&
- !( left->flags & Overshoot_Bottom &&
- x2 - x1 >= ras.precision_half ) )
- goto Exit;
-
- if ( dropOutControl == 1 )
- pxl = e2;
- else
- pxl = FLOOR( ( x1 + x2 - 1 ) / 2 + ras.precision_half );
- break;
-
- default: /* modes 2, 3, 6, 7 */
- goto Exit; /* no drop-out control */
- }
-
- /* undocumented but confirmed: If the drop-out would result in a */
- /* pixel outside of the bounding box, use the pixel inside of the */
- /* bounding box instead */
- if ( pxl < 0 )
- pxl = e1;
- else if ( (ULong)( TRUNC( pxl ) ) >= ras.target.rows )
- pxl = e2;
-
- /* check that the other pixel isn't set */
- e1 = pxl == e1 ? e2 : e1;
-
- e1 = TRUNC( e1 );
-
- bits = ras.bTarget + ( y >> 3 );
- f1 = (Byte)( 0x80 >> ( y & 7 ) );
-
- bits -= e1 * ras.target.pitch;
- if ( ras.target.pitch > 0 )
- bits += (Long)( ras.target.rows - 1 ) * ras.target.pitch;
-
- if ( e1 >= 0 &&
- (ULong)e1 < ras.target.rows &&
- *bits & f1 )
- goto Exit;
- }
- else
- goto Exit;
- }
-
- e1 = TRUNC( pxl );
-
- if ( e1 >= 0 && (ULong)e1 < ras.target.rows )
- {
- FT_TRACE7(( " -> y=%d (drop-out)", e1 ));
-
- bits = ras.bTarget + ( y >> 3 );
- f1 = (Byte)( 0x80 >> ( y & 7 ) );
- bits -= e1 * ras.target.pitch;
-
- if ( ras.target.pitch > 0 )
- bits += (Long)( ras.target.rows - 1 ) * ras.target.pitch;
-
- bits[0] |= f1;
- }
-
- Exit:
- FT_TRACE7(( "\n" ));
- }
-
-
- static void
- Horizontal_Sweep_Step( RAS_ARG )
- {
- /* Nothing, really */
- FT_UNUSED_RASTER;
- }
-
-
- /*************************************************************************/
- /* */
- /* Generic Sweep Drawing routine */
- /* */
- /*************************************************************************/
-
- static Bool
- Draw_Sweep( RAS_ARG )
- {
- Short y, y_change, y_height;
-
- PProfile P, Q, P_Left, P_Right;
-
- Short min_Y, max_Y, top, bottom, dropouts;
-
- Long x1, x2, xs, e1, e2;
-
- TProfileList waiting;
- TProfileList draw_left, draw_right;
-
-
- /* initialize empty linked lists */
-
- Init_Linked( &waiting );
-
- Init_Linked( &draw_left );
- Init_Linked( &draw_right );
-
- /* first, compute min and max Y */
-
- P = ras.fProfile;
- max_Y = (Short)TRUNC( ras.minY );
- min_Y = (Short)TRUNC( ras.maxY );
-
- while ( P )
- {
- Q = P->link;
-
- bottom = (Short)P->start;
- top = (Short)( P->start + P->height - 1 );
-
- if ( min_Y > bottom )
- min_Y = bottom;
- if ( max_Y < top )
- max_Y = top;
-
- P->X = 0;
- InsNew( &waiting, P );
-
- P = Q;
- }
-
- /* check the Y-turns */
- if ( ras.numTurns == 0 )
- {
- ras.error = FT_THROW( Invalid );
- return FAILURE;
- }
-
- /* now initialize the sweep */
-
- ras.Proc_Sweep_Init( RAS_VARS &min_Y, &max_Y );
-
- /* then compute the distance of each profile from min_Y */
-
- P = waiting;
-
- while ( P )
- {
- P->countL = P->start - min_Y;
- P = P->link;
- }
-
- /* let's go */
-
- y = min_Y;
- y_height = 0;
-
- if ( ras.numTurns > 0 &&
- ras.sizeBuff[-ras.numTurns] == min_Y )
- ras.numTurns--;
-
- while ( ras.numTurns > 0 )
- {
- /* check waiting list for new activations */
-
- P = waiting;
-
- while ( P )
- {
- Q = P->link;
- P->countL -= y_height;
- if ( P->countL == 0 )
- {
- DelOld( &waiting, P );
-
- if ( P->flags & Flow_Up )
- InsNew( &draw_left, P );
- else
- InsNew( &draw_right, P );
- }
-
- P = Q;
- }
-
- /* sort the drawing lists */
-
- Sort( &draw_left );
- Sort( &draw_right );
-
- y_change = (Short)ras.sizeBuff[-ras.numTurns--];
- y_height = (Short)( y_change - y );
-
- while ( y < y_change )
- {
- /* let's trace */
-
- dropouts = 0;
-
- P_Left = draw_left;
- P_Right = draw_right;
-
- while ( P_Left )
- {
- x1 = P_Left ->X;
- x2 = P_Right->X;
-
- if ( x1 > x2 )
- {
- xs = x1;
- x1 = x2;
- x2 = xs;
- }
-
- e1 = FLOOR( x1 );
- e2 = CEILING( x2 );
-
- if ( x2 - x1 <= ras.precision &&
- e1 != x1 && e2 != x2 )
- {
- if ( e1 > e2 || e2 == e1 + ras.precision )
- {
- Int dropOutControl = P_Left->flags & 7;
-
-
- if ( dropOutControl != 2 )
- {
- /* a drop-out was detected */
-
- P_Left ->X = x1;
- P_Right->X = x2;
-
- /* mark profile for drop-out processing */
- P_Left->countL = 1;
- dropouts++;
- }
-
- goto Skip_To_Next;
- }
- }
-
- ras.Proc_Sweep_Span( RAS_VARS y, x1, x2, P_Left, P_Right );
-
- Skip_To_Next:
-
- P_Left = P_Left->link;
- P_Right = P_Right->link;
- }
-
- /* handle drop-outs _after_ the span drawing -- */
- /* drop-out processing has been moved out of the loop */
- /* for performance tuning */
- if ( dropouts > 0 )
- goto Scan_DropOuts;
-
- Next_Line:
-
- ras.Proc_Sweep_Step( RAS_VAR );
-
- y++;
-
- if ( y < y_change )
- {
- Sort( &draw_left );
- Sort( &draw_right );
- }
- }
-
- /* now finalize the profiles that need it */
-
- P = draw_left;
- while ( P )
- {
- Q = P->link;
- if ( P->height == 0 )
- DelOld( &draw_left, P );
- P = Q;
- }
-
- P = draw_right;
- while ( P )
- {
- Q = P->link;
- if ( P->height == 0 )
- DelOld( &draw_right, P );
- P = Q;
- }
- }
-
- /* for gray-scaling, flush the bitmap scanline cache */
- while ( y <= max_Y )
- {
- ras.Proc_Sweep_Step( RAS_VAR );
- y++;
- }
-
- return SUCCESS;
-
- Scan_DropOuts:
-
- P_Left = draw_left;
- P_Right = draw_right;
-
- while ( P_Left )
- {
- if ( P_Left->countL )
- {
- P_Left->countL = 0;
-#if 0
- dropouts--; /* -- this is useful when debugging only */
-#endif
- ras.Proc_Sweep_Drop( RAS_VARS y,
- P_Left->X,
- P_Right->X,
- P_Left,
- P_Right );
- }
-
- P_Left = P_Left->link;
- P_Right = P_Right->link;
- }
-
- goto Next_Line;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* Render_Single_Pass */
- /* */
- /* <Description> */
- /* Perform one sweep with sub-banding. */
- /* */
- /* <Input> */
- /* flipped :: If set, flip the direction of the outline. */
- /* */
- /* <Return> */
- /* Renderer error code. */
- /* */
- static int
- Render_Single_Pass( RAS_ARGS Bool flipped )
- {
- Short i, j, k;
-
-
- while ( ras.band_top >= 0 )
- {
- ras.maxY = (Long)ras.band_stack[ras.band_top].y_max * ras.precision;
- ras.minY = (Long)ras.band_stack[ras.band_top].y_min * ras.precision;
-
- ras.top = ras.buff;
-
- ras.error = Raster_Err_None;
-
- if ( Convert_Glyph( RAS_VARS flipped ) )
- {
- if ( ras.error != Raster_Err_Overflow )
- return FAILURE;
-
- ras.error = Raster_Err_None;
-
- /* sub-banding */
-
-#ifdef DEBUG_RASTER
- ClearBand( RAS_VARS TRUNC( ras.minY ), TRUNC( ras.maxY ) );
-#endif
-
- i = ras.band_stack[ras.band_top].y_min;
- j = ras.band_stack[ras.band_top].y_max;
-
- k = (Short)( ( i + j ) / 2 );
-
- if ( ras.band_top >= 7 || k < i )
- {
- ras.band_top = 0;
- ras.error = FT_THROW( Invalid );
-
- return ras.error;
- }
-
- ras.band_stack[ras.band_top + 1].y_min = k;
- ras.band_stack[ras.band_top + 1].y_max = j;
-
- ras.band_stack[ras.band_top].y_max = (Short)( k - 1 );
-
- ras.band_top++;
- }
- else
- {
- if ( ras.fProfile )
- if ( Draw_Sweep( RAS_VAR ) )
- return ras.error;
- ras.band_top--;
- }
- }
-
- return SUCCESS;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* Render_Glyph */
- /* */
- /* <Description> */
- /* Render a glyph in a bitmap. Sub-banding if needed. */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. */
- /* */
- static FT_Error
- Render_Glyph( RAS_ARG )
- {
- FT_Error error;
-
-
- Set_High_Precision( RAS_VARS ras.outline.flags &
- FT_OUTLINE_HIGH_PRECISION );
- ras.scale_shift = ras.precision_shift;
-
- if ( ras.outline.flags & FT_OUTLINE_IGNORE_DROPOUTS )
- ras.dropOutControl = 2;
- else
- {
- if ( ras.outline.flags & FT_OUTLINE_SMART_DROPOUTS )
- ras.dropOutControl = 4;
- else
- ras.dropOutControl = 0;
-
- if ( !( ras.outline.flags & FT_OUTLINE_INCLUDE_STUBS ) )
- ras.dropOutControl += 1;
- }
-
- ras.second_pass = (Bool)( !( ras.outline.flags &
- FT_OUTLINE_SINGLE_PASS ) );
-
- /* Vertical Sweep */
- FT_TRACE7(( "Vertical pass (ftraster)\n" ));
-
- ras.Proc_Sweep_Init = Vertical_Sweep_Init;
- ras.Proc_Sweep_Span = Vertical_Sweep_Span;
- ras.Proc_Sweep_Drop = Vertical_Sweep_Drop;
- ras.Proc_Sweep_Step = Vertical_Sweep_Step;
-
- ras.band_top = 0;
- ras.band_stack[0].y_min = 0;
- ras.band_stack[0].y_max = (Short)( ras.target.rows - 1 );
-
- ras.bWidth = (UShort)ras.target.width;
- ras.bTarget = (Byte*)ras.target.buffer;
-
- if ( ( error = Render_Single_Pass( RAS_VARS 0 ) ) != 0 )
- return error;
-
- /* Horizontal Sweep */
- if ( ras.second_pass && ras.dropOutControl != 2 )
- {
- FT_TRACE7(( "Horizontal pass (ftraster)\n" ));
-
- ras.Proc_Sweep_Init = Horizontal_Sweep_Init;
- ras.Proc_Sweep_Span = Horizontal_Sweep_Span;
- ras.Proc_Sweep_Drop = Horizontal_Sweep_Drop;
- ras.Proc_Sweep_Step = Horizontal_Sweep_Step;
-
- ras.band_top = 0;
- ras.band_stack[0].y_min = 0;
- ras.band_stack[0].y_max = (Short)( ras.target.width - 1 );
-
- if ( ( error = Render_Single_Pass( RAS_VARS 1 ) ) != 0 )
- return error;
- }
-
- return Raster_Err_None;
- }
-
-
- static void
- ft_black_init( black_PRaster raster )
- {
- FT_UNUSED( raster );
- }
-
-
- /**** RASTER OBJECT CREATION: In standalone mode, we simply use *****/
- /**** a static object. *****/
-
-
-#ifdef _STANDALONE_
-
-
- static int
- ft_black_new( void* memory,
- FT_Raster *araster )
- {
- static black_TRaster the_raster;
- FT_UNUSED( memory );
-
-
- *araster = (FT_Raster)&the_raster;
- FT_MEM_ZERO( &the_raster, sizeof ( the_raster ) );
- ft_black_init( &the_raster );
-
- return 0;
- }
-
-
- static void
- ft_black_done( FT_Raster raster )
- {
- /* nothing */
- FT_UNUSED( raster );
- }
-
-
-#else /* !_STANDALONE_ */
-
-
- static int
- ft_black_new( FT_Memory memory,
- black_PRaster *araster )
- {
- FT_Error error;
- black_PRaster raster = NULL;
-
-
- *araster = 0;
- if ( !FT_NEW( raster ) )
- {
- raster->memory = memory;
- ft_black_init( raster );
-
- *araster = raster;
- }
-
- return error;
- }
-
-
- static void
- ft_black_done( black_PRaster raster )
- {
- FT_Memory memory = (FT_Memory)raster->memory;
-
-
- FT_FREE( raster );
- }
-
-
-#endif /* !_STANDALONE_ */
-
-
- static void
- ft_black_reset( black_PRaster raster,
- char* pool_base,
- Long pool_size )
- {
- FT_UNUSED( raster );
- FT_UNUSED( pool_base );
- FT_UNUSED( pool_size );
- }
-
-
- static int
- ft_black_set_mode( black_PRaster raster,
- ULong mode,
- const char* palette )
- {
- FT_UNUSED( raster );
- FT_UNUSED( mode );
- FT_UNUSED( palette );
-
- return 0;
- }
-
-
- static int
- ft_black_render( black_PRaster raster,
- const FT_Raster_Params* params )
- {
- const FT_Outline* outline = (const FT_Outline*)params->source;
- const FT_Bitmap* target_map = params->target;
-
- black_TWorker worker[1];
-
- Long buffer[FT_MAX( FT_RENDER_POOL_SIZE, 2048 ) / sizeof ( Long )];
-
-
- if ( !raster )
- return FT_THROW( Not_Ini );
-
- if ( !outline )
- return FT_THROW( Invalid );
-
- /* return immediately if the outline is empty */
- if ( outline->n_points == 0 || outline->n_contours <= 0 )
- return Raster_Err_None;
-
- if ( !outline->contours || !outline->points )
- return FT_THROW( Invalid );
-
- if ( outline->n_points !=
- outline->contours[outline->n_contours - 1] + 1 )
- return FT_THROW( Invalid );
-
- /* this version of the raster does not support direct rendering, sorry */
- if ( params->flags & FT_RASTER_FLAG_DIRECT )
- return FT_THROW( Unsupported );
-
- if ( params->flags & FT_RASTER_FLAG_AA )
- return FT_THROW( Unsupported );
-
- if ( !target_map )
- return FT_THROW( Invalid );
-
- /* nothing to do */
- if ( !target_map->width || !target_map->rows )
- return Raster_Err_None;
-
- if ( !target_map->buffer )
- return FT_THROW( Invalid );
-
- ras.outline = *outline;
- ras.target = *target_map;
-
- worker->buff = buffer;
- worker->sizeBuff = (&buffer)[1]; /* Points to right after buffer. */
-
- return Render_Glyph( RAS_VAR );
- }
-
-
- FT_DEFINE_RASTER_FUNCS(
- ft_standard_raster,
-
- FT_GLYPH_FORMAT_OUTLINE,
-
- (FT_Raster_New_Func) ft_black_new,
- (FT_Raster_Reset_Func) ft_black_reset,
- (FT_Raster_Set_Mode_Func)ft_black_set_mode,
- (FT_Raster_Render_Func) ft_black_render,
- (FT_Raster_Done_Func) ft_black_done )
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/raster/ftraster.h b/chromium/third_party/pdfium/third_party/freetype/src/raster/ftraster.h
deleted file mode 100644
index a270d487b93..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/raster/ftraster.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftraster.h */
-/* */
-/* The FreeType glyph rasterizer (specification). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used */
-/* modified and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __FTRASTER_H__
-#define __FTRASTER_H__
-
-
-#include <ft2build.h>
-#include FT_CONFIG_CONFIG_H
-#include FT_IMAGE_H
-
-
-FT_BEGIN_HEADER
-
-
- /*************************************************************************/
- /* */
- /* Uncomment the following line if you are using ftraster.c as a */
- /* standalone module, fully independent of FreeType. */
- /* */
-/* #define _STANDALONE_ */
-
- FT_EXPORT_VAR( const FT_Raster_Funcs ) ft_standard_raster;
-
-
-FT_END_HEADER
-
-#endif /* __FTRASTER_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/raster/ftrend1.c b/chromium/third_party/pdfium/third_party/freetype/src/raster/ftrend1.c
deleted file mode 100644
index f3143928399..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/raster/ftrend1.c
+++ /dev/null
@@ -1,254 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftrend1.c */
-/* */
-/* The FreeType glyph rasterizer interface (body). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_OUTLINE_H
-#include "ftrend1.h"
-#include "ftraster.h"
-#include "rastpic.h"
-
-#include "rasterrs.h"
-
-
- /* initialize renderer -- init its raster */
- static FT_Error
- ft_raster1_init( FT_Renderer render )
- {
- FT_Library library = FT_MODULE_LIBRARY( render );
-
-
- render->clazz->raster_class->raster_reset( render->raster,
- library->raster_pool,
- library->raster_pool_size );
-
- return FT_Err_Ok;
- }
-
-
- /* set render-specific mode */
- static FT_Error
- ft_raster1_set_mode( FT_Renderer render,
- FT_ULong mode_tag,
- FT_Pointer data )
- {
- /* we simply pass it to the raster */
- return render->clazz->raster_class->raster_set_mode( render->raster,
- mode_tag,
- data );
- }
-
-
- /* transform a given glyph image */
- static FT_Error
- ft_raster1_transform( FT_Renderer render,
- FT_GlyphSlot slot,
- const FT_Matrix* matrix,
- const FT_Vector* delta )
- {
- FT_Error error = FT_Err_Ok;
-
-
- if ( slot->format != render->glyph_format )
- {
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- if ( matrix )
- FT_Outline_Transform( &slot->outline, matrix );
-
- if ( delta )
- FT_Outline_Translate( &slot->outline, delta->x, delta->y );
-
- Exit:
- return error;
- }
-
-
- /* return the glyph's control box */
- static void
- ft_raster1_get_cbox( FT_Renderer render,
- FT_GlyphSlot slot,
- FT_BBox* cbox )
- {
- FT_MEM_ZERO( cbox, sizeof ( *cbox ) );
-
- if ( slot->format == render->glyph_format )
- FT_Outline_Get_CBox( &slot->outline, cbox );
- }
-
-
- /* convert a slot's glyph image into a bitmap */
- static FT_Error
- ft_raster1_render( FT_Renderer render,
- FT_GlyphSlot slot,
- FT_Render_Mode mode,
- const FT_Vector* origin )
- {
- FT_Error error;
- FT_Outline* outline;
- FT_BBox cbox, cbox0;
- FT_UInt width, height, pitch;
- FT_Bitmap* bitmap;
- FT_Memory memory;
-
- FT_Raster_Params params;
-
-
- /* check glyph image format */
- if ( slot->format != render->glyph_format )
- {
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- /* check rendering mode */
- if ( mode != FT_RENDER_MODE_MONO )
- {
- /* raster1 is only capable of producing monochrome bitmaps */
- return FT_THROW( Cannot_Render_Glyph );
- }
-
- outline = &slot->outline;
-
- /* translate the outline to the new origin if needed */
- if ( origin )
- FT_Outline_Translate( outline, origin->x, origin->y );
-
- /* compute the control box, and grid fit it */
- FT_Outline_Get_CBox( outline, &cbox0 );
-
- /* undocumented but confirmed: bbox values get rounded */
-#if 1
- cbox.xMin = FT_PIX_ROUND( cbox0.xMin );
- cbox.yMin = FT_PIX_ROUND( cbox0.yMin );
- cbox.xMax = FT_PIX_ROUND( cbox0.xMax );
- cbox.yMax = FT_PIX_ROUND( cbox0.yMax );
-#else
- cbox.xMin = FT_PIX_FLOOR( cbox.xMin );
- cbox.yMin = FT_PIX_FLOOR( cbox.yMin );
- cbox.xMax = FT_PIX_CEIL( cbox.xMax );
- cbox.yMax = FT_PIX_CEIL( cbox.yMax );
-#endif
-
- /* If either `width' or `height' round to 0, try */
- /* explicitly rounding up/down. In the case of */
- /* glyphs containing only one very narrow feature, */
- /* this gives the drop-out compensation in the scan */
- /* conversion code a chance to do its stuff. */
- width = (FT_UInt)( ( cbox.xMax - cbox.xMin ) >> 6 );
- if ( width == 0 )
- {
- cbox.xMin = FT_PIX_FLOOR( cbox0.xMin );
- cbox.xMax = FT_PIX_CEIL( cbox0.xMax );
-
- width = (FT_UInt)( ( cbox.xMax - cbox.xMin ) >> 6 );
- }
-
- height = (FT_UInt)( ( cbox.yMax - cbox.yMin ) >> 6 );
- if ( height == 0 )
- {
- cbox.yMin = FT_PIX_FLOOR( cbox0.yMin );
- cbox.yMax = FT_PIX_CEIL( cbox0.yMax );
-
- height = (FT_UInt)( ( cbox.yMax - cbox.yMin ) >> 6 );
- }
-
- if ( width > FT_USHORT_MAX || height > FT_USHORT_MAX )
- {
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- bitmap = &slot->bitmap;
- memory = render->root.memory;
-
- /* release old bitmap buffer */
- if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP )
- {
- FT_FREE( bitmap->buffer );
- slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP;
- }
-
- pitch = ( ( width + 15 ) >> 4 ) << 1;
- bitmap->pixel_mode = FT_PIXEL_MODE_MONO;
-
- bitmap->width = width;
- bitmap->rows = height;
- bitmap->pitch = (int)pitch;
-
- if ( FT_ALLOC_MULT( bitmap->buffer, pitch, height ) )
- goto Exit;
-
- slot->internal->flags |= FT_GLYPH_OWN_BITMAP;
-
- /* translate outline to render it into the bitmap */
- FT_Outline_Translate( outline, -cbox.xMin, -cbox.yMin );
-
- /* set up parameters */
- params.target = bitmap;
- params.source = outline;
- params.flags = 0;
-
- /* render outline into the bitmap */
- error = render->raster_render( render->raster, &params );
-
- FT_Outline_Translate( outline, cbox.xMin, cbox.yMin );
-
- if ( error )
- goto Exit;
-
- slot->format = FT_GLYPH_FORMAT_BITMAP;
- slot->bitmap_left = (FT_Int)( cbox.xMin >> 6 );
- slot->bitmap_top = (FT_Int)( cbox.yMax >> 6 );
-
- Exit:
- return error;
- }
-
-
- FT_DEFINE_RENDERER( ft_raster1_renderer_class,
-
- FT_MODULE_RENDERER,
- sizeof ( FT_RendererRec ),
-
- "raster1",
- 0x10000L,
- 0x20000L,
-
- 0, /* module specific interface */
-
- (FT_Module_Constructor)ft_raster1_init,
- (FT_Module_Destructor) 0,
- (FT_Module_Requester) 0
- ,
-
- FT_GLYPH_FORMAT_OUTLINE,
-
- (FT_Renderer_RenderFunc) ft_raster1_render,
- (FT_Renderer_TransformFunc)ft_raster1_transform,
- (FT_Renderer_GetCBoxFunc) ft_raster1_get_cbox,
- (FT_Renderer_SetModeFunc) ft_raster1_set_mode,
-
- (FT_Raster_Funcs*) &FT_STANDARD_RASTER_GET
- )
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/raster/ftrend1.h b/chromium/third_party/pdfium/third_party/freetype/src/raster/ftrend1.h
deleted file mode 100644
index edc5d13f4cd..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/raster/ftrend1.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftrend1.h */
-/* */
-/* The FreeType glyph rasterizer interface (specification). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __FTREND1_H__
-#define __FTREND1_H__
-
-
-#include <ft2build.h>
-#include FT_RENDER_H
-
-
-FT_BEGIN_HEADER
-
-
- FT_DECLARE_RENDERER( ft_raster1_renderer_class )
-
-
-FT_END_HEADER
-
-#endif /* __FTREND1_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/raster/raster.c b/chromium/third_party/pdfium/third_party/freetype/src/raster/raster.c
deleted file mode 100644
index 21bb16de1e5..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/raster/raster.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/***************************************************************************/
-/* */
-/* raster.c */
-/* */
-/* FreeType monochrome rasterer module component (body only). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#define FT_MAKE_OPTION_SINGLE_OBJECT
-
-#include <ft2build.h>
-#include "rastpic.c"
-#include "ftraster.c"
-#include "ftrend1.c"
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/raster/rasterrs.h b/chromium/third_party/pdfium/third_party/freetype/src/raster/rasterrs.h
deleted file mode 100644
index e7f00bcace3..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/raster/rasterrs.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/***************************************************************************/
-/* */
-/* rasterrs.h */
-/* */
-/* monochrome renderer error codes (specification only). */
-/* */
-/* Copyright 2001-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* This file is used to define the monochrome renderer error enumeration */
- /* constants. */
- /* */
- /*************************************************************************/
-
-#ifndef __RASTERRS_H__
-#define __RASTERRS_H__
-
-#include FT_MODULE_ERRORS_H
-
-#undef __FTERRORS_H__
-
-#undef FT_ERR_PREFIX
-#define FT_ERR_PREFIX Raster_Err_
-#define FT_ERR_BASE FT_Mod_Err_Raster
-
-#include FT_ERRORS_H
-
-#endif /* __RASTERRS_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/raster/rastpic.c b/chromium/third_party/pdfium/third_party/freetype/src/raster/rastpic.c
deleted file mode 100644
index 77e7ec3f903..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/raster/rastpic.c
+++ /dev/null
@@ -1,89 +0,0 @@
-/***************************************************************************/
-/* */
-/* rastpic.c */
-/* */
-/* The FreeType position independent code services for raster module. */
-/* */
-/* Copyright 2009-2015 by */
-/* Oran Agra and Mickey Gabel. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_INTERNAL_OBJECTS_H
-#include "rastpic.h"
-#include "rasterrs.h"
-
-
-#ifdef FT_CONFIG_OPTION_PIC
-
- /* forward declaration of PIC init functions from ftraster.c */
- void
- FT_Init_Class_ft_standard_raster( FT_Raster_Funcs* funcs );
-
-
- void
- ft_raster1_renderer_class_pic_free( FT_Library library )
- {
- FT_PIC_Container* pic_container = &library->pic_container;
- FT_Memory memory = library->memory;
-
-
- if ( pic_container->raster )
- {
- RasterPIC* container = (RasterPIC*)pic_container->raster;
-
-
- if ( --container->ref_count )
- return;
- FT_FREE( container );
- pic_container->raster = NULL;
- }
- }
-
-
- FT_Error
- ft_raster1_renderer_class_pic_init( FT_Library library )
- {
- FT_PIC_Container* pic_container = &library->pic_container;
- FT_Error error = FT_Err_Ok;
- RasterPIC* container = NULL;
- FT_Memory memory = library->memory;
-
-
- /* XXX: since this function also served the no longer available */
- /* raster5 renderer it uses reference counting, which could */
- /* be removed now */
- if ( pic_container->raster )
- {
- ((RasterPIC*)pic_container->raster)->ref_count++;
- return error;
- }
-
- /* allocate pointer, clear and set global container pointer */
- if ( FT_ALLOC( container, sizeof ( *container ) ) )
- return error;
- FT_MEM_SET( container, 0, sizeof ( *container ) );
- pic_container->raster = container;
-
- container->ref_count = 1;
-
- /* initialize pointer table - */
- /* this is how the module usually expects this data */
- FT_Init_Class_ft_standard_raster( &container->ft_standard_raster );
-
- return error;
- }
-
-#endif /* FT_CONFIG_OPTION_PIC */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/raster/rastpic.h b/chromium/third_party/pdfium/third_party/freetype/src/raster/rastpic.h
deleted file mode 100644
index 408996a9089..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/raster/rastpic.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/***************************************************************************/
-/* */
-/* rastpic.h */
-/* */
-/* The FreeType position independent code services for raster module. */
-/* */
-/* Copyright 2009-2015 by */
-/* Oran Agra and Mickey Gabel. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __RASTPIC_H__
-#define __RASTPIC_H__
-
-
-#include FT_INTERNAL_PIC_H
-
-
-FT_BEGIN_HEADER
-
-#ifndef FT_CONFIG_OPTION_PIC
-
-#define FT_STANDARD_RASTER_GET ft_standard_raster
-
-#else /* FT_CONFIG_OPTION_PIC */
-
- typedef struct RasterPIC_
- {
- int ref_count;
- FT_Raster_Funcs ft_standard_raster;
-
- } RasterPIC;
-
-
-#define GET_PIC( lib ) \
- ( (RasterPIC*)( (lib)->pic_container.raster ) )
-#define FT_STANDARD_RASTER_GET ( GET_PIC( library )->ft_standard_raster )
-
-
- /* see rastpic.c for the implementation */
- void
- ft_raster1_renderer_class_pic_free( FT_Library library );
-
- FT_Error
- ft_raster1_renderer_class_pic_init( FT_Library library );
-
-#endif /* FT_CONFIG_OPTION_PIC */
-
- /* */
-
-FT_END_HEADER
-
-#endif /* __RASTPIC_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/sfnt/Jamfile b/chromium/third_party/pdfium/third_party/freetype/src/sfnt/Jamfile
deleted file mode 100644
index cc98d1011ea..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/sfnt/Jamfile
+++ /dev/null
@@ -1,40 +0,0 @@
-# FreeType 2 src/sfnt Jamfile
-#
-# Copyright 2001-2015 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT. By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-SubDir FT2_TOP $(FT2_SRC_DIR) sfnt ;
-
-{
- local _sources ;
-
- if $(FT2_MULTI)
- {
- _sources = pngshim
- sfdriver
- sfntpic
- sfobjs
- ttbdf
- ttcmap
- ttkern
- ttload
- ttmtx
- ttpost
- ttsbit
- ;
- }
- else
- {
- _sources = sfnt ;
- }
-
- Library $(FT2_LIB) : $(_sources).c ;
-}
-
-# end of src/sfnt Jamfile
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/sfnt/pngshim.c b/chromium/third_party/pdfium/third_party/freetype/src/sfnt/pngshim.c
deleted file mode 100644
index ea60452635a..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/sfnt/pngshim.c
+++ /dev/null
@@ -1,378 +0,0 @@
-/***************************************************************************/
-/* */
-/* pngshim.c */
-/* */
-/* PNG Bitmap glyph support. */
-/* */
-/* Copyright 2013-2015 by */
-/* Google, Inc. */
-/* Written by Stuart Gill and Behdad Esfahbod. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_TRUETYPE_TAGS_H
-#include FT_CONFIG_STANDARD_LIBRARY_H
-
-
-#ifdef FT_CONFIG_OPTION_USE_PNG
-
- /* We always include <stjmp.h>, so make libpng shut up! */
-#define PNG_SKIP_SETJMP_CHECK 1
-#include <png.h>
-#include "pngshim.h"
-
-#include "sferrors.h"
-
-
- /* This code is freely based on cairo-png.c. There's so many ways */
- /* to call libpng, and the way cairo does it is defacto standard. */
-
- static unsigned int
- multiply_alpha( unsigned int alpha,
- unsigned int color )
- {
- unsigned int temp = alpha * color + 0x80;
-
-
- return ( temp + ( temp >> 8 ) ) >> 8;
- }
-
-
- /* Premultiplies data and converts RGBA bytes => native endian. */
- static void
- premultiply_data( png_structp png,
- png_row_infop row_info,
- png_bytep data )
- {
- unsigned int i;
-
- FT_UNUSED( png );
-
-
- for ( i = 0; i < row_info->rowbytes; i += 4 )
- {
- unsigned char* base = &data[i];
- unsigned int alpha = base[3];
-
-
- if ( alpha == 0 )
- base[0] = base[1] = base[2] = base[3] = 0;
-
- else
- {
- unsigned int red = base[0];
- unsigned int green = base[1];
- unsigned int blue = base[2];
-
-
- if ( alpha != 0xFF )
- {
- red = multiply_alpha( alpha, red );
- green = multiply_alpha( alpha, green );
- blue = multiply_alpha( alpha, blue );
- }
-
- base[0] = (unsigned char)blue;
- base[1] = (unsigned char)green;
- base[2] = (unsigned char)red;
- base[3] = (unsigned char)alpha;
- }
- }
- }
-
-
- /* Converts RGBx bytes to BGRA. */
- static void
- convert_bytes_to_data( png_structp png,
- png_row_infop row_info,
- png_bytep data )
- {
- unsigned int i;
-
- FT_UNUSED( png );
-
-
- for ( i = 0; i < row_info->rowbytes; i += 4 )
- {
- unsigned char* base = &data[i];
- unsigned int red = base[0];
- unsigned int green = base[1];
- unsigned int blue = base[2];
-
-
- base[0] = (unsigned char)blue;
- base[1] = (unsigned char)green;
- base[2] = (unsigned char)red;
- base[3] = 0xFF;
- }
- }
-
-
- /* Use error callback to avoid png writing to stderr. */
- static void
- error_callback( png_structp png,
- png_const_charp error_msg )
- {
- FT_Error* error = (FT_Error*)png_get_error_ptr( png );
-
- FT_UNUSED( error_msg );
-
-
- *error = FT_THROW( Out_Of_Memory );
-#ifdef PNG_SETJMP_SUPPORTED
- ft_longjmp( png_jmpbuf( png ), 1 );
-#endif
- /* if we get here, then we have no choice but to abort ... */
- }
-
-
- /* Use warning callback to avoid png writing to stderr. */
- static void
- warning_callback( png_structp png,
- png_const_charp error_msg )
- {
- FT_UNUSED( png );
- FT_UNUSED( error_msg );
-
- /* Just ignore warnings. */
- }
-
-
- static void
- read_data_from_FT_Stream( png_structp png,
- png_bytep data,
- png_size_t length )
- {
- FT_Error error;
- png_voidp p = png_get_io_ptr( png );
- FT_Stream stream = (FT_Stream)p;
-
-
- if ( FT_FRAME_ENTER( length ) )
- {
- FT_Error* e = (FT_Error*)png_get_error_ptr( png );
-
-
- *e = FT_THROW( Invalid_Stream_Read );
- png_error( png, NULL );
-
- return;
- }
-
- memcpy( data, stream->cursor, length );
-
- FT_FRAME_EXIT();
- }
-
-
- FT_LOCAL_DEF( FT_Error )
- Load_SBit_Png( FT_GlyphSlot slot,
- FT_Int x_offset,
- FT_Int y_offset,
- FT_Int pix_bits,
- TT_SBit_Metrics metrics,
- FT_Memory memory,
- FT_Byte* data,
- FT_UInt png_len,
- FT_Bool populate_map_and_metrics )
- {
- FT_Bitmap *map = &slot->bitmap;
- FT_Error error = FT_Err_Ok;
- FT_StreamRec stream;
-
- png_structp png;
- png_infop info;
- png_uint_32 imgWidth, imgHeight;
-
- int bitdepth, color_type, interlace;
- FT_Int i;
- png_byte* *rows = NULL; /* pacify compiler */
-
-
- if ( x_offset < 0 ||
- y_offset < 0 )
- {
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- if ( !populate_map_and_metrics &&
- ( (FT_UInt)x_offset + metrics->width > map->width ||
- (FT_UInt)y_offset + metrics->height > map->rows ||
- pix_bits != 32 ||
- map->pixel_mode != FT_PIXEL_MODE_BGRA ) )
- {
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- FT_Stream_OpenMemory( &stream, data, png_len );
-
- png = png_create_read_struct( PNG_LIBPNG_VER_STRING,
- &error,
- error_callback,
- warning_callback );
- if ( !png )
- {
- error = FT_THROW( Out_Of_Memory );
- goto Exit;
- }
-
- info = png_create_info_struct( png );
- if ( !info )
- {
- error = FT_THROW( Out_Of_Memory );
- png_destroy_read_struct( &png, NULL, NULL );
- goto Exit;
- }
-
- if ( ft_setjmp( png_jmpbuf( png ) ) )
- {
- error = FT_THROW( Invalid_File_Format );
- goto DestroyExit;
- }
-
- png_set_read_fn( png, &stream, read_data_from_FT_Stream );
-
- png_read_info( png, info );
- png_get_IHDR( png, info,
- &imgWidth, &imgHeight,
- &bitdepth, &color_type, &interlace,
- NULL, NULL );
-
- if ( error ||
- ( !populate_map_and_metrics &&
- ( (FT_Int)imgWidth != metrics->width ||
- (FT_Int)imgHeight != metrics->height ) ) )
- goto DestroyExit;
-
- if ( populate_map_and_metrics )
- {
- FT_ULong size;
-
-
- metrics->width = (FT_UShort)imgWidth;
- metrics->height = (FT_UShort)imgHeight;
-
- map->width = metrics->width;
- map->rows = metrics->height;
- map->pixel_mode = FT_PIXEL_MODE_BGRA;
- map->pitch = (int)( map->width * 4 );
- map->num_grays = 256;
-
- /* reject too large bitmaps similarly to the rasterizer */
- if ( map->rows > 0x7FFF || map->width > 0x7FFF )
- {
- error = FT_THROW( Array_Too_Large );
- goto DestroyExit;
- }
-
- /* this doesn't overflow: 0x7FFF * 0x7FFF * 4 < 2^32 */
- size = map->rows * (FT_ULong)map->pitch;
-
- error = ft_glyphslot_alloc_bitmap( slot, size );
- if ( error )
- goto DestroyExit;
- }
-
- /* convert palette/gray image to rgb */
- if ( color_type == PNG_COLOR_TYPE_PALETTE )
- png_set_palette_to_rgb( png );
-
- /* expand gray bit depth if needed */
- if ( color_type == PNG_COLOR_TYPE_GRAY )
- {
-#if PNG_LIBPNG_VER >= 10209
- png_set_expand_gray_1_2_4_to_8( png );
-#else
- png_set_gray_1_2_4_to_8( png );
-#endif
- }
-
- /* transform transparency to alpha */
- if ( png_get_valid(png, info, PNG_INFO_tRNS ) )
- png_set_tRNS_to_alpha( png );
-
- if ( bitdepth == 16 )
- png_set_strip_16( png );
-
- if ( bitdepth < 8 )
- png_set_packing( png );
-
- /* convert grayscale to RGB */
- if ( color_type == PNG_COLOR_TYPE_GRAY ||
- color_type == PNG_COLOR_TYPE_GRAY_ALPHA )
- png_set_gray_to_rgb( png );
-
- if ( interlace != PNG_INTERLACE_NONE )
- png_set_interlace_handling( png );
-
- png_set_filler( png, 0xFF, PNG_FILLER_AFTER );
-
- /* recheck header after setting EXPAND options */
- png_read_update_info(png, info );
- png_get_IHDR( png, info,
- &imgWidth, &imgHeight,
- &bitdepth, &color_type, &interlace,
- NULL, NULL );
-
- if ( bitdepth != 8 ||
- !( color_type == PNG_COLOR_TYPE_RGB ||
- color_type == PNG_COLOR_TYPE_RGB_ALPHA ) )
- {
- error = FT_THROW( Invalid_File_Format );
- goto DestroyExit;
- }
-
- switch ( color_type )
- {
- default:
- /* Shouldn't happen, but fall through. */
-
- case PNG_COLOR_TYPE_RGB_ALPHA:
- png_set_read_user_transform_fn( png, premultiply_data );
- break;
-
- case PNG_COLOR_TYPE_RGB:
- /* Humm, this smells. Carry on though. */
- png_set_read_user_transform_fn( png, convert_bytes_to_data );
- break;
- }
-
- if ( FT_NEW_ARRAY( rows, imgHeight ) )
- {
- error = FT_THROW( Out_Of_Memory );
- goto DestroyExit;
- }
-
- for ( i = 0; i < (FT_Int)imgHeight; i++ )
- rows[i] = map->buffer + ( y_offset + i ) * map->pitch + x_offset * 4;
-
- png_read_image( png, rows );
-
- FT_FREE( rows );
-
- png_read_end( png, info );
-
- DestroyExit:
- png_destroy_read_struct( &png, &info, NULL );
- FT_Stream_Close( &stream );
-
- Exit:
- return error;
- }
-
-#endif /* FT_CONFIG_OPTION_USE_PNG */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/sfnt/pngshim.h b/chromium/third_party/pdfium/third_party/freetype/src/sfnt/pngshim.h
deleted file mode 100644
index 4cc5c2b3a05..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/sfnt/pngshim.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/***************************************************************************/
-/* */
-/* pngshim.h */
-/* */
-/* PNG Bitmap glyph support. */
-/* */
-/* Copyright 2013-2015 by */
-/* Google, Inc. */
-/* Written by Stuart Gill and Behdad Esfahbod. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __PNGSHIM_H__
-#define __PNGSHIM_H__
-
-
-#include <ft2build.h>
-#include "ttload.h"
-
-
-FT_BEGIN_HEADER
-
-#ifdef FT_CONFIG_OPTION_USE_PNG
-
- FT_LOCAL( FT_Error )
- Load_SBit_Png( FT_GlyphSlot slot,
- FT_Int x_offset,
- FT_Int y_offset,
- FT_Int pix_bits,
- TT_SBit_Metrics metrics,
- FT_Memory memory,
- FT_Byte* data,
- FT_UInt png_len,
- FT_Bool populate_map_and_metrics );
-
-#endif
-
-FT_END_HEADER
-
-#endif /* __PNGSHIM_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/sfnt/sfdriver.c b/chromium/third_party/pdfium/third_party/freetype/src/sfnt/sfdriver.c
deleted file mode 100644
index 6a3f0d99333..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/sfnt/sfdriver.c
+++ /dev/null
@@ -1,531 +0,0 @@
-/***************************************************************************/
-/* */
-/* sfdriver.c */
-/* */
-/* High-level SFNT driver interface (body). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_SFNT_H
-#include FT_INTERNAL_OBJECTS_H
-
-#include "sfdriver.h"
-#include "ttload.h"
-#include "sfobjs.h"
-#include "sfntpic.h"
-
-#include "sferrors.h"
-
-#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
-#include "ttsbit.h"
-#endif
-
-#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
-#include "ttpost.h"
-#endif
-
-#ifdef TT_CONFIG_OPTION_BDF
-#include "ttbdf.h"
-#include FT_SERVICE_BDF_H
-#endif
-
-#include "ttcmap.h"
-#include "ttkern.h"
-#include "ttmtx.h"
-
-#include FT_SERVICE_GLYPH_DICT_H
-#include FT_SERVICE_POSTSCRIPT_NAME_H
-#include FT_SERVICE_SFNT_H
-#include FT_SERVICE_TT_CMAP_H
-
-
- /*************************************************************************/
- /* */
- /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
- /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
- /* messages during execution. */
- /* */
-#undef FT_COMPONENT
-#define FT_COMPONENT trace_sfdriver
-
-
- /*
- * SFNT TABLE SERVICE
- *
- */
-
- static void*
- get_sfnt_table( TT_Face face,
- FT_Sfnt_Tag tag )
- {
- void* table;
-
-
- switch ( tag )
- {
- case FT_SFNT_HEAD:
- table = &face->header;
- break;
-
- case FT_SFNT_HHEA:
- table = &face->horizontal;
- break;
-
- case FT_SFNT_VHEA:
- table = face->vertical_info ? &face->vertical : NULL;
- break;
-
- case FT_SFNT_OS2:
- table = face->os2.version == 0xFFFFU ? NULL : &face->os2;
- break;
-
- case FT_SFNT_POST:
- table = &face->postscript;
- break;
-
- case FT_SFNT_MAXP:
- table = &face->max_profile;
- break;
-
- case FT_SFNT_PCLT:
- table = face->pclt.Version ? &face->pclt : NULL;
- break;
-
- default:
- table = NULL;
- }
-
- return table;
- }
-
-
- static FT_Error
- sfnt_table_info( TT_Face face,
- FT_UInt idx,
- FT_ULong *tag,
- FT_ULong *offset,
- FT_ULong *length )
- {
- if ( !offset || !length )
- return FT_THROW( Invalid_Argument );
-
- if ( !tag )
- *length = face->num_tables;
- else
- {
- if ( idx >= face->num_tables )
- return FT_THROW( Table_Missing );
-
- *tag = face->dir_tables[idx].Tag;
- *offset = face->dir_tables[idx].Offset;
- *length = face->dir_tables[idx].Length;
- }
-
- return FT_Err_Ok;
- }
-
-
- FT_DEFINE_SERVICE_SFNT_TABLEREC(
- sfnt_service_sfnt_table,
- (FT_SFNT_TableLoadFunc)tt_face_load_any,
- (FT_SFNT_TableGetFunc) get_sfnt_table,
- (FT_SFNT_TableInfoFunc)sfnt_table_info )
-
-
-#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
-
- /*
- * GLYPH DICT SERVICE
- *
- */
-
- static FT_Error
- sfnt_get_glyph_name( TT_Face face,
- FT_UInt glyph_index,
- FT_Pointer buffer,
- FT_UInt buffer_max )
- {
- FT_String* gname;
- FT_Error error;
-
-
- error = tt_face_get_ps_name( face, glyph_index, &gname );
- if ( !error )
- FT_STRCPYN( buffer, gname, buffer_max );
-
- return error;
- }
-
-
- static FT_UInt
- sfnt_get_name_index( TT_Face face,
- FT_String* glyph_name )
- {
- FT_Face root = &face->root;
-
- FT_UInt i, max_gid = FT_UINT_MAX;
-
-
- if ( root->num_glyphs < 0 )
- return 0;
- else if ( (FT_ULong)root->num_glyphs < FT_UINT_MAX )
- max_gid = (FT_UInt)root->num_glyphs;
- else
- FT_TRACE0(( "Ignore glyph names for invalid GID 0x%08x - 0x%08x\n",
- FT_UINT_MAX, root->num_glyphs ));
-
- for ( i = 0; i < max_gid; i++ )
- {
- FT_String* gname;
- FT_Error error = tt_face_get_ps_name( face, i, &gname );
-
-
- if ( error )
- continue;
-
- if ( !ft_strcmp( glyph_name, gname ) )
- return i;
- }
-
- return 0;
- }
-
-
- FT_DEFINE_SERVICE_GLYPHDICTREC(
- sfnt_service_glyph_dict,
- (FT_GlyphDict_GetNameFunc) sfnt_get_glyph_name,
- (FT_GlyphDict_NameIndexFunc)sfnt_get_name_index )
-
-
-#endif /* TT_CONFIG_OPTION_POSTSCRIPT_NAMES */
-
-
- /*
- * POSTSCRIPT NAME SERVICE
- *
- */
-
- static const char*
- sfnt_get_ps_name( TT_Face face )
- {
- FT_Int n, found_win, found_apple;
- const char* result = NULL;
-
-
- /* shouldn't happen, but just in case to avoid memory leaks */
- if ( face->postscript_name )
- return face->postscript_name;
-
- /* scan the name table to see whether we have a Postscript name here, */
- /* either in Macintosh or Windows platform encodings */
- found_win = -1;
- found_apple = -1;
-
- for ( n = 0; n < face->num_names; n++ )
- {
- TT_NameEntryRec* name = face->name_table.names + n;
-
-
- if ( name->nameID == 6 && name->stringLength > 0 )
- {
- if ( name->platformID == 3 &&
- name->encodingID == 1 &&
- name->languageID == 0x409 )
- found_win = n;
-
- if ( name->platformID == 1 &&
- name->encodingID == 0 &&
- name->languageID == 0 )
- found_apple = n;
- }
- }
-
- if ( found_win != -1 )
- {
- FT_Memory memory = face->root.memory;
- TT_NameEntryRec* name = face->name_table.names + found_win;
- FT_UInt len = name->stringLength / 2;
- FT_Error error = FT_Err_Ok;
-
- FT_UNUSED( error );
-
-
- if ( !FT_ALLOC( result, name->stringLength + 1 ) )
- {
- FT_Stream stream = face->name_table.stream;
- FT_String* r = (FT_String*)result;
- FT_Char* p;
-
-
- if ( FT_STREAM_SEEK( name->stringOffset ) ||
- FT_FRAME_ENTER( name->stringLength ) )
- {
- FT_FREE( result );
- name->stringLength = 0;
- name->stringOffset = 0;
- FT_FREE( name->string );
-
- goto Exit;
- }
-
- p = (FT_Char*)stream->cursor;
-
- for ( ; len > 0; len--, p += 2 )
- {
- if ( p[0] == 0 && p[1] >= 32 )
- *r++ = p[1];
- }
- *r = '\0';
-
- FT_FRAME_EXIT();
- }
- goto Exit;
- }
-
- if ( found_apple != -1 )
- {
- FT_Memory memory = face->root.memory;
- TT_NameEntryRec* name = face->name_table.names + found_apple;
- FT_UInt len = name->stringLength;
- FT_Error error = FT_Err_Ok;
-
- FT_UNUSED( error );
-
-
- if ( !FT_ALLOC( result, len + 1 ) )
- {
- FT_Stream stream = face->name_table.stream;
-
-
- if ( FT_STREAM_SEEK( name->stringOffset ) ||
- FT_STREAM_READ( result, len ) )
- {
- name->stringOffset = 0;
- name->stringLength = 0;
- FT_FREE( name->string );
- FT_FREE( result );
- goto Exit;
- }
- ((char*)result)[len] = '\0';
- }
- }
-
- Exit:
- face->postscript_name = result;
- return result;
- }
-
-
- FT_DEFINE_SERVICE_PSFONTNAMEREC(
- sfnt_service_ps_name,
- (FT_PsName_GetFunc)sfnt_get_ps_name )
-
-
- /*
- * TT CMAP INFO
- */
- FT_DEFINE_SERVICE_TTCMAPSREC(
- tt_service_get_cmap_info,
- (TT_CMap_Info_GetFunc)tt_get_cmap_info )
-
-
-#ifdef TT_CONFIG_OPTION_BDF
-
- static FT_Error
- sfnt_get_charset_id( TT_Face face,
- const char* *acharset_encoding,
- const char* *acharset_registry )
- {
- BDF_PropertyRec encoding, registry;
- FT_Error error;
-
-
- /* XXX: I don't know whether this is correct, since
- * tt_face_find_bdf_prop only returns something correct if we have
- * previously selected a size that is listed in the BDF table.
- * Should we change the BDF table format to include single offsets
- * for `CHARSET_REGISTRY' and `CHARSET_ENCODING'?
- */
- error = tt_face_find_bdf_prop( face, "CHARSET_REGISTRY", &registry );
- if ( !error )
- {
- error = tt_face_find_bdf_prop( face, "CHARSET_ENCODING", &encoding );
- if ( !error )
- {
- if ( registry.type == BDF_PROPERTY_TYPE_ATOM &&
- encoding.type == BDF_PROPERTY_TYPE_ATOM )
- {
- *acharset_encoding = encoding.u.atom;
- *acharset_registry = registry.u.atom;
- }
- else
- error = FT_THROW( Invalid_Argument );
- }
- }
-
- return error;
- }
-
-
- FT_DEFINE_SERVICE_BDFRec(
- sfnt_service_bdf,
- (FT_BDF_GetCharsetIdFunc)sfnt_get_charset_id,
- (FT_BDF_GetPropertyFunc) tt_face_find_bdf_prop )
-
-
-#endif /* TT_CONFIG_OPTION_BDF */
-
-
- /*
- * SERVICE LIST
- */
-
-#if defined TT_CONFIG_OPTION_POSTSCRIPT_NAMES && defined TT_CONFIG_OPTION_BDF
- FT_DEFINE_SERVICEDESCREC5(
- sfnt_services,
- FT_SERVICE_ID_SFNT_TABLE, &SFNT_SERVICE_SFNT_TABLE_GET,
- FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &SFNT_SERVICE_PS_NAME_GET,
- FT_SERVICE_ID_GLYPH_DICT, &SFNT_SERVICE_GLYPH_DICT_GET,
- FT_SERVICE_ID_BDF, &SFNT_SERVICE_BDF_GET,
- FT_SERVICE_ID_TT_CMAP, &TT_SERVICE_CMAP_INFO_GET )
-#elif defined TT_CONFIG_OPTION_POSTSCRIPT_NAMES
- FT_DEFINE_SERVICEDESCREC4(
- sfnt_services,
- FT_SERVICE_ID_SFNT_TABLE, &SFNT_SERVICE_SFNT_TABLE_GET,
- FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &SFNT_SERVICE_PS_NAME_GET,
- FT_SERVICE_ID_GLYPH_DICT, &SFNT_SERVICE_GLYPH_DICT_GET,
- FT_SERVICE_ID_TT_CMAP, &TT_SERVICE_CMAP_INFO_GET )
-#elif defined TT_CONFIG_OPTION_BDF
- FT_DEFINE_SERVICEDESCREC4(
- sfnt_services,
- FT_SERVICE_ID_SFNT_TABLE, &SFNT_SERVICE_SFNT_TABLE_GET,
- FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &SFNT_SERVICE_PS_NAME_GET,
- FT_SERVICE_ID_BDF, &SFNT_SERVICE_BDF_GET,
- FT_SERVICE_ID_TT_CMAP, &TT_SERVICE_CMAP_INFO_GET )
-#else
- FT_DEFINE_SERVICEDESCREC3(
- sfnt_services,
- FT_SERVICE_ID_SFNT_TABLE, &SFNT_SERVICE_SFNT_TABLE_GET,
- FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &SFNT_SERVICE_PS_NAME_GET,
- FT_SERVICE_ID_TT_CMAP, &TT_SERVICE_CMAP_INFO_GET )
-#endif
-
-
- FT_CALLBACK_DEF( FT_Module_Interface )
- sfnt_get_interface( FT_Module module,
- const char* module_interface )
- {
- /* SFNT_SERVICES_GET dereferences `library' in PIC mode */
-#ifdef FT_CONFIG_OPTION_PIC
- FT_Library library;
-
-
- if ( !module )
- return NULL;
- library = module->library;
- if ( !library )
- return NULL;
-#else
- FT_UNUSED( module );
-#endif
-
- return ft_service_list_lookup( SFNT_SERVICES_GET, module_interface );
- }
-
-
-#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
-#define PUT_EMBEDDED_BITMAPS( a ) a
-#else
-#define PUT_EMBEDDED_BITMAPS( a ) NULL
-#endif
-
-#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
-#define PUT_PS_NAMES( a ) a
-#else
-#define PUT_PS_NAMES( a ) NULL
-#endif
-
- FT_DEFINE_SFNT_INTERFACE(
- sfnt_interface,
- tt_face_goto_table,
-
- sfnt_init_face,
- sfnt_load_face,
- sfnt_done_face,
- sfnt_get_interface,
-
- tt_face_load_any,
-
- tt_face_load_head,
- tt_face_load_hhea,
- tt_face_load_cmap,
- tt_face_load_maxp,
- tt_face_load_os2,
- tt_face_load_post,
-
- tt_face_load_name,
- tt_face_free_name,
-
- tt_face_load_kern,
- tt_face_load_gasp,
- tt_face_load_pclt,
-
- /* see `ttload.h' */
- PUT_EMBEDDED_BITMAPS( tt_face_load_bhed ),
-
- PUT_EMBEDDED_BITMAPS( tt_face_load_sbit_image ),
-
- /* see `ttpost.h' */
- PUT_PS_NAMES( tt_face_get_ps_name ),
- PUT_PS_NAMES( tt_face_free_ps_names ),
-
- /* since version 2.1.8 */
- tt_face_get_kerning,
-
- /* since version 2.2 */
- tt_face_load_font_dir,
- tt_face_load_hmtx,
-
- /* see `ttsbit.h' and `sfnt.h' */
- PUT_EMBEDDED_BITMAPS( tt_face_load_sbit ),
- PUT_EMBEDDED_BITMAPS( tt_face_free_sbit ),
-
- PUT_EMBEDDED_BITMAPS( tt_face_set_sbit_strike ),
- PUT_EMBEDDED_BITMAPS( tt_face_load_strike_metrics ),
-
- tt_face_get_metrics,
-
- tt_face_get_name
- )
-
-
- FT_DEFINE_MODULE(
- sfnt_module_class,
-
- 0, /* not a font driver or renderer */
- sizeof ( FT_ModuleRec ),
-
- "sfnt", /* driver name */
- 0x10000L, /* driver version 1.0 */
- 0x20000L, /* driver requires FreeType 2.0 or higher */
-
- (const void*)&SFNT_INTERFACE_GET, /* module specific interface */
-
- (FT_Module_Constructor)0,
- (FT_Module_Destructor) 0,
- (FT_Module_Requester) sfnt_get_interface )
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/sfnt/sfdriver.h b/chromium/third_party/pdfium/third_party/freetype/src/sfnt/sfdriver.h
deleted file mode 100644
index 944119cc228..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/sfnt/sfdriver.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/***************************************************************************/
-/* */
-/* sfdriver.h */
-/* */
-/* High-level SFNT driver interface (specification). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __SFDRIVER_H__
-#define __SFDRIVER_H__
-
-
-#include <ft2build.h>
-#include FT_MODULE_H
-
-
-FT_BEGIN_HEADER
-
-
- FT_DECLARE_MODULE( sfnt_module_class )
-
-
-FT_END_HEADER
-
-#endif /* __SFDRIVER_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/sfnt/sferrors.h b/chromium/third_party/pdfium/third_party/freetype/src/sfnt/sferrors.h
deleted file mode 100644
index e3bef3f743b..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/sfnt/sferrors.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/***************************************************************************/
-/* */
-/* sferrors.h */
-/* */
-/* SFNT error codes (specification only). */
-/* */
-/* Copyright 2001-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* This file is used to define the SFNT error enumeration constants. */
- /* */
- /*************************************************************************/
-
-#ifndef __SFERRORS_H__
-#define __SFERRORS_H__
-
-#include FT_MODULE_ERRORS_H
-
-#undef __FTERRORS_H__
-
-#undef FT_ERR_PREFIX
-#define FT_ERR_PREFIX SFNT_Err_
-#define FT_ERR_BASE FT_Mod_Err_SFNT
-
-#include FT_ERRORS_H
-
-#endif /* __SFERRORS_H__ */
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/sfnt/sfnt.c b/chromium/third_party/pdfium/third_party/freetype/src/sfnt/sfnt.c
deleted file mode 100644
index 0b8b5f45785..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/sfnt/sfnt.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/***************************************************************************/
-/* */
-/* sfnt.c */
-/* */
-/* Single object library component. */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#define FT_MAKE_OPTION_SINGLE_OBJECT
-
-#include <ft2build.h>
-#include "sfntpic.c"
-#include "ttload.c"
-#include "ttmtx.c"
-#include "ttcmap.c"
-#include "ttkern.c"
-#include "sfobjs.c"
-#include "sfdriver.c"
-
-#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
-#include "pngshim.c"
-#include "ttsbit.c"
-#endif
-
-#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
-#include "ttpost.c"
-#endif
-
-#ifdef TT_CONFIG_OPTION_BDF
-#include "ttbdf.c"
-#endif
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/sfnt/sfntpic.c b/chromium/third_party/pdfium/third_party/freetype/src/sfnt/sfntpic.c
deleted file mode 100644
index 2aaf4bcc40a..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/sfnt/sfntpic.c
+++ /dev/null
@@ -1,143 +0,0 @@
-/***************************************************************************/
-/* */
-/* sfntpic.c */
-/* */
-/* The FreeType position independent code services for sfnt module. */
-/* */
-/* Copyright 2009-2015 by */
-/* Oran Agra and Mickey Gabel. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_INTERNAL_OBJECTS_H
-#include "sfntpic.h"
-#include "sferrors.h"
-
-
-#ifdef FT_CONFIG_OPTION_PIC
-
- /* forward declaration of PIC init functions from sfdriver.c */
- FT_Error
- FT_Create_Class_sfnt_services( FT_Library library,
- FT_ServiceDescRec** output_class );
- void
- FT_Destroy_Class_sfnt_services( FT_Library library,
- FT_ServiceDescRec* clazz );
- void
- FT_Init_Class_sfnt_service_bdf( FT_Service_BDFRec* clazz );
- void
- FT_Init_Class_sfnt_interface( FT_Library library,
- SFNT_Interface* clazz );
- void
- FT_Init_Class_sfnt_service_glyph_dict(
- FT_Library library,
- FT_Service_GlyphDictRec* clazz );
- void
- FT_Init_Class_sfnt_service_ps_name(
- FT_Library library,
- FT_Service_PsFontNameRec* clazz );
- void
- FT_Init_Class_tt_service_get_cmap_info(
- FT_Library library,
- FT_Service_TTCMapsRec* clazz );
- void
- FT_Init_Class_sfnt_service_sfnt_table(
- FT_Service_SFNT_TableRec* clazz );
-
-
- /* forward declaration of PIC init functions from ttcmap.c */
- FT_Error
- FT_Create_Class_tt_cmap_classes( FT_Library library,
- TT_CMap_Class** output_class );
- void
- FT_Destroy_Class_tt_cmap_classes( FT_Library library,
- TT_CMap_Class* clazz );
-
-
- void
- sfnt_module_class_pic_free( FT_Library library )
- {
- FT_PIC_Container* pic_container = &library->pic_container;
- FT_Memory memory = library->memory;
-
-
- if ( pic_container->sfnt )
- {
- sfntModulePIC* container = (sfntModulePIC*)pic_container->sfnt;
-
-
- if ( container->sfnt_services )
- FT_Destroy_Class_sfnt_services( library,
- container->sfnt_services );
- container->sfnt_services = NULL;
-
- if ( container->tt_cmap_classes )
- FT_Destroy_Class_tt_cmap_classes( library,
- container->tt_cmap_classes );
- container->tt_cmap_classes = NULL;
-
- FT_FREE( container );
- pic_container->sfnt = NULL;
- }
- }
-
-
- FT_Error
- sfnt_module_class_pic_init( FT_Library library )
- {
- FT_PIC_Container* pic_container = &library->pic_container;
- FT_Error error = FT_Err_Ok;
- sfntModulePIC* container = NULL;
- FT_Memory memory = library->memory;
-
-
- /* allocate pointer, clear and set global container pointer */
- if ( FT_ALLOC( container, sizeof ( *container ) ) )
- return error;
- FT_MEM_SET( container, 0, sizeof ( *container ) );
- pic_container->sfnt = container;
-
- /* initialize pointer table - */
- /* this is how the module usually expects this data */
- error = FT_Create_Class_sfnt_services( library,
- &container->sfnt_services );
- if ( error )
- goto Exit;
-
- error = FT_Create_Class_tt_cmap_classes( library,
- &container->tt_cmap_classes );
- if ( error )
- goto Exit;
-
- FT_Init_Class_sfnt_service_glyph_dict(
- library, &container->sfnt_service_glyph_dict );
- FT_Init_Class_sfnt_service_ps_name(
- library, &container->sfnt_service_ps_name );
- FT_Init_Class_tt_service_get_cmap_info(
- library, &container->tt_service_get_cmap_info );
- FT_Init_Class_sfnt_service_sfnt_table(
- &container->sfnt_service_sfnt_table );
-#ifdef TT_CONFIG_OPTION_BDF
- FT_Init_Class_sfnt_service_bdf( &container->sfnt_service_bdf );
-#endif
- FT_Init_Class_sfnt_interface( library, &container->sfnt_interface );
-
- Exit:
- if ( error )
- sfnt_module_class_pic_free( library );
- return error;
- }
-
-#endif /* FT_CONFIG_OPTION_PIC */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/sfnt/sfntpic.h b/chromium/third_party/pdfium/third_party/freetype/src/sfnt/sfntpic.h
deleted file mode 100644
index d99be6a8248..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/sfnt/sfntpic.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/***************************************************************************/
-/* */
-/* sfntpic.h */
-/* */
-/* The FreeType position independent code services for sfnt module. */
-/* */
-/* Copyright 2009-2015 by */
-/* Oran Agra and Mickey Gabel. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __SFNTPIC_H__
-#define __SFNTPIC_H__
-
-
-#include FT_INTERNAL_PIC_H
-
-
-#ifndef FT_CONFIG_OPTION_PIC
-
-#define SFNT_SERVICES_GET sfnt_services
-#define SFNT_SERVICE_GLYPH_DICT_GET sfnt_service_glyph_dict
-#define SFNT_SERVICE_PS_NAME_GET sfnt_service_ps_name
-#define TT_SERVICE_CMAP_INFO_GET tt_service_get_cmap_info
-#define TT_CMAP_CLASSES_GET tt_cmap_classes
-#define SFNT_SERVICE_SFNT_TABLE_GET sfnt_service_sfnt_table
-#define SFNT_SERVICE_BDF_GET sfnt_service_bdf
-#define SFNT_INTERFACE_GET sfnt_interface
-
-#else /* FT_CONFIG_OPTION_PIC */
-
- /* some include files required for members of sfntModulePIC */
-#include FT_SERVICE_GLYPH_DICT_H
-#include FT_SERVICE_POSTSCRIPT_NAME_H
-#include FT_SERVICE_SFNT_H
-#include FT_SERVICE_TT_CMAP_H
-
-#ifdef TT_CONFIG_OPTION_BDF
-#include "ttbdf.h"
-#include FT_SERVICE_BDF_H
-#endif
-
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_SFNT_H
-#include "ttcmap.h"
-
-
-FT_BEGIN_HEADER
-
- typedef struct sfntModulePIC_
- {
- FT_ServiceDescRec* sfnt_services;
- FT_Service_GlyphDictRec sfnt_service_glyph_dict;
- FT_Service_PsFontNameRec sfnt_service_ps_name;
- FT_Service_TTCMapsRec tt_service_get_cmap_info;
- TT_CMap_Class* tt_cmap_classes;
- FT_Service_SFNT_TableRec sfnt_service_sfnt_table;
-#ifdef TT_CONFIG_OPTION_BDF
- FT_Service_BDFRec sfnt_service_bdf;
-#endif
- SFNT_Interface sfnt_interface;
-
- } sfntModulePIC;
-
-
-#define GET_PIC( lib ) \
- ( (sfntModulePIC*)( (lib)->pic_container.sfnt ) )
-
-#define SFNT_SERVICES_GET \
- ( GET_PIC( library )->sfnt_services )
-#define SFNT_SERVICE_GLYPH_DICT_GET \
- ( GET_PIC( library )->sfnt_service_glyph_dict )
-#define SFNT_SERVICE_PS_NAME_GET \
- ( GET_PIC( library )->sfnt_service_ps_name )
-#define TT_SERVICE_CMAP_INFO_GET \
- ( GET_PIC( library )->tt_service_get_cmap_info )
-#define TT_CMAP_CLASSES_GET \
- ( GET_PIC( library )->tt_cmap_classes )
-#define SFNT_SERVICE_SFNT_TABLE_GET \
- ( GET_PIC( library )->sfnt_service_sfnt_table )
-#define SFNT_SERVICE_BDF_GET \
- ( GET_PIC( library )->sfnt_service_bdf )
-#define SFNT_INTERFACE_GET \
- ( GET_PIC( library )->sfnt_interface )
-
-
- /* see sfntpic.c for the implementation */
- void
- sfnt_module_class_pic_free( FT_Library library );
-
- FT_Error
- sfnt_module_class_pic_init( FT_Library library );
-
-
-FT_END_HEADER
-
-#endif /* FT_CONFIG_OPTION_PIC */
-
- /* */
-
-#endif /* __SFNTPIC_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/sfnt/sfobjs.c b/chromium/third_party/pdfium/third_party/freetype/src/sfnt/sfobjs.c
deleted file mode 100644
index 14d3adef212..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/sfnt/sfobjs.c
+++ /dev/null
@@ -1,1603 +0,0 @@
-/***************************************************************************/
-/* */
-/* sfobjs.c */
-/* */
-/* SFNT object management (base). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include "sfobjs.h"
-#include "ttload.h"
-#include "ttcmap.h"
-#include "ttkern.h"
-#include FT_INTERNAL_SFNT_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_TRUETYPE_IDS_H
-#include FT_TRUETYPE_TAGS_H
-#include FT_SERVICE_POSTSCRIPT_CMAPS_H
-#include FT_SFNT_NAMES_H
-#include FT_GZIP_H
-#include "sferrors.h"
-
-#ifdef TT_CONFIG_OPTION_BDF
-#include "ttbdf.h"
-#endif
-
-
- /*************************************************************************/
- /* */
- /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
- /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
- /* messages during execution. */
- /* */
-#undef FT_COMPONENT
-#define FT_COMPONENT trace_sfobjs
-
-
-
- /* convert a UTF-16 name entry to ASCII */
- static FT_String*
- tt_name_entry_ascii_from_utf16( TT_NameEntry entry,
- FT_Memory memory )
- {
- FT_String* string = NULL;
- FT_UInt len, code, n;
- FT_Byte* read = (FT_Byte*)entry->string;
- FT_Error error;
-
-
- len = (FT_UInt)entry->stringLength / 2;
-
- if ( FT_NEW_ARRAY( string, len + 1 ) )
- return NULL;
-
- for ( n = 0; n < len; n++ )
- {
- code = FT_NEXT_USHORT( read );
-
- if ( code == 0 )
- break;
-
- if ( code < 32 || code > 127 )
- code = '?';
-
- string[n] = (char)code;
- }
-
- string[n] = 0;
-
- return string;
- }
-
-
- /* convert an Apple Roman or symbol name entry to ASCII */
- static FT_String*
- tt_name_entry_ascii_from_other( TT_NameEntry entry,
- FT_Memory memory )
- {
- FT_String* string = NULL;
- FT_UInt len, code, n;
- FT_Byte* read = (FT_Byte*)entry->string;
- FT_Error error;
-
-
- len = (FT_UInt)entry->stringLength;
-
- if ( FT_NEW_ARRAY( string, len + 1 ) )
- return NULL;
-
- for ( n = 0; n < len; n++ )
- {
- code = *read++;
-
- if ( code == 0 )
- break;
-
- if ( code < 32 || code > 127 )
- code = '?';
-
- string[n] = (char)code;
- }
-
- string[n] = 0;
-
- return string;
- }
-
-
- typedef FT_String* (*TT_NameEntry_ConvertFunc)( TT_NameEntry entry,
- FT_Memory memory );
-
-
- /* documentation is in sfnt.h */
-
- FT_LOCAL_DEF( FT_Error )
- tt_face_get_name( TT_Face face,
- FT_UShort nameid,
- FT_String** name )
- {
- FT_Memory memory = face->root.memory;
- FT_Error error = FT_Err_Ok;
- FT_String* result = NULL;
- FT_UShort n;
- TT_NameEntryRec* rec;
- FT_Int found_apple = -1;
- FT_Int found_apple_roman = -1;
- FT_Int found_apple_english = -1;
- FT_Int found_win = -1;
- FT_Int found_unicode = -1;
-
- FT_Bool is_english = 0;
-
- TT_NameEntry_ConvertFunc convert;
-
-
- FT_ASSERT( name );
-
- rec = face->name_table.names;
- for ( n = 0; n < face->num_names; n++, rec++ )
- {
- /* According to the OpenType 1.3 specification, only Microsoft or */
- /* Apple platform IDs might be used in the `name' table. The */
- /* `Unicode' platform is reserved for the `cmap' table, and the */
- /* `ISO' one is deprecated. */
- /* */
- /* However, the Apple TrueType specification doesn't say the same */
- /* thing and goes to suggest that all Unicode `name' table entries */
- /* should be coded in UTF-16 (in big-endian format I suppose). */
- /* */
- if ( rec->nameID == nameid && rec->stringLength > 0 )
- {
- switch ( rec->platformID )
- {
- case TT_PLATFORM_APPLE_UNICODE:
- case TT_PLATFORM_ISO:
- /* there is `languageID' to check there. We should use this */
- /* field only as a last solution when nothing else is */
- /* available. */
- /* */
- found_unicode = n;
- break;
-
- case TT_PLATFORM_MACINTOSH:
- /* This is a bit special because some fonts will use either */
- /* an English language id, or a Roman encoding id, to indicate */
- /* the English version of its font name. */
- /* */
- if ( rec->languageID == TT_MAC_LANGID_ENGLISH )
- found_apple_english = n;
- else if ( rec->encodingID == TT_MAC_ID_ROMAN )
- found_apple_roman = n;
- break;
-
- case TT_PLATFORM_MICROSOFT:
- /* we only take a non-English name when there is nothing */
- /* else available in the font */
- /* */
- if ( found_win == -1 || ( rec->languageID & 0x3FF ) == 0x009 )
- {
- switch ( rec->encodingID )
- {
- case TT_MS_ID_SYMBOL_CS:
- case TT_MS_ID_UNICODE_CS:
- case TT_MS_ID_UCS_4:
- is_english = FT_BOOL( ( rec->languageID & 0x3FF ) == 0x009 );
- found_win = n;
- break;
-
- default:
- ;
- }
- }
- break;
-
- default:
- ;
- }
- }
- }
-
- found_apple = found_apple_roman;
- if ( found_apple_english >= 0 )
- found_apple = found_apple_english;
-
- /* some fonts contain invalid Unicode or Macintosh formatted entries; */
- /* we will thus favor names encoded in Windows formats if available */
- /* (provided it is an English name) */
- /* */
- convert = NULL;
- if ( found_win >= 0 && !( found_apple >= 0 && !is_english ) )
- {
- rec = face->name_table.names + found_win;
- switch ( rec->encodingID )
- {
- /* all Unicode strings are encoded using UTF-16BE */
- case TT_MS_ID_UNICODE_CS:
- case TT_MS_ID_SYMBOL_CS:
- convert = tt_name_entry_ascii_from_utf16;
- break;
-
- case TT_MS_ID_UCS_4:
- /* Apparently, if this value is found in a name table entry, it is */
- /* documented as `full Unicode repertoire'. Experience with the */
- /* MsGothic font shipped with Windows Vista shows that this really */
- /* means UTF-16 encoded names (UCS-4 values are only used within */
- /* charmaps). */
- convert = tt_name_entry_ascii_from_utf16;
- break;
-
- default:
- ;
- }
- }
- else if ( found_apple >= 0 )
- {
- rec = face->name_table.names + found_apple;
- convert = tt_name_entry_ascii_from_other;
- }
- else if ( found_unicode >= 0 )
- {
- rec = face->name_table.names + found_unicode;
- convert = tt_name_entry_ascii_from_utf16;
- }
-
- if ( rec && convert )
- {
- if ( rec->string == NULL )
- {
- FT_Stream stream = face->name_table.stream;
-
-
- if ( FT_QNEW_ARRAY ( rec->string, rec->stringLength ) ||
- FT_STREAM_SEEK( rec->stringOffset ) ||
- FT_STREAM_READ( rec->string, rec->stringLength ) )
- {
- FT_FREE( rec->string );
- rec->stringLength = 0;
- result = NULL;
- goto Exit;
- }
- }
-
- result = convert( rec, memory );
- }
-
- Exit:
- *name = result;
- return error;
- }
-
-
- static FT_Encoding
- sfnt_find_encoding( int platform_id,
- int encoding_id )
- {
- typedef struct TEncoding_
- {
- int platform_id;
- int encoding_id;
- FT_Encoding encoding;
-
- } TEncoding;
-
- static
- const TEncoding tt_encodings[] =
- {
- { TT_PLATFORM_ISO, -1, FT_ENCODING_UNICODE },
-
- { TT_PLATFORM_APPLE_UNICODE, -1, FT_ENCODING_UNICODE },
-
- { TT_PLATFORM_MACINTOSH, TT_MAC_ID_ROMAN, FT_ENCODING_APPLE_ROMAN },
-
- { TT_PLATFORM_MICROSOFT, TT_MS_ID_SYMBOL_CS, FT_ENCODING_MS_SYMBOL },
- { TT_PLATFORM_MICROSOFT, TT_MS_ID_UCS_4, FT_ENCODING_UNICODE },
- { TT_PLATFORM_MICROSOFT, TT_MS_ID_UNICODE_CS, FT_ENCODING_UNICODE },
- { TT_PLATFORM_MICROSOFT, TT_MS_ID_SJIS, FT_ENCODING_SJIS },
- { TT_PLATFORM_MICROSOFT, TT_MS_ID_GB2312, FT_ENCODING_GB2312 },
- { TT_PLATFORM_MICROSOFT, TT_MS_ID_BIG_5, FT_ENCODING_BIG5 },
- { TT_PLATFORM_MICROSOFT, TT_MS_ID_WANSUNG, FT_ENCODING_WANSUNG },
- { TT_PLATFORM_MICROSOFT, TT_MS_ID_JOHAB, FT_ENCODING_JOHAB }
- };
-
- const TEncoding *cur, *limit;
-
-
- cur = tt_encodings;
- limit = cur + sizeof ( tt_encodings ) / sizeof ( tt_encodings[0] );
-
- for ( ; cur < limit; cur++ )
- {
- if ( cur->platform_id == platform_id )
- {
- if ( cur->encoding_id == encoding_id ||
- cur->encoding_id == -1 )
- return cur->encoding;
- }
- }
-
- return FT_ENCODING_NONE;
- }
-
-
-#define WRITE_USHORT( p, v ) \
- do \
- { \
- *(p)++ = (FT_Byte)( (v) >> 8 ); \
- *(p)++ = (FT_Byte)( (v) >> 0 ); \
- \
- } while ( 0 )
-
-#define WRITE_ULONG( p, v ) \
- do \
- { \
- *(p)++ = (FT_Byte)( (v) >> 24 ); \
- *(p)++ = (FT_Byte)( (v) >> 16 ); \
- *(p)++ = (FT_Byte)( (v) >> 8 ); \
- *(p)++ = (FT_Byte)( (v) >> 0 ); \
- \
- } while ( 0 )
-
-
- static void
- sfnt_stream_close( FT_Stream stream )
- {
- FT_Memory memory = stream->memory;
-
-
- FT_FREE( stream->base );
-
- stream->size = 0;
- stream->base = NULL;
- stream->close = NULL;
- }
-
-
- FT_CALLBACK_DEF( int )
- compare_offsets( const void* a,
- const void* b )
- {
- WOFF_Table table1 = *(WOFF_Table*)a;
- WOFF_Table table2 = *(WOFF_Table*)b;
-
- FT_ULong offset1 = table1->Offset;
- FT_ULong offset2 = table2->Offset;
-
-
- if ( offset1 > offset2 )
- return 1;
- else if ( offset1 < offset2 )
- return -1;
- else
- return 0;
- }
-
-
- /* Replace `face->root.stream' with a stream containing the extracted */
- /* SFNT of a WOFF font. */
-
- static FT_Error
- woff_open_font( FT_Stream stream,
- TT_Face face )
- {
- FT_Memory memory = stream->memory;
- FT_Error error = FT_Err_Ok;
-
- WOFF_HeaderRec woff;
- WOFF_Table tables = NULL;
- WOFF_Table* indices = NULL;
-
- FT_ULong woff_offset;
-
- FT_Byte* sfnt = NULL;
- FT_Stream sfnt_stream = NULL;
-
- FT_Byte* sfnt_header;
- FT_ULong sfnt_offset;
-
- FT_Int nn;
- FT_ULong old_tag = 0;
-
- static const FT_Frame_Field woff_header_fields[] =
- {
-#undef FT_STRUCTURE
-#define FT_STRUCTURE WOFF_HeaderRec
-
- FT_FRAME_START( 44 ),
- FT_FRAME_ULONG ( signature ),
- FT_FRAME_ULONG ( flavor ),
- FT_FRAME_ULONG ( length ),
- FT_FRAME_USHORT( num_tables ),
- FT_FRAME_USHORT( reserved ),
- FT_FRAME_ULONG ( totalSfntSize ),
- FT_FRAME_USHORT( majorVersion ),
- FT_FRAME_USHORT( minorVersion ),
- FT_FRAME_ULONG ( metaOffset ),
- FT_FRAME_ULONG ( metaLength ),
- FT_FRAME_ULONG ( metaOrigLength ),
- FT_FRAME_ULONG ( privOffset ),
- FT_FRAME_ULONG ( privLength ),
- FT_FRAME_END
- };
-
-
- FT_ASSERT( stream == face->root.stream );
- FT_ASSERT( FT_STREAM_POS() == 0 );
-
- if ( FT_STREAM_READ_FIELDS( woff_header_fields, &woff ) )
- return error;
-
- /* Make sure we don't recurse back here or hit TTC code. */
- if ( woff.flavor == TTAG_wOFF || woff.flavor == TTAG_ttcf )
- return FT_THROW( Invalid_Table );
-
- /* Miscellaneous checks. */
- if ( woff.length != stream->size ||
- woff.num_tables == 0 ||
- 44 + woff.num_tables * 20UL >= woff.length ||
- 12 + woff.num_tables * 16UL >= woff.totalSfntSize ||
- ( woff.totalSfntSize & 3 ) != 0 ||
- ( woff.metaOffset == 0 && ( woff.metaLength != 0 ||
- woff.metaOrigLength != 0 ) ) ||
- ( woff.metaLength != 0 && woff.metaOrigLength == 0 ) ||
- ( woff.privOffset == 0 && woff.privLength != 0 ) )
- return FT_THROW( Invalid_Table );
-
- if ( FT_ALLOC( sfnt, woff.totalSfntSize ) ||
- FT_NEW( sfnt_stream ) )
- goto Exit;
-
- sfnt_header = sfnt;
-
- /* Write sfnt header. */
- {
- FT_UInt searchRange, entrySelector, rangeShift, x;
-
-
- x = woff.num_tables;
- entrySelector = 0;
- while ( x )
- {
- x >>= 1;
- entrySelector += 1;
- }
- entrySelector--;
-
- searchRange = ( 1 << entrySelector ) * 16;
- rangeShift = woff.num_tables * 16 - searchRange;
-
- WRITE_ULONG ( sfnt_header, woff.flavor );
- WRITE_USHORT( sfnt_header, woff.num_tables );
- WRITE_USHORT( sfnt_header, searchRange );
- WRITE_USHORT( sfnt_header, entrySelector );
- WRITE_USHORT( sfnt_header, rangeShift );
- }
-
- /* While the entries in the sfnt header must be sorted by the */
- /* tag value, the tables themselves are not. We thus have to */
- /* sort them by offset and check that they don't overlap. */
-
- if ( FT_NEW_ARRAY( tables, woff.num_tables ) ||
- FT_NEW_ARRAY( indices, woff.num_tables ) )
- goto Exit;
-
- FT_TRACE2(( "\n"
- " tag offset compLen origLen checksum\n"
- " -------------------------------------------\n" ));
-
- if ( FT_FRAME_ENTER( 20L * woff.num_tables ) )
- goto Exit;
-
- for ( nn = 0; nn < woff.num_tables; nn++ )
- {
- WOFF_Table table = tables + nn;
-
- table->Tag = FT_GET_TAG4();
- table->Offset = FT_GET_ULONG();
- table->CompLength = FT_GET_ULONG();
- table->OrigLength = FT_GET_ULONG();
- table->CheckSum = FT_GET_ULONG();
-
- FT_TRACE2(( " %c%c%c%c %08lx %08lx %08lx %08lx\n",
- (FT_Char)( table->Tag >> 24 ),
- (FT_Char)( table->Tag >> 16 ),
- (FT_Char)( table->Tag >> 8 ),
- (FT_Char)( table->Tag ),
- table->Offset,
- table->CompLength,
- table->OrigLength,
- table->CheckSum ));
-
- if ( table->Tag <= old_tag )
- {
- FT_FRAME_EXIT();
- error = FT_THROW( Invalid_Table );
- goto Exit;
- }
-
- old_tag = table->Tag;
- indices[nn] = table;
- }
-
- FT_FRAME_EXIT();
-
- /* Sort by offset. */
-
- ft_qsort( indices,
- woff.num_tables,
- sizeof ( WOFF_Table ),
- compare_offsets );
-
- /* Check offsets and lengths. */
-
- woff_offset = 44 + woff.num_tables * 20L;
- sfnt_offset = 12 + woff.num_tables * 16L;
-
- for ( nn = 0; nn < woff.num_tables; nn++ )
- {
- WOFF_Table table = indices[nn];
-
-
- if ( table->Offset != woff_offset ||
- table->CompLength > woff.length ||
- table->Offset > woff.length - table->CompLength ||
- table->OrigLength > woff.totalSfntSize ||
- sfnt_offset > woff.totalSfntSize - table->OrigLength ||
- table->CompLength > table->OrigLength )
- {
- error = FT_THROW( Invalid_Table );
- goto Exit;
- }
-
- table->OrigOffset = sfnt_offset;
-
- /* The offsets must be multiples of 4. */
- woff_offset += ( table->CompLength + 3 ) & ~3U;
- sfnt_offset += ( table->OrigLength + 3 ) & ~3U;
- }
-
- /*
- * Final checks!
- *
- * We don't decode and check the metadata block.
- * We don't check table checksums either.
- * But other than those, I think we implement all
- * `MUST' checks from the spec.
- */
-
- if ( woff.metaOffset )
- {
- if ( woff.metaOffset != woff_offset ||
- woff.metaOffset + woff.metaLength > woff.length )
- {
- error = FT_THROW( Invalid_Table );
- goto Exit;
- }
-
- /* We have padding only ... */
- woff_offset += woff.metaLength;
- }
-
- if ( woff.privOffset )
- {
- /* ... if it isn't the last block. */
- woff_offset = ( woff_offset + 3 ) & ~3U;
-
- if ( woff.privOffset != woff_offset ||
- woff.privOffset + woff.privLength > woff.length )
- {
- error = FT_THROW( Invalid_Table );
- goto Exit;
- }
-
- /* No padding for the last block. */
- woff_offset += woff.privLength;
- }
-
- if ( sfnt_offset != woff.totalSfntSize ||
- woff_offset != woff.length )
- {
- error = FT_THROW( Invalid_Table );
- goto Exit;
- }
-
- /* Write the tables. */
-
- for ( nn = 0; nn < woff.num_tables; nn++ )
- {
- WOFF_Table table = tables + nn;
-
-
- /* Write SFNT table entry. */
- WRITE_ULONG( sfnt_header, table->Tag );
- WRITE_ULONG( sfnt_header, table->CheckSum );
- WRITE_ULONG( sfnt_header, table->OrigOffset );
- WRITE_ULONG( sfnt_header, table->OrigLength );
-
- /* Write table data. */
- if ( FT_STREAM_SEEK( table->Offset ) ||
- FT_FRAME_ENTER( table->CompLength ) )
- goto Exit;
-
- if ( table->CompLength == table->OrigLength )
- {
- /* Uncompressed data; just copy. */
- ft_memcpy( sfnt + table->OrigOffset,
- stream->cursor,
- table->OrigLength );
- }
- else
- {
-#ifdef FT_CONFIG_OPTION_USE_ZLIB
-
- /* Uncompress with zlib. */
- FT_ULong output_len = table->OrigLength;
-
-
- error = FT_Gzip_Uncompress( memory,
- sfnt + table->OrigOffset, &output_len,
- stream->cursor, table->CompLength );
- if ( error )
- goto Exit;
- if ( output_len != table->OrigLength )
- {
- error = FT_THROW( Invalid_Table );
- goto Exit;
- }
-
-#else /* !FT_CONFIG_OPTION_USE_ZLIB */
-
- error = FT_THROW( Unimplemented_Feature );
- goto Exit;
-
-#endif /* !FT_CONFIG_OPTION_USE_ZLIB */
- }
-
- FT_FRAME_EXIT();
-
- /* We don't check whether the padding bytes in the WOFF file are */
- /* actually '\0'. For the output, however, we do set them properly. */
- sfnt_offset = table->OrigOffset + table->OrigLength;
- while ( sfnt_offset & 3 )
- {
- sfnt[sfnt_offset] = '\0';
- sfnt_offset++;
- }
- }
-
- /* Ok! Finally ready. Swap out stream and return. */
- FT_Stream_OpenMemory( sfnt_stream, sfnt, woff.totalSfntSize );
- sfnt_stream->memory = stream->memory;
- sfnt_stream->close = sfnt_stream_close;
-
- FT_Stream_Free(
- face->root.stream,
- ( face->root.face_flags & FT_FACE_FLAG_EXTERNAL_STREAM ) != 0 );
-
- face->root.stream = sfnt_stream;
-
- face->root.face_flags &= ~FT_FACE_FLAG_EXTERNAL_STREAM;
-
- Exit:
- FT_FREE( tables );
- FT_FREE( indices );
-
- if ( error )
- {
- FT_FREE( sfnt );
- FT_Stream_Close( sfnt_stream );
- FT_FREE( sfnt_stream );
- }
-
- return error;
- }
-
-
-#undef WRITE_USHORT
-#undef WRITE_ULONG
-
-
- /* Fill in face->ttc_header. If the font is not a TTC, it is */
- /* synthesized into a TTC with one offset table. */
- static FT_Error
- sfnt_open_font( FT_Stream stream,
- TT_Face face )
- {
- FT_Memory memory = stream->memory;
- FT_Error error;
- FT_ULong tag, offset;
-
- static const FT_Frame_Field ttc_header_fields[] =
- {
-#undef FT_STRUCTURE
-#define FT_STRUCTURE TTC_HeaderRec
-
- FT_FRAME_START( 8 ),
- FT_FRAME_LONG( version ),
- FT_FRAME_LONG( count ), /* this is ULong in the specs */
- FT_FRAME_END
- };
-
-
- face->ttc_header.tag = 0;
- face->ttc_header.version = 0;
- face->ttc_header.count = 0;
-
- retry:
- offset = FT_STREAM_POS();
-
- if ( FT_READ_ULONG( tag ) )
- return error;
-
- if ( tag == TTAG_wOFF )
- {
- FT_TRACE2(( "sfnt_open_font: file is a WOFF; synthesizing SFNT\n" ));
-
- if ( FT_STREAM_SEEK( offset ) )
- return error;
-
- error = woff_open_font( stream, face );
- if ( error )
- return error;
-
- /* Swap out stream and retry! */
- stream = face->root.stream;
- goto retry;
- }
-
- if ( tag != 0x00010000UL &&
- tag != TTAG_ttcf &&
- tag != TTAG_OTTO &&
- tag != TTAG_true &&
- tag != TTAG_typ1 &&
- tag != 0x00020000UL )
- {
- FT_TRACE2(( " not a font using the SFNT container format\n" ));
- return FT_THROW( Unknown_File_Format );
- }
-
- face->ttc_header.tag = TTAG_ttcf;
-
- if ( tag == TTAG_ttcf )
- {
- FT_Int n;
-
-
- FT_TRACE3(( "sfnt_open_font: file is a collection\n" ));
-
- if ( FT_STREAM_READ_FIELDS( ttc_header_fields, &face->ttc_header ) )
- return error;
-
- if ( face->ttc_header.count == 0 )
- return FT_THROW( Invalid_Table );
-
- /* a rough size estimate: let's conservatively assume that there */
- /* is just a single table info in each subfont header (12 + 16*1 = */
- /* 28 bytes), thus we have (at least) `12 + 4*count' bytes for the */
- /* size of the TTC header plus `28*count' bytes for all subfont */
- /* headers */
- if ( (FT_ULong)face->ttc_header.count > stream->size / ( 28 + 4 ) )
- return FT_THROW( Array_Too_Large );
-
- /* now read the offsets of each font in the file */
- if ( FT_NEW_ARRAY( face->ttc_header.offsets, face->ttc_header.count ) )
- return error;
-
- if ( FT_FRAME_ENTER( face->ttc_header.count * 4L ) )
- return error;
-
- for ( n = 0; n < face->ttc_header.count; n++ )
- face->ttc_header.offsets[n] = FT_GET_ULONG();
-
- FT_FRAME_EXIT();
- }
- else
- {
- FT_TRACE3(( "sfnt_open_font: synthesize TTC\n" ));
-
- face->ttc_header.version = 1 << 16;
- face->ttc_header.count = 1;
-
- if ( FT_NEW( face->ttc_header.offsets ) )
- return error;
-
- face->ttc_header.offsets[0] = offset;
- }
-
- return error;
- }
-
-
- FT_LOCAL_DEF( FT_Error )
- sfnt_init_face( FT_Stream stream,
- TT_Face face,
- FT_Int face_instance_index,
- FT_Int num_params,
- FT_Parameter* params )
- {
- FT_Error error;
- FT_Library library = face->root.driver->root.library;
- SFNT_Service sfnt;
- FT_Int face_index;
-
-
- /* for now, parameters are unused */
- FT_UNUSED( num_params );
- FT_UNUSED( params );
-
-
- sfnt = (SFNT_Service)face->sfnt;
- if ( !sfnt )
- {
- sfnt = (SFNT_Service)FT_Get_Module_Interface( library, "sfnt" );
- if ( !sfnt )
- {
- FT_ERROR(( "sfnt_init_face: cannot access `sfnt' module\n" ));
- return FT_THROW( Missing_Module );
- }
-
- face->sfnt = sfnt;
- face->goto_table = sfnt->goto_table;
- }
-
- FT_FACE_FIND_GLOBAL_SERVICE( face, face->psnames, POSTSCRIPT_CMAPS );
-
- FT_TRACE2(( "SFNT driver\n" ));
-
- error = sfnt_open_font( stream, face );
- if ( error )
- return error;
-
- /* Stream may have changed in sfnt_open_font. */
- stream = face->root.stream;
-
- FT_TRACE2(( "sfnt_init_face: %08p, %ld\n", face, face_instance_index ));
-
- face_index = FT_ABS( face_instance_index ) & 0xFFFF;
-
- if ( face_index >= face->ttc_header.count )
- {
- if ( face_instance_index >= 0 )
- return FT_THROW( Invalid_Argument );
- else
- face_index = 0;
- }
-
- if ( FT_STREAM_SEEK( face->ttc_header.offsets[face_index] ) )
- return error;
-
- /* check whether we have a valid TrueType file */
- error = sfnt->load_font_dir( face, stream );
- if ( error )
- return error;
-
-#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
- {
- FT_ULong fvar_len;
- FT_UShort num_instances;
- FT_Int instance_index;
-
-
- instance_index = FT_ABS( face_instance_index ) >> 16;
-
- /* test whether current face is a GX font with named instances */
- if ( face->goto_table( face, TTAG_fvar, stream, &fvar_len ) ||
- fvar_len < 20 ||
- FT_STREAM_SKIP( 12 ) ||
- FT_READ_USHORT( num_instances ) )
- num_instances = 0;
-
- /* we support at most 2^15 - 1 instances */
- if ( num_instances >= ( 1U << 15 ) - 1 )
- {
- if ( face_instance_index >= 0 )
- return FT_THROW( Invalid_Argument );
- else
- num_instances = 0;
- }
-
- /* instance indices in `face_instance_index' start with index 1, */
- /* thus `>' and not `>=' */
- if ( instance_index > num_instances )
- {
- if ( face_instance_index >= 0 )
- return FT_THROW( Invalid_Argument );
- else
- num_instances = 0;
- }
-
- face->root.style_flags = (FT_Long)num_instances << 16;
- }
-#endif
-
- face->root.num_faces = face->ttc_header.count;
- face->root.face_index = face_index;
-
- return error;
- }
-
-
-#define LOAD_( x ) \
- do \
- { \
- FT_TRACE2(( "`" #x "' " )); \
- FT_TRACE3(( "-->\n" )); \
- \
- error = sfnt->load_ ## x( face, stream ); \
- \
- FT_TRACE2(( "%s\n", ( !error ) \
- ? "loaded" \
- : FT_ERR_EQ( error, Table_Missing ) \
- ? "missing" \
- : "failed to load" )); \
- FT_TRACE3(( "\n" )); \
- } while ( 0 )
-
-#define LOADM_( x, vertical ) \
- do \
- { \
- FT_TRACE2(( "`%s" #x "' ", \
- vertical ? "vertical " : "" )); \
- FT_TRACE3(( "-->\n" )); \
- \
- error = sfnt->load_ ## x( face, stream, vertical ); \
- \
- FT_TRACE2(( "%s\n", ( !error ) \
- ? "loaded" \
- : FT_ERR_EQ( error, Table_Missing ) \
- ? "missing" \
- : "failed to load" )); \
- FT_TRACE3(( "\n" )); \
- } while ( 0 )
-
-#define GET_NAME( id, field ) \
- do \
- { \
- error = tt_face_get_name( face, TT_NAME_ID_ ## id, field ); \
- if ( error ) \
- goto Exit; \
- } while ( 0 )
-
-
- FT_LOCAL_DEF( FT_Error )
- sfnt_load_face( FT_Stream stream,
- TT_Face face,
- FT_Int face_instance_index,
- FT_Int num_params,
- FT_Parameter* params )
- {
- FT_Error error;
-#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
- FT_Error psnames_error;
-#endif
- FT_Bool has_outline;
- FT_Bool is_apple_sbit;
- FT_Bool is_apple_sbix;
- FT_Bool ignore_preferred_family = FALSE;
- FT_Bool ignore_preferred_subfamily = FALSE;
-
- SFNT_Service sfnt = (SFNT_Service)face->sfnt;
-
- FT_UNUSED( face_instance_index );
-
-
- /* Check parameters */
-
- {
- FT_Int i;
-
-
- for ( i = 0; i < num_params; i++ )
- {
- if ( params[i].tag == FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY )
- ignore_preferred_family = TRUE;
- else if ( params[i].tag == FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY )
- ignore_preferred_subfamily = TRUE;
- }
- }
-
- /* Load tables */
-
- /* We now support two SFNT-based bitmapped font formats. They */
- /* are recognized easily as they do not include a `glyf' */
- /* table. */
- /* */
- /* The first format comes from Apple, and uses a table named */
- /* `bhed' instead of `head' to store the font header (using */
- /* the same format). It also doesn't include horizontal and */
- /* vertical metrics tables (i.e. `hhea' and `vhea' tables are */
- /* missing). */
- /* */
- /* The other format comes from Microsoft, and is used with */
- /* WinCE/PocketPC. It looks like a standard TTF, except that */
- /* it doesn't contain outlines. */
- /* */
-
- FT_TRACE2(( "sfnt_load_face: %08p\n\n", face ));
-
- /* do we have outlines in there? */
-#ifdef FT_CONFIG_OPTION_INCREMENTAL
- has_outline = FT_BOOL( face->root.internal->incremental_interface != 0 ||
- tt_face_lookup_table( face, TTAG_glyf ) != 0 ||
- tt_face_lookup_table( face, TTAG_CFF ) != 0 );
-#else
- has_outline = FT_BOOL( tt_face_lookup_table( face, TTAG_glyf ) != 0 ||
- tt_face_lookup_table( face, TTAG_CFF ) != 0 );
-#endif
-
- is_apple_sbit = 0;
- is_apple_sbix = !face->goto_table( face, TTAG_sbix, stream, 0 );
-
- /* Apple 'sbix' color bitmaps are rendered scaled and then the 'glyf'
- * outline rendered on top. We don't support that yet, so just ignore
- * the 'glyf' outline and advertise it as a bitmap-only font. */
- if ( is_apple_sbix )
- has_outline = FALSE;
-
- /* if this font doesn't contain outlines, we try to load */
- /* a `bhed' table */
- if ( !has_outline && sfnt->load_bhed )
- {
- LOAD_( bhed );
- is_apple_sbit = FT_BOOL( !error );
- }
-
- /* load the font header (`head' table) if this isn't an Apple */
- /* sbit font file */
- if ( !is_apple_sbit || is_apple_sbix )
- {
- LOAD_( head );
- if ( error )
- goto Exit;
- }
-
- if ( face->header.Units_Per_EM == 0 )
- {
- error = FT_THROW( Invalid_Table );
-
- goto Exit;
- }
-
- /* the following tables are often not present in embedded TrueType */
- /* fonts within PDF documents, so don't check for them. */
- LOAD_( maxp );
- LOAD_( cmap );
-
- /* the following tables are optional in PCL fonts -- */
- /* don't check for errors */
- LOAD_( name );
- LOAD_( post );
-
-#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
- psnames_error = error;
-#endif
-
- /* do not load the metrics headers and tables if this is an Apple */
- /* sbit font file */
- if ( !is_apple_sbit )
- {
- /* load the `hhea' and `hmtx' tables */
- LOADM_( hhea, 0 );
- if ( !error )
- {
- LOADM_( hmtx, 0 );
- if ( FT_ERR_EQ( error, Table_Missing ) )
- {
- error = FT_THROW( Hmtx_Table_Missing );
-
-#ifdef FT_CONFIG_OPTION_INCREMENTAL
- /* If this is an incrementally loaded font and there are */
- /* overriding metrics, tolerate a missing `hmtx' table. */
- if ( face->root.internal->incremental_interface &&
- face->root.internal->incremental_interface->funcs->
- get_glyph_metrics )
- {
- face->horizontal.number_Of_HMetrics = 0;
- error = FT_Err_Ok;
- }
-#endif
- }
- }
- else if ( FT_ERR_EQ( error, Table_Missing ) )
- {
- /* No `hhea' table necessary for SFNT Mac fonts. */
- if ( face->format_tag == TTAG_true )
- {
- FT_TRACE2(( "This is an SFNT Mac font.\n" ));
-
- has_outline = 0;
- error = FT_Err_Ok;
- }
- else
- {
- error = FT_THROW( Horiz_Header_Missing );
-
-#ifdef FT_CONFIG_OPTION_INCREMENTAL
- /* If this is an incrementally loaded font and there are */
- /* overriding metrics, tolerate a missing `hhea' table. */
- if ( face->root.internal->incremental_interface &&
- face->root.internal->incremental_interface->funcs->
- get_glyph_metrics )
- {
- face->horizontal.number_Of_HMetrics = 0;
- error = FT_Err_Ok;
- }
-#endif
-
- }
- }
-
- if ( error )
- goto Exit;
-
- /* try to load the `vhea' and `vmtx' tables */
- LOADM_( hhea, 1 );
- if ( !error )
- {
- LOADM_( hmtx, 1 );
- if ( !error )
- face->vertical_info = 1;
- }
-
- if ( error && FT_ERR_NEQ( error, Table_Missing ) )
- goto Exit;
-
- LOAD_( os2 );
- if ( error )
- {
- /* we treat the table as missing if there are any errors */
- face->os2.version = 0xFFFFU;
- }
- }
-
- /* the optional tables */
-
- /* embedded bitmap support */
- if ( sfnt->load_eblc )
- {
- LOAD_( eblc );
- if ( error )
- {
- /* a font which contains neither bitmaps nor outlines is */
- /* still valid (although rather useless in most cases); */
- /* however, you can find such stripped fonts in PDFs */
- if ( FT_ERR_EQ( error, Table_Missing ) )
- error = FT_Err_Ok;
- else
- goto Exit;
- }
- }
-
- LOAD_( pclt );
- if ( error )
- {
- if ( FT_ERR_NEQ( error, Table_Missing ) )
- goto Exit;
-
- face->pclt.Version = 0;
- }
-
- /* consider the kerning and gasp tables as optional */
- LOAD_( gasp );
- LOAD_( kern );
-
- face->root.num_glyphs = face->max_profile.numGlyphs;
-
- /* Bit 8 of the `fsSelection' field in the `OS/2' table denotes */
- /* a WWS-only font face. `WWS' stands for `weight', width', and */
- /* `slope', a term used by Microsoft's Windows Presentation */
- /* Foundation (WPF). This flag has been introduced in version */
- /* 1.5 of the OpenType specification (May 2008). */
-
- face->root.family_name = NULL;
- face->root.style_name = NULL;
- if ( face->os2.version != 0xFFFFU && face->os2.fsSelection & 256 )
- {
- if ( !ignore_preferred_family )
- GET_NAME( PREFERRED_FAMILY, &face->root.family_name );
- if ( !face->root.family_name )
- GET_NAME( FONT_FAMILY, &face->root.family_name );
-
- if ( !ignore_preferred_subfamily )
- GET_NAME( PREFERRED_SUBFAMILY, &face->root.style_name );
- if ( !face->root.style_name )
- GET_NAME( FONT_SUBFAMILY, &face->root.style_name );
- }
- else
- {
- GET_NAME( WWS_FAMILY, &face->root.family_name );
- if ( !face->root.family_name && !ignore_preferred_family )
- GET_NAME( PREFERRED_FAMILY, &face->root.family_name );
- if ( !face->root.family_name )
- GET_NAME( FONT_FAMILY, &face->root.family_name );
-
- GET_NAME( WWS_SUBFAMILY, &face->root.style_name );
- if ( !face->root.style_name && !ignore_preferred_subfamily )
- GET_NAME( PREFERRED_SUBFAMILY, &face->root.style_name );
- if ( !face->root.style_name )
- GET_NAME( FONT_SUBFAMILY, &face->root.style_name );
- }
-
- /* now set up root fields */
- {
- FT_Face root = &face->root;
- FT_Long flags = root->face_flags;
-
-
- /*********************************************************************/
- /* */
- /* Compute face flags. */
- /* */
- if ( face->sbit_table_type == TT_SBIT_TABLE_TYPE_CBLC ||
- face->sbit_table_type == TT_SBIT_TABLE_TYPE_SBIX )
- flags |= FT_FACE_FLAG_COLOR; /* color glyphs */
-
- if ( has_outline == TRUE )
- flags |= FT_FACE_FLAG_SCALABLE; /* scalable outlines */
-
- /* The sfnt driver only supports bitmap fonts natively, thus we */
- /* don't set FT_FACE_FLAG_HINTER. */
- flags |= FT_FACE_FLAG_SFNT | /* SFNT file format */
- FT_FACE_FLAG_HORIZONTAL; /* horizontal data */
-
-#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
- if ( !psnames_error &&
- face->postscript.FormatType != 0x00030000L )
- flags |= FT_FACE_FLAG_GLYPH_NAMES;
-#endif
-
- /* fixed width font? */
- if ( face->postscript.isFixedPitch )
- flags |= FT_FACE_FLAG_FIXED_WIDTH;
-
- /* vertical information? */
- if ( face->vertical_info )
- flags |= FT_FACE_FLAG_VERTICAL;
-
- /* kerning available ? */
- if ( TT_FACE_HAS_KERNING( face ) )
- flags |= FT_FACE_FLAG_KERNING;
-
-#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
- /* Don't bother to load the tables unless somebody asks for them. */
- /* No need to do work which will (probably) not be used. */
- if ( tt_face_lookup_table( face, TTAG_glyf ) != 0 &&
- tt_face_lookup_table( face, TTAG_fvar ) != 0 &&
- tt_face_lookup_table( face, TTAG_gvar ) != 0 )
- flags |= FT_FACE_FLAG_MULTIPLE_MASTERS;
-#endif
-
- root->face_flags = flags;
-
- /*********************************************************************/
- /* */
- /* Compute style flags. */
- /* */
-
- flags = 0;
- if ( has_outline == TRUE && face->os2.version != 0xFFFFU )
- {
- /* We have an OS/2 table; use the `fsSelection' field. Bit 9 */
- /* indicates an oblique font face. This flag has been */
- /* introduced in version 1.5 of the OpenType specification. */
-
- if ( face->os2.fsSelection & 512 ) /* bit 9 */
- flags |= FT_STYLE_FLAG_ITALIC;
- else if ( face->os2.fsSelection & 1 ) /* bit 0 */
- flags |= FT_STYLE_FLAG_ITALIC;
-
- if ( face->os2.fsSelection & 32 ) /* bit 5 */
- flags |= FT_STYLE_FLAG_BOLD;
- }
- else
- {
- /* this is an old Mac font, use the header field */
-
- if ( face->header.Mac_Style & 1 )
- flags |= FT_STYLE_FLAG_BOLD;
-
- if ( face->header.Mac_Style & 2 )
- flags |= FT_STYLE_FLAG_ITALIC;
- }
-
- root->style_flags |= flags;
-
- /*********************************************************************/
- /* */
- /* Polish the charmaps. */
- /* */
- /* Try to set the charmap encoding according to the platform & */
- /* encoding ID of each charmap. */
- /* */
-
- tt_face_build_cmaps( face ); /* ignore errors */
-
-
- /* set the encoding fields */
- {
- FT_Int m;
-
-
- for ( m = 0; m < root->num_charmaps; m++ )
- {
- FT_CharMap charmap = root->charmaps[m];
-
-
- charmap->encoding = sfnt_find_encoding( charmap->platform_id,
- charmap->encoding_id );
-
-#if 0
- if ( root->charmap == NULL &&
- charmap->encoding == FT_ENCODING_UNICODE )
- {
- /* set 'root->charmap' to the first Unicode encoding we find */
- root->charmap = charmap;
- }
-#endif
- }
- }
-
-#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
-
- /*
- * Now allocate the root array of FT_Bitmap_Size records and
- * populate them. Unfortunately, it isn't possible to indicate bit
- * depths in the FT_Bitmap_Size record. This is a design error.
- */
- {
- FT_UInt i, count;
-
-
- count = face->sbit_num_strikes;
-
- if ( count > 0 )
- {
- FT_Memory memory = face->root.stream->memory;
- FT_UShort em_size = face->header.Units_Per_EM;
- FT_Short avgwidth = face->os2.xAvgCharWidth;
- FT_Size_Metrics metrics;
-
-
- if ( em_size == 0 || face->os2.version == 0xFFFFU )
- {
- avgwidth = 1;
- em_size = 1;
- }
-
- if ( FT_NEW_ARRAY( root->available_sizes, count ) )
- goto Exit;
-
- for ( i = 0; i < count; i++ )
- {
- FT_Bitmap_Size* bsize = root->available_sizes + i;
-
-
- error = sfnt->load_strike_metrics( face, i, &metrics );
- if ( error )
- goto Exit;
-
- bsize->height = (FT_Short)( metrics.height >> 6 );
- bsize->width = (FT_Short)(
- ( avgwidth * metrics.x_ppem + em_size / 2 ) / em_size );
-
- bsize->x_ppem = metrics.x_ppem << 6;
- bsize->y_ppem = metrics.y_ppem << 6;
-
- /* assume 72dpi */
- bsize->size = metrics.y_ppem << 6;
- }
-
- root->face_flags |= FT_FACE_FLAG_FIXED_SIZES;
- root->num_fixed_sizes = (FT_Int)count;
- }
- }
-
-#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
-
- /* a font with no bitmaps and no outlines is scalable; */
- /* it has only empty glyphs then */
- if ( !FT_HAS_FIXED_SIZES( root ) && !FT_IS_SCALABLE( root ) )
- root->face_flags |= FT_FACE_FLAG_SCALABLE;
-
-
- /*********************************************************************/
- /* */
- /* Set up metrics. */
- /* */
- if ( FT_IS_SCALABLE( root ) )
- {
- /* XXX What about if outline header is missing */
- /* (e.g. sfnt wrapped bitmap)? */
- root->bbox.xMin = face->header.xMin;
- root->bbox.yMin = face->header.yMin;
- root->bbox.xMax = face->header.xMax;
- root->bbox.yMax = face->header.yMax;
- root->units_per_EM = face->header.Units_Per_EM;
-
-
- /* XXX: Computing the ascender/descender/height is very different */
- /* from what the specification tells you. Apparently, we */
- /* must be careful because */
- /* */
- /* - not all fonts have an OS/2 table; in this case, we take */
- /* the values in the horizontal header. However, these */
- /* values very often are not reliable. */
- /* */
- /* - otherwise, the correct typographic values are in the */
- /* sTypoAscender, sTypoDescender & sTypoLineGap fields. */
- /* */
- /* However, certain fonts have these fields set to 0. */
- /* Rather, they have usWinAscent & usWinDescent correctly */
- /* set (but with different values). */
- /* */
- /* As an example, Arial Narrow is implemented through four */
- /* files ARIALN.TTF, ARIALNI.TTF, ARIALNB.TTF & ARIALNBI.TTF */
- /* */
- /* Strangely, all fonts have the same values in their */
- /* sTypoXXX fields, except ARIALNB which sets them to 0. */
- /* */
- /* On the other hand, they all have different */
- /* usWinAscent/Descent values -- as a conclusion, the OS/2 */
- /* table cannot be used to compute the text height reliably! */
- /* */
-
- /* The ascender and descender are taken from the `hhea' table. */
- /* If zero, they are taken from the `OS/2' table. */
-
- root->ascender = face->horizontal.Ascender;
- root->descender = face->horizontal.Descender;
-
- root->height = root->ascender - root->descender +
- face->horizontal.Line_Gap;
-
- if ( !( root->ascender || root->descender ) )
- {
- if ( face->os2.version != 0xFFFFU )
- {
- if ( face->os2.sTypoAscender || face->os2.sTypoDescender )
- {
- root->ascender = face->os2.sTypoAscender;
- root->descender = face->os2.sTypoDescender;
-
- root->height = root->ascender - root->descender +
- face->os2.sTypoLineGap;
- }
- else
- {
- root->ascender = (FT_Short)face->os2.usWinAscent;
- root->descender = -(FT_Short)face->os2.usWinDescent;
-
- root->height = root->ascender - root->descender;
- }
- }
- }
-
- root->max_advance_width =
- (FT_Short)face->horizontal.advance_Width_Max;
- root->max_advance_height =
- (FT_Short)( face->vertical_info ? face->vertical.advance_Height_Max
- : root->height );
-
- /* See http://www.microsoft.com/OpenType/OTSpec/post.htm -- */
- /* Adjust underline position from top edge to centre of */
- /* stroke to convert TrueType meaning to FreeType meaning. */
- root->underline_position = face->postscript.underlinePosition -
- face->postscript.underlineThickness / 2;
- root->underline_thickness = face->postscript.underlineThickness;
- }
-
- }
-
- Exit:
- FT_TRACE2(( "sfnt_load_face: done\n" ));
-
- return error;
- }
-
-
-#undef LOAD_
-#undef LOADM_
-#undef GET_NAME
-
-
- FT_LOCAL_DEF( void )
- sfnt_done_face( TT_Face face )
- {
- FT_Memory memory;
- SFNT_Service sfnt;
-
-
- if ( !face )
- return;
-
- memory = face->root.memory;
- sfnt = (SFNT_Service)face->sfnt;
-
- if ( sfnt )
- {
- /* destroy the postscript names table if it is loaded */
- if ( sfnt->free_psnames )
- sfnt->free_psnames( face );
-
- /* destroy the embedded bitmaps table if it is loaded */
- if ( sfnt->free_eblc )
- sfnt->free_eblc( face );
- }
-
-#ifdef TT_CONFIG_OPTION_BDF
- /* freeing the embedded BDF properties */
- tt_face_free_bdf_props( face );
-#endif
-
- /* freeing the kerning table */
- tt_face_done_kern( face );
-
- /* freeing the collection table */
- FT_FREE( face->ttc_header.offsets );
- face->ttc_header.count = 0;
-
- /* freeing table directory */
- FT_FREE( face->dir_tables );
- face->num_tables = 0;
-
- {
- FT_Stream stream = FT_FACE_STREAM( face );
-
-
- /* simply release the 'cmap' table frame */
- FT_FRAME_RELEASE( face->cmap_table );
- face->cmap_size = 0;
- }
-
- /* freeing the horizontal metrics */
- {
- FT_Stream stream = FT_FACE_STREAM( face );
-
-
- FT_FRAME_RELEASE( face->horz_metrics );
- FT_FRAME_RELEASE( face->vert_metrics );
- face->horz_metrics_size = 0;
- face->vert_metrics_size = 0;
- }
-
- /* freeing the vertical ones, if any */
- if ( face->vertical_info )
- {
- FT_FREE( face->vertical.long_metrics );
- FT_FREE( face->vertical.short_metrics );
- face->vertical_info = 0;
- }
-
- /* freeing the gasp table */
- FT_FREE( face->gasp.gaspRanges );
- face->gasp.numRanges = 0;
-
- /* freeing the name table */
- if ( sfnt )
- sfnt->free_name( face );
-
- /* freeing family and style name */
- FT_FREE( face->root.family_name );
- FT_FREE( face->root.style_name );
-
- /* freeing sbit size table */
- FT_FREE( face->root.available_sizes );
- face->root.num_fixed_sizes = 0;
-
- FT_FREE( face->postscript_name );
-
- face->sfnt = NULL;
- }
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/sfnt/sfobjs.h b/chromium/third_party/pdfium/third_party/freetype/src/sfnt/sfobjs.h
deleted file mode 100644
index 455f86772f8..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/sfnt/sfobjs.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/***************************************************************************/
-/* */
-/* sfobjs.h */
-/* */
-/* SFNT object management (specification). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __SFOBJS_H__
-#define __SFOBJS_H__
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_SFNT_H
-#include FT_INTERNAL_OBJECTS_H
-
-
-FT_BEGIN_HEADER
-
-
- FT_LOCAL( FT_Error )
- sfnt_init_face( FT_Stream stream,
- TT_Face face,
- FT_Int face_instance_index,
- FT_Int num_params,
- FT_Parameter* params );
-
- FT_LOCAL( FT_Error )
- sfnt_load_face( FT_Stream stream,
- TT_Face face,
- FT_Int face_instance_index,
- FT_Int num_params,
- FT_Parameter* params );
-
- FT_LOCAL( void )
- sfnt_done_face( TT_Face face );
-
- FT_LOCAL( FT_Error )
- tt_face_get_name( TT_Face face,
- FT_UShort nameid,
- FT_String** name );
-
-
-FT_END_HEADER
-
-#endif /* __SFDRIVER_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/sfnt/ttbdf.c b/chromium/third_party/pdfium/third_party/freetype/src/sfnt/ttbdf.c
deleted file mode 100644
index 098b781a146..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/sfnt/ttbdf.c
+++ /dev/null
@@ -1,250 +0,0 @@
-/***************************************************************************/
-/* */
-/* ttbdf.c */
-/* */
-/* TrueType and OpenType embedded BDF properties (body). */
-/* */
-/* Copyright 2005-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_TRUETYPE_TAGS_H
-#include "ttbdf.h"
-
-#include "sferrors.h"
-
-
-#ifdef TT_CONFIG_OPTION_BDF
-
- /*************************************************************************/
- /* */
- /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
- /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
- /* messages during execution. */
- /* */
-#undef FT_COMPONENT
-#define FT_COMPONENT trace_ttbdf
-
-
- FT_LOCAL_DEF( void )
- tt_face_free_bdf_props( TT_Face face )
- {
- TT_BDF bdf = &face->bdf;
-
-
- if ( bdf->loaded )
- {
- FT_Stream stream = FT_FACE(face)->stream;
-
-
- if ( bdf->table != NULL )
- FT_FRAME_RELEASE( bdf->table );
-
- bdf->table_end = NULL;
- bdf->strings = NULL;
- bdf->strings_size = 0;
- }
- }
-
-
- static FT_Error
- tt_face_load_bdf_props( TT_Face face,
- FT_Stream stream )
- {
- TT_BDF bdf = &face->bdf;
- FT_ULong length;
- FT_Error error;
-
-
- FT_ZERO( bdf );
-
- error = tt_face_goto_table( face, TTAG_BDF, stream, &length );
- if ( error ||
- length < 8 ||
- FT_FRAME_EXTRACT( length, bdf->table ) )
- {
- error = FT_THROW( Invalid_Table );
- goto Exit;
- }
-
- bdf->table_end = bdf->table + length;
-
- {
- FT_Byte* p = bdf->table;
- FT_UInt version = FT_NEXT_USHORT( p );
- FT_UInt num_strikes = FT_NEXT_USHORT( p );
- FT_ULong strings = FT_NEXT_ULONG ( p );
- FT_UInt count;
- FT_Byte* strike;
-
-
- if ( version != 0x0001 ||
- strings < 8 ||
- ( strings - 8 ) / 4 < num_strikes ||
- strings + 1 > length )
- {
- goto BadTable;
- }
-
- bdf->num_strikes = num_strikes;
- bdf->strings = bdf->table + strings;
- bdf->strings_size = length - strings;
-
- count = bdf->num_strikes;
- p = bdf->table + 8;
- strike = p + count * 4;
-
-
- for ( ; count > 0; count-- )
- {
- FT_UInt num_items = FT_PEEK_USHORT( p + 2 );
-
- /*
- * We don't need to check the value sets themselves, since this
- * is done later.
- */
- strike += 10 * num_items;
-
- p += 4;
- }
-
- if ( strike > bdf->strings )
- goto BadTable;
- }
-
- bdf->loaded = 1;
-
- Exit:
- return error;
-
- BadTable:
- FT_FRAME_RELEASE( bdf->table );
- FT_ZERO( bdf );
- error = FT_THROW( Invalid_Table );
- goto Exit;
- }
-
-
- FT_LOCAL_DEF( FT_Error )
- tt_face_find_bdf_prop( TT_Face face,
- const char* property_name,
- BDF_PropertyRec *aprop )
- {
- TT_BDF bdf = &face->bdf;
- FT_Size size = FT_FACE(face)->size;
- FT_Error error = FT_Err_Ok;
- FT_Byte* p;
- FT_UInt count;
- FT_Byte* strike;
- FT_Offset property_len;
-
-
- aprop->type = BDF_PROPERTY_TYPE_NONE;
-
- if ( bdf->loaded == 0 )
- {
- error = tt_face_load_bdf_props( face, FT_FACE( face )->stream );
- if ( error )
- goto Exit;
- }
-
- count = bdf->num_strikes;
- p = bdf->table + 8;
- strike = p + 4 * count;
-
- error = FT_ERR( Invalid_Argument );
-
- if ( size == NULL || property_name == NULL )
- goto Exit;
-
- property_len = ft_strlen( property_name );
- if ( property_len == 0 )
- goto Exit;
-
- for ( ; count > 0; count-- )
- {
- FT_UInt _ppem = FT_NEXT_USHORT( p );
- FT_UInt _count = FT_NEXT_USHORT( p );
-
- if ( _ppem == size->metrics.y_ppem )
- {
- count = _count;
- goto FoundStrike;
- }
-
- strike += 10 * _count;
- }
- goto Exit;
-
- FoundStrike:
- p = strike;
- for ( ; count > 0; count-- )
- {
- FT_UInt type = FT_PEEK_USHORT( p + 4 );
-
- if ( ( type & 0x10 ) != 0 )
- {
- FT_UInt32 name_offset = FT_PEEK_ULONG( p );
- FT_UInt32 value = FT_PEEK_ULONG( p + 6 );
-
- /* be a bit paranoid for invalid entries here */
- if ( name_offset < bdf->strings_size &&
- property_len < bdf->strings_size - name_offset &&
- ft_strncmp( property_name,
- (const char*)bdf->strings + name_offset,
- bdf->strings_size - name_offset ) == 0 )
- {
- switch ( type & 0x0F )
- {
- case 0x00: /* string */
- case 0x01: /* atoms */
- /* check that the content is really 0-terminated */
- if ( value < bdf->strings_size &&
- ft_memchr( bdf->strings + value, 0, bdf->strings_size ) )
- {
- aprop->type = BDF_PROPERTY_TYPE_ATOM;
- aprop->u.atom = (const char*)bdf->strings + value;
- error = FT_Err_Ok;
- goto Exit;
- }
- break;
-
- case 0x02:
- aprop->type = BDF_PROPERTY_TYPE_INTEGER;
- aprop->u.integer = (FT_Int32)value;
- error = FT_Err_Ok;
- goto Exit;
-
- case 0x03:
- aprop->type = BDF_PROPERTY_TYPE_CARDINAL;
- aprop->u.cardinal = value;
- error = FT_Err_Ok;
- goto Exit;
-
- default:
- ;
- }
- }
- }
- p += 10;
- }
-
- Exit:
- return error;
- }
-
-#endif /* TT_CONFIG_OPTION_BDF */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/sfnt/ttbdf.h b/chromium/third_party/pdfium/third_party/freetype/src/sfnt/ttbdf.h
deleted file mode 100644
index fe4ba489e8d..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/sfnt/ttbdf.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/***************************************************************************/
-/* */
-/* ttbdf.h */
-/* */
-/* TrueType and OpenType embedded BDF properties (specification). */
-/* */
-/* Copyright 2005-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __TTBDF_H__
-#define __TTBDF_H__
-
-
-#include <ft2build.h>
-#include "ttload.h"
-#include FT_BDF_H
-
-
-FT_BEGIN_HEADER
-
-
- FT_LOCAL( void )
- tt_face_free_bdf_props( TT_Face face );
-
-
- FT_LOCAL( FT_Error )
- tt_face_find_bdf_prop( TT_Face face,
- const char* property_name,
- BDF_PropertyRec *aprop );
-
-
-FT_END_HEADER
-
-#endif /* __TTBDF_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/sfnt/ttcmap.c b/chromium/third_party/pdfium/third_party/freetype/src/sfnt/ttcmap.c
deleted file mode 100644
index c4d9abdfe68..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/sfnt/ttcmap.c
+++ /dev/null
@@ -1,3721 +0,0 @@
-/***************************************************************************/
-/* */
-/* ttcmap.c */
-/* */
-/* TrueType character mapping table (cmap) support (body). */
-/* */
-/* Copyright 2002-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-
-#include "sferrors.h" /* must come before FT_INTERNAL_VALIDATE_H */
-
-#include FT_INTERNAL_VALIDATE_H
-#include FT_INTERNAL_STREAM_H
-#include "ttload.h"
-#include "ttcmap.h"
-#include "sfntpic.h"
-
-
- /*************************************************************************/
- /* */
- /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
- /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
- /* messages during execution. */
- /* */
-#undef FT_COMPONENT
-#define FT_COMPONENT trace_ttcmap
-
-
-#define TT_PEEK_SHORT FT_PEEK_SHORT
-#define TT_PEEK_USHORT FT_PEEK_USHORT
-#define TT_PEEK_UINT24 FT_PEEK_UOFF3
-#define TT_PEEK_LONG FT_PEEK_LONG
-#define TT_PEEK_ULONG FT_PEEK_ULONG
-
-#define TT_NEXT_SHORT FT_NEXT_SHORT
-#define TT_NEXT_USHORT FT_NEXT_USHORT
-#define TT_NEXT_UINT24 FT_NEXT_UOFF3
-#define TT_NEXT_LONG FT_NEXT_LONG
-#define TT_NEXT_ULONG FT_NEXT_ULONG
-
-
- /* Too large glyph index return values are caught in `FT_Get_Char_Index' */
- /* and `FT_Get_Next_Char' (the latter calls the internal `next' function */
- /* again in this case). To mark character code return values as invalid */
- /* it is sufficient to set the corresponding glyph index return value to */
- /* zero. */
-
-
- FT_CALLBACK_DEF( FT_Error )
- tt_cmap_init( TT_CMap cmap,
- FT_Byte* table )
- {
- cmap->data = table;
- return FT_Err_Ok;
- }
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** FORMAT 0 *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
- /*************************************************************************/
- /* */
- /* TABLE OVERVIEW */
- /* -------------- */
- /* */
- /* NAME OFFSET TYPE DESCRIPTION */
- /* */
- /* format 0 USHORT must be 0 */
- /* length 2 USHORT table length in bytes */
- /* language 4 USHORT Mac language code */
- /* glyph_ids 6 BYTE[256] array of glyph indices */
- /* 262 */
- /* */
-
-#ifdef TT_CONFIG_CMAP_FORMAT_0
-
- FT_CALLBACK_DEF( FT_Error )
- tt_cmap0_validate( FT_Byte* table,
- FT_Validator valid )
- {
- FT_Byte* p;
- FT_UInt length;
-
-
- if ( table + 2 + 2 > valid->limit )
- FT_INVALID_TOO_SHORT;
-
- p = table + 2; /* skip format */
- length = TT_NEXT_USHORT( p );
-
- if ( table + length > valid->limit || length < 262 )
- FT_INVALID_TOO_SHORT;
-
- /* check glyph indices whenever necessary */
- if ( valid->level >= FT_VALIDATE_TIGHT )
- {
- FT_UInt n, idx;
-
-
- p = table + 6;
- for ( n = 0; n < 256; n++ )
- {
- idx = *p++;
- if ( idx >= TT_VALID_GLYPH_COUNT( valid ) )
- FT_INVALID_GLYPH_ID;
- }
- }
-
- return FT_Err_Ok;
- }
-
-
- FT_CALLBACK_DEF( FT_UInt )
- tt_cmap0_char_index( TT_CMap cmap,
- FT_UInt32 char_code )
- {
- FT_Byte* table = cmap->data;
-
-
- return char_code < 256 ? table[6 + char_code] : 0;
- }
-
-
- FT_CALLBACK_DEF( FT_UInt32 )
- tt_cmap0_char_next( TT_CMap cmap,
- FT_UInt32 *pchar_code )
- {
- FT_Byte* table = cmap->data;
- FT_UInt32 charcode = *pchar_code;
- FT_UInt32 result = 0;
- FT_UInt gindex = 0;
-
-
- table += 6; /* go to glyph IDs */
- while ( ++charcode < 256 )
- {
- gindex = table[charcode];
- if ( gindex != 0 )
- {
- result = charcode;
- break;
- }
- }
-
- *pchar_code = result;
- return gindex;
- }
-
-
- FT_CALLBACK_DEF( FT_Error )
- tt_cmap0_get_info( TT_CMap cmap,
- TT_CMapInfo *cmap_info )
- {
- FT_Byte* p = cmap->data + 4;
-
-
- cmap_info->format = 0;
- cmap_info->language = (FT_ULong)TT_PEEK_USHORT( p );
-
- return FT_Err_Ok;
- }
-
-
- FT_DEFINE_TT_CMAP(
- tt_cmap0_class_rec,
- sizeof ( TT_CMapRec ),
-
- (FT_CMap_InitFunc) tt_cmap_init,
- (FT_CMap_DoneFunc) NULL,
- (FT_CMap_CharIndexFunc)tt_cmap0_char_index,
- (FT_CMap_CharNextFunc) tt_cmap0_char_next,
-
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
-
- 0,
- (TT_CMap_ValidateFunc)tt_cmap0_validate,
- (TT_CMap_Info_GetFunc)tt_cmap0_get_info )
-
-#endif /* TT_CONFIG_CMAP_FORMAT_0 */
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** FORMAT 2 *****/
- /***** *****/
- /***** This is used for certain CJK encodings that encode text in a *****/
- /***** mixed 8/16 bits encoding along the following lines. *****/
- /***** *****/
- /***** * Certain byte values correspond to an 8-bit character code *****/
- /***** (typically in the range 0..127 for ASCII compatibility). *****/
- /***** *****/
- /***** * Certain byte values signal the first byte of a 2-byte *****/
- /***** character code (but these values are also valid as the *****/
- /***** second byte of a 2-byte character). *****/
- /***** *****/
- /***** The following charmap lookup and iteration functions all *****/
- /***** assume that the value `charcode' fulfills the following. *****/
- /***** *****/
- /***** - For one byte characters, `charcode' is simply the *****/
- /***** character code. *****/
- /***** *****/
- /***** - For two byte characters, `charcode' is the 2-byte *****/
- /***** character code in big endian format. More precisely: *****/
- /***** *****/
- /***** (charcode >> 8) is the first byte value *****/
- /***** (charcode & 0xFF) is the second byte value *****/
- /***** *****/
- /***** Note that not all values of `charcode' are valid according *****/
- /***** to these rules, and the function moderately checks the *****/
- /***** arguments. *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
- /*************************************************************************/
- /* */
- /* TABLE OVERVIEW */
- /* -------------- */
- /* */
- /* NAME OFFSET TYPE DESCRIPTION */
- /* */
- /* format 0 USHORT must be 2 */
- /* length 2 USHORT table length in bytes */
- /* language 4 USHORT Mac language code */
- /* keys 6 USHORT[256] sub-header keys */
- /* subs 518 SUBHEAD[NSUBS] sub-headers array */
- /* glyph_ids 518+NSUB*8 USHORT[] glyph ID array */
- /* */
- /* The `keys' table is used to map charcode high-bytes to sub-headers. */
- /* The value of `NSUBS' is the number of sub-headers defined in the */
- /* table and is computed by finding the maximum of the `keys' table. */
- /* */
- /* Note that for any n, `keys[n]' is a byte offset within the `subs' */
- /* table, i.e., it is the corresponding sub-header index multiplied */
- /* by 8. */
- /* */
- /* Each sub-header has the following format. */
- /* */
- /* NAME OFFSET TYPE DESCRIPTION */
- /* */
- /* first 0 USHORT first valid low-byte */
- /* count 2 USHORT number of valid low-bytes */
- /* delta 4 SHORT see below */
- /* offset 6 USHORT see below */
- /* */
- /* A sub-header defines, for each high-byte, the range of valid */
- /* low-bytes within the charmap. Note that the range defined by `first' */
- /* and `count' must be completely included in the interval [0..255] */
- /* according to the specification. */
- /* */
- /* If a character code is contained within a given sub-header, then */
- /* mapping it to a glyph index is done as follows. */
- /* */
- /* * The value of `offset' is read. This is a _byte_ distance from the */
- /* location of the `offset' field itself into a slice of the */
- /* `glyph_ids' table. Let's call it `slice' (it is a USHORT[], too). */
- /* */
- /* * The value `slice[char.lo - first]' is read. If it is 0, there is */
- /* no glyph for the charcode. Otherwise, the value of `delta' is */
- /* added to it (modulo 65536) to form a new glyph index. */
- /* */
- /* It is up to the validation routine to check that all offsets fall */
- /* within the glyph IDs table (and not within the `subs' table itself or */
- /* outside of the CMap). */
- /* */
-
-#ifdef TT_CONFIG_CMAP_FORMAT_2
-
- FT_CALLBACK_DEF( FT_Error )
- tt_cmap2_validate( FT_Byte* table,
- FT_Validator valid )
- {
- FT_Byte* p;
- FT_UInt length;
-
- FT_UInt n, max_subs;
- FT_Byte* keys; /* keys table */
- FT_Byte* subs; /* sub-headers */
- FT_Byte* glyph_ids; /* glyph ID array */
-
-
- if ( table + 2 + 2 > valid->limit )
- FT_INVALID_TOO_SHORT;
-
- p = table + 2; /* skip format */
- length = TT_NEXT_USHORT( p );
-
- if ( table + length > valid->limit || length < 6 + 512 )
- FT_INVALID_TOO_SHORT;
-
- keys = table + 6;
-
- /* parse keys to compute sub-headers count */
- p = keys;
- max_subs = 0;
- for ( n = 0; n < 256; n++ )
- {
- FT_UInt idx = TT_NEXT_USHORT( p );
-
-
- /* value must be multiple of 8 */
- if ( valid->level >= FT_VALIDATE_PARANOID && ( idx & 7 ) != 0 )
- FT_INVALID_DATA;
-
- idx >>= 3;
-
- if ( idx > max_subs )
- max_subs = idx;
- }
-
- FT_ASSERT( p == table + 518 );
-
- subs = p;
- glyph_ids = subs + ( max_subs + 1 ) * 8;
- if ( glyph_ids > valid->limit )
- FT_INVALID_TOO_SHORT;
-
- /* parse sub-headers */
- for ( n = 0; n <= max_subs; n++ )
- {
- FT_UInt first_code, code_count, offset;
- FT_Int delta;
-
-
- first_code = TT_NEXT_USHORT( p );
- code_count = TT_NEXT_USHORT( p );
- delta = TT_NEXT_SHORT( p );
- offset = TT_NEXT_USHORT( p );
-
- /* many Dynalab fonts have empty sub-headers */
- if ( code_count == 0 )
- continue;
-
- /* check range within 0..255 */
- if ( valid->level >= FT_VALIDATE_PARANOID )
- {
- if ( first_code >= 256 || first_code + code_count > 256 )
- FT_INVALID_DATA;
- }
-
- /* check offset */
- if ( offset != 0 )
- {
- FT_Byte* ids;
-
-
- ids = p - 2 + offset;
- if ( ids < glyph_ids || ids + code_count * 2 > table + length )
- FT_INVALID_OFFSET;
-
- /* check glyph IDs */
- if ( valid->level >= FT_VALIDATE_TIGHT )
- {
- FT_Byte* limit = p + code_count * 2;
- FT_UInt idx;
-
-
- for ( ; p < limit; )
- {
- idx = TT_NEXT_USHORT( p );
- if ( idx != 0 )
- {
- idx = (FT_UInt)( (FT_Int)idx + delta ) & 0xFFFFU;
- if ( idx >= TT_VALID_GLYPH_COUNT( valid ) )
- FT_INVALID_GLYPH_ID;
- }
- }
- }
- }
- }
-
- return FT_Err_Ok;
- }
-
-
- /* return sub header corresponding to a given character code */
- /* NULL on invalid charcode */
- static FT_Byte*
- tt_cmap2_get_subheader( FT_Byte* table,
- FT_UInt32 char_code )
- {
- FT_Byte* result = NULL;
-
-
- if ( char_code < 0x10000UL )
- {
- FT_UInt char_lo = (FT_UInt)( char_code & 0xFF );
- FT_UInt char_hi = (FT_UInt)( char_code >> 8 );
- FT_Byte* p = table + 6; /* keys table */
- FT_Byte* subs = table + 518; /* subheaders table */
- FT_Byte* sub;
-
-
- if ( char_hi == 0 )
- {
- /* an 8-bit character code -- we use subHeader 0 in this case */
- /* to test whether the character code is in the charmap */
- /* */
- sub = subs; /* jump to first sub-header */
-
- /* check that the sub-header for this byte is 0, which */
- /* indicates that it is really a valid one-byte value */
- /* Otherwise, return 0 */
- /* */
- p += char_lo * 2;
- if ( TT_PEEK_USHORT( p ) != 0 )
- goto Exit;
- }
- else
- {
- /* a 16-bit character code */
-
- /* jump to key entry */
- p += char_hi * 2;
- /* jump to sub-header */
- sub = subs + ( FT_PAD_FLOOR( TT_PEEK_USHORT( p ), 8 ) );
-
- /* check that the high byte isn't a valid one-byte value */
- if ( sub == subs )
- goto Exit;
- }
- result = sub;
- }
-
- Exit:
- return result;
- }
-
-
- FT_CALLBACK_DEF( FT_UInt )
- tt_cmap2_char_index( TT_CMap cmap,
- FT_UInt32 char_code )
- {
- FT_Byte* table = cmap->data;
- FT_UInt result = 0;
- FT_Byte* subheader;
-
-
- subheader = tt_cmap2_get_subheader( table, char_code );
- if ( subheader )
- {
- FT_Byte* p = subheader;
- FT_UInt idx = (FT_UInt)(char_code & 0xFF);
- FT_UInt start, count;
- FT_Int delta;
- FT_UInt offset;
-
-
- start = TT_NEXT_USHORT( p );
- count = TT_NEXT_USHORT( p );
- delta = TT_NEXT_SHORT ( p );
- offset = TT_PEEK_USHORT( p );
-
- idx -= start;
- if ( idx < count && offset != 0 )
- {
- p += offset + 2 * idx;
- idx = TT_PEEK_USHORT( p );
-
- if ( idx != 0 )
- result = (FT_UInt)( (FT_Int)idx + delta ) & 0xFFFFU;
- }
- }
-
- return result;
- }
-
-
- FT_CALLBACK_DEF( FT_UInt32 )
- tt_cmap2_char_next( TT_CMap cmap,
- FT_UInt32 *pcharcode )
- {
- FT_Byte* table = cmap->data;
- FT_UInt gindex = 0;
- FT_UInt32 result = 0;
- FT_UInt32 charcode = *pcharcode + 1;
- FT_Byte* subheader;
-
-
- while ( charcode < 0x10000UL )
- {
- subheader = tt_cmap2_get_subheader( table, charcode );
- if ( subheader )
- {
- FT_Byte* p = subheader;
- FT_UInt start = TT_NEXT_USHORT( p );
- FT_UInt count = TT_NEXT_USHORT( p );
- FT_Int delta = TT_NEXT_SHORT ( p );
- FT_UInt offset = TT_PEEK_USHORT( p );
- FT_UInt char_lo = (FT_UInt)( charcode & 0xFF );
- FT_UInt pos, idx;
-
-
- if ( offset == 0 )
- goto Next_SubHeader;
-
- if ( char_lo < start )
- {
- char_lo = start;
- pos = 0;
- }
- else
- pos = (FT_UInt)( char_lo - start );
-
- p += offset + pos * 2;
- charcode = FT_PAD_FLOOR( charcode, 256 ) + char_lo;
-
- for ( ; pos < count; pos++, charcode++ )
- {
- idx = TT_NEXT_USHORT( p );
-
- if ( idx != 0 )
- {
- gindex = (FT_UInt)( (FT_Int)idx + delta ) & 0xFFFFU;
- if ( gindex != 0 )
- {
- result = charcode;
- goto Exit;
- }
- }
- }
- }
-
- /* jump to next sub-header, i.e. higher byte value */
- Next_SubHeader:
- charcode = FT_PAD_FLOOR( charcode, 256 ) + 256;
- }
-
- Exit:
- *pcharcode = result;
-
- return gindex;
- }
-
-
- FT_CALLBACK_DEF( FT_Error )
- tt_cmap2_get_info( TT_CMap cmap,
- TT_CMapInfo *cmap_info )
- {
- FT_Byte* p = cmap->data + 4;
-
-
- cmap_info->format = 2;
- cmap_info->language = (FT_ULong)TT_PEEK_USHORT( p );
-
- return FT_Err_Ok;
- }
-
-
- FT_DEFINE_TT_CMAP(
- tt_cmap2_class_rec,
- sizeof ( TT_CMapRec ),
-
- (FT_CMap_InitFunc) tt_cmap_init,
- (FT_CMap_DoneFunc) NULL,
- (FT_CMap_CharIndexFunc)tt_cmap2_char_index,
- (FT_CMap_CharNextFunc) tt_cmap2_char_next,
-
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
-
- 2,
- (TT_CMap_ValidateFunc)tt_cmap2_validate,
- (TT_CMap_Info_GetFunc)tt_cmap2_get_info )
-
-#endif /* TT_CONFIG_CMAP_FORMAT_2 */
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** FORMAT 4 *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
- /*************************************************************************/
- /* */
- /* TABLE OVERVIEW */
- /* -------------- */
- /* */
- /* NAME OFFSET TYPE DESCRIPTION */
- /* */
- /* format 0 USHORT must be 4 */
- /* length 2 USHORT table length */
- /* in bytes */
- /* language 4 USHORT Mac language code */
- /* */
- /* segCountX2 6 USHORT 2*NUM_SEGS */
- /* searchRange 8 USHORT 2*(1 << LOG_SEGS) */
- /* entrySelector 10 USHORT LOG_SEGS */
- /* rangeShift 12 USHORT segCountX2 - */
- /* searchRange */
- /* */
- /* endCount 14 USHORT[NUM_SEGS] end charcode for */
- /* each segment; last */
- /* is 0xFFFF */
- /* */
- /* pad 14+NUM_SEGS*2 USHORT padding */
- /* */
- /* startCount 16+NUM_SEGS*2 USHORT[NUM_SEGS] first charcode for */
- /* each segment */
- /* */
- /* idDelta 16+NUM_SEGS*4 SHORT[NUM_SEGS] delta for each */
- /* segment */
- /* idOffset 16+NUM_SEGS*6 SHORT[NUM_SEGS] range offset for */
- /* each segment; can be */
- /* zero */
- /* */
- /* glyphIds 16+NUM_SEGS*8 USHORT[] array of glyph ID */
- /* ranges */
- /* */
- /* Character codes are modelled by a series of ordered (increasing) */
- /* intervals called segments. Each segment has start and end codes, */
- /* provided by the `startCount' and `endCount' arrays. Segments must */
- /* not overlap, and the last segment should always contain the value */
- /* 0xFFFF for `endCount'. */
- /* */
- /* The fields `searchRange', `entrySelector' and `rangeShift' are better */
- /* ignored (they are traces of over-engineering in the TrueType */
- /* specification). */
- /* */
- /* Each segment also has a signed `delta', as well as an optional offset */
- /* within the `glyphIds' table. */
- /* */
- /* If a segment's idOffset is 0, the glyph index corresponding to any */
- /* charcode within the segment is obtained by adding the value of */
- /* `idDelta' directly to the charcode, modulo 65536. */
- /* */
- /* Otherwise, a glyph index is taken from the glyph IDs sub-array for */
- /* the segment, and the value of `idDelta' is added to it. */
- /* */
- /* */
- /* Finally, note that a lot of fonts contain an invalid last segment, */
- /* where `start' and `end' are correctly set to 0xFFFF but both `delta' */
- /* and `offset' are incorrect (e.g., `opens___.ttf' which comes with */
- /* OpenOffice.org). We need special code to deal with them correctly. */
- /* */
-
-#ifdef TT_CONFIG_CMAP_FORMAT_4
-
- typedef struct TT_CMap4Rec_
- {
- TT_CMapRec cmap;
- FT_UInt32 cur_charcode; /* current charcode */
- FT_UInt cur_gindex; /* current glyph index */
-
- FT_UInt num_ranges;
- FT_UInt cur_range;
- FT_UInt cur_start;
- FT_UInt cur_end;
- FT_Int cur_delta;
- FT_Byte* cur_values;
-
- } TT_CMap4Rec, *TT_CMap4;
-
-
- FT_CALLBACK_DEF( FT_Error )
- tt_cmap4_init( TT_CMap4 cmap,
- FT_Byte* table )
- {
- FT_Byte* p;
-
-
- cmap->cmap.data = table;
-
- p = table + 6;
- cmap->num_ranges = FT_PEEK_USHORT( p ) >> 1;
- cmap->cur_charcode = (FT_UInt32)0xFFFFFFFFUL;
- cmap->cur_gindex = 0;
-
- return FT_Err_Ok;
- }
-
-
- static FT_Int
- tt_cmap4_set_range( TT_CMap4 cmap,
- FT_UInt range_index )
- {
- FT_Byte* table = cmap->cmap.data;
- FT_Byte* p;
- FT_UInt num_ranges = cmap->num_ranges;
-
-
- while ( range_index < num_ranges )
- {
- FT_UInt offset;
-
-
- p = table + 14 + range_index * 2;
- cmap->cur_end = FT_PEEK_USHORT( p );
-
- p += 2 + num_ranges * 2;
- cmap->cur_start = FT_PEEK_USHORT( p );
-
- p += num_ranges * 2;
- cmap->cur_delta = FT_PEEK_SHORT( p );
-
- p += num_ranges * 2;
- offset = FT_PEEK_USHORT( p );
-
- /* some fonts have an incorrect last segment; */
- /* we have to catch it */
- if ( range_index >= num_ranges - 1 &&
- cmap->cur_start == 0xFFFFU &&
- cmap->cur_end == 0xFFFFU )
- {
- TT_Face face = (TT_Face)cmap->cmap.cmap.charmap.face;
- FT_Byte* limit = face->cmap_table + face->cmap_size;
-
-
- if ( offset && p + offset + 2 > limit )
- {
- cmap->cur_delta = 1;
- offset = 0;
- }
- }
-
- if ( offset != 0xFFFFU )
- {
- cmap->cur_values = offset ? p + offset : NULL;
- cmap->cur_range = range_index;
- return 0;
- }
-
- /* we skip empty segments */
- range_index++;
- }
-
- return -1;
- }
-
-
- /* search the index of the charcode next to cmap->cur_charcode; */
- /* caller should call tt_cmap4_set_range with proper range */
- /* before calling this function */
- /* */
- static void
- tt_cmap4_next( TT_CMap4 cmap )
- {
- FT_UInt charcode;
-
-
- if ( cmap->cur_charcode >= 0xFFFFUL )
- goto Fail;
-
- charcode = (FT_UInt)cmap->cur_charcode + 1;
-
- if ( charcode < cmap->cur_start )
- charcode = cmap->cur_start;
-
- for ( ;; )
- {
- FT_Byte* values = cmap->cur_values;
- FT_UInt end = cmap->cur_end;
- FT_Int delta = cmap->cur_delta;
-
-
- if ( charcode <= end )
- {
- if ( values )
- {
- FT_Byte* p = values + 2 * ( charcode - cmap->cur_start );
-
-
- do
- {
- FT_UInt gindex = FT_NEXT_USHORT( p );
-
-
- if ( gindex != 0 )
- {
- gindex = (FT_UInt)( (FT_Int)gindex + delta ) & 0xFFFFU;
- if ( gindex != 0 )
- {
- cmap->cur_charcode = charcode;
- cmap->cur_gindex = gindex;
- return;
- }
- }
- } while ( ++charcode <= end );
- }
- else
- {
- do
- {
- FT_UInt gindex = (FT_UInt)( (FT_Int)charcode + delta ) & 0xFFFFU;
-
-
- if ( gindex != 0 )
- {
- cmap->cur_charcode = charcode;
- cmap->cur_gindex = gindex;
- return;
- }
- } while ( ++charcode <= end );
- }
- }
-
- /* we need to find another range */
- if ( tt_cmap4_set_range( cmap, cmap->cur_range + 1 ) < 0 )
- break;
-
- if ( charcode < cmap->cur_start )
- charcode = cmap->cur_start;
- }
-
- Fail:
- cmap->cur_charcode = (FT_UInt32)0xFFFFFFFFUL;
- cmap->cur_gindex = 0;
- }
-
-
- FT_CALLBACK_DEF( FT_Error )
- tt_cmap4_validate( FT_Byte* table,
- FT_Validator valid )
- {
- FT_Byte* p;
- FT_UInt length;
-
- FT_Byte *ends, *starts, *offsets, *deltas, *glyph_ids;
- FT_UInt num_segs;
- FT_Error error = FT_Err_Ok;
-
-
- if ( table + 2 + 2 > valid->limit )
- FT_INVALID_TOO_SHORT;
-
- p = table + 2; /* skip format */
- length = TT_NEXT_USHORT( p );
-
- /* in certain fonts, the `length' field is invalid and goes */
- /* out of bound. We try to correct this here... */
- if ( table + length > valid->limit )
- {
- if ( valid->level >= FT_VALIDATE_TIGHT )
- FT_INVALID_TOO_SHORT;
-
- length = (FT_UInt)( valid->limit - table );
- }
-
- if ( length < 16 )
- FT_INVALID_TOO_SHORT;
-
- p = table + 6;
- num_segs = TT_NEXT_USHORT( p ); /* read segCountX2 */
-
- if ( valid->level >= FT_VALIDATE_PARANOID )
- {
- /* check that we have an even value here */
- if ( num_segs & 1 )
- FT_INVALID_DATA;
- }
-
- num_segs /= 2;
-
- if ( length < 16 + num_segs * 2 * 4 )
- FT_INVALID_TOO_SHORT;
-
- /* check the search parameters - even though we never use them */
- /* */
- if ( valid->level >= FT_VALIDATE_PARANOID )
- {
- /* check the values of `searchRange', `entrySelector', `rangeShift' */
- FT_UInt search_range = TT_NEXT_USHORT( p );
- FT_UInt entry_selector = TT_NEXT_USHORT( p );
- FT_UInt range_shift = TT_NEXT_USHORT( p );
-
-
- if ( ( search_range | range_shift ) & 1 ) /* must be even values */
- FT_INVALID_DATA;
-
- search_range /= 2;
- range_shift /= 2;
-
- /* `search range' is the greatest power of 2 that is <= num_segs */
-
- if ( search_range > num_segs ||
- search_range * 2 < num_segs ||
- search_range + range_shift != num_segs ||
- search_range != ( 1U << entry_selector ) )
- FT_INVALID_DATA;
- }
-
- ends = table + 14;
- starts = table + 16 + num_segs * 2;
- deltas = starts + num_segs * 2;
- offsets = deltas + num_segs * 2;
- glyph_ids = offsets + num_segs * 2;
-
- /* check last segment; its end count value must be 0xFFFF */
- if ( valid->level >= FT_VALIDATE_PARANOID )
- {
- p = ends + ( num_segs - 1 ) * 2;
- if ( TT_PEEK_USHORT( p ) != 0xFFFFU )
- FT_INVALID_DATA;
- }
-
- {
- FT_UInt start, end, offset, n;
- FT_UInt last_start = 0, last_end = 0;
- FT_Int delta;
- FT_Byte* p_start = starts;
- FT_Byte* p_end = ends;
- FT_Byte* p_delta = deltas;
- FT_Byte* p_offset = offsets;
-
-
- for ( n = 0; n < num_segs; n++ )
- {
- p = p_offset;
- start = TT_NEXT_USHORT( p_start );
- end = TT_NEXT_USHORT( p_end );
- delta = TT_NEXT_SHORT( p_delta );
- offset = TT_NEXT_USHORT( p_offset );
-
- if ( start > end )
- FT_INVALID_DATA;
-
- /* this test should be performed at default validation level; */
- /* unfortunately, some popular Asian fonts have overlapping */
- /* ranges in their charmaps */
- /* */
- if ( start <= last_end && n > 0 )
- {
- if ( valid->level >= FT_VALIDATE_TIGHT )
- FT_INVALID_DATA;
- else
- {
- /* allow overlapping segments, provided their start points */
- /* and end points, respectively, are in ascending order */
- /* */
- if ( last_start > start || last_end > end )
- error |= TT_CMAP_FLAG_UNSORTED;
- else
- error |= TT_CMAP_FLAG_OVERLAPPING;
- }
- }
-
- if ( offset && offset != 0xFFFFU )
- {
- p += offset; /* start of glyph ID array */
-
- /* check that we point within the glyph IDs table only */
- if ( valid->level >= FT_VALIDATE_TIGHT )
- {
- if ( p < glyph_ids ||
- p + ( end - start + 1 ) * 2 > table + length )
- FT_INVALID_DATA;
- }
- /* Some fonts handle the last segment incorrectly. In */
- /* theory, 0xFFFF might point to an ordinary glyph -- */
- /* a cmap 4 is versatile and could be used for any */
- /* encoding, not only Unicode. However, reality shows */
- /* that far too many fonts are sloppy and incorrectly */
- /* set all fields but `start' and `end' for the last */
- /* segment if it contains only a single character. */
- /* */
- /* We thus omit the test here, delaying it to the */
- /* routines that actually access the cmap. */
- else if ( n != num_segs - 1 ||
- !( start == 0xFFFFU && end == 0xFFFFU ) )
- {
- if ( p < glyph_ids ||
- p + ( end - start + 1 ) * 2 > valid->limit )
- FT_INVALID_DATA;
- }
-
- /* check glyph indices within the segment range */
- if ( valid->level >= FT_VALIDATE_TIGHT )
- {
- FT_UInt i, idx;
-
-
- for ( i = start; i < end; i++ )
- {
- idx = FT_NEXT_USHORT( p );
- if ( idx != 0 )
- {
- idx = (FT_UInt)( (FT_Int)idx + delta ) & 0xFFFFU;
-
- if ( idx >= TT_VALID_GLYPH_COUNT( valid ) )
- FT_INVALID_GLYPH_ID;
- }
- }
- }
- }
- else if ( offset == 0xFFFFU )
- {
- /* some fonts (erroneously?) use a range offset of 0xFFFF */
- /* to mean missing glyph in cmap table */
- /* */
- if ( valid->level >= FT_VALIDATE_PARANOID ||
- n != num_segs - 1 ||
- !( start == 0xFFFFU && end == 0xFFFFU ) )
- FT_INVALID_DATA;
- }
-
- last_start = start;
- last_end = end;
- }
- }
-
- return error;
- }
-
-
- static FT_UInt
- tt_cmap4_char_map_linear( TT_CMap cmap,
- FT_UInt32* pcharcode,
- FT_Bool next )
- {
- TT_Face face = (TT_Face)cmap->cmap.charmap.face;
- FT_Byte* limit = face->cmap_table + face->cmap_size;
-
-
- FT_UInt num_segs2, start, end, offset;
- FT_Int delta;
- FT_UInt i, num_segs;
- FT_UInt32 charcode = *pcharcode;
- FT_UInt gindex = 0;
- FT_Byte* p;
- FT_Byte* q;
-
-
- p = cmap->data + 6;
- num_segs2 = FT_PAD_FLOOR( TT_PEEK_USHORT( p ), 2 );
-
- num_segs = num_segs2 >> 1;
-
- if ( !num_segs )
- return 0;
-
- if ( next )
- charcode++;
-
- if ( charcode > 0xFFFFU )
- return 0;
-
- /* linear search */
- p = cmap->data + 14; /* ends table */
- q = cmap->data + 16 + num_segs2; /* starts table */
-
- for ( i = 0; i < num_segs; i++ )
- {
- end = TT_NEXT_USHORT( p );
- start = TT_NEXT_USHORT( q );
-
- if ( charcode < start )
- {
- if ( next )
- charcode = start;
- else
- break;
- }
-
- Again:
- if ( charcode <= end )
- {
- FT_Byte* r;
-
-
- r = q - 2 + num_segs2;
- delta = TT_PEEK_SHORT( r );
- r += num_segs2;
- offset = TT_PEEK_USHORT( r );
-
- /* some fonts have an incorrect last segment; */
- /* we have to catch it */
- if ( i >= num_segs - 1 &&
- start == 0xFFFFU && end == 0xFFFFU )
- {
- if ( offset && r + offset + 2 > limit )
- {
- delta = 1;
- offset = 0;
- }
- }
-
- if ( offset == 0xFFFFU )
- continue;
-
- if ( offset )
- {
- r += offset + ( charcode - start ) * 2;
-
- /* if r > limit, the whole segment is invalid */
- if ( next && r > limit )
- continue;
-
- gindex = TT_PEEK_USHORT( r );
- if ( gindex )
- {
- gindex = (FT_UInt)( (FT_Int)gindex + delta ) & 0xFFFFU;
- if ( gindex >= (FT_UInt)face->root.num_glyphs )
- gindex = 0;
- }
- }
- else
- {
- gindex = (FT_UInt)( (FT_Int)charcode + delta ) & 0xFFFFU;
-
- if ( next && gindex >= (FT_UInt)face->root.num_glyphs )
- {
- /* we have an invalid glyph index; if there is an overflow, */
- /* we can adjust `charcode', otherwise the whole segment is */
- /* invalid */
- gindex = 0;
-
- if ( (FT_Int)charcode + delta < 0 &&
- (FT_Int)end + delta >= 0 )
- charcode = (FT_UInt)( -delta );
-
- else if ( (FT_Int)charcode + delta < 0x10000L &&
- (FT_Int)end + delta >= 0x10000L )
- charcode = (FT_UInt)( 0x10000L - delta );
-
- else
- continue;
- }
- }
-
- if ( next && !gindex )
- {
- if ( charcode >= 0xFFFFU )
- break;
-
- charcode++;
- goto Again;
- }
-
- break;
- }
- }
-
- if ( next )
- *pcharcode = charcode;
-
- return gindex;
- }
-
-
- static FT_UInt
- tt_cmap4_char_map_binary( TT_CMap cmap,
- FT_UInt32* pcharcode,
- FT_Bool next )
- {
- FT_UInt num_segs2, start, end, offset;
- FT_Int delta;
- FT_UInt max, min, mid, num_segs;
- FT_UInt charcode = (FT_UInt)*pcharcode;
- FT_UInt gindex = 0;
- FT_Byte* p;
-
-
- p = cmap->data + 6;
- num_segs2 = FT_PAD_FLOOR( TT_PEEK_USHORT( p ), 2 );
-
- if ( !num_segs2 )
- return 0;
-
- num_segs = num_segs2 >> 1;
-
- /* make compiler happy */
- mid = num_segs;
- end = 0xFFFFU;
-
- if ( next )
- charcode++;
-
- min = 0;
- max = num_segs;
-
- /* binary search */
- while ( min < max )
- {
- mid = ( min + max ) >> 1;
- p = cmap->data + 14 + mid * 2;
- end = TT_PEEK_USHORT( p );
- p += 2 + num_segs2;
- start = TT_PEEK_USHORT( p );
-
- if ( charcode < start )
- max = mid;
- else if ( charcode > end )
- min = mid + 1;
- else
- {
- p += num_segs2;
- delta = TT_PEEK_SHORT( p );
- p += num_segs2;
- offset = TT_PEEK_USHORT( p );
-
- /* some fonts have an incorrect last segment; */
- /* we have to catch it */
- if ( mid >= num_segs - 1 &&
- start == 0xFFFFU && end == 0xFFFFU )
- {
- TT_Face face = (TT_Face)cmap->cmap.charmap.face;
- FT_Byte* limit = face->cmap_table + face->cmap_size;
-
-
- if ( offset && p + offset + 2 > limit )
- {
- delta = 1;
- offset = 0;
- }
- }
-
- /* search the first segment containing `charcode' */
- if ( cmap->flags & TT_CMAP_FLAG_OVERLAPPING )
- {
- FT_UInt i;
-
-
- /* call the current segment `max' */
- max = mid;
-
- if ( offset == 0xFFFFU )
- mid = max + 1;
-
- /* search in segments before the current segment */
- for ( i = max ; i > 0; i-- )
- {
- FT_UInt prev_end;
- FT_Byte* old_p;
-
-
- old_p = p;
- p = cmap->data + 14 + ( i - 1 ) * 2;
- prev_end = TT_PEEK_USHORT( p );
-
- if ( charcode > prev_end )
- {
- p = old_p;
- break;
- }
-
- end = prev_end;
- p += 2 + num_segs2;
- start = TT_PEEK_USHORT( p );
- p += num_segs2;
- delta = TT_PEEK_SHORT( p );
- p += num_segs2;
- offset = TT_PEEK_USHORT( p );
-
- if ( offset != 0xFFFFU )
- mid = i - 1;
- }
-
- /* no luck */
- if ( mid == max + 1 )
- {
- if ( i != max )
- {
- p = cmap->data + 14 + max * 2;
- end = TT_PEEK_USHORT( p );
- p += 2 + num_segs2;
- start = TT_PEEK_USHORT( p );
- p += num_segs2;
- delta = TT_PEEK_SHORT( p );
- p += num_segs2;
- offset = TT_PEEK_USHORT( p );
- }
-
- mid = max;
-
- /* search in segments after the current segment */
- for ( i = max + 1; i < num_segs; i++ )
- {
- FT_UInt next_end, next_start;
-
-
- p = cmap->data + 14 + i * 2;
- next_end = TT_PEEK_USHORT( p );
- p += 2 + num_segs2;
- next_start = TT_PEEK_USHORT( p );
-
- if ( charcode < next_start )
- break;
-
- end = next_end;
- start = next_start;
- p += num_segs2;
- delta = TT_PEEK_SHORT( p );
- p += num_segs2;
- offset = TT_PEEK_USHORT( p );
-
- if ( offset != 0xFFFFU )
- mid = i;
- }
- i--;
-
- /* still no luck */
- if ( mid == max )
- {
- mid = i;
-
- break;
- }
- }
-
- /* end, start, delta, and offset are for the i'th segment */
- if ( mid != i )
- {
- p = cmap->data + 14 + mid * 2;
- end = TT_PEEK_USHORT( p );
- p += 2 + num_segs2;
- start = TT_PEEK_USHORT( p );
- p += num_segs2;
- delta = TT_PEEK_SHORT( p );
- p += num_segs2;
- offset = TT_PEEK_USHORT( p );
- }
- }
- else
- {
- if ( offset == 0xFFFFU )
- break;
- }
-
- if ( offset )
- {
- p += offset + ( charcode - start ) * 2;
- gindex = TT_PEEK_USHORT( p );
- if ( gindex != 0 )
- gindex = (FT_UInt)( (FT_Int)gindex + delta ) & 0xFFFFU;
- }
- else
- gindex = (FT_UInt)( (FT_Int)charcode + delta ) & 0xFFFFU;
-
- break;
- }
- }
-
- if ( next )
- {
- TT_CMap4 cmap4 = (TT_CMap4)cmap;
-
-
- /* if `charcode' is not in any segment, then `mid' is */
- /* the segment nearest to `charcode' */
-
- if ( charcode > end )
- {
- mid++;
- if ( mid == num_segs )
- return 0;
- }
-
- if ( tt_cmap4_set_range( cmap4, mid ) )
- {
- if ( gindex )
- *pcharcode = charcode;
- }
- else
- {
- cmap4->cur_charcode = charcode;
-
- if ( gindex )
- cmap4->cur_gindex = gindex;
- else
- {
- cmap4->cur_charcode = charcode;
- tt_cmap4_next( cmap4 );
- gindex = cmap4->cur_gindex;
- }
-
- if ( gindex )
- *pcharcode = cmap4->cur_charcode;
- }
- }
-
- return gindex;
- }
-
-
- FT_CALLBACK_DEF( FT_UInt )
- tt_cmap4_char_index( TT_CMap cmap,
- FT_UInt32 char_code )
- {
- if ( char_code >= 0x10000UL )
- return 0;
-
- if ( cmap->flags & TT_CMAP_FLAG_UNSORTED )
- return tt_cmap4_char_map_linear( cmap, &char_code, 0 );
- else
- return tt_cmap4_char_map_binary( cmap, &char_code, 0 );
- }
-
-
- FT_CALLBACK_DEF( FT_UInt32 )
- tt_cmap4_char_next( TT_CMap cmap,
- FT_UInt32 *pchar_code )
- {
- FT_UInt gindex;
-
-
- if ( *pchar_code >= 0xFFFFU )
- return 0;
-
- if ( cmap->flags & TT_CMAP_FLAG_UNSORTED )
- gindex = tt_cmap4_char_map_linear( cmap, pchar_code, 1 );
- else
- {
- TT_CMap4 cmap4 = (TT_CMap4)cmap;
-
-
- /* no need to search */
- if ( *pchar_code == cmap4->cur_charcode )
- {
- tt_cmap4_next( cmap4 );
- gindex = cmap4->cur_gindex;
- if ( gindex )
- *pchar_code = cmap4->cur_charcode;
- }
- else
- gindex = tt_cmap4_char_map_binary( cmap, pchar_code, 1 );
- }
-
- return gindex;
- }
-
-
- FT_CALLBACK_DEF( FT_Error )
- tt_cmap4_get_info( TT_CMap cmap,
- TT_CMapInfo *cmap_info )
- {
- FT_Byte* p = cmap->data + 4;
-
-
- cmap_info->format = 4;
- cmap_info->language = (FT_ULong)TT_PEEK_USHORT( p );
-
- return FT_Err_Ok;
- }
-
-
- FT_DEFINE_TT_CMAP(
- tt_cmap4_class_rec,
- sizeof ( TT_CMap4Rec ),
- (FT_CMap_InitFunc) tt_cmap4_init,
- (FT_CMap_DoneFunc) NULL,
- (FT_CMap_CharIndexFunc)tt_cmap4_char_index,
- (FT_CMap_CharNextFunc) tt_cmap4_char_next,
-
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
-
- 4,
- (TT_CMap_ValidateFunc)tt_cmap4_validate,
- (TT_CMap_Info_GetFunc)tt_cmap4_get_info )
-
-#endif /* TT_CONFIG_CMAP_FORMAT_4 */
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** FORMAT 6 *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
- /*************************************************************************/
- /* */
- /* TABLE OVERVIEW */
- /* -------------- */
- /* */
- /* NAME OFFSET TYPE DESCRIPTION */
- /* */
- /* format 0 USHORT must be 6 */
- /* length 2 USHORT table length in bytes */
- /* language 4 USHORT Mac language code */
- /* */
- /* first 6 USHORT first segment code */
- /* count 8 USHORT segment size in chars */
- /* glyphIds 10 USHORT[count] glyph IDs */
- /* */
- /* A very simplified segment mapping. */
- /* */
-
-#ifdef TT_CONFIG_CMAP_FORMAT_6
-
- FT_CALLBACK_DEF( FT_Error )
- tt_cmap6_validate( FT_Byte* table,
- FT_Validator valid )
- {
- FT_Byte* p;
- FT_UInt length, count;
-
-
- if ( table + 10 > valid->limit )
- FT_INVALID_TOO_SHORT;
-
- p = table + 2;
- length = TT_NEXT_USHORT( p );
-
- p = table + 8; /* skip language and start index */
- count = TT_NEXT_USHORT( p );
-
- if ( table + length > valid->limit || length < 10 + count * 2 )
- FT_INVALID_TOO_SHORT;
-
- /* check glyph indices */
- if ( valid->level >= FT_VALIDATE_TIGHT )
- {
- FT_UInt gindex;
-
-
- for ( ; count > 0; count-- )
- {
- gindex = TT_NEXT_USHORT( p );
- if ( gindex >= TT_VALID_GLYPH_COUNT( valid ) )
- FT_INVALID_GLYPH_ID;
- }
- }
-
- return FT_Err_Ok;
- }
-
-
- FT_CALLBACK_DEF( FT_UInt )
- tt_cmap6_char_index( TT_CMap cmap,
- FT_UInt32 char_code )
- {
- FT_Byte* table = cmap->data;
- FT_UInt result = 0;
- FT_Byte* p = table + 6;
- FT_UInt start = TT_NEXT_USHORT( p );
- FT_UInt count = TT_NEXT_USHORT( p );
- FT_UInt idx = (FT_UInt)( char_code - start );
-
-
- if ( idx < count )
- {
- p += 2 * idx;
- result = TT_PEEK_USHORT( p );
- }
-
- return result;
- }
-
-
- FT_CALLBACK_DEF( FT_UInt32 )
- tt_cmap6_char_next( TT_CMap cmap,
- FT_UInt32 *pchar_code )
- {
- FT_Byte* table = cmap->data;
- FT_UInt32 result = 0;
- FT_UInt32 char_code = *pchar_code + 1;
- FT_UInt gindex = 0;
-
- FT_Byte* p = table + 6;
- FT_UInt start = TT_NEXT_USHORT( p );
- FT_UInt count = TT_NEXT_USHORT( p );
- FT_UInt idx;
-
-
- if ( char_code >= 0x10000UL )
- return 0;
-
- if ( char_code < start )
- char_code = start;
-
- idx = (FT_UInt)( char_code - start );
- p += 2 * idx;
-
- for ( ; idx < count; idx++ )
- {
- gindex = TT_NEXT_USHORT( p );
- if ( gindex != 0 )
- {
- result = char_code;
- break;
- }
-
- if ( char_code >= 0xFFFFU )
- return 0;
-
- char_code++;
- }
-
- *pchar_code = result;
- return gindex;
- }
-
-
- FT_CALLBACK_DEF( FT_Error )
- tt_cmap6_get_info( TT_CMap cmap,
- TT_CMapInfo *cmap_info )
- {
- FT_Byte* p = cmap->data + 4;
-
-
- cmap_info->format = 6;
- cmap_info->language = (FT_ULong)TT_PEEK_USHORT( p );
-
- return FT_Err_Ok;
- }
-
-
- FT_DEFINE_TT_CMAP(
- tt_cmap6_class_rec,
- sizeof ( TT_CMapRec ),
-
- (FT_CMap_InitFunc) tt_cmap_init,
- (FT_CMap_DoneFunc) NULL,
- (FT_CMap_CharIndexFunc)tt_cmap6_char_index,
- (FT_CMap_CharNextFunc) tt_cmap6_char_next,
-
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
-
- 6,
- (TT_CMap_ValidateFunc)tt_cmap6_validate,
- (TT_CMap_Info_GetFunc)tt_cmap6_get_info )
-
-#endif /* TT_CONFIG_CMAP_FORMAT_6 */
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** FORMAT 8 *****/
- /***** *****/
- /***** It is hard to completely understand what the OpenType spec *****/
- /***** says about this format, but here is my conclusion. *****/
- /***** *****/
- /***** The purpose of this format is to easily map UTF-16 text to *****/
- /***** glyph indices. Basically, the `char_code' must be in one of *****/
- /***** the following formats. *****/
- /***** *****/
- /***** - A 16-bit value that isn't part of the Unicode Surrogates *****/
- /***** Area (i.e. U+D800-U+DFFF). *****/
- /***** *****/
- /***** - A 32-bit value, made of two surrogate values, i.e.. if *****/
- /***** `char_code = (char_hi << 16) | char_lo', then both *****/
- /***** `char_hi' and `char_lo' must be in the Surrogates Area. *****/
- /***** Area. *****/
- /***** *****/
- /***** The `is32' table embedded in the charmap indicates whether a *****/
- /***** given 16-bit value is in the surrogates area or not. *****/
- /***** *****/
- /***** So, for any given `char_code', we can assert the following. *****/
- /***** *****/
- /***** If `char_hi == 0' then we must have `is32[char_lo] == 0'. *****/
- /***** *****/
- /***** If `char_hi != 0' then we must have both *****/
- /***** `is32[char_hi] != 0' and `is32[char_lo] != 0'. *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
- /*************************************************************************/
- /* */
- /* TABLE OVERVIEW */
- /* -------------- */
- /* */
- /* NAME OFFSET TYPE DESCRIPTION */
- /* */
- /* format 0 USHORT must be 8 */
- /* reserved 2 USHORT reserved */
- /* length 4 ULONG length in bytes */
- /* language 8 ULONG Mac language code */
- /* is32 12 BYTE[8192] 32-bitness bitmap */
- /* count 8204 ULONG number of groups */
- /* */
- /* This header is followed by `count' groups of the following format: */
- /* */
- /* start 0 ULONG first charcode */
- /* end 4 ULONG last charcode */
- /* startId 8 ULONG start glyph ID for the group */
- /* */
-
-#ifdef TT_CONFIG_CMAP_FORMAT_8
-
- FT_CALLBACK_DEF( FT_Error )
- tt_cmap8_validate( FT_Byte* table,
- FT_Validator valid )
- {
- FT_Byte* p = table + 4;
- FT_Byte* is32;
- FT_UInt32 length;
- FT_UInt32 num_groups;
-
-
- if ( table + 16 + 8192 > valid->limit )
- FT_INVALID_TOO_SHORT;
-
- length = TT_NEXT_ULONG( p );
- if ( length > (FT_UInt32)( valid->limit - table ) || length < 8192 + 16 )
- FT_INVALID_TOO_SHORT;
-
- is32 = table + 12;
- p = is32 + 8192; /* skip `is32' array */
- num_groups = TT_NEXT_ULONG( p );
-
- /* p + num_groups * 12 > valid->limit ? */
- if ( num_groups > (FT_UInt32)( valid->limit - p ) / 12 )
- FT_INVALID_TOO_SHORT;
-
- /* check groups, they must be in increasing order */
- {
- FT_UInt32 n, start, end, start_id, count, last = 0;
-
-
- for ( n = 0; n < num_groups; n++ )
- {
- FT_UInt hi, lo;
-
-
- start = TT_NEXT_ULONG( p );
- end = TT_NEXT_ULONG( p );
- start_id = TT_NEXT_ULONG( p );
-
- if ( start > end )
- FT_INVALID_DATA;
-
- if ( n > 0 && start <= last )
- FT_INVALID_DATA;
-
- if ( valid->level >= FT_VALIDATE_TIGHT )
- {
- FT_UInt32 d = end - start;
-
-
- /* start_id + end - start >= TT_VALID_GLYPH_COUNT( valid ) ? */
- if ( d > TT_VALID_GLYPH_COUNT( valid ) ||
- start_id >= TT_VALID_GLYPH_COUNT( valid ) - d )
- FT_INVALID_GLYPH_ID;
-
- count = (FT_UInt32)( end - start + 1 );
-
- if ( start & ~0xFFFFU )
- {
- /* start_hi != 0; check that is32[i] is 1 for each i in */
- /* the `hi' and `lo' of the range [start..end] */
- for ( ; count > 0; count--, start++ )
- {
- hi = (FT_UInt)( start >> 16 );
- lo = (FT_UInt)( start & 0xFFFFU );
-
- if ( (is32[hi >> 3] & ( 0x80 >> ( hi & 7 ) ) ) == 0 )
- FT_INVALID_DATA;
-
- if ( (is32[lo >> 3] & ( 0x80 >> ( lo & 7 ) ) ) == 0 )
- FT_INVALID_DATA;
- }
- }
- else
- {
- /* start_hi == 0; check that is32[i] is 0 for each i in */
- /* the range [start..end] */
-
- /* end_hi cannot be != 0! */
- if ( end & ~0xFFFFU )
- FT_INVALID_DATA;
-
- for ( ; count > 0; count--, start++ )
- {
- lo = (FT_UInt)( start & 0xFFFFU );
-
- if ( (is32[lo >> 3] & ( 0x80 >> ( lo & 7 ) ) ) != 0 )
- FT_INVALID_DATA;
- }
- }
- }
-
- last = end;
- }
- }
-
- return FT_Err_Ok;
- }
-
-
- FT_CALLBACK_DEF( FT_UInt )
- tt_cmap8_char_index( TT_CMap cmap,
- FT_UInt32 char_code )
- {
- FT_Byte* table = cmap->data;
- FT_UInt result = 0;
- FT_Byte* p = table + 8204;
- FT_UInt32 num_groups = TT_NEXT_ULONG( p );
- FT_UInt32 start, end, start_id;
-
-
- for ( ; num_groups > 0; num_groups-- )
- {
- start = TT_NEXT_ULONG( p );
- end = TT_NEXT_ULONG( p );
- start_id = TT_NEXT_ULONG( p );
-
- if ( char_code < start )
- break;
-
- if ( char_code <= end )
- {
- if ( start_id > 0xFFFFFFFFUL - ( char_code - start ) )
- return 0;
-
- result = (FT_UInt)( start_id + ( char_code - start ) );
- break;
- }
- }
- return result;
- }
-
-
- FT_CALLBACK_DEF( FT_UInt32 )
- tt_cmap8_char_next( TT_CMap cmap,
- FT_UInt32 *pchar_code )
- {
- FT_Face face = cmap->cmap.charmap.face;
- FT_UInt32 result = 0;
- FT_UInt32 char_code;
- FT_UInt gindex = 0;
- FT_Byte* table = cmap->data;
- FT_Byte* p = table + 8204;
- FT_UInt32 num_groups = TT_NEXT_ULONG( p );
- FT_UInt32 start, end, start_id;
-
-
- if ( *pchar_code >= 0xFFFFFFFFUL )
- return 0;
-
- char_code = *pchar_code + 1;
-
- p = table + 8208;
-
- for ( ; num_groups > 0; num_groups-- )
- {
- start = TT_NEXT_ULONG( p );
- end = TT_NEXT_ULONG( p );
- start_id = TT_NEXT_ULONG( p );
-
- if ( char_code < start )
- char_code = start;
-
- Again:
- if ( char_code <= end )
- {
- /* ignore invalid group */
- if ( start_id > 0xFFFFFFFFUL - ( char_code - start ) )
- continue;
-
- gindex = (FT_UInt)( start_id + ( char_code - start ) );
-
- /* does first element of group point to `.notdef' glyph? */
- if ( gindex == 0 )
- {
- if ( char_code >= 0xFFFFFFFFUL )
- break;
-
- char_code++;
- goto Again;
- }
-
- /* if `gindex' is invalid, the remaining values */
- /* in this group are invalid, too */
- if ( gindex >= (FT_UInt)face->num_glyphs )
- continue;
-
- result = char_code;
- break;
- }
- }
-
- *pchar_code = result;
- return gindex;
- }
-
-
- FT_CALLBACK_DEF( FT_Error )
- tt_cmap8_get_info( TT_CMap cmap,
- TT_CMapInfo *cmap_info )
- {
- FT_Byte* p = cmap->data + 8;
-
-
- cmap_info->format = 8;
- cmap_info->language = (FT_ULong)TT_PEEK_ULONG( p );
-
- return FT_Err_Ok;
- }
-
-
- FT_DEFINE_TT_CMAP(
- tt_cmap8_class_rec,
- sizeof ( TT_CMapRec ),
-
- (FT_CMap_InitFunc) tt_cmap_init,
- (FT_CMap_DoneFunc) NULL,
- (FT_CMap_CharIndexFunc)tt_cmap8_char_index,
- (FT_CMap_CharNextFunc) tt_cmap8_char_next,
-
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
-
- 8,
- (TT_CMap_ValidateFunc)tt_cmap8_validate,
- (TT_CMap_Info_GetFunc)tt_cmap8_get_info )
-
-#endif /* TT_CONFIG_CMAP_FORMAT_8 */
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** FORMAT 10 *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
- /*************************************************************************/
- /* */
- /* TABLE OVERVIEW */
- /* -------------- */
- /* */
- /* NAME OFFSET TYPE DESCRIPTION */
- /* */
- /* format 0 USHORT must be 10 */
- /* reserved 2 USHORT reserved */
- /* length 4 ULONG length in bytes */
- /* language 8 ULONG Mac language code */
- /* */
- /* start 12 ULONG first char in range */
- /* count 16 ULONG number of chars in range */
- /* glyphIds 20 USHORT[count] glyph indices covered */
- /* */
-
-#ifdef TT_CONFIG_CMAP_FORMAT_10
-
- FT_CALLBACK_DEF( FT_Error )
- tt_cmap10_validate( FT_Byte* table,
- FT_Validator valid )
- {
- FT_Byte* p = table + 4;
- FT_ULong length, count;
-
-
- if ( table + 20 > valid->limit )
- FT_INVALID_TOO_SHORT;
-
- length = TT_NEXT_ULONG( p );
- p = table + 16;
- count = TT_NEXT_ULONG( p );
-
- if ( length > (FT_ULong)( valid->limit - table ) ||
- /* length < 20 + count * 2 ? */
- length < 20 ||
- ( length - 20 ) / 2 < count )
- FT_INVALID_TOO_SHORT;
-
- /* check glyph indices */
- if ( valid->level >= FT_VALIDATE_TIGHT )
- {
- FT_UInt gindex;
-
-
- for ( ; count > 0; count-- )
- {
- gindex = TT_NEXT_USHORT( p );
- if ( gindex >= TT_VALID_GLYPH_COUNT( valid ) )
- FT_INVALID_GLYPH_ID;
- }
- }
-
- return FT_Err_Ok;
- }
-
-
- FT_CALLBACK_DEF( FT_UInt )
- tt_cmap10_char_index( TT_CMap cmap,
- FT_UInt32 char_code )
- {
- FT_Byte* table = cmap->data;
- FT_UInt result = 0;
- FT_Byte* p = table + 12;
- FT_UInt32 start = TT_NEXT_ULONG( p );
- FT_UInt32 count = TT_NEXT_ULONG( p );
- FT_UInt32 idx;
-
-
- if ( char_code < start )
- return 0;
-
- idx = char_code - start;
-
- if ( idx < count )
- {
- p += 2 * idx;
- result = TT_PEEK_USHORT( p );
- }
-
- return result;
- }
-
-
- FT_CALLBACK_DEF( FT_UInt32 )
- tt_cmap10_char_next( TT_CMap cmap,
- FT_UInt32 *pchar_code )
- {
- FT_Byte* table = cmap->data;
- FT_UInt32 char_code;
- FT_UInt gindex = 0;
- FT_Byte* p = table + 12;
- FT_UInt32 start = TT_NEXT_ULONG( p );
- FT_UInt32 count = TT_NEXT_ULONG( p );
- FT_UInt32 idx;
-
-
- if ( *pchar_code >= 0xFFFFFFFFUL )
- return 0;
-
- char_code = *pchar_code + 1;
-
- if ( char_code < start )
- char_code = start;
-
- idx = char_code - start;
- p += 2 * idx;
-
- for ( ; idx < count; idx++ )
- {
- gindex = TT_NEXT_USHORT( p );
- if ( gindex != 0 )
- break;
-
- if ( char_code >= 0xFFFFFFFFUL )
- return 0;
-
- char_code++;
- }
-
- *pchar_code = char_code;
- return gindex;
- }
-
-
- FT_CALLBACK_DEF( FT_Error )
- tt_cmap10_get_info( TT_CMap cmap,
- TT_CMapInfo *cmap_info )
- {
- FT_Byte* p = cmap->data + 8;
-
-
- cmap_info->format = 10;
- cmap_info->language = (FT_ULong)TT_PEEK_ULONG( p );
-
- return FT_Err_Ok;
- }
-
-
- FT_DEFINE_TT_CMAP(
- tt_cmap10_class_rec,
- sizeof ( TT_CMapRec ),
-
- (FT_CMap_InitFunc) tt_cmap_init,
- (FT_CMap_DoneFunc) NULL,
- (FT_CMap_CharIndexFunc)tt_cmap10_char_index,
- (FT_CMap_CharNextFunc) tt_cmap10_char_next,
-
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
-
- 10,
- (TT_CMap_ValidateFunc)tt_cmap10_validate,
- (TT_CMap_Info_GetFunc)tt_cmap10_get_info )
-
-#endif /* TT_CONFIG_CMAP_FORMAT_10 */
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** FORMAT 12 *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
- /*************************************************************************/
- /* */
- /* TABLE OVERVIEW */
- /* -------------- */
- /* */
- /* NAME OFFSET TYPE DESCRIPTION */
- /* */
- /* format 0 USHORT must be 12 */
- /* reserved 2 USHORT reserved */
- /* length 4 ULONG length in bytes */
- /* language 8 ULONG Mac language code */
- /* count 12 ULONG number of groups */
- /* 16 */
- /* */
- /* This header is followed by `count' groups of the following format: */
- /* */
- /* start 0 ULONG first charcode */
- /* end 4 ULONG last charcode */
- /* startId 8 ULONG start glyph ID for the group */
- /* */
-
-#ifdef TT_CONFIG_CMAP_FORMAT_12
-
- typedef struct TT_CMap12Rec_
- {
- TT_CMapRec cmap;
- FT_Bool valid;
- FT_ULong cur_charcode;
- FT_UInt cur_gindex;
- FT_ULong cur_group;
- FT_ULong num_groups;
-
- } TT_CMap12Rec, *TT_CMap12;
-
-
- FT_CALLBACK_DEF( FT_Error )
- tt_cmap12_init( TT_CMap12 cmap,
- FT_Byte* table )
- {
- cmap->cmap.data = table;
-
- table += 12;
- cmap->num_groups = FT_PEEK_ULONG( table );
-
- cmap->valid = 0;
-
- return FT_Err_Ok;
- }
-
-
- FT_CALLBACK_DEF( FT_Error )
- tt_cmap12_validate( FT_Byte* table,
- FT_Validator valid )
- {
- FT_Byte* p;
- FT_ULong length;
- FT_ULong num_groups;
-
-
- if ( table + 16 > valid->limit )
- FT_INVALID_TOO_SHORT;
-
- p = table + 4;
- length = TT_NEXT_ULONG( p );
-
- p = table + 12;
- num_groups = TT_NEXT_ULONG( p );
-
- if ( length > (FT_ULong)( valid->limit - table ) ||
- /* length < 16 + 12 * num_groups ? */
- length < 16 ||
- ( length - 16 ) / 12 < num_groups )
- FT_INVALID_TOO_SHORT;
-
- /* check groups, they must be in increasing order */
- {
- FT_ULong n, start, end, start_id, last = 0;
-
-
- for ( n = 0; n < num_groups; n++ )
- {
- start = TT_NEXT_ULONG( p );
- end = TT_NEXT_ULONG( p );
- start_id = TT_NEXT_ULONG( p );
-
- if ( start > end )
- FT_INVALID_DATA;
-
- if ( n > 0 && start <= last )
- FT_INVALID_DATA;
-
- if ( valid->level >= FT_VALIDATE_TIGHT )
- {
- FT_UInt32 d = end - start;
-
-
- /* start_id + end - start >= TT_VALID_GLYPH_COUNT( valid ) ? */
- if ( d > TT_VALID_GLYPH_COUNT( valid ) ||
- start_id >= TT_VALID_GLYPH_COUNT( valid ) - d )
- FT_INVALID_GLYPH_ID;
- }
-
- last = end;
- }
- }
-
- return FT_Err_Ok;
- }
-
-
- /* search the index of the charcode next to cmap->cur_charcode */
- /* cmap->cur_group should be set up properly by caller */
- /* */
- static void
- tt_cmap12_next( TT_CMap12 cmap )
- {
- FT_Face face = cmap->cmap.cmap.charmap.face;
- FT_Byte* p;
- FT_ULong start, end, start_id, char_code;
- FT_ULong n;
- FT_UInt gindex;
-
-
- if ( cmap->cur_charcode >= 0xFFFFFFFFUL )
- goto Fail;
-
- char_code = cmap->cur_charcode + 1;
-
- for ( n = cmap->cur_group; n < cmap->num_groups; n++ )
- {
- p = cmap->cmap.data + 16 + 12 * n;
- start = TT_NEXT_ULONG( p );
- end = TT_NEXT_ULONG( p );
- start_id = TT_PEEK_ULONG( p );
-
- if ( char_code < start )
- char_code = start;
-
- Again:
- if ( char_code <= end )
- {
- /* ignore invalid group */
- if ( start_id > 0xFFFFFFFFUL - ( char_code - start ) )
- continue;
-
- gindex = (FT_UInt)( start_id + ( char_code - start ) );
-
- /* does first element of group point to `.notdef' glyph? */
- if ( gindex == 0 )
- {
- if ( char_code >= 0xFFFFFFFFUL )
- goto Fail;
-
- char_code++;
- goto Again;
- }
-
- /* if `gindex' is invalid, the remaining values */
- /* in this group are invalid, too */
- if ( gindex >= (FT_UInt)face->num_glyphs )
- continue;
-
- cmap->cur_charcode = char_code;
- cmap->cur_gindex = gindex;
- cmap->cur_group = n;
-
- return;
- }
- }
-
- Fail:
- cmap->valid = 0;
- }
-
-
- static FT_UInt
- tt_cmap12_char_map_binary( TT_CMap cmap,
- FT_UInt32* pchar_code,
- FT_Bool next )
- {
- FT_UInt gindex = 0;
- FT_Byte* p = cmap->data + 12;
- FT_UInt32 num_groups = TT_PEEK_ULONG( p );
- FT_UInt32 char_code = *pchar_code;
- FT_UInt32 start, end, start_id;
- FT_UInt32 max, min, mid;
-
-
- if ( !num_groups )
- return 0;
-
- /* make compiler happy */
- mid = num_groups;
- end = 0xFFFFFFFFUL;
-
- if ( next )
- {
- if ( char_code >= 0xFFFFFFFFUL )
- return 0;
-
- char_code++;
- }
-
- min = 0;
- max = num_groups;
-
- /* binary search */
- while ( min < max )
- {
- mid = ( min + max ) >> 1;
- p = cmap->data + 16 + 12 * mid;
-
- start = TT_NEXT_ULONG( p );
- end = TT_NEXT_ULONG( p );
-
- if ( char_code < start )
- max = mid;
- else if ( char_code > end )
- min = mid + 1;
- else
- {
- start_id = TT_PEEK_ULONG( p );
-
- /* reject invalid glyph index */
- if ( start_id > 0xFFFFFFFFUL - ( char_code - start ) )
- gindex = 0;
- else
- gindex = (FT_UInt)( start_id + ( char_code - start ) );
- break;
- }
- }
-
- if ( next )
- {
- FT_Face face = cmap->cmap.charmap.face;
- TT_CMap12 cmap12 = (TT_CMap12)cmap;
-
-
- /* if `char_code' is not in any group, then `mid' is */
- /* the group nearest to `char_code' */
-
- if ( char_code > end )
- {
- mid++;
- if ( mid == num_groups )
- return 0;
- }
-
- cmap12->valid = 1;
- cmap12->cur_charcode = char_code;
- cmap12->cur_group = mid;
-
- if ( gindex >= (FT_UInt)face->num_glyphs )
- gindex = 0;
-
- if ( !gindex )
- {
- tt_cmap12_next( cmap12 );
-
- if ( cmap12->valid )
- gindex = cmap12->cur_gindex;
- }
- else
- cmap12->cur_gindex = gindex;
-
- *pchar_code = cmap12->cur_charcode;
- }
-
- return gindex;
- }
-
-
- FT_CALLBACK_DEF( FT_UInt )
- tt_cmap12_char_index( TT_CMap cmap,
- FT_UInt32 char_code )
- {
- return tt_cmap12_char_map_binary( cmap, &char_code, 0 );
- }
-
-
- FT_CALLBACK_DEF( FT_UInt32 )
- tt_cmap12_char_next( TT_CMap cmap,
- FT_UInt32 *pchar_code )
- {
- TT_CMap12 cmap12 = (TT_CMap12)cmap;
- FT_UInt gindex;
-
-
- /* no need to search */
- if ( cmap12->valid && cmap12->cur_charcode == *pchar_code )
- {
- tt_cmap12_next( cmap12 );
- if ( cmap12->valid )
- {
- gindex = cmap12->cur_gindex;
- *pchar_code = (FT_UInt32)cmap12->cur_charcode;
- }
- else
- gindex = 0;
- }
- else
- gindex = tt_cmap12_char_map_binary( cmap, pchar_code, 1 );
-
- return gindex;
- }
-
-
- FT_CALLBACK_DEF( FT_Error )
- tt_cmap12_get_info( TT_CMap cmap,
- TT_CMapInfo *cmap_info )
- {
- FT_Byte* p = cmap->data + 8;
-
-
- cmap_info->format = 12;
- cmap_info->language = (FT_ULong)TT_PEEK_ULONG( p );
-
- return FT_Err_Ok;
- }
-
-
- FT_DEFINE_TT_CMAP(
- tt_cmap12_class_rec,
- sizeof ( TT_CMap12Rec ),
-
- (FT_CMap_InitFunc) tt_cmap12_init,
- (FT_CMap_DoneFunc) NULL,
- (FT_CMap_CharIndexFunc)tt_cmap12_char_index,
- (FT_CMap_CharNextFunc) tt_cmap12_char_next,
-
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
-
- 12,
- (TT_CMap_ValidateFunc)tt_cmap12_validate,
- (TT_CMap_Info_GetFunc)tt_cmap12_get_info )
-
-#endif /* TT_CONFIG_CMAP_FORMAT_12 */
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** FORMAT 13 *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
- /*************************************************************************/
- /* */
- /* TABLE OVERVIEW */
- /* -------------- */
- /* */
- /* NAME OFFSET TYPE DESCRIPTION */
- /* */
- /* format 0 USHORT must be 13 */
- /* reserved 2 USHORT reserved */
- /* length 4 ULONG length in bytes */
- /* language 8 ULONG Mac language code */
- /* count 12 ULONG number of groups */
- /* 16 */
- /* */
- /* This header is followed by `count' groups of the following format: */
- /* */
- /* start 0 ULONG first charcode */
- /* end 4 ULONG last charcode */
- /* glyphId 8 ULONG glyph ID for the whole group */
- /* */
-
-#ifdef TT_CONFIG_CMAP_FORMAT_13
-
- typedef struct TT_CMap13Rec_
- {
- TT_CMapRec cmap;
- FT_Bool valid;
- FT_ULong cur_charcode;
- FT_UInt cur_gindex;
- FT_ULong cur_group;
- FT_ULong num_groups;
-
- } TT_CMap13Rec, *TT_CMap13;
-
-
- FT_CALLBACK_DEF( FT_Error )
- tt_cmap13_init( TT_CMap13 cmap,
- FT_Byte* table )
- {
- cmap->cmap.data = table;
-
- table += 12;
- cmap->num_groups = FT_PEEK_ULONG( table );
-
- cmap->valid = 0;
-
- return FT_Err_Ok;
- }
-
-
- FT_CALLBACK_DEF( FT_Error )
- tt_cmap13_validate( FT_Byte* table,
- FT_Validator valid )
- {
- FT_Byte* p;
- FT_ULong length;
- FT_ULong num_groups;
-
-
- if ( table + 16 > valid->limit )
- FT_INVALID_TOO_SHORT;
-
- p = table + 4;
- length = TT_NEXT_ULONG( p );
-
- p = table + 12;
- num_groups = TT_NEXT_ULONG( p );
-
- if ( length > (FT_ULong)( valid->limit - table ) ||
- /* length < 16 + 12 * num_groups ? */
- length < 16 ||
- ( length - 16 ) / 12 < num_groups )
- FT_INVALID_TOO_SHORT;
-
- /* check groups, they must be in increasing order */
- {
- FT_ULong n, start, end, glyph_id, last = 0;
-
-
- for ( n = 0; n < num_groups; n++ )
- {
- start = TT_NEXT_ULONG( p );
- end = TT_NEXT_ULONG( p );
- glyph_id = TT_NEXT_ULONG( p );
-
- if ( start > end )
- FT_INVALID_DATA;
-
- if ( n > 0 && start <= last )
- FT_INVALID_DATA;
-
- if ( valid->level >= FT_VALIDATE_TIGHT )
- {
- if ( glyph_id >= TT_VALID_GLYPH_COUNT( valid ) )
- FT_INVALID_GLYPH_ID;
- }
-
- last = end;
- }
- }
-
- return FT_Err_Ok;
- }
-
-
- /* search the index of the charcode next to cmap->cur_charcode */
- /* cmap->cur_group should be set up properly by caller */
- /* */
- static void
- tt_cmap13_next( TT_CMap13 cmap )
- {
- FT_Face face = cmap->cmap.cmap.charmap.face;
- FT_Byte* p;
- FT_ULong start, end, glyph_id, char_code;
- FT_ULong n;
- FT_UInt gindex;
-
-
- if ( cmap->cur_charcode >= 0xFFFFFFFFUL )
- goto Fail;
-
- char_code = cmap->cur_charcode + 1;
-
- for ( n = cmap->cur_group; n < cmap->num_groups; n++ )
- {
- p = cmap->cmap.data + 16 + 12 * n;
- start = TT_NEXT_ULONG( p );
- end = TT_NEXT_ULONG( p );
- glyph_id = TT_PEEK_ULONG( p );
-
- if ( char_code < start )
- char_code = start;
-
- if ( char_code <= end )
- {
- gindex = (FT_UInt)glyph_id;
-
- if ( gindex && gindex < (FT_UInt)face->num_glyphs )
- {
- cmap->cur_charcode = char_code;
- cmap->cur_gindex = gindex;
- cmap->cur_group = n;
-
- return;
- }
- }
- }
-
- Fail:
- cmap->valid = 0;
- }
-
-
- static FT_UInt
- tt_cmap13_char_map_binary( TT_CMap cmap,
- FT_UInt32* pchar_code,
- FT_Bool next )
- {
- FT_UInt gindex = 0;
- FT_Byte* p = cmap->data + 12;
- FT_UInt32 num_groups = TT_PEEK_ULONG( p );
- FT_UInt32 char_code = *pchar_code;
- FT_UInt32 start, end;
- FT_UInt32 max, min, mid;
-
-
- if ( !num_groups )
- return 0;
-
- /* make compiler happy */
- mid = num_groups;
- end = 0xFFFFFFFFUL;
-
- if ( next )
- {
- if ( char_code >= 0xFFFFFFFFUL )
- return 0;
-
- char_code++;
- }
-
- min = 0;
- max = num_groups;
-
- /* binary search */
- while ( min < max )
- {
- mid = ( min + max ) >> 1;
- p = cmap->data + 16 + 12 * mid;
-
- start = TT_NEXT_ULONG( p );
- end = TT_NEXT_ULONG( p );
-
- if ( char_code < start )
- max = mid;
- else if ( char_code > end )
- min = mid + 1;
- else
- {
- gindex = (FT_UInt)TT_PEEK_ULONG( p );
-
- break;
- }
- }
-
- if ( next )
- {
- FT_Face face = cmap->cmap.charmap.face;
- TT_CMap13 cmap13 = (TT_CMap13)cmap;
-
-
- /* if `char_code' is not in any group, then `mid' is */
- /* the group nearest to `char_code' */
-
- if ( char_code > end )
- {
- mid++;
- if ( mid == num_groups )
- return 0;
- }
-
- cmap13->valid = 1;
- cmap13->cur_charcode = char_code;
- cmap13->cur_group = mid;
-
- if ( gindex >= (FT_UInt)face->num_glyphs )
- gindex = 0;
-
- if ( !gindex )
- {
- tt_cmap13_next( cmap13 );
-
- if ( cmap13->valid )
- gindex = cmap13->cur_gindex;
- }
- else
- cmap13->cur_gindex = gindex;
-
- *pchar_code = cmap13->cur_charcode;
- }
-
- return gindex;
- }
-
-
- FT_CALLBACK_DEF( FT_UInt )
- tt_cmap13_char_index( TT_CMap cmap,
- FT_UInt32 char_code )
- {
- return tt_cmap13_char_map_binary( cmap, &char_code, 0 );
- }
-
-
- FT_CALLBACK_DEF( FT_UInt32 )
- tt_cmap13_char_next( TT_CMap cmap,
- FT_UInt32 *pchar_code )
- {
- TT_CMap13 cmap13 = (TT_CMap13)cmap;
- FT_UInt gindex;
-
-
- /* no need to search */
- if ( cmap13->valid && cmap13->cur_charcode == *pchar_code )
- {
- tt_cmap13_next( cmap13 );
- if ( cmap13->valid )
- {
- gindex = cmap13->cur_gindex;
- *pchar_code = cmap13->cur_charcode;
- }
- else
- gindex = 0;
- }
- else
- gindex = tt_cmap13_char_map_binary( cmap, pchar_code, 1 );
-
- return gindex;
- }
-
-
- FT_CALLBACK_DEF( FT_Error )
- tt_cmap13_get_info( TT_CMap cmap,
- TT_CMapInfo *cmap_info )
- {
- FT_Byte* p = cmap->data + 8;
-
-
- cmap_info->format = 13;
- cmap_info->language = (FT_ULong)TT_PEEK_ULONG( p );
-
- return FT_Err_Ok;
- }
-
-
- FT_DEFINE_TT_CMAP(
- tt_cmap13_class_rec,
- sizeof ( TT_CMap13Rec ),
-
- (FT_CMap_InitFunc) tt_cmap13_init,
- (FT_CMap_DoneFunc) NULL,
- (FT_CMap_CharIndexFunc)tt_cmap13_char_index,
- (FT_CMap_CharNextFunc) tt_cmap13_char_next,
-
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
-
- 13,
- (TT_CMap_ValidateFunc)tt_cmap13_validate,
- (TT_CMap_Info_GetFunc)tt_cmap13_get_info )
-
-#endif /* TT_CONFIG_CMAP_FORMAT_13 */
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** FORMAT 14 *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
- /*************************************************************************/
- /* */
- /* TABLE OVERVIEW */
- /* -------------- */
- /* */
- /* NAME OFFSET TYPE DESCRIPTION */
- /* */
- /* format 0 USHORT must be 14 */
- /* length 2 ULONG table length in bytes */
- /* numSelector 6 ULONG number of variation sel. records */
- /* */
- /* Followed by numSelector records, each of which looks like */
- /* */
- /* varSelector 0 UINT24 Unicode codepoint of sel. */
- /* defaultOff 3 ULONG offset to a default UVS table */
- /* describing any variants to be found in */
- /* the normal Unicode subtable. */
- /* nonDefOff 7 ULONG offset to a non-default UVS table */
- /* describing any variants not in the */
- /* standard cmap, with GIDs here */
- /* (either offset may be 0 NULL) */
- /* */
- /* Selectors are sorted by code point. */
- /* */
- /* A default Unicode Variation Selector (UVS) subtable is just a list of */
- /* ranges of code points which are to be found in the standard cmap. No */
- /* glyph IDs (GIDs) here. */
- /* */
- /* numRanges 0 ULONG number of ranges following */
- /* */
- /* A range looks like */
- /* */
- /* uniStart 0 UINT24 code point of the first character in */
- /* this range */
- /* additionalCnt 3 UBYTE count of additional characters in this */
- /* range (zero means a range of a single */
- /* character) */
- /* */
- /* Ranges are sorted by `uniStart'. */
- /* */
- /* A non-default Unicode Variation Selector (UVS) subtable is a list of */
- /* mappings from codepoint to GID. */
- /* */
- /* numMappings 0 ULONG number of mappings */
- /* */
- /* A range looks like */
- /* */
- /* uniStart 0 UINT24 code point of the first character in */
- /* this range */
- /* GID 3 USHORT and its GID */
- /* */
- /* Ranges are sorted by `uniStart'. */
-
-#ifdef TT_CONFIG_CMAP_FORMAT_14
-
- typedef struct TT_CMap14Rec_
- {
- TT_CMapRec cmap;
- FT_ULong num_selectors;
-
- /* This array is used to store the results of various
- * cmap 14 query functions. The data is overwritten
- * on each call to these functions.
- */
- FT_UInt32 max_results;
- FT_UInt32* results;
- FT_Memory memory;
-
- } TT_CMap14Rec, *TT_CMap14;
-
-
- FT_CALLBACK_DEF( void )
- tt_cmap14_done( TT_CMap14 cmap )
- {
- FT_Memory memory = cmap->memory;
-
-
- cmap->max_results = 0;
- if ( memory != NULL && cmap->results != NULL )
- FT_FREE( cmap->results );
- }
-
-
- static FT_Error
- tt_cmap14_ensure( TT_CMap14 cmap,
- FT_UInt32 num_results,
- FT_Memory memory )
- {
- FT_UInt32 old_max = cmap->max_results;
- FT_Error error = FT_Err_Ok;
-
-
- if ( num_results > cmap->max_results )
- {
- cmap->memory = memory;
-
- if ( FT_QRENEW_ARRAY( cmap->results, old_max, num_results ) )
- return error;
-
- cmap->max_results = num_results;
- }
-
- return error;
- }
-
-
- FT_CALLBACK_DEF( FT_Error )
- tt_cmap14_init( TT_CMap14 cmap,
- FT_Byte* table )
- {
- cmap->cmap.data = table;
-
- table += 6;
- cmap->num_selectors = FT_PEEK_ULONG( table );
- cmap->max_results = 0;
- cmap->results = NULL;
-
- return FT_Err_Ok;
- }
-
-
- FT_CALLBACK_DEF( FT_Error )
- tt_cmap14_validate( FT_Byte* table,
- FT_Validator valid )
- {
- FT_Byte* p;
- FT_ULong length;
- FT_ULong num_selectors;
-
-
- if ( table + 2 + 4 + 4 > valid->limit )
- FT_INVALID_TOO_SHORT;
-
- p = table + 2;
- length = TT_NEXT_ULONG( p );
- num_selectors = TT_NEXT_ULONG( p );
-
- if ( length > (FT_ULong)( valid->limit - table ) ||
- /* length < 10 + 11 * num_selectors ? */
- length < 10 ||
- ( length - 10 ) / 11 < num_selectors )
- FT_INVALID_TOO_SHORT;
-
- /* check selectors, they must be in increasing order */
- {
- /* we start lastVarSel at 1 because a variant selector value of 0
- * isn't valid.
- */
- FT_ULong n, lastVarSel = 1;
-
-
- for ( n = 0; n < num_selectors; n++ )
- {
- FT_ULong varSel = TT_NEXT_UINT24( p );
- FT_ULong defOff = TT_NEXT_ULONG( p );
- FT_ULong nondefOff = TT_NEXT_ULONG( p );
-
-
- if ( defOff >= length || nondefOff >= length )
- FT_INVALID_TOO_SHORT;
-
- if ( varSel < lastVarSel )
- FT_INVALID_DATA;
-
- lastVarSel = varSel + 1;
-
- /* check the default table (these glyphs should be reached */
- /* through the normal Unicode cmap, no GIDs, just check order) */
- if ( defOff != 0 )
- {
- FT_Byte* defp = table + defOff;
- FT_ULong numRanges = TT_NEXT_ULONG( defp );
- FT_ULong i;
- FT_ULong lastBase = 0;
-
-
- /* defp + numRanges * 4 > valid->limit ? */
- if ( numRanges > (FT_ULong)( valid->limit - defp ) / 4 )
- FT_INVALID_TOO_SHORT;
-
- for ( i = 0; i < numRanges; ++i )
- {
- FT_ULong base = TT_NEXT_UINT24( defp );
- FT_ULong cnt = FT_NEXT_BYTE( defp );
-
-
- if ( base + cnt >= 0x110000UL ) /* end of Unicode */
- FT_INVALID_DATA;
-
- if ( base < lastBase )
- FT_INVALID_DATA;
-
- lastBase = base + cnt + 1U;
- }
- }
-
- /* and the non-default table (these glyphs are specified here) */
- if ( nondefOff != 0 )
- {
- FT_Byte* ndp = table + nondefOff;
- FT_ULong numMappings = TT_NEXT_ULONG( ndp );
- FT_ULong i, lastUni = 0;
-
-
- /* numMappings * 4 > (FT_ULong)( valid->limit - ndp ) ? */
- if ( numMappings > ( (FT_ULong)( valid->limit - ndp ) ) / 4 )
- FT_INVALID_TOO_SHORT;
-
- for ( i = 0; i < numMappings; ++i )
- {
- FT_ULong uni = TT_NEXT_UINT24( ndp );
- FT_ULong gid = TT_NEXT_USHORT( ndp );
-
-
- if ( uni >= 0x110000UL ) /* end of Unicode */
- FT_INVALID_DATA;
-
- if ( uni < lastUni )
- FT_INVALID_DATA;
-
- lastUni = uni + 1U;
-
- if ( valid->level >= FT_VALIDATE_TIGHT &&
- gid >= TT_VALID_GLYPH_COUNT( valid ) )
- FT_INVALID_GLYPH_ID;
- }
- }
- }
- }
-
- return FT_Err_Ok;
- }
-
-
- FT_CALLBACK_DEF( FT_UInt )
- tt_cmap14_char_index( TT_CMap cmap,
- FT_UInt32 char_code )
- {
- FT_UNUSED( cmap );
- FT_UNUSED( char_code );
-
- /* This can't happen */
- return 0;
- }
-
-
- FT_CALLBACK_DEF( FT_UInt32 )
- tt_cmap14_char_next( TT_CMap cmap,
- FT_UInt32 *pchar_code )
- {
- FT_UNUSED( cmap );
-
- /* This can't happen */
- *pchar_code = 0;
- return 0;
- }
-
-
- FT_CALLBACK_DEF( FT_Error )
- tt_cmap14_get_info( TT_CMap cmap,
- TT_CMapInfo *cmap_info )
- {
- FT_UNUSED( cmap );
-
- cmap_info->format = 14;
- /* subtable 14 does not define a language field */
- cmap_info->language = 0xFFFFFFFFUL;
-
- return FT_Err_Ok;
- }
-
-
- static FT_UInt
- tt_cmap14_char_map_def_binary( FT_Byte *base,
- FT_UInt32 char_code )
- {
- FT_UInt32 numRanges = TT_PEEK_ULONG( base );
- FT_UInt32 max, min;
-
-
- min = 0;
- max = numRanges;
-
- base += 4;
-
- /* binary search */
- while ( min < max )
- {
- FT_UInt32 mid = ( min + max ) >> 1;
- FT_Byte* p = base + 4 * mid;
- FT_ULong start = TT_NEXT_UINT24( p );
- FT_UInt cnt = FT_NEXT_BYTE( p );
-
-
- if ( char_code < start )
- max = mid;
- else if ( char_code > start+cnt )
- min = mid + 1;
- else
- return TRUE;
- }
-
- return FALSE;
- }
-
-
- static FT_UInt
- tt_cmap14_char_map_nondef_binary( FT_Byte *base,
- FT_UInt32 char_code )
- {
- FT_UInt32 numMappings = TT_PEEK_ULONG( base );
- FT_UInt32 max, min;
-
-
- min = 0;
- max = numMappings;
-
- base += 4;
-
- /* binary search */
- while ( min < max )
- {
- FT_UInt32 mid = ( min + max ) >> 1;
- FT_Byte* p = base + 5 * mid;
- FT_UInt32 uni = (FT_UInt32)TT_NEXT_UINT24( p );
-
-
- if ( char_code < uni )
- max = mid;
- else if ( char_code > uni )
- min = mid + 1;
- else
- return TT_PEEK_USHORT( p );
- }
-
- return 0;
- }
-
-
- static FT_Byte*
- tt_cmap14_find_variant( FT_Byte *base,
- FT_UInt32 variantCode )
- {
- FT_UInt32 numVar = TT_PEEK_ULONG( base );
- FT_UInt32 max, min;
-
-
- min = 0;
- max = numVar;
-
- base += 4;
-
- /* binary search */
- while ( min < max )
- {
- FT_UInt32 mid = ( min + max ) >> 1;
- FT_Byte* p = base + 11 * mid;
- FT_ULong varSel = TT_NEXT_UINT24( p );
-
-
- if ( variantCode < varSel )
- max = mid;
- else if ( variantCode > varSel )
- min = mid + 1;
- else
- return p;
- }
-
- return NULL;
- }
-
-
- FT_CALLBACK_DEF( FT_UInt )
- tt_cmap14_char_var_index( TT_CMap cmap,
- TT_CMap ucmap,
- FT_UInt32 charcode,
- FT_UInt32 variantSelector )
- {
- FT_Byte* p = tt_cmap14_find_variant( cmap->data + 6, variantSelector );
- FT_ULong defOff;
- FT_ULong nondefOff;
-
-
- if ( !p )
- return 0;
-
- defOff = TT_NEXT_ULONG( p );
- nondefOff = TT_PEEK_ULONG( p );
-
- if ( defOff != 0 &&
- tt_cmap14_char_map_def_binary( cmap->data + defOff, charcode ) )
- {
- /* This is the default variant of this charcode. GID not stored */
- /* here; stored in the normal Unicode charmap instead. */
- return ucmap->cmap.clazz->char_index( &ucmap->cmap, charcode );
- }
-
- if ( nondefOff != 0 )
- return tt_cmap14_char_map_nondef_binary( cmap->data + nondefOff,
- charcode );
-
- return 0;
- }
-
-
- FT_CALLBACK_DEF( FT_Int )
- tt_cmap14_char_var_isdefault( TT_CMap cmap,
- FT_UInt32 charcode,
- FT_UInt32 variantSelector )
- {
- FT_Byte* p = tt_cmap14_find_variant( cmap->data + 6, variantSelector );
- FT_ULong defOff;
- FT_ULong nondefOff;
-
-
- if ( !p )
- return -1;
-
- defOff = TT_NEXT_ULONG( p );
- nondefOff = TT_NEXT_ULONG( p );
-
- if ( defOff != 0 &&
- tt_cmap14_char_map_def_binary( cmap->data + defOff, charcode ) )
- return 1;
-
- if ( nondefOff != 0 &&
- tt_cmap14_char_map_nondef_binary( cmap->data + nondefOff,
- charcode ) != 0 )
- return 0;
-
- return -1;
- }
-
-
- FT_CALLBACK_DEF( FT_UInt32* )
- tt_cmap14_variants( TT_CMap cmap,
- FT_Memory memory )
- {
- TT_CMap14 cmap14 = (TT_CMap14)cmap;
- FT_UInt32 count = cmap14->num_selectors;
- FT_Byte* p = cmap->data + 10;
- FT_UInt32* result;
- FT_UInt32 i;
-
-
- if ( tt_cmap14_ensure( cmap14, ( count + 1 ), memory ) )
- return NULL;
-
- result = cmap14->results;
- for ( i = 0; i < count; ++i )
- {
- result[i] = (FT_UInt32)TT_NEXT_UINT24( p );
- p += 8;
- }
- result[i] = 0;
-
- return result;
- }
-
-
- FT_CALLBACK_DEF( FT_UInt32 * )
- tt_cmap14_char_variants( TT_CMap cmap,
- FT_Memory memory,
- FT_UInt32 charCode )
- {
- TT_CMap14 cmap14 = (TT_CMap14) cmap;
- FT_UInt32 count = cmap14->num_selectors;
- FT_Byte* p = cmap->data + 10;
- FT_UInt32* q;
-
-
- if ( tt_cmap14_ensure( cmap14, ( count + 1 ), memory ) )
- return NULL;
-
- for ( q = cmap14->results; count > 0; --count )
- {
- FT_UInt32 varSel = TT_NEXT_UINT24( p );
- FT_ULong defOff = TT_NEXT_ULONG( p );
- FT_ULong nondefOff = TT_NEXT_ULONG( p );
-
-
- if ( ( defOff != 0 &&
- tt_cmap14_char_map_def_binary( cmap->data + defOff,
- charCode ) ) ||
- ( nondefOff != 0 &&
- tt_cmap14_char_map_nondef_binary( cmap->data + nondefOff,
- charCode ) != 0 ) )
- {
- q[0] = varSel;
- q++;
- }
- }
- q[0] = 0;
-
- return cmap14->results;
- }
-
-
- static FT_UInt
- tt_cmap14_def_char_count( FT_Byte *p )
- {
- FT_UInt32 numRanges = (FT_UInt32)TT_NEXT_ULONG( p );
- FT_UInt tot = 0;
-
-
- p += 3; /* point to the first `cnt' field */
- for ( ; numRanges > 0; numRanges-- )
- {
- tot += 1 + p[0];
- p += 4;
- }
-
- return tot;
- }
-
-
- static FT_UInt32*
- tt_cmap14_get_def_chars( TT_CMap cmap,
- FT_Byte* p,
- FT_Memory memory )
- {
- TT_CMap14 cmap14 = (TT_CMap14) cmap;
- FT_UInt32 numRanges;
- FT_UInt cnt;
- FT_UInt32* q;
-
-
- cnt = tt_cmap14_def_char_count( p );
- numRanges = (FT_UInt32)TT_NEXT_ULONG( p );
-
- if ( tt_cmap14_ensure( cmap14, ( cnt + 1 ), memory ) )
- return NULL;
-
- for ( q = cmap14->results; numRanges > 0; --numRanges )
- {
- FT_UInt32 uni = (FT_UInt32)TT_NEXT_UINT24( p );
-
-
- cnt = FT_NEXT_BYTE( p ) + 1;
- do
- {
- q[0] = uni;
- uni += 1;
- q += 1;
-
- } while ( --cnt != 0 );
- }
- q[0] = 0;
-
- return cmap14->results;
- }
-
-
- static FT_UInt32*
- tt_cmap14_get_nondef_chars( TT_CMap cmap,
- FT_Byte *p,
- FT_Memory memory )
- {
- TT_CMap14 cmap14 = (TT_CMap14) cmap;
- FT_UInt32 numMappings;
- FT_UInt i;
- FT_UInt32 *ret;
-
-
- numMappings = (FT_UInt32)TT_NEXT_ULONG( p );
-
- if ( tt_cmap14_ensure( cmap14, ( numMappings + 1 ), memory ) )
- return NULL;
-
- ret = cmap14->results;
- for ( i = 0; i < numMappings; ++i )
- {
- ret[i] = (FT_UInt32)TT_NEXT_UINT24( p );
- p += 2;
- }
- ret[i] = 0;
-
- return ret;
- }
-
-
- FT_CALLBACK_DEF( FT_UInt32 * )
- tt_cmap14_variant_chars( TT_CMap cmap,
- FT_Memory memory,
- FT_UInt32 variantSelector )
- {
- FT_Byte *p = tt_cmap14_find_variant( cmap->data + 6,
- variantSelector );
- FT_Int i;
- FT_ULong defOff;
- FT_ULong nondefOff;
-
-
- if ( !p )
- return NULL;
-
- defOff = TT_NEXT_ULONG( p );
- nondefOff = TT_NEXT_ULONG( p );
-
- if ( defOff == 0 && nondefOff == 0 )
- return NULL;
-
- if ( defOff == 0 )
- return tt_cmap14_get_nondef_chars( cmap, cmap->data + nondefOff,
- memory );
- else if ( nondefOff == 0 )
- return tt_cmap14_get_def_chars( cmap, cmap->data + defOff,
- memory );
- else
- {
- /* Both a default and a non-default glyph set? That's probably not */
- /* good font design, but the spec allows for it... */
- TT_CMap14 cmap14 = (TT_CMap14) cmap;
- FT_UInt32 numRanges;
- FT_UInt32 numMappings;
- FT_UInt32 duni;
- FT_UInt32 dcnt;
- FT_UInt32 nuni;
- FT_Byte* dp;
- FT_UInt di, ni, k;
-
- FT_UInt32 *ret;
-
-
- p = cmap->data + nondefOff;
- dp = cmap->data + defOff;
-
- numMappings = (FT_UInt32)TT_NEXT_ULONG( p );
- dcnt = tt_cmap14_def_char_count( dp );
- numRanges = (FT_UInt32)TT_NEXT_ULONG( dp );
-
- if ( numMappings == 0 )
- return tt_cmap14_get_def_chars( cmap, cmap->data + defOff,
- memory );
- if ( dcnt == 0 )
- return tt_cmap14_get_nondef_chars( cmap, cmap->data + nondefOff,
- memory );
-
- if ( tt_cmap14_ensure( cmap14, ( dcnt + numMappings + 1 ), memory ) )
- return NULL;
-
- ret = cmap14->results;
- duni = (FT_UInt32)TT_NEXT_UINT24( dp );
- dcnt = FT_NEXT_BYTE( dp );
- di = 1;
- nuni = (FT_UInt32)TT_NEXT_UINT24( p );
- p += 2;
- ni = 1;
- i = 0;
-
- for ( ;; )
- {
- if ( nuni > duni + dcnt )
- {
- for ( k = 0; k <= dcnt; ++k )
- ret[i++] = duni + k;
-
- ++di;
-
- if ( di > numRanges )
- break;
-
- duni = (FT_UInt32)TT_NEXT_UINT24( dp );
- dcnt = FT_NEXT_BYTE( dp );
- }
- else
- {
- if ( nuni < duni )
- ret[i++] = nuni;
- /* If it is within the default range then ignore it -- */
- /* that should not have happened */
- ++ni;
- if ( ni > numMappings )
- break;
-
- nuni = (FT_UInt32)TT_NEXT_UINT24( p );
- p += 2;
- }
- }
-
- if ( ni <= numMappings )
- {
- /* If we get here then we have run out of all default ranges. */
- /* We have read one non-default mapping which we haven't stored */
- /* and there may be others that need to be read. */
- ret[i++] = nuni;
- while ( ni < numMappings )
- {
- ret[i++] = (FT_UInt32)TT_NEXT_UINT24( p );
- p += 2;
- ++ni;
- }
- }
- else if ( di <= numRanges )
- {
- /* If we get here then we have run out of all non-default */
- /* mappings. We have read one default range which we haven't */
- /* stored and there may be others that need to be read. */
- for ( k = 0; k <= dcnt; ++k )
- ret[i++] = duni + k;
-
- while ( di < numRanges )
- {
- duni = (FT_UInt32)TT_NEXT_UINT24( dp );
- dcnt = FT_NEXT_BYTE( dp );
-
- for ( k = 0; k <= dcnt; ++k )
- ret[i++] = duni + k;
- ++di;
- }
- }
-
- ret[i] = 0;
-
- return ret;
- }
- }
-
-
- FT_DEFINE_TT_CMAP(
- tt_cmap14_class_rec,
- sizeof ( TT_CMap14Rec ),
-
- (FT_CMap_InitFunc) tt_cmap14_init,
- (FT_CMap_DoneFunc) tt_cmap14_done,
- (FT_CMap_CharIndexFunc)tt_cmap14_char_index,
- (FT_CMap_CharNextFunc) tt_cmap14_char_next,
-
- /* Format 14 extension functions */
- (FT_CMap_CharVarIndexFunc) tt_cmap14_char_var_index,
- (FT_CMap_CharVarIsDefaultFunc)tt_cmap14_char_var_isdefault,
- (FT_CMap_VariantListFunc) tt_cmap14_variants,
- (FT_CMap_CharVariantListFunc) tt_cmap14_char_variants,
- (FT_CMap_VariantCharListFunc) tt_cmap14_variant_chars,
-
- 14,
- (TT_CMap_ValidateFunc)tt_cmap14_validate,
- (TT_CMap_Info_GetFunc)tt_cmap14_get_info )
-
-#endif /* TT_CONFIG_CMAP_FORMAT_14 */
-
-
-#ifndef FT_CONFIG_OPTION_PIC
-
- static const TT_CMap_Class tt_cmap_classes[] =
- {
-#define TTCMAPCITEM( a ) &a,
-#include "ttcmapc.h"
- NULL,
- };
-
-#else /*FT_CONFIG_OPTION_PIC*/
-
- void
- FT_Destroy_Class_tt_cmap_classes( FT_Library library,
- TT_CMap_Class* clazz )
- {
- FT_Memory memory = library->memory;
-
-
- if ( clazz )
- FT_FREE( clazz );
- }
-
-
- FT_Error
- FT_Create_Class_tt_cmap_classes( FT_Library library,
- TT_CMap_Class** output_class )
- {
- TT_CMap_Class* clazz = NULL;
- TT_CMap_ClassRec* recs;
- FT_Error error;
- FT_Memory memory = library->memory;
-
- int i = 0;
-
-
-#define TTCMAPCITEM( a ) i++;
-#include "ttcmapc.h"
-
- /* allocate enough space for both the pointers */
- /* plus terminator and the class instances */
- if ( FT_ALLOC( clazz, sizeof ( *clazz ) * ( i + 1 ) +
- sizeof ( TT_CMap_ClassRec ) * i ) )
- return error;
-
- /* the location of the class instances follows the array of pointers */
- recs = (TT_CMap_ClassRec*)( (char*)clazz +
- sizeof ( *clazz ) * ( i + 1 ) );
- i = 0;
-
-#undef TTCMAPCITEM
-#define TTCMAPCITEM( a ) \
- FT_Init_Class_ ## a( &recs[i] ); \
- clazz[i] = &recs[i]; \
- i++;
-#include "ttcmapc.h"
-
- clazz[i] = NULL;
-
- *output_class = clazz;
- return FT_Err_Ok;
- }
-
-#endif /*FT_CONFIG_OPTION_PIC*/
-
-
- /* parse the `cmap' table and build the corresponding TT_CMap objects */
- /* in the current face */
- /* */
- FT_LOCAL_DEF( FT_Error )
- tt_face_build_cmaps( TT_Face face )
- {
- FT_Byte* table = face->cmap_table;
- FT_Byte* limit = table + face->cmap_size;
- FT_UInt volatile num_cmaps;
- FT_Byte* volatile p = table;
- FT_Library library = FT_FACE_LIBRARY( face );
-
- FT_UNUSED( library );
-
-
- if ( !p || p + 4 > limit )
- return FT_THROW( Invalid_Table );
-
- /* only recognize format 0 */
- if ( TT_NEXT_USHORT( p ) != 0 )
- {
- FT_ERROR(( "tt_face_build_cmaps:"
- " unsupported `cmap' table format = %d\n",
- TT_PEEK_USHORT( p - 2 ) ));
- return FT_THROW( Invalid_Table );
- }
-
- num_cmaps = TT_NEXT_USHORT( p );
-
- for ( ; num_cmaps > 0 && p + 8 <= limit; num_cmaps-- )
- {
- FT_CharMapRec charmap;
- FT_UInt32 offset;
-
-
- charmap.platform_id = TT_NEXT_USHORT( p );
- charmap.encoding_id = TT_NEXT_USHORT( p );
- charmap.face = FT_FACE( face );
- charmap.encoding = FT_ENCODING_NONE; /* will be filled later */
- offset = TT_NEXT_ULONG( p );
-
- if ( offset && offset <= face->cmap_size - 2 )
- {
- FT_Byte* volatile cmap = table + offset;
- volatile FT_UInt format = TT_PEEK_USHORT( cmap );
- const TT_CMap_Class* volatile pclazz = TT_CMAP_CLASSES_GET;
- TT_CMap_Class volatile clazz;
-
-
- for ( ; *pclazz; pclazz++ )
- {
- clazz = *pclazz;
- if ( clazz->format == format )
- {
- volatile TT_ValidatorRec valid;
- volatile FT_Error error = FT_Err_Ok;
-
-
- ft_validator_init( FT_VALIDATOR( &valid ), cmap, limit,
- FT_VALIDATE_DEFAULT );
-
- valid.num_glyphs = (FT_UInt)face->max_profile.numGlyphs;
-
- if ( ft_setjmp( FT_VALIDATOR( &valid )->jump_buffer) == 0 )
- {
- /* validate this cmap sub-table */
- error = clazz->validate( cmap, FT_VALIDATOR( &valid ) );
- }
-
- if ( valid.validator.error == 0 )
- {
- FT_CMap ttcmap;
-
-
- /* It might make sense to store the single variation */
- /* selector cmap somewhere special. But it would have to be */
- /* in the public FT_FaceRec, and we can't change that. */
-
- if ( !FT_CMap_New( (FT_CMap_Class)clazz,
- cmap, &charmap, &ttcmap ) )
- {
- /* it is simpler to directly set `flags' than adding */
- /* a parameter to FT_CMap_New */
- ((TT_CMap)ttcmap)->flags = (FT_Int)error;
- }
- }
- else
- {
- FT_TRACE0(( "tt_face_build_cmaps:"
- " broken cmap sub-table ignored\n" ));
- }
- break;
- }
- }
-
- if ( *pclazz == NULL )
- {
- FT_TRACE0(( "tt_face_build_cmaps:"
- " unsupported cmap sub-table ignored\n" ));
- }
- }
- }
-
- return FT_Err_Ok;
- }
-
-
- FT_LOCAL( FT_Error )
- tt_get_cmap_info( FT_CharMap charmap,
- TT_CMapInfo *cmap_info )
- {
- FT_CMap cmap = (FT_CMap)charmap;
- TT_CMap_Class clazz = (TT_CMap_Class)cmap->clazz;
-
-
- return clazz->get_cmap_info( charmap, cmap_info );
- }
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/sfnt/ttcmap.h b/chromium/third_party/pdfium/third_party/freetype/src/sfnt/ttcmap.h
deleted file mode 100644
index b7ea8ee3773..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/sfnt/ttcmap.h
+++ /dev/null
@@ -1,158 +0,0 @@
-/***************************************************************************/
-/* */
-/* ttcmap.h */
-/* */
-/* TrueType character mapping table (cmap) support (specification). */
-/* */
-/* Copyright 2002-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __TTCMAP_H__
-#define __TTCMAP_H__
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_TRUETYPE_TYPES_H
-#include FT_INTERNAL_VALIDATE_H
-#include FT_SERVICE_TT_CMAP_H
-
-FT_BEGIN_HEADER
-
-
-#define TT_CMAP_FLAG_UNSORTED 1
-#define TT_CMAP_FLAG_OVERLAPPING 2
-
- typedef struct TT_CMapRec_
- {
- FT_CMapRec cmap;
- FT_Byte* data; /* pointer to in-memory cmap table */
- FT_Int flags; /* for format 4 only */
-
- } TT_CMapRec, *TT_CMap;
-
- typedef const struct TT_CMap_ClassRec_* TT_CMap_Class;
-
-
- typedef FT_Error
- (*TT_CMap_ValidateFunc)( FT_Byte* data,
- FT_Validator valid );
-
- typedef struct TT_CMap_ClassRec_
- {
- FT_CMap_ClassRec clazz;
- FT_UInt format;
- TT_CMap_ValidateFunc validate;
- TT_CMap_Info_GetFunc get_cmap_info;
-
- } TT_CMap_ClassRec;
-
-
-#ifndef FT_CONFIG_OPTION_PIC
-
-#define FT_DEFINE_TT_CMAP( class_, \
- size_, \
- init_, \
- done_, \
- char_index_, \
- char_next_, \
- char_var_index_, \
- char_var_default_, \
- variant_list_, \
- charvariant_list_, \
- variantchar_list_, \
- format_, \
- validate_, \
- get_cmap_info_ ) \
- FT_CALLBACK_TABLE_DEF \
- const TT_CMap_ClassRec class_ = \
- { \
- { size_, \
- init_, \
- done_, \
- char_index_, \
- char_next_, \
- char_var_index_, \
- char_var_default_, \
- variant_list_, \
- charvariant_list_, \
- variantchar_list_ \
- }, \
- \
- format_, \
- validate_, \
- get_cmap_info_ \
- };
-
-#else /* FT_CONFIG_OPTION_PIC */
-
-#define FT_DEFINE_TT_CMAP( class_, \
- size_, \
- init_, \
- done_, \
- char_index_, \
- char_next_, \
- char_var_index_, \
- char_var_default_, \
- variant_list_, \
- charvariant_list_, \
- variantchar_list_, \
- format_, \
- validate_, \
- get_cmap_info_ ) \
- void \
- FT_Init_Class_ ## class_( TT_CMap_ClassRec* clazz ) \
- { \
- clazz->clazz.size = size_; \
- clazz->clazz.init = init_; \
- clazz->clazz.done = done_; \
- clazz->clazz.char_index = char_index_; \
- clazz->clazz.char_next = char_next_; \
- clazz->clazz.char_var_index = char_var_index_; \
- clazz->clazz.char_var_default = char_var_default_; \
- clazz->clazz.variant_list = variant_list_; \
- clazz->clazz.charvariant_list = charvariant_list_; \
- clazz->clazz.variantchar_list = variantchar_list_; \
- clazz->format = format_; \
- clazz->validate = validate_; \
- clazz->get_cmap_info = get_cmap_info_; \
- }
-
-#endif /* FT_CONFIG_OPTION_PIC */
-
-
- typedef struct TT_ValidatorRec_
- {
- FT_ValidatorRec validator;
- FT_UInt num_glyphs;
-
- } TT_ValidatorRec, *TT_Validator;
-
-
-#define TT_VALIDATOR( x ) ( (TT_Validator)( x ) )
-#define TT_VALID_GLYPH_COUNT( x ) TT_VALIDATOR( x )->num_glyphs
-
-
- FT_LOCAL( FT_Error )
- tt_face_build_cmaps( TT_Face face );
-
- /* used in tt-cmaps service */
- FT_LOCAL( FT_Error )
- tt_get_cmap_info( FT_CharMap charmap,
- TT_CMapInfo *cmap_info );
-
-
-FT_END_HEADER
-
-#endif /* __TTCMAP_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/sfnt/ttcmapc.h b/chromium/third_party/pdfium/third_party/freetype/src/sfnt/ttcmapc.h
deleted file mode 100644
index 4a489402cff..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/sfnt/ttcmapc.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/***************************************************************************/
-/* */
-/* ttcmapc.h */
-/* */
-/* TT CMAP classes definitions (specification only). */
-/* */
-/* Copyright 2009-2015 by */
-/* Oran Agra and Mickey Gabel. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifdef TT_CONFIG_CMAP_FORMAT_0
- TTCMAPCITEM( tt_cmap0_class_rec )
-#endif
-
-#ifdef TT_CONFIG_CMAP_FORMAT_2
- TTCMAPCITEM( tt_cmap2_class_rec )
-#endif
-
-#ifdef TT_CONFIG_CMAP_FORMAT_4
- TTCMAPCITEM( tt_cmap4_class_rec )
-#endif
-
-#ifdef TT_CONFIG_CMAP_FORMAT_6
- TTCMAPCITEM( tt_cmap6_class_rec )
-#endif
-
-#ifdef TT_CONFIG_CMAP_FORMAT_8
- TTCMAPCITEM( tt_cmap8_class_rec )
-#endif
-
-#ifdef TT_CONFIG_CMAP_FORMAT_10
- TTCMAPCITEM( tt_cmap10_class_rec )
-#endif
-
-#ifdef TT_CONFIG_CMAP_FORMAT_12
- TTCMAPCITEM( tt_cmap12_class_rec )
-#endif
-
-#ifdef TT_CONFIG_CMAP_FORMAT_13
- TTCMAPCITEM( tt_cmap13_class_rec )
-#endif
-
-#ifdef TT_CONFIG_CMAP_FORMAT_14
- TTCMAPCITEM( tt_cmap14_class_rec )
-#endif
-
-
- /* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/sfnt/ttkern.c b/chromium/third_party/pdfium/third_party/freetype/src/sfnt/ttkern.c
deleted file mode 100644
index 4fccc535ced..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/sfnt/ttkern.c
+++ /dev/null
@@ -1,306 +0,0 @@
-/***************************************************************************/
-/* */
-/* ttkern.c */
-/* */
-/* Load the basic TrueType kerning table. This doesn't handle */
-/* kerning data within the GPOS table at the moment. */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_TRUETYPE_TAGS_H
-#include "ttkern.h"
-
-#include "sferrors.h"
-
-
- /*************************************************************************/
- /* */
- /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
- /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
- /* messages during execution. */
- /* */
-#undef FT_COMPONENT
-#define FT_COMPONENT trace_ttkern
-
-
-#undef TT_KERN_INDEX
-#define TT_KERN_INDEX( g1, g2 ) ( ( (FT_ULong)(g1) << 16 ) | (g2) )
-
-
- FT_LOCAL_DEF( FT_Error )
- tt_face_load_kern( TT_Face face,
- FT_Stream stream )
- {
- FT_Error error;
- FT_ULong table_size;
- FT_Byte* p;
- FT_Byte* p_limit;
- FT_UInt nn, num_tables;
- FT_UInt32 avail = 0, ordered = 0;
-
-
- /* the kern table is optional; exit silently if it is missing */
- error = face->goto_table( face, TTAG_kern, stream, &table_size );
- if ( error )
- goto Exit;
-
- if ( table_size < 4 ) /* the case of a malformed table */
- {
- FT_ERROR(( "tt_face_load_kern:"
- " kerning table is too small - ignored\n" ));
- error = FT_THROW( Table_Missing );
- goto Exit;
- }
-
- if ( FT_FRAME_EXTRACT( table_size, face->kern_table ) )
- {
- FT_ERROR(( "tt_face_load_kern:"
- " could not extract kerning table\n" ));
- goto Exit;
- }
-
- face->kern_table_size = table_size;
-
- p = face->kern_table;
- p_limit = p + table_size;
-
- p += 2; /* skip version */
- num_tables = FT_NEXT_USHORT( p );
-
- if ( num_tables > 32 ) /* we only support up to 32 sub-tables */
- num_tables = 32;
-
- for ( nn = 0; nn < num_tables; nn++ )
- {
- FT_UInt num_pairs, length, coverage;
- FT_Byte* p_next;
- FT_UInt32 mask = (FT_UInt32)1UL << nn;
-
-
- if ( p + 6 > p_limit )
- break;
-
- p_next = p;
-
- p += 2; /* skip version */
- length = FT_NEXT_USHORT( p );
- coverage = FT_NEXT_USHORT( p );
-
- if ( length <= 6 + 8 )
- break;
-
- p_next += length;
-
- if ( p_next > p_limit ) /* handle broken table */
- p_next = p_limit;
-
- /* only use horizontal kerning tables */
- if ( ( coverage & ~8U ) != 0x0001 ||
- p + 8 > p_limit )
- goto NextTable;
-
- num_pairs = FT_NEXT_USHORT( p );
- p += 6;
-
- if ( ( p_next - p ) < 6 * (int)num_pairs ) /* handle broken count */
- num_pairs = (FT_UInt)( ( p_next - p ) / 6 );
-
- avail |= mask;
-
- /*
- * Now check whether the pairs in this table are ordered.
- * We then can use binary search.
- */
- if ( num_pairs > 0 )
- {
- FT_ULong count;
- FT_ULong old_pair;
-
-
- old_pair = FT_NEXT_ULONG( p );
- p += 2;
-
- for ( count = num_pairs - 1; count > 0; count-- )
- {
- FT_UInt32 cur_pair;
-
-
- cur_pair = FT_NEXT_ULONG( p );
- if ( cur_pair <= old_pair )
- break;
-
- p += 2;
- old_pair = cur_pair;
- }
-
- if ( count == 0 )
- ordered |= mask;
- }
-
- NextTable:
- p = p_next;
- }
-
- face->num_kern_tables = nn;
- face->kern_avail_bits = avail;
- face->kern_order_bits = ordered;
-
- Exit:
- return error;
- }
-
-
- FT_LOCAL_DEF( void )
- tt_face_done_kern( TT_Face face )
- {
- FT_Stream stream = face->root.stream;
-
-
- FT_FRAME_RELEASE( face->kern_table );
- face->kern_table_size = 0;
- face->num_kern_tables = 0;
- face->kern_avail_bits = 0;
- face->kern_order_bits = 0;
- }
-
-
- FT_LOCAL_DEF( FT_Int )
- tt_face_get_kerning( TT_Face face,
- FT_UInt left_glyph,
- FT_UInt right_glyph )
- {
- FT_Int result = 0;
- FT_UInt count, mask;
- FT_Byte* p = face->kern_table;
- FT_Byte* p_limit = p + face->kern_table_size;
-
-
- p += 4;
- mask = 0x0001;
-
- for ( count = face->num_kern_tables;
- count > 0 && p + 6 <= p_limit;
- count--, mask <<= 1 )
- {
- FT_Byte* base = p;
- FT_Byte* next;
- FT_UInt version = FT_NEXT_USHORT( p );
- FT_UInt length = FT_NEXT_USHORT( p );
- FT_UInt coverage = FT_NEXT_USHORT( p );
- FT_UInt num_pairs;
- FT_Int value = 0;
-
- FT_UNUSED( version );
-
-
- next = base + length;
-
- if ( next > p_limit ) /* handle broken table */
- next = p_limit;
-
- if ( ( face->kern_avail_bits & mask ) == 0 )
- goto NextTable;
-
- if ( p + 8 > next )
- goto NextTable;
-
- num_pairs = FT_NEXT_USHORT( p );
- p += 6;
-
- if ( ( next - p ) < 6 * (int)num_pairs ) /* handle broken count */
- num_pairs = (FT_UInt)( ( next - p ) / 6 );
-
- switch ( coverage >> 8 )
- {
- case 0:
- {
- FT_ULong key0 = TT_KERN_INDEX( left_glyph, right_glyph );
-
-
- if ( face->kern_order_bits & mask ) /* binary search */
- {
- FT_UInt min = 0;
- FT_UInt max = num_pairs;
-
-
- while ( min < max )
- {
- FT_UInt mid = ( min + max ) >> 1;
- FT_Byte* q = p + 6 * mid;
- FT_ULong key;
-
-
- key = FT_NEXT_ULONG( q );
-
- if ( key == key0 )
- {
- value = FT_PEEK_SHORT( q );
- goto Found;
- }
- if ( key < key0 )
- min = mid + 1;
- else
- max = mid;
- }
- }
- else /* linear search */
- {
- FT_UInt count2;
-
-
- for ( count2 = num_pairs; count2 > 0; count2-- )
- {
- FT_ULong key = FT_NEXT_ULONG( p );
-
-
- if ( key == key0 )
- {
- value = FT_PEEK_SHORT( p );
- goto Found;
- }
- p += 2;
- }
- }
- }
- break;
-
- /*
- * We don't support format 2 because we haven't seen a single font
- * using it in real life...
- */
-
- default:
- ;
- }
-
- goto NextTable;
-
- Found:
- if ( coverage & 8 ) /* override or add */
- result = value;
- else
- result += value;
-
- NextTable:
- p = next;
- }
-
- return result;
- }
-
-#undef TT_KERN_INDEX
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/sfnt/ttkern.h b/chromium/third_party/pdfium/third_party/freetype/src/sfnt/ttkern.h
deleted file mode 100644
index 89cb24f07ce..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/sfnt/ttkern.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/***************************************************************************/
-/* */
-/* ttkern.h */
-/* */
-/* Load the basic TrueType kerning table. This doesn't handle */
-/* kerning data within the GPOS table at the moment. */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __TTKERN_H__
-#define __TTKERN_H__
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_TRUETYPE_TYPES_H
-
-
-FT_BEGIN_HEADER
-
-
- FT_LOCAL( FT_Error )
- tt_face_load_kern( TT_Face face,
- FT_Stream stream );
-
- FT_LOCAL( void )
- tt_face_done_kern( TT_Face face );
-
- FT_LOCAL( FT_Int )
- tt_face_get_kerning( TT_Face face,
- FT_UInt left_glyph,
- FT_UInt right_glyph );
-
-#define TT_FACE_HAS_KERNING( face ) ( (face)->kern_avail_bits != 0 )
-
-
-FT_END_HEADER
-
-#endif /* __TTKERN_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/sfnt/ttload.c b/chromium/third_party/pdfium/third_party/freetype/src/sfnt/ttload.c
deleted file mode 100644
index c1bd7f0c82e..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/sfnt/ttload.c
+++ /dev/null
@@ -1,1363 +0,0 @@
-/***************************************************************************/
-/* */
-/* ttload.c */
-/* */
-/* Load the basic TrueType tables, i.e., tables that can be either in */
-/* TTF or OTF fonts (body). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_TRUETYPE_TAGS_H
-#include "ttload.h"
-
-#include "sferrors.h"
-
-
- /*************************************************************************/
- /* */
- /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
- /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
- /* messages during execution. */
- /* */
-#undef FT_COMPONENT
-#define FT_COMPONENT trace_ttload
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* tt_face_lookup_table */
- /* */
- /* <Description> */
- /* Looks for a TrueType table by name. */
- /* */
- /* <Input> */
- /* face :: A face object handle. */
- /* */
- /* tag :: The searched tag. */
- /* */
- /* <Return> */
- /* A pointer to the table directory entry. 0 if not found. */
- /* */
- FT_LOCAL_DEF( TT_Table )
- tt_face_lookup_table( TT_Face face,
- FT_ULong tag )
- {
- TT_Table entry;
- TT_Table limit;
-#ifdef FT_DEBUG_LEVEL_TRACE
- FT_Bool zero_length = FALSE;
-#endif
-
-
- FT_TRACE4(( "tt_face_lookup_table: %08p, `%c%c%c%c' -- ",
- face,
- (FT_Char)( tag >> 24 ),
- (FT_Char)( tag >> 16 ),
- (FT_Char)( tag >> 8 ),
- (FT_Char)( tag ) ));
-
- entry = face->dir_tables;
- limit = entry + face->num_tables;
-
- for ( ; entry < limit; entry++ )
- {
- /* For compatibility with Windows, we consider */
- /* zero-length tables the same as missing tables. */
- if ( entry->Tag == tag )
- {
- if ( entry->Length != 0 )
- {
- FT_TRACE4(( "found table.\n" ));
- return entry;
- }
-#ifdef FT_DEBUG_LEVEL_TRACE
- zero_length = TRUE;
-#endif
- }
- }
-
-#ifdef FT_DEBUG_LEVEL_TRACE
- if ( zero_length )
- FT_TRACE4(( "ignoring empty table\n" ));
- else
- FT_TRACE4(( "could not find table\n" ));
-#endif
-
- return NULL;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* tt_face_goto_table */
- /* */
- /* <Description> */
- /* Looks for a TrueType table by name, then seek a stream to it. */
- /* */
- /* <Input> */
- /* face :: A face object handle. */
- /* */
- /* tag :: The searched tag. */
- /* */
- /* stream :: The stream to seek when the table is found. */
- /* */
- /* <Output> */
- /* length :: The length of the table if found, undefined otherwise. */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. */
- /* */
- FT_LOCAL_DEF( FT_Error )
- tt_face_goto_table( TT_Face face,
- FT_ULong tag,
- FT_Stream stream,
- FT_ULong* length )
- {
- TT_Table table;
- FT_Error error;
-
-
- table = tt_face_lookup_table( face, tag );
- if ( table )
- {
- if ( length )
- *length = table->Length;
-
- if ( FT_STREAM_SEEK( table->Offset ) )
- goto Exit;
- }
- else
- error = FT_THROW( Table_Missing );
-
- Exit:
- return error;
- }
-
-
- /* Here, we */
- /* */
- /* - check that `num_tables' is valid (and adjust it if necessary); */
- /* also return the number of valid table entries */
- /* */
- /* - look for a `head' table, check its size, and parse it to check */
- /* whether its `magic' field is correctly set */
- /* */
- /* - errors (except errors returned by stream handling) */
- /* */
- /* SFNT_Err_Unknown_File_Format: */
- /* no table is defined in directory, it is not sfnt-wrapped */
- /* data */
- /* SFNT_Err_Table_Missing: */
- /* table directory is valid, but essential tables */
- /* (head/bhed/SING) are missing */
- /* */
- static FT_Error
- check_table_dir( SFNT_Header sfnt,
- FT_Stream stream,
- FT_UShort* valid )
- {
- FT_Error error;
- FT_UShort nn, valid_entries = 0;
- FT_UInt has_head = 0, has_sing = 0, has_meta = 0;
- FT_ULong offset = sfnt->offset + 12;
-
- static const FT_Frame_Field table_dir_entry_fields[] =
- {
-#undef FT_STRUCTURE
-#define FT_STRUCTURE TT_TableRec
-
- FT_FRAME_START( 16 ),
- FT_FRAME_ULONG( Tag ),
- FT_FRAME_ULONG( CheckSum ),
- FT_FRAME_ULONG( Offset ),
- FT_FRAME_ULONG( Length ),
- FT_FRAME_END
- };
-
-
- if ( FT_STREAM_SEEK( offset ) )
- goto Exit;
-
- for ( nn = 0; nn < sfnt->num_tables; nn++ )
- {
- TT_TableRec table;
-
-
- if ( FT_STREAM_READ_FIELDS( table_dir_entry_fields, &table ) )
- {
- nn--;
- FT_TRACE2(( "check_table_dir:"
- " can read only %d table%s in font (instead of %d)\n",
- nn, nn == 1 ? "" : "s", sfnt->num_tables ));
- sfnt->num_tables = nn;
- break;
- }
-
- /* we ignore invalid tables */
-
- if ( table.Offset > stream->size )
- {
- FT_TRACE2(( "check_table_dir: table entry %d invalid\n", nn ));
- continue;
- }
- else if ( table.Length > stream->size - table.Offset )
- {
- /* Some tables have such a simple structure that clipping its */
- /* contents is harmless. This also makes FreeType less sensitive */
- /* to invalid table lengths (which programs like Acroread seem to */
- /* ignore in general). */
-
- if ( table.Tag == TTAG_hmtx ||
- table.Tag == TTAG_vmtx )
- valid_entries++;
- else
- {
- FT_TRACE2(( "check_table_dir: table entry %d invalid\n", nn ));
- continue;
- }
- }
- else
- valid_entries++;
-
- if ( table.Tag == TTAG_head || table.Tag == TTAG_bhed )
- {
- FT_UInt32 magic;
-
-
-#ifndef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
- if ( table.Tag == TTAG_head )
-#endif
- has_head = 1;
-
- /*
- * The table length should be 0x36, but certain font tools make it
- * 0x38, so we will just check that it is greater.
- *
- * Note that according to the specification, the table must be
- * padded to 32-bit lengths, but this doesn't apply to the value of
- * its `Length' field!
- *
- */
- if ( table.Length < 0x36 )
- {
- FT_TRACE2(( "check_table_dir:"
- " `head' or `bhed' table too small\n" ));
- error = FT_THROW( Table_Missing );
- goto Exit;
- }
-
- if ( FT_STREAM_SEEK( table.Offset + 12 ) ||
- FT_READ_ULONG( magic ) )
- goto Exit;
-
- if ( magic != 0x5F0F3CF5UL )
- FT_TRACE2(( "check_table_dir:"
- " invalid magic number in `head' or `bhed' table\n"));
-
- if ( FT_STREAM_SEEK( offset + ( nn + 1 ) * 16 ) )
- goto Exit;
- }
- else if ( table.Tag == TTAG_SING )
- has_sing = 1;
- else if ( table.Tag == TTAG_META )
- has_meta = 1;
- }
-
- *valid = valid_entries;
-
- if ( !valid_entries )
- {
- FT_TRACE2(( "check_table_dir: no valid tables found\n" ));
- error = FT_THROW( Unknown_File_Format );
- goto Exit;
- }
-
- /* if `sing' and `meta' tables are present, there is no `head' table */
- if ( has_head || ( has_sing && has_meta ) )
- {
- error = FT_Err_Ok;
- goto Exit;
- }
- else
- {
- FT_TRACE2(( "check_table_dir:" ));
-#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
- FT_TRACE2(( " neither `head', `bhed', nor `sing' table found\n" ));
-#else
- FT_TRACE2(( " neither `head' nor `sing' table found\n" ));
-#endif
- error = FT_THROW( Table_Missing );
- }
-
- Exit:
- return error;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* tt_face_load_font_dir */
- /* */
- /* <Description> */
- /* Loads the header of a SFNT font file. */
- /* */
- /* <Input> */
- /* face :: A handle to the target face object. */
- /* */
- /* stream :: The input stream. */
- /* */
- /* <Output> */
- /* sfnt :: The SFNT header. */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. */
- /* */
- /* <Note> */
- /* The stream cursor must be at the beginning of the font directory. */
- /* */
- FT_LOCAL_DEF( FT_Error )
- tt_face_load_font_dir( TT_Face face,
- FT_Stream stream )
- {
- SFNT_HeaderRec sfnt;
- FT_Error error;
- FT_Memory memory = stream->memory;
- FT_UShort nn, valid_entries;
-
- static const FT_Frame_Field offset_table_fields[] =
- {
-#undef FT_STRUCTURE
-#define FT_STRUCTURE SFNT_HeaderRec
-
- FT_FRAME_START( 8 ),
- FT_FRAME_USHORT( num_tables ),
- FT_FRAME_USHORT( search_range ),
- FT_FRAME_USHORT( entry_selector ),
- FT_FRAME_USHORT( range_shift ),
- FT_FRAME_END
- };
-
-
- FT_TRACE2(( "tt_face_load_font_dir: %08p\n", face ));
-
- /* read the offset table */
-
- sfnt.offset = FT_STREAM_POS();
-
- if ( FT_READ_ULONG( sfnt.format_tag ) ||
- FT_STREAM_READ_FIELDS( offset_table_fields, &sfnt ) )
- goto Exit;
-
- /* many fonts don't have these fields set correctly */
-#if 0
- if ( sfnt.search_range != 1 << ( sfnt.entry_selector + 4 ) ||
- sfnt.search_range + sfnt.range_shift != sfnt.num_tables << 4 )
- return FT_THROW( Unknown_File_Format );
-#endif
-
- /* load the table directory */
-
- FT_TRACE2(( "-- Number of tables: %10u\n", sfnt.num_tables ));
- FT_TRACE2(( "-- Format version: 0x%08lx\n", sfnt.format_tag ));
-
- if ( sfnt.format_tag != TTAG_OTTO )
- {
- /* check first */
- error = check_table_dir( &sfnt, stream, &valid_entries );
- if ( error )
- {
- FT_TRACE2(( "tt_face_load_font_dir:"
- " invalid table directory for TrueType\n" ));
- goto Exit;
- }
- }
- else
- valid_entries = sfnt.num_tables;
-
- face->num_tables = valid_entries;
- face->format_tag = sfnt.format_tag;
-
- if ( FT_QNEW_ARRAY( face->dir_tables, face->num_tables ) )
- goto Exit;
-
- if ( FT_STREAM_SEEK( sfnt.offset + 12 ) ||
- FT_FRAME_ENTER( sfnt.num_tables * 16L ) )
- goto Exit;
-
- FT_TRACE2(( "\n"
- " tag offset length checksum\n"
- " ----------------------------------\n" ));
-
- valid_entries = 0;
- for ( nn = 0; nn < sfnt.num_tables; nn++ )
- {
- TT_TableRec entry;
- FT_UShort i;
- FT_Bool duplicate;
-
-
- entry.Tag = FT_GET_TAG4();
- entry.CheckSum = FT_GET_ULONG();
- entry.Offset = FT_GET_ULONG();
- entry.Length = FT_GET_ULONG();
-
- /* ignore invalid tables that can't be sanitized */
-
- if ( entry.Offset > stream->size )
- continue;
- else if ( entry.Length > stream->size - entry.Offset )
- {
- if ( entry.Tag == TTAG_hmtx ||
- entry.Tag == TTAG_vmtx )
- {
-#ifdef FT_DEBUG_LEVEL_TRACE
- FT_ULong old_length = entry.Length;
-#endif
-
-
- /* make metrics table length a multiple of 4 */
- entry.Length = ( stream->size - entry.Offset ) & ~3U;
-
- FT_TRACE2(( " %c%c%c%c %08lx %08lx %08lx"
- " (sanitized; original length %08lx)",
- (FT_Char)( entry.Tag >> 24 ),
- (FT_Char)( entry.Tag >> 16 ),
- (FT_Char)( entry.Tag >> 8 ),
- (FT_Char)( entry.Tag ),
- entry.Offset,
- entry.Length,
- entry.CheckSum,
- old_length ));
- }
- else
- continue;
- }
-#ifdef FT_DEBUG_LEVEL_TRACE
- else
- FT_TRACE2(( " %c%c%c%c %08lx %08lx %08lx",
- (FT_Char)( entry.Tag >> 24 ),
- (FT_Char)( entry.Tag >> 16 ),
- (FT_Char)( entry.Tag >> 8 ),
- (FT_Char)( entry.Tag ),
- entry.Offset,
- entry.Length,
- entry.CheckSum ));
-#endif
-
- /* ignore duplicate tables – the first one wins */
- duplicate = 0;
- for ( i = 0; i < valid_entries; i++ )
- {
- if ( face->dir_tables[i].Tag == entry.Tag )
- {
- duplicate = 1;
- break;
- }
- }
- if ( duplicate )
- {
- FT_TRACE2(( " (duplicate, ignored)\n" ));
- continue;
- }
- else
- {
- FT_TRACE2(( "\n" ));
-
- /* we finally have a valid entry */
- face->dir_tables[valid_entries++] = entry;
- }
- }
-
- /* final adjustment to number of tables */
- face->num_tables = valid_entries;
-
- FT_FRAME_EXIT();
-
- FT_TRACE2(( "table directory loaded\n\n" ));
-
- Exit:
- return error;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* tt_face_load_any */
- /* */
- /* <Description> */
- /* Loads any font table into client memory. */
- /* */
- /* <Input> */
- /* face :: The face object to look for. */
- /* */
- /* tag :: The tag of table to load. Use the value 0 if you want */
- /* to access the whole font file, else set this parameter */
- /* to a valid TrueType table tag that you can forge with */
- /* the MAKE_TT_TAG macro. */
- /* */
- /* offset :: The starting offset in the table (or the file if */
- /* tag == 0). */
- /* */
- /* length :: The address of the decision variable: */
- /* */
- /* If length == NULL: */
- /* Loads the whole table. Returns an error if */
- /* `offset' == 0! */
- /* */
- /* If *length == 0: */
- /* Exits immediately; returning the length of the given */
- /* table or of the font file, depending on the value of */
- /* `tag'. */
- /* */
- /* If *length != 0: */
- /* Loads the next `length' bytes of table or font, */
- /* starting at offset `offset' (in table or font too). */
- /* */
- /* <Output> */
- /* buffer :: The address of target buffer. */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. */
- /* */
- FT_LOCAL_DEF( FT_Error )
- tt_face_load_any( TT_Face face,
- FT_ULong tag,
- FT_Long offset,
- FT_Byte* buffer,
- FT_ULong* length )
- {
- FT_Error error;
- FT_Stream stream;
- TT_Table table;
- FT_ULong size;
-
-
- if ( tag != 0 )
- {
- /* look for tag in font directory */
- table = tt_face_lookup_table( face, tag );
- if ( !table )
- {
- error = FT_THROW( Table_Missing );
- goto Exit;
- }
-
- offset += table->Offset;
- size = table->Length;
- }
- else
- /* tag == 0 -- the user wants to access the font file directly */
- size = face->root.stream->size;
-
- if ( length && *length == 0 )
- {
- *length = size;
-
- return FT_Err_Ok;
- }
-
- if ( length )
- size = *length;
-
- stream = face->root.stream;
- /* the `if' is syntactic sugar for picky compilers */
- if ( FT_STREAM_READ_AT( offset, buffer, size ) )
- goto Exit;
-
- Exit:
- return error;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* tt_face_load_generic_header */
- /* */
- /* <Description> */
- /* Loads the TrueType table `head' or `bhed'. */
- /* */
- /* <Input> */
- /* face :: A handle to the target face object. */
- /* */
- /* stream :: The input stream. */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. */
- /* */
- static FT_Error
- tt_face_load_generic_header( TT_Face face,
- FT_Stream stream,
- FT_ULong tag )
- {
- FT_Error error;
- TT_Header* header;
-
- static const FT_Frame_Field header_fields[] =
- {
-#undef FT_STRUCTURE
-#define FT_STRUCTURE TT_Header
-
- FT_FRAME_START( 54 ),
- FT_FRAME_ULONG ( Table_Version ),
- FT_FRAME_ULONG ( Font_Revision ),
- FT_FRAME_LONG ( CheckSum_Adjust ),
- FT_FRAME_LONG ( Magic_Number ),
- FT_FRAME_USHORT( Flags ),
- FT_FRAME_USHORT( Units_Per_EM ),
- FT_FRAME_LONG ( Created[0] ),
- FT_FRAME_LONG ( Created[1] ),
- FT_FRAME_LONG ( Modified[0] ),
- FT_FRAME_LONG ( Modified[1] ),
- FT_FRAME_SHORT ( xMin ),
- FT_FRAME_SHORT ( yMin ),
- FT_FRAME_SHORT ( xMax ),
- FT_FRAME_SHORT ( yMax ),
- FT_FRAME_USHORT( Mac_Style ),
- FT_FRAME_USHORT( Lowest_Rec_PPEM ),
- FT_FRAME_SHORT ( Font_Direction ),
- FT_FRAME_SHORT ( Index_To_Loc_Format ),
- FT_FRAME_SHORT ( Glyph_Data_Format ),
- FT_FRAME_END
- };
-
-
- error = face->goto_table( face, tag, stream, 0 );
- if ( error )
- goto Exit;
-
- header = &face->header;
-
- if ( FT_STREAM_READ_FIELDS( header_fields, header ) )
- goto Exit;
-
- FT_TRACE3(( "Units per EM: %4u\n", header->Units_Per_EM ));
- FT_TRACE3(( "IndexToLoc: %4d\n", header->Index_To_Loc_Format ));
-
- Exit:
- return error;
- }
-
-
- FT_LOCAL_DEF( FT_Error )
- tt_face_load_head( TT_Face face,
- FT_Stream stream )
- {
- return tt_face_load_generic_header( face, stream, TTAG_head );
- }
-
-
-#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
-
- FT_LOCAL_DEF( FT_Error )
- tt_face_load_bhed( TT_Face face,
- FT_Stream stream )
- {
- return tt_face_load_generic_header( face, stream, TTAG_bhed );
- }
-
-#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* tt_face_load_max_profile */
- /* */
- /* <Description> */
- /* Loads the maximum profile into a face object. */
- /* */
- /* <Input> */
- /* face :: A handle to the target face object. */
- /* */
- /* stream :: The input stream. */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. */
- /* */
- FT_LOCAL_DEF( FT_Error )
- tt_face_load_maxp( TT_Face face,
- FT_Stream stream )
- {
- FT_Error error;
- TT_MaxProfile* maxProfile = &face->max_profile;
-
- static const FT_Frame_Field maxp_fields[] =
- {
-#undef FT_STRUCTURE
-#define FT_STRUCTURE TT_MaxProfile
-
- FT_FRAME_START( 6 ),
- FT_FRAME_LONG ( version ),
- FT_FRAME_USHORT( numGlyphs ),
- FT_FRAME_END
- };
-
- static const FT_Frame_Field maxp_fields_extra[] =
- {
- FT_FRAME_START( 26 ),
- FT_FRAME_USHORT( maxPoints ),
- FT_FRAME_USHORT( maxContours ),
- FT_FRAME_USHORT( maxCompositePoints ),
- FT_FRAME_USHORT( maxCompositeContours ),
- FT_FRAME_USHORT( maxZones ),
- FT_FRAME_USHORT( maxTwilightPoints ),
- FT_FRAME_USHORT( maxStorage ),
- FT_FRAME_USHORT( maxFunctionDefs ),
- FT_FRAME_USHORT( maxInstructionDefs ),
- FT_FRAME_USHORT( maxStackElements ),
- FT_FRAME_USHORT( maxSizeOfInstructions ),
- FT_FRAME_USHORT( maxComponentElements ),
- FT_FRAME_USHORT( maxComponentDepth ),
- FT_FRAME_END
- };
-
-
- error = face->goto_table( face, TTAG_maxp, stream, 0 );
- if ( error )
- goto Exit;
-
- if ( FT_STREAM_READ_FIELDS( maxp_fields, maxProfile ) )
- goto Exit;
-
- maxProfile->maxPoints = 0;
- maxProfile->maxContours = 0;
- maxProfile->maxCompositePoints = 0;
- maxProfile->maxCompositeContours = 0;
- maxProfile->maxZones = 0;
- maxProfile->maxTwilightPoints = 0;
- maxProfile->maxStorage = 0;
- maxProfile->maxFunctionDefs = 0;
- maxProfile->maxInstructionDefs = 0;
- maxProfile->maxStackElements = 0;
- maxProfile->maxSizeOfInstructions = 0;
- maxProfile->maxComponentElements = 0;
- maxProfile->maxComponentDepth = 0;
-
- if ( maxProfile->version >= 0x10000L )
- {
- if ( FT_STREAM_READ_FIELDS( maxp_fields_extra, maxProfile ) )
- goto Exit;
-
- /* XXX: an adjustment that is necessary to load certain */
- /* broken fonts like `Keystrokes MT' :-( */
- /* */
- /* We allocate 64 function entries by default when */
- /* the maxFunctionDefs value is smaller. */
-
- if ( maxProfile->maxFunctionDefs < 64 )
- maxProfile->maxFunctionDefs = 64;
-
- /* we add 4 phantom points later */
- if ( maxProfile->maxTwilightPoints > ( 0xFFFFU - 4 ) )
- {
- FT_TRACE0(( "tt_face_load_maxp:"
- " too much twilight points in `maxp' table;\n"
- " "
- " some glyphs might be rendered incorrectly\n" ));
-
- maxProfile->maxTwilightPoints = 0xFFFFU - 4;
- }
-
- /* we arbitrarily limit recursion to avoid stack exhaustion */
- if ( maxProfile->maxComponentDepth > 100 )
- {
- FT_TRACE0(( "tt_face_load_maxp:"
- " abnormally large component depth (%d) set to 100\n",
- maxProfile->maxComponentDepth ));
- maxProfile->maxComponentDepth = 100;
- }
- }
-
- FT_TRACE3(( "numGlyphs: %u\n", maxProfile->numGlyphs ));
-
- Exit:
- return error;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* tt_face_load_name */
- /* */
- /* <Description> */
- /* Loads the name records. */
- /* */
- /* <Input> */
- /* face :: A handle to the target face object. */
- /* */
- /* stream :: The input stream. */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. */
- /* */
- FT_LOCAL_DEF( FT_Error )
- tt_face_load_name( TT_Face face,
- FT_Stream stream )
- {
- FT_Error error;
- FT_Memory memory = stream->memory;
- FT_ULong table_pos, table_len;
- FT_ULong storage_start, storage_limit;
- FT_UInt count;
- TT_NameTable table;
-
- static const FT_Frame_Field name_table_fields[] =
- {
-#undef FT_STRUCTURE
-#define FT_STRUCTURE TT_NameTableRec
-
- FT_FRAME_START( 6 ),
- FT_FRAME_USHORT( format ),
- FT_FRAME_USHORT( numNameRecords ),
- FT_FRAME_USHORT( storageOffset ),
- FT_FRAME_END
- };
-
- static const FT_Frame_Field name_record_fields[] =
- {
-#undef FT_STRUCTURE
-#define FT_STRUCTURE TT_NameEntryRec
-
- /* no FT_FRAME_START */
- FT_FRAME_USHORT( platformID ),
- FT_FRAME_USHORT( encodingID ),
- FT_FRAME_USHORT( languageID ),
- FT_FRAME_USHORT( nameID ),
- FT_FRAME_USHORT( stringLength ),
- FT_FRAME_USHORT( stringOffset ),
- FT_FRAME_END
- };
-
-
- table = &face->name_table;
- table->stream = stream;
-
- error = face->goto_table( face, TTAG_name, stream, &table_len );
- if ( error )
- goto Exit;
-
- table_pos = FT_STREAM_POS();
-
-
- if ( FT_STREAM_READ_FIELDS( name_table_fields, table ) )
- goto Exit;
-
- /* Some popular Asian fonts have an invalid `storageOffset' value */
- /* (it should be at least "6 + 12*num_names"). However, the string */
- /* offsets, computed as "storageOffset + entry->stringOffset", are */
- /* valid pointers within the name table... */
- /* */
- /* We thus can't check `storageOffset' right now. */
- /* */
- storage_start = table_pos + 6 + 12*table->numNameRecords;
- storage_limit = table_pos + table_len;
-
- if ( storage_start > storage_limit )
- {
- FT_ERROR(( "tt_face_load_name: invalid `name' table\n" ));
- error = FT_THROW( Name_Table_Missing );
- goto Exit;
- }
-
- /* Allocate the array of name records. */
- count = table->numNameRecords;
- table->numNameRecords = 0;
-
- if ( FT_NEW_ARRAY( table->names, count ) ||
- FT_FRAME_ENTER( count * 12 ) )
- goto Exit;
-
- /* Load the name records and determine how much storage is needed */
- /* to hold the strings themselves. */
- {
- TT_NameEntryRec* entry = table->names;
-
-
- for ( ; count > 0; count-- )
- {
- if ( FT_STREAM_READ_FIELDS( name_record_fields, entry ) )
- continue;
-
- /* check that the name is not empty */
- if ( entry->stringLength == 0 )
- continue;
-
- /* check that the name string is within the table */
- entry->stringOffset += table_pos + table->storageOffset;
- if ( entry->stringOffset < storage_start ||
- entry->stringOffset + entry->stringLength > storage_limit )
- {
- /* invalid entry - ignore it */
- entry->stringOffset = 0;
- entry->stringLength = 0;
- continue;
- }
-
- entry++;
- }
-
- table->numNameRecords = (FT_UInt)( entry - table->names );
- }
-
- FT_FRAME_EXIT();
-
- /* everything went well, update face->num_names */
- face->num_names = (FT_UShort) table->numNameRecords;
-
- Exit:
- return error;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* tt_face_free_names */
- /* */
- /* <Description> */
- /* Frees the name records. */
- /* */
- /* <Input> */
- /* face :: A handle to the target face object. */
- /* */
- FT_LOCAL_DEF( void )
- tt_face_free_name( TT_Face face )
- {
- FT_Memory memory = face->root.driver->root.memory;
- TT_NameTable table = &face->name_table;
- TT_NameEntry entry = table->names;
- FT_UInt count = table->numNameRecords;
-
-
- if ( table->names )
- {
- for ( ; count > 0; count--, entry++ )
- {
- FT_FREE( entry->string );
- entry->stringLength = 0;
- }
-
- /* free strings table */
- FT_FREE( table->names );
- }
-
- table->numNameRecords = 0;
- table->format = 0;
- table->storageOffset = 0;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* tt_face_load_cmap */
- /* */
- /* <Description> */
- /* Loads the cmap directory in a face object. The cmaps themselves */
- /* are loaded on demand in the `ttcmap.c' module. */
- /* */
- /* <Input> */
- /* face :: A handle to the target face object. */
- /* */
- /* stream :: A handle to the input stream. */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. */
- /* */
-
- FT_LOCAL_DEF( FT_Error )
- tt_face_load_cmap( TT_Face face,
- FT_Stream stream )
- {
- FT_Error error;
-
-
- error = face->goto_table( face, TTAG_cmap, stream, &face->cmap_size );
- if ( error )
- goto Exit;
-
- if ( FT_FRAME_EXTRACT( face->cmap_size, face->cmap_table ) )
- face->cmap_size = 0;
-
- Exit:
- return error;
- }
-
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* tt_face_load_os2 */
- /* */
- /* <Description> */
- /* Loads the OS2 table. */
- /* */
- /* <Input> */
- /* face :: A handle to the target face object. */
- /* */
- /* stream :: A handle to the input stream. */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. */
- /* */
- FT_LOCAL_DEF( FT_Error )
- tt_face_load_os2( TT_Face face,
- FT_Stream stream )
- {
- FT_Error error;
- TT_OS2* os2;
-
- static const FT_Frame_Field os2_fields[] =
- {
-#undef FT_STRUCTURE
-#define FT_STRUCTURE TT_OS2
-
- FT_FRAME_START( 78 ),
- FT_FRAME_USHORT( version ),
- FT_FRAME_SHORT ( xAvgCharWidth ),
- FT_FRAME_USHORT( usWeightClass ),
- FT_FRAME_USHORT( usWidthClass ),
- FT_FRAME_SHORT ( fsType ),
- FT_FRAME_SHORT ( ySubscriptXSize ),
- FT_FRAME_SHORT ( ySubscriptYSize ),
- FT_FRAME_SHORT ( ySubscriptXOffset ),
- FT_FRAME_SHORT ( ySubscriptYOffset ),
- FT_FRAME_SHORT ( ySuperscriptXSize ),
- FT_FRAME_SHORT ( ySuperscriptYSize ),
- FT_FRAME_SHORT ( ySuperscriptXOffset ),
- FT_FRAME_SHORT ( ySuperscriptYOffset ),
- FT_FRAME_SHORT ( yStrikeoutSize ),
- FT_FRAME_SHORT ( yStrikeoutPosition ),
- FT_FRAME_SHORT ( sFamilyClass ),
- FT_FRAME_BYTE ( panose[0] ),
- FT_FRAME_BYTE ( panose[1] ),
- FT_FRAME_BYTE ( panose[2] ),
- FT_FRAME_BYTE ( panose[3] ),
- FT_FRAME_BYTE ( panose[4] ),
- FT_FRAME_BYTE ( panose[5] ),
- FT_FRAME_BYTE ( panose[6] ),
- FT_FRAME_BYTE ( panose[7] ),
- FT_FRAME_BYTE ( panose[8] ),
- FT_FRAME_BYTE ( panose[9] ),
- FT_FRAME_ULONG ( ulUnicodeRange1 ),
- FT_FRAME_ULONG ( ulUnicodeRange2 ),
- FT_FRAME_ULONG ( ulUnicodeRange3 ),
- FT_FRAME_ULONG ( ulUnicodeRange4 ),
- FT_FRAME_BYTE ( achVendID[0] ),
- FT_FRAME_BYTE ( achVendID[1] ),
- FT_FRAME_BYTE ( achVendID[2] ),
- FT_FRAME_BYTE ( achVendID[3] ),
-
- FT_FRAME_USHORT( fsSelection ),
- FT_FRAME_USHORT( usFirstCharIndex ),
- FT_FRAME_USHORT( usLastCharIndex ),
- FT_FRAME_SHORT ( sTypoAscender ),
- FT_FRAME_SHORT ( sTypoDescender ),
- FT_FRAME_SHORT ( sTypoLineGap ),
- FT_FRAME_USHORT( usWinAscent ),
- FT_FRAME_USHORT( usWinDescent ),
- FT_FRAME_END
- };
-
- /* `OS/2' version 1 and newer */
- static const FT_Frame_Field os2_fields_extra1[] =
- {
- FT_FRAME_START( 8 ),
- FT_FRAME_ULONG( ulCodePageRange1 ),
- FT_FRAME_ULONG( ulCodePageRange2 ),
- FT_FRAME_END
- };
-
- /* `OS/2' version 2 and newer */
- static const FT_Frame_Field os2_fields_extra2[] =
- {
- FT_FRAME_START( 10 ),
- FT_FRAME_SHORT ( sxHeight ),
- FT_FRAME_SHORT ( sCapHeight ),
- FT_FRAME_USHORT( usDefaultChar ),
- FT_FRAME_USHORT( usBreakChar ),
- FT_FRAME_USHORT( usMaxContext ),
- FT_FRAME_END
- };
-
- /* `OS/2' version 5 and newer */
- static const FT_Frame_Field os2_fields_extra5[] =
- {
- FT_FRAME_START( 4 ),
- FT_FRAME_USHORT( usLowerOpticalPointSize ),
- FT_FRAME_USHORT( usUpperOpticalPointSize ),
- FT_FRAME_END
- };
-
-
- /* We now support old Mac fonts where the OS/2 table doesn't */
- /* exist. Simply put, we set the `version' field to 0xFFFF */
- /* and test this value each time we need to access the table. */
- error = face->goto_table( face, TTAG_OS2, stream, 0 );
- if ( error )
- goto Exit;
-
- os2 = &face->os2;
-
- if ( FT_STREAM_READ_FIELDS( os2_fields, os2 ) )
- goto Exit;
-
- os2->ulCodePageRange1 = 0;
- os2->ulCodePageRange2 = 0;
- os2->sxHeight = 0;
- os2->sCapHeight = 0;
- os2->usDefaultChar = 0;
- os2->usBreakChar = 0;
- os2->usMaxContext = 0;
- os2->usLowerOpticalPointSize = 0;
- os2->usUpperOpticalPointSize = 0xFFFF;
-
- if ( os2->version >= 0x0001 )
- {
- /* only version 1 tables */
- if ( FT_STREAM_READ_FIELDS( os2_fields_extra1, os2 ) )
- goto Exit;
-
- if ( os2->version >= 0x0002 )
- {
- /* only version 2 tables */
- if ( FT_STREAM_READ_FIELDS( os2_fields_extra2, os2 ) )
- goto Exit;
-
- if ( os2->version >= 0x0005 )
- {
- /* only version 5 tables */
- if ( FT_STREAM_READ_FIELDS( os2_fields_extra5, os2 ) )
- goto Exit;
- }
- }
- }
-
- FT_TRACE3(( "sTypoAscender: %4d\n", os2->sTypoAscender ));
- FT_TRACE3(( "sTypoDescender: %4d\n", os2->sTypoDescender ));
- FT_TRACE3(( "usWinAscent: %4u\n", os2->usWinAscent ));
- FT_TRACE3(( "usWinDescent: %4u\n", os2->usWinDescent ));
- FT_TRACE3(( "fsSelection: 0x%2x\n", os2->fsSelection ));
-
- Exit:
- return error;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* tt_face_load_postscript */
- /* */
- /* <Description> */
- /* Loads the Postscript table. */
- /* */
- /* <Input> */
- /* face :: A handle to the target face object. */
- /* */
- /* stream :: A handle to the input stream. */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. */
- /* */
- FT_LOCAL_DEF( FT_Error )
- tt_face_load_post( TT_Face face,
- FT_Stream stream )
- {
- FT_Error error;
- TT_Postscript* post = &face->postscript;
-
- static const FT_Frame_Field post_fields[] =
- {
-#undef FT_STRUCTURE
-#define FT_STRUCTURE TT_Postscript
-
- FT_FRAME_START( 32 ),
- FT_FRAME_ULONG( FormatType ),
- FT_FRAME_ULONG( italicAngle ),
- FT_FRAME_SHORT( underlinePosition ),
- FT_FRAME_SHORT( underlineThickness ),
- FT_FRAME_ULONG( isFixedPitch ),
- FT_FRAME_ULONG( minMemType42 ),
- FT_FRAME_ULONG( maxMemType42 ),
- FT_FRAME_ULONG( minMemType1 ),
- FT_FRAME_ULONG( maxMemType1 ),
- FT_FRAME_END
- };
-
-
- error = face->goto_table( face, TTAG_post, stream, 0 );
- if ( error )
- return error;
-
- if ( FT_STREAM_READ_FIELDS( post_fields, post ) )
- return error;
-
- /* we don't load the glyph names, we do that in another */
- /* module (ttpost). */
-
- FT_TRACE3(( "FormatType: 0x%x\n", post->FormatType ));
- FT_TRACE3(( "isFixedPitch: %s\n", post->isFixedPitch
- ? " yes" : " no" ));
-
- return FT_Err_Ok;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* tt_face_load_pclt */
- /* */
- /* <Description> */
- /* Loads the PCL 5 Table. */
- /* */
- /* <Input> */
- /* face :: A handle to the target face object. */
- /* */
- /* stream :: A handle to the input stream. */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. */
- /* */
- FT_LOCAL_DEF( FT_Error )
- tt_face_load_pclt( TT_Face face,
- FT_Stream stream )
- {
- static const FT_Frame_Field pclt_fields[] =
- {
-#undef FT_STRUCTURE
-#define FT_STRUCTURE TT_PCLT
-
- FT_FRAME_START( 54 ),
- FT_FRAME_ULONG ( Version ),
- FT_FRAME_ULONG ( FontNumber ),
- FT_FRAME_USHORT( Pitch ),
- FT_FRAME_USHORT( xHeight ),
- FT_FRAME_USHORT( Style ),
- FT_FRAME_USHORT( TypeFamily ),
- FT_FRAME_USHORT( CapHeight ),
- FT_FRAME_USHORT( SymbolSet ),
- FT_FRAME_BYTES ( TypeFace, 16 ),
- FT_FRAME_BYTES ( CharacterComplement, 8 ),
- FT_FRAME_BYTES ( FileName, 6 ),
- FT_FRAME_CHAR ( StrokeWeight ),
- FT_FRAME_CHAR ( WidthType ),
- FT_FRAME_BYTE ( SerifStyle ),
- FT_FRAME_BYTE ( Reserved ),
- FT_FRAME_END
- };
-
- FT_Error error;
- TT_PCLT* pclt = &face->pclt;
-
-
- /* optional table */
- error = face->goto_table( face, TTAG_PCLT, stream, 0 );
- if ( error )
- goto Exit;
-
- if ( FT_STREAM_READ_FIELDS( pclt_fields, pclt ) )
- goto Exit;
-
- Exit:
- return error;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* tt_face_load_gasp */
- /* */
- /* <Description> */
- /* Loads the `gasp' table into a face object. */
- /* */
- /* <Input> */
- /* face :: A handle to the target face object. */
- /* */
- /* stream :: The input stream. */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. */
- /* */
- FT_LOCAL_DEF( FT_Error )
- tt_face_load_gasp( TT_Face face,
- FT_Stream stream )
- {
- FT_Error error;
- FT_Memory memory = stream->memory;
-
- FT_UInt j,num_ranges;
- TT_GaspRange gaspranges = NULL;
-
-
- /* the gasp table is optional */
- error = face->goto_table( face, TTAG_gasp, stream, 0 );
- if ( error )
- goto Exit;
-
- if ( FT_FRAME_ENTER( 4L ) )
- goto Exit;
-
- face->gasp.version = FT_GET_USHORT();
- face->gasp.numRanges = FT_GET_USHORT();
-
- FT_FRAME_EXIT();
-
- /* only support versions 0 and 1 of the table */
- if ( face->gasp.version >= 2 )
- {
- face->gasp.numRanges = 0;
- error = FT_THROW( Invalid_Table );
- goto Exit;
- }
-
- num_ranges = face->gasp.numRanges;
- FT_TRACE3(( "numRanges: %u\n", num_ranges ));
-
- if ( FT_QNEW_ARRAY( face->gasp.gaspRanges, num_ranges ) ||
- FT_FRAME_ENTER( num_ranges * 4L ) )
- goto Exit;
-
- gaspranges = face->gasp.gaspRanges;
-
- for ( j = 0; j < num_ranges; j++ )
- {
- gaspranges[j].maxPPEM = FT_GET_USHORT();
- gaspranges[j].gaspFlag = FT_GET_USHORT();
-
- FT_TRACE3(( "gaspRange %d: rangeMaxPPEM %5d, rangeGaspBehavior 0x%x\n",
- j,
- gaspranges[j].maxPPEM,
- gaspranges[j].gaspFlag ));
- }
-
- FT_FRAME_EXIT();
-
- Exit:
- return error;
- }
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/sfnt/ttload.h b/chromium/third_party/pdfium/third_party/freetype/src/sfnt/ttload.h
deleted file mode 100644
index a6d91c5b702..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/sfnt/ttload.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/***************************************************************************/
-/* */
-/* ttload.h */
-/* */
-/* Load the basic TrueType tables, i.e., tables that can be either in */
-/* TTF or OTF fonts (specification). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __TTLOAD_H__
-#define __TTLOAD_H__
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_TRUETYPE_TYPES_H
-
-
-FT_BEGIN_HEADER
-
-
- FT_LOCAL( TT_Table )
- tt_face_lookup_table( TT_Face face,
- FT_ULong tag );
-
- FT_LOCAL( FT_Error )
- tt_face_goto_table( TT_Face face,
- FT_ULong tag,
- FT_Stream stream,
- FT_ULong* length );
-
-
- FT_LOCAL( FT_Error )
- tt_face_load_font_dir( TT_Face face,
- FT_Stream stream );
-
-
- FT_LOCAL( FT_Error )
- tt_face_load_any( TT_Face face,
- FT_ULong tag,
- FT_Long offset,
- FT_Byte* buffer,
- FT_ULong* length );
-
-
- FT_LOCAL( FT_Error )
- tt_face_load_head( TT_Face face,
- FT_Stream stream );
-
-
- FT_LOCAL( FT_Error )
- tt_face_load_cmap( TT_Face face,
- FT_Stream stream );
-
-
- FT_LOCAL( FT_Error )
- tt_face_load_maxp( TT_Face face,
- FT_Stream stream );
-
-
- FT_LOCAL( FT_Error )
- tt_face_load_name( TT_Face face,
- FT_Stream stream );
-
-
- FT_LOCAL( FT_Error )
- tt_face_load_os2( TT_Face face,
- FT_Stream stream );
-
-
- FT_LOCAL( FT_Error )
- tt_face_load_post( TT_Face face,
- FT_Stream stream );
-
-
- FT_LOCAL( FT_Error )
- tt_face_load_pclt( TT_Face face,
- FT_Stream stream );
-
- FT_LOCAL( void )
- tt_face_free_name( TT_Face face );
-
-
- FT_LOCAL( FT_Error )
- tt_face_load_gasp( TT_Face face,
- FT_Stream stream );
-
-#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
-
- FT_LOCAL( FT_Error )
- tt_face_load_bhed( TT_Face face,
- FT_Stream stream );
-
-#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
-
-
-FT_END_HEADER
-
-#endif /* __TTLOAD_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/sfnt/ttmtx.c b/chromium/third_party/pdfium/third_party/freetype/src/sfnt/ttmtx.c
deleted file mode 100644
index 58309aa496e..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/sfnt/ttmtx.c
+++ /dev/null
@@ -1,280 +0,0 @@
-/***************************************************************************/
-/* */
-/* ttmtx.c */
-/* */
-/* Load the metrics tables common to TTF and OTF fonts (body). */
-/* */
-/* Copyright 2006-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_TRUETYPE_TAGS_H
-#include "ttmtx.h"
-
-#include "sferrors.h"
-
-
- /*************************************************************************/
- /* */
- /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
- /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
- /* messages during execution. */
- /* */
-#undef FT_COMPONENT
-#define FT_COMPONENT trace_ttmtx
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* tt_face_load_hmtx */
- /* */
- /* <Description> */
- /* Load the `hmtx' or `vmtx' table into a face object. */
- /* */
- /* <Input> */
- /* face :: A handle to the target face object. */
- /* */
- /* stream :: The input stream. */
- /* */
- /* vertical :: A boolean flag. If set, load `vmtx'. */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. */
- /* */
- FT_LOCAL_DEF( FT_Error )
- tt_face_load_hmtx( TT_Face face,
- FT_Stream stream,
- FT_Bool vertical )
- {
- FT_Error error;
- FT_ULong tag, table_size;
- FT_ULong* ptable_offset;
- FT_ULong* ptable_size;
-
-
- if ( vertical )
- {
- tag = TTAG_vmtx;
- ptable_offset = &face->vert_metrics_offset;
- ptable_size = &face->vert_metrics_size;
- }
- else
- {
- tag = TTAG_hmtx;
- ptable_offset = &face->horz_metrics_offset;
- ptable_size = &face->horz_metrics_size;
- }
-
- error = face->goto_table( face, tag, stream, &table_size );
- if ( error )
- goto Fail;
-
- *ptable_size = table_size;
- *ptable_offset = FT_STREAM_POS();
-
- Fail:
- return error;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* tt_face_load_hhea */
- /* */
- /* <Description> */
- /* Load the `hhea' or 'vhea' table into a face object. */
- /* */
- /* <Input> */
- /* face :: A handle to the target face object. */
- /* */
- /* stream :: The input stream. */
- /* */
- /* vertical :: A boolean flag. If set, load `vhea'. */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. */
- /* */
- FT_LOCAL_DEF( FT_Error )
- tt_face_load_hhea( TT_Face face,
- FT_Stream stream,
- FT_Bool vertical )
- {
- FT_Error error;
- TT_HoriHeader* header;
-
- static const FT_Frame_Field metrics_header_fields[] =
- {
-#undef FT_STRUCTURE
-#define FT_STRUCTURE TT_HoriHeader
-
- FT_FRAME_START( 36 ),
- FT_FRAME_ULONG ( Version ),
- FT_FRAME_SHORT ( Ascender ),
- FT_FRAME_SHORT ( Descender ),
- FT_FRAME_SHORT ( Line_Gap ),
- FT_FRAME_USHORT( advance_Width_Max ),
- FT_FRAME_SHORT ( min_Left_Side_Bearing ),
- FT_FRAME_SHORT ( min_Right_Side_Bearing ),
- FT_FRAME_SHORT ( xMax_Extent ),
- FT_FRAME_SHORT ( caret_Slope_Rise ),
- FT_FRAME_SHORT ( caret_Slope_Run ),
- FT_FRAME_SHORT ( caret_Offset ),
- FT_FRAME_SHORT ( Reserved[0] ),
- FT_FRAME_SHORT ( Reserved[1] ),
- FT_FRAME_SHORT ( Reserved[2] ),
- FT_FRAME_SHORT ( Reserved[3] ),
- FT_FRAME_SHORT ( metric_Data_Format ),
- FT_FRAME_USHORT( number_Of_HMetrics ),
- FT_FRAME_END
- };
-
-
- if ( vertical )
- {
- void *v = &face->vertical;
-
-
- error = face->goto_table( face, TTAG_vhea, stream, 0 );
- if ( error )
- goto Fail;
-
- header = (TT_HoriHeader*)v;
- }
- else
- {
- error = face->goto_table( face, TTAG_hhea, stream, 0 );
- if ( error )
- goto Fail;
-
- header = &face->horizontal;
- }
-
- if ( FT_STREAM_READ_FIELDS( metrics_header_fields, header ) )
- goto Fail;
-
- FT_TRACE3(( "Ascender: %5d\n", header->Ascender ));
- FT_TRACE3(( "Descender: %5d\n", header->Descender ));
- FT_TRACE3(( "number_Of_Metrics: %5u\n", header->number_Of_HMetrics ));
-
- header->long_metrics = NULL;
- header->short_metrics = NULL;
-
- Fail:
- return error;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* tt_face_get_metrics */
- /* */
- /* <Description> */
- /* Return the horizontal or vertical metrics in font units for a */
- /* given glyph. The values are the left side bearing (top side */
- /* bearing for vertical metrics) and advance width (advance height */
- /* for vertical metrics). */
- /* */
- /* <Input> */
- /* face :: A pointer to the TrueType face structure. */
- /* */
- /* vertical :: If set to TRUE, get vertical metrics. */
- /* */
- /* gindex :: The glyph index. */
- /* */
- /* <Output> */
- /* abearing :: The bearing, either left side or top side. */
- /* */
- /* aadvance :: The advance width or advance height, depending on */
- /* the `vertical' flag. */
- /* */
- FT_LOCAL_DEF( void )
- tt_face_get_metrics( TT_Face face,
- FT_Bool vertical,
- FT_UInt gindex,
- FT_Short *abearing,
- FT_UShort *aadvance )
- {
- FT_Error error;
- FT_Stream stream = face->root.stream;
- TT_HoriHeader* header;
- FT_ULong table_pos, table_size, table_end;
- FT_UShort k;
-
-
- if ( vertical )
- {
- void* v = &face->vertical;
-
-
- header = (TT_HoriHeader*)v;
- table_pos = face->vert_metrics_offset;
- table_size = face->vert_metrics_size;
- }
- else
- {
- header = &face->horizontal;
- table_pos = face->horz_metrics_offset;
- table_size = face->horz_metrics_size;
- }
-
- table_end = table_pos + table_size;
-
- k = header->number_Of_HMetrics;
-
- if ( k > 0 )
- {
- if ( gindex < (FT_UInt)k )
- {
- table_pos += 4 * gindex;
- if ( table_pos + 4 > table_end )
- goto NoData;
-
- if ( FT_STREAM_SEEK( table_pos ) ||
- FT_READ_USHORT( *aadvance ) ||
- FT_READ_SHORT( *abearing ) )
- goto NoData;
- }
- else
- {
- table_pos += 4 * ( k - 1 );
- if ( table_pos + 4 > table_end )
- goto NoData;
-
- if ( FT_STREAM_SEEK( table_pos ) ||
- FT_READ_USHORT( *aadvance ) )
- goto NoData;
-
- table_pos += 4 + 2 * ( gindex - k );
- if ( table_pos + 2 > table_end )
- *abearing = 0;
- else
- {
- if ( !FT_STREAM_SEEK( table_pos ) )
- (void)FT_READ_SHORT( *abearing );
- }
- }
- }
- else
- {
- NoData:
- *abearing = 0;
- *aadvance = 0;
- }
- }
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/sfnt/ttmtx.h b/chromium/third_party/pdfium/third_party/freetype/src/sfnt/ttmtx.h
deleted file mode 100644
index 096ee062cf0..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/sfnt/ttmtx.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/***************************************************************************/
-/* */
-/* ttmtx.h */
-/* */
-/* Load the metrics tables common to TTF and OTF fonts (specification). */
-/* */
-/* Copyright 2006-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __TTMTX_H__
-#define __TTMTX_H__
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_TRUETYPE_TYPES_H
-
-
-FT_BEGIN_HEADER
-
-
- FT_LOCAL( FT_Error )
- tt_face_load_hhea( TT_Face face,
- FT_Stream stream,
- FT_Bool vertical );
-
-
- FT_LOCAL( FT_Error )
- tt_face_load_hmtx( TT_Face face,
- FT_Stream stream,
- FT_Bool vertical );
-
-
- FT_LOCAL( void )
- tt_face_get_metrics( TT_Face face,
- FT_Bool vertical,
- FT_UInt gindex,
- FT_Short* abearing,
- FT_UShort* aadvance );
-
-FT_END_HEADER
-
-#endif /* __TTMTX_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/sfnt/ttpost.c b/chromium/third_party/pdfium/third_party/freetype/src/sfnt/ttpost.c
deleted file mode 100644
index 8d29d1e9f6d..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/sfnt/ttpost.c
+++ /dev/null
@@ -1,563 +0,0 @@
-/***************************************************************************/
-/* */
-/* ttpost.c */
-/* */
-/* Postcript name table processing for TrueType and OpenType fonts */
-/* (body). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
- /*************************************************************************/
- /* */
- /* The post table is not completely loaded by the core engine. This */
- /* file loads the missing PS glyph names and implements an API to access */
- /* them. */
- /* */
- /*************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_TRUETYPE_TAGS_H
-#include "ttpost.h"
-
-#include "sferrors.h"
-
-
- /*************************************************************************/
- /* */
- /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
- /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
- /* messages during execution. */
- /* */
-#undef FT_COMPONENT
-#define FT_COMPONENT trace_ttpost
-
-
- /* If this configuration macro is defined, we rely on the `PSNames' */
- /* module to grab the glyph names. */
-
-#ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES
-
-
-#include FT_SERVICE_POSTSCRIPT_CMAPS_H
-
-#define MAC_NAME( x ) (FT_String*)psnames->macintosh_name( (FT_UInt)(x) )
-
-
-#else /* FT_CONFIG_OPTION_POSTSCRIPT_NAMES */
-
-
- /* Otherwise, we ignore the `PSNames' module, and provide our own */
- /* table of Mac names. Thus, it is possible to build a version of */
- /* FreeType without the Type 1 driver & PSNames module. */
-
-#define MAC_NAME( x ) (FT_String*)tt_post_default_names[x]
-
- /* the 258 default Mac PS glyph names; see file `tools/glnames.py' */
-
- static const FT_String* const tt_post_default_names[258] =
- {
- /* 0 */
- ".notdef", ".null", "nonmarkingreturn", "space", "exclam",
- "quotedbl", "numbersign", "dollar", "percent", "ampersand",
- /* 10 */
- "quotesingle", "parenleft", "parenright", "asterisk", "plus",
- "comma", "hyphen", "period", "slash", "zero",
- /* 20 */
- "one", "two", "three", "four", "five",
- "six", "seven", "eight", "nine", "colon",
- /* 30 */
- "semicolon", "less", "equal", "greater", "question",
- "at", "A", "B", "C", "D",
- /* 40 */
- "E", "F", "G", "H", "I",
- "J", "K", "L", "M", "N",
- /* 50 */
- "O", "P", "Q", "R", "S",
- "T", "U", "V", "W", "X",
- /* 60 */
- "Y", "Z", "bracketleft", "backslash", "bracketright",
- "asciicircum", "underscore", "grave", "a", "b",
- /* 70 */
- "c", "d", "e", "f", "g",
- "h", "i", "j", "k", "l",
- /* 80 */
- "m", "n", "o", "p", "q",
- "r", "s", "t", "u", "v",
- /* 90 */
- "w", "x", "y", "z", "braceleft",
- "bar", "braceright", "asciitilde", "Adieresis", "Aring",
- /* 100 */
- "Ccedilla", "Eacute", "Ntilde", "Odieresis", "Udieresis",
- "aacute", "agrave", "acircumflex", "adieresis", "atilde",
- /* 110 */
- "aring", "ccedilla", "eacute", "egrave", "ecircumflex",
- "edieresis", "iacute", "igrave", "icircumflex", "idieresis",
- /* 120 */
- "ntilde", "oacute", "ograve", "ocircumflex", "odieresis",
- "otilde", "uacute", "ugrave", "ucircumflex", "udieresis",
- /* 130 */
- "dagger", "degree", "cent", "sterling", "section",
- "bullet", "paragraph", "germandbls", "registered", "copyright",
- /* 140 */
- "trademark", "acute", "dieresis", "notequal", "AE",
- "Oslash", "infinity", "plusminus", "lessequal", "greaterequal",
- /* 150 */
- "yen", "mu", "partialdiff", "summation", "product",
- "pi", "integral", "ordfeminine", "ordmasculine", "Omega",
- /* 160 */
- "ae", "oslash", "questiondown", "exclamdown", "logicalnot",
- "radical", "florin", "approxequal", "Delta", "guillemotleft",
- /* 170 */
- "guillemotright", "ellipsis", "nonbreakingspace", "Agrave", "Atilde",
- "Otilde", "OE", "oe", "endash", "emdash",
- /* 180 */
- "quotedblleft", "quotedblright", "quoteleft", "quoteright", "divide",
- "lozenge", "ydieresis", "Ydieresis", "fraction", "currency",
- /* 190 */
- "guilsinglleft", "guilsinglright", "fi", "fl", "daggerdbl",
- "periodcentered", "quotesinglbase", "quotedblbase", "perthousand", "Acircumflex",
- /* 200 */
- "Ecircumflex", "Aacute", "Edieresis", "Egrave", "Iacute",
- "Icircumflex", "Idieresis", "Igrave", "Oacute", "Ocircumflex",
- /* 210 */
- "apple", "Ograve", "Uacute", "Ucircumflex", "Ugrave",
- "dotlessi", "circumflex", "tilde", "macron", "breve",
- /* 220 */
- "dotaccent", "ring", "cedilla", "hungarumlaut", "ogonek",
- "caron", "Lslash", "lslash", "Scaron", "scaron",
- /* 230 */
- "Zcaron", "zcaron", "brokenbar", "Eth", "eth",
- "Yacute", "yacute", "Thorn", "thorn", "minus",
- /* 240 */
- "multiply", "onesuperior", "twosuperior", "threesuperior", "onehalf",
- "onequarter", "threequarters", "franc", "Gbreve", "gbreve",
- /* 250 */
- "Idotaccent", "Scedilla", "scedilla", "Cacute", "cacute",
- "Ccaron", "ccaron", "dcroat",
- };
-
-
-#endif /* FT_CONFIG_OPTION_POSTSCRIPT_NAMES */
-
-
- static FT_Error
- load_format_20( TT_Face face,
- FT_Stream stream,
- FT_ULong post_limit )
- {
- FT_Memory memory = stream->memory;
- FT_Error error;
-
- FT_Int num_glyphs;
- FT_UShort num_names;
-
- FT_UShort* glyph_indices = NULL;
- FT_Char** name_strings = NULL;
-
-
- if ( FT_READ_USHORT( num_glyphs ) )
- goto Exit;
-
- /* UNDOCUMENTED! The number of glyphs in this table can be smaller */
- /* than the value in the maxp table (cf. cyberbit.ttf). */
-
- /* There already exist fonts which have more than 32768 glyph names */
- /* in this table, so the test for this threshold has been dropped. */
-
- if ( num_glyphs > face->max_profile.numGlyphs )
- {
- error = FT_THROW( Invalid_File_Format );
- goto Exit;
- }
-
- /* load the indices */
- {
- FT_Int n;
-
-
- if ( FT_NEW_ARRAY ( glyph_indices, num_glyphs ) ||
- FT_FRAME_ENTER( num_glyphs * 2L ) )
- goto Fail;
-
- for ( n = 0; n < num_glyphs; n++ )
- glyph_indices[n] = FT_GET_USHORT();
-
- FT_FRAME_EXIT();
- }
-
- /* compute number of names stored in table */
- {
- FT_Int n;
-
-
- num_names = 0;
-
- for ( n = 0; n < num_glyphs; n++ )
- {
- FT_Int idx;
-
-
- idx = glyph_indices[n];
- if ( idx >= 258 )
- {
- idx -= 257;
- if ( idx > num_names )
- num_names = (FT_UShort)idx;
- }
- }
- }
-
- /* now load the name strings */
- {
- FT_UShort n;
-
-
- if ( FT_NEW_ARRAY( name_strings, num_names ) )
- goto Fail;
-
- for ( n = 0; n < num_names; n++ )
- {
- FT_UInt len;
-
-
- if ( FT_STREAM_POS() >= post_limit )
- break;
- else
- {
- FT_TRACE6(( "load_format_20: %d byte left in post table\n",
- post_limit - FT_STREAM_POS() ));
-
- if ( FT_READ_BYTE( len ) )
- goto Fail1;
- }
-
- if ( len > post_limit ||
- FT_STREAM_POS() > post_limit - len )
- {
- FT_Int d = (FT_Int)post_limit - (FT_Int)FT_STREAM_POS();
-
-
- FT_ERROR(( "load_format_20:"
- " exceeding string length (%d),"
- " truncating at end of post table (%d byte left)\n",
- len, d ));
- len = (FT_UInt)FT_MAX( 0, d );
- }
-
- if ( FT_NEW_ARRAY( name_strings[n], len + 1 ) ||
- FT_STREAM_READ( name_strings[n], len ) )
- goto Fail1;
-
- name_strings[n][len] = '\0';
- }
-
- if ( n < num_names )
- {
- FT_ERROR(( "load_format_20:"
- " all entries in post table are already parsed,"
- " using NULL names for gid %d - %d\n",
- n, num_names - 1 ));
- for ( ; n < num_names; n++ )
- if ( FT_NEW_ARRAY( name_strings[n], 1 ) )
- goto Fail1;
- else
- name_strings[n][0] = '\0';
- }
- }
-
- /* all right, set table fields and exit successfully */
- {
- TT_Post_20 table = &face->postscript_names.names.format_20;
-
-
- table->num_glyphs = (FT_UShort)num_glyphs;
- table->num_names = (FT_UShort)num_names;
- table->glyph_indices = glyph_indices;
- table->glyph_names = name_strings;
- }
- return FT_Err_Ok;
-
- Fail1:
- {
- FT_UShort n;
-
-
- for ( n = 0; n < num_names; n++ )
- FT_FREE( name_strings[n] );
- }
-
- Fail:
- FT_FREE( name_strings );
- FT_FREE( glyph_indices );
-
- Exit:
- return error;
- }
-
-
- static FT_Error
- load_format_25( TT_Face face,
- FT_Stream stream,
- FT_ULong post_limit )
- {
- FT_Memory memory = stream->memory;
- FT_Error error;
-
- FT_Int num_glyphs;
- FT_Char* offset_table = NULL;
-
- FT_UNUSED( post_limit );
-
-
- /* UNDOCUMENTED! This value appears only in the Apple TT specs. */
- if ( FT_READ_USHORT( num_glyphs ) )
- goto Exit;
-
- /* check the number of glyphs */
- if ( num_glyphs > face->max_profile.numGlyphs || num_glyphs > 258 )
- {
- error = FT_THROW( Invalid_File_Format );
- goto Exit;
- }
-
- if ( FT_NEW_ARRAY( offset_table, num_glyphs ) ||
- FT_STREAM_READ( offset_table, num_glyphs ) )
- goto Fail;
-
- /* now check the offset table */
- {
- FT_Int n;
-
-
- for ( n = 0; n < num_glyphs; n++ )
- {
- FT_Long idx = (FT_Long)n + offset_table[n];
-
-
- if ( idx < 0 || idx > num_glyphs )
- {
- error = FT_THROW( Invalid_File_Format );
- goto Fail;
- }
- }
- }
-
- /* OK, set table fields and exit successfully */
- {
- TT_Post_25 table = &face->postscript_names.names.format_25;
-
-
- table->num_glyphs = (FT_UShort)num_glyphs;
- table->offsets = offset_table;
- }
-
- return FT_Err_Ok;
-
- Fail:
- FT_FREE( offset_table );
-
- Exit:
- return error;
- }
-
-
- static FT_Error
- load_post_names( TT_Face face )
- {
- FT_Stream stream;
- FT_Error error;
- FT_Fixed format;
- FT_ULong post_len;
- FT_ULong post_limit;
-
-
- /* get a stream for the face's resource */
- stream = face->root.stream;
-
- /* seek to the beginning of the PS names table */
- error = face->goto_table( face, TTAG_post, stream, &post_len );
- if ( error )
- goto Exit;
-
- post_limit = FT_STREAM_POS() + post_len;
-
- format = face->postscript.FormatType;
-
- /* go to beginning of subtable */
- if ( FT_STREAM_SKIP( 32 ) )
- goto Exit;
-
- /* now read postscript table */
- if ( format == 0x00020000L )
- error = load_format_20( face, stream, post_limit );
- else if ( format == 0x00028000L )
- error = load_format_25( face, stream, post_limit );
- else
- error = FT_THROW( Invalid_File_Format );
-
- face->postscript_names.loaded = 1;
-
- Exit:
- return error;
- }
-
-
- FT_LOCAL_DEF( void )
- tt_face_free_ps_names( TT_Face face )
- {
- FT_Memory memory = face->root.memory;
- TT_Post_Names names = &face->postscript_names;
- FT_Fixed format;
-
-
- if ( names->loaded )
- {
- format = face->postscript.FormatType;
-
- if ( format == 0x00020000L )
- {
- TT_Post_20 table = &names->names.format_20;
- FT_UShort n;
-
-
- FT_FREE( table->glyph_indices );
- table->num_glyphs = 0;
-
- for ( n = 0; n < table->num_names; n++ )
- FT_FREE( table->glyph_names[n] );
-
- FT_FREE( table->glyph_names );
- table->num_names = 0;
- }
- else if ( format == 0x00028000L )
- {
- TT_Post_25 table = &names->names.format_25;
-
-
- FT_FREE( table->offsets );
- table->num_glyphs = 0;
- }
- }
- names->loaded = 0;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* tt_face_get_ps_name */
- /* */
- /* <Description> */
- /* Get the PostScript glyph name of a glyph. */
- /* */
- /* <Input> */
- /* face :: A handle to the parent face. */
- /* */
- /* idx :: The glyph index. */
- /* */
- /* <InOut> */
- /* PSname :: The address of a string pointer. Will be NULL in case */
- /* of error, otherwise it is a pointer to the glyph name. */
- /* */
- /* You must not modify the returned string! */
- /* */
- /* <Output> */
- /* FreeType error code. 0 means success. */
- /* */
- FT_LOCAL_DEF( FT_Error )
- tt_face_get_ps_name( TT_Face face,
- FT_UInt idx,
- FT_String** PSname )
- {
- FT_Error error;
- TT_Post_Names names;
- FT_Fixed format;
-
-#ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES
- FT_Service_PsCMaps psnames;
-#endif
-
-
- if ( !face )
- return FT_THROW( Invalid_Face_Handle );
-
- if ( idx >= (FT_UInt)face->max_profile.numGlyphs )
- return FT_THROW( Invalid_Glyph_Index );
-
-#ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES
- psnames = (FT_Service_PsCMaps)face->psnames;
- if ( !psnames )
- return FT_THROW( Unimplemented_Feature );
-#endif
-
- names = &face->postscript_names;
-
- /* `.notdef' by default */
- *PSname = MAC_NAME( 0 );
-
- format = face->postscript.FormatType;
-
- if ( format == 0x00010000L )
- {
- if ( idx < 258 ) /* paranoid checking */
- *PSname = MAC_NAME( idx );
- }
- else if ( format == 0x00020000L )
- {
- TT_Post_20 table = &names->names.format_20;
-
-
- if ( !names->loaded )
- {
- error = load_post_names( face );
- if ( error )
- goto End;
- }
-
- if ( idx < (FT_UInt)table->num_glyphs )
- {
- FT_UShort name_index = table->glyph_indices[idx];
-
-
- if ( name_index < 258 )
- *PSname = MAC_NAME( name_index );
- else
- *PSname = (FT_String*)table->glyph_names[name_index - 258];
- }
- }
- else if ( format == 0x00028000L )
- {
- TT_Post_25 table = &names->names.format_25;
-
-
- if ( !names->loaded )
- {
- error = load_post_names( face );
- if ( error )
- goto End;
- }
-
- if ( idx < (FT_UInt)table->num_glyphs ) /* paranoid checking */
- *PSname = MAC_NAME( (FT_Int)idx + table->offsets[idx] );
- }
-
- /* nothing to do for format == 0x00030000L */
-
- End:
- return FT_Err_Ok;
- }
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/sfnt/ttpost.h b/chromium/third_party/pdfium/third_party/freetype/src/sfnt/ttpost.h
deleted file mode 100644
index e3eca02c623..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/sfnt/ttpost.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/***************************************************************************/
-/* */
-/* ttpost.h */
-/* */
-/* Postcript name table processing for TrueType and OpenType fonts */
-/* (specification). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __TTPOST_H__
-#define __TTPOST_H__
-
-
-#include <ft2build.h>
-#include FT_CONFIG_CONFIG_H
-#include FT_INTERNAL_TRUETYPE_TYPES_H
-
-
-FT_BEGIN_HEADER
-
-
- FT_LOCAL( FT_Error )
- tt_face_get_ps_name( TT_Face face,
- FT_UInt idx,
- FT_String** PSname );
-
- FT_LOCAL( void )
- tt_face_free_ps_names( TT_Face face );
-
-
-FT_END_HEADER
-
-#endif /* __TTPOST_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/sfnt/ttsbit.c b/chromium/third_party/pdfium/third_party/freetype/src/sfnt/ttsbit.c
deleted file mode 100644
index 3b351ecfce4..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/sfnt/ttsbit.c
+++ /dev/null
@@ -1,1472 +0,0 @@
-/***************************************************************************/
-/* */
-/* ttsbit.c */
-/* */
-/* TrueType and OpenType embedded bitmap support (body). */
-/* */
-/* Copyright 2005-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* Copyright 2013 by Google, Inc. */
-/* Google Author(s): Behdad Esfahbod. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_TRUETYPE_TAGS_H
-#include FT_BITMAP_H
-#include "ttsbit.h"
-
-#include "sferrors.h"
-
-#include "ttmtx.h"
-#include "pngshim.h"
-
-
- /*************************************************************************/
- /* */
- /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
- /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
- /* messages during execution. */
- /* */
-#undef FT_COMPONENT
-#define FT_COMPONENT trace_ttsbit
-
-
- FT_LOCAL_DEF( FT_Error )
- tt_face_load_sbit( TT_Face face,
- FT_Stream stream )
- {
- FT_Error error;
- FT_ULong table_size;
-
-
- face->sbit_table = NULL;
- face->sbit_table_size = 0;
- face->sbit_table_type = TT_SBIT_TABLE_TYPE_NONE;
- face->sbit_num_strikes = 0;
-
- error = face->goto_table( face, TTAG_CBLC, stream, &table_size );
- if ( !error )
- face->sbit_table_type = TT_SBIT_TABLE_TYPE_CBLC;
- else
- {
- error = face->goto_table( face, TTAG_EBLC, stream, &table_size );
- if ( error )
- error = face->goto_table( face, TTAG_bloc, stream, &table_size );
- if ( !error )
- face->sbit_table_type = TT_SBIT_TABLE_TYPE_EBLC;
- }
-
- if ( error )
- {
- error = face->goto_table( face, TTAG_sbix, stream, &table_size );
- if ( !error )
- face->sbit_table_type = TT_SBIT_TABLE_TYPE_SBIX;
- }
- if ( error )
- goto Exit;
-
- if ( table_size < 8 )
- {
- FT_ERROR(( "tt_face_load_sbit_strikes: table too short\n" ));
- error = FT_THROW( Invalid_File_Format );
- goto Exit;
- }
-
- switch ( (FT_UInt)face->sbit_table_type )
- {
- case TT_SBIT_TABLE_TYPE_EBLC:
- case TT_SBIT_TABLE_TYPE_CBLC:
- {
- FT_Byte* p;
- FT_Fixed version;
- FT_ULong num_strikes;
- FT_UInt count;
-
-
- if ( FT_FRAME_EXTRACT( table_size, face->sbit_table ) )
- goto Exit;
-
- face->sbit_table_size = table_size;
-
- p = face->sbit_table;
-
- version = FT_NEXT_LONG( p );
- num_strikes = FT_NEXT_ULONG( p );
-
- if ( ( (FT_ULong)version & 0xFFFF0000UL ) != 0x00020000UL )
- {
- error = FT_THROW( Unknown_File_Format );
- goto Exit;
- }
-
- if ( num_strikes >= 0x10000UL )
- {
- error = FT_THROW( Invalid_File_Format );
- goto Exit;
- }
-
- /*
- * Count the number of strikes available in the table. We are a bit
- * paranoid there and don't trust the data.
- */
- count = (FT_UInt)num_strikes;
- if ( 8 + 48UL * count > table_size )
- count = (FT_UInt)( ( table_size - 8 ) / 48 );
-
- face->sbit_num_strikes = count;
- }
- break;
-
- case TT_SBIT_TABLE_TYPE_SBIX:
- {
- FT_UShort version;
- FT_UShort flags;
- FT_ULong num_strikes;
- FT_UInt count;
-
-
- if ( FT_FRAME_ENTER( 8 ) )
- goto Exit;
-
- version = FT_GET_USHORT();
- flags = FT_GET_USHORT();
- num_strikes = FT_GET_ULONG();
-
- FT_FRAME_EXIT();
-
- if ( version < 1 )
- {
- error = FT_THROW( Unknown_File_Format );
- goto Exit;
- }
-
- /* Bit 0 must always be `1'. */
- /* Bit 1 controls the overlay of bitmaps with outlines. */
- /* All other bits should be zero. */
- if ( !( flags == 1 || flags == 3 ) ||
- num_strikes >= 0x10000UL )
- {
- error = FT_THROW( Invalid_File_Format );
- goto Exit;
- }
-
- /* we currently don't support bit 1; however, it is better to */
- /* draw at least something... */
- if ( flags == 3 )
- FT_TRACE1(( "tt_face_load_sbit_strikes:"
- " sbix overlay not supported yet\n"
- " "
- " expect bad rendering results\n" ));
-
- /*
- * Count the number of strikes available in the table. We are a bit
- * paranoid there and don't trust the data.
- */
- count = (FT_UInt)num_strikes;
- if ( 8 + 4UL * count > table_size )
- count = (FT_UInt)( ( table_size - 8 ) / 4 );
-
- if ( FT_STREAM_SEEK( FT_STREAM_POS() - 8 ) )
- goto Exit;
-
- face->sbit_table_size = 8 + count * 4;
- if ( FT_FRAME_EXTRACT( face->sbit_table_size, face->sbit_table ) )
- goto Exit;
-
- face->sbit_num_strikes = count;
- }
- break;
-
- default:
- error = FT_THROW( Unknown_File_Format );
- break;
- }
-
- if ( !error )
- FT_TRACE3(( "sbit_num_strikes: %u\n", face->sbit_num_strikes ));
-
- return FT_Err_Ok;
-
- Exit:
- if ( error )
- {
- if ( face->sbit_table )
- FT_FRAME_RELEASE( face->sbit_table );
- face->sbit_table_size = 0;
- face->sbit_table_type = TT_SBIT_TABLE_TYPE_NONE;
- }
-
- return error;
- }
-
-
- FT_LOCAL_DEF( void )
- tt_face_free_sbit( TT_Face face )
- {
- FT_Stream stream = face->root.stream;
-
-
- FT_FRAME_RELEASE( face->sbit_table );
- face->sbit_table_size = 0;
- face->sbit_table_type = TT_SBIT_TABLE_TYPE_NONE;
- face->sbit_num_strikes = 0;
- }
-
-
- FT_LOCAL_DEF( FT_Error )
- tt_face_set_sbit_strike( TT_Face face,
- FT_Size_Request req,
- FT_ULong* astrike_index )
- {
- return FT_Match_Size( (FT_Face)face, req, 0, astrike_index );
- }
-
-
- FT_LOCAL_DEF( FT_Error )
- tt_face_load_strike_metrics( TT_Face face,
- FT_ULong strike_index,
- FT_Size_Metrics* metrics )
- {
- if ( strike_index >= (FT_ULong)face->sbit_num_strikes )
- return FT_THROW( Invalid_Argument );
-
- switch ( (FT_UInt)face->sbit_table_type )
- {
- case TT_SBIT_TABLE_TYPE_EBLC:
- case TT_SBIT_TABLE_TYPE_CBLC:
- {
- FT_Byte* strike;
-
-
- strike = face->sbit_table + 8 + strike_index * 48;
-
- metrics->x_ppem = (FT_UShort)strike[44];
- metrics->y_ppem = (FT_UShort)strike[45];
-
- metrics->ascender = (FT_Char)strike[16] * 64; /* hori.ascender */
- metrics->descender = (FT_Char)strike[17] * 64; /* hori.descender */
- metrics->height = metrics->ascender - metrics->descender;
-
- /* Is this correct? */
- metrics->max_advance = ( (FT_Char)strike[22] + /* min_origin_SB */
- strike[18] + /* max_width */
- (FT_Char)strike[23] /* min_advance_SB */
- ) * 64;
- return FT_Err_Ok;
- }
-
- case TT_SBIT_TABLE_TYPE_SBIX:
- {
- FT_Stream stream = face->root.stream;
- FT_UInt offset, upem;
- FT_UShort ppem, resolution;
- TT_HoriHeader *hori;
- FT_ULong table_size;
- FT_Pos ppem_, upem_; /* to reduce casts */
-
- FT_Error error;
- FT_Byte* p;
-
-
- p = face->sbit_table + 8 + 4 * strike_index;
- offset = FT_NEXT_ULONG( p );
-
- error = face->goto_table( face, TTAG_sbix, stream, &table_size );
- if ( error )
- return error;
-
- if ( offset + 4 > table_size )
- return FT_THROW( Invalid_File_Format );
-
- if ( FT_STREAM_SEEK( FT_STREAM_POS() + offset ) ||
- FT_FRAME_ENTER( 4 ) )
- return error;
-
- ppem = FT_GET_USHORT();
- resolution = FT_GET_USHORT();
-
- FT_UNUSED( resolution ); /* What to do with this? */
-
- FT_FRAME_EXIT();
-
- upem = face->header.Units_Per_EM;
- hori = &face->horizontal;
-
- metrics->x_ppem = ppem;
- metrics->y_ppem = ppem;
-
- ppem_ = (FT_Pos)ppem;
- upem_ = (FT_Pos)upem;
-
- metrics->ascender = ppem_ * hori->Ascender * 64 / upem_;
- metrics->descender = ppem_ * hori->Descender * 64 / upem_;
- metrics->height = ppem_ * ( hori->Ascender -
- hori->Descender +
- hori->Line_Gap ) * 64 / upem_;
- metrics->max_advance = ppem_ * hori->advance_Width_Max * 64 / upem_;
-
- return error;
- }
-
- default:
- return FT_THROW( Unknown_File_Format );
- }
- }
-
-
- typedef struct TT_SBitDecoderRec_
- {
- TT_Face face;
- FT_Stream stream;
- FT_Bitmap* bitmap;
- TT_SBit_Metrics metrics;
- FT_Bool metrics_loaded;
- FT_Bool bitmap_allocated;
- FT_Byte bit_depth;
-
- FT_ULong ebdt_start;
- FT_ULong ebdt_size;
-
- FT_ULong strike_index_array;
- FT_ULong strike_index_count;
- FT_Byte* eblc_base;
- FT_Byte* eblc_limit;
-
- } TT_SBitDecoderRec, *TT_SBitDecoder;
-
-
- static FT_Error
- tt_sbit_decoder_init( TT_SBitDecoder decoder,
- TT_Face face,
- FT_ULong strike_index,
- TT_SBit_MetricsRec* metrics )
- {
- FT_Error error;
- FT_Stream stream = face->root.stream;
- FT_ULong ebdt_size;
-
-
- error = face->goto_table( face, TTAG_CBDT, stream, &ebdt_size );
- if ( error )
- error = face->goto_table( face, TTAG_EBDT, stream, &ebdt_size );
- if ( error )
- error = face->goto_table( face, TTAG_bdat, stream, &ebdt_size );
- if ( error )
- goto Exit;
-
- decoder->face = face;
- decoder->stream = stream;
- decoder->bitmap = &face->root.glyph->bitmap;
- decoder->metrics = metrics;
-
- decoder->metrics_loaded = 0;
- decoder->bitmap_allocated = 0;
-
- decoder->ebdt_start = FT_STREAM_POS();
- decoder->ebdt_size = ebdt_size;
-
- decoder->eblc_base = face->sbit_table;
- decoder->eblc_limit = face->sbit_table + face->sbit_table_size;
-
- /* now find the strike corresponding to the index */
- {
- FT_Byte* p;
-
-
- if ( 8 + 48 * strike_index + 3 * 4 + 34 + 1 > face->sbit_table_size )
- {
- error = FT_THROW( Invalid_File_Format );
- goto Exit;
- }
-
- p = decoder->eblc_base + 8 + 48 * strike_index;
-
- decoder->strike_index_array = FT_NEXT_ULONG( p );
- p += 4;
- decoder->strike_index_count = FT_NEXT_ULONG( p );
- p += 34;
- decoder->bit_depth = *p;
-
- /* decoder->strike_index_array + */
- /* 8 * decoder->strike_index_count > face->sbit_table_size ? */
- if ( decoder->strike_index_array > face->sbit_table_size ||
- decoder->strike_index_count >
- ( face->sbit_table_size - decoder->strike_index_array ) / 8 )
- error = FT_THROW( Invalid_File_Format );
- }
-
- Exit:
- return error;
- }
-
-
- static void
- tt_sbit_decoder_done( TT_SBitDecoder decoder )
- {
- FT_UNUSED( decoder );
- }
-
-
- static FT_Error
- tt_sbit_decoder_alloc_bitmap( TT_SBitDecoder decoder )
- {
- FT_Error error = FT_Err_Ok;
- FT_UInt width, height;
- FT_Bitmap* map = decoder->bitmap;
- FT_ULong size;
-
-
- if ( !decoder->metrics_loaded )
- {
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- width = decoder->metrics->width;
- height = decoder->metrics->height;
-
- map->width = width;
- map->rows = height;
-
- switch ( decoder->bit_depth )
- {
- case 1:
- map->pixel_mode = FT_PIXEL_MODE_MONO;
- map->pitch = (int)( ( map->width + 7 ) >> 3 );
- map->num_grays = 2;
- break;
-
- case 2:
- map->pixel_mode = FT_PIXEL_MODE_GRAY2;
- map->pitch = (int)( ( map->width + 3 ) >> 2 );
- map->num_grays = 4;
- break;
-
- case 4:
- map->pixel_mode = FT_PIXEL_MODE_GRAY4;
- map->pitch = (int)( ( map->width + 1 ) >> 1 );
- map->num_grays = 16;
- break;
-
- case 8:
- map->pixel_mode = FT_PIXEL_MODE_GRAY;
- map->pitch = (int)( map->width );
- map->num_grays = 256;
- break;
-
- case 32:
- map->pixel_mode = FT_PIXEL_MODE_BGRA;
- map->pitch = (int)( map->width * 4 );
- map->num_grays = 256;
- break;
-
- default:
- error = FT_THROW( Invalid_File_Format );
- goto Exit;
- }
-
- size = map->rows * (FT_ULong)map->pitch;
-
- /* check that there is no empty image */
- if ( size == 0 )
- goto Exit; /* exit successfully! */
-
- error = ft_glyphslot_alloc_bitmap( decoder->face->root.glyph, size );
- if ( error )
- goto Exit;
-
- decoder->bitmap_allocated = 1;
-
- Exit:
- return error;
- }
-
-
- static FT_Error
- tt_sbit_decoder_load_metrics( TT_SBitDecoder decoder,
- FT_Byte* *pp,
- FT_Byte* limit,
- FT_Bool big )
- {
- FT_Byte* p = *pp;
- TT_SBit_Metrics metrics = decoder->metrics;
-
-
- if ( p + 5 > limit )
- goto Fail;
-
- metrics->height = p[0];
- metrics->width = p[1];
- metrics->horiBearingX = (FT_Char)p[2];
- metrics->horiBearingY = (FT_Char)p[3];
- metrics->horiAdvance = p[4];
-
- p += 5;
- if ( big )
- {
- if ( p + 3 > limit )
- goto Fail;
-
- metrics->vertBearingX = (FT_Char)p[0];
- metrics->vertBearingY = (FT_Char)p[1];
- metrics->vertAdvance = p[2];
-
- p += 3;
- }
- else
- {
- /* avoid uninitialized data in case there is no vertical info -- */
- metrics->vertBearingX = 0;
- metrics->vertBearingY = 0;
- metrics->vertAdvance = 0;
- }
-
- decoder->metrics_loaded = 1;
- *pp = p;
- return FT_Err_Ok;
-
- Fail:
- FT_TRACE1(( "tt_sbit_decoder_load_metrics: broken table\n" ));
- return FT_THROW( Invalid_Argument );
- }
-
-
- /* forward declaration */
- static FT_Error
- tt_sbit_decoder_load_image( TT_SBitDecoder decoder,
- FT_UInt glyph_index,
- FT_Int x_pos,
- FT_Int y_pos );
-
- typedef FT_Error (*TT_SBitDecoder_LoadFunc)( TT_SBitDecoder decoder,
- FT_Byte* p,
- FT_Byte* plimit,
- FT_Int x_pos,
- FT_Int y_pos );
-
-
- static FT_Error
- tt_sbit_decoder_load_byte_aligned( TT_SBitDecoder decoder,
- FT_Byte* p,
- FT_Byte* limit,
- FT_Int x_pos,
- FT_Int y_pos )
- {
- FT_Error error = FT_Err_Ok;
- FT_Byte* line;
- FT_Int pitch, width, height, line_bits, h;
- FT_UInt bit_height, bit_width;
- FT_Bitmap* bitmap;
-
-
- /* check that we can write the glyph into the bitmap */
- bitmap = decoder->bitmap;
- bit_width = bitmap->width;
- bit_height = bitmap->rows;
- pitch = bitmap->pitch;
- line = bitmap->buffer;
-
- width = decoder->metrics->width;
- height = decoder->metrics->height;
-
- line_bits = width * decoder->bit_depth;
-
- if ( x_pos < 0 || (FT_UInt)( x_pos + width ) > bit_width ||
- y_pos < 0 || (FT_UInt)( y_pos + height ) > bit_height )
- {
- FT_TRACE1(( "tt_sbit_decoder_load_byte_aligned:"
- " invalid bitmap dimensions\n" ));
- error = FT_THROW( Invalid_File_Format );
- goto Exit;
- }
-
- if ( p + ( ( line_bits + 7 ) >> 3 ) * height > limit )
- {
- FT_TRACE1(( "tt_sbit_decoder_load_byte_aligned: broken bitmap\n" ));
- error = FT_THROW( Invalid_File_Format );
- goto Exit;
- }
-
- /* now do the blit */
- line += y_pos * pitch + ( x_pos >> 3 );
- x_pos &= 7;
-
- if ( x_pos == 0 ) /* the easy one */
- {
- for ( h = height; h > 0; h--, line += pitch )
- {
- FT_Byte* pwrite = line;
- FT_Int w;
-
-
- for ( w = line_bits; w >= 8; w -= 8 )
- {
- pwrite[0] = (FT_Byte)( pwrite[0] | *p++ );
- pwrite += 1;
- }
-
- if ( w > 0 )
- pwrite[0] = (FT_Byte)( pwrite[0] | ( *p++ & ( 0xFF00U >> w ) ) );
- }
- }
- else /* x_pos > 0 */
- {
- for ( h = height; h > 0; h--, line += pitch )
- {
- FT_Byte* pwrite = line;
- FT_Int w;
- FT_UInt wval = 0;
-
-
- for ( w = line_bits; w >= 8; w -= 8 )
- {
- wval = (FT_UInt)( wval | *p++ );
- pwrite[0] = (FT_Byte)( pwrite[0] | ( wval >> x_pos ) );
- pwrite += 1;
- wval <<= 8;
- }
-
- if ( w > 0 )
- wval = (FT_UInt)( wval | ( *p++ & ( 0xFF00U >> w ) ) );
-
- /* all bits read and there are `x_pos + w' bits to be written */
-
- pwrite[0] = (FT_Byte)( pwrite[0] | ( wval >> x_pos ) );
-
- if ( x_pos + w > 8 )
- {
- pwrite++;
- wval <<= 8;
- pwrite[0] = (FT_Byte)( pwrite[0] | ( wval >> x_pos ) );
- }
- }
- }
-
- Exit:
- if ( !error )
- FT_TRACE3(( "tt_sbit_decoder_load_byte_aligned: loaded\n" ));
- return error;
- }
-
-
- /*
- * Load a bit-aligned bitmap (with pointer `p') into a line-aligned bitmap
- * (with pointer `pwrite'). In the example below, the width is 3 pixel,
- * and `x_pos' is 1 pixel.
- *
- * p p+1
- * | | |
- * | 7 6 5 4 3 2 1 0 | 7 6 5 4 3 2 1 0 |...
- * | | |
- * +-------+ +-------+ +-------+ ...
- * . . .
- * . . .
- * v . .
- * +-------+ . .
- * | | .
- * | 7 6 5 4 3 2 1 0 | .
- * | | .
- * pwrite . .
- * . .
- * v .
- * +-------+ .
- * | |
- * | 7 6 5 4 3 2 1 0 |
- * | |
- * pwrite+1 .
- * .
- * v
- * +-------+
- * | |
- * | 7 6 5 4 3 2 1 0 |
- * | |
- * pwrite+2
- *
- */
-
- static FT_Error
- tt_sbit_decoder_load_bit_aligned( TT_SBitDecoder decoder,
- FT_Byte* p,
- FT_Byte* limit,
- FT_Int x_pos,
- FT_Int y_pos )
- {
- FT_Error error = FT_Err_Ok;
- FT_Byte* line;
- FT_Int pitch, width, height, line_bits, h, nbits;
- FT_UInt bit_height, bit_width;
- FT_Bitmap* bitmap;
- FT_UShort rval;
-
-
- /* check that we can write the glyph into the bitmap */
- bitmap = decoder->bitmap;
- bit_width = bitmap->width;
- bit_height = bitmap->rows;
- pitch = bitmap->pitch;
- line = bitmap->buffer;
-
- width = decoder->metrics->width;
- height = decoder->metrics->height;
-
- line_bits = width * decoder->bit_depth;
-
- if ( x_pos < 0 || (FT_UInt)( x_pos + width ) > bit_width ||
- y_pos < 0 || (FT_UInt)( y_pos + height ) > bit_height )
- {
- FT_TRACE1(( "tt_sbit_decoder_load_bit_aligned:"
- " invalid bitmap dimensions\n" ));
- error = FT_THROW( Invalid_File_Format );
- goto Exit;
- }
-
- if ( p + ( ( line_bits * height + 7 ) >> 3 ) > limit )
- {
- FT_TRACE1(( "tt_sbit_decoder_load_bit_aligned: broken bitmap\n" ));
- error = FT_THROW( Invalid_File_Format );
- goto Exit;
- }
-
- /* now do the blit */
-
- /* adjust `line' to point to the first byte of the bitmap */
- line += y_pos * pitch + ( x_pos >> 3 );
- x_pos &= 7;
-
- /* the higher byte of `rval' is used as a buffer */
- rval = 0;
- nbits = 0;
-
- for ( h = height; h > 0; h--, line += pitch )
- {
- FT_Byte* pwrite = line;
- FT_Int w = line_bits;
-
-
- /* handle initial byte (in target bitmap) specially if necessary */
- if ( x_pos )
- {
- w = ( line_bits < 8 - x_pos ) ? line_bits : 8 - x_pos;
-
- if ( h == height )
- {
- rval = *p++;
- nbits = x_pos;
- }
- else if ( nbits < w )
- {
- if ( p < limit )
- rval |= *p++;
- nbits += 8 - w;
- }
- else
- {
- rval >>= 8;
- nbits -= w;
- }
-
- *pwrite++ |= ( ( rval >> nbits ) & 0xFF ) &
- ( ~( 0xFF << w ) << ( 8 - w - x_pos ) );
- rval <<= 8;
-
- w = line_bits - w;
- }
-
- /* handle medial bytes */
- for ( ; w >= 8; w -= 8 )
- {
- rval |= *p++;
- *pwrite++ |= ( rval >> nbits ) & 0xFF;
-
- rval <<= 8;
- }
-
- /* handle final byte if necessary */
- if ( w > 0 )
- {
- if ( nbits < w )
- {
- if ( p < limit )
- rval |= *p++;
- *pwrite |= ( ( rval >> nbits ) & 0xFF ) & ( 0xFF00U >> w );
- nbits += 8 - w;
-
- rval <<= 8;
- }
- else
- {
- *pwrite |= ( ( rval >> nbits ) & 0xFF ) & ( 0xFF00U >> w );
- nbits -= w;
- }
- }
- }
-
- Exit:
- if ( !error )
- FT_TRACE3(( "tt_sbit_decoder_load_bit_aligned: loaded\n" ));
- return error;
- }
-
-
- static FT_Error
- tt_sbit_decoder_load_compound( TT_SBitDecoder decoder,
- FT_Byte* p,
- FT_Byte* limit,
- FT_Int x_pos,
- FT_Int y_pos )
- {
- FT_Error error = FT_Err_Ok;
- FT_UInt num_components, nn;
-
- FT_Char horiBearingX = (FT_Char)decoder->metrics->horiBearingX;
- FT_Char horiBearingY = (FT_Char)decoder->metrics->horiBearingY;
- FT_Byte horiAdvance = (FT_Byte)decoder->metrics->horiAdvance;
- FT_Char vertBearingX = (FT_Char)decoder->metrics->vertBearingX;
- FT_Char vertBearingY = (FT_Char)decoder->metrics->vertBearingY;
- FT_Byte vertAdvance = (FT_Byte)decoder->metrics->vertAdvance;
-
-
- if ( p + 2 > limit )
- goto Fail;
-
- num_components = FT_NEXT_USHORT( p );
- if ( p + 4 * num_components > limit )
- {
- FT_TRACE1(( "tt_sbit_decoder_load_compound: broken table\n" ));
- goto Fail;
- }
-
- FT_TRACE3(( "tt_sbit_decoder_load_compound: loading %d components\n",
- num_components ));
-
- for ( nn = 0; nn < num_components; nn++ )
- {
- FT_UInt gindex = FT_NEXT_USHORT( p );
- FT_Byte dx = FT_NEXT_BYTE( p );
- FT_Byte dy = FT_NEXT_BYTE( p );
-
-
- /* NB: a recursive call */
- error = tt_sbit_decoder_load_image( decoder, gindex,
- x_pos + dx, y_pos + dy );
- if ( error )
- break;
- }
-
- FT_TRACE3(( "tt_sbit_decoder_load_compound: done\n" ));
-
- decoder->metrics->horiBearingX = horiBearingX;
- decoder->metrics->horiBearingY = horiBearingY;
- decoder->metrics->horiAdvance = horiAdvance;
- decoder->metrics->vertBearingX = vertBearingX;
- decoder->metrics->vertBearingY = vertBearingY;
- decoder->metrics->vertAdvance = vertAdvance;
- decoder->metrics->width = (FT_Byte)decoder->bitmap->width;
- decoder->metrics->height = (FT_Byte)decoder->bitmap->rows;
-
- Exit:
- return error;
-
- Fail:
- error = FT_THROW( Invalid_File_Format );
- goto Exit;
- }
-
-
-#ifdef FT_CONFIG_OPTION_USE_PNG
-
- static FT_Error
- tt_sbit_decoder_load_png( TT_SBitDecoder decoder,
- FT_Byte* p,
- FT_Byte* limit,
- FT_Int x_pos,
- FT_Int y_pos )
- {
- FT_Error error = FT_Err_Ok;
- FT_ULong png_len;
-
-
- if ( limit - p < 4 )
- {
- FT_TRACE1(( "tt_sbit_decoder_load_png: broken bitmap\n" ));
- error = FT_THROW( Invalid_File_Format );
- goto Exit;
- }
-
- png_len = FT_NEXT_ULONG( p );
- if ( (FT_ULong)( limit - p ) < png_len )
- {
- FT_TRACE1(( "tt_sbit_decoder_load_png: broken bitmap\n" ));
- error = FT_THROW( Invalid_File_Format );
- goto Exit;
- }
-
- error = Load_SBit_Png( decoder->face->root.glyph,
- x_pos,
- y_pos,
- decoder->bit_depth,
- decoder->metrics,
- decoder->stream->memory,
- p,
- png_len,
- FALSE );
-
- Exit:
- if ( !error )
- FT_TRACE3(( "tt_sbit_decoder_load_png: loaded\n" ));
- return error;
- }
-
-#endif /* FT_CONFIG_OPTION_USE_PNG */
-
-
- static FT_Error
- tt_sbit_decoder_load_bitmap( TT_SBitDecoder decoder,
- FT_UInt glyph_format,
- FT_ULong glyph_start,
- FT_ULong glyph_size,
- FT_Int x_pos,
- FT_Int y_pos )
- {
- FT_Error error;
- FT_Stream stream = decoder->stream;
- FT_Byte* p;
- FT_Byte* p_limit;
- FT_Byte* data;
-
-
- /* seek into the EBDT table now */
- if ( glyph_start + glyph_size > decoder->ebdt_size )
- {
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- if ( FT_STREAM_SEEK( decoder->ebdt_start + glyph_start ) ||
- FT_FRAME_EXTRACT( glyph_size, data ) )
- goto Exit;
-
- p = data;
- p_limit = p + glyph_size;
-
- /* read the data, depending on the glyph format */
- switch ( glyph_format )
- {
- case 1:
- case 2:
- case 8:
- case 17:
- error = tt_sbit_decoder_load_metrics( decoder, &p, p_limit, 0 );
- break;
-
- case 6:
- case 7:
- case 9:
- case 18:
- error = tt_sbit_decoder_load_metrics( decoder, &p, p_limit, 1 );
- break;
-
- default:
- error = FT_Err_Ok;
- }
-
- if ( error )
- goto Fail;
-
- {
- TT_SBitDecoder_LoadFunc loader;
-
-
- switch ( glyph_format )
- {
- case 1:
- case 6:
- loader = tt_sbit_decoder_load_byte_aligned;
- break;
-
- case 2:
- case 7:
- {
- /* Don't trust `glyph_format'. For example, Apple's main Korean */
- /* system font, `AppleMyungJo.ttf' (version 7.0d2e6), uses glyph */
- /* format 7, but the data is format 6. We check whether we have */
- /* an excessive number of bytes in the image: If it is equal to */
- /* the value for a byte-aligned glyph, use the other loading */
- /* routine. */
- /* */
- /* Note that for some (width,height) combinations, where the */
- /* width is not a multiple of 8, the sizes for bit- and */
- /* byte-aligned data are equal, for example (7,7) or (15,6). We */
- /* then prefer what `glyph_format' specifies. */
-
- FT_UInt width = decoder->metrics->width;
- FT_UInt height = decoder->metrics->height;
-
- FT_UInt bit_size = ( width * height + 7 ) >> 3;
- FT_UInt byte_size = height * ( ( width + 7 ) >> 3 );
-
-
- if ( bit_size < byte_size &&
- byte_size == (FT_UInt)( p_limit - p ) )
- loader = tt_sbit_decoder_load_byte_aligned;
- else
- loader = tt_sbit_decoder_load_bit_aligned;
- }
- break;
-
- case 5:
- loader = tt_sbit_decoder_load_bit_aligned;
- break;
-
- case 8:
- if ( p + 1 > p_limit )
- goto Fail;
-
- p += 1; /* skip padding */
- /* fall-through */
-
- case 9:
- loader = tt_sbit_decoder_load_compound;
- break;
-
- case 17: /* small metrics, PNG image data */
- case 18: /* big metrics, PNG image data */
- case 19: /* metrics in EBLC, PNG image data */
-#ifdef FT_CONFIG_OPTION_USE_PNG
- loader = tt_sbit_decoder_load_png;
- break;
-#else
- error = FT_THROW( Unimplemented_Feature );
- goto Fail;
-#endif /* FT_CONFIG_OPTION_USE_PNG */
-
- default:
- error = FT_THROW( Invalid_Table );
- goto Fail;
- }
-
- if ( !decoder->bitmap_allocated )
- {
- error = tt_sbit_decoder_alloc_bitmap( decoder );
- if ( error )
- goto Fail;
- }
-
- error = loader( decoder, p, p_limit, x_pos, y_pos );
- }
-
- Fail:
- FT_FRAME_RELEASE( data );
-
- Exit:
- return error;
- }
-
-
- static FT_Error
- tt_sbit_decoder_load_image( TT_SBitDecoder decoder,
- FT_UInt glyph_index,
- FT_Int x_pos,
- FT_Int y_pos )
- {
- /*
- * First, we find the correct strike range that applies to this
- * glyph index.
- */
-
- FT_Byte* p = decoder->eblc_base + decoder->strike_index_array;
- FT_Byte* p_limit = decoder->eblc_limit;
- FT_ULong num_ranges = decoder->strike_index_count;
- FT_UInt start, end, index_format, image_format;
- FT_ULong image_start = 0, image_end = 0, image_offset;
-
-
- for ( ; num_ranges > 0; num_ranges-- )
- {
- start = FT_NEXT_USHORT( p );
- end = FT_NEXT_USHORT( p );
-
- if ( glyph_index >= start && glyph_index <= end )
- goto FoundRange;
-
- p += 4; /* ignore index offset */
- }
- goto NoBitmap;
-
- FoundRange:
- image_offset = FT_NEXT_ULONG( p );
-
- /* overflow check */
- p = decoder->eblc_base + decoder->strike_index_array;
- if ( image_offset > (FT_ULong)( p_limit - p ) )
- goto Failure;
-
- p += image_offset;
- if ( p + 8 > p_limit )
- goto NoBitmap;
-
- /* now find the glyph's location and extend within the ebdt table */
- index_format = FT_NEXT_USHORT( p );
- image_format = FT_NEXT_USHORT( p );
- image_offset = FT_NEXT_ULONG ( p );
-
- switch ( index_format )
- {
- case 1: /* 4-byte offsets relative to `image_offset' */
- p += 4 * ( glyph_index - start );
- if ( p + 8 > p_limit )
- goto NoBitmap;
-
- image_start = FT_NEXT_ULONG( p );
- image_end = FT_NEXT_ULONG( p );
-
- if ( image_start == image_end ) /* missing glyph */
- goto NoBitmap;
- break;
-
- case 2: /* big metrics, constant image size */
- {
- FT_ULong image_size;
-
-
- if ( p + 12 > p_limit )
- goto NoBitmap;
-
- image_size = FT_NEXT_ULONG( p );
-
- if ( tt_sbit_decoder_load_metrics( decoder, &p, p_limit, 1 ) )
- goto NoBitmap;
-
- image_start = image_size * ( glyph_index - start );
- image_end = image_start + image_size;
- }
- break;
-
- case 3: /* 2-byte offsets relative to 'image_offset' */
- p += 2 * ( glyph_index - start );
- if ( p + 4 > p_limit )
- goto NoBitmap;
-
- image_start = FT_NEXT_USHORT( p );
- image_end = FT_NEXT_USHORT( p );
-
- if ( image_start == image_end ) /* missing glyph */
- goto NoBitmap;
- break;
-
- case 4: /* sparse glyph array with (glyph,offset) pairs */
- {
- FT_ULong mm, num_glyphs;
-
-
- if ( p + 4 > p_limit )
- goto NoBitmap;
-
- num_glyphs = FT_NEXT_ULONG( p );
-
- /* overflow check for p + ( num_glyphs + 1 ) * 4 */
- if ( p + 4 > p_limit ||
- num_glyphs > (FT_ULong)( ( ( p_limit - p ) >> 2 ) - 1 ) )
- goto NoBitmap;
-
- for ( mm = 0; mm < num_glyphs; mm++ )
- {
- FT_UInt gindex = FT_NEXT_USHORT( p );
-
-
- if ( gindex == glyph_index )
- {
- image_start = FT_NEXT_USHORT( p );
- p += 2;
- image_end = FT_PEEK_USHORT( p );
- break;
- }
- p += 2;
- }
-
- if ( mm >= num_glyphs )
- goto NoBitmap;
- }
- break;
-
- case 5: /* constant metrics with sparse glyph codes */
- case 19:
- {
- FT_ULong image_size, mm, num_glyphs;
-
-
- if ( p + 16 > p_limit )
- goto NoBitmap;
-
- image_size = FT_NEXT_ULONG( p );
-
- if ( tt_sbit_decoder_load_metrics( decoder, &p, p_limit, 1 ) )
- goto NoBitmap;
-
- num_glyphs = FT_NEXT_ULONG( p );
-
- /* overflow check for p + 2 * num_glyphs */
- if ( num_glyphs > (FT_ULong)( ( p_limit - p ) >> 1 ) )
- goto NoBitmap;
-
- for ( mm = 0; mm < num_glyphs; mm++ )
- {
- FT_UInt gindex = FT_NEXT_USHORT( p );
-
-
- if ( gindex == glyph_index )
- break;
- }
-
- if ( mm >= num_glyphs )
- goto NoBitmap;
-
- image_start = image_size * mm;
- image_end = image_start + image_size;
- }
- break;
-
- default:
- goto NoBitmap;
- }
-
- if ( image_start > image_end )
- goto NoBitmap;
-
- image_end -= image_start;
- image_start = image_offset + image_start;
-
- FT_TRACE3(( "tt_sbit_decoder_load_image:"
- " found sbit (format %d) for glyph index %d\n",
- image_format, glyph_index ));
-
- return tt_sbit_decoder_load_bitmap( decoder,
- image_format,
- image_start,
- image_end,
- x_pos,
- y_pos );
-
- Failure:
- return FT_THROW( Invalid_Table );
-
- NoBitmap:
- FT_TRACE4(( "tt_sbit_decoder_load_image:"
- " no sbit found for glyph index %d\n", glyph_index ));
-
- return FT_THROW( Invalid_Argument );
- }
-
-
- static FT_Error
- tt_face_load_sbix_image( TT_Face face,
- FT_ULong strike_index,
- FT_UInt glyph_index,
- FT_Stream stream,
- FT_Bitmap *map,
- TT_SBit_MetricsRec *metrics )
- {
- FT_UInt sbix_pos, strike_offset, glyph_start, glyph_end;
- FT_ULong table_size;
- FT_Int originOffsetX, originOffsetY;
- FT_Tag graphicType;
- FT_Int recurse_depth = 0;
-
- FT_Error error;
- FT_Byte* p;
-
- FT_UNUSED( map );
-
-
- metrics->width = 0;
- metrics->height = 0;
-
- p = face->sbit_table + 8 + 4 * strike_index;
- strike_offset = FT_NEXT_ULONG( p );
-
- error = face->goto_table( face, TTAG_sbix, stream, &table_size );
- if ( error )
- return error;
- sbix_pos = FT_STREAM_POS();
-
- retry:
- if ( glyph_index > (FT_UInt)face->root.num_glyphs )
- return FT_THROW( Invalid_Argument );
-
- if ( strike_offset >= table_size ||
- table_size - strike_offset < 4 + glyph_index * 4 + 8 )
- return FT_THROW( Invalid_File_Format );
-
- if ( FT_STREAM_SEEK( sbix_pos + strike_offset + 4 + glyph_index * 4 ) ||
- FT_FRAME_ENTER( 8 ) )
- return error;
-
- glyph_start = FT_GET_ULONG();
- glyph_end = FT_GET_ULONG();
-
- FT_FRAME_EXIT();
-
- if ( glyph_start == glyph_end )
- return FT_THROW( Invalid_Argument );
- if ( glyph_start > glyph_end ||
- glyph_end - glyph_start < 8 ||
- table_size - strike_offset < glyph_end )
- return FT_THROW( Invalid_File_Format );
-
- if ( FT_STREAM_SEEK( sbix_pos + strike_offset + glyph_start ) ||
- FT_FRAME_ENTER( glyph_end - glyph_start ) )
- return error;
-
- originOffsetX = FT_GET_SHORT();
- originOffsetY = FT_GET_SHORT();
-
- graphicType = FT_GET_TAG4();
-
- switch ( graphicType )
- {
- case FT_MAKE_TAG( 'd', 'u', 'p', 'e' ):
- if ( recurse_depth < 4 )
- {
- glyph_index = FT_GET_USHORT();
- FT_FRAME_EXIT();
- recurse_depth++;
- goto retry;
- }
- error = FT_THROW( Invalid_File_Format );
- break;
-
- case FT_MAKE_TAG( 'p', 'n', 'g', ' ' ):
-#ifdef FT_CONFIG_OPTION_USE_PNG
- error = Load_SBit_Png( face->root.glyph,
- 0,
- 0,
- 32,
- metrics,
- stream->memory,
- stream->cursor,
- glyph_end - glyph_start - 8,
- TRUE );
-#else
- error = FT_THROW( Unimplemented_Feature );
-#endif
- break;
-
- case FT_MAKE_TAG( 'j', 'p', 'g', ' ' ):
- case FT_MAKE_TAG( 't', 'i', 'f', 'f' ):
- case FT_MAKE_TAG( 'r', 'g', 'b', 'l' ): /* used on iOS 7.1 */
- error = FT_THROW( Unknown_File_Format );
- break;
-
- default:
- error = FT_THROW( Unimplemented_Feature );
- break;
- }
-
- FT_FRAME_EXIT();
-
- if ( !error )
- {
- FT_Short abearing;
- FT_UShort aadvance;
-
-
- tt_face_get_metrics( face, FALSE, glyph_index, &abearing, &aadvance );
-
- metrics->horiBearingX = (FT_Short)originOffsetX;
- metrics->horiBearingY = (FT_Short)( -originOffsetY + metrics->height );
- metrics->horiAdvance = (FT_UShort)( aadvance *
- face->root.size->metrics.x_ppem /
- face->header.Units_Per_EM );
- }
-
- return error;
- }
-
- FT_LOCAL( FT_Error )
- tt_face_load_sbit_image( TT_Face face,
- FT_ULong strike_index,
- FT_UInt glyph_index,
- FT_UInt load_flags,
- FT_Stream stream,
- FT_Bitmap *map,
- TT_SBit_MetricsRec *metrics )
- {
- FT_Error error = FT_Err_Ok;
-
-
- switch ( (FT_UInt)face->sbit_table_type )
- {
- case TT_SBIT_TABLE_TYPE_EBLC:
- case TT_SBIT_TABLE_TYPE_CBLC:
- {
- TT_SBitDecoderRec decoder[1];
-
-
- error = tt_sbit_decoder_init( decoder, face, strike_index, metrics );
- if ( !error )
- {
- error = tt_sbit_decoder_load_image( decoder,
- glyph_index,
- 0,
- 0 );
- tt_sbit_decoder_done( decoder );
- }
- }
- break;
-
- case TT_SBIT_TABLE_TYPE_SBIX:
- error = tt_face_load_sbix_image( face,
- strike_index,
- glyph_index,
- stream,
- map,
- metrics );
- break;
-
- default:
- error = FT_THROW( Unknown_File_Format );
- break;
- }
-
- /* Flatten color bitmaps if color was not requested. */
- if ( !error &&
- !( load_flags & FT_LOAD_COLOR ) &&
- map->pixel_mode == FT_PIXEL_MODE_BGRA )
- {
- FT_Bitmap new_map;
- FT_Library library = face->root.glyph->library;
-
-
- FT_Bitmap_Init( &new_map );
-
- /* Convert to 8bit grayscale. */
- error = FT_Bitmap_Convert( library, map, &new_map, 1 );
- if ( error )
- FT_Bitmap_Done( library, &new_map );
- else
- {
- map->pixel_mode = new_map.pixel_mode;
- map->pitch = new_map.pitch;
- map->num_grays = new_map.num_grays;
-
- ft_glyphslot_set_bitmap( face->root.glyph, new_map.buffer );
- face->root.glyph->internal->flags |= FT_GLYPH_OWN_BITMAP;
- }
- }
-
- return error;
- }
-
-
-/* EOF */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/sfnt/ttsbit.h b/chromium/third_party/pdfium/third_party/freetype/src/sfnt/ttsbit.h
deleted file mode 100644
index d4e13aefb8d..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/sfnt/ttsbit.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/***************************************************************************/
-/* */
-/* ttsbit.h */
-/* */
-/* TrueType and OpenType embedded bitmap support (specification). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __TTSBIT_H__
-#define __TTSBIT_H__
-
-
-#include <ft2build.h>
-#include "ttload.h"
-
-
-FT_BEGIN_HEADER
-
-
- FT_LOCAL( FT_Error )
- tt_face_load_sbit( TT_Face face,
- FT_Stream stream );
-
- FT_LOCAL( void )
- tt_face_free_sbit( TT_Face face );
-
-
- FT_LOCAL( FT_Error )
- tt_face_set_sbit_strike( TT_Face face,
- FT_Size_Request req,
- FT_ULong* astrike_index );
-
- FT_LOCAL( FT_Error )
- tt_face_load_strike_metrics( TT_Face face,
- FT_ULong strike_index,
- FT_Size_Metrics* metrics );
-
- FT_LOCAL( FT_Error )
- tt_face_load_sbit_image( TT_Face face,
- FT_ULong strike_index,
- FT_UInt glyph_index,
- FT_UInt load_flags,
- FT_Stream stream,
- FT_Bitmap *map,
- TT_SBit_MetricsRec *metrics );
-
-
-FT_END_HEADER
-
-#endif /* __TTSBIT_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/smooth/Jamfile b/chromium/third_party/pdfium/third_party/freetype/src/smooth/Jamfile
deleted file mode 100644
index b1887c2c6ef..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/smooth/Jamfile
+++ /dev/null
@@ -1,32 +0,0 @@
-# FreeType 2 src/smooth Jamfile
-#
-# Copyright 2001-2015 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT. By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-SubDir FT2_TOP $(FT2_SRC_DIR) smooth ;
-
-{
- local _sources ;
-
- if $(FT2_MULTI)
- {
- _sources = ftgrays
- ftsmooth
- ftspic
- ;
- }
- else
- {
- _sources = smooth ;
- }
-
- Library $(FT2_LIB) : $(_sources).c ;
-}
-
-# end of src/smooth Jamfile
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/smooth/ftgrays.c b/chromium/third_party/pdfium/third_party/freetype/src/smooth/ftgrays.c
deleted file mode 100644
index ba2944559c3..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/smooth/ftgrays.c
+++ /dev/null
@@ -1,2116 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftgrays.c */
-/* */
-/* A new `perfect' anti-aliasing renderer (body). */
-/* */
-/* Copyright 2000-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
- /*************************************************************************/
- /* */
- /* This file can be compiled without the rest of the FreeType engine, by */
- /* defining the _STANDALONE_ macro when compiling it. You also need to */
- /* put the files `ftgrays.h' and `ftimage.h' into the current */
- /* compilation directory. Typically, you could do something like */
- /* */
- /* - copy `src/smooth/ftgrays.c' (this file) to your current directory */
- /* */
- /* - copy `include/freetype/ftimage.h' and `src/smooth/ftgrays.h' to the */
- /* same directory */
- /* */
- /* - compile `ftgrays' with the _STANDALONE_ macro defined, as in */
- /* */
- /* cc -c -D_STANDALONE_ ftgrays.c */
- /* */
- /* The renderer can be initialized with a call to */
- /* `ft_gray_raster.raster_new'; an anti-aliased bitmap can be generated */
- /* with a call to `ft_gray_raster.raster_render'. */
- /* */
- /* See the comments and documentation in the file `ftimage.h' for more */
- /* details on how the raster works. */
- /* */
- /*************************************************************************/
-
- /*************************************************************************/
- /* */
- /* This is a new anti-aliasing scan-converter for FreeType 2. The */
- /* algorithm used here is _very_ different from the one in the standard */
- /* `ftraster' module. Actually, `ftgrays' computes the _exact_ */
- /* coverage of the outline on each pixel cell. */
- /* */
- /* It is based on ideas that I initially found in Raph Levien's */
- /* excellent LibArt graphics library (see http://www.levien.com/libart */
- /* for more information, though the web pages do not tell anything */
- /* about the renderer; you'll have to dive into the source code to */
- /* understand how it works). */
- /* */
- /* Note, however, that this is a _very_ different implementation */
- /* compared to Raph's. Coverage information is stored in a very */
- /* different way, and I don't use sorted vector paths. Also, it doesn't */
- /* use floating point values. */
- /* */
- /* This renderer has the following advantages: */
- /* */
- /* - It doesn't need an intermediate bitmap. Instead, one can supply a */
- /* callback function that will be called by the renderer to draw gray */
- /* spans on any target surface. You can thus do direct composition on */
- /* any kind of bitmap, provided that you give the renderer the right */
- /* callback. */
- /* */
- /* - A perfect anti-aliaser, i.e., it computes the _exact_ coverage on */
- /* each pixel cell. */
- /* */
- /* - It performs a single pass on the outline (the `standard' FT2 */
- /* renderer makes two passes). */
- /* */
- /* - It can easily be modified to render to _any_ number of gray levels */
- /* cheaply. */
- /* */
- /* - For small (< 20) pixel sizes, it is faster than the standard */
- /* renderer. */
- /* */
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
- /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
- /* messages during execution. */
- /* */
-#undef FT_COMPONENT
-#define FT_COMPONENT trace_smooth
-
-
-#ifdef _STANDALONE_
-
-
- /* The size in bytes of the render pool used by the scan-line converter */
- /* to do all of its work. */
-#define FT_RENDER_POOL_SIZE 16384L
-
-
- /* Auxiliary macros for token concatenation. */
-#define FT_ERR_XCAT( x, y ) x ## y
-#define FT_ERR_CAT( x, y ) FT_ERR_XCAT( x, y )
-
-#define FT_BEGIN_STMNT do {
-#define FT_END_STMNT } while ( 0 )
-
-#define FT_MAX( a, b ) ( (a) > (b) ? (a) : (b) )
-#define FT_ABS( a ) ( (a) < 0 ? -(a) : (a) )
-
-
- /*
- * Approximate sqrt(x*x+y*y) using the `alpha max plus beta min'
- * algorithm. We use alpha = 1, beta = 3/8, giving us results with a
- * largest error less than 7% compared to the exact value.
- */
-#define FT_HYPOT( x, y ) \
- ( x = FT_ABS( x ), \
- y = FT_ABS( y ), \
- x > y ? x + ( 3 * y >> 3 ) \
- : y + ( 3 * x >> 3 ) )
-
-
- /* define this to dump debugging information */
-/* #define FT_DEBUG_LEVEL_TRACE */
-
-
-#ifdef FT_DEBUG_LEVEL_TRACE
-#include <stdio.h>
-#include <stdarg.h>
-#endif
-
-#include <stddef.h>
-#include <string.h>
-#include <setjmp.h>
-#include <limits.h>
-#define FT_UINT_MAX UINT_MAX
-#define FT_INT_MAX INT_MAX
-
-#define ft_memset memset
-
-#define ft_setjmp setjmp
-#define ft_longjmp longjmp
-#define ft_jmp_buf jmp_buf
-
-typedef ptrdiff_t FT_PtrDist;
-
-
-#define ErrRaster_Invalid_Mode -2
-#define ErrRaster_Invalid_Outline -1
-#define ErrRaster_Invalid_Argument -3
-#define ErrRaster_Memory_Overflow -4
-
-#define FT_BEGIN_HEADER
-#define FT_END_HEADER
-
-#include "ftimage.h"
-#include "ftgrays.h"
-
-
- /* This macro is used to indicate that a function parameter is unused. */
- /* Its purpose is simply to reduce compiler warnings. Note also that */
- /* simply defining it as `(void)x' doesn't avoid warnings with certain */
- /* ANSI compilers (e.g. LCC). */
-#define FT_UNUSED( x ) (x) = (x)
-
-
- /* we only use level 5 & 7 tracing messages; cf. ftdebug.h */
-
-#ifdef FT_DEBUG_LEVEL_TRACE
-
- void
- FT_Message( const char* fmt,
- ... )
- {
- va_list ap;
-
-
- va_start( ap, fmt );
- vfprintf( stderr, fmt, ap );
- va_end( ap );
- }
-
-
- /* empty function useful for setting a breakpoint to catch errors */
- int
- FT_Throw( int error,
- int line,
- const char* file )
- {
- FT_UNUSED( error );
- FT_UNUSED( line );
- FT_UNUSED( file );
-
- return 0;
- }
-
-
- /* we don't handle tracing levels in stand-alone mode; */
-#ifndef FT_TRACE5
-#define FT_TRACE5( varformat ) FT_Message varformat
-#endif
-#ifndef FT_TRACE7
-#define FT_TRACE7( varformat ) FT_Message varformat
-#endif
-#ifndef FT_ERROR
-#define FT_ERROR( varformat ) FT_Message varformat
-#endif
-
-#define FT_THROW( e ) \
- ( FT_Throw( FT_ERR_CAT( ErrRaster, e ), \
- __LINE__, \
- __FILE__ ) | \
- FT_ERR_CAT( ErrRaster, e ) )
-
-#else /* !FT_DEBUG_LEVEL_TRACE */
-
-#define FT_TRACE5( x ) do { } while ( 0 ) /* nothing */
-#define FT_TRACE7( x ) do { } while ( 0 ) /* nothing */
-#define FT_ERROR( x ) do { } while ( 0 ) /* nothing */
-#define FT_THROW( e ) FT_ERR_CAT( ErrRaster_, e )
-
-
-#endif /* !FT_DEBUG_LEVEL_TRACE */
-
-
-#define FT_DEFINE_OUTLINE_FUNCS( class_, \
- move_to_, line_to_, \
- conic_to_, cubic_to_, \
- shift_, delta_ ) \
- static const FT_Outline_Funcs class_ = \
- { \
- move_to_, \
- line_to_, \
- conic_to_, \
- cubic_to_, \
- shift_, \
- delta_ \
- };
-
-#define FT_DEFINE_RASTER_FUNCS( class_, glyph_format_, \
- raster_new_, raster_reset_, \
- raster_set_mode_, raster_render_, \
- raster_done_ ) \
- const FT_Raster_Funcs class_ = \
- { \
- glyph_format_, \
- raster_new_, \
- raster_reset_, \
- raster_set_mode_, \
- raster_render_, \
- raster_done_ \
- };
-
-
-#else /* !_STANDALONE_ */
-
-
-#include <ft2build.h>
-#include "ftgrays.h"
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_OUTLINE_H
-
-#include "ftsmerrs.h"
-
-#include "ftspic.h"
-
-#define Smooth_Err_Invalid_Mode Smooth_Err_Cannot_Render_Glyph
-#define Smooth_Err_Memory_Overflow Smooth_Err_Out_Of_Memory
-#define ErrRaster_Memory_Overflow Smooth_Err_Out_Of_Memory
-
-
-#endif /* !_STANDALONE_ */
-
-
-#ifndef FT_MEM_SET
-#define FT_MEM_SET( d, s, c ) ft_memset( d, s, c )
-#endif
-
-#ifndef FT_MEM_ZERO
-#define FT_MEM_ZERO( dest, count ) FT_MEM_SET( dest, 0, count )
-#endif
-
- /* as usual, for the speed hungry :-) */
-
-#undef RAS_ARG
-#undef RAS_ARG_
-#undef RAS_VAR
-#undef RAS_VAR_
-
-#ifndef FT_STATIC_RASTER
-
-#define RAS_ARG gray_PWorker worker
-#define RAS_ARG_ gray_PWorker worker,
-
-#define RAS_VAR worker
-#define RAS_VAR_ worker,
-
-#else /* FT_STATIC_RASTER */
-
-#define RAS_ARG /* empty */
-#define RAS_ARG_ /* empty */
-#define RAS_VAR /* empty */
-#define RAS_VAR_ /* empty */
-
-#endif /* FT_STATIC_RASTER */
-
-
- /* must be at least 6 bits! */
-#define PIXEL_BITS 8
-
-#undef FLOOR
-#undef CEILING
-#undef TRUNC
-#undef SCALED
-
-#define ONE_PIXEL ( 1L << PIXEL_BITS )
-#define TRUNC( x ) ( (TCoord)( (x) >> PIXEL_BITS ) )
-#define SUBPIXELS( x ) ( (TPos)(x) << PIXEL_BITS )
-#define FLOOR( x ) ( (x) & -ONE_PIXEL )
-#define CEILING( x ) ( ( (x) + ONE_PIXEL - 1 ) & -ONE_PIXEL )
-#define ROUND( x ) ( ( (x) + ONE_PIXEL / 2 ) & -ONE_PIXEL )
-
-#if PIXEL_BITS >= 6
-#define UPSCALE( x ) ( (x) << ( PIXEL_BITS - 6 ) )
-#define DOWNSCALE( x ) ( (x) >> ( PIXEL_BITS - 6 ) )
-#else
-#define UPSCALE( x ) ( (x) >> ( 6 - PIXEL_BITS ) )
-#define DOWNSCALE( x ) ( (x) << ( 6 - PIXEL_BITS ) )
-#endif
-
-
- /* Compute `dividend / divisor' and return both its quotient and */
- /* remainder, cast to a specific type. This macro also ensures that */
- /* the remainder is always positive. */
-#define FT_DIV_MOD( type, dividend, divisor, quotient, remainder ) \
- FT_BEGIN_STMNT \
- (quotient) = (type)( (dividend) / (divisor) ); \
- (remainder) = (type)( (dividend) % (divisor) ); \
- if ( (remainder) < 0 ) \
- { \
- (quotient)--; \
- (remainder) += (type)(divisor); \
- } \
- FT_END_STMNT
-
-#ifdef __arm__
- /* Work around a bug specific to GCC which make the compiler fail to */
- /* optimize a division and modulo operation on the same parameters */
- /* into a single call to `__aeabi_idivmod'. See */
- /* */
- /* http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43721 */
-#undef FT_DIV_MOD
-#define FT_DIV_MOD( type, dividend, divisor, quotient, remainder ) \
- FT_BEGIN_STMNT \
- (quotient) = (type)( (dividend) / (divisor) ); \
- (remainder) = (type)( (dividend) - (quotient) * (divisor) ); \
- if ( (remainder) < 0 ) \
- { \
- (quotient)--; \
- (remainder) += (type)(divisor); \
- } \
- FT_END_STMNT
-#endif /* __arm__ */
-
-
- /*************************************************************************/
- /* */
- /* TYPE DEFINITIONS */
- /* */
-
- /* don't change the following types to FT_Int or FT_Pos, since we might */
- /* need to define them to "float" or "double" when experimenting with */
- /* new algorithms */
-
- typedef long TCoord; /* integer scanline/pixel coordinate */
- typedef long TPos; /* sub-pixel coordinate */
-
- /* determine the type used to store cell areas. This normally takes at */
- /* least PIXEL_BITS*2 + 1 bits. On 16-bit systems, we need to use */
- /* `long' instead of `int', otherwise bad things happen */
-
-#if PIXEL_BITS <= 7
-
- typedef int TArea;
-
-#else /* PIXEL_BITS >= 8 */
-
- /* approximately determine the size of integers using an ANSI-C header */
-#if FT_UINT_MAX == 0xFFFFU
- typedef long TArea;
-#else
- typedef int TArea;
-#endif
-
-#endif /* PIXEL_BITS >= 8 */
-
-
- /* maximum number of gray spans in a call to the span callback */
-#define FT_MAX_GRAY_SPANS 32
-
-
- typedef struct TCell_* PCell;
-
- typedef struct TCell_
- {
- TPos x; /* same with gray_TWorker.ex */
- TCoord cover; /* same with gray_TWorker.cover */
- TArea area;
- PCell next;
-
- } TCell;
-
-
-#if defined( _MSC_VER ) /* Visual C++ (and Intel C++) */
- /* We disable the warning `structure was padded due to */
- /* __declspec(align())' in order to compile cleanly with */
- /* the maximum level of warnings. */
-#pragma warning( push )
-#pragma warning( disable : 4324 )
-#endif /* _MSC_VER */
-
- typedef struct gray_TWorker_
- {
- ft_jmp_buf jump_buffer;
-
- TCoord ex, ey;
- TPos min_ex, max_ex;
- TPos min_ey, max_ey;
- TPos count_ex, count_ey;
-
- TArea area;
- TCoord cover;
- int invalid;
-
- PCell cells;
- FT_PtrDist max_cells;
- FT_PtrDist num_cells;
-
- TPos x, y;
-
- FT_Vector bez_stack[32 * 3 + 1];
- int lev_stack[32];
-
- FT_Outline outline;
- FT_Bitmap target;
- FT_BBox clip_box;
-
- FT_Span gray_spans[FT_MAX_GRAY_SPANS];
- int num_gray_spans;
-
- FT_Raster_Span_Func render_span;
- void* render_span_data;
- int span_y;
-
- int band_size;
- int band_shoot;
-
- void* buffer;
- long buffer_size;
-
- PCell* ycells;
- TPos ycount;
-
- } gray_TWorker, *gray_PWorker;
-
-#if defined( _MSC_VER )
-#pragma warning( pop )
-#endif
-
-
-#ifndef FT_STATIC_RASTER
-#define ras (*worker)
-#else
- static gray_TWorker ras;
-#endif
-
-
- typedef struct gray_TRaster_
- {
- void* memory;
-
- } gray_TRaster, *gray_PRaster;
-
-
-
- /*************************************************************************/
- /* */
- /* Initialize the cells table. */
- /* */
- static void
- gray_init_cells( RAS_ARG_ void* buffer,
- long byte_size )
- {
- ras.buffer = buffer;
- ras.buffer_size = byte_size;
-
- ras.ycells = (PCell*) buffer;
- ras.cells = NULL;
- ras.max_cells = 0;
- ras.num_cells = 0;
- ras.area = 0;
- ras.cover = 0;
- ras.invalid = 1;
- }
-
-
- /*************************************************************************/
- /* */
- /* Compute the outline bounding box. */
- /* */
- static void
- gray_compute_cbox( RAS_ARG )
- {
- FT_Outline* outline = &ras.outline;
- FT_Vector* vec = outline->points;
- FT_Vector* limit = vec + outline->n_points;
-
-
- if ( outline->n_points <= 0 )
- {
- ras.min_ex = ras.max_ex = 0;
- ras.min_ey = ras.max_ey = 0;
- return;
- }
-
- ras.min_ex = ras.max_ex = vec->x;
- ras.min_ey = ras.max_ey = vec->y;
-
- vec++;
-
- for ( ; vec < limit; vec++ )
- {
- TPos x = vec->x;
- TPos y = vec->y;
-
-
- if ( x < ras.min_ex ) ras.min_ex = x;
- if ( x > ras.max_ex ) ras.max_ex = x;
- if ( y < ras.min_ey ) ras.min_ey = y;
- if ( y > ras.max_ey ) ras.max_ey = y;
- }
-
- /* truncate the bounding box to integer pixels */
- ras.min_ex = ras.min_ex >> 6;
- ras.min_ey = ras.min_ey >> 6;
- ras.max_ex = ( ras.max_ex + 63 ) >> 6;
- ras.max_ey = ( ras.max_ey + 63 ) >> 6;
- }
-
-
- /*************************************************************************/
- /* */
- /* Record the current cell in the table. */
- /* */
- static PCell
- gray_find_cell( RAS_ARG )
- {
- PCell *pcell, cell;
- TPos x = ras.ex;
-
-
- if ( x > ras.count_ex )
- x = ras.count_ex;
-
- pcell = &ras.ycells[ras.ey];
- for (;;)
- {
- cell = *pcell;
- if ( cell == NULL || cell->x > x )
- break;
-
- if ( cell->x == x )
- goto Exit;
-
- pcell = &cell->next;
- }
-
- if ( ras.num_cells >= ras.max_cells )
- ft_longjmp( ras.jump_buffer, 1 );
-
- cell = ras.cells + ras.num_cells++;
- cell->x = x;
- cell->area = 0;
- cell->cover = 0;
-
- cell->next = *pcell;
- *pcell = cell;
-
- Exit:
- return cell;
- }
-
-
- static void
- gray_record_cell( RAS_ARG )
- {
- if ( ras.area | ras.cover )
- {
- PCell cell = gray_find_cell( RAS_VAR );
-
-
- cell->area += ras.area;
- cell->cover += ras.cover;
- }
- }
-
-
- /*************************************************************************/
- /* */
- /* Set the current cell to a new position. */
- /* */
- static void
- gray_set_cell( RAS_ARG_ TCoord ex,
- TCoord ey )
- {
- /* Move the cell pointer to a new position. We set the `invalid' */
- /* flag to indicate that the cell isn't part of those we're interested */
- /* in during the render phase. This means that: */
- /* */
- /* . the new vertical position must be within min_ey..max_ey-1. */
- /* . the new horizontal position must be strictly less than max_ex */
- /* */
- /* Note that if a cell is to the left of the clipping region, it is */
- /* actually set to the (min_ex-1) horizontal position. */
-
- /* All cells that are on the left of the clipping region go to the */
- /* min_ex - 1 horizontal position. */
- ey -= ras.min_ey;
-
- if ( ex > ras.max_ex )
- ex = ras.max_ex;
-
- ex -= ras.min_ex;
- if ( ex < 0 )
- ex = -1;
-
- /* are we moving to a different cell ? */
- if ( ex != ras.ex || ey != ras.ey )
- {
- /* record the current one if it is valid */
- if ( !ras.invalid )
- gray_record_cell( RAS_VAR );
-
- ras.area = 0;
- ras.cover = 0;
- ras.ex = ex;
- ras.ey = ey;
- }
-
- ras.invalid = ( (unsigned int)ey >= (unsigned int)ras.count_ey ||
- ex >= ras.count_ex );
- }
-
-
- /*************************************************************************/
- /* */
- /* Start a new contour at a given cell. */
- /* */
- static void
- gray_start_cell( RAS_ARG_ TCoord ex,
- TCoord ey )
- {
- if ( ex > ras.max_ex )
- ex = (TCoord)( ras.max_ex );
-
- if ( ex < ras.min_ex )
- ex = (TCoord)( ras.min_ex - 1 );
-
- ras.area = 0;
- ras.cover = 0;
- ras.ex = ex - ras.min_ex;
- ras.ey = ey - ras.min_ey;
- ras.invalid = 0;
-
- gray_set_cell( RAS_VAR_ ex, ey );
- }
-
-
- /*************************************************************************/
- /* */
- /* Render a scanline as one or more cells. */
- /* */
- static void
- gray_render_scanline( RAS_ARG_ TCoord ey,
- TPos x1,
- TCoord y1,
- TPos x2,
- TCoord y2 )
- {
- TCoord ex1, ex2, fx1, fx2, delta, mod;
- long p, first, dx;
- int incr;
-
-
- dx = x2 - x1;
-
- ex1 = TRUNC( x1 );
- ex2 = TRUNC( x2 );
- fx1 = (TCoord)( x1 - SUBPIXELS( ex1 ) );
- fx2 = (TCoord)( x2 - SUBPIXELS( ex2 ) );
-
- /* trivial case. Happens often */
- if ( y1 == y2 )
- {
- gray_set_cell( RAS_VAR_ ex2, ey );
- return;
- }
-
- /* everything is located in a single cell. That is easy! */
- /* */
- if ( ex1 == ex2 )
- {
- delta = y2 - y1;
- ras.area += (TArea)(( fx1 + fx2 ) * delta);
- ras.cover += delta;
- return;
- }
-
- /* ok, we'll have to render a run of adjacent cells on the same */
- /* scanline... */
- /* */
- p = ( ONE_PIXEL - fx1 ) * ( y2 - y1 );
- first = ONE_PIXEL;
- incr = 1;
-
- if ( dx < 0 )
- {
- p = fx1 * ( y2 - y1 );
- first = 0;
- incr = -1;
- dx = -dx;
- }
-
- FT_DIV_MOD( TCoord, p, dx, delta, mod );
-
- ras.area += (TArea)(( fx1 + first ) * delta);
- ras.cover += delta;
-
- ex1 += incr;
- gray_set_cell( RAS_VAR_ ex1, ey );
- y1 += delta;
-
- if ( ex1 != ex2 )
- {
- TCoord lift, rem;
-
-
- p = ONE_PIXEL * ( y2 - y1 + delta );
- FT_DIV_MOD( TCoord, p, dx, lift, rem );
-
- mod -= (int)dx;
-
- do
- {
- delta = lift;
- mod += rem;
- if ( mod >= 0 )
- {
- mod -= (TCoord)dx;
- delta++;
- }
-
- ras.area += (TArea)(ONE_PIXEL * delta);
- ras.cover += delta;
- y1 += delta;
- ex1 += incr;
- gray_set_cell( RAS_VAR_ ex1, ey );
- } while ( ex1 != ex2 );
- }
-
- delta = y2 - y1;
- ras.area += (TArea)(( fx2 + ONE_PIXEL - first ) * delta);
- ras.cover += delta;
- }
-
-
- /*************************************************************************/
- /* */
- /* Render a given line as a series of scanlines. */
- /* */
- static void
- gray_render_line( RAS_ARG_ TPos to_x,
- TPos to_y )
- {
- TCoord ey1, ey2, fy1, fy2, mod;
- TPos dx, dy, x, x2;
- long p, first;
- int delta, rem, lift, incr;
-
-
- ey1 = TRUNC( ras.y );
- ey2 = TRUNC( to_y ); /* if (ey2 >= ras.max_ey) ey2 = ras.max_ey-1; */
- fy1 = (TCoord)( ras.y - SUBPIXELS( ey1 ) );
- fy2 = (TCoord)( to_y - SUBPIXELS( ey2 ) );
-
- dx = to_x - ras.x;
- dy = to_y - ras.y;
-
- /* perform vertical clipping */
- if ( ( ey1 >= ras.max_ey && ey2 >= ras.max_ey ) ||
- ( ey1 < ras.min_ey && ey2 < ras.min_ey ) )
- goto End;
-
- /* everything is on a single scanline */
- if ( ey1 == ey2 )
- {
- gray_render_scanline( RAS_VAR_ ey1, ras.x, fy1, to_x, fy2 );
- goto End;
- }
-
- /* vertical line - avoid calling gray_render_scanline */
- incr = 1;
-
- if ( dx == 0 )
- {
- TCoord ex = TRUNC( ras.x );
- TCoord two_fx = (TCoord)( ( ras.x - SUBPIXELS( ex ) ) << 1 );
- TArea area;
-
-
- first = ONE_PIXEL;
- if ( dy < 0 )
- {
- first = 0;
- incr = -1;
- }
-
- delta = (int)( first - fy1 );
- ras.area += (TArea)two_fx * delta;
- ras.cover += delta;
- ey1 += incr;
-
- gray_set_cell( RAS_VAR_ ex, ey1 );
-
- delta = (int)( first + first - ONE_PIXEL );
- area = (TArea)two_fx * delta;
- while ( ey1 != ey2 )
- {
- ras.area += area;
- ras.cover += delta;
- ey1 += incr;
-
- gray_set_cell( RAS_VAR_ ex, ey1 );
- }
-
- delta = (int)( fy2 - ONE_PIXEL + first );
- ras.area += (TArea)two_fx * delta;
- ras.cover += delta;
-
- goto End;
- }
-
- /* ok, we have to render several scanlines */
- p = ( ONE_PIXEL - fy1 ) * dx;
- first = ONE_PIXEL;
- incr = 1;
-
- if ( dy < 0 )
- {
- p = fy1 * dx;
- first = 0;
- incr = -1;
- dy = -dy;
- }
-
- FT_DIV_MOD( int, p, dy, delta, mod );
-
- x = ras.x + delta;
- gray_render_scanline( RAS_VAR_ ey1, ras.x, fy1, x, (TCoord)first );
-
- ey1 += incr;
- gray_set_cell( RAS_VAR_ TRUNC( x ), ey1 );
-
- if ( ey1 != ey2 )
- {
- p = ONE_PIXEL * dx;
- FT_DIV_MOD( int, p, dy, lift, rem );
- mod -= (int)dy;
-
- do
- {
- delta = lift;
- mod += rem;
- if ( mod >= 0 )
- {
- mod -= (int)dy;
- delta++;
- }
-
- x2 = x + delta;
- gray_render_scanline( RAS_VAR_ ey1, x,
- (TCoord)( ONE_PIXEL - first ), x2,
- (TCoord)first );
- x = x2;
-
- ey1 += incr;
- gray_set_cell( RAS_VAR_ TRUNC( x ), ey1 );
- } while ( ey1 != ey2 );
- }
-
- gray_render_scanline( RAS_VAR_ ey1, x,
- (TCoord)( ONE_PIXEL - first ), to_x,
- fy2 );
-
- End:
- ras.x = to_x;
- ras.y = to_y;
- }
-
-
- static void
- gray_split_conic( FT_Vector* base )
- {
- TPos a, b;
-
-
- base[4].x = base[2].x;
- b = base[1].x;
- a = base[3].x = ( base[2].x + b ) / 2;
- b = base[1].x = ( base[0].x + b ) / 2;
- base[2].x = ( a + b ) / 2;
-
- base[4].y = base[2].y;
- b = base[1].y;
- a = base[3].y = ( base[2].y + b ) / 2;
- b = base[1].y = ( base[0].y + b ) / 2;
- base[2].y = ( a + b ) / 2;
- }
-
-
- static void
- gray_render_conic( RAS_ARG_ const FT_Vector* control,
- const FT_Vector* to )
- {
- TPos dx, dy;
- TPos min, max, y;
- int top, level;
- int* levels;
- FT_Vector* arc;
-
-
- levels = ras.lev_stack;
-
- arc = ras.bez_stack;
- arc[0].x = UPSCALE( to->x );
- arc[0].y = UPSCALE( to->y );
- arc[1].x = UPSCALE( control->x );
- arc[1].y = UPSCALE( control->y );
- arc[2].x = ras.x;
- arc[2].y = ras.y;
- top = 0;
-
- dx = FT_ABS( arc[2].x + arc[0].x - 2 * arc[1].x );
- dy = FT_ABS( arc[2].y + arc[0].y - 2 * arc[1].y );
- if ( dx < dy )
- dx = dy;
-
- if ( dx < ONE_PIXEL / 4 )
- goto Draw;
-
- /* short-cut the arc that crosses the current band */
- min = max = arc[0].y;
-
- y = arc[1].y;
- if ( y < min ) min = y;
- if ( y > max ) max = y;
-
- y = arc[2].y;
- if ( y < min ) min = y;
- if ( y > max ) max = y;
-
- if ( TRUNC( min ) >= ras.max_ey || TRUNC( max ) < ras.min_ey )
- goto Draw;
-
- level = 0;
- do
- {
- dx >>= 2;
- level++;
- } while ( dx > ONE_PIXEL / 4 );
-
- levels[0] = level;
-
- do
- {
- level = levels[top];
- if ( level > 0 )
- {
- gray_split_conic( arc );
- arc += 2;
- top++;
- levels[top] = levels[top - 1] = level - 1;
- continue;
- }
-
- Draw:
- gray_render_line( RAS_VAR_ arc[0].x, arc[0].y );
- top--;
- arc -= 2;
-
- } while ( top >= 0 );
- }
-
-
- static void
- gray_split_cubic( FT_Vector* base )
- {
- TPos a, b, c, d;
-
-
- base[6].x = base[3].x;
- c = base[1].x;
- d = base[2].x;
- base[1].x = a = ( base[0].x + c ) / 2;
- base[5].x = b = ( base[3].x + d ) / 2;
- c = ( c + d ) / 2;
- base[2].x = a = ( a + c ) / 2;
- base[4].x = b = ( b + c ) / 2;
- base[3].x = ( a + b ) / 2;
-
- base[6].y = base[3].y;
- c = base[1].y;
- d = base[2].y;
- base[1].y = a = ( base[0].y + c ) / 2;
- base[5].y = b = ( base[3].y + d ) / 2;
- c = ( c + d ) / 2;
- base[2].y = a = ( a + c ) / 2;
- base[4].y = b = ( b + c ) / 2;
- base[3].y = ( a + b ) / 2;
- }
-
-
- static void
- gray_render_cubic( RAS_ARG_ const FT_Vector* control1,
- const FT_Vector* control2,
- const FT_Vector* to )
- {
- FT_Vector* arc;
- TPos min, max, y;
-
-
- arc = ras.bez_stack;
- arc[0].x = UPSCALE( to->x );
- arc[0].y = UPSCALE( to->y );
- arc[1].x = UPSCALE( control2->x );
- arc[1].y = UPSCALE( control2->y );
- arc[2].x = UPSCALE( control1->x );
- arc[2].y = UPSCALE( control1->y );
- arc[3].x = ras.x;
- arc[3].y = ras.y;
-
- /* Short-cut the arc that crosses the current band. */
- min = max = arc[0].y;
-
- y = arc[1].y;
- if ( y < min )
- min = y;
- if ( y > max )
- max = y;
-
- y = arc[2].y;
- if ( y < min )
- min = y;
- if ( y > max )
- max = y;
-
- y = arc[3].y;
- if ( y < min )
- min = y;
- if ( y > max )
- max = y;
-
- if ( TRUNC( min ) >= ras.max_ey || TRUNC( max ) < ras.min_ey )
- goto Draw;
-
- for (;;)
- {
- /* Decide whether to split or draw. See `Rapid Termination */
- /* Evaluation for Recursive Subdivision of Bezier Curves' by Thomas */
- /* F. Hain, at */
- /* http://www.cis.southalabama.edu/~hain/general/Publications/Bezier/Camera-ready%20CISST02%202.pdf */
-
- {
- TPos dx, dy, dx_, dy_;
- TPos dx1, dy1, dx2, dy2;
- TPos L, s, s_limit;
-
-
- /* dx and dy are x and y components of the P0-P3 chord vector. */
- dx = dx_ = arc[3].x - arc[0].x;
- dy = dy_ = arc[3].y - arc[0].y;
-
- L = FT_HYPOT( dx_, dy_ );
-
- /* Avoid possible arithmetic overflow below by splitting. */
- if ( L > 32767 )
- goto Split;
-
- /* Max deviation may be as much as (s/L) * 3/4 (if Hain's v = 1). */
- s_limit = L * (TPos)( ONE_PIXEL / 6 );
-
- /* s is L * the perpendicular distance from P1 to the line P0-P3. */
- dx1 = arc[1].x - arc[0].x;
- dy1 = arc[1].y - arc[0].y;
- s = FT_ABS( dy * dx1 - dx * dy1 );
-
- if ( s > s_limit )
- goto Split;
-
- /* s is L * the perpendicular distance from P2 to the line P0-P3. */
- dx2 = arc[2].x - arc[0].x;
- dy2 = arc[2].y - arc[0].y;
- s = FT_ABS( dy * dx2 - dx * dy2 );
-
- if ( s > s_limit )
- goto Split;
-
- /* Split super curvy segments where the off points are so far
- from the chord that the angles P0-P1-P3 or P0-P2-P3 become
- acute as detected by appropriate dot products. */
- if ( dx1 * ( dx1 - dx ) + dy1 * ( dy1 - dy ) > 0 ||
- dx2 * ( dx2 - dx ) + dy2 * ( dy2 - dy ) > 0 )
- goto Split;
-
- /* No reason to split. */
- goto Draw;
- }
-
- Split:
- gray_split_cubic( arc );
- arc += 3;
- continue;
-
- Draw:
- gray_render_line( RAS_VAR_ arc[0].x, arc[0].y );
-
- if ( arc == ras.bez_stack )
- return;
-
- arc -= 3;
- }
- }
-
-
- static int
- gray_move_to( const FT_Vector* to,
- gray_PWorker worker )
- {
- TPos x, y;
-
-
- /* record current cell, if any */
- if ( !ras.invalid )
- gray_record_cell( RAS_VAR );
-
- /* start to a new position */
- x = UPSCALE( to->x );
- y = UPSCALE( to->y );
-
- gray_start_cell( RAS_VAR_ TRUNC( x ), TRUNC( y ) );
-
- worker->x = x;
- worker->y = y;
- return 0;
- }
-
-
- static int
- gray_line_to( const FT_Vector* to,
- gray_PWorker worker )
- {
- gray_render_line( RAS_VAR_ UPSCALE( to->x ), UPSCALE( to->y ) );
- return 0;
- }
-
-
- static int
- gray_conic_to( const FT_Vector* control,
- const FT_Vector* to,
- gray_PWorker worker )
- {
- gray_render_conic( RAS_VAR_ control, to );
- return 0;
- }
-
-
- static int
- gray_cubic_to( const FT_Vector* control1,
- const FT_Vector* control2,
- const FT_Vector* to,
- gray_PWorker worker )
- {
- gray_render_cubic( RAS_VAR_ control1, control2, to );
- return 0;
- }
-
-
- static void
- gray_render_span( int y,
- int count,
- const FT_Span* spans,
- gray_PWorker worker )
- {
- unsigned char* p;
- FT_Bitmap* map = &worker->target;
-
-
- /* first of all, compute the scanline offset */
- p = (unsigned char*)map->buffer - y * map->pitch;
- if ( map->pitch >= 0 )
- p += ( map->rows - 1 ) * (unsigned int)map->pitch;
-
- for ( ; count > 0; count--, spans++ )
- {
- unsigned char coverage = spans->coverage;
-
-
- if ( coverage )
- {
- /* For small-spans it is faster to do it by ourselves than
- * calling `memset'. This is mainly due to the cost of the
- * function call.
- */
- if ( spans->len >= 8 )
- FT_MEM_SET( p + spans->x, (unsigned char)coverage, spans->len );
- else
- {
- unsigned char* q = p + spans->x;
-
-
- switch ( spans->len )
- {
- case 7: *q++ = (unsigned char)coverage;
- case 6: *q++ = (unsigned char)coverage;
- case 5: *q++ = (unsigned char)coverage;
- case 4: *q++ = (unsigned char)coverage;
- case 3: *q++ = (unsigned char)coverage;
- case 2: *q++ = (unsigned char)coverage;
- case 1: *q = (unsigned char)coverage;
- default:
- ;
- }
- }
- }
- }
- }
-
-
- static void
- gray_hline( RAS_ARG_ TCoord x,
- TCoord y,
- TPos area,
- TCoord acount )
- {
- int coverage;
-
-
- /* compute the coverage line's coverage, depending on the */
- /* outline fill rule */
- /* */
- /* the coverage percentage is area/(PIXEL_BITS*PIXEL_BITS*2) */
- /* */
- coverage = (int)( area >> ( PIXEL_BITS * 2 + 1 - 8 ) );
- /* use range 0..256 */
- if ( coverage < 0 )
- coverage = -coverage;
-
- if ( ras.outline.flags & FT_OUTLINE_EVEN_ODD_FILL )
- {
- coverage &= 511;
-
- if ( coverage > 256 )
- coverage = 512 - coverage;
- else if ( coverage == 256 )
- coverage = 255;
- }
- else
- {
- /* normal non-zero winding rule */
- if ( coverage >= 256 )
- coverage = 255;
- }
-
- y += (TCoord)ras.min_ey;
- x += (TCoord)ras.min_ex;
-
- /* FT_Span.x is a 16-bit short, so limit our coordinates appropriately */
- if ( x >= 32767 )
- x = 32767;
-
- /* FT_Span.y is an integer, so limit our coordinates appropriately */
- if ( y >= FT_INT_MAX )
- y = FT_INT_MAX;
-
- if ( coverage )
- {
- FT_Span* span;
- int count;
-
-
- /* see whether we can add this span to the current list */
- count = ras.num_gray_spans;
- span = ras.gray_spans + count - 1;
- if ( count > 0 &&
- ras.span_y == y &&
- (int)span->x + span->len == (int)x &&
- span->coverage == coverage )
- {
- span->len = (unsigned short)( span->len + acount );
- return;
- }
-
- if ( ras.span_y != y || count >= FT_MAX_GRAY_SPANS )
- {
- if ( ras.render_span && count > 0 )
- ras.render_span( ras.span_y, count, ras.gray_spans,
- ras.render_span_data );
-
-#ifdef FT_DEBUG_LEVEL_TRACE
-
- if ( count > 0 )
- {
- int n;
-
-
- FT_TRACE7(( "y = %3d ", ras.span_y ));
- span = ras.gray_spans;
- for ( n = 0; n < count; n++, span++ )
- FT_TRACE7(( "[%d..%d]:%02x ",
- span->x, span->x + span->len - 1, span->coverage ));
- FT_TRACE7(( "\n" ));
- }
-
-#endif /* FT_DEBUG_LEVEL_TRACE */
-
- ras.num_gray_spans = 0;
- ras.span_y = (int)y;
-
- span = ras.gray_spans;
- }
- else
- span++;
-
- /* add a gray span to the current list */
- span->x = (short)x;
- span->len = (unsigned short)acount;
- span->coverage = (unsigned char)coverage;
-
- ras.num_gray_spans++;
- }
- }
-
-
-#ifdef FT_DEBUG_LEVEL_TRACE
-
- /* to be called while in the debugger -- */
- /* this function causes a compiler warning since it is unused otherwise */
- static void
- gray_dump_cells( RAS_ARG )
- {
- int yindex;
-
-
- for ( yindex = 0; yindex < ras.ycount; yindex++ )
- {
- PCell cell;
-
-
- printf( "%3d:", yindex );
-
- for ( cell = ras.ycells[yindex]; cell != NULL; cell = cell->next )
- printf( " (%3ld, c:%4ld, a:%6d)", cell->x, cell->cover, cell->area );
- printf( "\n" );
- }
- }
-
-#endif /* FT_DEBUG_LEVEL_TRACE */
-
-
- static void
- gray_sweep( RAS_ARG_ const FT_Bitmap* target )
- {
- int yindex;
-
- FT_UNUSED( target );
-
-
- if ( ras.num_cells == 0 )
- return;
-
- ras.num_gray_spans = 0;
-
- FT_TRACE7(( "gray_sweep: start\n" ));
-
- for ( yindex = 0; yindex < ras.ycount; yindex++ )
- {
- PCell cell = ras.ycells[yindex];
- TCoord cover = 0;
- TCoord x = 0;
-
-
- for ( ; cell != NULL; cell = cell->next )
- {
- TPos area;
-
-
- if ( cell->x > x && cover != 0 )
- gray_hline( RAS_VAR_ x, yindex, cover * ( ONE_PIXEL * 2 ),
- cell->x - x );
-
- cover += cell->cover;
- area = cover * ( ONE_PIXEL * 2 ) - cell->area;
-
- if ( area != 0 && cell->x >= 0 )
- gray_hline( RAS_VAR_ cell->x, yindex, area, 1 );
-
- x = cell->x + 1;
- }
-
- if ( cover != 0 )
- gray_hline( RAS_VAR_ x, yindex, cover * ( ONE_PIXEL * 2 ),
- ras.count_ex - x );
- }
-
- if ( ras.render_span && ras.num_gray_spans > 0 )
- ras.render_span( ras.span_y, ras.num_gray_spans,
- ras.gray_spans, ras.render_span_data );
-
-#ifdef FT_DEBUG_LEVEL_TRACE
-
- if ( ras.num_gray_spans > 0 )
- {
- FT_Span* span;
- int n;
-
-
- FT_TRACE7(( "y = %3d ", ras.span_y ));
- span = ras.gray_spans;
- for ( n = 0; n < ras.num_gray_spans; n++, span++ )
- FT_TRACE7(( "[%d..%d]:%02x ",
- span->x, span->x + span->len - 1, span->coverage ));
- FT_TRACE7(( "\n" ));
- }
-
- FT_TRACE7(( "gray_sweep: end\n" ));
-
-#endif /* FT_DEBUG_LEVEL_TRACE */
-
- }
-
-
-#ifdef _STANDALONE_
-
- /*************************************************************************/
- /* */
- /* The following function should only compile in stand-alone mode, */
- /* i.e., when building this component without the rest of FreeType. */
- /* */
- /*************************************************************************/
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* FT_Outline_Decompose */
- /* */
- /* <Description> */
- /* Walk over an outline's structure to decompose it into individual */
- /* segments and Bézier arcs. This function is also able to emit */
- /* `move to' and `close to' operations to indicate the start and end */
- /* of new contours in the outline. */
- /* */
- /* <Input> */
- /* outline :: A pointer to the source target. */
- /* */
- /* func_interface :: A table of `emitters', i.e., function pointers */
- /* called during decomposition to indicate path */
- /* operations. */
- /* */
- /* <InOut> */
- /* user :: A typeless pointer which is passed to each */
- /* emitter during the decomposition. It can be */
- /* used to store the state during the */
- /* decomposition. */
- /* */
- /* <Return> */
- /* Error code. 0 means success. */
- /* */
- static int
- FT_Outline_Decompose( const FT_Outline* outline,
- const FT_Outline_Funcs* func_interface,
- void* user )
- {
-#undef SCALED
-#define SCALED( x ) ( ( (x) << shift ) - delta )
-
- FT_Vector v_last;
- FT_Vector v_control;
- FT_Vector v_start;
-
- FT_Vector* point;
- FT_Vector* limit;
- char* tags;
-
- int error;
-
- int n; /* index of contour in outline */
- int first; /* index of first point in contour */
- char tag; /* current point's state */
-
- int shift;
- TPos delta;
-
-
- if ( !outline )
- return FT_THROW( Invalid_Outline );
-
- if ( !func_interface )
- return FT_THROW( Invalid_Argument );
-
- shift = func_interface->shift;
- delta = func_interface->delta;
- first = 0;
-
- for ( n = 0; n < outline->n_contours; n++ )
- {
- int last; /* index of last point in contour */
-
-
- FT_TRACE5(( "FT_Outline_Decompose: Outline %d\n", n ));
-
- last = outline->contours[n];
- if ( last < 0 )
- goto Invalid_Outline;
- limit = outline->points + last;
-
- v_start = outline->points[first];
- v_start.x = SCALED( v_start.x );
- v_start.y = SCALED( v_start.y );
-
- v_last = outline->points[last];
- v_last.x = SCALED( v_last.x );
- v_last.y = SCALED( v_last.y );
-
- v_control = v_start;
-
- point = outline->points + first;
- tags = outline->tags + first;
- tag = FT_CURVE_TAG( tags[0] );
-
- /* A contour cannot start with a cubic control point! */
- if ( tag == FT_CURVE_TAG_CUBIC )
- goto Invalid_Outline;
-
- /* check first point to determine origin */
- if ( tag == FT_CURVE_TAG_CONIC )
- {
- /* first point is conic control. Yes, this happens. */
- if ( FT_CURVE_TAG( outline->tags[last] ) == FT_CURVE_TAG_ON )
- {
- /* start at last point if it is on the curve */
- v_start = v_last;
- limit--;
- }
- else
- {
- /* if both first and last points are conic, */
- /* start at their middle and record its position */
- /* for closure */
- v_start.x = ( v_start.x + v_last.x ) / 2;
- v_start.y = ( v_start.y + v_last.y ) / 2;
-
- v_last = v_start;
- }
- point--;
- tags--;
- }
-
- FT_TRACE5(( " move to (%.2f, %.2f)\n",
- v_start.x / 64.0, v_start.y / 64.0 ));
- error = func_interface->move_to( &v_start, user );
- if ( error )
- goto Exit;
-
- while ( point < limit )
- {
- point++;
- tags++;
-
- tag = FT_CURVE_TAG( tags[0] );
- switch ( tag )
- {
- case FT_CURVE_TAG_ON: /* emit a single line_to */
- {
- FT_Vector vec;
-
-
- vec.x = SCALED( point->x );
- vec.y = SCALED( point->y );
-
- FT_TRACE5(( " line to (%.2f, %.2f)\n",
- vec.x / 64.0, vec.y / 64.0 ));
- error = func_interface->line_to( &vec, user );
- if ( error )
- goto Exit;
- continue;
- }
-
- case FT_CURVE_TAG_CONIC: /* consume conic arcs */
- v_control.x = SCALED( point->x );
- v_control.y = SCALED( point->y );
-
- Do_Conic:
- if ( point < limit )
- {
- FT_Vector vec;
- FT_Vector v_middle;
-
-
- point++;
- tags++;
- tag = FT_CURVE_TAG( tags[0] );
-
- vec.x = SCALED( point->x );
- vec.y = SCALED( point->y );
-
- if ( tag == FT_CURVE_TAG_ON )
- {
- FT_TRACE5(( " conic to (%.2f, %.2f)"
- " with control (%.2f, %.2f)\n",
- vec.x / 64.0, vec.y / 64.0,
- v_control.x / 64.0, v_control.y / 64.0 ));
- error = func_interface->conic_to( &v_control, &vec, user );
- if ( error )
- goto Exit;
- continue;
- }
-
- if ( tag != FT_CURVE_TAG_CONIC )
- goto Invalid_Outline;
-
- v_middle.x = ( v_control.x + vec.x ) / 2;
- v_middle.y = ( v_control.y + vec.y ) / 2;
-
- FT_TRACE5(( " conic to (%.2f, %.2f)"
- " with control (%.2f, %.2f)\n",
- v_middle.x / 64.0, v_middle.y / 64.0,
- v_control.x / 64.0, v_control.y / 64.0 ));
- error = func_interface->conic_to( &v_control, &v_middle, user );
- if ( error )
- goto Exit;
-
- v_control = vec;
- goto Do_Conic;
- }
-
- FT_TRACE5(( " conic to (%.2f, %.2f)"
- " with control (%.2f, %.2f)\n",
- v_start.x / 64.0, v_start.y / 64.0,
- v_control.x / 64.0, v_control.y / 64.0 ));
- error = func_interface->conic_to( &v_control, &v_start, user );
- goto Close;
-
- default: /* FT_CURVE_TAG_CUBIC */
- {
- FT_Vector vec1, vec2;
-
-
- if ( point + 1 > limit ||
- FT_CURVE_TAG( tags[1] ) != FT_CURVE_TAG_CUBIC )
- goto Invalid_Outline;
-
- point += 2;
- tags += 2;
-
- vec1.x = SCALED( point[-2].x );
- vec1.y = SCALED( point[-2].y );
-
- vec2.x = SCALED( point[-1].x );
- vec2.y = SCALED( point[-1].y );
-
- if ( point <= limit )
- {
- FT_Vector vec;
-
-
- vec.x = SCALED( point->x );
- vec.y = SCALED( point->y );
-
- FT_TRACE5(( " cubic to (%.2f, %.2f)"
- " with controls (%.2f, %.2f) and (%.2f, %.2f)\n",
- vec.x / 64.0, vec.y / 64.0,
- vec1.x / 64.0, vec1.y / 64.0,
- vec2.x / 64.0, vec2.y / 64.0 ));
- error = func_interface->cubic_to( &vec1, &vec2, &vec, user );
- if ( error )
- goto Exit;
- continue;
- }
-
- FT_TRACE5(( " cubic to (%.2f, %.2f)"
- " with controls (%.2f, %.2f) and (%.2f, %.2f)\n",
- v_start.x / 64.0, v_start.y / 64.0,
- vec1.x / 64.0, vec1.y / 64.0,
- vec2.x / 64.0, vec2.y / 64.0 ));
- error = func_interface->cubic_to( &vec1, &vec2, &v_start, user );
- goto Close;
- }
- }
- }
-
- /* close the contour with a line segment */
- FT_TRACE5(( " line to (%.2f, %.2f)\n",
- v_start.x / 64.0, v_start.y / 64.0 ));
- error = func_interface->line_to( &v_start, user );
-
- Close:
- if ( error )
- goto Exit;
-
- first = last + 1;
- }
-
- FT_TRACE5(( "FT_Outline_Decompose: Done\n", n ));
- return 0;
-
- Exit:
- FT_TRACE5(( "FT_Outline_Decompose: Error %d\n", error ));
- return error;
-
- Invalid_Outline:
- return FT_THROW( Invalid_Outline );
- }
-
-#endif /* _STANDALONE_ */
-
-
- typedef struct gray_TBand_
- {
- TPos min, max;
-
- } gray_TBand;
-
-
- FT_DEFINE_OUTLINE_FUNCS(
- func_interface,
-
- (FT_Outline_MoveTo_Func) gray_move_to,
- (FT_Outline_LineTo_Func) gray_line_to,
- (FT_Outline_ConicTo_Func)gray_conic_to,
- (FT_Outline_CubicTo_Func)gray_cubic_to,
- 0,
- 0 )
-
-
- static int
- gray_convert_glyph_inner( RAS_ARG )
- {
-
- volatile int error = 0;
-
-#ifdef FT_CONFIG_OPTION_PIC
- FT_Outline_Funcs func_interface;
- Init_Class_func_interface(&func_interface);
-#endif
-
- if ( ft_setjmp( ras.jump_buffer ) == 0 )
- {
- error = FT_Outline_Decompose( &ras.outline, &func_interface, &ras );
- if ( !ras.invalid )
- gray_record_cell( RAS_VAR );
- }
- else
- error = FT_THROW( Memory_Overflow );
-
- return error;
- }
-
-
- static int
- gray_convert_glyph( RAS_ARG )
- {
- gray_TBand bands[40];
- gray_TBand* volatile band;
- int volatile n, num_bands;
- TPos volatile min, max, max_y;
- FT_BBox* clip;
-
-
- /* Set up state in the raster object */
- gray_compute_cbox( RAS_VAR );
-
- /* clip to target bitmap, exit if nothing to do */
- clip = &ras.clip_box;
-
- if ( ras.max_ex <= clip->xMin || ras.min_ex >= clip->xMax ||
- ras.max_ey <= clip->yMin || ras.min_ey >= clip->yMax )
- return 0;
-
- if ( ras.min_ex < clip->xMin ) ras.min_ex = clip->xMin;
- if ( ras.min_ey < clip->yMin ) ras.min_ey = clip->yMin;
-
- if ( ras.max_ex > clip->xMax ) ras.max_ex = clip->xMax;
- if ( ras.max_ey > clip->yMax ) ras.max_ey = clip->yMax;
-
- ras.count_ex = ras.max_ex - ras.min_ex;
- ras.count_ey = ras.max_ey - ras.min_ey;
-
- /* set up vertical bands */
- num_bands = (int)( ( ras.max_ey - ras.min_ey ) / ras.band_size );
- if ( num_bands == 0 )
- num_bands = 1;
- if ( num_bands >= 39 )
- num_bands = 39;
-
- ras.band_shoot = 0;
-
- min = ras.min_ey;
- max_y = ras.max_ey;
-
- for ( n = 0; n < num_bands; n++, min = max )
- {
- max = min + ras.band_size;
- if ( n == num_bands - 1 || max > max_y )
- max = max_y;
-
- bands[0].min = min;
- bands[0].max = max;
- band = bands;
-
- do
- {
- TPos bottom, top, middle;
- int error;
-
- {
- PCell cells_max;
- int yindex;
- long cell_start, cell_end, cell_mod;
-
-
- ras.ycells = (PCell*)ras.buffer;
- ras.ycount = band->max - band->min;
-
- cell_start = (long)sizeof ( PCell ) * ras.ycount;
- cell_mod = cell_start % (long)sizeof ( TCell );
- if ( cell_mod > 0 )
- cell_start += (long)sizeof ( TCell ) - cell_mod;
-
- cell_end = ras.buffer_size;
- cell_end -= cell_end % (long)sizeof ( TCell );
-
- cells_max = (PCell)( (char*)ras.buffer + cell_end );
- ras.cells = (PCell)( (char*)ras.buffer + cell_start );
- if ( ras.cells >= cells_max )
- goto ReduceBands;
-
- ras.max_cells = cells_max - ras.cells;
- if ( ras.max_cells < 2 )
- goto ReduceBands;
-
- for ( yindex = 0; yindex < ras.ycount; yindex++ )
- ras.ycells[yindex] = NULL;
- }
-
- ras.num_cells = 0;
- ras.invalid = 1;
- ras.min_ey = band->min;
- ras.max_ey = band->max;
- ras.count_ey = band->max - band->min;
-
- error = gray_convert_glyph_inner( RAS_VAR );
-
- if ( !error )
- {
- gray_sweep( RAS_VAR_ &ras.target );
- band--;
- continue;
- }
- else if ( error != ErrRaster_Memory_Overflow )
- return 1;
-
- ReduceBands:
- /* render pool overflow; we will reduce the render band by half */
- bottom = band->min;
- top = band->max;
- middle = bottom + ( ( top - bottom ) >> 1 );
-
- /* This is too complex for a single scanline; there must */
- /* be some problems. */
- if ( middle == bottom )
- {
-#ifdef FT_DEBUG_LEVEL_TRACE
- FT_TRACE7(( "gray_convert_glyph: rotten glyph\n" ));
-#endif
- return 1;
- }
-
- if ( bottom-top >= ras.band_size )
- ras.band_shoot++;
-
- band[1].min = bottom;
- band[1].max = middle;
- band[0].min = middle;
- band[0].max = top;
- band++;
- } while ( band >= bands );
- }
-
- if ( ras.band_shoot > 8 && ras.band_size > 16 )
- ras.band_size = ras.band_size / 2;
-
- return 0;
- }
-
-
- static int
- gray_raster_render( gray_PRaster raster,
- const FT_Raster_Params* params )
- {
- const FT_Outline* outline = (const FT_Outline*)params->source;
- const FT_Bitmap* target_map = params->target;
-
- gray_TWorker worker[1];
-
- TCell buffer[FT_MAX( FT_RENDER_POOL_SIZE, 2048 ) / sizeof ( TCell )];
- long buffer_size = sizeof ( buffer );
- int band_size = (int)( buffer_size /
- (long)( sizeof ( TCell ) * 8 ) );
-
-
- if ( !raster )
- return FT_THROW( Invalid_Argument );
-
- if ( !outline )
- return FT_THROW( Invalid_Outline );
-
- /* return immediately if the outline is empty */
- if ( outline->n_points == 0 || outline->n_contours <= 0 )
- return 0;
-
- if ( !outline->contours || !outline->points )
- return FT_THROW( Invalid_Outline );
-
- if ( outline->n_points !=
- outline->contours[outline->n_contours - 1] + 1 )
- return FT_THROW( Invalid_Outline );
-
- /* if direct mode is not set, we must have a target bitmap */
- if ( !( params->flags & FT_RASTER_FLAG_DIRECT ) )
- {
- if ( !target_map )
- return FT_THROW( Invalid_Argument );
-
- /* nothing to do */
- if ( !target_map->width || !target_map->rows )
- return 0;
-
- if ( !target_map->buffer )
- return FT_THROW( Invalid_Argument );
- }
-
- /* this version does not support monochrome rendering */
- if ( !( params->flags & FT_RASTER_FLAG_AA ) )
- return FT_THROW( Invalid_Mode );
-
- /* compute clipping box */
- if ( !( params->flags & FT_RASTER_FLAG_DIRECT ) )
- {
- /* compute clip box from target pixmap */
- ras.clip_box.xMin = 0;
- ras.clip_box.yMin = 0;
- ras.clip_box.xMax = (FT_Pos)target_map->width;
- ras.clip_box.yMax = (FT_Pos)target_map->rows;
- }
- else if ( params->flags & FT_RASTER_FLAG_CLIP )
- ras.clip_box = params->clip_box;
- else
- {
- ras.clip_box.xMin = -32768L;
- ras.clip_box.yMin = -32768L;
- ras.clip_box.xMax = 32767L;
- ras.clip_box.yMax = 32767L;
- }
-
- gray_init_cells( RAS_VAR_ buffer, buffer_size );
-
- ras.outline = *outline;
- ras.num_cells = 0;
- ras.invalid = 1;
- ras.band_size = band_size;
- ras.num_gray_spans = 0;
- ras.span_y = 0;
-
- if ( params->flags & FT_RASTER_FLAG_DIRECT )
- {
- ras.render_span = (FT_Raster_Span_Func)params->gray_spans;
- ras.render_span_data = params->user;
- }
- else
- {
- ras.target = *target_map;
- ras.render_span = (FT_Raster_Span_Func)gray_render_span;
- ras.render_span_data = &ras;
- }
-
- return gray_convert_glyph( RAS_VAR );
- }
-
-
- /**** RASTER OBJECT CREATION: In stand-alone mode, we simply use *****/
- /**** a static object. *****/
-
-#ifdef _STANDALONE_
-
- static int
- gray_raster_new( void* memory,
- FT_Raster* araster )
- {
- static gray_TRaster the_raster;
-
- FT_UNUSED( memory );
-
-
- *araster = (FT_Raster)&the_raster;
- FT_MEM_ZERO( &the_raster, sizeof ( the_raster ) );
-
- return 0;
- }
-
-
- static void
- gray_raster_done( FT_Raster raster )
- {
- /* nothing */
- FT_UNUSED( raster );
- }
-
-#else /* !_STANDALONE_ */
-
- static int
- gray_raster_new( FT_Memory memory,
- FT_Raster* araster )
- {
- FT_Error error;
- gray_PRaster raster = NULL;
-
-
- *araster = 0;
- if ( !FT_ALLOC( raster, sizeof ( gray_TRaster ) ) )
- {
- raster->memory = memory;
- *araster = (FT_Raster)raster;
- }
-
- return error;
- }
-
-
- static void
- gray_raster_done( FT_Raster raster )
- {
- FT_Memory memory = (FT_Memory)((gray_PRaster)raster)->memory;
-
-
- FT_FREE( raster );
- }
-
-#endif /* !_STANDALONE_ */
-
-
- static void
- gray_raster_reset( FT_Raster raster,
- char* pool_base,
- long pool_size )
- {
- FT_UNUSED( raster );
- FT_UNUSED( pool_base );
- FT_UNUSED( pool_size );
- }
-
-
- static int
- gray_raster_set_mode( FT_Raster raster,
- unsigned long mode,
- void* args )
- {
- FT_UNUSED( raster );
- FT_UNUSED( mode );
- FT_UNUSED( args );
-
-
- return 0; /* nothing to do */
- }
-
-
- FT_DEFINE_RASTER_FUNCS(
- ft_grays_raster,
-
- FT_GLYPH_FORMAT_OUTLINE,
-
- (FT_Raster_New_Func) gray_raster_new,
- (FT_Raster_Reset_Func) gray_raster_reset,
- (FT_Raster_Set_Mode_Func)gray_raster_set_mode,
- (FT_Raster_Render_Func) gray_raster_render,
- (FT_Raster_Done_Func) gray_raster_done )
-
-
-/* END */
-
-
-/* Local Variables: */
-/* coding: utf-8 */
-/* End: */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/smooth/ftgrays.h b/chromium/third_party/pdfium/third_party/freetype/src/smooth/ftgrays.h
deleted file mode 100644
index 1b5760330c4..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/smooth/ftgrays.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftgrays.h */
-/* */
-/* FreeType smooth renderer declaration */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __FTGRAYS_H__
-#define __FTGRAYS_H__
-
-#ifdef __cplusplus
- extern "C" {
-#endif
-
-
-#ifdef _STANDALONE_
-#include "ftimage.h"
-#else
-#include <ft2build.h>
-#include FT_CONFIG_CONFIG_H /* for FT_CONFIG_OPTION_PIC */
-#include FT_IMAGE_H
-#endif
-
-
- /*************************************************************************/
- /* */
- /* To make ftgrays.h independent from configuration files we check */
- /* whether FT_EXPORT_VAR has been defined already. */
- /* */
- /* On some systems and compilers (Win32 mostly), an extra keyword is */
- /* necessary to compile the library as a DLL. */
- /* */
-#ifndef FT_EXPORT_VAR
-#define FT_EXPORT_VAR( x ) extern x
-#endif
-
- FT_EXPORT_VAR( const FT_Raster_Funcs ) ft_grays_raster;
-
-
-#ifdef __cplusplus
- }
-#endif
-
-#endif /* __FTGRAYS_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/smooth/ftsmerrs.h b/chromium/third_party/pdfium/third_party/freetype/src/smooth/ftsmerrs.h
deleted file mode 100644
index cc38aa1996e..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/smooth/ftsmerrs.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftsmerrs.h */
-/* */
-/* smooth renderer error codes (specification only). */
-/* */
-/* Copyright 2001-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* This file is used to define the smooth renderer error enumeration */
- /* constants. */
- /* */
- /*************************************************************************/
-
-#ifndef __FTSMERRS_H__
-#define __FTSMERRS_H__
-
-#include FT_MODULE_ERRORS_H
-
-#undef __FTERRORS_H__
-
-#undef FT_ERR_PREFIX
-#define FT_ERR_PREFIX Smooth_Err_
-#define FT_ERR_BASE FT_Mod_Err_Smooth
-
-#include FT_ERRORS_H
-
-#endif /* __FTSMERRS_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/smooth/ftsmooth.c b/chromium/third_party/pdfium/third_party/freetype/src/smooth/ftsmooth.c
deleted file mode 100644
index 36205505340..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/smooth/ftsmooth.c
+++ /dev/null
@@ -1,511 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftsmooth.c */
-/* */
-/* Anti-aliasing renderer interface (body). */
-/* */
-/* Copyright 2000-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_OUTLINE_H
-#include "ftsmooth.h"
-#include "ftgrays.h"
-#include "ftspic.h"
-
-#include "ftsmerrs.h"
-
-
- /* initialize renderer -- init its raster */
- static FT_Error
- ft_smooth_init( FT_Renderer render )
- {
- FT_Library library = FT_MODULE_LIBRARY( render );
-
-
- render->clazz->raster_class->raster_reset( render->raster,
- library->raster_pool,
- library->raster_pool_size );
-
- return 0;
- }
-
-
- /* sets render-specific mode */
- static FT_Error
- ft_smooth_set_mode( FT_Renderer render,
- FT_ULong mode_tag,
- FT_Pointer data )
- {
- /* we simply pass it to the raster */
- return render->clazz->raster_class->raster_set_mode( render->raster,
- mode_tag,
- data );
- }
-
- /* transform a given glyph image */
- static FT_Error
- ft_smooth_transform( FT_Renderer render,
- FT_GlyphSlot slot,
- const FT_Matrix* matrix,
- const FT_Vector* delta )
- {
- FT_Error error = FT_Err_Ok;
-
-
- if ( slot->format != render->glyph_format )
- {
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- if ( matrix )
- FT_Outline_Transform( &slot->outline, matrix );
-
- if ( delta )
- FT_Outline_Translate( &slot->outline, delta->x, delta->y );
-
- Exit:
- return error;
- }
-
-
- /* return the glyph's control box */
- static void
- ft_smooth_get_cbox( FT_Renderer render,
- FT_GlyphSlot slot,
- FT_BBox* cbox )
- {
- FT_MEM_ZERO( cbox, sizeof ( *cbox ) );
-
- if ( slot->format == render->glyph_format )
- FT_Outline_Get_CBox( &slot->outline, cbox );
- }
-
-
- /* convert a slot's glyph image into a bitmap */
- static FT_Error
- ft_smooth_render_generic( FT_Renderer render,
- FT_GlyphSlot slot,
- FT_Render_Mode mode,
- const FT_Vector* origin,
- FT_Render_Mode required_mode )
- {
- FT_Error error;
- FT_Outline* outline = &slot->outline;
- FT_Bitmap* bitmap = &slot->bitmap;
- FT_Memory memory = render->root.memory;
- FT_BBox cbox;
- FT_Pos x_shift = 0;
- FT_Pos y_shift = 0;
- FT_Pos x_left, y_top;
- FT_Pos width, height, pitch;
-#ifndef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
- FT_Pos height_org, width_org;
-#endif
- FT_Int hmul = mode == FT_RENDER_MODE_LCD;
- FT_Int vmul = mode == FT_RENDER_MODE_LCD_V;
-
- FT_Raster_Params params;
-
- FT_Bool have_outline_shifted = FALSE;
- FT_Bool have_buffer = FALSE;
-
-
- /* check glyph image format */
- if ( slot->format != render->glyph_format )
- {
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- /* check mode */
- if ( mode != required_mode )
- {
- error = FT_THROW( Cannot_Render_Glyph );
- goto Exit;
- }
-
- if ( origin )
- {
- x_shift = origin->x;
- y_shift = origin->y;
- }
-
- /* compute the control box, and grid fit it */
- /* taking into account the origin shift */
- FT_Outline_Get_CBox( outline, &cbox );
-
- cbox.xMin = FT_PIX_FLOOR( cbox.xMin + x_shift );
- cbox.yMin = FT_PIX_FLOOR( cbox.yMin + y_shift );
- cbox.xMax = FT_PIX_CEIL( cbox.xMax + x_shift );
- cbox.yMax = FT_PIX_CEIL( cbox.yMax + y_shift );
-
- x_shift -= cbox.xMin;
- y_shift -= cbox.yMin;
-
- x_left = cbox.xMin >> 6;
- y_top = cbox.yMax >> 6;
-
- width = (FT_ULong)( cbox.xMax - cbox.xMin ) >> 6;
- height = (FT_ULong)( cbox.yMax - cbox.yMin ) >> 6;
-
-#ifndef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
- width_org = width;
- height_org = height;
-#endif
-
- pitch = width;
- if ( hmul )
- {
- width *= 3;
- pitch = FT_PAD_CEIL( width, 4 );
- }
-
- if ( vmul )
- height *= 3;
-
-#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
-
- if ( slot->library->lcd_filter_func )
- {
- FT_Int extra = slot->library->lcd_extra;
-
-
- if ( hmul )
- {
- x_shift += 64 * ( extra >> 1 );
- x_left -= extra >> 1;
- width += 3 * extra;
- pitch = FT_PAD_CEIL( width, 4 );
- }
-
- if ( vmul )
- {
- y_shift += 64 * ( extra >> 1 );
- y_top += extra >> 1;
- height += 3 * extra;
- }
- }
-
-#endif
-
- /*
- * XXX: on 16bit system, we return an error for huge bitmap
- * to prevent an overflow.
- */
- if ( x_left > FT_INT_MAX || y_top > FT_INT_MAX ||
- x_left < FT_INT_MIN || y_top < FT_INT_MIN )
- {
- error = FT_THROW( Invalid_Pixel_Size );
- goto Exit;
- }
-
- /* Required check is (pitch * height < FT_ULONG_MAX), */
- /* but we care realistic cases only. Always pitch <= width. */
- if ( width > 0x7FFF || height > 0x7FFF )
- {
- FT_ERROR(( "ft_smooth_render_generic: glyph too large: %u x %u\n",
- width, height ));
- error = FT_THROW( Raster_Overflow );
- goto Exit;
- }
-
- /* release old bitmap buffer */
- if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP )
- {
- FT_FREE( bitmap->buffer );
- slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP;
- }
-
- /* allocate new one */
- if ( FT_ALLOC( bitmap->buffer, (FT_ULong)( pitch * height ) ) )
- goto Exit;
- else
- have_buffer = TRUE;
-
- slot->internal->flags |= FT_GLYPH_OWN_BITMAP;
-
- slot->format = FT_GLYPH_FORMAT_BITMAP;
- slot->bitmap_left = (FT_Int)x_left;
- slot->bitmap_top = (FT_Int)y_top;
-
- bitmap->pixel_mode = FT_PIXEL_MODE_GRAY;
- bitmap->num_grays = 256;
- bitmap->width = (unsigned int)width;
- bitmap->rows = (unsigned int)height;
- bitmap->pitch = pitch;
-
- /* translate outline to render it into the bitmap */
- if ( x_shift || y_shift )
- {
- FT_Outline_Translate( outline, x_shift, y_shift );
- have_outline_shifted = TRUE;
- }
-
- /* set up parameters */
- params.target = bitmap;
- params.source = outline;
- params.flags = FT_RASTER_FLAG_AA;
-
-#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
-
- /* implode outline if needed */
- {
- FT_Vector* points = outline->points;
- FT_Vector* points_end = points + outline->n_points;
- FT_Vector* vec;
-
-
- if ( hmul )
- for ( vec = points; vec < points_end; vec++ )
- vec->x *= 3;
-
- if ( vmul )
- for ( vec = points; vec < points_end; vec++ )
- vec->y *= 3;
- }
-
- /* render outline into the bitmap */
- error = render->raster_render( render->raster, &params );
-
- /* deflate outline if needed */
- {
- FT_Vector* points = outline->points;
- FT_Vector* points_end = points + outline->n_points;
- FT_Vector* vec;
-
-
- if ( hmul )
- for ( vec = points; vec < points_end; vec++ )
- vec->x /= 3;
-
- if ( vmul )
- for ( vec = points; vec < points_end; vec++ )
- vec->y /= 3;
- }
-
- if ( error )
- goto Exit;
-
- if ( slot->library->lcd_filter_func )
- slot->library->lcd_filter_func( bitmap, mode, slot->library );
-
-#else /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
-
- /* render outline into bitmap */
- error = render->raster_render( render->raster, &params );
- if ( error )
- goto Exit;
-
- /* expand it horizontally */
- if ( hmul )
- {
- FT_Byte* line = bitmap->buffer;
- FT_UInt hh;
-
-
- for ( hh = height_org; hh > 0; hh--, line += pitch )
- {
- FT_UInt xx;
- FT_Byte* end = line + width;
-
-
- for ( xx = width_org; xx > 0; xx-- )
- {
- FT_UInt pixel = line[xx-1];
-
-
- end[-3] = (FT_Byte)pixel;
- end[-2] = (FT_Byte)pixel;
- end[-1] = (FT_Byte)pixel;
- end -= 3;
- }
- }
- }
-
- /* expand it vertically */
- if ( vmul )
- {
- FT_Byte* read = bitmap->buffer + ( height - height_org ) * pitch;
- FT_Byte* write = bitmap->buffer;
- FT_UInt hh;
-
-
- for ( hh = height_org; hh > 0; hh-- )
- {
- ft_memcpy( write, read, pitch );
- write += pitch;
-
- ft_memcpy( write, read, pitch );
- write += pitch;
-
- ft_memcpy( write, read, pitch );
- write += pitch;
- read += pitch;
- }
- }
-
-#endif /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
-
- /* everything is fine; don't deallocate buffer */
- have_buffer = FALSE;
-
- error = FT_Err_Ok;
-
- Exit:
- if ( have_outline_shifted )
- FT_Outline_Translate( outline, -x_shift, -y_shift );
- if ( have_buffer )
- {
- FT_FREE( bitmap->buffer );
- slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP;
- }
-
- return error;
- }
-
-
- /* convert a slot's glyph image into a bitmap */
- static FT_Error
- ft_smooth_render( FT_Renderer render,
- FT_GlyphSlot slot,
- FT_Render_Mode mode,
- const FT_Vector* origin )
- {
- if ( mode == FT_RENDER_MODE_LIGHT )
- mode = FT_RENDER_MODE_NORMAL;
-
- return ft_smooth_render_generic( render, slot, mode, origin,
- FT_RENDER_MODE_NORMAL );
- }
-
-
- /* convert a slot's glyph image into a horizontal LCD bitmap */
- static FT_Error
- ft_smooth_render_lcd( FT_Renderer render,
- FT_GlyphSlot slot,
- FT_Render_Mode mode,
- const FT_Vector* origin )
- {
- FT_Error error;
-
- error = ft_smooth_render_generic( render, slot, mode, origin,
- FT_RENDER_MODE_LCD );
- if ( !error )
- slot->bitmap.pixel_mode = FT_PIXEL_MODE_LCD;
-
- return error;
- }
-
-
- /* convert a slot's glyph image into a vertical LCD bitmap */
- static FT_Error
- ft_smooth_render_lcd_v( FT_Renderer render,
- FT_GlyphSlot slot,
- FT_Render_Mode mode,
- const FT_Vector* origin )
- {
- FT_Error error;
-
- error = ft_smooth_render_generic( render, slot, mode, origin,
- FT_RENDER_MODE_LCD_V );
- if ( !error )
- slot->bitmap.pixel_mode = FT_PIXEL_MODE_LCD_V;
-
- return error;
- }
-
-
- FT_DEFINE_RENDERER( ft_smooth_renderer_class,
-
- FT_MODULE_RENDERER,
- sizeof ( FT_RendererRec ),
-
- "smooth",
- 0x10000L,
- 0x20000L,
-
- 0, /* module specific interface */
-
- (FT_Module_Constructor)ft_smooth_init,
- (FT_Module_Destructor) 0,
- (FT_Module_Requester) 0
- ,
-
- FT_GLYPH_FORMAT_OUTLINE,
-
- (FT_Renderer_RenderFunc) ft_smooth_render,
- (FT_Renderer_TransformFunc)ft_smooth_transform,
- (FT_Renderer_GetCBoxFunc) ft_smooth_get_cbox,
- (FT_Renderer_SetModeFunc) ft_smooth_set_mode,
-
- (FT_Raster_Funcs*) &FT_GRAYS_RASTER_GET
- )
-
-
- FT_DEFINE_RENDERER( ft_smooth_lcd_renderer_class,
-
- FT_MODULE_RENDERER,
- sizeof ( FT_RendererRec ),
-
- "smooth-lcd",
- 0x10000L,
- 0x20000L,
-
- 0, /* module specific interface */
-
- (FT_Module_Constructor)ft_smooth_init,
- (FT_Module_Destructor) 0,
- (FT_Module_Requester) 0
- ,
-
- FT_GLYPH_FORMAT_OUTLINE,
-
- (FT_Renderer_RenderFunc) ft_smooth_render_lcd,
- (FT_Renderer_TransformFunc)ft_smooth_transform,
- (FT_Renderer_GetCBoxFunc) ft_smooth_get_cbox,
- (FT_Renderer_SetModeFunc) ft_smooth_set_mode,
-
- (FT_Raster_Funcs*) &FT_GRAYS_RASTER_GET
- )
-
- FT_DEFINE_RENDERER( ft_smooth_lcdv_renderer_class,
-
- FT_MODULE_RENDERER,
- sizeof ( FT_RendererRec ),
-
- "smooth-lcdv",
- 0x10000L,
- 0x20000L,
-
- 0, /* module specific interface */
-
- (FT_Module_Constructor)ft_smooth_init,
- (FT_Module_Destructor) 0,
- (FT_Module_Requester) 0
- ,
-
- FT_GLYPH_FORMAT_OUTLINE,
-
- (FT_Renderer_RenderFunc) ft_smooth_render_lcd_v,
- (FT_Renderer_TransformFunc)ft_smooth_transform,
- (FT_Renderer_GetCBoxFunc) ft_smooth_get_cbox,
- (FT_Renderer_SetModeFunc) ft_smooth_set_mode,
-
- (FT_Raster_Funcs*) &FT_GRAYS_RASTER_GET
- )
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/smooth/ftsmooth.h b/chromium/third_party/pdfium/third_party/freetype/src/smooth/ftsmooth.h
deleted file mode 100644
index 765018c239b..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/smooth/ftsmooth.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftsmooth.h */
-/* */
-/* Anti-aliasing renderer interface (specification). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __FTSMOOTH_H__
-#define __FTSMOOTH_H__
-
-
-#include <ft2build.h>
-#include FT_RENDER_H
-
-
-FT_BEGIN_HEADER
-
-
-#ifndef FT_CONFIG_OPTION_NO_STD_RASTER
- FT_DECLARE_RENDERER( ft_std_renderer_class )
-#endif
-
-#ifndef FT_CONFIG_OPTION_NO_SMOOTH_RASTER
- FT_DECLARE_RENDERER( ft_smooth_renderer_class )
-
- FT_DECLARE_RENDERER( ft_smooth_lcd_renderer_class )
-
- FT_DECLARE_RENDERER( ft_smooth_lcd_v_renderer_class )
-#endif
-
-
-
-FT_END_HEADER
-
-#endif /* __FTSMOOTH_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/smooth/ftspic.c b/chromium/third_party/pdfium/third_party/freetype/src/smooth/ftspic.c
deleted file mode 100644
index 8e6ed57eecb..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/smooth/ftspic.c
+++ /dev/null
@@ -1,118 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftspic.c */
-/* */
-/* The FreeType position independent code services for smooth module. */
-/* */
-/* Copyright 2009-2015 by */
-/* Oran Agra and Mickey Gabel. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_INTERNAL_OBJECTS_H
-#include "ftspic.h"
-#include "ftsmerrs.h"
-
-
-#ifdef FT_CONFIG_OPTION_PIC
-
- /* forward declaration of PIC init functions from ftgrays.c */
- void
- FT_Init_Class_ft_grays_raster( FT_Raster_Funcs* funcs );
-
-
- void
- ft_smooth_renderer_class_pic_free( FT_Library library )
- {
- FT_PIC_Container* pic_container = &library->pic_container;
- FT_Memory memory = library->memory;
-
-
- if ( pic_container->smooth )
- {
- SmoothPIC* container = (SmoothPIC*)pic_container->smooth;
-
-
- if ( --container->ref_count )
- return;
-
- FT_FREE( container );
- pic_container->smooth = NULL;
- }
- }
-
-
- FT_Error
- ft_smooth_renderer_class_pic_init( FT_Library library )
- {
- FT_PIC_Container* pic_container = &library->pic_container;
- FT_Error error = FT_Err_Ok;
- SmoothPIC* container = NULL;
- FT_Memory memory = library->memory;
-
-
- /* since this function also serve smooth_lcd and smooth_lcdv renderers,
- it implements reference counting */
- if ( pic_container->smooth )
- {
- ((SmoothPIC*)pic_container->smooth)->ref_count++;
- return error;
- }
-
- /* allocate pointer, clear and set global container pointer */
- if ( FT_ALLOC( container, sizeof ( *container ) ) )
- return error;
- FT_MEM_SET( container, 0, sizeof ( *container ) );
- pic_container->smooth = container;
-
- container->ref_count = 1;
-
- /* initialize pointer table - */
- /* this is how the module usually expects this data */
- FT_Init_Class_ft_grays_raster( &container->ft_grays_raster );
-
- return error;
- }
-
-
- /* re-route these init and free functions to the above functions */
- FT_Error
- ft_smooth_lcd_renderer_class_pic_init( FT_Library library )
- {
- return ft_smooth_renderer_class_pic_init( library );
- }
-
-
- void
- ft_smooth_lcd_renderer_class_pic_free( FT_Library library )
- {
- ft_smooth_renderer_class_pic_free( library );
- }
-
-
- FT_Error
- ft_smooth_lcdv_renderer_class_pic_init( FT_Library library )
- {
- return ft_smooth_renderer_class_pic_init( library );
- }
-
-
- void
- ft_smooth_lcdv_renderer_class_pic_free( FT_Library library )
- {
- ft_smooth_renderer_class_pic_free( library );
- }
-
-#endif /* FT_CONFIG_OPTION_PIC */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/smooth/ftspic.h b/chromium/third_party/pdfium/third_party/freetype/src/smooth/ftspic.h
deleted file mode 100644
index 071afcff203..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/smooth/ftspic.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftspic.h */
-/* */
-/* The FreeType position independent code services for smooth module. */
-/* */
-/* Copyright 2009-2015 by */
-/* Oran Agra and Mickey Gabel. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __FTSPIC_H__
-#define __FTSPIC_H__
-
-
-#include FT_INTERNAL_PIC_H
-
-
-FT_BEGIN_HEADER
-
-#ifndef FT_CONFIG_OPTION_PIC
-
-#define FT_GRAYS_RASTER_GET ft_grays_raster
-
-#else /* FT_CONFIG_OPTION_PIC */
-
- typedef struct SmoothPIC_
- {
- int ref_count;
- FT_Raster_Funcs ft_grays_raster;
-
- } SmoothPIC;
-
-
-#define GET_PIC( lib ) \
- ( (SmoothPIC*)( (lib)->pic_container.smooth ) )
-#define FT_GRAYS_RASTER_GET ( GET_PIC( library )->ft_grays_raster )
-
-
- /* see ftspic.c for the implementation */
- void
- ft_smooth_renderer_class_pic_free( FT_Library library );
-
- void
- ft_smooth_lcd_renderer_class_pic_free( FT_Library library );
-
- void
- ft_smooth_lcdv_renderer_class_pic_free( FT_Library library );
-
- FT_Error
- ft_smooth_renderer_class_pic_init( FT_Library library );
-
- FT_Error
- ft_smooth_lcd_renderer_class_pic_init( FT_Library library );
-
- FT_Error
- ft_smooth_lcdv_renderer_class_pic_init( FT_Library library );
-
-#endif /* FT_CONFIG_OPTION_PIC */
-
- /* */
-
-FT_END_HEADER
-
-#endif /* __FTSPIC_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/smooth/smooth.c b/chromium/third_party/pdfium/third_party/freetype/src/smooth/smooth.c
deleted file mode 100644
index 4ca4344c892..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/smooth/smooth.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/***************************************************************************/
-/* */
-/* smooth.c */
-/* */
-/* FreeType anti-aliasing rasterer module component (body only). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#define FT_MAKE_OPTION_SINGLE_OBJECT
-
-#include <ft2build.h>
-#include "ftspic.c"
-#include "ftgrays.c"
-#include "ftsmooth.c"
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/truetype/Jamfile b/chromium/third_party/pdfium/third_party/freetype/src/truetype/Jamfile
deleted file mode 100644
index 88cc26f2b13..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/truetype/Jamfile
+++ /dev/null
@@ -1,37 +0,0 @@
-# FreeType 2 src/truetype Jamfile
-#
-# Copyright 2001-2015 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT. By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-SubDir FT2_TOP $(FT2_SRC_DIR) truetype ;
-
-{
- local _sources ;
-
- if $(FT2_MULTI)
- {
- _sources = ttdriver
- ttgload
- ttgxvar
- ttinterp
- ttobjs
- ttpic
- ttpload
- ttsubpix
- ;
- }
- else
- {
- _sources = truetype ;
- }
-
- Library $(FT2_LIB) : $(_sources).c ;
-}
-
-# end of src/truetype Jamfile
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/truetype/truetype.c b/chromium/third_party/pdfium/third_party/freetype/src/truetype/truetype.c
deleted file mode 100644
index f929437dc17..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/truetype/truetype.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/***************************************************************************/
-/* */
-/* truetype.c */
-/* */
-/* FreeType TrueType driver component (body only). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#define FT_MAKE_OPTION_SINGLE_OBJECT
-
-#include <ft2build.h>
-#include "ttpic.c"
-#include "ttdriver.c" /* driver interface */
-#include "ttpload.c" /* tables loader */
-#include "ttgload.c" /* glyph loader */
-#include "ttobjs.c" /* object manager */
-
-#ifdef TT_USE_BYTECODE_INTERPRETER
-#include "ttinterp.c"
-#include "ttsubpix.c"
-#endif
-
-#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
-#include "ttgxvar.c" /* gx distortable font */
-#endif
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/truetype/ttdriver.c b/chromium/third_party/pdfium/third_party/freetype/src/truetype/ttdriver.c
deleted file mode 100644
index 08b30c95ad0..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/truetype/ttdriver.c
+++ /dev/null
@@ -1,565 +0,0 @@
-/***************************************************************************/
-/* */
-/* ttdriver.c */
-/* */
-/* TrueType font driver implementation (body). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_SFNT_H
-#include FT_SERVICE_FONT_FORMAT_H
-
-#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
-#include FT_MULTIPLE_MASTERS_H
-#include FT_SERVICE_MULTIPLE_MASTERS_H
-#endif
-
-#include FT_SERVICE_TRUETYPE_ENGINE_H
-#include FT_SERVICE_TRUETYPE_GLYF_H
-#include FT_SERVICE_PROPERTIES_H
-#include FT_TRUETYPE_DRIVER_H
-
-#include "ttdriver.h"
-#include "ttgload.h"
-#include "ttpload.h"
-
-#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
-#include "ttgxvar.h"
-#endif
-
-#include "tterrors.h"
-
-#include "ttpic.h"
-
- /*************************************************************************/
- /* */
- /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
- /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
- /* messages during execution. */
- /* */
-#undef FT_COMPONENT
-#define FT_COMPONENT trace_ttdriver
-
-
- /*
- * PROPERTY SERVICE
- *
- */
- static FT_Error
- tt_property_set( FT_Module module, /* TT_Driver */
- const char* property_name,
- const void* value )
- {
- FT_Error error = FT_Err_Ok;
- TT_Driver driver = (TT_Driver)module;
-
-
- if ( !ft_strcmp( property_name, "interpreter-version" ) )
- {
- FT_UInt* interpreter_version = (FT_UInt*)value;
-
-
-#ifndef TT_CONFIG_OPTION_SUBPIXEL_HINTING
- if ( *interpreter_version != TT_INTERPRETER_VERSION_35 )
- error = FT_ERR( Unimplemented_Feature );
- else
-#endif
- driver->interpreter_version = *interpreter_version;
-
- return error;
- }
-
- FT_TRACE0(( "tt_property_set: missing property `%s'\n",
- property_name ));
- return FT_THROW( Missing_Property );
- }
-
-
- static FT_Error
- tt_property_get( FT_Module module, /* TT_Driver */
- const char* property_name,
- const void* value )
- {
- FT_Error error = FT_Err_Ok;
- TT_Driver driver = (TT_Driver)module;
-
- FT_UInt interpreter_version = driver->interpreter_version;
-
-
- if ( !ft_strcmp( property_name, "interpreter-version" ) )
- {
- FT_UInt* val = (FT_UInt*)value;
-
-
- *val = interpreter_version;
-
- return error;
- }
-
- FT_TRACE0(( "tt_property_get: missing property `%s'\n",
- property_name ));
- return FT_THROW( Missing_Property );
- }
-
-
- FT_DEFINE_SERVICE_PROPERTIESREC(
- tt_service_properties,
- (FT_Properties_SetFunc)tt_property_set,
- (FT_Properties_GetFunc)tt_property_get )
-
-
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
- /**** ****/
- /**** ****/
- /**** F A C E S ****/
- /**** ****/
- /**** ****/
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* tt_get_kerning */
- /* */
- /* <Description> */
- /* A driver method used to return the kerning vector between two */
- /* glyphs of the same face. */
- /* */
- /* <Input> */
- /* face :: A handle to the source face object. */
- /* */
- /* left_glyph :: The index of the left glyph in the kern pair. */
- /* */
- /* right_glyph :: The index of the right glyph in the kern pair. */
- /* */
- /* <Output> */
- /* kerning :: The kerning vector. This is in font units for */
- /* scalable formats, and in pixels for fixed-sizes */
- /* formats. */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. */
- /* */
- /* <Note> */
- /* Only horizontal layouts (left-to-right & right-to-left) are */
- /* supported by this function. Other layouts, or more sophisticated */
- /* kernings, are out of scope of this method (the basic driver */
- /* interface is meant to be simple). */
- /* */
- /* They can be implemented by format-specific interfaces. */
- /* */
- static FT_Error
- tt_get_kerning( FT_Face ttface, /* TT_Face */
- FT_UInt left_glyph,
- FT_UInt right_glyph,
- FT_Vector* kerning )
- {
- TT_Face face = (TT_Face)ttface;
- SFNT_Service sfnt = (SFNT_Service)face->sfnt;
-
-
- kerning->x = 0;
- kerning->y = 0;
-
- if ( sfnt )
- kerning->x = sfnt->get_kerning( face, left_glyph, right_glyph );
-
- return 0;
- }
-
-
- static FT_Error
- tt_get_advances( FT_Face ttface,
- FT_UInt start,
- FT_UInt count,
- FT_Int32 flags,
- FT_Fixed *advances )
- {
- FT_UInt nn;
- TT_Face face = (TT_Face) ttface;
-
-
- /* XXX: TODO: check for sbits */
-
- if ( flags & FT_LOAD_VERTICAL_LAYOUT )
- {
- for ( nn = 0; nn < count; nn++ )
- {
- FT_Short tsb;
- FT_UShort ah;
-
-
- /* since we don't need `tsb', we use zero for `yMax' parameter */
- TT_Get_VMetrics( face, start + nn, 0, &tsb, &ah );
- advances[nn] = ah;
- }
- }
- else
- {
- for ( nn = 0; nn < count; nn++ )
- {
- FT_Short lsb;
- FT_UShort aw;
-
-
- TT_Get_HMetrics( face, start + nn, &lsb, &aw );
- advances[nn] = aw;
- }
- }
-
- return FT_Err_Ok;
- }
-
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
- /**** ****/
- /**** ****/
- /**** S I Z E S ****/
- /**** ****/
- /**** ****/
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
-
-
-#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
-
- static FT_Error
- tt_size_select( FT_Size size,
- FT_ULong strike_index )
- {
- TT_Face ttface = (TT_Face)size->face;
- TT_Size ttsize = (TT_Size)size;
- FT_Error error = FT_Err_Ok;
-
-
- ttsize->strike_index = strike_index;
-
- if ( FT_IS_SCALABLE( size->face ) )
- {
- /* use the scaled metrics, even when tt_size_reset fails */
- FT_Select_Metrics( size->face, strike_index );
-
- tt_size_reset( ttsize ); /* ignore return value */
- }
- else
- {
- SFNT_Service sfnt = (SFNT_Service) ttface->sfnt;
- FT_Size_Metrics* metrics = &size->metrics;
-
-
- error = sfnt->load_strike_metrics( ttface, strike_index, metrics );
- if ( error )
- ttsize->strike_index = 0xFFFFFFFFUL;
- }
-
- return error;
- }
-
-#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
-
-
- static FT_Error
- tt_size_request( FT_Size size,
- FT_Size_Request req )
- {
- TT_Size ttsize = (TT_Size)size;
- FT_Error error = FT_Err_Ok;
-
-
-#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
-
- if ( FT_HAS_FIXED_SIZES( size->face ) )
- {
- TT_Face ttface = (TT_Face)size->face;
- SFNT_Service sfnt = (SFNT_Service) ttface->sfnt;
- FT_ULong strike_index;
-
-
- error = sfnt->set_sbit_strike( ttface, req, &strike_index );
-
- if ( error )
- ttsize->strike_index = 0xFFFFFFFFUL;
- else
- return tt_size_select( size, strike_index );
- }
-
-#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
-
- FT_Request_Metrics( size->face, req );
-
- if ( FT_IS_SCALABLE( size->face ) )
- {
- error = tt_size_reset( ttsize );
- ttsize->root.metrics = ttsize->metrics;
- }
-
- return error;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* tt_glyph_load */
- /* */
- /* <Description> */
- /* A driver method used to load a glyph within a given glyph slot. */
- /* */
- /* <Input> */
- /* slot :: A handle to the target slot object where the glyph */
- /* will be loaded. */
- /* */
- /* size :: A handle to the source face size at which the glyph */
- /* must be scaled, loaded, etc. */
- /* */
- /* glyph_index :: The index of the glyph in the font file. */
- /* */
- /* load_flags :: A flag indicating what to load for this glyph. The */
- /* FT_LOAD_XXX constants can be used to control the */
- /* glyph loading process (e.g., whether the outline */
- /* should be scaled, whether to load bitmaps or not, */
- /* whether to hint the outline, etc). */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. */
- /* */
- static FT_Error
- tt_glyph_load( FT_GlyphSlot ttslot, /* TT_GlyphSlot */
- FT_Size ttsize, /* TT_Size */
- FT_UInt glyph_index,
- FT_Int32 load_flags )
- {
- TT_GlyphSlot slot = (TT_GlyphSlot)ttslot;
- TT_Size size = (TT_Size)ttsize;
- FT_Face face = ttslot->face;
- FT_Error error;
-
-
- if ( !slot )
- return FT_THROW( Invalid_Slot_Handle );
-
- if ( !size )
- return FT_THROW( Invalid_Size_Handle );
-
- if ( !face )
- return FT_THROW( Invalid_Face_Handle );
-
-#ifdef FT_CONFIG_OPTION_INCREMENTAL
- if ( glyph_index >= (FT_UInt)face->num_glyphs &&
- !face->internal->incremental_interface )
-#else
- if ( glyph_index >= (FT_UInt)face->num_glyphs )
-#endif
- return FT_THROW( Invalid_Argument );
-
- if ( load_flags & FT_LOAD_NO_HINTING )
- {
- /* both FT_LOAD_NO_HINTING and FT_LOAD_NO_AUTOHINT */
- /* are necessary to disable hinting for tricky fonts */
-
- if ( FT_IS_TRICKY( face ) )
- load_flags &= ~FT_LOAD_NO_HINTING;
-
- if ( load_flags & FT_LOAD_NO_AUTOHINT )
- load_flags |= FT_LOAD_NO_HINTING;
- }
-
- if ( load_flags & ( FT_LOAD_NO_RECURSE | FT_LOAD_NO_SCALE ) )
- {
- load_flags |= FT_LOAD_NO_BITMAP | FT_LOAD_NO_SCALE;
-
- if ( !FT_IS_TRICKY( face ) )
- load_flags |= FT_LOAD_NO_HINTING;
- }
-
- /* now load the glyph outline if necessary */
- error = TT_Load_Glyph( size, slot, glyph_index, load_flags );
-
- /* force drop-out mode to 2 - irrelevant now */
- /* slot->outline.dropout_mode = 2; */
-
- return error;
- }
-
-
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
- /**** ****/
- /**** ****/
- /**** D R I V E R I N T E R F A C E ****/
- /**** ****/
- /**** ****/
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
-
-#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
- FT_DEFINE_SERVICE_MULTIMASTERSREC(
- tt_service_gx_multi_masters,
- (FT_Get_MM_Func) NULL,
- (FT_Set_MM_Design_Func) NULL,
- (FT_Set_MM_Blend_Func) TT_Set_MM_Blend,
- (FT_Get_MM_Var_Func) TT_Get_MM_Var,
- (FT_Set_Var_Design_Func)TT_Set_Var_Design )
-#endif
-
- static const FT_Service_TrueTypeEngineRec tt_service_truetype_engine =
- {
-#ifdef TT_USE_BYTECODE_INTERPRETER
-
-#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
- FT_TRUETYPE_ENGINE_TYPE_UNPATENTED
-#else
- FT_TRUETYPE_ENGINE_TYPE_PATENTED
-#endif
-
-#else /* !TT_USE_BYTECODE_INTERPRETER */
-
- FT_TRUETYPE_ENGINE_TYPE_NONE
-
-#endif /* TT_USE_BYTECODE_INTERPRETER */
- };
-
- FT_DEFINE_SERVICE_TTGLYFREC(
- tt_service_truetype_glyf,
- (TT_Glyf_GetLocationFunc)tt_face_get_location )
-
-#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
- FT_DEFINE_SERVICEDESCREC5(
- tt_services,
- FT_SERVICE_ID_FONT_FORMAT, FT_FONT_FORMAT_TRUETYPE,
- FT_SERVICE_ID_MULTI_MASTERS, &TT_SERVICE_GX_MULTI_MASTERS_GET,
- FT_SERVICE_ID_TRUETYPE_ENGINE, &tt_service_truetype_engine,
- FT_SERVICE_ID_TT_GLYF, &TT_SERVICE_TRUETYPE_GLYF_GET,
- FT_SERVICE_ID_PROPERTIES, &TT_SERVICE_PROPERTIES_GET )
-#else
- FT_DEFINE_SERVICEDESCREC4(
- tt_services,
- FT_SERVICE_ID_FONT_FORMAT, FT_FONT_FORMAT_TRUETYPE,
- FT_SERVICE_ID_TRUETYPE_ENGINE, &tt_service_truetype_engine,
- FT_SERVICE_ID_TT_GLYF, &TT_SERVICE_TRUETYPE_GLYF_GET,
- FT_SERVICE_ID_PROPERTIES, &TT_SERVICE_PROPERTIES_GET )
-#endif
-
-
- FT_CALLBACK_DEF( FT_Module_Interface )
- tt_get_interface( FT_Module driver, /* TT_Driver */
- const char* tt_interface )
- {
- FT_Library library;
- FT_Module_Interface result;
- FT_Module sfntd;
- SFNT_Service sfnt;
-
-
- /* TT_SERVICES_GET dereferences `library' in PIC mode */
-#ifdef FT_CONFIG_OPTION_PIC
- if ( !driver )
- return NULL;
- library = driver->library;
- if ( !library )
- return NULL;
-#endif
-
- result = ft_service_list_lookup( TT_SERVICES_GET, tt_interface );
- if ( result != NULL )
- return result;
-
-#ifndef FT_CONFIG_OPTION_PIC
- if ( !driver )
- return NULL;
- library = driver->library;
- if ( !library )
- return NULL;
-#endif
-
- /* only return the default interface from the SFNT module */
- sfntd = FT_Get_Module( library, "sfnt" );
- if ( sfntd )
- {
- sfnt = (SFNT_Service)( sfntd->clazz->module_interface );
- if ( sfnt )
- return sfnt->get_interface( driver, tt_interface );
- }
-
- return 0;
- }
-
-
- /* The FT_DriverInterface structure is defined in ftdriver.h. */
-
-#ifdef TT_USE_BYTECODE_INTERPRETER
-#define TT_HINTER_FLAG FT_MODULE_DRIVER_HAS_HINTER
-#else
-#define TT_HINTER_FLAG 0
-#endif
-
-#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
-#define TT_SIZE_SELECT tt_size_select
-#else
-#define TT_SIZE_SELECT 0
-#endif
-
- FT_DEFINE_DRIVER(
- tt_driver_class,
-
- FT_MODULE_FONT_DRIVER |
- FT_MODULE_DRIVER_SCALABLE |
- TT_HINTER_FLAG,
-
- sizeof ( TT_DriverRec ),
-
- "truetype", /* driver name */
- 0x10000L, /* driver version == 1.0 */
- 0x20000L, /* driver requires FreeType 2.0 or above */
-
- (void*)0, /* driver specific interface */
-
- tt_driver_init,
- tt_driver_done,
- tt_get_interface,
-
- sizeof ( TT_FaceRec ),
- sizeof ( TT_SizeRec ),
- sizeof ( FT_GlyphSlotRec ),
-
- tt_face_init,
- tt_face_done,
- tt_size_init,
- tt_size_done,
- tt_slot_init,
- 0, /* FT_Slot_DoneFunc */
-
- tt_glyph_load,
-
- tt_get_kerning,
- 0, /* FT_Face_AttachFunc */
- tt_get_advances,
-
- tt_size_request,
- TT_SIZE_SELECT
- )
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/truetype/ttdriver.h b/chromium/third_party/pdfium/third_party/freetype/src/truetype/ttdriver.h
deleted file mode 100644
index 6cacd60966e..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/truetype/ttdriver.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/***************************************************************************/
-/* */
-/* ttdriver.h */
-/* */
-/* High-level TrueType driver interface (specification). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __TTDRIVER_H__
-#define __TTDRIVER_H__
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_DRIVER_H
-
-
-FT_BEGIN_HEADER
-
-
- FT_DECLARE_DRIVER( tt_driver_class )
-
-
-FT_END_HEADER
-
-#endif /* __TTDRIVER_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/truetype/tterrors.h b/chromium/third_party/pdfium/third_party/freetype/src/truetype/tterrors.h
deleted file mode 100644
index ba32cf744ce..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/truetype/tterrors.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/***************************************************************************/
-/* */
-/* tterrors.h */
-/* */
-/* TrueType error codes (specification only). */
-/* */
-/* Copyright 2001-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* This file is used to define the TrueType error enumeration */
- /* constants. */
- /* */
- /*************************************************************************/
-
-#ifndef __TTERRORS_H__
-#define __TTERRORS_H__
-
-#include FT_MODULE_ERRORS_H
-
-#undef __FTERRORS_H__
-
-#undef FT_ERR_PREFIX
-#define FT_ERR_PREFIX TT_Err_
-#define FT_ERR_BASE FT_Mod_Err_TrueType
-
-#include FT_ERRORS_H
-
-#endif /* __TTERRORS_H__ */
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/truetype/ttgload.c b/chromium/third_party/pdfium/third_party/freetype/src/truetype/ttgload.c
deleted file mode 100644
index a792ad44a06..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/truetype/ttgload.c
+++ /dev/null
@@ -1,2563 +0,0 @@
-/***************************************************************************/
-/* */
-/* ttgload.c */
-/* */
-/* TrueType Glyph Loader (body). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_CALC_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_SFNT_H
-#include FT_TRUETYPE_TAGS_H
-#include FT_OUTLINE_H
-#include FT_TRUETYPE_DRIVER_H
-
-#include "ttgload.h"
-#include "ttpload.h"
-
-#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
-#include "ttgxvar.h"
-#endif
-
-#include "tterrors.h"
-#include "ttsubpix.h"
-
-
- /*************************************************************************/
- /* */
- /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
- /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
- /* messages during execution. */
- /* */
-#undef FT_COMPONENT
-#define FT_COMPONENT trace_ttgload
-
-
- /*************************************************************************/
- /* */
- /* Composite glyph flags. */
- /* */
-#define ARGS_ARE_WORDS 0x0001
-#define ARGS_ARE_XY_VALUES 0x0002
-#define ROUND_XY_TO_GRID 0x0004
-#define WE_HAVE_A_SCALE 0x0008
-/* reserved 0x0010 */
-#define MORE_COMPONENTS 0x0020
-#define WE_HAVE_AN_XY_SCALE 0x0040
-#define WE_HAVE_A_2X2 0x0080
-#define WE_HAVE_INSTR 0x0100
-#define USE_MY_METRICS 0x0200
-#define OVERLAP_COMPOUND 0x0400
-#define SCALED_COMPONENT_OFFSET 0x0800
-#define UNSCALED_COMPONENT_OFFSET 0x1000
-
-
- /*************************************************************************/
- /* */
- /* Return the horizontal metrics in font units for a given glyph. */
- /* */
- FT_LOCAL_DEF( void )
- TT_Get_HMetrics( TT_Face face,
- FT_UInt idx,
- FT_Short* lsb,
- FT_UShort* aw )
- {
- ( (SFNT_Service)face->sfnt )->get_metrics( face, 0, idx, lsb, aw );
-
- FT_TRACE5(( " advance width (font units): %d\n", *aw ));
- FT_TRACE5(( " left side bearing (font units): %d\n", *lsb ));
- }
-
-
- /*************************************************************************/
- /* */
- /* Return the vertical metrics in font units for a given glyph. */
- /* See macro `TT_LOADER_SET_PP' below for explanations. */
- /* */
- FT_LOCAL_DEF( void )
- TT_Get_VMetrics( TT_Face face,
- FT_UInt idx,
- FT_Pos yMax,
- FT_Short* tsb,
- FT_UShort* ah )
- {
- if ( face->vertical_info )
- ( (SFNT_Service)face->sfnt )->get_metrics( face, 1, idx, tsb, ah );
-
- else if ( face->os2.version != 0xFFFFU )
- {
- *tsb = (FT_Short)( face->os2.sTypoAscender - yMax );
- *ah = (FT_UShort)FT_ABS( face->os2.sTypoAscender -
- face->os2.sTypoDescender );
- }
-
- else
- {
- *tsb = (FT_Short)( face->horizontal.Ascender - yMax );
- *ah = (FT_UShort)FT_ABS( face->horizontal.Ascender -
- face->horizontal.Descender );
- }
-
- FT_TRACE5(( " advance height (font units): %d\n", *ah ));
- FT_TRACE5(( " top side bearing (font units): %d\n", *tsb ));
- }
-
-
- static FT_Error
- tt_get_metrics( TT_Loader loader,
- FT_UInt glyph_index )
- {
- TT_Face face = loader->face;
-#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
- TT_Driver driver = (TT_Driver)FT_FACE_DRIVER( face );
-#endif
-
- FT_Error error;
- FT_Stream stream = loader->stream;
-
- FT_Short left_bearing = 0, top_bearing = 0;
- FT_UShort advance_width = 0, advance_height = 0;
-
- /* we must preserve the stream position */
- /* (which gets altered by the metrics functions) */
- FT_ULong pos = FT_STREAM_POS();
-
-
- TT_Get_HMetrics( face, glyph_index,
- &left_bearing,
- &advance_width );
- TT_Get_VMetrics( face, glyph_index,
- loader->bbox.yMax,
- &top_bearing,
- &advance_height );
-
- if ( FT_STREAM_SEEK( pos ) )
- return error;
-
- loader->left_bearing = left_bearing;
- loader->advance = advance_width;
- loader->top_bearing = top_bearing;
- loader->vadvance = advance_height;
-
-#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
- if ( driver->interpreter_version == TT_INTERPRETER_VERSION_38 &&
- loader->exec )
- {
- loader->exec->sph_tweak_flags = 0;
-
- /* This may not be the right place for this, but it works... */
- /* Note that we have to unconditionally load the tweaks since */
- /* it is possible that glyphs individually switch ClearType's */
- /* backwards compatibility mode on and off. */
- sph_set_tweaks( loader, glyph_index );
- }
-#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */
-
- if ( !loader->linear_def )
- {
- loader->linear_def = 1;
- loader->linear = advance_width;
- }
-
- return FT_Err_Ok;
- }
-
-
-#ifdef FT_CONFIG_OPTION_INCREMENTAL
-
- static void
- tt_get_metrics_incr_overrides( TT_Loader loader,
- FT_UInt glyph_index )
- {
- TT_Face face = loader->face;
-
- FT_Short left_bearing = 0, top_bearing = 0;
- FT_UShort advance_width = 0, advance_height = 0;
-
-
- /* If this is an incrementally loaded font check whether there are */
- /* overriding metrics for this glyph. */
- if ( face->root.internal->incremental_interface &&
- face->root.internal->incremental_interface->funcs->get_glyph_metrics )
- {
- FT_Incremental_MetricsRec metrics;
- FT_Error error;
-
-
- metrics.bearing_x = loader->left_bearing;
- metrics.bearing_y = 0;
- metrics.advance = loader->advance;
- metrics.advance_v = 0;
-
- error = face->root.internal->incremental_interface->funcs->get_glyph_metrics(
- face->root.internal->incremental_interface->object,
- glyph_index, FALSE, &metrics );
- if ( error )
- goto Exit;
-
- left_bearing = (FT_Short)metrics.bearing_x;
- advance_width = (FT_UShort)metrics.advance;
-
-#if 0
-
- /* GWW: Do I do the same for vertical metrics? */
- metrics.bearing_x = 0;
- metrics.bearing_y = loader->top_bearing;
- metrics.advance = loader->vadvance;
-
- error = face->root.internal->incremental_interface->funcs->get_glyph_metrics(
- face->root.internal->incremental_interface->object,
- glyph_index, TRUE, &metrics );
- if ( error )
- goto Exit;
-
- top_bearing = (FT_Short)metrics.bearing_y;
- advance_height = (FT_UShort)metrics.advance;
-
-#endif /* 0 */
-
- loader->left_bearing = left_bearing;
- loader->advance = advance_width;
- loader->top_bearing = top_bearing;
- loader->vadvance = advance_height;
-
- if ( !loader->linear_def )
- {
- loader->linear_def = 1;
- loader->linear = advance_width;
- }
- }
-
- Exit:
- return;
- }
-
-#endif /* FT_CONFIG_OPTION_INCREMENTAL */
-
-
- /*************************************************************************/
- /* */
- /* The following functions are used by default with TrueType fonts. */
- /* However, they can be replaced by alternatives if we need to support */
- /* TrueType-compressed formats (like MicroType) in the future. */
- /* */
- /*************************************************************************/
-
- FT_CALLBACK_DEF( FT_Error )
- TT_Access_Glyph_Frame( TT_Loader loader,
- FT_UInt glyph_index,
- FT_ULong offset,
- FT_UInt byte_count )
- {
- FT_Error error;
- FT_Stream stream = loader->stream;
-
- /* for non-debug mode */
- FT_UNUSED( glyph_index );
-
-
- FT_TRACE4(( "Glyph %ld\n", glyph_index ));
-
- /* the following line sets the `error' variable through macros! */
- if ( FT_STREAM_SEEK( offset ) || FT_FRAME_ENTER( byte_count ) )
- return error;
-
- loader->cursor = stream->cursor;
- loader->limit = stream->limit;
-
- return FT_Err_Ok;
- }
-
-
- FT_CALLBACK_DEF( void )
- TT_Forget_Glyph_Frame( TT_Loader loader )
- {
- FT_Stream stream = loader->stream;
-
-
- FT_FRAME_EXIT();
- }
-
-
- FT_CALLBACK_DEF( FT_Error )
- TT_Load_Glyph_Header( TT_Loader loader )
- {
- FT_Byte* p = loader->cursor;
- FT_Byte* limit = loader->limit;
-
-
- if ( p + 10 > limit )
- return FT_THROW( Invalid_Outline );
-
- loader->n_contours = FT_NEXT_SHORT( p );
-
- loader->bbox.xMin = FT_NEXT_SHORT( p );
- loader->bbox.yMin = FT_NEXT_SHORT( p );
- loader->bbox.xMax = FT_NEXT_SHORT( p );
- loader->bbox.yMax = FT_NEXT_SHORT( p );
-
- FT_TRACE5(( " # of contours: %d\n", loader->n_contours ));
- FT_TRACE5(( " xMin: %4d xMax: %4d\n", loader->bbox.xMin,
- loader->bbox.xMax ));
- FT_TRACE5(( " yMin: %4d yMax: %4d\n", loader->bbox.yMin,
- loader->bbox.yMax ));
- loader->cursor = p;
-
- return FT_Err_Ok;
- }
-
-
- FT_CALLBACK_DEF( FT_Error )
- TT_Load_Simple_Glyph( TT_Loader load )
- {
- FT_Error error;
- FT_Byte* p = load->cursor;
- FT_Byte* limit = load->limit;
- FT_GlyphLoader gloader = load->gloader;
- FT_Int n_contours = load->n_contours;
- FT_Outline* outline;
- FT_UShort n_ins;
- FT_Int n_points;
- FT_ULong tmp;
-
- FT_Byte *flag, *flag_limit;
- FT_Byte c, count;
- FT_Vector *vec, *vec_limit;
- FT_Pos x;
- FT_Short *cont, *cont_limit, prev_cont;
- FT_Int xy_size = 0;
-
-
- /* check that we can add the contours to the glyph */
- error = FT_GLYPHLOADER_CHECK_POINTS( gloader, 0, n_contours );
- if ( error )
- goto Fail;
-
- /* reading the contours' endpoints & number of points */
- cont = gloader->current.outline.contours;
- cont_limit = cont + n_contours;
-
- /* check space for contours array + instructions count */
- if ( n_contours >= 0xFFF || p + ( n_contours + 1 ) * 2 > limit )
- goto Invalid_Outline;
-
- prev_cont = FT_NEXT_SHORT( p );
-
- if ( n_contours > 0 )
- cont[0] = prev_cont;
-
- if ( prev_cont < 0 )
- goto Invalid_Outline;
-
- for ( cont++; cont < cont_limit; cont++ )
- {
- cont[0] = FT_NEXT_SHORT( p );
- if ( cont[0] <= prev_cont )
- {
- /* unordered contours: this is invalid */
- goto Invalid_Outline;
- }
- prev_cont = cont[0];
- }
-
- n_points = 0;
- if ( n_contours > 0 )
- {
- n_points = cont[-1] + 1;
- if ( n_points < 0 )
- goto Invalid_Outline;
- }
-
- /* note that we will add four phantom points later */
- error = FT_GLYPHLOADER_CHECK_POINTS( gloader, n_points + 4, 0 );
- if ( error )
- goto Fail;
-
- /* reading the bytecode instructions */
- load->glyph->control_len = 0;
- load->glyph->control_data = NULL;
-
- if ( p + 2 > limit )
- goto Invalid_Outline;
-
- n_ins = FT_NEXT_USHORT( p );
-
- FT_TRACE5(( " Instructions size: %u\n", n_ins ));
-
- /* check it */
- if ( ( limit - p ) < n_ins )
- {
- FT_TRACE0(( "TT_Load_Simple_Glyph: instruction count mismatch\n" ));
- error = FT_THROW( Too_Many_Hints );
- goto Fail;
- }
-
-#ifdef TT_USE_BYTECODE_INTERPRETER
-
- if ( IS_HINTED( load->load_flags ) )
- {
- /* we don't trust `maxSizeOfInstructions' in the `maxp' table */
- /* and thus update the bytecode array size by ourselves */
-
- tmp = load->exec->glyphSize;
- error = Update_Max( load->exec->memory,
- &tmp,
- sizeof ( FT_Byte ),
- (void*)&load->exec->glyphIns,
- n_ins );
-
- load->exec->glyphSize = (FT_UShort)tmp;
- if ( error )
- return error;
-
- load->glyph->control_len = n_ins;
- load->glyph->control_data = load->exec->glyphIns;
-
- FT_MEM_COPY( load->exec->glyphIns, p, (FT_Long)n_ins );
- }
-
-#endif /* TT_USE_BYTECODE_INTERPRETER */
-
- p += n_ins;
-
- outline = &gloader->current.outline;
-
- /* reading the point tags */
- flag = (FT_Byte*)outline->tags;
- flag_limit = flag + n_points;
-
- FT_ASSERT( flag != NULL );
-
- while ( flag < flag_limit )
- {
- if ( p + 1 > limit )
- goto Invalid_Outline;
-
- *flag++ = c = FT_NEXT_BYTE( p );
- if ( c & 8 )
- {
- if ( p + 1 > limit )
- goto Invalid_Outline;
-
- count = FT_NEXT_BYTE( p );
- if ( flag + (FT_Int)count > flag_limit )
- goto Invalid_Outline;
-
- for ( ; count > 0; count-- )
- *flag++ = c;
- }
- }
-
- /* reading the X coordinates */
-
- vec = outline->points;
- vec_limit = vec + n_points;
- flag = (FT_Byte*)outline->tags;
- x = 0;
-
- if ( p + xy_size > limit )
- goto Invalid_Outline;
-
- for ( ; vec < vec_limit; vec++, flag++ )
- {
- FT_Pos y = 0;
- FT_Byte f = *flag;
-
-
- if ( f & 2 )
- {
- if ( p + 1 > limit )
- goto Invalid_Outline;
-
- y = (FT_Pos)FT_NEXT_BYTE( p );
- if ( ( f & 16 ) == 0 )
- y = -y;
- }
- else if ( ( f & 16 ) == 0 )
- {
- if ( p + 2 > limit )
- goto Invalid_Outline;
-
- y = (FT_Pos)FT_NEXT_SHORT( p );
- }
-
- x += y;
- vec->x = x;
- /* the cast is for stupid compilers */
- *flag = (FT_Byte)( f & ~( 2 | 16 ) );
- }
-
- /* reading the Y coordinates */
-
- vec = gloader->current.outline.points;
- vec_limit = vec + n_points;
- flag = (FT_Byte*)outline->tags;
- x = 0;
-
- for ( ; vec < vec_limit; vec++, flag++ )
- {
- FT_Pos y = 0;
- FT_Byte f = *flag;
-
-
- if ( f & 4 )
- {
- if ( p + 1 > limit )
- goto Invalid_Outline;
-
- y = (FT_Pos)FT_NEXT_BYTE( p );
- if ( ( f & 32 ) == 0 )
- y = -y;
- }
- else if ( ( f & 32 ) == 0 )
- {
- if ( p + 2 > limit )
- goto Invalid_Outline;
-
- y = (FT_Pos)FT_NEXT_SHORT( p );
- }
-
- x += y;
- vec->y = x;
- /* the cast is for stupid compilers */
- *flag = (FT_Byte)( f & FT_CURVE_TAG_ON );
- }
-
- outline->n_points = (FT_Short)n_points;
- outline->n_contours = (FT_Short)n_contours;
-
- load->cursor = p;
-
- Fail:
- return error;
-
- Invalid_Outline:
- error = FT_THROW( Invalid_Outline );
- goto Fail;
- }
-
-
- FT_CALLBACK_DEF( FT_Error )
- TT_Load_Composite_Glyph( TT_Loader loader )
- {
- FT_Error error;
- FT_Byte* p = loader->cursor;
- FT_Byte* limit = loader->limit;
- FT_GlyphLoader gloader = loader->gloader;
- FT_SubGlyph subglyph;
- FT_UInt num_subglyphs;
-
-
- num_subglyphs = 0;
-
- do
- {
- FT_Fixed xx, xy, yy, yx;
- FT_UInt count;
-
-
- /* check that we can load a new subglyph */
- error = FT_GlyphLoader_CheckSubGlyphs( gloader, num_subglyphs + 1 );
- if ( error )
- goto Fail;
-
- /* check space */
- if ( p + 4 > limit )
- goto Invalid_Composite;
-
- subglyph = gloader->current.subglyphs + num_subglyphs;
-
- subglyph->arg1 = subglyph->arg2 = 0;
-
- subglyph->flags = FT_NEXT_USHORT( p );
- subglyph->index = FT_NEXT_USHORT( p );
-
- /* check space */
- count = 2;
- if ( subglyph->flags & ARGS_ARE_WORDS )
- count += 2;
- if ( subglyph->flags & WE_HAVE_A_SCALE )
- count += 2;
- else if ( subglyph->flags & WE_HAVE_AN_XY_SCALE )
- count += 4;
- else if ( subglyph->flags & WE_HAVE_A_2X2 )
- count += 8;
-
- if ( p + count > limit )
- goto Invalid_Composite;
-
- /* read arguments */
- if ( subglyph->flags & ARGS_ARE_XY_VALUES )
- {
- if ( subglyph->flags & ARGS_ARE_WORDS )
- {
- subglyph->arg1 = FT_NEXT_SHORT( p );
- subglyph->arg2 = FT_NEXT_SHORT( p );
- }
- else
- {
- subglyph->arg1 = FT_NEXT_CHAR( p );
- subglyph->arg2 = FT_NEXT_CHAR( p );
- }
- }
- else
- {
- if ( subglyph->flags & ARGS_ARE_WORDS )
- {
- subglyph->arg1 = (FT_Int)FT_NEXT_USHORT( p );
- subglyph->arg2 = (FT_Int)FT_NEXT_USHORT( p );
- }
- else
- {
- subglyph->arg1 = (FT_Int)FT_NEXT_BYTE( p );
- subglyph->arg2 = (FT_Int)FT_NEXT_BYTE( p );
- }
- }
-
- /* read transform */
- xx = yy = 0x10000L;
- xy = yx = 0;
-
- if ( subglyph->flags & WE_HAVE_A_SCALE )
- {
- xx = (FT_Fixed)FT_NEXT_SHORT( p ) * 4;
- yy = xx;
- }
- else if ( subglyph->flags & WE_HAVE_AN_XY_SCALE )
- {
- xx = (FT_Fixed)FT_NEXT_SHORT( p ) * 4;
- yy = (FT_Fixed)FT_NEXT_SHORT( p ) * 4;
- }
- else if ( subglyph->flags & WE_HAVE_A_2X2 )
- {
- xx = (FT_Fixed)FT_NEXT_SHORT( p ) * 4;
- yx = (FT_Fixed)FT_NEXT_SHORT( p ) * 4;
- xy = (FT_Fixed)FT_NEXT_SHORT( p ) * 4;
- yy = (FT_Fixed)FT_NEXT_SHORT( p ) * 4;
- }
-
- subglyph->transform.xx = xx;
- subglyph->transform.xy = xy;
- subglyph->transform.yx = yx;
- subglyph->transform.yy = yy;
-
- num_subglyphs++;
-
- } while ( subglyph->flags & MORE_COMPONENTS );
-
- gloader->current.num_subglyphs = num_subglyphs;
-
-#ifdef TT_USE_BYTECODE_INTERPRETER
-
- {
- FT_Stream stream = loader->stream;
-
-
- /* we must undo the FT_FRAME_ENTER in order to point */
- /* to the composite instructions, if we find some. */
- /* We will process them later. */
- /* */
- loader->ins_pos = (FT_ULong)( FT_STREAM_POS() +
- p - limit );
- }
-
-#endif
-
- loader->cursor = p;
-
- Fail:
- return error;
-
- Invalid_Composite:
- error = FT_THROW( Invalid_Composite );
- goto Fail;
- }
-
-
- FT_LOCAL_DEF( void )
- TT_Init_Glyph_Loading( TT_Face face )
- {
- face->access_glyph_frame = TT_Access_Glyph_Frame;
- face->read_glyph_header = TT_Load_Glyph_Header;
- face->read_simple_glyph = TT_Load_Simple_Glyph;
- face->read_composite_glyph = TT_Load_Composite_Glyph;
- face->forget_glyph_frame = TT_Forget_Glyph_Frame;
- }
-
-
- static void
- tt_prepare_zone( TT_GlyphZone zone,
- FT_GlyphLoad load,
- FT_UInt start_point,
- FT_UInt start_contour )
- {
- zone->n_points = (FT_UShort)load->outline.n_points -
- (FT_UShort)start_point;
- zone->n_contours = load->outline.n_contours -
- (FT_Short)start_contour;
- zone->org = load->extra_points + start_point;
- zone->cur = load->outline.points + start_point;
- zone->orus = load->extra_points2 + start_point;
- zone->tags = (FT_Byte*)load->outline.tags + start_point;
- zone->contours = (FT_UShort*)load->outline.contours + start_contour;
- zone->first_point = (FT_UShort)start_point;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Hint_Glyph */
- /* */
- /* <Description> */
- /* Hint the glyph using the zone prepared by the caller. Note that */
- /* the zone is supposed to include four phantom points. */
- /* */
- static FT_Error
- TT_Hint_Glyph( TT_Loader loader,
- FT_Bool is_composite )
- {
-#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
- TT_Face face = loader->face;
- TT_Driver driver = (TT_Driver)FT_FACE_DRIVER( face );
-#endif
-
- TT_GlyphZone zone = &loader->zone;
-
-#ifdef TT_USE_BYTECODE_INTERPRETER
- FT_Long n_ins;
-#else
- FT_UNUSED( is_composite );
-#endif
-
-
-#ifdef TT_USE_BYTECODE_INTERPRETER
- if ( loader->glyph->control_len > 0xFFFFL )
- {
- FT_TRACE1(( "TT_Hint_Glyph: too long instructions" ));
- FT_TRACE1(( " (0x%lx byte) is truncated\n",
- loader->glyph->control_len ));
- }
- n_ins = loader->glyph->control_len;
-
- /* save original point position in org */
- if ( n_ins > 0 )
- FT_ARRAY_COPY( zone->org, zone->cur, zone->n_points );
-
- /* Reset graphics state. */
- loader->exec->GS = loader->size->GS;
-
- /* XXX: UNDOCUMENTED! Hinting instructions of a composite glyph */
- /* completely refer to the (already) hinted subglyphs. */
- if ( is_composite )
- {
- loader->exec->metrics.x_scale = 1 << 16;
- loader->exec->metrics.y_scale = 1 << 16;
-
- FT_ARRAY_COPY( zone->orus, zone->cur, zone->n_points );
- }
- else
- {
- loader->exec->metrics.x_scale = loader->size->metrics.x_scale;
- loader->exec->metrics.y_scale = loader->size->metrics.y_scale;
- }
-#endif
-
- /* round phantom points */
- zone->cur[zone->n_points - 4].x =
- FT_PIX_ROUND( zone->cur[zone->n_points - 4].x );
- zone->cur[zone->n_points - 3].x =
- FT_PIX_ROUND( zone->cur[zone->n_points - 3].x );
- zone->cur[zone->n_points - 2].y =
- FT_PIX_ROUND( zone->cur[zone->n_points - 2].y );
- zone->cur[zone->n_points - 1].y =
- FT_PIX_ROUND( zone->cur[zone->n_points - 1].y );
-
-#ifdef TT_USE_BYTECODE_INTERPRETER
-
- if ( n_ins > 0 )
- {
- FT_Error error;
-
- FT_GlyphLoader gloader = loader->gloader;
- FT_Outline current_outline = gloader->current.outline;
-
-
- TT_Set_CodeRange( loader->exec, tt_coderange_glyph,
- loader->exec->glyphIns, n_ins );
-
- loader->exec->is_composite = is_composite;
- loader->exec->pts = *zone;
-
- error = TT_Run_Context( loader->exec );
- if ( error && loader->exec->pedantic_hinting )
- return error;
-
- /* store drop-out mode in bits 5-7; set bit 2 also as a marker */
- current_outline.tags[0] |=
- ( loader->exec->GS.scan_type << 5 ) | FT_CURVE_TAG_HAS_SCANMODE;
- }
-
-#endif
-
- /* save glyph phantom points */
- loader->pp1 = zone->cur[zone->n_points - 4];
- loader->pp2 = zone->cur[zone->n_points - 3];
- loader->pp3 = zone->cur[zone->n_points - 2];
- loader->pp4 = zone->cur[zone->n_points - 1];
-
-#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
- if ( driver->interpreter_version == TT_INTERPRETER_VERSION_38 )
- {
- if ( loader->exec->sph_tweak_flags & SPH_TWEAK_DEEMBOLDEN )
- FT_Outline_EmboldenXY( &loader->gloader->current.outline, -24, 0 );
-
- else if ( loader->exec->sph_tweak_flags & SPH_TWEAK_EMBOLDEN )
- FT_Outline_EmboldenXY( &loader->gloader->current.outline, 24, 0 );
- }
-#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */
-
- return FT_Err_Ok;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Process_Simple_Glyph */
- /* */
- /* <Description> */
- /* Once a simple glyph has been loaded, it needs to be processed. */
- /* Usually, this means scaling and hinting through bytecode */
- /* interpretation. */
- /* */
- static FT_Error
- TT_Process_Simple_Glyph( TT_Loader loader )
- {
- FT_GlyphLoader gloader = loader->gloader;
- FT_Error error = FT_Err_Ok;
- FT_Outline* outline;
- FT_Int n_points;
-
-
- outline = &gloader->current.outline;
- n_points = outline->n_points;
-
- /* set phantom points */
-
- outline->points[n_points ] = loader->pp1;
- outline->points[n_points + 1] = loader->pp2;
- outline->points[n_points + 2] = loader->pp3;
- outline->points[n_points + 3] = loader->pp4;
-
- outline->tags[n_points ] = 0;
- outline->tags[n_points + 1] = 0;
- outline->tags[n_points + 2] = 0;
- outline->tags[n_points + 3] = 0;
-
- n_points += 4;
-
-#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
-
- if ( loader->face->doblend )
- {
- /* Deltas apply to the unscaled data. */
- error = TT_Vary_Apply_Glyph_Deltas( loader->face,
- loader->glyph_index,
- outline,
- (FT_UInt)n_points );
- if ( error )
- return error;
- }
-
-#endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */
-
- if ( IS_HINTED( loader->load_flags ) )
- {
- tt_prepare_zone( &loader->zone, &gloader->current, 0, 0 );
-
- FT_ARRAY_COPY( loader->zone.orus, loader->zone.cur,
- loader->zone.n_points + 4 );
- }
-
- {
-#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
- TT_Face face = loader->face;
- TT_Driver driver = (TT_Driver)FT_FACE_DRIVER( face );
-
- FT_String* family = face->root.family_name;
- FT_UInt ppem = loader->size->metrics.x_ppem;
- FT_String* style = face->root.style_name;
- FT_UInt x_scale_factor = 1000;
-#endif
-
- FT_Vector* vec = outline->points;
- FT_Vector* limit = outline->points + n_points;
-
- FT_Fixed x_scale = 0; /* pacify compiler */
- FT_Fixed y_scale = 0;
-
- FT_Bool do_scale = FALSE;
-
-
-#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
-
- if ( driver->interpreter_version == TT_INTERPRETER_VERSION_38 )
- {
- /* scale, but only if enabled and only if TT hinting is being used */
- if ( IS_HINTED( loader->load_flags ) )
- x_scale_factor = sph_test_tweak_x_scaling( face,
- family,
- ppem,
- style,
- loader->glyph_index );
- /* scale the glyph */
- if ( ( loader->load_flags & FT_LOAD_NO_SCALE ) == 0 ||
- x_scale_factor != 1000 )
- {
- x_scale = FT_MulDiv( loader->size->metrics.x_scale,
- (FT_Long)x_scale_factor, 1000 );
- y_scale = loader->size->metrics.y_scale;
-
- /* compensate for any scaling by de/emboldening; */
- /* the amount was determined via experimentation */
- if ( x_scale_factor != 1000 && ppem > 11 )
- FT_Outline_EmboldenXY( outline,
- FT_MulFix( 1280 * ppem,
- 1000 - x_scale_factor ),
- 0 );
- do_scale = TRUE;
- }
- }
- else
-
-#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */
-
- {
- /* scale the glyph */
- if ( ( loader->load_flags & FT_LOAD_NO_SCALE ) == 0 )
- {
- x_scale = loader->size->metrics.x_scale;
- y_scale = loader->size->metrics.y_scale;
-
- do_scale = TRUE;
- }
- }
-
- if ( do_scale )
- {
- for ( ; vec < limit; vec++ )
- {
- vec->x = FT_MulFix( vec->x, x_scale );
- vec->y = FT_MulFix( vec->y, y_scale );
- }
-
- loader->pp1 = outline->points[n_points - 4];
- loader->pp2 = outline->points[n_points - 3];
- loader->pp3 = outline->points[n_points - 2];
- loader->pp4 = outline->points[n_points - 1];
- }
- }
-
- if ( IS_HINTED( loader->load_flags ) )
- {
- loader->zone.n_points += 4;
-
- error = TT_Hint_Glyph( loader, 0 );
- }
-
- return error;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Process_Composite_Component */
- /* */
- /* <Description> */
- /* Once a composite component has been loaded, it needs to be */
- /* processed. Usually, this means transforming and translating. */
- /* */
- static FT_Error
- TT_Process_Composite_Component( TT_Loader loader,
- FT_SubGlyph subglyph,
- FT_UInt start_point,
- FT_UInt num_base_points )
- {
- FT_GlyphLoader gloader = loader->gloader;
- FT_Outline current;
- FT_Bool have_scale;
- FT_Pos x, y;
-
-
- current.points = gloader->base.outline.points +
- num_base_points;
- current.n_points = gloader->base.outline.n_points -
- (short)num_base_points;
-
- have_scale = FT_BOOL( subglyph->flags & ( WE_HAVE_A_SCALE |
- WE_HAVE_AN_XY_SCALE |
- WE_HAVE_A_2X2 ) );
-
- /* perform the transform required for this subglyph */
- if ( have_scale )
- FT_Outline_Transform( &current, &subglyph->transform );
-
- /* get offset */
- if ( !( subglyph->flags & ARGS_ARE_XY_VALUES ) )
- {
- FT_UInt num_points = (FT_UInt)gloader->base.outline.n_points;
- FT_UInt k = (FT_UInt)subglyph->arg1;
- FT_UInt l = (FT_UInt)subglyph->arg2;
- FT_Vector* p1;
- FT_Vector* p2;
-
-
- /* match l-th point of the newly loaded component to the k-th point */
- /* of the previously loaded components. */
-
- /* change to the point numbers used by our outline */
- k += start_point;
- l += num_base_points;
- if ( k >= num_base_points ||
- l >= num_points )
- return FT_THROW( Invalid_Composite );
-
- p1 = gloader->base.outline.points + k;
- p2 = gloader->base.outline.points + l;
-
- x = p1->x - p2->x;
- y = p1->y - p2->y;
- }
- else
- {
- x = subglyph->arg1;
- y = subglyph->arg2;
-
- if ( !x && !y )
- return FT_Err_Ok;
-
- /* Use a default value dependent on */
- /* TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED. This is useful for old */
- /* TT fonts which don't set the xxx_COMPONENT_OFFSET bit. */
-
- if ( have_scale &&
-#ifdef TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED
- !( subglyph->flags & UNSCALED_COMPONENT_OFFSET ) )
-#else
- ( subglyph->flags & SCALED_COMPONENT_OFFSET ) )
-#endif
- {
-
-#if 0
-
- /*******************************************************************/
- /* */
- /* This algorithm is what Apple documents. But it doesn't work. */
- /* */
- int a = subglyph->transform.xx > 0 ? subglyph->transform.xx
- : -subglyph->transform.xx;
- int b = subglyph->transform.yx > 0 ? subglyph->transform.yx
- : -subglyph->transform.yx;
- int c = subglyph->transform.xy > 0 ? subglyph->transform.xy
- : -subglyph->transform.xy;
- int d = subglyph->transform.yy > 0 ? subglyph->transform.yy
- : -subglyph->transform.yy;
- int m = a > b ? a : b;
- int n = c > d ? c : d;
-
-
- if ( a - b <= 33 && a - b >= -33 )
- m *= 2;
- if ( c - d <= 33 && c - d >= -33 )
- n *= 2;
- x = FT_MulFix( x, m );
- y = FT_MulFix( y, n );
-
-#else /* 1 */
-
- /*******************************************************************/
- /* */
- /* This algorithm is a guess and works much better than the above. */
- /* */
- FT_Fixed mac_xscale = FT_Hypot( subglyph->transform.xx,
- subglyph->transform.xy );
- FT_Fixed mac_yscale = FT_Hypot( subglyph->transform.yy,
- subglyph->transform.yx );
-
-
- x = FT_MulFix( x, mac_xscale );
- y = FT_MulFix( y, mac_yscale );
-
-#endif /* 1 */
-
- }
-
- if ( !( loader->load_flags & FT_LOAD_NO_SCALE ) )
- {
- FT_Fixed x_scale = loader->size->metrics.x_scale;
- FT_Fixed y_scale = loader->size->metrics.y_scale;
-
-
- x = FT_MulFix( x, x_scale );
- y = FT_MulFix( y, y_scale );
-
- if ( subglyph->flags & ROUND_XY_TO_GRID )
- {
- x = FT_PIX_ROUND( x );
- y = FT_PIX_ROUND( y );
- }
- }
- }
-
- if ( x || y )
- FT_Outline_Translate( &current, x, y );
-
- return FT_Err_Ok;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Process_Composite_Glyph */
- /* */
- /* <Description> */
- /* This is slightly different from TT_Process_Simple_Glyph, in that */
- /* its sole purpose is to hint the glyph. Thus this function is */
- /* only available when bytecode interpreter is enabled. */
- /* */
- static FT_Error
- TT_Process_Composite_Glyph( TT_Loader loader,
- FT_UInt start_point,
- FT_UInt start_contour )
- {
- FT_Error error;
- FT_Outline* outline;
- FT_UInt i;
-
-
- outline = &loader->gloader->base.outline;
-
- /* make room for phantom points */
- error = FT_GLYPHLOADER_CHECK_POINTS( loader->gloader,
- outline->n_points + 4,
- 0 );
- if ( error )
- return error;
-
- outline->points[outline->n_points ] = loader->pp1;
- outline->points[outline->n_points + 1] = loader->pp2;
- outline->points[outline->n_points + 2] = loader->pp3;
- outline->points[outline->n_points + 3] = loader->pp4;
-
- outline->tags[outline->n_points ] = 0;
- outline->tags[outline->n_points + 1] = 0;
- outline->tags[outline->n_points + 2] = 0;
- outline->tags[outline->n_points + 3] = 0;
-
-#ifdef TT_USE_BYTECODE_INTERPRETER
-
- {
- FT_Stream stream = loader->stream;
- FT_UShort n_ins, max_ins;
- FT_ULong tmp;
-
-
- /* TT_Load_Composite_Glyph only gives us the offset of instructions */
- /* so we read them here */
- if ( FT_STREAM_SEEK( loader->ins_pos ) ||
- FT_READ_USHORT( n_ins ) )
- return error;
-
- FT_TRACE5(( " Instructions size = %d\n", n_ins ));
-
- /* check it */
- max_ins = loader->face->max_profile.maxSizeOfInstructions;
- if ( n_ins > max_ins )
- {
- /* don't trust `maxSizeOfInstructions'; */
- /* only do a rough safety check */
- if ( (FT_Int)n_ins > loader->byte_len )
- {
- FT_TRACE1(( "TT_Process_Composite_Glyph:"
- " too many instructions (%d) for glyph with length %d\n",
- n_ins, loader->byte_len ));
- return FT_THROW( Too_Many_Hints );
- }
-
- tmp = loader->exec->glyphSize;
- error = Update_Max( loader->exec->memory,
- &tmp,
- sizeof ( FT_Byte ),
- (void*)&loader->exec->glyphIns,
- n_ins );
-
- loader->exec->glyphSize = (FT_UShort)tmp;
- if ( error )
- return error;
- }
- else if ( n_ins == 0 )
- return FT_Err_Ok;
-
- if ( FT_STREAM_READ( loader->exec->glyphIns, n_ins ) )
- return error;
-
- loader->glyph->control_data = loader->exec->glyphIns;
- loader->glyph->control_len = n_ins;
- }
-
-#endif
-
- tt_prepare_zone( &loader->zone, &loader->gloader->base,
- start_point, start_contour );
-
- /* Some points are likely touched during execution of */
- /* instructions on components. So let's untouch them. */
- for ( i = 0; i < loader->zone.n_points; i++ )
- loader->zone.tags[i] &= ~FT_CURVE_TAG_TOUCH_BOTH;
-
- loader->zone.n_points += 4;
-
- return TT_Hint_Glyph( loader, 1 );
- }
-
-
- /*
- * Calculate the phantom points
- *
- * Defining the right side bearing (rsb) as
- *
- * rsb = aw - (lsb + xmax - xmin)
- *
- * (with `aw' the advance width, `lsb' the left side bearing, and `xmin'
- * and `xmax' the glyph's minimum and maximum x value), the OpenType
- * specification defines the initial position of horizontal phantom points
- * as
- *
- * pp1 = (round(xmin - lsb), 0) ,
- * pp2 = (round(pp1 + aw), 0) .
- *
- * Note that the rounding to the grid (in the device space) is not
- * documented currently in the specification.
- *
- * However, the specification lacks the precise definition of vertical
- * phantom points. Greg Hitchcock provided the following explanation.
- *
- * - a `vmtx' table is present
- *
- * For any glyph, the minimum and maximum y values (`ymin' and `ymax')
- * are given in the `glyf' table, the top side bearing (tsb) and advance
- * height (ah) are given in the `vmtx' table. The bottom side bearing
- * (bsb) is then calculated as
- *
- * bsb = ah - (tsb + ymax - ymin) ,
- *
- * and the initial position of vertical phantom points is
- *
- * pp3 = (x, round(ymax + tsb)) ,
- * pp4 = (x, round(pp3 - ah)) .
- *
- * See below for value `x'.
- *
- * - no `vmtx' table in the font
- *
- * If there is an `OS/2' table, we set
- *
- * DefaultAscender = sTypoAscender ,
- * DefaultDescender = sTypoDescender ,
- *
- * otherwise we use data from the `hhea' table:
- *
- * DefaultAscender = Ascender ,
- * DefaultDescender = Descender .
- *
- * With these two variables we can now set
- *
- * ah = DefaultAscender - sDefaultDescender ,
- * tsb = DefaultAscender - yMax ,
- *
- * and proceed as if a `vmtx' table was present.
- *
- * Usually we have
- *
- * x = aw / 2 , (1)
- *
- * but there is one compatibility case where it can be set to
- *
- * x = -DefaultDescender -
- * ((DefaultAscender - DefaultDescender - aw) / 2) . (2)
- *
- * and another one with
- *
- * x = 0 . (3)
- *
- * In Windows, the history of those values is quite complicated,
- * depending on the hinting engine (that is, the graphics framework).
- *
- * framework from to formula
- * ----------------------------------------------------------
- * GDI Windows 98 current (1)
- * (Windows 2000 for NT)
- * GDI+ Windows XP Windows 7 (2)
- * GDI+ Windows 8 current (3)
- * DWrite Windows 7 current (3)
- *
- * For simplicity, FreeType uses (1) for grayscale subpixel hinting and
- * (3) for everything else.
- *
- */
-#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
-
-#define TT_LOADER_SET_PP( loader ) \
- do \
- { \
- FT_Bool subpixel_hinting_ = loader->exec \
- ? loader->exec->subpixel_hinting \
- : 0; \
- FT_Bool grayscale_ = loader->exec \
- ? loader->exec->grayscale \
- : 0; \
- FT_Bool use_aw_2_ = (FT_Bool)( subpixel_hinting_ && \
- grayscale_ ); \
- \
- \
- (loader)->pp1.x = (loader)->bbox.xMin - (loader)->left_bearing; \
- (loader)->pp1.y = 0; \
- (loader)->pp2.x = (loader)->pp1.x + (loader)->advance; \
- (loader)->pp2.y = 0; \
- \
- (loader)->pp3.x = use_aw_2_ ? (loader)->advance / 2 : 0; \
- (loader)->pp3.y = (loader)->bbox.yMax + (loader)->top_bearing; \
- (loader)->pp4.x = use_aw_2_ ? (loader)->advance / 2 : 0; \
- (loader)->pp4.y = (loader)->pp3.y - (loader)->vadvance; \
- } while ( 0 )
-
-#else /* !TT_CONFIG_OPTION_SUBPIXEL_HINTING */
-
-#define TT_LOADER_SET_PP( loader ) \
- do \
- { \
- (loader)->pp1.x = (loader)->bbox.xMin - (loader)->left_bearing; \
- (loader)->pp1.y = 0; \
- (loader)->pp2.x = (loader)->pp1.x + (loader)->advance; \
- (loader)->pp2.y = 0; \
- \
- (loader)->pp3.x = 0; \
- (loader)->pp3.y = (loader)->bbox.yMax + (loader)->top_bearing; \
- (loader)->pp4.x = 0; \
- (loader)->pp4.y = (loader)->pp3.y - (loader)->vadvance; \
- } while ( 0 )
-
-#endif /* !TT_CONFIG_OPTION_SUBPIXEL_HINTING */
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* load_truetype_glyph */
- /* */
- /* <Description> */
- /* Loads a given truetype glyph. Handles composites and uses a */
- /* TT_Loader object. */
- /* */
- static FT_Error
- load_truetype_glyph( TT_Loader loader,
- FT_UInt glyph_index,
- FT_UInt recurse_count,
- FT_Bool header_only )
- {
- FT_Error error = FT_Err_Ok;
- FT_Fixed x_scale, y_scale;
- FT_ULong offset;
- TT_Face face = loader->face;
- FT_GlyphLoader gloader = loader->gloader;
- FT_Bool opened_frame = 0;
-
-#ifdef FT_CONFIG_OPTION_INCREMENTAL
- FT_StreamRec inc_stream;
- FT_Data glyph_data;
- FT_Bool glyph_data_loaded = 0;
-#endif
-
-
- /* some fonts have an incorrect value of `maxComponentDepth', */
- /* thus we allow depth 1 to catch the majority of them */
- if ( recurse_count > 1 &&
- recurse_count > face->max_profile.maxComponentDepth )
- {
- error = FT_THROW( Invalid_Composite );
- goto Exit;
- }
-
-#ifndef FT_CONFIG_OPTION_INCREMENTAL
- /* check glyph index */
- if ( glyph_index >= (FT_UInt)face->root.num_glyphs )
- {
- error = FT_THROW( Invalid_Glyph_Index );
- goto Exit;
- }
-#endif
-
- loader->glyph_index = glyph_index;
-
- if ( ( loader->load_flags & FT_LOAD_NO_SCALE ) == 0 )
- {
- x_scale = loader->size->metrics.x_scale;
- y_scale = loader->size->metrics.y_scale;
- }
- else
- {
- x_scale = 0x10000L;
- y_scale = 0x10000L;
- }
-
- /* Set `offset' to the start of the glyph relative to the start of */
- /* the `glyf' table, and `byte_len' to the length of the glyph in */
- /* bytes. */
-
-#ifdef FT_CONFIG_OPTION_INCREMENTAL
-
- /* If we are loading glyph data via the incremental interface, set */
- /* the loader stream to a memory stream reading the data returned */
- /* by the interface. */
- if ( face->root.internal->incremental_interface )
- {
- error = face->root.internal->incremental_interface->funcs->get_glyph_data(
- face->root.internal->incremental_interface->object,
- glyph_index, &glyph_data );
- if ( error )
- goto Exit;
-
- glyph_data_loaded = 1;
- offset = 0;
- loader->byte_len = glyph_data.length;
-
- FT_MEM_ZERO( &inc_stream, sizeof ( inc_stream ) );
- FT_Stream_OpenMemory( &inc_stream,
- glyph_data.pointer,
- (FT_ULong)glyph_data.length );
-
- loader->stream = &inc_stream;
- }
- else
-
-#endif /* FT_CONFIG_OPTION_INCREMENTAL */
-
- offset = tt_face_get_location( face, glyph_index,
- (FT_UInt*)&loader->byte_len );
-
- if ( loader->byte_len > 0 )
- {
-#ifdef FT_CONFIG_OPTION_INCREMENTAL
- /* for the incremental interface, `glyf_offset' is always zero */
- if ( !loader->glyf_offset &&
- !face->root.internal->incremental_interface )
-#else
- if ( !loader->glyf_offset )
-#endif /* FT_CONFIG_OPTION_INCREMENTAL */
- {
- FT_TRACE2(( "no `glyf' table but non-zero `loca' entry\n" ));
- error = FT_THROW( Invalid_Table );
- goto Exit;
- }
-
- error = face->access_glyph_frame( loader, glyph_index,
- loader->glyf_offset + offset,
- (FT_UInt)loader->byte_len );
- if ( error )
- goto Exit;
-
- opened_frame = 1;
-
- /* read glyph header first */
- error = face->read_glyph_header( loader );
- if ( error )
- goto Exit;
-
- /* the metrics must be computed after loading the glyph header */
- /* since we need the glyph's `yMax' value in case the vertical */
- /* metrics must be emulated */
- error = tt_get_metrics( loader, glyph_index );
- if ( error )
- goto Exit;
-
- if ( header_only )
- goto Exit;
- }
-
- if ( loader->byte_len == 0 || loader->n_contours == 0 )
- {
- loader->bbox.xMin = 0;
- loader->bbox.xMax = 0;
- loader->bbox.yMin = 0;
- loader->bbox.yMax = 0;
-
- error = tt_get_metrics( loader, glyph_index );
- if ( error )
- goto Exit;
-
- if ( header_only )
- goto Exit;
-
- /* must initialize points before (possibly) overriding */
- /* glyph metrics from the incremental interface */
- TT_LOADER_SET_PP( loader );
-
-#ifdef FT_CONFIG_OPTION_INCREMENTAL
- tt_get_metrics_incr_overrides( loader, glyph_index );
-#endif
-
-#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
-
- if ( loader->face->doblend )
- {
- /* a small outline structure with four elements for */
- /* communication with `TT_Vary_Apply_Glyph_Deltas' */
- FT_Vector points[4];
- char tags[4] = { 1, 1, 1, 1 };
- short contours[4] = { 0, 1, 2, 3 };
- FT_Outline outline;
-
-
- points[0].x = loader->pp1.x;
- points[0].y = loader->pp1.y;
- points[1].x = loader->pp2.x;
- points[1].y = loader->pp2.y;
-
- points[2].x = loader->pp3.x;
- points[2].y = loader->pp3.y;
- points[3].x = loader->pp4.x;
- points[3].y = loader->pp4.y;
-
- outline.n_points = 4;
- outline.n_contours = 4;
- outline.points = points;
- outline.tags = tags;
- outline.contours = contours;
-
- /* this must be done before scaling */
- error = TT_Vary_Apply_Glyph_Deltas( loader->face,
- glyph_index,
- &outline,
- (FT_UInt)outline.n_points );
- if ( error )
- goto Exit;
-
- loader->pp1.x = points[0].x;
- loader->pp1.y = points[0].y;
- loader->pp2.x = points[1].x;
- loader->pp2.y = points[1].y;
-
- loader->pp3.x = points[2].x;
- loader->pp3.y = points[2].y;
- loader->pp4.x = points[3].x;
- loader->pp4.y = points[3].y;
- }
-
-#endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */
-
- /* scale phantom points, if necessary; */
- /* they get rounded in `TT_Hint_Glyph' */
- if ( ( loader->load_flags & FT_LOAD_NO_SCALE ) == 0 )
- {
- loader->pp1.x = FT_MulFix( loader->pp1.x, x_scale );
- loader->pp2.x = FT_MulFix( loader->pp2.x, x_scale );
- /* pp1.y and pp2.y are always zero */
-
- loader->pp3.x = FT_MulFix( loader->pp3.x, x_scale );
- loader->pp3.y = FT_MulFix( loader->pp3.y, y_scale );
- loader->pp4.x = FT_MulFix( loader->pp4.x, x_scale );
- loader->pp4.y = FT_MulFix( loader->pp4.y, y_scale );
- }
-
- error = FT_Err_Ok;
- goto Exit;
- }
-
- /* must initialize phantom points before (possibly) overriding */
- /* glyph metrics from the incremental interface */
- TT_LOADER_SET_PP( loader );
-
-#ifdef FT_CONFIG_OPTION_INCREMENTAL
- tt_get_metrics_incr_overrides( loader, glyph_index );
-#endif
-
- /***********************************************************************/
- /***********************************************************************/
- /***********************************************************************/
-
- /* if it is a simple glyph, load it */
-
- if ( loader->n_contours > 0 )
- {
- error = face->read_simple_glyph( loader );
- if ( error )
- goto Exit;
-
- /* all data have been read */
- face->forget_glyph_frame( loader );
- opened_frame = 0;
-
- error = TT_Process_Simple_Glyph( loader );
- if ( error )
- goto Exit;
-
- FT_GlyphLoader_Add( gloader );
- }
-
- /***********************************************************************/
- /***********************************************************************/
- /***********************************************************************/
-
- /* otherwise, load a composite! */
- else if ( loader->n_contours == -1 )
- {
- FT_UInt start_point;
- FT_UInt start_contour;
- FT_ULong ins_pos; /* position of composite instructions, if any */
-
-
- start_point = (FT_UInt)gloader->base.outline.n_points;
- start_contour = (FT_UInt)gloader->base.outline.n_contours;
-
- /* for each subglyph, read composite header */
- error = face->read_composite_glyph( loader );
- if ( error )
- goto Exit;
-
- /* store the offset of instructions */
- ins_pos = loader->ins_pos;
-
- /* all data we need are read */
- face->forget_glyph_frame( loader );
- opened_frame = 0;
-
-#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
-
- if ( face->doblend )
- {
- short i, limit;
- FT_SubGlyph subglyph;
-
- FT_Outline outline;
- FT_Vector* points = NULL;
- char* tags = NULL;
- short* contours = NULL;
-
- FT_Memory memory = face->root.memory;
-
-
- limit = (short)gloader->current.num_subglyphs;
-
- /* construct an outline structure for */
- /* communication with `TT_Vary_Apply_Glyph_Deltas' */
- outline.n_points = (short)( gloader->current.num_subglyphs + 4 );
- outline.n_contours = outline.n_points;
-
- if ( FT_NEW_ARRAY( points, outline.n_points ) ||
- FT_NEW_ARRAY( tags, outline.n_points ) ||
- FT_NEW_ARRAY( contours, outline.n_points ) )
- goto Exit1;
-
- subglyph = gloader->current.subglyphs;
-
- for ( i = 0; i < limit; i++, subglyph++ )
- {
- /* applying deltas for anchor points doesn't make sense, */
- /* but we don't have to specially check this since */
- /* unused delta values are zero anyways */
- points[i].x = subglyph->arg1;
- points[i].y = subglyph->arg2;
- tags[i] = 1;
- contours[i] = i;
- }
-
- points[i].x = loader->pp1.x;
- points[i].y = loader->pp1.y;
- tags[i] = 1;
- contours[i] = i;
-
- i++;
- points[i].x = loader->pp2.x;
- points[i].y = loader->pp2.y;
- tags[i] = 1;
- contours[i] = i;
-
- i++;
- points[i].x = loader->pp3.x;
- points[i].y = loader->pp3.y;
- tags[i] = 1;
- contours[i] = i;
-
- i++;
- points[i].x = loader->pp4.x;
- points[i].y = loader->pp4.y;
- tags[i] = 1;
- contours[i] = i;
-
- outline.points = points;
- outline.tags = tags;
- outline.contours = contours;
-
- /* this call provides additional offsets */
- /* for each component's translation */
- if ( ( error = TT_Vary_Apply_Glyph_Deltas(
- face,
- glyph_index,
- &outline,
- (FT_UInt)outline.n_points ) ) != 0 )
- goto Exit1;
-
- subglyph = gloader->current.subglyphs;
-
- for ( i = 0; i < limit; i++, subglyph++ )
- {
- /* XXX: overflow check for subglyph->{arg1,arg2}. */
- /* Deltas must be within signed 16-bit, */
- /* but the restriction of summed deltas is not clear */
- subglyph->arg1 = (FT_Int16)points[i].x;
- subglyph->arg2 = (FT_Int16)points[i].y;
- }
-
- loader->pp1.x = points[i + 0].x;
- loader->pp1.y = points[i + 0].y;
- loader->pp2.x = points[i + 1].x;
- loader->pp2.y = points[i + 1].y;
-
- loader->pp3.x = points[i + 2].x;
- loader->pp3.y = points[i + 2].y;
- loader->pp4.x = points[i + 3].x;
- loader->pp4.y = points[i + 3].y;
-
- Exit1:
- FT_FREE( outline.points );
- FT_FREE( outline.tags );
- FT_FREE( outline.contours );
-
- if ( error )
- goto Exit;
- }
-
-#endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */
-
- /* scale phantom points, if necessary; */
- /* they get rounded in `TT_Hint_Glyph' */
- if ( ( loader->load_flags & FT_LOAD_NO_SCALE ) == 0 )
- {
- loader->pp1.x = FT_MulFix( loader->pp1.x, x_scale );
- loader->pp2.x = FT_MulFix( loader->pp2.x, x_scale );
- /* pp1.y and pp2.y are always zero */
-
- loader->pp3.x = FT_MulFix( loader->pp3.x, x_scale );
- loader->pp3.y = FT_MulFix( loader->pp3.y, y_scale );
- loader->pp4.x = FT_MulFix( loader->pp4.x, x_scale );
- loader->pp4.y = FT_MulFix( loader->pp4.y, y_scale );
- }
-
- /* if the flag FT_LOAD_NO_RECURSE is set, we return the subglyph */
- /* `as is' in the glyph slot (the client application will be */
- /* responsible for interpreting these data)... */
- if ( loader->load_flags & FT_LOAD_NO_RECURSE )
- {
- FT_GlyphLoader_Add( gloader );
- loader->glyph->format = FT_GLYPH_FORMAT_COMPOSITE;
-
- goto Exit;
- }
-
- /*********************************************************************/
- /*********************************************************************/
- /*********************************************************************/
-
- {
- FT_UInt n, num_base_points;
- FT_SubGlyph subglyph = NULL;
-
- FT_UInt num_points = start_point;
- FT_UInt num_subglyphs = gloader->current.num_subglyphs;
- FT_UInt num_base_subgs = gloader->base.num_subglyphs;
-
- FT_Stream old_stream = loader->stream;
- FT_Int old_byte_len = loader->byte_len;
-
-
- FT_GlyphLoader_Add( gloader );
-
- /* read each subglyph independently */
- for ( n = 0; n < num_subglyphs; n++ )
- {
- FT_Vector pp[4];
-
-
- /* Each time we call load_truetype_glyph in this loop, the */
- /* value of `gloader.base.subglyphs' can change due to table */
- /* reallocations. We thus need to recompute the subglyph */
- /* pointer on each iteration. */
- subglyph = gloader->base.subglyphs + num_base_subgs + n;
-
- pp[0] = loader->pp1;
- pp[1] = loader->pp2;
- pp[2] = loader->pp3;
- pp[3] = loader->pp4;
-
- num_base_points = (FT_UInt)gloader->base.outline.n_points;
-
- error = load_truetype_glyph( loader,
- (FT_UInt)subglyph->index,
- recurse_count + 1,
- FALSE );
- if ( error )
- goto Exit;
-
- /* restore subglyph pointer */
- subglyph = gloader->base.subglyphs + num_base_subgs + n;
-
- /* restore phantom points if necessary */
- if ( !( subglyph->flags & USE_MY_METRICS ) )
- {
- loader->pp1 = pp[0];
- loader->pp2 = pp[1];
- loader->pp3 = pp[2];
- loader->pp4 = pp[3];
- }
-
- num_points = (FT_UInt)gloader->base.outline.n_points;
-
- if ( num_points == num_base_points )
- continue;
-
- /* gloader->base.outline consists of three parts: */
- /* 0 -(1)-> start_point -(2)-> num_base_points -(3)-> n_points. */
- /* */
- /* (1): exists from the beginning */
- /* (2): components that have been loaded so far */
- /* (3): the newly loaded component */
- error = TT_Process_Composite_Component( loader,
- subglyph,
- start_point,
- num_base_points );
- if ( error )
- goto Exit;
- }
-
- loader->stream = old_stream;
- loader->byte_len = old_byte_len;
-
- /* process the glyph */
- loader->ins_pos = ins_pos;
- if ( IS_HINTED( loader->load_flags ) &&
-#ifdef TT_USE_BYTECODE_INTERPRETER
- subglyph->flags & WE_HAVE_INSTR &&
-#endif
- num_points > start_point )
- {
- error = TT_Process_Composite_Glyph( loader,
- start_point,
- start_contour );
- if ( error )
- goto Exit;
- }
- }
- }
- else
- {
- /* invalid composite count (negative but not -1) */
- error = FT_THROW( Invalid_Outline );
- goto Exit;
- }
-
- /***********************************************************************/
- /***********************************************************************/
- /***********************************************************************/
-
- Exit:
-
- if ( opened_frame )
- face->forget_glyph_frame( loader );
-
-#ifdef FT_CONFIG_OPTION_INCREMENTAL
-
- if ( glyph_data_loaded )
- face->root.internal->incremental_interface->funcs->free_glyph_data(
- face->root.internal->incremental_interface->object,
- &glyph_data );
-
-#endif
-
- return error;
- }
-
-
- static FT_Error
- compute_glyph_metrics( TT_Loader loader,
- FT_UInt glyph_index )
- {
- TT_Face face = loader->face;
-#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
- TT_Driver driver = (TT_Driver)FT_FACE_DRIVER( face );
-#endif
-
- FT_BBox bbox;
- FT_Fixed y_scale;
- TT_GlyphSlot glyph = loader->glyph;
- TT_Size size = loader->size;
-
-
- y_scale = 0x10000L;
- if ( ( loader->load_flags & FT_LOAD_NO_SCALE ) == 0 )
- y_scale = size->root.metrics.y_scale;
-
- if ( glyph->format != FT_GLYPH_FORMAT_COMPOSITE )
- FT_Outline_Get_CBox( &glyph->outline, &bbox );
- else
- bbox = loader->bbox;
-
- /* get the device-independent horizontal advance; it is scaled later */
- /* by the base layer. */
- glyph->linearHoriAdvance = loader->linear;
-
- glyph->metrics.horiBearingX = bbox.xMin;
- glyph->metrics.horiBearingY = bbox.yMax;
- glyph->metrics.horiAdvance = loader->pp2.x - loader->pp1.x;
-
- /* adjust advance width to the value contained in the hdmx table */
- /* unless FT_LOAD_COMPUTE_METRICS is set */
- if ( !face->postscript.isFixedPitch &&
- IS_HINTED( loader->load_flags ) &&
- !( loader->load_flags & FT_LOAD_COMPUTE_METRICS ) )
- {
- FT_Byte* widthp;
-
-
- widthp = tt_face_get_device_metrics( face,
- size->root.metrics.x_ppem,
- glyph_index );
-
-#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
-
- if ( driver->interpreter_version == TT_INTERPRETER_VERSION_38 )
- {
- FT_Bool ignore_x_mode;
-
-
- ignore_x_mode = FT_BOOL( FT_LOAD_TARGET_MODE( loader->load_flags ) !=
- FT_RENDER_MODE_MONO );
-
- if ( widthp &&
- ( ( ignore_x_mode && loader->exec->compatible_widths ) ||
- !ignore_x_mode ||
- SPH_OPTION_BITMAP_WIDTHS ) )
- glyph->metrics.horiAdvance = *widthp * 64;
- }
- else
-
-#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */
-
- {
- if ( widthp )
- glyph->metrics.horiAdvance = *widthp * 64;
- }
- }
-
- /* set glyph dimensions */
- glyph->metrics.width = bbox.xMax - bbox.xMin;
- glyph->metrics.height = bbox.yMax - bbox.yMin;
-
- /* Now take care of vertical metrics. In the case where there is */
- /* no vertical information within the font (relatively common), */
- /* create some metrics manually */
- {
- FT_Pos top; /* scaled vertical top side bearing */
- FT_Pos advance; /* scaled vertical advance height */
-
-
- /* Get the unscaled top bearing and advance height. */
- if ( face->vertical_info &&
- face->vertical.number_Of_VMetrics > 0 )
- {
- top = (FT_Short)FT_DivFix( loader->pp3.y - bbox.yMax,
- y_scale );
-
- if ( loader->pp3.y <= loader->pp4.y )
- advance = 0;
- else
- advance = (FT_UShort)FT_DivFix( loader->pp3.y - loader->pp4.y,
- y_scale );
- }
- else
- {
- FT_Pos height;
-
-
- /* XXX Compute top side bearing and advance height in */
- /* Get_VMetrics instead of here. */
-
- /* NOTE: The OS/2 values are the only `portable' ones, */
- /* which is why we use them, if there is an OS/2 */
- /* table in the font. Otherwise, we use the */
- /* values defined in the horizontal header. */
-
- height = (FT_Short)FT_DivFix( bbox.yMax - bbox.yMin,
- y_scale );
- if ( face->os2.version != 0xFFFFU )
- advance = (FT_Pos)( face->os2.sTypoAscender -
- face->os2.sTypoDescender );
- else
- advance = (FT_Pos)( face->horizontal.Ascender -
- face->horizontal.Descender );
-
- top = ( advance - height ) / 2;
- }
-
-#ifdef FT_CONFIG_OPTION_INCREMENTAL
- {
- FT_Incremental_InterfaceRec* incr;
- FT_Incremental_MetricsRec metrics;
- FT_Error error;
-
-
- incr = face->root.internal->incremental_interface;
-
- /* If this is an incrementally loaded font see if there are */
- /* overriding metrics for this glyph. */
- if ( incr && incr->funcs->get_glyph_metrics )
- {
- metrics.bearing_x = 0;
- metrics.bearing_y = top;
- metrics.advance = advance;
-
- error = incr->funcs->get_glyph_metrics( incr->object,
- glyph_index,
- TRUE,
- &metrics );
- if ( error )
- return error;
-
- top = metrics.bearing_y;
- advance = metrics.advance;
- }
- }
-
- /* GWW: Do vertical metrics get loaded incrementally too? */
-
-#endif /* FT_CONFIG_OPTION_INCREMENTAL */
-
- glyph->linearVertAdvance = advance;
-
- /* scale the metrics */
- if ( !( loader->load_flags & FT_LOAD_NO_SCALE ) )
- {
- top = FT_MulFix( top, y_scale );
- advance = FT_MulFix( advance, y_scale );
- }
-
- /* XXX: for now, we have no better algorithm for the lsb, but it */
- /* should work fine. */
- /* */
- glyph->metrics.vertBearingX = glyph->metrics.horiBearingX -
- glyph->metrics.horiAdvance / 2;
- glyph->metrics.vertBearingY = top;
- glyph->metrics.vertAdvance = advance;
- }
-
- return 0;
- }
-
-
-#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
-
- static FT_Error
- load_sbit_image( TT_Size size,
- TT_GlyphSlot glyph,
- FT_UInt glyph_index,
- FT_Int32 load_flags )
- {
- TT_Face face;
- SFNT_Service sfnt;
- FT_Stream stream;
- FT_Error error;
- TT_SBit_MetricsRec metrics;
-
-
- face = (TT_Face)glyph->face;
- sfnt = (SFNT_Service)face->sfnt;
- stream = face->root.stream;
-
- error = sfnt->load_sbit_image( face,
- size->strike_index,
- glyph_index,
- (FT_UInt)load_flags,
- stream,
- &glyph->bitmap,
- &metrics );
- if ( !error )
- {
- glyph->outline.n_points = 0;
- glyph->outline.n_contours = 0;
-
- glyph->metrics.width = (FT_Pos)metrics.width * 64;
- glyph->metrics.height = (FT_Pos)metrics.height * 64;
-
- glyph->metrics.horiBearingX = (FT_Pos)metrics.horiBearingX * 64;
- glyph->metrics.horiBearingY = (FT_Pos)metrics.horiBearingY * 64;
- glyph->metrics.horiAdvance = (FT_Pos)metrics.horiAdvance * 64;
-
- glyph->metrics.vertBearingX = (FT_Pos)metrics.vertBearingX * 64;
- glyph->metrics.vertBearingY = (FT_Pos)metrics.vertBearingY * 64;
- glyph->metrics.vertAdvance = (FT_Pos)metrics.vertAdvance * 64;
-
- glyph->format = FT_GLYPH_FORMAT_BITMAP;
-
- if ( load_flags & FT_LOAD_VERTICAL_LAYOUT )
- {
- glyph->bitmap_left = metrics.vertBearingX;
- glyph->bitmap_top = metrics.vertBearingY;
- }
- else
- {
- glyph->bitmap_left = metrics.horiBearingX;
- glyph->bitmap_top = metrics.horiBearingY;
- }
- }
-
- return error;
- }
-
-#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
-
-
- static FT_Error
- tt_loader_init( TT_Loader loader,
- TT_Size size,
- TT_GlyphSlot glyph,
- FT_Int32 load_flags,
- FT_Bool glyf_table_only )
- {
- FT_Error error;
-
- TT_Face face;
- FT_Stream stream;
-#ifdef TT_USE_BYTECODE_INTERPRETER
- FT_Bool pedantic = FT_BOOL( load_flags & FT_LOAD_PEDANTIC );
-#endif
-
-
- face = (TT_Face)glyph->face;
- stream = face->root.stream;
-
- FT_MEM_ZERO( loader, sizeof ( TT_LoaderRec ) );
-
-#ifdef TT_USE_BYTECODE_INTERPRETER
-
- /* load execution context */
- if ( IS_HINTED( load_flags ) && !glyf_table_only )
- {
- TT_ExecContext exec;
- FT_Bool grayscale;
-
-#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
- TT_Driver driver = (TT_Driver)FT_FACE_DRIVER( face );
-
- FT_Bool subpixel_hinting = FALSE;
-
-#if 0
- /* not used yet */
- FT_Bool compatible_widths;
- FT_Bool symmetrical_smoothing;
- FT_Bool bgr;
- FT_Bool vertical_lcd;
- FT_Bool subpixel_positioned;
- FT_Bool gray_cleartype;
-#endif
-#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */
-
- FT_Bool reexecute = FALSE;
-
-
- if ( size->bytecode_ready < 0 || size->cvt_ready < 0 )
- {
- error = tt_size_ready_bytecode( size, pedantic );
- if ( error )
- return error;
- }
- else if ( size->bytecode_ready )
- return size->bytecode_ready;
- else if ( size->cvt_ready )
- return size->cvt_ready;
-
- /* query new execution context */
- exec = size->context;
- if ( !exec )
- return FT_THROW( Could_Not_Find_Context );
-
-#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
-
- if ( driver->interpreter_version == TT_INTERPRETER_VERSION_38 )
- {
- subpixel_hinting = FT_BOOL( ( FT_LOAD_TARGET_MODE( load_flags ) !=
- FT_RENDER_MODE_MONO ) &&
- SPH_OPTION_SET_SUBPIXEL );
-
- if ( subpixel_hinting )
- grayscale = FALSE;
- else if ( SPH_OPTION_SET_GRAYSCALE )
- {
- grayscale = TRUE;
- subpixel_hinting = FALSE;
- }
- else
- grayscale = FALSE;
-
- if ( FT_IS_TRICKY( glyph->face ) )
- subpixel_hinting = FALSE;
-
- exec->ignore_x_mode = subpixel_hinting || grayscale;
- exec->rasterizer_version = SPH_OPTION_SET_RASTERIZER_VERSION;
- if ( exec->sph_tweak_flags & SPH_TWEAK_RASTERIZER_35 )
- exec->rasterizer_version = TT_INTERPRETER_VERSION_35;
-
-#if 1
- exec->compatible_widths = SPH_OPTION_SET_COMPATIBLE_WIDTHS;
- exec->symmetrical_smoothing = TRUE;
- exec->bgr = FALSE;
- exec->vertical_lcd = FALSE;
- exec->subpixel_positioned = TRUE;
- exec->gray_cleartype = FALSE;
-#else /* 0 */
- exec->compatible_widths =
- FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) !=
- TT_LOAD_COMPATIBLE_WIDTHS );
- exec->symmetrical_smoothing =
- FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) !=
- TT_LOAD_SYMMETRICAL_SMOOTHING );
- exec->bgr =
- FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) !=
- TT_LOAD_BGR );
- exec->vertical_lcd =
- FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) !=
- TT_LOAD_VERTICAL_LCD );
- exec->subpixel_positioned =
- FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) !=
- TT_LOAD_SUBPIXEL_POSITIONED );
- exec->gray_cleartype =
- FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) !=
- TT_LOAD_GRAY_CLEARTYPE );
-#endif /* 0 */
-
- }
- else
-
-#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */
-
- {
- grayscale = FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) !=
- FT_RENDER_MODE_MONO );
- }
-
- error = TT_Load_Context( exec, face, size );
- if ( error )
- return error;
-
-#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
-
- if ( driver->interpreter_version == TT_INTERPRETER_VERSION_38 )
- {
- /* a change from mono to subpixel rendering (and vice versa) */
- /* requires a re-execution of the CVT program */
- if ( subpixel_hinting != exec->subpixel_hinting )
- {
- FT_TRACE4(( "tt_loader_init: subpixel hinting change,"
- " re-executing `prep' table\n" ));
-
- exec->subpixel_hinting = subpixel_hinting;
- reexecute = TRUE;
- }
-
- /* a change from mono to grayscale rendering (and vice versa) */
- /* requires a re-execution of the CVT program */
- if ( grayscale != exec->grayscale )
- {
- FT_TRACE4(( "tt_loader_init: grayscale hinting change,"
- " re-executing `prep' table\n" ));
-
- exec->grayscale = grayscale;
- reexecute = TRUE;
- }
- }
- else
-
-#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */
-
- {
- /* a change from mono to grayscale rendering (and vice versa) */
- /* requires a re-execution of the CVT program */
- if ( grayscale != exec->grayscale )
- {
- FT_TRACE4(( "tt_loader_init: grayscale hinting change,"
- " re-executing `prep' table\n" ));
-
- exec->grayscale = grayscale;
- reexecute = TRUE;
- }
- }
-
- if ( reexecute )
- {
- FT_UInt i;
-
-
- for ( i = 0; i < size->cvt_size; i++ )
- size->cvt[i] = FT_MulFix( face->cvt[i], size->ttmetrics.scale );
- error = tt_size_run_prep( size, pedantic );
- if ( error )
- return error;
- }
-
- /* check whether the cvt program has disabled hinting */
- if ( exec->GS.instruct_control & 1 )
- load_flags |= FT_LOAD_NO_HINTING;
-
- /* load default graphics state -- if needed */
- if ( exec->GS.instruct_control & 2 )
- exec->GS = tt_default_graphics_state;
-
-#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
- /* check whether we have a font hinted for ClearType -- */
- /* note that this flag can also be modified in a glyph's bytecode */
- if ( exec->GS.instruct_control & 4 )
- exec->ignore_x_mode = 0;
-#endif
-
- exec->pedantic_hinting = FT_BOOL( load_flags & FT_LOAD_PEDANTIC );
- loader->exec = exec;
- loader->instructions = exec->glyphIns;
- }
-
-#endif /* TT_USE_BYTECODE_INTERPRETER */
-
- /* seek to the beginning of the glyph table -- for Type 42 fonts */
- /* the table might be accessed from a Postscript stream or something */
- /* else... */
-
-#ifdef FT_CONFIG_OPTION_INCREMENTAL
-
- if ( face->root.internal->incremental_interface )
- loader->glyf_offset = 0;
- else
-
-#endif
-
- {
- error = face->goto_table( face, TTAG_glyf, stream, 0 );
-
- if ( FT_ERR_EQ( error, Table_Missing ) )
- loader->glyf_offset = 0;
- else if ( error )
- {
- FT_ERROR(( "tt_loader_init: could not access glyph table\n" ));
- return error;
- }
- else
- loader->glyf_offset = FT_STREAM_POS();
- }
-
- /* get face's glyph loader */
- if ( !glyf_table_only )
- {
- FT_GlyphLoader gloader = glyph->internal->loader;
-
-
- FT_GlyphLoader_Rewind( gloader );
- loader->gloader = gloader;
- }
-
- loader->load_flags = (FT_ULong)load_flags;
-
- loader->face = face;
- loader->size = size;
- loader->glyph = (FT_GlyphSlot)glyph;
- loader->stream = stream;
-
- return FT_Err_Ok;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Load_Glyph */
- /* */
- /* <Description> */
- /* A function used to load a single glyph within a given glyph slot, */
- /* for a given size. */
- /* */
- /* <Input> */
- /* glyph :: A handle to a target slot object where the glyph */
- /* will be loaded. */
- /* */
- /* size :: A handle to the source face size at which the glyph */
- /* must be scaled/loaded. */
- /* */
- /* glyph_index :: The index of the glyph in the font file. */
- /* */
- /* load_flags :: A flag indicating what to load for this glyph. The */
- /* FT_LOAD_XXX constants can be used to control the */
- /* glyph loading process (e.g., whether the outline */
- /* should be scaled, whether to load bitmaps or not, */
- /* whether to hint the outline, etc). */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. */
- /* */
- FT_LOCAL_DEF( FT_Error )
- TT_Load_Glyph( TT_Size size,
- TT_GlyphSlot glyph,
- FT_UInt glyph_index,
- FT_Int32 load_flags )
- {
- FT_Error error;
- TT_LoaderRec loader;
-
-
- FT_TRACE1(( "TT_Load_Glyph: glyph index %d\n", glyph_index ));
-
-#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
-
- /* try to load embedded bitmap if any */
- /* */
- /* XXX: The convention should be emphasized in */
- /* the documents because it can be confusing. */
- if ( size->strike_index != 0xFFFFFFFFUL &&
- ( load_flags & FT_LOAD_NO_BITMAP ) == 0 )
- {
- error = load_sbit_image( size, glyph, glyph_index, load_flags );
- if ( !error )
- {
- if ( FT_IS_SCALABLE( glyph->face ) )
- {
- /* for the bbox we need the header only */
- (void)tt_loader_init( &loader, size, glyph, load_flags, TRUE );
- (void)load_truetype_glyph( &loader, glyph_index, 0, TRUE );
- glyph->linearHoriAdvance = loader.linear;
- glyph->linearVertAdvance = loader.vadvance;
-
- /* sanity checks: if `xxxAdvance' in the sbit metric */
- /* structure isn't set, use `linearXXXAdvance' */
- if ( !glyph->metrics.horiAdvance && glyph->linearHoriAdvance )
- glyph->metrics.horiAdvance =
- FT_MulFix( glyph->linearHoriAdvance,
- size->root.metrics.x_scale );
- if ( !glyph->metrics.vertAdvance && glyph->linearVertAdvance )
- glyph->metrics.vertAdvance =
- FT_MulFix( glyph->linearVertAdvance,
- size->root.metrics.y_scale );
- }
-
- return FT_Err_Ok;
- }
- }
-
-#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
-
- /* if FT_LOAD_NO_SCALE is not set, `ttmetrics' must be valid */
- if ( !( load_flags & FT_LOAD_NO_SCALE ) && !size->ttmetrics.valid )
- return FT_THROW( Invalid_Size_Handle );
-
- if ( load_flags & FT_LOAD_SBITS_ONLY )
- return FT_THROW( Invalid_Argument );
-
- error = tt_loader_init( &loader, size, glyph, load_flags, FALSE );
- if ( error )
- return error;
-
- glyph->format = FT_GLYPH_FORMAT_OUTLINE;
- glyph->num_subglyphs = 0;
- glyph->outline.flags = 0;
-
- /* main loading loop */
- error = load_truetype_glyph( &loader, glyph_index, 0, FALSE );
- if ( !error )
- {
- if ( glyph->format == FT_GLYPH_FORMAT_COMPOSITE )
- {
- glyph->num_subglyphs = loader.gloader->base.num_subglyphs;
- glyph->subglyphs = loader.gloader->base.subglyphs;
- }
- else
- {
- glyph->outline = loader.gloader->base.outline;
- glyph->outline.flags &= ~FT_OUTLINE_SINGLE_PASS;
-
- /* Translate array so that (0,0) is the glyph's origin. Note */
- /* that this behaviour is independent on the value of bit 1 of */
- /* the `flags' field in the `head' table -- at least major */
- /* applications like Acroread indicate that. */
- if ( loader.pp1.x )
- FT_Outline_Translate( &glyph->outline, -loader.pp1.x, 0 );
- }
-
-#ifdef TT_USE_BYTECODE_INTERPRETER
-
- if ( IS_HINTED( load_flags ) )
- {
- if ( loader.exec->GS.scan_control )
- {
- /* convert scan conversion mode to FT_OUTLINE_XXX flags */
- switch ( loader.exec->GS.scan_type )
- {
- case 0: /* simple drop-outs including stubs */
- glyph->outline.flags |= FT_OUTLINE_INCLUDE_STUBS;
- break;
- case 1: /* simple drop-outs excluding stubs */
- /* nothing; it's the default rendering mode */
- break;
- case 4: /* smart drop-outs including stubs */
- glyph->outline.flags |= FT_OUTLINE_SMART_DROPOUTS |
- FT_OUTLINE_INCLUDE_STUBS;
- break;
- case 5: /* smart drop-outs excluding stubs */
- glyph->outline.flags |= FT_OUTLINE_SMART_DROPOUTS;
- break;
-
- default: /* no drop-out control */
- glyph->outline.flags |= FT_OUTLINE_IGNORE_DROPOUTS;
- break;
- }
- }
- else
- glyph->outline.flags |= FT_OUTLINE_IGNORE_DROPOUTS;
- }
-
-#endif /* TT_USE_BYTECODE_INTERPRETER */
-
- error = compute_glyph_metrics( &loader, glyph_index );
- }
-
- /* Set the `high precision' bit flag. */
- /* This is _critical_ to get correct output for monochrome */
- /* TrueType glyphs at all sizes using the bytecode interpreter. */
- /* */
- if ( !( load_flags & FT_LOAD_NO_SCALE ) &&
- size->root.metrics.y_ppem < 24 )
- glyph->outline.flags |= FT_OUTLINE_HIGH_PRECISION;
-
- return error;
- }
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/truetype/ttgload.h b/chromium/third_party/pdfium/third_party/freetype/src/truetype/ttgload.h
deleted file mode 100644
index 8e3255e106d..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/truetype/ttgload.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/***************************************************************************/
-/* */
-/* ttgload.h */
-/* */
-/* TrueType Glyph Loader (specification). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __TTGLOAD_H__
-#define __TTGLOAD_H__
-
-
-#include <ft2build.h>
-#include "ttobjs.h"
-
-#ifdef TT_USE_BYTECODE_INTERPRETER
-#include "ttinterp.h"
-#endif
-
-
-FT_BEGIN_HEADER
-
-
- FT_LOCAL( void )
- TT_Init_Glyph_Loading( TT_Face face );
-
- FT_LOCAL( void )
- TT_Get_HMetrics( TT_Face face,
- FT_UInt idx,
- FT_Short* lsb,
- FT_UShort* aw );
-
- FT_LOCAL( void )
- TT_Get_VMetrics( TT_Face face,
- FT_UInt idx,
- FT_Pos yMax,
- FT_Short* tsb,
- FT_UShort* ah );
-
- FT_LOCAL( FT_Error )
- TT_Load_Glyph( TT_Size size,
- TT_GlyphSlot glyph,
- FT_UInt glyph_index,
- FT_Int32 load_flags );
-
-
-FT_END_HEADER
-
-#endif /* __TTGLOAD_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/truetype/ttgxvar.c b/chromium/third_party/pdfium/third_party/freetype/src/truetype/ttgxvar.c
deleted file mode 100644
index dd9e250c941..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/truetype/ttgxvar.c
+++ /dev/null
@@ -1,2074 +0,0 @@
-/***************************************************************************/
-/* */
-/* ttgxvar.c */
-/* */
-/* TrueType GX Font Variation loader */
-/* */
-/* Copyright 2004-2015 by */
-/* David Turner, Robert Wilhelm, Werner Lemberg, and George Williams. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* Apple documents the `fvar', `gvar', `cvar', and `avar' tables at */
- /* */
- /* https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6[fgca]var.html */
- /* */
- /* The documentation for `fvar' is inconsistent. At one point it says */
- /* that `countSizePairs' should be 3, at another point 2. It should */
- /* be 2. */
- /* */
- /* The documentation for `gvar' is not intelligible; `cvar' refers you */
- /* to `gvar' and is thus also incomprehensible. */
- /* */
- /* The documentation for `avar' appears correct, but Apple has no fonts */
- /* with an `avar' table, so it is hard to test. */
- /* */
- /* Many thanks to John Jenkins (at Apple) in figuring this out. */
- /* */
- /* */
- /* Apple's `kern' table has some references to tuple indices, but as */
- /* there is no indication where these indices are defined, nor how to */
- /* interpolate the kerning values (different tuples have different */
- /* classes) this issue is ignored. */
- /* */
- /*************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_CONFIG_CONFIG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_SFNT_H
-#include FT_TRUETYPE_TAGS_H
-#include FT_MULTIPLE_MASTERS_H
-
-#include "ttpload.h"
-#include "ttgxvar.h"
-
-#include "tterrors.h"
-
-
-#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
-
-
-#define FT_Stream_FTell( stream ) \
- (FT_ULong)( (stream)->cursor - (stream)->base )
-#define FT_Stream_SeekSet( stream, off ) \
- ( (stream)->cursor = (stream)->base + (off) )
-
-
- /*************************************************************************/
- /* */
- /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
- /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
- /* messages during execution. */
- /* */
-#undef FT_COMPONENT
-#define FT_COMPONENT trace_ttgxvar
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** Internal Routines *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* The macro ALL_POINTS is used in `ft_var_readpackedpoints'. It */
- /* indicates that there is a delta for every point without needing to */
- /* enumerate all of them. */
- /* */
-
- /* ensure that value `0' has the same width as a pointer */
-#define ALL_POINTS (FT_UShort*)~(FT_PtrDist)0
-
-
-#define GX_PT_POINTS_ARE_WORDS 0x80U
-#define GX_PT_POINT_RUN_COUNT_MASK 0x7FU
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* ft_var_readpackedpoints */
- /* */
- /* <Description> */
- /* Read a set of points to which the following deltas will apply. */
- /* Points are packed with a run length encoding. */
- /* */
- /* <Input> */
- /* stream :: The data stream. */
- /* */
- /* <Output> */
- /* point_cnt :: The number of points read. A zero value means that */
- /* all points in the glyph will be affected, without */
- /* enumerating them individually. */
- /* */
- /* <Return> */
- /* An array of FT_UShort containing the affected points or the */
- /* special value ALL_POINTS. */
- /* */
- static FT_UShort*
- ft_var_readpackedpoints( FT_Stream stream,
- FT_UInt *point_cnt )
- {
- FT_UShort *points = NULL;
- FT_UInt n;
- FT_UInt runcnt;
- FT_UInt i, j;
- FT_UShort first;
- FT_Memory memory = stream->memory;
- FT_Error error = FT_Err_Ok;
-
- FT_UNUSED( error );
-
-
- *point_cnt = 0;
-
- n = FT_GET_BYTE();
- if ( n == 0 )
- return ALL_POINTS;
-
- if ( n & GX_PT_POINTS_ARE_WORDS )
- {
- n &= GX_PT_POINT_RUN_COUNT_MASK;
- n <<= 8;
- n |= FT_GET_BYTE();
- }
-
- if ( FT_NEW_ARRAY( points, n ) )
- return NULL;
-
- *point_cnt = n;
-
- i = 0;
- while ( i < n )
- {
- runcnt = FT_GET_BYTE();
- if ( runcnt & GX_PT_POINTS_ARE_WORDS )
- {
- runcnt &= GX_PT_POINT_RUN_COUNT_MASK;
- first = FT_GET_USHORT();
- points[i++] = first;
-
- if ( runcnt < 1 || i + runcnt > n )
- goto Exit;
-
- /* first point not included in run count */
- for ( j = 0; j < runcnt; j++ )
- {
- first += FT_GET_USHORT();
- points[i++] = first;
- }
- }
- else
- {
- first = FT_GET_BYTE();
- points[i++] = first;
-
- if ( runcnt < 1 || i + runcnt > n )
- goto Exit;
-
- for ( j = 0; j < runcnt; j++ )
- {
- first += FT_GET_BYTE();
- points[i++] = first;
- }
- }
- }
-
- Exit:
- return points;
- }
-
-
-#define GX_DT_DELTAS_ARE_ZERO 0x80U
-#define GX_DT_DELTAS_ARE_WORDS 0x40U
-#define GX_DT_DELTA_RUN_COUNT_MASK 0x3FU
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* ft_var_readpackeddeltas */
- /* */
- /* <Description> */
- /* Read a set of deltas. These are packed slightly differently than */
- /* points. In particular there is no overall count. */
- /* */
- /* <Input> */
- /* stream :: The data stream. */
- /* */
- /* delta_cnt :: The number of deltas to be read. */
- /* */
- /* <Return> */
- /* An array of FT_Short containing the deltas for the affected */
- /* points. (This only gets the deltas for one dimension. It will */
- /* generally be called twice, once for x, once for y. When used in */
- /* cvt table, it will only be called once.) */
- /* */
- static FT_Short*
- ft_var_readpackeddeltas( FT_Stream stream,
- FT_UInt delta_cnt )
- {
- FT_Short *deltas = NULL;
- FT_UInt runcnt, cnt;
- FT_UInt i, j;
- FT_Memory memory = stream->memory;
- FT_Error error = FT_Err_Ok;
-
- FT_UNUSED( error );
-
-
- if ( FT_NEW_ARRAY( deltas, delta_cnt ) )
- return NULL;
-
- i = 0;
- while ( i < delta_cnt )
- {
- runcnt = FT_GET_BYTE();
- cnt = runcnt & GX_DT_DELTA_RUN_COUNT_MASK;
-
- if ( runcnt & GX_DT_DELTAS_ARE_ZERO )
- {
- /* `runcnt' zeroes get added */
- for ( j = 0; j <= cnt && i < delta_cnt; j++ )
- deltas[i++] = 0;
- }
- else if ( runcnt & GX_DT_DELTAS_ARE_WORDS )
- {
- /* `runcnt' shorts from the stack */
- for ( j = 0; j <= cnt && i < delta_cnt; j++ )
- deltas[i++] = FT_GET_SHORT();
- }
- else
- {
- /* `runcnt' signed bytes from the stack */
- for ( j = 0; j <= cnt && i < delta_cnt; j++ )
- deltas[i++] = FT_GET_CHAR();
- }
-
- if ( j <= cnt )
- {
- /* bad format */
- FT_FREE( deltas );
- return NULL;
- }
- }
-
- return deltas;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* ft_var_load_avar */
- /* */
- /* <Description> */
- /* Parse the `avar' table if present. It need not be, so we return */
- /* nothing. */
- /* */
- /* <InOut> */
- /* face :: The font face. */
- /* */
- static void
- ft_var_load_avar( TT_Face face )
- {
- FT_Stream stream = FT_FACE_STREAM( face );
- FT_Memory memory = stream->memory;
- GX_Blend blend = face->blend;
- GX_AVarSegment segment;
- FT_Error error = FT_Err_Ok;
- FT_Long version;
- FT_Long axisCount;
- FT_Int i, j;
- FT_ULong table_len;
-
- FT_UNUSED( error );
-
-
- FT_TRACE2(( "AVAR " ));
-
- blend->avar_checked = TRUE;
- error = face->goto_table( face, TTAG_avar, stream, &table_len );
- if ( error )
- {
- FT_TRACE2(( "is missing\n" ));
- return;
- }
-
- if ( FT_FRAME_ENTER( table_len ) )
- return;
-
- version = FT_GET_LONG();
- axisCount = FT_GET_LONG();
-
- if ( version != 0x00010000L )
- {
- FT_TRACE2(( "bad table version\n" ));
- goto Exit;
- }
-
- FT_TRACE2(( "loaded\n" ));
-
- if ( axisCount != (FT_Long)blend->mmvar->num_axis )
- {
- FT_TRACE2(( "ft_var_load_avar: number of axes in `avar' and `cvar'\n"
- " table are different\n" ));
- goto Exit;
- }
-
- if ( FT_NEW_ARRAY( blend->avar_segment, axisCount ) )
- goto Exit;
-
- segment = &blend->avar_segment[0];
- for ( i = 0; i < axisCount; i++, segment++ )
- {
- FT_TRACE5(( " axis %d:\n", i ));
-
- segment->pairCount = FT_GET_USHORT();
- if ( FT_NEW_ARRAY( segment->correspondence, segment->pairCount ) )
- {
- /* Failure. Free everything we have done so far. We must do */
- /* it right now since loading the `avar' table is optional. */
-
- for ( j = i - 1; j >= 0; j-- )
- FT_FREE( blend->avar_segment[j].correspondence );
-
- FT_FREE( blend->avar_segment );
- blend->avar_segment = NULL;
- goto Exit;
- }
-
- for ( j = 0; j < segment->pairCount; j++ )
- {
- /* convert to Fixed */
- segment->correspondence[j].fromCoord = FT_GET_SHORT() * 4;
- segment->correspondence[j].toCoord = FT_GET_SHORT() * 4;
-
- FT_TRACE5(( " mapping %.4f to %.4f\n",
- segment->correspondence[j].fromCoord / 65536.0,
- segment->correspondence[j].toCoord / 65536.0 ));
- }
-
- FT_TRACE5(( "\n" ));
- }
-
- Exit:
- FT_FRAME_EXIT();
- }
-
-
- typedef struct GX_GVar_Head_
- {
- FT_Long version;
- FT_UShort axisCount;
- FT_UShort globalCoordCount;
- FT_ULong offsetToCoord;
- FT_UShort glyphCount;
- FT_UShort flags;
- FT_ULong offsetToData;
-
- } GX_GVar_Head;
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* ft_var_load_gvar */
- /* */
- /* <Description> */
- /* Parse the `gvar' table if present. If `fvar' is there, `gvar' had */
- /* better be there too. */
- /* */
- /* <InOut> */
- /* face :: The font face. */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. */
- /* */
- static FT_Error
- ft_var_load_gvar( TT_Face face )
- {
- FT_Stream stream = FT_FACE_STREAM( face );
- FT_Memory memory = stream->memory;
- GX_Blend blend = face->blend;
- FT_Error error;
- FT_UInt i, j;
- FT_ULong table_len;
- FT_ULong gvar_start;
- FT_ULong offsetToData;
- GX_GVar_Head gvar_head;
-
- static const FT_Frame_Field gvar_fields[] =
- {
-
-#undef FT_STRUCTURE
-#define FT_STRUCTURE GX_GVar_Head
-
- FT_FRAME_START( 20 ),
- FT_FRAME_LONG ( version ),
- FT_FRAME_USHORT( axisCount ),
- FT_FRAME_USHORT( globalCoordCount ),
- FT_FRAME_ULONG ( offsetToCoord ),
- FT_FRAME_USHORT( glyphCount ),
- FT_FRAME_USHORT( flags ),
- FT_FRAME_ULONG ( offsetToData ),
- FT_FRAME_END
- };
-
-
- FT_TRACE2(( "GVAR " ));
-
- if ( ( error = face->goto_table( face,
- TTAG_gvar,
- stream,
- &table_len ) ) != 0 )
- {
- FT_TRACE2(( "is missing\n" ));
- goto Exit;
- }
-
- gvar_start = FT_STREAM_POS( );
- if ( FT_STREAM_READ_FIELDS( gvar_fields, &gvar_head ) )
- goto Exit;
-
- blend->tuplecount = gvar_head.globalCoordCount;
- blend->gv_glyphcnt = gvar_head.glyphCount;
- offsetToData = gvar_start + gvar_head.offsetToData;
-
- if ( gvar_head.version != 0x00010000L )
- {
- FT_TRACE1(( "bad table version\n" ));
- error = FT_THROW( Invalid_Table );
- goto Exit;
- }
-
- FT_TRACE2(( "loaded\n" ));
-
- if ( gvar_head.axisCount != (FT_UShort)blend->mmvar->num_axis )
- {
- FT_TRACE1(( "ft_var_load_gvar: number of axes in `gvar' and `cvar'\n"
- " table are different\n" ));
- error = FT_THROW( Invalid_Table );
- goto Exit;
- }
-
- FT_TRACE5(( "gvar: there are %d shared coordinates:\n",
- blend->tuplecount ));
-
- if ( FT_NEW_ARRAY( blend->glyphoffsets, blend->gv_glyphcnt + 1 ) )
- goto Exit;
-
- if ( gvar_head.flags & 1 )
- {
- /* long offsets (one more offset than glyphs, to mark size of last) */
- if ( FT_FRAME_ENTER( ( blend->gv_glyphcnt + 1 ) * 4L ) )
- goto Exit;
-
- for ( i = 0; i <= blend->gv_glyphcnt; i++ )
- blend->glyphoffsets[i] = offsetToData + FT_GET_ULONG();
-
- FT_FRAME_EXIT();
- }
- else
- {
- /* short offsets (one more offset than glyphs, to mark size of last) */
- if ( FT_FRAME_ENTER( ( blend->gv_glyphcnt + 1 ) * 2L ) )
- goto Exit;
-
- for ( i = 0; i <= blend->gv_glyphcnt; i++ )
- blend->glyphoffsets[i] = offsetToData + FT_GET_USHORT() * 2;
- /* XXX: Undocumented: `*2'! */
-
- FT_FRAME_EXIT();
- }
-
- if ( blend->tuplecount != 0 )
- {
- if ( FT_NEW_ARRAY( blend->tuplecoords,
- gvar_head.axisCount * blend->tuplecount ) )
- goto Exit;
-
- if ( FT_STREAM_SEEK( gvar_start + gvar_head.offsetToCoord ) ||
- FT_FRAME_ENTER( blend->tuplecount * gvar_head.axisCount * 2L ) )
- goto Exit;
-
- for ( i = 0; i < blend->tuplecount; i++ )
- {
- FT_TRACE5(( " [ " ));
- for ( j = 0 ; j < (FT_UInt)gvar_head.axisCount; j++ )
- {
- blend->tuplecoords[i * gvar_head.axisCount + j] =
- FT_GET_SHORT() * 4; /* convert to FT_Fixed */
- FT_TRACE5(( "%.4f ",
- blend->tuplecoords[i * gvar_head.axisCount + j] / 65536.0 ));
- }
- FT_TRACE5(( "]\n" ));
- }
-
- FT_TRACE5(( "\n" ));
-
- FT_FRAME_EXIT();
- }
-
- Exit:
- return error;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* ft_var_apply_tuple */
- /* */
- /* <Description> */
- /* Figure out whether a given tuple (design) applies to the current */
- /* blend, and if so, what is the scaling factor. */
- /* */
- /* <Input> */
- /* blend :: The current blend of the font. */
- /* */
- /* tupleIndex :: A flag saying whether this is an intermediate */
- /* tuple or not. */
- /* */
- /* tuple_coords :: The coordinates of the tuple in normalized axis */
- /* units. */
- /* */
- /* im_start_coords :: The initial coordinates where this tuple starts */
- /* to apply (for intermediate coordinates). */
- /* */
- /* im_end_coords :: The final coordinates after which this tuple no */
- /* longer applies (for intermediate coordinates). */
- /* */
- /* <Return> */
- /* An FT_Fixed value containing the scaling factor. */
- /* */
- static FT_Fixed
- ft_var_apply_tuple( GX_Blend blend,
- FT_UShort tupleIndex,
- FT_Fixed* tuple_coords,
- FT_Fixed* im_start_coords,
- FT_Fixed* im_end_coords )
- {
- FT_UInt i;
- FT_Fixed apply = 0x10000L;
-
-
- for ( i = 0; i < blend->num_axis; i++ )
- {
- FT_TRACE6(( " axis coordinate %d (%.4f):\n",
- i, blend->normalizedcoords[i] / 65536.0 ));
-
- /* It's not clear why (for intermediate tuples) we don't need */
- /* to check against start/end -- the documentation says we don't. */
- /* Similarly, it's unclear why we don't need to scale along the */
- /* axis. */
-
- if ( tuple_coords[i] == 0 )
- {
- FT_TRACE6(( " tuple coordinate is zero, ignored\n", i ));
- continue;
- }
-
- else if ( blend->normalizedcoords[i] == 0 )
- {
- FT_TRACE6(( " axis coordinate is zero, stop\n" ));
- apply = 0;
- break;
- }
-
- else if ( ( blend->normalizedcoords[i] < 0 && tuple_coords[i] > 0 ) ||
- ( blend->normalizedcoords[i] > 0 && tuple_coords[i] < 0 ) )
- {
- FT_TRACE6(( " tuple coordinate value %.4f is exceeded, stop\n",
- tuple_coords[i] / 65536.0 ));
- apply = 0;
- break;
- }
-
- else if ( !( tupleIndex & GX_TI_INTERMEDIATE_TUPLE ) )
- {
- FT_TRACE6(( " tuple coordinate value %.4f fits\n",
- tuple_coords[i] / 65536.0 ));
- /* not an intermediate tuple */
- apply = FT_MulFix( apply,
- blend->normalizedcoords[i] > 0
- ? blend->normalizedcoords[i]
- : -blend->normalizedcoords[i] );
- }
-
- else if ( blend->normalizedcoords[i] < im_start_coords[i] ||
- blend->normalizedcoords[i] > im_end_coords[i] )
- {
- FT_TRACE6(( " intermediate tuple range [%.4f;%.4f] is exceeded,"
- " stop\n",
- im_start_coords[i] / 65536.0,
- im_end_coords[i] / 65536.0 ));
- apply = 0;
- break;
- }
-
- else if ( blend->normalizedcoords[i] < tuple_coords[i] )
- {
- FT_TRACE6(( " intermediate tuple range [%.4f;%.4f] fits\n",
- im_start_coords[i] / 65536.0,
- im_end_coords[i] / 65536.0 ));
- apply = FT_MulDiv( apply,
- blend->normalizedcoords[i] - im_start_coords[i],
- tuple_coords[i] - im_start_coords[i] );
- }
-
- else
- {
- FT_TRACE6(( " intermediate tuple range [%.4f;%.4f] fits\n",
- im_start_coords[i] / 65536.0,
- im_end_coords[i] / 65536.0 ));
- apply = FT_MulDiv( apply,
- im_end_coords[i] - blend->normalizedcoords[i],
- im_end_coords[i] - tuple_coords[i] );
- }
- }
-
- FT_TRACE6(( " apply factor is %.4f\n", apply / 65536.0 ));
-
- return apply;
- }
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** MULTIPLE MASTERS SERVICE FUNCTIONS *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
-
- typedef struct GX_FVar_Head_
- {
- FT_Long version;
- FT_UShort offsetToData;
- FT_UShort countSizePairs;
- FT_UShort axisCount;
- FT_UShort axisSize;
- FT_UShort instanceCount;
- FT_UShort instanceSize;
-
- } GX_FVar_Head;
-
-
- typedef struct fvar_axis_
- {
- FT_ULong axisTag;
- FT_Fixed minValue;
- FT_Fixed defaultValue;
- FT_Fixed maxValue;
- FT_UShort flags;
- FT_UShort nameID;
-
- } GX_FVar_Axis;
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Get_MM_Var */
- /* */
- /* <Description> */
- /* Check that the font's `fvar' table is valid, parse it, and return */
- /* those data. */
- /* */
- /* <InOut> */
- /* face :: The font face. */
- /* TT_Get_MM_Var initializes the blend structure. */
- /* */
- /* <Output> */
- /* master :: The `fvar' data (must be freed by caller). Can be NULL, */
- /* which makes this function simply load MM support. */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. */
- /* */
- FT_LOCAL_DEF( FT_Error )
- TT_Get_MM_Var( TT_Face face,
- FT_MM_Var* *master )
- {
- FT_Stream stream = face->root.stream;
- FT_Memory memory = face->root.memory;
- FT_ULong table_len;
- FT_Error error = FT_Err_Ok;
- FT_ULong fvar_start;
- FT_Int i, j;
- FT_MM_Var* mmvar = NULL;
- FT_Fixed* next_coords;
- FT_String* next_name;
- FT_Var_Axis* a;
- FT_Var_Named_Style* ns;
- GX_FVar_Head fvar_head;
-
- static const FT_Frame_Field fvar_fields[] =
- {
-
-#undef FT_STRUCTURE
-#define FT_STRUCTURE GX_FVar_Head
-
- FT_FRAME_START( 16 ),
- FT_FRAME_LONG ( version ),
- FT_FRAME_USHORT( offsetToData ),
- FT_FRAME_USHORT( countSizePairs ),
- FT_FRAME_USHORT( axisCount ),
- FT_FRAME_USHORT( axisSize ),
- FT_FRAME_USHORT( instanceCount ),
- FT_FRAME_USHORT( instanceSize ),
- FT_FRAME_END
- };
-
- static const FT_Frame_Field fvaraxis_fields[] =
- {
-
-#undef FT_STRUCTURE
-#define FT_STRUCTURE GX_FVar_Axis
-
- FT_FRAME_START( 20 ),
- FT_FRAME_ULONG ( axisTag ),
- FT_FRAME_LONG ( minValue ),
- FT_FRAME_LONG ( defaultValue ),
- FT_FRAME_LONG ( maxValue ),
- FT_FRAME_USHORT( flags ),
- FT_FRAME_USHORT( nameID ),
- FT_FRAME_END
- };
-
-
- /* read the font data and set up the internal representation */
- /* if not already done */
-
- if ( face->blend == NULL )
- {
- FT_TRACE2(( "FVAR " ));
-
- /* both `fvar' and `gvar' must be present */
- if ( ( error = face->goto_table( face, TTAG_gvar,
- stream, &table_len ) ) != 0 )
- {
- FT_TRACE1(( "\n"
- "TT_Get_MM_Var: `gvar' table is missing\n" ));
- goto Exit;
- }
-
- if ( ( error = face->goto_table( face, TTAG_fvar,
- stream, &table_len ) ) != 0 )
- {
- FT_TRACE1(( "is missing\n" ));
- goto Exit;
- }
-
- fvar_start = FT_STREAM_POS( );
-
- if ( FT_STREAM_READ_FIELDS( fvar_fields, &fvar_head ) )
- goto Exit;
-
- if ( fvar_head.version != (FT_Long)0x00010000L ||
-#if 0
- /* fonts like `JamRegular.ttf' have an incorrect value for */
- /* `countSizePairs'; since value 2 is hard-coded in `fvar' */
- /* version 1.0, we simply ignore it */
- fvar_head.countSizePairs != 2 ||
-#endif
- fvar_head.axisSize != 20 ||
- /* axisCount limit implied by 16-bit instanceSize */
- fvar_head.axisCount > 0x3FFE ||
- fvar_head.instanceSize != 4 + 4 * fvar_head.axisCount ||
- /* instanceCount limit implied by limited range of name IDs */
- fvar_head.instanceCount > 0x7EFF ||
- fvar_head.offsetToData + fvar_head.axisCount * 20U +
- fvar_head.instanceCount * fvar_head.instanceSize > table_len )
- {
- FT_TRACE1(( "\n"
- "TT_Get_MM_Var: invalid `fvar' header\n" ));
- error = FT_THROW( Invalid_Table );
- goto Exit;
- }
-
- FT_TRACE2(( "loaded\n" ));
-
- FT_TRACE5(( "number of GX style axes: %d\n", fvar_head.axisCount ));
-
- if ( FT_NEW( face->blend ) )
- goto Exit;
-
- /* cannot overflow 32-bit arithmetic because of limits above */
- face->blend->mmvar_len =
- sizeof ( FT_MM_Var ) +
- fvar_head.axisCount * sizeof ( FT_Var_Axis ) +
- fvar_head.instanceCount * sizeof ( FT_Var_Named_Style ) +
- fvar_head.instanceCount * fvar_head.axisCount * sizeof ( FT_Fixed ) +
- 5 * fvar_head.axisCount;
-
- if ( FT_ALLOC( mmvar, face->blend->mmvar_len ) )
- goto Exit;
- face->blend->mmvar = mmvar;
-
- /* set up pointers and offsets into the `mmvar' array; */
- /* the data gets filled in later on */
-
- mmvar->num_axis =
- fvar_head.axisCount;
- mmvar->num_designs =
- ~0U; /* meaningless in this context; each glyph */
- /* may have a different number of designs */
- /* (or tuples, as called by Apple) */
- mmvar->num_namedstyles =
- fvar_head.instanceCount;
- mmvar->axis =
- (FT_Var_Axis*)&( mmvar[1] );
- mmvar->namedstyle =
- (FT_Var_Named_Style*)&( mmvar->axis[fvar_head.axisCount] );
-
- next_coords =
- (FT_Fixed*)&( mmvar->namedstyle[fvar_head.instanceCount] );
- for ( i = 0; i < fvar_head.instanceCount; i++ )
- {
- mmvar->namedstyle[i].coords = next_coords;
- next_coords += fvar_head.axisCount;
- }
-
- next_name = (FT_String*)next_coords;
- for ( i = 0; i < fvar_head.axisCount; i++ )
- {
- mmvar->axis[i].name = next_name;
- next_name += 5;
- }
-
- /* now fill in the data */
-
- if ( FT_STREAM_SEEK( fvar_start + fvar_head.offsetToData ) )
- goto Exit;
-
- a = mmvar->axis;
- for ( i = 0; i < fvar_head.axisCount; i++ )
- {
- GX_FVar_Axis axis_rec;
-
-
- if ( FT_STREAM_READ_FIELDS( fvaraxis_fields, &axis_rec ) )
- goto Exit;
- a->tag = axis_rec.axisTag;
- a->minimum = axis_rec.minValue;
- a->def = axis_rec.defaultValue;
- a->maximum = axis_rec.maxValue;
- a->strid = axis_rec.nameID;
-
- a->name[0] = (FT_String)( a->tag >> 24 );
- a->name[1] = (FT_String)( ( a->tag >> 16 ) & 0xFF );
- a->name[2] = (FT_String)( ( a->tag >> 8 ) & 0xFF );
- a->name[3] = (FT_String)( ( a->tag ) & 0xFF );
- a->name[4] = '\0';
-
- FT_TRACE5(( " \"%s\": minimum=%.4f, default=%.4f, maximum=%.4f\n",
- a->name,
- a->minimum / 65536.0,
- a->def / 65536.0,
- a->maximum / 65536.0 ));
-
- a++;
- }
-
- FT_TRACE5(( "\n" ));
-
- ns = mmvar->namedstyle;
- for ( i = 0; i < fvar_head.instanceCount; i++, ns++ )
- {
- if ( FT_FRAME_ENTER( 4L + 4L * fvar_head.axisCount ) )
- goto Exit;
-
- ns->strid = FT_GET_USHORT();
- (void) /* flags = */ FT_GET_USHORT();
-
- for ( j = 0; j < fvar_head.axisCount; j++ )
- ns->coords[j] = FT_GET_LONG();
-
- FT_FRAME_EXIT();
- }
- }
-
- /* fill the output array if requested */
-
- if ( master != NULL )
- {
- FT_UInt n;
-
-
- if ( FT_ALLOC( mmvar, face->blend->mmvar_len ) )
- goto Exit;
- FT_MEM_COPY( mmvar, face->blend->mmvar, face->blend->mmvar_len );
-
- mmvar->axis =
- (FT_Var_Axis*)&( mmvar[1] );
- mmvar->namedstyle =
- (FT_Var_Named_Style*)&( mmvar->axis[mmvar->num_axis] );
- next_coords =
- (FT_Fixed*)&( mmvar->namedstyle[mmvar->num_namedstyles] );
-
- for ( n = 0; n < mmvar->num_namedstyles; n++ )
- {
- mmvar->namedstyle[n].coords = next_coords;
- next_coords += mmvar->num_axis;
- }
-
- a = mmvar->axis;
- next_name = (FT_String*)next_coords;
- for ( n = 0; n < mmvar->num_axis; n++ )
- {
- a->name = next_name;
-
- /* standard PostScript names for some standard apple tags */
- if ( a->tag == TTAG_wght )
- a->name = (char*)"Weight";
- else if ( a->tag == TTAG_wdth )
- a->name = (char*)"Width";
- else if ( a->tag == TTAG_opsz )
- a->name = (char*)"OpticalSize";
- else if ( a->tag == TTAG_slnt )
- a->name = (char*)"Slant";
-
- next_name += 5;
- a++;
- }
-
- *master = mmvar;
- }
-
- Exit:
- return error;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Set_MM_Blend */
- /* */
- /* <Description> */
- /* Set the blend (normalized) coordinates for this instance of the */
- /* font. Check that the `gvar' table is reasonable and does some */
- /* initial preparation. */
- /* */
- /* <InOut> */
- /* face :: The font. */
- /* Initialize the blend structure with `gvar' data. */
- /* */
- /* <Input> */
- /* num_coords :: The number of available coordinates. If it is */
- /* larger than the number of axes, ignore the excess */
- /* values. If it is smaller than the number of axes, */
- /* use the default value (0) for the remaining axes. */
- /* */
- /* coords :: An array of `num_coords', each between [-1,1]. */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. */
- /* */
- FT_LOCAL_DEF( FT_Error )
- TT_Set_MM_Blend( TT_Face face,
- FT_UInt num_coords,
- FT_Fixed* coords )
- {
- FT_Error error = FT_Err_Ok;
- GX_Blend blend;
- FT_MM_Var* mmvar;
- FT_UInt i;
- FT_Memory memory = face->root.memory;
-
- enum
- {
- mcvt_retain,
- mcvt_modify,
- mcvt_load
-
- } manageCvt;
-
-
- face->doblend = FALSE;
-
- if ( face->blend == NULL )
- {
- if ( ( error = TT_Get_MM_Var( face, NULL ) ) != 0 )
- goto Exit;
- }
-
- blend = face->blend;
- mmvar = blend->mmvar;
-
- if ( num_coords > mmvar->num_axis )
- {
- FT_TRACE2(( "TT_Set_MM_Blend: only using first %d of %d coordinates\n",
- mmvar->num_axis, num_coords ));
- num_coords = mmvar->num_axis;
- }
-
- FT_TRACE5(( "normalized design coordinates:\n" ));
-
- for ( i = 0; i < num_coords; i++ )
- {
- FT_TRACE5(( " %.4f\n", coords[i] / 65536.0 ));
- if ( coords[i] < -0x00010000L || coords[i] > 0x00010000L )
- {
- FT_TRACE1(( "TT_Set_MM_Blend: normalized design coordinate %.4f\n"
- " is out of range [-1;1]\n",
- coords[i] / 65536.0 ));
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
- }
-
- FT_TRACE5(( "\n" ));
-
- if ( blend->glyphoffsets == NULL )
- if ( ( error = ft_var_load_gvar( face ) ) != 0 )
- goto Exit;
-
- if ( blend->normalizedcoords == NULL )
- {
- if ( FT_NEW_ARRAY( blend->normalizedcoords, mmvar->num_axis ) )
- goto Exit;
-
- manageCvt = mcvt_modify;
-
- /* If we have not set the blend coordinates before this, then the */
- /* cvt table will still be what we read from the `cvt ' table and */
- /* we don't need to reload it. We may need to change it though... */
- }
- else
- {
- manageCvt = mcvt_retain;
-
- for ( i = 0; i < num_coords; i++ )
- {
- if ( blend->normalizedcoords[i] != coords[i] )
- {
- manageCvt = mcvt_load;
- break;
- }
- }
-
- for ( ; i < mmvar->num_axis; i++ )
- {
- if ( blend->normalizedcoords[i] != 0 )
- {
- manageCvt = mcvt_load;
- break;
- }
- }
-
- /* If we don't change the blend coords then we don't need to do */
- /* anything to the cvt table. It will be correct. Otherwise we */
- /* no longer have the original cvt (it was modified when we set */
- /* the blend last time), so we must reload and then modify it. */
- }
-
- blend->num_axis = mmvar->num_axis;
- FT_MEM_COPY( blend->normalizedcoords,
- coords,
- num_coords * sizeof ( FT_Fixed ) );
-
- face->doblend = TRUE;
-
- if ( face->cvt != NULL )
- {
- switch ( manageCvt )
- {
- case mcvt_load:
- /* The cvt table has been loaded already; every time we change the */
- /* blend we may need to reload and remodify the cvt table. */
- FT_FREE( face->cvt );
- face->cvt = NULL;
-
- error = tt_face_load_cvt( face, face->root.stream );
- break;
-
- case mcvt_modify:
- /* The original cvt table is in memory. All we need to do is */
- /* apply the `cvar' table (if any). */
- error = tt_face_vary_cvt( face, face->root.stream );
- break;
-
- case mcvt_retain:
- /* The cvt table is correct for this set of coordinates. */
- break;
- }
- }
-
- Exit:
- return error;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Set_Var_Design */
- /* */
- /* <Description> */
- /* Set the coordinates for the instance, measured in the user */
- /* coordinate system. Parse the `avar' table (if present) to convert */
- /* from user to normalized coordinates. */
- /* */
- /* <InOut> */
- /* face :: The font face. */
- /* Initialize the blend struct with `gvar' data. */
- /* */
- /* <Input> */
- /* num_coords :: The number of available coordinates. If it is */
- /* larger than the number of axes, ignore the excess */
- /* values. If it is smaller than the number of axes, */
- /* use the default values for the remaining axes. */
- /* */
- /* coords :: A coordinate array with `num_coords' elements. */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. */
- /* */
- FT_LOCAL_DEF( FT_Error )
- TT_Set_Var_Design( TT_Face face,
- FT_UInt num_coords,
- FT_Fixed* coords )
- {
- FT_Error error = FT_Err_Ok;
- FT_Fixed* normalized = NULL;
- GX_Blend blend;
- FT_MM_Var* mmvar;
- FT_UInt i, j;
- FT_Var_Axis* a;
- GX_AVarSegment av;
- FT_Memory memory = face->root.memory;
-
-
- if ( face->blend == NULL )
- {
- if ( ( error = TT_Get_MM_Var( face, NULL ) ) != 0 )
- goto Exit;
- }
-
- blend = face->blend;
- mmvar = blend->mmvar;
-
- if ( num_coords > mmvar->num_axis )
- {
- FT_TRACE2(( "TT_Set_Var_Design:"
- " only using first %d of %d coordinates\n",
- mmvar->num_axis, num_coords ));
- num_coords = mmvar->num_axis;
- }
-
- /* Axis normalization is a two stage process. First we normalize */
- /* based on the [min,def,max] values for the axis to be [-1,0,1]. */
- /* Then, if there's an `avar' table, we renormalize this range. */
-
- if ( FT_NEW_ARRAY( normalized, mmvar->num_axis ) )
- goto Exit;
-
- FT_TRACE5(( "design coordinates:\n" ));
-
- a = mmvar->axis;
- for ( i = 0; i < num_coords; i++, a++ )
- {
- FT_TRACE5(( " %.4f\n", coords[i] / 65536.0 ));
- if ( coords[i] > a->maximum || coords[i] < a->minimum )
- {
- FT_TRACE1(( "TT_Set_Var_Design: normalized design coordinate %.4f\n"
- " is out of range [%.4f;%.4f]\n",
- coords[i] / 65536.0,
- a->minimum / 65536.0,
- a->maximum / 65536.0 ));
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- if ( coords[i] < a->def )
- normalized[i] = -FT_DivFix( coords[i] - a->def,
- a->minimum - a->def );
- else if ( a->maximum == a->def )
- normalized[i] = 0;
- else
- normalized[i] = FT_DivFix( coords[i] - a->def,
- a->maximum - a->def );
- }
-
- FT_TRACE5(( "\n" ));
-
- for ( ; i < mmvar->num_axis; i++ )
- normalized[i] = 0;
-
- if ( !blend->avar_checked )
- ft_var_load_avar( face );
-
- if ( blend->avar_segment != NULL )
- {
- FT_TRACE5(( "normalized design coordinates"
- " before applying `avar' data:\n" ));
-
- av = blend->avar_segment;
- for ( i = 0; i < mmvar->num_axis; i++, av++ )
- {
- for ( j = 1; j < (FT_UInt)av->pairCount; j++ )
- {
- FT_TRACE5(( " %.4f\n", normalized[i] / 65536.0 ));
- if ( normalized[i] < av->correspondence[j].fromCoord )
- {
- normalized[i] =
- FT_MulDiv( normalized[i] - av->correspondence[j - 1].fromCoord,
- av->correspondence[j].toCoord -
- av->correspondence[j - 1].toCoord,
- av->correspondence[j].fromCoord -
- av->correspondence[j - 1].fromCoord ) +
- av->correspondence[j - 1].toCoord;
- break;
- }
- }
- }
- }
-
- error = TT_Set_MM_Blend( face, mmvar->num_axis, normalized );
-
- Exit:
- FT_FREE( normalized );
- return error;
- }
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** GX VAR PARSING ROUTINES *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* tt_face_vary_cvt */
- /* */
- /* <Description> */
- /* Modify the loaded cvt table according to the `cvar' table and the */
- /* font's blend. */
- /* */
- /* <InOut> */
- /* face :: A handle to the target face object. */
- /* */
- /* <Input> */
- /* stream :: A handle to the input stream. */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. */
- /* */
- /* Most errors are ignored. It is perfectly valid not to have a */
- /* `cvar' table even if there is a `gvar' and `fvar' table. */
- /* */
- FT_LOCAL_DEF( FT_Error )
- tt_face_vary_cvt( TT_Face face,
- FT_Stream stream )
- {
- FT_Error error;
- FT_Memory memory = stream->memory;
- FT_ULong table_start;
- FT_ULong table_len;
- FT_UInt tupleCount;
- FT_ULong offsetToData;
- FT_ULong here;
- FT_UInt i, j;
- FT_Fixed* tuple_coords = NULL;
- FT_Fixed* im_start_coords = NULL;
- FT_Fixed* im_end_coords = NULL;
- GX_Blend blend = face->blend;
- FT_UInt point_count;
- FT_UShort* localpoints;
- FT_Short* deltas;
-
-
- FT_TRACE2(( "CVAR " ));
-
- if ( blend == NULL )
- {
- FT_TRACE2(( "\n"
- "tt_face_vary_cvt: no blend specified\n" ));
- error = FT_Err_Ok;
- goto Exit;
- }
-
- if ( face->cvt == NULL )
- {
- FT_TRACE2(( "\n"
- "tt_face_vary_cvt: no `cvt ' table\n" ));
- error = FT_Err_Ok;
- goto Exit;
- }
-
- error = face->goto_table( face, TTAG_cvar, stream, &table_len );
- if ( error )
- {
- FT_TRACE2(( "is missing\n" ));
-
- error = FT_Err_Ok;
- goto Exit;
- }
-
- if ( FT_FRAME_ENTER( table_len ) )
- {
- error = FT_Err_Ok;
- goto Exit;
- }
-
- table_start = FT_Stream_FTell( stream );
- if ( FT_GET_LONG() != 0x00010000L )
- {
- FT_TRACE2(( "bad table version\n" ));
-
- error = FT_Err_Ok;
- goto FExit;
- }
-
- FT_TRACE2(( "loaded\n" ));
-
- if ( FT_NEW_ARRAY( tuple_coords, blend->num_axis ) ||
- FT_NEW_ARRAY( im_start_coords, blend->num_axis ) ||
- FT_NEW_ARRAY( im_end_coords, blend->num_axis ) )
- goto FExit;
-
- tupleCount = FT_GET_USHORT();
- offsetToData = table_start + FT_GET_USHORT();
-
- /* The documentation implies there are flags packed into the */
- /* tuplecount, but John Jenkins says that shared points don't apply */
- /* to `cvar', and no other flags are defined. */
-
- FT_TRACE5(( "cvar: there are %d tuples:\n", tupleCount ));
-
- for ( i = 0; i < ( tupleCount & 0xFFF ); i++ )
- {
- FT_UInt tupleDataSize;
- FT_UInt tupleIndex;
- FT_Fixed apply;
-
-
- FT_TRACE6(( " tuple %d:\n", i ));
-
- tupleDataSize = FT_GET_USHORT();
- tupleIndex = FT_GET_USHORT();
-
- /* There is no provision here for a global tuple coordinate section, */
- /* so John says. There are no tuple indices, just embedded tuples. */
-
- if ( tupleIndex & GX_TI_EMBEDDED_TUPLE_COORD )
- {
- for ( j = 0; j < blend->num_axis; j++ )
- tuple_coords[j] = FT_GET_SHORT() * 4; /* convert from */
- /* short frac to fixed */
- }
- else
- {
- /* skip this tuple; it makes no sense */
-
- if ( tupleIndex & GX_TI_INTERMEDIATE_TUPLE )
- for ( j = 0; j < 2 * blend->num_axis; j++ )
- (void)FT_GET_SHORT();
-
- offsetToData += tupleDataSize;
- continue;
- }
-
- if ( tupleIndex & GX_TI_INTERMEDIATE_TUPLE )
- {
- for ( j = 0; j < blend->num_axis; j++ )
- im_start_coords[j] = FT_GET_SHORT() * 4;
- for ( j = 0; j < blend->num_axis; j++ )
- im_end_coords[j] = FT_GET_SHORT() * 4;
- }
-
- apply = ft_var_apply_tuple( blend,
- (FT_UShort)tupleIndex,
- tuple_coords,
- im_start_coords,
- im_end_coords );
- if ( /* tuple isn't active for our blend */
- apply == 0 ||
- /* global points not allowed, */
- /* if they aren't local, makes no sense */
- !( tupleIndex & GX_TI_PRIVATE_POINT_NUMBERS ) )
- {
- offsetToData += tupleDataSize;
- continue;
- }
-
- here = FT_Stream_FTell( stream );
-
- FT_Stream_SeekSet( stream, offsetToData );
-
- localpoints = ft_var_readpackedpoints( stream, &point_count );
- deltas = ft_var_readpackeddeltas( stream,
- point_count == 0 ? face->cvt_size
- : point_count );
- if ( localpoints == NULL || deltas == NULL )
- ; /* failure, ignore it */
-
- else if ( localpoints == ALL_POINTS )
- {
-#ifdef FT_DEBUG_LEVEL_TRACE
- int count = 0;
-#endif
-
-
- FT_TRACE7(( " CVT deltas:\n" ));
-
- /* this means that there are deltas for every entry in cvt */
- for ( j = 0; j < face->cvt_size; j++ )
- {
- FT_Long orig_cvt = face->cvt[j];
-
-
- face->cvt[j] = (FT_Short)( orig_cvt +
- FT_MulFix( deltas[j], apply ) );
-
-#ifdef FT_DEBUG_LEVEL_TRACE
- if ( orig_cvt != face->cvt[j] )
- {
- FT_TRACE7(( " %d: %d -> %d\n",
- j, orig_cvt, face->cvt[j] ));
- count++;
- }
-#endif
- }
-
-#ifdef FT_DEBUG_LEVEL_TRACE
- if ( !count )
- FT_TRACE7(( " none\n" ));
-#endif
- }
-
- else
- {
-#ifdef FT_DEBUG_LEVEL_TRACE
- int count = 0;
-#endif
-
-
- FT_TRACE7(( " CVT deltas:\n" ));
-
- for ( j = 0; j < point_count; j++ )
- {
- int pindex = localpoints[j];
- FT_Long orig_cvt = face->cvt[pindex];
-
-
- face->cvt[pindex] = (FT_Short)( orig_cvt +
- FT_MulFix( deltas[j], apply ) );
-
-#ifdef FT_DEBUG_LEVEL_TRACE
- if ( orig_cvt != face->cvt[pindex] )
- {
- FT_TRACE7(( " %d: %d -> %d\n",
- pindex, orig_cvt, face->cvt[pindex] ));
- count++;
- }
-#endif
- }
-
-#ifdef FT_DEBUG_LEVEL_TRACE
- if ( !count )
- FT_TRACE7(( " none\n" ));
-#endif
- }
-
- if ( localpoints != ALL_POINTS )
- FT_FREE( localpoints );
- FT_FREE( deltas );
-
- offsetToData += tupleDataSize;
-
- FT_Stream_SeekSet( stream, here );
- }
-
- FT_TRACE5(( "\n" ));
-
- FExit:
- FT_FRAME_EXIT();
-
- Exit:
- FT_FREE( tuple_coords );
- FT_FREE( im_start_coords );
- FT_FREE( im_end_coords );
-
- return error;
- }
-
-
- /* Shift the original coordinates of all points between indices `p1' */
- /* and `p2', using the same difference as given by index `ref'. */
-
- /* modeled after `af_iup_shift' */
-
- static void
- tt_delta_shift( int p1,
- int p2,
- int ref,
- FT_Vector* in_points,
- FT_Vector* out_points )
- {
- int p;
- FT_Vector delta;
-
-
- delta.x = out_points[ref].x - in_points[ref].x;
- delta.y = out_points[ref].y - in_points[ref].y;
-
- if ( delta.x == 0 && delta.y == 0 )
- return;
-
- for ( p = p1; p < ref; p++ )
- {
- out_points[p].x += delta.x;
- out_points[p].y += delta.y;
- }
-
- for ( p = ref + 1; p <= p2; p++ )
- {
- out_points[p].x += delta.x;
- out_points[p].y += delta.y;
- }
- }
-
-
- /* Interpolate the original coordinates of all points with indices */
- /* between `p1' and `p2', using `ref1' and `ref2' as the reference */
- /* point indices. */
-
- /* modeled after `af_iup_interp', `_iup_worker_interpolate', and */
- /* `Ins_IUP' */
-
- static void
- tt_delta_interpolate( int p1,
- int p2,
- int ref1,
- int ref2,
- FT_Vector* in_points,
- FT_Vector* out_points )
- {
- int p, i;
-
- FT_Pos out, in1, in2, out1, out2, d1, d2;
-
-
- if ( p1 > p2 )
- return;
-
- /* handle both horizontal and vertical coordinates */
- for ( i = 0; i <= 1; i++ )
- {
- /* shift array pointers so that we can access `foo.y' as `foo.x' */
- in_points = (FT_Vector*)( (FT_Pos*)in_points + i );
- out_points = (FT_Vector*)( (FT_Pos*)out_points + i );
-
- if ( in_points[ref1].x > in_points[ref2].x )
- {
- p = ref1;
- ref1 = ref2;
- ref2 = p;
- }
-
- in1 = in_points[ref1].x;
- in2 = in_points[ref2].x;
- out1 = out_points[ref1].x;
- out2 = out_points[ref2].x;
- d1 = out1 - in1;
- d2 = out2 - in2;
-
- if ( out1 == out2 || in1 == in2 )
- {
- for ( p = p1; p <= p2; p++ )
- {
- out = in_points[p].x;
-
- if ( out <= in1 )
- out += d1;
- else if ( out >= in2 )
- out += d2;
- else
- out = out1;
-
- out_points[p].x = out;
- }
- }
- else
- {
- FT_Fixed scale = FT_DivFix( out2 - out1, in2 - in1 );
-
-
- for ( p = p1; p <= p2; p++ )
- {
- out = in_points[p].x;
-
- if ( out <= in1 )
- out += d1;
- else if ( out >= in2 )
- out += d2;
- else
- out = out1 + FT_MulFix( out - in1, scale );
-
- out_points[p].x = out;
- }
- }
- }
- }
-
-
- /* Interpolate points without delta values, similar to */
- /* the `IUP' hinting instruction. */
-
- /* modeled after `Ins_IUP */
-
- static void
- tt_handle_deltas( FT_Outline* outline,
- FT_Vector* in_points,
- FT_Bool* has_delta )
- {
- FT_Vector* out_points;
-
- FT_Int first_point;
- FT_Int end_point;
-
- FT_Int first_delta;
- FT_Int cur_delta;
-
- FT_Int point;
- FT_Short contour;
-
-
- /* ignore empty outlines */
- if ( !outline->n_contours )
- return;
-
- out_points = outline->points;
-
- contour = 0;
- point = 0;
-
- do
- {
- end_point = outline->contours[contour];
- first_point = point;
-
- /* search first point that has a delta */
- while ( point <= end_point && !has_delta[point] )
- point++;
-
- if ( point <= end_point )
- {
- first_delta = point;
- cur_delta = point;
-
- point++;
-
- while ( point <= end_point )
- {
- /* search next point that has a delta */
- /* and interpolate intermediate points */
- if ( has_delta[point] )
- {
- tt_delta_interpolate( cur_delta + 1,
- point - 1,
- cur_delta,
- point,
- in_points,
- out_points );
- cur_delta = point;
- }
-
- point++;
- }
-
- /* shift contour if we only have a single delta */
- if ( cur_delta == first_delta )
- tt_delta_shift( first_point,
- end_point,
- cur_delta,
- in_points,
- out_points );
- else
- {
- /* otherwise handle remaining points */
- /* at the end and beginning of the contour */
- tt_delta_interpolate( cur_delta + 1,
- end_point,
- cur_delta,
- first_delta,
- in_points,
- out_points );
-
- if ( first_delta > 0 )
- tt_delta_interpolate( first_point,
- first_delta - 1,
- cur_delta,
- first_delta,
- in_points,
- out_points );
- }
- }
- contour++;
-
- } while ( contour < outline->n_contours );
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Vary_Apply_Glyph_Deltas */
- /* */
- /* <Description> */
- /* Apply the appropriate deltas to the current glyph. */
- /* */
- /* <Input> */
- /* face :: A handle to the target face object. */
- /* */
- /* glyph_index :: The index of the glyph being modified. */
- /* */
- /* n_points :: The number of the points in the glyph, including */
- /* phantom points. */
- /* */
- /* <InOut> */
- /* outline :: The outline to change. */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. */
- /* */
- FT_LOCAL_DEF( FT_Error )
- TT_Vary_Apply_Glyph_Deltas( TT_Face face,
- FT_UInt glyph_index,
- FT_Outline* outline,
- FT_UInt n_points )
- {
- FT_Stream stream = face->root.stream;
- FT_Memory memory = stream->memory;
- GX_Blend blend = face->blend;
-
- FT_Vector* points_org = NULL;
- FT_Bool* has_delta = NULL;
-
- FT_Error error;
- FT_ULong glyph_start;
- FT_UInt tupleCount;
- FT_ULong offsetToData;
- FT_ULong here;
- FT_UInt i, j;
- FT_Fixed* tuple_coords = NULL;
- FT_Fixed* im_start_coords = NULL;
- FT_Fixed* im_end_coords = NULL;
- FT_UInt point_count, spoint_count = 0;
- FT_UShort* sharedpoints = NULL;
- FT_UShort* localpoints = NULL;
- FT_UShort* points;
- FT_Short *deltas_x, *deltas_y;
-
-
- if ( !face->doblend || blend == NULL )
- return FT_THROW( Invalid_Argument );
-
- if ( glyph_index >= blend->gv_glyphcnt ||
- blend->glyphoffsets[glyph_index] ==
- blend->glyphoffsets[glyph_index + 1] )
- {
- FT_TRACE2(( "TT_Vary_Apply_Glyph_Deltas:"
- " no variation data for this glyph\n" ));
- return FT_Err_Ok;
- }
-
- if ( FT_NEW_ARRAY( points_org, n_points ) ||
- FT_NEW_ARRAY( has_delta, n_points ) )
- goto Fail1;
-
- if ( FT_STREAM_SEEK( blend->glyphoffsets[glyph_index] ) ||
- FT_FRAME_ENTER( blend->glyphoffsets[glyph_index + 1] -
- blend->glyphoffsets[glyph_index] ) )
- goto Fail1;
-
- glyph_start = FT_Stream_FTell( stream );
-
- /* each set of glyph variation data is formatted similarly to `cvar' */
- /* (except we get shared points and global tuples) */
-
- if ( FT_NEW_ARRAY( tuple_coords, blend->num_axis ) ||
- FT_NEW_ARRAY( im_start_coords, blend->num_axis ) ||
- FT_NEW_ARRAY( im_end_coords, blend->num_axis ) )
- goto Fail2;
-
- tupleCount = FT_GET_USHORT();
- offsetToData = glyph_start + FT_GET_USHORT();
-
- if ( tupleCount & GX_TC_TUPLES_SHARE_POINT_NUMBERS )
- {
- here = FT_Stream_FTell( stream );
-
- FT_Stream_SeekSet( stream, offsetToData );
-
- sharedpoints = ft_var_readpackedpoints( stream, &spoint_count );
- offsetToData = FT_Stream_FTell( stream );
-
- FT_Stream_SeekSet( stream, here );
- }
-
- FT_TRACE5(( "gvar: there are %d tuples:\n", tupleCount ));
-
- for ( i = 0; i < ( tupleCount & GX_TC_TUPLE_COUNT_MASK ); i++ )
- {
- FT_UInt tupleDataSize;
- FT_UInt tupleIndex;
- FT_Fixed apply;
-
-
- FT_TRACE6(( " tuple %d:\n", i ));
-
- tupleDataSize = FT_GET_USHORT();
- tupleIndex = FT_GET_USHORT();
-
- if ( tupleIndex & GX_TI_EMBEDDED_TUPLE_COORD )
- {
- for ( j = 0; j < blend->num_axis; j++ )
- tuple_coords[j] = FT_GET_SHORT() * 4; /* convert from */
- /* short frac to fixed */
- }
- else if ( ( tupleIndex & GX_TI_TUPLE_INDEX_MASK ) >= blend->tuplecount )
- {
- error = FT_THROW( Invalid_Table );
- goto Fail2;
- }
- else
- FT_MEM_COPY(
- tuple_coords,
- &blend->tuplecoords[( tupleIndex & 0xFFF ) * blend->num_axis],
- blend->num_axis * sizeof ( FT_Fixed ) );
-
- if ( tupleIndex & GX_TI_INTERMEDIATE_TUPLE )
- {
- for ( j = 0; j < blend->num_axis; j++ )
- im_start_coords[j] = FT_GET_SHORT() * 4;
- for ( j = 0; j < blend->num_axis; j++ )
- im_end_coords[j] = FT_GET_SHORT() * 4;
- }
-
- apply = ft_var_apply_tuple( blend,
- (FT_UShort)tupleIndex,
- tuple_coords,
- im_start_coords,
- im_end_coords );
-
- if ( apply == 0 ) /* tuple isn't active for our blend */
- {
- offsetToData += tupleDataSize;
- continue;
- }
-
- here = FT_Stream_FTell( stream );
-
- if ( tupleIndex & GX_TI_PRIVATE_POINT_NUMBERS )
- {
- FT_Stream_SeekSet( stream, offsetToData );
-
- localpoints = ft_var_readpackedpoints( stream, &point_count );
- points = localpoints;
- }
- else
- {
- points = sharedpoints;
- point_count = spoint_count;
- }
-
- deltas_x = ft_var_readpackeddeltas( stream,
- point_count == 0 ? n_points
- : point_count );
- deltas_y = ft_var_readpackeddeltas( stream,
- point_count == 0 ? n_points
- : point_count );
-
- if ( points == NULL || deltas_y == NULL || deltas_x == NULL )
- ; /* failure, ignore it */
-
- else if ( points == ALL_POINTS )
- {
-#ifdef FT_DEBUG_LEVEL_TRACE
- int count = 0;
-#endif
-
-
- FT_TRACE7(( " point deltas:\n" ));
-
- /* this means that there are deltas for every point in the glyph */
- for ( j = 0; j < n_points; j++ )
- {
-#ifdef FT_DEBUG_LEVEL_TRACE
- FT_Vector point_org = outline->points[j];
-#endif
-
-
- outline->points[j].x += FT_MulFix( deltas_x[j], apply );
- outline->points[j].y += FT_MulFix( deltas_y[j], apply );
-
-#ifdef FT_DEBUG_LEVEL_TRACE
- if ( ( point_org.x != outline->points[j].x ) ||
- ( point_org.y != outline->points[j].y ) )
- {
- FT_TRACE7(( " %d: (%d, %d) -> (%d, %d)\n",
- j,
- point_org.x,
- point_org.y,
- outline->points[j].x,
- outline->points[j].y ));
- count++;
- }
-#endif
- }
-
-#ifdef FT_DEBUG_LEVEL_TRACE
- if ( !count )
- FT_TRACE7(( " none\n" ));
-#endif
- }
-
- else
- {
-#ifdef FT_DEBUG_LEVEL_TRACE
- int count = 0;
-#endif
-
-
- /* we have to interpolate the missing deltas similar to the */
- /* IUP bytecode instruction */
- for ( j = 0; j < n_points; j++ )
- {
- points_org[j] = outline->points[j];
- has_delta[j] = FALSE;
- }
-
- for ( j = 0; j < point_count; j++ )
- {
- FT_UShort idx = localpoints[j];
-
-
- if ( idx >= n_points )
- continue;
-
- has_delta[idx] = TRUE;
-
- outline->points[idx].x += FT_MulFix( deltas_x[j], apply );
- outline->points[idx].y += FT_MulFix( deltas_y[j], apply );
- }
-
- /* no need to handle phantom points here, */
- /* since solitary points can't be interpolated */
- tt_handle_deltas( outline,
- points_org,
- has_delta );
-
-#ifdef FT_DEBUG_LEVEL_TRACE
- FT_TRACE7(( " point deltas:\n" ));
-
- for ( j = 0; j < n_points; j++)
- {
- if ( ( points_org[j].x != outline->points[j].x ) ||
- ( points_org[j].y != outline->points[j].y ) )
- {
- FT_TRACE7(( " %d: (%d, %d) -> (%d, %d)\n",
- j,
- points_org[j].x,
- points_org[j].y,
- outline->points[j].x,
- outline->points[j].y ));
- count++;
- }
- }
-
- if ( !count )
- FT_TRACE7(( " none\n" ));
-#endif
- }
-
- if ( localpoints != ALL_POINTS )
- FT_FREE( localpoints );
- FT_FREE( deltas_x );
- FT_FREE( deltas_y );
-
- offsetToData += tupleDataSize;
-
- FT_Stream_SeekSet( stream, here );
- }
-
- FT_TRACE5(( "\n" ));
-
- Fail2:
- FT_FREE( tuple_coords );
- FT_FREE( im_start_coords );
- FT_FREE( im_end_coords );
-
- FT_FRAME_EXIT();
-
- Fail1:
- FT_FREE( points_org );
- FT_FREE( has_delta );
-
- return error;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* tt_done_blend */
- /* */
- /* <Description> */
- /* Free the blend internal data structure. */
- /* */
- FT_LOCAL_DEF( void )
- tt_done_blend( FT_Memory memory,
- GX_Blend blend )
- {
- if ( blend != NULL )
- {
- FT_UInt i;
-
-
- FT_FREE( blend->normalizedcoords );
- FT_FREE( blend->mmvar );
-
- if ( blend->avar_segment != NULL )
- {
- for ( i = 0; i < blend->num_axis; i++ )
- FT_FREE( blend->avar_segment[i].correspondence );
- FT_FREE( blend->avar_segment );
- }
-
- FT_FREE( blend->tuplecoords );
- FT_FREE( blend->glyphoffsets );
- FT_FREE( blend );
- }
- }
-
-#endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/truetype/ttgxvar.h b/chromium/third_party/pdfium/third_party/freetype/src/truetype/ttgxvar.h
deleted file mode 100644
index 060d4d60eaf..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/truetype/ttgxvar.h
+++ /dev/null
@@ -1,182 +0,0 @@
-/***************************************************************************/
-/* */
-/* ttgxvar.h */
-/* */
-/* TrueType GX Font Variation loader (specification) */
-/* */
-/* Copyright 2004-2015 by */
-/* David Turner, Robert Wilhelm, Werner Lemberg and George Williams. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __TTGXVAR_H__
-#define __TTGXVAR_H__
-
-
-#include <ft2build.h>
-#include "ttobjs.h"
-
-
-FT_BEGIN_HEADER
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* GX_AVarCorrespondenceRec */
- /* */
- /* <Description> */
- /* A data structure representing `shortFracCorrespondence' in `avar' */
- /* table according to the specifications from Apple. */
- /* */
- typedef struct GX_AVarCorrespondenceRec_
- {
- FT_Fixed fromCoord;
- FT_Fixed toCoord;
-
- } GX_AVarCorrespondenceRec_, *GX_AVarCorrespondence;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* GX_AVarRec */
- /* */
- /* <Description> */
- /* Data from the segment field of `avar' table. */
- /* There is one of these for each axis. */
- /* */
- typedef struct GX_AVarSegmentRec_
- {
- FT_UShort pairCount;
- GX_AVarCorrespondence correspondence; /* array with pairCount entries */
-
- } GX_AVarSegmentRec, *GX_AVarSegment;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* GX_BlendRec */
- /* */
- /* <Description> */
- /* Data for interpolating a font from a distortable font specified */
- /* by the GX *var tables ([fgca]var). */
- /* */
- /* <Fields> */
- /* num_axis :: The number of axes along which interpolation */
- /* may happen */
- /* */
- /* normalizedcoords :: A normalized value (between [-1,1]) indicating */
- /* the contribution along each axis to the final */
- /* interpolated font. */
- /* */
- typedef struct GX_BlendRec_
- {
- FT_UInt num_axis;
- FT_Fixed* normalizedcoords;
-
- FT_MM_Var* mmvar;
- FT_Offset mmvar_len;
-
- FT_Bool avar_checked;
- GX_AVarSegment avar_segment;
-
- FT_UInt tuplecount; /* shared tuples in `gvar' */
- FT_Fixed* tuplecoords; /* tuplecoords[tuplecount][num_axis] */
-
- FT_UInt gv_glyphcnt;
- FT_ULong* glyphoffsets;
-
- } GX_BlendRec;
-
-
- /*************************************************************************/
- /* */
- /* <enum> */
- /* GX_TupleCountFlags */
- /* */
- /* <Description> */
- /* Flags used within the `TupleCount' field of the `gvar' table. */
- /* */
- typedef enum GX_TupleCountFlags_
- {
- GX_TC_TUPLES_SHARE_POINT_NUMBERS = 0x8000,
- GX_TC_RESERVED_TUPLE_FLAGS = 0x7000,
- GX_TC_TUPLE_COUNT_MASK = 0x0FFF
-
- } GX_TupleCountFlags;
-
-
- /*************************************************************************/
- /* */
- /* <enum> */
- /* GX_TupleIndexFlags */
- /* */
- /* <Description> */
- /* Flags used within the `TupleIndex' field of the `gvar' and `cvar' */
- /* tables. */
- /* */
- typedef enum GX_TupleIndexFlags_
- {
- GX_TI_EMBEDDED_TUPLE_COORD = 0x8000,
- GX_TI_INTERMEDIATE_TUPLE = 0x4000,
- GX_TI_PRIVATE_POINT_NUMBERS = 0x2000,
- GX_TI_RESERVED_TUPLE_FLAG = 0x1000,
- GX_TI_TUPLE_INDEX_MASK = 0x0FFF
-
- } GX_TupleIndexFlags;
-
-
-#define TTAG_wght FT_MAKE_TAG( 'w', 'g', 'h', 't' )
-#define TTAG_wdth FT_MAKE_TAG( 'w', 'd', 't', 'h' )
-#define TTAG_opsz FT_MAKE_TAG( 'o', 'p', 's', 'z' )
-#define TTAG_slnt FT_MAKE_TAG( 's', 'l', 'n', 't' )
-
-
- FT_LOCAL( FT_Error )
- TT_Set_MM_Blend( TT_Face face,
- FT_UInt num_coords,
- FT_Fixed* coords );
-
- FT_LOCAL( FT_Error )
- TT_Set_Var_Design( TT_Face face,
- FT_UInt num_coords,
- FT_Fixed* coords );
-
- FT_LOCAL( FT_Error )
- TT_Get_MM_Var( TT_Face face,
- FT_MM_Var* *master );
-
-
- FT_LOCAL( FT_Error )
- tt_face_vary_cvt( TT_Face face,
- FT_Stream stream );
-
-
- FT_LOCAL( FT_Error )
- TT_Vary_Apply_Glyph_Deltas( TT_Face face,
- FT_UInt glyph_index,
- FT_Outline* outline,
- FT_UInt n_points );
-
-
- FT_LOCAL( void )
- tt_done_blend( FT_Memory memory,
- GX_Blend blend );
-
-
-FT_END_HEADER
-
-
-#endif /* __TTGXVAR_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/truetype/ttinterp.c b/chromium/third_party/pdfium/third_party/freetype/src/truetype/ttinterp.c
deleted file mode 100644
index ae2a82adc5e..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/truetype/ttinterp.c
+++ /dev/null
@@ -1,8275 +0,0 @@
-/***************************************************************************/
-/* */
-/* ttinterp.c */
-/* */
-/* TrueType bytecode interpreter (body). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-/* Greg Hitchcock from Microsoft has helped a lot in resolving unclear */
-/* issues; many thanks! */
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_CALC_H
-#include FT_TRIGONOMETRY_H
-#include FT_SYSTEM_H
-#include FT_TRUETYPE_DRIVER_H
-
-#include "ttinterp.h"
-#include "tterrors.h"
-#include "ttsubpix.h"
-
-
-#ifdef TT_USE_BYTECODE_INTERPRETER
-
-
- /*************************************************************************/
- /* */
- /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
- /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
- /* messages during execution. */
- /* */
-#undef FT_COMPONENT
-#define FT_COMPONENT trace_ttinterp
-
-
- /*************************************************************************/
- /* */
- /* In order to detect infinite loops in the code, we set up a counter */
- /* within the run loop. A single stroke of interpretation is now */
- /* limited to a maximum number of opcodes defined below. */
- /* */
-#define MAX_RUNNABLE_OPCODES 1000000L
-
-
-#define SUBPIXEL_HINTING \
- ( ((TT_Driver)FT_FACE_DRIVER( exc->face ))->interpreter_version == \
- TT_INTERPRETER_VERSION_38 )
-
-
-#define PROJECT( v1, v2 ) \
- exc->func_project( exc, (v1)->x - (v2)->x, (v1)->y - (v2)->y )
-
-#define DUALPROJ( v1, v2 ) \
- exc->func_dualproj( exc, (v1)->x - (v2)->x, (v1)->y - (v2)->y )
-
-#define FAST_PROJECT( v ) \
- exc->func_project( exc, (v)->x, (v)->y )
-
-#define FAST_DUALPROJ( v ) \
- exc->func_dualproj( exc, (v)->x, (v)->y )
-
-
- /*************************************************************************/
- /* */
- /* Instruction dispatch function, as used by the interpreter. */
- /* */
- typedef void (*TInstruction_Function)( TT_ExecContext exc,
- FT_Long* args );
-
-
- /*************************************************************************/
- /* */
- /* Two simple bounds-checking macros. */
- /* */
-#define BOUNDS( x, n ) ( (FT_UInt)(x) >= (FT_UInt)(n) )
-#define BOUNDSL( x, n ) ( (FT_ULong)(x) >= (FT_ULong)(n) )
-
-
-#undef SUCCESS
-#define SUCCESS 0
-
-#undef FAILURE
-#define FAILURE 1
-
-#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
-#define GUESS_VECTOR( V ) \
- do \
- { \
- if ( exc->face->unpatented_hinting ) \
- { \
- exc->GS.V.x = (FT_F2Dot14)( exc->GS.both_x_axis ? 0x4000 : 0 ); \
- exc->GS.V.y = (FT_F2Dot14)( exc->GS.both_x_axis ? 0 : 0x4000 ); \
- } \
- } while (0)
-#else
-#define GUESS_VECTOR( V ) do { } while (0)
-#endif
-
-
- /*************************************************************************/
- /* */
- /* CODERANGE FUNCTIONS */
- /* */
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Goto_CodeRange */
- /* */
- /* <Description> */
- /* Switches to a new code range (updates the code related elements in */
- /* `exec', and `IP'). */
- /* */
- /* <Input> */
- /* range :: The new execution code range. */
- /* */
- /* IP :: The new IP in the new code range. */
- /* */
- /* <InOut> */
- /* exec :: The target execution context. */
- /* */
- FT_LOCAL_DEF( void )
- TT_Goto_CodeRange( TT_ExecContext exec,
- FT_Int range,
- FT_Long IP )
- {
- TT_CodeRange* coderange;
-
-
- FT_ASSERT( range >= 1 && range <= 3 );
-
- coderange = &exec->codeRangeTable[range - 1];
-
- FT_ASSERT( coderange->base != NULL );
-
- /* NOTE: Because the last instruction of a program may be a CALL */
- /* which will return to the first byte *after* the code */
- /* range, we test for IP <= Size instead of IP < Size. */
- /* */
- FT_ASSERT( IP <= coderange->size );
-
- exec->code = coderange->base;
- exec->codeSize = coderange->size;
- exec->IP = IP;
- exec->curRange = range;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Set_CodeRange */
- /* */
- /* <Description> */
- /* Sets a code range. */
- /* */
- /* <Input> */
- /* range :: The code range index. */
- /* */
- /* base :: The new code base. */
- /* */
- /* length :: The range size in bytes. */
- /* */
- /* <InOut> */
- /* exec :: The target execution context. */
- /* */
- FT_LOCAL_DEF( void )
- TT_Set_CodeRange( TT_ExecContext exec,
- FT_Int range,
- void* base,
- FT_Long length )
- {
- FT_ASSERT( range >= 1 && range <= 3 );
-
- exec->codeRangeTable[range - 1].base = (FT_Byte*)base;
- exec->codeRangeTable[range - 1].size = length;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Clear_CodeRange */
- /* */
- /* <Description> */
- /* Clears a code range. */
- /* */
- /* <Input> */
- /* range :: The code range index. */
- /* */
- /* <InOut> */
- /* exec :: The target execution context. */
- /* */
- FT_LOCAL_DEF( void )
- TT_Clear_CodeRange( TT_ExecContext exec,
- FT_Int range )
- {
- FT_ASSERT( range >= 1 && range <= 3 );
-
- exec->codeRangeTable[range - 1].base = NULL;
- exec->codeRangeTable[range - 1].size = 0;
- }
-
-
- /*************************************************************************/
- /* */
- /* EXECUTION CONTEXT ROUTINES */
- /* */
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Done_Context */
- /* */
- /* <Description> */
- /* Destroys a given context. */
- /* */
- /* <Input> */
- /* exec :: A handle to the target execution context. */
- /* */
- /* memory :: A handle to the parent memory object. */
- /* */
- /* <Note> */
- /* Only the glyph loader and debugger should call this function. */
- /* */
- FT_LOCAL_DEF( void )
- TT_Done_Context( TT_ExecContext exec )
- {
- FT_Memory memory = exec->memory;
-
-
- /* points zone */
- exec->maxPoints = 0;
- exec->maxContours = 0;
-
- /* free stack */
- FT_FREE( exec->stack );
- exec->stackSize = 0;
-
- /* free call stack */
- FT_FREE( exec->callStack );
- exec->callSize = 0;
- exec->callTop = 0;
-
- /* free glyph code range */
- FT_FREE( exec->glyphIns );
- exec->glyphSize = 0;
-
- exec->size = NULL;
- exec->face = NULL;
-
- FT_FREE( exec );
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* Init_Context */
- /* */
- /* <Description> */
- /* Initializes a context object. */
- /* */
- /* <Input> */
- /* memory :: A handle to the parent memory object. */
- /* */
- /* <InOut> */
- /* exec :: A handle to the target execution context. */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. */
- /* */
- static FT_Error
- Init_Context( TT_ExecContext exec,
- FT_Memory memory )
- {
- FT_Error error;
-
-
- FT_TRACE1(( "Init_Context: new object at 0x%08p\n", exec ));
-
- exec->memory = memory;
- exec->callSize = 32;
-
- if ( FT_NEW_ARRAY( exec->callStack, exec->callSize ) )
- goto Fail_Memory;
-
- /* all values in the context are set to 0 already, but this is */
- /* here as a remainder */
- exec->maxPoints = 0;
- exec->maxContours = 0;
-
- exec->stackSize = 0;
- exec->glyphSize = 0;
-
- exec->stack = NULL;
- exec->glyphIns = NULL;
-
- exec->face = NULL;
- exec->size = NULL;
-
- return FT_Err_Ok;
-
- Fail_Memory:
- FT_ERROR(( "Init_Context: not enough memory for %p\n", exec ));
- TT_Done_Context( exec );
-
- return error;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* Update_Max */
- /* */
- /* <Description> */
- /* Checks the size of a buffer and reallocates it if necessary. */
- /* */
- /* <Input> */
- /* memory :: A handle to the parent memory object. */
- /* */
- /* multiplier :: The size in bytes of each element in the buffer. */
- /* */
- /* new_max :: The new capacity (size) of the buffer. */
- /* */
- /* <InOut> */
- /* size :: The address of the buffer's current size expressed */
- /* in elements. */
- /* */
- /* buff :: The address of the buffer base pointer. */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. */
- /* */
- FT_LOCAL_DEF( FT_Error )
- Update_Max( FT_Memory memory,
- FT_ULong* size,
- FT_ULong multiplier,
- void* _pbuff,
- FT_ULong new_max )
- {
- FT_Error error;
- void** pbuff = (void**)_pbuff;
-
-
- if ( *size < new_max )
- {
- if ( FT_REALLOC( *pbuff, *size * multiplier, new_max * multiplier ) )
- return error;
- *size = new_max;
- }
-
- return FT_Err_Ok;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Load_Context */
- /* */
- /* <Description> */
- /* Prepare an execution context for glyph hinting. */
- /* */
- /* <Input> */
- /* face :: A handle to the source face object. */
- /* */
- /* size :: A handle to the source size object. */
- /* */
- /* <InOut> */
- /* exec :: A handle to the target execution context. */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. */
- /* */
- /* <Note> */
- /* Only the glyph loader and debugger should call this function. */
- /* */
- FT_LOCAL_DEF( FT_Error )
- TT_Load_Context( TT_ExecContext exec,
- TT_Face face,
- TT_Size size )
- {
- FT_Int i;
- FT_ULong tmp;
- TT_MaxProfile* maxp;
- FT_Error error;
-
-
- exec->face = face;
- maxp = &face->max_profile;
- exec->size = size;
-
- if ( size )
- {
- exec->numFDefs = size->num_function_defs;
- exec->maxFDefs = size->max_function_defs;
- exec->numIDefs = size->num_instruction_defs;
- exec->maxIDefs = size->max_instruction_defs;
- exec->FDefs = size->function_defs;
- exec->IDefs = size->instruction_defs;
- exec->tt_metrics = size->ttmetrics;
- exec->metrics = size->metrics;
-
- exec->maxFunc = size->max_func;
- exec->maxIns = size->max_ins;
-
- for ( i = 0; i < TT_MAX_CODE_RANGES; i++ )
- exec->codeRangeTable[i] = size->codeRangeTable[i];
-
- /* set graphics state */
- exec->GS = size->GS;
-
- exec->cvtSize = size->cvt_size;
- exec->cvt = size->cvt;
-
- exec->storeSize = size->storage_size;
- exec->storage = size->storage;
-
- exec->twilight = size->twilight;
-
- /* In case of multi-threading it can happen that the old size object */
- /* no longer exists, thus we must clear all glyph zone references. */
- ft_memset( &exec->zp0, 0, sizeof ( exec->zp0 ) );
- exec->zp1 = exec->zp0;
- exec->zp2 = exec->zp0;
- }
-
- /* XXX: We reserve a little more elements on the stack to deal safely */
- /* with broken fonts like arialbs, courbs, timesbs, etc. */
- tmp = (FT_ULong)exec->stackSize;
- error = Update_Max( exec->memory,
- &tmp,
- sizeof ( FT_F26Dot6 ),
- (void*)&exec->stack,
- maxp->maxStackElements + 32 );
- exec->stackSize = (FT_Long)tmp;
- if ( error )
- return error;
-
- tmp = exec->glyphSize;
- error = Update_Max( exec->memory,
- &tmp,
- sizeof ( FT_Byte ),
- (void*)&exec->glyphIns,
- maxp->maxSizeOfInstructions );
- exec->glyphSize = (FT_UShort)tmp;
- if ( error )
- return error;
-
- exec->pts.n_points = 0;
- exec->pts.n_contours = 0;
-
- exec->zp1 = exec->pts;
- exec->zp2 = exec->pts;
- exec->zp0 = exec->pts;
-
- exec->instruction_trap = FALSE;
-
- return FT_Err_Ok;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Save_Context */
- /* */
- /* <Description> */
- /* Saves the code ranges in a `size' object. */
- /* */
- /* <Input> */
- /* exec :: A handle to the source execution context. */
- /* */
- /* <InOut> */
- /* size :: A handle to the target size object. */
- /* */
- /* <Note> */
- /* Only the glyph loader and debugger should call this function. */
- /* */
- FT_LOCAL_DEF( void )
- TT_Save_Context( TT_ExecContext exec,
- TT_Size size )
- {
- FT_Int i;
-
-
- /* XXX: Will probably disappear soon with all the code range */
- /* management, which is now rather obsolete. */
- /* */
- size->num_function_defs = exec->numFDefs;
- size->num_instruction_defs = exec->numIDefs;
-
- size->max_func = exec->maxFunc;
- size->max_ins = exec->maxIns;
-
- for ( i = 0; i < TT_MAX_CODE_RANGES; i++ )
- size->codeRangeTable[i] = exec->codeRangeTable[i];
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Run_Context */
- /* */
- /* <Description> */
- /* Executes one or more instructions in the execution context. */
- /* */
- /* <Input> */
- /* debug :: A Boolean flag. If set, the function sets some internal */
- /* variables and returns immediately, otherwise TT_RunIns() */
- /* is called. */
- /* */
- /* This is commented out currently. */
- /* */
- /* <Input> */
- /* exec :: A handle to the target execution context. */
- /* */
- /* <Return> */
- /* TrueType error code. 0 means success. */
- /* */
- FT_LOCAL_DEF( FT_Error )
- TT_Run_Context( TT_ExecContext exec )
- {
- TT_Goto_CodeRange( exec, tt_coderange_glyph, 0 );
-
- exec->zp0 = exec->pts;
- exec->zp1 = exec->pts;
- exec->zp2 = exec->pts;
-
- exec->GS.gep0 = 1;
- exec->GS.gep1 = 1;
- exec->GS.gep2 = 1;
-
- exec->GS.projVector.x = 0x4000;
- exec->GS.projVector.y = 0x0000;
-
- exec->GS.freeVector = exec->GS.projVector;
- exec->GS.dualVector = exec->GS.projVector;
-
-#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
- exec->GS.both_x_axis = TRUE;
-#endif
-
- exec->GS.round_state = 1;
- exec->GS.loop = 1;
-
- /* some glyphs leave something on the stack. so we clean it */
- /* before a new execution. */
- exec->top = 0;
- exec->callTop = 0;
-
- return exec->face->interpreter( exec );
- }
-
-
- /* The default value for `scan_control' is documented as FALSE in the */
- /* TrueType specification. This is confusing since it implies a */
- /* Boolean value. However, this is not the case, thus both the */
- /* default values of our `scan_type' and `scan_control' fields (which */
- /* the documentation's `scan_control' variable is split into) are */
- /* zero. */
-
- const TT_GraphicsState tt_default_graphics_state =
- {
- 0, 0, 0,
- { 0x4000, 0 },
- { 0x4000, 0 },
- { 0x4000, 0 },
-
-#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
- TRUE,
-#endif
-
- 1, 64, 1,
- TRUE, 68, 0, 0, 9, 3,
- 0, FALSE, 0, 1, 1, 1
- };
-
-
- /* documentation is in ttinterp.h */
-
- FT_EXPORT_DEF( TT_ExecContext )
- TT_New_Context( TT_Driver driver )
- {
- FT_Memory memory;
- FT_Error error;
-
- TT_ExecContext exec = NULL;
-
-
- if ( !driver )
- goto Fail;
-
- memory = driver->root.root.memory;
-
- /* allocate object */
- if ( FT_NEW( exec ) )
- goto Fail;
-
- /* initialize it; in case of error this deallocates `exec' too */
- error = Init_Context( exec, memory );
- if ( error )
- goto Fail;
-
- return exec;
-
- Fail:
- return NULL;
- }
-
-
- /*************************************************************************/
- /* */
- /* Before an opcode is executed, the interpreter verifies that there are */
- /* enough arguments on the stack, with the help of the `Pop_Push_Count' */
- /* table. */
- /* */
- /* For each opcode, the first column gives the number of arguments that */
- /* are popped from the stack; the second one gives the number of those */
- /* that are pushed in result. */
- /* */
- /* Opcodes which have a varying number of parameters in the data stream */
- /* (NPUSHB, NPUSHW) are handled specially; they have a negative value in */
- /* the `opcode_length' table, and the value in `Pop_Push_Count' is set */
- /* to zero. */
- /* */
- /*************************************************************************/
-
-
-#undef PACK
-#define PACK( x, y ) ( ( x << 4 ) | y )
-
-
- static
- const FT_Byte Pop_Push_Count[256] =
- {
- /* opcodes are gathered in groups of 16 */
- /* please keep the spaces as they are */
-
- /* SVTCA y */ PACK( 0, 0 ),
- /* SVTCA x */ PACK( 0, 0 ),
- /* SPvTCA y */ PACK( 0, 0 ),
- /* SPvTCA x */ PACK( 0, 0 ),
- /* SFvTCA y */ PACK( 0, 0 ),
- /* SFvTCA x */ PACK( 0, 0 ),
- /* SPvTL // */ PACK( 2, 0 ),
- /* SPvTL + */ PACK( 2, 0 ),
- /* SFvTL // */ PACK( 2, 0 ),
- /* SFvTL + */ PACK( 2, 0 ),
- /* SPvFS */ PACK( 2, 0 ),
- /* SFvFS */ PACK( 2, 0 ),
- /* GPv */ PACK( 0, 2 ),
- /* GFv */ PACK( 0, 2 ),
- /* SFvTPv */ PACK( 0, 0 ),
- /* ISECT */ PACK( 5, 0 ),
-
- /* SRP0 */ PACK( 1, 0 ),
- /* SRP1 */ PACK( 1, 0 ),
- /* SRP2 */ PACK( 1, 0 ),
- /* SZP0 */ PACK( 1, 0 ),
- /* SZP1 */ PACK( 1, 0 ),
- /* SZP2 */ PACK( 1, 0 ),
- /* SZPS */ PACK( 1, 0 ),
- /* SLOOP */ PACK( 1, 0 ),
- /* RTG */ PACK( 0, 0 ),
- /* RTHG */ PACK( 0, 0 ),
- /* SMD */ PACK( 1, 0 ),
- /* ELSE */ PACK( 0, 0 ),
- /* JMPR */ PACK( 1, 0 ),
- /* SCvTCi */ PACK( 1, 0 ),
- /* SSwCi */ PACK( 1, 0 ),
- /* SSW */ PACK( 1, 0 ),
-
- /* DUP */ PACK( 1, 2 ),
- /* POP */ PACK( 1, 0 ),
- /* CLEAR */ PACK( 0, 0 ),
- /* SWAP */ PACK( 2, 2 ),
- /* DEPTH */ PACK( 0, 1 ),
- /* CINDEX */ PACK( 1, 1 ),
- /* MINDEX */ PACK( 1, 0 ),
- /* AlignPTS */ PACK( 2, 0 ),
- /* INS_$28 */ PACK( 0, 0 ),
- /* UTP */ PACK( 1, 0 ),
- /* LOOPCALL */ PACK( 2, 0 ),
- /* CALL */ PACK( 1, 0 ),
- /* FDEF */ PACK( 1, 0 ),
- /* ENDF */ PACK( 0, 0 ),
- /* MDAP[0] */ PACK( 1, 0 ),
- /* MDAP[1] */ PACK( 1, 0 ),
-
- /* IUP[0] */ PACK( 0, 0 ),
- /* IUP[1] */ PACK( 0, 0 ),
- /* SHP[0] */ PACK( 0, 0 ),
- /* SHP[1] */ PACK( 0, 0 ),
- /* SHC[0] */ PACK( 1, 0 ),
- /* SHC[1] */ PACK( 1, 0 ),
- /* SHZ[0] */ PACK( 1, 0 ),
- /* SHZ[1] */ PACK( 1, 0 ),
- /* SHPIX */ PACK( 1, 0 ),
- /* IP */ PACK( 0, 0 ),
- /* MSIRP[0] */ PACK( 2, 0 ),
- /* MSIRP[1] */ PACK( 2, 0 ),
- /* AlignRP */ PACK( 0, 0 ),
- /* RTDG */ PACK( 0, 0 ),
- /* MIAP[0] */ PACK( 2, 0 ),
- /* MIAP[1] */ PACK( 2, 0 ),
-
- /* NPushB */ PACK( 0, 0 ),
- /* NPushW */ PACK( 0, 0 ),
- /* WS */ PACK( 2, 0 ),
- /* RS */ PACK( 1, 1 ),
- /* WCvtP */ PACK( 2, 0 ),
- /* RCvt */ PACK( 1, 1 ),
- /* GC[0] */ PACK( 1, 1 ),
- /* GC[1] */ PACK( 1, 1 ),
- /* SCFS */ PACK( 2, 0 ),
- /* MD[0] */ PACK( 2, 1 ),
- /* MD[1] */ PACK( 2, 1 ),
- /* MPPEM */ PACK( 0, 1 ),
- /* MPS */ PACK( 0, 1 ),
- /* FlipON */ PACK( 0, 0 ),
- /* FlipOFF */ PACK( 0, 0 ),
- /* DEBUG */ PACK( 1, 0 ),
-
- /* LT */ PACK( 2, 1 ),
- /* LTEQ */ PACK( 2, 1 ),
- /* GT */ PACK( 2, 1 ),
- /* GTEQ */ PACK( 2, 1 ),
- /* EQ */ PACK( 2, 1 ),
- /* NEQ */ PACK( 2, 1 ),
- /* ODD */ PACK( 1, 1 ),
- /* EVEN */ PACK( 1, 1 ),
- /* IF */ PACK( 1, 0 ),
- /* EIF */ PACK( 0, 0 ),
- /* AND */ PACK( 2, 1 ),
- /* OR */ PACK( 2, 1 ),
- /* NOT */ PACK( 1, 1 ),
- /* DeltaP1 */ PACK( 1, 0 ),
- /* SDB */ PACK( 1, 0 ),
- /* SDS */ PACK( 1, 0 ),
-
- /* ADD */ PACK( 2, 1 ),
- /* SUB */ PACK( 2, 1 ),
- /* DIV */ PACK( 2, 1 ),
- /* MUL */ PACK( 2, 1 ),
- /* ABS */ PACK( 1, 1 ),
- /* NEG */ PACK( 1, 1 ),
- /* FLOOR */ PACK( 1, 1 ),
- /* CEILING */ PACK( 1, 1 ),
- /* ROUND[0] */ PACK( 1, 1 ),
- /* ROUND[1] */ PACK( 1, 1 ),
- /* ROUND[2] */ PACK( 1, 1 ),
- /* ROUND[3] */ PACK( 1, 1 ),
- /* NROUND[0] */ PACK( 1, 1 ),
- /* NROUND[1] */ PACK( 1, 1 ),
- /* NROUND[2] */ PACK( 1, 1 ),
- /* NROUND[3] */ PACK( 1, 1 ),
-
- /* WCvtF */ PACK( 2, 0 ),
- /* DeltaP2 */ PACK( 1, 0 ),
- /* DeltaP3 */ PACK( 1, 0 ),
- /* DeltaCn[0] */ PACK( 1, 0 ),
- /* DeltaCn[1] */ PACK( 1, 0 ),
- /* DeltaCn[2] */ PACK( 1, 0 ),
- /* SROUND */ PACK( 1, 0 ),
- /* S45Round */ PACK( 1, 0 ),
- /* JROT */ PACK( 2, 0 ),
- /* JROF */ PACK( 2, 0 ),
- /* ROFF */ PACK( 0, 0 ),
- /* INS_$7B */ PACK( 0, 0 ),
- /* RUTG */ PACK( 0, 0 ),
- /* RDTG */ PACK( 0, 0 ),
- /* SANGW */ PACK( 1, 0 ),
- /* AA */ PACK( 1, 0 ),
-
- /* FlipPT */ PACK( 0, 0 ),
- /* FlipRgON */ PACK( 2, 0 ),
- /* FlipRgOFF */ PACK( 2, 0 ),
- /* INS_$83 */ PACK( 0, 0 ),
- /* INS_$84 */ PACK( 0, 0 ),
- /* ScanCTRL */ PACK( 1, 0 ),
- /* SDPvTL[0] */ PACK( 2, 0 ),
- /* SDPvTL[1] */ PACK( 2, 0 ),
- /* GetINFO */ PACK( 1, 1 ),
- /* IDEF */ PACK( 1, 0 ),
- /* ROLL */ PACK( 3, 3 ),
- /* MAX */ PACK( 2, 1 ),
- /* MIN */ PACK( 2, 1 ),
- /* ScanTYPE */ PACK( 1, 0 ),
- /* InstCTRL */ PACK( 2, 0 ),
- /* INS_$8F */ PACK( 0, 0 ),
-
- /* INS_$90 */ PACK( 0, 0 ),
- /* INS_$91 */ PACK( 0, 0 ),
- /* INS_$92 */ PACK( 0, 0 ),
- /* INS_$93 */ PACK( 0, 0 ),
- /* INS_$94 */ PACK( 0, 0 ),
- /* INS_$95 */ PACK( 0, 0 ),
- /* INS_$96 */ PACK( 0, 0 ),
- /* INS_$97 */ PACK( 0, 0 ),
- /* INS_$98 */ PACK( 0, 0 ),
- /* INS_$99 */ PACK( 0, 0 ),
- /* INS_$9A */ PACK( 0, 0 ),
- /* INS_$9B */ PACK( 0, 0 ),
- /* INS_$9C */ PACK( 0, 0 ),
- /* INS_$9D */ PACK( 0, 0 ),
- /* INS_$9E */ PACK( 0, 0 ),
- /* INS_$9F */ PACK( 0, 0 ),
-
- /* INS_$A0 */ PACK( 0, 0 ),
- /* INS_$A1 */ PACK( 0, 0 ),
- /* INS_$A2 */ PACK( 0, 0 ),
- /* INS_$A3 */ PACK( 0, 0 ),
- /* INS_$A4 */ PACK( 0, 0 ),
- /* INS_$A5 */ PACK( 0, 0 ),
- /* INS_$A6 */ PACK( 0, 0 ),
- /* INS_$A7 */ PACK( 0, 0 ),
- /* INS_$A8 */ PACK( 0, 0 ),
- /* INS_$A9 */ PACK( 0, 0 ),
- /* INS_$AA */ PACK( 0, 0 ),
- /* INS_$AB */ PACK( 0, 0 ),
- /* INS_$AC */ PACK( 0, 0 ),
- /* INS_$AD */ PACK( 0, 0 ),
- /* INS_$AE */ PACK( 0, 0 ),
- /* INS_$AF */ PACK( 0, 0 ),
-
- /* PushB[0] */ PACK( 0, 1 ),
- /* PushB[1] */ PACK( 0, 2 ),
- /* PushB[2] */ PACK( 0, 3 ),
- /* PushB[3] */ PACK( 0, 4 ),
- /* PushB[4] */ PACK( 0, 5 ),
- /* PushB[5] */ PACK( 0, 6 ),
- /* PushB[6] */ PACK( 0, 7 ),
- /* PushB[7] */ PACK( 0, 8 ),
- /* PushW[0] */ PACK( 0, 1 ),
- /* PushW[1] */ PACK( 0, 2 ),
- /* PushW[2] */ PACK( 0, 3 ),
- /* PushW[3] */ PACK( 0, 4 ),
- /* PushW[4] */ PACK( 0, 5 ),
- /* PushW[5] */ PACK( 0, 6 ),
- /* PushW[6] */ PACK( 0, 7 ),
- /* PushW[7] */ PACK( 0, 8 ),
-
- /* MDRP[00] */ PACK( 1, 0 ),
- /* MDRP[01] */ PACK( 1, 0 ),
- /* MDRP[02] */ PACK( 1, 0 ),
- /* MDRP[03] */ PACK( 1, 0 ),
- /* MDRP[04] */ PACK( 1, 0 ),
- /* MDRP[05] */ PACK( 1, 0 ),
- /* MDRP[06] */ PACK( 1, 0 ),
- /* MDRP[07] */ PACK( 1, 0 ),
- /* MDRP[08] */ PACK( 1, 0 ),
- /* MDRP[09] */ PACK( 1, 0 ),
- /* MDRP[10] */ PACK( 1, 0 ),
- /* MDRP[11] */ PACK( 1, 0 ),
- /* MDRP[12] */ PACK( 1, 0 ),
- /* MDRP[13] */ PACK( 1, 0 ),
- /* MDRP[14] */ PACK( 1, 0 ),
- /* MDRP[15] */ PACK( 1, 0 ),
-
- /* MDRP[16] */ PACK( 1, 0 ),
- /* MDRP[17] */ PACK( 1, 0 ),
- /* MDRP[18] */ PACK( 1, 0 ),
- /* MDRP[19] */ PACK( 1, 0 ),
- /* MDRP[20] */ PACK( 1, 0 ),
- /* MDRP[21] */ PACK( 1, 0 ),
- /* MDRP[22] */ PACK( 1, 0 ),
- /* MDRP[23] */ PACK( 1, 0 ),
- /* MDRP[24] */ PACK( 1, 0 ),
- /* MDRP[25] */ PACK( 1, 0 ),
- /* MDRP[26] */ PACK( 1, 0 ),
- /* MDRP[27] */ PACK( 1, 0 ),
- /* MDRP[28] */ PACK( 1, 0 ),
- /* MDRP[29] */ PACK( 1, 0 ),
- /* MDRP[30] */ PACK( 1, 0 ),
- /* MDRP[31] */ PACK( 1, 0 ),
-
- /* MIRP[00] */ PACK( 2, 0 ),
- /* MIRP[01] */ PACK( 2, 0 ),
- /* MIRP[02] */ PACK( 2, 0 ),
- /* MIRP[03] */ PACK( 2, 0 ),
- /* MIRP[04] */ PACK( 2, 0 ),
- /* MIRP[05] */ PACK( 2, 0 ),
- /* MIRP[06] */ PACK( 2, 0 ),
- /* MIRP[07] */ PACK( 2, 0 ),
- /* MIRP[08] */ PACK( 2, 0 ),
- /* MIRP[09] */ PACK( 2, 0 ),
- /* MIRP[10] */ PACK( 2, 0 ),
- /* MIRP[11] */ PACK( 2, 0 ),
- /* MIRP[12] */ PACK( 2, 0 ),
- /* MIRP[13] */ PACK( 2, 0 ),
- /* MIRP[14] */ PACK( 2, 0 ),
- /* MIRP[15] */ PACK( 2, 0 ),
-
- /* MIRP[16] */ PACK( 2, 0 ),
- /* MIRP[17] */ PACK( 2, 0 ),
- /* MIRP[18] */ PACK( 2, 0 ),
- /* MIRP[19] */ PACK( 2, 0 ),
- /* MIRP[20] */ PACK( 2, 0 ),
- /* MIRP[21] */ PACK( 2, 0 ),
- /* MIRP[22] */ PACK( 2, 0 ),
- /* MIRP[23] */ PACK( 2, 0 ),
- /* MIRP[24] */ PACK( 2, 0 ),
- /* MIRP[25] */ PACK( 2, 0 ),
- /* MIRP[26] */ PACK( 2, 0 ),
- /* MIRP[27] */ PACK( 2, 0 ),
- /* MIRP[28] */ PACK( 2, 0 ),
- /* MIRP[29] */ PACK( 2, 0 ),
- /* MIRP[30] */ PACK( 2, 0 ),
- /* MIRP[31] */ PACK( 2, 0 )
- };
-
-
-#ifdef FT_DEBUG_LEVEL_TRACE
-
- /* the first hex digit gives the length of the opcode name; the space */
- /* after the digit is here just to increase readability of the source */
- /* code */
-
- static
- const char* const opcode_name[256] =
- {
- "7 SVTCA y",
- "7 SVTCA x",
- "8 SPvTCA y",
- "8 SPvTCA x",
- "8 SFvTCA y",
- "8 SFvTCA x",
- "8 SPvTL ||",
- "7 SPvTL +",
- "8 SFvTL ||",
- "7 SFvTL +",
- "5 SPvFS",
- "5 SFvFS",
- "3 GPv",
- "3 GFv",
- "6 SFvTPv",
- "5 ISECT",
-
- "4 SRP0",
- "4 SRP1",
- "4 SRP2",
- "4 SZP0",
- "4 SZP1",
- "4 SZP2",
- "4 SZPS",
- "5 SLOOP",
- "3 RTG",
- "4 RTHG",
- "3 SMD",
- "4 ELSE",
- "4 JMPR",
- "6 SCvTCi",
- "5 SSwCi",
- "3 SSW",
-
- "3 DUP",
- "3 POP",
- "5 CLEAR",
- "4 SWAP",
- "5 DEPTH",
- "6 CINDEX",
- "6 MINDEX",
- "8 AlignPTS",
- "7 INS_$28",
- "3 UTP",
- "8 LOOPCALL",
- "4 CALL",
- "4 FDEF",
- "4 ENDF",
- "7 MDAP[0]",
- "7 MDAP[1]",
-
- "6 IUP[0]",
- "6 IUP[1]",
- "6 SHP[0]",
- "6 SHP[1]",
- "6 SHC[0]",
- "6 SHC[1]",
- "6 SHZ[0]",
- "6 SHZ[1]",
- "5 SHPIX",
- "2 IP",
- "8 MSIRP[0]",
- "8 MSIRP[1]",
- "7 AlignRP",
- "4 RTDG",
- "7 MIAP[0]",
- "7 MIAP[1]",
-
- "6 NPushB",
- "6 NPushW",
- "2 WS",
- "2 RS",
- "5 WCvtP",
- "4 RCvt",
- "5 GC[0]",
- "5 GC[1]",
- "4 SCFS",
- "5 MD[0]",
- "5 MD[1]",
- "5 MPPEM",
- "3 MPS",
- "6 FlipON",
- "7 FlipOFF",
- "5 DEBUG",
-
- "2 LT",
- "4 LTEQ",
- "2 GT",
- "4 GTEQ",
- "2 EQ",
- "3 NEQ",
- "3 ODD",
- "4 EVEN",
- "2 IF",
- "3 EIF",
- "3 AND",
- "2 OR",
- "3 NOT",
- "7 DeltaP1",
- "3 SDB",
- "3 SDS",
-
- "3 ADD",
- "3 SUB",
- "3 DIV",
- "3 MUL",
- "3 ABS",
- "3 NEG",
- "5 FLOOR",
- "7 CEILING",
- "8 ROUND[0]",
- "8 ROUND[1]",
- "8 ROUND[2]",
- "8 ROUND[3]",
- "9 NROUND[0]",
- "9 NROUND[1]",
- "9 NROUND[2]",
- "9 NROUND[3]",
-
- "5 WCvtF",
- "7 DeltaP2",
- "7 DeltaP3",
- "A DeltaCn[0]",
- "A DeltaCn[1]",
- "A DeltaCn[2]",
- "6 SROUND",
- "8 S45Round",
- "4 JROT",
- "4 JROF",
- "4 ROFF",
- "7 INS_$7B",
- "4 RUTG",
- "4 RDTG",
- "5 SANGW",
- "2 AA",
-
- "6 FlipPT",
- "8 FlipRgON",
- "9 FlipRgOFF",
- "7 INS_$83",
- "7 INS_$84",
- "8 ScanCTRL",
- "9 SDPvTL[0]",
- "9 SDPvTL[1]",
- "7 GetINFO",
- "4 IDEF",
- "4 ROLL",
- "3 MAX",
- "3 MIN",
- "8 ScanTYPE",
- "8 InstCTRL",
- "7 INS_$8F",
-
- "7 INS_$90",
- "7 INS_$91",
- "7 INS_$92",
- "7 INS_$93",
- "7 INS_$94",
- "7 INS_$95",
- "7 INS_$96",
- "7 INS_$97",
- "7 INS_$98",
- "7 INS_$99",
- "7 INS_$9A",
- "7 INS_$9B",
- "7 INS_$9C",
- "7 INS_$9D",
- "7 INS_$9E",
- "7 INS_$9F",
-
- "7 INS_$A0",
- "7 INS_$A1",
- "7 INS_$A2",
- "7 INS_$A3",
- "7 INS_$A4",
- "7 INS_$A5",
- "7 INS_$A6",
- "7 INS_$A7",
- "7 INS_$A8",
- "7 INS_$A9",
- "7 INS_$AA",
- "7 INS_$AB",
- "7 INS_$AC",
- "7 INS_$AD",
- "7 INS_$AE",
- "7 INS_$AF",
-
- "8 PushB[0]",
- "8 PushB[1]",
- "8 PushB[2]",
- "8 PushB[3]",
- "8 PushB[4]",
- "8 PushB[5]",
- "8 PushB[6]",
- "8 PushB[7]",
- "8 PushW[0]",
- "8 PushW[1]",
- "8 PushW[2]",
- "8 PushW[3]",
- "8 PushW[4]",
- "8 PushW[5]",
- "8 PushW[6]",
- "8 PushW[7]",
-
- "8 MDRP[00]",
- "8 MDRP[01]",
- "8 MDRP[02]",
- "8 MDRP[03]",
- "8 MDRP[04]",
- "8 MDRP[05]",
- "8 MDRP[06]",
- "8 MDRP[07]",
- "8 MDRP[08]",
- "8 MDRP[09]",
- "8 MDRP[10]",
- "8 MDRP[11]",
- "8 MDRP[12]",
- "8 MDRP[13]",
- "8 MDRP[14]",
- "8 MDRP[15]",
-
- "8 MDRP[16]",
- "8 MDRP[17]",
- "8 MDRP[18]",
- "8 MDRP[19]",
- "8 MDRP[20]",
- "8 MDRP[21]",
- "8 MDRP[22]",
- "8 MDRP[23]",
- "8 MDRP[24]",
- "8 MDRP[25]",
- "8 MDRP[26]",
- "8 MDRP[27]",
- "8 MDRP[28]",
- "8 MDRP[29]",
- "8 MDRP[30]",
- "8 MDRP[31]",
-
- "8 MIRP[00]",
- "8 MIRP[01]",
- "8 MIRP[02]",
- "8 MIRP[03]",
- "8 MIRP[04]",
- "8 MIRP[05]",
- "8 MIRP[06]",
- "8 MIRP[07]",
- "8 MIRP[08]",
- "8 MIRP[09]",
- "8 MIRP[10]",
- "8 MIRP[11]",
- "8 MIRP[12]",
- "8 MIRP[13]",
- "8 MIRP[14]",
- "8 MIRP[15]",
-
- "8 MIRP[16]",
- "8 MIRP[17]",
- "8 MIRP[18]",
- "8 MIRP[19]",
- "8 MIRP[20]",
- "8 MIRP[21]",
- "8 MIRP[22]",
- "8 MIRP[23]",
- "8 MIRP[24]",
- "8 MIRP[25]",
- "8 MIRP[26]",
- "8 MIRP[27]",
- "8 MIRP[28]",
- "8 MIRP[29]",
- "8 MIRP[30]",
- "8 MIRP[31]"
- };
-
-#endif /* FT_DEBUG_LEVEL_TRACE */
-
-
- static
- const FT_Char opcode_length[256] =
- {
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-
- -1,-2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 2, 3, 4, 5, 6, 7, 8, 9, 3, 5, 7, 9, 11,13,15,17,
-
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
- };
-
-#undef PACK
-
-
-#ifndef FT_CONFIG_OPTION_NO_ASSEMBLER
-
-#if defined( __arm__ ) && \
- ( defined( __thumb2__ ) || !defined( __thumb__ ) )
-
-#define TT_MulFix14 TT_MulFix14_arm
-
- static FT_Int32
- TT_MulFix14_arm( FT_Int32 a,
- FT_Int b )
- {
- FT_Int32 t, t2;
-
-
-#if defined( __CC_ARM ) || defined( __ARMCC__ )
-
- __asm
- {
- smull t2, t, b, a /* (lo=t2,hi=t) = a*b */
- mov a, t, asr #31 /* a = (hi >> 31) */
- add a, a, #0x2000 /* a += 0x2000 */
- adds t2, t2, a /* t2 += a */
- adc t, t, #0 /* t += carry */
- mov a, t2, lsr #14 /* a = t2 >> 14 */
- orr a, a, t, lsl #18 /* a |= t << 18 */
- }
-
-#elif defined( __GNUC__ )
-
- __asm__ __volatile__ (
- "smull %1, %2, %4, %3\n\t" /* (lo=%1,hi=%2) = a*b */
- "mov %0, %2, asr #31\n\t" /* %0 = (hi >> 31) */
-#if defined( __clang__ ) && defined( __thumb2__ )
- "add.w %0, %0, #0x2000\n\t" /* %0 += 0x2000 */
-#else
- "add %0, %0, #0x2000\n\t" /* %0 += 0x2000 */
-#endif
- "adds %1, %1, %0\n\t" /* %1 += %0 */
- "adc %2, %2, #0\n\t" /* %2 += carry */
- "mov %0, %1, lsr #14\n\t" /* %0 = %1 >> 16 */
- "orr %0, %0, %2, lsl #18\n\t" /* %0 |= %2 << 16 */
- : "=r"(a), "=&r"(t2), "=&r"(t)
- : "r"(a), "r"(b)
- : "cc" );
-
-#endif
-
- return a;
- }
-
-#endif /* __arm__ && ( __thumb2__ || !__thumb__ ) */
-
-#endif /* !FT_CONFIG_OPTION_NO_ASSEMBLER */
-
-
-#if defined( __GNUC__ ) && \
- ( defined( __i386__ ) || defined( __x86_64__ ) )
-
-#define TT_MulFix14 TT_MulFix14_long_long
-
- /* Temporarily disable the warning that C90 doesn't support `long long'. */
-#if ( __GNUC__ * 100 + __GNUC_MINOR__ ) >= 406
-#pragma GCC diagnostic push
-#endif
-#pragma GCC diagnostic ignored "-Wlong-long"
-
- /* This is declared `noinline' because inlining the function results */
- /* in slower code. The `pure' attribute indicates that the result */
- /* only depends on the parameters. */
- static __attribute__(( noinline ))
- __attribute__(( pure )) FT_Int32
- TT_MulFix14_long_long( FT_Int32 a,
- FT_Int b )
- {
-
- long long ret = (long long)a * b;
-
- /* The following line assumes that right shifting of signed values */
- /* will actually preserve the sign bit. The exact behaviour is */
- /* undefined, but this is true on x86 and x86_64. */
- long long tmp = ret >> 63;
-
-
- ret += 0x2000 + tmp;
-
- return (FT_Int32)( ret >> 14 );
- }
-
-#if ( __GNUC__ * 100 + __GNUC_MINOR__ ) >= 406
-#pragma GCC diagnostic pop
-#endif
-
-#endif /* __GNUC__ && ( __i386__ || __x86_64__ ) */
-
-
-#ifndef TT_MulFix14
-
- /* Compute (a*b)/2^14 with maximum accuracy and rounding. */
- /* This is optimized to be faster than calling FT_MulFix() */
- /* for platforms where sizeof(int) == 2. */
- static FT_Int32
- TT_MulFix14( FT_Int32 a,
- FT_Int b )
- {
- FT_Int32 sign;
- FT_UInt32 ah, al, mid, lo, hi;
-
-
- sign = a ^ b;
-
- if ( a < 0 )
- a = -a;
- if ( b < 0 )
- b = -b;
-
- ah = (FT_UInt32)( ( a >> 16 ) & 0xFFFFU );
- al = (FT_UInt32)( a & 0xFFFFU );
-
- lo = al * b;
- mid = ah * b;
- hi = mid >> 16;
- mid = ( mid << 16 ) + ( 1 << 13 ); /* rounding */
- lo += mid;
- if ( lo < mid )
- hi += 1;
-
- mid = ( lo >> 14 ) | ( hi << 18 );
-
- return sign >= 0 ? (FT_Int32)mid : -(FT_Int32)mid;
- }
-
-#endif /* !TT_MulFix14 */
-
-
-#if defined( __GNUC__ ) && \
- ( defined( __i386__ ) || \
- defined( __x86_64__ ) || \
- defined( __arm__ ) )
-
-#define TT_DotFix14 TT_DotFix14_long_long
-
-#if ( __GNUC__ * 100 + __GNUC_MINOR__ ) >= 406
-#pragma GCC diagnostic push
-#endif
-#pragma GCC diagnostic ignored "-Wlong-long"
-
- static __attribute__(( pure )) FT_Int32
- TT_DotFix14_long_long( FT_Int32 ax,
- FT_Int32 ay,
- FT_Int bx,
- FT_Int by )
- {
- /* Temporarily disable the warning that C90 doesn't support */
- /* `long long'. */
-
- long long temp1 = (long long)ax * bx;
- long long temp2 = (long long)ay * by;
-
-
- temp1 += temp2;
- temp2 = temp1 >> 63;
- temp1 += 0x2000 + temp2;
-
- return (FT_Int32)( temp1 >> 14 );
-
- }
-
-#if ( __GNUC__ * 100 + __GNUC_MINOR__ ) >= 406
-#pragma GCC diagnostic pop
-#endif
-
-#endif /* __GNUC__ && (__arm__ || __i386__ || __x86_64__) */
-
-
-#ifndef TT_DotFix14
-
- /* compute (ax*bx+ay*by)/2^14 with maximum accuracy and rounding */
- static FT_Int32
- TT_DotFix14( FT_Int32 ax,
- FT_Int32 ay,
- FT_Int bx,
- FT_Int by )
- {
- FT_Int32 m, s, hi1, hi2, hi;
- FT_UInt32 l, lo1, lo2, lo;
-
-
- /* compute ax*bx as 64-bit value */
- l = (FT_UInt32)( ( ax & 0xFFFFU ) * bx );
- m = ( ax >> 16 ) * bx;
-
- lo1 = l + ( (FT_UInt32)m << 16 );
- hi1 = ( m >> 16 ) + ( (FT_Int32)l >> 31 ) + ( lo1 < l );
-
- /* compute ay*by as 64-bit value */
- l = (FT_UInt32)( ( ay & 0xFFFFU ) * by );
- m = ( ay >> 16 ) * by;
-
- lo2 = l + ( (FT_UInt32)m << 16 );
- hi2 = ( m >> 16 ) + ( (FT_Int32)l >> 31 ) + ( lo2 < l );
-
- /* add them */
- lo = lo1 + lo2;
- hi = hi1 + hi2 + ( lo < lo1 );
-
- /* divide the result by 2^14 with rounding */
- s = hi >> 31;
- l = lo + (FT_UInt32)s;
- hi += s + ( l < lo );
- lo = l;
-
- l = lo + 0x2000U;
- hi += ( l < lo );
-
- return (FT_Int32)( ( (FT_UInt32)hi << 18 ) | ( l >> 14 ) );
- }
-
-#endif /* TT_DotFix14 */
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* Current_Ratio */
- /* */
- /* <Description> */
- /* Returns the current aspect ratio scaling factor depending on the */
- /* projection vector's state and device resolutions. */
- /* */
- /* <Return> */
- /* The aspect ratio in 16.16 format, always <= 1.0 . */
- /* */
- static FT_Long
- Current_Ratio( TT_ExecContext exc )
- {
- if ( !exc->tt_metrics.ratio )
- {
-#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
- if ( exc->face->unpatented_hinting )
- {
- if ( exc->GS.both_x_axis )
- exc->tt_metrics.ratio = exc->tt_metrics.x_ratio;
- else
- exc->tt_metrics.ratio = exc->tt_metrics.y_ratio;
- }
- else
-#endif
- {
- if ( exc->GS.projVector.y == 0 )
- exc->tt_metrics.ratio = exc->tt_metrics.x_ratio;
-
- else if ( exc->GS.projVector.x == 0 )
- exc->tt_metrics.ratio = exc->tt_metrics.y_ratio;
-
- else
- {
- FT_F26Dot6 x, y;
-
-
- x = TT_MulFix14( exc->tt_metrics.x_ratio,
- exc->GS.projVector.x );
- y = TT_MulFix14( exc->tt_metrics.y_ratio,
- exc->GS.projVector.y );
- exc->tt_metrics.ratio = FT_Hypot( x, y );
- }
- }
- }
- return exc->tt_metrics.ratio;
- }
-
-
- FT_CALLBACK_DEF( FT_Long )
- Current_Ppem( TT_ExecContext exc )
- {
- return exc->tt_metrics.ppem;
- }
-
-
- FT_CALLBACK_DEF( FT_Long )
- Current_Ppem_Stretched( TT_ExecContext exc )
- {
- return FT_MulFix( exc->tt_metrics.ppem, Current_Ratio( exc ) );
- }
-
-
- /*************************************************************************/
- /* */
- /* Functions related to the control value table (CVT). */
- /* */
- /*************************************************************************/
-
-
- FT_CALLBACK_DEF( FT_F26Dot6 )
- Read_CVT( TT_ExecContext exc,
- FT_ULong idx )
- {
- return exc->cvt[idx];
- }
-
-
- FT_CALLBACK_DEF( FT_F26Dot6 )
- Read_CVT_Stretched( TT_ExecContext exc,
- FT_ULong idx )
- {
- return FT_MulFix( exc->cvt[idx], Current_Ratio( exc ) );
- }
-
-
- FT_CALLBACK_DEF( void )
- Write_CVT( TT_ExecContext exc,
- FT_ULong idx,
- FT_F26Dot6 value )
- {
- exc->cvt[idx] = value;
- }
-
-
- FT_CALLBACK_DEF( void )
- Write_CVT_Stretched( TT_ExecContext exc,
- FT_ULong idx,
- FT_F26Dot6 value )
- {
- exc->cvt[idx] = FT_DivFix( value, Current_Ratio( exc ) );
- }
-
-
- FT_CALLBACK_DEF( void )
- Move_CVT( TT_ExecContext exc,
- FT_ULong idx,
- FT_F26Dot6 value )
- {
- exc->cvt[idx] += value;
- }
-
-
- FT_CALLBACK_DEF( void )
- Move_CVT_Stretched( TT_ExecContext exc,
- FT_ULong idx,
- FT_F26Dot6 value )
- {
- exc->cvt[idx] += FT_DivFix( value, Current_Ratio( exc ) );
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* GetShortIns */
- /* */
- /* <Description> */
- /* Returns a short integer taken from the instruction stream at */
- /* address IP. */
- /* */
- /* <Return> */
- /* Short read at code[IP]. */
- /* */
- /* <Note> */
- /* This one could become a macro. */
- /* */
- static FT_Short
- GetShortIns( TT_ExecContext exc )
- {
- /* Reading a byte stream so there is no endianess (DaveP) */
- exc->IP += 2;
- return (FT_Short)( ( exc->code[exc->IP - 2] << 8 ) +
- exc->code[exc->IP - 1] );
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* Ins_Goto_CodeRange */
- /* */
- /* <Description> */
- /* Goes to a certain code range in the instruction stream. */
- /* */
- /* <Input> */
- /* aRange :: The index of the code range. */
- /* */
- /* aIP :: The new IP address in the code range. */
- /* */
- /* <Return> */
- /* SUCCESS or FAILURE. */
- /* */
- static FT_Bool
- Ins_Goto_CodeRange( TT_ExecContext exc,
- FT_Int aRange,
- FT_Long aIP )
- {
- TT_CodeRange* range;
-
-
- if ( aRange < 1 || aRange > 3 )
- {
- exc->error = FT_THROW( Bad_Argument );
- return FAILURE;
- }
-
- range = &exc->codeRangeTable[aRange - 1];
-
- if ( range->base == NULL ) /* invalid coderange */
- {
- exc->error = FT_THROW( Invalid_CodeRange );
- return FAILURE;
- }
-
- /* NOTE: Because the last instruction of a program may be a CALL */
- /* which will return to the first byte *after* the code */
- /* range, we test for aIP <= Size, instead of aIP < Size. */
-
- if ( aIP > range->size )
- {
- exc->error = FT_THROW( Code_Overflow );
- return FAILURE;
- }
-
- exc->code = range->base;
- exc->codeSize = range->size;
- exc->IP = aIP;
- exc->curRange = aRange;
-
- return SUCCESS;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* Direct_Move */
- /* */
- /* <Description> */
- /* Moves a point by a given distance along the freedom vector. The */
- /* point will be `touched'. */
- /* */
- /* <Input> */
- /* point :: The index of the point to move. */
- /* */
- /* distance :: The distance to apply. */
- /* */
- /* <InOut> */
- /* zone :: The affected glyph zone. */
- /* */
- static void
- Direct_Move( TT_ExecContext exc,
- TT_GlyphZone zone,
- FT_UShort point,
- FT_F26Dot6 distance )
- {
- FT_F26Dot6 v;
-
-
-#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
- FT_ASSERT( !exc->face->unpatented_hinting );
-#endif
-
- v = exc->GS.freeVector.x;
-
- if ( v != 0 )
- {
-#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
- if ( !SUBPIXEL_HINTING ||
- ( !exc->ignore_x_mode ||
- ( exc->sph_tweak_flags & SPH_TWEAK_ALLOW_X_DMOVE ) ) )
-#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */
- zone->cur[point].x += FT_MulDiv( distance, v, exc->F_dot_P );
-
- zone->tags[point] |= FT_CURVE_TAG_TOUCH_X;
- }
-
- v = exc->GS.freeVector.y;
-
- if ( v != 0 )
- {
- zone->cur[point].y += FT_MulDiv( distance, v, exc->F_dot_P );
-
- zone->tags[point] |= FT_CURVE_TAG_TOUCH_Y;
- }
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* Direct_Move_Orig */
- /* */
- /* <Description> */
- /* Moves the *original* position of a point by a given distance along */
- /* the freedom vector. Obviously, the point will not be `touched'. */
- /* */
- /* <Input> */
- /* point :: The index of the point to move. */
- /* */
- /* distance :: The distance to apply. */
- /* */
- /* <InOut> */
- /* zone :: The affected glyph zone. */
- /* */
- static void
- Direct_Move_Orig( TT_ExecContext exc,
- TT_GlyphZone zone,
- FT_UShort point,
- FT_F26Dot6 distance )
- {
- FT_F26Dot6 v;
-
-
-#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
- FT_ASSERT( !exc->face->unpatented_hinting );
-#endif
-
- v = exc->GS.freeVector.x;
-
- if ( v != 0 )
- zone->org[point].x += FT_MulDiv( distance, v, exc->F_dot_P );
-
- v = exc->GS.freeVector.y;
-
- if ( v != 0 )
- zone->org[point].y += FT_MulDiv( distance, v, exc->F_dot_P );
- }
-
-
- /*************************************************************************/
- /* */
- /* Special versions of Direct_Move() */
- /* */
- /* The following versions are used whenever both vectors are both */
- /* along one of the coordinate unit vectors, i.e. in 90% of the cases. */
- /* */
- /*************************************************************************/
-
-
- static void
- Direct_Move_X( TT_ExecContext exc,
- TT_GlyphZone zone,
- FT_UShort point,
- FT_F26Dot6 distance )
- {
- FT_UNUSED( exc );
-
-#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
- if ( !SUBPIXEL_HINTING ||
- !exc->ignore_x_mode )
-#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */
- zone->cur[point].x += distance;
-
- zone->tags[point] |= FT_CURVE_TAG_TOUCH_X;
- }
-
-
- static void
- Direct_Move_Y( TT_ExecContext exc,
- TT_GlyphZone zone,
- FT_UShort point,
- FT_F26Dot6 distance )
- {
- FT_UNUSED( exc );
-
- zone->cur[point].y += distance;
- zone->tags[point] |= FT_CURVE_TAG_TOUCH_Y;
- }
-
-
- /*************************************************************************/
- /* */
- /* Special versions of Direct_Move_Orig() */
- /* */
- /* The following versions are used whenever both vectors are both */
- /* along one of the coordinate unit vectors, i.e. in 90% of the cases. */
- /* */
- /*************************************************************************/
-
-
- static void
- Direct_Move_Orig_X( TT_ExecContext exc,
- TT_GlyphZone zone,
- FT_UShort point,
- FT_F26Dot6 distance )
- {
- FT_UNUSED( exc );
-
- zone->org[point].x += distance;
- }
-
-
- static void
- Direct_Move_Orig_Y( TT_ExecContext exc,
- TT_GlyphZone zone,
- FT_UShort point,
- FT_F26Dot6 distance )
- {
- FT_UNUSED( exc );
-
- zone->org[point].y += distance;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* Round_None */
- /* */
- /* <Description> */
- /* Does not round, but adds engine compensation. */
- /* */
- /* <Input> */
- /* distance :: The distance (not) to round. */
- /* */
- /* compensation :: The engine compensation. */
- /* */
- /* <Return> */
- /* The compensated distance. */
- /* */
- /* <Note> */
- /* The TrueType specification says very few about the relationship */
- /* between rounding and engine compensation. However, it seems from */
- /* the description of super round that we should add the compensation */
- /* before rounding. */
- /* */
- static FT_F26Dot6
- Round_None( TT_ExecContext exc,
- FT_F26Dot6 distance,
- FT_F26Dot6 compensation )
- {
- FT_F26Dot6 val;
-
- FT_UNUSED( exc );
-
-
- if ( distance >= 0 )
- {
- val = distance + compensation;
- if ( val < 0 )
- val = 0;
- }
- else
- {
- val = distance - compensation;
- if ( val > 0 )
- val = 0;
- }
- return val;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* Round_To_Grid */
- /* */
- /* <Description> */
- /* Rounds value to grid after adding engine compensation. */
- /* */
- /* <Input> */
- /* distance :: The distance to round. */
- /* */
- /* compensation :: The engine compensation. */
- /* */
- /* <Return> */
- /* Rounded distance. */
- /* */
- static FT_F26Dot6
- Round_To_Grid( TT_ExecContext exc,
- FT_F26Dot6 distance,
- FT_F26Dot6 compensation )
- {
- FT_F26Dot6 val;
-
- FT_UNUSED( exc );
-
-
- if ( distance >= 0 )
- {
- val = FT_PIX_ROUND( distance + compensation );
- if ( val < 0 )
- val = 0;
- }
- else
- {
- val = -FT_PIX_ROUND( compensation - distance );
- if ( val > 0 )
- val = 0;
- }
-
- return val;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* Round_To_Half_Grid */
- /* */
- /* <Description> */
- /* Rounds value to half grid after adding engine compensation. */
- /* */
- /* <Input> */
- /* distance :: The distance to round. */
- /* */
- /* compensation :: The engine compensation. */
- /* */
- /* <Return> */
- /* Rounded distance. */
- /* */
- static FT_F26Dot6
- Round_To_Half_Grid( TT_ExecContext exc,
- FT_F26Dot6 distance,
- FT_F26Dot6 compensation )
- {
- FT_F26Dot6 val;
-
- FT_UNUSED( exc );
-
-
- if ( distance >= 0 )
- {
- val = FT_PIX_FLOOR( distance + compensation ) + 32;
- if ( val < 0 )
- val = 32;
- }
- else
- {
- val = -( FT_PIX_FLOOR( compensation - distance ) + 32 );
- if ( val > 0 )
- val = -32;
- }
-
- return val;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* Round_Down_To_Grid */
- /* */
- /* <Description> */
- /* Rounds value down to grid after adding engine compensation. */
- /* */
- /* <Input> */
- /* distance :: The distance to round. */
- /* */
- /* compensation :: The engine compensation. */
- /* */
- /* <Return> */
- /* Rounded distance. */
- /* */
- static FT_F26Dot6
- Round_Down_To_Grid( TT_ExecContext exc,
- FT_F26Dot6 distance,
- FT_F26Dot6 compensation )
- {
- FT_F26Dot6 val;
-
- FT_UNUSED( exc );
-
-
- if ( distance >= 0 )
- {
- val = FT_PIX_FLOOR( distance + compensation );
- if ( val < 0 )
- val = 0;
- }
- else
- {
- val = -FT_PIX_FLOOR( compensation - distance );
- if ( val > 0 )
- val = 0;
- }
-
- return val;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* Round_Up_To_Grid */
- /* */
- /* <Description> */
- /* Rounds value up to grid after adding engine compensation. */
- /* */
- /* <Input> */
- /* distance :: The distance to round. */
- /* */
- /* compensation :: The engine compensation. */
- /* */
- /* <Return> */
- /* Rounded distance. */
- /* */
- static FT_F26Dot6
- Round_Up_To_Grid( TT_ExecContext exc,
- FT_F26Dot6 distance,
- FT_F26Dot6 compensation )
- {
- FT_F26Dot6 val;
-
- FT_UNUSED( exc );
-
-
- if ( distance >= 0 )
- {
- val = FT_PIX_CEIL( distance + compensation );
- if ( val < 0 )
- val = 0;
- }
- else
- {
- val = -FT_PIX_CEIL( compensation - distance );
- if ( val > 0 )
- val = 0;
- }
-
- return val;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* Round_To_Double_Grid */
- /* */
- /* <Description> */
- /* Rounds value to double grid after adding engine compensation. */
- /* */
- /* <Input> */
- /* distance :: The distance to round. */
- /* */
- /* compensation :: The engine compensation. */
- /* */
- /* <Return> */
- /* Rounded distance. */
- /* */
- static FT_F26Dot6
- Round_To_Double_Grid( TT_ExecContext exc,
- FT_F26Dot6 distance,
- FT_F26Dot6 compensation )
- {
- FT_F26Dot6 val;
-
- FT_UNUSED( exc );
-
-
- if ( distance >= 0 )
- {
- val = FT_PAD_ROUND( distance + compensation, 32 );
- if ( val < 0 )
- val = 0;
- }
- else
- {
- val = -FT_PAD_ROUND( compensation - distance, 32 );
- if ( val > 0 )
- val = 0;
- }
-
- return val;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* Round_Super */
- /* */
- /* <Description> */
- /* Super-rounds value to grid after adding engine compensation. */
- /* */
- /* <Input> */
- /* distance :: The distance to round. */
- /* */
- /* compensation :: The engine compensation. */
- /* */
- /* <Return> */
- /* Rounded distance. */
- /* */
- /* <Note> */
- /* The TrueType specification says very few about the relationship */
- /* between rounding and engine compensation. However, it seems from */
- /* the description of super round that we should add the compensation */
- /* before rounding. */
- /* */
- static FT_F26Dot6
- Round_Super( TT_ExecContext exc,
- FT_F26Dot6 distance,
- FT_F26Dot6 compensation )
- {
- FT_F26Dot6 val;
-
-
- if ( distance >= 0 )
- {
- val = ( distance - exc->phase + exc->threshold + compensation ) &
- -exc->period;
- val += exc->phase;
- if ( val < 0 )
- val = exc->phase;
- }
- else
- {
- val = -( ( exc->threshold - exc->phase - distance + compensation ) &
- -exc->period );
- val -= exc->phase;
- if ( val > 0 )
- val = -exc->phase;
- }
-
- return val;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* Round_Super_45 */
- /* */
- /* <Description> */
- /* Super-rounds value to grid after adding engine compensation. */
- /* */
- /* <Input> */
- /* distance :: The distance to round. */
- /* */
- /* compensation :: The engine compensation. */
- /* */
- /* <Return> */
- /* Rounded distance. */
- /* */
- /* <Note> */
- /* There is a separate function for Round_Super_45() as we may need */
- /* greater precision. */
- /* */
- static FT_F26Dot6
- Round_Super_45( TT_ExecContext exc,
- FT_F26Dot6 distance,
- FT_F26Dot6 compensation )
- {
- FT_F26Dot6 val;
-
-
- if ( distance >= 0 )
- {
- val = ( ( distance - exc->phase + exc->threshold + compensation ) /
- exc->period ) * exc->period;
- val += exc->phase;
- if ( val < 0 )
- val = exc->phase;
- }
- else
- {
- val = -( ( ( exc->threshold - exc->phase - distance + compensation ) /
- exc->period ) * exc->period );
- val -= exc->phase;
- if ( val > 0 )
- val = -exc->phase;
- }
-
- return val;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* Compute_Round */
- /* */
- /* <Description> */
- /* Sets the rounding mode. */
- /* */
- /* <Input> */
- /* round_mode :: The rounding mode to be used. */
- /* */
- static void
- Compute_Round( TT_ExecContext exc,
- FT_Byte round_mode )
- {
- switch ( round_mode )
- {
- case TT_Round_Off:
- exc->func_round = (TT_Round_Func)Round_None;
- break;
-
- case TT_Round_To_Grid:
- exc->func_round = (TT_Round_Func)Round_To_Grid;
- break;
-
- case TT_Round_Up_To_Grid:
- exc->func_round = (TT_Round_Func)Round_Up_To_Grid;
- break;
-
- case TT_Round_Down_To_Grid:
- exc->func_round = (TT_Round_Func)Round_Down_To_Grid;
- break;
-
- case TT_Round_To_Half_Grid:
- exc->func_round = (TT_Round_Func)Round_To_Half_Grid;
- break;
-
- case TT_Round_To_Double_Grid:
- exc->func_round = (TT_Round_Func)Round_To_Double_Grid;
- break;
-
- case TT_Round_Super:
- exc->func_round = (TT_Round_Func)Round_Super;
- break;
-
- case TT_Round_Super_45:
- exc->func_round = (TT_Round_Func)Round_Super_45;
- break;
- }
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* SetSuperRound */
- /* */
- /* <Description> */
- /* Sets Super Round parameters. */
- /* */
- /* <Input> */
- /* GridPeriod :: The grid period. */
- /* */
- /* selector :: The SROUND opcode. */
- /* */
- static void
- SetSuperRound( TT_ExecContext exc,
- FT_F2Dot14 GridPeriod,
- FT_Long selector )
- {
- switch ( (FT_Int)( selector & 0xC0 ) )
- {
- case 0:
- exc->period = GridPeriod / 2;
- break;
-
- case 0x40:
- exc->period = GridPeriod;
- break;
-
- case 0x80:
- exc->period = GridPeriod * 2;
- break;
-
- /* This opcode is reserved, but... */
- case 0xC0:
- exc->period = GridPeriod;
- break;
- }
-
- switch ( (FT_Int)( selector & 0x30 ) )
- {
- case 0:
- exc->phase = 0;
- break;
-
- case 0x10:
- exc->phase = exc->period / 4;
- break;
-
- case 0x20:
- exc->phase = exc->period / 2;
- break;
-
- case 0x30:
- exc->phase = exc->period * 3 / 4;
- break;
- }
-
- if ( ( selector & 0x0F ) == 0 )
- exc->threshold = exc->period - 1;
- else
- exc->threshold = ( (FT_Int)( selector & 0x0F ) - 4 ) * exc->period / 8;
-
- /* convert to F26Dot6 format */
- exc->period >>= 8;
- exc->phase >>= 8;
- exc->threshold >>= 8;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* Project */
- /* */
- /* <Description> */
- /* Computes the projection of vector given by (v2-v1) along the */
- /* current projection vector. */
- /* */
- /* <Input> */
- /* v1 :: First input vector. */
- /* v2 :: Second input vector. */
- /* */
- /* <Return> */
- /* The distance in F26dot6 format. */
- /* */
- static FT_F26Dot6
- Project( TT_ExecContext exc,
- FT_Pos dx,
- FT_Pos dy )
- {
-#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
- FT_ASSERT( !exc->face->unpatented_hinting );
-#endif
-
- return TT_DotFix14( dx, dy,
- exc->GS.projVector.x,
- exc->GS.projVector.y );
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* Dual_Project */
- /* */
- /* <Description> */
- /* Computes the projection of the vector given by (v2-v1) along the */
- /* current dual vector. */
- /* */
- /* <Input> */
- /* v1 :: First input vector. */
- /* v2 :: Second input vector. */
- /* */
- /* <Return> */
- /* The distance in F26dot6 format. */
- /* */
- static FT_F26Dot6
- Dual_Project( TT_ExecContext exc,
- FT_Pos dx,
- FT_Pos dy )
- {
- return TT_DotFix14( dx, dy,
- exc->GS.dualVector.x,
- exc->GS.dualVector.y );
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* Project_x */
- /* */
- /* <Description> */
- /* Computes the projection of the vector given by (v2-v1) along the */
- /* horizontal axis. */
- /* */
- /* <Input> */
- /* v1 :: First input vector. */
- /* v2 :: Second input vector. */
- /* */
- /* <Return> */
- /* The distance in F26dot6 format. */
- /* */
- static FT_F26Dot6
- Project_x( TT_ExecContext exc,
- FT_Pos dx,
- FT_Pos dy )
- {
- FT_UNUSED( exc );
- FT_UNUSED( dy );
-
- return dx;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* Project_y */
- /* */
- /* <Description> */
- /* Computes the projection of the vector given by (v2-v1) along the */
- /* vertical axis. */
- /* */
- /* <Input> */
- /* v1 :: First input vector. */
- /* v2 :: Second input vector. */
- /* */
- /* <Return> */
- /* The distance in F26dot6 format. */
- /* */
- static FT_F26Dot6
- Project_y( TT_ExecContext exc,
- FT_Pos dx,
- FT_Pos dy )
- {
- FT_UNUSED( exc );
- FT_UNUSED( dx );
-
- return dy;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* Compute_Funcs */
- /* */
- /* <Description> */
- /* Computes the projection and movement function pointers according */
- /* to the current graphics state. */
- /* */
- static void
- Compute_Funcs( TT_ExecContext exc )
- {
-#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
- if ( exc->face->unpatented_hinting )
- {
- /* If both vectors point rightwards along the x axis, set */
- /* `both-x-axis' true, otherwise set it false. The x values only */
- /* need be tested because the vector has been normalised to a unit */
- /* vector of length 0x4000 = unity. */
- exc->GS.both_x_axis = (FT_Bool)( exc->GS.projVector.x == 0x4000 &&
- exc->GS.freeVector.x == 0x4000 );
-
- /* Throw away projection and freedom vector information */
- /* because the patents don't allow them to be stored. */
- /* The relevant US Patents are 5155805 and 5325479. */
- exc->GS.projVector.x = 0;
- exc->GS.projVector.y = 0;
- exc->GS.freeVector.x = 0;
- exc->GS.freeVector.y = 0;
-
- if ( exc->GS.both_x_axis )
- {
- exc->func_project = Project_x;
- exc->func_move = Direct_Move_X;
- exc->func_move_orig = Direct_Move_Orig_X;
- }
- else
- {
- exc->func_project = Project_y;
- exc->func_move = Direct_Move_Y;
- exc->func_move_orig = Direct_Move_Orig_Y;
- }
-
- if ( exc->GS.dualVector.x == 0x4000 )
- exc->func_dualproj = Project_x;
- else if ( exc->GS.dualVector.y == 0x4000 )
- exc->func_dualproj = Project_y;
- else
- exc->func_dualproj = Dual_Project;
-
- /* Force recalculation of cached aspect ratio */
- exc->tt_metrics.ratio = 0;
-
- return;
- }
-#endif /* TT_CONFIG_OPTION_UNPATENTED_HINTING */
-
- if ( exc->GS.freeVector.x == 0x4000 )
- exc->F_dot_P = exc->GS.projVector.x;
- else if ( exc->GS.freeVector.y == 0x4000 )
- exc->F_dot_P = exc->GS.projVector.y;
- else
- exc->F_dot_P =
- ( (FT_Long)exc->GS.projVector.x * exc->GS.freeVector.x +
- (FT_Long)exc->GS.projVector.y * exc->GS.freeVector.y ) >> 14;
-
- if ( exc->GS.projVector.x == 0x4000 )
- exc->func_project = (TT_Project_Func)Project_x;
- else if ( exc->GS.projVector.y == 0x4000 )
- exc->func_project = (TT_Project_Func)Project_y;
- else
- exc->func_project = (TT_Project_Func)Project;
-
- if ( exc->GS.dualVector.x == 0x4000 )
- exc->func_dualproj = (TT_Project_Func)Project_x;
- else if ( exc->GS.dualVector.y == 0x4000 )
- exc->func_dualproj = (TT_Project_Func)Project_y;
- else
- exc->func_dualproj = (TT_Project_Func)Dual_Project;
-
- exc->func_move = (TT_Move_Func)Direct_Move;
- exc->func_move_orig = (TT_Move_Func)Direct_Move_Orig;
-
- if ( exc->F_dot_P == 0x4000L )
- {
- if ( exc->GS.freeVector.x == 0x4000 )
- {
- exc->func_move = (TT_Move_Func)Direct_Move_X;
- exc->func_move_orig = (TT_Move_Func)Direct_Move_Orig_X;
- }
- else if ( exc->GS.freeVector.y == 0x4000 )
- {
- exc->func_move = (TT_Move_Func)Direct_Move_Y;
- exc->func_move_orig = (TT_Move_Func)Direct_Move_Orig_Y;
- }
- }
-
- /* at small sizes, F_dot_P can become too small, resulting */
- /* in overflows and `spikes' in a number of glyphs like `w'. */
-
- if ( FT_ABS( exc->F_dot_P ) < 0x400L )
- exc->F_dot_P = 0x4000L;
-
- /* Disable cached aspect ratio */
- exc->tt_metrics.ratio = 0;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* Normalize */
- /* */
- /* <Description> */
- /* Norms a vector. */
- /* */
- /* <Input> */
- /* Vx :: The horizontal input vector coordinate. */
- /* Vy :: The vertical input vector coordinate. */
- /* */
- /* <Output> */
- /* R :: The normed unit vector. */
- /* */
- /* <Return> */
- /* Returns FAILURE if a vector parameter is zero. */
- /* */
- /* <Note> */
- /* In case Vx and Vy are both zero, `Normalize' returns SUCCESS, and */
- /* R is undefined. */
- /* */
- static FT_Bool
- Normalize( FT_F26Dot6 Vx,
- FT_F26Dot6 Vy,
- FT_UnitVector* R )
- {
- FT_Vector V;
-
-
- if ( Vx == 0 && Vy == 0 )
- {
- /* XXX: UNDOCUMENTED! It seems that it is possible to try */
- /* to normalize the vector (0,0). Return immediately. */
- return SUCCESS;
- }
-
- V.x = Vx;
- V.y = Vy;
-
- FT_Vector_NormLen( &V );
-
- R->x = (FT_F2Dot14)( V.x / 4 );
- R->y = (FT_F2Dot14)( V.y / 4 );
-
- return SUCCESS;
- }
-
-
- /*************************************************************************/
- /* */
- /* Here we start with the implementation of the various opcodes. */
- /* */
- /*************************************************************************/
-
-
-#define ARRAY_BOUND_ERROR \
- do \
- { \
- exc->error = FT_THROW( Invalid_Reference ); \
- return; \
- } while (0)
-
-
- /*************************************************************************/
- /* */
- /* MPPEM[]: Measure Pixel Per EM */
- /* Opcode range: 0x4B */
- /* Stack: --> Euint16 */
- /* */
- static void
- Ins_MPPEM( TT_ExecContext exc,
- FT_Long* args )
- {
- args[0] = exc->func_cur_ppem( exc );
- }
-
-
- /*************************************************************************/
- /* */
- /* MPS[]: Measure Point Size */
- /* Opcode range: 0x4C */
- /* Stack: --> Euint16 */
- /* */
- static void
- Ins_MPS( TT_ExecContext exc,
- FT_Long* args )
- {
- /* Note: The point size should be irrelevant in a given font program; */
- /* we thus decide to return only the PPEM value. */
-#if 0
- args[0] = exc->metrics.pointSize;
-#else
- args[0] = exc->func_cur_ppem( exc );
-#endif
- }
-
-
- /*************************************************************************/
- /* */
- /* DUP[]: DUPlicate the stack's top element */
- /* Opcode range: 0x20 */
- /* Stack: StkElt --> StkElt StkElt */
- /* */
- static void
- Ins_DUP( FT_Long* args )
- {
- args[1] = args[0];
- }
-
-
- /*************************************************************************/
- /* */
- /* POP[]: POP the stack's top element */
- /* Opcode range: 0x21 */
- /* Stack: StkElt --> */
- /* */
- static void
- Ins_POP( void )
- {
- /* nothing to do */
- }
-
-
- /*************************************************************************/
- /* */
- /* CLEAR[]: CLEAR the entire stack */
- /* Opcode range: 0x22 */
- /* Stack: StkElt... --> */
- /* */
- static void
- Ins_CLEAR( TT_ExecContext exc )
- {
- exc->new_top = 0;
- }
-
-
- /*************************************************************************/
- /* */
- /* SWAP[]: SWAP the stack's top two elements */
- /* Opcode range: 0x23 */
- /* Stack: 2 * StkElt --> 2 * StkElt */
- /* */
- static void
- Ins_SWAP( FT_Long* args )
- {
- FT_Long L;
-
-
- L = args[0];
- args[0] = args[1];
- args[1] = L;
- }
-
-
- /*************************************************************************/
- /* */
- /* DEPTH[]: return the stack DEPTH */
- /* Opcode range: 0x24 */
- /* Stack: --> uint32 */
- /* */
- static void
- Ins_DEPTH( TT_ExecContext exc,
- FT_Long* args )
- {
- args[0] = exc->top;
- }
-
-
- /*************************************************************************/
- /* */
- /* LT[]: Less Than */
- /* Opcode range: 0x50 */
- /* Stack: int32? int32? --> bool */
- /* */
- static void
- Ins_LT( FT_Long* args )
- {
- args[0] = ( args[0] < args[1] );
- }
-
-
- /*************************************************************************/
- /* */
- /* LTEQ[]: Less Than or EQual */
- /* Opcode range: 0x51 */
- /* Stack: int32? int32? --> bool */
- /* */
- static void
- Ins_LTEQ( FT_Long* args )
- {
- args[0] = ( args[0] <= args[1] );
- }
-
-
- /*************************************************************************/
- /* */
- /* GT[]: Greater Than */
- /* Opcode range: 0x52 */
- /* Stack: int32? int32? --> bool */
- /* */
- static void
- Ins_GT( FT_Long* args )
- {
- args[0] = ( args[0] > args[1] );
- }
-
-
- /*************************************************************************/
- /* */
- /* GTEQ[]: Greater Than or EQual */
- /* Opcode range: 0x53 */
- /* Stack: int32? int32? --> bool */
- /* */
- static void
- Ins_GTEQ( FT_Long* args )
- {
- args[0] = ( args[0] >= args[1] );
- }
-
-
- /*************************************************************************/
- /* */
- /* EQ[]: EQual */
- /* Opcode range: 0x54 */
- /* Stack: StkElt StkElt --> bool */
- /* */
- static void
- Ins_EQ( FT_Long* args )
- {
- args[0] = ( args[0] == args[1] );
- }
-
-
- /*************************************************************************/
- /* */
- /* NEQ[]: Not EQual */
- /* Opcode range: 0x55 */
- /* Stack: StkElt StkElt --> bool */
- /* */
- static void
- Ins_NEQ( FT_Long* args )
- {
- args[0] = ( args[0] != args[1] );
- }
-
-
- /*************************************************************************/
- /* */
- /* ODD[]: Is ODD */
- /* Opcode range: 0x56 */
- /* Stack: f26.6 --> bool */
- /* */
- static void
- Ins_ODD( TT_ExecContext exc,
- FT_Long* args )
- {
- args[0] = ( ( exc->func_round( exc, args[0], 0 ) & 127 ) == 64 );
- }
-
-
- /*************************************************************************/
- /* */
- /* EVEN[]: Is EVEN */
- /* Opcode range: 0x57 */
- /* Stack: f26.6 --> bool */
- /* */
- static void
- Ins_EVEN( TT_ExecContext exc,
- FT_Long* args )
- {
- args[0] = ( ( exc->func_round( exc, args[0], 0 ) & 127 ) == 0 );
- }
-
-
- /*************************************************************************/
- /* */
- /* AND[]: logical AND */
- /* Opcode range: 0x5A */
- /* Stack: uint32 uint32 --> uint32 */
- /* */
- static void
- Ins_AND( FT_Long* args )
- {
- args[0] = ( args[0] && args[1] );
- }
-
-
- /*************************************************************************/
- /* */
- /* OR[]: logical OR */
- /* Opcode range: 0x5B */
- /* Stack: uint32 uint32 --> uint32 */
- /* */
- static void
- Ins_OR( FT_Long* args )
- {
- args[0] = ( args[0] || args[1] );
- }
-
-
- /*************************************************************************/
- /* */
- /* NOT[]: logical NOT */
- /* Opcode range: 0x5C */
- /* Stack: StkElt --> uint32 */
- /* */
- static void
- Ins_NOT( FT_Long* args )
- {
- args[0] = !args[0];
- }
-
-
- /*************************************************************************/
- /* */
- /* ADD[]: ADD */
- /* Opcode range: 0x60 */
- /* Stack: f26.6 f26.6 --> f26.6 */
- /* */
- static void
- Ins_ADD( FT_Long* args )
- {
- args[0] += args[1];
- }
-
-
- /*************************************************************************/
- /* */
- /* SUB[]: SUBtract */
- /* Opcode range: 0x61 */
- /* Stack: f26.6 f26.6 --> f26.6 */
- /* */
- static void
- Ins_SUB( FT_Long* args )
- {
- args[0] -= args[1];
- }
-
-
- /*************************************************************************/
- /* */
- /* DIV[]: DIVide */
- /* Opcode range: 0x62 */
- /* Stack: f26.6 f26.6 --> f26.6 */
- /* */
- static void
- Ins_DIV( TT_ExecContext exc,
- FT_Long* args )
- {
- if ( args[1] == 0 )
- exc->error = FT_THROW( Divide_By_Zero );
- else
- args[0] = FT_MulDiv_No_Round( args[0], 64L, args[1] );
- }
-
-
- /*************************************************************************/
- /* */
- /* MUL[]: MULtiply */
- /* Opcode range: 0x63 */
- /* Stack: f26.6 f26.6 --> f26.6 */
- /* */
- static void
- Ins_MUL( FT_Long* args )
- {
- args[0] = FT_MulDiv( args[0], args[1], 64L );
- }
-
-
- /*************************************************************************/
- /* */
- /* ABS[]: ABSolute value */
- /* Opcode range: 0x64 */
- /* Stack: f26.6 --> f26.6 */
- /* */
- static void
- Ins_ABS( FT_Long* args )
- {
- args[0] = FT_ABS( args[0] );
- }
-
-
- /*************************************************************************/
- /* */
- /* NEG[]: NEGate */
- /* Opcode range: 0x65 */
- /* Stack: f26.6 --> f26.6 */
- /* */
- static void
- Ins_NEG( FT_Long* args )
- {
- args[0] = -args[0];
- }
-
-
- /*************************************************************************/
- /* */
- /* FLOOR[]: FLOOR */
- /* Opcode range: 0x66 */
- /* Stack: f26.6 --> f26.6 */
- /* */
- static void
- Ins_FLOOR( FT_Long* args )
- {
- args[0] = FT_PIX_FLOOR( args[0] );
- }
-
-
- /*************************************************************************/
- /* */
- /* CEILING[]: CEILING */
- /* Opcode range: 0x67 */
- /* Stack: f26.6 --> f26.6 */
- /* */
- static void
- Ins_CEILING( FT_Long* args )
- {
- args[0] = FT_PIX_CEIL( args[0] );
- }
-
-
- /*************************************************************************/
- /* */
- /* RS[]: Read Store */
- /* Opcode range: 0x43 */
- /* Stack: uint32 --> uint32 */
- /* */
- static void
- Ins_RS( TT_ExecContext exc,
- FT_Long* args )
- {
-#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
-
- FT_ULong I = (FT_ULong)args[0];
-
-
- if ( BOUNDSL( I, exc->storeSize ) )
- {
- if ( exc->pedantic_hinting )
- ARRAY_BOUND_ERROR;
- else
- args[0] = 0;
- }
- else
- {
- /* subpixel hinting - avoid Typeman Dstroke and */
- /* IStroke and Vacuform rounds */
- if ( SUBPIXEL_HINTING &&
- exc->ignore_x_mode &&
- ( ( I == 24 &&
- ( exc->face->sph_found_func_flags &
- ( SPH_FDEF_SPACING_1 |
- SPH_FDEF_SPACING_2 ) ) ) ||
- ( I == 22 &&
- ( exc->sph_in_func_flags &
- SPH_FDEF_TYPEMAN_STROKES ) ) ||
- ( I == 8 &&
- ( exc->face->sph_found_func_flags &
- SPH_FDEF_VACUFORM_ROUND_1 ) &&
- exc->iup_called ) ) )
- args[0] = 0;
- else
- args[0] = exc->storage[I];
- }
-
-#else /* !TT_CONFIG_OPTION_SUBPIXEL_HINTING */
-
- FT_ULong I = (FT_ULong)args[0];
-
-
- if ( BOUNDSL( I, exc->storeSize ) )
- {
- if ( exc->pedantic_hinting )
- ARRAY_BOUND_ERROR;
- else
- args[0] = 0;
- }
- else
- args[0] = exc->storage[I];
-
-#endif /* !TT_CONFIG_OPTION_SUBPIXEL_HINTING */
- }
-
-
- /*************************************************************************/
- /* */
- /* WS[]: Write Store */
- /* Opcode range: 0x42 */
- /* Stack: uint32 uint32 --> */
- /* */
- static void
- Ins_WS( TT_ExecContext exc,
- FT_Long* args )
- {
- FT_ULong I = (FT_ULong)args[0];
-
-
- if ( BOUNDSL( I, exc->storeSize ) )
- {
- if ( exc->pedantic_hinting )
- ARRAY_BOUND_ERROR;
- }
- else
- exc->storage[I] = args[1];
- }
-
-
- /*************************************************************************/
- /* */
- /* WCVTP[]: Write CVT in Pixel units */
- /* Opcode range: 0x44 */
- /* Stack: f26.6 uint32 --> */
- /* */
- static void
- Ins_WCVTP( TT_ExecContext exc,
- FT_Long* args )
- {
- FT_ULong I = (FT_ULong)args[0];
-
-
- if ( BOUNDSL( I, exc->cvtSize ) )
- {
- if ( exc->pedantic_hinting )
- ARRAY_BOUND_ERROR;
- }
- else
- exc->func_write_cvt( exc, I, args[1] );
- }
-
-
- /*************************************************************************/
- /* */
- /* WCVTF[]: Write CVT in Funits */
- /* Opcode range: 0x70 */
- /* Stack: uint32 uint32 --> */
- /* */
- static void
- Ins_WCVTF( TT_ExecContext exc,
- FT_Long* args )
- {
- FT_ULong I = (FT_ULong)args[0];
-
-
- if ( BOUNDSL( I, exc->cvtSize ) )
- {
- if ( exc->pedantic_hinting )
- ARRAY_BOUND_ERROR;
- }
- else
- exc->cvt[I] = FT_MulFix( args[1], exc->tt_metrics.scale );
- }
-
-
- /*************************************************************************/
- /* */
- /* RCVT[]: Read CVT */
- /* Opcode range: 0x45 */
- /* Stack: uint32 --> f26.6 */
- /* */
- static void
- Ins_RCVT( TT_ExecContext exc,
- FT_Long* args )
- {
- FT_ULong I = (FT_ULong)args[0];
-
-
- if ( BOUNDSL( I, exc->cvtSize ) )
- {
- if ( exc->pedantic_hinting )
- ARRAY_BOUND_ERROR;
- else
- args[0] = 0;
- }
- else
- args[0] = exc->func_read_cvt( exc, I );
- }
-
-
- /*************************************************************************/
- /* */
- /* AA[]: Adjust Angle */
- /* Opcode range: 0x7F */
- /* Stack: uint32 --> */
- /* */
- static void
- Ins_AA( void )
- {
- /* intentionally no longer supported */
- }
-
-
- /*************************************************************************/
- /* */
- /* DEBUG[]: DEBUG. Unsupported. */
- /* Opcode range: 0x4F */
- /* Stack: uint32 --> */
- /* */
- /* Note: The original instruction pops a value from the stack. */
- /* */
- static void
- Ins_DEBUG( TT_ExecContext exc )
- {
- exc->error = FT_THROW( Debug_OpCode );
- }
-
-
- /*************************************************************************/
- /* */
- /* ROUND[ab]: ROUND value */
- /* Opcode range: 0x68-0x6B */
- /* Stack: f26.6 --> f26.6 */
- /* */
- static void
- Ins_ROUND( TT_ExecContext exc,
- FT_Long* args )
- {
- args[0] = exc->func_round(
- exc,
- args[0],
- exc->tt_metrics.compensations[exc->opcode - 0x68] );
- }
-
-
- /*************************************************************************/
- /* */
- /* NROUND[ab]: No ROUNDing of value */
- /* Opcode range: 0x6C-0x6F */
- /* Stack: f26.6 --> f26.6 */
- /* */
- static void
- Ins_NROUND( TT_ExecContext exc,
- FT_Long* args )
- {
- args[0] = Round_None(
- exc,
- args[0],
- exc->tt_metrics.compensations[exc->opcode - 0x6C] );
- }
-
-
- /*************************************************************************/
- /* */
- /* MAX[]: MAXimum */
- /* Opcode range: 0x68 */
- /* Stack: int32? int32? --> int32 */
- /* */
- static void
- Ins_MAX( FT_Long* args )
- {
- if ( args[1] > args[0] )
- args[0] = args[1];
- }
-
-
- /*************************************************************************/
- /* */
- /* MIN[]: MINimum */
- /* Opcode range: 0x69 */
- /* Stack: int32? int32? --> int32 */
- /* */
- static void
- Ins_MIN( FT_Long* args )
- {
- if ( args[1] < args[0] )
- args[0] = args[1];
- }
-
-
- /*************************************************************************/
- /* */
- /* MINDEX[]: Move INDEXed element */
- /* Opcode range: 0x26 */
- /* Stack: int32? --> StkElt */
- /* */
- static void
- Ins_MINDEX( TT_ExecContext exc,
- FT_Long* args )
- {
- FT_Long L, K;
-
-
- L = args[0];
-
- if ( L <= 0 || L > exc->args )
- {
- if ( exc->pedantic_hinting )
- exc->error = FT_THROW( Invalid_Reference );
- }
- else
- {
- K = exc->stack[exc->args - L];
-
- FT_ARRAY_MOVE( &exc->stack[exc->args - L ],
- &exc->stack[exc->args - L + 1],
- ( L - 1 ) );
-
- exc->stack[exc->args - 1] = K;
- }
- }
-
-
- /*************************************************************************/
- /* */
- /* CINDEX[]: Copy INDEXed element */
- /* Opcode range: 0x25 */
- /* Stack: int32 --> StkElt */
- /* */
- static void
- Ins_CINDEX( TT_ExecContext exc,
- FT_Long* args )
- {
- FT_Long L;
-
-
- L = args[0];
-
- if ( L <= 0 || L > exc->args )
- {
- if ( exc->pedantic_hinting )
- exc->error = FT_THROW( Invalid_Reference );
- args[0] = 0;
- }
- else
- args[0] = exc->stack[exc->args - L];
- }
-
-
- /*************************************************************************/
- /* */
- /* ROLL[]: ROLL top three elements */
- /* Opcode range: 0x8A */
- /* Stack: 3 * StkElt --> 3 * StkElt */
- /* */
- static void
- Ins_ROLL( FT_Long* args )
- {
- FT_Long A, B, C;
-
-
- A = args[2];
- B = args[1];
- C = args[0];
-
- args[2] = C;
- args[1] = A;
- args[0] = B;
- }
-
-
- /*************************************************************************/
- /* */
- /* MANAGING THE FLOW OF CONTROL */
- /* */
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* SLOOP[]: Set LOOP variable */
- /* Opcode range: 0x17 */
- /* Stack: int32? --> */
- /* */
- static void
- Ins_SLOOP( TT_ExecContext exc,
- FT_Long* args )
- {
- if ( args[0] < 0 )
- exc->error = FT_THROW( Bad_Argument );
- else
- exc->GS.loop = args[0];
- }
-
-
- static FT_Bool
- SkipCode( TT_ExecContext exc )
- {
- exc->IP += exc->length;
-
- if ( exc->IP < exc->codeSize )
- {
- exc->opcode = exc->code[exc->IP];
-
- exc->length = opcode_length[exc->opcode];
- if ( exc->length < 0 )
- {
- if ( exc->IP + 1 >= exc->codeSize )
- goto Fail_Overflow;
- exc->length = 2 - exc->length * exc->code[exc->IP + 1];
- }
-
- if ( exc->IP + exc->length <= exc->codeSize )
- return SUCCESS;
- }
-
- Fail_Overflow:
- exc->error = FT_THROW( Code_Overflow );
- return FAILURE;
- }
-
-
- /*************************************************************************/
- /* */
- /* IF[]: IF test */
- /* Opcode range: 0x58 */
- /* Stack: StkElt --> */
- /* */
- static void
- Ins_IF( TT_ExecContext exc,
- FT_Long* args )
- {
- FT_Int nIfs;
- FT_Bool Out;
-
-
- if ( args[0] != 0 )
- return;
-
- nIfs = 1;
- Out = 0;
-
- do
- {
- if ( SkipCode( exc ) == FAILURE )
- return;
-
- switch ( exc->opcode )
- {
- case 0x58: /* IF */
- nIfs++;
- break;
-
- case 0x1B: /* ELSE */
- Out = FT_BOOL( nIfs == 1 );
- break;
-
- case 0x59: /* EIF */
- nIfs--;
- Out = FT_BOOL( nIfs == 0 );
- break;
- }
- } while ( Out == 0 );
- }
-
-
- /*************************************************************************/
- /* */
- /* ELSE[]: ELSE */
- /* Opcode range: 0x1B */
- /* Stack: --> */
- /* */
- static void
- Ins_ELSE( TT_ExecContext exc )
- {
- FT_Int nIfs;
-
-
- nIfs = 1;
-
- do
- {
- if ( SkipCode( exc ) == FAILURE )
- return;
-
- switch ( exc->opcode )
- {
- case 0x58: /* IF */
- nIfs++;
- break;
-
- case 0x59: /* EIF */
- nIfs--;
- break;
- }
- } while ( nIfs != 0 );
- }
-
-
- /*************************************************************************/
- /* */
- /* EIF[]: End IF */
- /* Opcode range: 0x59 */
- /* Stack: --> */
- /* */
- static void
- Ins_EIF( void )
- {
- /* nothing to do */
- }
-
-
- /*************************************************************************/
- /* */
- /* JMPR[]: JuMP Relative */
- /* Opcode range: 0x1C */
- /* Stack: int32 --> */
- /* */
- static void
- Ins_JMPR( TT_ExecContext exc,
- FT_Long* args )
- {
- if ( args[0] == 0 && exc->args == 0 )
- exc->error = FT_THROW( Bad_Argument );
- exc->IP += args[0];
- if ( exc->IP < 0 ||
- ( exc->callTop > 0 &&
- exc->IP > exc->callStack[exc->callTop - 1].Def->end ) )
- exc->error = FT_THROW( Bad_Argument );
- exc->step_ins = FALSE;
- }
-
-
- /*************************************************************************/
- /* */
- /* JROT[]: Jump Relative On True */
- /* Opcode range: 0x78 */
- /* Stack: StkElt int32 --> */
- /* */
- static void
- Ins_JROT( TT_ExecContext exc,
- FT_Long* args )
- {
- if ( args[1] != 0 )
- Ins_JMPR( exc, args );
- }
-
-
- /*************************************************************************/
- /* */
- /* JROF[]: Jump Relative On False */
- /* Opcode range: 0x79 */
- /* Stack: StkElt int32 --> */
- /* */
- static void
- Ins_JROF( TT_ExecContext exc,
- FT_Long* args )
- {
- if ( args[1] == 0 )
- Ins_JMPR( exc, args );
- }
-
-
- /*************************************************************************/
- /* */
- /* DEFINING AND USING FUNCTIONS AND INSTRUCTIONS */
- /* */
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* FDEF[]: Function DEFinition */
- /* Opcode range: 0x2C */
- /* Stack: uint32 --> */
- /* */
- static void
- Ins_FDEF( TT_ExecContext exc,
- FT_Long* args )
- {
- FT_ULong n;
- TT_DefRecord* rec;
- TT_DefRecord* limit;
-
-#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
- /* arguments to opcodes are skipped by `SKIP_Code' */
- FT_Byte opcode_pattern[9][12] = {
- /* #0 inline delta function 1 */
- {
- 0x4B, /* PPEM */
- 0x53, /* GTEQ */
- 0x23, /* SWAP */
- 0x4B, /* PPEM */
- 0x51, /* LTEQ */
- 0x5A, /* AND */
- 0x58, /* IF */
- 0x38, /* SHPIX */
- 0x1B, /* ELSE */
- 0x21, /* POP */
- 0x21, /* POP */
- 0x59 /* EIF */
- },
- /* #1 inline delta function 2 */
- {
- 0x4B, /* PPEM */
- 0x54, /* EQ */
- 0x58, /* IF */
- 0x38, /* SHPIX */
- 0x1B, /* ELSE */
- 0x21, /* POP */
- 0x21, /* POP */
- 0x59 /* EIF */
- },
- /* #2 diagonal stroke function */
- {
- 0x20, /* DUP */
- 0x20, /* DUP */
- 0xB0, /* PUSHB_1 */
- /* 1 */
- 0x60, /* ADD */
- 0x46, /* GC_cur */
- 0xB0, /* PUSHB_1 */
- /* 64 */
- 0x23, /* SWAP */
- 0x42 /* WS */
- },
- /* #3 VacuFormRound function */
- {
- 0x45, /* RCVT */
- 0x23, /* SWAP */
- 0x46, /* GC_cur */
- 0x60, /* ADD */
- 0x20, /* DUP */
- 0xB0 /* PUSHB_1 */
- /* 38 */
- },
- /* #4 TTFautohint bytecode (old) */
- {
- 0x20, /* DUP */
- 0x64, /* ABS */
- 0xB0, /* PUSHB_1 */
- /* 32 */
- 0x60, /* ADD */
- 0x66, /* FLOOR */
- 0x23, /* SWAP */
- 0xB0 /* PUSHB_1 */
- },
- /* #5 spacing function 1 */
- {
- 0x01, /* SVTCA_x */
- 0xB0, /* PUSHB_1 */
- /* 24 */
- 0x43, /* RS */
- 0x58 /* IF */
- },
- /* #6 spacing function 2 */
- {
- 0x01, /* SVTCA_x */
- 0x18, /* RTG */
- 0xB0, /* PUSHB_1 */
- /* 24 */
- 0x43, /* RS */
- 0x58 /* IF */
- },
- /* #7 TypeMan Talk DiagEndCtrl function */
- {
- 0x01, /* SVTCA_x */
- 0x20, /* DUP */
- 0xB0, /* PUSHB_1 */
- /* 3 */
- 0x25, /* CINDEX */
- },
- /* #8 TypeMan Talk Align */
- {
- 0x06, /* SPVTL */
- 0x7D, /* RDTG */
- },
- };
- FT_UShort opcode_patterns = 9;
- FT_UShort opcode_pointer[9] = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
- FT_UShort opcode_size[9] = { 12, 8, 8, 6, 7, 4, 5, 4, 2 };
- FT_UShort i;
-#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */
-
-
- /* some font programs are broken enough to redefine functions! */
- /* We will then parse the current table. */
-
- rec = exc->FDefs;
- limit = rec + exc->numFDefs;
- n = (FT_ULong)args[0];
-
- for ( ; rec < limit; rec++ )
- {
- if ( rec->opc == n )
- break;
- }
-
- if ( rec == limit )
- {
- /* check that there is enough room for new functions */
- if ( exc->numFDefs >= exc->maxFDefs )
- {
- exc->error = FT_THROW( Too_Many_Function_Defs );
- return;
- }
- exc->numFDefs++;
- }
-
- /* Although FDEF takes unsigned 32-bit integer, */
- /* func # must be within unsigned 16-bit integer */
- if ( n > 0xFFFFU )
- {
- exc->error = FT_THROW( Too_Many_Function_Defs );
- return;
- }
-
- rec->range = exc->curRange;
- rec->opc = (FT_UInt16)n;
- rec->start = exc->IP + 1;
- rec->active = TRUE;
- rec->inline_delta = FALSE;
- rec->sph_fdef_flags = 0x0000;
-
- if ( n > exc->maxFunc )
- exc->maxFunc = (FT_UInt16)n;
-
-#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
- /* We don't know for sure these are typeman functions, */
- /* however they are only active when RS 22 is called */
- if ( n >= 64 && n <= 66 )
- rec->sph_fdef_flags |= SPH_FDEF_TYPEMAN_STROKES;
-#endif
-
- /* Now skip the whole function definition. */
- /* We don't allow nested IDEFS & FDEFs. */
-
- while ( SkipCode( exc ) == SUCCESS )
- {
-
-#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
-
- if ( SUBPIXEL_HINTING )
- {
- for ( i = 0; i < opcode_patterns; i++ )
- {
- if ( opcode_pointer[i] < opcode_size[i] &&
- exc->opcode == opcode_pattern[i][opcode_pointer[i]] )
- {
- opcode_pointer[i] += 1;
-
- if ( opcode_pointer[i] == opcode_size[i] )
- {
- FT_TRACE6(( "sph: Function %d, opcode ptrn: %d, %s %s\n",
- i, n,
- exc->face->root.family_name,
- exc->face->root.style_name ));
-
- switch ( i )
- {
- case 0:
- rec->sph_fdef_flags |= SPH_FDEF_INLINE_DELTA_1;
- exc->face->sph_found_func_flags |= SPH_FDEF_INLINE_DELTA_1;
- break;
-
- case 1:
- rec->sph_fdef_flags |= SPH_FDEF_INLINE_DELTA_2;
- exc->face->sph_found_func_flags |= SPH_FDEF_INLINE_DELTA_2;
- break;
-
- case 2:
- switch ( n )
- {
- /* needs to be implemented still */
- case 58:
- rec->sph_fdef_flags |= SPH_FDEF_DIAGONAL_STROKE;
- exc->face->sph_found_func_flags |= SPH_FDEF_DIAGONAL_STROKE;
- }
- break;
-
- case 3:
- switch ( n )
- {
- case 0:
- rec->sph_fdef_flags |= SPH_FDEF_VACUFORM_ROUND_1;
- exc->face->sph_found_func_flags |= SPH_FDEF_VACUFORM_ROUND_1;
- }
- break;
-
- case 4:
- /* probably not necessary to detect anymore */
- rec->sph_fdef_flags |= SPH_FDEF_TTFAUTOHINT_1;
- exc->face->sph_found_func_flags |= SPH_FDEF_TTFAUTOHINT_1;
- break;
-
- case 5:
- switch ( n )
- {
- case 0:
- case 1:
- case 2:
- case 4:
- case 7:
- case 8:
- rec->sph_fdef_flags |= SPH_FDEF_SPACING_1;
- exc->face->sph_found_func_flags |= SPH_FDEF_SPACING_1;
- }
- break;
-
- case 6:
- switch ( n )
- {
- case 0:
- case 1:
- case 2:
- case 4:
- case 7:
- case 8:
- rec->sph_fdef_flags |= SPH_FDEF_SPACING_2;
- exc->face->sph_found_func_flags |= SPH_FDEF_SPACING_2;
- }
- break;
-
- case 7:
- rec->sph_fdef_flags |= SPH_FDEF_TYPEMAN_DIAGENDCTRL;
- exc->face->sph_found_func_flags |= SPH_FDEF_TYPEMAN_DIAGENDCTRL;
- break;
-
- case 8:
-#if 0
- rec->sph_fdef_flags |= SPH_FDEF_TYPEMAN_DIAGENDCTRL;
- exc->face->sph_found_func_flags |= SPH_FDEF_TYPEMAN_DIAGENDCTRL;
-#endif
- break;
- }
- opcode_pointer[i] = 0;
- }
- }
-
- else
- opcode_pointer[i] = 0;
- }
-
- /* Set sph_compatibility_mode only when deltas are detected */
- exc->face->sph_compatibility_mode =
- ( ( exc->face->sph_found_func_flags & SPH_FDEF_INLINE_DELTA_1 ) |
- ( exc->face->sph_found_func_flags & SPH_FDEF_INLINE_DELTA_2 ) );
- }
-
-#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */
-
- switch ( exc->opcode )
- {
- case 0x89: /* IDEF */
- case 0x2C: /* FDEF */
- exc->error = FT_THROW( Nested_DEFS );
- return;
-
- case 0x2D: /* ENDF */
- rec->end = exc->IP;
- return;
- }
- }
- }
-
-
- /*************************************************************************/
- /* */
- /* ENDF[]: END Function definition */
- /* Opcode range: 0x2D */
- /* Stack: --> */
- /* */
- static void
- Ins_ENDF( TT_ExecContext exc )
- {
- TT_CallRec* pRec;
-
-
-#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
- exc->sph_in_func_flags = 0x0000;
-#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */
-
- if ( exc->callTop <= 0 ) /* We encountered an ENDF without a call */
- {
- exc->error = FT_THROW( ENDF_In_Exec_Stream );
- return;
- }
-
- exc->callTop--;
-
- pRec = &exc->callStack[exc->callTop];
-
- pRec->Cur_Count--;
-
- exc->step_ins = FALSE;
-
- if ( pRec->Cur_Count > 0 )
- {
- exc->callTop++;
- exc->IP = pRec->Def->start;
- }
- else
- /* Loop through the current function */
- Ins_Goto_CodeRange( exc, pRec->Caller_Range, pRec->Caller_IP );
-
- /* Exit the current call frame. */
-
- /* NOTE: If the last instruction of a program is a */
- /* CALL or LOOPCALL, the return address is */
- /* always out of the code range. This is a */
- /* valid address, and it is why we do not test */
- /* the result of Ins_Goto_CodeRange() here! */
- }
-
-
- /*************************************************************************/
- /* */
- /* CALL[]: CALL function */
- /* Opcode range: 0x2B */
- /* Stack: uint32? --> */
- /* */
- static void
- Ins_CALL( TT_ExecContext exc,
- FT_Long* args )
- {
- FT_ULong F;
- TT_CallRec* pCrec;
- TT_DefRecord* def;
-
-
- /* first of all, check the index */
-
- F = (FT_ULong)args[0];
- if ( BOUNDSL( F, exc->maxFunc + 1 ) )
- goto Fail;
-
- /* Except for some old Apple fonts, all functions in a TrueType */
- /* font are defined in increasing order, starting from 0. This */
- /* means that we normally have */
- /* */
- /* exc->maxFunc+1 == exc->numFDefs */
- /* exc->FDefs[n].opc == n for n in 0..exc->maxFunc */
- /* */
- /* If this isn't true, we need to look up the function table. */
-
- def = exc->FDefs + F;
- if ( exc->maxFunc + 1 != exc->numFDefs || def->opc != F )
- {
- /* look up the FDefs table */
- TT_DefRecord* limit;
-
-
- def = exc->FDefs;
- limit = def + exc->numFDefs;
-
- while ( def < limit && def->opc != F )
- def++;
-
- if ( def == limit )
- goto Fail;
- }
-
- /* check that the function is active */
- if ( !def->active )
- goto Fail;
-
-#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
- if ( SUBPIXEL_HINTING &&
- exc->ignore_x_mode &&
- ( ( exc->iup_called &&
- ( exc->sph_tweak_flags & SPH_TWEAK_NO_CALL_AFTER_IUP ) ) ||
- ( def->sph_fdef_flags & SPH_FDEF_VACUFORM_ROUND_1 ) ) )
- goto Fail;
- else
- exc->sph_in_func_flags = def->sph_fdef_flags;
-#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */
-
- /* check the call stack */
- if ( exc->callTop >= exc->callSize )
- {
- exc->error = FT_THROW( Stack_Overflow );
- return;
- }
-
- pCrec = exc->callStack + exc->callTop;
-
- pCrec->Caller_Range = exc->curRange;
- pCrec->Caller_IP = exc->IP + 1;
- pCrec->Cur_Count = 1;
- pCrec->Def = def;
-
- exc->callTop++;
-
- Ins_Goto_CodeRange( exc, def->range, def->start );
-
- exc->step_ins = FALSE;
-
- return;
-
- Fail:
- exc->error = FT_THROW( Invalid_Reference );
- }
-
-
- /*************************************************************************/
- /* */
- /* LOOPCALL[]: LOOP and CALL function */
- /* Opcode range: 0x2A */
- /* Stack: uint32? Eint16? --> */
- /* */
- static void
- Ins_LOOPCALL( TT_ExecContext exc,
- FT_Long* args )
- {
- FT_ULong F;
- TT_CallRec* pCrec;
- TT_DefRecord* def;
-
-
- /* first of all, check the index */
- F = (FT_ULong)args[1];
- if ( BOUNDSL( F, exc->maxFunc + 1 ) )
- goto Fail;
-
- /* Except for some old Apple fonts, all functions in a TrueType */
- /* font are defined in increasing order, starting from 0. This */
- /* means that we normally have */
- /* */
- /* exc->maxFunc+1 == exc->numFDefs */
- /* exc->FDefs[n].opc == n for n in 0..exc->maxFunc */
- /* */
- /* If this isn't true, we need to look up the function table. */
-
- def = exc->FDefs + F;
- if ( exc->maxFunc + 1 != exc->numFDefs || def->opc != F )
- {
- /* look up the FDefs table */
- TT_DefRecord* limit;
-
-
- def = exc->FDefs;
- limit = def + exc->numFDefs;
-
- while ( def < limit && def->opc != F )
- def++;
-
- if ( def == limit )
- goto Fail;
- }
-
- /* check that the function is active */
- if ( !def->active )
- goto Fail;
-
-#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
- if ( SUBPIXEL_HINTING &&
- exc->ignore_x_mode &&
- ( def->sph_fdef_flags & SPH_FDEF_VACUFORM_ROUND_1 ) )
- goto Fail;
- else
- exc->sph_in_func_flags = def->sph_fdef_flags;
-#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */
-
- /* check stack */
- if ( exc->callTop >= exc->callSize )
- {
- exc->error = FT_THROW( Stack_Overflow );
- return;
- }
-
- if ( args[0] > 0 )
- {
- pCrec = exc->callStack + exc->callTop;
-
- pCrec->Caller_Range = exc->curRange;
- pCrec->Caller_IP = exc->IP + 1;
- pCrec->Cur_Count = (FT_Int)args[0];
- pCrec->Def = def;
-
- exc->callTop++;
-
- Ins_Goto_CodeRange( exc, def->range, def->start );
-
- exc->step_ins = FALSE;
- }
-
- return;
-
- Fail:
- exc->error = FT_THROW( Invalid_Reference );
- }
-
-
- /*************************************************************************/
- /* */
- /* IDEF[]: Instruction DEFinition */
- /* Opcode range: 0x89 */
- /* Stack: Eint8 --> */
- /* */
- static void
- Ins_IDEF( TT_ExecContext exc,
- FT_Long* args )
- {
- TT_DefRecord* def;
- TT_DefRecord* limit;
-
-
- /* First of all, look for the same function in our table */
-
- def = exc->IDefs;
- limit = def + exc->numIDefs;
-
- for ( ; def < limit; def++ )
- if ( def->opc == (FT_ULong)args[0] )
- break;
-
- if ( def == limit )
- {
- /* check that there is enough room for a new instruction */
- if ( exc->numIDefs >= exc->maxIDefs )
- {
- exc->error = FT_THROW( Too_Many_Instruction_Defs );
- return;
- }
- exc->numIDefs++;
- }
-
- /* opcode must be unsigned 8-bit integer */
- if ( 0 > args[0] || args[0] > 0x00FF )
- {
- exc->error = FT_THROW( Too_Many_Instruction_Defs );
- return;
- }
-
- def->opc = (FT_Byte)args[0];
- def->start = exc->IP + 1;
- def->range = exc->curRange;
- def->active = TRUE;
-
- if ( (FT_ULong)args[0] > exc->maxIns )
- exc->maxIns = (FT_Byte)args[0];
-
- /* Now skip the whole function definition. */
- /* We don't allow nested IDEFs & FDEFs. */
-
- while ( SkipCode( exc ) == SUCCESS )
- {
- switch ( exc->opcode )
- {
- case 0x89: /* IDEF */
- case 0x2C: /* FDEF */
- exc->error = FT_THROW( Nested_DEFS );
- return;
- case 0x2D: /* ENDF */
- return;
- }
- }
- }
-
-
- /*************************************************************************/
- /* */
- /* PUSHING DATA ONTO THE INTERPRETER STACK */
- /* */
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* NPUSHB[]: PUSH N Bytes */
- /* Opcode range: 0x40 */
- /* Stack: --> uint32... */
- /* */
- static void
- Ins_NPUSHB( TT_ExecContext exc,
- FT_Long* args )
- {
- FT_UShort L, K;
-
-
- L = (FT_UShort)exc->code[exc->IP + 1];
-
- if ( BOUNDS( L, exc->stackSize + 1 - exc->top ) )
- {
- exc->error = FT_THROW( Stack_Overflow );
- return;
- }
-
- for ( K = 1; K <= L; K++ )
- args[K - 1] = exc->code[exc->IP + K + 1];
-
- exc->new_top += L;
- }
-
-
- /*************************************************************************/
- /* */
- /* NPUSHW[]: PUSH N Words */
- /* Opcode range: 0x41 */
- /* Stack: --> int32... */
- /* */
- static void
- Ins_NPUSHW( TT_ExecContext exc,
- FT_Long* args )
- {
- FT_UShort L, K;
-
-
- L = (FT_UShort)exc->code[exc->IP + 1];
-
- if ( BOUNDS( L, exc->stackSize + 1 - exc->top ) )
- {
- exc->error = FT_THROW( Stack_Overflow );
- return;
- }
-
- exc->IP += 2;
-
- for ( K = 0; K < L; K++ )
- args[K] = GetShortIns( exc );
-
- exc->step_ins = FALSE;
- exc->new_top += L;
- }
-
-
- /*************************************************************************/
- /* */
- /* PUSHB[abc]: PUSH Bytes */
- /* Opcode range: 0xB0-0xB7 */
- /* Stack: --> uint32... */
- /* */
- static void
- Ins_PUSHB( TT_ExecContext exc,
- FT_Long* args )
- {
- FT_UShort L, K;
-
-
- L = (FT_UShort)( exc->opcode - 0xB0 + 1 );
-
- if ( BOUNDS( L, exc->stackSize + 1 - exc->top ) )
- {
- exc->error = FT_THROW( Stack_Overflow );
- return;
- }
-
- for ( K = 1; K <= L; K++ )
- args[K - 1] = exc->code[exc->IP + K];
- }
-
-
- /*************************************************************************/
- /* */
- /* PUSHW[abc]: PUSH Words */
- /* Opcode range: 0xB8-0xBF */
- /* Stack: --> int32... */
- /* */
- static void
- Ins_PUSHW( TT_ExecContext exc,
- FT_Long* args )
- {
- FT_UShort L, K;
-
-
- L = (FT_UShort)( exc->opcode - 0xB8 + 1 );
-
- if ( BOUNDS( L, exc->stackSize + 1 - exc->top ) )
- {
- exc->error = FT_THROW( Stack_Overflow );
- return;
- }
-
- exc->IP++;
-
- for ( K = 0; K < L; K++ )
- args[K] = GetShortIns( exc );
-
- exc->step_ins = FALSE;
- }
-
-
- /*************************************************************************/
- /* */
- /* MANAGING THE GRAPHICS STATE */
- /* */
- /*************************************************************************/
-
-
- static FT_Bool
- Ins_SxVTL( TT_ExecContext exc,
- FT_UShort aIdx1,
- FT_UShort aIdx2,
- FT_UnitVector* Vec )
- {
- FT_Long A, B, C;
- FT_Vector* p1;
- FT_Vector* p2;
-
- FT_Byte opcode = exc->opcode;
-
-
- if ( BOUNDS( aIdx1, exc->zp2.n_points ) ||
- BOUNDS( aIdx2, exc->zp1.n_points ) )
- {
- if ( exc->pedantic_hinting )
- exc->error = FT_THROW( Invalid_Reference );
- return FAILURE;
- }
-
- p1 = exc->zp1.cur + aIdx2;
- p2 = exc->zp2.cur + aIdx1;
-
- A = p1->x - p2->x;
- B = p1->y - p2->y;
-
- /* If p1 == p2, SPvTL and SFvTL behave the same as */
- /* SPvTCA[X] and SFvTCA[X], respectively. */
- /* */
- /* Confirmed by Greg Hitchcock. */
-
- if ( A == 0 && B == 0 )
- {
- A = 0x4000;
- opcode = 0;
- }
-
- if ( ( opcode & 1 ) != 0 )
- {
- C = B; /* counter clockwise rotation */
- B = A;
- A = -C;
- }
-
- Normalize( A, B, Vec );
-
- return SUCCESS;
- }
-
-
- /*************************************************************************/
- /* */
- /* SVTCA[a]: Set (F and P) Vectors to Coordinate Axis */
- /* Opcode range: 0x00-0x01 */
- /* Stack: --> */
- /* */
- /* SPvTCA[a]: Set PVector to Coordinate Axis */
- /* Opcode range: 0x02-0x03 */
- /* Stack: --> */
- /* */
- /* SFvTCA[a]: Set FVector to Coordinate Axis */
- /* Opcode range: 0x04-0x05 */
- /* Stack: --> */
- /* */
- static void
- Ins_SxyTCA( TT_ExecContext exc )
- {
- FT_Short AA, BB;
-
- FT_Byte opcode = exc->opcode;
-
-
- AA = (FT_Short)( ( opcode & 1 ) << 14 );
- BB = (FT_Short)( AA ^ 0x4000 );
-
- if ( opcode < 4 )
- {
- exc->GS.projVector.x = AA;
- exc->GS.projVector.y = BB;
-
- exc->GS.dualVector.x = AA;
- exc->GS.dualVector.y = BB;
- }
- else
- GUESS_VECTOR( projVector );
-
- if ( ( opcode & 2 ) == 0 )
- {
- exc->GS.freeVector.x = AA;
- exc->GS.freeVector.y = BB;
- }
- else
- GUESS_VECTOR( freeVector );
-
- Compute_Funcs( exc );
- }
-
-
- /*************************************************************************/
- /* */
- /* SPvTL[a]: Set PVector To Line */
- /* Opcode range: 0x06-0x07 */
- /* Stack: uint32 uint32 --> */
- /* */
- static void
- Ins_SPVTL( TT_ExecContext exc,
- FT_Long* args )
- {
- if ( Ins_SxVTL( exc,
- (FT_UShort)args[1],
- (FT_UShort)args[0],
- &exc->GS.projVector ) == SUCCESS )
- {
- exc->GS.dualVector = exc->GS.projVector;
- GUESS_VECTOR( freeVector );
- Compute_Funcs( exc );
- }
- }
-
-
- /*************************************************************************/
- /* */
- /* SFvTL[a]: Set FVector To Line */
- /* Opcode range: 0x08-0x09 */
- /* Stack: uint32 uint32 --> */
- /* */
- static void
- Ins_SFVTL( TT_ExecContext exc,
- FT_Long* args )
- {
- if ( Ins_SxVTL( exc,
- (FT_UShort)args[1],
- (FT_UShort)args[0],
- &exc->GS.freeVector ) == SUCCESS )
- {
- GUESS_VECTOR( projVector );
- Compute_Funcs( exc );
- }
- }
-
-
- /*************************************************************************/
- /* */
- /* SFvTPv[]: Set FVector To PVector */
- /* Opcode range: 0x0E */
- /* Stack: --> */
- /* */
- static void
- Ins_SFVTPV( TT_ExecContext exc )
- {
- GUESS_VECTOR( projVector );
- exc->GS.freeVector = exc->GS.projVector;
- Compute_Funcs( exc );
- }
-
-
- /*************************************************************************/
- /* */
- /* SPvFS[]: Set PVector From Stack */
- /* Opcode range: 0x0A */
- /* Stack: f2.14 f2.14 --> */
- /* */
- static void
- Ins_SPVFS( TT_ExecContext exc,
- FT_Long* args )
- {
- FT_Short S;
- FT_Long X, Y;
-
-
- /* Only use low 16bits, then sign extend */
- S = (FT_Short)args[1];
- Y = (FT_Long)S;
- S = (FT_Short)args[0];
- X = (FT_Long)S;
-
- Normalize( X, Y, &exc->GS.projVector );
-
- exc->GS.dualVector = exc->GS.projVector;
- GUESS_VECTOR( freeVector );
- Compute_Funcs( exc );
- }
-
-
- /*************************************************************************/
- /* */
- /* SFvFS[]: Set FVector From Stack */
- /* Opcode range: 0x0B */
- /* Stack: f2.14 f2.14 --> */
- /* */
- static void
- Ins_SFVFS( TT_ExecContext exc,
- FT_Long* args )
- {
- FT_Short S;
- FT_Long X, Y;
-
-
- /* Only use low 16bits, then sign extend */
- S = (FT_Short)args[1];
- Y = (FT_Long)S;
- S = (FT_Short)args[0];
- X = S;
-
- Normalize( X, Y, &exc->GS.freeVector );
- GUESS_VECTOR( projVector );
- Compute_Funcs( exc );
- }
-
-
- /*************************************************************************/
- /* */
- /* GPv[]: Get Projection Vector */
- /* Opcode range: 0x0C */
- /* Stack: ef2.14 --> ef2.14 */
- /* */
- static void
- Ins_GPV( TT_ExecContext exc,
- FT_Long* args )
- {
-#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
- if ( exc->face->unpatented_hinting )
- {
- args[0] = exc->GS.both_x_axis ? 0x4000 : 0;
- args[1] = exc->GS.both_x_axis ? 0 : 0x4000;
- }
- else
- {
- args[0] = exc->GS.projVector.x;
- args[1] = exc->GS.projVector.y;
- }
-#else
- args[0] = exc->GS.projVector.x;
- args[1] = exc->GS.projVector.y;
-#endif
- }
-
-
- /*************************************************************************/
- /* */
- /* GFv[]: Get Freedom Vector */
- /* Opcode range: 0x0D */
- /* Stack: ef2.14 --> ef2.14 */
- /* */
- static void
- Ins_GFV( TT_ExecContext exc,
- FT_Long* args )
- {
-#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
- if ( exc->face->unpatented_hinting )
- {
- args[0] = exc->GS.both_x_axis ? 0x4000 : 0;
- args[1] = exc->GS.both_x_axis ? 0 : 0x4000;
- }
- else
- {
- args[0] = exc->GS.freeVector.x;
- args[1] = exc->GS.freeVector.y;
- }
-#else
- args[0] = exc->GS.freeVector.x;
- args[1] = exc->GS.freeVector.y;
-#endif
- }
-
-
- /*************************************************************************/
- /* */
- /* SRP0[]: Set Reference Point 0 */
- /* Opcode range: 0x10 */
- /* Stack: uint32 --> */
- /* */
- static void
- Ins_SRP0( TT_ExecContext exc,
- FT_Long* args )
- {
- exc->GS.rp0 = (FT_UShort)args[0];
- }
-
-
- /*************************************************************************/
- /* */
- /* SRP1[]: Set Reference Point 1 */
- /* Opcode range: 0x11 */
- /* Stack: uint32 --> */
- /* */
- static void
- Ins_SRP1( TT_ExecContext exc,
- FT_Long* args )
- {
- exc->GS.rp1 = (FT_UShort)args[0];
- }
-
-
- /*************************************************************************/
- /* */
- /* SRP2[]: Set Reference Point 2 */
- /* Opcode range: 0x12 */
- /* Stack: uint32 --> */
- /* */
- static void
- Ins_SRP2( TT_ExecContext exc,
- FT_Long* args )
- {
- exc->GS.rp2 = (FT_UShort)args[0];
- }
-
-
- /*************************************************************************/
- /* */
- /* SMD[]: Set Minimum Distance */
- /* Opcode range: 0x1A */
- /* Stack: f26.6 --> */
- /* */
- static void
- Ins_SMD( TT_ExecContext exc,
- FT_Long* args )
- {
- exc->GS.minimum_distance = args[0];
- }
-
-
- /*************************************************************************/
- /* */
- /* SCVTCI[]: Set Control Value Table Cut In */
- /* Opcode range: 0x1D */
- /* Stack: f26.6 --> */
- /* */
- static void
- Ins_SCVTCI( TT_ExecContext exc,
- FT_Long* args )
- {
- exc->GS.control_value_cutin = (FT_F26Dot6)args[0];
- }
-
-
- /*************************************************************************/
- /* */
- /* SSWCI[]: Set Single Width Cut In */
- /* Opcode range: 0x1E */
- /* Stack: f26.6 --> */
- /* */
- static void
- Ins_SSWCI( TT_ExecContext exc,
- FT_Long* args )
- {
- exc->GS.single_width_cutin = (FT_F26Dot6)args[0];
- }
-
-
- /*************************************************************************/
- /* */
- /* SSW[]: Set Single Width */
- /* Opcode range: 0x1F */
- /* Stack: int32? --> */
- /* */
- static void
- Ins_SSW( TT_ExecContext exc,
- FT_Long* args )
- {
- exc->GS.single_width_value = FT_MulFix( args[0],
- exc->tt_metrics.scale );
- }
-
-
- /*************************************************************************/
- /* */
- /* FLIPON[]: Set auto-FLIP to ON */
- /* Opcode range: 0x4D */
- /* Stack: --> */
- /* */
- static void
- Ins_FLIPON( TT_ExecContext exc )
- {
- exc->GS.auto_flip = TRUE;
- }
-
-
- /*************************************************************************/
- /* */
- /* FLIPOFF[]: Set auto-FLIP to OFF */
- /* Opcode range: 0x4E */
- /* Stack: --> */
- /* */
- static void
- Ins_FLIPOFF( TT_ExecContext exc )
- {
- exc->GS.auto_flip = FALSE;
- }
-
-
- /*************************************************************************/
- /* */
- /* SANGW[]: Set ANGle Weight */
- /* Opcode range: 0x7E */
- /* Stack: uint32 --> */
- /* */
- static void
- Ins_SANGW( void )
- {
- /* instruction not supported anymore */
- }
-
-
- /*************************************************************************/
- /* */
- /* SDB[]: Set Delta Base */
- /* Opcode range: 0x5E */
- /* Stack: uint32 --> */
- /* */
- static void
- Ins_SDB( TT_ExecContext exc,
- FT_Long* args )
- {
- exc->GS.delta_base = (FT_UShort)args[0];
- }
-
-
- /*************************************************************************/
- /* */
- /* SDS[]: Set Delta Shift */
- /* Opcode range: 0x5F */
- /* Stack: uint32 --> */
- /* */
- static void
- Ins_SDS( TT_ExecContext exc,
- FT_Long* args )
- {
- if ( (FT_ULong)args[0] > 6UL )
- exc->error = FT_THROW( Bad_Argument );
- else
- exc->GS.delta_shift = (FT_UShort)args[0];
- }
-
-
- /*************************************************************************/
- /* */
- /* RTHG[]: Round To Half Grid */
- /* Opcode range: 0x19 */
- /* Stack: --> */
- /* */
- static void
- Ins_RTHG( TT_ExecContext exc )
- {
- exc->GS.round_state = TT_Round_To_Half_Grid;
- exc->func_round = (TT_Round_Func)Round_To_Half_Grid;
- }
-
-
- /*************************************************************************/
- /* */
- /* RTG[]: Round To Grid */
- /* Opcode range: 0x18 */
- /* Stack: --> */
- /* */
- static void
- Ins_RTG( TT_ExecContext exc )
- {
- exc->GS.round_state = TT_Round_To_Grid;
- exc->func_round = (TT_Round_Func)Round_To_Grid;
- }
-
-
- /*************************************************************************/
- /* RTDG[]: Round To Double Grid */
- /* Opcode range: 0x3D */
- /* Stack: --> */
- /* */
- static void
- Ins_RTDG( TT_ExecContext exc )
- {
- exc->GS.round_state = TT_Round_To_Double_Grid;
- exc->func_round = (TT_Round_Func)Round_To_Double_Grid;
- }
-
-
- /*************************************************************************/
- /* RUTG[]: Round Up To Grid */
- /* Opcode range: 0x7C */
- /* Stack: --> */
- /* */
- static void
- Ins_RUTG( TT_ExecContext exc )
- {
- exc->GS.round_state = TT_Round_Up_To_Grid;
- exc->func_round = (TT_Round_Func)Round_Up_To_Grid;
- }
-
-
- /*************************************************************************/
- /* */
- /* RDTG[]: Round Down To Grid */
- /* Opcode range: 0x7D */
- /* Stack: --> */
- /* */
- static void
- Ins_RDTG( TT_ExecContext exc )
- {
- exc->GS.round_state = TT_Round_Down_To_Grid;
- exc->func_round = (TT_Round_Func)Round_Down_To_Grid;
- }
-
-
- /*************************************************************************/
- /* */
- /* ROFF[]: Round OFF */
- /* Opcode range: 0x7A */
- /* Stack: --> */
- /* */
- static void
- Ins_ROFF( TT_ExecContext exc )
- {
- exc->GS.round_state = TT_Round_Off;
- exc->func_round = (TT_Round_Func)Round_None;
- }
-
-
- /*************************************************************************/
- /* */
- /* SROUND[]: Super ROUND */
- /* Opcode range: 0x76 */
- /* Stack: Eint8 --> */
- /* */
- static void
- Ins_SROUND( TT_ExecContext exc,
- FT_Long* args )
- {
- SetSuperRound( exc, 0x4000, args[0] );
-
- exc->GS.round_state = TT_Round_Super;
- exc->func_round = (TT_Round_Func)Round_Super;
- }
-
-
- /*************************************************************************/
- /* */
- /* S45ROUND[]: Super ROUND 45 degrees */
- /* Opcode range: 0x77 */
- /* Stack: uint32 --> */
- /* */
- static void
- Ins_S45ROUND( TT_ExecContext exc,
- FT_Long* args )
- {
- SetSuperRound( exc, 0x2D41, args[0] );
-
- exc->GS.round_state = TT_Round_Super_45;
- exc->func_round = (TT_Round_Func)Round_Super_45;
- }
-
-
- /*************************************************************************/
- /* */
- /* GC[a]: Get Coordinate projected onto */
- /* Opcode range: 0x46-0x47 */
- /* Stack: uint32 --> f26.6 */
- /* */
- /* XXX: UNDOCUMENTED: Measures from the original glyph must be taken */
- /* along the dual projection vector! */
- /* */
- static void
- Ins_GC( TT_ExecContext exc,
- FT_Long* args )
- {
- FT_ULong L;
- FT_F26Dot6 R;
-
-
- L = (FT_ULong)args[0];
-
- if ( BOUNDSL( L, exc->zp2.n_points ) )
- {
- if ( exc->pedantic_hinting )
- exc->error = FT_THROW( Invalid_Reference );
- R = 0;
- }
- else
- {
- if ( exc->opcode & 1 )
- R = FAST_DUALPROJ( &exc->zp2.org[L] );
- else
- R = FAST_PROJECT( &exc->zp2.cur[L] );
- }
-
- args[0] = R;
- }
-
-
- /*************************************************************************/
- /* */
- /* SCFS[]: Set Coordinate From Stack */
- /* Opcode range: 0x48 */
- /* Stack: f26.6 uint32 --> */
- /* */
- /* Formula: */
- /* */
- /* OA := OA + ( value - OA.p )/( f.p ) * f */
- /* */
- static void
- Ins_SCFS( TT_ExecContext exc,
- FT_Long* args )
- {
- FT_Long K;
- FT_UShort L;
-
-
- L = (FT_UShort)args[0];
-
- if ( BOUNDS( L, exc->zp2.n_points ) )
- {
- if ( exc->pedantic_hinting )
- exc->error = FT_THROW( Invalid_Reference );
- return;
- }
-
- K = FAST_PROJECT( &exc->zp2.cur[L] );
-
- exc->func_move( exc, &exc->zp2, L, args[1] - K );
-
- /* UNDOCUMENTED! The MS rasterizer does that with */
- /* twilight points (confirmed by Greg Hitchcock) */
- if ( exc->GS.gep2 == 0 )
- exc->zp2.org[L] = exc->zp2.cur[L];
- }
-
-
- /*************************************************************************/
- /* */
- /* MD[a]: Measure Distance */
- /* Opcode range: 0x49-0x4A */
- /* Stack: uint32 uint32 --> f26.6 */
- /* */
- /* XXX: UNDOCUMENTED: Measure taken in the original glyph must be along */
- /* the dual projection vector. */
- /* */
- /* XXX: UNDOCUMENTED: Flag attributes are inverted! */
- /* 0 => measure distance in original outline */
- /* 1 => measure distance in grid-fitted outline */
- /* */
- /* XXX: UNDOCUMENTED: `zp0 - zp1', and not `zp2 - zp1! */
- /* */
- static void
- Ins_MD( TT_ExecContext exc,
- FT_Long* args )
- {
- FT_UShort K, L;
- FT_F26Dot6 D;
-
-
- K = (FT_UShort)args[1];
- L = (FT_UShort)args[0];
-
- if ( BOUNDS( L, exc->zp0.n_points ) ||
- BOUNDS( K, exc->zp1.n_points ) )
- {
- if ( exc->pedantic_hinting )
- exc->error = FT_THROW( Invalid_Reference );
- D = 0;
- }
- else
- {
- if ( exc->opcode & 1 )
- D = PROJECT( exc->zp0.cur + L, exc->zp1.cur + K );
- else
- {
- /* XXX: UNDOCUMENTED: twilight zone special case */
-
- if ( exc->GS.gep0 == 0 || exc->GS.gep1 == 0 )
- {
- FT_Vector* vec1 = exc->zp0.org + L;
- FT_Vector* vec2 = exc->zp1.org + K;
-
-
- D = DUALPROJ( vec1, vec2 );
- }
- else
- {
- FT_Vector* vec1 = exc->zp0.orus + L;
- FT_Vector* vec2 = exc->zp1.orus + K;
-
-
- if ( exc->metrics.x_scale == exc->metrics.y_scale )
- {
- /* this should be faster */
- D = DUALPROJ( vec1, vec2 );
- D = FT_MulFix( D, exc->metrics.x_scale );
- }
- else
- {
- FT_Vector vec;
-
-
- vec.x = FT_MulFix( vec1->x - vec2->x, exc->metrics.x_scale );
- vec.y = FT_MulFix( vec1->y - vec2->y, exc->metrics.y_scale );
-
- D = FAST_DUALPROJ( &vec );
- }
- }
- }
- }
-
-#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
- /* Disable Type 2 Vacuform Rounds - e.g. Arial Narrow */
- if ( SUBPIXEL_HINTING &&
- exc->ignore_x_mode &&
- FT_ABS( D ) == 64 )
- D += 1;
-#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */
-
- args[0] = D;
- }
-
-
- /*************************************************************************/
- /* */
- /* SDPvTL[a]: Set Dual PVector to Line */
- /* Opcode range: 0x86-0x87 */
- /* Stack: uint32 uint32 --> */
- /* */
- static void
- Ins_SDPVTL( TT_ExecContext exc,
- FT_Long* args )
- {
- FT_Long A, B, C;
- FT_UShort p1, p2; /* was FT_Int in pas type ERROR */
-
- FT_Byte opcode = exc->opcode;
-
-
- p1 = (FT_UShort)args[1];
- p2 = (FT_UShort)args[0];
-
- if ( BOUNDS( p2, exc->zp1.n_points ) ||
- BOUNDS( p1, exc->zp2.n_points ) )
- {
- if ( exc->pedantic_hinting )
- exc->error = FT_THROW( Invalid_Reference );
- return;
- }
-
- {
- FT_Vector* v1 = exc->zp1.org + p2;
- FT_Vector* v2 = exc->zp2.org + p1;
-
-
- A = v1->x - v2->x;
- B = v1->y - v2->y;
-
- /* If v1 == v2, SDPvTL behaves the same as */
- /* SVTCA[X], respectively. */
- /* */
- /* Confirmed by Greg Hitchcock. */
-
- if ( A == 0 && B == 0 )
- {
- A = 0x4000;
- opcode = 0;
- }
- }
-
- if ( ( opcode & 1 ) != 0 )
- {
- C = B; /* counter clockwise rotation */
- B = A;
- A = -C;
- }
-
- Normalize( A, B, &exc->GS.dualVector );
-
- {
- FT_Vector* v1 = exc->zp1.cur + p2;
- FT_Vector* v2 = exc->zp2.cur + p1;
-
-
- A = v1->x - v2->x;
- B = v1->y - v2->y;
-
- if ( A == 0 && B == 0 )
- {
- A = 0x4000;
- opcode = 0;
- }
- }
-
- if ( ( opcode & 1 ) != 0 )
- {
- C = B; /* counter clockwise rotation */
- B = A;
- A = -C;
- }
-
- Normalize( A, B, &exc->GS.projVector );
- GUESS_VECTOR( freeVector );
- Compute_Funcs( exc );
- }
-
-
- /*************************************************************************/
- /* */
- /* SZP0[]: Set Zone Pointer 0 */
- /* Opcode range: 0x13 */
- /* Stack: uint32 --> */
- /* */
- static void
- Ins_SZP0( TT_ExecContext exc,
- FT_Long* args )
- {
- switch ( (FT_Int)args[0] )
- {
- case 0:
- exc->zp0 = exc->twilight;
- break;
-
- case 1:
- exc->zp0 = exc->pts;
- break;
-
- default:
- if ( exc->pedantic_hinting )
- exc->error = FT_THROW( Invalid_Reference );
- return;
- }
-
- exc->GS.gep0 = (FT_UShort)args[0];
- }
-
-
- /*************************************************************************/
- /* */
- /* SZP1[]: Set Zone Pointer 1 */
- /* Opcode range: 0x14 */
- /* Stack: uint32 --> */
- /* */
- static void
- Ins_SZP1( TT_ExecContext exc,
- FT_Long* args )
- {
- switch ( (FT_Int)args[0] )
- {
- case 0:
- exc->zp1 = exc->twilight;
- break;
-
- case 1:
- exc->zp1 = exc->pts;
- break;
-
- default:
- if ( exc->pedantic_hinting )
- exc->error = FT_THROW( Invalid_Reference );
- return;
- }
-
- exc->GS.gep1 = (FT_UShort)args[0];
- }
-
-
- /*************************************************************************/
- /* */
- /* SZP2[]: Set Zone Pointer 2 */
- /* Opcode range: 0x15 */
- /* Stack: uint32 --> */
- /* */
- static void
- Ins_SZP2( TT_ExecContext exc,
- FT_Long* args )
- {
- switch ( (FT_Int)args[0] )
- {
- case 0:
- exc->zp2 = exc->twilight;
- break;
-
- case 1:
- exc->zp2 = exc->pts;
- break;
-
- default:
- if ( exc->pedantic_hinting )
- exc->error = FT_THROW( Invalid_Reference );
- return;
- }
-
- exc->GS.gep2 = (FT_UShort)args[0];
- }
-
-
- /*************************************************************************/
- /* */
- /* SZPS[]: Set Zone PointerS */
- /* Opcode range: 0x16 */
- /* Stack: uint32 --> */
- /* */
- static void
- Ins_SZPS( TT_ExecContext exc,
- FT_Long* args )
- {
- switch ( (FT_Int)args[0] )
- {
- case 0:
- exc->zp0 = exc->twilight;
- break;
-
- case 1:
- exc->zp0 = exc->pts;
- break;
-
- default:
- if ( exc->pedantic_hinting )
- exc->error = FT_THROW( Invalid_Reference );
- return;
- }
-
- exc->zp1 = exc->zp0;
- exc->zp2 = exc->zp0;
-
- exc->GS.gep0 = (FT_UShort)args[0];
- exc->GS.gep1 = (FT_UShort)args[0];
- exc->GS.gep2 = (FT_UShort)args[0];
- }
-
-
- /*************************************************************************/
- /* */
- /* INSTCTRL[]: INSTruction ConTRoL */
- /* Opcode range: 0x8E */
- /* Stack: int32 int32 --> */
- /* */
- static void
- Ins_INSTCTRL( TT_ExecContext exc,
- FT_Long* args )
- {
- FT_ULong K, L, Kf;
-
-
- K = (FT_ULong)args[1];
- L = (FT_ULong)args[0];
-
- /* selector values cannot be `OR'ed; */
- /* they are indices starting with index 1, not flags */
- if ( K < 1 || K > 3 )
- {
- if ( exc->pedantic_hinting )
- exc->error = FT_THROW( Invalid_Reference );
- return;
- }
-
- /* convert index to flag value */
- Kf = 1 << ( K - 1 );
-
- if ( L != 0 )
- {
- /* arguments to selectors look like flag values */
- if ( L != Kf )
- {
- if ( exc->pedantic_hinting )
- exc->error = FT_THROW( Invalid_Reference );
- return;
- }
- }
-
- exc->GS.instruct_control &= ~(FT_Byte)Kf;
- exc->GS.instruct_control |= (FT_Byte)L;
-
-#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
- /* INSTCTRL modifying flag 3 also has an effect */
- /* outside of the CVT program */
- if ( K == 3 )
- exc->ignore_x_mode = FT_BOOL( L == 4 );
-#endif
- }
-
-
- /*************************************************************************/
- /* */
- /* SCANCTRL[]: SCAN ConTRoL */
- /* Opcode range: 0x85 */
- /* Stack: uint32? --> */
- /* */
- static void
- Ins_SCANCTRL( TT_ExecContext exc,
- FT_Long* args )
- {
- FT_Int A;
-
-
- /* Get Threshold */
- A = (FT_Int)( args[0] & 0xFF );
-
- if ( A == 0xFF )
- {
- exc->GS.scan_control = TRUE;
- return;
- }
- else if ( A == 0 )
- {
- exc->GS.scan_control = FALSE;
- return;
- }
-
- if ( ( args[0] & 0x100 ) != 0 && exc->tt_metrics.ppem <= A )
- exc->GS.scan_control = TRUE;
-
- if ( ( args[0] & 0x200 ) != 0 && exc->tt_metrics.rotated )
- exc->GS.scan_control = TRUE;
-
- if ( ( args[0] & 0x400 ) != 0 && exc->tt_metrics.stretched )
- exc->GS.scan_control = TRUE;
-
- if ( ( args[0] & 0x800 ) != 0 && exc->tt_metrics.ppem > A )
- exc->GS.scan_control = FALSE;
-
- if ( ( args[0] & 0x1000 ) != 0 && exc->tt_metrics.rotated )
- exc->GS.scan_control = FALSE;
-
- if ( ( args[0] & 0x2000 ) != 0 && exc->tt_metrics.stretched )
- exc->GS.scan_control = FALSE;
- }
-
-
- /*************************************************************************/
- /* */
- /* SCANTYPE[]: SCAN TYPE */
- /* Opcode range: 0x8D */
- /* Stack: uint32? --> */
- /* */
- static void
- Ins_SCANTYPE( TT_ExecContext exc,
- FT_Long* args )
- {
- if ( args[0] >= 0 )
- exc->GS.scan_type = (FT_Int)args[0];
- }
-
-
- /*************************************************************************/
- /* */
- /* MANAGING OUTLINES */
- /* */
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* FLIPPT[]: FLIP PoinT */
- /* Opcode range: 0x80 */
- /* Stack: uint32... --> */
- /* */
- static void
- Ins_FLIPPT( TT_ExecContext exc )
- {
- FT_UShort point;
-
-
- if ( exc->top < exc->GS.loop )
- {
- if ( exc->pedantic_hinting )
- exc->error = FT_THROW( Too_Few_Arguments );
- goto Fail;
- }
-
- while ( exc->GS.loop > 0 )
- {
- exc->args--;
-
- point = (FT_UShort)exc->stack[exc->args];
-
- if ( BOUNDS( point, exc->pts.n_points ) )
- {
- if ( exc->pedantic_hinting )
- {
- exc->error = FT_THROW( Invalid_Reference );
- return;
- }
- }
- else
- exc->pts.tags[point] ^= FT_CURVE_TAG_ON;
-
- exc->GS.loop--;
- }
-
- Fail:
- exc->GS.loop = 1;
- exc->new_top = exc->args;
- }
-
-
- /*************************************************************************/
- /* */
- /* FLIPRGON[]: FLIP RanGe ON */
- /* Opcode range: 0x81 */
- /* Stack: uint32 uint32 --> */
- /* */
- static void
- Ins_FLIPRGON( TT_ExecContext exc,
- FT_Long* args )
- {
- FT_UShort I, K, L;
-
-
- K = (FT_UShort)args[1];
- L = (FT_UShort)args[0];
-
- if ( BOUNDS( K, exc->pts.n_points ) ||
- BOUNDS( L, exc->pts.n_points ) )
- {
- if ( exc->pedantic_hinting )
- exc->error = FT_THROW( Invalid_Reference );
- return;
- }
-
- for ( I = L; I <= K; I++ )
- exc->pts.tags[I] |= FT_CURVE_TAG_ON;
- }
-
-
- /*************************************************************************/
- /* */
- /* FLIPRGOFF: FLIP RanGe OFF */
- /* Opcode range: 0x82 */
- /* Stack: uint32 uint32 --> */
- /* */
- static void
- Ins_FLIPRGOFF( TT_ExecContext exc,
- FT_Long* args )
- {
- FT_UShort I, K, L;
-
-
- K = (FT_UShort)args[1];
- L = (FT_UShort)args[0];
-
- if ( BOUNDS( K, exc->pts.n_points ) ||
- BOUNDS( L, exc->pts.n_points ) )
- {
- if ( exc->pedantic_hinting )
- exc->error = FT_THROW( Invalid_Reference );
- return;
- }
-
- for ( I = L; I <= K; I++ )
- exc->pts.tags[I] &= ~FT_CURVE_TAG_ON;
- }
-
-
- static FT_Bool
- Compute_Point_Displacement( TT_ExecContext exc,
- FT_F26Dot6* x,
- FT_F26Dot6* y,
- TT_GlyphZone zone,
- FT_UShort* refp )
- {
- TT_GlyphZoneRec zp;
- FT_UShort p;
- FT_F26Dot6 d;
-
-
- if ( exc->opcode & 1 )
- {
- zp = exc->zp0;
- p = exc->GS.rp1;
- }
- else
- {
- zp = exc->zp1;
- p = exc->GS.rp2;
- }
-
- if ( BOUNDS( p, zp.n_points ) )
- {
- if ( exc->pedantic_hinting )
- exc->error = FT_THROW( Invalid_Reference );
- *refp = 0;
- return FAILURE;
- }
-
- *zone = zp;
- *refp = p;
-
- d = PROJECT( zp.cur + p, zp.org + p );
-
-#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
- if ( exc->face->unpatented_hinting )
- {
- if ( exc->GS.both_x_axis )
- {
- *x = d;
- *y = 0;
- }
- else
- {
- *x = 0;
- *y = d;
- }
- }
- else
-#endif
- {
- *x = FT_MulDiv( d, (FT_Long)exc->GS.freeVector.x, exc->F_dot_P );
- *y = FT_MulDiv( d, (FT_Long)exc->GS.freeVector.y, exc->F_dot_P );
- }
-
- return SUCCESS;
- }
-
-
- static void
- Move_Zp2_Point( TT_ExecContext exc,
- FT_UShort point,
- FT_F26Dot6 dx,
- FT_F26Dot6 dy,
- FT_Bool touch )
- {
-#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
- if ( exc->face->unpatented_hinting )
- {
- if ( exc->GS.both_x_axis )
- {
- exc->zp2.cur[point].x += dx;
- if ( touch )
- exc->zp2.tags[point] |= FT_CURVE_TAG_TOUCH_X;
- }
- else
- {
- exc->zp2.cur[point].y += dy;
- if ( touch )
- exc->zp2.tags[point] |= FT_CURVE_TAG_TOUCH_Y;
- }
- return;
- }
-#endif
-
- if ( exc->GS.freeVector.x != 0 )
- {
- exc->zp2.cur[point].x += dx;
- if ( touch )
- exc->zp2.tags[point] |= FT_CURVE_TAG_TOUCH_X;
- }
-
- if ( exc->GS.freeVector.y != 0 )
- {
- exc->zp2.cur[point].y += dy;
- if ( touch )
- exc->zp2.tags[point] |= FT_CURVE_TAG_TOUCH_Y;
- }
- }
-
-
- /*************************************************************************/
- /* */
- /* SHP[a]: SHift Point by the last point */
- /* Opcode range: 0x32-0x33 */
- /* Stack: uint32... --> */
- /* */
- static void
- Ins_SHP( TT_ExecContext exc )
- {
- TT_GlyphZoneRec zp;
- FT_UShort refp;
-
- FT_F26Dot6 dx, dy;
- FT_UShort point;
-
-
- if ( exc->top < exc->GS.loop )
- {
- if ( exc->pedantic_hinting )
- exc->error = FT_THROW( Invalid_Reference );
- goto Fail;
- }
-
- if ( Compute_Point_Displacement( exc, &dx, &dy, &zp, &refp ) )
- return;
-
- while ( exc->GS.loop > 0 )
- {
- exc->args--;
- point = (FT_UShort)exc->stack[exc->args];
-
- if ( BOUNDS( point, exc->zp2.n_points ) )
- {
- if ( exc->pedantic_hinting )
- {
- exc->error = FT_THROW( Invalid_Reference );
- return;
- }
- }
- else
-#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
- /* doesn't follow Cleartype spec but produces better result */
- if ( SUBPIXEL_HINTING &&
- exc->ignore_x_mode )
- Move_Zp2_Point( exc, point, 0, dy, TRUE );
- else
-#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */
- Move_Zp2_Point( exc, point, dx, dy, TRUE );
-
- exc->GS.loop--;
- }
-
- Fail:
- exc->GS.loop = 1;
- exc->new_top = exc->args;
- }
-
-
- /*************************************************************************/
- /* */
- /* SHC[a]: SHift Contour */
- /* Opcode range: 0x34-35 */
- /* Stack: uint32 --> */
- /* */
- /* UNDOCUMENTED: According to Greg Hitchcock, there is one (virtual) */
- /* contour in the twilight zone, namely contour number */
- /* zero which includes all points of it. */
- /* */
- static void
- Ins_SHC( TT_ExecContext exc,
- FT_Long* args )
- {
- TT_GlyphZoneRec zp;
- FT_UShort refp;
- FT_F26Dot6 dx, dy;
-
- FT_Short contour, bounds;
- FT_UShort start, limit, i;
-
-
- contour = (FT_Short)args[0];
- bounds = ( exc->GS.gep2 == 0 ) ? 1 : exc->zp2.n_contours;
-
- if ( BOUNDS( contour, bounds ) )
- {
- if ( exc->pedantic_hinting )
- exc->error = FT_THROW( Invalid_Reference );
- return;
- }
-
- if ( Compute_Point_Displacement( exc, &dx, &dy, &zp, &refp ) )
- return;
-
- if ( contour == 0 )
- start = 0;
- else
- start = (FT_UShort)( exc->zp2.contours[contour - 1] + 1 -
- exc->zp2.first_point );
-
- /* we use the number of points if in the twilight zone */
- if ( exc->GS.gep2 == 0 )
- limit = exc->zp2.n_points;
- else
- limit = (FT_UShort)( exc->zp2.contours[contour] -
- exc->zp2.first_point + 1 );
-
- for ( i = start; i < limit; i++ )
- {
- if ( zp.cur != exc->zp2.cur || refp != i )
- Move_Zp2_Point( exc, i, dx, dy, TRUE );
- }
- }
-
-
- /*************************************************************************/
- /* */
- /* SHZ[a]: SHift Zone */
- /* Opcode range: 0x36-37 */
- /* Stack: uint32 --> */
- /* */
- static void
- Ins_SHZ( TT_ExecContext exc,
- FT_Long* args )
- {
- TT_GlyphZoneRec zp;
- FT_UShort refp;
- FT_F26Dot6 dx,
- dy;
-
- FT_UShort limit, i;
-
-
- if ( BOUNDS( args[0], 2 ) )
- {
- if ( exc->pedantic_hinting )
- exc->error = FT_THROW( Invalid_Reference );
- return;
- }
-
- if ( Compute_Point_Displacement( exc, &dx, &dy, &zp, &refp ) )
- return;
-
- /* XXX: UNDOCUMENTED! SHZ doesn't move the phantom points. */
- /* Twilight zone has no real contours, so use `n_points'. */
- /* Normal zone's `n_points' includes phantoms, so must */
- /* use end of last contour. */
- if ( exc->GS.gep2 == 0 )
- limit = (FT_UShort)exc->zp2.n_points;
- else if ( exc->GS.gep2 == 1 && exc->zp2.n_contours > 0 )
- limit = (FT_UShort)( exc->zp2.contours[exc->zp2.n_contours - 1] + 1 );
- else
- limit = 0;
-
- /* XXX: UNDOCUMENTED! SHZ doesn't touch the points */
- for ( i = 0; i < limit; i++ )
- {
- if ( zp.cur != exc->zp2.cur || refp != i )
- Move_Zp2_Point( exc, i, dx, dy, FALSE );
- }
- }
-
-
- /*************************************************************************/
- /* */
- /* SHPIX[]: SHift points by a PIXel amount */
- /* Opcode range: 0x38 */
- /* Stack: f26.6 uint32... --> */
- /* */
- static void
- Ins_SHPIX( TT_ExecContext exc,
- FT_Long* args )
- {
- FT_F26Dot6 dx, dy;
- FT_UShort point;
-#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
- FT_Int B1, B2;
-#endif
-
-
- if ( exc->top < exc->GS.loop + 1 )
- {
- if ( exc->pedantic_hinting )
- exc->error = FT_THROW( Invalid_Reference );
- goto Fail;
- }
-
-#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
- if ( exc->face->unpatented_hinting )
- {
- if ( exc->GS.both_x_axis )
- {
- dx = (FT_UInt32)args[0];
- dy = 0;
- }
- else
- {
- dx = 0;
- dy = (FT_UInt32)args[0];
- }
- }
- else
-#endif
- {
- dx = TT_MulFix14( args[0], exc->GS.freeVector.x );
- dy = TT_MulFix14( args[0], exc->GS.freeVector.y );
- }
-
- while ( exc->GS.loop > 0 )
- {
- exc->args--;
-
- point = (FT_UShort)exc->stack[exc->args];
-
- if ( BOUNDS( point, exc->zp2.n_points ) )
- {
- if ( exc->pedantic_hinting )
- {
- exc->error = FT_THROW( Invalid_Reference );
- return;
- }
- }
- else
-#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
- {
- /* If not using ignore_x_mode rendering, allow ZP2 move. */
- /* If inline deltas aren't allowed, skip ZP2 move. */
- /* If using ignore_x_mode rendering, allow ZP2 point move if: */
- /* - freedom vector is y and sph_compatibility_mode is off */
- /* - the glyph is composite and the move is in the Y direction */
- /* - the glyph is specifically set to allow SHPIX moves */
- /* - the move is on a previously Y-touched point */
-
- if ( SUBPIXEL_HINTING &&
- exc->ignore_x_mode )
- {
- /* save point for later comparison */
- if ( exc->GS.freeVector.y != 0 )
- B1 = exc->zp2.cur[point].y;
- else
- B1 = exc->zp2.cur[point].x;
-
- if ( !exc->face->sph_compatibility_mode &&
- exc->GS.freeVector.y != 0 )
- {
- Move_Zp2_Point( exc, point, dx, dy, TRUE );
-
- /* save new point */
- if ( exc->GS.freeVector.y != 0 )
- {
- B2 = exc->zp2.cur[point].y;
-
- /* reverse any disallowed moves */
- if ( ( exc->sph_tweak_flags & SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES ) &&
- ( B1 & 63 ) != 0 &&
- ( B2 & 63 ) != 0 &&
- B1 != B2 )
- Move_Zp2_Point( exc, point, -dx, -dy, TRUE );
- }
- }
- else if ( exc->face->sph_compatibility_mode )
- {
- if ( exc->sph_tweak_flags & SPH_TWEAK_ROUND_NONPIXEL_Y_MOVES )
- {
- dx = FT_PIX_ROUND( B1 + dx ) - B1;
- dy = FT_PIX_ROUND( B1 + dy ) - B1;
- }
-
- /* skip post-iup deltas */
- if ( exc->iup_called &&
- ( ( exc->sph_in_func_flags & SPH_FDEF_INLINE_DELTA_1 ) ||
- ( exc->sph_in_func_flags & SPH_FDEF_INLINE_DELTA_2 ) ) )
- goto Skip;
-
- if ( !( exc->sph_tweak_flags & SPH_TWEAK_ALWAYS_SKIP_DELTAP ) &&
- ( ( exc->is_composite && exc->GS.freeVector.y != 0 ) ||
- ( exc->zp2.tags[point] & FT_CURVE_TAG_TOUCH_Y ) ||
- ( exc->sph_tweak_flags & SPH_TWEAK_DO_SHPIX ) ) )
- Move_Zp2_Point( exc, point, 0, dy, TRUE );
-
- /* save new point */
- if ( exc->GS.freeVector.y != 0 )
- {
- B2 = exc->zp2.cur[point].y;
-
- /* reverse any disallowed moves */
- if ( ( B1 & 63 ) == 0 &&
- ( B2 & 63 ) != 0 &&
- B1 != B2 )
- Move_Zp2_Point( exc, point, 0, -dy, TRUE );
- }
- }
- else if ( exc->sph_in_func_flags & SPH_FDEF_TYPEMAN_DIAGENDCTRL )
- Move_Zp2_Point( exc, point, dx, dy, TRUE );
- }
- else
- Move_Zp2_Point( exc, point, dx, dy, TRUE );
- }
-
- Skip:
-
-#else /* !TT_CONFIG_OPTION_SUBPIXEL_HINTING */
-
- Move_Zp2_Point( exc, point, dx, dy, TRUE );
-
-#endif /* !TT_CONFIG_OPTION_SUBPIXEL_HINTING */
-
- exc->GS.loop--;
- }
-
- Fail:
- exc->GS.loop = 1;
- exc->new_top = exc->args;
- }
-
-
- /*************************************************************************/
- /* */
- /* MSIRP[a]: Move Stack Indirect Relative Position */
- /* Opcode range: 0x3A-0x3B */
- /* Stack: f26.6 uint32 --> */
- /* */
- static void
- Ins_MSIRP( TT_ExecContext exc,
- FT_Long* args )
- {
- FT_UShort point;
- FT_F26Dot6 distance;
-
-#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
- FT_F26Dot6 control_value_cutin = 0; /* pacify compiler */
-
-
- if ( SUBPIXEL_HINTING )
- {
- control_value_cutin = exc->GS.control_value_cutin;
-
- if ( exc->ignore_x_mode &&
- exc->GS.freeVector.x != 0 &&
- !( exc->sph_tweak_flags & SPH_TWEAK_NORMAL_ROUND ) )
- control_value_cutin = 0;
- }
-
-#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */
-
- point = (FT_UShort)args[0];
-
- if ( BOUNDS( point, exc->zp1.n_points ) ||
- BOUNDS( exc->GS.rp0, exc->zp0.n_points ) )
- {
- if ( exc->pedantic_hinting )
- exc->error = FT_THROW( Invalid_Reference );
- return;
- }
-
- /* UNDOCUMENTED! The MS rasterizer does that with */
- /* twilight points (confirmed by Greg Hitchcock) */
- if ( exc->GS.gep1 == 0 )
- {
- exc->zp1.org[point] = exc->zp0.org[exc->GS.rp0];
- exc->func_move_orig( exc, &exc->zp1, point, args[1] );
- exc->zp1.cur[point] = exc->zp1.org[point];
- }
-
- distance = PROJECT( exc->zp1.cur + point, exc->zp0.cur + exc->GS.rp0 );
-
-#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
- /* subpixel hinting - make MSIRP respect CVT cut-in; */
- if ( SUBPIXEL_HINTING &&
- exc->ignore_x_mode &&
- exc->GS.freeVector.x != 0 &&
- FT_ABS( distance - args[1] ) >= control_value_cutin )
- distance = args[1];
-#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */
-
- exc->func_move( exc, &exc->zp1, point, args[1] - distance );
-
- exc->GS.rp1 = exc->GS.rp0;
- exc->GS.rp2 = point;
-
- if ( ( exc->opcode & 1 ) != 0 )
- exc->GS.rp0 = point;
- }
-
-
- /*************************************************************************/
- /* */
- /* MDAP[a]: Move Direct Absolute Point */
- /* Opcode range: 0x2E-0x2F */
- /* Stack: uint32 --> */
- /* */
- static void
- Ins_MDAP( TT_ExecContext exc,
- FT_Long* args )
- {
- FT_UShort point;
- FT_F26Dot6 cur_dist;
- FT_F26Dot6 distance;
-
-
- point = (FT_UShort)args[0];
-
- if ( BOUNDS( point, exc->zp0.n_points ) )
- {
- if ( exc->pedantic_hinting )
- exc->error = FT_THROW( Invalid_Reference );
- return;
- }
-
- if ( ( exc->opcode & 1 ) != 0 )
- {
- cur_dist = FAST_PROJECT( &exc->zp0.cur[point] );
-#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
- if ( SUBPIXEL_HINTING &&
- exc->ignore_x_mode &&
- exc->GS.freeVector.x != 0 )
- distance = Round_None(
- exc,
- cur_dist,
- exc->tt_metrics.compensations[0] ) - cur_dist;
- else
-#endif
- distance = exc->func_round(
- exc,
- cur_dist,
- exc->tt_metrics.compensations[0] ) - cur_dist;
- }
- else
- distance = 0;
-
- exc->func_move( exc, &exc->zp0, point, distance );
-
- exc->GS.rp0 = point;
- exc->GS.rp1 = point;
- }
-
-
- /*************************************************************************/
- /* */
- /* MIAP[a]: Move Indirect Absolute Point */
- /* Opcode range: 0x3E-0x3F */
- /* Stack: uint32 uint32 --> */
- /* */
- static void
- Ins_MIAP( TT_ExecContext exc,
- FT_Long* args )
- {
- FT_ULong cvtEntry;
- FT_UShort point;
- FT_F26Dot6 distance;
- FT_F26Dot6 org_dist;
- FT_F26Dot6 control_value_cutin;
-
-
- control_value_cutin = exc->GS.control_value_cutin;
- cvtEntry = (FT_ULong)args[1];
- point = (FT_UShort)args[0];
-
-#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
- if ( SUBPIXEL_HINTING &&
- exc->ignore_x_mode &&
- exc->GS.freeVector.x != 0 &&
- exc->GS.freeVector.y == 0 &&
- !( exc->sph_tweak_flags & SPH_TWEAK_NORMAL_ROUND ) )
- control_value_cutin = 0;
-#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */
-
- if ( BOUNDS( point, exc->zp0.n_points ) ||
- BOUNDSL( cvtEntry, exc->cvtSize ) )
- {
- if ( exc->pedantic_hinting )
- exc->error = FT_THROW( Invalid_Reference );
- goto Fail;
- }
-
- /* UNDOCUMENTED! */
- /* */
- /* The behaviour of an MIAP instruction is quite different when used */
- /* in the twilight zone. */
- /* */
- /* First, no control value cut-in test is performed as it would fail */
- /* anyway. Second, the original point, i.e. (org_x,org_y) of */
- /* zp0.point, is set to the absolute, unrounded distance found in the */
- /* CVT. */
- /* */
- /* This is used in the CVT programs of the Microsoft fonts Arial, */
- /* Times, etc., in order to re-adjust some key font heights. It */
- /* allows the use of the IP instruction in the twilight zone, which */
- /* otherwise would be invalid according to the specification. */
- /* */
- /* We implement it with a special sequence for the twilight zone. */
- /* This is a bad hack, but it seems to work. */
- /* */
- /* Confirmed by Greg Hitchcock. */
-
- distance = exc->func_read_cvt( exc, cvtEntry );
-
- if ( exc->GS.gep0 == 0 ) /* If in twilight zone */
- {
-#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
- /* Only adjust if not in sph_compatibility_mode or ignore_x_mode. */
- /* Determined via experimentation and may be incorrect... */
- if ( !SUBPIXEL_HINTING ||
- ( !exc->ignore_x_mode ||
- !exc->face->sph_compatibility_mode ) )
-#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */
- exc->zp0.org[point].x = TT_MulFix14( distance,
- exc->GS.freeVector.x );
- exc->zp0.org[point].y = TT_MulFix14( distance,
- exc->GS.freeVector.y ),
- exc->zp0.cur[point] = exc->zp0.org[point];
- }
-#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
- if ( SUBPIXEL_HINTING &&
- exc->ignore_x_mode &&
- ( exc->sph_tweak_flags & SPH_TWEAK_MIAP_HACK ) &&
- distance > 0 &&
- exc->GS.freeVector.y != 0 )
- distance = 0;
-#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */
-
- org_dist = FAST_PROJECT( &exc->zp0.cur[point] );
-
- if ( ( exc->opcode & 1 ) != 0 ) /* rounding and control cut-in flag */
- {
- if ( FT_ABS( distance - org_dist ) > control_value_cutin )
- distance = org_dist;
-
-#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
- if ( SUBPIXEL_HINTING &&
- exc->ignore_x_mode &&
- exc->GS.freeVector.x != 0 )
- distance = Round_None( exc,
- distance,
- exc->tt_metrics.compensations[0] );
- else
-#endif
- distance = exc->func_round( exc,
- distance,
- exc->tt_metrics.compensations[0] );
- }
-
- exc->func_move( exc, &exc->zp0, point, distance - org_dist );
-
- Fail:
- exc->GS.rp0 = point;
- exc->GS.rp1 = point;
- }
-
-
- /*************************************************************************/
- /* */
- /* MDRP[abcde]: Move Direct Relative Point */
- /* Opcode range: 0xC0-0xDF */
- /* Stack: uint32 --> */
- /* */
- static void
- Ins_MDRP( TT_ExecContext exc,
- FT_Long* args )
- {
- FT_UShort point;
- FT_F26Dot6 org_dist, distance, minimum_distance;
-
-
- minimum_distance = exc->GS.minimum_distance;
-
-#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
- if ( SUBPIXEL_HINTING &&
- exc->ignore_x_mode &&
- exc->GS.freeVector.x != 0 &&
- !( exc->sph_tweak_flags & SPH_TWEAK_NORMAL_ROUND ) )
- minimum_distance = 0;
-#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */
-
- point = (FT_UShort)args[0];
-
- if ( BOUNDS( point, exc->zp1.n_points ) ||
- BOUNDS( exc->GS.rp0, exc->zp0.n_points ) )
- {
- if ( exc->pedantic_hinting )
- exc->error = FT_THROW( Invalid_Reference );
- goto Fail;
- }
-
- /* XXX: Is there some undocumented feature while in the */
- /* twilight zone? */
-
- /* XXX: UNDOCUMENTED: twilight zone special case */
-
- if ( exc->GS.gep0 == 0 || exc->GS.gep1 == 0 )
- {
- FT_Vector* vec1 = &exc->zp1.org[point];
- FT_Vector* vec2 = &exc->zp0.org[exc->GS.rp0];
-
-
- org_dist = DUALPROJ( vec1, vec2 );
- }
- else
- {
- FT_Vector* vec1 = &exc->zp1.orus[point];
- FT_Vector* vec2 = &exc->zp0.orus[exc->GS.rp0];
-
-
- if ( exc->metrics.x_scale == exc->metrics.y_scale )
- {
- /* this should be faster */
- org_dist = DUALPROJ( vec1, vec2 );
- org_dist = FT_MulFix( org_dist, exc->metrics.x_scale );
- }
- else
- {
- FT_Vector vec;
-
-
- vec.x = FT_MulFix( vec1->x - vec2->x, exc->metrics.x_scale );
- vec.y = FT_MulFix( vec1->y - vec2->y, exc->metrics.y_scale );
-
- org_dist = FAST_DUALPROJ( &vec );
- }
- }
-
- /* single width cut-in test */
-
- if ( FT_ABS( org_dist - exc->GS.single_width_value ) <
- exc->GS.single_width_cutin )
- {
- if ( org_dist >= 0 )
- org_dist = exc->GS.single_width_value;
- else
- org_dist = -exc->GS.single_width_value;
- }
-
- /* round flag */
-
- if ( ( exc->opcode & 4 ) != 0 )
- {
-#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
- if ( SUBPIXEL_HINTING &&
- exc->ignore_x_mode &&
- exc->GS.freeVector.x != 0 )
- distance = Round_None(
- exc,
- org_dist,
- exc->tt_metrics.compensations[exc->opcode & 3] );
- else
-#endif
- distance = exc->func_round(
- exc,
- org_dist,
- exc->tt_metrics.compensations[exc->opcode & 3] );
- }
- else
- distance = Round_None(
- exc,
- org_dist,
- exc->tt_metrics.compensations[exc->opcode & 3] );
-
- /* minimum distance flag */
-
- if ( ( exc->opcode & 8 ) != 0 )
- {
- if ( org_dist >= 0 )
- {
- if ( distance < minimum_distance )
- distance = minimum_distance;
- }
- else
- {
- if ( distance > -minimum_distance )
- distance = -minimum_distance;
- }
- }
-
- /* now move the point */
-
- org_dist = PROJECT( exc->zp1.cur + point, exc->zp0.cur + exc->GS.rp0 );
-
- exc->func_move( exc, &exc->zp1, point, distance - org_dist );
-
- Fail:
- exc->GS.rp1 = exc->GS.rp0;
- exc->GS.rp2 = point;
-
- if ( ( exc->opcode & 16 ) != 0 )
- exc->GS.rp0 = point;
- }
-
-
- /*************************************************************************/
- /* */
- /* MIRP[abcde]: Move Indirect Relative Point */
- /* Opcode range: 0xE0-0xFF */
- /* Stack: int32? uint32 --> */
- /* */
- static void
- Ins_MIRP( TT_ExecContext exc,
- FT_Long* args )
- {
- FT_UShort point;
- FT_ULong cvtEntry;
-
- FT_F26Dot6 cvt_dist,
- distance,
- cur_dist,
- org_dist,
- control_value_cutin,
- minimum_distance;
-#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
- FT_Int B1 = 0; /* pacify compiler */
- FT_Int B2 = 0;
- FT_Bool reverse_move = FALSE;
-#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */
-
-
- minimum_distance = exc->GS.minimum_distance;
- control_value_cutin = exc->GS.control_value_cutin;
- point = (FT_UShort)args[0];
- cvtEntry = (FT_ULong)( args[1] + 1 );
-
-#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
- if ( SUBPIXEL_HINTING &&
- exc->ignore_x_mode &&
- exc->GS.freeVector.x != 0 &&
- !( exc->sph_tweak_flags & SPH_TWEAK_NORMAL_ROUND ) )
- control_value_cutin = minimum_distance = 0;
-#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */
-
- /* XXX: UNDOCUMENTED! cvt[-1] = 0 always */
-
- if ( BOUNDS( point, exc->zp1.n_points ) ||
- BOUNDSL( cvtEntry, exc->cvtSize + 1 ) ||
- BOUNDS( exc->GS.rp0, exc->zp0.n_points ) )
- {
- if ( exc->pedantic_hinting )
- exc->error = FT_THROW( Invalid_Reference );
- goto Fail;
- }
-
- if ( !cvtEntry )
- cvt_dist = 0;
- else
- cvt_dist = exc->func_read_cvt( exc, cvtEntry - 1 );
-
- /* single width test */
-
- if ( FT_ABS( cvt_dist - exc->GS.single_width_value ) <
- exc->GS.single_width_cutin )
- {
- if ( cvt_dist >= 0 )
- cvt_dist = exc->GS.single_width_value;
- else
- cvt_dist = -exc->GS.single_width_value;
- }
-
- /* UNDOCUMENTED! The MS rasterizer does that with */
- /* twilight points (confirmed by Greg Hitchcock) */
- if ( exc->GS.gep1 == 0 )
- {
- exc->zp1.org[point].x = exc->zp0.org[exc->GS.rp0].x +
- TT_MulFix14( cvt_dist,
- exc->GS.freeVector.x );
- exc->zp1.org[point].y = exc->zp0.org[exc->GS.rp0].y +
- TT_MulFix14( cvt_dist,
- exc->GS.freeVector.y );
- exc->zp1.cur[point] = exc->zp1.org[point];
- }
-
- org_dist = DUALPROJ( &exc->zp1.org[point], &exc->zp0.org[exc->GS.rp0] );
- cur_dist = PROJECT ( &exc->zp1.cur[point], &exc->zp0.cur[exc->GS.rp0] );
-
- /* auto-flip test */
-
- if ( exc->GS.auto_flip )
- {
- if ( ( org_dist ^ cvt_dist ) < 0 )
- cvt_dist = -cvt_dist;
- }
-
-#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
- if ( SUBPIXEL_HINTING &&
- exc->ignore_x_mode &&
- exc->GS.freeVector.y != 0 &&
- ( exc->sph_tweak_flags & SPH_TWEAK_TIMES_NEW_ROMAN_HACK ) )
- {
- if ( cur_dist < -64 )
- cvt_dist -= 16;
- else if ( cur_dist > 64 && cur_dist < 84 )
- cvt_dist += 32;
- }
-#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */
-
- /* control value cut-in and round */
-
- if ( ( exc->opcode & 4 ) != 0 )
- {
- /* XXX: UNDOCUMENTED! Only perform cut-in test when both points */
- /* refer to the same zone. */
-
- if ( exc->GS.gep0 == exc->GS.gep1 )
- {
- /* XXX: According to Greg Hitchcock, the following wording is */
- /* the right one: */
- /* */
- /* When the absolute difference between the value in */
- /* the table [CVT] and the measurement directly from */
- /* the outline is _greater_ than the cut_in value, the */
- /* outline measurement is used. */
- /* */
- /* This is from `instgly.doc'. The description in */
- /* `ttinst2.doc', version 1.66, is thus incorrect since */
- /* it implies `>=' instead of `>'. */
-
- if ( FT_ABS( cvt_dist - org_dist ) > control_value_cutin )
- cvt_dist = org_dist;
- }
-
- distance = exc->func_round(
- exc,
- cvt_dist,
- exc->tt_metrics.compensations[exc->opcode & 3] );
- }
- else
- {
-
-#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
- /* do cvt cut-in always in MIRP for sph */
- if ( SUBPIXEL_HINTING &&
- exc->ignore_x_mode &&
- exc->GS.gep0 == exc->GS.gep1 )
- {
- if ( FT_ABS( cvt_dist - org_dist ) > control_value_cutin )
- cvt_dist = org_dist;
- }
-#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */
-
- distance = Round_None(
- exc,
- cvt_dist,
- exc->tt_metrics.compensations[exc->opcode & 3] );
- }
-
- /* minimum distance test */
-
- if ( ( exc->opcode & 8 ) != 0 )
- {
- if ( org_dist >= 0 )
- {
- if ( distance < minimum_distance )
- distance = minimum_distance;
- }
- else
- {
- if ( distance > -minimum_distance )
- distance = -minimum_distance;
- }
- }
-
-#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
- if ( SUBPIXEL_HINTING )
- {
- B1 = exc->zp1.cur[point].y;
-
- /* Round moves if necessary */
- if ( exc->ignore_x_mode &&
- exc->GS.freeVector.y != 0 &&
- ( exc->sph_tweak_flags & SPH_TWEAK_ROUND_NONPIXEL_Y_MOVES ) )
- distance = FT_PIX_ROUND( B1 + distance - cur_dist ) - B1 + cur_dist;
-
- if ( exc->ignore_x_mode &&
- exc->GS.freeVector.y != 0 &&
- ( exc->opcode & 16 ) == 0 &&
- ( exc->opcode & 8 ) == 0 &&
- ( exc->sph_tweak_flags & SPH_TWEAK_COURIER_NEW_2_HACK ) )
- distance += 64;
- }
-#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */
-
- exc->func_move( exc, &exc->zp1, point, distance - cur_dist );
-
-#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
- if ( SUBPIXEL_HINTING )
- {
- B2 = exc->zp1.cur[point].y;
-
- /* Reverse move if necessary */
- if ( exc->ignore_x_mode )
- {
- if ( exc->face->sph_compatibility_mode &&
- exc->GS.freeVector.y != 0 &&
- ( B1 & 63 ) == 0 &&
- ( B2 & 63 ) != 0 )
- reverse_move = TRUE;
-
- if ( ( exc->sph_tweak_flags & SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES ) &&
- exc->GS.freeVector.y != 0 &&
- ( B2 & 63 ) != 0 &&
- ( B1 & 63 ) != 0 )
- reverse_move = TRUE;
- }
-
- if ( reverse_move )
- exc->func_move( exc, &exc->zp1, point, -( distance - cur_dist ) );
- }
-
-#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */
-
- Fail:
- exc->GS.rp1 = exc->GS.rp0;
-
- if ( ( exc->opcode & 16 ) != 0 )
- exc->GS.rp0 = point;
-
- exc->GS.rp2 = point;
- }
-
-
- /*************************************************************************/
- /* */
- /* ALIGNRP[]: ALIGN Relative Point */
- /* Opcode range: 0x3C */
- /* Stack: uint32 uint32... --> */
- /* */
- static void
- Ins_ALIGNRP( TT_ExecContext exc )
- {
- FT_UShort point;
- FT_F26Dot6 distance;
-
-
-#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
- if ( SUBPIXEL_HINTING &&
- exc->ignore_x_mode &&
- exc->iup_called &&
- ( exc->sph_tweak_flags & SPH_TWEAK_NO_ALIGNRP_AFTER_IUP ) )
- {
- exc->error = FT_THROW( Invalid_Reference );
- goto Fail;
- }
-#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */
-
- if ( exc->top < exc->GS.loop ||
- BOUNDS( exc->GS.rp0, exc->zp0.n_points ) )
- {
- if ( exc->pedantic_hinting )
- exc->error = FT_THROW( Invalid_Reference );
- goto Fail;
- }
-
- while ( exc->GS.loop > 0 )
- {
- exc->args--;
-
- point = (FT_UShort)exc->stack[exc->args];
-
- if ( BOUNDS( point, exc->zp1.n_points ) )
- {
- if ( exc->pedantic_hinting )
- {
- exc->error = FT_THROW( Invalid_Reference );
- return;
- }
- }
- else
- {
- distance = PROJECT( exc->zp1.cur + point,
- exc->zp0.cur + exc->GS.rp0 );
-
- exc->func_move( exc, &exc->zp1, point, -distance );
- }
-
- exc->GS.loop--;
- }
-
- Fail:
- exc->GS.loop = 1;
- exc->new_top = exc->args;
- }
-
-
- /*************************************************************************/
- /* */
- /* ISECT[]: moves point to InterSECTion */
- /* Opcode range: 0x0F */
- /* Stack: 5 * uint32 --> */
- /* */
- static void
- Ins_ISECT( TT_ExecContext exc,
- FT_Long* args )
- {
- FT_UShort point,
- a0, a1,
- b0, b1;
-
- FT_F26Dot6 discriminant, dotproduct;
-
- FT_F26Dot6 dx, dy,
- dax, day,
- dbx, dby;
-
- FT_F26Dot6 val;
-
- FT_Vector R;
-
-
- point = (FT_UShort)args[0];
-
- a0 = (FT_UShort)args[1];
- a1 = (FT_UShort)args[2];
- b0 = (FT_UShort)args[3];
- b1 = (FT_UShort)args[4];
-
- if ( BOUNDS( b0, exc->zp0.n_points ) ||
- BOUNDS( b1, exc->zp0.n_points ) ||
- BOUNDS( a0, exc->zp1.n_points ) ||
- BOUNDS( a1, exc->zp1.n_points ) ||
- BOUNDS( point, exc->zp2.n_points ) )
- {
- if ( exc->pedantic_hinting )
- exc->error = FT_THROW( Invalid_Reference );
- return;
- }
-
- /* Cramer's rule */
-
- dbx = exc->zp0.cur[b1].x - exc->zp0.cur[b0].x;
- dby = exc->zp0.cur[b1].y - exc->zp0.cur[b0].y;
-
- dax = exc->zp1.cur[a1].x - exc->zp1.cur[a0].x;
- day = exc->zp1.cur[a1].y - exc->zp1.cur[a0].y;
-
- dx = exc->zp0.cur[b0].x - exc->zp1.cur[a0].x;
- dy = exc->zp0.cur[b0].y - exc->zp1.cur[a0].y;
-
- discriminant = FT_MulDiv( dax, -dby, 0x40 ) +
- FT_MulDiv( day, dbx, 0x40 );
- dotproduct = FT_MulDiv( dax, dbx, 0x40 ) +
- FT_MulDiv( day, dby, 0x40 );
-
- /* The discriminant above is actually a cross product of vectors */
- /* da and db. Together with the dot product, they can be used as */
- /* surrogates for sine and cosine of the angle between the vectors. */
- /* Indeed, */
- /* dotproduct = |da||db|cos(angle) */
- /* discriminant = |da||db|sin(angle) . */
- /* We use these equations to reject grazing intersections by */
- /* thresholding abs(tan(angle)) at 1/19, corresponding to 3 degrees. */
- if ( 19 * FT_ABS( discriminant ) > FT_ABS( dotproduct ) )
- {
- val = FT_MulDiv( dx, -dby, 0x40 ) + FT_MulDiv( dy, dbx, 0x40 );
-
- R.x = FT_MulDiv( val, dax, discriminant );
- R.y = FT_MulDiv( val, day, discriminant );
-
- exc->zp2.cur[point].x = exc->zp1.cur[a0].x + R.x;
- exc->zp2.cur[point].y = exc->zp1.cur[a0].y + R.y;
- }
- else
- {
- /* else, take the middle of the middles of A and B */
-
- exc->zp2.cur[point].x = ( exc->zp1.cur[a0].x +
- exc->zp1.cur[a1].x +
- exc->zp0.cur[b0].x +
- exc->zp0.cur[b1].x ) / 4;
- exc->zp2.cur[point].y = ( exc->zp1.cur[a0].y +
- exc->zp1.cur[a1].y +
- exc->zp0.cur[b0].y +
- exc->zp0.cur[b1].y ) / 4;
- }
-
- exc->zp2.tags[point] |= FT_CURVE_TAG_TOUCH_BOTH;
- }
-
-
- /*************************************************************************/
- /* */
- /* ALIGNPTS[]: ALIGN PoinTS */
- /* Opcode range: 0x27 */
- /* Stack: uint32 uint32 --> */
- /* */
- static void
- Ins_ALIGNPTS( TT_ExecContext exc,
- FT_Long* args )
- {
- FT_UShort p1, p2;
- FT_F26Dot6 distance;
-
-
- p1 = (FT_UShort)args[0];
- p2 = (FT_UShort)args[1];
-
- if ( BOUNDS( p1, exc->zp1.n_points ) ||
- BOUNDS( p2, exc->zp0.n_points ) )
- {
- if ( exc->pedantic_hinting )
- exc->error = FT_THROW( Invalid_Reference );
- return;
- }
-
- distance = PROJECT( exc->zp0.cur + p2, exc->zp1.cur + p1 ) / 2;
-
- exc->func_move( exc, &exc->zp1, p1, distance );
- exc->func_move( exc, &exc->zp0, p2, -distance );
- }
-
-
- /*************************************************************************/
- /* */
- /* IP[]: Interpolate Point */
- /* Opcode range: 0x39 */
- /* Stack: uint32... --> */
- /* */
-
- /* SOMETIMES, DUMBER CODE IS BETTER CODE */
-
- static void
- Ins_IP( TT_ExecContext exc )
- {
- FT_F26Dot6 old_range, cur_range;
- FT_Vector* orus_base;
- FT_Vector* cur_base;
- FT_Int twilight;
-
-
- if ( exc->top < exc->GS.loop )
- {
- if ( exc->pedantic_hinting )
- exc->error = FT_THROW( Invalid_Reference );
- goto Fail;
- }
-
- /*
- * We need to deal in a special way with the twilight zone.
- * Otherwise, by definition, the value of exc->twilight.orus[n] is (0,0),
- * for every n.
- */
- twilight = exc->GS.gep0 == 0 || exc->GS.gep1 == 0 || exc->GS.gep2 == 0;
-
- if ( BOUNDS( exc->GS.rp1, exc->zp0.n_points ) )
- {
- if ( exc->pedantic_hinting )
- exc->error = FT_THROW( Invalid_Reference );
- goto Fail;
- }
-
- if ( twilight )
- orus_base = &exc->zp0.org[exc->GS.rp1];
- else
- orus_base = &exc->zp0.orus[exc->GS.rp1];
-
- cur_base = &exc->zp0.cur[exc->GS.rp1];
-
- /* XXX: There are some glyphs in some braindead but popular */
- /* fonts out there (e.g. [aeu]grave in monotype.ttf) */
- /* calling IP[] with bad values of rp[12]. */
- /* Do something sane when this odd thing happens. */
- if ( BOUNDS( exc->GS.rp1, exc->zp0.n_points ) ||
- BOUNDS( exc->GS.rp2, exc->zp1.n_points ) )
- {
- old_range = 0;
- cur_range = 0;
- }
- else
- {
- if ( twilight )
- old_range = DUALPROJ( &exc->zp1.org[exc->GS.rp2], orus_base );
- else if ( exc->metrics.x_scale == exc->metrics.y_scale )
- old_range = DUALPROJ( &exc->zp1.orus[exc->GS.rp2], orus_base );
- else
- {
- FT_Vector vec;
-
-
- vec.x = FT_MulFix( exc->zp1.orus[exc->GS.rp2].x - orus_base->x,
- exc->metrics.x_scale );
- vec.y = FT_MulFix( exc->zp1.orus[exc->GS.rp2].y - orus_base->y,
- exc->metrics.y_scale );
-
- old_range = FAST_DUALPROJ( &vec );
- }
-
- cur_range = PROJECT( &exc->zp1.cur[exc->GS.rp2], cur_base );
- }
-
- for ( ; exc->GS.loop > 0; --exc->GS.loop )
- {
- FT_UInt point = (FT_UInt)exc->stack[--exc->args];
- FT_F26Dot6 org_dist, cur_dist, new_dist;
-
-
- /* check point bounds */
- if ( BOUNDS( point, exc->zp2.n_points ) )
- {
- if ( exc->pedantic_hinting )
- {
- exc->error = FT_THROW( Invalid_Reference );
- return;
- }
- continue;
- }
-
- if ( twilight )
- org_dist = DUALPROJ( &exc->zp2.org[point], orus_base );
- else if ( exc->metrics.x_scale == exc->metrics.y_scale )
- org_dist = DUALPROJ( &exc->zp2.orus[point], orus_base );
- else
- {
- FT_Vector vec;
-
-
- vec.x = FT_MulFix( exc->zp2.orus[point].x - orus_base->x,
- exc->metrics.x_scale );
- vec.y = FT_MulFix( exc->zp2.orus[point].y - orus_base->y,
- exc->metrics.y_scale );
-
- org_dist = FAST_DUALPROJ( &vec );
- }
-
- cur_dist = PROJECT( &exc->zp2.cur[point], cur_base );
-
- if ( org_dist )
- {
- if ( old_range )
- new_dist = FT_MulDiv( org_dist, cur_range, old_range );
- else
- {
- /* This is the same as what MS does for the invalid case: */
- /* */
- /* delta = (Original_Pt - Original_RP1) - */
- /* (Current_Pt - Current_RP1) ; */
- /* */
- /* In FreeType speak: */
- /* */
- /* delta = org_dist - cur_dist . */
- /* */
- /* We move `point' by `new_dist - cur_dist' after leaving */
- /* this block, thus we have */
- /* */
- /* new_dist - cur_dist = delta , */
- /* new_dist - cur_dist = org_dist - cur_dist , */
- /* new_dist = org_dist . */
-
- new_dist = org_dist;
- }
- }
- else
- new_dist = 0;
-
- exc->func_move( exc,
- &exc->zp2,
- (FT_UShort)point,
- new_dist - cur_dist );
- }
-
- Fail:
- exc->GS.loop = 1;
- exc->new_top = exc->args;
- }
-
-
- /*************************************************************************/
- /* */
- /* UTP[a]: UnTouch Point */
- /* Opcode range: 0x29 */
- /* Stack: uint32 --> */
- /* */
- static void
- Ins_UTP( TT_ExecContext exc,
- FT_Long* args )
- {
- FT_UShort point;
- FT_Byte mask;
-
-
- point = (FT_UShort)args[0];
-
- if ( BOUNDS( point, exc->zp0.n_points ) )
- {
- if ( exc->pedantic_hinting )
- exc->error = FT_THROW( Invalid_Reference );
- return;
- }
-
- mask = 0xFF;
-
- if ( exc->GS.freeVector.x != 0 )
- mask &= ~FT_CURVE_TAG_TOUCH_X;
-
- if ( exc->GS.freeVector.y != 0 )
- mask &= ~FT_CURVE_TAG_TOUCH_Y;
-
- exc->zp0.tags[point] &= mask;
- }
-
-
- /* Local variables for Ins_IUP: */
- typedef struct IUP_WorkerRec_
- {
- FT_Vector* orgs; /* original and current coordinate */
- FT_Vector* curs; /* arrays */
- FT_Vector* orus;
- FT_UInt max_points;
-
- } IUP_WorkerRec, *IUP_Worker;
-
-
- static void
- _iup_worker_shift( IUP_Worker worker,
- FT_UInt p1,
- FT_UInt p2,
- FT_UInt p )
- {
- FT_UInt i;
- FT_F26Dot6 dx;
-
-
- dx = worker->curs[p].x - worker->orgs[p].x;
- if ( dx != 0 )
- {
- for ( i = p1; i < p; i++ )
- worker->curs[i].x += dx;
-
- for ( i = p + 1; i <= p2; i++ )
- worker->curs[i].x += dx;
- }
- }
-
-
- static void
- _iup_worker_interpolate( IUP_Worker worker,
- FT_UInt p1,
- FT_UInt p2,
- FT_UInt ref1,
- FT_UInt ref2 )
- {
- FT_UInt i;
- FT_F26Dot6 orus1, orus2, org1, org2, cur1, cur2, delta1, delta2;
-
-
- if ( p1 > p2 )
- return;
-
- if ( BOUNDS( ref1, worker->max_points ) ||
- BOUNDS( ref2, worker->max_points ) )
- return;
-
- orus1 = worker->orus[ref1].x;
- orus2 = worker->orus[ref2].x;
-
- if ( orus1 > orus2 )
- {
- FT_F26Dot6 tmp_o;
- FT_UInt tmp_r;
-
-
- tmp_o = orus1;
- orus1 = orus2;
- orus2 = tmp_o;
-
- tmp_r = ref1;
- ref1 = ref2;
- ref2 = tmp_r;
- }
-
- org1 = worker->orgs[ref1].x;
- org2 = worker->orgs[ref2].x;
- cur1 = worker->curs[ref1].x;
- cur2 = worker->curs[ref2].x;
- delta1 = cur1 - org1;
- delta2 = cur2 - org2;
-
- if ( cur1 == cur2 || orus1 == orus2 )
- {
-
- /* trivial snap or shift of untouched points */
- for ( i = p1; i <= p2; i++ )
- {
- FT_F26Dot6 x = worker->orgs[i].x;
-
-
- if ( x <= org1 )
- x += delta1;
-
- else if ( x >= org2 )
- x += delta2;
-
- else
- x = cur1;
-
- worker->curs[i].x = x;
- }
- }
- else
- {
- FT_Fixed scale = 0;
- FT_Bool scale_valid = 0;
-
-
- /* interpolation */
- for ( i = p1; i <= p2; i++ )
- {
- FT_F26Dot6 x = worker->orgs[i].x;
-
-
- if ( x <= org1 )
- x += delta1;
-
- else if ( x >= org2 )
- x += delta2;
-
- else
- {
- if ( !scale_valid )
- {
- scale_valid = 1;
- scale = FT_DivFix( cur2 - cur1, orus2 - orus1 );
- }
-
- x = cur1 + FT_MulFix( worker->orus[i].x - orus1, scale );
- }
- worker->curs[i].x = x;
- }
- }
- }
-
-
- /*************************************************************************/
- /* */
- /* IUP[a]: Interpolate Untouched Points */
- /* Opcode range: 0x30-0x31 */
- /* Stack: --> */
- /* */
- static void
- Ins_IUP( TT_ExecContext exc )
- {
- IUP_WorkerRec V;
- FT_Byte mask;
-
- FT_UInt first_point; /* first point of contour */
- FT_UInt end_point; /* end point (last+1) of contour */
-
- FT_UInt first_touched; /* first touched point in contour */
- FT_UInt cur_touched; /* current touched point in contour */
-
- FT_UInt point; /* current point */
- FT_Short contour; /* current contour */
-
-
- /* ignore empty outlines */
- if ( exc->pts.n_contours == 0 )
- return;
-
- if ( exc->opcode & 1 )
- {
- mask = FT_CURVE_TAG_TOUCH_X;
- V.orgs = exc->pts.org;
- V.curs = exc->pts.cur;
- V.orus = exc->pts.orus;
- }
- else
- {
- mask = FT_CURVE_TAG_TOUCH_Y;
- V.orgs = (FT_Vector*)( (FT_Pos*)exc->pts.org + 1 );
- V.curs = (FT_Vector*)( (FT_Pos*)exc->pts.cur + 1 );
- V.orus = (FT_Vector*)( (FT_Pos*)exc->pts.orus + 1 );
- }
- V.max_points = exc->pts.n_points;
-
- contour = 0;
- point = 0;
-
-#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
- if ( SUBPIXEL_HINTING &&
- exc->ignore_x_mode )
- {
- exc->iup_called = TRUE;
- if ( exc->sph_tweak_flags & SPH_TWEAK_SKIP_IUP )
- return;
- }
-#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */
-
- do
- {
- end_point = exc->pts.contours[contour] - exc->pts.first_point;
- first_point = point;
-
- if ( BOUNDS( end_point, exc->pts.n_points ) )
- end_point = exc->pts.n_points - 1;
-
- while ( point <= end_point && ( exc->pts.tags[point] & mask ) == 0 )
- point++;
-
- if ( point <= end_point )
- {
- first_touched = point;
- cur_touched = point;
-
- point++;
-
- while ( point <= end_point )
- {
- if ( ( exc->pts.tags[point] & mask ) != 0 )
- {
- _iup_worker_interpolate( &V,
- cur_touched + 1,
- point - 1,
- cur_touched,
- point );
- cur_touched = point;
- }
-
- point++;
- }
-
- if ( cur_touched == first_touched )
- _iup_worker_shift( &V, first_point, end_point, cur_touched );
- else
- {
- _iup_worker_interpolate( &V,
- (FT_UShort)( cur_touched + 1 ),
- end_point,
- cur_touched,
- first_touched );
-
- if ( first_touched > 0 )
- _iup_worker_interpolate( &V,
- first_point,
- first_touched - 1,
- cur_touched,
- first_touched );
- }
- }
- contour++;
- } while ( contour < exc->pts.n_contours );
- }
-
-
- /*************************************************************************/
- /* */
- /* DELTAPn[]: DELTA exceptions P1, P2, P3 */
- /* Opcode range: 0x5D,0x71,0x72 */
- /* Stack: uint32 (2 * uint32)... --> */
- /* */
- static void
- Ins_DELTAP( TT_ExecContext exc,
- FT_Long* args )
- {
- FT_ULong nump, k;
- FT_UShort A;
- FT_ULong C, P;
- FT_Long B;
-#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
- FT_UShort B1, B2;
-
-
- if ( SUBPIXEL_HINTING &&
- exc->ignore_x_mode &&
- exc->iup_called &&
- ( exc->sph_tweak_flags & SPH_TWEAK_NO_DELTAP_AFTER_IUP ) )
- goto Fail;
-#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */
-
-
-#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
- /* Delta hinting is covered by US Patent 5159668. */
- if ( exc->face->unpatented_hinting )
- {
- FT_Long n = args[0] * 2;
-
-
- if ( exc->args < n )
- {
- if ( exc->pedantic_hinting )
- exc->error = FT_THROW( Too_Few_Arguments );
- n = exc->args;
- }
-
- exc->args -= n;
- exc->new_top = exc->args;
- return;
- }
-#endif
-
- P = (FT_ULong)exc->func_cur_ppem( exc );
- nump = (FT_ULong)args[0]; /* some points theoretically may occur more
- than once, thus UShort isn't enough */
-
- for ( k = 1; k <= nump; k++ )
- {
- if ( exc->args < 2 )
- {
- if ( exc->pedantic_hinting )
- exc->error = FT_THROW( Too_Few_Arguments );
- exc->args = 0;
- goto Fail;
- }
-
- exc->args -= 2;
-
- A = (FT_UShort)exc->stack[exc->args + 1];
- B = exc->stack[exc->args];
-
- /* XXX: Because some popular fonts contain some invalid DeltaP */
- /* instructions, we simply ignore them when the stacked */
- /* point reference is off limit, rather than returning an */
- /* error. As a delta instruction doesn't change a glyph */
- /* in great ways, this shouldn't be a problem. */
-
- if ( !BOUNDS( A, exc->zp0.n_points ) )
- {
- C = ( (FT_ULong)B & 0xF0 ) >> 4;
-
- switch ( exc->opcode )
- {
- case 0x5D:
- break;
-
- case 0x71:
- C += 16;
- break;
-
- case 0x72:
- C += 32;
- break;
- }
-
- C += exc->GS.delta_base;
-
- if ( P == C )
- {
- B = ( (FT_ULong)B & 0xF ) - 8;
- if ( B >= 0 )
- B++;
- B *= 1L << ( 6 - exc->GS.delta_shift );
-
-#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
-
- if ( SUBPIXEL_HINTING )
- {
- /*
- * Allow delta move if
- *
- * - not using ignore_x_mode rendering,
- * - glyph is specifically set to allow it, or
- * - glyph is composite and freedom vector is not in subpixel
- * direction.
- */
- if ( !exc->ignore_x_mode ||
- ( exc->sph_tweak_flags & SPH_TWEAK_ALWAYS_DO_DELTAP ) ||
- ( exc->is_composite && exc->GS.freeVector.y != 0 ) )
- exc->func_move( exc, &exc->zp0, A, B );
-
- /* Otherwise, apply subpixel hinting and compatibility mode */
- /* rules, always skipping deltas in subpixel direction. */
- else if ( exc->ignore_x_mode && exc->GS.freeVector.y != 0 )
- {
- /* save the y value of the point now; compare after move */
- B1 = (FT_UShort)exc->zp0.cur[A].y;
-
- /* Standard subpixel hinting: Allow y move for y-touched */
- /* points. This messes up DejaVu ... */
- if ( !exc->face->sph_compatibility_mode &&
- ( exc->zp0.tags[A] & FT_CURVE_TAG_TOUCH_Y ) )
- exc->func_move( exc, &exc->zp0, A, B );
-
- /* compatibility mode */
- else if ( exc->face->sph_compatibility_mode &&
- !( exc->sph_tweak_flags & SPH_TWEAK_ALWAYS_SKIP_DELTAP ) )
- {
- if ( exc->sph_tweak_flags & SPH_TWEAK_ROUND_NONPIXEL_Y_MOVES )
- B = FT_PIX_ROUND( B1 + B ) - B1;
-
- /* Allow delta move if using sph_compatibility_mode, */
- /* IUP has not been called, and point is touched on Y. */
- if ( !exc->iup_called &&
- ( exc->zp0.tags[A] & FT_CURVE_TAG_TOUCH_Y ) )
- exc->func_move( exc, &exc->zp0, A, B );
- }
-
- B2 = (FT_UShort)exc->zp0.cur[A].y;
-
- /* Reverse this move if it results in a disallowed move */
- if ( exc->GS.freeVector.y != 0 &&
- ( ( exc->face->sph_compatibility_mode &&
- ( B1 & 63 ) == 0 &&
- ( B2 & 63 ) != 0 ) ||
- ( ( exc->sph_tweak_flags &
- SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES_DELTAP ) &&
- ( B1 & 63 ) != 0 &&
- ( B2 & 63 ) != 0 ) ) )
- exc->func_move( exc, &exc->zp0, A, -B );
- }
- }
- else
-#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */
-
- exc->func_move( exc, &exc->zp0, A, B );
- }
- }
- else
- if ( exc->pedantic_hinting )
- exc->error = FT_THROW( Invalid_Reference );
- }
-
- Fail:
- exc->new_top = exc->args;
- }
-
-
- /*************************************************************************/
- /* */
- /* DELTACn[]: DELTA exceptions C1, C2, C3 */
- /* Opcode range: 0x73,0x74,0x75 */
- /* Stack: uint32 (2 * uint32)... --> */
- /* */
- static void
- Ins_DELTAC( TT_ExecContext exc,
- FT_Long* args )
- {
- FT_ULong nump, k;
- FT_ULong A, C, P;
- FT_Long B;
-
-
-#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
- /* Delta hinting is covered by US Patent 5159668. */
- if ( exc->face->unpatented_hinting )
- {
- FT_Long n = args[0] * 2;
-
-
- if ( exc->args < n )
- {
- if ( exc->pedantic_hinting )
- exc->error = FT_THROW( Too_Few_Arguments );
- n = exc->args;
- }
-
- exc->args -= n;
- exc->new_top = exc->args;
- return;
- }
-#endif
-
- P = (FT_ULong)exc->func_cur_ppem( exc );
- nump = (FT_ULong)args[0];
-
- for ( k = 1; k <= nump; k++ )
- {
- if ( exc->args < 2 )
- {
- if ( exc->pedantic_hinting )
- exc->error = FT_THROW( Too_Few_Arguments );
- exc->args = 0;
- goto Fail;
- }
-
- exc->args -= 2;
-
- A = (FT_ULong)exc->stack[exc->args + 1];
- B = exc->stack[exc->args];
-
- if ( BOUNDSL( A, exc->cvtSize ) )
- {
- if ( exc->pedantic_hinting )
- {
- exc->error = FT_THROW( Invalid_Reference );
- return;
- }
- }
- else
- {
- C = ( (FT_ULong)B & 0xF0 ) >> 4;
-
- switch ( exc->opcode )
- {
- case 0x73:
- break;
-
- case 0x74:
- C += 16;
- break;
-
- case 0x75:
- C += 32;
- break;
- }
-
- C += exc->GS.delta_base;
-
- if ( P == C )
- {
- B = ( (FT_ULong)B & 0xF ) - 8;
- if ( B >= 0 )
- B++;
- B *= 1L << ( 6 - exc->GS.delta_shift );
-
- exc->func_move_cvt( exc, A, B );
- }
- }
- }
-
- Fail:
- exc->new_top = exc->args;
- }
-
-
- /*************************************************************************/
- /* */
- /* MISC. INSTRUCTIONS */
- /* */
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* GETINFO[]: GET INFOrmation */
- /* Opcode range: 0x88 */
- /* Stack: uint32 --> uint32 */
- /* */
- /* XXX: UNDOCUMENTED: Selector bits higher than 9 are currently (May */
- /* 2015) not documented in the OpenType specification. */
- /* */
- /* Selector bit 11 is incorrectly described as bit 8, while the */
- /* real meaning of bit 8 (vertical LCD subpixels) stays */
- /* undocumented. The same mistake can be found in Greg Hitchcock's */
- /* whitepaper. */
- /* */
- static void
- Ins_GETINFO( TT_ExecContext exc,
- FT_Long* args )
- {
- FT_Long K;
-
-
- K = 0;
-
-#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
- /********************************/
- /* RASTERIZER VERSION */
- /* Selector Bit: 0 */
- /* Return Bit(s): 0-7 */
- /* */
- if ( SUBPIXEL_HINTING &&
- ( args[0] & 1 ) != 0 &&
- exc->subpixel_hinting )
- {
- if ( exc->ignore_x_mode )
- {
- /* if in ClearType backwards compatibility mode, */
- /* we sometimes change the TrueType version dynamically */
- K = exc->rasterizer_version;
- FT_TRACE6(( "Setting rasterizer version %d\n",
- exc->rasterizer_version ));
- }
- else
- K = TT_INTERPRETER_VERSION_38;
- }
- else
-#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */
- if ( ( args[0] & 1 ) != 0 )
- K = TT_INTERPRETER_VERSION_35;
-
- /********************************/
- /* GLYPH ROTATED */
- /* Selector Bit: 1 */
- /* Return Bit(s): 8 */
- /* */
- if ( ( args[0] & 2 ) != 0 && exc->tt_metrics.rotated )
- K |= 0x80;
-
- /********************************/
- /* GLYPH STRETCHED */
- /* Selector Bit: 2 */
- /* Return Bit(s): 9 */
- /* */
- if ( ( args[0] & 4 ) != 0 && exc->tt_metrics.stretched )
- K |= 1 << 8;
-
- /********************************/
- /* HINTING FOR GRAYSCALE */
- /* Selector Bit: 5 */
- /* Return Bit(s): 12 */
- /* */
- if ( ( args[0] & 32 ) != 0 && exc->grayscale )
- K |= 1 << 12;
-
-#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
-
- if ( SUBPIXEL_HINTING &&
- exc->rasterizer_version >= TT_INTERPRETER_VERSION_35 )
- {
-
- if ( exc->rasterizer_version >= 37 )
- {
- /********************************/
- /* HINTING FOR SUBPIXEL */
- /* Selector Bit: 6 */
- /* Return Bit(s): 13 */
- /* */
- if ( ( args[0] & 64 ) != 0 && exc->subpixel_hinting )
- K |= 1 << 13;
-
- /********************************/
- /* COMPATIBLE WIDTHS ENABLED */
- /* Selector Bit: 7 */
- /* Return Bit(s): 14 */
- /* */
- /* Functionality still needs to be added */
- if ( ( args[0] & 128 ) != 0 && exc->compatible_widths )
- K |= 1 << 14;
-
- /********************************/
- /* VERTICAL LCD SUBPIXELS? */
- /* Selector Bit: 8 */
- /* Return Bit(s): 15 */
- /* */
- /* Functionality still needs to be added */
- if ( ( args[0] & 256 ) != 0 && exc->vertical_lcd )
- K |= 1 << 15;
-
- /********************************/
- /* HINTING FOR BGR? */
- /* Selector Bit: 9 */
- /* Return Bit(s): 16 */
- /* */
- /* Functionality still needs to be added */
- if ( ( args[0] & 512 ) != 0 && exc->bgr )
- K |= 1 << 16;
-
- if ( exc->rasterizer_version >= 38 )
- {
- /********************************/
- /* SUBPIXEL POSITIONED? */
- /* Selector Bit: 10 */
- /* Return Bit(s): 17 */
- /* */
- /* Functionality still needs to be added */
- if ( ( args[0] & 1024 ) != 0 && exc->subpixel_positioned )
- K |= 1 << 17;
-
- /********************************/
- /* SYMMETRICAL SMOOTHING */
- /* Selector Bit: 11 */
- /* Return Bit(s): 18 */
- /* */
- /* Functionality still needs to be added */
- if ( ( args[0] & 2048 ) != 0 && exc->symmetrical_smoothing )
- K |= 1 << 18;
-
- /********************************/
- /* GRAY CLEARTYPE */
- /* Selector Bit: 12 */
- /* Return Bit(s): 19 */
- /* */
- /* Functionality still needs to be added */
- if ( ( args[0] & 4096 ) != 0 && exc->gray_cleartype )
- K |= 1 << 19;
- }
- }
- }
-
-#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */
-
- args[0] = K;
- }
-
-
- static void
- Ins_UNKNOWN( TT_ExecContext exc )
- {
- TT_DefRecord* def = exc->IDefs;
- TT_DefRecord* limit = def + exc->numIDefs;
-
-
- for ( ; def < limit; def++ )
- {
- if ( (FT_Byte)def->opc == exc->opcode && def->active )
- {
- TT_CallRec* call;
-
-
- if ( exc->callTop >= exc->callSize )
- {
- exc->error = FT_THROW( Stack_Overflow );
- return;
- }
-
- call = exc->callStack + exc->callTop++;
-
- call->Caller_Range = exc->curRange;
- call->Caller_IP = exc->IP + 1;
- call->Cur_Count = 1;
- call->Def = def;
-
- Ins_Goto_CodeRange( exc, def->range, def->start );
-
- exc->step_ins = FALSE;
- return;
- }
- }
-
- exc->error = FT_THROW( Invalid_Opcode );
- }
-
-
- /*************************************************************************/
- /* */
- /* RUN */
- /* */
- /* This function executes a run of opcodes. It will exit in the */
- /* following cases: */
- /* */
- /* - Errors (in which case it returns FALSE). */
- /* */
- /* - Reaching the end of the main code range (returns TRUE). */
- /* Reaching the end of a code range within a function call is an */
- /* error. */
- /* */
- /* - After executing one single opcode, if the flag `Instruction_Trap' */
- /* is set to TRUE (returns TRUE). */
- /* */
- /* On exit with TRUE, test IP < CodeSize to know whether it comes from */
- /* an instruction trap or a normal termination. */
- /* */
- /* */
- /* Note: The documented DEBUG opcode pops a value from the stack. This */
- /* behaviour is unsupported; here a DEBUG opcode is always an */
- /* error. */
- /* */
- /* */
- /* THIS IS THE INTERPRETER'S MAIN LOOP. */
- /* */
- /*************************************************************************/
-
-
- /* documentation is in ttinterp.h */
-
- FT_EXPORT_DEF( FT_Error )
- TT_RunIns( TT_ExecContext exc )
- {
- FT_Long ins_counter = 0; /* executed instructions counter */
- FT_UShort i;
-
-#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
- FT_Byte opcode_pattern[1][2] = {
- /* #8 TypeMan Talk Align */
- {
- 0x06, /* SPVTL */
- 0x7D, /* RDTG */
- },
- };
- FT_UShort opcode_patterns = 1;
- FT_UShort opcode_pointer[1] = { 0 };
- FT_UShort opcode_size[1] = { 1 };
-#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */
-
-
-#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
- exc->iup_called = FALSE;
-#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */
-
- /* set PPEM and CVT functions */
- exc->tt_metrics.ratio = 0;
- if ( exc->metrics.x_ppem != exc->metrics.y_ppem )
- {
- /* non-square pixels, use the stretched routines */
- exc->func_cur_ppem = Current_Ppem_Stretched;
- exc->func_read_cvt = Read_CVT_Stretched;
- exc->func_write_cvt = Write_CVT_Stretched;
- exc->func_move_cvt = Move_CVT_Stretched;
- }
- else
- {
- /* square pixels, use normal routines */
- exc->func_cur_ppem = Current_Ppem;
- exc->func_read_cvt = Read_CVT;
- exc->func_write_cvt = Write_CVT;
- exc->func_move_cvt = Move_CVT;
- }
-
- Compute_Funcs( exc );
- Compute_Round( exc, (FT_Byte)exc->GS.round_state );
-
- do
- {
- exc->opcode = exc->code[exc->IP];
-
-#ifdef FT_DEBUG_LEVEL_TRACE
- {
- FT_Long cnt = FT_MIN( 8, exc->top );
- FT_Long n;
-
-
- /* if tracing level is 7, show current code position */
- /* and the first few stack elements also */
- FT_TRACE6(( " " ));
- FT_TRACE7(( "%06d ", exc->IP ));
- FT_TRACE6(( opcode_name[exc->opcode] + 2 ));
- FT_TRACE7(( "%*s", *opcode_name[exc->opcode] == 'A'
- ? 2
- : 12 - ( *opcode_name[exc->opcode] - '0' ),
- "#" ));
- for ( n = 0; n < cnt; n++ )
- FT_TRACE7(( " %d", exc->stack[exc->top - n] ));
- FT_TRACE6(( "\n" ));
- }
-#endif /* FT_DEBUG_LEVEL_TRACE */
-
- if ( ( exc->length = opcode_length[exc->opcode] ) < 0 )
- {
- if ( exc->IP + 1 >= exc->codeSize )
- goto LErrorCodeOverflow_;
-
- exc->length = 2 - exc->length * exc->code[exc->IP + 1];
- }
-
- if ( exc->IP + exc->length > exc->codeSize )
- goto LErrorCodeOverflow_;
-
- /* First, let's check for empty stack and overflow */
- exc->args = exc->top - ( Pop_Push_Count[exc->opcode] >> 4 );
-
- /* `args' is the top of the stack once arguments have been popped. */
- /* One can also interpret it as the index of the last argument. */
- if ( exc->args < 0 )
- {
- if ( exc->pedantic_hinting )
- {
- exc->error = FT_THROW( Too_Few_Arguments );
- goto LErrorLabel_;
- }
-
- /* push zeroes onto the stack */
- for ( i = 0; i < Pop_Push_Count[exc->opcode] >> 4; i++ )
- exc->stack[i] = 0;
- exc->args = 0;
- }
-
- exc->new_top = exc->args + ( Pop_Push_Count[exc->opcode] & 15 );
-
- /* `new_top' is the new top of the stack, after the instruction's */
- /* execution. `top' will be set to `new_top' after the `switch' */
- /* statement. */
- if ( exc->new_top > exc->stackSize )
- {
- exc->error = FT_THROW( Stack_Overflow );
- goto LErrorLabel_;
- }
-
- exc->step_ins = TRUE;
- exc->error = FT_Err_Ok;
-
-#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
-
- if ( SUBPIXEL_HINTING )
- {
- for ( i = 0; i < opcode_patterns; i++ )
- {
- if ( opcode_pointer[i] < opcode_size[i] &&
- exc->opcode == opcode_pattern[i][opcode_pointer[i]] )
- {
- opcode_pointer[i] += 1;
-
- if ( opcode_pointer[i] == opcode_size[i] )
- {
- FT_TRACE6(( "sph: opcode ptrn: %d, %s %s\n",
- i,
- exc->face->root.family_name,
- exc->face->root.style_name ));
-
- switch ( i )
- {
- case 0:
- break;
- }
- opcode_pointer[i] = 0;
- }
- }
- else
- opcode_pointer[i] = 0;
- }
- }
-
-#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */
-
- {
- FT_Long* args = exc->stack + exc->args;
- FT_Byte opcode = exc->opcode;
-
-
- switch ( opcode )
- {
- case 0x00: /* SVTCA y */
- case 0x01: /* SVTCA x */
- case 0x02: /* SPvTCA y */
- case 0x03: /* SPvTCA x */
- case 0x04: /* SFvTCA y */
- case 0x05: /* SFvTCA x */
- Ins_SxyTCA( exc );
- break;
-
- case 0x06: /* SPvTL // */
- case 0x07: /* SPvTL + */
- Ins_SPVTL( exc, args );
- break;
-
- case 0x08: /* SFvTL // */
- case 0x09: /* SFvTL + */
- Ins_SFVTL( exc, args );
- break;
-
- case 0x0A: /* SPvFS */
- Ins_SPVFS( exc, args );
- break;
-
- case 0x0B: /* SFvFS */
- Ins_SFVFS( exc, args );
- break;
-
- case 0x0C: /* GPv */
- Ins_GPV( exc, args );
- break;
-
- case 0x0D: /* GFv */
- Ins_GFV( exc, args );
- break;
-
- case 0x0E: /* SFvTPv */
- Ins_SFVTPV( exc );
- break;
-
- case 0x0F: /* ISECT */
- Ins_ISECT( exc, args );
- break;
-
- case 0x10: /* SRP0 */
- Ins_SRP0( exc, args );
- break;
-
- case 0x11: /* SRP1 */
- Ins_SRP1( exc, args );
- break;
-
- case 0x12: /* SRP2 */
- Ins_SRP2( exc, args );
- break;
-
- case 0x13: /* SZP0 */
- Ins_SZP0( exc, args );
- break;
-
- case 0x14: /* SZP1 */
- Ins_SZP1( exc, args );
- break;
-
- case 0x15: /* SZP2 */
- Ins_SZP2( exc, args );
- break;
-
- case 0x16: /* SZPS */
- Ins_SZPS( exc, args );
- break;
-
- case 0x17: /* SLOOP */
- Ins_SLOOP( exc, args );
- break;
-
- case 0x18: /* RTG */
- Ins_RTG( exc );
- break;
-
- case 0x19: /* RTHG */
- Ins_RTHG( exc );
- break;
-
- case 0x1A: /* SMD */
- Ins_SMD( exc, args );
- break;
-
- case 0x1B: /* ELSE */
- Ins_ELSE( exc );
- break;
-
- case 0x1C: /* JMPR */
- Ins_JMPR( exc, args );
- break;
-
- case 0x1D: /* SCVTCI */
- Ins_SCVTCI( exc, args );
- break;
-
- case 0x1E: /* SSWCI */
- Ins_SSWCI( exc, args );
- break;
-
- case 0x1F: /* SSW */
- Ins_SSW( exc, args );
- break;
-
- case 0x20: /* DUP */
- Ins_DUP( args );
- break;
-
- case 0x21: /* POP */
- Ins_POP();
- break;
-
- case 0x22: /* CLEAR */
- Ins_CLEAR( exc );
- break;
-
- case 0x23: /* SWAP */
- Ins_SWAP( args );
- break;
-
- case 0x24: /* DEPTH */
- Ins_DEPTH( exc, args );
- break;
-
- case 0x25: /* CINDEX */
- Ins_CINDEX( exc, args );
- break;
-
- case 0x26: /* MINDEX */
- Ins_MINDEX( exc, args );
- break;
-
- case 0x27: /* ALIGNPTS */
- Ins_ALIGNPTS( exc, args );
- break;
-
- case 0x28: /* ???? */
- Ins_UNKNOWN( exc );
- break;
-
- case 0x29: /* UTP */
- Ins_UTP( exc, args );
- break;
-
- case 0x2A: /* LOOPCALL */
- Ins_LOOPCALL( exc, args );
- break;
-
- case 0x2B: /* CALL */
- Ins_CALL( exc, args );
- break;
-
- case 0x2C: /* FDEF */
- Ins_FDEF( exc, args );
- break;
-
- case 0x2D: /* ENDF */
- Ins_ENDF( exc );
- break;
-
- case 0x2E: /* MDAP */
- case 0x2F: /* MDAP */
- Ins_MDAP( exc, args );
- break;
-
- case 0x30: /* IUP */
- case 0x31: /* IUP */
- Ins_IUP( exc );
- break;
-
- case 0x32: /* SHP */
- case 0x33: /* SHP */
- Ins_SHP( exc );
- break;
-
- case 0x34: /* SHC */
- case 0x35: /* SHC */
- Ins_SHC( exc, args );
- break;
-
- case 0x36: /* SHZ */
- case 0x37: /* SHZ */
- Ins_SHZ( exc, args );
- break;
-
- case 0x38: /* SHPIX */
- Ins_SHPIX( exc, args );
- break;
-
- case 0x39: /* IP */
- Ins_IP( exc );
- break;
-
- case 0x3A: /* MSIRP */
- case 0x3B: /* MSIRP */
- Ins_MSIRP( exc, args );
- break;
-
- case 0x3C: /* AlignRP */
- Ins_ALIGNRP( exc );
- break;
-
- case 0x3D: /* RTDG */
- Ins_RTDG( exc );
- break;
-
- case 0x3E: /* MIAP */
- case 0x3F: /* MIAP */
- Ins_MIAP( exc, args );
- break;
-
- case 0x40: /* NPUSHB */
- Ins_NPUSHB( exc, args );
- break;
-
- case 0x41: /* NPUSHW */
- Ins_NPUSHW( exc, args );
- break;
-
- case 0x42: /* WS */
- Ins_WS( exc, args );
- break;
-
- case 0x43: /* RS */
- Ins_RS( exc, args );
- break;
-
- case 0x44: /* WCVTP */
- Ins_WCVTP( exc, args );
- break;
-
- case 0x45: /* RCVT */
- Ins_RCVT( exc, args );
- break;
-
- case 0x46: /* GC */
- case 0x47: /* GC */
- Ins_GC( exc, args );
- break;
-
- case 0x48: /* SCFS */
- Ins_SCFS( exc, args );
- break;
-
- case 0x49: /* MD */
- case 0x4A: /* MD */
- Ins_MD( exc, args );
- break;
-
- case 0x4B: /* MPPEM */
- Ins_MPPEM( exc, args );
- break;
-
- case 0x4C: /* MPS */
- Ins_MPS( exc, args );
- break;
-
- case 0x4D: /* FLIPON */
- Ins_FLIPON( exc );
- break;
-
- case 0x4E: /* FLIPOFF */
- Ins_FLIPOFF( exc );
- break;
-
- case 0x4F: /* DEBUG */
- Ins_DEBUG( exc );
- break;
-
- case 0x50: /* LT */
- Ins_LT( args );
- break;
-
- case 0x51: /* LTEQ */
- Ins_LTEQ( args );
- break;
-
- case 0x52: /* GT */
- Ins_GT( args );
- break;
-
- case 0x53: /* GTEQ */
- Ins_GTEQ( args );
- break;
-
- case 0x54: /* EQ */
- Ins_EQ( args );
- break;
-
- case 0x55: /* NEQ */
- Ins_NEQ( args );
- break;
-
- case 0x56: /* ODD */
- Ins_ODD( exc, args );
- break;
-
- case 0x57: /* EVEN */
- Ins_EVEN( exc, args );
- break;
-
- case 0x58: /* IF */
- Ins_IF( exc, args );
- break;
-
- case 0x59: /* EIF */
- Ins_EIF();
- break;
-
- case 0x5A: /* AND */
- Ins_AND( args );
- break;
-
- case 0x5B: /* OR */
- Ins_OR( args );
- break;
-
- case 0x5C: /* NOT */
- Ins_NOT( args );
- break;
-
- case 0x5D: /* DELTAP1 */
- Ins_DELTAP( exc, args );
- break;
-
- case 0x5E: /* SDB */
- Ins_SDB( exc, args );
- break;
-
- case 0x5F: /* SDS */
- Ins_SDS( exc, args );
- break;
-
- case 0x60: /* ADD */
- Ins_ADD( args );
- break;
-
- case 0x61: /* SUB */
- Ins_SUB( args );
- break;
-
- case 0x62: /* DIV */
- Ins_DIV( exc, args );
- break;
-
- case 0x63: /* MUL */
- Ins_MUL( args );
- break;
-
- case 0x64: /* ABS */
- Ins_ABS( args );
- break;
-
- case 0x65: /* NEG */
- Ins_NEG( args );
- break;
-
- case 0x66: /* FLOOR */
- Ins_FLOOR( args );
- break;
-
- case 0x67: /* CEILING */
- Ins_CEILING( args );
- break;
-
- case 0x68: /* ROUND */
- case 0x69: /* ROUND */
- case 0x6A: /* ROUND */
- case 0x6B: /* ROUND */
- Ins_ROUND( exc, args );
- break;
-
- case 0x6C: /* NROUND */
- case 0x6D: /* NROUND */
- case 0x6E: /* NRRUND */
- case 0x6F: /* NROUND */
- Ins_NROUND( exc, args );
- break;
-
- case 0x70: /* WCVTF */
- Ins_WCVTF( exc, args );
- break;
-
- case 0x71: /* DELTAP2 */
- case 0x72: /* DELTAP3 */
- Ins_DELTAP( exc, args );
- break;
-
- case 0x73: /* DELTAC0 */
- case 0x74: /* DELTAC1 */
- case 0x75: /* DELTAC2 */
- Ins_DELTAC( exc, args );
- break;
-
- case 0x76: /* SROUND */
- Ins_SROUND( exc, args );
- break;
-
- case 0x77: /* S45Round */
- Ins_S45ROUND( exc, args );
- break;
-
- case 0x78: /* JROT */
- Ins_JROT( exc, args );
- break;
-
- case 0x79: /* JROF */
- Ins_JROF( exc, args );
- break;
-
- case 0x7A: /* ROFF */
- Ins_ROFF( exc );
- break;
-
- case 0x7B: /* ???? */
- Ins_UNKNOWN( exc );
- break;
-
- case 0x7C: /* RUTG */
- Ins_RUTG( exc );
- break;
-
- case 0x7D: /* RDTG */
- Ins_RDTG( exc );
- break;
-
- case 0x7E: /* SANGW */
- Ins_SANGW();
- break;
-
- case 0x7F: /* AA */
- Ins_AA();
- break;
-
- case 0x80: /* FLIPPT */
- Ins_FLIPPT( exc );
- break;
-
- case 0x81: /* FLIPRGON */
- Ins_FLIPRGON( exc, args );
- break;
-
- case 0x82: /* FLIPRGOFF */
- Ins_FLIPRGOFF( exc, args );
- break;
-
- case 0x83: /* UNKNOWN */
- case 0x84: /* UNKNOWN */
- Ins_UNKNOWN( exc );
- break;
-
- case 0x85: /* SCANCTRL */
- Ins_SCANCTRL( exc, args );
- break;
-
- case 0x86: /* SDPvTL */
- case 0x87: /* SDPvTL */
- Ins_SDPVTL( exc, args );
- break;
-
- case 0x88: /* GETINFO */
- Ins_GETINFO( exc, args );
- break;
-
- case 0x89: /* IDEF */
- Ins_IDEF( exc, args );
- break;
-
- case 0x8A: /* ROLL */
- Ins_ROLL( args );
- break;
-
- case 0x8B: /* MAX */
- Ins_MAX( args );
- break;
-
- case 0x8C: /* MIN */
- Ins_MIN( args );
- break;
-
- case 0x8D: /* SCANTYPE */
- Ins_SCANTYPE( exc, args );
- break;
-
- case 0x8E: /* INSTCTRL */
- Ins_INSTCTRL( exc, args );
- break;
-
- case 0x8F:
- Ins_UNKNOWN( exc );
- break;
-
- default:
- if ( opcode >= 0xE0 )
- Ins_MIRP( exc, args );
- else if ( opcode >= 0xC0 )
- Ins_MDRP( exc, args );
- else if ( opcode >= 0xB8 )
- Ins_PUSHW( exc, args );
- else if ( opcode >= 0xB0 )
- Ins_PUSHB( exc, args );
- else
- Ins_UNKNOWN( exc );
- }
- }
-
- if ( exc->error )
- {
- switch ( exc->error )
- {
- /* looking for redefined instructions */
- case FT_ERR( Invalid_Opcode ):
- {
- TT_DefRecord* def = exc->IDefs;
- TT_DefRecord* limit = def + exc->numIDefs;
-
-
- for ( ; def < limit; def++ )
- {
- if ( def->active && exc->opcode == (FT_Byte)def->opc )
- {
- TT_CallRec* callrec;
-
-
- if ( exc->callTop >= exc->callSize )
- {
- exc->error = FT_THROW( Invalid_Reference );
- goto LErrorLabel_;
- }
-
- callrec = &exc->callStack[exc->callTop];
-
- callrec->Caller_Range = exc->curRange;
- callrec->Caller_IP = exc->IP + 1;
- callrec->Cur_Count = 1;
- callrec->Def = def;
-
- if ( Ins_Goto_CodeRange( exc,
- def->range,
- def->start ) == FAILURE )
- goto LErrorLabel_;
-
- goto LSuiteLabel_;
- }
- }
- }
-
- exc->error = FT_THROW( Invalid_Opcode );
- goto LErrorLabel_;
-
-#if 0
- break; /* Unreachable code warning suppression. */
- /* Leave to remind in case a later change the editor */
- /* to consider break; */
-#endif
-
- default:
- goto LErrorLabel_;
-
-#if 0
- break;
-#endif
- }
- }
-
- exc->top = exc->new_top;
-
- if ( exc->step_ins )
- exc->IP += exc->length;
-
- /* increment instruction counter and check if we didn't */
- /* run this program for too long (e.g. infinite loops). */
- if ( ++ins_counter > MAX_RUNNABLE_OPCODES )
- return FT_THROW( Execution_Too_Long );
-
- LSuiteLabel_:
- if ( exc->IP >= exc->codeSize )
- {
- if ( exc->callTop > 0 )
- {
- exc->error = FT_THROW( Code_Overflow );
- goto LErrorLabel_;
- }
- else
- goto LNo_Error_;
- }
- } while ( !exc->instruction_trap );
-
- LNo_Error_:
- return FT_Err_Ok;
-
- LErrorCodeOverflow_:
- exc->error = FT_THROW( Code_Overflow );
-
- LErrorLabel_:
- /* If any errors have occurred, function tables may be broken. */
- /* Force a re-execution of `prep' and `fpgm' tables if no */
- /* bytecode debugger is run. */
- if ( exc->error &&
- !exc->instruction_trap &&
- exc->curRange == tt_coderange_glyph )
- {
- FT_TRACE1(( " The interpreter returned error 0x%x\n", exc->error ));
- exc->size->bytecode_ready = -1;
- exc->size->cvt_ready = -1;
- }
-
- return exc->error;
- }
-
-
-#endif /* TT_USE_BYTECODE_INTERPRETER */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/truetype/ttinterp.h b/chromium/third_party/pdfium/third_party/freetype/src/truetype/ttinterp.h
deleted file mode 100644
index 32706d07604..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/truetype/ttinterp.h
+++ /dev/null
@@ -1,388 +0,0 @@
-/***************************************************************************/
-/* */
-/* ttinterp.h */
-/* */
-/* TrueType bytecode interpreter (specification). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __TTINTERP_H__
-#define __TTINTERP_H__
-
-#include <ft2build.h>
-#include "ttobjs.h"
-
-
-FT_BEGIN_HEADER
-
-
- /*************************************************************************/
- /* */
- /* Rounding mode constants. */
- /* */
-#define TT_Round_Off 5
-#define TT_Round_To_Half_Grid 0
-#define TT_Round_To_Grid 1
-#define TT_Round_To_Double_Grid 2
-#define TT_Round_Up_To_Grid 4
-#define TT_Round_Down_To_Grid 3
-#define TT_Round_Super 6
-#define TT_Round_Super_45 7
-
-
- /*************************************************************************/
- /* */
- /* Function types used by the interpreter, depending on various modes */
- /* (e.g. the rounding mode, whether to render a vertical or horizontal */
- /* line etc). */
- /* */
- /*************************************************************************/
-
- /* Rounding function */
- typedef FT_F26Dot6
- (*TT_Round_Func)( TT_ExecContext exc,
- FT_F26Dot6 distance,
- FT_F26Dot6 compensation );
-
- /* Point displacement along the freedom vector routine */
- typedef void
- (*TT_Move_Func)( TT_ExecContext exc,
- TT_GlyphZone zone,
- FT_UShort point,
- FT_F26Dot6 distance );
-
- /* Distance projection along one of the projection vectors */
- typedef FT_F26Dot6
- (*TT_Project_Func)( TT_ExecContext exc,
- FT_Pos dx,
- FT_Pos dy );
-
- /* getting current ppem. Take care of non-square pixels if necessary */
- typedef FT_Long
- (*TT_Cur_Ppem_Func)( TT_ExecContext exc );
-
- /* reading a cvt value. Take care of non-square pixels if necessary */
- typedef FT_F26Dot6
- (*TT_Get_CVT_Func)( TT_ExecContext exc,
- FT_ULong idx );
-
- /* setting or moving a cvt value. Take care of non-square pixels */
- /* if necessary */
- typedef void
- (*TT_Set_CVT_Func)( TT_ExecContext exc,
- FT_ULong idx,
- FT_F26Dot6 value );
-
-
- /*************************************************************************/
- /* */
- /* This structure defines a call record, used to manage function calls. */
- /* */
- typedef struct TT_CallRec_
- {
- FT_Int Caller_Range;
- FT_Long Caller_IP;
- FT_Long Cur_Count;
-
- TT_DefRecord *Def; /* either FDEF or IDEF */
-
- } TT_CallRec, *TT_CallStack;
-
-
-#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
-
- /*************************************************************************/
- /* */
- /* These structures define rules used to tweak subpixel hinting for */
- /* various fonts. "", 0, "", NULL value indicates to match any value. */
- /* */
-
-#define SPH_MAX_NAME_SIZE 32
-#define SPH_MAX_CLASS_MEMBERS 100
-
- typedef struct SPH_TweakRule_
- {
- const char family[SPH_MAX_NAME_SIZE];
- const FT_UInt ppem;
- const char style[SPH_MAX_NAME_SIZE];
- const FT_ULong glyph;
-
- } SPH_TweakRule;
-
-
- typedef struct SPH_ScaleRule_
- {
- const char family[SPH_MAX_NAME_SIZE];
- const FT_UInt ppem;
- const char style[SPH_MAX_NAME_SIZE];
- const FT_ULong glyph;
- const FT_ULong scale;
-
- } SPH_ScaleRule;
-
-
- typedef struct SPH_Font_Class_
- {
- const char name[SPH_MAX_NAME_SIZE];
- const char member[SPH_MAX_CLASS_MEMBERS][SPH_MAX_NAME_SIZE];
-
- } SPH_Font_Class;
-
-#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */
-
-
- /*************************************************************************/
- /* */
- /* The main structure for the interpreter which collects all necessary */
- /* variables and states. */
- /* */
- typedef struct TT_ExecContextRec_
- {
- TT_Face face;
- TT_Size size;
- FT_Memory memory;
-
- /* instructions state */
-
- FT_Error error; /* last execution error */
-
- FT_Long top; /* top of exec. stack */
-
- FT_Long stackSize; /* size of exec. stack */
- FT_Long* stack; /* current exec. stack */
-
- FT_Long args;
- FT_Long new_top; /* new top after exec. */
-
- TT_GlyphZoneRec zp0, /* zone records */
- zp1,
- zp2,
- pts,
- twilight;
-
- FT_Size_Metrics metrics;
- TT_Size_Metrics tt_metrics; /* size metrics */
-
- TT_GraphicsState GS; /* current graphics state */
-
- FT_Int curRange; /* current code range number */
- FT_Byte* code; /* current code range */
- FT_Long IP; /* current instruction pointer */
- FT_Long codeSize; /* size of current range */
-
- FT_Byte opcode; /* current opcode */
- FT_Int length; /* length of current opcode */
-
- FT_Bool step_ins; /* true if the interpreter must */
- /* increment IP after ins. exec */
- FT_ULong cvtSize;
- FT_Long* cvt;
-
- FT_UInt glyphSize; /* glyph instructions buffer size */
- FT_Byte* glyphIns; /* glyph instructions buffer */
-
- FT_UInt numFDefs; /* number of function defs */
- FT_UInt maxFDefs; /* maximum number of function defs */
- TT_DefArray FDefs; /* table of FDefs entries */
-
- FT_UInt numIDefs; /* number of instruction defs */
- FT_UInt maxIDefs; /* maximum number of ins defs */
- TT_DefArray IDefs; /* table of IDefs entries */
-
- FT_UInt maxFunc; /* maximum function index */
- FT_UInt maxIns; /* maximum instruction index */
-
- FT_Int callTop, /* top of call stack during execution */
- callSize; /* size of call stack */
- TT_CallStack callStack; /* call stack */
-
- FT_UShort maxPoints; /* capacity of this context's `pts' */
- FT_Short maxContours; /* record, expressed in points and */
- /* contours. */
-
- TT_CodeRangeTable codeRangeTable; /* table of valid code ranges */
- /* useful for the debugger */
-
- FT_UShort storeSize; /* size of current storage */
- FT_Long* storage; /* storage area */
-
- FT_F26Dot6 period; /* values used for the */
- FT_F26Dot6 phase; /* `SuperRounding' */
- FT_F26Dot6 threshold;
-
- FT_Bool instruction_trap; /* If `True', the interpreter will */
- /* exit after each instruction */
-
- TT_GraphicsState default_GS; /* graphics state resulting from */
- /* the prep program */
- FT_Bool is_composite; /* true if the glyph is composite */
- FT_Bool pedantic_hinting; /* true if pedantic interpretation */
-
- /* latest interpreter additions */
-
- FT_Long F_dot_P; /* dot product of freedom and projection */
- /* vectors */
- TT_Round_Func func_round; /* current rounding function */
-
- TT_Project_Func func_project, /* current projection function */
- func_dualproj, /* current dual proj. function */
- func_freeProj; /* current freedom proj. func */
-
- TT_Move_Func func_move; /* current point move function */
- TT_Move_Func func_move_orig; /* move original position function */
-
- TT_Cur_Ppem_Func func_cur_ppem; /* get current proj. ppem value */
-
- TT_Get_CVT_Func func_read_cvt; /* read a cvt entry */
- TT_Set_CVT_Func func_write_cvt; /* write a cvt entry (in pixels) */
- TT_Set_CVT_Func func_move_cvt; /* incr a cvt entry (in pixels) */
-
- FT_Bool grayscale; /* are we hinting for grayscale? */
-
-#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
- TT_Round_Func func_round_sphn; /* subpixel rounding function */
-
- FT_Bool subpixel_hinting; /* Using subpixel hinting? */
- FT_Bool ignore_x_mode; /* Standard rendering mode for */
- /* subpixel hinting. On if gray */
- /* or subpixel hinting is on. */
-
- /* The following 6 aren't fully implemented but here for MS rasterizer */
- /* compatibility. */
- FT_Bool compatible_widths; /* compatible widths? */
- FT_Bool symmetrical_smoothing; /* symmetrical_smoothing? */
- FT_Bool bgr; /* bgr instead of rgb? */
- FT_Bool vertical_lcd; /* long side of LCD subpixel */
- /* rectangles is horizontal */
- FT_Bool subpixel_positioned; /* subpixel positioned */
- /* (DirectWrite ClearType)? */
- FT_Bool gray_cleartype; /* ClearType hinting but */
- /* grayscale rendering */
-
- FT_Int rasterizer_version; /* MS rasterizer version */
-
- FT_Bool iup_called; /* IUP called for glyph? */
-
- FT_ULong sph_tweak_flags; /* flags to control */
- /* hint tweaks */
-
- FT_ULong sph_in_func_flags; /* flags to indicate if in */
- /* special functions */
-
-#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */
-
- } TT_ExecContextRec;
-
-
- extern const TT_GraphicsState tt_default_graphics_state;
-
-
-#ifdef TT_USE_BYTECODE_INTERPRETER
- FT_LOCAL( void )
- TT_Goto_CodeRange( TT_ExecContext exec,
- FT_Int range,
- FT_Long IP );
-
- FT_LOCAL( void )
- TT_Set_CodeRange( TT_ExecContext exec,
- FT_Int range,
- void* base,
- FT_Long length );
-
- FT_LOCAL( void )
- TT_Clear_CodeRange( TT_ExecContext exec,
- FT_Int range );
-
-
- FT_LOCAL( FT_Error )
- Update_Max( FT_Memory memory,
- FT_ULong* size,
- FT_ULong multiplier,
- void* _pbuff,
- FT_ULong new_max );
-#endif /* TT_USE_BYTECODE_INTERPRETER */
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_New_Context */
- /* */
- /* <Description> */
- /* Queries the face context for a given font. Note that there is */
- /* now a _single_ execution context in the TrueType driver which is */
- /* shared among faces. */
- /* */
- /* <Input> */
- /* face :: A handle to the source face object. */
- /* */
- /* <Return> */
- /* A handle to the execution context. Initialized for `face'. */
- /* */
- /* <Note> */
- /* Only the glyph loader and debugger should call this function. */
- /* (And right now only the glyph loader uses it.) */
- /* */
- FT_EXPORT( TT_ExecContext )
- TT_New_Context( TT_Driver driver );
-
-
-#ifdef TT_USE_BYTECODE_INTERPRETER
- FT_LOCAL( void )
- TT_Done_Context( TT_ExecContext exec );
-
- FT_LOCAL( FT_Error )
- TT_Load_Context( TT_ExecContext exec,
- TT_Face face,
- TT_Size size );
-
- FT_LOCAL( void )
- TT_Save_Context( TT_ExecContext exec,
- TT_Size ins );
-
- FT_LOCAL( FT_Error )
- TT_Run_Context( TT_ExecContext exec );
-#endif /* TT_USE_BYTECODE_INTERPRETER */
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_RunIns */
- /* */
- /* <Description> */
- /* Executes one or more instruction in the execution context. This */
- /* is the main function of the TrueType opcode interpreter. */
- /* */
- /* <Input> */
- /* exec :: A handle to the target execution context. */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. */
- /* */
- /* <Note> */
- /* Only the object manager and debugger should call this function. */
- /* */
- /* This function is publicly exported because it is directly */
- /* invoked by the TrueType debugger. */
- /* */
- FT_EXPORT( FT_Error )
- TT_RunIns( TT_ExecContext exec );
-
-
-FT_END_HEADER
-
-#endif /* __TTINTERP_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/truetype/ttobjs.c b/chromium/third_party/pdfium/third_party/freetype/src/truetype/ttobjs.c
deleted file mode 100644
index 6060d6f5d1e..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/truetype/ttobjs.c
+++ /dev/null
@@ -1,1359 +0,0 @@
-/***************************************************************************/
-/* */
-/* ttobjs.c */
-/* */
-/* Objects manager (body). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_TRUETYPE_TAGS_H
-#include FT_INTERNAL_SFNT_H
-#include FT_TRUETYPE_DRIVER_H
-
-#include "ttgload.h"
-#include "ttpload.h"
-
-#include "tterrors.h"
-
-#ifdef TT_USE_BYTECODE_INTERPRETER
-#include "ttinterp.h"
-#endif
-
-#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
-#include FT_TRUETYPE_UNPATENTED_H
-#endif
-
-#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
-#include "ttgxvar.h"
-#endif
-
- /*************************************************************************/
- /* */
- /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
- /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
- /* messages during execution. */
- /* */
-#undef FT_COMPONENT
-#define FT_COMPONENT trace_ttobjs
-
-
-#ifdef TT_USE_BYTECODE_INTERPRETER
-
- /*************************************************************************/
- /* */
- /* GLYPH ZONE FUNCTIONS */
- /* */
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* tt_glyphzone_done */
- /* */
- /* <Description> */
- /* Deallocate a glyph zone. */
- /* */
- /* <Input> */
- /* zone :: A pointer to the target glyph zone. */
- /* */
- FT_LOCAL_DEF( void )
- tt_glyphzone_done( TT_GlyphZone zone )
- {
- FT_Memory memory = zone->memory;
-
-
- if ( memory )
- {
- FT_FREE( zone->contours );
- FT_FREE( zone->tags );
- FT_FREE( zone->cur );
- FT_FREE( zone->org );
- FT_FREE( zone->orus );
-
- zone->max_points = zone->n_points = 0;
- zone->max_contours = zone->n_contours = 0;
- zone->memory = NULL;
- }
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* tt_glyphzone_new */
- /* */
- /* <Description> */
- /* Allocate a new glyph zone. */
- /* */
- /* <Input> */
- /* memory :: A handle to the current memory object. */
- /* */
- /* maxPoints :: The capacity of glyph zone in points. */
- /* */
- /* maxContours :: The capacity of glyph zone in contours. */
- /* */
- /* <Output> */
- /* zone :: A pointer to the target glyph zone record. */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. */
- /* */
- FT_LOCAL_DEF( FT_Error )
- tt_glyphzone_new( FT_Memory memory,
- FT_UShort maxPoints,
- FT_Short maxContours,
- TT_GlyphZone zone )
- {
- FT_Error error;
-
-
- FT_MEM_ZERO( zone, sizeof ( *zone ) );
- zone->memory = memory;
-
- if ( FT_NEW_ARRAY( zone->org, maxPoints ) ||
- FT_NEW_ARRAY( zone->cur, maxPoints ) ||
- FT_NEW_ARRAY( zone->orus, maxPoints ) ||
- FT_NEW_ARRAY( zone->tags, maxPoints ) ||
- FT_NEW_ARRAY( zone->contours, maxContours ) )
- {
- tt_glyphzone_done( zone );
- }
- else
- {
- zone->max_points = maxPoints;
- zone->max_contours = maxContours;
- }
-
- return error;
- }
-#endif /* TT_USE_BYTECODE_INTERPRETER */
-
-
- /* Compare the face with a list of well-known `tricky' fonts. */
- /* This list shall be expanded as we find more of them. */
-
- static FT_Bool
- tt_check_trickyness_family( FT_String* name )
- {
-
-#define TRICK_NAMES_MAX_CHARACTERS 19
-#define TRICK_NAMES_COUNT 9
-
- static const char trick_names[TRICK_NAMES_COUNT]
- [TRICK_NAMES_MAX_CHARACTERS + 1] =
- {
- "DFKaiSho-SB", /* dfkaisb.ttf */
- "DFKaiShu",
- "DFKai-SB", /* kaiu.ttf */
- "HuaTianKaiTi?", /* htkt2.ttf */
- "HuaTianSongTi?", /* htst3.ttf */
- "Ming(for ISO10646)", /* hkscsiic.ttf & iicore.ttf */
- "MingLiU", /* mingliu.ttf & mingliu.ttc */
- "PMingLiU", /* mingliu.ttc */
- "MingLi43", /* mingli.ttf */
- };
-
- int nn;
-
-
- for ( nn = 0; nn < TRICK_NAMES_COUNT; nn++ )
- if ( ft_strstr( name, trick_names[nn] ) )
- return TRUE;
-
- return FALSE;
- }
-
-
- /* XXX: This function should be in the `sfnt' module. */
-
- /* Some PDF generators clear the checksums in the TrueType header table. */
- /* For example, Quartz ContextPDF clears all entries, or Bullzip PDF */
- /* Printer clears the entries for subsetted subtables. We thus have to */
- /* recalculate the checksums where necessary. */
-
- static FT_UInt32
- tt_synth_sfnt_checksum( FT_Stream stream,
- FT_ULong length )
- {
- FT_Error error;
- FT_UInt32 checksum = 0;
- FT_UInt i;
-
-
- if ( FT_FRAME_ENTER( length ) )
- return 0;
-
- for ( ; length > 3; length -= 4 )
- checksum += (FT_UInt32)FT_GET_ULONG();
-
- for ( i = 3; length > 0; length--, i-- )
- checksum += (FT_UInt32)FT_GET_BYTE() << ( i * 8 );
-
- FT_FRAME_EXIT();
-
- return checksum;
- }
-
-
- /* XXX: This function should be in the `sfnt' module. */
-
- static FT_ULong
- tt_get_sfnt_checksum( TT_Face face,
- FT_UShort i )
- {
-#if 0 /* if we believe the written value, use following part. */
- if ( face->dir_tables[i].CheckSum )
- return face->dir_tables[i].CheckSum;
-#endif
-
- if ( !face->goto_table )
- return 0;
-
- if ( face->goto_table( face,
- face->dir_tables[i].Tag,
- face->root.stream,
- NULL ) )
- return 0;
-
- return (FT_ULong)tt_synth_sfnt_checksum( face->root.stream,
- face->dir_tables[i].Length );
- }
-
-
- typedef struct tt_sfnt_id_rec_
- {
- FT_ULong CheckSum;
- FT_ULong Length;
-
- } tt_sfnt_id_rec;
-
-
- static FT_Bool
- tt_check_trickyness_sfnt_ids( TT_Face face )
- {
-#define TRICK_SFNT_IDS_PER_FACE 3
-#define TRICK_SFNT_IDS_NUM_FACES 17
-
- static const tt_sfnt_id_rec sfnt_id[TRICK_SFNT_IDS_NUM_FACES]
- [TRICK_SFNT_IDS_PER_FACE] = {
-
-#define TRICK_SFNT_ID_cvt 0
-#define TRICK_SFNT_ID_fpgm 1
-#define TRICK_SFNT_ID_prep 2
-
- { /* MingLiU 1995 */
- { 0x05BCF058UL, 0x000002E4UL }, /* cvt */
- { 0x28233BF1UL, 0x000087C4UL }, /* fpgm */
- { 0xA344A1EAUL, 0x000001E1UL } /* prep */
- },
- { /* MingLiU 1996- */
- { 0x05BCF058UL, 0x000002E4UL }, /* cvt */
- { 0x28233BF1UL, 0x000087C4UL }, /* fpgm */
- { 0xA344A1EBUL, 0x000001E1UL } /* prep */
- },
- { /* DFKaiShu */
- { 0x11E5EAD4UL, 0x00000350UL }, /* cvt */
- { 0x5A30CA3BUL, 0x00009063UL }, /* fpgm */
- { 0x13A42602UL, 0x0000007EUL } /* prep */
- },
- { /* HuaTianKaiTi */
- { 0xFFFBFFFCUL, 0x00000008UL }, /* cvt */
- { 0x9C9E48B8UL, 0x0000BEA2UL }, /* fpgm */
- { 0x70020112UL, 0x00000008UL } /* prep */
- },
- { /* HuaTianSongTi */
- { 0xFFFBFFFCUL, 0x00000008UL }, /* cvt */
- { 0x0A5A0483UL, 0x00017C39UL }, /* fpgm */
- { 0x70020112UL, 0x00000008UL } /* prep */
- },
- { /* NEC fadpop7.ttf */
- { 0x00000000UL, 0x00000000UL }, /* cvt */
- { 0x40C92555UL, 0x000000E5UL }, /* fpgm */
- { 0xA39B58E3UL, 0x0000117CUL } /* prep */
- },
- { /* NEC fadrei5.ttf */
- { 0x00000000UL, 0x00000000UL }, /* cvt */
- { 0x33C41652UL, 0x000000E5UL }, /* fpgm */
- { 0x26D6C52AUL, 0x00000F6AUL } /* prep */
- },
- { /* NEC fangot7.ttf */
- { 0x00000000UL, 0x00000000UL }, /* cvt */
- { 0x6DB1651DUL, 0x0000019DUL }, /* fpgm */
- { 0x6C6E4B03UL, 0x00002492UL } /* prep */
- },
- { /* NEC fangyo5.ttf */
- { 0x00000000UL, 0x00000000UL }, /* cvt */
- { 0x40C92555UL, 0x000000E5UL }, /* fpgm */
- { 0xDE51FAD0UL, 0x0000117CUL } /* prep */
- },
- { /* NEC fankyo5.ttf */
- { 0x00000000UL, 0x00000000UL }, /* cvt */
- { 0x85E47664UL, 0x000000E5UL }, /* fpgm */
- { 0xA6C62831UL, 0x00001CAAUL } /* prep */
- },
- { /* NEC fanrgo5.ttf */
- { 0x00000000UL, 0x00000000UL }, /* cvt */
- { 0x2D891CFDUL, 0x0000019DUL }, /* fpgm */
- { 0xA0604633UL, 0x00001DE8UL } /* prep */
- },
- { /* NEC fangot5.ttc */
- { 0x00000000UL, 0x00000000UL }, /* cvt */
- { 0x40AA774CUL, 0x000001CBUL }, /* fpgm */
- { 0x9B5CAA96UL, 0x00001F9AUL } /* prep */
- },
- { /* NEC fanmin3.ttc */
- { 0x00000000UL, 0x00000000UL }, /* cvt */
- { 0x0D3DE9CBUL, 0x00000141UL }, /* fpgm */
- { 0xD4127766UL, 0x00002280UL } /* prep */
- },
- { /* NEC FA-Gothic, 1996 */
- { 0x00000000UL, 0x00000000UL }, /* cvt */
- { 0x4A692698UL, 0x000001F0UL }, /* fpgm */
- { 0x340D4346UL, 0x00001FCAUL } /* prep */
- },
- { /* NEC FA-Minchou, 1996 */
- { 0x00000000UL, 0x00000000UL }, /* cvt */
- { 0xCD34C604UL, 0x00000166UL }, /* fpgm */
- { 0x6CF31046UL, 0x000022B0UL } /* prep */
- },
- { /* NEC FA-RoundGothicB, 1996 */
- { 0x00000000UL, 0x00000000UL }, /* cvt */
- { 0x5DA75315UL, 0x0000019DUL }, /* fpgm */
- { 0x40745A5FUL, 0x000022E0UL } /* prep */
- },
- { /* NEC FA-RoundGothicM, 1996 */
- { 0x00000000UL, 0x00000000UL }, /* cvt */
- { 0xF055FC48UL, 0x000001C2UL }, /* fpgm */
- { 0x3900DED3UL, 0x00001E18UL } /* prep */
- }
- };
-
- FT_ULong checksum;
- int num_matched_ids[TRICK_SFNT_IDS_NUM_FACES];
- FT_Bool has_cvt, has_fpgm, has_prep;
- FT_UShort i;
- int j, k;
-
-
- FT_MEM_SET( num_matched_ids, 0,
- sizeof ( int ) * TRICK_SFNT_IDS_NUM_FACES );
- has_cvt = FALSE;
- has_fpgm = FALSE;
- has_prep = FALSE;
-
- for ( i = 0; i < face->num_tables; i++ )
- {
- checksum = 0;
-
- switch( face->dir_tables[i].Tag )
- {
- case TTAG_cvt:
- k = TRICK_SFNT_ID_cvt;
- has_cvt = TRUE;
- break;
-
- case TTAG_fpgm:
- k = TRICK_SFNT_ID_fpgm;
- has_fpgm = TRUE;
- break;
-
- case TTAG_prep:
- k = TRICK_SFNT_ID_prep;
- has_prep = TRUE;
- break;
-
- default:
- continue;
- }
-
- for ( j = 0; j < TRICK_SFNT_IDS_NUM_FACES; j++ )
- if ( face->dir_tables[i].Length == sfnt_id[j][k].Length )
- {
- if ( !checksum )
- checksum = tt_get_sfnt_checksum( face, i );
-
- if ( sfnt_id[j][k].CheckSum == checksum )
- num_matched_ids[j]++;
-
- if ( num_matched_ids[j] == TRICK_SFNT_IDS_PER_FACE )
- return TRUE;
- }
- }
-
- for ( j = 0; j < TRICK_SFNT_IDS_NUM_FACES; j++ )
- {
- if ( !has_cvt && !sfnt_id[j][TRICK_SFNT_ID_cvt].Length )
- num_matched_ids[j] ++;
- if ( !has_fpgm && !sfnt_id[j][TRICK_SFNT_ID_fpgm].Length )
- num_matched_ids[j] ++;
- if ( !has_prep && !sfnt_id[j][TRICK_SFNT_ID_prep].Length )
- num_matched_ids[j] ++;
- if ( num_matched_ids[j] == TRICK_SFNT_IDS_PER_FACE )
- return TRUE;
- }
-
- return FALSE;
- }
-
-
- static FT_Bool
- tt_check_trickyness( FT_Face face )
- {
- if ( !face )
- return FALSE;
-
- /* For first, check the face name for quick check. */
- if ( face->family_name &&
- tt_check_trickyness_family( face->family_name ) )
- return TRUE;
-
- /* Type42 fonts may lack `name' tables, we thus try to identify */
- /* tricky fonts by checking the checksums of Type42-persistent */
- /* sfnt tables (`cvt', `fpgm', and `prep'). */
- if ( tt_check_trickyness_sfnt_ids( (TT_Face)face ) )
- return TRUE;
-
- return FALSE;
- }
-
-
- /* Check whether `.notdef' is the only glyph in the `loca' table. */
- static FT_Bool
- tt_check_single_notdef( FT_Face ttface )
- {
- FT_Bool result = FALSE;
-
- TT_Face face = (TT_Face)ttface;
- FT_UInt asize;
- FT_ULong i;
- FT_ULong glyph_index = 0;
- FT_UInt count = 0;
-
-
- for( i = 0; i < face->num_locations; i++ )
- {
- tt_face_get_location( face, i, &asize );
- if ( asize > 0 )
- {
- count += 1;
- if ( count > 1 )
- break;
- glyph_index = i;
- }
- }
-
- /* Only have a single outline. */
- if ( count == 1 )
- {
- if ( glyph_index == 0 )
- result = TRUE;
- else
- {
- /* FIXME: Need to test glyphname == .notdef ? */
- FT_Error error;
- char buf[8];
-
-
- error = FT_Get_Glyph_Name( ttface, glyph_index, buf, 8 );
- if ( !error &&
- buf[0] == '.' && !ft_strncmp( buf, ".notdef", 8 ) )
- result = TRUE;
- }
- }
-
- return result;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* tt_face_init */
- /* */
- /* <Description> */
- /* Initialize a given TrueType face object. */
- /* */
- /* <Input> */
- /* stream :: The source font stream. */
- /* */
- /* face_index :: The index of the TrueType font, if we are opening a */
- /* collection, in bits 0-15. The numbered instance */
- /* index~+~1 of a GX (sub)font, if applicable, in bits */
- /* 16-30. */
- /* */
- /* num_params :: Number of additional generic parameters. Ignored. */
- /* */
- /* params :: Additional generic parameters. Ignored. */
- /* */
- /* <InOut> */
- /* face :: The newly built face object. */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. */
- /* */
- FT_LOCAL_DEF( FT_Error )
- tt_face_init( FT_Stream stream,
- FT_Face ttface, /* TT_Face */
- FT_Int face_index,
- FT_Int num_params,
- FT_Parameter* params )
- {
- FT_Error error;
- FT_Library library;
- SFNT_Service sfnt;
- TT_Face face = (TT_Face)ttface;
-
-
- FT_TRACE2(( "TTF driver\n" ));
-
- library = ttface->driver->root.library;
-
- sfnt = (SFNT_Service)FT_Get_Module_Interface( library, "sfnt" );
- if ( !sfnt )
- {
- FT_ERROR(( "tt_face_init: cannot access `sfnt' module\n" ));
- error = FT_THROW( Missing_Module );
- goto Exit;
- }
-
- /* create input stream from resource */
- if ( FT_STREAM_SEEK( 0 ) )
- goto Exit;
-
- /* check that we have a valid TrueType file */
- error = sfnt->init_face( stream, face, face_index, num_params, params );
-
- /* Stream may have changed. */
- stream = face->root.stream;
-
- if ( error )
- goto Exit;
-
- /* We must also be able to accept Mac/GX fonts, as well as OT ones. */
- /* The 0x00020000 tag is completely undocumented; some fonts from */
- /* Arphic made for Chinese Windows 3.1 have this. */
- if ( face->format_tag != 0x00010000L && /* MS fonts */
- face->format_tag != 0x00020000L && /* CJK fonts for Win 3.1 */
- face->format_tag != TTAG_true ) /* Mac fonts */
- {
- FT_TRACE2(( " not a TTF font\n" ));
- goto Bad_Format;
- }
-
-#ifdef TT_USE_BYTECODE_INTERPRETER
- ttface->face_flags |= FT_FACE_FLAG_HINTER;
-#endif
-
- /* If we are performing a simple font format check, exit immediately. */
- if ( face_index < 0 )
- return FT_Err_Ok;
-
- /* Load font directory */
- error = sfnt->load_face( stream, face, face_index, num_params, params );
- if ( error )
- goto Exit;
-
- if ( tt_check_trickyness( ttface ) )
- ttface->face_flags |= FT_FACE_FLAG_TRICKY;
-
- error = tt_face_load_hdmx( face, stream );
- if ( error )
- goto Exit;
-
- if ( FT_IS_SCALABLE( ttface ) )
- {
-
-#ifdef FT_CONFIG_OPTION_INCREMENTAL
-
- if ( !ttface->internal->incremental_interface )
- error = tt_face_load_loca( face, stream );
- if ( !error )
- error = tt_face_load_cvt( face, stream );
- if ( !error )
- error = tt_face_load_fpgm( face, stream );
- if ( !error )
- error = tt_face_load_prep( face, stream );
-
- /* Check the scalable flag based on `loca'. */
- if ( !ttface->internal->incremental_interface &&
- ttface->num_fixed_sizes &&
- face->glyph_locations &&
- tt_check_single_notdef( ttface ) )
- {
- FT_TRACE5(( "tt_face_init:"
- " Only the `.notdef' glyph has an outline.\n"
- " "
- " Resetting scalable flag to FALSE.\n" ));
-
- ttface->face_flags &= ~FT_FACE_FLAG_SCALABLE;
- }
-
-#else /* !FT_CONFIG_OPTION_INCREMENTAL */
-
- if ( !error )
- error = tt_face_load_loca( face, stream );
- if ( !error )
- error = tt_face_load_cvt( face, stream );
- if ( !error )
- error = tt_face_load_fpgm( face, stream );
- if ( !error )
- error = tt_face_load_prep( face, stream );
-
- /* Check the scalable flag based on `loca'. */
- if ( ttface->num_fixed_sizes &&
- face->glyph_locations &&
- tt_check_single_notdef( ttface ) )
- {
- FT_TRACE5(( "tt_face_init:"
- " Only the `.notdef' glyph has an outline.\n"
- " "
- " Resetting scalable flag to FALSE.\n" ));
-
- ttface->face_flags &= ~FT_FACE_FLAG_SCALABLE;
- }
-
-#endif /* !FT_CONFIG_OPTION_INCREMENTAL */
-
- }
-
-#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
-
- {
- FT_Int instance_index = face_index >> 16;
-
-
- if ( FT_HAS_MULTIPLE_MASTERS( ttface ) &&
- instance_index > 0 )
- {
- error = TT_Get_MM_Var( face, NULL );
- if ( error )
- goto Exit;
-
- if ( face->blend->mmvar->namedstyle )
- {
- FT_Memory memory = ttface->memory;
-
- FT_Var_Named_Style* named_style;
- FT_String* style_name;
-
-
- /* in `face_index', the instance index starts with value 1 */
- named_style = face->blend->mmvar->namedstyle + instance_index - 1;
- error = sfnt->get_name( face,
- (FT_UShort)named_style->strid,
- &style_name );
- if ( error )
- goto Exit;
-
- /* set style name; if already set, replace it */
- if ( face->root.style_name )
- FT_FREE( face->root.style_name );
- face->root.style_name = style_name;
-
- /* finally, select the named instance */
- error = TT_Set_Var_Design( face,
- face->blend->mmvar->num_axis,
- named_style->coords );
- if ( error )
- goto Exit;
- }
- }
- }
-
-#endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */
-
-#if defined( TT_CONFIG_OPTION_UNPATENTED_HINTING ) && \
- !defined( TT_CONFIG_OPTION_BYTECODE_INTERPRETER )
-
- {
- FT_Bool unpatented_hinting;
- int i;
-
-
- /* Determine whether unpatented hinting is to be used for this face. */
- unpatented_hinting = FT_BOOL
- ( library->debug_hooks[FT_DEBUG_HOOK_UNPATENTED_HINTING] != NULL );
-
- for ( i = 0; i < num_params && !face->unpatented_hinting; i++ )
- if ( params[i].tag == FT_PARAM_TAG_UNPATENTED_HINTING )
- unpatented_hinting = TRUE;
-
- if ( !unpatented_hinting )
- ttface->internal->ignore_unpatented_hinter = TRUE;
- }
-
-#endif /* TT_CONFIG_OPTION_UNPATENTED_HINTING &&
- !TT_CONFIG_OPTION_BYTECODE_INTERPRETER */
-
- /* initialize standard glyph loading routines */
- TT_Init_Glyph_Loading( face );
-
- Exit:
- return error;
-
- Bad_Format:
- error = FT_THROW( Unknown_File_Format );
- goto Exit;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* tt_face_done */
- /* */
- /* <Description> */
- /* Finalize a given face object. */
- /* */
- /* <Input> */
- /* face :: A pointer to the face object to destroy. */
- /* */
- FT_LOCAL_DEF( void )
- tt_face_done( FT_Face ttface ) /* TT_Face */
- {
- TT_Face face = (TT_Face)ttface;
- FT_Memory memory;
- FT_Stream stream;
- SFNT_Service sfnt;
-
-
- if ( !face )
- return;
-
- memory = ttface->memory;
- stream = ttface->stream;
- sfnt = (SFNT_Service)face->sfnt;
-
- /* for `extended TrueType formats' (i.e. compressed versions) */
- if ( face->extra.finalizer )
- face->extra.finalizer( face->extra.data );
-
- if ( sfnt )
- sfnt->done_face( face );
-
- /* freeing the locations table */
- tt_face_done_loca( face );
-
- tt_face_free_hdmx( face );
-
- /* freeing the CVT */
- FT_FREE( face->cvt );
- face->cvt_size = 0;
-
- /* freeing the programs */
- FT_FRAME_RELEASE( face->font_program );
- FT_FRAME_RELEASE( face->cvt_program );
- face->font_program_size = 0;
- face->cvt_program_size = 0;
-
-#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
- tt_done_blend( memory, face->blend );
- face->blend = NULL;
-#endif
- }
-
-
- /*************************************************************************/
- /* */
- /* SIZE FUNCTIONS */
- /* */
- /*************************************************************************/
-
-#ifdef TT_USE_BYTECODE_INTERPRETER
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* tt_size_run_fpgm */
- /* */
- /* <Description> */
- /* Run the font program. */
- /* */
- /* <Input> */
- /* size :: A handle to the size object. */
- /* */
- /* pedantic :: Set if bytecode execution should be pedantic. */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. */
- /* */
- FT_LOCAL_DEF( FT_Error )
- tt_size_run_fpgm( TT_Size size,
- FT_Bool pedantic )
- {
- TT_Face face = (TT_Face)size->root.face;
- TT_ExecContext exec;
- FT_Error error;
-
-
- exec = size->context;
-
- error = TT_Load_Context( exec, face, size );
- if ( error )
- return error;
-
- exec->callTop = 0;
- exec->top = 0;
-
- exec->period = 64;
- exec->phase = 0;
- exec->threshold = 0;
-
- exec->instruction_trap = FALSE;
- exec->F_dot_P = 0x4000L;
-
- exec->pedantic_hinting = pedantic;
-
- {
- FT_Size_Metrics* metrics = &exec->metrics;
- TT_Size_Metrics* tt_metrics = &exec->tt_metrics;
-
-
- metrics->x_ppem = 0;
- metrics->y_ppem = 0;
- metrics->x_scale = 0;
- metrics->y_scale = 0;
-
- tt_metrics->ppem = 0;
- tt_metrics->scale = 0;
- tt_metrics->ratio = 0x10000L;
- }
-
- /* allow font program execution */
- TT_Set_CodeRange( exec,
- tt_coderange_font,
- face->font_program,
- (FT_Long)face->font_program_size );
-
- /* disable CVT and glyph programs coderange */
- TT_Clear_CodeRange( exec, tt_coderange_cvt );
- TT_Clear_CodeRange( exec, tt_coderange_glyph );
-
- if ( face->font_program_size > 0 )
- {
- TT_Goto_CodeRange( exec, tt_coderange_font, 0 );
-
- FT_TRACE4(( "Executing `fpgm' table.\n" ));
- error = face->interpreter( exec );
- }
- else
- error = FT_Err_Ok;
-
- size->bytecode_ready = error;
-
- if ( !error )
- TT_Save_Context( exec, size );
-
- return error;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* tt_size_run_prep */
- /* */
- /* <Description> */
- /* Run the control value program. */
- /* */
- /* <Input> */
- /* size :: A handle to the size object. */
- /* */
- /* pedantic :: Set if bytecode execution should be pedantic. */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. */
- /* */
- FT_LOCAL_DEF( FT_Error )
- tt_size_run_prep( TT_Size size,
- FT_Bool pedantic )
- {
- TT_Face face = (TT_Face)size->root.face;
- TT_ExecContext exec;
- FT_Error error;
-
-
- exec = size->context;
-
- error = TT_Load_Context( exec, face, size );
- if ( error )
- return error;
-
- exec->callTop = 0;
- exec->top = 0;
-
- exec->instruction_trap = FALSE;
-
- exec->pedantic_hinting = pedantic;
-
- TT_Set_CodeRange( exec,
- tt_coderange_cvt,
- face->cvt_program,
- (FT_Long)face->cvt_program_size );
-
- TT_Clear_CodeRange( exec, tt_coderange_glyph );
-
- if ( face->cvt_program_size > 0 )
- {
- TT_Goto_CodeRange( exec, tt_coderange_cvt, 0 );
-
- FT_TRACE4(( "Executing `prep' table.\n" ));
-
- error = face->interpreter( exec );
- }
- else
- error = FT_Err_Ok;
-
- size->cvt_ready = error;
-
- /* UNDOCUMENTED! The MS rasterizer doesn't allow the following */
- /* graphics state variables to be modified by the CVT program. */
-
- exec->GS.dualVector.x = 0x4000;
- exec->GS.dualVector.y = 0;
- exec->GS.projVector.x = 0x4000;
- exec->GS.projVector.y = 0x0;
- exec->GS.freeVector.x = 0x4000;
- exec->GS.freeVector.y = 0x0;
-
- exec->GS.rp0 = 0;
- exec->GS.rp1 = 0;
- exec->GS.rp2 = 0;
-
- exec->GS.gep0 = 1;
- exec->GS.gep1 = 1;
- exec->GS.gep2 = 1;
-
- exec->GS.loop = 1;
-
- /* save as default graphics state */
- size->GS = exec->GS;
-
- TT_Save_Context( exec, size );
-
- return error;
- }
-
-
- static void
- tt_size_done_bytecode( FT_Size ftsize )
- {
- TT_Size size = (TT_Size)ftsize;
- TT_Face face = (TT_Face)ftsize->face;
- FT_Memory memory = face->root.memory;
-
- if ( size->context )
- {
- TT_Done_Context( size->context );
- size->context = NULL;
- }
-
- FT_FREE( size->cvt );
- size->cvt_size = 0;
-
- /* free storage area */
- FT_FREE( size->storage );
- size->storage_size = 0;
-
- /* twilight zone */
- tt_glyphzone_done( &size->twilight );
-
- FT_FREE( size->function_defs );
- FT_FREE( size->instruction_defs );
-
- size->num_function_defs = 0;
- size->max_function_defs = 0;
- size->num_instruction_defs = 0;
- size->max_instruction_defs = 0;
-
- size->max_func = 0;
- size->max_ins = 0;
-
- size->bytecode_ready = -1;
- size->cvt_ready = -1;
- }
-
-
- /* Initialize bytecode-related fields in the size object. */
- /* We do this only if bytecode interpretation is really needed. */
- static FT_Error
- tt_size_init_bytecode( FT_Size ftsize,
- FT_Bool pedantic )
- {
- FT_Error error;
- TT_Size size = (TT_Size)ftsize;
- TT_Face face = (TT_Face)ftsize->face;
- FT_Memory memory = face->root.memory;
-
- FT_UShort n_twilight;
- TT_MaxProfile* maxp = &face->max_profile;
-
-
- /* clean up bytecode related data */
- FT_FREE( size->function_defs );
- FT_FREE( size->instruction_defs );
- FT_FREE( size->cvt );
- FT_FREE( size->storage );
-
- if ( size->context )
- TT_Done_Context( size->context );
- tt_glyphzone_done( &size->twilight );
-
- size->bytecode_ready = -1;
- size->cvt_ready = -1;
-
- size->context = TT_New_Context( (TT_Driver)face->root.driver );
-
- size->max_function_defs = maxp->maxFunctionDefs;
- size->max_instruction_defs = maxp->maxInstructionDefs;
-
- size->num_function_defs = 0;
- size->num_instruction_defs = 0;
-
- size->max_func = 0;
- size->max_ins = 0;
-
- size->cvt_size = face->cvt_size;
- size->storage_size = maxp->maxStorage;
-
- /* Set default metrics */
- {
- TT_Size_Metrics* metrics = &size->ttmetrics;
-
-
- metrics->rotated = FALSE;
- metrics->stretched = FALSE;
-
- /* set default engine compensation */
- metrics->compensations[0] = 0; /* gray */
- metrics->compensations[1] = 0; /* black */
- metrics->compensations[2] = 0; /* white */
- metrics->compensations[3] = 0; /* reserved */
- }
-
- /* allocate function defs, instruction defs, cvt, and storage area */
- if ( FT_NEW_ARRAY( size->function_defs, size->max_function_defs ) ||
- FT_NEW_ARRAY( size->instruction_defs, size->max_instruction_defs ) ||
- FT_NEW_ARRAY( size->cvt, size->cvt_size ) ||
- FT_NEW_ARRAY( size->storage, size->storage_size ) )
- goto Exit;
-
- /* reserve twilight zone */
- n_twilight = maxp->maxTwilightPoints;
-
- /* there are 4 phantom points (do we need this?) */
- n_twilight += 4;
-
- error = tt_glyphzone_new( memory, n_twilight, 0, &size->twilight );
- if ( error )
- goto Exit;
-
- size->twilight.n_points = n_twilight;
-
- size->GS = tt_default_graphics_state;
-
- /* set `face->interpreter' according to the debug hook present */
- {
- FT_Library library = face->root.driver->root.library;
-
-
- face->interpreter = (TT_Interpreter)
- library->debug_hooks[FT_DEBUG_HOOK_TRUETYPE];
- if ( !face->interpreter )
- face->interpreter = (TT_Interpreter)TT_RunIns;
- }
-
- /* Fine, now run the font program! */
- error = tt_size_run_fpgm( size, pedantic );
-
- Exit:
- if ( error )
- tt_size_done_bytecode( ftsize );
-
- return error;
- }
-
-
- FT_LOCAL_DEF( FT_Error )
- tt_size_ready_bytecode( TT_Size size,
- FT_Bool pedantic )
- {
- FT_Error error = FT_Err_Ok;
-
-
- if ( size->bytecode_ready < 0 )
- error = tt_size_init_bytecode( (FT_Size)size, pedantic );
-
- if ( error || size->bytecode_ready )
- goto Exit;
-
- /* rescale CVT when needed */
- if ( size->cvt_ready < 0 )
- {
- FT_UInt i;
- TT_Face face = (TT_Face)size->root.face;
-
-
- /* Scale the cvt values to the new ppem. */
- /* We use by default the y ppem to scale the CVT. */
- for ( i = 0; i < size->cvt_size; i++ )
- size->cvt[i] = FT_MulFix( face->cvt[i], size->ttmetrics.scale );
-
- /* all twilight points are originally zero */
- for ( i = 0; i < (FT_UInt)size->twilight.n_points; i++ )
- {
- size->twilight.org[i].x = 0;
- size->twilight.org[i].y = 0;
- size->twilight.cur[i].x = 0;
- size->twilight.cur[i].y = 0;
- }
-
- /* clear storage area */
- for ( i = 0; i < (FT_UInt)size->storage_size; i++ )
- size->storage[i] = 0;
-
- size->GS = tt_default_graphics_state;
-
- error = tt_size_run_prep( size, pedantic );
- }
-
- Exit:
- return error;
- }
-
-#endif /* TT_USE_BYTECODE_INTERPRETER */
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* tt_size_init */
- /* */
- /* <Description> */
- /* Initialize a new TrueType size object. */
- /* */
- /* <InOut> */
- /* size :: A handle to the size object. */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. */
- /* */
- FT_LOCAL_DEF( FT_Error )
- tt_size_init( FT_Size ttsize ) /* TT_Size */
- {
- TT_Size size = (TT_Size)ttsize;
- FT_Error error = FT_Err_Ok;
-
-
-#ifdef TT_USE_BYTECODE_INTERPRETER
- size->bytecode_ready = -1;
- size->cvt_ready = -1;
-#endif
-
- size->ttmetrics.valid = FALSE;
- size->strike_index = 0xFFFFFFFFUL;
-
- return error;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* tt_size_done */
- /* */
- /* <Description> */
- /* The TrueType size object finalizer. */
- /* */
- /* <Input> */
- /* size :: A handle to the target size object. */
- /* */
- FT_LOCAL_DEF( void )
- tt_size_done( FT_Size ttsize ) /* TT_Size */
- {
- TT_Size size = (TT_Size)ttsize;
-
-
-#ifdef TT_USE_BYTECODE_INTERPRETER
- tt_size_done_bytecode( ttsize );
-#endif
-
- size->ttmetrics.valid = FALSE;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* tt_size_reset */
- /* */
- /* <Description> */
- /* Reset a TrueType size when resolutions and character dimensions */
- /* have been changed. */
- /* */
- /* <Input> */
- /* size :: A handle to the target size object. */
- /* */
- FT_LOCAL_DEF( FT_Error )
- tt_size_reset( TT_Size size )
- {
- TT_Face face;
- FT_Error error = FT_Err_Ok;
- FT_Size_Metrics* metrics;
-
-
- size->ttmetrics.valid = FALSE;
-
- face = (TT_Face)size->root.face;
-
- metrics = &size->metrics;
-
- /* copy the result from base layer */
- *metrics = size->root.metrics;
-
- if ( metrics->x_ppem < 1 || metrics->y_ppem < 1 )
- return FT_THROW( Invalid_PPem );
-
- /* This bit flag, if set, indicates that the ppems must be */
- /* rounded to integers. Nearly all TrueType fonts have this bit */
- /* set, as hinting won't work really well otherwise. */
- /* */
- if ( face->header.Flags & 8 )
- {
- metrics->x_scale = FT_DivFix( metrics->x_ppem << 6,
- face->root.units_per_EM );
- metrics->y_scale = FT_DivFix( metrics->y_ppem << 6,
- face->root.units_per_EM );
-
- metrics->ascender =
- FT_PIX_ROUND( FT_MulFix( face->root.ascender, metrics->y_scale ) );
- metrics->descender =
- FT_PIX_ROUND( FT_MulFix( face->root.descender, metrics->y_scale ) );
- metrics->height =
- FT_PIX_ROUND( FT_MulFix( face->root.height, metrics->y_scale ) );
- metrics->max_advance =
- FT_PIX_ROUND( FT_MulFix( face->root.max_advance_width,
- metrics->x_scale ) );
- }
-
- /* compute new transformation */
- if ( metrics->x_ppem >= metrics->y_ppem )
- {
- size->ttmetrics.scale = metrics->x_scale;
- size->ttmetrics.ppem = metrics->x_ppem;
- size->ttmetrics.x_ratio = 0x10000L;
- size->ttmetrics.y_ratio = FT_DivFix( metrics->y_ppem,
- metrics->x_ppem );
- }
- else
- {
- size->ttmetrics.scale = metrics->y_scale;
- size->ttmetrics.ppem = metrics->y_ppem;
- size->ttmetrics.x_ratio = FT_DivFix( metrics->x_ppem,
- metrics->y_ppem );
- size->ttmetrics.y_ratio = 0x10000L;
- }
-
-#ifdef TT_USE_BYTECODE_INTERPRETER
- size->cvt_ready = -1;
-#endif /* TT_USE_BYTECODE_INTERPRETER */
-
- if ( !error )
- size->ttmetrics.valid = TRUE;
-
- return error;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* tt_driver_init */
- /* */
- /* <Description> */
- /* Initialize a given TrueType driver object. */
- /* */
- /* <Input> */
- /* driver :: A handle to the target driver object. */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. */
- /* */
- FT_LOCAL_DEF( FT_Error )
- tt_driver_init( FT_Module ttdriver ) /* TT_Driver */
- {
-
-#ifdef TT_USE_BYTECODE_INTERPRETER
-
- TT_Driver driver = (TT_Driver)ttdriver;
-
-#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
- driver->interpreter_version = TT_INTERPRETER_VERSION_38;
-#else
- driver->interpreter_version = TT_INTERPRETER_VERSION_35;
-#endif
-
-#else /* !TT_USE_BYTECODE_INTERPRETER */
-
- FT_UNUSED( ttdriver );
-
-#endif /* !TT_USE_BYTECODE_INTERPRETER */
-
- return FT_Err_Ok;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* tt_driver_done */
- /* */
- /* <Description> */
- /* Finalize a given TrueType driver. */
- /* */
- /* <Input> */
- /* driver :: A handle to the target TrueType driver. */
- /* */
- FT_LOCAL_DEF( void )
- tt_driver_done( FT_Module ttdriver ) /* TT_Driver */
- {
- FT_UNUSED( ttdriver );
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* tt_slot_init */
- /* */
- /* <Description> */
- /* Initialize a new slot object. */
- /* */
- /* <InOut> */
- /* slot :: A handle to the slot object. */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. */
- /* */
- FT_LOCAL_DEF( FT_Error )
- tt_slot_init( FT_GlyphSlot slot )
- {
- return FT_GlyphLoader_CreateExtra( slot->internal->loader );
- }
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/truetype/ttobjs.h b/chromium/third_party/pdfium/third_party/freetype/src/truetype/ttobjs.h
deleted file mode 100644
index 9396089a991..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/truetype/ttobjs.h
+++ /dev/null
@@ -1,425 +0,0 @@
-/***************************************************************************/
-/* */
-/* ttobjs.h */
-/* */
-/* Objects manager (specification). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __TTOBJS_H__
-#define __TTOBJS_H__
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_TRUETYPE_TYPES_H
-
-
-FT_BEGIN_HEADER
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* TT_Driver */
- /* */
- /* <Description> */
- /* A handle to a TrueType driver object. */
- /* */
- typedef struct TT_DriverRec_* TT_Driver;
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* TT_GlyphSlot */
- /* */
- /* <Description> */
- /* A handle to a TrueType glyph slot object. */
- /* */
- /* <Note> */
- /* This is a direct typedef of FT_GlyphSlot, as there is nothing */
- /* specific about the TrueType glyph slot. */
- /* */
- typedef FT_GlyphSlot TT_GlyphSlot;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* TT_GraphicsState */
- /* */
- /* <Description> */
- /* The TrueType graphics state used during bytecode interpretation. */
- /* */
- typedef struct TT_GraphicsState_
- {
- FT_UShort rp0;
- FT_UShort rp1;
- FT_UShort rp2;
-
- FT_UnitVector dualVector;
- FT_UnitVector projVector;
- FT_UnitVector freeVector;
-
-#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
- FT_Bool both_x_axis;
-#endif
-
- FT_Long loop;
- FT_F26Dot6 minimum_distance;
- FT_Int round_state;
-
- FT_Bool auto_flip;
- FT_F26Dot6 control_value_cutin;
- FT_F26Dot6 single_width_cutin;
- FT_F26Dot6 single_width_value;
- FT_UShort delta_base;
- FT_UShort delta_shift;
-
- FT_Byte instruct_control;
- /* According to Greg Hitchcock from Microsoft, the `scan_control' */
- /* variable as documented in the TrueType specification is a 32-bit */
- /* integer; the high-word part holds the SCANTYPE value, the low-word */
- /* part the SCANCTRL value. We separate it into two fields. */
- FT_Bool scan_control;
- FT_Int scan_type;
-
- FT_UShort gep0;
- FT_UShort gep1;
- FT_UShort gep2;
-
- } TT_GraphicsState;
-
-
-#ifdef TT_USE_BYTECODE_INTERPRETER
-
- FT_LOCAL( void )
- tt_glyphzone_done( TT_GlyphZone zone );
-
- FT_LOCAL( FT_Error )
- tt_glyphzone_new( FT_Memory memory,
- FT_UShort maxPoints,
- FT_Short maxContours,
- TT_GlyphZone zone );
-
-#endif /* TT_USE_BYTECODE_INTERPRETER */
-
-
-
- /*************************************************************************/
- /* */
- /* EXECUTION SUBTABLES */
- /* */
- /* These sub-tables relate to instruction execution. */
- /* */
- /*************************************************************************/
-
-
-#define TT_MAX_CODE_RANGES 3
-
-
- /*************************************************************************/
- /* */
- /* There can only be 3 active code ranges at once: */
- /* - the Font Program */
- /* - the CVT Program */
- /* - a glyph's instructions set */
- /* */
- typedef enum TT_CodeRange_Tag_
- {
- tt_coderange_none = 0,
- tt_coderange_font,
- tt_coderange_cvt,
- tt_coderange_glyph
-
- } TT_CodeRange_Tag;
-
-
- typedef struct TT_CodeRange_
- {
- FT_Byte* base;
- FT_Long size;
-
- } TT_CodeRange;
-
- typedef TT_CodeRange TT_CodeRangeTable[TT_MAX_CODE_RANGES];
-
-
- /*************************************************************************/
- /* */
- /* Defines a function/instruction definition record. */
- /* */
- typedef struct TT_DefRecord_
- {
- FT_Int range; /* in which code range is it located? */
- FT_Long start; /* where does it start? */
- FT_Long end; /* where does it end? */
- FT_UInt opc; /* function #, or instruction code */
- FT_Bool active; /* is it active? */
- FT_Bool inline_delta; /* is function that defines inline delta? */
- FT_ULong sph_fdef_flags; /* flags to identify special functions */
-
- } TT_DefRecord, *TT_DefArray;
-
-
- /*************************************************************************/
- /* */
- /* Subglyph transformation record. */
- /* */
- typedef struct TT_Transform_
- {
- FT_Fixed xx, xy; /* transformation matrix coefficients */
- FT_Fixed yx, yy;
- FT_F26Dot6 ox, oy; /* offsets */
-
- } TT_Transform;
-
-
- /*************************************************************************/
- /* */
- /* A note regarding non-squared pixels: */
- /* */
- /* (This text will probably go into some docs at some time; for now, it */
- /* is kept here to explain some definitions in the TT_Size_Metrics */
- /* record). */
- /* */
- /* The CVT is a one-dimensional array containing values that control */
- /* certain important characteristics in a font, like the height of all */
- /* capitals, all lowercase letter, default spacing or stem width/height. */
- /* */
- /* These values are found in FUnits in the font file, and must be scaled */
- /* to pixel coordinates before being used by the CVT and glyph programs. */
- /* Unfortunately, when using distinct x and y resolutions (or distinct x */
- /* and y pointsizes), there are two possible scalings. */
- /* */
- /* A first try was to implement a `lazy' scheme where all values were */
- /* scaled when first used. However, while some values are always used */
- /* in the same direction, some others are used under many different */
- /* circumstances and orientations. */
- /* */
- /* I have found a simpler way to do the same, and it even seems to work */
- /* in most of the cases: */
- /* */
- /* - All CVT values are scaled to the maximum ppem size. */
- /* */
- /* - When performing a read or write in the CVT, a ratio factor is used */
- /* to perform adequate scaling. Example: */
- /* */
- /* x_ppem = 14 */
- /* y_ppem = 10 */
- /* */
- /* We choose ppem = x_ppem = 14 as the CVT scaling size. All cvt */
- /* entries are scaled to it. */
- /* */
- /* x_ratio = 1.0 */
- /* y_ratio = y_ppem/ppem (< 1.0) */
- /* */
- /* We compute the current ratio like: */
- /* */
- /* - If projVector is horizontal, */
- /* ratio = x_ratio = 1.0 */
- /* */
- /* - if projVector is vertical, */
- /* ratio = y_ratio */
- /* */
- /* - else, */
- /* ratio = sqrt( (proj.x * x_ratio) ^ 2 + (proj.y * y_ratio) ^ 2 ) */
- /* */
- /* Reading a cvt value returns */
- /* ratio * cvt[index] */
- /* */
- /* Writing a cvt value in pixels: */
- /* cvt[index] / ratio */
- /* */
- /* The current ppem is simply */
- /* ratio * ppem */
- /* */
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* Metrics used by the TrueType size and context objects. */
- /* */
- typedef struct TT_Size_Metrics_
- {
- /* for non-square pixels */
- FT_Long x_ratio;
- FT_Long y_ratio;
-
- FT_UShort ppem; /* maximum ppem size */
- FT_Long ratio; /* current ratio */
- FT_Fixed scale;
-
- FT_F26Dot6 compensations[4]; /* device-specific compensations */
-
- FT_Bool valid;
-
- FT_Bool rotated; /* `is the glyph rotated?'-flag */
- FT_Bool stretched; /* `is the glyph stretched?'-flag */
-
- } TT_Size_Metrics;
-
-
- /*************************************************************************/
- /* */
- /* TrueType size class. */
- /* */
- typedef struct TT_SizeRec_
- {
- FT_SizeRec root;
-
- /* we have our own copy of metrics so that we can modify */
- /* it without affecting auto-hinting (when used) */
- FT_Size_Metrics metrics;
-
- TT_Size_Metrics ttmetrics;
-
- FT_ULong strike_index; /* 0xFFFFFFFF to indicate invalid */
-
-#ifdef TT_USE_BYTECODE_INTERPRETER
-
- FT_UInt num_function_defs; /* number of function definitions */
- FT_UInt max_function_defs;
- TT_DefArray function_defs; /* table of function definitions */
-
- FT_UInt num_instruction_defs; /* number of ins. definitions */
- FT_UInt max_instruction_defs;
- TT_DefArray instruction_defs; /* table of ins. definitions */
-
- FT_UInt max_func;
- FT_UInt max_ins;
-
- TT_CodeRangeTable codeRangeTable;
-
- TT_GraphicsState GS;
-
- FT_ULong cvt_size; /* the scaled control value table */
- FT_Long* cvt;
-
- FT_UShort storage_size; /* The storage area is now part of */
- FT_Long* storage; /* the instance */
-
- TT_GlyphZoneRec twilight; /* The instance's twilight zone */
-
- TT_ExecContext context;
-
- /* if negative, `fpgm' (resp. `prep'), wasn't executed yet; */
- /* otherwise it is the returned error code */
- FT_Error bytecode_ready;
- FT_Error cvt_ready;
-
-#endif /* TT_USE_BYTECODE_INTERPRETER */
-
- } TT_SizeRec;
-
-
- /*************************************************************************/
- /* */
- /* TrueType driver class. */
- /* */
- typedef struct TT_DriverRec_
- {
- FT_DriverRec root;
-
- TT_GlyphZoneRec zone; /* glyph loader points zone */
-
- FT_UInt interpreter_version;
-
- } TT_DriverRec;
-
-
- /* Note: All of the functions below (except tt_size_reset()) are used */
- /* as function pointers in a FT_Driver_ClassRec. Therefore their */
- /* parameters are of types FT_Face, FT_Size, etc., rather than TT_Face, */
- /* TT_Size, etc., so that the compiler can confirm that the types and */
- /* number of parameters are correct. In all cases the FT_xxx types are */
- /* cast to their TT_xxx counterparts inside the functions since FreeType */
- /* will always use the TT driver to create them. */
-
-
- /*************************************************************************/
- /* */
- /* Face functions */
- /* */
- FT_LOCAL( FT_Error )
- tt_face_init( FT_Stream stream,
- FT_Face ttface, /* TT_Face */
- FT_Int face_index,
- FT_Int num_params,
- FT_Parameter* params );
-
- FT_LOCAL( void )
- tt_face_done( FT_Face ttface ); /* TT_Face */
-
-
- /*************************************************************************/
- /* */
- /* Size functions */
- /* */
- FT_LOCAL( FT_Error )
- tt_size_init( FT_Size ttsize ); /* TT_Size */
-
- FT_LOCAL( void )
- tt_size_done( FT_Size ttsize ); /* TT_Size */
-
-#ifdef TT_USE_BYTECODE_INTERPRETER
-
- FT_LOCAL( FT_Error )
- tt_size_run_fpgm( TT_Size size,
- FT_Bool pedantic );
-
- FT_LOCAL( FT_Error )
- tt_size_run_prep( TT_Size size,
- FT_Bool pedantic );
-
- FT_LOCAL( FT_Error )
- tt_size_ready_bytecode( TT_Size size,
- FT_Bool pedantic );
-
-#endif /* TT_USE_BYTECODE_INTERPRETER */
-
- FT_LOCAL( FT_Error )
- tt_size_reset( TT_Size size );
-
-
- /*************************************************************************/
- /* */
- /* Driver functions */
- /* */
- FT_LOCAL( FT_Error )
- tt_driver_init( FT_Module ttdriver ); /* TT_Driver */
-
- FT_LOCAL( void )
- tt_driver_done( FT_Module ttdriver ); /* TT_Driver */
-
-
- /*************************************************************************/
- /* */
- /* Slot functions */
- /* */
- FT_LOCAL( FT_Error )
- tt_slot_init( FT_GlyphSlot slot );
-
-
- /* auxiliary */
-#define IS_HINTED( flags ) ( ( flags & FT_LOAD_NO_HINTING ) == 0 )
-
-
-FT_END_HEADER
-
-#endif /* __TTOBJS_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/truetype/ttpic.c b/chromium/third_party/pdfium/third_party/freetype/src/truetype/ttpic.c
deleted file mode 100644
index 242a6b76ddb..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/truetype/ttpic.c
+++ /dev/null
@@ -1,101 +0,0 @@
-/***************************************************************************/
-/* */
-/* ttpic.c */
-/* */
-/* The FreeType position independent code services for truetype module. */
-/* */
-/* Copyright 2009-2015 by */
-/* Oran Agra and Mickey Gabel. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_INTERNAL_OBJECTS_H
-#include "ttpic.h"
-#include "tterrors.h"
-
-
-#ifdef FT_CONFIG_OPTION_PIC
-
- /* forward declaration of PIC init functions from ttdriver.c */
- FT_Error
- FT_Create_Class_tt_services( FT_Library library,
- FT_ServiceDescRec** output_class );
- void
- FT_Destroy_Class_tt_services( FT_Library library,
- FT_ServiceDescRec* clazz );
- void
- FT_Init_Class_tt_service_gx_multi_masters(
- FT_Service_MultiMastersRec* sv_mm );
- void
- FT_Init_Class_tt_service_truetype_glyf(
- FT_Service_TTGlyfRec* sv_ttglyf );
-
-
- void
- tt_driver_class_pic_free( FT_Library library )
- {
- FT_PIC_Container* pic_container = &library->pic_container;
- FT_Memory memory = library->memory;
-
-
- if ( pic_container->truetype )
- {
- TTModulePIC* container = (TTModulePIC*)pic_container->truetype;
-
-
- if ( container->tt_services )
- FT_Destroy_Class_tt_services( library, container->tt_services );
- container->tt_services = NULL;
- FT_FREE( container );
- pic_container->truetype = NULL;
- }
- }
-
-
- FT_Error
- tt_driver_class_pic_init( FT_Library library )
- {
- FT_PIC_Container* pic_container = &library->pic_container;
- FT_Error error = FT_Err_Ok;
- TTModulePIC* container = NULL;
- FT_Memory memory = library->memory;
-
-
- /* allocate pointer, clear and set global container pointer */
- if ( FT_ALLOC( container, sizeof ( *container ) ) )
- return error;
- FT_MEM_SET( container, 0, sizeof ( *container ) );
- pic_container->truetype = container;
-
- /* initialize pointer table - this is how the module usually */
- /* expects this data */
- error = FT_Create_Class_tt_services( library,
- &container->tt_services );
- if ( error )
- goto Exit;
-#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
- FT_Init_Class_tt_service_gx_multi_masters(
- &container->tt_service_gx_multi_masters );
-#endif
- FT_Init_Class_tt_service_truetype_glyf(
- &container->tt_service_truetype_glyf );
-
- Exit:
- if ( error )
- tt_driver_class_pic_free( library );
- return error;
- }
-
-#endif /* FT_CONFIG_OPTION_PIC */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/truetype/ttpic.h b/chromium/third_party/pdfium/third_party/freetype/src/truetype/ttpic.h
deleted file mode 100644
index 076ae56efa8..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/truetype/ttpic.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/***************************************************************************/
-/* */
-/* ttpic.h */
-/* */
-/* The FreeType position independent code services for truetype module. */
-/* */
-/* Copyright 2009-2015 by */
-/* Oran Agra and Mickey Gabel. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __TTPIC_H__
-#define __TTPIC_H__
-
-
-#include FT_INTERNAL_PIC_H
-
-
-#ifndef FT_CONFIG_OPTION_PIC
-
-#define TT_SERVICES_GET tt_services
-#define TT_SERVICE_GX_MULTI_MASTERS_GET tt_service_gx_multi_masters
-#define TT_SERVICE_TRUETYPE_GLYF_GET tt_service_truetype_glyf
-#define TT_SERVICE_PROPERTIES_GET tt_service_properties
-
-#else /* FT_CONFIG_OPTION_PIC */
-
-#include FT_MULTIPLE_MASTERS_H
-#include FT_SERVICE_MULTIPLE_MASTERS_H
-#include FT_SERVICE_TRUETYPE_GLYF_H
-#include FT_SERVICE_PROPERTIES_H
-
-
-FT_BEGIN_HEADER
-
- typedef struct TTModulePIC_
- {
- FT_ServiceDescRec* tt_services;
-#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
- FT_Service_MultiMastersRec tt_service_gx_multi_masters;
-#endif
- FT_Service_TTGlyfRec tt_service_truetype_glyf;
- FT_Service_PropertiesRec tt_service_properties;
-
- } TTModulePIC;
-
-
-#define GET_PIC( lib ) \
- ( (TTModulePIC*)((lib)->pic_container.truetype) )
-#define TT_SERVICES_GET \
- ( GET_PIC( library )->tt_services )
-#define TT_SERVICE_GX_MULTI_MASTERS_GET \
- ( GET_PIC( library )->tt_service_gx_multi_masters )
-#define TT_SERVICE_TRUETYPE_GLYF_GET \
- ( GET_PIC( library )->tt_service_truetype_glyf )
-#define TT_SERVICE_PROPERTIES_GET \
- ( GET_PIC( library )->tt_service_properties )
-
-
- /* see ttpic.c for the implementation */
- void
- tt_driver_class_pic_free( FT_Library library );
-
- FT_Error
- tt_driver_class_pic_init( FT_Library library );
-
-FT_END_HEADER
-
-#endif /* FT_CONFIG_OPTION_PIC */
-
- /* */
-
-#endif /* __TTPIC_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/truetype/ttpload.c b/chromium/third_party/pdfium/third_party/freetype/src/truetype/ttpload.c
deleted file mode 100644
index 4647c938aea..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/truetype/ttpload.c
+++ /dev/null
@@ -1,609 +0,0 @@
-/***************************************************************************/
-/* */
-/* ttpload.c */
-/* */
-/* TrueType-specific tables loader (body). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_STREAM_H
-#include FT_TRUETYPE_TAGS_H
-
-#include "ttpload.h"
-
-#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
-#include "ttgxvar.h"
-#endif
-
-#include "tterrors.h"
-
-
- /*************************************************************************/
- /* */
- /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
- /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
- /* messages during execution. */
- /* */
-#undef FT_COMPONENT
-#define FT_COMPONENT trace_ttpload
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* tt_face_load_loca */
- /* */
- /* <Description> */
- /* Load the locations table. */
- /* */
- /* <InOut> */
- /* face :: A handle to the target face object. */
- /* */
- /* <Input> */
- /* stream :: The input stream. */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. */
- /* */
- FT_LOCAL_DEF( FT_Error )
- tt_face_load_loca( TT_Face face,
- FT_Stream stream )
- {
- FT_Error error;
- FT_ULong table_len;
- FT_Int shift;
-
-
- /* we need the size of the `glyf' table for malformed `loca' tables */
- error = face->goto_table( face, TTAG_glyf, stream, &face->glyf_len );
-
- /* it is possible that a font doesn't have a glyf table at all */
- /* or its size is zero */
- if ( FT_ERR_EQ( error, Table_Missing ) )
- face->glyf_len = 0;
- else if ( error )
- goto Exit;
-
- FT_TRACE2(( "Locations " ));
- error = face->goto_table( face, TTAG_loca, stream, &table_len );
- if ( error )
- {
- error = FT_THROW( Locations_Missing );
- goto Exit;
- }
-
- if ( face->header.Index_To_Loc_Format != 0 )
- {
- shift = 2;
-
- if ( table_len >= 0x40000L )
- {
- FT_TRACE2(( "table too large\n" ));
- error = FT_THROW( Invalid_Table );
- goto Exit;
- }
- face->num_locations = table_len >> shift;
- }
- else
- {
- shift = 1;
-
- if ( table_len >= 0x20000L )
- {
- FT_TRACE2(( "table too large\n" ));
- error = FT_THROW( Invalid_Table );
- goto Exit;
- }
- face->num_locations = table_len >> shift;
- }
-
- if ( face->num_locations != (FT_ULong)face->root.num_glyphs + 1 )
- {
- FT_TRACE2(( "glyph count mismatch! loca: %d, maxp: %d\n",
- face->num_locations - 1, face->root.num_glyphs ));
-
- /* we only handle the case where `maxp' gives a larger value */
- if ( face->num_locations <= (FT_ULong)face->root.num_glyphs )
- {
- FT_ULong new_loca_len =
- ( (FT_ULong)face->root.num_glyphs + 1 ) << shift;
-
- TT_Table entry = face->dir_tables;
- TT_Table limit = entry + face->num_tables;
-
- FT_Long pos = (FT_Long)FT_STREAM_POS();
- FT_Long dist = 0x7FFFFFFFL;
-
-
- /* compute the distance to next table in font file */
- for ( ; entry < limit; entry++ )
- {
- FT_Long diff = (FT_Long)entry->Offset - pos;
-
-
- if ( diff > 0 && diff < dist )
- dist = diff;
- }
-
- if ( entry == limit )
- {
- /* `loca' is the last table */
- dist = (FT_Long)stream->size - pos;
- }
-
- if ( new_loca_len <= (FT_ULong)dist )
- {
- face->num_locations = (FT_ULong)face->root.num_glyphs + 1;
- table_len = new_loca_len;
-
- FT_TRACE2(( "adjusting num_locations to %d\n",
- face->num_locations ));
- }
- else
- {
- face->root.num_glyphs = face->num_locations
- ? (FT_Long)face->num_locations - 1 : 0;
-
- FT_TRACE2(( "adjusting num_glyphs to %d\n",
- face->root.num_glyphs ));
- }
- }
- }
-
- /*
- * Extract the frame. We don't need to decompress it since
- * we are able to parse it directly.
- */
- if ( FT_FRAME_EXTRACT( table_len, face->glyph_locations ) )
- goto Exit;
-
- FT_TRACE2(( "loaded\n" ));
-
- Exit:
- return error;
- }
-
-
- FT_LOCAL_DEF( FT_ULong )
- tt_face_get_location( TT_Face face,
- FT_UInt gindex,
- FT_UInt *asize )
- {
- FT_ULong pos1, pos2;
- FT_Byte* p;
- FT_Byte* p_limit;
-
-
- pos1 = pos2 = 0;
-
- if ( gindex < face->num_locations )
- {
- if ( face->header.Index_To_Loc_Format != 0 )
- {
- p = face->glyph_locations + gindex * 4;
- p_limit = face->glyph_locations + face->num_locations * 4;
-
- pos1 = FT_NEXT_ULONG( p );
- pos2 = pos1;
-
- if ( p + 4 <= p_limit )
- pos2 = FT_NEXT_ULONG( p );
- }
- else
- {
- p = face->glyph_locations + gindex * 2;
- p_limit = face->glyph_locations + face->num_locations * 2;
-
- pos1 = FT_NEXT_USHORT( p );
- pos2 = pos1;
-
- if ( p + 2 <= p_limit )
- pos2 = FT_NEXT_USHORT( p );
-
- pos1 <<= 1;
- pos2 <<= 1;
- }
- }
-
- /* Check broken location data */
- if ( pos1 > face->glyf_len )
- {
- FT_TRACE1(( "tt_face_get_location:"
- " too large offset=0x%08lx found for gid=0x%04lx,"
- " exceeding the end of glyf table (0x%08lx)\n",
- pos1, gindex, face->glyf_len ));
- *asize = 0;
- return 0;
- }
-
- if ( pos2 > face->glyf_len )
- {
- FT_TRACE1(( "tt_face_get_location:"
- " too large offset=0x%08lx found for gid=0x%04lx,"
- " truncate at the end of glyf table (0x%08lx)\n",
- pos2, gindex + 1, face->glyf_len ));
- pos2 = face->glyf_len;
- }
-
- /* The `loca' table must be ordered; it refers to the length of */
- /* an entry as the difference between the current and the next */
- /* position. However, there do exist (malformed) fonts which */
- /* don't obey this rule, so we are only able to provide an */
- /* upper bound for the size. */
- /* */
- /* We get (intentionally) a wrong, non-zero result in case the */
- /* `glyf' table is missing. */
- if ( pos2 >= pos1 )
- *asize = (FT_UInt)( pos2 - pos1 );
- else
- *asize = (FT_UInt)( face->glyf_len - pos1 );
-
- return pos1;
- }
-
-
- FT_LOCAL_DEF( void )
- tt_face_done_loca( TT_Face face )
- {
- FT_Stream stream = face->root.stream;
-
-
- FT_FRAME_RELEASE( face->glyph_locations );
- face->num_locations = 0;
- }
-
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* tt_face_load_cvt */
- /* */
- /* <Description> */
- /* Load the control value table into a face object. */
- /* */
- /* <InOut> */
- /* face :: A handle to the target face object. */
- /* */
- /* <Input> */
- /* stream :: A handle to the input stream. */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. */
- /* */
- FT_LOCAL_DEF( FT_Error )
- tt_face_load_cvt( TT_Face face,
- FT_Stream stream )
- {
-#ifdef TT_USE_BYTECODE_INTERPRETER
-
- FT_Error error;
- FT_Memory memory = stream->memory;
- FT_ULong table_len;
-
-
- FT_TRACE2(( "CVT " ));
-
- error = face->goto_table( face, TTAG_cvt, stream, &table_len );
- if ( error )
- {
- FT_TRACE2(( "is missing\n" ));
-
- face->cvt_size = 0;
- face->cvt = NULL;
- error = FT_Err_Ok;
-
- goto Exit;
- }
-
- face->cvt_size = table_len / 2;
-
- if ( FT_NEW_ARRAY( face->cvt, face->cvt_size ) )
- goto Exit;
-
- if ( FT_FRAME_ENTER( face->cvt_size * 2L ) )
- goto Exit;
-
- {
- FT_Short* cur = face->cvt;
- FT_Short* limit = cur + face->cvt_size;
-
-
- for ( ; cur < limit; cur++ )
- *cur = FT_GET_SHORT();
- }
-
- FT_FRAME_EXIT();
- FT_TRACE2(( "loaded\n" ));
-
-#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
- if ( face->doblend )
- error = tt_face_vary_cvt( face, stream );
-#endif
-
- Exit:
- return error;
-
-#else /* !TT_USE_BYTECODE_INTERPRETER */
-
- FT_UNUSED( face );
- FT_UNUSED( stream );
-
- return FT_Err_Ok;
-
-#endif
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* tt_face_load_fpgm */
- /* */
- /* <Description> */
- /* Load the font program. */
- /* */
- /* <InOut> */
- /* face :: A handle to the target face object. */
- /* */
- /* <Input> */
- /* stream :: A handle to the input stream. */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. */
- /* */
- FT_LOCAL_DEF( FT_Error )
- tt_face_load_fpgm( TT_Face face,
- FT_Stream stream )
- {
-#ifdef TT_USE_BYTECODE_INTERPRETER
-
- FT_Error error;
- FT_ULong table_len;
-
-
- FT_TRACE2(( "Font program " ));
-
- /* The font program is optional */
- error = face->goto_table( face, TTAG_fpgm, stream, &table_len );
- if ( error )
- {
- face->font_program = NULL;
- face->font_program_size = 0;
- error = FT_Err_Ok;
-
- FT_TRACE2(( "is missing\n" ));
- }
- else
- {
- face->font_program_size = table_len;
- if ( FT_FRAME_EXTRACT( table_len, face->font_program ) )
- goto Exit;
-
- FT_TRACE2(( "loaded, %12d bytes\n", face->font_program_size ));
- }
-
- Exit:
- return error;
-
-#else /* !TT_USE_BYTECODE_INTERPRETER */
-
- FT_UNUSED( face );
- FT_UNUSED( stream );
-
- return FT_Err_Ok;
-
-#endif
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* tt_face_load_prep */
- /* */
- /* <Description> */
- /* Load the cvt program. */
- /* */
- /* <InOut> */
- /* face :: A handle to the target face object. */
- /* */
- /* <Input> */
- /* stream :: A handle to the input stream. */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. */
- /* */
- FT_LOCAL_DEF( FT_Error )
- tt_face_load_prep( TT_Face face,
- FT_Stream stream )
- {
-#ifdef TT_USE_BYTECODE_INTERPRETER
-
- FT_Error error;
- FT_ULong table_len;
-
-
- FT_TRACE2(( "Prep program " ));
-
- error = face->goto_table( face, TTAG_prep, stream, &table_len );
- if ( error )
- {
- face->cvt_program = NULL;
- face->cvt_program_size = 0;
- error = FT_Err_Ok;
-
- FT_TRACE2(( "is missing\n" ));
- }
- else
- {
- face->cvt_program_size = table_len;
- if ( FT_FRAME_EXTRACT( table_len, face->cvt_program ) )
- goto Exit;
-
- FT_TRACE2(( "loaded, %12d bytes\n", face->cvt_program_size ));
- }
-
- Exit:
- return error;
-
-#else /* !TT_USE_BYTECODE_INTERPRETER */
-
- FT_UNUSED( face );
- FT_UNUSED( stream );
-
- return FT_Err_Ok;
-
-#endif
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* tt_face_load_hdmx */
- /* */
- /* <Description> */
- /* Load the `hdmx' table into the face object. */
- /* */
- /* <Input> */
- /* face :: A handle to the target face object. */
- /* */
- /* stream :: A handle to the input stream. */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. */
- /* */
-
- FT_LOCAL_DEF( FT_Error )
- tt_face_load_hdmx( TT_Face face,
- FT_Stream stream )
- {
- FT_Error error;
- FT_Memory memory = stream->memory;
- FT_UInt version, nn, num_records;
- FT_ULong table_size, record_size;
- FT_Byte* p;
- FT_Byte* limit;
-
-
- /* this table is optional */
- error = face->goto_table( face, TTAG_hdmx, stream, &table_size );
- if ( error || table_size < 8 )
- return FT_Err_Ok;
-
- if ( FT_FRAME_EXTRACT( table_size, face->hdmx_table ) )
- goto Exit;
-
- p = face->hdmx_table;
- limit = p + table_size;
-
- version = FT_NEXT_USHORT( p );
- num_records = FT_NEXT_USHORT( p );
- record_size = FT_NEXT_ULONG( p );
-
- /* The maximum number of bytes in an hdmx device record is the */
- /* maximum number of glyphs + 2; this is 0xFFFF + 2, thus */
- /* explaining why `record_size' is a long (which we read as */
- /* unsigned long for convenience). In practice, two bytes are */
- /* sufficient to hold the size value. */
- /* */
- /* There are at least two fonts, HANNOM-A and HANNOM-B version */
- /* 2.0 (2005), which get this wrong: The upper two bytes of */
- /* the size value are set to 0xFF instead of 0x00. We catch */
- /* and fix this. */
-
- if ( record_size >= 0xFFFF0000UL )
- record_size &= 0xFFFFU;
-
- /* The limit for `num_records' is a heuristic value. */
- if ( version != 0 ||
- num_records > 255 ||
- record_size > 0x10001L ||
- record_size < 4 )
- {
- error = FT_THROW( Invalid_File_Format );
- goto Fail;
- }
-
- if ( FT_NEW_ARRAY( face->hdmx_record_sizes, num_records ) )
- goto Fail;
-
- for ( nn = 0; nn < num_records; nn++ )
- {
- if ( p + record_size > limit )
- break;
-
- face->hdmx_record_sizes[nn] = p[0];
- p += record_size;
- }
-
- face->hdmx_record_count = nn;
- face->hdmx_table_size = table_size;
- face->hdmx_record_size = record_size;
-
- Exit:
- return error;
-
- Fail:
- FT_FRAME_RELEASE( face->hdmx_table );
- face->hdmx_table_size = 0;
- goto Exit;
- }
-
-
- FT_LOCAL_DEF( void )
- tt_face_free_hdmx( TT_Face face )
- {
- FT_Stream stream = face->root.stream;
- FT_Memory memory = stream->memory;
-
-
- FT_FREE( face->hdmx_record_sizes );
- FT_FRAME_RELEASE( face->hdmx_table );
- }
-
-
- /*************************************************************************/
- /* */
- /* Return the advance width table for a given pixel size if it is found */
- /* in the font's `hdmx' table (if any). */
- /* */
- FT_LOCAL_DEF( FT_Byte* )
- tt_face_get_device_metrics( TT_Face face,
- FT_UInt ppem,
- FT_UInt gindex )
- {
- FT_UInt nn;
- FT_Byte* result = NULL;
- FT_ULong record_size = face->hdmx_record_size;
- FT_Byte* record = face->hdmx_table + 8;
-
-
- for ( nn = 0; nn < face->hdmx_record_count; nn++ )
- if ( face->hdmx_record_sizes[nn] == ppem )
- {
- gindex += 2;
- if ( gindex < record_size )
- result = record + nn * record_size + gindex;
- break;
- }
-
- return result;
- }
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/truetype/ttpload.h b/chromium/third_party/pdfium/third_party/freetype/src/truetype/ttpload.h
deleted file mode 100644
index bc923698273..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/truetype/ttpload.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/***************************************************************************/
-/* */
-/* ttpload.h */
-/* */
-/* TrueType-specific tables loader (specification). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __TTPLOAD_H__
-#define __TTPLOAD_H__
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_TRUETYPE_TYPES_H
-
-
-FT_BEGIN_HEADER
-
-
- FT_LOCAL( FT_Error )
- tt_face_load_loca( TT_Face face,
- FT_Stream stream );
-
- FT_LOCAL( FT_ULong )
- tt_face_get_location( TT_Face face,
- FT_UInt gindex,
- FT_UInt *asize );
-
- FT_LOCAL( void )
- tt_face_done_loca( TT_Face face );
-
- FT_LOCAL( FT_Error )
- tt_face_load_cvt( TT_Face face,
- FT_Stream stream );
-
- FT_LOCAL( FT_Error )
- tt_face_load_fpgm( TT_Face face,
- FT_Stream stream );
-
-
- FT_LOCAL( FT_Error )
- tt_face_load_prep( TT_Face face,
- FT_Stream stream );
-
-
- FT_LOCAL( FT_Error )
- tt_face_load_hdmx( TT_Face face,
- FT_Stream stream );
-
-
- FT_LOCAL( void )
- tt_face_free_hdmx( TT_Face face );
-
-
- FT_LOCAL( FT_Byte* )
- tt_face_get_device_metrics( TT_Face face,
- FT_UInt ppem,
- FT_UInt gindex );
-
-FT_END_HEADER
-
-#endif /* __TTPLOAD_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/truetype/ttsubpix.c b/chromium/third_party/pdfium/third_party/freetype/src/truetype/ttsubpix.c
deleted file mode 100644
index 0d391e95a07..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/truetype/ttsubpix.c
+++ /dev/null
@@ -1,1011 +0,0 @@
-/***************************************************************************/
-/* */
-/* ttsubpix.c */
-/* */
-/* TrueType Subpixel Hinting. */
-/* */
-/* Copyright 2010-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_CALC_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_SFNT_H
-#include FT_TRUETYPE_TAGS_H
-#include FT_OUTLINE_H
-#include FT_TRUETYPE_DRIVER_H
-
-#include "ttsubpix.h"
-
-
-#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
-
- /*************************************************************************/
- /* */
- /* These rules affect how the TT Interpreter does hinting, with the */
- /* goal of doing subpixel hinting by (in general) ignoring x moves. */
- /* Some of these rules are fixes that go above and beyond the */
- /* stated techniques in the MS whitepaper on Cleartype, due to */
- /* artifacts in many glyphs. So, these rules make some glyphs render */
- /* better than they do in the MS rasterizer. */
- /* */
- /* "" string or 0 int/char indicates to apply to all glyphs. */
- /* "-" used as dummy placeholders, but any non-matching string works. */
- /* */
- /* Some of this could arguably be implemented in fontconfig, however: */
- /* */
- /* - Fontconfig can't set things on a glyph-by-glyph basis. */
- /* - The tweaks that happen here are very low-level, from an average */
- /* user's point of view and are best implemented in the hinter. */
- /* */
- /* The goal is to make the subpixel hinting techniques as generalized */
- /* as possible across all fonts to prevent the need for extra rules such */
- /* as these. */
- /* */
- /* The rule structure is designed so that entirely new rules can easily */
- /* be added when a new compatibility feature is discovered. */
- /* */
- /* The rule structures could also use some enhancement to handle ranges. */
- /* */
- /* ****************** WORK IN PROGRESS ******************* */
- /* */
-
- /* These are `classes' of fonts that can be grouped together and used in */
- /* rules below. A blank entry "" is required at the end of these! */
-#define FAMILY_CLASS_RULES_SIZE 7
-
- static const SPH_Font_Class FAMILY_CLASS_Rules
- [FAMILY_CLASS_RULES_SIZE] =
- {
- { "MS Legacy Fonts",
- { "Aharoni",
- "Andale Mono",
- "Andalus",
- "Angsana New",
- "AngsanaUPC",
- "Arabic Transparent",
- "Arial Black",
- "Arial Narrow",
- "Arial Unicode MS",
- "Arial",
- "Batang",
- "Browallia New",
- "BrowalliaUPC",
- "Comic Sans MS",
- "Cordia New",
- "CordiaUPC",
- "Courier New",
- "DFKai-SB",
- "David Transparent",
- "David",
- "DilleniaUPC",
- "Estrangelo Edessa",
- "EucrosiaUPC",
- "FangSong_GB2312",
- "Fixed Miriam Transparent",
- "FrankRuehl",
- "Franklin Gothic Medium",
- "FreesiaUPC",
- "Garamond",
- "Gautami",
- "Georgia",
- "Gulim",
- "Impact",
- "IrisUPC",
- "JasmineUPC",
- "KaiTi_GB2312",
- "KodchiangUPC",
- "Latha",
- "Levenim MT",
- "LilyUPC",
- "Lucida Console",
- "Lucida Sans Unicode",
- "MS Gothic",
- "MS Mincho",
- "MV Boli",
- "Mangal",
- "Marlett",
- "Microsoft Sans Serif",
- "Mingliu",
- "Miriam Fixed",
- "Miriam Transparent",
- "Miriam",
- "Narkisim",
- "Palatino Linotype",
- "Raavi",
- "Rod Transparent",
- "Rod",
- "Shruti",
- "SimHei",
- "Simplified Arabic Fixed",
- "Simplified Arabic",
- "Simsun",
- "Sylfaen",
- "Symbol",
- "Tahoma",
- "Times New Roman",
- "Traditional Arabic",
- "Trebuchet MS",
- "Tunga",
- "Verdana",
- "Webdings",
- "Wingdings",
- "",
- },
- },
- { "Core MS Legacy Fonts",
- { "Arial Black",
- "Arial Narrow",
- "Arial Unicode MS",
- "Arial",
- "Comic Sans MS",
- "Courier New",
- "Garamond",
- "Georgia",
- "Impact",
- "Lucida Console",
- "Lucida Sans Unicode",
- "Microsoft Sans Serif",
- "Palatino Linotype",
- "Tahoma",
- "Times New Roman",
- "Trebuchet MS",
- "Verdana",
- "",
- },
- },
- { "Apple Legacy Fonts",
- { "Geneva",
- "Times",
- "Monaco",
- "Century",
- "Chalkboard",
- "Lobster",
- "Century Gothic",
- "Optima",
- "Lucida Grande",
- "Gill Sans",
- "Baskerville",
- "Helvetica",
- "Helvetica Neue",
- "",
- },
- },
- { "Legacy Sans Fonts",
- { "Andale Mono",
- "Arial Unicode MS",
- "Arial",
- "Century Gothic",
- "Comic Sans MS",
- "Franklin Gothic Medium",
- "Geneva",
- "Lucida Console",
- "Lucida Grande",
- "Lucida Sans Unicode",
- "Lucida Sans Typewriter",
- "Microsoft Sans Serif",
- "Monaco",
- "Tahoma",
- "Trebuchet MS",
- "Verdana",
- "",
- },
- },
-
- { "Misc Legacy Fonts",
- { "Dark Courier", "", }, },
- { "Verdana Clones",
- { "DejaVu Sans",
- "Bitstream Vera Sans", "", }, },
- { "Verdana and Clones",
- { "DejaVu Sans",
- "Bitstream Vera Sans",
- "Verdana", "", }, },
- };
-
-
- /* Define this to force natural (i.e. not bitmap-compatible) widths. */
- /* The default leans strongly towards natural widths except for a few */
- /* legacy fonts where a selective combination produces nicer results. */
-/* #define FORCE_NATURAL_WIDTHS */
-
-
- /* Define `classes' of styles that can be grouped together and used in */
- /* rules below. A blank entry "" is required at the end of these! */
-#define STYLE_CLASS_RULES_SIZE 5
-
- static const SPH_Font_Class STYLE_CLASS_Rules
- [STYLE_CLASS_RULES_SIZE] =
- {
- { "Regular Class",
- { "Regular",
- "Book",
- "Medium",
- "Roman",
- "Normal",
- "",
- },
- },
- { "Regular/Italic Class",
- { "Regular",
- "Book",
- "Medium",
- "Italic",
- "Oblique",
- "Roman",
- "Normal",
- "",
- },
- },
- { "Bold/BoldItalic Class",
- { "Bold",
- "Bold Italic",
- "Black",
- "",
- },
- },
- { "Bold/Italic/BoldItalic Class",
- { "Bold",
- "Bold Italic",
- "Black",
- "Italic",
- "Oblique",
- "",
- },
- },
- { "Regular/Bold Class",
- { "Regular",
- "Book",
- "Medium",
- "Normal",
- "Roman",
- "Bold",
- "Black",
- "",
- },
- },
- };
-
-
- /* Force special legacy fixes for fonts. */
-#define COMPATIBILITY_MODE_RULES_SIZE 1
-
- static const SPH_TweakRule COMPATIBILITY_MODE_Rules
- [COMPATIBILITY_MODE_RULES_SIZE] =
- {
- { "Verdana Clones", 0, "", 0 },
- };
-
-
- /* Don't do subpixel (ignore_x_mode) hinting; do normal hinting. */
-#define PIXEL_HINTING_RULES_SIZE 2
-
- static const SPH_TweakRule PIXEL_HINTING_Rules
- [PIXEL_HINTING_RULES_SIZE] =
- {
- /* these characters are almost always safe */
- { "Courier New", 12, "Italic", 'z' },
- { "Courier New", 11, "Italic", 'z' },
- };
-
-
- /* Subpixel hinting ignores SHPIX rules on X. Force SHPIX for these. */
-#define DO_SHPIX_RULES_SIZE 1
-
- static const SPH_TweakRule DO_SHPIX_Rules
- [DO_SHPIX_RULES_SIZE] =
- {
- { "-", 0, "", 0 },
- };
-
-
- /* Skip Y moves that start with a point that is not on a Y pixel */
- /* boundary and don't move that point to a Y pixel boundary. */
-#define SKIP_NONPIXEL_Y_MOVES_RULES_SIZE 4
-
- static const SPH_TweakRule SKIP_NONPIXEL_Y_MOVES_Rules
- [SKIP_NONPIXEL_Y_MOVES_RULES_SIZE] =
- {
- /* fix vwxyz thinness*/
- { "Consolas", 0, "", 0 },
- /* Fix thin middle stems */
- { "Core MS Legacy Fonts", 0, "Regular", 0 },
- /* Cyrillic small letter I */
- { "Legacy Sans Fonts", 0, "", 0 },
- /* Fix artifacts with some Regular & Bold */
- { "Verdana Clones", 0, "", 0 },
- };
-
-
-#define SKIP_NONPIXEL_Y_MOVES_RULES_EXCEPTIONS_SIZE 1
-
- static const SPH_TweakRule SKIP_NONPIXEL_Y_MOVES_Rules_Exceptions
- [SKIP_NONPIXEL_Y_MOVES_RULES_EXCEPTIONS_SIZE] =
- {
- /* Fixes < and > */
- { "Courier New", 0, "Regular", 0 },
- };
-
-
- /* Skip Y moves that start with a point that is not on a Y pixel */
- /* boundary and don't move that point to a Y pixel boundary. */
-#define SKIP_NONPIXEL_Y_MOVES_DELTAP_RULES_SIZE 2
-
- static const SPH_TweakRule SKIP_NONPIXEL_Y_MOVES_DELTAP_Rules
- [SKIP_NONPIXEL_Y_MOVES_DELTAP_RULES_SIZE] =
- {
- /* Maintain thickness of diagonal in 'N' */
- { "Times New Roman", 0, "Regular/Bold Class", 'N' },
- { "Georgia", 0, "Regular/Bold Class", 'N' },
- };
-
-
- /* Skip Y moves that move a point off a Y pixel boundary. */
-#define SKIP_OFFPIXEL_Y_MOVES_RULES_SIZE 1
-
- static const SPH_TweakRule SKIP_OFFPIXEL_Y_MOVES_Rules
- [SKIP_OFFPIXEL_Y_MOVES_RULES_SIZE] =
- {
- { "-", 0, "", 0 },
- };
-
-
-#define SKIP_OFFPIXEL_Y_MOVES_RULES_EXCEPTIONS_SIZE 1
-
- static const SPH_TweakRule SKIP_OFFPIXEL_Y_MOVES_Rules_Exceptions
- [SKIP_OFFPIXEL_Y_MOVES_RULES_EXCEPTIONS_SIZE] =
- {
- { "-", 0, "", 0 },
- };
-
-
- /* Round moves that don't move a point to a Y pixel boundary. */
-#define ROUND_NONPIXEL_Y_MOVES_RULES_SIZE 2
-
- static const SPH_TweakRule ROUND_NONPIXEL_Y_MOVES_Rules
- [ROUND_NONPIXEL_Y_MOVES_RULES_SIZE] =
- {
- /* Droid font instructions don't snap Y to pixels */
- { "Droid Sans", 0, "Regular/Italic Class", 0 },
- { "Droid Sans Mono", 0, "", 0 },
- };
-
-
-#define ROUND_NONPIXEL_Y_MOVES_RULES_EXCEPTIONS_SIZE 1
-
- static const SPH_TweakRule ROUND_NONPIXEL_Y_MOVES_Rules_Exceptions
- [ROUND_NONPIXEL_Y_MOVES_RULES_EXCEPTIONS_SIZE] =
- {
- { "-", 0, "", 0 },
- };
-
-
- /* Allow a Direct_Move along X freedom vector if matched. */
-#define ALLOW_X_DMOVE_RULES_SIZE 1
-
- static const SPH_TweakRule ALLOW_X_DMOVE_Rules
- [ALLOW_X_DMOVE_RULES_SIZE] =
- {
- /* Fixes vanishing diagonal in 4 */
- { "Verdana", 0, "Regular", '4' },
- };
-
-
- /* Return MS rasterizer version 35 if matched. */
-#define RASTERIZER_35_RULES_SIZE 8
-
- static const SPH_TweakRule RASTERIZER_35_Rules
- [RASTERIZER_35_RULES_SIZE] =
- {
- /* This seems to be the only way to make these look good */
- { "Times New Roman", 0, "Regular", 'i' },
- { "Times New Roman", 0, "Regular", 'j' },
- { "Times New Roman", 0, "Regular", 'm' },
- { "Times New Roman", 0, "Regular", 'r' },
- { "Times New Roman", 0, "Regular", 'a' },
- { "Times New Roman", 0, "Regular", 'n' },
- { "Times New Roman", 0, "Regular", 'p' },
- { "Times", 0, "", 0 },
- };
-
-
- /* Don't round to the subpixel grid. Round to pixel grid. */
-#define NORMAL_ROUND_RULES_SIZE 1
-
- static const SPH_TweakRule NORMAL_ROUND_Rules
- [NORMAL_ROUND_RULES_SIZE] =
- {
- /* Fix serif thickness for certain ppems */
- /* Can probably be generalized somehow */
- { "Courier New", 0, "", 0 },
- };
-
-
- /* Skip IUP instructions if matched. */
-#define SKIP_IUP_RULES_SIZE 1
-
- static const SPH_TweakRule SKIP_IUP_Rules
- [SKIP_IUP_RULES_SIZE] =
- {
- { "Arial", 13, "Regular", 'a' },
- };
-
-
- /* Skip MIAP Twilight hack if matched. */
-#define MIAP_HACK_RULES_SIZE 1
-
- static const SPH_TweakRule MIAP_HACK_Rules
- [MIAP_HACK_RULES_SIZE] =
- {
- { "Geneva", 12, "", 0 },
- };
-
-
- /* Skip DELTAP instructions if matched. */
-#define ALWAYS_SKIP_DELTAP_RULES_SIZE 23
-
- static const SPH_TweakRule ALWAYS_SKIP_DELTAP_Rules
- [ALWAYS_SKIP_DELTAP_RULES_SIZE] =
- {
- { "Georgia", 0, "Regular", 'k' },
- /* fix various problems with e in different versions */
- { "Trebuchet MS", 14, "Regular", 'e' },
- { "Trebuchet MS", 13, "Regular", 'e' },
- { "Trebuchet MS", 15, "Regular", 'e' },
- { "Trebuchet MS", 0, "Italic", 'v' },
- { "Trebuchet MS", 0, "Italic", 'w' },
- { "Trebuchet MS", 0, "Regular", 'Y' },
- { "Arial", 11, "Regular", 's' },
- /* prevent problems with '3' and others */
- { "Verdana", 10, "Regular", 0 },
- { "Verdana", 9, "Regular", 0 },
- /* Cyrillic small letter short I */
- { "Legacy Sans Fonts", 0, "", 0x438 },
- { "Legacy Sans Fonts", 0, "", 0x439 },
- { "Arial", 10, "Regular", '6' },
- { "Arial", 0, "Bold/BoldItalic Class", 'a' },
- /* Make horizontal stems consistent with the rest */
- { "Arial", 24, "Bold", 'a' },
- { "Arial", 25, "Bold", 'a' },
- { "Arial", 24, "Bold", 's' },
- { "Arial", 25, "Bold", 's' },
- { "Arial", 34, "Bold", 's' },
- { "Arial", 35, "Bold", 's' },
- { "Arial", 36, "Bold", 's' },
- { "Arial", 25, "Regular", 's' },
- { "Arial", 26, "Regular", 's' },
- };
-
-
- /* Always do DELTAP instructions if matched. */
-#define ALWAYS_DO_DELTAP_RULES_SIZE 1
-
- static const SPH_TweakRule ALWAYS_DO_DELTAP_Rules
- [ALWAYS_DO_DELTAP_RULES_SIZE] =
- {
- { "-", 0, "", 0 },
- };
-
-
- /* Don't allow ALIGNRP after IUP. */
-#define NO_ALIGNRP_AFTER_IUP_RULES_SIZE 1
-
- static const SPH_TweakRule NO_ALIGNRP_AFTER_IUP_Rules
- [NO_ALIGNRP_AFTER_IUP_RULES_SIZE] =
- {
- /* Prevent creation of dents in outline */
- { "-", 0, "", 0 },
- };
-
-
- /* Don't allow DELTAP after IUP. */
-#define NO_DELTAP_AFTER_IUP_RULES_SIZE 1
-
- static const SPH_TweakRule NO_DELTAP_AFTER_IUP_Rules
- [NO_DELTAP_AFTER_IUP_RULES_SIZE] =
- {
- { "-", 0, "", 0 },
- };
-
-
- /* Don't allow CALL after IUP. */
-#define NO_CALL_AFTER_IUP_RULES_SIZE 1
-
- static const SPH_TweakRule NO_CALL_AFTER_IUP_Rules
- [NO_CALL_AFTER_IUP_RULES_SIZE] =
- {
- /* Prevent creation of dents in outline */
- { "-", 0, "", 0 },
- };
-
-
- /* De-embolden these glyphs slightly. */
-#define DEEMBOLDEN_RULES_SIZE 9
-
- static const SPH_TweakRule DEEMBOLDEN_Rules
- [DEEMBOLDEN_RULES_SIZE] =
- {
- { "Courier New", 0, "Bold", 'A' },
- { "Courier New", 0, "Bold", 'W' },
- { "Courier New", 0, "Bold", 'w' },
- { "Courier New", 0, "Bold", 'M' },
- { "Courier New", 0, "Bold", 'X' },
- { "Courier New", 0, "Bold", 'K' },
- { "Courier New", 0, "Bold", 'x' },
- { "Courier New", 0, "Bold", 'z' },
- { "Courier New", 0, "Bold", 'v' },
- };
-
-
- /* Embolden these glyphs slightly. */
-#define EMBOLDEN_RULES_SIZE 2
-
- static const SPH_TweakRule EMBOLDEN_Rules
- [EMBOLDEN_RULES_SIZE] =
- {
- { "Courier New", 0, "Regular", 0 },
- { "Courier New", 0, "Italic", 0 },
- };
-
-
- /* This is a CVT hack that makes thick horizontal stems on 2, 5, 7 */
- /* similar to Windows XP. */
-#define TIMES_NEW_ROMAN_HACK_RULES_SIZE 12
-
- static const SPH_TweakRule TIMES_NEW_ROMAN_HACK_Rules
- [TIMES_NEW_ROMAN_HACK_RULES_SIZE] =
- {
- { "Times New Roman", 16, "Italic", '2' },
- { "Times New Roman", 16, "Italic", '5' },
- { "Times New Roman", 16, "Italic", '7' },
- { "Times New Roman", 16, "Regular", '2' },
- { "Times New Roman", 16, "Regular", '5' },
- { "Times New Roman", 16, "Regular", '7' },
- { "Times New Roman", 17, "Italic", '2' },
- { "Times New Roman", 17, "Italic", '5' },
- { "Times New Roman", 17, "Italic", '7' },
- { "Times New Roman", 17, "Regular", '2' },
- { "Times New Roman", 17, "Regular", '5' },
- { "Times New Roman", 17, "Regular", '7' },
- };
-
-
- /* This fudges distance on 2 to get rid of the vanishing stem issue. */
- /* A real solution to this is certainly welcome. */
-#define COURIER_NEW_2_HACK_RULES_SIZE 15
-
- static const SPH_TweakRule COURIER_NEW_2_HACK_Rules
- [COURIER_NEW_2_HACK_RULES_SIZE] =
- {
- { "Courier New", 10, "Regular", '2' },
- { "Courier New", 11, "Regular", '2' },
- { "Courier New", 12, "Regular", '2' },
- { "Courier New", 13, "Regular", '2' },
- { "Courier New", 14, "Regular", '2' },
- { "Courier New", 15, "Regular", '2' },
- { "Courier New", 16, "Regular", '2' },
- { "Courier New", 17, "Regular", '2' },
- { "Courier New", 18, "Regular", '2' },
- { "Courier New", 19, "Regular", '2' },
- { "Courier New", 20, "Regular", '2' },
- { "Courier New", 21, "Regular", '2' },
- { "Courier New", 22, "Regular", '2' },
- { "Courier New", 23, "Regular", '2' },
- { "Courier New", 24, "Regular", '2' },
- };
-
-
-#ifndef FORCE_NATURAL_WIDTHS
-
- /* Use compatible widths with these glyphs. Compatible widths is always */
- /* on when doing B/W TrueType instructing, but is used selectively here, */
- /* typically on glyphs with 3 or more vertical stems. */
-#define COMPATIBLE_WIDTHS_RULES_SIZE 38
-
- static const SPH_TweakRule COMPATIBLE_WIDTHS_Rules
- [COMPATIBLE_WIDTHS_RULES_SIZE] =
- {
- { "Arial Unicode MS", 12, "Regular Class", 'm' },
- { "Arial Unicode MS", 14, "Regular Class", 'm' },
- /* Cyrillic small letter sha */
- { "Arial", 10, "Regular Class", 0x448 },
- { "Arial", 11, "Regular Class", 'm' },
- { "Arial", 12, "Regular Class", 'm' },
- /* Cyrillic small letter sha */
- { "Arial", 12, "Regular Class", 0x448 },
- { "Arial", 13, "Regular Class", 0x448 },
- { "Arial", 14, "Regular Class", 'm' },
- /* Cyrillic small letter sha */
- { "Arial", 14, "Regular Class", 0x448 },
- { "Arial", 15, "Regular Class", 0x448 },
- { "Arial", 17, "Regular Class", 'm' },
- { "DejaVu Sans", 15, "Regular Class", 0 },
- { "Microsoft Sans Serif", 11, "Regular Class", 0 },
- { "Microsoft Sans Serif", 12, "Regular Class", 0 },
- { "Segoe UI", 11, "Regular Class", 0 },
- { "Monaco", 0, "Regular Class", 0 },
- { "Segoe UI", 12, "Regular Class", 'm' },
- { "Segoe UI", 14, "Regular Class", 'm' },
- { "Tahoma", 11, "Regular Class", 0 },
- { "Times New Roman", 16, "Regular Class", 'c' },
- { "Times New Roman", 16, "Regular Class", 'm' },
- { "Times New Roman", 16, "Regular Class", 'o' },
- { "Times New Roman", 16, "Regular Class", 'w' },
- { "Trebuchet MS", 11, "Regular Class", 0 },
- { "Trebuchet MS", 12, "Regular Class", 0 },
- { "Trebuchet MS", 14, "Regular Class", 0 },
- { "Trebuchet MS", 15, "Regular Class", 0 },
- { "Ubuntu", 12, "Regular Class", 'm' },
- /* Cyrillic small letter sha */
- { "Verdana", 10, "Regular Class", 0x448 },
- { "Verdana", 11, "Regular Class", 0x448 },
- { "Verdana and Clones", 12, "Regular Class", 'i' },
- { "Verdana and Clones", 12, "Regular Class", 'j' },
- { "Verdana and Clones", 12, "Regular Class", 'l' },
- { "Verdana and Clones", 12, "Regular Class", 'm' },
- { "Verdana and Clones", 13, "Regular Class", 'i' },
- { "Verdana and Clones", 13, "Regular Class", 'j' },
- { "Verdana and Clones", 13, "Regular Class", 'l' },
- { "Verdana and Clones", 14, "Regular Class", 'm' },
- };
-
-
- /* Scaling slightly in the x-direction prior to hinting results in */
- /* more visually pleasing glyphs in certain cases. */
- /* This sometimes needs to be coordinated with compatible width rules. */
- /* A value of 1000 corresponds to a scaled value of 1.0. */
-
-#define X_SCALING_RULES_SIZE 50
-
- static const SPH_ScaleRule X_SCALING_Rules[X_SCALING_RULES_SIZE] =
- {
- { "DejaVu Sans", 12, "Regular Class", 'm', 950 },
- { "Verdana and Clones", 12, "Regular Class", 'a', 1100 },
- { "Verdana and Clones", 13, "Regular Class", 'a', 1050 },
- { "Arial", 11, "Regular Class", 'm', 975 },
- { "Arial", 12, "Regular Class", 'm', 1050 },
- /* Cyrillic small letter el */
- { "Arial", 13, "Regular Class", 0x43B, 950 },
- { "Arial", 13, "Regular Class", 'o', 950 },
- { "Arial", 13, "Regular Class", 'e', 950 },
- { "Arial", 14, "Regular Class", 'm', 950 },
- /* Cyrillic small letter el */
- { "Arial", 15, "Regular Class", 0x43B, 925 },
- { "Bitstream Vera Sans", 10, "Regular/Italic Class", 0, 1100 },
- { "Bitstream Vera Sans", 12, "Regular/Italic Class", 0, 1050 },
- { "Bitstream Vera Sans", 16, "Regular Class", 0, 1050 },
- { "Bitstream Vera Sans", 9, "Regular/Italic Class", 0, 1050 },
- { "DejaVu Sans", 12, "Regular Class", 'l', 975 },
- { "DejaVu Sans", 12, "Regular Class", 'i', 975 },
- { "DejaVu Sans", 12, "Regular Class", 'j', 975 },
- { "DejaVu Sans", 13, "Regular Class", 'l', 950 },
- { "DejaVu Sans", 13, "Regular Class", 'i', 950 },
- { "DejaVu Sans", 13, "Regular Class", 'j', 950 },
- { "DejaVu Sans", 10, "Regular/Italic Class", 0, 1100 },
- { "DejaVu Sans", 12, "Regular/Italic Class", 0, 1050 },
- { "Georgia", 10, "", 0, 1050 },
- { "Georgia", 11, "", 0, 1100 },
- { "Georgia", 12, "", 0, 1025 },
- { "Georgia", 13, "", 0, 1050 },
- { "Georgia", 16, "", 0, 1050 },
- { "Georgia", 17, "", 0, 1030 },
- { "Liberation Sans", 12, "Regular Class", 'm', 1100 },
- { "Lucida Grande", 11, "Regular Class", 'm', 1100 },
- { "Microsoft Sans Serif", 11, "Regular Class", 'm', 950 },
- { "Microsoft Sans Serif", 12, "Regular Class", 'm', 1050 },
- { "Segoe UI", 12, "Regular Class", 'H', 1050 },
- { "Segoe UI", 12, "Regular Class", 'm', 1050 },
- { "Segoe UI", 14, "Regular Class", 'm', 1050 },
- { "Tahoma", 11, "Regular Class", 'i', 975 },
- { "Tahoma", 11, "Regular Class", 'l', 975 },
- { "Tahoma", 11, "Regular Class", 'j', 900 },
- { "Tahoma", 11, "Regular Class", 'm', 918 },
- { "Verdana", 10, "Regular/Italic Class", 0, 1100 },
- { "Verdana", 12, "Regular Class", 'm', 975 },
- { "Verdana", 12, "Regular/Italic Class", 0, 1050 },
- { "Verdana", 13, "Regular/Italic Class", 'i', 950 },
- { "Verdana", 13, "Regular/Italic Class", 'j', 950 },
- { "Verdana", 13, "Regular/Italic Class", 'l', 950 },
- { "Verdana", 16, "Regular Class", 0, 1050 },
- { "Verdana", 9, "Regular/Italic Class", 0, 1050 },
- { "Times New Roman", 16, "Regular Class", 'm', 918 },
- { "Trebuchet MS", 11, "Regular Class", 'm', 800 },
- { "Trebuchet MS", 12, "Regular Class", 'm', 800 },
- };
-
-#else
-
-#define COMPATIBLE_WIDTHS_RULES_SIZE 1
-
- static const SPH_TweakRule COMPATIBLE_WIDTHS_Rules
- [COMPATIBLE_WIDTHS_RULES_SIZE] =
- {
- { "-", 0, "", 0 },
- };
-
-
-#define X_SCALING_RULES_SIZE 1
-
- static const SPH_ScaleRule X_SCALING_Rules
- [X_SCALING_RULES_SIZE] =
- {
- { "-", 0, "", 0, 1000 },
- };
-
-#endif /* FORCE_NATURAL_WIDTHS */
-
-
- static FT_Bool
- is_member_of_family_class( const FT_String* detected_font_name,
- const FT_String* rule_font_name )
- {
- FT_UInt i, j;
-
-
- /* Does font name match rule family? */
- if ( strcmp( detected_font_name, rule_font_name ) == 0 )
- return TRUE;
-
- /* Is font name a wildcard ""? */
- if ( strcmp( rule_font_name, "" ) == 0 )
- return TRUE;
-
- /* Is font name contained in a class list? */
- for ( i = 0; i < FAMILY_CLASS_RULES_SIZE; i++ )
- {
- if ( strcmp( FAMILY_CLASS_Rules[i].name, rule_font_name ) == 0 )
- {
- for ( j = 0; j < SPH_MAX_CLASS_MEMBERS; j++ )
- {
- if ( strcmp( FAMILY_CLASS_Rules[i].member[j], "" ) == 0 )
- continue;
- if ( strcmp( FAMILY_CLASS_Rules[i].member[j],
- detected_font_name ) == 0 )
- return TRUE;
- }
- }
- }
-
- return FALSE;
- }
-
-
- static FT_Bool
- is_member_of_style_class( const FT_String* detected_font_style,
- const FT_String* rule_font_style )
- {
- FT_UInt i, j;
-
-
- /* Does font style match rule style? */
- if ( strcmp( detected_font_style, rule_font_style ) == 0 )
- return TRUE;
-
- /* Is font style a wildcard ""? */
- if ( strcmp( rule_font_style, "" ) == 0 )
- return TRUE;
-
- /* Is font style contained in a class list? */
- for ( i = 0; i < STYLE_CLASS_RULES_SIZE; i++ )
- {
- if ( strcmp( STYLE_CLASS_Rules[i].name, rule_font_style ) == 0 )
- {
- for ( j = 0; j < SPH_MAX_CLASS_MEMBERS; j++ )
- {
- if ( strcmp( STYLE_CLASS_Rules[i].member[j], "" ) == 0 )
- continue;
- if ( strcmp( STYLE_CLASS_Rules[i].member[j],
- detected_font_style ) == 0 )
- return TRUE;
- }
- }
- }
-
- return FALSE;
- }
-
-
- FT_LOCAL_DEF( FT_Bool )
- sph_test_tweak( TT_Face face,
- const FT_String* family,
- FT_UInt ppem,
- const FT_String* style,
- FT_UInt glyph_index,
- const SPH_TweakRule* rule,
- FT_UInt num_rules )
- {
- FT_UInt i;
-
-
- /* rule checks may be able to be optimized further */
- for ( i = 0; i < num_rules; i++ )
- {
- if ( family &&
- ( is_member_of_family_class ( family, rule[i].family ) ) )
- if ( rule[i].ppem == 0 ||
- rule[i].ppem == ppem )
- if ( style &&
- is_member_of_style_class ( style, rule[i].style ) )
- if ( rule[i].glyph == 0 ||
- FT_Get_Char_Index( (FT_Face)face,
- rule[i].glyph ) == glyph_index )
- return TRUE;
- }
-
- return FALSE;
- }
-
-
- static FT_UInt
- scale_test_tweak( TT_Face face,
- const FT_String* family,
- FT_UInt ppem,
- const FT_String* style,
- FT_UInt glyph_index,
- const SPH_ScaleRule* rule,
- FT_UInt num_rules )
- {
- FT_UInt i;
-
-
- /* rule checks may be able to be optimized further */
- for ( i = 0; i < num_rules; i++ )
- {
- if ( family &&
- ( is_member_of_family_class ( family, rule[i].family ) ) )
- if ( rule[i].ppem == 0 ||
- rule[i].ppem == ppem )
- if ( style &&
- is_member_of_style_class( style, rule[i].style ) )
- if ( rule[i].glyph == 0 ||
- FT_Get_Char_Index( (FT_Face)face,
- rule[i].glyph ) == glyph_index )
- return rule[i].scale;
- }
-
- return 1000;
- }
-
-
- FT_LOCAL_DEF( FT_UInt )
- sph_test_tweak_x_scaling( TT_Face face,
- const FT_String* family,
- FT_UInt ppem,
- const FT_String* style,
- FT_UInt glyph_index )
- {
- return scale_test_tweak( face, family, ppem, style, glyph_index,
- X_SCALING_Rules, X_SCALING_RULES_SIZE );
- }
-
-
-#define TWEAK_RULES( x ) \
- if ( sph_test_tweak( face, family, ppem, style, glyph_index, \
- x##_Rules, x##_RULES_SIZE ) ) \
- loader->exec->sph_tweak_flags |= SPH_TWEAK_##x;
-
-#define TWEAK_RULES_EXCEPTIONS( x ) \
- if ( sph_test_tweak( face, family, ppem, style, glyph_index, \
- x##_Rules_Exceptions, x##_RULES_EXCEPTIONS_SIZE ) ) \
- loader->exec->sph_tweak_flags &= ~SPH_TWEAK_##x;
-
-
- FT_LOCAL_DEF( void )
- sph_set_tweaks( TT_Loader loader,
- FT_UInt glyph_index )
- {
- TT_Face face = loader->face;
- FT_String* family = face->root.family_name;
- FT_UInt ppem = loader->size->metrics.x_ppem;
- FT_String* style = face->root.style_name;
-
-
- /* don't apply rules if style isn't set */
- if ( !face->root.style_name )
- return;
-
-#ifdef SPH_DEBUG_MORE_VERBOSE
- printf( "%s,%d,%s,%c=%d ",
- family, ppem, style, glyph_index, glyph_index );
-#endif
-
- TWEAK_RULES( PIXEL_HINTING );
-
- if ( loader->exec->sph_tweak_flags & SPH_TWEAK_PIXEL_HINTING )
- {
- loader->exec->ignore_x_mode = FALSE;
- return;
- }
-
- TWEAK_RULES( ALLOW_X_DMOVE );
- TWEAK_RULES( ALWAYS_DO_DELTAP );
- TWEAK_RULES( ALWAYS_SKIP_DELTAP );
- TWEAK_RULES( DEEMBOLDEN );
- TWEAK_RULES( DO_SHPIX );
- TWEAK_RULES( EMBOLDEN );
- TWEAK_RULES( MIAP_HACK );
- TWEAK_RULES( NORMAL_ROUND );
- TWEAK_RULES( NO_ALIGNRP_AFTER_IUP );
- TWEAK_RULES( NO_CALL_AFTER_IUP );
- TWEAK_RULES( NO_DELTAP_AFTER_IUP );
- TWEAK_RULES( RASTERIZER_35 );
- TWEAK_RULES( SKIP_IUP );
-
- TWEAK_RULES( SKIP_OFFPIXEL_Y_MOVES );
- TWEAK_RULES_EXCEPTIONS( SKIP_OFFPIXEL_Y_MOVES );
-
- TWEAK_RULES( SKIP_NONPIXEL_Y_MOVES_DELTAP );
-
- TWEAK_RULES( SKIP_NONPIXEL_Y_MOVES );
- TWEAK_RULES_EXCEPTIONS( SKIP_NONPIXEL_Y_MOVES );
-
- TWEAK_RULES( ROUND_NONPIXEL_Y_MOVES );
- TWEAK_RULES_EXCEPTIONS( ROUND_NONPIXEL_Y_MOVES );
-
- if ( loader->exec->sph_tweak_flags & SPH_TWEAK_RASTERIZER_35 )
- {
- if ( loader->exec->rasterizer_version != TT_INTERPRETER_VERSION_35 )
- {
- loader->exec->rasterizer_version = TT_INTERPRETER_VERSION_35;
- loader->exec->size->cvt_ready = -1;
-
- tt_size_ready_bytecode(
- loader->exec->size,
- FT_BOOL( loader->load_flags & FT_LOAD_PEDANTIC ) );
- }
- else
- loader->exec->rasterizer_version = TT_INTERPRETER_VERSION_35;
- }
- else
- {
- if ( loader->exec->rasterizer_version !=
- SPH_OPTION_SET_RASTERIZER_VERSION )
- {
- loader->exec->rasterizer_version = SPH_OPTION_SET_RASTERIZER_VERSION;
- loader->exec->size->cvt_ready = -1;
-
- tt_size_ready_bytecode(
- loader->exec->size,
- FT_BOOL( loader->load_flags & FT_LOAD_PEDANTIC ) );
- }
- else
- loader->exec->rasterizer_version = SPH_OPTION_SET_RASTERIZER_VERSION;
- }
-
- if ( IS_HINTED( loader->load_flags ) )
- {
- TWEAK_RULES( TIMES_NEW_ROMAN_HACK );
- TWEAK_RULES( COURIER_NEW_2_HACK );
- }
-
- if ( sph_test_tweak( face, family, ppem, style, glyph_index,
- COMPATIBILITY_MODE_Rules, COMPATIBILITY_MODE_RULES_SIZE ) )
- loader->exec->face->sph_compatibility_mode = TRUE;
-
-
- if ( IS_HINTED( loader->load_flags ) )
- {
- if ( sph_test_tweak( face, family, ppem, style, glyph_index,
- COMPATIBLE_WIDTHS_Rules, COMPATIBLE_WIDTHS_RULES_SIZE ) )
- loader->exec->compatible_widths |= TRUE;
- }
- }
-
-#else /* !TT_CONFIG_OPTION_SUBPIXEL_HINTING */
-
- /* ANSI C doesn't like empty source files */
- typedef int _tt_subpix_dummy;
-
-#endif /* !TT_CONFIG_OPTION_SUBPIXEL_HINTING */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/truetype/ttsubpix.h b/chromium/third_party/pdfium/third_party/freetype/src/truetype/ttsubpix.h
deleted file mode 100644
index 9151aa3250c..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/truetype/ttsubpix.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/***************************************************************************/
-/* */
-/* ttsubpix.h */
-/* */
-/* TrueType Subpixel Hinting. */
-/* */
-/* Copyright 2010-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __TTSUBPIX_H__
-#define __TTSUBPIX_H__
-
-#include <ft2build.h>
-#include "ttobjs.h"
-#include "ttinterp.h"
-
-
-FT_BEGIN_HEADER
-
-
-#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
-
- /*************************************************************************/
- /* */
- /* ID flags to identify special functions at FDEF and runtime. */
- /* */
- /* */
-#define SPH_FDEF_INLINE_DELTA_1 0x0000001
-#define SPH_FDEF_INLINE_DELTA_2 0x0000002
-#define SPH_FDEF_DIAGONAL_STROKE 0x0000004
-#define SPH_FDEF_VACUFORM_ROUND_1 0x0000008
-#define SPH_FDEF_TTFAUTOHINT_1 0x0000010
-#define SPH_FDEF_SPACING_1 0x0000020
-#define SPH_FDEF_SPACING_2 0x0000040
-#define SPH_FDEF_TYPEMAN_STROKES 0x0000080
-#define SPH_FDEF_TYPEMAN_DIAGENDCTRL 0x0000100
-
-
- /*************************************************************************/
- /* */
- /* Tweak flags that are set for each glyph by the below rules. */
- /* */
- /* */
-#define SPH_TWEAK_ALLOW_X_DMOVE 0x0000001UL
-#define SPH_TWEAK_ALWAYS_DO_DELTAP 0x0000002UL
-#define SPH_TWEAK_ALWAYS_SKIP_DELTAP 0x0000004UL
-#define SPH_TWEAK_COURIER_NEW_2_HACK 0x0000008UL
-#define SPH_TWEAK_DEEMBOLDEN 0x0000010UL
-#define SPH_TWEAK_DO_SHPIX 0x0000020UL
-#define SPH_TWEAK_EMBOLDEN 0x0000040UL
-#define SPH_TWEAK_MIAP_HACK 0x0000080UL
-#define SPH_TWEAK_NORMAL_ROUND 0x0000100UL
-#define SPH_TWEAK_NO_ALIGNRP_AFTER_IUP 0x0000200UL
-#define SPH_TWEAK_NO_CALL_AFTER_IUP 0x0000400UL
-#define SPH_TWEAK_NO_DELTAP_AFTER_IUP 0x0000800UL
-#define SPH_TWEAK_PIXEL_HINTING 0x0001000UL
-#define SPH_TWEAK_RASTERIZER_35 0x0002000UL
-#define SPH_TWEAK_ROUND_NONPIXEL_Y_MOVES 0x0004000UL
-#define SPH_TWEAK_SKIP_IUP 0x0008000UL
-#define SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES 0x0010000UL
-#define SPH_TWEAK_SKIP_OFFPIXEL_Y_MOVES 0x0020000UL
-#define SPH_TWEAK_TIMES_NEW_ROMAN_HACK 0x0040000UL
-#define SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES_DELTAP 0x0080000UL
-
-
- FT_LOCAL( FT_Bool )
- sph_test_tweak( TT_Face face,
- const FT_String* family,
- FT_UInt ppem,
- const FT_String* style,
- FT_UInt glyph_index,
- const SPH_TweakRule* rule,
- FT_UInt num_rules );
-
- FT_LOCAL( FT_UInt )
- sph_test_tweak_x_scaling( TT_Face face,
- const FT_String* family,
- FT_UInt ppem,
- const FT_String* style,
- FT_UInt glyph_index );
-
- FT_LOCAL( void )
- sph_set_tweaks( TT_Loader loader,
- FT_UInt glyph_index );
-
-
- /* These macros are defined absent a method for setting them */
-#define SPH_OPTION_BITMAP_WIDTHS FALSE
-#define SPH_OPTION_SET_SUBPIXEL TRUE
-#define SPH_OPTION_SET_GRAYSCALE FALSE
-#define SPH_OPTION_SET_COMPATIBLE_WIDTHS FALSE
-#define SPH_OPTION_SET_RASTERIZER_VERSION 38
-
-#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */
-
-
-FT_END_HEADER
-
-#endif /* __TTSUBPIX_H__ */
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/type1/Jamfile b/chromium/third_party/pdfium/third_party/freetype/src/type1/Jamfile
deleted file mode 100644
index d1a3af57e90..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/type1/Jamfile
+++ /dev/null
@@ -1,35 +0,0 @@
-# FreeType 2 src/type1 Jamfile
-#
-# Copyright 2001-2015 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT. By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-SubDir FT2_TOP $(FT2_SRC_DIR) type1 ;
-
-{
- local _sources ;
-
- if $(FT2_MULTI)
- {
- _sources = t1afm
- t1driver
- t1gload
- t1load
- t1objs
- t1parse
- ;
- }
- else
- {
- _sources = type1 ;
- }
-
- Library $(FT2_LIB) : $(_sources).c ;
-}
-
-# end of src/type1 Jamfile
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/type1/t1afm.c b/chromium/third_party/pdfium/third_party/freetype/src/type1/t1afm.c
deleted file mode 100644
index 7f32059f850..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/type1/t1afm.c
+++ /dev/null
@@ -1,396 +0,0 @@
-/***************************************************************************/
-/* */
-/* t1afm.c */
-/* */
-/* AFM support for Type 1 fonts (body). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include "t1afm.h"
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
-#include "t1errors.h"
-
-
- /*************************************************************************/
- /* */
- /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
- /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
- /* messages during execution. */
- /* */
-#undef FT_COMPONENT
-#define FT_COMPONENT trace_t1afm
-
-
- FT_LOCAL_DEF( void )
- T1_Done_Metrics( FT_Memory memory,
- AFM_FontInfo fi )
- {
- FT_FREE( fi->KernPairs );
- fi->NumKernPair = 0;
-
- FT_FREE( fi->TrackKerns );
- fi->NumTrackKern = 0;
-
- FT_FREE( fi );
- }
-
-
- /* read a glyph name and return the equivalent glyph index */
- static FT_Int
- t1_get_index( const char* name,
- FT_Offset len,
- void* user_data )
- {
- T1_Font type1 = (T1_Font)user_data;
- FT_Int n;
-
-
- /* PS string/name length must be < 16-bit */
- if ( len > 0xFFFFU )
- return 0;
-
- for ( n = 0; n < type1->num_glyphs; n++ )
- {
- char* gname = (char*)type1->glyph_names[n];
-
-
- if ( gname && gname[0] == name[0] &&
- ft_strlen( gname ) == len &&
- ft_strncmp( gname, name, len ) == 0 )
- return n;
- }
-
- return 0;
- }
-
-
-#undef KERN_INDEX
-#define KERN_INDEX( g1, g2 ) ( ( (FT_ULong)(g1) << 16 ) | (g2) )
-
-
- /* compare two kerning pairs */
- FT_CALLBACK_DEF( int )
- compare_kern_pairs( const void* a,
- const void* b )
- {
- AFM_KernPair pair1 = (AFM_KernPair)a;
- AFM_KernPair pair2 = (AFM_KernPair)b;
-
- FT_ULong index1 = KERN_INDEX( pair1->index1, pair1->index2 );
- FT_ULong index2 = KERN_INDEX( pair2->index1, pair2->index2 );
-
-
- if ( index1 > index2 )
- return 1;
- else if ( index1 < index2 )
- return -1;
- else
- return 0;
- }
-
-
- /* parse a PFM file -- for now, only read the kerning pairs */
- static FT_Error
- T1_Read_PFM( FT_Face t1_face,
- FT_Stream stream,
- AFM_FontInfo fi )
- {
- FT_Error error = FT_Err_Ok;
- FT_Memory memory = stream->memory;
- FT_Byte* start;
- FT_Byte* limit;
- FT_Byte* p;
- AFM_KernPair kp;
- FT_Int width_table_length;
- FT_CharMap oldcharmap;
- FT_CharMap charmap;
- FT_Int n;
-
-
- start = (FT_Byte*)stream->cursor;
- limit = (FT_Byte*)stream->limit;
-
- /* Figure out how long the width table is. */
- /* This info is a little-endian short at offset 99. */
- p = start + 99;
- if ( p + 2 > limit )
- {
- error = FT_THROW( Unknown_File_Format );
- goto Exit;
- }
- width_table_length = FT_PEEK_USHORT_LE( p );
-
- p += 18 + width_table_length;
- if ( p + 0x12 > limit || FT_PEEK_USHORT_LE( p ) < 0x12 )
- /* extension table is probably optional */
- goto Exit;
-
- /* Kerning offset is 14 bytes from start of extensions table. */
- p += 14;
- p = start + FT_PEEK_ULONG_LE( p );
-
- if ( p == start )
- /* zero offset means no table */
- goto Exit;
-
- if ( p + 2 > limit )
- {
- error = FT_THROW( Unknown_File_Format );
- goto Exit;
- }
-
- fi->NumKernPair = FT_PEEK_USHORT_LE( p );
- p += 2;
- if ( p + 4 * fi->NumKernPair > limit )
- {
- error = FT_THROW( Unknown_File_Format );
- goto Exit;
- }
-
- /* Actually, kerning pairs are simply optional! */
- if ( fi->NumKernPair == 0 )
- goto Exit;
-
- /* allocate the pairs */
- if ( FT_QNEW_ARRAY( fi->KernPairs, fi->NumKernPair ) )
- goto Exit;
-
- /* now, read each kern pair */
- kp = fi->KernPairs;
- limit = p + 4 * fi->NumKernPair;
-
- /* PFM kerning data are stored by encoding rather than glyph index, */
- /* so find the PostScript charmap of this font and install it */
- /* temporarily. If we find no PostScript charmap, then just use */
- /* the default and hope it is the right one. */
- oldcharmap = t1_face->charmap;
- charmap = NULL;
-
- for ( n = 0; n < t1_face->num_charmaps; n++ )
- {
- charmap = t1_face->charmaps[n];
- /* check against PostScript pseudo platform */
- if ( charmap->platform_id == 7 )
- {
- error = FT_Set_Charmap( t1_face, charmap );
- if ( error )
- goto Exit;
- break;
- }
- }
-
- /* Kerning info is stored as: */
- /* */
- /* encoding of first glyph (1 byte) */
- /* encoding of second glyph (1 byte) */
- /* offset (little-endian short) */
- for ( ; p < limit ; p += 4 )
- {
- kp->index1 = FT_Get_Char_Index( t1_face, p[0] );
- kp->index2 = FT_Get_Char_Index( t1_face, p[1] );
-
- kp->x = (FT_Int)FT_PEEK_SHORT_LE(p + 2);
- kp->y = 0;
-
- kp++;
- }
-
- if ( oldcharmap != NULL )
- error = FT_Set_Charmap( t1_face, oldcharmap );
- if ( error )
- goto Exit;
-
- /* now, sort the kern pairs according to their glyph indices */
- ft_qsort( fi->KernPairs, fi->NumKernPair, sizeof ( AFM_KernPairRec ),
- compare_kern_pairs );
-
- Exit:
- if ( error )
- {
- FT_FREE( fi->KernPairs );
- fi->NumKernPair = 0;
- }
-
- return error;
- }
-
-
- /* parse a metrics file -- either AFM or PFM depending on what */
- /* it turns out to be */
- FT_LOCAL_DEF( FT_Error )
- T1_Read_Metrics( FT_Face t1_face,
- FT_Stream stream )
- {
- PSAux_Service psaux;
- FT_Memory memory = stream->memory;
- AFM_ParserRec parser;
- AFM_FontInfo fi = NULL;
- FT_Error error = FT_ERR( Unknown_File_Format );
- T1_Font t1_font = &( (T1_Face)t1_face )->type1;
-
-
- if ( FT_NEW( fi ) ||
- FT_FRAME_ENTER( stream->size ) )
- goto Exit;
-
- fi->FontBBox = t1_font->font_bbox;
- fi->Ascender = t1_font->font_bbox.yMax;
- fi->Descender = t1_font->font_bbox.yMin;
-
- psaux = (PSAux_Service)( (T1_Face)t1_face )->psaux;
- if ( psaux->afm_parser_funcs )
- {
- error = psaux->afm_parser_funcs->init( &parser,
- stream->memory,
- stream->cursor,
- stream->limit );
-
- if ( !error )
- {
- parser.FontInfo = fi;
- parser.get_index = t1_get_index;
- parser.user_data = t1_font;
-
- error = psaux->afm_parser_funcs->parse( &parser );
- psaux->afm_parser_funcs->done( &parser );
- }
- }
-
- if ( FT_ERR_EQ( error, Unknown_File_Format ) )
- {
- FT_Byte* start = stream->cursor;
-
-
- /* MS Windows allows versions up to 0x3FF without complaining */
- if ( stream->size > 6 &&
- start[1] < 4 &&
- FT_PEEK_ULONG_LE( start + 2 ) == stream->size )
- error = T1_Read_PFM( t1_face, stream, fi );
- }
-
- if ( !error )
- {
- t1_font->font_bbox = fi->FontBBox;
-
- t1_face->bbox.xMin = fi->FontBBox.xMin >> 16;
- t1_face->bbox.yMin = fi->FontBBox.yMin >> 16;
- /* no `U' suffix here to 0xFFFF! */
- t1_face->bbox.xMax = ( fi->FontBBox.xMax + 0xFFFF ) >> 16;
- t1_face->bbox.yMax = ( fi->FontBBox.yMax + 0xFFFF ) >> 16;
-
- /* no `U' suffix here to 0x8000! */
- t1_face->ascender = (FT_Short)( ( fi->Ascender + 0x8000 ) >> 16 );
- t1_face->descender = (FT_Short)( ( fi->Descender + 0x8000 ) >> 16 );
-
- if ( fi->NumKernPair )
- {
- t1_face->face_flags |= FT_FACE_FLAG_KERNING;
- ( (T1_Face)t1_face )->afm_data = fi;
- fi = NULL;
- }
- }
-
- FT_FRAME_EXIT();
-
- Exit:
- if ( fi != NULL )
- T1_Done_Metrics( memory, fi );
-
- return error;
- }
-
-
- /* find the kerning for a given glyph pair */
- FT_LOCAL_DEF( void )
- T1_Get_Kerning( AFM_FontInfo fi,
- FT_UInt glyph1,
- FT_UInt glyph2,
- FT_Vector* kerning )
- {
- AFM_KernPair min, mid, max;
- FT_ULong idx = KERN_INDEX( glyph1, glyph2 );
-
-
- /* simple binary search */
- min = fi->KernPairs;
- max = min + fi->NumKernPair - 1;
-
- while ( min <= max )
- {
- FT_ULong midi;
-
-
- mid = min + ( max - min ) / 2;
- midi = KERN_INDEX( mid->index1, mid->index2 );
-
- if ( midi == idx )
- {
- kerning->x = mid->x;
- kerning->y = mid->y;
-
- return;
- }
-
- if ( midi < idx )
- min = mid + 1;
- else
- max = mid - 1;
- }
-
- kerning->x = 0;
- kerning->y = 0;
- }
-
-
- FT_LOCAL_DEF( FT_Error )
- T1_Get_Track_Kerning( FT_Face face,
- FT_Fixed ptsize,
- FT_Int degree,
- FT_Fixed* kerning )
- {
- AFM_FontInfo fi = (AFM_FontInfo)( (T1_Face)face )->afm_data;
- FT_UInt i;
-
-
- if ( !fi )
- return FT_THROW( Invalid_Argument );
-
- for ( i = 0; i < fi->NumTrackKern; i++ )
- {
- AFM_TrackKern tk = fi->TrackKerns + i;
-
-
- if ( tk->degree != degree )
- continue;
-
- if ( ptsize < tk->min_ptsize )
- *kerning = tk->min_kern;
- else if ( ptsize > tk->max_ptsize )
- *kerning = tk->max_kern;
- else
- {
- *kerning = FT_MulDiv( ptsize - tk->min_ptsize,
- tk->max_kern - tk->min_kern,
- tk->max_ptsize - tk->min_ptsize ) +
- tk->min_kern;
- }
- }
-
- return FT_Err_Ok;
- }
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/type1/t1afm.h b/chromium/third_party/pdfium/third_party/freetype/src/type1/t1afm.h
deleted file mode 100644
index 0f42f3e3a83..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/type1/t1afm.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/***************************************************************************/
-/* */
-/* t1afm.h */
-/* */
-/* AFM support for Type 1 fonts (specification). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __T1AFM_H__
-#define __T1AFM_H__
-
-#include <ft2build.h>
-#include "t1objs.h"
-#include FT_INTERNAL_TYPE1_TYPES_H
-
-FT_BEGIN_HEADER
-
-
- FT_LOCAL( FT_Error )
- T1_Read_Metrics( FT_Face face,
- FT_Stream stream );
-
- FT_LOCAL( void )
- T1_Done_Metrics( FT_Memory memory,
- AFM_FontInfo fi );
-
- FT_LOCAL( void )
- T1_Get_Kerning( AFM_FontInfo fi,
- FT_UInt glyph1,
- FT_UInt glyph2,
- FT_Vector* kerning );
-
- FT_LOCAL( FT_Error )
- T1_Get_Track_Kerning( FT_Face face,
- FT_Fixed ptsize,
- FT_Int degree,
- FT_Fixed* kerning );
-
-FT_END_HEADER
-
-#endif /* __T1AFM_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/type1/t1driver.c b/chromium/third_party/pdfium/third_party/freetype/src/type1/t1driver.c
deleted file mode 100644
index 571f2d2f8cd..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/type1/t1driver.c
+++ /dev/null
@@ -1,725 +0,0 @@
-/***************************************************************************/
-/* */
-/* t1driver.c */
-/* */
-/* Type 1 driver interface (body). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include "t1driver.h"
-#include "t1gload.h"
-#include "t1load.h"
-
-#include "t1errors.h"
-
-#ifndef T1_CONFIG_OPTION_NO_AFM
-#include "t1afm.h"
-#endif
-
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-
-#include FT_SERVICE_MULTIPLE_MASTERS_H
-#include FT_SERVICE_GLYPH_DICT_H
-#include FT_SERVICE_FONT_FORMAT_H
-#include FT_SERVICE_POSTSCRIPT_NAME_H
-#include FT_SERVICE_POSTSCRIPT_CMAPS_H
-#include FT_SERVICE_POSTSCRIPT_INFO_H
-#include FT_SERVICE_KERNING_H
-
-
- /*************************************************************************/
- /* */
- /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
- /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
- /* messages during execution. */
- /* */
-#undef FT_COMPONENT
-#define FT_COMPONENT trace_t1driver
-
- /*
- * GLYPH DICT SERVICE
- *
- */
-
- static FT_Error
- t1_get_glyph_name( T1_Face face,
- FT_UInt glyph_index,
- FT_Pointer buffer,
- FT_UInt buffer_max )
- {
- FT_STRCPYN( buffer, face->type1.glyph_names[glyph_index], buffer_max );
-
- return FT_Err_Ok;
- }
-
-
- static FT_UInt
- t1_get_name_index( T1_Face face,
- FT_String* glyph_name )
- {
- FT_Int i;
-
-
- for ( i = 0; i < face->type1.num_glyphs; i++ )
- {
- FT_String* gname = face->type1.glyph_names[i];
-
-
- if ( !ft_strcmp( glyph_name, gname ) )
- return (FT_UInt)i;
- }
-
- return 0;
- }
-
-
- static const FT_Service_GlyphDictRec t1_service_glyph_dict =
- {
- (FT_GlyphDict_GetNameFunc) t1_get_glyph_name,
- (FT_GlyphDict_NameIndexFunc)t1_get_name_index
- };
-
-
- /*
- * POSTSCRIPT NAME SERVICE
- *
- */
-
- static const char*
- t1_get_ps_name( T1_Face face )
- {
- return (const char*) face->type1.font_name;
- }
-
-
- static const FT_Service_PsFontNameRec t1_service_ps_name =
- {
- (FT_PsName_GetFunc)t1_get_ps_name
- };
-
-
- /*
- * MULTIPLE MASTERS SERVICE
- *
- */
-
-#ifndef T1_CONFIG_OPTION_NO_MM_SUPPORT
- static const FT_Service_MultiMastersRec t1_service_multi_masters =
- {
- (FT_Get_MM_Func) T1_Get_Multi_Master,
- (FT_Set_MM_Design_Func) T1_Set_MM_Design,
- (FT_Set_MM_Blend_Func) T1_Set_MM_Blend,
- (FT_Get_MM_Var_Func) T1_Get_MM_Var,
- (FT_Set_Var_Design_Func)T1_Set_Var_Design
- };
-#endif
-
-
- /*
- * POSTSCRIPT INFO SERVICE
- *
- */
-
- static FT_Error
- t1_ps_get_font_info( FT_Face face,
- PS_FontInfoRec* afont_info )
- {
- *afont_info = ((T1_Face)face)->type1.font_info;
-
- return FT_Err_Ok;
- }
-
-
- static FT_Error
- t1_ps_get_font_extra( FT_Face face,
- PS_FontExtraRec* afont_extra )
- {
- *afont_extra = ((T1_Face)face)->type1.font_extra;
-
- return FT_Err_Ok;
- }
-
-
- static FT_Int
- t1_ps_has_glyph_names( FT_Face face )
- {
- FT_UNUSED( face );
-
- return 1;
- }
-
-
- static FT_Error
- t1_ps_get_font_private( FT_Face face,
- PS_PrivateRec* afont_private )
- {
- *afont_private = ((T1_Face)face)->type1.private_dict;
-
- return FT_Err_Ok;
- }
-
-
- static FT_Long
- t1_ps_get_font_value( FT_Face face,
- PS_Dict_Keys key,
- FT_UInt idx,
- void *value,
- FT_Long value_len_ )
- {
- FT_ULong retval = 0; /* always >= 1 if valid */
- FT_ULong value_len = value_len_ < 0 ? 0 : (FT_ULong)value_len_;
-
- T1_Face t1face = (T1_Face)face;
- T1_Font type1 = &t1face->type1;
-
-
- switch ( key )
- {
- case PS_DICT_FONT_TYPE:
- retval = sizeof ( type1->font_type );
- if ( value && value_len >= retval )
- *((FT_Byte *)value) = type1->font_type;
- break;
-
- case PS_DICT_FONT_MATRIX:
- if ( idx < sizeof ( type1->font_matrix ) /
- sizeof ( type1->font_matrix.xx ) )
- {
- FT_Fixed val = 0;
-
-
- retval = sizeof ( val );
- if ( value && value_len >= retval )
- {
- switch ( idx )
- {
- case 0:
- val = type1->font_matrix.xx;
- break;
- case 1:
- val = type1->font_matrix.xy;
- break;
- case 2:
- val = type1->font_matrix.yx;
- break;
- case 3:
- val = type1->font_matrix.yy;
- break;
- }
- *((FT_Fixed *)value) = val;
- }
- }
- break;
-
- case PS_DICT_FONT_BBOX:
- if ( idx < sizeof ( type1->font_bbox ) /
- sizeof ( type1->font_bbox.xMin ) )
- {
- FT_Fixed val = 0;
-
-
- retval = sizeof ( val );
- if ( value && value_len >= retval )
- {
- switch ( idx )
- {
- case 0:
- val = type1->font_bbox.xMin;
- break;
- case 1:
- val = type1->font_bbox.yMin;
- break;
- case 2:
- val = type1->font_bbox.xMax;
- break;
- case 3:
- val = type1->font_bbox.yMax;
- break;
- }
- *((FT_Fixed *)value) = val;
- }
- }
- break;
-
- case PS_DICT_PAINT_TYPE:
- retval = sizeof ( type1->paint_type );
- if ( value && value_len >= retval )
- *((FT_Byte *)value) = type1->paint_type;
- break;
-
- case PS_DICT_FONT_NAME:
- retval = ft_strlen( type1->font_name ) + 1;
- if ( value && value_len >= retval )
- ft_memcpy( value, (void *)( type1->font_name ), retval );
- break;
-
- case PS_DICT_UNIQUE_ID:
- retval = sizeof ( type1->private_dict.unique_id );
- if ( value && value_len >= retval )
- *((FT_Int *)value) = type1->private_dict.unique_id;
- break;
-
- case PS_DICT_NUM_CHAR_STRINGS:
- retval = sizeof ( type1->num_glyphs );
- if ( value && value_len >= retval )
- *((FT_Int *)value) = type1->num_glyphs;
- break;
-
- case PS_DICT_CHAR_STRING_KEY:
- if ( idx < (FT_UInt)type1->num_glyphs )
- {
- retval = ft_strlen( type1->glyph_names[idx] ) + 1;
- if ( value && value_len >= retval )
- {
- ft_memcpy( value, (void *)( type1->glyph_names[idx] ), retval );
- ((FT_Char *)value)[retval - 1] = (FT_Char)'\0';
- }
- }
- break;
-
- case PS_DICT_CHAR_STRING:
- if ( idx < (FT_UInt)type1->num_glyphs )
- {
- retval = type1->charstrings_len[idx] + 1;
- if ( value && value_len >= retval )
- {
- ft_memcpy( value, (void *)( type1->charstrings[idx] ),
- retval - 1 );
- ((FT_Char *)value)[retval - 1] = (FT_Char)'\0';
- }
- }
- break;
-
- case PS_DICT_ENCODING_TYPE:
- retval = sizeof ( type1->encoding_type );
- if ( value && value_len >= retval )
- *((T1_EncodingType *)value) = type1->encoding_type;
- break;
-
- case PS_DICT_ENCODING_ENTRY:
- if ( type1->encoding_type == T1_ENCODING_TYPE_ARRAY &&
- idx < (FT_UInt)type1->encoding.num_chars )
- {
- retval = ft_strlen( type1->encoding.char_name[idx] ) + 1;
- if ( value && value_len >= retval )
- {
- ft_memcpy( value, (void *)( type1->encoding.char_name[idx] ),
- retval - 1 );
- ((FT_Char *)value)[retval - 1] = (FT_Char)'\0';
- }
- }
- break;
-
- case PS_DICT_NUM_SUBRS:
- retval = sizeof ( type1->num_subrs );
- if ( value && value_len >= retval )
- *((FT_Int *)value) = type1->num_subrs;
- break;
-
- case PS_DICT_SUBR:
- if ( idx < (FT_UInt)type1->num_subrs )
- {
- retval = type1->subrs_len[idx] + 1;
- if ( value && value_len >= retval )
- {
- ft_memcpy( value, (void *)( type1->subrs[idx] ), retval - 1 );
- ((FT_Char *)value)[retval - 1] = (FT_Char)'\0';
- }
- }
- break;
-
- case PS_DICT_STD_HW:
- retval = sizeof ( type1->private_dict.standard_width[0] );
- if ( value && value_len >= retval )
- *((FT_UShort *)value) = type1->private_dict.standard_width[0];
- break;
-
- case PS_DICT_STD_VW:
- retval = sizeof ( type1->private_dict.standard_height[0] );
- if ( value && value_len >= retval )
- *((FT_UShort *)value) = type1->private_dict.standard_height[0];
- break;
-
- case PS_DICT_NUM_BLUE_VALUES:
- retval = sizeof ( type1->private_dict.num_blue_values );
- if ( value && value_len >= retval )
- *((FT_Byte *)value) = type1->private_dict.num_blue_values;
- break;
-
- case PS_DICT_BLUE_VALUE:
- if ( idx < type1->private_dict.num_blue_values )
- {
- retval = sizeof ( type1->private_dict.blue_values[idx] );
- if ( value && value_len >= retval )
- *((FT_Short *)value) = type1->private_dict.blue_values[idx];
- }
- break;
-
- case PS_DICT_BLUE_SCALE:
- retval = sizeof ( type1->private_dict.blue_scale );
- if ( value && value_len >= retval )
- *((FT_Fixed *)value) = type1->private_dict.blue_scale;
- break;
-
- case PS_DICT_BLUE_FUZZ:
- retval = sizeof ( type1->private_dict.blue_fuzz );
- if ( value && value_len >= retval )
- *((FT_Int *)value) = type1->private_dict.blue_fuzz;
- break;
-
- case PS_DICT_BLUE_SHIFT:
- retval = sizeof ( type1->private_dict.blue_shift );
- if ( value && value_len >= retval )
- *((FT_Int *)value) = type1->private_dict.blue_shift;
- break;
-
- case PS_DICT_NUM_OTHER_BLUES:
- retval = sizeof ( type1->private_dict.num_other_blues );
- if ( value && value_len >= retval )
- *((FT_Byte *)value) = type1->private_dict.num_other_blues;
- break;
-
- case PS_DICT_OTHER_BLUE:
- if ( idx < type1->private_dict.num_other_blues )
- {
- retval = sizeof ( type1->private_dict.other_blues[idx] );
- if ( value && value_len >= retval )
- *((FT_Short *)value) = type1->private_dict.other_blues[idx];
- }
- break;
-
- case PS_DICT_NUM_FAMILY_BLUES:
- retval = sizeof ( type1->private_dict.num_family_blues );
- if ( value && value_len >= retval )
- *((FT_Byte *)value) = type1->private_dict.num_family_blues;
- break;
-
- case PS_DICT_FAMILY_BLUE:
- if ( idx < type1->private_dict.num_family_blues )
- {
- retval = sizeof ( type1->private_dict.family_blues[idx] );
- if ( value && value_len >= retval )
- *((FT_Short *)value) = type1->private_dict.family_blues[idx];
- }
- break;
-
- case PS_DICT_NUM_FAMILY_OTHER_BLUES:
- retval = sizeof ( type1->private_dict.num_family_other_blues );
- if ( value && value_len >= retval )
- *((FT_Byte *)value) = type1->private_dict.num_family_other_blues;
- break;
-
- case PS_DICT_FAMILY_OTHER_BLUE:
- if ( idx < type1->private_dict.num_family_other_blues )
- {
- retval = sizeof ( type1->private_dict.family_other_blues[idx] );
- if ( value && value_len >= retval )
- *((FT_Short *)value) = type1->private_dict.family_other_blues[idx];
- }
- break;
-
- case PS_DICT_NUM_STEM_SNAP_H:
- retval = sizeof ( type1->private_dict.num_snap_widths );
- if ( value && value_len >= retval )
- *((FT_Byte *)value) = type1->private_dict.num_snap_widths;
- break;
-
- case PS_DICT_STEM_SNAP_H:
- if ( idx < type1->private_dict.num_snap_widths )
- {
- retval = sizeof ( type1->private_dict.snap_widths[idx] );
- if ( value && value_len >= retval )
- *((FT_Short *)value) = type1->private_dict.snap_widths[idx];
- }
- break;
-
- case PS_DICT_NUM_STEM_SNAP_V:
- retval = sizeof ( type1->private_dict.num_snap_heights );
- if ( value && value_len >= retval )
- *((FT_Byte *)value) = type1->private_dict.num_snap_heights;
- break;
-
- case PS_DICT_STEM_SNAP_V:
- if ( idx < type1->private_dict.num_snap_heights )
- {
- retval = sizeof ( type1->private_dict.snap_heights[idx] );
- if ( value && value_len >= retval )
- *((FT_Short *)value) = type1->private_dict.snap_heights[idx];
- }
- break;
-
- case PS_DICT_RND_STEM_UP:
- retval = sizeof ( type1->private_dict.round_stem_up );
- if ( value && value_len >= retval )
- *((FT_Bool *)value) = type1->private_dict.round_stem_up;
- break;
-
- case PS_DICT_FORCE_BOLD:
- retval = sizeof ( type1->private_dict.force_bold );
- if ( value && value_len >= retval )
- *((FT_Bool *)value) = type1->private_dict.force_bold;
- break;
-
- case PS_DICT_MIN_FEATURE:
- if ( idx < sizeof ( type1->private_dict.min_feature ) /
- sizeof ( type1->private_dict.min_feature[0] ) )
- {
- retval = sizeof ( type1->private_dict.min_feature[idx] );
- if ( value && value_len >= retval )
- *((FT_Short *)value) = type1->private_dict.min_feature[idx];
- }
- break;
-
- case PS_DICT_LEN_IV:
- retval = sizeof ( type1->private_dict.lenIV );
- if ( value && value_len >= retval )
- *((FT_Int *)value) = type1->private_dict.lenIV;
- break;
-
- case PS_DICT_PASSWORD:
- retval = sizeof ( type1->private_dict.password );
- if ( value && value_len >= retval )
- *((FT_Long *)value) = type1->private_dict.password;
- break;
-
- case PS_DICT_LANGUAGE_GROUP:
- retval = sizeof ( type1->private_dict.language_group );
- if ( value && value_len >= retval )
- *((FT_Long *)value) = type1->private_dict.language_group;
- break;
-
- case PS_DICT_IS_FIXED_PITCH:
- retval = sizeof ( type1->font_info.is_fixed_pitch );
- if ( value && value_len >= retval )
- *((FT_Bool *)value) = type1->font_info.is_fixed_pitch;
- break;
-
- case PS_DICT_UNDERLINE_POSITION:
- retval = sizeof ( type1->font_info.underline_position );
- if ( value && value_len >= retval )
- *((FT_Short *)value) = type1->font_info.underline_position;
- break;
-
- case PS_DICT_UNDERLINE_THICKNESS:
- retval = sizeof ( type1->font_info.underline_thickness );
- if ( value && value_len >= retval )
- *((FT_UShort *)value) = type1->font_info.underline_thickness;
- break;
-
- case PS_DICT_FS_TYPE:
- retval = sizeof ( type1->font_extra.fs_type );
- if ( value && value_len >= retval )
- *((FT_UShort *)value) = type1->font_extra.fs_type;
- break;
-
- case PS_DICT_VERSION:
- retval = ft_strlen( type1->font_info.version ) + 1;
- if ( value && value_len >= retval )
- ft_memcpy( value, (void *)( type1->font_info.version ), retval );
- break;
-
- case PS_DICT_NOTICE:
- retval = ft_strlen( type1->font_info.notice ) + 1;
- if ( value && value_len >= retval )
- ft_memcpy( value, (void *)( type1->font_info.notice ), retval );
- break;
-
- case PS_DICT_FULL_NAME:
- retval = ft_strlen( type1->font_info.full_name ) + 1;
- if ( value && value_len >= retval )
- ft_memcpy( value, (void *)( type1->font_info.full_name ), retval );
- break;
-
- case PS_DICT_FAMILY_NAME:
- retval = ft_strlen( type1->font_info.family_name ) + 1;
- if ( value && value_len >= retval )
- ft_memcpy( value, (void *)( type1->font_info.family_name ), retval );
- break;
-
- case PS_DICT_WEIGHT:
- retval = ft_strlen( type1->font_info.weight ) + 1;
- if ( value && value_len >= retval )
- ft_memcpy( value, (void *)( type1->font_info.weight ), retval );
- break;
-
- case PS_DICT_ITALIC_ANGLE:
- retval = sizeof ( type1->font_info.italic_angle );
- if ( value && value_len >= retval )
- *((FT_Long *)value) = type1->font_info.italic_angle;
- break;
- }
-
- return retval == 0 ? -1 : (FT_Long)retval;
- }
-
-
- static const FT_Service_PsInfoRec t1_service_ps_info =
- {
- (PS_GetFontInfoFunc) t1_ps_get_font_info,
- (PS_GetFontExtraFunc) t1_ps_get_font_extra,
- (PS_HasGlyphNamesFunc) t1_ps_has_glyph_names,
- (PS_GetFontPrivateFunc)t1_ps_get_font_private,
- (PS_GetFontValueFunc) t1_ps_get_font_value,
- };
-
-
-#ifndef T1_CONFIG_OPTION_NO_AFM
- static const FT_Service_KerningRec t1_service_kerning =
- {
- T1_Get_Track_Kerning,
- };
-#endif
-
-
- /*
- * SERVICE LIST
- *
- */
-
- static const FT_ServiceDescRec t1_services[] =
- {
- { FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &t1_service_ps_name },
- { FT_SERVICE_ID_GLYPH_DICT, &t1_service_glyph_dict },
- { FT_SERVICE_ID_FONT_FORMAT, FT_FONT_FORMAT_TYPE_1 },
- { FT_SERVICE_ID_POSTSCRIPT_INFO, &t1_service_ps_info },
-
-#ifndef T1_CONFIG_OPTION_NO_AFM
- { FT_SERVICE_ID_KERNING, &t1_service_kerning },
-#endif
-
-#ifndef T1_CONFIG_OPTION_NO_MM_SUPPORT
- { FT_SERVICE_ID_MULTI_MASTERS, &t1_service_multi_masters },
-#endif
- { NULL, NULL }
- };
-
-
- FT_CALLBACK_DEF( FT_Module_Interface )
- Get_Interface( FT_Module module,
- const FT_String* t1_interface )
- {
- FT_UNUSED( module );
-
- return ft_service_list_lookup( t1_services, t1_interface );
- }
-
-
-#ifndef T1_CONFIG_OPTION_NO_AFM
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* Get_Kerning */
- /* */
- /* <Description> */
- /* A driver method used to return the kerning vector between two */
- /* glyphs of the same face. */
- /* */
- /* <Input> */
- /* face :: A handle to the source face object. */
- /* */
- /* left_glyph :: The index of the left glyph in the kern pair. */
- /* */
- /* right_glyph :: The index of the right glyph in the kern pair. */
- /* */
- /* <Output> */
- /* kerning :: The kerning vector. This is in font units for */
- /* scalable formats, and in pixels for fixed-sizes */
- /* formats. */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. */
- /* */
- /* <Note> */
- /* Only horizontal layouts (left-to-right & right-to-left) are */
- /* supported by this function. Other layouts, or more sophisticated */
- /* kernings are out of scope of this method (the basic driver */
- /* interface is meant to be simple). */
- /* */
- /* They can be implemented by format-specific interfaces. */
- /* */
- static FT_Error
- Get_Kerning( FT_Face t1face, /* T1_Face */
- FT_UInt left_glyph,
- FT_UInt right_glyph,
- FT_Vector* kerning )
- {
- T1_Face face = (T1_Face)t1face;
-
-
- kerning->x = 0;
- kerning->y = 0;
-
- if ( face->afm_data )
- T1_Get_Kerning( (AFM_FontInfo)face->afm_data,
- left_glyph,
- right_glyph,
- kerning );
-
- return FT_Err_Ok;
- }
-
-
-#endif /* T1_CONFIG_OPTION_NO_AFM */
-
-
- FT_CALLBACK_TABLE_DEF
- const FT_Driver_ClassRec t1_driver_class =
- {
- {
- FT_MODULE_FONT_DRIVER |
- FT_MODULE_DRIVER_SCALABLE |
- FT_MODULE_DRIVER_HAS_HINTER,
-
- sizeof ( FT_DriverRec ),
-
- "type1",
- 0x10000L,
- 0x20000L,
-
- 0, /* format interface */
-
- T1_Driver_Init,
- T1_Driver_Done,
- Get_Interface,
- },
-
- sizeof ( T1_FaceRec ),
- sizeof ( T1_SizeRec ),
- sizeof ( T1_GlyphSlotRec ),
-
- T1_Face_Init,
- T1_Face_Done,
- T1_Size_Init,
- T1_Size_Done,
- T1_GlyphSlot_Init,
- T1_GlyphSlot_Done,
-
- T1_Load_Glyph,
-
-#ifdef T1_CONFIG_OPTION_NO_AFM
- 0, /* FT_Face_GetKerningFunc */
- 0, /* FT_Face_AttachFunc */
-#else
- Get_Kerning,
- T1_Read_Metrics,
-#endif
- T1_Get_Advances,
- T1_Size_Request,
- 0 /* FT_Size_SelectFunc */
- };
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/type1/t1driver.h b/chromium/third_party/pdfium/third_party/freetype/src/type1/t1driver.h
deleted file mode 100644
index 34bcf81ccf3..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/type1/t1driver.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/***************************************************************************/
-/* */
-/* t1driver.h */
-/* */
-/* High-level Type 1 driver interface (specification). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __T1DRIVER_H__
-#define __T1DRIVER_H__
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_DRIVER_H
-
-
-FT_BEGIN_HEADER
-
-#ifdef FT_CONFIG_OPTION_PIC
-#error "this module does not support PIC yet"
-#endif
-
-
- FT_EXPORT_VAR( const FT_Driver_ClassRec ) t1_driver_class;
-
-
-FT_END_HEADER
-
-#endif /* __T1DRIVER_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/type1/t1errors.h b/chromium/third_party/pdfium/third_party/freetype/src/type1/t1errors.h
deleted file mode 100644
index fc7a9bd64e4..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/type1/t1errors.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/***************************************************************************/
-/* */
-/* t1errors.h */
-/* */
-/* Type 1 error codes (specification only). */
-/* */
-/* Copyright 2001-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* This file is used to define the Type 1 error enumeration constants. */
- /* */
- /*************************************************************************/
-
-#ifndef __T1ERRORS_H__
-#define __T1ERRORS_H__
-
-#include FT_MODULE_ERRORS_H
-
-#undef __FTERRORS_H__
-
-#undef FT_ERR_PREFIX
-#define FT_ERR_PREFIX T1_Err_
-#define FT_ERR_BASE FT_Mod_Err_Type1
-
-#include FT_ERRORS_H
-
-#endif /* __T1ERRORS_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/type1/t1gload.c b/chromium/third_party/pdfium/third_party/freetype/src/type1/t1gload.c
deleted file mode 100644
index 85ada2ea6a9..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/type1/t1gload.c
+++ /dev/null
@@ -1,521 +0,0 @@
-/***************************************************************************/
-/* */
-/* t1gload.c */
-/* */
-/* Type 1 Glyph Loader (body). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include "t1gload.h"
-#include FT_INTERNAL_CALC_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_OUTLINE_H
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
-
-#include "t1errors.h"
-
-
- /*************************************************************************/
- /* */
- /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
- /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
- /* messages during execution. */
- /* */
-#undef FT_COMPONENT
-#define FT_COMPONENT trace_t1gload
-
-
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
- /********** *********/
- /********** COMPUTE THE MAXIMUM ADVANCE WIDTH *********/
- /********** *********/
- /********** The following code is in charge of computing *********/
- /********** the maximum advance width of the font. It *********/
- /********** quickly processes each glyph charstring to *********/
- /********** extract the value from either a `sbw' or `seac' *********/
- /********** operator. *********/
- /********** *********/
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
-
-
- static FT_Error
- T1_Parse_Glyph_And_Get_Char_String( T1_Decoder decoder,
- FT_UInt glyph_index,
- FT_Data* char_string )
- {
- T1_Face face = (T1_Face)decoder->builder.face;
- T1_Font type1 = &face->type1;
- FT_Error error = FT_Err_Ok;
-
-#ifdef FT_CONFIG_OPTION_INCREMENTAL
- FT_Incremental_InterfaceRec *inc =
- face->root.internal->incremental_interface;
-#endif
-
-
- decoder->font_matrix = type1->font_matrix;
- decoder->font_offset = type1->font_offset;
-
-#ifdef FT_CONFIG_OPTION_INCREMENTAL
-
- /* For incremental fonts get the character data using the */
- /* callback function. */
- if ( inc )
- error = inc->funcs->get_glyph_data( inc->object,
- glyph_index, char_string );
- else
-
-#endif /* FT_CONFIG_OPTION_INCREMENTAL */
-
- /* For ordinary fonts get the character data stored in the face record. */
- {
- char_string->pointer = type1->charstrings[glyph_index];
- char_string->length = (FT_Int)type1->charstrings_len[glyph_index];
- }
-
- if ( !error )
- error = decoder->funcs.parse_charstrings(
- decoder, (FT_Byte*)char_string->pointer,
- (FT_UInt)char_string->length );
-
-#ifdef FT_CONFIG_OPTION_INCREMENTAL
-
- /* Incremental fonts can optionally override the metrics. */
- if ( !error && inc && inc->funcs->get_glyph_metrics )
- {
- FT_Incremental_MetricsRec metrics;
-
-
- metrics.bearing_x = FIXED_TO_INT( decoder->builder.left_bearing.x );
- metrics.bearing_y = 0;
- metrics.advance = FIXED_TO_INT( decoder->builder.advance.x );
- metrics.advance_v = FIXED_TO_INT( decoder->builder.advance.y );
-
- error = inc->funcs->get_glyph_metrics( inc->object,
- glyph_index, FALSE, &metrics );
-
- decoder->builder.left_bearing.x = INT_TO_FIXED( metrics.bearing_x );
- decoder->builder.advance.x = INT_TO_FIXED( metrics.advance );
- decoder->builder.advance.y = INT_TO_FIXED( metrics.advance_v );
- }
-
-#endif /* FT_CONFIG_OPTION_INCREMENTAL */
-
- return error;
- }
-
-
- FT_CALLBACK_DEF( FT_Error )
- T1_Parse_Glyph( T1_Decoder decoder,
- FT_UInt glyph_index )
- {
- FT_Data glyph_data;
- FT_Error error = T1_Parse_Glyph_And_Get_Char_String(
- decoder, glyph_index, &glyph_data );
-
-
-#ifdef FT_CONFIG_OPTION_INCREMENTAL
-
- if ( !error )
- {
- T1_Face face = (T1_Face)decoder->builder.face;
-
-
- if ( face->root.internal->incremental_interface )
- face->root.internal->incremental_interface->funcs->free_glyph_data(
- face->root.internal->incremental_interface->object,
- &glyph_data );
- }
-
-#endif /* FT_CONFIG_OPTION_INCREMENTAL */
-
- return error;
- }
-
-
- FT_LOCAL_DEF( FT_Error )
- T1_Compute_Max_Advance( T1_Face face,
- FT_Pos* max_advance )
- {
- FT_Error error;
- T1_DecoderRec decoder;
- FT_Int glyph_index;
- T1_Font type1 = &face->type1;
- PSAux_Service psaux = (PSAux_Service)face->psaux;
-
-
- FT_ASSERT( ( face->len_buildchar == 0 ) == ( face->buildchar == NULL ) );
-
- *max_advance = 0;
-
- /* initialize load decoder */
- error = psaux->t1_decoder_funcs->init( &decoder,
- (FT_Face)face,
- 0, /* size */
- 0, /* glyph slot */
- (FT_Byte**)type1->glyph_names,
- face->blend,
- 0,
- FT_RENDER_MODE_NORMAL,
- T1_Parse_Glyph );
- if ( error )
- return error;
-
- decoder.builder.metrics_only = 1;
- decoder.builder.load_points = 0;
-
- decoder.num_subrs = type1->num_subrs;
- decoder.subrs = type1->subrs;
- decoder.subrs_len = type1->subrs_len;
-
- decoder.buildchar = face->buildchar;
- decoder.len_buildchar = face->len_buildchar;
-
- *max_advance = 0;
-
- /* for each glyph, parse the glyph charstring and extract */
- /* the advance width */
- for ( glyph_index = 0; glyph_index < type1->num_glyphs; glyph_index++ )
- {
- /* now get load the unscaled outline */
- (void)T1_Parse_Glyph( &decoder, (FT_UInt)glyph_index );
- if ( glyph_index == 0 || decoder.builder.advance.x > *max_advance )
- *max_advance = decoder.builder.advance.x;
-
- /* ignore the error if one occurred - skip to next glyph */
- }
-
- psaux->t1_decoder_funcs->done( &decoder );
-
- return FT_Err_Ok;
- }
-
-
- FT_LOCAL_DEF( FT_Error )
- T1_Get_Advances( FT_Face t1face, /* T1_Face */
- FT_UInt first,
- FT_UInt count,
- FT_Int32 load_flags,
- FT_Fixed* advances )
- {
- T1_Face face = (T1_Face)t1face;
- T1_DecoderRec decoder;
- T1_Font type1 = &face->type1;
- PSAux_Service psaux = (PSAux_Service)face->psaux;
- FT_UInt nn;
- FT_Error error;
-
-
- if ( load_flags & FT_LOAD_VERTICAL_LAYOUT )
- {
- for ( nn = 0; nn < count; nn++ )
- advances[nn] = 0;
-
- return FT_Err_Ok;
- }
-
- error = psaux->t1_decoder_funcs->init( &decoder,
- (FT_Face)face,
- 0, /* size */
- 0, /* glyph slot */
- (FT_Byte**)type1->glyph_names,
- face->blend,
- 0,
- FT_RENDER_MODE_NORMAL,
- T1_Parse_Glyph );
- if ( error )
- return error;
-
- decoder.builder.metrics_only = 1;
- decoder.builder.load_points = 0;
-
- decoder.num_subrs = type1->num_subrs;
- decoder.subrs = type1->subrs;
- decoder.subrs_len = type1->subrs_len;
-
- decoder.buildchar = face->buildchar;
- decoder.len_buildchar = face->len_buildchar;
-
- for ( nn = 0; nn < count; nn++ )
- {
- error = T1_Parse_Glyph( &decoder, first + nn );
- if ( !error )
- advances[nn] = FIXED_TO_INT( decoder.builder.advance.x );
- else
- advances[nn] = 0;
- }
-
- return FT_Err_Ok;
- }
-
-
- FT_LOCAL_DEF( FT_Error )
- T1_Load_Glyph( FT_GlyphSlot t1glyph, /* T1_GlyphSlot */
- FT_Size t1size, /* T1_Size */
- FT_UInt glyph_index,
- FT_Int32 load_flags )
- {
- T1_GlyphSlot glyph = (T1_GlyphSlot)t1glyph;
- FT_Error error;
- T1_DecoderRec decoder;
- T1_Face face = (T1_Face)t1glyph->face;
- FT_Bool hinting;
- T1_Font type1 = &face->type1;
- PSAux_Service psaux = (PSAux_Service)face->psaux;
- const T1_Decoder_Funcs decoder_funcs = psaux->t1_decoder_funcs;
-
- FT_Matrix font_matrix;
- FT_Vector font_offset;
- FT_Data glyph_data;
- FT_Bool must_finish_decoder = FALSE;
-#ifdef FT_CONFIG_OPTION_INCREMENTAL
- FT_Bool glyph_data_loaded = 0;
-#endif
-
-
-#ifdef FT_CONFIG_OPTION_INCREMENTAL
- if ( glyph_index >= (FT_UInt)face->root.num_glyphs &&
- !face->root.internal->incremental_interface )
-#else
- if ( glyph_index >= (FT_UInt)face->root.num_glyphs )
-#endif /* FT_CONFIG_OPTION_INCREMENTAL */
- {
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- FT_TRACE1(( "T1_Load_Glyph: glyph index %d\n", glyph_index ));
-
- FT_ASSERT( ( face->len_buildchar == 0 ) == ( face->buildchar == NULL ) );
-
- if ( load_flags & FT_LOAD_NO_RECURSE )
- load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING;
-
- if ( t1size )
- {
- glyph->x_scale = t1size->metrics.x_scale;
- glyph->y_scale = t1size->metrics.y_scale;
- }
- else
- {
- glyph->x_scale = 0x10000L;
- glyph->y_scale = 0x10000L;
- }
-
- t1glyph->outline.n_points = 0;
- t1glyph->outline.n_contours = 0;
-
- hinting = FT_BOOL( ( load_flags & FT_LOAD_NO_SCALE ) == 0 &&
- ( load_flags & FT_LOAD_NO_HINTING ) == 0 );
-
- t1glyph->format = FT_GLYPH_FORMAT_OUTLINE;
-
- error = decoder_funcs->init( &decoder,
- t1glyph->face,
- t1size,
- t1glyph,
- (FT_Byte**)type1->glyph_names,
- face->blend,
- FT_BOOL( hinting ),
- FT_LOAD_TARGET_MODE( load_flags ),
- T1_Parse_Glyph );
- if ( error )
- goto Exit;
-
- must_finish_decoder = TRUE;
-
- decoder.builder.no_recurse = FT_BOOL(
- ( load_flags & FT_LOAD_NO_RECURSE ) != 0 );
-
- decoder.num_subrs = type1->num_subrs;
- decoder.subrs = type1->subrs;
- decoder.subrs_len = type1->subrs_len;
-
- decoder.buildchar = face->buildchar;
- decoder.len_buildchar = face->len_buildchar;
-
- /* now load the unscaled outline */
- error = T1_Parse_Glyph_And_Get_Char_String( &decoder, glyph_index,
- &glyph_data );
- if ( error )
- goto Exit;
-#ifdef FT_CONFIG_OPTION_INCREMENTAL
- glyph_data_loaded = 1;
-#endif
-
- font_matrix = decoder.font_matrix;
- font_offset = decoder.font_offset;
-
- /* save new glyph tables */
- decoder_funcs->done( &decoder );
-
- must_finish_decoder = FALSE;
-
- /* now, set the metrics -- this is rather simple, as */
- /* the left side bearing is the xMin, and the top side */
- /* bearing the yMax */
- if ( !error )
- {
- t1glyph->outline.flags &= FT_OUTLINE_OWNER;
- t1glyph->outline.flags |= FT_OUTLINE_REVERSE_FILL;
-
- /* for composite glyphs, return only left side bearing and */
- /* advance width */
- if ( load_flags & FT_LOAD_NO_RECURSE )
- {
- FT_Slot_Internal internal = t1glyph->internal;
-
-
- t1glyph->metrics.horiBearingX =
- FIXED_TO_INT( decoder.builder.left_bearing.x );
- t1glyph->metrics.horiAdvance =
- FIXED_TO_INT( decoder.builder.advance.x );
-
- internal->glyph_matrix = font_matrix;
- internal->glyph_delta = font_offset;
- internal->glyph_transformed = 1;
- }
- else
- {
- FT_BBox cbox;
- FT_Glyph_Metrics* metrics = &t1glyph->metrics;
-
-
- /* copy the _unscaled_ advance width */
- metrics->horiAdvance =
- FIXED_TO_INT( decoder.builder.advance.x );
- t1glyph->linearHoriAdvance =
- FIXED_TO_INT( decoder.builder.advance.x );
- t1glyph->internal->glyph_transformed = 0;
-
- if ( load_flags & FT_LOAD_VERTICAL_LAYOUT )
- {
- /* make up vertical ones */
- metrics->vertAdvance = ( face->type1.font_bbox.yMax -
- face->type1.font_bbox.yMin ) >> 16;
- t1glyph->linearVertAdvance = metrics->vertAdvance;
- }
- else
- {
- metrics->vertAdvance =
- FIXED_TO_INT( decoder.builder.advance.y );
- t1glyph->linearVertAdvance =
- FIXED_TO_INT( decoder.builder.advance.y );
- }
-
- t1glyph->format = FT_GLYPH_FORMAT_OUTLINE;
-
- if ( t1size && t1size->metrics.y_ppem < 24 )
- t1glyph->outline.flags |= FT_OUTLINE_HIGH_PRECISION;
-
-#if 1
- /* apply the font matrix, if any */
- if ( font_matrix.xx != 0x10000L || font_matrix.yy != 0x10000L ||
- font_matrix.xy != 0 || font_matrix.yx != 0 )
- {
- FT_Outline_Transform( &t1glyph->outline, &font_matrix );
-
- metrics->horiAdvance = FT_MulFix( metrics->horiAdvance,
- font_matrix.xx );
- metrics->vertAdvance = FT_MulFix( metrics->vertAdvance,
- font_matrix.yy );
- }
-
- if ( font_offset.x || font_offset.y )
- {
- FT_Outline_Translate( &t1glyph->outline,
- font_offset.x,
- font_offset.y );
-
- metrics->horiAdvance += font_offset.x;
- metrics->vertAdvance += font_offset.y;
- }
-#endif
-
- if ( ( load_flags & FT_LOAD_NO_SCALE ) == 0 )
- {
- /* scale the outline and the metrics */
- FT_Int n;
- FT_Outline* cur = decoder.builder.base;
- FT_Vector* vec = cur->points;
- FT_Fixed x_scale = glyph->x_scale;
- FT_Fixed y_scale = glyph->y_scale;
-
-
- /* First of all, scale the points, if we are not hinting */
- if ( !hinting || ! decoder.builder.hints_funcs )
- for ( n = cur->n_points; n > 0; n--, vec++ )
- {
- vec->x = FT_MulFix( vec->x, x_scale );
- vec->y = FT_MulFix( vec->y, y_scale );
- }
-
- /* Then scale the metrics */
- metrics->horiAdvance = FT_MulFix( metrics->horiAdvance, x_scale );
- metrics->vertAdvance = FT_MulFix( metrics->vertAdvance, y_scale );
- }
-
- /* compute the other metrics */
- FT_Outline_Get_CBox( &t1glyph->outline, &cbox );
-
- metrics->width = cbox.xMax - cbox.xMin;
- metrics->height = cbox.yMax - cbox.yMin;
-
- metrics->horiBearingX = cbox.xMin;
- metrics->horiBearingY = cbox.yMax;
-
- if ( load_flags & FT_LOAD_VERTICAL_LAYOUT )
- {
- /* make up vertical ones */
- ft_synthesize_vertical_metrics( metrics,
- metrics->vertAdvance );
- }
- }
-
- /* Set control data to the glyph charstrings. Note that this is */
- /* _not_ zero-terminated. */
- t1glyph->control_data = (FT_Byte*)glyph_data.pointer;
- t1glyph->control_len = glyph_data.length;
- }
-
-
- Exit:
-
-#ifdef FT_CONFIG_OPTION_INCREMENTAL
- if ( glyph_data_loaded && face->root.internal->incremental_interface )
- {
- face->root.internal->incremental_interface->funcs->free_glyph_data(
- face->root.internal->incremental_interface->object,
- &glyph_data );
-
- /* Set the control data to null - it is no longer available if */
- /* loaded incrementally. */
- t1glyph->control_data = NULL;
- t1glyph->control_len = 0;
- }
-#endif
-
- if ( must_finish_decoder )
- decoder_funcs->done( &decoder );
-
- return error;
- }
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/type1/t1gload.h b/chromium/third_party/pdfium/third_party/freetype/src/type1/t1gload.h
deleted file mode 100644
index 05f60d586a1..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/type1/t1gload.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/***************************************************************************/
-/* */
-/* t1gload.h */
-/* */
-/* Type 1 Glyph Loader (specification). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __T1GLOAD_H__
-#define __T1GLOAD_H__
-
-
-#include <ft2build.h>
-#include "t1objs.h"
-
-
-FT_BEGIN_HEADER
-
-
- FT_LOCAL( FT_Error )
- T1_Compute_Max_Advance( T1_Face face,
- FT_Pos* max_advance );
-
- FT_LOCAL( FT_Error )
- T1_Get_Advances( FT_Face face,
- FT_UInt first,
- FT_UInt count,
- FT_Int32 load_flags,
- FT_Fixed* advances );
-
- FT_LOCAL( FT_Error )
- T1_Load_Glyph( FT_GlyphSlot glyph,
- FT_Size size,
- FT_UInt glyph_index,
- FT_Int32 load_flags );
-
-
-FT_END_HEADER
-
-#endif /* __T1GLOAD_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/type1/t1load.c b/chromium/third_party/pdfium/third_party/freetype/src/type1/t1load.c
deleted file mode 100644
index dbf4eafd716..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/type1/t1load.c
+++ /dev/null
@@ -1,2320 +0,0 @@
-/***************************************************************************/
-/* */
-/* t1load.c */
-/* */
-/* Type 1 font loader (body). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* This is the new and improved Type 1 data loader for FreeType 2. The */
- /* old loader has several problems: it is slow, complex, difficult to */
- /* maintain, and contains incredible hacks to make it accept some */
- /* ill-formed Type 1 fonts without hiccup-ing. Moreover, about 5% of */
- /* the Type 1 fonts on my machine still aren't loaded correctly by it. */
- /* */
- /* This version is much simpler, much faster and also easier to read and */
- /* maintain by a great order of magnitude. The idea behind it is to */
- /* _not_ try to read the Type 1 token stream with a state machine (i.e. */
- /* a Postscript-like interpreter) but rather to perform simple pattern */
- /* matching. */
- /* */
- /* Indeed, nearly all data definitions follow a simple pattern like */
- /* */
- /* ... /Field <data> ... */
- /* */
- /* where <data> can be a number, a boolean, a string, or an array of */
- /* numbers. There are a few exceptions, namely the encoding, font name, */
- /* charstrings, and subrs; they are handled with a special pattern */
- /* matching routine. */
- /* */
- /* All other common cases are handled very simply. The matching rules */
- /* are defined in the file `t1tokens.h' through the use of several */
- /* macros calls PARSE_XXX. This file is included twice here; the first */
- /* time to generate parsing callback functions, the second time to */
- /* generate a table of keywords (with pointers to the associated */
- /* callback functions). */
- /* */
- /* The function `parse_dict' simply scans *linearly* a given dictionary */
- /* (either the top-level or private one) and calls the appropriate */
- /* callback when it encounters an immediate keyword. */
- /* */
- /* This is by far the fastest way one can find to parse and read all */
- /* data. */
- /* */
- /* This led to tremendous code size reduction. Note that later, the */
- /* glyph loader will also be _greatly_ simplified, and the automatic */
- /* hinter will replace the clumsy `t1hinter'. */
- /* */
- /*************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_CONFIG_CONFIG_H
-#include FT_MULTIPLE_MASTERS_H
-#include FT_INTERNAL_TYPE1_TYPES_H
-#include FT_INTERNAL_CALC_H
-
-#include "t1load.h"
-#include "t1errors.h"
-
-
-#ifdef FT_CONFIG_OPTION_INCREMENTAL
-#define IS_INCREMENTAL (FT_Bool)( face->root.internal->incremental_interface != 0 )
-#else
-#define IS_INCREMENTAL 0
-#endif
-
-
- /*************************************************************************/
- /* */
- /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
- /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
- /* messages during execution. */
- /* */
-#undef FT_COMPONENT
-#define FT_COMPONENT trace_t1load
-
-
-#ifndef T1_CONFIG_OPTION_NO_MM_SUPPORT
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** MULTIPLE MASTERS SUPPORT *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
- static FT_Error
- t1_allocate_blend( T1_Face face,
- FT_UInt num_designs,
- FT_UInt num_axis )
- {
- PS_Blend blend;
- FT_Memory memory = face->root.memory;
- FT_Error error = FT_Err_Ok;
-
-
- blend = face->blend;
- if ( !blend )
- {
- if ( FT_NEW( blend ) )
- goto Exit;
-
- blend->num_default_design_vector = 0;
-
- face->blend = blend;
- }
-
- /* allocate design data if needed */
- if ( num_designs > 0 )
- {
- if ( blend->num_designs == 0 )
- {
- FT_UInt nn;
-
-
- /* allocate the blend `private' and `font_info' dictionaries */
- if ( FT_NEW_ARRAY( blend->font_infos[1], num_designs ) ||
- FT_NEW_ARRAY( blend->privates [1], num_designs ) ||
- FT_NEW_ARRAY( blend->bboxes [1], num_designs ) ||
- FT_NEW_ARRAY( blend->weight_vector, num_designs * 2 ) )
- goto Exit;
-
- blend->default_weight_vector = blend->weight_vector + num_designs;
-
- blend->font_infos[0] = &face->type1.font_info;
- blend->privates [0] = &face->type1.private_dict;
- blend->bboxes [0] = &face->type1.font_bbox;
-
- for ( nn = 2; nn <= num_designs; nn++ )
- {
- blend->font_infos[nn] = blend->font_infos[nn - 1] + 1;
- blend->privates [nn] = blend->privates [nn - 1] + 1;
- blend->bboxes [nn] = blend->bboxes [nn - 1] + 1;
- }
-
- blend->num_designs = num_designs;
- }
- else if ( blend->num_designs != num_designs )
- goto Fail;
- }
-
- /* allocate axis data if needed */
- if ( num_axis > 0 )
- {
- if ( blend->num_axis != 0 && blend->num_axis != num_axis )
- goto Fail;
-
- blend->num_axis = num_axis;
- }
-
- /* allocate the blend design pos table if needed */
- num_designs = blend->num_designs;
- num_axis = blend->num_axis;
- if ( num_designs && num_axis && blend->design_pos[0] == 0 )
- {
- FT_UInt n;
-
-
- if ( FT_NEW_ARRAY( blend->design_pos[0], num_designs * num_axis ) )
- goto Exit;
-
- for ( n = 1; n < num_designs; n++ )
- blend->design_pos[n] = blend->design_pos[0] + num_axis * n;
- }
-
- Exit:
- return error;
-
- Fail:
- error = FT_THROW( Invalid_File_Format );
- goto Exit;
- }
-
-
- FT_LOCAL_DEF( FT_Error )
- T1_Get_Multi_Master( T1_Face face,
- FT_Multi_Master* master )
- {
- PS_Blend blend = face->blend;
- FT_UInt n;
- FT_Error error;
-
-
- error = FT_THROW( Invalid_Argument );
-
- if ( blend )
- {
- master->num_axis = blend->num_axis;
- master->num_designs = blend->num_designs;
-
- for ( n = 0; n < blend->num_axis; n++ )
- {
- FT_MM_Axis* axis = master->axis + n;
- PS_DesignMap map = blend->design_map + n;
-
-
- axis->name = blend->axis_names[n];
- axis->minimum = map->design_points[0];
- axis->maximum = map->design_points[map->num_points - 1];
- }
-
- error = FT_Err_Ok;
- }
-
- return error;
- }
-
-
- /*************************************************************************/
- /* */
- /* Given a normalized (blend) coordinate, figure out the design */
- /* coordinate appropriate for that value. */
- /* */
- static FT_Fixed
- mm_axis_unmap( PS_DesignMap axismap,
- FT_Fixed ncv )
- {
- int j;
-
-
- if ( ncv <= axismap->blend_points[0] )
- return INT_TO_FIXED( axismap->design_points[0] );
-
- for ( j = 1; j < axismap->num_points; ++j )
- {
- if ( ncv <= axismap->blend_points[j] )
- return INT_TO_FIXED( axismap->design_points[j - 1] ) +
- ( axismap->design_points[j] - axismap->design_points[j - 1] ) *
- FT_DivFix( ncv - axismap->blend_points[j - 1],
- axismap->blend_points[j] -
- axismap->blend_points[j - 1] );
- }
-
- return INT_TO_FIXED( axismap->design_points[axismap->num_points - 1] );
- }
-
-
- /*************************************************************************/
- /* */
- /* Given a vector of weights, one for each design, figure out the */
- /* normalized axis coordinates which gave rise to those weights. */
- /* */
- static void
- mm_weights_unmap( FT_Fixed* weights,
- FT_Fixed* axiscoords,
- FT_UInt axis_count )
- {
- FT_ASSERT( axis_count <= T1_MAX_MM_AXIS );
-
- if ( axis_count == 1 )
- axiscoords[0] = weights[1];
-
- else if ( axis_count == 2 )
- {
- axiscoords[0] = weights[3] + weights[1];
- axiscoords[1] = weights[3] + weights[2];
- }
-
- else if ( axis_count == 3 )
- {
- axiscoords[0] = weights[7] + weights[5] + weights[3] + weights[1];
- axiscoords[1] = weights[7] + weights[6] + weights[3] + weights[2];
- axiscoords[2] = weights[7] + weights[6] + weights[5] + weights[4];
- }
-
- else
- {
- axiscoords[0] = weights[15] + weights[13] + weights[11] + weights[9] +
- weights[7] + weights[5] + weights[3] + weights[1];
- axiscoords[1] = weights[15] + weights[14] + weights[11] + weights[10] +
- weights[7] + weights[6] + weights[3] + weights[2];
- axiscoords[2] = weights[15] + weights[14] + weights[13] + weights[12] +
- weights[7] + weights[6] + weights[5] + weights[4];
- axiscoords[3] = weights[15] + weights[14] + weights[13] + weights[12] +
- weights[11] + weights[10] + weights[9] + weights[8];
- }
- }
-
-
- /*************************************************************************/
- /* */
- /* Just a wrapper around T1_Get_Multi_Master to support the different */
- /* arguments needed by the GX var distortable fonts. */
- /* */
- FT_LOCAL_DEF( FT_Error )
- T1_Get_MM_Var( T1_Face face,
- FT_MM_Var* *master )
- {
- FT_Memory memory = face->root.memory;
- FT_MM_Var *mmvar = NULL;
- FT_Multi_Master mmaster;
- FT_Error error;
- FT_UInt i;
- FT_Fixed axiscoords[T1_MAX_MM_AXIS];
- PS_Blend blend = face->blend;
-
-
- error = T1_Get_Multi_Master( face, &mmaster );
- if ( error )
- goto Exit;
- if ( FT_ALLOC( mmvar,
- sizeof ( FT_MM_Var ) +
- mmaster.num_axis * sizeof ( FT_Var_Axis ) ) )
- goto Exit;
-
- mmvar->num_axis = mmaster.num_axis;
- mmvar->num_designs = mmaster.num_designs;
- mmvar->num_namedstyles = ~0U; /* Does not apply */
- mmvar->axis = (FT_Var_Axis*)&mmvar[1];
- /* Point to axes after MM_Var struct */
- mmvar->namedstyle = NULL;
-
- for ( i = 0 ; i < mmaster.num_axis; ++i )
- {
- mmvar->axis[i].name = mmaster.axis[i].name;
- mmvar->axis[i].minimum = INT_TO_FIXED( mmaster.axis[i].minimum);
- mmvar->axis[i].maximum = INT_TO_FIXED( mmaster.axis[i].maximum);
- mmvar->axis[i].def = ( mmvar->axis[i].minimum +
- mmvar->axis[i].maximum ) / 2;
- /* Does not apply. But this value is in range */
- mmvar->axis[i].strid = ~0U; /* Does not apply */
- mmvar->axis[i].tag = ~0U; /* Does not apply */
-
- if ( ft_strcmp( mmvar->axis[i].name, "Weight" ) == 0 )
- mmvar->axis[i].tag = FT_MAKE_TAG( 'w', 'g', 'h', 't' );
- else if ( ft_strcmp( mmvar->axis[i].name, "Width" ) == 0 )
- mmvar->axis[i].tag = FT_MAKE_TAG( 'w', 'd', 't', 'h' );
- else if ( ft_strcmp( mmvar->axis[i].name, "OpticalSize" ) == 0 )
- mmvar->axis[i].tag = FT_MAKE_TAG( 'o', 'p', 's', 'z' );
- }
-
- if ( blend->num_designs == ( 1U << blend->num_axis ) )
- {
- mm_weights_unmap( blend->default_weight_vector,
- axiscoords,
- blend->num_axis );
-
- for ( i = 0; i < mmaster.num_axis; ++i )
- mmvar->axis[i].def = mm_axis_unmap( &blend->design_map[i],
- axiscoords[i] );
- }
-
- *master = mmvar;
-
- Exit:
- return error;
- }
-
-
- FT_LOCAL_DEF( FT_Error )
- T1_Set_MM_Blend( T1_Face face,
- FT_UInt num_coords,
- FT_Fixed* coords )
- {
- PS_Blend blend = face->blend;
- FT_UInt n, m;
-
-
- if ( !blend )
- return FT_THROW( Invalid_Argument );
-
- if ( num_coords > blend->num_axis )
- num_coords = blend->num_axis;
-
- /* recompute the weight vector from the blend coordinates */
- for ( n = 0; n < blend->num_designs; n++ )
- {
- FT_Fixed result = 0x10000L; /* 1.0 fixed */
-
-
- for ( m = 0; m < blend->num_axis; m++ )
- {
- FT_Fixed factor;
-
-
- /* get current blend axis position; */
- /* use a default value if we don't have a coordinate */
- factor = m < num_coords ? coords[m] : 0x8000;
- if ( factor < 0 )
- factor = 0;
- if ( factor > 0x10000L )
- factor = 0x10000L;
-
- if ( ( n & ( 1 << m ) ) == 0 )
- factor = 0x10000L - factor;
-
- result = FT_MulFix( result, factor );
- }
- blend->weight_vector[n] = result;
- }
-
- return FT_Err_Ok;
- }
-
-
- FT_LOCAL_DEF( FT_Error )
- T1_Set_MM_Design( T1_Face face,
- FT_UInt num_coords,
- FT_Long* coords )
- {
- PS_Blend blend = face->blend;
- FT_UInt n, p;
- FT_Fixed final_blends[T1_MAX_MM_DESIGNS];
-
-
- if ( !blend )
- return FT_THROW( Invalid_Argument );
-
- if ( num_coords > blend->num_axis )
- num_coords = blend->num_axis;
-
- /* compute the blend coordinates through the blend design map */
-
- for ( n = 0; n < blend->num_axis; n++ )
- {
- FT_Long design;
- FT_Fixed the_blend;
- PS_DesignMap map = blend->design_map + n;
- FT_Long* designs = map->design_points;
- FT_Fixed* blends = map->blend_points;
- FT_Int before = -1, after = -1;
-
-
- /* use a default value if we don't have a coordinate */
- if ( n < num_coords )
- design = coords[n];
- else
- design = ( designs[map->num_points - 1] - designs[0] ) / 2;
-
- for ( p = 0; p < (FT_UInt)map->num_points; p++ )
- {
- FT_Long p_design = designs[p];
-
-
- /* exact match? */
- if ( design == p_design )
- {
- the_blend = blends[p];
- goto Found;
- }
-
- if ( design < p_design )
- {
- after = (FT_Int)p;
- break;
- }
-
- before = (FT_Int)p;
- }
-
- /* now interpolate if necessary */
- if ( before < 0 )
- the_blend = blends[0];
-
- else if ( after < 0 )
- the_blend = blends[map->num_points - 1];
-
- else
- the_blend = FT_MulDiv( design - designs[before],
- blends [after] - blends [before],
- designs[after] - designs[before] );
-
- Found:
- final_blends[n] = the_blend;
- }
-
- return T1_Set_MM_Blend( face, blend->num_axis, final_blends );
- }
-
-
- /*************************************************************************/
- /* */
- /* Just a wrapper around T1_Set_MM_Design to support the different */
- /* arguments needed by the GX var distortable fonts. */
- /* */
- FT_LOCAL_DEF( FT_Error )
- T1_Set_Var_Design( T1_Face face,
- FT_UInt num_coords,
- FT_Fixed* coords )
- {
- FT_Long lcoords[T1_MAX_MM_AXIS];
- FT_UInt i;
-
-
- if ( num_coords > T1_MAX_MM_AXIS )
- num_coords = T1_MAX_MM_AXIS;
-
- for ( i = 0; i < num_coords; ++i )
- lcoords[i] = FIXED_TO_INT( coords[i] );
-
- return T1_Set_MM_Design( face, num_coords, lcoords );
- }
-
-
- FT_LOCAL_DEF( void )
- T1_Done_Blend( T1_Face face )
- {
- FT_Memory memory = face->root.memory;
- PS_Blend blend = face->blend;
-
-
- if ( blend )
- {
- FT_UInt num_designs = blend->num_designs;
- FT_UInt num_axis = blend->num_axis;
- FT_UInt n;
-
-
- /* release design pos table */
- FT_FREE( blend->design_pos[0] );
- for ( n = 1; n < num_designs; n++ )
- blend->design_pos[n] = NULL;
-
- /* release blend `private' and `font info' dictionaries */
- FT_FREE( blend->privates[1] );
- FT_FREE( blend->font_infos[1] );
- FT_FREE( blend->bboxes[1] );
-
- for ( n = 0; n < num_designs; n++ )
- {
- blend->privates [n] = NULL;
- blend->font_infos[n] = NULL;
- blend->bboxes [n] = NULL;
- }
-
- /* release weight vectors */
- FT_FREE( blend->weight_vector );
- blend->default_weight_vector = NULL;
-
- /* release axis names */
- for ( n = 0; n < num_axis; n++ )
- FT_FREE( blend->axis_names[n] );
-
- /* release design map */
- for ( n = 0; n < num_axis; n++ )
- {
- PS_DesignMap dmap = blend->design_map + n;
-
-
- FT_FREE( dmap->design_points );
- dmap->num_points = 0;
- }
-
- FT_FREE( face->blend );
- }
- }
-
-
- static void
- parse_blend_axis_types( T1_Face face,
- T1_Loader loader )
- {
- T1_TokenRec axis_tokens[T1_MAX_MM_AXIS];
- FT_Int n, num_axis;
- FT_Error error = FT_Err_Ok;
- PS_Blend blend;
- FT_Memory memory;
-
-
- /* take an array of objects */
- T1_ToTokenArray( &loader->parser, axis_tokens,
- T1_MAX_MM_AXIS, &num_axis );
- if ( num_axis < 0 )
- {
- error = FT_ERR( Ignore );
- goto Exit;
- }
- if ( num_axis == 0 || num_axis > T1_MAX_MM_AXIS )
- {
- FT_ERROR(( "parse_blend_axis_types: incorrect number of axes: %d\n",
- num_axis ));
- error = FT_THROW( Invalid_File_Format );
- goto Exit;
- }
-
- /* allocate blend if necessary */
- error = t1_allocate_blend( face, 0, (FT_UInt)num_axis );
- if ( error )
- goto Exit;
-
- blend = face->blend;
- memory = face->root.memory;
-
- /* each token is an immediate containing the name of the axis */
- for ( n = 0; n < num_axis; n++ )
- {
- T1_Token token = axis_tokens + n;
- FT_Byte* name;
- FT_UInt len;
-
-
- /* skip first slash, if any */
- if ( token->start[0] == '/' )
- token->start++;
-
- len = (FT_UInt)( token->limit - token->start );
- if ( len == 0 )
- {
- error = FT_THROW( Invalid_File_Format );
- goto Exit;
- }
-
- name = (FT_Byte*)blend->axis_names[n];
- if ( name )
- {
- FT_TRACE0(( "parse_blend_axis_types:"
- " overwriting axis name `%s' with `%*.s'\n",
- name, len, token->start ));
- FT_FREE( name );
- }
-
- if ( FT_ALLOC( blend->axis_names[n], len + 1 ) )
- goto Exit;
-
- name = (FT_Byte*)blend->axis_names[n];
- FT_MEM_COPY( name, token->start, len );
- name[len] = '\0';
- }
-
- Exit:
- loader->parser.root.error = error;
- }
-
-
- static void
- parse_blend_design_positions( T1_Face face,
- T1_Loader loader )
- {
- T1_TokenRec design_tokens[T1_MAX_MM_DESIGNS];
- FT_Int num_designs;
- FT_Int num_axis;
- T1_Parser parser = &loader->parser;
-
- FT_Error error = FT_Err_Ok;
- PS_Blend blend;
-
-
- /* get the array of design tokens -- compute number of designs */
- T1_ToTokenArray( parser, design_tokens,
- T1_MAX_MM_DESIGNS, &num_designs );
- if ( num_designs < 0 )
- {
- error = FT_ERR( Ignore );
- goto Exit;
- }
- if ( num_designs == 0 || num_designs > T1_MAX_MM_DESIGNS )
- {
- FT_ERROR(( "parse_blend_design_positions:"
- " incorrect number of designs: %d\n",
- num_designs ));
- error = FT_THROW( Invalid_File_Format );
- goto Exit;
- }
-
- {
- FT_Byte* old_cursor = parser->root.cursor;
- FT_Byte* old_limit = parser->root.limit;
- FT_Int n;
-
-
- blend = face->blend;
- num_axis = 0; /* make compiler happy */
-
- for ( n = 0; n < num_designs; n++ )
- {
- T1_TokenRec axis_tokens[T1_MAX_MM_AXIS];
- T1_Token token;
- FT_Int axis, n_axis;
-
-
- /* read axis/coordinates tokens */
- token = design_tokens + n;
- parser->root.cursor = token->start;
- parser->root.limit = token->limit;
- T1_ToTokenArray( parser, axis_tokens, T1_MAX_MM_AXIS, &n_axis );
-
- if ( n == 0 )
- {
- if ( n_axis <= 0 || n_axis > T1_MAX_MM_AXIS )
- {
- FT_ERROR(( "parse_blend_design_positions:"
- " invalid number of axes: %d\n",
- n_axis ));
- error = FT_THROW( Invalid_File_Format );
- goto Exit;
- }
-
- num_axis = n_axis;
- error = t1_allocate_blend( face,
- (FT_UInt)num_designs,
- (FT_UInt)num_axis );
- if ( error )
- goto Exit;
- blend = face->blend;
- }
- else if ( n_axis != num_axis )
- {
- FT_ERROR(( "parse_blend_design_positions: incorrect table\n" ));
- error = FT_THROW( Invalid_File_Format );
- goto Exit;
- }
-
- /* now read each axis token into the design position */
- for ( axis = 0; axis < n_axis; axis++ )
- {
- T1_Token token2 = axis_tokens + axis;
-
-
- parser->root.cursor = token2->start;
- parser->root.limit = token2->limit;
- blend->design_pos[n][axis] = T1_ToFixed( parser, 0 );
- }
- }
-
- loader->parser.root.cursor = old_cursor;
- loader->parser.root.limit = old_limit;
- }
-
- Exit:
- loader->parser.root.error = error;
- }
-
-
- static void
- parse_blend_design_map( T1_Face face,
- T1_Loader loader )
- {
- FT_Error error = FT_Err_Ok;
- T1_Parser parser = &loader->parser;
- PS_Blend blend;
- T1_TokenRec axis_tokens[T1_MAX_MM_AXIS];
- FT_Int n, num_axis;
- FT_Byte* old_cursor;
- FT_Byte* old_limit;
- FT_Memory memory = face->root.memory;
-
-
- T1_ToTokenArray( parser, axis_tokens,
- T1_MAX_MM_AXIS, &num_axis );
- if ( num_axis < 0 )
- {
- error = FT_ERR( Ignore );
- goto Exit;
- }
- if ( num_axis == 0 || num_axis > T1_MAX_MM_AXIS )
- {
- FT_ERROR(( "parse_blend_design_map: incorrect number of axes: %d\n",
- num_axis ));
- error = FT_THROW( Invalid_File_Format );
- goto Exit;
- }
-
- old_cursor = parser->root.cursor;
- old_limit = parser->root.limit;
-
- error = t1_allocate_blend( face, 0, (FT_UInt)num_axis );
- if ( error )
- goto Exit;
- blend = face->blend;
-
- /* now read each axis design map */
- for ( n = 0; n < num_axis; n++ )
- {
- PS_DesignMap map = blend->design_map + n;
- T1_Token axis_token;
- T1_TokenRec point_tokens[T1_MAX_MM_MAP_POINTS];
- FT_Int p, num_points;
-
-
- axis_token = axis_tokens + n;
-
- parser->root.cursor = axis_token->start;
- parser->root.limit = axis_token->limit;
- T1_ToTokenArray( parser, point_tokens,
- T1_MAX_MM_MAP_POINTS, &num_points );
-
- if ( num_points <= 0 || num_points > T1_MAX_MM_MAP_POINTS )
- {
- FT_ERROR(( "parse_blend_design_map: incorrect table\n" ));
- error = FT_THROW( Invalid_File_Format );
- goto Exit;
- }
-
- if ( map->design_points )
- {
- FT_ERROR(( "parse_blend_design_map: duplicate table\n" ));
- error = FT_THROW( Invalid_File_Format );
- goto Exit;
- }
-
- /* allocate design map data */
- if ( FT_NEW_ARRAY( map->design_points, num_points * 2 ) )
- goto Exit;
- map->blend_points = map->design_points + num_points;
- map->num_points = (FT_Byte)num_points;
-
- for ( p = 0; p < num_points; p++ )
- {
- T1_Token point_token;
-
-
- point_token = point_tokens + p;
-
- /* don't include delimiting brackets */
- parser->root.cursor = point_token->start + 1;
- parser->root.limit = point_token->limit - 1;
-
- map->design_points[p] = T1_ToInt( parser );
- map->blend_points [p] = T1_ToFixed( parser, 0 );
- }
- }
-
- parser->root.cursor = old_cursor;
- parser->root.limit = old_limit;
-
- Exit:
- parser->root.error = error;
- }
-
-
- static void
- parse_weight_vector( T1_Face face,
- T1_Loader loader )
- {
- T1_TokenRec design_tokens[T1_MAX_MM_DESIGNS];
- FT_Int num_designs;
- FT_Error error = FT_Err_Ok;
- T1_Parser parser = &loader->parser;
- PS_Blend blend = face->blend;
- T1_Token token;
- FT_Int n;
- FT_Byte* old_cursor;
- FT_Byte* old_limit;
-
-
- T1_ToTokenArray( parser, design_tokens,
- T1_MAX_MM_DESIGNS, &num_designs );
- if ( num_designs < 0 )
- {
- error = FT_ERR( Ignore );
- goto Exit;
- }
- if ( num_designs == 0 || num_designs > T1_MAX_MM_DESIGNS )
- {
- FT_ERROR(( "parse_weight_vector:"
- " incorrect number of designs: %d\n",
- num_designs ));
- error = FT_THROW( Invalid_File_Format );
- goto Exit;
- }
-
- if ( !blend || !blend->num_designs )
- {
- error = t1_allocate_blend( face, (FT_UInt)num_designs, 0 );
- if ( error )
- goto Exit;
- blend = face->blend;
- }
- else if ( blend->num_designs != (FT_UInt)num_designs )
- {
- FT_ERROR(( "parse_weight_vector:"
- " /BlendDesignPosition and /WeightVector have\n"
- " "
- " different number of elements\n" ));
- error = FT_THROW( Invalid_File_Format );
- goto Exit;
- }
-
- old_cursor = parser->root.cursor;
- old_limit = parser->root.limit;
-
- for ( n = 0; n < num_designs; n++ )
- {
- token = design_tokens + n;
- parser->root.cursor = token->start;
- parser->root.limit = token->limit;
-
- blend->default_weight_vector[n] =
- blend->weight_vector[n] = T1_ToFixed( parser, 0 );
- }
-
- parser->root.cursor = old_cursor;
- parser->root.limit = old_limit;
-
- Exit:
- parser->root.error = error;
- }
-
-
- /* e.g., /BuildCharArray [0 0 0 0 0 0 0 0] def */
- /* we're only interested in the number of array elements */
- static void
- parse_buildchar( T1_Face face,
- T1_Loader loader )
- {
- face->len_buildchar = (FT_UInt)T1_ToFixedArray( &loader->parser,
- 0, NULL, 0 );
- return;
- }
-
-
-#endif /* !T1_CONFIG_OPTION_NO_MM_SUPPORT */
-
-
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** TYPE 1 SYMBOL PARSING *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
- static FT_Error
- t1_load_keyword( T1_Face face,
- T1_Loader loader,
- const T1_Field field )
- {
- FT_Error error;
- void* dummy_object;
- void** objects;
- FT_UInt max_objects;
- PS_Blend blend = face->blend;
-
-
- if ( blend && blend->num_designs == 0 )
- blend = NULL;
-
- /* if the keyword has a dedicated callback, call it */
- if ( field->type == T1_FIELD_TYPE_CALLBACK )
- {
- field->reader( (FT_Face)face, loader );
- error = loader->parser.root.error;
- goto Exit;
- }
-
- /* now, the keyword is either a simple field, or a table of fields; */
- /* we are now going to take care of it */
- switch ( field->location )
- {
- case T1_FIELD_LOCATION_FONT_INFO:
- dummy_object = &face->type1.font_info;
- objects = &dummy_object;
- max_objects = 0;
-
- if ( blend )
- {
- objects = (void**)blend->font_infos;
- max_objects = blend->num_designs;
- }
- break;
-
- case T1_FIELD_LOCATION_FONT_EXTRA:
- dummy_object = &face->type1.font_extra;
- objects = &dummy_object;
- max_objects = 0;
- break;
-
- case T1_FIELD_LOCATION_PRIVATE:
- dummy_object = &face->type1.private_dict;
- objects = &dummy_object;
- max_objects = 0;
-
- if ( blend )
- {
- objects = (void**)blend->privates;
- max_objects = blend->num_designs;
- }
- break;
-
- case T1_FIELD_LOCATION_BBOX:
- dummy_object = &face->type1.font_bbox;
- objects = &dummy_object;
- max_objects = 0;
-
- if ( blend )
- {
- objects = (void**)blend->bboxes;
- max_objects = blend->num_designs;
- }
- break;
-
- case T1_FIELD_LOCATION_LOADER:
- dummy_object = loader;
- objects = &dummy_object;
- max_objects = 0;
- break;
-
- case T1_FIELD_LOCATION_FACE:
- dummy_object = face;
- objects = &dummy_object;
- max_objects = 0;
- break;
-
-#ifndef T1_CONFIG_OPTION_NO_MM_SUPPORT
- case T1_FIELD_LOCATION_BLEND:
- dummy_object = face->blend;
- objects = &dummy_object;
- max_objects = 0;
- break;
-#endif
-
- default:
- dummy_object = &face->type1;
- objects = &dummy_object;
- max_objects = 0;
- }
-
- if ( *objects )
- {
- if ( field->type == T1_FIELD_TYPE_INTEGER_ARRAY ||
- field->type == T1_FIELD_TYPE_FIXED_ARRAY )
- error = T1_Load_Field_Table( &loader->parser, field,
- objects, max_objects, 0 );
- else
- error = T1_Load_Field( &loader->parser, field,
- objects, max_objects, 0 );
- }
- else
- {
- FT_TRACE1(( "t1_load_keyword: ignoring keyword `%s'"
- " which is not valid at this point\n"
- " (probably due to missing keywords)\n",
- field->ident ));
- error = FT_Err_Ok;
- }
-
- Exit:
- return error;
- }
-
-
- static void
- parse_private( T1_Face face,
- T1_Loader loader )
- {
- FT_UNUSED( face );
-
- loader->keywords_encountered |= T1_PRIVATE;
- }
-
-
- /* return 1 in case of success */
-
- static int
- read_binary_data( T1_Parser parser,
- FT_ULong* size,
- FT_Byte** base,
- FT_Bool incremental )
- {
- FT_Byte* cur;
- FT_Byte* limit = parser->root.limit;
-
-
- /* the binary data has one of the following formats */
- /* */
- /* `size' [white*] RD white ....... ND */
- /* `size' [white*] -| white ....... |- */
- /* */
-
- T1_Skip_Spaces( parser );
-
- cur = parser->root.cursor;
-
- if ( cur < limit && ft_isdigit( *cur ) )
- {
- FT_Long s = T1_ToInt( parser );
-
-
- T1_Skip_PS_Token( parser ); /* `RD' or `-|' or something else */
-
- /* there is only one whitespace char after the */
- /* `RD' or `-|' token */
- *base = parser->root.cursor + 1;
-
- if ( s >= 0 && s < limit - *base )
- {
- parser->root.cursor += s + 1;
- *size = (FT_ULong)s;
- return !parser->root.error;
- }
- }
-
- if( !incremental )
- {
- FT_ERROR(( "read_binary_data: invalid size field\n" ));
- parser->root.error = FT_THROW( Invalid_File_Format );
- }
-
- return 0;
- }
-
-
- /* We now define the routines to handle the `/Encoding', `/Subrs', */
- /* and `/CharStrings' dictionaries. */
-
- static void
- t1_parse_font_matrix( T1_Face face,
- T1_Loader loader )
- {
- T1_Parser parser = &loader->parser;
- FT_Matrix* matrix = &face->type1.font_matrix;
- FT_Vector* offset = &face->type1.font_offset;
- FT_Face root = (FT_Face)&face->root;
- FT_Fixed temp[6];
- FT_Fixed temp_scale;
- FT_Int result;
-
-
- /* input is scaled by 1000 to accommodate default FontMatrix */
- result = T1_ToFixedArray( parser, 6, temp, 3 );
-
- if ( result < 6 )
- {
- parser->root.error = FT_THROW( Invalid_File_Format );
- return;
- }
-
- temp_scale = FT_ABS( temp[3] );
-
- if ( temp_scale == 0 )
- {
- FT_ERROR(( "t1_parse_font_matrix: invalid font matrix\n" ));
- parser->root.error = FT_THROW( Invalid_File_Format );
- return;
- }
-
- /* atypical case */
- if ( temp_scale != 0x10000L )
- {
- /* set units per EM based on FontMatrix values */
- root->units_per_EM = (FT_UShort)FT_DivFix( 1000, temp_scale );
-
- temp[0] = FT_DivFix( temp[0], temp_scale );
- temp[1] = FT_DivFix( temp[1], temp_scale );
- temp[2] = FT_DivFix( temp[2], temp_scale );
- temp[4] = FT_DivFix( temp[4], temp_scale );
- temp[5] = FT_DivFix( temp[5], temp_scale );
- temp[3] = temp[3] < 0 ? -0x10000L : 0x10000L;
- }
-
- matrix->xx = temp[0];
- matrix->yx = temp[1];
- matrix->xy = temp[2];
- matrix->yy = temp[3];
-
- /* note that the offsets must be expressed in integer font units */
- offset->x = temp[4] >> 16;
- offset->y = temp[5] >> 16;
- }
-
-
- static void
- parse_encoding( T1_Face face,
- T1_Loader loader )
- {
- T1_Parser parser = &loader->parser;
- FT_Byte* cur;
- FT_Byte* limit = parser->root.limit;
-
- PSAux_Service psaux = (PSAux_Service)face->psaux;
-
-
- T1_Skip_Spaces( parser );
- cur = parser->root.cursor;
- if ( cur >= limit )
- {
- FT_ERROR(( "parse_encoding: out of bounds\n" ));
- parser->root.error = FT_THROW( Invalid_File_Format );
- return;
- }
-
- /* if we have a number or `[', the encoding is an array, */
- /* and we must load it now */
- if ( ft_isdigit( *cur ) || *cur == '[' )
- {
- T1_Encoding encode = &face->type1.encoding;
- FT_Int count, n;
- PS_Table char_table = &loader->encoding_table;
- FT_Memory memory = parser->root.memory;
- FT_Error error;
- FT_Bool only_immediates = 0;
-
-
- /* read the number of entries in the encoding; should be 256 */
- if ( *cur == '[' )
- {
- count = 256;
- only_immediates = 1;
- parser->root.cursor++;
- }
- else
- count = (FT_Int)T1_ToInt( parser );
-
- /* only composite fonts (which we don't support) */
- /* can have larger values */
- if ( count > 256 )
- {
- FT_ERROR(( "parse_encoding: invalid encoding array size\n" ));
- parser->root.error = FT_THROW( Invalid_File_Format );
- return;
- }
-
- T1_Skip_Spaces( parser );
- if ( parser->root.cursor >= limit )
- return;
-
- /* PostScript happily allows overwriting of encoding arrays */
- if ( encode->char_index )
- {
- FT_FREE( encode->char_index );
- FT_FREE( encode->char_name );
- T1_Release_Table( char_table );
- }
-
- /* we use a T1_Table to store our charnames */
- loader->num_chars = encode->num_chars = count;
- if ( FT_NEW_ARRAY( encode->char_index, count ) ||
- FT_NEW_ARRAY( encode->char_name, count ) ||
- FT_SET_ERROR( psaux->ps_table_funcs->init(
- char_table, count, memory ) ) )
- {
- parser->root.error = error;
- return;
- }
-
- /* We need to `zero' out encoding_table.elements */
- for ( n = 0; n < count; n++ )
- {
- char* notdef = (char *)".notdef";
-
-
- (void)T1_Add_Table( char_table, n, notdef, 8 );
- }
-
- /* Now we need to read records of the form */
- /* */
- /* ... charcode /charname ... */
- /* */
- /* for each entry in our table. */
- /* */
- /* We simply look for a number followed by an immediate */
- /* name. Note that this ignores correctly the sequence */
- /* that is often seen in type1 fonts: */
- /* */
- /* 0 1 255 { 1 index exch /.notdef put } for dup */
- /* */
- /* used to clean the encoding array before anything else. */
- /* */
- /* Alternatively, if the array is directly given as */
- /* */
- /* /Encoding [ ... ] */
- /* */
- /* we only read immediates. */
-
- n = 0;
- T1_Skip_Spaces( parser );
-
- while ( parser->root.cursor < limit )
- {
- cur = parser->root.cursor;
-
- /* we stop when we encounter a `def' or `]' */
- if ( *cur == 'd' && cur + 3 < limit )
- {
- if ( cur[1] == 'e' &&
- cur[2] == 'f' &&
- IS_PS_DELIM( cur[3] ) )
- {
- FT_TRACE6(( "encoding end\n" ));
- cur += 3;
- break;
- }
- }
- if ( *cur == ']' )
- {
- FT_TRACE6(( "encoding end\n" ));
- cur++;
- break;
- }
-
- /* check whether we've found an entry */
- if ( ft_isdigit( *cur ) || only_immediates )
- {
- FT_Int charcode;
-
-
- if ( only_immediates )
- charcode = n;
- else
- {
- charcode = (FT_Int)T1_ToInt( parser );
- T1_Skip_Spaces( parser );
-
- /* protect against invalid charcode */
- if ( cur == parser->root.cursor )
- {
- parser->root.error = FT_THROW( Unknown_File_Format );
- return;
- }
- }
-
- cur = parser->root.cursor;
-
- if ( cur + 2 < limit && *cur == '/' && n < count )
- {
- FT_UInt len;
-
-
- cur++;
-
- parser->root.cursor = cur;
- T1_Skip_PS_Token( parser );
- if ( parser->root.cursor >= limit )
- return;
- if ( parser->root.error )
- return;
-
- len = (FT_UInt)( parser->root.cursor - cur );
-
- parser->root.error = T1_Add_Table( char_table, charcode,
- cur, len + 1 );
- if ( parser->root.error )
- return;
- char_table->elements[charcode][len] = '\0';
-
- n++;
- }
- else if ( only_immediates )
- {
- /* Since the current position is not updated for */
- /* immediates-only mode we would get an infinite loop if */
- /* we don't do anything here. */
- /* */
- /* This encoding array is not valid according to the type1 */
- /* specification (it might be an encoding for a CID type1 */
- /* font, however), so we conclude that this font is NOT a */
- /* type1 font. */
- parser->root.error = FT_THROW( Unknown_File_Format );
- return;
- }
- }
- else
- {
- T1_Skip_PS_Token( parser );
- if ( parser->root.error )
- return;
- }
-
- T1_Skip_Spaces( parser );
- }
-
- face->type1.encoding_type = T1_ENCODING_TYPE_ARRAY;
- parser->root.cursor = cur;
- }
-
- /* Otherwise, we should have either `StandardEncoding', */
- /* `ExpertEncoding', or `ISOLatin1Encoding' */
- else
- {
- if ( cur + 17 < limit &&
- ft_strncmp( (const char*)cur, "StandardEncoding", 16 ) == 0 )
- face->type1.encoding_type = T1_ENCODING_TYPE_STANDARD;
-
- else if ( cur + 15 < limit &&
- ft_strncmp( (const char*)cur, "ExpertEncoding", 14 ) == 0 )
- face->type1.encoding_type = T1_ENCODING_TYPE_EXPERT;
-
- else if ( cur + 18 < limit &&
- ft_strncmp( (const char*)cur, "ISOLatin1Encoding", 17 ) == 0 )
- face->type1.encoding_type = T1_ENCODING_TYPE_ISOLATIN1;
-
- else
- parser->root.error = FT_ERR( Ignore );
- }
- }
-
-
- static void
- parse_subrs( T1_Face face,
- T1_Loader loader )
- {
- T1_Parser parser = &loader->parser;
- PS_Table table = &loader->subrs;
- FT_Memory memory = parser->root.memory;
- FT_Error error;
- FT_Int num_subrs;
-
- PSAux_Service psaux = (PSAux_Service)face->psaux;
-
-
- T1_Skip_Spaces( parser );
-
- /* test for empty array */
- if ( parser->root.cursor < parser->root.limit &&
- *parser->root.cursor == '[' )
- {
- T1_Skip_PS_Token( parser );
- T1_Skip_Spaces ( parser );
- if ( parser->root.cursor >= parser->root.limit ||
- *parser->root.cursor != ']' )
- parser->root.error = FT_THROW( Invalid_File_Format );
- return;
- }
-
- num_subrs = (FT_Int)T1_ToInt( parser );
-
- /* position the parser right before the `dup' of the first subr */
- T1_Skip_PS_Token( parser ); /* `array' */
- if ( parser->root.error )
- return;
- T1_Skip_Spaces( parser );
-
- /* initialize subrs array -- with synthetic fonts it is possible */
- /* we get here twice */
- if ( !loader->num_subrs )
- {
- error = psaux->ps_table_funcs->init( table, num_subrs, memory );
- if ( error )
- goto Fail;
- }
-
- /* the format is simple: */
- /* */
- /* `index' + binary data */
- /* */
- for (;;)
- {
- FT_Long idx;
- FT_ULong size;
- FT_Byte* base;
-
-
- /* If we are out of data, or if the next token isn't `dup', */
- /* we are done. */
- if ( parser->root.cursor + 4 >= parser->root.limit ||
- ft_strncmp( (char*)parser->root.cursor, "dup", 3 ) != 0 )
- break;
-
- T1_Skip_PS_Token( parser ); /* `dup' */
-
- idx = T1_ToInt( parser );
-
- if ( !read_binary_data( parser, &size, &base, IS_INCREMENTAL ) )
- return;
-
- /* The binary string is followed by one token, e.g. `NP' */
- /* (bound to `noaccess put') or by two separate tokens: */
- /* `noaccess' & `put'. We position the parser right */
- /* before the next `dup', if any. */
- T1_Skip_PS_Token( parser ); /* `NP' or `|' or `noaccess' */
- if ( parser->root.error )
- return;
- T1_Skip_Spaces ( parser );
-
- if ( parser->root.cursor + 4 < parser->root.limit &&
- ft_strncmp( (char*)parser->root.cursor, "put", 3 ) == 0 )
- {
- T1_Skip_PS_Token( parser ); /* skip `put' */
- T1_Skip_Spaces ( parser );
- }
-
- /* with synthetic fonts it is possible we get here twice */
- if ( loader->num_subrs )
- continue;
-
- /* some fonts use a value of -1 for lenIV to indicate that */
- /* the charstrings are unencoded */
- /* */
- /* thanks to Tom Kacvinsky for pointing this out */
- /* */
- if ( face->type1.private_dict.lenIV >= 0 )
- {
- FT_Byte* temp;
-
-
- /* some fonts define empty subr records -- this is not totally */
- /* compliant to the specification (which says they should at */
- /* least contain a `return'), but we support them anyway */
- if ( size < (FT_ULong)face->type1.private_dict.lenIV )
- {
- error = FT_THROW( Invalid_File_Format );
- goto Fail;
- }
-
- /* t1_decrypt() shouldn't write to base -- make temporary copy */
- if ( FT_ALLOC( temp, size ) )
- goto Fail;
- FT_MEM_COPY( temp, base, size );
- psaux->t1_decrypt( temp, size, 4330 );
- size -= (FT_ULong)face->type1.private_dict.lenIV;
- error = T1_Add_Table( table, (FT_Int)idx,
- temp + face->type1.private_dict.lenIV, size );
- FT_FREE( temp );
- }
- else
- error = T1_Add_Table( table, (FT_Int)idx, base, size );
- if ( error )
- goto Fail;
- }
-
- if ( !loader->num_subrs )
- loader->num_subrs = num_subrs;
-
- return;
-
- Fail:
- parser->root.error = error;
- }
-
-
-#define TABLE_EXTEND 5
-
-
- static void
- parse_charstrings( T1_Face face,
- T1_Loader loader )
- {
- T1_Parser parser = &loader->parser;
- PS_Table code_table = &loader->charstrings;
- PS_Table name_table = &loader->glyph_names;
- PS_Table swap_table = &loader->swap_table;
- FT_Memory memory = parser->root.memory;
- FT_Error error;
-
- PSAux_Service psaux = (PSAux_Service)face->psaux;
-
- FT_Byte* cur = parser->root.cursor;
- FT_Byte* limit = parser->root.limit;
- FT_Int n, num_glyphs;
- FT_Int notdef_index = 0;
- FT_Byte notdef_found = 0;
-
-
- num_glyphs = (FT_Int)T1_ToInt( parser );
- if ( num_glyphs < 0 )
- {
- error = FT_THROW( Invalid_File_Format );
- goto Fail;
- }
-
- /* we certainly need more than 8 bytes per glyph */
- if ( num_glyphs > ( limit - cur ) >> 3 )
- {
- FT_TRACE0(( "parse_charstrings: adjusting number of glyphs"
- " (from %d to %d)\n",
- num_glyphs, ( limit - cur ) >> 3 ));
- num_glyphs = ( limit - cur ) >> 3;
- }
-
- /* some fonts like Optima-Oblique not only define the /CharStrings */
- /* array but access it also */
- if ( num_glyphs == 0 || parser->root.error )
- return;
-
- /* initialize tables, leaving space for addition of .notdef, */
- /* if necessary, and a few other glyphs to handle buggy */
- /* fonts which have more glyphs than specified. */
-
- /* for some non-standard fonts like `Optima' which provides */
- /* different outlines depending on the resolution it is */
- /* possible to get here twice */
- if ( !loader->num_glyphs )
- {
- error = psaux->ps_table_funcs->init(
- code_table, num_glyphs + 1 + TABLE_EXTEND, memory );
- if ( error )
- goto Fail;
-
- error = psaux->ps_table_funcs->init(
- name_table, num_glyphs + 1 + TABLE_EXTEND, memory );
- if ( error )
- goto Fail;
-
- /* Initialize table for swapping index notdef_index and */
- /* index 0 names and codes (if necessary). */
-
- error = psaux->ps_table_funcs->init( swap_table, 4, memory );
- if ( error )
- goto Fail;
- }
-
- n = 0;
-
- for (;;)
- {
- FT_ULong size;
- FT_Byte* base;
-
-
- /* the format is simple: */
- /* `/glyphname' + binary data */
-
- T1_Skip_Spaces( parser );
-
- cur = parser->root.cursor;
- if ( cur >= limit )
- break;
-
- /* we stop when we find a `def' or `end' keyword */
- if ( cur + 3 < limit && IS_PS_DELIM( cur[3] ) )
- {
- if ( cur[0] == 'd' &&
- cur[1] == 'e' &&
- cur[2] == 'f' )
- {
- /* There are fonts which have this: */
- /* */
- /* /CharStrings 118 dict def */
- /* Private begin */
- /* CharStrings begin */
- /* ... */
- /* */
- /* To catch this we ignore `def' if */
- /* no charstring has actually been */
- /* seen. */
- if ( n )
- break;
- }
-
- if ( cur[0] == 'e' &&
- cur[1] == 'n' &&
- cur[2] == 'd' )
- break;
- }
-
- T1_Skip_PS_Token( parser );
- if ( parser->root.cursor >= limit )
- {
- error = FT_THROW( Invalid_File_Format );
- goto Fail;
- }
- if ( parser->root.error )
- return;
-
- if ( *cur == '/' )
- {
- FT_UInt len;
-
-
- if ( cur + 2 >= limit )
- {
- error = FT_THROW( Invalid_File_Format );
- goto Fail;
- }
-
- cur++; /* skip `/' */
- len = (FT_UInt)( parser->root.cursor - cur );
-
- if ( !read_binary_data( parser, &size, &base, IS_INCREMENTAL ) )
- return;
-
- /* for some non-standard fonts like `Optima' which provides */
- /* different outlines depending on the resolution it is */
- /* possible to get here twice */
- if ( loader->num_glyphs )
- continue;
-
- error = T1_Add_Table( name_table, n, cur, len + 1 );
- if ( error )
- goto Fail;
-
- /* add a trailing zero to the name table */
- name_table->elements[n][len] = '\0';
-
- /* record index of /.notdef */
- if ( *cur == '.' &&
- ft_strcmp( ".notdef",
- (const char*)(name_table->elements[n]) ) == 0 )
- {
- notdef_index = n;
- notdef_found = 1;
- }
-
- if ( face->type1.private_dict.lenIV >= 0 &&
- n < num_glyphs + TABLE_EXTEND )
- {
- FT_Byte* temp;
-
-
- if ( size <= (FT_ULong)face->type1.private_dict.lenIV )
- {
- error = FT_THROW( Invalid_File_Format );
- goto Fail;
- }
-
- /* t1_decrypt() shouldn't write to base -- make temporary copy */
- if ( FT_ALLOC( temp, size ) )
- goto Fail;
- FT_MEM_COPY( temp, base, size );
- psaux->t1_decrypt( temp, size, 4330 );
- size -= (FT_ULong)face->type1.private_dict.lenIV;
- error = T1_Add_Table( code_table, n,
- temp + face->type1.private_dict.lenIV, size );
- FT_FREE( temp );
- }
- else
- error = T1_Add_Table( code_table, n, base, size );
- if ( error )
- goto Fail;
-
- n++;
- }
- }
-
- loader->num_glyphs = n;
-
- /* if /.notdef is found but does not occupy index 0, do our magic. */
- if ( notdef_found &&
- ft_strcmp( ".notdef", (const char*)name_table->elements[0] ) )
- {
- /* Swap glyph in index 0 with /.notdef glyph. First, add index 0 */
- /* name and code entries to swap_table. Then place notdef_index */
- /* name and code entries into swap_table. Then swap name and code */
- /* entries at indices notdef_index and 0 using values stored in */
- /* swap_table. */
-
- /* Index 0 name */
- error = T1_Add_Table( swap_table, 0,
- name_table->elements[0],
- name_table->lengths [0] );
- if ( error )
- goto Fail;
-
- /* Index 0 code */
- error = T1_Add_Table( swap_table, 1,
- code_table->elements[0],
- code_table->lengths [0] );
- if ( error )
- goto Fail;
-
- /* Index notdef_index name */
- error = T1_Add_Table( swap_table, 2,
- name_table->elements[notdef_index],
- name_table->lengths [notdef_index] );
- if ( error )
- goto Fail;
-
- /* Index notdef_index code */
- error = T1_Add_Table( swap_table, 3,
- code_table->elements[notdef_index],
- code_table->lengths [notdef_index] );
- if ( error )
- goto Fail;
-
- error = T1_Add_Table( name_table, notdef_index,
- swap_table->elements[0],
- swap_table->lengths [0] );
- if ( error )
- goto Fail;
-
- error = T1_Add_Table( code_table, notdef_index,
- swap_table->elements[1],
- swap_table->lengths [1] );
- if ( error )
- goto Fail;
-
- error = T1_Add_Table( name_table, 0,
- swap_table->elements[2],
- swap_table->lengths [2] );
- if ( error )
- goto Fail;
-
- error = T1_Add_Table( code_table, 0,
- swap_table->elements[3],
- swap_table->lengths [3] );
- if ( error )
- goto Fail;
-
- }
- else if ( !notdef_found )
- {
- /* notdef_index is already 0, or /.notdef is undefined in */
- /* charstrings dictionary. Worry about /.notdef undefined. */
- /* We take index 0 and add it to the end of the table(s) */
- /* and add our own /.notdef glyph to index 0. */
-
- /* 0 333 hsbw endchar */
- FT_Byte notdef_glyph[] = { 0x8B, 0xF7, 0xE1, 0x0D, 0x0E };
- char* notdef_name = (char *)".notdef";
-
-
- error = T1_Add_Table( swap_table, 0,
- name_table->elements[0],
- name_table->lengths [0] );
- if ( error )
- goto Fail;
-
- error = T1_Add_Table( swap_table, 1,
- code_table->elements[0],
- code_table->lengths [0] );
- if ( error )
- goto Fail;
-
- error = T1_Add_Table( name_table, 0, notdef_name, 8 );
- if ( error )
- goto Fail;
-
- error = T1_Add_Table( code_table, 0, notdef_glyph, 5 );
-
- if ( error )
- goto Fail;
-
- error = T1_Add_Table( name_table, n,
- swap_table->elements[0],
- swap_table->lengths [0] );
- if ( error )
- goto Fail;
-
- error = T1_Add_Table( code_table, n,
- swap_table->elements[1],
- swap_table->lengths [1] );
- if ( error )
- goto Fail;
-
- /* we added a glyph. */
- loader->num_glyphs += 1;
- }
-
- return;
-
- Fail:
- parser->root.error = error;
- }
-
-
- /*************************************************************************/
- /* */
- /* Define the token field static variables. This is a set of */
- /* T1_FieldRec variables. */
- /* */
- /*************************************************************************/
-
-
- static
- const T1_FieldRec t1_keywords[] =
- {
-
-#include "t1tokens.h"
-
- /* now add the special functions... */
- T1_FIELD_CALLBACK( "FontMatrix", t1_parse_font_matrix,
- T1_FIELD_DICT_FONTDICT )
- T1_FIELD_CALLBACK( "Encoding", parse_encoding,
- T1_FIELD_DICT_FONTDICT )
- T1_FIELD_CALLBACK( "Subrs", parse_subrs,
- T1_FIELD_DICT_PRIVATE )
- T1_FIELD_CALLBACK( "CharStrings", parse_charstrings,
- T1_FIELD_DICT_PRIVATE )
- T1_FIELD_CALLBACK( "Private", parse_private,
- T1_FIELD_DICT_FONTDICT )
-
-#ifndef T1_CONFIG_OPTION_NO_MM_SUPPORT
- T1_FIELD_CALLBACK( "BlendDesignPositions", parse_blend_design_positions,
- T1_FIELD_DICT_FONTDICT )
- T1_FIELD_CALLBACK( "BlendDesignMap", parse_blend_design_map,
- T1_FIELD_DICT_FONTDICT )
- T1_FIELD_CALLBACK( "BlendAxisTypes", parse_blend_axis_types,
- T1_FIELD_DICT_FONTDICT )
- T1_FIELD_CALLBACK( "WeightVector", parse_weight_vector,
- T1_FIELD_DICT_FONTDICT )
- T1_FIELD_CALLBACK( "BuildCharArray", parse_buildchar,
- T1_FIELD_DICT_PRIVATE )
-#endif
-
- { 0, T1_FIELD_LOCATION_CID_INFO, T1_FIELD_TYPE_NONE, 0, 0, 0, 0, 0, 0 }
- };
-
-
- static FT_Error
- parse_dict( T1_Face face,
- T1_Loader loader,
- FT_Byte* base,
- FT_ULong size )
- {
- T1_Parser parser = &loader->parser;
- FT_Byte *limit, *start_binary = NULL;
- FT_Bool have_integer = 0;
-
-
- parser->root.cursor = base;
- parser->root.limit = base + size;
- parser->root.error = FT_Err_Ok;
-
- limit = parser->root.limit;
-
- T1_Skip_Spaces( parser );
-
- while ( parser->root.cursor < limit )
- {
- FT_Byte* cur;
-
-
- cur = parser->root.cursor;
-
- /* look for `eexec' */
- if ( IS_PS_TOKEN( cur, limit, "eexec" ) )
- break;
-
- /* look for `closefile' which ends the eexec section */
- else if ( IS_PS_TOKEN( cur, limit, "closefile" ) )
- break;
-
- /* in a synthetic font the base font starts after a */
- /* `FontDictionary' token that is placed after a Private dict */
- else if ( IS_PS_TOKEN( cur, limit, "FontDirectory" ) )
- {
- if ( loader->keywords_encountered & T1_PRIVATE )
- loader->keywords_encountered |=
- T1_FONTDIR_AFTER_PRIVATE;
- parser->root.cursor += 13;
- }
-
- /* check whether we have an integer */
- else if ( ft_isdigit( *cur ) )
- {
- start_binary = cur;
- T1_Skip_PS_Token( parser );
- if ( parser->root.error )
- goto Exit;
- have_integer = 1;
- }
-
- /* in valid Type 1 fonts we don't see `RD' or `-|' directly */
- /* since those tokens are handled by parse_subrs and */
- /* parse_charstrings */
- else if ( *cur == 'R' && cur + 6 < limit && *(cur + 1) == 'D' &&
- have_integer )
- {
- FT_ULong s;
- FT_Byte* b;
-
-
- parser->root.cursor = start_binary;
- if ( !read_binary_data( parser, &s, &b, IS_INCREMENTAL ) )
- return FT_THROW( Invalid_File_Format );
- have_integer = 0;
- }
-
- else if ( *cur == '-' && cur + 6 < limit && *(cur + 1) == '|' &&
- have_integer )
- {
- FT_ULong s;
- FT_Byte* b;
-
-
- parser->root.cursor = start_binary;
- if ( !read_binary_data( parser, &s, &b, IS_INCREMENTAL ) )
- return FT_THROW( Invalid_File_Format );
- have_integer = 0;
- }
-
- /* look for immediates */
- else if ( *cur == '/' && cur + 2 < limit )
- {
- FT_UInt len;
-
-
- cur++;
-
- parser->root.cursor = cur;
- T1_Skip_PS_Token( parser );
- if ( parser->root.error )
- goto Exit;
-
- len = (FT_UInt)( parser->root.cursor - cur );
-
- if ( len > 0 && len < 22 && parser->root.cursor < limit )
- {
- /* now compare the immediate name to the keyword table */
- T1_Field keyword = (T1_Field)t1_keywords;
-
-
- for (;;)
- {
- FT_Byte* name;
-
-
- name = (FT_Byte*)keyword->ident;
- if ( !name )
- break;
-
- if ( cur[0] == name[0] &&
- len == ft_strlen( (const char *)name ) &&
- ft_memcmp( cur, name, len ) == 0 )
- {
- /* We found it -- run the parsing callback! */
- /* We record every instance of every field */
- /* (until we reach the base font of a */
- /* synthetic font) to deal adequately with */
- /* multiple master fonts; this is also */
- /* necessary because later PostScript */
- /* definitions override earlier ones. */
-
- /* Once we encounter `FontDirectory' after */
- /* `/Private', we know that this is a synthetic */
- /* font; except for `/CharStrings' we are not */
- /* interested in anything that follows this */
- /* `FontDirectory'. */
-
- /* MM fonts have more than one /Private token at */
- /* the top level; let's hope that all the junk */
- /* that follows the first /Private token is not */
- /* interesting to us. */
-
- /* According to Adobe Tech Note #5175 (CID-Keyed */
- /* Font Installation for ATM Software) a `begin' */
- /* must be followed by exactly one `end', and */
- /* `begin' -- `end' pairs must be accurately */
- /* paired. We could use this to distinguish */
- /* between the global Private and the Private */
- /* dict that is a member of the Blend dict. */
-
- const FT_UInt dict =
- ( loader->keywords_encountered & T1_PRIVATE )
- ? T1_FIELD_DICT_PRIVATE
- : T1_FIELD_DICT_FONTDICT;
-
- if ( !( dict & keyword->dict ) )
- {
- FT_TRACE1(( "parse_dict: found `%s' but ignoring it"
- " since it is in the wrong dictionary\n",
- keyword->ident ));
- break;
- }
-
- if ( !( loader->keywords_encountered &
- T1_FONTDIR_AFTER_PRIVATE ) ||
- ft_strcmp( (const char*)name, "CharStrings" ) == 0 )
- {
- parser->root.error = t1_load_keyword( face,
- loader,
- keyword );
- if ( parser->root.error != FT_Err_Ok )
- {
- if ( FT_ERR_EQ( parser->root.error, Ignore ) )
- parser->root.error = FT_Err_Ok;
- else
- return parser->root.error;
- }
- }
- break;
- }
-
- keyword++;
- }
- }
-
- have_integer = 0;
- }
- else
- {
- T1_Skip_PS_Token( parser );
- if ( parser->root.error )
- goto Exit;
- have_integer = 0;
- }
-
- T1_Skip_Spaces( parser );
- }
-
- Exit:
- return parser->root.error;
- }
-
-
- static void
- t1_init_loader( T1_Loader loader,
- T1_Face face )
- {
- FT_UNUSED( face );
-
- FT_MEM_ZERO( loader, sizeof ( *loader ) );
- loader->num_glyphs = 0;
- loader->num_chars = 0;
-
- /* initialize the tables -- simply set their `init' field to 0 */
- loader->encoding_table.init = 0;
- loader->charstrings.init = 0;
- loader->glyph_names.init = 0;
- loader->subrs.init = 0;
- loader->swap_table.init = 0;
- loader->fontdata = 0;
- loader->keywords_encountered = 0;
- }
-
-
- static void
- t1_done_loader( T1_Loader loader )
- {
- T1_Parser parser = &loader->parser;
-
-
- /* finalize tables */
- T1_Release_Table( &loader->encoding_table );
- T1_Release_Table( &loader->charstrings );
- T1_Release_Table( &loader->glyph_names );
- T1_Release_Table( &loader->swap_table );
- T1_Release_Table( &loader->subrs );
-
- /* finalize parser */
- T1_Finalize_Parser( parser );
- }
-
-
- FT_LOCAL_DEF( FT_Error )
- T1_Open_Face( T1_Face face )
- {
- T1_LoaderRec loader;
- T1_Parser parser;
- T1_Font type1 = &face->type1;
- PS_Private priv = &type1->private_dict;
- FT_Error error;
-
- PSAux_Service psaux = (PSAux_Service)face->psaux;
-
-
- t1_init_loader( &loader, face );
-
- /* default values */
- face->ndv_idx = -1;
- face->cdv_idx = -1;
- face->len_buildchar = 0;
-
- priv->blue_shift = 7;
- priv->blue_fuzz = 1;
- priv->lenIV = 4;
- priv->expansion_factor = (FT_Fixed)( 0.06 * 0x10000L );
- priv->blue_scale = (FT_Fixed)( 0.039625 * 0x10000L * 1000 );
-
- parser = &loader.parser;
- error = T1_New_Parser( parser,
- face->root.stream,
- face->root.memory,
- psaux );
- if ( error )
- goto Exit;
-
- error = parse_dict( face, &loader,
- parser->base_dict, parser->base_len );
- if ( error )
- goto Exit;
-
- error = T1_Get_Private_Dict( parser, psaux );
- if ( error )
- goto Exit;
-
- error = parse_dict( face, &loader,
- parser->private_dict, parser->private_len );
- if ( error )
- goto Exit;
-
- /* ensure even-ness of `num_blue_values' */
- priv->num_blue_values &= ~1;
-
-#ifndef T1_CONFIG_OPTION_NO_MM_SUPPORT
-
- if ( face->blend &&
- face->blend->num_default_design_vector != 0 &&
- face->blend->num_default_design_vector != face->blend->num_axis )
- {
- /* we don't use it currently so just warn, reset, and ignore */
- FT_ERROR(( "T1_Open_Face(): /DesignVector contains %u entries "
- "while there are %u axes.\n",
- face->blend->num_default_design_vector,
- face->blend->num_axis ));
-
- face->blend->num_default_design_vector = 0;
- }
-
- /* the following can happen for MM instances; we then treat the */
- /* font as a normal PS font */
- if ( face->blend &&
- ( !face->blend->num_designs || !face->blend->num_axis ) )
- T1_Done_Blend( face );
-
- /* another safety check */
- if ( face->blend )
- {
- FT_UInt i;
-
-
- for ( i = 0; i < face->blend->num_axis; i++ )
- if ( !face->blend->design_map[i].num_points )
- {
- T1_Done_Blend( face );
- break;
- }
- }
-
- if ( face->blend )
- {
- if ( face->len_buildchar > 0 )
- {
- FT_Memory memory = face->root.memory;
-
-
- if ( FT_NEW_ARRAY( face->buildchar, face->len_buildchar ) )
- {
- FT_ERROR(( "T1_Open_Face: cannot allocate BuildCharArray\n" ));
- face->len_buildchar = 0;
- goto Exit;
- }
- }
- }
- else
- face->len_buildchar = 0;
-
-#endif /* !T1_CONFIG_OPTION_NO_MM_SUPPORT */
-
- /* now, propagate the subrs, charstrings, and glyphnames tables */
- /* to the Type1 data */
- type1->num_glyphs = loader.num_glyphs;
-
- if ( loader.subrs.init )
- {
- loader.subrs.init = 0;
- type1->num_subrs = loader.num_subrs;
- type1->subrs_block = loader.subrs.block;
- type1->subrs = loader.subrs.elements;
- type1->subrs_len = loader.subrs.lengths;
- }
-
- if ( !IS_INCREMENTAL )
- if ( !loader.charstrings.init )
- {
- FT_ERROR(( "T1_Open_Face: no `/CharStrings' array in face\n" ));
- error = FT_THROW( Invalid_File_Format );
- }
-
- loader.charstrings.init = 0;
- type1->charstrings_block = loader.charstrings.block;
- type1->charstrings = loader.charstrings.elements;
- type1->charstrings_len = loader.charstrings.lengths;
-
- /* we copy the glyph names `block' and `elements' fields; */
- /* the `lengths' field must be released later */
- type1->glyph_names_block = loader.glyph_names.block;
- type1->glyph_names = (FT_String**)loader.glyph_names.elements;
- loader.glyph_names.block = NULL;
- loader.glyph_names.elements = NULL;
-
- /* we must now build type1.encoding when we have a custom array */
- if ( type1->encoding_type == T1_ENCODING_TYPE_ARRAY )
- {
- FT_Int charcode, idx, min_char, max_char;
- FT_Byte* glyph_name;
-
-
- /* OK, we do the following: for each element in the encoding */
- /* table, look up the index of the glyph having the same name */
- /* the index is then stored in type1.encoding.char_index, and */
- /* the name to type1.encoding.char_name */
-
- min_char = 0;
- max_char = 0;
-
- charcode = 0;
- for ( ; charcode < loader.encoding_table.max_elems; charcode++ )
- {
- FT_Byte* char_name;
-
-
- type1->encoding.char_index[charcode] = 0;
- type1->encoding.char_name [charcode] = (char *)".notdef";
-
- char_name = loader.encoding_table.elements[charcode];
- if ( char_name )
- for ( idx = 0; idx < type1->num_glyphs; idx++ )
- {
- glyph_name = (FT_Byte*)type1->glyph_names[idx];
- if ( ft_strcmp( (const char*)char_name,
- (const char*)glyph_name ) == 0 )
- {
- type1->encoding.char_index[charcode] = (FT_UShort)idx;
- type1->encoding.char_name [charcode] = (char*)glyph_name;
-
- /* Change min/max encoded char only if glyph name is */
- /* not /.notdef */
- if ( ft_strcmp( (const char*)".notdef",
- (const char*)glyph_name ) != 0 )
- {
- if ( charcode < min_char )
- min_char = charcode;
- if ( charcode >= max_char )
- max_char = charcode + 1;
- }
- break;
- }
- }
- }
-
- type1->encoding.code_first = min_char;
- type1->encoding.code_last = max_char;
- type1->encoding.num_chars = loader.num_chars;
- }
-
- Exit:
- t1_done_loader( &loader );
- return error;
- }
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/type1/t1load.h b/chromium/third_party/pdfium/third_party/freetype/src/type1/t1load.h
deleted file mode 100644
index de422e7ecd1..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/type1/t1load.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/***************************************************************************/
-/* */
-/* t1load.h */
-/* */
-/* Type 1 font loader (specification). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __T1LOAD_H__
-#define __T1LOAD_H__
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
-#include FT_MULTIPLE_MASTERS_H
-
-#include "t1parse.h"
-
-
-FT_BEGIN_HEADER
-
-
- typedef struct T1_Loader_
- {
- T1_ParserRec parser; /* parser used to read the stream */
-
- FT_Int num_chars; /* number of characters in encoding */
- PS_TableRec encoding_table; /* PS_Table used to store the */
- /* encoding character names */
-
- FT_Int num_glyphs;
- PS_TableRec glyph_names;
- PS_TableRec charstrings;
- PS_TableRec swap_table; /* For moving .notdef glyph to index 0. */
-
- FT_Int num_subrs;
- PS_TableRec subrs;
- FT_Bool fontdata;
-
- FT_UInt keywords_encountered; /* T1_LOADER_ENCOUNTERED_XXX */
-
- } T1_LoaderRec, *T1_Loader;
-
-
- /* treatment of some keywords differs depending on whether */
- /* they precede or follow certain other keywords */
-
-#define T1_PRIVATE ( 1 << 0 )
-#define T1_FONTDIR_AFTER_PRIVATE ( 1 << 1 )
-
-
- FT_LOCAL( FT_Error )
- T1_Open_Face( T1_Face face );
-
-#ifndef T1_CONFIG_OPTION_NO_MM_SUPPORT
-
- FT_LOCAL( FT_Error )
- T1_Get_Multi_Master( T1_Face face,
- FT_Multi_Master* master );
-
- FT_LOCAL_DEF( FT_Error )
- T1_Get_MM_Var( T1_Face face,
- FT_MM_Var* *master );
-
- FT_LOCAL( FT_Error )
- T1_Set_MM_Blend( T1_Face face,
- FT_UInt num_coords,
- FT_Fixed* coords );
-
- FT_LOCAL( FT_Error )
- T1_Set_MM_Design( T1_Face face,
- FT_UInt num_coords,
- FT_Long* coords );
-
- FT_LOCAL_DEF( FT_Error )
- T1_Set_Var_Design( T1_Face face,
- FT_UInt num_coords,
- FT_Fixed* coords );
-
- FT_LOCAL( void )
- T1_Done_Blend( T1_Face face );
-
-#endif /* !T1_CONFIG_OPTION_NO_MM_SUPPORT */
-
-
-FT_END_HEADER
-
-#endif /* __T1LOAD_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/type1/t1objs.c b/chromium/third_party/pdfium/third_party/freetype/src/type1/t1objs.c
deleted file mode 100644
index d921063eaa4..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/type1/t1objs.c
+++ /dev/null
@@ -1,613 +0,0 @@
-/***************************************************************************/
-/* */
-/* t1objs.c */
-/* */
-/* Type 1 objects manager (body). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_CALC_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_TRUETYPE_IDS_H
-
-#include "t1gload.h"
-#include "t1load.h"
-
-#include "t1errors.h"
-
-#ifndef T1_CONFIG_OPTION_NO_AFM
-#include "t1afm.h"
-#endif
-
-#include FT_SERVICE_POSTSCRIPT_CMAPS_H
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
-
-
- /*************************************************************************/
- /* */
- /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
- /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
- /* messages during execution. */
- /* */
-#undef FT_COMPONENT
-#define FT_COMPONENT trace_t1objs
-
-
- /*************************************************************************/
- /* */
- /* SIZE FUNCTIONS */
- /* */
- /* note that we store the global hints in the size's "internal" root */
- /* field */
- /* */
- /*************************************************************************/
-
-
- static PSH_Globals_Funcs
- T1_Size_Get_Globals_Funcs( T1_Size size )
- {
- T1_Face face = (T1_Face)size->root.face;
- PSHinter_Service pshinter = (PSHinter_Service)face->pshinter;
- FT_Module module;
-
-
- module = FT_Get_Module( size->root.face->driver->root.library,
- "pshinter" );
- return ( module && pshinter && pshinter->get_globals_funcs )
- ? pshinter->get_globals_funcs( module )
- : 0 ;
- }
-
-
- FT_LOCAL_DEF( void )
- T1_Size_Done( FT_Size t1size ) /* T1_Size */
- {
- T1_Size size = (T1_Size)t1size;
-
-
- if ( size->root.internal )
- {
- PSH_Globals_Funcs funcs;
-
-
- funcs = T1_Size_Get_Globals_Funcs( size );
- if ( funcs )
- funcs->destroy( (PSH_Globals)size->root.internal );
-
- size->root.internal = NULL;
- }
- }
-
-
- FT_LOCAL_DEF( FT_Error )
- T1_Size_Init( FT_Size t1size ) /* T1_Size */
- {
- T1_Size size = (T1_Size)t1size;
- FT_Error error = FT_Err_Ok;
- PSH_Globals_Funcs funcs = T1_Size_Get_Globals_Funcs( size );
-
-
- if ( funcs )
- {
- PSH_Globals globals;
- T1_Face face = (T1_Face)size->root.face;
-
-
- error = funcs->create( size->root.face->memory,
- &face->type1.private_dict, &globals );
- if ( !error )
- size->root.internal = (FT_Size_Internal)(void*)globals;
- }
-
- return error;
- }
-
-
- FT_LOCAL_DEF( FT_Error )
- T1_Size_Request( FT_Size t1size, /* T1_Size */
- FT_Size_Request req )
- {
- T1_Size size = (T1_Size)t1size;
- PSH_Globals_Funcs funcs = T1_Size_Get_Globals_Funcs( size );
-
-
- FT_Request_Metrics( size->root.face, req );
-
- if ( funcs )
- funcs->set_scale( (PSH_Globals)size->root.internal,
- size->root.metrics.x_scale,
- size->root.metrics.y_scale,
- 0, 0 );
-
- return FT_Err_Ok;
- }
-
-
- /*************************************************************************/
- /* */
- /* SLOT FUNCTIONS */
- /* */
- /*************************************************************************/
-
- FT_LOCAL_DEF( void )
- T1_GlyphSlot_Done( FT_GlyphSlot slot )
- {
- slot->internal->glyph_hints = NULL;
- }
-
-
- FT_LOCAL_DEF( FT_Error )
- T1_GlyphSlot_Init( FT_GlyphSlot slot )
- {
- T1_Face face;
- PSHinter_Service pshinter;
-
-
- face = (T1_Face)slot->face;
- pshinter = (PSHinter_Service)face->pshinter;
-
- if ( pshinter )
- {
- FT_Module module;
-
-
- module = FT_Get_Module( slot->face->driver->root.library,
- "pshinter" );
- if ( module )
- {
- T1_Hints_Funcs funcs;
-
-
- funcs = pshinter->get_t1_funcs( module );
- slot->internal->glyph_hints = (void*)funcs;
- }
- }
-
- return 0;
- }
-
-
- /*************************************************************************/
- /* */
- /* FACE FUNCTIONS */
- /* */
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* T1_Face_Done */
- /* */
- /* <Description> */
- /* The face object destructor. */
- /* */
- /* <Input> */
- /* face :: A typeless pointer to the face object to destroy. */
- /* */
- FT_LOCAL_DEF( void )
- T1_Face_Done( FT_Face t1face ) /* T1_Face */
- {
- T1_Face face = (T1_Face)t1face;
- FT_Memory memory;
- T1_Font type1;
-
-
- if ( !face )
- return;
-
- memory = face->root.memory;
- type1 = &face->type1;
-
-#ifndef T1_CONFIG_OPTION_NO_MM_SUPPORT
- /* release multiple masters information */
- FT_ASSERT( ( face->len_buildchar == 0 ) == ( face->buildchar == NULL ) );
-
- if ( face->buildchar )
- {
- FT_FREE( face->buildchar );
-
- face->buildchar = NULL;
- face->len_buildchar = 0;
- }
-
- T1_Done_Blend( face );
- face->blend = NULL;
-#endif
-
- /* release font info strings */
- {
- PS_FontInfo info = &type1->font_info;
-
-
- FT_FREE( info->version );
- FT_FREE( info->notice );
- FT_FREE( info->full_name );
- FT_FREE( info->family_name );
- FT_FREE( info->weight );
- }
-
- /* release top dictionary */
- FT_FREE( type1->charstrings_len );
- FT_FREE( type1->charstrings );
- FT_FREE( type1->glyph_names );
-
- FT_FREE( type1->subrs );
- FT_FREE( type1->subrs_len );
-
- FT_FREE( type1->subrs_block );
- FT_FREE( type1->charstrings_block );
- FT_FREE( type1->glyph_names_block );
-
- FT_FREE( type1->encoding.char_index );
- FT_FREE( type1->encoding.char_name );
- FT_FREE( type1->font_name );
-
-#ifndef T1_CONFIG_OPTION_NO_AFM
- /* release afm data if present */
- if ( face->afm_data )
- T1_Done_Metrics( memory, (AFM_FontInfo)face->afm_data );
-#endif
-
- /* release unicode map, if any */
-#if 0
- FT_FREE( face->unicode_map_rec.maps );
- face->unicode_map_rec.num_maps = 0;
- face->unicode_map = NULL;
-#endif
-
- face->root.family_name = NULL;
- face->root.style_name = NULL;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* T1_Face_Init */
- /* */
- /* <Description> */
- /* The face object constructor. */
- /* */
- /* <Input> */
- /* stream :: input stream where to load font data. */
- /* */
- /* face_index :: The index of the font face in the resource. */
- /* */
- /* num_params :: Number of additional generic parameters. Ignored. */
- /* */
- /* params :: Additional generic parameters. Ignored. */
- /* */
- /* <InOut> */
- /* face :: The face record to build. */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. */
- /* */
- FT_LOCAL_DEF( FT_Error )
- T1_Face_Init( FT_Stream stream,
- FT_Face t1face, /* T1_Face */
- FT_Int face_index,
- FT_Int num_params,
- FT_Parameter* params )
- {
- T1_Face face = (T1_Face)t1face;
- FT_Error error;
- FT_Service_PsCMaps psnames;
- PSAux_Service psaux;
- T1_Font type1 = &face->type1;
- PS_FontInfo info = &type1->font_info;
-
- FT_UNUSED( num_params );
- FT_UNUSED( params );
- FT_UNUSED( stream );
-
-
- face->root.num_faces = 1;
-
- FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS );
- face->psnames = psnames;
-
- face->psaux = FT_Get_Module_Interface( FT_FACE_LIBRARY( face ),
- "psaux" );
- psaux = (PSAux_Service)face->psaux;
- if ( !psaux )
- {
- FT_ERROR(( "T1_Face_Init: cannot access `psaux' module\n" ));
- error = FT_THROW( Missing_Module );
- goto Exit;
- }
-
- face->pshinter = FT_Get_Module_Interface( FT_FACE_LIBRARY( face ),
- "pshinter" );
-
- FT_TRACE2(( "Type 1 driver\n" ));
-
- /* open the tokenizer; this will also check the font format */
- error = T1_Open_Face( face );
- if ( error )
- goto Exit;
-
- /* if we just wanted to check the format, leave successfully now */
- if ( face_index < 0 )
- goto Exit;
-
- /* check the face index */
- if ( ( face_index & 0xFFFF ) > 0 )
- {
- FT_ERROR(( "T1_Face_Init: invalid face index\n" ));
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- /* now load the font program into the face object */
-
- /* initialize the face object fields */
-
- /* set up root face fields */
- {
- FT_Face root = (FT_Face)&face->root;
-
-
- root->num_glyphs = type1->num_glyphs;
- root->face_index = 0;
-
- root->face_flags |= FT_FACE_FLAG_SCALABLE |
- FT_FACE_FLAG_HORIZONTAL |
- FT_FACE_FLAG_GLYPH_NAMES |
- FT_FACE_FLAG_HINTER;
-
- if ( info->is_fixed_pitch )
- root->face_flags |= FT_FACE_FLAG_FIXED_WIDTH;
-
- if ( face->blend )
- root->face_flags |= FT_FACE_FLAG_MULTIPLE_MASTERS;
-
- /* The following code to extract the family and the style is very */
- /* simplistic and might get some things wrong. For a full-featured */
- /* algorithm you might have a look at the whitepaper given at */
- /* */
- /* http://blogs.msdn.com/text/archive/2007/04/23/wpf-font-selection-model.aspx */
-
- /* get style name -- be careful, some broken fonts only */
- /* have a `/FontName' dictionary entry! */
- root->family_name = info->family_name;
- root->style_name = NULL;
-
- if ( root->family_name )
- {
- char* full = info->full_name;
- char* family = root->family_name;
-
-
- if ( full )
- {
- FT_Bool the_same = TRUE;
-
-
- while ( *full )
- {
- if ( *full == *family )
- {
- family++;
- full++;
- }
- else
- {
- if ( *full == ' ' || *full == '-' )
- full++;
- else if ( *family == ' ' || *family == '-' )
- family++;
- else
- {
- the_same = FALSE;
-
- if ( !*family )
- root->style_name = full;
- break;
- }
- }
- }
-
- if ( the_same )
- root->style_name = (char *)"Regular";
- }
- }
- else
- {
- /* do we have a `/FontName'? */
- if ( type1->font_name )
- root->family_name = type1->font_name;
- }
-
- if ( !root->style_name )
- {
- if ( info->weight )
- root->style_name = info->weight;
- else
- /* assume `Regular' style because we don't know better */
- root->style_name = (char *)"Regular";
- }
-
- /* compute style flags */
- root->style_flags = 0;
- if ( info->italic_angle )
- root->style_flags |= FT_STYLE_FLAG_ITALIC;
- if ( info->weight )
- {
- if ( !ft_strcmp( info->weight, "Bold" ) ||
- !ft_strcmp( info->weight, "Black" ) )
- root->style_flags |= FT_STYLE_FLAG_BOLD;
- }
-
- /* no embedded bitmap support */
- root->num_fixed_sizes = 0;
- root->available_sizes = NULL;
-
- root->bbox.xMin = type1->font_bbox.xMin >> 16;
- root->bbox.yMin = type1->font_bbox.yMin >> 16;
- /* no `U' suffix here to 0xFFFF! */
- root->bbox.xMax = ( type1->font_bbox.xMax + 0xFFFF ) >> 16;
- root->bbox.yMax = ( type1->font_bbox.yMax + 0xFFFF ) >> 16;
-
- /* Set units_per_EM if we didn't set it in t1_parse_font_matrix. */
- if ( !root->units_per_EM )
- root->units_per_EM = 1000;
-
- root->ascender = (FT_Short)( root->bbox.yMax );
- root->descender = (FT_Short)( root->bbox.yMin );
-
- root->height = (FT_Short)( ( root->units_per_EM * 12 ) / 10 );
- if ( root->height < root->ascender - root->descender )
- root->height = (FT_Short)( root->ascender - root->descender );
-
- /* now compute the maximum advance width */
- root->max_advance_width =
- (FT_Short)( root->bbox.xMax );
- {
- FT_Pos max_advance;
-
-
- error = T1_Compute_Max_Advance( face, &max_advance );
-
- /* in case of error, keep the standard width */
- if ( !error )
- root->max_advance_width = (FT_Short)FIXED_TO_INT( max_advance );
- else
- error = FT_Err_Ok; /* clear error */
- }
-
- root->max_advance_height = root->height;
-
- root->underline_position = (FT_Short)info->underline_position;
- root->underline_thickness = (FT_Short)info->underline_thickness;
- }
-
- {
- FT_Face root = &face->root;
-
-
- if ( psnames )
- {
- FT_CharMapRec charmap;
- T1_CMap_Classes cmap_classes = psaux->t1_cmap_classes;
- FT_CMap_Class clazz;
-
-
- charmap.face = root;
-
- /* first of all, try to synthesize a Unicode charmap */
- charmap.platform_id = TT_PLATFORM_MICROSOFT;
- charmap.encoding_id = TT_MS_ID_UNICODE_CS;
- charmap.encoding = FT_ENCODING_UNICODE;
-
- error = FT_CMap_New( cmap_classes->unicode, NULL, &charmap, NULL );
- if ( error &&
- FT_ERR_NEQ( error, No_Unicode_Glyph_Name ) )
- goto Exit;
- error = FT_Err_Ok;
-
- /* now, generate an Adobe Standard encoding when appropriate */
- charmap.platform_id = TT_PLATFORM_ADOBE;
- clazz = NULL;
-
- switch ( type1->encoding_type )
- {
- case T1_ENCODING_TYPE_STANDARD:
- charmap.encoding = FT_ENCODING_ADOBE_STANDARD;
- charmap.encoding_id = TT_ADOBE_ID_STANDARD;
- clazz = cmap_classes->standard;
- break;
-
- case T1_ENCODING_TYPE_EXPERT:
- charmap.encoding = FT_ENCODING_ADOBE_EXPERT;
- charmap.encoding_id = TT_ADOBE_ID_EXPERT;
- clazz = cmap_classes->expert;
- break;
-
- case T1_ENCODING_TYPE_ARRAY:
- charmap.encoding = FT_ENCODING_ADOBE_CUSTOM;
- charmap.encoding_id = TT_ADOBE_ID_CUSTOM;
- clazz = cmap_classes->custom;
- break;
-
- case T1_ENCODING_TYPE_ISOLATIN1:
- charmap.encoding = FT_ENCODING_ADOBE_LATIN_1;
- charmap.encoding_id = TT_ADOBE_ID_LATIN_1;
- clazz = cmap_classes->unicode;
- break;
-
- default:
- ;
- }
-
- if ( clazz )
- error = FT_CMap_New( clazz, NULL, &charmap, NULL );
-
-#if 0
- /* Select default charmap */
- if (root->num_charmaps)
- root->charmap = root->charmaps[0];
-#endif
- }
- }
-
- Exit:
- return error;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* T1_Driver_Init */
- /* */
- /* <Description> */
- /* Initializes a given Type 1 driver object. */
- /* */
- /* <Input> */
- /* driver :: A handle to the target driver object. */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. */
- /* */
- FT_LOCAL_DEF( FT_Error )
- T1_Driver_Init( FT_Module driver )
- {
- FT_UNUSED( driver );
-
- return FT_Err_Ok;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* T1_Driver_Done */
- /* */
- /* <Description> */
- /* Finalizes a given Type 1 driver. */
- /* */
- /* <Input> */
- /* driver :: A handle to the target Type 1 driver. */
- /* */
- FT_LOCAL_DEF( void )
- T1_Driver_Done( FT_Module driver )
- {
- FT_UNUSED( driver );
- }
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/type1/t1objs.h b/chromium/third_party/pdfium/third_party/freetype/src/type1/t1objs.h
deleted file mode 100644
index 6b4f3cb56d4..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/type1/t1objs.h
+++ /dev/null
@@ -1,160 +0,0 @@
-/***************************************************************************/
-/* */
-/* t1objs.h */
-/* */
-/* Type 1 objects manager (specification). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __T1OBJS_H__
-#define __T1OBJS_H__
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_OBJECTS_H
-#include FT_CONFIG_CONFIG_H
-#include FT_INTERNAL_TYPE1_TYPES_H
-
-
-FT_BEGIN_HEADER
-
-
- /* The following structures must be defined by the hinter */
- typedef struct T1_Size_Hints_ T1_Size_Hints;
- typedef struct T1_Glyph_Hints_ T1_Glyph_Hints;
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* T1_Size */
- /* */
- /* <Description> */
- /* A handle to a Type 1 size object. */
- /* */
- typedef struct T1_SizeRec_* T1_Size;
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* T1_GlyphSlot */
- /* */
- /* <Description> */
- /* A handle to a Type 1 glyph slot object. */
- /* */
- typedef struct T1_GlyphSlotRec_* T1_GlyphSlot;
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* T1_CharMap */
- /* */
- /* <Description> */
- /* A handle to a Type 1 character mapping object. */
- /* */
- /* <Note> */
- /* The Type 1 format doesn't use a charmap but an encoding table. */
- /* The driver is responsible for making up charmap objects */
- /* corresponding to these tables. */
- /* */
- typedef struct T1_CharMapRec_* T1_CharMap;
-
-
- /*************************************************************************/
- /* */
- /* HERE BEGINS THE TYPE1 SPECIFIC STUFF */
- /* */
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* T1_SizeRec */
- /* */
- /* <Description> */
- /* Type 1 size record. */
- /* */
- typedef struct T1_SizeRec_
- {
- FT_SizeRec root;
-
- } T1_SizeRec;
-
-
- FT_LOCAL( void )
- T1_Size_Done( FT_Size size );
-
- FT_LOCAL( FT_Error )
- T1_Size_Request( FT_Size size,
- FT_Size_Request req );
-
- FT_LOCAL( FT_Error )
- T1_Size_Init( FT_Size size );
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* T1_GlyphSlotRec */
- /* */
- /* <Description> */
- /* Type 1 glyph slot record. */
- /* */
- typedef struct T1_GlyphSlotRec_
- {
- FT_GlyphSlotRec root;
-
- FT_Bool hint;
- FT_Bool scaled;
-
- FT_Int max_points;
- FT_Int max_contours;
-
- FT_Fixed x_scale;
- FT_Fixed y_scale;
-
- } T1_GlyphSlotRec;
-
-
- FT_LOCAL( FT_Error )
- T1_Face_Init( FT_Stream stream,
- FT_Face face,
- FT_Int face_index,
- FT_Int num_params,
- FT_Parameter* params );
-
- FT_LOCAL( void )
- T1_Face_Done( FT_Face face );
-
- FT_LOCAL( FT_Error )
- T1_GlyphSlot_Init( FT_GlyphSlot slot );
-
- FT_LOCAL( void )
- T1_GlyphSlot_Done( FT_GlyphSlot slot );
-
- FT_LOCAL( FT_Error )
- T1_Driver_Init( FT_Module driver );
-
- FT_LOCAL( void )
- T1_Driver_Done( FT_Module driver );
-
-
-FT_END_HEADER
-
-#endif /* __T1OBJS_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/type1/t1parse.c b/chromium/third_party/pdfium/third_party/freetype/src/type1/t1parse.c
deleted file mode 100644
index 0b685026067..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/type1/t1parse.c
+++ /dev/null
@@ -1,525 +0,0 @@
-/***************************************************************************/
-/* */
-/* t1parse.c */
-/* */
-/* Type 1 parser (body). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* The Type 1 parser is in charge of the following: */
- /* */
- /* - provide an implementation of a growing sequence of objects called */
- /* a `T1_Table' (used to build various tables needed by the loader). */
- /* */
- /* - opening .pfb and .pfa files to extract their top-level and private */
- /* dictionaries. */
- /* */
- /* - read numbers, arrays & strings from any dictionary. */
- /* */
- /* See `t1load.c' to see how data is loaded from the font file. */
- /* */
- /*************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
-
-#include "t1parse.h"
-
-#include "t1errors.h"
-
-
- /*************************************************************************/
- /* */
- /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
- /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
- /* messages during execution. */
- /* */
-#undef FT_COMPONENT
-#define FT_COMPONENT trace_t1parse
-
-
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** INPUT STREAM PARSER *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
-
-
- /* see Adobe Technical Note 5040.Download_Fonts.pdf */
-
- static FT_Error
- read_pfb_tag( FT_Stream stream,
- FT_UShort *atag,
- FT_ULong *asize )
- {
- FT_Error error;
- FT_UShort tag;
- FT_ULong size;
-
-
- *atag = 0;
- *asize = 0;
-
- if ( !FT_READ_USHORT( tag ) )
- {
- if ( tag == 0x8001U || tag == 0x8002U )
- {
- if ( !FT_READ_ULONG_LE( size ) )
- *asize = size;
- }
-
- *atag = tag;
- }
-
- return error;
- }
-
-
- static FT_Error
- check_type1_format( FT_Stream stream,
- const char* header_string,
- size_t header_length )
- {
- FT_Error error;
- FT_UShort tag;
- FT_ULong dummy;
-
-
- if ( FT_STREAM_SEEK( 0 ) )
- goto Exit;
-
- error = read_pfb_tag( stream, &tag, &dummy );
- if ( error )
- goto Exit;
-
- /* We assume that the first segment in a PFB is always encoded as */
- /* text. This might be wrong (and the specification doesn't insist */
- /* on that), but we have never seen a counterexample. */
- if ( tag != 0x8001U && FT_STREAM_SEEK( 0 ) )
- goto Exit;
-
- if ( !FT_FRAME_ENTER( header_length ) )
- {
- error = FT_Err_Ok;
-
- if ( ft_memcmp( stream->cursor, header_string, header_length ) != 0 )
- error = FT_THROW( Unknown_File_Format );
-
- FT_FRAME_EXIT();
- }
-
- Exit:
- return error;
- }
-
-
- FT_LOCAL_DEF( FT_Error )
- T1_New_Parser( T1_Parser parser,
- FT_Stream stream,
- FT_Memory memory,
- PSAux_Service psaux )
- {
- FT_Error error;
- FT_UShort tag;
- FT_ULong size;
-
-
- psaux->ps_parser_funcs->init( &parser->root, NULL, NULL, memory );
-
- parser->stream = stream;
- parser->base_len = 0;
- parser->base_dict = NULL;
- parser->private_len = 0;
- parser->private_dict = NULL;
- parser->in_pfb = 0;
- parser->in_memory = 0;
- parser->single_block = 0;
-
- /* check the header format */
- error = check_type1_format( stream, "%!PS-AdobeFont", 14 );
- if ( error )
- {
- if ( FT_ERR_NEQ( error, Unknown_File_Format ) )
- goto Exit;
-
- error = check_type1_format( stream, "%!FontType", 10 );
- if ( error )
- {
- FT_TRACE2(( " not a Type 1 font\n" ));
- goto Exit;
- }
- }
-
- /******************************************************************/
- /* */
- /* Here a short summary of what is going on: */
- /* */
- /* When creating a new Type 1 parser, we try to locate and load */
- /* the base dictionary if this is possible (i.e., for PFB */
- /* files). Otherwise, we load the whole font into memory. */
- /* */
- /* When `loading' the base dictionary, we only setup pointers */
- /* in the case of a memory-based stream. Otherwise, we */
- /* allocate and load the base dictionary in it. */
- /* */
- /* parser->in_pfb is set if we are in a binary (`.pfb') font. */
- /* parser->in_memory is set if we have a memory stream. */
- /* */
-
- /* try to compute the size of the base dictionary; */
- /* look for a Postscript binary file tag, i.e., 0x8001 */
- if ( FT_STREAM_SEEK( 0L ) )
- goto Exit;
-
- error = read_pfb_tag( stream, &tag, &size );
- if ( error )
- goto Exit;
-
- if ( tag != 0x8001U )
- {
- /* assume that this is a PFA file for now; an error will */
- /* be produced later when more things are checked */
- if ( FT_STREAM_SEEK( 0L ) )
- goto Exit;
- size = stream->size;
- }
- else
- parser->in_pfb = 1;
-
- /* now, try to load `size' bytes of the `base' dictionary we */
- /* found previously */
-
- /* if it is a memory-based resource, set up pointers */
- if ( !stream->read )
- {
- parser->base_dict = (FT_Byte*)stream->base + stream->pos;
- parser->base_len = size;
- parser->in_memory = 1;
-
- /* check that the `size' field is valid */
- if ( FT_STREAM_SKIP( size ) )
- goto Exit;
- }
- else
- {
- /* read segment in memory -- this is clumsy, but so does the format */
- if ( FT_ALLOC( parser->base_dict, size ) ||
- FT_STREAM_READ( parser->base_dict, size ) )
- goto Exit;
- parser->base_len = size;
- }
-
- parser->root.base = parser->base_dict;
- parser->root.cursor = parser->base_dict;
- parser->root.limit = parser->root.cursor + parser->base_len;
-
- Exit:
- if ( error && !parser->in_memory )
- FT_FREE( parser->base_dict );
-
- return error;
- }
-
-
- FT_LOCAL_DEF( void )
- T1_Finalize_Parser( T1_Parser parser )
- {
- FT_Memory memory = parser->root.memory;
-
-
- /* always free the private dictionary */
- FT_FREE( parser->private_dict );
-
- /* free the base dictionary only when we have a disk stream */
- if ( !parser->in_memory )
- FT_FREE( parser->base_dict );
-
- parser->root.funcs.done( &parser->root );
- }
-
-
- FT_LOCAL_DEF( FT_Error )
- T1_Get_Private_Dict( T1_Parser parser,
- PSAux_Service psaux )
- {
- FT_Stream stream = parser->stream;
- FT_Memory memory = parser->root.memory;
- FT_Error error = FT_Err_Ok;
- FT_ULong size;
-
-
- if ( parser->in_pfb )
- {
- /* in the case of the PFB format, the private dictionary can be */
- /* made of several segments. We thus first read the number of */
- /* segments to compute the total size of the private dictionary */
- /* then re-read them into memory. */
- FT_ULong start_pos = FT_STREAM_POS();
- FT_UShort tag;
-
-
- parser->private_len = 0;
- for (;;)
- {
- error = read_pfb_tag( stream, &tag, &size );
- if ( error )
- goto Fail;
-
- if ( tag != 0x8002U )
- break;
-
- parser->private_len += size;
-
- if ( FT_STREAM_SKIP( size ) )
- goto Fail;
- }
-
- /* Check that we have a private dictionary there */
- /* and allocate private dictionary buffer */
- if ( parser->private_len == 0 )
- {
- FT_ERROR(( "T1_Get_Private_Dict:"
- " invalid private dictionary section\n" ));
- error = FT_THROW( Invalid_File_Format );
- goto Fail;
- }
-
- if ( FT_STREAM_SEEK( start_pos ) ||
- FT_ALLOC( parser->private_dict, parser->private_len ) )
- goto Fail;
-
- parser->private_len = 0;
- for (;;)
- {
- error = read_pfb_tag( stream, &tag, &size );
- if ( error || tag != 0x8002U )
- {
- error = FT_Err_Ok;
- break;
- }
-
- if ( FT_STREAM_READ( parser->private_dict + parser->private_len,
- size ) )
- goto Fail;
-
- parser->private_len += size;
- }
- }
- else
- {
- /* We have already `loaded' the whole PFA font file into memory; */
- /* if this is a memory resource, allocate a new block to hold */
- /* the private dict. Otherwise, simply overwrite into the base */
- /* dictionary block in the heap. */
-
- /* first of all, look at the `eexec' keyword */
- FT_Byte* cur = parser->base_dict;
- FT_Byte* limit = cur + parser->base_len;
- FT_Pointer pos_lf;
- FT_Bool test_cr;
-
-
- Again:
- for (;;)
- {
- if ( cur[0] == 'e' &&
- cur + 9 < limit ) /* 9 = 5 letters for `eexec' + */
- /* whitespace + 4 chars */
- {
- if ( cur[1] == 'e' &&
- cur[2] == 'x' &&
- cur[3] == 'e' &&
- cur[4] == 'c' )
- break;
- }
- cur++;
- if ( cur >= limit )
- {
- FT_ERROR(( "T1_Get_Private_Dict:"
- " could not find `eexec' keyword\n" ));
- error = FT_THROW( Invalid_File_Format );
- goto Exit;
- }
- }
-
- /* check whether `eexec' was real -- it could be in a comment */
- /* or string (as e.g. in u003043t.gsf from ghostscript) */
-
- parser->root.cursor = parser->base_dict;
- /* set limit to `eexec' + whitespace + 4 characters */
- parser->root.limit = cur + 10;
-
- cur = parser->root.cursor;
- limit = parser->root.limit;
-
- while ( cur < limit )
- {
- if ( cur[0] == 'e' &&
- cur + 5 < limit )
- {
- if ( cur[1] == 'e' &&
- cur[2] == 'x' &&
- cur[3] == 'e' &&
- cur[4] == 'c' )
- goto Found;
- }
-
- T1_Skip_PS_Token( parser );
- if ( parser->root.error )
- break;
- T1_Skip_Spaces ( parser );
- cur = parser->root.cursor;
- }
-
- /* we haven't found the correct `eexec'; go back and continue */
- /* searching */
-
- cur = limit;
- limit = parser->base_dict + parser->base_len;
-
- if ( cur >= limit )
- {
- FT_ERROR(( "T1_Get_Private_Dict:"
- " premature end in private dictionary\n" ));
- error = FT_THROW( Invalid_File_Format );
- goto Exit;
- }
-
- goto Again;
-
- /* now determine where to write the _encrypted_ binary private */
- /* dictionary. We overwrite the base dictionary for disk-based */
- /* resources and allocate a new block otherwise */
-
- Found:
- parser->root.limit = parser->base_dict + parser->base_len;
-
- T1_Skip_PS_Token( parser );
- cur = parser->root.cursor;
- limit = parser->root.limit;
-
- /* According to the Type 1 spec, the first cipher byte must not be */
- /* an ASCII whitespace character code (blank, tab, carriage return */
- /* or line feed). We have seen Type 1 fonts with two line feed */
- /* characters... So skip now all whitespace character codes. */
- /* */
- /* On the other hand, Adobe's Type 1 parser handles fonts just */
- /* fine that are violating this limitation, so we add a heuristic */
- /* test to stop at \r only if it is not used for EOL. */
-
- pos_lf = ft_memchr( cur, '\n', (size_t)( limit - cur ) );
- test_cr = FT_BOOL( !pos_lf ||
- pos_lf > ft_memchr( cur,
- '\r',
- (size_t)( limit - cur ) ) );
-
- while ( cur < limit &&
- ( *cur == ' ' ||
- *cur == '\t' ||
- (test_cr && *cur == '\r' ) ||
- *cur == '\n' ) )
- ++cur;
- if ( cur >= limit )
- {
- FT_ERROR(( "T1_Get_Private_Dict:"
- " `eexec' not properly terminated\n" ));
- error = FT_THROW( Invalid_File_Format );
- goto Exit;
- }
-
- size = parser->base_len - (FT_ULong)( cur - parser->base_dict );
-
- if ( parser->in_memory )
- {
- /* note that we allocate one more byte to put a terminating `0' */
- if ( FT_ALLOC( parser->private_dict, size + 1 ) )
- goto Fail;
- parser->private_len = size;
- }
- else
- {
- parser->single_block = 1;
- parser->private_dict = parser->base_dict;
- parser->private_len = size;
- parser->base_dict = NULL;
- parser->base_len = 0;
- }
-
- /* now determine whether the private dictionary is encoded in binary */
- /* or hexadecimal ASCII format -- decode it accordingly */
-
- /* we need to access the next 4 bytes (after the final whitespace */
- /* following the `eexec' keyword); if they all are hexadecimal */
- /* digits, then we have a case of ASCII storage */
-
- if ( cur + 3 < limit &&
- ft_isxdigit( cur[0] ) && ft_isxdigit( cur[1] ) &&
- ft_isxdigit( cur[2] ) && ft_isxdigit( cur[3] ) )
- {
- /* ASCII hexadecimal encoding */
- FT_ULong len;
-
-
- parser->root.cursor = cur;
- (void)psaux->ps_parser_funcs->to_bytes( &parser->root,
- parser->private_dict,
- parser->private_len,
- &len,
- 0 );
- parser->private_len = len;
-
- /* put a safeguard */
- parser->private_dict[len] = '\0';
- }
- else
- /* binary encoding -- copy the private dict */
- FT_MEM_MOVE( parser->private_dict, cur, size );
- }
-
- /* we now decrypt the encoded binary private dictionary */
- psaux->t1_decrypt( parser->private_dict, parser->private_len, 55665U );
-
- if ( parser->private_len < 4 )
- {
- FT_ERROR(( "T1_Get_Private_Dict:"
- " invalid private dictionary section\n" ));
- error = FT_THROW( Invalid_File_Format );
- goto Fail;
- }
-
- /* replace the four random bytes at the beginning with whitespace */
- parser->private_dict[0] = ' ';
- parser->private_dict[1] = ' ';
- parser->private_dict[2] = ' ';
- parser->private_dict[3] = ' ';
-
- parser->root.base = parser->private_dict;
- parser->root.cursor = parser->private_dict;
- parser->root.limit = parser->root.cursor + parser->private_len;
-
- Fail:
- Exit:
- return error;
- }
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/type1/t1parse.h b/chromium/third_party/pdfium/third_party/freetype/src/type1/t1parse.h
deleted file mode 100644
index 93b02e3d317..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/type1/t1parse.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/***************************************************************************/
-/* */
-/* t1parse.h */
-/* */
-/* Type 1 parser (specification). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __T1PARSE_H__
-#define __T1PARSE_H__
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_TYPE1_TYPES_H
-#include FT_INTERNAL_STREAM_H
-
-
-FT_BEGIN_HEADER
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* T1_ParserRec */
- /* */
- /* <Description> */
- /* A PS_ParserRec is an object used to parse a Type 1 fonts very */
- /* quickly. */
- /* */
- /* <Fields> */
- /* root :: The root parser. */
- /* */
- /* stream :: The current input stream. */
- /* */
- /* base_dict :: A pointer to the top-level dictionary. */
- /* */
- /* base_len :: The length in bytes of the top dictionary. */
- /* */
- /* private_dict :: A pointer to the private dictionary. */
- /* */
- /* private_len :: The length in bytes of the private dictionary. */
- /* */
- /* in_pfb :: A boolean. Indicates that we are handling a PFB */
- /* file. */
- /* */
- /* in_memory :: A boolean. Indicates a memory-based stream. */
- /* */
- /* single_block :: A boolean. Indicates that the private dictionary */
- /* is stored in lieu of the base dictionary. */
- /* */
- typedef struct T1_ParserRec_
- {
- PS_ParserRec root;
- FT_Stream stream;
-
- FT_Byte* base_dict;
- FT_ULong base_len;
-
- FT_Byte* private_dict;
- FT_ULong private_len;
-
- FT_Bool in_pfb;
- FT_Bool in_memory;
- FT_Bool single_block;
-
- } T1_ParserRec, *T1_Parser;
-
-
-#define T1_Add_Table( p, i, o, l ) (p)->funcs.add( (p), i, o, l )
-#define T1_Release_Table( p ) \
- do \
- { \
- if ( (p)->funcs.release ) \
- (p)->funcs.release( p ); \
- } while ( 0 )
-
-
-#define T1_Skip_Spaces( p ) (p)->root.funcs.skip_spaces( &(p)->root )
-#define T1_Skip_PS_Token( p ) (p)->root.funcs.skip_PS_token( &(p)->root )
-
-#define T1_ToInt( p ) (p)->root.funcs.to_int( &(p)->root )
-#define T1_ToFixed( p, t ) (p)->root.funcs.to_fixed( &(p)->root, t )
-
-#define T1_ToCoordArray( p, m, c ) \
- (p)->root.funcs.to_coord_array( &(p)->root, m, c )
-#define T1_ToFixedArray( p, m, f, t ) \
- (p)->root.funcs.to_fixed_array( &(p)->root, m, f, t )
-#define T1_ToToken( p, t ) \
- (p)->root.funcs.to_token( &(p)->root, t )
-#define T1_ToTokenArray( p, t, m, c ) \
- (p)->root.funcs.to_token_array( &(p)->root, t, m, c )
-
-#define T1_Load_Field( p, f, o, m, pf ) \
- (p)->root.funcs.load_field( &(p)->root, f, o, m, pf )
-
-#define T1_Load_Field_Table( p, f, o, m, pf ) \
- (p)->root.funcs.load_field_table( &(p)->root, f, o, m, pf )
-
-
- FT_LOCAL( FT_Error )
- T1_New_Parser( T1_Parser parser,
- FT_Stream stream,
- FT_Memory memory,
- PSAux_Service psaux );
-
- FT_LOCAL( FT_Error )
- T1_Get_Private_Dict( T1_Parser parser,
- PSAux_Service psaux );
-
- FT_LOCAL( void )
- T1_Finalize_Parser( T1_Parser parser );
-
-
-FT_END_HEADER
-
-#endif /* __T1PARSE_H__ */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/type1/t1tokens.h b/chromium/third_party/pdfium/third_party/freetype/src/type1/t1tokens.h
deleted file mode 100644
index 39926524352..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/type1/t1tokens.h
+++ /dev/null
@@ -1,143 +0,0 @@
-/***************************************************************************/
-/* */
-/* t1tokens.h */
-/* */
-/* Type 1 tokenizer (specification). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#undef FT_STRUCTURE
-#define FT_STRUCTURE PS_FontInfoRec
-#undef T1CODE
-#define T1CODE T1_FIELD_LOCATION_FONT_INFO
-
- T1_FIELD_STRING( "version", version,
- T1_FIELD_DICT_FONTDICT )
- T1_FIELD_STRING( "Notice", notice,
- T1_FIELD_DICT_FONTDICT )
- T1_FIELD_STRING( "FullName", full_name,
- T1_FIELD_DICT_FONTDICT )
- T1_FIELD_STRING( "FamilyName", family_name,
- T1_FIELD_DICT_FONTDICT )
- T1_FIELD_STRING( "Weight", weight,
- T1_FIELD_DICT_FONTDICT )
-
- /* we use pointers to detect modifications made by synthetic fonts */
- T1_FIELD_NUM ( "ItalicAngle", italic_angle,
- T1_FIELD_DICT_FONTDICT )
- T1_FIELD_BOOL ( "isFixedPitch", is_fixed_pitch,
- T1_FIELD_DICT_FONTDICT )
- T1_FIELD_NUM ( "UnderlinePosition", underline_position,
- T1_FIELD_DICT_FONTDICT )
- T1_FIELD_NUM ( "UnderlineThickness", underline_thickness,
- T1_FIELD_DICT_FONTDICT )
-
-#undef FT_STRUCTURE
-#define FT_STRUCTURE PS_FontExtraRec
-#undef T1CODE
-#define T1CODE T1_FIELD_LOCATION_FONT_EXTRA
-
- T1_FIELD_NUM ( "FSType", fs_type,
- T1_FIELD_DICT_FONTDICT )
-
-#undef FT_STRUCTURE
-#define FT_STRUCTURE PS_PrivateRec
-#undef T1CODE
-#define T1CODE T1_FIELD_LOCATION_PRIVATE
-
- T1_FIELD_NUM ( "UniqueID", unique_id,
- T1_FIELD_DICT_FONTDICT | T1_FIELD_DICT_PRIVATE )
- T1_FIELD_NUM ( "lenIV", lenIV,
- T1_FIELD_DICT_PRIVATE )
- T1_FIELD_NUM ( "LanguageGroup", language_group,
- T1_FIELD_DICT_PRIVATE )
- T1_FIELD_NUM ( "password", password,
- T1_FIELD_DICT_PRIVATE )
-
- T1_FIELD_FIXED_1000( "BlueScale", blue_scale,
- T1_FIELD_DICT_PRIVATE )
- T1_FIELD_NUM ( "BlueShift", blue_shift,
- T1_FIELD_DICT_PRIVATE )
- T1_FIELD_NUM ( "BlueFuzz", blue_fuzz,
- T1_FIELD_DICT_PRIVATE )
-
- T1_FIELD_NUM_TABLE ( "BlueValues", blue_values, 14,
- T1_FIELD_DICT_PRIVATE )
- T1_FIELD_NUM_TABLE ( "OtherBlues", other_blues, 10,
- T1_FIELD_DICT_PRIVATE )
- T1_FIELD_NUM_TABLE ( "FamilyBlues", family_blues, 14,
- T1_FIELD_DICT_PRIVATE )
- T1_FIELD_NUM_TABLE ( "FamilyOtherBlues", family_other_blues, 10,
- T1_FIELD_DICT_PRIVATE )
-
- T1_FIELD_NUM_TABLE2( "StdHW", standard_width, 1,
- T1_FIELD_DICT_PRIVATE )
- T1_FIELD_NUM_TABLE2( "StdVW", standard_height, 1,
- T1_FIELD_DICT_PRIVATE )
- T1_FIELD_NUM_TABLE2( "MinFeature", min_feature, 2,
- T1_FIELD_DICT_PRIVATE )
-
- T1_FIELD_NUM_TABLE ( "StemSnapH", snap_widths, 12,
- T1_FIELD_DICT_PRIVATE )
- T1_FIELD_NUM_TABLE ( "StemSnapV", snap_heights, 12,
- T1_FIELD_DICT_PRIVATE )
-
- T1_FIELD_FIXED ( "ExpansionFactor", expansion_factor,
- T1_FIELD_DICT_PRIVATE )
- T1_FIELD_BOOL ( "ForceBold", force_bold,
- T1_FIELD_DICT_PRIVATE )
-
-
-#undef FT_STRUCTURE
-#define FT_STRUCTURE T1_FontRec
-#undef T1CODE
-#define T1CODE T1_FIELD_LOCATION_FONT_DICT
-
- T1_FIELD_KEY ( "FontName", font_name, T1_FIELD_DICT_FONTDICT )
- T1_FIELD_NUM ( "PaintType", paint_type, T1_FIELD_DICT_FONTDICT )
- T1_FIELD_NUM ( "FontType", font_type, T1_FIELD_DICT_FONTDICT )
- T1_FIELD_FIXED( "StrokeWidth", stroke_width, T1_FIELD_DICT_FONTDICT )
-
-
-#undef FT_STRUCTURE
-#define FT_STRUCTURE FT_BBox
-#undef T1CODE
-#define T1CODE T1_FIELD_LOCATION_BBOX
-
- T1_FIELD_BBOX( "FontBBox", xMin, T1_FIELD_DICT_FONTDICT )
-
-
-#ifndef T1_CONFIG_OPTION_NO_MM_SUPPORT
-
-#undef FT_STRUCTURE
-#define FT_STRUCTURE T1_FaceRec
-#undef T1CODE
-#define T1CODE T1_FIELD_LOCATION_FACE
-
- T1_FIELD_NUM( "NDV", ndv_idx, T1_FIELD_DICT_PRIVATE )
- T1_FIELD_NUM( "CDV", cdv_idx, T1_FIELD_DICT_PRIVATE )
-
-
-#undef FT_STRUCTURE
-#define FT_STRUCTURE PS_BlendRec
-#undef T1CODE
-#define T1CODE T1_FIELD_LOCATION_BLEND
-
- T1_FIELD_NUM_TABLE( "DesignVector", default_design_vector,
- T1_MAX_MM_DESIGNS, T1_FIELD_DICT_FONTDICT )
-
-
-#endif /* T1_CONFIG_OPTION_NO_MM_SUPPORT */
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/freetype/src/type1/type1.c b/chromium/third_party/pdfium/third_party/freetype/src/type1/type1.c
deleted file mode 100644
index 4c70ea7630b..00000000000
--- a/chromium/third_party/pdfium/third_party/freetype/src/type1/type1.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/***************************************************************************/
-/* */
-/* type1.c */
-/* */
-/* FreeType Type 1 driver component (body only). */
-/* */
-/* Copyright 1996-2015 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#define FT_MAKE_OPTION_SINGLE_OBJECT
-
-#include <ft2build.h>
-#include "t1parse.c"
-#include "t1load.c"
-#include "t1objs.c"
-#include "t1driver.c"
-#include "t1gload.c"
-
-#ifndef T1_CONFIG_OPTION_NO_AFM
-#include "t1afm.c"
-#endif
-
-
-/* END */
diff --git a/chromium/third_party/pdfium/third_party/lcms2-2.6/src/cmserr.c b/chromium/third_party/pdfium/third_party/lcms2-2.6/src/cmserr.c
index 77b67b43aa8..f9adc3824a1 100644
--- a/chromium/third_party/pdfium/third_party/lcms2-2.6/src/cmserr.c
+++ b/chromium/third_party/pdfium/third_party/lcms2-2.6/src/cmserr.c
@@ -269,7 +269,7 @@ void* CMSEXPORT _cmsMalloc(cmsContext ContextID, cmsUInt32Number size)
void* CMSEXPORT _cmsMallocZero(cmsContext ContextID, cmsUInt32Number size)
{
void* p = FXMEM_DefaultAlloc(size, 1);
- if (p) FXSYS_memset(p, 0, size);
+ if (p) memset(p, 0, size);
return p;
}
@@ -299,7 +299,7 @@ void CMSEXPORT _cmsFree(cmsContext ContextID, void* Ptr)
void* CMSEXPORT _cmsDupMem(cmsContext ContextID, const void* Org, cmsUInt32Number size)
{
void* p = FXMEM_DefaultAlloc(size, 1);
- FXSYS_memmove(p, Org, size);
+ memmove(p, Org, size);
return p;
}
diff --git a/chromium/third_party/pdfium/third_party/libjpeg/cderror.h b/chromium/third_party/pdfium/third_party/libjpeg/cderror.h
deleted file mode 100644
index 70435e161c0..00000000000
--- a/chromium/third_party/pdfium/third_party/libjpeg/cderror.h
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * cderror.h
- *
- * Copyright (C) 1994-1997, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file defines the error and message codes for the cjpeg/djpeg
- * applications. These strings are not needed as part of the JPEG library
- * proper.
- * Edit this file to add new codes, or to translate the message strings to
- * some other language.
- */
-
-/*
- * To define the enum list of message codes, include this file without
- * defining macro JMESSAGE. To create a message string table, include it
- * again with a suitable JMESSAGE definition (see jerror.c for an example).
- */
-#ifndef JMESSAGE
-#ifndef CDERROR_H
-#define CDERROR_H
-/* First time through, define the enum list */
-#define JMAKE_ENUM_LIST
-#else
-/* Repeated inclusions of this file are no-ops unless JMESSAGE is defined */
-#define JMESSAGE(code,string)
-#endif /* CDERROR_H */
-#endif /* JMESSAGE */
-
-#ifdef JMAKE_ENUM_LIST
-
-typedef enum {
-
-#define JMESSAGE(code,string) code ,
-
-#endif /* JMAKE_ENUM_LIST */
-
-JMESSAGE(JMSG_FIRSTADDONCODE=1000, NULL) /* Must be first entry! */
-
-#ifdef BMP_SUPPORTED
-JMESSAGE(JERR_BMP_BADCMAP, "Unsupported BMP colormap format")
-JMESSAGE(JERR_BMP_BADDEPTH, "Only 8- and 24-bit BMP files are supported")
-JMESSAGE(JERR_BMP_BADHEADER, "Invalid BMP file: bad header length")
-JMESSAGE(JERR_BMP_BADPLANES, "Invalid BMP file: biPlanes not equal to 1")
-JMESSAGE(JERR_BMP_COLORSPACE, "BMP output must be grayscale or RGB")
-JMESSAGE(JERR_BMP_COMPRESSED, "Sorry, compressed BMPs not yet supported")
-JMESSAGE(JERR_BMP_NOT, "Not a BMP file - does not start with BM")
-JMESSAGE(JTRC_BMP, "%ux%u 24-bit BMP image")
-JMESSAGE(JTRC_BMP_MAPPED, "%ux%u 8-bit colormapped BMP image")
-JMESSAGE(JTRC_BMP_OS2, "%ux%u 24-bit OS2 BMP image")
-JMESSAGE(JTRC_BMP_OS2_MAPPED, "%ux%u 8-bit colormapped OS2 BMP image")
-#endif /* BMP_SUPPORTED */
-
-#ifdef GIF_SUPPORTED
-JMESSAGE(JERR_GIF_BUG, "GIF output got confused")
-JMESSAGE(JERR_GIF_CODESIZE, "Bogus GIF codesize %d")
-JMESSAGE(JERR_GIF_COLORSPACE, "GIF output must be grayscale or RGB")
-JMESSAGE(JERR_GIF_IMAGENOTFOUND, "Too few images in GIF file")
-JMESSAGE(JERR_GIF_NOT, "Not a GIF file")
-JMESSAGE(JTRC_GIF, "%ux%ux%d GIF image")
-JMESSAGE(JTRC_GIF_BADVERSION,
- "Warning: unexpected GIF version number '%c%c%c'")
-JMESSAGE(JTRC_GIF_EXTENSION, "Ignoring GIF extension block of type 0x%02x")
-JMESSAGE(JTRC_GIF_NONSQUARE, "Caution: nonsquare pixels in input")
-JMESSAGE(JWRN_GIF_BADDATA, "Corrupt data in GIF file")
-JMESSAGE(JWRN_GIF_CHAR, "Bogus char 0x%02x in GIF file, ignoring")
-JMESSAGE(JWRN_GIF_ENDCODE, "Premature end of GIF image")
-JMESSAGE(JWRN_GIF_NOMOREDATA, "Ran out of GIF bits")
-#endif /* GIF_SUPPORTED */
-
-#ifdef PPM_SUPPORTED
-JMESSAGE(JERR_PPM_COLORSPACE, "PPM output must be grayscale or RGB")
-JMESSAGE(JERR_PPM_NONNUMERIC, "Nonnumeric data in PPM file")
-JMESSAGE(JERR_PPM_NOT, "Not a PPM/PGM file")
-JMESSAGE(JTRC_PGM, "%ux%u PGM image")
-JMESSAGE(JTRC_PGM_TEXT, "%ux%u text PGM image")
-JMESSAGE(JTRC_PPM, "%ux%u PPM image")
-JMESSAGE(JTRC_PPM_TEXT, "%ux%u text PPM image")
-#endif /* PPM_SUPPORTED */
-
-#ifdef RLE_SUPPORTED
-JMESSAGE(JERR_RLE_BADERROR, "Bogus error code from RLE library")
-JMESSAGE(JERR_RLE_COLORSPACE, "RLE output must be grayscale or RGB")
-JMESSAGE(JERR_RLE_DIMENSIONS, "Image dimensions (%ux%u) too large for RLE")
-JMESSAGE(JERR_RLE_EMPTY, "Empty RLE file")
-JMESSAGE(JERR_RLE_EOF, "Premature EOF in RLE header")
-JMESSAGE(JERR_RLE_MEM, "Insufficient memory for RLE header")
-JMESSAGE(JERR_RLE_NOT, "Not an RLE file")
-JMESSAGE(JERR_RLE_TOOMANYCHANNELS, "Cannot handle %d output channels for RLE")
-JMESSAGE(JERR_RLE_UNSUPPORTED, "Cannot handle this RLE setup")
-JMESSAGE(JTRC_RLE, "%ux%u full-color RLE file")
-JMESSAGE(JTRC_RLE_FULLMAP, "%ux%u full-color RLE file with map of length %d")
-JMESSAGE(JTRC_RLE_GRAY, "%ux%u grayscale RLE file")
-JMESSAGE(JTRC_RLE_MAPGRAY, "%ux%u grayscale RLE file with map of length %d")
-JMESSAGE(JTRC_RLE_MAPPED, "%ux%u colormapped RLE file with map of length %d")
-#endif /* RLE_SUPPORTED */
-
-#ifdef TARGA_SUPPORTED
-JMESSAGE(JERR_TGA_BADCMAP, "Unsupported Targa colormap format")
-JMESSAGE(JERR_TGA_BADPARMS, "Invalid or unsupported Targa file")
-JMESSAGE(JERR_TGA_COLORSPACE, "Targa output must be grayscale or RGB")
-JMESSAGE(JTRC_TGA, "%ux%u RGB Targa image")
-JMESSAGE(JTRC_TGA_GRAY, "%ux%u grayscale Targa image")
-JMESSAGE(JTRC_TGA_MAPPED, "%ux%u colormapped Targa image")
-#else
-JMESSAGE(JERR_TGA_NOTCOMP, "Targa support was not compiled")
-#endif /* TARGA_SUPPORTED */
-
-JMESSAGE(JERR_BAD_CMAP_FILE,
- "Color map file is invalid or of unsupported format")
-JMESSAGE(JERR_TOO_MANY_COLORS,
- "Output file format cannot handle %d colormap entries")
-JMESSAGE(JERR_UNGETC_FAILED, "ungetc failed")
-#ifdef TARGA_SUPPORTED
-JMESSAGE(JERR_UNKNOWN_FORMAT,
- "Unrecognized input file format --- perhaps you need -targa")
-#else
-JMESSAGE(JERR_UNKNOWN_FORMAT, "Unrecognized input file format")
-#endif
-JMESSAGE(JERR_UNSUPPORTED_FORMAT, "Unsupported output file format")
-
-#ifdef JMAKE_ENUM_LIST
-
- JMSG_LASTADDONCODE
-} ADDON_MESSAGE_CODE;
-
-#undef JMAKE_ENUM_LIST
-#endif /* JMAKE_ENUM_LIST */
-
-/* Zap JMESSAGE macro so that future re-inclusions do nothing by default */
-#undef JMESSAGE
diff --git a/chromium/third_party/pdfium/third_party/libjpeg/cdjpeg.h b/chromium/third_party/pdfium/third_party/libjpeg/cdjpeg.h
deleted file mode 100644
index 3d728ee9c70..00000000000
--- a/chromium/third_party/pdfium/third_party/libjpeg/cdjpeg.h
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * cdjpeg.h
- *
- * Copyright (C) 1994-1997, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file contains common declarations for the sample applications
- * cjpeg and djpeg. It is NOT used by the core JPEG library.
- */
-
-#define JPEG_CJPEG_DJPEG /* define proper options in jconfig.h */
-#define JPEG_INTERNAL_OPTIONS /* cjpeg.c,djpeg.c need to see xxx_SUPPORTED */
-#include "jinclude.h"
-#include "jpeglib.h"
-#include "jerror.h" /* get library error codes too */
-#include "cderror.h" /* get application-specific error codes */
-
-
-/*
- * Object interface for cjpeg's source file decoding modules
- */
-
-typedef struct cjpeg_source_struct * cjpeg_source_ptr;
-
-struct cjpeg_source_struct {
- JMETHOD(void, start_input, (j_compress_ptr cinfo,
- cjpeg_source_ptr sinfo));
- JMETHOD(JDIMENSION, get_pixel_rows, (j_compress_ptr cinfo,
- cjpeg_source_ptr sinfo));
- JMETHOD(void, finish_input, (j_compress_ptr cinfo,
- cjpeg_source_ptr sinfo));
-
- FXSYS_FILE *input_file;
-
- JSAMPARRAY buffer;
- JDIMENSION buffer_height;
-};
-
-
-/*
- * Object interface for djpeg's output file encoding modules
- */
-
-typedef struct djpeg_dest_struct * djpeg_dest_ptr;
-
-struct djpeg_dest_struct {
- /* start_output is called after jpeg_start_decompress finishes.
- * The color map will be ready at this time, if one is needed.
- */
- JMETHOD(void, start_output, (j_decompress_ptr cinfo,
- djpeg_dest_ptr dinfo));
- /* Emit the specified number of pixel rows from the buffer. */
- JMETHOD(void, put_pixel_rows, (j_decompress_ptr cinfo,
- djpeg_dest_ptr dinfo,
- JDIMENSION rows_supplied));
- /* Finish up at the end of the image. */
- JMETHOD(void, finish_output, (j_decompress_ptr cinfo,
- djpeg_dest_ptr dinfo));
-
- /* Target file spec; filled in by djpeg.c after object is created. */
- FXSYS_FILE * output_file;
-
- /* Output pixel-row buffer. Created by module init or start_output.
- * Width is cinfo->output_width * cinfo->output_components;
- * height is buffer_height.
- */
- JSAMPARRAY buffer;
- JDIMENSION buffer_height;
-};
-
-
-/*
- * cjpeg/djpeg may need to perform extra passes to convert to or from
- * the source/destination file format. The JPEG library does not know
- * about these passes, but we'd like them to be counted by the progress
- * monitor. We use an expanded progress monitor object to hold the
- * additional pass count.
- */
-
-struct cdjpeg_progress_mgr {
- struct jpeg_progress_mgr pub; /* fields known to JPEG library */
- int completed_extra_passes; /* extra passes completed */
- int total_extra_passes; /* total extra */
- /* last printed percentage stored here to avoid multiple printouts */
- int percent_done;
-};
-
-typedef struct cdjpeg_progress_mgr * cd_progress_ptr;
-
-
-/* Short forms of external names for systems with brain-damaged linkers. */
-
-#ifdef NEED_SHORT_EXTERNAL_NAMES
-#define jinit_read_bmp jIRdBMP
-#define jinit_write_bmp jIWrBMP
-#define jinit_read_gif jIRdGIF
-#define jinit_write_gif jIWrGIF
-#define jinit_read_ppm jIRdPPM
-#define jinit_write_ppm jIWrPPM
-#define jinit_read_rle jIRdRLE
-#define jinit_write_rle jIWrRLE
-#define jinit_read_targa jIRdTarga
-#define jinit_write_targa jIWrTarga
-#define read_quant_tables RdQTables
-#define read_scan_script RdScnScript
-#define set_quant_slots SetQSlots
-#define set_sample_factors SetSFacts
-#define read_color_map RdCMap
-#define enable_signal_catcher EnSigCatcher
-#define start_progress_monitor StProgMon
-#define end_progress_monitor EnProgMon
-#define read_stdin RdStdin
-#define write_stdout WrStdout
-#endif /* NEED_SHORT_EXTERNAL_NAMES */
-
-/* Module selection routines for I/O modules. */
-
-EXTERN(cjpeg_source_ptr) jinit_read_bmp JPP((j_compress_ptr cinfo));
-EXTERN(djpeg_dest_ptr) jinit_write_bmp JPP((j_decompress_ptr cinfo,
- boolean is_os2));
-EXTERN(cjpeg_source_ptr) jinit_read_gif JPP((j_compress_ptr cinfo));
-EXTERN(djpeg_dest_ptr) jinit_write_gif JPP((j_decompress_ptr cinfo));
-EXTERN(cjpeg_source_ptr) jinit_read_ppm JPP((j_compress_ptr cinfo));
-EXTERN(djpeg_dest_ptr) jinit_write_ppm JPP((j_decompress_ptr cinfo));
-EXTERN(cjpeg_source_ptr) jinit_read_rle JPP((j_compress_ptr cinfo));
-EXTERN(djpeg_dest_ptr) jinit_write_rle JPP((j_decompress_ptr cinfo));
-EXTERN(cjpeg_source_ptr) jinit_read_targa JPP((j_compress_ptr cinfo));
-EXTERN(djpeg_dest_ptr) jinit_write_targa JPP((j_decompress_ptr cinfo));
-
-/* cjpeg support routines (in rdswitch.c) */
-
-EXTERN(boolean) read_quant_tables JPP((j_compress_ptr cinfo, char * filename,
- int scale_factor, boolean force_baseline));
-EXTERN(boolean) read_scan_script JPP((j_compress_ptr cinfo, char * filename));
-EXTERN(boolean) set_quant_slots JPP((j_compress_ptr cinfo, char *arg));
-EXTERN(boolean) set_sample_factors JPP((j_compress_ptr cinfo, char *arg));
-
-/* djpeg support routines (in rdcolmap.c) */
-
-EXTERN(void) read_color_map JPP((j_decompress_ptr cinfo, FXSYS_FILE * infile));
-
-/* common support routines (in cdjpeg.c) */
-
-EXTERN(void) enable_signal_catcher JPP((j_common_ptr cinfo));
-EXTERN(void) start_progress_monitor JPP((j_common_ptr cinfo,
- cd_progress_ptr progress));
-EXTERN(void) end_progress_monitor JPP((j_common_ptr cinfo));
-EXTERN(boolean) keymatch JPP((char * arg, const char * keyword, int minchars));
-EXTERN(FXSYS_FILE *) read_stdin JPP((void));
-EXTERN(FXSYS_FILE *) write_stdout JPP((void));
-
-/* miscellaneous useful macros */
-
-#ifdef DONT_USE_B_MODE /* define mode parameters for fopen() */
-#define READ_BINARY "r"
-#define WRITE_BINARY "w"
-#else
-#ifdef VMS /* VMS is very nonstandard */
-#define READ_BINARY "rb", "ctx=stm"
-#define WRITE_BINARY "wb", "ctx=stm"
-#else /* standard ANSI-compliant case */
-#define READ_BINARY "rb"
-#define WRITE_BINARY "wb"
-#endif
-#endif
-
-#ifndef EXIT_FAILURE /* define exit() codes if not provided */
-#define EXIT_FAILURE 1
-#endif
-#ifndef EXIT_SUCCESS
-#ifdef VMS
-#define EXIT_SUCCESS 1 /* VMS is very nonstandard */
-#else
-#define EXIT_SUCCESS 0
-#endif
-#endif
-#ifndef EXIT_WARNING
-#ifdef VMS
-#define EXIT_WARNING 1 /* VMS is very nonstandard */
-#else
-#define EXIT_WARNING 2
-#endif
-#endif
diff --git a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jcapimin.c b/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jcapimin.c
deleted file mode 100644
index 54fb8c58c56..00000000000
--- a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jcapimin.c
+++ /dev/null
@@ -1,280 +0,0 @@
-/*
- * jcapimin.c
- *
- * Copyright (C) 1994-1998, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file contains application interface code for the compression half
- * of the JPEG library. These are the "minimum" API routines that may be
- * needed in either the normal full-compression case or the transcoding-only
- * case.
- *
- * Most of the routines intended to be called directly by an application
- * are in this file or in jcapistd.c. But also see jcparam.c for
- * parameter-setup helper routines, jcomapi.c for routines shared by
- * compression and decompression, and jctrans.c for the transcoding case.
- */
-
-#define JPEG_INTERNALS
-#include "jinclude.h"
-#include "jpeglib.h"
-
-
-/*
- * Initialization of a JPEG compression object.
- * The error manager must already be set up (in case memory manager fails).
- */
-
-GLOBAL(void)
-jpeg_CreateCompress (j_compress_ptr cinfo, int version, size_t structsize)
-{
- int i;
-
- /* Guard against version mismatches between library and caller. */
- cinfo->mem = NULL; /* so jpeg_destroy knows mem mgr not called */
- if (version != JPEG_LIB_VERSION)
- ERREXIT2(cinfo, JERR_BAD_LIB_VERSION, JPEG_LIB_VERSION, version);
- if (structsize != SIZEOF(struct jpeg_compress_struct))
- ERREXIT2(cinfo, JERR_BAD_STRUCT_SIZE,
- (int) SIZEOF(struct jpeg_compress_struct), (int) structsize);
-
- /* For debugging purposes, we zero the whole master structure.
- * But the application has already set the err pointer, and may have set
- * client_data, so we have to save and restore those fields.
- * Note: if application hasn't set client_data, tools like Purify may
- * complain here.
- */
- {
- struct jpeg_error_mgr * err = cinfo->err;
- void * client_data = cinfo->client_data; /* ignore Purify complaint here */
- MEMZERO(cinfo, SIZEOF(struct jpeg_compress_struct));
- cinfo->err = err;
- cinfo->client_data = client_data;
- }
- cinfo->is_decompressor = FALSE;
-
- /* Initialize a memory manager instance for this object */
- jinit_memory_mgr((j_common_ptr) cinfo);
-
- /* Zero out pointers to permanent structures. */
- cinfo->progress = NULL;
- cinfo->dest = NULL;
-
- cinfo->comp_info = NULL;
-
- for (i = 0; i < NUM_QUANT_TBLS; i++)
- cinfo->quant_tbl_ptrs[i] = NULL;
-
- for (i = 0; i < NUM_HUFF_TBLS; i++) {
- cinfo->dc_huff_tbl_ptrs[i] = NULL;
- cinfo->ac_huff_tbl_ptrs[i] = NULL;
- }
-
- cinfo->script_space = NULL;
-
- cinfo->input_gamma = 1.0; /* in case application forgets */
-
- /* OK, I'm ready */
- cinfo->global_state = CSTATE_START;
-}
-
-
-/*
- * Destruction of a JPEG compression object
- */
-
-GLOBAL(void)
-jpeg_destroy_compress (j_compress_ptr cinfo)
-{
- jpeg_destroy((j_common_ptr) cinfo); /* use common routine */
-}
-
-
-/*
- * Abort processing of a JPEG compression operation,
- * but don't destroy the object itself.
- */
-
-GLOBAL(void)
-jpeg_abort_compress (j_compress_ptr cinfo)
-{
- jpeg_abort((j_common_ptr) cinfo); /* use common routine */
-}
-
-
-/*
- * Forcibly suppress or un-suppress all quantization and Huffman tables.
- * Marks all currently defined tables as already written (if suppress)
- * or not written (if !suppress). This will control whether they get emitted
- * by a subsequent jpeg_start_compress call.
- *
- * This routine is exported for use by applications that want to produce
- * abbreviated JPEG datastreams. It logically belongs in jcparam.c, but
- * since it is called by jpeg_start_compress, we put it here --- otherwise
- * jcparam.o would be linked whether the application used it or not.
- */
-
-GLOBAL(void)
-jpeg_suppress_tables (j_compress_ptr cinfo, boolean suppress)
-{
- int i;
- JQUANT_TBL * qtbl;
- JHUFF_TBL * htbl;
-
- for (i = 0; i < NUM_QUANT_TBLS; i++) {
- if ((qtbl = cinfo->quant_tbl_ptrs[i]) != NULL)
- qtbl->sent_table = suppress;
- }
-
- for (i = 0; i < NUM_HUFF_TBLS; i++) {
- if ((htbl = cinfo->dc_huff_tbl_ptrs[i]) != NULL)
- htbl->sent_table = suppress;
- if ((htbl = cinfo->ac_huff_tbl_ptrs[i]) != NULL)
- htbl->sent_table = suppress;
- }
-}
-
-
-/*
- * Finish JPEG compression.
- *
- * If a multipass operating mode was selected, this may do a great deal of
- * work including most of the actual output.
- */
-
-GLOBAL(void)
-jpeg_finish_compress (j_compress_ptr cinfo)
-{
- JDIMENSION iMCU_row;
-
- if (cinfo->global_state == CSTATE_SCANNING ||
- cinfo->global_state == CSTATE_RAW_OK) {
- /* Terminate first pass */
- if (cinfo->next_scanline < cinfo->image_height)
- ERREXIT(cinfo, JERR_TOO_LITTLE_DATA);
- (*cinfo->master->finish_pass) (cinfo);
- } else if (cinfo->global_state != CSTATE_WRCOEFS)
- ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
- /* Perform any remaining passes */
- while (! cinfo->master->is_last_pass) {
- (*cinfo->master->prepare_for_pass) (cinfo);
- for (iMCU_row = 0; iMCU_row < cinfo->total_iMCU_rows; iMCU_row++) {
- if (cinfo->progress != NULL) {
- cinfo->progress->pass_counter = (long) iMCU_row;
- cinfo->progress->pass_limit = (long) cinfo->total_iMCU_rows;
- (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);
- }
- /* We bypass the main controller and invoke coef controller directly;
- * all work is being done from the coefficient buffer.
- */
- if (! (*cinfo->coef->compress_data) (cinfo, (JSAMPIMAGE) NULL))
- ERREXIT(cinfo, JERR_CANT_SUSPEND);
- }
- (*cinfo->master->finish_pass) (cinfo);
- }
- /* Write EOI, do final cleanup */
- (*cinfo->marker->write_file_trailer) (cinfo);
- (*cinfo->dest->term_destination) (cinfo);
- /* We can use jpeg_abort to release memory and reset global_state */
- jpeg_abort((j_common_ptr) cinfo);
-}
-
-
-/*
- * Write a special marker.
- * This is only recommended for writing COM or APPn markers.
- * Must be called after jpeg_start_compress() and before
- * first call to jpeg_write_scanlines() or jpeg_write_raw_data().
- */
-
-GLOBAL(void)
-jpeg_write_marker (j_compress_ptr cinfo, int marker,
- const JOCTET *dataptr, unsigned int datalen)
-{
- JMETHOD(void, write_marker_byte, (j_compress_ptr info, int val));
-
- if (cinfo->next_scanline != 0 ||
- (cinfo->global_state != CSTATE_SCANNING &&
- cinfo->global_state != CSTATE_RAW_OK &&
- cinfo->global_state != CSTATE_WRCOEFS))
- ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
-
- (*cinfo->marker->write_marker_header) (cinfo, marker, datalen);
- write_marker_byte = cinfo->marker->write_marker_byte; /* copy for speed */
- while (datalen--) {
- (*write_marker_byte) (cinfo, *dataptr);
- dataptr++;
- }
-}
-
-/* Same, but piecemeal. */
-
-GLOBAL(void)
-jpeg_write_m_header (j_compress_ptr cinfo, int marker, unsigned int datalen)
-{
- if (cinfo->next_scanline != 0 ||
- (cinfo->global_state != CSTATE_SCANNING &&
- cinfo->global_state != CSTATE_RAW_OK &&
- cinfo->global_state != CSTATE_WRCOEFS))
- ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
-
- (*cinfo->marker->write_marker_header) (cinfo, marker, datalen);
-}
-
-GLOBAL(void)
-jpeg_write_m_byte (j_compress_ptr cinfo, int val)
-{
- (*cinfo->marker->write_marker_byte) (cinfo, val);
-}
-
-
-/*
- * Alternate compression function: just write an abbreviated table file.
- * Before calling this, all parameters and a data destination must be set up.
- *
- * To produce a pair of files containing abbreviated tables and abbreviated
- * image data, one would proceed as follows:
- *
- * initialize JPEG object
- * set JPEG parameters
- * set destination to table file
- * jpeg_write_tables(cinfo);
- * set destination to image file
- * jpeg_start_compress(cinfo, FALSE);
- * write data...
- * jpeg_finish_compress(cinfo);
- *
- * jpeg_write_tables has the side effect of marking all tables written
- * (same as jpeg_suppress_tables(..., TRUE)). Thus a subsequent start_compress
- * will not re-emit the tables unless it is passed write_all_tables=TRUE.
- */
-
-GLOBAL(void)
-jpeg_write_tables (j_compress_ptr cinfo)
-{
- if (cinfo->global_state != CSTATE_START)
- ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
-
- /* (Re)initialize error mgr and destination modules */
- (*cinfo->err->reset_error_mgr) ((j_common_ptr) cinfo);
- (*cinfo->dest->init_destination) (cinfo);
- /* Initialize the marker writer ... bit of a crock to do it here. */
- jinit_marker_writer(cinfo);
- /* Write them tables! */
- (*cinfo->marker->write_tables_only) (cinfo);
- /* And clean up. */
- (*cinfo->dest->term_destination) (cinfo);
- /*
- * In library releases up through v6a, we called jpeg_abort() here to free
- * any working memory allocated by the destination manager and marker
- * writer. Some applications had a problem with that: they allocated space
- * of their own from the library memory manager, and didn't want it to go
- * away during write_tables. So now we do nothing. This will cause a
- * memory leak if an app calls write_tables repeatedly without doing a full
- * compression cycle or otherwise resetting the JPEG object. However, that
- * seems less bad than unexpectedly freeing memory in the normal case.
- * An app that prefers the old behavior can call jpeg_abort for itself after
- * each call to jpeg_write_tables().
- */
-}
diff --git a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jcapistd.c b/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jcapistd.c
deleted file mode 100644
index c0320b1b190..00000000000
--- a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jcapistd.c
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * jcapistd.c
- *
- * Copyright (C) 1994-1996, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file contains application interface code for the compression half
- * of the JPEG library. These are the "standard" API routines that are
- * used in the normal full-compression case. They are not used by a
- * transcoding-only application. Note that if an application links in
- * jpeg_start_compress, it will end up linking in the entire compressor.
- * We thus must separate this file from jcapimin.c to avoid linking the
- * whole compression library into a transcoder.
- */
-
-#define JPEG_INTERNALS
-#include "jinclude.h"
-#include "jpeglib.h"
-
-
-/*
- * Compression initialization.
- * Before calling this, all parameters and a data destination must be set up.
- *
- * We require a write_all_tables parameter as a failsafe check when writing
- * multiple datastreams from the same compression object. Since prior runs
- * will have left all the tables marked sent_table=TRUE, a subsequent run
- * would emit an abbreviated stream (no tables) by default. This may be what
- * is wanted, but for safety's sake it should not be the default behavior:
- * programmers should have to make a deliberate choice to emit abbreviated
- * images. Therefore the documentation and examples should encourage people
- * to pass write_all_tables=TRUE; then it will take active thought to do the
- * wrong thing.
- */
-
-GLOBAL(void)
-jpeg_start_compress (j_compress_ptr cinfo, boolean write_all_tables)
-{
- if (cinfo->global_state != CSTATE_START)
- ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
-
- if (write_all_tables)
- jpeg_suppress_tables(cinfo, FALSE); /* mark all tables to be written */
-
- /* (Re)initialize error mgr and destination modules */
- (*cinfo->err->reset_error_mgr) ((j_common_ptr) cinfo);
- (*cinfo->dest->init_destination) (cinfo);
- /* Perform master selection of active modules */
- jinit_compress_master(cinfo);
- /* Set up for the first pass */
- (*cinfo->master->prepare_for_pass) (cinfo);
- /* Ready for application to drive first pass through jpeg_write_scanlines
- * or jpeg_write_raw_data.
- */
- cinfo->next_scanline = 0;
- cinfo->global_state = (cinfo->raw_data_in ? CSTATE_RAW_OK : CSTATE_SCANNING);
-}
-
-
-/*
- * Write some scanlines of data to the JPEG compressor.
- *
- * The return value will be the number of lines actually written.
- * This should be less than the supplied num_lines only in case that
- * the data destination module has requested suspension of the compressor,
- * or if more than image_height scanlines are passed in.
- *
- * Note: we warn about excess calls to jpeg_write_scanlines() since
- * this likely signals an application programmer error. However,
- * excess scanlines passed in the last valid call are *silently* ignored,
- * so that the application need not adjust num_lines for end-of-image
- * when using a multiple-scanline buffer.
- */
-
-GLOBAL(JDIMENSION)
-jpeg_write_scanlines (j_compress_ptr cinfo, JSAMPARRAY scanlines,
- JDIMENSION num_lines)
-{
- JDIMENSION row_ctr, rows_left;
-
- if (cinfo->global_state != CSTATE_SCANNING)
- ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
- if (cinfo->next_scanline >= cinfo->image_height)
- WARNMS(cinfo, JWRN_TOO_MUCH_DATA);
-
- /* Call progress monitor hook if present */
- if (cinfo->progress != NULL) {
- cinfo->progress->pass_counter = (long) cinfo->next_scanline;
- cinfo->progress->pass_limit = (long) cinfo->image_height;
- (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);
- }
-
- /* Give master control module another chance if this is first call to
- * jpeg_write_scanlines. This lets output of the frame/scan headers be
- * delayed so that application can write COM, etc, markers between
- * jpeg_start_compress and jpeg_write_scanlines.
- */
- if (cinfo->master->call_pass_startup)
- (*cinfo->master->pass_startup) (cinfo);
-
- /* Ignore any extra scanlines at bottom of image. */
- rows_left = cinfo->image_height - cinfo->next_scanline;
- if (num_lines > rows_left)
- num_lines = rows_left;
-
- row_ctr = 0;
- (*cinfo->main->process_data) (cinfo, scanlines, &row_ctr, num_lines);
- cinfo->next_scanline += row_ctr;
- return row_ctr;
-}
-
-
-/*
- * Alternate entry point to write raw data.
- * Processes exactly one iMCU row per call, unless suspended.
- */
-
-GLOBAL(JDIMENSION)
-jpeg_write_raw_data (j_compress_ptr cinfo, JSAMPIMAGE data,
- JDIMENSION num_lines)
-{
- JDIMENSION lines_per_iMCU_row;
-
- if (cinfo->global_state != CSTATE_RAW_OK)
- ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
- if (cinfo->next_scanline >= cinfo->image_height) {
- WARNMS(cinfo, JWRN_TOO_MUCH_DATA);
- return 0;
- }
-
- /* Call progress monitor hook if present */
- if (cinfo->progress != NULL) {
- cinfo->progress->pass_counter = (long) cinfo->next_scanline;
- cinfo->progress->pass_limit = (long) cinfo->image_height;
- (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);
- }
-
- /* Give master control module another chance if this is first call to
- * jpeg_write_raw_data. This lets output of the frame/scan headers be
- * delayed so that application can write COM, etc, markers between
- * jpeg_start_compress and jpeg_write_raw_data.
- */
- if (cinfo->master->call_pass_startup)
- (*cinfo->master->pass_startup) (cinfo);
-
- /* Verify that at least one iMCU row has been passed. */
- lines_per_iMCU_row = cinfo->max_v_samp_factor * DCTSIZE;
- if (num_lines < lines_per_iMCU_row)
- ERREXIT(cinfo, JERR_BUFFER_SIZE);
-
- /* Directly compress the row. */
- if (! (*cinfo->coef->compress_data) (cinfo, data)) {
- /* If compressor did not consume the whole row, suspend processing. */
- return 0;
- }
-
- /* OK, we processed one iMCU row. */
- cinfo->next_scanline += lines_per_iMCU_row;
- return lines_per_iMCU_row;
-}
diff --git a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jccoefct.c b/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jccoefct.c
deleted file mode 100644
index 1963ddb61b1..00000000000
--- a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jccoefct.c
+++ /dev/null
@@ -1,449 +0,0 @@
-/*
- * jccoefct.c
- *
- * Copyright (C) 1994-1997, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file contains the coefficient buffer controller for compression.
- * This controller is the top level of the JPEG compressor proper.
- * The coefficient buffer lies between forward-DCT and entropy encoding steps.
- */
-
-#define JPEG_INTERNALS
-#include "jinclude.h"
-#include "jpeglib.h"
-
-
-/* We use a full-image coefficient buffer when doing Huffman optimization,
- * and also for writing multiple-scan JPEG files. In all cases, the DCT
- * step is run during the first pass, and subsequent passes need only read
- * the buffered coefficients.
- */
-#ifdef ENTROPY_OPT_SUPPORTED
-#define FULL_COEF_BUFFER_SUPPORTED
-#else
-#ifdef C_MULTISCAN_FILES_SUPPORTED
-#define FULL_COEF_BUFFER_SUPPORTED
-#endif
-#endif
-
-
-/* Private buffer controller object */
-
-typedef struct {
- struct jpeg_c_coef_controller pub; /* public fields */
-
- JDIMENSION iMCU_row_num; /* iMCU row # within image */
- JDIMENSION mcu_ctr; /* counts MCUs processed in current row */
- int MCU_vert_offset; /* counts MCU rows within iMCU row */
- int MCU_rows_per_iMCU_row; /* number of such rows needed */
-
- /* For single-pass compression, it's sufficient to buffer just one MCU
- * (although this may prove a bit slow in practice). We allocate a
- * workspace of C_MAX_BLOCKS_IN_MCU coefficient blocks, and reuse it for each
- * MCU constructed and sent. (On 80x86, the workspace is FAR even though
- * it's not really very big; this is to keep the module interfaces unchanged
- * when a large coefficient buffer is necessary.)
- * In multi-pass modes, this array points to the current MCU's blocks
- * within the virtual arrays.
- */
- JBLOCKROW MCU_buffer[C_MAX_BLOCKS_IN_MCU];
-
- /* In multi-pass modes, we need a virtual block array for each component. */
- jvirt_barray_ptr whole_image[MAX_COMPONENTS];
-} my_coef_controller;
-
-typedef my_coef_controller * my_coef_ptr;
-
-
-/* Forward declarations */
-METHODDEF(boolean) compress_data
- JPP((j_compress_ptr cinfo, JSAMPIMAGE input_buf));
-#ifdef FULL_COEF_BUFFER_SUPPORTED
-METHODDEF(boolean) compress_first_pass
- JPP((j_compress_ptr cinfo, JSAMPIMAGE input_buf));
-METHODDEF(boolean) compress_output
- JPP((j_compress_ptr cinfo, JSAMPIMAGE input_buf));
-#endif
-
-
-LOCAL(void)
-start_iMCU_row (j_compress_ptr cinfo)
-/* Reset within-iMCU-row counters for a new row */
-{
- my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
-
- /* In an interleaved scan, an MCU row is the same as an iMCU row.
- * In a noninterleaved scan, an iMCU row has v_samp_factor MCU rows.
- * But at the bottom of the image, process only what's left.
- */
- if (cinfo->comps_in_scan > 1) {
- coef->MCU_rows_per_iMCU_row = 1;
- } else {
- if (coef->iMCU_row_num < (cinfo->total_iMCU_rows-1))
- coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor;
- else
- coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height;
- }
-
- coef->mcu_ctr = 0;
- coef->MCU_vert_offset = 0;
-}
-
-
-/*
- * Initialize for a processing pass.
- */
-
-METHODDEF(void)
-start_pass_coef (j_compress_ptr cinfo, J_BUF_MODE pass_mode)
-{
- my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
-
- coef->iMCU_row_num = 0;
- start_iMCU_row(cinfo);
-
- switch (pass_mode) {
- case JBUF_PASS_THRU:
- if (coef->whole_image[0] != NULL)
- ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
- coef->pub.compress_data = compress_data;
- break;
-#ifdef FULL_COEF_BUFFER_SUPPORTED
- case JBUF_SAVE_AND_PASS:
- if (coef->whole_image[0] == NULL)
- ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
- coef->pub.compress_data = compress_first_pass;
- break;
- case JBUF_CRANK_DEST:
- if (coef->whole_image[0] == NULL)
- ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
- coef->pub.compress_data = compress_output;
- break;
-#endif
- default:
- ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
- break;
- }
-}
-
-
-/*
- * Process some data in the single-pass case.
- * We process the equivalent of one fully interleaved MCU row ("iMCU" row)
- * per call, ie, v_samp_factor block rows for each component in the image.
- * Returns TRUE if the iMCU row is completed, FALSE if suspended.
- *
- * NB: input_buf contains a plane for each component in image,
- * which we index according to the component's SOF position.
- */
-
-METHODDEF(boolean)
-compress_data (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
-{
- my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
- JDIMENSION MCU_col_num; /* index of current MCU within row */
- JDIMENSION last_MCU_col = cinfo->MCUs_per_row - 1;
- JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
- int blkn, bi, ci, yindex, yoffset, blockcnt;
- JDIMENSION ypos, xpos;
- jpeg_component_info *compptr;
-
- /* Loop to write as much as one whole iMCU row */
- for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
- yoffset++) {
- for (MCU_col_num = coef->mcu_ctr; MCU_col_num <= last_MCU_col;
- MCU_col_num++) {
- /* Determine where data comes from in input_buf and do the DCT thing.
- * Each call on forward_DCT processes a horizontal row of DCT blocks
- * as wide as an MCU; we rely on having allocated the MCU_buffer[] blocks
- * sequentially. Dummy blocks at the right or bottom edge are filled in
- * specially. The data in them does not matter for image reconstruction,
- * so we fill them with values that will encode to the smallest amount of
- * data, viz: all zeroes in the AC entries, DC entries equal to previous
- * block's DC value. (Thanks to Thomas Kinsman for this idea.)
- */
- blkn = 0;
- for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
- compptr = cinfo->cur_comp_info[ci];
- blockcnt = (MCU_col_num < last_MCU_col) ? compptr->MCU_width
- : compptr->last_col_width;
- xpos = MCU_col_num * compptr->MCU_sample_width;
- ypos = yoffset * DCTSIZE; /* ypos == (yoffset+yindex) * DCTSIZE */
- for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
- if (coef->iMCU_row_num < last_iMCU_row ||
- yoffset+yindex < compptr->last_row_height) {
- (*cinfo->fdct->forward_DCT) (cinfo, compptr,
- input_buf[compptr->component_index],
- coef->MCU_buffer[blkn],
- ypos, xpos, (JDIMENSION) blockcnt);
- if (blockcnt < compptr->MCU_width) {
- /* Create some dummy blocks at the right edge of the image. */
- jzero_far((void FAR *) coef->MCU_buffer[blkn + blockcnt],
- (compptr->MCU_width - blockcnt) * SIZEOF(JBLOCK));
- for (bi = blockcnt; bi < compptr->MCU_width; bi++) {
- coef->MCU_buffer[blkn+bi][0][0] = coef->MCU_buffer[blkn+bi-1][0][0];
- }
- }
- } else {
- /* Create a row of dummy blocks at the bottom of the image. */
- jzero_far((void FAR *) coef->MCU_buffer[blkn],
- compptr->MCU_width * SIZEOF(JBLOCK));
- for (bi = 0; bi < compptr->MCU_width; bi++) {
- coef->MCU_buffer[blkn+bi][0][0] = coef->MCU_buffer[blkn-1][0][0];
- }
- }
- blkn += compptr->MCU_width;
- ypos += DCTSIZE;
- }
- }
- /* Try to write the MCU. In event of a suspension failure, we will
- * re-DCT the MCU on restart (a bit inefficient, could be fixed...)
- */
- if (! (*cinfo->entropy->encode_mcu) (cinfo, coef->MCU_buffer)) {
- /* Suspension forced; update state counters and exit */
- coef->MCU_vert_offset = yoffset;
- coef->mcu_ctr = MCU_col_num;
- return FALSE;
- }
- }
- /* Completed an MCU row, but perhaps not an iMCU row */
- coef->mcu_ctr = 0;
- }
- /* Completed the iMCU row, advance counters for next one */
- coef->iMCU_row_num++;
- start_iMCU_row(cinfo);
- return TRUE;
-}
-
-
-#ifdef FULL_COEF_BUFFER_SUPPORTED
-
-/*
- * Process some data in the first pass of a multi-pass case.
- * We process the equivalent of one fully interleaved MCU row ("iMCU" row)
- * per call, ie, v_samp_factor block rows for each component in the image.
- * This amount of data is read from the source buffer, DCT'd and quantized,
- * and saved into the virtual arrays. We also generate suitable dummy blocks
- * as needed at the right and lower edges. (The dummy blocks are constructed
- * in the virtual arrays, which have been padded appropriately.) This makes
- * it possible for subsequent passes not to worry about real vs. dummy blocks.
- *
- * We must also emit the data to the entropy encoder. This is conveniently
- * done by calling compress_output() after we've loaded the current strip
- * of the virtual arrays.
- *
- * NB: input_buf contains a plane for each component in image. All
- * components are DCT'd and loaded into the virtual arrays in this pass.
- * However, it may be that only a subset of the components are emitted to
- * the entropy encoder during this first pass; be careful about looking
- * at the scan-dependent variables (MCU dimensions, etc).
- */
-
-METHODDEF(boolean)
-compress_first_pass (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
-{
- my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
- JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
- JDIMENSION blocks_across, MCUs_across, MCUindex;
- int bi, ci, h_samp_factor, block_row, block_rows, ndummy;
- JCOEF lastDC;
- jpeg_component_info *compptr;
- JBLOCKARRAY buffer;
- JBLOCKROW thisblockrow, lastblockrow;
-
- for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
- ci++, compptr++) {
- /* Align the virtual buffer for this component. */
- buffer = (*cinfo->mem->access_virt_barray)
- ((j_common_ptr) cinfo, coef->whole_image[ci],
- coef->iMCU_row_num * compptr->v_samp_factor,
- (JDIMENSION) compptr->v_samp_factor, TRUE);
- /* Count non-dummy DCT block rows in this iMCU row. */
- if (coef->iMCU_row_num < last_iMCU_row)
- block_rows = compptr->v_samp_factor;
- else {
- /* NB: can't use last_row_height here, since may not be set! */
- block_rows = (int) (compptr->height_in_blocks % compptr->v_samp_factor);
- if (block_rows == 0) block_rows = compptr->v_samp_factor;
- }
- blocks_across = compptr->width_in_blocks;
- h_samp_factor = compptr->h_samp_factor;
- /* Count number of dummy blocks to be added at the right margin. */
- ndummy = (int) (blocks_across % h_samp_factor);
- if (ndummy > 0)
- ndummy = h_samp_factor - ndummy;
- /* Perform DCT for all non-dummy blocks in this iMCU row. Each call
- * on forward_DCT processes a complete horizontal row of DCT blocks.
- */
- for (block_row = 0; block_row < block_rows; block_row++) {
- thisblockrow = buffer[block_row];
- (*cinfo->fdct->forward_DCT) (cinfo, compptr,
- input_buf[ci], thisblockrow,
- (JDIMENSION) (block_row * DCTSIZE),
- (JDIMENSION) 0, blocks_across);
- if (ndummy > 0) {
- /* Create dummy blocks at the right edge of the image. */
- thisblockrow += blocks_across; /* => first dummy block */
- jzero_far((void FAR *) thisblockrow, ndummy * SIZEOF(JBLOCK));
- lastDC = thisblockrow[-1][0];
- for (bi = 0; bi < ndummy; bi++) {
- thisblockrow[bi][0] = lastDC;
- }
- }
- }
- /* If at end of image, create dummy block rows as needed.
- * The tricky part here is that within each MCU, we want the DC values
- * of the dummy blocks to match the last real block's DC value.
- * This squeezes a few more bytes out of the resulting file...
- */
- if (coef->iMCU_row_num == last_iMCU_row) {
- blocks_across += ndummy; /* include lower right corner */
- MCUs_across = blocks_across / h_samp_factor;
- for (block_row = block_rows; block_row < compptr->v_samp_factor;
- block_row++) {
- thisblockrow = buffer[block_row];
- lastblockrow = buffer[block_row-1];
- jzero_far((void FAR *) thisblockrow,
- (size_t) (blocks_across * SIZEOF(JBLOCK)));
- for (MCUindex = 0; MCUindex < MCUs_across; MCUindex++) {
- lastDC = lastblockrow[h_samp_factor-1][0];
- for (bi = 0; bi < h_samp_factor; bi++) {
- thisblockrow[bi][0] = lastDC;
- }
- thisblockrow += h_samp_factor; /* advance to next MCU in row */
- lastblockrow += h_samp_factor;
- }
- }
- }
- }
- /* NB: compress_output will increment iMCU_row_num if successful.
- * A suspension return will result in redoing all the work above next time.
- */
-
- /* Emit data to the entropy encoder, sharing code with subsequent passes */
- return compress_output(cinfo, input_buf);
-}
-
-
-/*
- * Process some data in subsequent passes of a multi-pass case.
- * We process the equivalent of one fully interleaved MCU row ("iMCU" row)
- * per call, ie, v_samp_factor block rows for each component in the scan.
- * The data is obtained from the virtual arrays and fed to the entropy coder.
- * Returns TRUE if the iMCU row is completed, FALSE if suspended.
- *
- * NB: input_buf is ignored; it is likely to be a NULL pointer.
- */
-
-METHODDEF(boolean)
-compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
-{
- my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
- JDIMENSION MCU_col_num; /* index of current MCU within row */
- int blkn, ci, xindex, yindex, yoffset;
- JDIMENSION start_col;
- JBLOCKARRAY buffer[MAX_COMPS_IN_SCAN];
- JBLOCKROW buffer_ptr;
- jpeg_component_info *compptr;
-
- /* Align the virtual buffers for the components used in this scan.
- * NB: during first pass, this is safe only because the buffers will
- * already be aligned properly, so jmemmgr.c won't need to do any I/O.
- */
- for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
- compptr = cinfo->cur_comp_info[ci];
- buffer[ci] = (*cinfo->mem->access_virt_barray)
- ((j_common_ptr) cinfo, coef->whole_image[compptr->component_index],
- coef->iMCU_row_num * compptr->v_samp_factor,
- (JDIMENSION) compptr->v_samp_factor, FALSE);
- }
-
- /* Loop to process one whole iMCU row */
- for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
- yoffset++) {
- for (MCU_col_num = coef->mcu_ctr; MCU_col_num < cinfo->MCUs_per_row;
- MCU_col_num++) {
- /* Construct list of pointers to DCT blocks belonging to this MCU */
- blkn = 0; /* index of current DCT block within MCU */
- for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
- compptr = cinfo->cur_comp_info[ci];
- start_col = MCU_col_num * compptr->MCU_width;
- for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
- buffer_ptr = buffer[ci][yindex+yoffset] + start_col;
- for (xindex = 0; xindex < compptr->MCU_width; xindex++) {
- coef->MCU_buffer[blkn++] = buffer_ptr++;
- }
- }
- }
- /* Try to write the MCU. */
- if (! (*cinfo->entropy->encode_mcu) (cinfo, coef->MCU_buffer)) {
- /* Suspension forced; update state counters and exit */
- coef->MCU_vert_offset = yoffset;
- coef->mcu_ctr = MCU_col_num;
- return FALSE;
- }
- }
- /* Completed an MCU row, but perhaps not an iMCU row */
- coef->mcu_ctr = 0;
- }
- /* Completed the iMCU row, advance counters for next one */
- coef->iMCU_row_num++;
- start_iMCU_row(cinfo);
- return TRUE;
-}
-
-#endif /* FULL_COEF_BUFFER_SUPPORTED */
-
-
-/*
- * Initialize coefficient buffer controller.
- */
-
-GLOBAL(void)
-jinit_c_coef_controller (j_compress_ptr cinfo, boolean need_full_buffer)
-{
- my_coef_ptr coef;
-
- coef = (my_coef_ptr)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- SIZEOF(my_coef_controller));
- cinfo->coef = (struct jpeg_c_coef_controller *) coef;
- coef->pub.start_pass = start_pass_coef;
-
- /* Create the coefficient buffer. */
- if (need_full_buffer) {
-#ifdef FULL_COEF_BUFFER_SUPPORTED
- /* Allocate a full-image virtual array for each component, */
- /* padded to a multiple of samp_factor DCT blocks in each direction. */
- int ci;
- jpeg_component_info *compptr;
-
- for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
- ci++, compptr++) {
- coef->whole_image[ci] = (*cinfo->mem->request_virt_barray)
- ((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE,
- (JDIMENSION) jround_up((long) compptr->width_in_blocks,
- (long) compptr->h_samp_factor),
- (JDIMENSION) jround_up((long) compptr->height_in_blocks,
- (long) compptr->v_samp_factor),
- (JDIMENSION) compptr->v_samp_factor);
- }
-#else
- ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
-#endif
- } else {
- /* We only need a single-MCU buffer. */
- JBLOCKROW buffer;
- int i;
-
- buffer = (JBLOCKROW)
- (*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- C_MAX_BLOCKS_IN_MCU * SIZEOF(JBLOCK));
- for (i = 0; i < C_MAX_BLOCKS_IN_MCU; i++) {
- coef->MCU_buffer[i] = buffer + i;
- }
- coef->whole_image[0] = NULL; /* flag for no virtual arrays */
- }
-}
diff --git a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jccolor.c b/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jccolor.c
deleted file mode 100644
index 0a8a4b5d13c..00000000000
--- a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jccolor.c
+++ /dev/null
@@ -1,459 +0,0 @@
-/*
- * jccolor.c
- *
- * Copyright (C) 1991-1996, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file contains input colorspace conversion routines.
- */
-
-#define JPEG_INTERNALS
-#include "jinclude.h"
-#include "jpeglib.h"
-
-
-/* Private subobject */
-
-typedef struct {
- struct jpeg_color_converter pub; /* public fields */
-
- /* Private state for RGB->YCC conversion */
- INT32 * rgb_ycc_tab; /* => table for RGB to YCbCr conversion */
-} my_color_converter;
-
-typedef my_color_converter * my_cconvert_ptr;
-
-
-/**************** RGB -> YCbCr conversion: most common case **************/
-
-/*
- * YCbCr is defined per CCIR 601-1, except that Cb and Cr are
- * normalized to the range 0..MAXJSAMPLE rather than -0.5 .. 0.5.
- * The conversion equations to be implemented are therefore
- * Y = 0.29900 * R + 0.58700 * G + 0.11400 * B
- * Cb = -0.16874 * R - 0.33126 * G + 0.50000 * B + CENTERJSAMPLE
- * Cr = 0.50000 * R - 0.41869 * G - 0.08131 * B + CENTERJSAMPLE
- * (These numbers are derived from TIFF 6.0 section 21, dated 3-June-92.)
- * Note: older versions of the IJG code used a zero offset of MAXJSAMPLE/2,
- * rather than CENTERJSAMPLE, for Cb and Cr. This gave equal positive and
- * negative swings for Cb/Cr, but meant that grayscale values (Cb=Cr=0)
- * were not represented exactly. Now we sacrifice exact representation of
- * maximum red and maximum blue in order to get exact grayscales.
- *
- * To avoid floating-point arithmetic, we represent the fractional constants
- * as integers scaled up by 2^16 (about 4 digits precision); we have to divide
- * the products by 2^16, with appropriate rounding, to get the correct answer.
- *
- * For even more speed, we avoid doing any multiplications in the inner loop
- * by precalculating the constants times R,G,B for all possible values.
- * For 8-bit JSAMPLEs this is very reasonable (only 256 entries per table);
- * for 12-bit samples it is still acceptable. It's not very reasonable for
- * 16-bit samples, but if you want lossless storage you shouldn't be changing
- * colorspace anyway.
- * The CENTERJSAMPLE offsets and the rounding fudge-factor of 0.5 are included
- * in the tables to save adding them separately in the inner loop.
- */
-
-#define SCALEBITS 16 /* speediest right-shift on some machines */
-#define CBCR_OFFSET ((INT32) CENTERJSAMPLE << SCALEBITS)
-#define ONE_HALF ((INT32) 1 << (SCALEBITS-1))
-#define FIX(x) ((INT32) ((x) * (1L<<SCALEBITS) + 0.5))
-
-/* We allocate one big table and divide it up into eight parts, instead of
- * doing eight alloc_small requests. This lets us use a single table base
- * address, which can be held in a register in the inner loops on many
- * machines (more than can hold all eight addresses, anyway).
- */
-
-#define R_Y_OFF 0 /* offset to R => Y section */
-#define G_Y_OFF (1*(MAXJSAMPLE+1)) /* offset to G => Y section */
-#define B_Y_OFF (2*(MAXJSAMPLE+1)) /* etc. */
-#define R_CB_OFF (3*(MAXJSAMPLE+1))
-#define G_CB_OFF (4*(MAXJSAMPLE+1))
-#define B_CB_OFF (5*(MAXJSAMPLE+1))
-#define R_CR_OFF B_CB_OFF /* B=>Cb, R=>Cr are the same */
-#define G_CR_OFF (6*(MAXJSAMPLE+1))
-#define B_CR_OFF (7*(MAXJSAMPLE+1))
-#define TABLE_SIZE (8*(MAXJSAMPLE+1))
-
-
-/*
- * Initialize for RGB->YCC colorspace conversion.
- */
-
-METHODDEF(void)
-rgb_ycc_start (j_compress_ptr cinfo)
-{
- my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
- INT32 * rgb_ycc_tab;
- INT32 i;
-
- /* Allocate and fill in the conversion tables. */
- cconvert->rgb_ycc_tab = rgb_ycc_tab = (INT32 *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- (TABLE_SIZE * SIZEOF(INT32)));
-
- for (i = 0; i <= MAXJSAMPLE; i++) {
- rgb_ycc_tab[i+R_Y_OFF] = FIX(0.29900) * i;
- rgb_ycc_tab[i+G_Y_OFF] = FIX(0.58700) * i;
- rgb_ycc_tab[i+B_Y_OFF] = FIX(0.11400) * i + ONE_HALF;
- rgb_ycc_tab[i+R_CB_OFF] = (-FIX(0.16874)) * i;
- rgb_ycc_tab[i+G_CB_OFF] = (-FIX(0.33126)) * i;
- /* We use a rounding fudge-factor of 0.5-epsilon for Cb and Cr.
- * This ensures that the maximum output will round to MAXJSAMPLE
- * not MAXJSAMPLE+1, and thus that we don't have to range-limit.
- */
- rgb_ycc_tab[i+B_CB_OFF] = FIX(0.50000) * i + CBCR_OFFSET + ONE_HALF-1;
-/* B=>Cb and R=>Cr tables are the same
- rgb_ycc_tab[i+R_CR_OFF] = FIX(0.50000) * i + CBCR_OFFSET + ONE_HALF-1;
-*/
- rgb_ycc_tab[i+G_CR_OFF] = (-FIX(0.41869)) * i;
- rgb_ycc_tab[i+B_CR_OFF] = (-FIX(0.08131)) * i;
- }
-}
-
-
-/*
- * Convert some rows of samples to the JPEG colorspace.
- *
- * Note that we change from the application's interleaved-pixel format
- * to our internal noninterleaved, one-plane-per-component format.
- * The input buffer is therefore three times as wide as the output buffer.
- *
- * A starting row offset is provided only for the output buffer. The caller
- * can easily adjust the passed input_buf value to accommodate any row
- * offset required on that side.
- */
-
-METHODDEF(void)
-rgb_ycc_convert (j_compress_ptr cinfo,
- JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
- JDIMENSION output_row, int num_rows)
-{
- my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
- register int r, g, b;
- register INT32 * ctab = cconvert->rgb_ycc_tab;
- register JSAMPROW inptr;
- register JSAMPROW outptr0, outptr1, outptr2;
- register JDIMENSION col;
- JDIMENSION num_cols = cinfo->image_width;
-
- while (--num_rows >= 0) {
- inptr = *input_buf++;
- outptr0 = output_buf[0][output_row];
- outptr1 = output_buf[1][output_row];
- outptr2 = output_buf[2][output_row];
- output_row++;
- for (col = 0; col < num_cols; col++) {
- r = GETJSAMPLE(inptr[RGB_RED]);
- g = GETJSAMPLE(inptr[RGB_GREEN]);
- b = GETJSAMPLE(inptr[RGB_BLUE]);
- inptr += RGB_PIXELSIZE;
- /* If the inputs are 0..MAXJSAMPLE, the outputs of these equations
- * must be too; we do not need an explicit range-limiting operation.
- * Hence the value being shifted is never negative, and we don't
- * need the general RIGHT_SHIFT macro.
- */
- /* Y */
- outptr0[col] = (JSAMPLE)
- ((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF])
- >> SCALEBITS);
- /* Cb */
- outptr1[col] = (JSAMPLE)
- ((ctab[r+R_CB_OFF] + ctab[g+G_CB_OFF] + ctab[b+B_CB_OFF])
- >> SCALEBITS);
- /* Cr */
- outptr2[col] = (JSAMPLE)
- ((ctab[r+R_CR_OFF] + ctab[g+G_CR_OFF] + ctab[b+B_CR_OFF])
- >> SCALEBITS);
- }
- }
-}
-
-
-/**************** Cases other than RGB -> YCbCr **************/
-
-
-/*
- * Convert some rows of samples to the JPEG colorspace.
- * This version handles RGB->grayscale conversion, which is the same
- * as the RGB->Y portion of RGB->YCbCr.
- * We assume rgb_ycc_start has been called (we only use the Y tables).
- */
-
-METHODDEF(void)
-rgb_gray_convert (j_compress_ptr cinfo,
- JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
- JDIMENSION output_row, int num_rows)
-{
- my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
- register int r, g, b;
- register INT32 * ctab = cconvert->rgb_ycc_tab;
- register JSAMPROW inptr;
- register JSAMPROW outptr;
- register JDIMENSION col;
- JDIMENSION num_cols = cinfo->image_width;
-
- while (--num_rows >= 0) {
- inptr = *input_buf++;
- outptr = output_buf[0][output_row];
- output_row++;
- for (col = 0; col < num_cols; col++) {
- r = GETJSAMPLE(inptr[RGB_RED]);
- g = GETJSAMPLE(inptr[RGB_GREEN]);
- b = GETJSAMPLE(inptr[RGB_BLUE]);
- inptr += RGB_PIXELSIZE;
- /* Y */
- outptr[col] = (JSAMPLE)
- ((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF])
- >> SCALEBITS);
- }
- }
-}
-
-
-/*
- * Convert some rows of samples to the JPEG colorspace.
- * This version handles Adobe-style CMYK->YCCK conversion,
- * where we convert R=1-C, G=1-M, and B=1-Y to YCbCr using the same
- * conversion as above, while passing K (black) unchanged.
- * We assume rgb_ycc_start has been called.
- */
-
-METHODDEF(void)
-cmyk_ycck_convert (j_compress_ptr cinfo,
- JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
- JDIMENSION output_row, int num_rows)
-{
- my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
- register int r, g, b;
- register INT32 * ctab = cconvert->rgb_ycc_tab;
- register JSAMPROW inptr;
- register JSAMPROW outptr0, outptr1, outptr2, outptr3;
- register JDIMENSION col;
- JDIMENSION num_cols = cinfo->image_width;
-
- while (--num_rows >= 0) {
- inptr = *input_buf++;
- outptr0 = output_buf[0][output_row];
- outptr1 = output_buf[1][output_row];
- outptr2 = output_buf[2][output_row];
- outptr3 = output_buf[3][output_row];
- output_row++;
- for (col = 0; col < num_cols; col++) {
- r = MAXJSAMPLE - GETJSAMPLE(inptr[0]);
- g = MAXJSAMPLE - GETJSAMPLE(inptr[1]);
- b = MAXJSAMPLE - GETJSAMPLE(inptr[2]);
- /* K passes through as-is */
- outptr3[col] = inptr[3]; /* don't need GETJSAMPLE here */
- inptr += 4;
- /* If the inputs are 0..MAXJSAMPLE, the outputs of these equations
- * must be too; we do not need an explicit range-limiting operation.
- * Hence the value being shifted is never negative, and we don't
- * need the general RIGHT_SHIFT macro.
- */
- /* Y */
- outptr0[col] = (JSAMPLE)
- ((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF])
- >> SCALEBITS);
- /* Cb */
- outptr1[col] = (JSAMPLE)
- ((ctab[r+R_CB_OFF] + ctab[g+G_CB_OFF] + ctab[b+B_CB_OFF])
- >> SCALEBITS);
- /* Cr */
- outptr2[col] = (JSAMPLE)
- ((ctab[r+R_CR_OFF] + ctab[g+G_CR_OFF] + ctab[b+B_CR_OFF])
- >> SCALEBITS);
- }
- }
-}
-
-
-/*
- * Convert some rows of samples to the JPEG colorspace.
- * This version handles grayscale output with no conversion.
- * The source can be either plain grayscale or YCbCr (since Y == gray).
- */
-
-METHODDEF(void)
-grayscale_convert (j_compress_ptr cinfo,
- JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
- JDIMENSION output_row, int num_rows)
-{
- register JSAMPROW inptr;
- register JSAMPROW outptr;
- register JDIMENSION col;
- JDIMENSION num_cols = cinfo->image_width;
- int instride = cinfo->input_components;
-
- while (--num_rows >= 0) {
- inptr = *input_buf++;
- outptr = output_buf[0][output_row];
- output_row++;
- for (col = 0; col < num_cols; col++) {
- outptr[col] = inptr[0]; /* don't need GETJSAMPLE() here */
- inptr += instride;
- }
- }
-}
-
-
-/*
- * Convert some rows of samples to the JPEG colorspace.
- * This version handles multi-component colorspaces without conversion.
- * We assume input_components == num_components.
- */
-
-METHODDEF(void)
-null_convert (j_compress_ptr cinfo,
- JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
- JDIMENSION output_row, int num_rows)
-{
- register JSAMPROW inptr;
- register JSAMPROW outptr;
- register JDIMENSION col;
- register int ci;
- int nc = cinfo->num_components;
- JDIMENSION num_cols = cinfo->image_width;
-
- while (--num_rows >= 0) {
- /* It seems fastest to make a separate pass for each component. */
- for (ci = 0; ci < nc; ci++) {
- inptr = *input_buf;
- outptr = output_buf[ci][output_row];
- for (col = 0; col < num_cols; col++) {
- outptr[col] = inptr[ci]; /* don't need GETJSAMPLE() here */
- inptr += nc;
- }
- }
- input_buf++;
- output_row++;
- }
-}
-
-
-/*
- * Empty method for start_pass.
- */
-
-METHODDEF(void)
-null_method (j_compress_ptr cinfo)
-{
- /* no work needed */
-}
-
-
-/*
- * Module initialization routine for input colorspace conversion.
- */
-
-GLOBAL(void)
-jinit_color_converter (j_compress_ptr cinfo)
-{
- my_cconvert_ptr cconvert;
-
- cconvert = (my_cconvert_ptr)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- SIZEOF(my_color_converter));
- cinfo->cconvert = (struct jpeg_color_converter *) cconvert;
- /* set start_pass to null method until we find out differently */
- cconvert->pub.start_pass = null_method;
-
- /* Make sure input_components agrees with in_color_space */
- switch (cinfo->in_color_space) {
- case JCS_GRAYSCALE:
- if (cinfo->input_components != 1)
- ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);
- break;
-
- case JCS_RGB:
-#if RGB_PIXELSIZE != 3
- if (cinfo->input_components != RGB_PIXELSIZE)
- ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);
- break;
-#endif /* else share code with YCbCr */
-
- case JCS_YCbCr:
- if (cinfo->input_components != 3)
- ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);
- break;
-
- case JCS_CMYK:
- case JCS_YCCK:
- if (cinfo->input_components != 4)
- ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);
- break;
-
- default: /* JCS_UNKNOWN can be anything */
- if (cinfo->input_components < 1)
- ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);
- break;
- }
-
- /* Check num_components, set conversion method based on requested space */
- switch (cinfo->jpeg_color_space) {
- case JCS_GRAYSCALE:
- if (cinfo->num_components != 1)
- ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
- if (cinfo->in_color_space == JCS_GRAYSCALE)
- cconvert->pub.color_convert = grayscale_convert;
- else if (cinfo->in_color_space == JCS_RGB) {
- cconvert->pub.start_pass = rgb_ycc_start;
- cconvert->pub.color_convert = rgb_gray_convert;
- } else if (cinfo->in_color_space == JCS_YCbCr)
- cconvert->pub.color_convert = grayscale_convert;
- else
- ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
- break;
-
- case JCS_RGB:
- if (cinfo->num_components != 3)
- ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
- if (cinfo->in_color_space == JCS_RGB && RGB_PIXELSIZE == 3)
- cconvert->pub.color_convert = null_convert;
- else
- ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
- break;
-
- case JCS_YCbCr:
- if (cinfo->num_components != 3)
- ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
- if (cinfo->in_color_space == JCS_RGB) {
- cconvert->pub.start_pass = rgb_ycc_start;
- cconvert->pub.color_convert = rgb_ycc_convert;
- } else if (cinfo->in_color_space == JCS_YCbCr)
- cconvert->pub.color_convert = null_convert;
- else
- ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
- break;
-
- case JCS_CMYK:
- if (cinfo->num_components != 4)
- ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
- if (cinfo->in_color_space == JCS_CMYK)
- cconvert->pub.color_convert = null_convert;
- else
- ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
- break;
-
- case JCS_YCCK:
- if (cinfo->num_components != 4)
- ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
- if (cinfo->in_color_space == JCS_CMYK) {
- cconvert->pub.start_pass = rgb_ycc_start;
- cconvert->pub.color_convert = cmyk_ycck_convert;
- } else if (cinfo->in_color_space == JCS_YCCK)
- cconvert->pub.color_convert = null_convert;
- else
- ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
- break;
-
- default: /* allow null conversion of JCS_UNKNOWN */
- if (cinfo->jpeg_color_space != cinfo->in_color_space ||
- cinfo->num_components != cinfo->input_components)
- ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
- cconvert->pub.color_convert = null_convert;
- break;
- }
-}
diff --git a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jcdctmgr.c b/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jcdctmgr.c
deleted file mode 100644
index 61fa79b9e68..00000000000
--- a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jcdctmgr.c
+++ /dev/null
@@ -1,387 +0,0 @@
-/*
- * jcdctmgr.c
- *
- * Copyright (C) 1994-1996, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file contains the forward-DCT management logic.
- * This code selects a particular DCT implementation to be used,
- * and it performs related housekeeping chores including coefficient
- * quantization.
- */
-
-#define JPEG_INTERNALS
-#include "jinclude.h"
-#include "jpeglib.h"
-#include "jdct.h" /* Private declarations for DCT subsystem */
-
-
-/* Private subobject for this module */
-
-typedef struct {
- struct jpeg_forward_dct pub; /* public fields */
-
- /* Pointer to the DCT routine actually in use */
- forward_DCT_method_ptr do_dct;
-
- /* The actual post-DCT divisors --- not identical to the quant table
- * entries, because of scaling (especially for an unnormalized DCT).
- * Each table is given in normal array order.
- */
- DCTELEM * divisors[NUM_QUANT_TBLS];
-
-#ifdef DCT_FLOAT_SUPPORTED
- /* Same as above for the floating-point case. */
- float_DCT_method_ptr do_float_dct;
- FAST_FLOAT * float_divisors[NUM_QUANT_TBLS];
-#endif
-} my_fdct_controller;
-
-typedef my_fdct_controller * my_fdct_ptr;
-
-
-/*
- * Initialize for a processing pass.
- * Verify that all referenced Q-tables are present, and set up
- * the divisor table for each one.
- * In the current implementation, DCT of all components is done during
- * the first pass, even if only some components will be output in the
- * first scan. Hence all components should be examined here.
- */
-
-METHODDEF(void)
-start_pass_fdctmgr (j_compress_ptr cinfo)
-{
- my_fdct_ptr fdct = (my_fdct_ptr) cinfo->fdct;
- int ci, qtblno, i;
- jpeg_component_info *compptr;
- JQUANT_TBL * qtbl;
- DCTELEM * dtbl;
-
- for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
- ci++, compptr++) {
- qtblno = compptr->quant_tbl_no;
- /* Make sure specified quantization table is present */
- if (qtblno < 0 || qtblno >= NUM_QUANT_TBLS ||
- cinfo->quant_tbl_ptrs[qtblno] == NULL)
- ERREXIT1(cinfo, JERR_NO_QUANT_TABLE, qtblno);
- qtbl = cinfo->quant_tbl_ptrs[qtblno];
- /* Compute divisors for this quant table */
- /* We may do this more than once for same table, but it's not a big deal */
- switch (cinfo->dct_method) {
-#ifdef DCT_ISLOW_SUPPORTED
- case JDCT_ISLOW:
- /* For LL&M IDCT method, divisors are equal to raw quantization
- * coefficients multiplied by 8 (to counteract scaling).
- */
- if (fdct->divisors[qtblno] == NULL) {
- fdct->divisors[qtblno] = (DCTELEM *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- DCTSIZE2 * SIZEOF(DCTELEM));
- }
- dtbl = fdct->divisors[qtblno];
- for (i = 0; i < DCTSIZE2; i++) {
- dtbl[i] = ((DCTELEM) qtbl->quantval[i]) << 3;
- }
- break;
-#endif
-#ifdef DCT_IFAST_SUPPORTED
- case JDCT_IFAST:
- {
- /* For AA&N IDCT method, divisors are equal to quantization
- * coefficients scaled by scalefactor[row]*scalefactor[col], where
- * scalefactor[0] = 1
- * scalefactor[k] = cos(k*PI/16) * sqrt(2) for k=1..7
- * We apply a further scale factor of 8.
- */
-#define CONST_BITS 14
- static const INT16 aanscales[DCTSIZE2] = {
- /* precomputed values scaled up by 14 bits */
- 16384, 22725, 21407, 19266, 16384, 12873, 8867, 4520,
- 22725, 31521, 29692, 26722, 22725, 17855, 12299, 6270,
- 21407, 29692, 27969, 25172, 21407, 16819, 11585, 5906,
- 19266, 26722, 25172, 22654, 19266, 15137, 10426, 5315,
- 16384, 22725, 21407, 19266, 16384, 12873, 8867, 4520,
- 12873, 17855, 16819, 15137, 12873, 10114, 6967, 3552,
- 8867, 12299, 11585, 10426, 8867, 6967, 4799, 2446,
- 4520, 6270, 5906, 5315, 4520, 3552, 2446, 1247
- };
- SHIFT_TEMPS
-
- if (fdct->divisors[qtblno] == NULL) {
- fdct->divisors[qtblno] = (DCTELEM *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- DCTSIZE2 * SIZEOF(DCTELEM));
- }
- dtbl = fdct->divisors[qtblno];
- for (i = 0; i < DCTSIZE2; i++) {
- dtbl[i] = (DCTELEM)
- DESCALE(MULTIPLY16V16((INT32) qtbl->quantval[i],
- (INT32) aanscales[i]),
- CONST_BITS-3);
- }
- }
- break;
-#endif
-#ifdef DCT_FLOAT_SUPPORTED
- case JDCT_FLOAT:
- {
- /* For float AA&N IDCT method, divisors are equal to quantization
- * coefficients scaled by scalefactor[row]*scalefactor[col], where
- * scalefactor[0] = 1
- * scalefactor[k] = cos(k*PI/16) * sqrt(2) for k=1..7
- * We apply a further scale factor of 8.
- * What's actually stored is 1/divisor so that the inner loop can
- * use a multiplication rather than a division.
- */
- FAST_FLOAT * fdtbl;
- int row, col;
- static const double aanscalefactor[DCTSIZE] = {
- 1.0, 1.387039845, 1.306562965, 1.175875602,
- 1.0, 0.785694958, 0.541196100, 0.275899379
- };
-
- if (fdct->float_divisors[qtblno] == NULL) {
- fdct->float_divisors[qtblno] = (FAST_FLOAT *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- DCTSIZE2 * SIZEOF(FAST_FLOAT));
- }
- fdtbl = fdct->float_divisors[qtblno];
- i = 0;
- for (row = 0; row < DCTSIZE; row++) {
- for (col = 0; col < DCTSIZE; col++) {
- fdtbl[i] = (FAST_FLOAT)
- (1.0 / (((double) qtbl->quantval[i] *
- aanscalefactor[row] * aanscalefactor[col] * 8.0)));
- i++;
- }
- }
- }
- break;
-#endif
- default:
- ERREXIT(cinfo, JERR_NOT_COMPILED);
- break;
- }
- }
-}
-
-
-/*
- * Perform forward DCT on one or more blocks of a component.
- *
- * The input samples are taken from the sample_data[] array starting at
- * position start_row/start_col, and moving to the right for any additional
- * blocks. The quantized coefficients are returned in coef_blocks[].
- */
-
-METHODDEF(void)
-forward_DCT (j_compress_ptr cinfo, jpeg_component_info * compptr,
- JSAMPARRAY sample_data, JBLOCKROW coef_blocks,
- JDIMENSION start_row, JDIMENSION start_col,
- JDIMENSION num_blocks)
-/* This version is used for integer DCT implementations. */
-{
- /* This routine is heavily used, so it's worth coding it tightly. */
- my_fdct_ptr fdct = (my_fdct_ptr) cinfo->fdct;
- forward_DCT_method_ptr do_dct = fdct->do_dct;
- DCTELEM * divisors = fdct->divisors[compptr->quant_tbl_no];
- DCTELEM workspace[DCTSIZE2]; /* work area for FDCT subroutine */
- JDIMENSION bi;
-
- sample_data += start_row; /* fold in the vertical offset once */
-
- for (bi = 0; bi < num_blocks; bi++, start_col += DCTSIZE) {
- /* Load data into workspace, applying unsigned->signed conversion */
- { register DCTELEM *workspaceptr;
- register JSAMPROW elemptr;
- register int elemr;
-
- workspaceptr = workspace;
- for (elemr = 0; elemr < DCTSIZE; elemr++) {
- elemptr = sample_data[elemr] + start_col;
-#if DCTSIZE == 8 /* unroll the inner loop */
- *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
- *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
- *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
- *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
- *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
- *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
- *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
- *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
-#else
- { register int elemc;
- for (elemc = DCTSIZE; elemc > 0; elemc--) {
- *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
- }
- }
-#endif
- }
- }
-
- /* Perform the DCT */
- (*do_dct) (workspace);
-
- /* Quantize/descale the coefficients, and store into coef_blocks[] */
- { register DCTELEM temp, qval;
- register int i;
- register JCOEFPTR output_ptr = coef_blocks[bi];
-
- for (i = 0; i < DCTSIZE2; i++) {
- qval = divisors[i];
- temp = workspace[i];
- /* Divide the coefficient value by qval, ensuring proper rounding.
- * Since C does not specify the direction of rounding for negative
- * quotients, we have to force the dividend positive for portability.
- *
- * In most files, at least half of the output values will be zero
- * (at default quantization settings, more like three-quarters...)
- * so we should ensure that this case is fast. On many machines,
- * a comparison is enough cheaper than a divide to make a special test
- * a win. Since both inputs will be nonnegative, we need only test
- * for a < b to discover whether a/b is 0.
- * If your machine's division is fast enough, define FAST_DIVIDE.
- */
-#ifdef FAST_DIVIDE
-#define DIVIDE_BY(a,b) a /= b
-#else
-#define DIVIDE_BY(a,b) if (a >= b) a /= b; else a = 0
-#endif
- if (temp < 0) {
- temp = -temp;
- temp += qval>>1; /* for rounding */
- DIVIDE_BY(temp, qval);
- temp = -temp;
- } else {
- temp += qval>>1; /* for rounding */
- DIVIDE_BY(temp, qval);
- }
- output_ptr[i] = (JCOEF) temp;
- }
- }
- }
-}
-
-
-#ifdef DCT_FLOAT_SUPPORTED
-
-METHODDEF(void)
-forward_DCT_float (j_compress_ptr cinfo, jpeg_component_info * compptr,
- JSAMPARRAY sample_data, JBLOCKROW coef_blocks,
- JDIMENSION start_row, JDIMENSION start_col,
- JDIMENSION num_blocks)
-/* This version is used for floating-point DCT implementations. */
-{
- /* This routine is heavily used, so it's worth coding it tightly. */
- my_fdct_ptr fdct = (my_fdct_ptr) cinfo->fdct;
- float_DCT_method_ptr do_dct = fdct->do_float_dct;
- FAST_FLOAT * divisors = fdct->float_divisors[compptr->quant_tbl_no];
- FAST_FLOAT workspace[DCTSIZE2]; /* work area for FDCT subroutine */
- JDIMENSION bi;
-
- sample_data += start_row; /* fold in the vertical offset once */
-
- for (bi = 0; bi < num_blocks; bi++, start_col += DCTSIZE) {
- /* Load data into workspace, applying unsigned->signed conversion */
- { register FAST_FLOAT *workspaceptr;
- register JSAMPROW elemptr;
- register int elemr;
-
- workspaceptr = workspace;
- for (elemr = 0; elemr < DCTSIZE; elemr++) {
- elemptr = sample_data[elemr] + start_col;
-#if DCTSIZE == 8 /* unroll the inner loop */
- *workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
- *workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
- *workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
- *workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
- *workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
- *workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
- *workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
- *workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
-#else
- { register int elemc;
- for (elemc = DCTSIZE; elemc > 0; elemc--) {
- *workspaceptr++ = (FAST_FLOAT)
- (GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
- }
- }
-#endif
- }
- }
-
- /* Perform the DCT */
- (*do_dct) (workspace);
-
- /* Quantize/descale the coefficients, and store into coef_blocks[] */
- { register FAST_FLOAT temp;
- register int i;
- register JCOEFPTR output_ptr = coef_blocks[bi];
-
- for (i = 0; i < DCTSIZE2; i++) {
- /* Apply the quantization and scaling factor */
- temp = workspace[i] * divisors[i];
- /* Round to nearest integer.
- * Since C does not specify the direction of rounding for negative
- * quotients, we have to force the dividend positive for portability.
- * The maximum coefficient size is +-16K (for 12-bit data), so this
- * code should work for either 16-bit or 32-bit ints.
- */
- output_ptr[i] = (JCOEF) ((int) (temp + (FAST_FLOAT) 16384.5) - 16384);
- }
- }
- }
-}
-
-#endif /* DCT_FLOAT_SUPPORTED */
-
-
-/*
- * Initialize FDCT manager.
- */
-
-GLOBAL(void)
-jinit_forward_dct (j_compress_ptr cinfo)
-{
- my_fdct_ptr fdct;
- int i;
-
- fdct = (my_fdct_ptr)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- SIZEOF(my_fdct_controller));
- cinfo->fdct = (struct jpeg_forward_dct *) fdct;
- fdct->pub.start_pass = start_pass_fdctmgr;
-
- switch (cinfo->dct_method) {
-#ifdef DCT_ISLOW_SUPPORTED
- case JDCT_ISLOW:
- fdct->pub.forward_DCT = forward_DCT;
- fdct->do_dct = jpeg_fdct_islow;
- break;
-#endif
-#ifdef DCT_IFAST_SUPPORTED
- case JDCT_IFAST:
- fdct->pub.forward_DCT = forward_DCT;
- fdct->do_dct = jpeg_fdct_ifast;
- break;
-#endif
-#ifdef DCT_FLOAT_SUPPORTED
- case JDCT_FLOAT:
- fdct->pub.forward_DCT = forward_DCT_float;
- fdct->do_float_dct = jpeg_fdct_float;
- break;
-#endif
- default:
- ERREXIT(cinfo, JERR_NOT_COMPILED);
- break;
- }
-
- /* Mark divisor tables unallocated */
- for (i = 0; i < NUM_QUANT_TBLS; i++) {
- fdct->divisors[i] = NULL;
-#ifdef DCT_FLOAT_SUPPORTED
- fdct->float_divisors[i] = NULL;
-#endif
- }
-}
diff --git a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jchuff.c b/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jchuff.c
deleted file mode 100644
index 005220c3b2d..00000000000
--- a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jchuff.c
+++ /dev/null
@@ -1,908 +0,0 @@
-/*
- * jchuff.c
- *
- * Copyright (C) 1991-1997, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file contains Huffman entropy encoding routines.
- *
- * Much of the complexity here has to do with supporting output suspension.
- * If the data destination module demands suspension, we want to be able to
- * back up to the start of the current MCU. To do this, we copy state
- * variables into local working storage, and update them back to the
- * permanent JPEG objects only upon successful completion of an MCU.
- */
-
-#define JPEG_INTERNALS
-#include "jinclude.h"
-#include "jpeglib.h"
-#include "jchuff.h" /* Declarations shared with jcphuff.c */
-
-/* Expanded entropy encoder object for Huffman encoding.
- *
- * The savable_state subrecord contains fields that change within an MCU,
- * but must not be updated permanently until we complete the MCU.
- */
-
-typedef struct {
- INT32 put_buffer; /* current bit-accumulation buffer */
- int put_bits; /* # of bits now in it */
- int last_dc_val[MAX_COMPS_IN_SCAN]; /* last DC coef for each component */
-} savable_state;
-
-/* This macro is to work around compilers with missing or broken
- * structure assignment. You'll need to fix this code if you have
- * such a compiler and you change MAX_COMPS_IN_SCAN.
- */
-
-#ifndef NO_STRUCT_ASSIGN
-#define ASSIGN_STATE(dest,src) ((dest) = (src))
-#else
-#if MAX_COMPS_IN_SCAN == 4
-#define ASSIGN_STATE(dest,src) \
- ((dest).put_buffer = (src).put_buffer, \
- (dest).put_bits = (src).put_bits, \
- (dest).last_dc_val[0] = (src).last_dc_val[0], \
- (dest).last_dc_val[1] = (src).last_dc_val[1], \
- (dest).last_dc_val[2] = (src).last_dc_val[2], \
- (dest).last_dc_val[3] = (src).last_dc_val[3])
-#endif
-#endif
-
-
-typedef struct {
- struct jpeg_entropy_encoder pub; /* public fields */
-
- savable_state saved; /* Bit buffer & DC state at start of MCU */
-
- /* These fields are NOT loaded into local working state. */
- unsigned int restarts_to_go; /* MCUs left in this restart interval */
- int next_restart_num; /* next restart number to write (0-7) */
-
- /* Pointers to derived tables (these workspaces have image lifespan) */
- c_derived_tbl * dc_derived_tbls[NUM_HUFF_TBLS];
- c_derived_tbl * ac_derived_tbls[NUM_HUFF_TBLS];
-
-#ifdef ENTROPY_OPT_SUPPORTED /* Statistics tables for optimization */
- long * dc_count_ptrs[NUM_HUFF_TBLS];
- long * ac_count_ptrs[NUM_HUFF_TBLS];
-#endif
-} huff_entropy_encoder;
-
-typedef huff_entropy_encoder * huff_entropy_ptr;
-
-/* Working state while writing an MCU.
- * This struct contains all the fields that are needed by subroutines.
- */
-
-typedef struct {
- JOCTET * next_output_byte; /* => next byte to write in buffer */
- size_t free_in_buffer; /* # of byte spaces remaining in buffer */
- savable_state cur; /* Current bit buffer & DC state */
- j_compress_ptr cinfo; /* dump_buffer needs access to this */
-} working_state;
-
-
-/* Forward declarations */
-METHODDEF(boolean) encode_mcu_huff JPP((j_compress_ptr cinfo,
- JBLOCKROW *MCU_data));
-METHODDEF(void) finish_pass_huff JPP((j_compress_ptr cinfo));
-#ifdef ENTROPY_OPT_SUPPORTED
-METHODDEF(boolean) encode_mcu_gather JPP((j_compress_ptr cinfo,
- JBLOCKROW *MCU_data));
-METHODDEF(void) finish_pass_gather JPP((j_compress_ptr cinfo));
-#endif
-
-
-/*
- * Initialize for a Huffman-compressed scan.
- * If gather_statistics is TRUE, we do not output anything during the scan,
- * just count the Huffman symbols used and generate Huffman code tables.
- */
-
-METHODDEF(void)
-start_pass_huff (j_compress_ptr cinfo, boolean gather_statistics)
-{
- huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
- int ci, dctbl, actbl;
- jpeg_component_info * compptr;
-
- if (gather_statistics) {
-#ifdef ENTROPY_OPT_SUPPORTED
- entropy->pub.encode_mcu = encode_mcu_gather;
- entropy->pub.finish_pass = finish_pass_gather;
-#else
- ERREXIT(cinfo, JERR_NOT_COMPILED);
-#endif
- } else {
- entropy->pub.encode_mcu = encode_mcu_huff;
- entropy->pub.finish_pass = finish_pass_huff;
- }
-
- for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
- compptr = cinfo->cur_comp_info[ci];
- dctbl = compptr->dc_tbl_no;
- actbl = compptr->ac_tbl_no;
- if (gather_statistics) {
-#ifdef ENTROPY_OPT_SUPPORTED
- /* Check for invalid table indexes */
- /* (make_c_derived_tbl does this in the other path) */
- if (dctbl < 0 || dctbl >= NUM_HUFF_TBLS)
- ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, dctbl);
- if (actbl < 0 || actbl >= NUM_HUFF_TBLS)
- ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, actbl);
- /* Allocate and zero the statistics tables */
- /* Note that jpeg_gen_optimal_table expects 257 entries in each table! */
- if (entropy->dc_count_ptrs[dctbl] == NULL)
- entropy->dc_count_ptrs[dctbl] = (long *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- 257 * SIZEOF(long));
- MEMZERO(entropy->dc_count_ptrs[dctbl], 257 * SIZEOF(long));
- if (entropy->ac_count_ptrs[actbl] == NULL)
- entropy->ac_count_ptrs[actbl] = (long *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- 257 * SIZEOF(long));
- MEMZERO(entropy->ac_count_ptrs[actbl], 257 * SIZEOF(long));
-#endif
- } else {
- /* Compute derived values for Huffman tables */
- /* We may do this more than once for a table, but it's not expensive */
- jpeg_make_c_derived_tbl(cinfo, TRUE, dctbl,
- & entropy->dc_derived_tbls[dctbl]);
- jpeg_make_c_derived_tbl(cinfo, FALSE, actbl,
- & entropy->ac_derived_tbls[actbl]);
- }
- /* Initialize DC predictions to 0 */
- entropy->saved.last_dc_val[ci] = 0;
- }
-
- /* Initialize bit buffer to empty */
- entropy->saved.put_buffer = 0;
- entropy->saved.put_bits = 0;
-
- /* Initialize restart stuff */
- entropy->restarts_to_go = cinfo->restart_interval;
- entropy->next_restart_num = 0;
-}
-
-
-/*
- * Compute the derived values for a Huffman table.
- * This routine also performs some validation checks on the table.
- *
- * Note this is also used by jcphuff.c.
- */
-
-GLOBAL(void)
-jpeg_make_c_derived_tbl (j_compress_ptr cinfo, boolean isDC, int tblno,
- c_derived_tbl ** pdtbl)
-{
- JHUFF_TBL *htbl;
- c_derived_tbl *dtbl;
- int p, i, l, lastp, _si, maxsymbol;
- char huffsize[257];
- unsigned int huffcode[257];
- unsigned int code;
-
- /* Note that huffsize[] and huffcode[] are filled in code-length order,
- * paralleling the order of the symbols themselves in htbl->huffval[].
- */
-
- /* Find the input Huffman table */
- if (tblno < 0 || tblno >= NUM_HUFF_TBLS)
- ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tblno);
- htbl =
- isDC ? cinfo->dc_huff_tbl_ptrs[tblno] : cinfo->ac_huff_tbl_ptrs[tblno];
- if (htbl == NULL)
- ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tblno);
-
- /* Allocate a workspace if we haven't already done so. */
- if (*pdtbl == NULL)
- *pdtbl = (c_derived_tbl *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- SIZEOF(c_derived_tbl));
- dtbl = *pdtbl;
-
- /* Figure C.1: make table of Huffman code length for each symbol */
-
- p = 0;
- for (l = 1; l <= 16; l++) {
- i = (int) htbl->bits[l];
- if (i < 0 || p + i > 256) /* protect against table overrun */
- ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
- while (i--)
- huffsize[p++] = (char) l;
- }
- huffsize[p] = 0;
- lastp = p;
-
- /* Figure C.2: generate the codes themselves */
- /* We also validate that the counts represent a legal Huffman code tree. */
-
- code = 0;
- _si = huffsize[0];
- p = 0;
- while (huffsize[p]) {
- while (((int) huffsize[p]) == _si) {
- huffcode[p++] = code;
- code++;
- }
- /* code is now 1 more than the last code used for codelength si; but
- * it must still fit in si bits, since no code is allowed to be all ones.
- */
- if (((INT32) code) >= (((INT32) 1) << _si))
- ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
- code <<= 1;
- _si++;
- }
-
- /* Figure C.3: generate encoding tables */
- /* These are code and size indexed by symbol value */
-
- /* Set all codeless symbols to have code length 0;
- * this lets us detect duplicate VAL entries here, and later
- * allows emit_bits to detect any attempt to emit such symbols.
- */
- MEMZERO(dtbl->ehufsi, SIZEOF(dtbl->ehufsi));
-
- /* This is also a convenient place to check for out-of-range
- * and duplicated VAL entries. We allow 0..255 for AC symbols
- * but only 0..15 for DC. (We could constrain them further
- * based on data depth and mode, but this seems enough.)
- */
- maxsymbol = isDC ? 15 : 255;
-
- for (p = 0; p < lastp; p++) {
- i = htbl->huffval[p];
- if (i < 0 || i > maxsymbol || dtbl->ehufsi[i])
- ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
- dtbl->ehufco[i] = huffcode[p];
- dtbl->ehufsi[i] = huffsize[p];
- }
-}
-
-
-/* Outputting bytes to the file */
-
-/* Emit a byte, taking 'action' if must suspend. */
-#define emit_byte(state,val,action) \
- { *(state)->next_output_byte++ = (JOCTET) (val); \
- if (--(state)->free_in_buffer == 0) \
- if (! dump_buffer(state)) \
- { action; } }
-
-
-LOCAL(boolean)
-dump_buffer (working_state * state)
-/* Empty the output buffer; return TRUE if successful, FALSE if must suspend */
-{
- struct jpeg_destination_mgr * dest = state->cinfo->dest;
-
- if (! (*dest->empty_output_buffer) (state->cinfo))
- return FALSE;
- /* After a successful buffer dump, must reset buffer pointers */
- state->next_output_byte = dest->next_output_byte;
- state->free_in_buffer = dest->free_in_buffer;
- return TRUE;
-}
-
-
-/* Outputting bits to the file */
-
-/* Only the right 24 bits of put_buffer are used; the valid bits are
- * left-justified in this part. At most 16 bits can be passed to emit_bits
- * in one call, and we never retain more than 7 bits in put_buffer
- * between calls, so 24 bits are sufficient.
- */
-
-INLINE
-LOCAL(boolean)
-emit_bits (working_state * state, unsigned int code, int size)
-/* Emit some bits; return TRUE if successful, FALSE if must suspend */
-{
- /* This routine is heavily used, so it's worth coding tightly. */
- register INT32 put_buffer = (INT32) code;
- register int put_bits = state->cur.put_bits;
-
- /* if size is 0, caller used an invalid Huffman table entry */
- if (size == 0)
- ERREXIT(state->cinfo, JERR_HUFF_MISSING_CODE);
-
- put_buffer &= (((INT32) 1)<<size) - 1; /* mask off any extra bits in code */
-
- put_bits += size; /* new number of bits in buffer */
-
- put_buffer <<= 24 - put_bits; /* align incoming bits */
-
- put_buffer |= state->cur.put_buffer; /* and merge with old buffer contents */
-
- while (put_bits >= 8) {
- int c = (int) ((put_buffer >> 16) & 0xFF);
-
- emit_byte(state, c, return FALSE);
- if (c == 0xFF) { /* need to stuff a zero byte? */
- emit_byte(state, 0, return FALSE);
- }
- put_buffer <<= 8;
- put_bits -= 8;
- }
-
- state->cur.put_buffer = put_buffer; /* update state variables */
- state->cur.put_bits = put_bits;
-
- return TRUE;
-}
-
-
-LOCAL(boolean)
-flush_bits (working_state * state)
-{
- if (! emit_bits(state, 0x7F, 7)) /* fill any partial byte with ones */
- return FALSE;
- state->cur.put_buffer = 0; /* and reset bit-buffer to empty */
- state->cur.put_bits = 0;
- return TRUE;
-}
-
-
-/* Encode a single block's worth of coefficients */
-
-LOCAL(boolean)
-encode_one_block (working_state * state, JCOEFPTR block, int last_dc_val,
- c_derived_tbl *dctbl, c_derived_tbl *actbl)
-{
- register int temp, temp2;
- register int nbits;
- register int k, r, i;
-
- /* Encode the DC coefficient difference per section F.1.2.1 */
-
- temp = temp2 = block[0] - last_dc_val;
-
- if (temp < 0) {
- temp = -temp; /* temp is abs value of input */
- /* For a negative input, want temp2 = bitwise complement of abs(input) */
- /* This code assumes we are on a two's complement machine */
- temp2--;
- }
-
- /* Find the number of bits needed for the magnitude of the coefficient */
- nbits = 0;
- while (temp) {
- nbits++;
- temp >>= 1;
- }
- /* Check for out-of-range coefficient values.
- * Since we're encoding a difference, the range limit is twice as much.
- */
- if (nbits > MAX_COEF_BITS+1)
- ERREXIT(state->cinfo, JERR_BAD_DCT_COEF);
-
- /* Emit the Huffman-coded symbol for the number of bits */
- if (! emit_bits(state, dctbl->ehufco[nbits], dctbl->ehufsi[nbits]))
- return FALSE;
-
- /* Emit that number of bits of the value, if positive, */
- /* or the complement of its magnitude, if negative. */
- if (nbits) /* emit_bits rejects calls with size 0 */
- if (! emit_bits(state, (unsigned int) temp2, nbits))
- return FALSE;
-
- /* Encode the AC coefficients per section F.1.2.2 */
-
- r = 0; /* r = run length of zeros */
-
- for (k = 1; k < DCTSIZE2; k++) {
- if ((temp = block[jpeg_natural_order[k]]) == 0) {
- r++;
- } else {
- /* if run length > 15, must emit special run-length-16 codes (0xF0) */
- while (r > 15) {
- if (! emit_bits(state, actbl->ehufco[0xF0], actbl->ehufsi[0xF0]))
- return FALSE;
- r -= 16;
- }
-
- temp2 = temp;
- if (temp < 0) {
- temp = -temp; /* temp is abs value of input */
- /* This code assumes we are on a two's complement machine */
- temp2--;
- }
-
- /* Find the number of bits needed for the magnitude of the coefficient */
- nbits = 1; /* there must be at least one 1 bit */
- while ((temp >>= 1))
- nbits++;
- /* Check for out-of-range coefficient values */
- if (nbits > MAX_COEF_BITS)
- ERREXIT(state->cinfo, JERR_BAD_DCT_COEF);
-
- /* Emit Huffman symbol for run length / number of bits */
- i = (r << 4) + nbits;
- if (! emit_bits(state, actbl->ehufco[i], actbl->ehufsi[i]))
- return FALSE;
-
- /* Emit that number of bits of the value, if positive, */
- /* or the complement of its magnitude, if negative. */
- if (! emit_bits(state, (unsigned int) temp2, nbits))
- return FALSE;
-
- r = 0;
- }
- }
-
- /* If the last coef(s) were zero, emit an end-of-block code */
- if (r > 0)
- if (! emit_bits(state, actbl->ehufco[0], actbl->ehufsi[0]))
- return FALSE;
-
- return TRUE;
-}
-
-
-/*
- * Emit a restart marker & resynchronize predictions.
- */
-
-LOCAL(boolean)
-emit_restart (working_state * state, int restart_num)
-{
- int ci;
-
- if (! flush_bits(state))
- return FALSE;
-
- emit_byte(state, 0xFF, return FALSE);
- emit_byte(state, JPEG_RST0 + restart_num, return FALSE);
-
- /* Re-initialize DC predictions to 0 */
- for (ci = 0; ci < state->cinfo->comps_in_scan; ci++)
- state->cur.last_dc_val[ci] = 0;
-
- /* The restart counter is not updated until we successfully write the MCU. */
-
- return TRUE;
-}
-
-
-/*
- * Encode and output one MCU's worth of Huffman-compressed coefficients.
- */
-
-METHODDEF(boolean)
-encode_mcu_huff (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
-{
- huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
- working_state state;
- int blkn, ci;
- jpeg_component_info * compptr;
-
- /* Load up working state */
- state.next_output_byte = cinfo->dest->next_output_byte;
- state.free_in_buffer = cinfo->dest->free_in_buffer;
- ASSIGN_STATE(state.cur, entropy->saved);
- state.cinfo = cinfo;
-
- /* Emit restart marker if needed */
- if (cinfo->restart_interval) {
- if (entropy->restarts_to_go == 0)
- if (! emit_restart(&state, entropy->next_restart_num))
- return FALSE;
- }
-
- /* Encode the MCU data blocks */
- for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
- ci = cinfo->MCU_membership[blkn];
- compptr = cinfo->cur_comp_info[ci];
- if (! encode_one_block(&state,
- MCU_data[blkn][0], state.cur.last_dc_val[ci],
- entropy->dc_derived_tbls[compptr->dc_tbl_no],
- entropy->ac_derived_tbls[compptr->ac_tbl_no]))
- return FALSE;
- /* Update last_dc_val */
- state.cur.last_dc_val[ci] = MCU_data[blkn][0][0];
- }
-
- /* Completed MCU, so update state */
- cinfo->dest->next_output_byte = state.next_output_byte;
- cinfo->dest->free_in_buffer = state.free_in_buffer;
- ASSIGN_STATE(entropy->saved, state.cur);
-
- /* Update restart-interval state too */
- if (cinfo->restart_interval) {
- if (entropy->restarts_to_go == 0) {
- entropy->restarts_to_go = cinfo->restart_interval;
- entropy->next_restart_num++;
- entropy->next_restart_num &= 7;
- }
- entropy->restarts_to_go--;
- }
-
- return TRUE;
-}
-
-
-/*
- * Finish up at the end of a Huffman-compressed scan.
- */
-
-METHODDEF(void)
-finish_pass_huff (j_compress_ptr cinfo)
-{
- huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
- working_state state;
-
- /* Load up working state ... flush_bits needs it */
- state.next_output_byte = cinfo->dest->next_output_byte;
- state.free_in_buffer = cinfo->dest->free_in_buffer;
- ASSIGN_STATE(state.cur, entropy->saved);
- state.cinfo = cinfo;
-
- /* Flush out the last data */
- if (! flush_bits(&state))
- ERREXIT(cinfo, JERR_CANT_SUSPEND);
-
- /* Update state */
- cinfo->dest->next_output_byte = state.next_output_byte;
- cinfo->dest->free_in_buffer = state.free_in_buffer;
- ASSIGN_STATE(entropy->saved, state.cur);
-}
-
-
-/*
- * Huffman coding optimization.
- *
- * We first scan the supplied data and count the number of uses of each symbol
- * that is to be Huffman-coded. (This process MUST agree with the code above.)
- * Then we build a Huffman coding tree for the observed counts.
- * Symbols which are not needed at all for the particular image are not
- * assigned any code, which saves space in the DHT marker as well as in
- * the compressed data.
- */
-
-#ifdef ENTROPY_OPT_SUPPORTED
-
-
-/* Process a single block's worth of coefficients */
-
-LOCAL(void)
-htest_one_block (j_compress_ptr cinfo, JCOEFPTR block, int last_dc_val,
- long dc_counts[], long ac_counts[])
-{
- register int temp;
- register int nbits;
- register int k, r;
-
- /* Encode the DC coefficient difference per section F.1.2.1 */
-
- temp = block[0] - last_dc_val;
- if (temp < 0)
- temp = -temp;
-
- /* Find the number of bits needed for the magnitude of the coefficient */
- nbits = 0;
- while (temp) {
- nbits++;
- temp >>= 1;
- }
- /* Check for out-of-range coefficient values.
- * Since we're encoding a difference, the range limit is twice as much.
- */
- if (nbits > MAX_COEF_BITS+1)
- ERREXIT(cinfo, JERR_BAD_DCT_COEF);
-
- /* Count the Huffman symbol for the number of bits */
- dc_counts[nbits]++;
-
- /* Encode the AC coefficients per section F.1.2.2 */
-
- r = 0; /* r = run length of zeros */
-
- for (k = 1; k < DCTSIZE2; k++) {
- if ((temp = block[jpeg_natural_order[k]]) == 0) {
- r++;
- } else {
- /* if run length > 15, must emit special run-length-16 codes (0xF0) */
- while (r > 15) {
- ac_counts[0xF0]++;
- r -= 16;
- }
-
- /* Find the number of bits needed for the magnitude of the coefficient */
- if (temp < 0)
- temp = -temp;
-
- /* Find the number of bits needed for the magnitude of the coefficient */
- nbits = 1; /* there must be at least one 1 bit */
- while ((temp >>= 1))
- nbits++;
- /* Check for out-of-range coefficient values */
- if (nbits > MAX_COEF_BITS)
- ERREXIT(cinfo, JERR_BAD_DCT_COEF);
-
- /* Count Huffman symbol for run length / number of bits */
- ac_counts[(r << 4) + nbits]++;
-
- r = 0;
- }
- }
-
- /* If the last coef(s) were zero, emit an end-of-block code */
- if (r > 0)
- ac_counts[0]++;
-}
-
-
-/*
- * Trial-encode one MCU's worth of Huffman-compressed coefficients.
- * No data is actually output, so no suspension return is possible.
- */
-
-METHODDEF(boolean)
-encode_mcu_gather (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
-{
- huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
- int blkn, ci;
- jpeg_component_info * compptr;
-
- /* Take care of restart intervals if needed */
- if (cinfo->restart_interval) {
- if (entropy->restarts_to_go == 0) {
- /* Re-initialize DC predictions to 0 */
- for (ci = 0; ci < cinfo->comps_in_scan; ci++)
- entropy->saved.last_dc_val[ci] = 0;
- /* Update restart state */
- entropy->restarts_to_go = cinfo->restart_interval;
- }
- entropy->restarts_to_go--;
- }
-
- for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
- ci = cinfo->MCU_membership[blkn];
- compptr = cinfo->cur_comp_info[ci];
- htest_one_block(cinfo, MCU_data[blkn][0], entropy->saved.last_dc_val[ci],
- entropy->dc_count_ptrs[compptr->dc_tbl_no],
- entropy->ac_count_ptrs[compptr->ac_tbl_no]);
- entropy->saved.last_dc_val[ci] = MCU_data[blkn][0][0];
- }
-
- return TRUE;
-}
-
-
-/*
- * Generate the best Huffman code table for the given counts, fill htbl.
- * Note this is also used by jcphuff.c.
- *
- * The JPEG standard requires that no symbol be assigned a codeword of all
- * one bits (so that padding bits added at the end of a compressed segment
- * can't look like a valid code). Because of the canonical ordering of
- * codewords, this just means that there must be an unused slot in the
- * longest codeword length category. Section K.2 of the JPEG spec suggests
- * reserving such a slot by pretending that symbol 256 is a valid symbol
- * with count 1. In theory that's not optimal; giving it count zero but
- * including it in the symbol set anyway should give a better Huffman code.
- * But the theoretically better code actually seems to come out worse in
- * practice, because it produces more all-ones bytes (which incur stuffed
- * zero bytes in the final file). In any case the difference is tiny.
- *
- * The JPEG standard requires Huffman codes to be no more than 16 bits long.
- * If some symbols have a very small but nonzero probability, the Huffman tree
- * must be adjusted to meet the code length restriction. We currently use
- * the adjustment method suggested in JPEG section K.2. This method is *not*
- * optimal; it may not choose the best possible limited-length code. But
- * typically only very-low-frequency symbols will be given less-than-optimal
- * lengths, so the code is almost optimal. Experimental comparisons against
- * an optimal limited-length-code algorithm indicate that the difference is
- * microscopic --- usually less than a hundredth of a percent of total size.
- * So the extra complexity of an optimal algorithm doesn't seem worthwhile.
- */
-
-GLOBAL(void)
-jpeg_gen_optimal_table (j_compress_ptr cinfo, JHUFF_TBL * htbl, long freq[])
-{
-#define MAX_CLEN 32 /* assumed maximum initial code length */
- UINT8 bits[MAX_CLEN+1]; /* bits[k] = # of symbols with code length k */
- int codesize[257]; /* codesize[k] = code length of symbol k */
- int others[257]; /* next symbol in current branch of tree */
- int c1, c2;
- int p, i, j;
- long v;
-
- /* This algorithm is explained in section K.2 of the JPEG standard */
-
- MEMZERO(bits, SIZEOF(bits));
- MEMZERO(codesize, SIZEOF(codesize));
- for (i = 0; i < 257; i++)
- others[i] = -1; /* init links to empty */
-
- freq[256] = 1; /* make sure 256 has a nonzero count */
- /* Including the pseudo-symbol 256 in the Huffman procedure guarantees
- * that no real symbol is given code-value of all ones, because 256
- * will be placed last in the largest codeword category.
- */
-
- /* Huffman's basic algorithm to assign optimal code lengths to symbols */
-
- for (;;) {
- /* Find the smallest nonzero frequency, set c1 = its symbol */
- /* In case of ties, take the larger symbol number */
- c1 = -1;
- v = 1000000000L;
- for (i = 0; i <= 256; i++) {
- if (freq[i] && freq[i] <= v) {
- v = freq[i];
- c1 = i;
- }
- }
-
- /* Find the next smallest nonzero frequency, set c2 = its symbol */
- /* In case of ties, take the larger symbol number */
- c2 = -1;
- v = 1000000000L;
- for (i = 0; i <= 256; i++) {
- if (freq[i] && freq[i] <= v && i != c1) {
- v = freq[i];
- c2 = i;
- }
- }
-
- /* Done if we've merged everything into one frequency */
- if (c2 < 0)
- break;
-
- /* Else merge the two counts/trees */
- freq[c1] += freq[c2];
- freq[c2] = 0;
-
- /* Increment the codesize of everything in c1's tree branch */
- codesize[c1]++;
- while (others[c1] >= 0) {
- c1 = others[c1];
- codesize[c1]++;
- }
-
- others[c1] = c2; /* chain c2 onto c1's tree branch */
-
- /* Increment the codesize of everything in c2's tree branch */
- codesize[c2]++;
- while (others[c2] >= 0) {
- c2 = others[c2];
- codesize[c2]++;
- }
- }
-
- /* Now count the number of symbols of each code length */
- for (i = 0; i <= 256; i++) {
- if (codesize[i]) {
- /* The JPEG standard seems to think that this can't happen, */
- /* but I'm paranoid... */
- if (codesize[i] > MAX_CLEN)
- ERREXIT(cinfo, JERR_HUFF_CLEN_OVERFLOW);
-
- bits[codesize[i]]++;
- }
- }
-
- /* JPEG doesn't allow symbols with code lengths over 16 bits, so if the pure
- * Huffman procedure assigned any such lengths, we must adjust the coding.
- * Here is what the JPEG spec says about how this next bit works:
- * Since symbols are paired for the longest Huffman code, the symbols are
- * removed from this length category two at a time. The prefix for the pair
- * (which is one bit shorter) is allocated to one of the pair; then,
- * skipping the BITS entry for that prefix length, a code word from the next
- * shortest nonzero BITS entry is converted into a prefix for two code words
- * one bit longer.
- */
-
- for (i = MAX_CLEN; i > 16; i--) {
- while (bits[i] > 0) {
- j = i - 2; /* find length of new prefix to be used */
- while (bits[j] == 0)
- j--;
-
- bits[i] -= 2; /* remove two symbols */
- bits[i-1]++; /* one goes in this length */
- bits[j+1] += 2; /* two new symbols in this length */
- bits[j]--; /* symbol of this length is now a prefix */
- }
- }
-
- /* Remove the count for the pseudo-symbol 256 from the largest codelength */
- while (bits[i] == 0) /* find largest codelength still in use */
- i--;
- bits[i]--;
-
- /* Return final symbol counts (only for lengths 0..16) */
- MEMCOPY(htbl->bits, bits, SIZEOF(htbl->bits));
-
- /* Return a list of the symbols sorted by code length */
- /* It's not real clear to me why we don't need to consider the codelength
- * changes made above, but the JPEG spec seems to think this works.
- */
- p = 0;
- for (i = 1; i <= MAX_CLEN; i++) {
- for (j = 0; j <= 255; j++) {
- if (codesize[j] == i) {
- htbl->huffval[p] = (UINT8) j;
- p++;
- }
- }
- }
-
- /* Set sent_table FALSE so updated table will be written to JPEG file. */
- htbl->sent_table = FALSE;
-}
-
-
-/*
- * Finish up a statistics-gathering pass and create the new Huffman tables.
- */
-
-METHODDEF(void)
-finish_pass_gather (j_compress_ptr cinfo)
-{
- huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
- int ci, dctbl, actbl;
- jpeg_component_info * compptr;
- JHUFF_TBL **htblptr;
- boolean did_dc[NUM_HUFF_TBLS];
- boolean did_ac[NUM_HUFF_TBLS];
-
- /* It's important not to apply jpeg_gen_optimal_table more than once
- * per table, because it clobbers the input frequency counts!
- */
- MEMZERO(did_dc, SIZEOF(did_dc));
- MEMZERO(did_ac, SIZEOF(did_ac));
-
- for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
- compptr = cinfo->cur_comp_info[ci];
- dctbl = compptr->dc_tbl_no;
- actbl = compptr->ac_tbl_no;
- if (! did_dc[dctbl]) {
- htblptr = & cinfo->dc_huff_tbl_ptrs[dctbl];
- if (*htblptr == NULL)
- *htblptr = jpeg_alloc_huff_table((j_common_ptr) cinfo);
- jpeg_gen_optimal_table(cinfo, *htblptr, entropy->dc_count_ptrs[dctbl]);
- did_dc[dctbl] = TRUE;
- }
- if (! did_ac[actbl]) {
- htblptr = & cinfo->ac_huff_tbl_ptrs[actbl];
- if (*htblptr == NULL)
- *htblptr = jpeg_alloc_huff_table((j_common_ptr) cinfo);
- jpeg_gen_optimal_table(cinfo, *htblptr, entropy->ac_count_ptrs[actbl]);
- did_ac[actbl] = TRUE;
- }
- }
-}
-
-
-#endif /* ENTROPY_OPT_SUPPORTED */
-
-
-/*
- * Module initialization routine for Huffman entropy encoding.
- */
-
-GLOBAL(void)
-jinit_huff_encoder (j_compress_ptr cinfo)
-{
- huff_entropy_ptr entropy;
- int i;
-
- entropy = (huff_entropy_ptr)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- SIZEOF(huff_entropy_encoder));
- cinfo->entropy = (struct jpeg_entropy_encoder *) entropy;
- entropy->pub.start_pass = start_pass_huff;
-
- /* Mark tables unallocated */
- for (i = 0; i < NUM_HUFF_TBLS; i++) {
- entropy->dc_derived_tbls[i] = entropy->ac_derived_tbls[i] = NULL;
-#ifdef ENTROPY_OPT_SUPPORTED
- entropy->dc_count_ptrs[i] = entropy->ac_count_ptrs[i] = NULL;
-#endif
- }
-}
diff --git a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jcinit.c b/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jcinit.c
deleted file mode 100644
index 5efffe33166..00000000000
--- a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jcinit.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * jcinit.c
- *
- * Copyright (C) 1991-1997, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file contains initialization logic for the JPEG compressor.
- * This routine is in charge of selecting the modules to be executed and
- * making an initialization call to each one.
- *
- * Logically, this code belongs in jcmaster.c. It's split out because
- * linking this routine implies linking the entire compression library.
- * For a transcoding-only application, we want to be able to use jcmaster.c
- * without linking in the whole library.
- */
-
-#define JPEG_INTERNALS
-#include "jinclude.h"
-#include "jpeglib.h"
-
-
-/*
- * Master selection of compression modules.
- * This is done once at the start of processing an image. We determine
- * which modules will be used and give them appropriate initialization calls.
- */
-
-GLOBAL(void)
-jinit_compress_master (j_compress_ptr cinfo)
-{
- /* Initialize master control (includes parameter checking/processing) */
- jinit_c_master_control(cinfo, FALSE /* full compression */);
-
- /* Preprocessing */
- if (! cinfo->raw_data_in) {
- jinit_color_converter(cinfo);
- jinit_downsampler(cinfo);
- jinit_c_prep_controller(cinfo, FALSE /* never need full buffer here */);
- }
- /* Forward DCT */
- jinit_forward_dct(cinfo);
- /* Entropy encoding: either Huffman or arithmetic coding. */
- if (cinfo->arith_code) {
- ERREXIT(cinfo, JERR_ARITH_NOTIMPL);
- } else {
- if (cinfo->progressive_mode) {
-#ifdef C_PROGRESSIVE_SUPPORTED
- jinit_phuff_encoder(cinfo);
-#else
- ERREXIT(cinfo, JERR_NOT_COMPILED);
-#endif
- } else
- jinit_huff_encoder(cinfo);
- }
-
- /* Need a full-image coefficient buffer in any multi-pass mode. */
- jinit_c_coef_controller(cinfo,
- (boolean) (cinfo->num_scans > 1 || cinfo->optimize_coding));
- jinit_c_main_controller(cinfo, FALSE /* never need full buffer here */);
-
- jinit_marker_writer(cinfo);
-
- /* We can now tell the memory manager to allocate virtual arrays. */
- (*cinfo->mem->realize_virt_arrays) ((j_common_ptr) cinfo);
-
- /* Write the datastream header (SOI) immediately.
- * Frame and scan headers are postponed till later.
- * This lets application insert special markers after the SOI.
- */
- (*cinfo->marker->write_file_header) (cinfo);
-}
diff --git a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jcmainct.c b/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jcmainct.c
deleted file mode 100644
index e0279a7e017..00000000000
--- a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jcmainct.c
+++ /dev/null
@@ -1,293 +0,0 @@
-/*
- * jcmainct.c
- *
- * Copyright (C) 1994-1996, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file contains the main buffer controller for compression.
- * The main buffer lies between the pre-processor and the JPEG
- * compressor proper; it holds downsampled data in the JPEG colorspace.
- */
-
-#define JPEG_INTERNALS
-#include "jinclude.h"
-#include "jpeglib.h"
-
-
-/* Note: currently, there is no operating mode in which a full-image buffer
- * is needed at this step. If there were, that mode could not be used with
- * "raw data" input, since this module is bypassed in that case. However,
- * we've left the code here for possible use in special applications.
- */
-#undef FULL_MAIN_BUFFER_SUPPORTED
-
-
-/* Private buffer controller object */
-
-typedef struct {
- struct jpeg_c_main_controller pub; /* public fields */
-
- JDIMENSION cur_iMCU_row; /* number of current iMCU row */
- JDIMENSION rowgroup_ctr; /* counts row groups received in iMCU row */
- boolean suspended; /* remember if we suspended output */
- J_BUF_MODE pass_mode; /* current operating mode */
-
- /* If using just a strip buffer, this points to the entire set of buffers
- * (we allocate one for each component). In the full-image case, this
- * points to the currently accessible strips of the virtual arrays.
- */
- JSAMPARRAY buffer[MAX_COMPONENTS];
-
-#ifdef FULL_MAIN_BUFFER_SUPPORTED
- /* If using full-image storage, this array holds pointers to virtual-array
- * control blocks for each component. Unused if not full-image storage.
- */
- jvirt_sarray_ptr whole_image[MAX_COMPONENTS];
-#endif
-} my_main_controller;
-
-typedef my_main_controller * my_main_ptr;
-
-
-/* Forward declarations */
-METHODDEF(void) process_data_simple_main
- JPP((j_compress_ptr cinfo, JSAMPARRAY input_buf,
- JDIMENSION *in_row_ctr, JDIMENSION in_rows_avail));
-#ifdef FULL_MAIN_BUFFER_SUPPORTED
-METHODDEF(void) process_data_buffer_main
- JPP((j_compress_ptr cinfo, JSAMPARRAY input_buf,
- JDIMENSION *in_row_ctr, JDIMENSION in_rows_avail));
-#endif
-
-
-/*
- * Initialize for a processing pass.
- */
-
-METHODDEF(void)
-start_pass_main (j_compress_ptr cinfo, J_BUF_MODE pass_mode)
-{
- my_main_ptr main = (my_main_ptr) cinfo->main;
-
- /* Do nothing in raw-data mode. */
- if (cinfo->raw_data_in)
- return;
-
- main->cur_iMCU_row = 0; /* initialize counters */
- main->rowgroup_ctr = 0;
- main->suspended = FALSE;
- main->pass_mode = pass_mode; /* save mode for use by process_data */
-
- switch (pass_mode) {
- case JBUF_PASS_THRU:
-#ifdef FULL_MAIN_BUFFER_SUPPORTED
- if (main->whole_image[0] != NULL)
- ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
-#endif
- main->pub.process_data = process_data_simple_main;
- break;
-#ifdef FULL_MAIN_BUFFER_SUPPORTED
- case JBUF_SAVE_SOURCE:
- case JBUF_CRANK_DEST:
- case JBUF_SAVE_AND_PASS:
- if (main->whole_image[0] == NULL)
- ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
- main->pub.process_data = process_data_buffer_main;
- break;
-#endif
- default:
- ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
- break;
- }
-}
-
-
-/*
- * Process some data.
- * This routine handles the simple pass-through mode,
- * where we have only a strip buffer.
- */
-
-METHODDEF(void)
-process_data_simple_main (j_compress_ptr cinfo,
- JSAMPARRAY input_buf, JDIMENSION *in_row_ctr,
- JDIMENSION in_rows_avail)
-{
- my_main_ptr main = (my_main_ptr) cinfo->main;
-
- while (main->cur_iMCU_row < cinfo->total_iMCU_rows) {
- /* Read input data if we haven't filled the main buffer yet */
- if (main->rowgroup_ctr < DCTSIZE)
- (*cinfo->prep->pre_process_data) (cinfo,
- input_buf, in_row_ctr, in_rows_avail,
- main->buffer, &main->rowgroup_ctr,
- (JDIMENSION) DCTSIZE);
-
- /* If we don't have a full iMCU row buffered, return to application for
- * more data. Note that preprocessor will always pad to fill the iMCU row
- * at the bottom of the image.
- */
- if (main->rowgroup_ctr != DCTSIZE)
- return;
-
- /* Send the completed row to the compressor */
- if (! (*cinfo->coef->compress_data) (cinfo, main->buffer)) {
- /* If compressor did not consume the whole row, then we must need to
- * suspend processing and return to the application. In this situation
- * we pretend we didn't yet consume the last input row; otherwise, if
- * it happened to be the last row of the image, the application would
- * think we were done.
- */
- if (! main->suspended) {
- (*in_row_ctr)--;
- main->suspended = TRUE;
- }
- return;
- }
- /* We did finish the row. Undo our little suspension hack if a previous
- * call suspended; then mark the main buffer empty.
- */
- if (main->suspended) {
- (*in_row_ctr)++;
- main->suspended = FALSE;
- }
- main->rowgroup_ctr = 0;
- main->cur_iMCU_row++;
- }
-}
-
-
-#ifdef FULL_MAIN_BUFFER_SUPPORTED
-
-/*
- * Process some data.
- * This routine handles all of the modes that use a full-size buffer.
- */
-
-METHODDEF(void)
-process_data_buffer_main (j_compress_ptr cinfo,
- JSAMPARRAY input_buf, JDIMENSION *in_row_ctr,
- JDIMENSION in_rows_avail)
-{
- my_main_ptr main = (my_main_ptr) cinfo->main;
- int ci;
- jpeg_component_info *compptr;
- boolean writing = (main->pass_mode != JBUF_CRANK_DEST);
-
- while (main->cur_iMCU_row < cinfo->total_iMCU_rows) {
- /* Realign the virtual buffers if at the start of an iMCU row. */
- if (main->rowgroup_ctr == 0) {
- for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
- ci++, compptr++) {
- main->buffer[ci] = (*cinfo->mem->access_virt_sarray)
- ((j_common_ptr) cinfo, main->whole_image[ci],
- main->cur_iMCU_row * (compptr->v_samp_factor * DCTSIZE),
- (JDIMENSION) (compptr->v_samp_factor * DCTSIZE), writing);
- }
- /* In a read pass, pretend we just read some source data. */
- if (! writing) {
- *in_row_ctr += cinfo->max_v_samp_factor * DCTSIZE;
- main->rowgroup_ctr = DCTSIZE;
- }
- }
-
- /* If a write pass, read input data until the current iMCU row is full. */
- /* Note: preprocessor will pad if necessary to fill the last iMCU row. */
- if (writing) {
- (*cinfo->prep->pre_process_data) (cinfo,
- input_buf, in_row_ctr, in_rows_avail,
- main->buffer, &main->rowgroup_ctr,
- (JDIMENSION) DCTSIZE);
- /* Return to application if we need more data to fill the iMCU row. */
- if (main->rowgroup_ctr < DCTSIZE)
- return;
- }
-
- /* Emit data, unless this is a sink-only pass. */
- if (main->pass_mode != JBUF_SAVE_SOURCE) {
- if (! (*cinfo->coef->compress_data) (cinfo, main->buffer)) {
- /* If compressor did not consume the whole row, then we must need to
- * suspend processing and return to the application. In this situation
- * we pretend we didn't yet consume the last input row; otherwise, if
- * it happened to be the last row of the image, the application would
- * think we were done.
- */
- if (! main->suspended) {
- (*in_row_ctr)--;
- main->suspended = TRUE;
- }
- return;
- }
- /* We did finish the row. Undo our little suspension hack if a previous
- * call suspended; then mark the main buffer empty.
- */
- if (main->suspended) {
- (*in_row_ctr)++;
- main->suspended = FALSE;
- }
- }
-
- /* If get here, we are done with this iMCU row. Mark buffer empty. */
- main->rowgroup_ctr = 0;
- main->cur_iMCU_row++;
- }
-}
-
-#endif /* FULL_MAIN_BUFFER_SUPPORTED */
-
-
-/*
- * Initialize main buffer controller.
- */
-
-GLOBAL(void)
-jinit_c_main_controller (j_compress_ptr cinfo, boolean need_full_buffer)
-{
- my_main_ptr main;
- int ci;
- jpeg_component_info *compptr;
-
- main = (my_main_ptr)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- SIZEOF(my_main_controller));
- cinfo->main = (struct jpeg_c_main_controller *) main;
- main->pub.start_pass = start_pass_main;
-
- /* We don't need to create a buffer in raw-data mode. */
- if (cinfo->raw_data_in)
- return;
-
- /* Create the buffer. It holds downsampled data, so each component
- * may be of a different size.
- */
- if (need_full_buffer) {
-#ifdef FULL_MAIN_BUFFER_SUPPORTED
- /* Allocate a full-image virtual array for each component */
- /* Note we pad the bottom to a multiple of the iMCU height */
- for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
- ci++, compptr++) {
- main->whole_image[ci] = (*cinfo->mem->request_virt_sarray)
- ((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE,
- compptr->width_in_blocks * DCTSIZE,
- (JDIMENSION) jround_up((long) compptr->height_in_blocks,
- (long) compptr->v_samp_factor) * DCTSIZE,
- (JDIMENSION) (compptr->v_samp_factor * DCTSIZE));
- }
-#else
- ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
-#endif
- } else {
-#ifdef FULL_MAIN_BUFFER_SUPPORTED
- main->whole_image[0] = NULL; /* flag for no virtual arrays */
-#endif
- /* Allocate a strip buffer for each component */
- for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
- ci++, compptr++) {
- main->buffer[ci] = (*cinfo->mem->alloc_sarray)
- ((j_common_ptr) cinfo, JPOOL_IMAGE,
- compptr->width_in_blocks * DCTSIZE,
- (JDIMENSION) (compptr->v_samp_factor * DCTSIZE));
- }
- }
-}
diff --git a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jcmarker.c b/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jcmarker.c
deleted file mode 100644
index 3d1e6c6d524..00000000000
--- a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jcmarker.c
+++ /dev/null
@@ -1,664 +0,0 @@
-/*
- * jcmarker.c
- *
- * Copyright (C) 1991-1998, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file contains routines to write JPEG datastream markers.
- */
-
-#define JPEG_INTERNALS
-#include "jinclude.h"
-#include "jpeglib.h"
-
-
-typedef enum { /* JPEG marker codes */
- M_SOF0 = 0xc0,
- M_SOF1 = 0xc1,
- M_SOF2 = 0xc2,
- M_SOF3 = 0xc3,
-
- M_SOF5 = 0xc5,
- M_SOF6 = 0xc6,
- M_SOF7 = 0xc7,
-
- M_JPG = 0xc8,
- M_SOF9 = 0xc9,
- M_SOF10 = 0xca,
- M_SOF11 = 0xcb,
-
- M_SOF13 = 0xcd,
- M_SOF14 = 0xce,
- M_SOF15 = 0xcf,
-
- M_DHT = 0xc4,
-
- M_DAC = 0xcc,
-
- M_RST0 = 0xd0,
- M_RST1 = 0xd1,
- M_RST2 = 0xd2,
- M_RST3 = 0xd3,
- M_RST4 = 0xd4,
- M_RST5 = 0xd5,
- M_RST6 = 0xd6,
- M_RST7 = 0xd7,
-
- M_SOI = 0xd8,
- M_EOI = 0xd9,
- M_SOS = 0xda,
- M_DQT = 0xdb,
- M_DNL = 0xdc,
- M_DRI = 0xdd,
- M_DHP = 0xde,
- M_EXP = 0xdf,
-
- M_APP0 = 0xe0,
- M_APP1 = 0xe1,
- M_APP2 = 0xe2,
- M_APP3 = 0xe3,
- M_APP4 = 0xe4,
- M_APP5 = 0xe5,
- M_APP6 = 0xe6,
- M_APP7 = 0xe7,
- M_APP8 = 0xe8,
- M_APP9 = 0xe9,
- M_APP10 = 0xea,
- M_APP11 = 0xeb,
- M_APP12 = 0xec,
- M_APP13 = 0xed,
- M_APP14 = 0xee,
- M_APP15 = 0xef,
-
- M_JPG0 = 0xf0,
- M_JPG13 = 0xfd,
- M_COM = 0xfe,
-
- M_TEM = 0x01,
-
- M_ERROR = 0x100
-} JPEG_MARKER;
-
-
-/* Private state */
-
-typedef struct {
- struct jpeg_marker_writer pub; /* public fields */
-
- unsigned int last_restart_interval; /* last DRI value emitted; 0 after SOI */
-} my_marker_writer;
-
-typedef my_marker_writer * my_marker_ptr;
-
-
-/*
- * Basic output routines.
- *
- * Note that we do not support suspension while writing a marker.
- * Therefore, an application using suspension must ensure that there is
- * enough buffer space for the initial markers (typ. 600-700 bytes) before
- * calling jpeg_start_compress, and enough space to write the trailing EOI
- * (a few bytes) before calling jpeg_finish_compress. Multipass compression
- * modes are not supported at all with suspension, so those two are the only
- * points where markers will be written.
- */
-
-LOCAL(void)
-emit_byte (j_compress_ptr cinfo, int val)
-/* Emit a byte */
-{
- struct jpeg_destination_mgr * dest = cinfo->dest;
-
- *(dest->next_output_byte)++ = (JOCTET) val;
- if (--dest->free_in_buffer == 0) {
- if (! (*dest->empty_output_buffer) (cinfo))
- ERREXIT(cinfo, JERR_CANT_SUSPEND);
- }
-}
-
-
-LOCAL(void)
-emit_marker (j_compress_ptr cinfo, JPEG_MARKER mark)
-/* Emit a marker code */
-{
- emit_byte(cinfo, 0xFF);
- emit_byte(cinfo, (int) mark);
-}
-
-
-LOCAL(void)
-emit_2bytes (j_compress_ptr cinfo, int value)
-/* Emit a 2-byte integer; these are always MSB first in JPEG files */
-{
- emit_byte(cinfo, (value >> 8) & 0xFF);
- emit_byte(cinfo, value & 0xFF);
-}
-
-
-/*
- * Routines to write specific marker types.
- */
-
-LOCAL(int)
-emit_dqt (j_compress_ptr cinfo, int index)
-/* Emit a DQT marker */
-/* Returns the precision used (0 = 8bits, 1 = 16bits) for baseline checking */
-{
- JQUANT_TBL * qtbl = cinfo->quant_tbl_ptrs[index];
- int prec;
- int i;
-
- if (qtbl == NULL)
- ERREXIT1(cinfo, JERR_NO_QUANT_TABLE, index);
-
- prec = 0;
- for (i = 0; i < DCTSIZE2; i++) {
- if (qtbl->quantval[i] > 255)
- prec = 1;
- }
-
- if (! qtbl->sent_table) {
- emit_marker(cinfo, M_DQT);
-
- emit_2bytes(cinfo, prec ? DCTSIZE2*2 + 1 + 2 : DCTSIZE2 + 1 + 2);
-
- emit_byte(cinfo, index + (prec<<4));
-
- for (i = 0; i < DCTSIZE2; i++) {
- /* The table entries must be emitted in zigzag order. */
- unsigned int qval = qtbl->quantval[jpeg_natural_order[i]];
- if (prec)
- emit_byte(cinfo, (int) (qval >> 8));
- emit_byte(cinfo, (int) (qval & 0xFF));
- }
-
- qtbl->sent_table = TRUE;
- }
-
- return prec;
-}
-
-
-LOCAL(void)
-emit_dht (j_compress_ptr cinfo, int index, boolean is_ac)
-/* Emit a DHT marker */
-{
- JHUFF_TBL * htbl;
- int length, i;
-
- if (is_ac) {
- htbl = cinfo->ac_huff_tbl_ptrs[index];
- index += 0x10; /* output index has AC bit set */
- } else {
- htbl = cinfo->dc_huff_tbl_ptrs[index];
- }
-
- if (htbl == NULL)
- ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, index);
-
- if (! htbl->sent_table) {
- emit_marker(cinfo, M_DHT);
-
- length = 0;
- for (i = 1; i <= 16; i++)
- length += htbl->bits[i];
-
- emit_2bytes(cinfo, length + 2 + 1 + 16);
- emit_byte(cinfo, index);
-
- for (i = 1; i <= 16; i++)
- emit_byte(cinfo, htbl->bits[i]);
-
- for (i = 0; i < length; i++)
- emit_byte(cinfo, htbl->huffval[i]);
-
- htbl->sent_table = TRUE;
- }
-}
-
-
-LOCAL(void)
-emit_dac (j_compress_ptr cinfo)
-/* Emit a DAC marker */
-/* Since the useful info is so small, we want to emit all the tables in */
-/* one DAC marker. Therefore this routine does its own scan of the table. */
-{
-#ifdef C_ARITH_CODING_SUPPORTED
- char dc_in_use[NUM_ARITH_TBLS];
- char ac_in_use[NUM_ARITH_TBLS];
- int length, i;
- jpeg_component_info *compptr;
-
- for (i = 0; i < NUM_ARITH_TBLS; i++)
- dc_in_use[i] = ac_in_use[i] = 0;
-
- for (i = 0; i < cinfo->comps_in_scan; i++) {
- compptr = cinfo->cur_comp_info[i];
- dc_in_use[compptr->dc_tbl_no] = 1;
- ac_in_use[compptr->ac_tbl_no] = 1;
- }
-
- length = 0;
- for (i = 0; i < NUM_ARITH_TBLS; i++)
- length += dc_in_use[i] + ac_in_use[i];
-
- emit_marker(cinfo, M_DAC);
-
- emit_2bytes(cinfo, length*2 + 2);
-
- for (i = 0; i < NUM_ARITH_TBLS; i++) {
- if (dc_in_use[i]) {
- emit_byte(cinfo, i);
- emit_byte(cinfo, cinfo->arith_dc_L[i] + (cinfo->arith_dc_U[i]<<4));
- }
- if (ac_in_use[i]) {
- emit_byte(cinfo, i + 0x10);
- emit_byte(cinfo, cinfo->arith_ac_K[i]);
- }
- }
-#endif /* C_ARITH_CODING_SUPPORTED */
-}
-
-
-LOCAL(void)
-emit_dri (j_compress_ptr cinfo)
-/* Emit a DRI marker */
-{
- emit_marker(cinfo, M_DRI);
-
- emit_2bytes(cinfo, 4); /* fixed length */
-
- emit_2bytes(cinfo, (int) cinfo->restart_interval);
-}
-
-
-LOCAL(void)
-emit_sof (j_compress_ptr cinfo, JPEG_MARKER code)
-/* Emit a SOF marker */
-{
- int ci;
- jpeg_component_info *compptr;
-
- emit_marker(cinfo, code);
-
- emit_2bytes(cinfo, 3 * cinfo->num_components + 2 + 5 + 1); /* length */
-
- /* Make sure image isn't bigger than SOF field can handle */
- if ((long) cinfo->image_height > 65535L ||
- (long) cinfo->image_width > 65535L)
- ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int) 65535);
-
- emit_byte(cinfo, cinfo->data_precision);
- emit_2bytes(cinfo, (int) cinfo->image_height);
- emit_2bytes(cinfo, (int) cinfo->image_width);
-
- emit_byte(cinfo, cinfo->num_components);
-
- for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
- ci++, compptr++) {
- emit_byte(cinfo, compptr->component_id);
- emit_byte(cinfo, (compptr->h_samp_factor << 4) + compptr->v_samp_factor);
- emit_byte(cinfo, compptr->quant_tbl_no);
- }
-}
-
-
-LOCAL(void)
-emit_sos (j_compress_ptr cinfo)
-/* Emit a SOS marker */
-{
- int i, td, ta;
- jpeg_component_info *compptr;
-
- emit_marker(cinfo, M_SOS);
-
- emit_2bytes(cinfo, 2 * cinfo->comps_in_scan + 2 + 1 + 3); /* length */
-
- emit_byte(cinfo, cinfo->comps_in_scan);
-
- for (i = 0; i < cinfo->comps_in_scan; i++) {
- compptr = cinfo->cur_comp_info[i];
- emit_byte(cinfo, compptr->component_id);
- td = compptr->dc_tbl_no;
- ta = compptr->ac_tbl_no;
- if (cinfo->progressive_mode) {
- /* Progressive mode: only DC or only AC tables are used in one scan;
- * furthermore, Huffman coding of DC refinement uses no table at all.
- * We emit 0 for unused field(s); this is recommended by the P&M text
- * but does not seem to be specified in the standard.
- */
- if (cinfo->Ss == 0) {
- ta = 0; /* DC scan */
- if (cinfo->Ah != 0 && !cinfo->arith_code)
- td = 0; /* no DC table either */
- } else {
- td = 0; /* AC scan */
- }
- }
- emit_byte(cinfo, (td << 4) + ta);
- }
-
- emit_byte(cinfo, cinfo->Ss);
- emit_byte(cinfo, cinfo->Se);
- emit_byte(cinfo, (cinfo->Ah << 4) + cinfo->Al);
-}
-
-
-LOCAL(void)
-emit_jfif_app0 (j_compress_ptr cinfo)
-/* Emit a JFIF-compliant APP0 marker */
-{
- /*
- * Length of APP0 block (2 bytes)
- * Block ID (4 bytes - ASCII "JFIF")
- * Zero byte (1 byte to terminate the ID string)
- * Version Major, Minor (2 bytes - major first)
- * Units (1 byte - 0x00 = none, 0x01 = inch, 0x02 = cm)
- * Xdpu (2 bytes - dots per unit horizontal)
- * Ydpu (2 bytes - dots per unit vertical)
- * Thumbnail X size (1 byte)
- * Thumbnail Y size (1 byte)
- */
-
- emit_marker(cinfo, M_APP0);
-
- emit_2bytes(cinfo, 2 + 4 + 1 + 2 + 1 + 2 + 2 + 1 + 1); /* length */
-
- emit_byte(cinfo, 0x4A); /* Identifier: ASCII "JFIF" */
- emit_byte(cinfo, 0x46);
- emit_byte(cinfo, 0x49);
- emit_byte(cinfo, 0x46);
- emit_byte(cinfo, 0);
- emit_byte(cinfo, cinfo->JFIF_major_version); /* Version fields */
- emit_byte(cinfo, cinfo->JFIF_minor_version);
- emit_byte(cinfo, cinfo->density_unit); /* Pixel size information */
- emit_2bytes(cinfo, (int) cinfo->X_density);
- emit_2bytes(cinfo, (int) cinfo->Y_density);
- emit_byte(cinfo, 0); /* No thumbnail image */
- emit_byte(cinfo, 0);
-}
-
-
-LOCAL(void)
-emit_adobe_app14 (j_compress_ptr cinfo)
-/* Emit an Adobe APP14 marker */
-{
- /*
- * Length of APP14 block (2 bytes)
- * Block ID (5 bytes - ASCII "Adobe")
- * Version Number (2 bytes - currently 100)
- * Flags0 (2 bytes - currently 0)
- * Flags1 (2 bytes - currently 0)
- * Color transform (1 byte)
- *
- * Although Adobe TN 5116 mentions Version = 101, all the Adobe files
- * now in circulation seem to use Version = 100, so that's what we write.
- *
- * We write the color transform byte as 1 if the JPEG color space is
- * YCbCr, 2 if it's YCCK, 0 otherwise. Adobe's definition has to do with
- * whether the encoder performed a transformation, which is pretty useless.
- */
-
- emit_marker(cinfo, M_APP14);
-
- emit_2bytes(cinfo, 2 + 5 + 2 + 2 + 2 + 1); /* length */
-
- emit_byte(cinfo, 0x41); /* Identifier: ASCII "Adobe" */
- emit_byte(cinfo, 0x64);
- emit_byte(cinfo, 0x6F);
- emit_byte(cinfo, 0x62);
- emit_byte(cinfo, 0x65);
- emit_2bytes(cinfo, 100); /* Version */
- emit_2bytes(cinfo, 0); /* Flags0 */
- emit_2bytes(cinfo, 0); /* Flags1 */
- switch (cinfo->jpeg_color_space) {
- case JCS_YCbCr:
- emit_byte(cinfo, 1); /* Color transform = 1 */
- break;
- case JCS_YCCK:
- emit_byte(cinfo, 2); /* Color transform = 2 */
- break;
- default:
- emit_byte(cinfo, 0); /* Color transform = 0 */
- break;
- }
-}
-
-
-/*
- * These routines allow writing an arbitrary marker with parameters.
- * The only intended use is to emit COM or APPn markers after calling
- * write_file_header and before calling write_frame_header.
- * Other uses are not guaranteed to produce desirable results.
- * Counting the parameter bytes properly is the caller's responsibility.
- */
-
-METHODDEF(void)
-write_marker_header (j_compress_ptr cinfo, int marker, unsigned int datalen)
-/* Emit an arbitrary marker header */
-{
- if (datalen > (unsigned int) 65533) /* safety check */
- ERREXIT(cinfo, JERR_BAD_LENGTH);
-
- emit_marker(cinfo, (JPEG_MARKER) marker);
-
- emit_2bytes(cinfo, (int) (datalen + 2)); /* total length */
-}
-
-METHODDEF(void)
-write_marker_byte (j_compress_ptr cinfo, int val)
-/* Emit one byte of marker parameters following write_marker_header */
-{
- emit_byte(cinfo, val);
-}
-
-
-/*
- * Write datastream header.
- * This consists of an SOI and optional APPn markers.
- * We recommend use of the JFIF marker, but not the Adobe marker,
- * when using YCbCr or grayscale data. The JFIF marker should NOT
- * be used for any other JPEG colorspace. The Adobe marker is helpful
- * to distinguish RGB, CMYK, and YCCK colorspaces.
- * Note that an application can write additional header markers after
- * jpeg_start_compress returns.
- */
-
-METHODDEF(void)
-write_file_header (j_compress_ptr cinfo)
-{
- my_marker_ptr marker = (my_marker_ptr) cinfo->marker;
-
- emit_marker(cinfo, M_SOI); /* first the SOI */
-
- /* SOI is defined to reset restart interval to 0 */
- marker->last_restart_interval = 0;
-
- if (cinfo->write_JFIF_header) /* next an optional JFIF APP0 */
- emit_jfif_app0(cinfo);
- if (cinfo->write_Adobe_marker) /* next an optional Adobe APP14 */
- emit_adobe_app14(cinfo);
-}
-
-
-/*
- * Write frame header.
- * This consists of DQT and SOFn markers.
- * Note that we do not emit the SOF until we have emitted the DQT(s).
- * This avoids compatibility problems with incorrect implementations that
- * try to error-check the quant table numbers as soon as they see the SOF.
- */
-
-METHODDEF(void)
-write_frame_header (j_compress_ptr cinfo)
-{
- int ci, prec;
- boolean is_baseline;
- jpeg_component_info *compptr;
-
- /* Emit DQT for each quantization table.
- * Note that emit_dqt() suppresses any duplicate tables.
- */
- prec = 0;
- for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
- ci++, compptr++) {
- prec += emit_dqt(cinfo, compptr->quant_tbl_no);
- }
- /* now prec is nonzero iff there are any 16-bit quant tables. */
-
- /* Check for a non-baseline specification.
- * Note we assume that Huffman table numbers won't be changed later.
- */
- if (cinfo->arith_code || cinfo->progressive_mode ||
- cinfo->data_precision != 8) {
- is_baseline = FALSE;
- } else {
- is_baseline = TRUE;
- for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
- ci++, compptr++) {
- if (compptr->dc_tbl_no > 1 || compptr->ac_tbl_no > 1)
- is_baseline = FALSE;
- }
- if (prec && is_baseline) {
- is_baseline = FALSE;
- /* If it's baseline except for quantizer size, warn the user */
- TRACEMS(cinfo, 0, JTRC_16BIT_TABLES);
- }
- }
-
- /* Emit the proper SOF marker */
- if (cinfo->arith_code) {
- emit_sof(cinfo, M_SOF9); /* SOF code for arithmetic coding */
- } else {
- if (cinfo->progressive_mode)
- emit_sof(cinfo, M_SOF2); /* SOF code for progressive Huffman */
- else if (is_baseline)
- emit_sof(cinfo, M_SOF0); /* SOF code for baseline implementation */
- else
- emit_sof(cinfo, M_SOF1); /* SOF code for non-baseline Huffman file */
- }
-}
-
-
-/*
- * Write scan header.
- * This consists of DHT or DAC markers, optional DRI, and SOS.
- * Compressed data will be written following the SOS.
- */
-
-METHODDEF(void)
-write_scan_header (j_compress_ptr cinfo)
-{
- my_marker_ptr marker = (my_marker_ptr) cinfo->marker;
- int i;
- jpeg_component_info *compptr;
-
- if (cinfo->arith_code) {
- /* Emit arith conditioning info. We may have some duplication
- * if the file has multiple scans, but it's so small it's hardly
- * worth worrying about.
- */
- emit_dac(cinfo);
- } else {
- /* Emit Huffman tables.
- * Note that emit_dht() suppresses any duplicate tables.
- */
- for (i = 0; i < cinfo->comps_in_scan; i++) {
- compptr = cinfo->cur_comp_info[i];
- if (cinfo->progressive_mode) {
- /* Progressive mode: only DC or only AC tables are used in one scan */
- if (cinfo->Ss == 0) {
- if (cinfo->Ah == 0) /* DC needs no table for refinement scan */
- emit_dht(cinfo, compptr->dc_tbl_no, FALSE);
- } else {
- emit_dht(cinfo, compptr->ac_tbl_no, TRUE);
- }
- } else {
- /* Sequential mode: need both DC and AC tables */
- emit_dht(cinfo, compptr->dc_tbl_no, FALSE);
- emit_dht(cinfo, compptr->ac_tbl_no, TRUE);
- }
- }
- }
-
- /* Emit DRI if required --- note that DRI value could change for each scan.
- * We avoid wasting space with unnecessary DRIs, however.
- */
- if (cinfo->restart_interval != marker->last_restart_interval) {
- emit_dri(cinfo);
- marker->last_restart_interval = cinfo->restart_interval;
- }
-
- emit_sos(cinfo);
-}
-
-
-/*
- * Write datastream trailer.
- */
-
-METHODDEF(void)
-write_file_trailer (j_compress_ptr cinfo)
-{
- emit_marker(cinfo, M_EOI);
-}
-
-
-/*
- * Write an abbreviated table-specification datastream.
- * This consists of SOI, DQT and DHT tables, and EOI.
- * Any table that is defined and not marked sent_table = TRUE will be
- * emitted. Note that all tables will be marked sent_table = TRUE at exit.
- */
-
-METHODDEF(void)
-write_tables_only (j_compress_ptr cinfo)
-{
- int i;
-
- emit_marker(cinfo, M_SOI);
-
- for (i = 0; i < NUM_QUANT_TBLS; i++) {
- if (cinfo->quant_tbl_ptrs[i] != NULL)
- (void) emit_dqt(cinfo, i);
- }
-
- if (! cinfo->arith_code) {
- for (i = 0; i < NUM_HUFF_TBLS; i++) {
- if (cinfo->dc_huff_tbl_ptrs[i] != NULL)
- emit_dht(cinfo, i, FALSE);
- if (cinfo->ac_huff_tbl_ptrs[i] != NULL)
- emit_dht(cinfo, i, TRUE);
- }
- }
-
- emit_marker(cinfo, M_EOI);
-}
-
-
-/*
- * Initialize the marker writer module.
- */
-
-GLOBAL(void)
-jinit_marker_writer (j_compress_ptr cinfo)
-{
- my_marker_ptr marker;
-
- /* Create the subobject */
- marker = (my_marker_ptr)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- SIZEOF(my_marker_writer));
- cinfo->marker = (struct jpeg_marker_writer *) marker;
- /* Initialize method pointers */
- marker->pub.write_file_header = write_file_header;
- marker->pub.write_frame_header = write_frame_header;
- marker->pub.write_scan_header = write_scan_header;
- marker->pub.write_file_trailer = write_file_trailer;
- marker->pub.write_tables_only = write_tables_only;
- marker->pub.write_marker_header = write_marker_header;
- marker->pub.write_marker_byte = write_marker_byte;
- /* Initialize private state */
- marker->last_restart_interval = 0;
-}
diff --git a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jcmaster.c b/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jcmaster.c
deleted file mode 100644
index aab4020b879..00000000000
--- a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jcmaster.c
+++ /dev/null
@@ -1,590 +0,0 @@
-/*
- * jcmaster.c
- *
- * Copyright (C) 1991-1997, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file contains master control logic for the JPEG compressor.
- * These routines are concerned with parameter validation, initial setup,
- * and inter-pass control (determining the number of passes and the work
- * to be done in each pass).
- */
-
-#define JPEG_INTERNALS
-#include "jinclude.h"
-#include "jpeglib.h"
-
-
-/* Private state */
-
-typedef enum {
- main_pass, /* input data, also do first output step */
- huff_opt_pass, /* Huffman code optimization pass */
- output_pass /* data output pass */
-} c_pass_type;
-
-typedef struct {
- struct jpeg_comp_master pub; /* public fields */
-
- c_pass_type pass_type; /* the type of the current pass */
-
- int pass_number; /* # of passes completed */
- int total_passes; /* total # of passes needed */
-
- int scan_number; /* current index in scan_info[] */
-} my_comp_master;
-
-typedef my_comp_master * my_master_ptr;
-
-
-/*
- * Support routines that do various essential calculations.
- */
-
-LOCAL(void)
-initial_setup (j_compress_ptr cinfo)
-/* Do computations that are needed before master selection phase */
-{
- int ci;
- jpeg_component_info *compptr;
- long samplesperrow;
- JDIMENSION jd_samplesperrow;
-
- /* Sanity check on image dimensions */
- if (cinfo->image_height <= 0 || cinfo->image_width <= 0
- || cinfo->num_components <= 0 || cinfo->input_components <= 0)
- ERREXIT(cinfo, JERR_EMPTY_IMAGE);
-
- /* Make sure image isn't bigger than I can handle */
- if ((long) cinfo->image_height > (long) JPEG_MAX_DIMENSION ||
- (long) cinfo->image_width > (long) JPEG_MAX_DIMENSION)
- ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int) JPEG_MAX_DIMENSION);
-
- /* Width of an input scanline must be representable as JDIMENSION. */
- samplesperrow = (long) cinfo->image_width * (long) cinfo->input_components;
- jd_samplesperrow = (JDIMENSION) samplesperrow;
- if ((long) jd_samplesperrow != samplesperrow)
- ERREXIT(cinfo, JERR_WIDTH_OVERFLOW);
-
- /* For now, precision must match compiled-in value... */
- if (cinfo->data_precision != BITS_IN_JSAMPLE)
- ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
-
- /* Check that number of components won't exceed internal array sizes */
- if (cinfo->num_components > MAX_COMPONENTS)
- ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components,
- MAX_COMPONENTS);
-
- /* Compute maximum sampling factors; check factor validity */
- cinfo->max_h_samp_factor = 1;
- cinfo->max_v_samp_factor = 1;
- for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
- ci++, compptr++) {
- if (compptr->h_samp_factor<=0 || compptr->h_samp_factor>MAX_SAMP_FACTOR ||
- compptr->v_samp_factor<=0 || compptr->v_samp_factor>MAX_SAMP_FACTOR)
- ERREXIT(cinfo, JERR_BAD_SAMPLING);
- cinfo->max_h_samp_factor = MAX(cinfo->max_h_samp_factor,
- compptr->h_samp_factor);
- cinfo->max_v_samp_factor = MAX(cinfo->max_v_samp_factor,
- compptr->v_samp_factor);
- }
-
- /* Compute dimensions of components */
- for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
- ci++, compptr++) {
- /* Fill in the correct component_index value; don't rely on application */
- compptr->component_index = ci;
- /* For compression, we never do DCT scaling. */
- compptr->DCT_scaled_size = DCTSIZE;
- /* Size in DCT blocks */
- compptr->width_in_blocks = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_width * (long) compptr->h_samp_factor,
- (long) (cinfo->max_h_samp_factor * DCTSIZE));
- compptr->height_in_blocks = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_height * (long) compptr->v_samp_factor,
- (long) (cinfo->max_v_samp_factor * DCTSIZE));
- /* Size in samples */
- compptr->downsampled_width = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_width * (long) compptr->h_samp_factor,
- (long) cinfo->max_h_samp_factor);
- compptr->downsampled_height = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_height * (long) compptr->v_samp_factor,
- (long) cinfo->max_v_samp_factor);
- /* Mark component needed (this flag isn't actually used for compression) */
- compptr->component_needed = TRUE;
- }
-
- /* Compute number of fully interleaved MCU rows (number of times that
- * main controller will call coefficient controller).
- */
- cinfo->total_iMCU_rows = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_height,
- (long) (cinfo->max_v_samp_factor*DCTSIZE));
-}
-
-
-#ifdef C_MULTISCAN_FILES_SUPPORTED
-
-LOCAL(void)
-validate_script (j_compress_ptr cinfo)
-/* Verify that the scan script in cinfo->scan_info[] is valid; also
- * determine whether it uses progressive JPEG, and set cinfo->progressive_mode.
- */
-{
- const jpeg_scan_info * scanptr;
- int scanno, ncomps, ci, coefi, thisi;
- int Ss, Se, Ah, Al;
- boolean component_sent[MAX_COMPONENTS];
-#ifdef C_PROGRESSIVE_SUPPORTED
- int * last_bitpos_ptr;
- int last_bitpos[MAX_COMPONENTS][DCTSIZE2];
- /* -1 until that coefficient has been seen; then last Al for it */
-#endif
-
- if (cinfo->num_scans <= 0)
- ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, 0);
-
- /* For sequential JPEG, all scans must have Ss=0, Se=DCTSIZE2-1;
- * for progressive JPEG, no scan can have this.
- */
- scanptr = cinfo->scan_info;
- if (scanptr->Ss != 0 || scanptr->Se != DCTSIZE2-1) {
-#ifdef C_PROGRESSIVE_SUPPORTED
- cinfo->progressive_mode = TRUE;
- last_bitpos_ptr = & last_bitpos[0][0];
- for (ci = 0; ci < cinfo->num_components; ci++)
- for (coefi = 0; coefi < DCTSIZE2; coefi++)
- *last_bitpos_ptr++ = -1;
-#else
- ERREXIT(cinfo, JERR_NOT_COMPILED);
-#endif
- } else {
- cinfo->progressive_mode = FALSE;
- for (ci = 0; ci < cinfo->num_components; ci++)
- component_sent[ci] = FALSE;
- }
-
- for (scanno = 1; scanno <= cinfo->num_scans; scanptr++, scanno++) {
- /* Validate component indexes */
- ncomps = scanptr->comps_in_scan;
- if (ncomps <= 0 || ncomps > MAX_COMPS_IN_SCAN)
- ERREXIT2(cinfo, JERR_COMPONENT_COUNT, ncomps, MAX_COMPS_IN_SCAN);
- for (ci = 0; ci < ncomps; ci++) {
- thisi = scanptr->component_index[ci];
- if (thisi < 0 || thisi >= cinfo->num_components)
- ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, scanno);
- /* Components must appear in SOF order within each scan */
- if (ci > 0 && thisi <= scanptr->component_index[ci-1])
- ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, scanno);
- }
- /* Validate progression parameters */
- Ss = scanptr->Ss;
- Se = scanptr->Se;
- Ah = scanptr->Ah;
- Al = scanptr->Al;
- if (cinfo->progressive_mode) {
-#ifdef C_PROGRESSIVE_SUPPORTED
- /* The JPEG spec simply gives the ranges 0..13 for Ah and Al, but that
- * seems wrong: the upper bound ought to depend on data precision.
- * Perhaps they really meant 0..N+1 for N-bit precision.
- * Here we allow 0..10 for 8-bit data; Al larger than 10 results in
- * out-of-range reconstructed DC values during the first DC scan,
- * which might cause problems for some decoders.
- */
-#if BITS_IN_JSAMPLE == 8
-#define MAX_AH_AL 10
-#else
-#define MAX_AH_AL 13
-#endif
- if (Ss < 0 || Ss >= DCTSIZE2 || Se < Ss || Se >= DCTSIZE2 ||
- Ah < 0 || Ah > MAX_AH_AL || Al < 0 || Al > MAX_AH_AL)
- ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
- if (Ss == 0) {
- if (Se != 0) /* DC and AC together not OK */
- ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
- } else {
- if (ncomps != 1) /* AC scans must be for only one component */
- ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
- }
- for (ci = 0; ci < ncomps; ci++) {
- last_bitpos_ptr = & last_bitpos[scanptr->component_index[ci]][0];
- if (Ss != 0 && last_bitpos_ptr[0] < 0) /* AC without prior DC scan */
- ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
- for (coefi = Ss; coefi <= Se; coefi++) {
- if (last_bitpos_ptr[coefi] < 0) {
- /* first scan of this coefficient */
- if (Ah != 0)
- ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
- } else {
- /* not first scan */
- if (Ah != last_bitpos_ptr[coefi] || Al != Ah-1)
- ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
- }
- last_bitpos_ptr[coefi] = Al;
- }
- }
-#endif
- } else {
- /* For sequential JPEG, all progression parameters must be these: */
- if (Ss != 0 || Se != DCTSIZE2-1 || Ah != 0 || Al != 0)
- ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
- /* Make sure components are not sent twice */
- for (ci = 0; ci < ncomps; ci++) {
- thisi = scanptr->component_index[ci];
- if (component_sent[thisi])
- ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, scanno);
- component_sent[thisi] = TRUE;
- }
- }
- }
-
- /* Now verify that everything got sent. */
- if (cinfo->progressive_mode) {
-#ifdef C_PROGRESSIVE_SUPPORTED
- /* For progressive mode, we only check that at least some DC data
- * got sent for each component; the spec does not require that all bits
- * of all coefficients be transmitted. Would it be wiser to enforce
- * transmission of all coefficient bits??
- */
- for (ci = 0; ci < cinfo->num_components; ci++) {
- if (last_bitpos[ci][0] < 0)
- ERREXIT(cinfo, JERR_MISSING_DATA);
- }
-#endif
- } else {
- for (ci = 0; ci < cinfo->num_components; ci++) {
- if (! component_sent[ci])
- ERREXIT(cinfo, JERR_MISSING_DATA);
- }
- }
-}
-
-#endif /* C_MULTISCAN_FILES_SUPPORTED */
-
-
-LOCAL(void)
-select_scan_parameters (j_compress_ptr cinfo)
-/* Set up the scan parameters for the current scan */
-{
- int ci;
-
-#ifdef C_MULTISCAN_FILES_SUPPORTED
- if (cinfo->scan_info != NULL) {
- /* Prepare for current scan --- the script is already validated */
- my_master_ptr master = (my_master_ptr) cinfo->master;
- const jpeg_scan_info * scanptr = cinfo->scan_info + master->scan_number;
-
- cinfo->comps_in_scan = scanptr->comps_in_scan;
- for (ci = 0; ci < scanptr->comps_in_scan; ci++) {
- cinfo->cur_comp_info[ci] =
- &cinfo->comp_info[scanptr->component_index[ci]];
- }
- cinfo->Ss = scanptr->Ss;
- cinfo->Se = scanptr->Se;
- cinfo->Ah = scanptr->Ah;
- cinfo->Al = scanptr->Al;
- }
- else
-#endif
- {
- /* Prepare for single sequential-JPEG scan containing all components */
- if (cinfo->num_components > MAX_COMPS_IN_SCAN)
- ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components,
- MAX_COMPS_IN_SCAN);
- cinfo->comps_in_scan = cinfo->num_components;
- for (ci = 0; ci < cinfo->num_components; ci++) {
- cinfo->cur_comp_info[ci] = &cinfo->comp_info[ci];
- }
- cinfo->Ss = 0;
- cinfo->Se = DCTSIZE2-1;
- cinfo->Ah = 0;
- cinfo->Al = 0;
- }
-}
-
-
-LOCAL(void)
-per_scan_setup (j_compress_ptr cinfo)
-/* Do computations that are needed before processing a JPEG scan */
-/* cinfo->comps_in_scan and cinfo->cur_comp_info[] are already set */
-{
- int ci, mcublks, tmp;
- jpeg_component_info *compptr;
-
- if (cinfo->comps_in_scan == 1) {
-
- /* Noninterleaved (single-component) scan */
- compptr = cinfo->cur_comp_info[0];
-
- /* Overall image size in MCUs */
- cinfo->MCUs_per_row = compptr->width_in_blocks;
- cinfo->MCU_rows_in_scan = compptr->height_in_blocks;
-
- /* For noninterleaved scan, always one block per MCU */
- compptr->MCU_width = 1;
- compptr->MCU_height = 1;
- compptr->MCU_blocks = 1;
- compptr->MCU_sample_width = DCTSIZE;
- compptr->last_col_width = 1;
- /* For noninterleaved scans, it is convenient to define last_row_height
- * as the number of block rows present in the last iMCU row.
- */
- tmp = (int) (compptr->height_in_blocks % compptr->v_samp_factor);
- if (tmp == 0) tmp = compptr->v_samp_factor;
- compptr->last_row_height = tmp;
-
- /* Prepare array describing MCU composition */
- cinfo->blocks_in_MCU = 1;
- cinfo->MCU_membership[0] = 0;
-
- } else {
-
- /* Interleaved (multi-component) scan */
- if (cinfo->comps_in_scan <= 0 || cinfo->comps_in_scan > MAX_COMPS_IN_SCAN)
- ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->comps_in_scan,
- MAX_COMPS_IN_SCAN);
-
- /* Overall image size in MCUs */
- cinfo->MCUs_per_row = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_width,
- (long) (cinfo->max_h_samp_factor*DCTSIZE));
- cinfo->MCU_rows_in_scan = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_height,
- (long) (cinfo->max_v_samp_factor*DCTSIZE));
-
- cinfo->blocks_in_MCU = 0;
-
- for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
- compptr = cinfo->cur_comp_info[ci];
- /* Sampling factors give # of blocks of component in each MCU */
- compptr->MCU_width = compptr->h_samp_factor;
- compptr->MCU_height = compptr->v_samp_factor;
- compptr->MCU_blocks = compptr->MCU_width * compptr->MCU_height;
- compptr->MCU_sample_width = compptr->MCU_width * DCTSIZE;
- /* Figure number of non-dummy blocks in last MCU column & row */
- tmp = (int) (compptr->width_in_blocks % compptr->MCU_width);
- if (tmp == 0) tmp = compptr->MCU_width;
- compptr->last_col_width = tmp;
- tmp = (int) (compptr->height_in_blocks % compptr->MCU_height);
- if (tmp == 0) tmp = compptr->MCU_height;
- compptr->last_row_height = tmp;
- /* Prepare array describing MCU composition */
- mcublks = compptr->MCU_blocks;
- if (cinfo->blocks_in_MCU + mcublks > C_MAX_BLOCKS_IN_MCU)
- ERREXIT(cinfo, JERR_BAD_MCU_SIZE);
- while (mcublks-- > 0) {
- cinfo->MCU_membership[cinfo->blocks_in_MCU++] = ci;
- }
- }
-
- }
-
- /* Convert restart specified in rows to actual MCU count. */
- /* Note that count must fit in 16 bits, so we provide limiting. */
- if (cinfo->restart_in_rows > 0) {
- long nominal = (long) cinfo->restart_in_rows * (long) cinfo->MCUs_per_row;
- cinfo->restart_interval = (unsigned int) MIN(nominal, 65535L);
- }
-}
-
-
-/*
- * Per-pass setup.
- * This is called at the beginning of each pass. We determine which modules
- * will be active during this pass and give them appropriate start_pass calls.
- * We also set is_last_pass to indicate whether any more passes will be
- * required.
- */
-
-METHODDEF(void)
-prepare_for_pass (j_compress_ptr cinfo)
-{
- my_master_ptr master = (my_master_ptr) cinfo->master;
-
- switch (master->pass_type) {
- case main_pass:
- /* Initial pass: will collect input data, and do either Huffman
- * optimization or data output for the first scan.
- */
- select_scan_parameters(cinfo);
- per_scan_setup(cinfo);
- if (! cinfo->raw_data_in) {
- (*cinfo->cconvert->start_pass) (cinfo);
- (*cinfo->downsample->start_pass) (cinfo);
- (*cinfo->prep->start_pass) (cinfo, JBUF_PASS_THRU);
- }
- (*cinfo->fdct->start_pass) (cinfo);
- (*cinfo->entropy->start_pass) (cinfo, cinfo->optimize_coding);
- (*cinfo->coef->start_pass) (cinfo,
- (master->total_passes > 1 ?
- JBUF_SAVE_AND_PASS : JBUF_PASS_THRU));
- (*cinfo->main->start_pass) (cinfo, JBUF_PASS_THRU);
- if (cinfo->optimize_coding) {
- /* No immediate data output; postpone writing frame/scan headers */
- master->pub.call_pass_startup = FALSE;
- } else {
- /* Will write frame/scan headers at first jpeg_write_scanlines call */
- master->pub.call_pass_startup = TRUE;
- }
- break;
-#ifdef ENTROPY_OPT_SUPPORTED
- case huff_opt_pass:
- /* Do Huffman optimization for a scan after the first one. */
- select_scan_parameters(cinfo);
- per_scan_setup(cinfo);
- if (cinfo->Ss != 0 || cinfo->Ah == 0 || cinfo->arith_code) {
- (*cinfo->entropy->start_pass) (cinfo, TRUE);
- (*cinfo->coef->start_pass) (cinfo, JBUF_CRANK_DEST);
- master->pub.call_pass_startup = FALSE;
- break;
- }
- /* Special case: Huffman DC refinement scans need no Huffman table
- * and therefore we can skip the optimization pass for them.
- */
- master->pass_type = output_pass;
- master->pass_number++;
- /*FALLTHROUGH*/
-#endif
- case output_pass:
- /* Do a data-output pass. */
- /* We need not repeat per-scan setup if prior optimization pass did it. */
- if (! cinfo->optimize_coding) {
- select_scan_parameters(cinfo);
- per_scan_setup(cinfo);
- }
- (*cinfo->entropy->start_pass) (cinfo, FALSE);
- (*cinfo->coef->start_pass) (cinfo, JBUF_CRANK_DEST);
- /* We emit frame/scan headers now */
- if (master->scan_number == 0)
- (*cinfo->marker->write_frame_header) (cinfo);
- (*cinfo->marker->write_scan_header) (cinfo);
- master->pub.call_pass_startup = FALSE;
- break;
- default:
- ERREXIT(cinfo, JERR_NOT_COMPILED);
- }
-
- master->pub.is_last_pass = (master->pass_number == master->total_passes-1);
-
- /* Set up progress monitor's pass info if present */
- if (cinfo->progress != NULL) {
- cinfo->progress->completed_passes = master->pass_number;
- cinfo->progress->total_passes = master->total_passes;
- }
-}
-
-
-/*
- * Special start-of-pass hook.
- * This is called by jpeg_write_scanlines if call_pass_startup is TRUE.
- * In single-pass processing, we need this hook because we don't want to
- * write frame/scan headers during jpeg_start_compress; we want to let the
- * application write COM markers etc. between jpeg_start_compress and the
- * jpeg_write_scanlines loop.
- * In multi-pass processing, this routine is not used.
- */
-
-METHODDEF(void)
-pass_startup (j_compress_ptr cinfo)
-{
- cinfo->master->call_pass_startup = FALSE; /* reset flag so call only once */
-
- (*cinfo->marker->write_frame_header) (cinfo);
- (*cinfo->marker->write_scan_header) (cinfo);
-}
-
-
-/*
- * Finish up at end of pass.
- */
-
-METHODDEF(void)
-finish_pass_master (j_compress_ptr cinfo)
-{
- my_master_ptr master = (my_master_ptr) cinfo->master;
-
- /* The entropy coder always needs an end-of-pass call,
- * either to analyze statistics or to flush its output buffer.
- */
- (*cinfo->entropy->finish_pass) (cinfo);
-
- /* Update state for next pass */
- switch (master->pass_type) {
- case main_pass:
- /* next pass is either output of scan 0 (after optimization)
- * or output of scan 1 (if no optimization).
- */
- master->pass_type = output_pass;
- if (! cinfo->optimize_coding)
- master->scan_number++;
- break;
- case huff_opt_pass:
- /* next pass is always output of current scan */
- master->pass_type = output_pass;
- break;
- case output_pass:
- /* next pass is either optimization or output of next scan */
- if (cinfo->optimize_coding)
- master->pass_type = huff_opt_pass;
- master->scan_number++;
- break;
- }
-
- master->pass_number++;
-}
-
-
-/*
- * Initialize master compression control.
- */
-
-GLOBAL(void)
-jinit_c_master_control (j_compress_ptr cinfo, boolean transcode_only)
-{
- my_master_ptr master;
-
- master = (my_master_ptr)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- SIZEOF(my_comp_master));
- cinfo->master = (struct jpeg_comp_master *) master;
- master->pub.prepare_for_pass = prepare_for_pass;
- master->pub.pass_startup = pass_startup;
- master->pub.finish_pass = finish_pass_master;
- master->pub.is_last_pass = FALSE;
-
- /* Validate parameters, determine derived values */
- initial_setup(cinfo);
-
- if (cinfo->scan_info != NULL) {
-#ifdef C_MULTISCAN_FILES_SUPPORTED
- validate_script(cinfo);
-#else
- ERREXIT(cinfo, JERR_NOT_COMPILED);
-#endif
- } else {
- cinfo->progressive_mode = FALSE;
- cinfo->num_scans = 1;
- }
-
- if (cinfo->progressive_mode) /* TEMPORARY HACK ??? */
- cinfo->optimize_coding = TRUE; /* assume default tables no good for progressive mode */
-
- /* Initialize my private state */
- if (transcode_only) {
- /* no main pass in transcoding */
- if (cinfo->optimize_coding)
- master->pass_type = huff_opt_pass;
- else
- master->pass_type = output_pass;
- } else {
- /* for normal compression, first pass is always this type: */
- master->pass_type = main_pass;
- }
- master->scan_number = 0;
- master->pass_number = 0;
- if (cinfo->optimize_coding)
- master->total_passes = cinfo->num_scans * 2;
- else
- master->total_passes = cinfo->num_scans;
-}
diff --git a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jcomapi.c b/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jcomapi.c
deleted file mode 100644
index 9b1fa7568a6..00000000000
--- a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jcomapi.c
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * jcomapi.c
- *
- * Copyright (C) 1994-1997, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file contains application interface routines that are used for both
- * compression and decompression.
- */
-
-#define JPEG_INTERNALS
-#include "jinclude.h"
-#include "jpeglib.h"
-
-
-/*
- * Abort processing of a JPEG compression or decompression operation,
- * but don't destroy the object itself.
- *
- * For this, we merely clean up all the nonpermanent memory pools.
- * Note that temp files (virtual arrays) are not allowed to belong to
- * the permanent pool, so we will be able to close all temp files here.
- * Closing a data source or destination, if necessary, is the application's
- * responsibility.
- */
-
-GLOBAL(void)
-jpeg_abort (j_common_ptr cinfo)
-{
- int pool;
-
- /* Do nothing if called on a not-initialized or destroyed JPEG object. */
- if (cinfo->mem == NULL)
- return;
-
- /* Releasing pools in reverse order might help avoid fragmentation
- * with some (brain-damaged) malloc libraries.
- */
- for (pool = JPOOL_NUMPOOLS-1; pool > JPOOL_PERMANENT; pool--) {
- (*cinfo->mem->free_pool) (cinfo, pool);
- }
-
- /* Reset overall state for possible reuse of object */
- if (cinfo->is_decompressor) {
- cinfo->global_state = DSTATE_START;
- /* Try to keep application from accessing now-deleted marker list.
- * A bit kludgy to do it here, but this is the most central place.
- */
- ((j_decompress_ptr) cinfo)->marker_list = NULL;
- } else {
- cinfo->global_state = CSTATE_START;
- }
-}
-
-
-/*
- * Destruction of a JPEG object.
- *
- * Everything gets deallocated except the master jpeg_compress_struct itself
- * and the error manager struct. Both of these are supplied by the application
- * and must be freed, if necessary, by the application. (Often they are on
- * the stack and so don't need to be freed anyway.)
- * Closing a data source or destination, if necessary, is the application's
- * responsibility.
- */
-
-GLOBAL(void)
-jpeg_destroy (j_common_ptr cinfo)
-{
- /* We need only tell the memory manager to release everything. */
- /* NB: mem pointer is NULL if memory mgr failed to initialize. */
- if (cinfo->mem != NULL)
- (*cinfo->mem->self_destruct) (cinfo);
- cinfo->mem = NULL; /* be safe if jpeg_destroy is called twice */
- cinfo->global_state = 0; /* mark it destroyed */
-}
-
-
-/*
- * Convenience routines for allocating quantization and Huffman tables.
- * (Would jutils.c be a more reasonable place to put these?)
- */
-
-GLOBAL(JQUANT_TBL *)
-jpeg_alloc_quant_table (j_common_ptr cinfo)
-{
- JQUANT_TBL *tbl;
-
- tbl = (JQUANT_TBL *)
- (*cinfo->mem->alloc_small) (cinfo, JPOOL_PERMANENT, SIZEOF(JQUANT_TBL));
- tbl->sent_table = FALSE; /* make sure this is false in any new table */
- return tbl;
-}
-
-
-GLOBAL(JHUFF_TBL *)
-jpeg_alloc_huff_table (j_common_ptr cinfo)
-{
- JHUFF_TBL *tbl;
-
- tbl = (JHUFF_TBL *)
- (*cinfo->mem->alloc_small) (cinfo, JPOOL_PERMANENT, SIZEOF(JHUFF_TBL));
- tbl->sent_table = FALSE; /* make sure this is false in any new table */
- return tbl;
-}
diff --git a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jcparam.c b/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jcparam.c
deleted file mode 100644
index 6fc48f53653..00000000000
--- a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jcparam.c
+++ /dev/null
@@ -1,610 +0,0 @@
-/*
- * jcparam.c
- *
- * Copyright (C) 1991-1998, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file contains optional default-setting code for the JPEG compressor.
- * Applications do not have to use this file, but those that don't use it
- * must know a lot more about the innards of the JPEG code.
- */
-
-#define JPEG_INTERNALS
-#include "jinclude.h"
-#include "jpeglib.h"
-
-
-/*
- * Quantization table setup routines
- */
-
-GLOBAL(void)
-jpeg_add_quant_table (j_compress_ptr cinfo, int which_tbl,
- const unsigned int *basic_table,
- int scale_factor, boolean force_baseline)
-/* Define a quantization table equal to the basic_table times
- * a scale factor (given as a percentage).
- * If force_baseline is TRUE, the computed quantization table entries
- * are limited to 1..255 for JPEG baseline compatibility.
- */
-{
- JQUANT_TBL ** qtblptr;
- int i;
- long temp;
-
- /* Safety check to ensure start_compress not called yet. */
- if (cinfo->global_state != CSTATE_START)
- ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
-
- if (which_tbl < 0 || which_tbl >= NUM_QUANT_TBLS)
- ERREXIT1(cinfo, JERR_DQT_INDEX, which_tbl);
-
- qtblptr = & cinfo->quant_tbl_ptrs[which_tbl];
-
- if (*qtblptr == NULL)
- *qtblptr = jpeg_alloc_quant_table((j_common_ptr) cinfo);
-
- for (i = 0; i < DCTSIZE2; i++) {
- temp = ((long) basic_table[i] * scale_factor + 50L) / 100L;
- /* limit the values to the valid range */
- if (temp <= 0L) temp = 1L;
- if (temp > 32767L) temp = 32767L; /* max quantizer needed for 12 bits */
- if (force_baseline && temp > 255L)
- temp = 255L; /* limit to baseline range if requested */
- (*qtblptr)->quantval[i] = (UINT16) temp;
- }
-
- /* Initialize sent_table FALSE so table will be written to JPEG file. */
- (*qtblptr)->sent_table = FALSE;
-}
-
-
-GLOBAL(void)
-jpeg_set_linear_quality (j_compress_ptr cinfo, int scale_factor,
- boolean force_baseline)
-/* Set or change the 'quality' (quantization) setting, using default tables
- * and a straight percentage-scaling quality scale. In most cases it's better
- * to use jpeg_set_quality (below); this entry point is provided for
- * applications that insist on a linear percentage scaling.
- */
-{
- /* These are the sample quantization tables given in JPEG spec section K.1.
- * The spec says that the values given produce "good" quality, and
- * when divided by 2, "very good" quality.
- */
- static const unsigned int std_luminance_quant_tbl[DCTSIZE2] = {
- 16, 11, 10, 16, 24, 40, 51, 61,
- 12, 12, 14, 19, 26, 58, 60, 55,
- 14, 13, 16, 24, 40, 57, 69, 56,
- 14, 17, 22, 29, 51, 87, 80, 62,
- 18, 22, 37, 56, 68, 109, 103, 77,
- 24, 35, 55, 64, 81, 104, 113, 92,
- 49, 64, 78, 87, 103, 121, 120, 101,
- 72, 92, 95, 98, 112, 100, 103, 99
- };
- static const unsigned int std_chrominance_quant_tbl[DCTSIZE2] = {
- 17, 18, 24, 47, 99, 99, 99, 99,
- 18, 21, 26, 66, 99, 99, 99, 99,
- 24, 26, 56, 99, 99, 99, 99, 99,
- 47, 66, 99, 99, 99, 99, 99, 99,
- 99, 99, 99, 99, 99, 99, 99, 99,
- 99, 99, 99, 99, 99, 99, 99, 99,
- 99, 99, 99, 99, 99, 99, 99, 99,
- 99, 99, 99, 99, 99, 99, 99, 99
- };
-
- /* Set up two quantization tables using the specified scaling */
- jpeg_add_quant_table(cinfo, 0, std_luminance_quant_tbl,
- scale_factor, force_baseline);
- jpeg_add_quant_table(cinfo, 1, std_chrominance_quant_tbl,
- scale_factor, force_baseline);
-}
-
-
-GLOBAL(int)
-jpeg_quality_scaling (int quality)
-/* Convert a user-specified quality rating to a percentage scaling factor
- * for an underlying quantization table, using our recommended scaling curve.
- * The input 'quality' factor should be 0 (terrible) to 100 (very good).
- */
-{
- /* Safety limit on quality factor. Convert 0 to 1 to avoid zero divide. */
- if (quality <= 0) quality = 1;
- if (quality > 100) quality = 100;
-
- /* The basic table is used as-is (scaling 100) for a quality of 50.
- * Qualities 50..100 are converted to scaling percentage 200 - 2*Q;
- * note that at Q=100 the scaling is 0, which will cause jpeg_add_quant_table
- * to make all the table entries 1 (hence, minimum quantization loss).
- * Qualities 1..50 are converted to scaling percentage 5000/Q.
- */
- if (quality < 50)
- quality = 5000 / quality;
- else
- quality = 200 - quality*2;
-
- return quality;
-}
-
-
-GLOBAL(void)
-jpeg_set_quality (j_compress_ptr cinfo, int quality, boolean force_baseline)
-/* Set or change the 'quality' (quantization) setting, using default tables.
- * This is the standard quality-adjusting entry point for typical user
- * interfaces; only those who want detailed control over quantization tables
- * would use the preceding three routines directly.
- */
-{
- /* Convert user 0-100 rating to percentage scaling */
- quality = jpeg_quality_scaling(quality);
-
- /* Set up standard quality tables */
- jpeg_set_linear_quality(cinfo, quality, force_baseline);
-}
-
-
-/*
- * Huffman table setup routines
- */
-
-LOCAL(void)
-add_huff_table (j_compress_ptr cinfo,
- JHUFF_TBL **htblptr, const UINT8 *bits, const UINT8 *val)
-/* Define a Huffman table */
-{
- int nsymbols, len;
-
- if (*htblptr == NULL)
- *htblptr = jpeg_alloc_huff_table((j_common_ptr) cinfo);
-
- /* Copy the number-of-symbols-of-each-code-length counts */
- MEMCOPY((*htblptr)->bits, bits, SIZEOF((*htblptr)->bits));
-
- /* Validate the counts. We do this here mainly so we can copy the right
- * number of symbols from the val[] array, without risking marching off
- * the end of memory. jchuff.c will do a more thorough test later.
- */
- nsymbols = 0;
- for (len = 1; len <= 16; len++)
- nsymbols += bits[len];
- if (nsymbols < 1 || nsymbols > 256)
- ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
-
- MEMCOPY((*htblptr)->huffval, val, nsymbols * SIZEOF(UINT8));
-
- /* Initialize sent_table FALSE so table will be written to JPEG file. */
- (*htblptr)->sent_table = FALSE;
-}
-
-
-LOCAL(void)
-std_huff_tables (j_compress_ptr cinfo)
-/* Set up the standard Huffman tables (cf. JPEG standard section K.3) */
-/* IMPORTANT: these are only valid for 8-bit data precision! */
-{
- static const UINT8 bits_dc_luminance[17] =
- { /* 0-base */ 0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 };
- static const UINT8 val_dc_luminance[] =
- { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 };
-
- static const UINT8 bits_dc_chrominance[17] =
- { /* 0-base */ 0, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 };
- static const UINT8 val_dc_chrominance[] =
- { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 };
-
- static const UINT8 bits_ac_luminance[17] =
- { /* 0-base */ 0, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 0x7d };
- static const UINT8 val_ac_luminance[] =
- { 0x01, 0x02, 0x03, 0x00, 0x04, 0x11, 0x05, 0x12,
- 0x21, 0x31, 0x41, 0x06, 0x13, 0x51, 0x61, 0x07,
- 0x22, 0x71, 0x14, 0x32, 0x81, 0x91, 0xa1, 0x08,
- 0x23, 0x42, 0xb1, 0xc1, 0x15, 0x52, 0xd1, 0xf0,
- 0x24, 0x33, 0x62, 0x72, 0x82, 0x09, 0x0a, 0x16,
- 0x17, 0x18, 0x19, 0x1a, 0x25, 0x26, 0x27, 0x28,
- 0x29, 0x2a, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39,
- 0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49,
- 0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59,
- 0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69,
- 0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79,
- 0x7a, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89,
- 0x8a, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98,
- 0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
- 0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6,
- 0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3, 0xc4, 0xc5,
- 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2, 0xd3, 0xd4,
- 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xe1, 0xe2,
- 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea,
- 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8,
- 0xf9, 0xfa };
-
- static const UINT8 bits_ac_chrominance[17] =
- { /* 0-base */ 0, 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 0x77 };
- static const UINT8 val_ac_chrominance[] =
- { 0x00, 0x01, 0x02, 0x03, 0x11, 0x04, 0x05, 0x21,
- 0x31, 0x06, 0x12, 0x41, 0x51, 0x07, 0x61, 0x71,
- 0x13, 0x22, 0x32, 0x81, 0x08, 0x14, 0x42, 0x91,
- 0xa1, 0xb1, 0xc1, 0x09, 0x23, 0x33, 0x52, 0xf0,
- 0x15, 0x62, 0x72, 0xd1, 0x0a, 0x16, 0x24, 0x34,
- 0xe1, 0x25, 0xf1, 0x17, 0x18, 0x19, 0x1a, 0x26,
- 0x27, 0x28, 0x29, 0x2a, 0x35, 0x36, 0x37, 0x38,
- 0x39, 0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48,
- 0x49, 0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
- 0x59, 0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68,
- 0x69, 0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78,
- 0x79, 0x7a, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
- 0x88, 0x89, 0x8a, 0x92, 0x93, 0x94, 0x95, 0x96,
- 0x97, 0x98, 0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5,
- 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4,
- 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3,
- 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2,
- 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda,
- 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9,
- 0xea, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8,
- 0xf9, 0xfa };
-
- add_huff_table(cinfo, &cinfo->dc_huff_tbl_ptrs[0],
- bits_dc_luminance, val_dc_luminance);
- add_huff_table(cinfo, &cinfo->ac_huff_tbl_ptrs[0],
- bits_ac_luminance, val_ac_luminance);
- add_huff_table(cinfo, &cinfo->dc_huff_tbl_ptrs[1],
- bits_dc_chrominance, val_dc_chrominance);
- add_huff_table(cinfo, &cinfo->ac_huff_tbl_ptrs[1],
- bits_ac_chrominance, val_ac_chrominance);
-}
-
-
-/*
- * Default parameter setup for compression.
- *
- * Applications that don't choose to use this routine must do their
- * own setup of all these parameters. Alternately, you can call this
- * to establish defaults and then alter parameters selectively. This
- * is the recommended approach since, if we add any new parameters,
- * your code will still work (they'll be set to reasonable defaults).
- */
-
-GLOBAL(void)
-jpeg_set_defaults (j_compress_ptr cinfo)
-{
- int i;
-
- /* Safety check to ensure start_compress not called yet. */
- if (cinfo->global_state != CSTATE_START)
- ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
-
- /* Allocate comp_info array large enough for maximum component count.
- * Array is made permanent in case application wants to compress
- * multiple images at same param settings.
- */
- if (cinfo->comp_info == NULL)
- cinfo->comp_info = (jpeg_component_info *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
- MAX_COMPONENTS * SIZEOF(jpeg_component_info));
-
- /* Initialize everything not dependent on the color space */
-
- cinfo->data_precision = BITS_IN_JSAMPLE;
- /* Set up two quantization tables using default quality of 75 */
- jpeg_set_quality(cinfo, 75, TRUE);
- /* Set up two Huffman tables */
- std_huff_tables(cinfo);
-
- /* Initialize default arithmetic coding conditioning */
- for (i = 0; i < NUM_ARITH_TBLS; i++) {
- cinfo->arith_dc_L[i] = 0;
- cinfo->arith_dc_U[i] = 1;
- cinfo->arith_ac_K[i] = 5;
- }
-
- /* Default is no multiple-scan output */
- cinfo->scan_info = NULL;
- cinfo->num_scans = 0;
-
- /* Expect normal source image, not raw downsampled data */
- cinfo->raw_data_in = FALSE;
-
- /* Use Huffman coding, not arithmetic coding, by default */
- cinfo->arith_code = FALSE;
-
- /* By default, don't do extra passes to optimize entropy coding */
- cinfo->optimize_coding = FALSE;
- /* The standard Huffman tables are only valid for 8-bit data precision.
- * If the precision is higher, force optimization on so that usable
- * tables will be computed. This test can be removed if default tables
- * are supplied that are valid for the desired precision.
- */
- if (cinfo->data_precision > 8)
- cinfo->optimize_coding = TRUE;
-
- /* By default, use the simpler non-cosited sampling alignment */
- cinfo->CCIR601_sampling = FALSE;
-
- /* No input smoothing */
- cinfo->smoothing_factor = 0;
-
- /* DCT algorithm preference */
- cinfo->dct_method = JDCT_DEFAULT;
-
- /* No restart markers */
- cinfo->restart_interval = 0;
- cinfo->restart_in_rows = 0;
-
- /* Fill in default JFIF marker parameters. Note that whether the marker
- * will actually be written is determined by jpeg_set_colorspace.
- *
- * By default, the library emits JFIF version code 1.01.
- * An application that wants to emit JFIF 1.02 extension markers should set
- * JFIF_minor_version to 2. We could probably get away with just defaulting
- * to 1.02, but there may still be some decoders in use that will complain
- * about that; saying 1.01 should minimize compatibility problems.
- */
- cinfo->JFIF_major_version = 1; /* Default JFIF version = 1.01 */
- cinfo->JFIF_minor_version = 1;
- cinfo->density_unit = 0; /* Pixel size is unknown by default */
- cinfo->X_density = 1; /* Pixel aspect ratio is square by default */
- cinfo->Y_density = 1;
-
- /* Choose JPEG colorspace based on input space, set defaults accordingly */
-
- jpeg_default_colorspace(cinfo);
-}
-
-
-/*
- * Select an appropriate JPEG colorspace for in_color_space.
- */
-
-GLOBAL(void)
-jpeg_default_colorspace (j_compress_ptr cinfo)
-{
- switch (cinfo->in_color_space) {
- case JCS_GRAYSCALE:
- jpeg_set_colorspace(cinfo, JCS_GRAYSCALE);
- break;
- case JCS_RGB:
- jpeg_set_colorspace(cinfo, JCS_YCbCr);
- break;
- case JCS_YCbCr:
- jpeg_set_colorspace(cinfo, JCS_YCbCr);
- break;
- case JCS_CMYK:
- jpeg_set_colorspace(cinfo, JCS_CMYK); /* By default, no translation */
- break;
- case JCS_YCCK:
- jpeg_set_colorspace(cinfo, JCS_YCCK);
- break;
- case JCS_UNKNOWN:
- jpeg_set_colorspace(cinfo, JCS_UNKNOWN);
- break;
- default:
- ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);
- }
-}
-
-
-/*
- * Set the JPEG colorspace, and choose colorspace-dependent default values.
- */
-
-GLOBAL(void)
-jpeg_set_colorspace (j_compress_ptr cinfo, J_COLOR_SPACE colorspace)
-{
- jpeg_component_info * compptr;
- int ci;
-
-#define SET_COMP(index,id,hsamp,vsamp,quant,dctbl,actbl) \
- (compptr = &cinfo->comp_info[index], \
- compptr->component_id = (id), \
- compptr->h_samp_factor = (hsamp), \
- compptr->v_samp_factor = (vsamp), \
- compptr->quant_tbl_no = (quant), \
- compptr->dc_tbl_no = (dctbl), \
- compptr->ac_tbl_no = (actbl) )
-
- /* Safety check to ensure start_compress not called yet. */
- if (cinfo->global_state != CSTATE_START)
- ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
-
- /* For all colorspaces, we use Q and Huff tables 0 for luminance components,
- * tables 1 for chrominance components.
- */
-
- cinfo->jpeg_color_space = colorspace;
-
- cinfo->write_JFIF_header = FALSE; /* No marker for non-JFIF colorspaces */
- cinfo->write_Adobe_marker = FALSE; /* write no Adobe marker by default */
-
- switch (colorspace) {
- case JCS_GRAYSCALE:
- cinfo->write_JFIF_header = TRUE; /* Write a JFIF marker */
- cinfo->num_components = 1;
- /* JFIF specifies component ID 1 */
- SET_COMP(0, 1, 1,1, 0, 0,0);
- break;
- case JCS_RGB:
- cinfo->write_Adobe_marker = TRUE; /* write Adobe marker to flag RGB */
- cinfo->num_components = 3;
- SET_COMP(0, 0x52 /* 'R' */, 1,1, 0, 0,0);
- SET_COMP(1, 0x47 /* 'G' */, 1,1, 0, 0,0);
- SET_COMP(2, 0x42 /* 'B' */, 1,1, 0, 0,0);
- break;
- case JCS_YCbCr:
- cinfo->write_JFIF_header = TRUE; /* Write a JFIF marker */
- cinfo->num_components = 3;
- /* JFIF specifies component IDs 1,2,3 */
- /* We default to 2x2 subsamples of chrominance */
- SET_COMP(0, 1, 2,2, 0, 0,0);
- SET_COMP(1, 2, 1,1, 1, 1,1);
- SET_COMP(2, 3, 1,1, 1, 1,1);
- break;
- case JCS_CMYK:
- cinfo->write_Adobe_marker = TRUE; /* write Adobe marker to flag CMYK */
- cinfo->num_components = 4;
- SET_COMP(0, 0x43 /* 'C' */, 1,1, 0, 0,0);
- SET_COMP(1, 0x4D /* 'M' */, 1,1, 0, 0,0);
- SET_COMP(2, 0x59 /* 'Y' */, 1,1, 0, 0,0);
- SET_COMP(3, 0x4B /* 'K' */, 1,1, 0, 0,0);
- break;
- case JCS_YCCK:
- cinfo->write_Adobe_marker = TRUE; /* write Adobe marker to flag YCCK */
- cinfo->num_components = 4;
- SET_COMP(0, 1, 2,2, 0, 0,0);
- SET_COMP(1, 2, 1,1, 1, 1,1);
- SET_COMP(2, 3, 1,1, 1, 1,1);
- SET_COMP(3, 4, 2,2, 0, 0,0);
- break;
- case JCS_UNKNOWN:
- cinfo->num_components = cinfo->input_components;
- if (cinfo->num_components < 1 || cinfo->num_components > MAX_COMPONENTS)
- ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components,
- MAX_COMPONENTS);
- for (ci = 0; ci < cinfo->num_components; ci++) {
- SET_COMP(ci, ci, 1,1, 0, 0,0);
- }
- break;
- default:
- ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
- }
-}
-
-
-#ifdef C_PROGRESSIVE_SUPPORTED
-
-LOCAL(jpeg_scan_info *)
-fill_a_scan (jpeg_scan_info * scanptr, int ci,
- int Ss, int Se, int Ah, int Al)
-/* Support routine: generate one scan for specified component */
-{
- scanptr->comps_in_scan = 1;
- scanptr->component_index[0] = ci;
- scanptr->Ss = Ss;
- scanptr->Se = Se;
- scanptr->Ah = Ah;
- scanptr->Al = Al;
- scanptr++;
- return scanptr;
-}
-
-LOCAL(jpeg_scan_info *)
-fill_scans (jpeg_scan_info * scanptr, int ncomps,
- int Ss, int Se, int Ah, int Al)
-/* Support routine: generate one scan for each component */
-{
- int ci;
-
- for (ci = 0; ci < ncomps; ci++) {
- scanptr->comps_in_scan = 1;
- scanptr->component_index[0] = ci;
- scanptr->Ss = Ss;
- scanptr->Se = Se;
- scanptr->Ah = Ah;
- scanptr->Al = Al;
- scanptr++;
- }
- return scanptr;
-}
-
-LOCAL(jpeg_scan_info *)
-fill_dc_scans (jpeg_scan_info * scanptr, int ncomps, int Ah, int Al)
-/* Support routine: generate interleaved DC scan if possible, else N scans */
-{
- int ci;
-
- if (ncomps <= MAX_COMPS_IN_SCAN) {
- /* Single interleaved DC scan */
- scanptr->comps_in_scan = ncomps;
- for (ci = 0; ci < ncomps; ci++)
- scanptr->component_index[ci] = ci;
- scanptr->Ss = scanptr->Se = 0;
- scanptr->Ah = Ah;
- scanptr->Al = Al;
- scanptr++;
- } else {
- /* Noninterleaved DC scan for each component */
- scanptr = fill_scans(scanptr, ncomps, 0, 0, Ah, Al);
- }
- return scanptr;
-}
-
-
-/*
- * Create a recommended progressive-JPEG script.
- * cinfo->num_components and cinfo->jpeg_color_space must be correct.
- */
-
-GLOBAL(void)
-jpeg_simple_progression (j_compress_ptr cinfo)
-{
- int ncomps = cinfo->num_components;
- int nscans;
- jpeg_scan_info * scanptr;
-
- /* Safety check to ensure start_compress not called yet. */
- if (cinfo->global_state != CSTATE_START)
- ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
-
- /* Figure space needed for script. Calculation must match code below! */
- if (ncomps == 3 && cinfo->jpeg_color_space == JCS_YCbCr) {
- /* Custom script for YCbCr color images. */
- nscans = 10;
- } else {
- /* All-purpose script for other color spaces. */
- if (ncomps > MAX_COMPS_IN_SCAN)
- nscans = 6 * ncomps; /* 2 DC + 4 AC scans per component */
- else
- nscans = 2 + 4 * ncomps; /* 2 DC scans; 4 AC scans per component */
- }
-
- /* Allocate space for script.
- * We need to put it in the permanent pool in case the application performs
- * multiple compressions without changing the settings. To avoid a memory
- * leak if jpeg_simple_progression is called repeatedly for the same JPEG
- * object, we try to re-use previously allocated space, and we allocate
- * enough space to handle YCbCr even if initially asked for grayscale.
- */
- if (cinfo->script_space == NULL || cinfo->script_space_size < nscans) {
- cinfo->script_space_size = MAX(nscans, 10);
- cinfo->script_space = (jpeg_scan_info *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
- cinfo->script_space_size * SIZEOF(jpeg_scan_info));
- }
- scanptr = cinfo->script_space;
- cinfo->scan_info = scanptr;
- cinfo->num_scans = nscans;
-
- if (ncomps == 3 && cinfo->jpeg_color_space == JCS_YCbCr) {
- /* Custom script for YCbCr color images. */
- /* Initial DC scan */
- scanptr = fill_dc_scans(scanptr, ncomps, 0, 1);
- /* Initial AC scan: get some luma data out in a hurry */
- scanptr = fill_a_scan(scanptr, 0, 1, 5, 0, 2);
- /* Chroma data is too small to be worth expending many scans on */
- scanptr = fill_a_scan(scanptr, 2, 1, 63, 0, 1);
- scanptr = fill_a_scan(scanptr, 1, 1, 63, 0, 1);
- /* Complete spectral selection for luma AC */
- scanptr = fill_a_scan(scanptr, 0, 6, 63, 0, 2);
- /* Refine next bit of luma AC */
- scanptr = fill_a_scan(scanptr, 0, 1, 63, 2, 1);
- /* Finish DC successive approximation */
- scanptr = fill_dc_scans(scanptr, ncomps, 1, 0);
- /* Finish AC successive approximation */
- scanptr = fill_a_scan(scanptr, 2, 1, 63, 1, 0);
- scanptr = fill_a_scan(scanptr, 1, 1, 63, 1, 0);
- /* Luma bottom bit comes last since it's usually largest scan */
- scanptr = fill_a_scan(scanptr, 0, 1, 63, 1, 0);
- } else {
- /* All-purpose script for other color spaces. */
- /* Successive approximation first pass */
- scanptr = fill_dc_scans(scanptr, ncomps, 0, 1);
- scanptr = fill_scans(scanptr, ncomps, 1, 5, 0, 2);
- scanptr = fill_scans(scanptr, ncomps, 6, 63, 0, 2);
- /* Successive approximation second pass */
- scanptr = fill_scans(scanptr, ncomps, 1, 63, 2, 1);
- /* Successive approximation final pass */
- scanptr = fill_dc_scans(scanptr, ncomps, 1, 0);
- scanptr = fill_scans(scanptr, ncomps, 1, 63, 1, 0);
- }
-}
-
-#endif /* C_PROGRESSIVE_SUPPORTED */
diff --git a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jcphuff.c b/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jcphuff.c
deleted file mode 100644
index 07f9178b01c..00000000000
--- a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jcphuff.c
+++ /dev/null
@@ -1,833 +0,0 @@
-/*
- * jcphuff.c
- *
- * Copyright (C) 1995-1997, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file contains Huffman entropy encoding routines for progressive JPEG.
- *
- * We do not support output suspension in this module, since the library
- * currently does not allow multiple-scan files to be written with output
- * suspension.
- */
-
-#define JPEG_INTERNALS
-#include "jinclude.h"
-#include "jpeglib.h"
-#include "jchuff.h" /* Declarations shared with jchuff.c */
-
-#ifdef C_PROGRESSIVE_SUPPORTED
-
-/* Expanded entropy encoder object for progressive Huffman encoding. */
-
-typedef struct {
- struct jpeg_entropy_encoder pub; /* public fields */
-
- /* Mode flag: TRUE for optimization, FALSE for actual data output */
- boolean gather_statistics;
-
- /* Bit-level coding status.
- * next_output_byte/free_in_buffer are local copies of cinfo->dest fields.
- */
- JOCTET * next_output_byte; /* => next byte to write in buffer */
- size_t free_in_buffer; /* # of byte spaces remaining in buffer */
- INT32 put_buffer; /* current bit-accumulation buffer */
- int put_bits; /* # of bits now in it */
- j_compress_ptr cinfo; /* link to cinfo (needed for dump_buffer) */
-
- /* Coding status for DC components */
- int last_dc_val[MAX_COMPS_IN_SCAN]; /* last DC coef for each component */
-
- /* Coding status for AC components */
- int ac_tbl_no; /* the table number of the single component */
- unsigned int EOBRUN; /* run length of EOBs */
- unsigned int BE; /* # of buffered correction bits before MCU */
- char * bit_buffer; /* buffer for correction bits (1 per char) */
- /* packing correction bits tightly would save some space but cost time... */
-
- unsigned int restarts_to_go; /* MCUs left in this restart interval */
- int next_restart_num; /* next restart number to write (0-7) */
-
- /* Pointers to derived tables (these workspaces have image lifespan).
- * Since any one scan codes only DC or only AC, we only need one set
- * of tables, not one for DC and one for AC.
- */
- c_derived_tbl * derived_tbls[NUM_HUFF_TBLS];
-
- /* Statistics tables for optimization; again, one set is enough */
- long * count_ptrs[NUM_HUFF_TBLS];
-} phuff_entropy_encoder;
-
-typedef phuff_entropy_encoder * phuff_entropy_ptr;
-
-/* MAX_CORR_BITS is the number of bits the AC refinement correction-bit
- * buffer can hold. Larger sizes may slightly improve compression, but
- * 1000 is already well into the realm of overkill.
- * The minimum safe size is 64 bits.
- */
-
-#define MAX_CORR_BITS 1000 /* Max # of correction bits I can buffer */
-
-/* IRIGHT_SHIFT is like RIGHT_SHIFT, but works on int rather than INT32.
- * We assume that int right shift is unsigned if INT32 right shift is,
- * which should be safe.
- */
-
-#ifdef RIGHT_SHIFT_IS_UNSIGNED
-#define ISHIFT_TEMPS int ishift_temp;
-#define IRIGHT_SHIFT(x,shft) \
- ((ishift_temp = (x)) < 0 ? \
- (ishift_temp >> (shft)) | ((~0) << (16-(shft))) : \
- (ishift_temp >> (shft)))
-#else
-#define ISHIFT_TEMPS
-#define IRIGHT_SHIFT(x,shft) ((x) >> (shft))
-#endif
-
-/* Forward declarations */
-METHODDEF(boolean) encode_mcu_DC_first JPP((j_compress_ptr cinfo,
- JBLOCKROW *MCU_data));
-METHODDEF(boolean) encode_mcu_AC_first JPP((j_compress_ptr cinfo,
- JBLOCKROW *MCU_data));
-METHODDEF(boolean) encode_mcu_DC_refine JPP((j_compress_ptr cinfo,
- JBLOCKROW *MCU_data));
-METHODDEF(boolean) encode_mcu_AC_refine JPP((j_compress_ptr cinfo,
- JBLOCKROW *MCU_data));
-METHODDEF(void) finish_pass_phuff JPP((j_compress_ptr cinfo));
-METHODDEF(void) finish_pass_gather_phuff JPP((j_compress_ptr cinfo));
-
-
-/*
- * Initialize for a Huffman-compressed scan using progressive JPEG.
- */
-
-METHODDEF(void)
-start_pass_phuff (j_compress_ptr cinfo, boolean gather_statistics)
-{
- phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
- boolean is_DC_band;
- int ci, tbl;
- jpeg_component_info * compptr;
-
- entropy->cinfo = cinfo;
- entropy->gather_statistics = gather_statistics;
-
- is_DC_band = (cinfo->Ss == 0);
-
- /* We assume jcmaster.c already validated the scan parameters. */
-
- /* Select execution routines */
- if (cinfo->Ah == 0) {
- if (is_DC_band)
- entropy->pub.encode_mcu = encode_mcu_DC_first;
- else
- entropy->pub.encode_mcu = encode_mcu_AC_first;
- } else {
- if (is_DC_band)
- entropy->pub.encode_mcu = encode_mcu_DC_refine;
- else {
- entropy->pub.encode_mcu = encode_mcu_AC_refine;
- /* AC refinement needs a correction bit buffer */
- if (entropy->bit_buffer == NULL)
- entropy->bit_buffer = (char *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- MAX_CORR_BITS * SIZEOF(char));
- }
- }
- if (gather_statistics)
- entropy->pub.finish_pass = finish_pass_gather_phuff;
- else
- entropy->pub.finish_pass = finish_pass_phuff;
-
- /* Only DC coefficients may be interleaved, so cinfo->comps_in_scan = 1
- * for AC coefficients.
- */
- for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
- compptr = cinfo->cur_comp_info[ci];
- /* Initialize DC predictions to 0 */
- entropy->last_dc_val[ci] = 0;
- /* Get table index */
- if (is_DC_band) {
- if (cinfo->Ah != 0) /* DC refinement needs no table */
- continue;
- tbl = compptr->dc_tbl_no;
- } else {
- entropy->ac_tbl_no = tbl = compptr->ac_tbl_no;
- }
- if (gather_statistics) {
- /* Check for invalid table index */
- /* (make_c_derived_tbl does this in the other path) */
- if (tbl < 0 || tbl >= NUM_HUFF_TBLS)
- ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tbl);
- /* Allocate and zero the statistics tables */
- /* Note that jpeg_gen_optimal_table expects 257 entries in each table! */
- if (entropy->count_ptrs[tbl] == NULL)
- entropy->count_ptrs[tbl] = (long *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- 257 * SIZEOF(long));
- MEMZERO(entropy->count_ptrs[tbl], 257 * SIZEOF(long));
- } else {
- /* Compute derived values for Huffman table */
- /* We may do this more than once for a table, but it's not expensive */
- jpeg_make_c_derived_tbl(cinfo, is_DC_band, tbl,
- & entropy->derived_tbls[tbl]);
- }
- }
-
- /* Initialize AC stuff */
- entropy->EOBRUN = 0;
- entropy->BE = 0;
-
- /* Initialize bit buffer to empty */
- entropy->put_buffer = 0;
- entropy->put_bits = 0;
-
- /* Initialize restart stuff */
- entropy->restarts_to_go = cinfo->restart_interval;
- entropy->next_restart_num = 0;
-}
-
-
-/* Outputting bytes to the file.
- * NB: these must be called only when actually outputting,
- * that is, entropy->gather_statistics == FALSE.
- */
-
-/* Emit a byte */
-#define emit_byte(entropy,val) \
- { *(entropy)->next_output_byte++ = (JOCTET) (val); \
- if (--(entropy)->free_in_buffer == 0) \
- dump_buffer(entropy); }
-
-
-LOCAL(void)
-dump_buffer (phuff_entropy_ptr entropy)
-/* Empty the output buffer; we do not support suspension in this module. */
-{
- struct jpeg_destination_mgr * dest = entropy->cinfo->dest;
-
- if (! (*dest->empty_output_buffer) (entropy->cinfo))
- ERREXIT(entropy->cinfo, JERR_CANT_SUSPEND);
- /* After a successful buffer dump, must reset buffer pointers */
- entropy->next_output_byte = dest->next_output_byte;
- entropy->free_in_buffer = dest->free_in_buffer;
-}
-
-
-/* Outputting bits to the file */
-
-/* Only the right 24 bits of put_buffer are used; the valid bits are
- * left-justified in this part. At most 16 bits can be passed to emit_bits
- * in one call, and we never retain more than 7 bits in put_buffer
- * between calls, so 24 bits are sufficient.
- */
-
-INLINE
-LOCAL(void)
-emit_bits (phuff_entropy_ptr entropy, unsigned int code, int size)
-/* Emit some bits, unless we are in gather mode */
-{
- /* This routine is heavily used, so it's worth coding tightly. */
- register INT32 put_buffer = (INT32) code;
- register int put_bits = entropy->put_bits;
-
- /* if size is 0, caller used an invalid Huffman table entry */
- if (size == 0)
- ERREXIT(entropy->cinfo, JERR_HUFF_MISSING_CODE);
-
- if (entropy->gather_statistics)
- return; /* do nothing if we're only getting stats */
-
- put_buffer &= (((INT32) 1)<<size) - 1; /* mask off any extra bits in code */
-
- put_bits += size; /* new number of bits in buffer */
-
- put_buffer <<= 24 - put_bits; /* align incoming bits */
-
- put_buffer |= entropy->put_buffer; /* and merge with old buffer contents */
-
- while (put_bits >= 8) {
- int c = (int) ((put_buffer >> 16) & 0xFF);
-
- emit_byte(entropy, c);
- if (c == 0xFF) { /* need to stuff a zero byte? */
- emit_byte(entropy, 0);
- }
- put_buffer <<= 8;
- put_bits -= 8;
- }
-
- entropy->put_buffer = put_buffer; /* update variables */
- entropy->put_bits = put_bits;
-}
-
-
-LOCAL(void)
-flush_bits (phuff_entropy_ptr entropy)
-{
- emit_bits(entropy, 0x7F, 7); /* fill any partial byte with ones */
- entropy->put_buffer = 0; /* and reset bit-buffer to empty */
- entropy->put_bits = 0;
-}
-
-
-/*
- * Emit (or just count) a Huffman symbol.
- */
-
-INLINE
-LOCAL(void)
-emit_symbol (phuff_entropy_ptr entropy, int tbl_no, int symbol)
-{
- if (entropy->gather_statistics)
- entropy->count_ptrs[tbl_no][symbol]++;
- else {
- c_derived_tbl * tbl = entropy->derived_tbls[tbl_no];
- emit_bits(entropy, tbl->ehufco[symbol], tbl->ehufsi[symbol]);
- }
-}
-
-
-/*
- * Emit bits from a correction bit buffer.
- */
-
-LOCAL(void)
-emit_buffered_bits (phuff_entropy_ptr entropy, char * bufstart,
- unsigned int nbits)
-{
- if (entropy->gather_statistics)
- return; /* no real work */
-
- while (nbits > 0) {
- emit_bits(entropy, (unsigned int) (*bufstart), 1);
- bufstart++;
- nbits--;
- }
-}
-
-
-/*
- * Emit any pending EOBRUN symbol.
- */
-
-LOCAL(void)
-emit_eobrun (phuff_entropy_ptr entropy)
-{
- register int temp, nbits;
-
- if (entropy->EOBRUN > 0) { /* if there is any pending EOBRUN */
- temp = entropy->EOBRUN;
- nbits = 0;
- while ((temp >>= 1))
- nbits++;
- /* safety check: shouldn't happen given limited correction-bit buffer */
- if (nbits > 14)
- ERREXIT(entropy->cinfo, JERR_HUFF_MISSING_CODE);
-
- emit_symbol(entropy, entropy->ac_tbl_no, nbits << 4);
- if (nbits)
- emit_bits(entropy, entropy->EOBRUN, nbits);
-
- entropy->EOBRUN = 0;
-
- /* Emit any buffered correction bits */
- emit_buffered_bits(entropy, entropy->bit_buffer, entropy->BE);
- entropy->BE = 0;
- }
-}
-
-
-/*
- * Emit a restart marker & resynchronize predictions.
- */
-
-LOCAL(void)
-emit_restart (phuff_entropy_ptr entropy, int restart_num)
-{
- int ci;
-
- emit_eobrun(entropy);
-
- if (! entropy->gather_statistics) {
- flush_bits(entropy);
- emit_byte(entropy, 0xFF);
- emit_byte(entropy, JPEG_RST0 + restart_num);
- }
-
- if (entropy->cinfo->Ss == 0) {
- /* Re-initialize DC predictions to 0 */
- for (ci = 0; ci < entropy->cinfo->comps_in_scan; ci++)
- entropy->last_dc_val[ci] = 0;
- } else {
- /* Re-initialize all AC-related fields to 0 */
- entropy->EOBRUN = 0;
- entropy->BE = 0;
- }
-}
-
-
-/*
- * MCU encoding for DC initial scan (either spectral selection,
- * or first pass of successive approximation).
- */
-
-METHODDEF(boolean)
-encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
-{
- phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
- register int temp, temp2;
- register int nbits;
- int blkn, ci;
- int Al = cinfo->Al;
- JBLOCKROW block;
- jpeg_component_info * compptr;
- ISHIFT_TEMPS
-
- entropy->next_output_byte = cinfo->dest->next_output_byte;
- entropy->free_in_buffer = cinfo->dest->free_in_buffer;
-
- /* Emit restart marker if needed */
- if (cinfo->restart_interval)
- if (entropy->restarts_to_go == 0)
- emit_restart(entropy, entropy->next_restart_num);
-
- /* Encode the MCU data blocks */
- for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
- block = MCU_data[blkn];
- ci = cinfo->MCU_membership[blkn];
- compptr = cinfo->cur_comp_info[ci];
-
- /* Compute the DC value after the required point transform by Al.
- * This is simply an arithmetic right shift.
- */
- temp2 = IRIGHT_SHIFT((int) ((*block)[0]), Al);
-
- /* DC differences are figured on the point-transformed values. */
- temp = temp2 - entropy->last_dc_val[ci];
- entropy->last_dc_val[ci] = temp2;
-
- /* Encode the DC coefficient difference per section G.1.2.1 */
- temp2 = temp;
- if (temp < 0) {
- temp = -temp; /* temp is abs value of input */
- /* For a negative input, want temp2 = bitwise complement of abs(input) */
- /* This code assumes we are on a two's complement machine */
- temp2--;
- }
-
- /* Find the number of bits needed for the magnitude of the coefficient */
- nbits = 0;
- while (temp) {
- nbits++;
- temp >>= 1;
- }
- /* Check for out-of-range coefficient values.
- * Since we're encoding a difference, the range limit is twice as much.
- */
- if (nbits > MAX_COEF_BITS+1)
- ERREXIT(cinfo, JERR_BAD_DCT_COEF);
-
- /* Count/emit the Huffman-coded symbol for the number of bits */
- emit_symbol(entropy, compptr->dc_tbl_no, nbits);
-
- /* Emit that number of bits of the value, if positive, */
- /* or the complement of its magnitude, if negative. */
- if (nbits) /* emit_bits rejects calls with size 0 */
- emit_bits(entropy, (unsigned int) temp2, nbits);
- }
-
- cinfo->dest->next_output_byte = entropy->next_output_byte;
- cinfo->dest->free_in_buffer = entropy->free_in_buffer;
-
- /* Update restart-interval state too */
- if (cinfo->restart_interval) {
- if (entropy->restarts_to_go == 0) {
- entropy->restarts_to_go = cinfo->restart_interval;
- entropy->next_restart_num++;
- entropy->next_restart_num &= 7;
- }
- entropy->restarts_to_go--;
- }
-
- return TRUE;
-}
-
-
-/*
- * MCU encoding for AC initial scan (either spectral selection,
- * or first pass of successive approximation).
- */
-
-METHODDEF(boolean)
-encode_mcu_AC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
-{
- phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
- register int temp, temp2;
- register int nbits;
- register int r, k;
- int Se = cinfo->Se;
- int Al = cinfo->Al;
- JBLOCKROW block;
-
- entropy->next_output_byte = cinfo->dest->next_output_byte;
- entropy->free_in_buffer = cinfo->dest->free_in_buffer;
-
- /* Emit restart marker if needed */
- if (cinfo->restart_interval)
- if (entropy->restarts_to_go == 0)
- emit_restart(entropy, entropy->next_restart_num);
-
- /* Encode the MCU data block */
- block = MCU_data[0];
-
- /* Encode the AC coefficients per section G.1.2.2, fig. G.3 */
-
- r = 0; /* r = run length of zeros */
-
- for (k = cinfo->Ss; k <= Se; k++) {
- if ((temp = (*block)[jpeg_natural_order[k]]) == 0) {
- r++;
- continue;
- }
- /* We must apply the point transform by Al. For AC coefficients this
- * is an integer division with rounding towards 0. To do this portably
- * in C, we shift after obtaining the absolute value; so the code is
- * interwoven with finding the abs value (temp) and output bits (temp2).
- */
- if (temp < 0) {
- temp = -temp; /* temp is abs value of input */
- temp >>= Al; /* apply the point transform */
- /* For a negative coef, want temp2 = bitwise complement of abs(coef) */
- temp2 = ~temp;
- } else {
- temp >>= Al; /* apply the point transform */
- temp2 = temp;
- }
- /* Watch out for case that nonzero coef is zero after point transform */
- if (temp == 0) {
- r++;
- continue;
- }
-
- /* Emit any pending EOBRUN */
- if (entropy->EOBRUN > 0)
- emit_eobrun(entropy);
- /* if run length > 15, must emit special run-length-16 codes (0xF0) */
- while (r > 15) {
- emit_symbol(entropy, entropy->ac_tbl_no, 0xF0);
- r -= 16;
- }
-
- /* Find the number of bits needed for the magnitude of the coefficient */
- nbits = 1; /* there must be at least one 1 bit */
- while ((temp >>= 1))
- nbits++;
- /* Check for out-of-range coefficient values */
- if (nbits > MAX_COEF_BITS)
- ERREXIT(cinfo, JERR_BAD_DCT_COEF);
-
- /* Count/emit Huffman symbol for run length / number of bits */
- emit_symbol(entropy, entropy->ac_tbl_no, (r << 4) + nbits);
-
- /* Emit that number of bits of the value, if positive, */
- /* or the complement of its magnitude, if negative. */
- emit_bits(entropy, (unsigned int) temp2, nbits);
-
- r = 0; /* reset zero run length */
- }
-
- if (r > 0) { /* If there are trailing zeroes, */
- entropy->EOBRUN++; /* count an EOB */
- if (entropy->EOBRUN == 0x7FFF)
- emit_eobrun(entropy); /* force it out to avoid overflow */
- }
-
- cinfo->dest->next_output_byte = entropy->next_output_byte;
- cinfo->dest->free_in_buffer = entropy->free_in_buffer;
-
- /* Update restart-interval state too */
- if (cinfo->restart_interval) {
- if (entropy->restarts_to_go == 0) {
- entropy->restarts_to_go = cinfo->restart_interval;
- entropy->next_restart_num++;
- entropy->next_restart_num &= 7;
- }
- entropy->restarts_to_go--;
- }
-
- return TRUE;
-}
-
-
-/*
- * MCU encoding for DC successive approximation refinement scan.
- * Note: we assume such scans can be multi-component, although the spec
- * is not very clear on the point.
- */
-
-METHODDEF(boolean)
-encode_mcu_DC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
-{
- phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
- register int temp;
- int blkn;
- int Al = cinfo->Al;
- JBLOCKROW block;
-
- entropy->next_output_byte = cinfo->dest->next_output_byte;
- entropy->free_in_buffer = cinfo->dest->free_in_buffer;
-
- /* Emit restart marker if needed */
- if (cinfo->restart_interval)
- if (entropy->restarts_to_go == 0)
- emit_restart(entropy, entropy->next_restart_num);
-
- /* Encode the MCU data blocks */
- for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
- block = MCU_data[blkn];
-
- /* We simply emit the Al'th bit of the DC coefficient value. */
- temp = (*block)[0];
- emit_bits(entropy, (unsigned int) (temp >> Al), 1);
- }
-
- cinfo->dest->next_output_byte = entropy->next_output_byte;
- cinfo->dest->free_in_buffer = entropy->free_in_buffer;
-
- /* Update restart-interval state too */
- if (cinfo->restart_interval) {
- if (entropy->restarts_to_go == 0) {
- entropy->restarts_to_go = cinfo->restart_interval;
- entropy->next_restart_num++;
- entropy->next_restart_num &= 7;
- }
- entropy->restarts_to_go--;
- }
-
- return TRUE;
-}
-
-
-/*
- * MCU encoding for AC successive approximation refinement scan.
- */
-
-METHODDEF(boolean)
-encode_mcu_AC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
-{
- phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
- register int temp;
- register int r, k;
- int EOB;
- char *BR_buffer;
- unsigned int BR;
- int Se = cinfo->Se;
- int Al = cinfo->Al;
- JBLOCKROW block;
- int absvalues[DCTSIZE2];
-
- entropy->next_output_byte = cinfo->dest->next_output_byte;
- entropy->free_in_buffer = cinfo->dest->free_in_buffer;
-
- /* Emit restart marker if needed */
- if (cinfo->restart_interval)
- if (entropy->restarts_to_go == 0)
- emit_restart(entropy, entropy->next_restart_num);
-
- /* Encode the MCU data block */
- block = MCU_data[0];
-
- /* It is convenient to make a pre-pass to determine the transformed
- * coefficients' absolute values and the EOB position.
- */
- EOB = 0;
- for (k = cinfo->Ss; k <= Se; k++) {
- temp = (*block)[jpeg_natural_order[k]];
- /* We must apply the point transform by Al. For AC coefficients this
- * is an integer division with rounding towards 0. To do this portably
- * in C, we shift after obtaining the absolute value.
- */
- if (temp < 0)
- temp = -temp; /* temp is abs value of input */
- temp >>= Al; /* apply the point transform */
- absvalues[k] = temp; /* save abs value for main pass */
- if (temp == 1)
- EOB = k; /* EOB = index of last newly-nonzero coef */
- }
-
- /* Encode the AC coefficients per section G.1.2.3, fig. G.7 */
-
- r = 0; /* r = run length of zeros */
- BR = 0; /* BR = count of buffered bits added now */
- BR_buffer = entropy->bit_buffer + entropy->BE; /* Append bits to buffer */
-
- for (k = cinfo->Ss; k <= Se; k++) {
- if ((temp = absvalues[k]) == 0) {
- r++;
- continue;
- }
-
- /* Emit any required ZRLs, but not if they can be folded into EOB */
- while (r > 15 && k <= EOB) {
- /* emit any pending EOBRUN and the BE correction bits */
- emit_eobrun(entropy);
- /* Emit ZRL */
- emit_symbol(entropy, entropy->ac_tbl_no, 0xF0);
- r -= 16;
- /* Emit buffered correction bits that must be associated with ZRL */
- emit_buffered_bits(entropy, BR_buffer, BR);
- BR_buffer = entropy->bit_buffer; /* BE bits are gone now */
- BR = 0;
- }
-
- /* If the coef was previously nonzero, it only needs a correction bit.
- * NOTE: a straight translation of the spec's figure G.7 would suggest
- * that we also need to test r > 15. But if r > 15, we can only get here
- * if k > EOB, which implies that this coefficient is not 1.
- */
- if (temp > 1) {
- /* The correction bit is the next bit of the absolute value. */
- BR_buffer[BR++] = (char) (temp & 1);
- continue;
- }
-
- /* Emit any pending EOBRUN and the BE correction bits */
- emit_eobrun(entropy);
-
- /* Count/emit Huffman symbol for run length / number of bits */
- emit_symbol(entropy, entropy->ac_tbl_no, (r << 4) + 1);
-
- /* Emit output bit for newly-nonzero coef */
- temp = ((*block)[jpeg_natural_order[k]] < 0) ? 0 : 1;
- emit_bits(entropy, (unsigned int) temp, 1);
-
- /* Emit buffered correction bits that must be associated with this code */
- emit_buffered_bits(entropy, BR_buffer, BR);
- BR_buffer = entropy->bit_buffer; /* BE bits are gone now */
- BR = 0;
- r = 0; /* reset zero run length */
- }
-
- if (r > 0 || BR > 0) { /* If there are trailing zeroes, */
- entropy->EOBRUN++; /* count an EOB */
- entropy->BE += BR; /* concat my correction bits to older ones */
- /* We force out the EOB if we risk either:
- * 1. overflow of the EOB counter;
- * 2. overflow of the correction bit buffer during the next MCU.
- */
- if (entropy->EOBRUN == 0x7FFF || entropy->BE > (MAX_CORR_BITS-DCTSIZE2+1))
- emit_eobrun(entropy);
- }
-
- cinfo->dest->next_output_byte = entropy->next_output_byte;
- cinfo->dest->free_in_buffer = entropy->free_in_buffer;
-
- /* Update restart-interval state too */
- if (cinfo->restart_interval) {
- if (entropy->restarts_to_go == 0) {
- entropy->restarts_to_go = cinfo->restart_interval;
- entropy->next_restart_num++;
- entropy->next_restart_num &= 7;
- }
- entropy->restarts_to_go--;
- }
-
- return TRUE;
-}
-
-
-/*
- * Finish up at the end of a Huffman-compressed progressive scan.
- */
-
-METHODDEF(void)
-finish_pass_phuff (j_compress_ptr cinfo)
-{
- phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
-
- entropy->next_output_byte = cinfo->dest->next_output_byte;
- entropy->free_in_buffer = cinfo->dest->free_in_buffer;
-
- /* Flush out any buffered data */
- emit_eobrun(entropy);
- flush_bits(entropy);
-
- cinfo->dest->next_output_byte = entropy->next_output_byte;
- cinfo->dest->free_in_buffer = entropy->free_in_buffer;
-}
-
-
-/*
- * Finish up a statistics-gathering pass and create the new Huffman tables.
- */
-
-METHODDEF(void)
-finish_pass_gather_phuff (j_compress_ptr cinfo)
-{
- phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
- boolean is_DC_band;
- int ci, tbl;
- jpeg_component_info * compptr;
- JHUFF_TBL **htblptr;
- boolean did[NUM_HUFF_TBLS];
-
- /* Flush out buffered data (all we care about is counting the EOB symbol) */
- emit_eobrun(entropy);
-
- is_DC_band = (cinfo->Ss == 0);
-
- /* It's important not to apply jpeg_gen_optimal_table more than once
- * per table, because it clobbers the input frequency counts!
- */
- MEMZERO(did, SIZEOF(did));
-
- for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
- compptr = cinfo->cur_comp_info[ci];
- if (is_DC_band) {
- if (cinfo->Ah != 0) /* DC refinement needs no table */
- continue;
- tbl = compptr->dc_tbl_no;
- } else {
- tbl = compptr->ac_tbl_no;
- }
- if (! did[tbl]) {
- if (is_DC_band)
- htblptr = & cinfo->dc_huff_tbl_ptrs[tbl];
- else
- htblptr = & cinfo->ac_huff_tbl_ptrs[tbl];
- if (*htblptr == NULL)
- *htblptr = jpeg_alloc_huff_table((j_common_ptr) cinfo);
- jpeg_gen_optimal_table(cinfo, *htblptr, entropy->count_ptrs[tbl]);
- did[tbl] = TRUE;
- }
- }
-}
-
-
-/*
- * Module initialization routine for progressive Huffman entropy encoding.
- */
-
-GLOBAL(void)
-jinit_phuff_encoder (j_compress_ptr cinfo)
-{
- phuff_entropy_ptr entropy;
- int i;
-
- entropy = (phuff_entropy_ptr)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- SIZEOF(phuff_entropy_encoder));
- cinfo->entropy = (struct jpeg_entropy_encoder *) entropy;
- entropy->pub.start_pass = start_pass_phuff;
-
- /* Mark tables unallocated */
- for (i = 0; i < NUM_HUFF_TBLS; i++) {
- entropy->derived_tbls[i] = NULL;
- entropy->count_ptrs[i] = NULL;
- }
- entropy->bit_buffer = NULL; /* needed only in AC refinement scan */
-}
-
-#endif /* C_PROGRESSIVE_SUPPORTED */
diff --git a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jcprepct.c b/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jcprepct.c
deleted file mode 100644
index fa93333db20..00000000000
--- a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jcprepct.c
+++ /dev/null
@@ -1,354 +0,0 @@
-/*
- * jcprepct.c
- *
- * Copyright (C) 1994-1996, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file contains the compression preprocessing controller.
- * This controller manages the color conversion, downsampling,
- * and edge expansion steps.
- *
- * Most of the complexity here is associated with buffering input rows
- * as required by the downsampler. See the comments at the head of
- * jcsample.c for the downsampler's needs.
- */
-
-#define JPEG_INTERNALS
-#include "jinclude.h"
-#include "jpeglib.h"
-
-
-/* At present, jcsample.c can request context rows only for smoothing.
- * In the future, we might also need context rows for CCIR601 sampling
- * or other more-complex downsampling procedures. The code to support
- * context rows should be compiled only if needed.
- */
-#ifdef INPUT_SMOOTHING_SUPPORTED
-#define CONTEXT_ROWS_SUPPORTED
-#endif
-
-
-/*
- * For the simple (no-context-row) case, we just need to buffer one
- * row group's worth of pixels for the downsampling step. At the bottom of
- * the image, we pad to a full row group by replicating the last pixel row.
- * The downsampler's last output row is then replicated if needed to pad
- * out to a full iMCU row.
- *
- * When providing context rows, we must buffer three row groups' worth of
- * pixels. Three row groups are physically allocated, but the row pointer
- * arrays are made five row groups high, with the extra pointers above and
- * below "wrapping around" to point to the last and first real row groups.
- * This allows the downsampler to access the proper context rows.
- * At the top and bottom of the image, we create dummy context rows by
- * copying the first or last real pixel row. This copying could be avoided
- * by pointer hacking as is done in jdmainct.c, but it doesn't seem worth the
- * trouble on the compression side.
- */
-
-
-/* Private buffer controller object */
-
-typedef struct {
- struct jpeg_c_prep_controller pub; /* public fields */
-
- /* Downsampling input buffer. This buffer holds color-converted data
- * until we have enough to do a downsample step.
- */
- JSAMPARRAY color_buf[MAX_COMPONENTS];
-
- JDIMENSION rows_to_go; /* counts rows remaining in source image */
- int next_buf_row; /* index of next row to store in color_buf */
-
-#ifdef CONTEXT_ROWS_SUPPORTED /* only needed for context case */
- int this_row_group; /* starting row index of group to process */
- int next_buf_stop; /* downsample when we reach this index */
-#endif
-} my_prep_controller;
-
-typedef my_prep_controller * my_prep_ptr;
-
-
-/*
- * Initialize for a processing pass.
- */
-
-METHODDEF(void)
-start_pass_prep (j_compress_ptr cinfo, J_BUF_MODE pass_mode)
-{
- my_prep_ptr prep = (my_prep_ptr) cinfo->prep;
-
- if (pass_mode != JBUF_PASS_THRU)
- ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
-
- /* Initialize total-height counter for detecting bottom of image */
- prep->rows_to_go = cinfo->image_height;
- /* Mark the conversion buffer empty */
- prep->next_buf_row = 0;
-#ifdef CONTEXT_ROWS_SUPPORTED
- /* Preset additional state variables for context mode.
- * These aren't used in non-context mode, so we needn't test which mode.
- */
- prep->this_row_group = 0;
- /* Set next_buf_stop to stop after two row groups have been read in. */
- prep->next_buf_stop = 2 * cinfo->max_v_samp_factor;
-#endif
-}
-
-
-/*
- * Expand an image vertically from height input_rows to height output_rows,
- * by duplicating the bottom row.
- */
-
-LOCAL(void)
-expand_bottom_edge (JSAMPARRAY image_data, JDIMENSION num_cols,
- int input_rows, int output_rows)
-{
- register int row;
-
- for (row = input_rows; row < output_rows; row++) {
- jcopy_sample_rows(image_data, input_rows-1, image_data, row,
- 1, num_cols);
- }
-}
-
-
-/*
- * Process some data in the simple no-context case.
- *
- * Preprocessor output data is counted in "row groups". A row group
- * is defined to be v_samp_factor sample rows of each component.
- * Downsampling will produce this much data from each max_v_samp_factor
- * input rows.
- */
-
-METHODDEF(void)
-pre_process_data (j_compress_ptr cinfo,
- JSAMPARRAY input_buf, JDIMENSION *in_row_ctr,
- JDIMENSION in_rows_avail,
- JSAMPIMAGE output_buf, JDIMENSION *out_row_group_ctr,
- JDIMENSION out_row_groups_avail)
-{
- my_prep_ptr prep = (my_prep_ptr) cinfo->prep;
- int numrows, ci;
- JDIMENSION inrows;
- jpeg_component_info * compptr;
-
- while (*in_row_ctr < in_rows_avail &&
- *out_row_group_ctr < out_row_groups_avail) {
- /* Do color conversion to fill the conversion buffer. */
- inrows = in_rows_avail - *in_row_ctr;
- numrows = cinfo->max_v_samp_factor - prep->next_buf_row;
- numrows = (int) MIN((JDIMENSION) numrows, inrows);
- (*cinfo->cconvert->color_convert) (cinfo, input_buf + *in_row_ctr,
- prep->color_buf,
- (JDIMENSION) prep->next_buf_row,
- numrows);
- *in_row_ctr += numrows;
- prep->next_buf_row += numrows;
- prep->rows_to_go -= numrows;
- /* If at bottom of image, pad to fill the conversion buffer. */
- if (prep->rows_to_go == 0 &&
- prep->next_buf_row < cinfo->max_v_samp_factor) {
- for (ci = 0; ci < cinfo->num_components; ci++) {
- expand_bottom_edge(prep->color_buf[ci], cinfo->image_width,
- prep->next_buf_row, cinfo->max_v_samp_factor);
- }
- prep->next_buf_row = cinfo->max_v_samp_factor;
- }
- /* If we've filled the conversion buffer, empty it. */
- if (prep->next_buf_row == cinfo->max_v_samp_factor) {
- (*cinfo->downsample->downsample) (cinfo,
- prep->color_buf, (JDIMENSION) 0,
- output_buf, *out_row_group_ctr);
- prep->next_buf_row = 0;
- (*out_row_group_ctr)++;
- }
- /* If at bottom of image, pad the output to a full iMCU height.
- * Note we assume the caller is providing a one-iMCU-height output buffer!
- */
- if (prep->rows_to_go == 0 &&
- *out_row_group_ctr < out_row_groups_avail) {
- for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
- ci++, compptr++) {
- expand_bottom_edge(output_buf[ci],
- compptr->width_in_blocks * DCTSIZE,
- (int) (*out_row_group_ctr * compptr->v_samp_factor),
- (int) (out_row_groups_avail * compptr->v_samp_factor));
- }
- *out_row_group_ctr = out_row_groups_avail;
- break; /* can exit outer loop without test */
- }
- }
-}
-
-
-#ifdef CONTEXT_ROWS_SUPPORTED
-
-/*
- * Process some data in the context case.
- */
-
-METHODDEF(void)
-pre_process_context (j_compress_ptr cinfo,
- JSAMPARRAY input_buf, JDIMENSION *in_row_ctr,
- JDIMENSION in_rows_avail,
- JSAMPIMAGE output_buf, JDIMENSION *out_row_group_ctr,
- JDIMENSION out_row_groups_avail)
-{
- my_prep_ptr prep = (my_prep_ptr) cinfo->prep;
- int numrows, ci;
- int buf_height = cinfo->max_v_samp_factor * 3;
- JDIMENSION inrows;
-
- while (*out_row_group_ctr < out_row_groups_avail) {
- if (*in_row_ctr < in_rows_avail) {
- /* Do color conversion to fill the conversion buffer. */
- inrows = in_rows_avail - *in_row_ctr;
- numrows = prep->next_buf_stop - prep->next_buf_row;
- numrows = (int) MIN((JDIMENSION) numrows, inrows);
- (*cinfo->cconvert->color_convert) (cinfo, input_buf + *in_row_ctr,
- prep->color_buf,
- (JDIMENSION) prep->next_buf_row,
- numrows);
- /* Pad at top of image, if first time through */
- if (prep->rows_to_go == cinfo->image_height) {
- for (ci = 0; ci < cinfo->num_components; ci++) {
- int row;
- for (row = 1; row <= cinfo->max_v_samp_factor; row++) {
- jcopy_sample_rows(prep->color_buf[ci], 0,
- prep->color_buf[ci], -row,
- 1, cinfo->image_width);
- }
- }
- }
- *in_row_ctr += numrows;
- prep->next_buf_row += numrows;
- prep->rows_to_go -= numrows;
- } else {
- /* Return for more data, unless we are at the bottom of the image. */
- if (prep->rows_to_go != 0)
- break;
- /* When at bottom of image, pad to fill the conversion buffer. */
- if (prep->next_buf_row < prep->next_buf_stop) {
- for (ci = 0; ci < cinfo->num_components; ci++) {
- expand_bottom_edge(prep->color_buf[ci], cinfo->image_width,
- prep->next_buf_row, prep->next_buf_stop);
- }
- prep->next_buf_row = prep->next_buf_stop;
- }
- }
- /* If we've gotten enough data, downsample a row group. */
- if (prep->next_buf_row == prep->next_buf_stop) {
- (*cinfo->downsample->downsample) (cinfo,
- prep->color_buf,
- (JDIMENSION) prep->this_row_group,
- output_buf, *out_row_group_ctr);
- (*out_row_group_ctr)++;
- /* Advance pointers with wraparound as necessary. */
- prep->this_row_group += cinfo->max_v_samp_factor;
- if (prep->this_row_group >= buf_height)
- prep->this_row_group = 0;
- if (prep->next_buf_row >= buf_height)
- prep->next_buf_row = 0;
- prep->next_buf_stop = prep->next_buf_row + cinfo->max_v_samp_factor;
- }
- }
-}
-
-
-/*
- * Create the wrapped-around downsampling input buffer needed for context mode.
- */
-
-LOCAL(void)
-create_context_buffer (j_compress_ptr cinfo)
-{
- my_prep_ptr prep = (my_prep_ptr) cinfo->prep;
- int rgroup_height = cinfo->max_v_samp_factor;
- int ci, i;
- jpeg_component_info * compptr;
- JSAMPARRAY true_buffer, fake_buffer;
-
- /* Grab enough space for fake row pointers for all the components;
- * we need five row groups' worth of pointers for each component.
- */
- fake_buffer = (JSAMPARRAY)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- (cinfo->num_components * 5 * rgroup_height) *
- SIZEOF(JSAMPROW));
-
- for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
- ci++, compptr++) {
- /* Allocate the actual buffer space (3 row groups) for this component.
- * We make the buffer wide enough to allow the downsampler to edge-expand
- * horizontally within the buffer, if it so chooses.
- */
- true_buffer = (*cinfo->mem->alloc_sarray)
- ((j_common_ptr) cinfo, JPOOL_IMAGE,
- (JDIMENSION) (((long) compptr->width_in_blocks * DCTSIZE *
- cinfo->max_h_samp_factor) / compptr->h_samp_factor),
- (JDIMENSION) (3 * rgroup_height));
- /* Copy true buffer row pointers into the middle of the fake row array */
- MEMCOPY(fake_buffer + rgroup_height, true_buffer,
- 3 * rgroup_height * SIZEOF(JSAMPROW));
- /* Fill in the above and below wraparound pointers */
- for (i = 0; i < rgroup_height; i++) {
- fake_buffer[i] = true_buffer[2 * rgroup_height + i];
- fake_buffer[4 * rgroup_height + i] = true_buffer[i];
- }
- prep->color_buf[ci] = fake_buffer + rgroup_height;
- fake_buffer += 5 * rgroup_height; /* point to space for next component */
- }
-}
-
-#endif /* CONTEXT_ROWS_SUPPORTED */
-
-
-/*
- * Initialize preprocessing controller.
- */
-
-GLOBAL(void)
-jinit_c_prep_controller (j_compress_ptr cinfo, boolean need_full_buffer)
-{
- my_prep_ptr prep;
- int ci;
- jpeg_component_info * compptr;
-
- if (need_full_buffer) /* safety check */
- ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
-
- prep = (my_prep_ptr)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- SIZEOF(my_prep_controller));
- cinfo->prep = (struct jpeg_c_prep_controller *) prep;
- prep->pub.start_pass = start_pass_prep;
-
- /* Allocate the color conversion buffer.
- * We make the buffer wide enough to allow the downsampler to edge-expand
- * horizontally within the buffer, if it so chooses.
- */
- if (cinfo->downsample->need_context_rows) {
- /* Set up to provide context rows */
-#ifdef CONTEXT_ROWS_SUPPORTED
- prep->pub.pre_process_data = pre_process_context;
- create_context_buffer(cinfo);
-#else
- ERREXIT(cinfo, JERR_NOT_COMPILED);
-#endif
- } else {
- /* No context, just make it tall enough for one row group */
- prep->pub.pre_process_data = pre_process_data;
- for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
- ci++, compptr++) {
- prep->color_buf[ci] = (*cinfo->mem->alloc_sarray)
- ((j_common_ptr) cinfo, JPOOL_IMAGE,
- (JDIMENSION) (((long) compptr->width_in_blocks * DCTSIZE *
- cinfo->max_h_samp_factor) / compptr->h_samp_factor),
- (JDIMENSION) cinfo->max_v_samp_factor);
- }
- }
-}
diff --git a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jcsample.c b/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jcsample.c
deleted file mode 100644
index 212ec8757c4..00000000000
--- a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jcsample.c
+++ /dev/null
@@ -1,519 +0,0 @@
-/*
- * jcsample.c
- *
- * Copyright (C) 1991-1996, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file contains downsampling routines.
- *
- * Downsampling input data is counted in "row groups". A row group
- * is defined to be max_v_samp_factor pixel rows of each component,
- * from which the downsampler produces v_samp_factor sample rows.
- * A single row group is processed in each call to the downsampler module.
- *
- * The downsampler is responsible for edge-expansion of its output data
- * to fill an integral number of DCT blocks horizontally. The source buffer
- * may be modified if it is helpful for this purpose (the source buffer is
- * allocated wide enough to correspond to the desired output width).
- * The caller (the prep controller) is responsible for vertical padding.
- *
- * The downsampler may request "context rows" by setting need_context_rows
- * during startup. In this case, the input arrays will contain at least
- * one row group's worth of pixels above and below the passed-in data;
- * the caller will create dummy rows at image top and bottom by replicating
- * the first or last real pixel row.
- *
- * An excellent reference for image resampling is
- * Digital Image Warping, George Wolberg, 1990.
- * Pub. by IEEE Computer Society Press, Los Alamitos, CA. ISBN 0-8186-8944-7.
- *
- * The downsampling algorithm used here is a simple average of the source
- * pixels covered by the output pixel. The hi-falutin sampling literature
- * refers to this as a "box filter". In general the characteristics of a box
- * filter are not very good, but for the specific cases we normally use (1:1
- * and 2:1 ratios) the box is equivalent to a "triangle filter" which is not
- * nearly so bad. If you intend to use other sampling ratios, you'd be well
- * advised to improve this code.
- *
- * A simple input-smoothing capability is provided. This is mainly intended
- * for cleaning up color-dithered GIF input files (if you find it inadequate,
- * we suggest using an external filtering program such as pnmconvol). When
- * enabled, each input pixel P is replaced by a weighted sum of itself and its
- * eight neighbors. P's weight is 1-8*SF and each neighbor's weight is SF,
- * where SF = (smoothing_factor / 1024).
- * Currently, smoothing is only supported for 2h2v sampling factors.
- */
-
-#define JPEG_INTERNALS
-#include "jinclude.h"
-#include "jpeglib.h"
-
-
-/* Pointer to routine to downsample a single component */
-typedef JMETHOD(void, downsample1_ptr,
- (j_compress_ptr cinfo, jpeg_component_info * compptr,
- JSAMPARRAY input_data, JSAMPARRAY output_data));
-
-/* Private subobject */
-
-typedef struct {
- struct jpeg_downsampler pub; /* public fields */
-
- /* Downsampling method pointers, one per component */
- downsample1_ptr methods[MAX_COMPONENTS];
-} my_downsampler;
-
-typedef my_downsampler * my_downsample_ptr;
-
-
-/*
- * Initialize for a downsampling pass.
- */
-
-METHODDEF(void)
-start_pass_downsample (j_compress_ptr cinfo)
-{
- /* no work for now */
-}
-
-
-/*
- * Expand a component horizontally from width input_cols to width output_cols,
- * by duplicating the rightmost samples.
- */
-
-LOCAL(void)
-expand_right_edge (JSAMPARRAY image_data, int num_rows,
- JDIMENSION input_cols, JDIMENSION output_cols)
-{
- register JSAMPROW ptr;
- register JSAMPLE pixval;
- register int count;
- int row;
- int numcols = (int) (output_cols - input_cols);
-
- if (numcols > 0) {
- for (row = 0; row < num_rows; row++) {
- ptr = image_data[row] + input_cols;
- pixval = ptr[-1]; /* don't need GETJSAMPLE() here */
- for (count = numcols; count > 0; count--)
- *ptr++ = pixval;
- }
- }
-}
-
-
-/*
- * Do downsampling for a whole row group (all components).
- *
- * In this version we simply downsample each component independently.
- */
-
-METHODDEF(void)
-sep_downsample (j_compress_ptr cinfo,
- JSAMPIMAGE input_buf, JDIMENSION in_row_index,
- JSAMPIMAGE output_buf, JDIMENSION out_row_group_index)
-{
- my_downsample_ptr downsample = (my_downsample_ptr) cinfo->downsample;
- int ci;
- jpeg_component_info * compptr;
- JSAMPARRAY in_ptr, out_ptr;
-
- for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
- ci++, compptr++) {
- in_ptr = input_buf[ci] + in_row_index;
- out_ptr = output_buf[ci] + (out_row_group_index * compptr->v_samp_factor);
- (*downsample->methods[ci]) (cinfo, compptr, in_ptr, out_ptr);
- }
-}
-
-
-/*
- * Downsample pixel values of a single component.
- * One row group is processed per call.
- * This version handles arbitrary integral sampling ratios, without smoothing.
- * Note that this version is not actually used for customary sampling ratios.
- */
-
-METHODDEF(void)
-int_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
- JSAMPARRAY input_data, JSAMPARRAY output_data)
-{
- int inrow, outrow, h_expand, v_expand, numpix, numpix2, h, v;
- JDIMENSION outcol, outcol_h; /* outcol_h == outcol*h_expand */
- JDIMENSION output_cols = compptr->width_in_blocks * DCTSIZE;
- JSAMPROW inptr, outptr;
- INT32 outvalue;
-
- h_expand = cinfo->max_h_samp_factor / compptr->h_samp_factor;
- v_expand = cinfo->max_v_samp_factor / compptr->v_samp_factor;
- numpix = h_expand * v_expand;
- numpix2 = numpix/2;
-
- /* Expand input data enough to let all the output samples be generated
- * by the standard loop. Special-casing padded output would be more
- * efficient.
- */
- expand_right_edge(input_data, cinfo->max_v_samp_factor,
- cinfo->image_width, output_cols * h_expand);
-
- inrow = 0;
- for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) {
- outptr = output_data[outrow];
- for (outcol = 0, outcol_h = 0; outcol < output_cols;
- outcol++, outcol_h += h_expand) {
- outvalue = 0;
- for (v = 0; v < v_expand; v++) {
- inptr = input_data[inrow+v] + outcol_h;
- for (h = 0; h < h_expand; h++) {
- outvalue += (INT32) GETJSAMPLE(*inptr++);
- }
- }
- *outptr++ = (JSAMPLE) ((outvalue + numpix2) / numpix);
- }
- inrow += v_expand;
- }
-}
-
-
-/*
- * Downsample pixel values of a single component.
- * This version handles the special case of a full-size component,
- * without smoothing.
- */
-
-METHODDEF(void)
-fullsize_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
- JSAMPARRAY input_data, JSAMPARRAY output_data)
-{
- /* Copy the data */
- jcopy_sample_rows(input_data, 0, output_data, 0,
- cinfo->max_v_samp_factor, cinfo->image_width);
- /* Edge-expand */
- expand_right_edge(output_data, cinfo->max_v_samp_factor,
- cinfo->image_width, compptr->width_in_blocks * DCTSIZE);
-}
-
-
-/*
- * Downsample pixel values of a single component.
- * This version handles the common case of 2:1 horizontal and 1:1 vertical,
- * without smoothing.
- *
- * A note about the "bias" calculations: when rounding fractional values to
- * integer, we do not want to always round 0.5 up to the next integer.
- * If we did that, we'd introduce a noticeable bias towards larger values.
- * Instead, this code is arranged so that 0.5 will be rounded up or down at
- * alternate pixel locations (a simple ordered dither pattern).
- */
-
-METHODDEF(void)
-h2v1_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
- JSAMPARRAY input_data, JSAMPARRAY output_data)
-{
- int outrow;
- JDIMENSION outcol;
- JDIMENSION output_cols = compptr->width_in_blocks * DCTSIZE;
- register JSAMPROW inptr, outptr;
- register int bias;
-
- /* Expand input data enough to let all the output samples be generated
- * by the standard loop. Special-casing padded output would be more
- * efficient.
- */
- expand_right_edge(input_data, cinfo->max_v_samp_factor,
- cinfo->image_width, output_cols * 2);
-
- for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) {
- outptr = output_data[outrow];
- inptr = input_data[outrow];
- bias = 0; /* bias = 0,1,0,1,... for successive samples */
- for (outcol = 0; outcol < output_cols; outcol++) {
- *outptr++ = (JSAMPLE) ((GETJSAMPLE(*inptr) + GETJSAMPLE(inptr[1])
- + bias) >> 1);
- bias ^= 1; /* 0=>1, 1=>0 */
- inptr += 2;
- }
- }
-}
-
-
-/*
- * Downsample pixel values of a single component.
- * This version handles the standard case of 2:1 horizontal and 2:1 vertical,
- * without smoothing.
- */
-
-METHODDEF(void)
-h2v2_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
- JSAMPARRAY input_data, JSAMPARRAY output_data)
-{
- int inrow, outrow;
- JDIMENSION outcol;
- JDIMENSION output_cols = compptr->width_in_blocks * DCTSIZE;
- register JSAMPROW inptr0, inptr1, outptr;
- register int bias;
-
- /* Expand input data enough to let all the output samples be generated
- * by the standard loop. Special-casing padded output would be more
- * efficient.
- */
- expand_right_edge(input_data, cinfo->max_v_samp_factor,
- cinfo->image_width, output_cols * 2);
-
- inrow = 0;
- for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) {
- outptr = output_data[outrow];
- inptr0 = input_data[inrow];
- inptr1 = input_data[inrow+1];
- bias = 1; /* bias = 1,2,1,2,... for successive samples */
- for (outcol = 0; outcol < output_cols; outcol++) {
- *outptr++ = (JSAMPLE) ((GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) +
- GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1])
- + bias) >> 2);
- bias ^= 3; /* 1=>2, 2=>1 */
- inptr0 += 2; inptr1 += 2;
- }
- inrow += 2;
- }
-}
-
-
-#ifdef INPUT_SMOOTHING_SUPPORTED
-
-/*
- * Downsample pixel values of a single component.
- * This version handles the standard case of 2:1 horizontal and 2:1 vertical,
- * with smoothing. One row of context is required.
- */
-
-METHODDEF(void)
-h2v2_smooth_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
- JSAMPARRAY input_data, JSAMPARRAY output_data)
-{
- int inrow, outrow;
- JDIMENSION colctr;
- JDIMENSION output_cols = compptr->width_in_blocks * DCTSIZE;
- register JSAMPROW inptr0, inptr1, above_ptr, below_ptr, outptr;
- INT32 membersum, neighsum, memberscale, neighscale;
-
- /* Expand input data enough to let all the output samples be generated
- * by the standard loop. Special-casing padded output would be more
- * efficient.
- */
- expand_right_edge(input_data - 1, cinfo->max_v_samp_factor + 2,
- cinfo->image_width, output_cols * 2);
-
- /* We don't bother to form the individual "smoothed" input pixel values;
- * we can directly compute the output which is the average of the four
- * smoothed values. Each of the four member pixels contributes a fraction
- * (1-8*SF) to its own smoothed image and a fraction SF to each of the three
- * other smoothed pixels, therefore a total fraction (1-5*SF)/4 to the final
- * output. The four corner-adjacent neighbor pixels contribute a fraction
- * SF to just one smoothed pixel, or SF/4 to the final output; while the
- * eight edge-adjacent neighbors contribute SF to each of two smoothed
- * pixels, or SF/2 overall. In order to use integer arithmetic, these
- * factors are scaled by 2^16 = 65536.
- * Also recall that SF = smoothing_factor / 1024.
- */
-
- memberscale = 16384 - cinfo->smoothing_factor * 80; /* scaled (1-5*SF)/4 */
- neighscale = cinfo->smoothing_factor * 16; /* scaled SF/4 */
-
- inrow = 0;
- for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) {
- outptr = output_data[outrow];
- inptr0 = input_data[inrow];
- inptr1 = input_data[inrow+1];
- above_ptr = input_data[inrow-1];
- below_ptr = input_data[inrow+2];
-
- /* Special case for first column: pretend column -1 is same as column 0 */
- membersum = GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) +
- GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]);
- neighsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(above_ptr[1]) +
- GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[1]) +
- GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[2]) +
- GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[2]);
- neighsum += neighsum;
- neighsum += GETJSAMPLE(*above_ptr) + GETJSAMPLE(above_ptr[2]) +
- GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[2]);
- membersum = membersum * memberscale + neighsum * neighscale;
- *outptr++ = (JSAMPLE) ((membersum + 32768) >> 16);
- inptr0 += 2; inptr1 += 2; above_ptr += 2; below_ptr += 2;
-
- for (colctr = output_cols - 2; colctr > 0; colctr--) {
- /* sum of pixels directly mapped to this output element */
- membersum = GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) +
- GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]);
- /* sum of edge-neighbor pixels */
- neighsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(above_ptr[1]) +
- GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[1]) +
- GETJSAMPLE(inptr0[-1]) + GETJSAMPLE(inptr0[2]) +
- GETJSAMPLE(inptr1[-1]) + GETJSAMPLE(inptr1[2]);
- /* The edge-neighbors count twice as much as corner-neighbors */
- neighsum += neighsum;
- /* Add in the corner-neighbors */
- neighsum += GETJSAMPLE(above_ptr[-1]) + GETJSAMPLE(above_ptr[2]) +
- GETJSAMPLE(below_ptr[-1]) + GETJSAMPLE(below_ptr[2]);
- /* form final output scaled up by 2^16 */
- membersum = membersum * memberscale + neighsum * neighscale;
- /* round, descale and output it */
- *outptr++ = (JSAMPLE) ((membersum + 32768) >> 16);
- inptr0 += 2; inptr1 += 2; above_ptr += 2; below_ptr += 2;
- }
-
- /* Special case for last column */
- membersum = GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) +
- GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]);
- neighsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(above_ptr[1]) +
- GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[1]) +
- GETJSAMPLE(inptr0[-1]) + GETJSAMPLE(inptr0[1]) +
- GETJSAMPLE(inptr1[-1]) + GETJSAMPLE(inptr1[1]);
- neighsum += neighsum;
- neighsum += GETJSAMPLE(above_ptr[-1]) + GETJSAMPLE(above_ptr[1]) +
- GETJSAMPLE(below_ptr[-1]) + GETJSAMPLE(below_ptr[1]);
- membersum = membersum * memberscale + neighsum * neighscale;
- *outptr = (JSAMPLE) ((membersum + 32768) >> 16);
-
- inrow += 2;
- }
-}
-
-
-/*
- * Downsample pixel values of a single component.
- * This version handles the special case of a full-size component,
- * with smoothing. One row of context is required.
- */
-
-METHODDEF(void)
-fullsize_smooth_downsample (j_compress_ptr cinfo, jpeg_component_info *compptr,
- JSAMPARRAY input_data, JSAMPARRAY output_data)
-{
- int outrow;
- JDIMENSION colctr;
- JDIMENSION output_cols = compptr->width_in_blocks * DCTSIZE;
- register JSAMPROW inptr, above_ptr, below_ptr, outptr;
- INT32 membersum, neighsum, memberscale, neighscale;
- int colsum, lastcolsum, nextcolsum;
-
- /* Expand input data enough to let all the output samples be generated
- * by the standard loop. Special-casing padded output would be more
- * efficient.
- */
- expand_right_edge(input_data - 1, cinfo->max_v_samp_factor + 2,
- cinfo->image_width, output_cols);
-
- /* Each of the eight neighbor pixels contributes a fraction SF to the
- * smoothed pixel, while the main pixel contributes (1-8*SF). In order
- * to use integer arithmetic, these factors are multiplied by 2^16 = 65536.
- * Also recall that SF = smoothing_factor / 1024.
- */
-
- memberscale = 65536L - cinfo->smoothing_factor * 512L; /* scaled 1-8*SF */
- neighscale = cinfo->smoothing_factor * 64; /* scaled SF */
-
- for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) {
- outptr = output_data[outrow];
- inptr = input_data[outrow];
- above_ptr = input_data[outrow-1];
- below_ptr = input_data[outrow+1];
-
- /* Special case for first column */
- colsum = GETJSAMPLE(*above_ptr++) + GETJSAMPLE(*below_ptr++) +
- GETJSAMPLE(*inptr);
- membersum = GETJSAMPLE(*inptr++);
- nextcolsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(*below_ptr) +
- GETJSAMPLE(*inptr);
- neighsum = colsum + (colsum - membersum) + nextcolsum;
- membersum = membersum * memberscale + neighsum * neighscale;
- *outptr++ = (JSAMPLE) ((membersum + 32768) >> 16);
- lastcolsum = colsum; colsum = nextcolsum;
-
- for (colctr = output_cols - 2; colctr > 0; colctr--) {
- membersum = GETJSAMPLE(*inptr++);
- above_ptr++; below_ptr++;
- nextcolsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(*below_ptr) +
- GETJSAMPLE(*inptr);
- neighsum = lastcolsum + (colsum - membersum) + nextcolsum;
- membersum = membersum * memberscale + neighsum * neighscale;
- *outptr++ = (JSAMPLE) ((membersum + 32768) >> 16);
- lastcolsum = colsum; colsum = nextcolsum;
- }
-
- /* Special case for last column */
- membersum = GETJSAMPLE(*inptr);
- neighsum = lastcolsum + (colsum - membersum) + colsum;
- membersum = membersum * memberscale + neighsum * neighscale;
- *outptr = (JSAMPLE) ((membersum + 32768) >> 16);
-
- }
-}
-
-#endif /* INPUT_SMOOTHING_SUPPORTED */
-
-
-/*
- * Module initialization routine for downsampling.
- * Note that we must select a routine for each component.
- */
-
-GLOBAL(void)
-jinit_downsampler (j_compress_ptr cinfo)
-{
- my_downsample_ptr downsample;
- int ci;
- jpeg_component_info * compptr;
- boolean smoothok = TRUE;
-
- downsample = (my_downsample_ptr)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- SIZEOF(my_downsampler));
- cinfo->downsample = (struct jpeg_downsampler *) downsample;
- downsample->pub.start_pass = start_pass_downsample;
- downsample->pub.downsample = sep_downsample;
- downsample->pub.need_context_rows = FALSE;
-
- if (cinfo->CCIR601_sampling)
- ERREXIT(cinfo, JERR_CCIR601_NOTIMPL);
-
- /* Verify we can handle the sampling factors, and set up method pointers */
- for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
- ci++, compptr++) {
- if (compptr->h_samp_factor == cinfo->max_h_samp_factor &&
- compptr->v_samp_factor == cinfo->max_v_samp_factor) {
-#ifdef INPUT_SMOOTHING_SUPPORTED
- if (cinfo->smoothing_factor) {
- downsample->methods[ci] = fullsize_smooth_downsample;
- downsample->pub.need_context_rows = TRUE;
- } else
-#endif
- downsample->methods[ci] = fullsize_downsample;
- } else if (compptr->h_samp_factor * 2 == cinfo->max_h_samp_factor &&
- compptr->v_samp_factor == cinfo->max_v_samp_factor) {
- smoothok = FALSE;
- downsample->methods[ci] = h2v1_downsample;
- } else if (compptr->h_samp_factor * 2 == cinfo->max_h_samp_factor &&
- compptr->v_samp_factor * 2 == cinfo->max_v_samp_factor) {
-#ifdef INPUT_SMOOTHING_SUPPORTED
- if (cinfo->smoothing_factor) {
- downsample->methods[ci] = h2v2_smooth_downsample;
- downsample->pub.need_context_rows = TRUE;
- } else
-#endif
- downsample->methods[ci] = h2v2_downsample;
- } else if ((cinfo->max_h_samp_factor % compptr->h_samp_factor) == 0 &&
- (cinfo->max_v_samp_factor % compptr->v_samp_factor) == 0) {
- smoothok = FALSE;
- downsample->methods[ci] = int_downsample;
- } else
- ERREXIT(cinfo, JERR_FRACT_SAMPLE_NOTIMPL);
- }
-
-#ifdef INPUT_SMOOTHING_SUPPORTED
- if (cinfo->smoothing_factor && !smoothok)
- TRACEMS(cinfo, 0, JTRC_SMOOTH_NOTIMPL);
-#endif
-}
diff --git a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jctrans.c b/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jctrans.c
deleted file mode 100644
index 0e6d70769df..00000000000
--- a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jctrans.c
+++ /dev/null
@@ -1,388 +0,0 @@
-/*
- * jctrans.c
- *
- * Copyright (C) 1995-1998, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file contains library routines for transcoding compression,
- * that is, writing raw DCT coefficient arrays to an output JPEG file.
- * The routines in jcapimin.c will also be needed by a transcoder.
- */
-
-#define JPEG_INTERNALS
-#include "jinclude.h"
-#include "jpeglib.h"
-
-
-/* Forward declarations */
-LOCAL(void) transencode_master_selection
- JPP((j_compress_ptr cinfo, jvirt_barray_ptr * coef_arrays));
-LOCAL(void) transencode_coef_controller
- JPP((j_compress_ptr cinfo, jvirt_barray_ptr * coef_arrays));
-
-
-/*
- * Compression initialization for writing raw-coefficient data.
- * Before calling this, all parameters and a data destination must be set up.
- * Call jpeg_finish_compress() to actually write the data.
- *
- * The number of passed virtual arrays must match cinfo->num_components.
- * Note that the virtual arrays need not be filled or even realized at
- * the time write_coefficients is called; indeed, if the virtual arrays
- * were requested from this compression object's memory manager, they
- * typically will be realized during this routine and filled afterwards.
- */
-
-GLOBAL(void)
-jpeg_write_coefficients (j_compress_ptr cinfo, jvirt_barray_ptr * coef_arrays)
-{
- if (cinfo->global_state != CSTATE_START)
- ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
- /* Mark all tables to be written */
- jpeg_suppress_tables(cinfo, FALSE);
- /* (Re)initialize error mgr and destination modules */
- (*cinfo->err->reset_error_mgr) ((j_common_ptr) cinfo);
- (*cinfo->dest->init_destination) (cinfo);
- /* Perform master selection of active modules */
- transencode_master_selection(cinfo, coef_arrays);
- /* Wait for jpeg_finish_compress() call */
- cinfo->next_scanline = 0; /* so jpeg_write_marker works */
- cinfo->global_state = CSTATE_WRCOEFS;
-}
-
-
-/*
- * Initialize the compression object with default parameters,
- * then copy from the source object all parameters needed for lossless
- * transcoding. Parameters that can be varied without loss (such as
- * scan script and Huffman optimization) are left in their default states.
- */
-
-GLOBAL(void)
-jpeg_copy_critical_parameters (j_decompress_ptr srcinfo,
- j_compress_ptr dstinfo)
-{
- JQUANT_TBL ** qtblptr;
- jpeg_component_info *incomp, *outcomp;
- JQUANT_TBL *c_quant, *slot_quant;
- int tblno, ci, coefi;
-
- /* Safety check to ensure start_compress not called yet. */
- if (dstinfo->global_state != CSTATE_START)
- ERREXIT1(dstinfo, JERR_BAD_STATE, dstinfo->global_state);
- /* Copy fundamental image dimensions */
- dstinfo->image_width = srcinfo->image_width;
- dstinfo->image_height = srcinfo->image_height;
- dstinfo->input_components = srcinfo->num_components;
- dstinfo->in_color_space = srcinfo->jpeg_color_space;
- /* Initialize all parameters to default values */
- jpeg_set_defaults(dstinfo);
- /* jpeg_set_defaults may choose wrong colorspace, eg YCbCr if input is RGB.
- * Fix it to get the right header markers for the image colorspace.
- */
- jpeg_set_colorspace(dstinfo, srcinfo->jpeg_color_space);
- dstinfo->data_precision = srcinfo->data_precision;
- dstinfo->CCIR601_sampling = srcinfo->CCIR601_sampling;
- /* Copy the source's quantization tables. */
- for (tblno = 0; tblno < NUM_QUANT_TBLS; tblno++) {
- if (srcinfo->quant_tbl_ptrs[tblno] != NULL) {
- qtblptr = & dstinfo->quant_tbl_ptrs[tblno];
- if (*qtblptr == NULL)
- *qtblptr = jpeg_alloc_quant_table((j_common_ptr) dstinfo);
- MEMCOPY((*qtblptr)->quantval,
- srcinfo->quant_tbl_ptrs[tblno]->quantval,
- SIZEOF((*qtblptr)->quantval));
- (*qtblptr)->sent_table = FALSE;
- }
- }
- /* Copy the source's per-component info.
- * Note we assume jpeg_set_defaults has allocated the dest comp_info array.
- */
- dstinfo->num_components = srcinfo->num_components;
- if (dstinfo->num_components < 1 || dstinfo->num_components > MAX_COMPONENTS)
- ERREXIT2(dstinfo, JERR_COMPONENT_COUNT, dstinfo->num_components,
- MAX_COMPONENTS);
- for (ci = 0, incomp = srcinfo->comp_info, outcomp = dstinfo->comp_info;
- ci < dstinfo->num_components; ci++, incomp++, outcomp++) {
- outcomp->component_id = incomp->component_id;
- outcomp->h_samp_factor = incomp->h_samp_factor;
- outcomp->v_samp_factor = incomp->v_samp_factor;
- outcomp->quant_tbl_no = incomp->quant_tbl_no;
- /* Make sure saved quantization table for component matches the qtable
- * slot. If not, the input file re-used this qtable slot.
- * IJG encoder currently cannot duplicate this.
- */
- tblno = outcomp->quant_tbl_no;
- if (tblno < 0 || tblno >= NUM_QUANT_TBLS ||
- srcinfo->quant_tbl_ptrs[tblno] == NULL)
- ERREXIT1(dstinfo, JERR_NO_QUANT_TABLE, tblno);
- slot_quant = srcinfo->quant_tbl_ptrs[tblno];
- c_quant = incomp->quant_table;
- if (c_quant != NULL) {
- for (coefi = 0; coefi < DCTSIZE2; coefi++) {
- if (c_quant->quantval[coefi] != slot_quant->quantval[coefi])
- ERREXIT1(dstinfo, JERR_MISMATCHED_QUANT_TABLE, tblno);
- }
- }
- /* Note: we do not copy the source's Huffman table assignments;
- * instead we rely on jpeg_set_colorspace to have made a suitable choice.
- */
- }
- /* Also copy JFIF version and resolution information, if available.
- * Strictly speaking this isn't "critical" info, but it's nearly
- * always appropriate to copy it if available. In particular,
- * if the application chooses to copy JFIF 1.02 extension markers from
- * the source file, we need to copy the version to make sure we don't
- * emit a file that has 1.02 extensions but a claimed version of 1.01.
- * We will *not*, however, copy version info from mislabeled "2.01" files.
- */
- if (srcinfo->saw_JFIF_marker) {
- if (srcinfo->JFIF_major_version == 1) {
- dstinfo->JFIF_major_version = srcinfo->JFIF_major_version;
- dstinfo->JFIF_minor_version = srcinfo->JFIF_minor_version;
- }
- dstinfo->density_unit = srcinfo->density_unit;
- dstinfo->X_density = srcinfo->X_density;
- dstinfo->Y_density = srcinfo->Y_density;
- }
-}
-
-
-/*
- * Master selection of compression modules for transcoding.
- * This substitutes for jcinit.c's initialization of the full compressor.
- */
-
-LOCAL(void)
-transencode_master_selection (j_compress_ptr cinfo,
- jvirt_barray_ptr * coef_arrays)
-{
- /* Although we don't actually use input_components for transcoding,
- * jcmaster.c's initial_setup will complain if input_components is 0.
- */
- cinfo->input_components = 1;
- /* Initialize master control (includes parameter checking/processing) */
- jinit_c_master_control(cinfo, TRUE /* transcode only */);
-
- /* Entropy encoding: either Huffman or arithmetic coding. */
- if (cinfo->arith_code) {
- ERREXIT(cinfo, JERR_ARITH_NOTIMPL);
- } else {
- if (cinfo->progressive_mode) {
-#ifdef C_PROGRESSIVE_SUPPORTED
- jinit_phuff_encoder(cinfo);
-#else
- ERREXIT(cinfo, JERR_NOT_COMPILED);
-#endif
- } else
- jinit_huff_encoder(cinfo);
- }
-
- /* We need a special coefficient buffer controller. */
- transencode_coef_controller(cinfo, coef_arrays);
-
- jinit_marker_writer(cinfo);
-
- /* We can now tell the memory manager to allocate virtual arrays. */
- (*cinfo->mem->realize_virt_arrays) ((j_common_ptr) cinfo);
-
- /* Write the datastream header (SOI, JFIF) immediately.
- * Frame and scan headers are postponed till later.
- * This lets application insert special markers after the SOI.
- */
- (*cinfo->marker->write_file_header) (cinfo);
-}
-
-
-/*
- * The rest of this file is a special implementation of the coefficient
- * buffer controller. This is similar to jccoefct.c, but it handles only
- * output from presupplied virtual arrays. Furthermore, we generate any
- * dummy padding blocks on-the-fly rather than expecting them to be present
- * in the arrays.
- */
-
-/* Private buffer controller object */
-
-typedef struct {
- struct jpeg_c_coef_controller pub; /* public fields */
-
- JDIMENSION iMCU_row_num; /* iMCU row # within image */
- JDIMENSION mcu_ctr; /* counts MCUs processed in current row */
- int MCU_vert_offset; /* counts MCU rows within iMCU row */
- int MCU_rows_per_iMCU_row; /* number of such rows needed */
-
- /* Virtual block array for each component. */
- jvirt_barray_ptr * whole_image;
-
- /* Workspace for constructing dummy blocks at right/bottom edges. */
- JBLOCKROW dummy_buffer[C_MAX_BLOCKS_IN_MCU];
-} my_coef_controller;
-
-typedef my_coef_controller * my_coef_ptr;
-
-
-LOCAL(void)
-start_iMCU_row (j_compress_ptr cinfo)
-/* Reset within-iMCU-row counters for a new row */
-{
- my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
-
- /* In an interleaved scan, an MCU row is the same as an iMCU row.
- * In a noninterleaved scan, an iMCU row has v_samp_factor MCU rows.
- * But at the bottom of the image, process only what's left.
- */
- if (cinfo->comps_in_scan > 1) {
- coef->MCU_rows_per_iMCU_row = 1;
- } else {
- if (coef->iMCU_row_num < (cinfo->total_iMCU_rows-1))
- coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor;
- else
- coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height;
- }
-
- coef->mcu_ctr = 0;
- coef->MCU_vert_offset = 0;
-}
-
-
-/*
- * Initialize for a processing pass.
- */
-
-METHODDEF(void)
-start_pass_coef (j_compress_ptr cinfo, J_BUF_MODE pass_mode)
-{
- my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
-
- if (pass_mode != JBUF_CRANK_DEST)
- ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
-
- coef->iMCU_row_num = 0;
- start_iMCU_row(cinfo);
-}
-
-
-/*
- * Process some data.
- * We process the equivalent of one fully interleaved MCU row ("iMCU" row)
- * per call, ie, v_samp_factor block rows for each component in the scan.
- * The data is obtained from the virtual arrays and fed to the entropy coder.
- * Returns TRUE if the iMCU row is completed, FALSE if suspended.
- *
- * NB: input_buf is ignored; it is likely to be a NULL pointer.
- */
-
-METHODDEF(boolean)
-compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
-{
- my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
- JDIMENSION MCU_col_num; /* index of current MCU within row */
- JDIMENSION last_MCU_col = cinfo->MCUs_per_row - 1;
- JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
- int blkn, ci, xindex, yindex, yoffset, blockcnt;
- JDIMENSION start_col;
- JBLOCKARRAY buffer[MAX_COMPS_IN_SCAN];
- JBLOCKROW MCU_buffer[C_MAX_BLOCKS_IN_MCU];
- JBLOCKROW buffer_ptr;
- jpeg_component_info *compptr;
-
- /* Align the virtual buffers for the components used in this scan. */
- for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
- compptr = cinfo->cur_comp_info[ci];
- buffer[ci] = (*cinfo->mem->access_virt_barray)
- ((j_common_ptr) cinfo, coef->whole_image[compptr->component_index],
- coef->iMCU_row_num * compptr->v_samp_factor,
- (JDIMENSION) compptr->v_samp_factor, FALSE);
- }
-
- /* Loop to process one whole iMCU row */
- for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
- yoffset++) {
- for (MCU_col_num = coef->mcu_ctr; MCU_col_num < cinfo->MCUs_per_row;
- MCU_col_num++) {
- /* Construct list of pointers to DCT blocks belonging to this MCU */
- blkn = 0; /* index of current DCT block within MCU */
- for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
- compptr = cinfo->cur_comp_info[ci];
- start_col = MCU_col_num * compptr->MCU_width;
- blockcnt = (MCU_col_num < last_MCU_col) ? compptr->MCU_width
- : compptr->last_col_width;
- for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
- if (coef->iMCU_row_num < last_iMCU_row ||
- yindex+yoffset < compptr->last_row_height) {
- /* Fill in pointers to real blocks in this row */
- buffer_ptr = buffer[ci][yindex+yoffset] + start_col;
- for (xindex = 0; xindex < blockcnt; xindex++)
- MCU_buffer[blkn++] = buffer_ptr++;
- } else {
- /* At bottom of image, need a whole row of dummy blocks */
- xindex = 0;
- }
- /* Fill in any dummy blocks needed in this row.
- * Dummy blocks are filled in the same way as in jccoefct.c:
- * all zeroes in the AC entries, DC entries equal to previous
- * block's DC value. The init routine has already zeroed the
- * AC entries, so we need only set the DC entries correctly.
- */
- for (; xindex < compptr->MCU_width; xindex++) {
- MCU_buffer[blkn] = coef->dummy_buffer[blkn];
- MCU_buffer[blkn][0][0] = MCU_buffer[blkn-1][0][0];
- blkn++;
- }
- }
- }
- /* Try to write the MCU. */
- if (! (*cinfo->entropy->encode_mcu) (cinfo, MCU_buffer)) {
- /* Suspension forced; update state counters and exit */
- coef->MCU_vert_offset = yoffset;
- coef->mcu_ctr = MCU_col_num;
- return FALSE;
- }
- }
- /* Completed an MCU row, but perhaps not an iMCU row */
- coef->mcu_ctr = 0;
- }
- /* Completed the iMCU row, advance counters for next one */
- coef->iMCU_row_num++;
- start_iMCU_row(cinfo);
- return TRUE;
-}
-
-
-/*
- * Initialize coefficient buffer controller.
- *
- * Each passed coefficient array must be the right size for that
- * coefficient: width_in_blocks wide and height_in_blocks high,
- * with unitheight at least v_samp_factor.
- */
-
-LOCAL(void)
-transencode_coef_controller (j_compress_ptr cinfo,
- jvirt_barray_ptr * coef_arrays)
-{
- my_coef_ptr coef;
- JBLOCKROW buffer;
- int i;
-
- coef = (my_coef_ptr)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- SIZEOF(my_coef_controller));
- cinfo->coef = (struct jpeg_c_coef_controller *) coef;
- coef->pub.start_pass = start_pass_coef;
- coef->pub.compress_data = compress_output;
-
- /* Save pointer to virtual arrays */
- coef->whole_image = coef_arrays;
-
- /* Allocate and pre-zero space for dummy DCT blocks. */
- buffer = (JBLOCKROW)
- (*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- C_MAX_BLOCKS_IN_MCU * SIZEOF(JBLOCK));
- jzero_far((void FAR *) buffer, C_MAX_BLOCKS_IN_MCU * SIZEOF(JBLOCK));
- for (i = 0; i < C_MAX_BLOCKS_IN_MCU; i++) {
- coef->dummy_buffer[i] = buffer + i;
- }
-}
diff --git a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jdapimin.c b/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jdapimin.c
deleted file mode 100644
index cadb59fce3a..00000000000
--- a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jdapimin.c
+++ /dev/null
@@ -1,395 +0,0 @@
-/*
- * jdapimin.c
- *
- * Copyright (C) 1994-1998, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file contains application interface code for the decompression half
- * of the JPEG library. These are the "minimum" API routines that may be
- * needed in either the normal full-decompression case or the
- * transcoding-only case.
- *
- * Most of the routines intended to be called directly by an application
- * are in this file or in jdapistd.c. But also see jcomapi.c for routines
- * shared by compression and decompression, and jdtrans.c for the transcoding
- * case.
- */
-
-#define JPEG_INTERNALS
-#include "jinclude.h"
-#include "jpeglib.h"
-
-
-/*
- * Initialization of a JPEG decompression object.
- * The error manager must already be set up (in case memory manager fails).
- */
-
-GLOBAL(void)
-jpeg_CreateDecompress (j_decompress_ptr cinfo, int version, size_t structsize)
-{
- int i;
-
- /* Guard against version mismatches between library and caller. */
- cinfo->mem = NULL; /* so jpeg_destroy knows mem mgr not called */
- if (version != JPEG_LIB_VERSION)
- ERREXIT2(cinfo, JERR_BAD_LIB_VERSION, JPEG_LIB_VERSION, version);
- if (structsize != SIZEOF(struct jpeg_decompress_struct))
- ERREXIT2(cinfo, JERR_BAD_STRUCT_SIZE,
- (int) SIZEOF(struct jpeg_decompress_struct), (int) structsize);
-
- /* For debugging purposes, we zero the whole master structure.
- * But the application has already set the err pointer, and may have set
- * client_data, so we have to save and restore those fields.
- * Note: if application hasn't set client_data, tools like Purify may
- * complain here.
- */
- {
- struct jpeg_error_mgr * err = cinfo->err;
- void * client_data = cinfo->client_data; /* ignore Purify complaint here */
- MEMZERO(cinfo, SIZEOF(struct jpeg_decompress_struct));
- cinfo->err = err;
- cinfo->client_data = client_data;
- }
- cinfo->is_decompressor = TRUE;
-
- /* Initialize a memory manager instance for this object */
- jinit_memory_mgr((j_common_ptr) cinfo);
-
- /* Zero out pointers to permanent structures. */
- cinfo->progress = NULL;
- cinfo->src = NULL;
-
- for (i = 0; i < NUM_QUANT_TBLS; i++)
- cinfo->quant_tbl_ptrs[i] = NULL;
-
- for (i = 0; i < NUM_HUFF_TBLS; i++) {
- cinfo->dc_huff_tbl_ptrs[i] = NULL;
- cinfo->ac_huff_tbl_ptrs[i] = NULL;
- }
-
- /* Initialize marker processor so application can override methods
- * for COM, APPn markers before calling jpeg_read_header.
- */
- cinfo->marker_list = NULL;
- jinit_marker_reader(cinfo);
-
- /* And initialize the overall input controller. */
- jinit_input_controller(cinfo);
-
- /* OK, I'm ready */
- cinfo->global_state = DSTATE_START;
-}
-
-
-/*
- * Destruction of a JPEG decompression object
- */
-
-GLOBAL(void)
-jpeg_destroy_decompress (j_decompress_ptr cinfo)
-{
- jpeg_destroy((j_common_ptr) cinfo); /* use common routine */
-}
-
-
-/*
- * Abort processing of a JPEG decompression operation,
- * but don't destroy the object itself.
- */
-
-GLOBAL(void)
-jpeg_abort_decompress (j_decompress_ptr cinfo)
-{
- jpeg_abort((j_common_ptr) cinfo); /* use common routine */
-}
-
-
-/*
- * Set default decompression parameters.
- */
-
-LOCAL(void)
-default_decompress_parms (j_decompress_ptr cinfo)
-{
- /* Guess the input colorspace, and set output colorspace accordingly. */
- /* (Wish JPEG committee had provided a real way to specify this...) */
- /* Note application may override our guesses. */
- switch (cinfo->num_components) {
- case 1:
- cinfo->jpeg_color_space = JCS_GRAYSCALE;
- cinfo->out_color_space = JCS_GRAYSCALE;
- break;
-
- case 3:
- if (cinfo->saw_JFIF_marker) {
- cinfo->jpeg_color_space = JCS_YCbCr; /* JFIF implies YCbCr */
- } else if (cinfo->saw_Adobe_marker) {
- switch (cinfo->Adobe_transform) {
- case 0:
- cinfo->jpeg_color_space = JCS_RGB;
- break;
- case 1:
- cinfo->jpeg_color_space = JCS_YCbCr;
- break;
- default:
- WARNMS1(cinfo, JWRN_ADOBE_XFORM, cinfo->Adobe_transform);
- cinfo->jpeg_color_space = JCS_YCbCr; /* assume it's YCbCr */
- break;
- }
- } else {
- /* Saw no special markers, try to guess from the component IDs */
- int cid0 = cinfo->comp_info[0].component_id;
- int cid1 = cinfo->comp_info[1].component_id;
- int cid2 = cinfo->comp_info[2].component_id;
-
- if (cid0 == 1 && cid1 == 2 && cid2 == 3)
- cinfo->jpeg_color_space = JCS_YCbCr; /* assume JFIF w/out marker */
- else if (cid0 == 82 && cid1 == 71 && cid2 == 66)
- cinfo->jpeg_color_space = JCS_RGB; /* ASCII 'R', 'G', 'B' */
- else {
- TRACEMS3(cinfo, 1, JTRC_UNKNOWN_IDS, cid0, cid1, cid2);
- cinfo->jpeg_color_space = JCS_YCbCr; /* assume it's YCbCr */
- }
- }
- /* Always guess RGB is proper output colorspace. */
- cinfo->out_color_space = JCS_RGB;
- break;
-
- case 4:
- if (cinfo->saw_Adobe_marker) {
- switch (cinfo->Adobe_transform) {
- case 0:
- cinfo->jpeg_color_space = JCS_CMYK;
- break;
- case 2:
- cinfo->jpeg_color_space = JCS_YCCK;
- break;
- default:
- WARNMS1(cinfo, JWRN_ADOBE_XFORM, cinfo->Adobe_transform);
- cinfo->jpeg_color_space = JCS_YCCK; /* assume it's YCCK */
- break;
- }
- } else {
- /* No special markers, assume straight CMYK. */
- cinfo->jpeg_color_space = JCS_CMYK;
- }
- cinfo->out_color_space = JCS_CMYK;
- break;
-
- default:
- cinfo->jpeg_color_space = JCS_UNKNOWN;
- cinfo->out_color_space = JCS_UNKNOWN;
- break;
- }
-
- /* Set defaults for other decompression parameters. */
- cinfo->scale_num = 1; /* 1:1 scaling */
- cinfo->scale_denom = 1;
- cinfo->output_gamma = 1.0;
- cinfo->buffered_image = FALSE;
- cinfo->raw_data_out = FALSE;
- cinfo->dct_method = JDCT_DEFAULT;
- cinfo->do_fancy_upsampling = TRUE;
- cinfo->do_block_smoothing = TRUE;
- cinfo->quantize_colors = FALSE;
- /* We set these in case application only sets quantize_colors. */
- cinfo->dither_mode = JDITHER_FS;
-#ifdef QUANT_2PASS_SUPPORTED
- cinfo->two_pass_quantize = TRUE;
-#else
- cinfo->two_pass_quantize = FALSE;
-#endif
- cinfo->desired_number_of_colors = 256;
- cinfo->colormap = NULL;
- /* Initialize for no mode change in buffered-image mode. */
- cinfo->enable_1pass_quant = FALSE;
- cinfo->enable_external_quant = FALSE;
- cinfo->enable_2pass_quant = FALSE;
-}
-
-
-/*
- * Decompression startup: read start of JPEG datastream to see what's there.
- * Need only initialize JPEG object and supply a data source before calling.
- *
- * This routine will read as far as the first SOS marker (ie, actual start of
- * compressed data), and will save all tables and parameters in the JPEG
- * object. It will also initialize the decompression parameters to default
- * values, and finally return JPEG_HEADER_OK. On return, the application may
- * adjust the decompression parameters and then call jpeg_start_decompress.
- * (Or, if the application only wanted to determine the image parameters,
- * the data need not be decompressed. In that case, call jpeg_abort or
- * jpeg_destroy to release any temporary space.)
- * If an abbreviated (tables only) datastream is presented, the routine will
- * return JPEG_HEADER_TABLES_ONLY upon reaching EOI. The application may then
- * re-use the JPEG object to read the abbreviated image datastream(s).
- * It is unnecessary (but OK) to call jpeg_abort in this case.
- * The JPEG_SUSPENDED return code only occurs if the data source module
- * requests suspension of the decompressor. In this case the application
- * should load more source data and then re-call jpeg_read_header to resume
- * processing.
- * If a non-suspending data source is used and require_image is TRUE, then the
- * return code need not be inspected since only JPEG_HEADER_OK is possible.
- *
- * This routine is now just a front end to jpeg_consume_input, with some
- * extra error checking.
- */
-
-GLOBAL(int)
-jpeg_read_header (j_decompress_ptr cinfo, boolean require_image)
-{
- int retcode;
-
- if (cinfo->global_state != DSTATE_START &&
- cinfo->global_state != DSTATE_INHEADER)
- ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
-
- retcode = jpeg_consume_input(cinfo);
-
- switch (retcode) {
- case JPEG_REACHED_SOS:
- retcode = JPEG_HEADER_OK;
- break;
- case JPEG_REACHED_EOI:
- if (require_image) /* Complain if application wanted an image */
- ERREXIT(cinfo, JERR_NO_IMAGE);
- /* Reset to start state; it would be safer to require the application to
- * call jpeg_abort, but we can't change it now for compatibility reasons.
- * A side effect is to free any temporary memory (there shouldn't be any).
- */
- jpeg_abort((j_common_ptr) cinfo); /* sets state = DSTATE_START */
- retcode = JPEG_HEADER_TABLES_ONLY;
- break;
- case JPEG_SUSPENDED:
- /* no work */
- break;
- }
-
- return retcode;
-}
-
-
-/*
- * Consume data in advance of what the decompressor requires.
- * This can be called at any time once the decompressor object has
- * been created and a data source has been set up.
- *
- * This routine is essentially a state machine that handles a couple
- * of critical state-transition actions, namely initial setup and
- * transition from header scanning to ready-for-start_decompress.
- * All the actual input is done via the input controller's consume_input
- * method.
- */
-
-GLOBAL(int)
-jpeg_consume_input (j_decompress_ptr cinfo)
-{
- int retcode = JPEG_SUSPENDED;
-
- /* NB: every possible DSTATE value should be listed in this switch */
- switch (cinfo->global_state) {
- case DSTATE_START:
- /* Start-of-datastream actions: reset appropriate modules */
- (*cinfo->inputctl->reset_input_controller) (cinfo);
- /* Initialize application's data source module */
- (*cinfo->src->init_source) (cinfo);
- cinfo->global_state = DSTATE_INHEADER;
- /*FALLTHROUGH*/
- case DSTATE_INHEADER:
- retcode = (*cinfo->inputctl->consume_input) (cinfo);
- if (retcode == JPEG_REACHED_SOS) { /* Found SOS, prepare to decompress */
- /* Set up default parameters based on header data */
- default_decompress_parms(cinfo);
- /* Set global state: ready for start_decompress */
- cinfo->global_state = DSTATE_READY;
- }
- break;
- case DSTATE_READY:
- /* Can't advance past first SOS until start_decompress is called */
- retcode = JPEG_REACHED_SOS;
- break;
- case DSTATE_PRELOAD:
- case DSTATE_PRESCAN:
- case DSTATE_SCANNING:
- case DSTATE_RAW_OK:
- case DSTATE_BUFIMAGE:
- case DSTATE_BUFPOST:
- case DSTATE_STOPPING:
- retcode = (*cinfo->inputctl->consume_input) (cinfo);
- break;
- default:
- ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
- }
- return retcode;
-}
-
-
-/*
- * Have we finished reading the input file?
- */
-
-GLOBAL(boolean)
-jpeg_input_complete (j_decompress_ptr cinfo)
-{
- /* Check for valid jpeg object */
- if (cinfo->global_state < DSTATE_START ||
- cinfo->global_state > DSTATE_STOPPING)
- ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
- return cinfo->inputctl->eoi_reached;
-}
-
-
-/*
- * Is there more than one scan?
- */
-
-GLOBAL(boolean)
-jpeg_has_multiple_scans (j_decompress_ptr cinfo)
-{
- /* Only valid after jpeg_read_header completes */
- if (cinfo->global_state < DSTATE_READY ||
- cinfo->global_state > DSTATE_STOPPING)
- ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
- return cinfo->inputctl->has_multiple_scans;
-}
-
-
-/*
- * Finish JPEG decompression.
- *
- * This will normally just verify the file trailer and release temp storage.
- *
- * Returns FALSE if suspended. The return value need be inspected only if
- * a suspending data source is used.
- */
-
-GLOBAL(boolean)
-jpeg_finish_decompress (j_decompress_ptr cinfo)
-{
- if ((cinfo->global_state == DSTATE_SCANNING ||
- cinfo->global_state == DSTATE_RAW_OK) && ! cinfo->buffered_image) {
- /* Terminate final pass of non-buffered mode */
- if (cinfo->output_scanline < cinfo->output_height)
- ERREXIT(cinfo, JERR_TOO_LITTLE_DATA);
- (*cinfo->master->finish_output_pass) (cinfo);
- cinfo->global_state = DSTATE_STOPPING;
- } else if (cinfo->global_state == DSTATE_BUFIMAGE) {
- /* Finishing after a buffered-image operation */
- cinfo->global_state = DSTATE_STOPPING;
- } else if (cinfo->global_state != DSTATE_STOPPING) {
- /* STOPPING = repeat call after a suspension, anything else is error */
- ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
- }
- /* Read until EOI */
- while (! cinfo->inputctl->eoi_reached) {
- if ((*cinfo->inputctl->consume_input) (cinfo) == JPEG_SUSPENDED)
- return FALSE; /* Suspend, come back later */
- }
- /* Do final cleanup */
- (*cinfo->src->term_source) (cinfo);
- /* We can use jpeg_abort to release memory and reset global_state */
- jpeg_abort((j_common_ptr) cinfo);
- return TRUE;
-}
diff --git a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jdapistd.c b/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jdapistd.c
deleted file mode 100644
index 39bbb969bf9..00000000000
--- a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jdapistd.c
+++ /dev/null
@@ -1,276 +0,0 @@
-/*
- * jdapistd.c
- *
- * Copyright (C) 1994-1996, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file contains application interface code for the decompression half
- * of the JPEG library. These are the "standard" API routines that are
- * used in the normal full-decompression case. They are not used by a
- * transcoding-only application. Note that if an application links in
- * jpeg_start_decompress, it will end up linking in the entire decompressor.
- * We thus must separate this file from jdapimin.c to avoid linking the
- * whole decompression library into a transcoder.
- */
-
-#define JPEG_INTERNALS
-#include "jinclude.h"
-#include "jpeglib.h"
-
-
-/* Forward declarations */
-LOCAL(boolean) output_pass_setup JPP((j_decompress_ptr cinfo));
-
-
-/*
- * Decompression initialization.
- * jpeg_read_header must be completed before calling this.
- *
- * If a multipass operating mode was selected, this will do all but the
- * last pass, and thus may take a great deal of time.
- *
- * Returns FALSE if suspended. The return value need be inspected only if
- * a suspending data source is used.
- */
-
-GLOBAL(boolean)
-jpeg_start_decompress (j_decompress_ptr cinfo)
-{
- if (cinfo->global_state == DSTATE_READY) {
- /* First call: initialize master control, select active modules */
- jinit_master_decompress(cinfo);
- if (cinfo->buffered_image) {
- /* No more work here; expecting jpeg_start_output next */
- cinfo->global_state = DSTATE_BUFIMAGE;
- return TRUE;
- }
- cinfo->global_state = DSTATE_PRELOAD;
- }
- if (cinfo->global_state == DSTATE_PRELOAD) {
- /* If file has multiple scans, absorb them all into the coef buffer */
- if (cinfo->inputctl->has_multiple_scans) {
-#ifdef D_MULTISCAN_FILES_SUPPORTED
- for (;;) {
- int retcode;
- /* Call progress monitor hook if present */
- if (cinfo->progress != NULL)
- (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);
- /* Absorb some more input */
- retcode = (*cinfo->inputctl->consume_input) (cinfo);
- if (retcode == JPEG_SUSPENDED)
- return FALSE;
- if (retcode == JPEG_REACHED_EOI)
- break;
- /* Advance progress counter if appropriate */
- if (cinfo->progress != NULL &&
- (retcode == JPEG_ROW_COMPLETED || retcode == JPEG_REACHED_SOS)) {
- if (++cinfo->progress->pass_counter >= cinfo->progress->pass_limit) {
- /* jdmaster underestimated number of scans; ratchet up one scan */
- cinfo->progress->pass_limit += (long) cinfo->total_iMCU_rows;
- }
- }
- }
-#else
- ERREXIT(cinfo, JERR_NOT_COMPILED);
-#endif /* D_MULTISCAN_FILES_SUPPORTED */
- }
- cinfo->output_scan_number = cinfo->input_scan_number;
- } else if (cinfo->global_state != DSTATE_PRESCAN)
- ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
- /* Perform any dummy output passes, and set up for the final pass */
- return output_pass_setup(cinfo);
-}
-
-
-/*
- * Set up for an output pass, and perform any dummy pass(es) needed.
- * Common subroutine for jpeg_start_decompress and jpeg_start_output.
- * Entry: global_state = DSTATE_PRESCAN only if previously suspended.
- * Exit: If done, returns TRUE and sets global_state for proper output mode.
- * If suspended, returns FALSE and sets global_state = DSTATE_PRESCAN.
- */
-
-LOCAL(boolean)
-output_pass_setup (j_decompress_ptr cinfo)
-{
- if (cinfo->global_state != DSTATE_PRESCAN) {
- /* First call: do pass setup */
- (*cinfo->master->prepare_for_output_pass) (cinfo);
- cinfo->output_scanline = 0;
- cinfo->global_state = DSTATE_PRESCAN;
- }
- /* Loop over any required dummy passes */
- while (cinfo->master->is_dummy_pass) {
-#ifdef QUANT_2PASS_SUPPORTED
- /* Crank through the dummy pass */
- while (cinfo->output_scanline < cinfo->output_height) {
- JDIMENSION last_scanline;
- /* Call progress monitor hook if present */
- if (cinfo->progress != NULL) {
- cinfo->progress->pass_counter = (long) cinfo->output_scanline;
- cinfo->progress->pass_limit = (long) cinfo->output_height;
- (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);
- }
- /* Process some data */
- last_scanline = cinfo->output_scanline;
- (*cinfo->main->process_data) (cinfo, (JSAMPARRAY) NULL,
- &cinfo->output_scanline, (JDIMENSION) 0);
- if (cinfo->output_scanline == last_scanline)
- return FALSE; /* No progress made, must suspend */
- }
- /* Finish up dummy pass, and set up for another one */
- (*cinfo->master->finish_output_pass) (cinfo);
- (*cinfo->master->prepare_for_output_pass) (cinfo);
- cinfo->output_scanline = 0;
-#else
- ERREXIT(cinfo, JERR_NOT_COMPILED);
-#endif /* QUANT_2PASS_SUPPORTED */
- }
- /* Ready for application to drive output pass through
- * jpeg_read_scanlines or jpeg_read_raw_data.
- */
- cinfo->global_state = cinfo->raw_data_out ? DSTATE_RAW_OK : DSTATE_SCANNING;
- return TRUE;
-}
-
-
-/*
- * Read some scanlines of data from the JPEG decompressor.
- *
- * The return value will be the number of lines actually read.
- * This may be less than the number requested in several cases,
- * including bottom of image, data source suspension, and operating
- * modes that emit multiple scanlines at a time.
- *
- * Note: we warn about excess calls to jpeg_read_scanlines() since
- * this likely signals an application programmer error. However,
- * an oversize buffer (max_lines > scanlines remaining) is not an error.
- */
-
-GLOBAL(JDIMENSION)
-jpeg_read_scanlines (j_decompress_ptr cinfo, JSAMPARRAY scanlines,
- JDIMENSION max_lines)
-{
- JDIMENSION row_ctr;
-
- if (cinfo->global_state != DSTATE_SCANNING)
- return 0; /* XYQ 2010-6-27: don't throw exception here */
-/* ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); */
- if (cinfo->output_scanline >= cinfo->output_height) {
- WARNMS(cinfo, JWRN_TOO_MUCH_DATA);
- return 0;
- }
-
- /* Call progress monitor hook if present */
- if (cinfo->progress != NULL) {
- cinfo->progress->pass_counter = (long) cinfo->output_scanline;
- cinfo->progress->pass_limit = (long) cinfo->output_height;
- (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);
- }
-
- /* Process some data */
- row_ctr = 0;
- (*cinfo->main->process_data) (cinfo, scanlines, &row_ctr, max_lines);
- cinfo->output_scanline += row_ctr;
- return row_ctr;
-}
-
-
-/*
- * Alternate entry point to read raw data.
- * Processes exactly one iMCU row per call, unless suspended.
- */
-
-GLOBAL(JDIMENSION)
-jpeg_read_raw_data (j_decompress_ptr cinfo, JSAMPIMAGE data,
- JDIMENSION max_lines)
-{
- JDIMENSION lines_per_iMCU_row;
-
- if (cinfo->global_state != DSTATE_RAW_OK)
- ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
- if (cinfo->output_scanline >= cinfo->output_height) {
- WARNMS(cinfo, JWRN_TOO_MUCH_DATA);
- return 0;
- }
-
- /* Call progress monitor hook if present */
- if (cinfo->progress != NULL) {
- cinfo->progress->pass_counter = (long) cinfo->output_scanline;
- cinfo->progress->pass_limit = (long) cinfo->output_height;
- (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);
- }
-
- /* Verify that at least one iMCU row can be returned. */
- lines_per_iMCU_row = cinfo->max_v_samp_factor * cinfo->min_DCT_scaled_size;
- if (max_lines < lines_per_iMCU_row)
- ERREXIT(cinfo, JERR_BUFFER_SIZE);
-
- /* Decompress directly into user's buffer. */
- if (! (*cinfo->coef->decompress_data) (cinfo, data))
- return 0; /* suspension forced, can do nothing more */
-
- /* OK, we processed one iMCU row. */
- cinfo->output_scanline += lines_per_iMCU_row;
- return lines_per_iMCU_row;
-}
-
-
-/* Additional entry points for buffered-image mode. */
-
-#ifdef D_MULTISCAN_FILES_SUPPORTED
-
-/*
- * Initialize for an output pass in buffered-image mode.
- */
-
-GLOBAL(boolean)
-jpeg_start_output (j_decompress_ptr cinfo, int scan_number)
-{
- if (cinfo->global_state != DSTATE_BUFIMAGE &&
- cinfo->global_state != DSTATE_PRESCAN)
- ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
- /* Limit scan number to valid range */
- if (scan_number <= 0)
- scan_number = 1;
- if (cinfo->inputctl->eoi_reached &&
- scan_number > cinfo->input_scan_number)
- scan_number = cinfo->input_scan_number;
- cinfo->output_scan_number = scan_number;
- /* Perform any dummy output passes, and set up for the real pass */
- return output_pass_setup(cinfo);
-}
-
-
-/*
- * Finish up after an output pass in buffered-image mode.
- *
- * Returns FALSE if suspended. The return value need be inspected only if
- * a suspending data source is used.
- */
-
-GLOBAL(boolean)
-jpeg_finish_output (j_decompress_ptr cinfo)
-{
- if ((cinfo->global_state == DSTATE_SCANNING ||
- cinfo->global_state == DSTATE_RAW_OK) && cinfo->buffered_image) {
- /* Terminate this pass. */
- /* We do not require the whole pass to have been completed. */
- (*cinfo->master->finish_output_pass) (cinfo);
- cinfo->global_state = DSTATE_BUFPOST;
- } else if (cinfo->global_state != DSTATE_BUFPOST) {
- /* BUFPOST = repeat call after a suspension, anything else is error */
- ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
- }
- /* Read markers looking for SOS or EOI */
- while (cinfo->input_scan_number <= cinfo->output_scan_number &&
- ! cinfo->inputctl->eoi_reached) {
- if ((*cinfo->inputctl->consume_input) (cinfo) == JPEG_SUSPENDED)
- return FALSE; /* Suspend, come back later */
- }
- cinfo->global_state = DSTATE_BUFIMAGE;
- return TRUE;
-}
-
-#endif /* D_MULTISCAN_FILES_SUPPORTED */
diff --git a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jdcoefct.c b/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jdcoefct.c
deleted file mode 100644
index 4938d20fcb6..00000000000
--- a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jdcoefct.c
+++ /dev/null
@@ -1,736 +0,0 @@
-/*
- * jdcoefct.c
- *
- * Copyright (C) 1994-1997, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file contains the coefficient buffer controller for decompression.
- * This controller is the top level of the JPEG decompressor proper.
- * The coefficient buffer lies between entropy decoding and inverse-DCT steps.
- *
- * In buffered-image mode, this controller is the interface between
- * input-oriented processing and output-oriented processing.
- * Also, the input side (only) is used when reading a file for transcoding.
- */
-
-#define JPEG_INTERNALS
-#include "jinclude.h"
-#include "jpeglib.h"
-
-/* Block smoothing is only applicable for progressive JPEG, so: */
-#ifndef D_PROGRESSIVE_SUPPORTED
-#undef BLOCK_SMOOTHING_SUPPORTED
-#endif
-
-/* Private buffer controller object */
-
-typedef struct {
- struct jpeg_d_coef_controller pub; /* public fields */
-
- /* These variables keep track of the current location of the input side. */
- /* cinfo->input_iMCU_row is also used for this. */
- JDIMENSION MCU_ctr; /* counts MCUs processed in current row */
- int MCU_vert_offset; /* counts MCU rows within iMCU row */
- int MCU_rows_per_iMCU_row; /* number of such rows needed */
-
- /* The output side's location is represented by cinfo->output_iMCU_row. */
-
- /* In single-pass modes, it's sufficient to buffer just one MCU.
- * We allocate a workspace of D_MAX_BLOCKS_IN_MCU coefficient blocks,
- * and let the entropy decoder write into that workspace each time.
- * (On 80x86, the workspace is FAR even though it's not really very big;
- * this is to keep the module interfaces unchanged when a large coefficient
- * buffer is necessary.)
- * In multi-pass modes, this array points to the current MCU's blocks
- * within the virtual arrays; it is used only by the input side.
- */
- JBLOCKROW MCU_buffer[D_MAX_BLOCKS_IN_MCU];
-
-#ifdef D_MULTISCAN_FILES_SUPPORTED
- /* In multi-pass modes, we need a virtual block array for each component. */
- jvirt_barray_ptr whole_image[MAX_COMPONENTS];
-#endif
-
-#ifdef BLOCK_SMOOTHING_SUPPORTED
- /* When doing block smoothing, we latch coefficient Al values here */
- int * coef_bits_latch;
-#define SAVED_COEFS 6 /* we save coef_bits[0..5] */
-#endif
-} my_coef_controller;
-
-typedef my_coef_controller * my_coef_ptr;
-
-/* Forward declarations */
-METHODDEF(int) decompress_onepass
- JPP((j_decompress_ptr cinfo, JSAMPIMAGE output_buf));
-#ifdef D_MULTISCAN_FILES_SUPPORTED
-METHODDEF(int) decompress_data
- JPP((j_decompress_ptr cinfo, JSAMPIMAGE output_buf));
-#endif
-#ifdef BLOCK_SMOOTHING_SUPPORTED
-LOCAL(boolean) smoothing_ok JPP((j_decompress_ptr cinfo));
-METHODDEF(int) decompress_smooth_data
- JPP((j_decompress_ptr cinfo, JSAMPIMAGE output_buf));
-#endif
-
-
-LOCAL(void)
-start_iMCU_row (j_decompress_ptr cinfo)
-/* Reset within-iMCU-row counters for a new row (input side) */
-{
- my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
-
- /* In an interleaved scan, an MCU row is the same as an iMCU row.
- * In a noninterleaved scan, an iMCU row has v_samp_factor MCU rows.
- * But at the bottom of the image, process only what's left.
- */
- if (cinfo->comps_in_scan > 1) {
- coef->MCU_rows_per_iMCU_row = 1;
- } else {
- if (cinfo->input_iMCU_row < (cinfo->total_iMCU_rows-1))
- coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor;
- else
- coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height;
- }
-
- coef->MCU_ctr = 0;
- coef->MCU_vert_offset = 0;
-}
-
-
-/*
- * Initialize for an input processing pass.
- */
-
-METHODDEF(void)
-start_input_pass (j_decompress_ptr cinfo)
-{
- cinfo->input_iMCU_row = 0;
- start_iMCU_row(cinfo);
-}
-
-
-/*
- * Initialize for an output processing pass.
- */
-
-METHODDEF(void)
-start_output_pass (j_decompress_ptr cinfo)
-{
-#ifdef BLOCK_SMOOTHING_SUPPORTED
- my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
-
- /* If multipass, check to see whether to use block smoothing on this pass */
- if (coef->pub.coef_arrays != NULL) {
- if (cinfo->do_block_smoothing && smoothing_ok(cinfo))
- coef->pub.decompress_data = decompress_smooth_data;
- else
- coef->pub.decompress_data = decompress_data;
- }
-#endif
- cinfo->output_iMCU_row = 0;
-}
-
-
-/*
- * Decompress and return some data in the single-pass case.
- * Always attempts to emit one fully interleaved MCU row ("iMCU" row).
- * Input and output must run in lockstep since we have only a one-MCU buffer.
- * Return value is JPEG_ROW_COMPLETED, JPEG_SCAN_COMPLETED, or JPEG_SUSPENDED.
- *
- * NB: output_buf contains a plane for each component in image,
- * which we index according to the component's SOF position.
- */
-
-METHODDEF(int)
-decompress_onepass (j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
-{
- my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
- JDIMENSION MCU_col_num; /* index of current MCU within row */
- JDIMENSION last_MCU_col = cinfo->MCUs_per_row - 1;
- JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
- int blkn, ci, xindex, yindex, yoffset, useful_width;
- JSAMPARRAY output_ptr;
- JDIMENSION start_col, output_col;
- jpeg_component_info *compptr;
- inverse_DCT_method_ptr inverse_DCT;
-
- /* Loop to process as much as one whole iMCU row */
- for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
- yoffset++) {
- for (MCU_col_num = coef->MCU_ctr; MCU_col_num <= last_MCU_col;
- MCU_col_num++) {
- /* Try to fetch an MCU. Entropy decoder expects buffer to be zeroed. */
- jzero_far((void FAR *) coef->MCU_buffer[0],
- (size_t) (cinfo->blocks_in_MCU * SIZEOF(JBLOCK)));
- if (! (*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) {
- /* Suspension forced; update state counters and exit */
- coef->MCU_vert_offset = yoffset;
- coef->MCU_ctr = MCU_col_num;
- return JPEG_SUSPENDED;
- }
- /* Determine where data should go in output_buf and do the IDCT thing.
- * We skip dummy blocks at the right and bottom edges (but blkn gets
- * incremented past them!). Note the inner loop relies on having
- * allocated the MCU_buffer[] blocks sequentially.
- */
- blkn = 0; /* index of current DCT block within MCU */
- for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
- compptr = cinfo->cur_comp_info[ci];
- /* Don't bother to IDCT an uninteresting component. */
- if (! compptr->component_needed) {
- blkn += compptr->MCU_blocks;
- continue;
- }
- inverse_DCT = cinfo->idct->inverse_DCT[compptr->component_index];
- useful_width = (MCU_col_num < last_MCU_col) ? compptr->MCU_width
- : compptr->last_col_width;
- output_ptr = output_buf[compptr->component_index] +
- yoffset * compptr->DCT_scaled_size;
- start_col = MCU_col_num * compptr->MCU_sample_width;
- for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
- if (cinfo->input_iMCU_row < last_iMCU_row ||
- yoffset+yindex < compptr->last_row_height) {
- output_col = start_col;
- for (xindex = 0; xindex < useful_width; xindex++) {
- (*inverse_DCT) (cinfo, compptr,
- (JCOEFPTR) coef->MCU_buffer[blkn+xindex],
- output_ptr, output_col);
- output_col += compptr->DCT_scaled_size;
- }
- }
- blkn += compptr->MCU_width;
- output_ptr += compptr->DCT_scaled_size;
- }
- }
- }
- /* Completed an MCU row, but perhaps not an iMCU row */
- coef->MCU_ctr = 0;
- }
- /* Completed the iMCU row, advance counters for next one */
- cinfo->output_iMCU_row++;
- if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) {
- start_iMCU_row(cinfo);
- return JPEG_ROW_COMPLETED;
- }
- /* Completed the scan */
- (*cinfo->inputctl->finish_input_pass) (cinfo);
- return JPEG_SCAN_COMPLETED;
-}
-
-
-/*
- * Dummy consume-input routine for single-pass operation.
- */
-
-METHODDEF(int)
-dummy_consume_data (j_decompress_ptr cinfo)
-{
- return JPEG_SUSPENDED; /* Always indicate nothing was done */
-}
-
-
-#ifdef D_MULTISCAN_FILES_SUPPORTED
-
-/*
- * Consume input data and store it in the full-image coefficient buffer.
- * We read as much as one fully interleaved MCU row ("iMCU" row) per call,
- * ie, v_samp_factor block rows for each component in the scan.
- * Return value is JPEG_ROW_COMPLETED, JPEG_SCAN_COMPLETED, or JPEG_SUSPENDED.
- */
-
-METHODDEF(int)
-consume_data (j_decompress_ptr cinfo)
-{
- my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
- JDIMENSION MCU_col_num; /* index of current MCU within row */
- int blkn, ci, xindex, yindex, yoffset;
- JDIMENSION start_col;
- JBLOCKARRAY buffer[MAX_COMPS_IN_SCAN];
- JBLOCKROW buffer_ptr;
- jpeg_component_info *compptr;
-
- /* Align the virtual buffers for the components used in this scan. */
- for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
- compptr = cinfo->cur_comp_info[ci];
- buffer[ci] = (*cinfo->mem->access_virt_barray)
- ((j_common_ptr) cinfo, coef->whole_image[compptr->component_index],
- cinfo->input_iMCU_row * compptr->v_samp_factor,
- (JDIMENSION) compptr->v_samp_factor, TRUE);
- /* Note: entropy decoder expects buffer to be zeroed,
- * but this is handled automatically by the memory manager
- * because we requested a pre-zeroed array.
- */
- }
-
- /* Loop to process one whole iMCU row */
- for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
- yoffset++) {
- for (MCU_col_num = coef->MCU_ctr; MCU_col_num < cinfo->MCUs_per_row;
- MCU_col_num++) {
- /* Construct list of pointers to DCT blocks belonging to this MCU */
- blkn = 0; /* index of current DCT block within MCU */
- for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
- compptr = cinfo->cur_comp_info[ci];
- start_col = MCU_col_num * compptr->MCU_width;
- for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
- buffer_ptr = buffer[ci][yindex+yoffset] + start_col;
- for (xindex = 0; xindex < compptr->MCU_width; xindex++) {
- coef->MCU_buffer[blkn++] = buffer_ptr++;
- }
- }
- }
- /* Try to fetch the MCU. */
- if (! (*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) {
- /* Suspension forced; update state counters and exit */
- coef->MCU_vert_offset = yoffset;
- coef->MCU_ctr = MCU_col_num;
- return JPEG_SUSPENDED;
- }
- }
- /* Completed an MCU row, but perhaps not an iMCU row */
- coef->MCU_ctr = 0;
- }
- /* Completed the iMCU row, advance counters for next one */
- if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) {
- start_iMCU_row(cinfo);
- return JPEG_ROW_COMPLETED;
- }
- /* Completed the scan */
- (*cinfo->inputctl->finish_input_pass) (cinfo);
- return JPEG_SCAN_COMPLETED;
-}
-
-
-/*
- * Decompress and return some data in the multi-pass case.
- * Always attempts to emit one fully interleaved MCU row ("iMCU" row).
- * Return value is JPEG_ROW_COMPLETED, JPEG_SCAN_COMPLETED, or JPEG_SUSPENDED.
- *
- * NB: output_buf contains a plane for each component in image.
- */
-
-METHODDEF(int)
-decompress_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
-{
- my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
- JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
- JDIMENSION block_num;
- int ci, block_row, block_rows;
- JBLOCKARRAY buffer;
- JBLOCKROW buffer_ptr;
- JSAMPARRAY output_ptr;
- JDIMENSION output_col;
- jpeg_component_info *compptr;
- inverse_DCT_method_ptr inverse_DCT;
-
- /* Force some input to be done if we are getting ahead of the input. */
- while (cinfo->input_scan_number < cinfo->output_scan_number ||
- (cinfo->input_scan_number == cinfo->output_scan_number &&
- cinfo->input_iMCU_row <= cinfo->output_iMCU_row)) {
- if ((*cinfo->inputctl->consume_input)(cinfo) == JPEG_SUSPENDED)
- return JPEG_SUSPENDED;
- }
-
- /* OK, output from the virtual arrays. */
- for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
- ci++, compptr++) {
- /* Don't bother to IDCT an uninteresting component. */
- if (! compptr->component_needed)
- continue;
- /* Align the virtual buffer for this component. */
- buffer = (*cinfo->mem->access_virt_barray)
- ((j_common_ptr) cinfo, coef->whole_image[ci],
- cinfo->output_iMCU_row * compptr->v_samp_factor,
- (JDIMENSION) compptr->v_samp_factor, FALSE);
- /* Count non-dummy DCT block rows in this iMCU row. */
- if (cinfo->output_iMCU_row < last_iMCU_row)
- block_rows = compptr->v_samp_factor;
- else {
- /* NB: can't use last_row_height here; it is input-side-dependent! */
- block_rows = (int) (compptr->height_in_blocks % compptr->v_samp_factor);
- if (block_rows == 0) block_rows = compptr->v_samp_factor;
- }
- inverse_DCT = cinfo->idct->inverse_DCT[ci];
- output_ptr = output_buf[ci];
- /* Loop over all DCT blocks to be processed. */
- for (block_row = 0; block_row < block_rows; block_row++) {
- buffer_ptr = buffer[block_row];
- output_col = 0;
- for (block_num = 0; block_num < compptr->width_in_blocks; block_num++) {
- (*inverse_DCT) (cinfo, compptr, (JCOEFPTR) buffer_ptr,
- output_ptr, output_col);
- buffer_ptr++;
- output_col += compptr->DCT_scaled_size;
- }
- output_ptr += compptr->DCT_scaled_size;
- }
- }
-
- if (++(cinfo->output_iMCU_row) < cinfo->total_iMCU_rows)
- return JPEG_ROW_COMPLETED;
- return JPEG_SCAN_COMPLETED;
-}
-
-#endif /* D_MULTISCAN_FILES_SUPPORTED */
-
-
-#ifdef BLOCK_SMOOTHING_SUPPORTED
-
-/*
- * This code applies interblock smoothing as described by section K.8
- * of the JPEG standard: the first 5 AC coefficients are estimated from
- * the DC values of a DCT block and its 8 neighboring blocks.
- * We apply smoothing only for progressive JPEG decoding, and only if
- * the coefficients it can estimate are not yet known to full precision.
- */
-
-/* Natural-order array positions of the first 5 zigzag-order coefficients */
-#define Q01_POS 1
-#define Q10_POS 8
-#define Q20_POS 16
-#define Q11_POS 9
-#define Q02_POS 2
-
-/*
- * Determine whether block smoothing is applicable and safe.
- * We also latch the current states of the coef_bits[] entries for the
- * AC coefficients; otherwise, if the input side of the decompressor
- * advances into a new scan, we might think the coefficients are known
- * more accurately than they really are.
- */
-
-LOCAL(boolean)
-smoothing_ok (j_decompress_ptr cinfo)
-{
- my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
- boolean smoothing_useful = FALSE;
- int ci, coefi;
- jpeg_component_info *compptr;
- JQUANT_TBL * qtable;
- int * coef_bits;
- int * coef_bits_latch;
-
- if (! cinfo->progressive_mode || cinfo->coef_bits == NULL)
- return FALSE;
-
- /* Allocate latch area if not already done */
- if (coef->coef_bits_latch == NULL)
- coef->coef_bits_latch = (int *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- cinfo->num_components *
- (SAVED_COEFS * SIZEOF(int)));
- coef_bits_latch = coef->coef_bits_latch;
-
- for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
- ci++, compptr++) {
- /* All components' quantization values must already be latched. */
- if ((qtable = compptr->quant_table) == NULL)
- return FALSE;
- /* Verify DC & first 5 AC quantizers are nonzero to avoid zero-divide. */
- if (qtable->quantval[0] == 0 ||
- qtable->quantval[Q01_POS] == 0 ||
- qtable->quantval[Q10_POS] == 0 ||
- qtable->quantval[Q20_POS] == 0 ||
- qtable->quantval[Q11_POS] == 0 ||
- qtable->quantval[Q02_POS] == 0)
- return FALSE;
- /* DC values must be at least partly known for all components. */
- coef_bits = cinfo->coef_bits[ci];
- if (coef_bits[0] < 0)
- return FALSE;
- /* Block smoothing is helpful if some AC coefficients remain inaccurate. */
- for (coefi = 1; coefi <= 5; coefi++) {
- coef_bits_latch[coefi] = coef_bits[coefi];
- if (coef_bits[coefi] != 0)
- smoothing_useful = TRUE;
- }
- coef_bits_latch += SAVED_COEFS;
- }
-
- return smoothing_useful;
-}
-
-
-/*
- * Variant of decompress_data for use when doing block smoothing.
- */
-
-METHODDEF(int)
-decompress_smooth_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
-{
- my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
- JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
- JDIMENSION block_num, last_block_column;
- int ci, block_row, block_rows, access_rows;
- JBLOCKARRAY buffer;
- JBLOCKROW buffer_ptr, prev_block_row, next_block_row;
- JSAMPARRAY output_ptr;
- JDIMENSION output_col;
- jpeg_component_info *compptr;
- inverse_DCT_method_ptr inverse_DCT;
- boolean first_row, last_row;
- JBLOCK workspace;
- int *coef_bits;
- JQUANT_TBL *quanttbl;
- INT32 Q00,Q01,Q02,Q10,Q11,Q20, num;
- int DC1,DC2,DC3,DC4,DC5,DC6,DC7,DC8,DC9;
- int Al, pred;
-
- /* Force some input to be done if we are getting ahead of the input. */
- while (cinfo->input_scan_number <= cinfo->output_scan_number &&
- ! cinfo->inputctl->eoi_reached) {
- if (cinfo->input_scan_number == cinfo->output_scan_number) {
- /* If input is working on current scan, we ordinarily want it to
- * have completed the current row. But if input scan is DC,
- * we want it to keep one row ahead so that next block row's DC
- * values are up to date.
- */
- JDIMENSION delta = (cinfo->Ss == 0) ? 1 : 0;
- if (cinfo->input_iMCU_row > cinfo->output_iMCU_row+delta)
- break;
- }
- if ((*cinfo->inputctl->consume_input)(cinfo) == JPEG_SUSPENDED)
- return JPEG_SUSPENDED;
- }
-
- /* OK, output from the virtual arrays. */
- for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
- ci++, compptr++) {
- /* Don't bother to IDCT an uninteresting component. */
- if (! compptr->component_needed)
- continue;
- /* Count non-dummy DCT block rows in this iMCU row. */
- if (cinfo->output_iMCU_row < last_iMCU_row) {
- block_rows = compptr->v_samp_factor;
- access_rows = block_rows * 2; /* this and next iMCU row */
- last_row = FALSE;
- } else {
- /* NB: can't use last_row_height here; it is input-side-dependent! */
- block_rows = (int) (compptr->height_in_blocks % compptr->v_samp_factor);
- if (block_rows == 0) block_rows = compptr->v_samp_factor;
- access_rows = block_rows; /* this iMCU row only */
- last_row = TRUE;
- }
- /* Align the virtual buffer for this component. */
- if (cinfo->output_iMCU_row > 0) {
- access_rows += compptr->v_samp_factor; /* prior iMCU row too */
- buffer = (*cinfo->mem->access_virt_barray)
- ((j_common_ptr) cinfo, coef->whole_image[ci],
- (cinfo->output_iMCU_row - 1) * compptr->v_samp_factor,
- (JDIMENSION) access_rows, FALSE);
- buffer += compptr->v_samp_factor; /* point to current iMCU row */
- first_row = FALSE;
- } else {
- buffer = (*cinfo->mem->access_virt_barray)
- ((j_common_ptr) cinfo, coef->whole_image[ci],
- (JDIMENSION) 0, (JDIMENSION) access_rows, FALSE);
- first_row = TRUE;
- }
- /* Fetch component-dependent info */
- coef_bits = coef->coef_bits_latch + (ci * SAVED_COEFS);
- quanttbl = compptr->quant_table;
- Q00 = quanttbl->quantval[0];
- Q01 = quanttbl->quantval[Q01_POS];
- Q10 = quanttbl->quantval[Q10_POS];
- Q20 = quanttbl->quantval[Q20_POS];
- Q11 = quanttbl->quantval[Q11_POS];
- Q02 = quanttbl->quantval[Q02_POS];
- inverse_DCT = cinfo->idct->inverse_DCT[ci];
- output_ptr = output_buf[ci];
- /* Loop over all DCT blocks to be processed. */
- for (block_row = 0; block_row < block_rows; block_row++) {
- buffer_ptr = buffer[block_row];
- if (first_row && block_row == 0)
- prev_block_row = buffer_ptr;
- else
- prev_block_row = buffer[block_row-1];
- if (last_row && block_row == block_rows-1)
- next_block_row = buffer_ptr;
- else
- next_block_row = buffer[block_row+1];
- /* We fetch the surrounding DC values using a sliding-register approach.
- * Initialize all nine here so as to do the right thing on narrow pics.
- */
- DC1 = DC2 = DC3 = (int) prev_block_row[0][0];
- DC4 = DC5 = DC6 = (int) buffer_ptr[0][0];
- DC7 = DC8 = DC9 = (int) next_block_row[0][0];
- output_col = 0;
- last_block_column = compptr->width_in_blocks - 1;
- for (block_num = 0; block_num <= last_block_column; block_num++) {
- /* Fetch current DCT block into workspace so we can modify it. */
- jcopy_block_row(buffer_ptr, (JBLOCKROW) workspace, (JDIMENSION) 1);
- /* Update DC values */
- if (block_num < last_block_column) {
- DC3 = (int) prev_block_row[1][0];
- DC6 = (int) buffer_ptr[1][0];
- DC9 = (int) next_block_row[1][0];
- }
- /* Compute coefficient estimates per K.8.
- * An estimate is applied only if coefficient is still zero,
- * and is not known to be fully accurate.
- */
- /* AC01 */
- if ((Al=coef_bits[1]) != 0 && workspace[1] == 0) {
- num = 36 * Q00 * (DC4 - DC6);
- if (num >= 0) {
- pred = (int) (((Q01<<7) + num) / (Q01<<8));
- if (Al > 0 && pred >= (1<<Al))
- pred = (1<<Al)-1;
- } else {
- pred = (int) (((Q01<<7) - num) / (Q01<<8));
- if (Al > 0 && pred >= (1<<Al))
- pred = (1<<Al)-1;
- pred = -pred;
- }
- workspace[1] = (JCOEF) pred;
- }
- /* AC10 */
- if ((Al=coef_bits[2]) != 0 && workspace[8] == 0) {
- num = 36 * Q00 * (DC2 - DC8);
- if (num >= 0) {
- pred = (int) (((Q10<<7) + num) / (Q10<<8));
- if (Al > 0 && pred >= (1<<Al))
- pred = (1<<Al)-1;
- } else {
- pred = (int) (((Q10<<7) - num) / (Q10<<8));
- if (Al > 0 && pred >= (1<<Al))
- pred = (1<<Al)-1;
- pred = -pred;
- }
- workspace[8] = (JCOEF) pred;
- }
- /* AC20 */
- if ((Al=coef_bits[3]) != 0 && workspace[16] == 0) {
- num = 9 * Q00 * (DC2 + DC8 - 2*DC5);
- if (num >= 0) {
- pred = (int) (((Q20<<7) + num) / (Q20<<8));
- if (Al > 0 && pred >= (1<<Al))
- pred = (1<<Al)-1;
- } else {
- pred = (int) (((Q20<<7) - num) / (Q20<<8));
- if (Al > 0 && pred >= (1<<Al))
- pred = (1<<Al)-1;
- pred = -pred;
- }
- workspace[16] = (JCOEF) pred;
- }
- /* AC11 */
- if ((Al=coef_bits[4]) != 0 && workspace[9] == 0) {
- num = 5 * Q00 * (DC1 - DC3 - DC7 + DC9);
- if (num >= 0) {
- pred = (int) (((Q11<<7) + num) / (Q11<<8));
- if (Al > 0 && pred >= (1<<Al))
- pred = (1<<Al)-1;
- } else {
- pred = (int) (((Q11<<7) - num) / (Q11<<8));
- if (Al > 0 && pred >= (1<<Al))
- pred = (1<<Al)-1;
- pred = -pred;
- }
- workspace[9] = (JCOEF) pred;
- }
- /* AC02 */
- if ((Al=coef_bits[5]) != 0 && workspace[2] == 0) {
- num = 9 * Q00 * (DC4 + DC6 - 2*DC5);
- if (num >= 0) {
- pred = (int) (((Q02<<7) + num) / (Q02<<8));
- if (Al > 0 && pred >= (1<<Al))
- pred = (1<<Al)-1;
- } else {
- pred = (int) (((Q02<<7) - num) / (Q02<<8));
- if (Al > 0 && pred >= (1<<Al))
- pred = (1<<Al)-1;
- pred = -pred;
- }
- workspace[2] = (JCOEF) pred;
- }
- /* OK, do the IDCT */
- (*inverse_DCT) (cinfo, compptr, (JCOEFPTR) workspace,
- output_ptr, output_col);
- /* Advance for next column */
- DC1 = DC2; DC2 = DC3;
- DC4 = DC5; DC5 = DC6;
- DC7 = DC8; DC8 = DC9;
- buffer_ptr++, prev_block_row++, next_block_row++;
- output_col += compptr->DCT_scaled_size;
- }
- output_ptr += compptr->DCT_scaled_size;
- }
- }
-
- if (++(cinfo->output_iMCU_row) < cinfo->total_iMCU_rows)
- return JPEG_ROW_COMPLETED;
- return JPEG_SCAN_COMPLETED;
-}
-
-#endif /* BLOCK_SMOOTHING_SUPPORTED */
-
-
-/*
- * Initialize coefficient buffer controller.
- */
-
-GLOBAL(void)
-jinit_d_coef_controller (j_decompress_ptr cinfo, boolean need_full_buffer)
-{
- my_coef_ptr coef;
-
- coef = (my_coef_ptr)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- SIZEOF(my_coef_controller));
- cinfo->coef = (struct jpeg_d_coef_controller *) coef;
- coef->pub.start_input_pass = start_input_pass;
- coef->pub.start_output_pass = start_output_pass;
-#ifdef BLOCK_SMOOTHING_SUPPORTED
- coef->coef_bits_latch = NULL;
-#endif
-
- /* Create the coefficient buffer. */
- if (need_full_buffer) {
-#ifdef D_MULTISCAN_FILES_SUPPORTED
- /* Allocate a full-image virtual array for each component, */
- /* padded to a multiple of samp_factor DCT blocks in each direction. */
- /* Note we ask for a pre-zeroed array. */
- int ci, access_rows;
- jpeg_component_info *compptr;
-
- for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
- ci++, compptr++) {
- access_rows = compptr->v_samp_factor;
-#ifdef BLOCK_SMOOTHING_SUPPORTED
- /* If block smoothing could be used, need a bigger window */
- if (cinfo->progressive_mode)
- access_rows *= 3;
-#endif
- coef->whole_image[ci] = (*cinfo->mem->request_virt_barray)
- ((j_common_ptr) cinfo, JPOOL_IMAGE, TRUE,
- (JDIMENSION) jround_up((long) compptr->width_in_blocks,
- (long) compptr->h_samp_factor),
- (JDIMENSION) jround_up((long) compptr->height_in_blocks,
- (long) compptr->v_samp_factor),
- (JDIMENSION) access_rows);
- }
- coef->pub.consume_data = consume_data;
- coef->pub.decompress_data = decompress_data;
- coef->pub.coef_arrays = coef->whole_image; /* link to virtual arrays */
-#else
- ERREXIT(cinfo, JERR_NOT_COMPILED);
-#endif
- } else {
- /* We only need a single-MCU buffer. */
- JBLOCKROW buffer;
- int i;
-
- buffer = (JBLOCKROW)
- (*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- D_MAX_BLOCKS_IN_MCU * SIZEOF(JBLOCK));
- for (i = 0; i < D_MAX_BLOCKS_IN_MCU; i++) {
- coef->MCU_buffer[i] = buffer + i;
- }
- coef->pub.consume_data = dummy_consume_data;
- coef->pub.decompress_data = decompress_onepass;
- coef->pub.coef_arrays = NULL; /* flag for no virtual arrays */
- }
-}
diff --git a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jdcolor.c b/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jdcolor.c
deleted file mode 100644
index 6c04dfe8aa1..00000000000
--- a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jdcolor.c
+++ /dev/null
@@ -1,396 +0,0 @@
-/*
- * jdcolor.c
- *
- * Copyright (C) 1991-1997, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file contains output colorspace conversion routines.
- */
-
-#define JPEG_INTERNALS
-#include "jinclude.h"
-#include "jpeglib.h"
-
-
-/* Private subobject */
-
-typedef struct {
- struct jpeg_color_deconverter pub; /* public fields */
-
- /* Private state for YCC->RGB conversion */
- int * Cr_r_tab; /* => table for Cr to R conversion */
- int * Cb_b_tab; /* => table for Cb to B conversion */
- INT32 * Cr_g_tab; /* => table for Cr to G conversion */
- INT32 * Cb_g_tab; /* => table for Cb to G conversion */
-} my_color_deconverter;
-
-typedef my_color_deconverter * my_cconvert_ptr;
-
-
-/**************** YCbCr -> RGB conversion: most common case **************/
-
-/*
- * YCbCr is defined per CCIR 601-1, except that Cb and Cr are
- * normalized to the range 0..MAXJSAMPLE rather than -0.5 .. 0.5.
- * The conversion equations to be implemented are therefore
- * R = Y + 1.40200 * Cr
- * G = Y - 0.34414 * Cb - 0.71414 * Cr
- * B = Y + 1.77200 * Cb
- * where Cb and Cr represent the incoming values less CENTERJSAMPLE.
- * (These numbers are derived from TIFF 6.0 section 21, dated 3-June-92.)
- *
- * To avoid floating-point arithmetic, we represent the fractional constants
- * as integers scaled up by 2^16 (about 4 digits precision); we have to divide
- * the products by 2^16, with appropriate rounding, to get the correct answer.
- * Notice that Y, being an integral input, does not contribute any fraction
- * so it need not participate in the rounding.
- *
- * For even more speed, we avoid doing any multiplications in the inner loop
- * by precalculating the constants times Cb and Cr for all possible values.
- * For 8-bit JSAMPLEs this is very reasonable (only 256 entries per table);
- * for 12-bit samples it is still acceptable. It's not very reasonable for
- * 16-bit samples, but if you want lossless storage you shouldn't be changing
- * colorspace anyway.
- * The Cr=>R and Cb=>B values can be rounded to integers in advance; the
- * values for the G calculation are left scaled up, since we must add them
- * together before rounding.
- */
-
-#define SCALEBITS 16 /* speediest right-shift on some machines */
-#define ONE_HALF ((INT32) 1 << (SCALEBITS-1))
-#define FIX(x) ((INT32) ((x) * (1L<<SCALEBITS) + 0.5))
-
-
-/*
- * Initialize tables for YCC->RGB colorspace conversion.
- */
-
-LOCAL(void)
-build_ycc_rgb_table (j_decompress_ptr cinfo)
-{
- my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
- int i;
- INT32 x;
- SHIFT_TEMPS
-
- cconvert->Cr_r_tab = (int *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- (MAXJSAMPLE+1) * SIZEOF(int));
- cconvert->Cb_b_tab = (int *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- (MAXJSAMPLE+1) * SIZEOF(int));
- cconvert->Cr_g_tab = (INT32 *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- (MAXJSAMPLE+1) * SIZEOF(INT32));
- cconvert->Cb_g_tab = (INT32 *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- (MAXJSAMPLE+1) * SIZEOF(INT32));
-
- for (i = 0, x = -CENTERJSAMPLE; i <= MAXJSAMPLE; i++, x++) {
- /* i is the actual input pixel value, in the range 0..MAXJSAMPLE */
- /* The Cb or Cr value we are thinking of is x = i - CENTERJSAMPLE */
- /* Cr=>R value is nearest int to 1.40200 * x */
- cconvert->Cr_r_tab[i] = (int)
- RIGHT_SHIFT(FIX(1.40200) * x + ONE_HALF, SCALEBITS);
- /* Cb=>B value is nearest int to 1.77200 * x */
- cconvert->Cb_b_tab[i] = (int)
- RIGHT_SHIFT(FIX(1.77200) * x + ONE_HALF, SCALEBITS);
- /* Cr=>G value is scaled-up -0.71414 * x */
- cconvert->Cr_g_tab[i] = (- FIX(0.71414)) * x;
- /* Cb=>G value is scaled-up -0.34414 * x */
- /* We also add in ONE_HALF so that need not do it in inner loop */
- cconvert->Cb_g_tab[i] = (- FIX(0.34414)) * x + ONE_HALF;
- }
-}
-
-
-/*
- * Convert some rows of samples to the output colorspace.
- *
- * Note that we change from noninterleaved, one-plane-per-component format
- * to interleaved-pixel format. The output buffer is therefore three times
- * as wide as the input buffer.
- * A starting row offset is provided only for the input buffer. The caller
- * can easily adjust the passed output_buf value to accommodate any row
- * offset required on that side.
- */
-
-METHODDEF(void)
-ycc_rgb_convert (j_decompress_ptr cinfo,
- JSAMPIMAGE input_buf, JDIMENSION input_row,
- JSAMPARRAY output_buf, int num_rows)
-{
- my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
- register int y, cb, cr;
- register JSAMPROW outptr;
- register JSAMPROW inptr0, inptr1, inptr2;
- register JDIMENSION col;
- JDIMENSION num_cols = cinfo->output_width;
- /* copy these pointers into registers if possible */
- register JSAMPLE * range_limit = cinfo->sample_range_limit;
- register int * Crrtab = cconvert->Cr_r_tab;
- register int * Cbbtab = cconvert->Cb_b_tab;
- register INT32 * Crgtab = cconvert->Cr_g_tab;
- register INT32 * Cbgtab = cconvert->Cb_g_tab;
- SHIFT_TEMPS
-
- while (--num_rows >= 0) {
- inptr0 = input_buf[0][input_row];
- inptr1 = input_buf[1][input_row];
- inptr2 = input_buf[2][input_row];
- input_row++;
- outptr = *output_buf++;
- for (col = 0; col < num_cols; col++) {
- y = GETJSAMPLE(inptr0[col]);
- cb = GETJSAMPLE(inptr1[col]);
- cr = GETJSAMPLE(inptr2[col]);
- /* Range-limiting is essential due to noise introduced by DCT losses. */
- outptr[RGB_RED] = range_limit[y + Crrtab[cr]];
- outptr[RGB_GREEN] = range_limit[y +
- ((int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr],
- SCALEBITS))];
- outptr[RGB_BLUE] = range_limit[y + Cbbtab[cb]];
- outptr += RGB_PIXELSIZE;
- }
- }
-}
-
-
-/**************** Cases other than YCbCr -> RGB **************/
-
-
-/*
- * Color conversion for no colorspace change: just copy the data,
- * converting from separate-planes to interleaved representation.
- */
-
-METHODDEF(void)
-null_convert (j_decompress_ptr cinfo,
- JSAMPIMAGE input_buf, JDIMENSION input_row,
- JSAMPARRAY output_buf, int num_rows)
-{
- register JSAMPROW inptr, outptr;
- register JDIMENSION count;
- register int num_components = cinfo->num_components;
- JDIMENSION num_cols = cinfo->output_width;
- int ci;
-
- while (--num_rows >= 0) {
- for (ci = 0; ci < num_components; ci++) {
- inptr = input_buf[ci][input_row];
- outptr = output_buf[0] + ci;
- for (count = num_cols; count > 0; count--) {
- *outptr = *inptr++; /* needn't bother with GETJSAMPLE() here */
- outptr += num_components;
- }
- }
- input_row++;
- output_buf++;
- }
-}
-
-
-/*
- * Color conversion for grayscale: just copy the data.
- * This also works for YCbCr -> grayscale conversion, in which
- * we just copy the Y (luminance) component and ignore chrominance.
- */
-
-METHODDEF(void)
-grayscale_convert (j_decompress_ptr cinfo,
- JSAMPIMAGE input_buf, JDIMENSION input_row,
- JSAMPARRAY output_buf, int num_rows)
-{
- jcopy_sample_rows(input_buf[0], (int) input_row, output_buf, 0,
- num_rows, cinfo->output_width);
-}
-
-
-/*
- * Convert grayscale to RGB: just duplicate the graylevel three times.
- * This is provided to support applications that don't want to cope
- * with grayscale as a separate case.
- */
-
-METHODDEF(void)
-gray_rgb_convert (j_decompress_ptr cinfo,
- JSAMPIMAGE input_buf, JDIMENSION input_row,
- JSAMPARRAY output_buf, int num_rows)
-{
- register JSAMPROW inptr, outptr;
- register JDIMENSION col;
- JDIMENSION num_cols = cinfo->output_width;
-
- while (--num_rows >= 0) {
- inptr = input_buf[0][input_row++];
- outptr = *output_buf++;
- for (col = 0; col < num_cols; col++) {
- /* We can dispense with GETJSAMPLE() here */
- outptr[RGB_RED] = outptr[RGB_GREEN] = outptr[RGB_BLUE] = inptr[col];
- outptr += RGB_PIXELSIZE;
- }
- }
-}
-
-
-/*
- * Adobe-style YCCK->CMYK conversion.
- * We convert YCbCr to R=1-C, G=1-M, and B=1-Y using the same
- * conversion as above, while passing K (black) unchanged.
- * We assume build_ycc_rgb_table has been called.
- */
-
-METHODDEF(void)
-ycck_cmyk_convert (j_decompress_ptr cinfo,
- JSAMPIMAGE input_buf, JDIMENSION input_row,
- JSAMPARRAY output_buf, int num_rows)
-{
- my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
- register int y, cb, cr;
- register JSAMPROW outptr;
- register JSAMPROW inptr0, inptr1, inptr2, inptr3;
- register JDIMENSION col;
- JDIMENSION num_cols = cinfo->output_width;
- /* copy these pointers into registers if possible */
- register JSAMPLE * range_limit = cinfo->sample_range_limit;
- register int * Crrtab = cconvert->Cr_r_tab;
- register int * Cbbtab = cconvert->Cb_b_tab;
- register INT32 * Crgtab = cconvert->Cr_g_tab;
- register INT32 * Cbgtab = cconvert->Cb_g_tab;
- SHIFT_TEMPS
-
- while (--num_rows >= 0) {
- inptr0 = input_buf[0][input_row];
- inptr1 = input_buf[1][input_row];
- inptr2 = input_buf[2][input_row];
- inptr3 = input_buf[3][input_row];
- input_row++;
- outptr = *output_buf++;
- for (col = 0; col < num_cols; col++) {
- y = GETJSAMPLE(inptr0[col]);
- cb = GETJSAMPLE(inptr1[col]);
- cr = GETJSAMPLE(inptr2[col]);
- /* Range-limiting is essential due to noise introduced by DCT losses. */
- outptr[0] = range_limit[MAXJSAMPLE - (y + Crrtab[cr])]; /* red */
- outptr[1] = range_limit[MAXJSAMPLE - (y + /* green */
- ((int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr],
- SCALEBITS)))];
- outptr[2] = range_limit[MAXJSAMPLE - (y + Cbbtab[cb])]; /* blue */
- /* K passes through unchanged */
- outptr[3] = inptr3[col]; /* don't need GETJSAMPLE here */
- outptr += 4;
- }
- }
-}
-
-
-/*
- * Empty method for start_pass.
- */
-
-METHODDEF(void)
-start_pass_dcolor (j_decompress_ptr cinfo)
-{
- /* no work needed */
-}
-
-
-/*
- * Module initialization routine for output colorspace conversion.
- */
-
-GLOBAL(void)
-jinit_color_deconverter (j_decompress_ptr cinfo)
-{
- my_cconvert_ptr cconvert;
- int ci;
-
- cconvert = (my_cconvert_ptr)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- SIZEOF(my_color_deconverter));
- cinfo->cconvert = (struct jpeg_color_deconverter *) cconvert;
- cconvert->pub.start_pass = start_pass_dcolor;
-
- /* Make sure num_components agrees with jpeg_color_space */
- switch (cinfo->jpeg_color_space) {
- case JCS_GRAYSCALE:
- if (cinfo->num_components != 1)
- ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
- break;
-
- case JCS_RGB:
- case JCS_YCbCr:
- if (cinfo->num_components != 3)
- ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
- break;
-
- case JCS_CMYK:
- case JCS_YCCK:
- if (cinfo->num_components != 4)
- ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
- break;
-
- default: /* JCS_UNKNOWN can be anything */
- if (cinfo->num_components < 1)
- ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
- break;
- }
-
- /* Set out_color_components and conversion method based on requested space.
- * Also clear the component_needed flags for any unused components,
- * so that earlier pipeline stages can avoid useless computation.
- */
-
- switch (cinfo->out_color_space) {
- case JCS_GRAYSCALE:
- cinfo->out_color_components = 1;
- if (cinfo->jpeg_color_space == JCS_GRAYSCALE ||
- cinfo->jpeg_color_space == JCS_YCbCr) {
- cconvert->pub.color_convert = grayscale_convert;
- /* For color->grayscale conversion, only the Y (0) component is needed */
- for (ci = 1; ci < cinfo->num_components; ci++)
- cinfo->comp_info[ci].component_needed = FALSE;
- } else
- ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
- break;
-
- case JCS_RGB:
- cinfo->out_color_components = RGB_PIXELSIZE;
- if (cinfo->jpeg_color_space == JCS_YCbCr) {
- cconvert->pub.color_convert = ycc_rgb_convert;
- build_ycc_rgb_table(cinfo);
- } else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) {
- cconvert->pub.color_convert = gray_rgb_convert;
- } else if (cinfo->jpeg_color_space == JCS_RGB && RGB_PIXELSIZE == 3) {
- cconvert->pub.color_convert = null_convert;
- } else
- ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
- break;
-
- case JCS_CMYK:
- cinfo->out_color_components = 4;
- if (cinfo->jpeg_color_space == JCS_YCCK) {
- cconvert->pub.color_convert = ycck_cmyk_convert;
- build_ycc_rgb_table(cinfo);
- } else if (cinfo->jpeg_color_space == JCS_CMYK) {
- cconvert->pub.color_convert = null_convert;
- } else
- ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
- break;
-
- default:
- /* Permit null conversion to same output space */
- if (cinfo->out_color_space == cinfo->jpeg_color_space) {
- cinfo->out_color_components = cinfo->num_components;
- cconvert->pub.color_convert = null_convert;
- } else /* unsupported non-null conversion */
- ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
- break;
- }
-
- if (cinfo->quantize_colors)
- cinfo->output_components = 1; /* single colormapped output component */
- else
- cinfo->output_components = cinfo->out_color_components;
-}
diff --git a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jddctmgr.c b/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jddctmgr.c
deleted file mode 100644
index bbf8d0e92fd..00000000000
--- a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jddctmgr.c
+++ /dev/null
@@ -1,269 +0,0 @@
-/*
- * jddctmgr.c
- *
- * Copyright (C) 1994-1996, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file contains the inverse-DCT management logic.
- * This code selects a particular IDCT implementation to be used,
- * and it performs related housekeeping chores. No code in this file
- * is executed per IDCT step, only during output pass setup.
- *
- * Note that the IDCT routines are responsible for performing coefficient
- * dequantization as well as the IDCT proper. This module sets up the
- * dequantization multiplier table needed by the IDCT routine.
- */
-
-#define JPEG_INTERNALS
-#include "jinclude.h"
-#include "jpeglib.h"
-#include "jdct.h" /* Private declarations for DCT subsystem */
-
-
-/*
- * The decompressor input side (jdinput.c) saves away the appropriate
- * quantization table for each component at the start of the first scan
- * involving that component. (This is necessary in order to correctly
- * decode files that reuse Q-table slots.)
- * When we are ready to make an output pass, the saved Q-table is converted
- * to a multiplier table that will actually be used by the IDCT routine.
- * The multiplier table contents are IDCT-method-dependent. To support
- * application changes in IDCT method between scans, we can remake the
- * multiplier tables if necessary.
- * In buffered-image mode, the first output pass may occur before any data
- * has been seen for some components, and thus before their Q-tables have
- * been saved away. To handle this case, multiplier tables are preset
- * to zeroes; the result of the IDCT will be a neutral gray level.
- */
-
-
-/* Private subobject for this module */
-
-typedef struct {
- struct jpeg_inverse_dct pub; /* public fields */
-
- /* This array contains the IDCT method code that each multiplier table
- * is currently set up for, or -1 if it's not yet set up.
- * The actual multiplier tables are pointed to by dct_table in the
- * per-component comp_info structures.
- */
- int cur_method[MAX_COMPONENTS];
-} my_idct_controller;
-
-typedef my_idct_controller * my_idct_ptr;
-
-
-/* Allocated multiplier tables: big enough for any supported variant */
-
-typedef union {
- ISLOW_MULT_TYPE islow_array[DCTSIZE2];
-#ifdef DCT_IFAST_SUPPORTED
- IFAST_MULT_TYPE ifast_array[DCTSIZE2];
-#endif
-#ifdef DCT_FLOAT_SUPPORTED
- FLOAT_MULT_TYPE float_array[DCTSIZE2];
-#endif
-} multiplier_table;
-
-
-/* The current scaled-IDCT routines require ISLOW-style multiplier tables,
- * so be sure to compile that code if either ISLOW or SCALING is requested.
- */
-#ifdef DCT_ISLOW_SUPPORTED
-#define PROVIDE_ISLOW_TABLES
-#else
-#ifdef IDCT_SCALING_SUPPORTED
-#define PROVIDE_ISLOW_TABLES
-#endif
-#endif
-
-
-/*
- * Prepare for an output pass.
- * Here we select the proper IDCT routine for each component and build
- * a matching multiplier table.
- */
-
-METHODDEF(void)
-start_pass (j_decompress_ptr cinfo)
-{
- my_idct_ptr idct = (my_idct_ptr) cinfo->idct;
- int ci, i;
- jpeg_component_info *compptr;
- int method = 0;
- inverse_DCT_method_ptr method_ptr = NULL;
- JQUANT_TBL * qtbl;
-
- for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
- ci++, compptr++) {
- /* Select the proper IDCT routine for this component's scaling */
- switch (compptr->DCT_scaled_size) {
-#ifdef IDCT_SCALING_SUPPORTED
- case 1:
- method_ptr = jpeg_idct_1x1;
- method = JDCT_ISLOW; /* jidctred uses islow-style table */
- break;
- case 2:
- method_ptr = jpeg_idct_2x2;
- method = JDCT_ISLOW; /* jidctred uses islow-style table */
- break;
- case 4:
- method_ptr = jpeg_idct_4x4;
- method = JDCT_ISLOW; /* jidctred uses islow-style table */
- break;
-#endif
- case DCTSIZE:
- switch (cinfo->dct_method) {
-#ifdef DCT_ISLOW_SUPPORTED
- case JDCT_ISLOW:
- method_ptr = jpeg_idct_islow;
- method = JDCT_ISLOW;
- break;
-#endif
-#ifdef DCT_IFAST_SUPPORTED
- case JDCT_IFAST:
- method_ptr = jpeg_idct_ifast;
- method = JDCT_IFAST;
- break;
-#endif
-#ifdef DCT_FLOAT_SUPPORTED
- case JDCT_FLOAT:
- method_ptr = jpeg_idct_float;
- method = JDCT_FLOAT;
- break;
-#endif
- default:
- ERREXIT(cinfo, JERR_NOT_COMPILED);
- break;
- }
- break;
- default:
- ERREXIT1(cinfo, JERR_BAD_DCTSIZE, compptr->DCT_scaled_size);
- break;
- }
- idct->pub.inverse_DCT[ci] = method_ptr;
- /* Create multiplier table from quant table.
- * However, we can skip this if the component is uninteresting
- * or if we already built the table. Also, if no quant table
- * has yet been saved for the component, we leave the
- * multiplier table all-zero; we'll be reading zeroes from the
- * coefficient controller's buffer anyway.
- */
- if (! compptr->component_needed || idct->cur_method[ci] == method)
- continue;
- qtbl = compptr->quant_table;
- if (qtbl == NULL) /* happens if no data yet for component */
- continue;
- idct->cur_method[ci] = method;
- switch (method) {
-#ifdef PROVIDE_ISLOW_TABLES
- case JDCT_ISLOW:
- {
- /* For LL&M IDCT method, multipliers are equal to raw quantization
- * coefficients, but are stored as ints to ensure access efficiency.
- */
- ISLOW_MULT_TYPE * ismtbl = (ISLOW_MULT_TYPE *) compptr->dct_table;
- for (i = 0; i < DCTSIZE2; i++) {
- ismtbl[i] = (ISLOW_MULT_TYPE) qtbl->quantval[i];
- }
- }
- break;
-#endif
-#ifdef DCT_IFAST_SUPPORTED
- case JDCT_IFAST:
- {
- /* For AA&N IDCT method, multipliers are equal to quantization
- * coefficients scaled by scalefactor[row]*scalefactor[col], where
- * scalefactor[0] = 1
- * scalefactor[k] = cos(k*PI/16) * sqrt(2) for k=1..7
- * For integer operation, the multiplier table is to be scaled by
- * IFAST_SCALE_BITS.
- */
- IFAST_MULT_TYPE * ifmtbl = (IFAST_MULT_TYPE *) compptr->dct_table;
-#define CONST_BITS 14
- static const INT16 aanscales[DCTSIZE2] = {
- /* precomputed values scaled up by 14 bits */
- 16384, 22725, 21407, 19266, 16384, 12873, 8867, 4520,
- 22725, 31521, 29692, 26722, 22725, 17855, 12299, 6270,
- 21407, 29692, 27969, 25172, 21407, 16819, 11585, 5906,
- 19266, 26722, 25172, 22654, 19266, 15137, 10426, 5315,
- 16384, 22725, 21407, 19266, 16384, 12873, 8867, 4520,
- 12873, 17855, 16819, 15137, 12873, 10114, 6967, 3552,
- 8867, 12299, 11585, 10426, 8867, 6967, 4799, 2446,
- 4520, 6270, 5906, 5315, 4520, 3552, 2446, 1247
- };
- SHIFT_TEMPS
-
- for (i = 0; i < DCTSIZE2; i++) {
- ifmtbl[i] = (IFAST_MULT_TYPE)
- DESCALE(MULTIPLY16V16((INT32) qtbl->quantval[i],
- (INT32) aanscales[i]),
- CONST_BITS-IFAST_SCALE_BITS);
- }
- }
- break;
-#endif
-#ifdef DCT_FLOAT_SUPPORTED
- case JDCT_FLOAT:
- {
- /* For float AA&N IDCT method, multipliers are equal to quantization
- * coefficients scaled by scalefactor[row]*scalefactor[col], where
- * scalefactor[0] = 1
- * scalefactor[k] = cos(k*PI/16) * sqrt(2) for k=1..7
- */
- FLOAT_MULT_TYPE * fmtbl = (FLOAT_MULT_TYPE *) compptr->dct_table;
- int row, col;
- static const double aanscalefactor[DCTSIZE] = {
- 1.0, 1.387039845, 1.306562965, 1.175875602,
- 1.0, 0.785694958, 0.541196100, 0.275899379
- };
-
- i = 0;
- for (row = 0; row < DCTSIZE; row++) {
- for (col = 0; col < DCTSIZE; col++) {
- fmtbl[i] = (FLOAT_MULT_TYPE)
- ((double) qtbl->quantval[i] *
- aanscalefactor[row] * aanscalefactor[col]);
- i++;
- }
- }
- }
- break;
-#endif
- default:
- ERREXIT(cinfo, JERR_NOT_COMPILED);
- break;
- }
- }
-}
-
-
-/*
- * Initialize IDCT manager.
- */
-
-GLOBAL(void)
-jinit_inverse_dct (j_decompress_ptr cinfo)
-{
- my_idct_ptr idct;
- int ci;
- jpeg_component_info *compptr;
-
- idct = (my_idct_ptr)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- SIZEOF(my_idct_controller));
- cinfo->idct = (struct jpeg_inverse_dct *) idct;
- idct->pub.start_pass = start_pass;
-
- for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
- ci++, compptr++) {
- /* Allocate and pre-zero a multiplier table for each component */
- compptr->dct_table =
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- SIZEOF(multiplier_table));
- MEMZERO(compptr->dct_table, SIZEOF(multiplier_table));
- /* Mark multiplier table not yet set up for any method */
- idct->cur_method[ci] = -1;
- }
-}
diff --git a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jdhuff.c b/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jdhuff.c
deleted file mode 100644
index 2c9495c2b4f..00000000000
--- a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jdhuff.c
+++ /dev/null
@@ -1,650 +0,0 @@
-/*
- * jdhuff.c
- *
- * Copyright (C) 1991-1997, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file contains Huffman entropy decoding routines.
- *
- * Much of the complexity here has to do with supporting input suspension.
- * If the data source module demands suspension, we want to be able to back
- * up to the start of the current MCU. To do this, we copy state variables
- * into local working storage, and update them back to the permanent
- * storage only upon successful completion of an MCU.
- */
-
-#define JPEG_INTERNALS
-#include "jinclude.h"
-#include "jpeglib.h"
-#include "jdhuff.h" /* Declarations shared with jdphuff.c */
-
-/*
- * Expanded entropy decoder object for Huffman decoding.
- *
- * The savable_state subrecord contains fields that change within an MCU,
- * but must not be updated permanently until we complete the MCU.
- */
-
-typedef struct {
- int last_dc_val[MAX_COMPS_IN_SCAN]; /* last DC coef for each component */
-} savable_state;
-
-/* This macro is to work around compilers with missing or broken
- * structure assignment. You'll need to fix this code if you have
- * such a compiler and you change MAX_COMPS_IN_SCAN.
- */
-
-#ifndef NO_STRUCT_ASSIGN
-#define ASSIGN_STATE(dest,src) ((dest) = (src))
-#else
-#if MAX_COMPS_IN_SCAN == 4
-#define ASSIGN_STATE(dest,src) \
- ((dest).last_dc_val[0] = (src).last_dc_val[0], \
- (dest).last_dc_val[1] = (src).last_dc_val[1], \
- (dest).last_dc_val[2] = (src).last_dc_val[2], \
- (dest).last_dc_val[3] = (src).last_dc_val[3])
-#endif
-#endif
-
-
-typedef struct {
- struct jpeg_entropy_decoder pub; /* public fields */
-
- /* These fields are loaded into local variables at start of each MCU.
- * In case of suspension, we exit WITHOUT updating them.
- */
- bitread_perm_state bitstate; /* Bit buffer at start of MCU */
- savable_state saved; /* Other state at start of MCU */
-
- /* These fields are NOT loaded into local working state. */
- unsigned int restarts_to_go; /* MCUs left in this restart interval */
-
- /* Pointers to derived tables (these workspaces have image lifespan) */
- d_derived_tbl * dc_derived_tbls[NUM_HUFF_TBLS];
- d_derived_tbl * ac_derived_tbls[NUM_HUFF_TBLS];
-
- /* Precalculated info set up by start_pass for use in decode_mcu: */
-
- /* Pointers to derived tables to be used for each block within an MCU */
- d_derived_tbl * dc_cur_tbls[D_MAX_BLOCKS_IN_MCU];
- d_derived_tbl * ac_cur_tbls[D_MAX_BLOCKS_IN_MCU];
- /* Whether we care about the DC and AC coefficient values for each block */
- boolean dc_needed[D_MAX_BLOCKS_IN_MCU];
- boolean ac_needed[D_MAX_BLOCKS_IN_MCU];
-} huff_entropy_decoder;
-
-typedef huff_entropy_decoder * huff_entropy_ptr;
-
-
-/*
- * Initialize for a Huffman-compressed scan.
- */
-
-METHODDEF(void)
-start_pass_huff_decoder (j_decompress_ptr cinfo)
-{
- huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
- int ci, blkn, dctbl, actbl;
- jpeg_component_info * compptr;
-
- /* Check that the scan parameters Ss, Se, Ah/Al are OK for sequential JPEG.
- * This ought to be an error condition, but we make it a warning because
- * there are some baseline files out there with all zeroes in these bytes.
- */
- if (cinfo->Ss != 0 || cinfo->Se != DCTSIZE2-1 ||
- cinfo->Ah != 0 || cinfo->Al != 0)
- WARNMS(cinfo, JWRN_NOT_SEQUENTIAL);
-
- for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
- compptr = cinfo->cur_comp_info[ci];
- dctbl = compptr->dc_tbl_no;
- actbl = compptr->ac_tbl_no;
- /* Compute derived values for Huffman tables */
- /* We may do this more than once for a table, but it's not expensive */
- jpeg_make_d_derived_tbl(cinfo, TRUE, dctbl,
- & entropy->dc_derived_tbls[dctbl]);
- jpeg_make_d_derived_tbl(cinfo, FALSE, actbl,
- & entropy->ac_derived_tbls[actbl]);
- /* Initialize DC predictions to 0 */
- entropy->saved.last_dc_val[ci] = 0;
- }
-
- /* Precalculate decoding info for each block in an MCU of this scan */
- for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
- ci = cinfo->MCU_membership[blkn];
- compptr = cinfo->cur_comp_info[ci];
- /* Precalculate which table to use for each block */
- entropy->dc_cur_tbls[blkn] = entropy->dc_derived_tbls[compptr->dc_tbl_no];
- entropy->ac_cur_tbls[blkn] = entropy->ac_derived_tbls[compptr->ac_tbl_no];
- /* Decide whether we really care about the coefficient values */
- if (compptr->component_needed) {
- entropy->dc_needed[blkn] = TRUE;
- /* we don't need the ACs if producing a 1/8th-size image */
- entropy->ac_needed[blkn] = (compptr->DCT_scaled_size > 1);
- } else {
- entropy->dc_needed[blkn] = entropy->ac_needed[blkn] = FALSE;
- }
- }
-
- /* Initialize bitread state variables */
- entropy->bitstate.bits_left = 0;
- entropy->bitstate.get_buffer = 0; /* unnecessary, but keeps Purify quiet */
- entropy->pub.insufficient_data = FALSE;
-
- /* Initialize restart counter */
- entropy->restarts_to_go = cinfo->restart_interval;
-}
-
-
-/*
- * Compute the derived values for a Huffman table.
- * This routine also performs some validation checks on the table.
- *
- * Note this is also used by jdphuff.c.
- */
-
-GLOBAL(void)
-jpeg_make_d_derived_tbl (j_decompress_ptr cinfo, boolean isDC, int tblno,
- d_derived_tbl ** pdtbl)
-{
- JHUFF_TBL *htbl;
- d_derived_tbl *dtbl;
- int p, i, l, _si, numsymbols;
- int lookbits, ctr;
- char huffsize[257];
- unsigned int huffcode[257];
- unsigned int code;
-
- /* Note that huffsize[] and huffcode[] are filled in code-length order,
- * paralleling the order of the symbols themselves in htbl->huffval[].
- */
-
- /* Find the input Huffman table */
- if (tblno < 0 || tblno >= NUM_HUFF_TBLS)
- ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tblno);
- htbl =
- isDC ? cinfo->dc_huff_tbl_ptrs[tblno] : cinfo->ac_huff_tbl_ptrs[tblno];
- if (htbl == NULL)
- ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tblno);
-
- /* Allocate a workspace if we haven't already done so. */
- if (*pdtbl == NULL)
- *pdtbl = (d_derived_tbl *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- SIZEOF(d_derived_tbl));
- dtbl = *pdtbl;
- dtbl->pub = htbl; /* fill in back link */
-
- /* Figure C.1: make table of Huffman code length for each symbol */
-
- p = 0;
- for (l = 1; l <= 16; l++) {
- i = (int) htbl->bits[l];
- if (i < 0 || p + i > 256) /* protect against table overrun */
- ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
- while (i--)
- huffsize[p++] = (char) l;
- }
- huffsize[p] = 0;
- numsymbols = p;
-
- /* Figure C.2: generate the codes themselves */
- /* We also validate that the counts represent a legal Huffman code tree. */
-
- code = 0;
- _si = huffsize[0];
- p = 0;
- while (huffsize[p]) {
- while (((int) huffsize[p]) == _si) {
- huffcode[p++] = code;
- code++;
- }
- /* code is now 1 more than the last code used for codelength si; but
- * it must still fit in si bits, since no code is allowed to be all ones.
- */
- if (((INT32) code) >= (((INT32) 1) << _si))
- ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
- code <<= 1;
- _si++;
- }
-
- /* Figure F.15: generate decoding tables for bit-sequential decoding */
-
- p = 0;
- for (l = 1; l <= 16; l++) {
- if (htbl->bits[l]) {
- /* valoffset[l] = huffval[] index of 1st symbol of code length l,
- * minus the minimum code of length l
- */
- dtbl->valoffset[l] = (INT32) p - (INT32) huffcode[p];
- p += htbl->bits[l];
- dtbl->maxcode[l] = huffcode[p-1]; /* maximum code of length l */
- } else {
- dtbl->maxcode[l] = -1; /* -1 if no codes of this length */
- }
- }
- dtbl->maxcode[17] = 0xFFFFFL; /* ensures jpeg_huff_decode terminates */
-
- /* Compute lookahead tables to speed up decoding.
- * First we set all the table entries to 0, indicating "too long";
- * then we iterate through the Huffman codes that are short enough and
- * fill in all the entries that correspond to bit sequences starting
- * with that code.
- */
-
- MEMZERO(dtbl->look_nbits, SIZEOF(dtbl->look_nbits));
-
- p = 0;
- for (l = 1; l <= HUFF_LOOKAHEAD; l++) {
- for (i = 1; i <= (int) htbl->bits[l]; i++, p++) {
- /* l = current code's length, p = its index in huffcode[] & huffval[]. */
- /* Generate left-justified code followed by all possible bit sequences */
- lookbits = huffcode[p] << (HUFF_LOOKAHEAD-l);
- for (ctr = 1 << (HUFF_LOOKAHEAD-l); ctr > 0; ctr--) {
- dtbl->look_nbits[lookbits] = l;
- dtbl->look_sym[lookbits] = htbl->huffval[p];
- lookbits++;
- }
- }
- }
-
- /* Validate symbols as being reasonable.
- * For AC tables, we make no check, but accept all byte values 0..255.
- * For DC tables, we require the symbols to be in range 0..15.
- * (Tighter bounds could be applied depending on the data depth and mode,
- * but this is sufficient to ensure safe decoding.)
- */
- if (isDC) {
- for (i = 0; i < numsymbols; i++) {
- int sym = htbl->huffval[i];
- if (sym < 0 || sym > 15)
- ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
- }
- }
-}
-
-
-/*
- * Out-of-line code for bit fetching (shared with jdphuff.c).
- * See jdhuff.h for info about usage.
- * Note: current values of get_buffer and bits_left are passed as parameters,
- * but are returned in the corresponding fields of the state struct.
- *
- * On most machines MIN_GET_BITS should be 25 to allow the full 32-bit width
- * of get_buffer to be used. (On machines with wider words, an even larger
- * buffer could be used.) However, on some machines 32-bit shifts are
- * quite slow and take time proportional to the number of places shifted.
- * (This is true with most PC compilers, for instance.) In this case it may
- * be a win to set MIN_GET_BITS to the minimum value of 15. This reduces the
- * average shift distance at the cost of more calls to jpeg_fill_bit_buffer.
- */
-
-#ifdef SLOW_SHIFT_32
-#define MIN_GET_BITS 15 /* minimum allowable value */
-#else
-#define MIN_GET_BITS (BIT_BUF_SIZE-7)
-#endif
-
-
-GLOBAL(boolean)
-jpeg_fill_bit_buffer (bitread_working_state * state,
- register bit_buf_type get_buffer, register int bits_left,
- int nbits)
-/* Load up the bit buffer to a depth of at least nbits */
-{
- /* Copy heavily used state fields into locals (hopefully registers) */
- register const JOCTET * next_input_byte = state->next_input_byte;
- register size_t bytes_in_buffer = state->bytes_in_buffer;
- j_decompress_ptr cinfo = state->cinfo;
-
- /* Attempt to load at least MIN_GET_BITS bits into get_buffer. */
- /* (It is assumed that no request will be for more than that many bits.) */
- /* We fail to do so only if we hit a marker or are forced to suspend. */
-
- if (cinfo->unread_marker == 0) { /* cannot advance past a marker */
- while (bits_left < MIN_GET_BITS) {
- register int c;
-
- /* Attempt to read a byte */
- if (bytes_in_buffer == 0) {
- if (! (*cinfo->src->fill_input_buffer) (cinfo))
- return FALSE;
- next_input_byte = cinfo->src->next_input_byte;
- bytes_in_buffer = cinfo->src->bytes_in_buffer;
- }
- bytes_in_buffer--;
- c = GETJOCTET(*next_input_byte++);
-
- /* If it's 0xFF, check and discard stuffed zero byte */
- if (c == 0xFF) {
- /* Loop here to discard any padding FF's on terminating marker,
- * so that we can save a valid unread_marker value. NOTE: we will
- * accept multiple FF's followed by a 0 as meaning a single FF data
- * byte. This data pattern is not valid according to the standard.
- */
- do {
- if (bytes_in_buffer == 0) {
- if (! (*cinfo->src->fill_input_buffer) (cinfo))
- return FALSE;
- next_input_byte = cinfo->src->next_input_byte;
- bytes_in_buffer = cinfo->src->bytes_in_buffer;
- }
- bytes_in_buffer--;
- c = GETJOCTET(*next_input_byte++);
- } while (c == 0xFF);
-
- if (c == 0) {
- /* Found FF/00, which represents an FF data byte */
- c = 0xFF;
- } else {
- /* Oops, it's actually a marker indicating end of compressed data.
- * Save the marker code for later use.
- * Fine point: it might appear that we should save the marker into
- * bitread working state, not straight into permanent state. But
- * once we have hit a marker, we cannot need to suspend within the
- * current MCU, because we will read no more bytes from the data
- * source. So it is OK to update permanent state right away.
- */
- cinfo->unread_marker = c;
- /* See if we need to insert some fake zero bits. */
- goto no_more_bytes;
- }
- }
-
- /* OK, load c into get_buffer */
- get_buffer = (get_buffer << 8) | c;
- bits_left += 8;
- } /* end while */
- } else {
- no_more_bytes:
- /* We get here if we've read the marker that terminates the compressed
- * data segment. There should be enough bits in the buffer register
- * to satisfy the request; if so, no problem.
- */
- if (nbits > bits_left) {
- /* Uh-oh. Report corrupted data to user and stuff zeroes into
- * the data stream, so that we can produce some kind of image.
- * We use a nonvolatile flag to ensure that only one warning message
- * appears per data segment.
- */
- if (! cinfo->entropy->insufficient_data) {
- WARNMS(cinfo, JWRN_HIT_MARKER);
- cinfo->entropy->insufficient_data = TRUE;
- }
- /* Fill the buffer with zero bits */
- get_buffer <<= MIN_GET_BITS - bits_left;
- bits_left = MIN_GET_BITS;
- }
- }
-
- /* Unload the local registers */
- state->next_input_byte = next_input_byte;
- state->bytes_in_buffer = bytes_in_buffer;
- state->get_buffer = get_buffer;
- state->bits_left = bits_left;
-
- return TRUE;
-}
-
-
-/*
- * Out-of-line code for Huffman code decoding.
- * See jdhuff.h for info about usage.
- */
-
-GLOBAL(int)
-jpeg_huff_decode (bitread_working_state * state,
- register bit_buf_type get_buffer, register int bits_left,
- d_derived_tbl * htbl, int min_bits)
-{
- register int l = min_bits;
- register INT32 code;
-
- /* HUFF_DECODE has determined that the code is at least min_bits */
- /* bits long, so fetch that many bits in one swoop. */
-
- CHECK_BIT_BUFFER(*state, l, return -1);
- code = GET_BITS(l);
-
- /* Collect the rest of the Huffman code one bit at a time. */
- /* This is per Figure F.16 in the JPEG spec. */
-
- while (code > htbl->maxcode[l]) {
- code <<= 1;
- CHECK_BIT_BUFFER(*state, 1, return -1);
- code |= GET_BITS(1);
- l++;
- }
-
- /* Unload the local registers */
- state->get_buffer = get_buffer;
- state->bits_left = bits_left;
-
- /* With garbage input we may reach the sentinel value l = 17. */
-
- if (l > 16) {
- WARNMS(state->cinfo, JWRN_HUFF_BAD_CODE);
- return 0; /* fake a zero as the safest result */
- }
-
- return htbl->pub->huffval[ (int) (code + htbl->valoffset[l]) ];
-}
-
-
-/*
- * Figure F.12: extend sign bit.
- * On some machines, a shift and add will be faster than a table lookup.
- */
-
-#ifdef AVOID_TABLES
-
-#define HUFF_EXTEND(x,s) ((x) < (1<<((s)-1)) ? (x) + (((-1)<<(s)) + 1) : (x))
-
-#else
-
-#define HUFF_EXTEND(x,s) ((x) < extend_test[s] ? (x) + extend_offset[s] : (x))
-
-static const int extend_test[16] = /* entry n is 2**(n-1) */
- { 0, 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080,
- 0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000 };
-
-static const int extend_offset[16] = /* entry n is (-1 << n) + 1 */
- { 0, ((-1)<<1) + 1, ((-1)<<2) + 1, ((-1)<<3) + 1, ((-1)<<4) + 1,
- ((-1)<<5) + 1, ((-1)<<6) + 1, ((-1)<<7) + 1, ((-1)<<8) + 1,
- ((-1)<<9) + 1, ((-1)<<10) + 1, ((-1)<<11) + 1, ((-1)<<12) + 1,
- ((-1)<<13) + 1, ((-1)<<14) + 1, ((-1)<<15) + 1 };
-
-#endif /* AVOID_TABLES */
-
-
-/*
- * Check for a restart marker & resynchronize decoder.
- * Returns FALSE if must suspend.
- */
-
-LOCAL(boolean)
-process_restart (j_decompress_ptr cinfo)
-{
- huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
- int ci;
-
- /* Throw away any unused bits remaining in bit buffer; */
- /* include any full bytes in next_marker's count of discarded bytes */
- cinfo->marker->discarded_bytes += entropy->bitstate.bits_left / 8;
- entropy->bitstate.bits_left = 0;
-
- /* Advance past the RSTn marker */
- if (! (*cinfo->marker->read_restart_marker) (cinfo))
- return FALSE;
-
- /* Re-initialize DC predictions to 0 */
- for (ci = 0; ci < cinfo->comps_in_scan; ci++)
- entropy->saved.last_dc_val[ci] = 0;
-
- /* Reset restart counter */
- entropy->restarts_to_go = cinfo->restart_interval;
-
- /* Reset out-of-data flag, unless read_restart_marker left us smack up
- * against a marker. In that case we will end up treating the next data
- * segment as empty, and we can avoid producing bogus output pixels by
- * leaving the flag set.
- */
- if (cinfo->unread_marker == 0)
- entropy->pub.insufficient_data = FALSE;
-
- return TRUE;
-}
-
-
-/*
- * Decode and return one MCU's worth of Huffman-compressed coefficients.
- * The coefficients are reordered from zigzag order into natural array order,
- * but are not dequantized.
- *
- * The i'th block of the MCU is stored into the block pointed to by
- * MCU_data[i]. WE ASSUME THIS AREA HAS BEEN ZEROED BY THE CALLER.
- * (Wholesale zeroing is usually a little faster than retail...)
- *
- * Returns FALSE if data source requested suspension. In that case no
- * changes have been made to permanent state. (Exception: some output
- * coefficients may already have been assigned. This is harmless for
- * this module, since we'll just re-assign them on the next call.)
- */
-
-METHODDEF(boolean)
-decode_mcu (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
-{
- huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
- int blkn;
- BITREAD_STATE_VARS;
- savable_state state;
-
- /* Process restart marker if needed; may have to suspend */
- if (cinfo->restart_interval) {
- if (entropy->restarts_to_go == 0)
- if (! process_restart(cinfo))
- return FALSE;
- }
-
- /* If we've run out of data, just leave the MCU set to zeroes.
- * This way, we return uniform gray for the remainder of the segment.
- */
- if (! entropy->pub.insufficient_data) {
-
- /* Load up working state */
- BITREAD_LOAD_STATE(cinfo,entropy->bitstate);
- ASSIGN_STATE(state, entropy->saved);
-
- /* Outer loop handles each block in the MCU */
-
- for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
- JBLOCKROW block = MCU_data[blkn];
- d_derived_tbl * dctbl = entropy->dc_cur_tbls[blkn];
- d_derived_tbl * actbl = entropy->ac_cur_tbls[blkn];
- register int s, k, r;
-
- /* Decode a single block's worth of coefficients */
-
- /* Section F.2.2.1: decode the DC coefficient difference */
- HUFF_DECODE(s, br_state, dctbl, return FALSE, label1);
- if (s) {
- CHECK_BIT_BUFFER(br_state, s, return FALSE);
- r = GET_BITS(s);
- s = HUFF_EXTEND(r, s);
- }
-
- if (entropy->dc_needed[blkn]) {
- /* Convert DC difference to actual value, update last_dc_val */
- int ci = cinfo->MCU_membership[blkn];
- s += state.last_dc_val[ci];
- state.last_dc_val[ci] = s;
- /* Output the DC coefficient (assumes jpeg_natural_order[0] = 0) */
- (*block)[0] = (JCOEF) s;
- }
-
- if (entropy->ac_needed[blkn]) {
-
- /* Section F.2.2.2: decode the AC coefficients */
- /* Since zeroes are skipped, output area must be cleared beforehand */
- for (k = 1; k < DCTSIZE2; k++) {
- HUFF_DECODE(s, br_state, actbl, return FALSE, label2);
-
- r = s >> 4;
- s &= 15;
-
- if (s) {
- k += r;
- CHECK_BIT_BUFFER(br_state, s, return FALSE);
- r = GET_BITS(s);
- s = HUFF_EXTEND(r, s);
- /* Output coefficient in natural (dezigzagged) order.
- * Note: the extra entries in jpeg_natural_order[] will save us
- * if k >= DCTSIZE2, which could happen if the data is corrupted.
- */
- (*block)[jpeg_natural_order[k]] = (JCOEF) s;
- } else {
- if (r != 15)
- break;
- k += 15;
- }
- }
-
- } else {
-
- /* Section F.2.2.2: decode the AC coefficients */
- /* In this path we just discard the values */
- for (k = 1; k < DCTSIZE2; k++) {
- HUFF_DECODE(s, br_state, actbl, return FALSE, label3);
-
- r = s >> 4;
- s &= 15;
-
- if (s) {
- k += r;
- CHECK_BIT_BUFFER(br_state, s, return FALSE);
- DROP_BITS(s);
- } else {
- if (r != 15)
- break;
- k += 15;
- }
- }
-
- }
- }
-
- /* Completed MCU, so update state */
- BITREAD_SAVE_STATE(cinfo,entropy->bitstate);
- ASSIGN_STATE(entropy->saved, state);
- }
-
- /* Account for restart interval (no-op if not using restarts) */
- entropy->restarts_to_go--;
-
- return TRUE;
-}
-
-
-/*
- * Module initialization routine for Huffman entropy decoding.
- */
-
-GLOBAL(void)
-jinit_huff_decoder (j_decompress_ptr cinfo)
-{
- huff_entropy_ptr entropy;
- int i;
-
- entropy = (huff_entropy_ptr)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- SIZEOF(huff_entropy_decoder));
- cinfo->entropy = (struct jpeg_entropy_decoder *) entropy;
- entropy->pub.start_pass = start_pass_huff_decoder;
- entropy->pub.decode_mcu = decode_mcu;
-
- /* Mark tables unallocated */
- for (i = 0; i < NUM_HUFF_TBLS; i++) {
- entropy->dc_derived_tbls[i] = entropy->ac_derived_tbls[i] = NULL;
- }
-}
diff --git a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jdinput.c b/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jdinput.c
deleted file mode 100644
index 0c2ac8f120b..00000000000
--- a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jdinput.c
+++ /dev/null
@@ -1,381 +0,0 @@
-/*
- * jdinput.c
- *
- * Copyright (C) 1991-1997, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file contains input control logic for the JPEG decompressor.
- * These routines are concerned with controlling the decompressor's input
- * processing (marker reading and coefficient decoding). The actual input
- * reading is done in jdmarker.c, jdhuff.c, and jdphuff.c.
- */
-
-#define JPEG_INTERNALS
-#include "jinclude.h"
-#include "jpeglib.h"
-
-
-/* Private state */
-
-typedef struct {
- struct jpeg_input_controller pub; /* public fields */
-
- boolean inheaders; /* TRUE until first SOS is reached */
-} my_input_controller;
-
-typedef my_input_controller * my_inputctl_ptr;
-
-
-/* Forward declarations */
-METHODDEF(int) consume_markers JPP((j_decompress_ptr cinfo));
-
-
-/*
- * Routines to calculate various quantities related to the size of the image.
- */
-
-LOCAL(void)
-initial_setup (j_decompress_ptr cinfo)
-/* Called once, when first SOS marker is reached */
-{
- int ci;
- jpeg_component_info *compptr;
-
- /* Make sure image isn't bigger than I can handle */
- if ((long) cinfo->image_height > (long) JPEG_MAX_DIMENSION ||
- (long) cinfo->image_width > (long) JPEG_MAX_DIMENSION)
- ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int) JPEG_MAX_DIMENSION);
-
- /* For now, precision must match compiled-in value... */
- if (cinfo->data_precision != BITS_IN_JSAMPLE)
- ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
-
- /* Check that number of components won't exceed internal array sizes */
- if (cinfo->num_components > MAX_COMPONENTS)
- ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components,
- MAX_COMPONENTS);
-
- /* Compute maximum sampling factors; check factor validity */
- cinfo->max_h_samp_factor = 1;
- cinfo->max_v_samp_factor = 1;
- for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
- ci++, compptr++) {
- if (compptr->h_samp_factor<=0 || compptr->h_samp_factor>MAX_SAMP_FACTOR ||
- compptr->v_samp_factor<=0 || compptr->v_samp_factor>MAX_SAMP_FACTOR)
- ERREXIT(cinfo, JERR_BAD_SAMPLING);
- cinfo->max_h_samp_factor = MAX(cinfo->max_h_samp_factor,
- compptr->h_samp_factor);
- cinfo->max_v_samp_factor = MAX(cinfo->max_v_samp_factor,
- compptr->v_samp_factor);
- }
-
- /* We initialize DCT_scaled_size and min_DCT_scaled_size to DCTSIZE.
- * In the full decompressor, this will be overridden by jdmaster.c;
- * but in the transcoder, jdmaster.c is not used, so we must do it here.
- */
- cinfo->min_DCT_scaled_size = DCTSIZE;
-
- /* Compute dimensions of components */
- for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
- ci++, compptr++) {
- compptr->DCT_scaled_size = DCTSIZE;
- /* Size in DCT blocks */
- compptr->width_in_blocks = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_width * (long) compptr->h_samp_factor,
- (long) (cinfo->max_h_samp_factor * DCTSIZE));
- compptr->height_in_blocks = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_height * (long) compptr->v_samp_factor,
- (long) (cinfo->max_v_samp_factor * DCTSIZE));
- /* downsampled_width and downsampled_height will also be overridden by
- * jdmaster.c if we are doing full decompression. The transcoder library
- * doesn't use these values, but the calling application might.
- */
- /* Size in samples */
- compptr->downsampled_width = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_width * (long) compptr->h_samp_factor,
- (long) cinfo->max_h_samp_factor);
- compptr->downsampled_height = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_height * (long) compptr->v_samp_factor,
- (long) cinfo->max_v_samp_factor);
- /* Mark component needed, until color conversion says otherwise */
- compptr->component_needed = TRUE;
- /* Mark no quantization table yet saved for component */
- compptr->quant_table = NULL;
- }
-
- /* Compute number of fully interleaved MCU rows. */
- cinfo->total_iMCU_rows = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_height,
- (long) (cinfo->max_v_samp_factor*DCTSIZE));
-
- /* Decide whether file contains multiple scans */
- if (cinfo->comps_in_scan < cinfo->num_components || cinfo->progressive_mode)
- cinfo->inputctl->has_multiple_scans = TRUE;
- else
- cinfo->inputctl->has_multiple_scans = FALSE;
-}
-
-
-LOCAL(void)
-per_scan_setup (j_decompress_ptr cinfo)
-/* Do computations that are needed before processing a JPEG scan */
-/* cinfo->comps_in_scan and cinfo->cur_comp_info[] were set from SOS marker */
-{
- int ci, mcublks, tmp;
- jpeg_component_info *compptr;
-
- if (cinfo->comps_in_scan == 1) {
-
- /* Noninterleaved (single-component) scan */
- compptr = cinfo->cur_comp_info[0];
-
- /* Overall image size in MCUs */
- cinfo->MCUs_per_row = compptr->width_in_blocks;
- cinfo->MCU_rows_in_scan = compptr->height_in_blocks;
-
- /* For noninterleaved scan, always one block per MCU */
- compptr->MCU_width = 1;
- compptr->MCU_height = 1;
- compptr->MCU_blocks = 1;
- compptr->MCU_sample_width = compptr->DCT_scaled_size;
- compptr->last_col_width = 1;
- /* For noninterleaved scans, it is convenient to define last_row_height
- * as the number of block rows present in the last iMCU row.
- */
- tmp = (int) (compptr->height_in_blocks % compptr->v_samp_factor);
- if (tmp == 0) tmp = compptr->v_samp_factor;
- compptr->last_row_height = tmp;
-
- /* Prepare array describing MCU composition */
- cinfo->blocks_in_MCU = 1;
- cinfo->MCU_membership[0] = 0;
-
- } else {
-
- /* Interleaved (multi-component) scan */
- if (cinfo->comps_in_scan <= 0 || cinfo->comps_in_scan > MAX_COMPS_IN_SCAN)
- ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->comps_in_scan,
- MAX_COMPS_IN_SCAN);
-
- /* Overall image size in MCUs */
- cinfo->MCUs_per_row = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_width,
- (long) (cinfo->max_h_samp_factor*DCTSIZE));
- cinfo->MCU_rows_in_scan = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_height,
- (long) (cinfo->max_v_samp_factor*DCTSIZE));
-
- cinfo->blocks_in_MCU = 0;
-
- for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
- compptr = cinfo->cur_comp_info[ci];
- /* Sampling factors give # of blocks of component in each MCU */
- compptr->MCU_width = compptr->h_samp_factor;
- compptr->MCU_height = compptr->v_samp_factor;
- compptr->MCU_blocks = compptr->MCU_width * compptr->MCU_height;
- compptr->MCU_sample_width = compptr->MCU_width * compptr->DCT_scaled_size;
- /* Figure number of non-dummy blocks in last MCU column & row */
- tmp = (int) (compptr->width_in_blocks % compptr->MCU_width);
- if (tmp == 0) tmp = compptr->MCU_width;
- compptr->last_col_width = tmp;
- tmp = (int) (compptr->height_in_blocks % compptr->MCU_height);
- if (tmp == 0) tmp = compptr->MCU_height;
- compptr->last_row_height = tmp;
- /* Prepare array describing MCU composition */
- mcublks = compptr->MCU_blocks;
- if (cinfo->blocks_in_MCU + mcublks > D_MAX_BLOCKS_IN_MCU)
- ERREXIT(cinfo, JERR_BAD_MCU_SIZE);
- while (mcublks-- > 0) {
- cinfo->MCU_membership[cinfo->blocks_in_MCU++] = ci;
- }
- }
-
- }
-}
-
-
-/*
- * Save away a copy of the Q-table referenced by each component present
- * in the current scan, unless already saved during a prior scan.
- *
- * In a multiple-scan JPEG file, the encoder could assign different components
- * the same Q-table slot number, but change table definitions between scans
- * so that each component uses a different Q-table. (The IJG encoder is not
- * currently capable of doing this, but other encoders might.) Since we want
- * to be able to dequantize all the components at the end of the file, this
- * means that we have to save away the table actually used for each component.
- * We do this by copying the table at the start of the first scan containing
- * the component.
- * The JPEG spec prohibits the encoder from changing the contents of a Q-table
- * slot between scans of a component using that slot. If the encoder does so
- * anyway, this decoder will simply use the Q-table values that were current
- * at the start of the first scan for the component.
- *
- * The decompressor output side looks only at the saved quant tables,
- * not at the current Q-table slots.
- */
-
-LOCAL(void)
-latch_quant_tables (j_decompress_ptr cinfo)
-{
- int ci, qtblno;
- jpeg_component_info *compptr;
- JQUANT_TBL * qtbl;
-
- for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
- compptr = cinfo->cur_comp_info[ci];
- /* No work if we already saved Q-table for this component */
- if (compptr->quant_table != NULL)
- continue;
- /* Make sure specified quantization table is present */
- qtblno = compptr->quant_tbl_no;
- if (qtblno < 0 || qtblno >= NUM_QUANT_TBLS ||
- cinfo->quant_tbl_ptrs[qtblno] == NULL)
- ERREXIT1(cinfo, JERR_NO_QUANT_TABLE, qtblno);
- /* OK, save away the quantization table */
- qtbl = (JQUANT_TBL *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- SIZEOF(JQUANT_TBL));
- MEMCOPY(qtbl, cinfo->quant_tbl_ptrs[qtblno], SIZEOF(JQUANT_TBL));
- compptr->quant_table = qtbl;
- }
-}
-
-
-/*
- * Initialize the input modules to read a scan of compressed data.
- * The first call to this is done by jdmaster.c after initializing
- * the entire decompressor (during jpeg_start_decompress).
- * Subsequent calls come from consume_markers, below.
- */
-
-METHODDEF(void)
-start_input_pass (j_decompress_ptr cinfo)
-{
- per_scan_setup(cinfo);
- latch_quant_tables(cinfo);
- (*cinfo->entropy->start_pass) (cinfo);
- (*cinfo->coef->start_input_pass) (cinfo);
- cinfo->inputctl->consume_input = cinfo->coef->consume_data;
-}
-
-
-/*
- * Finish up after inputting a compressed-data scan.
- * This is called by the coefficient controller after it's read all
- * the expected data of the scan.
- */
-
-METHODDEF(void)
-finish_input_pass (j_decompress_ptr cinfo)
-{
- cinfo->inputctl->consume_input = consume_markers;
-}
-
-
-/*
- * Read JPEG markers before, between, or after compressed-data scans.
- * Change state as necessary when a new scan is reached.
- * Return value is JPEG_SUSPENDED, JPEG_REACHED_SOS, or JPEG_REACHED_EOI.
- *
- * The consume_input method pointer points either here or to the
- * coefficient controller's consume_data routine, depending on whether
- * we are reading a compressed data segment or inter-segment markers.
- */
-
-METHODDEF(int)
-consume_markers (j_decompress_ptr cinfo)
-{
- my_inputctl_ptr inputctl = (my_inputctl_ptr) cinfo->inputctl;
- int val;
-
- if (inputctl->pub.eoi_reached) /* After hitting EOI, read no further */
- return JPEG_REACHED_EOI;
-
- val = (*cinfo->marker->read_markers) (cinfo);
-
- switch (val) {
- case JPEG_REACHED_SOS: /* Found SOS */
- if (inputctl->inheaders) { /* 1st SOS */
- initial_setup(cinfo);
- inputctl->inheaders = FALSE;
- /* Note: start_input_pass must be called by jdmaster.c
- * before any more input can be consumed. jdapimin.c is
- * responsible for enforcing this sequencing.
- */
- } else { /* 2nd or later SOS marker */
- if (! inputctl->pub.has_multiple_scans)
- ERREXIT(cinfo, JERR_EOI_EXPECTED); /* Oops, I wasn't expecting this! */
- start_input_pass(cinfo);
- }
- break;
- case JPEG_REACHED_EOI: /* Found EOI */
- inputctl->pub.eoi_reached = TRUE;
- if (inputctl->inheaders) { /* Tables-only datastream, apparently */
- if (cinfo->marker->saw_SOF)
- ERREXIT(cinfo, JERR_SOF_NO_SOS);
- } else {
- /* Prevent infinite loop in coef ctlr's decompress_data routine
- * if user set output_scan_number larger than number of scans.
- */
- if (cinfo->output_scan_number > cinfo->input_scan_number)
- cinfo->output_scan_number = cinfo->input_scan_number;
- }
- break;
- case JPEG_SUSPENDED:
- break;
- }
-
- return val;
-}
-
-
-/*
- * Reset state to begin a fresh datastream.
- */
-
-METHODDEF(void)
-reset_input_controller (j_decompress_ptr cinfo)
-{
- my_inputctl_ptr inputctl = (my_inputctl_ptr) cinfo->inputctl;
-
- inputctl->pub.consume_input = consume_markers;
- inputctl->pub.has_multiple_scans = FALSE; /* "unknown" would be better */
- inputctl->pub.eoi_reached = FALSE;
- inputctl->inheaders = TRUE;
- /* Reset other modules */
- (*cinfo->err->reset_error_mgr) ((j_common_ptr) cinfo);
- (*cinfo->marker->reset_marker_reader) (cinfo);
- /* Reset progression state -- would be cleaner if entropy decoder did this */
- cinfo->coef_bits = NULL;
-}
-
-
-/*
- * Initialize the input controller module.
- * This is called only once, when the decompression object is created.
- */
-
-GLOBAL(void)
-jinit_input_controller (j_decompress_ptr cinfo)
-{
- my_inputctl_ptr inputctl;
-
- /* Create subobject in permanent pool */
- inputctl = (my_inputctl_ptr)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
- SIZEOF(my_input_controller));
- cinfo->inputctl = (struct jpeg_input_controller *) inputctl;
- /* Initialize method pointers */
- inputctl->pub.consume_input = consume_markers;
- inputctl->pub.reset_input_controller = reset_input_controller;
- inputctl->pub.start_input_pass = start_input_pass;
- inputctl->pub.finish_input_pass = finish_input_pass;
- /* Initialize state: can't use reset_input_controller since we don't
- * want to try to reset other modules yet.
- */
- inputctl->pub.has_multiple_scans = FALSE; /* "unknown" would be better */
- inputctl->pub.eoi_reached = FALSE;
- inputctl->inheaders = TRUE;
-}
diff --git a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jdmainct.c b/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jdmainct.c
deleted file mode 100644
index 13c956f5deb..00000000000
--- a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jdmainct.c
+++ /dev/null
@@ -1,512 +0,0 @@
-/*
- * jdmainct.c
- *
- * Copyright (C) 1994-1996, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file contains the main buffer controller for decompression.
- * The main buffer lies between the JPEG decompressor proper and the
- * post-processor; it holds downsampled data in the JPEG colorspace.
- *
- * Note that this code is bypassed in raw-data mode, since the application
- * supplies the equivalent of the main buffer in that case.
- */
-
-#define JPEG_INTERNALS
-#include "jinclude.h"
-#include "jpeglib.h"
-
-
-/*
- * In the current system design, the main buffer need never be a full-image
- * buffer; any full-height buffers will be found inside the coefficient or
- * postprocessing controllers. Nonetheless, the main controller is not
- * trivial. Its responsibility is to provide context rows for upsampling/
- * rescaling, and doing this in an efficient fashion is a bit tricky.
- *
- * Postprocessor input data is counted in "row groups". A row group
- * is defined to be (v_samp_factor * DCT_scaled_size / min_DCT_scaled_size)
- * sample rows of each component. (We require DCT_scaled_size values to be
- * chosen such that these numbers are integers. In practice DCT_scaled_size
- * values will likely be powers of two, so we actually have the stronger
- * condition that DCT_scaled_size / min_DCT_scaled_size is an integer.)
- * Upsampling will typically produce max_v_samp_factor pixel rows from each
- * row group (times any additional scale factor that the upsampler is
- * applying).
- *
- * The coefficient controller will deliver data to us one iMCU row at a time;
- * each iMCU row contains v_samp_factor * DCT_scaled_size sample rows, or
- * exactly min_DCT_scaled_size row groups. (This amount of data corresponds
- * to one row of MCUs when the image is fully interleaved.) Note that the
- * number of sample rows varies across components, but the number of row
- * groups does not. Some garbage sample rows may be included in the last iMCU
- * row at the bottom of the image.
- *
- * Depending on the vertical scaling algorithm used, the upsampler may need
- * access to the sample row(s) above and below its current input row group.
- * The upsampler is required to set need_context_rows TRUE at global selection
- * time if so. When need_context_rows is FALSE, this controller can simply
- * obtain one iMCU row at a time from the coefficient controller and dole it
- * out as row groups to the postprocessor.
- *
- * When need_context_rows is TRUE, this controller guarantees that the buffer
- * passed to postprocessing contains at least one row group's worth of samples
- * above and below the row group(s) being processed. Note that the context
- * rows "above" the first passed row group appear at negative row offsets in
- * the passed buffer. At the top and bottom of the image, the required
- * context rows are manufactured by duplicating the first or last real sample
- * row; this avoids having special cases in the upsampling inner loops.
- *
- * The amount of context is fixed at one row group just because that's a
- * convenient number for this controller to work with. The existing
- * upsamplers really only need one sample row of context. An upsampler
- * supporting arbitrary output rescaling might wish for more than one row
- * group of context when shrinking the image; tough, we don't handle that.
- * (This is justified by the assumption that downsizing will be handled mostly
- * by adjusting the DCT_scaled_size values, so that the actual scale factor at
- * the upsample step needn't be much less than one.)
- *
- * To provide the desired context, we have to retain the last two row groups
- * of one iMCU row while reading in the next iMCU row. (The last row group
- * can't be processed until we have another row group for its below-context,
- * and so we have to save the next-to-last group too for its above-context.)
- * We could do this most simply by copying data around in our buffer, but
- * that'd be very slow. We can avoid copying any data by creating a rather
- * strange pointer structure. Here's how it works. We allocate a workspace
- * consisting of M+2 row groups (where M = min_DCT_scaled_size is the number
- * of row groups per iMCU row). We create two sets of redundant pointers to
- * the workspace. Labeling the physical row groups 0 to M+1, the synthesized
- * pointer lists look like this:
- * M+1 M-1
- * master pointer --> 0 master pointer --> 0
- * 1 1
- * ... ...
- * M-3 M-3
- * M-2 M
- * M-1 M+1
- * M M-2
- * M+1 M-1
- * 0 0
- * We read alternate iMCU rows using each master pointer; thus the last two
- * row groups of the previous iMCU row remain un-overwritten in the workspace.
- * The pointer lists are set up so that the required context rows appear to
- * be adjacent to the proper places when we pass the pointer lists to the
- * upsampler.
- *
- * The above pictures describe the normal state of the pointer lists.
- * At top and bottom of the image, we diddle the pointer lists to duplicate
- * the first or last sample row as necessary (this is cheaper than copying
- * sample rows around).
- *
- * This scheme breaks down if M < 2, ie, min_DCT_scaled_size is 1. In that
- * situation each iMCU row provides only one row group so the buffering logic
- * must be different (eg, we must read two iMCU rows before we can emit the
- * first row group). For now, we simply do not support providing context
- * rows when min_DCT_scaled_size is 1. That combination seems unlikely to
- * be worth providing --- if someone wants a 1/8th-size preview, they probably
- * want it quick and dirty, so a context-free upsampler is sufficient.
- */
-
-
-/* Private buffer controller object */
-
-typedef struct {
- struct jpeg_d_main_controller pub; /* public fields */
-
- /* Pointer to allocated workspace (M or M+2 row groups). */
- JSAMPARRAY buffer[MAX_COMPONENTS];
-
- boolean buffer_full; /* Have we gotten an iMCU row from decoder? */
- JDIMENSION rowgroup_ctr; /* counts row groups output to postprocessor */
-
- /* Remaining fields are only used in the context case. */
-
- /* These are the master pointers to the funny-order pointer lists. */
- JSAMPIMAGE xbuffer[2]; /* pointers to weird pointer lists */
-
- int whichptr; /* indicates which pointer set is now in use */
- int context_state; /* process_data state machine status */
- JDIMENSION rowgroups_avail; /* row groups available to postprocessor */
- JDIMENSION iMCU_row_ctr; /* counts iMCU rows to detect image top/bot */
-} my_main_controller;
-
-typedef my_main_controller * my_main_ptr;
-
-/* context_state values: */
-#define CTX_PREPARE_FOR_IMCU 0 /* need to prepare for MCU row */
-#define CTX_PROCESS_IMCU 1 /* feeding iMCU to postprocessor */
-#define CTX_POSTPONED_ROW 2 /* feeding postponed row group */
-
-
-/* Forward declarations */
-METHODDEF(void) process_data_simple_main
- JPP((j_decompress_ptr cinfo, JSAMPARRAY output_buf,
- JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail));
-METHODDEF(void) process_data_context_main
- JPP((j_decompress_ptr cinfo, JSAMPARRAY output_buf,
- JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail));
-#ifdef QUANT_2PASS_SUPPORTED
-METHODDEF(void) process_data_crank_post
- JPP((j_decompress_ptr cinfo, JSAMPARRAY output_buf,
- JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail));
-#endif
-
-
-LOCAL(void)
-alloc_funny_pointers (j_decompress_ptr cinfo)
-/* Allocate space for the funny pointer lists.
- * This is done only once, not once per pass.
- */
-{
- my_main_ptr main = (my_main_ptr) cinfo->main;
- int ci, rgroup;
- int M = cinfo->min_DCT_scaled_size;
- jpeg_component_info *compptr;
- JSAMPARRAY xbuf;
-
- /* Get top-level space for component array pointers.
- * We alloc both arrays with one call to save a few cycles.
- */
- main->xbuffer[0] = (JSAMPIMAGE)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- cinfo->num_components * 2 * SIZEOF(JSAMPARRAY));
- main->xbuffer[1] = main->xbuffer[0] + cinfo->num_components;
-
- for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
- ci++, compptr++) {
- rgroup = (compptr->v_samp_factor * compptr->DCT_scaled_size) /
- cinfo->min_DCT_scaled_size; /* height of a row group of component */
- /* Get space for pointer lists --- M+4 row groups in each list.
- * We alloc both pointer lists with one call to save a few cycles.
- */
- xbuf = (JSAMPARRAY)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- 2 * (rgroup * (M + 4)) * SIZEOF(JSAMPROW));
- xbuf += rgroup; /* want one row group at negative offsets */
- main->xbuffer[0][ci] = xbuf;
- xbuf += rgroup * (M + 4);
- main->xbuffer[1][ci] = xbuf;
- }
-}
-
-
-LOCAL(void)
-make_funny_pointers (j_decompress_ptr cinfo)
-/* Create the funny pointer lists discussed in the comments above.
- * The actual workspace is already allocated (in main->buffer),
- * and the space for the pointer lists is allocated too.
- * This routine just fills in the curiously ordered lists.
- * This will be repeated at the beginning of each pass.
- */
-{
- my_main_ptr main = (my_main_ptr) cinfo->main;
- int ci, i, rgroup;
- int M = cinfo->min_DCT_scaled_size;
- jpeg_component_info *compptr;
- JSAMPARRAY buf, xbuf0, xbuf1;
-
- for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
- ci++, compptr++) {
- rgroup = (compptr->v_samp_factor * compptr->DCT_scaled_size) /
- cinfo->min_DCT_scaled_size; /* height of a row group of component */
- xbuf0 = main->xbuffer[0][ci];
- xbuf1 = main->xbuffer[1][ci];
- /* First copy the workspace pointers as-is */
- buf = main->buffer[ci];
- for (i = 0; i < rgroup * (M + 2); i++) {
- xbuf0[i] = xbuf1[i] = buf[i];
- }
- /* In the second list, put the last four row groups in swapped order */
- for (i = 0; i < rgroup * 2; i++) {
- xbuf1[rgroup*(M-2) + i] = buf[rgroup*M + i];
- xbuf1[rgroup*M + i] = buf[rgroup*(M-2) + i];
- }
- /* The wraparound pointers at top and bottom will be filled later
- * (see set_wraparound_pointers, below). Initially we want the "above"
- * pointers to duplicate the first actual data line. This only needs
- * to happen in xbuffer[0].
- */
- for (i = 0; i < rgroup; i++) {
- xbuf0[i - rgroup] = xbuf0[0];
- }
- }
-}
-
-
-LOCAL(void)
-set_wraparound_pointers (j_decompress_ptr cinfo)
-/* Set up the "wraparound" pointers at top and bottom of the pointer lists.
- * This changes the pointer list state from top-of-image to the normal state.
- */
-{
- my_main_ptr main = (my_main_ptr) cinfo->main;
- int ci, i, rgroup;
- int M = cinfo->min_DCT_scaled_size;
- jpeg_component_info *compptr;
- JSAMPARRAY xbuf0, xbuf1;
-
- for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
- ci++, compptr++) {
- rgroup = (compptr->v_samp_factor * compptr->DCT_scaled_size) /
- cinfo->min_DCT_scaled_size; /* height of a row group of component */
- xbuf0 = main->xbuffer[0][ci];
- xbuf1 = main->xbuffer[1][ci];
- for (i = 0; i < rgroup; i++) {
- xbuf0[i - rgroup] = xbuf0[rgroup*(M+1) + i];
- xbuf1[i - rgroup] = xbuf1[rgroup*(M+1) + i];
- xbuf0[rgroup*(M+2) + i] = xbuf0[i];
- xbuf1[rgroup*(M+2) + i] = xbuf1[i];
- }
- }
-}
-
-
-LOCAL(void)
-set_bottom_pointers (j_decompress_ptr cinfo)
-/* Change the pointer lists to duplicate the last sample row at the bottom
- * of the image. whichptr indicates which xbuffer holds the final iMCU row.
- * Also sets rowgroups_avail to indicate number of nondummy row groups in row.
- */
-{
- my_main_ptr main = (my_main_ptr) cinfo->main;
- int ci, i, rgroup, iMCUheight, rows_left;
- jpeg_component_info *compptr;
- JSAMPARRAY xbuf;
-
- for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
- ci++, compptr++) {
- /* Count sample rows in one iMCU row and in one row group */
- iMCUheight = compptr->v_samp_factor * compptr->DCT_scaled_size;
- rgroup = iMCUheight / cinfo->min_DCT_scaled_size;
- /* Count nondummy sample rows remaining for this component */
- rows_left = (int) (compptr->downsampled_height % (JDIMENSION) iMCUheight);
- if (rows_left == 0) rows_left = iMCUheight;
- /* Count nondummy row groups. Should get same answer for each component,
- * so we need only do it once.
- */
- if (ci == 0) {
- main->rowgroups_avail = (JDIMENSION) ((rows_left-1) / rgroup + 1);
- }
- /* Duplicate the last real sample row rgroup*2 times; this pads out the
- * last partial rowgroup and ensures at least one full rowgroup of context.
- */
- xbuf = main->xbuffer[main->whichptr][ci];
- for (i = 0; i < rgroup * 2; i++) {
- xbuf[rows_left + i] = xbuf[rows_left-1];
- }
- }
-}
-
-
-/*
- * Initialize for a processing pass.
- */
-
-METHODDEF(void)
-start_pass_main (j_decompress_ptr cinfo, J_BUF_MODE pass_mode)
-{
- my_main_ptr main = (my_main_ptr) cinfo->main;
-
- switch (pass_mode) {
- case JBUF_PASS_THRU:
- if (cinfo->upsample->need_context_rows) {
- main->pub.process_data = process_data_context_main;
- make_funny_pointers(cinfo); /* Create the xbuffer[] lists */
- main->whichptr = 0; /* Read first iMCU row into xbuffer[0] */
- main->context_state = CTX_PREPARE_FOR_IMCU;
- main->iMCU_row_ctr = 0;
- } else {
- /* Simple case with no context needed */
- main->pub.process_data = process_data_simple_main;
- }
- main->buffer_full = FALSE; /* Mark buffer empty */
- main->rowgroup_ctr = 0;
- break;
-#ifdef QUANT_2PASS_SUPPORTED
- case JBUF_CRANK_DEST:
- /* For last pass of 2-pass quantization, just crank the postprocessor */
- main->pub.process_data = process_data_crank_post;
- break;
-#endif
- default:
- ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
- break;
- }
-}
-
-
-/*
- * Process some data.
- * This handles the simple case where no context is required.
- */
-
-METHODDEF(void)
-process_data_simple_main (j_decompress_ptr cinfo,
- JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
- JDIMENSION out_rows_avail)
-{
- my_main_ptr main = (my_main_ptr) cinfo->main;
- JDIMENSION rowgroups_avail;
-
- /* Read input data if we haven't filled the main buffer yet */
- if (! main->buffer_full) {
- if (! (*cinfo->coef->decompress_data) (cinfo, main->buffer))
- return; /* suspension forced, can do nothing more */
- main->buffer_full = TRUE; /* OK, we have an iMCU row to work with */
- }
-
- /* There are always min_DCT_scaled_size row groups in an iMCU row. */
- rowgroups_avail = (JDIMENSION) cinfo->min_DCT_scaled_size;
- /* Note: at the bottom of the image, we may pass extra garbage row groups
- * to the postprocessor. The postprocessor has to check for bottom
- * of image anyway (at row resolution), so no point in us doing it too.
- */
-
- /* Feed the postprocessor */
- (*cinfo->post->post_process_data) (cinfo, main->buffer,
- &main->rowgroup_ctr, rowgroups_avail,
- output_buf, out_row_ctr, out_rows_avail);
-
- /* Has postprocessor consumed all the data yet? If so, mark buffer empty */
- if (main->rowgroup_ctr >= rowgroups_avail) {
- main->buffer_full = FALSE;
- main->rowgroup_ctr = 0;
- }
-}
-
-
-/*
- * Process some data.
- * This handles the case where context rows must be provided.
- */
-
-METHODDEF(void)
-process_data_context_main (j_decompress_ptr cinfo,
- JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
- JDIMENSION out_rows_avail)
-{
- my_main_ptr main = (my_main_ptr) cinfo->main;
-
- /* Read input data if we haven't filled the main buffer yet */
- if (! main->buffer_full) {
- if (! (*cinfo->coef->decompress_data) (cinfo,
- main->xbuffer[main->whichptr]))
- return; /* suspension forced, can do nothing more */
- main->buffer_full = TRUE; /* OK, we have an iMCU row to work with */
- main->iMCU_row_ctr++; /* count rows received */
- }
-
- /* Postprocessor typically will not swallow all the input data it is handed
- * in one call (due to filling the output buffer first). Must be prepared
- * to exit and restart. This switch lets us keep track of how far we got.
- * Note that each case falls through to the next on successful completion.
- */
- switch (main->context_state) {
- case CTX_POSTPONED_ROW:
- /* Call postprocessor using previously set pointers for postponed row */
- (*cinfo->post->post_process_data) (cinfo, main->xbuffer[main->whichptr],
- &main->rowgroup_ctr, main->rowgroups_avail,
- output_buf, out_row_ctr, out_rows_avail);
- if (main->rowgroup_ctr < main->rowgroups_avail)
- return; /* Need to suspend */
- main->context_state = CTX_PREPARE_FOR_IMCU;
- if (*out_row_ctr >= out_rows_avail)
- return; /* Postprocessor exactly filled output buf */
- /*FALLTHROUGH*/
- case CTX_PREPARE_FOR_IMCU:
- /* Prepare to process first M-1 row groups of this iMCU row */
- main->rowgroup_ctr = 0;
- main->rowgroups_avail = (JDIMENSION) (cinfo->min_DCT_scaled_size - 1);
- /* Check for bottom of image: if so, tweak pointers to "duplicate"
- * the last sample row, and adjust rowgroups_avail to ignore padding rows.
- */
- if (main->iMCU_row_ctr == cinfo->total_iMCU_rows)
- set_bottom_pointers(cinfo);
- main->context_state = CTX_PROCESS_IMCU;
- /*FALLTHROUGH*/
- case CTX_PROCESS_IMCU:
- /* Call postprocessor using previously set pointers */
- (*cinfo->post->post_process_data) (cinfo, main->xbuffer[main->whichptr],
- &main->rowgroup_ctr, main->rowgroups_avail,
- output_buf, out_row_ctr, out_rows_avail);
- if (main->rowgroup_ctr < main->rowgroups_avail)
- return; /* Need to suspend */
- /* After the first iMCU, change wraparound pointers to normal state */
- if (main->iMCU_row_ctr == 1)
- set_wraparound_pointers(cinfo);
- /* Prepare to load new iMCU row using other xbuffer list */
- main->whichptr ^= 1; /* 0=>1 or 1=>0 */
- main->buffer_full = FALSE;
- /* Still need to process last row group of this iMCU row, */
- /* which is saved at index M+1 of the other xbuffer */
- main->rowgroup_ctr = (JDIMENSION) (cinfo->min_DCT_scaled_size + 1);
- main->rowgroups_avail = (JDIMENSION) (cinfo->min_DCT_scaled_size + 2);
- main->context_state = CTX_POSTPONED_ROW;
- }
-}
-
-
-/*
- * Process some data.
- * Final pass of two-pass quantization: just call the postprocessor.
- * Source data will be the postprocessor controller's internal buffer.
- */
-
-#ifdef QUANT_2PASS_SUPPORTED
-
-METHODDEF(void)
-process_data_crank_post (j_decompress_ptr cinfo,
- JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
- JDIMENSION out_rows_avail)
-{
- (*cinfo->post->post_process_data) (cinfo, (JSAMPIMAGE) NULL,
- (JDIMENSION *) NULL, (JDIMENSION) 0,
- output_buf, out_row_ctr, out_rows_avail);
-}
-
-#endif /* QUANT_2PASS_SUPPORTED */
-
-
-/*
- * Initialize main buffer controller.
- */
-
-GLOBAL(void)
-jinit_d_main_controller (j_decompress_ptr cinfo, boolean need_full_buffer)
-{
- my_main_ptr main;
- int ci, rgroup, ngroups;
- jpeg_component_info *compptr;
-
- main = (my_main_ptr)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- SIZEOF(my_main_controller));
- cinfo->main = (struct jpeg_d_main_controller *) main;
- main->pub.start_pass = start_pass_main;
-
- if (need_full_buffer) /* shouldn't happen */
- ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
-
- /* Allocate the workspace.
- * ngroups is the number of row groups we need.
- */
- if (cinfo->upsample->need_context_rows) {
- if (cinfo->min_DCT_scaled_size < 2) /* unsupported, see comments above */
- ERREXIT(cinfo, JERR_NOTIMPL);
- alloc_funny_pointers(cinfo); /* Alloc space for xbuffer[] lists */
- ngroups = cinfo->min_DCT_scaled_size + 2;
- } else {
- ngroups = cinfo->min_DCT_scaled_size;
- }
-
- for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
- ci++, compptr++) {
- rgroup = (compptr->v_samp_factor * compptr->DCT_scaled_size) /
- cinfo->min_DCT_scaled_size; /* height of a row group of component */
- main->buffer[ci] = (*cinfo->mem->alloc_sarray)
- ((j_common_ptr) cinfo, JPOOL_IMAGE,
- compptr->width_in_blocks * compptr->DCT_scaled_size,
- (JDIMENSION) (rgroup * ngroups));
- }
-}
diff --git a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jdmarker.c b/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jdmarker.c
deleted file mode 100644
index 449a3c0f682..00000000000
--- a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jdmarker.c
+++ /dev/null
@@ -1,1393 +0,0 @@
-/*
- * jdmarker.c
- *
- * Copyright (C) 1991-1998, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file contains routines to decode JPEG datastream markers.
- * Most of the complexity arises from our desire to support input
- * suspension: if not all of the data for a marker is available,
- * we must exit back to the application. On resumption, we reprocess
- * the marker.
- */
-
-#define JPEG_INTERNALS
-#include "jinclude.h"
-#include "jpeglib.h"
-
-
-typedef enum { /* JPEG marker codes */
- M_SOF0 = 0xc0,
- M_SOF1 = 0xc1,
- M_SOF2 = 0xc2,
- M_SOF3 = 0xc3,
-
- M_SOF5 = 0xc5,
- M_SOF6 = 0xc6,
- M_SOF7 = 0xc7,
-
- M_JPG = 0xc8,
- M_SOF9 = 0xc9,
- M_SOF10 = 0xca,
- M_SOF11 = 0xcb,
-
- M_SOF13 = 0xcd,
- M_SOF14 = 0xce,
- M_SOF15 = 0xcf,
-
- M_DHT = 0xc4,
-
- M_DAC = 0xcc,
-
- M_RST0 = 0xd0,
- M_RST1 = 0xd1,
- M_RST2 = 0xd2,
- M_RST3 = 0xd3,
- M_RST4 = 0xd4,
- M_RST5 = 0xd5,
- M_RST6 = 0xd6,
- M_RST7 = 0xd7,
-
- M_SOI = 0xd8,
- M_EOI = 0xd9,
- M_SOS = 0xda,
- M_DQT = 0xdb,
- M_DNL = 0xdc,
- M_DRI = 0xdd,
- M_DHP = 0xde,
- M_EXP = 0xdf,
-
- M_APP0 = 0xe0,
- M_APP1 = 0xe1,
- M_APP2 = 0xe2,
- M_APP3 = 0xe3,
- M_APP4 = 0xe4,
- M_APP5 = 0xe5,
- M_APP6 = 0xe6,
- M_APP7 = 0xe7,
- M_APP8 = 0xe8,
- M_APP9 = 0xe9,
- M_APP10 = 0xea,
- M_APP11 = 0xeb,
- M_APP12 = 0xec,
- M_APP13 = 0xed,
- M_APP14 = 0xee,
- M_APP15 = 0xef,
-
- M_JPG0 = 0xf0,
- M_JPG13 = 0xfd,
- M_COM = 0xfe,
-
- M_TEM = 0x01,
-
- M_ERROR = 0x100
-} JPEG_MARKER;
-
-
-/* Private state */
-
-typedef struct {
- struct jpeg_marker_reader pub; /* public fields */
-
- /* Application-overridable marker processing methods */
- jpeg_marker_parser_method process_COM;
- jpeg_marker_parser_method process_APPn[16];
-
- /* Limit on marker data length to save for each marker type */
- unsigned int length_limit_COM;
- unsigned int length_limit_APPn[16];
-
- /* Status of COM/APPn marker saving */
- jpeg_saved_marker_ptr cur_marker; /* NULL if not processing a marker */
- unsigned int bytes_read; /* data bytes read so far in marker */
- /* Note: cur_marker is not linked into marker_list until it's all read. */
-} my_marker_reader;
-
-typedef my_marker_reader * my_marker_ptr;
-
-
-/*
- * Macros for fetching data from the data source module.
- *
- * At all times, cinfo->src->next_input_byte and ->bytes_in_buffer reflect
- * the current restart point; we update them only when we have reached a
- * suitable place to restart if a suspension occurs.
- */
-
-/* Declare and initialize local copies of input pointer/count */
-#define INPUT_VARS(cinfo) \
- struct jpeg_source_mgr * datasrc = (cinfo)->src; \
- const JOCTET * next_input_byte = datasrc->next_input_byte; \
- size_t bytes_in_buffer = datasrc->bytes_in_buffer
-
-/* Unload the local copies --- do this only at a restart boundary */
-#define INPUT_SYNC(cinfo) \
- ( datasrc->next_input_byte = next_input_byte, \
- datasrc->bytes_in_buffer = bytes_in_buffer )
-
-/* Reload the local copies --- used only in MAKE_BYTE_AVAIL */
-#define INPUT_RELOAD(cinfo) \
- ( next_input_byte = datasrc->next_input_byte, \
- bytes_in_buffer = datasrc->bytes_in_buffer )
-
-/* Internal macro for INPUT_BYTE and INPUT_2BYTES: make a byte available.
- * Note we do *not* do INPUT_SYNC before calling fill_input_buffer,
- * but we must reload the local copies after a successful fill.
- */
-#define MAKE_BYTE_AVAIL(cinfo,action) \
- if (bytes_in_buffer == 0) { \
- if (! (*datasrc->fill_input_buffer) (cinfo)) \
- { action; } \
- INPUT_RELOAD(cinfo); \
- }
-
-/* Read a byte into variable V.
- * If must suspend, take the specified action (typically "return FALSE").
- */
-#define INPUT_BYTE(cinfo,V,action) \
- MAKESTMT( MAKE_BYTE_AVAIL(cinfo,action); \
- bytes_in_buffer--; \
- V = GETJOCTET(*next_input_byte++); )
-
-/* As above, but read two bytes interpreted as an unsigned 16-bit integer.
- * V should be declared unsigned int or perhaps INT32.
- */
-#define INPUT_2BYTES(cinfo,V,action) \
- MAKESTMT( MAKE_BYTE_AVAIL(cinfo,action); \
- bytes_in_buffer--; \
- V = ((unsigned int) GETJOCTET(*next_input_byte++)) << 8; \
- MAKE_BYTE_AVAIL(cinfo,action); \
- bytes_in_buffer--; \
- V += GETJOCTET(*next_input_byte++); )
-
-
-/*
- * Routines to process JPEG markers.
- *
- * Entry condition: JPEG marker itself has been read and its code saved
- * in cinfo->unread_marker; input restart point is just after the marker.
- *
- * Exit: if return TRUE, have read and processed any parameters, and have
- * updated the restart point to point after the parameters.
- * If return FALSE, was forced to suspend before reaching end of
- * marker parameters; restart point has not been moved. Same routine
- * will be called again after application supplies more input data.
- *
- * This approach to suspension assumes that all of a marker's parameters
- * can fit into a single input bufferload. This should hold for "normal"
- * markers. Some COM/APPn markers might have large parameter segments
- * that might not fit. If we are simply dropping such a marker, we use
- * skip_input_data to get past it, and thereby put the problem on the
- * source manager's shoulders. If we are saving the marker's contents
- * into memory, we use a slightly different convention: when forced to
- * suspend, the marker processor updates the restart point to the end of
- * what it's consumed (ie, the end of the buffer) before returning FALSE.
- * On resumption, cinfo->unread_marker still contains the marker code,
- * but the data source will point to the next chunk of marker data.
- * The marker processor must retain internal state to deal with this.
- *
- * Note that we don't bother to avoid duplicate trace messages if a
- * suspension occurs within marker parameters. Other side effects
- * require more care.
- */
-
-
-LOCAL(boolean)
-get_soi (j_decompress_ptr cinfo)
-/* Process an SOI marker */
-{
- int i;
-
- TRACEMS(cinfo, 1, JTRC_SOI);
-
- if (cinfo->marker->saw_SOI)
- ERREXIT(cinfo, JERR_SOI_DUPLICATE);
-
- /* Reset all parameters that are defined to be reset by SOI */
-
- for (i = 0; i < NUM_ARITH_TBLS; i++) {
- cinfo->arith_dc_L[i] = 0;
- cinfo->arith_dc_U[i] = 1;
- cinfo->arith_ac_K[i] = 5;
- }
- cinfo->restart_interval = 0;
-
- /* Set initial assumptions for colorspace etc */
-
- cinfo->jpeg_color_space = JCS_UNKNOWN;
- cinfo->CCIR601_sampling = FALSE; /* Assume non-CCIR sampling??? */
-
- cinfo->saw_JFIF_marker = FALSE;
- cinfo->JFIF_major_version = 1; /* set default JFIF APP0 values */
- cinfo->JFIF_minor_version = 1;
- cinfo->density_unit = 0;
- cinfo->X_density = 1;
- cinfo->Y_density = 1;
- cinfo->saw_Adobe_marker = FALSE;
- cinfo->Adobe_transform = 0;
-
- cinfo->marker->saw_SOI = TRUE;
-
- return TRUE;
-}
-
-
-LOCAL(boolean)
-get_sof (j_decompress_ptr cinfo, boolean is_prog, boolean is_arith)
-/* Process a SOFn marker */
-{
- INT32 length;
- int c, ci;
- jpeg_component_info * compptr;
- /* LiuSunliang added 20111209 */
- JDIMENSION image_width, image_height;
- INPUT_VARS(cinfo);
-
- cinfo->progressive_mode = is_prog;
- cinfo->arith_code = is_arith;
-
- INPUT_2BYTES(cinfo, length, return FALSE);
-
- INPUT_BYTE(cinfo, cinfo->data_precision, return FALSE);
- INPUT_2BYTES(cinfo, image_height, return FALSE);
- INPUT_2BYTES(cinfo, image_width, return FALSE);
- INPUT_BYTE(cinfo, cinfo->num_components, return FALSE);
-
- if (image_width <= JPEG_MAX_DIMENSION)
- cinfo->image_width = image_width;
-
- if (image_height <= JPEG_MAX_DIMENSION)
- cinfo->image_height = image_height;
-
- length -= 8;
-
- TRACEMS4(cinfo, 1, JTRC_SOF, cinfo->unread_marker,
- (int) cinfo->image_width, (int) cinfo->image_height,
- cinfo->num_components);
-
- if (cinfo->marker->saw_SOF)
- ERREXIT(cinfo, JERR_SOF_DUPLICATE);
-
- /* We don't support files in which the image height is initially specified */
- /* as 0 and is later redefined by DNL. As long as we have to check that, */
- /* might as well have a general sanity check. */
- if (cinfo->image_height <= 0 || cinfo->image_width <= 0
- || cinfo->num_components <= 0)
- ERREXIT(cinfo, JERR_EMPTY_IMAGE);
-
- if (length != (cinfo->num_components * 3))
- ERREXIT(cinfo, JERR_BAD_LENGTH);
-
- if (cinfo->comp_info == NULL) /* do only once, even if suspend */
- cinfo->comp_info = (jpeg_component_info *) (*cinfo->mem->alloc_small)
- ((j_common_ptr) cinfo, JPOOL_IMAGE,
- cinfo->num_components * SIZEOF(jpeg_component_info));
-
- for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
- ci++, compptr++) {
- compptr->component_index = ci;
- INPUT_BYTE(cinfo, compptr->component_id, return FALSE);
- /* XYQ 2008-03-25: Adobe CMYK JPEG has serious flaw: the K channel has same component id as C channel */
- {
- int i;
- for (i = 0; i < ci; i ++)
- if (compptr->component_id == cinfo->comp_info[i].component_id) break;
- if (i < ci)
- /* Found the error! We replace the id with something unlikely used elsewhere */
- compptr->component_id += 0xf0;
- }
- /* end of modification */
- INPUT_BYTE(cinfo, c, return FALSE);
- compptr->h_samp_factor = (c >> 4) & 15;
- compptr->v_samp_factor = (c ) & 15;
- INPUT_BYTE(cinfo, compptr->quant_tbl_no, return FALSE);
-
- TRACEMS4(cinfo, 1, JTRC_SOF_COMPONENT,
- compptr->component_id, compptr->h_samp_factor,
- compptr->v_samp_factor, compptr->quant_tbl_no);
- }
-
- cinfo->marker->saw_SOF = TRUE;
-
- INPUT_SYNC(cinfo);
- return TRUE;
-}
-
-
-LOCAL(boolean)
-get_sos (j_decompress_ptr cinfo)
-/* Process a SOS marker */
-{
- INT32 length;
- int i, ci, n, c, cc;
- jpeg_component_info * compptr;
- INPUT_VARS(cinfo);
-
- if (! cinfo->marker->saw_SOF)
- ERREXIT(cinfo, JERR_SOS_NO_SOF);
-
- INPUT_2BYTES(cinfo, length, return FALSE);
-
- INPUT_BYTE(cinfo, n, return FALSE); /* Number of components */
-
- TRACEMS1(cinfo, 1, JTRC_SOS, n);
-
- if (length != (n * 2 + 6) || n < 1 || n > MAX_COMPS_IN_SCAN)
- ERREXIT(cinfo, JERR_BAD_LENGTH);
-
- cinfo->comps_in_scan = n;
-
- /* Collect the component-spec parameters */
-
- for (i = 0; i < n; i++) {
- INPUT_BYTE(cinfo, cc, return FALSE);
- INPUT_BYTE(cinfo, c, return FALSE);
-
- /* XYQ 2008-03-25: Adobe CMYK JPEG has serious flaw: the K channel has same component id as C channel */
- {
- int j;
- for (j = 0; j < i; j ++)
- if (cc == cinfo->cur_comp_info[j]->component_id) break;
- if (j < i)
- /* found the error! */
- cc += 0xf0;
- }
- /* end of modification */
- for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
- ci++, compptr++) {
- if (cc == compptr->component_id)
- goto id_found;
- }
-
- ERREXIT1(cinfo, JERR_BAD_COMPONENT_ID, cc);
-
- id_found:
-
- cinfo->cur_comp_info[i] = compptr;
- compptr->dc_tbl_no = (c >> 4) & 15;
- compptr->ac_tbl_no = (c ) & 15;
-
- TRACEMS3(cinfo, 1, JTRC_SOS_COMPONENT, cc,
- compptr->dc_tbl_no, compptr->ac_tbl_no);
- /* This CSi (cc) should differ from the previous CSi */
- for (ci = 0; ci < i; ci++) {
- if (cinfo->cur_comp_info[ci] == compptr)
- ERREXIT1(cinfo, JERR_BAD_COMPONENT_ID, cc);
- }
- }
-
- /* Collect the additional scan parameters Ss, Se, Ah/Al. */
- INPUT_BYTE(cinfo, c, return FALSE);
- cinfo->Ss = c;
- INPUT_BYTE(cinfo, c, return FALSE);
- cinfo->Se = c;
- INPUT_BYTE(cinfo, c, return FALSE);
- cinfo->Ah = (c >> 4) & 15;
- cinfo->Al = (c ) & 15;
-
- TRACEMS4(cinfo, 1, JTRC_SOS_PARAMS, cinfo->Ss, cinfo->Se,
- cinfo->Ah, cinfo->Al);
-
- /* Prepare to scan data & restart markers */
- cinfo->marker->next_restart_num = 0;
-
- /* Count another SOS marker */
- cinfo->input_scan_number++;
-
- INPUT_SYNC(cinfo);
- return TRUE;
-}
-
-
-#ifdef D_ARITH_CODING_SUPPORTED
-
-LOCAL(boolean)
-get_dac (j_decompress_ptr cinfo)
-/* Process a DAC marker */
-{
- INT32 length;
- int index, val;
- INPUT_VARS(cinfo);
-
- INPUT_2BYTES(cinfo, length, return FALSE);
- length -= 2;
-
- while (length > 0) {
- INPUT_BYTE(cinfo, index, return FALSE);
- INPUT_BYTE(cinfo, val, return FALSE);
-
- length -= 2;
-
- TRACEMS2(cinfo, 1, JTRC_DAC, index, val);
-
- if (index < 0 || index >= (2*NUM_ARITH_TBLS))
- ERREXIT1(cinfo, JERR_DAC_INDEX, index);
-
- if (index >= NUM_ARITH_TBLS) { /* define AC table */
- cinfo->arith_ac_K[index-NUM_ARITH_TBLS] = (UINT8) val;
- } else { /* define DC table */
- cinfo->arith_dc_L[index] = (UINT8) (val & 0x0F);
- cinfo->arith_dc_U[index] = (UINT8) (val >> 4);
- if (cinfo->arith_dc_L[index] > cinfo->arith_dc_U[index])
- ERREXIT1(cinfo, JERR_DAC_VALUE, val);
- }
- }
-
- if (length != 0)
- ERREXIT(cinfo, JERR_BAD_LENGTH);
-
- INPUT_SYNC(cinfo);
- return TRUE;
-}
-
-#else /* ! D_ARITH_CODING_SUPPORTED */
-
-#define get_dac(cinfo) skip_variable(cinfo)
-
-#endif /* D_ARITH_CODING_SUPPORTED */
-
-
-LOCAL(boolean)
-get_dht (j_decompress_ptr cinfo)
-/* Process a DHT marker */
-{
- INT32 length;
- UINT8 bits[17];
- UINT8 huffval[256];
- int i, index, count;
- JHUFF_TBL **htblptr;
- INPUT_VARS(cinfo);
-
- INPUT_2BYTES(cinfo, length, return FALSE);
- length -= 2;
-
- while (length > 16) {
- INPUT_BYTE(cinfo, index, return FALSE);
-
- TRACEMS1(cinfo, 1, JTRC_DHT, index);
-
- bits[0] = 0;
- count = 0;
- for (i = 1; i <= 16; i++) {
- INPUT_BYTE(cinfo, bits[i], return FALSE);
- count += bits[i];
- }
-
- length -= 1 + 16;
-
- TRACEMS8(cinfo, 2, JTRC_HUFFBITS,
- bits[1], bits[2], bits[3], bits[4],
- bits[5], bits[6], bits[7], bits[8]);
- TRACEMS8(cinfo, 2, JTRC_HUFFBITS,
- bits[9], bits[10], bits[11], bits[12],
- bits[13], bits[14], bits[15], bits[16]);
-
- /* Here we just do minimal validation of the counts to avoid walking
- * off the end of our table space. jdhuff.c will check more carefully.
- */
- if (count > 256 || ((INT32) count) > length)
- ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
-
- for (i = 0; i < count; i++)
- INPUT_BYTE(cinfo, huffval[i], return FALSE);
-
- length -= count;
-
- if (index & 0x10) { /* AC table definition */
- index -= 0x10;
- htblptr = &cinfo->ac_huff_tbl_ptrs[index];
- } else { /* DC table definition */
- htblptr = &cinfo->dc_huff_tbl_ptrs[index];
- }
-
- if (index < 0 || index >= NUM_HUFF_TBLS)
- ERREXIT1(cinfo, JERR_DHT_INDEX, index);
-
- if (*htblptr == NULL)
- *htblptr = jpeg_alloc_huff_table((j_common_ptr) cinfo);
-
- MEMCOPY((*htblptr)->bits, bits, SIZEOF((*htblptr)->bits));
- MEMCOPY((*htblptr)->huffval, huffval, SIZEOF((*htblptr)->huffval));
- }
-
- if (length != 0)
- ERREXIT(cinfo, JERR_BAD_LENGTH);
-
- INPUT_SYNC(cinfo);
- return TRUE;
-}
-
-
-LOCAL(boolean)
-get_dqt (j_decompress_ptr cinfo)
-/* Process a DQT marker */
-{
- INT32 length;
- int n, i, prec;
- unsigned int tmp;
- JQUANT_TBL *quant_ptr;
- INPUT_VARS(cinfo);
-
- INPUT_2BYTES(cinfo, length, return FALSE);
- length -= 2;
-
- while (length > 0) {
- INPUT_BYTE(cinfo, n, return FALSE);
- prec = n >> 4;
- n &= 0x0F;
-
- TRACEMS2(cinfo, 1, JTRC_DQT, n, prec);
-
- if (n >= NUM_QUANT_TBLS)
- ERREXIT1(cinfo, JERR_DQT_INDEX, n);
-
- if (cinfo->quant_tbl_ptrs[n] == NULL)
- cinfo->quant_tbl_ptrs[n] = jpeg_alloc_quant_table((j_common_ptr) cinfo);
- quant_ptr = cinfo->quant_tbl_ptrs[n];
-
- for (i = 0; i < DCTSIZE2; i++) {
- if (prec)
- INPUT_2BYTES(cinfo, tmp, return FALSE);
- else
- INPUT_BYTE(cinfo, tmp, return FALSE);
- /* We convert the zigzag-order table to natural array order. */
- quant_ptr->quantval[jpeg_natural_order[i]] = (UINT16) tmp;
- }
-
- if (cinfo->err->trace_level >= 2) {
- for (i = 0; i < DCTSIZE2; i += 8) {
- TRACEMS8(cinfo, 2, JTRC_QUANTVALS,
- quant_ptr->quantval[i], quant_ptr->quantval[i+1],
- quant_ptr->quantval[i+2], quant_ptr->quantval[i+3],
- quant_ptr->quantval[i+4], quant_ptr->quantval[i+5],
- quant_ptr->quantval[i+6], quant_ptr->quantval[i+7]);
- }
- }
-
- length -= DCTSIZE2+1;
- if (prec) length -= DCTSIZE2;
- }
-
- if (length != 0)
- ERREXIT(cinfo, JERR_BAD_LENGTH);
-
- INPUT_SYNC(cinfo);
- return TRUE;
-}
-
-
-LOCAL(boolean)
-get_dri (j_decompress_ptr cinfo)
-/* Process a DRI marker */
-{
- INT32 length;
- unsigned int tmp;
- INPUT_VARS(cinfo);
-
- INPUT_2BYTES(cinfo, length, return FALSE);
-
- if (length != 4)
- ERREXIT(cinfo, JERR_BAD_LENGTH);
-
- INPUT_2BYTES(cinfo, tmp, return FALSE);
-
- TRACEMS1(cinfo, 1, JTRC_DRI, tmp);
-
- cinfo->restart_interval = tmp;
-
- INPUT_SYNC(cinfo);
- return TRUE;
-}
-
-
-/*
- * Routines for processing APPn and COM markers.
- * These are either saved in memory or discarded, per application request.
- * APP0 and APP14 are specially checked to see if they are
- * JFIF and Adobe markers, respectively.
- */
-
-#define APP0_DATA_LEN 14 /* Length of interesting data in APP0 */
-#define APP14_DATA_LEN 12 /* Length of interesting data in APP14 */
-#define APPN_DATA_LEN 14 /* Must be the largest of the above!! */
-
-
-LOCAL(void)
-examine_app0 (j_decompress_ptr cinfo, JOCTET FAR * data,
- unsigned int datalen, INT32 remaining)
-/* Examine first few bytes from an APP0.
- * Take appropriate action if it is a JFIF marker.
- * datalen is # of bytes at data[], remaining is length of rest of marker data.
- */
-{
- INT32 totallen = (INT32) datalen + remaining;
-
- if (datalen >= APP0_DATA_LEN &&
- GETJOCTET(data[0]) == 0x4A &&
- GETJOCTET(data[1]) == 0x46 &&
- GETJOCTET(data[2]) == 0x49 &&
- GETJOCTET(data[3]) == 0x46 &&
- GETJOCTET(data[4]) == 0) {
- /* Found JFIF APP0 marker: save info */
- cinfo->saw_JFIF_marker = TRUE;
- cinfo->JFIF_major_version = GETJOCTET(data[5]);
- cinfo->JFIF_minor_version = GETJOCTET(data[6]);
- cinfo->density_unit = GETJOCTET(data[7]);
- cinfo->X_density = (GETJOCTET(data[8]) << 8) + GETJOCTET(data[9]);
- cinfo->Y_density = (GETJOCTET(data[10]) << 8) + GETJOCTET(data[11]);
- /* Check version.
- * Major version must be 1, anything else signals an incompatible change.
- * (We used to treat this as an error, but now it's a nonfatal warning,
- * because some bozo at Hijaak couldn't read the spec.)
- * Minor version should be 0..2, but process anyway if newer.
- */
- if (cinfo->JFIF_major_version != 1)
- WARNMS2(cinfo, JWRN_JFIF_MAJOR,
- cinfo->JFIF_major_version, cinfo->JFIF_minor_version);
- /* Generate trace messages */
- TRACEMS5(cinfo, 1, JTRC_JFIF,
- cinfo->JFIF_major_version, cinfo->JFIF_minor_version,
- cinfo->X_density, cinfo->Y_density, cinfo->density_unit);
- /* Validate thumbnail dimensions and issue appropriate messages */
- if (GETJOCTET(data[12]) | GETJOCTET(data[13]))
- TRACEMS2(cinfo, 1, JTRC_JFIF_THUMBNAIL,
- GETJOCTET(data[12]), GETJOCTET(data[13]));
- totallen -= APP0_DATA_LEN;
- if (totallen !=
- ((INT32)GETJOCTET(data[12]) * (INT32)GETJOCTET(data[13]) * (INT32) 3))
- TRACEMS1(cinfo, 1, JTRC_JFIF_BADTHUMBNAILSIZE, (int) totallen);
- } else if (datalen >= 6 &&
- GETJOCTET(data[0]) == 0x4A &&
- GETJOCTET(data[1]) == 0x46 &&
- GETJOCTET(data[2]) == 0x58 &&
- GETJOCTET(data[3]) == 0x58 &&
- GETJOCTET(data[4]) == 0) {
- /* Found JFIF "JFXX" extension APP0 marker */
- /* The library doesn't actually do anything with these,
- * but we try to produce a helpful trace message.
- */
- switch (GETJOCTET(data[5])) {
- case 0x10:
- TRACEMS1(cinfo, 1, JTRC_THUMB_JPEG, (int) totallen);
- break;
- case 0x11:
- TRACEMS1(cinfo, 1, JTRC_THUMB_PALETTE, (int) totallen);
- break;
- case 0x13:
- TRACEMS1(cinfo, 1, JTRC_THUMB_RGB, (int) totallen);
- break;
- default:
- TRACEMS2(cinfo, 1, JTRC_JFIF_EXTENSION,
- GETJOCTET(data[5]), (int) totallen);
- break;
- }
- } else {
- /* Start of APP0 does not match "JFIF" or "JFXX", or too short */
- TRACEMS1(cinfo, 1, JTRC_APP0, (int) totallen);
- }
-}
-
-
-LOCAL(void)
-examine_app14 (j_decompress_ptr cinfo, JOCTET FAR * data,
- unsigned int datalen, INT32 remaining)
-/* Examine first few bytes from an APP14.
- * Take appropriate action if it is an Adobe marker.
- * datalen is # of bytes at data[], remaining is length of rest of marker data.
- */
-{
- unsigned int version, flags0, flags1, transform;
-
- if (datalen >= APP14_DATA_LEN &&
- GETJOCTET(data[0]) == 0x41 &&
- GETJOCTET(data[1]) == 0x64 &&
- GETJOCTET(data[2]) == 0x6F &&
- GETJOCTET(data[3]) == 0x62 &&
- GETJOCTET(data[4]) == 0x65) {
- /* Found Adobe APP14 marker */
- version = (GETJOCTET(data[5]) << 8) + GETJOCTET(data[6]);
- flags0 = (GETJOCTET(data[7]) << 8) + GETJOCTET(data[8]);
- flags1 = (GETJOCTET(data[9]) << 8) + GETJOCTET(data[10]);
- transform = GETJOCTET(data[11]);
- TRACEMS4(cinfo, 1, JTRC_ADOBE, version, flags0, flags1, transform);
- cinfo->saw_Adobe_marker = TRUE;
- cinfo->Adobe_transform = (UINT8) transform;
- } else {
- /* Start of APP14 does not match "Adobe", or too short */
- TRACEMS1(cinfo, 1, JTRC_APP14, (int) (datalen + remaining));
- }
-}
-
-
-METHODDEF(boolean)
-get_interesting_appn (j_decompress_ptr cinfo)
-/* Process an APP0 or APP14 marker without saving it */
-{
- INT32 length;
- JOCTET b[APPN_DATA_LEN];
- unsigned int i, numtoread;
- INPUT_VARS(cinfo);
-
- INPUT_2BYTES(cinfo, length, return FALSE);
- length -= 2;
-
- /* get the interesting part of the marker data */
- if (length >= APPN_DATA_LEN)
- numtoread = APPN_DATA_LEN;
- else if (length > 0)
- numtoread = (unsigned int) length;
- else
- numtoread = 0;
- for (i = 0; i < numtoread; i++)
- INPUT_BYTE(cinfo, b[i], return FALSE);
- length -= numtoread;
-
- /* process it */
- switch (cinfo->unread_marker) {
- case M_APP0:
- examine_app0(cinfo, (JOCTET FAR *) b, numtoread, length);
- break;
- case M_APP14:
- examine_app14(cinfo, (JOCTET FAR *) b, numtoread, length);
- break;
- default:
- /* can't get here unless jpeg_save_markers chooses wrong processor */
- ERREXIT1(cinfo, JERR_UNKNOWN_MARKER, cinfo->unread_marker);
- break;
- }
-
- /* skip any remaining data -- could be lots */
- INPUT_SYNC(cinfo);
- if (length > 0)
- (*cinfo->src->skip_input_data) (cinfo, (long) length);
-
- return TRUE;
-}
-
-
-#ifdef SAVE_MARKERS_SUPPORTED
-
-METHODDEF(boolean)
-save_marker (j_decompress_ptr cinfo)
-/* Save an APPn or COM marker into the marker list */
-{
- my_marker_ptr marker = (my_marker_ptr) cinfo->marker;
- jpeg_saved_marker_ptr cur_marker = marker->cur_marker;
- unsigned int bytes_read, data_length;
- JOCTET FAR * data;
- INT32 length = 0;
- INPUT_VARS(cinfo);
-
- if (cur_marker == NULL) {
- /* begin reading a marker */
- INPUT_2BYTES(cinfo, length, return FALSE);
- length -= 2;
- if (length >= 0) { /* watch out for bogus length word */
- /* figure out how much we want to save */
- unsigned int limit;
- if (cinfo->unread_marker == (int) M_COM)
- limit = marker->length_limit_COM;
- else
- limit = marker->length_limit_APPn[cinfo->unread_marker - (int) M_APP0];
- if ((unsigned int) length < limit)
- limit = (unsigned int) length;
- /* allocate and initialize the marker item */
- cur_marker = (jpeg_saved_marker_ptr)
- (*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- SIZEOF(struct jpeg_marker_struct) + limit);
- cur_marker->next = NULL;
- cur_marker->marker = (UINT8) cinfo->unread_marker;
- cur_marker->original_length = (unsigned int) length;
- cur_marker->data_length = limit;
- /* data area is just beyond the jpeg_marker_struct */
- data = cur_marker->data = (JOCTET FAR *) (cur_marker + 1);
- marker->cur_marker = cur_marker;
- marker->bytes_read = 0;
- bytes_read = 0;
- data_length = limit;
- } else {
- /* deal with bogus length word */
- bytes_read = data_length = 0;
- data = NULL;
- }
- } else {
- /* resume reading a marker */
- bytes_read = marker->bytes_read;
- data_length = cur_marker->data_length;
- data = cur_marker->data + bytes_read;
- }
-
- while (bytes_read < data_length) {
- INPUT_SYNC(cinfo); /* move the restart point to here */
- marker->bytes_read = bytes_read;
- /* If there's not at least one byte in buffer, suspend */
- MAKE_BYTE_AVAIL(cinfo, return FALSE);
- /* Copy bytes with reasonable rapidity */
- while (bytes_read < data_length && bytes_in_buffer > 0) {
- *data++ = *next_input_byte++;
- bytes_in_buffer--;
- bytes_read++;
- }
- }
-
- /* Done reading what we want to read */
- if (cur_marker != NULL) { /* will be NULL if bogus length word */
- /* Add new marker to end of list */
- if (cinfo->marker_list == NULL) {
- cinfo->marker_list = cur_marker;
- } else {
- jpeg_saved_marker_ptr prev = cinfo->marker_list;
- while (prev->next != NULL)
- prev = prev->next;
- prev->next = cur_marker;
- }
- /* Reset pointer & calc remaining data length */
- data = cur_marker->data;
- length = cur_marker->original_length - data_length;
- }
- /* Reset to initial state for next marker */
- marker->cur_marker = NULL;
-
- /* Process the marker if interesting; else just make a generic trace msg */
- switch (cinfo->unread_marker) {
- case M_APP0:
- examine_app0(cinfo, data, data_length, length);
- break;
- case M_APP14:
- examine_app14(cinfo, data, data_length, length);
- break;
- default:
- TRACEMS2(cinfo, 1, JTRC_MISC_MARKER, cinfo->unread_marker,
- (int) (data_length + length));
- break;
- }
-
- /* skip any remaining data -- could be lots */
- INPUT_SYNC(cinfo); /* do before skip_input_data */
- if (length > 0)
- (*cinfo->src->skip_input_data) (cinfo, (long) length);
-
- return TRUE;
-}
-
-#endif /* SAVE_MARKERS_SUPPORTED */
-
-
-METHODDEF(boolean)
-skip_variable (j_decompress_ptr cinfo)
-/* Skip over an unknown or uninteresting variable-length marker */
-{
- INT32 length;
- INPUT_VARS(cinfo);
-
- INPUT_2BYTES(cinfo, length, return FALSE);
- length -= 2;
-
- TRACEMS2(cinfo, 1, JTRC_MISC_MARKER, cinfo->unread_marker, (int) length);
-
- INPUT_SYNC(cinfo); /* do before skip_input_data */
- if (length > 0)
- (*cinfo->src->skip_input_data) (cinfo, (long) length);
-
- return TRUE;
-}
-
-
-/*
- * Find the next JPEG marker, save it in cinfo->unread_marker.
- * Returns FALSE if had to suspend before reaching a marker;
- * in that case cinfo->unread_marker is unchanged.
- *
- * Note that the result might not be a valid marker code,
- * but it will never be 0 or FF.
- */
-
-LOCAL(boolean)
-next_marker (j_decompress_ptr cinfo)
-{
- int c;
- INPUT_VARS(cinfo);
-
- for (;;) {
- INPUT_BYTE(cinfo, c, return FALSE);
- /* Skip any non-FF bytes.
- * This may look a bit inefficient, but it will not occur in a valid file.
- * We sync after each discarded byte so that a suspending data source
- * can discard the byte from its buffer.
- */
- while (c != 0xFF) {
- cinfo->marker->discarded_bytes++;
- INPUT_SYNC(cinfo);
- INPUT_BYTE(cinfo, c, return FALSE);
- }
- /* This loop swallows any duplicate FF bytes. Extra FFs are legal as
- * pad bytes, so don't count them in discarded_bytes. We assume there
- * will not be so many consecutive FF bytes as to overflow a suspending
- * data source's input buffer.
- */
- do {
- INPUT_BYTE(cinfo, c, return FALSE);
- } while (c == 0xFF);
- if (c != 0)
- break; /* found a valid marker, exit loop */
- /* Reach here if we found a stuffed-zero data sequence (FF/00).
- * Discard it and loop back to try again.
- */
- cinfo->marker->discarded_bytes += 2;
- INPUT_SYNC(cinfo);
- }
-
- if (cinfo->marker->discarded_bytes != 0) {
- WARNMS2(cinfo, JWRN_EXTRANEOUS_DATA, cinfo->marker->discarded_bytes, c);
- cinfo->marker->discarded_bytes = 0;
- }
-
- cinfo->unread_marker = c;
-
- INPUT_SYNC(cinfo);
- return TRUE;
-}
-
-
-LOCAL(boolean)
-first_marker (j_decompress_ptr cinfo)
-/* Like next_marker, but used to obtain the initial SOI marker. */
-/* For this marker, we do not allow preceding garbage or fill; otherwise,
- * we might well scan an entire input file before realizing it ain't JPEG.
- * If an application wants to process non-JFIF files, it must seek to the
- * SOI before calling the JPEG library.
- */
-{
- int c, c2;
- INPUT_VARS(cinfo);
-
- INPUT_BYTE(cinfo, c, return FALSE);
- INPUT_BYTE(cinfo, c2, return FALSE);
- if (c != 0xFF || c2 != (int) M_SOI)
- ERREXIT2(cinfo, JERR_NO_SOI, c, c2);
-
- cinfo->unread_marker = c2;
-
- INPUT_SYNC(cinfo);
- return TRUE;
-}
-
-
-/*
- * Read markers until SOS or EOI.
- *
- * Returns same codes as are defined for jpeg_consume_input:
- * JPEG_SUSPENDED, JPEG_REACHED_SOS, or JPEG_REACHED_EOI.
- */
-
-METHODDEF(int)
-read_markers (j_decompress_ptr cinfo)
-{
- /* Outer loop repeats once for each marker. */
- for (;;) {
- /* Collect the marker proper, unless we already did. */
- /* NB: first_marker() enforces the requirement that SOI appear first. */
- if (cinfo->unread_marker == 0) {
- if (! cinfo->marker->saw_SOI) {
- if (! first_marker(cinfo))
- return JPEG_SUSPENDED;
- } else {
- if (! next_marker(cinfo))
- return JPEG_SUSPENDED;
- }
- }
- /* At this point cinfo->unread_marker contains the marker code and the
- * input point is just past the marker proper, but before any parameters.
- * A suspension will cause us to return with this state still true.
- */
- switch (cinfo->unread_marker) {
- case M_SOI:
- if (! get_soi(cinfo))
- return JPEG_SUSPENDED;
- break;
-
- case M_SOF0: /* Baseline */
- case M_SOF1: /* Extended sequential, Huffman */
- if (! get_sof(cinfo, FALSE, FALSE))
- return JPEG_SUSPENDED;
- break;
-
- case M_SOF2: /* Progressive, Huffman */
- if (! get_sof(cinfo, TRUE, FALSE))
- return JPEG_SUSPENDED;
- break;
-
- case M_SOF9: /* Extended sequential, arithmetic */
- if (! get_sof(cinfo, FALSE, TRUE))
- return JPEG_SUSPENDED;
- break;
-
- case M_SOF10: /* Progressive, arithmetic */
- if (! get_sof(cinfo, TRUE, TRUE))
- return JPEG_SUSPENDED;
- break;
-
- /* Currently unsupported SOFn types */
- case M_SOF3: /* Lossless, Huffman */
- case M_SOF5: /* Differential sequential, Huffman */
- case M_SOF6: /* Differential progressive, Huffman */
- case M_SOF7: /* Differential lossless, Huffman */
- case M_JPG: /* Reserved for JPEG extensions */
- case M_SOF11: /* Lossless, arithmetic */
- case M_SOF13: /* Differential sequential, arithmetic */
- case M_SOF14: /* Differential progressive, arithmetic */
- case M_SOF15: /* Differential lossless, arithmetic */
- ERREXIT1(cinfo, JERR_SOF_UNSUPPORTED, cinfo->unread_marker);
- break;
-
- case M_SOS:
- if (! get_sos(cinfo))
- return JPEG_SUSPENDED;
- cinfo->unread_marker = 0; /* processed the marker */
- return JPEG_REACHED_SOS;
-
- case M_EOI:
- TRACEMS(cinfo, 1, JTRC_EOI);
- cinfo->unread_marker = 0; /* processed the marker */
- return JPEG_REACHED_EOI;
-
- case M_DAC:
- if (! get_dac(cinfo))
- return JPEG_SUSPENDED;
- break;
-
- case M_DHT:
- if (! get_dht(cinfo))
- return JPEG_SUSPENDED;
- break;
-
- case M_DQT:
- if (! get_dqt(cinfo))
- return JPEG_SUSPENDED;
- break;
-
- case M_DRI:
- if (! get_dri(cinfo))
- return JPEG_SUSPENDED;
- break;
-
- case M_APP0:
- case M_APP1:
- case M_APP2:
- case M_APP3:
- case M_APP4:
- case M_APP5:
- case M_APP6:
- case M_APP7:
- case M_APP8:
- case M_APP9:
- case M_APP10:
- case M_APP11:
- case M_APP12:
- case M_APP13:
- case M_APP14:
- case M_APP15:
- if (! (*((my_marker_ptr) cinfo->marker)->process_APPn[
- cinfo->unread_marker - (int) M_APP0]) (cinfo))
- return JPEG_SUSPENDED;
- break;
-
- case M_COM:
- if (! (*((my_marker_ptr) cinfo->marker)->process_COM) (cinfo))
- return JPEG_SUSPENDED;
- break;
-
- case M_RST0: /* these are all parameterless */
- case M_RST1:
- case M_RST2:
- case M_RST3:
- case M_RST4:
- case M_RST5:
- case M_RST6:
- case M_RST7:
- case M_TEM:
- TRACEMS1(cinfo, 1, JTRC_PARMLESS_MARKER, cinfo->unread_marker);
- break;
-
- case M_DNL: /* Ignore DNL ... perhaps the wrong thing */
- if (! skip_variable(cinfo))
- return JPEG_SUSPENDED;
- break;
-
- default: /* must be DHP, EXP, JPGn, or RESn */
- /* For now, we treat the reserved markers as fatal errors since they are
- * likely to be used to signal incompatible JPEG Part 3 extensions.
- * Once the JPEG 3 version-number marker is well defined, this code
- * ought to change!
- */
- ERREXIT1(cinfo, JERR_UNKNOWN_MARKER, cinfo->unread_marker);
- break;
- }
- /* Successfully processed marker, so reset state variable */
- cinfo->unread_marker = 0;
- } /* end loop */
-}
-
-
-/*
- * Read a restart marker, which is expected to appear next in the datastream;
- * if the marker is not there, take appropriate recovery action.
- * Returns FALSE if suspension is required.
- *
- * This is called by the entropy decoder after it has read an appropriate
- * number of MCUs. cinfo->unread_marker may be nonzero if the entropy decoder
- * has already read a marker from the data source. Under normal conditions
- * cinfo->unread_marker will be reset to 0 before returning; if not reset,
- * it holds a marker which the decoder will be unable to read past.
- */
-
-METHODDEF(boolean)
-read_restart_marker (j_decompress_ptr cinfo)
-{
- /* Obtain a marker unless we already did. */
- /* Note that next_marker will complain if it skips any data. */
- if (cinfo->unread_marker == 0) {
- if (! next_marker(cinfo))
- return FALSE;
- }
-
- if (cinfo->unread_marker ==
- ((int) M_RST0 + cinfo->marker->next_restart_num)) {
- /* Normal case --- swallow the marker and let entropy decoder continue */
- TRACEMS1(cinfo, 3, JTRC_RST, cinfo->marker->next_restart_num);
- cinfo->unread_marker = 0;
- } else {
- /* Uh-oh, the restart markers have been messed up. */
- /* Let the data source manager determine how to resync. */
- if (! (*cinfo->src->resync_to_restart) (cinfo,
- cinfo->marker->next_restart_num))
- return FALSE;
- }
-
- /* Update next-restart state */
- cinfo->marker->next_restart_num = (cinfo->marker->next_restart_num + 1) & 7;
-
- return TRUE;
-}
-
-
-/*
- * This is the default resync_to_restart method for data source managers
- * to use if they don't have any better approach. Some data source managers
- * may be able to back up, or may have additional knowledge about the data
- * which permits a more intelligent recovery strategy; such managers would
- * presumably supply their own resync method.
- *
- * read_restart_marker calls resync_to_restart if it finds a marker other than
- * the restart marker it was expecting. (This code is *not* used unless
- * a nonzero restart interval has been declared.) cinfo->unread_marker is
- * the marker code actually found (might be anything, except 0 or FF).
- * The desired restart marker number (0..7) is passed as a parameter.
- * This routine is supposed to apply whatever error recovery strategy seems
- * appropriate in order to position the input stream to the next data segment.
- * Note that cinfo->unread_marker is treated as a marker appearing before
- * the current data-source input point; usually it should be reset to zero
- * before returning.
- * Returns FALSE if suspension is required.
- *
- * This implementation is substantially constrained by wanting to treat the
- * input as a data stream; this means we can't back up. Therefore, we have
- * only the following actions to work with:
- * 1. Simply discard the marker and let the entropy decoder resume at next
- * byte of file.
- * 2. Read forward until we find another marker, discarding intervening
- * data. (In theory we could look ahead within the current bufferload,
- * without having to discard data if we don't find the desired marker.
- * This idea is not implemented here, in part because it makes behavior
- * dependent on buffer size and chance buffer-boundary positions.)
- * 3. Leave the marker unread (by failing to zero cinfo->unread_marker).
- * This will cause the entropy decoder to process an empty data segment,
- * inserting dummy zeroes, and then we will reprocess the marker.
- *
- * #2 is appropriate if we think the desired marker lies ahead, while #3 is
- * appropriate if the found marker is a future restart marker (indicating
- * that we have missed the desired restart marker, probably because it got
- * corrupted).
- * We apply #2 or #3 if the found marker is a restart marker no more than
- * two counts behind or ahead of the expected one. We also apply #2 if the
- * found marker is not a legal JPEG marker code (it's certainly bogus data).
- * If the found marker is a restart marker more than 2 counts away, we do #1
- * (too much risk that the marker is erroneous; with luck we will be able to
- * resync at some future point).
- * For any valid non-restart JPEG marker, we apply #3. This keeps us from
- * overrunning the end of a scan. An implementation limited to single-scan
- * files might find it better to apply #2 for markers other than EOI, since
- * any other marker would have to be bogus data in that case.
- */
-
-GLOBAL(boolean)
-jpeg_resync_to_restart (j_decompress_ptr cinfo, int desired)
-{
- int marker = cinfo->unread_marker;
- int action = 1;
-
- /* Always put up a warning. */
- WARNMS2(cinfo, JWRN_MUST_RESYNC, marker, desired);
-
- /* Outer loop handles repeated decision after scanning forward. */
- for (;;) {
- if (marker < (int) M_SOF0)
- action = 2; /* invalid marker */
- else if (marker < (int) M_RST0 || marker > (int) M_RST7)
- action = 3; /* valid non-restart marker */
- else {
- if (marker == ((int) M_RST0 + ((desired+1) & 7)) ||
- marker == ((int) M_RST0 + ((desired+2) & 7)))
- action = 3; /* one of the next two expected restarts */
- else if (marker == ((int) M_RST0 + ((desired-1) & 7)) ||
- marker == ((int) M_RST0 + ((desired-2) & 7)))
- action = 2; /* a prior restart, so advance */
- else
- action = 1; /* desired restart or too far away */
- }
- TRACEMS2(cinfo, 4, JTRC_RECOVERY_ACTION, marker, action);
- switch (action) {
- case 1:
- /* Discard marker and let entropy decoder resume processing. */
- cinfo->unread_marker = 0;
- return TRUE;
- case 2:
- /* Scan to the next marker, and repeat the decision loop. */
- if (! next_marker(cinfo))
- return FALSE;
- marker = cinfo->unread_marker;
- break;
- case 3:
- /* Return without advancing past this marker. */
- /* Entropy decoder will be forced to process an empty segment. */
- return TRUE;
- }
- } /* end loop */
-}
-
-
-/*
- * Reset marker processing state to begin a fresh datastream.
- */
-
-METHODDEF(void)
-reset_marker_reader (j_decompress_ptr cinfo)
-{
- my_marker_ptr marker = (my_marker_ptr) cinfo->marker;
-
- cinfo->comp_info = NULL; /* until allocated by get_sof */
- cinfo->input_scan_number = 0; /* no SOS seen yet */
- cinfo->unread_marker = 0; /* no pending marker */
- marker->pub.saw_SOI = FALSE; /* set internal state too */
- marker->pub.saw_SOF = FALSE;
- marker->pub.discarded_bytes = 0;
- marker->cur_marker = NULL;
-}
-
-
-/*
- * Initialize the marker reader module.
- * This is called only once, when the decompression object is created.
- */
-
-GLOBAL(void)
-jinit_marker_reader (j_decompress_ptr cinfo)
-{
- my_marker_ptr marker;
- int i;
-
- /* Create subobject in permanent pool */
- marker = (my_marker_ptr)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
- SIZEOF(my_marker_reader));
- cinfo->marker = (struct jpeg_marker_reader *) marker;
- /* Initialize public method pointers */
- marker->pub.reset_marker_reader = reset_marker_reader;
- marker->pub.read_markers = read_markers;
- marker->pub.read_restart_marker = read_restart_marker;
- /* Initialize COM/APPn processing.
- * By default, we examine and then discard APP0 and APP14,
- * but simply discard COM and all other APPn.
- */
- marker->process_COM = skip_variable;
- marker->length_limit_COM = 0;
- for (i = 0; i < 16; i++) {
- marker->process_APPn[i] = skip_variable;
- marker->length_limit_APPn[i] = 0;
- }
- marker->process_APPn[0] = get_interesting_appn;
- marker->process_APPn[14] = get_interesting_appn;
- /* Reset marker processing state */
- reset_marker_reader(cinfo);
-}
-
-
-/*
- * Control saving of COM and APPn markers into marker_list.
- */
-
-#ifdef SAVE_MARKERS_SUPPORTED
-
-GLOBAL(void)
-jpeg_save_markers (j_decompress_ptr cinfo, int marker_code,
- unsigned int length_limit)
-{
- my_marker_ptr marker = (my_marker_ptr) cinfo->marker;
- long maxlength;
- jpeg_marker_parser_method processor;
-
- /* Length limit mustn't be larger than what we can allocate
- * (should only be a concern in a 16-bit environment).
- */
- maxlength = cinfo->mem->max_alloc_chunk - SIZEOF(struct jpeg_marker_struct);
- if (((long) length_limit) > maxlength)
- length_limit = (unsigned int) maxlength;
-
- /* Choose processor routine to use.
- * APP0/APP14 have special requirements.
- */
- if (length_limit) {
- processor = save_marker;
- /* If saving APP0/APP14, save at least enough for our internal use. */
- if (marker_code == (int) M_APP0 && length_limit < APP0_DATA_LEN)
- length_limit = APP0_DATA_LEN;
- else if (marker_code == (int) M_APP14 && length_limit < APP14_DATA_LEN)
- length_limit = APP14_DATA_LEN;
- } else {
- processor = skip_variable;
- /* If discarding APP0/APP14, use our regular on-the-fly processor. */
- if (marker_code == (int) M_APP0 || marker_code == (int) M_APP14)
- processor = get_interesting_appn;
- }
-
- if (marker_code == (int) M_COM) {
- marker->process_COM = processor;
- marker->length_limit_COM = length_limit;
- } else if (marker_code >= (int) M_APP0 && marker_code <= (int) M_APP15) {
- marker->process_APPn[marker_code - (int) M_APP0] = processor;
- marker->length_limit_APPn[marker_code - (int) M_APP0] = length_limit;
- } else
- ERREXIT1(cinfo, JERR_UNKNOWN_MARKER, marker_code);
-}
-
-#endif /* SAVE_MARKERS_SUPPORTED */
-
-
-/*
- * Install a special processing method for COM or APPn markers.
- */
-
-GLOBAL(void)
-jpeg_set_marker_processor (j_decompress_ptr cinfo, int marker_code,
- jpeg_marker_parser_method routine)
-{
- my_marker_ptr marker = (my_marker_ptr) cinfo->marker;
-
- if (marker_code == (int) M_COM)
- marker->process_COM = routine;
- else if (marker_code >= (int) M_APP0 && marker_code <= (int) M_APP15)
- marker->process_APPn[marker_code - (int) M_APP0] = routine;
- else
- ERREXIT1(cinfo, JERR_UNKNOWN_MARKER, marker_code);
-}
diff --git a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jdmaster.c b/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jdmaster.c
deleted file mode 100644
index 2802c5b7b29..00000000000
--- a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jdmaster.c
+++ /dev/null
@@ -1,557 +0,0 @@
-/*
- * jdmaster.c
- *
- * Copyright (C) 1991-1997, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file contains master control logic for the JPEG decompressor.
- * These routines are concerned with selecting the modules to be executed
- * and with determining the number of passes and the work to be done in each
- * pass.
- */
-
-#define JPEG_INTERNALS
-#include "jinclude.h"
-#include "jpeglib.h"
-
-
-/* Private state */
-
-typedef struct {
- struct jpeg_decomp_master pub; /* public fields */
-
- int pass_number; /* # of passes completed */
-
- boolean using_merged_upsample; /* TRUE if using merged upsample/cconvert */
-
- /* Saved references to initialized quantizer modules,
- * in case we need to switch modes.
- */
- struct jpeg_color_quantizer * quantizer_1pass;
- struct jpeg_color_quantizer * quantizer_2pass;
-} my_decomp_master;
-
-typedef my_decomp_master * my_master_ptr;
-
-
-/*
- * Determine whether merged upsample/color conversion should be used.
- * CRUCIAL: this must match the actual capabilities of jdmerge.c!
- */
-
-LOCAL(boolean)
-use_merged_upsample (j_decompress_ptr cinfo)
-{
-#ifdef UPSAMPLE_MERGING_SUPPORTED
- /* Merging is the equivalent of plain box-filter upsampling */
- if (cinfo->do_fancy_upsampling || cinfo->CCIR601_sampling)
- return FALSE;
- /* jdmerge.c only supports YCC=>RGB color conversion */
- if (cinfo->jpeg_color_space != JCS_YCbCr || cinfo->num_components != 3 ||
- cinfo->out_color_space != JCS_RGB ||
- cinfo->out_color_components != RGB_PIXELSIZE)
- return FALSE;
- /* and it only handles 2h1v or 2h2v sampling ratios */
- if (cinfo->comp_info[0].h_samp_factor != 2 ||
- cinfo->comp_info[1].h_samp_factor != 1 ||
- cinfo->comp_info[2].h_samp_factor != 1 ||
- cinfo->comp_info[0].v_samp_factor > 2 ||
- cinfo->comp_info[1].v_samp_factor != 1 ||
- cinfo->comp_info[2].v_samp_factor != 1)
- return FALSE;
- /* furthermore, it doesn't work if we've scaled the IDCTs differently */
- if (cinfo->comp_info[0].DCT_scaled_size != cinfo->min_DCT_scaled_size ||
- cinfo->comp_info[1].DCT_scaled_size != cinfo->min_DCT_scaled_size ||
- cinfo->comp_info[2].DCT_scaled_size != cinfo->min_DCT_scaled_size)
- return FALSE;
- /* ??? also need to test for upsample-time rescaling, when & if supported */
- return TRUE; /* by golly, it'll work... */
-#else
- return FALSE;
-#endif
-}
-
-
-/*
- * Compute output image dimensions and related values.
- * NOTE: this is exported for possible use by application.
- * Hence it mustn't do anything that can't be done twice.
- * Also note that it may be called before the master module is initialized!
- */
-
-GLOBAL(void)
-jpeg_calc_output_dimensions (j_decompress_ptr cinfo)
-/* Do computations that are needed before master selection phase */
-{
-#ifdef IDCT_SCALING_SUPPORTED
- int ci;
- jpeg_component_info *compptr;
-#endif
-
- /* Prevent application from calling me at wrong times */
- if (cinfo->global_state != DSTATE_READY)
- ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
-
-#ifdef IDCT_SCALING_SUPPORTED
-
- /* Compute actual output image dimensions and DCT scaling choices. */
- if (cinfo->scale_num * 8 <= cinfo->scale_denom) {
- /* Provide 1/8 scaling */
- cinfo->output_width = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_width, 8L);
- cinfo->output_height = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_height, 8L);
- cinfo->min_DCT_scaled_size = 1;
- } else if (cinfo->scale_num * 4 <= cinfo->scale_denom) {
- /* Provide 1/4 scaling */
- cinfo->output_width = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_width, 4L);
- cinfo->output_height = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_height, 4L);
- cinfo->min_DCT_scaled_size = 2;
- } else if (cinfo->scale_num * 2 <= cinfo->scale_denom) {
- /* Provide 1/2 scaling */
- cinfo->output_width = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_width, 2L);
- cinfo->output_height = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_height, 2L);
- cinfo->min_DCT_scaled_size = 4;
- } else {
- /* Provide 1/1 scaling */
- cinfo->output_width = cinfo->image_width;
- cinfo->output_height = cinfo->image_height;
- cinfo->min_DCT_scaled_size = DCTSIZE;
- }
- /* In selecting the actual DCT scaling for each component, we try to
- * scale up the chroma components via IDCT scaling rather than upsampling.
- * This saves time if the upsampler gets to use 1:1 scaling.
- * Note this code assumes that the supported DCT scalings are powers of 2.
- */
- for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
- ci++, compptr++) {
- int ssize = cinfo->min_DCT_scaled_size;
- while (ssize < DCTSIZE &&
- (compptr->h_samp_factor * ssize * 2 <=
- cinfo->max_h_samp_factor * cinfo->min_DCT_scaled_size) &&
- (compptr->v_samp_factor * ssize * 2 <=
- cinfo->max_v_samp_factor * cinfo->min_DCT_scaled_size)) {
- ssize = ssize * 2;
- }
- compptr->DCT_scaled_size = ssize;
- }
-
- /* Recompute downsampled dimensions of components;
- * application needs to know these if using raw downsampled data.
- */
- for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
- ci++, compptr++) {
- /* Size in samples, after IDCT scaling */
- compptr->downsampled_width = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_width *
- (long) (compptr->h_samp_factor * compptr->DCT_scaled_size),
- (long) (cinfo->max_h_samp_factor * DCTSIZE));
- compptr->downsampled_height = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_height *
- (long) (compptr->v_samp_factor * compptr->DCT_scaled_size),
- (long) (cinfo->max_v_samp_factor * DCTSIZE));
- }
-
-#else /* !IDCT_SCALING_SUPPORTED */
-
- /* Hardwire it to "no scaling" */
- cinfo->output_width = cinfo->image_width;
- cinfo->output_height = cinfo->image_height;
- /* jdinput.c has already initialized DCT_scaled_size to DCTSIZE,
- * and has computed unscaled downsampled_width and downsampled_height.
- */
-
-#endif /* IDCT_SCALING_SUPPORTED */
-
- /* Report number of components in selected colorspace. */
- /* Probably this should be in the color conversion module... */
- switch (cinfo->out_color_space) {
- case JCS_GRAYSCALE:
- cinfo->out_color_components = 1;
- break;
- case JCS_RGB:
-#if RGB_PIXELSIZE != 3
- cinfo->out_color_components = RGB_PIXELSIZE;
- break;
-#endif /* else share code with YCbCr */
- case JCS_YCbCr:
- cinfo->out_color_components = 3;
- break;
- case JCS_CMYK:
- case JCS_YCCK:
- cinfo->out_color_components = 4;
- break;
- default: /* else must be same colorspace as in file */
- cinfo->out_color_components = cinfo->num_components;
- break;
- }
- cinfo->output_components = (cinfo->quantize_colors ? 1 :
- cinfo->out_color_components);
-
- /* See if upsampler will want to emit more than one row at a time */
- if (use_merged_upsample(cinfo))
- cinfo->rec_outbuf_height = cinfo->max_v_samp_factor;
- else
- cinfo->rec_outbuf_height = 1;
-}
-
-
-/*
- * Several decompression processes need to range-limit values to the range
- * 0..MAXJSAMPLE; the input value may fall somewhat outside this range
- * due to noise introduced by quantization, roundoff error, etc. These
- * processes are inner loops and need to be as fast as possible. On most
- * machines, particularly CPUs with pipelines or instruction prefetch,
- * a (subscript-check-less) C table lookup
- * x = sample_range_limit[x];
- * is faster than explicit tests
- * if (x < 0) x = 0;
- * else if (x > MAXJSAMPLE) x = MAXJSAMPLE;
- * These processes all use a common table prepared by the routine below.
- *
- * For most steps we can mathematically guarantee that the initial value
- * of x is within MAXJSAMPLE+1 of the legal range, so a table running from
- * -(MAXJSAMPLE+1) to 2*MAXJSAMPLE+1 is sufficient. But for the initial
- * limiting step (just after the IDCT), a wildly out-of-range value is
- * possible if the input data is corrupt. To avoid any chance of indexing
- * off the end of memory and getting a bad-pointer trap, we perform the
- * post-IDCT limiting thus:
- * x = range_limit[x & MASK];
- * where MASK is 2 bits wider than legal sample data, ie 10 bits for 8-bit
- * samples. Under normal circumstances this is more than enough range and
- * a correct output will be generated; with bogus input data the mask will
- * cause wraparound, and we will safely generate a bogus-but-in-range output.
- * For the post-IDCT step, we want to convert the data from signed to unsigned
- * representation by adding CENTERJSAMPLE at the same time that we limit it.
- * So the post-IDCT limiting table ends up looking like this:
- * CENTERJSAMPLE,CENTERJSAMPLE+1,...,MAXJSAMPLE,
- * MAXJSAMPLE (repeat 2*(MAXJSAMPLE+1)-CENTERJSAMPLE times),
- * 0 (repeat 2*(MAXJSAMPLE+1)-CENTERJSAMPLE times),
- * 0,1,...,CENTERJSAMPLE-1
- * Negative inputs select values from the upper half of the table after
- * masking.
- *
- * We can save some space by overlapping the start of the post-IDCT table
- * with the simpler range limiting table. The post-IDCT table begins at
- * sample_range_limit + CENTERJSAMPLE.
- *
- * Note that the table is allocated in near data space on PCs; it's small
- * enough and used often enough to justify this.
- */
-
-LOCAL(void)
-prepare_range_limit_table (j_decompress_ptr cinfo)
-/* Allocate and fill in the sample_range_limit table */
-{
- JSAMPLE * table;
- int i;
-
- table = (JSAMPLE *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- (5 * (MAXJSAMPLE+1) + CENTERJSAMPLE) * SIZEOF(JSAMPLE));
- table += (MAXJSAMPLE+1); /* allow negative subscripts of simple table */
- cinfo->sample_range_limit = table;
- /* First segment of "simple" table: limit[x] = 0 for x < 0 */
- MEMZERO(table - (MAXJSAMPLE+1), (MAXJSAMPLE+1) * SIZEOF(JSAMPLE));
- /* Main part of "simple" table: limit[x] = x */
- for (i = 0; i <= MAXJSAMPLE; i++)
- table[i] = (JSAMPLE) i;
- table += CENTERJSAMPLE; /* Point to where post-IDCT table starts */
- /* End of simple table, rest of first half of post-IDCT table */
- for (i = CENTERJSAMPLE; i < 2*(MAXJSAMPLE+1); i++)
- table[i] = MAXJSAMPLE;
- /* Second half of post-IDCT table */
- MEMZERO(table + (2 * (MAXJSAMPLE+1)),
- (2 * (MAXJSAMPLE+1) - CENTERJSAMPLE) * SIZEOF(JSAMPLE));
- MEMCOPY(table + (4 * (MAXJSAMPLE+1) - CENTERJSAMPLE),
- cinfo->sample_range_limit, CENTERJSAMPLE * SIZEOF(JSAMPLE));
-}
-
-
-/*
- * Master selection of decompression modules.
- * This is done once at jpeg_start_decompress time. We determine
- * which modules will be used and give them appropriate initialization calls.
- * We also initialize the decompressor input side to begin consuming data.
- *
- * Since jpeg_read_header has finished, we know what is in the SOF
- * and (first) SOS markers. We also have all the application parameter
- * settings.
- */
-
-LOCAL(void)
-master_selection (j_decompress_ptr cinfo)
-{
- my_master_ptr master = (my_master_ptr) cinfo->master;
- boolean use_c_buffer;
- long samplesperrow;
- JDIMENSION jd_samplesperrow;
-
- /* Initialize dimensions and other stuff */
- jpeg_calc_output_dimensions(cinfo);
- prepare_range_limit_table(cinfo);
-
- /* Width of an output scanline must be representable as JDIMENSION. */
- samplesperrow = (long) cinfo->output_width * (long) cinfo->out_color_components;
- jd_samplesperrow = (JDIMENSION) samplesperrow;
- if ((long) jd_samplesperrow != samplesperrow)
- ERREXIT(cinfo, JERR_WIDTH_OVERFLOW);
-
- /* Initialize my private state */
- master->pass_number = 0;
- master->using_merged_upsample = use_merged_upsample(cinfo);
-
- /* Color quantizer selection */
- master->quantizer_1pass = NULL;
- master->quantizer_2pass = NULL;
- /* No mode changes if not using buffered-image mode. */
- if (! cinfo->quantize_colors || ! cinfo->buffered_image) {
- cinfo->enable_1pass_quant = FALSE;
- cinfo->enable_external_quant = FALSE;
- cinfo->enable_2pass_quant = FALSE;
- }
- if (cinfo->quantize_colors) {
- if (cinfo->raw_data_out)
- ERREXIT(cinfo, JERR_NOTIMPL);
- /* 2-pass quantizer only works in 3-component color space. */
- if (cinfo->out_color_components != 3) {
- cinfo->enable_1pass_quant = TRUE;
- cinfo->enable_external_quant = FALSE;
- cinfo->enable_2pass_quant = FALSE;
- cinfo->colormap = NULL;
- } else if (cinfo->colormap != NULL) {
- cinfo->enable_external_quant = TRUE;
- } else if (cinfo->two_pass_quantize) {
- cinfo->enable_2pass_quant = TRUE;
- } else {
- cinfo->enable_1pass_quant = TRUE;
- }
-
- if (cinfo->enable_1pass_quant) {
-#ifdef QUANT_1PASS_SUPPORTED
- jinit_1pass_quantizer(cinfo);
- master->quantizer_1pass = cinfo->cquantize;
-#else
- ERREXIT(cinfo, JERR_NOT_COMPILED);
-#endif
- }
-
- /* We use the 2-pass code to map to external colormaps. */
- if (cinfo->enable_2pass_quant || cinfo->enable_external_quant) {
-#ifdef QUANT_2PASS_SUPPORTED
- jinit_2pass_quantizer(cinfo);
- master->quantizer_2pass = cinfo->cquantize;
-#else
- ERREXIT(cinfo, JERR_NOT_COMPILED);
-#endif
- }
- /* If both quantizers are initialized, the 2-pass one is left active;
- * this is necessary for starting with quantization to an external map.
- */
- }
-
- /* Post-processing: in particular, color conversion first */
- if (! cinfo->raw_data_out) {
- if (master->using_merged_upsample) {
-#ifdef UPSAMPLE_MERGING_SUPPORTED
- jinit_merged_upsampler(cinfo); /* does color conversion too */
-#else
- ERREXIT(cinfo, JERR_NOT_COMPILED);
-#endif
- } else {
- jinit_color_deconverter(cinfo);
- jinit_upsampler(cinfo);
- }
- jinit_d_post_controller(cinfo, cinfo->enable_2pass_quant);
- }
- /* Inverse DCT */
- jinit_inverse_dct(cinfo);
- /* Entropy decoding: either Huffman or arithmetic coding. */
- if (cinfo->arith_code) {
- ERREXIT(cinfo, JERR_ARITH_NOTIMPL);
- } else {
- if (cinfo->progressive_mode) {
-#ifdef D_PROGRESSIVE_SUPPORTED
- jinit_phuff_decoder(cinfo);
-#else
- ERREXIT(cinfo, JERR_NOT_COMPILED);
-#endif
- } else
- jinit_huff_decoder(cinfo);
- }
-
- /* Initialize principal buffer controllers. */
- use_c_buffer = cinfo->inputctl->has_multiple_scans || cinfo->buffered_image;
- jinit_d_coef_controller(cinfo, use_c_buffer);
-
- if (! cinfo->raw_data_out)
- jinit_d_main_controller(cinfo, FALSE /* never need full buffer here */);
-
- /* We can now tell the memory manager to allocate virtual arrays. */
- (*cinfo->mem->realize_virt_arrays) ((j_common_ptr) cinfo);
-
- /* Initialize input side of decompressor to consume first scan. */
- (*cinfo->inputctl->start_input_pass) (cinfo);
-
-#ifdef D_MULTISCAN_FILES_SUPPORTED
- /* If jpeg_start_decompress will read the whole file, initialize
- * progress monitoring appropriately. The input step is counted
- * as one pass.
- */
- if (cinfo->progress != NULL && ! cinfo->buffered_image &&
- cinfo->inputctl->has_multiple_scans) {
- int nscans;
- /* Estimate number of scans to set pass_limit. */
- if (cinfo->progressive_mode) {
- /* Arbitrarily estimate 2 interleaved DC scans + 3 AC scans/component. */
- nscans = 2 + 3 * cinfo->num_components;
- } else {
- /* For a nonprogressive multiscan file, estimate 1 scan per component. */
- nscans = cinfo->num_components;
- }
- cinfo->progress->pass_counter = 0L;
- cinfo->progress->pass_limit = (long) cinfo->total_iMCU_rows * nscans;
- cinfo->progress->completed_passes = 0;
- cinfo->progress->total_passes = (cinfo->enable_2pass_quant ? 3 : 2);
- /* Count the input pass as done */
- master->pass_number++;
- }
-#endif /* D_MULTISCAN_FILES_SUPPORTED */
-}
-
-
-/*
- * Per-pass setup.
- * This is called at the beginning of each output pass. We determine which
- * modules will be active during this pass and give them appropriate
- * start_pass calls. We also set is_dummy_pass to indicate whether this
- * is a "real" output pass or a dummy pass for color quantization.
- * (In the latter case, jdapistd.c will crank the pass to completion.)
- */
-
-METHODDEF(void)
-prepare_for_output_pass (j_decompress_ptr cinfo)
-{
- my_master_ptr master = (my_master_ptr) cinfo->master;
-
- if (master->pub.is_dummy_pass) {
-#ifdef QUANT_2PASS_SUPPORTED
- /* Final pass of 2-pass quantization */
- master->pub.is_dummy_pass = FALSE;
- (*cinfo->cquantize->start_pass) (cinfo, FALSE);
- (*cinfo->post->start_pass) (cinfo, JBUF_CRANK_DEST);
- (*cinfo->main->start_pass) (cinfo, JBUF_CRANK_DEST);
-#else
- ERREXIT(cinfo, JERR_NOT_COMPILED);
-#endif /* QUANT_2PASS_SUPPORTED */
- } else {
- if (cinfo->quantize_colors && cinfo->colormap == NULL) {
- /* Select new quantization method */
- if (cinfo->two_pass_quantize && cinfo->enable_2pass_quant) {
- cinfo->cquantize = master->quantizer_2pass;
- master->pub.is_dummy_pass = TRUE;
- } else if (cinfo->enable_1pass_quant) {
- cinfo->cquantize = master->quantizer_1pass;
- } else {
- ERREXIT(cinfo, JERR_MODE_CHANGE);
- }
- }
- (*cinfo->idct->start_pass) (cinfo);
- (*cinfo->coef->start_output_pass) (cinfo);
- if (! cinfo->raw_data_out) {
- if (! master->using_merged_upsample)
- (*cinfo->cconvert->start_pass) (cinfo);
- (*cinfo->upsample->start_pass) (cinfo);
- if (cinfo->quantize_colors)
- (*cinfo->cquantize->start_pass) (cinfo, master->pub.is_dummy_pass);
- (*cinfo->post->start_pass) (cinfo,
- (master->pub.is_dummy_pass ? JBUF_SAVE_AND_PASS : JBUF_PASS_THRU));
- (*cinfo->main->start_pass) (cinfo, JBUF_PASS_THRU);
- }
- }
-
- /* Set up progress monitor's pass info if present */
- if (cinfo->progress != NULL) {
- cinfo->progress->completed_passes = master->pass_number;
- cinfo->progress->total_passes = master->pass_number +
- (master->pub.is_dummy_pass ? 2 : 1);
- /* In buffered-image mode, we assume one more output pass if EOI not
- * yet reached, but no more passes if EOI has been reached.
- */
- if (cinfo->buffered_image && ! cinfo->inputctl->eoi_reached) {
- cinfo->progress->total_passes += (cinfo->enable_2pass_quant ? 2 : 1);
- }
- }
-}
-
-
-/*
- * Finish up at end of an output pass.
- */
-
-METHODDEF(void)
-finish_output_pass (j_decompress_ptr cinfo)
-{
- my_master_ptr master = (my_master_ptr) cinfo->master;
-
- if (cinfo->quantize_colors)
- (*cinfo->cquantize->finish_pass) (cinfo);
- master->pass_number++;
-}
-
-
-#ifdef D_MULTISCAN_FILES_SUPPORTED
-
-/*
- * Switch to a new external colormap between output passes.
- */
-
-GLOBAL(void)
-jpeg_new_colormap (j_decompress_ptr cinfo)
-{
- my_master_ptr master = (my_master_ptr) cinfo->master;
-
- /* Prevent application from calling me at wrong times */
- if (cinfo->global_state != DSTATE_BUFIMAGE)
- ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
-
- if (cinfo->quantize_colors && cinfo->enable_external_quant &&
- cinfo->colormap != NULL) {
- /* Select 2-pass quantizer for external colormap use */
- cinfo->cquantize = master->quantizer_2pass;
- /* Notify quantizer of colormap change */
- (*cinfo->cquantize->new_color_map) (cinfo);
- master->pub.is_dummy_pass = FALSE; /* just in case */
- } else
- ERREXIT(cinfo, JERR_MODE_CHANGE);
-}
-
-#endif /* D_MULTISCAN_FILES_SUPPORTED */
-
-
-/*
- * Initialize master decompression control and select active modules.
- * This is performed at the start of jpeg_start_decompress.
- */
-
-GLOBAL(void)
-jinit_master_decompress (j_decompress_ptr cinfo)
-{
- my_master_ptr master;
-
- master = (my_master_ptr)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- SIZEOF(my_decomp_master));
- cinfo->master = (struct jpeg_decomp_master *) master;
- master->pub.prepare_for_output_pass = prepare_for_output_pass;
- master->pub.finish_output_pass = finish_output_pass;
-
- master->pub.is_dummy_pass = FALSE;
-
- master_selection(cinfo);
-}
diff --git a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jdmerge.c b/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jdmerge.c
deleted file mode 100644
index a175a56bf79..00000000000
--- a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jdmerge.c
+++ /dev/null
@@ -1,399 +0,0 @@
-/*
- * jdmerge.c
- *
- * Copyright (C) 1994-1996, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file contains code for merged upsampling/color conversion.
- *
- * This file combines functions from jdsample.c and jdcolor.c;
- * read those files first to understand what's going on.
- *
- * When the chroma components are to be upsampled by simple replication
- * (ie, box filtering), we can save some work in color conversion by
- * calculating all the output pixels corresponding to a pair of chroma
- * samples at one time. In the conversion equations
- * R = Y + K1 * Cr
- * G = Y + K2 * Cb + K3 * Cr
- * B = Y + K4 * Cb
- * only the Y term varies among the group of pixels corresponding to a pair
- * of chroma samples, so the rest of the terms can be calculated just once.
- * At typical sampling ratios, this eliminates half or three-quarters of the
- * multiplications needed for color conversion.
- *
- * This file currently provides implementations for the following cases:
- * YCbCr => RGB color conversion only.
- * Sampling ratios of 2h1v or 2h2v.
- * No scaling needed at upsample time.
- * Corner-aligned (non-CCIR601) sampling alignment.
- * Other special cases could be added, but in most applications these are
- * the only common cases. (For uncommon cases we fall back on the more
- * general code in jdsample.c and jdcolor.c.)
- */
-
-#define JPEG_INTERNALS
-#include "jinclude.h"
-#include "jpeglib.h"
-
-#ifdef UPSAMPLE_MERGING_SUPPORTED
-
-/* Private subobject */
-
-typedef struct {
- struct jpeg_upsampler pub; /* public fields */
-
- /* Pointer to routine to do actual upsampling/conversion of one row group */
- JMETHOD(void, upmethod, (j_decompress_ptr cinfo,
- JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr,
- JSAMPARRAY output_buf));
-
- /* Private state for YCC->RGB conversion */
- int * Cr_r_tab; /* => table for Cr to R conversion */
- int * Cb_b_tab; /* => table for Cb to B conversion */
- INT32 * Cr_g_tab; /* => table for Cr to G conversion */
- INT32 * Cb_g_tab; /* => table for Cb to G conversion */
-
- /* For 2:1 vertical sampling, we produce two output rows at a time.
- * We need a "spare" row buffer to hold the second output row if the
- * application provides just a one-row buffer; we also use the spare
- * to discard the dummy last row if the image height is odd.
- */
- JSAMPROW spare_row;
- boolean spare_full; /* T if spare buffer is occupied */
-
- JDIMENSION out_row_width; /* samples per output row */
- JDIMENSION rows_to_go; /* counts rows remaining in image */
-} my_upsampler;
-
-typedef my_upsampler * my_upsample_ptr;
-
-#define SCALEBITS 16 /* speediest right-shift on some machines */
-#define ONE_HALF ((INT32) 1 << (SCALEBITS-1))
-#define FIX(x) ((INT32) ((x) * (1L<<SCALEBITS) + 0.5))
-
-
-/*
- * Initialize tables for YCC->RGB colorspace conversion.
- * This is taken directly from jdcolor.c; see that file for more info.
- */
-
-LOCAL(void)
-build_ycc_rgb_table (j_decompress_ptr cinfo)
-{
- my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
- int i;
- INT32 x;
- SHIFT_TEMPS
-
- upsample->Cr_r_tab = (int *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- (MAXJSAMPLE+1) * SIZEOF(int));
- upsample->Cb_b_tab = (int *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- (MAXJSAMPLE+1) * SIZEOF(int));
- upsample->Cr_g_tab = (INT32 *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- (MAXJSAMPLE+1) * SIZEOF(INT32));
- upsample->Cb_g_tab = (INT32 *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- (MAXJSAMPLE+1) * SIZEOF(INT32));
-
- for (i = 0, x = -CENTERJSAMPLE; i <= MAXJSAMPLE; i++, x++) {
- /* i is the actual input pixel value, in the range 0..MAXJSAMPLE */
- /* The Cb or Cr value we are thinking of is x = i - CENTERJSAMPLE */
- /* Cr=>R value is nearest int to 1.40200 * x */
- upsample->Cr_r_tab[i] = (int)
- RIGHT_SHIFT(FIX(1.40200) * x + ONE_HALF, SCALEBITS);
- /* Cb=>B value is nearest int to 1.77200 * x */
- upsample->Cb_b_tab[i] = (int)
- RIGHT_SHIFT(FIX(1.77200) * x + ONE_HALF, SCALEBITS);
- /* Cr=>G value is scaled-up -0.71414 * x */
- upsample->Cr_g_tab[i] = (- FIX(0.71414)) * x;
- /* Cb=>G value is scaled-up -0.34414 * x */
- /* We also add in ONE_HALF so that need not do it in inner loop */
- upsample->Cb_g_tab[i] = (- FIX(0.34414)) * x + ONE_HALF;
- }
-}
-
-
-/*
- * Initialize for an upsampling pass.
- */
-
-METHODDEF(void)
-start_pass_merged_upsample (j_decompress_ptr cinfo)
-{
- my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
-
- /* Mark the spare buffer empty */
- upsample->spare_full = FALSE;
- /* Initialize total-height counter for detecting bottom of image */
- upsample->rows_to_go = cinfo->output_height;
-}
-
-
-/*
- * Control routine to do upsampling (and color conversion).
- *
- * The control routine just handles the row buffering considerations.
- */
-
-METHODDEF(void)
-merged_2v_upsample (j_decompress_ptr cinfo,
- JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr,
- JDIMENSION in_row_groups_avail,
- JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
- JDIMENSION out_rows_avail)
-/* 2:1 vertical sampling case: may need a spare row. */
-{
- my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
- JSAMPROW work_ptrs[2];
- JDIMENSION num_rows; /* number of rows returned to caller */
-
- if (upsample->spare_full) {
- /* If we have a spare row saved from a previous cycle, just return it. */
- jcopy_sample_rows(& upsample->spare_row, 0, output_buf + *out_row_ctr, 0,
- 1, upsample->out_row_width);
- num_rows = 1;
- upsample->spare_full = FALSE;
- } else {
- /* Figure number of rows to return to caller. */
- num_rows = 2;
- /* Not more than the distance to the end of the image. */
- if (num_rows > upsample->rows_to_go)
- num_rows = upsample->rows_to_go;
- /* And not more than what the client can accept: */
- out_rows_avail -= *out_row_ctr;
- if (num_rows > out_rows_avail)
- num_rows = out_rows_avail;
- /* Create output pointer array for upsampler. */
- work_ptrs[0] = output_buf[*out_row_ctr];
- if (num_rows > 1) {
- work_ptrs[1] = output_buf[*out_row_ctr + 1];
- } else {
- work_ptrs[1] = upsample->spare_row;
- upsample->spare_full = TRUE;
- }
- /* Now do the upsampling. */
- (*upsample->upmethod) (cinfo, input_buf, *in_row_group_ctr, work_ptrs);
- }
-
- /* Adjust counts */
- *out_row_ctr += num_rows;
- upsample->rows_to_go -= num_rows;
- /* When the buffer is emptied, declare this input row group consumed */
- if (! upsample->spare_full)
- (*in_row_group_ctr)++;
-}
-
-
-METHODDEF(void)
-merged_1v_upsample (j_decompress_ptr cinfo,
- JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr,
- JDIMENSION in_row_groups_avail,
- JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
- JDIMENSION out_rows_avail)
-/* 1:1 vertical sampling case: much easier, never need a spare row. */
-{
- my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
-
- /* Just do the upsampling. */
- (*upsample->upmethod) (cinfo, input_buf, *in_row_group_ctr,
- output_buf + *out_row_ctr);
- /* Adjust counts */
- (*out_row_ctr)++;
- (*in_row_group_ctr)++;
-}
-
-
-/*
- * These are the routines invoked by the control routines to do
- * the actual upsampling/conversion. One row group is processed per call.
- *
- * Note: since we may be writing directly into application-supplied buffers,
- * we have to be honest about the output width; we can't assume the buffer
- * has been rounded up to an even width.
- */
-
-
-/*
- * Upsample and color convert for the case of 2:1 horizontal and 1:1 vertical.
- */
-
-METHODDEF(void)
-h2v1_merged_upsample (j_decompress_ptr cinfo,
- JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr,
- JSAMPARRAY output_buf)
-{
- my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
- register int y, cred, cgreen, cblue;
- int cb, cr;
- register JSAMPROW outptr;
- JSAMPROW inptr0, inptr1, inptr2;
- JDIMENSION col;
- /* copy these pointers into registers if possible */
- register JSAMPLE * range_limit = cinfo->sample_range_limit;
- int * Crrtab = upsample->Cr_r_tab;
- int * Cbbtab = upsample->Cb_b_tab;
- INT32 * Crgtab = upsample->Cr_g_tab;
- INT32 * Cbgtab = upsample->Cb_g_tab;
- SHIFT_TEMPS
-
- inptr0 = input_buf[0][in_row_group_ctr];
- inptr1 = input_buf[1][in_row_group_ctr];
- inptr2 = input_buf[2][in_row_group_ctr];
- outptr = output_buf[0];
- /* Loop for each pair of output pixels */
- for (col = cinfo->output_width >> 1; col > 0; col--) {
- /* Do the chroma part of the calculation */
- cb = GETJSAMPLE(*inptr1++);
- cr = GETJSAMPLE(*inptr2++);
- cred = Crrtab[cr];
- cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
- cblue = Cbbtab[cb];
- /* Fetch 2 Y values and emit 2 pixels */
- y = GETJSAMPLE(*inptr0++);
- outptr[RGB_RED] = range_limit[y + cred];
- outptr[RGB_GREEN] = range_limit[y + cgreen];
- outptr[RGB_BLUE] = range_limit[y + cblue];
- outptr += RGB_PIXELSIZE;
- y = GETJSAMPLE(*inptr0++);
- outptr[RGB_RED] = range_limit[y + cred];
- outptr[RGB_GREEN] = range_limit[y + cgreen];
- outptr[RGB_BLUE] = range_limit[y + cblue];
- outptr += RGB_PIXELSIZE;
- }
- /* If image width is odd, do the last output column separately */
- if (cinfo->output_width & 1) {
- cb = GETJSAMPLE(*inptr1);
- cr = GETJSAMPLE(*inptr2);
- cred = Crrtab[cr];
- cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
- cblue = Cbbtab[cb];
- y = GETJSAMPLE(*inptr0);
- outptr[RGB_RED] = range_limit[y + cred];
- outptr[RGB_GREEN] = range_limit[y + cgreen];
- outptr[RGB_BLUE] = range_limit[y + cblue];
- }
-}
-
-
-/*
- * Upsample and color convert for the case of 2:1 horizontal and 2:1 vertical.
- */
-
-METHODDEF(void)
-h2v2_merged_upsample (j_decompress_ptr cinfo,
- JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr,
- JSAMPARRAY output_buf)
-{
- my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
- register int y, cred, cgreen, cblue;
- int cb, cr;
- register JSAMPROW outptr0, outptr1;
- JSAMPROW inptr00, inptr01, inptr1, inptr2;
- JDIMENSION col;
- /* copy these pointers into registers if possible */
- register JSAMPLE * range_limit = cinfo->sample_range_limit;
- int * Crrtab = upsample->Cr_r_tab;
- int * Cbbtab = upsample->Cb_b_tab;
- INT32 * Crgtab = upsample->Cr_g_tab;
- INT32 * Cbgtab = upsample->Cb_g_tab;
- SHIFT_TEMPS
-
- inptr00 = input_buf[0][in_row_group_ctr*2];
- inptr01 = input_buf[0][in_row_group_ctr*2 + 1];
- inptr1 = input_buf[1][in_row_group_ctr];
- inptr2 = input_buf[2][in_row_group_ctr];
- outptr0 = output_buf[0];
- outptr1 = output_buf[1];
- /* Loop for each group of output pixels */
- for (col = cinfo->output_width >> 1; col > 0; col--) {
- /* Do the chroma part of the calculation */
- cb = GETJSAMPLE(*inptr1++);
- cr = GETJSAMPLE(*inptr2++);
- cred = Crrtab[cr];
- cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
- cblue = Cbbtab[cb];
- /* Fetch 4 Y values and emit 4 pixels */
- y = GETJSAMPLE(*inptr00++);
- outptr0[RGB_RED] = range_limit[y + cred];
- outptr0[RGB_GREEN] = range_limit[y + cgreen];
- outptr0[RGB_BLUE] = range_limit[y + cblue];
- outptr0 += RGB_PIXELSIZE;
- y = GETJSAMPLE(*inptr00++);
- outptr0[RGB_RED] = range_limit[y + cred];
- outptr0[RGB_GREEN] = range_limit[y + cgreen];
- outptr0[RGB_BLUE] = range_limit[y + cblue];
- outptr0 += RGB_PIXELSIZE;
- y = GETJSAMPLE(*inptr01++);
- outptr1[RGB_RED] = range_limit[y + cred];
- outptr1[RGB_GREEN] = range_limit[y + cgreen];
- outptr1[RGB_BLUE] = range_limit[y + cblue];
- outptr1 += RGB_PIXELSIZE;
- y = GETJSAMPLE(*inptr01++);
- outptr1[RGB_RED] = range_limit[y + cred];
- outptr1[RGB_GREEN] = range_limit[y + cgreen];
- outptr1[RGB_BLUE] = range_limit[y + cblue];
- outptr1 += RGB_PIXELSIZE;
- }
- /* If image width is odd, do the last output column separately */
- if (cinfo->output_width & 1) {
- cb = GETJSAMPLE(*inptr1);
- cr = GETJSAMPLE(*inptr2);
- cred = Crrtab[cr];
- cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
- cblue = Cbbtab[cb];
- y = GETJSAMPLE(*inptr00);
- outptr0[RGB_RED] = range_limit[y + cred];
- outptr0[RGB_GREEN] = range_limit[y + cgreen];
- outptr0[RGB_BLUE] = range_limit[y + cblue];
- y = GETJSAMPLE(*inptr01);
- outptr1[RGB_RED] = range_limit[y + cred];
- outptr1[RGB_GREEN] = range_limit[y + cgreen];
- outptr1[RGB_BLUE] = range_limit[y + cblue];
- }
-}
-
-
-/*
- * Module initialization routine for merged upsampling/color conversion.
- *
- * NB: this is called under the conditions determined by use_merged_upsample()
- * in jdmaster.c. That routine MUST correspond to the actual capabilities
- * of this module; no safety checks are made here.
- */
-
-GLOBAL(void)
-jinit_merged_upsampler (j_decompress_ptr cinfo)
-{
- my_upsample_ptr upsample;
-
- upsample = (my_upsample_ptr)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- SIZEOF(my_upsampler));
- cinfo->upsample = (struct jpeg_upsampler *) upsample;
- upsample->pub.start_pass = start_pass_merged_upsample;
- upsample->pub.need_context_rows = FALSE;
-
- upsample->out_row_width = cinfo->output_width * cinfo->out_color_components;
-
- if (cinfo->max_v_samp_factor == 2) {
- upsample->pub.upsample = merged_2v_upsample;
- upsample->upmethod = h2v2_merged_upsample;
- /* Allocate a spare row buffer */
- upsample->spare_row = (JSAMPROW)
- (*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- (size_t) (upsample->out_row_width * SIZEOF(JSAMPLE)));
- } else {
- upsample->pub.upsample = merged_1v_upsample;
- upsample->upmethod = h2v1_merged_upsample;
- /* No spare row needed */
- upsample->spare_row = NULL;
- }
-
- build_ycc_rgb_table(cinfo);
-}
-
-#endif /* UPSAMPLE_MERGING_SUPPORTED */
diff --git a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jdphuff.c b/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jdphuff.c
deleted file mode 100644
index 22678099451..00000000000
--- a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jdphuff.c
+++ /dev/null
@@ -1,668 +0,0 @@
-/*
- * jdphuff.c
- *
- * Copyright (C) 1995-1997, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file contains Huffman entropy decoding routines for progressive JPEG.
- *
- * Much of the complexity here has to do with supporting input suspension.
- * If the data source module demands suspension, we want to be able to back
- * up to the start of the current MCU. To do this, we copy state variables
- * into local working storage, and update them back to the permanent
- * storage only upon successful completion of an MCU.
- */
-
-#define JPEG_INTERNALS
-#include "jinclude.h"
-#include "jpeglib.h"
-#include "jdhuff.h" /* Declarations shared with jdhuff.c */
-
-
-#ifdef D_PROGRESSIVE_SUPPORTED
-
-/*
- * Expanded entropy decoder object for progressive Huffman decoding.
- *
- * The savable_state subrecord contains fields that change within an MCU,
- * but must not be updated permanently until we complete the MCU.
- */
-
-typedef struct {
- unsigned int EOBRUN; /* remaining EOBs in EOBRUN */
- int last_dc_val[MAX_COMPS_IN_SCAN]; /* last DC coef for each component */
-} savable_state;
-
-/* This macro is to work around compilers with missing or broken
- * structure assignment. You'll need to fix this code if you have
- * such a compiler and you change MAX_COMPS_IN_SCAN.
- */
-
-#ifndef NO_STRUCT_ASSIGN
-#define ASSIGN_STATE(dest,src) ((dest) = (src))
-#else
-#if MAX_COMPS_IN_SCAN == 4
-#define ASSIGN_STATE(dest,src) \
- ((dest).EOBRUN = (src).EOBRUN, \
- (dest).last_dc_val[0] = (src).last_dc_val[0], \
- (dest).last_dc_val[1] = (src).last_dc_val[1], \
- (dest).last_dc_val[2] = (src).last_dc_val[2], \
- (dest).last_dc_val[3] = (src).last_dc_val[3])
-#endif
-#endif
-
-
-typedef struct {
- struct jpeg_entropy_decoder pub; /* public fields */
-
- /* These fields are loaded into local variables at start of each MCU.
- * In case of suspension, we exit WITHOUT updating them.
- */
- bitread_perm_state bitstate; /* Bit buffer at start of MCU */
- savable_state saved; /* Other state at start of MCU */
-
- /* These fields are NOT loaded into local working state. */
- unsigned int restarts_to_go; /* MCUs left in this restart interval */
-
- /* Pointers to derived tables (these workspaces have image lifespan) */
- d_derived_tbl * derived_tbls[NUM_HUFF_TBLS];
-
- d_derived_tbl * ac_derived_tbl; /* active table during an AC scan */
-} phuff_entropy_decoder;
-
-typedef phuff_entropy_decoder * phuff_entropy_ptr;
-
-/* Forward declarations */
-METHODDEF(boolean) decode_mcu_DC_first JPP((j_decompress_ptr cinfo,
- JBLOCKROW *MCU_data));
-METHODDEF(boolean) decode_mcu_AC_first JPP((j_decompress_ptr cinfo,
- JBLOCKROW *MCU_data));
-METHODDEF(boolean) decode_mcu_DC_refine JPP((j_decompress_ptr cinfo,
- JBLOCKROW *MCU_data));
-METHODDEF(boolean) decode_mcu_AC_refine JPP((j_decompress_ptr cinfo,
- JBLOCKROW *MCU_data));
-
-
-/*
- * Initialize for a Huffman-compressed scan.
- */
-
-METHODDEF(void)
-start_pass_phuff_decoder (j_decompress_ptr cinfo)
-{
- phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
- boolean is_DC_band, bad;
- int ci, coefi, tbl;
- int *coef_bit_ptr;
- jpeg_component_info * compptr;
-
- is_DC_band = (cinfo->Ss == 0);
-
- /* Validate scan parameters */
- bad = FALSE;
- if (is_DC_band) {
- if (cinfo->Se != 0)
- bad = TRUE;
- } else {
- /* need not check Ss/Se < 0 since they came from unsigned bytes */
- if (cinfo->Ss > cinfo->Se || cinfo->Se >= DCTSIZE2)
- bad = TRUE;
- /* AC scans may have only one component */
- if (cinfo->comps_in_scan != 1)
- bad = TRUE;
- }
- if (cinfo->Ah != 0) {
- /* Successive approximation refinement scan: must have Al = Ah-1. */
- if (cinfo->Al != cinfo->Ah-1)
- bad = TRUE;
- }
- if (cinfo->Al > 13) /* need not check for < 0 */
- bad = TRUE;
- /* Arguably the maximum Al value should be less than 13 for 8-bit precision,
- * but the spec doesn't say so, and we try to be liberal about what we
- * accept. Note: large Al values could result in out-of-range DC
- * coefficients during early scans, leading to bizarre displays due to
- * overflows in the IDCT math. But we won't crash.
- */
- if (bad)
- ERREXIT4(cinfo, JERR_BAD_PROGRESSION,
- cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al);
- /* Update progression status, and verify that scan order is legal.
- * Note that inter-scan inconsistencies are treated as warnings
- * not fatal errors ... not clear if this is right way to behave.
- */
- for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
- int cindex = cinfo->cur_comp_info[ci]->component_index;
- coef_bit_ptr = & cinfo->coef_bits[cindex][0];
- if (!is_DC_band && coef_bit_ptr[0] < 0) /* AC without prior DC scan */
- WARNMS2(cinfo, JWRN_BOGUS_PROGRESSION, cindex, 0);
- for (coefi = cinfo->Ss; coefi <= cinfo->Se; coefi++) {
- int expected = (coef_bit_ptr[coefi] < 0) ? 0 : coef_bit_ptr[coefi];
- if (cinfo->Ah != expected)
- WARNMS2(cinfo, JWRN_BOGUS_PROGRESSION, cindex, coefi);
- coef_bit_ptr[coefi] = cinfo->Al;
- }
- }
-
- /* Select MCU decoding routine */
- if (cinfo->Ah == 0) {
- if (is_DC_band)
- entropy->pub.decode_mcu = decode_mcu_DC_first;
- else
- entropy->pub.decode_mcu = decode_mcu_AC_first;
- } else {
- if (is_DC_band)
- entropy->pub.decode_mcu = decode_mcu_DC_refine;
- else
- entropy->pub.decode_mcu = decode_mcu_AC_refine;
- }
-
- for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
- compptr = cinfo->cur_comp_info[ci];
- /* Make sure requested tables are present, and compute derived tables.
- * We may build same derived table more than once, but it's not expensive.
- */
- if (is_DC_band) {
- if (cinfo->Ah == 0) { /* DC refinement needs no table */
- tbl = compptr->dc_tbl_no;
- jpeg_make_d_derived_tbl(cinfo, TRUE, tbl,
- & entropy->derived_tbls[tbl]);
- }
- } else {
- tbl = compptr->ac_tbl_no;
- jpeg_make_d_derived_tbl(cinfo, FALSE, tbl,
- & entropy->derived_tbls[tbl]);
- /* remember the single active table */
- entropy->ac_derived_tbl = entropy->derived_tbls[tbl];
- }
- /* Initialize DC predictions to 0 */
- entropy->saved.last_dc_val[ci] = 0;
- }
-
- /* Initialize bitread state variables */
- entropy->bitstate.bits_left = 0;
- entropy->bitstate.get_buffer = 0; /* unnecessary, but keeps Purify quiet */
- entropy->pub.insufficient_data = FALSE;
-
- /* Initialize private state variables */
- entropy->saved.EOBRUN = 0;
-
- /* Initialize restart counter */
- entropy->restarts_to_go = cinfo->restart_interval;
-}
-
-
-/*
- * Figure F.12: extend sign bit.
- * On some machines, a shift and add will be faster than a table lookup.
- */
-
-#ifdef AVOID_TABLES
-
-#define HUFF_EXTEND(x,s) ((x) < (1<<((s)-1)) ? (x) + (((-1)<<(s)) + 1) : (x))
-
-#else
-
-#define HUFF_EXTEND(x,s) ((x) < extend_test[s] ? (x) + extend_offset[s] : (x))
-
-static const int extend_test[16] = /* entry n is 2**(n-1) */
- { 0, 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080,
- 0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000 };
-
-static const int extend_offset[16] = /* entry n is (-1 << n) + 1 */
- { 0, ((-1)<<1) + 1, ((-1)<<2) + 1, ((-1)<<3) + 1, ((-1)<<4) + 1,
- ((-1)<<5) + 1, ((-1)<<6) + 1, ((-1)<<7) + 1, ((-1)<<8) + 1,
- ((-1)<<9) + 1, ((-1)<<10) + 1, ((-1)<<11) + 1, ((-1)<<12) + 1,
- ((-1)<<13) + 1, ((-1)<<14) + 1, ((-1)<<15) + 1 };
-
-#endif /* AVOID_TABLES */
-
-
-/*
- * Check for a restart marker & resynchronize decoder.
- * Returns FALSE if must suspend.
- */
-
-LOCAL(boolean)
-process_restart (j_decompress_ptr cinfo)
-{
- phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
- int ci;
-
- /* Throw away any unused bits remaining in bit buffer; */
- /* include any full bytes in next_marker's count of discarded bytes */
- cinfo->marker->discarded_bytes += entropy->bitstate.bits_left / 8;
- entropy->bitstate.bits_left = 0;
-
- /* Advance past the RSTn marker */
- if (! (*cinfo->marker->read_restart_marker) (cinfo))
- return FALSE;
-
- /* Re-initialize DC predictions to 0 */
- for (ci = 0; ci < cinfo->comps_in_scan; ci++)
- entropy->saved.last_dc_val[ci] = 0;
- /* Re-init EOB run count, too */
- entropy->saved.EOBRUN = 0;
-
- /* Reset restart counter */
- entropy->restarts_to_go = cinfo->restart_interval;
-
- /* Reset out-of-data flag, unless read_restart_marker left us smack up
- * against a marker. In that case we will end up treating the next data
- * segment as empty, and we can avoid producing bogus output pixels by
- * leaving the flag set.
- */
- if (cinfo->unread_marker == 0)
- entropy->pub.insufficient_data = FALSE;
-
- return TRUE;
-}
-
-
-/*
- * Huffman MCU decoding.
- * Each of these routines decodes and returns one MCU's worth of
- * Huffman-compressed coefficients.
- * The coefficients are reordered from zigzag order into natural array order,
- * but are not dequantized.
- *
- * The i'th block of the MCU is stored into the block pointed to by
- * MCU_data[i]. WE ASSUME THIS AREA IS INITIALLY ZEROED BY THE CALLER.
- *
- * We return FALSE if data source requested suspension. In that case no
- * changes have been made to permanent state. (Exception: some output
- * coefficients may already have been assigned. This is harmless for
- * spectral selection, since we'll just re-assign them on the next call.
- * Successive approximation AC refinement has to be more careful, however.)
- */
-
-/*
- * MCU decoding for DC initial scan (either spectral selection,
- * or first pass of successive approximation).
- */
-
-METHODDEF(boolean)
-decode_mcu_DC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
-{
- phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
- int Al = cinfo->Al;
- register int s, r;
- int blkn, ci;
- JBLOCKROW block;
- BITREAD_STATE_VARS;
- savable_state state;
- d_derived_tbl * tbl;
- jpeg_component_info * compptr;
-
- /* Process restart marker if needed; may have to suspend */
- if (cinfo->restart_interval) {
- if (entropy->restarts_to_go == 0)
- if (! process_restart(cinfo))
- return FALSE;
- }
-
- /* If we've run out of data, just leave the MCU set to zeroes.
- * This way, we return uniform gray for the remainder of the segment.
- */
- if (! entropy->pub.insufficient_data) {
-
- /* Load up working state */
- BITREAD_LOAD_STATE(cinfo,entropy->bitstate);
- ASSIGN_STATE(state, entropy->saved);
-
- /* Outer loop handles each block in the MCU */
-
- for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
- block = MCU_data[blkn];
- ci = cinfo->MCU_membership[blkn];
- compptr = cinfo->cur_comp_info[ci];
- tbl = entropy->derived_tbls[compptr->dc_tbl_no];
-
- /* Decode a single block's worth of coefficients */
-
- /* Section F.2.2.1: decode the DC coefficient difference */
- HUFF_DECODE(s, br_state, tbl, return FALSE, label1);
- if (s) {
- CHECK_BIT_BUFFER(br_state, s, return FALSE);
- r = GET_BITS(s);
- s = HUFF_EXTEND(r, s);
- }
-
- /* Convert DC difference to actual value, update last_dc_val */
- s += state.last_dc_val[ci];
- state.last_dc_val[ci] = s;
- /* Scale and output the coefficient (assumes jpeg_natural_order[0]=0) */
- (*block)[0] = (JCOEF) (s << Al);
- }
-
- /* Completed MCU, so update state */
- BITREAD_SAVE_STATE(cinfo,entropy->bitstate);
- ASSIGN_STATE(entropy->saved, state);
- }
-
- /* Account for restart interval (no-op if not using restarts) */
- entropy->restarts_to_go--;
-
- return TRUE;
-}
-
-
-/*
- * MCU decoding for AC initial scan (either spectral selection,
- * or first pass of successive approximation).
- */
-
-METHODDEF(boolean)
-decode_mcu_AC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
-{
- phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
- int Se = cinfo->Se;
- int Al = cinfo->Al;
- register int s, k, r;
- unsigned int EOBRUN;
- JBLOCKROW block;
- BITREAD_STATE_VARS;
- d_derived_tbl * tbl;
-
- /* Process restart marker if needed; may have to suspend */
- if (cinfo->restart_interval) {
- if (entropy->restarts_to_go == 0)
- if (! process_restart(cinfo))
- return FALSE;
- }
-
- /* If we've run out of data, just leave the MCU set to zeroes.
- * This way, we return uniform gray for the remainder of the segment.
- */
- if (! entropy->pub.insufficient_data) {
-
- /* Load up working state.
- * We can avoid loading/saving bitread state if in an EOB run.
- */
- EOBRUN = entropy->saved.EOBRUN; /* only part of saved state we need */
-
- /* There is always only one block per MCU */
-
- if (EOBRUN > 0) /* if it's a band of zeroes... */
- EOBRUN--; /* ...process it now (we do nothing) */
- else {
- BITREAD_LOAD_STATE(cinfo,entropy->bitstate);
- block = MCU_data[0];
- tbl = entropy->ac_derived_tbl;
-
- for (k = cinfo->Ss; k <= Se; k++) {
- HUFF_DECODE(s, br_state, tbl, return FALSE, label2);
- r = s >> 4;
- s &= 15;
- if (s) {
- k += r;
- CHECK_BIT_BUFFER(br_state, s, return FALSE);
- r = GET_BITS(s);
- s = HUFF_EXTEND(r, s);
- /* Scale and output coefficient in natural (dezigzagged) order */
- (*block)[jpeg_natural_order[k]] = (JCOEF) (s << Al);
- } else {
- if (r == 15) { /* ZRL */
- k += 15; /* skip 15 zeroes in band */
- } else { /* EOBr, run length is 2^r + appended bits */
- EOBRUN = 1 << r;
- if (r) { /* EOBr, r > 0 */
- CHECK_BIT_BUFFER(br_state, r, return FALSE);
- r = GET_BITS(r);
- EOBRUN += r;
- }
- EOBRUN--; /* this band is processed at this moment */
- break; /* force end-of-band */
- }
- }
- }
-
- BITREAD_SAVE_STATE(cinfo,entropy->bitstate);
- }
-
- /* Completed MCU, so update state */
- entropy->saved.EOBRUN = EOBRUN; /* only part of saved state we need */
- }
-
- /* Account for restart interval (no-op if not using restarts) */
- entropy->restarts_to_go--;
-
- return TRUE;
-}
-
-
-/*
- * MCU decoding for DC successive approximation refinement scan.
- * Note: we assume such scans can be multi-component, although the spec
- * is not very clear on the point.
- */
-
-METHODDEF(boolean)
-decode_mcu_DC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
-{
- phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
- int p1 = 1 << cinfo->Al; /* 1 in the bit position being coded */
- int blkn;
- JBLOCKROW block;
- BITREAD_STATE_VARS;
-
- /* Process restart marker if needed; may have to suspend */
- if (cinfo->restart_interval) {
- if (entropy->restarts_to_go == 0)
- if (! process_restart(cinfo))
- return FALSE;
- }
-
- /* Not worth the cycles to check insufficient_data here,
- * since we will not change the data anyway if we read zeroes.
- */
-
- /* Load up working state */
- BITREAD_LOAD_STATE(cinfo,entropy->bitstate);
-
- /* Outer loop handles each block in the MCU */
-
- for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
- block = MCU_data[blkn];
-
- /* Encoded data is simply the next bit of the two's-complement DC value */
- CHECK_BIT_BUFFER(br_state, 1, return FALSE);
- if (GET_BITS(1))
- (*block)[0] |= p1;
- /* Note: since we use |=, repeating the assignment later is safe */
- }
-
- /* Completed MCU, so update state */
- BITREAD_SAVE_STATE(cinfo,entropy->bitstate);
-
- /* Account for restart interval (no-op if not using restarts) */
- entropy->restarts_to_go--;
-
- return TRUE;
-}
-
-
-/*
- * MCU decoding for AC successive approximation refinement scan.
- */
-
-METHODDEF(boolean)
-decode_mcu_AC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
-{
- phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
- int Se = cinfo->Se;
- int p1 = 1 << cinfo->Al; /* 1 in the bit position being coded */
- int m1 = (-1) << cinfo->Al; /* -1 in the bit position being coded */
- register int s, k, r;
- unsigned int EOBRUN;
- JBLOCKROW block;
- JCOEFPTR thiscoef;
- BITREAD_STATE_VARS;
- d_derived_tbl * tbl;
- int num_newnz;
- int newnz_pos[DCTSIZE2];
-
- /* Process restart marker if needed; may have to suspend */
- if (cinfo->restart_interval) {
- if (entropy->restarts_to_go == 0)
- if (! process_restart(cinfo))
- return FALSE;
- }
-
- /* If we've run out of data, don't modify the MCU.
- */
- if (! entropy->pub.insufficient_data) {
-
- /* Load up working state */
- BITREAD_LOAD_STATE(cinfo,entropy->bitstate);
- EOBRUN = entropy->saved.EOBRUN; /* only part of saved state we need */
-
- /* There is always only one block per MCU */
- block = MCU_data[0];
- tbl = entropy->ac_derived_tbl;
-
- /* If we are forced to suspend, we must undo the assignments to any newly
- * nonzero coefficients in the block, because otherwise we'd get confused
- * next time about which coefficients were already nonzero.
- * But we need not undo addition of bits to already-nonzero coefficients;
- * instead, we can test the current bit to see if we already did it.
- */
- num_newnz = 0;
-
- /* initialize coefficient loop counter to start of band */
- k = cinfo->Ss;
-
- if (EOBRUN == 0) {
- for (; k <= Se; k++) {
- HUFF_DECODE(s, br_state, tbl, goto undoit, label3);
- r = s >> 4;
- s &= 15;
- if (s) {
- if (s != 1) /* size of new coef should always be 1 */
- WARNMS(cinfo, JWRN_HUFF_BAD_CODE);
- CHECK_BIT_BUFFER(br_state, 1, goto undoit);
- if (GET_BITS(1))
- s = p1; /* newly nonzero coef is positive */
- else
- s = m1; /* newly nonzero coef is negative */
- } else {
- if (r != 15) {
- EOBRUN = 1 << r; /* EOBr, run length is 2^r + appended bits */
- if (r) {
- CHECK_BIT_BUFFER(br_state, r, goto undoit);
- r = GET_BITS(r);
- EOBRUN += r;
- }
- break; /* rest of block is handled by EOB logic */
- }
- /* note s = 0 for processing ZRL */
- }
- /* Advance over already-nonzero coefs and r still-zero coefs,
- * appending correction bits to the nonzeroes. A correction bit is 1
- * if the absolute value of the coefficient must be increased.
- */
- do {
- thiscoef = *block + jpeg_natural_order[k];
- if (*thiscoef != 0) {
- CHECK_BIT_BUFFER(br_state, 1, goto undoit);
- if (GET_BITS(1)) {
- if ((*thiscoef & p1) == 0) { /* do nothing if already set it */
- if (*thiscoef >= 0)
- *thiscoef += p1;
- else
- *thiscoef += m1;
- }
- }
- } else {
- if (--r < 0)
- break; /* reached target zero coefficient */
- }
- k++;
- } while (k <= Se);
- if (s) {
- int pos = jpeg_natural_order[k];
- /* Output newly nonzero coefficient */
- (*block)[pos] = (JCOEF) s;
- /* Remember its position in case we have to suspend */
- newnz_pos[num_newnz++] = pos;
- }
- }
- }
-
- if (EOBRUN > 0) {
- /* Scan any remaining coefficient positions after the end-of-band
- * (the last newly nonzero coefficient, if any). Append a correction
- * bit to each already-nonzero coefficient. A correction bit is 1
- * if the absolute value of the coefficient must be increased.
- */
- for (; k <= Se; k++) {
- thiscoef = *block + jpeg_natural_order[k];
- if (*thiscoef != 0) {
- CHECK_BIT_BUFFER(br_state, 1, goto undoit);
- if (GET_BITS(1)) {
- if ((*thiscoef & p1) == 0) { /* do nothing if already changed it */
- if (*thiscoef >= 0)
- *thiscoef += p1;
- else
- *thiscoef += m1;
- }
- }
- }
- }
- /* Count one block completed in EOB run */
- EOBRUN--;
- }
-
- /* Completed MCU, so update state */
- BITREAD_SAVE_STATE(cinfo,entropy->bitstate);
- entropy->saved.EOBRUN = EOBRUN; /* only part of saved state we need */
- }
-
- /* Account for restart interval (no-op if not using restarts) */
- entropy->restarts_to_go--;
-
- return TRUE;
-
-undoit:
- /* Re-zero any output coefficients that we made newly nonzero */
- while (num_newnz > 0)
- (*block)[newnz_pos[--num_newnz]] = 0;
-
- return FALSE;
-}
-
-
-/*
- * Module initialization routine for progressive Huffman entropy decoding.
- */
-
-GLOBAL(void)
-jinit_phuff_decoder (j_decompress_ptr cinfo)
-{
- phuff_entropy_ptr entropy;
- int *coef_bit_ptr;
- int ci, i;
-
- entropy = (phuff_entropy_ptr)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- SIZEOF(phuff_entropy_decoder));
- cinfo->entropy = (struct jpeg_entropy_decoder *) entropy;
- entropy->pub.start_pass = start_pass_phuff_decoder;
-
- /* Mark derived tables unallocated */
- for (i = 0; i < NUM_HUFF_TBLS; i++) {
- entropy->derived_tbls[i] = NULL;
- }
-
- /* Create progression status table */
- cinfo->coef_bits = (int (*)[DCTSIZE2])
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- cinfo->num_components*DCTSIZE2*SIZEOF(int));
- coef_bit_ptr = & cinfo->coef_bits[0][0];
- for (ci = 0; ci < cinfo->num_components; ci++)
- for (i = 0; i < DCTSIZE2; i++)
- *coef_bit_ptr++ = -1;
-}
-
-#endif /* D_PROGRESSIVE_SUPPORTED */
diff --git a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jdpostct.c b/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jdpostct.c
deleted file mode 100644
index 571563d728e..00000000000
--- a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jdpostct.c
+++ /dev/null
@@ -1,290 +0,0 @@
-/*
- * jdpostct.c
- *
- * Copyright (C) 1994-1996, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file contains the decompression postprocessing controller.
- * This controller manages the upsampling, color conversion, and color
- * quantization/reduction steps; specifically, it controls the buffering
- * between upsample/color conversion and color quantization/reduction.
- *
- * If no color quantization/reduction is required, then this module has no
- * work to do, and it just hands off to the upsample/color conversion code.
- * An integrated upsample/convert/quantize process would replace this module
- * entirely.
- */
-
-#define JPEG_INTERNALS
-#include "jinclude.h"
-#include "jpeglib.h"
-
-
-/* Private buffer controller object */
-
-typedef struct {
- struct jpeg_d_post_controller pub; /* public fields */
-
- /* Color quantization source buffer: this holds output data from
- * the upsample/color conversion step to be passed to the quantizer.
- * For two-pass color quantization, we need a full-image buffer;
- * for one-pass operation, a strip buffer is sufficient.
- */
- jvirt_sarray_ptr whole_image; /* virtual array, or NULL if one-pass */
- JSAMPARRAY buffer; /* strip buffer, or current strip of virtual */
- JDIMENSION strip_height; /* buffer size in rows */
- /* for two-pass mode only: */
- JDIMENSION starting_row; /* row # of first row in current strip */
- JDIMENSION next_row; /* index of next row to fill/empty in strip */
-} my_post_controller;
-
-typedef my_post_controller * my_post_ptr;
-
-
-/* Forward declarations */
-METHODDEF(void) post_process_1pass
- JPP((j_decompress_ptr cinfo,
- JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr,
- JDIMENSION in_row_groups_avail,
- JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
- JDIMENSION out_rows_avail));
-#ifdef QUANT_2PASS_SUPPORTED
-METHODDEF(void) post_process_prepass
- JPP((j_decompress_ptr cinfo,
- JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr,
- JDIMENSION in_row_groups_avail,
- JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
- JDIMENSION out_rows_avail));
-METHODDEF(void) post_process_2pass
- JPP((j_decompress_ptr cinfo,
- JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr,
- JDIMENSION in_row_groups_avail,
- JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
- JDIMENSION out_rows_avail));
-#endif
-
-
-/*
- * Initialize for a processing pass.
- */
-
-METHODDEF(void)
-start_pass_dpost (j_decompress_ptr cinfo, J_BUF_MODE pass_mode)
-{
- my_post_ptr post = (my_post_ptr) cinfo->post;
-
- switch (pass_mode) {
- case JBUF_PASS_THRU:
- if (cinfo->quantize_colors) {
- /* Single-pass processing with color quantization. */
- post->pub.post_process_data = post_process_1pass;
- /* We could be doing buffered-image output before starting a 2-pass
- * color quantization; in that case, jinit_d_post_controller did not
- * allocate a strip buffer. Use the virtual-array buffer as workspace.
- */
- if (post->buffer == NULL) {
- post->buffer = (*cinfo->mem->access_virt_sarray)
- ((j_common_ptr) cinfo, post->whole_image,
- (JDIMENSION) 0, post->strip_height, TRUE);
- }
- } else {
- /* For single-pass processing without color quantization,
- * I have no work to do; just call the upsampler directly.
- */
- post->pub.post_process_data = cinfo->upsample->upsample;
- }
- break;
-#ifdef QUANT_2PASS_SUPPORTED
- case JBUF_SAVE_AND_PASS:
- /* First pass of 2-pass quantization */
- if (post->whole_image == NULL)
- ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
- post->pub.post_process_data = post_process_prepass;
- break;
- case JBUF_CRANK_DEST:
- /* Second pass of 2-pass quantization */
- if (post->whole_image == NULL)
- ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
- post->pub.post_process_data = post_process_2pass;
- break;
-#endif /* QUANT_2PASS_SUPPORTED */
- default:
- ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
- break;
- }
- post->starting_row = post->next_row = 0;
-}
-
-
-/*
- * Process some data in the one-pass (strip buffer) case.
- * This is used for color precision reduction as well as one-pass quantization.
- */
-
-METHODDEF(void)
-post_process_1pass (j_decompress_ptr cinfo,
- JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr,
- JDIMENSION in_row_groups_avail,
- JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
- JDIMENSION out_rows_avail)
-{
- my_post_ptr post = (my_post_ptr) cinfo->post;
- JDIMENSION num_rows, max_rows;
-
- /* Fill the buffer, but not more than what we can dump out in one go. */
- /* Note we rely on the upsampler to detect bottom of image. */
- max_rows = out_rows_avail - *out_row_ctr;
- if (max_rows > post->strip_height)
- max_rows = post->strip_height;
- num_rows = 0;
- (*cinfo->upsample->upsample) (cinfo,
- input_buf, in_row_group_ctr, in_row_groups_avail,
- post->buffer, &num_rows, max_rows);
- /* Quantize and emit data. */
- (*cinfo->cquantize->color_quantize) (cinfo,
- post->buffer, output_buf + *out_row_ctr, (int) num_rows);
- *out_row_ctr += num_rows;
-}
-
-
-#ifdef QUANT_2PASS_SUPPORTED
-
-/*
- * Process some data in the first pass of 2-pass quantization.
- */
-
-METHODDEF(void)
-post_process_prepass (j_decompress_ptr cinfo,
- JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr,
- JDIMENSION in_row_groups_avail,
- JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
- JDIMENSION out_rows_avail)
-{
- my_post_ptr post = (my_post_ptr) cinfo->post;
- JDIMENSION old_next_row, num_rows;
-
- /* Reposition virtual buffer if at start of strip. */
- if (post->next_row == 0) {
- post->buffer = (*cinfo->mem->access_virt_sarray)
- ((j_common_ptr) cinfo, post->whole_image,
- post->starting_row, post->strip_height, TRUE);
- }
-
- /* Upsample some data (up to a strip height's worth). */
- old_next_row = post->next_row;
- (*cinfo->upsample->upsample) (cinfo,
- input_buf, in_row_group_ctr, in_row_groups_avail,
- post->buffer, &post->next_row, post->strip_height);
-
- /* Allow quantizer to scan new data. No data is emitted, */
- /* but we advance out_row_ctr so outer loop can tell when we're done. */
- if (post->next_row > old_next_row) {
- num_rows = post->next_row - old_next_row;
- (*cinfo->cquantize->color_quantize) (cinfo, post->buffer + old_next_row,
- (JSAMPARRAY) NULL, (int) num_rows);
- *out_row_ctr += num_rows;
- }
-
- /* Advance if we filled the strip. */
- if (post->next_row >= post->strip_height) {
- post->starting_row += post->strip_height;
- post->next_row = 0;
- }
-}
-
-
-/*
- * Process some data in the second pass of 2-pass quantization.
- */
-
-METHODDEF(void)
-post_process_2pass (j_decompress_ptr cinfo,
- JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr,
- JDIMENSION in_row_groups_avail,
- JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
- JDIMENSION out_rows_avail)
-{
- my_post_ptr post = (my_post_ptr) cinfo->post;
- JDIMENSION num_rows, max_rows;
-
- /* Reposition virtual buffer if at start of strip. */
- if (post->next_row == 0) {
- post->buffer = (*cinfo->mem->access_virt_sarray)
- ((j_common_ptr) cinfo, post->whole_image,
- post->starting_row, post->strip_height, FALSE);
- }
-
- /* Determine number of rows to emit. */
- num_rows = post->strip_height - post->next_row; /* available in strip */
- max_rows = out_rows_avail - *out_row_ctr; /* available in output area */
- if (num_rows > max_rows)
- num_rows = max_rows;
- /* We have to check bottom of image here, can't depend on upsampler. */
- max_rows = cinfo->output_height - post->starting_row;
- if (num_rows > max_rows)
- num_rows = max_rows;
-
- /* Quantize and emit data. */
- (*cinfo->cquantize->color_quantize) (cinfo,
- post->buffer + post->next_row, output_buf + *out_row_ctr,
- (int) num_rows);
- *out_row_ctr += num_rows;
-
- /* Advance if we filled the strip. */
- post->next_row += num_rows;
- if (post->next_row >= post->strip_height) {
- post->starting_row += post->strip_height;
- post->next_row = 0;
- }
-}
-
-#endif /* QUANT_2PASS_SUPPORTED */
-
-
-/*
- * Initialize postprocessing controller.
- */
-
-GLOBAL(void)
-jinit_d_post_controller (j_decompress_ptr cinfo, boolean need_full_buffer)
-{
- my_post_ptr post;
-
- post = (my_post_ptr)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- SIZEOF(my_post_controller));
- cinfo->post = (struct jpeg_d_post_controller *) post;
- post->pub.start_pass = start_pass_dpost;
- post->whole_image = NULL; /* flag for no virtual arrays */
- post->buffer = NULL; /* flag for no strip buffer */
-
- /* Create the quantization buffer, if needed */
- if (cinfo->quantize_colors) {
- /* The buffer strip height is max_v_samp_factor, which is typically
- * an efficient number of rows for upsampling to return.
- * (In the presence of output rescaling, we might want to be smarter?)
- */
- post->strip_height = (JDIMENSION) cinfo->max_v_samp_factor;
- if (need_full_buffer) {
- /* Two-pass color quantization: need full-image storage. */
- /* We round up the number of rows to a multiple of the strip height. */
-#ifdef QUANT_2PASS_SUPPORTED
- post->whole_image = (*cinfo->mem->request_virt_sarray)
- ((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE,
- cinfo->output_width * cinfo->out_color_components,
- (JDIMENSION) jround_up((long) cinfo->output_height,
- (long) post->strip_height),
- post->strip_height);
-#else
- ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
-#endif /* QUANT_2PASS_SUPPORTED */
- } else {
- /* One-pass color quantization: just make a strip buffer. */
- post->buffer = (*cinfo->mem->alloc_sarray)
- ((j_common_ptr) cinfo, JPOOL_IMAGE,
- cinfo->output_width * cinfo->out_color_components,
- post->strip_height);
- }
- }
-}
diff --git a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jdsample.c b/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jdsample.c
deleted file mode 100644
index 80ffefb2a1c..00000000000
--- a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jdsample.c
+++ /dev/null
@@ -1,478 +0,0 @@
-/*
- * jdsample.c
- *
- * Copyright (C) 1991-1996, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file contains upsampling routines.
- *
- * Upsampling input data is counted in "row groups". A row group
- * is defined to be (v_samp_factor * DCT_scaled_size / min_DCT_scaled_size)
- * sample rows of each component. Upsampling will normally produce
- * max_v_samp_factor pixel rows from each row group (but this could vary
- * if the upsampler is applying a scale factor of its own).
- *
- * An excellent reference for image resampling is
- * Digital Image Warping, George Wolberg, 1990.
- * Pub. by IEEE Computer Society Press, Los Alamitos, CA. ISBN 0-8186-8944-7.
- */
-
-#define JPEG_INTERNALS
-#include "jinclude.h"
-#include "jpeglib.h"
-
-
-/* Pointer to routine to upsample a single component */
-typedef JMETHOD(void, upsample1_ptr,
- (j_decompress_ptr cinfo, jpeg_component_info * compptr,
- JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr));
-
-/* Private subobject */
-
-typedef struct {
- struct jpeg_upsampler pub; /* public fields */
-
- /* Color conversion buffer. When using separate upsampling and color
- * conversion steps, this buffer holds one upsampled row group until it
- * has been color converted and output.
- * Note: we do not allocate any storage for component(s) which are full-size,
- * ie do not need rescaling. The corresponding entry of color_buf[] is
- * simply set to point to the input data array, thereby avoiding copying.
- */
- JSAMPARRAY color_buf[MAX_COMPONENTS];
-
- /* Per-component upsampling method pointers */
- upsample1_ptr methods[MAX_COMPONENTS];
-
- int next_row_out; /* counts rows emitted from color_buf */
- JDIMENSION rows_to_go; /* counts rows remaining in image */
-
- /* Height of an input row group for each component. */
- int rowgroup_height[MAX_COMPONENTS];
-
- /* These arrays save pixel expansion factors so that int_expand need not
- * recompute them each time. They are unused for other upsampling methods.
- */
- UINT8 h_expand[MAX_COMPONENTS];
- UINT8 v_expand[MAX_COMPONENTS];
-} my_upsampler;
-
-typedef my_upsampler * my_upsample_ptr;
-
-
-/*
- * Initialize for an upsampling pass.
- */
-
-METHODDEF(void)
-start_pass_upsample (j_decompress_ptr cinfo)
-{
- my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
-
- /* Mark the conversion buffer empty */
- upsample->next_row_out = cinfo->max_v_samp_factor;
- /* Initialize total-height counter for detecting bottom of image */
- upsample->rows_to_go = cinfo->output_height;
-}
-
-
-/*
- * Control routine to do upsampling (and color conversion).
- *
- * In this version we upsample each component independently.
- * We upsample one row group into the conversion buffer, then apply
- * color conversion a row at a time.
- */
-
-METHODDEF(void)
-sep_upsample (j_decompress_ptr cinfo,
- JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr,
- JDIMENSION in_row_groups_avail,
- JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
- JDIMENSION out_rows_avail)
-{
- my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
- int ci;
- jpeg_component_info * compptr;
- JDIMENSION num_rows;
-
- /* Fill the conversion buffer, if it's empty */
- if (upsample->next_row_out >= cinfo->max_v_samp_factor) {
- for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
- ci++, compptr++) {
- /* Invoke per-component upsample method. Notice we pass a POINTER
- * to color_buf[ci], so that fullsize_upsample can change it.
- */
- (*upsample->methods[ci]) (cinfo, compptr,
- input_buf[ci] + (*in_row_group_ctr * upsample->rowgroup_height[ci]),
- upsample->color_buf + ci);
- }
- upsample->next_row_out = 0;
- }
-
- /* Color-convert and emit rows */
-
- /* How many we have in the buffer: */
- num_rows = (JDIMENSION) (cinfo->max_v_samp_factor - upsample->next_row_out);
- /* Not more than the distance to the end of the image. Need this test
- * in case the image height is not a multiple of max_v_samp_factor:
- */
- if (num_rows > upsample->rows_to_go)
- num_rows = upsample->rows_to_go;
- /* And not more than what the client can accept: */
- out_rows_avail -= *out_row_ctr;
- if (num_rows > out_rows_avail)
- num_rows = out_rows_avail;
-
- (*cinfo->cconvert->color_convert) (cinfo, upsample->color_buf,
- (JDIMENSION) upsample->next_row_out,
- output_buf + *out_row_ctr,
- (int) num_rows);
-
- /* Adjust counts */
- *out_row_ctr += num_rows;
- upsample->rows_to_go -= num_rows;
- upsample->next_row_out += num_rows;
- /* When the buffer is emptied, declare this input row group consumed */
- if (upsample->next_row_out >= cinfo->max_v_samp_factor)
- (*in_row_group_ctr)++;
-}
-
-
-/*
- * These are the routines invoked by sep_upsample to upsample pixel values
- * of a single component. One row group is processed per call.
- */
-
-
-/*
- * For full-size components, we just make color_buf[ci] point at the
- * input buffer, and thus avoid copying any data. Note that this is
- * safe only because sep_upsample doesn't declare the input row group
- * "consumed" until we are done color converting and emitting it.
- */
-
-METHODDEF(void)
-fullsize_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr,
- JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)
-{
- *output_data_ptr = input_data;
-}
-
-
-/*
- * This is a no-op version used for "uninteresting" components.
- * These components will not be referenced by color conversion.
- */
-
-METHODDEF(void)
-noop_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr,
- JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)
-{
- *output_data_ptr = NULL; /* safety check */
-}
-
-
-/*
- * This version handles any integral sampling ratios.
- * This is not used for typical JPEG files, so it need not be fast.
- * Nor, for that matter, is it particularly accurate: the algorithm is
- * simple replication of the input pixel onto the corresponding output
- * pixels. The hi-falutin sampling literature refers to this as a
- * "box filter". A box filter tends to introduce visible artifacts,
- * so if you are actually going to use 3:1 or 4:1 sampling ratios
- * you would be well advised to improve this code.
- */
-
-METHODDEF(void)
-int_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr,
- JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)
-{
- my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
- JSAMPARRAY output_data = *output_data_ptr;
- register JSAMPROW inptr, outptr;
- register JSAMPLE invalue;
- register int h;
- JSAMPROW outend;
- int h_expand, v_expand;
- int inrow, outrow;
-
- h_expand = upsample->h_expand[compptr->component_index];
- v_expand = upsample->v_expand[compptr->component_index];
-
- inrow = outrow = 0;
- while (outrow < cinfo->max_v_samp_factor) {
- /* Generate one output row with proper horizontal expansion */
- inptr = input_data[inrow];
- outptr = output_data[outrow];
- outend = outptr + cinfo->output_width;
- while (outptr < outend) {
- invalue = *inptr++; /* don't need GETJSAMPLE() here */
- for (h = h_expand; h > 0; h--) {
- *outptr++ = invalue;
- }
- }
- /* Generate any additional output rows by duplicating the first one */
- if (v_expand > 1) {
- jcopy_sample_rows(output_data, outrow, output_data, outrow+1,
- v_expand-1, cinfo->output_width);
- }
- inrow++;
- outrow += v_expand;
- }
-}
-
-
-/*
- * Fast processing for the common case of 2:1 horizontal and 1:1 vertical.
- * It's still a box filter.
- */
-
-METHODDEF(void)
-h2v1_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr,
- JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)
-{
- JSAMPARRAY output_data = *output_data_ptr;
- register JSAMPROW inptr, outptr;
- register JSAMPLE invalue;
- JSAMPROW outend;
- int inrow;
-
- for (inrow = 0; inrow < cinfo->max_v_samp_factor; inrow++) {
- inptr = input_data[inrow];
- outptr = output_data[inrow];
- outend = outptr + cinfo->output_width;
- while (outptr < outend) {
- invalue = *inptr++; /* don't need GETJSAMPLE() here */
- *outptr++ = invalue;
- *outptr++ = invalue;
- }
- }
-}
-
-
-/*
- * Fast processing for the common case of 2:1 horizontal and 2:1 vertical.
- * It's still a box filter.
- */
-
-METHODDEF(void)
-h2v2_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr,
- JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)
-{
- JSAMPARRAY output_data = *output_data_ptr;
- register JSAMPROW inptr, outptr;
- register JSAMPLE invalue;
- JSAMPROW outend;
- int inrow, outrow;
-
- inrow = outrow = 0;
- while (outrow < cinfo->max_v_samp_factor) {
- inptr = input_data[inrow];
- outptr = output_data[outrow];
- outend = outptr + cinfo->output_width;
- while (outptr < outend) {
- invalue = *inptr++; /* don't need GETJSAMPLE() here */
- *outptr++ = invalue;
- *outptr++ = invalue;
- }
- jcopy_sample_rows(output_data, outrow, output_data, outrow+1,
- 1, cinfo->output_width);
- inrow++;
- outrow += 2;
- }
-}
-
-
-/*
- * Fancy processing for the common case of 2:1 horizontal and 1:1 vertical.
- *
- * The upsampling algorithm is linear interpolation between pixel centers,
- * also known as a "triangle filter". This is a good compromise between
- * speed and visual quality. The centers of the output pixels are 1/4 and 3/4
- * of the way between input pixel centers.
- *
- * A note about the "bias" calculations: when rounding fractional values to
- * integer, we do not want to always round 0.5 up to the next integer.
- * If we did that, we'd introduce a noticeable bias towards larger values.
- * Instead, this code is arranged so that 0.5 will be rounded up or down at
- * alternate pixel locations (a simple ordered dither pattern).
- */
-
-METHODDEF(void)
-h2v1_fancy_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr,
- JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)
-{
- JSAMPARRAY output_data = *output_data_ptr;
- register JSAMPROW inptr, outptr;
- register int invalue;
- register JDIMENSION colctr;
- int inrow;
-
- for (inrow = 0; inrow < cinfo->max_v_samp_factor; inrow++) {
- inptr = input_data[inrow];
- outptr = output_data[inrow];
- /* Special case for first column */
- invalue = GETJSAMPLE(*inptr++);
- *outptr++ = (JSAMPLE) invalue;
- *outptr++ = (JSAMPLE) ((invalue * 3 + GETJSAMPLE(*inptr) + 2) >> 2);
-
- for (colctr = compptr->downsampled_width - 2; colctr > 0; colctr--) {
- /* General case: 3/4 * nearer pixel + 1/4 * further pixel */
- invalue = GETJSAMPLE(*inptr++) * 3;
- *outptr++ = (JSAMPLE) ((invalue + GETJSAMPLE(inptr[-2]) + 1) >> 2);
- *outptr++ = (JSAMPLE) ((invalue + GETJSAMPLE(*inptr) + 2) >> 2);
- }
-
- /* Special case for last column */
- invalue = GETJSAMPLE(*inptr);
- *outptr++ = (JSAMPLE) ((invalue * 3 + GETJSAMPLE(inptr[-1]) + 1) >> 2);
- *outptr++ = (JSAMPLE) invalue;
- }
-}
-
-
-/*
- * Fancy processing for the common case of 2:1 horizontal and 2:1 vertical.
- * Again a triangle filter; see comments for h2v1 case, above.
- *
- * It is OK for us to reference the adjacent input rows because we demanded
- * context from the main buffer controller (see initialization code).
- */
-
-METHODDEF(void)
-h2v2_fancy_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr,
- JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)
-{
- JSAMPARRAY output_data = *output_data_ptr;
- register JSAMPROW inptr0, inptr1, outptr;
-#if BITS_IN_JSAMPLE == 8
- register int thiscolsum, lastcolsum, nextcolsum;
-#else
- register INT32 thiscolsum, lastcolsum, nextcolsum;
-#endif
- register JDIMENSION colctr;
- int inrow, outrow, v;
-
- inrow = outrow = 0;
- while (outrow < cinfo->max_v_samp_factor) {
- for (v = 0; v < 2; v++) {
- /* inptr0 points to nearest input row, inptr1 points to next nearest */
- inptr0 = input_data[inrow];
- if (v == 0) /* next nearest is row above */
- inptr1 = input_data[inrow-1];
- else /* next nearest is row below */
- inptr1 = input_data[inrow+1];
- outptr = output_data[outrow++];
-
- /* Special case for first column */
- thiscolsum = GETJSAMPLE(*inptr0++) * 3 + GETJSAMPLE(*inptr1++);
- nextcolsum = GETJSAMPLE(*inptr0++) * 3 + GETJSAMPLE(*inptr1++);
- *outptr++ = (JSAMPLE) ((thiscolsum * 4 + 8) >> 4);
- *outptr++ = (JSAMPLE) ((thiscolsum * 3 + nextcolsum + 7) >> 4);
- lastcolsum = thiscolsum; thiscolsum = nextcolsum;
-
- for (colctr = compptr->downsampled_width - 2; colctr > 0; colctr--) {
- /* General case: 3/4 * nearer pixel + 1/4 * further pixel in each */
- /* dimension, thus 9/16, 3/16, 3/16, 1/16 overall */
- nextcolsum = GETJSAMPLE(*inptr0++) * 3 + GETJSAMPLE(*inptr1++);
- *outptr++ = (JSAMPLE) ((thiscolsum * 3 + lastcolsum + 8) >> 4);
- *outptr++ = (JSAMPLE) ((thiscolsum * 3 + nextcolsum + 7) >> 4);
- lastcolsum = thiscolsum; thiscolsum = nextcolsum;
- }
-
- /* Special case for last column */
- *outptr++ = (JSAMPLE) ((thiscolsum * 3 + lastcolsum + 8) >> 4);
- *outptr++ = (JSAMPLE) ((thiscolsum * 4 + 7) >> 4);
- }
- inrow++;
- }
-}
-
-
-/*
- * Module initialization routine for upsampling.
- */
-
-GLOBAL(void)
-jinit_upsampler (j_decompress_ptr cinfo)
-{
- my_upsample_ptr upsample;
- int ci;
- jpeg_component_info * compptr;
- boolean need_buffer, do_fancy;
- int h_in_group, v_in_group, h_out_group, v_out_group;
-
- upsample = (my_upsample_ptr)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- SIZEOF(my_upsampler));
- cinfo->upsample = (struct jpeg_upsampler *) upsample;
- upsample->pub.start_pass = start_pass_upsample;
- upsample->pub.upsample = sep_upsample;
- upsample->pub.need_context_rows = FALSE; /* until we find out differently */
-
- if (cinfo->CCIR601_sampling) /* this isn't supported */
- ERREXIT(cinfo, JERR_CCIR601_NOTIMPL);
-
- /* jdmainct.c doesn't support context rows when min_DCT_scaled_size = 1,
- * so don't ask for it.
- */
- do_fancy = cinfo->do_fancy_upsampling && cinfo->min_DCT_scaled_size > 1;
-
- /* Verify we can handle the sampling factors, select per-component methods,
- * and create storage as needed.
- */
- for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
- ci++, compptr++) {
- /* Compute size of an "input group" after IDCT scaling. This many samples
- * are to be converted to max_h_samp_factor * max_v_samp_factor pixels.
- */
- h_in_group = (compptr->h_samp_factor * compptr->DCT_scaled_size) /
- cinfo->min_DCT_scaled_size;
- v_in_group = (compptr->v_samp_factor * compptr->DCT_scaled_size) /
- cinfo->min_DCT_scaled_size;
- h_out_group = cinfo->max_h_samp_factor;
- v_out_group = cinfo->max_v_samp_factor;
- upsample->rowgroup_height[ci] = v_in_group; /* save for use later */
- need_buffer = TRUE;
- if (! compptr->component_needed) {
- /* Don't bother to upsample an uninteresting component. */
- upsample->methods[ci] = noop_upsample;
- need_buffer = FALSE;
- } else if (h_in_group == h_out_group && v_in_group == v_out_group) {
- /* Fullsize components can be processed without any work. */
- upsample->methods[ci] = fullsize_upsample;
- need_buffer = FALSE;
- } else if (h_in_group * 2 == h_out_group &&
- v_in_group == v_out_group) {
- /* Special cases for 2h1v upsampling */
- if (do_fancy && compptr->downsampled_width > 2)
- upsample->methods[ci] = h2v1_fancy_upsample;
- else
- upsample->methods[ci] = h2v1_upsample;
- } else if (h_in_group * 2 == h_out_group &&
- v_in_group * 2 == v_out_group) {
- /* Special cases for 2h2v upsampling */
- if (do_fancy && compptr->downsampled_width > 2) {
- upsample->methods[ci] = h2v2_fancy_upsample;
- upsample->pub.need_context_rows = TRUE;
- } else
- upsample->methods[ci] = h2v2_upsample;
- } else if ((h_out_group % h_in_group) == 0 &&
- (v_out_group % v_in_group) == 0) {
- /* Generic integral-factors upsampling method */
- upsample->methods[ci] = int_upsample;
- upsample->h_expand[ci] = (UINT8) (h_out_group / h_in_group);
- upsample->v_expand[ci] = (UINT8) (v_out_group / v_in_group);
- } else
- ERREXIT(cinfo, JERR_FRACT_SAMPLE_NOTIMPL);
- if (need_buffer) {
- upsample->color_buf[ci] = (*cinfo->mem->alloc_sarray)
- ((j_common_ptr) cinfo, JPOOL_IMAGE,
- (JDIMENSION) jround_up((long) cinfo->output_width,
- (long) cinfo->max_h_samp_factor),
- (JDIMENSION) cinfo->max_v_samp_factor);
- }
- }
-}
diff --git a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jdtrans.c b/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jdtrans.c
deleted file mode 100644
index 6c0ab715d32..00000000000
--- a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jdtrans.c
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * jdtrans.c
- *
- * Copyright (C) 1995-1997, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file contains library routines for transcoding decompression,
- * that is, reading raw DCT coefficient arrays from an input JPEG file.
- * The routines in jdapimin.c will also be needed by a transcoder.
- */
-
-#define JPEG_INTERNALS
-#include "jinclude.h"
-#include "jpeglib.h"
-
-
-/* Forward declarations */
-LOCAL(void) transdecode_master_selection JPP((j_decompress_ptr cinfo));
-
-
-/*
- * Read the coefficient arrays from a JPEG file.
- * jpeg_read_header must be completed before calling this.
- *
- * The entire image is read into a set of virtual coefficient-block arrays,
- * one per component. The return value is a pointer to the array of
- * virtual-array descriptors. These can be manipulated directly via the
- * JPEG memory manager, or handed off to jpeg_write_coefficients().
- * To release the memory occupied by the virtual arrays, call
- * jpeg_finish_decompress() when done with the data.
- *
- * An alternative usage is to simply obtain access to the coefficient arrays
- * during a buffered-image-mode decompression operation. This is allowed
- * after any jpeg_finish_output() call. The arrays can be accessed until
- * jpeg_finish_decompress() is called. (Note that any call to the library
- * may reposition the arrays, so don't rely on access_virt_barray() results
- * to stay valid across library calls.)
- *
- * Returns NULL if suspended. This case need be checked only if
- * a suspending data source is used.
- */
-
-GLOBAL(jvirt_barray_ptr *)
-jpeg_read_coefficients (j_decompress_ptr cinfo)
-{
- if (cinfo->global_state == DSTATE_READY) {
- /* First call: initialize active modules */
- transdecode_master_selection(cinfo);
- cinfo->global_state = DSTATE_RDCOEFS;
- }
- if (cinfo->global_state == DSTATE_RDCOEFS) {
- /* Absorb whole file into the coef buffer */
- for (;;) {
- int retcode;
- /* Call progress monitor hook if present */
- if (cinfo->progress != NULL)
- (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);
- /* Absorb some more input */
- retcode = (*cinfo->inputctl->consume_input) (cinfo);
- if (retcode == JPEG_SUSPENDED)
- return NULL;
- if (retcode == JPEG_REACHED_EOI)
- break;
- /* Advance progress counter if appropriate */
- if (cinfo->progress != NULL &&
- (retcode == JPEG_ROW_COMPLETED || retcode == JPEG_REACHED_SOS)) {
- if (++cinfo->progress->pass_counter >= cinfo->progress->pass_limit) {
- /* startup underestimated number of scans; ratchet up one scan */
- cinfo->progress->pass_limit += (long) cinfo->total_iMCU_rows;
- }
- }
- }
- /* Set state so that jpeg_finish_decompress does the right thing */
- cinfo->global_state = DSTATE_STOPPING;
- }
- /* At this point we should be in state DSTATE_STOPPING if being used
- * standalone, or in state DSTATE_BUFIMAGE if being invoked to get access
- * to the coefficients during a full buffered-image-mode decompression.
- */
- if ((cinfo->global_state == DSTATE_STOPPING ||
- cinfo->global_state == DSTATE_BUFIMAGE) && cinfo->buffered_image) {
- return cinfo->coef->coef_arrays;
- }
- /* Oops, improper usage */
- ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
- return NULL; /* keep compiler happy */
-}
-
-
-/*
- * Master selection of decompression modules for transcoding.
- * This substitutes for jdmaster.c's initialization of the full decompressor.
- */
-
-LOCAL(void)
-transdecode_master_selection (j_decompress_ptr cinfo)
-{
- /* This is effectively a buffered-image operation. */
- cinfo->buffered_image = TRUE;
-
- /* Entropy decoding: either Huffman or arithmetic coding. */
- if (cinfo->arith_code) {
- ERREXIT(cinfo, JERR_ARITH_NOTIMPL);
- } else {
- if (cinfo->progressive_mode) {
-#ifdef D_PROGRESSIVE_SUPPORTED
- jinit_phuff_decoder(cinfo);
-#else
- ERREXIT(cinfo, JERR_NOT_COMPILED);
-#endif
- } else
- jinit_huff_decoder(cinfo);
- }
-
- /* Always get a full-image coefficient buffer. */
- jinit_d_coef_controller(cinfo, TRUE);
-
- /* We can now tell the memory manager to allocate virtual arrays. */
- (*cinfo->mem->realize_virt_arrays) ((j_common_ptr) cinfo);
-
- /* Initialize input side of decompressor to consume first scan. */
- (*cinfo->inputctl->start_input_pass) (cinfo);
-
- /* Initialize progress monitoring. */
- if (cinfo->progress != NULL) {
- int nscans;
- /* Estimate number of scans to set pass_limit. */
- if (cinfo->progressive_mode) {
- /* Arbitrarily estimate 2 interleaved DC scans + 3 AC scans/component. */
- nscans = 2 + 3 * cinfo->num_components;
- } else if (cinfo->inputctl->has_multiple_scans) {
- /* For a nonprogressive multiscan file, estimate 1 scan per component. */
- nscans = cinfo->num_components;
- } else {
- nscans = 1;
- }
- cinfo->progress->pass_counter = 0L;
- cinfo->progress->pass_limit = (long) cinfo->total_iMCU_rows * nscans;
- cinfo->progress->completed_passes = 0;
- cinfo->progress->total_passes = 1;
- }
-}
diff --git a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jerror.c b/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jerror.c
deleted file mode 100644
index adfb9fe19db..00000000000
--- a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jerror.c
+++ /dev/null
@@ -1,239 +0,0 @@
-/*
- * jerror.c
- *
- * Copyright (C) 1991-1998, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file contains simple error-reporting and trace-message routines.
- * These are suitable for Unix-like systems and others where writing to
- * stderr is the right thing to do. Many applications will want to replace
- * some or all of these routines.
- *
- * These routines are used by both the compression and decompression code.
- */
-
-/* this is not a core library module, so it doesn't define JPEG_INTERNALS */
-#include "jinclude.h"
-#include "jpeglib.h"
-#include "jversion.h"
-#include "jerror.h"
-
-#ifndef EXIT_FAILURE /* define exit() codes if not provided */
-#define EXIT_FAILURE 1
-#endif
-
-
-/*
- * Create the message string table.
- * We do this from the master message list in jerror.h by re-reading
- * jerror.h with a suitable definition for macro JMESSAGE.
- * The message table is made an external symbol just in case any applications
- * want to refer to it directly.
- */
-
-#ifdef NEED_SHORT_EXTERNAL_NAMES
-#define jpeg_std_message_table jMsgTable
-#endif
-
-#define JMESSAGE(code,string) string ,
-
-const char * const jpeg_std_message_table[] = {
-#include "jerror.h"
- NULL
-};
-
-
-/*
- * Error exit handler: must not return to caller.
- *
- * Applications may override this if they want to get control back after
- * an error. Typically one would longjmp somewhere instead of exiting.
- * The setjmp buffer can be made a private field within an expanded error
- * handler object. Note that the info needed to generate an error message
- * is stored in the error object, so you can generate the message now or
- * later, at your convenience.
- * You should make sure that the JPEG object is cleaned up (with jpeg_abort
- * or jpeg_destroy) at some point.
- */
-
-METHODDEF(void)
-error_exit (j_common_ptr cinfo)
-{
- /* Always display the message */
- (*cinfo->err->output_message) (cinfo);
-
- /* Let the memory manager delete any temp files before we die */
- jpeg_destroy(cinfo);
-
-// exit(EXIT_FAILURE);
-}
-
-
-/*
- * Actual output of an error or trace message.
- * Applications may override this method to send JPEG messages somewhere
- * other than stderr.
- *
- * On Windows, printing to stderr is generally completely useless,
- * so we provide optional code to produce an error-dialog popup.
- * Most Windows applications will still prefer to override this routine,
- * but if they don't, it'll do something at least marginally useful.
- *
- * NOTE: to use the library in an environment that doesn't support the
- * C stdio library, you may have to delete the call to fprintf() entirely,
- * not just not use this routine.
- */
-
-METHODDEF(void)
-output_message (j_common_ptr cinfo)
-{
- char buffer[JMSG_LENGTH_MAX];
-
- /* Create the message */
- (*cinfo->err->format_message) (cinfo, buffer);
-
- /* Send it to stderr, adding a newline */
- FXSYS_fprintf(stderr, "%s\n", buffer);
-}
-
-
-/*
- * Decide whether to emit a trace or warning message.
- * msg_level is one of:
- * -1: recoverable corrupt-data warning, may want to abort.
- * 0: important advisory messages (always display to user).
- * 1: first level of tracing detail.
- * 2,3,...: successively more detailed tracing messages.
- * An application might override this method if it wanted to abort on warnings
- * or change the policy about which messages to display.
- */
-
-METHODDEF(void)
-emit_message (j_common_ptr cinfo, int msg_level)
-{
- struct jpeg_error_mgr * err = cinfo->err;
-
- if (msg_level < 0) {
- /* It's a warning message. Since corrupt files may generate many warnings,
- * the policy implemented here is to show only the first warning,
- * unless trace_level >= 3.
- */
- if (err->num_warnings == 0 || err->trace_level >= 3)
- (*err->output_message) (cinfo);
- /* Always count warnings in num_warnings. */
- err->num_warnings++;
- } else {
- /* It's a trace message. Show it if trace_level >= msg_level. */
- if (err->trace_level >= msg_level)
- (*err->output_message) (cinfo);
- }
-}
-
-
-/*
- * Format a message string for the most recent JPEG error or message.
- * The message is stored into buffer, which should be at least JMSG_LENGTH_MAX
- * characters. Note that no '\n' character is added to the string.
- * Few applications should need to override this method.
- */
-
-METHODDEF(void)
-format_message (j_common_ptr cinfo, char * buffer)
-{
-#if 0 /* XYQ */
- struct jpeg_error_mgr * err = cinfo->err;
- int msg_code = err->msg_code;
- const char * msgtext = NULL;
- const char * msgptr;
- char ch;
- boolean isstring;
-
- /* Look up message string in proper table */
- if (msg_code > 0 && msg_code <= err->last_jpeg_message) {
- msgtext = err->jpeg_message_table[msg_code];
- } else if (err->addon_message_table != NULL &&
- msg_code >= err->first_addon_message &&
- msg_code <= err->last_addon_message) {
- msgtext = err->addon_message_table[msg_code - err->first_addon_message];
- }
-
- /* Defend against bogus message number */
- if (msgtext == NULL) {
- err->msg_parm.i[0] = msg_code;
- msgtext = err->jpeg_message_table[0];
- }
-
- /* Check for string parameter, as indicated by %s in the message text */
- isstring = FALSE;
- msgptr = msgtext;
- while ((ch = *msgptr++) != '\0') {
- if (ch == '%') {
- if (*msgptr == 's') isstring = TRUE;
- break;
- }
- }
-
- /* Format the message into the passed buffer */
- if (isstring)
- sprintf(buffer, msgtext, err->msg_parm.s);
- else
- sprintf(buffer, msgtext,
- err->msg_parm.i[0], err->msg_parm.i[1],
- err->msg_parm.i[2], err->msg_parm.i[3],
- err->msg_parm.i[4], err->msg_parm.i[5],
- err->msg_parm.i[6], err->msg_parm.i[7]);
-#endif
-}
-
-
-/*
- * Reset error state variables at start of a new image.
- * This is called during compression startup to reset trace/error
- * processing to default state, without losing any application-specific
- * method pointers. An application might possibly want to override
- * this method if it has additional error processing state.
- */
-
-METHODDEF(void)
-reset_error_mgr (j_common_ptr cinfo)
-{
- cinfo->err->num_warnings = 0;
- /* trace_level is not reset since it is an application-supplied parameter */
- cinfo->err->msg_code = 0; /* may be useful as a flag for "no error" */
-}
-
-
-/*
- * Fill in the standard error-handling methods in a jpeg_error_mgr object.
- * Typical call is:
- * struct jpeg_compress_struct cinfo;
- * struct jpeg_error_mgr err;
- *
- * cinfo.err = jpeg_std_error(&err);
- * after which the application may override some of the methods.
- */
-
-GLOBAL(struct jpeg_error_mgr *)
-jpeg_std_error (struct jpeg_error_mgr * err)
-{
- err->error_exit = error_exit;
- err->emit_message = emit_message;
- err->output_message = output_message;
- err->format_message = format_message;
- err->reset_error_mgr = reset_error_mgr;
-
- err->trace_level = 0; /* default = no tracing */
- err->num_warnings = 0; /* no warnings emitted yet */
- err->msg_code = 0; /* may be useful as a flag for "no error" */
-
- /* Initialize message table pointers */
- err->jpeg_message_table = jpeg_std_message_table;
- err->last_jpeg_message = (int) JMSG_LASTMSGCODE - 1;
-
- err->addon_message_table = NULL;
- err->first_addon_message = 0; /* for safety */
- err->last_addon_message = 0;
-
- return err;
-}
diff --git a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jfdctfst.c b/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jfdctfst.c
deleted file mode 100644
index ccb378a3b45..00000000000
--- a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jfdctfst.c
+++ /dev/null
@@ -1,224 +0,0 @@
-/*
- * jfdctfst.c
- *
- * Copyright (C) 1994-1996, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file contains a fast, not so accurate integer implementation of the
- * forward DCT (Discrete Cosine Transform).
- *
- * A 2-D DCT can be done by 1-D DCT on each row followed by 1-D DCT
- * on each column. Direct algorithms are also available, but they are
- * much more complex and seem not to be any faster when reduced to code.
- *
- * This implementation is based on Arai, Agui, and Nakajima's algorithm for
- * scaled DCT. Their original paper (Trans. IEICE E-71(11):1095) is in
- * Japanese, but the algorithm is described in the Pennebaker & Mitchell
- * JPEG textbook (see REFERENCES section in file README). The following code
- * is based directly on figure 4-8 in P&M.
- * While an 8-point DCT cannot be done in less than 11 multiplies, it is
- * possible to arrange the computation so that many of the multiplies are
- * simple scalings of the final outputs. These multiplies can then be
- * folded into the multiplications or divisions by the JPEG quantization
- * table entries. The AA&N method leaves only 5 multiplies and 29 adds
- * to be done in the DCT itself.
- * The primary disadvantage of this method is that with fixed-point math,
- * accuracy is lost due to imprecise representation of the scaled
- * quantization values. The smaller the quantization table entry, the less
- * precise the scaled value, so this implementation does worse with high-
- * quality-setting files than with low-quality ones.
- */
-
-#define JPEG_INTERNALS
-#include "jinclude.h"
-#include "jpeglib.h"
-#include "jdct.h" /* Private declarations for DCT subsystem */
-
-#ifdef DCT_IFAST_SUPPORTED
-
-
-/*
- * This module is specialized to the case DCTSIZE = 8.
- */
-
-#if DCTSIZE != 8
- Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */
-#endif
-
-
-/* Scaling decisions are generally the same as in the LL&M algorithm;
- * see jfdctint.c for more details. However, we choose to descale
- * (right shift) multiplication products as soon as they are formed,
- * rather than carrying additional fractional bits into subsequent additions.
- * This compromises accuracy slightly, but it lets us save a few shifts.
- * More importantly, 16-bit arithmetic is then adequate (for 8-bit samples)
- * everywhere except in the multiplications proper; this saves a good deal
- * of work on 16-bit-int machines.
- *
- * Again to save a few shifts, the intermediate results between pass 1 and
- * pass 2 are not upscaled, but are represented only to integral precision.
- *
- * A final compromise is to represent the multiplicative constants to only
- * 8 fractional bits, rather than 13. This saves some shifting work on some
- * machines, and may also reduce the cost of multiplication (since there
- * are fewer one-bits in the constants).
- */
-
-#define CONST_BITS 8
-
-
-/* Some C compilers fail to reduce "FIX(constant)" at compile time, thus
- * causing a lot of useless floating-point operations at run time.
- * To get around this we use the following pre-calculated constants.
- * If you change CONST_BITS you may want to add appropriate values.
- * (With a reasonable C compiler, you can just rely on the FIX() macro...)
- */
-
-#if CONST_BITS == 8
-#define FIX_0_382683433 ((INT32) 98) /* FIX(0.382683433) */
-#define FIX_0_541196100 ((INT32) 139) /* FIX(0.541196100) */
-#define FIX_0_707106781 ((INT32) 181) /* FIX(0.707106781) */
-#define FIX_1_306562965 ((INT32) 334) /* FIX(1.306562965) */
-#else
-#define FIX_0_382683433 FIX(0.382683433)
-#define FIX_0_541196100 FIX(0.541196100)
-#define FIX_0_707106781 FIX(0.707106781)
-#define FIX_1_306562965 FIX(1.306562965)
-#endif
-
-
-/* We can gain a little more speed, with a further compromise in accuracy,
- * by omitting the addition in a descaling shift. This yields an incorrectly
- * rounded result half the time...
- */
-
-#ifndef USE_ACCURATE_ROUNDING
-#undef DESCALE
-#define DESCALE(x,n) RIGHT_SHIFT(x, n)
-#endif
-
-
-/* Multiply a DCTELEM variable by an INT32 constant, and immediately
- * descale to yield a DCTELEM result.
- */
-
-#define MULTIPLY(var,const) ((DCTELEM) DESCALE((var) * (const), CONST_BITS))
-
-
-/*
- * Perform the forward DCT on one block of samples.
- */
-
-GLOBAL(void)
-jpeg_fdct_ifast (DCTELEM * data)
-{
- DCTELEM tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
- DCTELEM tmp10, tmp11, tmp12, tmp13;
- DCTELEM z1, z2, z3, z4, z5, z11, z13;
- DCTELEM *dataptr;
- int ctr;
- SHIFT_TEMPS
-
- /* Pass 1: process rows. */
-
- dataptr = data;
- for (ctr = DCTSIZE-1; ctr >= 0; ctr--) {
- tmp0 = dataptr[0] + dataptr[7];
- tmp7 = dataptr[0] - dataptr[7];
- tmp1 = dataptr[1] + dataptr[6];
- tmp6 = dataptr[1] - dataptr[6];
- tmp2 = dataptr[2] + dataptr[5];
- tmp5 = dataptr[2] - dataptr[5];
- tmp3 = dataptr[3] + dataptr[4];
- tmp4 = dataptr[3] - dataptr[4];
-
- /* Even part */
-
- tmp10 = tmp0 + tmp3; /* phase 2 */
- tmp13 = tmp0 - tmp3;
- tmp11 = tmp1 + tmp2;
- tmp12 = tmp1 - tmp2;
-
- dataptr[0] = tmp10 + tmp11; /* phase 3 */
- dataptr[4] = tmp10 - tmp11;
-
- z1 = MULTIPLY(tmp12 + tmp13, FIX_0_707106781); /* c4 */
- dataptr[2] = tmp13 + z1; /* phase 5 */
- dataptr[6] = tmp13 - z1;
-
- /* Odd part */
-
- tmp10 = tmp4 + tmp5; /* phase 2 */
- tmp11 = tmp5 + tmp6;
- tmp12 = tmp6 + tmp7;
-
- /* The rotator is modified from fig 4-8 to avoid extra negations. */
- z5 = MULTIPLY(tmp10 - tmp12, FIX_0_382683433); /* c6 */
- z2 = MULTIPLY(tmp10, FIX_0_541196100) + z5; /* c2-c6 */
- z4 = MULTIPLY(tmp12, FIX_1_306562965) + z5; /* c2+c6 */
- z3 = MULTIPLY(tmp11, FIX_0_707106781); /* c4 */
-
- z11 = tmp7 + z3; /* phase 5 */
- z13 = tmp7 - z3;
-
- dataptr[5] = z13 + z2; /* phase 6 */
- dataptr[3] = z13 - z2;
- dataptr[1] = z11 + z4;
- dataptr[7] = z11 - z4;
-
- dataptr += DCTSIZE; /* advance pointer to next row */
- }
-
- /* Pass 2: process columns. */
-
- dataptr = data;
- for (ctr = DCTSIZE-1; ctr >= 0; ctr--) {
- tmp0 = dataptr[DCTSIZE*0] + dataptr[DCTSIZE*7];
- tmp7 = dataptr[DCTSIZE*0] - dataptr[DCTSIZE*7];
- tmp1 = dataptr[DCTSIZE*1] + dataptr[DCTSIZE*6];
- tmp6 = dataptr[DCTSIZE*1] - dataptr[DCTSIZE*6];
- tmp2 = dataptr[DCTSIZE*2] + dataptr[DCTSIZE*5];
- tmp5 = dataptr[DCTSIZE*2] - dataptr[DCTSIZE*5];
- tmp3 = dataptr[DCTSIZE*3] + dataptr[DCTSIZE*4];
- tmp4 = dataptr[DCTSIZE*3] - dataptr[DCTSIZE*4];
-
- /* Even part */
-
- tmp10 = tmp0 + tmp3; /* phase 2 */
- tmp13 = tmp0 - tmp3;
- tmp11 = tmp1 + tmp2;
- tmp12 = tmp1 - tmp2;
-
- dataptr[DCTSIZE*0] = tmp10 + tmp11; /* phase 3 */
- dataptr[DCTSIZE*4] = tmp10 - tmp11;
-
- z1 = MULTIPLY(tmp12 + tmp13, FIX_0_707106781); /* c4 */
- dataptr[DCTSIZE*2] = tmp13 + z1; /* phase 5 */
- dataptr[DCTSIZE*6] = tmp13 - z1;
-
- /* Odd part */
-
- tmp10 = tmp4 + tmp5; /* phase 2 */
- tmp11 = tmp5 + tmp6;
- tmp12 = tmp6 + tmp7;
-
- /* The rotator is modified from fig 4-8 to avoid extra negations. */
- z5 = MULTIPLY(tmp10 - tmp12, FIX_0_382683433); /* c6 */
- z2 = MULTIPLY(tmp10, FIX_0_541196100) + z5; /* c2-c6 */
- z4 = MULTIPLY(tmp12, FIX_1_306562965) + z5; /* c2+c6 */
- z3 = MULTIPLY(tmp11, FIX_0_707106781); /* c4 */
-
- z11 = tmp7 + z3; /* phase 5 */
- z13 = tmp7 - z3;
-
- dataptr[DCTSIZE*5] = z13 + z2; /* phase 6 */
- dataptr[DCTSIZE*3] = z13 - z2;
- dataptr[DCTSIZE*1] = z11 + z4;
- dataptr[DCTSIZE*7] = z11 - z4;
-
- dataptr++; /* advance pointer to next column */
- }
-}
-
-#endif /* DCT_IFAST_SUPPORTED */
diff --git a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jfdctint.c b/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jfdctint.c
deleted file mode 100644
index 0a78b64aee8..00000000000
--- a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jfdctint.c
+++ /dev/null
@@ -1,283 +0,0 @@
-/*
- * jfdctint.c
- *
- * Copyright (C) 1991-1996, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file contains a slow-but-accurate integer implementation of the
- * forward DCT (Discrete Cosine Transform).
- *
- * A 2-D DCT can be done by 1-D DCT on each row followed by 1-D DCT
- * on each column. Direct algorithms are also available, but they are
- * much more complex and seem not to be any faster when reduced to code.
- *
- * This implementation is based on an algorithm described in
- * C. Loeffler, A. Ligtenberg and G. Moschytz, "Practical Fast 1-D DCT
- * Algorithms with 11 Multiplications", Proc. Int'l. Conf. on Acoustics,
- * Speech, and Signal Processing 1989 (ICASSP '89), pp. 988-991.
- * The primary algorithm described there uses 11 multiplies and 29 adds.
- * We use their alternate method with 12 multiplies and 32 adds.
- * The advantage of this method is that no data path contains more than one
- * multiplication; this allows a very simple and accurate implementation in
- * scaled fixed-point arithmetic, with a minimal number of shifts.
- */
-
-#define JPEG_INTERNALS
-#include "jinclude.h"
-#include "jpeglib.h"
-#include "jdct.h" /* Private declarations for DCT subsystem */
-
-#ifdef DCT_ISLOW_SUPPORTED
-
-
-/*
- * This module is specialized to the case DCTSIZE = 8.
- */
-
-#if DCTSIZE != 8
- Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */
-#endif
-
-
-/*
- * The poop on this scaling stuff is as follows:
- *
- * Each 1-D DCT step produces outputs which are a factor of sqrt(N)
- * larger than the true DCT outputs. The final outputs are therefore
- * a factor of N larger than desired; since N=8 this can be cured by
- * a simple right shift at the end of the algorithm. The advantage of
- * this arrangement is that we save two multiplications per 1-D DCT,
- * because the y0 and y4 outputs need not be divided by sqrt(N).
- * In the IJG code, this factor of 8 is removed by the quantization step
- * (in jcdctmgr.c), NOT in this module.
- *
- * We have to do addition and subtraction of the integer inputs, which
- * is no problem, and multiplication by fractional constants, which is
- * a problem to do in integer arithmetic. We multiply all the constants
- * by CONST_SCALE and convert them to integer constants (thus retaining
- * CONST_BITS bits of precision in the constants). After doing a
- * multiplication we have to divide the product by CONST_SCALE, with proper
- * rounding, to produce the correct output. This division can be done
- * cheaply as a right shift of CONST_BITS bits. We postpone shifting
- * as long as possible so that partial sums can be added together with
- * full fractional precision.
- *
- * The outputs of the first pass are scaled up by PASS1_BITS bits so that
- * they are represented to better-than-integral precision. These outputs
- * require BITS_IN_JSAMPLE + PASS1_BITS + 3 bits; this fits in a 16-bit word
- * with the recommended scaling. (For 12-bit sample data, the intermediate
- * array is INT32 anyway.)
- *
- * To avoid overflow of the 32-bit intermediate results in pass 2, we must
- * have BITS_IN_JSAMPLE + CONST_BITS + PASS1_BITS <= 26. Error analysis
- * shows that the values given below are the most effective.
- */
-
-#if BITS_IN_JSAMPLE == 8
-#define CONST_BITS 13
-#define PASS1_BITS 2
-#else
-#define CONST_BITS 13
-#define PASS1_BITS 1 /* lose a little precision to avoid overflow */
-#endif
-
-/* Some C compilers fail to reduce "FIX(constant)" at compile time, thus
- * causing a lot of useless floating-point operations at run time.
- * To get around this we use the following pre-calculated constants.
- * If you change CONST_BITS you may want to add appropriate values.
- * (With a reasonable C compiler, you can just rely on the FIX() macro...)
- */
-
-#if CONST_BITS == 13
-#define FIX_0_298631336 ((INT32) 2446) /* FIX(0.298631336) */
-#define FIX_0_390180644 ((INT32) 3196) /* FIX(0.390180644) */
-#define FIX_0_541196100 ((INT32) 4433) /* FIX(0.541196100) */
-#define FIX_0_765366865 ((INT32) 6270) /* FIX(0.765366865) */
-#define FIX_0_899976223 ((INT32) 7373) /* FIX(0.899976223) */
-#define FIX_1_175875602 ((INT32) 9633) /* FIX(1.175875602) */
-#define FIX_1_501321110 ((INT32) 12299) /* FIX(1.501321110) */
-#define FIX_1_847759065 ((INT32) 15137) /* FIX(1.847759065) */
-#define FIX_1_961570560 ((INT32) 16069) /* FIX(1.961570560) */
-#define FIX_2_053119869 ((INT32) 16819) /* FIX(2.053119869) */
-#define FIX_2_562915447 ((INT32) 20995) /* FIX(2.562915447) */
-#define FIX_3_072711026 ((INT32) 25172) /* FIX(3.072711026) */
-#else
-#define FIX_0_298631336 FIX(0.298631336)
-#define FIX_0_390180644 FIX(0.390180644)
-#define FIX_0_541196100 FIX(0.541196100)
-#define FIX_0_765366865 FIX(0.765366865)
-#define FIX_0_899976223 FIX(0.899976223)
-#define FIX_1_175875602 FIX(1.175875602)
-#define FIX_1_501321110 FIX(1.501321110)
-#define FIX_1_847759065 FIX(1.847759065)
-#define FIX_1_961570560 FIX(1.961570560)
-#define FIX_2_053119869 FIX(2.053119869)
-#define FIX_2_562915447 FIX(2.562915447)
-#define FIX_3_072711026 FIX(3.072711026)
-#endif
-
-
-/* Multiply an INT32 variable by an INT32 constant to yield an INT32 result.
- * For 8-bit samples with the recommended scaling, all the variable
- * and constant values involved are no more than 16 bits wide, so a
- * 16x16->32 bit multiply can be used instead of a full 32x32 multiply.
- * For 12-bit samples, a full 32-bit multiplication will be needed.
- */
-
-#if BITS_IN_JSAMPLE == 8
-#define MULTIPLY(var,const) MULTIPLY16C16(var,const)
-#else
-#define MULTIPLY(var,const) ((var) * (const))
-#endif
-
-
-/*
- * Perform the forward DCT on one block of samples.
- */
-
-GLOBAL(void)
-jpeg_fdct_islow (DCTELEM * data)
-{
- INT32 tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
- INT32 tmp10, tmp11, tmp12, tmp13;
- INT32 z1, z2, z3, z4, z5;
- DCTELEM *dataptr;
- int ctr;
- SHIFT_TEMPS
-
- /* Pass 1: process rows. */
- /* Note results are scaled up by sqrt(8) compared to a true DCT; */
- /* furthermore, we scale the results by 2**PASS1_BITS. */
-
- dataptr = data;
- for (ctr = DCTSIZE-1; ctr >= 0; ctr--) {
- tmp0 = dataptr[0] + dataptr[7];
- tmp7 = dataptr[0] - dataptr[7];
- tmp1 = dataptr[1] + dataptr[6];
- tmp6 = dataptr[1] - dataptr[6];
- tmp2 = dataptr[2] + dataptr[5];
- tmp5 = dataptr[2] - dataptr[5];
- tmp3 = dataptr[3] + dataptr[4];
- tmp4 = dataptr[3] - dataptr[4];
-
- /* Even part per LL&M figure 1 --- note that published figure is faulty;
- * rotator "sqrt(2)*c1" should be "sqrt(2)*c6".
- */
-
- tmp10 = tmp0 + tmp3;
- tmp13 = tmp0 - tmp3;
- tmp11 = tmp1 + tmp2;
- tmp12 = tmp1 - tmp2;
-
- dataptr[0] = (DCTELEM) ((tmp10 + tmp11) << PASS1_BITS);
- dataptr[4] = (DCTELEM) ((tmp10 - tmp11) << PASS1_BITS);
-
- z1 = MULTIPLY(tmp12 + tmp13, FIX_0_541196100);
- dataptr[2] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp13, FIX_0_765366865),
- CONST_BITS-PASS1_BITS);
- dataptr[6] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp12, - FIX_1_847759065),
- CONST_BITS-PASS1_BITS);
-
- /* Odd part per figure 8 --- note paper omits factor of sqrt(2).
- * cK represents cos(K*pi/16).
- * i0..i3 in the paper are tmp4..tmp7 here.
- */
-
- z1 = tmp4 + tmp7;
- z2 = tmp5 + tmp6;
- z3 = tmp4 + tmp6;
- z4 = tmp5 + tmp7;
- z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */
-
- tmp4 = MULTIPLY(tmp4, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */
- tmp5 = MULTIPLY(tmp5, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */
- tmp6 = MULTIPLY(tmp6, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */
- tmp7 = MULTIPLY(tmp7, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */
- z1 = MULTIPLY(z1, - FIX_0_899976223); /* sqrt(2) * (c7-c3) */
- z2 = MULTIPLY(z2, - FIX_2_562915447); /* sqrt(2) * (-c1-c3) */
- z3 = MULTIPLY(z3, - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */
- z4 = MULTIPLY(z4, - FIX_0_390180644); /* sqrt(2) * (c5-c3) */
-
- z3 += z5;
- z4 += z5;
-
- dataptr[7] = (DCTELEM) DESCALE(tmp4 + z1 + z3, CONST_BITS-PASS1_BITS);
- dataptr[5] = (DCTELEM) DESCALE(tmp5 + z2 + z4, CONST_BITS-PASS1_BITS);
- dataptr[3] = (DCTELEM) DESCALE(tmp6 + z2 + z3, CONST_BITS-PASS1_BITS);
- dataptr[1] = (DCTELEM) DESCALE(tmp7 + z1 + z4, CONST_BITS-PASS1_BITS);
-
- dataptr += DCTSIZE; /* advance pointer to next row */
- }
-
- /* Pass 2: process columns.
- * We remove the PASS1_BITS scaling, but leave the results scaled up
- * by an overall factor of 8.
- */
-
- dataptr = data;
- for (ctr = DCTSIZE-1; ctr >= 0; ctr--) {
- tmp0 = dataptr[DCTSIZE*0] + dataptr[DCTSIZE*7];
- tmp7 = dataptr[DCTSIZE*0] - dataptr[DCTSIZE*7];
- tmp1 = dataptr[DCTSIZE*1] + dataptr[DCTSIZE*6];
- tmp6 = dataptr[DCTSIZE*1] - dataptr[DCTSIZE*6];
- tmp2 = dataptr[DCTSIZE*2] + dataptr[DCTSIZE*5];
- tmp5 = dataptr[DCTSIZE*2] - dataptr[DCTSIZE*5];
- tmp3 = dataptr[DCTSIZE*3] + dataptr[DCTSIZE*4];
- tmp4 = dataptr[DCTSIZE*3] - dataptr[DCTSIZE*4];
-
- /* Even part per LL&M figure 1 --- note that published figure is faulty;
- * rotator "sqrt(2)*c1" should be "sqrt(2)*c6".
- */
-
- tmp10 = tmp0 + tmp3;
- tmp13 = tmp0 - tmp3;
- tmp11 = tmp1 + tmp2;
- tmp12 = tmp1 - tmp2;
-
- dataptr[DCTSIZE*0] = (DCTELEM) DESCALE(tmp10 + tmp11, PASS1_BITS);
- dataptr[DCTSIZE*4] = (DCTELEM) DESCALE(tmp10 - tmp11, PASS1_BITS);
-
- z1 = MULTIPLY(tmp12 + tmp13, FIX_0_541196100);
- dataptr[DCTSIZE*2] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp13, FIX_0_765366865),
- CONST_BITS+PASS1_BITS);
- dataptr[DCTSIZE*6] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp12, - FIX_1_847759065),
- CONST_BITS+PASS1_BITS);
-
- /* Odd part per figure 8 --- note paper omits factor of sqrt(2).
- * cK represents cos(K*pi/16).
- * i0..i3 in the paper are tmp4..tmp7 here.
- */
-
- z1 = tmp4 + tmp7;
- z2 = tmp5 + tmp6;
- z3 = tmp4 + tmp6;
- z4 = tmp5 + tmp7;
- z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */
-
- tmp4 = MULTIPLY(tmp4, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */
- tmp5 = MULTIPLY(tmp5, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */
- tmp6 = MULTIPLY(tmp6, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */
- tmp7 = MULTIPLY(tmp7, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */
- z1 = MULTIPLY(z1, - FIX_0_899976223); /* sqrt(2) * (c7-c3) */
- z2 = MULTIPLY(z2, - FIX_2_562915447); /* sqrt(2) * (-c1-c3) */
- z3 = MULTIPLY(z3, - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */
- z4 = MULTIPLY(z4, - FIX_0_390180644); /* sqrt(2) * (c5-c3) */
-
- z3 += z5;
- z4 += z5;
-
- dataptr[DCTSIZE*7] = (DCTELEM) DESCALE(tmp4 + z1 + z3,
- CONST_BITS+PASS1_BITS);
- dataptr[DCTSIZE*5] = (DCTELEM) DESCALE(tmp5 + z2 + z4,
- CONST_BITS+PASS1_BITS);
- dataptr[DCTSIZE*3] = (DCTELEM) DESCALE(tmp6 + z2 + z3,
- CONST_BITS+PASS1_BITS);
- dataptr[DCTSIZE*1] = (DCTELEM) DESCALE(tmp7 + z1 + z4,
- CONST_BITS+PASS1_BITS);
-
- dataptr++; /* advance pointer to next column */
- }
-}
-
-#endif /* DCT_ISLOW_SUPPORTED */
diff --git a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jidctfst.c b/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jidctfst.c
deleted file mode 100644
index dba4216fb95..00000000000
--- a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jidctfst.c
+++ /dev/null
@@ -1,368 +0,0 @@
-/*
- * jidctfst.c
- *
- * Copyright (C) 1994-1998, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file contains a fast, not so accurate integer implementation of the
- * inverse DCT (Discrete Cosine Transform). In the IJG code, this routine
- * must also perform dequantization of the input coefficients.
- *
- * A 2-D IDCT can be done by 1-D IDCT on each column followed by 1-D IDCT
- * on each row (or vice versa, but it's more convenient to emit a row at
- * a time). Direct algorithms are also available, but they are much more
- * complex and seem not to be any faster when reduced to code.
- *
- * This implementation is based on Arai, Agui, and Nakajima's algorithm for
- * scaled DCT. Their original paper (Trans. IEICE E-71(11):1095) is in
- * Japanese, but the algorithm is described in the Pennebaker & Mitchell
- * JPEG textbook (see REFERENCES section in file README). The following code
- * is based directly on figure 4-8 in P&M.
- * While an 8-point DCT cannot be done in less than 11 multiplies, it is
- * possible to arrange the computation so that many of the multiplies are
- * simple scalings of the final outputs. These multiplies can then be
- * folded into the multiplications or divisions by the JPEG quantization
- * table entries. The AA&N method leaves only 5 multiplies and 29 adds
- * to be done in the DCT itself.
- * The primary disadvantage of this method is that with fixed-point math,
- * accuracy is lost due to imprecise representation of the scaled
- * quantization values. The smaller the quantization table entry, the less
- * precise the scaled value, so this implementation does worse with high-
- * quality-setting files than with low-quality ones.
- */
-
-#define JPEG_INTERNALS
-#include "jinclude.h"
-#include "jpeglib.h"
-#include "jdct.h" /* Private declarations for DCT subsystem */
-
-#ifdef DCT_IFAST_SUPPORTED
-
-
-/*
- * This module is specialized to the case DCTSIZE = 8.
- */
-
-#if DCTSIZE != 8
- Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */
-#endif
-
-
-/* Scaling decisions are generally the same as in the LL&M algorithm;
- * see jidctint.c for more details. However, we choose to descale
- * (right shift) multiplication products as soon as they are formed,
- * rather than carrying additional fractional bits into subsequent additions.
- * This compromises accuracy slightly, but it lets us save a few shifts.
- * More importantly, 16-bit arithmetic is then adequate (for 8-bit samples)
- * everywhere except in the multiplications proper; this saves a good deal
- * of work on 16-bit-int machines.
- *
- * The dequantized coefficients are not integers because the AA&N scaling
- * factors have been incorporated. We represent them scaled up by PASS1_BITS,
- * so that the first and second IDCT rounds have the same input scaling.
- * For 8-bit JSAMPLEs, we choose IFAST_SCALE_BITS = PASS1_BITS so as to
- * avoid a descaling shift; this compromises accuracy rather drastically
- * for small quantization table entries, but it saves a lot of shifts.
- * For 12-bit JSAMPLEs, there's no hope of using 16x16 multiplies anyway,
- * so we use a much larger scaling factor to preserve accuracy.
- *
- * A final compromise is to represent the multiplicative constants to only
- * 8 fractional bits, rather than 13. This saves some shifting work on some
- * machines, and may also reduce the cost of multiplication (since there
- * are fewer one-bits in the constants).
- */
-
-#if BITS_IN_JSAMPLE == 8
-#define CONST_BITS 8
-#define PASS1_BITS 2
-#else
-#define CONST_BITS 8
-#define PASS1_BITS 1 /* lose a little precision to avoid overflow */
-#endif
-
-/* Some C compilers fail to reduce "FIX(constant)" at compile time, thus
- * causing a lot of useless floating-point operations at run time.
- * To get around this we use the following pre-calculated constants.
- * If you change CONST_BITS you may want to add appropriate values.
- * (With a reasonable C compiler, you can just rely on the FIX() macro...)
- */
-
-#if CONST_BITS == 8
-#define FIX_1_082392200 ((INT32) 277) /* FIX(1.082392200) */
-#define FIX_1_414213562 ((INT32) 362) /* FIX(1.414213562) */
-#define FIX_1_847759065 ((INT32) 473) /* FIX(1.847759065) */
-#define FIX_2_613125930 ((INT32) 669) /* FIX(2.613125930) */
-#else
-#define FIX_1_082392200 FIX(1.082392200)
-#define FIX_1_414213562 FIX(1.414213562)
-#define FIX_1_847759065 FIX(1.847759065)
-#define FIX_2_613125930 FIX(2.613125930)
-#endif
-
-
-/* We can gain a little more speed, with a further compromise in accuracy,
- * by omitting the addition in a descaling shift. This yields an incorrectly
- * rounded result half the time...
- */
-
-#ifndef USE_ACCURATE_ROUNDING
-#undef DESCALE
-#define DESCALE(x,n) RIGHT_SHIFT(x, n)
-#endif
-
-
-/* Multiply a DCTELEM variable by an INT32 constant, and immediately
- * descale to yield a DCTELEM result.
- */
-
-#define MULTIPLY(var,const) ((DCTELEM) DESCALE((var) * (const), CONST_BITS))
-
-
-/* Dequantize a coefficient by multiplying it by the multiplier-table
- * entry; produce a DCTELEM result. For 8-bit data a 16x16->16
- * multiplication will do. For 12-bit data, the multiplier table is
- * declared INT32, so a 32-bit multiply will be used.
- */
-
-#if BITS_IN_JSAMPLE == 8
-#define DEQUANTIZE(coef,quantval) (((IFAST_MULT_TYPE) (coef)) * (quantval))
-#else
-#define DEQUANTIZE(coef,quantval) \
- DESCALE((coef)*(quantval), IFAST_SCALE_BITS-PASS1_BITS)
-#endif
-
-
-/* Like DESCALE, but applies to a DCTELEM and produces an int.
- * We assume that int right shift is unsigned if INT32 right shift is.
- */
-
-#ifdef RIGHT_SHIFT_IS_UNSIGNED
-#define ISHIFT_TEMPS DCTELEM ishift_temp;
-#if BITS_IN_JSAMPLE == 8
-#define DCTELEMBITS 16 /* DCTELEM may be 16 or 32 bits */
-#else
-#define DCTELEMBITS 32 /* DCTELEM must be 32 bits */
-#endif
-#define IRIGHT_SHIFT(x,shft) \
- ((ishift_temp = (x)) < 0 ? \
- (ishift_temp >> (shft)) | ((~((DCTELEM) 0)) << (DCTELEMBITS-(shft))) : \
- (ishift_temp >> (shft)))
-#else
-#define ISHIFT_TEMPS
-#define IRIGHT_SHIFT(x,shft) ((x) >> (shft))
-#endif
-
-#ifdef USE_ACCURATE_ROUNDING
-#define IDESCALE(x,n) ((int) IRIGHT_SHIFT((x) + (1 << ((n)-1)), n))
-#else
-#define IDESCALE(x,n) ((int) IRIGHT_SHIFT(x, n))
-#endif
-
-
-/*
- * Perform dequantization and inverse DCT on one block of coefficients.
- */
-
-GLOBAL(void)
-jpeg_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr,
- JCOEFPTR coef_block,
- JSAMPARRAY output_buf, JDIMENSION output_col)
-{
- DCTELEM tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
- DCTELEM tmp10, tmp11, tmp12, tmp13;
- DCTELEM z5, z10, z11, z12, z13;
- JCOEFPTR inptr;
- IFAST_MULT_TYPE * quantptr;
- int * wsptr;
- JSAMPROW outptr;
- JSAMPLE *range_limit = IDCT_range_limit(cinfo);
- int ctr;
- int workspace[DCTSIZE2]; /* buffers data between passes */
- SHIFT_TEMPS /* for DESCALE */
- ISHIFT_TEMPS /* for IDESCALE */
-
- /* Pass 1: process columns from input, store into work array. */
-
- inptr = coef_block;
- quantptr = (IFAST_MULT_TYPE *) compptr->dct_table;
- wsptr = workspace;
- for (ctr = DCTSIZE; ctr > 0; ctr--) {
- /* Due to quantization, we will usually find that many of the input
- * coefficients are zero, especially the AC terms. We can exploit this
- * by short-circuiting the IDCT calculation for any column in which all
- * the AC terms are zero. In that case each output is equal to the
- * DC coefficient (with scale factor as needed).
- * With typical images and quantization tables, half or more of the
- * column DCT calculations can be simplified this way.
- */
-
- if (inptr[DCTSIZE*1] == 0 && inptr[DCTSIZE*2] == 0 &&
- inptr[DCTSIZE*3] == 0 && inptr[DCTSIZE*4] == 0 &&
- inptr[DCTSIZE*5] == 0 && inptr[DCTSIZE*6] == 0 &&
- inptr[DCTSIZE*7] == 0) {
- /* AC terms all zero */
- int dcval = (int) DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
-
- wsptr[DCTSIZE*0] = dcval;
- wsptr[DCTSIZE*1] = dcval;
- wsptr[DCTSIZE*2] = dcval;
- wsptr[DCTSIZE*3] = dcval;
- wsptr[DCTSIZE*4] = dcval;
- wsptr[DCTSIZE*5] = dcval;
- wsptr[DCTSIZE*6] = dcval;
- wsptr[DCTSIZE*7] = dcval;
-
- inptr++; /* advance pointers to next column */
- quantptr++;
- wsptr++;
- continue;
- }
-
- /* Even part */
-
- tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
- tmp1 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]);
- tmp2 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]);
- tmp3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]);
-
- tmp10 = tmp0 + tmp2; /* phase 3 */
- tmp11 = tmp0 - tmp2;
-
- tmp13 = tmp1 + tmp3; /* phases 5-3 */
- tmp12 = MULTIPLY(tmp1 - tmp3, FIX_1_414213562) - tmp13; /* 2*c4 */
-
- tmp0 = tmp10 + tmp13; /* phase 2 */
- tmp3 = tmp10 - tmp13;
- tmp1 = tmp11 + tmp12;
- tmp2 = tmp11 - tmp12;
-
- /* Odd part */
-
- tmp4 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]);
- tmp5 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]);
- tmp6 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]);
- tmp7 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]);
-
- z13 = tmp6 + tmp5; /* phase 6 */
- z10 = tmp6 - tmp5;
- z11 = tmp4 + tmp7;
- z12 = tmp4 - tmp7;
-
- tmp7 = z11 + z13; /* phase 5 */
- tmp11 = MULTIPLY(z11 - z13, FIX_1_414213562); /* 2*c4 */
-
- z5 = MULTIPLY(z10 + z12, FIX_1_847759065); /* 2*c2 */
- tmp10 = MULTIPLY(z12, FIX_1_082392200) - z5; /* 2*(c2-c6) */
- tmp12 = MULTIPLY(z10, - FIX_2_613125930) + z5; /* -2*(c2+c6) */
-
- tmp6 = tmp12 - tmp7; /* phase 2 */
- tmp5 = tmp11 - tmp6;
- tmp4 = tmp10 + tmp5;
-
- wsptr[DCTSIZE*0] = (int) (tmp0 + tmp7);
- wsptr[DCTSIZE*7] = (int) (tmp0 - tmp7);
- wsptr[DCTSIZE*1] = (int) (tmp1 + tmp6);
- wsptr[DCTSIZE*6] = (int) (tmp1 - tmp6);
- wsptr[DCTSIZE*2] = (int) (tmp2 + tmp5);
- wsptr[DCTSIZE*5] = (int) (tmp2 - tmp5);
- wsptr[DCTSIZE*4] = (int) (tmp3 + tmp4);
- wsptr[DCTSIZE*3] = (int) (tmp3 - tmp4);
-
- inptr++; /* advance pointers to next column */
- quantptr++;
- wsptr++;
- }
-
- /* Pass 2: process rows from work array, store into output array. */
- /* Note that we must descale the results by a factor of 8 == 2**3, */
- /* and also undo the PASS1_BITS scaling. */
-
- wsptr = workspace;
- for (ctr = 0; ctr < DCTSIZE; ctr++) {
- outptr = output_buf[ctr] + output_col;
- /* Rows of zeroes can be exploited in the same way as we did with columns.
- * However, the column calculation has created many nonzero AC terms, so
- * the simplification applies less often (typically 5% to 10% of the time).
- * On machines with very fast multiplication, it's possible that the
- * test takes more time than it's worth. In that case this section
- * may be commented out.
- */
-
-#ifndef NO_ZERO_ROW_TEST
- if (wsptr[1] == 0 && wsptr[2] == 0 && wsptr[3] == 0 && wsptr[4] == 0 &&
- wsptr[5] == 0 && wsptr[6] == 0 && wsptr[7] == 0) {
- /* AC terms all zero */
- JSAMPLE dcval = range_limit[IDESCALE(wsptr[0], PASS1_BITS+3)
- & RANGE_MASK];
-
- outptr[0] = dcval;
- outptr[1] = dcval;
- outptr[2] = dcval;
- outptr[3] = dcval;
- outptr[4] = dcval;
- outptr[5] = dcval;
- outptr[6] = dcval;
- outptr[7] = dcval;
-
- wsptr += DCTSIZE; /* advance pointer to next row */
- continue;
- }
-#endif
-
- /* Even part */
-
- tmp10 = ((DCTELEM) wsptr[0] + (DCTELEM) wsptr[4]);
- tmp11 = ((DCTELEM) wsptr[0] - (DCTELEM) wsptr[4]);
-
- tmp13 = ((DCTELEM) wsptr[2] + (DCTELEM) wsptr[6]);
- tmp12 = MULTIPLY((DCTELEM) wsptr[2] - (DCTELEM) wsptr[6], FIX_1_414213562)
- - tmp13;
-
- tmp0 = tmp10 + tmp13;
- tmp3 = tmp10 - tmp13;
- tmp1 = tmp11 + tmp12;
- tmp2 = tmp11 - tmp12;
-
- /* Odd part */
-
- z13 = (DCTELEM) wsptr[5] + (DCTELEM) wsptr[3];
- z10 = (DCTELEM) wsptr[5] - (DCTELEM) wsptr[3];
- z11 = (DCTELEM) wsptr[1] + (DCTELEM) wsptr[7];
- z12 = (DCTELEM) wsptr[1] - (DCTELEM) wsptr[7];
-
- tmp7 = z11 + z13; /* phase 5 */
- tmp11 = MULTIPLY(z11 - z13, FIX_1_414213562); /* 2*c4 */
-
- z5 = MULTIPLY(z10 + z12, FIX_1_847759065); /* 2*c2 */
- tmp10 = MULTIPLY(z12, FIX_1_082392200) - z5; /* 2*(c2-c6) */
- tmp12 = MULTIPLY(z10, - FIX_2_613125930) + z5; /* -2*(c2+c6) */
-
- tmp6 = tmp12 - tmp7; /* phase 2 */
- tmp5 = tmp11 - tmp6;
- tmp4 = tmp10 + tmp5;
-
- /* Final output stage: scale down by a factor of 8 and range-limit */
-
- outptr[0] = range_limit[IDESCALE(tmp0 + tmp7, PASS1_BITS+3)
- & RANGE_MASK];
- outptr[7] = range_limit[IDESCALE(tmp0 - tmp7, PASS1_BITS+3)
- & RANGE_MASK];
- outptr[1] = range_limit[IDESCALE(tmp1 + tmp6, PASS1_BITS+3)
- & RANGE_MASK];
- outptr[6] = range_limit[IDESCALE(tmp1 - tmp6, PASS1_BITS+3)
- & RANGE_MASK];
- outptr[2] = range_limit[IDESCALE(tmp2 + tmp5, PASS1_BITS+3)
- & RANGE_MASK];
- outptr[5] = range_limit[IDESCALE(tmp2 - tmp5, PASS1_BITS+3)
- & RANGE_MASK];
- outptr[4] = range_limit[IDESCALE(tmp3 + tmp4, PASS1_BITS+3)
- & RANGE_MASK];
- outptr[3] = range_limit[IDESCALE(tmp3 - tmp4, PASS1_BITS+3)
- & RANGE_MASK];
-
- wsptr += DCTSIZE; /* advance pointer to next row */
- }
-}
-
-#endif /* DCT_IFAST_SUPPORTED */
diff --git a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jidctint.c b/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jidctint.c
deleted file mode 100644
index a72b3207caf..00000000000
--- a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jidctint.c
+++ /dev/null
@@ -1,389 +0,0 @@
-/*
- * jidctint.c
- *
- * Copyright (C) 1991-1998, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file contains a slow-but-accurate integer implementation of the
- * inverse DCT (Discrete Cosine Transform). In the IJG code, this routine
- * must also perform dequantization of the input coefficients.
- *
- * A 2-D IDCT can be done by 1-D IDCT on each column followed by 1-D IDCT
- * on each row (or vice versa, but it's more convenient to emit a row at
- * a time). Direct algorithms are also available, but they are much more
- * complex and seem not to be any faster when reduced to code.
- *
- * This implementation is based on an algorithm described in
- * C. Loeffler, A. Ligtenberg and G. Moschytz, "Practical Fast 1-D DCT
- * Algorithms with 11 Multiplications", Proc. Int'l. Conf. on Acoustics,
- * Speech, and Signal Processing 1989 (ICASSP '89), pp. 988-991.
- * The primary algorithm described there uses 11 multiplies and 29 adds.
- * We use their alternate method with 12 multiplies and 32 adds.
- * The advantage of this method is that no data path contains more than one
- * multiplication; this allows a very simple and accurate implementation in
- * scaled fixed-point arithmetic, with a minimal number of shifts.
- */
-
-#define JPEG_INTERNALS
-#include "jinclude.h"
-#include "jpeglib.h"
-#include "jdct.h" /* Private declarations for DCT subsystem */
-
-#ifdef DCT_ISLOW_SUPPORTED
-
-
-/*
- * This module is specialized to the case DCTSIZE = 8.
- */
-
-#if DCTSIZE != 8
- Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */
-#endif
-
-
-/*
- * The poop on this scaling stuff is as follows:
- *
- * Each 1-D IDCT step produces outputs which are a factor of sqrt(N)
- * larger than the true IDCT outputs. The final outputs are therefore
- * a factor of N larger than desired; since N=8 this can be cured by
- * a simple right shift at the end of the algorithm. The advantage of
- * this arrangement is that we save two multiplications per 1-D IDCT,
- * because the y0 and y4 inputs need not be divided by sqrt(N).
- *
- * We have to do addition and subtraction of the integer inputs, which
- * is no problem, and multiplication by fractional constants, which is
- * a problem to do in integer arithmetic. We multiply all the constants
- * by CONST_SCALE and convert them to integer constants (thus retaining
- * CONST_BITS bits of precision in the constants). After doing a
- * multiplication we have to divide the product by CONST_SCALE, with proper
- * rounding, to produce the correct output. This division can be done
- * cheaply as a right shift of CONST_BITS bits. We postpone shifting
- * as long as possible so that partial sums can be added together with
- * full fractional precision.
- *
- * The outputs of the first pass are scaled up by PASS1_BITS bits so that
- * they are represented to better-than-integral precision. These outputs
- * require BITS_IN_JSAMPLE + PASS1_BITS + 3 bits; this fits in a 16-bit word
- * with the recommended scaling. (To scale up 12-bit sample data further, an
- * intermediate INT32 array would be needed.)
- *
- * To avoid overflow of the 32-bit intermediate results in pass 2, we must
- * have BITS_IN_JSAMPLE + CONST_BITS + PASS1_BITS <= 26. Error analysis
- * shows that the values given below are the most effective.
- */
-
-#if BITS_IN_JSAMPLE == 8
-#define CONST_BITS 13
-#define PASS1_BITS 2
-#else
-#define CONST_BITS 13
-#define PASS1_BITS 1 /* lose a little precision to avoid overflow */
-#endif
-
-/* Some C compilers fail to reduce "FIX(constant)" at compile time, thus
- * causing a lot of useless floating-point operations at run time.
- * To get around this we use the following pre-calculated constants.
- * If you change CONST_BITS you may want to add appropriate values.
- * (With a reasonable C compiler, you can just rely on the FIX() macro...)
- */
-
-#if CONST_BITS == 13
-#define FIX_0_298631336 ((INT32) 2446) /* FIX(0.298631336) */
-#define FIX_0_390180644 ((INT32) 3196) /* FIX(0.390180644) */
-#define FIX_0_541196100 ((INT32) 4433) /* FIX(0.541196100) */
-#define FIX_0_765366865 ((INT32) 6270) /* FIX(0.765366865) */
-#define FIX_0_899976223 ((INT32) 7373) /* FIX(0.899976223) */
-#define FIX_1_175875602 ((INT32) 9633) /* FIX(1.175875602) */
-#define FIX_1_501321110 ((INT32) 12299) /* FIX(1.501321110) */
-#define FIX_1_847759065 ((INT32) 15137) /* FIX(1.847759065) */
-#define FIX_1_961570560 ((INT32) 16069) /* FIX(1.961570560) */
-#define FIX_2_053119869 ((INT32) 16819) /* FIX(2.053119869) */
-#define FIX_2_562915447 ((INT32) 20995) /* FIX(2.562915447) */
-#define FIX_3_072711026 ((INT32) 25172) /* FIX(3.072711026) */
-#else
-#define FIX_0_298631336 FIX(0.298631336)
-#define FIX_0_390180644 FIX(0.390180644)
-#define FIX_0_541196100 FIX(0.541196100)
-#define FIX_0_765366865 FIX(0.765366865)
-#define FIX_0_899976223 FIX(0.899976223)
-#define FIX_1_175875602 FIX(1.175875602)
-#define FIX_1_501321110 FIX(1.501321110)
-#define FIX_1_847759065 FIX(1.847759065)
-#define FIX_1_961570560 FIX(1.961570560)
-#define FIX_2_053119869 FIX(2.053119869)
-#define FIX_2_562915447 FIX(2.562915447)
-#define FIX_3_072711026 FIX(3.072711026)
-#endif
-
-
-/* Multiply an INT32 variable by an INT32 constant to yield an INT32 result.
- * For 8-bit samples with the recommended scaling, all the variable
- * and constant values involved are no more than 16 bits wide, so a
- * 16x16->32 bit multiply can be used instead of a full 32x32 multiply.
- * For 12-bit samples, a full 32-bit multiplication will be needed.
- */
-
-#if BITS_IN_JSAMPLE == 8
-#define MULTIPLY(var,const) MULTIPLY16C16(var,const)
-#else
-#define MULTIPLY(var,const) ((var) * (const))
-#endif
-
-
-/* Dequantize a coefficient by multiplying it by the multiplier-table
- * entry; produce an int result. In this module, both inputs and result
- * are 16 bits or less, so either int or short multiply will work.
- */
-
-#define DEQUANTIZE(coef,quantval) (((ISLOW_MULT_TYPE) (coef)) * (quantval))
-
-
-/*
- * Perform dequantization and inverse DCT on one block of coefficients.
- */
-
-GLOBAL(void)
-jpeg_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr,
- JCOEFPTR coef_block,
- JSAMPARRAY output_buf, JDIMENSION output_col)
-{
- INT32 tmp0, tmp1, tmp2, tmp3;
- INT32 tmp10, tmp11, tmp12, tmp13;
- INT32 z1, z2, z3, z4, z5;
- JCOEFPTR inptr;
- ISLOW_MULT_TYPE * quantptr;
- int * wsptr;
- JSAMPROW outptr;
- JSAMPLE *range_limit = IDCT_range_limit(cinfo);
- int ctr;
- int workspace[DCTSIZE2]; /* buffers data between passes */
- SHIFT_TEMPS
-
- /* Pass 1: process columns from input, store into work array. */
- /* Note results are scaled up by sqrt(8) compared to a true IDCT; */
- /* furthermore, we scale the results by 2**PASS1_BITS. */
-
- inptr = coef_block;
- quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table;
- wsptr = workspace;
- for (ctr = DCTSIZE; ctr > 0; ctr--) {
- /* Due to quantization, we will usually find that many of the input
- * coefficients are zero, especially the AC terms. We can exploit this
- * by short-circuiting the IDCT calculation for any column in which all
- * the AC terms are zero. In that case each output is equal to the
- * DC coefficient (with scale factor as needed).
- * With typical images and quantization tables, half or more of the
- * column DCT calculations can be simplified this way.
- */
-
- if (inptr[DCTSIZE*1] == 0 && inptr[DCTSIZE*2] == 0 &&
- inptr[DCTSIZE*3] == 0 && inptr[DCTSIZE*4] == 0 &&
- inptr[DCTSIZE*5] == 0 && inptr[DCTSIZE*6] == 0 &&
- inptr[DCTSIZE*7] == 0) {
- /* AC terms all zero */
- int dcval = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]) << PASS1_BITS;
-
- wsptr[DCTSIZE*0] = dcval;
- wsptr[DCTSIZE*1] = dcval;
- wsptr[DCTSIZE*2] = dcval;
- wsptr[DCTSIZE*3] = dcval;
- wsptr[DCTSIZE*4] = dcval;
- wsptr[DCTSIZE*5] = dcval;
- wsptr[DCTSIZE*6] = dcval;
- wsptr[DCTSIZE*7] = dcval;
-
- inptr++; /* advance pointers to next column */
- quantptr++;
- wsptr++;
- continue;
- }
-
- /* Even part: reverse the even part of the forward DCT. */
- /* The rotator is sqrt(2)*c(-6). */
-
- z2 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]);
- z3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]);
-
- z1 = MULTIPLY(z2 + z3, FIX_0_541196100);
- tmp2 = z1 + MULTIPLY(z3, - FIX_1_847759065);
- tmp3 = z1 + MULTIPLY(z2, FIX_0_765366865);
-
- z2 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
- z3 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]);
-
- tmp0 = (z2 + z3) << CONST_BITS;
- tmp1 = (z2 - z3) << CONST_BITS;
-
- tmp10 = tmp0 + tmp3;
- tmp13 = tmp0 - tmp3;
- tmp11 = tmp1 + tmp2;
- tmp12 = tmp1 - tmp2;
-
- /* Odd part per figure 8; the matrix is unitary and hence its
- * transpose is its inverse. i0..i3 are y7,y5,y3,y1 respectively.
- */
-
- tmp0 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]);
- tmp1 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]);
- tmp2 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]);
- tmp3 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]);
-
- z1 = tmp0 + tmp3;
- z2 = tmp1 + tmp2;
- z3 = tmp0 + tmp2;
- z4 = tmp1 + tmp3;
- z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */
-
- tmp0 = MULTIPLY(tmp0, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */
- tmp1 = MULTIPLY(tmp1, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */
- tmp2 = MULTIPLY(tmp2, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */
- tmp3 = MULTIPLY(tmp3, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */
- z1 = MULTIPLY(z1, - FIX_0_899976223); /* sqrt(2) * (c7-c3) */
- z2 = MULTIPLY(z2, - FIX_2_562915447); /* sqrt(2) * (-c1-c3) */
- z3 = MULTIPLY(z3, - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */
- z4 = MULTIPLY(z4, - FIX_0_390180644); /* sqrt(2) * (c5-c3) */
-
- z3 += z5;
- z4 += z5;
-
- tmp0 += z1 + z3;
- tmp1 += z2 + z4;
- tmp2 += z2 + z3;
- tmp3 += z1 + z4;
-
- /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */
-
- wsptr[DCTSIZE*0] = (int) DESCALE(tmp10 + tmp3, CONST_BITS-PASS1_BITS);
- wsptr[DCTSIZE*7] = (int) DESCALE(tmp10 - tmp3, CONST_BITS-PASS1_BITS);
- wsptr[DCTSIZE*1] = (int) DESCALE(tmp11 + tmp2, CONST_BITS-PASS1_BITS);
- wsptr[DCTSIZE*6] = (int) DESCALE(tmp11 - tmp2, CONST_BITS-PASS1_BITS);
- wsptr[DCTSIZE*2] = (int) DESCALE(tmp12 + tmp1, CONST_BITS-PASS1_BITS);
- wsptr[DCTSIZE*5] = (int) DESCALE(tmp12 - tmp1, CONST_BITS-PASS1_BITS);
- wsptr[DCTSIZE*3] = (int) DESCALE(tmp13 + tmp0, CONST_BITS-PASS1_BITS);
- wsptr[DCTSIZE*4] = (int) DESCALE(tmp13 - tmp0, CONST_BITS-PASS1_BITS);
-
- inptr++; /* advance pointers to next column */
- quantptr++;
- wsptr++;
- }
-
- /* Pass 2: process rows from work array, store into output array. */
- /* Note that we must descale the results by a factor of 8 == 2**3, */
- /* and also undo the PASS1_BITS scaling. */
-
- wsptr = workspace;
- for (ctr = 0; ctr < DCTSIZE; ctr++) {
- outptr = output_buf[ctr] + output_col;
- /* Rows of zeroes can be exploited in the same way as we did with columns.
- * However, the column calculation has created many nonzero AC terms, so
- * the simplification applies less often (typically 5% to 10% of the time).
- * On machines with very fast multiplication, it's possible that the
- * test takes more time than it's worth. In that case this section
- * may be commented out.
- */
-
-#ifndef NO_ZERO_ROW_TEST
- if (wsptr[1] == 0 && wsptr[2] == 0 && wsptr[3] == 0 && wsptr[4] == 0 &&
- wsptr[5] == 0 && wsptr[6] == 0 && wsptr[7] == 0) {
- /* AC terms all zero */
- JSAMPLE dcval = range_limit[(int) DESCALE((INT32) wsptr[0], PASS1_BITS+3)
- & RANGE_MASK];
-
- outptr[0] = dcval;
- outptr[1] = dcval;
- outptr[2] = dcval;
- outptr[3] = dcval;
- outptr[4] = dcval;
- outptr[5] = dcval;
- outptr[6] = dcval;
- outptr[7] = dcval;
-
- wsptr += DCTSIZE; /* advance pointer to next row */
- continue;
- }
-#endif
-
- /* Even part: reverse the even part of the forward DCT. */
- /* The rotator is sqrt(2)*c(-6). */
-
- z2 = (INT32) wsptr[2];
- z3 = (INT32) wsptr[6];
-
- z1 = MULTIPLY(z2 + z3, FIX_0_541196100);
- tmp2 = z1 + MULTIPLY(z3, - FIX_1_847759065);
- tmp3 = z1 + MULTIPLY(z2, FIX_0_765366865);
-
- tmp0 = ((INT32) wsptr[0] + (INT32) wsptr[4]) << CONST_BITS;
- tmp1 = ((INT32) wsptr[0] - (INT32) wsptr[4]) << CONST_BITS;
-
- tmp10 = tmp0 + tmp3;
- tmp13 = tmp0 - tmp3;
- tmp11 = tmp1 + tmp2;
- tmp12 = tmp1 - tmp2;
-
- /* Odd part per figure 8; the matrix is unitary and hence its
- * transpose is its inverse. i0..i3 are y7,y5,y3,y1 respectively.
- */
-
- tmp0 = (INT32) wsptr[7];
- tmp1 = (INT32) wsptr[5];
- tmp2 = (INT32) wsptr[3];
- tmp3 = (INT32) wsptr[1];
-
- z1 = tmp0 + tmp3;
- z2 = tmp1 + tmp2;
- z3 = tmp0 + tmp2;
- z4 = tmp1 + tmp3;
- z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */
-
- tmp0 = MULTIPLY(tmp0, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */
- tmp1 = MULTIPLY(tmp1, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */
- tmp2 = MULTIPLY(tmp2, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */
- tmp3 = MULTIPLY(tmp3, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */
- z1 = MULTIPLY(z1, - FIX_0_899976223); /* sqrt(2) * (c7-c3) */
- z2 = MULTIPLY(z2, - FIX_2_562915447); /* sqrt(2) * (-c1-c3) */
- z3 = MULTIPLY(z3, - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */
- z4 = MULTIPLY(z4, - FIX_0_390180644); /* sqrt(2) * (c5-c3) */
-
- z3 += z5;
- z4 += z5;
-
- tmp0 += z1 + z3;
- tmp1 += z2 + z4;
- tmp2 += z2 + z3;
- tmp3 += z1 + z4;
-
- /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */
-
- outptr[0] = range_limit[(int) DESCALE(tmp10 + tmp3,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[7] = range_limit[(int) DESCALE(tmp10 - tmp3,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[1] = range_limit[(int) DESCALE(tmp11 + tmp2,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[6] = range_limit[(int) DESCALE(tmp11 - tmp2,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[2] = range_limit[(int) DESCALE(tmp12 + tmp1,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[5] = range_limit[(int) DESCALE(tmp12 - tmp1,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[3] = range_limit[(int) DESCALE(tmp13 + tmp0,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[4] = range_limit[(int) DESCALE(tmp13 - tmp0,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
-
- wsptr += DCTSIZE; /* advance pointer to next row */
- }
-}
-
-#endif /* DCT_ISLOW_SUPPORTED */
diff --git a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jidctred.c b/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jidctred.c
deleted file mode 100644
index 421f3c7ca1e..00000000000
--- a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jidctred.c
+++ /dev/null
@@ -1,398 +0,0 @@
-/*
- * jidctred.c
- *
- * Copyright (C) 1994-1998, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file contains inverse-DCT routines that produce reduced-size output:
- * either 4x4, 2x2, or 1x1 pixels from an 8x8 DCT block.
- *
- * The implementation is based on the Loeffler, Ligtenberg and Moschytz (LL&M)
- * algorithm used in jidctint.c. We simply replace each 8-to-8 1-D IDCT step
- * with an 8-to-4 step that produces the four averages of two adjacent outputs
- * (or an 8-to-2 step producing two averages of four outputs, for 2x2 output).
- * These steps were derived by computing the corresponding values at the end
- * of the normal LL&M code, then simplifying as much as possible.
- *
- * 1x1 is trivial: just take the DC coefficient divided by 8.
- *
- * See jidctint.c for additional comments.
- */
-
-#define JPEG_INTERNALS
-#include "jinclude.h"
-#include "jpeglib.h"
-#include "jdct.h" /* Private declarations for DCT subsystem */
-
-#ifdef IDCT_SCALING_SUPPORTED
-
-
-/*
- * This module is specialized to the case DCTSIZE = 8.
- */
-
-#if DCTSIZE != 8
- Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */
-#endif
-
-
-/* Scaling is the same as in jidctint.c. */
-
-#if BITS_IN_JSAMPLE == 8
-#define CONST_BITS 13
-#define PASS1_BITS 2
-#else
-#define CONST_BITS 13
-#define PASS1_BITS 1 /* lose a little precision to avoid overflow */
-#endif
-
-/* Some C compilers fail to reduce "FIX(constant)" at compile time, thus
- * causing a lot of useless floating-point operations at run time.
- * To get around this we use the following pre-calculated constants.
- * If you change CONST_BITS you may want to add appropriate values.
- * (With a reasonable C compiler, you can just rely on the FIX() macro...)
- */
-
-#if CONST_BITS == 13
-#define FIX_0_211164243 ((INT32) 1730) /* FIX(0.211164243) */
-#define FIX_0_509795579 ((INT32) 4176) /* FIX(0.509795579) */
-#define FIX_0_601344887 ((INT32) 4926) /* FIX(0.601344887) */
-#define FIX_0_720959822 ((INT32) 5906) /* FIX(0.720959822) */
-#define FIX_0_765366865 ((INT32) 6270) /* FIX(0.765366865) */
-#define FIX_0_850430095 ((INT32) 6967) /* FIX(0.850430095) */
-#define FIX_0_899976223 ((INT32) 7373) /* FIX(0.899976223) */
-#define FIX_1_061594337 ((INT32) 8697) /* FIX(1.061594337) */
-#define FIX_1_272758580 ((INT32) 10426) /* FIX(1.272758580) */
-#define FIX_1_451774981 ((INT32) 11893) /* FIX(1.451774981) */
-#define FIX_1_847759065 ((INT32) 15137) /* FIX(1.847759065) */
-#define FIX_2_172734803 ((INT32) 17799) /* FIX(2.172734803) */
-#define FIX_2_562915447 ((INT32) 20995) /* FIX(2.562915447) */
-#define FIX_3_624509785 ((INT32) 29692) /* FIX(3.624509785) */
-#else
-#define FIX_0_211164243 FIX(0.211164243)
-#define FIX_0_509795579 FIX(0.509795579)
-#define FIX_0_601344887 FIX(0.601344887)
-#define FIX_0_720959822 FIX(0.720959822)
-#define FIX_0_765366865 FIX(0.765366865)
-#define FIX_0_850430095 FIX(0.850430095)
-#define FIX_0_899976223 FIX(0.899976223)
-#define FIX_1_061594337 FIX(1.061594337)
-#define FIX_1_272758580 FIX(1.272758580)
-#define FIX_1_451774981 FIX(1.451774981)
-#define FIX_1_847759065 FIX(1.847759065)
-#define FIX_2_172734803 FIX(2.172734803)
-#define FIX_2_562915447 FIX(2.562915447)
-#define FIX_3_624509785 FIX(3.624509785)
-#endif
-
-
-/* Multiply an INT32 variable by an INT32 constant to yield an INT32 result.
- * For 8-bit samples with the recommended scaling, all the variable
- * and constant values involved are no more than 16 bits wide, so a
- * 16x16->32 bit multiply can be used instead of a full 32x32 multiply.
- * For 12-bit samples, a full 32-bit multiplication will be needed.
- */
-
-#if BITS_IN_JSAMPLE == 8
-#define MULTIPLY(var,const) MULTIPLY16C16(var,const)
-#else
-#define MULTIPLY(var,const) ((var) * (const))
-#endif
-
-
-/* Dequantize a coefficient by multiplying it by the multiplier-table
- * entry; produce an int result. In this module, both inputs and result
- * are 16 bits or less, so either int or short multiply will work.
- */
-
-#define DEQUANTIZE(coef,quantval) (((ISLOW_MULT_TYPE) (coef)) * (quantval))
-
-
-/*
- * Perform dequantization and inverse DCT on one block of coefficients,
- * producing a reduced-size 4x4 output block.
- */
-
-GLOBAL(void)
-jpeg_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
- JCOEFPTR coef_block,
- JSAMPARRAY output_buf, JDIMENSION output_col)
-{
- INT32 tmp0, tmp2, tmp10, tmp12;
- INT32 z1, z2, z3, z4;
- JCOEFPTR inptr;
- ISLOW_MULT_TYPE * quantptr;
- int * wsptr;
- JSAMPROW outptr;
- JSAMPLE *range_limit = IDCT_range_limit(cinfo);
- int ctr;
- int workspace[DCTSIZE*4]; /* buffers data between passes */
- SHIFT_TEMPS
-
- /* Pass 1: process columns from input, store into work array. */
-
- inptr = coef_block;
- quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table;
- wsptr = workspace;
- for (ctr = DCTSIZE; ctr > 0; inptr++, quantptr++, wsptr++, ctr--) {
- /* Don't bother to process column 4, because second pass won't use it */
- if (ctr == DCTSIZE-4)
- continue;
- if (inptr[DCTSIZE*1] == 0 && inptr[DCTSIZE*2] == 0 &&
- inptr[DCTSIZE*3] == 0 && inptr[DCTSIZE*5] == 0 &&
- inptr[DCTSIZE*6] == 0 && inptr[DCTSIZE*7] == 0) {
- /* AC terms all zero; we need not examine term 4 for 4x4 output */
- int dcval = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]) << PASS1_BITS;
-
- wsptr[DCTSIZE*0] = dcval;
- wsptr[DCTSIZE*1] = dcval;
- wsptr[DCTSIZE*2] = dcval;
- wsptr[DCTSIZE*3] = dcval;
-
- continue;
- }
-
- /* Even part */
-
- tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
- tmp0 <<= (CONST_BITS+1);
-
- z2 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]);
- z3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]);
-
- tmp2 = MULTIPLY(z2, FIX_1_847759065) + MULTIPLY(z3, - FIX_0_765366865);
-
- tmp10 = tmp0 + tmp2;
- tmp12 = tmp0 - tmp2;
-
- /* Odd part */
-
- z1 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]);
- z2 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]);
- z3 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]);
- z4 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]);
-
- tmp0 = MULTIPLY(z1, - FIX_0_211164243) /* sqrt(2) * (c3-c1) */
- + MULTIPLY(z2, FIX_1_451774981) /* sqrt(2) * (c3+c7) */
- + MULTIPLY(z3, - FIX_2_172734803) /* sqrt(2) * (-c1-c5) */
- + MULTIPLY(z4, FIX_1_061594337); /* sqrt(2) * (c5+c7) */
-
- tmp2 = MULTIPLY(z1, - FIX_0_509795579) /* sqrt(2) * (c7-c5) */
- + MULTIPLY(z2, - FIX_0_601344887) /* sqrt(2) * (c5-c1) */
- + MULTIPLY(z3, FIX_0_899976223) /* sqrt(2) * (c3-c7) */
- + MULTIPLY(z4, FIX_2_562915447); /* sqrt(2) * (c1+c3) */
-
- /* Final output stage */
-
- wsptr[DCTSIZE*0] = (int) DESCALE(tmp10 + tmp2, CONST_BITS-PASS1_BITS+1);
- wsptr[DCTSIZE*3] = (int) DESCALE(tmp10 - tmp2, CONST_BITS-PASS1_BITS+1);
- wsptr[DCTSIZE*1] = (int) DESCALE(tmp12 + tmp0, CONST_BITS-PASS1_BITS+1);
- wsptr[DCTSIZE*2] = (int) DESCALE(tmp12 - tmp0, CONST_BITS-PASS1_BITS+1);
- }
-
- /* Pass 2: process 4 rows from work array, store into output array. */
-
- wsptr = workspace;
- for (ctr = 0; ctr < 4; ctr++) {
- outptr = output_buf[ctr] + output_col;
- /* It's not clear whether a zero row test is worthwhile here ... */
-
-#ifndef NO_ZERO_ROW_TEST
- if (wsptr[1] == 0 && wsptr[2] == 0 && wsptr[3] == 0 &&
- wsptr[5] == 0 && wsptr[6] == 0 && wsptr[7] == 0) {
- /* AC terms all zero */
- JSAMPLE dcval = range_limit[(int) DESCALE((INT32) wsptr[0], PASS1_BITS+3)
- & RANGE_MASK];
-
- outptr[0] = dcval;
- outptr[1] = dcval;
- outptr[2] = dcval;
- outptr[3] = dcval;
-
- wsptr += DCTSIZE; /* advance pointer to next row */
- continue;
- }
-#endif
-
- /* Even part */
-
- tmp0 = ((INT32) wsptr[0]) << (CONST_BITS+1);
-
- tmp2 = MULTIPLY((INT32) wsptr[2], FIX_1_847759065)
- + MULTIPLY((INT32) wsptr[6], - FIX_0_765366865);
-
- tmp10 = tmp0 + tmp2;
- tmp12 = tmp0 - tmp2;
-
- /* Odd part */
-
- z1 = (INT32) wsptr[7];
- z2 = (INT32) wsptr[5];
- z3 = (INT32) wsptr[3];
- z4 = (INT32) wsptr[1];
-
- tmp0 = MULTIPLY(z1, - FIX_0_211164243) /* sqrt(2) * (c3-c1) */
- + MULTIPLY(z2, FIX_1_451774981) /* sqrt(2) * (c3+c7) */
- + MULTIPLY(z3, - FIX_2_172734803) /* sqrt(2) * (-c1-c5) */
- + MULTIPLY(z4, FIX_1_061594337); /* sqrt(2) * (c5+c7) */
-
- tmp2 = MULTIPLY(z1, - FIX_0_509795579) /* sqrt(2) * (c7-c5) */
- + MULTIPLY(z2, - FIX_0_601344887) /* sqrt(2) * (c5-c1) */
- + MULTIPLY(z3, FIX_0_899976223) /* sqrt(2) * (c3-c7) */
- + MULTIPLY(z4, FIX_2_562915447); /* sqrt(2) * (c1+c3) */
-
- /* Final output stage */
-
- outptr[0] = range_limit[(int) DESCALE(tmp10 + tmp2,
- CONST_BITS+PASS1_BITS+3+1)
- & RANGE_MASK];
- outptr[3] = range_limit[(int) DESCALE(tmp10 - tmp2,
- CONST_BITS+PASS1_BITS+3+1)
- & RANGE_MASK];
- outptr[1] = range_limit[(int) DESCALE(tmp12 + tmp0,
- CONST_BITS+PASS1_BITS+3+1)
- & RANGE_MASK];
- outptr[2] = range_limit[(int) DESCALE(tmp12 - tmp0,
- CONST_BITS+PASS1_BITS+3+1)
- & RANGE_MASK];
-
- wsptr += DCTSIZE; /* advance pointer to next row */
- }
-}
-
-
-/*
- * Perform dequantization and inverse DCT on one block of coefficients,
- * producing a reduced-size 2x2 output block.
- */
-
-GLOBAL(void)
-jpeg_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
- JCOEFPTR coef_block,
- JSAMPARRAY output_buf, JDIMENSION output_col)
-{
- INT32 tmp0, tmp10, z1;
- JCOEFPTR inptr;
- ISLOW_MULT_TYPE * quantptr;
- int * wsptr;
- JSAMPROW outptr;
- JSAMPLE *range_limit = IDCT_range_limit(cinfo);
- int ctr;
- int workspace[DCTSIZE*2]; /* buffers data between passes */
- SHIFT_TEMPS
-
- /* Pass 1: process columns from input, store into work array. */
-
- inptr = coef_block;
- quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table;
- wsptr = workspace;
- for (ctr = DCTSIZE; ctr > 0; inptr++, quantptr++, wsptr++, ctr--) {
- /* Don't bother to process columns 2,4,6 */
- if (ctr == DCTSIZE-2 || ctr == DCTSIZE-4 || ctr == DCTSIZE-6)
- continue;
- if (inptr[DCTSIZE*1] == 0 && inptr[DCTSIZE*3] == 0 &&
- inptr[DCTSIZE*5] == 0 && inptr[DCTSIZE*7] == 0) {
- /* AC terms all zero; we need not examine terms 2,4,6 for 2x2 output */
- int dcval = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]) << PASS1_BITS;
-
- wsptr[DCTSIZE*0] = dcval;
- wsptr[DCTSIZE*1] = dcval;
-
- continue;
- }
-
- /* Even part */
-
- z1 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
- tmp10 = z1 << (CONST_BITS+2);
-
- /* Odd part */
-
- z1 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]);
- tmp0 = MULTIPLY(z1, - FIX_0_720959822); /* sqrt(2) * (c7-c5+c3-c1) */
- z1 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]);
- tmp0 += MULTIPLY(z1, FIX_0_850430095); /* sqrt(2) * (-c1+c3+c5+c7) */
- z1 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]);
- tmp0 += MULTIPLY(z1, - FIX_1_272758580); /* sqrt(2) * (-c1+c3-c5-c7) */
- z1 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]);
- tmp0 += MULTIPLY(z1, FIX_3_624509785); /* sqrt(2) * (c1+c3+c5+c7) */
-
- /* Final output stage */
-
- wsptr[DCTSIZE*0] = (int) DESCALE(tmp10 + tmp0, CONST_BITS-PASS1_BITS+2);
- wsptr[DCTSIZE*1] = (int) DESCALE(tmp10 - tmp0, CONST_BITS-PASS1_BITS+2);
- }
-
- /* Pass 2: process 2 rows from work array, store into output array. */
-
- wsptr = workspace;
- for (ctr = 0; ctr < 2; ctr++) {
- outptr = output_buf[ctr] + output_col;
- /* It's not clear whether a zero row test is worthwhile here ... */
-
-#ifndef NO_ZERO_ROW_TEST
- if (wsptr[1] == 0 && wsptr[3] == 0 && wsptr[5] == 0 && wsptr[7] == 0) {
- /* AC terms all zero */
- JSAMPLE dcval = range_limit[(int) DESCALE((INT32) wsptr[0], PASS1_BITS+3)
- & RANGE_MASK];
-
- outptr[0] = dcval;
- outptr[1] = dcval;
-
- wsptr += DCTSIZE; /* advance pointer to next row */
- continue;
- }
-#endif
-
- /* Even part */
-
- tmp10 = ((INT32) wsptr[0]) << (CONST_BITS+2);
-
- /* Odd part */
-
- tmp0 = MULTIPLY((INT32) wsptr[7], - FIX_0_720959822) /* sqrt(2) * (c7-c5+c3-c1) */
- + MULTIPLY((INT32) wsptr[5], FIX_0_850430095) /* sqrt(2) * (-c1+c3+c5+c7) */
- + MULTIPLY((INT32) wsptr[3], - FIX_1_272758580) /* sqrt(2) * (-c1+c3-c5-c7) */
- + MULTIPLY((INT32) wsptr[1], FIX_3_624509785); /* sqrt(2) * (c1+c3+c5+c7) */
-
- /* Final output stage */
-
- outptr[0] = range_limit[(int) DESCALE(tmp10 + tmp0,
- CONST_BITS+PASS1_BITS+3+2)
- & RANGE_MASK];
- outptr[1] = range_limit[(int) DESCALE(tmp10 - tmp0,
- CONST_BITS+PASS1_BITS+3+2)
- & RANGE_MASK];
-
- wsptr += DCTSIZE; /* advance pointer to next row */
- }
-}
-
-
-/*
- * Perform dequantization and inverse DCT on one block of coefficients,
- * producing a reduced-size 1x1 output block.
- */
-
-GLOBAL(void)
-jpeg_idct_1x1 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
- JCOEFPTR coef_block,
- JSAMPARRAY output_buf, JDIMENSION output_col)
-{
- int dcval;
- ISLOW_MULT_TYPE * quantptr;
- JSAMPLE *range_limit = IDCT_range_limit(cinfo);
- SHIFT_TEMPS
-
- /* We hardly need an inverse DCT routine for this: just take the
- * average pixel value, which is one-eighth of the DC coefficient.
- */
- quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table;
- dcval = DEQUANTIZE(coef_block[0], quantptr[0]);
- dcval = (int) DESCALE((INT32) dcval, 3);
-
- output_buf[0][output_col] = range_limit[dcval & RANGE_MASK];
-}
-
-#endif /* IDCT_SCALING_SUPPORTED */
diff --git a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jmemmgr.c b/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jmemmgr.c
deleted file mode 100644
index 47ead48ac47..00000000000
--- a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jmemmgr.c
+++ /dev/null
@@ -1,1120 +0,0 @@
-/*
- * jmemmgr.c
- *
- * Copyright (C) 1991-1997, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file contains the JPEG system-independent memory management
- * routines. This code is usable across a wide variety of machines; most
- * of the system dependencies have been isolated in a separate file.
- * The major functions provided here are:
- * * pool-based allocation and freeing of memory;
- * * policy decisions about how to divide available memory among the
- * virtual arrays;
- * * control logic for swapping virtual arrays between main memory and
- * backing storage.
- * The separate system-dependent file provides the actual backing-storage
- * access code, and it contains the policy decision about how much total
- * main memory to use.
- * This file is system-dependent in the sense that some of its functions
- * are unnecessary in some systems. For example, if there is enough virtual
- * memory so that backing storage will never be used, much of the virtual
- * array control logic could be removed. (Of course, if you have that much
- * memory then you shouldn't care about a little bit of unused code...)
- */
-
-#define JPEG_INTERNALS
-#define AM_MEMORY_MANAGER /* we define jvirt_Xarray_control structs */
-#include "jinclude.h"
-#include "jpeglib.h"
-#include "jmemsys.h" /* import the system-dependent declarations */
-
-#define NO_GETENV /* XYQ: 2007-5-22 Don't use it */
-
-#ifndef NO_GETENV
-#ifndef HAVE_STDLIB_H /* <stdlib.h> should declare getenv() */
-extern char * getenv JPP((const char * name));
-#endif
-#endif
-
-
-/*
- * Some important notes:
- * The allocation routines provided here must never return NULL.
- * They should exit to error_exit if unsuccessful.
- *
- * It's not a good idea to try to merge the sarray and barray routines,
- * even though they are textually almost the same, because samples are
- * usually stored as bytes while coefficients are shorts or ints. Thus,
- * in machines where byte pointers have a different representation from
- * word pointers, the resulting machine code could not be the same.
- */
-
-
-/*
- * Many machines require storage alignment: longs must start on 4-byte
- * boundaries, doubles on 8-byte boundaries, etc. On such machines, malloc()
- * always returns pointers that are multiples of the worst-case alignment
- * requirement, and we had better do so too.
- * There isn't any really portable way to determine the worst-case alignment
- * requirement. This module assumes that the alignment requirement is
- * multiples of sizeof(ALIGN_TYPE).
- * By default, we define ALIGN_TYPE as double. This is necessary on some
- * workstations (where doubles really do need 8-byte alignment) and will work
- * fine on nearly everything. If your machine has lesser alignment needs,
- * you can save a few bytes by making ALIGN_TYPE smaller.
- * The only place I know of where this will NOT work is certain Macintosh
- * 680x0 compilers that define double as a 10-byte IEEE extended float.
- * Doing 10-byte alignment is counterproductive because longwords won't be
- * aligned well. Put "#define ALIGN_TYPE long" in jconfig.h if you have
- * such a compiler.
- */
-
-#ifndef ALIGN_TYPE /* so can override from jconfig.h */
-#define ALIGN_TYPE double
-#endif
-
-
-/*
- * We allocate objects from "pools", where each pool is gotten with a single
- * request to jpeg_get_small() or jpeg_get_large(). There is no per-object
- * overhead within a pool, except for alignment padding. Each pool has a
- * header with a link to the next pool of the same class.
- * Small and large pool headers are identical except that the latter's
- * link pointer must be FAR on 80x86 machines.
- * Notice that the "real" header fields are union'ed with a dummy ALIGN_TYPE
- * field. This forces the compiler to make SIZEOF(small_pool_hdr) a multiple
- * of the alignment requirement of ALIGN_TYPE.
- */
-
-typedef union small_pool_struct * small_pool_ptr;
-
-typedef union small_pool_struct {
- struct {
- small_pool_ptr next; /* next in list of pools */
- size_t bytes_used; /* how many bytes already used within pool */
- size_t bytes_left; /* bytes still available in this pool */
- } hdr;
- ALIGN_TYPE dummy; /* included in union to ensure alignment */
-} small_pool_hdr;
-
-typedef union large_pool_struct FAR * large_pool_ptr;
-
-typedef union large_pool_struct {
- struct {
- large_pool_ptr next; /* next in list of pools */
- size_t bytes_used; /* how many bytes already used within pool */
- size_t bytes_left; /* bytes still available in this pool */
- } hdr;
- ALIGN_TYPE dummy; /* included in union to ensure alignment */
-} large_pool_hdr;
-
-
-/*
- * Here is the full definition of a memory manager object.
- */
-
-typedef struct {
- struct jpeg_memory_mgr pub; /* public fields */
-
- /* Each pool identifier (lifetime class) names a linked list of pools. */
- small_pool_ptr small_list[JPOOL_NUMPOOLS];
- large_pool_ptr large_list[JPOOL_NUMPOOLS];
-
- /* Since we only have one lifetime class of virtual arrays, only one
- * linked list is necessary (for each datatype). Note that the virtual
- * array control blocks being linked together are actually stored somewhere
- * in the small-pool list.
- */
- jvirt_sarray_ptr virt_sarray_list;
- jvirt_barray_ptr virt_barray_list;
-
- /* This counts total space obtained from jpeg_get_small/large */
- long total_space_allocated;
-
- /* alloc_sarray and alloc_barray set this value for use by virtual
- * array routines.
- */
- JDIMENSION last_rowsperchunk; /* from most recent alloc_sarray/barray */
-} my_memory_mgr;
-
-typedef my_memory_mgr * my_mem_ptr;
-
-
-/*
- * The control blocks for virtual arrays.
- * Note that these blocks are allocated in the "small" pool area.
- * System-dependent info for the associated backing store (if any) is hidden
- * inside the backing_store_info struct.
- */
-
-struct jvirt_sarray_control {
- JSAMPARRAY mem_buffer; /* => the in-memory buffer */
- JDIMENSION rows_in_array; /* total virtual array height */
- JDIMENSION samplesperrow; /* width of array (and of memory buffer) */
- JDIMENSION maxaccess; /* max rows accessed by access_virt_sarray */
- JDIMENSION rows_in_mem; /* height of memory buffer */
- JDIMENSION rowsperchunk; /* allocation chunk size in mem_buffer */
- JDIMENSION cur_start_row; /* first logical row # in the buffer */
- JDIMENSION first_undef_row; /* row # of first uninitialized row */
- boolean pre_zero; /* pre-zero mode requested? */
- boolean dirty; /* do current buffer contents need written? */
- boolean b_s_open; /* is backing-store data valid? */
- jvirt_sarray_ptr next; /* link to next virtual sarray control block */
- backing_store_info b_s_info; /* System-dependent control info */
-};
-
-struct jvirt_barray_control {
- JBLOCKARRAY mem_buffer; /* => the in-memory buffer */
- JDIMENSION rows_in_array; /* total virtual array height */
- JDIMENSION blocksperrow; /* width of array (and of memory buffer) */
- JDIMENSION maxaccess; /* max rows accessed by access_virt_barray */
- JDIMENSION rows_in_mem; /* height of memory buffer */
- JDIMENSION rowsperchunk; /* allocation chunk size in mem_buffer */
- JDIMENSION cur_start_row; /* first logical row # in the buffer */
- JDIMENSION first_undef_row; /* row # of first uninitialized row */
- boolean pre_zero; /* pre-zero mode requested? */
- boolean dirty; /* do current buffer contents need written? */
- boolean b_s_open; /* is backing-store data valid? */
- jvirt_barray_ptr next; /* link to next virtual barray control block */
- backing_store_info b_s_info; /* System-dependent control info */
-};
-
-
-#ifdef MEM_STATS /* optional extra stuff for statistics */
-
-LOCAL(void)
-print_mem_stats (j_common_ptr cinfo, int pool_id)
-{
- my_mem_ptr mem = (my_mem_ptr) cinfo->mem;
- small_pool_ptr shdr_ptr;
- large_pool_ptr lhdr_ptr;
-
- /* Since this is only a debugging stub, we can cheat a little by using
- * fprintf directly rather than going through the trace message code.
- * This is helpful because message parm array can't handle longs.
- */
- FXSYS_fprintf(stderr, "Freeing pool %d, total space = %ld\n",
- pool_id, mem->total_space_allocated);
-
- for (lhdr_ptr = mem->large_list[pool_id]; lhdr_ptr != NULL;
- lhdr_ptr = lhdr_ptr->hdr.next) {
- FXSYS_fprintf(stderr, " Large chunk used %ld\n",
- (long) lhdr_ptr->hdr.bytes_used);
- }
-
- for (shdr_ptr = mem->small_list[pool_id]; shdr_ptr != NULL;
- shdr_ptr = shdr_ptr->hdr.next) {
- FXSYS_fprintf(stderr, " Small chunk used %ld free %ld\n",
- (long) shdr_ptr->hdr.bytes_used,
- (long) shdr_ptr->hdr.bytes_left);
- }
-}
-
-#endif /* MEM_STATS */
-
-
-LOCAL(void)
-out_of_memory (j_common_ptr cinfo, int which)
-/* Report an out-of-memory error and stop execution */
-/* If we compiled MEM_STATS support, report alloc requests before dying */
-{
-#ifdef MEM_STATS
- cinfo->err->trace_level = 2; /* force self_destruct to report stats */
-#endif
- ERREXIT1(cinfo, JERR_OUT_OF_MEMORY, which);
-}
-
-
-/*
- * Allocation of "small" objects.
- *
- * For these, we use pooled storage. When a new pool must be created,
- * we try to get enough space for the current request plus a "slop" factor,
- * where the slop will be the amount of leftover space in the new pool.
- * The speed vs. space tradeoff is largely determined by the slop values.
- * A different slop value is provided for each pool class (lifetime),
- * and we also distinguish the first pool of a class from later ones.
- * NOTE: the values given work fairly well on both 16- and 32-bit-int
- * machines, but may be too small if longs are 64 bits or more.
- */
-
-static const size_t first_pool_slop[JPOOL_NUMPOOLS] =
-{
- 1600, /* first PERMANENT pool */
- 16000 /* first IMAGE pool */
-};
-
-static const size_t extra_pool_slop[JPOOL_NUMPOOLS] =
-{
- 0, /* additional PERMANENT pools */
- 5000 /* additional IMAGE pools */
-};
-
-#define MIN_SLOP 50 /* greater than 0 to avoid futile looping */
-
-
-METHODDEF(void *)
-alloc_small (j_common_ptr cinfo, int pool_id, size_t sizeofobject)
-/* Allocate a "small" object */
-{
- my_mem_ptr mem = (my_mem_ptr) cinfo->mem;
- small_pool_ptr hdr_ptr, prev_hdr_ptr;
- char * data_ptr;
- size_t odd_bytes, min_request, slop;
-
- /* Check for unsatisfiable request (do now to ensure no overflow below) */
- if (sizeofobject > (size_t) (MAX_ALLOC_CHUNK-SIZEOF(small_pool_hdr)))
- out_of_memory(cinfo, 1); /* request exceeds malloc's ability */
-
- /* Round up the requested size to a multiple of SIZEOF(ALIGN_TYPE) */
- odd_bytes = sizeofobject % SIZEOF(ALIGN_TYPE);
- if (odd_bytes > 0)
- sizeofobject += SIZEOF(ALIGN_TYPE) - odd_bytes;
-
- /* See if space is available in any existing pool */
- if (pool_id < 0 || pool_id >= JPOOL_NUMPOOLS)
- ERREXIT1(cinfo, JERR_BAD_POOL_ID, pool_id); /* safety check */
- prev_hdr_ptr = NULL;
- hdr_ptr = mem->small_list[pool_id];
- while (hdr_ptr != NULL) {
- if (hdr_ptr->hdr.bytes_left >= sizeofobject)
- break; /* found pool with enough space */
- prev_hdr_ptr = hdr_ptr;
- hdr_ptr = hdr_ptr->hdr.next;
- }
-
- /* Time to make a new pool? */
- if (hdr_ptr == NULL) {
- /* min_request is what we need now, slop is what will be leftover */
- min_request = sizeofobject + SIZEOF(small_pool_hdr);
- if (prev_hdr_ptr == NULL) /* first pool in class? */
- slop = first_pool_slop[pool_id];
- else
- slop = extra_pool_slop[pool_id];
- /* Don't ask for more than MAX_ALLOC_CHUNK */
- if (slop > (size_t) (MAX_ALLOC_CHUNK-min_request))
- slop = (size_t) (MAX_ALLOC_CHUNK-min_request);
- /* Try to get space, if fail reduce slop and try again */
- for (;;) {
- hdr_ptr = (small_pool_ptr) jpeg_get_small(cinfo, min_request + slop);
- if (hdr_ptr != NULL)
- break;
- slop /= 2;
- if (slop < MIN_SLOP) /* give up when it gets real small */
- out_of_memory(cinfo, 2); /* jpeg_get_small failed */
- }
- mem->total_space_allocated += min_request + slop;
- /* Success, initialize the new pool header and add to end of list */
- hdr_ptr->hdr.next = NULL;
- hdr_ptr->hdr.bytes_used = 0;
- hdr_ptr->hdr.bytes_left = sizeofobject + slop;
- if (prev_hdr_ptr == NULL) /* first pool in class? */
- mem->small_list[pool_id] = hdr_ptr;
- else
- prev_hdr_ptr->hdr.next = hdr_ptr;
- }
-
- /* OK, allocate the object from the current pool */
- data_ptr = (char *) (hdr_ptr + 1); /* point to first data byte in pool */
- data_ptr += hdr_ptr->hdr.bytes_used; /* point to place for object */
- hdr_ptr->hdr.bytes_used += sizeofobject;
- hdr_ptr->hdr.bytes_left -= sizeofobject;
-
- return (void *) data_ptr;
-}
-
-
-/*
- * Allocation of "large" objects.
- *
- * The external semantics of these are the same as "small" objects,
- * except that FAR pointers are used on 80x86. However the pool
- * management heuristics are quite different. We assume that each
- * request is large enough that it may as well be passed directly to
- * jpeg_get_large; the pool management just links everything together
- * so that we can free it all on demand.
- * Note: the major use of "large" objects is in JSAMPARRAY and JBLOCKARRAY
- * structures. The routines that create these structures (see below)
- * deliberately bunch rows together to ensure a large request size.
- */
-
-METHODDEF(void FAR *)
-alloc_large (j_common_ptr cinfo, int pool_id, size_t sizeofobject)
-/* Allocate a "large" object */
-{
- my_mem_ptr mem = (my_mem_ptr) cinfo->mem;
- large_pool_ptr hdr_ptr;
- size_t odd_bytes;
-
- /* Check for unsatisfiable request (do now to ensure no overflow below) */
- if (sizeofobject > (size_t) (MAX_ALLOC_CHUNK-SIZEOF(large_pool_hdr)))
- out_of_memory(cinfo, 3); /* request exceeds malloc's ability */
-
- /* Round up the requested size to a multiple of SIZEOF(ALIGN_TYPE) */
- odd_bytes = sizeofobject % SIZEOF(ALIGN_TYPE);
- if (odd_bytes > 0)
- sizeofobject += SIZEOF(ALIGN_TYPE) - odd_bytes;
-
- /* Always make a new pool */
- if (pool_id < 0 || pool_id >= JPOOL_NUMPOOLS)
- ERREXIT1(cinfo, JERR_BAD_POOL_ID, pool_id); /* safety check */
-
- hdr_ptr = (large_pool_ptr) jpeg_get_large(cinfo, sizeofobject +
- SIZEOF(large_pool_hdr));
- if (hdr_ptr == NULL)
- out_of_memory(cinfo, 4); /* jpeg_get_large failed */
- mem->total_space_allocated += sizeofobject + SIZEOF(large_pool_hdr);
-
- /* Success, initialize the new pool header and add to list */
- hdr_ptr->hdr.next = mem->large_list[pool_id];
- /* We maintain space counts in each pool header for statistical purposes,
- * even though they are not needed for allocation.
- */
- hdr_ptr->hdr.bytes_used = sizeofobject;
- hdr_ptr->hdr.bytes_left = 0;
- mem->large_list[pool_id] = hdr_ptr;
-
- return (void FAR *) (hdr_ptr + 1); /* point to first data byte in pool */
-}
-
-
-/*
- * Creation of 2-D sample arrays.
- * The pointers are in near heap, the samples themselves in FAR heap.
- *
- * To minimize allocation overhead and to allow I/O of large contiguous
- * blocks, we allocate the sample rows in groups of as many rows as possible
- * without exceeding MAX_ALLOC_CHUNK total bytes per allocation request.
- * NB: the virtual array control routines, later in this file, know about
- * this chunking of rows. The rowsperchunk value is left in the mem manager
- * object so that it can be saved away if this sarray is the workspace for
- * a virtual array.
- */
-
-METHODDEF(JSAMPARRAY)
-alloc_sarray (j_common_ptr cinfo, int pool_id,
- JDIMENSION samplesperrow, JDIMENSION numrows)
-/* Allocate a 2-D sample array */
-{
- my_mem_ptr mem = (my_mem_ptr) cinfo->mem;
- JSAMPARRAY result;
- JSAMPROW workspace;
- JDIMENSION rowsperchunk, currow, i;
- long ltemp;
-
- /* Calculate max # of rows allowed in one allocation chunk */
- ltemp = (MAX_ALLOC_CHUNK-SIZEOF(large_pool_hdr)) /
- ((long) samplesperrow * SIZEOF(JSAMPLE));
- if (ltemp <= 0)
- ERREXIT(cinfo, JERR_WIDTH_OVERFLOW);
- if (ltemp < (long) numrows)
- rowsperchunk = (JDIMENSION) ltemp;
- else
- rowsperchunk = numrows;
- mem->last_rowsperchunk = rowsperchunk;
-
- /* Get space for row pointers (small object) */
- result = (JSAMPARRAY) alloc_small(cinfo, pool_id,
- (size_t) (numrows * SIZEOF(JSAMPROW)));
-
- /* Get the rows themselves (large objects) */
- currow = 0;
- while (currow < numrows) {
- rowsperchunk = MIN(rowsperchunk, numrows - currow);
- workspace = (JSAMPROW) alloc_large(cinfo, pool_id,
- (size_t) ((size_t) rowsperchunk * (size_t) samplesperrow
- * SIZEOF(JSAMPLE)));
- for (i = rowsperchunk; i > 0; i--) {
- result[currow++] = workspace;
- workspace += samplesperrow;
- }
- }
-
- return result;
-}
-
-
-/*
- * Creation of 2-D coefficient-block arrays.
- * This is essentially the same as the code for sample arrays, above.
- */
-
-METHODDEF(JBLOCKARRAY)
-alloc_barray (j_common_ptr cinfo, int pool_id,
- JDIMENSION blocksperrow, JDIMENSION numrows)
-/* Allocate a 2-D coefficient-block array */
-{
- my_mem_ptr mem = (my_mem_ptr) cinfo->mem;
- JBLOCKARRAY result;
- JBLOCKROW workspace;
- JDIMENSION rowsperchunk, currow, i;
- long ltemp;
-
- /* Calculate max # of rows allowed in one allocation chunk */
- ltemp = (MAX_ALLOC_CHUNK-SIZEOF(large_pool_hdr)) /
- ((long) blocksperrow * SIZEOF(JBLOCK));
- if (ltemp <= 0)
- ERREXIT(cinfo, JERR_WIDTH_OVERFLOW);
- if (ltemp < (long) numrows)
- rowsperchunk = (JDIMENSION) ltemp;
- else
- rowsperchunk = numrows;
- mem->last_rowsperchunk = rowsperchunk;
-
- /* Get space for row pointers (small object) */
- result = (JBLOCKARRAY) alloc_small(cinfo, pool_id,
- (size_t) (numrows * SIZEOF(JBLOCKROW)));
-
- /* Get the rows themselves (large objects) */
- currow = 0;
- while (currow < numrows) {
- rowsperchunk = MIN(rowsperchunk, numrows - currow);
- workspace = (JBLOCKROW) alloc_large(cinfo, pool_id,
- (size_t) ((size_t) rowsperchunk * (size_t) blocksperrow
- * SIZEOF(JBLOCK)));
- for (i = rowsperchunk; i > 0; i--) {
- result[currow++] = workspace;
- workspace += blocksperrow;
- }
- }
-
- return result;
-}
-
-
-/*
- * About virtual array management:
- *
- * The above "normal" array routines are only used to allocate strip buffers
- * (as wide as the image, but just a few rows high). Full-image-sized buffers
- * are handled as "virtual" arrays. The array is still accessed a strip at a
- * time, but the memory manager must save the whole array for repeated
- * accesses. The intended implementation is that there is a strip buffer in
- * memory (as high as is possible given the desired memory limit), plus a
- * backing file that holds the rest of the array.
- *
- * The request_virt_array routines are told the total size of the image and
- * the maximum number of rows that will be accessed at once. The in-memory
- * buffer must be at least as large as the maxaccess value.
- *
- * The request routines create control blocks but not the in-memory buffers.
- * That is postponed until realize_virt_arrays is called. At that time the
- * total amount of space needed is known (approximately, anyway), so free
- * memory can be divided up fairly.
- *
- * The access_virt_array routines are responsible for making a specific strip
- * area accessible (after reading or writing the backing file, if necessary).
- * Note that the access routines are told whether the caller intends to modify
- * the accessed strip; during a read-only pass this saves having to rewrite
- * data to disk. The access routines are also responsible for pre-zeroing
- * any newly accessed rows, if pre-zeroing was requested.
- *
- * In current usage, the access requests are usually for nonoverlapping
- * strips; that is, successive access start_row numbers differ by exactly
- * num_rows = maxaccess. This means we can get good performance with simple
- * buffer dump/reload logic, by making the in-memory buffer be a multiple
- * of the access height; then there will never be accesses across bufferload
- * boundaries. The code will still work with overlapping access requests,
- * but it doesn't handle bufferload overlaps very efficiently.
- */
-
-
-METHODDEF(jvirt_sarray_ptr)
-request_virt_sarray (j_common_ptr cinfo, int pool_id, boolean pre_zero,
- JDIMENSION samplesperrow, JDIMENSION numrows,
- JDIMENSION maxaccess)
-/* Request a virtual 2-D sample array */
-{
- my_mem_ptr mem = (my_mem_ptr) cinfo->mem;
- jvirt_sarray_ptr result;
-
- /* Only IMAGE-lifetime virtual arrays are currently supported */
- if (pool_id != JPOOL_IMAGE)
- ERREXIT1(cinfo, JERR_BAD_POOL_ID, pool_id); /* safety check */
-
- /* get control block */
- result = (jvirt_sarray_ptr) alloc_small(cinfo, pool_id,
- SIZEOF(struct jvirt_sarray_control));
-
- result->mem_buffer = NULL; /* marks array not yet realized */
- result->rows_in_array = numrows;
- result->samplesperrow = samplesperrow;
- result->maxaccess = maxaccess;
- result->pre_zero = pre_zero;
- result->b_s_open = FALSE; /* no associated backing-store object */
- result->next = mem->virt_sarray_list; /* add to list of virtual arrays */
- mem->virt_sarray_list = result;
-
- return result;
-}
-
-
-METHODDEF(jvirt_barray_ptr)
-request_virt_barray (j_common_ptr cinfo, int pool_id, boolean pre_zero,
- JDIMENSION blocksperrow, JDIMENSION numrows,
- JDIMENSION maxaccess)
-/* Request a virtual 2-D coefficient-block array */
-{
- my_mem_ptr mem = (my_mem_ptr) cinfo->mem;
- jvirt_barray_ptr result;
-
- /* Only IMAGE-lifetime virtual arrays are currently supported */
- if (pool_id != JPOOL_IMAGE)
- ERREXIT1(cinfo, JERR_BAD_POOL_ID, pool_id); /* safety check */
-
- /* get control block */
- result = (jvirt_barray_ptr) alloc_small(cinfo, pool_id,
- SIZEOF(struct jvirt_barray_control));
-
- result->mem_buffer = NULL; /* marks array not yet realized */
- result->rows_in_array = numrows;
- result->blocksperrow = blocksperrow;
- result->maxaccess = maxaccess;
- result->pre_zero = pre_zero;
- result->b_s_open = FALSE; /* no associated backing-store object */
- result->next = mem->virt_barray_list; /* add to list of virtual arrays */
- mem->virt_barray_list = result;
-
- return result;
-}
-
-
-METHODDEF(void)
-realize_virt_arrays (j_common_ptr cinfo)
-/* Allocate the in-memory buffers for any unrealized virtual arrays */
-{
- my_mem_ptr mem = (my_mem_ptr) cinfo->mem;
- long space_per_minheight, maximum_space, avail_mem;
- long minheights, max_minheights;
- jvirt_sarray_ptr sptr;
- jvirt_barray_ptr bptr;
-
- /* Compute the minimum space needed (maxaccess rows in each buffer)
- * and the maximum space needed (full image height in each buffer).
- * These may be of use to the system-dependent jpeg_mem_available routine.
- */
- space_per_minheight = 0;
- maximum_space = 0;
- for (sptr = mem->virt_sarray_list; sptr != NULL; sptr = sptr->next) {
- if (sptr->mem_buffer == NULL) { /* if not realized yet */
- space_per_minheight += (long) sptr->maxaccess *
- (long) sptr->samplesperrow * SIZEOF(JSAMPLE);
- maximum_space += (long) sptr->rows_in_array *
- (long) sptr->samplesperrow * SIZEOF(JSAMPLE);
- }
- }
- for (bptr = mem->virt_barray_list; bptr != NULL; bptr = bptr->next) {
- if (bptr->mem_buffer == NULL) { /* if not realized yet */
- space_per_minheight += (long) bptr->maxaccess *
- (long) bptr->blocksperrow * SIZEOF(JBLOCK);
- maximum_space += (long) bptr->rows_in_array *
- (long) bptr->blocksperrow * SIZEOF(JBLOCK);
- }
- }
-
- if (space_per_minheight <= 0)
- return; /* no unrealized arrays, no work */
-
- /* Determine amount of memory to actually use; this is system-dependent. */
- avail_mem = jpeg_mem_available(cinfo, space_per_minheight, maximum_space,
- mem->total_space_allocated);
-
- /* If the maximum space needed is available, make all the buffers full
- * height; otherwise parcel it out with the same number of minheights
- * in each buffer.
- */
- if (avail_mem >= maximum_space)
- max_minheights = 1000000000L;
- else {
- max_minheights = avail_mem / space_per_minheight;
- /* If there doesn't seem to be enough space, try to get the minimum
- * anyway. This allows a "stub" implementation of jpeg_mem_available().
- */
- if (max_minheights <= 0)
- max_minheights = 1;
- }
-
- /* Allocate the in-memory buffers and initialize backing store as needed. */
-
- for (sptr = mem->virt_sarray_list; sptr != NULL; sptr = sptr->next) {
- if (sptr->mem_buffer == NULL) { /* if not realized yet */
- minheights = ((long) sptr->rows_in_array - 1L) / sptr->maxaccess + 1L;
- if (minheights <= max_minheights) {
- /* This buffer fits in memory */
- sptr->rows_in_mem = sptr->rows_in_array;
- } else {
- /* It doesn't fit in memory, create backing store. */
- sptr->rows_in_mem = (JDIMENSION) (max_minheights * sptr->maxaccess);
- jpeg_open_backing_store(cinfo, & sptr->b_s_info,
- (long) sptr->rows_in_array *
- (long) sptr->samplesperrow *
- (long) SIZEOF(JSAMPLE));
- sptr->b_s_open = TRUE;
- }
- sptr->mem_buffer = alloc_sarray(cinfo, JPOOL_IMAGE,
- sptr->samplesperrow, sptr->rows_in_mem);
- sptr->rowsperchunk = mem->last_rowsperchunk;
- sptr->cur_start_row = 0;
- sptr->first_undef_row = 0;
- sptr->dirty = FALSE;
- }
- }
-
- for (bptr = mem->virt_barray_list; bptr != NULL; bptr = bptr->next) {
- if (bptr->mem_buffer == NULL) { /* if not realized yet */
- minheights = ((long) bptr->rows_in_array - 1L) / bptr->maxaccess + 1L;
- if (minheights <= max_minheights) {
- /* This buffer fits in memory */
- bptr->rows_in_mem = bptr->rows_in_array;
- } else {
- /* It doesn't fit in memory, create backing store. */
- bptr->rows_in_mem = (JDIMENSION) (max_minheights * bptr->maxaccess);
- jpeg_open_backing_store(cinfo, & bptr->b_s_info,
- (long) bptr->rows_in_array *
- (long) bptr->blocksperrow *
- (long) SIZEOF(JBLOCK));
- bptr->b_s_open = TRUE;
- }
- bptr->mem_buffer = alloc_barray(cinfo, JPOOL_IMAGE,
- bptr->blocksperrow, bptr->rows_in_mem);
- bptr->rowsperchunk = mem->last_rowsperchunk;
- bptr->cur_start_row = 0;
- bptr->first_undef_row = 0;
- bptr->dirty = FALSE;
- }
- }
-}
-
-
-LOCAL(void)
-do_sarray_io (j_common_ptr cinfo, jvirt_sarray_ptr ptr, boolean writing)
-/* Do backing store read or write of a virtual sample array */
-{
- long bytesperrow, file_offset, byte_count, rows, thisrow, i;
-
- bytesperrow = (long) ptr->samplesperrow * SIZEOF(JSAMPLE);
- file_offset = ptr->cur_start_row * bytesperrow;
- /* Loop to read or write each allocation chunk in mem_buffer */
- for (i = 0; i < (long) ptr->rows_in_mem; i += ptr->rowsperchunk) {
- /* One chunk, but check for short chunk at end of buffer */
- rows = MIN((long) ptr->rowsperchunk, (long) ptr->rows_in_mem - i);
- /* Transfer no more than is currently defined */
- thisrow = (long) ptr->cur_start_row + i;
- rows = MIN(rows, (long) ptr->first_undef_row - thisrow);
- /* Transfer no more than fits in file */
- rows = MIN(rows, (long) ptr->rows_in_array - thisrow);
- if (rows <= 0) /* this chunk might be past end of file! */
- break;
- byte_count = rows * bytesperrow;
- if (writing)
- (*ptr->b_s_info.write_backing_store) (cinfo, & ptr->b_s_info,
- (void FAR *) ptr->mem_buffer[i],
- file_offset, byte_count);
- else
- (*ptr->b_s_info.read_backing_store) (cinfo, & ptr->b_s_info,
- (void FAR *) ptr->mem_buffer[i],
- file_offset, byte_count);
- file_offset += byte_count;
- }
-}
-
-
-LOCAL(void)
-do_barray_io (j_common_ptr cinfo, jvirt_barray_ptr ptr, boolean writing)
-/* Do backing store read or write of a virtual coefficient-block array */
-{
- long bytesperrow, file_offset, byte_count, rows, thisrow, i;
-
- bytesperrow = (long) ptr->blocksperrow * SIZEOF(JBLOCK);
- file_offset = ptr->cur_start_row * bytesperrow;
- /* Loop to read or write each allocation chunk in mem_buffer */
- for (i = 0; i < (long) ptr->rows_in_mem; i += ptr->rowsperchunk) {
- /* One chunk, but check for short chunk at end of buffer */
- rows = MIN((long) ptr->rowsperchunk, (long) ptr->rows_in_mem - i);
- /* Transfer no more than is currently defined */
- thisrow = (long) ptr->cur_start_row + i;
- rows = MIN(rows, (long) ptr->first_undef_row - thisrow);
- /* Transfer no more than fits in file */
- rows = MIN(rows, (long) ptr->rows_in_array - thisrow);
- if (rows <= 0) /* this chunk might be past end of file! */
- break;
- byte_count = rows * bytesperrow;
- if (writing)
- (*ptr->b_s_info.write_backing_store) (cinfo, & ptr->b_s_info,
- (void FAR *) ptr->mem_buffer[i],
- file_offset, byte_count);
- else
- (*ptr->b_s_info.read_backing_store) (cinfo, & ptr->b_s_info,
- (void FAR *) ptr->mem_buffer[i],
- file_offset, byte_count);
- file_offset += byte_count;
- }
-}
-
-
-METHODDEF(JSAMPARRAY)
-access_virt_sarray (j_common_ptr cinfo, jvirt_sarray_ptr ptr,
- JDIMENSION start_row, JDIMENSION num_rows,
- boolean writable)
-/* Access the part of a virtual sample array starting at start_row */
-/* and extending for num_rows rows. writable is true if */
-/* caller intends to modify the accessed area. */
-{
- JDIMENSION end_row = start_row + num_rows;
- JDIMENSION undef_row;
-
- /* debugging check */
- if (end_row > ptr->rows_in_array || num_rows > ptr->maxaccess ||
- ptr->mem_buffer == NULL)
- ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS);
-
- /* Make the desired part of the virtual array accessible */
- if (start_row < ptr->cur_start_row ||
- end_row > ptr->cur_start_row+ptr->rows_in_mem) {
- if (! ptr->b_s_open)
- ERREXIT(cinfo, JERR_VIRTUAL_BUG);
- /* Flush old buffer contents if necessary */
- if (ptr->dirty) {
- do_sarray_io(cinfo, ptr, TRUE);
- ptr->dirty = FALSE;
- }
- /* Decide what part of virtual array to access.
- * Algorithm: if target address > current window, assume forward scan,
- * load starting at target address. If target address < current window,
- * assume backward scan, load so that target area is top of window.
- * Note that when switching from forward write to forward read, will have
- * start_row = 0, so the limiting case applies and we load from 0 anyway.
- */
- if (start_row > ptr->cur_start_row) {
- ptr->cur_start_row = start_row;
- } else {
- /* use long arithmetic here to avoid overflow & unsigned problems */
- long ltemp;
-
- ltemp = (long) end_row - (long) ptr->rows_in_mem;
- if (ltemp < 0)
- ltemp = 0; /* don't fall off front end of file */
- ptr->cur_start_row = (JDIMENSION) ltemp;
- }
- /* Read in the selected part of the array.
- * During the initial write pass, we will do no actual read
- * because the selected part is all undefined.
- */
- do_sarray_io(cinfo, ptr, FALSE);
- }
- /* Ensure the accessed part of the array is defined; prezero if needed.
- * To improve locality of access, we only prezero the part of the array
- * that the caller is about to access, not the entire in-memory array.
- */
- if (ptr->first_undef_row < end_row) {
- if (ptr->first_undef_row < start_row) {
- if (writable) /* writer skipped over a section of array */
- ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS);
- undef_row = start_row; /* but reader is allowed to read ahead */
- } else {
- undef_row = ptr->first_undef_row;
- }
- if (writable)
- ptr->first_undef_row = end_row;
- if (ptr->pre_zero) {
- size_t bytesperrow = (size_t) ptr->samplesperrow * SIZEOF(JSAMPLE);
- undef_row -= ptr->cur_start_row; /* make indexes relative to buffer */
- end_row -= ptr->cur_start_row;
- while (undef_row < end_row) {
- jzero_far((void FAR *) ptr->mem_buffer[undef_row], bytesperrow);
- undef_row++;
- }
- } else {
- if (! writable) /* reader looking at undefined data */
- ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS);
- }
- }
- /* Flag the buffer dirty if caller will write in it */
- if (writable)
- ptr->dirty = TRUE;
- /* Return address of proper part of the buffer */
- return ptr->mem_buffer + (start_row - ptr->cur_start_row);
-}
-
-
-METHODDEF(JBLOCKARRAY)
-access_virt_barray (j_common_ptr cinfo, jvirt_barray_ptr ptr,
- JDIMENSION start_row, JDIMENSION num_rows,
- boolean writable)
-/* Access the part of a virtual block array starting at start_row */
-/* and extending for num_rows rows. writable is true if */
-/* caller intends to modify the accessed area. */
-{
- JDIMENSION end_row = start_row + num_rows;
- JDIMENSION undef_row;
-
- /* debugging check */
- if (end_row > ptr->rows_in_array || num_rows > ptr->maxaccess ||
- ptr->mem_buffer == NULL)
- ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS);
-
- /* Make the desired part of the virtual array accessible */
- if (start_row < ptr->cur_start_row ||
- end_row > ptr->cur_start_row+ptr->rows_in_mem) {
- if (! ptr->b_s_open)
- ERREXIT(cinfo, JERR_VIRTUAL_BUG);
- /* Flush old buffer contents if necessary */
- if (ptr->dirty) {
- do_barray_io(cinfo, ptr, TRUE);
- ptr->dirty = FALSE;
- }
- /* Decide what part of virtual array to access.
- * Algorithm: if target address > current window, assume forward scan,
- * load starting at target address. If target address < current window,
- * assume backward scan, load so that target area is top of window.
- * Note that when switching from forward write to forward read, will have
- * start_row = 0, so the limiting case applies and we load from 0 anyway.
- */
- if (start_row > ptr->cur_start_row) {
- ptr->cur_start_row = start_row;
- } else {
- /* use long arithmetic here to avoid overflow & unsigned problems */
- long ltemp;
-
- ltemp = (long) end_row - (long) ptr->rows_in_mem;
- if (ltemp < 0)
- ltemp = 0; /* don't fall off front end of file */
- ptr->cur_start_row = (JDIMENSION) ltemp;
- }
- /* Read in the selected part of the array.
- * During the initial write pass, we will do no actual read
- * because the selected part is all undefined.
- */
- do_barray_io(cinfo, ptr, FALSE);
- }
- /* Ensure the accessed part of the array is defined; prezero if needed.
- * To improve locality of access, we only prezero the part of the array
- * that the caller is about to access, not the entire in-memory array.
- */
- if (ptr->first_undef_row < end_row) {
- if (ptr->first_undef_row < start_row) {
- if (writable) /* writer skipped over a section of array */
- ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS);
- undef_row = start_row; /* but reader is allowed to read ahead */
- } else {
- undef_row = ptr->first_undef_row;
- }
- if (writable)
- ptr->first_undef_row = end_row;
- if (ptr->pre_zero) {
- size_t bytesperrow = (size_t) ptr->blocksperrow * SIZEOF(JBLOCK);
- undef_row -= ptr->cur_start_row; /* make indexes relative to buffer */
- end_row -= ptr->cur_start_row;
- while (undef_row < end_row) {
- jzero_far((void FAR *) ptr->mem_buffer[undef_row], bytesperrow);
- undef_row++;
- }
- } else {
- if (! writable) /* reader looking at undefined data */
- ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS);
- }
- }
- /* Flag the buffer dirty if caller will write in it */
- if (writable)
- ptr->dirty = TRUE;
- /* Return address of proper part of the buffer */
- return ptr->mem_buffer + (start_row - ptr->cur_start_row);
-}
-
-
-/*
- * Release all objects belonging to a specified pool.
- */
-
-METHODDEF(void)
-free_pool (j_common_ptr cinfo, int pool_id)
-{
- my_mem_ptr mem = (my_mem_ptr) cinfo->mem;
- small_pool_ptr shdr_ptr;
- large_pool_ptr lhdr_ptr;
- size_t space_freed;
-
- if (pool_id < 0 || pool_id >= JPOOL_NUMPOOLS)
- ERREXIT1(cinfo, JERR_BAD_POOL_ID, pool_id); /* safety check */
-
-#ifdef MEM_STATS
- if (cinfo->err->trace_level > 1)
- print_mem_stats(cinfo, pool_id); /* print pool's memory usage statistics */
-#endif
-
- /* If freeing IMAGE pool, close any virtual arrays first */
- if (pool_id == JPOOL_IMAGE) {
- jvirt_sarray_ptr sptr;
- jvirt_barray_ptr bptr;
-
- for (sptr = mem->virt_sarray_list; sptr != NULL; sptr = sptr->next) {
- if (sptr->b_s_open) { /* there may be no backing store */
- sptr->b_s_open = FALSE; /* prevent recursive close if error */
- (*sptr->b_s_info.close_backing_store) (cinfo, & sptr->b_s_info);
- }
- }
- mem->virt_sarray_list = NULL;
- for (bptr = mem->virt_barray_list; bptr != NULL; bptr = bptr->next) {
- if (bptr->b_s_open) { /* there may be no backing store */
- bptr->b_s_open = FALSE; /* prevent recursive close if error */
- (*bptr->b_s_info.close_backing_store) (cinfo, & bptr->b_s_info);
- }
- }
- mem->virt_barray_list = NULL;
- }
-
- /* Release large objects */
- lhdr_ptr = mem->large_list[pool_id];
- mem->large_list[pool_id] = NULL;
-
- while (lhdr_ptr != NULL) {
- large_pool_ptr next_lhdr_ptr = lhdr_ptr->hdr.next;
- space_freed = lhdr_ptr->hdr.bytes_used +
- lhdr_ptr->hdr.bytes_left +
- SIZEOF(large_pool_hdr);
- jpeg_free_large(cinfo, (void FAR *) lhdr_ptr, space_freed);
- mem->total_space_allocated -= space_freed;
- lhdr_ptr = next_lhdr_ptr;
- }
-
- /* Release small objects */
- shdr_ptr = mem->small_list[pool_id];
- mem->small_list[pool_id] = NULL;
-
- while (shdr_ptr != NULL) {
- small_pool_ptr next_shdr_ptr = shdr_ptr->hdr.next;
- space_freed = shdr_ptr->hdr.bytes_used +
- shdr_ptr->hdr.bytes_left +
- SIZEOF(small_pool_hdr);
- jpeg_free_small(cinfo, (void *) shdr_ptr, space_freed);
- mem->total_space_allocated -= space_freed;
- shdr_ptr = next_shdr_ptr;
- }
-}
-
-
-/*
- * Close up shop entirely.
- * Note that this cannot be called unless cinfo->mem is non-NULL.
- */
-
-METHODDEF(void)
-self_destruct (j_common_ptr cinfo)
-{
- int pool;
-
- /* Close all backing store, release all memory.
- * Releasing pools in reverse order might help avoid fragmentation
- * with some (brain-damaged) malloc libraries.
- */
- for (pool = JPOOL_NUMPOOLS-1; pool >= JPOOL_PERMANENT; pool--) {
- free_pool(cinfo, pool);
- }
-
- /* Release the memory manager control block too. */
- jpeg_free_small(cinfo, (void *) cinfo->mem, SIZEOF(my_memory_mgr));
- cinfo->mem = NULL; /* ensures I will be called only once */
-
- jpeg_mem_term(cinfo); /* system-dependent cleanup */
-}
-
-
-/*
- * Memory manager initialization.
- * When this is called, only the error manager pointer is valid in cinfo!
- */
-
-GLOBAL(void)
-jinit_memory_mgr (j_common_ptr cinfo)
-{
- my_mem_ptr mem;
- long max_to_use;
- int pool;
- size_t test_mac;
-
- cinfo->mem = NULL; /* for safety if init fails */
-
- /* Check for configuration errors.
- * SIZEOF(ALIGN_TYPE) should be a power of 2; otherwise, it probably
- * doesn't reflect any real hardware alignment requirement.
- * The test is a little tricky: for X>0, X and X-1 have no one-bits
- * in common if and only if X is a power of 2, ie has only one one-bit.
- * Some compilers may give an "unreachable code" warning here; ignore it.
- */
- if ((SIZEOF(ALIGN_TYPE) & (SIZEOF(ALIGN_TYPE)-1)) != 0)
- ERREXIT(cinfo, JERR_BAD_ALIGN_TYPE);
- /* MAX_ALLOC_CHUNK must be representable as type size_t, and must be
- * a multiple of SIZEOF(ALIGN_TYPE).
- * Again, an "unreachable code" warning may be ignored here.
- * But a "constant too large" warning means you need to fix MAX_ALLOC_CHUNK.
- */
- test_mac = (size_t) MAX_ALLOC_CHUNK;
- if ((long) test_mac != MAX_ALLOC_CHUNK ||
- (MAX_ALLOC_CHUNK % SIZEOF(ALIGN_TYPE)) != 0)
- ERREXIT(cinfo, JERR_BAD_ALLOC_CHUNK);
-
- max_to_use = jpeg_mem_init(cinfo); /* system-dependent initialization */
-
- /* Attempt to allocate memory manager's control block */
- mem = (my_mem_ptr) jpeg_get_small(cinfo, SIZEOF(my_memory_mgr));
-
- if (mem == NULL) {
- jpeg_mem_term(cinfo); /* system-dependent cleanup */
- ERREXIT1(cinfo, JERR_OUT_OF_MEMORY, 0);
- }
-
- /* OK, fill in the method pointers */
- mem->pub.alloc_small = alloc_small;
- mem->pub.alloc_large = alloc_large;
- mem->pub.alloc_sarray = alloc_sarray;
- mem->pub.alloc_barray = alloc_barray;
- mem->pub.request_virt_sarray = request_virt_sarray;
- mem->pub.request_virt_barray = request_virt_barray;
- mem->pub.realize_virt_arrays = realize_virt_arrays;
- mem->pub.access_virt_sarray = access_virt_sarray;
- mem->pub.access_virt_barray = access_virt_barray;
- mem->pub.free_pool = free_pool;
- mem->pub.self_destruct = self_destruct;
-
- /* Make MAX_ALLOC_CHUNK accessible to other modules */
- mem->pub.max_alloc_chunk = MAX_ALLOC_CHUNK;
-
- /* Initialize working state */
- mem->pub.max_memory_to_use = max_to_use;
-
- for (pool = JPOOL_NUMPOOLS-1; pool >= JPOOL_PERMANENT; pool--) {
- mem->small_list[pool] = NULL;
- mem->large_list[pool] = NULL;
- }
- mem->virt_sarray_list = NULL;
- mem->virt_barray_list = NULL;
-
- mem->total_space_allocated = SIZEOF(my_memory_mgr);
-
- /* Declare ourselves open for business */
- cinfo->mem = & mem->pub;
-
- /* Check for an environment variable JPEGMEM; if found, override the
- * default max_memory setting from jpeg_mem_init. Note that the
- * surrounding application may again override this value.
- * If your system doesn't support getenv(), define NO_GETENV to disable
- * this feature.
- */
-#ifndef NO_GETENV
- { char * memenv;
-
- if ((memenv = getenv("JPEGMEM")) != NULL) {
- char ch = 'x';
-
- if (sscanf(memenv, "%ld%c", &max_to_use, &ch) > 0) {
- if (ch == 'm' || ch == 'M')
- max_to_use *= 1000L;
- mem->pub.max_memory_to_use = max_to_use * 1000L;
- }
- }
- }
-#endif
-
-}
diff --git a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jmemnobs.c b/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jmemnobs.c
deleted file mode 100644
index 0344f6fd738..00000000000
--- a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jmemnobs.c
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * jmemnobs.c
- *
- * Copyright (C) 1992-1996, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file provides a really simple implementation of the system-
- * dependent portion of the JPEG memory manager. This implementation
- * assumes that no backing-store files are needed: all required space
- * can be obtained from malloc().
- * This is very portable in the sense that it'll compile on almost anything,
- * but you'd better have lots of main memory (or virtual memory) if you want
- * to process big images.
- * Note that the max_memory_to_use option is ignored by this implementation.
- */
-
-#define JPEG_INTERNALS
-#include "jinclude.h"
-#include "jpeglib.h"
-#include "jmemsys.h" /* import the system-dependent declarations */
-
-#ifndef HAVE_STDLIB_H /* <stdlib.h> should declare malloc(),free() */
-extern void * malloc JPP((size_t size));
-extern void free JPP((void *ptr));
-#endif
-
-void* FXMEM_DefaultAlloc(int byte_size, int);
-void FXMEM_DefaultFree(void* pointer, int);
-
-/*
- * Memory allocation and freeing are controlled by the regular library
- * routines malloc() and free().
- */
-
-GLOBAL(void *)
-jpeg_get_small (j_common_ptr cinfo, size_t sizeofobject)
-{
-// return (void *) malloc(sizeofobject);
- return FXMEM_DefaultAlloc(sizeofobject, 0);
-}
-
-GLOBAL(void)
-jpeg_free_small (j_common_ptr cinfo, void * object, size_t sizeofobject)
-{
-// free(object);
- FXMEM_DefaultFree(object, 0);
-}
-
-
-/*
- * "Large" objects are treated the same as "small" ones.
- * NB: although we include FAR keywords in the routine declarations,
- * this file won't actually work in 80x86 small/medium model; at least,
- * you probably won't be able to process useful-size images in only 64KB.
- */
-
-GLOBAL(void FAR *)
-jpeg_get_large (j_common_ptr cinfo, size_t sizeofobject)
-{
-// return (void FAR *) malloc(sizeofobject);
- return FXMEM_DefaultAlloc(sizeofobject, 0);
-}
-
-GLOBAL(void)
-jpeg_free_large (j_common_ptr cinfo, void FAR * object, size_t sizeofobject)
-{
-// free(object);
- FXMEM_DefaultFree(object, 0);
-}
-
-
-/*
- * This routine computes the total memory space available for allocation.
- * Here we always say, "we got all you want bud!"
- */
-
-GLOBAL(long)
-jpeg_mem_available (j_common_ptr cinfo, long min_bytes_needed,
- long max_bytes_needed, long already_allocated)
-{
- return max_bytes_needed;
-}
-
-
-/*
- * Backing store (temporary file) management.
- * Since jpeg_mem_available always promised the moon,
- * this should never be called and we can just error out.
- */
-
-GLOBAL(void)
-jpeg_open_backing_store (j_common_ptr cinfo, backing_store_ptr info,
- long total_bytes_needed)
-{
- ERREXIT(cinfo, JERR_NO_BACKING_STORE);
-}
-
-
-/*
- * These routines take care of any system-dependent initialization and
- * cleanup required. Here, there isn't any.
- */
-
-GLOBAL(long)
-jpeg_mem_init (j_common_ptr cinfo)
-{
- return 0; /* just set max_memory_to_use to 0 */
-}
-
-GLOBAL(void)
-jpeg_mem_term (j_common_ptr cinfo)
-{
- /* no work */
-}
diff --git a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jutils.c b/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jutils.c
deleted file mode 100644
index d18a9555621..00000000000
--- a/chromium/third_party/pdfium/third_party/libjpeg/fpdfapi_jutils.c
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * jutils.c
- *
- * Copyright (C) 1991-1996, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file contains tables and miscellaneous utility routines needed
- * for both compression and decompression.
- * Note we prefix all global names with "j" to minimize conflicts with
- * a surrounding application.
- */
-
-#define JPEG_INTERNALS
-#include "jinclude.h"
-#include "jpeglib.h"
-
-
-/*
- * jpeg_zigzag_order[i] is the zigzag-order position of the i'th element
- * of a DCT block read in natural order (left to right, top to bottom).
- */
-
-#if 0 /* This table is not actually needed in v6a */
-
-const int jpeg_zigzag_order[DCTSIZE2] = {
- 0, 1, 5, 6, 14, 15, 27, 28,
- 2, 4, 7, 13, 16, 26, 29, 42,
- 3, 8, 12, 17, 25, 30, 41, 43,
- 9, 11, 18, 24, 31, 40, 44, 53,
- 10, 19, 23, 32, 39, 45, 52, 54,
- 20, 22, 33, 38, 46, 51, 55, 60,
- 21, 34, 37, 47, 50, 56, 59, 61,
- 35, 36, 48, 49, 57, 58, 62, 63
-};
-
-#endif
-
-/*
- * jpeg_natural_order[i] is the natural-order position of the i'th element
- * of zigzag order.
- *
- * When reading corrupted data, the Huffman decoders could attempt
- * to reference an entry beyond the end of this array (if the decoded
- * zero run length reaches past the end of the block). To prevent
- * wild stores without adding an inner-loop test, we put some extra
- * "63"s after the real entries. This will cause the extra coefficient
- * to be stored in location 63 of the block, not somewhere random.
- * The worst case would be a run-length of 15, which means we need 16
- * fake entries.
- */
-
-const int jpeg_natural_order[DCTSIZE2+16] = {
- 0, 1, 8, 16, 9, 2, 3, 10,
- 17, 24, 32, 25, 18, 11, 4, 5,
- 12, 19, 26, 33, 40, 48, 41, 34,
- 27, 20, 13, 6, 7, 14, 21, 28,
- 35, 42, 49, 56, 57, 50, 43, 36,
- 29, 22, 15, 23, 30, 37, 44, 51,
- 58, 59, 52, 45, 38, 31, 39, 46,
- 53, 60, 61, 54, 47, 55, 62, 63,
- 63, 63, 63, 63, 63, 63, 63, 63, /* extra entries for safety in decoder */
- 63, 63, 63, 63, 63, 63, 63, 63
-};
-
-
-/*
- * Arithmetic utilities
- */
-
-GLOBAL(long)
-jdiv_round_up (long a, long b)
-/* Compute a/b rounded up to next integer, ie, ceil(a/b) */
-/* Assumes a >= 0, b > 0 */
-{
- return (a + b - 1L) / b;
-}
-
-
-GLOBAL(long)
-jround_up (long a, long b)
-/* Compute a rounded up to next multiple of b, ie, ceil(a/b)*b */
-/* Assumes a >= 0, b > 0 */
-{
- a += b - 1L;
- return a - (a % b);
-}
-
-
-/* On normal machines we can apply MEMCOPY() and MEMZERO() to sample arrays
- * and coefficient-block arrays. This won't work on 80x86 because the arrays
- * are FAR and we're assuming a small-pointer memory model. However, some
- * DOS compilers provide far-pointer versions of memcpy() and memset() even
- * in the small-model libraries. These will be used if USE_FMEM is defined.
- * Otherwise, the routines below do it the hard way. (The performance cost
- * is not all that great, because these routines aren't very heavily used.)
- */
-
-#ifndef NEED_FAR_POINTERS /* normal case, same as regular macros */
-#define FMEMCOPY(dest,src,size) MEMCOPY(dest,src,size)
-#define FMEMZERO(target,size) MEMZERO(target,size)
-#else /* 80x86 case, define if we can */
-#ifdef USE_FMEM
-#define FMEMCOPY(dest,src,size) _fmemcpy((void FAR *)(dest), (const void FAR *)(src), (size_t)(size))
-#define FMEMZERO(target,size) _fmemset((void FAR *)(target), 0, (size_t)(size))
-#endif
-#endif
-
-
-GLOBAL(void)
-jcopy_sample_rows (JSAMPARRAY input_array, int source_row,
- JSAMPARRAY output_array, int dest_row,
- int num_rows, JDIMENSION num_cols)
-/* Copy some rows of samples from one place to another.
- * num_rows rows are copied from input_array[source_row++]
- * to output_array[dest_row++]; these areas may overlap for duplication.
- * The source and destination arrays must be at least as wide as num_cols.
- */
-{
- register JSAMPROW inptr, outptr;
-#ifdef FMEMCOPY
- register size_t count = (size_t) (num_cols * SIZEOF(JSAMPLE));
-#else
- register JDIMENSION count;
-#endif
- register int row;
-
- input_array += source_row;
- output_array += dest_row;
-
- for (row = num_rows; row > 0; row--) {
- inptr = *input_array++;
- outptr = *output_array++;
-#ifdef FMEMCOPY
- FMEMCOPY(outptr, inptr, count);
-#else
- for (count = num_cols; count > 0; count--)
- *outptr++ = *inptr++; /* needn't bother with GETJSAMPLE() here */
-#endif
- }
-}
-
-
-GLOBAL(void)
-jcopy_block_row (JBLOCKROW input_row, JBLOCKROW output_row,
- JDIMENSION num_blocks)
-/* Copy a row of coefficient blocks from one place to another. */
-{
-#ifdef FMEMCOPY
- FMEMCOPY(output_row, input_row, num_blocks * (DCTSIZE2 * SIZEOF(JCOEF)));
-#else
- register JCOEFPTR inptr, outptr;
- register long count;
-
- inptr = (JCOEFPTR) input_row;
- outptr = (JCOEFPTR) output_row;
- for (count = (long) num_blocks * DCTSIZE2; count > 0; count--) {
- *outptr++ = *inptr++;
- }
-#endif
-}
-
-
-GLOBAL(void)
-jzero_far (void FAR * target, size_t bytestozero)
-/* Zero out a chunk of FAR memory. */
-/* This might be sample-array data, block-array data, or alloc_large data. */
-{
-#ifdef FMEMZERO
- FMEMZERO(target, bytestozero);
-#else
- register char FAR * ptr = (char FAR *) target;
- register size_t count;
-
- for (count = bytestozero; count > 0; count--) {
- *ptr++ = 0;
- }
-#endif
-}
diff --git a/chromium/third_party/pdfium/third_party/libjpeg/jchuff.h b/chromium/third_party/pdfium/third_party/libjpeg/jchuff.h
deleted file mode 100644
index a9599fc1e6f..00000000000
--- a/chromium/third_party/pdfium/third_party/libjpeg/jchuff.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * jchuff.h
- *
- * Copyright (C) 1991-1997, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file contains declarations for Huffman entropy encoding routines
- * that are shared between the sequential encoder (jchuff.c) and the
- * progressive encoder (jcphuff.c). No other modules need to see these.
- */
-
-/* The legal range of a DCT coefficient is
- * -1024 .. +1023 for 8-bit data;
- * -16384 .. +16383 for 12-bit data.
- * Hence the magnitude should always fit in 10 or 14 bits respectively.
- */
-
-#if BITS_IN_JSAMPLE == 8
-#define MAX_COEF_BITS 10
-#else
-#define MAX_COEF_BITS 14
-#endif
-
-/* Derived data constructed for each Huffman table */
-
-typedef struct {
- unsigned int ehufco[256]; /* code for each symbol */
- char ehufsi[256]; /* length of code for each symbol */
- /* If no code has been allocated for a symbol S, ehufsi[S] contains 0 */
-} c_derived_tbl;
-
-/* Short forms of external names for systems with brain-damaged linkers. */
-
-#ifdef NEED_SHORT_EXTERNAL_NAMES
-#define jpeg_make_c_derived_tbl jMkCDerived
-#define jpeg_gen_optimal_table jGenOptTbl
-#endif /* NEED_SHORT_EXTERNAL_NAMES */
-
-/* Expand a Huffman table definition into the derived format */
-EXTERN(void) jpeg_make_c_derived_tbl
- JPP((j_compress_ptr cinfo, boolean isDC, int tblno,
- c_derived_tbl ** pdtbl));
-
-/* Generate an optimal table definition given the specified counts */
-EXTERN(void) jpeg_gen_optimal_table
- JPP((j_compress_ptr cinfo, JHUFF_TBL * htbl, long freq[]));
diff --git a/chromium/third_party/pdfium/third_party/libjpeg/jconfig.h b/chromium/third_party/pdfium/third_party/libjpeg/jconfig.h
deleted file mode 100644
index ea3c3977996..00000000000
--- a/chromium/third_party/pdfium/third_party/libjpeg/jconfig.h
+++ /dev/null
@@ -1,51 +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
-
-/* jconfig.vc --- jconfig.h for Microsoft Visual C++ on Windows 95 or NT. */
-/* see jconfig.doc for explanations */
-
-#define HAVE_PROTOTYPES
-#define HAVE_UNSIGNED_CHAR
-#define HAVE_UNSIGNED_SHORT
-/* #define void char */
-/* #define const */
-#undef CHAR_IS_UNSIGNED
-#define HAVE_STDDEF_H
-#define HAVE_STDLIB_H
-#undef NEED_BSD_STRINGS
-#undef NEED_SYS_TYPES_H
-#undef NEED_FAR_POINTERS /* we presume a 32-bit flat memory model */
-#undef NEED_SHORT_EXTERNAL_NAMES
-#undef INCOMPLETE_TYPES_BROKEN
-
-/* Define "boolean" as unsigned char, not int, per Windows custom */
-#ifndef __RPCNDR_H__ /* don't conflict if rpcndr.h already read */
-typedef unsigned char boolean;
-#endif
-#define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */
-
-
-#ifdef JPEG_INTERNALS
-
-#undef RIGHT_SHIFT_IS_UNSIGNED
-
-#endif /* JPEG_INTERNALS */
-
-#ifdef JPEG_CJPEG_DJPEG
-
-#define BMP_SUPPORTED /* BMP image file format */
-#define GIF_SUPPORTED /* GIF image file format */
-#define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */
-#undef RLE_SUPPORTED /* Utah RLE image file format */
-#define TARGA_SUPPORTED /* Targa image file format */
-
-#define TWO_FILE_COMMANDLINE /* optional */
-#define USE_SETMODE /* Microsoft has setmode() */
-#undef NEED_SIGNAL_CATCHER
-#undef DONT_USE_B_MODE
-#undef PROGRESS_REPORT /* optional */
-
-#endif /* JPEG_CJPEG_DJPEG */
diff --git a/chromium/third_party/pdfium/third_party/libjpeg/jdct.h b/chromium/third_party/pdfium/third_party/libjpeg/jdct.h
deleted file mode 100644
index 04192a266ae..00000000000
--- a/chromium/third_party/pdfium/third_party/libjpeg/jdct.h
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * jdct.h
- *
- * Copyright (C) 1994-1996, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This include file contains common declarations for the forward and
- * inverse DCT modules. These declarations are private to the DCT managers
- * (jcdctmgr.c, jddctmgr.c) and the individual DCT algorithms.
- * The individual DCT algorithms are kept in separate files to ease
- * machine-dependent tuning (e.g., assembly coding).
- */
-
-
-/*
- * A forward DCT routine is given a pointer to a work area of type DCTELEM[];
- * the DCT is to be performed in-place in that buffer. Type DCTELEM is int
- * for 8-bit samples, INT32 for 12-bit samples. (NOTE: Floating-point DCT
- * implementations use an array of type FAST_FLOAT, instead.)
- * The DCT inputs are expected to be signed (range +-CENTERJSAMPLE).
- * The DCT outputs are returned scaled up by a factor of 8; they therefore
- * have a range of +-8K for 8-bit data, +-128K for 12-bit data. This
- * convention improves accuracy in integer implementations and saves some
- * work in floating-point ones.
- * Quantization of the output coefficients is done by jcdctmgr.c.
- */
-
-#if BITS_IN_JSAMPLE == 8
-typedef int DCTELEM; /* 16 or 32 bits is fine */
-#else
-typedef INT32 DCTELEM; /* must have 32 bits */
-#endif
-
-typedef JMETHOD(void, forward_DCT_method_ptr, (DCTELEM * data));
-typedef JMETHOD(void, float_DCT_method_ptr, (FAST_FLOAT * data));
-
-
-/*
- * An inverse DCT routine is given a pointer to the input JBLOCK and a pointer
- * to an output sample array. The routine must dequantize the input data as
- * well as perform the IDCT; for dequantization, it uses the multiplier table
- * pointed to by compptr->dct_table. The output data is to be placed into the
- * sample array starting at a specified column. (Any row offset needed will
- * be applied to the array pointer before it is passed to the IDCT code.)
- * Note that the number of samples emitted by the IDCT routine is
- * DCT_scaled_size * DCT_scaled_size.
- */
-
-/* typedef inverse_DCT_method_ptr is declared in jpegint.h */
-
-/*
- * Each IDCT routine has its own ideas about the best dct_table element type.
- */
-
-typedef MULTIPLIER ISLOW_MULT_TYPE; /* short or int, whichever is faster */
-#if BITS_IN_JSAMPLE == 8
-typedef MULTIPLIER IFAST_MULT_TYPE; /* 16 bits is OK, use short if faster */
-#define IFAST_SCALE_BITS 2 /* fractional bits in scale factors */
-#else
-typedef INT32 IFAST_MULT_TYPE; /* need 32 bits for scaled quantizers */
-#define IFAST_SCALE_BITS 13 /* fractional bits in scale factors */
-#endif
-typedef FAST_FLOAT FLOAT_MULT_TYPE; /* preferred floating type */
-
-
-/*
- * Each IDCT routine is responsible for range-limiting its results and
- * converting them to unsigned form (0..MAXJSAMPLE). The raw outputs could
- * be quite far out of range if the input data is corrupt, so a bulletproof
- * range-limiting step is required. We use a mask-and-table-lookup method
- * to do the combined operations quickly. See the comments with
- * prepare_range_limit_table (in jdmaster.c) for more info.
- */
-
-#define IDCT_range_limit(cinfo) ((cinfo)->sample_range_limit + CENTERJSAMPLE)
-
-#define RANGE_MASK (MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
-
-
-/* Short forms of external names for systems with brain-damaged linkers. */
-
-#ifdef NEED_SHORT_EXTERNAL_NAMES
-#define jpeg_fdct_islow jFDislow
-#define jpeg_fdct_ifast jFDifast
-#define jpeg_fdct_float jFDfloat
-#define jpeg_idct_islow jRDislow
-#define jpeg_idct_ifast jRDifast
-#define jpeg_idct_float jRDfloat
-#define jpeg_idct_4x4 jRD4x4
-#define jpeg_idct_2x2 jRD2x2
-#define jpeg_idct_1x1 jRD1x1
-#endif /* NEED_SHORT_EXTERNAL_NAMES */
-
-/* Extern declarations for the forward and inverse DCT routines. */
-
-EXTERN(void) jpeg_fdct_islow JPP((DCTELEM * data));
-EXTERN(void) jpeg_fdct_ifast JPP((DCTELEM * data));
-EXTERN(void) jpeg_fdct_float JPP((FAST_FLOAT * data));
-
-EXTERN(void) jpeg_idct_islow
- JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
- JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
-EXTERN(void) jpeg_idct_ifast
- JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
- JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
-EXTERN(void) jpeg_idct_float
- JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
- JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
-EXTERN(void) jpeg_idct_4x4
- JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
- JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
-EXTERN(void) jpeg_idct_2x2
- JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
- JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
-EXTERN(void) jpeg_idct_1x1
- JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
- JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
-
-
-/*
- * Macros for handling fixed-point arithmetic; these are used by many
- * but not all of the DCT/IDCT modules.
- *
- * All values are expected to be of type INT32.
- * Fractional constants are scaled left by CONST_BITS bits.
- * CONST_BITS is defined within each module using these macros,
- * and may differ from one module to the next.
- */
-
-#define ONE ((INT32) 1)
-#define CONST_SCALE (ONE << CONST_BITS)
-
-/* Convert a positive real constant to an integer scaled by CONST_SCALE.
- * Caution: some C compilers fail to reduce "FIX(constant)" at compile time,
- * thus causing a lot of useless floating-point operations at run time.
- */
-
-#define FIX(x) ((INT32) ((x) * CONST_SCALE + 0.5))
-
-/* Descale and correctly round an INT32 value that's scaled by N bits.
- * We assume RIGHT_SHIFT rounds towards minus infinity, so adding
- * the fudge factor is correct for either sign of X.
- */
-
-#define DESCALE(x,n) RIGHT_SHIFT((x) + (ONE << ((n)-1)), n)
-
-/* Multiply an INT32 variable by an INT32 constant to yield an INT32 result.
- * This macro is used only when the two inputs will actually be no more than
- * 16 bits wide, so that a 16x16->32 bit multiply can be used instead of a
- * full 32x32 multiply. This provides a useful speedup on many machines.
- * Unfortunately there is no way to specify a 16x16->32 multiply portably
- * in C, but some C compilers will do the right thing if you provide the
- * correct combination of casts.
- */
-
-#ifdef SHORTxSHORT_32 /* may work if 'int' is 32 bits */
-#define MULTIPLY16C16(var,const) (((INT16) (var)) * ((INT16) (const)))
-#endif
-#ifdef SHORTxLCONST_32 /* known to work with Microsoft C 6.0 */
-#define MULTIPLY16C16(var,const) (((INT16) (var)) * ((INT32) (const)))
-#endif
-
-#ifndef MULTIPLY16C16 /* default definition */
-#define MULTIPLY16C16(var,const) ((var) * (const))
-#endif
-
-/* Same except both inputs are variables. */
-
-#ifdef SHORTxSHORT_32 /* may work if 'int' is 32 bits */
-#define MULTIPLY16V16(var1,var2) (((INT16) (var1)) * ((INT16) (var2)))
-#endif
-
-#ifndef MULTIPLY16V16 /* default definition */
-#define MULTIPLY16V16(var1,var2) ((var1) * (var2))
-#endif
diff --git a/chromium/third_party/pdfium/third_party/libjpeg/jdhuff.h b/chromium/third_party/pdfium/third_party/libjpeg/jdhuff.h
deleted file mode 100644
index ae19b6cafd7..00000000000
--- a/chromium/third_party/pdfium/third_party/libjpeg/jdhuff.h
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- * jdhuff.h
- *
- * Copyright (C) 1991-1997, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file contains declarations for Huffman entropy decoding routines
- * that are shared between the sequential decoder (jdhuff.c) and the
- * progressive decoder (jdphuff.c). No other modules need to see these.
- */
-
-/* Short forms of external names for systems with brain-damaged linkers. */
-
-#ifdef NEED_SHORT_EXTERNAL_NAMES
-#define jpeg_make_d_derived_tbl jMkDDerived
-#define jpeg_fill_bit_buffer jFilBitBuf
-#define jpeg_huff_decode jHufDecode
-#endif /* NEED_SHORT_EXTERNAL_NAMES */
-
-
-/* Derived data constructed for each Huffman table */
-
-#define HUFF_LOOKAHEAD 8 /* # of bits of lookahead */
-
-typedef struct {
- /* Basic tables: (element [0] of each array is unused) */
- INT32 maxcode[18]; /* largest code of length k (-1 if none) */
- /* (maxcode[17] is a sentinel to ensure jpeg_huff_decode terminates) */
- INT32 valoffset[17]; /* huffval[] offset for codes of length k */
- /* valoffset[k] = huffval[] index of 1st symbol of code length k, less
- * the smallest code of length k; so given a code of length k, the
- * corresponding symbol is huffval[code + valoffset[k]]
- */
-
- /* Link to public Huffman table (needed only in jpeg_huff_decode) */
- JHUFF_TBL *pub;
-
- /* Lookahead tables: indexed by the next HUFF_LOOKAHEAD bits of
- * the input data stream. If the next Huffman code is no more
- * than HUFF_LOOKAHEAD bits long, we can obtain its length and
- * the corresponding symbol directly from these tables.
- */
- int look_nbits[1<<HUFF_LOOKAHEAD]; /* # bits, or 0 if too long */
- UINT8 look_sym[1<<HUFF_LOOKAHEAD]; /* symbol, or unused */
-} d_derived_tbl;
-
-/* Expand a Huffman table definition into the derived format */
-EXTERN(void) jpeg_make_d_derived_tbl
- JPP((j_decompress_ptr cinfo, boolean isDC, int tblno,
- d_derived_tbl ** pdtbl));
-
-
-/*
- * Fetching the next N bits from the input stream is a time-critical operation
- * for the Huffman decoders. We implement it with a combination of inline
- * macros and out-of-line subroutines. Note that N (the number of bits
- * demanded at one time) never exceeds 15 for JPEG use.
- *
- * We read source bytes into get_buffer and dole out bits as needed.
- * If get_buffer already contains enough bits, they are fetched in-line
- * by the macros CHECK_BIT_BUFFER and GET_BITS. When there aren't enough
- * bits, jpeg_fill_bit_buffer is called; it will attempt to fill get_buffer
- * as full as possible (not just to the number of bits needed; this
- * prefetching reduces the overhead cost of calling jpeg_fill_bit_buffer).
- * Note that jpeg_fill_bit_buffer may return FALSE to indicate suspension.
- * On TRUE return, jpeg_fill_bit_buffer guarantees that get_buffer contains
- * at least the requested number of bits --- dummy zeroes are inserted if
- * necessary.
- */
-
-typedef INT32 bit_buf_type; /* type of bit-extraction buffer */
-#define BIT_BUF_SIZE 32 /* size of buffer in bits */
-
-/* If long is > 32 bits on your machine, and shifting/masking longs is
- * reasonably fast, making bit_buf_type be long and setting BIT_BUF_SIZE
- * appropriately should be a win. Unfortunately we can't define the size
- * with something like #define BIT_BUF_SIZE (sizeof(bit_buf_type)*8)
- * because not all machines measure sizeof in 8-bit bytes.
- */
-
-typedef struct { /* Bitreading state saved across MCUs */
- bit_buf_type get_buffer; /* current bit-extraction buffer */
- int bits_left; /* # of unused bits in it */
-} bitread_perm_state;
-
-typedef struct { /* Bitreading working state within an MCU */
- /* Current data source location */
- /* We need a copy, rather than munging the original, in case of suspension */
- const JOCTET * next_input_byte; /* => next byte to read from source */
- size_t bytes_in_buffer; /* # of bytes remaining in source buffer */
- /* Bit input buffer --- note these values are kept in register variables,
- * not in this struct, inside the inner loops.
- */
- bit_buf_type get_buffer; /* current bit-extraction buffer */
- int bits_left; /* # of unused bits in it */
- /* Pointer needed by jpeg_fill_bit_buffer. */
- j_decompress_ptr cinfo; /* back link to decompress master record */
-} bitread_working_state;
-
-/* Macros to declare and load/save bitread local variables. */
-#define BITREAD_STATE_VARS \
- register bit_buf_type get_buffer; \
- register int bits_left; \
- bitread_working_state br_state
-
-#define BITREAD_LOAD_STATE(cinfop,permstate) \
- br_state.cinfo = cinfop; \
- br_state.next_input_byte = cinfop->src->next_input_byte; \
- br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
- get_buffer = permstate.get_buffer; \
- bits_left = permstate.bits_left;
-
-#define BITREAD_SAVE_STATE(cinfop,permstate) \
- cinfop->src->next_input_byte = br_state.next_input_byte; \
- cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
- permstate.get_buffer = get_buffer; \
- permstate.bits_left = bits_left
-
-/*
- * These macros provide the in-line portion of bit fetching.
- * Use CHECK_BIT_BUFFER to ensure there are N bits in get_buffer
- * before using GET_BITS, PEEK_BITS, or DROP_BITS.
- * The variables get_buffer and bits_left are assumed to be locals,
- * but the state struct might not be (jpeg_huff_decode needs this).
- * CHECK_BIT_BUFFER(state,n,action);
- * Ensure there are N bits in get_buffer; if suspend, take action.
- * val = GET_BITS(n);
- * Fetch next N bits.
- * val = PEEK_BITS(n);
- * Fetch next N bits without removing them from the buffer.
- * DROP_BITS(n);
- * Discard next N bits.
- * The value N should be a simple variable, not an expression, because it
- * is evaluated multiple times.
- */
-
-#define CHECK_BIT_BUFFER(state,nbits,action) \
- { if (bits_left < (nbits)) { \
- if (! jpeg_fill_bit_buffer(&(state),get_buffer,bits_left,nbits)) \
- { action; } \
- get_buffer = (state).get_buffer; bits_left = (state).bits_left; } }
-
-#define GET_BITS(nbits) \
- (((int) (get_buffer >> (bits_left -= (nbits)))) & ((1<<(nbits))-1))
-
-#define PEEK_BITS(nbits) \
- (((int) (get_buffer >> (bits_left - (nbits)))) & ((1<<(nbits))-1))
-
-#define DROP_BITS(nbits) \
- (bits_left -= (nbits))
-
-/* Load up the bit buffer to a depth of at least nbits */
-EXTERN(boolean) jpeg_fill_bit_buffer
- JPP((bitread_working_state * state, register bit_buf_type get_buffer,
- register int bits_left, int nbits));
-
-
-/*
- * Code for extracting next Huffman-coded symbol from input bit stream.
- * Again, this is time-critical and we make the main paths be macros.
- *
- * We use a lookahead table to process codes of up to HUFF_LOOKAHEAD bits
- * without looping. Usually, more than 95% of the Huffman codes will be 8
- * or fewer bits long. The few overlength codes are handled with a loop,
- * which need not be inline code.
- *
- * Notes about the HUFF_DECODE macro:
- * 1. Near the end of the data segment, we may fail to get enough bits
- * for a lookahead. In that case, we do it the hard way.
- * 2. If the lookahead table contains no entry, the next code must be
- * more than HUFF_LOOKAHEAD bits long.
- * 3. jpeg_huff_decode returns -1 if forced to suspend.
- */
-
-#define HUFF_DECODE(result,state,htbl,failaction,slowlabel) \
-{ register int nb, look; \
- if (bits_left < HUFF_LOOKAHEAD) { \
- if (! jpeg_fill_bit_buffer(&state,get_buffer,bits_left, 0)) {failaction;} \
- get_buffer = state.get_buffer; bits_left = state.bits_left; \
- if (bits_left < HUFF_LOOKAHEAD) { \
- nb = 1; goto slowlabel; \
- } \
- } \
- look = PEEK_BITS(HUFF_LOOKAHEAD); \
- if ((nb = htbl->look_nbits[look]) != 0) { \
- DROP_BITS(nb); \
- result = htbl->look_sym[look]; \
- } else { \
- nb = HUFF_LOOKAHEAD+1; \
-slowlabel: \
- if ((result=jpeg_huff_decode(&state,get_buffer,bits_left,htbl,nb)) < 0) \
- { failaction; } \
- get_buffer = state.get_buffer; bits_left = state.bits_left; \
- } \
-}
-
-/* Out-of-line case for Huffman code fetching */
-EXTERN(int) jpeg_huff_decode
- JPP((bitread_working_state * state, register bit_buf_type get_buffer,
- register int bits_left, d_derived_tbl * htbl, int min_bits));
diff --git a/chromium/third_party/pdfium/third_party/libjpeg/jerror.h b/chromium/third_party/pdfium/third_party/libjpeg/jerror.h
deleted file mode 100644
index 06d344067a3..00000000000
--- a/chromium/third_party/pdfium/third_party/libjpeg/jerror.h
+++ /dev/null
@@ -1,291 +0,0 @@
-/*
- * jerror.h
- *
- * Copyright (C) 1994-1997, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file defines the error and message codes for the JPEG library.
- * Edit this file to add new codes, or to translate the message strings to
- * some other language.
- * A set of error-reporting macros are defined too. Some applications using
- * the JPEG library may wish to include this file to get the error codes
- * and/or the macros.
- */
-
-/*
- * To define the enum list of message codes, include this file without
- * defining macro JMESSAGE. To create a message string table, include it
- * again with a suitable JMESSAGE definition (see jerror.c for an example).
- */
-#ifndef JMESSAGE
-#ifndef JERROR_H
-/* First time through, define the enum list */
-#define JMAKE_ENUM_LIST
-#else
-/* Repeated inclusions of this file are no-ops unless JMESSAGE is defined */
-#define JMESSAGE(code,string)
-#endif /* JERROR_H */
-#endif /* JMESSAGE */
-
-#ifdef JMAKE_ENUM_LIST
-
-typedef enum {
-
-#define JMESSAGE(code,string) code ,
-
-#endif /* JMAKE_ENUM_LIST */
-
-JMESSAGE(JMSG_NOMESSAGE, "Bogus message code %d") /* Must be first entry! */
-
-/* For maintenance convenience, list is alphabetical by message code name */
-JMESSAGE(JERR_ARITH_NOTIMPL,
- "Sorry, there are legal restrictions on arithmetic coding")
-JMESSAGE(JERR_BAD_ALIGN_TYPE, "ALIGN_TYPE is wrong, please fix")
-JMESSAGE(JERR_BAD_ALLOC_CHUNK, "MAX_ALLOC_CHUNK is wrong, please fix")
-JMESSAGE(JERR_BAD_BUFFER_MODE, "Bogus buffer control mode")
-JMESSAGE(JERR_BAD_COMPONENT_ID, "Invalid component ID %d in SOS")
-JMESSAGE(JERR_BAD_DCT_COEF, "DCT coefficient out of range")
-JMESSAGE(JERR_BAD_DCTSIZE, "IDCT output block size %d not supported")
-JMESSAGE(JERR_BAD_HUFF_TABLE, "Bogus Huffman table definition")
-JMESSAGE(JERR_BAD_IN_COLORSPACE, "Bogus input colorspace")
-JMESSAGE(JERR_BAD_J_COLORSPACE, "Bogus JPEG colorspace")
-JMESSAGE(JERR_BAD_LENGTH, "Bogus marker length")
-JMESSAGE(JERR_BAD_LIB_VERSION,
- "Wrong JPEG library version: library is %d, caller expects %d")
-JMESSAGE(JERR_BAD_MCU_SIZE, "Sampling factors too large for interleaved scan")
-JMESSAGE(JERR_BAD_POOL_ID, "Invalid memory pool code %d")
-JMESSAGE(JERR_BAD_PRECISION, "Unsupported JPEG data precision %d")
-JMESSAGE(JERR_BAD_PROGRESSION,
- "Invalid progressive parameters Ss=%d Se=%d Ah=%d Al=%d")
-JMESSAGE(JERR_BAD_PROG_SCRIPT,
- "Invalid progressive parameters at scan script entry %d")
-JMESSAGE(JERR_BAD_SAMPLING, "Bogus sampling factors")
-JMESSAGE(JERR_BAD_SCAN_SCRIPT, "Invalid scan script at entry %d")
-JMESSAGE(JERR_BAD_STATE, "Improper call to JPEG library in state %d")
-JMESSAGE(JERR_BAD_STRUCT_SIZE,
- "JPEG parameter struct mismatch: library thinks size is %u, caller expects %u")
-JMESSAGE(JERR_BAD_VIRTUAL_ACCESS, "Bogus virtual array access")
-JMESSAGE(JERR_BUFFER_SIZE, "Buffer passed to JPEG library is too small")
-JMESSAGE(JERR_CANT_SUSPEND, "Suspension not allowed here")
-JMESSAGE(JERR_CCIR601_NOTIMPL, "CCIR601 sampling not implemented yet")
-JMESSAGE(JERR_COMPONENT_COUNT, "Too many color components: %d, max %d")
-JMESSAGE(JERR_CONVERSION_NOTIMPL, "Unsupported color conversion request")
-JMESSAGE(JERR_DAC_INDEX, "Bogus DAC index %d")
-JMESSAGE(JERR_DAC_VALUE, "Bogus DAC value 0x%x")
-JMESSAGE(JERR_DHT_INDEX, "Bogus DHT index %d")
-JMESSAGE(JERR_DQT_INDEX, "Bogus DQT index %d")
-JMESSAGE(JERR_EMPTY_IMAGE, "Empty JPEG image (DNL not supported)")
-JMESSAGE(JERR_EMS_READ, "Read from EMS failed")
-JMESSAGE(JERR_EMS_WRITE, "Write to EMS failed")
-JMESSAGE(JERR_EOI_EXPECTED, "Didn't expect more than one scan")
-JMESSAGE(JERR_FILE_READ, "Input file read error")
-JMESSAGE(JERR_FILE_WRITE, "Output file write error --- out of disk space?")
-JMESSAGE(JERR_FRACT_SAMPLE_NOTIMPL, "Fractional sampling not implemented yet")
-JMESSAGE(JERR_HUFF_CLEN_OVERFLOW, "Huffman code size table overflow")
-JMESSAGE(JERR_HUFF_MISSING_CODE, "Missing Huffman code table entry")
-JMESSAGE(JERR_IMAGE_TOO_BIG, "Maximum supported image dimension is %u pixels")
-JMESSAGE(JERR_INPUT_EMPTY, "Empty input file")
-JMESSAGE(JERR_INPUT_EOF, "Premature end of input file")
-JMESSAGE(JERR_MISMATCHED_QUANT_TABLE,
- "Cannot transcode due to multiple use of quantization table %d")
-JMESSAGE(JERR_MISSING_DATA, "Scan script does not transmit all data")
-JMESSAGE(JERR_MODE_CHANGE, "Invalid color quantization mode change")
-JMESSAGE(JERR_NOTIMPL, "Not implemented yet")
-JMESSAGE(JERR_NOT_COMPILED, "Requested feature was omitted at compile time")
-JMESSAGE(JERR_NO_BACKING_STORE, "Backing store not supported")
-JMESSAGE(JERR_NO_HUFF_TABLE, "Huffman table 0x%02x was not defined")
-JMESSAGE(JERR_NO_IMAGE, "JPEG datastream contains no image")
-JMESSAGE(JERR_NO_QUANT_TABLE, "Quantization table 0x%02x was not defined")
-JMESSAGE(JERR_NO_SOI, "Not a JPEG file: starts with 0x%02x 0x%02x")
-JMESSAGE(JERR_OUT_OF_MEMORY, "Insufficient memory (case %d)")
-JMESSAGE(JERR_QUANT_COMPONENTS,
- "Cannot quantize more than %d color components")
-JMESSAGE(JERR_QUANT_FEW_COLORS, "Cannot quantize to fewer than %d colors")
-JMESSAGE(JERR_QUANT_MANY_COLORS, "Cannot quantize to more than %d colors")
-JMESSAGE(JERR_SOF_DUPLICATE, "Invalid JPEG file structure: two SOF markers")
-JMESSAGE(JERR_SOF_NO_SOS, "Invalid JPEG file structure: missing SOS marker")
-JMESSAGE(JERR_SOF_UNSUPPORTED, "Unsupported JPEG process: SOF type 0x%02x")
-JMESSAGE(JERR_SOI_DUPLICATE, "Invalid JPEG file structure: two SOI markers")
-JMESSAGE(JERR_SOS_NO_SOF, "Invalid JPEG file structure: SOS before SOF")
-JMESSAGE(JERR_TFILE_CREATE, "Failed to create temporary file %s")
-JMESSAGE(JERR_TFILE_READ, "Read failed on temporary file")
-JMESSAGE(JERR_TFILE_SEEK, "Seek failed on temporary file")
-JMESSAGE(JERR_TFILE_WRITE,
- "Write failed on temporary file --- out of disk space?")
-JMESSAGE(JERR_TOO_LITTLE_DATA, "Application transferred too few scanlines")
-JMESSAGE(JERR_UNKNOWN_MARKER, "Unsupported marker type 0x%02x")
-JMESSAGE(JERR_VIRTUAL_BUG, "Virtual array controller messed up")
-JMESSAGE(JERR_WIDTH_OVERFLOW, "Image too wide for this implementation")
-JMESSAGE(JERR_XMS_READ, "Read from XMS failed")
-JMESSAGE(JERR_XMS_WRITE, "Write to XMS failed")
-JMESSAGE(JMSG_COPYRIGHT, JCOPYRIGHT)
-JMESSAGE(JMSG_VERSION, JVERSION)
-JMESSAGE(JTRC_16BIT_TABLES,
- "Caution: quantization tables are too coarse for baseline JPEG")
-JMESSAGE(JTRC_ADOBE,
- "Adobe APP14 marker: version %d, flags 0x%04x 0x%04x, transform %d")
-JMESSAGE(JTRC_APP0, "Unknown APP0 marker (not JFIF), length %u")
-JMESSAGE(JTRC_APP14, "Unknown APP14 marker (not Adobe), length %u")
-JMESSAGE(JTRC_DAC, "Define Arithmetic Table 0x%02x: 0x%02x")
-JMESSAGE(JTRC_DHT, "Define Huffman Table 0x%02x")
-JMESSAGE(JTRC_DQT, "Define Quantization Table %d precision %d")
-JMESSAGE(JTRC_DRI, "Define Restart Interval %u")
-JMESSAGE(JTRC_EMS_CLOSE, "Freed EMS handle %u")
-JMESSAGE(JTRC_EMS_OPEN, "Obtained EMS handle %u")
-JMESSAGE(JTRC_EOI, "End Of Image")
-JMESSAGE(JTRC_HUFFBITS, " %3d %3d %3d %3d %3d %3d %3d %3d")
-JMESSAGE(JTRC_JFIF, "JFIF APP0 marker: version %d.%02d, density %dx%d %d")
-JMESSAGE(JTRC_JFIF_BADTHUMBNAILSIZE,
- "Warning: thumbnail image size does not match data length %u")
-JMESSAGE(JTRC_JFIF_EXTENSION,
- "JFIF extension marker: type 0x%02x, length %u")
-JMESSAGE(JTRC_JFIF_THUMBNAIL, " with %d x %d thumbnail image")
-JMESSAGE(JTRC_MISC_MARKER, "Miscellaneous marker 0x%02x, length %u")
-JMESSAGE(JTRC_PARMLESS_MARKER, "Unexpected marker 0x%02x")
-JMESSAGE(JTRC_QUANTVALS, " %4u %4u %4u %4u %4u %4u %4u %4u")
-JMESSAGE(JTRC_QUANT_3_NCOLORS, "Quantizing to %d = %d*%d*%d colors")
-JMESSAGE(JTRC_QUANT_NCOLORS, "Quantizing to %d colors")
-JMESSAGE(JTRC_QUANT_SELECTED, "Selected %d colors for quantization")
-JMESSAGE(JTRC_RECOVERY_ACTION, "At marker 0x%02x, recovery action %d")
-JMESSAGE(JTRC_RST, "RST%d")
-JMESSAGE(JTRC_SMOOTH_NOTIMPL,
- "Smoothing not supported with nonstandard sampling ratios")
-JMESSAGE(JTRC_SOF, "Start Of Frame 0x%02x: width=%u, height=%u, components=%d")
-JMESSAGE(JTRC_SOF_COMPONENT, " Component %d: %dhx%dv q=%d")
-JMESSAGE(JTRC_SOI, "Start of Image")
-JMESSAGE(JTRC_SOS, "Start Of Scan: %d components")
-JMESSAGE(JTRC_SOS_COMPONENT, " Component %d: dc=%d ac=%d")
-JMESSAGE(JTRC_SOS_PARAMS, " Ss=%d, Se=%d, Ah=%d, Al=%d")
-JMESSAGE(JTRC_TFILE_CLOSE, "Closed temporary file %s")
-JMESSAGE(JTRC_TFILE_OPEN, "Opened temporary file %s")
-JMESSAGE(JTRC_THUMB_JPEG,
- "JFIF extension marker: JPEG-compressed thumbnail image, length %u")
-JMESSAGE(JTRC_THUMB_PALETTE,
- "JFIF extension marker: palette thumbnail image, length %u")
-JMESSAGE(JTRC_THUMB_RGB,
- "JFIF extension marker: RGB thumbnail image, length %u")
-JMESSAGE(JTRC_UNKNOWN_IDS,
- "Unrecognized component IDs %d %d %d, assuming YCbCr")
-JMESSAGE(JTRC_XMS_CLOSE, "Freed XMS handle %u")
-JMESSAGE(JTRC_XMS_OPEN, "Obtained XMS handle %u")
-JMESSAGE(JWRN_ADOBE_XFORM, "Unknown Adobe color transform code %d")
-JMESSAGE(JWRN_BOGUS_PROGRESSION,
- "Inconsistent progression sequence for component %d coefficient %d")
-JMESSAGE(JWRN_EXTRANEOUS_DATA,
- "Corrupt JPEG data: %u extraneous bytes before marker 0x%02x")
-JMESSAGE(JWRN_HIT_MARKER, "Corrupt JPEG data: premature end of data segment")
-JMESSAGE(JWRN_HUFF_BAD_CODE, "Corrupt JPEG data: bad Huffman code")
-JMESSAGE(JWRN_JFIF_MAJOR, "Warning: unknown JFIF revision number %d.%02d")
-JMESSAGE(JWRN_JPEG_EOF, "Premature end of JPEG file")
-JMESSAGE(JWRN_MUST_RESYNC,
- "Corrupt JPEG data: found marker 0x%02x instead of RST%d")
-JMESSAGE(JWRN_NOT_SEQUENTIAL, "Invalid SOS parameters for sequential JPEG")
-JMESSAGE(JWRN_TOO_MUCH_DATA, "Application transferred too many scanlines")
-
-#ifdef JMAKE_ENUM_LIST
-
- JMSG_LASTMSGCODE
-} J_MESSAGE_CODE;
-
-#undef JMAKE_ENUM_LIST
-#endif /* JMAKE_ENUM_LIST */
-
-/* Zap JMESSAGE macro so that future re-inclusions do nothing by default */
-#undef JMESSAGE
-
-
-#ifndef JERROR_H
-#define JERROR_H
-
-/* Macros to simplify using the error and trace message stuff */
-/* The first parameter is either type of cinfo pointer */
-
-/* Fatal errors (print message and exit) */
-#define ERREXIT(cinfo,code) \
- ((cinfo)->err->msg_code = (code), \
- (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))
-#define ERREXIT1(cinfo,code,p1) \
- ((cinfo)->err->msg_code = (code), \
- (cinfo)->err->msg_parm.i[0] = (p1), \
- (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))
-#define ERREXIT2(cinfo,code,p1,p2) \
- ((cinfo)->err->msg_code = (code), \
- (cinfo)->err->msg_parm.i[0] = (p1), \
- (cinfo)->err->msg_parm.i[1] = (p2), \
- (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))
-#define ERREXIT3(cinfo,code,p1,p2,p3) \
- ((cinfo)->err->msg_code = (code), \
- (cinfo)->err->msg_parm.i[0] = (p1), \
- (cinfo)->err->msg_parm.i[1] = (p2), \
- (cinfo)->err->msg_parm.i[2] = (p3), \
- (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))
-#define ERREXIT4(cinfo,code,p1,p2,p3,p4) \
- ((cinfo)->err->msg_code = (code), \
- (cinfo)->err->msg_parm.i[0] = (p1), \
- (cinfo)->err->msg_parm.i[1] = (p2), \
- (cinfo)->err->msg_parm.i[2] = (p3), \
- (cinfo)->err->msg_parm.i[3] = (p4), \
- (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))
-#define ERREXITS(cinfo,code,str) \
- ((cinfo)->err->msg_code = (code), \
- FXSYS_strncpy((cinfo)->err->msg_parm.s, (str), JMSG_STR_PARM_MAX), \
- (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))
-
-#define MAKESTMT(stuff) do { stuff } while (0)
-
-/* Nonfatal errors (we can keep going, but the data is probably corrupt) */
-#define WARNMS(cinfo,code) \
- ((cinfo)->err->msg_code = (code), \
- (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), -1))
-#define WARNMS1(cinfo,code,p1) \
- ((cinfo)->err->msg_code = (code), \
- (cinfo)->err->msg_parm.i[0] = (p1), \
- (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), -1))
-#define WARNMS2(cinfo,code,p1,p2) \
- ((cinfo)->err->msg_code = (code), \
- (cinfo)->err->msg_parm.i[0] = (p1), \
- (cinfo)->err->msg_parm.i[1] = (p2), \
- (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), -1))
-
-/* Informational/debugging messages */
-#define TRACEMS(cinfo,lvl,code) \
- ((cinfo)->err->msg_code = (code), \
- (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)))
-#define TRACEMS1(cinfo,lvl,code,p1) \
- ((cinfo)->err->msg_code = (code), \
- (cinfo)->err->msg_parm.i[0] = (p1), \
- (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)))
-#define TRACEMS2(cinfo,lvl,code,p1,p2) \
- ((cinfo)->err->msg_code = (code), \
- (cinfo)->err->msg_parm.i[0] = (p1), \
- (cinfo)->err->msg_parm.i[1] = (p2), \
- (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)))
-#define TRACEMS3(cinfo,lvl,code,p1,p2,p3) \
- MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \
- _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); \
- (cinfo)->err->msg_code = (code); \
- (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); )
-#define TRACEMS4(cinfo,lvl,code,p1,p2,p3,p4) \
- MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \
- _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \
- (cinfo)->err->msg_code = (code); \
- (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); )
-#define TRACEMS5(cinfo,lvl,code,p1,p2,p3,p4,p5) \
- MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \
- _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \
- _mp[4] = (p5); \
- (cinfo)->err->msg_code = (code); \
- (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); )
-#define TRACEMS8(cinfo,lvl,code,p1,p2,p3,p4,p5,p6,p7,p8) \
- MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \
- _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \
- _mp[4] = (p5); _mp[5] = (p6); _mp[6] = (p7); _mp[7] = (p8); \
- (cinfo)->err->msg_code = (code); \
- (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); )
-#define TRACEMSS(cinfo,lvl,code,str) \
- ((cinfo)->err->msg_code = (code), \
- FXSYS_strncpy((cinfo)->err->msg_parm.s, (str), JMSG_STR_PARM_MAX), \
- (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)))
-
-#endif /* JERROR_H */
diff --git a/chromium/third_party/pdfium/third_party/libjpeg/jinclude.h b/chromium/third_party/pdfium/third_party/libjpeg/jinclude.h
deleted file mode 100644
index 6f6a87c79ea..00000000000
--- a/chromium/third_party/pdfium/third_party/libjpeg/jinclude.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * jinclude.h
- *
- * Copyright (C) 1991-1994, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file exists to provide a single place to fix any problems with
- * including the wrong system include files. (Common problems are taken
- * care of by the standard jconfig symbols, but on really weird systems
- * you may have to edit this file.)
- *
- * NOTE: this file is NOT intended to be included by applications using the
- * JPEG library. Most applications need only include jpeglib.h.
- */
-
-
-/* Include auto-config file to find out which system include files we need. */
-
-#include "jconfig.h" /* auto configuration options */
-#define JCONFIG_INCLUDED /* so that jpeglib.h doesn't do it again */
-
-#include "core/fxcrt/fx_system.h"
-
-/*
- * We need the NULL macro and size_t typedef.
- * On an ANSI-conforming system it is sufficient to include <stddef.h>.
- * Otherwise, we get them from <stdlib.h> or <stdio.h>; we may have to
- * pull in <sys/types.h> as well.
- * Note that the core JPEG library does not require <stdio.h>;
- * only the default error handler and data source/destination modules do.
- * But we must pull it in because of the references to FILE in jpeglib.h.
- * You can remove those references if you want to compile without <stdio.h>.
- */
-
-#ifdef _DEBUG
-#define CRTDBG_MAP_ALLOC
-//#include <stdlib.h>
-//#include <crtdbg.h>
-#endif
-
-#ifdef HAVE_STDDEF_H
-#include <stddef.h>
-#endif
-
-#ifdef HAVE_STDLIB_H
-//#include <stdlib.h>
-#endif
-
-#ifdef NEED_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-
-#ifndef FAR
-#define FAR
-#endif
-
-//#include <stdio.h>
-
-/*
- * We need memory copying and zeroing functions, plus strncpy().
- * ANSI and System V implementations declare these in <string.h>.
- * BSD doesn't have the mem() functions, but it does have bcopy()/bzero().
- * Some systems may declare memset and memcpy in <memory.h>.
- *
- * NOTE: we assume the size parameters to these functions are of type size_t.
- * Change the casts in these macros if not!
- */
-
-#ifdef NEED_BSD_STRINGS
-
-//#include <strings.h>
-#define MEMZERO(target,size) bzero((void *)(target), (size_t)(size))
-#define MEMCOPY(dest,src,size) bcopy((const void *)(src), (void *)(dest), (size_t)(size))
-
-#else /* not BSD, assume ANSI/SysV string lib */
-
-//#include <string.h>
-#define MEMZERO(target,size) FXSYS_memset((void *)(target), 0, (size_t)(size))
-#define MEMCOPY(dest,src,size) FXSYS_memcpy((void *)(dest), (const void *)(src), (size_t)(size))
-
-#endif
-
-/*
- * In ANSI C, and indeed any rational implementation, size_t is also the
- * type returned by sizeof(). However, it seems there are some irrational
- * implementations out there, in which sizeof() returns an int even though
- * size_t is defined as long or unsigned long. To ensure consistent results
- * we always use this SIZEOF() macro in place of using sizeof() directly.
- */
-
-#define SIZEOF(object) ((size_t) sizeof(object))
-
-/*
- * The modules that use fread() and fwrite() always invoke them through
- * these macros. On some systems you may need to twiddle the argument casts.
- * CAUTION: argument order is different from underlying functions!
- */
-
-#define JFREAD(file,buf,sizeofbuf) \
- ((size_t) FXSYS_fread((void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file)))
-#define JFWRITE(file,buf,sizeofbuf) \
- ((size_t) FXSYS_fwrite((const void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file)))
diff --git a/chromium/third_party/pdfium/third_party/libjpeg/jmemsys.h b/chromium/third_party/pdfium/third_party/libjpeg/jmemsys.h
deleted file mode 100644
index 896688181bf..00000000000
--- a/chromium/third_party/pdfium/third_party/libjpeg/jmemsys.h
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * jmemsys.h
- *
- * Copyright (C) 1992-1997, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This include file defines the interface between the system-independent
- * and system-dependent portions of the JPEG memory manager. No other
- * modules need include it. (The system-independent portion is jmemmgr.c;
- * there are several different versions of the system-dependent portion.)
- *
- * This file works as-is for the system-dependent memory managers supplied
- * in the IJG distribution. You may need to modify it if you write a
- * custom memory manager.
- */
-
-
-/* Short forms of external names for systems with brain-damaged linkers. */
-
-#ifdef NEED_SHORT_EXTERNAL_NAMES
-#define jpeg_get_small jGetSmall
-#define jpeg_free_small jFreeSmall
-#define jpeg_get_large jGetLarge
-#define jpeg_free_large jFreeLarge
-#define jpeg_mem_available jMemAvail
-#define jpeg_open_backing_store jOpenBackStore
-#define jpeg_mem_init jMemInit
-#define jpeg_mem_term jMemTerm
-#endif /* NEED_SHORT_EXTERNAL_NAMES */
-
-
-/*
- * These two functions are used to allocate and release small chunks of
- * memory. (Typically the total amount requested through jpeg_get_small is
- * no more than 20K or so; this will be requested in chunks of a few K each.)
- * Behavior should be the same as for the standard library functions malloc
- * and free; in particular, jpeg_get_small must return NULL on failure.
- * On most systems, these ARE malloc and free. jpeg_free_small is passed the
- * size of the object being freed, just in case it's needed.
- * On an 80x86 machine using small-data memory model, these manage near heap.
- */
-
-EXTERN(void *) jpeg_get_small JPP((j_common_ptr cinfo, size_t sizeofobject));
-EXTERN(void) jpeg_free_small JPP((j_common_ptr cinfo, void * object,
- size_t sizeofobject));
-
-/*
- * These two functions are used to allocate and release large chunks of
- * memory (up to the total free space designated by jpeg_mem_available).
- * The interface is the same as above, except that on an 80x86 machine,
- * far pointers are used. On most other machines these are identical to
- * the jpeg_get/free_small routines; but we keep them separate anyway,
- * in case a different allocation strategy is desirable for large chunks.
- */
-
-EXTERN(void FAR *) jpeg_get_large JPP((j_common_ptr cinfo,
- size_t sizeofobject));
-EXTERN(void) jpeg_free_large JPP((j_common_ptr cinfo, void FAR * object,
- size_t sizeofobject));
-
-/*
- * The macro MAX_ALLOC_CHUNK designates the maximum number of bytes that may
- * be requested in a single call to jpeg_get_large (and jpeg_get_small for that
- * matter, but that case should never come into play). This macro is needed
- * to model the 64Kb-segment-size limit of far addressing on 80x86 machines.
- * On those machines, we expect that jconfig.h will provide a proper value.
- * On machines with 32-bit flat address spaces, any large constant may be used.
- *
- * NB: jmemmgr.c expects that MAX_ALLOC_CHUNK will be representable as type
- * size_t and will be a multiple of sizeof(align_type).
- */
-
-#ifndef MAX_ALLOC_CHUNK /* may be overridden in jconfig.h */
-#define MAX_ALLOC_CHUNK 1000000000L
-#endif
-
-/*
- * This routine computes the total space still available for allocation by
- * jpeg_get_large. If more space than this is needed, backing store will be
- * used. NOTE: any memory already allocated must not be counted.
- *
- * There is a minimum space requirement, corresponding to the minimum
- * feasible buffer sizes; jmemmgr.c will request that much space even if
- * jpeg_mem_available returns zero. The maximum space needed, enough to hold
- * all working storage in memory, is also passed in case it is useful.
- * Finally, the total space already allocated is passed. If no better
- * method is available, cinfo->mem->max_memory_to_use - already_allocated
- * is often a suitable calculation.
- *
- * It is OK for jpeg_mem_available to underestimate the space available
- * (that'll just lead to more backing-store access than is really necessary).
- * However, an overestimate will lead to failure. Hence it's wise to subtract
- * a slop factor from the true available space. 5% should be enough.
- *
- * On machines with lots of virtual memory, any large constant may be returned.
- * Conversely, zero may be returned to always use the minimum amount of memory.
- */
-
-EXTERN(long) jpeg_mem_available JPP((j_common_ptr cinfo,
- long min_bytes_needed,
- long max_bytes_needed,
- long already_allocated));
-
-
-/*
- * This structure holds whatever state is needed to access a single
- * backing-store object. The read/write/close method pointers are called
- * by jmemmgr.c to manipulate the backing-store object; all other fields
- * are private to the system-dependent backing store routines.
- */
-
-#define TEMP_NAME_LENGTH 64 /* max length of a temporary file's name */
-
-typedef struct backing_store_struct * backing_store_ptr;
-
-typedef struct backing_store_struct {
- /* Methods for reading/writing/closing this backing-store object */
- JMETHOD(void, read_backing_store, (j_common_ptr cinfo,
- backing_store_ptr info,
- void FAR * buffer_address,
- long file_offset, long byte_count));
- JMETHOD(void, write_backing_store, (j_common_ptr cinfo,
- backing_store_ptr info,
- void FAR * buffer_address,
- long file_offset, long byte_count));
- JMETHOD(void, close_backing_store, (j_common_ptr cinfo,
- backing_store_ptr info));
-
- /* Private fields for system-dependent backing-store management */
- /* For a typical implementation with temp files, we need: */
- FXSYS_FILE * temp_file; /* stdio reference to temp file */
- char temp_name[TEMP_NAME_LENGTH]; /* name of temp file */
-} backing_store_info;
-
-
-/*
- * Initial opening of a backing-store object. This must fill in the
- * read/write/close pointers in the object. The read/write routines
- * may take an error exit if the specified maximum file size is exceeded.
- * (If jpeg_mem_available always returns a large value, this routine can
- * just take an error exit.)
- */
-
-EXTERN(void) jpeg_open_backing_store JPP((j_common_ptr cinfo,
- backing_store_ptr info,
- long total_bytes_needed));
-
-
-/*
- * These routines take care of any system-dependent initialization and
- * cleanup required. jpeg_mem_init will be called before anything is
- * allocated (and, therefore, nothing in cinfo is of use except the error
- * manager pointer). It should return a suitable default value for
- * max_memory_to_use; this may subsequently be overridden by the surrounding
- * application. (Note that max_memory_to_use is only important if
- * jpeg_mem_available chooses to consult it ... no one else will.)
- * jpeg_mem_term may assume that all requested memory has been freed and that
- * all opened backing-store objects have been closed.
- */
-
-EXTERN(long) jpeg_mem_init JPP((j_common_ptr cinfo));
-EXTERN(void) jpeg_mem_term JPP((j_common_ptr cinfo));
diff --git a/chromium/third_party/pdfium/third_party/libjpeg/jmorecfg.h b/chromium/third_party/pdfium/third_party/libjpeg/jmorecfg.h
deleted file mode 100644
index a80d90495ea..00000000000
--- a/chromium/third_party/pdfium/third_party/libjpeg/jmorecfg.h
+++ /dev/null
@@ -1,372 +0,0 @@
-/*
- * jmorecfg.h
- *
- * Copyright (C) 1991-1997, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file contains additional configuration options that customize the
- * JPEG software for special applications or support machine-dependent
- * optimizations. Most users will not need to touch this file.
- */
-
-#ifdef _MSC_VER
-#pragma warning (disable : 4142)
-#endif
-
-/*
- * Define BITS_IN_JSAMPLE as either
- * 8 for 8-bit sample values (the usual setting)
- * 12 for 12-bit sample values
- * Only 8 and 12 are legal data precisions for lossy JPEG according to the
- * JPEG standard, and the IJG code does not support anything else!
- * We do not support run-time selection of data precision, sorry.
- */
-
-#define BITS_IN_JSAMPLE 8 /* use 8 or 12 */
-
-
-/*
- * Maximum number of components (color channels) allowed in JPEG image.
- * To meet the letter of the JPEG spec, set this to 255. However, darn
- * few applications need more than 4 channels (maybe 5 for CMYK + alpha
- * mask). We recommend 10 as a reasonable compromise; use 4 if you are
- * really short on memory. (Each allowed component costs a hundred or so
- * bytes of storage, whether actually used in an image or not.)
- */
-
-#define MAX_COMPONENTS 10 /* maximum number of image components */
-
-
-/*
- * Basic data types.
- * You may need to change these if you have a machine with unusual data
- * type sizes; for example, "char" not 8 bits, "short" not 16 bits,
- * or "long" not 32 bits. We don't care whether "int" is 16 or 32 bits,
- * but it had better be at least 16.
- */
-
-/* Representation of a single sample (pixel element value).
- * We frequently allocate large arrays of these, so it's important to keep
- * them small. But if you have memory to burn and access to char or short
- * arrays is very slow on your hardware, you might want to change these.
- */
-
-#if BITS_IN_JSAMPLE == 8
-/* JSAMPLE should be the smallest type that will hold the values 0..255.
- * You can use a signed char by having GETJSAMPLE mask it with 0xFF.
- */
-
-#ifdef HAVE_UNSIGNED_CHAR
-
-typedef unsigned char JSAMPLE;
-#define GETJSAMPLE(value) ((int) (value))
-
-#else /* not HAVE_UNSIGNED_CHAR */
-
-typedef char JSAMPLE;
-#ifdef CHAR_IS_UNSIGNED
-#define GETJSAMPLE(value) ((int) (value))
-#else
-#define GETJSAMPLE(value) ((int) (value) & 0xFF)
-#endif /* CHAR_IS_UNSIGNED */
-
-#endif /* HAVE_UNSIGNED_CHAR */
-
-#define MAXJSAMPLE 255
-#define CENTERJSAMPLE 128
-
-#endif /* BITS_IN_JSAMPLE == 8 */
-
-
-#if BITS_IN_JSAMPLE == 12
-/* JSAMPLE should be the smallest type that will hold the values 0..4095.
- * On nearly all machines "short" will do nicely.
- */
-
-typedef short JSAMPLE;
-#define GETJSAMPLE(value) ((int) (value))
-
-#define MAXJSAMPLE 4095
-#define CENTERJSAMPLE 2048
-
-#endif /* BITS_IN_JSAMPLE == 12 */
-
-
-/* Representation of a DCT frequency coefficient.
- * This should be a signed value of at least 16 bits; "short" is usually OK.
- * Again, we allocate large arrays of these, but you can change to int
- * if you have memory to burn and "short" is really slow.
- */
-
-typedef short JCOEF;
-
-
-/* Compressed datastreams are represented as arrays of JOCTET.
- * These must be EXACTLY 8 bits wide, at least once they are written to
- * external storage. Note that when using the stdio data source/destination
- * managers, this is also the data type passed to fread/fwrite.
- */
-
-#ifdef HAVE_UNSIGNED_CHAR
-
-typedef unsigned char JOCTET;
-#define GETJOCTET(value) (value)
-
-#else /* not HAVE_UNSIGNED_CHAR */
-
-typedef char JOCTET;
-#ifdef CHAR_IS_UNSIGNED
-#define GETJOCTET(value) (value)
-#else
-#define GETJOCTET(value) ((value) & 0xFF)
-#endif /* CHAR_IS_UNSIGNED */
-
-#endif /* HAVE_UNSIGNED_CHAR */
-
-
-/* These typedefs are used for various table entries and so forth.
- * They must be at least as wide as specified; but making them too big
- * won't cost a huge amount of memory, so we don't provide special
- * extraction code like we did for JSAMPLE. (In other words, these
- * typedefs live at a different point on the speed/space tradeoff curve.)
- */
-
-#if _FX_OS_ != _FX_VXWORKS_
-
-/* UINT8 must hold at least the values 0..255. */
-
-#ifdef HAVE_UNSIGNED_CHAR
-typedef unsigned char UINT8;
-#else /* not HAVE_UNSIGNED_CHAR */
-#ifdef CHAR_IS_UNSIGNED
-typedef char UINT8;
-#else /* not CHAR_IS_UNSIGNED */
-typedef short UINT8;
-#endif /* CHAR_IS_UNSIGNED */
-#endif /* HAVE_UNSIGNED_CHAR */
-
-
-/* UINT16 must hold at least the values 0..65535. */
-
-#ifdef HAVE_UNSIGNED_SHORT
-typedef unsigned short UINT16;
-#else /* not HAVE_UNSIGNED_SHORT */
-typedef unsigned int UINT16;
-#endif /* HAVE_UNSIGNED_SHORT */
-
-/* INT16 must hold at least the values -32768..32767. */
-
-#ifndef XMD_H /* X11/xmd.h correctly defines INT16 */
-typedef short INT16;
-#endif
-
-/* INT32 must hold at least signed 32-bit values. */
-
-#ifndef XMD_H /* X11/xmd.h correctly defines INT32 */
-typedef int INT32;
-#endif
-
-#endif
-
-/* Datatype used for image dimensions. The JPEG standard only supports
- * images up to 64K*64K due to 16-bit fields in SOF markers. Therefore
- * "unsigned int" is sufficient on all machines. However, if you need to
- * handle larger images and you don't mind deviating from the spec, you
- * can change this datatype.
- */
-
-typedef unsigned int JDIMENSION;
-
-#define JPEG_MAX_DIMENSION 65500L /* a tad under 64K to prevent overflows */
-
-
-/* These macros are used in all function definitions and extern declarations.
- * You could modify them if you need to change function linkage conventions;
- * in particular, you'll need to do that to make the library a Windows DLL.
- * Another application is to make all functions global for use with debuggers
- * or code profilers that require it.
- */
-
-/* a function called through method pointers: */
-#define METHODDEF(type) static type
-/* a function used only in its module: */
-#define LOCAL(type) static type
-/* a function referenced thru EXTERNs: */
-#define GLOBAL(type) type
-
-/* a reference to a GLOBAL function: */
-#define EXTERN(type) extern type
-
-
-/* This macro is used to declare a "method", that is, a function pointer.
- * We want to supply prototype parameters if the compiler can cope.
- * Note that the arglist parameter must be parenthesized!
- * Again, you can customize this if you need special linkage keywords.
- */
-
-#ifdef HAVE_PROTOTYPES
-#define JMETHOD(type,methodname,arglist) type (*methodname) arglist
-#else
-#define JMETHOD(type,methodname,arglist) type (*methodname) ()
-#endif
-
-
-/* Here is the pseudo-keyword for declaring pointers that must be "far"
- * on 80x86 machines. Most of the specialized coding for 80x86 is handled
- * by just saying "FAR *" where such a pointer is needed. In a few places
- * explicit coding is needed; see uses of the NEED_FAR_POINTERS symbol.
- */
-
-#ifdef NEED_FAR_POINTERS
-#define FAR far
-#else
-//#define FAR
-#endif
-
-
-/*
- * On a few systems, type boolean and/or its values FALSE, TRUE may appear
- * in standard header files. Or you may have conflicts with application-
- * specific header files that you want to include together with these files.
- * Defining HAVE_BOOLEAN before including jpeglib.h should make it work.
- */
-
-#ifndef HAVE_BOOLEAN
-typedef int boolean;
-#endif
-#ifndef FALSE /* in case these macros already exist */
-#define FALSE 0 /* values of boolean */
-#endif
-#ifndef TRUE
-#define TRUE 1
-#endif
-
-
-/*
- * The remaining options affect code selection within the JPEG library,
- * but they don't need to be visible to most applications using the library.
- * To minimize application namespace pollution, the symbols won't be
- * defined unless JPEG_INTERNALS or JPEG_INTERNAL_OPTIONS has been defined.
- */
-
-#ifdef JPEG_INTERNALS
-#define JPEG_INTERNAL_OPTIONS
-#endif
-
-#ifdef JPEG_INTERNAL_OPTIONS
-
-
-/*
- * These defines indicate whether to include various optional functions.
- * Undefining some of these symbols will produce a smaller but less capable
- * library. Note that you can leave certain source files out of the
- * compilation/linking process if you've #undef'd the corresponding symbols.
- * (You may HAVE to do that if your compiler doesn't like null source files.)
- */
-
-/* Arithmetic coding is unsupported for legal reasons. Complaints to IBM. */
-
-/* Capability options common to encoder and decoder: */
-
-#define DCT_ISLOW_SUPPORTED /* slow but accurate integer algorithm */
-#define DCT_IFAST_SUPPORTED /* faster, less accurate integer method */
-#undef DCT_FLOAT_SUPPORTED /* floating-point: accurate, fast on fast HW */
-
-/* Encoder capability options: */
-
-#undef C_ARITH_CODING_SUPPORTED /* Arithmetic coding back end? */
-#define C_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */
-#define C_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/
-#define ENTROPY_OPT_SUPPORTED /* Optimization of entropy coding parms? */
-/* Note: if you selected 12-bit data precision, it is dangerous to turn off
- * ENTROPY_OPT_SUPPORTED. The standard Huffman tables are only good for 8-bit
- * precision, so jchuff.c normally uses entropy optimization to compute
- * usable tables for higher precision. If you don't want to do optimization,
- * you'll have to supply different default Huffman tables.
- * The exact same statements apply for progressive JPEG: the default tables
- * don't work for progressive mode. (This may get fixed, however.)
- */
-#define INPUT_SMOOTHING_SUPPORTED /* Input image smoothing option? */
-
-/* Decoder capability options: */
-
-#undef D_ARITH_CODING_SUPPORTED /* Arithmetic coding back end? */
-#define D_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */
-#define D_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/
-#define SAVE_MARKERS_SUPPORTED /* jpeg_save_markers() needed? */
-#define BLOCK_SMOOTHING_SUPPORTED /* Block smoothing? (Progressive only) */
-#define IDCT_SCALING_SUPPORTED /* Output rescaling via IDCT? */
-#undef UPSAMPLE_SCALING_SUPPORTED /* Output rescaling at upsample stage? */
-#define UPSAMPLE_MERGING_SUPPORTED /* Fast path for sloppy upsampling? */
-#undef QUANT_1PASS_SUPPORTED /* 1-pass color quantization? */
-#undef QUANT_2PASS_SUPPORTED /* 2-pass color quantization? */
-
-/* more capability options later, no doubt */
-
-
-/*
- * Ordering of RGB data in scanlines passed to or from the application.
- * If your application wants to deal with data in the order B,G,R, just
- * change these macros. You can also deal with formats such as R,G,B,X
- * (one extra byte per pixel) by changing RGB_PIXELSIZE. Note that changing
- * the offsets will also change the order in which colormap data is organized.
- * RESTRICTIONS:
- * 1. The sample applications cjpeg,djpeg do NOT support modified RGB formats.
- * 2. These macros only affect RGB<=>YCbCr color conversion, so they are not
- * useful if you are using JPEG color spaces other than YCbCr or grayscale.
- * 3. The color quantizer modules will not behave desirably if RGB_PIXELSIZE
- * is not 3 (they don't understand about dummy color components!). So you
- * can't use color quantization if you change that value.
- */
-
-#define RGB_RED 0 /* Offset of Red in an RGB scanline element */
-#define RGB_GREEN 1 /* Offset of Green */
-#define RGB_BLUE 2 /* Offset of Blue */
-#define RGB_PIXELSIZE 3 /* JSAMPLEs per RGB scanline element */
-
-
-/* Definitions for speed-related optimizations. */
-
-
-/* If your compiler supports inline functions, define INLINE
- * as the inline keyword; otherwise define it as empty.
- */
-
-#ifndef INLINE
-#ifdef __GNUC__ /* for instance, GNU C knows about inline */
-#define INLINE __inline__
-#endif
-#ifndef INLINE
-#define INLINE /* default is to define it as empty */
-#endif
-#endif
-
-
-/* On some machines (notably 68000 series) "int" is 32 bits, but multiplying
- * two 16-bit shorts is faster than multiplying two ints. Define MULTIPLIER
- * as short on such a machine. MULTIPLIER must be at least 16 bits wide.
- */
-
-#ifndef MULTIPLIER
-#define MULTIPLIER int /* type for fastest integer multiply */
-#endif
-
-
-/* FAST_FLOAT should be either float or double, whichever is done faster
- * by your compiler. (Note that this type is only used in the floating point
- * DCT routines, so it only matters if you've defined DCT_FLOAT_SUPPORTED.)
- * Typically, float is faster in ANSI C compilers, while double is faster in
- * pre-ANSI compilers (because they insist on converting to double anyway).
- * The code below therefore chooses float if we have ANSI-style prototypes.
- */
-
-#ifndef FAST_FLOAT
-#ifdef HAVE_PROTOTYPES
-#define FAST_FLOAT float
-#else
-#define FAST_FLOAT double
-#endif
-#endif
-
-#endif /* JPEG_INTERNAL_OPTIONS */
diff --git a/chromium/third_party/pdfium/third_party/libjpeg/jpegint.h b/chromium/third_party/pdfium/third_party/libjpeg/jpegint.h
deleted file mode 100644
index 95b00d405ca..00000000000
--- a/chromium/third_party/pdfium/third_party/libjpeg/jpegint.h
+++ /dev/null
@@ -1,392 +0,0 @@
-/*
- * jpegint.h
- *
- * Copyright (C) 1991-1997, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file provides common declarations for the various JPEG modules.
- * These declarations are considered internal to the JPEG library; most
- * applications using the library shouldn't need to include this file.
- */
-
-
-/* Declarations for both compression & decompression */
-
-typedef enum { /* Operating modes for buffer controllers */
- JBUF_PASS_THRU, /* Plain stripwise operation */
- /* Remaining modes require a full-image buffer to have been created */
- JBUF_SAVE_SOURCE, /* Run source subobject only, save output */
- JBUF_CRANK_DEST, /* Run dest subobject only, using saved data */
- JBUF_SAVE_AND_PASS /* Run both subobjects, save output */
-} J_BUF_MODE;
-
-/* Values of global_state field (jdapi.c has some dependencies on ordering!) */
-#define CSTATE_START 100 /* after create_compress */
-#define CSTATE_SCANNING 101 /* start_compress done, write_scanlines OK */
-#define CSTATE_RAW_OK 102 /* start_compress done, write_raw_data OK */
-#define CSTATE_WRCOEFS 103 /* jpeg_write_coefficients done */
-#define DSTATE_START 200 /* after create_decompress */
-#define DSTATE_INHEADER 201 /* reading header markers, no SOS yet */
-#define DSTATE_READY 202 /* found SOS, ready for start_decompress */
-#define DSTATE_PRELOAD 203 /* reading multiscan file in start_decompress*/
-#define DSTATE_PRESCAN 204 /* performing dummy pass for 2-pass quant */
-#define DSTATE_SCANNING 205 /* start_decompress done, read_scanlines OK */
-#define DSTATE_RAW_OK 206 /* start_decompress done, read_raw_data OK */
-#define DSTATE_BUFIMAGE 207 /* expecting jpeg_start_output */
-#define DSTATE_BUFPOST 208 /* looking for SOS/EOI in jpeg_finish_output */
-#define DSTATE_RDCOEFS 209 /* reading file in jpeg_read_coefficients */
-#define DSTATE_STOPPING 210 /* looking for EOI in jpeg_finish_decompress */
-
-
-/* Declarations for compression modules */
-
-/* Master control module */
-struct jpeg_comp_master {
- JMETHOD(void, prepare_for_pass, (j_compress_ptr cinfo));
- JMETHOD(void, pass_startup, (j_compress_ptr cinfo));
- JMETHOD(void, finish_pass, (j_compress_ptr cinfo));
-
- /* State variables made visible to other modules */
- boolean call_pass_startup; /* True if pass_startup must be called */
- boolean is_last_pass; /* True during last pass */
-};
-
-/* Main buffer control (downsampled-data buffer) */
-struct jpeg_c_main_controller {
- JMETHOD(void, start_pass, (j_compress_ptr cinfo, J_BUF_MODE pass_mode));
- JMETHOD(void, process_data, (j_compress_ptr cinfo,
- JSAMPARRAY input_buf, JDIMENSION *in_row_ctr,
- JDIMENSION in_rows_avail));
-};
-
-/* Compression preprocessing (downsampling input buffer control) */
-struct jpeg_c_prep_controller {
- JMETHOD(void, start_pass, (j_compress_ptr cinfo, J_BUF_MODE pass_mode));
- JMETHOD(void, pre_process_data, (j_compress_ptr cinfo,
- JSAMPARRAY input_buf,
- JDIMENSION *in_row_ctr,
- JDIMENSION in_rows_avail,
- JSAMPIMAGE output_buf,
- JDIMENSION *out_row_group_ctr,
- JDIMENSION out_row_groups_avail));
-};
-
-/* Coefficient buffer control */
-struct jpeg_c_coef_controller {
- JMETHOD(void, start_pass, (j_compress_ptr cinfo, J_BUF_MODE pass_mode));
- JMETHOD(boolean, compress_data, (j_compress_ptr cinfo,
- JSAMPIMAGE input_buf));
-};
-
-/* Colorspace conversion */
-struct jpeg_color_converter {
- JMETHOD(void, start_pass, (j_compress_ptr cinfo));
- JMETHOD(void, color_convert, (j_compress_ptr cinfo,
- JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
- JDIMENSION output_row, int num_rows));
-};
-
-/* Downsampling */
-struct jpeg_downsampler {
- JMETHOD(void, start_pass, (j_compress_ptr cinfo));
- JMETHOD(void, downsample, (j_compress_ptr cinfo,
- JSAMPIMAGE input_buf, JDIMENSION in_row_index,
- JSAMPIMAGE output_buf,
- JDIMENSION out_row_group_index));
-
- boolean need_context_rows; /* TRUE if need rows above & below */
-};
-
-/* Forward DCT (also controls coefficient quantization) */
-struct jpeg_forward_dct {
- JMETHOD(void, start_pass, (j_compress_ptr cinfo));
- /* perhaps this should be an array??? */
- JMETHOD(void, forward_DCT, (j_compress_ptr cinfo,
- jpeg_component_info * compptr,
- JSAMPARRAY sample_data, JBLOCKROW coef_blocks,
- JDIMENSION start_row, JDIMENSION start_col,
- JDIMENSION num_blocks));
-};
-
-/* Entropy encoding */
-struct jpeg_entropy_encoder {
- JMETHOD(void, start_pass, (j_compress_ptr cinfo, boolean gather_statistics));
- JMETHOD(boolean, encode_mcu, (j_compress_ptr cinfo, JBLOCKROW *MCU_data));
- JMETHOD(void, finish_pass, (j_compress_ptr cinfo));
-};
-
-/* Marker writing */
-struct jpeg_marker_writer {
- JMETHOD(void, write_file_header, (j_compress_ptr cinfo));
- JMETHOD(void, write_frame_header, (j_compress_ptr cinfo));
- JMETHOD(void, write_scan_header, (j_compress_ptr cinfo));
- JMETHOD(void, write_file_trailer, (j_compress_ptr cinfo));
- JMETHOD(void, write_tables_only, (j_compress_ptr cinfo));
- /* These routines are exported to allow insertion of extra markers */
- /* Probably only COM and APPn markers should be written this way */
- JMETHOD(void, write_marker_header, (j_compress_ptr cinfo, int marker,
- unsigned int datalen));
- JMETHOD(void, write_marker_byte, (j_compress_ptr cinfo, int val));
-};
-
-
-/* Declarations for decompression modules */
-
-/* Master control module */
-struct jpeg_decomp_master {
- JMETHOD(void, prepare_for_output_pass, (j_decompress_ptr cinfo));
- JMETHOD(void, finish_output_pass, (j_decompress_ptr cinfo));
-
- /* State variables made visible to other modules */
- boolean is_dummy_pass; /* True during 1st pass for 2-pass quant */
-};
-
-/* Input control module */
-struct jpeg_input_controller {
- JMETHOD(int, consume_input, (j_decompress_ptr cinfo));
- JMETHOD(void, reset_input_controller, (j_decompress_ptr cinfo));
- JMETHOD(void, start_input_pass, (j_decompress_ptr cinfo));
- JMETHOD(void, finish_input_pass, (j_decompress_ptr cinfo));
-
- /* State variables made visible to other modules */
- boolean has_multiple_scans; /* True if file has multiple scans */
- boolean eoi_reached; /* True when EOI has been consumed */
-};
-
-/* Main buffer control (downsampled-data buffer) */
-struct jpeg_d_main_controller {
- JMETHOD(void, start_pass, (j_decompress_ptr cinfo, J_BUF_MODE pass_mode));
- JMETHOD(void, process_data, (j_decompress_ptr cinfo,
- JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
- JDIMENSION out_rows_avail));
-};
-
-/* Coefficient buffer control */
-struct jpeg_d_coef_controller {
- JMETHOD(void, start_input_pass, (j_decompress_ptr cinfo));
- JMETHOD(int, consume_data, (j_decompress_ptr cinfo));
- JMETHOD(void, start_output_pass, (j_decompress_ptr cinfo));
- JMETHOD(int, decompress_data, (j_decompress_ptr cinfo,
- JSAMPIMAGE output_buf));
- /* Pointer to array of coefficient virtual arrays, or NULL if none */
- jvirt_barray_ptr *coef_arrays;
-};
-
-/* Decompression postprocessing (color quantization buffer control) */
-struct jpeg_d_post_controller {
- JMETHOD(void, start_pass, (j_decompress_ptr cinfo, J_BUF_MODE pass_mode));
- JMETHOD(void, post_process_data, (j_decompress_ptr cinfo,
- JSAMPIMAGE input_buf,
- JDIMENSION *in_row_group_ctr,
- JDIMENSION in_row_groups_avail,
- JSAMPARRAY output_buf,
- JDIMENSION *out_row_ctr,
- JDIMENSION out_rows_avail));
-};
-
-/* Marker reading & parsing */
-struct jpeg_marker_reader {
- JMETHOD(void, reset_marker_reader, (j_decompress_ptr cinfo));
- /* Read markers until SOS or EOI.
- * Returns same codes as are defined for jpeg_consume_input:
- * JPEG_SUSPENDED, JPEG_REACHED_SOS, or JPEG_REACHED_EOI.
- */
- JMETHOD(int, read_markers, (j_decompress_ptr cinfo));
- /* Read a restart marker --- exported for use by entropy decoder only */
- jpeg_marker_parser_method read_restart_marker;
-
- /* State of marker reader --- nominally internal, but applications
- * supplying COM or APPn handlers might like to know the state.
- */
- boolean saw_SOI; /* found SOI? */
- boolean saw_SOF; /* found SOF? */
- int next_restart_num; /* next restart number expected (0-7) */
- unsigned int discarded_bytes; /* # of bytes skipped looking for a marker */
-};
-
-/* Entropy decoding */
-struct jpeg_entropy_decoder {
- JMETHOD(void, start_pass, (j_decompress_ptr cinfo));
- JMETHOD(boolean, decode_mcu, (j_decompress_ptr cinfo,
- JBLOCKROW *MCU_data));
-
- /* This is here to share code between baseline and progressive decoders; */
- /* other modules probably should not use it */
- boolean insufficient_data; /* set TRUE after emitting warning */
-};
-
-/* Inverse DCT (also performs dequantization) */
-typedef JMETHOD(void, inverse_DCT_method_ptr,
- (j_decompress_ptr cinfo, jpeg_component_info * compptr,
- JCOEFPTR coef_block,
- JSAMPARRAY output_buf, JDIMENSION output_col));
-
-struct jpeg_inverse_dct {
- JMETHOD(void, start_pass, (j_decompress_ptr cinfo));
- /* It is useful to allow each component to have a separate IDCT method. */
- inverse_DCT_method_ptr inverse_DCT[MAX_COMPONENTS];
-};
-
-/* Upsampling (note that upsampler must also call color converter) */
-struct jpeg_upsampler {
- JMETHOD(void, start_pass, (j_decompress_ptr cinfo));
- JMETHOD(void, upsample, (j_decompress_ptr cinfo,
- JSAMPIMAGE input_buf,
- JDIMENSION *in_row_group_ctr,
- JDIMENSION in_row_groups_avail,
- JSAMPARRAY output_buf,
- JDIMENSION *out_row_ctr,
- JDIMENSION out_rows_avail));
-
- boolean need_context_rows; /* TRUE if need rows above & below */
-};
-
-/* Colorspace conversion */
-struct jpeg_color_deconverter {
- JMETHOD(void, start_pass, (j_decompress_ptr cinfo));
- JMETHOD(void, color_convert, (j_decompress_ptr cinfo,
- JSAMPIMAGE input_buf, JDIMENSION input_row,
- JSAMPARRAY output_buf, int num_rows));
-};
-
-/* Color quantization or color precision reduction */
-struct jpeg_color_quantizer {
- JMETHOD(void, start_pass, (j_decompress_ptr cinfo, boolean is_pre_scan));
- JMETHOD(void, color_quantize, (j_decompress_ptr cinfo,
- JSAMPARRAY input_buf, JSAMPARRAY output_buf,
- int num_rows));
- JMETHOD(void, finish_pass, (j_decompress_ptr cinfo));
- JMETHOD(void, new_color_map, (j_decompress_ptr cinfo));
-};
-
-
-/* Miscellaneous useful macros */
-
-#undef MAX
-#define MAX(a,b) ((a) > (b) ? (a) : (b))
-#undef MIN
-#define MIN(a,b) ((a) < (b) ? (a) : (b))
-
-
-/* We assume that right shift corresponds to signed division by 2 with
- * rounding towards minus infinity. This is correct for typical "arithmetic
- * shift" instructions that shift in copies of the sign bit. But some
- * C compilers implement >> with an unsigned shift. For these machines you
- * must define RIGHT_SHIFT_IS_UNSIGNED.
- * RIGHT_SHIFT provides a proper signed right shift of an INT32 quantity.
- * It is only applied with constant shift counts. SHIFT_TEMPS must be
- * included in the variables of any routine using RIGHT_SHIFT.
- */
-
-#ifdef RIGHT_SHIFT_IS_UNSIGNED
-#define SHIFT_TEMPS INT32 shift_temp;
-#define RIGHT_SHIFT(x,shft) \
- ((shift_temp = (x)) < 0 ? \
- (shift_temp >> (shft)) | ((~((INT32) 0)) << (32-(shft))) : \
- (shift_temp >> (shft)))
-#else
-#define SHIFT_TEMPS
-#define RIGHT_SHIFT(x,shft) ((x) >> (shft))
-#endif
-
-
-/* Short forms of external names for systems with brain-damaged linkers. */
-
-#ifdef NEED_SHORT_EXTERNAL_NAMES
-#define jinit_compress_master jICompress
-#define jinit_c_master_control jICMaster
-#define jinit_c_main_controller jICMainC
-#define jinit_c_prep_controller jICPrepC
-#define jinit_c_coef_controller jICCoefC
-#define jinit_color_converter jICColor
-#define jinit_downsampler jIDownsampler
-#define jinit_forward_dct jIFDCT
-#define jinit_huff_encoder jIHEncoder
-#define jinit_phuff_encoder jIPHEncoder
-#define jinit_marker_writer jIMWriter
-#define jinit_master_decompress jIDMaster
-#define jinit_d_main_controller jIDMainC
-#define jinit_d_coef_controller jIDCoefC
-#define jinit_d_post_controller jIDPostC
-#define jinit_input_controller jIInCtlr
-#define jinit_marker_reader jIMReader
-#define jinit_huff_decoder jIHDecoder
-#define jinit_phuff_decoder jIPHDecoder
-#define jinit_inverse_dct jIIDCT
-#define jinit_upsampler jIUpsampler
-#define jinit_color_deconverter jIDColor
-#define jinit_1pass_quantizer jI1Quant
-#define jinit_2pass_quantizer jI2Quant
-#define jinit_merged_upsampler jIMUpsampler
-#define jinit_memory_mgr jIMemMgr
-#define jdiv_round_up jDivRound
-#define jround_up jRound
-#define jcopy_sample_rows jCopySamples
-#define jcopy_block_row jCopyBlocks
-#define jzero_far jZeroFar
-#define jpeg_zigzag_order jZIGTable
-#define jpeg_natural_order jZAGTable
-#endif /* NEED_SHORT_EXTERNAL_NAMES */
-
-
-/* Compression module initialization routines */
-EXTERN(void) jinit_compress_master JPP((j_compress_ptr cinfo));
-EXTERN(void) jinit_c_master_control JPP((j_compress_ptr cinfo,
- boolean transcode_only));
-EXTERN(void) jinit_c_main_controller JPP((j_compress_ptr cinfo,
- boolean need_full_buffer));
-EXTERN(void) jinit_c_prep_controller JPP((j_compress_ptr cinfo,
- boolean need_full_buffer));
-EXTERN(void) jinit_c_coef_controller JPP((j_compress_ptr cinfo,
- boolean need_full_buffer));
-EXTERN(void) jinit_color_converter JPP((j_compress_ptr cinfo));
-EXTERN(void) jinit_downsampler JPP((j_compress_ptr cinfo));
-EXTERN(void) jinit_forward_dct JPP((j_compress_ptr cinfo));
-EXTERN(void) jinit_huff_encoder JPP((j_compress_ptr cinfo));
-EXTERN(void) jinit_phuff_encoder JPP((j_compress_ptr cinfo));
-EXTERN(void) jinit_marker_writer JPP((j_compress_ptr cinfo));
-/* Decompression module initialization routines */
-EXTERN(void) jinit_master_decompress JPP((j_decompress_ptr cinfo));
-EXTERN(void) jinit_d_main_controller JPP((j_decompress_ptr cinfo,
- boolean need_full_buffer));
-EXTERN(void) jinit_d_coef_controller JPP((j_decompress_ptr cinfo,
- boolean need_full_buffer));
-EXTERN(void) jinit_d_post_controller JPP((j_decompress_ptr cinfo,
- boolean need_full_buffer));
-EXTERN(void) jinit_input_controller JPP((j_decompress_ptr cinfo));
-EXTERN(void) jinit_marker_reader JPP((j_decompress_ptr cinfo));
-EXTERN(void) jinit_huff_decoder JPP((j_decompress_ptr cinfo));
-EXTERN(void) jinit_phuff_decoder JPP((j_decompress_ptr cinfo));
-EXTERN(void) jinit_inverse_dct JPP((j_decompress_ptr cinfo));
-EXTERN(void) jinit_upsampler JPP((j_decompress_ptr cinfo));
-EXTERN(void) jinit_color_deconverter JPP((j_decompress_ptr cinfo));
-EXTERN(void) jinit_1pass_quantizer JPP((j_decompress_ptr cinfo));
-EXTERN(void) jinit_2pass_quantizer JPP((j_decompress_ptr cinfo));
-EXTERN(void) jinit_merged_upsampler JPP((j_decompress_ptr cinfo));
-/* Memory manager initialization */
-EXTERN(void) jinit_memory_mgr JPP((j_common_ptr cinfo));
-
-/* Utility routines in jutils.c */
-EXTERN(long) jdiv_round_up JPP((long a, long b));
-EXTERN(long) jround_up JPP((long a, long b));
-EXTERN(void) jcopy_sample_rows JPP((JSAMPARRAY input_array, int source_row,
- JSAMPARRAY output_array, int dest_row,
- int num_rows, JDIMENSION num_cols));
-EXTERN(void) jcopy_block_row JPP((JBLOCKROW input_row, JBLOCKROW output_row,
- JDIMENSION num_blocks));
-EXTERN(void) jzero_far JPP((void FAR * target, size_t bytestozero));
-/* Constant tables in jutils.c */
-#if 0 /* This table is not actually needed in v6a */
-extern const int jpeg_zigzag_order[]; /* natural coef order to zigzag order */
-#endif
-extern const int jpeg_natural_order[]; /* zigzag coef order to natural order */
-
-/* Suppress undefined-structure complaints if necessary. */
-
-#ifdef INCOMPLETE_TYPES_BROKEN
-#ifndef AM_MEMORY_MANAGER /* only jmemmgr.c defines these */
-struct jvirt_sarray_control { long dummy; };
-struct jvirt_barray_control { long dummy; };
-#endif
-#endif /* INCOMPLETE_TYPES_BROKEN */
diff --git a/chromium/third_party/pdfium/third_party/libjpeg/jpeglib.h b/chromium/third_party/pdfium/third_party/libjpeg/jpeglib.h
deleted file mode 100644
index f6af4f2b479..00000000000
--- a/chromium/third_party/pdfium/third_party/libjpeg/jpeglib.h
+++ /dev/null
@@ -1,1200 +0,0 @@
-/*
- * jpeglib.h
- *
- * Copyright (C) 1991-1998, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file defines the application interface for the JPEG library.
- * Most applications using the library need only include this file,
- * and perhaps jerror.h if they want to know the exact error codes.
- */
-
-#ifndef JPEGLIB_H
-#define JPEGLIB_H
-
-#define FOXIT_PREFIX(origName) FPDFAPIJPEG_##origName
-
-#define jcopy_block_row FOXIT_PREFIX(jcopy_block_row)
-#define jcopy_sample_rows FOXIT_PREFIX(jcopy_sample_rows)
-#define jdiv_round_up FOXIT_PREFIX(jdiv_round_up)
-#define jinit_1pass_quantizer FOXIT_PREFIX(jinit_1pass_quantizer)
-#define jinit_2pass_quantizer FOXIT_PREFIX(jinit_2pass_quantizer)
-#define jinit_c_coef_controller FOXIT_PREFIX(jinit_c_coef_controller)
-#define jinit_c_main_controller FOXIT_PREFIX(jinit_c_main_controller)
-#define jinit_c_master_control FOXIT_PREFIX(jinit_c_master_control)
-#define jinit_c_prep_controller FOXIT_PREFIX(jinit_c_prep_controller)
-#define jinit_color_converter FOXIT_PREFIX(jinit_color_converter)
-#define jinit_color_deconverter FOXIT_PREFIX(jinit_color_deconverter)
-#define jinit_compress_master FOXIT_PREFIX(jinit_compress_master)
-#define jinit_d_coef_controller FOXIT_PREFIX(jinit_d_coef_controller)
-#define jinit_d_main_controller FOXIT_PREFIX(jinit_d_main_controller)
-#define jinit_d_post_controller FOXIT_PREFIX(jinit_d_post_controller)
-#define jinit_downsampler FOXIT_PREFIX(jinit_downsampler)
-#define jinit_forward_dct FOXIT_PREFIX(jinit_forward_dct)
-#define jinit_huff_decoder FOXIT_PREFIX(jinit_huff_decoder)
-#define jinit_huff_encoder FOXIT_PREFIX(jinit_huff_encoder)
-#define jinit_input_controller FOXIT_PREFIX(jinit_input_controller)
-#define jinit_inverse_dct FOXIT_PREFIX(jinit_inverse_dct)
-#define jinit_marker_reader FOXIT_PREFIX(jinit_marker_reader)
-#define jinit_marker_writer FOXIT_PREFIX(jinit_marker_writer)
-#define jinit_master_decompress FOXIT_PREFIX(jinit_master_decompress)
-#define jinit_memory_mgr FOXIT_PREFIX(jinit_memory_mgr)
-#define jinit_merged_upsampler FOXIT_PREFIX(jinit_merged_upsampler)
-#define jinit_phuff_decoder FOXIT_PREFIX(jinit_phuff_decoder)
-#define jinit_phuff_encoder FOXIT_PREFIX(jinit_phuff_encoder)
-#define jinit_upsampler FOXIT_PREFIX(jinit_upsampler)
-#define jpeg_CreateCompress FOXIT_PREFIX(jpeg_CreateCompress)
-#define jpeg_CreateDecompress FOXIT_PREFIX(jpeg_CreateDecompress)
-#define jpeg_abort FOXIT_PREFIX(jpeg_abort)
-#define jpeg_abort_compress FOXIT_PREFIX(jpeg_abort_compress)
-#define jpeg_abort_decompress FOXIT_PREFIX(jpeg_abort_decompress)
-#define jpeg_add_quant_table FOXIT_PREFIX(jpeg_add_quant_table)
-#define jpeg_alloc_huff_table FOXIT_PREFIX(jpeg_alloc_huff_table)
-#define jpeg_alloc_quant_table FOXIT_PREFIX(jpeg_alloc_quant_table)
-#define jpeg_calc_output_dimensions FOXIT_PREFIX(jpeg_calc_output_dimensions)
-#define jpeg_consume_input FOXIT_PREFIX(jpeg_consume_input)
-#define jpeg_default_colorspace FOXIT_PREFIX(jpeg_default_colorspace)
-#define jpeg_destroy FOXIT_PREFIX(jpeg_destroy)
-#define jpeg_destroy_compress FOXIT_PREFIX(jpeg_destroy_compress)
-#define jpeg_destroy_decompress FOXIT_PREFIX(jpeg_destroy_decompress)
-#define jpeg_fdct_ifast FOXIT_PREFIX(jpeg_fdct_ifast)
-#define jpeg_fdct_islow FOXIT_PREFIX(jpeg_fdct_islow)
-#define jpeg_fill_bit_buffer FOXIT_PREFIX(jpeg_fill_bit_buffer)
-#define jpeg_finish_compress FOXIT_PREFIX(jpeg_finish_compress)
-#define jpeg_finish_decompress FOXIT_PREFIX(jpeg_finish_decompress)
-#define jpeg_finish_output FOXIT_PREFIX(jpeg_finish_output)
-#define jpeg_free_large FOXIT_PREFIX(jpeg_free_large)
-#define jpeg_free_small FOXIT_PREFIX(jpeg_free_small)
-#define jpeg_gen_optimal_table FOXIT_PREFIX(jpeg_gen_optimal_table)
-#define jpeg_get_large FOXIT_PREFIX(jpeg_get_large)
-#define jpeg_get_small FOXIT_PREFIX(jpeg_get_small)
-#define jpeg_has_multiple_scans FOXIT_PREFIX(jpeg_has_multiple_scans)
-#define jpeg_huff_decode FOXIT_PREFIX(jpeg_huff_decode)
-#define jpeg_idct_1x1 FOXIT_PREFIX(jpeg_idct_1x1)
-#define jpeg_idct_2x2 FOXIT_PREFIX(jpeg_idct_2x2)
-#define jpeg_idct_4x4 FOXIT_PREFIX(jpeg_idct_4x4)
-#define jpeg_idct_float FOXIT_PREFIX(jpeg_idct_float)
-#define jpeg_idct_ifast FOXIT_PREFIX(jpeg_idct_ifast)
-#define jpeg_idct_islow FOXIT_PREFIX(jpeg_idct_islow)
-#define jpeg_input_complete FOXIT_PREFIX(jpeg_input_complete)
-#define jpeg_make_c_derived_tbl FOXIT_PREFIX(jpeg_make_c_derived_tbl)
-#define jpeg_make_d_derived_tbl FOXIT_PREFIX(jpeg_make_d_derived_tbl)
-#define jpeg_mem_available FOXIT_PREFIX(jpeg_mem_available)
-#define jpeg_mem_init FOXIT_PREFIX(jpeg_mem_init)
-#define jpeg_mem_term FOXIT_PREFIX(jpeg_mem_term)
-#define jpeg_natural_order FOXIT_PREFIX(jpeg_natural_order)
-#define jpeg_new_colormap FOXIT_PREFIX(jpeg_new_colormap)
-#define jpeg_open_backing_store FOXIT_PREFIX(jpeg_open_backing_store)
-#define jpeg_quality_scaling FOXIT_PREFIX(jpeg_quality_scaling)
-#define jpeg_read_coefficients FOXIT_PREFIX(jpeg_read_coefficients)
-#define jpeg_read_header FOXIT_PREFIX(jpeg_read_header)
-#define jpeg_read_raw_data FOXIT_PREFIX(jpeg_read_raw_data)
-#define jpeg_read_scanlines FOXIT_PREFIX(jpeg_read_scanlines)
-#define jpeg_resync_to_restart FOXIT_PREFIX(jpeg_resync_to_restart)
-#define jpeg_save_markers FOXIT_PREFIX(jpeg_save_markers)
-#define jpeg_set_colorspace FOXIT_PREFIX(jpeg_set_colorspace)
-#define jpeg_set_defaults FOXIT_PREFIX(jpeg_set_defaults)
-#define jpeg_set_linear_quality FOXIT_PREFIX(jpeg_set_linear_quality)
-#define jpeg_set_marker_processor FOXIT_PREFIX(jpeg_set_marker_processor)
-#define jpeg_set_quality FOXIT_PREFIX(jpeg_set_quality)
-#define jpeg_simple_progression FOXIT_PREFIX(jpeg_simple_progression)
-#define jpeg_start_compress FOXIT_PREFIX(jpeg_start_compress)
-#define jpeg_start_decompress FOXIT_PREFIX(jpeg_start_decompress)
-#define jpeg_start_output FOXIT_PREFIX(jpeg_start_output)
-#define jpeg_std_error FOXIT_PREFIX(jpeg_std_error)
-#define jpeg_std_message_table FOXIT_PREFIX(jpeg_std_message_table)
-#define jpeg_stdio_src FOXIT_PREFIX(jpeg_stdio_src)
-#define jpeg_suppress_tables FOXIT_PREFIX(jpeg_suppress_tables)
-#define jpeg_write_m_byte FOXIT_PREFIX(jpeg_write_m_byte)
-#define jpeg_write_m_header FOXIT_PREFIX(jpeg_write_m_header)
-#define jpeg_write_marker FOXIT_PREFIX(jpeg_write_marker)
-#define jpeg_write_raw_data FOXIT_PREFIX(jpeg_write_raw_data)
-#define jpeg_write_scanlines FOXIT_PREFIX(jpeg_write_scanlines)
-#define jpeg_write_tables FOXIT_PREFIX(jpeg_write_tables)
-#define jround_up FOXIT_PREFIX(jround_up)
-#define jzero_far FOXIT_PREFIX(jzero_far)
-
- /*
- * First we include the configuration files that record how this
- * installation of the JPEG library is set up. jconfig.h can be
- * generated automatically for many systems. jmorecfg.h contains
- * manual configuration options that most people need not worry about.
- */
-
-#ifndef JCONFIG_INCLUDED /* in case jinclude.h already did */
-#include "jconfig.h" /* widely used configuration options */
-#endif
-#include "jmorecfg.h" /* seldom changed options */
-
-
-/* Version ID for the JPEG library.
- * Might be useful for tests like "#if JPEG_LIB_VERSION >= 60".
- */
-
-#define JPEG_LIB_VERSION 62 /* Version 6b */
-
-
-/* Various constants determining the sizes of things.
- * All of these are specified by the JPEG standard, so don't change them
- * if you want to be compatible.
- */
-
-#define DCTSIZE 8 /* The basic DCT block is 8x8 samples */
-#define DCTSIZE2 64 /* DCTSIZE squared; # of elements in a block */
-#define NUM_QUANT_TBLS 4 /* Quantization tables are numbered 0..3 */
-#define NUM_HUFF_TBLS 4 /* Huffman tables are numbered 0..3 */
-#define NUM_ARITH_TBLS 16 /* Arith-coding tables are numbered 0..15 */
-#define MAX_COMPS_IN_SCAN 4 /* JPEG limit on # of components in one scan */
-#define MAX_SAMP_FACTOR 4 /* JPEG limit on sampling factors */
-/* Unfortunately, some bozo at Adobe saw no reason to be bound by the standard;
- * the PostScript DCT filter can emit files with many more than 10 blocks/MCU.
- * If you happen to run across such a file, you can up D_MAX_BLOCKS_IN_MCU
- * to handle it. We even let you do this from the jconfig.h file. However,
- * we strongly discourage changing C_MAX_BLOCKS_IN_MCU; just because Adobe
- * sometimes emits noncompliant files doesn't mean you should too.
- */
-#define C_MAX_BLOCKS_IN_MCU 10 /* compressor's limit on blocks per MCU */
-#ifndef D_MAX_BLOCKS_IN_MCU
-#define D_MAX_BLOCKS_IN_MCU 10 /* decompressor's limit on blocks per MCU */
-#endif
-
-
-/* Data structures for images (arrays of samples and of DCT coefficients).
- * On 80x86 machines, the image arrays are too big for near pointers,
- * but the pointer arrays can fit in near memory.
- */
-
-typedef JSAMPLE *JSAMPROW; /* ptr to one image row of pixel samples. */
-typedef JSAMPROW *JSAMPARRAY; /* ptr to some rows (a 2-D sample array) */
-typedef JSAMPARRAY *JSAMPIMAGE; /* a 3-D sample array: top index is color */
-
-typedef JCOEF JBLOCK[DCTSIZE2]; /* one block of coefficients */
-typedef JBLOCK *JBLOCKROW; /* pointer to one row of coefficient blocks */
-typedef JBLOCKROW *JBLOCKARRAY; /* a 2-D array of coefficient blocks */
-typedef JBLOCKARRAY *JBLOCKIMAGE; /* a 3-D array of coefficient blocks */
-
-typedef JCOEF *JCOEFPTR; /* useful in a couple of places */
-
-
-/* Types for JPEG compression parameters and working tables. */
-
-
-/* DCT coefficient quantization tables. */
-
-typedef struct {
- /* This array gives the coefficient quantizers in natural array order
- * (not the zigzag order in which they are stored in a JPEG DQT marker).
- * CAUTION: IJG versions prior to v6a kept this array in zigzag order.
- */
- UINT16 quantval[DCTSIZE2]; /* quantization step for each coefficient */
- /* This field is used only during compression. It's initialized FALSE when
- * the table is created, and set TRUE when it's been output to the file.
- * You could suppress output of a table by setting this to TRUE.
- * (See jpeg_suppress_tables for an example.)
- */
- boolean sent_table; /* TRUE when table has been output */
-} JQUANT_TBL;
-
-
-/* Huffman coding tables. */
-
-typedef struct {
- /* These two fields directly represent the contents of a JPEG DHT marker */
- UINT8 bits[17]; /* bits[k] = # of symbols with codes of */
- /* length k bits; bits[0] is unused */
- UINT8 huffval[256]; /* The symbols, in order of incr code length */
- /* This field is used only during compression. It's initialized FALSE when
- * the table is created, and set TRUE when it's been output to the file.
- * You could suppress output of a table by setting this to TRUE.
- * (See jpeg_suppress_tables for an example.)
- */
- boolean sent_table; /* TRUE when table has been output */
-} JHUFF_TBL;
-
-
-/* Basic info about one component (color channel). */
-
-typedef struct {
- /* These values are fixed over the whole image. */
- /* For compression, they must be supplied by parameter setup; */
- /* for decompression, they are read from the SOF marker. */
- int component_id; /* identifier for this component (0..255) */
- int component_index; /* its index in SOF or cinfo->comp_info[] */
- int h_samp_factor; /* horizontal sampling factor (1..4) */
- int v_samp_factor; /* vertical sampling factor (1..4) */
- int quant_tbl_no; /* quantization table selector (0..3) */
- /* These values may vary between scans. */
- /* For compression, they must be supplied by parameter setup; */
- /* for decompression, they are read from the SOS marker. */
- /* The decompressor output side may not use these variables. */
- int dc_tbl_no; /* DC entropy table selector (0..3) */
- int ac_tbl_no; /* AC entropy table selector (0..3) */
-
- /* Remaining fields should be treated as private by applications. */
-
- /* These values are computed during compression or decompression startup: */
- /* Component's size in DCT blocks.
- * Any dummy blocks added to complete an MCU are not counted; therefore
- * these values do not depend on whether a scan is interleaved or not.
- */
- JDIMENSION width_in_blocks;
- JDIMENSION height_in_blocks;
- /* Size of a DCT block in samples. Always DCTSIZE for compression.
- * For decompression this is the size of the output from one DCT block,
- * reflecting any scaling we choose to apply during the IDCT step.
- * Values of 1,2,4,8 are likely to be supported. Note that different
- * components may receive different IDCT scalings.
- */
- int DCT_scaled_size;
- /* The downsampled dimensions are the component's actual, unpadded number
- * of samples at the main buffer (preprocessing/compression interface), thus
- * downsampled_width = ceil(image_width * Hi/Hmax)
- * and similarly for height. For decompression, IDCT scaling is included, so
- * downsampled_width = ceil(image_width * Hi/Hmax * DCT_scaled_size/DCTSIZE)
- */
- JDIMENSION downsampled_width; /* actual width in samples */
- JDIMENSION downsampled_height; /* actual height in samples */
- /* This flag is used only for decompression. In cases where some of the
- * components will be ignored (eg grayscale output from YCbCr image),
- * we can skip most computations for the unused components.
- */
- boolean component_needed; /* do we need the value of this component? */
-
- /* These values are computed before starting a scan of the component. */
- /* The decompressor output side may not use these variables. */
- int MCU_width; /* number of blocks per MCU, horizontally */
- int MCU_height; /* number of blocks per MCU, vertically */
- int MCU_blocks; /* MCU_width * MCU_height */
- int MCU_sample_width; /* MCU width in samples, MCU_width*DCT_scaled_size */
- int last_col_width; /* # of non-dummy blocks across in last MCU */
- int last_row_height; /* # of non-dummy blocks down in last MCU */
-
- /* Saved quantization table for component; NULL if none yet saved.
- * See jdinput.c comments about the need for this information.
- * This field is currently used only for decompression.
- */
- JQUANT_TBL * quant_table;
-
- /* Private per-component storage for DCT or IDCT subsystem. */
- void * dct_table;
-} jpeg_component_info;
-
-
-/* The script for encoding a multiple-scan file is an array of these: */
-
-typedef struct {
- int comps_in_scan; /* number of components encoded in this scan */
- int component_index[MAX_COMPS_IN_SCAN]; /* their SOF/comp_info[] indexes */
- int Ss, Se; /* progressive JPEG spectral selection parms */
- int Ah, Al; /* progressive JPEG successive approx. parms */
-} jpeg_scan_info;
-
-/* The decompressor can save APPn and COM markers in a list of these: */
-
-typedef struct jpeg_marker_struct * jpeg_saved_marker_ptr;
-
-struct jpeg_marker_struct {
- jpeg_saved_marker_ptr next; /* next in list, or NULL */
- UINT8 marker; /* marker code: JPEG_COM, or JPEG_APP0+n */
- unsigned int original_length; /* # bytes of data in the file */
- unsigned int data_length; /* # bytes of data saved at data[] */
- JOCTET * data; /* the data contained in the marker */
- /* the marker length word is not counted in data_length or original_length */
-};
-
-/* Known color spaces. */
-
-typedef enum {
- JCS_UNKNOWN, /* error/unspecified */
- JCS_GRAYSCALE, /* monochrome */
- JCS_RGB, /* red/green/blue */
- JCS_YCbCr, /* Y/Cb/Cr (also known as YUV) */
- JCS_CMYK, /* C/M/Y/K */
- JCS_YCCK /* Y/Cb/Cr/K */
-} J_COLOR_SPACE;
-
-/* DCT/IDCT algorithm options. */
-
-typedef enum {
- JDCT_ISLOW, /* slow but accurate integer algorithm */
- JDCT_IFAST, /* faster, less accurate integer method */
- JDCT_FLOAT /* floating-point: accurate, fast on fast HW */
-} J_DCT_METHOD;
-
-#ifndef JDCT_DEFAULT /* may be overridden in jconfig.h */
-#define JDCT_DEFAULT JDCT_ISLOW
-#endif
-#ifndef JDCT_FASTEST /* may be overridden in jconfig.h */
-#define JDCT_FASTEST JDCT_IFAST
-#endif
-
-/* Dithering options for decompression. */
-
-typedef enum {
- JDITHER_NONE, /* no dithering */
- JDITHER_ORDERED, /* simple ordered dither */
- JDITHER_FS /* Floyd-Steinberg error diffusion dither */
-} J_DITHER_MODE;
-
-
-/* Common fields between JPEG compression and decompression master structs. */
-
-#define jpeg_common_fields \
- struct jpeg_error_mgr * err; /* Error handler module */\
- struct jpeg_memory_mgr * mem; /* Memory manager module */\
- struct jpeg_progress_mgr * progress; /* Progress monitor, or NULL if none */\
- void * client_data; /* Available for use by application */\
- boolean is_decompressor; /* So common code can tell which is which */\
- int global_state /* For checking call sequence validity */
-
-/* Routines that are to be used by both halves of the library are declared
- * to receive a pointer to this structure. There are no actual instances of
- * jpeg_common_struct, only of jpeg_compress_struct and jpeg_decompress_struct.
- */
-struct jpeg_common_struct {
- jpeg_common_fields; /* Fields common to both master struct types */
- /* Additional fields follow in an actual jpeg_compress_struct or
- * jpeg_decompress_struct. All three structs must agree on these
- * initial fields! (This would be a lot cleaner in C++.)
- */
-};
-
-typedef struct jpeg_common_struct * j_common_ptr;
-typedef struct jpeg_compress_struct * j_compress_ptr;
-typedef struct jpeg_decompress_struct * j_decompress_ptr;
-
-
-/* Master record for a compression instance */
-
-struct jpeg_compress_struct {
- jpeg_common_fields; /* Fields shared with jpeg_decompress_struct */
-
- /* Destination for compressed data */
- struct jpeg_destination_mgr * dest;
-
- /* Description of source image --- these fields must be filled in by
- * outer application before starting compression. in_color_space must
- * be correct before you can even call jpeg_set_defaults().
- */
-
- JDIMENSION image_width; /* input image width */
- JDIMENSION image_height; /* input image height */
- int input_components; /* # of color components in input image */
- J_COLOR_SPACE in_color_space; /* colorspace of input image */
-
- double input_gamma; /* image gamma of input image */
-
- /* Compression parameters --- these fields must be set before calling
- * jpeg_start_compress(). We recommend calling jpeg_set_defaults() to
- * initialize everything to reasonable defaults, then changing anything
- * the application specifically wants to change. That way you won't get
- * burnt when new parameters are added. Also note that there are several
- * helper routines to simplify changing parameters.
- */
-
- int data_precision; /* bits of precision in image data */
-
- int num_components; /* # of color components in JPEG image */
- J_COLOR_SPACE jpeg_color_space; /* colorspace of JPEG image */
-
- jpeg_component_info * comp_info;
- /* comp_info[i] describes component that appears i'th in SOF */
-
- JQUANT_TBL * quant_tbl_ptrs[NUM_QUANT_TBLS];
- /* ptrs to coefficient quantization tables, or NULL if not defined */
-
- JHUFF_TBL * dc_huff_tbl_ptrs[NUM_HUFF_TBLS];
- JHUFF_TBL * ac_huff_tbl_ptrs[NUM_HUFF_TBLS];
- /* ptrs to Huffman coding tables, or NULL if not defined */
-
- UINT8 arith_dc_L[NUM_ARITH_TBLS]; /* L values for DC arith-coding tables */
- UINT8 arith_dc_U[NUM_ARITH_TBLS]; /* U values for DC arith-coding tables */
- UINT8 arith_ac_K[NUM_ARITH_TBLS]; /* Kx values for AC arith-coding tables */
-
- int num_scans; /* # of entries in scan_info array */
- const jpeg_scan_info * scan_info; /* script for multi-scan file, or NULL */
- /* The default value of scan_info is NULL, which causes a single-scan
- * sequential JPEG file to be emitted. To create a multi-scan file,
- * set num_scans and scan_info to point to an array of scan definitions.
- */
-
- boolean raw_data_in; /* TRUE=caller supplies downsampled data */
- boolean arith_code; /* TRUE=arithmetic coding, FALSE=Huffman */
- boolean optimize_coding; /* TRUE=optimize entropy encoding parms */
- boolean CCIR601_sampling; /* TRUE=first samples are cosited */
- int smoothing_factor; /* 1..100, or 0 for no input smoothing */
- J_DCT_METHOD dct_method; /* DCT algorithm selector */
-
- /* The restart interval can be specified in absolute MCUs by setting
- * restart_interval, or in MCU rows by setting restart_in_rows
- * (in which case the correct restart_interval will be figured
- * for each scan).
- */
- unsigned int restart_interval; /* MCUs per restart, or 0 for no restart */
- int restart_in_rows; /* if > 0, MCU rows per restart interval */
-
- /* Parameters controlling emission of special markers. */
-
- boolean write_JFIF_header; /* should a JFIF marker be written? */
- UINT8 JFIF_major_version; /* What to write for the JFIF version number */
- UINT8 JFIF_minor_version;
- /* These three values are not used by the JPEG code, merely copied */
- /* into the JFIF APP0 marker. density_unit can be 0 for unknown, */
- /* 1 for dots/inch, or 2 for dots/cm. Note that the pixel aspect */
- /* ratio is defined by X_density/Y_density even when density_unit=0. */
- UINT8 density_unit; /* JFIF code for pixel size units */
- UINT16 X_density; /* Horizontal pixel density */
- UINT16 Y_density; /* Vertical pixel density */
- boolean write_Adobe_marker; /* should an Adobe marker be written? */
-
- /* State variable: index of next scanline to be written to
- * jpeg_write_scanlines(). Application may use this to control its
- * processing loop, e.g., "while (next_scanline < image_height)".
- */
-
- JDIMENSION next_scanline; /* 0 .. image_height-1 */
-
- /* Remaining fields are known throughout compressor, but generally
- * should not be touched by a surrounding application.
- */
-
- /*
- * These fields are computed during compression startup
- */
- boolean progressive_mode; /* TRUE if scan script uses progressive mode */
- int max_h_samp_factor; /* largest h_samp_factor */
- int max_v_samp_factor; /* largest v_samp_factor */
-
- JDIMENSION total_iMCU_rows; /* # of iMCU rows to be input to coef ctlr */
- /* The coefficient controller receives data in units of MCU rows as defined
- * for fully interleaved scans (whether the JPEG file is interleaved or not).
- * There are v_samp_factor * DCTSIZE sample rows of each component in an
- * "iMCU" (interleaved MCU) row.
- */
-
- /*
- * These fields are valid during any one scan.
- * They describe the components and MCUs actually appearing in the scan.
- */
- int comps_in_scan; /* # of JPEG components in this scan */
- jpeg_component_info * cur_comp_info[MAX_COMPS_IN_SCAN];
- /* *cur_comp_info[i] describes component that appears i'th in SOS */
-
- JDIMENSION MCUs_per_row; /* # of MCUs across the image */
- JDIMENSION MCU_rows_in_scan; /* # of MCU rows in the image */
-
- int blocks_in_MCU; /* # of DCT blocks per MCU */
- int MCU_membership[C_MAX_BLOCKS_IN_MCU];
- /* MCU_membership[i] is index in cur_comp_info of component owning */
- /* i'th block in an MCU */
-
- int Ss, Se, Ah, Al; /* progressive JPEG parameters for scan */
-
- /*
- * Links to compression subobjects (methods and private variables of modules)
- */
- struct jpeg_comp_master * master;
- struct jpeg_c_main_controller * main;
- struct jpeg_c_prep_controller * prep;
- struct jpeg_c_coef_controller * coef;
- struct jpeg_marker_writer * marker;
- struct jpeg_color_converter * cconvert;
- struct jpeg_downsampler * downsample;
- struct jpeg_forward_dct * fdct;
- struct jpeg_entropy_encoder * entropy;
- jpeg_scan_info * script_space; /* workspace for jpeg_simple_progression */
- int script_space_size;
-};
-
-
-/* Master record for a decompression instance */
-
-struct jpeg_decompress_struct {
- jpeg_common_fields; /* Fields shared with jpeg_compress_struct */
-
- /* Source of compressed data */
- struct jpeg_source_mgr * src;
-
- /* Basic description of image --- filled in by jpeg_read_header(). */
- /* Application may inspect these values to decide how to process image. */
-
- JDIMENSION image_width; /* nominal image width (from SOF marker) */
- JDIMENSION image_height; /* nominal image height */
- int num_components; /* # of color components in JPEG image */
- J_COLOR_SPACE jpeg_color_space; /* colorspace of JPEG image */
-
- /* Decompression processing parameters --- these fields must be set before
- * calling jpeg_start_decompress(). Note that jpeg_read_header() initializes
- * them to default values.
- */
-
- J_COLOR_SPACE out_color_space; /* colorspace for output */
-
- unsigned int scale_num, scale_denom; /* fraction by which to scale image */
-
- double output_gamma; /* image gamma wanted in output */
-
- boolean buffered_image; /* TRUE=multiple output passes */
- boolean raw_data_out; /* TRUE=downsampled data wanted */
-
- J_DCT_METHOD dct_method; /* IDCT algorithm selector */
- boolean do_fancy_upsampling; /* TRUE=apply fancy upsampling */
- boolean do_block_smoothing; /* TRUE=apply interblock smoothing */
-
- boolean quantize_colors; /* TRUE=colormapped output wanted */
- /* the following are ignored if not quantize_colors: */
- J_DITHER_MODE dither_mode; /* type of color dithering to use */
- boolean two_pass_quantize; /* TRUE=use two-pass color quantization */
- int desired_number_of_colors; /* max # colors to use in created colormap */
- /* these are significant only in buffered-image mode: */
- boolean enable_1pass_quant; /* enable future use of 1-pass quantizer */
- boolean enable_external_quant;/* enable future use of external colormap */
- boolean enable_2pass_quant; /* enable future use of 2-pass quantizer */
-
- /* Description of actual output image that will be returned to application.
- * These fields are computed by jpeg_start_decompress().
- * You can also use jpeg_calc_output_dimensions() to determine these values
- * in advance of calling jpeg_start_decompress().
- */
-
- JDIMENSION output_width; /* scaled image width */
- JDIMENSION output_height; /* scaled image height */
- int out_color_components; /* # of color components in out_color_space */
- int output_components; /* # of color components returned */
- /* output_components is 1 (a colormap index) when quantizing colors;
- * otherwise it equals out_color_components.
- */
- int rec_outbuf_height; /* min recommended height of scanline buffer */
- /* If the buffer passed to jpeg_read_scanlines() is less than this many rows
- * high, space and time will be wasted due to unnecessary data copying.
- * Usually rec_outbuf_height will be 1 or 2, at most 4.
- */
-
- /* When quantizing colors, the output colormap is described by these fields.
- * The application can supply a colormap by setting colormap non-NULL before
- * calling jpeg_start_decompress; otherwise a colormap is created during
- * jpeg_start_decompress or jpeg_start_output.
- * The map has out_color_components rows and actual_number_of_colors columns.
- */
- int actual_number_of_colors; /* number of entries in use */
- JSAMPARRAY colormap; /* The color map as a 2-D pixel array */
-
- /* State variables: these variables indicate the progress of decompression.
- * The application may examine these but must not modify them.
- */
-
- /* Row index of next scanline to be read from jpeg_read_scanlines().
- * Application may use this to control its processing loop, e.g.,
- * "while (output_scanline < output_height)".
- */
- JDIMENSION output_scanline; /* 0 .. output_height-1 */
-
- /* Current input scan number and number of iMCU rows completed in scan.
- * These indicate the progress of the decompressor input side.
- */
- int input_scan_number; /* Number of SOS markers seen so far */
- JDIMENSION input_iMCU_row; /* Number of iMCU rows completed */
-
- /* The "output scan number" is the notional scan being displayed by the
- * output side. The decompressor will not allow output scan/row number
- * to get ahead of input scan/row, but it can fall arbitrarily far behind.
- */
- int output_scan_number; /* Nominal scan number being displayed */
- JDIMENSION output_iMCU_row; /* Number of iMCU rows read */
-
- /* Current progression status. coef_bits[c][i] indicates the precision
- * with which component c's DCT coefficient i (in zigzag order) is known.
- * It is -1 when no data has yet been received, otherwise it is the point
- * transform (shift) value for the most recent scan of the coefficient
- * (thus, 0 at completion of the progression).
- * This pointer is NULL when reading a non-progressive file.
- */
- int (*coef_bits)[DCTSIZE2]; /* -1 or current Al value for each coef */
-
- /* Internal JPEG parameters --- the application usually need not look at
- * these fields. Note that the decompressor output side may not use
- * any parameters that can change between scans.
- */
-
- /* Quantization and Huffman tables are carried forward across input
- * datastreams when processing abbreviated JPEG datastreams.
- */
-
- JQUANT_TBL * quant_tbl_ptrs[NUM_QUANT_TBLS];
- /* ptrs to coefficient quantization tables, or NULL if not defined */
-
- JHUFF_TBL * dc_huff_tbl_ptrs[NUM_HUFF_TBLS];
- JHUFF_TBL * ac_huff_tbl_ptrs[NUM_HUFF_TBLS];
- /* ptrs to Huffman coding tables, or NULL if not defined */
-
- /* These parameters are never carried across datastreams, since they
- * are given in SOF/SOS markers or defined to be reset by SOI.
- */
-
- int data_precision; /* bits of precision in image data */
-
- jpeg_component_info * comp_info;
- /* comp_info[i] describes component that appears i'th in SOF */
-
- boolean progressive_mode; /* TRUE if SOFn specifies progressive mode */
- boolean arith_code; /* TRUE=arithmetic coding, FALSE=Huffman */
-
- UINT8 arith_dc_L[NUM_ARITH_TBLS]; /* L values for DC arith-coding tables */
- UINT8 arith_dc_U[NUM_ARITH_TBLS]; /* U values for DC arith-coding tables */
- UINT8 arith_ac_K[NUM_ARITH_TBLS]; /* Kx values for AC arith-coding tables */
-
- unsigned int restart_interval; /* MCUs per restart interval, or 0 for no restart */
-
- /* These fields record data obtained from optional markers recognized by
- * the JPEG library.
- */
- boolean saw_JFIF_marker; /* TRUE iff a JFIF APP0 marker was found */
- /* Data copied from JFIF marker; only valid if saw_JFIF_marker is TRUE: */
- UINT8 JFIF_major_version; /* JFIF version number */
- UINT8 JFIF_minor_version;
- UINT8 density_unit; /* JFIF code for pixel size units */
- UINT16 X_density; /* Horizontal pixel density */
- UINT16 Y_density; /* Vertical pixel density */
- boolean saw_Adobe_marker; /* TRUE iff an Adobe APP14 marker was found */
- UINT8 Adobe_transform; /* Color transform code from Adobe marker */
-
- boolean CCIR601_sampling; /* TRUE=first samples are cosited */
-
- /* Aside from the specific data retained from APPn markers known to the
- * library, the uninterpreted contents of any or all APPn and COM markers
- * can be saved in a list for examination by the application.
- */
- jpeg_saved_marker_ptr marker_list; /* Head of list of saved markers */
-
- /* Remaining fields are known throughout decompressor, but generally
- * should not be touched by a surrounding application.
- */
-
- /*
- * These fields are computed during decompression startup
- */
- int max_h_samp_factor; /* largest h_samp_factor */
- int max_v_samp_factor; /* largest v_samp_factor */
-
- int min_DCT_scaled_size; /* smallest DCT_scaled_size of any component */
-
- JDIMENSION total_iMCU_rows; /* # of iMCU rows in image */
- /* The coefficient controller's input and output progress is measured in
- * units of "iMCU" (interleaved MCU) rows. These are the same as MCU rows
- * in fully interleaved JPEG scans, but are used whether the scan is
- * interleaved or not. We define an iMCU row as v_samp_factor DCT block
- * rows of each component. Therefore, the IDCT output contains
- * v_samp_factor*DCT_scaled_size sample rows of a component per iMCU row.
- */
-
- JSAMPLE * sample_range_limit; /* table for fast range-limiting */
-
- /*
- * These fields are valid during any one scan.
- * They describe the components and MCUs actually appearing in the scan.
- * Note that the decompressor output side must not use these fields.
- */
- int comps_in_scan; /* # of JPEG components in this scan */
- jpeg_component_info * cur_comp_info[MAX_COMPS_IN_SCAN];
- /* *cur_comp_info[i] describes component that appears i'th in SOS */
-
- JDIMENSION MCUs_per_row; /* # of MCUs across the image */
- JDIMENSION MCU_rows_in_scan; /* # of MCU rows in the image */
-
- int blocks_in_MCU; /* # of DCT blocks per MCU */
- int MCU_membership[D_MAX_BLOCKS_IN_MCU];
- /* MCU_membership[i] is index in cur_comp_info of component owning */
- /* i'th block in an MCU */
-
- int Ss, Se, Ah, Al; /* progressive JPEG parameters for scan */
-
- /* This field is shared between entropy decoder and marker parser.
- * It is either zero or the code of a JPEG marker that has been
- * read from the data source, but has not yet been processed.
- */
- int unread_marker;
-
- /*
- * Links to decompression subobjects (methods, private variables of modules)
- */
- struct jpeg_decomp_master * master;
- struct jpeg_d_main_controller * main;
- struct jpeg_d_coef_controller * coef;
- struct jpeg_d_post_controller * post;
- struct jpeg_input_controller * inputctl;
- struct jpeg_marker_reader * marker;
- struct jpeg_entropy_decoder * entropy;
- struct jpeg_inverse_dct * idct;
- struct jpeg_upsampler * upsample;
- struct jpeg_color_deconverter * cconvert;
- struct jpeg_color_quantizer * cquantize;
-};
-
-
-/* "Object" declarations for JPEG modules that may be supplied or called
- * directly by the surrounding application.
- * As with all objects in the JPEG library, these structs only define the
- * publicly visible methods and state variables of a module. Additional
- * private fields may exist after the public ones.
- */
-
-
-/* Error handler object */
-
-struct jpeg_error_mgr {
- /* Error exit handler: does not return to caller */
- JMETHOD(void, error_exit, (j_common_ptr cinfo));
- /* Conditionally emit a trace or warning message */
- JMETHOD(void, emit_message, (j_common_ptr cinfo, int msg_level));
- /* Routine that actually outputs a trace or error message */
- JMETHOD(void, output_message, (j_common_ptr cinfo));
- /* Format a message string for the most recent JPEG error or message */
- JMETHOD(void, format_message, (j_common_ptr cinfo, char * buffer));
-#define JMSG_LENGTH_MAX 200 /* recommended size of format_message buffer */
- /* Reset error state variables at start of a new image */
- JMETHOD(void, reset_error_mgr, (j_common_ptr cinfo));
-
- /* The message ID code and any parameters are saved here.
- * A message can have one string parameter or up to 8 int parameters.
- */
- int msg_code;
-#define JMSG_STR_PARM_MAX 80
- union {
- int i[8];
- char s[JMSG_STR_PARM_MAX];
- } msg_parm;
-
- /* Standard state variables for error facility */
-
- int trace_level; /* max msg_level that will be displayed */
-
- /* For recoverable corrupt-data errors, we emit a warning message,
- * but keep going unless emit_message chooses to abort. emit_message
- * should count warnings in num_warnings. The surrounding application
- * can check for bad data by seeing if num_warnings is nonzero at the
- * end of processing.
- */
- long num_warnings; /* number of corrupt-data warnings */
-
- /* These fields point to the table(s) of error message strings.
- * An application can change the table pointer to switch to a different
- * message list (typically, to change the language in which errors are
- * reported). Some applications may wish to add additional error codes
- * that will be handled by the JPEG library error mechanism; the second
- * table pointer is used for this purpose.
- *
- * First table includes all errors generated by JPEG library itself.
- * Error code 0 is reserved for a "no such error string" message.
- */
- const char * const * jpeg_message_table; /* Library errors */
- int last_jpeg_message; /* Table contains strings 0..last_jpeg_message */
- /* Second table can be added by application (see cjpeg/djpeg for example).
- * It contains strings numbered first_addon_message..last_addon_message.
- */
- const char * const * addon_message_table; /* Non-library errors */
- int first_addon_message; /* code for first string in addon table */
- int last_addon_message; /* code for last string in addon table */
-};
-
-
-/* Progress monitor object */
-
-struct jpeg_progress_mgr {
- JMETHOD(void, progress_monitor, (j_common_ptr cinfo));
-
- long pass_counter; /* work units completed in this pass */
- long pass_limit; /* total number of work units in this pass */
- int completed_passes; /* passes completed so far */
- int total_passes; /* total number of passes expected */
-};
-
-
-/* Data destination object for compression */
-
-struct jpeg_destination_mgr {
- JOCTET * next_output_byte; /* => next byte to write in buffer */
- size_t free_in_buffer; /* # of byte spaces remaining in buffer */
-
- JMETHOD(void, init_destination, (j_compress_ptr cinfo));
- JMETHOD(boolean, empty_output_buffer, (j_compress_ptr cinfo));
- JMETHOD(void, term_destination, (j_compress_ptr cinfo));
-};
-
-
-/* Data source object for decompression */
-
-struct jpeg_source_mgr {
- const JOCTET * next_input_byte; /* => next byte to read from buffer */
- size_t bytes_in_buffer; /* # of bytes remaining in buffer */
-
- JMETHOD(void, init_source, (j_decompress_ptr cinfo));
- JMETHOD(boolean, fill_input_buffer, (j_decompress_ptr cinfo));
- JMETHOD(void, skip_input_data, (j_decompress_ptr cinfo, long num_bytes));
- JMETHOD(boolean, resync_to_restart, (j_decompress_ptr cinfo, int desired));
- JMETHOD(void, term_source, (j_decompress_ptr cinfo));
-};
-
-
-/* Memory manager object.
- * Allocates "small" objects (a few K total), "large" objects (tens of K),
- * and "really big" objects (virtual arrays with backing store if needed).
- * The memory manager does not allow individual objects to be freed; rather,
- * each created object is assigned to a pool, and whole pools can be freed
- * at once. This is faster and more convenient than remembering exactly what
- * to free, especially where malloc()/free() are not too speedy.
- * NB: alloc routines never return NULL. They exit to error_exit if not
- * successful.
- */
-
-#define JPOOL_PERMANENT 0 /* lasts until master record is destroyed */
-#define JPOOL_IMAGE 1 /* lasts until done with image/datastream */
-#define JPOOL_NUMPOOLS 2
-
-typedef struct jvirt_sarray_control * jvirt_sarray_ptr;
-typedef struct jvirt_barray_control * jvirt_barray_ptr;
-
-
-struct jpeg_memory_mgr {
- /* Method pointers */
- JMETHOD(void *, alloc_small, (j_common_ptr cinfo, int pool_id,
- size_t sizeofobject));
- JMETHOD(void *, alloc_large, (j_common_ptr cinfo, int pool_id,
- size_t sizeofobject));
- JMETHOD(JSAMPARRAY, alloc_sarray, (j_common_ptr cinfo, int pool_id,
- JDIMENSION samplesperrow,
- JDIMENSION numrows));
- JMETHOD(JBLOCKARRAY, alloc_barray, (j_common_ptr cinfo, int pool_id,
- JDIMENSION blocksperrow,
- JDIMENSION numrows));
- JMETHOD(jvirt_sarray_ptr, request_virt_sarray, (j_common_ptr cinfo,
- int pool_id,
- boolean pre_zero,
- JDIMENSION samplesperrow,
- JDIMENSION numrows,
- JDIMENSION maxaccess));
- JMETHOD(jvirt_barray_ptr, request_virt_barray, (j_common_ptr cinfo,
- int pool_id,
- boolean pre_zero,
- JDIMENSION blocksperrow,
- JDIMENSION numrows,
- JDIMENSION maxaccess));
- JMETHOD(void, realize_virt_arrays, (j_common_ptr cinfo));
- JMETHOD(JSAMPARRAY, access_virt_sarray, (j_common_ptr cinfo,
- jvirt_sarray_ptr ptr,
- JDIMENSION start_row,
- JDIMENSION num_rows,
- boolean writable));
- JMETHOD(JBLOCKARRAY, access_virt_barray, (j_common_ptr cinfo,
- jvirt_barray_ptr ptr,
- JDIMENSION start_row,
- JDIMENSION num_rows,
- boolean writable));
- JMETHOD(void, free_pool, (j_common_ptr cinfo, int pool_id));
- JMETHOD(void, self_destruct, (j_common_ptr cinfo));
-
- /* Limit on memory allocation for this JPEG object. (Note that this is
- * merely advisory, not a guaranteed maximum; it only affects the space
- * used for virtual-array buffers.) May be changed by outer application
- * after creating the JPEG object.
- */
- long max_memory_to_use;
-
- /* Maximum allocation request accepted by alloc_large. */
- long max_alloc_chunk;
-};
-
-
-/* Routine signature for application-supplied marker processing methods.
- * Need not pass marker code since it is stored in cinfo->unread_marker.
- */
-typedef JMETHOD(boolean, jpeg_marker_parser_method, (j_decompress_ptr cinfo));
-
-
-/* Declarations for routines called by application.
- * The JPP macro hides prototype parameters from compilers that can't cope.
- * Note JPP requires double parentheses.
- */
-
-#ifdef HAVE_PROTOTYPES
-#define JPP(arglist) arglist
-#else
-#define JPP(arglist) ()
-#endif
-
-
-/* Short forms of external names for systems with brain-damaged linkers.
- * We shorten external names to be unique in the first six letters, which
- * is good enough for all known systems.
- * (If your compiler itself needs names to be unique in less than 15
- * characters, you are out of luck. Get a better compiler.)
- */
-
-#ifdef NEED_SHORT_EXTERNAL_NAMES
-#define jpeg_std_error jStdError
-#define jpeg_CreateCompress jCreaCompress
-#define jpeg_CreateDecompress jCreaDecompress
-#define jpeg_destroy_compress jDestCompress
-#define jpeg_destroy_decompress jDestDecompress
-#define jpeg_stdio_dest jStdDest
-#define jpeg_stdio_src jStdSrc
-#define jpeg_set_defaults jSetDefaults
-#define jpeg_set_colorspace jSetColorspace
-#define jpeg_default_colorspace jDefColorspace
-#define jpeg_set_quality jSetQuality
-#define jpeg_set_linear_quality jSetLQuality
-#define jpeg_add_quant_table jAddQuantTable
-#define jpeg_quality_scaling jQualityScaling
-#define jpeg_simple_progression jSimProgress
-#define jpeg_suppress_tables jSuppressTables
-#define jpeg_alloc_quant_table jAlcQTable
-#define jpeg_alloc_huff_table jAlcHTable
-#define jpeg_start_compress jStrtCompress
-#define jpeg_write_scanlines jWrtScanlines
-#define jpeg_finish_compress jFinCompress
-#define jpeg_write_raw_data jWrtRawData
-#define jpeg_write_marker jWrtMarker
-#define jpeg_write_m_header jWrtMHeader
-#define jpeg_write_m_byte jWrtMByte
-#define jpeg_write_tables jWrtTables
-#define jpeg_read_header jReadHeader
-#define jpeg_start_decompress jStrtDecompress
-#define jpeg_read_scanlines jReadScanlines
-#define jpeg_finish_decompress jFinDecompress
-#define jpeg_read_raw_data jReadRawData
-#define jpeg_has_multiple_scans jHasMultScn
-#define jpeg_start_output jStrtOutput
-#define jpeg_finish_output jFinOutput
-#define jpeg_input_complete jInComplete
-#define jpeg_new_colormap jNewCMap
-#define jpeg_consume_input jConsumeInput
-#define jpeg_calc_output_dimensions jCalcDimensions
-#define jpeg_save_markers jSaveMarkers
-#define jpeg_set_marker_processor jSetMarker
-#define jpeg_read_coefficients jReadCoefs
-#define jpeg_write_coefficients jWrtCoefs
-#define jpeg_copy_critical_parameters jCopyCrit
-#define jpeg_abort_compress jAbrtCompress
-#define jpeg_abort_decompress jAbrtDecompress
-#define jpeg_abort jAbort
-#define jpeg_destroy jDestroy
-#define jpeg_resync_to_restart jResyncRestart
-#endif /* NEED_SHORT_EXTERNAL_NAMES */
-
-
-/* Default error-management setup */
-EXTERN(struct jpeg_error_mgr *) jpeg_std_error
- JPP((struct jpeg_error_mgr * err));
-
-/* Initialization of JPEG compression objects.
- * jpeg_create_compress() and jpeg_create_decompress() are the exported
- * names that applications should call. These expand to calls on
- * jpeg_CreateCompress and jpeg_CreateDecompress with additional information
- * passed for version mismatch checking.
- * NB: you must set up the error-manager BEFORE calling jpeg_create_xxx.
- */
-#define jpeg_create_compress(cinfo) \
- jpeg_CreateCompress((cinfo), JPEG_LIB_VERSION, \
- (size_t) sizeof(struct jpeg_compress_struct))
-#define jpeg_create_decompress(cinfo) \
- jpeg_CreateDecompress((cinfo), JPEG_LIB_VERSION, \
- (size_t) sizeof(struct jpeg_decompress_struct))
-EXTERN(void) jpeg_CreateCompress JPP((j_compress_ptr cinfo,
- int version, size_t structsize));
-EXTERN(void) jpeg_CreateDecompress JPP((j_decompress_ptr cinfo,
- int version, size_t structsize));
-/* Destruction of JPEG compression objects */
-EXTERN(void) jpeg_destroy_compress JPP((j_compress_ptr cinfo));
-EXTERN(void) jpeg_destroy_decompress JPP((j_decompress_ptr cinfo));
-
-#if 0
-/* Standard data source and destination managers: stdio streams. */
-/* Caller is responsible for opening the file before and closing after. */
-EXTERN(void) jpeg_stdio_dest JPP((j_compress_ptr cinfo, FXSYS_FILE * outfile));
-EXTERN(void) jpeg_stdio_src JPP((j_decompress_ptr cinfo, FXSYS_FILE * infile));
-#endif
-
-/* Default parameter setup for compression */
-EXTERN(void) jpeg_set_defaults JPP((j_compress_ptr cinfo));
-/* Compression parameter setup aids */
-EXTERN(void) jpeg_set_colorspace JPP((j_compress_ptr cinfo,
- J_COLOR_SPACE colorspace));
-EXTERN(void) jpeg_default_colorspace JPP((j_compress_ptr cinfo));
-EXTERN(void) jpeg_set_quality JPP((j_compress_ptr cinfo, int quality,
- boolean force_baseline));
-EXTERN(void) jpeg_set_linear_quality JPP((j_compress_ptr cinfo,
- int scale_factor,
- boolean force_baseline));
-EXTERN(void) jpeg_add_quant_table JPP((j_compress_ptr cinfo, int which_tbl,
- const unsigned int *basic_table,
- int scale_factor,
- boolean force_baseline));
-EXTERN(int) jpeg_quality_scaling JPP((int quality));
-EXTERN(void) jpeg_simple_progression JPP((j_compress_ptr cinfo));
-EXTERN(void) jpeg_suppress_tables JPP((j_compress_ptr cinfo,
- boolean suppress));
-EXTERN(JQUANT_TBL *) jpeg_alloc_quant_table JPP((j_common_ptr cinfo));
-EXTERN(JHUFF_TBL *) jpeg_alloc_huff_table JPP((j_common_ptr cinfo));
-
-/* Main entry points for compression */
-EXTERN(void) jpeg_start_compress JPP((j_compress_ptr cinfo,
- boolean write_all_tables));
-EXTERN(JDIMENSION) jpeg_write_scanlines JPP((j_compress_ptr cinfo,
- JSAMPARRAY scanlines,
- JDIMENSION num_lines));
-EXTERN(void) jpeg_finish_compress JPP((j_compress_ptr cinfo));
-
-/* Replaces jpeg_write_scanlines when writing raw downsampled data. */
-EXTERN(JDIMENSION) jpeg_write_raw_data JPP((j_compress_ptr cinfo,
- JSAMPIMAGE data,
- JDIMENSION num_lines));
-
-/* Write a special marker. See libjpeg.doc concerning safe usage. */
-EXTERN(void) jpeg_write_marker
- JPP((j_compress_ptr cinfo, int marker,
- const JOCTET * dataptr, unsigned int datalen));
-/* Same, but piecemeal. */
-EXTERN(void) jpeg_write_m_header
- JPP((j_compress_ptr cinfo, int marker, unsigned int datalen));
-EXTERN(void) jpeg_write_m_byte
- JPP((j_compress_ptr cinfo, int val));
-
-/* Alternate compression function: just write an abbreviated table file */
-EXTERN(void) jpeg_write_tables JPP((j_compress_ptr cinfo));
-
-/* Decompression startup: read start of JPEG datastream to see what's there */
-EXTERN(int) jpeg_read_header JPP((j_decompress_ptr cinfo,
- boolean require_image));
-/* Return value is one of: */
-#define JPEG_SUSPENDED 0 /* Suspended due to lack of input data */
-#define JPEG_HEADER_OK 1 /* Found valid image datastream */
-#define JPEG_HEADER_TABLES_ONLY 2 /* Found valid table-specs-only datastream */
-/* If you pass require_image = TRUE (normal case), you need not check for
- * a TABLES_ONLY return code; an abbreviated file will cause an error exit.
- * JPEG_SUSPENDED is only possible if you use a data source module that can
- * give a suspension return (the stdio source module doesn't).
- */
-
-/* Main entry points for decompression */
-EXTERN(boolean) jpeg_start_decompress JPP((j_decompress_ptr cinfo));
-EXTERN(JDIMENSION) jpeg_read_scanlines JPP((j_decompress_ptr cinfo,
- JSAMPARRAY scanlines,
- JDIMENSION max_lines));
-EXTERN(boolean) jpeg_finish_decompress JPP((j_decompress_ptr cinfo));
-
-/* Replaces jpeg_read_scanlines when reading raw downsampled data. */
-EXTERN(JDIMENSION) jpeg_read_raw_data JPP((j_decompress_ptr cinfo,
- JSAMPIMAGE data,
- JDIMENSION max_lines));
-
-/* Additional entry points for buffered-image mode. */
-EXTERN(boolean) jpeg_has_multiple_scans JPP((j_decompress_ptr cinfo));
-EXTERN(boolean) jpeg_start_output JPP((j_decompress_ptr cinfo,
- int scan_number));
-EXTERN(boolean) jpeg_finish_output JPP((j_decompress_ptr cinfo));
-EXTERN(boolean) jpeg_input_complete JPP((j_decompress_ptr cinfo));
-EXTERN(void) jpeg_new_colormap JPP((j_decompress_ptr cinfo));
-EXTERN(int) jpeg_consume_input JPP((j_decompress_ptr cinfo));
-/* Return value is one of: */
-/* #define JPEG_SUSPENDED 0 Suspended due to lack of input data */
-#define JPEG_REACHED_SOS 1 /* Reached start of new scan */
-#define JPEG_REACHED_EOI 2 /* Reached end of image */
-#define JPEG_ROW_COMPLETED 3 /* Completed one iMCU row */
-#define JPEG_SCAN_COMPLETED 4 /* Completed last iMCU row of a scan */
-
-/* Precalculate output dimensions for current decompression parameters. */
-EXTERN(void) jpeg_calc_output_dimensions JPP((j_decompress_ptr cinfo));
-
-/* Control saving of COM and APPn markers into marker_list. */
-EXTERN(void) jpeg_save_markers
- JPP((j_decompress_ptr cinfo, int marker_code,
- unsigned int length_limit));
-
-/* Install a special processing method for COM or APPn markers. */
-EXTERN(void) jpeg_set_marker_processor
- JPP((j_decompress_ptr cinfo, int marker_code,
- jpeg_marker_parser_method routine));
-
-/* Read or write raw DCT coefficients --- useful for lossless transcoding. */
-EXTERN(jvirt_barray_ptr *) jpeg_read_coefficients JPP((j_decompress_ptr cinfo));
-EXTERN(void) jpeg_write_coefficients JPP((j_compress_ptr cinfo,
- jvirt_barray_ptr * coef_arrays));
-EXTERN(void) jpeg_copy_critical_parameters JPP((j_decompress_ptr srcinfo,
- j_compress_ptr dstinfo));
-
-/* If you choose to abort compression or decompression before completing
- * jpeg_finish_(de)compress, then you need to clean up to release memory,
- * temporary files, etc. You can just call jpeg_destroy_(de)compress
- * if you're done with the JPEG object, but if you want to clean it up and
- * reuse it, call this:
- */
-EXTERN(void) jpeg_abort_compress JPP((j_compress_ptr cinfo));
-EXTERN(void) jpeg_abort_decompress JPP((j_decompress_ptr cinfo));
-
-/* Generic versions of jpeg_abort and jpeg_destroy that work on either
- * flavor of JPEG object. These may be more convenient in some places.
- */
-EXTERN(void) jpeg_abort JPP((j_common_ptr cinfo));
-EXTERN(void) jpeg_destroy JPP((j_common_ptr cinfo));
-
-/* Default restart-marker-resync procedure for use by data source modules */
-EXTERN(boolean) jpeg_resync_to_restart JPP((j_decompress_ptr cinfo,
- int desired));
-
-
-/* These marker codes are exported since applications and data source modules
- * are likely to want to use them.
- */
-
-#define JPEG_RST0 0xD0 /* RST0 marker code */
-#define JPEG_EOI 0xD9 /* EOI marker code */
-#define JPEG_APP0 0xE0 /* APP0 marker code */
-#define JPEG_COM 0xFE /* COM marker code */
-
-
-/* If we have a brain-damaged compiler that emits warnings (or worse, errors)
- * for structure definitions that are never filled in, keep it quiet by
- * supplying dummy definitions for the various substructures.
- */
-
-#ifdef INCOMPLETE_TYPES_BROKEN
-#ifndef JPEG_INTERNALS /* will be defined in jpegint.h */
-struct jvirt_sarray_control { long dummy; };
-struct jvirt_barray_control { long dummy; };
-struct jpeg_comp_master { long dummy; };
-struct jpeg_c_main_controller { long dummy; };
-struct jpeg_c_prep_controller { long dummy; };
-struct jpeg_c_coef_controller { long dummy; };
-struct jpeg_marker_writer { long dummy; };
-struct jpeg_color_converter { long dummy; };
-struct jpeg_downsampler { long dummy; };
-struct jpeg_forward_dct { long dummy; };
-struct jpeg_entropy_encoder { long dummy; };
-struct jpeg_decomp_master { long dummy; };
-struct jpeg_d_main_controller { long dummy; };
-struct jpeg_d_coef_controller { long dummy; };
-struct jpeg_d_post_controller { long dummy; };
-struct jpeg_input_controller { long dummy; };
-struct jpeg_marker_reader { long dummy; };
-struct jpeg_entropy_decoder { long dummy; };
-struct jpeg_inverse_dct { long dummy; };
-struct jpeg_upsampler { long dummy; };
-struct jpeg_color_deconverter { long dummy; };
-struct jpeg_color_quantizer { long dummy; };
-#endif /* JPEG_INTERNALS */
-#endif /* INCOMPLETE_TYPES_BROKEN */
-
-
-/*
- * The JPEG library modules define JPEG_INTERNALS before including this file.
- * The internal structure declarations are read only when that is true.
- * Applications using the library should not include jpegint.h, but may wish
- * to include jerror.h.
- */
-
-#ifdef JPEG_INTERNALS
-#include "jpegint.h" /* fetch private declarations */
-#include "jerror.h" /* fetch error codes too */
-#endif
-
-#endif /* JPEGLIB_H */
diff --git a/chromium/third_party/pdfium/third_party/libjpeg/jversion.h b/chromium/third_party/pdfium/third_party/libjpeg/jversion.h
deleted file mode 100644
index 6472c58d351..00000000000
--- a/chromium/third_party/pdfium/third_party/libjpeg/jversion.h
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- * jversion.h
- *
- * Copyright (C) 1991-1998, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file contains software version identification.
- */
-
-
-#define JVERSION "6b 27-Mar-1998"
-
-#define JCOPYRIGHT "Copyright (C) 1998, Thomas G. Lane"
diff --git a/chromium/third_party/pdfium/third_party/libjpeg/transupp.h b/chromium/third_party/pdfium/third_party/libjpeg/transupp.h
deleted file mode 100644
index 5c2d32aff50..00000000000
--- a/chromium/third_party/pdfium/third_party/libjpeg/transupp.h
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * transupp.h
- *
- * Copyright (C) 1997, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file contains declarations for image transformation routines and
- * other utility code used by the jpegtran sample application. These are
- * NOT part of the core JPEG library. But we keep these routines separate
- * from jpegtran.c to ease the task of maintaining jpegtran-like programs
- * that have other user interfaces.
- *
- * NOTE: all the routines declared here have very specific requirements
- * about when they are to be executed during the reading and writing of the
- * source and destination files. See the comments in transupp.c, or see
- * jpegtran.c for an example of correct usage.
- */
-
-/* If you happen not to want the image transform support, disable it here */
-#ifndef TRANSFORMS_SUPPORTED
-#define TRANSFORMS_SUPPORTED 1 /* 0 disables transform code */
-#endif
-
-/* Short forms of external names for systems with brain-damaged linkers. */
-
-#ifdef NEED_SHORT_EXTERNAL_NAMES
-#define jtransform_request_workspace jTrRequest
-#define jtransform_adjust_parameters jTrAdjust
-#define jtransform_execute_transformation jTrExec
-#define jcopy_markers_setup jCMrkSetup
-#define jcopy_markers_execute jCMrkExec
-#endif /* NEED_SHORT_EXTERNAL_NAMES */
-
-
-/*
- * Codes for supported types of image transformations.
- */
-
-typedef enum {
- JXFORM_NONE, /* no transformation */
- JXFORM_FLIP_H, /* horizontal flip */
- JXFORM_FLIP_V, /* vertical flip */
- JXFORM_TRANSPOSE, /* transpose across UL-to-LR axis */
- JXFORM_TRANSVERSE, /* transpose across UR-to-LL axis */
- JXFORM_ROT_90, /* 90-degree clockwise rotation */
- JXFORM_ROT_180, /* 180-degree rotation */
- JXFORM_ROT_270 /* 270-degree clockwise (or 90 ccw) */
-} JXFORM_CODE;
-
-/*
- * Although rotating and flipping data expressed as DCT coefficients is not
- * hard, there is an asymmetry in the JPEG format specification for images
- * whose dimensions aren't multiples of the iMCU size. The right and bottom
- * image edges are padded out to the next iMCU boundary with junk data; but
- * no padding is possible at the top and left edges. If we were to flip
- * the whole image including the pad data, then pad garbage would become
- * visible at the top and/or left, and real pixels would disappear into the
- * pad margins --- perhaps permanently, since encoders & decoders may not
- * bother to preserve DCT blocks that appear to be completely outside the
- * nominal image area. So, we have to exclude any partial iMCUs from the
- * basic transformation.
- *
- * Transpose is the only transformation that can handle partial iMCUs at the
- * right and bottom edges completely cleanly. flip_h can flip partial iMCUs
- * at the bottom, but leaves any partial iMCUs at the right edge untouched.
- * Similarly flip_v leaves any partial iMCUs at the bottom edge untouched.
- * The other transforms are defined as combinations of these basic transforms
- * and process edge blocks in a way that preserves the equivalence.
- *
- * The "trim" option causes untransformable partial iMCUs to be dropped;
- * this is not strictly lossless, but it usually gives the best-looking
- * result for odd-size images. Note that when this option is active,
- * the expected mathematical equivalences between the transforms may not hold.
- * (For example, -rot 270 -trim trims only the bottom edge, but -rot 90 -trim
- * followed by -rot 180 -trim trims both edges.)
- *
- * We also offer a "force to grayscale" option, which simply discards the
- * chrominance channels of a YCbCr image. This is lossless in the sense that
- * the luminance channel is preserved exactly. It's not the same kind of
- * thing as the rotate/flip transformations, but it's convenient to handle it
- * as part of this package, mainly because the transformation routines have to
- * be aware of the option to know how many components to work on.
- */
-
-typedef struct {
- /* Options: set by caller */
- JXFORM_CODE transform; /* image transform operator */
- boolean trim; /* if TRUE, trim partial MCUs as needed */
- boolean force_grayscale; /* if TRUE, convert color image to grayscale */
-
- /* Internal workspace: caller should not touch these */
- int num_components; /* # of components in workspace */
- jvirt_barray_ptr * workspace_coef_arrays; /* workspace for transformations */
-} jpeg_transform_info;
-
-
-#if TRANSFORMS_SUPPORTED
-
-/* Request any required workspace */
-EXTERN(void) jtransform_request_workspace
- JPP((j_decompress_ptr srcinfo, jpeg_transform_info *info));
-/* Adjust output image parameters */
-EXTERN(jvirt_barray_ptr *) jtransform_adjust_parameters
- JPP((j_decompress_ptr srcinfo, j_compress_ptr dstinfo,
- jvirt_barray_ptr *src_coef_arrays,
- jpeg_transform_info *info));
-/* Execute the actual transformation, if any */
-EXTERN(void) jtransform_execute_transformation
- JPP((j_decompress_ptr srcinfo, j_compress_ptr dstinfo,
- jvirt_barray_ptr *src_coef_arrays,
- jpeg_transform_info *info));
-
-#endif /* TRANSFORMS_SUPPORTED */
-
-
-/*
- * Support for copying optional markers from source to destination file.
- */
-
-typedef enum {
- JCOPYOPT_NONE, /* copy no optional markers */
- JCOPYOPT_COMMENTS, /* copy only comment (COM) markers */
- JCOPYOPT_ALL /* copy all optional markers */
-} JCOPY_OPTION;
-
-#define JCOPYOPT_DEFAULT JCOPYOPT_COMMENTS /* recommended default */
-
-/* Setup decompression object to save desired markers in memory */
-EXTERN(void) jcopy_markers_setup
- JPP((j_decompress_ptr srcinfo, JCOPY_OPTION option));
-/* Copy markers saved in the given source object to the destination object */
-EXTERN(void) jcopy_markers_execute
- JPP((j_decompress_ptr srcinfo, j_compress_ptr dstinfo,
- JCOPY_OPTION option));
diff --git a/chromium/third_party/pdfium/third_party/libopenjpeg20/0029-avoid-division-by-0.patch b/chromium/third_party/pdfium/third_party/libopenjpeg20/0029-avoid-division-by-0.patch
new file mode 100644
index 00000000000..4ea2b7ce3c1
--- /dev/null
+++ b/chromium/third_party/pdfium/third_party/libopenjpeg20/0029-avoid-division-by-0.patch
@@ -0,0 +1,119 @@
+diff --git a/third_party/libopenjpeg20/pi.c b/third_party/libopenjpeg20/pi.c
+index 9097e31a0..083674222 100644
+--- a/third_party/libopenjpeg20/pi.c
++++ b/third_party/libopenjpeg20/pi.c
+@@ -355,12 +355,20 @@ if (!pi->tp_on){
+ }
+ res = &comp->resolutions[pi->resno];
+ levelno = comp->numresolutions - 1 - pi->resno;
+- trx0 = opj_int_ceildiv(pi->tx0, (OPJ_INT32)(comp->dx << levelno));
+- try0 = opj_int_ceildiv(pi->ty0, (OPJ_INT32)(comp->dy << levelno));
+- trx1 = opj_int_ceildiv(pi->tx1, (OPJ_INT32)(comp->dx << levelno));
+- try1 = opj_int_ceildiv(pi->ty1, (OPJ_INT32)(comp->dy << levelno));
++ OPJ_INT32 x_divisor = comp->dx << levelno;
++ OPJ_INT32 y_divisor = comp->dy << levelno;
++ if (x_divisor == 0 || y_divisor == 0) {
++ continue;
++ }
++ trx0 = opj_int_ceildiv(pi->tx0, x_divisor);
++ try0 = opj_int_ceildiv(pi->ty0, y_divisor);
++ trx1 = opj_int_ceildiv(pi->tx1, x_divisor);
++ try1 = opj_int_ceildiv(pi->ty1, y_divisor);
+ rpx = res->pdx + levelno;
+ rpy = res->pdy + levelno;
++ if (comp->dy << rpy == 0 || 1 << rpy == 0 || comp->dx << rpx == 0 || 1 << rpx == 0) {
++ continue;
++ }
+ if (!((pi->y % (OPJ_INT32)(comp->dy << rpy) == 0) || ((pi->y == pi->ty0) && ((try0 << levelno) % (1 << rpy))))){
+ continue;
+ }
+@@ -372,9 +380,9 @@ if (!pi->tp_on){
+
+ if ((trx0==trx1)||(try0==try1)) continue;
+
+- prci = opj_int_floordivpow2(opj_int_ceildiv(pi->x, (OPJ_INT32)(comp->dx << levelno)), (OPJ_INT32)res->pdx)
++ prci = opj_int_floordivpow2(opj_int_ceildiv(pi->x, x_divisor), (OPJ_INT32)res->pdx)
+ - opj_int_floordivpow2(trx0, (OPJ_INT32)res->pdx);
+- prcj = opj_int_floordivpow2(opj_int_ceildiv(pi->y, (OPJ_INT32)(comp->dy << levelno)), (OPJ_INT32)res->pdy)
++ prcj = opj_int_floordivpow2(opj_int_ceildiv(pi->y, y_divisor), (OPJ_INT32)res->pdy)
+ - opj_int_floordivpow2(try0, (OPJ_INT32)res->pdy);
+ pi->precno = (OPJ_UINT32)(prci + prcj * (OPJ_INT32)res->pw);
+ if (pi->precno >= res->pw * res->ph) {
+@@ -439,12 +447,20 @@ static OPJ_BOOL opj_pi_next_pcrl(opj_pi_iterator_t * pi) {
+ OPJ_INT32 prci, prcj;
+ res = &comp->resolutions[pi->resno];
+ levelno = comp->numresolutions - 1 - pi->resno;
+- trx0 = opj_int_ceildiv(pi->tx0, (OPJ_INT32)(comp->dx << levelno));
+- try0 = opj_int_ceildiv(pi->ty0, (OPJ_INT32)(comp->dy << levelno));
+- trx1 = opj_int_ceildiv(pi->tx1, (OPJ_INT32)(comp->dx << levelno));
+- try1 = opj_int_ceildiv(pi->ty1, (OPJ_INT32)(comp->dy << levelno));
++ OPJ_INT32 x_divisor = comp->dx << levelno;
++ OPJ_INT32 y_divisor = comp->dy << levelno;
++ if (x_divisor == 0 || y_divisor == 0) {
++ continue;
++ }
++ trx0 = opj_int_ceildiv(pi->tx0, x_divisor);
++ try0 = opj_int_ceildiv(pi->ty0, y_divisor);
++ trx1 = opj_int_ceildiv(pi->tx1, x_divisor);
++ try1 = opj_int_ceildiv(pi->ty1, y_divisor);
+ rpx = res->pdx + levelno;
+ rpy = res->pdy + levelno;
++ if (comp->dy << rpy == 0 || 1 << rpy == 0 || comp->dx << rpx == 0 || 1 << rpx == 0) {
++ continue;
++ }
+ if (!((pi->y % (OPJ_INT32)(comp->dy << rpy) == 0) || ((pi->y == pi->ty0) && ((try0 << levelno) % (1 << rpy))))){
+ continue;
+ }
+@@ -456,9 +472,9 @@ static OPJ_BOOL opj_pi_next_pcrl(opj_pi_iterator_t * pi) {
+
+ if ((trx0==trx1)||(try0==try1)) continue;
+
+- prci = opj_int_floordivpow2(opj_int_ceildiv(pi->x, (OPJ_INT32)(comp->dx << levelno)), (OPJ_INT32)res->pdx)
++ prci = opj_int_floordivpow2(opj_int_ceildiv(pi->x, x_divisor), (OPJ_INT32)res->pdx)
+ - opj_int_floordivpow2(trx0, (OPJ_INT32)res->pdx);
+- prcj = opj_int_floordivpow2(opj_int_ceildiv(pi->y, (OPJ_INT32)(comp->dy << levelno)), (OPJ_INT32)res->pdy)
++ prcj = opj_int_floordivpow2(opj_int_ceildiv(pi->y, y_divisor), (OPJ_INT32)res->pdy)
+ - opj_int_floordivpow2(try0, (OPJ_INT32)res->pdy);
+ pi->precno = (OPJ_UINT32)(prci + prcj * (OPJ_INT32)res->pw);
+ if (pi->precno >= res->pw * res->ph) {
+@@ -521,26 +537,33 @@ static OPJ_BOOL opj_pi_next_cprl(opj_pi_iterator_t * pi) {
+ OPJ_INT32 prci, prcj;
+ res = &comp->resolutions[pi->resno];
+ levelno = comp->numresolutions - 1 - pi->resno;
+- trx0 = opj_int_ceildiv(pi->tx0, (OPJ_INT32)(comp->dx << levelno));
+- try0 = opj_int_ceildiv(pi->ty0, (OPJ_INT32)(comp->dy << levelno));
+- trx1 = opj_int_ceildiv(pi->tx1, (OPJ_INT32)(comp->dx << levelno));
+- try1 = opj_int_ceildiv(pi->ty1, (OPJ_INT32)(comp->dy << levelno));
++ OPJ_INT32 x_divisor = comp->dx << levelno;
++ OPJ_INT32 y_divisor = comp->dy << levelno;
++ if (x_divisor == 0 || y_divisor == 0) {
++ continue;
++ }
++ trx0 = opj_int_ceildiv(pi->tx0, x_divisor);
++ try0 = opj_int_ceildiv(pi->ty0, y_divisor);
++ trx1 = opj_int_ceildiv(pi->tx1, x_divisor);
++ try1 = opj_int_ceildiv(pi->ty1, y_divisor);
+ rpx = res->pdx + levelno;
+ rpy = res->pdy + levelno;
++ if (comp->dy << rpy == 0 || 1 << rpy == 0 || comp->dx << rpx == 0 || 1 << rpx == 0) {
++ continue;
++ }
+ if (!((pi->y % (OPJ_INT32)(comp->dy << rpy) == 0) || ((pi->y == pi->ty0) && ((try0 << levelno) % (1 << rpy))))){
+ continue;
+ }
+ if (!((pi->x % (OPJ_INT32)(comp->dx << rpx) == 0) || ((pi->x == pi->tx0) && ((trx0 << levelno) % (1 << rpx))))){
+ continue;
+ }
+-
+ if ((res->pw==0)||(res->ph==0)) continue;
+
+ if ((trx0==trx1)||(try0==try1)) continue;
+
+- prci = opj_int_floordivpow2(opj_int_ceildiv(pi->x, (OPJ_INT32)(comp->dx << levelno)), (OPJ_INT32)res->pdx)
++ prci = opj_int_floordivpow2(opj_int_ceildiv(pi->x, x_divisor), (OPJ_INT32)res->pdx)
+ - opj_int_floordivpow2(trx0, (OPJ_INT32)res->pdx);
+- prcj = opj_int_floordivpow2(opj_int_ceildiv(pi->y, (OPJ_INT32)(comp->dy << levelno)), (OPJ_INT32)res->pdy)
++ prcj = opj_int_floordivpow2(opj_int_ceildiv(pi->y, y_divisor), (OPJ_INT32)res->pdy)
+ - opj_int_floordivpow2(try0, (OPJ_INT32)res->pdy);
+ pi->precno = (OPJ_UINT32)(prci + prcj * (OPJ_INT32)res->pw);
+ if (pi->precno >= res->pw * res->ph) {
diff --git a/chromium/third_party/pdfium/third_party/libopenjpeg20/README.pdfium b/chromium/third_party/pdfium/third_party/libopenjpeg20/README.pdfium
index 6c2a3c74ba0..9ce0c05706a 100644
--- a/chromium/third_party/pdfium/third_party/libopenjpeg20/README.pdfium
+++ b/chromium/third_party/pdfium/third_party/libopenjpeg20/README.pdfium
@@ -38,4 +38,5 @@ Local Modifications:
0026-use_opj_uint_ceildiv.patch: Remove (OPJ_UINT32)opj_int_ceildiv((OPJ_INT32)a, (OPJ_INT32) b).
0027-undefined-shift-opj_t1_decode_cblk.patch: upstream fix for a ubsan bug.
0028-upstream-check-size-in-opj_j2k_read_siz.patch: upstream patch in j2k.c.
+0029-avoid-division-by-0: fix some /0 and %0 in pi.c (caused by bad shifts).
TODO(thestig): List all the other patches.
diff --git a/chromium/third_party/pdfium/third_party/libopenjpeg20/pi.c b/chromium/third_party/pdfium/third_party/libopenjpeg20/pi.c
index 9097e31a0ee..08367422224 100644
--- a/chromium/third_party/pdfium/third_party/libopenjpeg20/pi.c
+++ b/chromium/third_party/pdfium/third_party/libopenjpeg20/pi.c
@@ -355,12 +355,20 @@ if (!pi->tp_on){
}
res = &comp->resolutions[pi->resno];
levelno = comp->numresolutions - 1 - pi->resno;
- trx0 = opj_int_ceildiv(pi->tx0, (OPJ_INT32)(comp->dx << levelno));
- try0 = opj_int_ceildiv(pi->ty0, (OPJ_INT32)(comp->dy << levelno));
- trx1 = opj_int_ceildiv(pi->tx1, (OPJ_INT32)(comp->dx << levelno));
- try1 = opj_int_ceildiv(pi->ty1, (OPJ_INT32)(comp->dy << levelno));
+ OPJ_INT32 x_divisor = comp->dx << levelno;
+ OPJ_INT32 y_divisor = comp->dy << levelno;
+ if (x_divisor == 0 || y_divisor == 0) {
+ continue;
+ }
+ trx0 = opj_int_ceildiv(pi->tx0, x_divisor);
+ try0 = opj_int_ceildiv(pi->ty0, y_divisor);
+ trx1 = opj_int_ceildiv(pi->tx1, x_divisor);
+ try1 = opj_int_ceildiv(pi->ty1, y_divisor);
rpx = res->pdx + levelno;
rpy = res->pdy + levelno;
+ if (comp->dy << rpy == 0 || 1 << rpy == 0 || comp->dx << rpx == 0 || 1 << rpx == 0) {
+ continue;
+ }
if (!((pi->y % (OPJ_INT32)(comp->dy << rpy) == 0) || ((pi->y == pi->ty0) && ((try0 << levelno) % (1 << rpy))))){
continue;
}
@@ -372,9 +380,9 @@ if (!pi->tp_on){
if ((trx0==trx1)||(try0==try1)) continue;
- prci = opj_int_floordivpow2(opj_int_ceildiv(pi->x, (OPJ_INT32)(comp->dx << levelno)), (OPJ_INT32)res->pdx)
+ prci = opj_int_floordivpow2(opj_int_ceildiv(pi->x, x_divisor), (OPJ_INT32)res->pdx)
- opj_int_floordivpow2(trx0, (OPJ_INT32)res->pdx);
- prcj = opj_int_floordivpow2(opj_int_ceildiv(pi->y, (OPJ_INT32)(comp->dy << levelno)), (OPJ_INT32)res->pdy)
+ prcj = opj_int_floordivpow2(opj_int_ceildiv(pi->y, y_divisor), (OPJ_INT32)res->pdy)
- opj_int_floordivpow2(try0, (OPJ_INT32)res->pdy);
pi->precno = (OPJ_UINT32)(prci + prcj * (OPJ_INT32)res->pw);
if (pi->precno >= res->pw * res->ph) {
@@ -439,12 +447,20 @@ static OPJ_BOOL opj_pi_next_pcrl(opj_pi_iterator_t * pi) {
OPJ_INT32 prci, prcj;
res = &comp->resolutions[pi->resno];
levelno = comp->numresolutions - 1 - pi->resno;
- trx0 = opj_int_ceildiv(pi->tx0, (OPJ_INT32)(comp->dx << levelno));
- try0 = opj_int_ceildiv(pi->ty0, (OPJ_INT32)(comp->dy << levelno));
- trx1 = opj_int_ceildiv(pi->tx1, (OPJ_INT32)(comp->dx << levelno));
- try1 = opj_int_ceildiv(pi->ty1, (OPJ_INT32)(comp->dy << levelno));
+ OPJ_INT32 x_divisor = comp->dx << levelno;
+ OPJ_INT32 y_divisor = comp->dy << levelno;
+ if (x_divisor == 0 || y_divisor == 0) {
+ continue;
+ }
+ trx0 = opj_int_ceildiv(pi->tx0, x_divisor);
+ try0 = opj_int_ceildiv(pi->ty0, y_divisor);
+ trx1 = opj_int_ceildiv(pi->tx1, x_divisor);
+ try1 = opj_int_ceildiv(pi->ty1, y_divisor);
rpx = res->pdx + levelno;
rpy = res->pdy + levelno;
+ if (comp->dy << rpy == 0 || 1 << rpy == 0 || comp->dx << rpx == 0 || 1 << rpx == 0) {
+ continue;
+ }
if (!((pi->y % (OPJ_INT32)(comp->dy << rpy) == 0) || ((pi->y == pi->ty0) && ((try0 << levelno) % (1 << rpy))))){
continue;
}
@@ -456,9 +472,9 @@ static OPJ_BOOL opj_pi_next_pcrl(opj_pi_iterator_t * pi) {
if ((trx0==trx1)||(try0==try1)) continue;
- prci = opj_int_floordivpow2(opj_int_ceildiv(pi->x, (OPJ_INT32)(comp->dx << levelno)), (OPJ_INT32)res->pdx)
+ prci = opj_int_floordivpow2(opj_int_ceildiv(pi->x, x_divisor), (OPJ_INT32)res->pdx)
- opj_int_floordivpow2(trx0, (OPJ_INT32)res->pdx);
- prcj = opj_int_floordivpow2(opj_int_ceildiv(pi->y, (OPJ_INT32)(comp->dy << levelno)), (OPJ_INT32)res->pdy)
+ prcj = opj_int_floordivpow2(opj_int_ceildiv(pi->y, y_divisor), (OPJ_INT32)res->pdy)
- opj_int_floordivpow2(try0, (OPJ_INT32)res->pdy);
pi->precno = (OPJ_UINT32)(prci + prcj * (OPJ_INT32)res->pw);
if (pi->precno >= res->pw * res->ph) {
@@ -521,26 +537,33 @@ static OPJ_BOOL opj_pi_next_cprl(opj_pi_iterator_t * pi) {
OPJ_INT32 prci, prcj;
res = &comp->resolutions[pi->resno];
levelno = comp->numresolutions - 1 - pi->resno;
- trx0 = opj_int_ceildiv(pi->tx0, (OPJ_INT32)(comp->dx << levelno));
- try0 = opj_int_ceildiv(pi->ty0, (OPJ_INT32)(comp->dy << levelno));
- trx1 = opj_int_ceildiv(pi->tx1, (OPJ_INT32)(comp->dx << levelno));
- try1 = opj_int_ceildiv(pi->ty1, (OPJ_INT32)(comp->dy << levelno));
+ OPJ_INT32 x_divisor = comp->dx << levelno;
+ OPJ_INT32 y_divisor = comp->dy << levelno;
+ if (x_divisor == 0 || y_divisor == 0) {
+ continue;
+ }
+ trx0 = opj_int_ceildiv(pi->tx0, x_divisor);
+ try0 = opj_int_ceildiv(pi->ty0, y_divisor);
+ trx1 = opj_int_ceildiv(pi->tx1, x_divisor);
+ try1 = opj_int_ceildiv(pi->ty1, y_divisor);
rpx = res->pdx + levelno;
rpy = res->pdy + levelno;
+ if (comp->dy << rpy == 0 || 1 << rpy == 0 || comp->dx << rpx == 0 || 1 << rpx == 0) {
+ continue;
+ }
if (!((pi->y % (OPJ_INT32)(comp->dy << rpy) == 0) || ((pi->y == pi->ty0) && ((try0 << levelno) % (1 << rpy))))){
continue;
}
if (!((pi->x % (OPJ_INT32)(comp->dx << rpx) == 0) || ((pi->x == pi->tx0) && ((trx0 << levelno) % (1 << rpx))))){
continue;
}
-
if ((res->pw==0)||(res->ph==0)) continue;
if ((trx0==trx1)||(try0==try1)) continue;
- prci = opj_int_floordivpow2(opj_int_ceildiv(pi->x, (OPJ_INT32)(comp->dx << levelno)), (OPJ_INT32)res->pdx)
+ prci = opj_int_floordivpow2(opj_int_ceildiv(pi->x, x_divisor), (OPJ_INT32)res->pdx)
- opj_int_floordivpow2(trx0, (OPJ_INT32)res->pdx);
- prcj = opj_int_floordivpow2(opj_int_ceildiv(pi->y, (OPJ_INT32)(comp->dy << levelno)), (OPJ_INT32)res->pdy)
+ prcj = opj_int_floordivpow2(opj_int_ceildiv(pi->y, y_divisor), (OPJ_INT32)res->pdy)
- opj_int_floordivpow2(try0, (OPJ_INT32)res->pdy);
pi->precno = (OPJ_UINT32)(prci + prcj * (OPJ_INT32)res->pw);
if (pi->precno >= res->pw * res->ph) {
diff --git a/chromium/third_party/pdfium/third_party/libpng16/0000-build-config.patch b/chromium/third_party/pdfium/third_party/libpng16/0000-build-config.patch
index 7b7b158f325..5c30866405b 100644
--- a/chromium/third_party/pdfium/third_party/libpng16/0000-build-config.patch
+++ b/chromium/third_party/pdfium/third_party/libpng16/0000-build-config.patch
@@ -29,15 +29,3 @@ diff a/third_party/libpng16/pngmem.c b/third_party/libpng16/pngmem.c
}
#ifdef PNG_USER_MEM_SUPPORTED
-diff a/third_party/libpng16/pngstruct.h b/third_party/libpng16/pngstruct.h
---- a/third_party/libpng16/pngstruct.h
-+++ b/third_party/libpng16/pngstruct.h
-@@ -27,7 +27,7 @@
- /* We must ensure that zlib uses 'const' in declarations. */
- # define ZLIB_CONST
- #endif
--#include "zlib.h"
-+#include "third_party/zlib_v128/zlib.h"
- #ifdef const
- /* zlib.h sometimes #defines const to nothing, undo this. */
- # undef const
diff --git a/chromium/third_party/pdfium/third_party/libpng16/pngstruct.h b/chromium/third_party/pdfium/third_party/libpng16/pngstruct.h
index 0b372de4c61..c1f35edef5c 100644
--- a/chromium/third_party/pdfium/third_party/libpng16/pngstruct.h
+++ b/chromium/third_party/pdfium/third_party/libpng16/pngstruct.h
@@ -27,7 +27,7 @@
/* We must ensure that zlib uses 'const' in declarations. */
# define ZLIB_CONST
#endif
-#include "third_party/zlib_v128/zlib.h"
+#include "zlib.h"
#ifdef const
/* zlib.h sometimes #defines const to nothing, undo this. */
# undef const
diff --git a/chromium/third_party/pdfium/third_party/libtiff/0000-build-config.patch b/chromium/third_party/pdfium/third_party/libtiff/0000-build-config.patch
index 64e86e60ad4..a422b37db85 100644
--- a/chromium/third_party/pdfium/third_party/libtiff/0000-build-config.patch
+++ b/chromium/third_party/pdfium/third_party/libtiff/0000-build-config.patch
@@ -65,30 +65,6 @@ diff a/third_party/libtiff/tif_ojpeg.c b/third_party/libtiff/tif_ojpeg.c
typedef struct jpeg_error_mgr jpeg_error_mgr;
typedef struct jpeg_common_struct jpeg_common_struct;
-diff a/third_party/libtiff/tif_pixarlog.c b/third_party/libtiff/tif_pixarlog.c
---- a/third_party/libtiff/tif_pixarlog.c
-+++ b/third_party/libtiff/tif_pixarlog.c
-@@ -90,7 +90,7 @@
- */
-
- #include "tif_predict.h"
--#include "zlib.h"
-+#include "../zlib_v128/zlib.h"
-
- #include <stdio.h>
- #include <stdlib.h>
-diff a/third_party/libtiff/tif_zip.c b/third_party/libtiff/tif_zip.c
---- a/third_party/libtiff/tif_zip.c
-+++ b/third_party/libtiff/tif_zip.c
-@@ -47,7 +47,7 @@
- * last found at ftp://ftp.uu.net/pub/archiving/zip/zlib/zlib-0.99.tar.gz.
- */
- #include "tif_predict.h"
--#include "zlib.h"
-+#include "../zlib_v128/zlib.h"
-
- #include <stdio.h>
-
diff a/third_party/libtiff/tiffconf.h b/third_party/libtiff/tiffconf.h
--- /dev/null
+++ b/third_party/libtiff/tiffconf.h
@@ -102,7 +78,7 @@ diff a/third_party/libtiff/tiffconf.h b/third_party/libtiff/tiffconf.h
+#ifndef _TIFFCONF_
+#define _TIFFCONF_
+
-+#include "core/include/fxcrt/fx_system.h"
++#include "core/fxcrt/fx_system.h"
+
+//NOTE: The tiff codec requires an ANSI C compiler environment for building and
+// presumes an ANSI C environment for use.
diff --git a/chromium/third_party/pdfium/third_party/libtiff/0002-CVE-2015-8665-8683.patch b/chromium/third_party/pdfium/third_party/libtiff/0002-CVE-2015-8665-8683.patch
deleted file mode 100644
index 0d740e229d4..00000000000
--- a/chromium/third_party/pdfium/third_party/libtiff/0002-CVE-2015-8665-8683.patch
+++ /dev/null
@@ -1,114 +0,0 @@
-From f94a29a822f5528d2334592760fbb7938f15eb55 Mon Sep 17 00:00:00 2001
-From: erouault <erouault>
-Date: Sat, 26 Dec 2015 17:32:03 +0000
-Subject: [PATCH] * libtiff/tif_getimage.c: fix out-of-bound reads in
- TIFFRGBAImage interface in case of unsupported values of
- SamplesPerPixel/ExtraSamples for LogLUV / CIELab. Add explicit call to
- TIFFRGBAImageOK() in TIFFRGBAImageBegin(). Fix CVE-2015-8665 reported by
- limingxing and CVE-2015-8683 reported by zzf of Alibaba.
-
----
- ChangeLog | 8 ++++++++
- libtiff/tif_getimage.c | 35 ++++++++++++++++++++++-------------
- 2 files changed, 30 insertions(+), 13 deletions(-)
-
-Index: tiff-4.0.3/libtiff/tif_getimage.c
-===================================================================
---- tiff-4.0.3.orig/libtiff/tif_getimage.c 2016-03-23 10:13:42.728371661 -0400
-+++ tiff-4.0.3/libtiff/tif_getimage.c 2016-03-23 10:13:42.724371614 -0400
-@@ -182,20 +182,22 @@
- "Planarconfiguration", td->td_planarconfig);
- return (0);
- }
-- if( td->td_samplesperpixel != 3 )
-+ if( td->td_samplesperpixel != 3 || colorchannels != 3 )
- {
- sprintf(emsg,
-- "Sorry, can not handle image with %s=%d",
-- "Samples/pixel", td->td_samplesperpixel);
-+ "Sorry, can not handle image with %s=%d, %s=%d",
-+ "Samples/pixel", td->td_samplesperpixel,
-+ "colorchannels", colorchannels);
- return 0;
- }
- break;
- case PHOTOMETRIC_CIELAB:
-- if( td->td_samplesperpixel != 3 || td->td_bitspersample != 8 )
-+ if( td->td_samplesperpixel != 3 || colorchannels != 3 || td->td_bitspersample != 8 )
- {
- sprintf(emsg,
-- "Sorry, can not handle image with %s=%d and %s=%d",
-+ "Sorry, can not handle image with %s=%d, %s=%d and %s=%d",
- "Samples/pixel", td->td_samplesperpixel,
-+ "colorchannels", colorchannels,
- "Bits/sample", td->td_bitspersample);
- return 0;
- }
-@@ -255,6 +257,9 @@
- int colorchannels;
- uint16 *red_orig, *green_orig, *blue_orig;
- int n_color;
-+
-+ if( !TIFFRGBAImageOK(tif, emsg) )
-+ return 0;
-
- /* Initialize to normal values */
- img->row_offset = 0;
-@@ -2470,29 +2475,33 @@
- case PHOTOMETRIC_RGB:
- switch (img->bitspersample) {
- case 8:
-- if (img->alpha == EXTRASAMPLE_ASSOCALPHA)
-+ if (img->alpha == EXTRASAMPLE_ASSOCALPHA &&
-+ img->samplesperpixel >= 4)
- img->put.contig = putRGBAAcontig8bittile;
-- else if (img->alpha == EXTRASAMPLE_UNASSALPHA)
-+ else if (img->alpha == EXTRASAMPLE_UNASSALPHA &&
-+ img->samplesperpixel >= 4)
- {
- if (BuildMapUaToAa(img))
- img->put.contig = putRGBUAcontig8bittile;
- }
-- else
-+ else if( img->samplesperpixel >= 3 )
- img->put.contig = putRGBcontig8bittile;
- break;
- case 16:
-- if (img->alpha == EXTRASAMPLE_ASSOCALPHA)
-+ if (img->alpha == EXTRASAMPLE_ASSOCALPHA &&
-+ img->samplesperpixel >=4 )
- {
- if (BuildMapBitdepth16To8(img))
- img->put.contig = putRGBAAcontig16bittile;
- }
-- else if (img->alpha == EXTRASAMPLE_UNASSALPHA)
-+ else if (img->alpha == EXTRASAMPLE_UNASSALPHA &&
-+ img->samplesperpixel >=4 )
- {
- if (BuildMapBitdepth16To8(img) &&
- BuildMapUaToAa(img))
- img->put.contig = putRGBUAcontig16bittile;
- }
-- else
-+ else if( img->samplesperpixel >=3 )
- {
- if (BuildMapBitdepth16To8(img))
- img->put.contig = putRGBcontig16bittile;
-@@ -2501,7 +2510,7 @@
- }
- break;
- case PHOTOMETRIC_SEPARATED:
-- if (buildMap(img)) {
-+ if (img->samplesperpixel >=4 && buildMap(img)) {
- if (img->bitspersample == 8) {
- if (!img->Map)
- img->put.contig = putRGBcontig8bitCMYKtile;
-@@ -2597,7 +2606,7 @@
- }
- break;
- case PHOTOMETRIC_CIELAB:
-- if (buildMap(img)) {
-+ if (img->samplesperpixel == 3 && buildMap(img)) {
- if (img->bitspersample == 8)
- img->put.contig = initCIELabConversion(img);
- break;
diff --git a/chromium/third_party/pdfium/third_party/libtiff/0003-CVE-2015-8781-8782-8783.patch b/chromium/third_party/pdfium/third_party/libtiff/0003-CVE-2015-8781-8782-8783.patch
deleted file mode 100644
index c4ed67dfc8e..00000000000
--- a/chromium/third_party/pdfium/third_party/libtiff/0003-CVE-2015-8781-8782-8783.patch
+++ /dev/null
@@ -1,172 +0,0 @@
-From aaab5c3c9d2a2c6984f23ccbc79702610439bc65 Mon Sep 17 00:00:00 2001
-From: erouault <erouault>
-Date: Sun, 27 Dec 2015 16:25:11 +0000
-Subject: [PATCH] * libtiff/tif_luv.c: fix potential out-of-bound writes in
- decode functions in non debug builds by replacing assert()s by regular if
- checks (bugzilla #2522). Fix potential out-of-bound reads in case of short
- input data.
-
----
- ChangeLog | 7 +++++++
- libtiff/tif_luv.c | 55 ++++++++++++++++++++++++++++++++++++++++++++-----------
- 2 files changed, 51 insertions(+), 11 deletions(-)
-
-Index: tiff-4.0.3/libtiff/tif_luv.c
-===================================================================
---- tiff-4.0.3.orig/libtiff/tif_luv.c 2016-03-23 10:13:56.868540963 -0400
-+++ tiff-4.0.3/libtiff/tif_luv.c 2016-03-23 10:13:56.864540914 -0400
-@@ -202,7 +202,11 @@
- if (sp->user_datafmt == SGILOGDATAFMT_16BIT)
- tp = (int16*) op;
- else {
-- assert(sp->tbuflen >= npixels);
-+ if(sp->tbuflen < npixels) {
-+ TIFFErrorExt(tif->tif_clientdata, module,
-+ "Translation buffer too short");
-+ return (0);
-+ }
- tp = (int16*) sp->tbuf;
- }
- _TIFFmemset((void*) tp, 0, npixels*sizeof (tp[0]));
-@@ -211,9 +215,11 @@
- cc = tif->tif_rawcc;
- /* get each byte string */
- for (shft = 2*8; (shft -= 8) >= 0; ) {
-- for (i = 0; i < npixels && cc > 0; )
-+ for (i = 0; i < npixels && cc > 0; ) {
- if (*bp >= 128) { /* run */
-- rc = *bp++ + (2-128); /* TODO: potential input buffer overrun when decoding corrupt or truncated data */
-+ if( cc < 2 )
-+ break;
-+ rc = *bp++ + (2-128);
- b = (int16)(*bp++ << shft);
- cc -= 2;
- while (rc-- && i < npixels)
-@@ -223,6 +229,7 @@
- while (--cc && rc-- && i < npixels)
- tp[i++] |= (int16)*bp++ << shft;
- }
-+ }
- if (i != npixels) {
- #if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__))
- TIFFErrorExt(tif->tif_clientdata, module,
-@@ -268,13 +275,17 @@
- if (sp->user_datafmt == SGILOGDATAFMT_RAW)
- tp = (uint32 *)op;
- else {
-- assert(sp->tbuflen >= npixels);
-+ if(sp->tbuflen < npixels) {
-+ TIFFErrorExt(tif->tif_clientdata, module,
-+ "Translation buffer too short");
-+ return (0);
-+ }
- tp = (uint32 *) sp->tbuf;
- }
- /* copy to array of uint32 */
- bp = (unsigned char*) tif->tif_rawcp;
- cc = tif->tif_rawcc;
-- for (i = 0; i < npixels && cc > 0; i++) {
-+ for (i = 0; i < npixels && cc >= 3; i++) {
- tp[i] = bp[0] << 16 | bp[1] << 8 | bp[2];
- bp += 3;
- cc -= 3;
-@@ -325,7 +336,11 @@
- if (sp->user_datafmt == SGILOGDATAFMT_RAW)
- tp = (uint32*) op;
- else {
-- assert(sp->tbuflen >= npixels);
-+ if(sp->tbuflen < npixels) {
-+ TIFFErrorExt(tif->tif_clientdata, module,
-+ "Translation buffer too short");
-+ return (0);
-+ }
- tp = (uint32*) sp->tbuf;
- }
- _TIFFmemset((void*) tp, 0, npixels*sizeof (tp[0]));
-@@ -334,11 +349,13 @@
- cc = tif->tif_rawcc;
- /* get each byte string */
- for (shft = 4*8; (shft -= 8) >= 0; ) {
-- for (i = 0; i < npixels && cc > 0; )
-+ for (i = 0; i < npixels && cc > 0; ) {
- if (*bp >= 128) { /* run */
-+ if( cc < 2 )
-+ break;
- rc = *bp++ + (2-128);
- b = (uint32)*bp++ << shft;
-- cc -= 2; /* TODO: potential input buffer overrun when decoding corrupt or truncated data */
-+ cc -= 2;
- while (rc-- && i < npixels)
- tp[i++] |= b;
- } else { /* non-run */
-@@ -346,6 +363,7 @@
- while (--cc && rc-- && i < npixels)
- tp[i++] |= (uint32)*bp++ << shft;
- }
-+ }
- if (i != npixels) {
- #if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__))
- TIFFErrorExt(tif->tif_clientdata, module,
-@@ -407,6 +425,7 @@
- static int
- LogL16Encode(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
- {
-+ static const char module[] = "LogL16Encode";
- LogLuvState* sp = EncoderState(tif);
- int shft;
- tmsize_t i;
-@@ -427,7 +446,11 @@
- tp = (int16*) bp;
- else {
- tp = (int16*) sp->tbuf;
-- assert(sp->tbuflen >= npixels);
-+ if(sp->tbuflen < npixels) {
-+ TIFFErrorExt(tif->tif_clientdata, module,
-+ "Translation buffer too short");
-+ return (0);
-+ }
- (*sp->tfunc)(sp, bp, npixels);
- }
- /* compress each byte string */
-@@ -500,6 +523,7 @@
- static int
- LogLuvEncode24(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
- {
-+ static const char module[] = "LogLuvEncode24";
- LogLuvState* sp = EncoderState(tif);
- tmsize_t i;
- tmsize_t npixels;
-@@ -515,7 +539,11 @@
- tp = (uint32*) bp;
- else {
- tp = (uint32*) sp->tbuf;
-- assert(sp->tbuflen >= npixels);
-+ if(sp->tbuflen < npixels) {
-+ TIFFErrorExt(tif->tif_clientdata, module,
-+ "Translation buffer too short");
-+ return (0);
-+ }
- (*sp->tfunc)(sp, bp, npixels);
- }
- /* write out encoded pixels */
-@@ -547,6 +575,7 @@
- static int
- LogLuvEncode32(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
- {
-+ static const char module[] = "LogLuvEncode32";
- LogLuvState* sp = EncoderState(tif);
- int shft;
- tmsize_t i;
-@@ -568,7 +597,11 @@
- tp = (uint32*) bp;
- else {
- tp = (uint32*) sp->tbuf;
-- assert(sp->tbuflen >= npixels);
-+ if(sp->tbuflen < npixels) {
-+ TIFFErrorExt(tif->tif_clientdata, module,
-+ "Translation buffer too short");
-+ return (0);
-+ }
- (*sp->tfunc)(sp, bp, npixels);
- }
- /* compress each byte string */
diff --git a/chromium/third_party/pdfium/third_party/libtiff/0004-CVE-2015-8784.patch b/chromium/third_party/pdfium/third_party/libtiff/0004-CVE-2015-8784.patch
deleted file mode 100644
index e4415de6c1a..00000000000
--- a/chromium/third_party/pdfium/third_party/libtiff/0004-CVE-2015-8784.patch
+++ /dev/null
@@ -1,50 +0,0 @@
-From b18012dae552f85dcc5c57d3bf4e997a15b1cc1c Mon Sep 17 00:00:00 2001
-From: erouault <erouault>
-Date: Sun, 27 Dec 2015 16:55:20 +0000
-Subject: [PATCH] * libtiff/tif_next.c: fix potential out-of-bound write in
- NeXTDecode() triggered by http://lcamtuf.coredump.cx/afl/vulns/libtiff5.tif
- (bugzilla #2508)
-
----
- ChangeLog | 6 ++++++
- libtiff/tif_next.c | 10 ++++++++--
- 2 files changed, 14 insertions(+), 2 deletions(-)
-
-diff --git a/libtiff/tif_next.c b/libtiff/tif_next.c
-index dd669cc..0a5b635 100644
---- a/libtiff/tif_next.c
-+++ b/libtiff/tif_next.c
-@@ -37,7 +37,7 @@
- case 0: op[0] = (unsigned char) ((v) << 6); break; \
- case 1: op[0] |= (v) << 4; break; \
- case 2: op[0] |= (v) << 2; break; \
-- case 3: *op++ |= (v); break; \
-+ case 3: *op++ |= (v); op_offset++; break; \
- } \
- }
-
-@@ -106,6 +106,7 @@ NeXTDecode(TIFF* tif, uint8* buf, tmsize_t occ, uint16 s)
- uint32 imagewidth = tif->tif_dir.td_imagewidth;
- if( isTiled(tif) )
- imagewidth = tif->tif_dir.td_tilewidth;
-+ tmsize_t op_offset = 0;
-
- /*
- * The scanline is composed of a sequence of constant
-@@ -122,10 +123,15 @@ NeXTDecode(TIFF* tif, uint8* buf, tmsize_t occ, uint16 s)
- * bounds, potentially resulting in a security
- * issue.
- */
-- while (n-- > 0 && npixels < imagewidth)
-+ while (n-- > 0 && npixels < imagewidth && op_offset < scanline)
- SETPIXEL(op, grey);
- if (npixels >= imagewidth)
- break;
-+ if (op_offset >= scanline ) {
-+ TIFFErrorExt(tif->tif_clientdata, module, "Invalid data for scanline %ld",
-+ (long) tif->tif_row);
-+ return (0);
-+ }
- if (cc == 0)
- goto bad;
- n = *bp++, cc--;
diff --git a/chromium/third_party/pdfium/third_party/libtiff/0006-HeapBufferOverflow-ChopUpSingleUncompressedStrip.patch b/chromium/third_party/pdfium/third_party/libtiff/0006-HeapBufferOverflow-ChopUpSingleUncompressedStrip.patch
index 583f068c955..5d44fb1cbc4 100644
--- a/chromium/third_party/pdfium/third_party/libtiff/0006-HeapBufferOverflow-ChopUpSingleUncompressedStrip.patch
+++ b/chromium/third_party/pdfium/third_party/libtiff/0006-HeapBufferOverflow-ChopUpSingleUncompressedStrip.patch
@@ -1,9 +1,9 @@
-diff --git a/core/fxcodec/codec/fx_codec_tiff.cpp b/core/fxcodec/codec/fx_codec_tiff.cpp
+diff --git a/core/fxcodec/codec/ccodec_tiffmodule.cpp b/core/fxcodec/codec/ccodec_tiffmodule.cpp
index 09cfea4..20fda63 100644
---- a/core/fxcodec/codec/fx_codec_tiff.cpp
-+++ b/core/fxcodec/codec/fx_codec_tiff.cpp
+--- a/core/fxcodec/codec/ccodec_tiffmodule.cpp
++++ b/core/fxcodec/codec/ccodec_tiffmodule.cpp
@@ -79,6 +79,10 @@ int _TIFFmemcmp(const void* ptr1, const void* ptr2, tmsize_t size) {
- return FXSYS_memcmp(ptr1, ptr2, (size_t)size);
+ return memcmp(ptr1, ptr2, (size_t)size);
}
+int _TIFFIfMultiplicationOverflow(tmsize_t op1, tmsize_t op2) {
diff --git a/chromium/third_party/pdfium/third_party/libtiff/0009-HeapBufferOverflow-PixarLogDecode.patch b/chromium/third_party/pdfium/third_party/libtiff/0009-HeapBufferOverflow-PixarLogDecode.patch
deleted file mode 100644
index 57dbe2efb72..00000000000
--- a/chromium/third_party/pdfium/third_party/libtiff/0009-HeapBufferOverflow-PixarLogDecode.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-diff --git a/third_party/libtiff/tif_pixarlog.c b/third_party/libtiff/tif_pixarlog.c
-index b93b4c7..0674fa4 100644
---- a/third_party/libtiff/tif_pixarlog.c
-+++ b/third_party/libtiff/tif_pixarlog.c
-@@ -457,6 +457,7 @@ horizontalAccumulate8abgr(uint16 *wp, int n, int stride, unsigned char *op,
- typedef struct {
- TIFFPredictorState predict;
- z_stream stream;
-+ tmsize_t tbuf_size; /* only set/used on reading for now */
- uint16 *tbuf;
- uint16 stride;
- int state;
-@@ -692,6 +693,7 @@ PixarLogSetupDecode(TIFF* tif)
- sp->tbuf = (uint16 *) _TIFFmalloc(tbuf_size);
- if (sp->tbuf == NULL)
- return (0);
-+ sp->tbuf_size = tbuf_size;
- if (sp->user_datafmt == PIXARLOGDATAFMT_UNKNOWN)
- sp->user_datafmt = PixarLogGuessDataFmt(td);
- if (sp->user_datafmt == PIXARLOGDATAFMT_UNKNOWN) {
-@@ -781,6 +783,12 @@ PixarLogDecode(TIFF* tif, uint8* op, tmsize_t occ, uint16 s)
- TIFFErrorExt(tif->tif_clientdata, module, "ZLib cannot deal with buffers this size");
- return (0);
- }
-+ /* Check that we will not fill more than what was allocated */
-+ if ((tmsize_t)sp->stream.avail_out > sp->tbuf_size)
-+ {
-+ TIFFErrorExt(tif->tif_clientdata, module, "sp->stream.avail_out > sp->tbuf_size");
-+ return (0);
-+ }
- do {
- int state = inflate(&sp->stream, Z_PARTIAL_FLUSH);
- if (state == Z_STREAM_END) {
diff --git a/chromium/third_party/pdfium/third_party/libtiff/0011-fix-leak-imagebegin2.patch b/chromium/third_party/pdfium/third_party/libtiff/0011-fix-leak-imagebegin2.patch
index 91f82c939e3..6d8e402ea71 100644
--- a/chromium/third_party/pdfium/third_party/libtiff/0011-fix-leak-imagebegin2.patch
+++ b/chromium/third_party/pdfium/third_party/libtiff/0011-fix-leak-imagebegin2.patch
@@ -1,41 +1,32 @@
diff --git a/third_party/libtiff/tif_getimage.c b/third_party/libtiff/tif_getimage.c
-index 97fa94d..1cf6ac6 100644
+index 66ace060e..6e605c441 100644
--- a/third_party/libtiff/tif_getimage.c
+++ b/third_party/libtiff/tif_getimage.c
-@@ -267,6 +267,13 @@ TIFFRGBAImageBegin(TIFFRGBAImage* img, TIFF* tif, int stop, char emsg[1024])
- img->redcmap = NULL;
- img->greencmap = NULL;
- img->bluecmap = NULL;
-+ img->Map = NULL;
-+ img->BWmap = NULL;
-+ img->PALmap = NULL;
-+ img->ycbcr = NULL;
-+ img->cielab = NULL;
-+ img->UaToAa = NULL;
-+ img->Bitdepth16To8 = NULL;
- img->req_orientation = ORIENTATION_BOTLEFT; /* It is the default */
+@@ -284,6 +283,13 @@ TIFFRGBAImageBegin(TIFFRGBAImage* img, TIFF* tif, int stop, char emsg[1024])
+ img->redcmap = NULL;
+ img->greencmap = NULL;
+ img->bluecmap = NULL;
++ img->Map = NULL;
++ img->BWmap = NULL;
++ img->PALmap = NULL;
++ img->ycbcr = NULL;
++ img->cielab = NULL;
++ img->UaToAa = NULL;
++ img->Bitdepth16To8 = NULL;
+ img->req_orientation = ORIENTATION_BOTLEFT; /* It is the default */
- img->tif = tif;
-@@ -452,13 +459,6 @@ TIFFRGBAImageBegin(TIFFRGBAImage* img, TIFF* tif, int stop, char emsg[1024])
- photoTag, img->photometric);
+ img->tif = tif;
+@@ -476,13 +468,6 @@ TIFFRGBAImageBegin(TIFFRGBAImage* img, TIFF* tif, int stop, char emsg[1024])
+ photoTag, img->photometric);
goto fail_return;
- }
-- img->Map = NULL;
-- img->BWmap = NULL;
-- img->PALmap = NULL;
-- img->ycbcr = NULL;
-- img->cielab = NULL;
-- img->UaToAa = NULL;
-- img->Bitdepth16To8 = NULL;
- TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &img->width);
- TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &img->height);
- TIFFGetFieldDefaulted(tif, TIFFTAG_ORIENTATION, &img->orientation);
-@@ -478,7 +478,7 @@ TIFFRGBAImageBegin(TIFFRGBAImage* img, TIFF* tif, int stop, char emsg[1024])
- return 1;
-
- fail_return:
-- TIFFRGBAImageEnd(img);
-+ TIFFRGBAImageEnd( img );
- return 0;
- }
- \ No newline at end of file
+ }
+- img->Map = NULL;
+- img->BWmap = NULL;
+- img->PALmap = NULL;
+- img->ycbcr = NULL;
+- img->cielab = NULL;
+- img->UaToAa = NULL;
+- img->Bitdepth16To8 = NULL;
+ TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &img->width);
+ TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &img->height);
+ TIFFGetFieldDefaulted(tif, TIFFTAG_ORIENTATION, &img->orientation);
diff --git a/chromium/third_party/pdfium/third_party/libtiff/0015-fix-leaks-in-tif_ojpeg.patch b/chromium/third_party/pdfium/third_party/libtiff/0015-fix-leaks-in-tif_ojpeg.patch
index e9d3a408bfe..d2ddd4aad66 100644
--- a/chromium/third_party/pdfium/third_party/libtiff/0015-fix-leaks-in-tif_ojpeg.patch
+++ b/chromium/third_party/pdfium/third_party/libtiff/0015-fix-leaks-in-tif_ojpeg.patch
@@ -1,37 +1,43 @@
diff --git a/third_party/libtiff/tif_ojpeg.c b/third_party/libtiff/tif_ojpeg.c
-index cc5449cd6..f69b00148 100644
+index e128887bf..465f9ebc4 100644
--- a/third_party/libtiff/tif_ojpeg.c
+++ b/third_party/libtiff/tif_ojpeg.c
-@@ -1790,7 +1790,10 @@ OJPEGReadHeaderInfoSecTablesQTable(TIFF* tif)
- TIFFSeekFile(tif,sp->qtable_offset[m],SEEK_SET);
- p=TIFFReadFile(tif,&ob[sizeof(uint32)+5],64);
- if (p!=64)
-+ {
-+ _TIFFfree(ob);
- return(0);
-+ }
- sp->qtable[m]=ob;
- sp->sof_tq[m]=m;
- }
-@@ -1854,7 +1857,10 @@ OJPEGReadHeaderInfoSecTablesDcTable(TIFF* tif)
- rb[sizeof(uint32)+5+n]=o[n];
- p=TIFFReadFile(tif,&(rb[sizeof(uint32)+21]),q);
- if (p!=q)
-+ {
-+ _TIFFfree(rb);
- return(0);
-+ }
- sp->dctable[m]=rb;
- sp->sos_tda[m]=(m<<4);
- }
-@@ -1918,7 +1924,10 @@ OJPEGReadHeaderInfoSecTablesAcTable(TIFF* tif)
- rb[sizeof(uint32)+5+n]=o[n];
- p=TIFFReadFile(tif,&(rb[sizeof(uint32)+21]),q);
- if (p!=q)
-+ {
-+ _TIFFfree(rb);
- return(0);
-+ }
- sp->actable[m]=rb;
- sp->sos_tda[m]=(sp->sos_tda[m]|m);
- }
+@@ -1791,7 +1791,12 @@ OJPEGReadHeaderInfoSecTablesQTable(TIFF* tif)
+ TIFFSeekFile(tif,sp->qtable_offset[m],SEEK_SET);
+ p=(uint32)TIFFReadFile(tif,&ob[sizeof(uint32)+5],64);
+ if (p!=64)
++ {
++ _TIFFfree(ob);
+ return(0);
++ }
++ if (sp->qtable[m]!=0)
++ _TIFFfree(sp->qtable[m]);
+ sp->qtable[m]=ob;
+ sp->sof_tq[m]=m;
+ }
+@@ -1860,7 +1855,12 @@ OJPEGReadHeaderInfoSecTablesDcTable(TIFF* tif)
+ rb[sizeof(uint32)+5+n]=o[n];
+ p=(uint32)TIFFReadFile(tif,&(rb[sizeof(uint32)+21]),q);
+ if (p!=q)
++ {
++ _TIFFfree(rb);
+ return(0);
++ }
++ if (sp->dctable[m]!=0)
++ _TIFFfree(sp->dctable[m]);
+ sp->dctable[m]=rb;
+ sp->sos_tda[m]=(m<<4);
+ }
+@@ -1929,7 +1919,12 @@ OJPEGReadHeaderInfoSecTablesAcTable(TIFF* tif)
+ rb[sizeof(uint32)+5+n]=o[n];
+ p=(uint32)TIFFReadFile(tif,&(rb[sizeof(uint32)+21]),q);
+ if (p!=q)
++ {
++ _TIFFfree(rb);
+ return(0);
++ }
++ if (sp->actable[m])
++ _TIFFfree(sp->actable[m]);
+ sp->actable[m]=rb;
+ sp->sos_tda[m]=(sp->sos_tda[m]|m);
+ }
diff --git a/chromium/third_party/pdfium/third_party/libtiff/0016-fix-leak-in-pixarlogsetupdecode.patch b/chromium/third_party/pdfium/third_party/libtiff/0016-fix-leak-in-pixarlogsetupdecode.patch
deleted file mode 100644
index c49e676c348..00000000000
--- a/chromium/third_party/pdfium/third_party/libtiff/0016-fix-leak-in-pixarlogsetupdecode.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-diff --git a/third_party/libtiff/tif_pixarlog.c b/third_party/libtiff/tif_pixarlog.c
-index 29535d31e..80006d5b1 100644
---- a/third_party/libtiff/tif_pixarlog.c
-+++ b/third_party/libtiff/tif_pixarlog.c
-@@ -697,6 +697,9 @@ PixarLogSetupDecode(TIFF* tif)
- if (sp->user_datafmt == PIXARLOGDATAFMT_UNKNOWN)
- sp->user_datafmt = PixarLogGuessDataFmt(td);
- if (sp->user_datafmt == PIXARLOGDATAFMT_UNKNOWN) {
-+ _TIFFfree(sp->tbuf);
-+ sp->tbuf = NULL;
-+ sp->tbuf_size = 0;
- TIFFErrorExt(tif->tif_clientdata, module,
- "PixarLog compression can't handle bits depth/data format combination (depth: %d)",
- td->td_bitspersample);
-@@ -704,6 +707,9 @@ PixarLogSetupDecode(TIFF* tif)
- }
-
- if (inflateInit(&sp->stream) != Z_OK) {
-+ _TIFFfree(sp->tbuf);
-+ sp->tbuf = NULL;
-+ sp->tbuf_size = 0;
- TIFFErrorExt(tif->tif_clientdata, module, "%s", sp->stream.msg);
- return (0);
- } else {
diff --git a/chromium/third_party/pdfium/third_party/libtiff/0017-safe_skews_in_gtTileContig.patch b/chromium/third_party/pdfium/third_party/libtiff/0017-safe_skews_in_gtTileContig.patch
index 10c5077392d..ad6d33daeec 100644
--- a/chromium/third_party/pdfium/third_party/libtiff/0017-safe_skews_in_gtTileContig.patch
+++ b/chromium/third_party/pdfium/third_party/libtiff/0017-safe_skews_in_gtTileContig.patch
@@ -1,5 +1,5 @@
diff --git a/third_party/libtiff/tif_getimage.c b/third_party/libtiff/tif_getimage.c
-index 2861cdd1e..5ed1b7a37 100644
+index 84cc1d1a7..82e19164e 100644
--- a/third_party/libtiff/tif_getimage.c
+++ b/third_party/libtiff/tif_getimage.c
@@ -31,6 +31,7 @@
@@ -10,7 +10,7 @@ index 2861cdd1e..5ed1b7a37 100644
static int gtTileContig(TIFFRGBAImage*, uint32*, uint32, uint32);
static int gtTileSeparate(TIFFRGBAImage*, uint32*, uint32, uint32);
-@@ -612,6 +613,7 @@ gtTileContig(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
+@@ -629,6 +628,7 @@ gtTileContig(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
uint32 tw, th;
unsigned char* buf;
int32 fromskew, toskew;
@@ -18,22 +18,23 @@ index 2861cdd1e..5ed1b7a37 100644
uint32 nrow;
int ret = 1, flip;
uint32 this_tw, tocol;
-@@ -631,19 +633,37 @@ gtTileContig(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
+@@ -649,19 +647,37 @@ gtTileContig(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
flip = setorientation(img);
if (flip & FLIP_VERTICALLY) {
- y = h - 1;
-- toskew = -(int32)(tw + w);
-+ safeskew = 0;
-+ safeskew -= tw;
-+ safeskew -= w;
+ y = h - 1;
+- toskew = -(int32)(tw + w);
++ safeskew = 0;
++ safeskew -= tw;
++ safeskew -= w;
}
else {
- y = 0;
-- toskew = -(int32)(tw - w);
-+ safeskew = 0;
-+ safeskew -= tw;
-+ safeskew +=w;
+ y = 0;
+- toskew = -(int32)(tw - w);
++ safeskew = 0;
++ safeskew -= tw;
++ safeskew +=w;
}
+
+ if(safeskew > INT_MAX || safeskew < INT_MIN){
+ _TIFFfree(buf);
+ TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "%s", "Invalid skew");
@@ -41,9 +42,8 @@ index 2861cdd1e..5ed1b7a37 100644
+ }
+ toskew = safeskew;
+
-
/*
- * Leftmost tile is clipped on left side if col_offset > 0.
+ * Leftmost tile is clipped on left side if col_offset > 0.
*/
leftmost_fromskew = img->col_offset % tw;
leftmost_tw = tw - leftmost_fromskew;
@@ -59,30 +59,30 @@ index 2861cdd1e..5ed1b7a37 100644
for (row = 0; row < h; row += nrow)
{
rowstoread = th - (row + img->row_offset) % th;
-@@ -668,9 +688,24 @@ gtTileContig(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
- /*
- * Rightmost tile is clipped on right side.
- */
-- fromskew = tw - (w - tocol);
-+ safeskew = tw;
-+ safeskew -= w;
-+ safeskew += tocol;
-+ if(safeskew > INT_MAX || safeskew < INT_MIN){
-+ _TIFFfree(buf);
-+ TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "%s", "Invalid skew");
-+ return (0);
-+ }
-+ fromskew = safeskew;
- this_tw = tw - fromskew;
-- this_toskew = toskew + fromskew;
-+ safeskew = toskew;
-+ safeskew += fromskew;
-+ if(safeskew > INT_MAX || safeskew < INT_MIN){
-+ _TIFFfree(buf);
-+ TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "%s", "Invalid skew");
-+ return (0);
-+ }
-+ this_toskew = safeskew;
- }
- (*put)(img, raster+y*w+tocol, tocol, y, this_tw, nrow, fromskew, this_toskew, buf + pos);
- tocol += this_tw;
+@@ -704,9 +684,24 @@ gtTileContig(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
+ /*
+ * Rightmost tile is clipped on right side.
+ */
+- fromskew = tw - (w - tocol);
++ safeskew = tw;
++ safeskew -= w;
++ safeskew += tocol;
++ if(safeskew > INT_MAX || safeskew < INT_MIN){
++ _TIFFfree(buf);
++ TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "%s", "Invalid skew");
++ return (0);
++ }
++ fromskew = safeskew;
+ this_tw = tw - fromskew;
+- this_toskew = toskew + fromskew;
++ safeskew = toskew;
++ safeskew += fromskew;
++ if(safeskew > INT_MAX || safeskew < INT_MIN){
++ _TIFFfree(buf);
++ TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "%s", "Invalid skew");
++ return (0);
++ }
++ this_toskew = safeskew;
+ }
+ (*put)(img, raster+y*w+tocol, tocol, y, this_tw, nrow, fromskew, this_toskew, buf + pos);
+ tocol += this_tw;
diff --git a/chromium/third_party/pdfium/third_party/libtiff/0018-fix-leak-in-PredictorSetupDecode.patch b/chromium/third_party/pdfium/third_party/libtiff/0018-fix-leak-in-PredictorSetupDecode.patch
index a18df774096..e7758eb5732 100644
--- a/chromium/third_party/pdfium/third_party/libtiff/0018-fix-leak-in-PredictorSetupDecode.patch
+++ b/chromium/third_party/pdfium/third_party/libtiff/0018-fix-leak-in-PredictorSetupDecode.patch
@@ -1,39 +1,15 @@
-diff --git a/third_party/libtiff/tif_pixarlog.c b/third_party/libtiff/tif_pixarlog.c
-index 80006d5b1..29535d31e 100644
---- a/third_party/libtiff/tif_pixarlog.c
-+++ b/third_party/libtiff/tif_pixarlog.c
-@@ -697,9 +697,6 @@ PixarLogSetupDecode(TIFF* tif)
- if (sp->user_datafmt == PIXARLOGDATAFMT_UNKNOWN)
- sp->user_datafmt = PixarLogGuessDataFmt(td);
- if (sp->user_datafmt == PIXARLOGDATAFMT_UNKNOWN) {
-- _TIFFfree(sp->tbuf);
-- sp->tbuf = NULL;
-- sp->tbuf_size = 0;
- TIFFErrorExt(tif->tif_clientdata, module,
- "PixarLog compression can't handle bits depth/data format combination (depth: %d)",
- td->td_bitspersample);
-@@ -707,9 +704,6 @@ PixarLogSetupDecode(TIFF* tif)
- }
-
- if (inflateInit(&sp->stream) != Z_OK) {
-- _TIFFfree(sp->tbuf);
-- sp->tbuf = NULL;
-- sp->tbuf_size = 0;
- TIFFErrorExt(tif->tif_clientdata, module, "%s", sp->stream.msg);
- return (0);
- } else {
diff --git a/third_party/libtiff/tif_predict.c b/third_party/libtiff/tif_predict.c
-index 1388dde59..8975672ae 100644
+index 1bb78e209..0b185d2e2 100644
--- a/third_party/libtiff/tif_predict.c
+++ b/third_party/libtiff/tif_predict.c
-@@ -109,7 +109,10 @@ PredictorSetupDecode(TIFF* tif)
- TIFFDirectory* td = &tif->tif_dir;
+@@ -118,7 +118,10 @@ PredictorSetupDecode(TIFF* tif)
+ TIFFDirectory* td = &tif->tif_dir;
- if (!(*sp->setupdecode)(tif) || !PredictorSetup(tif))
-+ {
-+ (*tif->tif_cleanup)(tif);
- return 0;
-+ }
+ if (!(*sp->setupdecode)(tif) || !PredictorSetup(tif))
++ {
++ (*tif->tif_cleanup)(tif);
+ return 0;
++ }
- if (sp->predictor == 2) {
- switch (td->td_bitspersample) {
+ if (sp->predictor == 2) {
+ switch (td->td_bitspersample) {
diff --git a/chromium/third_party/pdfium/third_party/libtiff/0019-fix-invalid-reads-TIFFFetchNormalTag.patch b/chromium/third_party/pdfium/third_party/libtiff/0019-fix-invalid-reads-TIFFFetchNormalTag.patch
deleted file mode 100644
index 9ebb7ef8db9..00000000000
--- a/chromium/third_party/pdfium/third_party/libtiff/0019-fix-invalid-reads-TIFFFetchNormalTag.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-diff --git a/third_party/libtiff/tif_dirread.c b/third_party/libtiff/tif_dirread.c
-index bc4102184..0e3f8ccd4 100644
---- a/third_party/libtiff/tif_dirread.c
-+++ b/third_party/libtiff/tif_dirread.c
-@@ -4983,6 +4983,11 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover)
- if (err==TIFFReadDirEntryErrOk)
- {
- int m;
-+ if( dp->tdir_count > 0 && data[dp->tdir_count-1] != '\0' )
-+ {
-+ TIFFWarningExt(tif->tif_clientdata,module,"ASCII value for tag \"%s\" does not end in null byte. Forcing it to be null",fip->field_name);
-+ data[dp->tdir_count-1] = '\0';
-+ }
- m=TIFFSetField(tif,dp->tdir_tag,(uint16)(dp->tdir_count),data);
- if (data!=0)
- _TIFFfree(data);
-@@ -5155,6 +5160,11 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover)
- if (err==TIFFReadDirEntryErrOk)
- {
- int m;
-+ if( dp->tdir_count > 0 && data[dp->tdir_count-1] != '\0' )
-+ {
-+ TIFFWarningExt(tif->tif_clientdata,module,"ASCII value for tag \"%s\" does not end in null byte. Forcing it to be null",fip->field_name);
-+ data[dp->tdir_count-1] = '\0';
-+ }
- m=TIFFSetField(tif,dp->tdir_tag,(uint32)(dp->tdir_count),data);
- if (data!=0)
- _TIFFfree(data);
diff --git a/chromium/third_party/pdfium/third_party/libtiff/0019-oom-TIFFReadDirEntryArray.patch b/chromium/third_party/pdfium/third_party/libtiff/0019-oom-TIFFReadDirEntryArray.patch
new file mode 100644
index 00000000000..1144e06ef4a
--- /dev/null
+++ b/chromium/third_party/pdfium/third_party/libtiff/0019-oom-TIFFReadDirEntryArray.patch
@@ -0,0 +1,81 @@
+diff --git a/third_party/libtiff/tif_dirread.c b/third_party/libtiff/tif_dirread.c
+index 7dd944483..d50b39a80 100644
+--- a/third_party/libtiff/tif_dirread.c
++++ b/third_party/libtiff/tif_dirread.c
+@@ -790,44 +790,43 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryArray(TIFF* tif, TIFFDirEntry* d
+ *count=(uint32)direntry->tdir_count;
+ datasize=(*count)*typesize;
+ assert((tmsize_t)datasize>0);
+- data=_TIFFCheckMalloc(tif, *count, typesize, "ReadDirEntryArray");
+- if (data==0)
+- return(TIFFReadDirEntryErrAlloc);
++ const uint32 small_alloc_threshold=(tif->tif_flags&TIFF_BIGTIFF)? 8 : 4;
++ if (datasize <= small_alloc_threshold)
++ {
++ data=_TIFFCheckMalloc(tif, *count, typesize, "ReadDirEntryArray");
++ if (data==0)
++ return(TIFFReadDirEntryErrAlloc);
++ _TIFFmemcpy(data,&direntry->tdir_offset,datasize);
++ *value=data;
++ return(TIFFReadDirEntryErrOk);
++ }
++ uint64 offset;
+ if (!(tif->tif_flags&TIFF_BIGTIFF))
+ {
+- if (datasize<=4)
+- _TIFFmemcpy(data,&direntry->tdir_offset,datasize);
+- else
+- {
+- enum TIFFReadDirEntryErr err;
+- uint32 offset = direntry->tdir_offset.toff_long;
+- if (tif->tif_flags&TIFF_SWAB)
+- TIFFSwabLong(&offset);
+- err=TIFFReadDirEntryData(tif,(uint64)offset,(tmsize_t)datasize,data);
+- if (err!=TIFFReadDirEntryErrOk)
+- {
+- _TIFFfree(data);
+- return(err);
+- }
+- }
++ uint32 small_offset=direntry->tdir_offset.toff_long;
++ if (tif->tif_flags&TIFF_SWAB)
++ TIFFSwabLong(&small_offset);
++ offset=(uint64)small_offset;
+ }
+ else
+ {
+- if (datasize<=8)
+- _TIFFmemcpy(data,&direntry->tdir_offset,datasize);
+- else
+- {
+- enum TIFFReadDirEntryErr err;
+- uint64 offset = direntry->tdir_offset.toff_long8;
+- if (tif->tif_flags&TIFF_SWAB)
+- TIFFSwabLong8(&offset);
+- err=TIFFReadDirEntryData(tif,offset,(tmsize_t)datasize,data);
+- if (err!=TIFFReadDirEntryErrOk)
+- {
+- _TIFFfree(data);
+- return(err);
+- }
+- }
++ offset = direntry->tdir_offset.toff_long8;
++ if (tif->tif_flags&TIFF_SWAB)
++ TIFFSwabLong8(&offset);
++ }
++ if ((uint64)(-1) - offset < datasize)
++ return(TIFFReadDirEntryErrIo);
++ const uint64 size=isMapped(tif)? (uint64)tif->tif_size : TIFFGetFileSize(tif);
++ if (offset + datasize > size)
++ return(TIFFReadDirEntryErrIo);
++ data=_TIFFCheckMalloc(tif, *count, typesize, "ReadDirEntryArray");
++ if (data==0)
++ return(TIFFReadDirEntryErrAlloc);
++ enum TIFFReadDirEntryErr err=TIFFReadDirEntryData(tif,offset,(tmsize_t)datasize,data);
++ if (err!=TIFFReadDirEntryErrOk)
++ {
++ _TIFFfree(data);
++ return(err);
+ }
+ *value=data;
+ return(TIFFReadDirEntryErrOk);
diff --git a/chromium/third_party/pdfium/third_party/libtiff/0020-unreasonable-td-bitspersample.patch b/chromium/third_party/pdfium/third_party/libtiff/0020-unreasonable-td-bitspersample.patch
deleted file mode 100644
index 1ad5e34e3c2..00000000000
--- a/chromium/third_party/pdfium/third_party/libtiff/0020-unreasonable-td-bitspersample.patch
+++ /dev/null
@@ -1,22 +0,0 @@
-diff --git a/third_party/libtiff/tif_dirread.c b/third_party/libtiff/tif_dirread.c
-index 0e3f8ccd4..e0403aef3 100644
---- a/third_party/libtiff/tif_dirread.c
-+++ b/third_party/libtiff/tif_dirread.c
-@@ -3754,6 +3754,17 @@ TIFFReadDirectory(TIFF* tif)
- fip ? fip->field_name : "unknown tagname");
- continue;
- }
-+ /* ColorMap or TransferFunction for high bit */
-+ /* depths do not make much sense and could be */
-+ /* used as a denial of service vector */
-+ if (tif->tif_dir.td_bitspersample > 24)
-+ {
-+ TIFFWarningExt(tif->tif_clientdata,module,
-+ "Ignoring %s because BitsPerSample=%d>24",
-+ fip ? fip->field_name : "unknown tagname",
-+ tif->tif_dir.td_bitspersample);
-+ continue;
-+ }
- countpersample=(1L<<tif->tif_dir.td_bitspersample);
- if ((dp->tdir_tag==TIFFTAG_TRANSFERFUNCTION)&&(dp->tdir_count==(uint64)countpersample))
- {
diff --git a/chromium/third_party/pdfium/third_party/libtiff/0020-upstream-security-fixes.patch b/chromium/third_party/pdfium/third_party/libtiff/0020-upstream-security-fixes.patch
new file mode 100644
index 00000000000..139b79ddebb
--- /dev/null
+++ b/chromium/third_party/pdfium/third_party/libtiff/0020-upstream-security-fixes.patch
@@ -0,0 +1,270 @@
+diff --git a/third_party/libtiff/tif_dir.c b/third_party/libtiff/tif_dir.c
+index 4b3632ab1..81b849374 100644
+--- a/third_party/libtiff/tif_dir.c
++++ b/third_party/libtiff/tif_dir.c
+@@ -862,6 +862,32 @@ _TIFFVGetField(TIFF* tif, uint32 tag, va_list ap)
+ if( fip == NULL ) /* cannot happen since TIFFGetField() already checks it */
+ return 0;
+
++ if( tag == TIFFTAG_NUMBEROFINKS )
++ {
++ int i;
++ for (i = 0; i < td->td_customValueCount; i++) {
++ uint16 val;
++ TIFFTagValue *tv = td->td_customValues + i;
++ if (tv->info->field_tag != tag)
++ continue;
++ val = *(uint16 *)tv->value;
++ /* Truncate to SamplesPerPixel, since the */
++ /* setting code for INKNAMES assume that there are SamplesPerPixel */
++ /* inknames. */
++ /* Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2599 */
++ if( val > td->td_samplesperpixel )
++ {
++ TIFFWarningExt(tif->tif_clientdata,"_TIFFVGetField",
++ "Truncating NumberOfInks from %u to %u",
++ val, td->td_samplesperpixel);
++ val = td->td_samplesperpixel;
++ }
++ *va_arg(ap, uint16*) = val;
++ return 1;
++ }
++ return 0;
++ }
++
+ /*
+ * We want to force the custom code to be used for custom
+ * fields even if the tag happens to match a well known
+diff --git a/third_party/libtiff/tif_dirread.c b/third_party/libtiff/tif_dirread.c
+index d50b39a80..7dbcf6d86 100644
+--- a/third_party/libtiff/tif_dirread.c
++++ b/third_party/libtiff/tif_dirread.c
+@@ -5503,8 +5503,7 @@ ChopUpSingleUncompressedStrip(TIFF* tif)
+ uint64 rowblockbytes;
+ uint64 stripbytes;
+ uint32 strip;
+- uint64 nstrips64;
+- uint32 nstrips32;
++ uint32 nstrips;
+ uint32 rowsperstrip;
+ uint64* newcounts;
+ uint64* newoffsets;
+@@ -5535,18 +5534,17 @@ ChopUpSingleUncompressedStrip(TIFF* tif)
+ return;
+
+ /*
+- * never increase the number of strips in an image
++ * never increase the number of rows per strip
+ */
+ if (rowsperstrip >= td->td_rowsperstrip)
+ return;
+- nstrips64 = TIFFhowmany_64(bytecount, stripbytes);
+- if ((nstrips64==0)||(nstrips64>0xFFFFFFFF)) /* something is wonky, do nothing. */
+- return;
+- nstrips32 = (uint32)nstrips64;
++ nstrips = TIFFhowmany_32(td->td_imagelength, rowsperstrip);
++ if( nstrips == 0 )
++ return;
+
+- newcounts = (uint64*) _TIFFCheckMalloc(tif, nstrips32, sizeof (uint64),
++ newcounts = (uint64*) _TIFFCheckMalloc(tif, nstrips, sizeof (uint64),
+ "for chopped \"StripByteCounts\" array");
+- newoffsets = (uint64*) _TIFFCheckMalloc(tif, nstrips32, sizeof (uint64),
++ newoffsets = (uint64*) _TIFFCheckMalloc(tif, nstrips, sizeof (uint64),
+ "for chopped \"StripOffsets\" array");
+ if (newcounts == NULL || newoffsets == NULL) {
+ /*
+@@ -5563,18 +5561,18 @@ ChopUpSingleUncompressedStrip(TIFF* tif)
+ * Fill the strip information arrays with new bytecounts and offsets
+ * that reflect the broken-up format.
+ */
+- for (strip = 0; strip < nstrips32; strip++) {
++ for (strip = 0; strip < nstrips; strip++) {
+ if (stripbytes > bytecount)
+ stripbytes = bytecount;
+ newcounts[strip] = stripbytes;
+- newoffsets[strip] = offset;
++ newoffsets[strip] = stripbytes ? offset : 0;
+ offset += stripbytes;
+ bytecount -= stripbytes;
+ }
+ /*
+ * Replace old single strip info with multi-strip info.
+ */
+- td->td_stripsperimage = td->td_nstrips = nstrips32;
++ td->td_stripsperimage = td->td_nstrips = nstrips;
+ TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, rowsperstrip);
+
+ _TIFFfree(td->td_stripbytecount);
+diff --git a/third_party/libtiff/tif_luv.c b/third_party/libtiff/tif_luv.c
+index ca08f30a7..220c15034 100644
+--- a/third_party/libtiff/tif_luv.c
++++ b/third_party/libtiff/tif_luv.c
+@@ -158,6 +158,7 @@
+ typedef struct logLuvState LogLuvState;
+
+ struct logLuvState {
++ int encoder_state; /* 1 if encoder correctly initialized */
+ int user_datafmt; /* user data format */
+ int encode_meth; /* encoding method */
+ int pixel_size; /* bytes per pixel */
+@@ -1552,6 +1553,7 @@ LogLuvSetupEncode(TIFF* tif)
+ td->td_photometric, "must be either LogLUV or LogL");
+ break;
+ }
++ sp->encoder_state = 1;
+ return (1);
+ notsupported:
+ TIFFErrorExt(tif->tif_clientdata, module,
+@@ -1563,19 +1565,27 @@ notsupported:
+ static void
+ LogLuvClose(TIFF* tif)
+ {
++ LogLuvState* sp = (LogLuvState*) tif->tif_data;
+ TIFFDirectory *td = &tif->tif_dir;
+
++ assert(sp != 0);
+ /*
+ * For consistency, we always want to write out the same
+ * bitspersample and sampleformat for our TIFF file,
+ * regardless of the data format being used by the application.
+ * Since this routine is called after tags have been set but
+ * before they have been recorded in the file, we reset them here.
++ * Note: this is really a nasty approach. See PixarLogClose
+ */
+- td->td_samplesperpixel =
+- (td->td_photometric == PHOTOMETRIC_LOGL) ? 1 : 3;
+- td->td_bitspersample = 16;
+- td->td_sampleformat = SAMPLEFORMAT_INT;
++ if( sp->encoder_state )
++ {
++ /* See PixarLogClose. Might avoid issues with tags whose size depends
++ * on those below, but not completely sure this is enough. */
++ td->td_samplesperpixel =
++ (td->td_photometric == PHOTOMETRIC_LOGL) ? 1 : 3;
++ td->td_bitspersample = 16;
++ td->td_sampleformat = SAMPLEFORMAT_INT;
++ }
+ }
+
+ static void
+diff --git a/third_party/libtiff/tif_ojpeg.c b/third_party/libtiff/tif_ojpeg.c
+index e128887bf..cb84be96b 100644
+--- a/third_party/libtiff/tif_ojpeg.c
++++ b/third_party/libtiff/tif_ojpeg.c
+@@ -253,6 +253,7 @@ typedef enum {
+
+ typedef struct {
+ TIFF* tif;
++ int decoder_ok;
+ #ifndef LIBJPEG_ENCAP_EXTERNAL
+ JMP_BUF exit_jmpbuf;
+ #endif
+@@ -731,6 +732,7 @@ OJPEGPreDecode(TIFF* tif, uint16 s)
+ }
+ sp->write_curstrile++;
+ }
++ sp->decoder_ok = 1;
+ return(1);
+ }
+
+@@ -793,8 +795,14 @@ OJPEGPreDecodeSkipScanlines(TIFF* tif)
+ static int
+ OJPEGDecode(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s)
+ {
++ static const char module[]="OJPEGDecode";
+ OJPEGState* sp=(OJPEGState*)tif->tif_data;
+ (void)s;
++ if( !sp->decoder_ok )
++ {
++ TIFFErrorExt(tif->tif_clientdata,module,"Cannot decode: decoder not correctly initialized");
++ return 0;
++ }
+ if (sp->libjpeg_jpeg_query_style==0)
+ {
+ if (OJPEGDecodeRaw(tif,buf,cc)==0)
+diff --git a/third_party/libtiff/tif_pixarlog.c b/third_party/libtiff/tif_pixarlog.c
+index 8f6ca8f63..e6574ec3d 100644
+--- a/third_party/libtiff/tif_pixarlog.c
++++ b/third_party/libtiff/tif_pixarlog.c
+@@ -1233,8 +1233,10 @@ PixarLogPostEncode(TIFF* tif)
+ static void
+ PixarLogClose(TIFF* tif)
+ {
++ PixarLogState* sp = (PixarLogState*) tif->tif_data;
+ TIFFDirectory *td = &tif->tif_dir;
+
++ assert(sp != 0);
+ /* In a really sneaky (and really incorrect, and untruthful, and
+ * troublesome, and error-prone) maneuver that completely goes against
+ * the spirit of TIFF, and breaks TIFF, on close, we covertly
+@@ -1243,8 +1245,19 @@ PixarLogClose(TIFF* tif)
+ * readers that don't know about PixarLog, or how to set
+ * the PIXARLOGDATFMT pseudo-tag.
+ */
+- td->td_bitspersample = 8;
+- td->td_sampleformat = SAMPLEFORMAT_UINT;
++
++ if (sp->state&PLSTATE_INIT) {
++ /* We test the state to avoid an issue such as in
++ * http://bugzilla.maptools.org/show_bug.cgi?id=2604
++ * What appends in that case is that the bitspersample is 1 and
++ * a TransferFunction is set. The size of the TransferFunction
++ * depends on 1<<bitspersample. So if we increase it, an access
++ * out of the buffer will happen at directory flushing.
++ * Another option would be to clear those targs.
++ */
++ td->td_bitspersample = 8;
++ td->td_sampleformat = SAMPLEFORMAT_UINT;
++ }
+ }
+
+ static void
+diff --git a/third_party/libtiff/tif_read.c b/third_party/libtiff/tif_read.c
+index 795153bbf..1ba100e54 100644
+--- a/third_party/libtiff/tif_read.c
++++ b/third_party/libtiff/tif_read.c
+@@ -346,7 +346,7 @@ TIFFReadEncodedStrip(TIFF* tif, uint32 strip, void* buf, tmsize_t size)
+ rowsperstrip=td->td_rowsperstrip;
+ if (rowsperstrip>td->td_imagelength)
+ rowsperstrip=td->td_imagelength;
+- stripsperplane=((td->td_imagelength+rowsperstrip-1)/rowsperstrip);
++ stripsperplane= TIFFhowmany_32_maxuint_compat(td->td_imagelength, rowsperstrip);
+ stripinplane=(strip%stripsperplane);
+ plane=(uint16)(strip/stripsperplane);
+ rows=td->td_imagelength-stripinplane*rowsperstrip;
+diff --git a/third_party/libtiff/tif_strip.c b/third_party/libtiff/tif_strip.c
+index b6098dd31..3b55285cd 100644
+--- a/third_party/libtiff/tif_strip.c
++++ b/third_party/libtiff/tif_strip.c
+@@ -63,15 +63,6 @@ TIFFNumberOfStrips(TIFF* tif)
+ TIFFDirectory *td = &tif->tif_dir;
+ uint32 nstrips;
+
+- /* If the value was already computed and store in td_nstrips, then return it,
+- since ChopUpSingleUncompressedStrip might have altered and resized the
+- since the td_stripbytecount and td_stripoffset arrays to the new value
+- after the initial affectation of td_nstrips = TIFFNumberOfStrips() in
+- tif_dirread.c ~line 3612.
+- See http://bugzilla.maptools.org/show_bug.cgi?id=2587 */
+- if( td->td_nstrips )
+- return td->td_nstrips;
+-
+ nstrips = (td->td_rowsperstrip == (uint32) -1 ? 1 :
+ TIFFhowmany_32(td->td_imagelength, td->td_rowsperstrip));
+ if (td->td_planarconfig == PLANARCONFIG_SEPARATE)
+diff --git a/third_party/libtiff/tiffiop.h b/third_party/libtiff/tiffiop.h
+index b6db1e932..1925a6b5e 100644
+--- a/third_party/libtiff/tiffiop.h
++++ b/third_party/libtiff/tiffiop.h
+@@ -249,6 +249,10 @@ struct tiff {
+ #define TIFFhowmany_32(x, y) (((uint32)x < (0xffffffff - (uint32)(y-1))) ? \
+ ((((uint32)(x))+(((uint32)(y))-1))/((uint32)(y))) : \
+ 0U)
++/* Variant of TIFFhowmany_32() that doesn't return 0 if x close to MAXUINT. */
++/* Caution: TIFFhowmany_32_maxuint_compat(x,y)*y might overflow */
++#define TIFFhowmany_32_maxuint_compat(x, y) \
++ (((uint32)(x) / (uint32)(y)) + ((((uint32)(x) % (uint32)(y)) != 0) ? 1 : 0))
+ #define TIFFhowmany8_32(x) (((x)&0x07)?((uint32)(x)>>3)+1:(uint32)(x)>>3)
+ #define TIFFroundup_32(x, y) (TIFFhowmany_32(x,y)*(y))
+ #define TIFFhowmany_64(x, y) ((((uint64)(x))+(((uint64)(y))-1))/((uint64)(y)))
diff --git a/chromium/third_party/pdfium/third_party/libtiff/0021-fix-leaks-ojpegreaderinfosectables.patch b/chromium/third_party/pdfium/third_party/libtiff/0021-fix-leaks-ojpegreaderinfosectables.patch
deleted file mode 100644
index e3b4bd89640..00000000000
--- a/chromium/third_party/pdfium/third_party/libtiff/0021-fix-leaks-ojpegreaderinfosectables.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-diff --git a/third_party/libtiff/tif_ojpeg.c b/third_party/libtiff/tif_ojpeg.c
-index f69b00148..276d562df 100644
---- a/third_party/libtiff/tif_ojpeg.c
-+++ b/third_party/libtiff/tif_ojpeg.c
-@@ -1794,6 +1794,8 @@ OJPEGReadHeaderInfoSecTablesQTable(TIFF* tif)
- _TIFFfree(ob);
- return(0);
- }
-+ if (sp->qtable[m]!=0)
-+ _TIFFfree(sp->qtable[m]);
- sp->qtable[m]=ob;
- sp->sof_tq[m]=m;
- }
-@@ -1861,6 +1863,8 @@ OJPEGReadHeaderInfoSecTablesDcTable(TIFF* tif)
- _TIFFfree(rb);
- return(0);
- }
-+ if (sp->dctable[m]!=0)
-+ _TIFFfree(sp->dctable[m]);
- sp->dctable[m]=rb;
- sp->sos_tda[m]=(m<<4);
- }
-@@ -1928,6 +1932,8 @@ OJPEGReadHeaderInfoSecTablesAcTable(TIFF* tif)
- _TIFFfree(rb);
- return(0);
- }
-+ if (sp->actable[m])
-+ _TIFFfree(sp->actable[m]);
- sp->actable[m]=rb;
- sp->sos_tda[m]=(sp->sos_tda[m]|m);
- }
diff --git a/chromium/third_party/pdfium/third_party/libtiff/0021-oom-TIFFFillStrip.patch b/chromium/third_party/pdfium/third_party/libtiff/0021-oom-TIFFFillStrip.patch
new file mode 100644
index 00000000000..a64dc5ed13a
--- /dev/null
+++ b/chromium/third_party/pdfium/third_party/libtiff/0021-oom-TIFFFillStrip.patch
@@ -0,0 +1,18 @@
+diff --git a/third_party/libtiff/tif_read.c b/third_party/libtiff/tif_read.c
+index 1ba100e54..c25e7e79f 100644
+--- a/third_party/libtiff/tif_read.c
++++ b/third_party/libtiff/tif_read.c
+@@ -616,6 +616,13 @@ TIFFFillStrip(TIFF* tif, uint32 strip)
+ TIFFErrorExt(tif->tif_clientdata,module,"Integer overflow");
+ return(0);
+ }
++ const tmsize_t size=isMapped(tif)? tif->tif_size : (tmsize_t)TIFFGetFileSize(tif);
++ if (bytecountm > size) {
++ TIFFErrorExt(tif->tif_clientdata, module,
++ "Requested read strip size %lu is too large",
++ (unsigned long) strip);
++ return (0);
++ }
+ if (bytecountm > tif->tif_rawdatasize) {
+ tif->tif_curstrip = NOSTRIP;
+ if ((tif->tif_flags & TIFF_MYBUFFER) == 0) {
diff --git a/chromium/third_party/pdfium/third_party/libtiff/README.pdfium b/chromium/third_party/pdfium/third_party/libtiff/README.pdfium
index e4436d21fdc..b11066feddd 100644
--- a/chromium/third_party/pdfium/third_party/libtiff/README.pdfium
+++ b/chromium/third_party/pdfium/third_party/libtiff/README.pdfium
@@ -1,6 +1,6 @@
Name: LibTIFF
URL: http://www.remotesensing.org/libtiff/
-Version: 4.0.6
+Version: 4.0.7
Security Critical: yes
License: BSD
@@ -11,23 +11,18 @@ Local Modifications:
0000-build-config.patch: Local build configuration changes.
0001-build-config.patch: Enable HAVE_SEARCH_H in tiffconf.h for VS 2015
-0002-CVE-2015-8665-8683.patch: Security fixes
-0003-CVE-2015-8781-8782-8783.patch: Security fixes
-0004-CVE-2015-8784.patch: Security fixes
0005-Leak-TIFFFetchStripThing.patch: Fix a memory leak
0006-HeapBufferOverflow-ChopUpSingleUncompressedStrip.patch: Fix a heap buffer overflow
0007-uninitialized-value.patch: Fix potentially uninitialized dircount value
0008-HeapBufferOverflow-ChopUpSingleUncompressedStrip.patch: Fix a heap buffer overflow
-0009-HeapBufferOverflow-PixarLogDecode.patch: Fix a heap buffer overflow
0010-fix-leak-imagebegin: Fix a leak when TIFFRGBAImageBegin fails
0011-fix-leak-imagebegin2: Apply upstream fix related to our previous patch
0012-initialize-tif-rawdata.patch: Initialize tif_rawdata to guard against unitialized access
0013-validate-refblackwhite.patch: Make sure the refblackwhite values aren't nan.
0014-cast-to-unsigned-in-putagreytile.patch: casting to avoid undefined shifts.
0015-fix-leaks-in-tif_ojpeg.patch: fix direct leaks in tif_ojpeg.c methods
-0016-fix-leak-in-pixarlogsetupdecode.patch: Free sp->tbuf if setup fails
0017-safe_skews_in_gtTileContig.patch: return error if to/from skews overflow from int32.
0018-fix-leak-in-PredictorSetupDecode.patch: call tif->tif_cleanup if the setup fails.
-0019-fix-invalid-reads-TIFFFetchNormalTag.patch: upstream security fix in tif_dirread.
-0020-unreasonable-td-bitspersample.patch: upstream patch ignoring large td_bitspersample.
-0021-fix-leaks-ojpegreaderinfosectables.patch: more direct leak fixes in tif_ojpeg.c.
+0019-oom-TIFFReadDirEntryArray.patch: Try to avoid out-of-memory in tif_dirread.c.
+0020-upstream-security-fixes.patch: patch our copy with several upstream security fixes.
+0021-oom-TIFFFillStrip.patch: Try to avoid out-of-memory in tif_read.c
diff --git a/chromium/third_party/pdfium/third_party/libtiff/tif_aux.c b/chromium/third_party/pdfium/third_party/libtiff/tif_aux.c
index bc4ea019281..74532c8c6fb 100644
--- a/chromium/third_party/pdfium/third_party/libtiff/tif_aux.c
+++ b/chromium/third_party/pdfium/third_party/libtiff/tif_aux.c
@@ -1,4 +1,4 @@
-/* $Id: tif_aux.c,v 1.26 2010-07-01 15:33:28 dron Exp $ */
+/* $Id: tif_aux.c,v 1.29 2016-11-11 20:45:53 erouault Exp $ */
/*
* Copyright (c) 1991-1997 Sam Leffler
@@ -100,7 +100,8 @@ TIFFDefaultTransferFunction(TIFFDirectory* td)
n = ((tmsize_t)1)<<td->td_bitspersample;
nbytes = n * sizeof (uint16);
- if (!(tf[0] = (uint16 *)_TIFFmalloc(nbytes)))
+ tf[0] = (uint16 *)_TIFFmalloc(nbytes);
+ if (tf[0] == NULL)
return 0;
tf[0][0] = 0;
for (i = 1; i < n; i++) {
@@ -109,10 +110,12 @@ TIFFDefaultTransferFunction(TIFFDirectory* td)
}
if (td->td_samplesperpixel - td->td_extrasamples > 1) {
- if (!(tf[1] = (uint16 *)_TIFFmalloc(nbytes)))
+ tf[1] = (uint16 *)_TIFFmalloc(nbytes);
+ if(tf[1] == NULL)
goto bad;
_TIFFmemcpy(tf[1], tf[0], nbytes);
- if (!(tf[2] = (uint16 *)_TIFFmalloc(nbytes)))
+ tf[2] = (uint16 *)_TIFFmalloc(nbytes);
+ if (tf[2] == NULL)
goto bad;
_TIFFmemcpy(tf[2], tf[0], nbytes);
}
@@ -134,7 +137,8 @@ TIFFDefaultRefBlackWhite(TIFFDirectory* td)
{
int i;
- if (!(td->td_refblackwhite = (float *)_TIFFmalloc(6*sizeof (float))))
+ td->td_refblackwhite = (float *)_TIFFmalloc(6*sizeof (float));
+ if (td->td_refblackwhite == NULL)
return 0;
if (td->td_photometric == PHOTOMETRIC_YCBCR) {
/*
@@ -163,7 +167,7 @@ TIFFDefaultRefBlackWhite(TIFFDirectory* td)
* value if the tag is not present in the directory.
*
* NB: We use the value in the directory, rather than
- * explcit values so that defaults exist only one
+ * explicit values so that defaults exist only one
* place in the library -- in TIFFDefaultDirectory.
*/
int
@@ -208,11 +212,18 @@ TIFFVGetFieldDefaulted(TIFF* tif, uint32 tag, va_list ap)
*va_arg(ap, uint16 *) = td->td_resolutionunit;
return (1);
case TIFFTAG_PREDICTOR:
- {
- TIFFPredictorState* sp = (TIFFPredictorState*) tif->tif_data;
- *va_arg(ap, uint16*) = (uint16) sp->predictor;
- return 1;
- }
+ {
+ TIFFPredictorState* sp = (TIFFPredictorState*) tif->tif_data;
+ if( sp == NULL )
+ {
+ TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+ "Cannot get \"Predictor\" tag as plugin is not configured");
+ *va_arg(ap, uint16*) = 0;
+ return 0;
+ }
+ *va_arg(ap, uint16*) = (uint16) sp->predictor;
+ return 1;
+ }
case TIFFTAG_DOTRANGE:
*va_arg(ap, uint16 *) = 0;
*va_arg(ap, uint16 *) = (1<<td->td_bitspersample)-1;
diff --git a/chromium/third_party/pdfium/third_party/libtiff/tif_close.c b/chromium/third_party/pdfium/third_party/libtiff/tif_close.c
index 13d2bab5ce9..a0cb661311f 100644
--- a/chromium/third_party/pdfium/third_party/libtiff/tif_close.c
+++ b/chromium/third_party/pdfium/third_party/libtiff/tif_close.c
@@ -1,4 +1,4 @@
-/* $Id: tif_close.c,v 1.19 2010-03-10 18:56:48 bfriesen Exp $ */
+/* $Id: tif_close.c,v 1.21 2016-01-23 21:20:34 erouault Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@@ -36,7 +36,7 @@
/**
* Auxiliary function to free the TIFF structure. Given structure will be
- * completetly freed, so you should save opened file handle and pointer
+ * completely freed, so you should save opened file handle and pointer
* to the close procedure in external variables before calling
* _TIFFCleanup(), if you will need these ones to close the file.
*
@@ -62,11 +62,11 @@ TIFFCleanup(TIFF* tif)
*/
while( tif->tif_clientinfo )
{
- TIFFClientInfoLink *link = tif->tif_clientinfo;
+ TIFFClientInfoLink *psLink = tif->tif_clientinfo;
- tif->tif_clientinfo = link->next;
- _TIFFfree( link->name );
- _TIFFfree( link );
+ tif->tif_clientinfo = psLink->next;
+ _TIFFfree( psLink->name );
+ _TIFFfree( psLink );
}
if (tif->tif_rawdata && (tif->tif_flags&TIFF_MYBUFFER))
diff --git a/chromium/third_party/pdfium/third_party/libtiff/tif_color.c b/chromium/third_party/pdfium/third_party/libtiff/tif_color.c
index be4850ce6b1..89194c20760 100644
--- a/chromium/third_party/pdfium/third_party/libtiff/tif_color.c
+++ b/chromium/third_party/pdfium/third_party/libtiff/tif_color.c
@@ -1,4 +1,4 @@
-/* $Id: tif_color.c,v 1.19 2010-12-14 02:22:42 faxguy Exp $ */
+/* $Id: tif_color.c,v 1.22 2016-09-04 21:32:56 erouault Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@@ -126,37 +126,37 @@ TIFFCIELabToRGBInit(TIFFCIELabToRGB* cielab,
const TIFFDisplay *display, float *refWhite)
{
int i;
- double gamma;
+ double dfGamma;
cielab->range = CIELABTORGB_TABLE_RANGE;
_TIFFmemcpy(&cielab->display, display, sizeof(TIFFDisplay));
/* Red */
- gamma = 1.0 / cielab->display.d_gammaR ;
+ dfGamma = 1.0 / cielab->display.d_gammaR ;
cielab->rstep =
(cielab->display.d_YCR - cielab->display.d_Y0R) / cielab->range;
for(i = 0; i <= cielab->range; i++) {
cielab->Yr2r[i] = cielab->display.d_Vrwr
- * ((float)pow((double)i / cielab->range, gamma));
+ * ((float)pow((double)i / cielab->range, dfGamma));
}
/* Green */
- gamma = 1.0 / cielab->display.d_gammaG ;
+ dfGamma = 1.0 / cielab->display.d_gammaG ;
cielab->gstep =
(cielab->display.d_YCR - cielab->display.d_Y0R) / cielab->range;
for(i = 0; i <= cielab->range; i++) {
cielab->Yg2g[i] = cielab->display.d_Vrwg
- * ((float)pow((double)i / cielab->range, gamma));
+ * ((float)pow((double)i / cielab->range, dfGamma));
}
/* Blue */
- gamma = 1.0 / cielab->display.d_gammaB ;
+ dfGamma = 1.0 / cielab->display.d_gammaB ;
cielab->bstep =
(cielab->display.d_YCR - cielab->display.d_Y0R) / cielab->range;
for(i = 0; i <= cielab->range; i++) {
cielab->Yb2b[i] = cielab->display.d_Vrwb
- * ((float)pow((double)i / cielab->range, gamma));
+ * ((float)pow((double)i / cielab->range, dfGamma));
}
/* Init reference white point */
@@ -175,7 +175,7 @@ TIFFCIELabToRGBInit(TIFFCIELabToRGB* cielab,
#define SHIFT 16
#define FIX(x) ((int32)((x) * (1L<<SHIFT) + 0.5))
#define ONE_HALF ((int32)(1<<(SHIFT-1)))
-#define Code2V(c, RB, RW, CR) ((((c)-(int32)(RB))*(float)(CR))/(float)(((RW)-(RB)) ? ((RW)-(RB)) : 1))
+#define Code2V(c, RB, RW, CR) ((((c)-(int32)(RB))*(float)(CR))/(float)(((RW)-(RB)!=0) ? ((RW)-(RB)) : 1))
#define CLAMP(f,min,max) ((f)<(min)?(min):(f)>(max)?(max):(f))
#define HICLAMP(f,max) ((f)>(max)?(max):(f))
@@ -186,7 +186,9 @@ TIFFYCbCrtoRGB(TIFFYCbCrToRGB *ycbcr, uint32 Y, int32 Cb, int32 Cr,
int32 i;
/* XXX: Only 8-bit YCbCr input supported for now */
- Y = HICLAMP(Y, 255), Cb = CLAMP(Cb, 0, 255), Cr = CLAMP(Cr, 0, 255);
+ Y = HICLAMP(Y, 255);
+ Cb = CLAMP(Cb, 0, 255);
+ Cr = CLAMP(Cr, 0, 255);
i = ycbcr->Y_tab[Y] + ycbcr->Cr_r_tab[Cr];
*r = CLAMP(i, 0, 255);
diff --git a/chromium/third_party/pdfium/third_party/libtiff/tif_compress.c b/chromium/third_party/pdfium/third_party/libtiff/tif_compress.c
index 20e72fd0731..b571d19545f 100644
--- a/chromium/third_party/pdfium/third_party/libtiff/tif_compress.c
+++ b/chromium/third_party/pdfium/third_party/libtiff/tif_compress.c
@@ -1,4 +1,4 @@
-/* $Id: tif_compress.c,v 1.22 2010-03-10 18:56:48 bfriesen Exp $ */
+/* $Id: tif_compress.c,v 1.25 2016-10-25 20:04:22 erouault Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@@ -82,10 +82,10 @@ TIFFNoDecode(TIFF* tif, const char* method)
TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
"Compression scheme %u %s decoding is not implemented",
tif->tif_dir.td_compression, method);
- return (-1);
+ return (0);
}
-int
+static int
_TIFFNoFixupTags(TIFF* tif)
{
(void) tif;
@@ -227,7 +227,7 @@ TIFFUnRegisterCODEC(TIFFCodec* c)
codec_t* cd;
codec_t** pcd;
- for (pcd = &registeredCODECS; (cd = *pcd); pcd = &cd->next)
+ for (pcd = &registeredCODECS; (cd = *pcd) != NULL; pcd = &cd->next)
if (cd->info == c) {
*pcd = cd->next;
_TIFFfree(cd);
diff --git a/chromium/third_party/pdfium/third_party/libtiff/tif_dir.c b/chromium/third_party/pdfium/third_party/libtiff/tif_dir.c
index 16ce3d3cee1..81b849374ba 100644
--- a/chromium/third_party/pdfium/third_party/libtiff/tif_dir.c
+++ b/chromium/third_party/pdfium/third_party/libtiff/tif_dir.c
@@ -1,4 +1,4 @@
-/* $Id: tif_dir.c,v 1.121 2015-05-31 23:11:43 bfriesen Exp $ */
+/* $Id: tif_dir.c,v 1.127 2016-10-25 21:35:15 erouault Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@@ -43,8 +43,10 @@
static void
setByteArray(void** vpp, void* vp, size_t nmemb, size_t elem_size)
{
- if (*vpp)
- _TIFFfree(*vpp), *vpp = 0;
+ if (*vpp) {
+ _TIFFfree(*vpp);
+ *vpp = 0;
+ }
if (vp) {
tmsize_t bytes = (tmsize_t)(nmemb * elem_size);
if (elem_size && bytes / elem_size == nmemb)
@@ -57,13 +59,13 @@ void _TIFFsetByteArray(void** vpp, void* vp, uint32 n)
{ setByteArray(vpp, vp, n, 1); }
void _TIFFsetString(char** cpp, char* cp)
{ setByteArray((void**) cpp, (void*) cp, strlen(cp)+1, 1); }
-void _TIFFsetNString(char** cpp, char* cp, uint32 n)
+static void _TIFFsetNString(char** cpp, char* cp, uint32 n)
{ setByteArray((void**) cpp, (void*) cp, n, 1); }
void _TIFFsetShortArray(uint16** wpp, uint16* wp, uint32 n)
{ setByteArray((void**) wpp, (void*) wp, n, sizeof (uint16)); }
void _TIFFsetLongArray(uint32** lpp, uint32* lp, uint32 n)
{ setByteArray((void**) lpp, (void*) lp, n, sizeof (uint32)); }
-void _TIFFsetLong8Array(uint64** lpp, uint64* lp, uint32 n)
+static void _TIFFsetLong8Array(uint64** lpp, uint64* lp, uint32 n)
{ setByteArray((void**) lpp, (void*) lp, n, sizeof (uint64)); }
void _TIFFsetFloatArray(float** fpp, float* fp, uint32 n)
{ setByteArray((void**) fpp, (void*) fp, n, sizeof (float)); }
@@ -170,7 +172,7 @@ _TIFFVSetField(TIFF* tif, uint32 tag, va_list ap)
* We want to force the custom code to be used for custom
* fields even if the tag happens to match a well known
* one - important for reinterpreted handling of standard
- * tag values in custom directories (ie. EXIF)
+ * tag values in custom directories (i.e. EXIF)
*/
if (fip->field_bit == FIELD_CUSTOM) {
standard_tag = 0;
@@ -254,6 +256,28 @@ _TIFFVSetField(TIFF* tif, uint32 tag, va_list ap)
v = (uint16) va_arg(ap, uint16_vap);
if (v == 0)
goto badvalue;
+ if( v != td->td_samplesperpixel )
+ {
+ /* See http://bugzilla.maptools.org/show_bug.cgi?id=2500 */
+ if( td->td_sminsamplevalue != NULL )
+ {
+ TIFFWarningExt(tif->tif_clientdata,module,
+ "SamplesPerPixel tag value is changing, "
+ "but SMinSampleValue tag was read with a different value. Cancelling it");
+ TIFFClrFieldBit(tif,FIELD_SMINSAMPLEVALUE);
+ _TIFFfree(td->td_sminsamplevalue);
+ td->td_sminsamplevalue = NULL;
+ }
+ if( td->td_smaxsamplevalue != NULL )
+ {
+ TIFFWarningExt(tif->tif_clientdata,module,
+ "SamplesPerPixel tag value is changing, "
+ "but SMaxSampleValue tag was read with a different value. Cancelling it");
+ TIFFClrFieldBit(tif,FIELD_SMAXSAMPLEVALUE);
+ _TIFFfree(td->td_smaxsamplevalue);
+ td->td_smaxsamplevalue = NULL;
+ }
+ }
td->td_samplesperpixel = (uint16) v;
break;
case TIFFTAG_ROWSPERSTRIP:
@@ -402,7 +426,7 @@ _TIFFVSetField(TIFF* tif, uint32 tag, va_list ap)
if ((tif->tif_flags & TIFF_INSUBIFD) == 0) {
td->td_nsubifd = (uint16) va_arg(ap, uint16_vap);
_TIFFsetLong8Array(&td->td_subifd, (uint64*) va_arg(ap, uint64*),
- (long) td->td_nsubifd);
+ (uint32) td->td_nsubifd);
} else {
TIFFErrorExt(tif->tif_clientdata, module,
"%s: Sorry, cannot nest SubIFDs",
@@ -421,7 +445,7 @@ _TIFFVSetField(TIFF* tif, uint32 tag, va_list ap)
v = (td->td_samplesperpixel - td->td_extrasamples) > 1 ? 3 : 1;
for (i = 0; i < v; i++)
_TIFFsetShortArray(&td->td_transferfunction[i],
- va_arg(ap, uint16*), 1L<<td->td_bitspersample);
+ va_arg(ap, uint16*), 1U<<td->td_bitspersample);
break;
case TIFFTAG_REFERENCEBLACKWHITE:
/* XXX should check for null range */
@@ -587,10 +611,10 @@ _TIFFVSetField(TIFF* tif, uint32 tag, va_list ap)
handled this way ... likely best if we move it into
the directory structure with an explicit field in
libtiff 4.1 and assign it a FIELD_ value */
- uint16 v[2];
- v[0] = (uint16)va_arg(ap, int);
- v[1] = (uint16)va_arg(ap, int);
- _TIFFmemcpy(tv->value, &v, 4);
+ uint16 v2[2];
+ v2[0] = (uint16)va_arg(ap, int);
+ v2[1] = (uint16)va_arg(ap, int);
+ _TIFFmemcpy(tv->value, &v2, 4);
}
else if (fip->field_passcount
@@ -608,66 +632,66 @@ _TIFFVSetField(TIFF* tif, uint32 tag, va_list ap)
case TIFF_BYTE:
case TIFF_UNDEFINED:
{
- uint8 v = (uint8)va_arg(ap, int);
- _TIFFmemcpy(val, &v, tv_size);
+ uint8 v2 = (uint8)va_arg(ap, int);
+ _TIFFmemcpy(val, &v2, tv_size);
}
break;
case TIFF_SBYTE:
{
- int8 v = (int8)va_arg(ap, int);
- _TIFFmemcpy(val, &v, tv_size);
+ int8 v2 = (int8)va_arg(ap, int);
+ _TIFFmemcpy(val, &v2, tv_size);
}
break;
case TIFF_SHORT:
{
- uint16 v = (uint16)va_arg(ap, int);
- _TIFFmemcpy(val, &v, tv_size);
+ uint16 v2 = (uint16)va_arg(ap, int);
+ _TIFFmemcpy(val, &v2, tv_size);
}
break;
case TIFF_SSHORT:
{
- int16 v = (int16)va_arg(ap, int);
- _TIFFmemcpy(val, &v, tv_size);
+ int16 v2 = (int16)va_arg(ap, int);
+ _TIFFmemcpy(val, &v2, tv_size);
}
break;
case TIFF_LONG:
case TIFF_IFD:
{
- uint32 v = va_arg(ap, uint32);
- _TIFFmemcpy(val, &v, tv_size);
+ uint32 v2 = va_arg(ap, uint32);
+ _TIFFmemcpy(val, &v2, tv_size);
}
break;
case TIFF_SLONG:
{
- int32 v = va_arg(ap, int32);
- _TIFFmemcpy(val, &v, tv_size);
+ int32 v2 = va_arg(ap, int32);
+ _TIFFmemcpy(val, &v2, tv_size);
}
break;
case TIFF_LONG8:
case TIFF_IFD8:
{
- uint64 v = va_arg(ap, uint64);
- _TIFFmemcpy(val, &v, tv_size);
+ uint64 v2 = va_arg(ap, uint64);
+ _TIFFmemcpy(val, &v2, tv_size);
}
break;
case TIFF_SLONG8:
{
- int64 v = va_arg(ap, int64);
- _TIFFmemcpy(val, &v, tv_size);
+ int64 v2 = va_arg(ap, int64);
+ _TIFFmemcpy(val, &v2, tv_size);
}
break;
case TIFF_RATIONAL:
case TIFF_SRATIONAL:
case TIFF_FLOAT:
{
- float v = (float)va_arg(ap, double);
- _TIFFmemcpy(val, &v, tv_size);
+ float v2 = (float)va_arg(ap, double);
+ _TIFFmemcpy(val, &v2, tv_size);
}
break;
case TIFF_DOUBLE:
{
- double v = va_arg(ap, double);
- _TIFFmemcpy(val, &v, tv_size);
+ double v2 = va_arg(ap, double);
+ _TIFFmemcpy(val, &v2, tv_size);
}
break;
default:
@@ -680,9 +704,9 @@ _TIFFVSetField(TIFF* tif, uint32 tag, va_list ap)
}
}
if (status) {
- const TIFFField* fip=TIFFFieldWithTag(tif,tag);
- if (fip)
- TIFFSetFieldBit(tif, fip->field_bit);
+ const TIFFField* fip2=TIFFFieldWithTag(tif,tag);
+ if (fip2)
+ TIFFSetFieldBit(tif, fip2->field_bit);
tif->tif_flags |= TIFF_DIRTYDIRECT;
}
@@ -691,31 +715,31 @@ end:
return (status);
badvalue:
{
- const TIFFField* fip=TIFFFieldWithTag(tif,tag);
+ const TIFFField* fip2=TIFFFieldWithTag(tif,tag);
TIFFErrorExt(tif->tif_clientdata, module,
"%s: Bad value %u for \"%s\" tag",
tif->tif_name, v,
- fip ? fip->field_name : "Unknown");
+ fip2 ? fip2->field_name : "Unknown");
va_end(ap);
}
return (0);
badvalue32:
{
- const TIFFField* fip=TIFFFieldWithTag(tif,tag);
+ const TIFFField* fip2=TIFFFieldWithTag(tif,tag);
TIFFErrorExt(tif->tif_clientdata, module,
"%s: Bad value %u for \"%s\" tag",
tif->tif_name, v32,
- fip ? fip->field_name : "Unknown");
+ fip2 ? fip2->field_name : "Unknown");
va_end(ap);
}
return (0);
badvaluedouble:
{
- const TIFFField* fip=TIFFFieldWithTag(tif,tag);
+ const TIFFField* fip2=TIFFFieldWithTag(tif,tag);
TIFFErrorExt(tif->tif_clientdata, module,
"%s: Bad value %f for \"%s\" tag",
tif->tif_name, dblval,
- fip ? fip->field_name : "Unknown");
+ fip2 ? fip2->field_name : "Unknown");
va_end(ap);
}
return (0);
@@ -838,11 +862,37 @@ _TIFFVGetField(TIFF* tif, uint32 tag, va_list ap)
if( fip == NULL ) /* cannot happen since TIFFGetField() already checks it */
return 0;
+ if( tag == TIFFTAG_NUMBEROFINKS )
+ {
+ int i;
+ for (i = 0; i < td->td_customValueCount; i++) {
+ uint16 val;
+ TIFFTagValue *tv = td->td_customValues + i;
+ if (tv->info->field_tag != tag)
+ continue;
+ val = *(uint16 *)tv->value;
+ /* Truncate to SamplesPerPixel, since the */
+ /* setting code for INKNAMES assume that there are SamplesPerPixel */
+ /* inknames. */
+ /* Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2599 */
+ if( val > td->td_samplesperpixel )
+ {
+ TIFFWarningExt(tif->tif_clientdata,"_TIFFVGetField",
+ "Truncating NumberOfInks from %u to %u",
+ val, td->td_samplesperpixel);
+ val = td->td_samplesperpixel;
+ }
+ *va_arg(ap, uint16*) = val;
+ return 1;
+ }
+ return 0;
+ }
+
/*
* We want to force the custom code to be used for custom
* fields even if the tag happens to match a well known
* one - important for reinterpreted handling of standard
- * tag values in custom directories (ie. EXIF)
+ * tag values in custom directories (i.e. EXIF)
*/
if (fip->field_bit == FIELD_CUSTOM) {
standard_tag = 0;
@@ -893,7 +943,7 @@ _TIFFVGetField(TIFF* tif, uint32 tag, va_list ap)
*va_arg(ap, double**) = td->td_sminsamplevalue;
else
{
- /* libtiff historially treats this as a single value. */
+ /* libtiff historically treats this as a single value. */
uint16 i;
double v = td->td_sminsamplevalue[0];
for (i=1; i < td->td_samplesperpixel; ++i)
@@ -907,7 +957,7 @@ _TIFFVGetField(TIFF* tif, uint32 tag, va_list ap)
*va_arg(ap, double**) = td->td_smaxsamplevalue;
else
{
- /* libtiff historially treats this as a single value. */
+ /* libtiff historically treats this as a single value. */
uint16 i;
double v = td->td_smaxsamplevalue[0];
for (i=1; i < td->td_samplesperpixel; ++i)
diff --git a/chromium/third_party/pdfium/third_party/libtiff/tif_dirinfo.c b/chromium/third_party/pdfium/third_party/libtiff/tif_dirinfo.c
index 7db4bdb95c7..23ad0020559 100644
--- a/chromium/third_party/pdfium/third_party/libtiff/tif_dirinfo.c
+++ b/chromium/third_party/pdfium/third_party/libtiff/tif_dirinfo.c
@@ -1,4 +1,4 @@
-/* $Id: tif_dirinfo.c,v 1.121 2014-05-07 01:58:46 bfriesen Exp $ */
+/* $Id: tif_dirinfo.c,v 1.126 2016-11-18 02:52:13 bfriesen Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@@ -38,14 +38,22 @@
* NOTE: The second field (field_readcount) and third field (field_writecount)
* sometimes use the values TIFF_VARIABLE (-1), TIFF_VARIABLE2 (-3)
* and TIFF_SPP (-2). The macros should be used but would throw off
- * the formatting of the code, so please interprete the -1, -2 and -3
+ * the formatting of the code, so please interpret the -1, -2 and -3
* values accordingly.
*/
-static TIFFFieldArray tiffFieldArray;
-static TIFFFieldArray exifFieldArray;
-
-static TIFFField
+/* const object should be initialized */
+#ifdef _MSC_VER
+#pragma warning( push )
+#pragma warning( disable : 4132 )
+#endif
+static const TIFFFieldArray tiffFieldArray;
+static const TIFFFieldArray exifFieldArray;
+#ifdef _MSC_VER
+#pragma warning( pop )
+#endif
+
+static const TIFFField
tiffFields[] = {
{ TIFFTAG_SUBFILETYPE, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_SUBFILETYPE, 1, 0, "SubfileType", NULL },
{ TIFFTAG_OSUBFILETYPE, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UNDEFINED, TIFF_SETGET_UNDEFINED, FIELD_SUBFILETYPE, 1, 0, "OldSubfileType", NULL },
@@ -95,7 +103,7 @@ tiffFields[] = {
{ TIFFTAG_TILELENGTH, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_TILEDIMENSIONS, 0, 0, "TileLength", NULL },
{ TIFFTAG_TILEOFFSETS, -1, 1, TIFF_LONG8, 0, TIFF_SETGET_UNDEFINED, TIFF_SETGET_UNDEFINED, FIELD_STRIPOFFSETS, 0, 0, "TileOffsets", NULL },
{ TIFFTAG_TILEBYTECOUNTS, -1, 1, TIFF_LONG8, 0, TIFF_SETGET_UNDEFINED, TIFF_SETGET_UNDEFINED, FIELD_STRIPBYTECOUNTS, 0, 0, "TileByteCounts", NULL },
- { TIFFTAG_SUBIFD, -1, -1, TIFF_IFD8, 0, TIFF_SETGET_C16_IFD8, TIFF_SETGET_UNDEFINED, FIELD_SUBIFD, 1, 1, "SubIFD", &tiffFieldArray },
+ { TIFFTAG_SUBIFD, -1, -1, TIFF_IFD8, 0, TIFF_SETGET_C16_IFD8, TIFF_SETGET_UNDEFINED, FIELD_SUBIFD, 1, 1, "SubIFD", (TIFFFieldArray*) &tiffFieldArray },
{ TIFFTAG_INKSET, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "InkSet", NULL },
{ TIFFTAG_INKNAMES, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_C16_ASCII, TIFF_SETGET_UNDEFINED, FIELD_INKNAMES, 1, 1, "InkNames", NULL },
{ TIFFTAG_NUMBEROFINKS, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "NumberOfInks", NULL },
@@ -134,7 +142,7 @@ tiffFields[] = {
/* end Pixar tags */
{ TIFFTAG_RICHTIFFIPTC, -3, -3, TIFF_LONG, 0, TIFF_SETGET_C32_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 1, "RichTIFFIPTC", NULL },
{ TIFFTAG_PHOTOSHOP, -3, -3, TIFF_BYTE, 0, TIFF_SETGET_C32_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 1, "Photoshop", NULL },
- { TIFFTAG_EXIFIFD, 1, 1, TIFF_IFD8, 0, TIFF_SETGET_IFD8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "EXIFIFDOffset", &exifFieldArray },
+ { TIFFTAG_EXIFIFD, 1, 1, TIFF_IFD8, 0, TIFF_SETGET_IFD8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "EXIFIFDOffset", (TIFFFieldArray*) &exifFieldArray },
{ TIFFTAG_ICCPROFILE, -3, -3, TIFF_UNDEFINED, 0, TIFF_SETGET_C32_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 1, "ICC Profile", NULL },
{ TIFFTAG_GPSIFD, 1, 1, TIFF_IFD8, 0, TIFF_SETGET_IFD8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "GPSIFDOffset", NULL },
{ TIFFTAG_FAXRECVPARAMS, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UINT32, FIELD_CUSTOM, TRUE, FALSE, "FaxRecvParams", NULL },
@@ -211,7 +219,7 @@ tiffFields[] = {
/* begin pseudo tags */
};
-static TIFFField
+static const TIFFField
exifFields[] = {
{ EXIFTAG_EXPOSURETIME, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ExposureTime", NULL },
{ EXIFTAG_FNUMBER, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "FNumber", NULL },
@@ -271,13 +279,13 @@ exifFields[] = {
{ EXIFTAG_IMAGEUNIQUEID, 33, 33, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ImageUniqueID", NULL }
};
-static TIFFFieldArray
-tiffFieldArray = { tfiatImage, 0, TIFFArrayCount(tiffFields), tiffFields };
-static TIFFFieldArray
-exifFieldArray = { tfiatExif, 0, TIFFArrayCount(exifFields), exifFields };
+static const TIFFFieldArray
+tiffFieldArray = { tfiatImage, 0, TIFFArrayCount(tiffFields), (TIFFField*) tiffFields };
+static const TIFFFieldArray
+exifFieldArray = { tfiatExif, 0, TIFFArrayCount(exifFields), (TIFFField*) exifFields };
/*
- * We have our own local lfind() equivelent to avoid subtle differences
+ * We have our own local lfind() equivalent to avoid subtle differences
* in types passed to lfind() on different systems.
*/
@@ -521,7 +529,7 @@ TIFFFindField(TIFF* tif, uint32 tag, TIFFDataType dt)
return tif->tif_foundfield = (ret ? *ret : NULL);
}
-const TIFFField*
+static const TIFFField*
_TIFFFindFieldByName(TIFF* tif, const char *field_name, TIFFDataType dt)
{
TIFFField key = {0, 0, 0, TIFF_NOTYPE, 0, 0, 0, 0, 0, 0, NULL, NULL};
@@ -713,7 +721,7 @@ _TIFFCreateAnonField(TIFF *tif, uint32 tag, TIFFDataType field_type)
* note that this name is a special sign to TIFFClose() and
* _TIFFSetupFields() to free the field
*/
- snprintf(fld->field_name, 32, "Tag %d", (int) tag);
+ (void) snprintf(fld->field_name, 32, "Tag %d", (int) tag);
return fld;
}
diff --git a/chromium/third_party/pdfium/third_party/libtiff/tif_dirread.c b/chromium/third_party/pdfium/third_party/libtiff/tif_dirread.c
index e0403aef314..7dbcf6d86ec 100644
--- a/chromium/third_party/pdfium/third_party/libtiff/tif_dirread.c
+++ b/chromium/third_party/pdfium/third_party/libtiff/tif_dirread.c
@@ -1,4 +1,4 @@
-/* $Id: tif_dirread.c,v 1.191 2015-09-05 20:31:41 bfriesen Exp $ */
+/* $Id: tif_dirread.c,v 1.204 2016-11-16 15:14:15 erouault Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@@ -166,6 +166,8 @@ static int TIFFFetchSubjectDistance(TIFF*, TIFFDirEntry*);
static void ChopUpSingleUncompressedStrip(TIFF*);
static uint64 TIFFReadUInt64(const uint8 *value);
+static int _TIFFFillStrilesInternal( TIFF *tif, int loadStripByteCount );
+
typedef union _UInt64Aligned_t
{
double d;
@@ -788,44 +790,43 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryArray(TIFF* tif, TIFFDirEntry* d
*count=(uint32)direntry->tdir_count;
datasize=(*count)*typesize;
assert((tmsize_t)datasize>0);
- data=_TIFFCheckMalloc(tif, *count, typesize, "ReadDirEntryArray");
- if (data==0)
- return(TIFFReadDirEntryErrAlloc);
+ const uint32 small_alloc_threshold=(tif->tif_flags&TIFF_BIGTIFF)? 8 : 4;
+ if (datasize <= small_alloc_threshold)
+ {
+ data=_TIFFCheckMalloc(tif, *count, typesize, "ReadDirEntryArray");
+ if (data==0)
+ return(TIFFReadDirEntryErrAlloc);
+ _TIFFmemcpy(data,&direntry->tdir_offset,datasize);
+ *value=data;
+ return(TIFFReadDirEntryErrOk);
+ }
+ uint64 offset;
if (!(tif->tif_flags&TIFF_BIGTIFF))
{
- if (datasize<=4)
- _TIFFmemcpy(data,&direntry->tdir_offset,datasize);
- else
- {
- enum TIFFReadDirEntryErr err;
- uint32 offset = direntry->tdir_offset.toff_long;
- if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabLong(&offset);
- err=TIFFReadDirEntryData(tif,(uint64)offset,(tmsize_t)datasize,data);
- if (err!=TIFFReadDirEntryErrOk)
- {
- _TIFFfree(data);
- return(err);
- }
- }
+ uint32 small_offset=direntry->tdir_offset.toff_long;
+ if (tif->tif_flags&TIFF_SWAB)
+ TIFFSwabLong(&small_offset);
+ offset=(uint64)small_offset;
}
else
{
- if (datasize<=8)
- _TIFFmemcpy(data,&direntry->tdir_offset,datasize);
- else
- {
- enum TIFFReadDirEntryErr err;
- uint64 offset = direntry->tdir_offset.toff_long8;
- if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabLong8(&offset);
- err=TIFFReadDirEntryData(tif,offset,(tmsize_t)datasize,data);
- if (err!=TIFFReadDirEntryErrOk)
- {
- _TIFFfree(data);
- return(err);
- }
- }
+ offset = direntry->tdir_offset.toff_long8;
+ if (tif->tif_flags&TIFF_SWAB)
+ TIFFSwabLong8(&offset);
+ }
+ if ((uint64)(-1) - offset < datasize)
+ return(TIFFReadDirEntryErrIo);
+ const uint64 size=isMapped(tif)? (uint64)tif->tif_size : TIFFGetFileSize(tif);
+ if (offset + datasize > size)
+ return(TIFFReadDirEntryErrIo);
+ data=_TIFFCheckMalloc(tif, *count, typesize, "ReadDirEntryArray");
+ if (data==0)
+ return(TIFFReadDirEntryErrAlloc);
+ enum TIFFReadDirEntryErr err=TIFFReadDirEntryData(tif,offset,(tmsize_t)datasize,data);
+ if (err!=TIFFReadDirEntryErrOk)
+ {
+ _TIFFfree(data);
+ return(err);
}
*value=data;
return(TIFFReadDirEntryErrOk);
@@ -3457,12 +3458,12 @@ TIFFReadDirectory(TIFF* tif)
* the fields to check type and tag information,
* and to extract info required to size data
* structures. A second pass is made afterwards
- * to read in everthing not taken in the first pass.
+ * to read in everything not taken in the first pass.
* But we must process the Compression tag first
* in order to merge in codec-private tag definitions (otherwise
* we may get complaints about unknown tags). However, the
* Compression tag may be dependent on the SamplesPerPixel
- * tag value because older TIFF specs permited Compression
+ * tag value because older TIFF specs permitted Compression
* to be written as a SamplesPerPixel-count tag entry.
* Thus if we don't first figure out the correct SamplesPerPixel
* tag value then we may end up ignoring the Compression tag
@@ -3626,6 +3627,7 @@ TIFFReadDirectory(TIFF* tif)
if (tif->tif_dir.td_planarconfig == PLANARCONFIG_SEPARATE)
tif->tif_dir.td_stripsperimage /= tif->tif_dir.td_samplesperpixel;
if (!TIFFFieldSet(tif, FIELD_STRIPOFFSETS)) {
+#ifdef OJPEG_SUPPORT
if ((tif->tif_dir.td_compression==COMPRESSION_OJPEG) &&
(isTiled(tif)==0) &&
(tif->tif_dir.td_nstrips==1)) {
@@ -3638,7 +3640,9 @@ TIFFReadDirectory(TIFF* tif)
* JpegInterchangeFormat stream.
*/
TIFFSetFieldBit(tif, FIELD_STRIPOFFSETS);
- } else {
+ } else
+#endif
+ {
MissingRequired(tif,
isTiled(tif) ? "TileOffsets" : "StripOffsets");
goto bad;
@@ -3663,7 +3667,7 @@ TIFFReadDirectory(TIFF* tif)
* DataType and SampleFormat tags are supposed to be
* written as one value/sample, but some vendors
* incorrectly write one value only -- so we accept
- * that as well (yech). Other vendors write correct
+ * that as well (yuck). Other vendors write correct
* value for NumberOfSamples, but incorrect one for
* BitsPerSample and friends, and we will read this
* too.
@@ -3690,7 +3694,7 @@ TIFFReadDirectory(TIFF* tif)
case TIFFTAG_SMAXSAMPLEVALUE:
{
- double *data;
+ double *data = NULL;
enum TIFFReadDirEntryErr err;
uint32 saved_flags;
int m;
@@ -3741,7 +3745,7 @@ TIFFReadDirectory(TIFF* tif)
uint32 countrequired;
uint32 incrementpersample;
uint16* value=NULL;
- /* It would be dangerous to instanciate those tag values */
+ /* It would be dangerous to instantiate those tag values */
/* since if td_bitspersample has not yet been read (due to */
/* unordered tags), it could be read afterwards with a */
/* values greater than the default one (1), which may cause */
@@ -3759,13 +3763,14 @@ TIFFReadDirectory(TIFF* tif)
/* used as a denial of service vector */
if (tif->tif_dir.td_bitspersample > 24)
{
+ fip = TIFFFieldWithTag(tif,dp->tdir_tag);
TIFFWarningExt(tif->tif_clientdata,module,
"Ignoring %s because BitsPerSample=%d>24",
fip ? fip->field_name : "unknown tagname",
tif->tif_dir.td_bitspersample);
continue;
}
- countpersample=(1L<<tif->tif_dir.td_bitspersample);
+ countpersample=(1U<<tif->tif_dir.td_bitspersample);
if ((dp->tdir_tag==TIFFTAG_TRANSFERFUNCTION)&&(dp->tdir_count==(uint64)countpersample))
{
countrequired=countpersample;
@@ -4153,7 +4158,7 @@ TIFFReadDirectoryFindFieldInfo(TIFF* tif, uint16 tagid, uint32* fii)
}
/*
- * Read custom directory from the arbitarry offset.
+ * Read custom directory from the arbitrary offset.
* The code is very similar to TIFFReadDirectory().
*/
int
@@ -4280,8 +4285,9 @@ EstimateStripByteCounts(TIFF* tif, TIFFDirEntry* dir, uint16 dircount)
TIFFDirectory *td = &tif->tif_dir;
uint32 strip;
- if( !_TIFFFillStriles( tif ) )
- return -1;
+ /* Do not try to load stripbytecount as we will compute it */
+ if( !_TIFFFillStrilesInternal( tif, 0 ) )
+ return -1;
if (td->td_stripbytecount)
_TIFFfree(td->td_stripbytecount);
@@ -4303,7 +4309,7 @@ EstimateStripByteCounts(TIFF* tif, TIFFDirEntry* dir, uint16 dircount)
/* calculate amount of space used by indirect values */
for (dp = dir, n = dircount; n > 0; n--, dp++)
{
- uint32 typewidth = TIFFDataWidth((TIFFDataType) dp->tdir_type);
+ uint32 typewidth;
uint64 datasize;
typewidth = TIFFDataWidth((TIFFDataType) dp->tdir_type);
if (typewidth == 0) {
@@ -4393,7 +4399,7 @@ TIFFCheckDirOffset(TIFF* tif, uint64 diroff)
tif->tif_dirnumber++;
- if (tif->tif_dirnumber > tif->tif_dirlistsize) {
+ if (tif->tif_dirlist == NULL || tif->tif_dirnumber > tif->tif_dirlistsize) {
uint64* new_dirlist;
/*
@@ -4583,7 +4589,6 @@ TIFFFetchDirectory(TIFF* tif, uint64 diroff, TIFFDirEntry** pdir,
}
else
{
- tmsize_t m;
uint64 dircount64;
m=off+sizeof(uint64);
if ((m<off)||(m<(tmsize_t)sizeof(uint64))||(m>tif->tif_size)) {
@@ -4994,7 +4999,7 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover)
if (err==TIFFReadDirEntryErrOk)
{
int m;
- if( dp->tdir_count > 0 && data[dp->tdir_count-1] != '\0' )
+ if( dp->tdir_count > 0 && data[dp->tdir_count-1] != '\0' )
{
TIFFWarningExt(tif->tif_clientdata,module,"ASCII value for tag \"%s\" does not end in null byte. Forcing it to be null",fip->field_name);
data[dp->tdir_count-1] = '\0';
@@ -5171,7 +5176,7 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover)
if (err==TIFFReadDirEntryErrOk)
{
int m;
- if( dp->tdir_count > 0 && data[dp->tdir_count-1] != '\0' )
+ if( dp->tdir_count > 0 && data[dp->tdir_count-1] != '\0' )
{
TIFFWarningExt(tif->tif_clientdata,module,"ASCII value for tag \"%s\" does not end in null byte. Forcing it to be null",fip->field_name);
data[dp->tdir_count-1] = '\0';
@@ -5498,8 +5503,7 @@ ChopUpSingleUncompressedStrip(TIFF* tif)
uint64 rowblockbytes;
uint64 stripbytes;
uint32 strip;
- uint64 nstrips64;
- uint32 nstrips32;
+ uint32 nstrips;
uint32 rowsperstrip;
uint64* newcounts;
uint64* newoffsets;
@@ -5530,18 +5534,17 @@ ChopUpSingleUncompressedStrip(TIFF* tif)
return;
/*
- * never increase the number of strips in an image
+ * never increase the number of rows per strip
*/
if (rowsperstrip >= td->td_rowsperstrip)
return;
- nstrips64 = TIFFhowmany_64(bytecount, stripbytes);
- if ((nstrips64==0)||(nstrips64>0xFFFFFFFF)) /* something is wonky, do nothing. */
- return;
- nstrips32 = (uint32)nstrips64;
+ nstrips = TIFFhowmany_32(td->td_imagelength, rowsperstrip);
+ if( nstrips == 0 )
+ return;
- newcounts = (uint64*) _TIFFCheckMalloc(tif, nstrips32, sizeof (uint64),
+ newcounts = (uint64*) _TIFFCheckMalloc(tif, nstrips, sizeof (uint64),
"for chopped \"StripByteCounts\" array");
- newoffsets = (uint64*) _TIFFCheckMalloc(tif, nstrips32, sizeof (uint64),
+ newoffsets = (uint64*) _TIFFCheckMalloc(tif, nstrips, sizeof (uint64),
"for chopped \"StripOffsets\" array");
if (newcounts == NULL || newoffsets == NULL) {
/*
@@ -5558,18 +5561,18 @@ ChopUpSingleUncompressedStrip(TIFF* tif)
* Fill the strip information arrays with new bytecounts and offsets
* that reflect the broken-up format.
*/
- for (strip = 0; strip < nstrips32; strip++) {
+ for (strip = 0; strip < nstrips; strip++) {
if (stripbytes > bytecount)
stripbytes = bytecount;
newcounts[strip] = stripbytes;
- newoffsets[strip] = offset;
+ newoffsets[strip] = stripbytes ? offset : 0;
offset += stripbytes;
bytecount -= stripbytes;
}
/*
* Replace old single strip info with multi-strip info.
*/
- td->td_stripsperimage = td->td_nstrips = nstrips32;
+ td->td_stripsperimage = td->td_nstrips = nstrips;
TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, rowsperstrip);
_TIFFfree(td->td_stripbytecount);
@@ -5581,6 +5584,11 @@ ChopUpSingleUncompressedStrip(TIFF* tif)
int _TIFFFillStriles( TIFF *tif )
{
+ return _TIFFFillStrilesInternal( tif, 1 );
+}
+
+static int _TIFFFillStrilesInternal( TIFF *tif, int loadStripByteCount )
+{
#if defined(DEFER_STRILE_LOAD)
register TIFFDirectory *td = &tif->tif_dir;
int return_value = 1;
@@ -5597,7 +5605,8 @@ int _TIFFFillStriles( TIFF *tif )
return_value = 0;
}
- if (!TIFFFetchStripThing(tif,&(td->td_stripbytecount_entry),
+ if (loadStripByteCount &&
+ !TIFFFetchStripThing(tif,&(td->td_stripbytecount_entry),
td->td_nstrips,&td->td_stripbytecount))
{
return_value = 0;
@@ -5622,6 +5631,7 @@ int _TIFFFillStriles( TIFF *tif )
return return_value;
#else /* !defined(DEFER_STRILE_LOAD) */
(void) tif;
+ (void) loadStripByteCount;
return 1;
#endif
}
diff --git a/chromium/third_party/pdfium/third_party/libtiff/tif_dirwrite.c b/chromium/third_party/pdfium/third_party/libtiff/tif_dirwrite.c
index a0fd8dc2f62..d34f6f611d3 100644
--- a/chromium/third_party/pdfium/third_party/libtiff/tif_dirwrite.c
+++ b/chromium/third_party/pdfium/third_party/libtiff/tif_dirwrite.c
@@ -1,4 +1,4 @@
-/* $Id: tif_dirwrite.c,v 1.78 2015-05-31 00:38:46 bfriesen Exp $ */
+/* $Id: tif_dirwrite.c,v 1.83 2016-10-25 21:35:15 erouault Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@@ -542,8 +542,20 @@ TIFFWriteDirectorySec(TIFF* tif, int isimage, int imagedone, uint64* pdiroff)
{
if (!isTiled(tif))
{
- if (!TIFFWriteDirectoryTagLongLong8Array(tif,&ndir,dir,TIFFTAG_STRIPOFFSETS,tif->tif_dir.td_nstrips,tif->tif_dir.td_stripoffset))
- goto bad;
+ /* td_stripoffset might be NULL in an odd OJPEG case. See
+ * tif_dirread.c around line 3634.
+ * XXX: OJPEG hack.
+ * If a) compression is OJPEG, b) it's not a tiled TIFF,
+ * and c) the number of strips is 1,
+ * then we tolerate the absence of stripoffsets tag,
+ * because, presumably, all required data is in the
+ * JpegInterchangeFormat stream.
+ * We can get here when using tiffset on such a file.
+ * See http://bugzilla.maptools.org/show_bug.cgi?id=2500
+ */
+ if (tif->tif_dir.td_stripoffset != NULL &&
+ !TIFFWriteDirectoryTagLongLong8Array(tif,&ndir,dir,TIFFTAG_STRIPOFFSETS,tif->tif_dir.td_nstrips,tif->tif_dir.td_stripoffset))
+ goto bad;
}
else
{
@@ -645,7 +657,7 @@ TIFFWriteDirectorySec(TIFF* tif, int isimage, int imagedone, uint64* pdiroff)
assert(o->field_passcount==0);
TIFFGetField(tif,o->field_tag,&pb);
pa=(uint32)(strlen(pb));
- if (!TIFFWriteDirectoryTagAscii(tif,&ndir,dir,o->field_tag,pa,pb))
+ if (!TIFFWriteDirectoryTagAscii(tif,&ndir,dir,(uint16)o->field_tag,pa,pb))
goto bad;
}
break;
@@ -656,7 +668,7 @@ TIFFWriteDirectorySec(TIFF* tif, int isimage, int imagedone, uint64* pdiroff)
assert(o->field_readcount==1);
assert(o->field_passcount==0);
TIFFGetField(tif,o->field_tag,&p);
- if (!TIFFWriteDirectoryTagShort(tif,&ndir,dir,o->field_tag,p))
+ if (!TIFFWriteDirectoryTagShort(tif,&ndir,dir,(uint16)o->field_tag,p))
goto bad;
}
break;
@@ -667,7 +679,7 @@ TIFFWriteDirectorySec(TIFF* tif, int isimage, int imagedone, uint64* pdiroff)
assert(o->field_readcount==1);
assert(o->field_passcount==0);
TIFFGetField(tif,o->field_tag,&p);
- if (!TIFFWriteDirectoryTagLong(tif,&ndir,dir,o->field_tag,p))
+ if (!TIFFWriteDirectoryTagLong(tif,&ndir,dir,(uint16)o->field_tag,p))
goto bad;
}
break;
@@ -679,7 +691,7 @@ TIFFWriteDirectorySec(TIFF* tif, int isimage, int imagedone, uint64* pdiroff)
assert(o->field_readcount==TIFF_VARIABLE2);
assert(o->field_passcount==1);
TIFFGetField(tif,o->field_tag,&pa,&pb);
- if (!TIFFWriteDirectoryTagUndefinedArray(tif,&ndir,dir,o->field_tag,pa,pb))
+ if (!TIFFWriteDirectoryTagUndefinedArray(tif,&ndir,dir,(uint16)o->field_tag,pa,pb))
goto bad;
}
break;
@@ -693,70 +705,72 @@ TIFFWriteDirectorySec(TIFF* tif, int isimage, int imagedone, uint64* pdiroff)
}
for (m=0; m<(uint32)(tif->tif_dir.td_customValueCount); m++)
{
+ uint16 tag = (uint16)tif->tif_dir.td_customValues[m].info->field_tag;
+ uint32 count = tif->tif_dir.td_customValues[m].count;
switch (tif->tif_dir.td_customValues[m].info->field_type)
{
case TIFF_ASCII:
- if (!TIFFWriteDirectoryTagAscii(tif,&ndir,dir,tif->tif_dir.td_customValues[m].info->field_tag,tif->tif_dir.td_customValues[m].count,tif->tif_dir.td_customValues[m].value))
+ if (!TIFFWriteDirectoryTagAscii(tif,&ndir,dir,tag,count,tif->tif_dir.td_customValues[m].value))
goto bad;
break;
case TIFF_UNDEFINED:
- if (!TIFFWriteDirectoryTagUndefinedArray(tif,&ndir,dir,tif->tif_dir.td_customValues[m].info->field_tag,tif->tif_dir.td_customValues[m].count,tif->tif_dir.td_customValues[m].value))
+ if (!TIFFWriteDirectoryTagUndefinedArray(tif,&ndir,dir,tag,count,tif->tif_dir.td_customValues[m].value))
goto bad;
break;
case TIFF_BYTE:
- if (!TIFFWriteDirectoryTagByteArray(tif,&ndir,dir,tif->tif_dir.td_customValues[m].info->field_tag,tif->tif_dir.td_customValues[m].count,tif->tif_dir.td_customValues[m].value))
+ if (!TIFFWriteDirectoryTagByteArray(tif,&ndir,dir,tag,count,tif->tif_dir.td_customValues[m].value))
goto bad;
break;
case TIFF_SBYTE:
- if (!TIFFWriteDirectoryTagSbyteArray(tif,&ndir,dir,tif->tif_dir.td_customValues[m].info->field_tag,tif->tif_dir.td_customValues[m].count,tif->tif_dir.td_customValues[m].value))
+ if (!TIFFWriteDirectoryTagSbyteArray(tif,&ndir,dir,tag,count,tif->tif_dir.td_customValues[m].value))
goto bad;
break;
case TIFF_SHORT:
- if (!TIFFWriteDirectoryTagShortArray(tif,&ndir,dir,tif->tif_dir.td_customValues[m].info->field_tag,tif->tif_dir.td_customValues[m].count,tif->tif_dir.td_customValues[m].value))
+ if (!TIFFWriteDirectoryTagShortArray(tif,&ndir,dir,tag,count,tif->tif_dir.td_customValues[m].value))
goto bad;
break;
case TIFF_SSHORT:
- if (!TIFFWriteDirectoryTagSshortArray(tif,&ndir,dir,tif->tif_dir.td_customValues[m].info->field_tag,tif->tif_dir.td_customValues[m].count,tif->tif_dir.td_customValues[m].value))
+ if (!TIFFWriteDirectoryTagSshortArray(tif,&ndir,dir,tag,count,tif->tif_dir.td_customValues[m].value))
goto bad;
break;
case TIFF_LONG:
- if (!TIFFWriteDirectoryTagLongArray(tif,&ndir,dir,tif->tif_dir.td_customValues[m].info->field_tag,tif->tif_dir.td_customValues[m].count,tif->tif_dir.td_customValues[m].value))
+ if (!TIFFWriteDirectoryTagLongArray(tif,&ndir,dir,tag,count,tif->tif_dir.td_customValues[m].value))
goto bad;
break;
case TIFF_SLONG:
- if (!TIFFWriteDirectoryTagSlongArray(tif,&ndir,dir,tif->tif_dir.td_customValues[m].info->field_tag,tif->tif_dir.td_customValues[m].count,tif->tif_dir.td_customValues[m].value))
+ if (!TIFFWriteDirectoryTagSlongArray(tif,&ndir,dir,tag,count,tif->tif_dir.td_customValues[m].value))
goto bad;
break;
case TIFF_LONG8:
- if (!TIFFWriteDirectoryTagLong8Array(tif,&ndir,dir,tif->tif_dir.td_customValues[m].info->field_tag,tif->tif_dir.td_customValues[m].count,tif->tif_dir.td_customValues[m].value))
+ if (!TIFFWriteDirectoryTagLong8Array(tif,&ndir,dir,tag,count,tif->tif_dir.td_customValues[m].value))
goto bad;
break;
case TIFF_SLONG8:
- if (!TIFFWriteDirectoryTagSlong8Array(tif,&ndir,dir,tif->tif_dir.td_customValues[m].info->field_tag,tif->tif_dir.td_customValues[m].count,tif->tif_dir.td_customValues[m].value))
+ if (!TIFFWriteDirectoryTagSlong8Array(tif,&ndir,dir,tag,count,tif->tif_dir.td_customValues[m].value))
goto bad;
break;
case TIFF_RATIONAL:
- if (!TIFFWriteDirectoryTagRationalArray(tif,&ndir,dir,tif->tif_dir.td_customValues[m].info->field_tag,tif->tif_dir.td_customValues[m].count,tif->tif_dir.td_customValues[m].value))
+ if (!TIFFWriteDirectoryTagRationalArray(tif,&ndir,dir,tag,count,tif->tif_dir.td_customValues[m].value))
goto bad;
break;
case TIFF_SRATIONAL:
- if (!TIFFWriteDirectoryTagSrationalArray(tif,&ndir,dir,tif->tif_dir.td_customValues[m].info->field_tag,tif->tif_dir.td_customValues[m].count,tif->tif_dir.td_customValues[m].value))
+ if (!TIFFWriteDirectoryTagSrationalArray(tif,&ndir,dir,tag,count,tif->tif_dir.td_customValues[m].value))
goto bad;
break;
case TIFF_FLOAT:
- if (!TIFFWriteDirectoryTagFloatArray(tif,&ndir,dir,tif->tif_dir.td_customValues[m].info->field_tag,tif->tif_dir.td_customValues[m].count,tif->tif_dir.td_customValues[m].value))
+ if (!TIFFWriteDirectoryTagFloatArray(tif,&ndir,dir,tag,count,tif->tif_dir.td_customValues[m].value))
goto bad;
break;
case TIFF_DOUBLE:
- if (!TIFFWriteDirectoryTagDoubleArray(tif,&ndir,dir,tif->tif_dir.td_customValues[m].info->field_tag,tif->tif_dir.td_customValues[m].count,tif->tif_dir.td_customValues[m].value))
+ if (!TIFFWriteDirectoryTagDoubleArray(tif,&ndir,dir,tag,count,tif->tif_dir.td_customValues[m].value))
goto bad;
break;
case TIFF_IFD:
- if (!TIFFWriteDirectoryTagIfdArray(tif,&ndir,dir,tif->tif_dir.td_customValues[m].info->field_tag,tif->tif_dir.td_customValues[m].count,tif->tif_dir.td_customValues[m].value))
+ if (!TIFFWriteDirectoryTagIfdArray(tif,&ndir,dir,tag,count,tif->tif_dir.td_customValues[m].value))
goto bad;
break;
case TIFF_IFD8:
- if (!TIFFWriteDirectoryTagIfdIfd8Array(tif,&ndir,dir,tif->tif_dir.td_customValues[m].info->field_tag,tif->tif_dir.td_customValues[m].count,tif->tif_dir.td_customValues[m].value))
+ if (!TIFFWriteDirectoryTagIfdIfd8Array(tif,&ndir,dir,tag,count,tif->tif_dir.td_customValues[m].value))
goto bad;
break;
default:
@@ -778,7 +792,7 @@ TIFFWriteDirectorySec(TIFF* tif, int isimage, int imagedone, uint64* pdiroff)
goto bad;
}
else
- tif->tif_diroff=(TIFFSeekFile(tif,0,SEEK_END)+1)&(~1);
+ tif->tif_diroff=(TIFFSeekFile(tif,0,SEEK_END)+1)&(~((toff_t)1));
if (pdiroff!=NULL)
*pdiroff=tif->tif_diroff;
if (!(tif->tif_flags&TIFF_BIGTIFF))
@@ -828,7 +842,7 @@ TIFFWriteDirectorySec(TIFF* tif, int isimage, int imagedone, uint64* pdiroff)
uint32 nTmp;
TIFFDirEntry* o;
n=dirmem;
- *(uint16*)n=ndir;
+ *(uint16*)n=(uint16)ndir;
if (tif->tif_flags&TIFF_SWAB)
TIFFSwabShort((uint16*)n);
n+=2;
@@ -2141,13 +2155,13 @@ TIFFWriteDirectoryTagCheckedRationalArray(TIFF* tif, uint32* ndir, TIFFDirEntry*
}
else if (*na<1.0)
{
- nb[0]=(uint32)((*na)*0xFFFFFFFF);
+ nb[0]=(uint32)((double)(*na)*0xFFFFFFFF);
nb[1]=0xFFFFFFFF;
}
else
{
nb[0]=0xFFFFFFFF;
- nb[1]=(uint32)(0xFFFFFFFF/(*na));
+ nb[1]=(uint32)((double)0xFFFFFFFF/(*na));
}
}
if (tif->tif_flags&TIFF_SWAB)
@@ -2184,13 +2198,13 @@ TIFFWriteDirectoryTagCheckedSrationalArray(TIFF* tif, uint32* ndir, TIFFDirEntry
}
else if (*na>-1.0)
{
- nb[0]=-(int32)((-*na)*0x7FFFFFFF);
+ nb[0]=-(int32)((double)(-*na)*0x7FFFFFFF);
nb[1]=0x7FFFFFFF;
}
else
{
nb[0]=-0x7FFFFFFF;
- nb[1]=(int32)(0x7FFFFFFF/(-*na));
+ nb[1]=(int32)((double)0x7FFFFFFF/(-*na));
}
}
else
@@ -2202,13 +2216,13 @@ TIFFWriteDirectoryTagCheckedSrationalArray(TIFF* tif, uint32* ndir, TIFFDirEntry
}
else if (*na<1.0)
{
- nb[0]=(int32)((*na)*0x7FFFFFFF);
+ nb[0]=(int32)((double)(*na)*0x7FFFFFFF);
nb[1]=0x7FFFFFFF;
}
else
{
nb[0]=0x7FFFFFFF;
- nb[1]=(int32)(0x7FFFFFFF/(*na));
+ nb[1]=(int32)((double)0x7FFFFFFF/(*na));
}
}
}
@@ -2368,7 +2382,7 @@ TIFFLinkDirectory(TIFF* tif)
{
static const char module[] = "TIFFLinkDirectory";
- tif->tif_diroff = (TIFFSeekFile(tif,0,SEEK_END)+1) &~ 1;
+ tif->tif_diroff = (TIFFSeekFile(tif,0,SEEK_END)+1) & (~((toff_t)1));
/*
* Handle SubIFDs
diff --git a/chromium/third_party/pdfium/third_party/libtiff/tif_dumpmode.c b/chromium/third_party/pdfium/third_party/libtiff/tif_dumpmode.c
index a94cf0b34a9..a6a94c04d56 100644
--- a/chromium/third_party/pdfium/third_party/libtiff/tif_dumpmode.c
+++ b/chromium/third_party/pdfium/third_party/libtiff/tif_dumpmode.c
@@ -1,4 +1,4 @@
-/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_dumpmode.c,v 1.14 2011-04-02 20:54:09 bfriesen Exp $ */
+/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_dumpmode.c,v 1.15 2015-12-12 18:04:26 erouault Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@@ -66,7 +66,7 @@ DumpModeEncode(TIFF* tif, uint8* pp, tmsize_t cc, uint16 s)
cc -= n;
if (tif->tif_rawcc >= tif->tif_rawdatasize &&
!TIFFFlushData1(tif))
- return (-1);
+ return (0);
}
return (1);
}
diff --git a/chromium/third_party/pdfium/third_party/libtiff/tif_extension.c b/chromium/third_party/pdfium/third_party/libtiff/tif_extension.c
index 10afd4162c1..39fab4c7ba8 100644
--- a/chromium/third_party/pdfium/third_party/libtiff/tif_extension.c
+++ b/chromium/third_party/pdfium/third_party/libtiff/tif_extension.c
@@ -1,4 +1,4 @@
-/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_extension.c,v 1.7 2010-03-10 18:56:48 bfriesen Exp $ */
+/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_extension.c,v 1.8 2015-12-06 11:13:43 erouault Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@@ -66,13 +66,13 @@ TIFFTagMethods *TIFFAccessTagMethods( TIFF *tif )
void *TIFFGetClientInfo( TIFF *tif, const char *name )
{
- TIFFClientInfoLink *link = tif->tif_clientinfo;
+ TIFFClientInfoLink *psLink = tif->tif_clientinfo;
- while( link != NULL && strcmp(link->name,name) != 0 )
- link = link->next;
+ while( psLink != NULL && strcmp(psLink->name,name) != 0 )
+ psLink = psLink->next;
- if( link != NULL )
- return link->data;
+ if( psLink != NULL )
+ return psLink->data;
else
return NULL;
}
@@ -80,18 +80,18 @@ void *TIFFGetClientInfo( TIFF *tif, const char *name )
void TIFFSetClientInfo( TIFF *tif, void *data, const char *name )
{
- TIFFClientInfoLink *link = tif->tif_clientinfo;
+ TIFFClientInfoLink *psLink = tif->tif_clientinfo;
/*
** Do we have an existing link with this name? If so, just
** set it.
*/
- while( link != NULL && strcmp(link->name,name) != 0 )
- link = link->next;
+ while( psLink != NULL && strcmp(psLink->name,name) != 0 )
+ psLink = psLink->next;
- if( link != NULL )
+ if( psLink != NULL )
{
- link->data = data;
+ psLink->data = data;
return;
}
@@ -99,15 +99,15 @@ void TIFFSetClientInfo( TIFF *tif, void *data, const char *name )
** Create a new link.
*/
- link = (TIFFClientInfoLink *) _TIFFmalloc(sizeof(TIFFClientInfoLink));
- assert (link != NULL);
- link->next = tif->tif_clientinfo;
- link->name = (char *) _TIFFmalloc((tmsize_t)(strlen(name)+1));
- assert (link->name != NULL);
- strcpy(link->name, name);
- link->data = data;
+ psLink = (TIFFClientInfoLink *) _TIFFmalloc(sizeof(TIFFClientInfoLink));
+ assert (psLink != NULL);
+ psLink->next = tif->tif_clientinfo;
+ psLink->name = (char *) _TIFFmalloc((tmsize_t)(strlen(name)+1));
+ assert (psLink->name != NULL);
+ strcpy(psLink->name, name);
+ psLink->data = data;
- tif->tif_clientinfo = link;
+ tif->tif_clientinfo = psLink;
}
/*
* Local Variables:
diff --git a/chromium/third_party/pdfium/third_party/libtiff/tif_fax3.c b/chromium/third_party/pdfium/third_party/libtiff/tif_fax3.c
index bbe72555bee..16bb4d36f04 100644
--- a/chromium/third_party/pdfium/third_party/libtiff/tif_fax3.c
+++ b/chromium/third_party/pdfium/third_party/libtiff/tif_fax3.c
@@ -1,4 +1,4 @@
-/* $Id: tif_fax3.c,v 1.75 2015-08-30 20:49:55 erouault Exp $ */
+/* $Id: tif_fax3.c,v 1.78 2016-09-04 21:32:56 erouault Exp $ */
/*
* Copyright (c) 1990-1997 Sam Leffler
@@ -644,7 +644,8 @@ putspan(TIFF* tif, int32 span, const tableentry* tab)
while (span >= 2624) {
const tableentry* te = &tab[63 + (2560>>6)];
- code = te->code, length = te->length;
+ code = te->code;
+ length = te->length;
#ifdef FAX3_DEBUG
DEBUG_PRINT("MakeUp", te->runlen);
#endif
@@ -654,14 +655,16 @@ putspan(TIFF* tif, int32 span, const tableentry* tab)
if (span >= 64) {
const tableentry* te = &tab[63 + (span>>6)];
assert(te->runlen == 64*(span>>6));
- code = te->code, length = te->length;
+ code = te->code;
+ length = te->length;
#ifdef FAX3_DEBUG
DEBUG_PRINT("MakeUp", te->runlen);
#endif
_PutBits(tif, code, length);
span -= te->runlen;
}
- code = tab[span].code, length = tab[span].length;
+ code = tab[span].code;
+ length = tab[span].length;
#ifdef FAX3_DEBUG
DEBUG_PRINT(" Term", tab[span].runlen);
#endif
@@ -697,14 +700,16 @@ Fax3PutEOL(TIFF* tif)
align = sp->bit + (8 - align);
else
align = sp->bit - align;
- code = 0;
tparm=align;
_PutBits(tif, 0, tparm);
}
}
- code = EOL, length = 12;
- if (is2DEncoding(sp))
- code = (code<<1) | (sp->tag == G3_1D), length++;
+ code = EOL;
+ length = 12;
+ if (is2DEncoding(sp)) {
+ code = (code<<1) | (sp->tag == G3_1D);
+ length++;
+ }
_PutBits(tif, code, length);
sp->data = data;
@@ -815,7 +820,7 @@ find0span(unsigned char* bp, int32 bs, int32 be)
/*
* Check partial byte on lhs.
*/
- if (bits > 0 && (n = (bs & 7))) {
+ if (bits > 0 && (n = (bs & 7)) != 0) {
span = zeroruns[(*bp << n) & 0xff];
if (span > 8-n) /* table value too generous */
span = 8-n;
@@ -835,12 +840,14 @@ find0span(unsigned char* bp, int32 bs, int32 be)
while (!isAligned(bp, long)) {
if (*bp != 0x00)
return (span + zeroruns[*bp]);
- span += 8, bits -= 8;
+ span += 8;
+ bits -= 8;
bp++;
}
lp = (long*) bp;
while ((bits >= (int32)(8 * sizeof(long))) && (0 == *lp)) {
- span += 8*sizeof (long), bits -= 8*sizeof (long);
+ span += 8*sizeof (long);
+ bits -= 8*sizeof (long);
lp++;
}
bp = (unsigned char*) lp;
@@ -851,7 +858,8 @@ find0span(unsigned char* bp, int32 bs, int32 be)
while (bits >= 8) {
if (*bp != 0x00) /* end of run */
return (span + zeroruns[*bp]);
- span += 8, bits -= 8;
+ span += 8;
+ bits -= 8;
bp++;
}
/*
@@ -874,7 +882,7 @@ find1span(unsigned char* bp, int32 bs, int32 be)
/*
* Check partial byte on lhs.
*/
- if (bits > 0 && (n = (bs & 7))) {
+ if (bits > 0 && (n = (bs & 7)) != 0) {
span = oneruns[(*bp << n) & 0xff];
if (span > 8-n) /* table value too generous */
span = 8-n;
@@ -894,12 +902,14 @@ find1span(unsigned char* bp, int32 bs, int32 be)
while (!isAligned(bp, long)) {
if (*bp != 0xff)
return (span + oneruns[*bp]);
- span += 8, bits -= 8;
+ span += 8;
+ bits -= 8;
bp++;
}
lp = (long*) bp;
while ((bits >= (int32)(8 * sizeof(long))) && (~0 == *lp)) {
- span += 8*sizeof (long), bits -= 8*sizeof (long);
+ span += 8*sizeof (long);
+ bits -= 8*sizeof (long);
lp++;
}
bp = (unsigned char*) lp;
@@ -910,7 +920,8 @@ find1span(unsigned char* bp, int32 bs, int32 be)
while (bits >= 8) {
if (*bp != 0xff) /* end of run */
return (span + oneruns[*bp]);
- span += 8, bits -= 8;
+ span += 8;
+ bits -= 8;
bp++;
}
/*
@@ -1094,8 +1105,10 @@ Fax3Close(TIFF* tif)
unsigned int length = 12;
int i;
- if (is2DEncoding(sp))
- code = (code<<1) | (sp->tag == G3_1D), length++;
+ if (is2DEncoding(sp)) {
+ code = (code<<1) | (sp->tag == G3_1D);
+ length++;
+ }
for (i = 0; i < 6; i++)
Fax3PutBits(tif, code, length);
Fax3FlushBits(tif, sp);
@@ -1182,7 +1195,7 @@ Fax3VSetField(TIFF* tif, uint32 tag, va_list ap)
return (*sp->vsetparent)(tif, tag, ap);
}
- if ((fip = TIFFFieldWithTag(tif, tag)))
+ if ((fip = TIFFFieldWithTag(tif, tag)) != NULL)
TIFFSetFieldBit(tif, fip->field_bit);
else
return 0;
@@ -1241,10 +1254,14 @@ Fax3PrintDir(TIFF* tif, FILE* fd, long flags)
} else {
fprintf(fd, " Group 3 Options:");
- if (sp->groupoptions & GROUP3OPT_2DENCODING)
- fprintf(fd, "%s2-d encoding", sep), sep = "+";
- if (sp->groupoptions & GROUP3OPT_FILLBITS)
- fprintf(fd, "%sEOL padding", sep), sep = "+";
+ if (sp->groupoptions & GROUP3OPT_2DENCODING) {
+ fprintf(fd, "%s2-d encoding", sep);
+ sep = "+";
+ }
+ if (sp->groupoptions & GROUP3OPT_FILLBITS) {
+ fprintf(fd, "%sEOL padding", sep);
+ sep = "+";
+ }
if (sp->groupoptions & GROUP3OPT_UNCOMPRESSED)
fprintf(fd, "%suncompressed data", sep);
}
diff --git a/chromium/third_party/pdfium/third_party/libtiff/tif_fax3.h b/chromium/third_party/pdfium/third_party/libtiff/tif_fax3.h
index b0f46c9a43f..e0b2ca6bfc9 100644
--- a/chromium/third_party/pdfium/third_party/libtiff/tif_fax3.h
+++ b/chromium/third_party/pdfium/third_party/libtiff/tif_fax3.h
@@ -1,4 +1,4 @@
-/* $Id: tif_fax3.h,v 1.9 2011-03-10 20:23:07 fwarmerdam Exp $ */
+/* $Id: tif_fax3.h,v 1.11 2016-01-23 21:20:34 erouault Exp $ */
/*
* Copyright (c) 1990-1997 Sam Leffler
@@ -39,7 +39,7 @@
/*
* To override the default routine used to image decoded
- * spans one can use the pseduo tag TIFFTAG_FAXFILLFUNC.
+ * spans one can use the pseudo tag TIFFTAG_FAXFILLFUNC.
* The routine must have the type signature given below;
* for example:
*
@@ -84,7 +84,7 @@ extern void _TIFFFax3fillruns(unsigned char*, uint32*, uint32*, uint32);
typedef struct { /* state table entry */
unsigned char State; /* see above */
unsigned char Width; /* width of code in bits */
- uint32 Param; /* unsigned 32-bit run length in bits */
+ uint16 Param; /* unsigned 16-bit run length in bits */
} TIFFFaxTabEnt;
extern const TIFFFaxTabEnt TIFFFaxMainTable[];
diff --git a/chromium/third_party/pdfium/third_party/libtiff/tif_getimage.c b/chromium/third_party/pdfium/third_party/libtiff/tif_getimage.c
index 5ed1b7a370a..84cc1d1a769 100644
--- a/chromium/third_party/pdfium/third_party/libtiff/tif_getimage.c
+++ b/chromium/third_party/pdfium/third_party/libtiff/tif_getimage.c
@@ -1,4 +1,4 @@
-/* $Id: tif_getimage.c,v 1.90 2015-06-17 01:34:08 bfriesen Exp $ */
+/* $Id: tif_getimage.c,v 1.98 2016-11-18 02:47:45 bfriesen Exp $ */
/*
* Copyright (c) 1991-1997 Sam Leffler
@@ -96,6 +96,10 @@ TIFFRGBAImageOK(TIFF* tif, char emsg[1024])
td->td_bitspersample);
return (0);
}
+ if (td->td_sampleformat == SAMPLEFORMAT_IEEEFP) {
+ sprintf(emsg, "Sorry, can not handle images with IEEE floating-point samples");
+ return (0);
+ }
colorchannels = td->td_samplesperpixel - td->td_extrasamples;
if (!TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &photometric)) {
switch (colorchannels) {
@@ -183,27 +187,25 @@ TIFFRGBAImageOK(TIFF* tif, char emsg[1024])
"Planarconfiguration", td->td_planarconfig);
return (0);
}
- if( td->td_samplesperpixel != 3 || colorchannels != 3 )
- {
- sprintf(emsg,
- "Sorry, can not handle image with %s=%d, %s=%d",
- "Samples/pixel", td->td_samplesperpixel,
- "colorchannels", colorchannels);
- return 0;
- }
+ if ( td->td_samplesperpixel != 3 || colorchannels != 3 ) {
+ sprintf(emsg,
+ "Sorry, can not handle image with %s=%d, %s=%d",
+ "Samples/pixel", td->td_samplesperpixel,
+ "colorchannels", colorchannels);
+ return 0;
+ }
break;
case PHOTOMETRIC_CIELAB:
- if( td->td_samplesperpixel != 3 || colorchannels != 3 || td->td_bitspersample != 8 )
- {
- sprintf(emsg,
- "Sorry, can not handle image with %s=%d, %s=%d and %s=%d",
- "Samples/pixel", td->td_samplesperpixel,
- "colorchannels", colorchannels,
- "Bits/sample", td->td_bitspersample);
- return 0;
- }
+ if ( td->td_samplesperpixel != 3 || colorchannels != 3 || td->td_bitspersample != 8 ) {
+ sprintf(emsg,
+ "Sorry, can not handle image with %s=%d, %s=%d and %s=%d",
+ "Samples/pixel", td->td_samplesperpixel,
+ "colorchannels", colorchannels,
+ "Bits/sample", td->td_bitspersample);
+ return 0;
+ }
break;
- default:
+ default:
sprintf(emsg, "Sorry, can not handle image with %s=%d",
photoTag, photometric);
return (0);
@@ -214,20 +216,34 @@ TIFFRGBAImageOK(TIFF* tif, char emsg[1024])
void
TIFFRGBAImageEnd(TIFFRGBAImage* img)
{
- if (img->Map)
- _TIFFfree(img->Map), img->Map = NULL;
- if (img->BWmap)
- _TIFFfree(img->BWmap), img->BWmap = NULL;
- if (img->PALmap)
- _TIFFfree(img->PALmap), img->PALmap = NULL;
- if (img->ycbcr)
- _TIFFfree(img->ycbcr), img->ycbcr = NULL;
- if (img->cielab)
- _TIFFfree(img->cielab), img->cielab = NULL;
- if (img->UaToAa)
- _TIFFfree(img->UaToAa), img->UaToAa = NULL;
- if (img->Bitdepth16To8)
- _TIFFfree(img->Bitdepth16To8), img->Bitdepth16To8 = NULL;
+ if (img->Map) {
+ _TIFFfree(img->Map);
+ img->Map = NULL;
+ }
+ if (img->BWmap) {
+ _TIFFfree(img->BWmap);
+ img->BWmap = NULL;
+ }
+ if (img->PALmap) {
+ _TIFFfree(img->PALmap);
+ img->PALmap = NULL;
+ }
+ if (img->ycbcr) {
+ _TIFFfree(img->ycbcr);
+ img->ycbcr = NULL;
+ }
+ if (img->cielab) {
+ _TIFFfree(img->cielab);
+ img->cielab = NULL;
+ }
+ if (img->UaToAa) {
+ _TIFFfree(img->UaToAa);
+ img->UaToAa = NULL;
+ }
+ if (img->Bitdepth16To8) {
+ _TIFFfree(img->Bitdepth16To8);
+ img->Bitdepth16To8 = NULL;
+ }
if( img->redcmap ) {
_TIFFfree( img->redcmap );
@@ -351,7 +367,7 @@ TIFFRGBAImageBegin(TIFFRGBAImage* img, TIFF* tif, int stop, char emsg[1024])
}
/* copy the colormaps so we can modify them */
- n_color = (1L << img->bitspersample);
+ n_color = (1U << img->bitspersample);
img->redcmap = (uint16 *) _TIFFmalloc(sizeof(uint16)*n_color);
img->greencmap = (uint16 *) _TIFFmalloc(sizeof(uint16)*n_color);
img->bluecmap = (uint16 *) _TIFFmalloc(sizeof(uint16)*n_color);
@@ -364,7 +380,7 @@ TIFFRGBAImageBegin(TIFFRGBAImage* img, TIFF* tif, int stop, char emsg[1024])
_TIFFmemcpy( img->greencmap, green_orig, n_color * 2 );
_TIFFmemcpy( img->bluecmap, blue_orig, n_color * 2 );
- /* fall thru... */
+ /* fall through... */
case PHOTOMETRIC_MINISWHITE:
case PHOTOMETRIC_MINISBLACK:
if (planarconfig == PLANARCONFIG_CONTIG
@@ -479,7 +495,7 @@ TIFFRGBAImageBegin(TIFFRGBAImage* img, TIFF* tif, int stop, char emsg[1024])
return 1;
fail_return:
- TIFFRGBAImageEnd( img );
+ TIFFRGBAImageEnd(img);
return 0;
}
@@ -512,7 +528,7 @@ TIFFReadRGBAImageOriented(TIFF* tif,
int ok;
if (TIFFRGBAImageOK(tif, emsg) && TIFFRGBAImageBegin(&img, tif, stop, emsg)) {
- img.req_orientation = orientation;
+ img.req_orientation = (uint16)orientation;
/* XXX verify rwidth and rheight against width and height */
ok = TIFFRGBAImageGet(&img, raster+(rheight-img.height)*rwidth,
rwidth, img.height);
@@ -643,14 +659,14 @@ gtTileContig(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
safeskew -= tw;
safeskew +=w;
}
+
if(safeskew > INT_MAX || safeskew < INT_MIN){
- _TIFFfree(buf);
- TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "%s", "Invalid skew");
- return (0);
+ _TIFFfree(buf);
+ TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "%s", "Invalid skew");
+ return (0);
}
toskew = safeskew;
-
/*
* Leftmost tile is clipped on left side if col_offset > 0.
*/
@@ -659,9 +675,9 @@ gtTileContig(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
safeskew = toskew;
safeskew += leftmost_fromskew;
if(safeskew > INT_MAX || safeskew < INT_MIN){
- _TIFFfree(buf);
- TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "%s", "Invalid skew");
- return (0);
+ _TIFFfree(buf);
+ TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "%s", "Invalid skew");
+ return (0);
}
leftmost_toskew = safeskew;
for (row = 0; row < h; row += nrow)
@@ -692,18 +708,18 @@ gtTileContig(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
safeskew -= w;
safeskew += tocol;
if(safeskew > INT_MAX || safeskew < INT_MIN){
- _TIFFfree(buf);
- TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "%s", "Invalid skew");
- return (0);
+ _TIFFfree(buf);
+ TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "%s", "Invalid skew");
+ return (0);
}
fromskew = safeskew;
this_tw = tw - fromskew;
safeskew = toskew;
safeskew += fromskew;
if(safeskew > INT_MAX || safeskew < INT_MIN){
- _TIFFfree(buf);
- TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "%s", "Invalid skew");
- return (0);
+ _TIFFfree(buf);
+ TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "%s", "Invalid skew");
+ return (0);
}
this_toskew = safeskew;
}
@@ -733,7 +749,8 @@ gtTileContig(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
uint32 temp = *left;
*left = *right;
*right = temp;
- left++, right--;
+ left++;
+ right--;
}
}
}
@@ -766,7 +783,7 @@ gtTileSeparate(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
int alpha = img->alpha;
uint32 nrow;
int ret = 1, flip;
- int colorchannels;
+ uint16 colorchannels;
uint32 this_tw, tocol;
int32 this_toskew, leftmost_toskew;
int32 leftmost_fromskew;
@@ -900,7 +917,8 @@ gtTileSeparate(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
uint32 temp = *left;
*left = *right;
*right = temp;
- left++, right--;
+ left++;
+ right--;
}
}
}
@@ -990,7 +1008,8 @@ gtStripContig(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
uint32 temp = *left;
*left = *right;
*right = temp;
- left++, right--;
+ left++;
+ right--;
}
}
}
@@ -1021,7 +1040,8 @@ gtStripSeparate(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
tmsize_t bufsize;
int32 fromskew, toskew;
int alpha = img->alpha;
- int ret = 1, flip, colorchannels;
+ int ret = 1, flip;
+ uint16 colorchannels;
stripsize = TIFFStripSize(tif);
bufsize = TIFFSafeMultiply(tmsize_t,alpha?4:3,stripsize);
@@ -1123,7 +1143,8 @@ gtStripSeparate(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
uint32 temp = *left;
*left = *right;
*right = temp;
- left++, right--;
+ left++;
+ right--;
}
}
}
@@ -1451,7 +1472,7 @@ DECLAREContigPutFunc(putRGBUAcontig8bittile)
uint8* m;
for (x = w; x-- > 0;) {
a = pp[3];
- m = img->UaToAa+(a<<8);
+ m = img->UaToAa+((size_t) a<<8);
r = m[pp[0]];
g = m[pp[1]];
b = m[pp[2]];
@@ -1522,7 +1543,7 @@ DECLAREContigPutFunc(putRGBUAcontig16bittile)
uint8* m;
for (x = w; x-- > 0;) {
a = img->Bitdepth16To8[wp[3]];
- m = img->UaToAa+(a<<8);
+ m = img->UaToAa+((size_t) a<<8);
r = m[img->Bitdepth16To8[wp[0]]];
g = m[img->Bitdepth16To8[wp[1]]];
b = m[img->Bitdepth16To8[wp[2]]];
@@ -1653,7 +1674,7 @@ DECLARESepPutFunc(putRGBUAseparate8bittile)
uint8* m;
for (x = w; x-- > 0;) {
av = *a++;
- m = img->UaToAa+(av<<8);
+ m = img->UaToAa+((size_t) av<<8);
rv = m[*r++];
gv = m[*g++];
bv = m[*b++];
@@ -1715,15 +1736,15 @@ DECLARESepPutFunc(putRGBUAseparate16bittile)
uint16 *wa = (uint16*) a;
(void) img; (void) y;
while (h-- > 0) {
- uint32 r,g,b,a;
+ uint32 r2,g2,b2,a2;
uint8* m;
for (x = w; x-- > 0;) {
- a = img->Bitdepth16To8[*wa++];
- m = img->UaToAa+(a<<8);
- r = m[img->Bitdepth16To8[*wr++]];
- g = m[img->Bitdepth16To8[*wg++]];
- b = m[img->Bitdepth16To8[*wb++]];
- *cp++ = PACK4(r,g,b,a);
+ a2 = img->Bitdepth16To8[*wa++];
+ m = img->UaToAa+((size_t) a2<<8);
+ r2 = m[img->Bitdepth16To8[*wr++]];
+ g2 = m[img->Bitdepth16To8[*wg++]];
+ b2 = m[img->Bitdepth16To8[*wb++]];
+ *cp++ = PACK4(r2,g2,b2,a2);
}
SKEW4(wr, wg, wb, wa, fromskew);
cp += toskew;
@@ -1878,10 +1899,16 @@ DECLAREContigPutFunc(putcontig8bitYCbCr44tile)
YCbCrtoRGB(cp3[2], pp[14]);
YCbCrtoRGB(cp3[3], pp[15]);
- cp += 4, cp1 += 4, cp2 += 4, cp3 += 4;
+ cp += 4;
+ cp1 += 4;
+ cp2 += 4;
+ cp3 += 4;
pp += 18;
} while (--x);
- cp += incr, cp1 += incr, cp2 += incr, cp3 += incr;
+ cp += incr;
+ cp1 += incr;
+ cp2 += incr;
+ cp3 += incr;
pp += fromskew;
}
} else {
@@ -1932,7 +1959,10 @@ DECLAREContigPutFunc(putcontig8bitYCbCr44tile)
if (h <= 4)
break;
h -= 4;
- cp += incr, cp1 += incr, cp2 += incr, cp3 += incr;
+ cp += incr;
+ cp1 += incr;
+ cp2 += incr;
+ cp3 += incr;
pp += fromskew;
}
}
@@ -1964,10 +1994,12 @@ DECLAREContigPutFunc(putcontig8bitYCbCr42tile)
YCbCrtoRGB(cp1[2], pp[6]);
YCbCrtoRGB(cp1[3], pp[7]);
- cp += 4, cp1 += 4;
+ cp += 4;
+ cp1 += 4;
pp += 10;
} while (--x);
- cp += incr, cp1 += incr;
+ cp += incr;
+ cp1 += incr;
pp += fromskew;
}
} else {
@@ -2010,7 +2042,8 @@ DECLAREContigPutFunc(putcontig8bitYCbCr42tile)
if (h <= 2)
break;
h -= 2;
- cp += incr, cp1 += incr;
+ cp += incr;
+ cp1 += incr;
pp += fromskew;
}
}
@@ -2399,7 +2432,8 @@ setupMap(TIFFRGBAImage* img)
if (!makebwmap(img))
return (0);
/* no longer need Map, free it */
- _TIFFfree(img->Map), img->Map = NULL;
+ _TIFFfree(img->Map);
+ img->Map = NULL;
}
return (1);
}
@@ -2507,7 +2541,7 @@ buildMap(TIFFRGBAImage* img)
case PHOTOMETRIC_SEPARATED:
if (img->bitspersample == 8)
break;
- /* fall thru... */
+ /* fall through... */
case PHOTOMETRIC_MINISBLACK:
case PHOTOMETRIC_MINISWHITE:
if (!setupMap(img))
@@ -2777,7 +2811,7 @@ BuildMapUaToAa(TIFFRGBAImage* img)
for (na=0; na<256; na++)
{
for (nv=0; nv<256; nv++)
- *m++=(nv*na+127)/255;
+ *m++=(uint8)((nv*na+127)/255);
}
return(1);
}
@@ -2797,7 +2831,7 @@ BuildMapBitdepth16To8(TIFFRGBAImage* img)
}
m=img->Bitdepth16To8;
for (n=0; n<65536; n++)
- *m++=(n+128)/257;
+ *m++=(uint8)((n+128)/257);
return(1);
}
diff --git a/chromium/third_party/pdfium/third_party/libtiff/tif_jpeg.c b/chromium/third_party/pdfium/third_party/libtiff/tif_jpeg.c
index 66599092994..abd0b0aa2fb 100644
--- a/chromium/third_party/pdfium/third_party/libtiff/tif_jpeg.c
+++ b/chromium/third_party/pdfium/third_party/libtiff/tif_jpeg.c
@@ -1,4 +1,4 @@
-/* $Id: tif_jpeg.c,v 1.119 2015-08-15 20:13:07 bfriesen Exp $ */
+/* $Id: tif_jpeg.c,v 1.123 2016-01-23 21:20:34 erouault Exp $ */
/*
* Copyright (c) 1994-1997 Sam Leffler
@@ -58,7 +58,7 @@ int TIFFReInitJPEG_12( TIFF *tif, int scheme, int is_encode );
Libjpeg's jmorecfg.h defines INT16 and INT32, but only if XMD_H is
not defined. Unfortunately, the MinGW and Borland compilers include
a typedef for INT32, which causes a conflict. MSVC does not include
- a conficting typedef given the headers which are included.
+ a conflicting typedef given the headers which are included.
*/
#if defined(__BORLANDC__) || defined(__MINGW32__)
# define XMD_H 1
@@ -945,7 +945,7 @@ JPEGFixupTagsSubsamplingSkip(struct JPEGFixupTagsSubsamplingData* data, uint16 s
else
{
uint16 m;
- m=skiplength-data->bufferbytesleft;
+ m=(uint16)(skiplength-data->bufferbytesleft);
if (m<=data->filebytesleft)
{
data->bufferbytesleft=0;
@@ -1291,7 +1291,7 @@ JPEGDecode(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s)
if( line_work_buf != NULL )
{
/*
- * In the MK1 case, we aways read into a 16bit
+ * In the MK1 case, we always read into a 16bit
* buffer, and then pack down to 12bit or 8bit.
* In 6B case we only read into 16 bit buffer
* for 12bit data, which we need to repack.
@@ -1311,10 +1311,10 @@ JPEGDecode(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s)
((unsigned char *) buf) + iPair * 3;
JSAMPLE *in_ptr = line_work_buf + iPair * 2;
- out_ptr[0] = (in_ptr[0] & 0xff0) >> 4;
- out_ptr[1] = ((in_ptr[0] & 0xf) << 4)
- | ((in_ptr[1] & 0xf00) >> 8);
- out_ptr[2] = ((in_ptr[1] & 0xff) >> 0);
+ out_ptr[0] = (unsigned char)((in_ptr[0] & 0xff0) >> 4);
+ out_ptr[1] = (unsigned char)(((in_ptr[0] & 0xf) << 4)
+ | ((in_ptr[1] & 0xf00) >> 8));
+ out_ptr[2] = (unsigned char)(((in_ptr[1] & 0xff) >> 0));
}
}
else if( sp->cinfo.d.data_precision == 8 )
@@ -1375,7 +1375,7 @@ JPEGDecodeRaw(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s)
(void) s;
/* data is expected to be read in multiples of a scanline */
- if ( (nrows = sp->cinfo.d.image_height) ) {
+ if ( (nrows = sp->cinfo.d.image_height) != 0 ) {
/* Cb,Cr both have sampling factors 1, so this is correct */
JDIMENSION clumps_per_line = sp->cinfo.d.comp_info[1].downsampled_width;
@@ -1475,10 +1475,10 @@ JPEGDecodeRaw(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s)
{
unsigned char *out_ptr = ((unsigned char *) buf) + iPair * 3;
JSAMPLE *in_ptr = (JSAMPLE *) (tmpbuf + iPair * 2);
- out_ptr[0] = (in_ptr[0] & 0xff0) >> 4;
- out_ptr[1] = ((in_ptr[0] & 0xf) << 4)
- | ((in_ptr[1] & 0xf00) >> 8);
- out_ptr[2] = ((in_ptr[1] & 0xff) >> 0);
+ out_ptr[0] = (unsigned char)((in_ptr[0] & 0xff0) >> 4);
+ out_ptr[1] = (unsigned char)(((in_ptr[0] & 0xf) << 4)
+ | ((in_ptr[1] & 0xf00) >> 8));
+ out_ptr[2] = (unsigned char)(((in_ptr[1] & 0xff) >> 0));
}
}
}
@@ -1901,7 +1901,7 @@ JPEGEncode(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s)
if( sp->cinfo.c.data_precision == 12 )
{
- line16_count = (sp->bytesperline * 2) / 3;
+ line16_count = (int)((sp->bytesperline * 2) / 3);
line16 = (short *) _TIFFmalloc(sizeof(short) * line16_count);
if (!line16)
{
@@ -2146,8 +2146,7 @@ JPEGVSetField(TIFF* tif, uint32 tag, va_list ap)
/* XXX */
return (0);
}
- _TIFFsetByteArray(&sp->jpegtables, va_arg(ap, void*),
- (long) v32);
+ _TIFFsetByteArray(&sp->jpegtables, va_arg(ap, void*), v32);
sp->jpegtables_length = v32;
TIFFSetFieldBit(tif, FIELD_JPEGTABLES);
break;
@@ -2176,7 +2175,7 @@ JPEGVSetField(TIFF* tif, uint32 tag, va_list ap)
return (*sp->vsetparent)(tif, tag, ap);
}
- if ((fip = TIFFFieldWithTag(tif, tag))) {
+ if ((fip = TIFFFieldWithTag(tif, tag)) != NULL) {
TIFFSetFieldBit(tif, fip->field_bit);
} else {
return (0);
diff --git a/chromium/third_party/pdfium/third_party/libtiff/tif_luv.c b/chromium/third_party/pdfium/third_party/libtiff/tif_luv.c
index 01f39c0d636..220c15034a2 100644
--- a/chromium/third_party/pdfium/third_party/libtiff/tif_luv.c
+++ b/chromium/third_party/pdfium/third_party/libtiff/tif_luv.c
@@ -1,4 +1,4 @@
-/* $Id: tif_luv.c,v 1.40 2015-06-21 01:09:09 bfriesen Exp $ */
+/* $Id: tif_luv.c,v 1.43 2016-09-04 21:32:56 erouault Exp $ */
/*
* Copyright (c) 1997 Greg Ward Larson
@@ -158,6 +158,7 @@
typedef struct logLuvState LogLuvState;
struct logLuvState {
+ int encoder_state; /* 1 if encoder correctly initialized */
int user_datafmt; /* user data format */
int encode_meth; /* encoding method */
int pixel_size; /* bytes per pixel */
@@ -401,8 +402,10 @@ LogLuvDecodeStrip(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
return 0;
assert(cc%rowlen == 0);
- while (cc && (*tif->tif_decoderow)(tif, bp, rowlen, s))
- bp += rowlen, cc -= rowlen;
+ while (cc && (*tif->tif_decoderow)(tif, bp, rowlen, s)) {
+ bp += rowlen;
+ cc -= rowlen;
+ }
return (cc == 0);
}
@@ -420,8 +423,10 @@ LogLuvDecodeTile(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
return 0;
assert(cc%rowlen == 0);
- while (cc && (*tif->tif_decoderow)(tif, bp, rowlen, s))
- bp += rowlen, cc -= rowlen;
+ while (cc && (*tif->tif_decoderow)(tif, bp, rowlen, s)) {
+ bp += rowlen;
+ cc -= rowlen;
+ }
return (cc == 0);
}
@@ -687,8 +692,10 @@ LogLuvEncodeStrip(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
return 0;
assert(cc%rowlen == 0);
- while (cc && (*tif->tif_encoderow)(tif, bp, rowlen, s) == 1)
- bp += rowlen, cc -= rowlen;
+ while (cc && (*tif->tif_encoderow)(tif, bp, rowlen, s) == 1) {
+ bp += rowlen;
+ cc -= rowlen;
+ }
return (cc == 0);
}
@@ -705,8 +712,10 @@ LogLuvEncodeTile(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
return 0;
assert(cc%rowlen == 0);
- while (cc && (*tif->tif_encoderow)(tif, bp, rowlen, s) == 1)
- bp += rowlen, cc -= rowlen;
+ while (cc && (*tif->tif_encoderow)(tif, bp, rowlen, s) == 1) {
+ bp += rowlen;
+ cc -= rowlen;
+ }
return (cc == 0);
}
@@ -1276,6 +1285,14 @@ LogL16InitState(TIFF* tif)
assert(sp != NULL);
assert(td->td_photometric == PHOTOMETRIC_LOGL);
+ if( td->td_samplesperpixel != 1 )
+ {
+ TIFFErrorExt(tif->tif_clientdata, module,
+ "Sorry, can not handle LogL image with %s=%d",
+ "Samples/pixel", td->td_samplesperpixel);
+ return 0;
+ }
+
/* for some reason, we can't do this in TIFFInitLogL16 */
if (sp->user_datafmt == SGILOGDATAFMT_UNKNOWN)
sp->user_datafmt = LogL16GuessDataFmt(td);
@@ -1536,6 +1553,7 @@ LogLuvSetupEncode(TIFF* tif)
td->td_photometric, "must be either LogLUV or LogL");
break;
}
+ sp->encoder_state = 1;
return (1);
notsupported:
TIFFErrorExt(tif->tif_clientdata, module,
@@ -1547,19 +1565,27 @@ notsupported:
static void
LogLuvClose(TIFF* tif)
{
+ LogLuvState* sp = (LogLuvState*) tif->tif_data;
TIFFDirectory *td = &tif->tif_dir;
+ assert(sp != 0);
/*
* For consistency, we always want to write out the same
* bitspersample and sampleformat for our TIFF file,
* regardless of the data format being used by the application.
* Since this routine is called after tags have been set but
* before they have been recorded in the file, we reset them here.
+ * Note: this is really a nasty approach. See PixarLogClose
*/
- td->td_samplesperpixel =
- (td->td_photometric == PHOTOMETRIC_LOGL) ? 1 : 3;
- td->td_bitspersample = 16;
- td->td_sampleformat = SAMPLEFORMAT_INT;
+ if( sp->encoder_state )
+ {
+ /* See PixarLogClose. Might avoid issues with tags whose size depends
+ * on those below, but not completely sure this is enough. */
+ td->td_samplesperpixel =
+ (td->td_photometric == PHOTOMETRIC_LOGL) ? 1 : 3;
+ td->td_bitspersample = 16;
+ td->td_sampleformat = SAMPLEFORMAT_INT;
+ }
}
static void
@@ -1598,17 +1624,21 @@ LogLuvVSetField(TIFF* tif, uint32 tag, va_list ap)
*/
switch (sp->user_datafmt) {
case SGILOGDATAFMT_FLOAT:
- bps = 32, fmt = SAMPLEFORMAT_IEEEFP;
+ bps = 32;
+ fmt = SAMPLEFORMAT_IEEEFP;
break;
case SGILOGDATAFMT_16BIT:
- bps = 16, fmt = SAMPLEFORMAT_INT;
+ bps = 16;
+ fmt = SAMPLEFORMAT_INT;
break;
case SGILOGDATAFMT_RAW:
- bps = 32, fmt = SAMPLEFORMAT_UINT;
+ bps = 32;
+ fmt = SAMPLEFORMAT_UINT;
TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, 1);
break;
case SGILOGDATAFMT_8BIT:
- bps = 8, fmt = SAMPLEFORMAT_UINT;
+ bps = 8;
+ fmt = SAMPLEFORMAT_UINT;
break;
default:
TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
diff --git a/chromium/third_party/pdfium/third_party/libtiff/tif_lzw.c b/chromium/third_party/pdfium/third_party/libtiff/tif_lzw.c
index 9b76dd03b39..240e19c2e05 100644
--- a/chromium/third_party/pdfium/third_party/libtiff/tif_lzw.c
+++ b/chromium/third_party/pdfium/third_party/libtiff/tif_lzw.c
@@ -1,4 +1,4 @@
-/* $Id: tif_lzw.c,v 1.49 2015-08-30 21:07:44 erouault Exp $ */
+/* $Id: tif_lzw.c,v 1.52 2016-09-04 21:32:56 erouault Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@@ -240,8 +240,8 @@ LZWSetupDecode(TIFF* tif)
*/
code = 255;
do {
- sp->dec_codetab[code].value = code;
- sp->dec_codetab[code].firstchar = code;
+ sp->dec_codetab[code].value = (unsigned char)code;
+ sp->dec_codetab[code].firstchar = (unsigned char)code;
sp->dec_codetab[code].length = 1;
sp->dec_codetab[code].next = NULL;
} while (code--);
@@ -411,14 +411,15 @@ LZWDecode(TIFF* tif, uint8* op0, tmsize_t occ0, uint16 s)
/*
* Residue satisfies only part of the decode request.
*/
- op += residue, occ -= residue;
+ op += residue;
+ occ -= residue;
tp = op;
do {
int t;
--tp;
t = codep->value;
codep = codep->next;
- *tp = t;
+ *tp = (char)t;
} while (--residue && codep);
sp->dec_restart = 0;
}
@@ -454,7 +455,8 @@ LZWDecode(TIFF* tif, uint8* op0, tmsize_t occ0, uint16 s)
tif->tif_row);
return (0);
}
- *op++ = (char)code, occ--;
+ *op++ = (char)code;
+ occ--;
oldcodep = sp->dec_codetab + code;
continue;
}
@@ -532,16 +534,19 @@ LZWDecode(TIFF* tif, uint8* op0, tmsize_t occ0, uint16 s)
--tp;
t = codep->value;
codep = codep->next;
- *tp = t;
+ *tp = (char)t;
} while (codep && tp > op);
if (codep) {
codeLoop(tif, module);
break;
}
assert(occ >= len);
- op += len, occ -= len;
- } else
- *op++ = (char)code, occ--;
+ op += len;
+ occ -= len;
+ } else {
+ *op++ = (char)code;
+ occ--;
+ }
}
tif->tif_rawcp = (uint8*) bp;
@@ -635,7 +640,8 @@ LZWDecodeCompat(TIFF* tif, uint8* op0, tmsize_t occ0, uint16 s)
/*
* Residue satisfies only part of the decode request.
*/
- op += residue, occ -= residue;
+ op += residue;
+ occ -= residue;
tp = op;
do {
*--tp = codep->value;
@@ -675,7 +681,8 @@ LZWDecodeCompat(TIFF* tif, uint8* op0, tmsize_t occ0, uint16 s)
tif->tif_row);
return (0);
}
- *op++ = code, occ--;
+ *op++ = (char)code;
+ occ--;
oldcodep = sp->dec_codetab + code;
continue;
}
@@ -741,17 +748,20 @@ LZWDecodeCompat(TIFF* tif, uint8* op0, tmsize_t occ0, uint16 s)
break;
}
assert(occ >= codep->length);
- op += codep->length, occ -= codep->length;
+ op += codep->length;
+ occ -= codep->length;
tp = op;
do {
*--tp = codep->value;
} while( (codep = codep->next) != NULL );
- } else
- *op++ = code, occ--;
+ } else {
+ *op++ = (char)code;
+ occ--;
+ }
}
tif->tif_rawcp = (uint8*) bp;
- sp->lzw_nbits = nbits;
+ sp->lzw_nbits = (unsigned short)nbits;
sp->lzw_nextdata = nextdata;
sp->lzw_nextbits = nextbits;
sp->dec_nbitsmask = nbitsmask;
@@ -900,7 +910,7 @@ LZWEncode(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
nbits = sp->lzw_nbits;
op = tif->tif_rawcp;
limit = sp->enc_rawlimit;
- ent = sp->enc_oldcode;
+ ent = (hcode_t)sp->enc_oldcode;
if (ent == (hcode_t) -1 && cc > 0) {
/*
@@ -936,7 +946,7 @@ LZWEncode(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
disp = 1;
do {
/*
- * Avoid pointer arithmetic 'cuz of
+ * Avoid pointer arithmetic because of
* wraparound problems with segments.
*/
if ((h -= disp) < 0)
@@ -963,8 +973,8 @@ LZWEncode(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
op = tif->tif_rawdata;
}
PutNextCode(op, ent);
- ent = c;
- hp->code = free_ent++;
+ ent = (hcode_t)c;
+ hp->code = (hcode_t)(free_ent++);
hp->hash = fcode;
if (free_ent == CODE_MAX-1) {
/* table is full, emit clear code and reset */
@@ -1021,9 +1031,9 @@ LZWEncode(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
sp->enc_oldcode = ent;
sp->lzw_nextdata = nextdata;
sp->lzw_nextbits = nextbits;
- sp->lzw_free_ent = free_ent;
- sp->lzw_maxcode = maxcode;
- sp->lzw_nbits = nbits;
+ sp->lzw_free_ent = (unsigned short)free_ent;
+ sp->lzw_maxcode = (unsigned short)maxcode;
+ sp->lzw_nbits = (unsigned short)nbits;
tif->tif_rawcp = op;
return (1);
}
diff --git a/chromium/third_party/pdfium/third_party/libtiff/tif_next.c b/chromium/third_party/pdfium/third_party/libtiff/tif_next.c
index b2076a0b017..08211788acb 100644
--- a/chromium/third_party/pdfium/third_party/libtiff/tif_next.c
+++ b/chromium/third_party/pdfium/third_party/libtiff/tif_next.c
@@ -1,4 +1,4 @@
-/* $Id: tif_next.c,v 1.16 2014-12-29 12:09:11 erouault Exp $ */
+/* $Id: tif_next.c,v 1.19 2016-09-04 21:32:56 erouault Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@@ -72,7 +72,8 @@ NeXTDecode(TIFF* tif, uint8* buf, tmsize_t occ, uint16 s)
return (0);
}
for (row = buf; cc > 0 && occ > 0; occ -= scanline, row += scanline) {
- n = *bp++, cc--;
+ n = *bp++;
+ cc--;
switch (n) {
case LITERALROW:
/*
@@ -103,10 +104,10 @@ NeXTDecode(TIFF* tif, uint8* buf, tmsize_t occ, uint16 s)
}
default: {
uint32 npixels = 0, grey;
+ tmsize_t op_offset = 0;
uint32 imagewidth = tif->tif_dir.td_imagewidth;
if( isTiled(tif) )
imagewidth = tif->tif_dir.td_tilewidth;
- tmsize_t op_offset = 0;
/*
* The scanline is composed of a sequence of constant
@@ -134,7 +135,8 @@ NeXTDecode(TIFF* tif, uint8* buf, tmsize_t occ, uint16 s)
}
if (cc == 0)
goto bad;
- n = *bp++, cc--;
+ n = *bp++;
+ cc--;
}
break;
}
diff --git a/chromium/third_party/pdfium/third_party/libtiff/tif_ojpeg.c b/chromium/third_party/pdfium/third_party/libtiff/tif_ojpeg.c
index 276d562dfbe..cb84be96ba4 100644
--- a/chromium/third_party/pdfium/third_party/libtiff/tif_ojpeg.c
+++ b/chromium/third_party/pdfium/third_party/libtiff/tif_ojpeg.c
@@ -1,4 +1,4 @@
-/* $Id: tif_ojpeg.c,v 1.60 2015-05-31 00:38:46 bfriesen Exp $ */
+/* $Id: tif_ojpeg.c,v 1.65 2016-09-04 21:32:56 erouault Exp $ */
/* WARNING: The type of JPEG encapsulation defined by the TIFF Version 6.0
specification is now totally obsolete and deprecated for new applications and
@@ -75,7 +75,7 @@
OJPEGSubsamplingCorrect, making no note of any other data, reporting no warnings
or errors, up to the point where either these values are read, or it's clear they
aren't there. This means that some of the data is read twice, but we feel speed
- in correcting these values is important enough to warrant this sacrifice. Allthough
+ in correcting these values is important enough to warrant this sacrifice. Although
there is currently no define or other configuration mechanism to disable this behaviour,
the actual header scanning is build to robustly respond with error report if it
should encounter an uncorrected mismatch of subsampling values. See
@@ -84,7 +84,7 @@
The restart interval and restart markers are the most tricky part... The restart
interval can be specified in a tag. It can also be set inside the input JPEG stream.
It can be used inside the input JPEG stream. If reading from strile data, we've
- consistenly discovered the need to insert restart markers in between the different
+ consistently discovered the need to insert restart markers in between the different
striles, as is also probably the most likely interpretation of the original TIFF 6.0
specification. With all this setting of interval, and actual use of markers that is not
predictable at the time of valid JPEG header assembly, the restart thing may turn
@@ -113,7 +113,7 @@
planarconfig is not separate (vast majority). We may one day use that to build
converters to JPEG, and/or to new-style JPEG compression inside TIFF.
- A dissadvantage is the lack of random access to the individual striles. This is the
+ A disadvantage is the lack of random access to the individual striles. This is the
reason for much of the complicated restart-and-position stuff inside OJPEGPreDecode.
Applications would do well accessing all striles in order, as this will result in
a single sequential scan of the input stream, and no restarting of LibJpeg decoding
@@ -135,7 +135,7 @@
* The default mode, without JPEG_ENCAP_EXTERNAL, implements the call encapsulators
* here, internally, with normal longjump.
* SETJMP, LONGJMP, JMP_BUF: On some machines/environments a longjump equivalent is
- * conviniently available, but still it may be worthwhile to use _setjmp or sigsetjmp
+ * conveniently available, but still it may be worthwhile to use _setjmp or sigsetjmp
* in place of plain setjmp. These macros will make it easier. It is useless
* to fiddle with these if you define JPEG_ENCAP_EXTERNAL.
* OJPEG_BUFFER: Define the size of the desired buffer here. Should be small enough so as to guarantee
@@ -200,7 +200,7 @@ static const TIFFField ojpegFields[] = {
Libjpeg's jmorecfg.h defines INT16 and INT32, but only if XMD_H is
not defined. Unfortunately, the MinGW and Borland compilers include
a typedef for INT32, which causes a conflict. MSVC does not include
- a conficting typedef given the headers which are included.
+ a conflicting typedef given the headers which are included.
*/
#if defined(__BORLANDC__) || defined(__MINGW32__)
# define XMD_H 1
@@ -253,6 +253,7 @@ typedef enum {
typedef struct {
TIFF* tif;
+ int decoder_ok;
#ifndef LIBJPEG_ENCAP_EXTERNAL
JMP_BUF exit_jmpbuf;
#endif
@@ -731,6 +732,7 @@ OJPEGPreDecode(TIFF* tif, uint16 s)
}
sp->write_curstrile++;
}
+ sp->decoder_ok = 1;
return(1);
}
@@ -793,8 +795,14 @@ OJPEGPreDecodeSkipScanlines(TIFF* tif)
static int
OJPEGDecode(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s)
{
+ static const char module[]="OJPEGDecode";
OJPEGState* sp=(OJPEGState*)tif->tif_data;
(void)s;
+ if( !sp->decoder_ok )
+ {
+ TIFFErrorExt(tif->tif_clientdata,module,"Cannot decode: decoder not correctly initialized");
+ return 0;
+ }
if (sp->libjpeg_jpeg_query_style==0)
{
if (OJPEGDecodeRaw(tif,buf,cc)==0)
@@ -1090,7 +1098,7 @@ OJPEGReadHeaderInfo(TIFF* tif)
TIFFErrorExt(tif->tif_clientdata,module,"Incompatible vertical subsampling and image strip/tile length");
return(0);
}
- sp->restart_interval=((sp->strile_width+sp->subsampling_hor*8-1)/(sp->subsampling_hor*8))*(sp->strile_length/(sp->subsampling_ver*8));
+ sp->restart_interval=(uint16)(((sp->strile_width+sp->subsampling_hor*8-1)/(sp->subsampling_hor*8))*(sp->strile_length/(sp->subsampling_ver*8)));
}
if (OJPEGReadHeaderInfoSec(tif)==0)
return(0);
@@ -1112,7 +1120,7 @@ OJPEGReadSecondarySos(TIFF* tif, uint16 s)
assert(s<3);
assert(sp->sos_end[0].log!=0);
assert(sp->sos_end[s].log==0);
- sp->plane_sample_offset=s-1;
+ sp->plane_sample_offset=(uint8)(s-1);
while(sp->sos_end[sp->plane_sample_offset].log==0)
sp->plane_sample_offset--;
sp->in_buffer_source=sp->sos_end[sp->plane_sample_offset].in_buffer_source;
@@ -1390,7 +1398,8 @@ OJPEGReadHeaderInfoSec(TIFF* tif)
static int
OJPEGReadHeaderInfoSecStreamDri(TIFF* tif)
{
- /* this could easilly cause trouble in some cases... but no such cases have occured sofar */
+ /* This could easily cause trouble in some cases... but no such cases have
+ occurred so far */
static const char module[]="OJPEGReadHeaderInfoSecStreamDri";
OJPEGState* sp=(OJPEGState*)tif->tif_data;
uint16 m;
@@ -1788,7 +1797,7 @@ OJPEGReadHeaderInfoSecTablesQTable(TIFF* tif)
ob[sizeof(uint32)+3]=67;
ob[sizeof(uint32)+4]=m;
TIFFSeekFile(tif,sp->qtable_offset[m],SEEK_SET);
- p=TIFFReadFile(tif,&ob[sizeof(uint32)+5],64);
+ p=(uint32)TIFFReadFile(tif,&ob[sizeof(uint32)+5],64);
if (p!=64)
{
_TIFFfree(ob);
@@ -1836,7 +1845,7 @@ OJPEGReadHeaderInfoSecTablesDcTable(TIFF* tif)
}
}
TIFFSeekFile(tif,sp->dctable_offset[m],SEEK_SET);
- p=TIFFReadFile(tif,o,16);
+ p=(uint32)TIFFReadFile(tif,o,16);
if (p!=16)
return(0);
q=0;
@@ -1852,12 +1861,12 @@ OJPEGReadHeaderInfoSecTablesDcTable(TIFF* tif)
*(uint32*)rb=ra;
rb[sizeof(uint32)]=255;
rb[sizeof(uint32)+1]=JPEG_MARKER_DHT;
- rb[sizeof(uint32)+2]=((19+q)>>8);
+ rb[sizeof(uint32)+2]=(uint8)((19+q)>>8);
rb[sizeof(uint32)+3]=((19+q)&255);
rb[sizeof(uint32)+4]=m;
for (n=0; n<16; n++)
rb[sizeof(uint32)+5+n]=o[n];
- p=TIFFReadFile(tif,&(rb[sizeof(uint32)+21]),q);
+ p=(uint32)TIFFReadFile(tif,&(rb[sizeof(uint32)+21]),q);
if (p!=q)
{
_TIFFfree(rb);
@@ -1905,7 +1914,7 @@ OJPEGReadHeaderInfoSecTablesAcTable(TIFF* tif)
}
}
TIFFSeekFile(tif,sp->actable_offset[m],SEEK_SET);
- p=TIFFReadFile(tif,o,16);
+ p=(uint32)TIFFReadFile(tif,o,16);
if (p!=16)
return(0);
q=0;
@@ -1921,12 +1930,12 @@ OJPEGReadHeaderInfoSecTablesAcTable(TIFF* tif)
*(uint32*)rb=ra;
rb[sizeof(uint32)]=255;
rb[sizeof(uint32)+1]=JPEG_MARKER_DHT;
- rb[sizeof(uint32)+2]=((19+q)>>8);
+ rb[sizeof(uint32)+2]=(uint8)((19+q)>>8);
rb[sizeof(uint32)+3]=((19+q)&255);
rb[sizeof(uint32)+4]=(16|m);
for (n=0; n<16; n++)
rb[sizeof(uint32)+5+n]=o[n];
- p=TIFFReadFile(tif,&(rb[sizeof(uint32)+21]),q);
+ p=(uint32)TIFFReadFile(tif,&(rb[sizeof(uint32)+21]),q);
if (p!=q)
{
_TIFFfree(rb);
@@ -2293,10 +2302,10 @@ OJPEGWriteStreamSof(TIFF* tif, void** mem, uint32* len)
/* P */
sp->out_buffer[4]=8;
/* Y */
- sp->out_buffer[5]=(sp->sof_y>>8);
+ sp->out_buffer[5]=(uint8)(sp->sof_y>>8);
sp->out_buffer[6]=(sp->sof_y&255);
/* X */
- sp->out_buffer[7]=(sp->sof_x>>8);
+ sp->out_buffer[7]=(uint8)(sp->sof_x>>8);
sp->out_buffer[8]=(sp->sof_x&255);
/* Nf */
sp->out_buffer[9]=sp->samples_per_pixel_per_plane;
@@ -2409,7 +2418,12 @@ OJPEGWriteStreamEoi(TIFF* tif, void** mem, uint32* len)
static int
jpeg_create_decompress_encap(OJPEGState* sp, jpeg_decompress_struct* cinfo)
{
- return(SETJMP(sp->exit_jmpbuf)?0:(jpeg_create_decompress(cinfo),1));
+ if( SETJMP(sp->exit_jmpbuf) )
+ return 0;
+ else {
+ jpeg_create_decompress(cinfo);
+ return 1;
+ }
}
#endif
@@ -2417,7 +2431,12 @@ jpeg_create_decompress_encap(OJPEGState* sp, jpeg_decompress_struct* cinfo)
static int
jpeg_read_header_encap(OJPEGState* sp, jpeg_decompress_struct* cinfo, uint8 require_image)
{
- return(SETJMP(sp->exit_jmpbuf)?0:(jpeg_read_header(cinfo,require_image),1));
+ if( SETJMP(sp->exit_jmpbuf) )
+ return 0;
+ else {
+ jpeg_read_header(cinfo,require_image);
+ return 1;
+ }
}
#endif
@@ -2425,7 +2444,12 @@ jpeg_read_header_encap(OJPEGState* sp, jpeg_decompress_struct* cinfo, uint8 requ
static int
jpeg_start_decompress_encap(OJPEGState* sp, jpeg_decompress_struct* cinfo)
{
- return(SETJMP(sp->exit_jmpbuf)?0:(jpeg_start_decompress(cinfo),1));
+ if( SETJMP(sp->exit_jmpbuf) )
+ return 0;
+ else {
+ jpeg_start_decompress(cinfo);
+ return 1;
+ }
}
#endif
@@ -2433,7 +2457,12 @@ jpeg_start_decompress_encap(OJPEGState* sp, jpeg_decompress_struct* cinfo)
static int
jpeg_read_scanlines_encap(OJPEGState* sp, jpeg_decompress_struct* cinfo, void* scanlines, uint32 max_lines)
{
- return(SETJMP(sp->exit_jmpbuf)?0:(jpeg_read_scanlines(cinfo,scanlines,max_lines),1));
+ if( SETJMP(sp->exit_jmpbuf) )
+ return 0;
+ else {
+ jpeg_read_scanlines(cinfo,scanlines,max_lines);
+ return 1;
+ }
}
#endif
@@ -2441,7 +2470,12 @@ jpeg_read_scanlines_encap(OJPEGState* sp, jpeg_decompress_struct* cinfo, void* s
static int
jpeg_read_raw_data_encap(OJPEGState* sp, jpeg_decompress_struct* cinfo, void* data, uint32 max_lines)
{
- return(SETJMP(sp->exit_jmpbuf)?0:(jpeg_read_raw_data(cinfo,data,max_lines),1));
+ if( SETJMP(sp->exit_jmpbuf) )
+ return 0;
+ else {
+ jpeg_read_raw_data(cinfo,data,max_lines);
+ return 1;
+ }
}
#endif
@@ -2503,6 +2537,10 @@ OJPEGLibjpegJpegSourceMgrSkipInputData(jpeg_decompress_struct* cinfo, long num_b
jpeg_encap_unwind(tif);
}
+#ifdef _MSC_VER
+#pragma warning( push )
+#pragma warning( disable : 4702 ) /* unreachable code */
+#endif
static boolean
OJPEGLibjpegJpegSourceMgrResyncToRestart(jpeg_decompress_struct* cinfo, int desired)
{
@@ -2512,6 +2550,9 @@ OJPEGLibjpegJpegSourceMgrResyncToRestart(jpeg_decompress_struct* cinfo, int desi
jpeg_encap_unwind(tif);
return(0);
}
+#ifdef _MSC_VER
+#pragma warning( pop )
+#endif
static void
OJPEGLibjpegJpegSourceMgrTermSource(jpeg_decompress_struct* cinfo)
diff --git a/chromium/third_party/pdfium/third_party/libtiff/tif_open.c b/chromium/third_party/pdfium/third_party/libtiff/tif_open.c
index 8c88328cf28..5c9036e6b4f 100644
--- a/chromium/third_party/pdfium/third_party/libtiff/tif_open.c
+++ b/chromium/third_party/pdfium/third_party/libtiff/tif_open.c
@@ -1,4 +1,4 @@
-/* $Id: tif_open.c,v 1.46 2010-12-06 16:54:54 faxguy Exp $ */
+/* $Id: tif_open.c,v 1.47 2016-01-23 21:20:34 erouault Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@@ -168,7 +168,7 @@ TIFFClientOpen(
* The following flags may be used to control intrinsic library
* behaviour that may or may not be desirable (usually for
* compatibility with some application that claims to support
- * TIFF but only supports some braindead idea of what the
+ * TIFF but only supports some brain dead idea of what the
* vendor thinks TIFF is):
*
* 'l' use little-endian byte order for creating a file
@@ -198,8 +198,8 @@ TIFFClientOpen(
* The 'L', 'B', and 'H' flags are intended for applications
* that can optimize operations on data by using a particular
* bit order. By default the library returns data in MSB2LSB
- * bit order for compatibiltiy with older versions of this
- * library. Returning data in the bit order of the native cpu
+ * bit order for compatibility with older versions of this
+ * library. Returning data in the bit order of the native CPU
* makes the most sense but also requires applications to check
* the value of the FillOrder tag; something they probably do
* not do right now.
diff --git a/chromium/third_party/pdfium/third_party/libtiff/tif_packbits.c b/chromium/third_party/pdfium/third_party/libtiff/tif_packbits.c
index 9e77190131e..d2a0165de9d 100644
--- a/chromium/third_party/pdfium/third_party/libtiff/tif_packbits.c
+++ b/chromium/third_party/pdfium/third_party/libtiff/tif_packbits.c
@@ -1,4 +1,4 @@
-/* $Id: tif_packbits.c,v 1.22 2012-06-20 05:25:33 fwarmerdam Exp $ */
+/* $Id: tif_packbits.c,v 1.24 2016-09-04 21:32:56 erouault Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@@ -38,7 +38,8 @@ PackBitsPreEncode(TIFF* tif, uint16 s)
{
(void) s;
- if (!(tif->tif_data = (uint8*)_TIFFmalloc(sizeof(tmsize_t))))
+ tif->tif_data = (uint8*)_TIFFmalloc(sizeof(tmsize_t));
+ if (tif->tif_data == NULL)
return (0);
/*
* Calculate the scanline/tile-width size in bytes.
@@ -81,7 +82,9 @@ PackBitsEncode(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s)
/*
* Find the longest string of identical bytes.
*/
- b = *bp++, cc--, n = 1;
+ b = *bp++;
+ cc--;
+ n = 1;
for (; cc > 0 && b == *bp; cc--, bp++)
n++;
again:
@@ -222,7 +225,8 @@ PackBitsDecode(TIFF* tif, uint8* op, tmsize_t occ, uint16 s)
bp = (char*) tif->tif_rawcp;
cc = tif->tif_rawcc;
while (cc > 0 && occ > 0) {
- n = (long) *bp++, cc--;
+ n = (long) *bp++;
+ cc--;
/*
* Watch out for compilers that
* don't sign extend chars...
@@ -241,7 +245,8 @@ PackBitsDecode(TIFF* tif, uint8* op, tmsize_t occ, uint16 s)
n = (long)occ;
}
occ -= n;
- b = *bp++, cc--;
+ b = *bp++;
+ cc--;
while (n-- > 0)
*op++ = (uint8) b;
} else { /* copy next n+1 bytes literally */
diff --git a/chromium/third_party/pdfium/third_party/libtiff/tif_pixarlog.c b/chromium/third_party/pdfium/third_party/libtiff/tif_pixarlog.c
index 29535d31ee1..c2903bffef4 100644
--- a/chromium/third_party/pdfium/third_party/libtiff/tif_pixarlog.c
+++ b/chromium/third_party/pdfium/third_party/libtiff/tif_pixarlog.c
@@ -1,4 +1,4 @@
-/* $Id: tif_pixarlog.c,v 1.39 2012-12-10 17:27:13 tgl Exp $ */
+/* $Id: tif_pixarlog.c,v 1.48 2016-09-23 22:12:18 erouault Exp $ */
/*
* Copyright (c) 1996-1997 Sam Leffler
@@ -45,15 +45,15 @@
* input is assumed to be unsigned linear color values that represent
* the range 0-1. In the case of IEEE values, the 0-1 range is assumed to
* be the normal linear color range, in addition over 1 values are
- * accepted up to a value of about 25.0 to encode "hot" hightlights and such.
+ * accepted up to a value of about 25.0 to encode "hot" highlights and such.
* The encoding is lossless for 8-bit values, slightly lossy for the
* other bit depths. The actual color precision should be better
* than the human eye can perceive with extra room to allow for
* error introduced by further image computation. As with any quantized
* color format, it is possible to perform image calculations which
* expose the quantization error. This format should certainly be less
- * susceptable to such errors than standard 8-bit encodings, but more
- * susceptable than straight 16-bit or 32-bit encodings.
+ * susceptible to such errors than standard 8-bit encodings, but more
+ * susceptible than straight 16-bit or 32-bit encodings.
*
* On reading the internal format is converted to the desired output format.
* The program can request which format it desires by setting the internal
@@ -90,7 +90,7 @@
*/
#include "tif_predict.h"
-#include "../zlib_v128/zlib.h"
+#include "zlib.h"
#include <stdio.h>
#include <stdlib.h>
@@ -296,33 +296,35 @@ horizontalAccumulate16(uint16 *wp, int n, int stride, uint16 *op,
static void
horizontalAccumulate11(uint16 *wp, int n, int stride, uint16 *op)
{
- register unsigned int cr, cg, cb, ca, mask;
+ register unsigned int cr, cg, cb, ca, mask;
if (n >= stride) {
mask = CODE_MASK;
if (stride == 3) {
- op[0] = cr = wp[0]; op[1] = cg = wp[1]; op[2] = cb = wp[2];
+ op[0] = wp[0]; op[1] = wp[1]; op[2] = wp[2];
+ cr = wp[0]; cg = wp[1]; cb = wp[2];
n -= 3;
while (n > 0) {
wp += 3;
op += 3;
n -= 3;
- op[0] = (cr += wp[0]) & mask;
- op[1] = (cg += wp[1]) & mask;
- op[2] = (cb += wp[2]) & mask;
+ op[0] = (uint16)((cr += wp[0]) & mask);
+ op[1] = (uint16)((cg += wp[1]) & mask);
+ op[2] = (uint16)((cb += wp[2]) & mask);
}
} else if (stride == 4) {
- op[0] = cr = wp[0]; op[1] = cg = wp[1];
- op[2] = cb = wp[2]; op[3] = ca = wp[3];
+ op[0] = wp[0]; op[1] = wp[1];
+ op[2] = wp[2]; op[3] = wp[3];
+ cr = wp[0]; cg = wp[1]; cb = wp[2]; ca = wp[3];
n -= 4;
while (n > 0) {
wp += 4;
op += 4;
n -= 4;
- op[0] = (cr += wp[0]) & mask;
- op[1] = (cg += wp[1]) & mask;
- op[2] = (cb += wp[2]) & mask;
- op[3] = (ca += wp[3]) & mask;
+ op[0] = (uint16)((cr += wp[0]) & mask);
+ op[1] = (uint16)((cg += wp[1]) & mask);
+ op[2] = (uint16)((cb += wp[2]) & mask);
+ op[3] = (uint16)((ca += wp[3]) & mask);
}
} else {
REPEAT(stride, *op = *wp&mask; wp++; op++)
@@ -557,7 +559,7 @@ PixarLogMakeTables(PixarLogState *sp)
for (i = 0; i < lt2size; i++) {
if ((i*linstep)*(i*linstep) > ToLinearF[j]*ToLinearF[j+1])
j++;
- FromLT2[i] = j;
+ FromLT2[i] = (uint16)j;
}
/*
@@ -569,14 +571,14 @@ PixarLogMakeTables(PixarLogState *sp)
for (i = 0; i < 16384; i++) {
while ((i/16383.)*(i/16383.) > ToLinearF[j]*ToLinearF[j+1])
j++;
- From14[i] = j;
+ From14[i] = (uint16)j;
}
j = 0;
for (i = 0; i < 256; i++) {
while ((i/255.)*(i/255.) > ToLinearF[j]*ToLinearF[j+1])
j++;
- From8[i] = j;
+ From8[i] = (uint16)j;
}
Fltsize = (float)(lt2size/2);
@@ -704,7 +706,7 @@ PixarLogSetupDecode(TIFF* tif)
}
if (inflateInit(&sp->stream) != Z_OK) {
- TIFFErrorExt(tif->tif_clientdata, module, "%s", sp->stream.msg);
+ TIFFErrorExt(tif->tif_clientdata, module, "%s", sp->stream.msg ? sp->stream.msg : "(null)");
return (0);
} else {
sp->state |= PLSTATE_INIT;
@@ -727,7 +729,7 @@ PixarLogPreDecode(TIFF* tif, uint16 s)
assert(sizeof(sp->stream.avail_in)==4); /* if this assert gets raised,
we need to simplify this code to reflect a ZLib that is likely updated
to deal with 8byte memory sizes, though this code will respond
- apropriately even before we simplify it */
+ appropriately even before we simplify it */
sp->stream.avail_in = (uInt) tif->tif_rawcc;
if ((tmsize_t)sp->stream.avail_in != tif->tif_rawcc)
{
@@ -776,7 +778,7 @@ PixarLogDecode(TIFF* tif, uint8* op, tmsize_t occ, uint16 s)
assert(sizeof(sp->stream.avail_out)==4); /* if this assert gets raised,
we need to simplify this code to reflect a ZLib that is likely updated
to deal with 8byte memory sizes, though this code will respond
- apropriately even before we simplify it */
+ appropriately even before we simplify it */
sp->stream.avail_out = (uInt) (nsamples * sizeof(uint16));
if (sp->stream.avail_out != nsamples * sizeof(uint16))
{
@@ -797,14 +799,14 @@ PixarLogDecode(TIFF* tif, uint8* op, tmsize_t occ, uint16 s)
if (state == Z_DATA_ERROR) {
TIFFErrorExt(tif->tif_clientdata, module,
"Decoding error at scanline %lu, %s",
- (unsigned long) tif->tif_row, sp->stream.msg);
+ (unsigned long) tif->tif_row, sp->stream.msg ? sp->stream.msg : "(null)");
if (inflateSync(&sp->stream) != Z_OK)
return (0);
continue;
}
if (state != Z_OK) {
TIFFErrorExt(tif->tif_clientdata, module, "ZLib error: %s",
- sp->stream.msg);
+ sp->stream.msg ? sp->stream.msg : "(null)");
return (0);
}
} while (sp->stream.avail_out > 0);
@@ -906,7 +908,7 @@ PixarLogSetupEncode(TIFF* tif)
}
if (deflateInit(&sp->stream, sp->quality) != Z_OK) {
- TIFFErrorExt(tif->tif_clientdata, module, "%s", sp->stream.msg);
+ TIFFErrorExt(tif->tif_clientdata, module, "%s", sp->stream.msg ? sp->stream.msg : "(null)");
return (0);
} else {
sp->state |= PLSTATE_INIT;
@@ -929,8 +931,8 @@ PixarLogPreEncode(TIFF* tif, uint16 s)
assert(sizeof(sp->stream.avail_out)==4); /* if this assert gets raised,
we need to simplify this code to reflect a ZLib that is likely updated
to deal with 8byte memory sizes, though this code will respond
- apropriately even before we simplify it */
- sp->stream.avail_out = tif->tif_rawdatasize;
+ appropriately even before we simplify it */
+ sp->stream.avail_out = (uInt)tif->tif_rawdatasize;
if ((tmsize_t)sp->stream.avail_out != tif->tif_rawdatasize)
{
TIFFErrorExt(tif->tif_clientdata, module, "ZLib cannot deal with buffers this size");
@@ -961,9 +963,9 @@ horizontalDifferenceF(float *ip, int n, int stride, uint16 *wp, uint16 *FromLT2)
n -= 3;
wp += 3;
ip += 3;
- r1 = (int32) CLAMP(ip[0]); wp[0] = (r1-r2) & mask; r2 = r1;
- g1 = (int32) CLAMP(ip[1]); wp[1] = (g1-g2) & mask; g2 = g1;
- b1 = (int32) CLAMP(ip[2]); wp[2] = (b1-b2) & mask; b2 = b1;
+ r1 = (int32) CLAMP(ip[0]); wp[0] = (uint16)((r1-r2) & mask); r2 = r1;
+ g1 = (int32) CLAMP(ip[1]); wp[1] = (uint16)((g1-g2) & mask); g2 = g1;
+ b1 = (int32) CLAMP(ip[2]); wp[2] = (uint16)((b1-b2) & mask); b2 = b1;
}
} else if (stride == 4) {
r2 = wp[0] = (uint16) CLAMP(ip[0]);
@@ -975,23 +977,20 @@ horizontalDifferenceF(float *ip, int n, int stride, uint16 *wp, uint16 *FromLT2)
n -= 4;
wp += 4;
ip += 4;
- r1 = (int32) CLAMP(ip[0]); wp[0] = (r1-r2) & mask; r2 = r1;
- g1 = (int32) CLAMP(ip[1]); wp[1] = (g1-g2) & mask; g2 = g1;
- b1 = (int32) CLAMP(ip[2]); wp[2] = (b1-b2) & mask; b2 = b1;
- a1 = (int32) CLAMP(ip[3]); wp[3] = (a1-a2) & mask; a2 = a1;
+ r1 = (int32) CLAMP(ip[0]); wp[0] = (uint16)((r1-r2) & mask); r2 = r1;
+ g1 = (int32) CLAMP(ip[1]); wp[1] = (uint16)((g1-g2) & mask); g2 = g1;
+ b1 = (int32) CLAMP(ip[2]); wp[2] = (uint16)((b1-b2) & mask); b2 = b1;
+ a1 = (int32) CLAMP(ip[3]); wp[3] = (uint16)((a1-a2) & mask); a2 = a1;
}
} else {
- ip += n - 1; /* point to last one */
- wp += n - 1; /* point to last one */
- n -= stride;
- while (n > 0) {
- REPEAT(stride, wp[0] = (uint16) CLAMP(ip[0]);
- wp[stride] -= wp[0];
- wp[stride] &= mask;
- wp--; ip--)
- n -= stride;
- }
- REPEAT(stride, wp[0] = (uint16) CLAMP(ip[0]); wp--; ip--)
+ REPEAT(stride, wp[0] = (uint16) CLAMP(ip[0]); wp++; ip++)
+ n -= stride;
+ while (n > 0) {
+ REPEAT(stride,
+ wp[0] = (uint16)(((int32)CLAMP(ip[0])-(int32)CLAMP(ip[-stride])) & mask);
+ wp++; ip++)
+ n -= stride;
+ }
}
}
}
@@ -1016,9 +1015,9 @@ horizontalDifference16(unsigned short *ip, int n, int stride,
n -= 3;
wp += 3;
ip += 3;
- r1 = CLAMP(ip[0]); wp[0] = (r1-r2) & mask; r2 = r1;
- g1 = CLAMP(ip[1]); wp[1] = (g1-g2) & mask; g2 = g1;
- b1 = CLAMP(ip[2]); wp[2] = (b1-b2) & mask; b2 = b1;
+ r1 = CLAMP(ip[0]); wp[0] = (uint16)((r1-r2) & mask); r2 = r1;
+ g1 = CLAMP(ip[1]); wp[1] = (uint16)((g1-g2) & mask); g2 = g1;
+ b1 = CLAMP(ip[2]); wp[2] = (uint16)((b1-b2) & mask); b2 = b1;
}
} else if (stride == 4) {
r2 = wp[0] = CLAMP(ip[0]); g2 = wp[1] = CLAMP(ip[1]);
@@ -1028,23 +1027,20 @@ horizontalDifference16(unsigned short *ip, int n, int stride,
n -= 4;
wp += 4;
ip += 4;
- r1 = CLAMP(ip[0]); wp[0] = (r1-r2) & mask; r2 = r1;
- g1 = CLAMP(ip[1]); wp[1] = (g1-g2) & mask; g2 = g1;
- b1 = CLAMP(ip[2]); wp[2] = (b1-b2) & mask; b2 = b1;
- a1 = CLAMP(ip[3]); wp[3] = (a1-a2) & mask; a2 = a1;
+ r1 = CLAMP(ip[0]); wp[0] = (uint16)((r1-r2) & mask); r2 = r1;
+ g1 = CLAMP(ip[1]); wp[1] = (uint16)((g1-g2) & mask); g2 = g1;
+ b1 = CLAMP(ip[2]); wp[2] = (uint16)((b1-b2) & mask); b2 = b1;
+ a1 = CLAMP(ip[3]); wp[3] = (uint16)((a1-a2) & mask); a2 = a1;
}
} else {
- ip += n - 1; /* point to last one */
- wp += n - 1; /* point to last one */
+ REPEAT(stride, wp[0] = CLAMP(ip[0]); wp++; ip++)
n -= stride;
while (n > 0) {
- REPEAT(stride, wp[0] = CLAMP(ip[0]);
- wp[stride] -= wp[0];
- wp[stride] &= mask;
- wp--; ip--)
- n -= stride;
- }
- REPEAT(stride, wp[0] = CLAMP(ip[0]); wp--; ip--)
+ REPEAT(stride,
+ wp[0] = (uint16)((CLAMP(ip[0])-CLAMP(ip[-stride])) & mask);
+ wp++; ip++)
+ n -= stride;
+ }
}
}
}
@@ -1067,9 +1063,9 @@ horizontalDifference8(unsigned char *ip, int n, int stride,
n -= 3;
while (n > 0) {
n -= 3;
- r1 = CLAMP(ip[3]); wp[3] = (r1-r2) & mask; r2 = r1;
- g1 = CLAMP(ip[4]); wp[4] = (g1-g2) & mask; g2 = g1;
- b1 = CLAMP(ip[5]); wp[5] = (b1-b2) & mask; b2 = b1;
+ r1 = CLAMP(ip[3]); wp[3] = (uint16)((r1-r2) & mask); r2 = r1;
+ g1 = CLAMP(ip[4]); wp[4] = (uint16)((g1-g2) & mask); g2 = g1;
+ b1 = CLAMP(ip[5]); wp[5] = (uint16)((b1-b2) & mask); b2 = b1;
wp += 3;
ip += 3;
}
@@ -1079,26 +1075,23 @@ horizontalDifference8(unsigned char *ip, int n, int stride,
n -= 4;
while (n > 0) {
n -= 4;
- r1 = CLAMP(ip[4]); wp[4] = (r1-r2) & mask; r2 = r1;
- g1 = CLAMP(ip[5]); wp[5] = (g1-g2) & mask; g2 = g1;
- b1 = CLAMP(ip[6]); wp[6] = (b1-b2) & mask; b2 = b1;
- a1 = CLAMP(ip[7]); wp[7] = (a1-a2) & mask; a2 = a1;
+ r1 = CLAMP(ip[4]); wp[4] = (uint16)((r1-r2) & mask); r2 = r1;
+ g1 = CLAMP(ip[5]); wp[5] = (uint16)((g1-g2) & mask); g2 = g1;
+ b1 = CLAMP(ip[6]); wp[6] = (uint16)((b1-b2) & mask); b2 = b1;
+ a1 = CLAMP(ip[7]); wp[7] = (uint16)((a1-a2) & mask); a2 = a1;
wp += 4;
ip += 4;
}
} else {
- wp += n + stride - 1; /* point to last one */
- ip += n + stride - 1; /* point to last one */
- n -= stride;
- while (n > 0) {
- REPEAT(stride, wp[0] = CLAMP(ip[0]);
- wp[stride] -= wp[0];
- wp[stride] &= mask;
- wp--; ip--)
- n -= stride;
- }
- REPEAT(stride, wp[0] = CLAMP(ip[0]); wp--; ip--)
- }
+ REPEAT(stride, wp[0] = CLAMP(ip[0]); wp++; ip++)
+ n -= stride;
+ while (n > 0) {
+ REPEAT(stride,
+ wp[0] = (uint16)((CLAMP(ip[0])-CLAMP(ip[-stride])) & mask);
+ wp++; ip++)
+ n -= stride;
+ }
+ }
}
}
@@ -1139,6 +1132,13 @@ PixarLogEncode(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
}
llen = sp->stride * td->td_imagewidth;
+ /* Check against the number of elements (of size uint16) of sp->tbuf */
+ if( n > (tmsize_t)(td->td_rowsperstrip * llen) )
+ {
+ TIFFErrorExt(tif->tif_clientdata, module,
+ "Too many input bytes provided");
+ return 0;
+ }
for (i = 0, up = sp->tbuf; i < n; i += llen, up += llen) {
switch (sp->user_datafmt) {
@@ -1169,7 +1169,7 @@ PixarLogEncode(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
assert(sizeof(sp->stream.avail_in)==4); /* if this assert gets raised,
we need to simplify this code to reflect a ZLib that is likely updated
to deal with 8byte memory sizes, though this code will respond
- apropriately even before we simplify it */
+ appropriately even before we simplify it */
sp->stream.avail_in = (uInt) (n * sizeof(uint16));
if ((sp->stream.avail_in / sizeof(uint16)) != (uInt) n)
{
@@ -1181,7 +1181,7 @@ PixarLogEncode(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
do {
if (deflate(&sp->stream, Z_NO_FLUSH) != Z_OK) {
TIFFErrorExt(tif->tif_clientdata, module, "Encoder error: %s",
- sp->stream.msg);
+ sp->stream.msg ? sp->stream.msg : "(null)");
return (0);
}
if (sp->stream.avail_out == 0) {
@@ -1223,7 +1223,7 @@ PixarLogPostEncode(TIFF* tif)
break;
default:
TIFFErrorExt(tif->tif_clientdata, module, "ZLib error: %s",
- sp->stream.msg);
+ sp->stream.msg ? sp->stream.msg : "(null)");
return (0);
}
} while (state != Z_STREAM_END);
@@ -1233,9 +1233,11 @@ PixarLogPostEncode(TIFF* tif)
static void
PixarLogClose(TIFF* tif)
{
+ PixarLogState* sp = (PixarLogState*) tif->tif_data;
TIFFDirectory *td = &tif->tif_dir;
- /* In a really sneaky (and really incorrect, and untruthfull, and
+ assert(sp != 0);
+ /* In a really sneaky (and really incorrect, and untruthful, and
* troublesome, and error-prone) maneuver that completely goes against
* the spirit of TIFF, and breaks TIFF, on close, we covertly
* modify both bitspersample and sampleformat in the directory to
@@ -1243,8 +1245,19 @@ PixarLogClose(TIFF* tif)
* readers that don't know about PixarLog, or how to set
* the PIXARLOGDATFMT pseudo-tag.
*/
- td->td_bitspersample = 8;
- td->td_sampleformat = SAMPLEFORMAT_UINT;
+
+ if (sp->state&PLSTATE_INIT) {
+ /* We test the state to avoid an issue such as in
+ * http://bugzilla.maptools.org/show_bug.cgi?id=2604
+ * What appends in that case is that the bitspersample is 1 and
+ * a TransferFunction is set. The size of the TransferFunction
+ * depends on 1<<bitspersample. So if we increase it, an access
+ * out of the buffer will happen at directory flushing.
+ * Another option would be to clear those targs.
+ */
+ td->td_bitspersample = 8;
+ td->td_sampleformat = SAMPLEFORMAT_UINT;
+ }
}
static void
@@ -1293,7 +1306,7 @@ PixarLogVSetField(TIFF* tif, uint32 tag, va_list ap)
if (deflateParams(&sp->stream,
sp->quality, Z_DEFAULT_STRATEGY) != Z_OK) {
TIFFErrorExt(tif->tif_clientdata, module, "ZLib error: %s",
- sp->stream.msg);
+ sp->stream.msg ? sp->stream.msg : "(null)");
return (0);
}
}
diff --git a/chromium/third_party/pdfium/third_party/libtiff/tif_predict.c b/chromium/third_party/pdfium/third_party/libtiff/tif_predict.c
index 8975672aec9..1bb78e2097a 100644
--- a/chromium/third_party/pdfium/third_party/libtiff/tif_predict.c
+++ b/chromium/third_party/pdfium/third_party/libtiff/tif_predict.c
@@ -1,4 +1,4 @@
-/* $Id: tif_predict.c,v 1.35 2015-08-31 15:05:57 erouault Exp $ */
+/* $Id: tif_predict.c,v 1.40 2016-11-04 09:19:13 erouault Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@@ -34,18 +34,18 @@
#define PredictorState(tif) ((TIFFPredictorState*) (tif)->tif_data)
-static void horAcc8(TIFF* tif, uint8* cp0, tmsize_t cc);
-static void horAcc16(TIFF* tif, uint8* cp0, tmsize_t cc);
-static void horAcc32(TIFF* tif, uint8* cp0, tmsize_t cc);
-static void swabHorAcc16(TIFF* tif, uint8* cp0, tmsize_t cc);
-static void swabHorAcc32(TIFF* tif, uint8* cp0, tmsize_t cc);
-static void horDiff8(TIFF* tif, uint8* cp0, tmsize_t cc);
-static void horDiff16(TIFF* tif, uint8* cp0, tmsize_t cc);
-static void horDiff32(TIFF* tif, uint8* cp0, tmsize_t cc);
-static void swabHorDiff16(TIFF* tif, uint8* cp0, tmsize_t cc);
-static void swabHorDiff32(TIFF* tif, uint8* cp0, tmsize_t cc);
-static void fpAcc(TIFF* tif, uint8* cp0, tmsize_t cc);
-static void fpDiff(TIFF* tif, uint8* cp0, tmsize_t cc);
+static int horAcc8(TIFF* tif, uint8* cp0, tmsize_t cc);
+static int horAcc16(TIFF* tif, uint8* cp0, tmsize_t cc);
+static int horAcc32(TIFF* tif, uint8* cp0, tmsize_t cc);
+static int swabHorAcc16(TIFF* tif, uint8* cp0, tmsize_t cc);
+static int swabHorAcc32(TIFF* tif, uint8* cp0, tmsize_t cc);
+static int horDiff8(TIFF* tif, uint8* cp0, tmsize_t cc);
+static int horDiff16(TIFF* tif, uint8* cp0, tmsize_t cc);
+static int horDiff32(TIFF* tif, uint8* cp0, tmsize_t cc);
+static int swabHorDiff16(TIFF* tif, uint8* cp0, tmsize_t cc);
+static int swabHorDiff32(TIFF* tif, uint8* cp0, tmsize_t cc);
+static int fpAcc(TIFF* tif, uint8* cp0, tmsize_t cc);
+static int fpDiff(TIFF* tif, uint8* cp0, tmsize_t cc);
static int PredictorDecodeRow(TIFF* tif, uint8* op0, tmsize_t occ0, uint16 s);
static int PredictorDecodeTile(TIFF* tif, uint8* op0, tmsize_t occ0, uint16 s);
static int PredictorEncodeRow(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s);
@@ -80,6 +80,15 @@ PredictorSetup(TIFF* tif)
td->td_sampleformat);
return 0;
}
+ if (td->td_bitspersample != 16
+ && td->td_bitspersample != 24
+ && td->td_bitspersample != 32
+ && td->td_bitspersample != 64) { /* Should 64 be allowed? */
+ TIFFErrorExt(tif->tif_clientdata, module,
+ "Floating point \"Predictor\" not supported with %d-bit samples",
+ td->td_bitspersample);
+ return 0;
+ }
break;
default:
TIFFErrorExt(tif->tif_clientdata, module,
@@ -177,7 +186,7 @@ PredictorSetupDecode(TIFF* tif)
}
/*
* Allocate buffer to keep the decoded bytes before
- * rearranging in the ight order
+ * rearranging in the right order
*/
}
@@ -216,7 +225,7 @@ PredictorSetupEncode(TIFF* tif)
/*
* If the data is horizontally differenced 16-bit data that
* requires byte-swapping, then it must be byte swapped after
- * the differenciation step. We do this with a special-purpose
+ * the differentiation step. We do this with a special-purpose
* routine and override the normal post decoding logic that
* the library setup when the directory was read.
*/
@@ -267,13 +276,19 @@ PredictorSetupEncode(TIFF* tif)
/* - when storing into the byte stream, we explicitly mask with 0xff so */
/* as to make icc -check=conversions happy (not necessary by the standard) */
-static void
+static int
horAcc8(TIFF* tif, uint8* cp0, tmsize_t cc)
{
tmsize_t stride = PredictorState(tif)->stride;
unsigned char* cp = (unsigned char*) cp0;
- assert((cc%stride)==0);
+ if((cc%stride)!=0)
+ {
+ TIFFErrorExt(tif->tif_clientdata, "horAcc8",
+ "%s", "(cc%stride)!=0");
+ return 0;
+ }
+
if (cc > stride) {
/*
* Pipeline the most common cases.
@@ -315,26 +330,32 @@ horAcc8(TIFF* tif, uint8* cp0, tmsize_t cc)
} while (cc>0);
}
}
+ return 1;
}
-static void
+static int
swabHorAcc16(TIFF* tif, uint8* cp0, tmsize_t cc)
{
uint16* wp = (uint16*) cp0;
tmsize_t wc = cc / 2;
TIFFSwabArrayOfShort(wp, wc);
- horAcc16(tif, cp0, cc);
+ return horAcc16(tif, cp0, cc);
}
-static void
+static int
horAcc16(TIFF* tif, uint8* cp0, tmsize_t cc)
{
tmsize_t stride = PredictorState(tif)->stride;
uint16* wp = (uint16*) cp0;
tmsize_t wc = cc / 2;
- assert((cc%(2*stride))==0);
+ if((cc%(2*stride))!=0)
+ {
+ TIFFErrorExt(tif->tif_clientdata, "horAcc16",
+ "%s", "cc%(2*stride))!=0");
+ return 0;
+ }
if (wc > stride) {
wc -= stride;
@@ -343,26 +364,32 @@ horAcc16(TIFF* tif, uint8* cp0, tmsize_t cc)
wc -= stride;
} while (wc > 0);
}
+ return 1;
}
-static void
+static int
swabHorAcc32(TIFF* tif, uint8* cp0, tmsize_t cc)
{
uint32* wp = (uint32*) cp0;
tmsize_t wc = cc / 4;
TIFFSwabArrayOfLong(wp, wc);
- horAcc32(tif, cp0, cc);
+ return horAcc32(tif, cp0, cc);
}
-static void
+static int
horAcc32(TIFF* tif, uint8* cp0, tmsize_t cc)
{
tmsize_t stride = PredictorState(tif)->stride;
uint32* wp = (uint32*) cp0;
tmsize_t wc = cc / 4;
- assert((cc%(4*stride))==0);
+ if((cc%(4*stride))!=0)
+ {
+ TIFFErrorExt(tif->tif_clientdata, "horAcc32",
+ "%s", "cc%(4*stride))!=0");
+ return 0;
+ }
if (wc > stride) {
wc -= stride;
@@ -371,12 +398,13 @@ horAcc32(TIFF* tif, uint8* cp0, tmsize_t cc)
wc -= stride;
} while (wc > 0);
}
+ return 1;
}
/*
* Floating point predictor accumulation routine.
*/
-static void
+static int
fpAcc(TIFF* tif, uint8* cp0, tmsize_t cc)
{
tmsize_t stride = PredictorState(tif)->stride;
@@ -384,12 +412,18 @@ fpAcc(TIFF* tif, uint8* cp0, tmsize_t cc)
tmsize_t wc = cc / bps;
tmsize_t count = cc;
uint8 *cp = (uint8 *) cp0;
- uint8 *tmp = (uint8 *)_TIFFmalloc(cc);
+ uint8 *tmp;
- assert((cc%(bps*stride))==0);
+ if(cc%(bps*stride)!=0)
+ {
+ TIFFErrorExt(tif->tif_clientdata, "fpAcc",
+ "%s", "cc%(bps*stride))!=0");
+ return 0;
+ }
+ tmp = (uint8 *)_TIFFmalloc(cc);
if (!tmp)
- return;
+ return 0;
while (count > stride) {
REPEAT4(stride, cp[stride] =
@@ -411,6 +445,7 @@ fpAcc(TIFF* tif, uint8* cp0, tmsize_t cc)
}
}
_TIFFfree(tmp);
+ return 1;
}
/*
@@ -426,8 +461,7 @@ PredictorDecodeRow(TIFF* tif, uint8* op0, tmsize_t occ0, uint16 s)
assert(sp->decodepfunc != NULL);
if ((*sp->decoderow)(tif, op0, occ0, s)) {
- (*sp->decodepfunc)(tif, op0, occ0);
- return 1;
+ return (*sp->decodepfunc)(tif, op0, occ0);
} else
return 0;
}
@@ -450,10 +484,16 @@ PredictorDecodeTile(TIFF* tif, uint8* op0, tmsize_t occ0, uint16 s)
if ((*sp->decodetile)(tif, op0, occ0, s)) {
tmsize_t rowsize = sp->rowsize;
assert(rowsize > 0);
- assert((occ0%rowsize)==0);
+ if((occ0%rowsize) !=0)
+ {
+ TIFFErrorExt(tif->tif_clientdata, "PredictorDecodeTile",
+ "%s", "occ0%rowsize != 0");
+ return 0;
+ }
assert(sp->decodepfunc != NULL);
while (occ0 > 0) {
- (*sp->decodepfunc)(tif, op0, rowsize);
+ if( !(*sp->decodepfunc)(tif, op0, rowsize) )
+ return 0;
occ0 -= rowsize;
op0 += rowsize;
}
@@ -462,14 +502,19 @@ PredictorDecodeTile(TIFF* tif, uint8* op0, tmsize_t occ0, uint16 s)
return 0;
}
-static void
+static int
horDiff8(TIFF* tif, uint8* cp0, tmsize_t cc)
{
TIFFPredictorState* sp = PredictorState(tif);
tmsize_t stride = sp->stride;
unsigned char* cp = (unsigned char*) cp0;
- assert((cc%stride)==0);
+ if((cc%stride)!=0)
+ {
+ TIFFErrorExt(tif->tif_clientdata, "horDiff8",
+ "%s", "(cc%stride)!=0");
+ return 0;
+ }
if (cc > stride) {
cc -= stride;
@@ -507,9 +552,10 @@ horDiff8(TIFF* tif, uint8* cp0, tmsize_t cc)
} while ((cc -= stride) > 0);
}
}
+ return 1;
}
-static void
+static int
horDiff16(TIFF* tif, uint8* cp0, tmsize_t cc)
{
TIFFPredictorState* sp = PredictorState(tif);
@@ -517,7 +563,12 @@ horDiff16(TIFF* tif, uint8* cp0, tmsize_t cc)
uint16 *wp = (uint16*) cp0;
tmsize_t wc = cc/2;
- assert((cc%(2*stride))==0);
+ if((cc%(2*stride))!=0)
+ {
+ TIFFErrorExt(tif->tif_clientdata, "horDiff8",
+ "%s", "(cc%(2*stride))!=0");
+ return 0;
+ }
if (wc > stride) {
wc -= stride;
@@ -527,20 +578,23 @@ horDiff16(TIFF* tif, uint8* cp0, tmsize_t cc)
wc -= stride;
} while (wc > 0);
}
+ return 1;
}
-static void
+static int
swabHorDiff16(TIFF* tif, uint8* cp0, tmsize_t cc)
{
uint16* wp = (uint16*) cp0;
tmsize_t wc = cc / 2;
- horDiff16(tif, cp0, cc);
+ if( !horDiff16(tif, cp0, cc) )
+ return 0;
TIFFSwabArrayOfShort(wp, wc);
+ return 1;
}
-static void
+static int
horDiff32(TIFF* tif, uint8* cp0, tmsize_t cc)
{
TIFFPredictorState* sp = PredictorState(tif);
@@ -548,7 +602,12 @@ horDiff32(TIFF* tif, uint8* cp0, tmsize_t cc)
uint32 *wp = (uint32*) cp0;
tmsize_t wc = cc/4;
- assert((cc%(4*stride))==0);
+ if((cc%(4*stride))!=0)
+ {
+ TIFFErrorExt(tif->tif_clientdata, "horDiff32",
+ "%s", "(cc%(4*stride))!=0");
+ return 0;
+ }
if (wc > stride) {
wc -= stride;
@@ -558,23 +617,26 @@ horDiff32(TIFF* tif, uint8* cp0, tmsize_t cc)
wc -= stride;
} while (wc > 0);
}
+ return 1;
}
-static void
+static int
swabHorDiff32(TIFF* tif, uint8* cp0, tmsize_t cc)
{
uint32* wp = (uint32*) cp0;
tmsize_t wc = cc / 4;
- horDiff32(tif, cp0, cc);
+ if( !horDiff32(tif, cp0, cc) )
+ return 0;
TIFFSwabArrayOfLong(wp, wc);
+ return 1;
}
/*
* Floating point predictor differencing routine.
*/
-static void
+static int
fpDiff(TIFF* tif, uint8* cp0, tmsize_t cc)
{
tmsize_t stride = PredictorState(tif)->stride;
@@ -582,12 +644,18 @@ fpDiff(TIFF* tif, uint8* cp0, tmsize_t cc)
tmsize_t wc = cc / bps;
tmsize_t count;
uint8 *cp = (uint8 *) cp0;
- uint8 *tmp = (uint8 *)_TIFFmalloc(cc);
+ uint8 *tmp;
- assert((cc%(bps*stride))==0);
+ if((cc%(bps*stride))!=0)
+ {
+ TIFFErrorExt(tif->tif_clientdata, "fpDiff",
+ "%s", "(cc%(bps*stride))!=0");
+ return 0;
+ }
+ tmp = (uint8 *)_TIFFmalloc(cc);
if (!tmp)
- return;
+ return 0;
_TIFFmemcpy(tmp, cp0, cc);
for (count = 0; count < wc; count++) {
@@ -607,6 +675,7 @@ fpDiff(TIFF* tif, uint8* cp0, tmsize_t cc)
cp += cc - stride - 1;
for (count = cc; count > stride; count -= stride)
REPEAT4(stride, cp[stride] = (unsigned char)((cp[stride] - cp[0])&0xff); cp--)
+ return 1;
}
static int
@@ -619,7 +688,8 @@ PredictorEncodeRow(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
assert(sp->encoderow != NULL);
/* XXX horizontal differencing alters user's data XXX */
- (*sp->encodepfunc)(tif, bp, cc);
+ if( !(*sp->encodepfunc)(tif, bp, cc) )
+ return 0;
return (*sp->encoderow)(tif, bp, cc, s);
}
@@ -654,7 +724,13 @@ PredictorEncodeTile(TIFF* tif, uint8* bp0, tmsize_t cc0, uint16 s)
rowsize = sp->rowsize;
assert(rowsize > 0);
- assert((cc0%rowsize)==0);
+ if((cc0%rowsize)!=0)
+ {
+ TIFFErrorExt(tif->tif_clientdata, "PredictorEncodeTile",
+ "%s", "(cc0%rowsize)!=0");
+ _TIFFfree( working_copy );
+ return 0;
+ }
while (cc > 0) {
(*sp->encodepfunc)(tif, bp, rowsize);
cc -= rowsize;
@@ -703,7 +779,7 @@ PredictorVGetField(TIFF* tif, uint32 tag, va_list ap)
switch (tag) {
case TIFFTAG_PREDICTOR:
- *va_arg(ap, uint16*) = sp->predictor;
+ *va_arg(ap, uint16*) = (uint16)sp->predictor;
break;
default:
return (*sp->vgetparent)(tif, tag, ap);
diff --git a/chromium/third_party/pdfium/third_party/libtiff/tif_predict.h b/chromium/third_party/pdfium/third_party/libtiff/tif_predict.h
index dc7144c69e6..6c68e21acbb 100644
--- a/chromium/third_party/pdfium/third_party/libtiff/tif_predict.h
+++ b/chromium/third_party/pdfium/third_party/libtiff/tif_predict.h
@@ -1,4 +1,4 @@
-/* $Id: tif_predict.h,v 1.8 2010-03-10 18:56:49 bfriesen Exp $ */
+/* $Id: tif_predict.h,v 1.9 2016-10-31 17:24:26 erouault Exp $ */
/*
* Copyright (c) 1995-1997 Sam Leffler
@@ -30,6 +30,8 @@
* ``Library-private'' Support for the Predictor Tag
*/
+typedef int (*TIFFEncodeDecodeMethod)(TIFF* tif, uint8* buf, tmsize_t size);
+
/*
* Codecs that want to support the Predictor tag must place
* this structure first in their private state block so that
@@ -43,12 +45,12 @@ typedef struct {
TIFFCodeMethod encoderow; /* parent codec encode/decode row */
TIFFCodeMethod encodestrip; /* parent codec encode/decode strip */
TIFFCodeMethod encodetile; /* parent codec encode/decode tile */
- TIFFPostMethod encodepfunc; /* horizontal differencer */
+ TIFFEncodeDecodeMethod encodepfunc; /* horizontal differencer */
TIFFCodeMethod decoderow; /* parent codec encode/decode row */
TIFFCodeMethod decodestrip; /* parent codec encode/decode strip */
TIFFCodeMethod decodetile; /* parent codec encode/decode tile */
- TIFFPostMethod decodepfunc; /* horizontal accumulator */
+ TIFFEncodeDecodeMethod decodepfunc; /* horizontal accumulator */
TIFFVGetMethod vgetparent; /* super-class method */
TIFFVSetMethod vsetparent; /* super-class method */
diff --git a/chromium/third_party/pdfium/third_party/libtiff/tif_print.c b/chromium/third_party/pdfium/third_party/libtiff/tif_print.c
index 7b1a4222a3b..186f2ee5c00 100644
--- a/chromium/third_party/pdfium/third_party/libtiff/tif_print.c
+++ b/chromium/third_party/pdfium/third_party/libtiff/tif_print.c
@@ -1,4 +1,4 @@
-/* $Id: tif_print.c,v 1.62 2015-08-19 02:31:04 bfriesen Exp $ */
+/* $Id: tif_print.c,v 1.64 2015-12-06 22:19:56 erouault Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@@ -37,7 +37,7 @@
static void
_TIFFprintAsciiBounded(FILE* fd, const char* cp, size_t max_chars);
-static const char *photoNames[] = {
+static const char * const photoNames[] = {
"min-is-white", /* PHOTOMETRIC_MINISWHITE */
"min-is-black", /* PHOTOMETRIC_MINISBLACK */
"RGB color", /* PHOTOMETRIC_RGB */
@@ -52,7 +52,7 @@ static const char *photoNames[] = {
};
#define NPHOTONAMES (sizeof (photoNames) / sizeof (photoNames[0]))
-static const char *orientNames[] = {
+static const char * const orientNames[] = {
"0 (0x0)",
"row 0 top, col 0 lhs", /* ORIENTATION_TOPLEFT */
"row 0 top, col 0 rhs", /* ORIENTATION_TOPRIGHT */
@@ -237,7 +237,6 @@ TIFFPrintDirectory(TIFF* tif, FILE* fd, long flags)
{
TIFFDirectory *td = &tif->tif_dir;
char *sep;
- uint16 i;
long l, n;
#if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__))
@@ -365,6 +364,7 @@ TIFFPrintDirectory(TIFF* tif, FILE* fd, long flags)
}
}
if (TIFFFieldSet(tif,FIELD_EXTRASAMPLES) && td->td_extrasamples) {
+ uint16 i;
fprintf(fd, " Extra Samples: %u<", td->td_extrasamples);
sep = "";
for (i = 0; i < td->td_extrasamples; i++) {
@@ -389,6 +389,7 @@ TIFFPrintDirectory(TIFF* tif, FILE* fd, long flags)
}
if (TIFFFieldSet(tif,FIELD_INKNAMES)) {
char* cp;
+ uint16 i;
fprintf(fd, " Ink Names: ");
i = td->td_samplesperpixel;
sep = "";
@@ -481,6 +482,7 @@ TIFFPrintDirectory(TIFF* tif, FILE* fd, long flags)
if (TIFFFieldSet(tif,FIELD_MAXSAMPLEVALUE))
fprintf(fd, " Max Sample Value: %u\n", td->td_maxsamplevalue);
if (TIFFFieldSet(tif,FIELD_SMINSAMPLEVALUE)) {
+ int i;
int count = (tif->tif_flags & TIFF_PERSAMPLE) ? td->td_samplesperpixel : 1;
fprintf(fd, " SMin Sample Value:");
for (i = 0; i < count; ++i)
@@ -488,6 +490,7 @@ TIFFPrintDirectory(TIFF* tif, FILE* fd, long flags)
fprintf(fd, "\n");
}
if (TIFFFieldSet(tif,FIELD_SMAXSAMPLEVALUE)) {
+ int i;
int count = (tif->tif_flags & TIFF_PERSAMPLE) ? td->td_samplesperpixel : 1;
fprintf(fd, " SMax Sample Value:");
for (i = 0; i < count; ++i)
@@ -527,6 +530,7 @@ TIFFPrintDirectory(TIFF* tif, FILE* fd, long flags)
fprintf(fd, "(present)\n");
}
if (TIFFFieldSet(tif,FIELD_REFBLACKWHITE)) {
+ int i;
fprintf(fd, " Reference Black/White:\n");
for (i = 0; i < 3; i++)
fprintf(fd, " %2d: %5g %5g\n", i,
@@ -539,6 +543,7 @@ TIFFPrintDirectory(TIFF* tif, FILE* fd, long flags)
fprintf(fd, "\n");
n = 1L<<td->td_bitspersample;
for (l = 0; l < n; l++) {
+ uint16 i;
fprintf(fd, " %2lu: %5u",
l, td->td_transferfunction[0][l]);
for (i = 1; i < td->td_samplesperpixel; i++)
@@ -550,6 +555,7 @@ TIFFPrintDirectory(TIFF* tif, FILE* fd, long flags)
fprintf(fd, "(present)\n");
}
if (TIFFFieldSet(tif, FIELD_SUBIFD) && (td->td_subifd)) {
+ uint16 i;
fprintf(fd, " SubIFD Offsets:");
for (i = 0; i < td->td_nsubifd; i++)
#if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__))
diff --git a/chromium/third_party/pdfium/third_party/libtiff/tif_read.c b/chromium/third_party/pdfium/third_party/libtiff/tif_read.c
index 548b1f5ea67..c25e7e79f01 100644
--- a/chromium/third_party/pdfium/third_party/libtiff/tif_read.c
+++ b/chromium/third_party/pdfium/third_party/libtiff/tif_read.c
@@ -1,4 +1,4 @@
-/* $Id: tif_read.c,v 1.45 2015-06-07 22:35:40 bfriesen Exp $ */
+/* $Id: tif_read.c,v 1.49 2016-07-10 18:00:21 erouault Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@@ -31,6 +31,9 @@
#include "tiffiop.h"
#include <stdio.h>
+#define TIFF_SIZE_T_MAX ((size_t) ~ ((size_t)0))
+#define TIFF_TMSIZE_T_MAX (tmsize_t)(TIFF_SIZE_T_MAX >> 1)
+
int TIFFFillStrip(TIFF* tif, uint32 strip);
int TIFFFillTile(TIFF* tif, uint32 tile);
static int TIFFStartStrip(TIFF* tif, uint32 strip);
@@ -38,6 +41,8 @@ static int TIFFStartTile(TIFF* tif, uint32 tile);
static int TIFFCheckRead(TIFF*, int);
static tmsize_t
TIFFReadRawStrip1(TIFF* tif, uint32 strip, void* buf, tmsize_t size,const char* module);
+static tmsize_t
+TIFFReadRawTile1(TIFF* tif, uint32 tile, void* buf, tmsize_t size, const char* module);
#define NOSTRIP ((uint32)(-1)) /* undefined state */
#define NOTILE ((uint32)(-1)) /* undefined state */
@@ -341,15 +346,33 @@ TIFFReadEncodedStrip(TIFF* tif, uint32 strip, void* buf, tmsize_t size)
rowsperstrip=td->td_rowsperstrip;
if (rowsperstrip>td->td_imagelength)
rowsperstrip=td->td_imagelength;
- stripsperplane=((td->td_imagelength+rowsperstrip-1)/rowsperstrip);
+ stripsperplane= TIFFhowmany_32_maxuint_compat(td->td_imagelength, rowsperstrip);
stripinplane=(strip%stripsperplane);
- plane=(strip/stripsperplane);
+ plane=(uint16)(strip/stripsperplane);
rows=td->td_imagelength-stripinplane*rowsperstrip;
if (rows>rowsperstrip)
rows=rowsperstrip;
stripsize=TIFFVStripSize(tif,rows);
if (stripsize==0)
return((tmsize_t)(-1));
+
+ /* shortcut to avoid an extra memcpy() */
+ if( td->td_compression == COMPRESSION_NONE &&
+ size!=(tmsize_t)(-1) && size >= stripsize &&
+ !isMapped(tif) &&
+ ((tif->tif_flags&TIFF_NOREADRAW)==0) )
+ {
+ if (TIFFReadRawStrip1(tif, strip, buf, stripsize, module) != stripsize)
+ return ((tmsize_t)(-1));
+
+ if (!isFillOrder(tif, td->td_fillorder) &&
+ (tif->tif_flags & TIFF_NOBITREV) == 0)
+ TIFFReverseBits(buf,stripsize);
+
+ (*tif->tif_postdecode)(tif,buf,stripsize);
+ return (stripsize);
+ }
+
if ((size!=(tmsize_t)(-1))&&(size<stripsize))
stripsize=size;
if (!TIFFFillStrip(tif,strip))
@@ -401,7 +424,7 @@ TIFFReadRawStrip1(TIFF* tif, uint32 strip, void* buf, tmsize_t size,
tmsize_t n;
ma=(tmsize_t)td->td_stripoffset[strip];
mb=ma+size;
- if (((uint64)ma!=td->td_stripoffset[strip])||(ma>tif->tif_size))
+ if ((td->td_stripoffset[strip] > (uint64)TIFF_TMSIZE_T_MAX)||(ma>tif->tif_size))
n=0;
else if ((mb<ma)||(mb<size)||(mb>tif->tif_size))
n=tif->tif_size-ma;
@@ -492,9 +515,9 @@ TIFFFillStrip(TIFF* tif, uint32 strip)
static const char module[] = "TIFFFillStrip";
TIFFDirectory *td = &tif->tif_dir;
- if (!_TIFFFillStriles( tif ) || !tif->tif_dir.td_stripbytecount)
- return 0;
-
+ if (!_TIFFFillStriles( tif ) || !tif->tif_dir.td_stripbytecount)
+ return 0;
+
if ((tif->tif_flags&TIFF_NOREADRAW)==0)
{
uint64 bytecount = td->td_stripbytecount[strip];
@@ -593,6 +616,13 @@ TIFFFillStrip(TIFF* tif, uint32 strip)
TIFFErrorExt(tif->tif_clientdata,module,"Integer overflow");
return(0);
}
+ const tmsize_t size=isMapped(tif)? tif->tif_size : (tmsize_t)TIFFGetFileSize(tif);
+ if (bytecountm > size) {
+ TIFFErrorExt(tif->tif_clientdata, module,
+ "Requested read strip size %lu is too large",
+ (unsigned long) strip);
+ return (0);
+ }
if (bytecountm > tif->tif_rawdatasize) {
tif->tif_curstrip = NOSTRIP;
if ((tif->tif_flags & TIFF_MYBUFFER) == 0) {
@@ -661,6 +691,24 @@ TIFFReadEncodedTile(TIFF* tif, uint32 tile, void* buf, tmsize_t size)
(unsigned long) tile, (unsigned long) td->td_nstrips);
return ((tmsize_t)(-1));
}
+
+ /* shortcut to avoid an extra memcpy() */
+ if( td->td_compression == COMPRESSION_NONE &&
+ size!=(tmsize_t)(-1) && size >= tilesize &&
+ !isMapped(tif) &&
+ ((tif->tif_flags&TIFF_NOREADRAW)==0) )
+ {
+ if (TIFFReadRawTile1(tif, tile, buf, tilesize, module) != tilesize)
+ return ((tmsize_t)(-1));
+
+ if (!isFillOrder(tif, td->td_fillorder) &&
+ (tif->tif_flags & TIFF_NOBITREV) == 0)
+ TIFFReverseBits(buf,tilesize);
+
+ (*tif->tif_postdecode)(tif,buf,tilesize);
+ return (tilesize);
+ }
+
if (size == (tmsize_t)(-1))
size = tilesize;
else if (size > tilesize)
@@ -717,7 +765,7 @@ TIFFReadRawTile1(TIFF* tif, uint32 tile, void* buf, tmsize_t size, const char* m
tmsize_t n;
ma=(tmsize_t)td->td_stripoffset[tile];
mb=ma+size;
- if (((uint64)ma!=td->td_stripoffset[tile])||(ma>tif->tif_size))
+ if ((td->td_stripoffset[tile] > (uint64)TIFF_TMSIZE_T_MAX)||(ma>tif->tif_size))
n=0;
else if ((mb<ma)||(mb<size)||(mb>tif->tif_size))
n=tif->tif_size-ma;
@@ -795,9 +843,9 @@ TIFFFillTile(TIFF* tif, uint32 tile)
static const char module[] = "TIFFFillTile";
TIFFDirectory *td = &tif->tif_dir;
- if (!_TIFFFillStriles( tif ) || !tif->tif_dir.td_stripbytecount)
- return 0;
-
+ if (!_TIFFFillStriles( tif ) || !tif->tif_dir.td_stripbytecount)
+ return 0;
+
if ((tif->tif_flags&TIFF_NOREADRAW)==0)
{
uint64 bytecount = td->td_stripbytecount[tile];
@@ -960,8 +1008,8 @@ TIFFStartStrip(TIFF* tif, uint32 strip)
{
TIFFDirectory *td = &tif->tif_dir;
- if (!_TIFFFillStriles( tif ) || !tif->tif_dir.td_stripbytecount)
- return 0;
+ if (!_TIFFFillStriles( tif ) || !tif->tif_dir.td_stripbytecount)
+ return 0;
if ((tif->tif_flags & TIFF_CODERSETUP) == 0) {
if (!(*tif->tif_setupdecode)(tif))
diff --git a/chromium/third_party/pdfium/third_party/libtiff/tif_strip.c b/chromium/third_party/pdfium/third_party/libtiff/tif_strip.c
index 6cac71dd928..3b55285cd3b 100644
--- a/chromium/third_party/pdfium/third_party/libtiff/tif_strip.c
+++ b/chromium/third_party/pdfium/third_party/libtiff/tif_strip.c
@@ -1,4 +1,4 @@
-/* $Id: tif_strip.c,v 1.36 2015-06-07 22:35:40 bfriesen Exp $ */
+/* $Id: tif_strip.c,v 1.37 2016-11-09 23:00:49 erouault Exp $ */
/*
* Copyright (c) 1991-1997 Sam Leffler
diff --git a/chromium/third_party/pdfium/third_party/libtiff/tif_swab.c b/chromium/third_party/pdfium/third_party/libtiff/tif_swab.c
index f37e33f1c99..211dc576eb2 100644
--- a/chromium/third_party/pdfium/third_party/libtiff/tif_swab.c
+++ b/chromium/third_party/pdfium/third_party/libtiff/tif_swab.c
@@ -1,4 +1,4 @@
-/* $Id: tif_swab.c,v 1.13 2010-03-10 18:56:49 bfriesen Exp $ */
+/* $Id: tif_swab.c,v 1.14 2016-09-04 21:32:56 erouault Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@@ -296,8 +296,10 @@ TIFFReverseBits(uint8* cp, tmsize_t n)
cp[7] = TIFFBitRevTable[cp[7]];
cp += 8;
}
- while (n-- > 0)
- *cp = TIFFBitRevTable[*cp], cp++;
+ while (n-- > 0) {
+ *cp = TIFFBitRevTable[*cp];
+ cp++;
+ }
}
/* vim: set ts=8 sts=8 sw=8 noet: */
diff --git a/chromium/third_party/pdfium/third_party/libtiff/tif_thunder.c b/chromium/third_party/pdfium/third_party/libtiff/tif_thunder.c
index 390891c98bd..183199de76e 100644
--- a/chromium/third_party/pdfium/third_party/libtiff/tif_thunder.c
+++ b/chromium/third_party/pdfium/third_party/libtiff/tif_thunder.c
@@ -1,4 +1,4 @@
-/* $Id: tif_thunder.c,v 1.12 2011-04-02 20:54:09 bfriesen Exp $ */
+/* $Id: tif_thunder.c,v 1.13 2016-09-04 21:32:56 erouault Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@@ -100,7 +100,8 @@ ThunderDecode(TIFF* tif, uint8* op, tmsize_t maxpixels)
while (cc > 0 && npixels < maxpixels) {
int n, delta;
- n = *bp++, cc--;
+ n = *bp++;
+ cc--;
switch (n & THUNDER_CODE) {
case THUNDER_RUN: /* pixel run */
/*
diff --git a/chromium/third_party/pdfium/third_party/libtiff/tif_write.c b/chromium/third_party/pdfium/third_party/libtiff/tif_write.c
index 7996c31e08a..34c4d81a09d 100644
--- a/chromium/third_party/pdfium/third_party/libtiff/tif_write.c
+++ b/chromium/third_party/pdfium/third_party/libtiff/tif_write.c
@@ -1,4 +1,4 @@
-/* $Id: tif_write.c,v 1.42 2015-06-07 23:00:23 bfriesen Exp $ */
+/* $Id: tif_write.c,v 1.45 2016-09-23 22:12:18 erouault Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@@ -258,6 +258,23 @@ TIFFWriteEncodedStrip(TIFF* tif, uint32 strip, void* data, tmsize_t cc)
tif->tif_rawcp = tif->tif_rawdata;
tif->tif_flags &= ~TIFF_POSTENCODE;
+
+ /* shortcut to avoid an extra memcpy() */
+ if( td->td_compression == COMPRESSION_NONE )
+ {
+ /* swab if needed - note that source buffer will be altered */
+ tif->tif_postdecode( tif, (uint8*) data, cc );
+
+ if (!isFillOrder(tif, td->td_fillorder) &&
+ (tif->tif_flags & TIFF_NOBITREV) == 0)
+ TIFFReverseBits((uint8*) data, cc);
+
+ if (cc > 0 &&
+ !TIFFAppendToStrip(tif, strip, (uint8*) data, cc))
+ return ((tmsize_t) -1);
+ return (cc);
+ }
+
sample = (uint16)(strip / td->td_stripsperimage);
if (!(*tif->tif_preencode)(tif, sample))
return ((tmsize_t) -1);
@@ -266,7 +283,7 @@ TIFFWriteEncodedStrip(TIFF* tif, uint32 strip, void* data, tmsize_t cc)
tif->tif_postdecode( tif, (uint8*) data, cc );
if (!(*tif->tif_encodestrip)(tif, (uint8*) data, cc, sample))
- return (0);
+ return ((tmsize_t) -1);
if (!(*tif->tif_postencode)(tif))
return ((tmsize_t) -1);
if (!isFillOrder(tif, td->td_fillorder) &&
@@ -431,9 +448,7 @@ TIFFWriteEncodedTile(TIFF* tif, uint32 tile, void* data, tmsize_t cc)
tif->tif_flags |= TIFF_CODERSETUP;
}
tif->tif_flags &= ~TIFF_POSTENCODE;
- sample = (uint16)(tile/td->td_stripsperimage);
- if (!(*tif->tif_preencode)(tif, sample))
- return ((tmsize_t)(-1));
+
/*
* Clamp write amount to the tile size. This is mostly
* done so that callers can pass in some large number
@@ -442,11 +457,30 @@ TIFFWriteEncodedTile(TIFF* tif, uint32 tile, void* data, tmsize_t cc)
if ( cc < 1 || cc > tif->tif_tilesize)
cc = tif->tif_tilesize;
+ /* shortcut to avoid an extra memcpy() */
+ if( td->td_compression == COMPRESSION_NONE )
+ {
+ /* swab if needed - note that source buffer will be altered */
+ tif->tif_postdecode( tif, (uint8*) data, cc );
+
+ if (!isFillOrder(tif, td->td_fillorder) &&
+ (tif->tif_flags & TIFF_NOBITREV) == 0)
+ TIFFReverseBits((uint8*) data, cc);
+
+ if (cc > 0 &&
+ !TIFFAppendToStrip(tif, tile, (uint8*) data, cc))
+ return ((tmsize_t) -1);
+ return (cc);
+ }
+
+ sample = (uint16)(tile/td->td_stripsperimage);
+ if (!(*tif->tif_preencode)(tif, sample))
+ return ((tmsize_t)(-1));
/* swab if needed - note that source buffer will be altered */
tif->tif_postdecode( tif, (uint8*) data, cc );
if (!(*tif->tif_encodetile)(tif, (uint8*) data, cc, sample))
- return (0);
+ return ((tmsize_t) -1);
if (!(*tif->tif_postencode)(tif))
return ((tmsize_t)(-1));
if (!isFillOrder(tif, td->td_fillorder) &&
@@ -764,7 +798,14 @@ TIFFFlushData1(TIFF* tif)
if (!TIFFAppendToStrip(tif,
isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip,
tif->tif_rawdata, tif->tif_rawcc))
+ {
+ /* We update those variables even in case of error since there's */
+ /* code that doesn't really check the return code of this */
+ /* function */
+ tif->tif_rawcc = 0;
+ tif->tif_rawcp = tif->tif_rawdata;
return (0);
+ }
tif->tif_rawcc = 0;
tif->tif_rawcp = tif->tif_rawdata;
}
diff --git a/chromium/third_party/pdfium/third_party/libtiff/tif_zip.c b/chromium/third_party/pdfium/third_party/libtiff/tif_zip.c
index b3ac9b956e1..8c35aea83df 100644
--- a/chromium/third_party/pdfium/third_party/libtiff/tif_zip.c
+++ b/chromium/third_party/pdfium/third_party/libtiff/tif_zip.c
@@ -1,4 +1,4 @@
-/* $Id: tif_zip.c,v 1.33 2014-12-25 18:29:11 erouault Exp $ */
+/* $Id: tif_zip.c,v 1.36 2016-11-12 16:48:28 erouault Exp $ */
/*
* Copyright (c) 1995-1997 Sam Leffler
@@ -47,7 +47,7 @@
* last found at ftp://ftp.uu.net/pub/archiving/zip/zlib/zlib-0.99.tar.gz.
*/
#include "tif_predict.h"
-#include "../zlib_v128/zlib.h"
+#include "zlib.h"
#include <stdio.h>
@@ -135,7 +135,7 @@ ZIPPreDecode(TIFF* tif, uint16 s)
assert(sizeof(sp->stream.avail_in)==4); /* if this assert gets raised,
we need to simplify this code to reflect a ZLib that is likely updated
to deal with 8byte memory sizes, though this code will respond
- apropriately even before we simplify it */
+ appropriately even before we simplify it */
sp->stream.avail_in = (uInt) tif->tif_rawcc;
if ((tmsize_t)sp->stream.avail_in != tif->tif_rawcc)
{
@@ -162,7 +162,7 @@ ZIPDecode(TIFF* tif, uint8* op, tmsize_t occ, uint16 s)
assert(sizeof(sp->stream.avail_out)==4); /* if this assert gets raised,
we need to simplify this code to reflect a ZLib that is likely updated
to deal with 8byte memory sizes, though this code will respond
- apropriately even before we simplify it */
+ appropriately even before we simplify it */
sp->stream.avail_out = (uInt) occ;
if ((tmsize_t)sp->stream.avail_out != occ)
{
@@ -239,8 +239,8 @@ ZIPPreEncode(TIFF* tif, uint16 s)
assert(sizeof(sp->stream.avail_out)==4); /* if this assert gets raised,
we need to simplify this code to reflect a ZLib that is likely updated
to deal with 8byte memory sizes, though this code will respond
- apropriately even before we simplify it */
- sp->stream.avail_out = tif->tif_rawdatasize;
+ appropriately even before we simplify it */
+ sp->stream.avail_out = (uInt)tif->tif_rawdatasize;
if ((tmsize_t)sp->stream.avail_out != tif->tif_rawdatasize)
{
TIFFErrorExt(tif->tif_clientdata, module, "ZLib cannot deal with buffers this size");
@@ -266,7 +266,7 @@ ZIPEncode(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
assert(sizeof(sp->stream.avail_in)==4); /* if this assert gets raised,
we need to simplify this code to reflect a ZLib that is likely updated
to deal with 8byte memory sizes, though this code will respond
- apropriately even before we simplify it */
+ appropriately even before we simplify it */
sp->stream.avail_in = (uInt) cc;
if ((tmsize_t)sp->stream.avail_in != cc)
{
@@ -460,7 +460,7 @@ bad:
"No space for ZIP state block");
return (0);
}
-#endif /* ZIP_SUPORT */
+#endif /* ZIP_SUPPORT */
/* vim: set ts=8 sts=8 sw=8 noet: */
/*
diff --git a/chromium/third_party/pdfium/third_party/libtiff/tiff.h b/chromium/third_party/pdfium/third_party/libtiff/tiff.h
index bc46acd02b3..fb39634c4b6 100644
--- a/chromium/third_party/pdfium/third_party/libtiff/tiff.h
+++ b/chromium/third_party/pdfium/third_party/libtiff/tiff.h
@@ -1,4 +1,4 @@
-/* $Id: tiff.h,v 1.69 2014-04-02 17:23:06 fwarmerdam Exp $ */
+/* $Id: tiff.h,v 1.70 2016-01-23 21:20:34 erouault Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@@ -279,7 +279,7 @@ typedef enum {
#define PREDICTOR_FLOATINGPOINT 3 /* floating point predictor */
#define TIFFTAG_WHITEPOINT 318 /* image white point */
#define TIFFTAG_PRIMARYCHROMATICITIES 319 /* !primary chromaticities */
-#define TIFFTAG_COLORMAP 320 /* RGB map for pallette image */
+#define TIFFTAG_COLORMAP 320 /* RGB map for palette image */
#define TIFFTAG_HALFTONEHINTS 321 /* !highlight+shadow info */
#define TIFFTAG_TILEWIDTH 322 /* !tile width in pixels */
#define TIFFTAG_TILELENGTH 323 /* !tile height in pixels */
@@ -358,7 +358,7 @@ typedef enum {
#define TIFFTAG_JPEGRESTARTINTERVAL 515 /* !restart interval length */
#define TIFFTAG_JPEGLOSSLESSPREDICTORS 517 /* !lossless proc predictor */
#define TIFFTAG_JPEGPOINTTRANSFORM 518 /* !lossless point transform */
-#define TIFFTAG_JPEGQTABLES 519 /* !Q matrice offsets */
+#define TIFFTAG_JPEGQTABLES 519 /* !Q matrix offsets */
#define TIFFTAG_JPEGDCTABLES 520 /* !DCT table offsets */
#define TIFFTAG_JPEGACTABLES 521 /* !AC coefficient offsets */
#define TIFFTAG_YCBCRCOEFFICIENTS 529 /* !RGB -> YCbCr transform */
diff --git a/chromium/third_party/pdfium/third_party/libtiff/tiffio.h b/chromium/third_party/pdfium/third_party/libtiff/tiffio.h
index 056aed22f7b..dd6c9a42945 100644
--- a/chromium/third_party/pdfium/third_party/libtiff/tiffio.h
+++ b/chromium/third_party/pdfium/third_party/libtiff/tiffio.h
@@ -1,4 +1,4 @@
-/* $Id: tiffio.h,v 1.91 2012-07-29 15:45:29 tgl Exp $ */
+/* $Id: tiffio.h,v 1.92 2016-01-23 21:20:34 erouault Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@@ -208,7 +208,7 @@ struct _TIFFRGBAImage {
uint16 orientation; /* image orientation */
uint16 req_orientation; /* requested orientation */
uint16 photometric; /* image photometric interp */
- uint16* redcmap; /* colormap pallete */
+ uint16* redcmap; /* colormap palette */
uint16* greencmap;
uint16* bluecmap;
/* get image data routine */
@@ -225,7 +225,7 @@ struct _TIFFRGBAImage {
TIFFYCbCrToRGB* ycbcr; /* YCbCr conversion state */
TIFFCIELabToRGB* cielab; /* CIE L*a*b conversion state */
- uint8* UaToAa; /* Unassociated alpha to associated alpha convertion LUT */
+ uint8* UaToAa; /* Unassociated alpha to associated alpha conversion LUT */
uint8* Bitdepth16To8; /* LUT for conversion from 16bit to 8bit values */
int row_offset;
diff --git a/chromium/third_party/pdfium/third_party/libtiff/tiffiop.h b/chromium/third_party/pdfium/third_party/libtiff/tiffiop.h
index f4b2ea480a6..1925a6b5e4b 100644
--- a/chromium/third_party/pdfium/third_party/libtiff/tiffiop.h
+++ b/chromium/third_party/pdfium/third_party/libtiff/tiffiop.h
@@ -1,4 +1,4 @@
-/* $Id: tiffiop.h,v 1.87 2015-08-23 17:49:01 bfriesen Exp $ */
+/* $Id: tiffiop.h,v 1.89 2016-01-23 21:20:34 erouault Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@@ -85,7 +85,7 @@ typedef struct client_info {
/*
* Typedefs for ``method pointers'' used internally.
- * these are depriciated and provided only for backwards compatibility
+ * these are deprecated and provided only for backwards compatibility.
*/
typedef unsigned char tidataval_t; /* internal image data value type */
typedef tidataval_t* tidata_t; /* reference to internal image data */
@@ -104,33 +104,33 @@ struct tiff {
int tif_fd; /* open file descriptor */
int tif_mode; /* open mode (O_*) */
uint32 tif_flags;
- #define TIFF_FILLORDER 0x00003 /* natural bit fill order for machine */
- #define TIFF_DIRTYHEADER 0x00004 /* header must be written on close */
- #define TIFF_DIRTYDIRECT 0x00008 /* current directory must be written */
- #define TIFF_BUFFERSETUP 0x00010 /* data buffers setup */
- #define TIFF_CODERSETUP 0x00020 /* encoder/decoder setup done */
- #define TIFF_BEENWRITING 0x00040 /* written 1+ scanlines to file */
- #define TIFF_SWAB 0x00080 /* byte swap file information */
- #define TIFF_NOBITREV 0x00100 /* inhibit bit reversal logic */
- #define TIFF_MYBUFFER 0x00200 /* my raw data buffer; free on close */
- #define TIFF_ISTILED 0x00400 /* file is tile, not strip- based */
- #define TIFF_MAPPED 0x00800 /* file is mapped into memory */
- #define TIFF_POSTENCODE 0x01000 /* need call to postencode routine */
- #define TIFF_INSUBIFD 0x02000 /* currently writing a subifd */
- #define TIFF_UPSAMPLED 0x04000 /* library is doing data up-sampling */
- #define TIFF_STRIPCHOP 0x08000 /* enable strip chopping support */
- #define TIFF_HEADERONLY 0x10000 /* read header only, do not process the first directory */
- #define TIFF_NOREADRAW 0x20000 /* skip reading of raw uncompressed image data */
- #define TIFF_INCUSTOMIFD 0x40000 /* currently writing a custom IFD */
- #define TIFF_BIGTIFF 0x80000 /* read/write bigtiff */
- #define TIFF_BUF4WRITE 0x100000 /* rawcc bytes are for writing */
- #define TIFF_DIRTYSTRIP 0x200000 /* stripoffsets/stripbytecount dirty*/
- #define TIFF_PERSAMPLE 0x400000 /* get/set per sample tags as arrays */
- #define TIFF_BUFFERMMAP 0x800000 /* read buffer (tif_rawdata) points into mmap() memory */
+ #define TIFF_FILLORDER 0x00003U /* natural bit fill order for machine */
+ #define TIFF_DIRTYHEADER 0x00004U /* header must be written on close */
+ #define TIFF_DIRTYDIRECT 0x00008U /* current directory must be written */
+ #define TIFF_BUFFERSETUP 0x00010U /* data buffers setup */
+ #define TIFF_CODERSETUP 0x00020U /* encoder/decoder setup done */
+ #define TIFF_BEENWRITING 0x00040U /* written 1+ scanlines to file */
+ #define TIFF_SWAB 0x00080U /* byte swap file information */
+ #define TIFF_NOBITREV 0x00100U /* inhibit bit reversal logic */
+ #define TIFF_MYBUFFER 0x00200U /* my raw data buffer; free on close */
+ #define TIFF_ISTILED 0x00400U /* file is tile, not strip- based */
+ #define TIFF_MAPPED 0x00800U /* file is mapped into memory */
+ #define TIFF_POSTENCODE 0x01000U /* need call to postencode routine */
+ #define TIFF_INSUBIFD 0x02000U /* currently writing a subifd */
+ #define TIFF_UPSAMPLED 0x04000U /* library is doing data up-sampling */
+ #define TIFF_STRIPCHOP 0x08000U /* enable strip chopping support */
+ #define TIFF_HEADERONLY 0x10000U /* read header only, do not process the first directory */
+ #define TIFF_NOREADRAW 0x20000U /* skip reading of raw uncompressed image data */
+ #define TIFF_INCUSTOMIFD 0x40000U /* currently writing a custom IFD */
+ #define TIFF_BIGTIFF 0x80000U /* read/write bigtiff */
+ #define TIFF_BUF4WRITE 0x100000U /* rawcc bytes are for writing */
+ #define TIFF_DIRTYSTRIP 0x200000U /* stripoffsets/stripbytecount dirty*/
+ #define TIFF_PERSAMPLE 0x400000U /* get/set per sample tags as arrays */
+ #define TIFF_BUFFERMMAP 0x800000U /* read buffer (tif_rawdata) points into mmap() memory */
uint64 tif_diroff; /* file offset of current directory */
uint64 tif_nextdiroff; /* file offset of following directory */
uint64* tif_dirlist; /* list of offsets to already seen directories to prevent IFD looping */
- uint16 tif_dirlistsize; /* number of entires in offset list */
+ uint16 tif_dirlistsize; /* number of entries in offset list */
uint16 tif_dirnumber; /* number of already seen directories */
TIFFDirectory tif_dir; /* internal rep of current directory */
TIFFDirectory tif_customdir; /* custom IFDs are separated from the main ones */
@@ -249,6 +249,10 @@ struct tiff {
#define TIFFhowmany_32(x, y) (((uint32)x < (0xffffffff - (uint32)(y-1))) ? \
((((uint32)(x))+(((uint32)(y))-1))/((uint32)(y))) : \
0U)
+/* Variant of TIFFhowmany_32() that doesn't return 0 if x close to MAXUINT. */
+/* Caution: TIFFhowmany_32_maxuint_compat(x,y)*y might overflow */
+#define TIFFhowmany_32_maxuint_compat(x, y) \
+ (((uint32)(x) / (uint32)(y)) + ((((uint32)(x) % (uint32)(y)) != 0) ? 1 : 0))
#define TIFFhowmany8_32(x) (((x)&0x07)?((uint32)(x)>>3)+1:(uint32)(x)>>3)
#define TIFFroundup_32(x, y) (TIFFhowmany_32(x,y)*(y))
#define TIFFhowmany_64(x, y) ((((uint64)(x))+(((uint64)(y))-1))/((uint64)(y)))
diff --git a/chromium/third_party/pdfium/third_party/libtiff/tiffvers.h b/chromium/third_party/pdfium/third_party/libtiff/tiffvers.h
index e965814b3d6..fe55c726cb9 100644
--- a/chromium/third_party/pdfium/third_party/libtiff/tiffvers.h
+++ b/chromium/third_party/pdfium/third_party/libtiff/tiffvers.h
@@ -1,4 +1,4 @@
-#define TIFFLIB_VERSION_STR "LIBTIFF, Version 4.0.6\nCopyright (c) 1988-1996 Sam Leffler\nCopyright (c) 1991-1996 Silicon Graphics, Inc."
+#define TIFFLIB_VERSION_STR "LIBTIFF, Version 4.0.7\nCopyright (c) 1988-1996 Sam Leffler\nCopyright (c) 1991-1996 Silicon Graphics, Inc."
/*
* This define can be used in code that requires
* compilation-related definitions specific to a
@@ -6,4 +6,4 @@
* version checking should be done based on the
* string returned by TIFFGetVersion.
*/
-#define TIFFLIB_VERSION 20150912
+#define TIFFLIB_VERSION 20161119
diff --git a/chromium/third_party/pdfium/third_party/libtiff/uvcode.h b/chromium/third_party/pdfium/third_party/libtiff/uvcode.h
index 50f11d7e0ae..6286cfbb0c1 100644
--- a/chromium/third_party/pdfium/third_party/libtiff/uvcode.h
+++ b/chromium/third_party/pdfium/third_party/libtiff/uvcode.h
@@ -3,7 +3,7 @@
#define UV_NDIVS 16289
#define UV_VSTART (float)0.016940
#define UV_NVS 163
-static struct {
+static const struct {
float ustart;
short nus, ncum;
} uv_row[UV_NVS] = {
diff --git a/chromium/third_party/pdfium/third_party/yasm/BUILD.gn b/chromium/third_party/pdfium/third_party/yasm/BUILD.gn
new file mode 100644
index 00000000000..adcb833184e
--- /dev/null
+++ b/chromium/third_party/pdfium/third_party/yasm/BUILD.gn
@@ -0,0 +1,547 @@
+# Copyright 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# The yasm build process creates a slew of small C subprograms that
+# dynamically generate files at various point in the build process. This makes
+# the build integration moderately complex.
+#
+# There are three classes of dynamically generated files:
+# 1) C source files that should be included in the build (eg., lc3bid.c)
+# 2) C source files that are #included by static C sources (eg., license.c)
+# 3) Intermediate files that are used as input by other subprograms to
+# further generate files in category #1 or #2. (eg., version.mac)
+#
+# This structure is represented with the following targets:
+# 1) yasm -- Sources, flags for the main yasm executable. Also has most of
+# of the actions and rules that invoke the subprograms.
+# 2) yasm_config -- General build configuration including setting a
+# inputs listing the checked in version of files
+# generated by manually running configure. These manually
+# generated files are used by all binaries.
+# 3) yasm_utils -- Object files with memory management and hashing utilities
+# shared between yasm and the genperf subprogram.
+# 4) genmacro, genmodule, etc. -- One executable target for each subprogram.
+# 5) generate_license, generate_module, etc. -- Actions that invoke programs
+# built in #4 to generate .c files.
+# 6) compile_gperf, compile_re2c, etc. -- Actions that invoke programs that
+# turn intermediate files into .c files.
+
+import("//build/config/compiler/compiler.gni")
+
+if (current_toolchain == host_toolchain) {
+ # Various files referenced by multiple targets.
+ yasm_gen_include_dir = "$target_gen_dir/include"
+ config_makefile = "source/config/$host_os/Makefile"
+ version_file = "version.mac"
+
+ import("//build/compiled_action.gni")
+
+ config("yasm_config") {
+ include_dirs = [
+ "source/config/$host_os",
+ "source/patched-yasm",
+ ]
+ defines = [ "HAVE_CONFIG_H" ]
+ if (is_posix) {
+ cflags = [ "-std=gnu99" ]
+ }
+ }
+
+ executable("genmacro") {
+ sources = [
+ "source/patched-yasm/tools/genmacro/genmacro.c",
+ ]
+ configs -= [ "//build/config/compiler:chromium_code" ]
+ configs += [
+ ":yasm_config",
+ "//build/config/compiler:no_chromium_code",
+ ]
+ deps = [
+ "//build/config/sanitizers:deps",
+
+ # Default manifest on Windows (a no-op elsewhere).
+ "//build/win:default_exe_manifest",
+ ]
+ }
+
+ executable("genmodule") {
+ sources = [
+ "source/patched-yasm/libyasm/genmodule.c",
+ ]
+ configs -= [ "//build/config/compiler:chromium_code" ]
+ configs += [
+ ":yasm_config",
+ "//build/config/compiler:no_chromium_code",
+ ]
+ deps = [
+ "//build/config/sanitizers:deps",
+
+ # Default manifest on Windows (a no-op elsewhere).
+ "//build/win:default_exe_manifest",
+ ]
+ }
+
+ executable("genperf") {
+ sources = [
+ "source/patched-yasm/tools/genperf/genperf.c",
+ "source/patched-yasm/tools/genperf/perfect.c",
+ ]
+
+ configs -= [ "//build/config/compiler:chromium_code" ]
+ configs += [
+ ":yasm_config",
+ "//build/config/compiler:no_chromium_code",
+ ]
+
+ deps = [
+ ":yasm_utils",
+ "//build/config/sanitizers:deps",
+
+ # Default manifest on Windows (a no-op elsewhere).
+ "//build/win:default_exe_manifest",
+ ]
+ }
+
+ # Used by both yasm and genperf binaries.
+ static_library("yasm_utils") {
+ sources = [
+ "source/patched-yasm/libyasm/phash.c",
+ "source/patched-yasm/libyasm/xmalloc.c",
+ "source/patched-yasm/libyasm/xstrdup.c",
+ ]
+
+ configs -= [ "//build/config/compiler:chromium_code" ]
+ configs += [
+ ":yasm_config",
+ "//build/config/compiler:no_chromium_code",
+ ]
+ }
+
+ executable("genstring") {
+ sources = [
+ "source/patched-yasm/genstring.c",
+ ]
+ configs -= [ "//build/config/compiler:chromium_code" ]
+ configs += [
+ ":yasm_config",
+ "//build/config/compiler:no_chromium_code",
+ ]
+ deps = [
+ "//build/config/sanitizers:deps",
+
+ # Default manifest on Windows (a no-op elsewhere).
+ "//build/win:default_exe_manifest",
+ ]
+ }
+
+ executable("genversion") {
+ sources = [
+ "source/patched-yasm/modules/preprocs/nasm/genversion.c",
+ ]
+ configs -= [ "//build/config/compiler:chromium_code" ]
+ configs += [
+ ":yasm_config",
+ "//build/config/compiler:no_chromium_code",
+ ]
+ deps = [
+ "//build/config/sanitizers:deps",
+
+ # Default manifest on Windows (a no-op elsewhere).
+ "//build/win:default_exe_manifest",
+ ]
+ }
+
+ config("re2c_warnings") {
+ # re2c is missing CLOSEVOP from one switch.
+ if (is_clang) {
+ cflags = [
+ # re2c is missing CLOSEVOP from one switch.
+ "-Wno-switch",
+
+ # re2c contains many static functions in headers (because it's
+ # a C library predating C99.)
+ "-Wno-unused-function",
+ ]
+ }
+ }
+
+ executable("re2c") {
+ sources = [
+ "source/patched-yasm/tools/re2c/actions.c",
+ "source/patched-yasm/tools/re2c/code.c",
+ "source/patched-yasm/tools/re2c/dfa.c",
+ "source/patched-yasm/tools/re2c/main.c",
+ "source/patched-yasm/tools/re2c/mbo_getopt.c",
+ "source/patched-yasm/tools/re2c/parser.c",
+ "source/patched-yasm/tools/re2c/scanner.c",
+ "source/patched-yasm/tools/re2c/substr.c",
+ "source/patched-yasm/tools/re2c/translate.c",
+ ]
+
+ configs -= [ "//build/config/compiler:chromium_code" ]
+ configs += [
+ ":yasm_config",
+ "//build/config/compiler:no_chromium_code",
+
+ # Must be after no_chromium_code for warning flags to be ordered
+ # correctly.
+ ":re2c_warnings",
+ ]
+ deps = [
+ "//build/config/sanitizers:deps",
+
+ # Default manifest on Windows (a no-op elsewhere).
+ "//build/win:default_exe_manifest",
+ ]
+ }
+
+ config("yasm_warnings") {
+ if (is_clang) {
+ cflags = [
+ # reg3264type in x86expr.c is unused.
+ "-Wno-unused-local-typedef",
+ ]
+ } else if (is_linux) {
+ cflags = [
+ # dosexe_objfmt_output ignores the return value of ftruncate.
+ "-Wno-unused-result",
+ ]
+ }
+ }
+
+ executable("yasm") {
+ sources = [
+ "source/patched-yasm/frontends/yasm/yasm-options.c",
+ "source/patched-yasm/frontends/yasm/yasm.c",
+ "source/patched-yasm/libyasm/assocdat.c",
+ "source/patched-yasm/libyasm/bc-align.c",
+ "source/patched-yasm/libyasm/bc-data.c",
+ "source/patched-yasm/libyasm/bc-incbin.c",
+ "source/patched-yasm/libyasm/bc-org.c",
+ "source/patched-yasm/libyasm/bc-reserve.c",
+ "source/patched-yasm/libyasm/bitvect.c",
+ "source/patched-yasm/libyasm/bytecode.c",
+ "source/patched-yasm/libyasm/errwarn.c",
+ "source/patched-yasm/libyasm/expr.c",
+ "source/patched-yasm/libyasm/file.c",
+ "source/patched-yasm/libyasm/floatnum.c",
+ "source/patched-yasm/libyasm/hamt.c",
+ "source/patched-yasm/libyasm/insn.c",
+ "source/patched-yasm/libyasm/intnum.c",
+ "source/patched-yasm/libyasm/inttree.c",
+ "source/patched-yasm/libyasm/linemap.c",
+ "source/patched-yasm/libyasm/md5.c",
+ "source/patched-yasm/libyasm/mergesort.c",
+ "source/patched-yasm/libyasm/section.c",
+ "source/patched-yasm/libyasm/strcasecmp.c",
+ "source/patched-yasm/libyasm/strsep.c",
+ "source/patched-yasm/libyasm/symrec.c",
+ "source/patched-yasm/libyasm/valparam.c",
+ "source/patched-yasm/libyasm/value.c",
+ "source/patched-yasm/modules/arch/lc3b/lc3barch.c",
+ "source/patched-yasm/modules/arch/lc3b/lc3bbc.c",
+ "source/patched-yasm/modules/arch/x86/x86arch.c",
+ "source/patched-yasm/modules/arch/x86/x86bc.c",
+ "source/patched-yasm/modules/arch/x86/x86expr.c",
+ "source/patched-yasm/modules/arch/x86/x86id.c",
+ "source/patched-yasm/modules/dbgfmts/codeview/cv-dbgfmt.c",
+ "source/patched-yasm/modules/dbgfmts/codeview/cv-symline.c",
+ "source/patched-yasm/modules/dbgfmts/codeview/cv-type.c",
+ "source/patched-yasm/modules/dbgfmts/dwarf2/dwarf2-aranges.c",
+ "source/patched-yasm/modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c",
+ "source/patched-yasm/modules/dbgfmts/dwarf2/dwarf2-info.c",
+ "source/patched-yasm/modules/dbgfmts/dwarf2/dwarf2-line.c",
+ "source/patched-yasm/modules/dbgfmts/null/null-dbgfmt.c",
+ "source/patched-yasm/modules/dbgfmts/stabs/stabs-dbgfmt.c",
+ "source/patched-yasm/modules/listfmts/nasm/nasm-listfmt.c",
+ "source/patched-yasm/modules/objfmts/bin/bin-objfmt.c",
+ "source/patched-yasm/modules/objfmts/coff/coff-objfmt.c",
+ "source/patched-yasm/modules/objfmts/coff/win64-except.c",
+ "source/patched-yasm/modules/objfmts/dbg/dbg-objfmt.c",
+ "source/patched-yasm/modules/objfmts/elf/elf-objfmt.c",
+ "source/patched-yasm/modules/objfmts/elf/elf-x86-amd64.c",
+ "source/patched-yasm/modules/objfmts/elf/elf-x86-x86.c",
+ "source/patched-yasm/modules/objfmts/elf/elf.c",
+ "source/patched-yasm/modules/objfmts/macho/macho-objfmt.c",
+ "source/patched-yasm/modules/objfmts/rdf/rdf-objfmt.c",
+ "source/patched-yasm/modules/objfmts/xdf/xdf-objfmt.c",
+ "source/patched-yasm/modules/parsers/gas/gas-parse-intel.c",
+ "source/patched-yasm/modules/parsers/gas/gas-parse.c",
+ "source/patched-yasm/modules/parsers/gas/gas-parser.c",
+ "source/patched-yasm/modules/parsers/nasm/nasm-parse.c",
+ "source/patched-yasm/modules/parsers/nasm/nasm-parser.c",
+ "source/patched-yasm/modules/preprocs/cpp/cpp-preproc.c",
+ "source/patched-yasm/modules/preprocs/nasm/nasm-eval.c",
+ "source/patched-yasm/modules/preprocs/nasm/nasm-pp.c",
+ "source/patched-yasm/modules/preprocs/nasm/nasm-preproc.c",
+ "source/patched-yasm/modules/preprocs/nasm/nasmlib.c",
+ "source/patched-yasm/modules/preprocs/raw/raw-preproc.c",
+
+ # Files generated by compile_gperf
+ "$target_gen_dir/x86cpu.c",
+ "$target_gen_dir/x86regtmod.c",
+
+ # Files generated by compile_re2c
+ "$target_gen_dir/gas-token.c",
+ "$target_gen_dir/nasm-token.c",
+
+ # File generated by compile_re2c_lc3b
+ "$target_gen_dir/lc3bid.c",
+
+ # File generated by generate_module
+ "$target_gen_dir/module.c",
+ ]
+
+ configs -= [ "//build/config/compiler:chromium_code" ]
+ configs += [
+ ":yasm_config",
+ "//build/config/compiler:no_chromium_code",
+ "//build/config/compiler:no_incompatible_pointer_warnings",
+
+ # Must be after no_chromium_code for warning flags to be ordered
+ # correctly.
+ ":yasm_warnings",
+ ]
+
+ # Disable WPO for yasm: crbug.com/604808
+ if (is_official_build && full_wpo_on_official) {
+ configs -= [ "//build/config/compiler:default_optimization" ]
+ configs += [ "//build/config/compiler:optimize_no_wpo" ]
+ }
+
+ # Yasm generates a bunch of .c files which its source file #include.
+ # Add the |target_gen_dir| into the include path so it can find them.
+ # Ideally, these generated .c files would be placed into a separate
+ # directory, but the gen_x86_insn.py script does not make this easy.
+ include_dirs = [ yasm_gen_include_dir ]
+
+ if (!is_win) {
+ cflags = [
+ "-std=c89",
+ "-pedantic",
+ ]
+ }
+
+ # TODO(ajwong): This should take most of the generated output as
+ # inputs.
+ deps = [
+ ":compile_gperf",
+ ":compile_gperf_for_include",
+ ":compile_nasm_macros",
+ ":compile_nasm_version",
+ ":compile_re2c",
+ ":compile_re2c_lc3b",
+ ":compile_win64_gas",
+ ":compile_win64_nasm",
+ ":generate_license",
+ ":generate_module",
+ ":generate_version",
+ ":yasm_utils",
+ "//build/config/sanitizers:deps",
+
+ # Default manifest on Windows (a no-op elsewhere).
+ "//build/win:default_exe_manifest",
+ ]
+ }
+
+ compiled_action_foreach("compile_gperf") {
+ tool = ":genperf"
+ sources = [
+ "source/patched-yasm/modules/arch/x86/x86cpu.gperf",
+ "source/patched-yasm/modules/arch/x86/x86regtmod.gperf",
+ ]
+
+ outputs = [
+ "$target_gen_dir/{{source_name_part}}.c",
+ ]
+ args = [
+ "{{source}}",
+ rebase_path(target_gen_dir, root_build_dir) + "/{{source_name_part}}.c",
+ ]
+ deps = [
+ ":generate_x86_insn",
+ ]
+ }
+
+ # This differs from |compile_gperf| in where it places it output files.
+ compiled_action_foreach("compile_gperf_for_include") {
+ tool = ":genperf"
+ sources = [
+ # Make sure the generated gperf files in $target_gen_dir are synced with
+ # the outputs for the related generate_*_insn actions in the
+ # generate_files target below.
+ #
+ # The output for these two are #included by
+ # source/patched-yasm/modules/arch/x86/x86id.c
+ "$yasm_gen_include_dir/x86insn_gas.gperf",
+ "$yasm_gen_include_dir/x86insn_nasm.gperf",
+ ]
+
+ outputs = [
+ "$yasm_gen_include_dir/{{source_name_part}}.c",
+ ]
+ args = [
+ "{{source}}",
+ rebase_path(yasm_gen_include_dir, root_build_dir) +
+ "/{{source_name_part}}.c",
+ ]
+ deps = [
+ ":generate_x86_insn",
+ ]
+ }
+
+ template("compile_macro") {
+ compiled_action(target_name) {
+ tool = ":genmacro"
+
+ # Output #included by source/patched-yasm/frontends/yasm/yasm.c.
+ inputs = invoker.sources
+ outputs = invoker.outputs
+ args = [
+ rebase_path(outputs[0], root_build_dir),
+ invoker.macro_varname,
+ rebase_path(inputs[0], root_build_dir),
+ ]
+ if (defined(invoker.deps)) {
+ deps = invoker.deps
+ }
+ }
+ }
+
+ compile_macro("compile_nasm_macros") {
+ # Output #included by
+ # source/patched-yasm/modules/preprocs/nasm/nasm-parser.c
+ sources = [
+ "source/patched-yasm/modules/parsers/nasm/nasm-std.mac",
+ ]
+ outputs = [
+ "$yasm_gen_include_dir/nasm-macros.c",
+ ]
+ macro_varname = "nasm_standard_mac"
+ }
+
+ compile_macro("compile_nasm_version") {
+ # Output #included by
+ # source/patched-yasm/modules/preprocs/nasm/nasm-preproc.c
+ sources = [
+ "$target_gen_dir/$version_file",
+ ]
+ outputs = [
+ "$yasm_gen_include_dir/nasm-version.c",
+ ]
+ macro_varname = "nasm_version_mac"
+ deps = [
+ ":generate_version",
+ ]
+ }
+
+ compile_macro("compile_win64_gas") {
+ # Output #included by source/patched-yasm/frontends/yasm/yasm.c.
+ sources = [
+ "source/patched-yasm/modules/objfmts/coff/win64-gas.mac",
+ ]
+ outputs = [
+ "$yasm_gen_include_dir/win64-gas.c",
+ ]
+ macro_varname = "win64_gas_stdmac"
+ }
+
+ compile_macro("compile_win64_nasm") {
+ # Output #included by source/patched-yasm/frontends/yasm/yasm.c.
+ sources = [
+ "source/patched-yasm/modules/objfmts/coff/win64-nasm.mac",
+ ]
+ outputs = [
+ "$yasm_gen_include_dir/win64-nasm.c",
+ ]
+ macro_varname = "win64_nasm_stdmac"
+ }
+
+ compiled_action_foreach("compile_re2c") {
+ tool = ":re2c"
+ sources = [
+ "source/patched-yasm/modules/parsers/gas/gas-token.re",
+ "source/patched-yasm/modules/parsers/nasm/nasm-token.re",
+ ]
+ outputs = [
+ "$target_gen_dir/{{source_name_part}}.c",
+ ]
+ args = [
+ "-b",
+ "-o",
+ rebase_path(target_gen_dir, root_build_dir) + "/{{source_name_part}}.c",
+ "{{source}}",
+ ]
+ }
+
+ # This call doesn't fit into the re2c template above.
+ compiled_action("compile_re2c_lc3b") {
+ tool = ":re2c"
+ inputs = [
+ "source/patched-yasm/modules/arch/lc3b/lc3bid.re",
+ ]
+ outputs = [
+ "$target_gen_dir/lc3bid.c",
+ ]
+ args = [
+ "-s",
+ "-o",
+ rebase_path(outputs[0], root_build_dir),
+ rebase_path(inputs[0], root_build_dir),
+ ]
+ }
+
+ compiled_action("generate_license") {
+ tool = ":genstring"
+
+ # Output #included by source/patched-yasm/frontends/yasm/yasm.c.
+ inputs = [
+ "source/patched-yasm/COPYING",
+ ]
+ outputs = [
+ "$yasm_gen_include_dir/license.c",
+ ]
+ args = [
+ "license_msg",
+ rebase_path(outputs[0], root_build_dir),
+ rebase_path(inputs[0], root_build_dir),
+ ]
+ }
+
+ compiled_action("generate_module") {
+ tool = ":genmodule"
+ inputs = [
+ "source/patched-yasm/libyasm/module.in",
+ config_makefile,
+ ]
+ outputs = [
+ "$target_gen_dir/module.c",
+ ]
+ args = [
+ rebase_path(inputs[0], root_build_dir),
+ rebase_path(config_makefile, root_build_dir),
+ rebase_path(outputs[0], root_build_dir),
+ ]
+ }
+
+ compiled_action("generate_version") {
+ tool = ":genversion"
+ outputs = [
+ "$target_gen_dir/$version_file",
+ ]
+ args = [ rebase_path(outputs[0], root_build_dir) ]
+ }
+
+ action("generate_x86_insn") {
+ script = "source/patched-yasm/modules/arch/x86/gen_x86_insn.py"
+
+ # Output eventually #included by source/patched-yasm/frontends/yasm/x86id.c
+ outputs = [
+ "$yasm_gen_include_dir/x86insns.c",
+ "$yasm_gen_include_dir/x86insn_gas.gperf",
+ "$yasm_gen_include_dir/x86insn_nasm.gperf",
+ ]
+ args = [ rebase_path(yasm_gen_include_dir, root_build_dir) ]
+ }
+}
diff --git a/chromium/third_party/pdfium/third_party/yasm/CHROMIUM.diff b/chromium/third_party/pdfium/third_party/yasm/CHROMIUM.diff
new file mode 100644
index 00000000000..80fd767292b
--- /dev/null
+++ b/chromium/third_party/pdfium/third_party/yasm/CHROMIUM.diff
@@ -0,0 +1,20 @@
+--- frontends/tasm/tasm.c
++++ frontends/tasm/tasm.c
+@@ -224,7 +224,9 @@
+ /* version message */
+ /*@observer@*/ static const char *version_msg[] = {
+ PACKAGE_STRING,
+- "Compiled on " __DATE__ ".",
+ "Copyright (c) 2001-2010 Peter Johnson and other Yasm developers.",
+ "Run yasm --license for licensing overview and summary."
+ };
+--- frontends/yasm/yasm.c
++++ frontends/yasm/yasm.c
+@@ -213,7 +213,9 @@
+ /* version message */
+ /*@observer@*/ static const char *version_msg[] = {
+ PACKAGE_STRING,
+- "Compiled on " __DATE__ ".",
+ "Copyright (c) 2001-2011 Peter Johnson and other Yasm developers.",
+ "Run yasm --license for licensing overview and summary."
+ };
diff --git a/chromium/third_party/pdfium/third_party/yasm/OWNERS b/chromium/third_party/pdfium/third_party/yasm/OWNERS
new file mode 100644
index 00000000000..1967bf567e8
--- /dev/null
+++ b/chromium/third_party/pdfium/third_party/yasm/OWNERS
@@ -0,0 +1 @@
+thestig@chromium.org
diff --git a/chromium/third_party/pdfium/third_party/yasm/README.pdfium b/chromium/third_party/pdfium/third_party/yasm/README.pdfium
new file mode 100644
index 00000000000..81b286f5c8f
--- /dev/null
+++ b/chromium/third_party/pdfium/third_party/yasm/README.pdfium
@@ -0,0 +1,142 @@
+Name: yasm
+URL: http://www.tortall.net/projects/yasm/
+Version: 1.2.0
+License: 2-clause or 3-clause BSD licensed, with the exception of bitvect, which is triple-licensed under the Artistic license, GPL, and LGPL
+License File: source/patched-yasm/COPYING
+License Android Compatible: yes
+Security Critical: no
+
+With these patches merged:
+* https://github.com/yasm/yasm/commit/a2cbb10ee1b90b73647667ac849c74d65761d412
+* https://github.com/yasm/yasm/commit/01ab853e68ef8aeded716d6f5b34895200f66a51
+* https://github.com/yasm/yasm/commit/82fafa7b5619e702c8681c959ade0746498e3cbc
+* https://github.com/yasm/yasm/commit/2bd66514b6b100887c19d8598da38347b3cff40e
+* https://github.com/yasm/yasm/commit/ab19547382660d81e0b4a0232dccb38f44c52a36
+* https://github.com/yasm/yasm/commit/9728322335cba96500861ef766b1546d096e5600
+* CHROMIUM.diff: this patch makes yasm deterministic.
+
+
+See also the yasm.gyp file for a description of the yasm build process.
+
+Instructions for recreating the yasm.gyp file.
+ 1) Get a clean version of the yasm source tree. The clean tree can be found
+ at:
+
+ src/third_party/yasm/source/yasm
+
+ 2) Run configure on the pristine source from a different directory (eg.,
+ /tmp/yasm_build). Running configure from another directory will keep
+ the source tree clean.
+
+ 3) Next, capture all the output from a build of yasm. We will use the build
+ log as a reference for making the yasm.gyp file.
+
+ make yasm > yasm_build_log 2> yasm_build_err
+
+ 4) Check yasm_build_err to see if there are any anomalies beyond yasm's
+ compiler warnings.
+
+ 5) Grab the generated Makefile, libyasm-stdint.h, config.h, and put into
+ the correct platform location. For android platform, copy the files
+ generated for linux, but make sure that ENABLE_NLS is not defined to
+ allow mac host compiles to work. For ios, copy the files from mac.
+
+ src/third_party/yasm/source/config/[platform]
+
+ While we do not directly use the "Makefile" to build, it is needed by
+ the "genmodule" subprogram as input for creating the available modules
+ list.
+
+ 6) Make sure all the subprograms are represented in yasm.gyp.
+
+ grep '^gcc' yasm_build_log |
+ grep -v ' -DHAVE_CONFIG_H '
+
+ The yasm build creates a bunch of subprograms that in-turn generate
+ more .c files in the build. Luckily the commands to generate the
+ subprogram do not have -DHAVE_CONFIG_H as a cflag.
+
+ From this list, make sure all the subprograms that are build have
+ appropriate targets in the yasm.gyp.
+
+ You will notice, when you get to the next step, that there are some
+ .c source files that are compiled both for yasm, and for genperf.
+
+ Those should go into the genperf_libs target so that they can be
+ shared by the genperf and yasm targets. Find those files by appending
+
+ | grep 'gp-'
+
+ to the command above.
+
+ 7) Find all the source files used to build yasm proper.
+
+ grep -E '^gcc' yasm_build_log |
+ grep ' -DHAVE_CONFIG_H ' |
+ awk '{print $NF }' |
+ sed -e "s/'\.\/'\`//" | # Removes some garbage from the build line.
+ sort -u |
+ sed -e "s/\(.*\)/'\1',/" # Add quotes to each line.
+
+ Reversing the -DHAVE_CONFIG_H filter from the command above should
+ list the compile lines for yasm proper.
+
+ This should get you close, but you will need to manually examine this
+ list. However, some of the built products are still included in the
+ command above. Generally, if the source file is in the root directory,
+ it's a generated file.
+
+ Inspect the current yasm.gyp for a list of the subprograms and their
+ outputs.
+
+ Update the sources list in the yasm target accordingly. Read step #9
+ as well if you update the source list to avoid problems.
+
+ 8) Update the actions for each of the subprograms.
+
+ Here is the real fun. For each subprogram created, you will need to
+ update the actions and rules in yasm.gyp that invoke the subprogram to
+ generate the files needed by the rest of the build.
+
+ I don't have any good succinct instructions for this. Grep the build
+ log for each subprogram invocation (eg., "./genversion"), look at
+ its command inputs and output, then verify our yasm.gyp does something
+ similar.
+
+ The good news is things likely only link or compile if this is done
+ right so you'll know if there is a problem.
+
+ Again, refer to the existing yasm.gyp for a guide to how the generated
+ files are used.
+
+ Here are a few gotchas:
+ 1) genmodule, by default, writes module.c into the current
+ directory. This does not play nicely with gyp. We patch the
+ source during build to allow specifying a specific output file.
+
+ 2) Most of the generated files, even though they are .c files, are
+ #included by other files in the build. Make sure they end up
+ in a directory that is in the include path for the build.
+ One of <(shared_generated_dir) or <(generated_dir) should work.
+
+ 3) Some of the genperf output is #included while others need to be
+ compiled directly. That is why there are 2 different rules for
+ .gperf files in two targets.
+
+ 9) Check for python scripts that are run.
+
+ grep python yasm_build_log
+
+ Yasm uses python scripts to generate the assembly code description
+ files in C++. Make sure to get these put into the gyp file properly as
+ well. An example is gen_x86_insn.py for x86 assembly.
+
+ Note that at least the gen_x86_insn.py script suffers from the same
+ problem as genmacro in that it outputs to the current directory by
+ default. The yasm.gyp build patches this file before invoking it to
+ allow specifying an output directory.
+
+ 10) Recreate the 'AdditionalOptions!': [ '/analyze' ] block so that VC++
+ /analyze builds won't fail.
+
+ 11) If all that's is finished, attempt to build....and cross your fingers.
diff --git a/chromium/third_party/pdfium/third_party/yasm/run_yasm.py b/chromium/third_party/pdfium/third_party/yasm/run_yasm.py
new file mode 100644
index 00000000000..cbd79ccea17
--- /dev/null
+++ b/chromium/third_party/pdfium/third_party/yasm/run_yasm.py
@@ -0,0 +1,51 @@
+# Copyright 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""A wrapper to run yasm.
+
+Its main job is to provide a Python wrapper for GN integration, and to write
+the makefile-style output yasm generates in stdout to a .d file for dependency
+management of .inc files.
+
+Run with:
+ python run_yasm.py <yasm_binary_path> <all other yasm args>
+
+Note that <all other yasm args> must include an explicit output file (-o). This
+script will append a ".d" to this and write the dependencies there. This script
+will add "-M" to cause yasm to write the deps to stdout, so you don't need to
+specify that.
+"""
+
+import argparse
+import sys
+import subprocess
+
+# Extract the output file name from the yasm command line so we can generate a
+# .d file with the same base name.
+parser = argparse.ArgumentParser()
+parser.add_argument("-o", dest="objfile")
+options, _ = parser.parse_known_args()
+
+objfile = options.objfile
+depfile = objfile + '.d'
+
+# Assemble.
+result_code = subprocess.call(sys.argv[1:])
+if result_code != 0:
+ sys.exit(result_code)
+
+# Now generate the .d file listing the dependencies. The -M option makes yasm
+# write the Makefile-style dependencies to stdout, but it seems that inhibits
+# generating any compiled output so we need to do this in a separate pass.
+# However, outputting deps seems faster than actually assembling, and yasm is
+# so fast anyway this is not a big deal.
+#
+# This guarantees proper dependency management for assembly files. Otherwise,
+# we would have to require people to manually specify the .inc files they
+# depend on in the build file, which will surely be wrong or out-of-date in
+# some cases.
+deps = subprocess.check_output(sys.argv[1:] + ['-M'])
+with open(depfile, "wb") as f:
+ f.write(deps)
+
diff --git a/chromium/third_party/pdfium/third_party/yasm/source/config/android/Makefile b/chromium/third_party/pdfium/third_party/yasm/source/config/android/Makefile
new file mode 100644
index 00000000000..6fccce46a99
--- /dev/null
+++ b/chromium/third_party/pdfium/third_party/yasm/source/config/android/Makefile
@@ -0,0 +1,3822 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# Makefile. Generated from Makefile.in by configure.
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+
+
+# $Id: Makefile.am 2184 2009-03-24 05:04:15Z peter $
+
+# $Id: Makefile.inc 2084 2008-05-09 07:08:17Z peter $
+
+# $Id: Makefile.inc 1718 2006-12-24 00:13:19Z peter $
+
+# These utility programs have to be built for BUILD host in cross-build.
+# This makes things rather non-standard automake
+
+# $Id: Makefile.inc 2084 2008-05-09 07:08:17Z peter $
+
+# These utility programs have to be built for BUILD host in cross-build.
+# This makes things rather non-standard automake
+
+# $Id: Makefile.inc 1939 2007-09-10 07:15:50Z peter $
+
+# These utility programs have to be built for BUILD host in cross-build.
+# This makes things rather non-standard automake
+
+# $Id: Makefile.inc 1948 2007-09-13 02:53:30Z peter $
+
+# $Id: Makefile.inc 1951 2007-09-14 05:19:10Z peter $
+
+# $Id: Makefile.inc 1598 2006-08-10 04:02:59Z peter $
+
+# $Id: Makefile.inc 1914 2007-08-20 05:13:35Z peter $
+
+# $Id: Makefile.inc 2111 2008-07-06 22:26:49Z peter $
+
+# $Id: Makefile.inc 2170 2009-01-14 08:28:13Z peter $
+
+# $Id: Makefile.inc 2192 2009-03-29 23:25:05Z peter $
+
+# $Id: Makefile.inc 1776 2007-02-19 02:36:10Z peter $
+
+# $Id: Makefile.inc 2111 2008-07-06 22:26:49Z peter $
+
+# $Id: Makefile.inc 1928 2007-09-07 22:03:34Z peter $
+
+# $Id: Makefile.inc 1152 2004-10-02 06:18:30Z peter $
+
+# $Id: Makefile.inc 1183 2004-12-01 07:49:18Z peter $
+
+# $Id: Makefile.inc 2130 2008-10-07 05:38:11Z peter $
+
+# $Id: Makefile.inc 1783 2007-02-22 03:40:31Z peter $
+
+# $Id: Makefile.inc 2169 2009-01-02 20:46:57Z peter $
+
+# $Id$
+
+# $Id: Makefile.inc 2130 2008-10-07 05:38:11Z peter $
+
+# $Id: Makefile.inc 2190 2009-03-25 03:40:59Z peter $
+
+# $Id: Makefile.inc 1137 2004-09-04 01:24:57Z peter $
+
+# $Id: Makefile.inc 2082 2008-05-09 06:46:02Z peter $
+
+# $Id: Makefile.inc 2063 2008-04-12 08:30:22Z peter $
+
+# $Id: Makefile.inc 2063 2008-04-12 08:30:22Z peter $
+
+# $Id: Makefile.inc 1966 2007-09-20 03:54:36Z peter $
+
+# $Id: Makefile.inc 2130 2008-10-07 05:38:11Z peter $
+
+# $Id: Makefile.inc 2185 2009-03-24 06:33:32Z peter $
+
+# $Id: Makefile.inc 2172 2009-01-27 06:38:14Z peter $
+
+# $Id: Makefile.inc 2176 2009-03-04 07:39:02Z peter $
+
+# Makefile for cpp module.
+# Copied from raw preprocessor module.
+
+# $Id: Makefile.inc 1662 2006-10-21 18:52:29Z peter $
+
+# $Id: Makefile.inc 1428 2006-03-27 02:15:19Z peter $
+
+# $Id: Makefile.inc 1378 2006-02-12 01:27:39Z peter $
+
+# $Id: Makefile.inc 1350 2006-01-29 21:11:03Z peter $
+
+# $Id: Makefile.inc 1851 2007-05-26 17:56:36Z peter $
+
+# $Id: Makefile.inc 1617 2006-09-16 05:43:41Z peter $
+
+# $Id: Makefile.inc 1350 2006-01-29 21:11:03Z peter $
+
+# $Id: Makefile.inc 1183 2004-12-01 07:49:18Z peter $
+
+# $Id: Makefile.inc 1183 2004-12-01 07:49:18Z peter $
+
+# $Id$
+
+# $Id: Makefile.inc 1732 2007-01-13 19:34:04Z peter $
+
+# $Id: Makefile.inc 1183 2004-12-01 07:49:18Z peter $
+
+# $Id: Makefile.inc 2130 2008-10-07 05:38:11Z peter $
+
+# $Id: Makefile.inc 2010 2007-11-14 08:33:32Z peter $
+
+# $Id: Makefile.inc 2010 2007-11-14 08:33:32Z peter $
+
+# $Id: Makefile.inc 1252 2005-09-28 05:50:51Z peter $
+
+# $Id: Makefile.inc 2036 2008-02-09 04:06:47Z peter $
+
+# $Id: Makefile.inc 2126 2008-10-03 08:13:00Z peter $
+
+# $Id: Makefile.inc 2036 2008-02-09 04:06:47Z peter $
+
+# $Id: Makefile.inc 1168 2004-10-31 01:07:52Z peter $
+
+# $Id: Makefile.inc 2082 2008-05-09 06:46:02Z peter $
+
+# $Id: Makefile.inc 1617 2006-09-16 05:43:41Z peter $
+
+# $Id: Makefile.inc 1732 2007-01-13 19:34:04Z peter $
+
+# $Id: Makefile.inc 1777 2007-02-19 08:21:17Z peter $
+
+# $Id: Makefile.inc 1782 2007-02-21 06:45:39Z peter $
+
+# $Id: Makefile.inc 2108 2008-06-05 08:48:21Z peter $
+
+# $Id: Makefile.inc 1854 2007-05-31 06:16:49Z peter $
+
+# $Id: Makefile.inc 2108 2008-06-05 08:48:21Z peter $
+
+# $Id: Makefile.inc 1653 2006-10-17 06:58:41Z peter $
+
+# $Id: Makefile.inc 1653 2006-10-17 06:58:41Z peter $
+
+# $Id: Makefile.inc 1183 2004-12-01 07:49:18Z peter $
+
+# Assume objfmt_coff is included
+
+# $Id: Makefile.inc 2166 2009-01-02 08:33:21Z peter $
+
+# $Id: Makefile.inc 2166 2009-01-02 08:33:21Z peter $
+
+# $Id: Makefile.inc 1331 2006-01-15 22:48:55Z peter $
+
+# Assume objfmt_coff is included
+
+# $Id: Makefile.inc 2120 2008-09-04 04:45:30Z peter $
+
+# $Id: Makefile.inc 2082 2008-05-09 06:46:02Z peter $
+
+# $Id: Makefile.inc 1183 2004-12-01 07:49:18Z peter $
+
+# $Id: Makefile.inc 1851 2007-05-26 17:56:36Z peter $
+
+# $Id: Makefile.inc 2111 2008-07-06 22:26:49Z peter $
+
+# $Id: Makefile.inc 2123 2008-09-30 03:56:37Z peter $
+
+# $Id: Makefile.inc 2130 2008-10-07 05:38:11Z peter $
+
+# $Id: Makefile.inc 1463 2006-04-05 05:39:23Z peter $
+
+# $Id: Makefile.inc 1463 2006-04-05 05:39:23Z peter $
+
+
+
+
+pkgdatadir = $(datadir)/yasm
+pkglibdir = $(libdir)/yasm
+pkgincludedir = $(includedir)/yasm
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = x86_64-unknown-linux-gnu
+host_triplet = x86_64-unknown-linux-gnu
+bin_PROGRAMS = yasm$(EXEEXT) ytasm$(EXEEXT)
+TESTS = $(am__append_3) modules/arch/x86/tests/x86_test.sh \
+ modules/arch/x86/tests/gas32/x86_gas32_test.sh \
+ modules/arch/x86/tests/gas64/x86_gas64_test.sh \
+ modules/arch/lc3b/tests/lc3b_test.sh \
+ modules/parsers/gas/tests/gas_test.sh \
+ modules/parsers/gas/tests/bin/gas_bin_test.sh \
+ modules/parsers/nasm/tests/nasm_test.sh \
+ modules/parsers/nasm/tests/worphan/nasm_worphan_test.sh \
+ modules/parsers/tasm/tests/tasm_test.sh \
+ modules/parsers/tasm/tests/exe/tasm_exe_test.sh \
+ modules/preprocs/nasm/tests/nasmpp_test.sh \
+ modules/preprocs/raw/tests/rawpp_test.sh \
+ modules/dbgfmts/dwarf2/tests/pass32/dwarf2_pass32_test.sh \
+ modules/dbgfmts/dwarf2/tests/pass64/dwarf2_pass64_test.sh \
+ modules/dbgfmts/dwarf2/tests/passwin64/dwarf2_passwin64_test.sh \
+ modules/dbgfmts/stabs/tests/stabs_test.sh \
+ modules/objfmts/bin/tests/bin_test.sh \
+ modules/objfmts/bin/tests/multisect/bin_multi_test.sh \
+ modules/objfmts/elf/tests/elf_test.sh \
+ modules/objfmts/elf/tests/amd64/elf_amd64_test.sh \
+ modules/objfmts/elf/tests/gas32/elf_gas32_test.sh \
+ modules/objfmts/elf/tests/gas64/elf_gas64_test.sh \
+ modules/objfmts/coff/tests/coff_test.sh \
+ modules/objfmts/macho/tests/gas32/gas_macho32_test.sh \
+ modules/objfmts/macho/tests/gas64/gas_macho64_test.sh \
+ modules/objfmts/macho/tests/nasm32/macho32_test.sh \
+ modules/objfmts/macho/tests/nasm64/macho64_test.sh \
+ modules/objfmts/rdf/tests/rdf_test.sh \
+ modules/objfmts/win32/tests/win32_test.sh \
+ modules/objfmts/win32/tests/gas/win32_gas_test.sh \
+ modules/objfmts/win64/tests/win64_test.sh \
+ modules/objfmts/win64/tests/gas/win64_gas_test.sh \
+ modules/objfmts/xdf/tests/xdf_test.sh bitvect_test$(EXEEXT) \
+ floatnum_test$(EXEEXT) leb128_test$(EXEEXT) \
+ splitpath_test$(EXEEXT) combpath_test$(EXEEXT) \
+ uncstring_test$(EXEEXT) libyasm/tests/libyasm_test.sh
+noinst_PROGRAMS = genstring$(EXEEXT) re2c$(EXEEXT) genmacro$(EXEEXT) \
+ genperf$(EXEEXT) genversion$(EXEEXT) genmodule$(EXEEXT)
+check_PROGRAMS = test_hd$(EXEEXT) bitvect_test$(EXEEXT) \
+ floatnum_test$(EXEEXT) leb128_test$(EXEEXT) \
+ splitpath_test$(EXEEXT) combpath_test$(EXEEXT) \
+ uncstring_test$(EXEEXT)
+DIST_COMMON = README $(am__configure_deps) $(dist_man_MANS) \
+ $(include_HEADERS) $(modinclude_HEADERS) $(noinst_HEADERS) \
+ $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(srcdir)/config.h.in $(srcdir)/frontends/Makefile.inc \
+ $(srcdir)/frontends/tasm/Makefile.inc \
+ $(srcdir)/frontends/yasm/Makefile.inc \
+ $(srcdir)/libyasm/Makefile.inc \
+ $(srcdir)/libyasm/tests/Makefile.inc $(srcdir)/m4/Makefile.inc \
+ $(srcdir)/modules/Makefile.inc \
+ $(srcdir)/modules/arch/Makefile.inc \
+ $(srcdir)/modules/arch/lc3b/Makefile.inc \
+ $(srcdir)/modules/arch/lc3b/tests/Makefile.inc \
+ $(srcdir)/modules/arch/x86/Makefile.inc \
+ $(srcdir)/modules/arch/x86/tests/Makefile.inc \
+ $(srcdir)/modules/arch/x86/tests/gas32/Makefile.inc \
+ $(srcdir)/modules/arch/x86/tests/gas64/Makefile.inc \
+ $(srcdir)/modules/dbgfmts/Makefile.inc \
+ $(srcdir)/modules/dbgfmts/codeview/Makefile.inc \
+ $(srcdir)/modules/dbgfmts/dwarf2/Makefile.inc \
+ $(srcdir)/modules/dbgfmts/dwarf2/tests/Makefile.inc \
+ $(srcdir)/modules/dbgfmts/dwarf2/tests/pass32/Makefile.inc \
+ $(srcdir)/modules/dbgfmts/dwarf2/tests/pass64/Makefile.inc \
+ $(srcdir)/modules/dbgfmts/dwarf2/tests/passwin64/Makefile.inc \
+ $(srcdir)/modules/dbgfmts/null/Makefile.inc \
+ $(srcdir)/modules/dbgfmts/stabs/Makefile.inc \
+ $(srcdir)/modules/dbgfmts/stabs/tests/Makefile.inc \
+ $(srcdir)/modules/listfmts/Makefile.inc \
+ $(srcdir)/modules/listfmts/nasm/Makefile.inc \
+ $(srcdir)/modules/objfmts/Makefile.inc \
+ $(srcdir)/modules/objfmts/bin/Makefile.inc \
+ $(srcdir)/modules/objfmts/bin/tests/Makefile.inc \
+ $(srcdir)/modules/objfmts/bin/tests/multisect/Makefile.inc \
+ $(srcdir)/modules/objfmts/coff/Makefile.inc \
+ $(srcdir)/modules/objfmts/coff/tests/Makefile.inc \
+ $(srcdir)/modules/objfmts/dbg/Makefile.inc \
+ $(srcdir)/modules/objfmts/elf/Makefile.inc \
+ $(srcdir)/modules/objfmts/elf/tests/Makefile.inc \
+ $(srcdir)/modules/objfmts/elf/tests/amd64/Makefile.inc \
+ $(srcdir)/modules/objfmts/elf/tests/gas32/Makefile.inc \
+ $(srcdir)/modules/objfmts/elf/tests/gas64/Makefile.inc \
+ $(srcdir)/modules/objfmts/macho/Makefile.inc \
+ $(srcdir)/modules/objfmts/macho/tests/Makefile.inc \
+ $(srcdir)/modules/objfmts/macho/tests/gas32/Makefile.inc \
+ $(srcdir)/modules/objfmts/macho/tests/gas64/Makefile.inc \
+ $(srcdir)/modules/objfmts/macho/tests/nasm32/Makefile.inc \
+ $(srcdir)/modules/objfmts/macho/tests/nasm64/Makefile.inc \
+ $(srcdir)/modules/objfmts/rdf/Makefile.inc \
+ $(srcdir)/modules/objfmts/rdf/tests/Makefile.inc \
+ $(srcdir)/modules/objfmts/win32/Makefile.inc \
+ $(srcdir)/modules/objfmts/win32/tests/Makefile.inc \
+ $(srcdir)/modules/objfmts/win32/tests/gas/Makefile.inc \
+ $(srcdir)/modules/objfmts/win64/Makefile.inc \
+ $(srcdir)/modules/objfmts/win64/tests/Makefile.inc \
+ $(srcdir)/modules/objfmts/win64/tests/gas/Makefile.inc \
+ $(srcdir)/modules/objfmts/xdf/Makefile.inc \
+ $(srcdir)/modules/objfmts/xdf/tests/Makefile.inc \
+ $(srcdir)/modules/parsers/Makefile.inc \
+ $(srcdir)/modules/parsers/gas/Makefile.inc \
+ $(srcdir)/modules/parsers/gas/tests/Makefile.inc \
+ $(srcdir)/modules/parsers/gas/tests/bin/Makefile.inc \
+ $(srcdir)/modules/parsers/nasm/Makefile.inc \
+ $(srcdir)/modules/parsers/nasm/tests/Makefile.inc \
+ $(srcdir)/modules/parsers/nasm/tests/worphan/Makefile.inc \
+ $(srcdir)/modules/parsers/tasm/Makefile.inc \
+ $(srcdir)/modules/parsers/tasm/tests/Makefile.inc \
+ $(srcdir)/modules/parsers/tasm/tests/exe/Makefile.inc \
+ $(srcdir)/modules/preprocs/Makefile.inc \
+ $(srcdir)/modules/preprocs/cpp/Makefile.inc \
+ $(srcdir)/modules/preprocs/nasm/Makefile.inc \
+ $(srcdir)/modules/preprocs/nasm/tests/Makefile.inc \
+ $(srcdir)/modules/preprocs/raw/Makefile.inc \
+ $(srcdir)/modules/preprocs/raw/tests/Makefile.inc \
+ $(srcdir)/tools/Makefile.inc \
+ $(srcdir)/tools/genmacro/Makefile.inc \
+ $(srcdir)/tools/genperf/Makefile.inc \
+ $(srcdir)/tools/python-yasm/Makefile.inc \
+ $(srcdir)/tools/python-yasm/tests/Makefile.inc \
+ $(srcdir)/tools/re2c/Makefile.inc $(top_srcdir)/configure \
+ ABOUT-NLS AUTHORS COPYING ChangeLog INSTALL NEWS \
+ config/config.guess config/config.rpath config/config.sub \
+ config/depcomp config/install-sh config/ltmain.sh \
+ config/missing
+#am__append_1 = _yasm.pxi yasm.pyx \
+# yasm_python.c python-setup.txt \
+# .python-build
+#am__append_2 = PYTHON=${PYTHON}
+#am__append_3 = tools/python-yasm/tests/python_test.sh
+am__append_4 = $(dist_man_MANS)
+subdir = .
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/ax_create_stdint_h.m4 \
+ $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/iconv.m4 \
+ $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
+ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/nls.m4 \
+ $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \
+ $(top_srcdir)/m4/pyrex.m4 $(top_srcdir)/m4/pythonhead.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
+ configure.lineno config.status.lineno
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = config.h
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \
+ "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man7dir)" \
+ "$(DESTDIR)$(includedir)" "$(DESTDIR)$(modincludedir)" \
+ "$(DESTDIR)$(includedir)"
+libLIBRARIES_INSTALL = $(INSTALL_DATA)
+LIBRARIES = $(lib_LIBRARIES)
+AR = ar
+ARFLAGS = cru
+libyasm_a_AR = $(AR) $(ARFLAGS)
+libyasm_a_LIBADD =
+am_libyasm_a_OBJECTS = x86arch.$(OBJEXT) x86bc.$(OBJEXT) \
+ x86expr.$(OBJEXT) x86id.$(OBJEXT) lc3barch.$(OBJEXT) \
+ lc3bbc.$(OBJEXT) nasm-listfmt.$(OBJEXT) gas-parser.$(OBJEXT) \
+ gas-parse.$(OBJEXT) nasm-parser.$(OBJEXT) nasm-parse.$(OBJEXT) \
+ nasm-preproc.$(OBJEXT) nasm-pp.$(OBJEXT) nasmlib.$(OBJEXT) \
+ nasm-eval.$(OBJEXT) raw-preproc.$(OBJEXT) \
+ cpp-preproc.$(OBJEXT) cv-dbgfmt.$(OBJEXT) cv-symline.$(OBJEXT) \
+ cv-type.$(OBJEXT) dwarf2-dbgfmt.$(OBJEXT) \
+ dwarf2-line.$(OBJEXT) dwarf2-aranges.$(OBJEXT) \
+ dwarf2-info.$(OBJEXT) null-dbgfmt.$(OBJEXT) \
+ stabs-dbgfmt.$(OBJEXT) dbg-objfmt.$(OBJEXT) \
+ bin-objfmt.$(OBJEXT) elf.$(OBJEXT) elf-objfmt.$(OBJEXT) \
+ elf-x86-x86.$(OBJEXT) elf-x86-amd64.$(OBJEXT) \
+ coff-objfmt.$(OBJEXT) win64-except.$(OBJEXT) \
+ macho-objfmt.$(OBJEXT) rdf-objfmt.$(OBJEXT) \
+ xdf-objfmt.$(OBJEXT) assocdat.$(OBJEXT) bitvect.$(OBJEXT) \
+ bc-align.$(OBJEXT) bc-data.$(OBJEXT) bc-incbin.$(OBJEXT) \
+ bc-org.$(OBJEXT) bc-reserve.$(OBJEXT) bytecode.$(OBJEXT) \
+ errwarn.$(OBJEXT) expr.$(OBJEXT) file.$(OBJEXT) \
+ floatnum.$(OBJEXT) hamt.$(OBJEXT) insn.$(OBJEXT) \
+ intnum.$(OBJEXT) inttree.$(OBJEXT) linemap.$(OBJEXT) \
+ md5.$(OBJEXT) mergesort.$(OBJEXT) phash.$(OBJEXT) \
+ section.$(OBJEXT) strcasecmp.$(OBJEXT) strsep.$(OBJEXT) \
+ symrec.$(OBJEXT) valparam.$(OBJEXT) value.$(OBJEXT) \
+ xmalloc.$(OBJEXT) xstrdup.$(OBJEXT)
+nodist_libyasm_a_OBJECTS = x86cpu.$(OBJEXT) x86regtmod.$(OBJEXT) \
+ lc3bid.$(OBJEXT) gas-token.$(OBJEXT) nasm-token.$(OBJEXT) \
+ module.$(OBJEXT)
+libyasm_a_OBJECTS = $(am_libyasm_a_OBJECTS) \
+ $(nodist_libyasm_a_OBJECTS)
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS)
+am_bitvect_test_OBJECTS = bitvect_test.$(OBJEXT)
+bitvect_test_OBJECTS = $(am_bitvect_test_OBJECTS)
+am__DEPENDENCIES_1 =
+bitvect_test_DEPENDENCIES = libyasm.a $(am__DEPENDENCIES_1)
+am_combpath_test_OBJECTS = combpath_test.$(OBJEXT)
+combpath_test_OBJECTS = $(am_combpath_test_OBJECTS)
+combpath_test_DEPENDENCIES = libyasm.a $(am__DEPENDENCIES_1)
+am_floatnum_test_OBJECTS = floatnum_test.$(OBJEXT)
+floatnum_test_OBJECTS = $(am_floatnum_test_OBJECTS)
+floatnum_test_DEPENDENCIES = libyasm.a $(am__DEPENDENCIES_1)
+am_genmacro_OBJECTS =
+genmacro_OBJECTS = $(am_genmacro_OBJECTS)
+genmacro_DEPENDENCIES = genmacro.$(OBJEXT)
+am_genmodule_OBJECTS =
+genmodule_OBJECTS = $(am_genmodule_OBJECTS)
+genmodule_DEPENDENCIES = genmodule.$(OBJEXT)
+am_genperf_OBJECTS =
+genperf_OBJECTS = $(am_genperf_OBJECTS)
+genperf_DEPENDENCIES = genperf.$(OBJEXT) gp-perfect.$(OBJEXT) \
+ gp-phash.$(OBJEXT) gp-xmalloc.$(OBJEXT) gp-xstrdup.$(OBJEXT)
+am_genstring_OBJECTS =
+genstring_OBJECTS = $(am_genstring_OBJECTS)
+genstring_DEPENDENCIES = genstring.$(OBJEXT)
+am_genversion_OBJECTS =
+genversion_OBJECTS = $(am_genversion_OBJECTS)
+genversion_DEPENDENCIES = genversion.$(OBJEXT)
+am_leb128_test_OBJECTS = leb128_test.$(OBJEXT)
+leb128_test_OBJECTS = $(am_leb128_test_OBJECTS)
+leb128_test_DEPENDENCIES = libyasm.a $(am__DEPENDENCIES_1)
+am_re2c_OBJECTS =
+re2c_OBJECTS = $(am_re2c_OBJECTS)
+re2c_DEPENDENCIES = re2c-main.$(OBJEXT) re2c-code.$(OBJEXT) \
+ re2c-dfa.$(OBJEXT) re2c-parser.$(OBJEXT) \
+ re2c-actions.$(OBJEXT) re2c-scanner.$(OBJEXT) \
+ re2c-mbo_getopt.$(OBJEXT) re2c-substr.$(OBJEXT) \
+ re2c-translate.$(OBJEXT)
+am_splitpath_test_OBJECTS = splitpath_test.$(OBJEXT)
+splitpath_test_OBJECTS = $(am_splitpath_test_OBJECTS)
+splitpath_test_DEPENDENCIES = libyasm.a $(am__DEPENDENCIES_1)
+am_test_hd_OBJECTS = test_hd.$(OBJEXT)
+test_hd_OBJECTS = $(am_test_hd_OBJECTS)
+test_hd_LDADD = $(LDADD)
+am_uncstring_test_OBJECTS = uncstring_test.$(OBJEXT)
+uncstring_test_OBJECTS = $(am_uncstring_test_OBJECTS)
+uncstring_test_DEPENDENCIES = libyasm.a $(am__DEPENDENCIES_1)
+am_yasm_OBJECTS = yasm.$(OBJEXT) yasm-options.$(OBJEXT)
+yasm_OBJECTS = $(am_yasm_OBJECTS)
+yasm_DEPENDENCIES = libyasm.a $(am__DEPENDENCIES_1)
+am_ytasm_OBJECTS = tasm.$(OBJEXT) tasm-options.$(OBJEXT)
+ytasm_OBJECTS = $(am_ytasm_OBJECTS)
+ytasm_DEPENDENCIES = libyasm.a $(am__DEPENDENCIES_1)
+DEFAULT_INCLUDES = -I.
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libyasm_a_SOURCES) $(nodist_libyasm_a_SOURCES) \
+ $(bitvect_test_SOURCES) $(combpath_test_SOURCES) \
+ $(floatnum_test_SOURCES) $(genmacro_SOURCES) \
+ $(genmodule_SOURCES) $(genperf_SOURCES) $(genstring_SOURCES) \
+ $(genversion_SOURCES) $(leb128_test_SOURCES) $(re2c_SOURCES) \
+ $(splitpath_test_SOURCES) $(test_hd_SOURCES) \
+ $(uncstring_test_SOURCES) $(yasm_SOURCES) $(ytasm_SOURCES)
+DIST_SOURCES = $(libyasm_a_SOURCES) $(bitvect_test_SOURCES) \
+ $(combpath_test_SOURCES) $(floatnum_test_SOURCES) \
+ $(genmacro_SOURCES) $(genmodule_SOURCES) $(genperf_SOURCES) \
+ $(genstring_SOURCES) $(genversion_SOURCES) \
+ $(leb128_test_SOURCES) $(re2c_SOURCES) \
+ $(splitpath_test_SOURCES) $(test_hd_SOURCES) \
+ $(uncstring_test_SOURCES) $(yasm_SOURCES) $(ytasm_SOURCES)
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-dvi-recursive install-exec-recursive \
+ install-html-recursive install-info-recursive \
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
+man1dir = $(mandir)/man1
+man7dir = $(mandir)/man7
+NROFF = nroff
+MANS = $(dist_man_MANS)
+includeHEADERS_INSTALL = $(INSTALL_HEADER)
+modincludeHEADERS_INSTALL = $(INSTALL_HEADER)
+nodist_includeHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(include_HEADERS) $(modinclude_HEADERS) \
+ $(nodist_include_HEADERS) $(noinst_HEADERS)
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+distdir = $(PACKAGE)-$(VERSION)
+top_distdir = $(distdir)
+am__remove_distdir = \
+ { test ! -d $(distdir) \
+ || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
+ && rm -fr $(distdir); }; }
+DIST_ARCHIVES = $(distdir).tar.gz
+GZIP_ENV = --best
+distuninstallcheck_listfiles = find . -type f -print
+distcleancheck_listfiles = find . -type f -print
+ACLOCAL = ${SHELL} /tmp/yasm/config/missing --run aclocal-1.10
+AMTAR = ${SHELL} /tmp/yasm/config/missing --run tar
+ARCH = x86
+AUTOCONF = ${SHELL} /tmp/yasm/config/missing --run autoconf
+AUTOHEADER = ${SHELL} /tmp/yasm/config/missing --run autoheader
+AUTOMAKE = ${SHELL} /tmp/yasm/config/missing --run automake-1.10
+AWK = gawk
+CC = gcc -std=gnu99
+CCDEPMODE = depmode=gcc3
+CCLD_FOR_BUILD = gcc -std=gnu99
+CC_FOR_BUILD = gcc -std=gnu99
+CFLAGS = -g -O2
+CPP = gcc -E
+CPPFLAGS =
+CYGPATH_W = echo
+DEFS = -DHAVE_CONFIG_H
+DEPDIR = .deps
+ECHO_C =
+ECHO_N = -n
+ECHO_T =
+EGREP = /bin/grep -E
+EXEEXT =
+GCC = yes
+GMSGFMT = /usr/bin/msgfmt
+GMSGFMT_015 = /usr/bin/msgfmt
+GREP = /bin/grep
+HOST_CC = gcc -std=gnu99
+INSTALL = /usr/bin/install -c
+INSTALL_DATA = ${INSTALL} -m 644
+INSTALL_PROGRAM = ${INSTALL}
+INSTALL_SCRIPT = ${INSTALL}
+INSTALL_STRIP_PROGRAM = $(install_sh) -c -s
+INTLLIBS =
+INTL_MACOSX_LIBS =
+LDFLAGS =
+LIBICONV = -liconv
+LIBINTL =
+LIBOBJS =
+LIBS =
+LN_S = ln -s
+LTLIBICONV = -liconv
+LTLIBINTL =
+LTLIBOBJS =
+MAINT =
+MAKEINFO = ${SHELL} /tmp/yasm/config/missing --run makeinfo
+MKDIR_P = /bin/mkdir -p
+MORE_CFLAGS = -ansi -pedantic -Wall -W -Waggregate-return -Wbad-function-cast -Wcast-align -Wcast-qual -Wchar-subscripts -Winline -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wreturn-type -Wshadow -Wsign-compare -Wstrict-prototypes -Wswitch -Wwrite-strings -Wno-undef -Wno-unused-parameter
+MSGFMT = /usr/bin/msgfmt
+MSGFMT_015 = /usr/bin/msgfmt
+MSGMERGE = /usr/bin/msgmerge
+OBJEXT = o
+PACKAGE = yasm
+PACKAGE_BUGREPORT = bug-yasm@tortall.net
+PACKAGE_NAME = yasm
+PACKAGE_STRING = yasm HEAD
+PACKAGE_TARNAME = yasm
+PACKAGE_VERSION = HEAD
+PATH_SEPARATOR = :
+POSUB = po
+PYTHON = /usr/bin/python
+PYTHON_EXEC_PREFIX = ${exec_prefix}
+PYTHON_INCLUDES =
+PYTHON_PLATFORM = linux2
+PYTHON_PREFIX = ${prefix}
+PYTHON_VERSION = 2.5
+RANLIB = ranlib
+SET_MAKE =
+SHELL = /bin/sh
+STRIP =
+USE_NLS = yes
+VERSION = HEAD
+XGETTEXT = /usr/bin/xgettext
+XGETTEXT_015 = /usr/bin/xgettext
+XMLTO = xmlto
+abs_builddir = /tmp/yasm
+abs_srcdir = /tmp/yasm
+abs_top_builddir = /tmp/yasm
+abs_top_srcdir = /tmp/yasm
+ac_ct_CC = gcc
+am__include = include
+am__leading_dot = .
+am__quote =
+am__tar = ${AMTAR} chof - "$$tardir"
+am__untar = ${AMTAR} xf -
+bindir = ${exec_prefix}/bin
+build = x86_64-unknown-linux-gnu
+build_alias =
+build_cpu = x86_64
+build_os = linux-gnu
+build_vendor = unknown
+builddir = .
+datadir = ${datarootdir}
+datarootdir = ${prefix}/share
+docdir = ${datarootdir}/doc/${PACKAGE_TARNAME}
+dvidir = ${docdir}
+exec_prefix = ${prefix}
+host = x86_64-unknown-linux-gnu
+host_alias =
+host_cpu = x86_64
+host_os = linux-gnu
+host_vendor = unknown
+htmldir = ${docdir}
+includedir = ${prefix}/include
+infodir = ${datarootdir}/info
+install_sh = $(SHELL) /tmp/yasm/config/install-sh
+libdir = ${exec_prefix}/lib
+libexecdir = ${exec_prefix}/libexec
+localedir = ${datarootdir}/locale
+localstatedir = ${prefix}/var
+mandir = ${datarootdir}/man
+mkdir_p = /bin/mkdir -p
+oldincludedir = /usr/include
+pdfdir = ${docdir}
+pkgpyexecdir = ${pyexecdir}/yasm
+pkgpythondir = ${pythondir}/yasm
+prefix = /usr/local
+program_transform_name = s,x,x,
+psdir = ${docdir}
+pyexecdir = ${exec_prefix}/lib/python2.5/site-packages
+pythondir = ${prefix}/lib/python2.5/site-packages
+sbindir = ${exec_prefix}/sbin
+sharedstatedir = ${prefix}/com
+srcdir = .
+sysconfdir = ${prefix}/etc
+target_alias =
+top_builddir = .
+top_srcdir = .
+SUBDIRS = po .
+AM_YFLAGS = -d
+AM_CFLAGS = -ansi -pedantic -Wall -W -Waggregate-return -Wbad-function-cast -Wcast-align -Wcast-qual -Wchar-subscripts -Winline -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wreturn-type -Wshadow -Wsign-compare -Wstrict-prototypes -Wswitch -Wwrite-strings -Wno-undef -Wno-unused-parameter
+
+#!include modules/objfmts/omf/Makefile.inc
+dist_man_MANS = yasm_arch.7 yasm_parsers.7 yasm_dbgfmts.7 \
+ yasm_objfmts.7 yasm.1
+TESTS_ENVIRONMENT = $(am__append_2)
+test_hd_SOURCES = test_hd.c
+include_HEADERS = libyasm.h
+nodist_include_HEADERS = libyasm-stdint.h
+noinst_HEADERS = util.h
+BUILT_SOURCES = x86insns.c x86insn_nasm.gperf x86insn_gas.gperf \
+ x86insn_nasm.c x86insn_gas.c gas-token.c nasm-token.c \
+ nasm-macros.c nasm-version.c version.mac win64-nasm.c \
+ win64-gas.c license.c
+MAINTAINERCLEANFILES = x86insns.c x86insn_nasm.gperf x86insn_gas.gperf \
+ $(am__append_4)
+
+# Until this gets fixed in automake
+DISTCLEANFILES = libyasm/stamp-h libyasm/stamp-h[0-9]*
+
+# Suffix rule for genperf
+SUFFIXES = .gperf
+
+# configure.lineno doesn't clean up after itself?
+CLEANFILES = configure.lineno $(am__append_1) x86insn_nasm.c \
+ x86insn_gas.c x86cpu.c x86regtmod.c lc3bid.c gas-token.c \
+ nasm-token.c nasm-macros.c nasm-version.c version.mac \
+ win64-nasm.c win64-gas.c module.c license.c
+
+# automake doesn't distribute mkinstalldirs?
+#!EXTRA_DIST += modules/objfmts/omf/Makefile.inc
+EXTRA_DIST = config/config.rpath config/mkinstalldirs \
+ tools/Makefile.inc libyasm/Makefile.inc modules/Makefile.inc \
+ frontends/Makefile.inc tools/re2c/Makefile.inc \
+ tools/genmacro/Makefile.inc tools/genperf/Makefile.inc \
+ tools/python-yasm/Makefile.inc tools/re2c/main.c \
+ tools/re2c/basics.h tools/re2c/globals.h tools/re2c/ins.h \
+ tools/re2c/re.h tools/re2c/token.h tools/re2c/code.c \
+ tools/re2c/dfa.h tools/re2c/dfa.c tools/re2c/parse.h \
+ tools/re2c/parser.h tools/re2c/parser.c tools/re2c/actions.c \
+ tools/re2c/scanner.h tools/re2c/scanner.c \
+ tools/re2c/mbo_getopt.h tools/re2c/mbo_getopt.c \
+ tools/re2c/substr.h tools/re2c/substr.c tools/re2c/translate.c \
+ tools/re2c/CHANGELOG tools/re2c/NO_WARRANTY tools/re2c/README \
+ tools/re2c/scanner.re tools/re2c/re2c.1 \
+ tools/re2c/bootstrap/scanner.c tools/re2c/doc/loplas.ps.gz \
+ tools/re2c/doc/sample.bib tools/re2c/examples/basemmap.c \
+ tools/re2c/examples/c.re tools/re2c/examples/cmmap.re \
+ tools/re2c/examples/cnokw.re tools/re2c/examples/cunroll.re \
+ tools/re2c/examples/modula.re tools/re2c/examples/repeater.re \
+ tools/re2c/examples/sample.re tools/re2c/examples/simple.re \
+ tools/re2c/examples/rexx/README \
+ tools/re2c/examples/rexx/rexx.l \
+ tools/re2c/examples/rexx/scanio.c tools/genmacro/genmacro.c \
+ tools/genperf/genperf.c tools/genperf/perfect.c \
+ tools/genperf/perfect.h tools/genperf/standard.h \
+ tools/python-yasm/pyxelator/cparse.py \
+ tools/python-yasm/pyxelator/genpyx.py \
+ tools/python-yasm/pyxelator/ir.py \
+ tools/python-yasm/pyxelator/lexer.py \
+ tools/python-yasm/pyxelator/node.py \
+ tools/python-yasm/pyxelator/parse_core.py \
+ tools/python-yasm/pyxelator/work_unit.py \
+ tools/python-yasm/pyxelator/wrap_yasm.py \
+ tools/python-yasm/setup.py tools/python-yasm/yasm.pyx \
+ $(PYBINDING_DEPS) tools/python-yasm/tests/Makefile.inc \
+ tools/python-yasm/tests/python_test.sh \
+ tools/python-yasm/tests/__init__.py \
+ tools/python-yasm/tests/test_bytecode.py \
+ tools/python-yasm/tests/test_expr.py \
+ tools/python-yasm/tests/test_intnum.py \
+ tools/python-yasm/tests/test_symrec.py \
+ modules/arch/Makefile.inc modules/listfmts/Makefile.inc \
+ modules/parsers/Makefile.inc modules/preprocs/Makefile.inc \
+ modules/objfmts/Makefile.inc modules/arch/x86/Makefile.inc \
+ modules/arch/lc3b/Makefile.inc \
+ modules/arch/x86/gen_x86_insn.py x86insns.c x86insn_nasm.gperf \
+ x86insn_gas.gperf modules/arch/x86/x86cpu.gperf \
+ modules/arch/x86/x86regtmod.gperf \
+ modules/arch/x86/tests/Makefile.inc \
+ modules/arch/x86/tests/x86_test.sh \
+ modules/arch/x86/tests/gen-fma-test.py \
+ modules/arch/x86/tests/addbyte.asm \
+ modules/arch/x86/tests/addbyte.errwarn \
+ modules/arch/x86/tests/addbyte.hex \
+ modules/arch/x86/tests/addrop.asm \
+ modules/arch/x86/tests/addrop.errwarn \
+ modules/arch/x86/tests/addrop.hex \
+ modules/arch/x86/tests/addrop-err.asm \
+ modules/arch/x86/tests/addrop-err.errwarn \
+ modules/arch/x86/tests/aes.asm modules/arch/x86/tests/aes.hex \
+ modules/arch/x86/tests/amd200707.asm \
+ modules/arch/x86/tests/amd200707.hex \
+ modules/arch/x86/tests/arithsmall.asm \
+ modules/arch/x86/tests/arithsmall.errwarn \
+ modules/arch/x86/tests/arithsmall.hex \
+ modules/arch/x86/tests/avx.asm modules/arch/x86/tests/avx.hex \
+ modules/arch/x86/tests/avxcc.asm \
+ modules/arch/x86/tests/avxcc.hex \
+ modules/arch/x86/tests/bittest.asm \
+ modules/arch/x86/tests/bittest.hex \
+ modules/arch/x86/tests/bswap64.asm \
+ modules/arch/x86/tests/bswap64.hex \
+ modules/arch/x86/tests/clmul.asm \
+ modules/arch/x86/tests/clmul.hex \
+ modules/arch/x86/tests/cmpxchg.asm \
+ modules/arch/x86/tests/cmpxchg.hex \
+ modules/arch/x86/tests/cpubasic-err.asm \
+ modules/arch/x86/tests/cpubasic-err.errwarn \
+ modules/arch/x86/tests/cyrix.asm \
+ modules/arch/x86/tests/cyrix.hex \
+ modules/arch/x86/tests/div-err.asm \
+ modules/arch/x86/tests/div-err.errwarn \
+ modules/arch/x86/tests/ea-nonzero.asm \
+ modules/arch/x86/tests/ea-nonzero.hex \
+ modules/arch/x86/tests/ea-over.asm \
+ modules/arch/x86/tests/ea-over.errwarn \
+ modules/arch/x86/tests/ea-over.hex \
+ modules/arch/x86/tests/ea-warn.asm \
+ modules/arch/x86/tests/ea-warn.errwarn \
+ modules/arch/x86/tests/ea-warn.hex \
+ modules/arch/x86/tests/ebpindex.asm \
+ modules/arch/x86/tests/ebpindex.hex \
+ modules/arch/x86/tests/effaddr.asm \
+ modules/arch/x86/tests/effaddr.hex \
+ modules/arch/x86/tests/enter.asm \
+ modules/arch/x86/tests/enter.errwarn \
+ modules/arch/x86/tests/enter.hex \
+ modules/arch/x86/tests/far64.asm \
+ modules/arch/x86/tests/far64.hex \
+ modules/arch/x86/tests/farbasic.asm \
+ modules/arch/x86/tests/farbasic.hex \
+ modules/arch/x86/tests/farithr.asm \
+ modules/arch/x86/tests/farithr.hex \
+ modules/arch/x86/tests/fcmov.asm \
+ modules/arch/x86/tests/fcmov.hex \
+ modules/arch/x86/tests/fma.asm modules/arch/x86/tests/fma.hex \
+ modules/arch/x86/tests/fwdequ64.asm \
+ modules/arch/x86/tests/fwdequ64.hex \
+ modules/arch/x86/tests/genopcode.asm \
+ modules/arch/x86/tests/genopcode.hex \
+ modules/arch/x86/tests/imm64.asm \
+ modules/arch/x86/tests/imm64.errwarn \
+ modules/arch/x86/tests/imm64.hex \
+ modules/arch/x86/tests/iret.asm \
+ modules/arch/x86/tests/iret.hex \
+ modules/arch/x86/tests/jmp64-1.asm \
+ modules/arch/x86/tests/jmp64-1.hex \
+ modules/arch/x86/tests/jmp64-2.asm \
+ modules/arch/x86/tests/jmp64-2.hex \
+ modules/arch/x86/tests/jmp64-3.asm \
+ modules/arch/x86/tests/jmp64-3.hex \
+ modules/arch/x86/tests/jmp64-4.asm \
+ modules/arch/x86/tests/jmp64-4.hex \
+ modules/arch/x86/tests/jmp64-5.asm \
+ modules/arch/x86/tests/jmp64-5.hex \
+ modules/arch/x86/tests/jmp64-6.asm \
+ modules/arch/x86/tests/jmp64-6.hex \
+ modules/arch/x86/tests/jmpfar.asm \
+ modules/arch/x86/tests/jmpfar.hex \
+ modules/arch/x86/tests/lds.asm modules/arch/x86/tests/lds.hex \
+ modules/arch/x86/tests/loopadsz.asm \
+ modules/arch/x86/tests/loopadsz.hex \
+ modules/arch/x86/tests/lsahf.asm \
+ modules/arch/x86/tests/lsahf.hex \
+ modules/arch/x86/tests/mem64-err.asm \
+ modules/arch/x86/tests/mem64-err.errwarn \
+ modules/arch/x86/tests/mem64.asm \
+ modules/arch/x86/tests/mem64.errwarn \
+ modules/arch/x86/tests/mem64.hex \
+ modules/arch/x86/tests/mem64hi32.asm \
+ modules/arch/x86/tests/mem64hi32.hex \
+ modules/arch/x86/tests/mem64rip.asm \
+ modules/arch/x86/tests/mem64rip.hex \
+ modules/arch/x86/tests/mixcase.asm \
+ modules/arch/x86/tests/mixcase.hex \
+ modules/arch/x86/tests/movbe.asm \
+ modules/arch/x86/tests/movbe.hex \
+ modules/arch/x86/tests/movdq32.asm \
+ modules/arch/x86/tests/movdq32.hex \
+ modules/arch/x86/tests/movdq64.asm \
+ modules/arch/x86/tests/movdq64.hex \
+ modules/arch/x86/tests/negequ.asm \
+ modules/arch/x86/tests/negequ.hex \
+ modules/arch/x86/tests/nomem64-err.asm \
+ modules/arch/x86/tests/nomem64-err.errwarn \
+ modules/arch/x86/tests/nomem64-err2.asm \
+ modules/arch/x86/tests/nomem64-err2.errwarn \
+ modules/arch/x86/tests/nomem64.asm \
+ modules/arch/x86/tests/nomem64.errwarn \
+ modules/arch/x86/tests/nomem64.hex \
+ modules/arch/x86/tests/o64.asm modules/arch/x86/tests/o64.hex \
+ modules/arch/x86/tests/o64loop.asm \
+ modules/arch/x86/tests/o64loop.errwarn \
+ modules/arch/x86/tests/o64loop.hex \
+ modules/arch/x86/tests/opersize.asm \
+ modules/arch/x86/tests/opersize.hex \
+ modules/arch/x86/tests/opsize-err.asm \
+ modules/arch/x86/tests/opsize-err.errwarn \
+ modules/arch/x86/tests/overflow.asm \
+ modules/arch/x86/tests/overflow.errwarn \
+ modules/arch/x86/tests/overflow.hex \
+ modules/arch/x86/tests/padlock.asm \
+ modules/arch/x86/tests/padlock.hex \
+ modules/arch/x86/tests/pshift.asm \
+ modules/arch/x86/tests/pshift.hex \
+ modules/arch/x86/tests/push64.asm \
+ modules/arch/x86/tests/push64.errwarn \
+ modules/arch/x86/tests/push64.hex \
+ modules/arch/x86/tests/pushf.asm \
+ modules/arch/x86/tests/pushf.hex \
+ modules/arch/x86/tests/pushf-err.asm \
+ modules/arch/x86/tests/pushf-err.errwarn \
+ modules/arch/x86/tests/pushnosize.asm \
+ modules/arch/x86/tests/pushnosize.errwarn \
+ modules/arch/x86/tests/pushnosize.hex \
+ modules/arch/x86/tests/rep.asm modules/arch/x86/tests/rep.hex \
+ modules/arch/x86/tests/ret.asm modules/arch/x86/tests/ret.hex \
+ modules/arch/x86/tests/riprel1.asm \
+ modules/arch/x86/tests/riprel1.hex \
+ modules/arch/x86/tests/riprel2.asm \
+ modules/arch/x86/tests/riprel2.errwarn \
+ modules/arch/x86/tests/riprel2.hex \
+ modules/arch/x86/tests/ripseg.asm \
+ modules/arch/x86/tests/ripseg.errwarn \
+ modules/arch/x86/tests/ripseg.hex \
+ modules/arch/x86/tests/segmov.asm \
+ modules/arch/x86/tests/segmov.hex \
+ modules/arch/x86/tests/segoff.asm \
+ modules/arch/x86/tests/segoff.hex \
+ modules/arch/x86/tests/segoff-err.asm \
+ modules/arch/x86/tests/segoff-err.errwarn \
+ modules/arch/x86/tests/shift.asm \
+ modules/arch/x86/tests/shift.hex \
+ modules/arch/x86/tests/simd-1.asm \
+ modules/arch/x86/tests/simd-1.hex \
+ modules/arch/x86/tests/simd-2.asm \
+ modules/arch/x86/tests/simd-2.hex \
+ modules/arch/x86/tests/simd64-1.asm \
+ modules/arch/x86/tests/simd64-1.hex \
+ modules/arch/x86/tests/simd64-2.asm \
+ modules/arch/x86/tests/simd64-2.hex \
+ modules/arch/x86/tests/sse-prefix.asm \
+ modules/arch/x86/tests/sse-prefix.hex \
+ modules/arch/x86/tests/sse3.asm \
+ modules/arch/x86/tests/sse3.hex \
+ modules/arch/x86/tests/sse4.asm \
+ modules/arch/x86/tests/sse4.hex \
+ modules/arch/x86/tests/sse4-err.asm \
+ modules/arch/x86/tests/sse4-err.errwarn \
+ modules/arch/x86/tests/sse5-all.asm \
+ modules/arch/x86/tests/sse5-all.hex \
+ modules/arch/x86/tests/sse5-basic.asm \
+ modules/arch/x86/tests/sse5-basic.hex \
+ modules/arch/x86/tests/sse5-cc.asm \
+ modules/arch/x86/tests/sse5-cc.hex \
+ modules/arch/x86/tests/sse5-err.asm \
+ modules/arch/x86/tests/sse5-err.errwarn \
+ modules/arch/x86/tests/ssewidth.asm \
+ modules/arch/x86/tests/ssewidth.hex \
+ modules/arch/x86/tests/ssse3.asm \
+ modules/arch/x86/tests/ssse3.c \
+ modules/arch/x86/tests/ssse3.hex \
+ modules/arch/x86/tests/stos.asm \
+ modules/arch/x86/tests/stos.hex modules/arch/x86/tests/str.asm \
+ modules/arch/x86/tests/str.hex \
+ modules/arch/x86/tests/strict.asm \
+ modules/arch/x86/tests/strict.errwarn \
+ modules/arch/x86/tests/strict.hex \
+ modules/arch/x86/tests/strict-err.asm \
+ modules/arch/x86/tests/strict-err.errwarn \
+ modules/arch/x86/tests/stringseg.asm \
+ modules/arch/x86/tests/stringseg.errwarn \
+ modules/arch/x86/tests/stringseg.hex \
+ modules/arch/x86/tests/svm.asm modules/arch/x86/tests/svm.hex \
+ modules/arch/x86/tests/twobytemem.asm \
+ modules/arch/x86/tests/twobytemem.errwarn \
+ modules/arch/x86/tests/twobytemem.hex \
+ modules/arch/x86/tests/vmx.asm modules/arch/x86/tests/vmx.hex \
+ modules/arch/x86/tests/vmx-err.asm \
+ modules/arch/x86/tests/vmx-err.errwarn \
+ modules/arch/x86/tests/x86label.asm \
+ modules/arch/x86/tests/x86label.hex \
+ modules/arch/x86/tests/xchg64.asm \
+ modules/arch/x86/tests/xchg64.hex \
+ modules/arch/x86/tests/xmm64.asm \
+ modules/arch/x86/tests/xmm64.hex \
+ modules/arch/x86/tests/xsave.asm \
+ modules/arch/x86/tests/xsave.hex \
+ modules/arch/x86/tests/gas32/Makefile.inc \
+ modules/arch/x86/tests/gas64/Makefile.inc \
+ modules/arch/x86/tests/gas32/x86_gas32_test.sh \
+ modules/arch/x86/tests/gas32/align32.asm \
+ modules/arch/x86/tests/gas32/align32.hex \
+ modules/arch/x86/tests/gas32/gas-farithr.asm \
+ modules/arch/x86/tests/gas32/gas-farithr.hex \
+ modules/arch/x86/tests/gas32/gas-fpmem.asm \
+ modules/arch/x86/tests/gas32/gas-fpmem.hex \
+ modules/arch/x86/tests/gas32/gas-movdq32.asm \
+ modules/arch/x86/tests/gas32/gas-movdq32.hex \
+ modules/arch/x86/tests/gas32/gas-movsd.asm \
+ modules/arch/x86/tests/gas32/gas-movsd.hex \
+ modules/arch/x86/tests/gas32/gas32-jmpcall.asm \
+ modules/arch/x86/tests/gas32/gas32-jmpcall.hex \
+ modules/arch/x86/tests/gas64/x86_gas64_test.sh \
+ modules/arch/x86/tests/gas64/align64.asm \
+ modules/arch/x86/tests/gas64/align64.hex \
+ modules/arch/x86/tests/gas64/gas-cbw.asm \
+ modules/arch/x86/tests/gas64/gas-cbw.hex \
+ modules/arch/x86/tests/gas64/gas-fp.asm \
+ modules/arch/x86/tests/gas64/gas-fp.hex \
+ modules/arch/x86/tests/gas64/gas-inout.asm \
+ modules/arch/x86/tests/gas64/gas-inout.hex \
+ modules/arch/x86/tests/gas64/gas-moreinsn.asm \
+ modules/arch/x86/tests/gas64/gas-moreinsn.hex \
+ modules/arch/x86/tests/gas64/gas-movabs.asm \
+ modules/arch/x86/tests/gas64/gas-movabs.hex \
+ modules/arch/x86/tests/gas64/gas-movdq64.asm \
+ modules/arch/x86/tests/gas64/gas-movdq64.hex \
+ modules/arch/x86/tests/gas64/gas-movsxs.asm \
+ modules/arch/x86/tests/gas64/gas-movsxs.hex \
+ modules/arch/x86/tests/gas64/gas-muldiv.asm \
+ modules/arch/x86/tests/gas64/gas-muldiv.hex \
+ modules/arch/x86/tests/gas64/gas-prefix.asm \
+ modules/arch/x86/tests/gas64/gas-prefix.errwarn \
+ modules/arch/x86/tests/gas64/gas-prefix.hex \
+ modules/arch/x86/tests/gas64/gas-retenter.asm \
+ modules/arch/x86/tests/gas64/gas-retenter.hex \
+ modules/arch/x86/tests/gas64/gas-shift.asm \
+ modules/arch/x86/tests/gas64/gas-shift.hex \
+ modules/arch/x86/tests/gas64/gas64-jmpcall.asm \
+ modules/arch/x86/tests/gas64/gas64-jmpcall.hex \
+ modules/arch/x86/tests/gas64/riprel.asm \
+ modules/arch/x86/tests/gas64/riprel.hex \
+ modules/arch/lc3b/tests/Makefile.inc \
+ modules/arch/lc3b/lc3bid.re \
+ modules/arch/lc3b/tests/lc3b_test.sh \
+ modules/arch/lc3b/tests/lc3b-basic.asm \
+ modules/arch/lc3b/tests/lc3b-basic.errwarn \
+ modules/arch/lc3b/tests/lc3b-basic.hex \
+ modules/arch/lc3b/tests/lc3b-br.asm \
+ modules/arch/lc3b/tests/lc3b-br.hex \
+ modules/arch/lc3b/tests/lc3b-ea-err.asm \
+ modules/arch/lc3b/tests/lc3b-ea-err.errwarn \
+ modules/arch/lc3b/tests/lc3b-mp22NC.asm \
+ modules/arch/lc3b/tests/lc3b-mp22NC.hex \
+ modules/arch/yasm_arch.xml modules/listfmts/nasm/Makefile.inc \
+ modules/parsers/gas/Makefile.inc \
+ modules/parsers/nasm/Makefile.inc \
+ modules/parsers/gas/tests/Makefile.inc \
+ modules/parsers/gas/gas-token.re \
+ modules/parsers/gas/tests/gas_test.sh \
+ modules/parsers/gas/tests/dataref-imm.asm \
+ modules/parsers/gas/tests/dataref-imm.hex \
+ modules/parsers/gas/tests/datavis.asm \
+ modules/parsers/gas/tests/datavis.errwarn \
+ modules/parsers/gas/tests/datavis.hex \
+ modules/parsers/gas/tests/datavis2.asm \
+ modules/parsers/gas/tests/datavis2.hex \
+ modules/parsers/gas/tests/execsect.asm \
+ modules/parsers/gas/tests/execsect.hex \
+ modules/parsers/gas/tests/gas-fill.asm \
+ modules/parsers/gas/tests/gas-fill.hex \
+ modules/parsers/gas/tests/gas-float.asm \
+ modules/parsers/gas/tests/gas-float.hex \
+ modules/parsers/gas/tests/gas-instlabel.asm \
+ modules/parsers/gas/tests/gas-instlabel.hex \
+ modules/parsers/gas/tests/gas-line-err.asm \
+ modules/parsers/gas/tests/gas-line-err.errwarn \
+ modules/parsers/gas/tests/gas-line2-err.asm \
+ modules/parsers/gas/tests/gas-line2-err.errwarn \
+ modules/parsers/gas/tests/gas-push.asm \
+ modules/parsers/gas/tests/gas-push.hex \
+ modules/parsers/gas/tests/gas-segprefix.asm \
+ modules/parsers/gas/tests/gas-segprefix.hex \
+ modules/parsers/gas/tests/gas-semi.asm \
+ modules/parsers/gas/tests/gas-semi.hex \
+ modules/parsers/gas/tests/gassectalign.asm \
+ modules/parsers/gas/tests/gassectalign.hex \
+ modules/parsers/gas/tests/jmpcall.asm \
+ modules/parsers/gas/tests/jmpcall.errwarn \
+ modules/parsers/gas/tests/jmpcall.hex \
+ modules/parsers/gas/tests/leb128.asm \
+ modules/parsers/gas/tests/leb128.hex \
+ modules/parsers/gas/tests/localcomm.asm \
+ modules/parsers/gas/tests/localcomm.hex \
+ modules/parsers/gas/tests/reggroup-err.asm \
+ modules/parsers/gas/tests/reggroup-err.errwarn \
+ modules/parsers/gas/tests/reggroup.asm \
+ modules/parsers/gas/tests/reggroup.hex \
+ modules/parsers/gas/tests/strzero.asm \
+ modules/parsers/gas/tests/strzero.hex \
+ modules/parsers/gas/tests/varinsn.asm \
+ modules/parsers/gas/tests/varinsn.hex \
+ modules/parsers/gas/tests/bin/Makefile.inc \
+ modules/parsers/gas/tests/bin/gas_bin_test.sh \
+ modules/parsers/gas/tests/bin/gas-comment.asm \
+ modules/parsers/gas/tests/bin/gas-comment.errwarn \
+ modules/parsers/gas/tests/bin/gas-comment.hex \
+ modules/parsers/gas/tests/bin/gas-llabel.asm \
+ modules/parsers/gas/tests/bin/gas-llabel.hex \
+ modules/parsers/gas/tests/bin/gas-set.asm \
+ modules/parsers/gas/tests/bin/gas-set.hex \
+ modules/parsers/gas/tests/bin/rept-err.asm \
+ modules/parsers/gas/tests/bin/rept-err.errwarn \
+ modules/parsers/gas/tests/bin/reptempty.asm \
+ modules/parsers/gas/tests/bin/reptempty.hex \
+ modules/parsers/gas/tests/bin/reptlong.asm \
+ modules/parsers/gas/tests/bin/reptlong.hex \
+ modules/parsers/gas/tests/bin/reptnested-err.asm \
+ modules/parsers/gas/tests/bin/reptnested-err.errwarn \
+ modules/parsers/gas/tests/bin/reptsimple.asm \
+ modules/parsers/gas/tests/bin/reptsimple.hex \
+ modules/parsers/gas/tests/bin/reptwarn.asm \
+ modules/parsers/gas/tests/bin/reptwarn.errwarn \
+ modules/parsers/gas/tests/bin/reptwarn.hex \
+ modules/parsers/gas/tests/bin/reptzero.asm \
+ modules/parsers/gas/tests/bin/reptzero.hex \
+ modules/parsers/nasm/nasm-token.re \
+ modules/parsers/nasm/nasm-std.mac \
+ modules/parsers/nasm/tests/Makefile.inc \
+ modules/parsers/nasm/tests/nasm_test.sh \
+ modules/parsers/nasm/tests/alignnop16.asm \
+ modules/parsers/nasm/tests/alignnop16.hex \
+ modules/parsers/nasm/tests/alignnop32.asm \
+ modules/parsers/nasm/tests/alignnop32.hex \
+ modules/parsers/nasm/tests/charconstmath.asm \
+ modules/parsers/nasm/tests/charconstmath.hex \
+ modules/parsers/nasm/tests/dy.asm \
+ modules/parsers/nasm/tests/dy.hex \
+ modules/parsers/nasm/tests/endcomma.asm \
+ modules/parsers/nasm/tests/endcomma.hex \
+ modules/parsers/nasm/tests/equcolon.asm \
+ modules/parsers/nasm/tests/equcolon.hex \
+ modules/parsers/nasm/tests/equlocal.asm \
+ modules/parsers/nasm/tests/equlocal.hex \
+ modules/parsers/nasm/tests/hexconst.asm \
+ modules/parsers/nasm/tests/hexconst.hex \
+ modules/parsers/nasm/tests/long.asm \
+ modules/parsers/nasm/tests/long.hex \
+ modules/parsers/nasm/tests/locallabel.asm \
+ modules/parsers/nasm/tests/locallabel.hex \
+ modules/parsers/nasm/tests/locallabel2.asm \
+ modules/parsers/nasm/tests/locallabel2.hex \
+ modules/parsers/nasm/tests/nasm-prefix.asm \
+ modules/parsers/nasm/tests/nasm-prefix.hex \
+ modules/parsers/nasm/tests/newsect.asm \
+ modules/parsers/nasm/tests/newsect.hex \
+ modules/parsers/nasm/tests/orphannowarn.asm \
+ modules/parsers/nasm/tests/orphannowarn.hex \
+ modules/parsers/nasm/tests/prevlocalwarn.asm \
+ modules/parsers/nasm/tests/prevlocalwarn.errwarn \
+ modules/parsers/nasm/tests/prevlocalwarn.hex \
+ modules/parsers/nasm/tests/strucalign.asm \
+ modules/parsers/nasm/tests/strucalign.hex \
+ modules/parsers/nasm/tests/struczero.asm \
+ modules/parsers/nasm/tests/struczero.hex \
+ modules/parsers/nasm/tests/syntax-err.asm \
+ modules/parsers/nasm/tests/syntax-err.errwarn \
+ modules/parsers/nasm/tests/uscore.asm \
+ modules/parsers/nasm/tests/uscore.hex \
+ modules/parsers/nasm/tests/worphan/Makefile.inc \
+ modules/parsers/nasm/tests/worphan/nasm_worphan_test.sh \
+ modules/parsers/nasm/tests/worphan/orphanwarn.asm \
+ modules/parsers/nasm/tests/worphan/orphanwarn.errwarn \
+ modules/parsers/nasm/tests/worphan/orphanwarn.hex \
+ modules/parsers/tasm/tests/Makefile.inc \
+ modules/parsers/tasm/tests/tasm_test.sh \
+ modules/parsers/tasm/tests/array.asm \
+ modules/parsers/tasm/tests/array.hex \
+ modules/parsers/tasm/tests/case.asm \
+ modules/parsers/tasm/tests/case.hex \
+ modules/parsers/tasm/tests/charstr.asm \
+ modules/parsers/tasm/tests/charstr.hex \
+ modules/parsers/tasm/tests/dup.asm \
+ modules/parsers/tasm/tests/dup.hex \
+ modules/parsers/tasm/tests/equal.asm \
+ modules/parsers/tasm/tests/equal.hex \
+ modules/parsers/tasm/tests/expr.asm \
+ modules/parsers/tasm/tests/expr.hex \
+ modules/parsers/tasm/tests/irp.asm \
+ modules/parsers/tasm/tests/irp.hex \
+ modules/parsers/tasm/tests/label.asm \
+ modules/parsers/tasm/tests/label.hex \
+ modules/parsers/tasm/tests/les.asm \
+ modules/parsers/tasm/tests/les.hex \
+ modules/parsers/tasm/tests/lidt.asm \
+ modules/parsers/tasm/tests/lidt.hex \
+ modules/parsers/tasm/tests/macro.asm \
+ modules/parsers/tasm/tests/macro.hex \
+ modules/parsers/tasm/tests/offset.asm \
+ modules/parsers/tasm/tests/offset.hex \
+ modules/parsers/tasm/tests/quote.asm \
+ modules/parsers/tasm/tests/quote.hex \
+ modules/parsers/tasm/tests/res.asm \
+ modules/parsers/tasm/tests/res.errwarn \
+ modules/parsers/tasm/tests/res.hex \
+ modules/parsers/tasm/tests/segment.asm \
+ modules/parsers/tasm/tests/segment.hex \
+ modules/parsers/tasm/tests/size.asm \
+ modules/parsers/tasm/tests/size.hex \
+ modules/parsers/tasm/tests/struc.asm \
+ modules/parsers/tasm/tests/struc.errwarn \
+ modules/parsers/tasm/tests/struc.hex \
+ modules/parsers/tasm/tests/exe/Makefile.inc \
+ modules/parsers/tasm/tests/exe/tasm_exe_test.sh \
+ modules/parsers/tasm/tests/exe/exe.asm \
+ modules/parsers/tasm/tests/exe/exe.hex \
+ modules/parsers/yasm_parsers.xml \
+ modules/preprocs/nasm/Makefile.inc \
+ modules/preprocs/raw/Makefile.inc \
+ modules/preprocs/cpp/Makefile.inc \
+ modules/preprocs/nasm/genversion.c \
+ modules/preprocs/nasm/tests/Makefile.inc \
+ modules/preprocs/nasm/tests/nasmpp_test.sh \
+ modules/preprocs/nasm/tests/16args.asm \
+ modules/preprocs/nasm/tests/16args.hex \
+ modules/preprocs/nasm/tests/ifcritical-err.asm \
+ modules/preprocs/nasm/tests/ifcritical-err.errwarn \
+ modules/preprocs/nasm/tests/longline.asm \
+ modules/preprocs/nasm/tests/longline.hex \
+ modules/preprocs/nasm/tests/macroeof-err.asm \
+ modules/preprocs/nasm/tests/macroeof-err.errwarn \
+ modules/preprocs/nasm/tests/noinclude-err.asm \
+ modules/preprocs/nasm/tests/noinclude-err.errwarn \
+ modules/preprocs/nasm/tests/nasmpp-bigint.asm \
+ modules/preprocs/nasm/tests/nasmpp-bigint.hex \
+ modules/preprocs/nasm/tests/nasmpp-decimal.asm \
+ modules/preprocs/nasm/tests/nasmpp-decimal.hex \
+ modules/preprocs/nasm/tests/nasmpp-nested.asm \
+ modules/preprocs/nasm/tests/nasmpp-nested.errwarn \
+ modules/preprocs/nasm/tests/nasmpp-nested.hex \
+ modules/preprocs/nasm/tests/orgsect.asm \
+ modules/preprocs/nasm/tests/orgsect.hex \
+ modules/preprocs/raw/tests/Makefile.inc \
+ modules/preprocs/raw/tests/rawpp_test.sh \
+ modules/preprocs/raw/tests/longline.asm \
+ modules/preprocs/raw/tests/longline.hex \
+ modules/dbgfmts/codeview/Makefile.inc \
+ modules/dbgfmts/dwarf2/Makefile.inc \
+ modules/dbgfmts/null/Makefile.inc \
+ modules/dbgfmts/stabs/Makefile.inc \
+ modules/dbgfmts/codeview/cv8.txt \
+ modules/dbgfmts/dwarf2/tests/Makefile.inc \
+ modules/dbgfmts/dwarf2/tests/pass32/Makefile.inc \
+ modules/dbgfmts/dwarf2/tests/pass64/Makefile.inc \
+ modules/dbgfmts/dwarf2/tests/passwin64/Makefile.inc \
+ modules/dbgfmts/dwarf2/tests/pass32/dwarf2_pass32_test.sh \
+ modules/dbgfmts/dwarf2/tests/pass32/dwarf32-err.asm \
+ modules/dbgfmts/dwarf2/tests/pass32/dwarf32-err.errwarn \
+ modules/dbgfmts/dwarf2/tests/pass32/dwarf32_testhd.asm \
+ modules/dbgfmts/dwarf2/tests/pass32/dwarf32_testhd.hex \
+ modules/dbgfmts/dwarf2/tests/pass64/dwarf2_pass64_test.sh \
+ modules/dbgfmts/dwarf2/tests/pass64/dwarf64_2loc.asm \
+ modules/dbgfmts/dwarf2/tests/pass64/dwarf64_2loc.hex \
+ modules/dbgfmts/dwarf2/tests/pass64/dwarf64_leb128.asm \
+ modules/dbgfmts/dwarf2/tests/pass64/dwarf64_leb128.hex \
+ modules/dbgfmts/dwarf2/tests/passwin64/dwarf2_passwin64_test.sh \
+ modules/dbgfmts/dwarf2/tests/passwin64/dwarfwin64_testhd.asm \
+ modules/dbgfmts/dwarf2/tests/passwin64/dwarfwin64_testhd.errwarn \
+ modules/dbgfmts/dwarf2/tests/passwin64/dwarfwin64_testhd.hex \
+ modules/dbgfmts/stabs/tests/Makefile.inc \
+ modules/dbgfmts/stabs/tests/stabs_test.sh \
+ modules/dbgfmts/stabs/tests/stabs-elf.asm \
+ modules/dbgfmts/stabs/tests/stabs-elf.hex \
+ modules/dbgfmts/yasm_dbgfmts.xml \
+ modules/objfmts/dbg/Makefile.inc \
+ modules/objfmts/bin/Makefile.inc \
+ modules/objfmts/elf/Makefile.inc \
+ modules/objfmts/coff/Makefile.inc \
+ modules/objfmts/macho/Makefile.inc \
+ modules/objfmts/rdf/Makefile.inc \
+ modules/objfmts/win32/Makefile.inc \
+ modules/objfmts/win64/Makefile.inc \
+ modules/objfmts/xdf/Makefile.inc \
+ modules/objfmts/bin/tests/Makefile.inc \
+ modules/objfmts/bin/tests/bin_test.sh \
+ modules/objfmts/bin/tests/abs.asm \
+ modules/objfmts/bin/tests/abs.hex \
+ modules/objfmts/bin/tests/bigorg.asm \
+ modules/objfmts/bin/tests/bigorg.hex \
+ modules/objfmts/bin/tests/bigorg.errwarn \
+ modules/objfmts/bin/tests/bin-farabs.asm \
+ modules/objfmts/bin/tests/bin-farabs.hex \
+ modules/objfmts/bin/tests/bin-rip.asm \
+ modules/objfmts/bin/tests/bin-rip.hex \
+ modules/objfmts/bin/tests/bintest.asm \
+ modules/objfmts/bin/tests/bintest.hex \
+ modules/objfmts/bin/tests/float-err.asm \
+ modules/objfmts/bin/tests/float-err.errwarn \
+ modules/objfmts/bin/tests/float.asm \
+ modules/objfmts/bin/tests/float.hex \
+ modules/objfmts/bin/tests/integer-warn.asm \
+ modules/objfmts/bin/tests/integer-warn.hex \
+ modules/objfmts/bin/tests/integer-warn.errwarn \
+ modules/objfmts/bin/tests/integer.asm \
+ modules/objfmts/bin/tests/integer.hex \
+ modules/objfmts/bin/tests/levelop.asm \
+ modules/objfmts/bin/tests/levelop.hex \
+ modules/objfmts/bin/tests/reserve.asm \
+ modules/objfmts/bin/tests/reserve.hex \
+ modules/objfmts/bin/tests/reserve.errwarn \
+ modules/objfmts/bin/tests/shr.asm \
+ modules/objfmts/bin/tests/shr.hex \
+ modules/objfmts/bin/tests/multisect/Makefile.inc \
+ modules/objfmts/bin/tests/multisect/bin_multi_test.sh \
+ modules/objfmts/bin/tests/multisect/bin-align.asm \
+ modules/objfmts/bin/tests/multisect/bin-align.errwarn \
+ modules/objfmts/bin/tests/multisect/bin-align.hex \
+ modules/objfmts/bin/tests/multisect/bin-align.map \
+ modules/objfmts/bin/tests/multisect/bin-ssym.asm \
+ modules/objfmts/bin/tests/multisect/bin-ssym.hex \
+ modules/objfmts/bin/tests/multisect/bin-ssym.map \
+ modules/objfmts/bin/tests/multisect/follows-loop1-err.asm \
+ modules/objfmts/bin/tests/multisect/follows-loop1-err.errwarn \
+ modules/objfmts/bin/tests/multisect/follows-loop2-err.asm \
+ modules/objfmts/bin/tests/multisect/follows-loop2-err.errwarn \
+ modules/objfmts/bin/tests/multisect/follows-notfound-err.asm \
+ modules/objfmts/bin/tests/multisect/follows-notfound-err.errwarn \
+ modules/objfmts/bin/tests/multisect/initbss.asm \
+ modules/objfmts/bin/tests/multisect/initbss.errwarn \
+ modules/objfmts/bin/tests/multisect/initbss.hex \
+ modules/objfmts/bin/tests/multisect/initbss.map \
+ modules/objfmts/bin/tests/multisect/ldlinux-sects.asm \
+ modules/objfmts/bin/tests/multisect/ldlinux-sects.hex \
+ modules/objfmts/bin/tests/multisect/ldlinux-sects.map \
+ modules/objfmts/bin/tests/multisect/multisect1.asm \
+ modules/objfmts/bin/tests/multisect/multisect1.hex \
+ modules/objfmts/bin/tests/multisect/multisect1.map \
+ modules/objfmts/bin/tests/multisect/multisect2.asm \
+ modules/objfmts/bin/tests/multisect/multisect2.hex \
+ modules/objfmts/bin/tests/multisect/multisect2.map \
+ modules/objfmts/bin/tests/multisect/multisect3.asm \
+ modules/objfmts/bin/tests/multisect/multisect3.hex \
+ modules/objfmts/bin/tests/multisect/multisect3.map \
+ modules/objfmts/bin/tests/multisect/multisect4.asm \
+ modules/objfmts/bin/tests/multisect/multisect4.hex \
+ modules/objfmts/bin/tests/multisect/multisect4.map \
+ modules/objfmts/bin/tests/multisect/multisect5.asm \
+ modules/objfmts/bin/tests/multisect/multisect5.hex \
+ modules/objfmts/bin/tests/multisect/multisect5.map \
+ modules/objfmts/bin/tests/multisect/nomultisect1.asm \
+ modules/objfmts/bin/tests/multisect/nomultisect1.hex \
+ modules/objfmts/bin/tests/multisect/nomultisect1.map \
+ modules/objfmts/bin/tests/multisect/nomultisect2.asm \
+ modules/objfmts/bin/tests/multisect/nomultisect2.hex \
+ modules/objfmts/bin/tests/multisect/nomultisect2.map \
+ modules/objfmts/bin/tests/multisect/vfollows-loop1-err.asm \
+ modules/objfmts/bin/tests/multisect/vfollows-loop1-err.errwarn \
+ modules/objfmts/bin/tests/multisect/vfollows-loop2-err.asm \
+ modules/objfmts/bin/tests/multisect/vfollows-loop2-err.errwarn \
+ modules/objfmts/bin/tests/multisect/vfollows-notfound-err.asm \
+ modules/objfmts/bin/tests/multisect/vfollows-notfound-err.errwarn \
+ modules/objfmts/elf/tests/Makefile.inc \
+ modules/objfmts/elf/tests/elf_test.sh \
+ modules/objfmts/elf/tests/curpos.asm \
+ modules/objfmts/elf/tests/curpos.hex \
+ modules/objfmts/elf/tests/curpos-err.asm \
+ modules/objfmts/elf/tests/curpos-err.errwarn \
+ modules/objfmts/elf/tests/elf-overdef.asm \
+ modules/objfmts/elf/tests/elf-overdef.hex \
+ modules/objfmts/elf/tests/elf-x86id.asm \
+ modules/objfmts/elf/tests/elf-x86id.hex \
+ modules/objfmts/elf/tests/elfabssect.asm \
+ modules/objfmts/elf/tests/elfabssect.hex \
+ modules/objfmts/elf/tests/elfcond.asm \
+ modules/objfmts/elf/tests/elfcond.hex \
+ modules/objfmts/elf/tests/elfequabs.asm \
+ modules/objfmts/elf/tests/elfequabs.hex \
+ modules/objfmts/elf/tests/elfglobal.asm \
+ modules/objfmts/elf/tests/elfglobal.hex \
+ modules/objfmts/elf/tests/elfglobext.asm \
+ modules/objfmts/elf/tests/elfglobext.hex \
+ modules/objfmts/elf/tests/elfglobext2.asm \
+ modules/objfmts/elf/tests/elfglobext2.hex \
+ modules/objfmts/elf/tests/elfmanysym.asm \
+ modules/objfmts/elf/tests/elfmanysym.hex \
+ modules/objfmts/elf/tests/elfreloc.asm \
+ modules/objfmts/elf/tests/elfreloc.hex \
+ modules/objfmts/elf/tests/elfreloc-ext.asm \
+ modules/objfmts/elf/tests/elfreloc-ext.hex \
+ modules/objfmts/elf/tests/elfsectalign.asm \
+ modules/objfmts/elf/tests/elfsectalign.hex \
+ modules/objfmts/elf/tests/elfso.asm \
+ modules/objfmts/elf/tests/elfso.hex \
+ modules/objfmts/elf/tests/elftest.c \
+ modules/objfmts/elf/tests/elftest.asm \
+ modules/objfmts/elf/tests/elftest.hex \
+ modules/objfmts/elf/tests/elftimes.asm \
+ modules/objfmts/elf/tests/elftimes.hex \
+ modules/objfmts/elf/tests/elftypesize.asm \
+ modules/objfmts/elf/tests/elftypesize.hex \
+ modules/objfmts/elf/tests/elfvisibility.asm \
+ modules/objfmts/elf/tests/elfvisibility.errwarn \
+ modules/objfmts/elf/tests/elfvisibility.hex \
+ modules/objfmts/elf/tests/nasm-sectname.asm \
+ modules/objfmts/elf/tests/nasm-sectname.hex \
+ modules/objfmts/elf/tests/nasm-forceident.asm \
+ modules/objfmts/elf/tests/nasm-forceident.hex \
+ modules/objfmts/elf/tests/amd64/Makefile.inc \
+ modules/objfmts/elf/tests/gas32/Makefile.inc \
+ modules/objfmts/elf/tests/gas64/Makefile.inc \
+ modules/objfmts/elf/tests/amd64/elf_amd64_test.sh \
+ modules/objfmts/elf/tests/amd64/elf-rip.asm \
+ modules/objfmts/elf/tests/amd64/elf-rip.hex \
+ modules/objfmts/elf/tests/amd64/elfso64.asm \
+ modules/objfmts/elf/tests/amd64/elfso64.hex \
+ modules/objfmts/elf/tests/amd64/gotpcrel.asm \
+ modules/objfmts/elf/tests/amd64/gotpcrel.hex \
+ modules/objfmts/elf/tests/gas32/elf_gas32_test.sh \
+ modules/objfmts/elf/tests/gas32/elf_gas32_ssym.asm \
+ modules/objfmts/elf/tests/gas32/elf_gas32_ssym.hex \
+ modules/objfmts/elf/tests/gas64/elf_gas64_test.sh \
+ modules/objfmts/elf/tests/gas64/crosssect.asm \
+ modules/objfmts/elf/tests/gas64/crosssect.hex \
+ modules/objfmts/elf/tests/gas64/elf_gas64_curpos.asm \
+ modules/objfmts/elf/tests/gas64/elf_gas64_curpos.hex \
+ modules/objfmts/elf/tests/gas64/elf_gas64_reloc.asm \
+ modules/objfmts/elf/tests/gas64/elf_gas64_reloc.hex \
+ modules/objfmts/elf/tests/gas64/elf_gas64_ssym.asm \
+ modules/objfmts/elf/tests/gas64/elf_gas64_ssym.hex \
+ modules/objfmts/coff/win64-nasm.mac \
+ modules/objfmts/coff/win64-gas.mac \
+ modules/objfmts/coff/tests/Makefile.inc \
+ modules/objfmts/coff/tests/coff_test.sh \
+ modules/objfmts/coff/tests/cofftest.c \
+ modules/objfmts/coff/tests/cofftest.asm \
+ modules/objfmts/coff/tests/cofftest.hex \
+ modules/objfmts/coff/tests/cofftimes.asm \
+ modules/objfmts/coff/tests/cofftimes.hex \
+ modules/objfmts/coff/tests/x86id.asm \
+ modules/objfmts/coff/tests/x86id.hex \
+ modules/objfmts/coff/tests/x86id.errwarn \
+ modules/objfmts/macho/tests/Makefile.inc \
+ modules/objfmts/macho/tests/gas32/Makefile.inc \
+ modules/objfmts/macho/tests/gas64/Makefile.inc \
+ modules/objfmts/macho/tests/nasm32/Makefile.inc \
+ modules/objfmts/macho/tests/nasm64/Makefile.inc \
+ modules/objfmts/macho/tests/gas32/gas_macho32_test.sh \
+ modules/objfmts/macho/tests/gas32/gas-macho32.asm \
+ modules/objfmts/macho/tests/gas32/gas-macho32.hex \
+ modules/objfmts/macho/tests/gas64/gas_macho64_test.sh \
+ modules/objfmts/macho/tests/gas64/gas-macho64.asm \
+ modules/objfmts/macho/tests/gas64/gas-macho64.hex \
+ modules/objfmts/macho/tests/gas64/gas-macho64-pic.asm \
+ modules/objfmts/macho/tests/gas64/gas-macho64-pic.hex \
+ modules/objfmts/macho/tests/nasm32/macho32_test.sh \
+ modules/objfmts/macho/tests/nasm32/machotest.c \
+ modules/objfmts/macho/tests/nasm32/machotest.asm \
+ modules/objfmts/macho/tests/nasm32/machotest.hex \
+ modules/objfmts/macho/tests/nasm32/macho-reloc.asm \
+ modules/objfmts/macho/tests/nasm32/macho-reloc.hex \
+ modules/objfmts/macho/tests/nasm32/macho32-sect.asm \
+ modules/objfmts/macho/tests/nasm32/macho32-sect.errwarn \
+ modules/objfmts/macho/tests/nasm32/macho32-sect.hex \
+ modules/objfmts/macho/tests/nasm64/nasm-macho64-pic.asm \
+ modules/objfmts/macho/tests/nasm64/nasm-macho64-pic.hex \
+ modules/objfmts/macho/tests/nasm64/macho64_test.sh \
+ modules/objfmts/macho/tests/nasm64/machotest64.c \
+ modules/objfmts/macho/tests/nasm64/machotest64.asm \
+ modules/objfmts/macho/tests/nasm64/machotest64.hex \
+ modules/objfmts/macho/tests/nasm64/macho-reloc64-err.asm \
+ modules/objfmts/macho/tests/nasm64/macho-reloc64-err.errwarn \
+ modules/objfmts/rdf/tests/Makefile.inc \
+ modules/objfmts/rdf/tests/rdf_test.sh \
+ modules/objfmts/rdf/tests/rdfabs.asm \
+ modules/objfmts/rdf/tests/rdfabs.errwarn \
+ modules/objfmts/rdf/tests/rdfabs.hex \
+ modules/objfmts/rdf/tests/rdfext.asm \
+ modules/objfmts/rdf/tests/rdfext.hex \
+ modules/objfmts/rdf/tests/rdfseg.asm \
+ modules/objfmts/rdf/tests/rdfseg.hex \
+ modules/objfmts/rdf/tests/rdfseg2.asm \
+ modules/objfmts/rdf/tests/rdfseg2.hex \
+ modules/objfmts/rdf/tests/rdftest1.asm \
+ modules/objfmts/rdf/tests/rdftest1.hex \
+ modules/objfmts/rdf/tests/rdftest2.asm \
+ modules/objfmts/rdf/tests/rdftest2.hex \
+ modules/objfmts/rdf/tests/rdtlib.asm \
+ modules/objfmts/rdf/tests/rdtlib.hex \
+ modules/objfmts/rdf/tests/rdtmain.asm \
+ modules/objfmts/rdf/tests/rdtmain.hex \
+ modules/objfmts/rdf/tests/testlib.asm \
+ modules/objfmts/rdf/tests/testlib.hex \
+ modules/objfmts/win32/tests/Makefile.inc \
+ modules/objfmts/win32/tests/export.asm \
+ modules/objfmts/win32/tests/export.hex \
+ modules/objfmts/win32/tests/win32_test.sh \
+ modules/objfmts/win32/tests/win32-curpos.asm \
+ modules/objfmts/win32/tests/win32-curpos.hex \
+ modules/objfmts/win32/tests/win32-overdef.asm \
+ modules/objfmts/win32/tests/win32-overdef.hex \
+ modules/objfmts/win32/tests/win32-safeseh.asm \
+ modules/objfmts/win32/tests/win32-safeseh.hex \
+ modules/objfmts/win32/tests/win32-safeseh.masm \
+ modules/objfmts/win32/tests/win32-segof.asm \
+ modules/objfmts/win32/tests/win32-segof.hex \
+ modules/objfmts/win32/tests/win32test.c \
+ modules/objfmts/win32/tests/win32test.asm \
+ modules/objfmts/win32/tests/win32test.hex \
+ modules/objfmts/win32/tests/gas/Makefile.inc \
+ modules/objfmts/win32/tests/gas/win32_gas_test.sh \
+ modules/objfmts/win32/tests/gas/win32at.asm \
+ modules/objfmts/win32/tests/gas/win32at.hex \
+ modules/objfmts/win64/tests/Makefile.inc \
+ modules/objfmts/win64/tests/win64_test.sh \
+ modules/objfmts/win64/tests/sce1.asm \
+ modules/objfmts/win64/tests/sce1.hex \
+ modules/objfmts/win64/tests/sce1-err.asm \
+ modules/objfmts/win64/tests/sce1-err.errwarn \
+ modules/objfmts/win64/tests/sce2.asm \
+ modules/objfmts/win64/tests/sce2.hex \
+ modules/objfmts/win64/tests/sce2-err.asm \
+ modules/objfmts/win64/tests/sce2-err.errwarn \
+ modules/objfmts/win64/tests/sce3.asm \
+ modules/objfmts/win64/tests/sce3.hex \
+ modules/objfmts/win64/tests/sce3.masm \
+ modules/objfmts/win64/tests/sce4.asm \
+ modules/objfmts/win64/tests/sce4.hex \
+ modules/objfmts/win64/tests/sce4.masm \
+ modules/objfmts/win64/tests/sce4-err.asm \
+ modules/objfmts/win64/tests/sce4-err.errwarn \
+ modules/objfmts/win64/tests/win64-abs.asm \
+ modules/objfmts/win64/tests/win64-abs.hex \
+ modules/objfmts/win64/tests/win64-curpos.asm \
+ modules/objfmts/win64/tests/win64-curpos.hex \
+ modules/objfmts/win64/tests/win64-dataref.asm \
+ modules/objfmts/win64/tests/win64-dataref.hex \
+ modules/objfmts/win64/tests/win64-dataref.masm \
+ modules/objfmts/win64/tests/win64-dataref2.asm \
+ modules/objfmts/win64/tests/win64-dataref2.hex \
+ modules/objfmts/win64/tests/win64-dataref2.masm \
+ modules/objfmts/win64/tests/gas/Makefile.inc \
+ modules/objfmts/win64/tests/gas/win64_gas_test.sh \
+ modules/objfmts/win64/tests/gas/win64-gas-sce.asm \
+ modules/objfmts/win64/tests/gas/win64-gas-sce.hex \
+ modules/objfmts/xdf/tests/Makefile.inc \
+ modules/objfmts/xdf/tests/xdf_test.sh \
+ modules/objfmts/xdf/tests/xdf-overdef.asm \
+ modules/objfmts/xdf/tests/xdf-overdef.hex \
+ modules/objfmts/xdf/tests/xdflong.asm \
+ modules/objfmts/xdf/tests/xdflong.hex \
+ modules/objfmts/xdf/tests/xdflong.errwarn \
+ modules/objfmts/xdf/tests/xdfother.asm \
+ modules/objfmts/xdf/tests/xdfother.hex \
+ modules/objfmts/xdf/tests/xdfprotect.asm \
+ modules/objfmts/xdf/tests/xdfprotect.hex \
+ modules/objfmts/xdf/tests/xdfsect.asm \
+ modules/objfmts/xdf/tests/xdfsect.hex \
+ modules/objfmts/xdf/tests/xdfsect-err.asm \
+ modules/objfmts/xdf/tests/xdfsect-err.errwarn \
+ modules/objfmts/xdf/tests/xdfvirtual.asm \
+ modules/objfmts/xdf/tests/xdfvirtual.hex \
+ modules/objfmts/yasm_objfmts.xml libyasm/genmodule.c \
+ libyasm/module.in libyasm/tests/Makefile.inc \
+ libyasm/tests/libyasm_test.sh libyasm/tests/1shl0.asm \
+ libyasm/tests/1shl0.hex libyasm/tests/absloop-err.asm \
+ libyasm/tests/absloop-err.errwarn \
+ libyasm/tests/charconst64.asm libyasm/tests/charconst64.hex \
+ libyasm/tests/data-rawvalue.asm \
+ libyasm/tests/data-rawvalue.hex libyasm/tests/duplabel-err.asm \
+ libyasm/tests/duplabel-err.errwarn libyasm/tests/emptydata.asm \
+ libyasm/tests/emptydata.hex libyasm/tests/equ-expand.asm \
+ libyasm/tests/equ-expand.hex libyasm/tests/expr-fold-level.asm \
+ libyasm/tests/expr-fold-level.hex \
+ libyasm/tests/expr-wide-ident.asm \
+ libyasm/tests/expr-wide-ident.hex libyasm/tests/externdef.asm \
+ libyasm/tests/externdef.errwarn libyasm/tests/externdef.hex \
+ libyasm/tests/incbin.asm libyasm/tests/incbin.hex \
+ libyasm/tests/jmpsize1.asm libyasm/tests/jmpsize1.hex \
+ libyasm/tests/jmpsize1-err.asm \
+ libyasm/tests/jmpsize1-err.errwarn \
+ libyasm/tests/opt-align1.asm libyasm/tests/opt-align1.hex \
+ libyasm/tests/opt-align2.asm libyasm/tests/opt-align2.hex \
+ libyasm/tests/opt-align3.asm libyasm/tests/opt-align3.hex \
+ libyasm/tests/opt-circular1-err.asm \
+ libyasm/tests/opt-circular1-err.errwarn \
+ libyasm/tests/opt-circular2-err.asm \
+ libyasm/tests/opt-circular2-err.errwarn \
+ libyasm/tests/opt-circular3-err.asm \
+ libyasm/tests/opt-circular3-err.errwarn \
+ libyasm/tests/opt-gvmat64.asm libyasm/tests/opt-gvmat64.hex \
+ libyasm/tests/opt-immexpand.asm \
+ libyasm/tests/opt-immexpand.hex \
+ libyasm/tests/opt-immnoexpand.asm \
+ libyasm/tests/opt-immnoexpand.hex \
+ libyasm/tests/opt-oldalign.asm libyasm/tests/opt-oldalign.hex \
+ libyasm/tests/opt-struc.asm libyasm/tests/opt-struc.hex \
+ libyasm/tests/reserve-err1.asm \
+ libyasm/tests/reserve-err1.errwarn \
+ libyasm/tests/reserve-err2.asm \
+ libyasm/tests/reserve-err2.errwarn libyasm/tests/strucsize.asm \
+ libyasm/tests/strucsize.hex libyasm/tests/times0.asm \
+ libyasm/tests/times0.hex libyasm/tests/timesover-err.asm \
+ libyasm/tests/timesover-err.errwarn \
+ libyasm/tests/timesunder.asm libyasm/tests/timesunder.hex \
+ libyasm/tests/times-res.asm libyasm/tests/times-res.errwarn \
+ libyasm/tests/times-res.hex libyasm/tests/unary.asm \
+ libyasm/tests/unary.hex libyasm/tests/value-err.asm \
+ libyasm/tests/value-err.errwarn \
+ libyasm/tests/value-samesym.asm \
+ libyasm/tests/value-samesym.errwarn \
+ libyasm/tests/value-samesym.hex libyasm/tests/value-mask.asm \
+ libyasm/tests/value-mask.errwarn libyasm/tests/value-mask.hex \
+ frontends/yasm/Makefile.inc frontends/tasm/Makefile.inc \
+ frontends/yasm/yasm.xml m4/intmax.m4 m4/longdouble.m4 \
+ m4/nls.m4 m4/po.m4 m4/printf-posix.m4 m4/signed.m4 \
+ m4/size_max.m4 m4/ulonglong.m4 m4/wchar_t.m4 m4/wint_t.m4 \
+ m4/xsize.m4 m4/codeset.m4 m4/gettext.m4 m4/glibc21.m4 \
+ m4/iconv.m4 m4/intdiv0.m4 m4/inttypes.m4 m4/inttypes_h.m4 \
+ m4/inttypes-pri.m4 m4/isc-posix.m4 m4/lcmessage.m4 \
+ m4/lib-ld.m4 m4/lib-link.m4 m4/lib-prefix.m4 m4/longlong.m4 \
+ m4/progtest.m4 m4/stdint_h.m4 m4/uintmax_t.m4 m4/pythonhead.m4 \
+ m4/pyrex.m4 out_test.sh Artistic.txt BSD.txt GNU_GPL-2.0 \
+ GNU_LGPL-2.0 splint.sh Mkfiles/Makefile.flat \
+ Mkfiles/Makefile.dj Mkfiles/dj/config.h \
+ Mkfiles/dj/libyasm-stdint.h \
+ Mkfiles/vc9/crt_secure_no_deprecate.vsprops \
+ Mkfiles/vc9/yasm.sln Mkfiles/vc9/yasm.vcproj \
+ Mkfiles/vc9/ytasm.vcproj Mkfiles/vc9/config.h \
+ Mkfiles/vc9/libyasm-stdint.h Mkfiles/vc9/readme.vc9.txt \
+ Mkfiles/vc9/yasm.rules Mkfiles/vc9/vc98_swap.py \
+ Mkfiles/vc9/genmacro/genmacro.vcproj \
+ Mkfiles/vc9/genmacro/run.bat \
+ Mkfiles/vc9/genmodule/genmodule.vcproj \
+ Mkfiles/vc9/genmodule/run.bat \
+ Mkfiles/vc9/genstring/genstring.vcproj \
+ Mkfiles/vc9/genstring/run.bat \
+ Mkfiles/vc9/genversion/genversion.vcproj \
+ Mkfiles/vc9/genversion/run.bat \
+ Mkfiles/vc9/libyasm/libyasm.vcproj \
+ Mkfiles/vc9/modules/modules.vcproj \
+ Mkfiles/vc9/re2c/re2c.vcproj Mkfiles/vc9/re2c/run.bat \
+ Mkfiles/vc9/genperf/genperf.vcproj Mkfiles/vc9/genperf/run.bat \
+ genstring.c
+
+# libyasm-stdint.h doesn't clean up after itself?
+CONFIG_CLEAN_FILES = libyasm-stdint.h
+re2c_SOURCES =
+re2c_LDADD = re2c-main.$(OBJEXT) re2c-code.$(OBJEXT) \
+ re2c-dfa.$(OBJEXT) re2c-parser.$(OBJEXT) \
+ re2c-actions.$(OBJEXT) re2c-scanner.$(OBJEXT) \
+ re2c-mbo_getopt.$(OBJEXT) re2c-substr.$(OBJEXT) \
+ re2c-translate.$(OBJEXT)
+re2c_LINK = $(CCLD_FOR_BUILD) -o $@
+genmacro_SOURCES =
+genmacro_LDADD = genmacro.$(OBJEXT)
+genmacro_LINK = $(CCLD_FOR_BUILD) -o $@
+genperf_SOURCES =
+genperf_LDADD = genperf.$(OBJEXT) gp-perfect.$(OBJEXT) \
+ gp-phash.$(OBJEXT) gp-xmalloc.$(OBJEXT) gp-xstrdup.$(OBJEXT)
+genperf_LINK = $(CCLD_FOR_BUILD) -o $@
+PYBINDING_DEPS = tools/python-yasm/bytecode.pxi \
+ tools/python-yasm/errwarn.pxi tools/python-yasm/expr.pxi \
+ tools/python-yasm/floatnum.pxi tools/python-yasm/intnum.pxi \
+ tools/python-yasm/symrec.pxi tools/python-yasm/value.pxi
+YASM_MODULES = arch_x86 arch_lc3b listfmt_nasm parser_gas parser_gnu \
+ parser_nasm parser_tasm preproc_nasm preproc_tasm preproc_raw \
+ preproc_cpp dbgfmt_cv8 dbgfmt_dwarf2 dbgfmt_null dbgfmt_stabs \
+ objfmt_dbg objfmt_bin objfmt_dosexe objfmt_elf objfmt_elf32 \
+ objfmt_elf64 objfmt_coff objfmt_macho objfmt_macho32 \
+ objfmt_macho64 objfmt_rdf objfmt_win32 objfmt_win64 objfmt_x64 \
+ objfmt_xdf
+lib_LIBRARIES = libyasm.a
+libyasm_a_SOURCES = modules/arch/x86/x86arch.c \
+ modules/arch/x86/x86arch.h modules/arch/x86/x86bc.c \
+ modules/arch/x86/x86expr.c modules/arch/x86/x86id.c \
+ modules/arch/lc3b/lc3barch.c modules/arch/lc3b/lc3barch.h \
+ modules/arch/lc3b/lc3bbc.c \
+ modules/listfmts/nasm/nasm-listfmt.c \
+ modules/parsers/gas/gas-parser.c \
+ modules/parsers/gas/gas-parser.h \
+ modules/parsers/gas/gas-parse.c \
+ modules/parsers/nasm/nasm-parser.c \
+ modules/parsers/nasm/nasm-parser.h \
+ modules/parsers/nasm/nasm-parse.c \
+ modules/preprocs/nasm/nasm-preproc.c \
+ modules/preprocs/nasm/nasm-pp.h \
+ modules/preprocs/nasm/nasm-pp.c modules/preprocs/nasm/nasm.h \
+ modules/preprocs/nasm/nasmlib.h \
+ modules/preprocs/nasm/nasmlib.c \
+ modules/preprocs/nasm/nasm-eval.h \
+ modules/preprocs/nasm/nasm-eval.c \
+ modules/preprocs/raw/raw-preproc.c \
+ modules/preprocs/cpp/cpp-preproc.c \
+ modules/dbgfmts/codeview/cv-dbgfmt.h \
+ modules/dbgfmts/codeview/cv-dbgfmt.c \
+ modules/dbgfmts/codeview/cv-symline.c \
+ modules/dbgfmts/codeview/cv-type.c \
+ modules/dbgfmts/dwarf2/dwarf2-dbgfmt.h \
+ modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c \
+ modules/dbgfmts/dwarf2/dwarf2-line.c \
+ modules/dbgfmts/dwarf2/dwarf2-aranges.c \
+ modules/dbgfmts/dwarf2/dwarf2-info.c \
+ modules/dbgfmts/null/null-dbgfmt.c \
+ modules/dbgfmts/stabs/stabs-dbgfmt.c \
+ modules/objfmts/dbg/dbg-objfmt.c \
+ modules/objfmts/bin/bin-objfmt.c modules/objfmts/elf/elf.c \
+ modules/objfmts/elf/elf.h modules/objfmts/elf/elf-objfmt.c \
+ modules/objfmts/elf/elf-machine.h \
+ modules/objfmts/elf/elf-x86-x86.c \
+ modules/objfmts/elf/elf-x86-amd64.c \
+ modules/objfmts/coff/coff-objfmt.c \
+ modules/objfmts/coff/coff-objfmt.h \
+ modules/objfmts/coff/win64-except.c \
+ modules/objfmts/macho/macho-objfmt.c \
+ modules/objfmts/rdf/rdf-objfmt.c \
+ modules/objfmts/xdf/xdf-objfmt.c libyasm/assocdat.c \
+ libyasm/bitvect.c libyasm/bc-align.c libyasm/bc-data.c \
+ libyasm/bc-incbin.c libyasm/bc-org.c libyasm/bc-reserve.c \
+ libyasm/bytecode.c libyasm/errwarn.c libyasm/expr.c \
+ libyasm/file.c libyasm/floatnum.c libyasm/hamt.c \
+ libyasm/insn.c libyasm/intnum.c libyasm/inttree.c \
+ libyasm/linemap.c libyasm/md5.c libyasm/mergesort.c \
+ libyasm/phash.c libyasm/section.c libyasm/strcasecmp.c \
+ libyasm/strsep.c libyasm/symrec.c libyasm/valparam.c \
+ libyasm/value.c libyasm/xmalloc.c libyasm/xstrdup.c
+nodist_libyasm_a_SOURCES = x86cpu.c x86regtmod.c lc3bid.c gas-token.c \
+ nasm-token.c module.c
+genversion_SOURCES =
+genversion_LDADD = genversion.$(OBJEXT)
+genversion_LINK = $(CCLD_FOR_BUILD) -o $@
+genmodule_SOURCES =
+genmodule_LDADD = genmodule.$(OBJEXT)
+genmodule_LINK = $(CCLD_FOR_BUILD) -o $@
+modincludedir = $(includedir)/libyasm
+modinclude_HEADERS = libyasm/arch.h libyasm/assocdat.h \
+ libyasm/bitvect.h libyasm/bytecode.h libyasm/compat-queue.h \
+ libyasm/coretype.h libyasm/dbgfmt.h libyasm/errwarn.h \
+ libyasm/expr.h libyasm/file.h libyasm/floatnum.h \
+ libyasm/hamt.h libyasm/insn.h libyasm/intnum.h \
+ libyasm/inttree.h libyasm/linemap.h libyasm/listfmt.h \
+ libyasm/md5.h libyasm/module.h libyasm/objfmt.h \
+ libyasm/parser.h libyasm/phash.h libyasm/preproc.h \
+ libyasm/section.h libyasm/symrec.h libyasm/valparam.h \
+ libyasm/value.h
+bitvect_test_SOURCES = libyasm/tests/bitvect_test.c
+bitvect_test_LDADD = libyasm.a $(INTLLIBS)
+floatnum_test_SOURCES = libyasm/tests/floatnum_test.c
+floatnum_test_LDADD = libyasm.a $(INTLLIBS)
+leb128_test_SOURCES = libyasm/tests/leb128_test.c
+leb128_test_LDADD = libyasm.a $(INTLLIBS)
+splitpath_test_SOURCES = libyasm/tests/splitpath_test.c
+splitpath_test_LDADD = libyasm.a $(INTLLIBS)
+combpath_test_SOURCES = libyasm/tests/combpath_test.c
+combpath_test_LDADD = libyasm.a $(INTLLIBS)
+uncstring_test_SOURCES = libyasm/tests/uncstring_test.c
+uncstring_test_LDADD = libyasm.a $(INTLLIBS)
+yasm_SOURCES = frontends/yasm/yasm.c frontends/yasm/yasm-options.c \
+ frontends/yasm/yasm-options.h
+yasm_LDADD = libyasm.a $(INTLLIBS)
+ytasm_SOURCES = frontends/tasm/tasm.c frontends/tasm/tasm-options.c \
+ frontends/tasm/tasm-options.h
+ytasm_LDADD = libyasm.a $(INTLLIBS)
+ACLOCAL_AMFLAGS = -I m4
+
+# genstring build
+genstring_SOURCES =
+genstring_LDADD = genstring.$(OBJEXT)
+genstring_LINK = $(CCLD_FOR_BUILD) -o $@
+all: $(BUILT_SOURCES) config.h
+ $(MAKE) $(AM_MAKEFLAGS) all-recursive
+
+.SUFFIXES:
+.SUFFIXES: .gperf .c .o .obj
+am--refresh:
+ @:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(srcdir)/tools/Makefile.inc $(srcdir)/tools/re2c/Makefile.inc $(srcdir)/tools/genmacro/Makefile.inc $(srcdir)/tools/genperf/Makefile.inc $(srcdir)/tools/python-yasm/Makefile.inc $(srcdir)/tools/python-yasm/tests/Makefile.inc $(srcdir)/modules/Makefile.inc $(srcdir)/modules/arch/Makefile.inc $(srcdir)/modules/arch/x86/Makefile.inc $(srcdir)/modules/arch/x86/tests/Makefile.inc $(srcdir)/modules/arch/x86/tests/gas32/Makefile.inc $(srcdir)/modules/arch/x86/tests/gas64/Makefile.inc $(srcdir)/modules/arch/lc3b/Makefile.inc $(srcdir)/modules/arch/lc3b/tests/Makefile.inc $(srcdir)/modules/listfmts/Makefile.inc $(srcdir)/modules/listfmts/nasm/Makefile.inc $(srcdir)/modules/parsers/Makefile.inc $(srcdir)/modules/parsers/gas/Makefile.inc $(srcdir)/modules/parsers/gas/tests/Makefile.inc $(srcdir)/modules/parsers/gas/tests/bin/Makefile.inc $(srcdir)/modules/parsers/nasm/Makefile.inc $(srcdir)/modules/parsers/nasm/tests/Makefile.inc $(srcdir)/modules/parsers/nasm/tests/worphan/Makefile.inc $(srcdir)/modules/parsers/tasm/Makefile.inc $(srcdir)/modules/parsers/tasm/tests/Makefile.inc $(srcdir)/modules/parsers/tasm/tests/exe/Makefile.inc $(srcdir)/modules/preprocs/Makefile.inc $(srcdir)/modules/preprocs/nasm/Makefile.inc $(srcdir)/modules/preprocs/nasm/tests/Makefile.inc $(srcdir)/modules/preprocs/raw/Makefile.inc $(srcdir)/modules/preprocs/raw/tests/Makefile.inc $(srcdir)/modules/preprocs/cpp/Makefile.inc $(srcdir)/modules/dbgfmts/Makefile.inc $(srcdir)/modules/dbgfmts/codeview/Makefile.inc $(srcdir)/modules/dbgfmts/dwarf2/Makefile.inc $(srcdir)/modules/dbgfmts/dwarf2/tests/Makefile.inc $(srcdir)/modules/dbgfmts/dwarf2/tests/pass32/Makefile.inc $(srcdir)/modules/dbgfmts/dwarf2/tests/pass64/Makefile.inc $(srcdir)/modules/dbgfmts/dwarf2/tests/passwin64/Makefile.inc $(srcdir)/modules/dbgfmts/null/Makefile.inc $(srcdir)/modules/dbgfmts/stabs/Makefile.inc $(srcdir)/modules/dbgfmts/stabs/tests/Makefile.inc $(srcdir)/modules/objfmts/Makefile.inc $(srcdir)/modules/objfmts/dbg/Makefile.inc $(srcdir)/modules/objfmts/bin/Makefile.inc $(srcdir)/modules/objfmts/bin/tests/Makefile.inc $(srcdir)/modules/objfmts/bin/tests/multisect/Makefile.inc $(srcdir)/modules/objfmts/elf/Makefile.inc $(srcdir)/modules/objfmts/elf/tests/Makefile.inc $(srcdir)/modules/objfmts/elf/tests/amd64/Makefile.inc $(srcdir)/modules/objfmts/elf/tests/gas32/Makefile.inc $(srcdir)/modules/objfmts/elf/tests/gas64/Makefile.inc $(srcdir)/modules/objfmts/coff/Makefile.inc $(srcdir)/modules/objfmts/coff/tests/Makefile.inc $(srcdir)/modules/objfmts/macho/Makefile.inc $(srcdir)/modules/objfmts/macho/tests/Makefile.inc $(srcdir)/modules/objfmts/macho/tests/gas32/Makefile.inc $(srcdir)/modules/objfmts/macho/tests/gas64/Makefile.inc $(srcdir)/modules/objfmts/macho/tests/nasm32/Makefile.inc $(srcdir)/modules/objfmts/macho/tests/nasm64/Makefile.inc $(srcdir)/modules/objfmts/rdf/Makefile.inc $(srcdir)/modules/objfmts/rdf/tests/Makefile.inc $(srcdir)/modules/objfmts/win32/Makefile.inc $(srcdir)/modules/objfmts/win32/tests/Makefile.inc $(srcdir)/modules/objfmts/win32/tests/gas/Makefile.inc $(srcdir)/modules/objfmts/win64/Makefile.inc $(srcdir)/modules/objfmts/win64/tests/Makefile.inc $(srcdir)/modules/objfmts/win64/tests/gas/Makefile.inc $(srcdir)/modules/objfmts/xdf/Makefile.inc $(srcdir)/modules/objfmts/xdf/tests/Makefile.inc $(srcdir)/libyasm/Makefile.inc $(srcdir)/libyasm/tests/Makefile.inc $(srcdir)/frontends/Makefile.inc $(srcdir)/frontends/yasm/Makefile.inc $(srcdir)/frontends/tasm/Makefile.inc $(srcdir)/m4/Makefile.inc $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \
+ cd $(srcdir) && $(AUTOMAKE) --gnu \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ echo ' $(SHELL) ./config.status'; \
+ $(SHELL) ./config.status;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ $(SHELL) ./config.status --recheck
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(srcdir) && $(AUTOCONF)
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+
+config.h: stamp-h1
+ @if test ! -f $@; then \
+ rm -f stamp-h1; \
+ $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \
+ else :; fi
+
+stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
+ @rm -f stamp-h1
+ cd $(top_builddir) && $(SHELL) ./config.status config.h
+$(srcdir)/config.h.in: $(am__configure_deps)
+ cd $(top_srcdir) && $(AUTOHEADER)
+ rm -f stamp-h1
+ touch $@
+
+distclean-hdr:
+ -rm -f config.h stamp-h1
+install-libLIBRARIES: $(lib_LIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
+ @list='$(lib_LIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f=$(am__strip_dir) \
+ echo " $(libLIBRARIES_INSTALL) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
+ $(libLIBRARIES_INSTALL) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
+ else :; fi; \
+ done
+ @$(POST_INSTALL)
+ @list='$(lib_LIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ p=$(am__strip_dir) \
+ echo " $(RANLIB) '$(DESTDIR)$(libdir)/$$p'"; \
+ $(RANLIB) "$(DESTDIR)$(libdir)/$$p"; \
+ else :; fi; \
+ done
+
+uninstall-libLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(lib_LIBRARIES)'; for p in $$list; do \
+ p=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(libdir)/$$p'"; \
+ rm -f "$(DESTDIR)$(libdir)/$$p"; \
+ done
+
+clean-libLIBRARIES:
+ -test -z "$(lib_LIBRARIES)" || rm -f $(lib_LIBRARIES)
+libyasm.a: $(libyasm_a_OBJECTS) $(libyasm_a_DEPENDENCIES)
+ -rm -f libyasm.a
+ $(libyasm_a_AR) libyasm.a $(libyasm_a_OBJECTS) $(libyasm_a_LIBADD)
+ $(RANLIB) libyasm.a
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+
+clean-checkPROGRAMS:
+ -test -z "$(check_PROGRAMS)" || rm -f $(check_PROGRAMS)
+
+clean-noinstPROGRAMS:
+ -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS)
+bitvect_test$(EXEEXT): $(bitvect_test_OBJECTS) $(bitvect_test_DEPENDENCIES)
+ @rm -f bitvect_test$(EXEEXT)
+ $(LINK) $(bitvect_test_OBJECTS) $(bitvect_test_LDADD) $(LIBS)
+combpath_test$(EXEEXT): $(combpath_test_OBJECTS) $(combpath_test_DEPENDENCIES)
+ @rm -f combpath_test$(EXEEXT)
+ $(LINK) $(combpath_test_OBJECTS) $(combpath_test_LDADD) $(LIBS)
+floatnum_test$(EXEEXT): $(floatnum_test_OBJECTS) $(floatnum_test_DEPENDENCIES)
+ @rm -f floatnum_test$(EXEEXT)
+ $(LINK) $(floatnum_test_OBJECTS) $(floatnum_test_LDADD) $(LIBS)
+genmacro$(EXEEXT): $(genmacro_OBJECTS) $(genmacro_DEPENDENCIES)
+ @rm -f genmacro$(EXEEXT)
+ $(genmacro_LINK) $(genmacro_OBJECTS) $(genmacro_LDADD) $(LIBS)
+genmodule$(EXEEXT): $(genmodule_OBJECTS) $(genmodule_DEPENDENCIES)
+ @rm -f genmodule$(EXEEXT)
+ $(genmodule_LINK) $(genmodule_OBJECTS) $(genmodule_LDADD) $(LIBS)
+genperf$(EXEEXT): $(genperf_OBJECTS) $(genperf_DEPENDENCIES)
+ @rm -f genperf$(EXEEXT)
+ $(genperf_LINK) $(genperf_OBJECTS) $(genperf_LDADD) $(LIBS)
+genstring$(EXEEXT): $(genstring_OBJECTS) $(genstring_DEPENDENCIES)
+ @rm -f genstring$(EXEEXT)
+ $(genstring_LINK) $(genstring_OBJECTS) $(genstring_LDADD) $(LIBS)
+genversion$(EXEEXT): $(genversion_OBJECTS) $(genversion_DEPENDENCIES)
+ @rm -f genversion$(EXEEXT)
+ $(genversion_LINK) $(genversion_OBJECTS) $(genversion_LDADD) $(LIBS)
+leb128_test$(EXEEXT): $(leb128_test_OBJECTS) $(leb128_test_DEPENDENCIES)
+ @rm -f leb128_test$(EXEEXT)
+ $(LINK) $(leb128_test_OBJECTS) $(leb128_test_LDADD) $(LIBS)
+re2c$(EXEEXT): $(re2c_OBJECTS) $(re2c_DEPENDENCIES)
+ @rm -f re2c$(EXEEXT)
+ $(re2c_LINK) $(re2c_OBJECTS) $(re2c_LDADD) $(LIBS)
+splitpath_test$(EXEEXT): $(splitpath_test_OBJECTS) $(splitpath_test_DEPENDENCIES)
+ @rm -f splitpath_test$(EXEEXT)
+ $(LINK) $(splitpath_test_OBJECTS) $(splitpath_test_LDADD) $(LIBS)
+test_hd$(EXEEXT): $(test_hd_OBJECTS) $(test_hd_DEPENDENCIES)
+ @rm -f test_hd$(EXEEXT)
+ $(LINK) $(test_hd_OBJECTS) $(test_hd_LDADD) $(LIBS)
+uncstring_test$(EXEEXT): $(uncstring_test_OBJECTS) $(uncstring_test_DEPENDENCIES)
+ @rm -f uncstring_test$(EXEEXT)
+ $(LINK) $(uncstring_test_OBJECTS) $(uncstring_test_LDADD) $(LIBS)
+yasm$(EXEEXT): $(yasm_OBJECTS) $(yasm_DEPENDENCIES)
+ @rm -f yasm$(EXEEXT)
+ $(LINK) $(yasm_OBJECTS) $(yasm_LDADD) $(LIBS)
+ytasm$(EXEEXT): $(ytasm_OBJECTS) $(ytasm_DEPENDENCIES)
+ @rm -f ytasm$(EXEEXT)
+ $(LINK) $(ytasm_OBJECTS) $(ytasm_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+include ./$(DEPDIR)/assocdat.Po
+include ./$(DEPDIR)/bc-align.Po
+include ./$(DEPDIR)/bc-data.Po
+include ./$(DEPDIR)/bc-incbin.Po
+include ./$(DEPDIR)/bc-org.Po
+include ./$(DEPDIR)/bc-reserve.Po
+include ./$(DEPDIR)/bin-objfmt.Po
+include ./$(DEPDIR)/bitvect.Po
+include ./$(DEPDIR)/bitvect_test.Po
+include ./$(DEPDIR)/bytecode.Po
+include ./$(DEPDIR)/coff-objfmt.Po
+include ./$(DEPDIR)/combpath_test.Po
+include ./$(DEPDIR)/cpp-preproc.Po
+include ./$(DEPDIR)/cv-dbgfmt.Po
+include ./$(DEPDIR)/cv-symline.Po
+include ./$(DEPDIR)/cv-type.Po
+include ./$(DEPDIR)/dbg-objfmt.Po
+include ./$(DEPDIR)/dwarf2-aranges.Po
+include ./$(DEPDIR)/dwarf2-dbgfmt.Po
+include ./$(DEPDIR)/dwarf2-info.Po
+include ./$(DEPDIR)/dwarf2-line.Po
+include ./$(DEPDIR)/elf-objfmt.Po
+include ./$(DEPDIR)/elf-x86-amd64.Po
+include ./$(DEPDIR)/elf-x86-x86.Po
+include ./$(DEPDIR)/elf.Po
+include ./$(DEPDIR)/errwarn.Po
+include ./$(DEPDIR)/expr.Po
+include ./$(DEPDIR)/file.Po
+include ./$(DEPDIR)/floatnum.Po
+include ./$(DEPDIR)/floatnum_test.Po
+include ./$(DEPDIR)/gas-parse.Po
+include ./$(DEPDIR)/gas-parser.Po
+include ./$(DEPDIR)/gas-token.Po
+include ./$(DEPDIR)/hamt.Po
+include ./$(DEPDIR)/insn.Po
+include ./$(DEPDIR)/intnum.Po
+include ./$(DEPDIR)/inttree.Po
+include ./$(DEPDIR)/lc3barch.Po
+include ./$(DEPDIR)/lc3bbc.Po
+include ./$(DEPDIR)/lc3bid.Po
+include ./$(DEPDIR)/leb128_test.Po
+include ./$(DEPDIR)/linemap.Po
+include ./$(DEPDIR)/macho-objfmt.Po
+include ./$(DEPDIR)/md5.Po
+include ./$(DEPDIR)/mergesort.Po
+include ./$(DEPDIR)/module.Po
+include ./$(DEPDIR)/nasm-eval.Po
+include ./$(DEPDIR)/nasm-listfmt.Po
+include ./$(DEPDIR)/nasm-parse.Po
+include ./$(DEPDIR)/nasm-parser.Po
+include ./$(DEPDIR)/nasm-pp.Po
+include ./$(DEPDIR)/nasm-preproc.Po
+include ./$(DEPDIR)/nasm-token.Po
+include ./$(DEPDIR)/nasmlib.Po
+include ./$(DEPDIR)/null-dbgfmt.Po
+include ./$(DEPDIR)/phash.Po
+include ./$(DEPDIR)/raw-preproc.Po
+include ./$(DEPDIR)/rdf-objfmt.Po
+include ./$(DEPDIR)/section.Po
+include ./$(DEPDIR)/splitpath_test.Po
+include ./$(DEPDIR)/stabs-dbgfmt.Po
+include ./$(DEPDIR)/strcasecmp.Po
+include ./$(DEPDIR)/strsep.Po
+include ./$(DEPDIR)/symrec.Po
+include ./$(DEPDIR)/tasm-options.Po
+include ./$(DEPDIR)/tasm.Po
+include ./$(DEPDIR)/test_hd.Po
+include ./$(DEPDIR)/uncstring_test.Po
+include ./$(DEPDIR)/valparam.Po
+include ./$(DEPDIR)/value.Po
+include ./$(DEPDIR)/win64-except.Po
+include ./$(DEPDIR)/x86arch.Po
+include ./$(DEPDIR)/x86bc.Po
+include ./$(DEPDIR)/x86cpu.Po
+include ./$(DEPDIR)/x86expr.Po
+include ./$(DEPDIR)/x86id.Po
+include ./$(DEPDIR)/x86regtmod.Po
+include ./$(DEPDIR)/xdf-objfmt.Po
+include ./$(DEPDIR)/xmalloc.Po
+include ./$(DEPDIR)/xstrdup.Po
+include ./$(DEPDIR)/yasm-options.Po
+include ./$(DEPDIR)/yasm.Po
+
+.c.o:
+ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+# source='$<' object='$@' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(COMPILE) -c $<
+
+.c.obj:
+ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+# source='$<' object='$@' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+x86arch.o: modules/arch/x86/x86arch.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT x86arch.o -MD -MP -MF $(DEPDIR)/x86arch.Tpo -c -o x86arch.o `test -f 'modules/arch/x86/x86arch.c' || echo '$(srcdir)/'`modules/arch/x86/x86arch.c
+ mv -f $(DEPDIR)/x86arch.Tpo $(DEPDIR)/x86arch.Po
+# source='modules/arch/x86/x86arch.c' object='x86arch.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o x86arch.o `test -f 'modules/arch/x86/x86arch.c' || echo '$(srcdir)/'`modules/arch/x86/x86arch.c
+
+x86arch.obj: modules/arch/x86/x86arch.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT x86arch.obj -MD -MP -MF $(DEPDIR)/x86arch.Tpo -c -o x86arch.obj `if test -f 'modules/arch/x86/x86arch.c'; then $(CYGPATH_W) 'modules/arch/x86/x86arch.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/x86/x86arch.c'; fi`
+ mv -f $(DEPDIR)/x86arch.Tpo $(DEPDIR)/x86arch.Po
+# source='modules/arch/x86/x86arch.c' object='x86arch.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o x86arch.obj `if test -f 'modules/arch/x86/x86arch.c'; then $(CYGPATH_W) 'modules/arch/x86/x86arch.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/x86/x86arch.c'; fi`
+
+x86bc.o: modules/arch/x86/x86bc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT x86bc.o -MD -MP -MF $(DEPDIR)/x86bc.Tpo -c -o x86bc.o `test -f 'modules/arch/x86/x86bc.c' || echo '$(srcdir)/'`modules/arch/x86/x86bc.c
+ mv -f $(DEPDIR)/x86bc.Tpo $(DEPDIR)/x86bc.Po
+# source='modules/arch/x86/x86bc.c' object='x86bc.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o x86bc.o `test -f 'modules/arch/x86/x86bc.c' || echo '$(srcdir)/'`modules/arch/x86/x86bc.c
+
+x86bc.obj: modules/arch/x86/x86bc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT x86bc.obj -MD -MP -MF $(DEPDIR)/x86bc.Tpo -c -o x86bc.obj `if test -f 'modules/arch/x86/x86bc.c'; then $(CYGPATH_W) 'modules/arch/x86/x86bc.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/x86/x86bc.c'; fi`
+ mv -f $(DEPDIR)/x86bc.Tpo $(DEPDIR)/x86bc.Po
+# source='modules/arch/x86/x86bc.c' object='x86bc.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o x86bc.obj `if test -f 'modules/arch/x86/x86bc.c'; then $(CYGPATH_W) 'modules/arch/x86/x86bc.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/x86/x86bc.c'; fi`
+
+x86expr.o: modules/arch/x86/x86expr.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT x86expr.o -MD -MP -MF $(DEPDIR)/x86expr.Tpo -c -o x86expr.o `test -f 'modules/arch/x86/x86expr.c' || echo '$(srcdir)/'`modules/arch/x86/x86expr.c
+ mv -f $(DEPDIR)/x86expr.Tpo $(DEPDIR)/x86expr.Po
+# source='modules/arch/x86/x86expr.c' object='x86expr.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o x86expr.o `test -f 'modules/arch/x86/x86expr.c' || echo '$(srcdir)/'`modules/arch/x86/x86expr.c
+
+x86expr.obj: modules/arch/x86/x86expr.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT x86expr.obj -MD -MP -MF $(DEPDIR)/x86expr.Tpo -c -o x86expr.obj `if test -f 'modules/arch/x86/x86expr.c'; then $(CYGPATH_W) 'modules/arch/x86/x86expr.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/x86/x86expr.c'; fi`
+ mv -f $(DEPDIR)/x86expr.Tpo $(DEPDIR)/x86expr.Po
+# source='modules/arch/x86/x86expr.c' object='x86expr.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o x86expr.obj `if test -f 'modules/arch/x86/x86expr.c'; then $(CYGPATH_W) 'modules/arch/x86/x86expr.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/x86/x86expr.c'; fi`
+
+x86id.o: modules/arch/x86/x86id.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT x86id.o -MD -MP -MF $(DEPDIR)/x86id.Tpo -c -o x86id.o `test -f 'modules/arch/x86/x86id.c' || echo '$(srcdir)/'`modules/arch/x86/x86id.c
+ mv -f $(DEPDIR)/x86id.Tpo $(DEPDIR)/x86id.Po
+# source='modules/arch/x86/x86id.c' object='x86id.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o x86id.o `test -f 'modules/arch/x86/x86id.c' || echo '$(srcdir)/'`modules/arch/x86/x86id.c
+
+x86id.obj: modules/arch/x86/x86id.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT x86id.obj -MD -MP -MF $(DEPDIR)/x86id.Tpo -c -o x86id.obj `if test -f 'modules/arch/x86/x86id.c'; then $(CYGPATH_W) 'modules/arch/x86/x86id.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/x86/x86id.c'; fi`
+ mv -f $(DEPDIR)/x86id.Tpo $(DEPDIR)/x86id.Po
+# source='modules/arch/x86/x86id.c' object='x86id.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o x86id.obj `if test -f 'modules/arch/x86/x86id.c'; then $(CYGPATH_W) 'modules/arch/x86/x86id.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/x86/x86id.c'; fi`
+
+lc3barch.o: modules/arch/lc3b/lc3barch.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lc3barch.o -MD -MP -MF $(DEPDIR)/lc3barch.Tpo -c -o lc3barch.o `test -f 'modules/arch/lc3b/lc3barch.c' || echo '$(srcdir)/'`modules/arch/lc3b/lc3barch.c
+ mv -f $(DEPDIR)/lc3barch.Tpo $(DEPDIR)/lc3barch.Po
+# source='modules/arch/lc3b/lc3barch.c' object='lc3barch.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lc3barch.o `test -f 'modules/arch/lc3b/lc3barch.c' || echo '$(srcdir)/'`modules/arch/lc3b/lc3barch.c
+
+lc3barch.obj: modules/arch/lc3b/lc3barch.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lc3barch.obj -MD -MP -MF $(DEPDIR)/lc3barch.Tpo -c -o lc3barch.obj `if test -f 'modules/arch/lc3b/lc3barch.c'; then $(CYGPATH_W) 'modules/arch/lc3b/lc3barch.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/lc3b/lc3barch.c'; fi`
+ mv -f $(DEPDIR)/lc3barch.Tpo $(DEPDIR)/lc3barch.Po
+# source='modules/arch/lc3b/lc3barch.c' object='lc3barch.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lc3barch.obj `if test -f 'modules/arch/lc3b/lc3barch.c'; then $(CYGPATH_W) 'modules/arch/lc3b/lc3barch.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/lc3b/lc3barch.c'; fi`
+
+lc3bbc.o: modules/arch/lc3b/lc3bbc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lc3bbc.o -MD -MP -MF $(DEPDIR)/lc3bbc.Tpo -c -o lc3bbc.o `test -f 'modules/arch/lc3b/lc3bbc.c' || echo '$(srcdir)/'`modules/arch/lc3b/lc3bbc.c
+ mv -f $(DEPDIR)/lc3bbc.Tpo $(DEPDIR)/lc3bbc.Po
+# source='modules/arch/lc3b/lc3bbc.c' object='lc3bbc.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lc3bbc.o `test -f 'modules/arch/lc3b/lc3bbc.c' || echo '$(srcdir)/'`modules/arch/lc3b/lc3bbc.c
+
+lc3bbc.obj: modules/arch/lc3b/lc3bbc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lc3bbc.obj -MD -MP -MF $(DEPDIR)/lc3bbc.Tpo -c -o lc3bbc.obj `if test -f 'modules/arch/lc3b/lc3bbc.c'; then $(CYGPATH_W) 'modules/arch/lc3b/lc3bbc.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/lc3b/lc3bbc.c'; fi`
+ mv -f $(DEPDIR)/lc3bbc.Tpo $(DEPDIR)/lc3bbc.Po
+# source='modules/arch/lc3b/lc3bbc.c' object='lc3bbc.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lc3bbc.obj `if test -f 'modules/arch/lc3b/lc3bbc.c'; then $(CYGPATH_W) 'modules/arch/lc3b/lc3bbc.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/lc3b/lc3bbc.c'; fi`
+
+nasm-listfmt.o: modules/listfmts/nasm/nasm-listfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-listfmt.o -MD -MP -MF $(DEPDIR)/nasm-listfmt.Tpo -c -o nasm-listfmt.o `test -f 'modules/listfmts/nasm/nasm-listfmt.c' || echo '$(srcdir)/'`modules/listfmts/nasm/nasm-listfmt.c
+ mv -f $(DEPDIR)/nasm-listfmt.Tpo $(DEPDIR)/nasm-listfmt.Po
+# source='modules/listfmts/nasm/nasm-listfmt.c' object='nasm-listfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-listfmt.o `test -f 'modules/listfmts/nasm/nasm-listfmt.c' || echo '$(srcdir)/'`modules/listfmts/nasm/nasm-listfmt.c
+
+nasm-listfmt.obj: modules/listfmts/nasm/nasm-listfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-listfmt.obj -MD -MP -MF $(DEPDIR)/nasm-listfmt.Tpo -c -o nasm-listfmt.obj `if test -f 'modules/listfmts/nasm/nasm-listfmt.c'; then $(CYGPATH_W) 'modules/listfmts/nasm/nasm-listfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/listfmts/nasm/nasm-listfmt.c'; fi`
+ mv -f $(DEPDIR)/nasm-listfmt.Tpo $(DEPDIR)/nasm-listfmt.Po
+# source='modules/listfmts/nasm/nasm-listfmt.c' object='nasm-listfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-listfmt.obj `if test -f 'modules/listfmts/nasm/nasm-listfmt.c'; then $(CYGPATH_W) 'modules/listfmts/nasm/nasm-listfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/listfmts/nasm/nasm-listfmt.c'; fi`
+
+gas-parser.o: modules/parsers/gas/gas-parser.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gas-parser.o -MD -MP -MF $(DEPDIR)/gas-parser.Tpo -c -o gas-parser.o `test -f 'modules/parsers/gas/gas-parser.c' || echo '$(srcdir)/'`modules/parsers/gas/gas-parser.c
+ mv -f $(DEPDIR)/gas-parser.Tpo $(DEPDIR)/gas-parser.Po
+# source='modules/parsers/gas/gas-parser.c' object='gas-parser.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gas-parser.o `test -f 'modules/parsers/gas/gas-parser.c' || echo '$(srcdir)/'`modules/parsers/gas/gas-parser.c
+
+gas-parser.obj: modules/parsers/gas/gas-parser.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gas-parser.obj -MD -MP -MF $(DEPDIR)/gas-parser.Tpo -c -o gas-parser.obj `if test -f 'modules/parsers/gas/gas-parser.c'; then $(CYGPATH_W) 'modules/parsers/gas/gas-parser.c'; else $(CYGPATH_W) '$(srcdir)/modules/parsers/gas/gas-parser.c'; fi`
+ mv -f $(DEPDIR)/gas-parser.Tpo $(DEPDIR)/gas-parser.Po
+# source='modules/parsers/gas/gas-parser.c' object='gas-parser.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gas-parser.obj `if test -f 'modules/parsers/gas/gas-parser.c'; then $(CYGPATH_W) 'modules/parsers/gas/gas-parser.c'; else $(CYGPATH_W) '$(srcdir)/modules/parsers/gas/gas-parser.c'; fi`
+
+gas-parse.o: modules/parsers/gas/gas-parse.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gas-parse.o -MD -MP -MF $(DEPDIR)/gas-parse.Tpo -c -o gas-parse.o `test -f 'modules/parsers/gas/gas-parse.c' || echo '$(srcdir)/'`modules/parsers/gas/gas-parse.c
+ mv -f $(DEPDIR)/gas-parse.Tpo $(DEPDIR)/gas-parse.Po
+# source='modules/parsers/gas/gas-parse.c' object='gas-parse.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gas-parse.o `test -f 'modules/parsers/gas/gas-parse.c' || echo '$(srcdir)/'`modules/parsers/gas/gas-parse.c
+
+gas-parse.obj: modules/parsers/gas/gas-parse.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gas-parse.obj -MD -MP -MF $(DEPDIR)/gas-parse.Tpo -c -o gas-parse.obj `if test -f 'modules/parsers/gas/gas-parse.c'; then $(CYGPATH_W) 'modules/parsers/gas/gas-parse.c'; else $(CYGPATH_W) '$(srcdir)/modules/parsers/gas/gas-parse.c'; fi`
+ mv -f $(DEPDIR)/gas-parse.Tpo $(DEPDIR)/gas-parse.Po
+# source='modules/parsers/gas/gas-parse.c' object='gas-parse.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gas-parse.obj `if test -f 'modules/parsers/gas/gas-parse.c'; then $(CYGPATH_W) 'modules/parsers/gas/gas-parse.c'; else $(CYGPATH_W) '$(srcdir)/modules/parsers/gas/gas-parse.c'; fi`
+
+nasm-parser.o: modules/parsers/nasm/nasm-parser.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-parser.o -MD -MP -MF $(DEPDIR)/nasm-parser.Tpo -c -o nasm-parser.o `test -f 'modules/parsers/nasm/nasm-parser.c' || echo '$(srcdir)/'`modules/parsers/nasm/nasm-parser.c
+ mv -f $(DEPDIR)/nasm-parser.Tpo $(DEPDIR)/nasm-parser.Po
+# source='modules/parsers/nasm/nasm-parser.c' object='nasm-parser.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-parser.o `test -f 'modules/parsers/nasm/nasm-parser.c' || echo '$(srcdir)/'`modules/parsers/nasm/nasm-parser.c
+
+nasm-parser.obj: modules/parsers/nasm/nasm-parser.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-parser.obj -MD -MP -MF $(DEPDIR)/nasm-parser.Tpo -c -o nasm-parser.obj `if test -f 'modules/parsers/nasm/nasm-parser.c'; then $(CYGPATH_W) 'modules/parsers/nasm/nasm-parser.c'; else $(CYGPATH_W) '$(srcdir)/modules/parsers/nasm/nasm-parser.c'; fi`
+ mv -f $(DEPDIR)/nasm-parser.Tpo $(DEPDIR)/nasm-parser.Po
+# source='modules/parsers/nasm/nasm-parser.c' object='nasm-parser.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-parser.obj `if test -f 'modules/parsers/nasm/nasm-parser.c'; then $(CYGPATH_W) 'modules/parsers/nasm/nasm-parser.c'; else $(CYGPATH_W) '$(srcdir)/modules/parsers/nasm/nasm-parser.c'; fi`
+
+nasm-parse.o: modules/parsers/nasm/nasm-parse.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-parse.o -MD -MP -MF $(DEPDIR)/nasm-parse.Tpo -c -o nasm-parse.o `test -f 'modules/parsers/nasm/nasm-parse.c' || echo '$(srcdir)/'`modules/parsers/nasm/nasm-parse.c
+ mv -f $(DEPDIR)/nasm-parse.Tpo $(DEPDIR)/nasm-parse.Po
+# source='modules/parsers/nasm/nasm-parse.c' object='nasm-parse.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-parse.o `test -f 'modules/parsers/nasm/nasm-parse.c' || echo '$(srcdir)/'`modules/parsers/nasm/nasm-parse.c
+
+nasm-parse.obj: modules/parsers/nasm/nasm-parse.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-parse.obj -MD -MP -MF $(DEPDIR)/nasm-parse.Tpo -c -o nasm-parse.obj `if test -f 'modules/parsers/nasm/nasm-parse.c'; then $(CYGPATH_W) 'modules/parsers/nasm/nasm-parse.c'; else $(CYGPATH_W) '$(srcdir)/modules/parsers/nasm/nasm-parse.c'; fi`
+ mv -f $(DEPDIR)/nasm-parse.Tpo $(DEPDIR)/nasm-parse.Po
+# source='modules/parsers/nasm/nasm-parse.c' object='nasm-parse.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-parse.obj `if test -f 'modules/parsers/nasm/nasm-parse.c'; then $(CYGPATH_W) 'modules/parsers/nasm/nasm-parse.c'; else $(CYGPATH_W) '$(srcdir)/modules/parsers/nasm/nasm-parse.c'; fi`
+
+nasm-preproc.o: modules/preprocs/nasm/nasm-preproc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-preproc.o -MD -MP -MF $(DEPDIR)/nasm-preproc.Tpo -c -o nasm-preproc.o `test -f 'modules/preprocs/nasm/nasm-preproc.c' || echo '$(srcdir)/'`modules/preprocs/nasm/nasm-preproc.c
+ mv -f $(DEPDIR)/nasm-preproc.Tpo $(DEPDIR)/nasm-preproc.Po
+# source='modules/preprocs/nasm/nasm-preproc.c' object='nasm-preproc.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-preproc.o `test -f 'modules/preprocs/nasm/nasm-preproc.c' || echo '$(srcdir)/'`modules/preprocs/nasm/nasm-preproc.c
+
+nasm-preproc.obj: modules/preprocs/nasm/nasm-preproc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-preproc.obj -MD -MP -MF $(DEPDIR)/nasm-preproc.Tpo -c -o nasm-preproc.obj `if test -f 'modules/preprocs/nasm/nasm-preproc.c'; then $(CYGPATH_W) 'modules/preprocs/nasm/nasm-preproc.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/nasm/nasm-preproc.c'; fi`
+ mv -f $(DEPDIR)/nasm-preproc.Tpo $(DEPDIR)/nasm-preproc.Po
+# source='modules/preprocs/nasm/nasm-preproc.c' object='nasm-preproc.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-preproc.obj `if test -f 'modules/preprocs/nasm/nasm-preproc.c'; then $(CYGPATH_W) 'modules/preprocs/nasm/nasm-preproc.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/nasm/nasm-preproc.c'; fi`
+
+nasm-pp.o: modules/preprocs/nasm/nasm-pp.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-pp.o -MD -MP -MF $(DEPDIR)/nasm-pp.Tpo -c -o nasm-pp.o `test -f 'modules/preprocs/nasm/nasm-pp.c' || echo '$(srcdir)/'`modules/preprocs/nasm/nasm-pp.c
+ mv -f $(DEPDIR)/nasm-pp.Tpo $(DEPDIR)/nasm-pp.Po
+# source='modules/preprocs/nasm/nasm-pp.c' object='nasm-pp.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-pp.o `test -f 'modules/preprocs/nasm/nasm-pp.c' || echo '$(srcdir)/'`modules/preprocs/nasm/nasm-pp.c
+
+nasm-pp.obj: modules/preprocs/nasm/nasm-pp.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-pp.obj -MD -MP -MF $(DEPDIR)/nasm-pp.Tpo -c -o nasm-pp.obj `if test -f 'modules/preprocs/nasm/nasm-pp.c'; then $(CYGPATH_W) 'modules/preprocs/nasm/nasm-pp.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/nasm/nasm-pp.c'; fi`
+ mv -f $(DEPDIR)/nasm-pp.Tpo $(DEPDIR)/nasm-pp.Po
+# source='modules/preprocs/nasm/nasm-pp.c' object='nasm-pp.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-pp.obj `if test -f 'modules/preprocs/nasm/nasm-pp.c'; then $(CYGPATH_W) 'modules/preprocs/nasm/nasm-pp.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/nasm/nasm-pp.c'; fi`
+
+nasmlib.o: modules/preprocs/nasm/nasmlib.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasmlib.o -MD -MP -MF $(DEPDIR)/nasmlib.Tpo -c -o nasmlib.o `test -f 'modules/preprocs/nasm/nasmlib.c' || echo '$(srcdir)/'`modules/preprocs/nasm/nasmlib.c
+ mv -f $(DEPDIR)/nasmlib.Tpo $(DEPDIR)/nasmlib.Po
+# source='modules/preprocs/nasm/nasmlib.c' object='nasmlib.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasmlib.o `test -f 'modules/preprocs/nasm/nasmlib.c' || echo '$(srcdir)/'`modules/preprocs/nasm/nasmlib.c
+
+nasmlib.obj: modules/preprocs/nasm/nasmlib.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasmlib.obj -MD -MP -MF $(DEPDIR)/nasmlib.Tpo -c -o nasmlib.obj `if test -f 'modules/preprocs/nasm/nasmlib.c'; then $(CYGPATH_W) 'modules/preprocs/nasm/nasmlib.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/nasm/nasmlib.c'; fi`
+ mv -f $(DEPDIR)/nasmlib.Tpo $(DEPDIR)/nasmlib.Po
+# source='modules/preprocs/nasm/nasmlib.c' object='nasmlib.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasmlib.obj `if test -f 'modules/preprocs/nasm/nasmlib.c'; then $(CYGPATH_W) 'modules/preprocs/nasm/nasmlib.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/nasm/nasmlib.c'; fi`
+
+nasm-eval.o: modules/preprocs/nasm/nasm-eval.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-eval.o -MD -MP -MF $(DEPDIR)/nasm-eval.Tpo -c -o nasm-eval.o `test -f 'modules/preprocs/nasm/nasm-eval.c' || echo '$(srcdir)/'`modules/preprocs/nasm/nasm-eval.c
+ mv -f $(DEPDIR)/nasm-eval.Tpo $(DEPDIR)/nasm-eval.Po
+# source='modules/preprocs/nasm/nasm-eval.c' object='nasm-eval.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-eval.o `test -f 'modules/preprocs/nasm/nasm-eval.c' || echo '$(srcdir)/'`modules/preprocs/nasm/nasm-eval.c
+
+nasm-eval.obj: modules/preprocs/nasm/nasm-eval.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-eval.obj -MD -MP -MF $(DEPDIR)/nasm-eval.Tpo -c -o nasm-eval.obj `if test -f 'modules/preprocs/nasm/nasm-eval.c'; then $(CYGPATH_W) 'modules/preprocs/nasm/nasm-eval.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/nasm/nasm-eval.c'; fi`
+ mv -f $(DEPDIR)/nasm-eval.Tpo $(DEPDIR)/nasm-eval.Po
+# source='modules/preprocs/nasm/nasm-eval.c' object='nasm-eval.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-eval.obj `if test -f 'modules/preprocs/nasm/nasm-eval.c'; then $(CYGPATH_W) 'modules/preprocs/nasm/nasm-eval.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/nasm/nasm-eval.c'; fi`
+
+raw-preproc.o: modules/preprocs/raw/raw-preproc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT raw-preproc.o -MD -MP -MF $(DEPDIR)/raw-preproc.Tpo -c -o raw-preproc.o `test -f 'modules/preprocs/raw/raw-preproc.c' || echo '$(srcdir)/'`modules/preprocs/raw/raw-preproc.c
+ mv -f $(DEPDIR)/raw-preproc.Tpo $(DEPDIR)/raw-preproc.Po
+# source='modules/preprocs/raw/raw-preproc.c' object='raw-preproc.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o raw-preproc.o `test -f 'modules/preprocs/raw/raw-preproc.c' || echo '$(srcdir)/'`modules/preprocs/raw/raw-preproc.c
+
+raw-preproc.obj: modules/preprocs/raw/raw-preproc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT raw-preproc.obj -MD -MP -MF $(DEPDIR)/raw-preproc.Tpo -c -o raw-preproc.obj `if test -f 'modules/preprocs/raw/raw-preproc.c'; then $(CYGPATH_W) 'modules/preprocs/raw/raw-preproc.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/raw/raw-preproc.c'; fi`
+ mv -f $(DEPDIR)/raw-preproc.Tpo $(DEPDIR)/raw-preproc.Po
+# source='modules/preprocs/raw/raw-preproc.c' object='raw-preproc.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o raw-preproc.obj `if test -f 'modules/preprocs/raw/raw-preproc.c'; then $(CYGPATH_W) 'modules/preprocs/raw/raw-preproc.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/raw/raw-preproc.c'; fi`
+
+cpp-preproc.o: modules/preprocs/cpp/cpp-preproc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpp-preproc.o -MD -MP -MF $(DEPDIR)/cpp-preproc.Tpo -c -o cpp-preproc.o `test -f 'modules/preprocs/cpp/cpp-preproc.c' || echo '$(srcdir)/'`modules/preprocs/cpp/cpp-preproc.c
+ mv -f $(DEPDIR)/cpp-preproc.Tpo $(DEPDIR)/cpp-preproc.Po
+# source='modules/preprocs/cpp/cpp-preproc.c' object='cpp-preproc.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpp-preproc.o `test -f 'modules/preprocs/cpp/cpp-preproc.c' || echo '$(srcdir)/'`modules/preprocs/cpp/cpp-preproc.c
+
+cpp-preproc.obj: modules/preprocs/cpp/cpp-preproc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpp-preproc.obj -MD -MP -MF $(DEPDIR)/cpp-preproc.Tpo -c -o cpp-preproc.obj `if test -f 'modules/preprocs/cpp/cpp-preproc.c'; then $(CYGPATH_W) 'modules/preprocs/cpp/cpp-preproc.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/cpp/cpp-preproc.c'; fi`
+ mv -f $(DEPDIR)/cpp-preproc.Tpo $(DEPDIR)/cpp-preproc.Po
+# source='modules/preprocs/cpp/cpp-preproc.c' object='cpp-preproc.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpp-preproc.obj `if test -f 'modules/preprocs/cpp/cpp-preproc.c'; then $(CYGPATH_W) 'modules/preprocs/cpp/cpp-preproc.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/cpp/cpp-preproc.c'; fi`
+
+cv-dbgfmt.o: modules/dbgfmts/codeview/cv-dbgfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cv-dbgfmt.o -MD -MP -MF $(DEPDIR)/cv-dbgfmt.Tpo -c -o cv-dbgfmt.o `test -f 'modules/dbgfmts/codeview/cv-dbgfmt.c' || echo '$(srcdir)/'`modules/dbgfmts/codeview/cv-dbgfmt.c
+ mv -f $(DEPDIR)/cv-dbgfmt.Tpo $(DEPDIR)/cv-dbgfmt.Po
+# source='modules/dbgfmts/codeview/cv-dbgfmt.c' object='cv-dbgfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cv-dbgfmt.o `test -f 'modules/dbgfmts/codeview/cv-dbgfmt.c' || echo '$(srcdir)/'`modules/dbgfmts/codeview/cv-dbgfmt.c
+
+cv-dbgfmt.obj: modules/dbgfmts/codeview/cv-dbgfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cv-dbgfmt.obj -MD -MP -MF $(DEPDIR)/cv-dbgfmt.Tpo -c -o cv-dbgfmt.obj `if test -f 'modules/dbgfmts/codeview/cv-dbgfmt.c'; then $(CYGPATH_W) 'modules/dbgfmts/codeview/cv-dbgfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/codeview/cv-dbgfmt.c'; fi`
+ mv -f $(DEPDIR)/cv-dbgfmt.Tpo $(DEPDIR)/cv-dbgfmt.Po
+# source='modules/dbgfmts/codeview/cv-dbgfmt.c' object='cv-dbgfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cv-dbgfmt.obj `if test -f 'modules/dbgfmts/codeview/cv-dbgfmt.c'; then $(CYGPATH_W) 'modules/dbgfmts/codeview/cv-dbgfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/codeview/cv-dbgfmt.c'; fi`
+
+cv-symline.o: modules/dbgfmts/codeview/cv-symline.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cv-symline.o -MD -MP -MF $(DEPDIR)/cv-symline.Tpo -c -o cv-symline.o `test -f 'modules/dbgfmts/codeview/cv-symline.c' || echo '$(srcdir)/'`modules/dbgfmts/codeview/cv-symline.c
+ mv -f $(DEPDIR)/cv-symline.Tpo $(DEPDIR)/cv-symline.Po
+# source='modules/dbgfmts/codeview/cv-symline.c' object='cv-symline.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cv-symline.o `test -f 'modules/dbgfmts/codeview/cv-symline.c' || echo '$(srcdir)/'`modules/dbgfmts/codeview/cv-symline.c
+
+cv-symline.obj: modules/dbgfmts/codeview/cv-symline.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cv-symline.obj -MD -MP -MF $(DEPDIR)/cv-symline.Tpo -c -o cv-symline.obj `if test -f 'modules/dbgfmts/codeview/cv-symline.c'; then $(CYGPATH_W) 'modules/dbgfmts/codeview/cv-symline.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/codeview/cv-symline.c'; fi`
+ mv -f $(DEPDIR)/cv-symline.Tpo $(DEPDIR)/cv-symline.Po
+# source='modules/dbgfmts/codeview/cv-symline.c' object='cv-symline.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cv-symline.obj `if test -f 'modules/dbgfmts/codeview/cv-symline.c'; then $(CYGPATH_W) 'modules/dbgfmts/codeview/cv-symline.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/codeview/cv-symline.c'; fi`
+
+cv-type.o: modules/dbgfmts/codeview/cv-type.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cv-type.o -MD -MP -MF $(DEPDIR)/cv-type.Tpo -c -o cv-type.o `test -f 'modules/dbgfmts/codeview/cv-type.c' || echo '$(srcdir)/'`modules/dbgfmts/codeview/cv-type.c
+ mv -f $(DEPDIR)/cv-type.Tpo $(DEPDIR)/cv-type.Po
+# source='modules/dbgfmts/codeview/cv-type.c' object='cv-type.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cv-type.o `test -f 'modules/dbgfmts/codeview/cv-type.c' || echo '$(srcdir)/'`modules/dbgfmts/codeview/cv-type.c
+
+cv-type.obj: modules/dbgfmts/codeview/cv-type.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cv-type.obj -MD -MP -MF $(DEPDIR)/cv-type.Tpo -c -o cv-type.obj `if test -f 'modules/dbgfmts/codeview/cv-type.c'; then $(CYGPATH_W) 'modules/dbgfmts/codeview/cv-type.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/codeview/cv-type.c'; fi`
+ mv -f $(DEPDIR)/cv-type.Tpo $(DEPDIR)/cv-type.Po
+# source='modules/dbgfmts/codeview/cv-type.c' object='cv-type.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cv-type.obj `if test -f 'modules/dbgfmts/codeview/cv-type.c'; then $(CYGPATH_W) 'modules/dbgfmts/codeview/cv-type.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/codeview/cv-type.c'; fi`
+
+dwarf2-dbgfmt.o: modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dwarf2-dbgfmt.o -MD -MP -MF $(DEPDIR)/dwarf2-dbgfmt.Tpo -c -o dwarf2-dbgfmt.o `test -f 'modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c' || echo '$(srcdir)/'`modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c
+ mv -f $(DEPDIR)/dwarf2-dbgfmt.Tpo $(DEPDIR)/dwarf2-dbgfmt.Po
+# source='modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c' object='dwarf2-dbgfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dwarf2-dbgfmt.o `test -f 'modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c' || echo '$(srcdir)/'`modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c
+
+dwarf2-dbgfmt.obj: modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dwarf2-dbgfmt.obj -MD -MP -MF $(DEPDIR)/dwarf2-dbgfmt.Tpo -c -o dwarf2-dbgfmt.obj `if test -f 'modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c'; then $(CYGPATH_W) 'modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c'; fi`
+ mv -f $(DEPDIR)/dwarf2-dbgfmt.Tpo $(DEPDIR)/dwarf2-dbgfmt.Po
+# source='modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c' object='dwarf2-dbgfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dwarf2-dbgfmt.obj `if test -f 'modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c'; then $(CYGPATH_W) 'modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c'; fi`
+
+dwarf2-line.o: modules/dbgfmts/dwarf2/dwarf2-line.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dwarf2-line.o -MD -MP -MF $(DEPDIR)/dwarf2-line.Tpo -c -o dwarf2-line.o `test -f 'modules/dbgfmts/dwarf2/dwarf2-line.c' || echo '$(srcdir)/'`modules/dbgfmts/dwarf2/dwarf2-line.c
+ mv -f $(DEPDIR)/dwarf2-line.Tpo $(DEPDIR)/dwarf2-line.Po
+# source='modules/dbgfmts/dwarf2/dwarf2-line.c' object='dwarf2-line.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dwarf2-line.o `test -f 'modules/dbgfmts/dwarf2/dwarf2-line.c' || echo '$(srcdir)/'`modules/dbgfmts/dwarf2/dwarf2-line.c
+
+dwarf2-line.obj: modules/dbgfmts/dwarf2/dwarf2-line.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dwarf2-line.obj -MD -MP -MF $(DEPDIR)/dwarf2-line.Tpo -c -o dwarf2-line.obj `if test -f 'modules/dbgfmts/dwarf2/dwarf2-line.c'; then $(CYGPATH_W) 'modules/dbgfmts/dwarf2/dwarf2-line.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/dwarf2/dwarf2-line.c'; fi`
+ mv -f $(DEPDIR)/dwarf2-line.Tpo $(DEPDIR)/dwarf2-line.Po
+# source='modules/dbgfmts/dwarf2/dwarf2-line.c' object='dwarf2-line.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dwarf2-line.obj `if test -f 'modules/dbgfmts/dwarf2/dwarf2-line.c'; then $(CYGPATH_W) 'modules/dbgfmts/dwarf2/dwarf2-line.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/dwarf2/dwarf2-line.c'; fi`
+
+dwarf2-aranges.o: modules/dbgfmts/dwarf2/dwarf2-aranges.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dwarf2-aranges.o -MD -MP -MF $(DEPDIR)/dwarf2-aranges.Tpo -c -o dwarf2-aranges.o `test -f 'modules/dbgfmts/dwarf2/dwarf2-aranges.c' || echo '$(srcdir)/'`modules/dbgfmts/dwarf2/dwarf2-aranges.c
+ mv -f $(DEPDIR)/dwarf2-aranges.Tpo $(DEPDIR)/dwarf2-aranges.Po
+# source='modules/dbgfmts/dwarf2/dwarf2-aranges.c' object='dwarf2-aranges.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dwarf2-aranges.o `test -f 'modules/dbgfmts/dwarf2/dwarf2-aranges.c' || echo '$(srcdir)/'`modules/dbgfmts/dwarf2/dwarf2-aranges.c
+
+dwarf2-aranges.obj: modules/dbgfmts/dwarf2/dwarf2-aranges.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dwarf2-aranges.obj -MD -MP -MF $(DEPDIR)/dwarf2-aranges.Tpo -c -o dwarf2-aranges.obj `if test -f 'modules/dbgfmts/dwarf2/dwarf2-aranges.c'; then $(CYGPATH_W) 'modules/dbgfmts/dwarf2/dwarf2-aranges.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/dwarf2/dwarf2-aranges.c'; fi`
+ mv -f $(DEPDIR)/dwarf2-aranges.Tpo $(DEPDIR)/dwarf2-aranges.Po
+# source='modules/dbgfmts/dwarf2/dwarf2-aranges.c' object='dwarf2-aranges.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dwarf2-aranges.obj `if test -f 'modules/dbgfmts/dwarf2/dwarf2-aranges.c'; then $(CYGPATH_W) 'modules/dbgfmts/dwarf2/dwarf2-aranges.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/dwarf2/dwarf2-aranges.c'; fi`
+
+dwarf2-info.o: modules/dbgfmts/dwarf2/dwarf2-info.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dwarf2-info.o -MD -MP -MF $(DEPDIR)/dwarf2-info.Tpo -c -o dwarf2-info.o `test -f 'modules/dbgfmts/dwarf2/dwarf2-info.c' || echo '$(srcdir)/'`modules/dbgfmts/dwarf2/dwarf2-info.c
+ mv -f $(DEPDIR)/dwarf2-info.Tpo $(DEPDIR)/dwarf2-info.Po
+# source='modules/dbgfmts/dwarf2/dwarf2-info.c' object='dwarf2-info.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dwarf2-info.o `test -f 'modules/dbgfmts/dwarf2/dwarf2-info.c' || echo '$(srcdir)/'`modules/dbgfmts/dwarf2/dwarf2-info.c
+
+dwarf2-info.obj: modules/dbgfmts/dwarf2/dwarf2-info.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dwarf2-info.obj -MD -MP -MF $(DEPDIR)/dwarf2-info.Tpo -c -o dwarf2-info.obj `if test -f 'modules/dbgfmts/dwarf2/dwarf2-info.c'; then $(CYGPATH_W) 'modules/dbgfmts/dwarf2/dwarf2-info.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/dwarf2/dwarf2-info.c'; fi`
+ mv -f $(DEPDIR)/dwarf2-info.Tpo $(DEPDIR)/dwarf2-info.Po
+# source='modules/dbgfmts/dwarf2/dwarf2-info.c' object='dwarf2-info.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dwarf2-info.obj `if test -f 'modules/dbgfmts/dwarf2/dwarf2-info.c'; then $(CYGPATH_W) 'modules/dbgfmts/dwarf2/dwarf2-info.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/dwarf2/dwarf2-info.c'; fi`
+
+null-dbgfmt.o: modules/dbgfmts/null/null-dbgfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT null-dbgfmt.o -MD -MP -MF $(DEPDIR)/null-dbgfmt.Tpo -c -o null-dbgfmt.o `test -f 'modules/dbgfmts/null/null-dbgfmt.c' || echo '$(srcdir)/'`modules/dbgfmts/null/null-dbgfmt.c
+ mv -f $(DEPDIR)/null-dbgfmt.Tpo $(DEPDIR)/null-dbgfmt.Po
+# source='modules/dbgfmts/null/null-dbgfmt.c' object='null-dbgfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o null-dbgfmt.o `test -f 'modules/dbgfmts/null/null-dbgfmt.c' || echo '$(srcdir)/'`modules/dbgfmts/null/null-dbgfmt.c
+
+null-dbgfmt.obj: modules/dbgfmts/null/null-dbgfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT null-dbgfmt.obj -MD -MP -MF $(DEPDIR)/null-dbgfmt.Tpo -c -o null-dbgfmt.obj `if test -f 'modules/dbgfmts/null/null-dbgfmt.c'; then $(CYGPATH_W) 'modules/dbgfmts/null/null-dbgfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/null/null-dbgfmt.c'; fi`
+ mv -f $(DEPDIR)/null-dbgfmt.Tpo $(DEPDIR)/null-dbgfmt.Po
+# source='modules/dbgfmts/null/null-dbgfmt.c' object='null-dbgfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o null-dbgfmt.obj `if test -f 'modules/dbgfmts/null/null-dbgfmt.c'; then $(CYGPATH_W) 'modules/dbgfmts/null/null-dbgfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/null/null-dbgfmt.c'; fi`
+
+stabs-dbgfmt.o: modules/dbgfmts/stabs/stabs-dbgfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT stabs-dbgfmt.o -MD -MP -MF $(DEPDIR)/stabs-dbgfmt.Tpo -c -o stabs-dbgfmt.o `test -f 'modules/dbgfmts/stabs/stabs-dbgfmt.c' || echo '$(srcdir)/'`modules/dbgfmts/stabs/stabs-dbgfmt.c
+ mv -f $(DEPDIR)/stabs-dbgfmt.Tpo $(DEPDIR)/stabs-dbgfmt.Po
+# source='modules/dbgfmts/stabs/stabs-dbgfmt.c' object='stabs-dbgfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o stabs-dbgfmt.o `test -f 'modules/dbgfmts/stabs/stabs-dbgfmt.c' || echo '$(srcdir)/'`modules/dbgfmts/stabs/stabs-dbgfmt.c
+
+stabs-dbgfmt.obj: modules/dbgfmts/stabs/stabs-dbgfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT stabs-dbgfmt.obj -MD -MP -MF $(DEPDIR)/stabs-dbgfmt.Tpo -c -o stabs-dbgfmt.obj `if test -f 'modules/dbgfmts/stabs/stabs-dbgfmt.c'; then $(CYGPATH_W) 'modules/dbgfmts/stabs/stabs-dbgfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/stabs/stabs-dbgfmt.c'; fi`
+ mv -f $(DEPDIR)/stabs-dbgfmt.Tpo $(DEPDIR)/stabs-dbgfmt.Po
+# source='modules/dbgfmts/stabs/stabs-dbgfmt.c' object='stabs-dbgfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o stabs-dbgfmt.obj `if test -f 'modules/dbgfmts/stabs/stabs-dbgfmt.c'; then $(CYGPATH_W) 'modules/dbgfmts/stabs/stabs-dbgfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/stabs/stabs-dbgfmt.c'; fi`
+
+dbg-objfmt.o: modules/objfmts/dbg/dbg-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dbg-objfmt.o -MD -MP -MF $(DEPDIR)/dbg-objfmt.Tpo -c -o dbg-objfmt.o `test -f 'modules/objfmts/dbg/dbg-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/dbg/dbg-objfmt.c
+ mv -f $(DEPDIR)/dbg-objfmt.Tpo $(DEPDIR)/dbg-objfmt.Po
+# source='modules/objfmts/dbg/dbg-objfmt.c' object='dbg-objfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dbg-objfmt.o `test -f 'modules/objfmts/dbg/dbg-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/dbg/dbg-objfmt.c
+
+dbg-objfmt.obj: modules/objfmts/dbg/dbg-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dbg-objfmt.obj -MD -MP -MF $(DEPDIR)/dbg-objfmt.Tpo -c -o dbg-objfmt.obj `if test -f 'modules/objfmts/dbg/dbg-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/dbg/dbg-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/dbg/dbg-objfmt.c'; fi`
+ mv -f $(DEPDIR)/dbg-objfmt.Tpo $(DEPDIR)/dbg-objfmt.Po
+# source='modules/objfmts/dbg/dbg-objfmt.c' object='dbg-objfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dbg-objfmt.obj `if test -f 'modules/objfmts/dbg/dbg-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/dbg/dbg-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/dbg/dbg-objfmt.c'; fi`
+
+bin-objfmt.o: modules/objfmts/bin/bin-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bin-objfmt.o -MD -MP -MF $(DEPDIR)/bin-objfmt.Tpo -c -o bin-objfmt.o `test -f 'modules/objfmts/bin/bin-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/bin/bin-objfmt.c
+ mv -f $(DEPDIR)/bin-objfmt.Tpo $(DEPDIR)/bin-objfmt.Po
+# source='modules/objfmts/bin/bin-objfmt.c' object='bin-objfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bin-objfmt.o `test -f 'modules/objfmts/bin/bin-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/bin/bin-objfmt.c
+
+bin-objfmt.obj: modules/objfmts/bin/bin-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bin-objfmt.obj -MD -MP -MF $(DEPDIR)/bin-objfmt.Tpo -c -o bin-objfmt.obj `if test -f 'modules/objfmts/bin/bin-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/bin/bin-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/bin/bin-objfmt.c'; fi`
+ mv -f $(DEPDIR)/bin-objfmt.Tpo $(DEPDIR)/bin-objfmt.Po
+# source='modules/objfmts/bin/bin-objfmt.c' object='bin-objfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bin-objfmt.obj `if test -f 'modules/objfmts/bin/bin-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/bin/bin-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/bin/bin-objfmt.c'; fi`
+
+elf.o: modules/objfmts/elf/elf.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT elf.o -MD -MP -MF $(DEPDIR)/elf.Tpo -c -o elf.o `test -f 'modules/objfmts/elf/elf.c' || echo '$(srcdir)/'`modules/objfmts/elf/elf.c
+ mv -f $(DEPDIR)/elf.Tpo $(DEPDIR)/elf.Po
+# source='modules/objfmts/elf/elf.c' object='elf.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o elf.o `test -f 'modules/objfmts/elf/elf.c' || echo '$(srcdir)/'`modules/objfmts/elf/elf.c
+
+elf.obj: modules/objfmts/elf/elf.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT elf.obj -MD -MP -MF $(DEPDIR)/elf.Tpo -c -o elf.obj `if test -f 'modules/objfmts/elf/elf.c'; then $(CYGPATH_W) 'modules/objfmts/elf/elf.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/elf/elf.c'; fi`
+ mv -f $(DEPDIR)/elf.Tpo $(DEPDIR)/elf.Po
+# source='modules/objfmts/elf/elf.c' object='elf.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o elf.obj `if test -f 'modules/objfmts/elf/elf.c'; then $(CYGPATH_W) 'modules/objfmts/elf/elf.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/elf/elf.c'; fi`
+
+elf-objfmt.o: modules/objfmts/elf/elf-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT elf-objfmt.o -MD -MP -MF $(DEPDIR)/elf-objfmt.Tpo -c -o elf-objfmt.o `test -f 'modules/objfmts/elf/elf-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/elf/elf-objfmt.c
+ mv -f $(DEPDIR)/elf-objfmt.Tpo $(DEPDIR)/elf-objfmt.Po
+# source='modules/objfmts/elf/elf-objfmt.c' object='elf-objfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o elf-objfmt.o `test -f 'modules/objfmts/elf/elf-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/elf/elf-objfmt.c
+
+elf-objfmt.obj: modules/objfmts/elf/elf-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT elf-objfmt.obj -MD -MP -MF $(DEPDIR)/elf-objfmt.Tpo -c -o elf-objfmt.obj `if test -f 'modules/objfmts/elf/elf-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/elf/elf-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/elf/elf-objfmt.c'; fi`
+ mv -f $(DEPDIR)/elf-objfmt.Tpo $(DEPDIR)/elf-objfmt.Po
+# source='modules/objfmts/elf/elf-objfmt.c' object='elf-objfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o elf-objfmt.obj `if test -f 'modules/objfmts/elf/elf-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/elf/elf-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/elf/elf-objfmt.c'; fi`
+
+elf-x86-x86.o: modules/objfmts/elf/elf-x86-x86.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT elf-x86-x86.o -MD -MP -MF $(DEPDIR)/elf-x86-x86.Tpo -c -o elf-x86-x86.o `test -f 'modules/objfmts/elf/elf-x86-x86.c' || echo '$(srcdir)/'`modules/objfmts/elf/elf-x86-x86.c
+ mv -f $(DEPDIR)/elf-x86-x86.Tpo $(DEPDIR)/elf-x86-x86.Po
+# source='modules/objfmts/elf/elf-x86-x86.c' object='elf-x86-x86.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o elf-x86-x86.o `test -f 'modules/objfmts/elf/elf-x86-x86.c' || echo '$(srcdir)/'`modules/objfmts/elf/elf-x86-x86.c
+
+elf-x86-x86.obj: modules/objfmts/elf/elf-x86-x86.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT elf-x86-x86.obj -MD -MP -MF $(DEPDIR)/elf-x86-x86.Tpo -c -o elf-x86-x86.obj `if test -f 'modules/objfmts/elf/elf-x86-x86.c'; then $(CYGPATH_W) 'modules/objfmts/elf/elf-x86-x86.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/elf/elf-x86-x86.c'; fi`
+ mv -f $(DEPDIR)/elf-x86-x86.Tpo $(DEPDIR)/elf-x86-x86.Po
+# source='modules/objfmts/elf/elf-x86-x86.c' object='elf-x86-x86.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o elf-x86-x86.obj `if test -f 'modules/objfmts/elf/elf-x86-x86.c'; then $(CYGPATH_W) 'modules/objfmts/elf/elf-x86-x86.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/elf/elf-x86-x86.c'; fi`
+
+elf-x86-amd64.o: modules/objfmts/elf/elf-x86-amd64.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT elf-x86-amd64.o -MD -MP -MF $(DEPDIR)/elf-x86-amd64.Tpo -c -o elf-x86-amd64.o `test -f 'modules/objfmts/elf/elf-x86-amd64.c' || echo '$(srcdir)/'`modules/objfmts/elf/elf-x86-amd64.c
+ mv -f $(DEPDIR)/elf-x86-amd64.Tpo $(DEPDIR)/elf-x86-amd64.Po
+# source='modules/objfmts/elf/elf-x86-amd64.c' object='elf-x86-amd64.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o elf-x86-amd64.o `test -f 'modules/objfmts/elf/elf-x86-amd64.c' || echo '$(srcdir)/'`modules/objfmts/elf/elf-x86-amd64.c
+
+elf-x86-amd64.obj: modules/objfmts/elf/elf-x86-amd64.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT elf-x86-amd64.obj -MD -MP -MF $(DEPDIR)/elf-x86-amd64.Tpo -c -o elf-x86-amd64.obj `if test -f 'modules/objfmts/elf/elf-x86-amd64.c'; then $(CYGPATH_W) 'modules/objfmts/elf/elf-x86-amd64.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/elf/elf-x86-amd64.c'; fi`
+ mv -f $(DEPDIR)/elf-x86-amd64.Tpo $(DEPDIR)/elf-x86-amd64.Po
+# source='modules/objfmts/elf/elf-x86-amd64.c' object='elf-x86-amd64.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o elf-x86-amd64.obj `if test -f 'modules/objfmts/elf/elf-x86-amd64.c'; then $(CYGPATH_W) 'modules/objfmts/elf/elf-x86-amd64.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/elf/elf-x86-amd64.c'; fi`
+
+coff-objfmt.o: modules/objfmts/coff/coff-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT coff-objfmt.o -MD -MP -MF $(DEPDIR)/coff-objfmt.Tpo -c -o coff-objfmt.o `test -f 'modules/objfmts/coff/coff-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/coff/coff-objfmt.c
+ mv -f $(DEPDIR)/coff-objfmt.Tpo $(DEPDIR)/coff-objfmt.Po
+# source='modules/objfmts/coff/coff-objfmt.c' object='coff-objfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o coff-objfmt.o `test -f 'modules/objfmts/coff/coff-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/coff/coff-objfmt.c
+
+coff-objfmt.obj: modules/objfmts/coff/coff-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT coff-objfmt.obj -MD -MP -MF $(DEPDIR)/coff-objfmt.Tpo -c -o coff-objfmt.obj `if test -f 'modules/objfmts/coff/coff-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/coff/coff-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/coff/coff-objfmt.c'; fi`
+ mv -f $(DEPDIR)/coff-objfmt.Tpo $(DEPDIR)/coff-objfmt.Po
+# source='modules/objfmts/coff/coff-objfmt.c' object='coff-objfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o coff-objfmt.obj `if test -f 'modules/objfmts/coff/coff-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/coff/coff-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/coff/coff-objfmt.c'; fi`
+
+win64-except.o: modules/objfmts/coff/win64-except.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT win64-except.o -MD -MP -MF $(DEPDIR)/win64-except.Tpo -c -o win64-except.o `test -f 'modules/objfmts/coff/win64-except.c' || echo '$(srcdir)/'`modules/objfmts/coff/win64-except.c
+ mv -f $(DEPDIR)/win64-except.Tpo $(DEPDIR)/win64-except.Po
+# source='modules/objfmts/coff/win64-except.c' object='win64-except.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o win64-except.o `test -f 'modules/objfmts/coff/win64-except.c' || echo '$(srcdir)/'`modules/objfmts/coff/win64-except.c
+
+win64-except.obj: modules/objfmts/coff/win64-except.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT win64-except.obj -MD -MP -MF $(DEPDIR)/win64-except.Tpo -c -o win64-except.obj `if test -f 'modules/objfmts/coff/win64-except.c'; then $(CYGPATH_W) 'modules/objfmts/coff/win64-except.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/coff/win64-except.c'; fi`
+ mv -f $(DEPDIR)/win64-except.Tpo $(DEPDIR)/win64-except.Po
+# source='modules/objfmts/coff/win64-except.c' object='win64-except.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o win64-except.obj `if test -f 'modules/objfmts/coff/win64-except.c'; then $(CYGPATH_W) 'modules/objfmts/coff/win64-except.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/coff/win64-except.c'; fi`
+
+macho-objfmt.o: modules/objfmts/macho/macho-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT macho-objfmt.o -MD -MP -MF $(DEPDIR)/macho-objfmt.Tpo -c -o macho-objfmt.o `test -f 'modules/objfmts/macho/macho-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/macho/macho-objfmt.c
+ mv -f $(DEPDIR)/macho-objfmt.Tpo $(DEPDIR)/macho-objfmt.Po
+# source='modules/objfmts/macho/macho-objfmt.c' object='macho-objfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o macho-objfmt.o `test -f 'modules/objfmts/macho/macho-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/macho/macho-objfmt.c
+
+macho-objfmt.obj: modules/objfmts/macho/macho-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT macho-objfmt.obj -MD -MP -MF $(DEPDIR)/macho-objfmt.Tpo -c -o macho-objfmt.obj `if test -f 'modules/objfmts/macho/macho-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/macho/macho-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/macho/macho-objfmt.c'; fi`
+ mv -f $(DEPDIR)/macho-objfmt.Tpo $(DEPDIR)/macho-objfmt.Po
+# source='modules/objfmts/macho/macho-objfmt.c' object='macho-objfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o macho-objfmt.obj `if test -f 'modules/objfmts/macho/macho-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/macho/macho-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/macho/macho-objfmt.c'; fi`
+
+rdf-objfmt.o: modules/objfmts/rdf/rdf-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rdf-objfmt.o -MD -MP -MF $(DEPDIR)/rdf-objfmt.Tpo -c -o rdf-objfmt.o `test -f 'modules/objfmts/rdf/rdf-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/rdf/rdf-objfmt.c
+ mv -f $(DEPDIR)/rdf-objfmt.Tpo $(DEPDIR)/rdf-objfmt.Po
+# source='modules/objfmts/rdf/rdf-objfmt.c' object='rdf-objfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rdf-objfmt.o `test -f 'modules/objfmts/rdf/rdf-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/rdf/rdf-objfmt.c
+
+rdf-objfmt.obj: modules/objfmts/rdf/rdf-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rdf-objfmt.obj -MD -MP -MF $(DEPDIR)/rdf-objfmt.Tpo -c -o rdf-objfmt.obj `if test -f 'modules/objfmts/rdf/rdf-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/rdf/rdf-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/rdf/rdf-objfmt.c'; fi`
+ mv -f $(DEPDIR)/rdf-objfmt.Tpo $(DEPDIR)/rdf-objfmt.Po
+# source='modules/objfmts/rdf/rdf-objfmt.c' object='rdf-objfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rdf-objfmt.obj `if test -f 'modules/objfmts/rdf/rdf-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/rdf/rdf-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/rdf/rdf-objfmt.c'; fi`
+
+xdf-objfmt.o: modules/objfmts/xdf/xdf-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xdf-objfmt.o -MD -MP -MF $(DEPDIR)/xdf-objfmt.Tpo -c -o xdf-objfmt.o `test -f 'modules/objfmts/xdf/xdf-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/xdf/xdf-objfmt.c
+ mv -f $(DEPDIR)/xdf-objfmt.Tpo $(DEPDIR)/xdf-objfmt.Po
+# source='modules/objfmts/xdf/xdf-objfmt.c' object='xdf-objfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xdf-objfmt.o `test -f 'modules/objfmts/xdf/xdf-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/xdf/xdf-objfmt.c
+
+xdf-objfmt.obj: modules/objfmts/xdf/xdf-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xdf-objfmt.obj -MD -MP -MF $(DEPDIR)/xdf-objfmt.Tpo -c -o xdf-objfmt.obj `if test -f 'modules/objfmts/xdf/xdf-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/xdf/xdf-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/xdf/xdf-objfmt.c'; fi`
+ mv -f $(DEPDIR)/xdf-objfmt.Tpo $(DEPDIR)/xdf-objfmt.Po
+# source='modules/objfmts/xdf/xdf-objfmt.c' object='xdf-objfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xdf-objfmt.obj `if test -f 'modules/objfmts/xdf/xdf-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/xdf/xdf-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/xdf/xdf-objfmt.c'; fi`
+
+assocdat.o: libyasm/assocdat.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT assocdat.o -MD -MP -MF $(DEPDIR)/assocdat.Tpo -c -o assocdat.o `test -f 'libyasm/assocdat.c' || echo '$(srcdir)/'`libyasm/assocdat.c
+ mv -f $(DEPDIR)/assocdat.Tpo $(DEPDIR)/assocdat.Po
+# source='libyasm/assocdat.c' object='assocdat.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o assocdat.o `test -f 'libyasm/assocdat.c' || echo '$(srcdir)/'`libyasm/assocdat.c
+
+assocdat.obj: libyasm/assocdat.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT assocdat.obj -MD -MP -MF $(DEPDIR)/assocdat.Tpo -c -o assocdat.obj `if test -f 'libyasm/assocdat.c'; then $(CYGPATH_W) 'libyasm/assocdat.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/assocdat.c'; fi`
+ mv -f $(DEPDIR)/assocdat.Tpo $(DEPDIR)/assocdat.Po
+# source='libyasm/assocdat.c' object='assocdat.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o assocdat.obj `if test -f 'libyasm/assocdat.c'; then $(CYGPATH_W) 'libyasm/assocdat.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/assocdat.c'; fi`
+
+bitvect.o: libyasm/bitvect.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bitvect.o -MD -MP -MF $(DEPDIR)/bitvect.Tpo -c -o bitvect.o `test -f 'libyasm/bitvect.c' || echo '$(srcdir)/'`libyasm/bitvect.c
+ mv -f $(DEPDIR)/bitvect.Tpo $(DEPDIR)/bitvect.Po
+# source='libyasm/bitvect.c' object='bitvect.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bitvect.o `test -f 'libyasm/bitvect.c' || echo '$(srcdir)/'`libyasm/bitvect.c
+
+bitvect.obj: libyasm/bitvect.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bitvect.obj -MD -MP -MF $(DEPDIR)/bitvect.Tpo -c -o bitvect.obj `if test -f 'libyasm/bitvect.c'; then $(CYGPATH_W) 'libyasm/bitvect.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bitvect.c'; fi`
+ mv -f $(DEPDIR)/bitvect.Tpo $(DEPDIR)/bitvect.Po
+# source='libyasm/bitvect.c' object='bitvect.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bitvect.obj `if test -f 'libyasm/bitvect.c'; then $(CYGPATH_W) 'libyasm/bitvect.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bitvect.c'; fi`
+
+bc-align.o: libyasm/bc-align.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bc-align.o -MD -MP -MF $(DEPDIR)/bc-align.Tpo -c -o bc-align.o `test -f 'libyasm/bc-align.c' || echo '$(srcdir)/'`libyasm/bc-align.c
+ mv -f $(DEPDIR)/bc-align.Tpo $(DEPDIR)/bc-align.Po
+# source='libyasm/bc-align.c' object='bc-align.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bc-align.o `test -f 'libyasm/bc-align.c' || echo '$(srcdir)/'`libyasm/bc-align.c
+
+bc-align.obj: libyasm/bc-align.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bc-align.obj -MD -MP -MF $(DEPDIR)/bc-align.Tpo -c -o bc-align.obj `if test -f 'libyasm/bc-align.c'; then $(CYGPATH_W) 'libyasm/bc-align.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bc-align.c'; fi`
+ mv -f $(DEPDIR)/bc-align.Tpo $(DEPDIR)/bc-align.Po
+# source='libyasm/bc-align.c' object='bc-align.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bc-align.obj `if test -f 'libyasm/bc-align.c'; then $(CYGPATH_W) 'libyasm/bc-align.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bc-align.c'; fi`
+
+bc-data.o: libyasm/bc-data.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bc-data.o -MD -MP -MF $(DEPDIR)/bc-data.Tpo -c -o bc-data.o `test -f 'libyasm/bc-data.c' || echo '$(srcdir)/'`libyasm/bc-data.c
+ mv -f $(DEPDIR)/bc-data.Tpo $(DEPDIR)/bc-data.Po
+# source='libyasm/bc-data.c' object='bc-data.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bc-data.o `test -f 'libyasm/bc-data.c' || echo '$(srcdir)/'`libyasm/bc-data.c
+
+bc-data.obj: libyasm/bc-data.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bc-data.obj -MD -MP -MF $(DEPDIR)/bc-data.Tpo -c -o bc-data.obj `if test -f 'libyasm/bc-data.c'; then $(CYGPATH_W) 'libyasm/bc-data.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bc-data.c'; fi`
+ mv -f $(DEPDIR)/bc-data.Tpo $(DEPDIR)/bc-data.Po
+# source='libyasm/bc-data.c' object='bc-data.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bc-data.obj `if test -f 'libyasm/bc-data.c'; then $(CYGPATH_W) 'libyasm/bc-data.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bc-data.c'; fi`
+
+bc-incbin.o: libyasm/bc-incbin.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bc-incbin.o -MD -MP -MF $(DEPDIR)/bc-incbin.Tpo -c -o bc-incbin.o `test -f 'libyasm/bc-incbin.c' || echo '$(srcdir)/'`libyasm/bc-incbin.c
+ mv -f $(DEPDIR)/bc-incbin.Tpo $(DEPDIR)/bc-incbin.Po
+# source='libyasm/bc-incbin.c' object='bc-incbin.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bc-incbin.o `test -f 'libyasm/bc-incbin.c' || echo '$(srcdir)/'`libyasm/bc-incbin.c
+
+bc-incbin.obj: libyasm/bc-incbin.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bc-incbin.obj -MD -MP -MF $(DEPDIR)/bc-incbin.Tpo -c -o bc-incbin.obj `if test -f 'libyasm/bc-incbin.c'; then $(CYGPATH_W) 'libyasm/bc-incbin.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bc-incbin.c'; fi`
+ mv -f $(DEPDIR)/bc-incbin.Tpo $(DEPDIR)/bc-incbin.Po
+# source='libyasm/bc-incbin.c' object='bc-incbin.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bc-incbin.obj `if test -f 'libyasm/bc-incbin.c'; then $(CYGPATH_W) 'libyasm/bc-incbin.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bc-incbin.c'; fi`
+
+bc-org.o: libyasm/bc-org.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bc-org.o -MD -MP -MF $(DEPDIR)/bc-org.Tpo -c -o bc-org.o `test -f 'libyasm/bc-org.c' || echo '$(srcdir)/'`libyasm/bc-org.c
+ mv -f $(DEPDIR)/bc-org.Tpo $(DEPDIR)/bc-org.Po
+# source='libyasm/bc-org.c' object='bc-org.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bc-org.o `test -f 'libyasm/bc-org.c' || echo '$(srcdir)/'`libyasm/bc-org.c
+
+bc-org.obj: libyasm/bc-org.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bc-org.obj -MD -MP -MF $(DEPDIR)/bc-org.Tpo -c -o bc-org.obj `if test -f 'libyasm/bc-org.c'; then $(CYGPATH_W) 'libyasm/bc-org.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bc-org.c'; fi`
+ mv -f $(DEPDIR)/bc-org.Tpo $(DEPDIR)/bc-org.Po
+# source='libyasm/bc-org.c' object='bc-org.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bc-org.obj `if test -f 'libyasm/bc-org.c'; then $(CYGPATH_W) 'libyasm/bc-org.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bc-org.c'; fi`
+
+bc-reserve.o: libyasm/bc-reserve.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bc-reserve.o -MD -MP -MF $(DEPDIR)/bc-reserve.Tpo -c -o bc-reserve.o `test -f 'libyasm/bc-reserve.c' || echo '$(srcdir)/'`libyasm/bc-reserve.c
+ mv -f $(DEPDIR)/bc-reserve.Tpo $(DEPDIR)/bc-reserve.Po
+# source='libyasm/bc-reserve.c' object='bc-reserve.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bc-reserve.o `test -f 'libyasm/bc-reserve.c' || echo '$(srcdir)/'`libyasm/bc-reserve.c
+
+bc-reserve.obj: libyasm/bc-reserve.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bc-reserve.obj -MD -MP -MF $(DEPDIR)/bc-reserve.Tpo -c -o bc-reserve.obj `if test -f 'libyasm/bc-reserve.c'; then $(CYGPATH_W) 'libyasm/bc-reserve.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bc-reserve.c'; fi`
+ mv -f $(DEPDIR)/bc-reserve.Tpo $(DEPDIR)/bc-reserve.Po
+# source='libyasm/bc-reserve.c' object='bc-reserve.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bc-reserve.obj `if test -f 'libyasm/bc-reserve.c'; then $(CYGPATH_W) 'libyasm/bc-reserve.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bc-reserve.c'; fi`
+
+bytecode.o: libyasm/bytecode.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bytecode.o -MD -MP -MF $(DEPDIR)/bytecode.Tpo -c -o bytecode.o `test -f 'libyasm/bytecode.c' || echo '$(srcdir)/'`libyasm/bytecode.c
+ mv -f $(DEPDIR)/bytecode.Tpo $(DEPDIR)/bytecode.Po
+# source='libyasm/bytecode.c' object='bytecode.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bytecode.o `test -f 'libyasm/bytecode.c' || echo '$(srcdir)/'`libyasm/bytecode.c
+
+bytecode.obj: libyasm/bytecode.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bytecode.obj -MD -MP -MF $(DEPDIR)/bytecode.Tpo -c -o bytecode.obj `if test -f 'libyasm/bytecode.c'; then $(CYGPATH_W) 'libyasm/bytecode.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bytecode.c'; fi`
+ mv -f $(DEPDIR)/bytecode.Tpo $(DEPDIR)/bytecode.Po
+# source='libyasm/bytecode.c' object='bytecode.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bytecode.obj `if test -f 'libyasm/bytecode.c'; then $(CYGPATH_W) 'libyasm/bytecode.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bytecode.c'; fi`
+
+errwarn.o: libyasm/errwarn.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT errwarn.o -MD -MP -MF $(DEPDIR)/errwarn.Tpo -c -o errwarn.o `test -f 'libyasm/errwarn.c' || echo '$(srcdir)/'`libyasm/errwarn.c
+ mv -f $(DEPDIR)/errwarn.Tpo $(DEPDIR)/errwarn.Po
+# source='libyasm/errwarn.c' object='errwarn.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o errwarn.o `test -f 'libyasm/errwarn.c' || echo '$(srcdir)/'`libyasm/errwarn.c
+
+errwarn.obj: libyasm/errwarn.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT errwarn.obj -MD -MP -MF $(DEPDIR)/errwarn.Tpo -c -o errwarn.obj `if test -f 'libyasm/errwarn.c'; then $(CYGPATH_W) 'libyasm/errwarn.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/errwarn.c'; fi`
+ mv -f $(DEPDIR)/errwarn.Tpo $(DEPDIR)/errwarn.Po
+# source='libyasm/errwarn.c' object='errwarn.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o errwarn.obj `if test -f 'libyasm/errwarn.c'; then $(CYGPATH_W) 'libyasm/errwarn.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/errwarn.c'; fi`
+
+expr.o: libyasm/expr.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT expr.o -MD -MP -MF $(DEPDIR)/expr.Tpo -c -o expr.o `test -f 'libyasm/expr.c' || echo '$(srcdir)/'`libyasm/expr.c
+ mv -f $(DEPDIR)/expr.Tpo $(DEPDIR)/expr.Po
+# source='libyasm/expr.c' object='expr.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o expr.o `test -f 'libyasm/expr.c' || echo '$(srcdir)/'`libyasm/expr.c
+
+expr.obj: libyasm/expr.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT expr.obj -MD -MP -MF $(DEPDIR)/expr.Tpo -c -o expr.obj `if test -f 'libyasm/expr.c'; then $(CYGPATH_W) 'libyasm/expr.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/expr.c'; fi`
+ mv -f $(DEPDIR)/expr.Tpo $(DEPDIR)/expr.Po
+# source='libyasm/expr.c' object='expr.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o expr.obj `if test -f 'libyasm/expr.c'; then $(CYGPATH_W) 'libyasm/expr.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/expr.c'; fi`
+
+file.o: libyasm/file.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT file.o -MD -MP -MF $(DEPDIR)/file.Tpo -c -o file.o `test -f 'libyasm/file.c' || echo '$(srcdir)/'`libyasm/file.c
+ mv -f $(DEPDIR)/file.Tpo $(DEPDIR)/file.Po
+# source='libyasm/file.c' object='file.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o file.o `test -f 'libyasm/file.c' || echo '$(srcdir)/'`libyasm/file.c
+
+file.obj: libyasm/file.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT file.obj -MD -MP -MF $(DEPDIR)/file.Tpo -c -o file.obj `if test -f 'libyasm/file.c'; then $(CYGPATH_W) 'libyasm/file.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/file.c'; fi`
+ mv -f $(DEPDIR)/file.Tpo $(DEPDIR)/file.Po
+# source='libyasm/file.c' object='file.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o file.obj `if test -f 'libyasm/file.c'; then $(CYGPATH_W) 'libyasm/file.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/file.c'; fi`
+
+floatnum.o: libyasm/floatnum.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT floatnum.o -MD -MP -MF $(DEPDIR)/floatnum.Tpo -c -o floatnum.o `test -f 'libyasm/floatnum.c' || echo '$(srcdir)/'`libyasm/floatnum.c
+ mv -f $(DEPDIR)/floatnum.Tpo $(DEPDIR)/floatnum.Po
+# source='libyasm/floatnum.c' object='floatnum.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o floatnum.o `test -f 'libyasm/floatnum.c' || echo '$(srcdir)/'`libyasm/floatnum.c
+
+floatnum.obj: libyasm/floatnum.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT floatnum.obj -MD -MP -MF $(DEPDIR)/floatnum.Tpo -c -o floatnum.obj `if test -f 'libyasm/floatnum.c'; then $(CYGPATH_W) 'libyasm/floatnum.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/floatnum.c'; fi`
+ mv -f $(DEPDIR)/floatnum.Tpo $(DEPDIR)/floatnum.Po
+# source='libyasm/floatnum.c' object='floatnum.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o floatnum.obj `if test -f 'libyasm/floatnum.c'; then $(CYGPATH_W) 'libyasm/floatnum.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/floatnum.c'; fi`
+
+hamt.o: libyasm/hamt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT hamt.o -MD -MP -MF $(DEPDIR)/hamt.Tpo -c -o hamt.o `test -f 'libyasm/hamt.c' || echo '$(srcdir)/'`libyasm/hamt.c
+ mv -f $(DEPDIR)/hamt.Tpo $(DEPDIR)/hamt.Po
+# source='libyasm/hamt.c' object='hamt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o hamt.o `test -f 'libyasm/hamt.c' || echo '$(srcdir)/'`libyasm/hamt.c
+
+hamt.obj: libyasm/hamt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT hamt.obj -MD -MP -MF $(DEPDIR)/hamt.Tpo -c -o hamt.obj `if test -f 'libyasm/hamt.c'; then $(CYGPATH_W) 'libyasm/hamt.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/hamt.c'; fi`
+ mv -f $(DEPDIR)/hamt.Tpo $(DEPDIR)/hamt.Po
+# source='libyasm/hamt.c' object='hamt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o hamt.obj `if test -f 'libyasm/hamt.c'; then $(CYGPATH_W) 'libyasm/hamt.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/hamt.c'; fi`
+
+insn.o: libyasm/insn.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT insn.o -MD -MP -MF $(DEPDIR)/insn.Tpo -c -o insn.o `test -f 'libyasm/insn.c' || echo '$(srcdir)/'`libyasm/insn.c
+ mv -f $(DEPDIR)/insn.Tpo $(DEPDIR)/insn.Po
+# source='libyasm/insn.c' object='insn.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o insn.o `test -f 'libyasm/insn.c' || echo '$(srcdir)/'`libyasm/insn.c
+
+insn.obj: libyasm/insn.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT insn.obj -MD -MP -MF $(DEPDIR)/insn.Tpo -c -o insn.obj `if test -f 'libyasm/insn.c'; then $(CYGPATH_W) 'libyasm/insn.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/insn.c'; fi`
+ mv -f $(DEPDIR)/insn.Tpo $(DEPDIR)/insn.Po
+# source='libyasm/insn.c' object='insn.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o insn.obj `if test -f 'libyasm/insn.c'; then $(CYGPATH_W) 'libyasm/insn.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/insn.c'; fi`
+
+intnum.o: libyasm/intnum.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT intnum.o -MD -MP -MF $(DEPDIR)/intnum.Tpo -c -o intnum.o `test -f 'libyasm/intnum.c' || echo '$(srcdir)/'`libyasm/intnum.c
+ mv -f $(DEPDIR)/intnum.Tpo $(DEPDIR)/intnum.Po
+# source='libyasm/intnum.c' object='intnum.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o intnum.o `test -f 'libyasm/intnum.c' || echo '$(srcdir)/'`libyasm/intnum.c
+
+intnum.obj: libyasm/intnum.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT intnum.obj -MD -MP -MF $(DEPDIR)/intnum.Tpo -c -o intnum.obj `if test -f 'libyasm/intnum.c'; then $(CYGPATH_W) 'libyasm/intnum.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/intnum.c'; fi`
+ mv -f $(DEPDIR)/intnum.Tpo $(DEPDIR)/intnum.Po
+# source='libyasm/intnum.c' object='intnum.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o intnum.obj `if test -f 'libyasm/intnum.c'; then $(CYGPATH_W) 'libyasm/intnum.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/intnum.c'; fi`
+
+inttree.o: libyasm/inttree.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT inttree.o -MD -MP -MF $(DEPDIR)/inttree.Tpo -c -o inttree.o `test -f 'libyasm/inttree.c' || echo '$(srcdir)/'`libyasm/inttree.c
+ mv -f $(DEPDIR)/inttree.Tpo $(DEPDIR)/inttree.Po
+# source='libyasm/inttree.c' object='inttree.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o inttree.o `test -f 'libyasm/inttree.c' || echo '$(srcdir)/'`libyasm/inttree.c
+
+inttree.obj: libyasm/inttree.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT inttree.obj -MD -MP -MF $(DEPDIR)/inttree.Tpo -c -o inttree.obj `if test -f 'libyasm/inttree.c'; then $(CYGPATH_W) 'libyasm/inttree.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/inttree.c'; fi`
+ mv -f $(DEPDIR)/inttree.Tpo $(DEPDIR)/inttree.Po
+# source='libyasm/inttree.c' object='inttree.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o inttree.obj `if test -f 'libyasm/inttree.c'; then $(CYGPATH_W) 'libyasm/inttree.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/inttree.c'; fi`
+
+linemap.o: libyasm/linemap.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT linemap.o -MD -MP -MF $(DEPDIR)/linemap.Tpo -c -o linemap.o `test -f 'libyasm/linemap.c' || echo '$(srcdir)/'`libyasm/linemap.c
+ mv -f $(DEPDIR)/linemap.Tpo $(DEPDIR)/linemap.Po
+# source='libyasm/linemap.c' object='linemap.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o linemap.o `test -f 'libyasm/linemap.c' || echo '$(srcdir)/'`libyasm/linemap.c
+
+linemap.obj: libyasm/linemap.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT linemap.obj -MD -MP -MF $(DEPDIR)/linemap.Tpo -c -o linemap.obj `if test -f 'libyasm/linemap.c'; then $(CYGPATH_W) 'libyasm/linemap.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/linemap.c'; fi`
+ mv -f $(DEPDIR)/linemap.Tpo $(DEPDIR)/linemap.Po
+# source='libyasm/linemap.c' object='linemap.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o linemap.obj `if test -f 'libyasm/linemap.c'; then $(CYGPATH_W) 'libyasm/linemap.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/linemap.c'; fi`
+
+md5.o: libyasm/md5.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT md5.o -MD -MP -MF $(DEPDIR)/md5.Tpo -c -o md5.o `test -f 'libyasm/md5.c' || echo '$(srcdir)/'`libyasm/md5.c
+ mv -f $(DEPDIR)/md5.Tpo $(DEPDIR)/md5.Po
+# source='libyasm/md5.c' object='md5.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o md5.o `test -f 'libyasm/md5.c' || echo '$(srcdir)/'`libyasm/md5.c
+
+md5.obj: libyasm/md5.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT md5.obj -MD -MP -MF $(DEPDIR)/md5.Tpo -c -o md5.obj `if test -f 'libyasm/md5.c'; then $(CYGPATH_W) 'libyasm/md5.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/md5.c'; fi`
+ mv -f $(DEPDIR)/md5.Tpo $(DEPDIR)/md5.Po
+# source='libyasm/md5.c' object='md5.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o md5.obj `if test -f 'libyasm/md5.c'; then $(CYGPATH_W) 'libyasm/md5.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/md5.c'; fi`
+
+mergesort.o: libyasm/mergesort.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mergesort.o -MD -MP -MF $(DEPDIR)/mergesort.Tpo -c -o mergesort.o `test -f 'libyasm/mergesort.c' || echo '$(srcdir)/'`libyasm/mergesort.c
+ mv -f $(DEPDIR)/mergesort.Tpo $(DEPDIR)/mergesort.Po
+# source='libyasm/mergesort.c' object='mergesort.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mergesort.o `test -f 'libyasm/mergesort.c' || echo '$(srcdir)/'`libyasm/mergesort.c
+
+mergesort.obj: libyasm/mergesort.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mergesort.obj -MD -MP -MF $(DEPDIR)/mergesort.Tpo -c -o mergesort.obj `if test -f 'libyasm/mergesort.c'; then $(CYGPATH_W) 'libyasm/mergesort.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/mergesort.c'; fi`
+ mv -f $(DEPDIR)/mergesort.Tpo $(DEPDIR)/mergesort.Po
+# source='libyasm/mergesort.c' object='mergesort.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mergesort.obj `if test -f 'libyasm/mergesort.c'; then $(CYGPATH_W) 'libyasm/mergesort.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/mergesort.c'; fi`
+
+phash.o: libyasm/phash.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT phash.o -MD -MP -MF $(DEPDIR)/phash.Tpo -c -o phash.o `test -f 'libyasm/phash.c' || echo '$(srcdir)/'`libyasm/phash.c
+ mv -f $(DEPDIR)/phash.Tpo $(DEPDIR)/phash.Po
+# source='libyasm/phash.c' object='phash.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o phash.o `test -f 'libyasm/phash.c' || echo '$(srcdir)/'`libyasm/phash.c
+
+phash.obj: libyasm/phash.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT phash.obj -MD -MP -MF $(DEPDIR)/phash.Tpo -c -o phash.obj `if test -f 'libyasm/phash.c'; then $(CYGPATH_W) 'libyasm/phash.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/phash.c'; fi`
+ mv -f $(DEPDIR)/phash.Tpo $(DEPDIR)/phash.Po
+# source='libyasm/phash.c' object='phash.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o phash.obj `if test -f 'libyasm/phash.c'; then $(CYGPATH_W) 'libyasm/phash.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/phash.c'; fi`
+
+section.o: libyasm/section.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT section.o -MD -MP -MF $(DEPDIR)/section.Tpo -c -o section.o `test -f 'libyasm/section.c' || echo '$(srcdir)/'`libyasm/section.c
+ mv -f $(DEPDIR)/section.Tpo $(DEPDIR)/section.Po
+# source='libyasm/section.c' object='section.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o section.o `test -f 'libyasm/section.c' || echo '$(srcdir)/'`libyasm/section.c
+
+section.obj: libyasm/section.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT section.obj -MD -MP -MF $(DEPDIR)/section.Tpo -c -o section.obj `if test -f 'libyasm/section.c'; then $(CYGPATH_W) 'libyasm/section.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/section.c'; fi`
+ mv -f $(DEPDIR)/section.Tpo $(DEPDIR)/section.Po
+# source='libyasm/section.c' object='section.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o section.obj `if test -f 'libyasm/section.c'; then $(CYGPATH_W) 'libyasm/section.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/section.c'; fi`
+
+strcasecmp.o: libyasm/strcasecmp.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT strcasecmp.o -MD -MP -MF $(DEPDIR)/strcasecmp.Tpo -c -o strcasecmp.o `test -f 'libyasm/strcasecmp.c' || echo '$(srcdir)/'`libyasm/strcasecmp.c
+ mv -f $(DEPDIR)/strcasecmp.Tpo $(DEPDIR)/strcasecmp.Po
+# source='libyasm/strcasecmp.c' object='strcasecmp.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o strcasecmp.o `test -f 'libyasm/strcasecmp.c' || echo '$(srcdir)/'`libyasm/strcasecmp.c
+
+strcasecmp.obj: libyasm/strcasecmp.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT strcasecmp.obj -MD -MP -MF $(DEPDIR)/strcasecmp.Tpo -c -o strcasecmp.obj `if test -f 'libyasm/strcasecmp.c'; then $(CYGPATH_W) 'libyasm/strcasecmp.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/strcasecmp.c'; fi`
+ mv -f $(DEPDIR)/strcasecmp.Tpo $(DEPDIR)/strcasecmp.Po
+# source='libyasm/strcasecmp.c' object='strcasecmp.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o strcasecmp.obj `if test -f 'libyasm/strcasecmp.c'; then $(CYGPATH_W) 'libyasm/strcasecmp.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/strcasecmp.c'; fi`
+
+strsep.o: libyasm/strsep.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT strsep.o -MD -MP -MF $(DEPDIR)/strsep.Tpo -c -o strsep.o `test -f 'libyasm/strsep.c' || echo '$(srcdir)/'`libyasm/strsep.c
+ mv -f $(DEPDIR)/strsep.Tpo $(DEPDIR)/strsep.Po
+# source='libyasm/strsep.c' object='strsep.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o strsep.o `test -f 'libyasm/strsep.c' || echo '$(srcdir)/'`libyasm/strsep.c
+
+strsep.obj: libyasm/strsep.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT strsep.obj -MD -MP -MF $(DEPDIR)/strsep.Tpo -c -o strsep.obj `if test -f 'libyasm/strsep.c'; then $(CYGPATH_W) 'libyasm/strsep.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/strsep.c'; fi`
+ mv -f $(DEPDIR)/strsep.Tpo $(DEPDIR)/strsep.Po
+# source='libyasm/strsep.c' object='strsep.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o strsep.obj `if test -f 'libyasm/strsep.c'; then $(CYGPATH_W) 'libyasm/strsep.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/strsep.c'; fi`
+
+symrec.o: libyasm/symrec.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT symrec.o -MD -MP -MF $(DEPDIR)/symrec.Tpo -c -o symrec.o `test -f 'libyasm/symrec.c' || echo '$(srcdir)/'`libyasm/symrec.c
+ mv -f $(DEPDIR)/symrec.Tpo $(DEPDIR)/symrec.Po
+# source='libyasm/symrec.c' object='symrec.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o symrec.o `test -f 'libyasm/symrec.c' || echo '$(srcdir)/'`libyasm/symrec.c
+
+symrec.obj: libyasm/symrec.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT symrec.obj -MD -MP -MF $(DEPDIR)/symrec.Tpo -c -o symrec.obj `if test -f 'libyasm/symrec.c'; then $(CYGPATH_W) 'libyasm/symrec.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/symrec.c'; fi`
+ mv -f $(DEPDIR)/symrec.Tpo $(DEPDIR)/symrec.Po
+# source='libyasm/symrec.c' object='symrec.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o symrec.obj `if test -f 'libyasm/symrec.c'; then $(CYGPATH_W) 'libyasm/symrec.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/symrec.c'; fi`
+
+valparam.o: libyasm/valparam.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT valparam.o -MD -MP -MF $(DEPDIR)/valparam.Tpo -c -o valparam.o `test -f 'libyasm/valparam.c' || echo '$(srcdir)/'`libyasm/valparam.c
+ mv -f $(DEPDIR)/valparam.Tpo $(DEPDIR)/valparam.Po
+# source='libyasm/valparam.c' object='valparam.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o valparam.o `test -f 'libyasm/valparam.c' || echo '$(srcdir)/'`libyasm/valparam.c
+
+valparam.obj: libyasm/valparam.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT valparam.obj -MD -MP -MF $(DEPDIR)/valparam.Tpo -c -o valparam.obj `if test -f 'libyasm/valparam.c'; then $(CYGPATH_W) 'libyasm/valparam.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/valparam.c'; fi`
+ mv -f $(DEPDIR)/valparam.Tpo $(DEPDIR)/valparam.Po
+# source='libyasm/valparam.c' object='valparam.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o valparam.obj `if test -f 'libyasm/valparam.c'; then $(CYGPATH_W) 'libyasm/valparam.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/valparam.c'; fi`
+
+value.o: libyasm/value.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT value.o -MD -MP -MF $(DEPDIR)/value.Tpo -c -o value.o `test -f 'libyasm/value.c' || echo '$(srcdir)/'`libyasm/value.c
+ mv -f $(DEPDIR)/value.Tpo $(DEPDIR)/value.Po
+# source='libyasm/value.c' object='value.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o value.o `test -f 'libyasm/value.c' || echo '$(srcdir)/'`libyasm/value.c
+
+value.obj: libyasm/value.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT value.obj -MD -MP -MF $(DEPDIR)/value.Tpo -c -o value.obj `if test -f 'libyasm/value.c'; then $(CYGPATH_W) 'libyasm/value.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/value.c'; fi`
+ mv -f $(DEPDIR)/value.Tpo $(DEPDIR)/value.Po
+# source='libyasm/value.c' object='value.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o value.obj `if test -f 'libyasm/value.c'; then $(CYGPATH_W) 'libyasm/value.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/value.c'; fi`
+
+xmalloc.o: libyasm/xmalloc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xmalloc.o -MD -MP -MF $(DEPDIR)/xmalloc.Tpo -c -o xmalloc.o `test -f 'libyasm/xmalloc.c' || echo '$(srcdir)/'`libyasm/xmalloc.c
+ mv -f $(DEPDIR)/xmalloc.Tpo $(DEPDIR)/xmalloc.Po
+# source='libyasm/xmalloc.c' object='xmalloc.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xmalloc.o `test -f 'libyasm/xmalloc.c' || echo '$(srcdir)/'`libyasm/xmalloc.c
+
+xmalloc.obj: libyasm/xmalloc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xmalloc.obj -MD -MP -MF $(DEPDIR)/xmalloc.Tpo -c -o xmalloc.obj `if test -f 'libyasm/xmalloc.c'; then $(CYGPATH_W) 'libyasm/xmalloc.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/xmalloc.c'; fi`
+ mv -f $(DEPDIR)/xmalloc.Tpo $(DEPDIR)/xmalloc.Po
+# source='libyasm/xmalloc.c' object='xmalloc.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xmalloc.obj `if test -f 'libyasm/xmalloc.c'; then $(CYGPATH_W) 'libyasm/xmalloc.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/xmalloc.c'; fi`
+
+xstrdup.o: libyasm/xstrdup.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xstrdup.o -MD -MP -MF $(DEPDIR)/xstrdup.Tpo -c -o xstrdup.o `test -f 'libyasm/xstrdup.c' || echo '$(srcdir)/'`libyasm/xstrdup.c
+ mv -f $(DEPDIR)/xstrdup.Tpo $(DEPDIR)/xstrdup.Po
+# source='libyasm/xstrdup.c' object='xstrdup.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xstrdup.o `test -f 'libyasm/xstrdup.c' || echo '$(srcdir)/'`libyasm/xstrdup.c
+
+xstrdup.obj: libyasm/xstrdup.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xstrdup.obj -MD -MP -MF $(DEPDIR)/xstrdup.Tpo -c -o xstrdup.obj `if test -f 'libyasm/xstrdup.c'; then $(CYGPATH_W) 'libyasm/xstrdup.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/xstrdup.c'; fi`
+ mv -f $(DEPDIR)/xstrdup.Tpo $(DEPDIR)/xstrdup.Po
+# source='libyasm/xstrdup.c' object='xstrdup.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xstrdup.obj `if test -f 'libyasm/xstrdup.c'; then $(CYGPATH_W) 'libyasm/xstrdup.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/xstrdup.c'; fi`
+
+bitvect_test.o: libyasm/tests/bitvect_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bitvect_test.o -MD -MP -MF $(DEPDIR)/bitvect_test.Tpo -c -o bitvect_test.o `test -f 'libyasm/tests/bitvect_test.c' || echo '$(srcdir)/'`libyasm/tests/bitvect_test.c
+ mv -f $(DEPDIR)/bitvect_test.Tpo $(DEPDIR)/bitvect_test.Po
+# source='libyasm/tests/bitvect_test.c' object='bitvect_test.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bitvect_test.o `test -f 'libyasm/tests/bitvect_test.c' || echo '$(srcdir)/'`libyasm/tests/bitvect_test.c
+
+bitvect_test.obj: libyasm/tests/bitvect_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bitvect_test.obj -MD -MP -MF $(DEPDIR)/bitvect_test.Tpo -c -o bitvect_test.obj `if test -f 'libyasm/tests/bitvect_test.c'; then $(CYGPATH_W) 'libyasm/tests/bitvect_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/bitvect_test.c'; fi`
+ mv -f $(DEPDIR)/bitvect_test.Tpo $(DEPDIR)/bitvect_test.Po
+# source='libyasm/tests/bitvect_test.c' object='bitvect_test.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bitvect_test.obj `if test -f 'libyasm/tests/bitvect_test.c'; then $(CYGPATH_W) 'libyasm/tests/bitvect_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/bitvect_test.c'; fi`
+
+combpath_test.o: libyasm/tests/combpath_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT combpath_test.o -MD -MP -MF $(DEPDIR)/combpath_test.Tpo -c -o combpath_test.o `test -f 'libyasm/tests/combpath_test.c' || echo '$(srcdir)/'`libyasm/tests/combpath_test.c
+ mv -f $(DEPDIR)/combpath_test.Tpo $(DEPDIR)/combpath_test.Po
+# source='libyasm/tests/combpath_test.c' object='combpath_test.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o combpath_test.o `test -f 'libyasm/tests/combpath_test.c' || echo '$(srcdir)/'`libyasm/tests/combpath_test.c
+
+combpath_test.obj: libyasm/tests/combpath_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT combpath_test.obj -MD -MP -MF $(DEPDIR)/combpath_test.Tpo -c -o combpath_test.obj `if test -f 'libyasm/tests/combpath_test.c'; then $(CYGPATH_W) 'libyasm/tests/combpath_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/combpath_test.c'; fi`
+ mv -f $(DEPDIR)/combpath_test.Tpo $(DEPDIR)/combpath_test.Po
+# source='libyasm/tests/combpath_test.c' object='combpath_test.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o combpath_test.obj `if test -f 'libyasm/tests/combpath_test.c'; then $(CYGPATH_W) 'libyasm/tests/combpath_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/combpath_test.c'; fi`
+
+floatnum_test.o: libyasm/tests/floatnum_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT floatnum_test.o -MD -MP -MF $(DEPDIR)/floatnum_test.Tpo -c -o floatnum_test.o `test -f 'libyasm/tests/floatnum_test.c' || echo '$(srcdir)/'`libyasm/tests/floatnum_test.c
+ mv -f $(DEPDIR)/floatnum_test.Tpo $(DEPDIR)/floatnum_test.Po
+# source='libyasm/tests/floatnum_test.c' object='floatnum_test.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o floatnum_test.o `test -f 'libyasm/tests/floatnum_test.c' || echo '$(srcdir)/'`libyasm/tests/floatnum_test.c
+
+floatnum_test.obj: libyasm/tests/floatnum_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT floatnum_test.obj -MD -MP -MF $(DEPDIR)/floatnum_test.Tpo -c -o floatnum_test.obj `if test -f 'libyasm/tests/floatnum_test.c'; then $(CYGPATH_W) 'libyasm/tests/floatnum_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/floatnum_test.c'; fi`
+ mv -f $(DEPDIR)/floatnum_test.Tpo $(DEPDIR)/floatnum_test.Po
+# source='libyasm/tests/floatnum_test.c' object='floatnum_test.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o floatnum_test.obj `if test -f 'libyasm/tests/floatnum_test.c'; then $(CYGPATH_W) 'libyasm/tests/floatnum_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/floatnum_test.c'; fi`
+
+leb128_test.o: libyasm/tests/leb128_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT leb128_test.o -MD -MP -MF $(DEPDIR)/leb128_test.Tpo -c -o leb128_test.o `test -f 'libyasm/tests/leb128_test.c' || echo '$(srcdir)/'`libyasm/tests/leb128_test.c
+ mv -f $(DEPDIR)/leb128_test.Tpo $(DEPDIR)/leb128_test.Po
+# source='libyasm/tests/leb128_test.c' object='leb128_test.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o leb128_test.o `test -f 'libyasm/tests/leb128_test.c' || echo '$(srcdir)/'`libyasm/tests/leb128_test.c
+
+leb128_test.obj: libyasm/tests/leb128_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT leb128_test.obj -MD -MP -MF $(DEPDIR)/leb128_test.Tpo -c -o leb128_test.obj `if test -f 'libyasm/tests/leb128_test.c'; then $(CYGPATH_W) 'libyasm/tests/leb128_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/leb128_test.c'; fi`
+ mv -f $(DEPDIR)/leb128_test.Tpo $(DEPDIR)/leb128_test.Po
+# source='libyasm/tests/leb128_test.c' object='leb128_test.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o leb128_test.obj `if test -f 'libyasm/tests/leb128_test.c'; then $(CYGPATH_W) 'libyasm/tests/leb128_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/leb128_test.c'; fi`
+
+splitpath_test.o: libyasm/tests/splitpath_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT splitpath_test.o -MD -MP -MF $(DEPDIR)/splitpath_test.Tpo -c -o splitpath_test.o `test -f 'libyasm/tests/splitpath_test.c' || echo '$(srcdir)/'`libyasm/tests/splitpath_test.c
+ mv -f $(DEPDIR)/splitpath_test.Tpo $(DEPDIR)/splitpath_test.Po
+# source='libyasm/tests/splitpath_test.c' object='splitpath_test.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o splitpath_test.o `test -f 'libyasm/tests/splitpath_test.c' || echo '$(srcdir)/'`libyasm/tests/splitpath_test.c
+
+splitpath_test.obj: libyasm/tests/splitpath_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT splitpath_test.obj -MD -MP -MF $(DEPDIR)/splitpath_test.Tpo -c -o splitpath_test.obj `if test -f 'libyasm/tests/splitpath_test.c'; then $(CYGPATH_W) 'libyasm/tests/splitpath_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/splitpath_test.c'; fi`
+ mv -f $(DEPDIR)/splitpath_test.Tpo $(DEPDIR)/splitpath_test.Po
+# source='libyasm/tests/splitpath_test.c' object='splitpath_test.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o splitpath_test.obj `if test -f 'libyasm/tests/splitpath_test.c'; then $(CYGPATH_W) 'libyasm/tests/splitpath_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/splitpath_test.c'; fi`
+
+uncstring_test.o: libyasm/tests/uncstring_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT uncstring_test.o -MD -MP -MF $(DEPDIR)/uncstring_test.Tpo -c -o uncstring_test.o `test -f 'libyasm/tests/uncstring_test.c' || echo '$(srcdir)/'`libyasm/tests/uncstring_test.c
+ mv -f $(DEPDIR)/uncstring_test.Tpo $(DEPDIR)/uncstring_test.Po
+# source='libyasm/tests/uncstring_test.c' object='uncstring_test.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o uncstring_test.o `test -f 'libyasm/tests/uncstring_test.c' || echo '$(srcdir)/'`libyasm/tests/uncstring_test.c
+
+uncstring_test.obj: libyasm/tests/uncstring_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT uncstring_test.obj -MD -MP -MF $(DEPDIR)/uncstring_test.Tpo -c -o uncstring_test.obj `if test -f 'libyasm/tests/uncstring_test.c'; then $(CYGPATH_W) 'libyasm/tests/uncstring_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/uncstring_test.c'; fi`
+ mv -f $(DEPDIR)/uncstring_test.Tpo $(DEPDIR)/uncstring_test.Po
+# source='libyasm/tests/uncstring_test.c' object='uncstring_test.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o uncstring_test.obj `if test -f 'libyasm/tests/uncstring_test.c'; then $(CYGPATH_W) 'libyasm/tests/uncstring_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/uncstring_test.c'; fi`
+
+yasm.o: frontends/yasm/yasm.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT yasm.o -MD -MP -MF $(DEPDIR)/yasm.Tpo -c -o yasm.o `test -f 'frontends/yasm/yasm.c' || echo '$(srcdir)/'`frontends/yasm/yasm.c
+ mv -f $(DEPDIR)/yasm.Tpo $(DEPDIR)/yasm.Po
+# source='frontends/yasm/yasm.c' object='yasm.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o yasm.o `test -f 'frontends/yasm/yasm.c' || echo '$(srcdir)/'`frontends/yasm/yasm.c
+
+yasm.obj: frontends/yasm/yasm.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT yasm.obj -MD -MP -MF $(DEPDIR)/yasm.Tpo -c -o yasm.obj `if test -f 'frontends/yasm/yasm.c'; then $(CYGPATH_W) 'frontends/yasm/yasm.c'; else $(CYGPATH_W) '$(srcdir)/frontends/yasm/yasm.c'; fi`
+ mv -f $(DEPDIR)/yasm.Tpo $(DEPDIR)/yasm.Po
+# source='frontends/yasm/yasm.c' object='yasm.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o yasm.obj `if test -f 'frontends/yasm/yasm.c'; then $(CYGPATH_W) 'frontends/yasm/yasm.c'; else $(CYGPATH_W) '$(srcdir)/frontends/yasm/yasm.c'; fi`
+
+yasm-options.o: frontends/yasm/yasm-options.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT yasm-options.o -MD -MP -MF $(DEPDIR)/yasm-options.Tpo -c -o yasm-options.o `test -f 'frontends/yasm/yasm-options.c' || echo '$(srcdir)/'`frontends/yasm/yasm-options.c
+ mv -f $(DEPDIR)/yasm-options.Tpo $(DEPDIR)/yasm-options.Po
+# source='frontends/yasm/yasm-options.c' object='yasm-options.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o yasm-options.o `test -f 'frontends/yasm/yasm-options.c' || echo '$(srcdir)/'`frontends/yasm/yasm-options.c
+
+yasm-options.obj: frontends/yasm/yasm-options.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT yasm-options.obj -MD -MP -MF $(DEPDIR)/yasm-options.Tpo -c -o yasm-options.obj `if test -f 'frontends/yasm/yasm-options.c'; then $(CYGPATH_W) 'frontends/yasm/yasm-options.c'; else $(CYGPATH_W) '$(srcdir)/frontends/yasm/yasm-options.c'; fi`
+ mv -f $(DEPDIR)/yasm-options.Tpo $(DEPDIR)/yasm-options.Po
+# source='frontends/yasm/yasm-options.c' object='yasm-options.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o yasm-options.obj `if test -f 'frontends/yasm/yasm-options.c'; then $(CYGPATH_W) 'frontends/yasm/yasm-options.c'; else $(CYGPATH_W) '$(srcdir)/frontends/yasm/yasm-options.c'; fi`
+
+tasm.o: frontends/tasm/tasm.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tasm.o -MD -MP -MF $(DEPDIR)/tasm.Tpo -c -o tasm.o `test -f 'frontends/tasm/tasm.c' || echo '$(srcdir)/'`frontends/tasm/tasm.c
+ mv -f $(DEPDIR)/tasm.Tpo $(DEPDIR)/tasm.Po
+# source='frontends/tasm/tasm.c' object='tasm.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tasm.o `test -f 'frontends/tasm/tasm.c' || echo '$(srcdir)/'`frontends/tasm/tasm.c
+
+tasm.obj: frontends/tasm/tasm.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tasm.obj -MD -MP -MF $(DEPDIR)/tasm.Tpo -c -o tasm.obj `if test -f 'frontends/tasm/tasm.c'; then $(CYGPATH_W) 'frontends/tasm/tasm.c'; else $(CYGPATH_W) '$(srcdir)/frontends/tasm/tasm.c'; fi`
+ mv -f $(DEPDIR)/tasm.Tpo $(DEPDIR)/tasm.Po
+# source='frontends/tasm/tasm.c' object='tasm.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tasm.obj `if test -f 'frontends/tasm/tasm.c'; then $(CYGPATH_W) 'frontends/tasm/tasm.c'; else $(CYGPATH_W) '$(srcdir)/frontends/tasm/tasm.c'; fi`
+
+tasm-options.o: frontends/tasm/tasm-options.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tasm-options.o -MD -MP -MF $(DEPDIR)/tasm-options.Tpo -c -o tasm-options.o `test -f 'frontends/tasm/tasm-options.c' || echo '$(srcdir)/'`frontends/tasm/tasm-options.c
+ mv -f $(DEPDIR)/tasm-options.Tpo $(DEPDIR)/tasm-options.Po
+# source='frontends/tasm/tasm-options.c' object='tasm-options.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tasm-options.o `test -f 'frontends/tasm/tasm-options.c' || echo '$(srcdir)/'`frontends/tasm/tasm-options.c
+
+tasm-options.obj: frontends/tasm/tasm-options.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tasm-options.obj -MD -MP -MF $(DEPDIR)/tasm-options.Tpo -c -o tasm-options.obj `if test -f 'frontends/tasm/tasm-options.c'; then $(CYGPATH_W) 'frontends/tasm/tasm-options.c'; else $(CYGPATH_W) '$(srcdir)/frontends/tasm/tasm-options.c'; fi`
+ mv -f $(DEPDIR)/tasm-options.Tpo $(DEPDIR)/tasm-options.Po
+# source='frontends/tasm/tasm-options.c' object='tasm-options.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tasm-options.obj `if test -f 'frontends/tasm/tasm-options.c'; then $(CYGPATH_W) 'frontends/tasm/tasm-options.c'; else $(CYGPATH_W) '$(srcdir)/frontends/tasm/tasm-options.c'; fi`
+install-man1: $(man1_MANS) $(man_MANS)
+ @$(NORMAL_INSTALL)
+ test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)"
+ @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.1*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
+ else file=$$i; fi; \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 1*) ;; \
+ *) ext='1' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \
+ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst"; \
+ done
+uninstall-man1:
+ @$(NORMAL_UNINSTALL)
+ @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.1*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 1*) ;; \
+ *) ext='1' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " rm -f '$(DESTDIR)$(man1dir)/$$inst'"; \
+ rm -f "$(DESTDIR)$(man1dir)/$$inst"; \
+ done
+install-man7: $(man7_MANS) $(man_MANS)
+ @$(NORMAL_INSTALL)
+ test -z "$(man7dir)" || $(MKDIR_P) "$(DESTDIR)$(man7dir)"
+ @list='$(man7_MANS) $(dist_man7_MANS) $(nodist_man7_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.7*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
+ else file=$$i; fi; \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 7*) ;; \
+ *) ext='7' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man7dir)/$$inst'"; \
+ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man7dir)/$$inst"; \
+ done
+uninstall-man7:
+ @$(NORMAL_UNINSTALL)
+ @list='$(man7_MANS) $(dist_man7_MANS) $(nodist_man7_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.7*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 7*) ;; \
+ *) ext='7' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " rm -f '$(DESTDIR)$(man7dir)/$$inst'"; \
+ rm -f "$(DESTDIR)$(man7dir)/$$inst"; \
+ done
+install-includeHEADERS: $(include_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)"
+ @list='$(include_HEADERS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includedir)/$$f'"; \
+ $(includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includedir)/$$f"; \
+ done
+
+uninstall-includeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(include_HEADERS)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(includedir)/$$f'"; \
+ rm -f "$(DESTDIR)$(includedir)/$$f"; \
+ done
+install-modincludeHEADERS: $(modinclude_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(modincludedir)" || $(MKDIR_P) "$(DESTDIR)$(modincludedir)"
+ @list='$(modinclude_HEADERS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(modincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(modincludedir)/$$f'"; \
+ $(modincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(modincludedir)/$$f"; \
+ done
+
+uninstall-modincludeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(modinclude_HEADERS)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(modincludedir)/$$f'"; \
+ rm -f "$(DESTDIR)$(modincludedir)/$$f"; \
+ done
+install-nodist_includeHEADERS: $(nodist_include_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)"
+ @list='$(nodist_include_HEADERS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(nodist_includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includedir)/$$f'"; \
+ $(nodist_includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includedir)/$$f"; \
+ done
+
+uninstall-nodist_includeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(nodist_include_HEADERS)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(includedir)/$$f'"; \
+ rm -f "$(DESTDIR)$(includedir)/$$f"; \
+ done
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+check-TESTS: $(TESTS)
+ @failed=0; all=0; xfail=0; xpass=0; skip=0; ws='[ ]'; \
+ srcdir=$(srcdir); export srcdir; \
+ list=' $(TESTS) '; \
+ if test -n "$$list"; then \
+ for tst in $$list; do \
+ if test -f ./$$tst; then dir=./; \
+ elif test -f $$tst; then dir=; \
+ else dir="$(srcdir)/"; fi; \
+ if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
+ all=`expr $$all + 1`; \
+ case " $(XFAIL_TESTS) " in \
+ *$$ws$$tst$$ws*) \
+ xpass=`expr $$xpass + 1`; \
+ failed=`expr $$failed + 1`; \
+ echo "XPASS: $$tst"; \
+ ;; \
+ *) \
+ echo "PASS: $$tst"; \
+ ;; \
+ esac; \
+ elif test $$? -ne 77; then \
+ all=`expr $$all + 1`; \
+ case " $(XFAIL_TESTS) " in \
+ *$$ws$$tst$$ws*) \
+ xfail=`expr $$xfail + 1`; \
+ echo "XFAIL: $$tst"; \
+ ;; \
+ *) \
+ failed=`expr $$failed + 1`; \
+ echo "FAIL: $$tst"; \
+ ;; \
+ esac; \
+ else \
+ skip=`expr $$skip + 1`; \
+ echo "SKIP: $$tst"; \
+ fi; \
+ done; \
+ if test "$$failed" -eq 0; then \
+ if test "$$xfail" -eq 0; then \
+ banner="All $$all tests passed"; \
+ else \
+ banner="All $$all tests behaved as expected ($$xfail expected failures)"; \
+ fi; \
+ else \
+ if test "$$xpass" -eq 0; then \
+ banner="$$failed of $$all tests failed"; \
+ else \
+ banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \
+ fi; \
+ fi; \
+ dashes="$$banner"; \
+ skipped=""; \
+ if test "$$skip" -ne 0; then \
+ skipped="($$skip tests were not run)"; \
+ test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
+ dashes="$$skipped"; \
+ fi; \
+ report=""; \
+ if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
+ report="Please report to $(PACKAGE_BUGREPORT)"; \
+ test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
+ dashes="$$report"; \
+ fi; \
+ dashes=`echo "$$dashes" | sed s/./=/g`; \
+ echo "$$dashes"; \
+ echo "$$banner"; \
+ test -z "$$skipped" || echo "$$skipped"; \
+ test -z "$$report" || echo "$$report"; \
+ echo "$$dashes"; \
+ test "$$failed" -eq 0; \
+ else :; fi
+
+distdir: $(DISTFILES)
+ $(am__remove_distdir)
+ test -d $(distdir) || mkdir $(distdir)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ distdir=`$(am__cd) $(distdir) && pwd`; \
+ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$top_distdir" \
+ distdir="$$distdir/$$subdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+ -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
+ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
+ || chmod -R a+r $(distdir)
+dist-gzip: distdir
+ tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+ $(am__remove_distdir)
+
+dist-bzip2: distdir
+ tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
+ $(am__remove_distdir)
+
+dist-lzma: distdir
+ tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
+ $(am__remove_distdir)
+
+dist-tarZ: distdir
+ tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
+ $(am__remove_distdir)
+
+dist-shar: distdir
+ shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+ $(am__remove_distdir)
+
+dist-zip: distdir
+ -rm -f $(distdir).zip
+ zip -rq $(distdir).zip $(distdir)
+ $(am__remove_distdir)
+
+dist dist-all: distdir
+ tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+ $(am__remove_distdir)
+
+# This target untars the dist file and tries a VPATH configuration. Then
+# it guarantees that the distribution is self-contained by making another
+# tarfile.
+distcheck: dist
+ case '$(DIST_ARCHIVES)' in \
+ *.tar.gz*) \
+ GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
+ *.tar.bz2*) \
+ bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
+ *.tar.lzma*) \
+ unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\
+ *.tar.Z*) \
+ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
+ *.shar.gz*) \
+ GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
+ *.zip*) \
+ unzip $(distdir).zip ;;\
+ esac
+ chmod -R a-w $(distdir); chmod a+w $(distdir)
+ mkdir $(distdir)/_build
+ mkdir $(distdir)/_inst
+ chmod a-w $(distdir)
+ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
+ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
+ && cd $(distdir)/_build \
+ && ../configure --srcdir=.. --prefix="$$dc_install_base" \
+ $(DISTCHECK_CONFIGURE_FLAGS) \
+ && $(MAKE) $(AM_MAKEFLAGS) \
+ && $(MAKE) $(AM_MAKEFLAGS) dvi \
+ && $(MAKE) $(AM_MAKEFLAGS) check \
+ && $(MAKE) $(AM_MAKEFLAGS) install \
+ && $(MAKE) $(AM_MAKEFLAGS) installcheck \
+ && $(MAKE) $(AM_MAKEFLAGS) uninstall \
+ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
+ distuninstallcheck \
+ && chmod -R a-w "$$dc_install_base" \
+ && ({ \
+ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
+ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
+ } || { rm -rf "$$dc_destdir"; exit 1; }) \
+ && rm -rf "$$dc_destdir" \
+ && $(MAKE) $(AM_MAKEFLAGS) dist \
+ && rm -rf $(DIST_ARCHIVES) \
+ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck
+ $(am__remove_distdir)
+ @(echo "$(distdir) archives ready for distribution: "; \
+ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
+ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
+distuninstallcheck:
+ @cd $(distuninstallcheck_dir) \
+ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
+ || { echo "ERROR: files left after uninstall:" ; \
+ if test -n "$(DESTDIR)"; then \
+ echo " (check DESTDIR support)"; \
+ fi ; \
+ $(distuninstallcheck_listfiles) ; \
+ exit 1; } >&2
+distcleancheck: distclean
+ @if test '$(srcdir)' = . ; then \
+ echo "ERROR: distcleancheck can only run from a VPATH build" ; \
+ exit 1 ; \
+ fi
+ @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
+ || { echo "ERROR: files left in build directory after distclean:" ; \
+ $(distcleancheck_listfiles) ; \
+ exit 1; } >&2
+check-am: all-am
+ $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
+ $(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) check-recursive
+all-am: Makefile $(LIBRARIES) $(PROGRAMS) $(MANS) $(HEADERS) config.h \
+ all-local
+installdirs: installdirs-recursive
+installdirs-am:
+ for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man7dir)" "$(DESTDIR)$(includedir)" "$(DESTDIR)$(modincludedir)" "$(DESTDIR)$(includedir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+ -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
+clean: clean-recursive
+
+clean-am: clean-binPROGRAMS clean-checkPROGRAMS clean-generic \
+ clean-libLIBRARIES clean-noinstPROGRAMS mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-hdr distclean-local distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am: install-includeHEADERS install-man \
+ install-modincludeHEADERS install-nodist_includeHEADERS
+
+install-dvi: install-dvi-recursive
+
+install-exec-am: install-binPROGRAMS install-libLIBRARIES
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) install-exec-hook
+
+install-html: install-html-recursive
+
+install-info: install-info-recursive
+
+install-man: install-man1 install-man7
+
+install-pdf: install-pdf-recursive
+
+install-ps: install-ps-recursive
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+ -rm -rf $(top_srcdir)/autom4te.cache
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS uninstall-includeHEADERS \
+ uninstall-libLIBRARIES uninstall-man \
+ uninstall-modincludeHEADERS uninstall-nodist_includeHEADERS
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) uninstall-hook
+
+uninstall-man: uninstall-man1 uninstall-man7
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+ install-exec-am install-strip uninstall-am
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+ all all-am all-local am--refresh check check-TESTS check-am \
+ clean clean-binPROGRAMS clean-checkPROGRAMS clean-generic \
+ clean-libLIBRARIES clean-noinstPROGRAMS ctags ctags-recursive \
+ dist dist-all dist-bzip2 dist-gzip dist-lzma dist-shar \
+ dist-tarZ dist-zip distcheck distclean distclean-compile \
+ distclean-generic distclean-hdr distclean-local distclean-tags \
+ distcleancheck distdir distuninstallcheck dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-exec-hook install-html \
+ install-html-am install-includeHEADERS install-info \
+ install-info-am install-libLIBRARIES install-man install-man1 \
+ install-man7 install-modincludeHEADERS \
+ install-nodist_includeHEADERS install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs installdirs-am maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic pdf pdf-am ps ps-am tags tags-recursive \
+ uninstall uninstall-am uninstall-binPROGRAMS uninstall-hook \
+ uninstall-includeHEADERS uninstall-libLIBRARIES uninstall-man \
+ uninstall-man1 uninstall-man7 uninstall-modincludeHEADERS \
+ uninstall-nodist_includeHEADERS
+
+
+re2c-main.$(OBJEXT): tools/re2c/main.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/re2c/main.c || echo '$(srcdir)/'`tools/re2c/main.c
+
+re2c-code.$(OBJEXT): tools/re2c/code.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/re2c/code.c || echo '$(srcdir)/'`tools/re2c/code.c
+
+re2c-dfa.$(OBJEXT): tools/re2c/dfa.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/re2c/dfa.c || echo '$(srcdir)/'`tools/re2c/dfa.c
+
+re2c-parser.$(OBJEXT): tools/re2c/parser.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/re2c/parser.c || echo '$(srcdir)/'`tools/re2c/parser.c
+
+re2c-actions.$(OBJEXT): tools/re2c/actions.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/re2c/actions.c || echo '$(srcdir)/'`tools/re2c/actions.c
+
+re2c-scanner.$(OBJEXT): tools/re2c/scanner.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/re2c/scanner.c || echo '$(srcdir)/'`tools/re2c/scanner.c
+
+re2c-mbo_getopt.$(OBJEXT): tools/re2c/mbo_getopt.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/re2c/mbo_getopt.c || echo '$(srcdir)/'`tools/re2c/mbo_getopt.c
+
+re2c-substr.$(OBJEXT): tools/re2c/substr.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/re2c/substr.c || echo '$(srcdir)/'`tools/re2c/substr.c
+
+re2c-translate.$(OBJEXT): tools/re2c/translate.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/re2c/translate.c || echo '$(srcdir)/'`tools/re2c/translate.c
+
+genmacro.$(OBJEXT): tools/genmacro/genmacro.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/genmacro/genmacro.c || echo '$(srcdir)/'`tools/genmacro/genmacro.c
+.gperf.c: genperf$(EXEEXT)
+ $(top_builddir)/genperf$(EXEEXT) $< $@
+
+genperf.$(OBJEXT): tools/genperf/genperf.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/genperf/genperf.c || echo '$(srcdir)/'`tools/genperf/genperf.c
+
+gp-perfect.$(OBJEXT): tools/genperf/perfect.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/genperf/perfect.c || echo '$(srcdir)/'`tools/genperf/perfect.c
+
+gp-phash.$(OBJEXT): libyasm/phash.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f libyasm/phash.c || echo '$(srcdir)/'`libyasm/phash.c
+
+gp-xmalloc.$(OBJEXT): libyasm/xmalloc.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f libyasm/xmalloc.c || echo '$(srcdir)/'`libyasm/xmalloc.c
+
+gp-xstrdup.$(OBJEXT): libyasm/xstrdup.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f libyasm/xstrdup.c || echo '$(srcdir)/'`libyasm/xstrdup.c
+
+# Use Pyxelator to generate Pyrex function headers.
+#_yasm.pxi: ${HEADERS}
+# @rm -rf .tmp
+# @mkdir .tmp
+# $(PYTHON) $(srcdir)/tools/python-yasm/pyxelator/wrap_yasm.py \
+# "YASM_DIR=${srcdir}" "CPP=${CPP}" "CPPFLAGS=${CPPFLAGS}"
+# @rm -rf .tmp
+
+# Need to build a local copy of the main Pyrex input file to include _yasm.pxi
+# from the build directory. Also need to fixup the other .pxi include paths.
+#yasm.pyx: $(srcdir)/tools/python-yasm/yasm.pyx
+# sed -e 's,^include "\([^_]\),include "${srcdir}/tools/python-yasm/\1,' \
+# $(srcdir)/tools/python-yasm/yasm.pyx > $@
+
+# Actually run Pyrex
+#yasm_python.c: yasm.pyx _yasm.pxi $(PYBINDING_DEPS)
+# $(PYTHON) -c "from Pyrex.Compiler.Main import main; main(command_line=1)" \
+# -o $@ yasm.pyx
+
+# Now the Python build magic...
+#python-setup.txt: Makefile
+# echo "includes=${DEFS} ${DEFAULT_INCLUDES} ${INCLUDES} ${AM_CPPFLAGS} ${CPPFLAGS}" > python-setup.txt
+# echo "sources=${libyasm_a_SOURCES}" >> python-setup.txt
+# echo "srcdir=${srcdir}" >> python-setup.txt
+# echo "gcc=${GCC}" >> python-setup.txt
+
+#.python-build: python-setup.txt yasm_python.c ${libyasm_a_SOURCES}
+# $(PYTHON) `test -f tools/python-yasm/setup.py || echo '$(srcdir)/'`tools/python-yasm/setup.py build
+# touch .python-build
+#python-build: .python-build
+
+#python-install: .python-build
+# $(PYTHON) `test -f tools/python-yasm/setup.py || echo '$(srcdir)/'`tools/python-yasm/setup.py install "--install-lib=$(DESTDIR)$(pythondir)"
+
+#python-uninstall:
+# rm -f `$(PYTHON) -c "import sys;sys.path.insert(0, '${DESTDIR}${pythondir}'); import yasm; print yasm.__file__"`
+
+python-build:
+python-install:
+python-uninstall:
+
+modules/arch/x86/x86id.c: x86insn_nasm.c x86insn_gas.c x86insns.c
+
+x86insn_nasm.gperf x86insn_gas.gperf x86insns.c: $(srcdir)/modules/arch/x86/gen_x86_insn.py
+ $(PYTHON) $(srcdir)/modules/arch/x86/gen_x86_insn.py
+#x86insn_nasm.gperf: $(srcdir)/x86insn_nasm.gperf
+# @echo Python must be installed to regenerate x86 instructions files
+# cp $(srcdir)/x86insn_nasm.gperf $@
+#x86insn_gas.gperf: $(srcdir)/x86insn_gas.gperf
+# @echo Python must be installed to regenerate x86 instructions files
+# cp $(srcdir)/x86insn_gas.gperf $@
+
+# Use suffix rules for gperf files
+x86insn_nasm.c: x86insn_nasm.gperf genperf$(EXEEXT)
+x86insn_gas.c: x86insn_gas.gperf genperf$(EXEEXT)
+x86cpu.c: $(srcdir)/modules/arch/x86/x86cpu.gperf genperf$(EXEEXT)
+ $(top_builddir)/genperf$(EXEEXT) $(srcdir)/modules/arch/x86/x86cpu.gperf $@
+x86regtmod.c: $(srcdir)/modules/arch/x86/x86regtmod.gperf genperf$(EXEEXT)
+ $(top_builddir)/genperf$(EXEEXT) $(srcdir)/modules/arch/x86/x86regtmod.gperf $@
+
+lc3bid.c: $(srcdir)/modules/arch/lc3b/lc3bid.re re2c$(EXEEXT)
+ $(top_builddir)/re2c$(EXEEXT) -s -o $@ $(srcdir)/modules/arch/lc3b/lc3bid.re
+
+yasm_arch.7: modules/arch/yasm_arch.xml
+ $(XMLTO) -o $(top_builddir) man $(srcdir)/modules/arch/yasm_arch.xml
+
+#EXTRA_DIST += modules/listfmts/nasm/tests/Makefile.inc
+
+#include modules/listfmts/nasm/tests/Makefile.inc
+
+gas-token.c: $(srcdir)/modules/parsers/gas/gas-token.re re2c$(EXEEXT)
+ $(top_builddir)/re2c$(EXEEXT) -b -o $@ $(srcdir)/modules/parsers/gas/gas-token.re
+
+nasm-token.c: $(srcdir)/modules/parsers/nasm/nasm-token.re re2c$(EXEEXT)
+ $(top_builddir)/re2c$(EXEEXT) -b -o $@ $(srcdir)/modules/parsers/nasm/nasm-token.re
+
+$(top_srcdir)/modules/parsers/nasm/nasm-parser.c: nasm-macros.c
+
+nasm-macros.c: $(srcdir)/modules/parsers/nasm/nasm-std.mac genmacro$(EXEEXT)
+ $(top_builddir)/genmacro$(EXEEXT) $@ nasm_standard_mac $(srcdir)/modules/parsers/nasm/nasm-std.mac
+
+yasm_parsers.7: modules/parsers/yasm_parsers.xml
+ $(XMLTO) -o $(top_builddir) man $(srcdir)/modules/parsers/yasm_parsers.xml
+
+$(top_srcdir)/modules/preprocs/nasm/nasm-preproc.c: nasm-version.c
+
+nasm-version.c: version.mac genmacro$(EXEEXT)
+ $(top_builddir)/genmacro$(EXEEXT) $@ nasm_version_mac version.mac
+
+version.mac: genversion$(EXEEXT)
+ $(top_builddir)/genversion$(EXEEXT) $@
+
+genversion.$(OBJEXT): modules/preprocs/nasm/genversion.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f modules/preprocs/nasm/genversion.c || echo '$(srcdir)/'`modules/preprocs/nasm/genversion.c
+
+#EXTRA_DIST += modules/dbgfmts/codeview/tests/Makefile.inc
+#include modules/dbgfmts/codeview/tests/Makefile.inc
+
+yasm_dbgfmts.7: modules/dbgfmts/yasm_dbgfmts.xml
+ $(XMLTO) -o $(top_builddir) man $(srcdir)/modules/dbgfmts/yasm_dbgfmts.xml
+
+$(top_srcdir)/modules/objfmts/coff/coff-objfmt.c: win64-nasm.c win64-gas.c
+
+win64-nasm.c: $(srcdir)/modules/objfmts/coff/win64-nasm.mac genmacro$(EXEEXT)
+ $(top_builddir)/genmacro$(EXEEXT) $@ win64_nasm_stdmac $(srcdir)/modules/objfmts/coff/win64-nasm.mac
+
+win64-gas.c: $(srcdir)/modules/objfmts/coff/win64-gas.mac genmacro$(EXEEXT)
+ $(top_builddir)/genmacro$(EXEEXT) $@ win64_gas_stdmac $(srcdir)/modules/objfmts/coff/win64-gas.mac
+
+yasm_objfmts.7: modules/objfmts/yasm_objfmts.xml
+ $(XMLTO) -o $(top_builddir) man $(srcdir)/modules/objfmts/yasm_objfmts.xml
+
+module.c: $(top_srcdir)/libyasm/module.in genmodule$(EXEEXT) Makefile
+ $(top_builddir)/genmodule$(EXEEXT) $(top_srcdir)/libyasm/module.in Makefile
+
+genmodule.$(OBJEXT): libyasm/genmodule.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f libyasm/genmodule.c || echo '$(srcdir)/'`libyasm/genmodule.c
+
+yasm.1: frontends/yasm/yasm.xml
+ $(XMLTO) -o $(top_builddir) man $(srcdir)/frontends/yasm/yasm.xml
+
+$(srcdir)/frontends/yasm/yasm.c: license.c
+
+license.c: $(srcdir)/COPYING genstring$(EXEEXT)
+ $(top_builddir)/genstring$(EXEEXT) license_msg $@ $(srcdir)/COPYING
+
+distclean-local:
+ -rm -rf results
+ -rm -rf build
+
+all-local: python-build
+install-exec-hook: python-install
+uninstall-hook: python-uninstall
+
+genstring.$(OBJEXT): genstring.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f genstring.c || echo '$(srcdir)/'`genstring.c
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/chromium/third_party/pdfium/third_party/yasm/source/config/android/config.h b/chromium/third_party/pdfium/third_party/yasm/source/config/android/config.h
new file mode 100644
index 00000000000..35a50b74b0d
--- /dev/null
+++ b/chromium/third_party/pdfium/third_party/yasm/source/config/android/config.h
@@ -0,0 +1,173 @@
+/* config.h. Generated from config.h.in by configure. */
+/* config.h.in. Generated from configure.ac by autoheader. */
+
+/* Command name to run C preprocessor */
+#define CPP_PROG "gcc -E"
+
+/* */
+/* #undef ENABLE_NLS */
+
+/* Define to 1 if you have the `abort' function. */
+#define HAVE_ABORT 1
+
+/* */
+/* #undef HAVE_CATGETS */
+
+/* Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the
+ CoreFoundation framework. */
+/* #undef HAVE_CFLOCALECOPYCURRENT */
+
+/* Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in
+ the CoreFoundation framework. */
+/* #undef HAVE_CFPREFERENCESCOPYAPPVALUE */
+
+/* Define if the GNU dcgettext() function is already present or preinstalled.
+ */
+#define HAVE_DCGETTEXT 1
+
+/* Define to 1 if you have the <direct.h> header file. */
+/* #undef HAVE_DIRECT_H */
+
+/* Define to 1 if you have the `ftruncate' function. */
+#define HAVE_FTRUNCATE 1
+
+/* Define to 1 if you have the `getcwd' function. */
+#define HAVE_GETCWD 1
+
+/* */
+#define HAVE_GETTEXT 1
+
+/* Define to 1 if you have the GNU C Library */
+#define HAVE_GNU_C_LIBRARY 1
+
+/* Define if you have the iconv() function and it works. */
+/* #undef HAVE_ICONV */
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* */
+/* #undef HAVE_LC_MESSAGES */
+
+/* Define to 1 if you have the <libgen.h> header file. */
+#define HAVE_LIBGEN_H 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the `mergesort' function. */
+/* #undef HAVE_MERGESORT */
+
+/* Define to 1 if you have the `popen' function. */
+#define HAVE_POPEN 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* */
+/* #undef HAVE_STPCPY */
+
+/* Define to 1 if you have the `strcasecmp' function. */
+#define HAVE_STRCASECMP 1
+
+/* Define to 1 if you have the `strcmpi' function. */
+/* #undef HAVE_STRCMPI */
+
+/* Define to 1 if you have the `stricmp' function. */
+/* #undef HAVE_STRICMP */
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the `strncasecmp' function. */
+#define HAVE_STRNCASECMP 1
+
+/* Define to 1 if you have the `strsep' function. */
+#define HAVE_STRSEP 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the `toascii' function. */
+#define HAVE_TOASCII 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define to 1 if you have the `vsnprintf' function. */
+#define HAVE_VSNPRINTF 1
+
+/* Define to 1 if you have the `_stricmp' function. */
+/* #undef HAVE__STRICMP */
+
+/* Name of package */
+#define PACKAGE "yasm"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "bug-yasm@tortall.net"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "yasm"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "yasm 1.2.0"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "yasm"
+
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "1.2.0"
+
+/* Define to 1 if the C compiler supports function prototypes. */
+#define PROTOTYPES 1
+
+/* The size of `char', as computed by sizeof. */
+/* #undef SIZEOF_CHAR */
+
+/* The size of `int', as computed by sizeof. */
+/* #undef SIZEOF_INT */
+
+/* The size of `long', as computed by sizeof. */
+/* #undef SIZEOF_LONG */
+
+/* The size of `short', as computed by sizeof. */
+/* #undef SIZEOF_SHORT */
+
+/* The size of `void*', as computed by sizeof. */
+/* #undef SIZEOF_VOIDP */
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Version number of package */
+#define VERSION "1.2.0"
+
+/* Define if using the dmalloc debugging malloc package */
+/* #undef WITH_DMALLOC */
+
+/* Define like PROTOTYPES; this can be used by system headers. */
+#define __PROTOTYPES 1
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef const */
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+ calls it, or to nothing if 'inline' is not supported under any name. */
+#ifndef __cplusplus
+/* #undef inline */
+#endif
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+/* #undef size_t */
diff --git a/chromium/third_party/pdfium/third_party/yasm/source/config/android/libyasm-stdint.h b/chromium/third_party/pdfium/third_party/yasm/source/config/android/libyasm-stdint.h
new file mode 100644
index 00000000000..357610e1c11
--- /dev/null
+++ b/chromium/third_party/pdfium/third_party/yasm/source/config/android/libyasm-stdint.h
@@ -0,0 +1,9 @@
+#ifndef _YASM_LIBYASM_STDINT_H
+#define _YASM_LIBYASM_STDINT_H 1
+#ifndef _GENERATED_STDINT_H
+#define _GENERATED_STDINT_H "yasm HEAD"
+/* generated using gcc -std=gnu99 */
+#define _STDINT_HAVE_STDINT_H 1
+#include <stdint.h>
+#endif
+#endif
diff --git a/chromium/third_party/pdfium/third_party/yasm/source/config/ios/Makefile b/chromium/third_party/pdfium/third_party/yasm/source/config/ios/Makefile
new file mode 100644
index 00000000000..770352550d7
--- /dev/null
+++ b/chromium/third_party/pdfium/third_party/yasm/source/config/ios/Makefile
@@ -0,0 +1,3822 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# Makefile. Generated from Makefile.in by configure.
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+
+
+# $Id: Makefile.am 2184 2009-03-24 05:04:15Z peter $
+
+# $Id: Makefile.inc 2084 2008-05-09 07:08:17Z peter $
+
+# $Id: Makefile.inc 1718 2006-12-24 00:13:19Z peter $
+
+# These utility programs have to be built for BUILD host in cross-build.
+# This makes things rather non-standard automake
+
+# $Id: Makefile.inc 2084 2008-05-09 07:08:17Z peter $
+
+# These utility programs have to be built for BUILD host in cross-build.
+# This makes things rather non-standard automake
+
+# $Id: Makefile.inc 1939 2007-09-10 07:15:50Z peter $
+
+# These utility programs have to be built for BUILD host in cross-build.
+# This makes things rather non-standard automake
+
+# $Id: Makefile.inc 1948 2007-09-13 02:53:30Z peter $
+
+# $Id: Makefile.inc 1951 2007-09-14 05:19:10Z peter $
+
+# $Id: Makefile.inc 1598 2006-08-10 04:02:59Z peter $
+
+# $Id: Makefile.inc 1914 2007-08-20 05:13:35Z peter $
+
+# $Id: Makefile.inc 2111 2008-07-06 22:26:49Z peter $
+
+# $Id: Makefile.inc 2170 2009-01-14 08:28:13Z peter $
+
+# $Id: Makefile.inc 2193 2009-04-04 23:03:41Z peter $
+
+# $Id: Makefile.inc 1776 2007-02-19 02:36:10Z peter $
+
+# $Id: Makefile.inc 2111 2008-07-06 22:26:49Z peter $
+
+# $Id: Makefile.inc 1928 2007-09-07 22:03:34Z peter $
+
+# $Id: Makefile.inc 1152 2004-10-02 06:18:30Z peter $
+
+# $Id: Makefile.inc 1183 2004-12-01 07:49:18Z peter $
+
+# $Id: Makefile.inc 2130 2008-10-07 05:38:11Z peter $
+
+# $Id: Makefile.inc 1783 2007-02-22 03:40:31Z peter $
+
+# $Id: Makefile.inc 2169 2009-01-02 20:46:57Z peter $
+
+# $Id$
+
+# $Id: Makefile.inc 2130 2008-10-07 05:38:11Z peter $
+
+# $Id: Makefile.inc 2191 2009-03-25 03:42:05Z peter $
+
+# $Id: Makefile.inc 1137 2004-09-04 01:24:57Z peter $
+
+# $Id: Makefile.inc 2082 2008-05-09 06:46:02Z peter $
+
+# $Id: Makefile.inc 2063 2008-04-12 08:30:22Z peter $
+
+# $Id: Makefile.inc 2063 2008-04-12 08:30:22Z peter $
+
+# $Id: Makefile.inc 1966 2007-09-20 03:54:36Z peter $
+
+# $Id: Makefile.inc 2130 2008-10-07 05:38:11Z peter $
+
+# $Id: Makefile.inc 2185 2009-03-24 06:33:32Z peter $
+
+# $Id: Makefile.inc 2172 2009-01-27 06:38:14Z peter $
+
+# $Id: Makefile.inc 2176 2009-03-04 07:39:02Z peter $
+
+# Makefile for cpp module.
+# Copied from raw preprocessor module.
+
+# $Id: Makefile.inc 1662 2006-10-21 18:52:29Z peter $
+
+# $Id: Makefile.inc 1428 2006-03-27 02:15:19Z peter $
+
+# $Id: Makefile.inc 1378 2006-02-12 01:27:39Z peter $
+
+# $Id: Makefile.inc 1350 2006-01-29 21:11:03Z peter $
+
+# $Id: Makefile.inc 1851 2007-05-26 17:56:36Z peter $
+
+# $Id: Makefile.inc 1617 2006-09-16 05:43:41Z peter $
+
+# $Id: Makefile.inc 1350 2006-01-29 21:11:03Z peter $
+
+# $Id: Makefile.inc 1183 2004-12-01 07:49:18Z peter $
+
+# $Id: Makefile.inc 1183 2004-12-01 07:49:18Z peter $
+
+# $Id$
+
+# $Id: Makefile.inc 1732 2007-01-13 19:34:04Z peter $
+
+# $Id: Makefile.inc 1183 2004-12-01 07:49:18Z peter $
+
+# $Id: Makefile.inc 2130 2008-10-07 05:38:11Z peter $
+
+# $Id: Makefile.inc 2010 2007-11-14 08:33:32Z peter $
+
+# $Id: Makefile.inc 2010 2007-11-14 08:33:32Z peter $
+
+# $Id: Makefile.inc 1252 2005-09-28 05:50:51Z peter $
+
+# $Id: Makefile.inc 2036 2008-02-09 04:06:47Z peter $
+
+# $Id: Makefile.inc 2126 2008-10-03 08:13:00Z peter $
+
+# $Id: Makefile.inc 2036 2008-02-09 04:06:47Z peter $
+
+# $Id: Makefile.inc 1168 2004-10-31 01:07:52Z peter $
+
+# $Id: Makefile.inc 2082 2008-05-09 06:46:02Z peter $
+
+# $Id: Makefile.inc 1617 2006-09-16 05:43:41Z peter $
+
+# $Id: Makefile.inc 1732 2007-01-13 19:34:04Z peter $
+
+# $Id: Makefile.inc 1777 2007-02-19 08:21:17Z peter $
+
+# $Id: Makefile.inc 1782 2007-02-21 06:45:39Z peter $
+
+# $Id: Makefile.inc 2108 2008-06-05 08:48:21Z peter $
+
+# $Id: Makefile.inc 1854 2007-05-31 06:16:49Z peter $
+
+# $Id: Makefile.inc 2108 2008-06-05 08:48:21Z peter $
+
+# $Id: Makefile.inc 1653 2006-10-17 06:58:41Z peter $
+
+# $Id: Makefile.inc 1653 2006-10-17 06:58:41Z peter $
+
+# $Id: Makefile.inc 1183 2004-12-01 07:49:18Z peter $
+
+# Assume objfmt_coff is included
+
+# $Id: Makefile.inc 2166 2009-01-02 08:33:21Z peter $
+
+# $Id: Makefile.inc 2166 2009-01-02 08:33:21Z peter $
+
+# $Id: Makefile.inc 1331 2006-01-15 22:48:55Z peter $
+
+# Assume objfmt_coff is included
+
+# $Id: Makefile.inc 2120 2008-09-04 04:45:30Z peter $
+
+# $Id: Makefile.inc 2082 2008-05-09 06:46:02Z peter $
+
+# $Id: Makefile.inc 1183 2004-12-01 07:49:18Z peter $
+
+# $Id: Makefile.inc 1851 2007-05-26 17:56:36Z peter $
+
+# $Id: Makefile.inc 2111 2008-07-06 22:26:49Z peter $
+
+# $Id: Makefile.inc 2123 2008-09-30 03:56:37Z peter $
+
+# $Id: Makefile.inc 2130 2008-10-07 05:38:11Z peter $
+
+# $Id: Makefile.inc 1463 2006-04-05 05:39:23Z peter $
+
+# $Id: Makefile.inc 1463 2006-04-05 05:39:23Z peter $
+
+
+
+VPATH = /workspace/ajwong/git-chrome/src/third_party/yasm/source/patched-yasm
+pkgdatadir = $(datadir)/yasm
+pkglibdir = $(libdir)/yasm
+pkgincludedir = $(includedir)/yasm
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = i686-apple-darwin9.8.0
+host_triplet = i686-apple-darwin9.8.0
+bin_PROGRAMS = yasm$(EXEEXT) ytasm$(EXEEXT)
+TESTS = $(am__append_3) modules/arch/x86/tests/x86_test.sh \
+ modules/arch/x86/tests/gas32/x86_gas32_test.sh \
+ modules/arch/x86/tests/gas64/x86_gas64_test.sh \
+ modules/arch/lc3b/tests/lc3b_test.sh \
+ modules/parsers/gas/tests/gas_test.sh \
+ modules/parsers/gas/tests/bin/gas_bin_test.sh \
+ modules/parsers/nasm/tests/nasm_test.sh \
+ modules/parsers/nasm/tests/worphan/nasm_worphan_test.sh \
+ modules/parsers/tasm/tests/tasm_test.sh \
+ modules/parsers/tasm/tests/exe/tasm_exe_test.sh \
+ modules/preprocs/nasm/tests/nasmpp_test.sh \
+ modules/preprocs/raw/tests/rawpp_test.sh \
+ modules/dbgfmts/dwarf2/tests/pass32/dwarf2_pass32_test.sh \
+ modules/dbgfmts/dwarf2/tests/pass64/dwarf2_pass64_test.sh \
+ modules/dbgfmts/dwarf2/tests/passwin64/dwarf2_passwin64_test.sh \
+ modules/dbgfmts/stabs/tests/stabs_test.sh \
+ modules/objfmts/bin/tests/bin_test.sh \
+ modules/objfmts/bin/tests/multisect/bin_multi_test.sh \
+ modules/objfmts/elf/tests/elf_test.sh \
+ modules/objfmts/elf/tests/amd64/elf_amd64_test.sh \
+ modules/objfmts/elf/tests/gas32/elf_gas32_test.sh \
+ modules/objfmts/elf/tests/gas64/elf_gas64_test.sh \
+ modules/objfmts/coff/tests/coff_test.sh \
+ modules/objfmts/macho/tests/gas32/gas_macho32_test.sh \
+ modules/objfmts/macho/tests/gas64/gas_macho64_test.sh \
+ modules/objfmts/macho/tests/nasm32/macho32_test.sh \
+ modules/objfmts/macho/tests/nasm64/macho64_test.sh \
+ modules/objfmts/rdf/tests/rdf_test.sh \
+ modules/objfmts/win32/tests/win32_test.sh \
+ modules/objfmts/win32/tests/gas/win32_gas_test.sh \
+ modules/objfmts/win64/tests/win64_test.sh \
+ modules/objfmts/win64/tests/gas/win64_gas_test.sh \
+ modules/objfmts/xdf/tests/xdf_test.sh bitvect_test$(EXEEXT) \
+ floatnum_test$(EXEEXT) leb128_test$(EXEEXT) \
+ splitpath_test$(EXEEXT) combpath_test$(EXEEXT) \
+ uncstring_test$(EXEEXT) libyasm/tests/libyasm_test.sh
+noinst_PROGRAMS = genstring$(EXEEXT) re2c$(EXEEXT) genmacro$(EXEEXT) \
+ genperf$(EXEEXT) genversion$(EXEEXT) genmodule$(EXEEXT)
+check_PROGRAMS = test_hd$(EXEEXT) bitvect_test$(EXEEXT) \
+ floatnum_test$(EXEEXT) leb128_test$(EXEEXT) \
+ splitpath_test$(EXEEXT) combpath_test$(EXEEXT) \
+ uncstring_test$(EXEEXT)
+DIST_COMMON = README $(am__configure_deps) $(dist_man_MANS) \
+ $(include_HEADERS) $(modinclude_HEADERS) $(noinst_HEADERS) \
+ $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(srcdir)/config.h.in $(srcdir)/frontends/Makefile.inc \
+ $(srcdir)/frontends/tasm/Makefile.inc \
+ $(srcdir)/frontends/yasm/Makefile.inc \
+ $(srcdir)/libyasm/Makefile.inc \
+ $(srcdir)/libyasm/tests/Makefile.inc $(srcdir)/m4/Makefile.inc \
+ $(srcdir)/modules/Makefile.inc \
+ $(srcdir)/modules/arch/Makefile.inc \
+ $(srcdir)/modules/arch/lc3b/Makefile.inc \
+ $(srcdir)/modules/arch/lc3b/tests/Makefile.inc \
+ $(srcdir)/modules/arch/x86/Makefile.inc \
+ $(srcdir)/modules/arch/x86/tests/Makefile.inc \
+ $(srcdir)/modules/arch/x86/tests/gas32/Makefile.inc \
+ $(srcdir)/modules/arch/x86/tests/gas64/Makefile.inc \
+ $(srcdir)/modules/dbgfmts/Makefile.inc \
+ $(srcdir)/modules/dbgfmts/codeview/Makefile.inc \
+ $(srcdir)/modules/dbgfmts/dwarf2/Makefile.inc \
+ $(srcdir)/modules/dbgfmts/dwarf2/tests/Makefile.inc \
+ $(srcdir)/modules/dbgfmts/dwarf2/tests/pass32/Makefile.inc \
+ $(srcdir)/modules/dbgfmts/dwarf2/tests/pass64/Makefile.inc \
+ $(srcdir)/modules/dbgfmts/dwarf2/tests/passwin64/Makefile.inc \
+ $(srcdir)/modules/dbgfmts/null/Makefile.inc \
+ $(srcdir)/modules/dbgfmts/stabs/Makefile.inc \
+ $(srcdir)/modules/dbgfmts/stabs/tests/Makefile.inc \
+ $(srcdir)/modules/listfmts/Makefile.inc \
+ $(srcdir)/modules/listfmts/nasm/Makefile.inc \
+ $(srcdir)/modules/objfmts/Makefile.inc \
+ $(srcdir)/modules/objfmts/bin/Makefile.inc \
+ $(srcdir)/modules/objfmts/bin/tests/Makefile.inc \
+ $(srcdir)/modules/objfmts/bin/tests/multisect/Makefile.inc \
+ $(srcdir)/modules/objfmts/coff/Makefile.inc \
+ $(srcdir)/modules/objfmts/coff/tests/Makefile.inc \
+ $(srcdir)/modules/objfmts/dbg/Makefile.inc \
+ $(srcdir)/modules/objfmts/elf/Makefile.inc \
+ $(srcdir)/modules/objfmts/elf/tests/Makefile.inc \
+ $(srcdir)/modules/objfmts/elf/tests/amd64/Makefile.inc \
+ $(srcdir)/modules/objfmts/elf/tests/gas32/Makefile.inc \
+ $(srcdir)/modules/objfmts/elf/tests/gas64/Makefile.inc \
+ $(srcdir)/modules/objfmts/macho/Makefile.inc \
+ $(srcdir)/modules/objfmts/macho/tests/Makefile.inc \
+ $(srcdir)/modules/objfmts/macho/tests/gas32/Makefile.inc \
+ $(srcdir)/modules/objfmts/macho/tests/gas64/Makefile.inc \
+ $(srcdir)/modules/objfmts/macho/tests/nasm32/Makefile.inc \
+ $(srcdir)/modules/objfmts/macho/tests/nasm64/Makefile.inc \
+ $(srcdir)/modules/objfmts/rdf/Makefile.inc \
+ $(srcdir)/modules/objfmts/rdf/tests/Makefile.inc \
+ $(srcdir)/modules/objfmts/win32/Makefile.inc \
+ $(srcdir)/modules/objfmts/win32/tests/Makefile.inc \
+ $(srcdir)/modules/objfmts/win32/tests/gas/Makefile.inc \
+ $(srcdir)/modules/objfmts/win64/Makefile.inc \
+ $(srcdir)/modules/objfmts/win64/tests/Makefile.inc \
+ $(srcdir)/modules/objfmts/win64/tests/gas/Makefile.inc \
+ $(srcdir)/modules/objfmts/xdf/Makefile.inc \
+ $(srcdir)/modules/objfmts/xdf/tests/Makefile.inc \
+ $(srcdir)/modules/parsers/Makefile.inc \
+ $(srcdir)/modules/parsers/gas/Makefile.inc \
+ $(srcdir)/modules/parsers/gas/tests/Makefile.inc \
+ $(srcdir)/modules/parsers/gas/tests/bin/Makefile.inc \
+ $(srcdir)/modules/parsers/nasm/Makefile.inc \
+ $(srcdir)/modules/parsers/nasm/tests/Makefile.inc \
+ $(srcdir)/modules/parsers/nasm/tests/worphan/Makefile.inc \
+ $(srcdir)/modules/parsers/tasm/Makefile.inc \
+ $(srcdir)/modules/parsers/tasm/tests/Makefile.inc \
+ $(srcdir)/modules/parsers/tasm/tests/exe/Makefile.inc \
+ $(srcdir)/modules/preprocs/Makefile.inc \
+ $(srcdir)/modules/preprocs/cpp/Makefile.inc \
+ $(srcdir)/modules/preprocs/nasm/Makefile.inc \
+ $(srcdir)/modules/preprocs/nasm/tests/Makefile.inc \
+ $(srcdir)/modules/preprocs/raw/Makefile.inc \
+ $(srcdir)/modules/preprocs/raw/tests/Makefile.inc \
+ $(srcdir)/tools/Makefile.inc \
+ $(srcdir)/tools/genmacro/Makefile.inc \
+ $(srcdir)/tools/genperf/Makefile.inc \
+ $(srcdir)/tools/python-yasm/Makefile.inc \
+ $(srcdir)/tools/python-yasm/tests/Makefile.inc \
+ $(srcdir)/tools/re2c/Makefile.inc $(top_srcdir)/configure \
+ ABOUT-NLS AUTHORS COPYING ChangeLog INSTALL NEWS \
+ config/config.guess config/config.rpath config/config.sub \
+ config/depcomp config/install-sh config/ltmain.sh \
+ config/missing
+#am__append_1 = _yasm.pxi yasm.pyx \
+# yasm_python.c python-setup.txt \
+# .python-build
+#am__append_2 = PYTHON=${PYTHON}
+#am__append_3 = tools/python-yasm/tests/python_test.sh
+#am__append_4 = $(dist_man_MANS)
+subdir = .
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/ax_create_stdint_h.m4 \
+ $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/iconv.m4 \
+ $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
+ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/nls.m4 \
+ $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \
+ $(top_srcdir)/m4/pyrex.m4 $(top_srcdir)/m4/pythonhead.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
+ configure.lineno config.status.lineno
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = config.h
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \
+ "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man7dir)" \
+ "$(DESTDIR)$(includedir)" "$(DESTDIR)$(modincludedir)" \
+ "$(DESTDIR)$(includedir)"
+libLIBRARIES_INSTALL = $(INSTALL_DATA)
+LIBRARIES = $(lib_LIBRARIES)
+AR = ar
+ARFLAGS = cru
+libyasm_a_AR = $(AR) $(ARFLAGS)
+libyasm_a_LIBADD =
+am_libyasm_a_OBJECTS = x86arch.$(OBJEXT) x86bc.$(OBJEXT) \
+ x86expr.$(OBJEXT) x86id.$(OBJEXT) lc3barch.$(OBJEXT) \
+ lc3bbc.$(OBJEXT) nasm-listfmt.$(OBJEXT) gas-parser.$(OBJEXT) \
+ gas-parse.$(OBJEXT) nasm-parser.$(OBJEXT) nasm-parse.$(OBJEXT) \
+ nasm-preproc.$(OBJEXT) nasm-pp.$(OBJEXT) nasmlib.$(OBJEXT) \
+ nasm-eval.$(OBJEXT) raw-preproc.$(OBJEXT) \
+ cpp-preproc.$(OBJEXT) cv-dbgfmt.$(OBJEXT) cv-symline.$(OBJEXT) \
+ cv-type.$(OBJEXT) dwarf2-dbgfmt.$(OBJEXT) \
+ dwarf2-line.$(OBJEXT) dwarf2-aranges.$(OBJEXT) \
+ dwarf2-info.$(OBJEXT) null-dbgfmt.$(OBJEXT) \
+ stabs-dbgfmt.$(OBJEXT) dbg-objfmt.$(OBJEXT) \
+ bin-objfmt.$(OBJEXT) elf.$(OBJEXT) elf-objfmt.$(OBJEXT) \
+ elf-x86-x86.$(OBJEXT) elf-x86-amd64.$(OBJEXT) \
+ coff-objfmt.$(OBJEXT) win64-except.$(OBJEXT) \
+ macho-objfmt.$(OBJEXT) rdf-objfmt.$(OBJEXT) \
+ xdf-objfmt.$(OBJEXT) assocdat.$(OBJEXT) bitvect.$(OBJEXT) \
+ bc-align.$(OBJEXT) bc-data.$(OBJEXT) bc-incbin.$(OBJEXT) \
+ bc-org.$(OBJEXT) bc-reserve.$(OBJEXT) bytecode.$(OBJEXT) \
+ errwarn.$(OBJEXT) expr.$(OBJEXT) file.$(OBJEXT) \
+ floatnum.$(OBJEXT) hamt.$(OBJEXT) insn.$(OBJEXT) \
+ intnum.$(OBJEXT) inttree.$(OBJEXT) linemap.$(OBJEXT) \
+ md5.$(OBJEXT) mergesort.$(OBJEXT) phash.$(OBJEXT) \
+ section.$(OBJEXT) strcasecmp.$(OBJEXT) strsep.$(OBJEXT) \
+ symrec.$(OBJEXT) valparam.$(OBJEXT) value.$(OBJEXT) \
+ xmalloc.$(OBJEXT) xstrdup.$(OBJEXT)
+nodist_libyasm_a_OBJECTS = x86cpu.$(OBJEXT) x86regtmod.$(OBJEXT) \
+ lc3bid.$(OBJEXT) gas-token.$(OBJEXT) nasm-token.$(OBJEXT) \
+ module.$(OBJEXT)
+libyasm_a_OBJECTS = $(am_libyasm_a_OBJECTS) \
+ $(nodist_libyasm_a_OBJECTS)
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS)
+am_bitvect_test_OBJECTS = bitvect_test.$(OBJEXT)
+bitvect_test_OBJECTS = $(am_bitvect_test_OBJECTS)
+am__DEPENDENCIES_1 =
+bitvect_test_DEPENDENCIES = libyasm.a $(am__DEPENDENCIES_1)
+am_combpath_test_OBJECTS = combpath_test.$(OBJEXT)
+combpath_test_OBJECTS = $(am_combpath_test_OBJECTS)
+combpath_test_DEPENDENCIES = libyasm.a $(am__DEPENDENCIES_1)
+am_floatnum_test_OBJECTS = floatnum_test.$(OBJEXT)
+floatnum_test_OBJECTS = $(am_floatnum_test_OBJECTS)
+floatnum_test_DEPENDENCIES = libyasm.a $(am__DEPENDENCIES_1)
+am_genmacro_OBJECTS =
+genmacro_OBJECTS = $(am_genmacro_OBJECTS)
+genmacro_DEPENDENCIES = genmacro.$(OBJEXT)
+am_genmodule_OBJECTS =
+genmodule_OBJECTS = $(am_genmodule_OBJECTS)
+genmodule_DEPENDENCIES = genmodule.$(OBJEXT)
+am_genperf_OBJECTS =
+genperf_OBJECTS = $(am_genperf_OBJECTS)
+genperf_DEPENDENCIES = genperf.$(OBJEXT) gp-perfect.$(OBJEXT) \
+ gp-phash.$(OBJEXT) gp-xmalloc.$(OBJEXT) gp-xstrdup.$(OBJEXT)
+am_genstring_OBJECTS =
+genstring_OBJECTS = $(am_genstring_OBJECTS)
+genstring_DEPENDENCIES = genstring.$(OBJEXT)
+am_genversion_OBJECTS =
+genversion_OBJECTS = $(am_genversion_OBJECTS)
+genversion_DEPENDENCIES = genversion.$(OBJEXT)
+am_leb128_test_OBJECTS = leb128_test.$(OBJEXT)
+leb128_test_OBJECTS = $(am_leb128_test_OBJECTS)
+leb128_test_DEPENDENCIES = libyasm.a $(am__DEPENDENCIES_1)
+am_re2c_OBJECTS =
+re2c_OBJECTS = $(am_re2c_OBJECTS)
+re2c_DEPENDENCIES = re2c-main.$(OBJEXT) re2c-code.$(OBJEXT) \
+ re2c-dfa.$(OBJEXT) re2c-parser.$(OBJEXT) \
+ re2c-actions.$(OBJEXT) re2c-scanner.$(OBJEXT) \
+ re2c-mbo_getopt.$(OBJEXT) re2c-substr.$(OBJEXT) \
+ re2c-translate.$(OBJEXT)
+am_splitpath_test_OBJECTS = splitpath_test.$(OBJEXT)
+splitpath_test_OBJECTS = $(am_splitpath_test_OBJECTS)
+splitpath_test_DEPENDENCIES = libyasm.a $(am__DEPENDENCIES_1)
+am_test_hd_OBJECTS = test_hd.$(OBJEXT)
+test_hd_OBJECTS = $(am_test_hd_OBJECTS)
+test_hd_LDADD = $(LDADD)
+am_uncstring_test_OBJECTS = uncstring_test.$(OBJEXT)
+uncstring_test_OBJECTS = $(am_uncstring_test_OBJECTS)
+uncstring_test_DEPENDENCIES = libyasm.a $(am__DEPENDENCIES_1)
+am_yasm_OBJECTS = yasm.$(OBJEXT) yasm-options.$(OBJEXT)
+yasm_OBJECTS = $(am_yasm_OBJECTS)
+yasm_DEPENDENCIES = libyasm.a $(am__DEPENDENCIES_1)
+am_ytasm_OBJECTS = tasm.$(OBJEXT) tasm-options.$(OBJEXT)
+ytasm_OBJECTS = $(am_ytasm_OBJECTS)
+ytasm_DEPENDENCIES = libyasm.a $(am__DEPENDENCIES_1)
+DEFAULT_INCLUDES = -I. -I$(srcdir)
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libyasm_a_SOURCES) $(nodist_libyasm_a_SOURCES) \
+ $(bitvect_test_SOURCES) $(combpath_test_SOURCES) \
+ $(floatnum_test_SOURCES) $(genmacro_SOURCES) \
+ $(genmodule_SOURCES) $(genperf_SOURCES) $(genstring_SOURCES) \
+ $(genversion_SOURCES) $(leb128_test_SOURCES) $(re2c_SOURCES) \
+ $(splitpath_test_SOURCES) $(test_hd_SOURCES) \
+ $(uncstring_test_SOURCES) $(yasm_SOURCES) $(ytasm_SOURCES)
+DIST_SOURCES = $(libyasm_a_SOURCES) $(bitvect_test_SOURCES) \
+ $(combpath_test_SOURCES) $(floatnum_test_SOURCES) \
+ $(genmacro_SOURCES) $(genmodule_SOURCES) $(genperf_SOURCES) \
+ $(genstring_SOURCES) $(genversion_SOURCES) \
+ $(leb128_test_SOURCES) $(re2c_SOURCES) \
+ $(splitpath_test_SOURCES) $(test_hd_SOURCES) \
+ $(uncstring_test_SOURCES) $(yasm_SOURCES) $(ytasm_SOURCES)
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-dvi-recursive install-exec-recursive \
+ install-html-recursive install-info-recursive \
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
+man1dir = $(mandir)/man1
+man7dir = $(mandir)/man7
+NROFF = nroff
+MANS = $(dist_man_MANS)
+includeHEADERS_INSTALL = $(INSTALL_HEADER)
+modincludeHEADERS_INSTALL = $(INSTALL_HEADER)
+nodist_includeHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(include_HEADERS) $(modinclude_HEADERS) \
+ $(nodist_include_HEADERS) $(noinst_HEADERS)
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+distdir = $(PACKAGE)-$(VERSION)
+top_distdir = $(distdir)
+am__remove_distdir = \
+ { test ! -d $(distdir) \
+ || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
+ && rm -fr $(distdir); }; }
+DIST_ARCHIVES = $(distdir).tar.gz
+GZIP_ENV = --best
+distuninstallcheck_listfiles = find . -type f -print
+distcleancheck_listfiles = find . -type f -print
+ACLOCAL = ${SHELL} /workspace/ajwong/git-chrome/src/third_party/yasm/source/patched-yasm/config/missing --run aclocal-1.10
+AMTAR = ${SHELL} /workspace/ajwong/git-chrome/src/third_party/yasm/source/patched-yasm/config/missing --run tar
+ARCH = x86
+AUTOCONF = ${SHELL} /workspace/ajwong/git-chrome/src/third_party/yasm/source/patched-yasm/config/missing --run autoconf
+AUTOHEADER = ${SHELL} /workspace/ajwong/git-chrome/src/third_party/yasm/source/patched-yasm/config/missing --run autoheader
+AUTOMAKE = ${SHELL} /workspace/ajwong/git-chrome/src/third_party/yasm/source/patched-yasm/config/missing --run automake-1.10
+AWK = awk
+CC = gcc -std=gnu99
+CCDEPMODE = depmode=gcc3
+CCLD_FOR_BUILD = gcc -std=gnu99
+CC_FOR_BUILD = gcc -std=gnu99
+CFLAGS = -g -O2
+CPP = gcc -E
+CPPFLAGS =
+CYGPATH_W = echo
+DEFS = -DHAVE_CONFIG_H
+DEPDIR = .deps
+ECHO_C = \c
+ECHO_N =
+ECHO_T =
+EGREP = /usr/bin/grep -E
+EXEEXT =
+GCC = yes
+GMSGFMT = /opt/local/bin/msgfmt
+GMSGFMT_015 = /opt/local/bin/msgfmt
+GREP = /usr/bin/grep
+HOST_CC = gcc -std=gnu99
+INSTALL = /usr/bin/install -c
+INSTALL_DATA = ${INSTALL} -m 644
+INSTALL_PROGRAM = ${INSTALL}
+INSTALL_SCRIPT = ${INSTALL}
+INSTALL_STRIP_PROGRAM = $(install_sh) -c -s
+INTLLIBS =
+INTL_MACOSX_LIBS = -Wl,-framework -Wl,CoreFoundation
+LDFLAGS =
+LIBICONV = -liconv
+LIBINTL =
+LIBOBJS =
+LIBS =
+LN_S = ln -s
+LTLIBICONV = -liconv
+LTLIBINTL =
+LTLIBOBJS =
+MAINT = #
+MAKEINFO = ${SHELL} /workspace/ajwong/git-chrome/src/third_party/yasm/source/patched-yasm/config/missing --run makeinfo
+MKDIR_P = /workspace/ajwong/git-chrome/src/third_party/yasm/source/patched-yasm/config/install-sh -c -d
+MORE_CFLAGS =
+MSGFMT = /opt/local/bin/msgfmt
+MSGFMT_015 = /opt/local/bin/msgfmt
+MSGMERGE = /opt/local/bin/msgmerge
+OBJEXT = o
+PACKAGE = yasm
+PACKAGE_BUGREPORT = bug-yasm@tortall.net
+PACKAGE_NAME = yasm
+PACKAGE_STRING = yasm 0.8.0
+PACKAGE_TARNAME = yasm
+PACKAGE_VERSION = 0.8.0
+PATH_SEPARATOR = :
+POSUB =
+PYTHON = /usr/bin/python
+PYTHON_EXEC_PREFIX = ${exec_prefix}
+PYTHON_INCLUDES =
+PYTHON_PLATFORM = darwin
+PYTHON_PREFIX = ${prefix}
+PYTHON_VERSION = 2.5
+RANLIB = ranlib
+SET_MAKE =
+SHELL = /bin/sh
+STRIP =
+USE_NLS = no
+VERSION = 0.8.0
+XGETTEXT = /opt/local/bin/xgettext
+XGETTEXT_015 = /opt/local/bin/xgettext
+XMLTO = :
+abs_builddir = /tmp/yasm
+abs_srcdir = /workspace/ajwong/git-chrome/src/third_party/yasm/source/patched-yasm
+abs_top_builddir = /tmp/yasm
+abs_top_srcdir = /workspace/ajwong/git-chrome/src/third_party/yasm/source/patched-yasm
+ac_ct_CC = gcc
+am__include = include
+am__leading_dot = .
+am__quote =
+am__tar = ${AMTAR} chof - "$$tardir"
+am__untar = ${AMTAR} xf -
+bindir = ${exec_prefix}/bin
+build = i686-apple-darwin9.8.0
+build_alias =
+build_cpu = i686
+build_os = darwin9.8.0
+build_vendor = apple
+builddir = .
+datadir = ${datarootdir}
+datarootdir = ${prefix}/share
+docdir = ${datarootdir}/doc/${PACKAGE_TARNAME}
+dvidir = ${docdir}
+exec_prefix = ${prefix}
+host = i686-apple-darwin9.8.0
+host_alias =
+host_cpu = i686
+host_os = darwin9.8.0
+host_vendor = apple
+htmldir = ${docdir}
+includedir = ${prefix}/include
+infodir = ${datarootdir}/info
+install_sh = $(SHELL) /workspace/ajwong/git-chrome/src/third_party/yasm/source/patched-yasm/config/install-sh
+libdir = ${exec_prefix}/lib
+libexecdir = ${exec_prefix}/libexec
+localedir = ${datarootdir}/locale
+localstatedir = ${prefix}/var
+mandir = ${datarootdir}/man
+mkdir_p = /workspace/ajwong/git-chrome/src/third_party/yasm/source/patched-yasm/config/install-sh -c -d
+oldincludedir = /usr/include
+pdfdir = ${docdir}
+pkgpyexecdir = ${pyexecdir}/yasm
+pkgpythondir = ${pythondir}/yasm
+prefix = /usr/local
+program_transform_name = s,x,x,
+psdir = ${docdir}
+pyexecdir = /Library/Python/2.5/site-packages
+pythondir = /Library/Python/2.5/site-packages
+sbindir = ${exec_prefix}/sbin
+sharedstatedir = ${prefix}/com
+srcdir = /workspace/ajwong/git-chrome/src/third_party/yasm/source/patched-yasm
+sysconfdir = ${prefix}/etc
+target_alias =
+top_builddir = .
+top_srcdir = /workspace/ajwong/git-chrome/src/third_party/yasm/source/patched-yasm
+SUBDIRS = po .
+AM_YFLAGS = -d
+AM_CFLAGS =
+
+#!include modules/objfmts/omf/Makefile.inc
+dist_man_MANS = yasm_arch.7 yasm_parsers.7 yasm_dbgfmts.7 \
+ yasm_objfmts.7 yasm.1
+TESTS_ENVIRONMENT = $(am__append_2)
+test_hd_SOURCES = test_hd.c
+include_HEADERS = libyasm.h
+nodist_include_HEADERS = libyasm-stdint.h
+noinst_HEADERS = util.h
+BUILT_SOURCES = x86insns.c x86insn_nasm.gperf x86insn_gas.gperf \
+ x86insn_nasm.c x86insn_gas.c gas-token.c nasm-token.c \
+ nasm-macros.c nasm-version.c version.mac win64-nasm.c \
+ win64-gas.c license.c
+MAINTAINERCLEANFILES = x86insns.c x86insn_nasm.gperf x86insn_gas.gperf \
+ $(am__append_4)
+
+# Until this gets fixed in automake
+DISTCLEANFILES = libyasm/stamp-h libyasm/stamp-h[0-9]*
+
+# Suffix rule for genperf
+SUFFIXES = .gperf
+
+# configure.lineno doesn't clean up after itself?
+CLEANFILES = configure.lineno $(am__append_1) x86insn_nasm.c \
+ x86insn_gas.c x86cpu.c x86regtmod.c lc3bid.c gas-token.c \
+ nasm-token.c nasm-macros.c nasm-version.c version.mac \
+ win64-nasm.c win64-gas.c module.c license.c
+
+# automake doesn't distribute mkinstalldirs?
+#!EXTRA_DIST += modules/objfmts/omf/Makefile.inc
+EXTRA_DIST = config/config.rpath config/mkinstalldirs \
+ tools/Makefile.inc libyasm/Makefile.inc modules/Makefile.inc \
+ frontends/Makefile.inc tools/re2c/Makefile.inc \
+ tools/genmacro/Makefile.inc tools/genperf/Makefile.inc \
+ tools/python-yasm/Makefile.inc tools/re2c/main.c \
+ tools/re2c/basics.h tools/re2c/globals.h tools/re2c/ins.h \
+ tools/re2c/re.h tools/re2c/token.h tools/re2c/code.c \
+ tools/re2c/dfa.h tools/re2c/dfa.c tools/re2c/parse.h \
+ tools/re2c/parser.h tools/re2c/parser.c tools/re2c/actions.c \
+ tools/re2c/scanner.h tools/re2c/scanner.c \
+ tools/re2c/mbo_getopt.h tools/re2c/mbo_getopt.c \
+ tools/re2c/substr.h tools/re2c/substr.c tools/re2c/translate.c \
+ tools/re2c/CHANGELOG tools/re2c/NO_WARRANTY tools/re2c/README \
+ tools/re2c/scanner.re tools/re2c/re2c.1 \
+ tools/re2c/bootstrap/scanner.c tools/re2c/doc/loplas.ps.gz \
+ tools/re2c/doc/sample.bib tools/re2c/examples/basemmap.c \
+ tools/re2c/examples/c.re tools/re2c/examples/cmmap.re \
+ tools/re2c/examples/cnokw.re tools/re2c/examples/cunroll.re \
+ tools/re2c/examples/modula.re tools/re2c/examples/repeater.re \
+ tools/re2c/examples/sample.re tools/re2c/examples/simple.re \
+ tools/re2c/examples/rexx/README \
+ tools/re2c/examples/rexx/rexx.l \
+ tools/re2c/examples/rexx/scanio.c tools/genmacro/genmacro.c \
+ tools/genperf/genperf.c tools/genperf/perfect.c \
+ tools/genperf/perfect.h tools/genperf/standard.h \
+ tools/python-yasm/pyxelator/cparse.py \
+ tools/python-yasm/pyxelator/genpyx.py \
+ tools/python-yasm/pyxelator/ir.py \
+ tools/python-yasm/pyxelator/lexer.py \
+ tools/python-yasm/pyxelator/node.py \
+ tools/python-yasm/pyxelator/parse_core.py \
+ tools/python-yasm/pyxelator/work_unit.py \
+ tools/python-yasm/pyxelator/wrap_yasm.py \
+ tools/python-yasm/setup.py tools/python-yasm/yasm.pyx \
+ $(PYBINDING_DEPS) tools/python-yasm/tests/Makefile.inc \
+ tools/python-yasm/tests/python_test.sh \
+ tools/python-yasm/tests/__init__.py \
+ tools/python-yasm/tests/test_bytecode.py \
+ tools/python-yasm/tests/test_expr.py \
+ tools/python-yasm/tests/test_intnum.py \
+ tools/python-yasm/tests/test_symrec.py \
+ modules/arch/Makefile.inc modules/listfmts/Makefile.inc \
+ modules/parsers/Makefile.inc modules/preprocs/Makefile.inc \
+ modules/objfmts/Makefile.inc modules/arch/x86/Makefile.inc \
+ modules/arch/lc3b/Makefile.inc \
+ modules/arch/x86/gen_x86_insn.py x86insns.c x86insn_nasm.gperf \
+ x86insn_gas.gperf modules/arch/x86/x86cpu.gperf \
+ modules/arch/x86/x86regtmod.gperf \
+ modules/arch/x86/tests/Makefile.inc \
+ modules/arch/x86/tests/x86_test.sh \
+ modules/arch/x86/tests/gen-fma-test.py \
+ modules/arch/x86/tests/addbyte.asm \
+ modules/arch/x86/tests/addbyte.errwarn \
+ modules/arch/x86/tests/addbyte.hex \
+ modules/arch/x86/tests/addrop.asm \
+ modules/arch/x86/tests/addrop.errwarn \
+ modules/arch/x86/tests/addrop.hex \
+ modules/arch/x86/tests/addrop-err.asm \
+ modules/arch/x86/tests/addrop-err.errwarn \
+ modules/arch/x86/tests/aes.asm modules/arch/x86/tests/aes.hex \
+ modules/arch/x86/tests/amd200707.asm \
+ modules/arch/x86/tests/amd200707.hex \
+ modules/arch/x86/tests/arithsmall.asm \
+ modules/arch/x86/tests/arithsmall.errwarn \
+ modules/arch/x86/tests/arithsmall.hex \
+ modules/arch/x86/tests/avx.asm modules/arch/x86/tests/avx.hex \
+ modules/arch/x86/tests/avxcc.asm \
+ modules/arch/x86/tests/avxcc.hex \
+ modules/arch/x86/tests/bittest.asm \
+ modules/arch/x86/tests/bittest.hex \
+ modules/arch/x86/tests/bswap64.asm \
+ modules/arch/x86/tests/bswap64.hex \
+ modules/arch/x86/tests/clmul.asm \
+ modules/arch/x86/tests/clmul.hex \
+ modules/arch/x86/tests/cmpxchg.asm \
+ modules/arch/x86/tests/cmpxchg.hex \
+ modules/arch/x86/tests/cpubasic-err.asm \
+ modules/arch/x86/tests/cpubasic-err.errwarn \
+ modules/arch/x86/tests/cyrix.asm \
+ modules/arch/x86/tests/cyrix.hex \
+ modules/arch/x86/tests/div-err.asm \
+ modules/arch/x86/tests/div-err.errwarn \
+ modules/arch/x86/tests/ea-nonzero.asm \
+ modules/arch/x86/tests/ea-nonzero.hex \
+ modules/arch/x86/tests/ea-over.asm \
+ modules/arch/x86/tests/ea-over.errwarn \
+ modules/arch/x86/tests/ea-over.hex \
+ modules/arch/x86/tests/ea-warn.asm \
+ modules/arch/x86/tests/ea-warn.errwarn \
+ modules/arch/x86/tests/ea-warn.hex \
+ modules/arch/x86/tests/ebpindex.asm \
+ modules/arch/x86/tests/ebpindex.hex \
+ modules/arch/x86/tests/effaddr.asm \
+ modules/arch/x86/tests/effaddr.hex \
+ modules/arch/x86/tests/enter.asm \
+ modules/arch/x86/tests/enter.errwarn \
+ modules/arch/x86/tests/enter.hex \
+ modules/arch/x86/tests/far64.asm \
+ modules/arch/x86/tests/far64.hex \
+ modules/arch/x86/tests/farbasic.asm \
+ modules/arch/x86/tests/farbasic.hex \
+ modules/arch/x86/tests/farithr.asm \
+ modules/arch/x86/tests/farithr.hex \
+ modules/arch/x86/tests/fcmov.asm \
+ modules/arch/x86/tests/fcmov.hex \
+ modules/arch/x86/tests/fma.asm modules/arch/x86/tests/fma.hex \
+ modules/arch/x86/tests/fwdequ64.asm \
+ modules/arch/x86/tests/fwdequ64.hex \
+ modules/arch/x86/tests/genopcode.asm \
+ modules/arch/x86/tests/genopcode.hex \
+ modules/arch/x86/tests/imm64.asm \
+ modules/arch/x86/tests/imm64.errwarn \
+ modules/arch/x86/tests/imm64.hex \
+ modules/arch/x86/tests/iret.asm \
+ modules/arch/x86/tests/iret.hex \
+ modules/arch/x86/tests/jmp64-1.asm \
+ modules/arch/x86/tests/jmp64-1.hex \
+ modules/arch/x86/tests/jmp64-2.asm \
+ modules/arch/x86/tests/jmp64-2.hex \
+ modules/arch/x86/tests/jmp64-3.asm \
+ modules/arch/x86/tests/jmp64-3.hex \
+ modules/arch/x86/tests/jmp64-4.asm \
+ modules/arch/x86/tests/jmp64-4.hex \
+ modules/arch/x86/tests/jmp64-5.asm \
+ modules/arch/x86/tests/jmp64-5.hex \
+ modules/arch/x86/tests/jmp64-6.asm \
+ modules/arch/x86/tests/jmp64-6.hex \
+ modules/arch/x86/tests/jmpfar.asm \
+ modules/arch/x86/tests/jmpfar.hex \
+ modules/arch/x86/tests/lds.asm modules/arch/x86/tests/lds.hex \
+ modules/arch/x86/tests/loopadsz.asm \
+ modules/arch/x86/tests/loopadsz.hex \
+ modules/arch/x86/tests/lsahf.asm \
+ modules/arch/x86/tests/lsahf.hex \
+ modules/arch/x86/tests/mem64-err.asm \
+ modules/arch/x86/tests/mem64-err.errwarn \
+ modules/arch/x86/tests/mem64.asm \
+ modules/arch/x86/tests/mem64.errwarn \
+ modules/arch/x86/tests/mem64.hex \
+ modules/arch/x86/tests/mem64hi32.asm \
+ modules/arch/x86/tests/mem64hi32.hex \
+ modules/arch/x86/tests/mem64rip.asm \
+ modules/arch/x86/tests/mem64rip.hex \
+ modules/arch/x86/tests/mixcase.asm \
+ modules/arch/x86/tests/mixcase.hex \
+ modules/arch/x86/tests/movbe.asm \
+ modules/arch/x86/tests/movbe.hex \
+ modules/arch/x86/tests/movdq32.asm \
+ modules/arch/x86/tests/movdq32.hex \
+ modules/arch/x86/tests/movdq64.asm \
+ modules/arch/x86/tests/movdq64.hex \
+ modules/arch/x86/tests/negequ.asm \
+ modules/arch/x86/tests/negequ.hex \
+ modules/arch/x86/tests/nomem64-err.asm \
+ modules/arch/x86/tests/nomem64-err.errwarn \
+ modules/arch/x86/tests/nomem64-err2.asm \
+ modules/arch/x86/tests/nomem64-err2.errwarn \
+ modules/arch/x86/tests/nomem64.asm \
+ modules/arch/x86/tests/nomem64.errwarn \
+ modules/arch/x86/tests/nomem64.hex \
+ modules/arch/x86/tests/o64.asm modules/arch/x86/tests/o64.hex \
+ modules/arch/x86/tests/o64loop.asm \
+ modules/arch/x86/tests/o64loop.errwarn \
+ modules/arch/x86/tests/o64loop.hex \
+ modules/arch/x86/tests/opersize.asm \
+ modules/arch/x86/tests/opersize.hex \
+ modules/arch/x86/tests/opsize-err.asm \
+ modules/arch/x86/tests/opsize-err.errwarn \
+ modules/arch/x86/tests/overflow.asm \
+ modules/arch/x86/tests/overflow.errwarn \
+ modules/arch/x86/tests/overflow.hex \
+ modules/arch/x86/tests/padlock.asm \
+ modules/arch/x86/tests/padlock.hex \
+ modules/arch/x86/tests/pshift.asm \
+ modules/arch/x86/tests/pshift.hex \
+ modules/arch/x86/tests/push64.asm \
+ modules/arch/x86/tests/push64.errwarn \
+ modules/arch/x86/tests/push64.hex \
+ modules/arch/x86/tests/pushf.asm \
+ modules/arch/x86/tests/pushf.hex \
+ modules/arch/x86/tests/pushf-err.asm \
+ modules/arch/x86/tests/pushf-err.errwarn \
+ modules/arch/x86/tests/pushnosize.asm \
+ modules/arch/x86/tests/pushnosize.errwarn \
+ modules/arch/x86/tests/pushnosize.hex \
+ modules/arch/x86/tests/rep.asm modules/arch/x86/tests/rep.hex \
+ modules/arch/x86/tests/ret.asm modules/arch/x86/tests/ret.hex \
+ modules/arch/x86/tests/riprel1.asm \
+ modules/arch/x86/tests/riprel1.hex \
+ modules/arch/x86/tests/riprel2.asm \
+ modules/arch/x86/tests/riprel2.errwarn \
+ modules/arch/x86/tests/riprel2.hex \
+ modules/arch/x86/tests/ripseg.asm \
+ modules/arch/x86/tests/ripseg.errwarn \
+ modules/arch/x86/tests/ripseg.hex \
+ modules/arch/x86/tests/segmov.asm \
+ modules/arch/x86/tests/segmov.hex \
+ modules/arch/x86/tests/segoff.asm \
+ modules/arch/x86/tests/segoff.hex \
+ modules/arch/x86/tests/segoff-err.asm \
+ modules/arch/x86/tests/segoff-err.errwarn \
+ modules/arch/x86/tests/shift.asm \
+ modules/arch/x86/tests/shift.hex \
+ modules/arch/x86/tests/simd-1.asm \
+ modules/arch/x86/tests/simd-1.hex \
+ modules/arch/x86/tests/simd-2.asm \
+ modules/arch/x86/tests/simd-2.hex \
+ modules/arch/x86/tests/simd64-1.asm \
+ modules/arch/x86/tests/simd64-1.hex \
+ modules/arch/x86/tests/simd64-2.asm \
+ modules/arch/x86/tests/simd64-2.hex \
+ modules/arch/x86/tests/sse-prefix.asm \
+ modules/arch/x86/tests/sse-prefix.hex \
+ modules/arch/x86/tests/sse3.asm \
+ modules/arch/x86/tests/sse3.hex \
+ modules/arch/x86/tests/sse4.asm \
+ modules/arch/x86/tests/sse4.hex \
+ modules/arch/x86/tests/sse4-err.asm \
+ modules/arch/x86/tests/sse4-err.errwarn \
+ modules/arch/x86/tests/sse5-all.asm \
+ modules/arch/x86/tests/sse5-all.hex \
+ modules/arch/x86/tests/sse5-basic.asm \
+ modules/arch/x86/tests/sse5-basic.hex \
+ modules/arch/x86/tests/sse5-cc.asm \
+ modules/arch/x86/tests/sse5-cc.hex \
+ modules/arch/x86/tests/sse5-err.asm \
+ modules/arch/x86/tests/sse5-err.errwarn \
+ modules/arch/x86/tests/ssewidth.asm \
+ modules/arch/x86/tests/ssewidth.hex \
+ modules/arch/x86/tests/ssse3.asm \
+ modules/arch/x86/tests/ssse3.c \
+ modules/arch/x86/tests/ssse3.hex \
+ modules/arch/x86/tests/stos.asm \
+ modules/arch/x86/tests/stos.hex modules/arch/x86/tests/str.asm \
+ modules/arch/x86/tests/str.hex \
+ modules/arch/x86/tests/strict.asm \
+ modules/arch/x86/tests/strict.errwarn \
+ modules/arch/x86/tests/strict.hex \
+ modules/arch/x86/tests/strict-err.asm \
+ modules/arch/x86/tests/strict-err.errwarn \
+ modules/arch/x86/tests/stringseg.asm \
+ modules/arch/x86/tests/stringseg.errwarn \
+ modules/arch/x86/tests/stringseg.hex \
+ modules/arch/x86/tests/svm.asm modules/arch/x86/tests/svm.hex \
+ modules/arch/x86/tests/twobytemem.asm \
+ modules/arch/x86/tests/twobytemem.errwarn \
+ modules/arch/x86/tests/twobytemem.hex \
+ modules/arch/x86/tests/vmx.asm modules/arch/x86/tests/vmx.hex \
+ modules/arch/x86/tests/vmx-err.asm \
+ modules/arch/x86/tests/vmx-err.errwarn \
+ modules/arch/x86/tests/x86label.asm \
+ modules/arch/x86/tests/x86label.hex \
+ modules/arch/x86/tests/xchg64.asm \
+ modules/arch/x86/tests/xchg64.hex \
+ modules/arch/x86/tests/xmm64.asm \
+ modules/arch/x86/tests/xmm64.hex \
+ modules/arch/x86/tests/xsave.asm \
+ modules/arch/x86/tests/xsave.hex \
+ modules/arch/x86/tests/gas32/Makefile.inc \
+ modules/arch/x86/tests/gas64/Makefile.inc \
+ modules/arch/x86/tests/gas32/x86_gas32_test.sh \
+ modules/arch/x86/tests/gas32/align32.asm \
+ modules/arch/x86/tests/gas32/align32.hex \
+ modules/arch/x86/tests/gas32/gas-farithr.asm \
+ modules/arch/x86/tests/gas32/gas-farithr.hex \
+ modules/arch/x86/tests/gas32/gas-fpmem.asm \
+ modules/arch/x86/tests/gas32/gas-fpmem.hex \
+ modules/arch/x86/tests/gas32/gas-movdq32.asm \
+ modules/arch/x86/tests/gas32/gas-movdq32.hex \
+ modules/arch/x86/tests/gas32/gas-movsd.asm \
+ modules/arch/x86/tests/gas32/gas-movsd.hex \
+ modules/arch/x86/tests/gas32/gas32-jmpcall.asm \
+ modules/arch/x86/tests/gas32/gas32-jmpcall.hex \
+ modules/arch/x86/tests/gas64/x86_gas64_test.sh \
+ modules/arch/x86/tests/gas64/align64.asm \
+ modules/arch/x86/tests/gas64/align64.hex \
+ modules/arch/x86/tests/gas64/gas-cbw.asm \
+ modules/arch/x86/tests/gas64/gas-cbw.hex \
+ modules/arch/x86/tests/gas64/gas-fp.asm \
+ modules/arch/x86/tests/gas64/gas-fp.hex \
+ modules/arch/x86/tests/gas64/gas-inout.asm \
+ modules/arch/x86/tests/gas64/gas-inout.hex \
+ modules/arch/x86/tests/gas64/gas-moreinsn.asm \
+ modules/arch/x86/tests/gas64/gas-moreinsn.hex \
+ modules/arch/x86/tests/gas64/gas-movabs.asm \
+ modules/arch/x86/tests/gas64/gas-movabs.hex \
+ modules/arch/x86/tests/gas64/gas-movdq64.asm \
+ modules/arch/x86/tests/gas64/gas-movdq64.hex \
+ modules/arch/x86/tests/gas64/gas-movsxs.asm \
+ modules/arch/x86/tests/gas64/gas-movsxs.hex \
+ modules/arch/x86/tests/gas64/gas-muldiv.asm \
+ modules/arch/x86/tests/gas64/gas-muldiv.hex \
+ modules/arch/x86/tests/gas64/gas-prefix.asm \
+ modules/arch/x86/tests/gas64/gas-prefix.errwarn \
+ modules/arch/x86/tests/gas64/gas-prefix.hex \
+ modules/arch/x86/tests/gas64/gas-retenter.asm \
+ modules/arch/x86/tests/gas64/gas-retenter.hex \
+ modules/arch/x86/tests/gas64/gas-shift.asm \
+ modules/arch/x86/tests/gas64/gas-shift.hex \
+ modules/arch/x86/tests/gas64/gas64-jmpcall.asm \
+ modules/arch/x86/tests/gas64/gas64-jmpcall.hex \
+ modules/arch/x86/tests/gas64/riprel.asm \
+ modules/arch/x86/tests/gas64/riprel.hex \
+ modules/arch/lc3b/tests/Makefile.inc \
+ modules/arch/lc3b/lc3bid.re \
+ modules/arch/lc3b/tests/lc3b_test.sh \
+ modules/arch/lc3b/tests/lc3b-basic.asm \
+ modules/arch/lc3b/tests/lc3b-basic.errwarn \
+ modules/arch/lc3b/tests/lc3b-basic.hex \
+ modules/arch/lc3b/tests/lc3b-br.asm \
+ modules/arch/lc3b/tests/lc3b-br.hex \
+ modules/arch/lc3b/tests/lc3b-ea-err.asm \
+ modules/arch/lc3b/tests/lc3b-ea-err.errwarn \
+ modules/arch/lc3b/tests/lc3b-mp22NC.asm \
+ modules/arch/lc3b/tests/lc3b-mp22NC.hex \
+ modules/arch/yasm_arch.xml modules/listfmts/nasm/Makefile.inc \
+ modules/parsers/gas/Makefile.inc \
+ modules/parsers/nasm/Makefile.inc \
+ modules/parsers/gas/tests/Makefile.inc \
+ modules/parsers/gas/gas-token.re \
+ modules/parsers/gas/tests/gas_test.sh \
+ modules/parsers/gas/tests/dataref-imm.asm \
+ modules/parsers/gas/tests/dataref-imm.hex \
+ modules/parsers/gas/tests/datavis.asm \
+ modules/parsers/gas/tests/datavis.errwarn \
+ modules/parsers/gas/tests/datavis.hex \
+ modules/parsers/gas/tests/datavis2.asm \
+ modules/parsers/gas/tests/datavis2.hex \
+ modules/parsers/gas/tests/execsect.asm \
+ modules/parsers/gas/tests/execsect.hex \
+ modules/parsers/gas/tests/gas-fill.asm \
+ modules/parsers/gas/tests/gas-fill.hex \
+ modules/parsers/gas/tests/gas-float.asm \
+ modules/parsers/gas/tests/gas-float.hex \
+ modules/parsers/gas/tests/gas-instlabel.asm \
+ modules/parsers/gas/tests/gas-instlabel.hex \
+ modules/parsers/gas/tests/gas-line-err.asm \
+ modules/parsers/gas/tests/gas-line-err.errwarn \
+ modules/parsers/gas/tests/gas-line2-err.asm \
+ modules/parsers/gas/tests/gas-line2-err.errwarn \
+ modules/parsers/gas/tests/gas-push.asm \
+ modules/parsers/gas/tests/gas-push.hex \
+ modules/parsers/gas/tests/gas-segprefix.asm \
+ modules/parsers/gas/tests/gas-segprefix.hex \
+ modules/parsers/gas/tests/gas-semi.asm \
+ modules/parsers/gas/tests/gas-semi.hex \
+ modules/parsers/gas/tests/gassectalign.asm \
+ modules/parsers/gas/tests/gassectalign.hex \
+ modules/parsers/gas/tests/jmpcall.asm \
+ modules/parsers/gas/tests/jmpcall.errwarn \
+ modules/parsers/gas/tests/jmpcall.hex \
+ modules/parsers/gas/tests/leb128.asm \
+ modules/parsers/gas/tests/leb128.hex \
+ modules/parsers/gas/tests/localcomm.asm \
+ modules/parsers/gas/tests/localcomm.hex \
+ modules/parsers/gas/tests/reggroup-err.asm \
+ modules/parsers/gas/tests/reggroup-err.errwarn \
+ modules/parsers/gas/tests/reggroup.asm \
+ modules/parsers/gas/tests/reggroup.hex \
+ modules/parsers/gas/tests/strzero.asm \
+ modules/parsers/gas/tests/strzero.hex \
+ modules/parsers/gas/tests/varinsn.asm \
+ modules/parsers/gas/tests/varinsn.hex \
+ modules/parsers/gas/tests/bin/Makefile.inc \
+ modules/parsers/gas/tests/bin/gas_bin_test.sh \
+ modules/parsers/gas/tests/bin/gas-comment.asm \
+ modules/parsers/gas/tests/bin/gas-comment.errwarn \
+ modules/parsers/gas/tests/bin/gas-comment.hex \
+ modules/parsers/gas/tests/bin/gas-llabel.asm \
+ modules/parsers/gas/tests/bin/gas-llabel.hex \
+ modules/parsers/gas/tests/bin/gas-set.asm \
+ modules/parsers/gas/tests/bin/gas-set.hex \
+ modules/parsers/gas/tests/bin/rept-err.asm \
+ modules/parsers/gas/tests/bin/rept-err.errwarn \
+ modules/parsers/gas/tests/bin/reptempty.asm \
+ modules/parsers/gas/tests/bin/reptempty.hex \
+ modules/parsers/gas/tests/bin/reptlong.asm \
+ modules/parsers/gas/tests/bin/reptlong.hex \
+ modules/parsers/gas/tests/bin/reptnested-err.asm \
+ modules/parsers/gas/tests/bin/reptnested-err.errwarn \
+ modules/parsers/gas/tests/bin/reptsimple.asm \
+ modules/parsers/gas/tests/bin/reptsimple.hex \
+ modules/parsers/gas/tests/bin/reptwarn.asm \
+ modules/parsers/gas/tests/bin/reptwarn.errwarn \
+ modules/parsers/gas/tests/bin/reptwarn.hex \
+ modules/parsers/gas/tests/bin/reptzero.asm \
+ modules/parsers/gas/tests/bin/reptzero.hex \
+ modules/parsers/nasm/nasm-token.re \
+ modules/parsers/nasm/nasm-std.mac \
+ modules/parsers/nasm/tests/Makefile.inc \
+ modules/parsers/nasm/tests/nasm_test.sh \
+ modules/parsers/nasm/tests/alignnop16.asm \
+ modules/parsers/nasm/tests/alignnop16.hex \
+ modules/parsers/nasm/tests/alignnop32.asm \
+ modules/parsers/nasm/tests/alignnop32.hex \
+ modules/parsers/nasm/tests/charconstmath.asm \
+ modules/parsers/nasm/tests/charconstmath.hex \
+ modules/parsers/nasm/tests/dy.asm \
+ modules/parsers/nasm/tests/dy.hex \
+ modules/parsers/nasm/tests/endcomma.asm \
+ modules/parsers/nasm/tests/endcomma.hex \
+ modules/parsers/nasm/tests/equcolon.asm \
+ modules/parsers/nasm/tests/equcolon.hex \
+ modules/parsers/nasm/tests/equlocal.asm \
+ modules/parsers/nasm/tests/equlocal.hex \
+ modules/parsers/nasm/tests/hexconst.asm \
+ modules/parsers/nasm/tests/hexconst.hex \
+ modules/parsers/nasm/tests/long.asm \
+ modules/parsers/nasm/tests/long.hex \
+ modules/parsers/nasm/tests/locallabel.asm \
+ modules/parsers/nasm/tests/locallabel.hex \
+ modules/parsers/nasm/tests/locallabel2.asm \
+ modules/parsers/nasm/tests/locallabel2.hex \
+ modules/parsers/nasm/tests/nasm-prefix.asm \
+ modules/parsers/nasm/tests/nasm-prefix.hex \
+ modules/parsers/nasm/tests/newsect.asm \
+ modules/parsers/nasm/tests/newsect.hex \
+ modules/parsers/nasm/tests/orphannowarn.asm \
+ modules/parsers/nasm/tests/orphannowarn.hex \
+ modules/parsers/nasm/tests/prevlocalwarn.asm \
+ modules/parsers/nasm/tests/prevlocalwarn.errwarn \
+ modules/parsers/nasm/tests/prevlocalwarn.hex \
+ modules/parsers/nasm/tests/strucalign.asm \
+ modules/parsers/nasm/tests/strucalign.hex \
+ modules/parsers/nasm/tests/struczero.asm \
+ modules/parsers/nasm/tests/struczero.hex \
+ modules/parsers/nasm/tests/syntax-err.asm \
+ modules/parsers/nasm/tests/syntax-err.errwarn \
+ modules/parsers/nasm/tests/uscore.asm \
+ modules/parsers/nasm/tests/uscore.hex \
+ modules/parsers/nasm/tests/worphan/Makefile.inc \
+ modules/parsers/nasm/tests/worphan/nasm_worphan_test.sh \
+ modules/parsers/nasm/tests/worphan/orphanwarn.asm \
+ modules/parsers/nasm/tests/worphan/orphanwarn.errwarn \
+ modules/parsers/nasm/tests/worphan/orphanwarn.hex \
+ modules/parsers/tasm/tests/Makefile.inc \
+ modules/parsers/tasm/tests/tasm_test.sh \
+ modules/parsers/tasm/tests/array.asm \
+ modules/parsers/tasm/tests/array.hex \
+ modules/parsers/tasm/tests/case.asm \
+ modules/parsers/tasm/tests/case.hex \
+ modules/parsers/tasm/tests/charstr.asm \
+ modules/parsers/tasm/tests/charstr.hex \
+ modules/parsers/tasm/tests/dup.asm \
+ modules/parsers/tasm/tests/dup.hex \
+ modules/parsers/tasm/tests/equal.asm \
+ modules/parsers/tasm/tests/equal.hex \
+ modules/parsers/tasm/tests/expr.asm \
+ modules/parsers/tasm/tests/expr.hex \
+ modules/parsers/tasm/tests/irp.asm \
+ modules/parsers/tasm/tests/irp.hex \
+ modules/parsers/tasm/tests/label.asm \
+ modules/parsers/tasm/tests/label.hex \
+ modules/parsers/tasm/tests/les.asm \
+ modules/parsers/tasm/tests/les.hex \
+ modules/parsers/tasm/tests/lidt.asm \
+ modules/parsers/tasm/tests/lidt.hex \
+ modules/parsers/tasm/tests/macro.asm \
+ modules/parsers/tasm/tests/macro.hex \
+ modules/parsers/tasm/tests/offset.asm \
+ modules/parsers/tasm/tests/offset.hex \
+ modules/parsers/tasm/tests/quote.asm \
+ modules/parsers/tasm/tests/quote.hex \
+ modules/parsers/tasm/tests/res.asm \
+ modules/parsers/tasm/tests/res.errwarn \
+ modules/parsers/tasm/tests/res.hex \
+ modules/parsers/tasm/tests/segment.asm \
+ modules/parsers/tasm/tests/segment.hex \
+ modules/parsers/tasm/tests/size.asm \
+ modules/parsers/tasm/tests/size.hex \
+ modules/parsers/tasm/tests/struc.asm \
+ modules/parsers/tasm/tests/struc.errwarn \
+ modules/parsers/tasm/tests/struc.hex \
+ modules/parsers/tasm/tests/exe/Makefile.inc \
+ modules/parsers/tasm/tests/exe/tasm_exe_test.sh \
+ modules/parsers/tasm/tests/exe/exe.asm \
+ modules/parsers/tasm/tests/exe/exe.hex \
+ modules/parsers/yasm_parsers.xml \
+ modules/preprocs/nasm/Makefile.inc \
+ modules/preprocs/raw/Makefile.inc \
+ modules/preprocs/cpp/Makefile.inc \
+ modules/preprocs/nasm/genversion.c \
+ modules/preprocs/nasm/tests/Makefile.inc \
+ modules/preprocs/nasm/tests/nasmpp_test.sh \
+ modules/preprocs/nasm/tests/16args.asm \
+ modules/preprocs/nasm/tests/16args.hex \
+ modules/preprocs/nasm/tests/ifcritical-err.asm \
+ modules/preprocs/nasm/tests/ifcritical-err.errwarn \
+ modules/preprocs/nasm/tests/longline.asm \
+ modules/preprocs/nasm/tests/longline.hex \
+ modules/preprocs/nasm/tests/macroeof-err.asm \
+ modules/preprocs/nasm/tests/macroeof-err.errwarn \
+ modules/preprocs/nasm/tests/noinclude-err.asm \
+ modules/preprocs/nasm/tests/noinclude-err.errwarn \
+ modules/preprocs/nasm/tests/nasmpp-bigint.asm \
+ modules/preprocs/nasm/tests/nasmpp-bigint.hex \
+ modules/preprocs/nasm/tests/nasmpp-decimal.asm \
+ modules/preprocs/nasm/tests/nasmpp-decimal.hex \
+ modules/preprocs/nasm/tests/nasmpp-nested.asm \
+ modules/preprocs/nasm/tests/nasmpp-nested.errwarn \
+ modules/preprocs/nasm/tests/nasmpp-nested.hex \
+ modules/preprocs/nasm/tests/orgsect.asm \
+ modules/preprocs/nasm/tests/orgsect.hex \
+ modules/preprocs/raw/tests/Makefile.inc \
+ modules/preprocs/raw/tests/rawpp_test.sh \
+ modules/preprocs/raw/tests/longline.asm \
+ modules/preprocs/raw/tests/longline.hex \
+ modules/dbgfmts/codeview/Makefile.inc \
+ modules/dbgfmts/dwarf2/Makefile.inc \
+ modules/dbgfmts/null/Makefile.inc \
+ modules/dbgfmts/stabs/Makefile.inc \
+ modules/dbgfmts/codeview/cv8.txt \
+ modules/dbgfmts/dwarf2/tests/Makefile.inc \
+ modules/dbgfmts/dwarf2/tests/pass32/Makefile.inc \
+ modules/dbgfmts/dwarf2/tests/pass64/Makefile.inc \
+ modules/dbgfmts/dwarf2/tests/passwin64/Makefile.inc \
+ modules/dbgfmts/dwarf2/tests/pass32/dwarf2_pass32_test.sh \
+ modules/dbgfmts/dwarf2/tests/pass32/dwarf32-err.asm \
+ modules/dbgfmts/dwarf2/tests/pass32/dwarf32-err.errwarn \
+ modules/dbgfmts/dwarf2/tests/pass32/dwarf32_testhd.asm \
+ modules/dbgfmts/dwarf2/tests/pass32/dwarf32_testhd.hex \
+ modules/dbgfmts/dwarf2/tests/pass64/dwarf2_pass64_test.sh \
+ modules/dbgfmts/dwarf2/tests/pass64/dwarf64_2loc.asm \
+ modules/dbgfmts/dwarf2/tests/pass64/dwarf64_2loc.hex \
+ modules/dbgfmts/dwarf2/tests/pass64/dwarf64_leb128.asm \
+ modules/dbgfmts/dwarf2/tests/pass64/dwarf64_leb128.hex \
+ modules/dbgfmts/dwarf2/tests/passwin64/dwarf2_passwin64_test.sh \
+ modules/dbgfmts/dwarf2/tests/passwin64/dwarfwin64_testhd.asm \
+ modules/dbgfmts/dwarf2/tests/passwin64/dwarfwin64_testhd.errwarn \
+ modules/dbgfmts/dwarf2/tests/passwin64/dwarfwin64_testhd.hex \
+ modules/dbgfmts/stabs/tests/Makefile.inc \
+ modules/dbgfmts/stabs/tests/stabs_test.sh \
+ modules/dbgfmts/stabs/tests/stabs-elf.asm \
+ modules/dbgfmts/stabs/tests/stabs-elf.hex \
+ modules/dbgfmts/yasm_dbgfmts.xml \
+ modules/objfmts/dbg/Makefile.inc \
+ modules/objfmts/bin/Makefile.inc \
+ modules/objfmts/elf/Makefile.inc \
+ modules/objfmts/coff/Makefile.inc \
+ modules/objfmts/macho/Makefile.inc \
+ modules/objfmts/rdf/Makefile.inc \
+ modules/objfmts/win32/Makefile.inc \
+ modules/objfmts/win64/Makefile.inc \
+ modules/objfmts/xdf/Makefile.inc \
+ modules/objfmts/bin/tests/Makefile.inc \
+ modules/objfmts/bin/tests/bin_test.sh \
+ modules/objfmts/bin/tests/abs.asm \
+ modules/objfmts/bin/tests/abs.hex \
+ modules/objfmts/bin/tests/bigorg.asm \
+ modules/objfmts/bin/tests/bigorg.hex \
+ modules/objfmts/bin/tests/bigorg.errwarn \
+ modules/objfmts/bin/tests/bin-farabs.asm \
+ modules/objfmts/bin/tests/bin-farabs.hex \
+ modules/objfmts/bin/tests/bin-rip.asm \
+ modules/objfmts/bin/tests/bin-rip.hex \
+ modules/objfmts/bin/tests/bintest.asm \
+ modules/objfmts/bin/tests/bintest.hex \
+ modules/objfmts/bin/tests/float-err.asm \
+ modules/objfmts/bin/tests/float-err.errwarn \
+ modules/objfmts/bin/tests/float.asm \
+ modules/objfmts/bin/tests/float.hex \
+ modules/objfmts/bin/tests/integer-warn.asm \
+ modules/objfmts/bin/tests/integer-warn.hex \
+ modules/objfmts/bin/tests/integer-warn.errwarn \
+ modules/objfmts/bin/tests/integer.asm \
+ modules/objfmts/bin/tests/integer.hex \
+ modules/objfmts/bin/tests/levelop.asm \
+ modules/objfmts/bin/tests/levelop.hex \
+ modules/objfmts/bin/tests/reserve.asm \
+ modules/objfmts/bin/tests/reserve.hex \
+ modules/objfmts/bin/tests/reserve.errwarn \
+ modules/objfmts/bin/tests/shr.asm \
+ modules/objfmts/bin/tests/shr.hex \
+ modules/objfmts/bin/tests/multisect/Makefile.inc \
+ modules/objfmts/bin/tests/multisect/bin_multi_test.sh \
+ modules/objfmts/bin/tests/multisect/bin-align.asm \
+ modules/objfmts/bin/tests/multisect/bin-align.errwarn \
+ modules/objfmts/bin/tests/multisect/bin-align.hex \
+ modules/objfmts/bin/tests/multisect/bin-align.map \
+ modules/objfmts/bin/tests/multisect/bin-ssym.asm \
+ modules/objfmts/bin/tests/multisect/bin-ssym.hex \
+ modules/objfmts/bin/tests/multisect/bin-ssym.map \
+ modules/objfmts/bin/tests/multisect/follows-loop1-err.asm \
+ modules/objfmts/bin/tests/multisect/follows-loop1-err.errwarn \
+ modules/objfmts/bin/tests/multisect/follows-loop2-err.asm \
+ modules/objfmts/bin/tests/multisect/follows-loop2-err.errwarn \
+ modules/objfmts/bin/tests/multisect/follows-notfound-err.asm \
+ modules/objfmts/bin/tests/multisect/follows-notfound-err.errwarn \
+ modules/objfmts/bin/tests/multisect/initbss.asm \
+ modules/objfmts/bin/tests/multisect/initbss.errwarn \
+ modules/objfmts/bin/tests/multisect/initbss.hex \
+ modules/objfmts/bin/tests/multisect/initbss.map \
+ modules/objfmts/bin/tests/multisect/ldlinux-sects.asm \
+ modules/objfmts/bin/tests/multisect/ldlinux-sects.hex \
+ modules/objfmts/bin/tests/multisect/ldlinux-sects.map \
+ modules/objfmts/bin/tests/multisect/multisect1.asm \
+ modules/objfmts/bin/tests/multisect/multisect1.hex \
+ modules/objfmts/bin/tests/multisect/multisect1.map \
+ modules/objfmts/bin/tests/multisect/multisect2.asm \
+ modules/objfmts/bin/tests/multisect/multisect2.hex \
+ modules/objfmts/bin/tests/multisect/multisect2.map \
+ modules/objfmts/bin/tests/multisect/multisect3.asm \
+ modules/objfmts/bin/tests/multisect/multisect3.hex \
+ modules/objfmts/bin/tests/multisect/multisect3.map \
+ modules/objfmts/bin/tests/multisect/multisect4.asm \
+ modules/objfmts/bin/tests/multisect/multisect4.hex \
+ modules/objfmts/bin/tests/multisect/multisect4.map \
+ modules/objfmts/bin/tests/multisect/multisect5.asm \
+ modules/objfmts/bin/tests/multisect/multisect5.hex \
+ modules/objfmts/bin/tests/multisect/multisect5.map \
+ modules/objfmts/bin/tests/multisect/nomultisect1.asm \
+ modules/objfmts/bin/tests/multisect/nomultisect1.hex \
+ modules/objfmts/bin/tests/multisect/nomultisect1.map \
+ modules/objfmts/bin/tests/multisect/nomultisect2.asm \
+ modules/objfmts/bin/tests/multisect/nomultisect2.hex \
+ modules/objfmts/bin/tests/multisect/nomultisect2.map \
+ modules/objfmts/bin/tests/multisect/vfollows-loop1-err.asm \
+ modules/objfmts/bin/tests/multisect/vfollows-loop1-err.errwarn \
+ modules/objfmts/bin/tests/multisect/vfollows-loop2-err.asm \
+ modules/objfmts/bin/tests/multisect/vfollows-loop2-err.errwarn \
+ modules/objfmts/bin/tests/multisect/vfollows-notfound-err.asm \
+ modules/objfmts/bin/tests/multisect/vfollows-notfound-err.errwarn \
+ modules/objfmts/elf/tests/Makefile.inc \
+ modules/objfmts/elf/tests/elf_test.sh \
+ modules/objfmts/elf/tests/curpos.asm \
+ modules/objfmts/elf/tests/curpos.hex \
+ modules/objfmts/elf/tests/curpos-err.asm \
+ modules/objfmts/elf/tests/curpos-err.errwarn \
+ modules/objfmts/elf/tests/elf-overdef.asm \
+ modules/objfmts/elf/tests/elf-overdef.hex \
+ modules/objfmts/elf/tests/elf-x86id.asm \
+ modules/objfmts/elf/tests/elf-x86id.hex \
+ modules/objfmts/elf/tests/elfabssect.asm \
+ modules/objfmts/elf/tests/elfabssect.hex \
+ modules/objfmts/elf/tests/elfcond.asm \
+ modules/objfmts/elf/tests/elfcond.hex \
+ modules/objfmts/elf/tests/elfequabs.asm \
+ modules/objfmts/elf/tests/elfequabs.hex \
+ modules/objfmts/elf/tests/elfglobal.asm \
+ modules/objfmts/elf/tests/elfglobal.hex \
+ modules/objfmts/elf/tests/elfglobext.asm \
+ modules/objfmts/elf/tests/elfglobext.hex \
+ modules/objfmts/elf/tests/elfglobext2.asm \
+ modules/objfmts/elf/tests/elfglobext2.hex \
+ modules/objfmts/elf/tests/elfmanysym.asm \
+ modules/objfmts/elf/tests/elfmanysym.hex \
+ modules/objfmts/elf/tests/elfreloc.asm \
+ modules/objfmts/elf/tests/elfreloc.hex \
+ modules/objfmts/elf/tests/elfreloc-ext.asm \
+ modules/objfmts/elf/tests/elfreloc-ext.hex \
+ modules/objfmts/elf/tests/elfsectalign.asm \
+ modules/objfmts/elf/tests/elfsectalign.hex \
+ modules/objfmts/elf/tests/elfso.asm \
+ modules/objfmts/elf/tests/elfso.hex \
+ modules/objfmts/elf/tests/elftest.c \
+ modules/objfmts/elf/tests/elftest.asm \
+ modules/objfmts/elf/tests/elftest.hex \
+ modules/objfmts/elf/tests/elftimes.asm \
+ modules/objfmts/elf/tests/elftimes.hex \
+ modules/objfmts/elf/tests/elftypesize.asm \
+ modules/objfmts/elf/tests/elftypesize.hex \
+ modules/objfmts/elf/tests/elfvisibility.asm \
+ modules/objfmts/elf/tests/elfvisibility.errwarn \
+ modules/objfmts/elf/tests/elfvisibility.hex \
+ modules/objfmts/elf/tests/nasm-sectname.asm \
+ modules/objfmts/elf/tests/nasm-sectname.hex \
+ modules/objfmts/elf/tests/nasm-forceident.asm \
+ modules/objfmts/elf/tests/nasm-forceident.hex \
+ modules/objfmts/elf/tests/amd64/Makefile.inc \
+ modules/objfmts/elf/tests/gas32/Makefile.inc \
+ modules/objfmts/elf/tests/gas64/Makefile.inc \
+ modules/objfmts/elf/tests/amd64/elf_amd64_test.sh \
+ modules/objfmts/elf/tests/amd64/elf-rip.asm \
+ modules/objfmts/elf/tests/amd64/elf-rip.hex \
+ modules/objfmts/elf/tests/amd64/elfso64.asm \
+ modules/objfmts/elf/tests/amd64/elfso64.hex \
+ modules/objfmts/elf/tests/amd64/gotpcrel.asm \
+ modules/objfmts/elf/tests/amd64/gotpcrel.hex \
+ modules/objfmts/elf/tests/gas32/elf_gas32_test.sh \
+ modules/objfmts/elf/tests/gas32/elf_gas32_ssym.asm \
+ modules/objfmts/elf/tests/gas32/elf_gas32_ssym.hex \
+ modules/objfmts/elf/tests/gas64/elf_gas64_test.sh \
+ modules/objfmts/elf/tests/gas64/crosssect.asm \
+ modules/objfmts/elf/tests/gas64/crosssect.hex \
+ modules/objfmts/elf/tests/gas64/elf_gas64_curpos.asm \
+ modules/objfmts/elf/tests/gas64/elf_gas64_curpos.hex \
+ modules/objfmts/elf/tests/gas64/elf_gas64_reloc.asm \
+ modules/objfmts/elf/tests/gas64/elf_gas64_reloc.hex \
+ modules/objfmts/elf/tests/gas64/elf_gas64_ssym.asm \
+ modules/objfmts/elf/tests/gas64/elf_gas64_ssym.hex \
+ modules/objfmts/coff/win64-nasm.mac \
+ modules/objfmts/coff/win64-gas.mac \
+ modules/objfmts/coff/tests/Makefile.inc \
+ modules/objfmts/coff/tests/coff_test.sh \
+ modules/objfmts/coff/tests/cofftest.c \
+ modules/objfmts/coff/tests/cofftest.asm \
+ modules/objfmts/coff/tests/cofftest.hex \
+ modules/objfmts/coff/tests/cofftimes.asm \
+ modules/objfmts/coff/tests/cofftimes.hex \
+ modules/objfmts/coff/tests/x86id.asm \
+ modules/objfmts/coff/tests/x86id.hex \
+ modules/objfmts/coff/tests/x86id.errwarn \
+ modules/objfmts/macho/tests/Makefile.inc \
+ modules/objfmts/macho/tests/gas32/Makefile.inc \
+ modules/objfmts/macho/tests/gas64/Makefile.inc \
+ modules/objfmts/macho/tests/nasm32/Makefile.inc \
+ modules/objfmts/macho/tests/nasm64/Makefile.inc \
+ modules/objfmts/macho/tests/gas32/gas_macho32_test.sh \
+ modules/objfmts/macho/tests/gas32/gas-macho32.asm \
+ modules/objfmts/macho/tests/gas32/gas-macho32.hex \
+ modules/objfmts/macho/tests/gas64/gas_macho64_test.sh \
+ modules/objfmts/macho/tests/gas64/gas-macho64.asm \
+ modules/objfmts/macho/tests/gas64/gas-macho64.hex \
+ modules/objfmts/macho/tests/gas64/gas-macho64-pic.asm \
+ modules/objfmts/macho/tests/gas64/gas-macho64-pic.hex \
+ modules/objfmts/macho/tests/nasm32/macho32_test.sh \
+ modules/objfmts/macho/tests/nasm32/machotest.c \
+ modules/objfmts/macho/tests/nasm32/machotest.asm \
+ modules/objfmts/macho/tests/nasm32/machotest.hex \
+ modules/objfmts/macho/tests/nasm32/macho-reloc.asm \
+ modules/objfmts/macho/tests/nasm32/macho-reloc.hex \
+ modules/objfmts/macho/tests/nasm32/macho32-sect.asm \
+ modules/objfmts/macho/tests/nasm32/macho32-sect.errwarn \
+ modules/objfmts/macho/tests/nasm32/macho32-sect.hex \
+ modules/objfmts/macho/tests/nasm64/nasm-macho64-pic.asm \
+ modules/objfmts/macho/tests/nasm64/nasm-macho64-pic.hex \
+ modules/objfmts/macho/tests/nasm64/macho64_test.sh \
+ modules/objfmts/macho/tests/nasm64/machotest64.c \
+ modules/objfmts/macho/tests/nasm64/machotest64.asm \
+ modules/objfmts/macho/tests/nasm64/machotest64.hex \
+ modules/objfmts/macho/tests/nasm64/macho-reloc64-err.asm \
+ modules/objfmts/macho/tests/nasm64/macho-reloc64-err.errwarn \
+ modules/objfmts/rdf/tests/Makefile.inc \
+ modules/objfmts/rdf/tests/rdf_test.sh \
+ modules/objfmts/rdf/tests/rdfabs.asm \
+ modules/objfmts/rdf/tests/rdfabs.errwarn \
+ modules/objfmts/rdf/tests/rdfabs.hex \
+ modules/objfmts/rdf/tests/rdfext.asm \
+ modules/objfmts/rdf/tests/rdfext.hex \
+ modules/objfmts/rdf/tests/rdfseg.asm \
+ modules/objfmts/rdf/tests/rdfseg.hex \
+ modules/objfmts/rdf/tests/rdfseg2.asm \
+ modules/objfmts/rdf/tests/rdfseg2.hex \
+ modules/objfmts/rdf/tests/rdftest1.asm \
+ modules/objfmts/rdf/tests/rdftest1.hex \
+ modules/objfmts/rdf/tests/rdftest2.asm \
+ modules/objfmts/rdf/tests/rdftest2.hex \
+ modules/objfmts/rdf/tests/rdtlib.asm \
+ modules/objfmts/rdf/tests/rdtlib.hex \
+ modules/objfmts/rdf/tests/rdtmain.asm \
+ modules/objfmts/rdf/tests/rdtmain.hex \
+ modules/objfmts/rdf/tests/testlib.asm \
+ modules/objfmts/rdf/tests/testlib.hex \
+ modules/objfmts/win32/tests/Makefile.inc \
+ modules/objfmts/win32/tests/export.asm \
+ modules/objfmts/win32/tests/export.hex \
+ modules/objfmts/win32/tests/win32_test.sh \
+ modules/objfmts/win32/tests/win32-curpos.asm \
+ modules/objfmts/win32/tests/win32-curpos.hex \
+ modules/objfmts/win32/tests/win32-overdef.asm \
+ modules/objfmts/win32/tests/win32-overdef.hex \
+ modules/objfmts/win32/tests/win32-safeseh.asm \
+ modules/objfmts/win32/tests/win32-safeseh.hex \
+ modules/objfmts/win32/tests/win32-safeseh.masm \
+ modules/objfmts/win32/tests/win32-segof.asm \
+ modules/objfmts/win32/tests/win32-segof.hex \
+ modules/objfmts/win32/tests/win32test.c \
+ modules/objfmts/win32/tests/win32test.asm \
+ modules/objfmts/win32/tests/win32test.hex \
+ modules/objfmts/win32/tests/gas/Makefile.inc \
+ modules/objfmts/win32/tests/gas/win32_gas_test.sh \
+ modules/objfmts/win32/tests/gas/win32at.asm \
+ modules/objfmts/win32/tests/gas/win32at.hex \
+ modules/objfmts/win64/tests/Makefile.inc \
+ modules/objfmts/win64/tests/win64_test.sh \
+ modules/objfmts/win64/tests/sce1.asm \
+ modules/objfmts/win64/tests/sce1.hex \
+ modules/objfmts/win64/tests/sce1-err.asm \
+ modules/objfmts/win64/tests/sce1-err.errwarn \
+ modules/objfmts/win64/tests/sce2.asm \
+ modules/objfmts/win64/tests/sce2.hex \
+ modules/objfmts/win64/tests/sce2-err.asm \
+ modules/objfmts/win64/tests/sce2-err.errwarn \
+ modules/objfmts/win64/tests/sce3.asm \
+ modules/objfmts/win64/tests/sce3.hex \
+ modules/objfmts/win64/tests/sce3.masm \
+ modules/objfmts/win64/tests/sce4.asm \
+ modules/objfmts/win64/tests/sce4.hex \
+ modules/objfmts/win64/tests/sce4.masm \
+ modules/objfmts/win64/tests/sce4-err.asm \
+ modules/objfmts/win64/tests/sce4-err.errwarn \
+ modules/objfmts/win64/tests/win64-abs.asm \
+ modules/objfmts/win64/tests/win64-abs.hex \
+ modules/objfmts/win64/tests/win64-curpos.asm \
+ modules/objfmts/win64/tests/win64-curpos.hex \
+ modules/objfmts/win64/tests/win64-dataref.asm \
+ modules/objfmts/win64/tests/win64-dataref.hex \
+ modules/objfmts/win64/tests/win64-dataref.masm \
+ modules/objfmts/win64/tests/win64-dataref2.asm \
+ modules/objfmts/win64/tests/win64-dataref2.hex \
+ modules/objfmts/win64/tests/win64-dataref2.masm \
+ modules/objfmts/win64/tests/gas/Makefile.inc \
+ modules/objfmts/win64/tests/gas/win64_gas_test.sh \
+ modules/objfmts/win64/tests/gas/win64-gas-sce.asm \
+ modules/objfmts/win64/tests/gas/win64-gas-sce.hex \
+ modules/objfmts/xdf/tests/Makefile.inc \
+ modules/objfmts/xdf/tests/xdf_test.sh \
+ modules/objfmts/xdf/tests/xdf-overdef.asm \
+ modules/objfmts/xdf/tests/xdf-overdef.hex \
+ modules/objfmts/xdf/tests/xdflong.asm \
+ modules/objfmts/xdf/tests/xdflong.hex \
+ modules/objfmts/xdf/tests/xdflong.errwarn \
+ modules/objfmts/xdf/tests/xdfother.asm \
+ modules/objfmts/xdf/tests/xdfother.hex \
+ modules/objfmts/xdf/tests/xdfprotect.asm \
+ modules/objfmts/xdf/tests/xdfprotect.hex \
+ modules/objfmts/xdf/tests/xdfsect.asm \
+ modules/objfmts/xdf/tests/xdfsect.hex \
+ modules/objfmts/xdf/tests/xdfsect-err.asm \
+ modules/objfmts/xdf/tests/xdfsect-err.errwarn \
+ modules/objfmts/xdf/tests/xdfvirtual.asm \
+ modules/objfmts/xdf/tests/xdfvirtual.hex \
+ modules/objfmts/yasm_objfmts.xml libyasm/genmodule.c \
+ libyasm/module.in libyasm/tests/Makefile.inc \
+ libyasm/tests/libyasm_test.sh libyasm/tests/1shl0.asm \
+ libyasm/tests/1shl0.hex libyasm/tests/absloop-err.asm \
+ libyasm/tests/absloop-err.errwarn \
+ libyasm/tests/charconst64.asm libyasm/tests/charconst64.hex \
+ libyasm/tests/data-rawvalue.asm \
+ libyasm/tests/data-rawvalue.hex libyasm/tests/duplabel-err.asm \
+ libyasm/tests/duplabel-err.errwarn libyasm/tests/emptydata.asm \
+ libyasm/tests/emptydata.hex libyasm/tests/equ-expand.asm \
+ libyasm/tests/equ-expand.hex libyasm/tests/expr-fold-level.asm \
+ libyasm/tests/expr-fold-level.hex \
+ libyasm/tests/expr-wide-ident.asm \
+ libyasm/tests/expr-wide-ident.hex libyasm/tests/externdef.asm \
+ libyasm/tests/externdef.errwarn libyasm/tests/externdef.hex \
+ libyasm/tests/incbin.asm libyasm/tests/incbin.hex \
+ libyasm/tests/jmpsize1.asm libyasm/tests/jmpsize1.hex \
+ libyasm/tests/jmpsize1-err.asm \
+ libyasm/tests/jmpsize1-err.errwarn \
+ libyasm/tests/opt-align1.asm libyasm/tests/opt-align1.hex \
+ libyasm/tests/opt-align2.asm libyasm/tests/opt-align2.hex \
+ libyasm/tests/opt-align3.asm libyasm/tests/opt-align3.hex \
+ libyasm/tests/opt-circular1-err.asm \
+ libyasm/tests/opt-circular1-err.errwarn \
+ libyasm/tests/opt-circular2-err.asm \
+ libyasm/tests/opt-circular2-err.errwarn \
+ libyasm/tests/opt-circular3-err.asm \
+ libyasm/tests/opt-circular3-err.errwarn \
+ libyasm/tests/opt-gvmat64.asm libyasm/tests/opt-gvmat64.hex \
+ libyasm/tests/opt-immexpand.asm \
+ libyasm/tests/opt-immexpand.hex \
+ libyasm/tests/opt-immnoexpand.asm \
+ libyasm/tests/opt-immnoexpand.hex \
+ libyasm/tests/opt-oldalign.asm libyasm/tests/opt-oldalign.hex \
+ libyasm/tests/opt-struc.asm libyasm/tests/opt-struc.hex \
+ libyasm/tests/reserve-err1.asm \
+ libyasm/tests/reserve-err1.errwarn \
+ libyasm/tests/reserve-err2.asm \
+ libyasm/tests/reserve-err2.errwarn libyasm/tests/strucsize.asm \
+ libyasm/tests/strucsize.hex libyasm/tests/times0.asm \
+ libyasm/tests/times0.hex libyasm/tests/timesover-err.asm \
+ libyasm/tests/timesover-err.errwarn \
+ libyasm/tests/timesunder.asm libyasm/tests/timesunder.hex \
+ libyasm/tests/times-res.asm libyasm/tests/times-res.errwarn \
+ libyasm/tests/times-res.hex libyasm/tests/unary.asm \
+ libyasm/tests/unary.hex libyasm/tests/value-err.asm \
+ libyasm/tests/value-err.errwarn \
+ libyasm/tests/value-samesym.asm \
+ libyasm/tests/value-samesym.errwarn \
+ libyasm/tests/value-samesym.hex libyasm/tests/value-mask.asm \
+ libyasm/tests/value-mask.errwarn libyasm/tests/value-mask.hex \
+ frontends/yasm/Makefile.inc frontends/tasm/Makefile.inc \
+ frontends/yasm/yasm.xml m4/intmax.m4 m4/longdouble.m4 \
+ m4/nls.m4 m4/po.m4 m4/printf-posix.m4 m4/signed.m4 \
+ m4/size_max.m4 m4/ulonglong.m4 m4/wchar_t.m4 m4/wint_t.m4 \
+ m4/xsize.m4 m4/codeset.m4 m4/gettext.m4 m4/glibc21.m4 \
+ m4/iconv.m4 m4/intdiv0.m4 m4/inttypes.m4 m4/inttypes_h.m4 \
+ m4/inttypes-pri.m4 m4/isc-posix.m4 m4/lcmessage.m4 \
+ m4/lib-ld.m4 m4/lib-link.m4 m4/lib-prefix.m4 m4/longlong.m4 \
+ m4/progtest.m4 m4/stdint_h.m4 m4/uintmax_t.m4 m4/pythonhead.m4 \
+ m4/pyrex.m4 out_test.sh Artistic.txt BSD.txt GNU_GPL-2.0 \
+ GNU_LGPL-2.0 splint.sh Mkfiles/Makefile.flat \
+ Mkfiles/Makefile.dj Mkfiles/dj/config.h \
+ Mkfiles/dj/libyasm-stdint.h \
+ Mkfiles/vc9/crt_secure_no_deprecate.vsprops \
+ Mkfiles/vc9/yasm.sln Mkfiles/vc9/yasm.vcproj \
+ Mkfiles/vc9/ytasm.vcproj Mkfiles/vc9/config.h \
+ Mkfiles/vc9/libyasm-stdint.h Mkfiles/vc9/readme.vc9.txt \
+ Mkfiles/vc9/yasm.rules Mkfiles/vc9/vc98_swap.py \
+ Mkfiles/vc9/genmacro/genmacro.vcproj \
+ Mkfiles/vc9/genmacro/run.bat \
+ Mkfiles/vc9/genmodule/genmodule.vcproj \
+ Mkfiles/vc9/genmodule/run.bat \
+ Mkfiles/vc9/genstring/genstring.vcproj \
+ Mkfiles/vc9/genstring/run.bat \
+ Mkfiles/vc9/genversion/genversion.vcproj \
+ Mkfiles/vc9/genversion/run.bat \
+ Mkfiles/vc9/libyasm/libyasm.vcproj \
+ Mkfiles/vc9/modules/modules.vcproj \
+ Mkfiles/vc9/re2c/re2c.vcproj Mkfiles/vc9/re2c/run.bat \
+ Mkfiles/vc9/genperf/genperf.vcproj Mkfiles/vc9/genperf/run.bat \
+ genstring.c
+
+# libyasm-stdint.h doesn't clean up after itself?
+CONFIG_CLEAN_FILES = libyasm-stdint.h
+re2c_SOURCES =
+re2c_LDADD = re2c-main.$(OBJEXT) re2c-code.$(OBJEXT) \
+ re2c-dfa.$(OBJEXT) re2c-parser.$(OBJEXT) \
+ re2c-actions.$(OBJEXT) re2c-scanner.$(OBJEXT) \
+ re2c-mbo_getopt.$(OBJEXT) re2c-substr.$(OBJEXT) \
+ re2c-translate.$(OBJEXT)
+re2c_LINK = $(CCLD_FOR_BUILD) -o $@
+genmacro_SOURCES =
+genmacro_LDADD = genmacro.$(OBJEXT)
+genmacro_LINK = $(CCLD_FOR_BUILD) -o $@
+genperf_SOURCES =
+genperf_LDADD = genperf.$(OBJEXT) gp-perfect.$(OBJEXT) \
+ gp-phash.$(OBJEXT) gp-xmalloc.$(OBJEXT) gp-xstrdup.$(OBJEXT)
+genperf_LINK = $(CCLD_FOR_BUILD) -o $@
+PYBINDING_DEPS = tools/python-yasm/bytecode.pxi \
+ tools/python-yasm/errwarn.pxi tools/python-yasm/expr.pxi \
+ tools/python-yasm/floatnum.pxi tools/python-yasm/intnum.pxi \
+ tools/python-yasm/symrec.pxi tools/python-yasm/value.pxi
+YASM_MODULES = arch_x86 arch_lc3b listfmt_nasm parser_gas parser_gnu \
+ parser_nasm parser_tasm preproc_nasm preproc_tasm preproc_raw \
+ preproc_cpp dbgfmt_cv8 dbgfmt_dwarf2 dbgfmt_null dbgfmt_stabs \
+ objfmt_dbg objfmt_bin objfmt_dosexe objfmt_elf objfmt_elf32 \
+ objfmt_elf64 objfmt_coff objfmt_macho objfmt_macho32 \
+ objfmt_macho64 objfmt_rdf objfmt_win32 objfmt_win64 objfmt_x64 \
+ objfmt_xdf
+lib_LIBRARIES = libyasm.a
+libyasm_a_SOURCES = modules/arch/x86/x86arch.c \
+ modules/arch/x86/x86arch.h modules/arch/x86/x86bc.c \
+ modules/arch/x86/x86expr.c modules/arch/x86/x86id.c \
+ modules/arch/lc3b/lc3barch.c modules/arch/lc3b/lc3barch.h \
+ modules/arch/lc3b/lc3bbc.c \
+ modules/listfmts/nasm/nasm-listfmt.c \
+ modules/parsers/gas/gas-parser.c \
+ modules/parsers/gas/gas-parser.h \
+ modules/parsers/gas/gas-parse.c \
+ modules/parsers/nasm/nasm-parser.c \
+ modules/parsers/nasm/nasm-parser.h \
+ modules/parsers/nasm/nasm-parse.c \
+ modules/preprocs/nasm/nasm-preproc.c \
+ modules/preprocs/nasm/nasm-pp.h \
+ modules/preprocs/nasm/nasm-pp.c modules/preprocs/nasm/nasm.h \
+ modules/preprocs/nasm/nasmlib.h \
+ modules/preprocs/nasm/nasmlib.c \
+ modules/preprocs/nasm/nasm-eval.h \
+ modules/preprocs/nasm/nasm-eval.c \
+ modules/preprocs/raw/raw-preproc.c \
+ modules/preprocs/cpp/cpp-preproc.c \
+ modules/dbgfmts/codeview/cv-dbgfmt.h \
+ modules/dbgfmts/codeview/cv-dbgfmt.c \
+ modules/dbgfmts/codeview/cv-symline.c \
+ modules/dbgfmts/codeview/cv-type.c \
+ modules/dbgfmts/dwarf2/dwarf2-dbgfmt.h \
+ modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c \
+ modules/dbgfmts/dwarf2/dwarf2-line.c \
+ modules/dbgfmts/dwarf2/dwarf2-aranges.c \
+ modules/dbgfmts/dwarf2/dwarf2-info.c \
+ modules/dbgfmts/null/null-dbgfmt.c \
+ modules/dbgfmts/stabs/stabs-dbgfmt.c \
+ modules/objfmts/dbg/dbg-objfmt.c \
+ modules/objfmts/bin/bin-objfmt.c modules/objfmts/elf/elf.c \
+ modules/objfmts/elf/elf.h modules/objfmts/elf/elf-objfmt.c \
+ modules/objfmts/elf/elf-machine.h \
+ modules/objfmts/elf/elf-x86-x86.c \
+ modules/objfmts/elf/elf-x86-amd64.c \
+ modules/objfmts/coff/coff-objfmt.c \
+ modules/objfmts/coff/coff-objfmt.h \
+ modules/objfmts/coff/win64-except.c \
+ modules/objfmts/macho/macho-objfmt.c \
+ modules/objfmts/rdf/rdf-objfmt.c \
+ modules/objfmts/xdf/xdf-objfmt.c libyasm/assocdat.c \
+ libyasm/bitvect.c libyasm/bc-align.c libyasm/bc-data.c \
+ libyasm/bc-incbin.c libyasm/bc-org.c libyasm/bc-reserve.c \
+ libyasm/bytecode.c libyasm/errwarn.c libyasm/expr.c \
+ libyasm/file.c libyasm/floatnum.c libyasm/hamt.c \
+ libyasm/insn.c libyasm/intnum.c libyasm/inttree.c \
+ libyasm/linemap.c libyasm/md5.c libyasm/mergesort.c \
+ libyasm/phash.c libyasm/section.c libyasm/strcasecmp.c \
+ libyasm/strsep.c libyasm/symrec.c libyasm/valparam.c \
+ libyasm/value.c libyasm/xmalloc.c libyasm/xstrdup.c
+nodist_libyasm_a_SOURCES = x86cpu.c x86regtmod.c lc3bid.c gas-token.c \
+ nasm-token.c module.c
+genversion_SOURCES =
+genversion_LDADD = genversion.$(OBJEXT)
+genversion_LINK = $(CCLD_FOR_BUILD) -o $@
+genmodule_SOURCES =
+genmodule_LDADD = genmodule.$(OBJEXT)
+genmodule_LINK = $(CCLD_FOR_BUILD) -o $@
+modincludedir = $(includedir)/libyasm
+modinclude_HEADERS = libyasm/arch.h libyasm/assocdat.h \
+ libyasm/bitvect.h libyasm/bytecode.h libyasm/compat-queue.h \
+ libyasm/coretype.h libyasm/dbgfmt.h libyasm/errwarn.h \
+ libyasm/expr.h libyasm/file.h libyasm/floatnum.h \
+ libyasm/hamt.h libyasm/insn.h libyasm/intnum.h \
+ libyasm/inttree.h libyasm/linemap.h libyasm/listfmt.h \
+ libyasm/md5.h libyasm/module.h libyasm/objfmt.h \
+ libyasm/parser.h libyasm/phash.h libyasm/preproc.h \
+ libyasm/section.h libyasm/symrec.h libyasm/valparam.h \
+ libyasm/value.h
+bitvect_test_SOURCES = libyasm/tests/bitvect_test.c
+bitvect_test_LDADD = libyasm.a $(INTLLIBS)
+floatnum_test_SOURCES = libyasm/tests/floatnum_test.c
+floatnum_test_LDADD = libyasm.a $(INTLLIBS)
+leb128_test_SOURCES = libyasm/tests/leb128_test.c
+leb128_test_LDADD = libyasm.a $(INTLLIBS)
+splitpath_test_SOURCES = libyasm/tests/splitpath_test.c
+splitpath_test_LDADD = libyasm.a $(INTLLIBS)
+combpath_test_SOURCES = libyasm/tests/combpath_test.c
+combpath_test_LDADD = libyasm.a $(INTLLIBS)
+uncstring_test_SOURCES = libyasm/tests/uncstring_test.c
+uncstring_test_LDADD = libyasm.a $(INTLLIBS)
+yasm_SOURCES = frontends/yasm/yasm.c frontends/yasm/yasm-options.c \
+ frontends/yasm/yasm-options.h
+yasm_LDADD = libyasm.a $(INTLLIBS)
+ytasm_SOURCES = frontends/tasm/tasm.c frontends/tasm/tasm-options.c \
+ frontends/tasm/tasm-options.h
+ytasm_LDADD = libyasm.a $(INTLLIBS)
+ACLOCAL_AMFLAGS = -I m4
+
+# genstring build
+genstring_SOURCES =
+genstring_LDADD = genstring.$(OBJEXT)
+genstring_LINK = $(CCLD_FOR_BUILD) -o $@
+all: $(BUILT_SOURCES) config.h
+ $(MAKE) $(AM_MAKEFLAGS) all-recursive
+
+.SUFFIXES:
+.SUFFIXES: .gperf .c .o .obj
+am--refresh:
+ @:
+$(srcdir)/Makefile.in: # $(srcdir)/Makefile.am $(srcdir)/tools/Makefile.inc $(srcdir)/tools/re2c/Makefile.inc $(srcdir)/tools/genmacro/Makefile.inc $(srcdir)/tools/genperf/Makefile.inc $(srcdir)/tools/python-yasm/Makefile.inc $(srcdir)/tools/python-yasm/tests/Makefile.inc $(srcdir)/modules/Makefile.inc $(srcdir)/modules/arch/Makefile.inc $(srcdir)/modules/arch/x86/Makefile.inc $(srcdir)/modules/arch/x86/tests/Makefile.inc $(srcdir)/modules/arch/x86/tests/gas32/Makefile.inc $(srcdir)/modules/arch/x86/tests/gas64/Makefile.inc $(srcdir)/modules/arch/lc3b/Makefile.inc $(srcdir)/modules/arch/lc3b/tests/Makefile.inc $(srcdir)/modules/listfmts/Makefile.inc $(srcdir)/modules/listfmts/nasm/Makefile.inc $(srcdir)/modules/parsers/Makefile.inc $(srcdir)/modules/parsers/gas/Makefile.inc $(srcdir)/modules/parsers/gas/tests/Makefile.inc $(srcdir)/modules/parsers/gas/tests/bin/Makefile.inc $(srcdir)/modules/parsers/nasm/Makefile.inc $(srcdir)/modules/parsers/nasm/tests/Makefile.inc $(srcdir)/modules/parsers/nasm/tests/worphan/Makefile.inc $(srcdir)/modules/parsers/tasm/Makefile.inc $(srcdir)/modules/parsers/tasm/tests/Makefile.inc $(srcdir)/modules/parsers/tasm/tests/exe/Makefile.inc $(srcdir)/modules/preprocs/Makefile.inc $(srcdir)/modules/preprocs/nasm/Makefile.inc $(srcdir)/modules/preprocs/nasm/tests/Makefile.inc $(srcdir)/modules/preprocs/raw/Makefile.inc $(srcdir)/modules/preprocs/raw/tests/Makefile.inc $(srcdir)/modules/preprocs/cpp/Makefile.inc $(srcdir)/modules/dbgfmts/Makefile.inc $(srcdir)/modules/dbgfmts/codeview/Makefile.inc $(srcdir)/modules/dbgfmts/dwarf2/Makefile.inc $(srcdir)/modules/dbgfmts/dwarf2/tests/Makefile.inc $(srcdir)/modules/dbgfmts/dwarf2/tests/pass32/Makefile.inc $(srcdir)/modules/dbgfmts/dwarf2/tests/pass64/Makefile.inc $(srcdir)/modules/dbgfmts/dwarf2/tests/passwin64/Makefile.inc $(srcdir)/modules/dbgfmts/null/Makefile.inc $(srcdir)/modules/dbgfmts/stabs/Makefile.inc $(srcdir)/modules/dbgfmts/stabs/tests/Makefile.inc $(srcdir)/modules/objfmts/Makefile.inc $(srcdir)/modules/objfmts/dbg/Makefile.inc $(srcdir)/modules/objfmts/bin/Makefile.inc $(srcdir)/modules/objfmts/bin/tests/Makefile.inc $(srcdir)/modules/objfmts/bin/tests/multisect/Makefile.inc $(srcdir)/modules/objfmts/elf/Makefile.inc $(srcdir)/modules/objfmts/elf/tests/Makefile.inc $(srcdir)/modules/objfmts/elf/tests/amd64/Makefile.inc $(srcdir)/modules/objfmts/elf/tests/gas32/Makefile.inc $(srcdir)/modules/objfmts/elf/tests/gas64/Makefile.inc $(srcdir)/modules/objfmts/coff/Makefile.inc $(srcdir)/modules/objfmts/coff/tests/Makefile.inc $(srcdir)/modules/objfmts/macho/Makefile.inc $(srcdir)/modules/objfmts/macho/tests/Makefile.inc $(srcdir)/modules/objfmts/macho/tests/gas32/Makefile.inc $(srcdir)/modules/objfmts/macho/tests/gas64/Makefile.inc $(srcdir)/modules/objfmts/macho/tests/nasm32/Makefile.inc $(srcdir)/modules/objfmts/macho/tests/nasm64/Makefile.inc $(srcdir)/modules/objfmts/rdf/Makefile.inc $(srcdir)/modules/objfmts/rdf/tests/Makefile.inc $(srcdir)/modules/objfmts/win32/Makefile.inc $(srcdir)/modules/objfmts/win32/tests/Makefile.inc $(srcdir)/modules/objfmts/win32/tests/gas/Makefile.inc $(srcdir)/modules/objfmts/win64/Makefile.inc $(srcdir)/modules/objfmts/win64/tests/Makefile.inc $(srcdir)/modules/objfmts/win64/tests/gas/Makefile.inc $(srcdir)/modules/objfmts/xdf/Makefile.inc $(srcdir)/modules/objfmts/xdf/tests/Makefile.inc $(srcdir)/libyasm/Makefile.inc $(srcdir)/libyasm/tests/Makefile.inc $(srcdir)/frontends/Makefile.inc $(srcdir)/frontends/yasm/Makefile.inc $(srcdir)/frontends/tasm/Makefile.inc $(srcdir)/m4/Makefile.inc $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \
+ cd $(srcdir) && $(AUTOMAKE) --gnu \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ echo ' $(SHELL) ./config.status'; \
+ $(SHELL) ./config.status;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ $(SHELL) ./config.status --recheck
+
+$(top_srcdir)/configure: # $(am__configure_deps)
+ cd $(srcdir) && $(AUTOCONF)
+$(ACLOCAL_M4): # $(am__aclocal_m4_deps)
+ cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+
+config.h: stamp-h1
+ @if test ! -f $@; then \
+ rm -f stamp-h1; \
+ $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \
+ else :; fi
+
+stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
+ @rm -f stamp-h1
+ cd $(top_builddir) && $(SHELL) ./config.status config.h
+$(srcdir)/config.h.in: # $(am__configure_deps)
+ cd $(top_srcdir) && $(AUTOHEADER)
+ rm -f stamp-h1
+ touch $@
+
+distclean-hdr:
+ -rm -f config.h stamp-h1
+install-libLIBRARIES: $(lib_LIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
+ @list='$(lib_LIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f=$(am__strip_dir) \
+ echo " $(libLIBRARIES_INSTALL) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
+ $(libLIBRARIES_INSTALL) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
+ else :; fi; \
+ done
+ @$(POST_INSTALL)
+ @list='$(lib_LIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ p=$(am__strip_dir) \
+ echo " $(RANLIB) '$(DESTDIR)$(libdir)/$$p'"; \
+ $(RANLIB) "$(DESTDIR)$(libdir)/$$p"; \
+ else :; fi; \
+ done
+
+uninstall-libLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(lib_LIBRARIES)'; for p in $$list; do \
+ p=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(libdir)/$$p'"; \
+ rm -f "$(DESTDIR)$(libdir)/$$p"; \
+ done
+
+clean-libLIBRARIES:
+ -test -z "$(lib_LIBRARIES)" || rm -f $(lib_LIBRARIES)
+libyasm.a: $(libyasm_a_OBJECTS) $(libyasm_a_DEPENDENCIES)
+ -rm -f libyasm.a
+ $(libyasm_a_AR) libyasm.a $(libyasm_a_OBJECTS) $(libyasm_a_LIBADD)
+ $(RANLIB) libyasm.a
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+
+clean-checkPROGRAMS:
+ -test -z "$(check_PROGRAMS)" || rm -f $(check_PROGRAMS)
+
+clean-noinstPROGRAMS:
+ -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS)
+bitvect_test$(EXEEXT): $(bitvect_test_OBJECTS) $(bitvect_test_DEPENDENCIES)
+ @rm -f bitvect_test$(EXEEXT)
+ $(LINK) $(bitvect_test_OBJECTS) $(bitvect_test_LDADD) $(LIBS)
+combpath_test$(EXEEXT): $(combpath_test_OBJECTS) $(combpath_test_DEPENDENCIES)
+ @rm -f combpath_test$(EXEEXT)
+ $(LINK) $(combpath_test_OBJECTS) $(combpath_test_LDADD) $(LIBS)
+floatnum_test$(EXEEXT): $(floatnum_test_OBJECTS) $(floatnum_test_DEPENDENCIES)
+ @rm -f floatnum_test$(EXEEXT)
+ $(LINK) $(floatnum_test_OBJECTS) $(floatnum_test_LDADD) $(LIBS)
+genmacro$(EXEEXT): $(genmacro_OBJECTS) $(genmacro_DEPENDENCIES)
+ @rm -f genmacro$(EXEEXT)
+ $(genmacro_LINK) $(genmacro_OBJECTS) $(genmacro_LDADD) $(LIBS)
+genmodule$(EXEEXT): $(genmodule_OBJECTS) $(genmodule_DEPENDENCIES)
+ @rm -f genmodule$(EXEEXT)
+ $(genmodule_LINK) $(genmodule_OBJECTS) $(genmodule_LDADD) $(LIBS)
+genperf$(EXEEXT): $(genperf_OBJECTS) $(genperf_DEPENDENCIES)
+ @rm -f genperf$(EXEEXT)
+ $(genperf_LINK) $(genperf_OBJECTS) $(genperf_LDADD) $(LIBS)
+genstring$(EXEEXT): $(genstring_OBJECTS) $(genstring_DEPENDENCIES)
+ @rm -f genstring$(EXEEXT)
+ $(genstring_LINK) $(genstring_OBJECTS) $(genstring_LDADD) $(LIBS)
+genversion$(EXEEXT): $(genversion_OBJECTS) $(genversion_DEPENDENCIES)
+ @rm -f genversion$(EXEEXT)
+ $(genversion_LINK) $(genversion_OBJECTS) $(genversion_LDADD) $(LIBS)
+leb128_test$(EXEEXT): $(leb128_test_OBJECTS) $(leb128_test_DEPENDENCIES)
+ @rm -f leb128_test$(EXEEXT)
+ $(LINK) $(leb128_test_OBJECTS) $(leb128_test_LDADD) $(LIBS)
+re2c$(EXEEXT): $(re2c_OBJECTS) $(re2c_DEPENDENCIES)
+ @rm -f re2c$(EXEEXT)
+ $(re2c_LINK) $(re2c_OBJECTS) $(re2c_LDADD) $(LIBS)
+splitpath_test$(EXEEXT): $(splitpath_test_OBJECTS) $(splitpath_test_DEPENDENCIES)
+ @rm -f splitpath_test$(EXEEXT)
+ $(LINK) $(splitpath_test_OBJECTS) $(splitpath_test_LDADD) $(LIBS)
+test_hd$(EXEEXT): $(test_hd_OBJECTS) $(test_hd_DEPENDENCIES)
+ @rm -f test_hd$(EXEEXT)
+ $(LINK) $(test_hd_OBJECTS) $(test_hd_LDADD) $(LIBS)
+uncstring_test$(EXEEXT): $(uncstring_test_OBJECTS) $(uncstring_test_DEPENDENCIES)
+ @rm -f uncstring_test$(EXEEXT)
+ $(LINK) $(uncstring_test_OBJECTS) $(uncstring_test_LDADD) $(LIBS)
+yasm$(EXEEXT): $(yasm_OBJECTS) $(yasm_DEPENDENCIES)
+ @rm -f yasm$(EXEEXT)
+ $(LINK) $(yasm_OBJECTS) $(yasm_LDADD) $(LIBS)
+ytasm$(EXEEXT): $(ytasm_OBJECTS) $(ytasm_DEPENDENCIES)
+ @rm -f ytasm$(EXEEXT)
+ $(LINK) $(ytasm_OBJECTS) $(ytasm_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+include ./$(DEPDIR)/assocdat.Po
+include ./$(DEPDIR)/bc-align.Po
+include ./$(DEPDIR)/bc-data.Po
+include ./$(DEPDIR)/bc-incbin.Po
+include ./$(DEPDIR)/bc-org.Po
+include ./$(DEPDIR)/bc-reserve.Po
+include ./$(DEPDIR)/bin-objfmt.Po
+include ./$(DEPDIR)/bitvect.Po
+include ./$(DEPDIR)/bitvect_test.Po
+include ./$(DEPDIR)/bytecode.Po
+include ./$(DEPDIR)/coff-objfmt.Po
+include ./$(DEPDIR)/combpath_test.Po
+include ./$(DEPDIR)/cpp-preproc.Po
+include ./$(DEPDIR)/cv-dbgfmt.Po
+include ./$(DEPDIR)/cv-symline.Po
+include ./$(DEPDIR)/cv-type.Po
+include ./$(DEPDIR)/dbg-objfmt.Po
+include ./$(DEPDIR)/dwarf2-aranges.Po
+include ./$(DEPDIR)/dwarf2-dbgfmt.Po
+include ./$(DEPDIR)/dwarf2-info.Po
+include ./$(DEPDIR)/dwarf2-line.Po
+include ./$(DEPDIR)/elf-objfmt.Po
+include ./$(DEPDIR)/elf-x86-amd64.Po
+include ./$(DEPDIR)/elf-x86-x86.Po
+include ./$(DEPDIR)/elf.Po
+include ./$(DEPDIR)/errwarn.Po
+include ./$(DEPDIR)/expr.Po
+include ./$(DEPDIR)/file.Po
+include ./$(DEPDIR)/floatnum.Po
+include ./$(DEPDIR)/floatnum_test.Po
+include ./$(DEPDIR)/gas-parse.Po
+include ./$(DEPDIR)/gas-parser.Po
+include ./$(DEPDIR)/gas-token.Po
+include ./$(DEPDIR)/hamt.Po
+include ./$(DEPDIR)/insn.Po
+include ./$(DEPDIR)/intnum.Po
+include ./$(DEPDIR)/inttree.Po
+include ./$(DEPDIR)/lc3barch.Po
+include ./$(DEPDIR)/lc3bbc.Po
+include ./$(DEPDIR)/lc3bid.Po
+include ./$(DEPDIR)/leb128_test.Po
+include ./$(DEPDIR)/linemap.Po
+include ./$(DEPDIR)/macho-objfmt.Po
+include ./$(DEPDIR)/md5.Po
+include ./$(DEPDIR)/mergesort.Po
+include ./$(DEPDIR)/module.Po
+include ./$(DEPDIR)/nasm-eval.Po
+include ./$(DEPDIR)/nasm-listfmt.Po
+include ./$(DEPDIR)/nasm-parse.Po
+include ./$(DEPDIR)/nasm-parser.Po
+include ./$(DEPDIR)/nasm-pp.Po
+include ./$(DEPDIR)/nasm-preproc.Po
+include ./$(DEPDIR)/nasm-token.Po
+include ./$(DEPDIR)/nasmlib.Po
+include ./$(DEPDIR)/null-dbgfmt.Po
+include ./$(DEPDIR)/phash.Po
+include ./$(DEPDIR)/raw-preproc.Po
+include ./$(DEPDIR)/rdf-objfmt.Po
+include ./$(DEPDIR)/section.Po
+include ./$(DEPDIR)/splitpath_test.Po
+include ./$(DEPDIR)/stabs-dbgfmt.Po
+include ./$(DEPDIR)/strcasecmp.Po
+include ./$(DEPDIR)/strsep.Po
+include ./$(DEPDIR)/symrec.Po
+include ./$(DEPDIR)/tasm-options.Po
+include ./$(DEPDIR)/tasm.Po
+include ./$(DEPDIR)/test_hd.Po
+include ./$(DEPDIR)/uncstring_test.Po
+include ./$(DEPDIR)/valparam.Po
+include ./$(DEPDIR)/value.Po
+include ./$(DEPDIR)/win64-except.Po
+include ./$(DEPDIR)/x86arch.Po
+include ./$(DEPDIR)/x86bc.Po
+include ./$(DEPDIR)/x86cpu.Po
+include ./$(DEPDIR)/x86expr.Po
+include ./$(DEPDIR)/x86id.Po
+include ./$(DEPDIR)/x86regtmod.Po
+include ./$(DEPDIR)/xdf-objfmt.Po
+include ./$(DEPDIR)/xmalloc.Po
+include ./$(DEPDIR)/xstrdup.Po
+include ./$(DEPDIR)/yasm-options.Po
+include ./$(DEPDIR)/yasm.Po
+
+.c.o:
+ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+# source='$<' object='$@' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(COMPILE) -c $<
+
+.c.obj:
+ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+# source='$<' object='$@' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+x86arch.o: modules/arch/x86/x86arch.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT x86arch.o -MD -MP -MF $(DEPDIR)/x86arch.Tpo -c -o x86arch.o `test -f 'modules/arch/x86/x86arch.c' || echo '$(srcdir)/'`modules/arch/x86/x86arch.c
+ mv -f $(DEPDIR)/x86arch.Tpo $(DEPDIR)/x86arch.Po
+# source='modules/arch/x86/x86arch.c' object='x86arch.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o x86arch.o `test -f 'modules/arch/x86/x86arch.c' || echo '$(srcdir)/'`modules/arch/x86/x86arch.c
+
+x86arch.obj: modules/arch/x86/x86arch.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT x86arch.obj -MD -MP -MF $(DEPDIR)/x86arch.Tpo -c -o x86arch.obj `if test -f 'modules/arch/x86/x86arch.c'; then $(CYGPATH_W) 'modules/arch/x86/x86arch.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/x86/x86arch.c'; fi`
+ mv -f $(DEPDIR)/x86arch.Tpo $(DEPDIR)/x86arch.Po
+# source='modules/arch/x86/x86arch.c' object='x86arch.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o x86arch.obj `if test -f 'modules/arch/x86/x86arch.c'; then $(CYGPATH_W) 'modules/arch/x86/x86arch.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/x86/x86arch.c'; fi`
+
+x86bc.o: modules/arch/x86/x86bc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT x86bc.o -MD -MP -MF $(DEPDIR)/x86bc.Tpo -c -o x86bc.o `test -f 'modules/arch/x86/x86bc.c' || echo '$(srcdir)/'`modules/arch/x86/x86bc.c
+ mv -f $(DEPDIR)/x86bc.Tpo $(DEPDIR)/x86bc.Po
+# source='modules/arch/x86/x86bc.c' object='x86bc.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o x86bc.o `test -f 'modules/arch/x86/x86bc.c' || echo '$(srcdir)/'`modules/arch/x86/x86bc.c
+
+x86bc.obj: modules/arch/x86/x86bc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT x86bc.obj -MD -MP -MF $(DEPDIR)/x86bc.Tpo -c -o x86bc.obj `if test -f 'modules/arch/x86/x86bc.c'; then $(CYGPATH_W) 'modules/arch/x86/x86bc.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/x86/x86bc.c'; fi`
+ mv -f $(DEPDIR)/x86bc.Tpo $(DEPDIR)/x86bc.Po
+# source='modules/arch/x86/x86bc.c' object='x86bc.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o x86bc.obj `if test -f 'modules/arch/x86/x86bc.c'; then $(CYGPATH_W) 'modules/arch/x86/x86bc.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/x86/x86bc.c'; fi`
+
+x86expr.o: modules/arch/x86/x86expr.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT x86expr.o -MD -MP -MF $(DEPDIR)/x86expr.Tpo -c -o x86expr.o `test -f 'modules/arch/x86/x86expr.c' || echo '$(srcdir)/'`modules/arch/x86/x86expr.c
+ mv -f $(DEPDIR)/x86expr.Tpo $(DEPDIR)/x86expr.Po
+# source='modules/arch/x86/x86expr.c' object='x86expr.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o x86expr.o `test -f 'modules/arch/x86/x86expr.c' || echo '$(srcdir)/'`modules/arch/x86/x86expr.c
+
+x86expr.obj: modules/arch/x86/x86expr.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT x86expr.obj -MD -MP -MF $(DEPDIR)/x86expr.Tpo -c -o x86expr.obj `if test -f 'modules/arch/x86/x86expr.c'; then $(CYGPATH_W) 'modules/arch/x86/x86expr.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/x86/x86expr.c'; fi`
+ mv -f $(DEPDIR)/x86expr.Tpo $(DEPDIR)/x86expr.Po
+# source='modules/arch/x86/x86expr.c' object='x86expr.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o x86expr.obj `if test -f 'modules/arch/x86/x86expr.c'; then $(CYGPATH_W) 'modules/arch/x86/x86expr.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/x86/x86expr.c'; fi`
+
+x86id.o: modules/arch/x86/x86id.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT x86id.o -MD -MP -MF $(DEPDIR)/x86id.Tpo -c -o x86id.o `test -f 'modules/arch/x86/x86id.c' || echo '$(srcdir)/'`modules/arch/x86/x86id.c
+ mv -f $(DEPDIR)/x86id.Tpo $(DEPDIR)/x86id.Po
+# source='modules/arch/x86/x86id.c' object='x86id.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o x86id.o `test -f 'modules/arch/x86/x86id.c' || echo '$(srcdir)/'`modules/arch/x86/x86id.c
+
+x86id.obj: modules/arch/x86/x86id.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT x86id.obj -MD -MP -MF $(DEPDIR)/x86id.Tpo -c -o x86id.obj `if test -f 'modules/arch/x86/x86id.c'; then $(CYGPATH_W) 'modules/arch/x86/x86id.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/x86/x86id.c'; fi`
+ mv -f $(DEPDIR)/x86id.Tpo $(DEPDIR)/x86id.Po
+# source='modules/arch/x86/x86id.c' object='x86id.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o x86id.obj `if test -f 'modules/arch/x86/x86id.c'; then $(CYGPATH_W) 'modules/arch/x86/x86id.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/x86/x86id.c'; fi`
+
+lc3barch.o: modules/arch/lc3b/lc3barch.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lc3barch.o -MD -MP -MF $(DEPDIR)/lc3barch.Tpo -c -o lc3barch.o `test -f 'modules/arch/lc3b/lc3barch.c' || echo '$(srcdir)/'`modules/arch/lc3b/lc3barch.c
+ mv -f $(DEPDIR)/lc3barch.Tpo $(DEPDIR)/lc3barch.Po
+# source='modules/arch/lc3b/lc3barch.c' object='lc3barch.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lc3barch.o `test -f 'modules/arch/lc3b/lc3barch.c' || echo '$(srcdir)/'`modules/arch/lc3b/lc3barch.c
+
+lc3barch.obj: modules/arch/lc3b/lc3barch.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lc3barch.obj -MD -MP -MF $(DEPDIR)/lc3barch.Tpo -c -o lc3barch.obj `if test -f 'modules/arch/lc3b/lc3barch.c'; then $(CYGPATH_W) 'modules/arch/lc3b/lc3barch.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/lc3b/lc3barch.c'; fi`
+ mv -f $(DEPDIR)/lc3barch.Tpo $(DEPDIR)/lc3barch.Po
+# source='modules/arch/lc3b/lc3barch.c' object='lc3barch.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lc3barch.obj `if test -f 'modules/arch/lc3b/lc3barch.c'; then $(CYGPATH_W) 'modules/arch/lc3b/lc3barch.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/lc3b/lc3barch.c'; fi`
+
+lc3bbc.o: modules/arch/lc3b/lc3bbc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lc3bbc.o -MD -MP -MF $(DEPDIR)/lc3bbc.Tpo -c -o lc3bbc.o `test -f 'modules/arch/lc3b/lc3bbc.c' || echo '$(srcdir)/'`modules/arch/lc3b/lc3bbc.c
+ mv -f $(DEPDIR)/lc3bbc.Tpo $(DEPDIR)/lc3bbc.Po
+# source='modules/arch/lc3b/lc3bbc.c' object='lc3bbc.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lc3bbc.o `test -f 'modules/arch/lc3b/lc3bbc.c' || echo '$(srcdir)/'`modules/arch/lc3b/lc3bbc.c
+
+lc3bbc.obj: modules/arch/lc3b/lc3bbc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lc3bbc.obj -MD -MP -MF $(DEPDIR)/lc3bbc.Tpo -c -o lc3bbc.obj `if test -f 'modules/arch/lc3b/lc3bbc.c'; then $(CYGPATH_W) 'modules/arch/lc3b/lc3bbc.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/lc3b/lc3bbc.c'; fi`
+ mv -f $(DEPDIR)/lc3bbc.Tpo $(DEPDIR)/lc3bbc.Po
+# source='modules/arch/lc3b/lc3bbc.c' object='lc3bbc.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lc3bbc.obj `if test -f 'modules/arch/lc3b/lc3bbc.c'; then $(CYGPATH_W) 'modules/arch/lc3b/lc3bbc.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/lc3b/lc3bbc.c'; fi`
+
+nasm-listfmt.o: modules/listfmts/nasm/nasm-listfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-listfmt.o -MD -MP -MF $(DEPDIR)/nasm-listfmt.Tpo -c -o nasm-listfmt.o `test -f 'modules/listfmts/nasm/nasm-listfmt.c' || echo '$(srcdir)/'`modules/listfmts/nasm/nasm-listfmt.c
+ mv -f $(DEPDIR)/nasm-listfmt.Tpo $(DEPDIR)/nasm-listfmt.Po
+# source='modules/listfmts/nasm/nasm-listfmt.c' object='nasm-listfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-listfmt.o `test -f 'modules/listfmts/nasm/nasm-listfmt.c' || echo '$(srcdir)/'`modules/listfmts/nasm/nasm-listfmt.c
+
+nasm-listfmt.obj: modules/listfmts/nasm/nasm-listfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-listfmt.obj -MD -MP -MF $(DEPDIR)/nasm-listfmt.Tpo -c -o nasm-listfmt.obj `if test -f 'modules/listfmts/nasm/nasm-listfmt.c'; then $(CYGPATH_W) 'modules/listfmts/nasm/nasm-listfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/listfmts/nasm/nasm-listfmt.c'; fi`
+ mv -f $(DEPDIR)/nasm-listfmt.Tpo $(DEPDIR)/nasm-listfmt.Po
+# source='modules/listfmts/nasm/nasm-listfmt.c' object='nasm-listfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-listfmt.obj `if test -f 'modules/listfmts/nasm/nasm-listfmt.c'; then $(CYGPATH_W) 'modules/listfmts/nasm/nasm-listfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/listfmts/nasm/nasm-listfmt.c'; fi`
+
+gas-parser.o: modules/parsers/gas/gas-parser.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gas-parser.o -MD -MP -MF $(DEPDIR)/gas-parser.Tpo -c -o gas-parser.o `test -f 'modules/parsers/gas/gas-parser.c' || echo '$(srcdir)/'`modules/parsers/gas/gas-parser.c
+ mv -f $(DEPDIR)/gas-parser.Tpo $(DEPDIR)/gas-parser.Po
+# source='modules/parsers/gas/gas-parser.c' object='gas-parser.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gas-parser.o `test -f 'modules/parsers/gas/gas-parser.c' || echo '$(srcdir)/'`modules/parsers/gas/gas-parser.c
+
+gas-parser.obj: modules/parsers/gas/gas-parser.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gas-parser.obj -MD -MP -MF $(DEPDIR)/gas-parser.Tpo -c -o gas-parser.obj `if test -f 'modules/parsers/gas/gas-parser.c'; then $(CYGPATH_W) 'modules/parsers/gas/gas-parser.c'; else $(CYGPATH_W) '$(srcdir)/modules/parsers/gas/gas-parser.c'; fi`
+ mv -f $(DEPDIR)/gas-parser.Tpo $(DEPDIR)/gas-parser.Po
+# source='modules/parsers/gas/gas-parser.c' object='gas-parser.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gas-parser.obj `if test -f 'modules/parsers/gas/gas-parser.c'; then $(CYGPATH_W) 'modules/parsers/gas/gas-parser.c'; else $(CYGPATH_W) '$(srcdir)/modules/parsers/gas/gas-parser.c'; fi`
+
+gas-parse.o: modules/parsers/gas/gas-parse.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gas-parse.o -MD -MP -MF $(DEPDIR)/gas-parse.Tpo -c -o gas-parse.o `test -f 'modules/parsers/gas/gas-parse.c' || echo '$(srcdir)/'`modules/parsers/gas/gas-parse.c
+ mv -f $(DEPDIR)/gas-parse.Tpo $(DEPDIR)/gas-parse.Po
+# source='modules/parsers/gas/gas-parse.c' object='gas-parse.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gas-parse.o `test -f 'modules/parsers/gas/gas-parse.c' || echo '$(srcdir)/'`modules/parsers/gas/gas-parse.c
+
+gas-parse.obj: modules/parsers/gas/gas-parse.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gas-parse.obj -MD -MP -MF $(DEPDIR)/gas-parse.Tpo -c -o gas-parse.obj `if test -f 'modules/parsers/gas/gas-parse.c'; then $(CYGPATH_W) 'modules/parsers/gas/gas-parse.c'; else $(CYGPATH_W) '$(srcdir)/modules/parsers/gas/gas-parse.c'; fi`
+ mv -f $(DEPDIR)/gas-parse.Tpo $(DEPDIR)/gas-parse.Po
+# source='modules/parsers/gas/gas-parse.c' object='gas-parse.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gas-parse.obj `if test -f 'modules/parsers/gas/gas-parse.c'; then $(CYGPATH_W) 'modules/parsers/gas/gas-parse.c'; else $(CYGPATH_W) '$(srcdir)/modules/parsers/gas/gas-parse.c'; fi`
+
+nasm-parser.o: modules/parsers/nasm/nasm-parser.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-parser.o -MD -MP -MF $(DEPDIR)/nasm-parser.Tpo -c -o nasm-parser.o `test -f 'modules/parsers/nasm/nasm-parser.c' || echo '$(srcdir)/'`modules/parsers/nasm/nasm-parser.c
+ mv -f $(DEPDIR)/nasm-parser.Tpo $(DEPDIR)/nasm-parser.Po
+# source='modules/parsers/nasm/nasm-parser.c' object='nasm-parser.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-parser.o `test -f 'modules/parsers/nasm/nasm-parser.c' || echo '$(srcdir)/'`modules/parsers/nasm/nasm-parser.c
+
+nasm-parser.obj: modules/parsers/nasm/nasm-parser.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-parser.obj -MD -MP -MF $(DEPDIR)/nasm-parser.Tpo -c -o nasm-parser.obj `if test -f 'modules/parsers/nasm/nasm-parser.c'; then $(CYGPATH_W) 'modules/parsers/nasm/nasm-parser.c'; else $(CYGPATH_W) '$(srcdir)/modules/parsers/nasm/nasm-parser.c'; fi`
+ mv -f $(DEPDIR)/nasm-parser.Tpo $(DEPDIR)/nasm-parser.Po
+# source='modules/parsers/nasm/nasm-parser.c' object='nasm-parser.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-parser.obj `if test -f 'modules/parsers/nasm/nasm-parser.c'; then $(CYGPATH_W) 'modules/parsers/nasm/nasm-parser.c'; else $(CYGPATH_W) '$(srcdir)/modules/parsers/nasm/nasm-parser.c'; fi`
+
+nasm-parse.o: modules/parsers/nasm/nasm-parse.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-parse.o -MD -MP -MF $(DEPDIR)/nasm-parse.Tpo -c -o nasm-parse.o `test -f 'modules/parsers/nasm/nasm-parse.c' || echo '$(srcdir)/'`modules/parsers/nasm/nasm-parse.c
+ mv -f $(DEPDIR)/nasm-parse.Tpo $(DEPDIR)/nasm-parse.Po
+# source='modules/parsers/nasm/nasm-parse.c' object='nasm-parse.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-parse.o `test -f 'modules/parsers/nasm/nasm-parse.c' || echo '$(srcdir)/'`modules/parsers/nasm/nasm-parse.c
+
+nasm-parse.obj: modules/parsers/nasm/nasm-parse.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-parse.obj -MD -MP -MF $(DEPDIR)/nasm-parse.Tpo -c -o nasm-parse.obj `if test -f 'modules/parsers/nasm/nasm-parse.c'; then $(CYGPATH_W) 'modules/parsers/nasm/nasm-parse.c'; else $(CYGPATH_W) '$(srcdir)/modules/parsers/nasm/nasm-parse.c'; fi`
+ mv -f $(DEPDIR)/nasm-parse.Tpo $(DEPDIR)/nasm-parse.Po
+# source='modules/parsers/nasm/nasm-parse.c' object='nasm-parse.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-parse.obj `if test -f 'modules/parsers/nasm/nasm-parse.c'; then $(CYGPATH_W) 'modules/parsers/nasm/nasm-parse.c'; else $(CYGPATH_W) '$(srcdir)/modules/parsers/nasm/nasm-parse.c'; fi`
+
+nasm-preproc.o: modules/preprocs/nasm/nasm-preproc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-preproc.o -MD -MP -MF $(DEPDIR)/nasm-preproc.Tpo -c -o nasm-preproc.o `test -f 'modules/preprocs/nasm/nasm-preproc.c' || echo '$(srcdir)/'`modules/preprocs/nasm/nasm-preproc.c
+ mv -f $(DEPDIR)/nasm-preproc.Tpo $(DEPDIR)/nasm-preproc.Po
+# source='modules/preprocs/nasm/nasm-preproc.c' object='nasm-preproc.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-preproc.o `test -f 'modules/preprocs/nasm/nasm-preproc.c' || echo '$(srcdir)/'`modules/preprocs/nasm/nasm-preproc.c
+
+nasm-preproc.obj: modules/preprocs/nasm/nasm-preproc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-preproc.obj -MD -MP -MF $(DEPDIR)/nasm-preproc.Tpo -c -o nasm-preproc.obj `if test -f 'modules/preprocs/nasm/nasm-preproc.c'; then $(CYGPATH_W) 'modules/preprocs/nasm/nasm-preproc.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/nasm/nasm-preproc.c'; fi`
+ mv -f $(DEPDIR)/nasm-preproc.Tpo $(DEPDIR)/nasm-preproc.Po
+# source='modules/preprocs/nasm/nasm-preproc.c' object='nasm-preproc.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-preproc.obj `if test -f 'modules/preprocs/nasm/nasm-preproc.c'; then $(CYGPATH_W) 'modules/preprocs/nasm/nasm-preproc.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/nasm/nasm-preproc.c'; fi`
+
+nasm-pp.o: modules/preprocs/nasm/nasm-pp.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-pp.o -MD -MP -MF $(DEPDIR)/nasm-pp.Tpo -c -o nasm-pp.o `test -f 'modules/preprocs/nasm/nasm-pp.c' || echo '$(srcdir)/'`modules/preprocs/nasm/nasm-pp.c
+ mv -f $(DEPDIR)/nasm-pp.Tpo $(DEPDIR)/nasm-pp.Po
+# source='modules/preprocs/nasm/nasm-pp.c' object='nasm-pp.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-pp.o `test -f 'modules/preprocs/nasm/nasm-pp.c' || echo '$(srcdir)/'`modules/preprocs/nasm/nasm-pp.c
+
+nasm-pp.obj: modules/preprocs/nasm/nasm-pp.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-pp.obj -MD -MP -MF $(DEPDIR)/nasm-pp.Tpo -c -o nasm-pp.obj `if test -f 'modules/preprocs/nasm/nasm-pp.c'; then $(CYGPATH_W) 'modules/preprocs/nasm/nasm-pp.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/nasm/nasm-pp.c'; fi`
+ mv -f $(DEPDIR)/nasm-pp.Tpo $(DEPDIR)/nasm-pp.Po
+# source='modules/preprocs/nasm/nasm-pp.c' object='nasm-pp.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-pp.obj `if test -f 'modules/preprocs/nasm/nasm-pp.c'; then $(CYGPATH_W) 'modules/preprocs/nasm/nasm-pp.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/nasm/nasm-pp.c'; fi`
+
+nasmlib.o: modules/preprocs/nasm/nasmlib.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasmlib.o -MD -MP -MF $(DEPDIR)/nasmlib.Tpo -c -o nasmlib.o `test -f 'modules/preprocs/nasm/nasmlib.c' || echo '$(srcdir)/'`modules/preprocs/nasm/nasmlib.c
+ mv -f $(DEPDIR)/nasmlib.Tpo $(DEPDIR)/nasmlib.Po
+# source='modules/preprocs/nasm/nasmlib.c' object='nasmlib.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasmlib.o `test -f 'modules/preprocs/nasm/nasmlib.c' || echo '$(srcdir)/'`modules/preprocs/nasm/nasmlib.c
+
+nasmlib.obj: modules/preprocs/nasm/nasmlib.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasmlib.obj -MD -MP -MF $(DEPDIR)/nasmlib.Tpo -c -o nasmlib.obj `if test -f 'modules/preprocs/nasm/nasmlib.c'; then $(CYGPATH_W) 'modules/preprocs/nasm/nasmlib.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/nasm/nasmlib.c'; fi`
+ mv -f $(DEPDIR)/nasmlib.Tpo $(DEPDIR)/nasmlib.Po
+# source='modules/preprocs/nasm/nasmlib.c' object='nasmlib.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasmlib.obj `if test -f 'modules/preprocs/nasm/nasmlib.c'; then $(CYGPATH_W) 'modules/preprocs/nasm/nasmlib.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/nasm/nasmlib.c'; fi`
+
+nasm-eval.o: modules/preprocs/nasm/nasm-eval.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-eval.o -MD -MP -MF $(DEPDIR)/nasm-eval.Tpo -c -o nasm-eval.o `test -f 'modules/preprocs/nasm/nasm-eval.c' || echo '$(srcdir)/'`modules/preprocs/nasm/nasm-eval.c
+ mv -f $(DEPDIR)/nasm-eval.Tpo $(DEPDIR)/nasm-eval.Po
+# source='modules/preprocs/nasm/nasm-eval.c' object='nasm-eval.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-eval.o `test -f 'modules/preprocs/nasm/nasm-eval.c' || echo '$(srcdir)/'`modules/preprocs/nasm/nasm-eval.c
+
+nasm-eval.obj: modules/preprocs/nasm/nasm-eval.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-eval.obj -MD -MP -MF $(DEPDIR)/nasm-eval.Tpo -c -o nasm-eval.obj `if test -f 'modules/preprocs/nasm/nasm-eval.c'; then $(CYGPATH_W) 'modules/preprocs/nasm/nasm-eval.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/nasm/nasm-eval.c'; fi`
+ mv -f $(DEPDIR)/nasm-eval.Tpo $(DEPDIR)/nasm-eval.Po
+# source='modules/preprocs/nasm/nasm-eval.c' object='nasm-eval.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-eval.obj `if test -f 'modules/preprocs/nasm/nasm-eval.c'; then $(CYGPATH_W) 'modules/preprocs/nasm/nasm-eval.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/nasm/nasm-eval.c'; fi`
+
+raw-preproc.o: modules/preprocs/raw/raw-preproc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT raw-preproc.o -MD -MP -MF $(DEPDIR)/raw-preproc.Tpo -c -o raw-preproc.o `test -f 'modules/preprocs/raw/raw-preproc.c' || echo '$(srcdir)/'`modules/preprocs/raw/raw-preproc.c
+ mv -f $(DEPDIR)/raw-preproc.Tpo $(DEPDIR)/raw-preproc.Po
+# source='modules/preprocs/raw/raw-preproc.c' object='raw-preproc.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o raw-preproc.o `test -f 'modules/preprocs/raw/raw-preproc.c' || echo '$(srcdir)/'`modules/preprocs/raw/raw-preproc.c
+
+raw-preproc.obj: modules/preprocs/raw/raw-preproc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT raw-preproc.obj -MD -MP -MF $(DEPDIR)/raw-preproc.Tpo -c -o raw-preproc.obj `if test -f 'modules/preprocs/raw/raw-preproc.c'; then $(CYGPATH_W) 'modules/preprocs/raw/raw-preproc.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/raw/raw-preproc.c'; fi`
+ mv -f $(DEPDIR)/raw-preproc.Tpo $(DEPDIR)/raw-preproc.Po
+# source='modules/preprocs/raw/raw-preproc.c' object='raw-preproc.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o raw-preproc.obj `if test -f 'modules/preprocs/raw/raw-preproc.c'; then $(CYGPATH_W) 'modules/preprocs/raw/raw-preproc.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/raw/raw-preproc.c'; fi`
+
+cpp-preproc.o: modules/preprocs/cpp/cpp-preproc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpp-preproc.o -MD -MP -MF $(DEPDIR)/cpp-preproc.Tpo -c -o cpp-preproc.o `test -f 'modules/preprocs/cpp/cpp-preproc.c' || echo '$(srcdir)/'`modules/preprocs/cpp/cpp-preproc.c
+ mv -f $(DEPDIR)/cpp-preproc.Tpo $(DEPDIR)/cpp-preproc.Po
+# source='modules/preprocs/cpp/cpp-preproc.c' object='cpp-preproc.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpp-preproc.o `test -f 'modules/preprocs/cpp/cpp-preproc.c' || echo '$(srcdir)/'`modules/preprocs/cpp/cpp-preproc.c
+
+cpp-preproc.obj: modules/preprocs/cpp/cpp-preproc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpp-preproc.obj -MD -MP -MF $(DEPDIR)/cpp-preproc.Tpo -c -o cpp-preproc.obj `if test -f 'modules/preprocs/cpp/cpp-preproc.c'; then $(CYGPATH_W) 'modules/preprocs/cpp/cpp-preproc.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/cpp/cpp-preproc.c'; fi`
+ mv -f $(DEPDIR)/cpp-preproc.Tpo $(DEPDIR)/cpp-preproc.Po
+# source='modules/preprocs/cpp/cpp-preproc.c' object='cpp-preproc.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpp-preproc.obj `if test -f 'modules/preprocs/cpp/cpp-preproc.c'; then $(CYGPATH_W) 'modules/preprocs/cpp/cpp-preproc.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/cpp/cpp-preproc.c'; fi`
+
+cv-dbgfmt.o: modules/dbgfmts/codeview/cv-dbgfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cv-dbgfmt.o -MD -MP -MF $(DEPDIR)/cv-dbgfmt.Tpo -c -o cv-dbgfmt.o `test -f 'modules/dbgfmts/codeview/cv-dbgfmt.c' || echo '$(srcdir)/'`modules/dbgfmts/codeview/cv-dbgfmt.c
+ mv -f $(DEPDIR)/cv-dbgfmt.Tpo $(DEPDIR)/cv-dbgfmt.Po
+# source='modules/dbgfmts/codeview/cv-dbgfmt.c' object='cv-dbgfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cv-dbgfmt.o `test -f 'modules/dbgfmts/codeview/cv-dbgfmt.c' || echo '$(srcdir)/'`modules/dbgfmts/codeview/cv-dbgfmt.c
+
+cv-dbgfmt.obj: modules/dbgfmts/codeview/cv-dbgfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cv-dbgfmt.obj -MD -MP -MF $(DEPDIR)/cv-dbgfmt.Tpo -c -o cv-dbgfmt.obj `if test -f 'modules/dbgfmts/codeview/cv-dbgfmt.c'; then $(CYGPATH_W) 'modules/dbgfmts/codeview/cv-dbgfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/codeview/cv-dbgfmt.c'; fi`
+ mv -f $(DEPDIR)/cv-dbgfmt.Tpo $(DEPDIR)/cv-dbgfmt.Po
+# source='modules/dbgfmts/codeview/cv-dbgfmt.c' object='cv-dbgfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cv-dbgfmt.obj `if test -f 'modules/dbgfmts/codeview/cv-dbgfmt.c'; then $(CYGPATH_W) 'modules/dbgfmts/codeview/cv-dbgfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/codeview/cv-dbgfmt.c'; fi`
+
+cv-symline.o: modules/dbgfmts/codeview/cv-symline.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cv-symline.o -MD -MP -MF $(DEPDIR)/cv-symline.Tpo -c -o cv-symline.o `test -f 'modules/dbgfmts/codeview/cv-symline.c' || echo '$(srcdir)/'`modules/dbgfmts/codeview/cv-symline.c
+ mv -f $(DEPDIR)/cv-symline.Tpo $(DEPDIR)/cv-symline.Po
+# source='modules/dbgfmts/codeview/cv-symline.c' object='cv-symline.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cv-symline.o `test -f 'modules/dbgfmts/codeview/cv-symline.c' || echo '$(srcdir)/'`modules/dbgfmts/codeview/cv-symline.c
+
+cv-symline.obj: modules/dbgfmts/codeview/cv-symline.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cv-symline.obj -MD -MP -MF $(DEPDIR)/cv-symline.Tpo -c -o cv-symline.obj `if test -f 'modules/dbgfmts/codeview/cv-symline.c'; then $(CYGPATH_W) 'modules/dbgfmts/codeview/cv-symline.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/codeview/cv-symline.c'; fi`
+ mv -f $(DEPDIR)/cv-symline.Tpo $(DEPDIR)/cv-symline.Po
+# source='modules/dbgfmts/codeview/cv-symline.c' object='cv-symline.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cv-symline.obj `if test -f 'modules/dbgfmts/codeview/cv-symline.c'; then $(CYGPATH_W) 'modules/dbgfmts/codeview/cv-symline.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/codeview/cv-symline.c'; fi`
+
+cv-type.o: modules/dbgfmts/codeview/cv-type.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cv-type.o -MD -MP -MF $(DEPDIR)/cv-type.Tpo -c -o cv-type.o `test -f 'modules/dbgfmts/codeview/cv-type.c' || echo '$(srcdir)/'`modules/dbgfmts/codeview/cv-type.c
+ mv -f $(DEPDIR)/cv-type.Tpo $(DEPDIR)/cv-type.Po
+# source='modules/dbgfmts/codeview/cv-type.c' object='cv-type.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cv-type.o `test -f 'modules/dbgfmts/codeview/cv-type.c' || echo '$(srcdir)/'`modules/dbgfmts/codeview/cv-type.c
+
+cv-type.obj: modules/dbgfmts/codeview/cv-type.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cv-type.obj -MD -MP -MF $(DEPDIR)/cv-type.Tpo -c -o cv-type.obj `if test -f 'modules/dbgfmts/codeview/cv-type.c'; then $(CYGPATH_W) 'modules/dbgfmts/codeview/cv-type.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/codeview/cv-type.c'; fi`
+ mv -f $(DEPDIR)/cv-type.Tpo $(DEPDIR)/cv-type.Po
+# source='modules/dbgfmts/codeview/cv-type.c' object='cv-type.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cv-type.obj `if test -f 'modules/dbgfmts/codeview/cv-type.c'; then $(CYGPATH_W) 'modules/dbgfmts/codeview/cv-type.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/codeview/cv-type.c'; fi`
+
+dwarf2-dbgfmt.o: modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dwarf2-dbgfmt.o -MD -MP -MF $(DEPDIR)/dwarf2-dbgfmt.Tpo -c -o dwarf2-dbgfmt.o `test -f 'modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c' || echo '$(srcdir)/'`modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c
+ mv -f $(DEPDIR)/dwarf2-dbgfmt.Tpo $(DEPDIR)/dwarf2-dbgfmt.Po
+# source='modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c' object='dwarf2-dbgfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dwarf2-dbgfmt.o `test -f 'modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c' || echo '$(srcdir)/'`modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c
+
+dwarf2-dbgfmt.obj: modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dwarf2-dbgfmt.obj -MD -MP -MF $(DEPDIR)/dwarf2-dbgfmt.Tpo -c -o dwarf2-dbgfmt.obj `if test -f 'modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c'; then $(CYGPATH_W) 'modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c'; fi`
+ mv -f $(DEPDIR)/dwarf2-dbgfmt.Tpo $(DEPDIR)/dwarf2-dbgfmt.Po
+# source='modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c' object='dwarf2-dbgfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dwarf2-dbgfmt.obj `if test -f 'modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c'; then $(CYGPATH_W) 'modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c'; fi`
+
+dwarf2-line.o: modules/dbgfmts/dwarf2/dwarf2-line.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dwarf2-line.o -MD -MP -MF $(DEPDIR)/dwarf2-line.Tpo -c -o dwarf2-line.o `test -f 'modules/dbgfmts/dwarf2/dwarf2-line.c' || echo '$(srcdir)/'`modules/dbgfmts/dwarf2/dwarf2-line.c
+ mv -f $(DEPDIR)/dwarf2-line.Tpo $(DEPDIR)/dwarf2-line.Po
+# source='modules/dbgfmts/dwarf2/dwarf2-line.c' object='dwarf2-line.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dwarf2-line.o `test -f 'modules/dbgfmts/dwarf2/dwarf2-line.c' || echo '$(srcdir)/'`modules/dbgfmts/dwarf2/dwarf2-line.c
+
+dwarf2-line.obj: modules/dbgfmts/dwarf2/dwarf2-line.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dwarf2-line.obj -MD -MP -MF $(DEPDIR)/dwarf2-line.Tpo -c -o dwarf2-line.obj `if test -f 'modules/dbgfmts/dwarf2/dwarf2-line.c'; then $(CYGPATH_W) 'modules/dbgfmts/dwarf2/dwarf2-line.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/dwarf2/dwarf2-line.c'; fi`
+ mv -f $(DEPDIR)/dwarf2-line.Tpo $(DEPDIR)/dwarf2-line.Po
+# source='modules/dbgfmts/dwarf2/dwarf2-line.c' object='dwarf2-line.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dwarf2-line.obj `if test -f 'modules/dbgfmts/dwarf2/dwarf2-line.c'; then $(CYGPATH_W) 'modules/dbgfmts/dwarf2/dwarf2-line.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/dwarf2/dwarf2-line.c'; fi`
+
+dwarf2-aranges.o: modules/dbgfmts/dwarf2/dwarf2-aranges.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dwarf2-aranges.o -MD -MP -MF $(DEPDIR)/dwarf2-aranges.Tpo -c -o dwarf2-aranges.o `test -f 'modules/dbgfmts/dwarf2/dwarf2-aranges.c' || echo '$(srcdir)/'`modules/dbgfmts/dwarf2/dwarf2-aranges.c
+ mv -f $(DEPDIR)/dwarf2-aranges.Tpo $(DEPDIR)/dwarf2-aranges.Po
+# source='modules/dbgfmts/dwarf2/dwarf2-aranges.c' object='dwarf2-aranges.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dwarf2-aranges.o `test -f 'modules/dbgfmts/dwarf2/dwarf2-aranges.c' || echo '$(srcdir)/'`modules/dbgfmts/dwarf2/dwarf2-aranges.c
+
+dwarf2-aranges.obj: modules/dbgfmts/dwarf2/dwarf2-aranges.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dwarf2-aranges.obj -MD -MP -MF $(DEPDIR)/dwarf2-aranges.Tpo -c -o dwarf2-aranges.obj `if test -f 'modules/dbgfmts/dwarf2/dwarf2-aranges.c'; then $(CYGPATH_W) 'modules/dbgfmts/dwarf2/dwarf2-aranges.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/dwarf2/dwarf2-aranges.c'; fi`
+ mv -f $(DEPDIR)/dwarf2-aranges.Tpo $(DEPDIR)/dwarf2-aranges.Po
+# source='modules/dbgfmts/dwarf2/dwarf2-aranges.c' object='dwarf2-aranges.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dwarf2-aranges.obj `if test -f 'modules/dbgfmts/dwarf2/dwarf2-aranges.c'; then $(CYGPATH_W) 'modules/dbgfmts/dwarf2/dwarf2-aranges.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/dwarf2/dwarf2-aranges.c'; fi`
+
+dwarf2-info.o: modules/dbgfmts/dwarf2/dwarf2-info.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dwarf2-info.o -MD -MP -MF $(DEPDIR)/dwarf2-info.Tpo -c -o dwarf2-info.o `test -f 'modules/dbgfmts/dwarf2/dwarf2-info.c' || echo '$(srcdir)/'`modules/dbgfmts/dwarf2/dwarf2-info.c
+ mv -f $(DEPDIR)/dwarf2-info.Tpo $(DEPDIR)/dwarf2-info.Po
+# source='modules/dbgfmts/dwarf2/dwarf2-info.c' object='dwarf2-info.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dwarf2-info.o `test -f 'modules/dbgfmts/dwarf2/dwarf2-info.c' || echo '$(srcdir)/'`modules/dbgfmts/dwarf2/dwarf2-info.c
+
+dwarf2-info.obj: modules/dbgfmts/dwarf2/dwarf2-info.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dwarf2-info.obj -MD -MP -MF $(DEPDIR)/dwarf2-info.Tpo -c -o dwarf2-info.obj `if test -f 'modules/dbgfmts/dwarf2/dwarf2-info.c'; then $(CYGPATH_W) 'modules/dbgfmts/dwarf2/dwarf2-info.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/dwarf2/dwarf2-info.c'; fi`
+ mv -f $(DEPDIR)/dwarf2-info.Tpo $(DEPDIR)/dwarf2-info.Po
+# source='modules/dbgfmts/dwarf2/dwarf2-info.c' object='dwarf2-info.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dwarf2-info.obj `if test -f 'modules/dbgfmts/dwarf2/dwarf2-info.c'; then $(CYGPATH_W) 'modules/dbgfmts/dwarf2/dwarf2-info.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/dwarf2/dwarf2-info.c'; fi`
+
+null-dbgfmt.o: modules/dbgfmts/null/null-dbgfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT null-dbgfmt.o -MD -MP -MF $(DEPDIR)/null-dbgfmt.Tpo -c -o null-dbgfmt.o `test -f 'modules/dbgfmts/null/null-dbgfmt.c' || echo '$(srcdir)/'`modules/dbgfmts/null/null-dbgfmt.c
+ mv -f $(DEPDIR)/null-dbgfmt.Tpo $(DEPDIR)/null-dbgfmt.Po
+# source='modules/dbgfmts/null/null-dbgfmt.c' object='null-dbgfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o null-dbgfmt.o `test -f 'modules/dbgfmts/null/null-dbgfmt.c' || echo '$(srcdir)/'`modules/dbgfmts/null/null-dbgfmt.c
+
+null-dbgfmt.obj: modules/dbgfmts/null/null-dbgfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT null-dbgfmt.obj -MD -MP -MF $(DEPDIR)/null-dbgfmt.Tpo -c -o null-dbgfmt.obj `if test -f 'modules/dbgfmts/null/null-dbgfmt.c'; then $(CYGPATH_W) 'modules/dbgfmts/null/null-dbgfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/null/null-dbgfmt.c'; fi`
+ mv -f $(DEPDIR)/null-dbgfmt.Tpo $(DEPDIR)/null-dbgfmt.Po
+# source='modules/dbgfmts/null/null-dbgfmt.c' object='null-dbgfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o null-dbgfmt.obj `if test -f 'modules/dbgfmts/null/null-dbgfmt.c'; then $(CYGPATH_W) 'modules/dbgfmts/null/null-dbgfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/null/null-dbgfmt.c'; fi`
+
+stabs-dbgfmt.o: modules/dbgfmts/stabs/stabs-dbgfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT stabs-dbgfmt.o -MD -MP -MF $(DEPDIR)/stabs-dbgfmt.Tpo -c -o stabs-dbgfmt.o `test -f 'modules/dbgfmts/stabs/stabs-dbgfmt.c' || echo '$(srcdir)/'`modules/dbgfmts/stabs/stabs-dbgfmt.c
+ mv -f $(DEPDIR)/stabs-dbgfmt.Tpo $(DEPDIR)/stabs-dbgfmt.Po
+# source='modules/dbgfmts/stabs/stabs-dbgfmt.c' object='stabs-dbgfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o stabs-dbgfmt.o `test -f 'modules/dbgfmts/stabs/stabs-dbgfmt.c' || echo '$(srcdir)/'`modules/dbgfmts/stabs/stabs-dbgfmt.c
+
+stabs-dbgfmt.obj: modules/dbgfmts/stabs/stabs-dbgfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT stabs-dbgfmt.obj -MD -MP -MF $(DEPDIR)/stabs-dbgfmt.Tpo -c -o stabs-dbgfmt.obj `if test -f 'modules/dbgfmts/stabs/stabs-dbgfmt.c'; then $(CYGPATH_W) 'modules/dbgfmts/stabs/stabs-dbgfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/stabs/stabs-dbgfmt.c'; fi`
+ mv -f $(DEPDIR)/stabs-dbgfmt.Tpo $(DEPDIR)/stabs-dbgfmt.Po
+# source='modules/dbgfmts/stabs/stabs-dbgfmt.c' object='stabs-dbgfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o stabs-dbgfmt.obj `if test -f 'modules/dbgfmts/stabs/stabs-dbgfmt.c'; then $(CYGPATH_W) 'modules/dbgfmts/stabs/stabs-dbgfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/stabs/stabs-dbgfmt.c'; fi`
+
+dbg-objfmt.o: modules/objfmts/dbg/dbg-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dbg-objfmt.o -MD -MP -MF $(DEPDIR)/dbg-objfmt.Tpo -c -o dbg-objfmt.o `test -f 'modules/objfmts/dbg/dbg-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/dbg/dbg-objfmt.c
+ mv -f $(DEPDIR)/dbg-objfmt.Tpo $(DEPDIR)/dbg-objfmt.Po
+# source='modules/objfmts/dbg/dbg-objfmt.c' object='dbg-objfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dbg-objfmt.o `test -f 'modules/objfmts/dbg/dbg-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/dbg/dbg-objfmt.c
+
+dbg-objfmt.obj: modules/objfmts/dbg/dbg-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dbg-objfmt.obj -MD -MP -MF $(DEPDIR)/dbg-objfmt.Tpo -c -o dbg-objfmt.obj `if test -f 'modules/objfmts/dbg/dbg-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/dbg/dbg-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/dbg/dbg-objfmt.c'; fi`
+ mv -f $(DEPDIR)/dbg-objfmt.Tpo $(DEPDIR)/dbg-objfmt.Po
+# source='modules/objfmts/dbg/dbg-objfmt.c' object='dbg-objfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dbg-objfmt.obj `if test -f 'modules/objfmts/dbg/dbg-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/dbg/dbg-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/dbg/dbg-objfmt.c'; fi`
+
+bin-objfmt.o: modules/objfmts/bin/bin-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bin-objfmt.o -MD -MP -MF $(DEPDIR)/bin-objfmt.Tpo -c -o bin-objfmt.o `test -f 'modules/objfmts/bin/bin-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/bin/bin-objfmt.c
+ mv -f $(DEPDIR)/bin-objfmt.Tpo $(DEPDIR)/bin-objfmt.Po
+# source='modules/objfmts/bin/bin-objfmt.c' object='bin-objfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bin-objfmt.o `test -f 'modules/objfmts/bin/bin-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/bin/bin-objfmt.c
+
+bin-objfmt.obj: modules/objfmts/bin/bin-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bin-objfmt.obj -MD -MP -MF $(DEPDIR)/bin-objfmt.Tpo -c -o bin-objfmt.obj `if test -f 'modules/objfmts/bin/bin-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/bin/bin-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/bin/bin-objfmt.c'; fi`
+ mv -f $(DEPDIR)/bin-objfmt.Tpo $(DEPDIR)/bin-objfmt.Po
+# source='modules/objfmts/bin/bin-objfmt.c' object='bin-objfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bin-objfmt.obj `if test -f 'modules/objfmts/bin/bin-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/bin/bin-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/bin/bin-objfmt.c'; fi`
+
+elf.o: modules/objfmts/elf/elf.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT elf.o -MD -MP -MF $(DEPDIR)/elf.Tpo -c -o elf.o `test -f 'modules/objfmts/elf/elf.c' || echo '$(srcdir)/'`modules/objfmts/elf/elf.c
+ mv -f $(DEPDIR)/elf.Tpo $(DEPDIR)/elf.Po
+# source='modules/objfmts/elf/elf.c' object='elf.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o elf.o `test -f 'modules/objfmts/elf/elf.c' || echo '$(srcdir)/'`modules/objfmts/elf/elf.c
+
+elf.obj: modules/objfmts/elf/elf.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT elf.obj -MD -MP -MF $(DEPDIR)/elf.Tpo -c -o elf.obj `if test -f 'modules/objfmts/elf/elf.c'; then $(CYGPATH_W) 'modules/objfmts/elf/elf.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/elf/elf.c'; fi`
+ mv -f $(DEPDIR)/elf.Tpo $(DEPDIR)/elf.Po
+# source='modules/objfmts/elf/elf.c' object='elf.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o elf.obj `if test -f 'modules/objfmts/elf/elf.c'; then $(CYGPATH_W) 'modules/objfmts/elf/elf.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/elf/elf.c'; fi`
+
+elf-objfmt.o: modules/objfmts/elf/elf-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT elf-objfmt.o -MD -MP -MF $(DEPDIR)/elf-objfmt.Tpo -c -o elf-objfmt.o `test -f 'modules/objfmts/elf/elf-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/elf/elf-objfmt.c
+ mv -f $(DEPDIR)/elf-objfmt.Tpo $(DEPDIR)/elf-objfmt.Po
+# source='modules/objfmts/elf/elf-objfmt.c' object='elf-objfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o elf-objfmt.o `test -f 'modules/objfmts/elf/elf-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/elf/elf-objfmt.c
+
+elf-objfmt.obj: modules/objfmts/elf/elf-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT elf-objfmt.obj -MD -MP -MF $(DEPDIR)/elf-objfmt.Tpo -c -o elf-objfmt.obj `if test -f 'modules/objfmts/elf/elf-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/elf/elf-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/elf/elf-objfmt.c'; fi`
+ mv -f $(DEPDIR)/elf-objfmt.Tpo $(DEPDIR)/elf-objfmt.Po
+# source='modules/objfmts/elf/elf-objfmt.c' object='elf-objfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o elf-objfmt.obj `if test -f 'modules/objfmts/elf/elf-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/elf/elf-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/elf/elf-objfmt.c'; fi`
+
+elf-x86-x86.o: modules/objfmts/elf/elf-x86-x86.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT elf-x86-x86.o -MD -MP -MF $(DEPDIR)/elf-x86-x86.Tpo -c -o elf-x86-x86.o `test -f 'modules/objfmts/elf/elf-x86-x86.c' || echo '$(srcdir)/'`modules/objfmts/elf/elf-x86-x86.c
+ mv -f $(DEPDIR)/elf-x86-x86.Tpo $(DEPDIR)/elf-x86-x86.Po
+# source='modules/objfmts/elf/elf-x86-x86.c' object='elf-x86-x86.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o elf-x86-x86.o `test -f 'modules/objfmts/elf/elf-x86-x86.c' || echo '$(srcdir)/'`modules/objfmts/elf/elf-x86-x86.c
+
+elf-x86-x86.obj: modules/objfmts/elf/elf-x86-x86.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT elf-x86-x86.obj -MD -MP -MF $(DEPDIR)/elf-x86-x86.Tpo -c -o elf-x86-x86.obj `if test -f 'modules/objfmts/elf/elf-x86-x86.c'; then $(CYGPATH_W) 'modules/objfmts/elf/elf-x86-x86.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/elf/elf-x86-x86.c'; fi`
+ mv -f $(DEPDIR)/elf-x86-x86.Tpo $(DEPDIR)/elf-x86-x86.Po
+# source='modules/objfmts/elf/elf-x86-x86.c' object='elf-x86-x86.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o elf-x86-x86.obj `if test -f 'modules/objfmts/elf/elf-x86-x86.c'; then $(CYGPATH_W) 'modules/objfmts/elf/elf-x86-x86.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/elf/elf-x86-x86.c'; fi`
+
+elf-x86-amd64.o: modules/objfmts/elf/elf-x86-amd64.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT elf-x86-amd64.o -MD -MP -MF $(DEPDIR)/elf-x86-amd64.Tpo -c -o elf-x86-amd64.o `test -f 'modules/objfmts/elf/elf-x86-amd64.c' || echo '$(srcdir)/'`modules/objfmts/elf/elf-x86-amd64.c
+ mv -f $(DEPDIR)/elf-x86-amd64.Tpo $(DEPDIR)/elf-x86-amd64.Po
+# source='modules/objfmts/elf/elf-x86-amd64.c' object='elf-x86-amd64.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o elf-x86-amd64.o `test -f 'modules/objfmts/elf/elf-x86-amd64.c' || echo '$(srcdir)/'`modules/objfmts/elf/elf-x86-amd64.c
+
+elf-x86-amd64.obj: modules/objfmts/elf/elf-x86-amd64.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT elf-x86-amd64.obj -MD -MP -MF $(DEPDIR)/elf-x86-amd64.Tpo -c -o elf-x86-amd64.obj `if test -f 'modules/objfmts/elf/elf-x86-amd64.c'; then $(CYGPATH_W) 'modules/objfmts/elf/elf-x86-amd64.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/elf/elf-x86-amd64.c'; fi`
+ mv -f $(DEPDIR)/elf-x86-amd64.Tpo $(DEPDIR)/elf-x86-amd64.Po
+# source='modules/objfmts/elf/elf-x86-amd64.c' object='elf-x86-amd64.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o elf-x86-amd64.obj `if test -f 'modules/objfmts/elf/elf-x86-amd64.c'; then $(CYGPATH_W) 'modules/objfmts/elf/elf-x86-amd64.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/elf/elf-x86-amd64.c'; fi`
+
+coff-objfmt.o: modules/objfmts/coff/coff-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT coff-objfmt.o -MD -MP -MF $(DEPDIR)/coff-objfmt.Tpo -c -o coff-objfmt.o `test -f 'modules/objfmts/coff/coff-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/coff/coff-objfmt.c
+ mv -f $(DEPDIR)/coff-objfmt.Tpo $(DEPDIR)/coff-objfmt.Po
+# source='modules/objfmts/coff/coff-objfmt.c' object='coff-objfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o coff-objfmt.o `test -f 'modules/objfmts/coff/coff-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/coff/coff-objfmt.c
+
+coff-objfmt.obj: modules/objfmts/coff/coff-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT coff-objfmt.obj -MD -MP -MF $(DEPDIR)/coff-objfmt.Tpo -c -o coff-objfmt.obj `if test -f 'modules/objfmts/coff/coff-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/coff/coff-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/coff/coff-objfmt.c'; fi`
+ mv -f $(DEPDIR)/coff-objfmt.Tpo $(DEPDIR)/coff-objfmt.Po
+# source='modules/objfmts/coff/coff-objfmt.c' object='coff-objfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o coff-objfmt.obj `if test -f 'modules/objfmts/coff/coff-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/coff/coff-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/coff/coff-objfmt.c'; fi`
+
+win64-except.o: modules/objfmts/coff/win64-except.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT win64-except.o -MD -MP -MF $(DEPDIR)/win64-except.Tpo -c -o win64-except.o `test -f 'modules/objfmts/coff/win64-except.c' || echo '$(srcdir)/'`modules/objfmts/coff/win64-except.c
+ mv -f $(DEPDIR)/win64-except.Tpo $(DEPDIR)/win64-except.Po
+# source='modules/objfmts/coff/win64-except.c' object='win64-except.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o win64-except.o `test -f 'modules/objfmts/coff/win64-except.c' || echo '$(srcdir)/'`modules/objfmts/coff/win64-except.c
+
+win64-except.obj: modules/objfmts/coff/win64-except.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT win64-except.obj -MD -MP -MF $(DEPDIR)/win64-except.Tpo -c -o win64-except.obj `if test -f 'modules/objfmts/coff/win64-except.c'; then $(CYGPATH_W) 'modules/objfmts/coff/win64-except.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/coff/win64-except.c'; fi`
+ mv -f $(DEPDIR)/win64-except.Tpo $(DEPDIR)/win64-except.Po
+# source='modules/objfmts/coff/win64-except.c' object='win64-except.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o win64-except.obj `if test -f 'modules/objfmts/coff/win64-except.c'; then $(CYGPATH_W) 'modules/objfmts/coff/win64-except.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/coff/win64-except.c'; fi`
+
+macho-objfmt.o: modules/objfmts/macho/macho-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT macho-objfmt.o -MD -MP -MF $(DEPDIR)/macho-objfmt.Tpo -c -o macho-objfmt.o `test -f 'modules/objfmts/macho/macho-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/macho/macho-objfmt.c
+ mv -f $(DEPDIR)/macho-objfmt.Tpo $(DEPDIR)/macho-objfmt.Po
+# source='modules/objfmts/macho/macho-objfmt.c' object='macho-objfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o macho-objfmt.o `test -f 'modules/objfmts/macho/macho-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/macho/macho-objfmt.c
+
+macho-objfmt.obj: modules/objfmts/macho/macho-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT macho-objfmt.obj -MD -MP -MF $(DEPDIR)/macho-objfmt.Tpo -c -o macho-objfmt.obj `if test -f 'modules/objfmts/macho/macho-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/macho/macho-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/macho/macho-objfmt.c'; fi`
+ mv -f $(DEPDIR)/macho-objfmt.Tpo $(DEPDIR)/macho-objfmt.Po
+# source='modules/objfmts/macho/macho-objfmt.c' object='macho-objfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o macho-objfmt.obj `if test -f 'modules/objfmts/macho/macho-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/macho/macho-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/macho/macho-objfmt.c'; fi`
+
+rdf-objfmt.o: modules/objfmts/rdf/rdf-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rdf-objfmt.o -MD -MP -MF $(DEPDIR)/rdf-objfmt.Tpo -c -o rdf-objfmt.o `test -f 'modules/objfmts/rdf/rdf-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/rdf/rdf-objfmt.c
+ mv -f $(DEPDIR)/rdf-objfmt.Tpo $(DEPDIR)/rdf-objfmt.Po
+# source='modules/objfmts/rdf/rdf-objfmt.c' object='rdf-objfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rdf-objfmt.o `test -f 'modules/objfmts/rdf/rdf-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/rdf/rdf-objfmt.c
+
+rdf-objfmt.obj: modules/objfmts/rdf/rdf-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rdf-objfmt.obj -MD -MP -MF $(DEPDIR)/rdf-objfmt.Tpo -c -o rdf-objfmt.obj `if test -f 'modules/objfmts/rdf/rdf-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/rdf/rdf-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/rdf/rdf-objfmt.c'; fi`
+ mv -f $(DEPDIR)/rdf-objfmt.Tpo $(DEPDIR)/rdf-objfmt.Po
+# source='modules/objfmts/rdf/rdf-objfmt.c' object='rdf-objfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rdf-objfmt.obj `if test -f 'modules/objfmts/rdf/rdf-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/rdf/rdf-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/rdf/rdf-objfmt.c'; fi`
+
+xdf-objfmt.o: modules/objfmts/xdf/xdf-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xdf-objfmt.o -MD -MP -MF $(DEPDIR)/xdf-objfmt.Tpo -c -o xdf-objfmt.o `test -f 'modules/objfmts/xdf/xdf-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/xdf/xdf-objfmt.c
+ mv -f $(DEPDIR)/xdf-objfmt.Tpo $(DEPDIR)/xdf-objfmt.Po
+# source='modules/objfmts/xdf/xdf-objfmt.c' object='xdf-objfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xdf-objfmt.o `test -f 'modules/objfmts/xdf/xdf-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/xdf/xdf-objfmt.c
+
+xdf-objfmt.obj: modules/objfmts/xdf/xdf-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xdf-objfmt.obj -MD -MP -MF $(DEPDIR)/xdf-objfmt.Tpo -c -o xdf-objfmt.obj `if test -f 'modules/objfmts/xdf/xdf-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/xdf/xdf-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/xdf/xdf-objfmt.c'; fi`
+ mv -f $(DEPDIR)/xdf-objfmt.Tpo $(DEPDIR)/xdf-objfmt.Po
+# source='modules/objfmts/xdf/xdf-objfmt.c' object='xdf-objfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xdf-objfmt.obj `if test -f 'modules/objfmts/xdf/xdf-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/xdf/xdf-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/xdf/xdf-objfmt.c'; fi`
+
+assocdat.o: libyasm/assocdat.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT assocdat.o -MD -MP -MF $(DEPDIR)/assocdat.Tpo -c -o assocdat.o `test -f 'libyasm/assocdat.c' || echo '$(srcdir)/'`libyasm/assocdat.c
+ mv -f $(DEPDIR)/assocdat.Tpo $(DEPDIR)/assocdat.Po
+# source='libyasm/assocdat.c' object='assocdat.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o assocdat.o `test -f 'libyasm/assocdat.c' || echo '$(srcdir)/'`libyasm/assocdat.c
+
+assocdat.obj: libyasm/assocdat.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT assocdat.obj -MD -MP -MF $(DEPDIR)/assocdat.Tpo -c -o assocdat.obj `if test -f 'libyasm/assocdat.c'; then $(CYGPATH_W) 'libyasm/assocdat.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/assocdat.c'; fi`
+ mv -f $(DEPDIR)/assocdat.Tpo $(DEPDIR)/assocdat.Po
+# source='libyasm/assocdat.c' object='assocdat.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o assocdat.obj `if test -f 'libyasm/assocdat.c'; then $(CYGPATH_W) 'libyasm/assocdat.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/assocdat.c'; fi`
+
+bitvect.o: libyasm/bitvect.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bitvect.o -MD -MP -MF $(DEPDIR)/bitvect.Tpo -c -o bitvect.o `test -f 'libyasm/bitvect.c' || echo '$(srcdir)/'`libyasm/bitvect.c
+ mv -f $(DEPDIR)/bitvect.Tpo $(DEPDIR)/bitvect.Po
+# source='libyasm/bitvect.c' object='bitvect.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bitvect.o `test -f 'libyasm/bitvect.c' || echo '$(srcdir)/'`libyasm/bitvect.c
+
+bitvect.obj: libyasm/bitvect.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bitvect.obj -MD -MP -MF $(DEPDIR)/bitvect.Tpo -c -o bitvect.obj `if test -f 'libyasm/bitvect.c'; then $(CYGPATH_W) 'libyasm/bitvect.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bitvect.c'; fi`
+ mv -f $(DEPDIR)/bitvect.Tpo $(DEPDIR)/bitvect.Po
+# source='libyasm/bitvect.c' object='bitvect.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bitvect.obj `if test -f 'libyasm/bitvect.c'; then $(CYGPATH_W) 'libyasm/bitvect.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bitvect.c'; fi`
+
+bc-align.o: libyasm/bc-align.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bc-align.o -MD -MP -MF $(DEPDIR)/bc-align.Tpo -c -o bc-align.o `test -f 'libyasm/bc-align.c' || echo '$(srcdir)/'`libyasm/bc-align.c
+ mv -f $(DEPDIR)/bc-align.Tpo $(DEPDIR)/bc-align.Po
+# source='libyasm/bc-align.c' object='bc-align.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bc-align.o `test -f 'libyasm/bc-align.c' || echo '$(srcdir)/'`libyasm/bc-align.c
+
+bc-align.obj: libyasm/bc-align.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bc-align.obj -MD -MP -MF $(DEPDIR)/bc-align.Tpo -c -o bc-align.obj `if test -f 'libyasm/bc-align.c'; then $(CYGPATH_W) 'libyasm/bc-align.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bc-align.c'; fi`
+ mv -f $(DEPDIR)/bc-align.Tpo $(DEPDIR)/bc-align.Po
+# source='libyasm/bc-align.c' object='bc-align.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bc-align.obj `if test -f 'libyasm/bc-align.c'; then $(CYGPATH_W) 'libyasm/bc-align.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bc-align.c'; fi`
+
+bc-data.o: libyasm/bc-data.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bc-data.o -MD -MP -MF $(DEPDIR)/bc-data.Tpo -c -o bc-data.o `test -f 'libyasm/bc-data.c' || echo '$(srcdir)/'`libyasm/bc-data.c
+ mv -f $(DEPDIR)/bc-data.Tpo $(DEPDIR)/bc-data.Po
+# source='libyasm/bc-data.c' object='bc-data.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bc-data.o `test -f 'libyasm/bc-data.c' || echo '$(srcdir)/'`libyasm/bc-data.c
+
+bc-data.obj: libyasm/bc-data.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bc-data.obj -MD -MP -MF $(DEPDIR)/bc-data.Tpo -c -o bc-data.obj `if test -f 'libyasm/bc-data.c'; then $(CYGPATH_W) 'libyasm/bc-data.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bc-data.c'; fi`
+ mv -f $(DEPDIR)/bc-data.Tpo $(DEPDIR)/bc-data.Po
+# source='libyasm/bc-data.c' object='bc-data.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bc-data.obj `if test -f 'libyasm/bc-data.c'; then $(CYGPATH_W) 'libyasm/bc-data.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bc-data.c'; fi`
+
+bc-incbin.o: libyasm/bc-incbin.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bc-incbin.o -MD -MP -MF $(DEPDIR)/bc-incbin.Tpo -c -o bc-incbin.o `test -f 'libyasm/bc-incbin.c' || echo '$(srcdir)/'`libyasm/bc-incbin.c
+ mv -f $(DEPDIR)/bc-incbin.Tpo $(DEPDIR)/bc-incbin.Po
+# source='libyasm/bc-incbin.c' object='bc-incbin.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bc-incbin.o `test -f 'libyasm/bc-incbin.c' || echo '$(srcdir)/'`libyasm/bc-incbin.c
+
+bc-incbin.obj: libyasm/bc-incbin.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bc-incbin.obj -MD -MP -MF $(DEPDIR)/bc-incbin.Tpo -c -o bc-incbin.obj `if test -f 'libyasm/bc-incbin.c'; then $(CYGPATH_W) 'libyasm/bc-incbin.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bc-incbin.c'; fi`
+ mv -f $(DEPDIR)/bc-incbin.Tpo $(DEPDIR)/bc-incbin.Po
+# source='libyasm/bc-incbin.c' object='bc-incbin.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bc-incbin.obj `if test -f 'libyasm/bc-incbin.c'; then $(CYGPATH_W) 'libyasm/bc-incbin.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bc-incbin.c'; fi`
+
+bc-org.o: libyasm/bc-org.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bc-org.o -MD -MP -MF $(DEPDIR)/bc-org.Tpo -c -o bc-org.o `test -f 'libyasm/bc-org.c' || echo '$(srcdir)/'`libyasm/bc-org.c
+ mv -f $(DEPDIR)/bc-org.Tpo $(DEPDIR)/bc-org.Po
+# source='libyasm/bc-org.c' object='bc-org.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bc-org.o `test -f 'libyasm/bc-org.c' || echo '$(srcdir)/'`libyasm/bc-org.c
+
+bc-org.obj: libyasm/bc-org.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bc-org.obj -MD -MP -MF $(DEPDIR)/bc-org.Tpo -c -o bc-org.obj `if test -f 'libyasm/bc-org.c'; then $(CYGPATH_W) 'libyasm/bc-org.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bc-org.c'; fi`
+ mv -f $(DEPDIR)/bc-org.Tpo $(DEPDIR)/bc-org.Po
+# source='libyasm/bc-org.c' object='bc-org.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bc-org.obj `if test -f 'libyasm/bc-org.c'; then $(CYGPATH_W) 'libyasm/bc-org.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bc-org.c'; fi`
+
+bc-reserve.o: libyasm/bc-reserve.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bc-reserve.o -MD -MP -MF $(DEPDIR)/bc-reserve.Tpo -c -o bc-reserve.o `test -f 'libyasm/bc-reserve.c' || echo '$(srcdir)/'`libyasm/bc-reserve.c
+ mv -f $(DEPDIR)/bc-reserve.Tpo $(DEPDIR)/bc-reserve.Po
+# source='libyasm/bc-reserve.c' object='bc-reserve.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bc-reserve.o `test -f 'libyasm/bc-reserve.c' || echo '$(srcdir)/'`libyasm/bc-reserve.c
+
+bc-reserve.obj: libyasm/bc-reserve.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bc-reserve.obj -MD -MP -MF $(DEPDIR)/bc-reserve.Tpo -c -o bc-reserve.obj `if test -f 'libyasm/bc-reserve.c'; then $(CYGPATH_W) 'libyasm/bc-reserve.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bc-reserve.c'; fi`
+ mv -f $(DEPDIR)/bc-reserve.Tpo $(DEPDIR)/bc-reserve.Po
+# source='libyasm/bc-reserve.c' object='bc-reserve.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bc-reserve.obj `if test -f 'libyasm/bc-reserve.c'; then $(CYGPATH_W) 'libyasm/bc-reserve.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bc-reserve.c'; fi`
+
+bytecode.o: libyasm/bytecode.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bytecode.o -MD -MP -MF $(DEPDIR)/bytecode.Tpo -c -o bytecode.o `test -f 'libyasm/bytecode.c' || echo '$(srcdir)/'`libyasm/bytecode.c
+ mv -f $(DEPDIR)/bytecode.Tpo $(DEPDIR)/bytecode.Po
+# source='libyasm/bytecode.c' object='bytecode.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bytecode.o `test -f 'libyasm/bytecode.c' || echo '$(srcdir)/'`libyasm/bytecode.c
+
+bytecode.obj: libyasm/bytecode.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bytecode.obj -MD -MP -MF $(DEPDIR)/bytecode.Tpo -c -o bytecode.obj `if test -f 'libyasm/bytecode.c'; then $(CYGPATH_W) 'libyasm/bytecode.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bytecode.c'; fi`
+ mv -f $(DEPDIR)/bytecode.Tpo $(DEPDIR)/bytecode.Po
+# source='libyasm/bytecode.c' object='bytecode.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bytecode.obj `if test -f 'libyasm/bytecode.c'; then $(CYGPATH_W) 'libyasm/bytecode.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bytecode.c'; fi`
+
+errwarn.o: libyasm/errwarn.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT errwarn.o -MD -MP -MF $(DEPDIR)/errwarn.Tpo -c -o errwarn.o `test -f 'libyasm/errwarn.c' || echo '$(srcdir)/'`libyasm/errwarn.c
+ mv -f $(DEPDIR)/errwarn.Tpo $(DEPDIR)/errwarn.Po
+# source='libyasm/errwarn.c' object='errwarn.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o errwarn.o `test -f 'libyasm/errwarn.c' || echo '$(srcdir)/'`libyasm/errwarn.c
+
+errwarn.obj: libyasm/errwarn.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT errwarn.obj -MD -MP -MF $(DEPDIR)/errwarn.Tpo -c -o errwarn.obj `if test -f 'libyasm/errwarn.c'; then $(CYGPATH_W) 'libyasm/errwarn.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/errwarn.c'; fi`
+ mv -f $(DEPDIR)/errwarn.Tpo $(DEPDIR)/errwarn.Po
+# source='libyasm/errwarn.c' object='errwarn.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o errwarn.obj `if test -f 'libyasm/errwarn.c'; then $(CYGPATH_W) 'libyasm/errwarn.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/errwarn.c'; fi`
+
+expr.o: libyasm/expr.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT expr.o -MD -MP -MF $(DEPDIR)/expr.Tpo -c -o expr.o `test -f 'libyasm/expr.c' || echo '$(srcdir)/'`libyasm/expr.c
+ mv -f $(DEPDIR)/expr.Tpo $(DEPDIR)/expr.Po
+# source='libyasm/expr.c' object='expr.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o expr.o `test -f 'libyasm/expr.c' || echo '$(srcdir)/'`libyasm/expr.c
+
+expr.obj: libyasm/expr.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT expr.obj -MD -MP -MF $(DEPDIR)/expr.Tpo -c -o expr.obj `if test -f 'libyasm/expr.c'; then $(CYGPATH_W) 'libyasm/expr.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/expr.c'; fi`
+ mv -f $(DEPDIR)/expr.Tpo $(DEPDIR)/expr.Po
+# source='libyasm/expr.c' object='expr.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o expr.obj `if test -f 'libyasm/expr.c'; then $(CYGPATH_W) 'libyasm/expr.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/expr.c'; fi`
+
+file.o: libyasm/file.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT file.o -MD -MP -MF $(DEPDIR)/file.Tpo -c -o file.o `test -f 'libyasm/file.c' || echo '$(srcdir)/'`libyasm/file.c
+ mv -f $(DEPDIR)/file.Tpo $(DEPDIR)/file.Po
+# source='libyasm/file.c' object='file.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o file.o `test -f 'libyasm/file.c' || echo '$(srcdir)/'`libyasm/file.c
+
+file.obj: libyasm/file.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT file.obj -MD -MP -MF $(DEPDIR)/file.Tpo -c -o file.obj `if test -f 'libyasm/file.c'; then $(CYGPATH_W) 'libyasm/file.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/file.c'; fi`
+ mv -f $(DEPDIR)/file.Tpo $(DEPDIR)/file.Po
+# source='libyasm/file.c' object='file.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o file.obj `if test -f 'libyasm/file.c'; then $(CYGPATH_W) 'libyasm/file.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/file.c'; fi`
+
+floatnum.o: libyasm/floatnum.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT floatnum.o -MD -MP -MF $(DEPDIR)/floatnum.Tpo -c -o floatnum.o `test -f 'libyasm/floatnum.c' || echo '$(srcdir)/'`libyasm/floatnum.c
+ mv -f $(DEPDIR)/floatnum.Tpo $(DEPDIR)/floatnum.Po
+# source='libyasm/floatnum.c' object='floatnum.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o floatnum.o `test -f 'libyasm/floatnum.c' || echo '$(srcdir)/'`libyasm/floatnum.c
+
+floatnum.obj: libyasm/floatnum.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT floatnum.obj -MD -MP -MF $(DEPDIR)/floatnum.Tpo -c -o floatnum.obj `if test -f 'libyasm/floatnum.c'; then $(CYGPATH_W) 'libyasm/floatnum.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/floatnum.c'; fi`
+ mv -f $(DEPDIR)/floatnum.Tpo $(DEPDIR)/floatnum.Po
+# source='libyasm/floatnum.c' object='floatnum.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o floatnum.obj `if test -f 'libyasm/floatnum.c'; then $(CYGPATH_W) 'libyasm/floatnum.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/floatnum.c'; fi`
+
+hamt.o: libyasm/hamt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT hamt.o -MD -MP -MF $(DEPDIR)/hamt.Tpo -c -o hamt.o `test -f 'libyasm/hamt.c' || echo '$(srcdir)/'`libyasm/hamt.c
+ mv -f $(DEPDIR)/hamt.Tpo $(DEPDIR)/hamt.Po
+# source='libyasm/hamt.c' object='hamt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o hamt.o `test -f 'libyasm/hamt.c' || echo '$(srcdir)/'`libyasm/hamt.c
+
+hamt.obj: libyasm/hamt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT hamt.obj -MD -MP -MF $(DEPDIR)/hamt.Tpo -c -o hamt.obj `if test -f 'libyasm/hamt.c'; then $(CYGPATH_W) 'libyasm/hamt.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/hamt.c'; fi`
+ mv -f $(DEPDIR)/hamt.Tpo $(DEPDIR)/hamt.Po
+# source='libyasm/hamt.c' object='hamt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o hamt.obj `if test -f 'libyasm/hamt.c'; then $(CYGPATH_W) 'libyasm/hamt.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/hamt.c'; fi`
+
+insn.o: libyasm/insn.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT insn.o -MD -MP -MF $(DEPDIR)/insn.Tpo -c -o insn.o `test -f 'libyasm/insn.c' || echo '$(srcdir)/'`libyasm/insn.c
+ mv -f $(DEPDIR)/insn.Tpo $(DEPDIR)/insn.Po
+# source='libyasm/insn.c' object='insn.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o insn.o `test -f 'libyasm/insn.c' || echo '$(srcdir)/'`libyasm/insn.c
+
+insn.obj: libyasm/insn.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT insn.obj -MD -MP -MF $(DEPDIR)/insn.Tpo -c -o insn.obj `if test -f 'libyasm/insn.c'; then $(CYGPATH_W) 'libyasm/insn.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/insn.c'; fi`
+ mv -f $(DEPDIR)/insn.Tpo $(DEPDIR)/insn.Po
+# source='libyasm/insn.c' object='insn.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o insn.obj `if test -f 'libyasm/insn.c'; then $(CYGPATH_W) 'libyasm/insn.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/insn.c'; fi`
+
+intnum.o: libyasm/intnum.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT intnum.o -MD -MP -MF $(DEPDIR)/intnum.Tpo -c -o intnum.o `test -f 'libyasm/intnum.c' || echo '$(srcdir)/'`libyasm/intnum.c
+ mv -f $(DEPDIR)/intnum.Tpo $(DEPDIR)/intnum.Po
+# source='libyasm/intnum.c' object='intnum.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o intnum.o `test -f 'libyasm/intnum.c' || echo '$(srcdir)/'`libyasm/intnum.c
+
+intnum.obj: libyasm/intnum.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT intnum.obj -MD -MP -MF $(DEPDIR)/intnum.Tpo -c -o intnum.obj `if test -f 'libyasm/intnum.c'; then $(CYGPATH_W) 'libyasm/intnum.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/intnum.c'; fi`
+ mv -f $(DEPDIR)/intnum.Tpo $(DEPDIR)/intnum.Po
+# source='libyasm/intnum.c' object='intnum.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o intnum.obj `if test -f 'libyasm/intnum.c'; then $(CYGPATH_W) 'libyasm/intnum.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/intnum.c'; fi`
+
+inttree.o: libyasm/inttree.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT inttree.o -MD -MP -MF $(DEPDIR)/inttree.Tpo -c -o inttree.o `test -f 'libyasm/inttree.c' || echo '$(srcdir)/'`libyasm/inttree.c
+ mv -f $(DEPDIR)/inttree.Tpo $(DEPDIR)/inttree.Po
+# source='libyasm/inttree.c' object='inttree.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o inttree.o `test -f 'libyasm/inttree.c' || echo '$(srcdir)/'`libyasm/inttree.c
+
+inttree.obj: libyasm/inttree.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT inttree.obj -MD -MP -MF $(DEPDIR)/inttree.Tpo -c -o inttree.obj `if test -f 'libyasm/inttree.c'; then $(CYGPATH_W) 'libyasm/inttree.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/inttree.c'; fi`
+ mv -f $(DEPDIR)/inttree.Tpo $(DEPDIR)/inttree.Po
+# source='libyasm/inttree.c' object='inttree.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o inttree.obj `if test -f 'libyasm/inttree.c'; then $(CYGPATH_W) 'libyasm/inttree.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/inttree.c'; fi`
+
+linemap.o: libyasm/linemap.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT linemap.o -MD -MP -MF $(DEPDIR)/linemap.Tpo -c -o linemap.o `test -f 'libyasm/linemap.c' || echo '$(srcdir)/'`libyasm/linemap.c
+ mv -f $(DEPDIR)/linemap.Tpo $(DEPDIR)/linemap.Po
+# source='libyasm/linemap.c' object='linemap.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o linemap.o `test -f 'libyasm/linemap.c' || echo '$(srcdir)/'`libyasm/linemap.c
+
+linemap.obj: libyasm/linemap.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT linemap.obj -MD -MP -MF $(DEPDIR)/linemap.Tpo -c -o linemap.obj `if test -f 'libyasm/linemap.c'; then $(CYGPATH_W) 'libyasm/linemap.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/linemap.c'; fi`
+ mv -f $(DEPDIR)/linemap.Tpo $(DEPDIR)/linemap.Po
+# source='libyasm/linemap.c' object='linemap.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o linemap.obj `if test -f 'libyasm/linemap.c'; then $(CYGPATH_W) 'libyasm/linemap.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/linemap.c'; fi`
+
+md5.o: libyasm/md5.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT md5.o -MD -MP -MF $(DEPDIR)/md5.Tpo -c -o md5.o `test -f 'libyasm/md5.c' || echo '$(srcdir)/'`libyasm/md5.c
+ mv -f $(DEPDIR)/md5.Tpo $(DEPDIR)/md5.Po
+# source='libyasm/md5.c' object='md5.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o md5.o `test -f 'libyasm/md5.c' || echo '$(srcdir)/'`libyasm/md5.c
+
+md5.obj: libyasm/md5.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT md5.obj -MD -MP -MF $(DEPDIR)/md5.Tpo -c -o md5.obj `if test -f 'libyasm/md5.c'; then $(CYGPATH_W) 'libyasm/md5.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/md5.c'; fi`
+ mv -f $(DEPDIR)/md5.Tpo $(DEPDIR)/md5.Po
+# source='libyasm/md5.c' object='md5.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o md5.obj `if test -f 'libyasm/md5.c'; then $(CYGPATH_W) 'libyasm/md5.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/md5.c'; fi`
+
+mergesort.o: libyasm/mergesort.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mergesort.o -MD -MP -MF $(DEPDIR)/mergesort.Tpo -c -o mergesort.o `test -f 'libyasm/mergesort.c' || echo '$(srcdir)/'`libyasm/mergesort.c
+ mv -f $(DEPDIR)/mergesort.Tpo $(DEPDIR)/mergesort.Po
+# source='libyasm/mergesort.c' object='mergesort.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mergesort.o `test -f 'libyasm/mergesort.c' || echo '$(srcdir)/'`libyasm/mergesort.c
+
+mergesort.obj: libyasm/mergesort.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mergesort.obj -MD -MP -MF $(DEPDIR)/mergesort.Tpo -c -o mergesort.obj `if test -f 'libyasm/mergesort.c'; then $(CYGPATH_W) 'libyasm/mergesort.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/mergesort.c'; fi`
+ mv -f $(DEPDIR)/mergesort.Tpo $(DEPDIR)/mergesort.Po
+# source='libyasm/mergesort.c' object='mergesort.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mergesort.obj `if test -f 'libyasm/mergesort.c'; then $(CYGPATH_W) 'libyasm/mergesort.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/mergesort.c'; fi`
+
+phash.o: libyasm/phash.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT phash.o -MD -MP -MF $(DEPDIR)/phash.Tpo -c -o phash.o `test -f 'libyasm/phash.c' || echo '$(srcdir)/'`libyasm/phash.c
+ mv -f $(DEPDIR)/phash.Tpo $(DEPDIR)/phash.Po
+# source='libyasm/phash.c' object='phash.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o phash.o `test -f 'libyasm/phash.c' || echo '$(srcdir)/'`libyasm/phash.c
+
+phash.obj: libyasm/phash.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT phash.obj -MD -MP -MF $(DEPDIR)/phash.Tpo -c -o phash.obj `if test -f 'libyasm/phash.c'; then $(CYGPATH_W) 'libyasm/phash.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/phash.c'; fi`
+ mv -f $(DEPDIR)/phash.Tpo $(DEPDIR)/phash.Po
+# source='libyasm/phash.c' object='phash.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o phash.obj `if test -f 'libyasm/phash.c'; then $(CYGPATH_W) 'libyasm/phash.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/phash.c'; fi`
+
+section.o: libyasm/section.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT section.o -MD -MP -MF $(DEPDIR)/section.Tpo -c -o section.o `test -f 'libyasm/section.c' || echo '$(srcdir)/'`libyasm/section.c
+ mv -f $(DEPDIR)/section.Tpo $(DEPDIR)/section.Po
+# source='libyasm/section.c' object='section.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o section.o `test -f 'libyasm/section.c' || echo '$(srcdir)/'`libyasm/section.c
+
+section.obj: libyasm/section.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT section.obj -MD -MP -MF $(DEPDIR)/section.Tpo -c -o section.obj `if test -f 'libyasm/section.c'; then $(CYGPATH_W) 'libyasm/section.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/section.c'; fi`
+ mv -f $(DEPDIR)/section.Tpo $(DEPDIR)/section.Po
+# source='libyasm/section.c' object='section.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o section.obj `if test -f 'libyasm/section.c'; then $(CYGPATH_W) 'libyasm/section.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/section.c'; fi`
+
+strcasecmp.o: libyasm/strcasecmp.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT strcasecmp.o -MD -MP -MF $(DEPDIR)/strcasecmp.Tpo -c -o strcasecmp.o `test -f 'libyasm/strcasecmp.c' || echo '$(srcdir)/'`libyasm/strcasecmp.c
+ mv -f $(DEPDIR)/strcasecmp.Tpo $(DEPDIR)/strcasecmp.Po
+# source='libyasm/strcasecmp.c' object='strcasecmp.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o strcasecmp.o `test -f 'libyasm/strcasecmp.c' || echo '$(srcdir)/'`libyasm/strcasecmp.c
+
+strcasecmp.obj: libyasm/strcasecmp.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT strcasecmp.obj -MD -MP -MF $(DEPDIR)/strcasecmp.Tpo -c -o strcasecmp.obj `if test -f 'libyasm/strcasecmp.c'; then $(CYGPATH_W) 'libyasm/strcasecmp.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/strcasecmp.c'; fi`
+ mv -f $(DEPDIR)/strcasecmp.Tpo $(DEPDIR)/strcasecmp.Po
+# source='libyasm/strcasecmp.c' object='strcasecmp.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o strcasecmp.obj `if test -f 'libyasm/strcasecmp.c'; then $(CYGPATH_W) 'libyasm/strcasecmp.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/strcasecmp.c'; fi`
+
+strsep.o: libyasm/strsep.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT strsep.o -MD -MP -MF $(DEPDIR)/strsep.Tpo -c -o strsep.o `test -f 'libyasm/strsep.c' || echo '$(srcdir)/'`libyasm/strsep.c
+ mv -f $(DEPDIR)/strsep.Tpo $(DEPDIR)/strsep.Po
+# source='libyasm/strsep.c' object='strsep.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o strsep.o `test -f 'libyasm/strsep.c' || echo '$(srcdir)/'`libyasm/strsep.c
+
+strsep.obj: libyasm/strsep.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT strsep.obj -MD -MP -MF $(DEPDIR)/strsep.Tpo -c -o strsep.obj `if test -f 'libyasm/strsep.c'; then $(CYGPATH_W) 'libyasm/strsep.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/strsep.c'; fi`
+ mv -f $(DEPDIR)/strsep.Tpo $(DEPDIR)/strsep.Po
+# source='libyasm/strsep.c' object='strsep.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o strsep.obj `if test -f 'libyasm/strsep.c'; then $(CYGPATH_W) 'libyasm/strsep.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/strsep.c'; fi`
+
+symrec.o: libyasm/symrec.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT symrec.o -MD -MP -MF $(DEPDIR)/symrec.Tpo -c -o symrec.o `test -f 'libyasm/symrec.c' || echo '$(srcdir)/'`libyasm/symrec.c
+ mv -f $(DEPDIR)/symrec.Tpo $(DEPDIR)/symrec.Po
+# source='libyasm/symrec.c' object='symrec.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o symrec.o `test -f 'libyasm/symrec.c' || echo '$(srcdir)/'`libyasm/symrec.c
+
+symrec.obj: libyasm/symrec.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT symrec.obj -MD -MP -MF $(DEPDIR)/symrec.Tpo -c -o symrec.obj `if test -f 'libyasm/symrec.c'; then $(CYGPATH_W) 'libyasm/symrec.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/symrec.c'; fi`
+ mv -f $(DEPDIR)/symrec.Tpo $(DEPDIR)/symrec.Po
+# source='libyasm/symrec.c' object='symrec.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o symrec.obj `if test -f 'libyasm/symrec.c'; then $(CYGPATH_W) 'libyasm/symrec.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/symrec.c'; fi`
+
+valparam.o: libyasm/valparam.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT valparam.o -MD -MP -MF $(DEPDIR)/valparam.Tpo -c -o valparam.o `test -f 'libyasm/valparam.c' || echo '$(srcdir)/'`libyasm/valparam.c
+ mv -f $(DEPDIR)/valparam.Tpo $(DEPDIR)/valparam.Po
+# source='libyasm/valparam.c' object='valparam.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o valparam.o `test -f 'libyasm/valparam.c' || echo '$(srcdir)/'`libyasm/valparam.c
+
+valparam.obj: libyasm/valparam.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT valparam.obj -MD -MP -MF $(DEPDIR)/valparam.Tpo -c -o valparam.obj `if test -f 'libyasm/valparam.c'; then $(CYGPATH_W) 'libyasm/valparam.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/valparam.c'; fi`
+ mv -f $(DEPDIR)/valparam.Tpo $(DEPDIR)/valparam.Po
+# source='libyasm/valparam.c' object='valparam.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o valparam.obj `if test -f 'libyasm/valparam.c'; then $(CYGPATH_W) 'libyasm/valparam.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/valparam.c'; fi`
+
+value.o: libyasm/value.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT value.o -MD -MP -MF $(DEPDIR)/value.Tpo -c -o value.o `test -f 'libyasm/value.c' || echo '$(srcdir)/'`libyasm/value.c
+ mv -f $(DEPDIR)/value.Tpo $(DEPDIR)/value.Po
+# source='libyasm/value.c' object='value.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o value.o `test -f 'libyasm/value.c' || echo '$(srcdir)/'`libyasm/value.c
+
+value.obj: libyasm/value.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT value.obj -MD -MP -MF $(DEPDIR)/value.Tpo -c -o value.obj `if test -f 'libyasm/value.c'; then $(CYGPATH_W) 'libyasm/value.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/value.c'; fi`
+ mv -f $(DEPDIR)/value.Tpo $(DEPDIR)/value.Po
+# source='libyasm/value.c' object='value.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o value.obj `if test -f 'libyasm/value.c'; then $(CYGPATH_W) 'libyasm/value.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/value.c'; fi`
+
+xmalloc.o: libyasm/xmalloc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xmalloc.o -MD -MP -MF $(DEPDIR)/xmalloc.Tpo -c -o xmalloc.o `test -f 'libyasm/xmalloc.c' || echo '$(srcdir)/'`libyasm/xmalloc.c
+ mv -f $(DEPDIR)/xmalloc.Tpo $(DEPDIR)/xmalloc.Po
+# source='libyasm/xmalloc.c' object='xmalloc.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xmalloc.o `test -f 'libyasm/xmalloc.c' || echo '$(srcdir)/'`libyasm/xmalloc.c
+
+xmalloc.obj: libyasm/xmalloc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xmalloc.obj -MD -MP -MF $(DEPDIR)/xmalloc.Tpo -c -o xmalloc.obj `if test -f 'libyasm/xmalloc.c'; then $(CYGPATH_W) 'libyasm/xmalloc.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/xmalloc.c'; fi`
+ mv -f $(DEPDIR)/xmalloc.Tpo $(DEPDIR)/xmalloc.Po
+# source='libyasm/xmalloc.c' object='xmalloc.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xmalloc.obj `if test -f 'libyasm/xmalloc.c'; then $(CYGPATH_W) 'libyasm/xmalloc.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/xmalloc.c'; fi`
+
+xstrdup.o: libyasm/xstrdup.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xstrdup.o -MD -MP -MF $(DEPDIR)/xstrdup.Tpo -c -o xstrdup.o `test -f 'libyasm/xstrdup.c' || echo '$(srcdir)/'`libyasm/xstrdup.c
+ mv -f $(DEPDIR)/xstrdup.Tpo $(DEPDIR)/xstrdup.Po
+# source='libyasm/xstrdup.c' object='xstrdup.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xstrdup.o `test -f 'libyasm/xstrdup.c' || echo '$(srcdir)/'`libyasm/xstrdup.c
+
+xstrdup.obj: libyasm/xstrdup.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xstrdup.obj -MD -MP -MF $(DEPDIR)/xstrdup.Tpo -c -o xstrdup.obj `if test -f 'libyasm/xstrdup.c'; then $(CYGPATH_W) 'libyasm/xstrdup.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/xstrdup.c'; fi`
+ mv -f $(DEPDIR)/xstrdup.Tpo $(DEPDIR)/xstrdup.Po
+# source='libyasm/xstrdup.c' object='xstrdup.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xstrdup.obj `if test -f 'libyasm/xstrdup.c'; then $(CYGPATH_W) 'libyasm/xstrdup.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/xstrdup.c'; fi`
+
+bitvect_test.o: libyasm/tests/bitvect_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bitvect_test.o -MD -MP -MF $(DEPDIR)/bitvect_test.Tpo -c -o bitvect_test.o `test -f 'libyasm/tests/bitvect_test.c' || echo '$(srcdir)/'`libyasm/tests/bitvect_test.c
+ mv -f $(DEPDIR)/bitvect_test.Tpo $(DEPDIR)/bitvect_test.Po
+# source='libyasm/tests/bitvect_test.c' object='bitvect_test.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bitvect_test.o `test -f 'libyasm/tests/bitvect_test.c' || echo '$(srcdir)/'`libyasm/tests/bitvect_test.c
+
+bitvect_test.obj: libyasm/tests/bitvect_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bitvect_test.obj -MD -MP -MF $(DEPDIR)/bitvect_test.Tpo -c -o bitvect_test.obj `if test -f 'libyasm/tests/bitvect_test.c'; then $(CYGPATH_W) 'libyasm/tests/bitvect_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/bitvect_test.c'; fi`
+ mv -f $(DEPDIR)/bitvect_test.Tpo $(DEPDIR)/bitvect_test.Po
+# source='libyasm/tests/bitvect_test.c' object='bitvect_test.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bitvect_test.obj `if test -f 'libyasm/tests/bitvect_test.c'; then $(CYGPATH_W) 'libyasm/tests/bitvect_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/bitvect_test.c'; fi`
+
+combpath_test.o: libyasm/tests/combpath_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT combpath_test.o -MD -MP -MF $(DEPDIR)/combpath_test.Tpo -c -o combpath_test.o `test -f 'libyasm/tests/combpath_test.c' || echo '$(srcdir)/'`libyasm/tests/combpath_test.c
+ mv -f $(DEPDIR)/combpath_test.Tpo $(DEPDIR)/combpath_test.Po
+# source='libyasm/tests/combpath_test.c' object='combpath_test.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o combpath_test.o `test -f 'libyasm/tests/combpath_test.c' || echo '$(srcdir)/'`libyasm/tests/combpath_test.c
+
+combpath_test.obj: libyasm/tests/combpath_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT combpath_test.obj -MD -MP -MF $(DEPDIR)/combpath_test.Tpo -c -o combpath_test.obj `if test -f 'libyasm/tests/combpath_test.c'; then $(CYGPATH_W) 'libyasm/tests/combpath_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/combpath_test.c'; fi`
+ mv -f $(DEPDIR)/combpath_test.Tpo $(DEPDIR)/combpath_test.Po
+# source='libyasm/tests/combpath_test.c' object='combpath_test.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o combpath_test.obj `if test -f 'libyasm/tests/combpath_test.c'; then $(CYGPATH_W) 'libyasm/tests/combpath_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/combpath_test.c'; fi`
+
+floatnum_test.o: libyasm/tests/floatnum_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT floatnum_test.o -MD -MP -MF $(DEPDIR)/floatnum_test.Tpo -c -o floatnum_test.o `test -f 'libyasm/tests/floatnum_test.c' || echo '$(srcdir)/'`libyasm/tests/floatnum_test.c
+ mv -f $(DEPDIR)/floatnum_test.Tpo $(DEPDIR)/floatnum_test.Po
+# source='libyasm/tests/floatnum_test.c' object='floatnum_test.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o floatnum_test.o `test -f 'libyasm/tests/floatnum_test.c' || echo '$(srcdir)/'`libyasm/tests/floatnum_test.c
+
+floatnum_test.obj: libyasm/tests/floatnum_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT floatnum_test.obj -MD -MP -MF $(DEPDIR)/floatnum_test.Tpo -c -o floatnum_test.obj `if test -f 'libyasm/tests/floatnum_test.c'; then $(CYGPATH_W) 'libyasm/tests/floatnum_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/floatnum_test.c'; fi`
+ mv -f $(DEPDIR)/floatnum_test.Tpo $(DEPDIR)/floatnum_test.Po
+# source='libyasm/tests/floatnum_test.c' object='floatnum_test.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o floatnum_test.obj `if test -f 'libyasm/tests/floatnum_test.c'; then $(CYGPATH_W) 'libyasm/tests/floatnum_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/floatnum_test.c'; fi`
+
+leb128_test.o: libyasm/tests/leb128_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT leb128_test.o -MD -MP -MF $(DEPDIR)/leb128_test.Tpo -c -o leb128_test.o `test -f 'libyasm/tests/leb128_test.c' || echo '$(srcdir)/'`libyasm/tests/leb128_test.c
+ mv -f $(DEPDIR)/leb128_test.Tpo $(DEPDIR)/leb128_test.Po
+# source='libyasm/tests/leb128_test.c' object='leb128_test.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o leb128_test.o `test -f 'libyasm/tests/leb128_test.c' || echo '$(srcdir)/'`libyasm/tests/leb128_test.c
+
+leb128_test.obj: libyasm/tests/leb128_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT leb128_test.obj -MD -MP -MF $(DEPDIR)/leb128_test.Tpo -c -o leb128_test.obj `if test -f 'libyasm/tests/leb128_test.c'; then $(CYGPATH_W) 'libyasm/tests/leb128_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/leb128_test.c'; fi`
+ mv -f $(DEPDIR)/leb128_test.Tpo $(DEPDIR)/leb128_test.Po
+# source='libyasm/tests/leb128_test.c' object='leb128_test.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o leb128_test.obj `if test -f 'libyasm/tests/leb128_test.c'; then $(CYGPATH_W) 'libyasm/tests/leb128_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/leb128_test.c'; fi`
+
+splitpath_test.o: libyasm/tests/splitpath_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT splitpath_test.o -MD -MP -MF $(DEPDIR)/splitpath_test.Tpo -c -o splitpath_test.o `test -f 'libyasm/tests/splitpath_test.c' || echo '$(srcdir)/'`libyasm/tests/splitpath_test.c
+ mv -f $(DEPDIR)/splitpath_test.Tpo $(DEPDIR)/splitpath_test.Po
+# source='libyasm/tests/splitpath_test.c' object='splitpath_test.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o splitpath_test.o `test -f 'libyasm/tests/splitpath_test.c' || echo '$(srcdir)/'`libyasm/tests/splitpath_test.c
+
+splitpath_test.obj: libyasm/tests/splitpath_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT splitpath_test.obj -MD -MP -MF $(DEPDIR)/splitpath_test.Tpo -c -o splitpath_test.obj `if test -f 'libyasm/tests/splitpath_test.c'; then $(CYGPATH_W) 'libyasm/tests/splitpath_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/splitpath_test.c'; fi`
+ mv -f $(DEPDIR)/splitpath_test.Tpo $(DEPDIR)/splitpath_test.Po
+# source='libyasm/tests/splitpath_test.c' object='splitpath_test.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o splitpath_test.obj `if test -f 'libyasm/tests/splitpath_test.c'; then $(CYGPATH_W) 'libyasm/tests/splitpath_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/splitpath_test.c'; fi`
+
+uncstring_test.o: libyasm/tests/uncstring_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT uncstring_test.o -MD -MP -MF $(DEPDIR)/uncstring_test.Tpo -c -o uncstring_test.o `test -f 'libyasm/tests/uncstring_test.c' || echo '$(srcdir)/'`libyasm/tests/uncstring_test.c
+ mv -f $(DEPDIR)/uncstring_test.Tpo $(DEPDIR)/uncstring_test.Po
+# source='libyasm/tests/uncstring_test.c' object='uncstring_test.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o uncstring_test.o `test -f 'libyasm/tests/uncstring_test.c' || echo '$(srcdir)/'`libyasm/tests/uncstring_test.c
+
+uncstring_test.obj: libyasm/tests/uncstring_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT uncstring_test.obj -MD -MP -MF $(DEPDIR)/uncstring_test.Tpo -c -o uncstring_test.obj `if test -f 'libyasm/tests/uncstring_test.c'; then $(CYGPATH_W) 'libyasm/tests/uncstring_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/uncstring_test.c'; fi`
+ mv -f $(DEPDIR)/uncstring_test.Tpo $(DEPDIR)/uncstring_test.Po
+# source='libyasm/tests/uncstring_test.c' object='uncstring_test.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o uncstring_test.obj `if test -f 'libyasm/tests/uncstring_test.c'; then $(CYGPATH_W) 'libyasm/tests/uncstring_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/uncstring_test.c'; fi`
+
+yasm.o: frontends/yasm/yasm.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT yasm.o -MD -MP -MF $(DEPDIR)/yasm.Tpo -c -o yasm.o `test -f 'frontends/yasm/yasm.c' || echo '$(srcdir)/'`frontends/yasm/yasm.c
+ mv -f $(DEPDIR)/yasm.Tpo $(DEPDIR)/yasm.Po
+# source='frontends/yasm/yasm.c' object='yasm.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o yasm.o `test -f 'frontends/yasm/yasm.c' || echo '$(srcdir)/'`frontends/yasm/yasm.c
+
+yasm.obj: frontends/yasm/yasm.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT yasm.obj -MD -MP -MF $(DEPDIR)/yasm.Tpo -c -o yasm.obj `if test -f 'frontends/yasm/yasm.c'; then $(CYGPATH_W) 'frontends/yasm/yasm.c'; else $(CYGPATH_W) '$(srcdir)/frontends/yasm/yasm.c'; fi`
+ mv -f $(DEPDIR)/yasm.Tpo $(DEPDIR)/yasm.Po
+# source='frontends/yasm/yasm.c' object='yasm.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o yasm.obj `if test -f 'frontends/yasm/yasm.c'; then $(CYGPATH_W) 'frontends/yasm/yasm.c'; else $(CYGPATH_W) '$(srcdir)/frontends/yasm/yasm.c'; fi`
+
+yasm-options.o: frontends/yasm/yasm-options.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT yasm-options.o -MD -MP -MF $(DEPDIR)/yasm-options.Tpo -c -o yasm-options.o `test -f 'frontends/yasm/yasm-options.c' || echo '$(srcdir)/'`frontends/yasm/yasm-options.c
+ mv -f $(DEPDIR)/yasm-options.Tpo $(DEPDIR)/yasm-options.Po
+# source='frontends/yasm/yasm-options.c' object='yasm-options.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o yasm-options.o `test -f 'frontends/yasm/yasm-options.c' || echo '$(srcdir)/'`frontends/yasm/yasm-options.c
+
+yasm-options.obj: frontends/yasm/yasm-options.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT yasm-options.obj -MD -MP -MF $(DEPDIR)/yasm-options.Tpo -c -o yasm-options.obj `if test -f 'frontends/yasm/yasm-options.c'; then $(CYGPATH_W) 'frontends/yasm/yasm-options.c'; else $(CYGPATH_W) '$(srcdir)/frontends/yasm/yasm-options.c'; fi`
+ mv -f $(DEPDIR)/yasm-options.Tpo $(DEPDIR)/yasm-options.Po
+# source='frontends/yasm/yasm-options.c' object='yasm-options.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o yasm-options.obj `if test -f 'frontends/yasm/yasm-options.c'; then $(CYGPATH_W) 'frontends/yasm/yasm-options.c'; else $(CYGPATH_W) '$(srcdir)/frontends/yasm/yasm-options.c'; fi`
+
+tasm.o: frontends/tasm/tasm.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tasm.o -MD -MP -MF $(DEPDIR)/tasm.Tpo -c -o tasm.o `test -f 'frontends/tasm/tasm.c' || echo '$(srcdir)/'`frontends/tasm/tasm.c
+ mv -f $(DEPDIR)/tasm.Tpo $(DEPDIR)/tasm.Po
+# source='frontends/tasm/tasm.c' object='tasm.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tasm.o `test -f 'frontends/tasm/tasm.c' || echo '$(srcdir)/'`frontends/tasm/tasm.c
+
+tasm.obj: frontends/tasm/tasm.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tasm.obj -MD -MP -MF $(DEPDIR)/tasm.Tpo -c -o tasm.obj `if test -f 'frontends/tasm/tasm.c'; then $(CYGPATH_W) 'frontends/tasm/tasm.c'; else $(CYGPATH_W) '$(srcdir)/frontends/tasm/tasm.c'; fi`
+ mv -f $(DEPDIR)/tasm.Tpo $(DEPDIR)/tasm.Po
+# source='frontends/tasm/tasm.c' object='tasm.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tasm.obj `if test -f 'frontends/tasm/tasm.c'; then $(CYGPATH_W) 'frontends/tasm/tasm.c'; else $(CYGPATH_W) '$(srcdir)/frontends/tasm/tasm.c'; fi`
+
+tasm-options.o: frontends/tasm/tasm-options.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tasm-options.o -MD -MP -MF $(DEPDIR)/tasm-options.Tpo -c -o tasm-options.o `test -f 'frontends/tasm/tasm-options.c' || echo '$(srcdir)/'`frontends/tasm/tasm-options.c
+ mv -f $(DEPDIR)/tasm-options.Tpo $(DEPDIR)/tasm-options.Po
+# source='frontends/tasm/tasm-options.c' object='tasm-options.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tasm-options.o `test -f 'frontends/tasm/tasm-options.c' || echo '$(srcdir)/'`frontends/tasm/tasm-options.c
+
+tasm-options.obj: frontends/tasm/tasm-options.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tasm-options.obj -MD -MP -MF $(DEPDIR)/tasm-options.Tpo -c -o tasm-options.obj `if test -f 'frontends/tasm/tasm-options.c'; then $(CYGPATH_W) 'frontends/tasm/tasm-options.c'; else $(CYGPATH_W) '$(srcdir)/frontends/tasm/tasm-options.c'; fi`
+ mv -f $(DEPDIR)/tasm-options.Tpo $(DEPDIR)/tasm-options.Po
+# source='frontends/tasm/tasm-options.c' object='tasm-options.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tasm-options.obj `if test -f 'frontends/tasm/tasm-options.c'; then $(CYGPATH_W) 'frontends/tasm/tasm-options.c'; else $(CYGPATH_W) '$(srcdir)/frontends/tasm/tasm-options.c'; fi`
+install-man1: $(man1_MANS) $(man_MANS)
+ @$(NORMAL_INSTALL)
+ test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)"
+ @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.1*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
+ else file=$$i; fi; \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 1*) ;; \
+ *) ext='1' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \
+ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst"; \
+ done
+uninstall-man1:
+ @$(NORMAL_UNINSTALL)
+ @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.1*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 1*) ;; \
+ *) ext='1' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " rm -f '$(DESTDIR)$(man1dir)/$$inst'"; \
+ rm -f "$(DESTDIR)$(man1dir)/$$inst"; \
+ done
+install-man7: $(man7_MANS) $(man_MANS)
+ @$(NORMAL_INSTALL)
+ test -z "$(man7dir)" || $(MKDIR_P) "$(DESTDIR)$(man7dir)"
+ @list='$(man7_MANS) $(dist_man7_MANS) $(nodist_man7_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.7*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
+ else file=$$i; fi; \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 7*) ;; \
+ *) ext='7' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man7dir)/$$inst'"; \
+ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man7dir)/$$inst"; \
+ done
+uninstall-man7:
+ @$(NORMAL_UNINSTALL)
+ @list='$(man7_MANS) $(dist_man7_MANS) $(nodist_man7_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.7*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 7*) ;; \
+ *) ext='7' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " rm -f '$(DESTDIR)$(man7dir)/$$inst'"; \
+ rm -f "$(DESTDIR)$(man7dir)/$$inst"; \
+ done
+install-includeHEADERS: $(include_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)"
+ @list='$(include_HEADERS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includedir)/$$f'"; \
+ $(includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includedir)/$$f"; \
+ done
+
+uninstall-includeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(include_HEADERS)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(includedir)/$$f'"; \
+ rm -f "$(DESTDIR)$(includedir)/$$f"; \
+ done
+install-modincludeHEADERS: $(modinclude_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(modincludedir)" || $(MKDIR_P) "$(DESTDIR)$(modincludedir)"
+ @list='$(modinclude_HEADERS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(modincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(modincludedir)/$$f'"; \
+ $(modincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(modincludedir)/$$f"; \
+ done
+
+uninstall-modincludeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(modinclude_HEADERS)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(modincludedir)/$$f'"; \
+ rm -f "$(DESTDIR)$(modincludedir)/$$f"; \
+ done
+install-nodist_includeHEADERS: $(nodist_include_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)"
+ @list='$(nodist_include_HEADERS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(nodist_includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includedir)/$$f'"; \
+ $(nodist_includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includedir)/$$f"; \
+ done
+
+uninstall-nodist_includeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(nodist_include_HEADERS)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(includedir)/$$f'"; \
+ rm -f "$(DESTDIR)$(includedir)/$$f"; \
+ done
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+check-TESTS: $(TESTS)
+ @failed=0; all=0; xfail=0; xpass=0; skip=0; ws='[ ]'; \
+ srcdir=$(srcdir); export srcdir; \
+ list=' $(TESTS) '; \
+ if test -n "$$list"; then \
+ for tst in $$list; do \
+ if test -f ./$$tst; then dir=./; \
+ elif test -f $$tst; then dir=; \
+ else dir="$(srcdir)/"; fi; \
+ if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
+ all=`expr $$all + 1`; \
+ case " $(XFAIL_TESTS) " in \
+ *$$ws$$tst$$ws*) \
+ xpass=`expr $$xpass + 1`; \
+ failed=`expr $$failed + 1`; \
+ echo "XPASS: $$tst"; \
+ ;; \
+ *) \
+ echo "PASS: $$tst"; \
+ ;; \
+ esac; \
+ elif test $$? -ne 77; then \
+ all=`expr $$all + 1`; \
+ case " $(XFAIL_TESTS) " in \
+ *$$ws$$tst$$ws*) \
+ xfail=`expr $$xfail + 1`; \
+ echo "XFAIL: $$tst"; \
+ ;; \
+ *) \
+ failed=`expr $$failed + 1`; \
+ echo "FAIL: $$tst"; \
+ ;; \
+ esac; \
+ else \
+ skip=`expr $$skip + 1`; \
+ echo "SKIP: $$tst"; \
+ fi; \
+ done; \
+ if test "$$failed" -eq 0; then \
+ if test "$$xfail" -eq 0; then \
+ banner="All $$all tests passed"; \
+ else \
+ banner="All $$all tests behaved as expected ($$xfail expected failures)"; \
+ fi; \
+ else \
+ if test "$$xpass" -eq 0; then \
+ banner="$$failed of $$all tests failed"; \
+ else \
+ banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \
+ fi; \
+ fi; \
+ dashes="$$banner"; \
+ skipped=""; \
+ if test "$$skip" -ne 0; then \
+ skipped="($$skip tests were not run)"; \
+ test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
+ dashes="$$skipped"; \
+ fi; \
+ report=""; \
+ if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
+ report="Please report to $(PACKAGE_BUGREPORT)"; \
+ test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
+ dashes="$$report"; \
+ fi; \
+ dashes=`echo "$$dashes" | sed s/./=/g`; \
+ echo "$$dashes"; \
+ echo "$$banner"; \
+ test -z "$$skipped" || echo "$$skipped"; \
+ test -z "$$report" || echo "$$report"; \
+ echo "$$dashes"; \
+ test "$$failed" -eq 0; \
+ else :; fi
+
+distdir: $(DISTFILES)
+ $(am__remove_distdir)
+ test -d $(distdir) || mkdir $(distdir)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ distdir=`$(am__cd) $(distdir) && pwd`; \
+ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$top_distdir" \
+ distdir="$$distdir/$$subdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+ -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
+ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
+ || chmod -R a+r $(distdir)
+dist-gzip: distdir
+ tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+ $(am__remove_distdir)
+
+dist-bzip2: distdir
+ tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
+ $(am__remove_distdir)
+
+dist-lzma: distdir
+ tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
+ $(am__remove_distdir)
+
+dist-tarZ: distdir
+ tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
+ $(am__remove_distdir)
+
+dist-shar: distdir
+ shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+ $(am__remove_distdir)
+
+dist-zip: distdir
+ -rm -f $(distdir).zip
+ zip -rq $(distdir).zip $(distdir)
+ $(am__remove_distdir)
+
+dist dist-all: distdir
+ tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+ $(am__remove_distdir)
+
+# This target untars the dist file and tries a VPATH configuration. Then
+# it guarantees that the distribution is self-contained by making another
+# tarfile.
+distcheck: dist
+ case '$(DIST_ARCHIVES)' in \
+ *.tar.gz*) \
+ GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
+ *.tar.bz2*) \
+ bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
+ *.tar.lzma*) \
+ unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\
+ *.tar.Z*) \
+ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
+ *.shar.gz*) \
+ GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
+ *.zip*) \
+ unzip $(distdir).zip ;;\
+ esac
+ chmod -R a-w $(distdir); chmod a+w $(distdir)
+ mkdir $(distdir)/_build
+ mkdir $(distdir)/_inst
+ chmod a-w $(distdir)
+ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
+ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
+ && cd $(distdir)/_build \
+ && ../configure --srcdir=.. --prefix="$$dc_install_base" \
+ $(DISTCHECK_CONFIGURE_FLAGS) \
+ && $(MAKE) $(AM_MAKEFLAGS) \
+ && $(MAKE) $(AM_MAKEFLAGS) dvi \
+ && $(MAKE) $(AM_MAKEFLAGS) check \
+ && $(MAKE) $(AM_MAKEFLAGS) install \
+ && $(MAKE) $(AM_MAKEFLAGS) installcheck \
+ && $(MAKE) $(AM_MAKEFLAGS) uninstall \
+ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
+ distuninstallcheck \
+ && chmod -R a-w "$$dc_install_base" \
+ && ({ \
+ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
+ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
+ } || { rm -rf "$$dc_destdir"; exit 1; }) \
+ && rm -rf "$$dc_destdir" \
+ && $(MAKE) $(AM_MAKEFLAGS) dist \
+ && rm -rf $(DIST_ARCHIVES) \
+ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck
+ $(am__remove_distdir)
+ @(echo "$(distdir) archives ready for distribution: "; \
+ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
+ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
+distuninstallcheck:
+ @cd $(distuninstallcheck_dir) \
+ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
+ || { echo "ERROR: files left after uninstall:" ; \
+ if test -n "$(DESTDIR)"; then \
+ echo " (check DESTDIR support)"; \
+ fi ; \
+ $(distuninstallcheck_listfiles) ; \
+ exit 1; } >&2
+distcleancheck: distclean
+ @if test '$(srcdir)' = . ; then \
+ echo "ERROR: distcleancheck can only run from a VPATH build" ; \
+ exit 1 ; \
+ fi
+ @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
+ || { echo "ERROR: files left in build directory after distclean:" ; \
+ $(distcleancheck_listfiles) ; \
+ exit 1; } >&2
+check-am: all-am
+ $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
+ $(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) check-recursive
+all-am: Makefile $(LIBRARIES) $(PROGRAMS) $(MANS) $(HEADERS) config.h \
+ all-local
+installdirs: installdirs-recursive
+installdirs-am:
+ for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man7dir)" "$(DESTDIR)$(includedir)" "$(DESTDIR)$(modincludedir)" "$(DESTDIR)$(includedir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+ -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
+clean: clean-recursive
+
+clean-am: clean-binPROGRAMS clean-checkPROGRAMS clean-generic \
+ clean-libLIBRARIES clean-noinstPROGRAMS mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-hdr distclean-local distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am: install-includeHEADERS install-man \
+ install-modincludeHEADERS install-nodist_includeHEADERS
+
+install-dvi: install-dvi-recursive
+
+install-exec-am: install-binPROGRAMS install-libLIBRARIES
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) install-exec-hook
+
+install-html: install-html-recursive
+
+install-info: install-info-recursive
+
+install-man: install-man1 install-man7
+
+install-pdf: install-pdf-recursive
+
+install-ps: install-ps-recursive
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+ -rm -rf $(top_srcdir)/autom4te.cache
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS uninstall-includeHEADERS \
+ uninstall-libLIBRARIES uninstall-man \
+ uninstall-modincludeHEADERS uninstall-nodist_includeHEADERS
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) uninstall-hook
+
+uninstall-man: uninstall-man1 uninstall-man7
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+ install-exec-am install-strip uninstall-am
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+ all all-am all-local am--refresh check check-TESTS check-am \
+ clean clean-binPROGRAMS clean-checkPROGRAMS clean-generic \
+ clean-libLIBRARIES clean-noinstPROGRAMS ctags ctags-recursive \
+ dist dist-all dist-bzip2 dist-gzip dist-lzma dist-shar \
+ dist-tarZ dist-zip distcheck distclean distclean-compile \
+ distclean-generic distclean-hdr distclean-local distclean-tags \
+ distcleancheck distdir distuninstallcheck dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-exec-hook install-html \
+ install-html-am install-includeHEADERS install-info \
+ install-info-am install-libLIBRARIES install-man install-man1 \
+ install-man7 install-modincludeHEADERS \
+ install-nodist_includeHEADERS install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs installdirs-am maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic pdf pdf-am ps ps-am tags tags-recursive \
+ uninstall uninstall-am uninstall-binPROGRAMS uninstall-hook \
+ uninstall-includeHEADERS uninstall-libLIBRARIES uninstall-man \
+ uninstall-man1 uninstall-man7 uninstall-modincludeHEADERS \
+ uninstall-nodist_includeHEADERS
+
+
+re2c-main.$(OBJEXT): tools/re2c/main.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/re2c/main.c || echo '$(srcdir)/'`tools/re2c/main.c
+
+re2c-code.$(OBJEXT): tools/re2c/code.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/re2c/code.c || echo '$(srcdir)/'`tools/re2c/code.c
+
+re2c-dfa.$(OBJEXT): tools/re2c/dfa.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/re2c/dfa.c || echo '$(srcdir)/'`tools/re2c/dfa.c
+
+re2c-parser.$(OBJEXT): tools/re2c/parser.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/re2c/parser.c || echo '$(srcdir)/'`tools/re2c/parser.c
+
+re2c-actions.$(OBJEXT): tools/re2c/actions.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/re2c/actions.c || echo '$(srcdir)/'`tools/re2c/actions.c
+
+re2c-scanner.$(OBJEXT): tools/re2c/scanner.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/re2c/scanner.c || echo '$(srcdir)/'`tools/re2c/scanner.c
+
+re2c-mbo_getopt.$(OBJEXT): tools/re2c/mbo_getopt.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/re2c/mbo_getopt.c || echo '$(srcdir)/'`tools/re2c/mbo_getopt.c
+
+re2c-substr.$(OBJEXT): tools/re2c/substr.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/re2c/substr.c || echo '$(srcdir)/'`tools/re2c/substr.c
+
+re2c-translate.$(OBJEXT): tools/re2c/translate.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/re2c/translate.c || echo '$(srcdir)/'`tools/re2c/translate.c
+
+genmacro.$(OBJEXT): tools/genmacro/genmacro.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/genmacro/genmacro.c || echo '$(srcdir)/'`tools/genmacro/genmacro.c
+.gperf.c: genperf$(EXEEXT)
+ $(top_builddir)/genperf$(EXEEXT) $< $@
+
+genperf.$(OBJEXT): tools/genperf/genperf.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/genperf/genperf.c || echo '$(srcdir)/'`tools/genperf/genperf.c
+
+gp-perfect.$(OBJEXT): tools/genperf/perfect.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/genperf/perfect.c || echo '$(srcdir)/'`tools/genperf/perfect.c
+
+gp-phash.$(OBJEXT): libyasm/phash.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f libyasm/phash.c || echo '$(srcdir)/'`libyasm/phash.c
+
+gp-xmalloc.$(OBJEXT): libyasm/xmalloc.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f libyasm/xmalloc.c || echo '$(srcdir)/'`libyasm/xmalloc.c
+
+gp-xstrdup.$(OBJEXT): libyasm/xstrdup.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f libyasm/xstrdup.c || echo '$(srcdir)/'`libyasm/xstrdup.c
+
+# Use Pyxelator to generate Pyrex function headers.
+#_yasm.pxi: ${HEADERS}
+# @rm -rf .tmp
+# @mkdir .tmp
+# $(PYTHON) $(srcdir)/tools/python-yasm/pyxelator/wrap_yasm.py \
+# "YASM_DIR=${srcdir}" "CPP=${CPP}" "CPPFLAGS=${CPPFLAGS}"
+# @rm -rf .tmp
+
+# Need to build a local copy of the main Pyrex input file to include _yasm.pxi
+# from the build directory. Also need to fixup the other .pxi include paths.
+#yasm.pyx: $(srcdir)/tools/python-yasm/yasm.pyx
+# sed -e 's,^include "\([^_]\),include "${srcdir}/tools/python-yasm/\1,' \
+# $(srcdir)/tools/python-yasm/yasm.pyx > $@
+
+# Actually run Pyrex
+#yasm_python.c: yasm.pyx _yasm.pxi $(PYBINDING_DEPS)
+# $(PYTHON) -c "from Pyrex.Compiler.Main import main; main(command_line=1)" \
+# -o $@ yasm.pyx
+
+# Now the Python build magic...
+#python-setup.txt: Makefile
+# echo "includes=${DEFS} ${DEFAULT_INCLUDES} ${INCLUDES} ${AM_CPPFLAGS} ${CPPFLAGS}" > python-setup.txt
+# echo "sources=${libyasm_a_SOURCES}" >> python-setup.txt
+# echo "srcdir=${srcdir}" >> python-setup.txt
+# echo "gcc=${GCC}" >> python-setup.txt
+
+#.python-build: python-setup.txt yasm_python.c ${libyasm_a_SOURCES}
+# $(PYTHON) `test -f tools/python-yasm/setup.py || echo '$(srcdir)/'`tools/python-yasm/setup.py build
+# touch .python-build
+#python-build: .python-build
+
+#python-install: .python-build
+# $(PYTHON) `test -f tools/python-yasm/setup.py || echo '$(srcdir)/'`tools/python-yasm/setup.py install "--install-lib=$(DESTDIR)$(pythondir)"
+
+#python-uninstall:
+# rm -f `$(PYTHON) -c "import sys;sys.path.insert(0, '${DESTDIR}${pythondir}'); import yasm; print yasm.__file__"`
+
+python-build:
+python-install:
+python-uninstall:
+
+modules/arch/x86/x86id.c: x86insn_nasm.c x86insn_gas.c x86insns.c
+
+x86insn_nasm.gperf x86insn_gas.gperf x86insns.c: $(srcdir)/modules/arch/x86/gen_x86_insn.py
+ $(PYTHON) $(srcdir)/modules/arch/x86/gen_x86_insn.py
+#x86insn_nasm.gperf: $(srcdir)/x86insn_nasm.gperf
+# @echo Python must be installed to regenerate x86 instructions files
+# cp $(srcdir)/x86insn_nasm.gperf $@
+#x86insn_gas.gperf: $(srcdir)/x86insn_gas.gperf
+# @echo Python must be installed to regenerate x86 instructions files
+# cp $(srcdir)/x86insn_gas.gperf $@
+
+# Use suffix rules for gperf files
+x86insn_nasm.c: x86insn_nasm.gperf genperf$(EXEEXT)
+x86insn_gas.c: x86insn_gas.gperf genperf$(EXEEXT)
+x86cpu.c: $(srcdir)/modules/arch/x86/x86cpu.gperf genperf$(EXEEXT)
+ $(top_builddir)/genperf$(EXEEXT) $(srcdir)/modules/arch/x86/x86cpu.gperf $@
+x86regtmod.c: $(srcdir)/modules/arch/x86/x86regtmod.gperf genperf$(EXEEXT)
+ $(top_builddir)/genperf$(EXEEXT) $(srcdir)/modules/arch/x86/x86regtmod.gperf $@
+
+lc3bid.c: $(srcdir)/modules/arch/lc3b/lc3bid.re re2c$(EXEEXT)
+ $(top_builddir)/re2c$(EXEEXT) -s -o $@ $(srcdir)/modules/arch/lc3b/lc3bid.re
+
+#yasm_arch.7: modules/arch/yasm_arch.xml
+# $(XMLTO) -o $(top_builddir) man $(srcdir)/modules/arch/yasm_arch.xml
+
+#EXTRA_DIST += modules/listfmts/nasm/tests/Makefile.inc
+
+#include modules/listfmts/nasm/tests/Makefile.inc
+
+gas-token.c: $(srcdir)/modules/parsers/gas/gas-token.re re2c$(EXEEXT)
+ $(top_builddir)/re2c$(EXEEXT) -b -o $@ $(srcdir)/modules/parsers/gas/gas-token.re
+
+nasm-token.c: $(srcdir)/modules/parsers/nasm/nasm-token.re re2c$(EXEEXT)
+ $(top_builddir)/re2c$(EXEEXT) -b -o $@ $(srcdir)/modules/parsers/nasm/nasm-token.re
+
+$(top_srcdir)/modules/parsers/nasm/nasm-parser.c: nasm-macros.c
+
+nasm-macros.c: $(srcdir)/modules/parsers/nasm/nasm-std.mac genmacro$(EXEEXT)
+ $(top_builddir)/genmacro$(EXEEXT) $@ nasm_standard_mac $(srcdir)/modules/parsers/nasm/nasm-std.mac
+
+#yasm_parsers.7: modules/parsers/yasm_parsers.xml
+# $(XMLTO) -o $(top_builddir) man $(srcdir)/modules/parsers/yasm_parsers.xml
+
+$(top_srcdir)/modules/preprocs/nasm/nasm-preproc.c: nasm-version.c
+
+nasm-version.c: version.mac genmacro$(EXEEXT)
+ $(top_builddir)/genmacro$(EXEEXT) $@ nasm_version_mac version.mac
+
+version.mac: genversion$(EXEEXT)
+ $(top_builddir)/genversion$(EXEEXT) $@
+
+genversion.$(OBJEXT): modules/preprocs/nasm/genversion.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f modules/preprocs/nasm/genversion.c || echo '$(srcdir)/'`modules/preprocs/nasm/genversion.c
+
+#EXTRA_DIST += modules/dbgfmts/codeview/tests/Makefile.inc
+#include modules/dbgfmts/codeview/tests/Makefile.inc
+
+#yasm_dbgfmts.7: modules/dbgfmts/yasm_dbgfmts.xml
+# $(XMLTO) -o $(top_builddir) man $(srcdir)/modules/dbgfmts/yasm_dbgfmts.xml
+
+$(top_srcdir)/modules/objfmts/coff/coff-objfmt.c: win64-nasm.c win64-gas.c
+
+win64-nasm.c: $(srcdir)/modules/objfmts/coff/win64-nasm.mac genmacro$(EXEEXT)
+ $(top_builddir)/genmacro$(EXEEXT) $@ win64_nasm_stdmac $(srcdir)/modules/objfmts/coff/win64-nasm.mac
+
+win64-gas.c: $(srcdir)/modules/objfmts/coff/win64-gas.mac genmacro$(EXEEXT)
+ $(top_builddir)/genmacro$(EXEEXT) $@ win64_gas_stdmac $(srcdir)/modules/objfmts/coff/win64-gas.mac
+
+#yasm_objfmts.7: modules/objfmts/yasm_objfmts.xml
+# $(XMLTO) -o $(top_builddir) man $(srcdir)/modules/objfmts/yasm_objfmts.xml
+
+module.c: $(top_srcdir)/libyasm/module.in genmodule$(EXEEXT) Makefile
+ $(top_builddir)/genmodule$(EXEEXT) $(top_srcdir)/libyasm/module.in Makefile
+
+genmodule.$(OBJEXT): libyasm/genmodule.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f libyasm/genmodule.c || echo '$(srcdir)/'`libyasm/genmodule.c
+
+#yasm.1: frontends/yasm/yasm.xml
+# $(XMLTO) -o $(top_builddir) man $(srcdir)/frontends/yasm/yasm.xml
+
+$(srcdir)/frontends/yasm/yasm.c: license.c
+
+license.c: $(srcdir)/COPYING genstring$(EXEEXT)
+ $(top_builddir)/genstring$(EXEEXT) license_msg $@ $(srcdir)/COPYING
+
+distclean-local:
+ -rm -rf results
+ -rm -rf build
+
+all-local: python-build
+install-exec-hook: python-install
+uninstall-hook: python-uninstall
+
+genstring.$(OBJEXT): genstring.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f genstring.c || echo '$(srcdir)/'`genstring.c
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/chromium/third_party/pdfium/third_party/yasm/source/config/ios/config.h b/chromium/third_party/pdfium/third_party/yasm/source/config/ios/config.h
new file mode 100644
index 00000000000..f3b43d235a4
--- /dev/null
+++ b/chromium/third_party/pdfium/third_party/yasm/source/config/ios/config.h
@@ -0,0 +1,173 @@
+/* config.h. Generated from config.h.in by configure. */
+/* config.h.in. Generated from configure.ac by autoheader. */
+
+/* Command name to run C preprocessor */
+#define CPP_PROG "gcc -E"
+
+/* */
+/* #undef ENABLE_NLS */
+
+/* Define to 1 if you have the `abort' function. */
+#define HAVE_ABORT 1
+
+/* */
+/* #undef HAVE_CATGETS */
+
+/* Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the
+ CoreFoundation framework. */
+#define HAVE_CFLOCALECOPYCURRENT 1
+
+/* Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in
+ the CoreFoundation framework. */
+#define HAVE_CFPREFERENCESCOPYAPPVALUE 1
+
+/* Define if the GNU dcgettext() function is already present or preinstalled.
+ */
+/* #undef HAVE_DCGETTEXT */
+
+/* Define to 1 if you have the <direct.h> header file. */
+/* #undef HAVE_DIRECT_H */
+
+/* Define to 1 if you have the `ftruncate' function. */
+#define HAVE_FTRUNCATE 1
+
+/* Define to 1 if you have the `getcwd' function. */
+#define HAVE_GETCWD 1
+
+/* */
+/* #undef HAVE_GETTEXT */
+
+/* Define to 1 if you have the GNU C Library */
+/* #undef HAVE_GNU_C_LIBRARY */
+
+/* Define if you have the iconv() function and it works. */
+#define HAVE_ICONV 1
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* */
+/* #undef HAVE_LC_MESSAGES */
+
+/* Define to 1 if you have the <libgen.h> header file. */
+#define HAVE_LIBGEN_H 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the `mergesort' function. */
+#define HAVE_MERGESORT 1
+
+/* Define to 1 if you have the `popen' function. */
+#define HAVE_POPEN 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* */
+/* #undef HAVE_STPCPY */
+
+/* Define to 1 if you have the `strcasecmp' function. */
+#define HAVE_STRCASECMP 1
+
+/* Define to 1 if you have the `strcmpi' function. */
+/* #undef HAVE_STRCMPI */
+
+/* Define to 1 if you have the `stricmp' function. */
+/* #undef HAVE_STRICMP */
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the `strncasecmp' function. */
+#define HAVE_STRNCASECMP 1
+
+/* Define to 1 if you have the `strsep' function. */
+#define HAVE_STRSEP 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the `toascii' function. */
+#define HAVE_TOASCII 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define to 1 if you have the `vsnprintf' function. */
+#define HAVE_VSNPRINTF 1
+
+/* Define to 1 if you have the `_stricmp' function. */
+/* #undef HAVE__STRICMP */
+
+/* Name of package */
+#define PACKAGE "yasm"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "bug-yasm@tortall.net"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "yasm"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "yasm 1.2.0"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "yasm"
+
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "1.2.0"
+
+/* Define to 1 if the C compiler supports function prototypes. */
+#define PROTOTYPES 1
+
+/* The size of `char', as computed by sizeof. */
+/* #undef SIZEOF_CHAR */
+
+/* The size of `int', as computed by sizeof. */
+/* #undef SIZEOF_INT */
+
+/* The size of `long', as computed by sizeof. */
+/* #undef SIZEOF_LONG */
+
+/* The size of `short', as computed by sizeof. */
+/* #undef SIZEOF_SHORT */
+
+/* The size of `void*', as computed by sizeof. */
+/* #undef SIZEOF_VOIDP */
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Version number of package */
+#define VERSION "1.2.0"
+
+/* Define if using the dmalloc debugging malloc package */
+/* #undef WITH_DMALLOC */
+
+/* Define like PROTOTYPES; this can be used by system headers. */
+#define __PROTOTYPES 1
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef const */
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+ calls it, or to nothing if 'inline' is not supported under any name. */
+#ifndef __cplusplus
+/* #undef inline */
+#endif
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+/* #undef size_t */
diff --git a/chromium/third_party/pdfium/third_party/yasm/source/config/ios/libyasm-stdint.h b/chromium/third_party/pdfium/third_party/yasm/source/config/ios/libyasm-stdint.h
new file mode 100644
index 00000000000..851e85b788a
--- /dev/null
+++ b/chromium/third_party/pdfium/third_party/yasm/source/config/ios/libyasm-stdint.h
@@ -0,0 +1,9 @@
+#ifndef _YASM_LIBYASM_STDINT_H
+#define _YASM_LIBYASM_STDINT_H 1
+#ifndef _GENERATED_STDINT_H
+#define _GENERATED_STDINT_H "yasm 0.8.0"
+/* generated using gcc -std=gnu99 */
+#define _STDINT_HAVE_STDINT_H 1
+#include <stdint.h>
+#endif
+#endif
diff --git a/chromium/third_party/pdfium/third_party/yasm/source/config/linux/Makefile b/chromium/third_party/pdfium/third_party/yasm/source/config/linux/Makefile
new file mode 100644
index 00000000000..6fccce46a99
--- /dev/null
+++ b/chromium/third_party/pdfium/third_party/yasm/source/config/linux/Makefile
@@ -0,0 +1,3822 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# Makefile. Generated from Makefile.in by configure.
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+
+
+# $Id: Makefile.am 2184 2009-03-24 05:04:15Z peter $
+
+# $Id: Makefile.inc 2084 2008-05-09 07:08:17Z peter $
+
+# $Id: Makefile.inc 1718 2006-12-24 00:13:19Z peter $
+
+# These utility programs have to be built for BUILD host in cross-build.
+# This makes things rather non-standard automake
+
+# $Id: Makefile.inc 2084 2008-05-09 07:08:17Z peter $
+
+# These utility programs have to be built for BUILD host in cross-build.
+# This makes things rather non-standard automake
+
+# $Id: Makefile.inc 1939 2007-09-10 07:15:50Z peter $
+
+# These utility programs have to be built for BUILD host in cross-build.
+# This makes things rather non-standard automake
+
+# $Id: Makefile.inc 1948 2007-09-13 02:53:30Z peter $
+
+# $Id: Makefile.inc 1951 2007-09-14 05:19:10Z peter $
+
+# $Id: Makefile.inc 1598 2006-08-10 04:02:59Z peter $
+
+# $Id: Makefile.inc 1914 2007-08-20 05:13:35Z peter $
+
+# $Id: Makefile.inc 2111 2008-07-06 22:26:49Z peter $
+
+# $Id: Makefile.inc 2170 2009-01-14 08:28:13Z peter $
+
+# $Id: Makefile.inc 2192 2009-03-29 23:25:05Z peter $
+
+# $Id: Makefile.inc 1776 2007-02-19 02:36:10Z peter $
+
+# $Id: Makefile.inc 2111 2008-07-06 22:26:49Z peter $
+
+# $Id: Makefile.inc 1928 2007-09-07 22:03:34Z peter $
+
+# $Id: Makefile.inc 1152 2004-10-02 06:18:30Z peter $
+
+# $Id: Makefile.inc 1183 2004-12-01 07:49:18Z peter $
+
+# $Id: Makefile.inc 2130 2008-10-07 05:38:11Z peter $
+
+# $Id: Makefile.inc 1783 2007-02-22 03:40:31Z peter $
+
+# $Id: Makefile.inc 2169 2009-01-02 20:46:57Z peter $
+
+# $Id$
+
+# $Id: Makefile.inc 2130 2008-10-07 05:38:11Z peter $
+
+# $Id: Makefile.inc 2190 2009-03-25 03:40:59Z peter $
+
+# $Id: Makefile.inc 1137 2004-09-04 01:24:57Z peter $
+
+# $Id: Makefile.inc 2082 2008-05-09 06:46:02Z peter $
+
+# $Id: Makefile.inc 2063 2008-04-12 08:30:22Z peter $
+
+# $Id: Makefile.inc 2063 2008-04-12 08:30:22Z peter $
+
+# $Id: Makefile.inc 1966 2007-09-20 03:54:36Z peter $
+
+# $Id: Makefile.inc 2130 2008-10-07 05:38:11Z peter $
+
+# $Id: Makefile.inc 2185 2009-03-24 06:33:32Z peter $
+
+# $Id: Makefile.inc 2172 2009-01-27 06:38:14Z peter $
+
+# $Id: Makefile.inc 2176 2009-03-04 07:39:02Z peter $
+
+# Makefile for cpp module.
+# Copied from raw preprocessor module.
+
+# $Id: Makefile.inc 1662 2006-10-21 18:52:29Z peter $
+
+# $Id: Makefile.inc 1428 2006-03-27 02:15:19Z peter $
+
+# $Id: Makefile.inc 1378 2006-02-12 01:27:39Z peter $
+
+# $Id: Makefile.inc 1350 2006-01-29 21:11:03Z peter $
+
+# $Id: Makefile.inc 1851 2007-05-26 17:56:36Z peter $
+
+# $Id: Makefile.inc 1617 2006-09-16 05:43:41Z peter $
+
+# $Id: Makefile.inc 1350 2006-01-29 21:11:03Z peter $
+
+# $Id: Makefile.inc 1183 2004-12-01 07:49:18Z peter $
+
+# $Id: Makefile.inc 1183 2004-12-01 07:49:18Z peter $
+
+# $Id$
+
+# $Id: Makefile.inc 1732 2007-01-13 19:34:04Z peter $
+
+# $Id: Makefile.inc 1183 2004-12-01 07:49:18Z peter $
+
+# $Id: Makefile.inc 2130 2008-10-07 05:38:11Z peter $
+
+# $Id: Makefile.inc 2010 2007-11-14 08:33:32Z peter $
+
+# $Id: Makefile.inc 2010 2007-11-14 08:33:32Z peter $
+
+# $Id: Makefile.inc 1252 2005-09-28 05:50:51Z peter $
+
+# $Id: Makefile.inc 2036 2008-02-09 04:06:47Z peter $
+
+# $Id: Makefile.inc 2126 2008-10-03 08:13:00Z peter $
+
+# $Id: Makefile.inc 2036 2008-02-09 04:06:47Z peter $
+
+# $Id: Makefile.inc 1168 2004-10-31 01:07:52Z peter $
+
+# $Id: Makefile.inc 2082 2008-05-09 06:46:02Z peter $
+
+# $Id: Makefile.inc 1617 2006-09-16 05:43:41Z peter $
+
+# $Id: Makefile.inc 1732 2007-01-13 19:34:04Z peter $
+
+# $Id: Makefile.inc 1777 2007-02-19 08:21:17Z peter $
+
+# $Id: Makefile.inc 1782 2007-02-21 06:45:39Z peter $
+
+# $Id: Makefile.inc 2108 2008-06-05 08:48:21Z peter $
+
+# $Id: Makefile.inc 1854 2007-05-31 06:16:49Z peter $
+
+# $Id: Makefile.inc 2108 2008-06-05 08:48:21Z peter $
+
+# $Id: Makefile.inc 1653 2006-10-17 06:58:41Z peter $
+
+# $Id: Makefile.inc 1653 2006-10-17 06:58:41Z peter $
+
+# $Id: Makefile.inc 1183 2004-12-01 07:49:18Z peter $
+
+# Assume objfmt_coff is included
+
+# $Id: Makefile.inc 2166 2009-01-02 08:33:21Z peter $
+
+# $Id: Makefile.inc 2166 2009-01-02 08:33:21Z peter $
+
+# $Id: Makefile.inc 1331 2006-01-15 22:48:55Z peter $
+
+# Assume objfmt_coff is included
+
+# $Id: Makefile.inc 2120 2008-09-04 04:45:30Z peter $
+
+# $Id: Makefile.inc 2082 2008-05-09 06:46:02Z peter $
+
+# $Id: Makefile.inc 1183 2004-12-01 07:49:18Z peter $
+
+# $Id: Makefile.inc 1851 2007-05-26 17:56:36Z peter $
+
+# $Id: Makefile.inc 2111 2008-07-06 22:26:49Z peter $
+
+# $Id: Makefile.inc 2123 2008-09-30 03:56:37Z peter $
+
+# $Id: Makefile.inc 2130 2008-10-07 05:38:11Z peter $
+
+# $Id: Makefile.inc 1463 2006-04-05 05:39:23Z peter $
+
+# $Id: Makefile.inc 1463 2006-04-05 05:39:23Z peter $
+
+
+
+
+pkgdatadir = $(datadir)/yasm
+pkglibdir = $(libdir)/yasm
+pkgincludedir = $(includedir)/yasm
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = x86_64-unknown-linux-gnu
+host_triplet = x86_64-unknown-linux-gnu
+bin_PROGRAMS = yasm$(EXEEXT) ytasm$(EXEEXT)
+TESTS = $(am__append_3) modules/arch/x86/tests/x86_test.sh \
+ modules/arch/x86/tests/gas32/x86_gas32_test.sh \
+ modules/arch/x86/tests/gas64/x86_gas64_test.sh \
+ modules/arch/lc3b/tests/lc3b_test.sh \
+ modules/parsers/gas/tests/gas_test.sh \
+ modules/parsers/gas/tests/bin/gas_bin_test.sh \
+ modules/parsers/nasm/tests/nasm_test.sh \
+ modules/parsers/nasm/tests/worphan/nasm_worphan_test.sh \
+ modules/parsers/tasm/tests/tasm_test.sh \
+ modules/parsers/tasm/tests/exe/tasm_exe_test.sh \
+ modules/preprocs/nasm/tests/nasmpp_test.sh \
+ modules/preprocs/raw/tests/rawpp_test.sh \
+ modules/dbgfmts/dwarf2/tests/pass32/dwarf2_pass32_test.sh \
+ modules/dbgfmts/dwarf2/tests/pass64/dwarf2_pass64_test.sh \
+ modules/dbgfmts/dwarf2/tests/passwin64/dwarf2_passwin64_test.sh \
+ modules/dbgfmts/stabs/tests/stabs_test.sh \
+ modules/objfmts/bin/tests/bin_test.sh \
+ modules/objfmts/bin/tests/multisect/bin_multi_test.sh \
+ modules/objfmts/elf/tests/elf_test.sh \
+ modules/objfmts/elf/tests/amd64/elf_amd64_test.sh \
+ modules/objfmts/elf/tests/gas32/elf_gas32_test.sh \
+ modules/objfmts/elf/tests/gas64/elf_gas64_test.sh \
+ modules/objfmts/coff/tests/coff_test.sh \
+ modules/objfmts/macho/tests/gas32/gas_macho32_test.sh \
+ modules/objfmts/macho/tests/gas64/gas_macho64_test.sh \
+ modules/objfmts/macho/tests/nasm32/macho32_test.sh \
+ modules/objfmts/macho/tests/nasm64/macho64_test.sh \
+ modules/objfmts/rdf/tests/rdf_test.sh \
+ modules/objfmts/win32/tests/win32_test.sh \
+ modules/objfmts/win32/tests/gas/win32_gas_test.sh \
+ modules/objfmts/win64/tests/win64_test.sh \
+ modules/objfmts/win64/tests/gas/win64_gas_test.sh \
+ modules/objfmts/xdf/tests/xdf_test.sh bitvect_test$(EXEEXT) \
+ floatnum_test$(EXEEXT) leb128_test$(EXEEXT) \
+ splitpath_test$(EXEEXT) combpath_test$(EXEEXT) \
+ uncstring_test$(EXEEXT) libyasm/tests/libyasm_test.sh
+noinst_PROGRAMS = genstring$(EXEEXT) re2c$(EXEEXT) genmacro$(EXEEXT) \
+ genperf$(EXEEXT) genversion$(EXEEXT) genmodule$(EXEEXT)
+check_PROGRAMS = test_hd$(EXEEXT) bitvect_test$(EXEEXT) \
+ floatnum_test$(EXEEXT) leb128_test$(EXEEXT) \
+ splitpath_test$(EXEEXT) combpath_test$(EXEEXT) \
+ uncstring_test$(EXEEXT)
+DIST_COMMON = README $(am__configure_deps) $(dist_man_MANS) \
+ $(include_HEADERS) $(modinclude_HEADERS) $(noinst_HEADERS) \
+ $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(srcdir)/config.h.in $(srcdir)/frontends/Makefile.inc \
+ $(srcdir)/frontends/tasm/Makefile.inc \
+ $(srcdir)/frontends/yasm/Makefile.inc \
+ $(srcdir)/libyasm/Makefile.inc \
+ $(srcdir)/libyasm/tests/Makefile.inc $(srcdir)/m4/Makefile.inc \
+ $(srcdir)/modules/Makefile.inc \
+ $(srcdir)/modules/arch/Makefile.inc \
+ $(srcdir)/modules/arch/lc3b/Makefile.inc \
+ $(srcdir)/modules/arch/lc3b/tests/Makefile.inc \
+ $(srcdir)/modules/arch/x86/Makefile.inc \
+ $(srcdir)/modules/arch/x86/tests/Makefile.inc \
+ $(srcdir)/modules/arch/x86/tests/gas32/Makefile.inc \
+ $(srcdir)/modules/arch/x86/tests/gas64/Makefile.inc \
+ $(srcdir)/modules/dbgfmts/Makefile.inc \
+ $(srcdir)/modules/dbgfmts/codeview/Makefile.inc \
+ $(srcdir)/modules/dbgfmts/dwarf2/Makefile.inc \
+ $(srcdir)/modules/dbgfmts/dwarf2/tests/Makefile.inc \
+ $(srcdir)/modules/dbgfmts/dwarf2/tests/pass32/Makefile.inc \
+ $(srcdir)/modules/dbgfmts/dwarf2/tests/pass64/Makefile.inc \
+ $(srcdir)/modules/dbgfmts/dwarf2/tests/passwin64/Makefile.inc \
+ $(srcdir)/modules/dbgfmts/null/Makefile.inc \
+ $(srcdir)/modules/dbgfmts/stabs/Makefile.inc \
+ $(srcdir)/modules/dbgfmts/stabs/tests/Makefile.inc \
+ $(srcdir)/modules/listfmts/Makefile.inc \
+ $(srcdir)/modules/listfmts/nasm/Makefile.inc \
+ $(srcdir)/modules/objfmts/Makefile.inc \
+ $(srcdir)/modules/objfmts/bin/Makefile.inc \
+ $(srcdir)/modules/objfmts/bin/tests/Makefile.inc \
+ $(srcdir)/modules/objfmts/bin/tests/multisect/Makefile.inc \
+ $(srcdir)/modules/objfmts/coff/Makefile.inc \
+ $(srcdir)/modules/objfmts/coff/tests/Makefile.inc \
+ $(srcdir)/modules/objfmts/dbg/Makefile.inc \
+ $(srcdir)/modules/objfmts/elf/Makefile.inc \
+ $(srcdir)/modules/objfmts/elf/tests/Makefile.inc \
+ $(srcdir)/modules/objfmts/elf/tests/amd64/Makefile.inc \
+ $(srcdir)/modules/objfmts/elf/tests/gas32/Makefile.inc \
+ $(srcdir)/modules/objfmts/elf/tests/gas64/Makefile.inc \
+ $(srcdir)/modules/objfmts/macho/Makefile.inc \
+ $(srcdir)/modules/objfmts/macho/tests/Makefile.inc \
+ $(srcdir)/modules/objfmts/macho/tests/gas32/Makefile.inc \
+ $(srcdir)/modules/objfmts/macho/tests/gas64/Makefile.inc \
+ $(srcdir)/modules/objfmts/macho/tests/nasm32/Makefile.inc \
+ $(srcdir)/modules/objfmts/macho/tests/nasm64/Makefile.inc \
+ $(srcdir)/modules/objfmts/rdf/Makefile.inc \
+ $(srcdir)/modules/objfmts/rdf/tests/Makefile.inc \
+ $(srcdir)/modules/objfmts/win32/Makefile.inc \
+ $(srcdir)/modules/objfmts/win32/tests/Makefile.inc \
+ $(srcdir)/modules/objfmts/win32/tests/gas/Makefile.inc \
+ $(srcdir)/modules/objfmts/win64/Makefile.inc \
+ $(srcdir)/modules/objfmts/win64/tests/Makefile.inc \
+ $(srcdir)/modules/objfmts/win64/tests/gas/Makefile.inc \
+ $(srcdir)/modules/objfmts/xdf/Makefile.inc \
+ $(srcdir)/modules/objfmts/xdf/tests/Makefile.inc \
+ $(srcdir)/modules/parsers/Makefile.inc \
+ $(srcdir)/modules/parsers/gas/Makefile.inc \
+ $(srcdir)/modules/parsers/gas/tests/Makefile.inc \
+ $(srcdir)/modules/parsers/gas/tests/bin/Makefile.inc \
+ $(srcdir)/modules/parsers/nasm/Makefile.inc \
+ $(srcdir)/modules/parsers/nasm/tests/Makefile.inc \
+ $(srcdir)/modules/parsers/nasm/tests/worphan/Makefile.inc \
+ $(srcdir)/modules/parsers/tasm/Makefile.inc \
+ $(srcdir)/modules/parsers/tasm/tests/Makefile.inc \
+ $(srcdir)/modules/parsers/tasm/tests/exe/Makefile.inc \
+ $(srcdir)/modules/preprocs/Makefile.inc \
+ $(srcdir)/modules/preprocs/cpp/Makefile.inc \
+ $(srcdir)/modules/preprocs/nasm/Makefile.inc \
+ $(srcdir)/modules/preprocs/nasm/tests/Makefile.inc \
+ $(srcdir)/modules/preprocs/raw/Makefile.inc \
+ $(srcdir)/modules/preprocs/raw/tests/Makefile.inc \
+ $(srcdir)/tools/Makefile.inc \
+ $(srcdir)/tools/genmacro/Makefile.inc \
+ $(srcdir)/tools/genperf/Makefile.inc \
+ $(srcdir)/tools/python-yasm/Makefile.inc \
+ $(srcdir)/tools/python-yasm/tests/Makefile.inc \
+ $(srcdir)/tools/re2c/Makefile.inc $(top_srcdir)/configure \
+ ABOUT-NLS AUTHORS COPYING ChangeLog INSTALL NEWS \
+ config/config.guess config/config.rpath config/config.sub \
+ config/depcomp config/install-sh config/ltmain.sh \
+ config/missing
+#am__append_1 = _yasm.pxi yasm.pyx \
+# yasm_python.c python-setup.txt \
+# .python-build
+#am__append_2 = PYTHON=${PYTHON}
+#am__append_3 = tools/python-yasm/tests/python_test.sh
+am__append_4 = $(dist_man_MANS)
+subdir = .
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/ax_create_stdint_h.m4 \
+ $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/iconv.m4 \
+ $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
+ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/nls.m4 \
+ $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \
+ $(top_srcdir)/m4/pyrex.m4 $(top_srcdir)/m4/pythonhead.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
+ configure.lineno config.status.lineno
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = config.h
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \
+ "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man7dir)" \
+ "$(DESTDIR)$(includedir)" "$(DESTDIR)$(modincludedir)" \
+ "$(DESTDIR)$(includedir)"
+libLIBRARIES_INSTALL = $(INSTALL_DATA)
+LIBRARIES = $(lib_LIBRARIES)
+AR = ar
+ARFLAGS = cru
+libyasm_a_AR = $(AR) $(ARFLAGS)
+libyasm_a_LIBADD =
+am_libyasm_a_OBJECTS = x86arch.$(OBJEXT) x86bc.$(OBJEXT) \
+ x86expr.$(OBJEXT) x86id.$(OBJEXT) lc3barch.$(OBJEXT) \
+ lc3bbc.$(OBJEXT) nasm-listfmt.$(OBJEXT) gas-parser.$(OBJEXT) \
+ gas-parse.$(OBJEXT) nasm-parser.$(OBJEXT) nasm-parse.$(OBJEXT) \
+ nasm-preproc.$(OBJEXT) nasm-pp.$(OBJEXT) nasmlib.$(OBJEXT) \
+ nasm-eval.$(OBJEXT) raw-preproc.$(OBJEXT) \
+ cpp-preproc.$(OBJEXT) cv-dbgfmt.$(OBJEXT) cv-symline.$(OBJEXT) \
+ cv-type.$(OBJEXT) dwarf2-dbgfmt.$(OBJEXT) \
+ dwarf2-line.$(OBJEXT) dwarf2-aranges.$(OBJEXT) \
+ dwarf2-info.$(OBJEXT) null-dbgfmt.$(OBJEXT) \
+ stabs-dbgfmt.$(OBJEXT) dbg-objfmt.$(OBJEXT) \
+ bin-objfmt.$(OBJEXT) elf.$(OBJEXT) elf-objfmt.$(OBJEXT) \
+ elf-x86-x86.$(OBJEXT) elf-x86-amd64.$(OBJEXT) \
+ coff-objfmt.$(OBJEXT) win64-except.$(OBJEXT) \
+ macho-objfmt.$(OBJEXT) rdf-objfmt.$(OBJEXT) \
+ xdf-objfmt.$(OBJEXT) assocdat.$(OBJEXT) bitvect.$(OBJEXT) \
+ bc-align.$(OBJEXT) bc-data.$(OBJEXT) bc-incbin.$(OBJEXT) \
+ bc-org.$(OBJEXT) bc-reserve.$(OBJEXT) bytecode.$(OBJEXT) \
+ errwarn.$(OBJEXT) expr.$(OBJEXT) file.$(OBJEXT) \
+ floatnum.$(OBJEXT) hamt.$(OBJEXT) insn.$(OBJEXT) \
+ intnum.$(OBJEXT) inttree.$(OBJEXT) linemap.$(OBJEXT) \
+ md5.$(OBJEXT) mergesort.$(OBJEXT) phash.$(OBJEXT) \
+ section.$(OBJEXT) strcasecmp.$(OBJEXT) strsep.$(OBJEXT) \
+ symrec.$(OBJEXT) valparam.$(OBJEXT) value.$(OBJEXT) \
+ xmalloc.$(OBJEXT) xstrdup.$(OBJEXT)
+nodist_libyasm_a_OBJECTS = x86cpu.$(OBJEXT) x86regtmod.$(OBJEXT) \
+ lc3bid.$(OBJEXT) gas-token.$(OBJEXT) nasm-token.$(OBJEXT) \
+ module.$(OBJEXT)
+libyasm_a_OBJECTS = $(am_libyasm_a_OBJECTS) \
+ $(nodist_libyasm_a_OBJECTS)
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS)
+am_bitvect_test_OBJECTS = bitvect_test.$(OBJEXT)
+bitvect_test_OBJECTS = $(am_bitvect_test_OBJECTS)
+am__DEPENDENCIES_1 =
+bitvect_test_DEPENDENCIES = libyasm.a $(am__DEPENDENCIES_1)
+am_combpath_test_OBJECTS = combpath_test.$(OBJEXT)
+combpath_test_OBJECTS = $(am_combpath_test_OBJECTS)
+combpath_test_DEPENDENCIES = libyasm.a $(am__DEPENDENCIES_1)
+am_floatnum_test_OBJECTS = floatnum_test.$(OBJEXT)
+floatnum_test_OBJECTS = $(am_floatnum_test_OBJECTS)
+floatnum_test_DEPENDENCIES = libyasm.a $(am__DEPENDENCIES_1)
+am_genmacro_OBJECTS =
+genmacro_OBJECTS = $(am_genmacro_OBJECTS)
+genmacro_DEPENDENCIES = genmacro.$(OBJEXT)
+am_genmodule_OBJECTS =
+genmodule_OBJECTS = $(am_genmodule_OBJECTS)
+genmodule_DEPENDENCIES = genmodule.$(OBJEXT)
+am_genperf_OBJECTS =
+genperf_OBJECTS = $(am_genperf_OBJECTS)
+genperf_DEPENDENCIES = genperf.$(OBJEXT) gp-perfect.$(OBJEXT) \
+ gp-phash.$(OBJEXT) gp-xmalloc.$(OBJEXT) gp-xstrdup.$(OBJEXT)
+am_genstring_OBJECTS =
+genstring_OBJECTS = $(am_genstring_OBJECTS)
+genstring_DEPENDENCIES = genstring.$(OBJEXT)
+am_genversion_OBJECTS =
+genversion_OBJECTS = $(am_genversion_OBJECTS)
+genversion_DEPENDENCIES = genversion.$(OBJEXT)
+am_leb128_test_OBJECTS = leb128_test.$(OBJEXT)
+leb128_test_OBJECTS = $(am_leb128_test_OBJECTS)
+leb128_test_DEPENDENCIES = libyasm.a $(am__DEPENDENCIES_1)
+am_re2c_OBJECTS =
+re2c_OBJECTS = $(am_re2c_OBJECTS)
+re2c_DEPENDENCIES = re2c-main.$(OBJEXT) re2c-code.$(OBJEXT) \
+ re2c-dfa.$(OBJEXT) re2c-parser.$(OBJEXT) \
+ re2c-actions.$(OBJEXT) re2c-scanner.$(OBJEXT) \
+ re2c-mbo_getopt.$(OBJEXT) re2c-substr.$(OBJEXT) \
+ re2c-translate.$(OBJEXT)
+am_splitpath_test_OBJECTS = splitpath_test.$(OBJEXT)
+splitpath_test_OBJECTS = $(am_splitpath_test_OBJECTS)
+splitpath_test_DEPENDENCIES = libyasm.a $(am__DEPENDENCIES_1)
+am_test_hd_OBJECTS = test_hd.$(OBJEXT)
+test_hd_OBJECTS = $(am_test_hd_OBJECTS)
+test_hd_LDADD = $(LDADD)
+am_uncstring_test_OBJECTS = uncstring_test.$(OBJEXT)
+uncstring_test_OBJECTS = $(am_uncstring_test_OBJECTS)
+uncstring_test_DEPENDENCIES = libyasm.a $(am__DEPENDENCIES_1)
+am_yasm_OBJECTS = yasm.$(OBJEXT) yasm-options.$(OBJEXT)
+yasm_OBJECTS = $(am_yasm_OBJECTS)
+yasm_DEPENDENCIES = libyasm.a $(am__DEPENDENCIES_1)
+am_ytasm_OBJECTS = tasm.$(OBJEXT) tasm-options.$(OBJEXT)
+ytasm_OBJECTS = $(am_ytasm_OBJECTS)
+ytasm_DEPENDENCIES = libyasm.a $(am__DEPENDENCIES_1)
+DEFAULT_INCLUDES = -I.
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libyasm_a_SOURCES) $(nodist_libyasm_a_SOURCES) \
+ $(bitvect_test_SOURCES) $(combpath_test_SOURCES) \
+ $(floatnum_test_SOURCES) $(genmacro_SOURCES) \
+ $(genmodule_SOURCES) $(genperf_SOURCES) $(genstring_SOURCES) \
+ $(genversion_SOURCES) $(leb128_test_SOURCES) $(re2c_SOURCES) \
+ $(splitpath_test_SOURCES) $(test_hd_SOURCES) \
+ $(uncstring_test_SOURCES) $(yasm_SOURCES) $(ytasm_SOURCES)
+DIST_SOURCES = $(libyasm_a_SOURCES) $(bitvect_test_SOURCES) \
+ $(combpath_test_SOURCES) $(floatnum_test_SOURCES) \
+ $(genmacro_SOURCES) $(genmodule_SOURCES) $(genperf_SOURCES) \
+ $(genstring_SOURCES) $(genversion_SOURCES) \
+ $(leb128_test_SOURCES) $(re2c_SOURCES) \
+ $(splitpath_test_SOURCES) $(test_hd_SOURCES) \
+ $(uncstring_test_SOURCES) $(yasm_SOURCES) $(ytasm_SOURCES)
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-dvi-recursive install-exec-recursive \
+ install-html-recursive install-info-recursive \
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
+man1dir = $(mandir)/man1
+man7dir = $(mandir)/man7
+NROFF = nroff
+MANS = $(dist_man_MANS)
+includeHEADERS_INSTALL = $(INSTALL_HEADER)
+modincludeHEADERS_INSTALL = $(INSTALL_HEADER)
+nodist_includeHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(include_HEADERS) $(modinclude_HEADERS) \
+ $(nodist_include_HEADERS) $(noinst_HEADERS)
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+distdir = $(PACKAGE)-$(VERSION)
+top_distdir = $(distdir)
+am__remove_distdir = \
+ { test ! -d $(distdir) \
+ || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
+ && rm -fr $(distdir); }; }
+DIST_ARCHIVES = $(distdir).tar.gz
+GZIP_ENV = --best
+distuninstallcheck_listfiles = find . -type f -print
+distcleancheck_listfiles = find . -type f -print
+ACLOCAL = ${SHELL} /tmp/yasm/config/missing --run aclocal-1.10
+AMTAR = ${SHELL} /tmp/yasm/config/missing --run tar
+ARCH = x86
+AUTOCONF = ${SHELL} /tmp/yasm/config/missing --run autoconf
+AUTOHEADER = ${SHELL} /tmp/yasm/config/missing --run autoheader
+AUTOMAKE = ${SHELL} /tmp/yasm/config/missing --run automake-1.10
+AWK = gawk
+CC = gcc -std=gnu99
+CCDEPMODE = depmode=gcc3
+CCLD_FOR_BUILD = gcc -std=gnu99
+CC_FOR_BUILD = gcc -std=gnu99
+CFLAGS = -g -O2
+CPP = gcc -E
+CPPFLAGS =
+CYGPATH_W = echo
+DEFS = -DHAVE_CONFIG_H
+DEPDIR = .deps
+ECHO_C =
+ECHO_N = -n
+ECHO_T =
+EGREP = /bin/grep -E
+EXEEXT =
+GCC = yes
+GMSGFMT = /usr/bin/msgfmt
+GMSGFMT_015 = /usr/bin/msgfmt
+GREP = /bin/grep
+HOST_CC = gcc -std=gnu99
+INSTALL = /usr/bin/install -c
+INSTALL_DATA = ${INSTALL} -m 644
+INSTALL_PROGRAM = ${INSTALL}
+INSTALL_SCRIPT = ${INSTALL}
+INSTALL_STRIP_PROGRAM = $(install_sh) -c -s
+INTLLIBS =
+INTL_MACOSX_LIBS =
+LDFLAGS =
+LIBICONV = -liconv
+LIBINTL =
+LIBOBJS =
+LIBS =
+LN_S = ln -s
+LTLIBICONV = -liconv
+LTLIBINTL =
+LTLIBOBJS =
+MAINT =
+MAKEINFO = ${SHELL} /tmp/yasm/config/missing --run makeinfo
+MKDIR_P = /bin/mkdir -p
+MORE_CFLAGS = -ansi -pedantic -Wall -W -Waggregate-return -Wbad-function-cast -Wcast-align -Wcast-qual -Wchar-subscripts -Winline -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wreturn-type -Wshadow -Wsign-compare -Wstrict-prototypes -Wswitch -Wwrite-strings -Wno-undef -Wno-unused-parameter
+MSGFMT = /usr/bin/msgfmt
+MSGFMT_015 = /usr/bin/msgfmt
+MSGMERGE = /usr/bin/msgmerge
+OBJEXT = o
+PACKAGE = yasm
+PACKAGE_BUGREPORT = bug-yasm@tortall.net
+PACKAGE_NAME = yasm
+PACKAGE_STRING = yasm HEAD
+PACKAGE_TARNAME = yasm
+PACKAGE_VERSION = HEAD
+PATH_SEPARATOR = :
+POSUB = po
+PYTHON = /usr/bin/python
+PYTHON_EXEC_PREFIX = ${exec_prefix}
+PYTHON_INCLUDES =
+PYTHON_PLATFORM = linux2
+PYTHON_PREFIX = ${prefix}
+PYTHON_VERSION = 2.5
+RANLIB = ranlib
+SET_MAKE =
+SHELL = /bin/sh
+STRIP =
+USE_NLS = yes
+VERSION = HEAD
+XGETTEXT = /usr/bin/xgettext
+XGETTEXT_015 = /usr/bin/xgettext
+XMLTO = xmlto
+abs_builddir = /tmp/yasm
+abs_srcdir = /tmp/yasm
+abs_top_builddir = /tmp/yasm
+abs_top_srcdir = /tmp/yasm
+ac_ct_CC = gcc
+am__include = include
+am__leading_dot = .
+am__quote =
+am__tar = ${AMTAR} chof - "$$tardir"
+am__untar = ${AMTAR} xf -
+bindir = ${exec_prefix}/bin
+build = x86_64-unknown-linux-gnu
+build_alias =
+build_cpu = x86_64
+build_os = linux-gnu
+build_vendor = unknown
+builddir = .
+datadir = ${datarootdir}
+datarootdir = ${prefix}/share
+docdir = ${datarootdir}/doc/${PACKAGE_TARNAME}
+dvidir = ${docdir}
+exec_prefix = ${prefix}
+host = x86_64-unknown-linux-gnu
+host_alias =
+host_cpu = x86_64
+host_os = linux-gnu
+host_vendor = unknown
+htmldir = ${docdir}
+includedir = ${prefix}/include
+infodir = ${datarootdir}/info
+install_sh = $(SHELL) /tmp/yasm/config/install-sh
+libdir = ${exec_prefix}/lib
+libexecdir = ${exec_prefix}/libexec
+localedir = ${datarootdir}/locale
+localstatedir = ${prefix}/var
+mandir = ${datarootdir}/man
+mkdir_p = /bin/mkdir -p
+oldincludedir = /usr/include
+pdfdir = ${docdir}
+pkgpyexecdir = ${pyexecdir}/yasm
+pkgpythondir = ${pythondir}/yasm
+prefix = /usr/local
+program_transform_name = s,x,x,
+psdir = ${docdir}
+pyexecdir = ${exec_prefix}/lib/python2.5/site-packages
+pythondir = ${prefix}/lib/python2.5/site-packages
+sbindir = ${exec_prefix}/sbin
+sharedstatedir = ${prefix}/com
+srcdir = .
+sysconfdir = ${prefix}/etc
+target_alias =
+top_builddir = .
+top_srcdir = .
+SUBDIRS = po .
+AM_YFLAGS = -d
+AM_CFLAGS = -ansi -pedantic -Wall -W -Waggregate-return -Wbad-function-cast -Wcast-align -Wcast-qual -Wchar-subscripts -Winline -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wreturn-type -Wshadow -Wsign-compare -Wstrict-prototypes -Wswitch -Wwrite-strings -Wno-undef -Wno-unused-parameter
+
+#!include modules/objfmts/omf/Makefile.inc
+dist_man_MANS = yasm_arch.7 yasm_parsers.7 yasm_dbgfmts.7 \
+ yasm_objfmts.7 yasm.1
+TESTS_ENVIRONMENT = $(am__append_2)
+test_hd_SOURCES = test_hd.c
+include_HEADERS = libyasm.h
+nodist_include_HEADERS = libyasm-stdint.h
+noinst_HEADERS = util.h
+BUILT_SOURCES = x86insns.c x86insn_nasm.gperf x86insn_gas.gperf \
+ x86insn_nasm.c x86insn_gas.c gas-token.c nasm-token.c \
+ nasm-macros.c nasm-version.c version.mac win64-nasm.c \
+ win64-gas.c license.c
+MAINTAINERCLEANFILES = x86insns.c x86insn_nasm.gperf x86insn_gas.gperf \
+ $(am__append_4)
+
+# Until this gets fixed in automake
+DISTCLEANFILES = libyasm/stamp-h libyasm/stamp-h[0-9]*
+
+# Suffix rule for genperf
+SUFFIXES = .gperf
+
+# configure.lineno doesn't clean up after itself?
+CLEANFILES = configure.lineno $(am__append_1) x86insn_nasm.c \
+ x86insn_gas.c x86cpu.c x86regtmod.c lc3bid.c gas-token.c \
+ nasm-token.c nasm-macros.c nasm-version.c version.mac \
+ win64-nasm.c win64-gas.c module.c license.c
+
+# automake doesn't distribute mkinstalldirs?
+#!EXTRA_DIST += modules/objfmts/omf/Makefile.inc
+EXTRA_DIST = config/config.rpath config/mkinstalldirs \
+ tools/Makefile.inc libyasm/Makefile.inc modules/Makefile.inc \
+ frontends/Makefile.inc tools/re2c/Makefile.inc \
+ tools/genmacro/Makefile.inc tools/genperf/Makefile.inc \
+ tools/python-yasm/Makefile.inc tools/re2c/main.c \
+ tools/re2c/basics.h tools/re2c/globals.h tools/re2c/ins.h \
+ tools/re2c/re.h tools/re2c/token.h tools/re2c/code.c \
+ tools/re2c/dfa.h tools/re2c/dfa.c tools/re2c/parse.h \
+ tools/re2c/parser.h tools/re2c/parser.c tools/re2c/actions.c \
+ tools/re2c/scanner.h tools/re2c/scanner.c \
+ tools/re2c/mbo_getopt.h tools/re2c/mbo_getopt.c \
+ tools/re2c/substr.h tools/re2c/substr.c tools/re2c/translate.c \
+ tools/re2c/CHANGELOG tools/re2c/NO_WARRANTY tools/re2c/README \
+ tools/re2c/scanner.re tools/re2c/re2c.1 \
+ tools/re2c/bootstrap/scanner.c tools/re2c/doc/loplas.ps.gz \
+ tools/re2c/doc/sample.bib tools/re2c/examples/basemmap.c \
+ tools/re2c/examples/c.re tools/re2c/examples/cmmap.re \
+ tools/re2c/examples/cnokw.re tools/re2c/examples/cunroll.re \
+ tools/re2c/examples/modula.re tools/re2c/examples/repeater.re \
+ tools/re2c/examples/sample.re tools/re2c/examples/simple.re \
+ tools/re2c/examples/rexx/README \
+ tools/re2c/examples/rexx/rexx.l \
+ tools/re2c/examples/rexx/scanio.c tools/genmacro/genmacro.c \
+ tools/genperf/genperf.c tools/genperf/perfect.c \
+ tools/genperf/perfect.h tools/genperf/standard.h \
+ tools/python-yasm/pyxelator/cparse.py \
+ tools/python-yasm/pyxelator/genpyx.py \
+ tools/python-yasm/pyxelator/ir.py \
+ tools/python-yasm/pyxelator/lexer.py \
+ tools/python-yasm/pyxelator/node.py \
+ tools/python-yasm/pyxelator/parse_core.py \
+ tools/python-yasm/pyxelator/work_unit.py \
+ tools/python-yasm/pyxelator/wrap_yasm.py \
+ tools/python-yasm/setup.py tools/python-yasm/yasm.pyx \
+ $(PYBINDING_DEPS) tools/python-yasm/tests/Makefile.inc \
+ tools/python-yasm/tests/python_test.sh \
+ tools/python-yasm/tests/__init__.py \
+ tools/python-yasm/tests/test_bytecode.py \
+ tools/python-yasm/tests/test_expr.py \
+ tools/python-yasm/tests/test_intnum.py \
+ tools/python-yasm/tests/test_symrec.py \
+ modules/arch/Makefile.inc modules/listfmts/Makefile.inc \
+ modules/parsers/Makefile.inc modules/preprocs/Makefile.inc \
+ modules/objfmts/Makefile.inc modules/arch/x86/Makefile.inc \
+ modules/arch/lc3b/Makefile.inc \
+ modules/arch/x86/gen_x86_insn.py x86insns.c x86insn_nasm.gperf \
+ x86insn_gas.gperf modules/arch/x86/x86cpu.gperf \
+ modules/arch/x86/x86regtmod.gperf \
+ modules/arch/x86/tests/Makefile.inc \
+ modules/arch/x86/tests/x86_test.sh \
+ modules/arch/x86/tests/gen-fma-test.py \
+ modules/arch/x86/tests/addbyte.asm \
+ modules/arch/x86/tests/addbyte.errwarn \
+ modules/arch/x86/tests/addbyte.hex \
+ modules/arch/x86/tests/addrop.asm \
+ modules/arch/x86/tests/addrop.errwarn \
+ modules/arch/x86/tests/addrop.hex \
+ modules/arch/x86/tests/addrop-err.asm \
+ modules/arch/x86/tests/addrop-err.errwarn \
+ modules/arch/x86/tests/aes.asm modules/arch/x86/tests/aes.hex \
+ modules/arch/x86/tests/amd200707.asm \
+ modules/arch/x86/tests/amd200707.hex \
+ modules/arch/x86/tests/arithsmall.asm \
+ modules/arch/x86/tests/arithsmall.errwarn \
+ modules/arch/x86/tests/arithsmall.hex \
+ modules/arch/x86/tests/avx.asm modules/arch/x86/tests/avx.hex \
+ modules/arch/x86/tests/avxcc.asm \
+ modules/arch/x86/tests/avxcc.hex \
+ modules/arch/x86/tests/bittest.asm \
+ modules/arch/x86/tests/bittest.hex \
+ modules/arch/x86/tests/bswap64.asm \
+ modules/arch/x86/tests/bswap64.hex \
+ modules/arch/x86/tests/clmul.asm \
+ modules/arch/x86/tests/clmul.hex \
+ modules/arch/x86/tests/cmpxchg.asm \
+ modules/arch/x86/tests/cmpxchg.hex \
+ modules/arch/x86/tests/cpubasic-err.asm \
+ modules/arch/x86/tests/cpubasic-err.errwarn \
+ modules/arch/x86/tests/cyrix.asm \
+ modules/arch/x86/tests/cyrix.hex \
+ modules/arch/x86/tests/div-err.asm \
+ modules/arch/x86/tests/div-err.errwarn \
+ modules/arch/x86/tests/ea-nonzero.asm \
+ modules/arch/x86/tests/ea-nonzero.hex \
+ modules/arch/x86/tests/ea-over.asm \
+ modules/arch/x86/tests/ea-over.errwarn \
+ modules/arch/x86/tests/ea-over.hex \
+ modules/arch/x86/tests/ea-warn.asm \
+ modules/arch/x86/tests/ea-warn.errwarn \
+ modules/arch/x86/tests/ea-warn.hex \
+ modules/arch/x86/tests/ebpindex.asm \
+ modules/arch/x86/tests/ebpindex.hex \
+ modules/arch/x86/tests/effaddr.asm \
+ modules/arch/x86/tests/effaddr.hex \
+ modules/arch/x86/tests/enter.asm \
+ modules/arch/x86/tests/enter.errwarn \
+ modules/arch/x86/tests/enter.hex \
+ modules/arch/x86/tests/far64.asm \
+ modules/arch/x86/tests/far64.hex \
+ modules/arch/x86/tests/farbasic.asm \
+ modules/arch/x86/tests/farbasic.hex \
+ modules/arch/x86/tests/farithr.asm \
+ modules/arch/x86/tests/farithr.hex \
+ modules/arch/x86/tests/fcmov.asm \
+ modules/arch/x86/tests/fcmov.hex \
+ modules/arch/x86/tests/fma.asm modules/arch/x86/tests/fma.hex \
+ modules/arch/x86/tests/fwdequ64.asm \
+ modules/arch/x86/tests/fwdequ64.hex \
+ modules/arch/x86/tests/genopcode.asm \
+ modules/arch/x86/tests/genopcode.hex \
+ modules/arch/x86/tests/imm64.asm \
+ modules/arch/x86/tests/imm64.errwarn \
+ modules/arch/x86/tests/imm64.hex \
+ modules/arch/x86/tests/iret.asm \
+ modules/arch/x86/tests/iret.hex \
+ modules/arch/x86/tests/jmp64-1.asm \
+ modules/arch/x86/tests/jmp64-1.hex \
+ modules/arch/x86/tests/jmp64-2.asm \
+ modules/arch/x86/tests/jmp64-2.hex \
+ modules/arch/x86/tests/jmp64-3.asm \
+ modules/arch/x86/tests/jmp64-3.hex \
+ modules/arch/x86/tests/jmp64-4.asm \
+ modules/arch/x86/tests/jmp64-4.hex \
+ modules/arch/x86/tests/jmp64-5.asm \
+ modules/arch/x86/tests/jmp64-5.hex \
+ modules/arch/x86/tests/jmp64-6.asm \
+ modules/arch/x86/tests/jmp64-6.hex \
+ modules/arch/x86/tests/jmpfar.asm \
+ modules/arch/x86/tests/jmpfar.hex \
+ modules/arch/x86/tests/lds.asm modules/arch/x86/tests/lds.hex \
+ modules/arch/x86/tests/loopadsz.asm \
+ modules/arch/x86/tests/loopadsz.hex \
+ modules/arch/x86/tests/lsahf.asm \
+ modules/arch/x86/tests/lsahf.hex \
+ modules/arch/x86/tests/mem64-err.asm \
+ modules/arch/x86/tests/mem64-err.errwarn \
+ modules/arch/x86/tests/mem64.asm \
+ modules/arch/x86/tests/mem64.errwarn \
+ modules/arch/x86/tests/mem64.hex \
+ modules/arch/x86/tests/mem64hi32.asm \
+ modules/arch/x86/tests/mem64hi32.hex \
+ modules/arch/x86/tests/mem64rip.asm \
+ modules/arch/x86/tests/mem64rip.hex \
+ modules/arch/x86/tests/mixcase.asm \
+ modules/arch/x86/tests/mixcase.hex \
+ modules/arch/x86/tests/movbe.asm \
+ modules/arch/x86/tests/movbe.hex \
+ modules/arch/x86/tests/movdq32.asm \
+ modules/arch/x86/tests/movdq32.hex \
+ modules/arch/x86/tests/movdq64.asm \
+ modules/arch/x86/tests/movdq64.hex \
+ modules/arch/x86/tests/negequ.asm \
+ modules/arch/x86/tests/negequ.hex \
+ modules/arch/x86/tests/nomem64-err.asm \
+ modules/arch/x86/tests/nomem64-err.errwarn \
+ modules/arch/x86/tests/nomem64-err2.asm \
+ modules/arch/x86/tests/nomem64-err2.errwarn \
+ modules/arch/x86/tests/nomem64.asm \
+ modules/arch/x86/tests/nomem64.errwarn \
+ modules/arch/x86/tests/nomem64.hex \
+ modules/arch/x86/tests/o64.asm modules/arch/x86/tests/o64.hex \
+ modules/arch/x86/tests/o64loop.asm \
+ modules/arch/x86/tests/o64loop.errwarn \
+ modules/arch/x86/tests/o64loop.hex \
+ modules/arch/x86/tests/opersize.asm \
+ modules/arch/x86/tests/opersize.hex \
+ modules/arch/x86/tests/opsize-err.asm \
+ modules/arch/x86/tests/opsize-err.errwarn \
+ modules/arch/x86/tests/overflow.asm \
+ modules/arch/x86/tests/overflow.errwarn \
+ modules/arch/x86/tests/overflow.hex \
+ modules/arch/x86/tests/padlock.asm \
+ modules/arch/x86/tests/padlock.hex \
+ modules/arch/x86/tests/pshift.asm \
+ modules/arch/x86/tests/pshift.hex \
+ modules/arch/x86/tests/push64.asm \
+ modules/arch/x86/tests/push64.errwarn \
+ modules/arch/x86/tests/push64.hex \
+ modules/arch/x86/tests/pushf.asm \
+ modules/arch/x86/tests/pushf.hex \
+ modules/arch/x86/tests/pushf-err.asm \
+ modules/arch/x86/tests/pushf-err.errwarn \
+ modules/arch/x86/tests/pushnosize.asm \
+ modules/arch/x86/tests/pushnosize.errwarn \
+ modules/arch/x86/tests/pushnosize.hex \
+ modules/arch/x86/tests/rep.asm modules/arch/x86/tests/rep.hex \
+ modules/arch/x86/tests/ret.asm modules/arch/x86/tests/ret.hex \
+ modules/arch/x86/tests/riprel1.asm \
+ modules/arch/x86/tests/riprel1.hex \
+ modules/arch/x86/tests/riprel2.asm \
+ modules/arch/x86/tests/riprel2.errwarn \
+ modules/arch/x86/tests/riprel2.hex \
+ modules/arch/x86/tests/ripseg.asm \
+ modules/arch/x86/tests/ripseg.errwarn \
+ modules/arch/x86/tests/ripseg.hex \
+ modules/arch/x86/tests/segmov.asm \
+ modules/arch/x86/tests/segmov.hex \
+ modules/arch/x86/tests/segoff.asm \
+ modules/arch/x86/tests/segoff.hex \
+ modules/arch/x86/tests/segoff-err.asm \
+ modules/arch/x86/tests/segoff-err.errwarn \
+ modules/arch/x86/tests/shift.asm \
+ modules/arch/x86/tests/shift.hex \
+ modules/arch/x86/tests/simd-1.asm \
+ modules/arch/x86/tests/simd-1.hex \
+ modules/arch/x86/tests/simd-2.asm \
+ modules/arch/x86/tests/simd-2.hex \
+ modules/arch/x86/tests/simd64-1.asm \
+ modules/arch/x86/tests/simd64-1.hex \
+ modules/arch/x86/tests/simd64-2.asm \
+ modules/arch/x86/tests/simd64-2.hex \
+ modules/arch/x86/tests/sse-prefix.asm \
+ modules/arch/x86/tests/sse-prefix.hex \
+ modules/arch/x86/tests/sse3.asm \
+ modules/arch/x86/tests/sse3.hex \
+ modules/arch/x86/tests/sse4.asm \
+ modules/arch/x86/tests/sse4.hex \
+ modules/arch/x86/tests/sse4-err.asm \
+ modules/arch/x86/tests/sse4-err.errwarn \
+ modules/arch/x86/tests/sse5-all.asm \
+ modules/arch/x86/tests/sse5-all.hex \
+ modules/arch/x86/tests/sse5-basic.asm \
+ modules/arch/x86/tests/sse5-basic.hex \
+ modules/arch/x86/tests/sse5-cc.asm \
+ modules/arch/x86/tests/sse5-cc.hex \
+ modules/arch/x86/tests/sse5-err.asm \
+ modules/arch/x86/tests/sse5-err.errwarn \
+ modules/arch/x86/tests/ssewidth.asm \
+ modules/arch/x86/tests/ssewidth.hex \
+ modules/arch/x86/tests/ssse3.asm \
+ modules/arch/x86/tests/ssse3.c \
+ modules/arch/x86/tests/ssse3.hex \
+ modules/arch/x86/tests/stos.asm \
+ modules/arch/x86/tests/stos.hex modules/arch/x86/tests/str.asm \
+ modules/arch/x86/tests/str.hex \
+ modules/arch/x86/tests/strict.asm \
+ modules/arch/x86/tests/strict.errwarn \
+ modules/arch/x86/tests/strict.hex \
+ modules/arch/x86/tests/strict-err.asm \
+ modules/arch/x86/tests/strict-err.errwarn \
+ modules/arch/x86/tests/stringseg.asm \
+ modules/arch/x86/tests/stringseg.errwarn \
+ modules/arch/x86/tests/stringseg.hex \
+ modules/arch/x86/tests/svm.asm modules/arch/x86/tests/svm.hex \
+ modules/arch/x86/tests/twobytemem.asm \
+ modules/arch/x86/tests/twobytemem.errwarn \
+ modules/arch/x86/tests/twobytemem.hex \
+ modules/arch/x86/tests/vmx.asm modules/arch/x86/tests/vmx.hex \
+ modules/arch/x86/tests/vmx-err.asm \
+ modules/arch/x86/tests/vmx-err.errwarn \
+ modules/arch/x86/tests/x86label.asm \
+ modules/arch/x86/tests/x86label.hex \
+ modules/arch/x86/tests/xchg64.asm \
+ modules/arch/x86/tests/xchg64.hex \
+ modules/arch/x86/tests/xmm64.asm \
+ modules/arch/x86/tests/xmm64.hex \
+ modules/arch/x86/tests/xsave.asm \
+ modules/arch/x86/tests/xsave.hex \
+ modules/arch/x86/tests/gas32/Makefile.inc \
+ modules/arch/x86/tests/gas64/Makefile.inc \
+ modules/arch/x86/tests/gas32/x86_gas32_test.sh \
+ modules/arch/x86/tests/gas32/align32.asm \
+ modules/arch/x86/tests/gas32/align32.hex \
+ modules/arch/x86/tests/gas32/gas-farithr.asm \
+ modules/arch/x86/tests/gas32/gas-farithr.hex \
+ modules/arch/x86/tests/gas32/gas-fpmem.asm \
+ modules/arch/x86/tests/gas32/gas-fpmem.hex \
+ modules/arch/x86/tests/gas32/gas-movdq32.asm \
+ modules/arch/x86/tests/gas32/gas-movdq32.hex \
+ modules/arch/x86/tests/gas32/gas-movsd.asm \
+ modules/arch/x86/tests/gas32/gas-movsd.hex \
+ modules/arch/x86/tests/gas32/gas32-jmpcall.asm \
+ modules/arch/x86/tests/gas32/gas32-jmpcall.hex \
+ modules/arch/x86/tests/gas64/x86_gas64_test.sh \
+ modules/arch/x86/tests/gas64/align64.asm \
+ modules/arch/x86/tests/gas64/align64.hex \
+ modules/arch/x86/tests/gas64/gas-cbw.asm \
+ modules/arch/x86/tests/gas64/gas-cbw.hex \
+ modules/arch/x86/tests/gas64/gas-fp.asm \
+ modules/arch/x86/tests/gas64/gas-fp.hex \
+ modules/arch/x86/tests/gas64/gas-inout.asm \
+ modules/arch/x86/tests/gas64/gas-inout.hex \
+ modules/arch/x86/tests/gas64/gas-moreinsn.asm \
+ modules/arch/x86/tests/gas64/gas-moreinsn.hex \
+ modules/arch/x86/tests/gas64/gas-movabs.asm \
+ modules/arch/x86/tests/gas64/gas-movabs.hex \
+ modules/arch/x86/tests/gas64/gas-movdq64.asm \
+ modules/arch/x86/tests/gas64/gas-movdq64.hex \
+ modules/arch/x86/tests/gas64/gas-movsxs.asm \
+ modules/arch/x86/tests/gas64/gas-movsxs.hex \
+ modules/arch/x86/tests/gas64/gas-muldiv.asm \
+ modules/arch/x86/tests/gas64/gas-muldiv.hex \
+ modules/arch/x86/tests/gas64/gas-prefix.asm \
+ modules/arch/x86/tests/gas64/gas-prefix.errwarn \
+ modules/arch/x86/tests/gas64/gas-prefix.hex \
+ modules/arch/x86/tests/gas64/gas-retenter.asm \
+ modules/arch/x86/tests/gas64/gas-retenter.hex \
+ modules/arch/x86/tests/gas64/gas-shift.asm \
+ modules/arch/x86/tests/gas64/gas-shift.hex \
+ modules/arch/x86/tests/gas64/gas64-jmpcall.asm \
+ modules/arch/x86/tests/gas64/gas64-jmpcall.hex \
+ modules/arch/x86/tests/gas64/riprel.asm \
+ modules/arch/x86/tests/gas64/riprel.hex \
+ modules/arch/lc3b/tests/Makefile.inc \
+ modules/arch/lc3b/lc3bid.re \
+ modules/arch/lc3b/tests/lc3b_test.sh \
+ modules/arch/lc3b/tests/lc3b-basic.asm \
+ modules/arch/lc3b/tests/lc3b-basic.errwarn \
+ modules/arch/lc3b/tests/lc3b-basic.hex \
+ modules/arch/lc3b/tests/lc3b-br.asm \
+ modules/arch/lc3b/tests/lc3b-br.hex \
+ modules/arch/lc3b/tests/lc3b-ea-err.asm \
+ modules/arch/lc3b/tests/lc3b-ea-err.errwarn \
+ modules/arch/lc3b/tests/lc3b-mp22NC.asm \
+ modules/arch/lc3b/tests/lc3b-mp22NC.hex \
+ modules/arch/yasm_arch.xml modules/listfmts/nasm/Makefile.inc \
+ modules/parsers/gas/Makefile.inc \
+ modules/parsers/nasm/Makefile.inc \
+ modules/parsers/gas/tests/Makefile.inc \
+ modules/parsers/gas/gas-token.re \
+ modules/parsers/gas/tests/gas_test.sh \
+ modules/parsers/gas/tests/dataref-imm.asm \
+ modules/parsers/gas/tests/dataref-imm.hex \
+ modules/parsers/gas/tests/datavis.asm \
+ modules/parsers/gas/tests/datavis.errwarn \
+ modules/parsers/gas/tests/datavis.hex \
+ modules/parsers/gas/tests/datavis2.asm \
+ modules/parsers/gas/tests/datavis2.hex \
+ modules/parsers/gas/tests/execsect.asm \
+ modules/parsers/gas/tests/execsect.hex \
+ modules/parsers/gas/tests/gas-fill.asm \
+ modules/parsers/gas/tests/gas-fill.hex \
+ modules/parsers/gas/tests/gas-float.asm \
+ modules/parsers/gas/tests/gas-float.hex \
+ modules/parsers/gas/tests/gas-instlabel.asm \
+ modules/parsers/gas/tests/gas-instlabel.hex \
+ modules/parsers/gas/tests/gas-line-err.asm \
+ modules/parsers/gas/tests/gas-line-err.errwarn \
+ modules/parsers/gas/tests/gas-line2-err.asm \
+ modules/parsers/gas/tests/gas-line2-err.errwarn \
+ modules/parsers/gas/tests/gas-push.asm \
+ modules/parsers/gas/tests/gas-push.hex \
+ modules/parsers/gas/tests/gas-segprefix.asm \
+ modules/parsers/gas/tests/gas-segprefix.hex \
+ modules/parsers/gas/tests/gas-semi.asm \
+ modules/parsers/gas/tests/gas-semi.hex \
+ modules/parsers/gas/tests/gassectalign.asm \
+ modules/parsers/gas/tests/gassectalign.hex \
+ modules/parsers/gas/tests/jmpcall.asm \
+ modules/parsers/gas/tests/jmpcall.errwarn \
+ modules/parsers/gas/tests/jmpcall.hex \
+ modules/parsers/gas/tests/leb128.asm \
+ modules/parsers/gas/tests/leb128.hex \
+ modules/parsers/gas/tests/localcomm.asm \
+ modules/parsers/gas/tests/localcomm.hex \
+ modules/parsers/gas/tests/reggroup-err.asm \
+ modules/parsers/gas/tests/reggroup-err.errwarn \
+ modules/parsers/gas/tests/reggroup.asm \
+ modules/parsers/gas/tests/reggroup.hex \
+ modules/parsers/gas/tests/strzero.asm \
+ modules/parsers/gas/tests/strzero.hex \
+ modules/parsers/gas/tests/varinsn.asm \
+ modules/parsers/gas/tests/varinsn.hex \
+ modules/parsers/gas/tests/bin/Makefile.inc \
+ modules/parsers/gas/tests/bin/gas_bin_test.sh \
+ modules/parsers/gas/tests/bin/gas-comment.asm \
+ modules/parsers/gas/tests/bin/gas-comment.errwarn \
+ modules/parsers/gas/tests/bin/gas-comment.hex \
+ modules/parsers/gas/tests/bin/gas-llabel.asm \
+ modules/parsers/gas/tests/bin/gas-llabel.hex \
+ modules/parsers/gas/tests/bin/gas-set.asm \
+ modules/parsers/gas/tests/bin/gas-set.hex \
+ modules/parsers/gas/tests/bin/rept-err.asm \
+ modules/parsers/gas/tests/bin/rept-err.errwarn \
+ modules/parsers/gas/tests/bin/reptempty.asm \
+ modules/parsers/gas/tests/bin/reptempty.hex \
+ modules/parsers/gas/tests/bin/reptlong.asm \
+ modules/parsers/gas/tests/bin/reptlong.hex \
+ modules/parsers/gas/tests/bin/reptnested-err.asm \
+ modules/parsers/gas/tests/bin/reptnested-err.errwarn \
+ modules/parsers/gas/tests/bin/reptsimple.asm \
+ modules/parsers/gas/tests/bin/reptsimple.hex \
+ modules/parsers/gas/tests/bin/reptwarn.asm \
+ modules/parsers/gas/tests/bin/reptwarn.errwarn \
+ modules/parsers/gas/tests/bin/reptwarn.hex \
+ modules/parsers/gas/tests/bin/reptzero.asm \
+ modules/parsers/gas/tests/bin/reptzero.hex \
+ modules/parsers/nasm/nasm-token.re \
+ modules/parsers/nasm/nasm-std.mac \
+ modules/parsers/nasm/tests/Makefile.inc \
+ modules/parsers/nasm/tests/nasm_test.sh \
+ modules/parsers/nasm/tests/alignnop16.asm \
+ modules/parsers/nasm/tests/alignnop16.hex \
+ modules/parsers/nasm/tests/alignnop32.asm \
+ modules/parsers/nasm/tests/alignnop32.hex \
+ modules/parsers/nasm/tests/charconstmath.asm \
+ modules/parsers/nasm/tests/charconstmath.hex \
+ modules/parsers/nasm/tests/dy.asm \
+ modules/parsers/nasm/tests/dy.hex \
+ modules/parsers/nasm/tests/endcomma.asm \
+ modules/parsers/nasm/tests/endcomma.hex \
+ modules/parsers/nasm/tests/equcolon.asm \
+ modules/parsers/nasm/tests/equcolon.hex \
+ modules/parsers/nasm/tests/equlocal.asm \
+ modules/parsers/nasm/tests/equlocal.hex \
+ modules/parsers/nasm/tests/hexconst.asm \
+ modules/parsers/nasm/tests/hexconst.hex \
+ modules/parsers/nasm/tests/long.asm \
+ modules/parsers/nasm/tests/long.hex \
+ modules/parsers/nasm/tests/locallabel.asm \
+ modules/parsers/nasm/tests/locallabel.hex \
+ modules/parsers/nasm/tests/locallabel2.asm \
+ modules/parsers/nasm/tests/locallabel2.hex \
+ modules/parsers/nasm/tests/nasm-prefix.asm \
+ modules/parsers/nasm/tests/nasm-prefix.hex \
+ modules/parsers/nasm/tests/newsect.asm \
+ modules/parsers/nasm/tests/newsect.hex \
+ modules/parsers/nasm/tests/orphannowarn.asm \
+ modules/parsers/nasm/tests/orphannowarn.hex \
+ modules/parsers/nasm/tests/prevlocalwarn.asm \
+ modules/parsers/nasm/tests/prevlocalwarn.errwarn \
+ modules/parsers/nasm/tests/prevlocalwarn.hex \
+ modules/parsers/nasm/tests/strucalign.asm \
+ modules/parsers/nasm/tests/strucalign.hex \
+ modules/parsers/nasm/tests/struczero.asm \
+ modules/parsers/nasm/tests/struczero.hex \
+ modules/parsers/nasm/tests/syntax-err.asm \
+ modules/parsers/nasm/tests/syntax-err.errwarn \
+ modules/parsers/nasm/tests/uscore.asm \
+ modules/parsers/nasm/tests/uscore.hex \
+ modules/parsers/nasm/tests/worphan/Makefile.inc \
+ modules/parsers/nasm/tests/worphan/nasm_worphan_test.sh \
+ modules/parsers/nasm/tests/worphan/orphanwarn.asm \
+ modules/parsers/nasm/tests/worphan/orphanwarn.errwarn \
+ modules/parsers/nasm/tests/worphan/orphanwarn.hex \
+ modules/parsers/tasm/tests/Makefile.inc \
+ modules/parsers/tasm/tests/tasm_test.sh \
+ modules/parsers/tasm/tests/array.asm \
+ modules/parsers/tasm/tests/array.hex \
+ modules/parsers/tasm/tests/case.asm \
+ modules/parsers/tasm/tests/case.hex \
+ modules/parsers/tasm/tests/charstr.asm \
+ modules/parsers/tasm/tests/charstr.hex \
+ modules/parsers/tasm/tests/dup.asm \
+ modules/parsers/tasm/tests/dup.hex \
+ modules/parsers/tasm/tests/equal.asm \
+ modules/parsers/tasm/tests/equal.hex \
+ modules/parsers/tasm/tests/expr.asm \
+ modules/parsers/tasm/tests/expr.hex \
+ modules/parsers/tasm/tests/irp.asm \
+ modules/parsers/tasm/tests/irp.hex \
+ modules/parsers/tasm/tests/label.asm \
+ modules/parsers/tasm/tests/label.hex \
+ modules/parsers/tasm/tests/les.asm \
+ modules/parsers/tasm/tests/les.hex \
+ modules/parsers/tasm/tests/lidt.asm \
+ modules/parsers/tasm/tests/lidt.hex \
+ modules/parsers/tasm/tests/macro.asm \
+ modules/parsers/tasm/tests/macro.hex \
+ modules/parsers/tasm/tests/offset.asm \
+ modules/parsers/tasm/tests/offset.hex \
+ modules/parsers/tasm/tests/quote.asm \
+ modules/parsers/tasm/tests/quote.hex \
+ modules/parsers/tasm/tests/res.asm \
+ modules/parsers/tasm/tests/res.errwarn \
+ modules/parsers/tasm/tests/res.hex \
+ modules/parsers/tasm/tests/segment.asm \
+ modules/parsers/tasm/tests/segment.hex \
+ modules/parsers/tasm/tests/size.asm \
+ modules/parsers/tasm/tests/size.hex \
+ modules/parsers/tasm/tests/struc.asm \
+ modules/parsers/tasm/tests/struc.errwarn \
+ modules/parsers/tasm/tests/struc.hex \
+ modules/parsers/tasm/tests/exe/Makefile.inc \
+ modules/parsers/tasm/tests/exe/tasm_exe_test.sh \
+ modules/parsers/tasm/tests/exe/exe.asm \
+ modules/parsers/tasm/tests/exe/exe.hex \
+ modules/parsers/yasm_parsers.xml \
+ modules/preprocs/nasm/Makefile.inc \
+ modules/preprocs/raw/Makefile.inc \
+ modules/preprocs/cpp/Makefile.inc \
+ modules/preprocs/nasm/genversion.c \
+ modules/preprocs/nasm/tests/Makefile.inc \
+ modules/preprocs/nasm/tests/nasmpp_test.sh \
+ modules/preprocs/nasm/tests/16args.asm \
+ modules/preprocs/nasm/tests/16args.hex \
+ modules/preprocs/nasm/tests/ifcritical-err.asm \
+ modules/preprocs/nasm/tests/ifcritical-err.errwarn \
+ modules/preprocs/nasm/tests/longline.asm \
+ modules/preprocs/nasm/tests/longline.hex \
+ modules/preprocs/nasm/tests/macroeof-err.asm \
+ modules/preprocs/nasm/tests/macroeof-err.errwarn \
+ modules/preprocs/nasm/tests/noinclude-err.asm \
+ modules/preprocs/nasm/tests/noinclude-err.errwarn \
+ modules/preprocs/nasm/tests/nasmpp-bigint.asm \
+ modules/preprocs/nasm/tests/nasmpp-bigint.hex \
+ modules/preprocs/nasm/tests/nasmpp-decimal.asm \
+ modules/preprocs/nasm/tests/nasmpp-decimal.hex \
+ modules/preprocs/nasm/tests/nasmpp-nested.asm \
+ modules/preprocs/nasm/tests/nasmpp-nested.errwarn \
+ modules/preprocs/nasm/tests/nasmpp-nested.hex \
+ modules/preprocs/nasm/tests/orgsect.asm \
+ modules/preprocs/nasm/tests/orgsect.hex \
+ modules/preprocs/raw/tests/Makefile.inc \
+ modules/preprocs/raw/tests/rawpp_test.sh \
+ modules/preprocs/raw/tests/longline.asm \
+ modules/preprocs/raw/tests/longline.hex \
+ modules/dbgfmts/codeview/Makefile.inc \
+ modules/dbgfmts/dwarf2/Makefile.inc \
+ modules/dbgfmts/null/Makefile.inc \
+ modules/dbgfmts/stabs/Makefile.inc \
+ modules/dbgfmts/codeview/cv8.txt \
+ modules/dbgfmts/dwarf2/tests/Makefile.inc \
+ modules/dbgfmts/dwarf2/tests/pass32/Makefile.inc \
+ modules/dbgfmts/dwarf2/tests/pass64/Makefile.inc \
+ modules/dbgfmts/dwarf2/tests/passwin64/Makefile.inc \
+ modules/dbgfmts/dwarf2/tests/pass32/dwarf2_pass32_test.sh \
+ modules/dbgfmts/dwarf2/tests/pass32/dwarf32-err.asm \
+ modules/dbgfmts/dwarf2/tests/pass32/dwarf32-err.errwarn \
+ modules/dbgfmts/dwarf2/tests/pass32/dwarf32_testhd.asm \
+ modules/dbgfmts/dwarf2/tests/pass32/dwarf32_testhd.hex \
+ modules/dbgfmts/dwarf2/tests/pass64/dwarf2_pass64_test.sh \
+ modules/dbgfmts/dwarf2/tests/pass64/dwarf64_2loc.asm \
+ modules/dbgfmts/dwarf2/tests/pass64/dwarf64_2loc.hex \
+ modules/dbgfmts/dwarf2/tests/pass64/dwarf64_leb128.asm \
+ modules/dbgfmts/dwarf2/tests/pass64/dwarf64_leb128.hex \
+ modules/dbgfmts/dwarf2/tests/passwin64/dwarf2_passwin64_test.sh \
+ modules/dbgfmts/dwarf2/tests/passwin64/dwarfwin64_testhd.asm \
+ modules/dbgfmts/dwarf2/tests/passwin64/dwarfwin64_testhd.errwarn \
+ modules/dbgfmts/dwarf2/tests/passwin64/dwarfwin64_testhd.hex \
+ modules/dbgfmts/stabs/tests/Makefile.inc \
+ modules/dbgfmts/stabs/tests/stabs_test.sh \
+ modules/dbgfmts/stabs/tests/stabs-elf.asm \
+ modules/dbgfmts/stabs/tests/stabs-elf.hex \
+ modules/dbgfmts/yasm_dbgfmts.xml \
+ modules/objfmts/dbg/Makefile.inc \
+ modules/objfmts/bin/Makefile.inc \
+ modules/objfmts/elf/Makefile.inc \
+ modules/objfmts/coff/Makefile.inc \
+ modules/objfmts/macho/Makefile.inc \
+ modules/objfmts/rdf/Makefile.inc \
+ modules/objfmts/win32/Makefile.inc \
+ modules/objfmts/win64/Makefile.inc \
+ modules/objfmts/xdf/Makefile.inc \
+ modules/objfmts/bin/tests/Makefile.inc \
+ modules/objfmts/bin/tests/bin_test.sh \
+ modules/objfmts/bin/tests/abs.asm \
+ modules/objfmts/bin/tests/abs.hex \
+ modules/objfmts/bin/tests/bigorg.asm \
+ modules/objfmts/bin/tests/bigorg.hex \
+ modules/objfmts/bin/tests/bigorg.errwarn \
+ modules/objfmts/bin/tests/bin-farabs.asm \
+ modules/objfmts/bin/tests/bin-farabs.hex \
+ modules/objfmts/bin/tests/bin-rip.asm \
+ modules/objfmts/bin/tests/bin-rip.hex \
+ modules/objfmts/bin/tests/bintest.asm \
+ modules/objfmts/bin/tests/bintest.hex \
+ modules/objfmts/bin/tests/float-err.asm \
+ modules/objfmts/bin/tests/float-err.errwarn \
+ modules/objfmts/bin/tests/float.asm \
+ modules/objfmts/bin/tests/float.hex \
+ modules/objfmts/bin/tests/integer-warn.asm \
+ modules/objfmts/bin/tests/integer-warn.hex \
+ modules/objfmts/bin/tests/integer-warn.errwarn \
+ modules/objfmts/bin/tests/integer.asm \
+ modules/objfmts/bin/tests/integer.hex \
+ modules/objfmts/bin/tests/levelop.asm \
+ modules/objfmts/bin/tests/levelop.hex \
+ modules/objfmts/bin/tests/reserve.asm \
+ modules/objfmts/bin/tests/reserve.hex \
+ modules/objfmts/bin/tests/reserve.errwarn \
+ modules/objfmts/bin/tests/shr.asm \
+ modules/objfmts/bin/tests/shr.hex \
+ modules/objfmts/bin/tests/multisect/Makefile.inc \
+ modules/objfmts/bin/tests/multisect/bin_multi_test.sh \
+ modules/objfmts/bin/tests/multisect/bin-align.asm \
+ modules/objfmts/bin/tests/multisect/bin-align.errwarn \
+ modules/objfmts/bin/tests/multisect/bin-align.hex \
+ modules/objfmts/bin/tests/multisect/bin-align.map \
+ modules/objfmts/bin/tests/multisect/bin-ssym.asm \
+ modules/objfmts/bin/tests/multisect/bin-ssym.hex \
+ modules/objfmts/bin/tests/multisect/bin-ssym.map \
+ modules/objfmts/bin/tests/multisect/follows-loop1-err.asm \
+ modules/objfmts/bin/tests/multisect/follows-loop1-err.errwarn \
+ modules/objfmts/bin/tests/multisect/follows-loop2-err.asm \
+ modules/objfmts/bin/tests/multisect/follows-loop2-err.errwarn \
+ modules/objfmts/bin/tests/multisect/follows-notfound-err.asm \
+ modules/objfmts/bin/tests/multisect/follows-notfound-err.errwarn \
+ modules/objfmts/bin/tests/multisect/initbss.asm \
+ modules/objfmts/bin/tests/multisect/initbss.errwarn \
+ modules/objfmts/bin/tests/multisect/initbss.hex \
+ modules/objfmts/bin/tests/multisect/initbss.map \
+ modules/objfmts/bin/tests/multisect/ldlinux-sects.asm \
+ modules/objfmts/bin/tests/multisect/ldlinux-sects.hex \
+ modules/objfmts/bin/tests/multisect/ldlinux-sects.map \
+ modules/objfmts/bin/tests/multisect/multisect1.asm \
+ modules/objfmts/bin/tests/multisect/multisect1.hex \
+ modules/objfmts/bin/tests/multisect/multisect1.map \
+ modules/objfmts/bin/tests/multisect/multisect2.asm \
+ modules/objfmts/bin/tests/multisect/multisect2.hex \
+ modules/objfmts/bin/tests/multisect/multisect2.map \
+ modules/objfmts/bin/tests/multisect/multisect3.asm \
+ modules/objfmts/bin/tests/multisect/multisect3.hex \
+ modules/objfmts/bin/tests/multisect/multisect3.map \
+ modules/objfmts/bin/tests/multisect/multisect4.asm \
+ modules/objfmts/bin/tests/multisect/multisect4.hex \
+ modules/objfmts/bin/tests/multisect/multisect4.map \
+ modules/objfmts/bin/tests/multisect/multisect5.asm \
+ modules/objfmts/bin/tests/multisect/multisect5.hex \
+ modules/objfmts/bin/tests/multisect/multisect5.map \
+ modules/objfmts/bin/tests/multisect/nomultisect1.asm \
+ modules/objfmts/bin/tests/multisect/nomultisect1.hex \
+ modules/objfmts/bin/tests/multisect/nomultisect1.map \
+ modules/objfmts/bin/tests/multisect/nomultisect2.asm \
+ modules/objfmts/bin/tests/multisect/nomultisect2.hex \
+ modules/objfmts/bin/tests/multisect/nomultisect2.map \
+ modules/objfmts/bin/tests/multisect/vfollows-loop1-err.asm \
+ modules/objfmts/bin/tests/multisect/vfollows-loop1-err.errwarn \
+ modules/objfmts/bin/tests/multisect/vfollows-loop2-err.asm \
+ modules/objfmts/bin/tests/multisect/vfollows-loop2-err.errwarn \
+ modules/objfmts/bin/tests/multisect/vfollows-notfound-err.asm \
+ modules/objfmts/bin/tests/multisect/vfollows-notfound-err.errwarn \
+ modules/objfmts/elf/tests/Makefile.inc \
+ modules/objfmts/elf/tests/elf_test.sh \
+ modules/objfmts/elf/tests/curpos.asm \
+ modules/objfmts/elf/tests/curpos.hex \
+ modules/objfmts/elf/tests/curpos-err.asm \
+ modules/objfmts/elf/tests/curpos-err.errwarn \
+ modules/objfmts/elf/tests/elf-overdef.asm \
+ modules/objfmts/elf/tests/elf-overdef.hex \
+ modules/objfmts/elf/tests/elf-x86id.asm \
+ modules/objfmts/elf/tests/elf-x86id.hex \
+ modules/objfmts/elf/tests/elfabssect.asm \
+ modules/objfmts/elf/tests/elfabssect.hex \
+ modules/objfmts/elf/tests/elfcond.asm \
+ modules/objfmts/elf/tests/elfcond.hex \
+ modules/objfmts/elf/tests/elfequabs.asm \
+ modules/objfmts/elf/tests/elfequabs.hex \
+ modules/objfmts/elf/tests/elfglobal.asm \
+ modules/objfmts/elf/tests/elfglobal.hex \
+ modules/objfmts/elf/tests/elfglobext.asm \
+ modules/objfmts/elf/tests/elfglobext.hex \
+ modules/objfmts/elf/tests/elfglobext2.asm \
+ modules/objfmts/elf/tests/elfglobext2.hex \
+ modules/objfmts/elf/tests/elfmanysym.asm \
+ modules/objfmts/elf/tests/elfmanysym.hex \
+ modules/objfmts/elf/tests/elfreloc.asm \
+ modules/objfmts/elf/tests/elfreloc.hex \
+ modules/objfmts/elf/tests/elfreloc-ext.asm \
+ modules/objfmts/elf/tests/elfreloc-ext.hex \
+ modules/objfmts/elf/tests/elfsectalign.asm \
+ modules/objfmts/elf/tests/elfsectalign.hex \
+ modules/objfmts/elf/tests/elfso.asm \
+ modules/objfmts/elf/tests/elfso.hex \
+ modules/objfmts/elf/tests/elftest.c \
+ modules/objfmts/elf/tests/elftest.asm \
+ modules/objfmts/elf/tests/elftest.hex \
+ modules/objfmts/elf/tests/elftimes.asm \
+ modules/objfmts/elf/tests/elftimes.hex \
+ modules/objfmts/elf/tests/elftypesize.asm \
+ modules/objfmts/elf/tests/elftypesize.hex \
+ modules/objfmts/elf/tests/elfvisibility.asm \
+ modules/objfmts/elf/tests/elfvisibility.errwarn \
+ modules/objfmts/elf/tests/elfvisibility.hex \
+ modules/objfmts/elf/tests/nasm-sectname.asm \
+ modules/objfmts/elf/tests/nasm-sectname.hex \
+ modules/objfmts/elf/tests/nasm-forceident.asm \
+ modules/objfmts/elf/tests/nasm-forceident.hex \
+ modules/objfmts/elf/tests/amd64/Makefile.inc \
+ modules/objfmts/elf/tests/gas32/Makefile.inc \
+ modules/objfmts/elf/tests/gas64/Makefile.inc \
+ modules/objfmts/elf/tests/amd64/elf_amd64_test.sh \
+ modules/objfmts/elf/tests/amd64/elf-rip.asm \
+ modules/objfmts/elf/tests/amd64/elf-rip.hex \
+ modules/objfmts/elf/tests/amd64/elfso64.asm \
+ modules/objfmts/elf/tests/amd64/elfso64.hex \
+ modules/objfmts/elf/tests/amd64/gotpcrel.asm \
+ modules/objfmts/elf/tests/amd64/gotpcrel.hex \
+ modules/objfmts/elf/tests/gas32/elf_gas32_test.sh \
+ modules/objfmts/elf/tests/gas32/elf_gas32_ssym.asm \
+ modules/objfmts/elf/tests/gas32/elf_gas32_ssym.hex \
+ modules/objfmts/elf/tests/gas64/elf_gas64_test.sh \
+ modules/objfmts/elf/tests/gas64/crosssect.asm \
+ modules/objfmts/elf/tests/gas64/crosssect.hex \
+ modules/objfmts/elf/tests/gas64/elf_gas64_curpos.asm \
+ modules/objfmts/elf/tests/gas64/elf_gas64_curpos.hex \
+ modules/objfmts/elf/tests/gas64/elf_gas64_reloc.asm \
+ modules/objfmts/elf/tests/gas64/elf_gas64_reloc.hex \
+ modules/objfmts/elf/tests/gas64/elf_gas64_ssym.asm \
+ modules/objfmts/elf/tests/gas64/elf_gas64_ssym.hex \
+ modules/objfmts/coff/win64-nasm.mac \
+ modules/objfmts/coff/win64-gas.mac \
+ modules/objfmts/coff/tests/Makefile.inc \
+ modules/objfmts/coff/tests/coff_test.sh \
+ modules/objfmts/coff/tests/cofftest.c \
+ modules/objfmts/coff/tests/cofftest.asm \
+ modules/objfmts/coff/tests/cofftest.hex \
+ modules/objfmts/coff/tests/cofftimes.asm \
+ modules/objfmts/coff/tests/cofftimes.hex \
+ modules/objfmts/coff/tests/x86id.asm \
+ modules/objfmts/coff/tests/x86id.hex \
+ modules/objfmts/coff/tests/x86id.errwarn \
+ modules/objfmts/macho/tests/Makefile.inc \
+ modules/objfmts/macho/tests/gas32/Makefile.inc \
+ modules/objfmts/macho/tests/gas64/Makefile.inc \
+ modules/objfmts/macho/tests/nasm32/Makefile.inc \
+ modules/objfmts/macho/tests/nasm64/Makefile.inc \
+ modules/objfmts/macho/tests/gas32/gas_macho32_test.sh \
+ modules/objfmts/macho/tests/gas32/gas-macho32.asm \
+ modules/objfmts/macho/tests/gas32/gas-macho32.hex \
+ modules/objfmts/macho/tests/gas64/gas_macho64_test.sh \
+ modules/objfmts/macho/tests/gas64/gas-macho64.asm \
+ modules/objfmts/macho/tests/gas64/gas-macho64.hex \
+ modules/objfmts/macho/tests/gas64/gas-macho64-pic.asm \
+ modules/objfmts/macho/tests/gas64/gas-macho64-pic.hex \
+ modules/objfmts/macho/tests/nasm32/macho32_test.sh \
+ modules/objfmts/macho/tests/nasm32/machotest.c \
+ modules/objfmts/macho/tests/nasm32/machotest.asm \
+ modules/objfmts/macho/tests/nasm32/machotest.hex \
+ modules/objfmts/macho/tests/nasm32/macho-reloc.asm \
+ modules/objfmts/macho/tests/nasm32/macho-reloc.hex \
+ modules/objfmts/macho/tests/nasm32/macho32-sect.asm \
+ modules/objfmts/macho/tests/nasm32/macho32-sect.errwarn \
+ modules/objfmts/macho/tests/nasm32/macho32-sect.hex \
+ modules/objfmts/macho/tests/nasm64/nasm-macho64-pic.asm \
+ modules/objfmts/macho/tests/nasm64/nasm-macho64-pic.hex \
+ modules/objfmts/macho/tests/nasm64/macho64_test.sh \
+ modules/objfmts/macho/tests/nasm64/machotest64.c \
+ modules/objfmts/macho/tests/nasm64/machotest64.asm \
+ modules/objfmts/macho/tests/nasm64/machotest64.hex \
+ modules/objfmts/macho/tests/nasm64/macho-reloc64-err.asm \
+ modules/objfmts/macho/tests/nasm64/macho-reloc64-err.errwarn \
+ modules/objfmts/rdf/tests/Makefile.inc \
+ modules/objfmts/rdf/tests/rdf_test.sh \
+ modules/objfmts/rdf/tests/rdfabs.asm \
+ modules/objfmts/rdf/tests/rdfabs.errwarn \
+ modules/objfmts/rdf/tests/rdfabs.hex \
+ modules/objfmts/rdf/tests/rdfext.asm \
+ modules/objfmts/rdf/tests/rdfext.hex \
+ modules/objfmts/rdf/tests/rdfseg.asm \
+ modules/objfmts/rdf/tests/rdfseg.hex \
+ modules/objfmts/rdf/tests/rdfseg2.asm \
+ modules/objfmts/rdf/tests/rdfseg2.hex \
+ modules/objfmts/rdf/tests/rdftest1.asm \
+ modules/objfmts/rdf/tests/rdftest1.hex \
+ modules/objfmts/rdf/tests/rdftest2.asm \
+ modules/objfmts/rdf/tests/rdftest2.hex \
+ modules/objfmts/rdf/tests/rdtlib.asm \
+ modules/objfmts/rdf/tests/rdtlib.hex \
+ modules/objfmts/rdf/tests/rdtmain.asm \
+ modules/objfmts/rdf/tests/rdtmain.hex \
+ modules/objfmts/rdf/tests/testlib.asm \
+ modules/objfmts/rdf/tests/testlib.hex \
+ modules/objfmts/win32/tests/Makefile.inc \
+ modules/objfmts/win32/tests/export.asm \
+ modules/objfmts/win32/tests/export.hex \
+ modules/objfmts/win32/tests/win32_test.sh \
+ modules/objfmts/win32/tests/win32-curpos.asm \
+ modules/objfmts/win32/tests/win32-curpos.hex \
+ modules/objfmts/win32/tests/win32-overdef.asm \
+ modules/objfmts/win32/tests/win32-overdef.hex \
+ modules/objfmts/win32/tests/win32-safeseh.asm \
+ modules/objfmts/win32/tests/win32-safeseh.hex \
+ modules/objfmts/win32/tests/win32-safeseh.masm \
+ modules/objfmts/win32/tests/win32-segof.asm \
+ modules/objfmts/win32/tests/win32-segof.hex \
+ modules/objfmts/win32/tests/win32test.c \
+ modules/objfmts/win32/tests/win32test.asm \
+ modules/objfmts/win32/tests/win32test.hex \
+ modules/objfmts/win32/tests/gas/Makefile.inc \
+ modules/objfmts/win32/tests/gas/win32_gas_test.sh \
+ modules/objfmts/win32/tests/gas/win32at.asm \
+ modules/objfmts/win32/tests/gas/win32at.hex \
+ modules/objfmts/win64/tests/Makefile.inc \
+ modules/objfmts/win64/tests/win64_test.sh \
+ modules/objfmts/win64/tests/sce1.asm \
+ modules/objfmts/win64/tests/sce1.hex \
+ modules/objfmts/win64/tests/sce1-err.asm \
+ modules/objfmts/win64/tests/sce1-err.errwarn \
+ modules/objfmts/win64/tests/sce2.asm \
+ modules/objfmts/win64/tests/sce2.hex \
+ modules/objfmts/win64/tests/sce2-err.asm \
+ modules/objfmts/win64/tests/sce2-err.errwarn \
+ modules/objfmts/win64/tests/sce3.asm \
+ modules/objfmts/win64/tests/sce3.hex \
+ modules/objfmts/win64/tests/sce3.masm \
+ modules/objfmts/win64/tests/sce4.asm \
+ modules/objfmts/win64/tests/sce4.hex \
+ modules/objfmts/win64/tests/sce4.masm \
+ modules/objfmts/win64/tests/sce4-err.asm \
+ modules/objfmts/win64/tests/sce4-err.errwarn \
+ modules/objfmts/win64/tests/win64-abs.asm \
+ modules/objfmts/win64/tests/win64-abs.hex \
+ modules/objfmts/win64/tests/win64-curpos.asm \
+ modules/objfmts/win64/tests/win64-curpos.hex \
+ modules/objfmts/win64/tests/win64-dataref.asm \
+ modules/objfmts/win64/tests/win64-dataref.hex \
+ modules/objfmts/win64/tests/win64-dataref.masm \
+ modules/objfmts/win64/tests/win64-dataref2.asm \
+ modules/objfmts/win64/tests/win64-dataref2.hex \
+ modules/objfmts/win64/tests/win64-dataref2.masm \
+ modules/objfmts/win64/tests/gas/Makefile.inc \
+ modules/objfmts/win64/tests/gas/win64_gas_test.sh \
+ modules/objfmts/win64/tests/gas/win64-gas-sce.asm \
+ modules/objfmts/win64/tests/gas/win64-gas-sce.hex \
+ modules/objfmts/xdf/tests/Makefile.inc \
+ modules/objfmts/xdf/tests/xdf_test.sh \
+ modules/objfmts/xdf/tests/xdf-overdef.asm \
+ modules/objfmts/xdf/tests/xdf-overdef.hex \
+ modules/objfmts/xdf/tests/xdflong.asm \
+ modules/objfmts/xdf/tests/xdflong.hex \
+ modules/objfmts/xdf/tests/xdflong.errwarn \
+ modules/objfmts/xdf/tests/xdfother.asm \
+ modules/objfmts/xdf/tests/xdfother.hex \
+ modules/objfmts/xdf/tests/xdfprotect.asm \
+ modules/objfmts/xdf/tests/xdfprotect.hex \
+ modules/objfmts/xdf/tests/xdfsect.asm \
+ modules/objfmts/xdf/tests/xdfsect.hex \
+ modules/objfmts/xdf/tests/xdfsect-err.asm \
+ modules/objfmts/xdf/tests/xdfsect-err.errwarn \
+ modules/objfmts/xdf/tests/xdfvirtual.asm \
+ modules/objfmts/xdf/tests/xdfvirtual.hex \
+ modules/objfmts/yasm_objfmts.xml libyasm/genmodule.c \
+ libyasm/module.in libyasm/tests/Makefile.inc \
+ libyasm/tests/libyasm_test.sh libyasm/tests/1shl0.asm \
+ libyasm/tests/1shl0.hex libyasm/tests/absloop-err.asm \
+ libyasm/tests/absloop-err.errwarn \
+ libyasm/tests/charconst64.asm libyasm/tests/charconst64.hex \
+ libyasm/tests/data-rawvalue.asm \
+ libyasm/tests/data-rawvalue.hex libyasm/tests/duplabel-err.asm \
+ libyasm/tests/duplabel-err.errwarn libyasm/tests/emptydata.asm \
+ libyasm/tests/emptydata.hex libyasm/tests/equ-expand.asm \
+ libyasm/tests/equ-expand.hex libyasm/tests/expr-fold-level.asm \
+ libyasm/tests/expr-fold-level.hex \
+ libyasm/tests/expr-wide-ident.asm \
+ libyasm/tests/expr-wide-ident.hex libyasm/tests/externdef.asm \
+ libyasm/tests/externdef.errwarn libyasm/tests/externdef.hex \
+ libyasm/tests/incbin.asm libyasm/tests/incbin.hex \
+ libyasm/tests/jmpsize1.asm libyasm/tests/jmpsize1.hex \
+ libyasm/tests/jmpsize1-err.asm \
+ libyasm/tests/jmpsize1-err.errwarn \
+ libyasm/tests/opt-align1.asm libyasm/tests/opt-align1.hex \
+ libyasm/tests/opt-align2.asm libyasm/tests/opt-align2.hex \
+ libyasm/tests/opt-align3.asm libyasm/tests/opt-align3.hex \
+ libyasm/tests/opt-circular1-err.asm \
+ libyasm/tests/opt-circular1-err.errwarn \
+ libyasm/tests/opt-circular2-err.asm \
+ libyasm/tests/opt-circular2-err.errwarn \
+ libyasm/tests/opt-circular3-err.asm \
+ libyasm/tests/opt-circular3-err.errwarn \
+ libyasm/tests/opt-gvmat64.asm libyasm/tests/opt-gvmat64.hex \
+ libyasm/tests/opt-immexpand.asm \
+ libyasm/tests/opt-immexpand.hex \
+ libyasm/tests/opt-immnoexpand.asm \
+ libyasm/tests/opt-immnoexpand.hex \
+ libyasm/tests/opt-oldalign.asm libyasm/tests/opt-oldalign.hex \
+ libyasm/tests/opt-struc.asm libyasm/tests/opt-struc.hex \
+ libyasm/tests/reserve-err1.asm \
+ libyasm/tests/reserve-err1.errwarn \
+ libyasm/tests/reserve-err2.asm \
+ libyasm/tests/reserve-err2.errwarn libyasm/tests/strucsize.asm \
+ libyasm/tests/strucsize.hex libyasm/tests/times0.asm \
+ libyasm/tests/times0.hex libyasm/tests/timesover-err.asm \
+ libyasm/tests/timesover-err.errwarn \
+ libyasm/tests/timesunder.asm libyasm/tests/timesunder.hex \
+ libyasm/tests/times-res.asm libyasm/tests/times-res.errwarn \
+ libyasm/tests/times-res.hex libyasm/tests/unary.asm \
+ libyasm/tests/unary.hex libyasm/tests/value-err.asm \
+ libyasm/tests/value-err.errwarn \
+ libyasm/tests/value-samesym.asm \
+ libyasm/tests/value-samesym.errwarn \
+ libyasm/tests/value-samesym.hex libyasm/tests/value-mask.asm \
+ libyasm/tests/value-mask.errwarn libyasm/tests/value-mask.hex \
+ frontends/yasm/Makefile.inc frontends/tasm/Makefile.inc \
+ frontends/yasm/yasm.xml m4/intmax.m4 m4/longdouble.m4 \
+ m4/nls.m4 m4/po.m4 m4/printf-posix.m4 m4/signed.m4 \
+ m4/size_max.m4 m4/ulonglong.m4 m4/wchar_t.m4 m4/wint_t.m4 \
+ m4/xsize.m4 m4/codeset.m4 m4/gettext.m4 m4/glibc21.m4 \
+ m4/iconv.m4 m4/intdiv0.m4 m4/inttypes.m4 m4/inttypes_h.m4 \
+ m4/inttypes-pri.m4 m4/isc-posix.m4 m4/lcmessage.m4 \
+ m4/lib-ld.m4 m4/lib-link.m4 m4/lib-prefix.m4 m4/longlong.m4 \
+ m4/progtest.m4 m4/stdint_h.m4 m4/uintmax_t.m4 m4/pythonhead.m4 \
+ m4/pyrex.m4 out_test.sh Artistic.txt BSD.txt GNU_GPL-2.0 \
+ GNU_LGPL-2.0 splint.sh Mkfiles/Makefile.flat \
+ Mkfiles/Makefile.dj Mkfiles/dj/config.h \
+ Mkfiles/dj/libyasm-stdint.h \
+ Mkfiles/vc9/crt_secure_no_deprecate.vsprops \
+ Mkfiles/vc9/yasm.sln Mkfiles/vc9/yasm.vcproj \
+ Mkfiles/vc9/ytasm.vcproj Mkfiles/vc9/config.h \
+ Mkfiles/vc9/libyasm-stdint.h Mkfiles/vc9/readme.vc9.txt \
+ Mkfiles/vc9/yasm.rules Mkfiles/vc9/vc98_swap.py \
+ Mkfiles/vc9/genmacro/genmacro.vcproj \
+ Mkfiles/vc9/genmacro/run.bat \
+ Mkfiles/vc9/genmodule/genmodule.vcproj \
+ Mkfiles/vc9/genmodule/run.bat \
+ Mkfiles/vc9/genstring/genstring.vcproj \
+ Mkfiles/vc9/genstring/run.bat \
+ Mkfiles/vc9/genversion/genversion.vcproj \
+ Mkfiles/vc9/genversion/run.bat \
+ Mkfiles/vc9/libyasm/libyasm.vcproj \
+ Mkfiles/vc9/modules/modules.vcproj \
+ Mkfiles/vc9/re2c/re2c.vcproj Mkfiles/vc9/re2c/run.bat \
+ Mkfiles/vc9/genperf/genperf.vcproj Mkfiles/vc9/genperf/run.bat \
+ genstring.c
+
+# libyasm-stdint.h doesn't clean up after itself?
+CONFIG_CLEAN_FILES = libyasm-stdint.h
+re2c_SOURCES =
+re2c_LDADD = re2c-main.$(OBJEXT) re2c-code.$(OBJEXT) \
+ re2c-dfa.$(OBJEXT) re2c-parser.$(OBJEXT) \
+ re2c-actions.$(OBJEXT) re2c-scanner.$(OBJEXT) \
+ re2c-mbo_getopt.$(OBJEXT) re2c-substr.$(OBJEXT) \
+ re2c-translate.$(OBJEXT)
+re2c_LINK = $(CCLD_FOR_BUILD) -o $@
+genmacro_SOURCES =
+genmacro_LDADD = genmacro.$(OBJEXT)
+genmacro_LINK = $(CCLD_FOR_BUILD) -o $@
+genperf_SOURCES =
+genperf_LDADD = genperf.$(OBJEXT) gp-perfect.$(OBJEXT) \
+ gp-phash.$(OBJEXT) gp-xmalloc.$(OBJEXT) gp-xstrdup.$(OBJEXT)
+genperf_LINK = $(CCLD_FOR_BUILD) -o $@
+PYBINDING_DEPS = tools/python-yasm/bytecode.pxi \
+ tools/python-yasm/errwarn.pxi tools/python-yasm/expr.pxi \
+ tools/python-yasm/floatnum.pxi tools/python-yasm/intnum.pxi \
+ tools/python-yasm/symrec.pxi tools/python-yasm/value.pxi
+YASM_MODULES = arch_x86 arch_lc3b listfmt_nasm parser_gas parser_gnu \
+ parser_nasm parser_tasm preproc_nasm preproc_tasm preproc_raw \
+ preproc_cpp dbgfmt_cv8 dbgfmt_dwarf2 dbgfmt_null dbgfmt_stabs \
+ objfmt_dbg objfmt_bin objfmt_dosexe objfmt_elf objfmt_elf32 \
+ objfmt_elf64 objfmt_coff objfmt_macho objfmt_macho32 \
+ objfmt_macho64 objfmt_rdf objfmt_win32 objfmt_win64 objfmt_x64 \
+ objfmt_xdf
+lib_LIBRARIES = libyasm.a
+libyasm_a_SOURCES = modules/arch/x86/x86arch.c \
+ modules/arch/x86/x86arch.h modules/arch/x86/x86bc.c \
+ modules/arch/x86/x86expr.c modules/arch/x86/x86id.c \
+ modules/arch/lc3b/lc3barch.c modules/arch/lc3b/lc3barch.h \
+ modules/arch/lc3b/lc3bbc.c \
+ modules/listfmts/nasm/nasm-listfmt.c \
+ modules/parsers/gas/gas-parser.c \
+ modules/parsers/gas/gas-parser.h \
+ modules/parsers/gas/gas-parse.c \
+ modules/parsers/nasm/nasm-parser.c \
+ modules/parsers/nasm/nasm-parser.h \
+ modules/parsers/nasm/nasm-parse.c \
+ modules/preprocs/nasm/nasm-preproc.c \
+ modules/preprocs/nasm/nasm-pp.h \
+ modules/preprocs/nasm/nasm-pp.c modules/preprocs/nasm/nasm.h \
+ modules/preprocs/nasm/nasmlib.h \
+ modules/preprocs/nasm/nasmlib.c \
+ modules/preprocs/nasm/nasm-eval.h \
+ modules/preprocs/nasm/nasm-eval.c \
+ modules/preprocs/raw/raw-preproc.c \
+ modules/preprocs/cpp/cpp-preproc.c \
+ modules/dbgfmts/codeview/cv-dbgfmt.h \
+ modules/dbgfmts/codeview/cv-dbgfmt.c \
+ modules/dbgfmts/codeview/cv-symline.c \
+ modules/dbgfmts/codeview/cv-type.c \
+ modules/dbgfmts/dwarf2/dwarf2-dbgfmt.h \
+ modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c \
+ modules/dbgfmts/dwarf2/dwarf2-line.c \
+ modules/dbgfmts/dwarf2/dwarf2-aranges.c \
+ modules/dbgfmts/dwarf2/dwarf2-info.c \
+ modules/dbgfmts/null/null-dbgfmt.c \
+ modules/dbgfmts/stabs/stabs-dbgfmt.c \
+ modules/objfmts/dbg/dbg-objfmt.c \
+ modules/objfmts/bin/bin-objfmt.c modules/objfmts/elf/elf.c \
+ modules/objfmts/elf/elf.h modules/objfmts/elf/elf-objfmt.c \
+ modules/objfmts/elf/elf-machine.h \
+ modules/objfmts/elf/elf-x86-x86.c \
+ modules/objfmts/elf/elf-x86-amd64.c \
+ modules/objfmts/coff/coff-objfmt.c \
+ modules/objfmts/coff/coff-objfmt.h \
+ modules/objfmts/coff/win64-except.c \
+ modules/objfmts/macho/macho-objfmt.c \
+ modules/objfmts/rdf/rdf-objfmt.c \
+ modules/objfmts/xdf/xdf-objfmt.c libyasm/assocdat.c \
+ libyasm/bitvect.c libyasm/bc-align.c libyasm/bc-data.c \
+ libyasm/bc-incbin.c libyasm/bc-org.c libyasm/bc-reserve.c \
+ libyasm/bytecode.c libyasm/errwarn.c libyasm/expr.c \
+ libyasm/file.c libyasm/floatnum.c libyasm/hamt.c \
+ libyasm/insn.c libyasm/intnum.c libyasm/inttree.c \
+ libyasm/linemap.c libyasm/md5.c libyasm/mergesort.c \
+ libyasm/phash.c libyasm/section.c libyasm/strcasecmp.c \
+ libyasm/strsep.c libyasm/symrec.c libyasm/valparam.c \
+ libyasm/value.c libyasm/xmalloc.c libyasm/xstrdup.c
+nodist_libyasm_a_SOURCES = x86cpu.c x86regtmod.c lc3bid.c gas-token.c \
+ nasm-token.c module.c
+genversion_SOURCES =
+genversion_LDADD = genversion.$(OBJEXT)
+genversion_LINK = $(CCLD_FOR_BUILD) -o $@
+genmodule_SOURCES =
+genmodule_LDADD = genmodule.$(OBJEXT)
+genmodule_LINK = $(CCLD_FOR_BUILD) -o $@
+modincludedir = $(includedir)/libyasm
+modinclude_HEADERS = libyasm/arch.h libyasm/assocdat.h \
+ libyasm/bitvect.h libyasm/bytecode.h libyasm/compat-queue.h \
+ libyasm/coretype.h libyasm/dbgfmt.h libyasm/errwarn.h \
+ libyasm/expr.h libyasm/file.h libyasm/floatnum.h \
+ libyasm/hamt.h libyasm/insn.h libyasm/intnum.h \
+ libyasm/inttree.h libyasm/linemap.h libyasm/listfmt.h \
+ libyasm/md5.h libyasm/module.h libyasm/objfmt.h \
+ libyasm/parser.h libyasm/phash.h libyasm/preproc.h \
+ libyasm/section.h libyasm/symrec.h libyasm/valparam.h \
+ libyasm/value.h
+bitvect_test_SOURCES = libyasm/tests/bitvect_test.c
+bitvect_test_LDADD = libyasm.a $(INTLLIBS)
+floatnum_test_SOURCES = libyasm/tests/floatnum_test.c
+floatnum_test_LDADD = libyasm.a $(INTLLIBS)
+leb128_test_SOURCES = libyasm/tests/leb128_test.c
+leb128_test_LDADD = libyasm.a $(INTLLIBS)
+splitpath_test_SOURCES = libyasm/tests/splitpath_test.c
+splitpath_test_LDADD = libyasm.a $(INTLLIBS)
+combpath_test_SOURCES = libyasm/tests/combpath_test.c
+combpath_test_LDADD = libyasm.a $(INTLLIBS)
+uncstring_test_SOURCES = libyasm/tests/uncstring_test.c
+uncstring_test_LDADD = libyasm.a $(INTLLIBS)
+yasm_SOURCES = frontends/yasm/yasm.c frontends/yasm/yasm-options.c \
+ frontends/yasm/yasm-options.h
+yasm_LDADD = libyasm.a $(INTLLIBS)
+ytasm_SOURCES = frontends/tasm/tasm.c frontends/tasm/tasm-options.c \
+ frontends/tasm/tasm-options.h
+ytasm_LDADD = libyasm.a $(INTLLIBS)
+ACLOCAL_AMFLAGS = -I m4
+
+# genstring build
+genstring_SOURCES =
+genstring_LDADD = genstring.$(OBJEXT)
+genstring_LINK = $(CCLD_FOR_BUILD) -o $@
+all: $(BUILT_SOURCES) config.h
+ $(MAKE) $(AM_MAKEFLAGS) all-recursive
+
+.SUFFIXES:
+.SUFFIXES: .gperf .c .o .obj
+am--refresh:
+ @:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(srcdir)/tools/Makefile.inc $(srcdir)/tools/re2c/Makefile.inc $(srcdir)/tools/genmacro/Makefile.inc $(srcdir)/tools/genperf/Makefile.inc $(srcdir)/tools/python-yasm/Makefile.inc $(srcdir)/tools/python-yasm/tests/Makefile.inc $(srcdir)/modules/Makefile.inc $(srcdir)/modules/arch/Makefile.inc $(srcdir)/modules/arch/x86/Makefile.inc $(srcdir)/modules/arch/x86/tests/Makefile.inc $(srcdir)/modules/arch/x86/tests/gas32/Makefile.inc $(srcdir)/modules/arch/x86/tests/gas64/Makefile.inc $(srcdir)/modules/arch/lc3b/Makefile.inc $(srcdir)/modules/arch/lc3b/tests/Makefile.inc $(srcdir)/modules/listfmts/Makefile.inc $(srcdir)/modules/listfmts/nasm/Makefile.inc $(srcdir)/modules/parsers/Makefile.inc $(srcdir)/modules/parsers/gas/Makefile.inc $(srcdir)/modules/parsers/gas/tests/Makefile.inc $(srcdir)/modules/parsers/gas/tests/bin/Makefile.inc $(srcdir)/modules/parsers/nasm/Makefile.inc $(srcdir)/modules/parsers/nasm/tests/Makefile.inc $(srcdir)/modules/parsers/nasm/tests/worphan/Makefile.inc $(srcdir)/modules/parsers/tasm/Makefile.inc $(srcdir)/modules/parsers/tasm/tests/Makefile.inc $(srcdir)/modules/parsers/tasm/tests/exe/Makefile.inc $(srcdir)/modules/preprocs/Makefile.inc $(srcdir)/modules/preprocs/nasm/Makefile.inc $(srcdir)/modules/preprocs/nasm/tests/Makefile.inc $(srcdir)/modules/preprocs/raw/Makefile.inc $(srcdir)/modules/preprocs/raw/tests/Makefile.inc $(srcdir)/modules/preprocs/cpp/Makefile.inc $(srcdir)/modules/dbgfmts/Makefile.inc $(srcdir)/modules/dbgfmts/codeview/Makefile.inc $(srcdir)/modules/dbgfmts/dwarf2/Makefile.inc $(srcdir)/modules/dbgfmts/dwarf2/tests/Makefile.inc $(srcdir)/modules/dbgfmts/dwarf2/tests/pass32/Makefile.inc $(srcdir)/modules/dbgfmts/dwarf2/tests/pass64/Makefile.inc $(srcdir)/modules/dbgfmts/dwarf2/tests/passwin64/Makefile.inc $(srcdir)/modules/dbgfmts/null/Makefile.inc $(srcdir)/modules/dbgfmts/stabs/Makefile.inc $(srcdir)/modules/dbgfmts/stabs/tests/Makefile.inc $(srcdir)/modules/objfmts/Makefile.inc $(srcdir)/modules/objfmts/dbg/Makefile.inc $(srcdir)/modules/objfmts/bin/Makefile.inc $(srcdir)/modules/objfmts/bin/tests/Makefile.inc $(srcdir)/modules/objfmts/bin/tests/multisect/Makefile.inc $(srcdir)/modules/objfmts/elf/Makefile.inc $(srcdir)/modules/objfmts/elf/tests/Makefile.inc $(srcdir)/modules/objfmts/elf/tests/amd64/Makefile.inc $(srcdir)/modules/objfmts/elf/tests/gas32/Makefile.inc $(srcdir)/modules/objfmts/elf/tests/gas64/Makefile.inc $(srcdir)/modules/objfmts/coff/Makefile.inc $(srcdir)/modules/objfmts/coff/tests/Makefile.inc $(srcdir)/modules/objfmts/macho/Makefile.inc $(srcdir)/modules/objfmts/macho/tests/Makefile.inc $(srcdir)/modules/objfmts/macho/tests/gas32/Makefile.inc $(srcdir)/modules/objfmts/macho/tests/gas64/Makefile.inc $(srcdir)/modules/objfmts/macho/tests/nasm32/Makefile.inc $(srcdir)/modules/objfmts/macho/tests/nasm64/Makefile.inc $(srcdir)/modules/objfmts/rdf/Makefile.inc $(srcdir)/modules/objfmts/rdf/tests/Makefile.inc $(srcdir)/modules/objfmts/win32/Makefile.inc $(srcdir)/modules/objfmts/win32/tests/Makefile.inc $(srcdir)/modules/objfmts/win32/tests/gas/Makefile.inc $(srcdir)/modules/objfmts/win64/Makefile.inc $(srcdir)/modules/objfmts/win64/tests/Makefile.inc $(srcdir)/modules/objfmts/win64/tests/gas/Makefile.inc $(srcdir)/modules/objfmts/xdf/Makefile.inc $(srcdir)/modules/objfmts/xdf/tests/Makefile.inc $(srcdir)/libyasm/Makefile.inc $(srcdir)/libyasm/tests/Makefile.inc $(srcdir)/frontends/Makefile.inc $(srcdir)/frontends/yasm/Makefile.inc $(srcdir)/frontends/tasm/Makefile.inc $(srcdir)/m4/Makefile.inc $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \
+ cd $(srcdir) && $(AUTOMAKE) --gnu \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ echo ' $(SHELL) ./config.status'; \
+ $(SHELL) ./config.status;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ $(SHELL) ./config.status --recheck
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(srcdir) && $(AUTOCONF)
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+
+config.h: stamp-h1
+ @if test ! -f $@; then \
+ rm -f stamp-h1; \
+ $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \
+ else :; fi
+
+stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
+ @rm -f stamp-h1
+ cd $(top_builddir) && $(SHELL) ./config.status config.h
+$(srcdir)/config.h.in: $(am__configure_deps)
+ cd $(top_srcdir) && $(AUTOHEADER)
+ rm -f stamp-h1
+ touch $@
+
+distclean-hdr:
+ -rm -f config.h stamp-h1
+install-libLIBRARIES: $(lib_LIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
+ @list='$(lib_LIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f=$(am__strip_dir) \
+ echo " $(libLIBRARIES_INSTALL) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
+ $(libLIBRARIES_INSTALL) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
+ else :; fi; \
+ done
+ @$(POST_INSTALL)
+ @list='$(lib_LIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ p=$(am__strip_dir) \
+ echo " $(RANLIB) '$(DESTDIR)$(libdir)/$$p'"; \
+ $(RANLIB) "$(DESTDIR)$(libdir)/$$p"; \
+ else :; fi; \
+ done
+
+uninstall-libLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(lib_LIBRARIES)'; for p in $$list; do \
+ p=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(libdir)/$$p'"; \
+ rm -f "$(DESTDIR)$(libdir)/$$p"; \
+ done
+
+clean-libLIBRARIES:
+ -test -z "$(lib_LIBRARIES)" || rm -f $(lib_LIBRARIES)
+libyasm.a: $(libyasm_a_OBJECTS) $(libyasm_a_DEPENDENCIES)
+ -rm -f libyasm.a
+ $(libyasm_a_AR) libyasm.a $(libyasm_a_OBJECTS) $(libyasm_a_LIBADD)
+ $(RANLIB) libyasm.a
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+
+clean-checkPROGRAMS:
+ -test -z "$(check_PROGRAMS)" || rm -f $(check_PROGRAMS)
+
+clean-noinstPROGRAMS:
+ -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS)
+bitvect_test$(EXEEXT): $(bitvect_test_OBJECTS) $(bitvect_test_DEPENDENCIES)
+ @rm -f bitvect_test$(EXEEXT)
+ $(LINK) $(bitvect_test_OBJECTS) $(bitvect_test_LDADD) $(LIBS)
+combpath_test$(EXEEXT): $(combpath_test_OBJECTS) $(combpath_test_DEPENDENCIES)
+ @rm -f combpath_test$(EXEEXT)
+ $(LINK) $(combpath_test_OBJECTS) $(combpath_test_LDADD) $(LIBS)
+floatnum_test$(EXEEXT): $(floatnum_test_OBJECTS) $(floatnum_test_DEPENDENCIES)
+ @rm -f floatnum_test$(EXEEXT)
+ $(LINK) $(floatnum_test_OBJECTS) $(floatnum_test_LDADD) $(LIBS)
+genmacro$(EXEEXT): $(genmacro_OBJECTS) $(genmacro_DEPENDENCIES)
+ @rm -f genmacro$(EXEEXT)
+ $(genmacro_LINK) $(genmacro_OBJECTS) $(genmacro_LDADD) $(LIBS)
+genmodule$(EXEEXT): $(genmodule_OBJECTS) $(genmodule_DEPENDENCIES)
+ @rm -f genmodule$(EXEEXT)
+ $(genmodule_LINK) $(genmodule_OBJECTS) $(genmodule_LDADD) $(LIBS)
+genperf$(EXEEXT): $(genperf_OBJECTS) $(genperf_DEPENDENCIES)
+ @rm -f genperf$(EXEEXT)
+ $(genperf_LINK) $(genperf_OBJECTS) $(genperf_LDADD) $(LIBS)
+genstring$(EXEEXT): $(genstring_OBJECTS) $(genstring_DEPENDENCIES)
+ @rm -f genstring$(EXEEXT)
+ $(genstring_LINK) $(genstring_OBJECTS) $(genstring_LDADD) $(LIBS)
+genversion$(EXEEXT): $(genversion_OBJECTS) $(genversion_DEPENDENCIES)
+ @rm -f genversion$(EXEEXT)
+ $(genversion_LINK) $(genversion_OBJECTS) $(genversion_LDADD) $(LIBS)
+leb128_test$(EXEEXT): $(leb128_test_OBJECTS) $(leb128_test_DEPENDENCIES)
+ @rm -f leb128_test$(EXEEXT)
+ $(LINK) $(leb128_test_OBJECTS) $(leb128_test_LDADD) $(LIBS)
+re2c$(EXEEXT): $(re2c_OBJECTS) $(re2c_DEPENDENCIES)
+ @rm -f re2c$(EXEEXT)
+ $(re2c_LINK) $(re2c_OBJECTS) $(re2c_LDADD) $(LIBS)
+splitpath_test$(EXEEXT): $(splitpath_test_OBJECTS) $(splitpath_test_DEPENDENCIES)
+ @rm -f splitpath_test$(EXEEXT)
+ $(LINK) $(splitpath_test_OBJECTS) $(splitpath_test_LDADD) $(LIBS)
+test_hd$(EXEEXT): $(test_hd_OBJECTS) $(test_hd_DEPENDENCIES)
+ @rm -f test_hd$(EXEEXT)
+ $(LINK) $(test_hd_OBJECTS) $(test_hd_LDADD) $(LIBS)
+uncstring_test$(EXEEXT): $(uncstring_test_OBJECTS) $(uncstring_test_DEPENDENCIES)
+ @rm -f uncstring_test$(EXEEXT)
+ $(LINK) $(uncstring_test_OBJECTS) $(uncstring_test_LDADD) $(LIBS)
+yasm$(EXEEXT): $(yasm_OBJECTS) $(yasm_DEPENDENCIES)
+ @rm -f yasm$(EXEEXT)
+ $(LINK) $(yasm_OBJECTS) $(yasm_LDADD) $(LIBS)
+ytasm$(EXEEXT): $(ytasm_OBJECTS) $(ytasm_DEPENDENCIES)
+ @rm -f ytasm$(EXEEXT)
+ $(LINK) $(ytasm_OBJECTS) $(ytasm_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+include ./$(DEPDIR)/assocdat.Po
+include ./$(DEPDIR)/bc-align.Po
+include ./$(DEPDIR)/bc-data.Po
+include ./$(DEPDIR)/bc-incbin.Po
+include ./$(DEPDIR)/bc-org.Po
+include ./$(DEPDIR)/bc-reserve.Po
+include ./$(DEPDIR)/bin-objfmt.Po
+include ./$(DEPDIR)/bitvect.Po
+include ./$(DEPDIR)/bitvect_test.Po
+include ./$(DEPDIR)/bytecode.Po
+include ./$(DEPDIR)/coff-objfmt.Po
+include ./$(DEPDIR)/combpath_test.Po
+include ./$(DEPDIR)/cpp-preproc.Po
+include ./$(DEPDIR)/cv-dbgfmt.Po
+include ./$(DEPDIR)/cv-symline.Po
+include ./$(DEPDIR)/cv-type.Po
+include ./$(DEPDIR)/dbg-objfmt.Po
+include ./$(DEPDIR)/dwarf2-aranges.Po
+include ./$(DEPDIR)/dwarf2-dbgfmt.Po
+include ./$(DEPDIR)/dwarf2-info.Po
+include ./$(DEPDIR)/dwarf2-line.Po
+include ./$(DEPDIR)/elf-objfmt.Po
+include ./$(DEPDIR)/elf-x86-amd64.Po
+include ./$(DEPDIR)/elf-x86-x86.Po
+include ./$(DEPDIR)/elf.Po
+include ./$(DEPDIR)/errwarn.Po
+include ./$(DEPDIR)/expr.Po
+include ./$(DEPDIR)/file.Po
+include ./$(DEPDIR)/floatnum.Po
+include ./$(DEPDIR)/floatnum_test.Po
+include ./$(DEPDIR)/gas-parse.Po
+include ./$(DEPDIR)/gas-parser.Po
+include ./$(DEPDIR)/gas-token.Po
+include ./$(DEPDIR)/hamt.Po
+include ./$(DEPDIR)/insn.Po
+include ./$(DEPDIR)/intnum.Po
+include ./$(DEPDIR)/inttree.Po
+include ./$(DEPDIR)/lc3barch.Po
+include ./$(DEPDIR)/lc3bbc.Po
+include ./$(DEPDIR)/lc3bid.Po
+include ./$(DEPDIR)/leb128_test.Po
+include ./$(DEPDIR)/linemap.Po
+include ./$(DEPDIR)/macho-objfmt.Po
+include ./$(DEPDIR)/md5.Po
+include ./$(DEPDIR)/mergesort.Po
+include ./$(DEPDIR)/module.Po
+include ./$(DEPDIR)/nasm-eval.Po
+include ./$(DEPDIR)/nasm-listfmt.Po
+include ./$(DEPDIR)/nasm-parse.Po
+include ./$(DEPDIR)/nasm-parser.Po
+include ./$(DEPDIR)/nasm-pp.Po
+include ./$(DEPDIR)/nasm-preproc.Po
+include ./$(DEPDIR)/nasm-token.Po
+include ./$(DEPDIR)/nasmlib.Po
+include ./$(DEPDIR)/null-dbgfmt.Po
+include ./$(DEPDIR)/phash.Po
+include ./$(DEPDIR)/raw-preproc.Po
+include ./$(DEPDIR)/rdf-objfmt.Po
+include ./$(DEPDIR)/section.Po
+include ./$(DEPDIR)/splitpath_test.Po
+include ./$(DEPDIR)/stabs-dbgfmt.Po
+include ./$(DEPDIR)/strcasecmp.Po
+include ./$(DEPDIR)/strsep.Po
+include ./$(DEPDIR)/symrec.Po
+include ./$(DEPDIR)/tasm-options.Po
+include ./$(DEPDIR)/tasm.Po
+include ./$(DEPDIR)/test_hd.Po
+include ./$(DEPDIR)/uncstring_test.Po
+include ./$(DEPDIR)/valparam.Po
+include ./$(DEPDIR)/value.Po
+include ./$(DEPDIR)/win64-except.Po
+include ./$(DEPDIR)/x86arch.Po
+include ./$(DEPDIR)/x86bc.Po
+include ./$(DEPDIR)/x86cpu.Po
+include ./$(DEPDIR)/x86expr.Po
+include ./$(DEPDIR)/x86id.Po
+include ./$(DEPDIR)/x86regtmod.Po
+include ./$(DEPDIR)/xdf-objfmt.Po
+include ./$(DEPDIR)/xmalloc.Po
+include ./$(DEPDIR)/xstrdup.Po
+include ./$(DEPDIR)/yasm-options.Po
+include ./$(DEPDIR)/yasm.Po
+
+.c.o:
+ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+# source='$<' object='$@' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(COMPILE) -c $<
+
+.c.obj:
+ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+# source='$<' object='$@' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+x86arch.o: modules/arch/x86/x86arch.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT x86arch.o -MD -MP -MF $(DEPDIR)/x86arch.Tpo -c -o x86arch.o `test -f 'modules/arch/x86/x86arch.c' || echo '$(srcdir)/'`modules/arch/x86/x86arch.c
+ mv -f $(DEPDIR)/x86arch.Tpo $(DEPDIR)/x86arch.Po
+# source='modules/arch/x86/x86arch.c' object='x86arch.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o x86arch.o `test -f 'modules/arch/x86/x86arch.c' || echo '$(srcdir)/'`modules/arch/x86/x86arch.c
+
+x86arch.obj: modules/arch/x86/x86arch.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT x86arch.obj -MD -MP -MF $(DEPDIR)/x86arch.Tpo -c -o x86arch.obj `if test -f 'modules/arch/x86/x86arch.c'; then $(CYGPATH_W) 'modules/arch/x86/x86arch.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/x86/x86arch.c'; fi`
+ mv -f $(DEPDIR)/x86arch.Tpo $(DEPDIR)/x86arch.Po
+# source='modules/arch/x86/x86arch.c' object='x86arch.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o x86arch.obj `if test -f 'modules/arch/x86/x86arch.c'; then $(CYGPATH_W) 'modules/arch/x86/x86arch.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/x86/x86arch.c'; fi`
+
+x86bc.o: modules/arch/x86/x86bc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT x86bc.o -MD -MP -MF $(DEPDIR)/x86bc.Tpo -c -o x86bc.o `test -f 'modules/arch/x86/x86bc.c' || echo '$(srcdir)/'`modules/arch/x86/x86bc.c
+ mv -f $(DEPDIR)/x86bc.Tpo $(DEPDIR)/x86bc.Po
+# source='modules/arch/x86/x86bc.c' object='x86bc.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o x86bc.o `test -f 'modules/arch/x86/x86bc.c' || echo '$(srcdir)/'`modules/arch/x86/x86bc.c
+
+x86bc.obj: modules/arch/x86/x86bc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT x86bc.obj -MD -MP -MF $(DEPDIR)/x86bc.Tpo -c -o x86bc.obj `if test -f 'modules/arch/x86/x86bc.c'; then $(CYGPATH_W) 'modules/arch/x86/x86bc.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/x86/x86bc.c'; fi`
+ mv -f $(DEPDIR)/x86bc.Tpo $(DEPDIR)/x86bc.Po
+# source='modules/arch/x86/x86bc.c' object='x86bc.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o x86bc.obj `if test -f 'modules/arch/x86/x86bc.c'; then $(CYGPATH_W) 'modules/arch/x86/x86bc.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/x86/x86bc.c'; fi`
+
+x86expr.o: modules/arch/x86/x86expr.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT x86expr.o -MD -MP -MF $(DEPDIR)/x86expr.Tpo -c -o x86expr.o `test -f 'modules/arch/x86/x86expr.c' || echo '$(srcdir)/'`modules/arch/x86/x86expr.c
+ mv -f $(DEPDIR)/x86expr.Tpo $(DEPDIR)/x86expr.Po
+# source='modules/arch/x86/x86expr.c' object='x86expr.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o x86expr.o `test -f 'modules/arch/x86/x86expr.c' || echo '$(srcdir)/'`modules/arch/x86/x86expr.c
+
+x86expr.obj: modules/arch/x86/x86expr.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT x86expr.obj -MD -MP -MF $(DEPDIR)/x86expr.Tpo -c -o x86expr.obj `if test -f 'modules/arch/x86/x86expr.c'; then $(CYGPATH_W) 'modules/arch/x86/x86expr.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/x86/x86expr.c'; fi`
+ mv -f $(DEPDIR)/x86expr.Tpo $(DEPDIR)/x86expr.Po
+# source='modules/arch/x86/x86expr.c' object='x86expr.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o x86expr.obj `if test -f 'modules/arch/x86/x86expr.c'; then $(CYGPATH_W) 'modules/arch/x86/x86expr.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/x86/x86expr.c'; fi`
+
+x86id.o: modules/arch/x86/x86id.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT x86id.o -MD -MP -MF $(DEPDIR)/x86id.Tpo -c -o x86id.o `test -f 'modules/arch/x86/x86id.c' || echo '$(srcdir)/'`modules/arch/x86/x86id.c
+ mv -f $(DEPDIR)/x86id.Tpo $(DEPDIR)/x86id.Po
+# source='modules/arch/x86/x86id.c' object='x86id.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o x86id.o `test -f 'modules/arch/x86/x86id.c' || echo '$(srcdir)/'`modules/arch/x86/x86id.c
+
+x86id.obj: modules/arch/x86/x86id.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT x86id.obj -MD -MP -MF $(DEPDIR)/x86id.Tpo -c -o x86id.obj `if test -f 'modules/arch/x86/x86id.c'; then $(CYGPATH_W) 'modules/arch/x86/x86id.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/x86/x86id.c'; fi`
+ mv -f $(DEPDIR)/x86id.Tpo $(DEPDIR)/x86id.Po
+# source='modules/arch/x86/x86id.c' object='x86id.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o x86id.obj `if test -f 'modules/arch/x86/x86id.c'; then $(CYGPATH_W) 'modules/arch/x86/x86id.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/x86/x86id.c'; fi`
+
+lc3barch.o: modules/arch/lc3b/lc3barch.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lc3barch.o -MD -MP -MF $(DEPDIR)/lc3barch.Tpo -c -o lc3barch.o `test -f 'modules/arch/lc3b/lc3barch.c' || echo '$(srcdir)/'`modules/arch/lc3b/lc3barch.c
+ mv -f $(DEPDIR)/lc3barch.Tpo $(DEPDIR)/lc3barch.Po
+# source='modules/arch/lc3b/lc3barch.c' object='lc3barch.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lc3barch.o `test -f 'modules/arch/lc3b/lc3barch.c' || echo '$(srcdir)/'`modules/arch/lc3b/lc3barch.c
+
+lc3barch.obj: modules/arch/lc3b/lc3barch.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lc3barch.obj -MD -MP -MF $(DEPDIR)/lc3barch.Tpo -c -o lc3barch.obj `if test -f 'modules/arch/lc3b/lc3barch.c'; then $(CYGPATH_W) 'modules/arch/lc3b/lc3barch.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/lc3b/lc3barch.c'; fi`
+ mv -f $(DEPDIR)/lc3barch.Tpo $(DEPDIR)/lc3barch.Po
+# source='modules/arch/lc3b/lc3barch.c' object='lc3barch.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lc3barch.obj `if test -f 'modules/arch/lc3b/lc3barch.c'; then $(CYGPATH_W) 'modules/arch/lc3b/lc3barch.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/lc3b/lc3barch.c'; fi`
+
+lc3bbc.o: modules/arch/lc3b/lc3bbc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lc3bbc.o -MD -MP -MF $(DEPDIR)/lc3bbc.Tpo -c -o lc3bbc.o `test -f 'modules/arch/lc3b/lc3bbc.c' || echo '$(srcdir)/'`modules/arch/lc3b/lc3bbc.c
+ mv -f $(DEPDIR)/lc3bbc.Tpo $(DEPDIR)/lc3bbc.Po
+# source='modules/arch/lc3b/lc3bbc.c' object='lc3bbc.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lc3bbc.o `test -f 'modules/arch/lc3b/lc3bbc.c' || echo '$(srcdir)/'`modules/arch/lc3b/lc3bbc.c
+
+lc3bbc.obj: modules/arch/lc3b/lc3bbc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lc3bbc.obj -MD -MP -MF $(DEPDIR)/lc3bbc.Tpo -c -o lc3bbc.obj `if test -f 'modules/arch/lc3b/lc3bbc.c'; then $(CYGPATH_W) 'modules/arch/lc3b/lc3bbc.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/lc3b/lc3bbc.c'; fi`
+ mv -f $(DEPDIR)/lc3bbc.Tpo $(DEPDIR)/lc3bbc.Po
+# source='modules/arch/lc3b/lc3bbc.c' object='lc3bbc.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lc3bbc.obj `if test -f 'modules/arch/lc3b/lc3bbc.c'; then $(CYGPATH_W) 'modules/arch/lc3b/lc3bbc.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/lc3b/lc3bbc.c'; fi`
+
+nasm-listfmt.o: modules/listfmts/nasm/nasm-listfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-listfmt.o -MD -MP -MF $(DEPDIR)/nasm-listfmt.Tpo -c -o nasm-listfmt.o `test -f 'modules/listfmts/nasm/nasm-listfmt.c' || echo '$(srcdir)/'`modules/listfmts/nasm/nasm-listfmt.c
+ mv -f $(DEPDIR)/nasm-listfmt.Tpo $(DEPDIR)/nasm-listfmt.Po
+# source='modules/listfmts/nasm/nasm-listfmt.c' object='nasm-listfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-listfmt.o `test -f 'modules/listfmts/nasm/nasm-listfmt.c' || echo '$(srcdir)/'`modules/listfmts/nasm/nasm-listfmt.c
+
+nasm-listfmt.obj: modules/listfmts/nasm/nasm-listfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-listfmt.obj -MD -MP -MF $(DEPDIR)/nasm-listfmt.Tpo -c -o nasm-listfmt.obj `if test -f 'modules/listfmts/nasm/nasm-listfmt.c'; then $(CYGPATH_W) 'modules/listfmts/nasm/nasm-listfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/listfmts/nasm/nasm-listfmt.c'; fi`
+ mv -f $(DEPDIR)/nasm-listfmt.Tpo $(DEPDIR)/nasm-listfmt.Po
+# source='modules/listfmts/nasm/nasm-listfmt.c' object='nasm-listfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-listfmt.obj `if test -f 'modules/listfmts/nasm/nasm-listfmt.c'; then $(CYGPATH_W) 'modules/listfmts/nasm/nasm-listfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/listfmts/nasm/nasm-listfmt.c'; fi`
+
+gas-parser.o: modules/parsers/gas/gas-parser.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gas-parser.o -MD -MP -MF $(DEPDIR)/gas-parser.Tpo -c -o gas-parser.o `test -f 'modules/parsers/gas/gas-parser.c' || echo '$(srcdir)/'`modules/parsers/gas/gas-parser.c
+ mv -f $(DEPDIR)/gas-parser.Tpo $(DEPDIR)/gas-parser.Po
+# source='modules/parsers/gas/gas-parser.c' object='gas-parser.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gas-parser.o `test -f 'modules/parsers/gas/gas-parser.c' || echo '$(srcdir)/'`modules/parsers/gas/gas-parser.c
+
+gas-parser.obj: modules/parsers/gas/gas-parser.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gas-parser.obj -MD -MP -MF $(DEPDIR)/gas-parser.Tpo -c -o gas-parser.obj `if test -f 'modules/parsers/gas/gas-parser.c'; then $(CYGPATH_W) 'modules/parsers/gas/gas-parser.c'; else $(CYGPATH_W) '$(srcdir)/modules/parsers/gas/gas-parser.c'; fi`
+ mv -f $(DEPDIR)/gas-parser.Tpo $(DEPDIR)/gas-parser.Po
+# source='modules/parsers/gas/gas-parser.c' object='gas-parser.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gas-parser.obj `if test -f 'modules/parsers/gas/gas-parser.c'; then $(CYGPATH_W) 'modules/parsers/gas/gas-parser.c'; else $(CYGPATH_W) '$(srcdir)/modules/parsers/gas/gas-parser.c'; fi`
+
+gas-parse.o: modules/parsers/gas/gas-parse.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gas-parse.o -MD -MP -MF $(DEPDIR)/gas-parse.Tpo -c -o gas-parse.o `test -f 'modules/parsers/gas/gas-parse.c' || echo '$(srcdir)/'`modules/parsers/gas/gas-parse.c
+ mv -f $(DEPDIR)/gas-parse.Tpo $(DEPDIR)/gas-parse.Po
+# source='modules/parsers/gas/gas-parse.c' object='gas-parse.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gas-parse.o `test -f 'modules/parsers/gas/gas-parse.c' || echo '$(srcdir)/'`modules/parsers/gas/gas-parse.c
+
+gas-parse.obj: modules/parsers/gas/gas-parse.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gas-parse.obj -MD -MP -MF $(DEPDIR)/gas-parse.Tpo -c -o gas-parse.obj `if test -f 'modules/parsers/gas/gas-parse.c'; then $(CYGPATH_W) 'modules/parsers/gas/gas-parse.c'; else $(CYGPATH_W) '$(srcdir)/modules/parsers/gas/gas-parse.c'; fi`
+ mv -f $(DEPDIR)/gas-parse.Tpo $(DEPDIR)/gas-parse.Po
+# source='modules/parsers/gas/gas-parse.c' object='gas-parse.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gas-parse.obj `if test -f 'modules/parsers/gas/gas-parse.c'; then $(CYGPATH_W) 'modules/parsers/gas/gas-parse.c'; else $(CYGPATH_W) '$(srcdir)/modules/parsers/gas/gas-parse.c'; fi`
+
+nasm-parser.o: modules/parsers/nasm/nasm-parser.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-parser.o -MD -MP -MF $(DEPDIR)/nasm-parser.Tpo -c -o nasm-parser.o `test -f 'modules/parsers/nasm/nasm-parser.c' || echo '$(srcdir)/'`modules/parsers/nasm/nasm-parser.c
+ mv -f $(DEPDIR)/nasm-parser.Tpo $(DEPDIR)/nasm-parser.Po
+# source='modules/parsers/nasm/nasm-parser.c' object='nasm-parser.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-parser.o `test -f 'modules/parsers/nasm/nasm-parser.c' || echo '$(srcdir)/'`modules/parsers/nasm/nasm-parser.c
+
+nasm-parser.obj: modules/parsers/nasm/nasm-parser.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-parser.obj -MD -MP -MF $(DEPDIR)/nasm-parser.Tpo -c -o nasm-parser.obj `if test -f 'modules/parsers/nasm/nasm-parser.c'; then $(CYGPATH_W) 'modules/parsers/nasm/nasm-parser.c'; else $(CYGPATH_W) '$(srcdir)/modules/parsers/nasm/nasm-parser.c'; fi`
+ mv -f $(DEPDIR)/nasm-parser.Tpo $(DEPDIR)/nasm-parser.Po
+# source='modules/parsers/nasm/nasm-parser.c' object='nasm-parser.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-parser.obj `if test -f 'modules/parsers/nasm/nasm-parser.c'; then $(CYGPATH_W) 'modules/parsers/nasm/nasm-parser.c'; else $(CYGPATH_W) '$(srcdir)/modules/parsers/nasm/nasm-parser.c'; fi`
+
+nasm-parse.o: modules/parsers/nasm/nasm-parse.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-parse.o -MD -MP -MF $(DEPDIR)/nasm-parse.Tpo -c -o nasm-parse.o `test -f 'modules/parsers/nasm/nasm-parse.c' || echo '$(srcdir)/'`modules/parsers/nasm/nasm-parse.c
+ mv -f $(DEPDIR)/nasm-parse.Tpo $(DEPDIR)/nasm-parse.Po
+# source='modules/parsers/nasm/nasm-parse.c' object='nasm-parse.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-parse.o `test -f 'modules/parsers/nasm/nasm-parse.c' || echo '$(srcdir)/'`modules/parsers/nasm/nasm-parse.c
+
+nasm-parse.obj: modules/parsers/nasm/nasm-parse.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-parse.obj -MD -MP -MF $(DEPDIR)/nasm-parse.Tpo -c -o nasm-parse.obj `if test -f 'modules/parsers/nasm/nasm-parse.c'; then $(CYGPATH_W) 'modules/parsers/nasm/nasm-parse.c'; else $(CYGPATH_W) '$(srcdir)/modules/parsers/nasm/nasm-parse.c'; fi`
+ mv -f $(DEPDIR)/nasm-parse.Tpo $(DEPDIR)/nasm-parse.Po
+# source='modules/parsers/nasm/nasm-parse.c' object='nasm-parse.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-parse.obj `if test -f 'modules/parsers/nasm/nasm-parse.c'; then $(CYGPATH_W) 'modules/parsers/nasm/nasm-parse.c'; else $(CYGPATH_W) '$(srcdir)/modules/parsers/nasm/nasm-parse.c'; fi`
+
+nasm-preproc.o: modules/preprocs/nasm/nasm-preproc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-preproc.o -MD -MP -MF $(DEPDIR)/nasm-preproc.Tpo -c -o nasm-preproc.o `test -f 'modules/preprocs/nasm/nasm-preproc.c' || echo '$(srcdir)/'`modules/preprocs/nasm/nasm-preproc.c
+ mv -f $(DEPDIR)/nasm-preproc.Tpo $(DEPDIR)/nasm-preproc.Po
+# source='modules/preprocs/nasm/nasm-preproc.c' object='nasm-preproc.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-preproc.o `test -f 'modules/preprocs/nasm/nasm-preproc.c' || echo '$(srcdir)/'`modules/preprocs/nasm/nasm-preproc.c
+
+nasm-preproc.obj: modules/preprocs/nasm/nasm-preproc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-preproc.obj -MD -MP -MF $(DEPDIR)/nasm-preproc.Tpo -c -o nasm-preproc.obj `if test -f 'modules/preprocs/nasm/nasm-preproc.c'; then $(CYGPATH_W) 'modules/preprocs/nasm/nasm-preproc.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/nasm/nasm-preproc.c'; fi`
+ mv -f $(DEPDIR)/nasm-preproc.Tpo $(DEPDIR)/nasm-preproc.Po
+# source='modules/preprocs/nasm/nasm-preproc.c' object='nasm-preproc.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-preproc.obj `if test -f 'modules/preprocs/nasm/nasm-preproc.c'; then $(CYGPATH_W) 'modules/preprocs/nasm/nasm-preproc.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/nasm/nasm-preproc.c'; fi`
+
+nasm-pp.o: modules/preprocs/nasm/nasm-pp.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-pp.o -MD -MP -MF $(DEPDIR)/nasm-pp.Tpo -c -o nasm-pp.o `test -f 'modules/preprocs/nasm/nasm-pp.c' || echo '$(srcdir)/'`modules/preprocs/nasm/nasm-pp.c
+ mv -f $(DEPDIR)/nasm-pp.Tpo $(DEPDIR)/nasm-pp.Po
+# source='modules/preprocs/nasm/nasm-pp.c' object='nasm-pp.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-pp.o `test -f 'modules/preprocs/nasm/nasm-pp.c' || echo '$(srcdir)/'`modules/preprocs/nasm/nasm-pp.c
+
+nasm-pp.obj: modules/preprocs/nasm/nasm-pp.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-pp.obj -MD -MP -MF $(DEPDIR)/nasm-pp.Tpo -c -o nasm-pp.obj `if test -f 'modules/preprocs/nasm/nasm-pp.c'; then $(CYGPATH_W) 'modules/preprocs/nasm/nasm-pp.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/nasm/nasm-pp.c'; fi`
+ mv -f $(DEPDIR)/nasm-pp.Tpo $(DEPDIR)/nasm-pp.Po
+# source='modules/preprocs/nasm/nasm-pp.c' object='nasm-pp.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-pp.obj `if test -f 'modules/preprocs/nasm/nasm-pp.c'; then $(CYGPATH_W) 'modules/preprocs/nasm/nasm-pp.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/nasm/nasm-pp.c'; fi`
+
+nasmlib.o: modules/preprocs/nasm/nasmlib.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasmlib.o -MD -MP -MF $(DEPDIR)/nasmlib.Tpo -c -o nasmlib.o `test -f 'modules/preprocs/nasm/nasmlib.c' || echo '$(srcdir)/'`modules/preprocs/nasm/nasmlib.c
+ mv -f $(DEPDIR)/nasmlib.Tpo $(DEPDIR)/nasmlib.Po
+# source='modules/preprocs/nasm/nasmlib.c' object='nasmlib.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasmlib.o `test -f 'modules/preprocs/nasm/nasmlib.c' || echo '$(srcdir)/'`modules/preprocs/nasm/nasmlib.c
+
+nasmlib.obj: modules/preprocs/nasm/nasmlib.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasmlib.obj -MD -MP -MF $(DEPDIR)/nasmlib.Tpo -c -o nasmlib.obj `if test -f 'modules/preprocs/nasm/nasmlib.c'; then $(CYGPATH_W) 'modules/preprocs/nasm/nasmlib.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/nasm/nasmlib.c'; fi`
+ mv -f $(DEPDIR)/nasmlib.Tpo $(DEPDIR)/nasmlib.Po
+# source='modules/preprocs/nasm/nasmlib.c' object='nasmlib.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasmlib.obj `if test -f 'modules/preprocs/nasm/nasmlib.c'; then $(CYGPATH_W) 'modules/preprocs/nasm/nasmlib.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/nasm/nasmlib.c'; fi`
+
+nasm-eval.o: modules/preprocs/nasm/nasm-eval.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-eval.o -MD -MP -MF $(DEPDIR)/nasm-eval.Tpo -c -o nasm-eval.o `test -f 'modules/preprocs/nasm/nasm-eval.c' || echo '$(srcdir)/'`modules/preprocs/nasm/nasm-eval.c
+ mv -f $(DEPDIR)/nasm-eval.Tpo $(DEPDIR)/nasm-eval.Po
+# source='modules/preprocs/nasm/nasm-eval.c' object='nasm-eval.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-eval.o `test -f 'modules/preprocs/nasm/nasm-eval.c' || echo '$(srcdir)/'`modules/preprocs/nasm/nasm-eval.c
+
+nasm-eval.obj: modules/preprocs/nasm/nasm-eval.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-eval.obj -MD -MP -MF $(DEPDIR)/nasm-eval.Tpo -c -o nasm-eval.obj `if test -f 'modules/preprocs/nasm/nasm-eval.c'; then $(CYGPATH_W) 'modules/preprocs/nasm/nasm-eval.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/nasm/nasm-eval.c'; fi`
+ mv -f $(DEPDIR)/nasm-eval.Tpo $(DEPDIR)/nasm-eval.Po
+# source='modules/preprocs/nasm/nasm-eval.c' object='nasm-eval.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-eval.obj `if test -f 'modules/preprocs/nasm/nasm-eval.c'; then $(CYGPATH_W) 'modules/preprocs/nasm/nasm-eval.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/nasm/nasm-eval.c'; fi`
+
+raw-preproc.o: modules/preprocs/raw/raw-preproc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT raw-preproc.o -MD -MP -MF $(DEPDIR)/raw-preproc.Tpo -c -o raw-preproc.o `test -f 'modules/preprocs/raw/raw-preproc.c' || echo '$(srcdir)/'`modules/preprocs/raw/raw-preproc.c
+ mv -f $(DEPDIR)/raw-preproc.Tpo $(DEPDIR)/raw-preproc.Po
+# source='modules/preprocs/raw/raw-preproc.c' object='raw-preproc.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o raw-preproc.o `test -f 'modules/preprocs/raw/raw-preproc.c' || echo '$(srcdir)/'`modules/preprocs/raw/raw-preproc.c
+
+raw-preproc.obj: modules/preprocs/raw/raw-preproc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT raw-preproc.obj -MD -MP -MF $(DEPDIR)/raw-preproc.Tpo -c -o raw-preproc.obj `if test -f 'modules/preprocs/raw/raw-preproc.c'; then $(CYGPATH_W) 'modules/preprocs/raw/raw-preproc.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/raw/raw-preproc.c'; fi`
+ mv -f $(DEPDIR)/raw-preproc.Tpo $(DEPDIR)/raw-preproc.Po
+# source='modules/preprocs/raw/raw-preproc.c' object='raw-preproc.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o raw-preproc.obj `if test -f 'modules/preprocs/raw/raw-preproc.c'; then $(CYGPATH_W) 'modules/preprocs/raw/raw-preproc.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/raw/raw-preproc.c'; fi`
+
+cpp-preproc.o: modules/preprocs/cpp/cpp-preproc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpp-preproc.o -MD -MP -MF $(DEPDIR)/cpp-preproc.Tpo -c -o cpp-preproc.o `test -f 'modules/preprocs/cpp/cpp-preproc.c' || echo '$(srcdir)/'`modules/preprocs/cpp/cpp-preproc.c
+ mv -f $(DEPDIR)/cpp-preproc.Tpo $(DEPDIR)/cpp-preproc.Po
+# source='modules/preprocs/cpp/cpp-preproc.c' object='cpp-preproc.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpp-preproc.o `test -f 'modules/preprocs/cpp/cpp-preproc.c' || echo '$(srcdir)/'`modules/preprocs/cpp/cpp-preproc.c
+
+cpp-preproc.obj: modules/preprocs/cpp/cpp-preproc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpp-preproc.obj -MD -MP -MF $(DEPDIR)/cpp-preproc.Tpo -c -o cpp-preproc.obj `if test -f 'modules/preprocs/cpp/cpp-preproc.c'; then $(CYGPATH_W) 'modules/preprocs/cpp/cpp-preproc.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/cpp/cpp-preproc.c'; fi`
+ mv -f $(DEPDIR)/cpp-preproc.Tpo $(DEPDIR)/cpp-preproc.Po
+# source='modules/preprocs/cpp/cpp-preproc.c' object='cpp-preproc.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpp-preproc.obj `if test -f 'modules/preprocs/cpp/cpp-preproc.c'; then $(CYGPATH_W) 'modules/preprocs/cpp/cpp-preproc.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/cpp/cpp-preproc.c'; fi`
+
+cv-dbgfmt.o: modules/dbgfmts/codeview/cv-dbgfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cv-dbgfmt.o -MD -MP -MF $(DEPDIR)/cv-dbgfmt.Tpo -c -o cv-dbgfmt.o `test -f 'modules/dbgfmts/codeview/cv-dbgfmt.c' || echo '$(srcdir)/'`modules/dbgfmts/codeview/cv-dbgfmt.c
+ mv -f $(DEPDIR)/cv-dbgfmt.Tpo $(DEPDIR)/cv-dbgfmt.Po
+# source='modules/dbgfmts/codeview/cv-dbgfmt.c' object='cv-dbgfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cv-dbgfmt.o `test -f 'modules/dbgfmts/codeview/cv-dbgfmt.c' || echo '$(srcdir)/'`modules/dbgfmts/codeview/cv-dbgfmt.c
+
+cv-dbgfmt.obj: modules/dbgfmts/codeview/cv-dbgfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cv-dbgfmt.obj -MD -MP -MF $(DEPDIR)/cv-dbgfmt.Tpo -c -o cv-dbgfmt.obj `if test -f 'modules/dbgfmts/codeview/cv-dbgfmt.c'; then $(CYGPATH_W) 'modules/dbgfmts/codeview/cv-dbgfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/codeview/cv-dbgfmt.c'; fi`
+ mv -f $(DEPDIR)/cv-dbgfmt.Tpo $(DEPDIR)/cv-dbgfmt.Po
+# source='modules/dbgfmts/codeview/cv-dbgfmt.c' object='cv-dbgfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cv-dbgfmt.obj `if test -f 'modules/dbgfmts/codeview/cv-dbgfmt.c'; then $(CYGPATH_W) 'modules/dbgfmts/codeview/cv-dbgfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/codeview/cv-dbgfmt.c'; fi`
+
+cv-symline.o: modules/dbgfmts/codeview/cv-symline.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cv-symline.o -MD -MP -MF $(DEPDIR)/cv-symline.Tpo -c -o cv-symline.o `test -f 'modules/dbgfmts/codeview/cv-symline.c' || echo '$(srcdir)/'`modules/dbgfmts/codeview/cv-symline.c
+ mv -f $(DEPDIR)/cv-symline.Tpo $(DEPDIR)/cv-symline.Po
+# source='modules/dbgfmts/codeview/cv-symline.c' object='cv-symline.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cv-symline.o `test -f 'modules/dbgfmts/codeview/cv-symline.c' || echo '$(srcdir)/'`modules/dbgfmts/codeview/cv-symline.c
+
+cv-symline.obj: modules/dbgfmts/codeview/cv-symline.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cv-symline.obj -MD -MP -MF $(DEPDIR)/cv-symline.Tpo -c -o cv-symline.obj `if test -f 'modules/dbgfmts/codeview/cv-symline.c'; then $(CYGPATH_W) 'modules/dbgfmts/codeview/cv-symline.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/codeview/cv-symline.c'; fi`
+ mv -f $(DEPDIR)/cv-symline.Tpo $(DEPDIR)/cv-symline.Po
+# source='modules/dbgfmts/codeview/cv-symline.c' object='cv-symline.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cv-symline.obj `if test -f 'modules/dbgfmts/codeview/cv-symline.c'; then $(CYGPATH_W) 'modules/dbgfmts/codeview/cv-symline.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/codeview/cv-symline.c'; fi`
+
+cv-type.o: modules/dbgfmts/codeview/cv-type.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cv-type.o -MD -MP -MF $(DEPDIR)/cv-type.Tpo -c -o cv-type.o `test -f 'modules/dbgfmts/codeview/cv-type.c' || echo '$(srcdir)/'`modules/dbgfmts/codeview/cv-type.c
+ mv -f $(DEPDIR)/cv-type.Tpo $(DEPDIR)/cv-type.Po
+# source='modules/dbgfmts/codeview/cv-type.c' object='cv-type.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cv-type.o `test -f 'modules/dbgfmts/codeview/cv-type.c' || echo '$(srcdir)/'`modules/dbgfmts/codeview/cv-type.c
+
+cv-type.obj: modules/dbgfmts/codeview/cv-type.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cv-type.obj -MD -MP -MF $(DEPDIR)/cv-type.Tpo -c -o cv-type.obj `if test -f 'modules/dbgfmts/codeview/cv-type.c'; then $(CYGPATH_W) 'modules/dbgfmts/codeview/cv-type.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/codeview/cv-type.c'; fi`
+ mv -f $(DEPDIR)/cv-type.Tpo $(DEPDIR)/cv-type.Po
+# source='modules/dbgfmts/codeview/cv-type.c' object='cv-type.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cv-type.obj `if test -f 'modules/dbgfmts/codeview/cv-type.c'; then $(CYGPATH_W) 'modules/dbgfmts/codeview/cv-type.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/codeview/cv-type.c'; fi`
+
+dwarf2-dbgfmt.o: modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dwarf2-dbgfmt.o -MD -MP -MF $(DEPDIR)/dwarf2-dbgfmt.Tpo -c -o dwarf2-dbgfmt.o `test -f 'modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c' || echo '$(srcdir)/'`modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c
+ mv -f $(DEPDIR)/dwarf2-dbgfmt.Tpo $(DEPDIR)/dwarf2-dbgfmt.Po
+# source='modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c' object='dwarf2-dbgfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dwarf2-dbgfmt.o `test -f 'modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c' || echo '$(srcdir)/'`modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c
+
+dwarf2-dbgfmt.obj: modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dwarf2-dbgfmt.obj -MD -MP -MF $(DEPDIR)/dwarf2-dbgfmt.Tpo -c -o dwarf2-dbgfmt.obj `if test -f 'modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c'; then $(CYGPATH_W) 'modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c'; fi`
+ mv -f $(DEPDIR)/dwarf2-dbgfmt.Tpo $(DEPDIR)/dwarf2-dbgfmt.Po
+# source='modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c' object='dwarf2-dbgfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dwarf2-dbgfmt.obj `if test -f 'modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c'; then $(CYGPATH_W) 'modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c'; fi`
+
+dwarf2-line.o: modules/dbgfmts/dwarf2/dwarf2-line.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dwarf2-line.o -MD -MP -MF $(DEPDIR)/dwarf2-line.Tpo -c -o dwarf2-line.o `test -f 'modules/dbgfmts/dwarf2/dwarf2-line.c' || echo '$(srcdir)/'`modules/dbgfmts/dwarf2/dwarf2-line.c
+ mv -f $(DEPDIR)/dwarf2-line.Tpo $(DEPDIR)/dwarf2-line.Po
+# source='modules/dbgfmts/dwarf2/dwarf2-line.c' object='dwarf2-line.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dwarf2-line.o `test -f 'modules/dbgfmts/dwarf2/dwarf2-line.c' || echo '$(srcdir)/'`modules/dbgfmts/dwarf2/dwarf2-line.c
+
+dwarf2-line.obj: modules/dbgfmts/dwarf2/dwarf2-line.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dwarf2-line.obj -MD -MP -MF $(DEPDIR)/dwarf2-line.Tpo -c -o dwarf2-line.obj `if test -f 'modules/dbgfmts/dwarf2/dwarf2-line.c'; then $(CYGPATH_W) 'modules/dbgfmts/dwarf2/dwarf2-line.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/dwarf2/dwarf2-line.c'; fi`
+ mv -f $(DEPDIR)/dwarf2-line.Tpo $(DEPDIR)/dwarf2-line.Po
+# source='modules/dbgfmts/dwarf2/dwarf2-line.c' object='dwarf2-line.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dwarf2-line.obj `if test -f 'modules/dbgfmts/dwarf2/dwarf2-line.c'; then $(CYGPATH_W) 'modules/dbgfmts/dwarf2/dwarf2-line.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/dwarf2/dwarf2-line.c'; fi`
+
+dwarf2-aranges.o: modules/dbgfmts/dwarf2/dwarf2-aranges.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dwarf2-aranges.o -MD -MP -MF $(DEPDIR)/dwarf2-aranges.Tpo -c -o dwarf2-aranges.o `test -f 'modules/dbgfmts/dwarf2/dwarf2-aranges.c' || echo '$(srcdir)/'`modules/dbgfmts/dwarf2/dwarf2-aranges.c
+ mv -f $(DEPDIR)/dwarf2-aranges.Tpo $(DEPDIR)/dwarf2-aranges.Po
+# source='modules/dbgfmts/dwarf2/dwarf2-aranges.c' object='dwarf2-aranges.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dwarf2-aranges.o `test -f 'modules/dbgfmts/dwarf2/dwarf2-aranges.c' || echo '$(srcdir)/'`modules/dbgfmts/dwarf2/dwarf2-aranges.c
+
+dwarf2-aranges.obj: modules/dbgfmts/dwarf2/dwarf2-aranges.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dwarf2-aranges.obj -MD -MP -MF $(DEPDIR)/dwarf2-aranges.Tpo -c -o dwarf2-aranges.obj `if test -f 'modules/dbgfmts/dwarf2/dwarf2-aranges.c'; then $(CYGPATH_W) 'modules/dbgfmts/dwarf2/dwarf2-aranges.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/dwarf2/dwarf2-aranges.c'; fi`
+ mv -f $(DEPDIR)/dwarf2-aranges.Tpo $(DEPDIR)/dwarf2-aranges.Po
+# source='modules/dbgfmts/dwarf2/dwarf2-aranges.c' object='dwarf2-aranges.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dwarf2-aranges.obj `if test -f 'modules/dbgfmts/dwarf2/dwarf2-aranges.c'; then $(CYGPATH_W) 'modules/dbgfmts/dwarf2/dwarf2-aranges.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/dwarf2/dwarf2-aranges.c'; fi`
+
+dwarf2-info.o: modules/dbgfmts/dwarf2/dwarf2-info.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dwarf2-info.o -MD -MP -MF $(DEPDIR)/dwarf2-info.Tpo -c -o dwarf2-info.o `test -f 'modules/dbgfmts/dwarf2/dwarf2-info.c' || echo '$(srcdir)/'`modules/dbgfmts/dwarf2/dwarf2-info.c
+ mv -f $(DEPDIR)/dwarf2-info.Tpo $(DEPDIR)/dwarf2-info.Po
+# source='modules/dbgfmts/dwarf2/dwarf2-info.c' object='dwarf2-info.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dwarf2-info.o `test -f 'modules/dbgfmts/dwarf2/dwarf2-info.c' || echo '$(srcdir)/'`modules/dbgfmts/dwarf2/dwarf2-info.c
+
+dwarf2-info.obj: modules/dbgfmts/dwarf2/dwarf2-info.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dwarf2-info.obj -MD -MP -MF $(DEPDIR)/dwarf2-info.Tpo -c -o dwarf2-info.obj `if test -f 'modules/dbgfmts/dwarf2/dwarf2-info.c'; then $(CYGPATH_W) 'modules/dbgfmts/dwarf2/dwarf2-info.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/dwarf2/dwarf2-info.c'; fi`
+ mv -f $(DEPDIR)/dwarf2-info.Tpo $(DEPDIR)/dwarf2-info.Po
+# source='modules/dbgfmts/dwarf2/dwarf2-info.c' object='dwarf2-info.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dwarf2-info.obj `if test -f 'modules/dbgfmts/dwarf2/dwarf2-info.c'; then $(CYGPATH_W) 'modules/dbgfmts/dwarf2/dwarf2-info.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/dwarf2/dwarf2-info.c'; fi`
+
+null-dbgfmt.o: modules/dbgfmts/null/null-dbgfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT null-dbgfmt.o -MD -MP -MF $(DEPDIR)/null-dbgfmt.Tpo -c -o null-dbgfmt.o `test -f 'modules/dbgfmts/null/null-dbgfmt.c' || echo '$(srcdir)/'`modules/dbgfmts/null/null-dbgfmt.c
+ mv -f $(DEPDIR)/null-dbgfmt.Tpo $(DEPDIR)/null-dbgfmt.Po
+# source='modules/dbgfmts/null/null-dbgfmt.c' object='null-dbgfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o null-dbgfmt.o `test -f 'modules/dbgfmts/null/null-dbgfmt.c' || echo '$(srcdir)/'`modules/dbgfmts/null/null-dbgfmt.c
+
+null-dbgfmt.obj: modules/dbgfmts/null/null-dbgfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT null-dbgfmt.obj -MD -MP -MF $(DEPDIR)/null-dbgfmt.Tpo -c -o null-dbgfmt.obj `if test -f 'modules/dbgfmts/null/null-dbgfmt.c'; then $(CYGPATH_W) 'modules/dbgfmts/null/null-dbgfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/null/null-dbgfmt.c'; fi`
+ mv -f $(DEPDIR)/null-dbgfmt.Tpo $(DEPDIR)/null-dbgfmt.Po
+# source='modules/dbgfmts/null/null-dbgfmt.c' object='null-dbgfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o null-dbgfmt.obj `if test -f 'modules/dbgfmts/null/null-dbgfmt.c'; then $(CYGPATH_W) 'modules/dbgfmts/null/null-dbgfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/null/null-dbgfmt.c'; fi`
+
+stabs-dbgfmt.o: modules/dbgfmts/stabs/stabs-dbgfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT stabs-dbgfmt.o -MD -MP -MF $(DEPDIR)/stabs-dbgfmt.Tpo -c -o stabs-dbgfmt.o `test -f 'modules/dbgfmts/stabs/stabs-dbgfmt.c' || echo '$(srcdir)/'`modules/dbgfmts/stabs/stabs-dbgfmt.c
+ mv -f $(DEPDIR)/stabs-dbgfmt.Tpo $(DEPDIR)/stabs-dbgfmt.Po
+# source='modules/dbgfmts/stabs/stabs-dbgfmt.c' object='stabs-dbgfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o stabs-dbgfmt.o `test -f 'modules/dbgfmts/stabs/stabs-dbgfmt.c' || echo '$(srcdir)/'`modules/dbgfmts/stabs/stabs-dbgfmt.c
+
+stabs-dbgfmt.obj: modules/dbgfmts/stabs/stabs-dbgfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT stabs-dbgfmt.obj -MD -MP -MF $(DEPDIR)/stabs-dbgfmt.Tpo -c -o stabs-dbgfmt.obj `if test -f 'modules/dbgfmts/stabs/stabs-dbgfmt.c'; then $(CYGPATH_W) 'modules/dbgfmts/stabs/stabs-dbgfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/stabs/stabs-dbgfmt.c'; fi`
+ mv -f $(DEPDIR)/stabs-dbgfmt.Tpo $(DEPDIR)/stabs-dbgfmt.Po
+# source='modules/dbgfmts/stabs/stabs-dbgfmt.c' object='stabs-dbgfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o stabs-dbgfmt.obj `if test -f 'modules/dbgfmts/stabs/stabs-dbgfmt.c'; then $(CYGPATH_W) 'modules/dbgfmts/stabs/stabs-dbgfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/stabs/stabs-dbgfmt.c'; fi`
+
+dbg-objfmt.o: modules/objfmts/dbg/dbg-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dbg-objfmt.o -MD -MP -MF $(DEPDIR)/dbg-objfmt.Tpo -c -o dbg-objfmt.o `test -f 'modules/objfmts/dbg/dbg-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/dbg/dbg-objfmt.c
+ mv -f $(DEPDIR)/dbg-objfmt.Tpo $(DEPDIR)/dbg-objfmt.Po
+# source='modules/objfmts/dbg/dbg-objfmt.c' object='dbg-objfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dbg-objfmt.o `test -f 'modules/objfmts/dbg/dbg-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/dbg/dbg-objfmt.c
+
+dbg-objfmt.obj: modules/objfmts/dbg/dbg-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dbg-objfmt.obj -MD -MP -MF $(DEPDIR)/dbg-objfmt.Tpo -c -o dbg-objfmt.obj `if test -f 'modules/objfmts/dbg/dbg-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/dbg/dbg-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/dbg/dbg-objfmt.c'; fi`
+ mv -f $(DEPDIR)/dbg-objfmt.Tpo $(DEPDIR)/dbg-objfmt.Po
+# source='modules/objfmts/dbg/dbg-objfmt.c' object='dbg-objfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dbg-objfmt.obj `if test -f 'modules/objfmts/dbg/dbg-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/dbg/dbg-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/dbg/dbg-objfmt.c'; fi`
+
+bin-objfmt.o: modules/objfmts/bin/bin-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bin-objfmt.o -MD -MP -MF $(DEPDIR)/bin-objfmt.Tpo -c -o bin-objfmt.o `test -f 'modules/objfmts/bin/bin-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/bin/bin-objfmt.c
+ mv -f $(DEPDIR)/bin-objfmt.Tpo $(DEPDIR)/bin-objfmt.Po
+# source='modules/objfmts/bin/bin-objfmt.c' object='bin-objfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bin-objfmt.o `test -f 'modules/objfmts/bin/bin-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/bin/bin-objfmt.c
+
+bin-objfmt.obj: modules/objfmts/bin/bin-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bin-objfmt.obj -MD -MP -MF $(DEPDIR)/bin-objfmt.Tpo -c -o bin-objfmt.obj `if test -f 'modules/objfmts/bin/bin-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/bin/bin-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/bin/bin-objfmt.c'; fi`
+ mv -f $(DEPDIR)/bin-objfmt.Tpo $(DEPDIR)/bin-objfmt.Po
+# source='modules/objfmts/bin/bin-objfmt.c' object='bin-objfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bin-objfmt.obj `if test -f 'modules/objfmts/bin/bin-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/bin/bin-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/bin/bin-objfmt.c'; fi`
+
+elf.o: modules/objfmts/elf/elf.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT elf.o -MD -MP -MF $(DEPDIR)/elf.Tpo -c -o elf.o `test -f 'modules/objfmts/elf/elf.c' || echo '$(srcdir)/'`modules/objfmts/elf/elf.c
+ mv -f $(DEPDIR)/elf.Tpo $(DEPDIR)/elf.Po
+# source='modules/objfmts/elf/elf.c' object='elf.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o elf.o `test -f 'modules/objfmts/elf/elf.c' || echo '$(srcdir)/'`modules/objfmts/elf/elf.c
+
+elf.obj: modules/objfmts/elf/elf.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT elf.obj -MD -MP -MF $(DEPDIR)/elf.Tpo -c -o elf.obj `if test -f 'modules/objfmts/elf/elf.c'; then $(CYGPATH_W) 'modules/objfmts/elf/elf.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/elf/elf.c'; fi`
+ mv -f $(DEPDIR)/elf.Tpo $(DEPDIR)/elf.Po
+# source='modules/objfmts/elf/elf.c' object='elf.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o elf.obj `if test -f 'modules/objfmts/elf/elf.c'; then $(CYGPATH_W) 'modules/objfmts/elf/elf.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/elf/elf.c'; fi`
+
+elf-objfmt.o: modules/objfmts/elf/elf-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT elf-objfmt.o -MD -MP -MF $(DEPDIR)/elf-objfmt.Tpo -c -o elf-objfmt.o `test -f 'modules/objfmts/elf/elf-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/elf/elf-objfmt.c
+ mv -f $(DEPDIR)/elf-objfmt.Tpo $(DEPDIR)/elf-objfmt.Po
+# source='modules/objfmts/elf/elf-objfmt.c' object='elf-objfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o elf-objfmt.o `test -f 'modules/objfmts/elf/elf-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/elf/elf-objfmt.c
+
+elf-objfmt.obj: modules/objfmts/elf/elf-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT elf-objfmt.obj -MD -MP -MF $(DEPDIR)/elf-objfmt.Tpo -c -o elf-objfmt.obj `if test -f 'modules/objfmts/elf/elf-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/elf/elf-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/elf/elf-objfmt.c'; fi`
+ mv -f $(DEPDIR)/elf-objfmt.Tpo $(DEPDIR)/elf-objfmt.Po
+# source='modules/objfmts/elf/elf-objfmt.c' object='elf-objfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o elf-objfmt.obj `if test -f 'modules/objfmts/elf/elf-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/elf/elf-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/elf/elf-objfmt.c'; fi`
+
+elf-x86-x86.o: modules/objfmts/elf/elf-x86-x86.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT elf-x86-x86.o -MD -MP -MF $(DEPDIR)/elf-x86-x86.Tpo -c -o elf-x86-x86.o `test -f 'modules/objfmts/elf/elf-x86-x86.c' || echo '$(srcdir)/'`modules/objfmts/elf/elf-x86-x86.c
+ mv -f $(DEPDIR)/elf-x86-x86.Tpo $(DEPDIR)/elf-x86-x86.Po
+# source='modules/objfmts/elf/elf-x86-x86.c' object='elf-x86-x86.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o elf-x86-x86.o `test -f 'modules/objfmts/elf/elf-x86-x86.c' || echo '$(srcdir)/'`modules/objfmts/elf/elf-x86-x86.c
+
+elf-x86-x86.obj: modules/objfmts/elf/elf-x86-x86.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT elf-x86-x86.obj -MD -MP -MF $(DEPDIR)/elf-x86-x86.Tpo -c -o elf-x86-x86.obj `if test -f 'modules/objfmts/elf/elf-x86-x86.c'; then $(CYGPATH_W) 'modules/objfmts/elf/elf-x86-x86.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/elf/elf-x86-x86.c'; fi`
+ mv -f $(DEPDIR)/elf-x86-x86.Tpo $(DEPDIR)/elf-x86-x86.Po
+# source='modules/objfmts/elf/elf-x86-x86.c' object='elf-x86-x86.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o elf-x86-x86.obj `if test -f 'modules/objfmts/elf/elf-x86-x86.c'; then $(CYGPATH_W) 'modules/objfmts/elf/elf-x86-x86.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/elf/elf-x86-x86.c'; fi`
+
+elf-x86-amd64.o: modules/objfmts/elf/elf-x86-amd64.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT elf-x86-amd64.o -MD -MP -MF $(DEPDIR)/elf-x86-amd64.Tpo -c -o elf-x86-amd64.o `test -f 'modules/objfmts/elf/elf-x86-amd64.c' || echo '$(srcdir)/'`modules/objfmts/elf/elf-x86-amd64.c
+ mv -f $(DEPDIR)/elf-x86-amd64.Tpo $(DEPDIR)/elf-x86-amd64.Po
+# source='modules/objfmts/elf/elf-x86-amd64.c' object='elf-x86-amd64.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o elf-x86-amd64.o `test -f 'modules/objfmts/elf/elf-x86-amd64.c' || echo '$(srcdir)/'`modules/objfmts/elf/elf-x86-amd64.c
+
+elf-x86-amd64.obj: modules/objfmts/elf/elf-x86-amd64.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT elf-x86-amd64.obj -MD -MP -MF $(DEPDIR)/elf-x86-amd64.Tpo -c -o elf-x86-amd64.obj `if test -f 'modules/objfmts/elf/elf-x86-amd64.c'; then $(CYGPATH_W) 'modules/objfmts/elf/elf-x86-amd64.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/elf/elf-x86-amd64.c'; fi`
+ mv -f $(DEPDIR)/elf-x86-amd64.Tpo $(DEPDIR)/elf-x86-amd64.Po
+# source='modules/objfmts/elf/elf-x86-amd64.c' object='elf-x86-amd64.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o elf-x86-amd64.obj `if test -f 'modules/objfmts/elf/elf-x86-amd64.c'; then $(CYGPATH_W) 'modules/objfmts/elf/elf-x86-amd64.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/elf/elf-x86-amd64.c'; fi`
+
+coff-objfmt.o: modules/objfmts/coff/coff-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT coff-objfmt.o -MD -MP -MF $(DEPDIR)/coff-objfmt.Tpo -c -o coff-objfmt.o `test -f 'modules/objfmts/coff/coff-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/coff/coff-objfmt.c
+ mv -f $(DEPDIR)/coff-objfmt.Tpo $(DEPDIR)/coff-objfmt.Po
+# source='modules/objfmts/coff/coff-objfmt.c' object='coff-objfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o coff-objfmt.o `test -f 'modules/objfmts/coff/coff-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/coff/coff-objfmt.c
+
+coff-objfmt.obj: modules/objfmts/coff/coff-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT coff-objfmt.obj -MD -MP -MF $(DEPDIR)/coff-objfmt.Tpo -c -o coff-objfmt.obj `if test -f 'modules/objfmts/coff/coff-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/coff/coff-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/coff/coff-objfmt.c'; fi`
+ mv -f $(DEPDIR)/coff-objfmt.Tpo $(DEPDIR)/coff-objfmt.Po
+# source='modules/objfmts/coff/coff-objfmt.c' object='coff-objfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o coff-objfmt.obj `if test -f 'modules/objfmts/coff/coff-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/coff/coff-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/coff/coff-objfmt.c'; fi`
+
+win64-except.o: modules/objfmts/coff/win64-except.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT win64-except.o -MD -MP -MF $(DEPDIR)/win64-except.Tpo -c -o win64-except.o `test -f 'modules/objfmts/coff/win64-except.c' || echo '$(srcdir)/'`modules/objfmts/coff/win64-except.c
+ mv -f $(DEPDIR)/win64-except.Tpo $(DEPDIR)/win64-except.Po
+# source='modules/objfmts/coff/win64-except.c' object='win64-except.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o win64-except.o `test -f 'modules/objfmts/coff/win64-except.c' || echo '$(srcdir)/'`modules/objfmts/coff/win64-except.c
+
+win64-except.obj: modules/objfmts/coff/win64-except.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT win64-except.obj -MD -MP -MF $(DEPDIR)/win64-except.Tpo -c -o win64-except.obj `if test -f 'modules/objfmts/coff/win64-except.c'; then $(CYGPATH_W) 'modules/objfmts/coff/win64-except.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/coff/win64-except.c'; fi`
+ mv -f $(DEPDIR)/win64-except.Tpo $(DEPDIR)/win64-except.Po
+# source='modules/objfmts/coff/win64-except.c' object='win64-except.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o win64-except.obj `if test -f 'modules/objfmts/coff/win64-except.c'; then $(CYGPATH_W) 'modules/objfmts/coff/win64-except.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/coff/win64-except.c'; fi`
+
+macho-objfmt.o: modules/objfmts/macho/macho-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT macho-objfmt.o -MD -MP -MF $(DEPDIR)/macho-objfmt.Tpo -c -o macho-objfmt.o `test -f 'modules/objfmts/macho/macho-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/macho/macho-objfmt.c
+ mv -f $(DEPDIR)/macho-objfmt.Tpo $(DEPDIR)/macho-objfmt.Po
+# source='modules/objfmts/macho/macho-objfmt.c' object='macho-objfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o macho-objfmt.o `test -f 'modules/objfmts/macho/macho-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/macho/macho-objfmt.c
+
+macho-objfmt.obj: modules/objfmts/macho/macho-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT macho-objfmt.obj -MD -MP -MF $(DEPDIR)/macho-objfmt.Tpo -c -o macho-objfmt.obj `if test -f 'modules/objfmts/macho/macho-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/macho/macho-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/macho/macho-objfmt.c'; fi`
+ mv -f $(DEPDIR)/macho-objfmt.Tpo $(DEPDIR)/macho-objfmt.Po
+# source='modules/objfmts/macho/macho-objfmt.c' object='macho-objfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o macho-objfmt.obj `if test -f 'modules/objfmts/macho/macho-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/macho/macho-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/macho/macho-objfmt.c'; fi`
+
+rdf-objfmt.o: modules/objfmts/rdf/rdf-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rdf-objfmt.o -MD -MP -MF $(DEPDIR)/rdf-objfmt.Tpo -c -o rdf-objfmt.o `test -f 'modules/objfmts/rdf/rdf-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/rdf/rdf-objfmt.c
+ mv -f $(DEPDIR)/rdf-objfmt.Tpo $(DEPDIR)/rdf-objfmt.Po
+# source='modules/objfmts/rdf/rdf-objfmt.c' object='rdf-objfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rdf-objfmt.o `test -f 'modules/objfmts/rdf/rdf-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/rdf/rdf-objfmt.c
+
+rdf-objfmt.obj: modules/objfmts/rdf/rdf-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rdf-objfmt.obj -MD -MP -MF $(DEPDIR)/rdf-objfmt.Tpo -c -o rdf-objfmt.obj `if test -f 'modules/objfmts/rdf/rdf-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/rdf/rdf-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/rdf/rdf-objfmt.c'; fi`
+ mv -f $(DEPDIR)/rdf-objfmt.Tpo $(DEPDIR)/rdf-objfmt.Po
+# source='modules/objfmts/rdf/rdf-objfmt.c' object='rdf-objfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rdf-objfmt.obj `if test -f 'modules/objfmts/rdf/rdf-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/rdf/rdf-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/rdf/rdf-objfmt.c'; fi`
+
+xdf-objfmt.o: modules/objfmts/xdf/xdf-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xdf-objfmt.o -MD -MP -MF $(DEPDIR)/xdf-objfmt.Tpo -c -o xdf-objfmt.o `test -f 'modules/objfmts/xdf/xdf-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/xdf/xdf-objfmt.c
+ mv -f $(DEPDIR)/xdf-objfmt.Tpo $(DEPDIR)/xdf-objfmt.Po
+# source='modules/objfmts/xdf/xdf-objfmt.c' object='xdf-objfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xdf-objfmt.o `test -f 'modules/objfmts/xdf/xdf-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/xdf/xdf-objfmt.c
+
+xdf-objfmt.obj: modules/objfmts/xdf/xdf-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xdf-objfmt.obj -MD -MP -MF $(DEPDIR)/xdf-objfmt.Tpo -c -o xdf-objfmt.obj `if test -f 'modules/objfmts/xdf/xdf-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/xdf/xdf-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/xdf/xdf-objfmt.c'; fi`
+ mv -f $(DEPDIR)/xdf-objfmt.Tpo $(DEPDIR)/xdf-objfmt.Po
+# source='modules/objfmts/xdf/xdf-objfmt.c' object='xdf-objfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xdf-objfmt.obj `if test -f 'modules/objfmts/xdf/xdf-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/xdf/xdf-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/xdf/xdf-objfmt.c'; fi`
+
+assocdat.o: libyasm/assocdat.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT assocdat.o -MD -MP -MF $(DEPDIR)/assocdat.Tpo -c -o assocdat.o `test -f 'libyasm/assocdat.c' || echo '$(srcdir)/'`libyasm/assocdat.c
+ mv -f $(DEPDIR)/assocdat.Tpo $(DEPDIR)/assocdat.Po
+# source='libyasm/assocdat.c' object='assocdat.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o assocdat.o `test -f 'libyasm/assocdat.c' || echo '$(srcdir)/'`libyasm/assocdat.c
+
+assocdat.obj: libyasm/assocdat.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT assocdat.obj -MD -MP -MF $(DEPDIR)/assocdat.Tpo -c -o assocdat.obj `if test -f 'libyasm/assocdat.c'; then $(CYGPATH_W) 'libyasm/assocdat.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/assocdat.c'; fi`
+ mv -f $(DEPDIR)/assocdat.Tpo $(DEPDIR)/assocdat.Po
+# source='libyasm/assocdat.c' object='assocdat.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o assocdat.obj `if test -f 'libyasm/assocdat.c'; then $(CYGPATH_W) 'libyasm/assocdat.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/assocdat.c'; fi`
+
+bitvect.o: libyasm/bitvect.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bitvect.o -MD -MP -MF $(DEPDIR)/bitvect.Tpo -c -o bitvect.o `test -f 'libyasm/bitvect.c' || echo '$(srcdir)/'`libyasm/bitvect.c
+ mv -f $(DEPDIR)/bitvect.Tpo $(DEPDIR)/bitvect.Po
+# source='libyasm/bitvect.c' object='bitvect.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bitvect.o `test -f 'libyasm/bitvect.c' || echo '$(srcdir)/'`libyasm/bitvect.c
+
+bitvect.obj: libyasm/bitvect.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bitvect.obj -MD -MP -MF $(DEPDIR)/bitvect.Tpo -c -o bitvect.obj `if test -f 'libyasm/bitvect.c'; then $(CYGPATH_W) 'libyasm/bitvect.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bitvect.c'; fi`
+ mv -f $(DEPDIR)/bitvect.Tpo $(DEPDIR)/bitvect.Po
+# source='libyasm/bitvect.c' object='bitvect.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bitvect.obj `if test -f 'libyasm/bitvect.c'; then $(CYGPATH_W) 'libyasm/bitvect.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bitvect.c'; fi`
+
+bc-align.o: libyasm/bc-align.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bc-align.o -MD -MP -MF $(DEPDIR)/bc-align.Tpo -c -o bc-align.o `test -f 'libyasm/bc-align.c' || echo '$(srcdir)/'`libyasm/bc-align.c
+ mv -f $(DEPDIR)/bc-align.Tpo $(DEPDIR)/bc-align.Po
+# source='libyasm/bc-align.c' object='bc-align.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bc-align.o `test -f 'libyasm/bc-align.c' || echo '$(srcdir)/'`libyasm/bc-align.c
+
+bc-align.obj: libyasm/bc-align.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bc-align.obj -MD -MP -MF $(DEPDIR)/bc-align.Tpo -c -o bc-align.obj `if test -f 'libyasm/bc-align.c'; then $(CYGPATH_W) 'libyasm/bc-align.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bc-align.c'; fi`
+ mv -f $(DEPDIR)/bc-align.Tpo $(DEPDIR)/bc-align.Po
+# source='libyasm/bc-align.c' object='bc-align.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bc-align.obj `if test -f 'libyasm/bc-align.c'; then $(CYGPATH_W) 'libyasm/bc-align.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bc-align.c'; fi`
+
+bc-data.o: libyasm/bc-data.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bc-data.o -MD -MP -MF $(DEPDIR)/bc-data.Tpo -c -o bc-data.o `test -f 'libyasm/bc-data.c' || echo '$(srcdir)/'`libyasm/bc-data.c
+ mv -f $(DEPDIR)/bc-data.Tpo $(DEPDIR)/bc-data.Po
+# source='libyasm/bc-data.c' object='bc-data.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bc-data.o `test -f 'libyasm/bc-data.c' || echo '$(srcdir)/'`libyasm/bc-data.c
+
+bc-data.obj: libyasm/bc-data.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bc-data.obj -MD -MP -MF $(DEPDIR)/bc-data.Tpo -c -o bc-data.obj `if test -f 'libyasm/bc-data.c'; then $(CYGPATH_W) 'libyasm/bc-data.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bc-data.c'; fi`
+ mv -f $(DEPDIR)/bc-data.Tpo $(DEPDIR)/bc-data.Po
+# source='libyasm/bc-data.c' object='bc-data.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bc-data.obj `if test -f 'libyasm/bc-data.c'; then $(CYGPATH_W) 'libyasm/bc-data.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bc-data.c'; fi`
+
+bc-incbin.o: libyasm/bc-incbin.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bc-incbin.o -MD -MP -MF $(DEPDIR)/bc-incbin.Tpo -c -o bc-incbin.o `test -f 'libyasm/bc-incbin.c' || echo '$(srcdir)/'`libyasm/bc-incbin.c
+ mv -f $(DEPDIR)/bc-incbin.Tpo $(DEPDIR)/bc-incbin.Po
+# source='libyasm/bc-incbin.c' object='bc-incbin.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bc-incbin.o `test -f 'libyasm/bc-incbin.c' || echo '$(srcdir)/'`libyasm/bc-incbin.c
+
+bc-incbin.obj: libyasm/bc-incbin.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bc-incbin.obj -MD -MP -MF $(DEPDIR)/bc-incbin.Tpo -c -o bc-incbin.obj `if test -f 'libyasm/bc-incbin.c'; then $(CYGPATH_W) 'libyasm/bc-incbin.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bc-incbin.c'; fi`
+ mv -f $(DEPDIR)/bc-incbin.Tpo $(DEPDIR)/bc-incbin.Po
+# source='libyasm/bc-incbin.c' object='bc-incbin.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bc-incbin.obj `if test -f 'libyasm/bc-incbin.c'; then $(CYGPATH_W) 'libyasm/bc-incbin.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bc-incbin.c'; fi`
+
+bc-org.o: libyasm/bc-org.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bc-org.o -MD -MP -MF $(DEPDIR)/bc-org.Tpo -c -o bc-org.o `test -f 'libyasm/bc-org.c' || echo '$(srcdir)/'`libyasm/bc-org.c
+ mv -f $(DEPDIR)/bc-org.Tpo $(DEPDIR)/bc-org.Po
+# source='libyasm/bc-org.c' object='bc-org.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bc-org.o `test -f 'libyasm/bc-org.c' || echo '$(srcdir)/'`libyasm/bc-org.c
+
+bc-org.obj: libyasm/bc-org.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bc-org.obj -MD -MP -MF $(DEPDIR)/bc-org.Tpo -c -o bc-org.obj `if test -f 'libyasm/bc-org.c'; then $(CYGPATH_W) 'libyasm/bc-org.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bc-org.c'; fi`
+ mv -f $(DEPDIR)/bc-org.Tpo $(DEPDIR)/bc-org.Po
+# source='libyasm/bc-org.c' object='bc-org.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bc-org.obj `if test -f 'libyasm/bc-org.c'; then $(CYGPATH_W) 'libyasm/bc-org.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bc-org.c'; fi`
+
+bc-reserve.o: libyasm/bc-reserve.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bc-reserve.o -MD -MP -MF $(DEPDIR)/bc-reserve.Tpo -c -o bc-reserve.o `test -f 'libyasm/bc-reserve.c' || echo '$(srcdir)/'`libyasm/bc-reserve.c
+ mv -f $(DEPDIR)/bc-reserve.Tpo $(DEPDIR)/bc-reserve.Po
+# source='libyasm/bc-reserve.c' object='bc-reserve.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bc-reserve.o `test -f 'libyasm/bc-reserve.c' || echo '$(srcdir)/'`libyasm/bc-reserve.c
+
+bc-reserve.obj: libyasm/bc-reserve.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bc-reserve.obj -MD -MP -MF $(DEPDIR)/bc-reserve.Tpo -c -o bc-reserve.obj `if test -f 'libyasm/bc-reserve.c'; then $(CYGPATH_W) 'libyasm/bc-reserve.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bc-reserve.c'; fi`
+ mv -f $(DEPDIR)/bc-reserve.Tpo $(DEPDIR)/bc-reserve.Po
+# source='libyasm/bc-reserve.c' object='bc-reserve.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bc-reserve.obj `if test -f 'libyasm/bc-reserve.c'; then $(CYGPATH_W) 'libyasm/bc-reserve.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bc-reserve.c'; fi`
+
+bytecode.o: libyasm/bytecode.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bytecode.o -MD -MP -MF $(DEPDIR)/bytecode.Tpo -c -o bytecode.o `test -f 'libyasm/bytecode.c' || echo '$(srcdir)/'`libyasm/bytecode.c
+ mv -f $(DEPDIR)/bytecode.Tpo $(DEPDIR)/bytecode.Po
+# source='libyasm/bytecode.c' object='bytecode.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bytecode.o `test -f 'libyasm/bytecode.c' || echo '$(srcdir)/'`libyasm/bytecode.c
+
+bytecode.obj: libyasm/bytecode.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bytecode.obj -MD -MP -MF $(DEPDIR)/bytecode.Tpo -c -o bytecode.obj `if test -f 'libyasm/bytecode.c'; then $(CYGPATH_W) 'libyasm/bytecode.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bytecode.c'; fi`
+ mv -f $(DEPDIR)/bytecode.Tpo $(DEPDIR)/bytecode.Po
+# source='libyasm/bytecode.c' object='bytecode.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bytecode.obj `if test -f 'libyasm/bytecode.c'; then $(CYGPATH_W) 'libyasm/bytecode.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bytecode.c'; fi`
+
+errwarn.o: libyasm/errwarn.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT errwarn.o -MD -MP -MF $(DEPDIR)/errwarn.Tpo -c -o errwarn.o `test -f 'libyasm/errwarn.c' || echo '$(srcdir)/'`libyasm/errwarn.c
+ mv -f $(DEPDIR)/errwarn.Tpo $(DEPDIR)/errwarn.Po
+# source='libyasm/errwarn.c' object='errwarn.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o errwarn.o `test -f 'libyasm/errwarn.c' || echo '$(srcdir)/'`libyasm/errwarn.c
+
+errwarn.obj: libyasm/errwarn.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT errwarn.obj -MD -MP -MF $(DEPDIR)/errwarn.Tpo -c -o errwarn.obj `if test -f 'libyasm/errwarn.c'; then $(CYGPATH_W) 'libyasm/errwarn.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/errwarn.c'; fi`
+ mv -f $(DEPDIR)/errwarn.Tpo $(DEPDIR)/errwarn.Po
+# source='libyasm/errwarn.c' object='errwarn.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o errwarn.obj `if test -f 'libyasm/errwarn.c'; then $(CYGPATH_W) 'libyasm/errwarn.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/errwarn.c'; fi`
+
+expr.o: libyasm/expr.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT expr.o -MD -MP -MF $(DEPDIR)/expr.Tpo -c -o expr.o `test -f 'libyasm/expr.c' || echo '$(srcdir)/'`libyasm/expr.c
+ mv -f $(DEPDIR)/expr.Tpo $(DEPDIR)/expr.Po
+# source='libyasm/expr.c' object='expr.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o expr.o `test -f 'libyasm/expr.c' || echo '$(srcdir)/'`libyasm/expr.c
+
+expr.obj: libyasm/expr.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT expr.obj -MD -MP -MF $(DEPDIR)/expr.Tpo -c -o expr.obj `if test -f 'libyasm/expr.c'; then $(CYGPATH_W) 'libyasm/expr.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/expr.c'; fi`
+ mv -f $(DEPDIR)/expr.Tpo $(DEPDIR)/expr.Po
+# source='libyasm/expr.c' object='expr.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o expr.obj `if test -f 'libyasm/expr.c'; then $(CYGPATH_W) 'libyasm/expr.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/expr.c'; fi`
+
+file.o: libyasm/file.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT file.o -MD -MP -MF $(DEPDIR)/file.Tpo -c -o file.o `test -f 'libyasm/file.c' || echo '$(srcdir)/'`libyasm/file.c
+ mv -f $(DEPDIR)/file.Tpo $(DEPDIR)/file.Po
+# source='libyasm/file.c' object='file.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o file.o `test -f 'libyasm/file.c' || echo '$(srcdir)/'`libyasm/file.c
+
+file.obj: libyasm/file.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT file.obj -MD -MP -MF $(DEPDIR)/file.Tpo -c -o file.obj `if test -f 'libyasm/file.c'; then $(CYGPATH_W) 'libyasm/file.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/file.c'; fi`
+ mv -f $(DEPDIR)/file.Tpo $(DEPDIR)/file.Po
+# source='libyasm/file.c' object='file.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o file.obj `if test -f 'libyasm/file.c'; then $(CYGPATH_W) 'libyasm/file.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/file.c'; fi`
+
+floatnum.o: libyasm/floatnum.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT floatnum.o -MD -MP -MF $(DEPDIR)/floatnum.Tpo -c -o floatnum.o `test -f 'libyasm/floatnum.c' || echo '$(srcdir)/'`libyasm/floatnum.c
+ mv -f $(DEPDIR)/floatnum.Tpo $(DEPDIR)/floatnum.Po
+# source='libyasm/floatnum.c' object='floatnum.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o floatnum.o `test -f 'libyasm/floatnum.c' || echo '$(srcdir)/'`libyasm/floatnum.c
+
+floatnum.obj: libyasm/floatnum.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT floatnum.obj -MD -MP -MF $(DEPDIR)/floatnum.Tpo -c -o floatnum.obj `if test -f 'libyasm/floatnum.c'; then $(CYGPATH_W) 'libyasm/floatnum.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/floatnum.c'; fi`
+ mv -f $(DEPDIR)/floatnum.Tpo $(DEPDIR)/floatnum.Po
+# source='libyasm/floatnum.c' object='floatnum.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o floatnum.obj `if test -f 'libyasm/floatnum.c'; then $(CYGPATH_W) 'libyasm/floatnum.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/floatnum.c'; fi`
+
+hamt.o: libyasm/hamt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT hamt.o -MD -MP -MF $(DEPDIR)/hamt.Tpo -c -o hamt.o `test -f 'libyasm/hamt.c' || echo '$(srcdir)/'`libyasm/hamt.c
+ mv -f $(DEPDIR)/hamt.Tpo $(DEPDIR)/hamt.Po
+# source='libyasm/hamt.c' object='hamt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o hamt.o `test -f 'libyasm/hamt.c' || echo '$(srcdir)/'`libyasm/hamt.c
+
+hamt.obj: libyasm/hamt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT hamt.obj -MD -MP -MF $(DEPDIR)/hamt.Tpo -c -o hamt.obj `if test -f 'libyasm/hamt.c'; then $(CYGPATH_W) 'libyasm/hamt.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/hamt.c'; fi`
+ mv -f $(DEPDIR)/hamt.Tpo $(DEPDIR)/hamt.Po
+# source='libyasm/hamt.c' object='hamt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o hamt.obj `if test -f 'libyasm/hamt.c'; then $(CYGPATH_W) 'libyasm/hamt.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/hamt.c'; fi`
+
+insn.o: libyasm/insn.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT insn.o -MD -MP -MF $(DEPDIR)/insn.Tpo -c -o insn.o `test -f 'libyasm/insn.c' || echo '$(srcdir)/'`libyasm/insn.c
+ mv -f $(DEPDIR)/insn.Tpo $(DEPDIR)/insn.Po
+# source='libyasm/insn.c' object='insn.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o insn.o `test -f 'libyasm/insn.c' || echo '$(srcdir)/'`libyasm/insn.c
+
+insn.obj: libyasm/insn.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT insn.obj -MD -MP -MF $(DEPDIR)/insn.Tpo -c -o insn.obj `if test -f 'libyasm/insn.c'; then $(CYGPATH_W) 'libyasm/insn.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/insn.c'; fi`
+ mv -f $(DEPDIR)/insn.Tpo $(DEPDIR)/insn.Po
+# source='libyasm/insn.c' object='insn.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o insn.obj `if test -f 'libyasm/insn.c'; then $(CYGPATH_W) 'libyasm/insn.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/insn.c'; fi`
+
+intnum.o: libyasm/intnum.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT intnum.o -MD -MP -MF $(DEPDIR)/intnum.Tpo -c -o intnum.o `test -f 'libyasm/intnum.c' || echo '$(srcdir)/'`libyasm/intnum.c
+ mv -f $(DEPDIR)/intnum.Tpo $(DEPDIR)/intnum.Po
+# source='libyasm/intnum.c' object='intnum.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o intnum.o `test -f 'libyasm/intnum.c' || echo '$(srcdir)/'`libyasm/intnum.c
+
+intnum.obj: libyasm/intnum.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT intnum.obj -MD -MP -MF $(DEPDIR)/intnum.Tpo -c -o intnum.obj `if test -f 'libyasm/intnum.c'; then $(CYGPATH_W) 'libyasm/intnum.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/intnum.c'; fi`
+ mv -f $(DEPDIR)/intnum.Tpo $(DEPDIR)/intnum.Po
+# source='libyasm/intnum.c' object='intnum.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o intnum.obj `if test -f 'libyasm/intnum.c'; then $(CYGPATH_W) 'libyasm/intnum.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/intnum.c'; fi`
+
+inttree.o: libyasm/inttree.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT inttree.o -MD -MP -MF $(DEPDIR)/inttree.Tpo -c -o inttree.o `test -f 'libyasm/inttree.c' || echo '$(srcdir)/'`libyasm/inttree.c
+ mv -f $(DEPDIR)/inttree.Tpo $(DEPDIR)/inttree.Po
+# source='libyasm/inttree.c' object='inttree.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o inttree.o `test -f 'libyasm/inttree.c' || echo '$(srcdir)/'`libyasm/inttree.c
+
+inttree.obj: libyasm/inttree.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT inttree.obj -MD -MP -MF $(DEPDIR)/inttree.Tpo -c -o inttree.obj `if test -f 'libyasm/inttree.c'; then $(CYGPATH_W) 'libyasm/inttree.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/inttree.c'; fi`
+ mv -f $(DEPDIR)/inttree.Tpo $(DEPDIR)/inttree.Po
+# source='libyasm/inttree.c' object='inttree.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o inttree.obj `if test -f 'libyasm/inttree.c'; then $(CYGPATH_W) 'libyasm/inttree.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/inttree.c'; fi`
+
+linemap.o: libyasm/linemap.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT linemap.o -MD -MP -MF $(DEPDIR)/linemap.Tpo -c -o linemap.o `test -f 'libyasm/linemap.c' || echo '$(srcdir)/'`libyasm/linemap.c
+ mv -f $(DEPDIR)/linemap.Tpo $(DEPDIR)/linemap.Po
+# source='libyasm/linemap.c' object='linemap.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o linemap.o `test -f 'libyasm/linemap.c' || echo '$(srcdir)/'`libyasm/linemap.c
+
+linemap.obj: libyasm/linemap.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT linemap.obj -MD -MP -MF $(DEPDIR)/linemap.Tpo -c -o linemap.obj `if test -f 'libyasm/linemap.c'; then $(CYGPATH_W) 'libyasm/linemap.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/linemap.c'; fi`
+ mv -f $(DEPDIR)/linemap.Tpo $(DEPDIR)/linemap.Po
+# source='libyasm/linemap.c' object='linemap.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o linemap.obj `if test -f 'libyasm/linemap.c'; then $(CYGPATH_W) 'libyasm/linemap.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/linemap.c'; fi`
+
+md5.o: libyasm/md5.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT md5.o -MD -MP -MF $(DEPDIR)/md5.Tpo -c -o md5.o `test -f 'libyasm/md5.c' || echo '$(srcdir)/'`libyasm/md5.c
+ mv -f $(DEPDIR)/md5.Tpo $(DEPDIR)/md5.Po
+# source='libyasm/md5.c' object='md5.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o md5.o `test -f 'libyasm/md5.c' || echo '$(srcdir)/'`libyasm/md5.c
+
+md5.obj: libyasm/md5.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT md5.obj -MD -MP -MF $(DEPDIR)/md5.Tpo -c -o md5.obj `if test -f 'libyasm/md5.c'; then $(CYGPATH_W) 'libyasm/md5.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/md5.c'; fi`
+ mv -f $(DEPDIR)/md5.Tpo $(DEPDIR)/md5.Po
+# source='libyasm/md5.c' object='md5.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o md5.obj `if test -f 'libyasm/md5.c'; then $(CYGPATH_W) 'libyasm/md5.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/md5.c'; fi`
+
+mergesort.o: libyasm/mergesort.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mergesort.o -MD -MP -MF $(DEPDIR)/mergesort.Tpo -c -o mergesort.o `test -f 'libyasm/mergesort.c' || echo '$(srcdir)/'`libyasm/mergesort.c
+ mv -f $(DEPDIR)/mergesort.Tpo $(DEPDIR)/mergesort.Po
+# source='libyasm/mergesort.c' object='mergesort.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mergesort.o `test -f 'libyasm/mergesort.c' || echo '$(srcdir)/'`libyasm/mergesort.c
+
+mergesort.obj: libyasm/mergesort.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mergesort.obj -MD -MP -MF $(DEPDIR)/mergesort.Tpo -c -o mergesort.obj `if test -f 'libyasm/mergesort.c'; then $(CYGPATH_W) 'libyasm/mergesort.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/mergesort.c'; fi`
+ mv -f $(DEPDIR)/mergesort.Tpo $(DEPDIR)/mergesort.Po
+# source='libyasm/mergesort.c' object='mergesort.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mergesort.obj `if test -f 'libyasm/mergesort.c'; then $(CYGPATH_W) 'libyasm/mergesort.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/mergesort.c'; fi`
+
+phash.o: libyasm/phash.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT phash.o -MD -MP -MF $(DEPDIR)/phash.Tpo -c -o phash.o `test -f 'libyasm/phash.c' || echo '$(srcdir)/'`libyasm/phash.c
+ mv -f $(DEPDIR)/phash.Tpo $(DEPDIR)/phash.Po
+# source='libyasm/phash.c' object='phash.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o phash.o `test -f 'libyasm/phash.c' || echo '$(srcdir)/'`libyasm/phash.c
+
+phash.obj: libyasm/phash.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT phash.obj -MD -MP -MF $(DEPDIR)/phash.Tpo -c -o phash.obj `if test -f 'libyasm/phash.c'; then $(CYGPATH_W) 'libyasm/phash.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/phash.c'; fi`
+ mv -f $(DEPDIR)/phash.Tpo $(DEPDIR)/phash.Po
+# source='libyasm/phash.c' object='phash.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o phash.obj `if test -f 'libyasm/phash.c'; then $(CYGPATH_W) 'libyasm/phash.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/phash.c'; fi`
+
+section.o: libyasm/section.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT section.o -MD -MP -MF $(DEPDIR)/section.Tpo -c -o section.o `test -f 'libyasm/section.c' || echo '$(srcdir)/'`libyasm/section.c
+ mv -f $(DEPDIR)/section.Tpo $(DEPDIR)/section.Po
+# source='libyasm/section.c' object='section.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o section.o `test -f 'libyasm/section.c' || echo '$(srcdir)/'`libyasm/section.c
+
+section.obj: libyasm/section.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT section.obj -MD -MP -MF $(DEPDIR)/section.Tpo -c -o section.obj `if test -f 'libyasm/section.c'; then $(CYGPATH_W) 'libyasm/section.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/section.c'; fi`
+ mv -f $(DEPDIR)/section.Tpo $(DEPDIR)/section.Po
+# source='libyasm/section.c' object='section.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o section.obj `if test -f 'libyasm/section.c'; then $(CYGPATH_W) 'libyasm/section.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/section.c'; fi`
+
+strcasecmp.o: libyasm/strcasecmp.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT strcasecmp.o -MD -MP -MF $(DEPDIR)/strcasecmp.Tpo -c -o strcasecmp.o `test -f 'libyasm/strcasecmp.c' || echo '$(srcdir)/'`libyasm/strcasecmp.c
+ mv -f $(DEPDIR)/strcasecmp.Tpo $(DEPDIR)/strcasecmp.Po
+# source='libyasm/strcasecmp.c' object='strcasecmp.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o strcasecmp.o `test -f 'libyasm/strcasecmp.c' || echo '$(srcdir)/'`libyasm/strcasecmp.c
+
+strcasecmp.obj: libyasm/strcasecmp.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT strcasecmp.obj -MD -MP -MF $(DEPDIR)/strcasecmp.Tpo -c -o strcasecmp.obj `if test -f 'libyasm/strcasecmp.c'; then $(CYGPATH_W) 'libyasm/strcasecmp.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/strcasecmp.c'; fi`
+ mv -f $(DEPDIR)/strcasecmp.Tpo $(DEPDIR)/strcasecmp.Po
+# source='libyasm/strcasecmp.c' object='strcasecmp.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o strcasecmp.obj `if test -f 'libyasm/strcasecmp.c'; then $(CYGPATH_W) 'libyasm/strcasecmp.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/strcasecmp.c'; fi`
+
+strsep.o: libyasm/strsep.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT strsep.o -MD -MP -MF $(DEPDIR)/strsep.Tpo -c -o strsep.o `test -f 'libyasm/strsep.c' || echo '$(srcdir)/'`libyasm/strsep.c
+ mv -f $(DEPDIR)/strsep.Tpo $(DEPDIR)/strsep.Po
+# source='libyasm/strsep.c' object='strsep.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o strsep.o `test -f 'libyasm/strsep.c' || echo '$(srcdir)/'`libyasm/strsep.c
+
+strsep.obj: libyasm/strsep.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT strsep.obj -MD -MP -MF $(DEPDIR)/strsep.Tpo -c -o strsep.obj `if test -f 'libyasm/strsep.c'; then $(CYGPATH_W) 'libyasm/strsep.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/strsep.c'; fi`
+ mv -f $(DEPDIR)/strsep.Tpo $(DEPDIR)/strsep.Po
+# source='libyasm/strsep.c' object='strsep.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o strsep.obj `if test -f 'libyasm/strsep.c'; then $(CYGPATH_W) 'libyasm/strsep.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/strsep.c'; fi`
+
+symrec.o: libyasm/symrec.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT symrec.o -MD -MP -MF $(DEPDIR)/symrec.Tpo -c -o symrec.o `test -f 'libyasm/symrec.c' || echo '$(srcdir)/'`libyasm/symrec.c
+ mv -f $(DEPDIR)/symrec.Tpo $(DEPDIR)/symrec.Po
+# source='libyasm/symrec.c' object='symrec.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o symrec.o `test -f 'libyasm/symrec.c' || echo '$(srcdir)/'`libyasm/symrec.c
+
+symrec.obj: libyasm/symrec.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT symrec.obj -MD -MP -MF $(DEPDIR)/symrec.Tpo -c -o symrec.obj `if test -f 'libyasm/symrec.c'; then $(CYGPATH_W) 'libyasm/symrec.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/symrec.c'; fi`
+ mv -f $(DEPDIR)/symrec.Tpo $(DEPDIR)/symrec.Po
+# source='libyasm/symrec.c' object='symrec.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o symrec.obj `if test -f 'libyasm/symrec.c'; then $(CYGPATH_W) 'libyasm/symrec.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/symrec.c'; fi`
+
+valparam.o: libyasm/valparam.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT valparam.o -MD -MP -MF $(DEPDIR)/valparam.Tpo -c -o valparam.o `test -f 'libyasm/valparam.c' || echo '$(srcdir)/'`libyasm/valparam.c
+ mv -f $(DEPDIR)/valparam.Tpo $(DEPDIR)/valparam.Po
+# source='libyasm/valparam.c' object='valparam.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o valparam.o `test -f 'libyasm/valparam.c' || echo '$(srcdir)/'`libyasm/valparam.c
+
+valparam.obj: libyasm/valparam.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT valparam.obj -MD -MP -MF $(DEPDIR)/valparam.Tpo -c -o valparam.obj `if test -f 'libyasm/valparam.c'; then $(CYGPATH_W) 'libyasm/valparam.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/valparam.c'; fi`
+ mv -f $(DEPDIR)/valparam.Tpo $(DEPDIR)/valparam.Po
+# source='libyasm/valparam.c' object='valparam.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o valparam.obj `if test -f 'libyasm/valparam.c'; then $(CYGPATH_W) 'libyasm/valparam.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/valparam.c'; fi`
+
+value.o: libyasm/value.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT value.o -MD -MP -MF $(DEPDIR)/value.Tpo -c -o value.o `test -f 'libyasm/value.c' || echo '$(srcdir)/'`libyasm/value.c
+ mv -f $(DEPDIR)/value.Tpo $(DEPDIR)/value.Po
+# source='libyasm/value.c' object='value.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o value.o `test -f 'libyasm/value.c' || echo '$(srcdir)/'`libyasm/value.c
+
+value.obj: libyasm/value.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT value.obj -MD -MP -MF $(DEPDIR)/value.Tpo -c -o value.obj `if test -f 'libyasm/value.c'; then $(CYGPATH_W) 'libyasm/value.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/value.c'; fi`
+ mv -f $(DEPDIR)/value.Tpo $(DEPDIR)/value.Po
+# source='libyasm/value.c' object='value.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o value.obj `if test -f 'libyasm/value.c'; then $(CYGPATH_W) 'libyasm/value.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/value.c'; fi`
+
+xmalloc.o: libyasm/xmalloc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xmalloc.o -MD -MP -MF $(DEPDIR)/xmalloc.Tpo -c -o xmalloc.o `test -f 'libyasm/xmalloc.c' || echo '$(srcdir)/'`libyasm/xmalloc.c
+ mv -f $(DEPDIR)/xmalloc.Tpo $(DEPDIR)/xmalloc.Po
+# source='libyasm/xmalloc.c' object='xmalloc.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xmalloc.o `test -f 'libyasm/xmalloc.c' || echo '$(srcdir)/'`libyasm/xmalloc.c
+
+xmalloc.obj: libyasm/xmalloc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xmalloc.obj -MD -MP -MF $(DEPDIR)/xmalloc.Tpo -c -o xmalloc.obj `if test -f 'libyasm/xmalloc.c'; then $(CYGPATH_W) 'libyasm/xmalloc.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/xmalloc.c'; fi`
+ mv -f $(DEPDIR)/xmalloc.Tpo $(DEPDIR)/xmalloc.Po
+# source='libyasm/xmalloc.c' object='xmalloc.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xmalloc.obj `if test -f 'libyasm/xmalloc.c'; then $(CYGPATH_W) 'libyasm/xmalloc.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/xmalloc.c'; fi`
+
+xstrdup.o: libyasm/xstrdup.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xstrdup.o -MD -MP -MF $(DEPDIR)/xstrdup.Tpo -c -o xstrdup.o `test -f 'libyasm/xstrdup.c' || echo '$(srcdir)/'`libyasm/xstrdup.c
+ mv -f $(DEPDIR)/xstrdup.Tpo $(DEPDIR)/xstrdup.Po
+# source='libyasm/xstrdup.c' object='xstrdup.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xstrdup.o `test -f 'libyasm/xstrdup.c' || echo '$(srcdir)/'`libyasm/xstrdup.c
+
+xstrdup.obj: libyasm/xstrdup.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xstrdup.obj -MD -MP -MF $(DEPDIR)/xstrdup.Tpo -c -o xstrdup.obj `if test -f 'libyasm/xstrdup.c'; then $(CYGPATH_W) 'libyasm/xstrdup.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/xstrdup.c'; fi`
+ mv -f $(DEPDIR)/xstrdup.Tpo $(DEPDIR)/xstrdup.Po
+# source='libyasm/xstrdup.c' object='xstrdup.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xstrdup.obj `if test -f 'libyasm/xstrdup.c'; then $(CYGPATH_W) 'libyasm/xstrdup.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/xstrdup.c'; fi`
+
+bitvect_test.o: libyasm/tests/bitvect_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bitvect_test.o -MD -MP -MF $(DEPDIR)/bitvect_test.Tpo -c -o bitvect_test.o `test -f 'libyasm/tests/bitvect_test.c' || echo '$(srcdir)/'`libyasm/tests/bitvect_test.c
+ mv -f $(DEPDIR)/bitvect_test.Tpo $(DEPDIR)/bitvect_test.Po
+# source='libyasm/tests/bitvect_test.c' object='bitvect_test.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bitvect_test.o `test -f 'libyasm/tests/bitvect_test.c' || echo '$(srcdir)/'`libyasm/tests/bitvect_test.c
+
+bitvect_test.obj: libyasm/tests/bitvect_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bitvect_test.obj -MD -MP -MF $(DEPDIR)/bitvect_test.Tpo -c -o bitvect_test.obj `if test -f 'libyasm/tests/bitvect_test.c'; then $(CYGPATH_W) 'libyasm/tests/bitvect_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/bitvect_test.c'; fi`
+ mv -f $(DEPDIR)/bitvect_test.Tpo $(DEPDIR)/bitvect_test.Po
+# source='libyasm/tests/bitvect_test.c' object='bitvect_test.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bitvect_test.obj `if test -f 'libyasm/tests/bitvect_test.c'; then $(CYGPATH_W) 'libyasm/tests/bitvect_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/bitvect_test.c'; fi`
+
+combpath_test.o: libyasm/tests/combpath_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT combpath_test.o -MD -MP -MF $(DEPDIR)/combpath_test.Tpo -c -o combpath_test.o `test -f 'libyasm/tests/combpath_test.c' || echo '$(srcdir)/'`libyasm/tests/combpath_test.c
+ mv -f $(DEPDIR)/combpath_test.Tpo $(DEPDIR)/combpath_test.Po
+# source='libyasm/tests/combpath_test.c' object='combpath_test.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o combpath_test.o `test -f 'libyasm/tests/combpath_test.c' || echo '$(srcdir)/'`libyasm/tests/combpath_test.c
+
+combpath_test.obj: libyasm/tests/combpath_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT combpath_test.obj -MD -MP -MF $(DEPDIR)/combpath_test.Tpo -c -o combpath_test.obj `if test -f 'libyasm/tests/combpath_test.c'; then $(CYGPATH_W) 'libyasm/tests/combpath_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/combpath_test.c'; fi`
+ mv -f $(DEPDIR)/combpath_test.Tpo $(DEPDIR)/combpath_test.Po
+# source='libyasm/tests/combpath_test.c' object='combpath_test.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o combpath_test.obj `if test -f 'libyasm/tests/combpath_test.c'; then $(CYGPATH_W) 'libyasm/tests/combpath_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/combpath_test.c'; fi`
+
+floatnum_test.o: libyasm/tests/floatnum_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT floatnum_test.o -MD -MP -MF $(DEPDIR)/floatnum_test.Tpo -c -o floatnum_test.o `test -f 'libyasm/tests/floatnum_test.c' || echo '$(srcdir)/'`libyasm/tests/floatnum_test.c
+ mv -f $(DEPDIR)/floatnum_test.Tpo $(DEPDIR)/floatnum_test.Po
+# source='libyasm/tests/floatnum_test.c' object='floatnum_test.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o floatnum_test.o `test -f 'libyasm/tests/floatnum_test.c' || echo '$(srcdir)/'`libyasm/tests/floatnum_test.c
+
+floatnum_test.obj: libyasm/tests/floatnum_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT floatnum_test.obj -MD -MP -MF $(DEPDIR)/floatnum_test.Tpo -c -o floatnum_test.obj `if test -f 'libyasm/tests/floatnum_test.c'; then $(CYGPATH_W) 'libyasm/tests/floatnum_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/floatnum_test.c'; fi`
+ mv -f $(DEPDIR)/floatnum_test.Tpo $(DEPDIR)/floatnum_test.Po
+# source='libyasm/tests/floatnum_test.c' object='floatnum_test.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o floatnum_test.obj `if test -f 'libyasm/tests/floatnum_test.c'; then $(CYGPATH_W) 'libyasm/tests/floatnum_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/floatnum_test.c'; fi`
+
+leb128_test.o: libyasm/tests/leb128_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT leb128_test.o -MD -MP -MF $(DEPDIR)/leb128_test.Tpo -c -o leb128_test.o `test -f 'libyasm/tests/leb128_test.c' || echo '$(srcdir)/'`libyasm/tests/leb128_test.c
+ mv -f $(DEPDIR)/leb128_test.Tpo $(DEPDIR)/leb128_test.Po
+# source='libyasm/tests/leb128_test.c' object='leb128_test.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o leb128_test.o `test -f 'libyasm/tests/leb128_test.c' || echo '$(srcdir)/'`libyasm/tests/leb128_test.c
+
+leb128_test.obj: libyasm/tests/leb128_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT leb128_test.obj -MD -MP -MF $(DEPDIR)/leb128_test.Tpo -c -o leb128_test.obj `if test -f 'libyasm/tests/leb128_test.c'; then $(CYGPATH_W) 'libyasm/tests/leb128_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/leb128_test.c'; fi`
+ mv -f $(DEPDIR)/leb128_test.Tpo $(DEPDIR)/leb128_test.Po
+# source='libyasm/tests/leb128_test.c' object='leb128_test.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o leb128_test.obj `if test -f 'libyasm/tests/leb128_test.c'; then $(CYGPATH_W) 'libyasm/tests/leb128_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/leb128_test.c'; fi`
+
+splitpath_test.o: libyasm/tests/splitpath_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT splitpath_test.o -MD -MP -MF $(DEPDIR)/splitpath_test.Tpo -c -o splitpath_test.o `test -f 'libyasm/tests/splitpath_test.c' || echo '$(srcdir)/'`libyasm/tests/splitpath_test.c
+ mv -f $(DEPDIR)/splitpath_test.Tpo $(DEPDIR)/splitpath_test.Po
+# source='libyasm/tests/splitpath_test.c' object='splitpath_test.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o splitpath_test.o `test -f 'libyasm/tests/splitpath_test.c' || echo '$(srcdir)/'`libyasm/tests/splitpath_test.c
+
+splitpath_test.obj: libyasm/tests/splitpath_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT splitpath_test.obj -MD -MP -MF $(DEPDIR)/splitpath_test.Tpo -c -o splitpath_test.obj `if test -f 'libyasm/tests/splitpath_test.c'; then $(CYGPATH_W) 'libyasm/tests/splitpath_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/splitpath_test.c'; fi`
+ mv -f $(DEPDIR)/splitpath_test.Tpo $(DEPDIR)/splitpath_test.Po
+# source='libyasm/tests/splitpath_test.c' object='splitpath_test.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o splitpath_test.obj `if test -f 'libyasm/tests/splitpath_test.c'; then $(CYGPATH_W) 'libyasm/tests/splitpath_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/splitpath_test.c'; fi`
+
+uncstring_test.o: libyasm/tests/uncstring_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT uncstring_test.o -MD -MP -MF $(DEPDIR)/uncstring_test.Tpo -c -o uncstring_test.o `test -f 'libyasm/tests/uncstring_test.c' || echo '$(srcdir)/'`libyasm/tests/uncstring_test.c
+ mv -f $(DEPDIR)/uncstring_test.Tpo $(DEPDIR)/uncstring_test.Po
+# source='libyasm/tests/uncstring_test.c' object='uncstring_test.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o uncstring_test.o `test -f 'libyasm/tests/uncstring_test.c' || echo '$(srcdir)/'`libyasm/tests/uncstring_test.c
+
+uncstring_test.obj: libyasm/tests/uncstring_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT uncstring_test.obj -MD -MP -MF $(DEPDIR)/uncstring_test.Tpo -c -o uncstring_test.obj `if test -f 'libyasm/tests/uncstring_test.c'; then $(CYGPATH_W) 'libyasm/tests/uncstring_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/uncstring_test.c'; fi`
+ mv -f $(DEPDIR)/uncstring_test.Tpo $(DEPDIR)/uncstring_test.Po
+# source='libyasm/tests/uncstring_test.c' object='uncstring_test.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o uncstring_test.obj `if test -f 'libyasm/tests/uncstring_test.c'; then $(CYGPATH_W) 'libyasm/tests/uncstring_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/uncstring_test.c'; fi`
+
+yasm.o: frontends/yasm/yasm.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT yasm.o -MD -MP -MF $(DEPDIR)/yasm.Tpo -c -o yasm.o `test -f 'frontends/yasm/yasm.c' || echo '$(srcdir)/'`frontends/yasm/yasm.c
+ mv -f $(DEPDIR)/yasm.Tpo $(DEPDIR)/yasm.Po
+# source='frontends/yasm/yasm.c' object='yasm.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o yasm.o `test -f 'frontends/yasm/yasm.c' || echo '$(srcdir)/'`frontends/yasm/yasm.c
+
+yasm.obj: frontends/yasm/yasm.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT yasm.obj -MD -MP -MF $(DEPDIR)/yasm.Tpo -c -o yasm.obj `if test -f 'frontends/yasm/yasm.c'; then $(CYGPATH_W) 'frontends/yasm/yasm.c'; else $(CYGPATH_W) '$(srcdir)/frontends/yasm/yasm.c'; fi`
+ mv -f $(DEPDIR)/yasm.Tpo $(DEPDIR)/yasm.Po
+# source='frontends/yasm/yasm.c' object='yasm.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o yasm.obj `if test -f 'frontends/yasm/yasm.c'; then $(CYGPATH_W) 'frontends/yasm/yasm.c'; else $(CYGPATH_W) '$(srcdir)/frontends/yasm/yasm.c'; fi`
+
+yasm-options.o: frontends/yasm/yasm-options.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT yasm-options.o -MD -MP -MF $(DEPDIR)/yasm-options.Tpo -c -o yasm-options.o `test -f 'frontends/yasm/yasm-options.c' || echo '$(srcdir)/'`frontends/yasm/yasm-options.c
+ mv -f $(DEPDIR)/yasm-options.Tpo $(DEPDIR)/yasm-options.Po
+# source='frontends/yasm/yasm-options.c' object='yasm-options.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o yasm-options.o `test -f 'frontends/yasm/yasm-options.c' || echo '$(srcdir)/'`frontends/yasm/yasm-options.c
+
+yasm-options.obj: frontends/yasm/yasm-options.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT yasm-options.obj -MD -MP -MF $(DEPDIR)/yasm-options.Tpo -c -o yasm-options.obj `if test -f 'frontends/yasm/yasm-options.c'; then $(CYGPATH_W) 'frontends/yasm/yasm-options.c'; else $(CYGPATH_W) '$(srcdir)/frontends/yasm/yasm-options.c'; fi`
+ mv -f $(DEPDIR)/yasm-options.Tpo $(DEPDIR)/yasm-options.Po
+# source='frontends/yasm/yasm-options.c' object='yasm-options.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o yasm-options.obj `if test -f 'frontends/yasm/yasm-options.c'; then $(CYGPATH_W) 'frontends/yasm/yasm-options.c'; else $(CYGPATH_W) '$(srcdir)/frontends/yasm/yasm-options.c'; fi`
+
+tasm.o: frontends/tasm/tasm.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tasm.o -MD -MP -MF $(DEPDIR)/tasm.Tpo -c -o tasm.o `test -f 'frontends/tasm/tasm.c' || echo '$(srcdir)/'`frontends/tasm/tasm.c
+ mv -f $(DEPDIR)/tasm.Tpo $(DEPDIR)/tasm.Po
+# source='frontends/tasm/tasm.c' object='tasm.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tasm.o `test -f 'frontends/tasm/tasm.c' || echo '$(srcdir)/'`frontends/tasm/tasm.c
+
+tasm.obj: frontends/tasm/tasm.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tasm.obj -MD -MP -MF $(DEPDIR)/tasm.Tpo -c -o tasm.obj `if test -f 'frontends/tasm/tasm.c'; then $(CYGPATH_W) 'frontends/tasm/tasm.c'; else $(CYGPATH_W) '$(srcdir)/frontends/tasm/tasm.c'; fi`
+ mv -f $(DEPDIR)/tasm.Tpo $(DEPDIR)/tasm.Po
+# source='frontends/tasm/tasm.c' object='tasm.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tasm.obj `if test -f 'frontends/tasm/tasm.c'; then $(CYGPATH_W) 'frontends/tasm/tasm.c'; else $(CYGPATH_W) '$(srcdir)/frontends/tasm/tasm.c'; fi`
+
+tasm-options.o: frontends/tasm/tasm-options.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tasm-options.o -MD -MP -MF $(DEPDIR)/tasm-options.Tpo -c -o tasm-options.o `test -f 'frontends/tasm/tasm-options.c' || echo '$(srcdir)/'`frontends/tasm/tasm-options.c
+ mv -f $(DEPDIR)/tasm-options.Tpo $(DEPDIR)/tasm-options.Po
+# source='frontends/tasm/tasm-options.c' object='tasm-options.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tasm-options.o `test -f 'frontends/tasm/tasm-options.c' || echo '$(srcdir)/'`frontends/tasm/tasm-options.c
+
+tasm-options.obj: frontends/tasm/tasm-options.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tasm-options.obj -MD -MP -MF $(DEPDIR)/tasm-options.Tpo -c -o tasm-options.obj `if test -f 'frontends/tasm/tasm-options.c'; then $(CYGPATH_W) 'frontends/tasm/tasm-options.c'; else $(CYGPATH_W) '$(srcdir)/frontends/tasm/tasm-options.c'; fi`
+ mv -f $(DEPDIR)/tasm-options.Tpo $(DEPDIR)/tasm-options.Po
+# source='frontends/tasm/tasm-options.c' object='tasm-options.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tasm-options.obj `if test -f 'frontends/tasm/tasm-options.c'; then $(CYGPATH_W) 'frontends/tasm/tasm-options.c'; else $(CYGPATH_W) '$(srcdir)/frontends/tasm/tasm-options.c'; fi`
+install-man1: $(man1_MANS) $(man_MANS)
+ @$(NORMAL_INSTALL)
+ test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)"
+ @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.1*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
+ else file=$$i; fi; \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 1*) ;; \
+ *) ext='1' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \
+ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst"; \
+ done
+uninstall-man1:
+ @$(NORMAL_UNINSTALL)
+ @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.1*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 1*) ;; \
+ *) ext='1' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " rm -f '$(DESTDIR)$(man1dir)/$$inst'"; \
+ rm -f "$(DESTDIR)$(man1dir)/$$inst"; \
+ done
+install-man7: $(man7_MANS) $(man_MANS)
+ @$(NORMAL_INSTALL)
+ test -z "$(man7dir)" || $(MKDIR_P) "$(DESTDIR)$(man7dir)"
+ @list='$(man7_MANS) $(dist_man7_MANS) $(nodist_man7_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.7*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
+ else file=$$i; fi; \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 7*) ;; \
+ *) ext='7' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man7dir)/$$inst'"; \
+ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man7dir)/$$inst"; \
+ done
+uninstall-man7:
+ @$(NORMAL_UNINSTALL)
+ @list='$(man7_MANS) $(dist_man7_MANS) $(nodist_man7_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.7*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 7*) ;; \
+ *) ext='7' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " rm -f '$(DESTDIR)$(man7dir)/$$inst'"; \
+ rm -f "$(DESTDIR)$(man7dir)/$$inst"; \
+ done
+install-includeHEADERS: $(include_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)"
+ @list='$(include_HEADERS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includedir)/$$f'"; \
+ $(includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includedir)/$$f"; \
+ done
+
+uninstall-includeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(include_HEADERS)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(includedir)/$$f'"; \
+ rm -f "$(DESTDIR)$(includedir)/$$f"; \
+ done
+install-modincludeHEADERS: $(modinclude_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(modincludedir)" || $(MKDIR_P) "$(DESTDIR)$(modincludedir)"
+ @list='$(modinclude_HEADERS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(modincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(modincludedir)/$$f'"; \
+ $(modincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(modincludedir)/$$f"; \
+ done
+
+uninstall-modincludeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(modinclude_HEADERS)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(modincludedir)/$$f'"; \
+ rm -f "$(DESTDIR)$(modincludedir)/$$f"; \
+ done
+install-nodist_includeHEADERS: $(nodist_include_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)"
+ @list='$(nodist_include_HEADERS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(nodist_includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includedir)/$$f'"; \
+ $(nodist_includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includedir)/$$f"; \
+ done
+
+uninstall-nodist_includeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(nodist_include_HEADERS)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(includedir)/$$f'"; \
+ rm -f "$(DESTDIR)$(includedir)/$$f"; \
+ done
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+check-TESTS: $(TESTS)
+ @failed=0; all=0; xfail=0; xpass=0; skip=0; ws='[ ]'; \
+ srcdir=$(srcdir); export srcdir; \
+ list=' $(TESTS) '; \
+ if test -n "$$list"; then \
+ for tst in $$list; do \
+ if test -f ./$$tst; then dir=./; \
+ elif test -f $$tst; then dir=; \
+ else dir="$(srcdir)/"; fi; \
+ if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
+ all=`expr $$all + 1`; \
+ case " $(XFAIL_TESTS) " in \
+ *$$ws$$tst$$ws*) \
+ xpass=`expr $$xpass + 1`; \
+ failed=`expr $$failed + 1`; \
+ echo "XPASS: $$tst"; \
+ ;; \
+ *) \
+ echo "PASS: $$tst"; \
+ ;; \
+ esac; \
+ elif test $$? -ne 77; then \
+ all=`expr $$all + 1`; \
+ case " $(XFAIL_TESTS) " in \
+ *$$ws$$tst$$ws*) \
+ xfail=`expr $$xfail + 1`; \
+ echo "XFAIL: $$tst"; \
+ ;; \
+ *) \
+ failed=`expr $$failed + 1`; \
+ echo "FAIL: $$tst"; \
+ ;; \
+ esac; \
+ else \
+ skip=`expr $$skip + 1`; \
+ echo "SKIP: $$tst"; \
+ fi; \
+ done; \
+ if test "$$failed" -eq 0; then \
+ if test "$$xfail" -eq 0; then \
+ banner="All $$all tests passed"; \
+ else \
+ banner="All $$all tests behaved as expected ($$xfail expected failures)"; \
+ fi; \
+ else \
+ if test "$$xpass" -eq 0; then \
+ banner="$$failed of $$all tests failed"; \
+ else \
+ banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \
+ fi; \
+ fi; \
+ dashes="$$banner"; \
+ skipped=""; \
+ if test "$$skip" -ne 0; then \
+ skipped="($$skip tests were not run)"; \
+ test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
+ dashes="$$skipped"; \
+ fi; \
+ report=""; \
+ if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
+ report="Please report to $(PACKAGE_BUGREPORT)"; \
+ test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
+ dashes="$$report"; \
+ fi; \
+ dashes=`echo "$$dashes" | sed s/./=/g`; \
+ echo "$$dashes"; \
+ echo "$$banner"; \
+ test -z "$$skipped" || echo "$$skipped"; \
+ test -z "$$report" || echo "$$report"; \
+ echo "$$dashes"; \
+ test "$$failed" -eq 0; \
+ else :; fi
+
+distdir: $(DISTFILES)
+ $(am__remove_distdir)
+ test -d $(distdir) || mkdir $(distdir)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ distdir=`$(am__cd) $(distdir) && pwd`; \
+ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$top_distdir" \
+ distdir="$$distdir/$$subdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+ -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
+ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
+ || chmod -R a+r $(distdir)
+dist-gzip: distdir
+ tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+ $(am__remove_distdir)
+
+dist-bzip2: distdir
+ tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
+ $(am__remove_distdir)
+
+dist-lzma: distdir
+ tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
+ $(am__remove_distdir)
+
+dist-tarZ: distdir
+ tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
+ $(am__remove_distdir)
+
+dist-shar: distdir
+ shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+ $(am__remove_distdir)
+
+dist-zip: distdir
+ -rm -f $(distdir).zip
+ zip -rq $(distdir).zip $(distdir)
+ $(am__remove_distdir)
+
+dist dist-all: distdir
+ tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+ $(am__remove_distdir)
+
+# This target untars the dist file and tries a VPATH configuration. Then
+# it guarantees that the distribution is self-contained by making another
+# tarfile.
+distcheck: dist
+ case '$(DIST_ARCHIVES)' in \
+ *.tar.gz*) \
+ GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
+ *.tar.bz2*) \
+ bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
+ *.tar.lzma*) \
+ unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\
+ *.tar.Z*) \
+ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
+ *.shar.gz*) \
+ GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
+ *.zip*) \
+ unzip $(distdir).zip ;;\
+ esac
+ chmod -R a-w $(distdir); chmod a+w $(distdir)
+ mkdir $(distdir)/_build
+ mkdir $(distdir)/_inst
+ chmod a-w $(distdir)
+ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
+ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
+ && cd $(distdir)/_build \
+ && ../configure --srcdir=.. --prefix="$$dc_install_base" \
+ $(DISTCHECK_CONFIGURE_FLAGS) \
+ && $(MAKE) $(AM_MAKEFLAGS) \
+ && $(MAKE) $(AM_MAKEFLAGS) dvi \
+ && $(MAKE) $(AM_MAKEFLAGS) check \
+ && $(MAKE) $(AM_MAKEFLAGS) install \
+ && $(MAKE) $(AM_MAKEFLAGS) installcheck \
+ && $(MAKE) $(AM_MAKEFLAGS) uninstall \
+ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
+ distuninstallcheck \
+ && chmod -R a-w "$$dc_install_base" \
+ && ({ \
+ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
+ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
+ } || { rm -rf "$$dc_destdir"; exit 1; }) \
+ && rm -rf "$$dc_destdir" \
+ && $(MAKE) $(AM_MAKEFLAGS) dist \
+ && rm -rf $(DIST_ARCHIVES) \
+ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck
+ $(am__remove_distdir)
+ @(echo "$(distdir) archives ready for distribution: "; \
+ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
+ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
+distuninstallcheck:
+ @cd $(distuninstallcheck_dir) \
+ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
+ || { echo "ERROR: files left after uninstall:" ; \
+ if test -n "$(DESTDIR)"; then \
+ echo " (check DESTDIR support)"; \
+ fi ; \
+ $(distuninstallcheck_listfiles) ; \
+ exit 1; } >&2
+distcleancheck: distclean
+ @if test '$(srcdir)' = . ; then \
+ echo "ERROR: distcleancheck can only run from a VPATH build" ; \
+ exit 1 ; \
+ fi
+ @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
+ || { echo "ERROR: files left in build directory after distclean:" ; \
+ $(distcleancheck_listfiles) ; \
+ exit 1; } >&2
+check-am: all-am
+ $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
+ $(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) check-recursive
+all-am: Makefile $(LIBRARIES) $(PROGRAMS) $(MANS) $(HEADERS) config.h \
+ all-local
+installdirs: installdirs-recursive
+installdirs-am:
+ for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man7dir)" "$(DESTDIR)$(includedir)" "$(DESTDIR)$(modincludedir)" "$(DESTDIR)$(includedir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+ -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
+clean: clean-recursive
+
+clean-am: clean-binPROGRAMS clean-checkPROGRAMS clean-generic \
+ clean-libLIBRARIES clean-noinstPROGRAMS mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-hdr distclean-local distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am: install-includeHEADERS install-man \
+ install-modincludeHEADERS install-nodist_includeHEADERS
+
+install-dvi: install-dvi-recursive
+
+install-exec-am: install-binPROGRAMS install-libLIBRARIES
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) install-exec-hook
+
+install-html: install-html-recursive
+
+install-info: install-info-recursive
+
+install-man: install-man1 install-man7
+
+install-pdf: install-pdf-recursive
+
+install-ps: install-ps-recursive
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+ -rm -rf $(top_srcdir)/autom4te.cache
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS uninstall-includeHEADERS \
+ uninstall-libLIBRARIES uninstall-man \
+ uninstall-modincludeHEADERS uninstall-nodist_includeHEADERS
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) uninstall-hook
+
+uninstall-man: uninstall-man1 uninstall-man7
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+ install-exec-am install-strip uninstall-am
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+ all all-am all-local am--refresh check check-TESTS check-am \
+ clean clean-binPROGRAMS clean-checkPROGRAMS clean-generic \
+ clean-libLIBRARIES clean-noinstPROGRAMS ctags ctags-recursive \
+ dist dist-all dist-bzip2 dist-gzip dist-lzma dist-shar \
+ dist-tarZ dist-zip distcheck distclean distclean-compile \
+ distclean-generic distclean-hdr distclean-local distclean-tags \
+ distcleancheck distdir distuninstallcheck dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-exec-hook install-html \
+ install-html-am install-includeHEADERS install-info \
+ install-info-am install-libLIBRARIES install-man install-man1 \
+ install-man7 install-modincludeHEADERS \
+ install-nodist_includeHEADERS install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs installdirs-am maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic pdf pdf-am ps ps-am tags tags-recursive \
+ uninstall uninstall-am uninstall-binPROGRAMS uninstall-hook \
+ uninstall-includeHEADERS uninstall-libLIBRARIES uninstall-man \
+ uninstall-man1 uninstall-man7 uninstall-modincludeHEADERS \
+ uninstall-nodist_includeHEADERS
+
+
+re2c-main.$(OBJEXT): tools/re2c/main.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/re2c/main.c || echo '$(srcdir)/'`tools/re2c/main.c
+
+re2c-code.$(OBJEXT): tools/re2c/code.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/re2c/code.c || echo '$(srcdir)/'`tools/re2c/code.c
+
+re2c-dfa.$(OBJEXT): tools/re2c/dfa.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/re2c/dfa.c || echo '$(srcdir)/'`tools/re2c/dfa.c
+
+re2c-parser.$(OBJEXT): tools/re2c/parser.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/re2c/parser.c || echo '$(srcdir)/'`tools/re2c/parser.c
+
+re2c-actions.$(OBJEXT): tools/re2c/actions.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/re2c/actions.c || echo '$(srcdir)/'`tools/re2c/actions.c
+
+re2c-scanner.$(OBJEXT): tools/re2c/scanner.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/re2c/scanner.c || echo '$(srcdir)/'`tools/re2c/scanner.c
+
+re2c-mbo_getopt.$(OBJEXT): tools/re2c/mbo_getopt.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/re2c/mbo_getopt.c || echo '$(srcdir)/'`tools/re2c/mbo_getopt.c
+
+re2c-substr.$(OBJEXT): tools/re2c/substr.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/re2c/substr.c || echo '$(srcdir)/'`tools/re2c/substr.c
+
+re2c-translate.$(OBJEXT): tools/re2c/translate.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/re2c/translate.c || echo '$(srcdir)/'`tools/re2c/translate.c
+
+genmacro.$(OBJEXT): tools/genmacro/genmacro.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/genmacro/genmacro.c || echo '$(srcdir)/'`tools/genmacro/genmacro.c
+.gperf.c: genperf$(EXEEXT)
+ $(top_builddir)/genperf$(EXEEXT) $< $@
+
+genperf.$(OBJEXT): tools/genperf/genperf.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/genperf/genperf.c || echo '$(srcdir)/'`tools/genperf/genperf.c
+
+gp-perfect.$(OBJEXT): tools/genperf/perfect.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/genperf/perfect.c || echo '$(srcdir)/'`tools/genperf/perfect.c
+
+gp-phash.$(OBJEXT): libyasm/phash.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f libyasm/phash.c || echo '$(srcdir)/'`libyasm/phash.c
+
+gp-xmalloc.$(OBJEXT): libyasm/xmalloc.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f libyasm/xmalloc.c || echo '$(srcdir)/'`libyasm/xmalloc.c
+
+gp-xstrdup.$(OBJEXT): libyasm/xstrdup.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f libyasm/xstrdup.c || echo '$(srcdir)/'`libyasm/xstrdup.c
+
+# Use Pyxelator to generate Pyrex function headers.
+#_yasm.pxi: ${HEADERS}
+# @rm -rf .tmp
+# @mkdir .tmp
+# $(PYTHON) $(srcdir)/tools/python-yasm/pyxelator/wrap_yasm.py \
+# "YASM_DIR=${srcdir}" "CPP=${CPP}" "CPPFLAGS=${CPPFLAGS}"
+# @rm -rf .tmp
+
+# Need to build a local copy of the main Pyrex input file to include _yasm.pxi
+# from the build directory. Also need to fixup the other .pxi include paths.
+#yasm.pyx: $(srcdir)/tools/python-yasm/yasm.pyx
+# sed -e 's,^include "\([^_]\),include "${srcdir}/tools/python-yasm/\1,' \
+# $(srcdir)/tools/python-yasm/yasm.pyx > $@
+
+# Actually run Pyrex
+#yasm_python.c: yasm.pyx _yasm.pxi $(PYBINDING_DEPS)
+# $(PYTHON) -c "from Pyrex.Compiler.Main import main; main(command_line=1)" \
+# -o $@ yasm.pyx
+
+# Now the Python build magic...
+#python-setup.txt: Makefile
+# echo "includes=${DEFS} ${DEFAULT_INCLUDES} ${INCLUDES} ${AM_CPPFLAGS} ${CPPFLAGS}" > python-setup.txt
+# echo "sources=${libyasm_a_SOURCES}" >> python-setup.txt
+# echo "srcdir=${srcdir}" >> python-setup.txt
+# echo "gcc=${GCC}" >> python-setup.txt
+
+#.python-build: python-setup.txt yasm_python.c ${libyasm_a_SOURCES}
+# $(PYTHON) `test -f tools/python-yasm/setup.py || echo '$(srcdir)/'`tools/python-yasm/setup.py build
+# touch .python-build
+#python-build: .python-build
+
+#python-install: .python-build
+# $(PYTHON) `test -f tools/python-yasm/setup.py || echo '$(srcdir)/'`tools/python-yasm/setup.py install "--install-lib=$(DESTDIR)$(pythondir)"
+
+#python-uninstall:
+# rm -f `$(PYTHON) -c "import sys;sys.path.insert(0, '${DESTDIR}${pythondir}'); import yasm; print yasm.__file__"`
+
+python-build:
+python-install:
+python-uninstall:
+
+modules/arch/x86/x86id.c: x86insn_nasm.c x86insn_gas.c x86insns.c
+
+x86insn_nasm.gperf x86insn_gas.gperf x86insns.c: $(srcdir)/modules/arch/x86/gen_x86_insn.py
+ $(PYTHON) $(srcdir)/modules/arch/x86/gen_x86_insn.py
+#x86insn_nasm.gperf: $(srcdir)/x86insn_nasm.gperf
+# @echo Python must be installed to regenerate x86 instructions files
+# cp $(srcdir)/x86insn_nasm.gperf $@
+#x86insn_gas.gperf: $(srcdir)/x86insn_gas.gperf
+# @echo Python must be installed to regenerate x86 instructions files
+# cp $(srcdir)/x86insn_gas.gperf $@
+
+# Use suffix rules for gperf files
+x86insn_nasm.c: x86insn_nasm.gperf genperf$(EXEEXT)
+x86insn_gas.c: x86insn_gas.gperf genperf$(EXEEXT)
+x86cpu.c: $(srcdir)/modules/arch/x86/x86cpu.gperf genperf$(EXEEXT)
+ $(top_builddir)/genperf$(EXEEXT) $(srcdir)/modules/arch/x86/x86cpu.gperf $@
+x86regtmod.c: $(srcdir)/modules/arch/x86/x86regtmod.gperf genperf$(EXEEXT)
+ $(top_builddir)/genperf$(EXEEXT) $(srcdir)/modules/arch/x86/x86regtmod.gperf $@
+
+lc3bid.c: $(srcdir)/modules/arch/lc3b/lc3bid.re re2c$(EXEEXT)
+ $(top_builddir)/re2c$(EXEEXT) -s -o $@ $(srcdir)/modules/arch/lc3b/lc3bid.re
+
+yasm_arch.7: modules/arch/yasm_arch.xml
+ $(XMLTO) -o $(top_builddir) man $(srcdir)/modules/arch/yasm_arch.xml
+
+#EXTRA_DIST += modules/listfmts/nasm/tests/Makefile.inc
+
+#include modules/listfmts/nasm/tests/Makefile.inc
+
+gas-token.c: $(srcdir)/modules/parsers/gas/gas-token.re re2c$(EXEEXT)
+ $(top_builddir)/re2c$(EXEEXT) -b -o $@ $(srcdir)/modules/parsers/gas/gas-token.re
+
+nasm-token.c: $(srcdir)/modules/parsers/nasm/nasm-token.re re2c$(EXEEXT)
+ $(top_builddir)/re2c$(EXEEXT) -b -o $@ $(srcdir)/modules/parsers/nasm/nasm-token.re
+
+$(top_srcdir)/modules/parsers/nasm/nasm-parser.c: nasm-macros.c
+
+nasm-macros.c: $(srcdir)/modules/parsers/nasm/nasm-std.mac genmacro$(EXEEXT)
+ $(top_builddir)/genmacro$(EXEEXT) $@ nasm_standard_mac $(srcdir)/modules/parsers/nasm/nasm-std.mac
+
+yasm_parsers.7: modules/parsers/yasm_parsers.xml
+ $(XMLTO) -o $(top_builddir) man $(srcdir)/modules/parsers/yasm_parsers.xml
+
+$(top_srcdir)/modules/preprocs/nasm/nasm-preproc.c: nasm-version.c
+
+nasm-version.c: version.mac genmacro$(EXEEXT)
+ $(top_builddir)/genmacro$(EXEEXT) $@ nasm_version_mac version.mac
+
+version.mac: genversion$(EXEEXT)
+ $(top_builddir)/genversion$(EXEEXT) $@
+
+genversion.$(OBJEXT): modules/preprocs/nasm/genversion.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f modules/preprocs/nasm/genversion.c || echo '$(srcdir)/'`modules/preprocs/nasm/genversion.c
+
+#EXTRA_DIST += modules/dbgfmts/codeview/tests/Makefile.inc
+#include modules/dbgfmts/codeview/tests/Makefile.inc
+
+yasm_dbgfmts.7: modules/dbgfmts/yasm_dbgfmts.xml
+ $(XMLTO) -o $(top_builddir) man $(srcdir)/modules/dbgfmts/yasm_dbgfmts.xml
+
+$(top_srcdir)/modules/objfmts/coff/coff-objfmt.c: win64-nasm.c win64-gas.c
+
+win64-nasm.c: $(srcdir)/modules/objfmts/coff/win64-nasm.mac genmacro$(EXEEXT)
+ $(top_builddir)/genmacro$(EXEEXT) $@ win64_nasm_stdmac $(srcdir)/modules/objfmts/coff/win64-nasm.mac
+
+win64-gas.c: $(srcdir)/modules/objfmts/coff/win64-gas.mac genmacro$(EXEEXT)
+ $(top_builddir)/genmacro$(EXEEXT) $@ win64_gas_stdmac $(srcdir)/modules/objfmts/coff/win64-gas.mac
+
+yasm_objfmts.7: modules/objfmts/yasm_objfmts.xml
+ $(XMLTO) -o $(top_builddir) man $(srcdir)/modules/objfmts/yasm_objfmts.xml
+
+module.c: $(top_srcdir)/libyasm/module.in genmodule$(EXEEXT) Makefile
+ $(top_builddir)/genmodule$(EXEEXT) $(top_srcdir)/libyasm/module.in Makefile
+
+genmodule.$(OBJEXT): libyasm/genmodule.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f libyasm/genmodule.c || echo '$(srcdir)/'`libyasm/genmodule.c
+
+yasm.1: frontends/yasm/yasm.xml
+ $(XMLTO) -o $(top_builddir) man $(srcdir)/frontends/yasm/yasm.xml
+
+$(srcdir)/frontends/yasm/yasm.c: license.c
+
+license.c: $(srcdir)/COPYING genstring$(EXEEXT)
+ $(top_builddir)/genstring$(EXEEXT) license_msg $@ $(srcdir)/COPYING
+
+distclean-local:
+ -rm -rf results
+ -rm -rf build
+
+all-local: python-build
+install-exec-hook: python-install
+uninstall-hook: python-uninstall
+
+genstring.$(OBJEXT): genstring.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f genstring.c || echo '$(srcdir)/'`genstring.c
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/chromium/third_party/pdfium/third_party/yasm/source/config/linux/config.h b/chromium/third_party/pdfium/third_party/yasm/source/config/linux/config.h
new file mode 100644
index 00000000000..9e3653957b5
--- /dev/null
+++ b/chromium/third_party/pdfium/third_party/yasm/source/config/linux/config.h
@@ -0,0 +1,173 @@
+/* config.h. Generated from config.h.in by configure. */
+/* config.h.in. Generated from configure.ac by autoheader. */
+
+/* Command name to run C preprocessor */
+#define CPP_PROG "gcc -E"
+
+/* */
+#define ENABLE_NLS 1
+
+/* Define to 1 if you have the `abort' function. */
+#define HAVE_ABORT 1
+
+/* */
+/* #undef HAVE_CATGETS */
+
+/* Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the
+ CoreFoundation framework. */
+/* #undef HAVE_CFLOCALECOPYCURRENT */
+
+/* Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in
+ the CoreFoundation framework. */
+/* #undef HAVE_CFPREFERENCESCOPYAPPVALUE */
+
+/* Define if the GNU dcgettext() function is already present or preinstalled.
+ */
+#define HAVE_DCGETTEXT 1
+
+/* Define to 1 if you have the <direct.h> header file. */
+/* #undef HAVE_DIRECT_H */
+
+/* Define to 1 if you have the `ftruncate' function. */
+#define HAVE_FTRUNCATE 1
+
+/* Define to 1 if you have the `getcwd' function. */
+#define HAVE_GETCWD 1
+
+/* */
+#define HAVE_GETTEXT 1
+
+/* Define to 1 if you have the GNU C Library */
+#define HAVE_GNU_C_LIBRARY 1
+
+/* Define if you have the iconv() function and it works. */
+/* #undef HAVE_ICONV */
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* */
+/* #undef HAVE_LC_MESSAGES */
+
+/* Define to 1 if you have the <libgen.h> header file. */
+#define HAVE_LIBGEN_H 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the `mergesort' function. */
+/* #undef HAVE_MERGESORT */
+
+/* Define to 1 if you have the `popen' function. */
+#define HAVE_POPEN 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* */
+/* #undef HAVE_STPCPY */
+
+/* Define to 1 if you have the `strcasecmp' function. */
+#define HAVE_STRCASECMP 1
+
+/* Define to 1 if you have the `strcmpi' function. */
+/* #undef HAVE_STRCMPI */
+
+/* Define to 1 if you have the `stricmp' function. */
+/* #undef HAVE_STRICMP */
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the `strncasecmp' function. */
+#define HAVE_STRNCASECMP 1
+
+/* Define to 1 if you have the `strsep' function. */
+#define HAVE_STRSEP 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the `toascii' function. */
+#define HAVE_TOASCII 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define to 1 if you have the `vsnprintf' function. */
+#define HAVE_VSNPRINTF 1
+
+/* Define to 1 if you have the `_stricmp' function. */
+/* #undef HAVE__STRICMP */
+
+/* Name of package */
+#define PACKAGE "yasm"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "bug-yasm@tortall.net"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "yasm"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "yasm 1.2.0"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "yasm"
+
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "1.2.0"
+
+/* Define to 1 if the C compiler supports function prototypes. */
+#define PROTOTYPES 1
+
+/* The size of `char', as computed by sizeof. */
+/* #undef SIZEOF_CHAR */
+
+/* The size of `int', as computed by sizeof. */
+/* #undef SIZEOF_INT */
+
+/* The size of `long', as computed by sizeof. */
+/* #undef SIZEOF_LONG */
+
+/* The size of `short', as computed by sizeof. */
+/* #undef SIZEOF_SHORT */
+
+/* The size of `void*', as computed by sizeof. */
+/* #undef SIZEOF_VOIDP */
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Version number of package */
+#define VERSION "1.2.0"
+
+/* Define if using the dmalloc debugging malloc package */
+/* #undef WITH_DMALLOC */
+
+/* Define like PROTOTYPES; this can be used by system headers. */
+#define __PROTOTYPES 1
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef const */
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+ calls it, or to nothing if 'inline' is not supported under any name. */
+#ifndef __cplusplus
+/* #undef inline */
+#endif
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+/* #undef size_t */
diff --git a/chromium/third_party/pdfium/third_party/yasm/source/config/linux/libyasm-stdint.h b/chromium/third_party/pdfium/third_party/yasm/source/config/linux/libyasm-stdint.h
new file mode 100644
index 00000000000..357610e1c11
--- /dev/null
+++ b/chromium/third_party/pdfium/third_party/yasm/source/config/linux/libyasm-stdint.h
@@ -0,0 +1,9 @@
+#ifndef _YASM_LIBYASM_STDINT_H
+#define _YASM_LIBYASM_STDINT_H 1
+#ifndef _GENERATED_STDINT_H
+#define _GENERATED_STDINT_H "yasm HEAD"
+/* generated using gcc -std=gnu99 */
+#define _STDINT_HAVE_STDINT_H 1
+#include <stdint.h>
+#endif
+#endif
diff --git a/chromium/third_party/pdfium/third_party/yasm/source/config/mac/Makefile b/chromium/third_party/pdfium/third_party/yasm/source/config/mac/Makefile
new file mode 100644
index 00000000000..770352550d7
--- /dev/null
+++ b/chromium/third_party/pdfium/third_party/yasm/source/config/mac/Makefile
@@ -0,0 +1,3822 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# Makefile. Generated from Makefile.in by configure.
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+
+
+# $Id: Makefile.am 2184 2009-03-24 05:04:15Z peter $
+
+# $Id: Makefile.inc 2084 2008-05-09 07:08:17Z peter $
+
+# $Id: Makefile.inc 1718 2006-12-24 00:13:19Z peter $
+
+# These utility programs have to be built for BUILD host in cross-build.
+# This makes things rather non-standard automake
+
+# $Id: Makefile.inc 2084 2008-05-09 07:08:17Z peter $
+
+# These utility programs have to be built for BUILD host in cross-build.
+# This makes things rather non-standard automake
+
+# $Id: Makefile.inc 1939 2007-09-10 07:15:50Z peter $
+
+# These utility programs have to be built for BUILD host in cross-build.
+# This makes things rather non-standard automake
+
+# $Id: Makefile.inc 1948 2007-09-13 02:53:30Z peter $
+
+# $Id: Makefile.inc 1951 2007-09-14 05:19:10Z peter $
+
+# $Id: Makefile.inc 1598 2006-08-10 04:02:59Z peter $
+
+# $Id: Makefile.inc 1914 2007-08-20 05:13:35Z peter $
+
+# $Id: Makefile.inc 2111 2008-07-06 22:26:49Z peter $
+
+# $Id: Makefile.inc 2170 2009-01-14 08:28:13Z peter $
+
+# $Id: Makefile.inc 2193 2009-04-04 23:03:41Z peter $
+
+# $Id: Makefile.inc 1776 2007-02-19 02:36:10Z peter $
+
+# $Id: Makefile.inc 2111 2008-07-06 22:26:49Z peter $
+
+# $Id: Makefile.inc 1928 2007-09-07 22:03:34Z peter $
+
+# $Id: Makefile.inc 1152 2004-10-02 06:18:30Z peter $
+
+# $Id: Makefile.inc 1183 2004-12-01 07:49:18Z peter $
+
+# $Id: Makefile.inc 2130 2008-10-07 05:38:11Z peter $
+
+# $Id: Makefile.inc 1783 2007-02-22 03:40:31Z peter $
+
+# $Id: Makefile.inc 2169 2009-01-02 20:46:57Z peter $
+
+# $Id$
+
+# $Id: Makefile.inc 2130 2008-10-07 05:38:11Z peter $
+
+# $Id: Makefile.inc 2191 2009-03-25 03:42:05Z peter $
+
+# $Id: Makefile.inc 1137 2004-09-04 01:24:57Z peter $
+
+# $Id: Makefile.inc 2082 2008-05-09 06:46:02Z peter $
+
+# $Id: Makefile.inc 2063 2008-04-12 08:30:22Z peter $
+
+# $Id: Makefile.inc 2063 2008-04-12 08:30:22Z peter $
+
+# $Id: Makefile.inc 1966 2007-09-20 03:54:36Z peter $
+
+# $Id: Makefile.inc 2130 2008-10-07 05:38:11Z peter $
+
+# $Id: Makefile.inc 2185 2009-03-24 06:33:32Z peter $
+
+# $Id: Makefile.inc 2172 2009-01-27 06:38:14Z peter $
+
+# $Id: Makefile.inc 2176 2009-03-04 07:39:02Z peter $
+
+# Makefile for cpp module.
+# Copied from raw preprocessor module.
+
+# $Id: Makefile.inc 1662 2006-10-21 18:52:29Z peter $
+
+# $Id: Makefile.inc 1428 2006-03-27 02:15:19Z peter $
+
+# $Id: Makefile.inc 1378 2006-02-12 01:27:39Z peter $
+
+# $Id: Makefile.inc 1350 2006-01-29 21:11:03Z peter $
+
+# $Id: Makefile.inc 1851 2007-05-26 17:56:36Z peter $
+
+# $Id: Makefile.inc 1617 2006-09-16 05:43:41Z peter $
+
+# $Id: Makefile.inc 1350 2006-01-29 21:11:03Z peter $
+
+# $Id: Makefile.inc 1183 2004-12-01 07:49:18Z peter $
+
+# $Id: Makefile.inc 1183 2004-12-01 07:49:18Z peter $
+
+# $Id$
+
+# $Id: Makefile.inc 1732 2007-01-13 19:34:04Z peter $
+
+# $Id: Makefile.inc 1183 2004-12-01 07:49:18Z peter $
+
+# $Id: Makefile.inc 2130 2008-10-07 05:38:11Z peter $
+
+# $Id: Makefile.inc 2010 2007-11-14 08:33:32Z peter $
+
+# $Id: Makefile.inc 2010 2007-11-14 08:33:32Z peter $
+
+# $Id: Makefile.inc 1252 2005-09-28 05:50:51Z peter $
+
+# $Id: Makefile.inc 2036 2008-02-09 04:06:47Z peter $
+
+# $Id: Makefile.inc 2126 2008-10-03 08:13:00Z peter $
+
+# $Id: Makefile.inc 2036 2008-02-09 04:06:47Z peter $
+
+# $Id: Makefile.inc 1168 2004-10-31 01:07:52Z peter $
+
+# $Id: Makefile.inc 2082 2008-05-09 06:46:02Z peter $
+
+# $Id: Makefile.inc 1617 2006-09-16 05:43:41Z peter $
+
+# $Id: Makefile.inc 1732 2007-01-13 19:34:04Z peter $
+
+# $Id: Makefile.inc 1777 2007-02-19 08:21:17Z peter $
+
+# $Id: Makefile.inc 1782 2007-02-21 06:45:39Z peter $
+
+# $Id: Makefile.inc 2108 2008-06-05 08:48:21Z peter $
+
+# $Id: Makefile.inc 1854 2007-05-31 06:16:49Z peter $
+
+# $Id: Makefile.inc 2108 2008-06-05 08:48:21Z peter $
+
+# $Id: Makefile.inc 1653 2006-10-17 06:58:41Z peter $
+
+# $Id: Makefile.inc 1653 2006-10-17 06:58:41Z peter $
+
+# $Id: Makefile.inc 1183 2004-12-01 07:49:18Z peter $
+
+# Assume objfmt_coff is included
+
+# $Id: Makefile.inc 2166 2009-01-02 08:33:21Z peter $
+
+# $Id: Makefile.inc 2166 2009-01-02 08:33:21Z peter $
+
+# $Id: Makefile.inc 1331 2006-01-15 22:48:55Z peter $
+
+# Assume objfmt_coff is included
+
+# $Id: Makefile.inc 2120 2008-09-04 04:45:30Z peter $
+
+# $Id: Makefile.inc 2082 2008-05-09 06:46:02Z peter $
+
+# $Id: Makefile.inc 1183 2004-12-01 07:49:18Z peter $
+
+# $Id: Makefile.inc 1851 2007-05-26 17:56:36Z peter $
+
+# $Id: Makefile.inc 2111 2008-07-06 22:26:49Z peter $
+
+# $Id: Makefile.inc 2123 2008-09-30 03:56:37Z peter $
+
+# $Id: Makefile.inc 2130 2008-10-07 05:38:11Z peter $
+
+# $Id: Makefile.inc 1463 2006-04-05 05:39:23Z peter $
+
+# $Id: Makefile.inc 1463 2006-04-05 05:39:23Z peter $
+
+
+
+VPATH = /workspace/ajwong/git-chrome/src/third_party/yasm/source/patched-yasm
+pkgdatadir = $(datadir)/yasm
+pkglibdir = $(libdir)/yasm
+pkgincludedir = $(includedir)/yasm
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = i686-apple-darwin9.8.0
+host_triplet = i686-apple-darwin9.8.0
+bin_PROGRAMS = yasm$(EXEEXT) ytasm$(EXEEXT)
+TESTS = $(am__append_3) modules/arch/x86/tests/x86_test.sh \
+ modules/arch/x86/tests/gas32/x86_gas32_test.sh \
+ modules/arch/x86/tests/gas64/x86_gas64_test.sh \
+ modules/arch/lc3b/tests/lc3b_test.sh \
+ modules/parsers/gas/tests/gas_test.sh \
+ modules/parsers/gas/tests/bin/gas_bin_test.sh \
+ modules/parsers/nasm/tests/nasm_test.sh \
+ modules/parsers/nasm/tests/worphan/nasm_worphan_test.sh \
+ modules/parsers/tasm/tests/tasm_test.sh \
+ modules/parsers/tasm/tests/exe/tasm_exe_test.sh \
+ modules/preprocs/nasm/tests/nasmpp_test.sh \
+ modules/preprocs/raw/tests/rawpp_test.sh \
+ modules/dbgfmts/dwarf2/tests/pass32/dwarf2_pass32_test.sh \
+ modules/dbgfmts/dwarf2/tests/pass64/dwarf2_pass64_test.sh \
+ modules/dbgfmts/dwarf2/tests/passwin64/dwarf2_passwin64_test.sh \
+ modules/dbgfmts/stabs/tests/stabs_test.sh \
+ modules/objfmts/bin/tests/bin_test.sh \
+ modules/objfmts/bin/tests/multisect/bin_multi_test.sh \
+ modules/objfmts/elf/tests/elf_test.sh \
+ modules/objfmts/elf/tests/amd64/elf_amd64_test.sh \
+ modules/objfmts/elf/tests/gas32/elf_gas32_test.sh \
+ modules/objfmts/elf/tests/gas64/elf_gas64_test.sh \
+ modules/objfmts/coff/tests/coff_test.sh \
+ modules/objfmts/macho/tests/gas32/gas_macho32_test.sh \
+ modules/objfmts/macho/tests/gas64/gas_macho64_test.sh \
+ modules/objfmts/macho/tests/nasm32/macho32_test.sh \
+ modules/objfmts/macho/tests/nasm64/macho64_test.sh \
+ modules/objfmts/rdf/tests/rdf_test.sh \
+ modules/objfmts/win32/tests/win32_test.sh \
+ modules/objfmts/win32/tests/gas/win32_gas_test.sh \
+ modules/objfmts/win64/tests/win64_test.sh \
+ modules/objfmts/win64/tests/gas/win64_gas_test.sh \
+ modules/objfmts/xdf/tests/xdf_test.sh bitvect_test$(EXEEXT) \
+ floatnum_test$(EXEEXT) leb128_test$(EXEEXT) \
+ splitpath_test$(EXEEXT) combpath_test$(EXEEXT) \
+ uncstring_test$(EXEEXT) libyasm/tests/libyasm_test.sh
+noinst_PROGRAMS = genstring$(EXEEXT) re2c$(EXEEXT) genmacro$(EXEEXT) \
+ genperf$(EXEEXT) genversion$(EXEEXT) genmodule$(EXEEXT)
+check_PROGRAMS = test_hd$(EXEEXT) bitvect_test$(EXEEXT) \
+ floatnum_test$(EXEEXT) leb128_test$(EXEEXT) \
+ splitpath_test$(EXEEXT) combpath_test$(EXEEXT) \
+ uncstring_test$(EXEEXT)
+DIST_COMMON = README $(am__configure_deps) $(dist_man_MANS) \
+ $(include_HEADERS) $(modinclude_HEADERS) $(noinst_HEADERS) \
+ $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(srcdir)/config.h.in $(srcdir)/frontends/Makefile.inc \
+ $(srcdir)/frontends/tasm/Makefile.inc \
+ $(srcdir)/frontends/yasm/Makefile.inc \
+ $(srcdir)/libyasm/Makefile.inc \
+ $(srcdir)/libyasm/tests/Makefile.inc $(srcdir)/m4/Makefile.inc \
+ $(srcdir)/modules/Makefile.inc \
+ $(srcdir)/modules/arch/Makefile.inc \
+ $(srcdir)/modules/arch/lc3b/Makefile.inc \
+ $(srcdir)/modules/arch/lc3b/tests/Makefile.inc \
+ $(srcdir)/modules/arch/x86/Makefile.inc \
+ $(srcdir)/modules/arch/x86/tests/Makefile.inc \
+ $(srcdir)/modules/arch/x86/tests/gas32/Makefile.inc \
+ $(srcdir)/modules/arch/x86/tests/gas64/Makefile.inc \
+ $(srcdir)/modules/dbgfmts/Makefile.inc \
+ $(srcdir)/modules/dbgfmts/codeview/Makefile.inc \
+ $(srcdir)/modules/dbgfmts/dwarf2/Makefile.inc \
+ $(srcdir)/modules/dbgfmts/dwarf2/tests/Makefile.inc \
+ $(srcdir)/modules/dbgfmts/dwarf2/tests/pass32/Makefile.inc \
+ $(srcdir)/modules/dbgfmts/dwarf2/tests/pass64/Makefile.inc \
+ $(srcdir)/modules/dbgfmts/dwarf2/tests/passwin64/Makefile.inc \
+ $(srcdir)/modules/dbgfmts/null/Makefile.inc \
+ $(srcdir)/modules/dbgfmts/stabs/Makefile.inc \
+ $(srcdir)/modules/dbgfmts/stabs/tests/Makefile.inc \
+ $(srcdir)/modules/listfmts/Makefile.inc \
+ $(srcdir)/modules/listfmts/nasm/Makefile.inc \
+ $(srcdir)/modules/objfmts/Makefile.inc \
+ $(srcdir)/modules/objfmts/bin/Makefile.inc \
+ $(srcdir)/modules/objfmts/bin/tests/Makefile.inc \
+ $(srcdir)/modules/objfmts/bin/tests/multisect/Makefile.inc \
+ $(srcdir)/modules/objfmts/coff/Makefile.inc \
+ $(srcdir)/modules/objfmts/coff/tests/Makefile.inc \
+ $(srcdir)/modules/objfmts/dbg/Makefile.inc \
+ $(srcdir)/modules/objfmts/elf/Makefile.inc \
+ $(srcdir)/modules/objfmts/elf/tests/Makefile.inc \
+ $(srcdir)/modules/objfmts/elf/tests/amd64/Makefile.inc \
+ $(srcdir)/modules/objfmts/elf/tests/gas32/Makefile.inc \
+ $(srcdir)/modules/objfmts/elf/tests/gas64/Makefile.inc \
+ $(srcdir)/modules/objfmts/macho/Makefile.inc \
+ $(srcdir)/modules/objfmts/macho/tests/Makefile.inc \
+ $(srcdir)/modules/objfmts/macho/tests/gas32/Makefile.inc \
+ $(srcdir)/modules/objfmts/macho/tests/gas64/Makefile.inc \
+ $(srcdir)/modules/objfmts/macho/tests/nasm32/Makefile.inc \
+ $(srcdir)/modules/objfmts/macho/tests/nasm64/Makefile.inc \
+ $(srcdir)/modules/objfmts/rdf/Makefile.inc \
+ $(srcdir)/modules/objfmts/rdf/tests/Makefile.inc \
+ $(srcdir)/modules/objfmts/win32/Makefile.inc \
+ $(srcdir)/modules/objfmts/win32/tests/Makefile.inc \
+ $(srcdir)/modules/objfmts/win32/tests/gas/Makefile.inc \
+ $(srcdir)/modules/objfmts/win64/Makefile.inc \
+ $(srcdir)/modules/objfmts/win64/tests/Makefile.inc \
+ $(srcdir)/modules/objfmts/win64/tests/gas/Makefile.inc \
+ $(srcdir)/modules/objfmts/xdf/Makefile.inc \
+ $(srcdir)/modules/objfmts/xdf/tests/Makefile.inc \
+ $(srcdir)/modules/parsers/Makefile.inc \
+ $(srcdir)/modules/parsers/gas/Makefile.inc \
+ $(srcdir)/modules/parsers/gas/tests/Makefile.inc \
+ $(srcdir)/modules/parsers/gas/tests/bin/Makefile.inc \
+ $(srcdir)/modules/parsers/nasm/Makefile.inc \
+ $(srcdir)/modules/parsers/nasm/tests/Makefile.inc \
+ $(srcdir)/modules/parsers/nasm/tests/worphan/Makefile.inc \
+ $(srcdir)/modules/parsers/tasm/Makefile.inc \
+ $(srcdir)/modules/parsers/tasm/tests/Makefile.inc \
+ $(srcdir)/modules/parsers/tasm/tests/exe/Makefile.inc \
+ $(srcdir)/modules/preprocs/Makefile.inc \
+ $(srcdir)/modules/preprocs/cpp/Makefile.inc \
+ $(srcdir)/modules/preprocs/nasm/Makefile.inc \
+ $(srcdir)/modules/preprocs/nasm/tests/Makefile.inc \
+ $(srcdir)/modules/preprocs/raw/Makefile.inc \
+ $(srcdir)/modules/preprocs/raw/tests/Makefile.inc \
+ $(srcdir)/tools/Makefile.inc \
+ $(srcdir)/tools/genmacro/Makefile.inc \
+ $(srcdir)/tools/genperf/Makefile.inc \
+ $(srcdir)/tools/python-yasm/Makefile.inc \
+ $(srcdir)/tools/python-yasm/tests/Makefile.inc \
+ $(srcdir)/tools/re2c/Makefile.inc $(top_srcdir)/configure \
+ ABOUT-NLS AUTHORS COPYING ChangeLog INSTALL NEWS \
+ config/config.guess config/config.rpath config/config.sub \
+ config/depcomp config/install-sh config/ltmain.sh \
+ config/missing
+#am__append_1 = _yasm.pxi yasm.pyx \
+# yasm_python.c python-setup.txt \
+# .python-build
+#am__append_2 = PYTHON=${PYTHON}
+#am__append_3 = tools/python-yasm/tests/python_test.sh
+#am__append_4 = $(dist_man_MANS)
+subdir = .
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/ax_create_stdint_h.m4 \
+ $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/iconv.m4 \
+ $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
+ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/nls.m4 \
+ $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \
+ $(top_srcdir)/m4/pyrex.m4 $(top_srcdir)/m4/pythonhead.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
+ configure.lineno config.status.lineno
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = config.h
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \
+ "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man7dir)" \
+ "$(DESTDIR)$(includedir)" "$(DESTDIR)$(modincludedir)" \
+ "$(DESTDIR)$(includedir)"
+libLIBRARIES_INSTALL = $(INSTALL_DATA)
+LIBRARIES = $(lib_LIBRARIES)
+AR = ar
+ARFLAGS = cru
+libyasm_a_AR = $(AR) $(ARFLAGS)
+libyasm_a_LIBADD =
+am_libyasm_a_OBJECTS = x86arch.$(OBJEXT) x86bc.$(OBJEXT) \
+ x86expr.$(OBJEXT) x86id.$(OBJEXT) lc3barch.$(OBJEXT) \
+ lc3bbc.$(OBJEXT) nasm-listfmt.$(OBJEXT) gas-parser.$(OBJEXT) \
+ gas-parse.$(OBJEXT) nasm-parser.$(OBJEXT) nasm-parse.$(OBJEXT) \
+ nasm-preproc.$(OBJEXT) nasm-pp.$(OBJEXT) nasmlib.$(OBJEXT) \
+ nasm-eval.$(OBJEXT) raw-preproc.$(OBJEXT) \
+ cpp-preproc.$(OBJEXT) cv-dbgfmt.$(OBJEXT) cv-symline.$(OBJEXT) \
+ cv-type.$(OBJEXT) dwarf2-dbgfmt.$(OBJEXT) \
+ dwarf2-line.$(OBJEXT) dwarf2-aranges.$(OBJEXT) \
+ dwarf2-info.$(OBJEXT) null-dbgfmt.$(OBJEXT) \
+ stabs-dbgfmt.$(OBJEXT) dbg-objfmt.$(OBJEXT) \
+ bin-objfmt.$(OBJEXT) elf.$(OBJEXT) elf-objfmt.$(OBJEXT) \
+ elf-x86-x86.$(OBJEXT) elf-x86-amd64.$(OBJEXT) \
+ coff-objfmt.$(OBJEXT) win64-except.$(OBJEXT) \
+ macho-objfmt.$(OBJEXT) rdf-objfmt.$(OBJEXT) \
+ xdf-objfmt.$(OBJEXT) assocdat.$(OBJEXT) bitvect.$(OBJEXT) \
+ bc-align.$(OBJEXT) bc-data.$(OBJEXT) bc-incbin.$(OBJEXT) \
+ bc-org.$(OBJEXT) bc-reserve.$(OBJEXT) bytecode.$(OBJEXT) \
+ errwarn.$(OBJEXT) expr.$(OBJEXT) file.$(OBJEXT) \
+ floatnum.$(OBJEXT) hamt.$(OBJEXT) insn.$(OBJEXT) \
+ intnum.$(OBJEXT) inttree.$(OBJEXT) linemap.$(OBJEXT) \
+ md5.$(OBJEXT) mergesort.$(OBJEXT) phash.$(OBJEXT) \
+ section.$(OBJEXT) strcasecmp.$(OBJEXT) strsep.$(OBJEXT) \
+ symrec.$(OBJEXT) valparam.$(OBJEXT) value.$(OBJEXT) \
+ xmalloc.$(OBJEXT) xstrdup.$(OBJEXT)
+nodist_libyasm_a_OBJECTS = x86cpu.$(OBJEXT) x86regtmod.$(OBJEXT) \
+ lc3bid.$(OBJEXT) gas-token.$(OBJEXT) nasm-token.$(OBJEXT) \
+ module.$(OBJEXT)
+libyasm_a_OBJECTS = $(am_libyasm_a_OBJECTS) \
+ $(nodist_libyasm_a_OBJECTS)
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS)
+am_bitvect_test_OBJECTS = bitvect_test.$(OBJEXT)
+bitvect_test_OBJECTS = $(am_bitvect_test_OBJECTS)
+am__DEPENDENCIES_1 =
+bitvect_test_DEPENDENCIES = libyasm.a $(am__DEPENDENCIES_1)
+am_combpath_test_OBJECTS = combpath_test.$(OBJEXT)
+combpath_test_OBJECTS = $(am_combpath_test_OBJECTS)
+combpath_test_DEPENDENCIES = libyasm.a $(am__DEPENDENCIES_1)
+am_floatnum_test_OBJECTS = floatnum_test.$(OBJEXT)
+floatnum_test_OBJECTS = $(am_floatnum_test_OBJECTS)
+floatnum_test_DEPENDENCIES = libyasm.a $(am__DEPENDENCIES_1)
+am_genmacro_OBJECTS =
+genmacro_OBJECTS = $(am_genmacro_OBJECTS)
+genmacro_DEPENDENCIES = genmacro.$(OBJEXT)
+am_genmodule_OBJECTS =
+genmodule_OBJECTS = $(am_genmodule_OBJECTS)
+genmodule_DEPENDENCIES = genmodule.$(OBJEXT)
+am_genperf_OBJECTS =
+genperf_OBJECTS = $(am_genperf_OBJECTS)
+genperf_DEPENDENCIES = genperf.$(OBJEXT) gp-perfect.$(OBJEXT) \
+ gp-phash.$(OBJEXT) gp-xmalloc.$(OBJEXT) gp-xstrdup.$(OBJEXT)
+am_genstring_OBJECTS =
+genstring_OBJECTS = $(am_genstring_OBJECTS)
+genstring_DEPENDENCIES = genstring.$(OBJEXT)
+am_genversion_OBJECTS =
+genversion_OBJECTS = $(am_genversion_OBJECTS)
+genversion_DEPENDENCIES = genversion.$(OBJEXT)
+am_leb128_test_OBJECTS = leb128_test.$(OBJEXT)
+leb128_test_OBJECTS = $(am_leb128_test_OBJECTS)
+leb128_test_DEPENDENCIES = libyasm.a $(am__DEPENDENCIES_1)
+am_re2c_OBJECTS =
+re2c_OBJECTS = $(am_re2c_OBJECTS)
+re2c_DEPENDENCIES = re2c-main.$(OBJEXT) re2c-code.$(OBJEXT) \
+ re2c-dfa.$(OBJEXT) re2c-parser.$(OBJEXT) \
+ re2c-actions.$(OBJEXT) re2c-scanner.$(OBJEXT) \
+ re2c-mbo_getopt.$(OBJEXT) re2c-substr.$(OBJEXT) \
+ re2c-translate.$(OBJEXT)
+am_splitpath_test_OBJECTS = splitpath_test.$(OBJEXT)
+splitpath_test_OBJECTS = $(am_splitpath_test_OBJECTS)
+splitpath_test_DEPENDENCIES = libyasm.a $(am__DEPENDENCIES_1)
+am_test_hd_OBJECTS = test_hd.$(OBJEXT)
+test_hd_OBJECTS = $(am_test_hd_OBJECTS)
+test_hd_LDADD = $(LDADD)
+am_uncstring_test_OBJECTS = uncstring_test.$(OBJEXT)
+uncstring_test_OBJECTS = $(am_uncstring_test_OBJECTS)
+uncstring_test_DEPENDENCIES = libyasm.a $(am__DEPENDENCIES_1)
+am_yasm_OBJECTS = yasm.$(OBJEXT) yasm-options.$(OBJEXT)
+yasm_OBJECTS = $(am_yasm_OBJECTS)
+yasm_DEPENDENCIES = libyasm.a $(am__DEPENDENCIES_1)
+am_ytasm_OBJECTS = tasm.$(OBJEXT) tasm-options.$(OBJEXT)
+ytasm_OBJECTS = $(am_ytasm_OBJECTS)
+ytasm_DEPENDENCIES = libyasm.a $(am__DEPENDENCIES_1)
+DEFAULT_INCLUDES = -I. -I$(srcdir)
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libyasm_a_SOURCES) $(nodist_libyasm_a_SOURCES) \
+ $(bitvect_test_SOURCES) $(combpath_test_SOURCES) \
+ $(floatnum_test_SOURCES) $(genmacro_SOURCES) \
+ $(genmodule_SOURCES) $(genperf_SOURCES) $(genstring_SOURCES) \
+ $(genversion_SOURCES) $(leb128_test_SOURCES) $(re2c_SOURCES) \
+ $(splitpath_test_SOURCES) $(test_hd_SOURCES) \
+ $(uncstring_test_SOURCES) $(yasm_SOURCES) $(ytasm_SOURCES)
+DIST_SOURCES = $(libyasm_a_SOURCES) $(bitvect_test_SOURCES) \
+ $(combpath_test_SOURCES) $(floatnum_test_SOURCES) \
+ $(genmacro_SOURCES) $(genmodule_SOURCES) $(genperf_SOURCES) \
+ $(genstring_SOURCES) $(genversion_SOURCES) \
+ $(leb128_test_SOURCES) $(re2c_SOURCES) \
+ $(splitpath_test_SOURCES) $(test_hd_SOURCES) \
+ $(uncstring_test_SOURCES) $(yasm_SOURCES) $(ytasm_SOURCES)
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-dvi-recursive install-exec-recursive \
+ install-html-recursive install-info-recursive \
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
+man1dir = $(mandir)/man1
+man7dir = $(mandir)/man7
+NROFF = nroff
+MANS = $(dist_man_MANS)
+includeHEADERS_INSTALL = $(INSTALL_HEADER)
+modincludeHEADERS_INSTALL = $(INSTALL_HEADER)
+nodist_includeHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(include_HEADERS) $(modinclude_HEADERS) \
+ $(nodist_include_HEADERS) $(noinst_HEADERS)
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+distdir = $(PACKAGE)-$(VERSION)
+top_distdir = $(distdir)
+am__remove_distdir = \
+ { test ! -d $(distdir) \
+ || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
+ && rm -fr $(distdir); }; }
+DIST_ARCHIVES = $(distdir).tar.gz
+GZIP_ENV = --best
+distuninstallcheck_listfiles = find . -type f -print
+distcleancheck_listfiles = find . -type f -print
+ACLOCAL = ${SHELL} /workspace/ajwong/git-chrome/src/third_party/yasm/source/patched-yasm/config/missing --run aclocal-1.10
+AMTAR = ${SHELL} /workspace/ajwong/git-chrome/src/third_party/yasm/source/patched-yasm/config/missing --run tar
+ARCH = x86
+AUTOCONF = ${SHELL} /workspace/ajwong/git-chrome/src/third_party/yasm/source/patched-yasm/config/missing --run autoconf
+AUTOHEADER = ${SHELL} /workspace/ajwong/git-chrome/src/third_party/yasm/source/patched-yasm/config/missing --run autoheader
+AUTOMAKE = ${SHELL} /workspace/ajwong/git-chrome/src/third_party/yasm/source/patched-yasm/config/missing --run automake-1.10
+AWK = awk
+CC = gcc -std=gnu99
+CCDEPMODE = depmode=gcc3
+CCLD_FOR_BUILD = gcc -std=gnu99
+CC_FOR_BUILD = gcc -std=gnu99
+CFLAGS = -g -O2
+CPP = gcc -E
+CPPFLAGS =
+CYGPATH_W = echo
+DEFS = -DHAVE_CONFIG_H
+DEPDIR = .deps
+ECHO_C = \c
+ECHO_N =
+ECHO_T =
+EGREP = /usr/bin/grep -E
+EXEEXT =
+GCC = yes
+GMSGFMT = /opt/local/bin/msgfmt
+GMSGFMT_015 = /opt/local/bin/msgfmt
+GREP = /usr/bin/grep
+HOST_CC = gcc -std=gnu99
+INSTALL = /usr/bin/install -c
+INSTALL_DATA = ${INSTALL} -m 644
+INSTALL_PROGRAM = ${INSTALL}
+INSTALL_SCRIPT = ${INSTALL}
+INSTALL_STRIP_PROGRAM = $(install_sh) -c -s
+INTLLIBS =
+INTL_MACOSX_LIBS = -Wl,-framework -Wl,CoreFoundation
+LDFLAGS =
+LIBICONV = -liconv
+LIBINTL =
+LIBOBJS =
+LIBS =
+LN_S = ln -s
+LTLIBICONV = -liconv
+LTLIBINTL =
+LTLIBOBJS =
+MAINT = #
+MAKEINFO = ${SHELL} /workspace/ajwong/git-chrome/src/third_party/yasm/source/patched-yasm/config/missing --run makeinfo
+MKDIR_P = /workspace/ajwong/git-chrome/src/third_party/yasm/source/patched-yasm/config/install-sh -c -d
+MORE_CFLAGS =
+MSGFMT = /opt/local/bin/msgfmt
+MSGFMT_015 = /opt/local/bin/msgfmt
+MSGMERGE = /opt/local/bin/msgmerge
+OBJEXT = o
+PACKAGE = yasm
+PACKAGE_BUGREPORT = bug-yasm@tortall.net
+PACKAGE_NAME = yasm
+PACKAGE_STRING = yasm 0.8.0
+PACKAGE_TARNAME = yasm
+PACKAGE_VERSION = 0.8.0
+PATH_SEPARATOR = :
+POSUB =
+PYTHON = /usr/bin/python
+PYTHON_EXEC_PREFIX = ${exec_prefix}
+PYTHON_INCLUDES =
+PYTHON_PLATFORM = darwin
+PYTHON_PREFIX = ${prefix}
+PYTHON_VERSION = 2.5
+RANLIB = ranlib
+SET_MAKE =
+SHELL = /bin/sh
+STRIP =
+USE_NLS = no
+VERSION = 0.8.0
+XGETTEXT = /opt/local/bin/xgettext
+XGETTEXT_015 = /opt/local/bin/xgettext
+XMLTO = :
+abs_builddir = /tmp/yasm
+abs_srcdir = /workspace/ajwong/git-chrome/src/third_party/yasm/source/patched-yasm
+abs_top_builddir = /tmp/yasm
+abs_top_srcdir = /workspace/ajwong/git-chrome/src/third_party/yasm/source/patched-yasm
+ac_ct_CC = gcc
+am__include = include
+am__leading_dot = .
+am__quote =
+am__tar = ${AMTAR} chof - "$$tardir"
+am__untar = ${AMTAR} xf -
+bindir = ${exec_prefix}/bin
+build = i686-apple-darwin9.8.0
+build_alias =
+build_cpu = i686
+build_os = darwin9.8.0
+build_vendor = apple
+builddir = .
+datadir = ${datarootdir}
+datarootdir = ${prefix}/share
+docdir = ${datarootdir}/doc/${PACKAGE_TARNAME}
+dvidir = ${docdir}
+exec_prefix = ${prefix}
+host = i686-apple-darwin9.8.0
+host_alias =
+host_cpu = i686
+host_os = darwin9.8.0
+host_vendor = apple
+htmldir = ${docdir}
+includedir = ${prefix}/include
+infodir = ${datarootdir}/info
+install_sh = $(SHELL) /workspace/ajwong/git-chrome/src/third_party/yasm/source/patched-yasm/config/install-sh
+libdir = ${exec_prefix}/lib
+libexecdir = ${exec_prefix}/libexec
+localedir = ${datarootdir}/locale
+localstatedir = ${prefix}/var
+mandir = ${datarootdir}/man
+mkdir_p = /workspace/ajwong/git-chrome/src/third_party/yasm/source/patched-yasm/config/install-sh -c -d
+oldincludedir = /usr/include
+pdfdir = ${docdir}
+pkgpyexecdir = ${pyexecdir}/yasm
+pkgpythondir = ${pythondir}/yasm
+prefix = /usr/local
+program_transform_name = s,x,x,
+psdir = ${docdir}
+pyexecdir = /Library/Python/2.5/site-packages
+pythondir = /Library/Python/2.5/site-packages
+sbindir = ${exec_prefix}/sbin
+sharedstatedir = ${prefix}/com
+srcdir = /workspace/ajwong/git-chrome/src/third_party/yasm/source/patched-yasm
+sysconfdir = ${prefix}/etc
+target_alias =
+top_builddir = .
+top_srcdir = /workspace/ajwong/git-chrome/src/third_party/yasm/source/patched-yasm
+SUBDIRS = po .
+AM_YFLAGS = -d
+AM_CFLAGS =
+
+#!include modules/objfmts/omf/Makefile.inc
+dist_man_MANS = yasm_arch.7 yasm_parsers.7 yasm_dbgfmts.7 \
+ yasm_objfmts.7 yasm.1
+TESTS_ENVIRONMENT = $(am__append_2)
+test_hd_SOURCES = test_hd.c
+include_HEADERS = libyasm.h
+nodist_include_HEADERS = libyasm-stdint.h
+noinst_HEADERS = util.h
+BUILT_SOURCES = x86insns.c x86insn_nasm.gperf x86insn_gas.gperf \
+ x86insn_nasm.c x86insn_gas.c gas-token.c nasm-token.c \
+ nasm-macros.c nasm-version.c version.mac win64-nasm.c \
+ win64-gas.c license.c
+MAINTAINERCLEANFILES = x86insns.c x86insn_nasm.gperf x86insn_gas.gperf \
+ $(am__append_4)
+
+# Until this gets fixed in automake
+DISTCLEANFILES = libyasm/stamp-h libyasm/stamp-h[0-9]*
+
+# Suffix rule for genperf
+SUFFIXES = .gperf
+
+# configure.lineno doesn't clean up after itself?
+CLEANFILES = configure.lineno $(am__append_1) x86insn_nasm.c \
+ x86insn_gas.c x86cpu.c x86regtmod.c lc3bid.c gas-token.c \
+ nasm-token.c nasm-macros.c nasm-version.c version.mac \
+ win64-nasm.c win64-gas.c module.c license.c
+
+# automake doesn't distribute mkinstalldirs?
+#!EXTRA_DIST += modules/objfmts/omf/Makefile.inc
+EXTRA_DIST = config/config.rpath config/mkinstalldirs \
+ tools/Makefile.inc libyasm/Makefile.inc modules/Makefile.inc \
+ frontends/Makefile.inc tools/re2c/Makefile.inc \
+ tools/genmacro/Makefile.inc tools/genperf/Makefile.inc \
+ tools/python-yasm/Makefile.inc tools/re2c/main.c \
+ tools/re2c/basics.h tools/re2c/globals.h tools/re2c/ins.h \
+ tools/re2c/re.h tools/re2c/token.h tools/re2c/code.c \
+ tools/re2c/dfa.h tools/re2c/dfa.c tools/re2c/parse.h \
+ tools/re2c/parser.h tools/re2c/parser.c tools/re2c/actions.c \
+ tools/re2c/scanner.h tools/re2c/scanner.c \
+ tools/re2c/mbo_getopt.h tools/re2c/mbo_getopt.c \
+ tools/re2c/substr.h tools/re2c/substr.c tools/re2c/translate.c \
+ tools/re2c/CHANGELOG tools/re2c/NO_WARRANTY tools/re2c/README \
+ tools/re2c/scanner.re tools/re2c/re2c.1 \
+ tools/re2c/bootstrap/scanner.c tools/re2c/doc/loplas.ps.gz \
+ tools/re2c/doc/sample.bib tools/re2c/examples/basemmap.c \
+ tools/re2c/examples/c.re tools/re2c/examples/cmmap.re \
+ tools/re2c/examples/cnokw.re tools/re2c/examples/cunroll.re \
+ tools/re2c/examples/modula.re tools/re2c/examples/repeater.re \
+ tools/re2c/examples/sample.re tools/re2c/examples/simple.re \
+ tools/re2c/examples/rexx/README \
+ tools/re2c/examples/rexx/rexx.l \
+ tools/re2c/examples/rexx/scanio.c tools/genmacro/genmacro.c \
+ tools/genperf/genperf.c tools/genperf/perfect.c \
+ tools/genperf/perfect.h tools/genperf/standard.h \
+ tools/python-yasm/pyxelator/cparse.py \
+ tools/python-yasm/pyxelator/genpyx.py \
+ tools/python-yasm/pyxelator/ir.py \
+ tools/python-yasm/pyxelator/lexer.py \
+ tools/python-yasm/pyxelator/node.py \
+ tools/python-yasm/pyxelator/parse_core.py \
+ tools/python-yasm/pyxelator/work_unit.py \
+ tools/python-yasm/pyxelator/wrap_yasm.py \
+ tools/python-yasm/setup.py tools/python-yasm/yasm.pyx \
+ $(PYBINDING_DEPS) tools/python-yasm/tests/Makefile.inc \
+ tools/python-yasm/tests/python_test.sh \
+ tools/python-yasm/tests/__init__.py \
+ tools/python-yasm/tests/test_bytecode.py \
+ tools/python-yasm/tests/test_expr.py \
+ tools/python-yasm/tests/test_intnum.py \
+ tools/python-yasm/tests/test_symrec.py \
+ modules/arch/Makefile.inc modules/listfmts/Makefile.inc \
+ modules/parsers/Makefile.inc modules/preprocs/Makefile.inc \
+ modules/objfmts/Makefile.inc modules/arch/x86/Makefile.inc \
+ modules/arch/lc3b/Makefile.inc \
+ modules/arch/x86/gen_x86_insn.py x86insns.c x86insn_nasm.gperf \
+ x86insn_gas.gperf modules/arch/x86/x86cpu.gperf \
+ modules/arch/x86/x86regtmod.gperf \
+ modules/arch/x86/tests/Makefile.inc \
+ modules/arch/x86/tests/x86_test.sh \
+ modules/arch/x86/tests/gen-fma-test.py \
+ modules/arch/x86/tests/addbyte.asm \
+ modules/arch/x86/tests/addbyte.errwarn \
+ modules/arch/x86/tests/addbyte.hex \
+ modules/arch/x86/tests/addrop.asm \
+ modules/arch/x86/tests/addrop.errwarn \
+ modules/arch/x86/tests/addrop.hex \
+ modules/arch/x86/tests/addrop-err.asm \
+ modules/arch/x86/tests/addrop-err.errwarn \
+ modules/arch/x86/tests/aes.asm modules/arch/x86/tests/aes.hex \
+ modules/arch/x86/tests/amd200707.asm \
+ modules/arch/x86/tests/amd200707.hex \
+ modules/arch/x86/tests/arithsmall.asm \
+ modules/arch/x86/tests/arithsmall.errwarn \
+ modules/arch/x86/tests/arithsmall.hex \
+ modules/arch/x86/tests/avx.asm modules/arch/x86/tests/avx.hex \
+ modules/arch/x86/tests/avxcc.asm \
+ modules/arch/x86/tests/avxcc.hex \
+ modules/arch/x86/tests/bittest.asm \
+ modules/arch/x86/tests/bittest.hex \
+ modules/arch/x86/tests/bswap64.asm \
+ modules/arch/x86/tests/bswap64.hex \
+ modules/arch/x86/tests/clmul.asm \
+ modules/arch/x86/tests/clmul.hex \
+ modules/arch/x86/tests/cmpxchg.asm \
+ modules/arch/x86/tests/cmpxchg.hex \
+ modules/arch/x86/tests/cpubasic-err.asm \
+ modules/arch/x86/tests/cpubasic-err.errwarn \
+ modules/arch/x86/tests/cyrix.asm \
+ modules/arch/x86/tests/cyrix.hex \
+ modules/arch/x86/tests/div-err.asm \
+ modules/arch/x86/tests/div-err.errwarn \
+ modules/arch/x86/tests/ea-nonzero.asm \
+ modules/arch/x86/tests/ea-nonzero.hex \
+ modules/arch/x86/tests/ea-over.asm \
+ modules/arch/x86/tests/ea-over.errwarn \
+ modules/arch/x86/tests/ea-over.hex \
+ modules/arch/x86/tests/ea-warn.asm \
+ modules/arch/x86/tests/ea-warn.errwarn \
+ modules/arch/x86/tests/ea-warn.hex \
+ modules/arch/x86/tests/ebpindex.asm \
+ modules/arch/x86/tests/ebpindex.hex \
+ modules/arch/x86/tests/effaddr.asm \
+ modules/arch/x86/tests/effaddr.hex \
+ modules/arch/x86/tests/enter.asm \
+ modules/arch/x86/tests/enter.errwarn \
+ modules/arch/x86/tests/enter.hex \
+ modules/arch/x86/tests/far64.asm \
+ modules/arch/x86/tests/far64.hex \
+ modules/arch/x86/tests/farbasic.asm \
+ modules/arch/x86/tests/farbasic.hex \
+ modules/arch/x86/tests/farithr.asm \
+ modules/arch/x86/tests/farithr.hex \
+ modules/arch/x86/tests/fcmov.asm \
+ modules/arch/x86/tests/fcmov.hex \
+ modules/arch/x86/tests/fma.asm modules/arch/x86/tests/fma.hex \
+ modules/arch/x86/tests/fwdequ64.asm \
+ modules/arch/x86/tests/fwdequ64.hex \
+ modules/arch/x86/tests/genopcode.asm \
+ modules/arch/x86/tests/genopcode.hex \
+ modules/arch/x86/tests/imm64.asm \
+ modules/arch/x86/tests/imm64.errwarn \
+ modules/arch/x86/tests/imm64.hex \
+ modules/arch/x86/tests/iret.asm \
+ modules/arch/x86/tests/iret.hex \
+ modules/arch/x86/tests/jmp64-1.asm \
+ modules/arch/x86/tests/jmp64-1.hex \
+ modules/arch/x86/tests/jmp64-2.asm \
+ modules/arch/x86/tests/jmp64-2.hex \
+ modules/arch/x86/tests/jmp64-3.asm \
+ modules/arch/x86/tests/jmp64-3.hex \
+ modules/arch/x86/tests/jmp64-4.asm \
+ modules/arch/x86/tests/jmp64-4.hex \
+ modules/arch/x86/tests/jmp64-5.asm \
+ modules/arch/x86/tests/jmp64-5.hex \
+ modules/arch/x86/tests/jmp64-6.asm \
+ modules/arch/x86/tests/jmp64-6.hex \
+ modules/arch/x86/tests/jmpfar.asm \
+ modules/arch/x86/tests/jmpfar.hex \
+ modules/arch/x86/tests/lds.asm modules/arch/x86/tests/lds.hex \
+ modules/arch/x86/tests/loopadsz.asm \
+ modules/arch/x86/tests/loopadsz.hex \
+ modules/arch/x86/tests/lsahf.asm \
+ modules/arch/x86/tests/lsahf.hex \
+ modules/arch/x86/tests/mem64-err.asm \
+ modules/arch/x86/tests/mem64-err.errwarn \
+ modules/arch/x86/tests/mem64.asm \
+ modules/arch/x86/tests/mem64.errwarn \
+ modules/arch/x86/tests/mem64.hex \
+ modules/arch/x86/tests/mem64hi32.asm \
+ modules/arch/x86/tests/mem64hi32.hex \
+ modules/arch/x86/tests/mem64rip.asm \
+ modules/arch/x86/tests/mem64rip.hex \
+ modules/arch/x86/tests/mixcase.asm \
+ modules/arch/x86/tests/mixcase.hex \
+ modules/arch/x86/tests/movbe.asm \
+ modules/arch/x86/tests/movbe.hex \
+ modules/arch/x86/tests/movdq32.asm \
+ modules/arch/x86/tests/movdq32.hex \
+ modules/arch/x86/tests/movdq64.asm \
+ modules/arch/x86/tests/movdq64.hex \
+ modules/arch/x86/tests/negequ.asm \
+ modules/arch/x86/tests/negequ.hex \
+ modules/arch/x86/tests/nomem64-err.asm \
+ modules/arch/x86/tests/nomem64-err.errwarn \
+ modules/arch/x86/tests/nomem64-err2.asm \
+ modules/arch/x86/tests/nomem64-err2.errwarn \
+ modules/arch/x86/tests/nomem64.asm \
+ modules/arch/x86/tests/nomem64.errwarn \
+ modules/arch/x86/tests/nomem64.hex \
+ modules/arch/x86/tests/o64.asm modules/arch/x86/tests/o64.hex \
+ modules/arch/x86/tests/o64loop.asm \
+ modules/arch/x86/tests/o64loop.errwarn \
+ modules/arch/x86/tests/o64loop.hex \
+ modules/arch/x86/tests/opersize.asm \
+ modules/arch/x86/tests/opersize.hex \
+ modules/arch/x86/tests/opsize-err.asm \
+ modules/arch/x86/tests/opsize-err.errwarn \
+ modules/arch/x86/tests/overflow.asm \
+ modules/arch/x86/tests/overflow.errwarn \
+ modules/arch/x86/tests/overflow.hex \
+ modules/arch/x86/tests/padlock.asm \
+ modules/arch/x86/tests/padlock.hex \
+ modules/arch/x86/tests/pshift.asm \
+ modules/arch/x86/tests/pshift.hex \
+ modules/arch/x86/tests/push64.asm \
+ modules/arch/x86/tests/push64.errwarn \
+ modules/arch/x86/tests/push64.hex \
+ modules/arch/x86/tests/pushf.asm \
+ modules/arch/x86/tests/pushf.hex \
+ modules/arch/x86/tests/pushf-err.asm \
+ modules/arch/x86/tests/pushf-err.errwarn \
+ modules/arch/x86/tests/pushnosize.asm \
+ modules/arch/x86/tests/pushnosize.errwarn \
+ modules/arch/x86/tests/pushnosize.hex \
+ modules/arch/x86/tests/rep.asm modules/arch/x86/tests/rep.hex \
+ modules/arch/x86/tests/ret.asm modules/arch/x86/tests/ret.hex \
+ modules/arch/x86/tests/riprel1.asm \
+ modules/arch/x86/tests/riprel1.hex \
+ modules/arch/x86/tests/riprel2.asm \
+ modules/arch/x86/tests/riprel2.errwarn \
+ modules/arch/x86/tests/riprel2.hex \
+ modules/arch/x86/tests/ripseg.asm \
+ modules/arch/x86/tests/ripseg.errwarn \
+ modules/arch/x86/tests/ripseg.hex \
+ modules/arch/x86/tests/segmov.asm \
+ modules/arch/x86/tests/segmov.hex \
+ modules/arch/x86/tests/segoff.asm \
+ modules/arch/x86/tests/segoff.hex \
+ modules/arch/x86/tests/segoff-err.asm \
+ modules/arch/x86/tests/segoff-err.errwarn \
+ modules/arch/x86/tests/shift.asm \
+ modules/arch/x86/tests/shift.hex \
+ modules/arch/x86/tests/simd-1.asm \
+ modules/arch/x86/tests/simd-1.hex \
+ modules/arch/x86/tests/simd-2.asm \
+ modules/arch/x86/tests/simd-2.hex \
+ modules/arch/x86/tests/simd64-1.asm \
+ modules/arch/x86/tests/simd64-1.hex \
+ modules/arch/x86/tests/simd64-2.asm \
+ modules/arch/x86/tests/simd64-2.hex \
+ modules/arch/x86/tests/sse-prefix.asm \
+ modules/arch/x86/tests/sse-prefix.hex \
+ modules/arch/x86/tests/sse3.asm \
+ modules/arch/x86/tests/sse3.hex \
+ modules/arch/x86/tests/sse4.asm \
+ modules/arch/x86/tests/sse4.hex \
+ modules/arch/x86/tests/sse4-err.asm \
+ modules/arch/x86/tests/sse4-err.errwarn \
+ modules/arch/x86/tests/sse5-all.asm \
+ modules/arch/x86/tests/sse5-all.hex \
+ modules/arch/x86/tests/sse5-basic.asm \
+ modules/arch/x86/tests/sse5-basic.hex \
+ modules/arch/x86/tests/sse5-cc.asm \
+ modules/arch/x86/tests/sse5-cc.hex \
+ modules/arch/x86/tests/sse5-err.asm \
+ modules/arch/x86/tests/sse5-err.errwarn \
+ modules/arch/x86/tests/ssewidth.asm \
+ modules/arch/x86/tests/ssewidth.hex \
+ modules/arch/x86/tests/ssse3.asm \
+ modules/arch/x86/tests/ssse3.c \
+ modules/arch/x86/tests/ssse3.hex \
+ modules/arch/x86/tests/stos.asm \
+ modules/arch/x86/tests/stos.hex modules/arch/x86/tests/str.asm \
+ modules/arch/x86/tests/str.hex \
+ modules/arch/x86/tests/strict.asm \
+ modules/arch/x86/tests/strict.errwarn \
+ modules/arch/x86/tests/strict.hex \
+ modules/arch/x86/tests/strict-err.asm \
+ modules/arch/x86/tests/strict-err.errwarn \
+ modules/arch/x86/tests/stringseg.asm \
+ modules/arch/x86/tests/stringseg.errwarn \
+ modules/arch/x86/tests/stringseg.hex \
+ modules/arch/x86/tests/svm.asm modules/arch/x86/tests/svm.hex \
+ modules/arch/x86/tests/twobytemem.asm \
+ modules/arch/x86/tests/twobytemem.errwarn \
+ modules/arch/x86/tests/twobytemem.hex \
+ modules/arch/x86/tests/vmx.asm modules/arch/x86/tests/vmx.hex \
+ modules/arch/x86/tests/vmx-err.asm \
+ modules/arch/x86/tests/vmx-err.errwarn \
+ modules/arch/x86/tests/x86label.asm \
+ modules/arch/x86/tests/x86label.hex \
+ modules/arch/x86/tests/xchg64.asm \
+ modules/arch/x86/tests/xchg64.hex \
+ modules/arch/x86/tests/xmm64.asm \
+ modules/arch/x86/tests/xmm64.hex \
+ modules/arch/x86/tests/xsave.asm \
+ modules/arch/x86/tests/xsave.hex \
+ modules/arch/x86/tests/gas32/Makefile.inc \
+ modules/arch/x86/tests/gas64/Makefile.inc \
+ modules/arch/x86/tests/gas32/x86_gas32_test.sh \
+ modules/arch/x86/tests/gas32/align32.asm \
+ modules/arch/x86/tests/gas32/align32.hex \
+ modules/arch/x86/tests/gas32/gas-farithr.asm \
+ modules/arch/x86/tests/gas32/gas-farithr.hex \
+ modules/arch/x86/tests/gas32/gas-fpmem.asm \
+ modules/arch/x86/tests/gas32/gas-fpmem.hex \
+ modules/arch/x86/tests/gas32/gas-movdq32.asm \
+ modules/arch/x86/tests/gas32/gas-movdq32.hex \
+ modules/arch/x86/tests/gas32/gas-movsd.asm \
+ modules/arch/x86/tests/gas32/gas-movsd.hex \
+ modules/arch/x86/tests/gas32/gas32-jmpcall.asm \
+ modules/arch/x86/tests/gas32/gas32-jmpcall.hex \
+ modules/arch/x86/tests/gas64/x86_gas64_test.sh \
+ modules/arch/x86/tests/gas64/align64.asm \
+ modules/arch/x86/tests/gas64/align64.hex \
+ modules/arch/x86/tests/gas64/gas-cbw.asm \
+ modules/arch/x86/tests/gas64/gas-cbw.hex \
+ modules/arch/x86/tests/gas64/gas-fp.asm \
+ modules/arch/x86/tests/gas64/gas-fp.hex \
+ modules/arch/x86/tests/gas64/gas-inout.asm \
+ modules/arch/x86/tests/gas64/gas-inout.hex \
+ modules/arch/x86/tests/gas64/gas-moreinsn.asm \
+ modules/arch/x86/tests/gas64/gas-moreinsn.hex \
+ modules/arch/x86/tests/gas64/gas-movabs.asm \
+ modules/arch/x86/tests/gas64/gas-movabs.hex \
+ modules/arch/x86/tests/gas64/gas-movdq64.asm \
+ modules/arch/x86/tests/gas64/gas-movdq64.hex \
+ modules/arch/x86/tests/gas64/gas-movsxs.asm \
+ modules/arch/x86/tests/gas64/gas-movsxs.hex \
+ modules/arch/x86/tests/gas64/gas-muldiv.asm \
+ modules/arch/x86/tests/gas64/gas-muldiv.hex \
+ modules/arch/x86/tests/gas64/gas-prefix.asm \
+ modules/arch/x86/tests/gas64/gas-prefix.errwarn \
+ modules/arch/x86/tests/gas64/gas-prefix.hex \
+ modules/arch/x86/tests/gas64/gas-retenter.asm \
+ modules/arch/x86/tests/gas64/gas-retenter.hex \
+ modules/arch/x86/tests/gas64/gas-shift.asm \
+ modules/arch/x86/tests/gas64/gas-shift.hex \
+ modules/arch/x86/tests/gas64/gas64-jmpcall.asm \
+ modules/arch/x86/tests/gas64/gas64-jmpcall.hex \
+ modules/arch/x86/tests/gas64/riprel.asm \
+ modules/arch/x86/tests/gas64/riprel.hex \
+ modules/arch/lc3b/tests/Makefile.inc \
+ modules/arch/lc3b/lc3bid.re \
+ modules/arch/lc3b/tests/lc3b_test.sh \
+ modules/arch/lc3b/tests/lc3b-basic.asm \
+ modules/arch/lc3b/tests/lc3b-basic.errwarn \
+ modules/arch/lc3b/tests/lc3b-basic.hex \
+ modules/arch/lc3b/tests/lc3b-br.asm \
+ modules/arch/lc3b/tests/lc3b-br.hex \
+ modules/arch/lc3b/tests/lc3b-ea-err.asm \
+ modules/arch/lc3b/tests/lc3b-ea-err.errwarn \
+ modules/arch/lc3b/tests/lc3b-mp22NC.asm \
+ modules/arch/lc3b/tests/lc3b-mp22NC.hex \
+ modules/arch/yasm_arch.xml modules/listfmts/nasm/Makefile.inc \
+ modules/parsers/gas/Makefile.inc \
+ modules/parsers/nasm/Makefile.inc \
+ modules/parsers/gas/tests/Makefile.inc \
+ modules/parsers/gas/gas-token.re \
+ modules/parsers/gas/tests/gas_test.sh \
+ modules/parsers/gas/tests/dataref-imm.asm \
+ modules/parsers/gas/tests/dataref-imm.hex \
+ modules/parsers/gas/tests/datavis.asm \
+ modules/parsers/gas/tests/datavis.errwarn \
+ modules/parsers/gas/tests/datavis.hex \
+ modules/parsers/gas/tests/datavis2.asm \
+ modules/parsers/gas/tests/datavis2.hex \
+ modules/parsers/gas/tests/execsect.asm \
+ modules/parsers/gas/tests/execsect.hex \
+ modules/parsers/gas/tests/gas-fill.asm \
+ modules/parsers/gas/tests/gas-fill.hex \
+ modules/parsers/gas/tests/gas-float.asm \
+ modules/parsers/gas/tests/gas-float.hex \
+ modules/parsers/gas/tests/gas-instlabel.asm \
+ modules/parsers/gas/tests/gas-instlabel.hex \
+ modules/parsers/gas/tests/gas-line-err.asm \
+ modules/parsers/gas/tests/gas-line-err.errwarn \
+ modules/parsers/gas/tests/gas-line2-err.asm \
+ modules/parsers/gas/tests/gas-line2-err.errwarn \
+ modules/parsers/gas/tests/gas-push.asm \
+ modules/parsers/gas/tests/gas-push.hex \
+ modules/parsers/gas/tests/gas-segprefix.asm \
+ modules/parsers/gas/tests/gas-segprefix.hex \
+ modules/parsers/gas/tests/gas-semi.asm \
+ modules/parsers/gas/tests/gas-semi.hex \
+ modules/parsers/gas/tests/gassectalign.asm \
+ modules/parsers/gas/tests/gassectalign.hex \
+ modules/parsers/gas/tests/jmpcall.asm \
+ modules/parsers/gas/tests/jmpcall.errwarn \
+ modules/parsers/gas/tests/jmpcall.hex \
+ modules/parsers/gas/tests/leb128.asm \
+ modules/parsers/gas/tests/leb128.hex \
+ modules/parsers/gas/tests/localcomm.asm \
+ modules/parsers/gas/tests/localcomm.hex \
+ modules/parsers/gas/tests/reggroup-err.asm \
+ modules/parsers/gas/tests/reggroup-err.errwarn \
+ modules/parsers/gas/tests/reggroup.asm \
+ modules/parsers/gas/tests/reggroup.hex \
+ modules/parsers/gas/tests/strzero.asm \
+ modules/parsers/gas/tests/strzero.hex \
+ modules/parsers/gas/tests/varinsn.asm \
+ modules/parsers/gas/tests/varinsn.hex \
+ modules/parsers/gas/tests/bin/Makefile.inc \
+ modules/parsers/gas/tests/bin/gas_bin_test.sh \
+ modules/parsers/gas/tests/bin/gas-comment.asm \
+ modules/parsers/gas/tests/bin/gas-comment.errwarn \
+ modules/parsers/gas/tests/bin/gas-comment.hex \
+ modules/parsers/gas/tests/bin/gas-llabel.asm \
+ modules/parsers/gas/tests/bin/gas-llabel.hex \
+ modules/parsers/gas/tests/bin/gas-set.asm \
+ modules/parsers/gas/tests/bin/gas-set.hex \
+ modules/parsers/gas/tests/bin/rept-err.asm \
+ modules/parsers/gas/tests/bin/rept-err.errwarn \
+ modules/parsers/gas/tests/bin/reptempty.asm \
+ modules/parsers/gas/tests/bin/reptempty.hex \
+ modules/parsers/gas/tests/bin/reptlong.asm \
+ modules/parsers/gas/tests/bin/reptlong.hex \
+ modules/parsers/gas/tests/bin/reptnested-err.asm \
+ modules/parsers/gas/tests/bin/reptnested-err.errwarn \
+ modules/parsers/gas/tests/bin/reptsimple.asm \
+ modules/parsers/gas/tests/bin/reptsimple.hex \
+ modules/parsers/gas/tests/bin/reptwarn.asm \
+ modules/parsers/gas/tests/bin/reptwarn.errwarn \
+ modules/parsers/gas/tests/bin/reptwarn.hex \
+ modules/parsers/gas/tests/bin/reptzero.asm \
+ modules/parsers/gas/tests/bin/reptzero.hex \
+ modules/parsers/nasm/nasm-token.re \
+ modules/parsers/nasm/nasm-std.mac \
+ modules/parsers/nasm/tests/Makefile.inc \
+ modules/parsers/nasm/tests/nasm_test.sh \
+ modules/parsers/nasm/tests/alignnop16.asm \
+ modules/parsers/nasm/tests/alignnop16.hex \
+ modules/parsers/nasm/tests/alignnop32.asm \
+ modules/parsers/nasm/tests/alignnop32.hex \
+ modules/parsers/nasm/tests/charconstmath.asm \
+ modules/parsers/nasm/tests/charconstmath.hex \
+ modules/parsers/nasm/tests/dy.asm \
+ modules/parsers/nasm/tests/dy.hex \
+ modules/parsers/nasm/tests/endcomma.asm \
+ modules/parsers/nasm/tests/endcomma.hex \
+ modules/parsers/nasm/tests/equcolon.asm \
+ modules/parsers/nasm/tests/equcolon.hex \
+ modules/parsers/nasm/tests/equlocal.asm \
+ modules/parsers/nasm/tests/equlocal.hex \
+ modules/parsers/nasm/tests/hexconst.asm \
+ modules/parsers/nasm/tests/hexconst.hex \
+ modules/parsers/nasm/tests/long.asm \
+ modules/parsers/nasm/tests/long.hex \
+ modules/parsers/nasm/tests/locallabel.asm \
+ modules/parsers/nasm/tests/locallabel.hex \
+ modules/parsers/nasm/tests/locallabel2.asm \
+ modules/parsers/nasm/tests/locallabel2.hex \
+ modules/parsers/nasm/tests/nasm-prefix.asm \
+ modules/parsers/nasm/tests/nasm-prefix.hex \
+ modules/parsers/nasm/tests/newsect.asm \
+ modules/parsers/nasm/tests/newsect.hex \
+ modules/parsers/nasm/tests/orphannowarn.asm \
+ modules/parsers/nasm/tests/orphannowarn.hex \
+ modules/parsers/nasm/tests/prevlocalwarn.asm \
+ modules/parsers/nasm/tests/prevlocalwarn.errwarn \
+ modules/parsers/nasm/tests/prevlocalwarn.hex \
+ modules/parsers/nasm/tests/strucalign.asm \
+ modules/parsers/nasm/tests/strucalign.hex \
+ modules/parsers/nasm/tests/struczero.asm \
+ modules/parsers/nasm/tests/struczero.hex \
+ modules/parsers/nasm/tests/syntax-err.asm \
+ modules/parsers/nasm/tests/syntax-err.errwarn \
+ modules/parsers/nasm/tests/uscore.asm \
+ modules/parsers/nasm/tests/uscore.hex \
+ modules/parsers/nasm/tests/worphan/Makefile.inc \
+ modules/parsers/nasm/tests/worphan/nasm_worphan_test.sh \
+ modules/parsers/nasm/tests/worphan/orphanwarn.asm \
+ modules/parsers/nasm/tests/worphan/orphanwarn.errwarn \
+ modules/parsers/nasm/tests/worphan/orphanwarn.hex \
+ modules/parsers/tasm/tests/Makefile.inc \
+ modules/parsers/tasm/tests/tasm_test.sh \
+ modules/parsers/tasm/tests/array.asm \
+ modules/parsers/tasm/tests/array.hex \
+ modules/parsers/tasm/tests/case.asm \
+ modules/parsers/tasm/tests/case.hex \
+ modules/parsers/tasm/tests/charstr.asm \
+ modules/parsers/tasm/tests/charstr.hex \
+ modules/parsers/tasm/tests/dup.asm \
+ modules/parsers/tasm/tests/dup.hex \
+ modules/parsers/tasm/tests/equal.asm \
+ modules/parsers/tasm/tests/equal.hex \
+ modules/parsers/tasm/tests/expr.asm \
+ modules/parsers/tasm/tests/expr.hex \
+ modules/parsers/tasm/tests/irp.asm \
+ modules/parsers/tasm/tests/irp.hex \
+ modules/parsers/tasm/tests/label.asm \
+ modules/parsers/tasm/tests/label.hex \
+ modules/parsers/tasm/tests/les.asm \
+ modules/parsers/tasm/tests/les.hex \
+ modules/parsers/tasm/tests/lidt.asm \
+ modules/parsers/tasm/tests/lidt.hex \
+ modules/parsers/tasm/tests/macro.asm \
+ modules/parsers/tasm/tests/macro.hex \
+ modules/parsers/tasm/tests/offset.asm \
+ modules/parsers/tasm/tests/offset.hex \
+ modules/parsers/tasm/tests/quote.asm \
+ modules/parsers/tasm/tests/quote.hex \
+ modules/parsers/tasm/tests/res.asm \
+ modules/parsers/tasm/tests/res.errwarn \
+ modules/parsers/tasm/tests/res.hex \
+ modules/parsers/tasm/tests/segment.asm \
+ modules/parsers/tasm/tests/segment.hex \
+ modules/parsers/tasm/tests/size.asm \
+ modules/parsers/tasm/tests/size.hex \
+ modules/parsers/tasm/tests/struc.asm \
+ modules/parsers/tasm/tests/struc.errwarn \
+ modules/parsers/tasm/tests/struc.hex \
+ modules/parsers/tasm/tests/exe/Makefile.inc \
+ modules/parsers/tasm/tests/exe/tasm_exe_test.sh \
+ modules/parsers/tasm/tests/exe/exe.asm \
+ modules/parsers/tasm/tests/exe/exe.hex \
+ modules/parsers/yasm_parsers.xml \
+ modules/preprocs/nasm/Makefile.inc \
+ modules/preprocs/raw/Makefile.inc \
+ modules/preprocs/cpp/Makefile.inc \
+ modules/preprocs/nasm/genversion.c \
+ modules/preprocs/nasm/tests/Makefile.inc \
+ modules/preprocs/nasm/tests/nasmpp_test.sh \
+ modules/preprocs/nasm/tests/16args.asm \
+ modules/preprocs/nasm/tests/16args.hex \
+ modules/preprocs/nasm/tests/ifcritical-err.asm \
+ modules/preprocs/nasm/tests/ifcritical-err.errwarn \
+ modules/preprocs/nasm/tests/longline.asm \
+ modules/preprocs/nasm/tests/longline.hex \
+ modules/preprocs/nasm/tests/macroeof-err.asm \
+ modules/preprocs/nasm/tests/macroeof-err.errwarn \
+ modules/preprocs/nasm/tests/noinclude-err.asm \
+ modules/preprocs/nasm/tests/noinclude-err.errwarn \
+ modules/preprocs/nasm/tests/nasmpp-bigint.asm \
+ modules/preprocs/nasm/tests/nasmpp-bigint.hex \
+ modules/preprocs/nasm/tests/nasmpp-decimal.asm \
+ modules/preprocs/nasm/tests/nasmpp-decimal.hex \
+ modules/preprocs/nasm/tests/nasmpp-nested.asm \
+ modules/preprocs/nasm/tests/nasmpp-nested.errwarn \
+ modules/preprocs/nasm/tests/nasmpp-nested.hex \
+ modules/preprocs/nasm/tests/orgsect.asm \
+ modules/preprocs/nasm/tests/orgsect.hex \
+ modules/preprocs/raw/tests/Makefile.inc \
+ modules/preprocs/raw/tests/rawpp_test.sh \
+ modules/preprocs/raw/tests/longline.asm \
+ modules/preprocs/raw/tests/longline.hex \
+ modules/dbgfmts/codeview/Makefile.inc \
+ modules/dbgfmts/dwarf2/Makefile.inc \
+ modules/dbgfmts/null/Makefile.inc \
+ modules/dbgfmts/stabs/Makefile.inc \
+ modules/dbgfmts/codeview/cv8.txt \
+ modules/dbgfmts/dwarf2/tests/Makefile.inc \
+ modules/dbgfmts/dwarf2/tests/pass32/Makefile.inc \
+ modules/dbgfmts/dwarf2/tests/pass64/Makefile.inc \
+ modules/dbgfmts/dwarf2/tests/passwin64/Makefile.inc \
+ modules/dbgfmts/dwarf2/tests/pass32/dwarf2_pass32_test.sh \
+ modules/dbgfmts/dwarf2/tests/pass32/dwarf32-err.asm \
+ modules/dbgfmts/dwarf2/tests/pass32/dwarf32-err.errwarn \
+ modules/dbgfmts/dwarf2/tests/pass32/dwarf32_testhd.asm \
+ modules/dbgfmts/dwarf2/tests/pass32/dwarf32_testhd.hex \
+ modules/dbgfmts/dwarf2/tests/pass64/dwarf2_pass64_test.sh \
+ modules/dbgfmts/dwarf2/tests/pass64/dwarf64_2loc.asm \
+ modules/dbgfmts/dwarf2/tests/pass64/dwarf64_2loc.hex \
+ modules/dbgfmts/dwarf2/tests/pass64/dwarf64_leb128.asm \
+ modules/dbgfmts/dwarf2/tests/pass64/dwarf64_leb128.hex \
+ modules/dbgfmts/dwarf2/tests/passwin64/dwarf2_passwin64_test.sh \
+ modules/dbgfmts/dwarf2/tests/passwin64/dwarfwin64_testhd.asm \
+ modules/dbgfmts/dwarf2/tests/passwin64/dwarfwin64_testhd.errwarn \
+ modules/dbgfmts/dwarf2/tests/passwin64/dwarfwin64_testhd.hex \
+ modules/dbgfmts/stabs/tests/Makefile.inc \
+ modules/dbgfmts/stabs/tests/stabs_test.sh \
+ modules/dbgfmts/stabs/tests/stabs-elf.asm \
+ modules/dbgfmts/stabs/tests/stabs-elf.hex \
+ modules/dbgfmts/yasm_dbgfmts.xml \
+ modules/objfmts/dbg/Makefile.inc \
+ modules/objfmts/bin/Makefile.inc \
+ modules/objfmts/elf/Makefile.inc \
+ modules/objfmts/coff/Makefile.inc \
+ modules/objfmts/macho/Makefile.inc \
+ modules/objfmts/rdf/Makefile.inc \
+ modules/objfmts/win32/Makefile.inc \
+ modules/objfmts/win64/Makefile.inc \
+ modules/objfmts/xdf/Makefile.inc \
+ modules/objfmts/bin/tests/Makefile.inc \
+ modules/objfmts/bin/tests/bin_test.sh \
+ modules/objfmts/bin/tests/abs.asm \
+ modules/objfmts/bin/tests/abs.hex \
+ modules/objfmts/bin/tests/bigorg.asm \
+ modules/objfmts/bin/tests/bigorg.hex \
+ modules/objfmts/bin/tests/bigorg.errwarn \
+ modules/objfmts/bin/tests/bin-farabs.asm \
+ modules/objfmts/bin/tests/bin-farabs.hex \
+ modules/objfmts/bin/tests/bin-rip.asm \
+ modules/objfmts/bin/tests/bin-rip.hex \
+ modules/objfmts/bin/tests/bintest.asm \
+ modules/objfmts/bin/tests/bintest.hex \
+ modules/objfmts/bin/tests/float-err.asm \
+ modules/objfmts/bin/tests/float-err.errwarn \
+ modules/objfmts/bin/tests/float.asm \
+ modules/objfmts/bin/tests/float.hex \
+ modules/objfmts/bin/tests/integer-warn.asm \
+ modules/objfmts/bin/tests/integer-warn.hex \
+ modules/objfmts/bin/tests/integer-warn.errwarn \
+ modules/objfmts/bin/tests/integer.asm \
+ modules/objfmts/bin/tests/integer.hex \
+ modules/objfmts/bin/tests/levelop.asm \
+ modules/objfmts/bin/tests/levelop.hex \
+ modules/objfmts/bin/tests/reserve.asm \
+ modules/objfmts/bin/tests/reserve.hex \
+ modules/objfmts/bin/tests/reserve.errwarn \
+ modules/objfmts/bin/tests/shr.asm \
+ modules/objfmts/bin/tests/shr.hex \
+ modules/objfmts/bin/tests/multisect/Makefile.inc \
+ modules/objfmts/bin/tests/multisect/bin_multi_test.sh \
+ modules/objfmts/bin/tests/multisect/bin-align.asm \
+ modules/objfmts/bin/tests/multisect/bin-align.errwarn \
+ modules/objfmts/bin/tests/multisect/bin-align.hex \
+ modules/objfmts/bin/tests/multisect/bin-align.map \
+ modules/objfmts/bin/tests/multisect/bin-ssym.asm \
+ modules/objfmts/bin/tests/multisect/bin-ssym.hex \
+ modules/objfmts/bin/tests/multisect/bin-ssym.map \
+ modules/objfmts/bin/tests/multisect/follows-loop1-err.asm \
+ modules/objfmts/bin/tests/multisect/follows-loop1-err.errwarn \
+ modules/objfmts/bin/tests/multisect/follows-loop2-err.asm \
+ modules/objfmts/bin/tests/multisect/follows-loop2-err.errwarn \
+ modules/objfmts/bin/tests/multisect/follows-notfound-err.asm \
+ modules/objfmts/bin/tests/multisect/follows-notfound-err.errwarn \
+ modules/objfmts/bin/tests/multisect/initbss.asm \
+ modules/objfmts/bin/tests/multisect/initbss.errwarn \
+ modules/objfmts/bin/tests/multisect/initbss.hex \
+ modules/objfmts/bin/tests/multisect/initbss.map \
+ modules/objfmts/bin/tests/multisect/ldlinux-sects.asm \
+ modules/objfmts/bin/tests/multisect/ldlinux-sects.hex \
+ modules/objfmts/bin/tests/multisect/ldlinux-sects.map \
+ modules/objfmts/bin/tests/multisect/multisect1.asm \
+ modules/objfmts/bin/tests/multisect/multisect1.hex \
+ modules/objfmts/bin/tests/multisect/multisect1.map \
+ modules/objfmts/bin/tests/multisect/multisect2.asm \
+ modules/objfmts/bin/tests/multisect/multisect2.hex \
+ modules/objfmts/bin/tests/multisect/multisect2.map \
+ modules/objfmts/bin/tests/multisect/multisect3.asm \
+ modules/objfmts/bin/tests/multisect/multisect3.hex \
+ modules/objfmts/bin/tests/multisect/multisect3.map \
+ modules/objfmts/bin/tests/multisect/multisect4.asm \
+ modules/objfmts/bin/tests/multisect/multisect4.hex \
+ modules/objfmts/bin/tests/multisect/multisect4.map \
+ modules/objfmts/bin/tests/multisect/multisect5.asm \
+ modules/objfmts/bin/tests/multisect/multisect5.hex \
+ modules/objfmts/bin/tests/multisect/multisect5.map \
+ modules/objfmts/bin/tests/multisect/nomultisect1.asm \
+ modules/objfmts/bin/tests/multisect/nomultisect1.hex \
+ modules/objfmts/bin/tests/multisect/nomultisect1.map \
+ modules/objfmts/bin/tests/multisect/nomultisect2.asm \
+ modules/objfmts/bin/tests/multisect/nomultisect2.hex \
+ modules/objfmts/bin/tests/multisect/nomultisect2.map \
+ modules/objfmts/bin/tests/multisect/vfollows-loop1-err.asm \
+ modules/objfmts/bin/tests/multisect/vfollows-loop1-err.errwarn \
+ modules/objfmts/bin/tests/multisect/vfollows-loop2-err.asm \
+ modules/objfmts/bin/tests/multisect/vfollows-loop2-err.errwarn \
+ modules/objfmts/bin/tests/multisect/vfollows-notfound-err.asm \
+ modules/objfmts/bin/tests/multisect/vfollows-notfound-err.errwarn \
+ modules/objfmts/elf/tests/Makefile.inc \
+ modules/objfmts/elf/tests/elf_test.sh \
+ modules/objfmts/elf/tests/curpos.asm \
+ modules/objfmts/elf/tests/curpos.hex \
+ modules/objfmts/elf/tests/curpos-err.asm \
+ modules/objfmts/elf/tests/curpos-err.errwarn \
+ modules/objfmts/elf/tests/elf-overdef.asm \
+ modules/objfmts/elf/tests/elf-overdef.hex \
+ modules/objfmts/elf/tests/elf-x86id.asm \
+ modules/objfmts/elf/tests/elf-x86id.hex \
+ modules/objfmts/elf/tests/elfabssect.asm \
+ modules/objfmts/elf/tests/elfabssect.hex \
+ modules/objfmts/elf/tests/elfcond.asm \
+ modules/objfmts/elf/tests/elfcond.hex \
+ modules/objfmts/elf/tests/elfequabs.asm \
+ modules/objfmts/elf/tests/elfequabs.hex \
+ modules/objfmts/elf/tests/elfglobal.asm \
+ modules/objfmts/elf/tests/elfglobal.hex \
+ modules/objfmts/elf/tests/elfglobext.asm \
+ modules/objfmts/elf/tests/elfglobext.hex \
+ modules/objfmts/elf/tests/elfglobext2.asm \
+ modules/objfmts/elf/tests/elfglobext2.hex \
+ modules/objfmts/elf/tests/elfmanysym.asm \
+ modules/objfmts/elf/tests/elfmanysym.hex \
+ modules/objfmts/elf/tests/elfreloc.asm \
+ modules/objfmts/elf/tests/elfreloc.hex \
+ modules/objfmts/elf/tests/elfreloc-ext.asm \
+ modules/objfmts/elf/tests/elfreloc-ext.hex \
+ modules/objfmts/elf/tests/elfsectalign.asm \
+ modules/objfmts/elf/tests/elfsectalign.hex \
+ modules/objfmts/elf/tests/elfso.asm \
+ modules/objfmts/elf/tests/elfso.hex \
+ modules/objfmts/elf/tests/elftest.c \
+ modules/objfmts/elf/tests/elftest.asm \
+ modules/objfmts/elf/tests/elftest.hex \
+ modules/objfmts/elf/tests/elftimes.asm \
+ modules/objfmts/elf/tests/elftimes.hex \
+ modules/objfmts/elf/tests/elftypesize.asm \
+ modules/objfmts/elf/tests/elftypesize.hex \
+ modules/objfmts/elf/tests/elfvisibility.asm \
+ modules/objfmts/elf/tests/elfvisibility.errwarn \
+ modules/objfmts/elf/tests/elfvisibility.hex \
+ modules/objfmts/elf/tests/nasm-sectname.asm \
+ modules/objfmts/elf/tests/nasm-sectname.hex \
+ modules/objfmts/elf/tests/nasm-forceident.asm \
+ modules/objfmts/elf/tests/nasm-forceident.hex \
+ modules/objfmts/elf/tests/amd64/Makefile.inc \
+ modules/objfmts/elf/tests/gas32/Makefile.inc \
+ modules/objfmts/elf/tests/gas64/Makefile.inc \
+ modules/objfmts/elf/tests/amd64/elf_amd64_test.sh \
+ modules/objfmts/elf/tests/amd64/elf-rip.asm \
+ modules/objfmts/elf/tests/amd64/elf-rip.hex \
+ modules/objfmts/elf/tests/amd64/elfso64.asm \
+ modules/objfmts/elf/tests/amd64/elfso64.hex \
+ modules/objfmts/elf/tests/amd64/gotpcrel.asm \
+ modules/objfmts/elf/tests/amd64/gotpcrel.hex \
+ modules/objfmts/elf/tests/gas32/elf_gas32_test.sh \
+ modules/objfmts/elf/tests/gas32/elf_gas32_ssym.asm \
+ modules/objfmts/elf/tests/gas32/elf_gas32_ssym.hex \
+ modules/objfmts/elf/tests/gas64/elf_gas64_test.sh \
+ modules/objfmts/elf/tests/gas64/crosssect.asm \
+ modules/objfmts/elf/tests/gas64/crosssect.hex \
+ modules/objfmts/elf/tests/gas64/elf_gas64_curpos.asm \
+ modules/objfmts/elf/tests/gas64/elf_gas64_curpos.hex \
+ modules/objfmts/elf/tests/gas64/elf_gas64_reloc.asm \
+ modules/objfmts/elf/tests/gas64/elf_gas64_reloc.hex \
+ modules/objfmts/elf/tests/gas64/elf_gas64_ssym.asm \
+ modules/objfmts/elf/tests/gas64/elf_gas64_ssym.hex \
+ modules/objfmts/coff/win64-nasm.mac \
+ modules/objfmts/coff/win64-gas.mac \
+ modules/objfmts/coff/tests/Makefile.inc \
+ modules/objfmts/coff/tests/coff_test.sh \
+ modules/objfmts/coff/tests/cofftest.c \
+ modules/objfmts/coff/tests/cofftest.asm \
+ modules/objfmts/coff/tests/cofftest.hex \
+ modules/objfmts/coff/tests/cofftimes.asm \
+ modules/objfmts/coff/tests/cofftimes.hex \
+ modules/objfmts/coff/tests/x86id.asm \
+ modules/objfmts/coff/tests/x86id.hex \
+ modules/objfmts/coff/tests/x86id.errwarn \
+ modules/objfmts/macho/tests/Makefile.inc \
+ modules/objfmts/macho/tests/gas32/Makefile.inc \
+ modules/objfmts/macho/tests/gas64/Makefile.inc \
+ modules/objfmts/macho/tests/nasm32/Makefile.inc \
+ modules/objfmts/macho/tests/nasm64/Makefile.inc \
+ modules/objfmts/macho/tests/gas32/gas_macho32_test.sh \
+ modules/objfmts/macho/tests/gas32/gas-macho32.asm \
+ modules/objfmts/macho/tests/gas32/gas-macho32.hex \
+ modules/objfmts/macho/tests/gas64/gas_macho64_test.sh \
+ modules/objfmts/macho/tests/gas64/gas-macho64.asm \
+ modules/objfmts/macho/tests/gas64/gas-macho64.hex \
+ modules/objfmts/macho/tests/gas64/gas-macho64-pic.asm \
+ modules/objfmts/macho/tests/gas64/gas-macho64-pic.hex \
+ modules/objfmts/macho/tests/nasm32/macho32_test.sh \
+ modules/objfmts/macho/tests/nasm32/machotest.c \
+ modules/objfmts/macho/tests/nasm32/machotest.asm \
+ modules/objfmts/macho/tests/nasm32/machotest.hex \
+ modules/objfmts/macho/tests/nasm32/macho-reloc.asm \
+ modules/objfmts/macho/tests/nasm32/macho-reloc.hex \
+ modules/objfmts/macho/tests/nasm32/macho32-sect.asm \
+ modules/objfmts/macho/tests/nasm32/macho32-sect.errwarn \
+ modules/objfmts/macho/tests/nasm32/macho32-sect.hex \
+ modules/objfmts/macho/tests/nasm64/nasm-macho64-pic.asm \
+ modules/objfmts/macho/tests/nasm64/nasm-macho64-pic.hex \
+ modules/objfmts/macho/tests/nasm64/macho64_test.sh \
+ modules/objfmts/macho/tests/nasm64/machotest64.c \
+ modules/objfmts/macho/tests/nasm64/machotest64.asm \
+ modules/objfmts/macho/tests/nasm64/machotest64.hex \
+ modules/objfmts/macho/tests/nasm64/macho-reloc64-err.asm \
+ modules/objfmts/macho/tests/nasm64/macho-reloc64-err.errwarn \
+ modules/objfmts/rdf/tests/Makefile.inc \
+ modules/objfmts/rdf/tests/rdf_test.sh \
+ modules/objfmts/rdf/tests/rdfabs.asm \
+ modules/objfmts/rdf/tests/rdfabs.errwarn \
+ modules/objfmts/rdf/tests/rdfabs.hex \
+ modules/objfmts/rdf/tests/rdfext.asm \
+ modules/objfmts/rdf/tests/rdfext.hex \
+ modules/objfmts/rdf/tests/rdfseg.asm \
+ modules/objfmts/rdf/tests/rdfseg.hex \
+ modules/objfmts/rdf/tests/rdfseg2.asm \
+ modules/objfmts/rdf/tests/rdfseg2.hex \
+ modules/objfmts/rdf/tests/rdftest1.asm \
+ modules/objfmts/rdf/tests/rdftest1.hex \
+ modules/objfmts/rdf/tests/rdftest2.asm \
+ modules/objfmts/rdf/tests/rdftest2.hex \
+ modules/objfmts/rdf/tests/rdtlib.asm \
+ modules/objfmts/rdf/tests/rdtlib.hex \
+ modules/objfmts/rdf/tests/rdtmain.asm \
+ modules/objfmts/rdf/tests/rdtmain.hex \
+ modules/objfmts/rdf/tests/testlib.asm \
+ modules/objfmts/rdf/tests/testlib.hex \
+ modules/objfmts/win32/tests/Makefile.inc \
+ modules/objfmts/win32/tests/export.asm \
+ modules/objfmts/win32/tests/export.hex \
+ modules/objfmts/win32/tests/win32_test.sh \
+ modules/objfmts/win32/tests/win32-curpos.asm \
+ modules/objfmts/win32/tests/win32-curpos.hex \
+ modules/objfmts/win32/tests/win32-overdef.asm \
+ modules/objfmts/win32/tests/win32-overdef.hex \
+ modules/objfmts/win32/tests/win32-safeseh.asm \
+ modules/objfmts/win32/tests/win32-safeseh.hex \
+ modules/objfmts/win32/tests/win32-safeseh.masm \
+ modules/objfmts/win32/tests/win32-segof.asm \
+ modules/objfmts/win32/tests/win32-segof.hex \
+ modules/objfmts/win32/tests/win32test.c \
+ modules/objfmts/win32/tests/win32test.asm \
+ modules/objfmts/win32/tests/win32test.hex \
+ modules/objfmts/win32/tests/gas/Makefile.inc \
+ modules/objfmts/win32/tests/gas/win32_gas_test.sh \
+ modules/objfmts/win32/tests/gas/win32at.asm \
+ modules/objfmts/win32/tests/gas/win32at.hex \
+ modules/objfmts/win64/tests/Makefile.inc \
+ modules/objfmts/win64/tests/win64_test.sh \
+ modules/objfmts/win64/tests/sce1.asm \
+ modules/objfmts/win64/tests/sce1.hex \
+ modules/objfmts/win64/tests/sce1-err.asm \
+ modules/objfmts/win64/tests/sce1-err.errwarn \
+ modules/objfmts/win64/tests/sce2.asm \
+ modules/objfmts/win64/tests/sce2.hex \
+ modules/objfmts/win64/tests/sce2-err.asm \
+ modules/objfmts/win64/tests/sce2-err.errwarn \
+ modules/objfmts/win64/tests/sce3.asm \
+ modules/objfmts/win64/tests/sce3.hex \
+ modules/objfmts/win64/tests/sce3.masm \
+ modules/objfmts/win64/tests/sce4.asm \
+ modules/objfmts/win64/tests/sce4.hex \
+ modules/objfmts/win64/tests/sce4.masm \
+ modules/objfmts/win64/tests/sce4-err.asm \
+ modules/objfmts/win64/tests/sce4-err.errwarn \
+ modules/objfmts/win64/tests/win64-abs.asm \
+ modules/objfmts/win64/tests/win64-abs.hex \
+ modules/objfmts/win64/tests/win64-curpos.asm \
+ modules/objfmts/win64/tests/win64-curpos.hex \
+ modules/objfmts/win64/tests/win64-dataref.asm \
+ modules/objfmts/win64/tests/win64-dataref.hex \
+ modules/objfmts/win64/tests/win64-dataref.masm \
+ modules/objfmts/win64/tests/win64-dataref2.asm \
+ modules/objfmts/win64/tests/win64-dataref2.hex \
+ modules/objfmts/win64/tests/win64-dataref2.masm \
+ modules/objfmts/win64/tests/gas/Makefile.inc \
+ modules/objfmts/win64/tests/gas/win64_gas_test.sh \
+ modules/objfmts/win64/tests/gas/win64-gas-sce.asm \
+ modules/objfmts/win64/tests/gas/win64-gas-sce.hex \
+ modules/objfmts/xdf/tests/Makefile.inc \
+ modules/objfmts/xdf/tests/xdf_test.sh \
+ modules/objfmts/xdf/tests/xdf-overdef.asm \
+ modules/objfmts/xdf/tests/xdf-overdef.hex \
+ modules/objfmts/xdf/tests/xdflong.asm \
+ modules/objfmts/xdf/tests/xdflong.hex \
+ modules/objfmts/xdf/tests/xdflong.errwarn \
+ modules/objfmts/xdf/tests/xdfother.asm \
+ modules/objfmts/xdf/tests/xdfother.hex \
+ modules/objfmts/xdf/tests/xdfprotect.asm \
+ modules/objfmts/xdf/tests/xdfprotect.hex \
+ modules/objfmts/xdf/tests/xdfsect.asm \
+ modules/objfmts/xdf/tests/xdfsect.hex \
+ modules/objfmts/xdf/tests/xdfsect-err.asm \
+ modules/objfmts/xdf/tests/xdfsect-err.errwarn \
+ modules/objfmts/xdf/tests/xdfvirtual.asm \
+ modules/objfmts/xdf/tests/xdfvirtual.hex \
+ modules/objfmts/yasm_objfmts.xml libyasm/genmodule.c \
+ libyasm/module.in libyasm/tests/Makefile.inc \
+ libyasm/tests/libyasm_test.sh libyasm/tests/1shl0.asm \
+ libyasm/tests/1shl0.hex libyasm/tests/absloop-err.asm \
+ libyasm/tests/absloop-err.errwarn \
+ libyasm/tests/charconst64.asm libyasm/tests/charconst64.hex \
+ libyasm/tests/data-rawvalue.asm \
+ libyasm/tests/data-rawvalue.hex libyasm/tests/duplabel-err.asm \
+ libyasm/tests/duplabel-err.errwarn libyasm/tests/emptydata.asm \
+ libyasm/tests/emptydata.hex libyasm/tests/equ-expand.asm \
+ libyasm/tests/equ-expand.hex libyasm/tests/expr-fold-level.asm \
+ libyasm/tests/expr-fold-level.hex \
+ libyasm/tests/expr-wide-ident.asm \
+ libyasm/tests/expr-wide-ident.hex libyasm/tests/externdef.asm \
+ libyasm/tests/externdef.errwarn libyasm/tests/externdef.hex \
+ libyasm/tests/incbin.asm libyasm/tests/incbin.hex \
+ libyasm/tests/jmpsize1.asm libyasm/tests/jmpsize1.hex \
+ libyasm/tests/jmpsize1-err.asm \
+ libyasm/tests/jmpsize1-err.errwarn \
+ libyasm/tests/opt-align1.asm libyasm/tests/opt-align1.hex \
+ libyasm/tests/opt-align2.asm libyasm/tests/opt-align2.hex \
+ libyasm/tests/opt-align3.asm libyasm/tests/opt-align3.hex \
+ libyasm/tests/opt-circular1-err.asm \
+ libyasm/tests/opt-circular1-err.errwarn \
+ libyasm/tests/opt-circular2-err.asm \
+ libyasm/tests/opt-circular2-err.errwarn \
+ libyasm/tests/opt-circular3-err.asm \
+ libyasm/tests/opt-circular3-err.errwarn \
+ libyasm/tests/opt-gvmat64.asm libyasm/tests/opt-gvmat64.hex \
+ libyasm/tests/opt-immexpand.asm \
+ libyasm/tests/opt-immexpand.hex \
+ libyasm/tests/opt-immnoexpand.asm \
+ libyasm/tests/opt-immnoexpand.hex \
+ libyasm/tests/opt-oldalign.asm libyasm/tests/opt-oldalign.hex \
+ libyasm/tests/opt-struc.asm libyasm/tests/opt-struc.hex \
+ libyasm/tests/reserve-err1.asm \
+ libyasm/tests/reserve-err1.errwarn \
+ libyasm/tests/reserve-err2.asm \
+ libyasm/tests/reserve-err2.errwarn libyasm/tests/strucsize.asm \
+ libyasm/tests/strucsize.hex libyasm/tests/times0.asm \
+ libyasm/tests/times0.hex libyasm/tests/timesover-err.asm \
+ libyasm/tests/timesover-err.errwarn \
+ libyasm/tests/timesunder.asm libyasm/tests/timesunder.hex \
+ libyasm/tests/times-res.asm libyasm/tests/times-res.errwarn \
+ libyasm/tests/times-res.hex libyasm/tests/unary.asm \
+ libyasm/tests/unary.hex libyasm/tests/value-err.asm \
+ libyasm/tests/value-err.errwarn \
+ libyasm/tests/value-samesym.asm \
+ libyasm/tests/value-samesym.errwarn \
+ libyasm/tests/value-samesym.hex libyasm/tests/value-mask.asm \
+ libyasm/tests/value-mask.errwarn libyasm/tests/value-mask.hex \
+ frontends/yasm/Makefile.inc frontends/tasm/Makefile.inc \
+ frontends/yasm/yasm.xml m4/intmax.m4 m4/longdouble.m4 \
+ m4/nls.m4 m4/po.m4 m4/printf-posix.m4 m4/signed.m4 \
+ m4/size_max.m4 m4/ulonglong.m4 m4/wchar_t.m4 m4/wint_t.m4 \
+ m4/xsize.m4 m4/codeset.m4 m4/gettext.m4 m4/glibc21.m4 \
+ m4/iconv.m4 m4/intdiv0.m4 m4/inttypes.m4 m4/inttypes_h.m4 \
+ m4/inttypes-pri.m4 m4/isc-posix.m4 m4/lcmessage.m4 \
+ m4/lib-ld.m4 m4/lib-link.m4 m4/lib-prefix.m4 m4/longlong.m4 \
+ m4/progtest.m4 m4/stdint_h.m4 m4/uintmax_t.m4 m4/pythonhead.m4 \
+ m4/pyrex.m4 out_test.sh Artistic.txt BSD.txt GNU_GPL-2.0 \
+ GNU_LGPL-2.0 splint.sh Mkfiles/Makefile.flat \
+ Mkfiles/Makefile.dj Mkfiles/dj/config.h \
+ Mkfiles/dj/libyasm-stdint.h \
+ Mkfiles/vc9/crt_secure_no_deprecate.vsprops \
+ Mkfiles/vc9/yasm.sln Mkfiles/vc9/yasm.vcproj \
+ Mkfiles/vc9/ytasm.vcproj Mkfiles/vc9/config.h \
+ Mkfiles/vc9/libyasm-stdint.h Mkfiles/vc9/readme.vc9.txt \
+ Mkfiles/vc9/yasm.rules Mkfiles/vc9/vc98_swap.py \
+ Mkfiles/vc9/genmacro/genmacro.vcproj \
+ Mkfiles/vc9/genmacro/run.bat \
+ Mkfiles/vc9/genmodule/genmodule.vcproj \
+ Mkfiles/vc9/genmodule/run.bat \
+ Mkfiles/vc9/genstring/genstring.vcproj \
+ Mkfiles/vc9/genstring/run.bat \
+ Mkfiles/vc9/genversion/genversion.vcproj \
+ Mkfiles/vc9/genversion/run.bat \
+ Mkfiles/vc9/libyasm/libyasm.vcproj \
+ Mkfiles/vc9/modules/modules.vcproj \
+ Mkfiles/vc9/re2c/re2c.vcproj Mkfiles/vc9/re2c/run.bat \
+ Mkfiles/vc9/genperf/genperf.vcproj Mkfiles/vc9/genperf/run.bat \
+ genstring.c
+
+# libyasm-stdint.h doesn't clean up after itself?
+CONFIG_CLEAN_FILES = libyasm-stdint.h
+re2c_SOURCES =
+re2c_LDADD = re2c-main.$(OBJEXT) re2c-code.$(OBJEXT) \
+ re2c-dfa.$(OBJEXT) re2c-parser.$(OBJEXT) \
+ re2c-actions.$(OBJEXT) re2c-scanner.$(OBJEXT) \
+ re2c-mbo_getopt.$(OBJEXT) re2c-substr.$(OBJEXT) \
+ re2c-translate.$(OBJEXT)
+re2c_LINK = $(CCLD_FOR_BUILD) -o $@
+genmacro_SOURCES =
+genmacro_LDADD = genmacro.$(OBJEXT)
+genmacro_LINK = $(CCLD_FOR_BUILD) -o $@
+genperf_SOURCES =
+genperf_LDADD = genperf.$(OBJEXT) gp-perfect.$(OBJEXT) \
+ gp-phash.$(OBJEXT) gp-xmalloc.$(OBJEXT) gp-xstrdup.$(OBJEXT)
+genperf_LINK = $(CCLD_FOR_BUILD) -o $@
+PYBINDING_DEPS = tools/python-yasm/bytecode.pxi \
+ tools/python-yasm/errwarn.pxi tools/python-yasm/expr.pxi \
+ tools/python-yasm/floatnum.pxi tools/python-yasm/intnum.pxi \
+ tools/python-yasm/symrec.pxi tools/python-yasm/value.pxi
+YASM_MODULES = arch_x86 arch_lc3b listfmt_nasm parser_gas parser_gnu \
+ parser_nasm parser_tasm preproc_nasm preproc_tasm preproc_raw \
+ preproc_cpp dbgfmt_cv8 dbgfmt_dwarf2 dbgfmt_null dbgfmt_stabs \
+ objfmt_dbg objfmt_bin objfmt_dosexe objfmt_elf objfmt_elf32 \
+ objfmt_elf64 objfmt_coff objfmt_macho objfmt_macho32 \
+ objfmt_macho64 objfmt_rdf objfmt_win32 objfmt_win64 objfmt_x64 \
+ objfmt_xdf
+lib_LIBRARIES = libyasm.a
+libyasm_a_SOURCES = modules/arch/x86/x86arch.c \
+ modules/arch/x86/x86arch.h modules/arch/x86/x86bc.c \
+ modules/arch/x86/x86expr.c modules/arch/x86/x86id.c \
+ modules/arch/lc3b/lc3barch.c modules/arch/lc3b/lc3barch.h \
+ modules/arch/lc3b/lc3bbc.c \
+ modules/listfmts/nasm/nasm-listfmt.c \
+ modules/parsers/gas/gas-parser.c \
+ modules/parsers/gas/gas-parser.h \
+ modules/parsers/gas/gas-parse.c \
+ modules/parsers/nasm/nasm-parser.c \
+ modules/parsers/nasm/nasm-parser.h \
+ modules/parsers/nasm/nasm-parse.c \
+ modules/preprocs/nasm/nasm-preproc.c \
+ modules/preprocs/nasm/nasm-pp.h \
+ modules/preprocs/nasm/nasm-pp.c modules/preprocs/nasm/nasm.h \
+ modules/preprocs/nasm/nasmlib.h \
+ modules/preprocs/nasm/nasmlib.c \
+ modules/preprocs/nasm/nasm-eval.h \
+ modules/preprocs/nasm/nasm-eval.c \
+ modules/preprocs/raw/raw-preproc.c \
+ modules/preprocs/cpp/cpp-preproc.c \
+ modules/dbgfmts/codeview/cv-dbgfmt.h \
+ modules/dbgfmts/codeview/cv-dbgfmt.c \
+ modules/dbgfmts/codeview/cv-symline.c \
+ modules/dbgfmts/codeview/cv-type.c \
+ modules/dbgfmts/dwarf2/dwarf2-dbgfmt.h \
+ modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c \
+ modules/dbgfmts/dwarf2/dwarf2-line.c \
+ modules/dbgfmts/dwarf2/dwarf2-aranges.c \
+ modules/dbgfmts/dwarf2/dwarf2-info.c \
+ modules/dbgfmts/null/null-dbgfmt.c \
+ modules/dbgfmts/stabs/stabs-dbgfmt.c \
+ modules/objfmts/dbg/dbg-objfmt.c \
+ modules/objfmts/bin/bin-objfmt.c modules/objfmts/elf/elf.c \
+ modules/objfmts/elf/elf.h modules/objfmts/elf/elf-objfmt.c \
+ modules/objfmts/elf/elf-machine.h \
+ modules/objfmts/elf/elf-x86-x86.c \
+ modules/objfmts/elf/elf-x86-amd64.c \
+ modules/objfmts/coff/coff-objfmt.c \
+ modules/objfmts/coff/coff-objfmt.h \
+ modules/objfmts/coff/win64-except.c \
+ modules/objfmts/macho/macho-objfmt.c \
+ modules/objfmts/rdf/rdf-objfmt.c \
+ modules/objfmts/xdf/xdf-objfmt.c libyasm/assocdat.c \
+ libyasm/bitvect.c libyasm/bc-align.c libyasm/bc-data.c \
+ libyasm/bc-incbin.c libyasm/bc-org.c libyasm/bc-reserve.c \
+ libyasm/bytecode.c libyasm/errwarn.c libyasm/expr.c \
+ libyasm/file.c libyasm/floatnum.c libyasm/hamt.c \
+ libyasm/insn.c libyasm/intnum.c libyasm/inttree.c \
+ libyasm/linemap.c libyasm/md5.c libyasm/mergesort.c \
+ libyasm/phash.c libyasm/section.c libyasm/strcasecmp.c \
+ libyasm/strsep.c libyasm/symrec.c libyasm/valparam.c \
+ libyasm/value.c libyasm/xmalloc.c libyasm/xstrdup.c
+nodist_libyasm_a_SOURCES = x86cpu.c x86regtmod.c lc3bid.c gas-token.c \
+ nasm-token.c module.c
+genversion_SOURCES =
+genversion_LDADD = genversion.$(OBJEXT)
+genversion_LINK = $(CCLD_FOR_BUILD) -o $@
+genmodule_SOURCES =
+genmodule_LDADD = genmodule.$(OBJEXT)
+genmodule_LINK = $(CCLD_FOR_BUILD) -o $@
+modincludedir = $(includedir)/libyasm
+modinclude_HEADERS = libyasm/arch.h libyasm/assocdat.h \
+ libyasm/bitvect.h libyasm/bytecode.h libyasm/compat-queue.h \
+ libyasm/coretype.h libyasm/dbgfmt.h libyasm/errwarn.h \
+ libyasm/expr.h libyasm/file.h libyasm/floatnum.h \
+ libyasm/hamt.h libyasm/insn.h libyasm/intnum.h \
+ libyasm/inttree.h libyasm/linemap.h libyasm/listfmt.h \
+ libyasm/md5.h libyasm/module.h libyasm/objfmt.h \
+ libyasm/parser.h libyasm/phash.h libyasm/preproc.h \
+ libyasm/section.h libyasm/symrec.h libyasm/valparam.h \
+ libyasm/value.h
+bitvect_test_SOURCES = libyasm/tests/bitvect_test.c
+bitvect_test_LDADD = libyasm.a $(INTLLIBS)
+floatnum_test_SOURCES = libyasm/tests/floatnum_test.c
+floatnum_test_LDADD = libyasm.a $(INTLLIBS)
+leb128_test_SOURCES = libyasm/tests/leb128_test.c
+leb128_test_LDADD = libyasm.a $(INTLLIBS)
+splitpath_test_SOURCES = libyasm/tests/splitpath_test.c
+splitpath_test_LDADD = libyasm.a $(INTLLIBS)
+combpath_test_SOURCES = libyasm/tests/combpath_test.c
+combpath_test_LDADD = libyasm.a $(INTLLIBS)
+uncstring_test_SOURCES = libyasm/tests/uncstring_test.c
+uncstring_test_LDADD = libyasm.a $(INTLLIBS)
+yasm_SOURCES = frontends/yasm/yasm.c frontends/yasm/yasm-options.c \
+ frontends/yasm/yasm-options.h
+yasm_LDADD = libyasm.a $(INTLLIBS)
+ytasm_SOURCES = frontends/tasm/tasm.c frontends/tasm/tasm-options.c \
+ frontends/tasm/tasm-options.h
+ytasm_LDADD = libyasm.a $(INTLLIBS)
+ACLOCAL_AMFLAGS = -I m4
+
+# genstring build
+genstring_SOURCES =
+genstring_LDADD = genstring.$(OBJEXT)
+genstring_LINK = $(CCLD_FOR_BUILD) -o $@
+all: $(BUILT_SOURCES) config.h
+ $(MAKE) $(AM_MAKEFLAGS) all-recursive
+
+.SUFFIXES:
+.SUFFIXES: .gperf .c .o .obj
+am--refresh:
+ @:
+$(srcdir)/Makefile.in: # $(srcdir)/Makefile.am $(srcdir)/tools/Makefile.inc $(srcdir)/tools/re2c/Makefile.inc $(srcdir)/tools/genmacro/Makefile.inc $(srcdir)/tools/genperf/Makefile.inc $(srcdir)/tools/python-yasm/Makefile.inc $(srcdir)/tools/python-yasm/tests/Makefile.inc $(srcdir)/modules/Makefile.inc $(srcdir)/modules/arch/Makefile.inc $(srcdir)/modules/arch/x86/Makefile.inc $(srcdir)/modules/arch/x86/tests/Makefile.inc $(srcdir)/modules/arch/x86/tests/gas32/Makefile.inc $(srcdir)/modules/arch/x86/tests/gas64/Makefile.inc $(srcdir)/modules/arch/lc3b/Makefile.inc $(srcdir)/modules/arch/lc3b/tests/Makefile.inc $(srcdir)/modules/listfmts/Makefile.inc $(srcdir)/modules/listfmts/nasm/Makefile.inc $(srcdir)/modules/parsers/Makefile.inc $(srcdir)/modules/parsers/gas/Makefile.inc $(srcdir)/modules/parsers/gas/tests/Makefile.inc $(srcdir)/modules/parsers/gas/tests/bin/Makefile.inc $(srcdir)/modules/parsers/nasm/Makefile.inc $(srcdir)/modules/parsers/nasm/tests/Makefile.inc $(srcdir)/modules/parsers/nasm/tests/worphan/Makefile.inc $(srcdir)/modules/parsers/tasm/Makefile.inc $(srcdir)/modules/parsers/tasm/tests/Makefile.inc $(srcdir)/modules/parsers/tasm/tests/exe/Makefile.inc $(srcdir)/modules/preprocs/Makefile.inc $(srcdir)/modules/preprocs/nasm/Makefile.inc $(srcdir)/modules/preprocs/nasm/tests/Makefile.inc $(srcdir)/modules/preprocs/raw/Makefile.inc $(srcdir)/modules/preprocs/raw/tests/Makefile.inc $(srcdir)/modules/preprocs/cpp/Makefile.inc $(srcdir)/modules/dbgfmts/Makefile.inc $(srcdir)/modules/dbgfmts/codeview/Makefile.inc $(srcdir)/modules/dbgfmts/dwarf2/Makefile.inc $(srcdir)/modules/dbgfmts/dwarf2/tests/Makefile.inc $(srcdir)/modules/dbgfmts/dwarf2/tests/pass32/Makefile.inc $(srcdir)/modules/dbgfmts/dwarf2/tests/pass64/Makefile.inc $(srcdir)/modules/dbgfmts/dwarf2/tests/passwin64/Makefile.inc $(srcdir)/modules/dbgfmts/null/Makefile.inc $(srcdir)/modules/dbgfmts/stabs/Makefile.inc $(srcdir)/modules/dbgfmts/stabs/tests/Makefile.inc $(srcdir)/modules/objfmts/Makefile.inc $(srcdir)/modules/objfmts/dbg/Makefile.inc $(srcdir)/modules/objfmts/bin/Makefile.inc $(srcdir)/modules/objfmts/bin/tests/Makefile.inc $(srcdir)/modules/objfmts/bin/tests/multisect/Makefile.inc $(srcdir)/modules/objfmts/elf/Makefile.inc $(srcdir)/modules/objfmts/elf/tests/Makefile.inc $(srcdir)/modules/objfmts/elf/tests/amd64/Makefile.inc $(srcdir)/modules/objfmts/elf/tests/gas32/Makefile.inc $(srcdir)/modules/objfmts/elf/tests/gas64/Makefile.inc $(srcdir)/modules/objfmts/coff/Makefile.inc $(srcdir)/modules/objfmts/coff/tests/Makefile.inc $(srcdir)/modules/objfmts/macho/Makefile.inc $(srcdir)/modules/objfmts/macho/tests/Makefile.inc $(srcdir)/modules/objfmts/macho/tests/gas32/Makefile.inc $(srcdir)/modules/objfmts/macho/tests/gas64/Makefile.inc $(srcdir)/modules/objfmts/macho/tests/nasm32/Makefile.inc $(srcdir)/modules/objfmts/macho/tests/nasm64/Makefile.inc $(srcdir)/modules/objfmts/rdf/Makefile.inc $(srcdir)/modules/objfmts/rdf/tests/Makefile.inc $(srcdir)/modules/objfmts/win32/Makefile.inc $(srcdir)/modules/objfmts/win32/tests/Makefile.inc $(srcdir)/modules/objfmts/win32/tests/gas/Makefile.inc $(srcdir)/modules/objfmts/win64/Makefile.inc $(srcdir)/modules/objfmts/win64/tests/Makefile.inc $(srcdir)/modules/objfmts/win64/tests/gas/Makefile.inc $(srcdir)/modules/objfmts/xdf/Makefile.inc $(srcdir)/modules/objfmts/xdf/tests/Makefile.inc $(srcdir)/libyasm/Makefile.inc $(srcdir)/libyasm/tests/Makefile.inc $(srcdir)/frontends/Makefile.inc $(srcdir)/frontends/yasm/Makefile.inc $(srcdir)/frontends/tasm/Makefile.inc $(srcdir)/m4/Makefile.inc $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \
+ cd $(srcdir) && $(AUTOMAKE) --gnu \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ echo ' $(SHELL) ./config.status'; \
+ $(SHELL) ./config.status;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ $(SHELL) ./config.status --recheck
+
+$(top_srcdir)/configure: # $(am__configure_deps)
+ cd $(srcdir) && $(AUTOCONF)
+$(ACLOCAL_M4): # $(am__aclocal_m4_deps)
+ cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+
+config.h: stamp-h1
+ @if test ! -f $@; then \
+ rm -f stamp-h1; \
+ $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \
+ else :; fi
+
+stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
+ @rm -f stamp-h1
+ cd $(top_builddir) && $(SHELL) ./config.status config.h
+$(srcdir)/config.h.in: # $(am__configure_deps)
+ cd $(top_srcdir) && $(AUTOHEADER)
+ rm -f stamp-h1
+ touch $@
+
+distclean-hdr:
+ -rm -f config.h stamp-h1
+install-libLIBRARIES: $(lib_LIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
+ @list='$(lib_LIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f=$(am__strip_dir) \
+ echo " $(libLIBRARIES_INSTALL) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
+ $(libLIBRARIES_INSTALL) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
+ else :; fi; \
+ done
+ @$(POST_INSTALL)
+ @list='$(lib_LIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ p=$(am__strip_dir) \
+ echo " $(RANLIB) '$(DESTDIR)$(libdir)/$$p'"; \
+ $(RANLIB) "$(DESTDIR)$(libdir)/$$p"; \
+ else :; fi; \
+ done
+
+uninstall-libLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(lib_LIBRARIES)'; for p in $$list; do \
+ p=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(libdir)/$$p'"; \
+ rm -f "$(DESTDIR)$(libdir)/$$p"; \
+ done
+
+clean-libLIBRARIES:
+ -test -z "$(lib_LIBRARIES)" || rm -f $(lib_LIBRARIES)
+libyasm.a: $(libyasm_a_OBJECTS) $(libyasm_a_DEPENDENCIES)
+ -rm -f libyasm.a
+ $(libyasm_a_AR) libyasm.a $(libyasm_a_OBJECTS) $(libyasm_a_LIBADD)
+ $(RANLIB) libyasm.a
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+
+clean-checkPROGRAMS:
+ -test -z "$(check_PROGRAMS)" || rm -f $(check_PROGRAMS)
+
+clean-noinstPROGRAMS:
+ -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS)
+bitvect_test$(EXEEXT): $(bitvect_test_OBJECTS) $(bitvect_test_DEPENDENCIES)
+ @rm -f bitvect_test$(EXEEXT)
+ $(LINK) $(bitvect_test_OBJECTS) $(bitvect_test_LDADD) $(LIBS)
+combpath_test$(EXEEXT): $(combpath_test_OBJECTS) $(combpath_test_DEPENDENCIES)
+ @rm -f combpath_test$(EXEEXT)
+ $(LINK) $(combpath_test_OBJECTS) $(combpath_test_LDADD) $(LIBS)
+floatnum_test$(EXEEXT): $(floatnum_test_OBJECTS) $(floatnum_test_DEPENDENCIES)
+ @rm -f floatnum_test$(EXEEXT)
+ $(LINK) $(floatnum_test_OBJECTS) $(floatnum_test_LDADD) $(LIBS)
+genmacro$(EXEEXT): $(genmacro_OBJECTS) $(genmacro_DEPENDENCIES)
+ @rm -f genmacro$(EXEEXT)
+ $(genmacro_LINK) $(genmacro_OBJECTS) $(genmacro_LDADD) $(LIBS)
+genmodule$(EXEEXT): $(genmodule_OBJECTS) $(genmodule_DEPENDENCIES)
+ @rm -f genmodule$(EXEEXT)
+ $(genmodule_LINK) $(genmodule_OBJECTS) $(genmodule_LDADD) $(LIBS)
+genperf$(EXEEXT): $(genperf_OBJECTS) $(genperf_DEPENDENCIES)
+ @rm -f genperf$(EXEEXT)
+ $(genperf_LINK) $(genperf_OBJECTS) $(genperf_LDADD) $(LIBS)
+genstring$(EXEEXT): $(genstring_OBJECTS) $(genstring_DEPENDENCIES)
+ @rm -f genstring$(EXEEXT)
+ $(genstring_LINK) $(genstring_OBJECTS) $(genstring_LDADD) $(LIBS)
+genversion$(EXEEXT): $(genversion_OBJECTS) $(genversion_DEPENDENCIES)
+ @rm -f genversion$(EXEEXT)
+ $(genversion_LINK) $(genversion_OBJECTS) $(genversion_LDADD) $(LIBS)
+leb128_test$(EXEEXT): $(leb128_test_OBJECTS) $(leb128_test_DEPENDENCIES)
+ @rm -f leb128_test$(EXEEXT)
+ $(LINK) $(leb128_test_OBJECTS) $(leb128_test_LDADD) $(LIBS)
+re2c$(EXEEXT): $(re2c_OBJECTS) $(re2c_DEPENDENCIES)
+ @rm -f re2c$(EXEEXT)
+ $(re2c_LINK) $(re2c_OBJECTS) $(re2c_LDADD) $(LIBS)
+splitpath_test$(EXEEXT): $(splitpath_test_OBJECTS) $(splitpath_test_DEPENDENCIES)
+ @rm -f splitpath_test$(EXEEXT)
+ $(LINK) $(splitpath_test_OBJECTS) $(splitpath_test_LDADD) $(LIBS)
+test_hd$(EXEEXT): $(test_hd_OBJECTS) $(test_hd_DEPENDENCIES)
+ @rm -f test_hd$(EXEEXT)
+ $(LINK) $(test_hd_OBJECTS) $(test_hd_LDADD) $(LIBS)
+uncstring_test$(EXEEXT): $(uncstring_test_OBJECTS) $(uncstring_test_DEPENDENCIES)
+ @rm -f uncstring_test$(EXEEXT)
+ $(LINK) $(uncstring_test_OBJECTS) $(uncstring_test_LDADD) $(LIBS)
+yasm$(EXEEXT): $(yasm_OBJECTS) $(yasm_DEPENDENCIES)
+ @rm -f yasm$(EXEEXT)
+ $(LINK) $(yasm_OBJECTS) $(yasm_LDADD) $(LIBS)
+ytasm$(EXEEXT): $(ytasm_OBJECTS) $(ytasm_DEPENDENCIES)
+ @rm -f ytasm$(EXEEXT)
+ $(LINK) $(ytasm_OBJECTS) $(ytasm_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+include ./$(DEPDIR)/assocdat.Po
+include ./$(DEPDIR)/bc-align.Po
+include ./$(DEPDIR)/bc-data.Po
+include ./$(DEPDIR)/bc-incbin.Po
+include ./$(DEPDIR)/bc-org.Po
+include ./$(DEPDIR)/bc-reserve.Po
+include ./$(DEPDIR)/bin-objfmt.Po
+include ./$(DEPDIR)/bitvect.Po
+include ./$(DEPDIR)/bitvect_test.Po
+include ./$(DEPDIR)/bytecode.Po
+include ./$(DEPDIR)/coff-objfmt.Po
+include ./$(DEPDIR)/combpath_test.Po
+include ./$(DEPDIR)/cpp-preproc.Po
+include ./$(DEPDIR)/cv-dbgfmt.Po
+include ./$(DEPDIR)/cv-symline.Po
+include ./$(DEPDIR)/cv-type.Po
+include ./$(DEPDIR)/dbg-objfmt.Po
+include ./$(DEPDIR)/dwarf2-aranges.Po
+include ./$(DEPDIR)/dwarf2-dbgfmt.Po
+include ./$(DEPDIR)/dwarf2-info.Po
+include ./$(DEPDIR)/dwarf2-line.Po
+include ./$(DEPDIR)/elf-objfmt.Po
+include ./$(DEPDIR)/elf-x86-amd64.Po
+include ./$(DEPDIR)/elf-x86-x86.Po
+include ./$(DEPDIR)/elf.Po
+include ./$(DEPDIR)/errwarn.Po
+include ./$(DEPDIR)/expr.Po
+include ./$(DEPDIR)/file.Po
+include ./$(DEPDIR)/floatnum.Po
+include ./$(DEPDIR)/floatnum_test.Po
+include ./$(DEPDIR)/gas-parse.Po
+include ./$(DEPDIR)/gas-parser.Po
+include ./$(DEPDIR)/gas-token.Po
+include ./$(DEPDIR)/hamt.Po
+include ./$(DEPDIR)/insn.Po
+include ./$(DEPDIR)/intnum.Po
+include ./$(DEPDIR)/inttree.Po
+include ./$(DEPDIR)/lc3barch.Po
+include ./$(DEPDIR)/lc3bbc.Po
+include ./$(DEPDIR)/lc3bid.Po
+include ./$(DEPDIR)/leb128_test.Po
+include ./$(DEPDIR)/linemap.Po
+include ./$(DEPDIR)/macho-objfmt.Po
+include ./$(DEPDIR)/md5.Po
+include ./$(DEPDIR)/mergesort.Po
+include ./$(DEPDIR)/module.Po
+include ./$(DEPDIR)/nasm-eval.Po
+include ./$(DEPDIR)/nasm-listfmt.Po
+include ./$(DEPDIR)/nasm-parse.Po
+include ./$(DEPDIR)/nasm-parser.Po
+include ./$(DEPDIR)/nasm-pp.Po
+include ./$(DEPDIR)/nasm-preproc.Po
+include ./$(DEPDIR)/nasm-token.Po
+include ./$(DEPDIR)/nasmlib.Po
+include ./$(DEPDIR)/null-dbgfmt.Po
+include ./$(DEPDIR)/phash.Po
+include ./$(DEPDIR)/raw-preproc.Po
+include ./$(DEPDIR)/rdf-objfmt.Po
+include ./$(DEPDIR)/section.Po
+include ./$(DEPDIR)/splitpath_test.Po
+include ./$(DEPDIR)/stabs-dbgfmt.Po
+include ./$(DEPDIR)/strcasecmp.Po
+include ./$(DEPDIR)/strsep.Po
+include ./$(DEPDIR)/symrec.Po
+include ./$(DEPDIR)/tasm-options.Po
+include ./$(DEPDIR)/tasm.Po
+include ./$(DEPDIR)/test_hd.Po
+include ./$(DEPDIR)/uncstring_test.Po
+include ./$(DEPDIR)/valparam.Po
+include ./$(DEPDIR)/value.Po
+include ./$(DEPDIR)/win64-except.Po
+include ./$(DEPDIR)/x86arch.Po
+include ./$(DEPDIR)/x86bc.Po
+include ./$(DEPDIR)/x86cpu.Po
+include ./$(DEPDIR)/x86expr.Po
+include ./$(DEPDIR)/x86id.Po
+include ./$(DEPDIR)/x86regtmod.Po
+include ./$(DEPDIR)/xdf-objfmt.Po
+include ./$(DEPDIR)/xmalloc.Po
+include ./$(DEPDIR)/xstrdup.Po
+include ./$(DEPDIR)/yasm-options.Po
+include ./$(DEPDIR)/yasm.Po
+
+.c.o:
+ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+# source='$<' object='$@' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(COMPILE) -c $<
+
+.c.obj:
+ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+# source='$<' object='$@' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+x86arch.o: modules/arch/x86/x86arch.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT x86arch.o -MD -MP -MF $(DEPDIR)/x86arch.Tpo -c -o x86arch.o `test -f 'modules/arch/x86/x86arch.c' || echo '$(srcdir)/'`modules/arch/x86/x86arch.c
+ mv -f $(DEPDIR)/x86arch.Tpo $(DEPDIR)/x86arch.Po
+# source='modules/arch/x86/x86arch.c' object='x86arch.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o x86arch.o `test -f 'modules/arch/x86/x86arch.c' || echo '$(srcdir)/'`modules/arch/x86/x86arch.c
+
+x86arch.obj: modules/arch/x86/x86arch.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT x86arch.obj -MD -MP -MF $(DEPDIR)/x86arch.Tpo -c -o x86arch.obj `if test -f 'modules/arch/x86/x86arch.c'; then $(CYGPATH_W) 'modules/arch/x86/x86arch.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/x86/x86arch.c'; fi`
+ mv -f $(DEPDIR)/x86arch.Tpo $(DEPDIR)/x86arch.Po
+# source='modules/arch/x86/x86arch.c' object='x86arch.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o x86arch.obj `if test -f 'modules/arch/x86/x86arch.c'; then $(CYGPATH_W) 'modules/arch/x86/x86arch.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/x86/x86arch.c'; fi`
+
+x86bc.o: modules/arch/x86/x86bc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT x86bc.o -MD -MP -MF $(DEPDIR)/x86bc.Tpo -c -o x86bc.o `test -f 'modules/arch/x86/x86bc.c' || echo '$(srcdir)/'`modules/arch/x86/x86bc.c
+ mv -f $(DEPDIR)/x86bc.Tpo $(DEPDIR)/x86bc.Po
+# source='modules/arch/x86/x86bc.c' object='x86bc.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o x86bc.o `test -f 'modules/arch/x86/x86bc.c' || echo '$(srcdir)/'`modules/arch/x86/x86bc.c
+
+x86bc.obj: modules/arch/x86/x86bc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT x86bc.obj -MD -MP -MF $(DEPDIR)/x86bc.Tpo -c -o x86bc.obj `if test -f 'modules/arch/x86/x86bc.c'; then $(CYGPATH_W) 'modules/arch/x86/x86bc.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/x86/x86bc.c'; fi`
+ mv -f $(DEPDIR)/x86bc.Tpo $(DEPDIR)/x86bc.Po
+# source='modules/arch/x86/x86bc.c' object='x86bc.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o x86bc.obj `if test -f 'modules/arch/x86/x86bc.c'; then $(CYGPATH_W) 'modules/arch/x86/x86bc.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/x86/x86bc.c'; fi`
+
+x86expr.o: modules/arch/x86/x86expr.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT x86expr.o -MD -MP -MF $(DEPDIR)/x86expr.Tpo -c -o x86expr.o `test -f 'modules/arch/x86/x86expr.c' || echo '$(srcdir)/'`modules/arch/x86/x86expr.c
+ mv -f $(DEPDIR)/x86expr.Tpo $(DEPDIR)/x86expr.Po
+# source='modules/arch/x86/x86expr.c' object='x86expr.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o x86expr.o `test -f 'modules/arch/x86/x86expr.c' || echo '$(srcdir)/'`modules/arch/x86/x86expr.c
+
+x86expr.obj: modules/arch/x86/x86expr.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT x86expr.obj -MD -MP -MF $(DEPDIR)/x86expr.Tpo -c -o x86expr.obj `if test -f 'modules/arch/x86/x86expr.c'; then $(CYGPATH_W) 'modules/arch/x86/x86expr.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/x86/x86expr.c'; fi`
+ mv -f $(DEPDIR)/x86expr.Tpo $(DEPDIR)/x86expr.Po
+# source='modules/arch/x86/x86expr.c' object='x86expr.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o x86expr.obj `if test -f 'modules/arch/x86/x86expr.c'; then $(CYGPATH_W) 'modules/arch/x86/x86expr.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/x86/x86expr.c'; fi`
+
+x86id.o: modules/arch/x86/x86id.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT x86id.o -MD -MP -MF $(DEPDIR)/x86id.Tpo -c -o x86id.o `test -f 'modules/arch/x86/x86id.c' || echo '$(srcdir)/'`modules/arch/x86/x86id.c
+ mv -f $(DEPDIR)/x86id.Tpo $(DEPDIR)/x86id.Po
+# source='modules/arch/x86/x86id.c' object='x86id.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o x86id.o `test -f 'modules/arch/x86/x86id.c' || echo '$(srcdir)/'`modules/arch/x86/x86id.c
+
+x86id.obj: modules/arch/x86/x86id.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT x86id.obj -MD -MP -MF $(DEPDIR)/x86id.Tpo -c -o x86id.obj `if test -f 'modules/arch/x86/x86id.c'; then $(CYGPATH_W) 'modules/arch/x86/x86id.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/x86/x86id.c'; fi`
+ mv -f $(DEPDIR)/x86id.Tpo $(DEPDIR)/x86id.Po
+# source='modules/arch/x86/x86id.c' object='x86id.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o x86id.obj `if test -f 'modules/arch/x86/x86id.c'; then $(CYGPATH_W) 'modules/arch/x86/x86id.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/x86/x86id.c'; fi`
+
+lc3barch.o: modules/arch/lc3b/lc3barch.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lc3barch.o -MD -MP -MF $(DEPDIR)/lc3barch.Tpo -c -o lc3barch.o `test -f 'modules/arch/lc3b/lc3barch.c' || echo '$(srcdir)/'`modules/arch/lc3b/lc3barch.c
+ mv -f $(DEPDIR)/lc3barch.Tpo $(DEPDIR)/lc3barch.Po
+# source='modules/arch/lc3b/lc3barch.c' object='lc3barch.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lc3barch.o `test -f 'modules/arch/lc3b/lc3barch.c' || echo '$(srcdir)/'`modules/arch/lc3b/lc3barch.c
+
+lc3barch.obj: modules/arch/lc3b/lc3barch.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lc3barch.obj -MD -MP -MF $(DEPDIR)/lc3barch.Tpo -c -o lc3barch.obj `if test -f 'modules/arch/lc3b/lc3barch.c'; then $(CYGPATH_W) 'modules/arch/lc3b/lc3barch.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/lc3b/lc3barch.c'; fi`
+ mv -f $(DEPDIR)/lc3barch.Tpo $(DEPDIR)/lc3barch.Po
+# source='modules/arch/lc3b/lc3barch.c' object='lc3barch.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lc3barch.obj `if test -f 'modules/arch/lc3b/lc3barch.c'; then $(CYGPATH_W) 'modules/arch/lc3b/lc3barch.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/lc3b/lc3barch.c'; fi`
+
+lc3bbc.o: modules/arch/lc3b/lc3bbc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lc3bbc.o -MD -MP -MF $(DEPDIR)/lc3bbc.Tpo -c -o lc3bbc.o `test -f 'modules/arch/lc3b/lc3bbc.c' || echo '$(srcdir)/'`modules/arch/lc3b/lc3bbc.c
+ mv -f $(DEPDIR)/lc3bbc.Tpo $(DEPDIR)/lc3bbc.Po
+# source='modules/arch/lc3b/lc3bbc.c' object='lc3bbc.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lc3bbc.o `test -f 'modules/arch/lc3b/lc3bbc.c' || echo '$(srcdir)/'`modules/arch/lc3b/lc3bbc.c
+
+lc3bbc.obj: modules/arch/lc3b/lc3bbc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lc3bbc.obj -MD -MP -MF $(DEPDIR)/lc3bbc.Tpo -c -o lc3bbc.obj `if test -f 'modules/arch/lc3b/lc3bbc.c'; then $(CYGPATH_W) 'modules/arch/lc3b/lc3bbc.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/lc3b/lc3bbc.c'; fi`
+ mv -f $(DEPDIR)/lc3bbc.Tpo $(DEPDIR)/lc3bbc.Po
+# source='modules/arch/lc3b/lc3bbc.c' object='lc3bbc.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lc3bbc.obj `if test -f 'modules/arch/lc3b/lc3bbc.c'; then $(CYGPATH_W) 'modules/arch/lc3b/lc3bbc.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/lc3b/lc3bbc.c'; fi`
+
+nasm-listfmt.o: modules/listfmts/nasm/nasm-listfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-listfmt.o -MD -MP -MF $(DEPDIR)/nasm-listfmt.Tpo -c -o nasm-listfmt.o `test -f 'modules/listfmts/nasm/nasm-listfmt.c' || echo '$(srcdir)/'`modules/listfmts/nasm/nasm-listfmt.c
+ mv -f $(DEPDIR)/nasm-listfmt.Tpo $(DEPDIR)/nasm-listfmt.Po
+# source='modules/listfmts/nasm/nasm-listfmt.c' object='nasm-listfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-listfmt.o `test -f 'modules/listfmts/nasm/nasm-listfmt.c' || echo '$(srcdir)/'`modules/listfmts/nasm/nasm-listfmt.c
+
+nasm-listfmt.obj: modules/listfmts/nasm/nasm-listfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-listfmt.obj -MD -MP -MF $(DEPDIR)/nasm-listfmt.Tpo -c -o nasm-listfmt.obj `if test -f 'modules/listfmts/nasm/nasm-listfmt.c'; then $(CYGPATH_W) 'modules/listfmts/nasm/nasm-listfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/listfmts/nasm/nasm-listfmt.c'; fi`
+ mv -f $(DEPDIR)/nasm-listfmt.Tpo $(DEPDIR)/nasm-listfmt.Po
+# source='modules/listfmts/nasm/nasm-listfmt.c' object='nasm-listfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-listfmt.obj `if test -f 'modules/listfmts/nasm/nasm-listfmt.c'; then $(CYGPATH_W) 'modules/listfmts/nasm/nasm-listfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/listfmts/nasm/nasm-listfmt.c'; fi`
+
+gas-parser.o: modules/parsers/gas/gas-parser.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gas-parser.o -MD -MP -MF $(DEPDIR)/gas-parser.Tpo -c -o gas-parser.o `test -f 'modules/parsers/gas/gas-parser.c' || echo '$(srcdir)/'`modules/parsers/gas/gas-parser.c
+ mv -f $(DEPDIR)/gas-parser.Tpo $(DEPDIR)/gas-parser.Po
+# source='modules/parsers/gas/gas-parser.c' object='gas-parser.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gas-parser.o `test -f 'modules/parsers/gas/gas-parser.c' || echo '$(srcdir)/'`modules/parsers/gas/gas-parser.c
+
+gas-parser.obj: modules/parsers/gas/gas-parser.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gas-parser.obj -MD -MP -MF $(DEPDIR)/gas-parser.Tpo -c -o gas-parser.obj `if test -f 'modules/parsers/gas/gas-parser.c'; then $(CYGPATH_W) 'modules/parsers/gas/gas-parser.c'; else $(CYGPATH_W) '$(srcdir)/modules/parsers/gas/gas-parser.c'; fi`
+ mv -f $(DEPDIR)/gas-parser.Tpo $(DEPDIR)/gas-parser.Po
+# source='modules/parsers/gas/gas-parser.c' object='gas-parser.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gas-parser.obj `if test -f 'modules/parsers/gas/gas-parser.c'; then $(CYGPATH_W) 'modules/parsers/gas/gas-parser.c'; else $(CYGPATH_W) '$(srcdir)/modules/parsers/gas/gas-parser.c'; fi`
+
+gas-parse.o: modules/parsers/gas/gas-parse.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gas-parse.o -MD -MP -MF $(DEPDIR)/gas-parse.Tpo -c -o gas-parse.o `test -f 'modules/parsers/gas/gas-parse.c' || echo '$(srcdir)/'`modules/parsers/gas/gas-parse.c
+ mv -f $(DEPDIR)/gas-parse.Tpo $(DEPDIR)/gas-parse.Po
+# source='modules/parsers/gas/gas-parse.c' object='gas-parse.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gas-parse.o `test -f 'modules/parsers/gas/gas-parse.c' || echo '$(srcdir)/'`modules/parsers/gas/gas-parse.c
+
+gas-parse.obj: modules/parsers/gas/gas-parse.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gas-parse.obj -MD -MP -MF $(DEPDIR)/gas-parse.Tpo -c -o gas-parse.obj `if test -f 'modules/parsers/gas/gas-parse.c'; then $(CYGPATH_W) 'modules/parsers/gas/gas-parse.c'; else $(CYGPATH_W) '$(srcdir)/modules/parsers/gas/gas-parse.c'; fi`
+ mv -f $(DEPDIR)/gas-parse.Tpo $(DEPDIR)/gas-parse.Po
+# source='modules/parsers/gas/gas-parse.c' object='gas-parse.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gas-parse.obj `if test -f 'modules/parsers/gas/gas-parse.c'; then $(CYGPATH_W) 'modules/parsers/gas/gas-parse.c'; else $(CYGPATH_W) '$(srcdir)/modules/parsers/gas/gas-parse.c'; fi`
+
+nasm-parser.o: modules/parsers/nasm/nasm-parser.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-parser.o -MD -MP -MF $(DEPDIR)/nasm-parser.Tpo -c -o nasm-parser.o `test -f 'modules/parsers/nasm/nasm-parser.c' || echo '$(srcdir)/'`modules/parsers/nasm/nasm-parser.c
+ mv -f $(DEPDIR)/nasm-parser.Tpo $(DEPDIR)/nasm-parser.Po
+# source='modules/parsers/nasm/nasm-parser.c' object='nasm-parser.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-parser.o `test -f 'modules/parsers/nasm/nasm-parser.c' || echo '$(srcdir)/'`modules/parsers/nasm/nasm-parser.c
+
+nasm-parser.obj: modules/parsers/nasm/nasm-parser.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-parser.obj -MD -MP -MF $(DEPDIR)/nasm-parser.Tpo -c -o nasm-parser.obj `if test -f 'modules/parsers/nasm/nasm-parser.c'; then $(CYGPATH_W) 'modules/parsers/nasm/nasm-parser.c'; else $(CYGPATH_W) '$(srcdir)/modules/parsers/nasm/nasm-parser.c'; fi`
+ mv -f $(DEPDIR)/nasm-parser.Tpo $(DEPDIR)/nasm-parser.Po
+# source='modules/parsers/nasm/nasm-parser.c' object='nasm-parser.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-parser.obj `if test -f 'modules/parsers/nasm/nasm-parser.c'; then $(CYGPATH_W) 'modules/parsers/nasm/nasm-parser.c'; else $(CYGPATH_W) '$(srcdir)/modules/parsers/nasm/nasm-parser.c'; fi`
+
+nasm-parse.o: modules/parsers/nasm/nasm-parse.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-parse.o -MD -MP -MF $(DEPDIR)/nasm-parse.Tpo -c -o nasm-parse.o `test -f 'modules/parsers/nasm/nasm-parse.c' || echo '$(srcdir)/'`modules/parsers/nasm/nasm-parse.c
+ mv -f $(DEPDIR)/nasm-parse.Tpo $(DEPDIR)/nasm-parse.Po
+# source='modules/parsers/nasm/nasm-parse.c' object='nasm-parse.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-parse.o `test -f 'modules/parsers/nasm/nasm-parse.c' || echo '$(srcdir)/'`modules/parsers/nasm/nasm-parse.c
+
+nasm-parse.obj: modules/parsers/nasm/nasm-parse.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-parse.obj -MD -MP -MF $(DEPDIR)/nasm-parse.Tpo -c -o nasm-parse.obj `if test -f 'modules/parsers/nasm/nasm-parse.c'; then $(CYGPATH_W) 'modules/parsers/nasm/nasm-parse.c'; else $(CYGPATH_W) '$(srcdir)/modules/parsers/nasm/nasm-parse.c'; fi`
+ mv -f $(DEPDIR)/nasm-parse.Tpo $(DEPDIR)/nasm-parse.Po
+# source='modules/parsers/nasm/nasm-parse.c' object='nasm-parse.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-parse.obj `if test -f 'modules/parsers/nasm/nasm-parse.c'; then $(CYGPATH_W) 'modules/parsers/nasm/nasm-parse.c'; else $(CYGPATH_W) '$(srcdir)/modules/parsers/nasm/nasm-parse.c'; fi`
+
+nasm-preproc.o: modules/preprocs/nasm/nasm-preproc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-preproc.o -MD -MP -MF $(DEPDIR)/nasm-preproc.Tpo -c -o nasm-preproc.o `test -f 'modules/preprocs/nasm/nasm-preproc.c' || echo '$(srcdir)/'`modules/preprocs/nasm/nasm-preproc.c
+ mv -f $(DEPDIR)/nasm-preproc.Tpo $(DEPDIR)/nasm-preproc.Po
+# source='modules/preprocs/nasm/nasm-preproc.c' object='nasm-preproc.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-preproc.o `test -f 'modules/preprocs/nasm/nasm-preproc.c' || echo '$(srcdir)/'`modules/preprocs/nasm/nasm-preproc.c
+
+nasm-preproc.obj: modules/preprocs/nasm/nasm-preproc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-preproc.obj -MD -MP -MF $(DEPDIR)/nasm-preproc.Tpo -c -o nasm-preproc.obj `if test -f 'modules/preprocs/nasm/nasm-preproc.c'; then $(CYGPATH_W) 'modules/preprocs/nasm/nasm-preproc.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/nasm/nasm-preproc.c'; fi`
+ mv -f $(DEPDIR)/nasm-preproc.Tpo $(DEPDIR)/nasm-preproc.Po
+# source='modules/preprocs/nasm/nasm-preproc.c' object='nasm-preproc.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-preproc.obj `if test -f 'modules/preprocs/nasm/nasm-preproc.c'; then $(CYGPATH_W) 'modules/preprocs/nasm/nasm-preproc.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/nasm/nasm-preproc.c'; fi`
+
+nasm-pp.o: modules/preprocs/nasm/nasm-pp.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-pp.o -MD -MP -MF $(DEPDIR)/nasm-pp.Tpo -c -o nasm-pp.o `test -f 'modules/preprocs/nasm/nasm-pp.c' || echo '$(srcdir)/'`modules/preprocs/nasm/nasm-pp.c
+ mv -f $(DEPDIR)/nasm-pp.Tpo $(DEPDIR)/nasm-pp.Po
+# source='modules/preprocs/nasm/nasm-pp.c' object='nasm-pp.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-pp.o `test -f 'modules/preprocs/nasm/nasm-pp.c' || echo '$(srcdir)/'`modules/preprocs/nasm/nasm-pp.c
+
+nasm-pp.obj: modules/preprocs/nasm/nasm-pp.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-pp.obj -MD -MP -MF $(DEPDIR)/nasm-pp.Tpo -c -o nasm-pp.obj `if test -f 'modules/preprocs/nasm/nasm-pp.c'; then $(CYGPATH_W) 'modules/preprocs/nasm/nasm-pp.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/nasm/nasm-pp.c'; fi`
+ mv -f $(DEPDIR)/nasm-pp.Tpo $(DEPDIR)/nasm-pp.Po
+# source='modules/preprocs/nasm/nasm-pp.c' object='nasm-pp.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-pp.obj `if test -f 'modules/preprocs/nasm/nasm-pp.c'; then $(CYGPATH_W) 'modules/preprocs/nasm/nasm-pp.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/nasm/nasm-pp.c'; fi`
+
+nasmlib.o: modules/preprocs/nasm/nasmlib.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasmlib.o -MD -MP -MF $(DEPDIR)/nasmlib.Tpo -c -o nasmlib.o `test -f 'modules/preprocs/nasm/nasmlib.c' || echo '$(srcdir)/'`modules/preprocs/nasm/nasmlib.c
+ mv -f $(DEPDIR)/nasmlib.Tpo $(DEPDIR)/nasmlib.Po
+# source='modules/preprocs/nasm/nasmlib.c' object='nasmlib.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasmlib.o `test -f 'modules/preprocs/nasm/nasmlib.c' || echo '$(srcdir)/'`modules/preprocs/nasm/nasmlib.c
+
+nasmlib.obj: modules/preprocs/nasm/nasmlib.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasmlib.obj -MD -MP -MF $(DEPDIR)/nasmlib.Tpo -c -o nasmlib.obj `if test -f 'modules/preprocs/nasm/nasmlib.c'; then $(CYGPATH_W) 'modules/preprocs/nasm/nasmlib.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/nasm/nasmlib.c'; fi`
+ mv -f $(DEPDIR)/nasmlib.Tpo $(DEPDIR)/nasmlib.Po
+# source='modules/preprocs/nasm/nasmlib.c' object='nasmlib.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasmlib.obj `if test -f 'modules/preprocs/nasm/nasmlib.c'; then $(CYGPATH_W) 'modules/preprocs/nasm/nasmlib.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/nasm/nasmlib.c'; fi`
+
+nasm-eval.o: modules/preprocs/nasm/nasm-eval.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-eval.o -MD -MP -MF $(DEPDIR)/nasm-eval.Tpo -c -o nasm-eval.o `test -f 'modules/preprocs/nasm/nasm-eval.c' || echo '$(srcdir)/'`modules/preprocs/nasm/nasm-eval.c
+ mv -f $(DEPDIR)/nasm-eval.Tpo $(DEPDIR)/nasm-eval.Po
+# source='modules/preprocs/nasm/nasm-eval.c' object='nasm-eval.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-eval.o `test -f 'modules/preprocs/nasm/nasm-eval.c' || echo '$(srcdir)/'`modules/preprocs/nasm/nasm-eval.c
+
+nasm-eval.obj: modules/preprocs/nasm/nasm-eval.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-eval.obj -MD -MP -MF $(DEPDIR)/nasm-eval.Tpo -c -o nasm-eval.obj `if test -f 'modules/preprocs/nasm/nasm-eval.c'; then $(CYGPATH_W) 'modules/preprocs/nasm/nasm-eval.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/nasm/nasm-eval.c'; fi`
+ mv -f $(DEPDIR)/nasm-eval.Tpo $(DEPDIR)/nasm-eval.Po
+# source='modules/preprocs/nasm/nasm-eval.c' object='nasm-eval.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-eval.obj `if test -f 'modules/preprocs/nasm/nasm-eval.c'; then $(CYGPATH_W) 'modules/preprocs/nasm/nasm-eval.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/nasm/nasm-eval.c'; fi`
+
+raw-preproc.o: modules/preprocs/raw/raw-preproc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT raw-preproc.o -MD -MP -MF $(DEPDIR)/raw-preproc.Tpo -c -o raw-preproc.o `test -f 'modules/preprocs/raw/raw-preproc.c' || echo '$(srcdir)/'`modules/preprocs/raw/raw-preproc.c
+ mv -f $(DEPDIR)/raw-preproc.Tpo $(DEPDIR)/raw-preproc.Po
+# source='modules/preprocs/raw/raw-preproc.c' object='raw-preproc.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o raw-preproc.o `test -f 'modules/preprocs/raw/raw-preproc.c' || echo '$(srcdir)/'`modules/preprocs/raw/raw-preproc.c
+
+raw-preproc.obj: modules/preprocs/raw/raw-preproc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT raw-preproc.obj -MD -MP -MF $(DEPDIR)/raw-preproc.Tpo -c -o raw-preproc.obj `if test -f 'modules/preprocs/raw/raw-preproc.c'; then $(CYGPATH_W) 'modules/preprocs/raw/raw-preproc.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/raw/raw-preproc.c'; fi`
+ mv -f $(DEPDIR)/raw-preproc.Tpo $(DEPDIR)/raw-preproc.Po
+# source='modules/preprocs/raw/raw-preproc.c' object='raw-preproc.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o raw-preproc.obj `if test -f 'modules/preprocs/raw/raw-preproc.c'; then $(CYGPATH_W) 'modules/preprocs/raw/raw-preproc.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/raw/raw-preproc.c'; fi`
+
+cpp-preproc.o: modules/preprocs/cpp/cpp-preproc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpp-preproc.o -MD -MP -MF $(DEPDIR)/cpp-preproc.Tpo -c -o cpp-preproc.o `test -f 'modules/preprocs/cpp/cpp-preproc.c' || echo '$(srcdir)/'`modules/preprocs/cpp/cpp-preproc.c
+ mv -f $(DEPDIR)/cpp-preproc.Tpo $(DEPDIR)/cpp-preproc.Po
+# source='modules/preprocs/cpp/cpp-preproc.c' object='cpp-preproc.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpp-preproc.o `test -f 'modules/preprocs/cpp/cpp-preproc.c' || echo '$(srcdir)/'`modules/preprocs/cpp/cpp-preproc.c
+
+cpp-preproc.obj: modules/preprocs/cpp/cpp-preproc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpp-preproc.obj -MD -MP -MF $(DEPDIR)/cpp-preproc.Tpo -c -o cpp-preproc.obj `if test -f 'modules/preprocs/cpp/cpp-preproc.c'; then $(CYGPATH_W) 'modules/preprocs/cpp/cpp-preproc.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/cpp/cpp-preproc.c'; fi`
+ mv -f $(DEPDIR)/cpp-preproc.Tpo $(DEPDIR)/cpp-preproc.Po
+# source='modules/preprocs/cpp/cpp-preproc.c' object='cpp-preproc.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpp-preproc.obj `if test -f 'modules/preprocs/cpp/cpp-preproc.c'; then $(CYGPATH_W) 'modules/preprocs/cpp/cpp-preproc.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/cpp/cpp-preproc.c'; fi`
+
+cv-dbgfmt.o: modules/dbgfmts/codeview/cv-dbgfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cv-dbgfmt.o -MD -MP -MF $(DEPDIR)/cv-dbgfmt.Tpo -c -o cv-dbgfmt.o `test -f 'modules/dbgfmts/codeview/cv-dbgfmt.c' || echo '$(srcdir)/'`modules/dbgfmts/codeview/cv-dbgfmt.c
+ mv -f $(DEPDIR)/cv-dbgfmt.Tpo $(DEPDIR)/cv-dbgfmt.Po
+# source='modules/dbgfmts/codeview/cv-dbgfmt.c' object='cv-dbgfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cv-dbgfmt.o `test -f 'modules/dbgfmts/codeview/cv-dbgfmt.c' || echo '$(srcdir)/'`modules/dbgfmts/codeview/cv-dbgfmt.c
+
+cv-dbgfmt.obj: modules/dbgfmts/codeview/cv-dbgfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cv-dbgfmt.obj -MD -MP -MF $(DEPDIR)/cv-dbgfmt.Tpo -c -o cv-dbgfmt.obj `if test -f 'modules/dbgfmts/codeview/cv-dbgfmt.c'; then $(CYGPATH_W) 'modules/dbgfmts/codeview/cv-dbgfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/codeview/cv-dbgfmt.c'; fi`
+ mv -f $(DEPDIR)/cv-dbgfmt.Tpo $(DEPDIR)/cv-dbgfmt.Po
+# source='modules/dbgfmts/codeview/cv-dbgfmt.c' object='cv-dbgfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cv-dbgfmt.obj `if test -f 'modules/dbgfmts/codeview/cv-dbgfmt.c'; then $(CYGPATH_W) 'modules/dbgfmts/codeview/cv-dbgfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/codeview/cv-dbgfmt.c'; fi`
+
+cv-symline.o: modules/dbgfmts/codeview/cv-symline.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cv-symline.o -MD -MP -MF $(DEPDIR)/cv-symline.Tpo -c -o cv-symline.o `test -f 'modules/dbgfmts/codeview/cv-symline.c' || echo '$(srcdir)/'`modules/dbgfmts/codeview/cv-symline.c
+ mv -f $(DEPDIR)/cv-symline.Tpo $(DEPDIR)/cv-symline.Po
+# source='modules/dbgfmts/codeview/cv-symline.c' object='cv-symline.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cv-symline.o `test -f 'modules/dbgfmts/codeview/cv-symline.c' || echo '$(srcdir)/'`modules/dbgfmts/codeview/cv-symline.c
+
+cv-symline.obj: modules/dbgfmts/codeview/cv-symline.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cv-symline.obj -MD -MP -MF $(DEPDIR)/cv-symline.Tpo -c -o cv-symline.obj `if test -f 'modules/dbgfmts/codeview/cv-symline.c'; then $(CYGPATH_W) 'modules/dbgfmts/codeview/cv-symline.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/codeview/cv-symline.c'; fi`
+ mv -f $(DEPDIR)/cv-symline.Tpo $(DEPDIR)/cv-symline.Po
+# source='modules/dbgfmts/codeview/cv-symline.c' object='cv-symline.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cv-symline.obj `if test -f 'modules/dbgfmts/codeview/cv-symline.c'; then $(CYGPATH_W) 'modules/dbgfmts/codeview/cv-symline.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/codeview/cv-symline.c'; fi`
+
+cv-type.o: modules/dbgfmts/codeview/cv-type.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cv-type.o -MD -MP -MF $(DEPDIR)/cv-type.Tpo -c -o cv-type.o `test -f 'modules/dbgfmts/codeview/cv-type.c' || echo '$(srcdir)/'`modules/dbgfmts/codeview/cv-type.c
+ mv -f $(DEPDIR)/cv-type.Tpo $(DEPDIR)/cv-type.Po
+# source='modules/dbgfmts/codeview/cv-type.c' object='cv-type.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cv-type.o `test -f 'modules/dbgfmts/codeview/cv-type.c' || echo '$(srcdir)/'`modules/dbgfmts/codeview/cv-type.c
+
+cv-type.obj: modules/dbgfmts/codeview/cv-type.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cv-type.obj -MD -MP -MF $(DEPDIR)/cv-type.Tpo -c -o cv-type.obj `if test -f 'modules/dbgfmts/codeview/cv-type.c'; then $(CYGPATH_W) 'modules/dbgfmts/codeview/cv-type.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/codeview/cv-type.c'; fi`
+ mv -f $(DEPDIR)/cv-type.Tpo $(DEPDIR)/cv-type.Po
+# source='modules/dbgfmts/codeview/cv-type.c' object='cv-type.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cv-type.obj `if test -f 'modules/dbgfmts/codeview/cv-type.c'; then $(CYGPATH_W) 'modules/dbgfmts/codeview/cv-type.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/codeview/cv-type.c'; fi`
+
+dwarf2-dbgfmt.o: modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dwarf2-dbgfmt.o -MD -MP -MF $(DEPDIR)/dwarf2-dbgfmt.Tpo -c -o dwarf2-dbgfmt.o `test -f 'modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c' || echo '$(srcdir)/'`modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c
+ mv -f $(DEPDIR)/dwarf2-dbgfmt.Tpo $(DEPDIR)/dwarf2-dbgfmt.Po
+# source='modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c' object='dwarf2-dbgfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dwarf2-dbgfmt.o `test -f 'modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c' || echo '$(srcdir)/'`modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c
+
+dwarf2-dbgfmt.obj: modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dwarf2-dbgfmt.obj -MD -MP -MF $(DEPDIR)/dwarf2-dbgfmt.Tpo -c -o dwarf2-dbgfmt.obj `if test -f 'modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c'; then $(CYGPATH_W) 'modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c'; fi`
+ mv -f $(DEPDIR)/dwarf2-dbgfmt.Tpo $(DEPDIR)/dwarf2-dbgfmt.Po
+# source='modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c' object='dwarf2-dbgfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dwarf2-dbgfmt.obj `if test -f 'modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c'; then $(CYGPATH_W) 'modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c'; fi`
+
+dwarf2-line.o: modules/dbgfmts/dwarf2/dwarf2-line.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dwarf2-line.o -MD -MP -MF $(DEPDIR)/dwarf2-line.Tpo -c -o dwarf2-line.o `test -f 'modules/dbgfmts/dwarf2/dwarf2-line.c' || echo '$(srcdir)/'`modules/dbgfmts/dwarf2/dwarf2-line.c
+ mv -f $(DEPDIR)/dwarf2-line.Tpo $(DEPDIR)/dwarf2-line.Po
+# source='modules/dbgfmts/dwarf2/dwarf2-line.c' object='dwarf2-line.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dwarf2-line.o `test -f 'modules/dbgfmts/dwarf2/dwarf2-line.c' || echo '$(srcdir)/'`modules/dbgfmts/dwarf2/dwarf2-line.c
+
+dwarf2-line.obj: modules/dbgfmts/dwarf2/dwarf2-line.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dwarf2-line.obj -MD -MP -MF $(DEPDIR)/dwarf2-line.Tpo -c -o dwarf2-line.obj `if test -f 'modules/dbgfmts/dwarf2/dwarf2-line.c'; then $(CYGPATH_W) 'modules/dbgfmts/dwarf2/dwarf2-line.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/dwarf2/dwarf2-line.c'; fi`
+ mv -f $(DEPDIR)/dwarf2-line.Tpo $(DEPDIR)/dwarf2-line.Po
+# source='modules/dbgfmts/dwarf2/dwarf2-line.c' object='dwarf2-line.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dwarf2-line.obj `if test -f 'modules/dbgfmts/dwarf2/dwarf2-line.c'; then $(CYGPATH_W) 'modules/dbgfmts/dwarf2/dwarf2-line.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/dwarf2/dwarf2-line.c'; fi`
+
+dwarf2-aranges.o: modules/dbgfmts/dwarf2/dwarf2-aranges.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dwarf2-aranges.o -MD -MP -MF $(DEPDIR)/dwarf2-aranges.Tpo -c -o dwarf2-aranges.o `test -f 'modules/dbgfmts/dwarf2/dwarf2-aranges.c' || echo '$(srcdir)/'`modules/dbgfmts/dwarf2/dwarf2-aranges.c
+ mv -f $(DEPDIR)/dwarf2-aranges.Tpo $(DEPDIR)/dwarf2-aranges.Po
+# source='modules/dbgfmts/dwarf2/dwarf2-aranges.c' object='dwarf2-aranges.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dwarf2-aranges.o `test -f 'modules/dbgfmts/dwarf2/dwarf2-aranges.c' || echo '$(srcdir)/'`modules/dbgfmts/dwarf2/dwarf2-aranges.c
+
+dwarf2-aranges.obj: modules/dbgfmts/dwarf2/dwarf2-aranges.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dwarf2-aranges.obj -MD -MP -MF $(DEPDIR)/dwarf2-aranges.Tpo -c -o dwarf2-aranges.obj `if test -f 'modules/dbgfmts/dwarf2/dwarf2-aranges.c'; then $(CYGPATH_W) 'modules/dbgfmts/dwarf2/dwarf2-aranges.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/dwarf2/dwarf2-aranges.c'; fi`
+ mv -f $(DEPDIR)/dwarf2-aranges.Tpo $(DEPDIR)/dwarf2-aranges.Po
+# source='modules/dbgfmts/dwarf2/dwarf2-aranges.c' object='dwarf2-aranges.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dwarf2-aranges.obj `if test -f 'modules/dbgfmts/dwarf2/dwarf2-aranges.c'; then $(CYGPATH_W) 'modules/dbgfmts/dwarf2/dwarf2-aranges.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/dwarf2/dwarf2-aranges.c'; fi`
+
+dwarf2-info.o: modules/dbgfmts/dwarf2/dwarf2-info.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dwarf2-info.o -MD -MP -MF $(DEPDIR)/dwarf2-info.Tpo -c -o dwarf2-info.o `test -f 'modules/dbgfmts/dwarf2/dwarf2-info.c' || echo '$(srcdir)/'`modules/dbgfmts/dwarf2/dwarf2-info.c
+ mv -f $(DEPDIR)/dwarf2-info.Tpo $(DEPDIR)/dwarf2-info.Po
+# source='modules/dbgfmts/dwarf2/dwarf2-info.c' object='dwarf2-info.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dwarf2-info.o `test -f 'modules/dbgfmts/dwarf2/dwarf2-info.c' || echo '$(srcdir)/'`modules/dbgfmts/dwarf2/dwarf2-info.c
+
+dwarf2-info.obj: modules/dbgfmts/dwarf2/dwarf2-info.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dwarf2-info.obj -MD -MP -MF $(DEPDIR)/dwarf2-info.Tpo -c -o dwarf2-info.obj `if test -f 'modules/dbgfmts/dwarf2/dwarf2-info.c'; then $(CYGPATH_W) 'modules/dbgfmts/dwarf2/dwarf2-info.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/dwarf2/dwarf2-info.c'; fi`
+ mv -f $(DEPDIR)/dwarf2-info.Tpo $(DEPDIR)/dwarf2-info.Po
+# source='modules/dbgfmts/dwarf2/dwarf2-info.c' object='dwarf2-info.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dwarf2-info.obj `if test -f 'modules/dbgfmts/dwarf2/dwarf2-info.c'; then $(CYGPATH_W) 'modules/dbgfmts/dwarf2/dwarf2-info.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/dwarf2/dwarf2-info.c'; fi`
+
+null-dbgfmt.o: modules/dbgfmts/null/null-dbgfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT null-dbgfmt.o -MD -MP -MF $(DEPDIR)/null-dbgfmt.Tpo -c -o null-dbgfmt.o `test -f 'modules/dbgfmts/null/null-dbgfmt.c' || echo '$(srcdir)/'`modules/dbgfmts/null/null-dbgfmt.c
+ mv -f $(DEPDIR)/null-dbgfmt.Tpo $(DEPDIR)/null-dbgfmt.Po
+# source='modules/dbgfmts/null/null-dbgfmt.c' object='null-dbgfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o null-dbgfmt.o `test -f 'modules/dbgfmts/null/null-dbgfmt.c' || echo '$(srcdir)/'`modules/dbgfmts/null/null-dbgfmt.c
+
+null-dbgfmt.obj: modules/dbgfmts/null/null-dbgfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT null-dbgfmt.obj -MD -MP -MF $(DEPDIR)/null-dbgfmt.Tpo -c -o null-dbgfmt.obj `if test -f 'modules/dbgfmts/null/null-dbgfmt.c'; then $(CYGPATH_W) 'modules/dbgfmts/null/null-dbgfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/null/null-dbgfmt.c'; fi`
+ mv -f $(DEPDIR)/null-dbgfmt.Tpo $(DEPDIR)/null-dbgfmt.Po
+# source='modules/dbgfmts/null/null-dbgfmt.c' object='null-dbgfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o null-dbgfmt.obj `if test -f 'modules/dbgfmts/null/null-dbgfmt.c'; then $(CYGPATH_W) 'modules/dbgfmts/null/null-dbgfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/null/null-dbgfmt.c'; fi`
+
+stabs-dbgfmt.o: modules/dbgfmts/stabs/stabs-dbgfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT stabs-dbgfmt.o -MD -MP -MF $(DEPDIR)/stabs-dbgfmt.Tpo -c -o stabs-dbgfmt.o `test -f 'modules/dbgfmts/stabs/stabs-dbgfmt.c' || echo '$(srcdir)/'`modules/dbgfmts/stabs/stabs-dbgfmt.c
+ mv -f $(DEPDIR)/stabs-dbgfmt.Tpo $(DEPDIR)/stabs-dbgfmt.Po
+# source='modules/dbgfmts/stabs/stabs-dbgfmt.c' object='stabs-dbgfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o stabs-dbgfmt.o `test -f 'modules/dbgfmts/stabs/stabs-dbgfmt.c' || echo '$(srcdir)/'`modules/dbgfmts/stabs/stabs-dbgfmt.c
+
+stabs-dbgfmt.obj: modules/dbgfmts/stabs/stabs-dbgfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT stabs-dbgfmt.obj -MD -MP -MF $(DEPDIR)/stabs-dbgfmt.Tpo -c -o stabs-dbgfmt.obj `if test -f 'modules/dbgfmts/stabs/stabs-dbgfmt.c'; then $(CYGPATH_W) 'modules/dbgfmts/stabs/stabs-dbgfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/stabs/stabs-dbgfmt.c'; fi`
+ mv -f $(DEPDIR)/stabs-dbgfmt.Tpo $(DEPDIR)/stabs-dbgfmt.Po
+# source='modules/dbgfmts/stabs/stabs-dbgfmt.c' object='stabs-dbgfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o stabs-dbgfmt.obj `if test -f 'modules/dbgfmts/stabs/stabs-dbgfmt.c'; then $(CYGPATH_W) 'modules/dbgfmts/stabs/stabs-dbgfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/stabs/stabs-dbgfmt.c'; fi`
+
+dbg-objfmt.o: modules/objfmts/dbg/dbg-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dbg-objfmt.o -MD -MP -MF $(DEPDIR)/dbg-objfmt.Tpo -c -o dbg-objfmt.o `test -f 'modules/objfmts/dbg/dbg-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/dbg/dbg-objfmt.c
+ mv -f $(DEPDIR)/dbg-objfmt.Tpo $(DEPDIR)/dbg-objfmt.Po
+# source='modules/objfmts/dbg/dbg-objfmt.c' object='dbg-objfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dbg-objfmt.o `test -f 'modules/objfmts/dbg/dbg-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/dbg/dbg-objfmt.c
+
+dbg-objfmt.obj: modules/objfmts/dbg/dbg-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dbg-objfmt.obj -MD -MP -MF $(DEPDIR)/dbg-objfmt.Tpo -c -o dbg-objfmt.obj `if test -f 'modules/objfmts/dbg/dbg-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/dbg/dbg-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/dbg/dbg-objfmt.c'; fi`
+ mv -f $(DEPDIR)/dbg-objfmt.Tpo $(DEPDIR)/dbg-objfmt.Po
+# source='modules/objfmts/dbg/dbg-objfmt.c' object='dbg-objfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dbg-objfmt.obj `if test -f 'modules/objfmts/dbg/dbg-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/dbg/dbg-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/dbg/dbg-objfmt.c'; fi`
+
+bin-objfmt.o: modules/objfmts/bin/bin-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bin-objfmt.o -MD -MP -MF $(DEPDIR)/bin-objfmt.Tpo -c -o bin-objfmt.o `test -f 'modules/objfmts/bin/bin-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/bin/bin-objfmt.c
+ mv -f $(DEPDIR)/bin-objfmt.Tpo $(DEPDIR)/bin-objfmt.Po
+# source='modules/objfmts/bin/bin-objfmt.c' object='bin-objfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bin-objfmt.o `test -f 'modules/objfmts/bin/bin-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/bin/bin-objfmt.c
+
+bin-objfmt.obj: modules/objfmts/bin/bin-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bin-objfmt.obj -MD -MP -MF $(DEPDIR)/bin-objfmt.Tpo -c -o bin-objfmt.obj `if test -f 'modules/objfmts/bin/bin-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/bin/bin-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/bin/bin-objfmt.c'; fi`
+ mv -f $(DEPDIR)/bin-objfmt.Tpo $(DEPDIR)/bin-objfmt.Po
+# source='modules/objfmts/bin/bin-objfmt.c' object='bin-objfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bin-objfmt.obj `if test -f 'modules/objfmts/bin/bin-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/bin/bin-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/bin/bin-objfmt.c'; fi`
+
+elf.o: modules/objfmts/elf/elf.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT elf.o -MD -MP -MF $(DEPDIR)/elf.Tpo -c -o elf.o `test -f 'modules/objfmts/elf/elf.c' || echo '$(srcdir)/'`modules/objfmts/elf/elf.c
+ mv -f $(DEPDIR)/elf.Tpo $(DEPDIR)/elf.Po
+# source='modules/objfmts/elf/elf.c' object='elf.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o elf.o `test -f 'modules/objfmts/elf/elf.c' || echo '$(srcdir)/'`modules/objfmts/elf/elf.c
+
+elf.obj: modules/objfmts/elf/elf.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT elf.obj -MD -MP -MF $(DEPDIR)/elf.Tpo -c -o elf.obj `if test -f 'modules/objfmts/elf/elf.c'; then $(CYGPATH_W) 'modules/objfmts/elf/elf.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/elf/elf.c'; fi`
+ mv -f $(DEPDIR)/elf.Tpo $(DEPDIR)/elf.Po
+# source='modules/objfmts/elf/elf.c' object='elf.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o elf.obj `if test -f 'modules/objfmts/elf/elf.c'; then $(CYGPATH_W) 'modules/objfmts/elf/elf.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/elf/elf.c'; fi`
+
+elf-objfmt.o: modules/objfmts/elf/elf-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT elf-objfmt.o -MD -MP -MF $(DEPDIR)/elf-objfmt.Tpo -c -o elf-objfmt.o `test -f 'modules/objfmts/elf/elf-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/elf/elf-objfmt.c
+ mv -f $(DEPDIR)/elf-objfmt.Tpo $(DEPDIR)/elf-objfmt.Po
+# source='modules/objfmts/elf/elf-objfmt.c' object='elf-objfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o elf-objfmt.o `test -f 'modules/objfmts/elf/elf-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/elf/elf-objfmt.c
+
+elf-objfmt.obj: modules/objfmts/elf/elf-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT elf-objfmt.obj -MD -MP -MF $(DEPDIR)/elf-objfmt.Tpo -c -o elf-objfmt.obj `if test -f 'modules/objfmts/elf/elf-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/elf/elf-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/elf/elf-objfmt.c'; fi`
+ mv -f $(DEPDIR)/elf-objfmt.Tpo $(DEPDIR)/elf-objfmt.Po
+# source='modules/objfmts/elf/elf-objfmt.c' object='elf-objfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o elf-objfmt.obj `if test -f 'modules/objfmts/elf/elf-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/elf/elf-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/elf/elf-objfmt.c'; fi`
+
+elf-x86-x86.o: modules/objfmts/elf/elf-x86-x86.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT elf-x86-x86.o -MD -MP -MF $(DEPDIR)/elf-x86-x86.Tpo -c -o elf-x86-x86.o `test -f 'modules/objfmts/elf/elf-x86-x86.c' || echo '$(srcdir)/'`modules/objfmts/elf/elf-x86-x86.c
+ mv -f $(DEPDIR)/elf-x86-x86.Tpo $(DEPDIR)/elf-x86-x86.Po
+# source='modules/objfmts/elf/elf-x86-x86.c' object='elf-x86-x86.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o elf-x86-x86.o `test -f 'modules/objfmts/elf/elf-x86-x86.c' || echo '$(srcdir)/'`modules/objfmts/elf/elf-x86-x86.c
+
+elf-x86-x86.obj: modules/objfmts/elf/elf-x86-x86.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT elf-x86-x86.obj -MD -MP -MF $(DEPDIR)/elf-x86-x86.Tpo -c -o elf-x86-x86.obj `if test -f 'modules/objfmts/elf/elf-x86-x86.c'; then $(CYGPATH_W) 'modules/objfmts/elf/elf-x86-x86.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/elf/elf-x86-x86.c'; fi`
+ mv -f $(DEPDIR)/elf-x86-x86.Tpo $(DEPDIR)/elf-x86-x86.Po
+# source='modules/objfmts/elf/elf-x86-x86.c' object='elf-x86-x86.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o elf-x86-x86.obj `if test -f 'modules/objfmts/elf/elf-x86-x86.c'; then $(CYGPATH_W) 'modules/objfmts/elf/elf-x86-x86.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/elf/elf-x86-x86.c'; fi`
+
+elf-x86-amd64.o: modules/objfmts/elf/elf-x86-amd64.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT elf-x86-amd64.o -MD -MP -MF $(DEPDIR)/elf-x86-amd64.Tpo -c -o elf-x86-amd64.o `test -f 'modules/objfmts/elf/elf-x86-amd64.c' || echo '$(srcdir)/'`modules/objfmts/elf/elf-x86-amd64.c
+ mv -f $(DEPDIR)/elf-x86-amd64.Tpo $(DEPDIR)/elf-x86-amd64.Po
+# source='modules/objfmts/elf/elf-x86-amd64.c' object='elf-x86-amd64.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o elf-x86-amd64.o `test -f 'modules/objfmts/elf/elf-x86-amd64.c' || echo '$(srcdir)/'`modules/objfmts/elf/elf-x86-amd64.c
+
+elf-x86-amd64.obj: modules/objfmts/elf/elf-x86-amd64.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT elf-x86-amd64.obj -MD -MP -MF $(DEPDIR)/elf-x86-amd64.Tpo -c -o elf-x86-amd64.obj `if test -f 'modules/objfmts/elf/elf-x86-amd64.c'; then $(CYGPATH_W) 'modules/objfmts/elf/elf-x86-amd64.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/elf/elf-x86-amd64.c'; fi`
+ mv -f $(DEPDIR)/elf-x86-amd64.Tpo $(DEPDIR)/elf-x86-amd64.Po
+# source='modules/objfmts/elf/elf-x86-amd64.c' object='elf-x86-amd64.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o elf-x86-amd64.obj `if test -f 'modules/objfmts/elf/elf-x86-amd64.c'; then $(CYGPATH_W) 'modules/objfmts/elf/elf-x86-amd64.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/elf/elf-x86-amd64.c'; fi`
+
+coff-objfmt.o: modules/objfmts/coff/coff-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT coff-objfmt.o -MD -MP -MF $(DEPDIR)/coff-objfmt.Tpo -c -o coff-objfmt.o `test -f 'modules/objfmts/coff/coff-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/coff/coff-objfmt.c
+ mv -f $(DEPDIR)/coff-objfmt.Tpo $(DEPDIR)/coff-objfmt.Po
+# source='modules/objfmts/coff/coff-objfmt.c' object='coff-objfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o coff-objfmt.o `test -f 'modules/objfmts/coff/coff-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/coff/coff-objfmt.c
+
+coff-objfmt.obj: modules/objfmts/coff/coff-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT coff-objfmt.obj -MD -MP -MF $(DEPDIR)/coff-objfmt.Tpo -c -o coff-objfmt.obj `if test -f 'modules/objfmts/coff/coff-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/coff/coff-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/coff/coff-objfmt.c'; fi`
+ mv -f $(DEPDIR)/coff-objfmt.Tpo $(DEPDIR)/coff-objfmt.Po
+# source='modules/objfmts/coff/coff-objfmt.c' object='coff-objfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o coff-objfmt.obj `if test -f 'modules/objfmts/coff/coff-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/coff/coff-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/coff/coff-objfmt.c'; fi`
+
+win64-except.o: modules/objfmts/coff/win64-except.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT win64-except.o -MD -MP -MF $(DEPDIR)/win64-except.Tpo -c -o win64-except.o `test -f 'modules/objfmts/coff/win64-except.c' || echo '$(srcdir)/'`modules/objfmts/coff/win64-except.c
+ mv -f $(DEPDIR)/win64-except.Tpo $(DEPDIR)/win64-except.Po
+# source='modules/objfmts/coff/win64-except.c' object='win64-except.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o win64-except.o `test -f 'modules/objfmts/coff/win64-except.c' || echo '$(srcdir)/'`modules/objfmts/coff/win64-except.c
+
+win64-except.obj: modules/objfmts/coff/win64-except.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT win64-except.obj -MD -MP -MF $(DEPDIR)/win64-except.Tpo -c -o win64-except.obj `if test -f 'modules/objfmts/coff/win64-except.c'; then $(CYGPATH_W) 'modules/objfmts/coff/win64-except.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/coff/win64-except.c'; fi`
+ mv -f $(DEPDIR)/win64-except.Tpo $(DEPDIR)/win64-except.Po
+# source='modules/objfmts/coff/win64-except.c' object='win64-except.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o win64-except.obj `if test -f 'modules/objfmts/coff/win64-except.c'; then $(CYGPATH_W) 'modules/objfmts/coff/win64-except.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/coff/win64-except.c'; fi`
+
+macho-objfmt.o: modules/objfmts/macho/macho-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT macho-objfmt.o -MD -MP -MF $(DEPDIR)/macho-objfmt.Tpo -c -o macho-objfmt.o `test -f 'modules/objfmts/macho/macho-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/macho/macho-objfmt.c
+ mv -f $(DEPDIR)/macho-objfmt.Tpo $(DEPDIR)/macho-objfmt.Po
+# source='modules/objfmts/macho/macho-objfmt.c' object='macho-objfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o macho-objfmt.o `test -f 'modules/objfmts/macho/macho-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/macho/macho-objfmt.c
+
+macho-objfmt.obj: modules/objfmts/macho/macho-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT macho-objfmt.obj -MD -MP -MF $(DEPDIR)/macho-objfmt.Tpo -c -o macho-objfmt.obj `if test -f 'modules/objfmts/macho/macho-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/macho/macho-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/macho/macho-objfmt.c'; fi`
+ mv -f $(DEPDIR)/macho-objfmt.Tpo $(DEPDIR)/macho-objfmt.Po
+# source='modules/objfmts/macho/macho-objfmt.c' object='macho-objfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o macho-objfmt.obj `if test -f 'modules/objfmts/macho/macho-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/macho/macho-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/macho/macho-objfmt.c'; fi`
+
+rdf-objfmt.o: modules/objfmts/rdf/rdf-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rdf-objfmt.o -MD -MP -MF $(DEPDIR)/rdf-objfmt.Tpo -c -o rdf-objfmt.o `test -f 'modules/objfmts/rdf/rdf-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/rdf/rdf-objfmt.c
+ mv -f $(DEPDIR)/rdf-objfmt.Tpo $(DEPDIR)/rdf-objfmt.Po
+# source='modules/objfmts/rdf/rdf-objfmt.c' object='rdf-objfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rdf-objfmt.o `test -f 'modules/objfmts/rdf/rdf-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/rdf/rdf-objfmt.c
+
+rdf-objfmt.obj: modules/objfmts/rdf/rdf-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rdf-objfmt.obj -MD -MP -MF $(DEPDIR)/rdf-objfmt.Tpo -c -o rdf-objfmt.obj `if test -f 'modules/objfmts/rdf/rdf-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/rdf/rdf-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/rdf/rdf-objfmt.c'; fi`
+ mv -f $(DEPDIR)/rdf-objfmt.Tpo $(DEPDIR)/rdf-objfmt.Po
+# source='modules/objfmts/rdf/rdf-objfmt.c' object='rdf-objfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rdf-objfmt.obj `if test -f 'modules/objfmts/rdf/rdf-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/rdf/rdf-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/rdf/rdf-objfmt.c'; fi`
+
+xdf-objfmt.o: modules/objfmts/xdf/xdf-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xdf-objfmt.o -MD -MP -MF $(DEPDIR)/xdf-objfmt.Tpo -c -o xdf-objfmt.o `test -f 'modules/objfmts/xdf/xdf-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/xdf/xdf-objfmt.c
+ mv -f $(DEPDIR)/xdf-objfmt.Tpo $(DEPDIR)/xdf-objfmt.Po
+# source='modules/objfmts/xdf/xdf-objfmt.c' object='xdf-objfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xdf-objfmt.o `test -f 'modules/objfmts/xdf/xdf-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/xdf/xdf-objfmt.c
+
+xdf-objfmt.obj: modules/objfmts/xdf/xdf-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xdf-objfmt.obj -MD -MP -MF $(DEPDIR)/xdf-objfmt.Tpo -c -o xdf-objfmt.obj `if test -f 'modules/objfmts/xdf/xdf-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/xdf/xdf-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/xdf/xdf-objfmt.c'; fi`
+ mv -f $(DEPDIR)/xdf-objfmt.Tpo $(DEPDIR)/xdf-objfmt.Po
+# source='modules/objfmts/xdf/xdf-objfmt.c' object='xdf-objfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xdf-objfmt.obj `if test -f 'modules/objfmts/xdf/xdf-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/xdf/xdf-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/xdf/xdf-objfmt.c'; fi`
+
+assocdat.o: libyasm/assocdat.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT assocdat.o -MD -MP -MF $(DEPDIR)/assocdat.Tpo -c -o assocdat.o `test -f 'libyasm/assocdat.c' || echo '$(srcdir)/'`libyasm/assocdat.c
+ mv -f $(DEPDIR)/assocdat.Tpo $(DEPDIR)/assocdat.Po
+# source='libyasm/assocdat.c' object='assocdat.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o assocdat.o `test -f 'libyasm/assocdat.c' || echo '$(srcdir)/'`libyasm/assocdat.c
+
+assocdat.obj: libyasm/assocdat.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT assocdat.obj -MD -MP -MF $(DEPDIR)/assocdat.Tpo -c -o assocdat.obj `if test -f 'libyasm/assocdat.c'; then $(CYGPATH_W) 'libyasm/assocdat.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/assocdat.c'; fi`
+ mv -f $(DEPDIR)/assocdat.Tpo $(DEPDIR)/assocdat.Po
+# source='libyasm/assocdat.c' object='assocdat.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o assocdat.obj `if test -f 'libyasm/assocdat.c'; then $(CYGPATH_W) 'libyasm/assocdat.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/assocdat.c'; fi`
+
+bitvect.o: libyasm/bitvect.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bitvect.o -MD -MP -MF $(DEPDIR)/bitvect.Tpo -c -o bitvect.o `test -f 'libyasm/bitvect.c' || echo '$(srcdir)/'`libyasm/bitvect.c
+ mv -f $(DEPDIR)/bitvect.Tpo $(DEPDIR)/bitvect.Po
+# source='libyasm/bitvect.c' object='bitvect.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bitvect.o `test -f 'libyasm/bitvect.c' || echo '$(srcdir)/'`libyasm/bitvect.c
+
+bitvect.obj: libyasm/bitvect.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bitvect.obj -MD -MP -MF $(DEPDIR)/bitvect.Tpo -c -o bitvect.obj `if test -f 'libyasm/bitvect.c'; then $(CYGPATH_W) 'libyasm/bitvect.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bitvect.c'; fi`
+ mv -f $(DEPDIR)/bitvect.Tpo $(DEPDIR)/bitvect.Po
+# source='libyasm/bitvect.c' object='bitvect.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bitvect.obj `if test -f 'libyasm/bitvect.c'; then $(CYGPATH_W) 'libyasm/bitvect.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bitvect.c'; fi`
+
+bc-align.o: libyasm/bc-align.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bc-align.o -MD -MP -MF $(DEPDIR)/bc-align.Tpo -c -o bc-align.o `test -f 'libyasm/bc-align.c' || echo '$(srcdir)/'`libyasm/bc-align.c
+ mv -f $(DEPDIR)/bc-align.Tpo $(DEPDIR)/bc-align.Po
+# source='libyasm/bc-align.c' object='bc-align.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bc-align.o `test -f 'libyasm/bc-align.c' || echo '$(srcdir)/'`libyasm/bc-align.c
+
+bc-align.obj: libyasm/bc-align.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bc-align.obj -MD -MP -MF $(DEPDIR)/bc-align.Tpo -c -o bc-align.obj `if test -f 'libyasm/bc-align.c'; then $(CYGPATH_W) 'libyasm/bc-align.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bc-align.c'; fi`
+ mv -f $(DEPDIR)/bc-align.Tpo $(DEPDIR)/bc-align.Po
+# source='libyasm/bc-align.c' object='bc-align.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bc-align.obj `if test -f 'libyasm/bc-align.c'; then $(CYGPATH_W) 'libyasm/bc-align.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bc-align.c'; fi`
+
+bc-data.o: libyasm/bc-data.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bc-data.o -MD -MP -MF $(DEPDIR)/bc-data.Tpo -c -o bc-data.o `test -f 'libyasm/bc-data.c' || echo '$(srcdir)/'`libyasm/bc-data.c
+ mv -f $(DEPDIR)/bc-data.Tpo $(DEPDIR)/bc-data.Po
+# source='libyasm/bc-data.c' object='bc-data.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bc-data.o `test -f 'libyasm/bc-data.c' || echo '$(srcdir)/'`libyasm/bc-data.c
+
+bc-data.obj: libyasm/bc-data.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bc-data.obj -MD -MP -MF $(DEPDIR)/bc-data.Tpo -c -o bc-data.obj `if test -f 'libyasm/bc-data.c'; then $(CYGPATH_W) 'libyasm/bc-data.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bc-data.c'; fi`
+ mv -f $(DEPDIR)/bc-data.Tpo $(DEPDIR)/bc-data.Po
+# source='libyasm/bc-data.c' object='bc-data.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bc-data.obj `if test -f 'libyasm/bc-data.c'; then $(CYGPATH_W) 'libyasm/bc-data.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bc-data.c'; fi`
+
+bc-incbin.o: libyasm/bc-incbin.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bc-incbin.o -MD -MP -MF $(DEPDIR)/bc-incbin.Tpo -c -o bc-incbin.o `test -f 'libyasm/bc-incbin.c' || echo '$(srcdir)/'`libyasm/bc-incbin.c
+ mv -f $(DEPDIR)/bc-incbin.Tpo $(DEPDIR)/bc-incbin.Po
+# source='libyasm/bc-incbin.c' object='bc-incbin.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bc-incbin.o `test -f 'libyasm/bc-incbin.c' || echo '$(srcdir)/'`libyasm/bc-incbin.c
+
+bc-incbin.obj: libyasm/bc-incbin.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bc-incbin.obj -MD -MP -MF $(DEPDIR)/bc-incbin.Tpo -c -o bc-incbin.obj `if test -f 'libyasm/bc-incbin.c'; then $(CYGPATH_W) 'libyasm/bc-incbin.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bc-incbin.c'; fi`
+ mv -f $(DEPDIR)/bc-incbin.Tpo $(DEPDIR)/bc-incbin.Po
+# source='libyasm/bc-incbin.c' object='bc-incbin.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bc-incbin.obj `if test -f 'libyasm/bc-incbin.c'; then $(CYGPATH_W) 'libyasm/bc-incbin.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bc-incbin.c'; fi`
+
+bc-org.o: libyasm/bc-org.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bc-org.o -MD -MP -MF $(DEPDIR)/bc-org.Tpo -c -o bc-org.o `test -f 'libyasm/bc-org.c' || echo '$(srcdir)/'`libyasm/bc-org.c
+ mv -f $(DEPDIR)/bc-org.Tpo $(DEPDIR)/bc-org.Po
+# source='libyasm/bc-org.c' object='bc-org.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bc-org.o `test -f 'libyasm/bc-org.c' || echo '$(srcdir)/'`libyasm/bc-org.c
+
+bc-org.obj: libyasm/bc-org.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bc-org.obj -MD -MP -MF $(DEPDIR)/bc-org.Tpo -c -o bc-org.obj `if test -f 'libyasm/bc-org.c'; then $(CYGPATH_W) 'libyasm/bc-org.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bc-org.c'; fi`
+ mv -f $(DEPDIR)/bc-org.Tpo $(DEPDIR)/bc-org.Po
+# source='libyasm/bc-org.c' object='bc-org.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bc-org.obj `if test -f 'libyasm/bc-org.c'; then $(CYGPATH_W) 'libyasm/bc-org.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bc-org.c'; fi`
+
+bc-reserve.o: libyasm/bc-reserve.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bc-reserve.o -MD -MP -MF $(DEPDIR)/bc-reserve.Tpo -c -o bc-reserve.o `test -f 'libyasm/bc-reserve.c' || echo '$(srcdir)/'`libyasm/bc-reserve.c
+ mv -f $(DEPDIR)/bc-reserve.Tpo $(DEPDIR)/bc-reserve.Po
+# source='libyasm/bc-reserve.c' object='bc-reserve.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bc-reserve.o `test -f 'libyasm/bc-reserve.c' || echo '$(srcdir)/'`libyasm/bc-reserve.c
+
+bc-reserve.obj: libyasm/bc-reserve.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bc-reserve.obj -MD -MP -MF $(DEPDIR)/bc-reserve.Tpo -c -o bc-reserve.obj `if test -f 'libyasm/bc-reserve.c'; then $(CYGPATH_W) 'libyasm/bc-reserve.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bc-reserve.c'; fi`
+ mv -f $(DEPDIR)/bc-reserve.Tpo $(DEPDIR)/bc-reserve.Po
+# source='libyasm/bc-reserve.c' object='bc-reserve.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bc-reserve.obj `if test -f 'libyasm/bc-reserve.c'; then $(CYGPATH_W) 'libyasm/bc-reserve.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bc-reserve.c'; fi`
+
+bytecode.o: libyasm/bytecode.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bytecode.o -MD -MP -MF $(DEPDIR)/bytecode.Tpo -c -o bytecode.o `test -f 'libyasm/bytecode.c' || echo '$(srcdir)/'`libyasm/bytecode.c
+ mv -f $(DEPDIR)/bytecode.Tpo $(DEPDIR)/bytecode.Po
+# source='libyasm/bytecode.c' object='bytecode.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bytecode.o `test -f 'libyasm/bytecode.c' || echo '$(srcdir)/'`libyasm/bytecode.c
+
+bytecode.obj: libyasm/bytecode.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bytecode.obj -MD -MP -MF $(DEPDIR)/bytecode.Tpo -c -o bytecode.obj `if test -f 'libyasm/bytecode.c'; then $(CYGPATH_W) 'libyasm/bytecode.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bytecode.c'; fi`
+ mv -f $(DEPDIR)/bytecode.Tpo $(DEPDIR)/bytecode.Po
+# source='libyasm/bytecode.c' object='bytecode.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bytecode.obj `if test -f 'libyasm/bytecode.c'; then $(CYGPATH_W) 'libyasm/bytecode.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bytecode.c'; fi`
+
+errwarn.o: libyasm/errwarn.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT errwarn.o -MD -MP -MF $(DEPDIR)/errwarn.Tpo -c -o errwarn.o `test -f 'libyasm/errwarn.c' || echo '$(srcdir)/'`libyasm/errwarn.c
+ mv -f $(DEPDIR)/errwarn.Tpo $(DEPDIR)/errwarn.Po
+# source='libyasm/errwarn.c' object='errwarn.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o errwarn.o `test -f 'libyasm/errwarn.c' || echo '$(srcdir)/'`libyasm/errwarn.c
+
+errwarn.obj: libyasm/errwarn.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT errwarn.obj -MD -MP -MF $(DEPDIR)/errwarn.Tpo -c -o errwarn.obj `if test -f 'libyasm/errwarn.c'; then $(CYGPATH_W) 'libyasm/errwarn.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/errwarn.c'; fi`
+ mv -f $(DEPDIR)/errwarn.Tpo $(DEPDIR)/errwarn.Po
+# source='libyasm/errwarn.c' object='errwarn.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o errwarn.obj `if test -f 'libyasm/errwarn.c'; then $(CYGPATH_W) 'libyasm/errwarn.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/errwarn.c'; fi`
+
+expr.o: libyasm/expr.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT expr.o -MD -MP -MF $(DEPDIR)/expr.Tpo -c -o expr.o `test -f 'libyasm/expr.c' || echo '$(srcdir)/'`libyasm/expr.c
+ mv -f $(DEPDIR)/expr.Tpo $(DEPDIR)/expr.Po
+# source='libyasm/expr.c' object='expr.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o expr.o `test -f 'libyasm/expr.c' || echo '$(srcdir)/'`libyasm/expr.c
+
+expr.obj: libyasm/expr.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT expr.obj -MD -MP -MF $(DEPDIR)/expr.Tpo -c -o expr.obj `if test -f 'libyasm/expr.c'; then $(CYGPATH_W) 'libyasm/expr.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/expr.c'; fi`
+ mv -f $(DEPDIR)/expr.Tpo $(DEPDIR)/expr.Po
+# source='libyasm/expr.c' object='expr.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o expr.obj `if test -f 'libyasm/expr.c'; then $(CYGPATH_W) 'libyasm/expr.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/expr.c'; fi`
+
+file.o: libyasm/file.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT file.o -MD -MP -MF $(DEPDIR)/file.Tpo -c -o file.o `test -f 'libyasm/file.c' || echo '$(srcdir)/'`libyasm/file.c
+ mv -f $(DEPDIR)/file.Tpo $(DEPDIR)/file.Po
+# source='libyasm/file.c' object='file.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o file.o `test -f 'libyasm/file.c' || echo '$(srcdir)/'`libyasm/file.c
+
+file.obj: libyasm/file.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT file.obj -MD -MP -MF $(DEPDIR)/file.Tpo -c -o file.obj `if test -f 'libyasm/file.c'; then $(CYGPATH_W) 'libyasm/file.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/file.c'; fi`
+ mv -f $(DEPDIR)/file.Tpo $(DEPDIR)/file.Po
+# source='libyasm/file.c' object='file.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o file.obj `if test -f 'libyasm/file.c'; then $(CYGPATH_W) 'libyasm/file.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/file.c'; fi`
+
+floatnum.o: libyasm/floatnum.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT floatnum.o -MD -MP -MF $(DEPDIR)/floatnum.Tpo -c -o floatnum.o `test -f 'libyasm/floatnum.c' || echo '$(srcdir)/'`libyasm/floatnum.c
+ mv -f $(DEPDIR)/floatnum.Tpo $(DEPDIR)/floatnum.Po
+# source='libyasm/floatnum.c' object='floatnum.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o floatnum.o `test -f 'libyasm/floatnum.c' || echo '$(srcdir)/'`libyasm/floatnum.c
+
+floatnum.obj: libyasm/floatnum.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT floatnum.obj -MD -MP -MF $(DEPDIR)/floatnum.Tpo -c -o floatnum.obj `if test -f 'libyasm/floatnum.c'; then $(CYGPATH_W) 'libyasm/floatnum.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/floatnum.c'; fi`
+ mv -f $(DEPDIR)/floatnum.Tpo $(DEPDIR)/floatnum.Po
+# source='libyasm/floatnum.c' object='floatnum.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o floatnum.obj `if test -f 'libyasm/floatnum.c'; then $(CYGPATH_W) 'libyasm/floatnum.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/floatnum.c'; fi`
+
+hamt.o: libyasm/hamt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT hamt.o -MD -MP -MF $(DEPDIR)/hamt.Tpo -c -o hamt.o `test -f 'libyasm/hamt.c' || echo '$(srcdir)/'`libyasm/hamt.c
+ mv -f $(DEPDIR)/hamt.Tpo $(DEPDIR)/hamt.Po
+# source='libyasm/hamt.c' object='hamt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o hamt.o `test -f 'libyasm/hamt.c' || echo '$(srcdir)/'`libyasm/hamt.c
+
+hamt.obj: libyasm/hamt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT hamt.obj -MD -MP -MF $(DEPDIR)/hamt.Tpo -c -o hamt.obj `if test -f 'libyasm/hamt.c'; then $(CYGPATH_W) 'libyasm/hamt.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/hamt.c'; fi`
+ mv -f $(DEPDIR)/hamt.Tpo $(DEPDIR)/hamt.Po
+# source='libyasm/hamt.c' object='hamt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o hamt.obj `if test -f 'libyasm/hamt.c'; then $(CYGPATH_W) 'libyasm/hamt.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/hamt.c'; fi`
+
+insn.o: libyasm/insn.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT insn.o -MD -MP -MF $(DEPDIR)/insn.Tpo -c -o insn.o `test -f 'libyasm/insn.c' || echo '$(srcdir)/'`libyasm/insn.c
+ mv -f $(DEPDIR)/insn.Tpo $(DEPDIR)/insn.Po
+# source='libyasm/insn.c' object='insn.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o insn.o `test -f 'libyasm/insn.c' || echo '$(srcdir)/'`libyasm/insn.c
+
+insn.obj: libyasm/insn.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT insn.obj -MD -MP -MF $(DEPDIR)/insn.Tpo -c -o insn.obj `if test -f 'libyasm/insn.c'; then $(CYGPATH_W) 'libyasm/insn.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/insn.c'; fi`
+ mv -f $(DEPDIR)/insn.Tpo $(DEPDIR)/insn.Po
+# source='libyasm/insn.c' object='insn.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o insn.obj `if test -f 'libyasm/insn.c'; then $(CYGPATH_W) 'libyasm/insn.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/insn.c'; fi`
+
+intnum.o: libyasm/intnum.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT intnum.o -MD -MP -MF $(DEPDIR)/intnum.Tpo -c -o intnum.o `test -f 'libyasm/intnum.c' || echo '$(srcdir)/'`libyasm/intnum.c
+ mv -f $(DEPDIR)/intnum.Tpo $(DEPDIR)/intnum.Po
+# source='libyasm/intnum.c' object='intnum.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o intnum.o `test -f 'libyasm/intnum.c' || echo '$(srcdir)/'`libyasm/intnum.c
+
+intnum.obj: libyasm/intnum.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT intnum.obj -MD -MP -MF $(DEPDIR)/intnum.Tpo -c -o intnum.obj `if test -f 'libyasm/intnum.c'; then $(CYGPATH_W) 'libyasm/intnum.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/intnum.c'; fi`
+ mv -f $(DEPDIR)/intnum.Tpo $(DEPDIR)/intnum.Po
+# source='libyasm/intnum.c' object='intnum.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o intnum.obj `if test -f 'libyasm/intnum.c'; then $(CYGPATH_W) 'libyasm/intnum.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/intnum.c'; fi`
+
+inttree.o: libyasm/inttree.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT inttree.o -MD -MP -MF $(DEPDIR)/inttree.Tpo -c -o inttree.o `test -f 'libyasm/inttree.c' || echo '$(srcdir)/'`libyasm/inttree.c
+ mv -f $(DEPDIR)/inttree.Tpo $(DEPDIR)/inttree.Po
+# source='libyasm/inttree.c' object='inttree.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o inttree.o `test -f 'libyasm/inttree.c' || echo '$(srcdir)/'`libyasm/inttree.c
+
+inttree.obj: libyasm/inttree.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT inttree.obj -MD -MP -MF $(DEPDIR)/inttree.Tpo -c -o inttree.obj `if test -f 'libyasm/inttree.c'; then $(CYGPATH_W) 'libyasm/inttree.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/inttree.c'; fi`
+ mv -f $(DEPDIR)/inttree.Tpo $(DEPDIR)/inttree.Po
+# source='libyasm/inttree.c' object='inttree.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o inttree.obj `if test -f 'libyasm/inttree.c'; then $(CYGPATH_W) 'libyasm/inttree.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/inttree.c'; fi`
+
+linemap.o: libyasm/linemap.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT linemap.o -MD -MP -MF $(DEPDIR)/linemap.Tpo -c -o linemap.o `test -f 'libyasm/linemap.c' || echo '$(srcdir)/'`libyasm/linemap.c
+ mv -f $(DEPDIR)/linemap.Tpo $(DEPDIR)/linemap.Po
+# source='libyasm/linemap.c' object='linemap.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o linemap.o `test -f 'libyasm/linemap.c' || echo '$(srcdir)/'`libyasm/linemap.c
+
+linemap.obj: libyasm/linemap.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT linemap.obj -MD -MP -MF $(DEPDIR)/linemap.Tpo -c -o linemap.obj `if test -f 'libyasm/linemap.c'; then $(CYGPATH_W) 'libyasm/linemap.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/linemap.c'; fi`
+ mv -f $(DEPDIR)/linemap.Tpo $(DEPDIR)/linemap.Po
+# source='libyasm/linemap.c' object='linemap.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o linemap.obj `if test -f 'libyasm/linemap.c'; then $(CYGPATH_W) 'libyasm/linemap.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/linemap.c'; fi`
+
+md5.o: libyasm/md5.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT md5.o -MD -MP -MF $(DEPDIR)/md5.Tpo -c -o md5.o `test -f 'libyasm/md5.c' || echo '$(srcdir)/'`libyasm/md5.c
+ mv -f $(DEPDIR)/md5.Tpo $(DEPDIR)/md5.Po
+# source='libyasm/md5.c' object='md5.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o md5.o `test -f 'libyasm/md5.c' || echo '$(srcdir)/'`libyasm/md5.c
+
+md5.obj: libyasm/md5.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT md5.obj -MD -MP -MF $(DEPDIR)/md5.Tpo -c -o md5.obj `if test -f 'libyasm/md5.c'; then $(CYGPATH_W) 'libyasm/md5.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/md5.c'; fi`
+ mv -f $(DEPDIR)/md5.Tpo $(DEPDIR)/md5.Po
+# source='libyasm/md5.c' object='md5.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o md5.obj `if test -f 'libyasm/md5.c'; then $(CYGPATH_W) 'libyasm/md5.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/md5.c'; fi`
+
+mergesort.o: libyasm/mergesort.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mergesort.o -MD -MP -MF $(DEPDIR)/mergesort.Tpo -c -o mergesort.o `test -f 'libyasm/mergesort.c' || echo '$(srcdir)/'`libyasm/mergesort.c
+ mv -f $(DEPDIR)/mergesort.Tpo $(DEPDIR)/mergesort.Po
+# source='libyasm/mergesort.c' object='mergesort.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mergesort.o `test -f 'libyasm/mergesort.c' || echo '$(srcdir)/'`libyasm/mergesort.c
+
+mergesort.obj: libyasm/mergesort.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mergesort.obj -MD -MP -MF $(DEPDIR)/mergesort.Tpo -c -o mergesort.obj `if test -f 'libyasm/mergesort.c'; then $(CYGPATH_W) 'libyasm/mergesort.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/mergesort.c'; fi`
+ mv -f $(DEPDIR)/mergesort.Tpo $(DEPDIR)/mergesort.Po
+# source='libyasm/mergesort.c' object='mergesort.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mergesort.obj `if test -f 'libyasm/mergesort.c'; then $(CYGPATH_W) 'libyasm/mergesort.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/mergesort.c'; fi`
+
+phash.o: libyasm/phash.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT phash.o -MD -MP -MF $(DEPDIR)/phash.Tpo -c -o phash.o `test -f 'libyasm/phash.c' || echo '$(srcdir)/'`libyasm/phash.c
+ mv -f $(DEPDIR)/phash.Tpo $(DEPDIR)/phash.Po
+# source='libyasm/phash.c' object='phash.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o phash.o `test -f 'libyasm/phash.c' || echo '$(srcdir)/'`libyasm/phash.c
+
+phash.obj: libyasm/phash.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT phash.obj -MD -MP -MF $(DEPDIR)/phash.Tpo -c -o phash.obj `if test -f 'libyasm/phash.c'; then $(CYGPATH_W) 'libyasm/phash.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/phash.c'; fi`
+ mv -f $(DEPDIR)/phash.Tpo $(DEPDIR)/phash.Po
+# source='libyasm/phash.c' object='phash.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o phash.obj `if test -f 'libyasm/phash.c'; then $(CYGPATH_W) 'libyasm/phash.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/phash.c'; fi`
+
+section.o: libyasm/section.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT section.o -MD -MP -MF $(DEPDIR)/section.Tpo -c -o section.o `test -f 'libyasm/section.c' || echo '$(srcdir)/'`libyasm/section.c
+ mv -f $(DEPDIR)/section.Tpo $(DEPDIR)/section.Po
+# source='libyasm/section.c' object='section.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o section.o `test -f 'libyasm/section.c' || echo '$(srcdir)/'`libyasm/section.c
+
+section.obj: libyasm/section.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT section.obj -MD -MP -MF $(DEPDIR)/section.Tpo -c -o section.obj `if test -f 'libyasm/section.c'; then $(CYGPATH_W) 'libyasm/section.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/section.c'; fi`
+ mv -f $(DEPDIR)/section.Tpo $(DEPDIR)/section.Po
+# source='libyasm/section.c' object='section.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o section.obj `if test -f 'libyasm/section.c'; then $(CYGPATH_W) 'libyasm/section.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/section.c'; fi`
+
+strcasecmp.o: libyasm/strcasecmp.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT strcasecmp.o -MD -MP -MF $(DEPDIR)/strcasecmp.Tpo -c -o strcasecmp.o `test -f 'libyasm/strcasecmp.c' || echo '$(srcdir)/'`libyasm/strcasecmp.c
+ mv -f $(DEPDIR)/strcasecmp.Tpo $(DEPDIR)/strcasecmp.Po
+# source='libyasm/strcasecmp.c' object='strcasecmp.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o strcasecmp.o `test -f 'libyasm/strcasecmp.c' || echo '$(srcdir)/'`libyasm/strcasecmp.c
+
+strcasecmp.obj: libyasm/strcasecmp.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT strcasecmp.obj -MD -MP -MF $(DEPDIR)/strcasecmp.Tpo -c -o strcasecmp.obj `if test -f 'libyasm/strcasecmp.c'; then $(CYGPATH_W) 'libyasm/strcasecmp.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/strcasecmp.c'; fi`
+ mv -f $(DEPDIR)/strcasecmp.Tpo $(DEPDIR)/strcasecmp.Po
+# source='libyasm/strcasecmp.c' object='strcasecmp.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o strcasecmp.obj `if test -f 'libyasm/strcasecmp.c'; then $(CYGPATH_W) 'libyasm/strcasecmp.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/strcasecmp.c'; fi`
+
+strsep.o: libyasm/strsep.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT strsep.o -MD -MP -MF $(DEPDIR)/strsep.Tpo -c -o strsep.o `test -f 'libyasm/strsep.c' || echo '$(srcdir)/'`libyasm/strsep.c
+ mv -f $(DEPDIR)/strsep.Tpo $(DEPDIR)/strsep.Po
+# source='libyasm/strsep.c' object='strsep.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o strsep.o `test -f 'libyasm/strsep.c' || echo '$(srcdir)/'`libyasm/strsep.c
+
+strsep.obj: libyasm/strsep.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT strsep.obj -MD -MP -MF $(DEPDIR)/strsep.Tpo -c -o strsep.obj `if test -f 'libyasm/strsep.c'; then $(CYGPATH_W) 'libyasm/strsep.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/strsep.c'; fi`
+ mv -f $(DEPDIR)/strsep.Tpo $(DEPDIR)/strsep.Po
+# source='libyasm/strsep.c' object='strsep.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o strsep.obj `if test -f 'libyasm/strsep.c'; then $(CYGPATH_W) 'libyasm/strsep.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/strsep.c'; fi`
+
+symrec.o: libyasm/symrec.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT symrec.o -MD -MP -MF $(DEPDIR)/symrec.Tpo -c -o symrec.o `test -f 'libyasm/symrec.c' || echo '$(srcdir)/'`libyasm/symrec.c
+ mv -f $(DEPDIR)/symrec.Tpo $(DEPDIR)/symrec.Po
+# source='libyasm/symrec.c' object='symrec.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o symrec.o `test -f 'libyasm/symrec.c' || echo '$(srcdir)/'`libyasm/symrec.c
+
+symrec.obj: libyasm/symrec.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT symrec.obj -MD -MP -MF $(DEPDIR)/symrec.Tpo -c -o symrec.obj `if test -f 'libyasm/symrec.c'; then $(CYGPATH_W) 'libyasm/symrec.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/symrec.c'; fi`
+ mv -f $(DEPDIR)/symrec.Tpo $(DEPDIR)/symrec.Po
+# source='libyasm/symrec.c' object='symrec.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o symrec.obj `if test -f 'libyasm/symrec.c'; then $(CYGPATH_W) 'libyasm/symrec.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/symrec.c'; fi`
+
+valparam.o: libyasm/valparam.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT valparam.o -MD -MP -MF $(DEPDIR)/valparam.Tpo -c -o valparam.o `test -f 'libyasm/valparam.c' || echo '$(srcdir)/'`libyasm/valparam.c
+ mv -f $(DEPDIR)/valparam.Tpo $(DEPDIR)/valparam.Po
+# source='libyasm/valparam.c' object='valparam.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o valparam.o `test -f 'libyasm/valparam.c' || echo '$(srcdir)/'`libyasm/valparam.c
+
+valparam.obj: libyasm/valparam.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT valparam.obj -MD -MP -MF $(DEPDIR)/valparam.Tpo -c -o valparam.obj `if test -f 'libyasm/valparam.c'; then $(CYGPATH_W) 'libyasm/valparam.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/valparam.c'; fi`
+ mv -f $(DEPDIR)/valparam.Tpo $(DEPDIR)/valparam.Po
+# source='libyasm/valparam.c' object='valparam.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o valparam.obj `if test -f 'libyasm/valparam.c'; then $(CYGPATH_W) 'libyasm/valparam.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/valparam.c'; fi`
+
+value.o: libyasm/value.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT value.o -MD -MP -MF $(DEPDIR)/value.Tpo -c -o value.o `test -f 'libyasm/value.c' || echo '$(srcdir)/'`libyasm/value.c
+ mv -f $(DEPDIR)/value.Tpo $(DEPDIR)/value.Po
+# source='libyasm/value.c' object='value.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o value.o `test -f 'libyasm/value.c' || echo '$(srcdir)/'`libyasm/value.c
+
+value.obj: libyasm/value.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT value.obj -MD -MP -MF $(DEPDIR)/value.Tpo -c -o value.obj `if test -f 'libyasm/value.c'; then $(CYGPATH_W) 'libyasm/value.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/value.c'; fi`
+ mv -f $(DEPDIR)/value.Tpo $(DEPDIR)/value.Po
+# source='libyasm/value.c' object='value.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o value.obj `if test -f 'libyasm/value.c'; then $(CYGPATH_W) 'libyasm/value.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/value.c'; fi`
+
+xmalloc.o: libyasm/xmalloc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xmalloc.o -MD -MP -MF $(DEPDIR)/xmalloc.Tpo -c -o xmalloc.o `test -f 'libyasm/xmalloc.c' || echo '$(srcdir)/'`libyasm/xmalloc.c
+ mv -f $(DEPDIR)/xmalloc.Tpo $(DEPDIR)/xmalloc.Po
+# source='libyasm/xmalloc.c' object='xmalloc.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xmalloc.o `test -f 'libyasm/xmalloc.c' || echo '$(srcdir)/'`libyasm/xmalloc.c
+
+xmalloc.obj: libyasm/xmalloc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xmalloc.obj -MD -MP -MF $(DEPDIR)/xmalloc.Tpo -c -o xmalloc.obj `if test -f 'libyasm/xmalloc.c'; then $(CYGPATH_W) 'libyasm/xmalloc.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/xmalloc.c'; fi`
+ mv -f $(DEPDIR)/xmalloc.Tpo $(DEPDIR)/xmalloc.Po
+# source='libyasm/xmalloc.c' object='xmalloc.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xmalloc.obj `if test -f 'libyasm/xmalloc.c'; then $(CYGPATH_W) 'libyasm/xmalloc.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/xmalloc.c'; fi`
+
+xstrdup.o: libyasm/xstrdup.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xstrdup.o -MD -MP -MF $(DEPDIR)/xstrdup.Tpo -c -o xstrdup.o `test -f 'libyasm/xstrdup.c' || echo '$(srcdir)/'`libyasm/xstrdup.c
+ mv -f $(DEPDIR)/xstrdup.Tpo $(DEPDIR)/xstrdup.Po
+# source='libyasm/xstrdup.c' object='xstrdup.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xstrdup.o `test -f 'libyasm/xstrdup.c' || echo '$(srcdir)/'`libyasm/xstrdup.c
+
+xstrdup.obj: libyasm/xstrdup.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xstrdup.obj -MD -MP -MF $(DEPDIR)/xstrdup.Tpo -c -o xstrdup.obj `if test -f 'libyasm/xstrdup.c'; then $(CYGPATH_W) 'libyasm/xstrdup.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/xstrdup.c'; fi`
+ mv -f $(DEPDIR)/xstrdup.Tpo $(DEPDIR)/xstrdup.Po
+# source='libyasm/xstrdup.c' object='xstrdup.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xstrdup.obj `if test -f 'libyasm/xstrdup.c'; then $(CYGPATH_W) 'libyasm/xstrdup.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/xstrdup.c'; fi`
+
+bitvect_test.o: libyasm/tests/bitvect_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bitvect_test.o -MD -MP -MF $(DEPDIR)/bitvect_test.Tpo -c -o bitvect_test.o `test -f 'libyasm/tests/bitvect_test.c' || echo '$(srcdir)/'`libyasm/tests/bitvect_test.c
+ mv -f $(DEPDIR)/bitvect_test.Tpo $(DEPDIR)/bitvect_test.Po
+# source='libyasm/tests/bitvect_test.c' object='bitvect_test.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bitvect_test.o `test -f 'libyasm/tests/bitvect_test.c' || echo '$(srcdir)/'`libyasm/tests/bitvect_test.c
+
+bitvect_test.obj: libyasm/tests/bitvect_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bitvect_test.obj -MD -MP -MF $(DEPDIR)/bitvect_test.Tpo -c -o bitvect_test.obj `if test -f 'libyasm/tests/bitvect_test.c'; then $(CYGPATH_W) 'libyasm/tests/bitvect_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/bitvect_test.c'; fi`
+ mv -f $(DEPDIR)/bitvect_test.Tpo $(DEPDIR)/bitvect_test.Po
+# source='libyasm/tests/bitvect_test.c' object='bitvect_test.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bitvect_test.obj `if test -f 'libyasm/tests/bitvect_test.c'; then $(CYGPATH_W) 'libyasm/tests/bitvect_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/bitvect_test.c'; fi`
+
+combpath_test.o: libyasm/tests/combpath_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT combpath_test.o -MD -MP -MF $(DEPDIR)/combpath_test.Tpo -c -o combpath_test.o `test -f 'libyasm/tests/combpath_test.c' || echo '$(srcdir)/'`libyasm/tests/combpath_test.c
+ mv -f $(DEPDIR)/combpath_test.Tpo $(DEPDIR)/combpath_test.Po
+# source='libyasm/tests/combpath_test.c' object='combpath_test.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o combpath_test.o `test -f 'libyasm/tests/combpath_test.c' || echo '$(srcdir)/'`libyasm/tests/combpath_test.c
+
+combpath_test.obj: libyasm/tests/combpath_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT combpath_test.obj -MD -MP -MF $(DEPDIR)/combpath_test.Tpo -c -o combpath_test.obj `if test -f 'libyasm/tests/combpath_test.c'; then $(CYGPATH_W) 'libyasm/tests/combpath_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/combpath_test.c'; fi`
+ mv -f $(DEPDIR)/combpath_test.Tpo $(DEPDIR)/combpath_test.Po
+# source='libyasm/tests/combpath_test.c' object='combpath_test.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o combpath_test.obj `if test -f 'libyasm/tests/combpath_test.c'; then $(CYGPATH_W) 'libyasm/tests/combpath_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/combpath_test.c'; fi`
+
+floatnum_test.o: libyasm/tests/floatnum_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT floatnum_test.o -MD -MP -MF $(DEPDIR)/floatnum_test.Tpo -c -o floatnum_test.o `test -f 'libyasm/tests/floatnum_test.c' || echo '$(srcdir)/'`libyasm/tests/floatnum_test.c
+ mv -f $(DEPDIR)/floatnum_test.Tpo $(DEPDIR)/floatnum_test.Po
+# source='libyasm/tests/floatnum_test.c' object='floatnum_test.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o floatnum_test.o `test -f 'libyasm/tests/floatnum_test.c' || echo '$(srcdir)/'`libyasm/tests/floatnum_test.c
+
+floatnum_test.obj: libyasm/tests/floatnum_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT floatnum_test.obj -MD -MP -MF $(DEPDIR)/floatnum_test.Tpo -c -o floatnum_test.obj `if test -f 'libyasm/tests/floatnum_test.c'; then $(CYGPATH_W) 'libyasm/tests/floatnum_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/floatnum_test.c'; fi`
+ mv -f $(DEPDIR)/floatnum_test.Tpo $(DEPDIR)/floatnum_test.Po
+# source='libyasm/tests/floatnum_test.c' object='floatnum_test.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o floatnum_test.obj `if test -f 'libyasm/tests/floatnum_test.c'; then $(CYGPATH_W) 'libyasm/tests/floatnum_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/floatnum_test.c'; fi`
+
+leb128_test.o: libyasm/tests/leb128_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT leb128_test.o -MD -MP -MF $(DEPDIR)/leb128_test.Tpo -c -o leb128_test.o `test -f 'libyasm/tests/leb128_test.c' || echo '$(srcdir)/'`libyasm/tests/leb128_test.c
+ mv -f $(DEPDIR)/leb128_test.Tpo $(DEPDIR)/leb128_test.Po
+# source='libyasm/tests/leb128_test.c' object='leb128_test.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o leb128_test.o `test -f 'libyasm/tests/leb128_test.c' || echo '$(srcdir)/'`libyasm/tests/leb128_test.c
+
+leb128_test.obj: libyasm/tests/leb128_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT leb128_test.obj -MD -MP -MF $(DEPDIR)/leb128_test.Tpo -c -o leb128_test.obj `if test -f 'libyasm/tests/leb128_test.c'; then $(CYGPATH_W) 'libyasm/tests/leb128_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/leb128_test.c'; fi`
+ mv -f $(DEPDIR)/leb128_test.Tpo $(DEPDIR)/leb128_test.Po
+# source='libyasm/tests/leb128_test.c' object='leb128_test.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o leb128_test.obj `if test -f 'libyasm/tests/leb128_test.c'; then $(CYGPATH_W) 'libyasm/tests/leb128_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/leb128_test.c'; fi`
+
+splitpath_test.o: libyasm/tests/splitpath_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT splitpath_test.o -MD -MP -MF $(DEPDIR)/splitpath_test.Tpo -c -o splitpath_test.o `test -f 'libyasm/tests/splitpath_test.c' || echo '$(srcdir)/'`libyasm/tests/splitpath_test.c
+ mv -f $(DEPDIR)/splitpath_test.Tpo $(DEPDIR)/splitpath_test.Po
+# source='libyasm/tests/splitpath_test.c' object='splitpath_test.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o splitpath_test.o `test -f 'libyasm/tests/splitpath_test.c' || echo '$(srcdir)/'`libyasm/tests/splitpath_test.c
+
+splitpath_test.obj: libyasm/tests/splitpath_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT splitpath_test.obj -MD -MP -MF $(DEPDIR)/splitpath_test.Tpo -c -o splitpath_test.obj `if test -f 'libyasm/tests/splitpath_test.c'; then $(CYGPATH_W) 'libyasm/tests/splitpath_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/splitpath_test.c'; fi`
+ mv -f $(DEPDIR)/splitpath_test.Tpo $(DEPDIR)/splitpath_test.Po
+# source='libyasm/tests/splitpath_test.c' object='splitpath_test.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o splitpath_test.obj `if test -f 'libyasm/tests/splitpath_test.c'; then $(CYGPATH_W) 'libyasm/tests/splitpath_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/splitpath_test.c'; fi`
+
+uncstring_test.o: libyasm/tests/uncstring_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT uncstring_test.o -MD -MP -MF $(DEPDIR)/uncstring_test.Tpo -c -o uncstring_test.o `test -f 'libyasm/tests/uncstring_test.c' || echo '$(srcdir)/'`libyasm/tests/uncstring_test.c
+ mv -f $(DEPDIR)/uncstring_test.Tpo $(DEPDIR)/uncstring_test.Po
+# source='libyasm/tests/uncstring_test.c' object='uncstring_test.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o uncstring_test.o `test -f 'libyasm/tests/uncstring_test.c' || echo '$(srcdir)/'`libyasm/tests/uncstring_test.c
+
+uncstring_test.obj: libyasm/tests/uncstring_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT uncstring_test.obj -MD -MP -MF $(DEPDIR)/uncstring_test.Tpo -c -o uncstring_test.obj `if test -f 'libyasm/tests/uncstring_test.c'; then $(CYGPATH_W) 'libyasm/tests/uncstring_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/uncstring_test.c'; fi`
+ mv -f $(DEPDIR)/uncstring_test.Tpo $(DEPDIR)/uncstring_test.Po
+# source='libyasm/tests/uncstring_test.c' object='uncstring_test.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o uncstring_test.obj `if test -f 'libyasm/tests/uncstring_test.c'; then $(CYGPATH_W) 'libyasm/tests/uncstring_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/uncstring_test.c'; fi`
+
+yasm.o: frontends/yasm/yasm.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT yasm.o -MD -MP -MF $(DEPDIR)/yasm.Tpo -c -o yasm.o `test -f 'frontends/yasm/yasm.c' || echo '$(srcdir)/'`frontends/yasm/yasm.c
+ mv -f $(DEPDIR)/yasm.Tpo $(DEPDIR)/yasm.Po
+# source='frontends/yasm/yasm.c' object='yasm.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o yasm.o `test -f 'frontends/yasm/yasm.c' || echo '$(srcdir)/'`frontends/yasm/yasm.c
+
+yasm.obj: frontends/yasm/yasm.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT yasm.obj -MD -MP -MF $(DEPDIR)/yasm.Tpo -c -o yasm.obj `if test -f 'frontends/yasm/yasm.c'; then $(CYGPATH_W) 'frontends/yasm/yasm.c'; else $(CYGPATH_W) '$(srcdir)/frontends/yasm/yasm.c'; fi`
+ mv -f $(DEPDIR)/yasm.Tpo $(DEPDIR)/yasm.Po
+# source='frontends/yasm/yasm.c' object='yasm.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o yasm.obj `if test -f 'frontends/yasm/yasm.c'; then $(CYGPATH_W) 'frontends/yasm/yasm.c'; else $(CYGPATH_W) '$(srcdir)/frontends/yasm/yasm.c'; fi`
+
+yasm-options.o: frontends/yasm/yasm-options.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT yasm-options.o -MD -MP -MF $(DEPDIR)/yasm-options.Tpo -c -o yasm-options.o `test -f 'frontends/yasm/yasm-options.c' || echo '$(srcdir)/'`frontends/yasm/yasm-options.c
+ mv -f $(DEPDIR)/yasm-options.Tpo $(DEPDIR)/yasm-options.Po
+# source='frontends/yasm/yasm-options.c' object='yasm-options.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o yasm-options.o `test -f 'frontends/yasm/yasm-options.c' || echo '$(srcdir)/'`frontends/yasm/yasm-options.c
+
+yasm-options.obj: frontends/yasm/yasm-options.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT yasm-options.obj -MD -MP -MF $(DEPDIR)/yasm-options.Tpo -c -o yasm-options.obj `if test -f 'frontends/yasm/yasm-options.c'; then $(CYGPATH_W) 'frontends/yasm/yasm-options.c'; else $(CYGPATH_W) '$(srcdir)/frontends/yasm/yasm-options.c'; fi`
+ mv -f $(DEPDIR)/yasm-options.Tpo $(DEPDIR)/yasm-options.Po
+# source='frontends/yasm/yasm-options.c' object='yasm-options.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o yasm-options.obj `if test -f 'frontends/yasm/yasm-options.c'; then $(CYGPATH_W) 'frontends/yasm/yasm-options.c'; else $(CYGPATH_W) '$(srcdir)/frontends/yasm/yasm-options.c'; fi`
+
+tasm.o: frontends/tasm/tasm.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tasm.o -MD -MP -MF $(DEPDIR)/tasm.Tpo -c -o tasm.o `test -f 'frontends/tasm/tasm.c' || echo '$(srcdir)/'`frontends/tasm/tasm.c
+ mv -f $(DEPDIR)/tasm.Tpo $(DEPDIR)/tasm.Po
+# source='frontends/tasm/tasm.c' object='tasm.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tasm.o `test -f 'frontends/tasm/tasm.c' || echo '$(srcdir)/'`frontends/tasm/tasm.c
+
+tasm.obj: frontends/tasm/tasm.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tasm.obj -MD -MP -MF $(DEPDIR)/tasm.Tpo -c -o tasm.obj `if test -f 'frontends/tasm/tasm.c'; then $(CYGPATH_W) 'frontends/tasm/tasm.c'; else $(CYGPATH_W) '$(srcdir)/frontends/tasm/tasm.c'; fi`
+ mv -f $(DEPDIR)/tasm.Tpo $(DEPDIR)/tasm.Po
+# source='frontends/tasm/tasm.c' object='tasm.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tasm.obj `if test -f 'frontends/tasm/tasm.c'; then $(CYGPATH_W) 'frontends/tasm/tasm.c'; else $(CYGPATH_W) '$(srcdir)/frontends/tasm/tasm.c'; fi`
+
+tasm-options.o: frontends/tasm/tasm-options.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tasm-options.o -MD -MP -MF $(DEPDIR)/tasm-options.Tpo -c -o tasm-options.o `test -f 'frontends/tasm/tasm-options.c' || echo '$(srcdir)/'`frontends/tasm/tasm-options.c
+ mv -f $(DEPDIR)/tasm-options.Tpo $(DEPDIR)/tasm-options.Po
+# source='frontends/tasm/tasm-options.c' object='tasm-options.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tasm-options.o `test -f 'frontends/tasm/tasm-options.c' || echo '$(srcdir)/'`frontends/tasm/tasm-options.c
+
+tasm-options.obj: frontends/tasm/tasm-options.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tasm-options.obj -MD -MP -MF $(DEPDIR)/tasm-options.Tpo -c -o tasm-options.obj `if test -f 'frontends/tasm/tasm-options.c'; then $(CYGPATH_W) 'frontends/tasm/tasm-options.c'; else $(CYGPATH_W) '$(srcdir)/frontends/tasm/tasm-options.c'; fi`
+ mv -f $(DEPDIR)/tasm-options.Tpo $(DEPDIR)/tasm-options.Po
+# source='frontends/tasm/tasm-options.c' object='tasm-options.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tasm-options.obj `if test -f 'frontends/tasm/tasm-options.c'; then $(CYGPATH_W) 'frontends/tasm/tasm-options.c'; else $(CYGPATH_W) '$(srcdir)/frontends/tasm/tasm-options.c'; fi`
+install-man1: $(man1_MANS) $(man_MANS)
+ @$(NORMAL_INSTALL)
+ test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)"
+ @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.1*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
+ else file=$$i; fi; \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 1*) ;; \
+ *) ext='1' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \
+ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst"; \
+ done
+uninstall-man1:
+ @$(NORMAL_UNINSTALL)
+ @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.1*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 1*) ;; \
+ *) ext='1' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " rm -f '$(DESTDIR)$(man1dir)/$$inst'"; \
+ rm -f "$(DESTDIR)$(man1dir)/$$inst"; \
+ done
+install-man7: $(man7_MANS) $(man_MANS)
+ @$(NORMAL_INSTALL)
+ test -z "$(man7dir)" || $(MKDIR_P) "$(DESTDIR)$(man7dir)"
+ @list='$(man7_MANS) $(dist_man7_MANS) $(nodist_man7_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.7*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
+ else file=$$i; fi; \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 7*) ;; \
+ *) ext='7' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man7dir)/$$inst'"; \
+ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man7dir)/$$inst"; \
+ done
+uninstall-man7:
+ @$(NORMAL_UNINSTALL)
+ @list='$(man7_MANS) $(dist_man7_MANS) $(nodist_man7_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.7*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 7*) ;; \
+ *) ext='7' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " rm -f '$(DESTDIR)$(man7dir)/$$inst'"; \
+ rm -f "$(DESTDIR)$(man7dir)/$$inst"; \
+ done
+install-includeHEADERS: $(include_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)"
+ @list='$(include_HEADERS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includedir)/$$f'"; \
+ $(includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includedir)/$$f"; \
+ done
+
+uninstall-includeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(include_HEADERS)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(includedir)/$$f'"; \
+ rm -f "$(DESTDIR)$(includedir)/$$f"; \
+ done
+install-modincludeHEADERS: $(modinclude_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(modincludedir)" || $(MKDIR_P) "$(DESTDIR)$(modincludedir)"
+ @list='$(modinclude_HEADERS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(modincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(modincludedir)/$$f'"; \
+ $(modincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(modincludedir)/$$f"; \
+ done
+
+uninstall-modincludeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(modinclude_HEADERS)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(modincludedir)/$$f'"; \
+ rm -f "$(DESTDIR)$(modincludedir)/$$f"; \
+ done
+install-nodist_includeHEADERS: $(nodist_include_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)"
+ @list='$(nodist_include_HEADERS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(nodist_includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includedir)/$$f'"; \
+ $(nodist_includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includedir)/$$f"; \
+ done
+
+uninstall-nodist_includeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(nodist_include_HEADERS)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(includedir)/$$f'"; \
+ rm -f "$(DESTDIR)$(includedir)/$$f"; \
+ done
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+check-TESTS: $(TESTS)
+ @failed=0; all=0; xfail=0; xpass=0; skip=0; ws='[ ]'; \
+ srcdir=$(srcdir); export srcdir; \
+ list=' $(TESTS) '; \
+ if test -n "$$list"; then \
+ for tst in $$list; do \
+ if test -f ./$$tst; then dir=./; \
+ elif test -f $$tst; then dir=; \
+ else dir="$(srcdir)/"; fi; \
+ if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
+ all=`expr $$all + 1`; \
+ case " $(XFAIL_TESTS) " in \
+ *$$ws$$tst$$ws*) \
+ xpass=`expr $$xpass + 1`; \
+ failed=`expr $$failed + 1`; \
+ echo "XPASS: $$tst"; \
+ ;; \
+ *) \
+ echo "PASS: $$tst"; \
+ ;; \
+ esac; \
+ elif test $$? -ne 77; then \
+ all=`expr $$all + 1`; \
+ case " $(XFAIL_TESTS) " in \
+ *$$ws$$tst$$ws*) \
+ xfail=`expr $$xfail + 1`; \
+ echo "XFAIL: $$tst"; \
+ ;; \
+ *) \
+ failed=`expr $$failed + 1`; \
+ echo "FAIL: $$tst"; \
+ ;; \
+ esac; \
+ else \
+ skip=`expr $$skip + 1`; \
+ echo "SKIP: $$tst"; \
+ fi; \
+ done; \
+ if test "$$failed" -eq 0; then \
+ if test "$$xfail" -eq 0; then \
+ banner="All $$all tests passed"; \
+ else \
+ banner="All $$all tests behaved as expected ($$xfail expected failures)"; \
+ fi; \
+ else \
+ if test "$$xpass" -eq 0; then \
+ banner="$$failed of $$all tests failed"; \
+ else \
+ banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \
+ fi; \
+ fi; \
+ dashes="$$banner"; \
+ skipped=""; \
+ if test "$$skip" -ne 0; then \
+ skipped="($$skip tests were not run)"; \
+ test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
+ dashes="$$skipped"; \
+ fi; \
+ report=""; \
+ if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
+ report="Please report to $(PACKAGE_BUGREPORT)"; \
+ test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
+ dashes="$$report"; \
+ fi; \
+ dashes=`echo "$$dashes" | sed s/./=/g`; \
+ echo "$$dashes"; \
+ echo "$$banner"; \
+ test -z "$$skipped" || echo "$$skipped"; \
+ test -z "$$report" || echo "$$report"; \
+ echo "$$dashes"; \
+ test "$$failed" -eq 0; \
+ else :; fi
+
+distdir: $(DISTFILES)
+ $(am__remove_distdir)
+ test -d $(distdir) || mkdir $(distdir)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ distdir=`$(am__cd) $(distdir) && pwd`; \
+ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$top_distdir" \
+ distdir="$$distdir/$$subdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+ -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
+ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
+ || chmod -R a+r $(distdir)
+dist-gzip: distdir
+ tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+ $(am__remove_distdir)
+
+dist-bzip2: distdir
+ tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
+ $(am__remove_distdir)
+
+dist-lzma: distdir
+ tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
+ $(am__remove_distdir)
+
+dist-tarZ: distdir
+ tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
+ $(am__remove_distdir)
+
+dist-shar: distdir
+ shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+ $(am__remove_distdir)
+
+dist-zip: distdir
+ -rm -f $(distdir).zip
+ zip -rq $(distdir).zip $(distdir)
+ $(am__remove_distdir)
+
+dist dist-all: distdir
+ tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+ $(am__remove_distdir)
+
+# This target untars the dist file and tries a VPATH configuration. Then
+# it guarantees that the distribution is self-contained by making another
+# tarfile.
+distcheck: dist
+ case '$(DIST_ARCHIVES)' in \
+ *.tar.gz*) \
+ GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
+ *.tar.bz2*) \
+ bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
+ *.tar.lzma*) \
+ unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\
+ *.tar.Z*) \
+ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
+ *.shar.gz*) \
+ GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
+ *.zip*) \
+ unzip $(distdir).zip ;;\
+ esac
+ chmod -R a-w $(distdir); chmod a+w $(distdir)
+ mkdir $(distdir)/_build
+ mkdir $(distdir)/_inst
+ chmod a-w $(distdir)
+ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
+ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
+ && cd $(distdir)/_build \
+ && ../configure --srcdir=.. --prefix="$$dc_install_base" \
+ $(DISTCHECK_CONFIGURE_FLAGS) \
+ && $(MAKE) $(AM_MAKEFLAGS) \
+ && $(MAKE) $(AM_MAKEFLAGS) dvi \
+ && $(MAKE) $(AM_MAKEFLAGS) check \
+ && $(MAKE) $(AM_MAKEFLAGS) install \
+ && $(MAKE) $(AM_MAKEFLAGS) installcheck \
+ && $(MAKE) $(AM_MAKEFLAGS) uninstall \
+ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
+ distuninstallcheck \
+ && chmod -R a-w "$$dc_install_base" \
+ && ({ \
+ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
+ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
+ } || { rm -rf "$$dc_destdir"; exit 1; }) \
+ && rm -rf "$$dc_destdir" \
+ && $(MAKE) $(AM_MAKEFLAGS) dist \
+ && rm -rf $(DIST_ARCHIVES) \
+ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck
+ $(am__remove_distdir)
+ @(echo "$(distdir) archives ready for distribution: "; \
+ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
+ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
+distuninstallcheck:
+ @cd $(distuninstallcheck_dir) \
+ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
+ || { echo "ERROR: files left after uninstall:" ; \
+ if test -n "$(DESTDIR)"; then \
+ echo " (check DESTDIR support)"; \
+ fi ; \
+ $(distuninstallcheck_listfiles) ; \
+ exit 1; } >&2
+distcleancheck: distclean
+ @if test '$(srcdir)' = . ; then \
+ echo "ERROR: distcleancheck can only run from a VPATH build" ; \
+ exit 1 ; \
+ fi
+ @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
+ || { echo "ERROR: files left in build directory after distclean:" ; \
+ $(distcleancheck_listfiles) ; \
+ exit 1; } >&2
+check-am: all-am
+ $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
+ $(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) check-recursive
+all-am: Makefile $(LIBRARIES) $(PROGRAMS) $(MANS) $(HEADERS) config.h \
+ all-local
+installdirs: installdirs-recursive
+installdirs-am:
+ for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man7dir)" "$(DESTDIR)$(includedir)" "$(DESTDIR)$(modincludedir)" "$(DESTDIR)$(includedir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+ -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
+clean: clean-recursive
+
+clean-am: clean-binPROGRAMS clean-checkPROGRAMS clean-generic \
+ clean-libLIBRARIES clean-noinstPROGRAMS mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-hdr distclean-local distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am: install-includeHEADERS install-man \
+ install-modincludeHEADERS install-nodist_includeHEADERS
+
+install-dvi: install-dvi-recursive
+
+install-exec-am: install-binPROGRAMS install-libLIBRARIES
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) install-exec-hook
+
+install-html: install-html-recursive
+
+install-info: install-info-recursive
+
+install-man: install-man1 install-man7
+
+install-pdf: install-pdf-recursive
+
+install-ps: install-ps-recursive
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+ -rm -rf $(top_srcdir)/autom4te.cache
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS uninstall-includeHEADERS \
+ uninstall-libLIBRARIES uninstall-man \
+ uninstall-modincludeHEADERS uninstall-nodist_includeHEADERS
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) uninstall-hook
+
+uninstall-man: uninstall-man1 uninstall-man7
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+ install-exec-am install-strip uninstall-am
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+ all all-am all-local am--refresh check check-TESTS check-am \
+ clean clean-binPROGRAMS clean-checkPROGRAMS clean-generic \
+ clean-libLIBRARIES clean-noinstPROGRAMS ctags ctags-recursive \
+ dist dist-all dist-bzip2 dist-gzip dist-lzma dist-shar \
+ dist-tarZ dist-zip distcheck distclean distclean-compile \
+ distclean-generic distclean-hdr distclean-local distclean-tags \
+ distcleancheck distdir distuninstallcheck dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-exec-hook install-html \
+ install-html-am install-includeHEADERS install-info \
+ install-info-am install-libLIBRARIES install-man install-man1 \
+ install-man7 install-modincludeHEADERS \
+ install-nodist_includeHEADERS install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs installdirs-am maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic pdf pdf-am ps ps-am tags tags-recursive \
+ uninstall uninstall-am uninstall-binPROGRAMS uninstall-hook \
+ uninstall-includeHEADERS uninstall-libLIBRARIES uninstall-man \
+ uninstall-man1 uninstall-man7 uninstall-modincludeHEADERS \
+ uninstall-nodist_includeHEADERS
+
+
+re2c-main.$(OBJEXT): tools/re2c/main.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/re2c/main.c || echo '$(srcdir)/'`tools/re2c/main.c
+
+re2c-code.$(OBJEXT): tools/re2c/code.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/re2c/code.c || echo '$(srcdir)/'`tools/re2c/code.c
+
+re2c-dfa.$(OBJEXT): tools/re2c/dfa.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/re2c/dfa.c || echo '$(srcdir)/'`tools/re2c/dfa.c
+
+re2c-parser.$(OBJEXT): tools/re2c/parser.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/re2c/parser.c || echo '$(srcdir)/'`tools/re2c/parser.c
+
+re2c-actions.$(OBJEXT): tools/re2c/actions.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/re2c/actions.c || echo '$(srcdir)/'`tools/re2c/actions.c
+
+re2c-scanner.$(OBJEXT): tools/re2c/scanner.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/re2c/scanner.c || echo '$(srcdir)/'`tools/re2c/scanner.c
+
+re2c-mbo_getopt.$(OBJEXT): tools/re2c/mbo_getopt.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/re2c/mbo_getopt.c || echo '$(srcdir)/'`tools/re2c/mbo_getopt.c
+
+re2c-substr.$(OBJEXT): tools/re2c/substr.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/re2c/substr.c || echo '$(srcdir)/'`tools/re2c/substr.c
+
+re2c-translate.$(OBJEXT): tools/re2c/translate.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/re2c/translate.c || echo '$(srcdir)/'`tools/re2c/translate.c
+
+genmacro.$(OBJEXT): tools/genmacro/genmacro.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/genmacro/genmacro.c || echo '$(srcdir)/'`tools/genmacro/genmacro.c
+.gperf.c: genperf$(EXEEXT)
+ $(top_builddir)/genperf$(EXEEXT) $< $@
+
+genperf.$(OBJEXT): tools/genperf/genperf.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/genperf/genperf.c || echo '$(srcdir)/'`tools/genperf/genperf.c
+
+gp-perfect.$(OBJEXT): tools/genperf/perfect.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/genperf/perfect.c || echo '$(srcdir)/'`tools/genperf/perfect.c
+
+gp-phash.$(OBJEXT): libyasm/phash.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f libyasm/phash.c || echo '$(srcdir)/'`libyasm/phash.c
+
+gp-xmalloc.$(OBJEXT): libyasm/xmalloc.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f libyasm/xmalloc.c || echo '$(srcdir)/'`libyasm/xmalloc.c
+
+gp-xstrdup.$(OBJEXT): libyasm/xstrdup.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f libyasm/xstrdup.c || echo '$(srcdir)/'`libyasm/xstrdup.c
+
+# Use Pyxelator to generate Pyrex function headers.
+#_yasm.pxi: ${HEADERS}
+# @rm -rf .tmp
+# @mkdir .tmp
+# $(PYTHON) $(srcdir)/tools/python-yasm/pyxelator/wrap_yasm.py \
+# "YASM_DIR=${srcdir}" "CPP=${CPP}" "CPPFLAGS=${CPPFLAGS}"
+# @rm -rf .tmp
+
+# Need to build a local copy of the main Pyrex input file to include _yasm.pxi
+# from the build directory. Also need to fixup the other .pxi include paths.
+#yasm.pyx: $(srcdir)/tools/python-yasm/yasm.pyx
+# sed -e 's,^include "\([^_]\),include "${srcdir}/tools/python-yasm/\1,' \
+# $(srcdir)/tools/python-yasm/yasm.pyx > $@
+
+# Actually run Pyrex
+#yasm_python.c: yasm.pyx _yasm.pxi $(PYBINDING_DEPS)
+# $(PYTHON) -c "from Pyrex.Compiler.Main import main; main(command_line=1)" \
+# -o $@ yasm.pyx
+
+# Now the Python build magic...
+#python-setup.txt: Makefile
+# echo "includes=${DEFS} ${DEFAULT_INCLUDES} ${INCLUDES} ${AM_CPPFLAGS} ${CPPFLAGS}" > python-setup.txt
+# echo "sources=${libyasm_a_SOURCES}" >> python-setup.txt
+# echo "srcdir=${srcdir}" >> python-setup.txt
+# echo "gcc=${GCC}" >> python-setup.txt
+
+#.python-build: python-setup.txt yasm_python.c ${libyasm_a_SOURCES}
+# $(PYTHON) `test -f tools/python-yasm/setup.py || echo '$(srcdir)/'`tools/python-yasm/setup.py build
+# touch .python-build
+#python-build: .python-build
+
+#python-install: .python-build
+# $(PYTHON) `test -f tools/python-yasm/setup.py || echo '$(srcdir)/'`tools/python-yasm/setup.py install "--install-lib=$(DESTDIR)$(pythondir)"
+
+#python-uninstall:
+# rm -f `$(PYTHON) -c "import sys;sys.path.insert(0, '${DESTDIR}${pythondir}'); import yasm; print yasm.__file__"`
+
+python-build:
+python-install:
+python-uninstall:
+
+modules/arch/x86/x86id.c: x86insn_nasm.c x86insn_gas.c x86insns.c
+
+x86insn_nasm.gperf x86insn_gas.gperf x86insns.c: $(srcdir)/modules/arch/x86/gen_x86_insn.py
+ $(PYTHON) $(srcdir)/modules/arch/x86/gen_x86_insn.py
+#x86insn_nasm.gperf: $(srcdir)/x86insn_nasm.gperf
+# @echo Python must be installed to regenerate x86 instructions files
+# cp $(srcdir)/x86insn_nasm.gperf $@
+#x86insn_gas.gperf: $(srcdir)/x86insn_gas.gperf
+# @echo Python must be installed to regenerate x86 instructions files
+# cp $(srcdir)/x86insn_gas.gperf $@
+
+# Use suffix rules for gperf files
+x86insn_nasm.c: x86insn_nasm.gperf genperf$(EXEEXT)
+x86insn_gas.c: x86insn_gas.gperf genperf$(EXEEXT)
+x86cpu.c: $(srcdir)/modules/arch/x86/x86cpu.gperf genperf$(EXEEXT)
+ $(top_builddir)/genperf$(EXEEXT) $(srcdir)/modules/arch/x86/x86cpu.gperf $@
+x86regtmod.c: $(srcdir)/modules/arch/x86/x86regtmod.gperf genperf$(EXEEXT)
+ $(top_builddir)/genperf$(EXEEXT) $(srcdir)/modules/arch/x86/x86regtmod.gperf $@
+
+lc3bid.c: $(srcdir)/modules/arch/lc3b/lc3bid.re re2c$(EXEEXT)
+ $(top_builddir)/re2c$(EXEEXT) -s -o $@ $(srcdir)/modules/arch/lc3b/lc3bid.re
+
+#yasm_arch.7: modules/arch/yasm_arch.xml
+# $(XMLTO) -o $(top_builddir) man $(srcdir)/modules/arch/yasm_arch.xml
+
+#EXTRA_DIST += modules/listfmts/nasm/tests/Makefile.inc
+
+#include modules/listfmts/nasm/tests/Makefile.inc
+
+gas-token.c: $(srcdir)/modules/parsers/gas/gas-token.re re2c$(EXEEXT)
+ $(top_builddir)/re2c$(EXEEXT) -b -o $@ $(srcdir)/modules/parsers/gas/gas-token.re
+
+nasm-token.c: $(srcdir)/modules/parsers/nasm/nasm-token.re re2c$(EXEEXT)
+ $(top_builddir)/re2c$(EXEEXT) -b -o $@ $(srcdir)/modules/parsers/nasm/nasm-token.re
+
+$(top_srcdir)/modules/parsers/nasm/nasm-parser.c: nasm-macros.c
+
+nasm-macros.c: $(srcdir)/modules/parsers/nasm/nasm-std.mac genmacro$(EXEEXT)
+ $(top_builddir)/genmacro$(EXEEXT) $@ nasm_standard_mac $(srcdir)/modules/parsers/nasm/nasm-std.mac
+
+#yasm_parsers.7: modules/parsers/yasm_parsers.xml
+# $(XMLTO) -o $(top_builddir) man $(srcdir)/modules/parsers/yasm_parsers.xml
+
+$(top_srcdir)/modules/preprocs/nasm/nasm-preproc.c: nasm-version.c
+
+nasm-version.c: version.mac genmacro$(EXEEXT)
+ $(top_builddir)/genmacro$(EXEEXT) $@ nasm_version_mac version.mac
+
+version.mac: genversion$(EXEEXT)
+ $(top_builddir)/genversion$(EXEEXT) $@
+
+genversion.$(OBJEXT): modules/preprocs/nasm/genversion.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f modules/preprocs/nasm/genversion.c || echo '$(srcdir)/'`modules/preprocs/nasm/genversion.c
+
+#EXTRA_DIST += modules/dbgfmts/codeview/tests/Makefile.inc
+#include modules/dbgfmts/codeview/tests/Makefile.inc
+
+#yasm_dbgfmts.7: modules/dbgfmts/yasm_dbgfmts.xml
+# $(XMLTO) -o $(top_builddir) man $(srcdir)/modules/dbgfmts/yasm_dbgfmts.xml
+
+$(top_srcdir)/modules/objfmts/coff/coff-objfmt.c: win64-nasm.c win64-gas.c
+
+win64-nasm.c: $(srcdir)/modules/objfmts/coff/win64-nasm.mac genmacro$(EXEEXT)
+ $(top_builddir)/genmacro$(EXEEXT) $@ win64_nasm_stdmac $(srcdir)/modules/objfmts/coff/win64-nasm.mac
+
+win64-gas.c: $(srcdir)/modules/objfmts/coff/win64-gas.mac genmacro$(EXEEXT)
+ $(top_builddir)/genmacro$(EXEEXT) $@ win64_gas_stdmac $(srcdir)/modules/objfmts/coff/win64-gas.mac
+
+#yasm_objfmts.7: modules/objfmts/yasm_objfmts.xml
+# $(XMLTO) -o $(top_builddir) man $(srcdir)/modules/objfmts/yasm_objfmts.xml
+
+module.c: $(top_srcdir)/libyasm/module.in genmodule$(EXEEXT) Makefile
+ $(top_builddir)/genmodule$(EXEEXT) $(top_srcdir)/libyasm/module.in Makefile
+
+genmodule.$(OBJEXT): libyasm/genmodule.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f libyasm/genmodule.c || echo '$(srcdir)/'`libyasm/genmodule.c
+
+#yasm.1: frontends/yasm/yasm.xml
+# $(XMLTO) -o $(top_builddir) man $(srcdir)/frontends/yasm/yasm.xml
+
+$(srcdir)/frontends/yasm/yasm.c: license.c
+
+license.c: $(srcdir)/COPYING genstring$(EXEEXT)
+ $(top_builddir)/genstring$(EXEEXT) license_msg $@ $(srcdir)/COPYING
+
+distclean-local:
+ -rm -rf results
+ -rm -rf build
+
+all-local: python-build
+install-exec-hook: python-install
+uninstall-hook: python-uninstall
+
+genstring.$(OBJEXT): genstring.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f genstring.c || echo '$(srcdir)/'`genstring.c
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/chromium/third_party/pdfium/third_party/yasm/source/config/mac/config.h b/chromium/third_party/pdfium/third_party/yasm/source/config/mac/config.h
new file mode 100644
index 00000000000..f3b43d235a4
--- /dev/null
+++ b/chromium/third_party/pdfium/third_party/yasm/source/config/mac/config.h
@@ -0,0 +1,173 @@
+/* config.h. Generated from config.h.in by configure. */
+/* config.h.in. Generated from configure.ac by autoheader. */
+
+/* Command name to run C preprocessor */
+#define CPP_PROG "gcc -E"
+
+/* */
+/* #undef ENABLE_NLS */
+
+/* Define to 1 if you have the `abort' function. */
+#define HAVE_ABORT 1
+
+/* */
+/* #undef HAVE_CATGETS */
+
+/* Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the
+ CoreFoundation framework. */
+#define HAVE_CFLOCALECOPYCURRENT 1
+
+/* Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in
+ the CoreFoundation framework. */
+#define HAVE_CFPREFERENCESCOPYAPPVALUE 1
+
+/* Define if the GNU dcgettext() function is already present or preinstalled.
+ */
+/* #undef HAVE_DCGETTEXT */
+
+/* Define to 1 if you have the <direct.h> header file. */
+/* #undef HAVE_DIRECT_H */
+
+/* Define to 1 if you have the `ftruncate' function. */
+#define HAVE_FTRUNCATE 1
+
+/* Define to 1 if you have the `getcwd' function. */
+#define HAVE_GETCWD 1
+
+/* */
+/* #undef HAVE_GETTEXT */
+
+/* Define to 1 if you have the GNU C Library */
+/* #undef HAVE_GNU_C_LIBRARY */
+
+/* Define if you have the iconv() function and it works. */
+#define HAVE_ICONV 1
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* */
+/* #undef HAVE_LC_MESSAGES */
+
+/* Define to 1 if you have the <libgen.h> header file. */
+#define HAVE_LIBGEN_H 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the `mergesort' function. */
+#define HAVE_MERGESORT 1
+
+/* Define to 1 if you have the `popen' function. */
+#define HAVE_POPEN 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* */
+/* #undef HAVE_STPCPY */
+
+/* Define to 1 if you have the `strcasecmp' function. */
+#define HAVE_STRCASECMP 1
+
+/* Define to 1 if you have the `strcmpi' function. */
+/* #undef HAVE_STRCMPI */
+
+/* Define to 1 if you have the `stricmp' function. */
+/* #undef HAVE_STRICMP */
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the `strncasecmp' function. */
+#define HAVE_STRNCASECMP 1
+
+/* Define to 1 if you have the `strsep' function. */
+#define HAVE_STRSEP 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the `toascii' function. */
+#define HAVE_TOASCII 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define to 1 if you have the `vsnprintf' function. */
+#define HAVE_VSNPRINTF 1
+
+/* Define to 1 if you have the `_stricmp' function. */
+/* #undef HAVE__STRICMP */
+
+/* Name of package */
+#define PACKAGE "yasm"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "bug-yasm@tortall.net"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "yasm"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "yasm 1.2.0"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "yasm"
+
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "1.2.0"
+
+/* Define to 1 if the C compiler supports function prototypes. */
+#define PROTOTYPES 1
+
+/* The size of `char', as computed by sizeof. */
+/* #undef SIZEOF_CHAR */
+
+/* The size of `int', as computed by sizeof. */
+/* #undef SIZEOF_INT */
+
+/* The size of `long', as computed by sizeof. */
+/* #undef SIZEOF_LONG */
+
+/* The size of `short', as computed by sizeof. */
+/* #undef SIZEOF_SHORT */
+
+/* The size of `void*', as computed by sizeof. */
+/* #undef SIZEOF_VOIDP */
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Version number of package */
+#define VERSION "1.2.0"
+
+/* Define if using the dmalloc debugging malloc package */
+/* #undef WITH_DMALLOC */
+
+/* Define like PROTOTYPES; this can be used by system headers. */
+#define __PROTOTYPES 1
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef const */
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+ calls it, or to nothing if 'inline' is not supported under any name. */
+#ifndef __cplusplus
+/* #undef inline */
+#endif
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+/* #undef size_t */
diff --git a/chromium/third_party/pdfium/third_party/yasm/source/config/mac/libyasm-stdint.h b/chromium/third_party/pdfium/third_party/yasm/source/config/mac/libyasm-stdint.h
new file mode 100644
index 00000000000..851e85b788a
--- /dev/null
+++ b/chromium/third_party/pdfium/third_party/yasm/source/config/mac/libyasm-stdint.h
@@ -0,0 +1,9 @@
+#ifndef _YASM_LIBYASM_STDINT_H
+#define _YASM_LIBYASM_STDINT_H 1
+#ifndef _GENERATED_STDINT_H
+#define _GENERATED_STDINT_H "yasm 0.8.0"
+/* generated using gcc -std=gnu99 */
+#define _STDINT_HAVE_STDINT_H 1
+#include <stdint.h>
+#endif
+#endif
diff --git a/chromium/third_party/pdfium/third_party/yasm/source/config/openbsd/Makefile b/chromium/third_party/pdfium/third_party/yasm/source/config/openbsd/Makefile
new file mode 100644
index 00000000000..6fccce46a99
--- /dev/null
+++ b/chromium/third_party/pdfium/third_party/yasm/source/config/openbsd/Makefile
@@ -0,0 +1,3822 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# Makefile. Generated from Makefile.in by configure.
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+
+
+# $Id: Makefile.am 2184 2009-03-24 05:04:15Z peter $
+
+# $Id: Makefile.inc 2084 2008-05-09 07:08:17Z peter $
+
+# $Id: Makefile.inc 1718 2006-12-24 00:13:19Z peter $
+
+# These utility programs have to be built for BUILD host in cross-build.
+# This makes things rather non-standard automake
+
+# $Id: Makefile.inc 2084 2008-05-09 07:08:17Z peter $
+
+# These utility programs have to be built for BUILD host in cross-build.
+# This makes things rather non-standard automake
+
+# $Id: Makefile.inc 1939 2007-09-10 07:15:50Z peter $
+
+# These utility programs have to be built for BUILD host in cross-build.
+# This makes things rather non-standard automake
+
+# $Id: Makefile.inc 1948 2007-09-13 02:53:30Z peter $
+
+# $Id: Makefile.inc 1951 2007-09-14 05:19:10Z peter $
+
+# $Id: Makefile.inc 1598 2006-08-10 04:02:59Z peter $
+
+# $Id: Makefile.inc 1914 2007-08-20 05:13:35Z peter $
+
+# $Id: Makefile.inc 2111 2008-07-06 22:26:49Z peter $
+
+# $Id: Makefile.inc 2170 2009-01-14 08:28:13Z peter $
+
+# $Id: Makefile.inc 2192 2009-03-29 23:25:05Z peter $
+
+# $Id: Makefile.inc 1776 2007-02-19 02:36:10Z peter $
+
+# $Id: Makefile.inc 2111 2008-07-06 22:26:49Z peter $
+
+# $Id: Makefile.inc 1928 2007-09-07 22:03:34Z peter $
+
+# $Id: Makefile.inc 1152 2004-10-02 06:18:30Z peter $
+
+# $Id: Makefile.inc 1183 2004-12-01 07:49:18Z peter $
+
+# $Id: Makefile.inc 2130 2008-10-07 05:38:11Z peter $
+
+# $Id: Makefile.inc 1783 2007-02-22 03:40:31Z peter $
+
+# $Id: Makefile.inc 2169 2009-01-02 20:46:57Z peter $
+
+# $Id$
+
+# $Id: Makefile.inc 2130 2008-10-07 05:38:11Z peter $
+
+# $Id: Makefile.inc 2190 2009-03-25 03:40:59Z peter $
+
+# $Id: Makefile.inc 1137 2004-09-04 01:24:57Z peter $
+
+# $Id: Makefile.inc 2082 2008-05-09 06:46:02Z peter $
+
+# $Id: Makefile.inc 2063 2008-04-12 08:30:22Z peter $
+
+# $Id: Makefile.inc 2063 2008-04-12 08:30:22Z peter $
+
+# $Id: Makefile.inc 1966 2007-09-20 03:54:36Z peter $
+
+# $Id: Makefile.inc 2130 2008-10-07 05:38:11Z peter $
+
+# $Id: Makefile.inc 2185 2009-03-24 06:33:32Z peter $
+
+# $Id: Makefile.inc 2172 2009-01-27 06:38:14Z peter $
+
+# $Id: Makefile.inc 2176 2009-03-04 07:39:02Z peter $
+
+# Makefile for cpp module.
+# Copied from raw preprocessor module.
+
+# $Id: Makefile.inc 1662 2006-10-21 18:52:29Z peter $
+
+# $Id: Makefile.inc 1428 2006-03-27 02:15:19Z peter $
+
+# $Id: Makefile.inc 1378 2006-02-12 01:27:39Z peter $
+
+# $Id: Makefile.inc 1350 2006-01-29 21:11:03Z peter $
+
+# $Id: Makefile.inc 1851 2007-05-26 17:56:36Z peter $
+
+# $Id: Makefile.inc 1617 2006-09-16 05:43:41Z peter $
+
+# $Id: Makefile.inc 1350 2006-01-29 21:11:03Z peter $
+
+# $Id: Makefile.inc 1183 2004-12-01 07:49:18Z peter $
+
+# $Id: Makefile.inc 1183 2004-12-01 07:49:18Z peter $
+
+# $Id$
+
+# $Id: Makefile.inc 1732 2007-01-13 19:34:04Z peter $
+
+# $Id: Makefile.inc 1183 2004-12-01 07:49:18Z peter $
+
+# $Id: Makefile.inc 2130 2008-10-07 05:38:11Z peter $
+
+# $Id: Makefile.inc 2010 2007-11-14 08:33:32Z peter $
+
+# $Id: Makefile.inc 2010 2007-11-14 08:33:32Z peter $
+
+# $Id: Makefile.inc 1252 2005-09-28 05:50:51Z peter $
+
+# $Id: Makefile.inc 2036 2008-02-09 04:06:47Z peter $
+
+# $Id: Makefile.inc 2126 2008-10-03 08:13:00Z peter $
+
+# $Id: Makefile.inc 2036 2008-02-09 04:06:47Z peter $
+
+# $Id: Makefile.inc 1168 2004-10-31 01:07:52Z peter $
+
+# $Id: Makefile.inc 2082 2008-05-09 06:46:02Z peter $
+
+# $Id: Makefile.inc 1617 2006-09-16 05:43:41Z peter $
+
+# $Id: Makefile.inc 1732 2007-01-13 19:34:04Z peter $
+
+# $Id: Makefile.inc 1777 2007-02-19 08:21:17Z peter $
+
+# $Id: Makefile.inc 1782 2007-02-21 06:45:39Z peter $
+
+# $Id: Makefile.inc 2108 2008-06-05 08:48:21Z peter $
+
+# $Id: Makefile.inc 1854 2007-05-31 06:16:49Z peter $
+
+# $Id: Makefile.inc 2108 2008-06-05 08:48:21Z peter $
+
+# $Id: Makefile.inc 1653 2006-10-17 06:58:41Z peter $
+
+# $Id: Makefile.inc 1653 2006-10-17 06:58:41Z peter $
+
+# $Id: Makefile.inc 1183 2004-12-01 07:49:18Z peter $
+
+# Assume objfmt_coff is included
+
+# $Id: Makefile.inc 2166 2009-01-02 08:33:21Z peter $
+
+# $Id: Makefile.inc 2166 2009-01-02 08:33:21Z peter $
+
+# $Id: Makefile.inc 1331 2006-01-15 22:48:55Z peter $
+
+# Assume objfmt_coff is included
+
+# $Id: Makefile.inc 2120 2008-09-04 04:45:30Z peter $
+
+# $Id: Makefile.inc 2082 2008-05-09 06:46:02Z peter $
+
+# $Id: Makefile.inc 1183 2004-12-01 07:49:18Z peter $
+
+# $Id: Makefile.inc 1851 2007-05-26 17:56:36Z peter $
+
+# $Id: Makefile.inc 2111 2008-07-06 22:26:49Z peter $
+
+# $Id: Makefile.inc 2123 2008-09-30 03:56:37Z peter $
+
+# $Id: Makefile.inc 2130 2008-10-07 05:38:11Z peter $
+
+# $Id: Makefile.inc 1463 2006-04-05 05:39:23Z peter $
+
+# $Id: Makefile.inc 1463 2006-04-05 05:39:23Z peter $
+
+
+
+
+pkgdatadir = $(datadir)/yasm
+pkglibdir = $(libdir)/yasm
+pkgincludedir = $(includedir)/yasm
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = x86_64-unknown-linux-gnu
+host_triplet = x86_64-unknown-linux-gnu
+bin_PROGRAMS = yasm$(EXEEXT) ytasm$(EXEEXT)
+TESTS = $(am__append_3) modules/arch/x86/tests/x86_test.sh \
+ modules/arch/x86/tests/gas32/x86_gas32_test.sh \
+ modules/arch/x86/tests/gas64/x86_gas64_test.sh \
+ modules/arch/lc3b/tests/lc3b_test.sh \
+ modules/parsers/gas/tests/gas_test.sh \
+ modules/parsers/gas/tests/bin/gas_bin_test.sh \
+ modules/parsers/nasm/tests/nasm_test.sh \
+ modules/parsers/nasm/tests/worphan/nasm_worphan_test.sh \
+ modules/parsers/tasm/tests/tasm_test.sh \
+ modules/parsers/tasm/tests/exe/tasm_exe_test.sh \
+ modules/preprocs/nasm/tests/nasmpp_test.sh \
+ modules/preprocs/raw/tests/rawpp_test.sh \
+ modules/dbgfmts/dwarf2/tests/pass32/dwarf2_pass32_test.sh \
+ modules/dbgfmts/dwarf2/tests/pass64/dwarf2_pass64_test.sh \
+ modules/dbgfmts/dwarf2/tests/passwin64/dwarf2_passwin64_test.sh \
+ modules/dbgfmts/stabs/tests/stabs_test.sh \
+ modules/objfmts/bin/tests/bin_test.sh \
+ modules/objfmts/bin/tests/multisect/bin_multi_test.sh \
+ modules/objfmts/elf/tests/elf_test.sh \
+ modules/objfmts/elf/tests/amd64/elf_amd64_test.sh \
+ modules/objfmts/elf/tests/gas32/elf_gas32_test.sh \
+ modules/objfmts/elf/tests/gas64/elf_gas64_test.sh \
+ modules/objfmts/coff/tests/coff_test.sh \
+ modules/objfmts/macho/tests/gas32/gas_macho32_test.sh \
+ modules/objfmts/macho/tests/gas64/gas_macho64_test.sh \
+ modules/objfmts/macho/tests/nasm32/macho32_test.sh \
+ modules/objfmts/macho/tests/nasm64/macho64_test.sh \
+ modules/objfmts/rdf/tests/rdf_test.sh \
+ modules/objfmts/win32/tests/win32_test.sh \
+ modules/objfmts/win32/tests/gas/win32_gas_test.sh \
+ modules/objfmts/win64/tests/win64_test.sh \
+ modules/objfmts/win64/tests/gas/win64_gas_test.sh \
+ modules/objfmts/xdf/tests/xdf_test.sh bitvect_test$(EXEEXT) \
+ floatnum_test$(EXEEXT) leb128_test$(EXEEXT) \
+ splitpath_test$(EXEEXT) combpath_test$(EXEEXT) \
+ uncstring_test$(EXEEXT) libyasm/tests/libyasm_test.sh
+noinst_PROGRAMS = genstring$(EXEEXT) re2c$(EXEEXT) genmacro$(EXEEXT) \
+ genperf$(EXEEXT) genversion$(EXEEXT) genmodule$(EXEEXT)
+check_PROGRAMS = test_hd$(EXEEXT) bitvect_test$(EXEEXT) \
+ floatnum_test$(EXEEXT) leb128_test$(EXEEXT) \
+ splitpath_test$(EXEEXT) combpath_test$(EXEEXT) \
+ uncstring_test$(EXEEXT)
+DIST_COMMON = README $(am__configure_deps) $(dist_man_MANS) \
+ $(include_HEADERS) $(modinclude_HEADERS) $(noinst_HEADERS) \
+ $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(srcdir)/config.h.in $(srcdir)/frontends/Makefile.inc \
+ $(srcdir)/frontends/tasm/Makefile.inc \
+ $(srcdir)/frontends/yasm/Makefile.inc \
+ $(srcdir)/libyasm/Makefile.inc \
+ $(srcdir)/libyasm/tests/Makefile.inc $(srcdir)/m4/Makefile.inc \
+ $(srcdir)/modules/Makefile.inc \
+ $(srcdir)/modules/arch/Makefile.inc \
+ $(srcdir)/modules/arch/lc3b/Makefile.inc \
+ $(srcdir)/modules/arch/lc3b/tests/Makefile.inc \
+ $(srcdir)/modules/arch/x86/Makefile.inc \
+ $(srcdir)/modules/arch/x86/tests/Makefile.inc \
+ $(srcdir)/modules/arch/x86/tests/gas32/Makefile.inc \
+ $(srcdir)/modules/arch/x86/tests/gas64/Makefile.inc \
+ $(srcdir)/modules/dbgfmts/Makefile.inc \
+ $(srcdir)/modules/dbgfmts/codeview/Makefile.inc \
+ $(srcdir)/modules/dbgfmts/dwarf2/Makefile.inc \
+ $(srcdir)/modules/dbgfmts/dwarf2/tests/Makefile.inc \
+ $(srcdir)/modules/dbgfmts/dwarf2/tests/pass32/Makefile.inc \
+ $(srcdir)/modules/dbgfmts/dwarf2/tests/pass64/Makefile.inc \
+ $(srcdir)/modules/dbgfmts/dwarf2/tests/passwin64/Makefile.inc \
+ $(srcdir)/modules/dbgfmts/null/Makefile.inc \
+ $(srcdir)/modules/dbgfmts/stabs/Makefile.inc \
+ $(srcdir)/modules/dbgfmts/stabs/tests/Makefile.inc \
+ $(srcdir)/modules/listfmts/Makefile.inc \
+ $(srcdir)/modules/listfmts/nasm/Makefile.inc \
+ $(srcdir)/modules/objfmts/Makefile.inc \
+ $(srcdir)/modules/objfmts/bin/Makefile.inc \
+ $(srcdir)/modules/objfmts/bin/tests/Makefile.inc \
+ $(srcdir)/modules/objfmts/bin/tests/multisect/Makefile.inc \
+ $(srcdir)/modules/objfmts/coff/Makefile.inc \
+ $(srcdir)/modules/objfmts/coff/tests/Makefile.inc \
+ $(srcdir)/modules/objfmts/dbg/Makefile.inc \
+ $(srcdir)/modules/objfmts/elf/Makefile.inc \
+ $(srcdir)/modules/objfmts/elf/tests/Makefile.inc \
+ $(srcdir)/modules/objfmts/elf/tests/amd64/Makefile.inc \
+ $(srcdir)/modules/objfmts/elf/tests/gas32/Makefile.inc \
+ $(srcdir)/modules/objfmts/elf/tests/gas64/Makefile.inc \
+ $(srcdir)/modules/objfmts/macho/Makefile.inc \
+ $(srcdir)/modules/objfmts/macho/tests/Makefile.inc \
+ $(srcdir)/modules/objfmts/macho/tests/gas32/Makefile.inc \
+ $(srcdir)/modules/objfmts/macho/tests/gas64/Makefile.inc \
+ $(srcdir)/modules/objfmts/macho/tests/nasm32/Makefile.inc \
+ $(srcdir)/modules/objfmts/macho/tests/nasm64/Makefile.inc \
+ $(srcdir)/modules/objfmts/rdf/Makefile.inc \
+ $(srcdir)/modules/objfmts/rdf/tests/Makefile.inc \
+ $(srcdir)/modules/objfmts/win32/Makefile.inc \
+ $(srcdir)/modules/objfmts/win32/tests/Makefile.inc \
+ $(srcdir)/modules/objfmts/win32/tests/gas/Makefile.inc \
+ $(srcdir)/modules/objfmts/win64/Makefile.inc \
+ $(srcdir)/modules/objfmts/win64/tests/Makefile.inc \
+ $(srcdir)/modules/objfmts/win64/tests/gas/Makefile.inc \
+ $(srcdir)/modules/objfmts/xdf/Makefile.inc \
+ $(srcdir)/modules/objfmts/xdf/tests/Makefile.inc \
+ $(srcdir)/modules/parsers/Makefile.inc \
+ $(srcdir)/modules/parsers/gas/Makefile.inc \
+ $(srcdir)/modules/parsers/gas/tests/Makefile.inc \
+ $(srcdir)/modules/parsers/gas/tests/bin/Makefile.inc \
+ $(srcdir)/modules/parsers/nasm/Makefile.inc \
+ $(srcdir)/modules/parsers/nasm/tests/Makefile.inc \
+ $(srcdir)/modules/parsers/nasm/tests/worphan/Makefile.inc \
+ $(srcdir)/modules/parsers/tasm/Makefile.inc \
+ $(srcdir)/modules/parsers/tasm/tests/Makefile.inc \
+ $(srcdir)/modules/parsers/tasm/tests/exe/Makefile.inc \
+ $(srcdir)/modules/preprocs/Makefile.inc \
+ $(srcdir)/modules/preprocs/cpp/Makefile.inc \
+ $(srcdir)/modules/preprocs/nasm/Makefile.inc \
+ $(srcdir)/modules/preprocs/nasm/tests/Makefile.inc \
+ $(srcdir)/modules/preprocs/raw/Makefile.inc \
+ $(srcdir)/modules/preprocs/raw/tests/Makefile.inc \
+ $(srcdir)/tools/Makefile.inc \
+ $(srcdir)/tools/genmacro/Makefile.inc \
+ $(srcdir)/tools/genperf/Makefile.inc \
+ $(srcdir)/tools/python-yasm/Makefile.inc \
+ $(srcdir)/tools/python-yasm/tests/Makefile.inc \
+ $(srcdir)/tools/re2c/Makefile.inc $(top_srcdir)/configure \
+ ABOUT-NLS AUTHORS COPYING ChangeLog INSTALL NEWS \
+ config/config.guess config/config.rpath config/config.sub \
+ config/depcomp config/install-sh config/ltmain.sh \
+ config/missing
+#am__append_1 = _yasm.pxi yasm.pyx \
+# yasm_python.c python-setup.txt \
+# .python-build
+#am__append_2 = PYTHON=${PYTHON}
+#am__append_3 = tools/python-yasm/tests/python_test.sh
+am__append_4 = $(dist_man_MANS)
+subdir = .
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/ax_create_stdint_h.m4 \
+ $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/iconv.m4 \
+ $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
+ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/nls.m4 \
+ $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \
+ $(top_srcdir)/m4/pyrex.m4 $(top_srcdir)/m4/pythonhead.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
+ configure.lineno config.status.lineno
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = config.h
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \
+ "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man7dir)" \
+ "$(DESTDIR)$(includedir)" "$(DESTDIR)$(modincludedir)" \
+ "$(DESTDIR)$(includedir)"
+libLIBRARIES_INSTALL = $(INSTALL_DATA)
+LIBRARIES = $(lib_LIBRARIES)
+AR = ar
+ARFLAGS = cru
+libyasm_a_AR = $(AR) $(ARFLAGS)
+libyasm_a_LIBADD =
+am_libyasm_a_OBJECTS = x86arch.$(OBJEXT) x86bc.$(OBJEXT) \
+ x86expr.$(OBJEXT) x86id.$(OBJEXT) lc3barch.$(OBJEXT) \
+ lc3bbc.$(OBJEXT) nasm-listfmt.$(OBJEXT) gas-parser.$(OBJEXT) \
+ gas-parse.$(OBJEXT) nasm-parser.$(OBJEXT) nasm-parse.$(OBJEXT) \
+ nasm-preproc.$(OBJEXT) nasm-pp.$(OBJEXT) nasmlib.$(OBJEXT) \
+ nasm-eval.$(OBJEXT) raw-preproc.$(OBJEXT) \
+ cpp-preproc.$(OBJEXT) cv-dbgfmt.$(OBJEXT) cv-symline.$(OBJEXT) \
+ cv-type.$(OBJEXT) dwarf2-dbgfmt.$(OBJEXT) \
+ dwarf2-line.$(OBJEXT) dwarf2-aranges.$(OBJEXT) \
+ dwarf2-info.$(OBJEXT) null-dbgfmt.$(OBJEXT) \
+ stabs-dbgfmt.$(OBJEXT) dbg-objfmt.$(OBJEXT) \
+ bin-objfmt.$(OBJEXT) elf.$(OBJEXT) elf-objfmt.$(OBJEXT) \
+ elf-x86-x86.$(OBJEXT) elf-x86-amd64.$(OBJEXT) \
+ coff-objfmt.$(OBJEXT) win64-except.$(OBJEXT) \
+ macho-objfmt.$(OBJEXT) rdf-objfmt.$(OBJEXT) \
+ xdf-objfmt.$(OBJEXT) assocdat.$(OBJEXT) bitvect.$(OBJEXT) \
+ bc-align.$(OBJEXT) bc-data.$(OBJEXT) bc-incbin.$(OBJEXT) \
+ bc-org.$(OBJEXT) bc-reserve.$(OBJEXT) bytecode.$(OBJEXT) \
+ errwarn.$(OBJEXT) expr.$(OBJEXT) file.$(OBJEXT) \
+ floatnum.$(OBJEXT) hamt.$(OBJEXT) insn.$(OBJEXT) \
+ intnum.$(OBJEXT) inttree.$(OBJEXT) linemap.$(OBJEXT) \
+ md5.$(OBJEXT) mergesort.$(OBJEXT) phash.$(OBJEXT) \
+ section.$(OBJEXT) strcasecmp.$(OBJEXT) strsep.$(OBJEXT) \
+ symrec.$(OBJEXT) valparam.$(OBJEXT) value.$(OBJEXT) \
+ xmalloc.$(OBJEXT) xstrdup.$(OBJEXT)
+nodist_libyasm_a_OBJECTS = x86cpu.$(OBJEXT) x86regtmod.$(OBJEXT) \
+ lc3bid.$(OBJEXT) gas-token.$(OBJEXT) nasm-token.$(OBJEXT) \
+ module.$(OBJEXT)
+libyasm_a_OBJECTS = $(am_libyasm_a_OBJECTS) \
+ $(nodist_libyasm_a_OBJECTS)
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS)
+am_bitvect_test_OBJECTS = bitvect_test.$(OBJEXT)
+bitvect_test_OBJECTS = $(am_bitvect_test_OBJECTS)
+am__DEPENDENCIES_1 =
+bitvect_test_DEPENDENCIES = libyasm.a $(am__DEPENDENCIES_1)
+am_combpath_test_OBJECTS = combpath_test.$(OBJEXT)
+combpath_test_OBJECTS = $(am_combpath_test_OBJECTS)
+combpath_test_DEPENDENCIES = libyasm.a $(am__DEPENDENCIES_1)
+am_floatnum_test_OBJECTS = floatnum_test.$(OBJEXT)
+floatnum_test_OBJECTS = $(am_floatnum_test_OBJECTS)
+floatnum_test_DEPENDENCIES = libyasm.a $(am__DEPENDENCIES_1)
+am_genmacro_OBJECTS =
+genmacro_OBJECTS = $(am_genmacro_OBJECTS)
+genmacro_DEPENDENCIES = genmacro.$(OBJEXT)
+am_genmodule_OBJECTS =
+genmodule_OBJECTS = $(am_genmodule_OBJECTS)
+genmodule_DEPENDENCIES = genmodule.$(OBJEXT)
+am_genperf_OBJECTS =
+genperf_OBJECTS = $(am_genperf_OBJECTS)
+genperf_DEPENDENCIES = genperf.$(OBJEXT) gp-perfect.$(OBJEXT) \
+ gp-phash.$(OBJEXT) gp-xmalloc.$(OBJEXT) gp-xstrdup.$(OBJEXT)
+am_genstring_OBJECTS =
+genstring_OBJECTS = $(am_genstring_OBJECTS)
+genstring_DEPENDENCIES = genstring.$(OBJEXT)
+am_genversion_OBJECTS =
+genversion_OBJECTS = $(am_genversion_OBJECTS)
+genversion_DEPENDENCIES = genversion.$(OBJEXT)
+am_leb128_test_OBJECTS = leb128_test.$(OBJEXT)
+leb128_test_OBJECTS = $(am_leb128_test_OBJECTS)
+leb128_test_DEPENDENCIES = libyasm.a $(am__DEPENDENCIES_1)
+am_re2c_OBJECTS =
+re2c_OBJECTS = $(am_re2c_OBJECTS)
+re2c_DEPENDENCIES = re2c-main.$(OBJEXT) re2c-code.$(OBJEXT) \
+ re2c-dfa.$(OBJEXT) re2c-parser.$(OBJEXT) \
+ re2c-actions.$(OBJEXT) re2c-scanner.$(OBJEXT) \
+ re2c-mbo_getopt.$(OBJEXT) re2c-substr.$(OBJEXT) \
+ re2c-translate.$(OBJEXT)
+am_splitpath_test_OBJECTS = splitpath_test.$(OBJEXT)
+splitpath_test_OBJECTS = $(am_splitpath_test_OBJECTS)
+splitpath_test_DEPENDENCIES = libyasm.a $(am__DEPENDENCIES_1)
+am_test_hd_OBJECTS = test_hd.$(OBJEXT)
+test_hd_OBJECTS = $(am_test_hd_OBJECTS)
+test_hd_LDADD = $(LDADD)
+am_uncstring_test_OBJECTS = uncstring_test.$(OBJEXT)
+uncstring_test_OBJECTS = $(am_uncstring_test_OBJECTS)
+uncstring_test_DEPENDENCIES = libyasm.a $(am__DEPENDENCIES_1)
+am_yasm_OBJECTS = yasm.$(OBJEXT) yasm-options.$(OBJEXT)
+yasm_OBJECTS = $(am_yasm_OBJECTS)
+yasm_DEPENDENCIES = libyasm.a $(am__DEPENDENCIES_1)
+am_ytasm_OBJECTS = tasm.$(OBJEXT) tasm-options.$(OBJEXT)
+ytasm_OBJECTS = $(am_ytasm_OBJECTS)
+ytasm_DEPENDENCIES = libyasm.a $(am__DEPENDENCIES_1)
+DEFAULT_INCLUDES = -I.
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libyasm_a_SOURCES) $(nodist_libyasm_a_SOURCES) \
+ $(bitvect_test_SOURCES) $(combpath_test_SOURCES) \
+ $(floatnum_test_SOURCES) $(genmacro_SOURCES) \
+ $(genmodule_SOURCES) $(genperf_SOURCES) $(genstring_SOURCES) \
+ $(genversion_SOURCES) $(leb128_test_SOURCES) $(re2c_SOURCES) \
+ $(splitpath_test_SOURCES) $(test_hd_SOURCES) \
+ $(uncstring_test_SOURCES) $(yasm_SOURCES) $(ytasm_SOURCES)
+DIST_SOURCES = $(libyasm_a_SOURCES) $(bitvect_test_SOURCES) \
+ $(combpath_test_SOURCES) $(floatnum_test_SOURCES) \
+ $(genmacro_SOURCES) $(genmodule_SOURCES) $(genperf_SOURCES) \
+ $(genstring_SOURCES) $(genversion_SOURCES) \
+ $(leb128_test_SOURCES) $(re2c_SOURCES) \
+ $(splitpath_test_SOURCES) $(test_hd_SOURCES) \
+ $(uncstring_test_SOURCES) $(yasm_SOURCES) $(ytasm_SOURCES)
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-dvi-recursive install-exec-recursive \
+ install-html-recursive install-info-recursive \
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
+man1dir = $(mandir)/man1
+man7dir = $(mandir)/man7
+NROFF = nroff
+MANS = $(dist_man_MANS)
+includeHEADERS_INSTALL = $(INSTALL_HEADER)
+modincludeHEADERS_INSTALL = $(INSTALL_HEADER)
+nodist_includeHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(include_HEADERS) $(modinclude_HEADERS) \
+ $(nodist_include_HEADERS) $(noinst_HEADERS)
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+distdir = $(PACKAGE)-$(VERSION)
+top_distdir = $(distdir)
+am__remove_distdir = \
+ { test ! -d $(distdir) \
+ || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
+ && rm -fr $(distdir); }; }
+DIST_ARCHIVES = $(distdir).tar.gz
+GZIP_ENV = --best
+distuninstallcheck_listfiles = find . -type f -print
+distcleancheck_listfiles = find . -type f -print
+ACLOCAL = ${SHELL} /tmp/yasm/config/missing --run aclocal-1.10
+AMTAR = ${SHELL} /tmp/yasm/config/missing --run tar
+ARCH = x86
+AUTOCONF = ${SHELL} /tmp/yasm/config/missing --run autoconf
+AUTOHEADER = ${SHELL} /tmp/yasm/config/missing --run autoheader
+AUTOMAKE = ${SHELL} /tmp/yasm/config/missing --run automake-1.10
+AWK = gawk
+CC = gcc -std=gnu99
+CCDEPMODE = depmode=gcc3
+CCLD_FOR_BUILD = gcc -std=gnu99
+CC_FOR_BUILD = gcc -std=gnu99
+CFLAGS = -g -O2
+CPP = gcc -E
+CPPFLAGS =
+CYGPATH_W = echo
+DEFS = -DHAVE_CONFIG_H
+DEPDIR = .deps
+ECHO_C =
+ECHO_N = -n
+ECHO_T =
+EGREP = /bin/grep -E
+EXEEXT =
+GCC = yes
+GMSGFMT = /usr/bin/msgfmt
+GMSGFMT_015 = /usr/bin/msgfmt
+GREP = /bin/grep
+HOST_CC = gcc -std=gnu99
+INSTALL = /usr/bin/install -c
+INSTALL_DATA = ${INSTALL} -m 644
+INSTALL_PROGRAM = ${INSTALL}
+INSTALL_SCRIPT = ${INSTALL}
+INSTALL_STRIP_PROGRAM = $(install_sh) -c -s
+INTLLIBS =
+INTL_MACOSX_LIBS =
+LDFLAGS =
+LIBICONV = -liconv
+LIBINTL =
+LIBOBJS =
+LIBS =
+LN_S = ln -s
+LTLIBICONV = -liconv
+LTLIBINTL =
+LTLIBOBJS =
+MAINT =
+MAKEINFO = ${SHELL} /tmp/yasm/config/missing --run makeinfo
+MKDIR_P = /bin/mkdir -p
+MORE_CFLAGS = -ansi -pedantic -Wall -W -Waggregate-return -Wbad-function-cast -Wcast-align -Wcast-qual -Wchar-subscripts -Winline -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wreturn-type -Wshadow -Wsign-compare -Wstrict-prototypes -Wswitch -Wwrite-strings -Wno-undef -Wno-unused-parameter
+MSGFMT = /usr/bin/msgfmt
+MSGFMT_015 = /usr/bin/msgfmt
+MSGMERGE = /usr/bin/msgmerge
+OBJEXT = o
+PACKAGE = yasm
+PACKAGE_BUGREPORT = bug-yasm@tortall.net
+PACKAGE_NAME = yasm
+PACKAGE_STRING = yasm HEAD
+PACKAGE_TARNAME = yasm
+PACKAGE_VERSION = HEAD
+PATH_SEPARATOR = :
+POSUB = po
+PYTHON = /usr/bin/python
+PYTHON_EXEC_PREFIX = ${exec_prefix}
+PYTHON_INCLUDES =
+PYTHON_PLATFORM = linux2
+PYTHON_PREFIX = ${prefix}
+PYTHON_VERSION = 2.5
+RANLIB = ranlib
+SET_MAKE =
+SHELL = /bin/sh
+STRIP =
+USE_NLS = yes
+VERSION = HEAD
+XGETTEXT = /usr/bin/xgettext
+XGETTEXT_015 = /usr/bin/xgettext
+XMLTO = xmlto
+abs_builddir = /tmp/yasm
+abs_srcdir = /tmp/yasm
+abs_top_builddir = /tmp/yasm
+abs_top_srcdir = /tmp/yasm
+ac_ct_CC = gcc
+am__include = include
+am__leading_dot = .
+am__quote =
+am__tar = ${AMTAR} chof - "$$tardir"
+am__untar = ${AMTAR} xf -
+bindir = ${exec_prefix}/bin
+build = x86_64-unknown-linux-gnu
+build_alias =
+build_cpu = x86_64
+build_os = linux-gnu
+build_vendor = unknown
+builddir = .
+datadir = ${datarootdir}
+datarootdir = ${prefix}/share
+docdir = ${datarootdir}/doc/${PACKAGE_TARNAME}
+dvidir = ${docdir}
+exec_prefix = ${prefix}
+host = x86_64-unknown-linux-gnu
+host_alias =
+host_cpu = x86_64
+host_os = linux-gnu
+host_vendor = unknown
+htmldir = ${docdir}
+includedir = ${prefix}/include
+infodir = ${datarootdir}/info
+install_sh = $(SHELL) /tmp/yasm/config/install-sh
+libdir = ${exec_prefix}/lib
+libexecdir = ${exec_prefix}/libexec
+localedir = ${datarootdir}/locale
+localstatedir = ${prefix}/var
+mandir = ${datarootdir}/man
+mkdir_p = /bin/mkdir -p
+oldincludedir = /usr/include
+pdfdir = ${docdir}
+pkgpyexecdir = ${pyexecdir}/yasm
+pkgpythondir = ${pythondir}/yasm
+prefix = /usr/local
+program_transform_name = s,x,x,
+psdir = ${docdir}
+pyexecdir = ${exec_prefix}/lib/python2.5/site-packages
+pythondir = ${prefix}/lib/python2.5/site-packages
+sbindir = ${exec_prefix}/sbin
+sharedstatedir = ${prefix}/com
+srcdir = .
+sysconfdir = ${prefix}/etc
+target_alias =
+top_builddir = .
+top_srcdir = .
+SUBDIRS = po .
+AM_YFLAGS = -d
+AM_CFLAGS = -ansi -pedantic -Wall -W -Waggregate-return -Wbad-function-cast -Wcast-align -Wcast-qual -Wchar-subscripts -Winline -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wreturn-type -Wshadow -Wsign-compare -Wstrict-prototypes -Wswitch -Wwrite-strings -Wno-undef -Wno-unused-parameter
+
+#!include modules/objfmts/omf/Makefile.inc
+dist_man_MANS = yasm_arch.7 yasm_parsers.7 yasm_dbgfmts.7 \
+ yasm_objfmts.7 yasm.1
+TESTS_ENVIRONMENT = $(am__append_2)
+test_hd_SOURCES = test_hd.c
+include_HEADERS = libyasm.h
+nodist_include_HEADERS = libyasm-stdint.h
+noinst_HEADERS = util.h
+BUILT_SOURCES = x86insns.c x86insn_nasm.gperf x86insn_gas.gperf \
+ x86insn_nasm.c x86insn_gas.c gas-token.c nasm-token.c \
+ nasm-macros.c nasm-version.c version.mac win64-nasm.c \
+ win64-gas.c license.c
+MAINTAINERCLEANFILES = x86insns.c x86insn_nasm.gperf x86insn_gas.gperf \
+ $(am__append_4)
+
+# Until this gets fixed in automake
+DISTCLEANFILES = libyasm/stamp-h libyasm/stamp-h[0-9]*
+
+# Suffix rule for genperf
+SUFFIXES = .gperf
+
+# configure.lineno doesn't clean up after itself?
+CLEANFILES = configure.lineno $(am__append_1) x86insn_nasm.c \
+ x86insn_gas.c x86cpu.c x86regtmod.c lc3bid.c gas-token.c \
+ nasm-token.c nasm-macros.c nasm-version.c version.mac \
+ win64-nasm.c win64-gas.c module.c license.c
+
+# automake doesn't distribute mkinstalldirs?
+#!EXTRA_DIST += modules/objfmts/omf/Makefile.inc
+EXTRA_DIST = config/config.rpath config/mkinstalldirs \
+ tools/Makefile.inc libyasm/Makefile.inc modules/Makefile.inc \
+ frontends/Makefile.inc tools/re2c/Makefile.inc \
+ tools/genmacro/Makefile.inc tools/genperf/Makefile.inc \
+ tools/python-yasm/Makefile.inc tools/re2c/main.c \
+ tools/re2c/basics.h tools/re2c/globals.h tools/re2c/ins.h \
+ tools/re2c/re.h tools/re2c/token.h tools/re2c/code.c \
+ tools/re2c/dfa.h tools/re2c/dfa.c tools/re2c/parse.h \
+ tools/re2c/parser.h tools/re2c/parser.c tools/re2c/actions.c \
+ tools/re2c/scanner.h tools/re2c/scanner.c \
+ tools/re2c/mbo_getopt.h tools/re2c/mbo_getopt.c \
+ tools/re2c/substr.h tools/re2c/substr.c tools/re2c/translate.c \
+ tools/re2c/CHANGELOG tools/re2c/NO_WARRANTY tools/re2c/README \
+ tools/re2c/scanner.re tools/re2c/re2c.1 \
+ tools/re2c/bootstrap/scanner.c tools/re2c/doc/loplas.ps.gz \
+ tools/re2c/doc/sample.bib tools/re2c/examples/basemmap.c \
+ tools/re2c/examples/c.re tools/re2c/examples/cmmap.re \
+ tools/re2c/examples/cnokw.re tools/re2c/examples/cunroll.re \
+ tools/re2c/examples/modula.re tools/re2c/examples/repeater.re \
+ tools/re2c/examples/sample.re tools/re2c/examples/simple.re \
+ tools/re2c/examples/rexx/README \
+ tools/re2c/examples/rexx/rexx.l \
+ tools/re2c/examples/rexx/scanio.c tools/genmacro/genmacro.c \
+ tools/genperf/genperf.c tools/genperf/perfect.c \
+ tools/genperf/perfect.h tools/genperf/standard.h \
+ tools/python-yasm/pyxelator/cparse.py \
+ tools/python-yasm/pyxelator/genpyx.py \
+ tools/python-yasm/pyxelator/ir.py \
+ tools/python-yasm/pyxelator/lexer.py \
+ tools/python-yasm/pyxelator/node.py \
+ tools/python-yasm/pyxelator/parse_core.py \
+ tools/python-yasm/pyxelator/work_unit.py \
+ tools/python-yasm/pyxelator/wrap_yasm.py \
+ tools/python-yasm/setup.py tools/python-yasm/yasm.pyx \
+ $(PYBINDING_DEPS) tools/python-yasm/tests/Makefile.inc \
+ tools/python-yasm/tests/python_test.sh \
+ tools/python-yasm/tests/__init__.py \
+ tools/python-yasm/tests/test_bytecode.py \
+ tools/python-yasm/tests/test_expr.py \
+ tools/python-yasm/tests/test_intnum.py \
+ tools/python-yasm/tests/test_symrec.py \
+ modules/arch/Makefile.inc modules/listfmts/Makefile.inc \
+ modules/parsers/Makefile.inc modules/preprocs/Makefile.inc \
+ modules/objfmts/Makefile.inc modules/arch/x86/Makefile.inc \
+ modules/arch/lc3b/Makefile.inc \
+ modules/arch/x86/gen_x86_insn.py x86insns.c x86insn_nasm.gperf \
+ x86insn_gas.gperf modules/arch/x86/x86cpu.gperf \
+ modules/arch/x86/x86regtmod.gperf \
+ modules/arch/x86/tests/Makefile.inc \
+ modules/arch/x86/tests/x86_test.sh \
+ modules/arch/x86/tests/gen-fma-test.py \
+ modules/arch/x86/tests/addbyte.asm \
+ modules/arch/x86/tests/addbyte.errwarn \
+ modules/arch/x86/tests/addbyte.hex \
+ modules/arch/x86/tests/addrop.asm \
+ modules/arch/x86/tests/addrop.errwarn \
+ modules/arch/x86/tests/addrop.hex \
+ modules/arch/x86/tests/addrop-err.asm \
+ modules/arch/x86/tests/addrop-err.errwarn \
+ modules/arch/x86/tests/aes.asm modules/arch/x86/tests/aes.hex \
+ modules/arch/x86/tests/amd200707.asm \
+ modules/arch/x86/tests/amd200707.hex \
+ modules/arch/x86/tests/arithsmall.asm \
+ modules/arch/x86/tests/arithsmall.errwarn \
+ modules/arch/x86/tests/arithsmall.hex \
+ modules/arch/x86/tests/avx.asm modules/arch/x86/tests/avx.hex \
+ modules/arch/x86/tests/avxcc.asm \
+ modules/arch/x86/tests/avxcc.hex \
+ modules/arch/x86/tests/bittest.asm \
+ modules/arch/x86/tests/bittest.hex \
+ modules/arch/x86/tests/bswap64.asm \
+ modules/arch/x86/tests/bswap64.hex \
+ modules/arch/x86/tests/clmul.asm \
+ modules/arch/x86/tests/clmul.hex \
+ modules/arch/x86/tests/cmpxchg.asm \
+ modules/arch/x86/tests/cmpxchg.hex \
+ modules/arch/x86/tests/cpubasic-err.asm \
+ modules/arch/x86/tests/cpubasic-err.errwarn \
+ modules/arch/x86/tests/cyrix.asm \
+ modules/arch/x86/tests/cyrix.hex \
+ modules/arch/x86/tests/div-err.asm \
+ modules/arch/x86/tests/div-err.errwarn \
+ modules/arch/x86/tests/ea-nonzero.asm \
+ modules/arch/x86/tests/ea-nonzero.hex \
+ modules/arch/x86/tests/ea-over.asm \
+ modules/arch/x86/tests/ea-over.errwarn \
+ modules/arch/x86/tests/ea-over.hex \
+ modules/arch/x86/tests/ea-warn.asm \
+ modules/arch/x86/tests/ea-warn.errwarn \
+ modules/arch/x86/tests/ea-warn.hex \
+ modules/arch/x86/tests/ebpindex.asm \
+ modules/arch/x86/tests/ebpindex.hex \
+ modules/arch/x86/tests/effaddr.asm \
+ modules/arch/x86/tests/effaddr.hex \
+ modules/arch/x86/tests/enter.asm \
+ modules/arch/x86/tests/enter.errwarn \
+ modules/arch/x86/tests/enter.hex \
+ modules/arch/x86/tests/far64.asm \
+ modules/arch/x86/tests/far64.hex \
+ modules/arch/x86/tests/farbasic.asm \
+ modules/arch/x86/tests/farbasic.hex \
+ modules/arch/x86/tests/farithr.asm \
+ modules/arch/x86/tests/farithr.hex \
+ modules/arch/x86/tests/fcmov.asm \
+ modules/arch/x86/tests/fcmov.hex \
+ modules/arch/x86/tests/fma.asm modules/arch/x86/tests/fma.hex \
+ modules/arch/x86/tests/fwdequ64.asm \
+ modules/arch/x86/tests/fwdequ64.hex \
+ modules/arch/x86/tests/genopcode.asm \
+ modules/arch/x86/tests/genopcode.hex \
+ modules/arch/x86/tests/imm64.asm \
+ modules/arch/x86/tests/imm64.errwarn \
+ modules/arch/x86/tests/imm64.hex \
+ modules/arch/x86/tests/iret.asm \
+ modules/arch/x86/tests/iret.hex \
+ modules/arch/x86/tests/jmp64-1.asm \
+ modules/arch/x86/tests/jmp64-1.hex \
+ modules/arch/x86/tests/jmp64-2.asm \
+ modules/arch/x86/tests/jmp64-2.hex \
+ modules/arch/x86/tests/jmp64-3.asm \
+ modules/arch/x86/tests/jmp64-3.hex \
+ modules/arch/x86/tests/jmp64-4.asm \
+ modules/arch/x86/tests/jmp64-4.hex \
+ modules/arch/x86/tests/jmp64-5.asm \
+ modules/arch/x86/tests/jmp64-5.hex \
+ modules/arch/x86/tests/jmp64-6.asm \
+ modules/arch/x86/tests/jmp64-6.hex \
+ modules/arch/x86/tests/jmpfar.asm \
+ modules/arch/x86/tests/jmpfar.hex \
+ modules/arch/x86/tests/lds.asm modules/arch/x86/tests/lds.hex \
+ modules/arch/x86/tests/loopadsz.asm \
+ modules/arch/x86/tests/loopadsz.hex \
+ modules/arch/x86/tests/lsahf.asm \
+ modules/arch/x86/tests/lsahf.hex \
+ modules/arch/x86/tests/mem64-err.asm \
+ modules/arch/x86/tests/mem64-err.errwarn \
+ modules/arch/x86/tests/mem64.asm \
+ modules/arch/x86/tests/mem64.errwarn \
+ modules/arch/x86/tests/mem64.hex \
+ modules/arch/x86/tests/mem64hi32.asm \
+ modules/arch/x86/tests/mem64hi32.hex \
+ modules/arch/x86/tests/mem64rip.asm \
+ modules/arch/x86/tests/mem64rip.hex \
+ modules/arch/x86/tests/mixcase.asm \
+ modules/arch/x86/tests/mixcase.hex \
+ modules/arch/x86/tests/movbe.asm \
+ modules/arch/x86/tests/movbe.hex \
+ modules/arch/x86/tests/movdq32.asm \
+ modules/arch/x86/tests/movdq32.hex \
+ modules/arch/x86/tests/movdq64.asm \
+ modules/arch/x86/tests/movdq64.hex \
+ modules/arch/x86/tests/negequ.asm \
+ modules/arch/x86/tests/negequ.hex \
+ modules/arch/x86/tests/nomem64-err.asm \
+ modules/arch/x86/tests/nomem64-err.errwarn \
+ modules/arch/x86/tests/nomem64-err2.asm \
+ modules/arch/x86/tests/nomem64-err2.errwarn \
+ modules/arch/x86/tests/nomem64.asm \
+ modules/arch/x86/tests/nomem64.errwarn \
+ modules/arch/x86/tests/nomem64.hex \
+ modules/arch/x86/tests/o64.asm modules/arch/x86/tests/o64.hex \
+ modules/arch/x86/tests/o64loop.asm \
+ modules/arch/x86/tests/o64loop.errwarn \
+ modules/arch/x86/tests/o64loop.hex \
+ modules/arch/x86/tests/opersize.asm \
+ modules/arch/x86/tests/opersize.hex \
+ modules/arch/x86/tests/opsize-err.asm \
+ modules/arch/x86/tests/opsize-err.errwarn \
+ modules/arch/x86/tests/overflow.asm \
+ modules/arch/x86/tests/overflow.errwarn \
+ modules/arch/x86/tests/overflow.hex \
+ modules/arch/x86/tests/padlock.asm \
+ modules/arch/x86/tests/padlock.hex \
+ modules/arch/x86/tests/pshift.asm \
+ modules/arch/x86/tests/pshift.hex \
+ modules/arch/x86/tests/push64.asm \
+ modules/arch/x86/tests/push64.errwarn \
+ modules/arch/x86/tests/push64.hex \
+ modules/arch/x86/tests/pushf.asm \
+ modules/arch/x86/tests/pushf.hex \
+ modules/arch/x86/tests/pushf-err.asm \
+ modules/arch/x86/tests/pushf-err.errwarn \
+ modules/arch/x86/tests/pushnosize.asm \
+ modules/arch/x86/tests/pushnosize.errwarn \
+ modules/arch/x86/tests/pushnosize.hex \
+ modules/arch/x86/tests/rep.asm modules/arch/x86/tests/rep.hex \
+ modules/arch/x86/tests/ret.asm modules/arch/x86/tests/ret.hex \
+ modules/arch/x86/tests/riprel1.asm \
+ modules/arch/x86/tests/riprel1.hex \
+ modules/arch/x86/tests/riprel2.asm \
+ modules/arch/x86/tests/riprel2.errwarn \
+ modules/arch/x86/tests/riprel2.hex \
+ modules/arch/x86/tests/ripseg.asm \
+ modules/arch/x86/tests/ripseg.errwarn \
+ modules/arch/x86/tests/ripseg.hex \
+ modules/arch/x86/tests/segmov.asm \
+ modules/arch/x86/tests/segmov.hex \
+ modules/arch/x86/tests/segoff.asm \
+ modules/arch/x86/tests/segoff.hex \
+ modules/arch/x86/tests/segoff-err.asm \
+ modules/arch/x86/tests/segoff-err.errwarn \
+ modules/arch/x86/tests/shift.asm \
+ modules/arch/x86/tests/shift.hex \
+ modules/arch/x86/tests/simd-1.asm \
+ modules/arch/x86/tests/simd-1.hex \
+ modules/arch/x86/tests/simd-2.asm \
+ modules/arch/x86/tests/simd-2.hex \
+ modules/arch/x86/tests/simd64-1.asm \
+ modules/arch/x86/tests/simd64-1.hex \
+ modules/arch/x86/tests/simd64-2.asm \
+ modules/arch/x86/tests/simd64-2.hex \
+ modules/arch/x86/tests/sse-prefix.asm \
+ modules/arch/x86/tests/sse-prefix.hex \
+ modules/arch/x86/tests/sse3.asm \
+ modules/arch/x86/tests/sse3.hex \
+ modules/arch/x86/tests/sse4.asm \
+ modules/arch/x86/tests/sse4.hex \
+ modules/arch/x86/tests/sse4-err.asm \
+ modules/arch/x86/tests/sse4-err.errwarn \
+ modules/arch/x86/tests/sse5-all.asm \
+ modules/arch/x86/tests/sse5-all.hex \
+ modules/arch/x86/tests/sse5-basic.asm \
+ modules/arch/x86/tests/sse5-basic.hex \
+ modules/arch/x86/tests/sse5-cc.asm \
+ modules/arch/x86/tests/sse5-cc.hex \
+ modules/arch/x86/tests/sse5-err.asm \
+ modules/arch/x86/tests/sse5-err.errwarn \
+ modules/arch/x86/tests/ssewidth.asm \
+ modules/arch/x86/tests/ssewidth.hex \
+ modules/arch/x86/tests/ssse3.asm \
+ modules/arch/x86/tests/ssse3.c \
+ modules/arch/x86/tests/ssse3.hex \
+ modules/arch/x86/tests/stos.asm \
+ modules/arch/x86/tests/stos.hex modules/arch/x86/tests/str.asm \
+ modules/arch/x86/tests/str.hex \
+ modules/arch/x86/tests/strict.asm \
+ modules/arch/x86/tests/strict.errwarn \
+ modules/arch/x86/tests/strict.hex \
+ modules/arch/x86/tests/strict-err.asm \
+ modules/arch/x86/tests/strict-err.errwarn \
+ modules/arch/x86/tests/stringseg.asm \
+ modules/arch/x86/tests/stringseg.errwarn \
+ modules/arch/x86/tests/stringseg.hex \
+ modules/arch/x86/tests/svm.asm modules/arch/x86/tests/svm.hex \
+ modules/arch/x86/tests/twobytemem.asm \
+ modules/arch/x86/tests/twobytemem.errwarn \
+ modules/arch/x86/tests/twobytemem.hex \
+ modules/arch/x86/tests/vmx.asm modules/arch/x86/tests/vmx.hex \
+ modules/arch/x86/tests/vmx-err.asm \
+ modules/arch/x86/tests/vmx-err.errwarn \
+ modules/arch/x86/tests/x86label.asm \
+ modules/arch/x86/tests/x86label.hex \
+ modules/arch/x86/tests/xchg64.asm \
+ modules/arch/x86/tests/xchg64.hex \
+ modules/arch/x86/tests/xmm64.asm \
+ modules/arch/x86/tests/xmm64.hex \
+ modules/arch/x86/tests/xsave.asm \
+ modules/arch/x86/tests/xsave.hex \
+ modules/arch/x86/tests/gas32/Makefile.inc \
+ modules/arch/x86/tests/gas64/Makefile.inc \
+ modules/arch/x86/tests/gas32/x86_gas32_test.sh \
+ modules/arch/x86/tests/gas32/align32.asm \
+ modules/arch/x86/tests/gas32/align32.hex \
+ modules/arch/x86/tests/gas32/gas-farithr.asm \
+ modules/arch/x86/tests/gas32/gas-farithr.hex \
+ modules/arch/x86/tests/gas32/gas-fpmem.asm \
+ modules/arch/x86/tests/gas32/gas-fpmem.hex \
+ modules/arch/x86/tests/gas32/gas-movdq32.asm \
+ modules/arch/x86/tests/gas32/gas-movdq32.hex \
+ modules/arch/x86/tests/gas32/gas-movsd.asm \
+ modules/arch/x86/tests/gas32/gas-movsd.hex \
+ modules/arch/x86/tests/gas32/gas32-jmpcall.asm \
+ modules/arch/x86/tests/gas32/gas32-jmpcall.hex \
+ modules/arch/x86/tests/gas64/x86_gas64_test.sh \
+ modules/arch/x86/tests/gas64/align64.asm \
+ modules/arch/x86/tests/gas64/align64.hex \
+ modules/arch/x86/tests/gas64/gas-cbw.asm \
+ modules/arch/x86/tests/gas64/gas-cbw.hex \
+ modules/arch/x86/tests/gas64/gas-fp.asm \
+ modules/arch/x86/tests/gas64/gas-fp.hex \
+ modules/arch/x86/tests/gas64/gas-inout.asm \
+ modules/arch/x86/tests/gas64/gas-inout.hex \
+ modules/arch/x86/tests/gas64/gas-moreinsn.asm \
+ modules/arch/x86/tests/gas64/gas-moreinsn.hex \
+ modules/arch/x86/tests/gas64/gas-movabs.asm \
+ modules/arch/x86/tests/gas64/gas-movabs.hex \
+ modules/arch/x86/tests/gas64/gas-movdq64.asm \
+ modules/arch/x86/tests/gas64/gas-movdq64.hex \
+ modules/arch/x86/tests/gas64/gas-movsxs.asm \
+ modules/arch/x86/tests/gas64/gas-movsxs.hex \
+ modules/arch/x86/tests/gas64/gas-muldiv.asm \
+ modules/arch/x86/tests/gas64/gas-muldiv.hex \
+ modules/arch/x86/tests/gas64/gas-prefix.asm \
+ modules/arch/x86/tests/gas64/gas-prefix.errwarn \
+ modules/arch/x86/tests/gas64/gas-prefix.hex \
+ modules/arch/x86/tests/gas64/gas-retenter.asm \
+ modules/arch/x86/tests/gas64/gas-retenter.hex \
+ modules/arch/x86/tests/gas64/gas-shift.asm \
+ modules/arch/x86/tests/gas64/gas-shift.hex \
+ modules/arch/x86/tests/gas64/gas64-jmpcall.asm \
+ modules/arch/x86/tests/gas64/gas64-jmpcall.hex \
+ modules/arch/x86/tests/gas64/riprel.asm \
+ modules/arch/x86/tests/gas64/riprel.hex \
+ modules/arch/lc3b/tests/Makefile.inc \
+ modules/arch/lc3b/lc3bid.re \
+ modules/arch/lc3b/tests/lc3b_test.sh \
+ modules/arch/lc3b/tests/lc3b-basic.asm \
+ modules/arch/lc3b/tests/lc3b-basic.errwarn \
+ modules/arch/lc3b/tests/lc3b-basic.hex \
+ modules/arch/lc3b/tests/lc3b-br.asm \
+ modules/arch/lc3b/tests/lc3b-br.hex \
+ modules/arch/lc3b/tests/lc3b-ea-err.asm \
+ modules/arch/lc3b/tests/lc3b-ea-err.errwarn \
+ modules/arch/lc3b/tests/lc3b-mp22NC.asm \
+ modules/arch/lc3b/tests/lc3b-mp22NC.hex \
+ modules/arch/yasm_arch.xml modules/listfmts/nasm/Makefile.inc \
+ modules/parsers/gas/Makefile.inc \
+ modules/parsers/nasm/Makefile.inc \
+ modules/parsers/gas/tests/Makefile.inc \
+ modules/parsers/gas/gas-token.re \
+ modules/parsers/gas/tests/gas_test.sh \
+ modules/parsers/gas/tests/dataref-imm.asm \
+ modules/parsers/gas/tests/dataref-imm.hex \
+ modules/parsers/gas/tests/datavis.asm \
+ modules/parsers/gas/tests/datavis.errwarn \
+ modules/parsers/gas/tests/datavis.hex \
+ modules/parsers/gas/tests/datavis2.asm \
+ modules/parsers/gas/tests/datavis2.hex \
+ modules/parsers/gas/tests/execsect.asm \
+ modules/parsers/gas/tests/execsect.hex \
+ modules/parsers/gas/tests/gas-fill.asm \
+ modules/parsers/gas/tests/gas-fill.hex \
+ modules/parsers/gas/tests/gas-float.asm \
+ modules/parsers/gas/tests/gas-float.hex \
+ modules/parsers/gas/tests/gas-instlabel.asm \
+ modules/parsers/gas/tests/gas-instlabel.hex \
+ modules/parsers/gas/tests/gas-line-err.asm \
+ modules/parsers/gas/tests/gas-line-err.errwarn \
+ modules/parsers/gas/tests/gas-line2-err.asm \
+ modules/parsers/gas/tests/gas-line2-err.errwarn \
+ modules/parsers/gas/tests/gas-push.asm \
+ modules/parsers/gas/tests/gas-push.hex \
+ modules/parsers/gas/tests/gas-segprefix.asm \
+ modules/parsers/gas/tests/gas-segprefix.hex \
+ modules/parsers/gas/tests/gas-semi.asm \
+ modules/parsers/gas/tests/gas-semi.hex \
+ modules/parsers/gas/tests/gassectalign.asm \
+ modules/parsers/gas/tests/gassectalign.hex \
+ modules/parsers/gas/tests/jmpcall.asm \
+ modules/parsers/gas/tests/jmpcall.errwarn \
+ modules/parsers/gas/tests/jmpcall.hex \
+ modules/parsers/gas/tests/leb128.asm \
+ modules/parsers/gas/tests/leb128.hex \
+ modules/parsers/gas/tests/localcomm.asm \
+ modules/parsers/gas/tests/localcomm.hex \
+ modules/parsers/gas/tests/reggroup-err.asm \
+ modules/parsers/gas/tests/reggroup-err.errwarn \
+ modules/parsers/gas/tests/reggroup.asm \
+ modules/parsers/gas/tests/reggroup.hex \
+ modules/parsers/gas/tests/strzero.asm \
+ modules/parsers/gas/tests/strzero.hex \
+ modules/parsers/gas/tests/varinsn.asm \
+ modules/parsers/gas/tests/varinsn.hex \
+ modules/parsers/gas/tests/bin/Makefile.inc \
+ modules/parsers/gas/tests/bin/gas_bin_test.sh \
+ modules/parsers/gas/tests/bin/gas-comment.asm \
+ modules/parsers/gas/tests/bin/gas-comment.errwarn \
+ modules/parsers/gas/tests/bin/gas-comment.hex \
+ modules/parsers/gas/tests/bin/gas-llabel.asm \
+ modules/parsers/gas/tests/bin/gas-llabel.hex \
+ modules/parsers/gas/tests/bin/gas-set.asm \
+ modules/parsers/gas/tests/bin/gas-set.hex \
+ modules/parsers/gas/tests/bin/rept-err.asm \
+ modules/parsers/gas/tests/bin/rept-err.errwarn \
+ modules/parsers/gas/tests/bin/reptempty.asm \
+ modules/parsers/gas/tests/bin/reptempty.hex \
+ modules/parsers/gas/tests/bin/reptlong.asm \
+ modules/parsers/gas/tests/bin/reptlong.hex \
+ modules/parsers/gas/tests/bin/reptnested-err.asm \
+ modules/parsers/gas/tests/bin/reptnested-err.errwarn \
+ modules/parsers/gas/tests/bin/reptsimple.asm \
+ modules/parsers/gas/tests/bin/reptsimple.hex \
+ modules/parsers/gas/tests/bin/reptwarn.asm \
+ modules/parsers/gas/tests/bin/reptwarn.errwarn \
+ modules/parsers/gas/tests/bin/reptwarn.hex \
+ modules/parsers/gas/tests/bin/reptzero.asm \
+ modules/parsers/gas/tests/bin/reptzero.hex \
+ modules/parsers/nasm/nasm-token.re \
+ modules/parsers/nasm/nasm-std.mac \
+ modules/parsers/nasm/tests/Makefile.inc \
+ modules/parsers/nasm/tests/nasm_test.sh \
+ modules/parsers/nasm/tests/alignnop16.asm \
+ modules/parsers/nasm/tests/alignnop16.hex \
+ modules/parsers/nasm/tests/alignnop32.asm \
+ modules/parsers/nasm/tests/alignnop32.hex \
+ modules/parsers/nasm/tests/charconstmath.asm \
+ modules/parsers/nasm/tests/charconstmath.hex \
+ modules/parsers/nasm/tests/dy.asm \
+ modules/parsers/nasm/tests/dy.hex \
+ modules/parsers/nasm/tests/endcomma.asm \
+ modules/parsers/nasm/tests/endcomma.hex \
+ modules/parsers/nasm/tests/equcolon.asm \
+ modules/parsers/nasm/tests/equcolon.hex \
+ modules/parsers/nasm/tests/equlocal.asm \
+ modules/parsers/nasm/tests/equlocal.hex \
+ modules/parsers/nasm/tests/hexconst.asm \
+ modules/parsers/nasm/tests/hexconst.hex \
+ modules/parsers/nasm/tests/long.asm \
+ modules/parsers/nasm/tests/long.hex \
+ modules/parsers/nasm/tests/locallabel.asm \
+ modules/parsers/nasm/tests/locallabel.hex \
+ modules/parsers/nasm/tests/locallabel2.asm \
+ modules/parsers/nasm/tests/locallabel2.hex \
+ modules/parsers/nasm/tests/nasm-prefix.asm \
+ modules/parsers/nasm/tests/nasm-prefix.hex \
+ modules/parsers/nasm/tests/newsect.asm \
+ modules/parsers/nasm/tests/newsect.hex \
+ modules/parsers/nasm/tests/orphannowarn.asm \
+ modules/parsers/nasm/tests/orphannowarn.hex \
+ modules/parsers/nasm/tests/prevlocalwarn.asm \
+ modules/parsers/nasm/tests/prevlocalwarn.errwarn \
+ modules/parsers/nasm/tests/prevlocalwarn.hex \
+ modules/parsers/nasm/tests/strucalign.asm \
+ modules/parsers/nasm/tests/strucalign.hex \
+ modules/parsers/nasm/tests/struczero.asm \
+ modules/parsers/nasm/tests/struczero.hex \
+ modules/parsers/nasm/tests/syntax-err.asm \
+ modules/parsers/nasm/tests/syntax-err.errwarn \
+ modules/parsers/nasm/tests/uscore.asm \
+ modules/parsers/nasm/tests/uscore.hex \
+ modules/parsers/nasm/tests/worphan/Makefile.inc \
+ modules/parsers/nasm/tests/worphan/nasm_worphan_test.sh \
+ modules/parsers/nasm/tests/worphan/orphanwarn.asm \
+ modules/parsers/nasm/tests/worphan/orphanwarn.errwarn \
+ modules/parsers/nasm/tests/worphan/orphanwarn.hex \
+ modules/parsers/tasm/tests/Makefile.inc \
+ modules/parsers/tasm/tests/tasm_test.sh \
+ modules/parsers/tasm/tests/array.asm \
+ modules/parsers/tasm/tests/array.hex \
+ modules/parsers/tasm/tests/case.asm \
+ modules/parsers/tasm/tests/case.hex \
+ modules/parsers/tasm/tests/charstr.asm \
+ modules/parsers/tasm/tests/charstr.hex \
+ modules/parsers/tasm/tests/dup.asm \
+ modules/parsers/tasm/tests/dup.hex \
+ modules/parsers/tasm/tests/equal.asm \
+ modules/parsers/tasm/tests/equal.hex \
+ modules/parsers/tasm/tests/expr.asm \
+ modules/parsers/tasm/tests/expr.hex \
+ modules/parsers/tasm/tests/irp.asm \
+ modules/parsers/tasm/tests/irp.hex \
+ modules/parsers/tasm/tests/label.asm \
+ modules/parsers/tasm/tests/label.hex \
+ modules/parsers/tasm/tests/les.asm \
+ modules/parsers/tasm/tests/les.hex \
+ modules/parsers/tasm/tests/lidt.asm \
+ modules/parsers/tasm/tests/lidt.hex \
+ modules/parsers/tasm/tests/macro.asm \
+ modules/parsers/tasm/tests/macro.hex \
+ modules/parsers/tasm/tests/offset.asm \
+ modules/parsers/tasm/tests/offset.hex \
+ modules/parsers/tasm/tests/quote.asm \
+ modules/parsers/tasm/tests/quote.hex \
+ modules/parsers/tasm/tests/res.asm \
+ modules/parsers/tasm/tests/res.errwarn \
+ modules/parsers/tasm/tests/res.hex \
+ modules/parsers/tasm/tests/segment.asm \
+ modules/parsers/tasm/tests/segment.hex \
+ modules/parsers/tasm/tests/size.asm \
+ modules/parsers/tasm/tests/size.hex \
+ modules/parsers/tasm/tests/struc.asm \
+ modules/parsers/tasm/tests/struc.errwarn \
+ modules/parsers/tasm/tests/struc.hex \
+ modules/parsers/tasm/tests/exe/Makefile.inc \
+ modules/parsers/tasm/tests/exe/tasm_exe_test.sh \
+ modules/parsers/tasm/tests/exe/exe.asm \
+ modules/parsers/tasm/tests/exe/exe.hex \
+ modules/parsers/yasm_parsers.xml \
+ modules/preprocs/nasm/Makefile.inc \
+ modules/preprocs/raw/Makefile.inc \
+ modules/preprocs/cpp/Makefile.inc \
+ modules/preprocs/nasm/genversion.c \
+ modules/preprocs/nasm/tests/Makefile.inc \
+ modules/preprocs/nasm/tests/nasmpp_test.sh \
+ modules/preprocs/nasm/tests/16args.asm \
+ modules/preprocs/nasm/tests/16args.hex \
+ modules/preprocs/nasm/tests/ifcritical-err.asm \
+ modules/preprocs/nasm/tests/ifcritical-err.errwarn \
+ modules/preprocs/nasm/tests/longline.asm \
+ modules/preprocs/nasm/tests/longline.hex \
+ modules/preprocs/nasm/tests/macroeof-err.asm \
+ modules/preprocs/nasm/tests/macroeof-err.errwarn \
+ modules/preprocs/nasm/tests/noinclude-err.asm \
+ modules/preprocs/nasm/tests/noinclude-err.errwarn \
+ modules/preprocs/nasm/tests/nasmpp-bigint.asm \
+ modules/preprocs/nasm/tests/nasmpp-bigint.hex \
+ modules/preprocs/nasm/tests/nasmpp-decimal.asm \
+ modules/preprocs/nasm/tests/nasmpp-decimal.hex \
+ modules/preprocs/nasm/tests/nasmpp-nested.asm \
+ modules/preprocs/nasm/tests/nasmpp-nested.errwarn \
+ modules/preprocs/nasm/tests/nasmpp-nested.hex \
+ modules/preprocs/nasm/tests/orgsect.asm \
+ modules/preprocs/nasm/tests/orgsect.hex \
+ modules/preprocs/raw/tests/Makefile.inc \
+ modules/preprocs/raw/tests/rawpp_test.sh \
+ modules/preprocs/raw/tests/longline.asm \
+ modules/preprocs/raw/tests/longline.hex \
+ modules/dbgfmts/codeview/Makefile.inc \
+ modules/dbgfmts/dwarf2/Makefile.inc \
+ modules/dbgfmts/null/Makefile.inc \
+ modules/dbgfmts/stabs/Makefile.inc \
+ modules/dbgfmts/codeview/cv8.txt \
+ modules/dbgfmts/dwarf2/tests/Makefile.inc \
+ modules/dbgfmts/dwarf2/tests/pass32/Makefile.inc \
+ modules/dbgfmts/dwarf2/tests/pass64/Makefile.inc \
+ modules/dbgfmts/dwarf2/tests/passwin64/Makefile.inc \
+ modules/dbgfmts/dwarf2/tests/pass32/dwarf2_pass32_test.sh \
+ modules/dbgfmts/dwarf2/tests/pass32/dwarf32-err.asm \
+ modules/dbgfmts/dwarf2/tests/pass32/dwarf32-err.errwarn \
+ modules/dbgfmts/dwarf2/tests/pass32/dwarf32_testhd.asm \
+ modules/dbgfmts/dwarf2/tests/pass32/dwarf32_testhd.hex \
+ modules/dbgfmts/dwarf2/tests/pass64/dwarf2_pass64_test.sh \
+ modules/dbgfmts/dwarf2/tests/pass64/dwarf64_2loc.asm \
+ modules/dbgfmts/dwarf2/tests/pass64/dwarf64_2loc.hex \
+ modules/dbgfmts/dwarf2/tests/pass64/dwarf64_leb128.asm \
+ modules/dbgfmts/dwarf2/tests/pass64/dwarf64_leb128.hex \
+ modules/dbgfmts/dwarf2/tests/passwin64/dwarf2_passwin64_test.sh \
+ modules/dbgfmts/dwarf2/tests/passwin64/dwarfwin64_testhd.asm \
+ modules/dbgfmts/dwarf2/tests/passwin64/dwarfwin64_testhd.errwarn \
+ modules/dbgfmts/dwarf2/tests/passwin64/dwarfwin64_testhd.hex \
+ modules/dbgfmts/stabs/tests/Makefile.inc \
+ modules/dbgfmts/stabs/tests/stabs_test.sh \
+ modules/dbgfmts/stabs/tests/stabs-elf.asm \
+ modules/dbgfmts/stabs/tests/stabs-elf.hex \
+ modules/dbgfmts/yasm_dbgfmts.xml \
+ modules/objfmts/dbg/Makefile.inc \
+ modules/objfmts/bin/Makefile.inc \
+ modules/objfmts/elf/Makefile.inc \
+ modules/objfmts/coff/Makefile.inc \
+ modules/objfmts/macho/Makefile.inc \
+ modules/objfmts/rdf/Makefile.inc \
+ modules/objfmts/win32/Makefile.inc \
+ modules/objfmts/win64/Makefile.inc \
+ modules/objfmts/xdf/Makefile.inc \
+ modules/objfmts/bin/tests/Makefile.inc \
+ modules/objfmts/bin/tests/bin_test.sh \
+ modules/objfmts/bin/tests/abs.asm \
+ modules/objfmts/bin/tests/abs.hex \
+ modules/objfmts/bin/tests/bigorg.asm \
+ modules/objfmts/bin/tests/bigorg.hex \
+ modules/objfmts/bin/tests/bigorg.errwarn \
+ modules/objfmts/bin/tests/bin-farabs.asm \
+ modules/objfmts/bin/tests/bin-farabs.hex \
+ modules/objfmts/bin/tests/bin-rip.asm \
+ modules/objfmts/bin/tests/bin-rip.hex \
+ modules/objfmts/bin/tests/bintest.asm \
+ modules/objfmts/bin/tests/bintest.hex \
+ modules/objfmts/bin/tests/float-err.asm \
+ modules/objfmts/bin/tests/float-err.errwarn \
+ modules/objfmts/bin/tests/float.asm \
+ modules/objfmts/bin/tests/float.hex \
+ modules/objfmts/bin/tests/integer-warn.asm \
+ modules/objfmts/bin/tests/integer-warn.hex \
+ modules/objfmts/bin/tests/integer-warn.errwarn \
+ modules/objfmts/bin/tests/integer.asm \
+ modules/objfmts/bin/tests/integer.hex \
+ modules/objfmts/bin/tests/levelop.asm \
+ modules/objfmts/bin/tests/levelop.hex \
+ modules/objfmts/bin/tests/reserve.asm \
+ modules/objfmts/bin/tests/reserve.hex \
+ modules/objfmts/bin/tests/reserve.errwarn \
+ modules/objfmts/bin/tests/shr.asm \
+ modules/objfmts/bin/tests/shr.hex \
+ modules/objfmts/bin/tests/multisect/Makefile.inc \
+ modules/objfmts/bin/tests/multisect/bin_multi_test.sh \
+ modules/objfmts/bin/tests/multisect/bin-align.asm \
+ modules/objfmts/bin/tests/multisect/bin-align.errwarn \
+ modules/objfmts/bin/tests/multisect/bin-align.hex \
+ modules/objfmts/bin/tests/multisect/bin-align.map \
+ modules/objfmts/bin/tests/multisect/bin-ssym.asm \
+ modules/objfmts/bin/tests/multisect/bin-ssym.hex \
+ modules/objfmts/bin/tests/multisect/bin-ssym.map \
+ modules/objfmts/bin/tests/multisect/follows-loop1-err.asm \
+ modules/objfmts/bin/tests/multisect/follows-loop1-err.errwarn \
+ modules/objfmts/bin/tests/multisect/follows-loop2-err.asm \
+ modules/objfmts/bin/tests/multisect/follows-loop2-err.errwarn \
+ modules/objfmts/bin/tests/multisect/follows-notfound-err.asm \
+ modules/objfmts/bin/tests/multisect/follows-notfound-err.errwarn \
+ modules/objfmts/bin/tests/multisect/initbss.asm \
+ modules/objfmts/bin/tests/multisect/initbss.errwarn \
+ modules/objfmts/bin/tests/multisect/initbss.hex \
+ modules/objfmts/bin/tests/multisect/initbss.map \
+ modules/objfmts/bin/tests/multisect/ldlinux-sects.asm \
+ modules/objfmts/bin/tests/multisect/ldlinux-sects.hex \
+ modules/objfmts/bin/tests/multisect/ldlinux-sects.map \
+ modules/objfmts/bin/tests/multisect/multisect1.asm \
+ modules/objfmts/bin/tests/multisect/multisect1.hex \
+ modules/objfmts/bin/tests/multisect/multisect1.map \
+ modules/objfmts/bin/tests/multisect/multisect2.asm \
+ modules/objfmts/bin/tests/multisect/multisect2.hex \
+ modules/objfmts/bin/tests/multisect/multisect2.map \
+ modules/objfmts/bin/tests/multisect/multisect3.asm \
+ modules/objfmts/bin/tests/multisect/multisect3.hex \
+ modules/objfmts/bin/tests/multisect/multisect3.map \
+ modules/objfmts/bin/tests/multisect/multisect4.asm \
+ modules/objfmts/bin/tests/multisect/multisect4.hex \
+ modules/objfmts/bin/tests/multisect/multisect4.map \
+ modules/objfmts/bin/tests/multisect/multisect5.asm \
+ modules/objfmts/bin/tests/multisect/multisect5.hex \
+ modules/objfmts/bin/tests/multisect/multisect5.map \
+ modules/objfmts/bin/tests/multisect/nomultisect1.asm \
+ modules/objfmts/bin/tests/multisect/nomultisect1.hex \
+ modules/objfmts/bin/tests/multisect/nomultisect1.map \
+ modules/objfmts/bin/tests/multisect/nomultisect2.asm \
+ modules/objfmts/bin/tests/multisect/nomultisect2.hex \
+ modules/objfmts/bin/tests/multisect/nomultisect2.map \
+ modules/objfmts/bin/tests/multisect/vfollows-loop1-err.asm \
+ modules/objfmts/bin/tests/multisect/vfollows-loop1-err.errwarn \
+ modules/objfmts/bin/tests/multisect/vfollows-loop2-err.asm \
+ modules/objfmts/bin/tests/multisect/vfollows-loop2-err.errwarn \
+ modules/objfmts/bin/tests/multisect/vfollows-notfound-err.asm \
+ modules/objfmts/bin/tests/multisect/vfollows-notfound-err.errwarn \
+ modules/objfmts/elf/tests/Makefile.inc \
+ modules/objfmts/elf/tests/elf_test.sh \
+ modules/objfmts/elf/tests/curpos.asm \
+ modules/objfmts/elf/tests/curpos.hex \
+ modules/objfmts/elf/tests/curpos-err.asm \
+ modules/objfmts/elf/tests/curpos-err.errwarn \
+ modules/objfmts/elf/tests/elf-overdef.asm \
+ modules/objfmts/elf/tests/elf-overdef.hex \
+ modules/objfmts/elf/tests/elf-x86id.asm \
+ modules/objfmts/elf/tests/elf-x86id.hex \
+ modules/objfmts/elf/tests/elfabssect.asm \
+ modules/objfmts/elf/tests/elfabssect.hex \
+ modules/objfmts/elf/tests/elfcond.asm \
+ modules/objfmts/elf/tests/elfcond.hex \
+ modules/objfmts/elf/tests/elfequabs.asm \
+ modules/objfmts/elf/tests/elfequabs.hex \
+ modules/objfmts/elf/tests/elfglobal.asm \
+ modules/objfmts/elf/tests/elfglobal.hex \
+ modules/objfmts/elf/tests/elfglobext.asm \
+ modules/objfmts/elf/tests/elfglobext.hex \
+ modules/objfmts/elf/tests/elfglobext2.asm \
+ modules/objfmts/elf/tests/elfglobext2.hex \
+ modules/objfmts/elf/tests/elfmanysym.asm \
+ modules/objfmts/elf/tests/elfmanysym.hex \
+ modules/objfmts/elf/tests/elfreloc.asm \
+ modules/objfmts/elf/tests/elfreloc.hex \
+ modules/objfmts/elf/tests/elfreloc-ext.asm \
+ modules/objfmts/elf/tests/elfreloc-ext.hex \
+ modules/objfmts/elf/tests/elfsectalign.asm \
+ modules/objfmts/elf/tests/elfsectalign.hex \
+ modules/objfmts/elf/tests/elfso.asm \
+ modules/objfmts/elf/tests/elfso.hex \
+ modules/objfmts/elf/tests/elftest.c \
+ modules/objfmts/elf/tests/elftest.asm \
+ modules/objfmts/elf/tests/elftest.hex \
+ modules/objfmts/elf/tests/elftimes.asm \
+ modules/objfmts/elf/tests/elftimes.hex \
+ modules/objfmts/elf/tests/elftypesize.asm \
+ modules/objfmts/elf/tests/elftypesize.hex \
+ modules/objfmts/elf/tests/elfvisibility.asm \
+ modules/objfmts/elf/tests/elfvisibility.errwarn \
+ modules/objfmts/elf/tests/elfvisibility.hex \
+ modules/objfmts/elf/tests/nasm-sectname.asm \
+ modules/objfmts/elf/tests/nasm-sectname.hex \
+ modules/objfmts/elf/tests/nasm-forceident.asm \
+ modules/objfmts/elf/tests/nasm-forceident.hex \
+ modules/objfmts/elf/tests/amd64/Makefile.inc \
+ modules/objfmts/elf/tests/gas32/Makefile.inc \
+ modules/objfmts/elf/tests/gas64/Makefile.inc \
+ modules/objfmts/elf/tests/amd64/elf_amd64_test.sh \
+ modules/objfmts/elf/tests/amd64/elf-rip.asm \
+ modules/objfmts/elf/tests/amd64/elf-rip.hex \
+ modules/objfmts/elf/tests/amd64/elfso64.asm \
+ modules/objfmts/elf/tests/amd64/elfso64.hex \
+ modules/objfmts/elf/tests/amd64/gotpcrel.asm \
+ modules/objfmts/elf/tests/amd64/gotpcrel.hex \
+ modules/objfmts/elf/tests/gas32/elf_gas32_test.sh \
+ modules/objfmts/elf/tests/gas32/elf_gas32_ssym.asm \
+ modules/objfmts/elf/tests/gas32/elf_gas32_ssym.hex \
+ modules/objfmts/elf/tests/gas64/elf_gas64_test.sh \
+ modules/objfmts/elf/tests/gas64/crosssect.asm \
+ modules/objfmts/elf/tests/gas64/crosssect.hex \
+ modules/objfmts/elf/tests/gas64/elf_gas64_curpos.asm \
+ modules/objfmts/elf/tests/gas64/elf_gas64_curpos.hex \
+ modules/objfmts/elf/tests/gas64/elf_gas64_reloc.asm \
+ modules/objfmts/elf/tests/gas64/elf_gas64_reloc.hex \
+ modules/objfmts/elf/tests/gas64/elf_gas64_ssym.asm \
+ modules/objfmts/elf/tests/gas64/elf_gas64_ssym.hex \
+ modules/objfmts/coff/win64-nasm.mac \
+ modules/objfmts/coff/win64-gas.mac \
+ modules/objfmts/coff/tests/Makefile.inc \
+ modules/objfmts/coff/tests/coff_test.sh \
+ modules/objfmts/coff/tests/cofftest.c \
+ modules/objfmts/coff/tests/cofftest.asm \
+ modules/objfmts/coff/tests/cofftest.hex \
+ modules/objfmts/coff/tests/cofftimes.asm \
+ modules/objfmts/coff/tests/cofftimes.hex \
+ modules/objfmts/coff/tests/x86id.asm \
+ modules/objfmts/coff/tests/x86id.hex \
+ modules/objfmts/coff/tests/x86id.errwarn \
+ modules/objfmts/macho/tests/Makefile.inc \
+ modules/objfmts/macho/tests/gas32/Makefile.inc \
+ modules/objfmts/macho/tests/gas64/Makefile.inc \
+ modules/objfmts/macho/tests/nasm32/Makefile.inc \
+ modules/objfmts/macho/tests/nasm64/Makefile.inc \
+ modules/objfmts/macho/tests/gas32/gas_macho32_test.sh \
+ modules/objfmts/macho/tests/gas32/gas-macho32.asm \
+ modules/objfmts/macho/tests/gas32/gas-macho32.hex \
+ modules/objfmts/macho/tests/gas64/gas_macho64_test.sh \
+ modules/objfmts/macho/tests/gas64/gas-macho64.asm \
+ modules/objfmts/macho/tests/gas64/gas-macho64.hex \
+ modules/objfmts/macho/tests/gas64/gas-macho64-pic.asm \
+ modules/objfmts/macho/tests/gas64/gas-macho64-pic.hex \
+ modules/objfmts/macho/tests/nasm32/macho32_test.sh \
+ modules/objfmts/macho/tests/nasm32/machotest.c \
+ modules/objfmts/macho/tests/nasm32/machotest.asm \
+ modules/objfmts/macho/tests/nasm32/machotest.hex \
+ modules/objfmts/macho/tests/nasm32/macho-reloc.asm \
+ modules/objfmts/macho/tests/nasm32/macho-reloc.hex \
+ modules/objfmts/macho/tests/nasm32/macho32-sect.asm \
+ modules/objfmts/macho/tests/nasm32/macho32-sect.errwarn \
+ modules/objfmts/macho/tests/nasm32/macho32-sect.hex \
+ modules/objfmts/macho/tests/nasm64/nasm-macho64-pic.asm \
+ modules/objfmts/macho/tests/nasm64/nasm-macho64-pic.hex \
+ modules/objfmts/macho/tests/nasm64/macho64_test.sh \
+ modules/objfmts/macho/tests/nasm64/machotest64.c \
+ modules/objfmts/macho/tests/nasm64/machotest64.asm \
+ modules/objfmts/macho/tests/nasm64/machotest64.hex \
+ modules/objfmts/macho/tests/nasm64/macho-reloc64-err.asm \
+ modules/objfmts/macho/tests/nasm64/macho-reloc64-err.errwarn \
+ modules/objfmts/rdf/tests/Makefile.inc \
+ modules/objfmts/rdf/tests/rdf_test.sh \
+ modules/objfmts/rdf/tests/rdfabs.asm \
+ modules/objfmts/rdf/tests/rdfabs.errwarn \
+ modules/objfmts/rdf/tests/rdfabs.hex \
+ modules/objfmts/rdf/tests/rdfext.asm \
+ modules/objfmts/rdf/tests/rdfext.hex \
+ modules/objfmts/rdf/tests/rdfseg.asm \
+ modules/objfmts/rdf/tests/rdfseg.hex \
+ modules/objfmts/rdf/tests/rdfseg2.asm \
+ modules/objfmts/rdf/tests/rdfseg2.hex \
+ modules/objfmts/rdf/tests/rdftest1.asm \
+ modules/objfmts/rdf/tests/rdftest1.hex \
+ modules/objfmts/rdf/tests/rdftest2.asm \
+ modules/objfmts/rdf/tests/rdftest2.hex \
+ modules/objfmts/rdf/tests/rdtlib.asm \
+ modules/objfmts/rdf/tests/rdtlib.hex \
+ modules/objfmts/rdf/tests/rdtmain.asm \
+ modules/objfmts/rdf/tests/rdtmain.hex \
+ modules/objfmts/rdf/tests/testlib.asm \
+ modules/objfmts/rdf/tests/testlib.hex \
+ modules/objfmts/win32/tests/Makefile.inc \
+ modules/objfmts/win32/tests/export.asm \
+ modules/objfmts/win32/tests/export.hex \
+ modules/objfmts/win32/tests/win32_test.sh \
+ modules/objfmts/win32/tests/win32-curpos.asm \
+ modules/objfmts/win32/tests/win32-curpos.hex \
+ modules/objfmts/win32/tests/win32-overdef.asm \
+ modules/objfmts/win32/tests/win32-overdef.hex \
+ modules/objfmts/win32/tests/win32-safeseh.asm \
+ modules/objfmts/win32/tests/win32-safeseh.hex \
+ modules/objfmts/win32/tests/win32-safeseh.masm \
+ modules/objfmts/win32/tests/win32-segof.asm \
+ modules/objfmts/win32/tests/win32-segof.hex \
+ modules/objfmts/win32/tests/win32test.c \
+ modules/objfmts/win32/tests/win32test.asm \
+ modules/objfmts/win32/tests/win32test.hex \
+ modules/objfmts/win32/tests/gas/Makefile.inc \
+ modules/objfmts/win32/tests/gas/win32_gas_test.sh \
+ modules/objfmts/win32/tests/gas/win32at.asm \
+ modules/objfmts/win32/tests/gas/win32at.hex \
+ modules/objfmts/win64/tests/Makefile.inc \
+ modules/objfmts/win64/tests/win64_test.sh \
+ modules/objfmts/win64/tests/sce1.asm \
+ modules/objfmts/win64/tests/sce1.hex \
+ modules/objfmts/win64/tests/sce1-err.asm \
+ modules/objfmts/win64/tests/sce1-err.errwarn \
+ modules/objfmts/win64/tests/sce2.asm \
+ modules/objfmts/win64/tests/sce2.hex \
+ modules/objfmts/win64/tests/sce2-err.asm \
+ modules/objfmts/win64/tests/sce2-err.errwarn \
+ modules/objfmts/win64/tests/sce3.asm \
+ modules/objfmts/win64/tests/sce3.hex \
+ modules/objfmts/win64/tests/sce3.masm \
+ modules/objfmts/win64/tests/sce4.asm \
+ modules/objfmts/win64/tests/sce4.hex \
+ modules/objfmts/win64/tests/sce4.masm \
+ modules/objfmts/win64/tests/sce4-err.asm \
+ modules/objfmts/win64/tests/sce4-err.errwarn \
+ modules/objfmts/win64/tests/win64-abs.asm \
+ modules/objfmts/win64/tests/win64-abs.hex \
+ modules/objfmts/win64/tests/win64-curpos.asm \
+ modules/objfmts/win64/tests/win64-curpos.hex \
+ modules/objfmts/win64/tests/win64-dataref.asm \
+ modules/objfmts/win64/tests/win64-dataref.hex \
+ modules/objfmts/win64/tests/win64-dataref.masm \
+ modules/objfmts/win64/tests/win64-dataref2.asm \
+ modules/objfmts/win64/tests/win64-dataref2.hex \
+ modules/objfmts/win64/tests/win64-dataref2.masm \
+ modules/objfmts/win64/tests/gas/Makefile.inc \
+ modules/objfmts/win64/tests/gas/win64_gas_test.sh \
+ modules/objfmts/win64/tests/gas/win64-gas-sce.asm \
+ modules/objfmts/win64/tests/gas/win64-gas-sce.hex \
+ modules/objfmts/xdf/tests/Makefile.inc \
+ modules/objfmts/xdf/tests/xdf_test.sh \
+ modules/objfmts/xdf/tests/xdf-overdef.asm \
+ modules/objfmts/xdf/tests/xdf-overdef.hex \
+ modules/objfmts/xdf/tests/xdflong.asm \
+ modules/objfmts/xdf/tests/xdflong.hex \
+ modules/objfmts/xdf/tests/xdflong.errwarn \
+ modules/objfmts/xdf/tests/xdfother.asm \
+ modules/objfmts/xdf/tests/xdfother.hex \
+ modules/objfmts/xdf/tests/xdfprotect.asm \
+ modules/objfmts/xdf/tests/xdfprotect.hex \
+ modules/objfmts/xdf/tests/xdfsect.asm \
+ modules/objfmts/xdf/tests/xdfsect.hex \
+ modules/objfmts/xdf/tests/xdfsect-err.asm \
+ modules/objfmts/xdf/tests/xdfsect-err.errwarn \
+ modules/objfmts/xdf/tests/xdfvirtual.asm \
+ modules/objfmts/xdf/tests/xdfvirtual.hex \
+ modules/objfmts/yasm_objfmts.xml libyasm/genmodule.c \
+ libyasm/module.in libyasm/tests/Makefile.inc \
+ libyasm/tests/libyasm_test.sh libyasm/tests/1shl0.asm \
+ libyasm/tests/1shl0.hex libyasm/tests/absloop-err.asm \
+ libyasm/tests/absloop-err.errwarn \
+ libyasm/tests/charconst64.asm libyasm/tests/charconst64.hex \
+ libyasm/tests/data-rawvalue.asm \
+ libyasm/tests/data-rawvalue.hex libyasm/tests/duplabel-err.asm \
+ libyasm/tests/duplabel-err.errwarn libyasm/tests/emptydata.asm \
+ libyasm/tests/emptydata.hex libyasm/tests/equ-expand.asm \
+ libyasm/tests/equ-expand.hex libyasm/tests/expr-fold-level.asm \
+ libyasm/tests/expr-fold-level.hex \
+ libyasm/tests/expr-wide-ident.asm \
+ libyasm/tests/expr-wide-ident.hex libyasm/tests/externdef.asm \
+ libyasm/tests/externdef.errwarn libyasm/tests/externdef.hex \
+ libyasm/tests/incbin.asm libyasm/tests/incbin.hex \
+ libyasm/tests/jmpsize1.asm libyasm/tests/jmpsize1.hex \
+ libyasm/tests/jmpsize1-err.asm \
+ libyasm/tests/jmpsize1-err.errwarn \
+ libyasm/tests/opt-align1.asm libyasm/tests/opt-align1.hex \
+ libyasm/tests/opt-align2.asm libyasm/tests/opt-align2.hex \
+ libyasm/tests/opt-align3.asm libyasm/tests/opt-align3.hex \
+ libyasm/tests/opt-circular1-err.asm \
+ libyasm/tests/opt-circular1-err.errwarn \
+ libyasm/tests/opt-circular2-err.asm \
+ libyasm/tests/opt-circular2-err.errwarn \
+ libyasm/tests/opt-circular3-err.asm \
+ libyasm/tests/opt-circular3-err.errwarn \
+ libyasm/tests/opt-gvmat64.asm libyasm/tests/opt-gvmat64.hex \
+ libyasm/tests/opt-immexpand.asm \
+ libyasm/tests/opt-immexpand.hex \
+ libyasm/tests/opt-immnoexpand.asm \
+ libyasm/tests/opt-immnoexpand.hex \
+ libyasm/tests/opt-oldalign.asm libyasm/tests/opt-oldalign.hex \
+ libyasm/tests/opt-struc.asm libyasm/tests/opt-struc.hex \
+ libyasm/tests/reserve-err1.asm \
+ libyasm/tests/reserve-err1.errwarn \
+ libyasm/tests/reserve-err2.asm \
+ libyasm/tests/reserve-err2.errwarn libyasm/tests/strucsize.asm \
+ libyasm/tests/strucsize.hex libyasm/tests/times0.asm \
+ libyasm/tests/times0.hex libyasm/tests/timesover-err.asm \
+ libyasm/tests/timesover-err.errwarn \
+ libyasm/tests/timesunder.asm libyasm/tests/timesunder.hex \
+ libyasm/tests/times-res.asm libyasm/tests/times-res.errwarn \
+ libyasm/tests/times-res.hex libyasm/tests/unary.asm \
+ libyasm/tests/unary.hex libyasm/tests/value-err.asm \
+ libyasm/tests/value-err.errwarn \
+ libyasm/tests/value-samesym.asm \
+ libyasm/tests/value-samesym.errwarn \
+ libyasm/tests/value-samesym.hex libyasm/tests/value-mask.asm \
+ libyasm/tests/value-mask.errwarn libyasm/tests/value-mask.hex \
+ frontends/yasm/Makefile.inc frontends/tasm/Makefile.inc \
+ frontends/yasm/yasm.xml m4/intmax.m4 m4/longdouble.m4 \
+ m4/nls.m4 m4/po.m4 m4/printf-posix.m4 m4/signed.m4 \
+ m4/size_max.m4 m4/ulonglong.m4 m4/wchar_t.m4 m4/wint_t.m4 \
+ m4/xsize.m4 m4/codeset.m4 m4/gettext.m4 m4/glibc21.m4 \
+ m4/iconv.m4 m4/intdiv0.m4 m4/inttypes.m4 m4/inttypes_h.m4 \
+ m4/inttypes-pri.m4 m4/isc-posix.m4 m4/lcmessage.m4 \
+ m4/lib-ld.m4 m4/lib-link.m4 m4/lib-prefix.m4 m4/longlong.m4 \
+ m4/progtest.m4 m4/stdint_h.m4 m4/uintmax_t.m4 m4/pythonhead.m4 \
+ m4/pyrex.m4 out_test.sh Artistic.txt BSD.txt GNU_GPL-2.0 \
+ GNU_LGPL-2.0 splint.sh Mkfiles/Makefile.flat \
+ Mkfiles/Makefile.dj Mkfiles/dj/config.h \
+ Mkfiles/dj/libyasm-stdint.h \
+ Mkfiles/vc9/crt_secure_no_deprecate.vsprops \
+ Mkfiles/vc9/yasm.sln Mkfiles/vc9/yasm.vcproj \
+ Mkfiles/vc9/ytasm.vcproj Mkfiles/vc9/config.h \
+ Mkfiles/vc9/libyasm-stdint.h Mkfiles/vc9/readme.vc9.txt \
+ Mkfiles/vc9/yasm.rules Mkfiles/vc9/vc98_swap.py \
+ Mkfiles/vc9/genmacro/genmacro.vcproj \
+ Mkfiles/vc9/genmacro/run.bat \
+ Mkfiles/vc9/genmodule/genmodule.vcproj \
+ Mkfiles/vc9/genmodule/run.bat \
+ Mkfiles/vc9/genstring/genstring.vcproj \
+ Mkfiles/vc9/genstring/run.bat \
+ Mkfiles/vc9/genversion/genversion.vcproj \
+ Mkfiles/vc9/genversion/run.bat \
+ Mkfiles/vc9/libyasm/libyasm.vcproj \
+ Mkfiles/vc9/modules/modules.vcproj \
+ Mkfiles/vc9/re2c/re2c.vcproj Mkfiles/vc9/re2c/run.bat \
+ Mkfiles/vc9/genperf/genperf.vcproj Mkfiles/vc9/genperf/run.bat \
+ genstring.c
+
+# libyasm-stdint.h doesn't clean up after itself?
+CONFIG_CLEAN_FILES = libyasm-stdint.h
+re2c_SOURCES =
+re2c_LDADD = re2c-main.$(OBJEXT) re2c-code.$(OBJEXT) \
+ re2c-dfa.$(OBJEXT) re2c-parser.$(OBJEXT) \
+ re2c-actions.$(OBJEXT) re2c-scanner.$(OBJEXT) \
+ re2c-mbo_getopt.$(OBJEXT) re2c-substr.$(OBJEXT) \
+ re2c-translate.$(OBJEXT)
+re2c_LINK = $(CCLD_FOR_BUILD) -o $@
+genmacro_SOURCES =
+genmacro_LDADD = genmacro.$(OBJEXT)
+genmacro_LINK = $(CCLD_FOR_BUILD) -o $@
+genperf_SOURCES =
+genperf_LDADD = genperf.$(OBJEXT) gp-perfect.$(OBJEXT) \
+ gp-phash.$(OBJEXT) gp-xmalloc.$(OBJEXT) gp-xstrdup.$(OBJEXT)
+genperf_LINK = $(CCLD_FOR_BUILD) -o $@
+PYBINDING_DEPS = tools/python-yasm/bytecode.pxi \
+ tools/python-yasm/errwarn.pxi tools/python-yasm/expr.pxi \
+ tools/python-yasm/floatnum.pxi tools/python-yasm/intnum.pxi \
+ tools/python-yasm/symrec.pxi tools/python-yasm/value.pxi
+YASM_MODULES = arch_x86 arch_lc3b listfmt_nasm parser_gas parser_gnu \
+ parser_nasm parser_tasm preproc_nasm preproc_tasm preproc_raw \
+ preproc_cpp dbgfmt_cv8 dbgfmt_dwarf2 dbgfmt_null dbgfmt_stabs \
+ objfmt_dbg objfmt_bin objfmt_dosexe objfmt_elf objfmt_elf32 \
+ objfmt_elf64 objfmt_coff objfmt_macho objfmt_macho32 \
+ objfmt_macho64 objfmt_rdf objfmt_win32 objfmt_win64 objfmt_x64 \
+ objfmt_xdf
+lib_LIBRARIES = libyasm.a
+libyasm_a_SOURCES = modules/arch/x86/x86arch.c \
+ modules/arch/x86/x86arch.h modules/arch/x86/x86bc.c \
+ modules/arch/x86/x86expr.c modules/arch/x86/x86id.c \
+ modules/arch/lc3b/lc3barch.c modules/arch/lc3b/lc3barch.h \
+ modules/arch/lc3b/lc3bbc.c \
+ modules/listfmts/nasm/nasm-listfmt.c \
+ modules/parsers/gas/gas-parser.c \
+ modules/parsers/gas/gas-parser.h \
+ modules/parsers/gas/gas-parse.c \
+ modules/parsers/nasm/nasm-parser.c \
+ modules/parsers/nasm/nasm-parser.h \
+ modules/parsers/nasm/nasm-parse.c \
+ modules/preprocs/nasm/nasm-preproc.c \
+ modules/preprocs/nasm/nasm-pp.h \
+ modules/preprocs/nasm/nasm-pp.c modules/preprocs/nasm/nasm.h \
+ modules/preprocs/nasm/nasmlib.h \
+ modules/preprocs/nasm/nasmlib.c \
+ modules/preprocs/nasm/nasm-eval.h \
+ modules/preprocs/nasm/nasm-eval.c \
+ modules/preprocs/raw/raw-preproc.c \
+ modules/preprocs/cpp/cpp-preproc.c \
+ modules/dbgfmts/codeview/cv-dbgfmt.h \
+ modules/dbgfmts/codeview/cv-dbgfmt.c \
+ modules/dbgfmts/codeview/cv-symline.c \
+ modules/dbgfmts/codeview/cv-type.c \
+ modules/dbgfmts/dwarf2/dwarf2-dbgfmt.h \
+ modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c \
+ modules/dbgfmts/dwarf2/dwarf2-line.c \
+ modules/dbgfmts/dwarf2/dwarf2-aranges.c \
+ modules/dbgfmts/dwarf2/dwarf2-info.c \
+ modules/dbgfmts/null/null-dbgfmt.c \
+ modules/dbgfmts/stabs/stabs-dbgfmt.c \
+ modules/objfmts/dbg/dbg-objfmt.c \
+ modules/objfmts/bin/bin-objfmt.c modules/objfmts/elf/elf.c \
+ modules/objfmts/elf/elf.h modules/objfmts/elf/elf-objfmt.c \
+ modules/objfmts/elf/elf-machine.h \
+ modules/objfmts/elf/elf-x86-x86.c \
+ modules/objfmts/elf/elf-x86-amd64.c \
+ modules/objfmts/coff/coff-objfmt.c \
+ modules/objfmts/coff/coff-objfmt.h \
+ modules/objfmts/coff/win64-except.c \
+ modules/objfmts/macho/macho-objfmt.c \
+ modules/objfmts/rdf/rdf-objfmt.c \
+ modules/objfmts/xdf/xdf-objfmt.c libyasm/assocdat.c \
+ libyasm/bitvect.c libyasm/bc-align.c libyasm/bc-data.c \
+ libyasm/bc-incbin.c libyasm/bc-org.c libyasm/bc-reserve.c \
+ libyasm/bytecode.c libyasm/errwarn.c libyasm/expr.c \
+ libyasm/file.c libyasm/floatnum.c libyasm/hamt.c \
+ libyasm/insn.c libyasm/intnum.c libyasm/inttree.c \
+ libyasm/linemap.c libyasm/md5.c libyasm/mergesort.c \
+ libyasm/phash.c libyasm/section.c libyasm/strcasecmp.c \
+ libyasm/strsep.c libyasm/symrec.c libyasm/valparam.c \
+ libyasm/value.c libyasm/xmalloc.c libyasm/xstrdup.c
+nodist_libyasm_a_SOURCES = x86cpu.c x86regtmod.c lc3bid.c gas-token.c \
+ nasm-token.c module.c
+genversion_SOURCES =
+genversion_LDADD = genversion.$(OBJEXT)
+genversion_LINK = $(CCLD_FOR_BUILD) -o $@
+genmodule_SOURCES =
+genmodule_LDADD = genmodule.$(OBJEXT)
+genmodule_LINK = $(CCLD_FOR_BUILD) -o $@
+modincludedir = $(includedir)/libyasm
+modinclude_HEADERS = libyasm/arch.h libyasm/assocdat.h \
+ libyasm/bitvect.h libyasm/bytecode.h libyasm/compat-queue.h \
+ libyasm/coretype.h libyasm/dbgfmt.h libyasm/errwarn.h \
+ libyasm/expr.h libyasm/file.h libyasm/floatnum.h \
+ libyasm/hamt.h libyasm/insn.h libyasm/intnum.h \
+ libyasm/inttree.h libyasm/linemap.h libyasm/listfmt.h \
+ libyasm/md5.h libyasm/module.h libyasm/objfmt.h \
+ libyasm/parser.h libyasm/phash.h libyasm/preproc.h \
+ libyasm/section.h libyasm/symrec.h libyasm/valparam.h \
+ libyasm/value.h
+bitvect_test_SOURCES = libyasm/tests/bitvect_test.c
+bitvect_test_LDADD = libyasm.a $(INTLLIBS)
+floatnum_test_SOURCES = libyasm/tests/floatnum_test.c
+floatnum_test_LDADD = libyasm.a $(INTLLIBS)
+leb128_test_SOURCES = libyasm/tests/leb128_test.c
+leb128_test_LDADD = libyasm.a $(INTLLIBS)
+splitpath_test_SOURCES = libyasm/tests/splitpath_test.c
+splitpath_test_LDADD = libyasm.a $(INTLLIBS)
+combpath_test_SOURCES = libyasm/tests/combpath_test.c
+combpath_test_LDADD = libyasm.a $(INTLLIBS)
+uncstring_test_SOURCES = libyasm/tests/uncstring_test.c
+uncstring_test_LDADD = libyasm.a $(INTLLIBS)
+yasm_SOURCES = frontends/yasm/yasm.c frontends/yasm/yasm-options.c \
+ frontends/yasm/yasm-options.h
+yasm_LDADD = libyasm.a $(INTLLIBS)
+ytasm_SOURCES = frontends/tasm/tasm.c frontends/tasm/tasm-options.c \
+ frontends/tasm/tasm-options.h
+ytasm_LDADD = libyasm.a $(INTLLIBS)
+ACLOCAL_AMFLAGS = -I m4
+
+# genstring build
+genstring_SOURCES =
+genstring_LDADD = genstring.$(OBJEXT)
+genstring_LINK = $(CCLD_FOR_BUILD) -o $@
+all: $(BUILT_SOURCES) config.h
+ $(MAKE) $(AM_MAKEFLAGS) all-recursive
+
+.SUFFIXES:
+.SUFFIXES: .gperf .c .o .obj
+am--refresh:
+ @:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(srcdir)/tools/Makefile.inc $(srcdir)/tools/re2c/Makefile.inc $(srcdir)/tools/genmacro/Makefile.inc $(srcdir)/tools/genperf/Makefile.inc $(srcdir)/tools/python-yasm/Makefile.inc $(srcdir)/tools/python-yasm/tests/Makefile.inc $(srcdir)/modules/Makefile.inc $(srcdir)/modules/arch/Makefile.inc $(srcdir)/modules/arch/x86/Makefile.inc $(srcdir)/modules/arch/x86/tests/Makefile.inc $(srcdir)/modules/arch/x86/tests/gas32/Makefile.inc $(srcdir)/modules/arch/x86/tests/gas64/Makefile.inc $(srcdir)/modules/arch/lc3b/Makefile.inc $(srcdir)/modules/arch/lc3b/tests/Makefile.inc $(srcdir)/modules/listfmts/Makefile.inc $(srcdir)/modules/listfmts/nasm/Makefile.inc $(srcdir)/modules/parsers/Makefile.inc $(srcdir)/modules/parsers/gas/Makefile.inc $(srcdir)/modules/parsers/gas/tests/Makefile.inc $(srcdir)/modules/parsers/gas/tests/bin/Makefile.inc $(srcdir)/modules/parsers/nasm/Makefile.inc $(srcdir)/modules/parsers/nasm/tests/Makefile.inc $(srcdir)/modules/parsers/nasm/tests/worphan/Makefile.inc $(srcdir)/modules/parsers/tasm/Makefile.inc $(srcdir)/modules/parsers/tasm/tests/Makefile.inc $(srcdir)/modules/parsers/tasm/tests/exe/Makefile.inc $(srcdir)/modules/preprocs/Makefile.inc $(srcdir)/modules/preprocs/nasm/Makefile.inc $(srcdir)/modules/preprocs/nasm/tests/Makefile.inc $(srcdir)/modules/preprocs/raw/Makefile.inc $(srcdir)/modules/preprocs/raw/tests/Makefile.inc $(srcdir)/modules/preprocs/cpp/Makefile.inc $(srcdir)/modules/dbgfmts/Makefile.inc $(srcdir)/modules/dbgfmts/codeview/Makefile.inc $(srcdir)/modules/dbgfmts/dwarf2/Makefile.inc $(srcdir)/modules/dbgfmts/dwarf2/tests/Makefile.inc $(srcdir)/modules/dbgfmts/dwarf2/tests/pass32/Makefile.inc $(srcdir)/modules/dbgfmts/dwarf2/tests/pass64/Makefile.inc $(srcdir)/modules/dbgfmts/dwarf2/tests/passwin64/Makefile.inc $(srcdir)/modules/dbgfmts/null/Makefile.inc $(srcdir)/modules/dbgfmts/stabs/Makefile.inc $(srcdir)/modules/dbgfmts/stabs/tests/Makefile.inc $(srcdir)/modules/objfmts/Makefile.inc $(srcdir)/modules/objfmts/dbg/Makefile.inc $(srcdir)/modules/objfmts/bin/Makefile.inc $(srcdir)/modules/objfmts/bin/tests/Makefile.inc $(srcdir)/modules/objfmts/bin/tests/multisect/Makefile.inc $(srcdir)/modules/objfmts/elf/Makefile.inc $(srcdir)/modules/objfmts/elf/tests/Makefile.inc $(srcdir)/modules/objfmts/elf/tests/amd64/Makefile.inc $(srcdir)/modules/objfmts/elf/tests/gas32/Makefile.inc $(srcdir)/modules/objfmts/elf/tests/gas64/Makefile.inc $(srcdir)/modules/objfmts/coff/Makefile.inc $(srcdir)/modules/objfmts/coff/tests/Makefile.inc $(srcdir)/modules/objfmts/macho/Makefile.inc $(srcdir)/modules/objfmts/macho/tests/Makefile.inc $(srcdir)/modules/objfmts/macho/tests/gas32/Makefile.inc $(srcdir)/modules/objfmts/macho/tests/gas64/Makefile.inc $(srcdir)/modules/objfmts/macho/tests/nasm32/Makefile.inc $(srcdir)/modules/objfmts/macho/tests/nasm64/Makefile.inc $(srcdir)/modules/objfmts/rdf/Makefile.inc $(srcdir)/modules/objfmts/rdf/tests/Makefile.inc $(srcdir)/modules/objfmts/win32/Makefile.inc $(srcdir)/modules/objfmts/win32/tests/Makefile.inc $(srcdir)/modules/objfmts/win32/tests/gas/Makefile.inc $(srcdir)/modules/objfmts/win64/Makefile.inc $(srcdir)/modules/objfmts/win64/tests/Makefile.inc $(srcdir)/modules/objfmts/win64/tests/gas/Makefile.inc $(srcdir)/modules/objfmts/xdf/Makefile.inc $(srcdir)/modules/objfmts/xdf/tests/Makefile.inc $(srcdir)/libyasm/Makefile.inc $(srcdir)/libyasm/tests/Makefile.inc $(srcdir)/frontends/Makefile.inc $(srcdir)/frontends/yasm/Makefile.inc $(srcdir)/frontends/tasm/Makefile.inc $(srcdir)/m4/Makefile.inc $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \
+ cd $(srcdir) && $(AUTOMAKE) --gnu \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ echo ' $(SHELL) ./config.status'; \
+ $(SHELL) ./config.status;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ $(SHELL) ./config.status --recheck
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(srcdir) && $(AUTOCONF)
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+
+config.h: stamp-h1
+ @if test ! -f $@; then \
+ rm -f stamp-h1; \
+ $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \
+ else :; fi
+
+stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
+ @rm -f stamp-h1
+ cd $(top_builddir) && $(SHELL) ./config.status config.h
+$(srcdir)/config.h.in: $(am__configure_deps)
+ cd $(top_srcdir) && $(AUTOHEADER)
+ rm -f stamp-h1
+ touch $@
+
+distclean-hdr:
+ -rm -f config.h stamp-h1
+install-libLIBRARIES: $(lib_LIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
+ @list='$(lib_LIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f=$(am__strip_dir) \
+ echo " $(libLIBRARIES_INSTALL) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
+ $(libLIBRARIES_INSTALL) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
+ else :; fi; \
+ done
+ @$(POST_INSTALL)
+ @list='$(lib_LIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ p=$(am__strip_dir) \
+ echo " $(RANLIB) '$(DESTDIR)$(libdir)/$$p'"; \
+ $(RANLIB) "$(DESTDIR)$(libdir)/$$p"; \
+ else :; fi; \
+ done
+
+uninstall-libLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(lib_LIBRARIES)'; for p in $$list; do \
+ p=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(libdir)/$$p'"; \
+ rm -f "$(DESTDIR)$(libdir)/$$p"; \
+ done
+
+clean-libLIBRARIES:
+ -test -z "$(lib_LIBRARIES)" || rm -f $(lib_LIBRARIES)
+libyasm.a: $(libyasm_a_OBJECTS) $(libyasm_a_DEPENDENCIES)
+ -rm -f libyasm.a
+ $(libyasm_a_AR) libyasm.a $(libyasm_a_OBJECTS) $(libyasm_a_LIBADD)
+ $(RANLIB) libyasm.a
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+
+clean-checkPROGRAMS:
+ -test -z "$(check_PROGRAMS)" || rm -f $(check_PROGRAMS)
+
+clean-noinstPROGRAMS:
+ -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS)
+bitvect_test$(EXEEXT): $(bitvect_test_OBJECTS) $(bitvect_test_DEPENDENCIES)
+ @rm -f bitvect_test$(EXEEXT)
+ $(LINK) $(bitvect_test_OBJECTS) $(bitvect_test_LDADD) $(LIBS)
+combpath_test$(EXEEXT): $(combpath_test_OBJECTS) $(combpath_test_DEPENDENCIES)
+ @rm -f combpath_test$(EXEEXT)
+ $(LINK) $(combpath_test_OBJECTS) $(combpath_test_LDADD) $(LIBS)
+floatnum_test$(EXEEXT): $(floatnum_test_OBJECTS) $(floatnum_test_DEPENDENCIES)
+ @rm -f floatnum_test$(EXEEXT)
+ $(LINK) $(floatnum_test_OBJECTS) $(floatnum_test_LDADD) $(LIBS)
+genmacro$(EXEEXT): $(genmacro_OBJECTS) $(genmacro_DEPENDENCIES)
+ @rm -f genmacro$(EXEEXT)
+ $(genmacro_LINK) $(genmacro_OBJECTS) $(genmacro_LDADD) $(LIBS)
+genmodule$(EXEEXT): $(genmodule_OBJECTS) $(genmodule_DEPENDENCIES)
+ @rm -f genmodule$(EXEEXT)
+ $(genmodule_LINK) $(genmodule_OBJECTS) $(genmodule_LDADD) $(LIBS)
+genperf$(EXEEXT): $(genperf_OBJECTS) $(genperf_DEPENDENCIES)
+ @rm -f genperf$(EXEEXT)
+ $(genperf_LINK) $(genperf_OBJECTS) $(genperf_LDADD) $(LIBS)
+genstring$(EXEEXT): $(genstring_OBJECTS) $(genstring_DEPENDENCIES)
+ @rm -f genstring$(EXEEXT)
+ $(genstring_LINK) $(genstring_OBJECTS) $(genstring_LDADD) $(LIBS)
+genversion$(EXEEXT): $(genversion_OBJECTS) $(genversion_DEPENDENCIES)
+ @rm -f genversion$(EXEEXT)
+ $(genversion_LINK) $(genversion_OBJECTS) $(genversion_LDADD) $(LIBS)
+leb128_test$(EXEEXT): $(leb128_test_OBJECTS) $(leb128_test_DEPENDENCIES)
+ @rm -f leb128_test$(EXEEXT)
+ $(LINK) $(leb128_test_OBJECTS) $(leb128_test_LDADD) $(LIBS)
+re2c$(EXEEXT): $(re2c_OBJECTS) $(re2c_DEPENDENCIES)
+ @rm -f re2c$(EXEEXT)
+ $(re2c_LINK) $(re2c_OBJECTS) $(re2c_LDADD) $(LIBS)
+splitpath_test$(EXEEXT): $(splitpath_test_OBJECTS) $(splitpath_test_DEPENDENCIES)
+ @rm -f splitpath_test$(EXEEXT)
+ $(LINK) $(splitpath_test_OBJECTS) $(splitpath_test_LDADD) $(LIBS)
+test_hd$(EXEEXT): $(test_hd_OBJECTS) $(test_hd_DEPENDENCIES)
+ @rm -f test_hd$(EXEEXT)
+ $(LINK) $(test_hd_OBJECTS) $(test_hd_LDADD) $(LIBS)
+uncstring_test$(EXEEXT): $(uncstring_test_OBJECTS) $(uncstring_test_DEPENDENCIES)
+ @rm -f uncstring_test$(EXEEXT)
+ $(LINK) $(uncstring_test_OBJECTS) $(uncstring_test_LDADD) $(LIBS)
+yasm$(EXEEXT): $(yasm_OBJECTS) $(yasm_DEPENDENCIES)
+ @rm -f yasm$(EXEEXT)
+ $(LINK) $(yasm_OBJECTS) $(yasm_LDADD) $(LIBS)
+ytasm$(EXEEXT): $(ytasm_OBJECTS) $(ytasm_DEPENDENCIES)
+ @rm -f ytasm$(EXEEXT)
+ $(LINK) $(ytasm_OBJECTS) $(ytasm_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+include ./$(DEPDIR)/assocdat.Po
+include ./$(DEPDIR)/bc-align.Po
+include ./$(DEPDIR)/bc-data.Po
+include ./$(DEPDIR)/bc-incbin.Po
+include ./$(DEPDIR)/bc-org.Po
+include ./$(DEPDIR)/bc-reserve.Po
+include ./$(DEPDIR)/bin-objfmt.Po
+include ./$(DEPDIR)/bitvect.Po
+include ./$(DEPDIR)/bitvect_test.Po
+include ./$(DEPDIR)/bytecode.Po
+include ./$(DEPDIR)/coff-objfmt.Po
+include ./$(DEPDIR)/combpath_test.Po
+include ./$(DEPDIR)/cpp-preproc.Po
+include ./$(DEPDIR)/cv-dbgfmt.Po
+include ./$(DEPDIR)/cv-symline.Po
+include ./$(DEPDIR)/cv-type.Po
+include ./$(DEPDIR)/dbg-objfmt.Po
+include ./$(DEPDIR)/dwarf2-aranges.Po
+include ./$(DEPDIR)/dwarf2-dbgfmt.Po
+include ./$(DEPDIR)/dwarf2-info.Po
+include ./$(DEPDIR)/dwarf2-line.Po
+include ./$(DEPDIR)/elf-objfmt.Po
+include ./$(DEPDIR)/elf-x86-amd64.Po
+include ./$(DEPDIR)/elf-x86-x86.Po
+include ./$(DEPDIR)/elf.Po
+include ./$(DEPDIR)/errwarn.Po
+include ./$(DEPDIR)/expr.Po
+include ./$(DEPDIR)/file.Po
+include ./$(DEPDIR)/floatnum.Po
+include ./$(DEPDIR)/floatnum_test.Po
+include ./$(DEPDIR)/gas-parse.Po
+include ./$(DEPDIR)/gas-parser.Po
+include ./$(DEPDIR)/gas-token.Po
+include ./$(DEPDIR)/hamt.Po
+include ./$(DEPDIR)/insn.Po
+include ./$(DEPDIR)/intnum.Po
+include ./$(DEPDIR)/inttree.Po
+include ./$(DEPDIR)/lc3barch.Po
+include ./$(DEPDIR)/lc3bbc.Po
+include ./$(DEPDIR)/lc3bid.Po
+include ./$(DEPDIR)/leb128_test.Po
+include ./$(DEPDIR)/linemap.Po
+include ./$(DEPDIR)/macho-objfmt.Po
+include ./$(DEPDIR)/md5.Po
+include ./$(DEPDIR)/mergesort.Po
+include ./$(DEPDIR)/module.Po
+include ./$(DEPDIR)/nasm-eval.Po
+include ./$(DEPDIR)/nasm-listfmt.Po
+include ./$(DEPDIR)/nasm-parse.Po
+include ./$(DEPDIR)/nasm-parser.Po
+include ./$(DEPDIR)/nasm-pp.Po
+include ./$(DEPDIR)/nasm-preproc.Po
+include ./$(DEPDIR)/nasm-token.Po
+include ./$(DEPDIR)/nasmlib.Po
+include ./$(DEPDIR)/null-dbgfmt.Po
+include ./$(DEPDIR)/phash.Po
+include ./$(DEPDIR)/raw-preproc.Po
+include ./$(DEPDIR)/rdf-objfmt.Po
+include ./$(DEPDIR)/section.Po
+include ./$(DEPDIR)/splitpath_test.Po
+include ./$(DEPDIR)/stabs-dbgfmt.Po
+include ./$(DEPDIR)/strcasecmp.Po
+include ./$(DEPDIR)/strsep.Po
+include ./$(DEPDIR)/symrec.Po
+include ./$(DEPDIR)/tasm-options.Po
+include ./$(DEPDIR)/tasm.Po
+include ./$(DEPDIR)/test_hd.Po
+include ./$(DEPDIR)/uncstring_test.Po
+include ./$(DEPDIR)/valparam.Po
+include ./$(DEPDIR)/value.Po
+include ./$(DEPDIR)/win64-except.Po
+include ./$(DEPDIR)/x86arch.Po
+include ./$(DEPDIR)/x86bc.Po
+include ./$(DEPDIR)/x86cpu.Po
+include ./$(DEPDIR)/x86expr.Po
+include ./$(DEPDIR)/x86id.Po
+include ./$(DEPDIR)/x86regtmod.Po
+include ./$(DEPDIR)/xdf-objfmt.Po
+include ./$(DEPDIR)/xmalloc.Po
+include ./$(DEPDIR)/xstrdup.Po
+include ./$(DEPDIR)/yasm-options.Po
+include ./$(DEPDIR)/yasm.Po
+
+.c.o:
+ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+# source='$<' object='$@' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(COMPILE) -c $<
+
+.c.obj:
+ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+# source='$<' object='$@' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+x86arch.o: modules/arch/x86/x86arch.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT x86arch.o -MD -MP -MF $(DEPDIR)/x86arch.Tpo -c -o x86arch.o `test -f 'modules/arch/x86/x86arch.c' || echo '$(srcdir)/'`modules/arch/x86/x86arch.c
+ mv -f $(DEPDIR)/x86arch.Tpo $(DEPDIR)/x86arch.Po
+# source='modules/arch/x86/x86arch.c' object='x86arch.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o x86arch.o `test -f 'modules/arch/x86/x86arch.c' || echo '$(srcdir)/'`modules/arch/x86/x86arch.c
+
+x86arch.obj: modules/arch/x86/x86arch.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT x86arch.obj -MD -MP -MF $(DEPDIR)/x86arch.Tpo -c -o x86arch.obj `if test -f 'modules/arch/x86/x86arch.c'; then $(CYGPATH_W) 'modules/arch/x86/x86arch.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/x86/x86arch.c'; fi`
+ mv -f $(DEPDIR)/x86arch.Tpo $(DEPDIR)/x86arch.Po
+# source='modules/arch/x86/x86arch.c' object='x86arch.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o x86arch.obj `if test -f 'modules/arch/x86/x86arch.c'; then $(CYGPATH_W) 'modules/arch/x86/x86arch.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/x86/x86arch.c'; fi`
+
+x86bc.o: modules/arch/x86/x86bc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT x86bc.o -MD -MP -MF $(DEPDIR)/x86bc.Tpo -c -o x86bc.o `test -f 'modules/arch/x86/x86bc.c' || echo '$(srcdir)/'`modules/arch/x86/x86bc.c
+ mv -f $(DEPDIR)/x86bc.Tpo $(DEPDIR)/x86bc.Po
+# source='modules/arch/x86/x86bc.c' object='x86bc.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o x86bc.o `test -f 'modules/arch/x86/x86bc.c' || echo '$(srcdir)/'`modules/arch/x86/x86bc.c
+
+x86bc.obj: modules/arch/x86/x86bc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT x86bc.obj -MD -MP -MF $(DEPDIR)/x86bc.Tpo -c -o x86bc.obj `if test -f 'modules/arch/x86/x86bc.c'; then $(CYGPATH_W) 'modules/arch/x86/x86bc.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/x86/x86bc.c'; fi`
+ mv -f $(DEPDIR)/x86bc.Tpo $(DEPDIR)/x86bc.Po
+# source='modules/arch/x86/x86bc.c' object='x86bc.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o x86bc.obj `if test -f 'modules/arch/x86/x86bc.c'; then $(CYGPATH_W) 'modules/arch/x86/x86bc.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/x86/x86bc.c'; fi`
+
+x86expr.o: modules/arch/x86/x86expr.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT x86expr.o -MD -MP -MF $(DEPDIR)/x86expr.Tpo -c -o x86expr.o `test -f 'modules/arch/x86/x86expr.c' || echo '$(srcdir)/'`modules/arch/x86/x86expr.c
+ mv -f $(DEPDIR)/x86expr.Tpo $(DEPDIR)/x86expr.Po
+# source='modules/arch/x86/x86expr.c' object='x86expr.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o x86expr.o `test -f 'modules/arch/x86/x86expr.c' || echo '$(srcdir)/'`modules/arch/x86/x86expr.c
+
+x86expr.obj: modules/arch/x86/x86expr.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT x86expr.obj -MD -MP -MF $(DEPDIR)/x86expr.Tpo -c -o x86expr.obj `if test -f 'modules/arch/x86/x86expr.c'; then $(CYGPATH_W) 'modules/arch/x86/x86expr.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/x86/x86expr.c'; fi`
+ mv -f $(DEPDIR)/x86expr.Tpo $(DEPDIR)/x86expr.Po
+# source='modules/arch/x86/x86expr.c' object='x86expr.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o x86expr.obj `if test -f 'modules/arch/x86/x86expr.c'; then $(CYGPATH_W) 'modules/arch/x86/x86expr.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/x86/x86expr.c'; fi`
+
+x86id.o: modules/arch/x86/x86id.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT x86id.o -MD -MP -MF $(DEPDIR)/x86id.Tpo -c -o x86id.o `test -f 'modules/arch/x86/x86id.c' || echo '$(srcdir)/'`modules/arch/x86/x86id.c
+ mv -f $(DEPDIR)/x86id.Tpo $(DEPDIR)/x86id.Po
+# source='modules/arch/x86/x86id.c' object='x86id.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o x86id.o `test -f 'modules/arch/x86/x86id.c' || echo '$(srcdir)/'`modules/arch/x86/x86id.c
+
+x86id.obj: modules/arch/x86/x86id.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT x86id.obj -MD -MP -MF $(DEPDIR)/x86id.Tpo -c -o x86id.obj `if test -f 'modules/arch/x86/x86id.c'; then $(CYGPATH_W) 'modules/arch/x86/x86id.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/x86/x86id.c'; fi`
+ mv -f $(DEPDIR)/x86id.Tpo $(DEPDIR)/x86id.Po
+# source='modules/arch/x86/x86id.c' object='x86id.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o x86id.obj `if test -f 'modules/arch/x86/x86id.c'; then $(CYGPATH_W) 'modules/arch/x86/x86id.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/x86/x86id.c'; fi`
+
+lc3barch.o: modules/arch/lc3b/lc3barch.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lc3barch.o -MD -MP -MF $(DEPDIR)/lc3barch.Tpo -c -o lc3barch.o `test -f 'modules/arch/lc3b/lc3barch.c' || echo '$(srcdir)/'`modules/arch/lc3b/lc3barch.c
+ mv -f $(DEPDIR)/lc3barch.Tpo $(DEPDIR)/lc3barch.Po
+# source='modules/arch/lc3b/lc3barch.c' object='lc3barch.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lc3barch.o `test -f 'modules/arch/lc3b/lc3barch.c' || echo '$(srcdir)/'`modules/arch/lc3b/lc3barch.c
+
+lc3barch.obj: modules/arch/lc3b/lc3barch.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lc3barch.obj -MD -MP -MF $(DEPDIR)/lc3barch.Tpo -c -o lc3barch.obj `if test -f 'modules/arch/lc3b/lc3barch.c'; then $(CYGPATH_W) 'modules/arch/lc3b/lc3barch.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/lc3b/lc3barch.c'; fi`
+ mv -f $(DEPDIR)/lc3barch.Tpo $(DEPDIR)/lc3barch.Po
+# source='modules/arch/lc3b/lc3barch.c' object='lc3barch.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lc3barch.obj `if test -f 'modules/arch/lc3b/lc3barch.c'; then $(CYGPATH_W) 'modules/arch/lc3b/lc3barch.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/lc3b/lc3barch.c'; fi`
+
+lc3bbc.o: modules/arch/lc3b/lc3bbc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lc3bbc.o -MD -MP -MF $(DEPDIR)/lc3bbc.Tpo -c -o lc3bbc.o `test -f 'modules/arch/lc3b/lc3bbc.c' || echo '$(srcdir)/'`modules/arch/lc3b/lc3bbc.c
+ mv -f $(DEPDIR)/lc3bbc.Tpo $(DEPDIR)/lc3bbc.Po
+# source='modules/arch/lc3b/lc3bbc.c' object='lc3bbc.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lc3bbc.o `test -f 'modules/arch/lc3b/lc3bbc.c' || echo '$(srcdir)/'`modules/arch/lc3b/lc3bbc.c
+
+lc3bbc.obj: modules/arch/lc3b/lc3bbc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lc3bbc.obj -MD -MP -MF $(DEPDIR)/lc3bbc.Tpo -c -o lc3bbc.obj `if test -f 'modules/arch/lc3b/lc3bbc.c'; then $(CYGPATH_W) 'modules/arch/lc3b/lc3bbc.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/lc3b/lc3bbc.c'; fi`
+ mv -f $(DEPDIR)/lc3bbc.Tpo $(DEPDIR)/lc3bbc.Po
+# source='modules/arch/lc3b/lc3bbc.c' object='lc3bbc.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lc3bbc.obj `if test -f 'modules/arch/lc3b/lc3bbc.c'; then $(CYGPATH_W) 'modules/arch/lc3b/lc3bbc.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/lc3b/lc3bbc.c'; fi`
+
+nasm-listfmt.o: modules/listfmts/nasm/nasm-listfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-listfmt.o -MD -MP -MF $(DEPDIR)/nasm-listfmt.Tpo -c -o nasm-listfmt.o `test -f 'modules/listfmts/nasm/nasm-listfmt.c' || echo '$(srcdir)/'`modules/listfmts/nasm/nasm-listfmt.c
+ mv -f $(DEPDIR)/nasm-listfmt.Tpo $(DEPDIR)/nasm-listfmt.Po
+# source='modules/listfmts/nasm/nasm-listfmt.c' object='nasm-listfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-listfmt.o `test -f 'modules/listfmts/nasm/nasm-listfmt.c' || echo '$(srcdir)/'`modules/listfmts/nasm/nasm-listfmt.c
+
+nasm-listfmt.obj: modules/listfmts/nasm/nasm-listfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-listfmt.obj -MD -MP -MF $(DEPDIR)/nasm-listfmt.Tpo -c -o nasm-listfmt.obj `if test -f 'modules/listfmts/nasm/nasm-listfmt.c'; then $(CYGPATH_W) 'modules/listfmts/nasm/nasm-listfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/listfmts/nasm/nasm-listfmt.c'; fi`
+ mv -f $(DEPDIR)/nasm-listfmt.Tpo $(DEPDIR)/nasm-listfmt.Po
+# source='modules/listfmts/nasm/nasm-listfmt.c' object='nasm-listfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-listfmt.obj `if test -f 'modules/listfmts/nasm/nasm-listfmt.c'; then $(CYGPATH_W) 'modules/listfmts/nasm/nasm-listfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/listfmts/nasm/nasm-listfmt.c'; fi`
+
+gas-parser.o: modules/parsers/gas/gas-parser.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gas-parser.o -MD -MP -MF $(DEPDIR)/gas-parser.Tpo -c -o gas-parser.o `test -f 'modules/parsers/gas/gas-parser.c' || echo '$(srcdir)/'`modules/parsers/gas/gas-parser.c
+ mv -f $(DEPDIR)/gas-parser.Tpo $(DEPDIR)/gas-parser.Po
+# source='modules/parsers/gas/gas-parser.c' object='gas-parser.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gas-parser.o `test -f 'modules/parsers/gas/gas-parser.c' || echo '$(srcdir)/'`modules/parsers/gas/gas-parser.c
+
+gas-parser.obj: modules/parsers/gas/gas-parser.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gas-parser.obj -MD -MP -MF $(DEPDIR)/gas-parser.Tpo -c -o gas-parser.obj `if test -f 'modules/parsers/gas/gas-parser.c'; then $(CYGPATH_W) 'modules/parsers/gas/gas-parser.c'; else $(CYGPATH_W) '$(srcdir)/modules/parsers/gas/gas-parser.c'; fi`
+ mv -f $(DEPDIR)/gas-parser.Tpo $(DEPDIR)/gas-parser.Po
+# source='modules/parsers/gas/gas-parser.c' object='gas-parser.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gas-parser.obj `if test -f 'modules/parsers/gas/gas-parser.c'; then $(CYGPATH_W) 'modules/parsers/gas/gas-parser.c'; else $(CYGPATH_W) '$(srcdir)/modules/parsers/gas/gas-parser.c'; fi`
+
+gas-parse.o: modules/parsers/gas/gas-parse.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gas-parse.o -MD -MP -MF $(DEPDIR)/gas-parse.Tpo -c -o gas-parse.o `test -f 'modules/parsers/gas/gas-parse.c' || echo '$(srcdir)/'`modules/parsers/gas/gas-parse.c
+ mv -f $(DEPDIR)/gas-parse.Tpo $(DEPDIR)/gas-parse.Po
+# source='modules/parsers/gas/gas-parse.c' object='gas-parse.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gas-parse.o `test -f 'modules/parsers/gas/gas-parse.c' || echo '$(srcdir)/'`modules/parsers/gas/gas-parse.c
+
+gas-parse.obj: modules/parsers/gas/gas-parse.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gas-parse.obj -MD -MP -MF $(DEPDIR)/gas-parse.Tpo -c -o gas-parse.obj `if test -f 'modules/parsers/gas/gas-parse.c'; then $(CYGPATH_W) 'modules/parsers/gas/gas-parse.c'; else $(CYGPATH_W) '$(srcdir)/modules/parsers/gas/gas-parse.c'; fi`
+ mv -f $(DEPDIR)/gas-parse.Tpo $(DEPDIR)/gas-parse.Po
+# source='modules/parsers/gas/gas-parse.c' object='gas-parse.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gas-parse.obj `if test -f 'modules/parsers/gas/gas-parse.c'; then $(CYGPATH_W) 'modules/parsers/gas/gas-parse.c'; else $(CYGPATH_W) '$(srcdir)/modules/parsers/gas/gas-parse.c'; fi`
+
+nasm-parser.o: modules/parsers/nasm/nasm-parser.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-parser.o -MD -MP -MF $(DEPDIR)/nasm-parser.Tpo -c -o nasm-parser.o `test -f 'modules/parsers/nasm/nasm-parser.c' || echo '$(srcdir)/'`modules/parsers/nasm/nasm-parser.c
+ mv -f $(DEPDIR)/nasm-parser.Tpo $(DEPDIR)/nasm-parser.Po
+# source='modules/parsers/nasm/nasm-parser.c' object='nasm-parser.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-parser.o `test -f 'modules/parsers/nasm/nasm-parser.c' || echo '$(srcdir)/'`modules/parsers/nasm/nasm-parser.c
+
+nasm-parser.obj: modules/parsers/nasm/nasm-parser.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-parser.obj -MD -MP -MF $(DEPDIR)/nasm-parser.Tpo -c -o nasm-parser.obj `if test -f 'modules/parsers/nasm/nasm-parser.c'; then $(CYGPATH_W) 'modules/parsers/nasm/nasm-parser.c'; else $(CYGPATH_W) '$(srcdir)/modules/parsers/nasm/nasm-parser.c'; fi`
+ mv -f $(DEPDIR)/nasm-parser.Tpo $(DEPDIR)/nasm-parser.Po
+# source='modules/parsers/nasm/nasm-parser.c' object='nasm-parser.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-parser.obj `if test -f 'modules/parsers/nasm/nasm-parser.c'; then $(CYGPATH_W) 'modules/parsers/nasm/nasm-parser.c'; else $(CYGPATH_W) '$(srcdir)/modules/parsers/nasm/nasm-parser.c'; fi`
+
+nasm-parse.o: modules/parsers/nasm/nasm-parse.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-parse.o -MD -MP -MF $(DEPDIR)/nasm-parse.Tpo -c -o nasm-parse.o `test -f 'modules/parsers/nasm/nasm-parse.c' || echo '$(srcdir)/'`modules/parsers/nasm/nasm-parse.c
+ mv -f $(DEPDIR)/nasm-parse.Tpo $(DEPDIR)/nasm-parse.Po
+# source='modules/parsers/nasm/nasm-parse.c' object='nasm-parse.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-parse.o `test -f 'modules/parsers/nasm/nasm-parse.c' || echo '$(srcdir)/'`modules/parsers/nasm/nasm-parse.c
+
+nasm-parse.obj: modules/parsers/nasm/nasm-parse.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-parse.obj -MD -MP -MF $(DEPDIR)/nasm-parse.Tpo -c -o nasm-parse.obj `if test -f 'modules/parsers/nasm/nasm-parse.c'; then $(CYGPATH_W) 'modules/parsers/nasm/nasm-parse.c'; else $(CYGPATH_W) '$(srcdir)/modules/parsers/nasm/nasm-parse.c'; fi`
+ mv -f $(DEPDIR)/nasm-parse.Tpo $(DEPDIR)/nasm-parse.Po
+# source='modules/parsers/nasm/nasm-parse.c' object='nasm-parse.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-parse.obj `if test -f 'modules/parsers/nasm/nasm-parse.c'; then $(CYGPATH_W) 'modules/parsers/nasm/nasm-parse.c'; else $(CYGPATH_W) '$(srcdir)/modules/parsers/nasm/nasm-parse.c'; fi`
+
+nasm-preproc.o: modules/preprocs/nasm/nasm-preproc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-preproc.o -MD -MP -MF $(DEPDIR)/nasm-preproc.Tpo -c -o nasm-preproc.o `test -f 'modules/preprocs/nasm/nasm-preproc.c' || echo '$(srcdir)/'`modules/preprocs/nasm/nasm-preproc.c
+ mv -f $(DEPDIR)/nasm-preproc.Tpo $(DEPDIR)/nasm-preproc.Po
+# source='modules/preprocs/nasm/nasm-preproc.c' object='nasm-preproc.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-preproc.o `test -f 'modules/preprocs/nasm/nasm-preproc.c' || echo '$(srcdir)/'`modules/preprocs/nasm/nasm-preproc.c
+
+nasm-preproc.obj: modules/preprocs/nasm/nasm-preproc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-preproc.obj -MD -MP -MF $(DEPDIR)/nasm-preproc.Tpo -c -o nasm-preproc.obj `if test -f 'modules/preprocs/nasm/nasm-preproc.c'; then $(CYGPATH_W) 'modules/preprocs/nasm/nasm-preproc.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/nasm/nasm-preproc.c'; fi`
+ mv -f $(DEPDIR)/nasm-preproc.Tpo $(DEPDIR)/nasm-preproc.Po
+# source='modules/preprocs/nasm/nasm-preproc.c' object='nasm-preproc.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-preproc.obj `if test -f 'modules/preprocs/nasm/nasm-preproc.c'; then $(CYGPATH_W) 'modules/preprocs/nasm/nasm-preproc.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/nasm/nasm-preproc.c'; fi`
+
+nasm-pp.o: modules/preprocs/nasm/nasm-pp.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-pp.o -MD -MP -MF $(DEPDIR)/nasm-pp.Tpo -c -o nasm-pp.o `test -f 'modules/preprocs/nasm/nasm-pp.c' || echo '$(srcdir)/'`modules/preprocs/nasm/nasm-pp.c
+ mv -f $(DEPDIR)/nasm-pp.Tpo $(DEPDIR)/nasm-pp.Po
+# source='modules/preprocs/nasm/nasm-pp.c' object='nasm-pp.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-pp.o `test -f 'modules/preprocs/nasm/nasm-pp.c' || echo '$(srcdir)/'`modules/preprocs/nasm/nasm-pp.c
+
+nasm-pp.obj: modules/preprocs/nasm/nasm-pp.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-pp.obj -MD -MP -MF $(DEPDIR)/nasm-pp.Tpo -c -o nasm-pp.obj `if test -f 'modules/preprocs/nasm/nasm-pp.c'; then $(CYGPATH_W) 'modules/preprocs/nasm/nasm-pp.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/nasm/nasm-pp.c'; fi`
+ mv -f $(DEPDIR)/nasm-pp.Tpo $(DEPDIR)/nasm-pp.Po
+# source='modules/preprocs/nasm/nasm-pp.c' object='nasm-pp.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-pp.obj `if test -f 'modules/preprocs/nasm/nasm-pp.c'; then $(CYGPATH_W) 'modules/preprocs/nasm/nasm-pp.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/nasm/nasm-pp.c'; fi`
+
+nasmlib.o: modules/preprocs/nasm/nasmlib.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasmlib.o -MD -MP -MF $(DEPDIR)/nasmlib.Tpo -c -o nasmlib.o `test -f 'modules/preprocs/nasm/nasmlib.c' || echo '$(srcdir)/'`modules/preprocs/nasm/nasmlib.c
+ mv -f $(DEPDIR)/nasmlib.Tpo $(DEPDIR)/nasmlib.Po
+# source='modules/preprocs/nasm/nasmlib.c' object='nasmlib.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasmlib.o `test -f 'modules/preprocs/nasm/nasmlib.c' || echo '$(srcdir)/'`modules/preprocs/nasm/nasmlib.c
+
+nasmlib.obj: modules/preprocs/nasm/nasmlib.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasmlib.obj -MD -MP -MF $(DEPDIR)/nasmlib.Tpo -c -o nasmlib.obj `if test -f 'modules/preprocs/nasm/nasmlib.c'; then $(CYGPATH_W) 'modules/preprocs/nasm/nasmlib.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/nasm/nasmlib.c'; fi`
+ mv -f $(DEPDIR)/nasmlib.Tpo $(DEPDIR)/nasmlib.Po
+# source='modules/preprocs/nasm/nasmlib.c' object='nasmlib.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasmlib.obj `if test -f 'modules/preprocs/nasm/nasmlib.c'; then $(CYGPATH_W) 'modules/preprocs/nasm/nasmlib.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/nasm/nasmlib.c'; fi`
+
+nasm-eval.o: modules/preprocs/nasm/nasm-eval.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-eval.o -MD -MP -MF $(DEPDIR)/nasm-eval.Tpo -c -o nasm-eval.o `test -f 'modules/preprocs/nasm/nasm-eval.c' || echo '$(srcdir)/'`modules/preprocs/nasm/nasm-eval.c
+ mv -f $(DEPDIR)/nasm-eval.Tpo $(DEPDIR)/nasm-eval.Po
+# source='modules/preprocs/nasm/nasm-eval.c' object='nasm-eval.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-eval.o `test -f 'modules/preprocs/nasm/nasm-eval.c' || echo '$(srcdir)/'`modules/preprocs/nasm/nasm-eval.c
+
+nasm-eval.obj: modules/preprocs/nasm/nasm-eval.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-eval.obj -MD -MP -MF $(DEPDIR)/nasm-eval.Tpo -c -o nasm-eval.obj `if test -f 'modules/preprocs/nasm/nasm-eval.c'; then $(CYGPATH_W) 'modules/preprocs/nasm/nasm-eval.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/nasm/nasm-eval.c'; fi`
+ mv -f $(DEPDIR)/nasm-eval.Tpo $(DEPDIR)/nasm-eval.Po
+# source='modules/preprocs/nasm/nasm-eval.c' object='nasm-eval.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-eval.obj `if test -f 'modules/preprocs/nasm/nasm-eval.c'; then $(CYGPATH_W) 'modules/preprocs/nasm/nasm-eval.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/nasm/nasm-eval.c'; fi`
+
+raw-preproc.o: modules/preprocs/raw/raw-preproc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT raw-preproc.o -MD -MP -MF $(DEPDIR)/raw-preproc.Tpo -c -o raw-preproc.o `test -f 'modules/preprocs/raw/raw-preproc.c' || echo '$(srcdir)/'`modules/preprocs/raw/raw-preproc.c
+ mv -f $(DEPDIR)/raw-preproc.Tpo $(DEPDIR)/raw-preproc.Po
+# source='modules/preprocs/raw/raw-preproc.c' object='raw-preproc.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o raw-preproc.o `test -f 'modules/preprocs/raw/raw-preproc.c' || echo '$(srcdir)/'`modules/preprocs/raw/raw-preproc.c
+
+raw-preproc.obj: modules/preprocs/raw/raw-preproc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT raw-preproc.obj -MD -MP -MF $(DEPDIR)/raw-preproc.Tpo -c -o raw-preproc.obj `if test -f 'modules/preprocs/raw/raw-preproc.c'; then $(CYGPATH_W) 'modules/preprocs/raw/raw-preproc.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/raw/raw-preproc.c'; fi`
+ mv -f $(DEPDIR)/raw-preproc.Tpo $(DEPDIR)/raw-preproc.Po
+# source='modules/preprocs/raw/raw-preproc.c' object='raw-preproc.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o raw-preproc.obj `if test -f 'modules/preprocs/raw/raw-preproc.c'; then $(CYGPATH_W) 'modules/preprocs/raw/raw-preproc.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/raw/raw-preproc.c'; fi`
+
+cpp-preproc.o: modules/preprocs/cpp/cpp-preproc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpp-preproc.o -MD -MP -MF $(DEPDIR)/cpp-preproc.Tpo -c -o cpp-preproc.o `test -f 'modules/preprocs/cpp/cpp-preproc.c' || echo '$(srcdir)/'`modules/preprocs/cpp/cpp-preproc.c
+ mv -f $(DEPDIR)/cpp-preproc.Tpo $(DEPDIR)/cpp-preproc.Po
+# source='modules/preprocs/cpp/cpp-preproc.c' object='cpp-preproc.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpp-preproc.o `test -f 'modules/preprocs/cpp/cpp-preproc.c' || echo '$(srcdir)/'`modules/preprocs/cpp/cpp-preproc.c
+
+cpp-preproc.obj: modules/preprocs/cpp/cpp-preproc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpp-preproc.obj -MD -MP -MF $(DEPDIR)/cpp-preproc.Tpo -c -o cpp-preproc.obj `if test -f 'modules/preprocs/cpp/cpp-preproc.c'; then $(CYGPATH_W) 'modules/preprocs/cpp/cpp-preproc.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/cpp/cpp-preproc.c'; fi`
+ mv -f $(DEPDIR)/cpp-preproc.Tpo $(DEPDIR)/cpp-preproc.Po
+# source='modules/preprocs/cpp/cpp-preproc.c' object='cpp-preproc.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpp-preproc.obj `if test -f 'modules/preprocs/cpp/cpp-preproc.c'; then $(CYGPATH_W) 'modules/preprocs/cpp/cpp-preproc.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/cpp/cpp-preproc.c'; fi`
+
+cv-dbgfmt.o: modules/dbgfmts/codeview/cv-dbgfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cv-dbgfmt.o -MD -MP -MF $(DEPDIR)/cv-dbgfmt.Tpo -c -o cv-dbgfmt.o `test -f 'modules/dbgfmts/codeview/cv-dbgfmt.c' || echo '$(srcdir)/'`modules/dbgfmts/codeview/cv-dbgfmt.c
+ mv -f $(DEPDIR)/cv-dbgfmt.Tpo $(DEPDIR)/cv-dbgfmt.Po
+# source='modules/dbgfmts/codeview/cv-dbgfmt.c' object='cv-dbgfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cv-dbgfmt.o `test -f 'modules/dbgfmts/codeview/cv-dbgfmt.c' || echo '$(srcdir)/'`modules/dbgfmts/codeview/cv-dbgfmt.c
+
+cv-dbgfmt.obj: modules/dbgfmts/codeview/cv-dbgfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cv-dbgfmt.obj -MD -MP -MF $(DEPDIR)/cv-dbgfmt.Tpo -c -o cv-dbgfmt.obj `if test -f 'modules/dbgfmts/codeview/cv-dbgfmt.c'; then $(CYGPATH_W) 'modules/dbgfmts/codeview/cv-dbgfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/codeview/cv-dbgfmt.c'; fi`
+ mv -f $(DEPDIR)/cv-dbgfmt.Tpo $(DEPDIR)/cv-dbgfmt.Po
+# source='modules/dbgfmts/codeview/cv-dbgfmt.c' object='cv-dbgfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cv-dbgfmt.obj `if test -f 'modules/dbgfmts/codeview/cv-dbgfmt.c'; then $(CYGPATH_W) 'modules/dbgfmts/codeview/cv-dbgfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/codeview/cv-dbgfmt.c'; fi`
+
+cv-symline.o: modules/dbgfmts/codeview/cv-symline.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cv-symline.o -MD -MP -MF $(DEPDIR)/cv-symline.Tpo -c -o cv-symline.o `test -f 'modules/dbgfmts/codeview/cv-symline.c' || echo '$(srcdir)/'`modules/dbgfmts/codeview/cv-symline.c
+ mv -f $(DEPDIR)/cv-symline.Tpo $(DEPDIR)/cv-symline.Po
+# source='modules/dbgfmts/codeview/cv-symline.c' object='cv-symline.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cv-symline.o `test -f 'modules/dbgfmts/codeview/cv-symline.c' || echo '$(srcdir)/'`modules/dbgfmts/codeview/cv-symline.c
+
+cv-symline.obj: modules/dbgfmts/codeview/cv-symline.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cv-symline.obj -MD -MP -MF $(DEPDIR)/cv-symline.Tpo -c -o cv-symline.obj `if test -f 'modules/dbgfmts/codeview/cv-symline.c'; then $(CYGPATH_W) 'modules/dbgfmts/codeview/cv-symline.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/codeview/cv-symline.c'; fi`
+ mv -f $(DEPDIR)/cv-symline.Tpo $(DEPDIR)/cv-symline.Po
+# source='modules/dbgfmts/codeview/cv-symline.c' object='cv-symline.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cv-symline.obj `if test -f 'modules/dbgfmts/codeview/cv-symline.c'; then $(CYGPATH_W) 'modules/dbgfmts/codeview/cv-symline.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/codeview/cv-symline.c'; fi`
+
+cv-type.o: modules/dbgfmts/codeview/cv-type.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cv-type.o -MD -MP -MF $(DEPDIR)/cv-type.Tpo -c -o cv-type.o `test -f 'modules/dbgfmts/codeview/cv-type.c' || echo '$(srcdir)/'`modules/dbgfmts/codeview/cv-type.c
+ mv -f $(DEPDIR)/cv-type.Tpo $(DEPDIR)/cv-type.Po
+# source='modules/dbgfmts/codeview/cv-type.c' object='cv-type.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cv-type.o `test -f 'modules/dbgfmts/codeview/cv-type.c' || echo '$(srcdir)/'`modules/dbgfmts/codeview/cv-type.c
+
+cv-type.obj: modules/dbgfmts/codeview/cv-type.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cv-type.obj -MD -MP -MF $(DEPDIR)/cv-type.Tpo -c -o cv-type.obj `if test -f 'modules/dbgfmts/codeview/cv-type.c'; then $(CYGPATH_W) 'modules/dbgfmts/codeview/cv-type.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/codeview/cv-type.c'; fi`
+ mv -f $(DEPDIR)/cv-type.Tpo $(DEPDIR)/cv-type.Po
+# source='modules/dbgfmts/codeview/cv-type.c' object='cv-type.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cv-type.obj `if test -f 'modules/dbgfmts/codeview/cv-type.c'; then $(CYGPATH_W) 'modules/dbgfmts/codeview/cv-type.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/codeview/cv-type.c'; fi`
+
+dwarf2-dbgfmt.o: modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dwarf2-dbgfmt.o -MD -MP -MF $(DEPDIR)/dwarf2-dbgfmt.Tpo -c -o dwarf2-dbgfmt.o `test -f 'modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c' || echo '$(srcdir)/'`modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c
+ mv -f $(DEPDIR)/dwarf2-dbgfmt.Tpo $(DEPDIR)/dwarf2-dbgfmt.Po
+# source='modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c' object='dwarf2-dbgfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dwarf2-dbgfmt.o `test -f 'modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c' || echo '$(srcdir)/'`modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c
+
+dwarf2-dbgfmt.obj: modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dwarf2-dbgfmt.obj -MD -MP -MF $(DEPDIR)/dwarf2-dbgfmt.Tpo -c -o dwarf2-dbgfmt.obj `if test -f 'modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c'; then $(CYGPATH_W) 'modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c'; fi`
+ mv -f $(DEPDIR)/dwarf2-dbgfmt.Tpo $(DEPDIR)/dwarf2-dbgfmt.Po
+# source='modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c' object='dwarf2-dbgfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dwarf2-dbgfmt.obj `if test -f 'modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c'; then $(CYGPATH_W) 'modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c'; fi`
+
+dwarf2-line.o: modules/dbgfmts/dwarf2/dwarf2-line.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dwarf2-line.o -MD -MP -MF $(DEPDIR)/dwarf2-line.Tpo -c -o dwarf2-line.o `test -f 'modules/dbgfmts/dwarf2/dwarf2-line.c' || echo '$(srcdir)/'`modules/dbgfmts/dwarf2/dwarf2-line.c
+ mv -f $(DEPDIR)/dwarf2-line.Tpo $(DEPDIR)/dwarf2-line.Po
+# source='modules/dbgfmts/dwarf2/dwarf2-line.c' object='dwarf2-line.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dwarf2-line.o `test -f 'modules/dbgfmts/dwarf2/dwarf2-line.c' || echo '$(srcdir)/'`modules/dbgfmts/dwarf2/dwarf2-line.c
+
+dwarf2-line.obj: modules/dbgfmts/dwarf2/dwarf2-line.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dwarf2-line.obj -MD -MP -MF $(DEPDIR)/dwarf2-line.Tpo -c -o dwarf2-line.obj `if test -f 'modules/dbgfmts/dwarf2/dwarf2-line.c'; then $(CYGPATH_W) 'modules/dbgfmts/dwarf2/dwarf2-line.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/dwarf2/dwarf2-line.c'; fi`
+ mv -f $(DEPDIR)/dwarf2-line.Tpo $(DEPDIR)/dwarf2-line.Po
+# source='modules/dbgfmts/dwarf2/dwarf2-line.c' object='dwarf2-line.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dwarf2-line.obj `if test -f 'modules/dbgfmts/dwarf2/dwarf2-line.c'; then $(CYGPATH_W) 'modules/dbgfmts/dwarf2/dwarf2-line.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/dwarf2/dwarf2-line.c'; fi`
+
+dwarf2-aranges.o: modules/dbgfmts/dwarf2/dwarf2-aranges.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dwarf2-aranges.o -MD -MP -MF $(DEPDIR)/dwarf2-aranges.Tpo -c -o dwarf2-aranges.o `test -f 'modules/dbgfmts/dwarf2/dwarf2-aranges.c' || echo '$(srcdir)/'`modules/dbgfmts/dwarf2/dwarf2-aranges.c
+ mv -f $(DEPDIR)/dwarf2-aranges.Tpo $(DEPDIR)/dwarf2-aranges.Po
+# source='modules/dbgfmts/dwarf2/dwarf2-aranges.c' object='dwarf2-aranges.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dwarf2-aranges.o `test -f 'modules/dbgfmts/dwarf2/dwarf2-aranges.c' || echo '$(srcdir)/'`modules/dbgfmts/dwarf2/dwarf2-aranges.c
+
+dwarf2-aranges.obj: modules/dbgfmts/dwarf2/dwarf2-aranges.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dwarf2-aranges.obj -MD -MP -MF $(DEPDIR)/dwarf2-aranges.Tpo -c -o dwarf2-aranges.obj `if test -f 'modules/dbgfmts/dwarf2/dwarf2-aranges.c'; then $(CYGPATH_W) 'modules/dbgfmts/dwarf2/dwarf2-aranges.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/dwarf2/dwarf2-aranges.c'; fi`
+ mv -f $(DEPDIR)/dwarf2-aranges.Tpo $(DEPDIR)/dwarf2-aranges.Po
+# source='modules/dbgfmts/dwarf2/dwarf2-aranges.c' object='dwarf2-aranges.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dwarf2-aranges.obj `if test -f 'modules/dbgfmts/dwarf2/dwarf2-aranges.c'; then $(CYGPATH_W) 'modules/dbgfmts/dwarf2/dwarf2-aranges.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/dwarf2/dwarf2-aranges.c'; fi`
+
+dwarf2-info.o: modules/dbgfmts/dwarf2/dwarf2-info.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dwarf2-info.o -MD -MP -MF $(DEPDIR)/dwarf2-info.Tpo -c -o dwarf2-info.o `test -f 'modules/dbgfmts/dwarf2/dwarf2-info.c' || echo '$(srcdir)/'`modules/dbgfmts/dwarf2/dwarf2-info.c
+ mv -f $(DEPDIR)/dwarf2-info.Tpo $(DEPDIR)/dwarf2-info.Po
+# source='modules/dbgfmts/dwarf2/dwarf2-info.c' object='dwarf2-info.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dwarf2-info.o `test -f 'modules/dbgfmts/dwarf2/dwarf2-info.c' || echo '$(srcdir)/'`modules/dbgfmts/dwarf2/dwarf2-info.c
+
+dwarf2-info.obj: modules/dbgfmts/dwarf2/dwarf2-info.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dwarf2-info.obj -MD -MP -MF $(DEPDIR)/dwarf2-info.Tpo -c -o dwarf2-info.obj `if test -f 'modules/dbgfmts/dwarf2/dwarf2-info.c'; then $(CYGPATH_W) 'modules/dbgfmts/dwarf2/dwarf2-info.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/dwarf2/dwarf2-info.c'; fi`
+ mv -f $(DEPDIR)/dwarf2-info.Tpo $(DEPDIR)/dwarf2-info.Po
+# source='modules/dbgfmts/dwarf2/dwarf2-info.c' object='dwarf2-info.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dwarf2-info.obj `if test -f 'modules/dbgfmts/dwarf2/dwarf2-info.c'; then $(CYGPATH_W) 'modules/dbgfmts/dwarf2/dwarf2-info.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/dwarf2/dwarf2-info.c'; fi`
+
+null-dbgfmt.o: modules/dbgfmts/null/null-dbgfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT null-dbgfmt.o -MD -MP -MF $(DEPDIR)/null-dbgfmt.Tpo -c -o null-dbgfmt.o `test -f 'modules/dbgfmts/null/null-dbgfmt.c' || echo '$(srcdir)/'`modules/dbgfmts/null/null-dbgfmt.c
+ mv -f $(DEPDIR)/null-dbgfmt.Tpo $(DEPDIR)/null-dbgfmt.Po
+# source='modules/dbgfmts/null/null-dbgfmt.c' object='null-dbgfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o null-dbgfmt.o `test -f 'modules/dbgfmts/null/null-dbgfmt.c' || echo '$(srcdir)/'`modules/dbgfmts/null/null-dbgfmt.c
+
+null-dbgfmt.obj: modules/dbgfmts/null/null-dbgfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT null-dbgfmt.obj -MD -MP -MF $(DEPDIR)/null-dbgfmt.Tpo -c -o null-dbgfmt.obj `if test -f 'modules/dbgfmts/null/null-dbgfmt.c'; then $(CYGPATH_W) 'modules/dbgfmts/null/null-dbgfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/null/null-dbgfmt.c'; fi`
+ mv -f $(DEPDIR)/null-dbgfmt.Tpo $(DEPDIR)/null-dbgfmt.Po
+# source='modules/dbgfmts/null/null-dbgfmt.c' object='null-dbgfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o null-dbgfmt.obj `if test -f 'modules/dbgfmts/null/null-dbgfmt.c'; then $(CYGPATH_W) 'modules/dbgfmts/null/null-dbgfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/null/null-dbgfmt.c'; fi`
+
+stabs-dbgfmt.o: modules/dbgfmts/stabs/stabs-dbgfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT stabs-dbgfmt.o -MD -MP -MF $(DEPDIR)/stabs-dbgfmt.Tpo -c -o stabs-dbgfmt.o `test -f 'modules/dbgfmts/stabs/stabs-dbgfmt.c' || echo '$(srcdir)/'`modules/dbgfmts/stabs/stabs-dbgfmt.c
+ mv -f $(DEPDIR)/stabs-dbgfmt.Tpo $(DEPDIR)/stabs-dbgfmt.Po
+# source='modules/dbgfmts/stabs/stabs-dbgfmt.c' object='stabs-dbgfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o stabs-dbgfmt.o `test -f 'modules/dbgfmts/stabs/stabs-dbgfmt.c' || echo '$(srcdir)/'`modules/dbgfmts/stabs/stabs-dbgfmt.c
+
+stabs-dbgfmt.obj: modules/dbgfmts/stabs/stabs-dbgfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT stabs-dbgfmt.obj -MD -MP -MF $(DEPDIR)/stabs-dbgfmt.Tpo -c -o stabs-dbgfmt.obj `if test -f 'modules/dbgfmts/stabs/stabs-dbgfmt.c'; then $(CYGPATH_W) 'modules/dbgfmts/stabs/stabs-dbgfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/stabs/stabs-dbgfmt.c'; fi`
+ mv -f $(DEPDIR)/stabs-dbgfmt.Tpo $(DEPDIR)/stabs-dbgfmt.Po
+# source='modules/dbgfmts/stabs/stabs-dbgfmt.c' object='stabs-dbgfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o stabs-dbgfmt.obj `if test -f 'modules/dbgfmts/stabs/stabs-dbgfmt.c'; then $(CYGPATH_W) 'modules/dbgfmts/stabs/stabs-dbgfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/stabs/stabs-dbgfmt.c'; fi`
+
+dbg-objfmt.o: modules/objfmts/dbg/dbg-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dbg-objfmt.o -MD -MP -MF $(DEPDIR)/dbg-objfmt.Tpo -c -o dbg-objfmt.o `test -f 'modules/objfmts/dbg/dbg-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/dbg/dbg-objfmt.c
+ mv -f $(DEPDIR)/dbg-objfmt.Tpo $(DEPDIR)/dbg-objfmt.Po
+# source='modules/objfmts/dbg/dbg-objfmt.c' object='dbg-objfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dbg-objfmt.o `test -f 'modules/objfmts/dbg/dbg-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/dbg/dbg-objfmt.c
+
+dbg-objfmt.obj: modules/objfmts/dbg/dbg-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dbg-objfmt.obj -MD -MP -MF $(DEPDIR)/dbg-objfmt.Tpo -c -o dbg-objfmt.obj `if test -f 'modules/objfmts/dbg/dbg-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/dbg/dbg-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/dbg/dbg-objfmt.c'; fi`
+ mv -f $(DEPDIR)/dbg-objfmt.Tpo $(DEPDIR)/dbg-objfmt.Po
+# source='modules/objfmts/dbg/dbg-objfmt.c' object='dbg-objfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dbg-objfmt.obj `if test -f 'modules/objfmts/dbg/dbg-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/dbg/dbg-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/dbg/dbg-objfmt.c'; fi`
+
+bin-objfmt.o: modules/objfmts/bin/bin-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bin-objfmt.o -MD -MP -MF $(DEPDIR)/bin-objfmt.Tpo -c -o bin-objfmt.o `test -f 'modules/objfmts/bin/bin-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/bin/bin-objfmt.c
+ mv -f $(DEPDIR)/bin-objfmt.Tpo $(DEPDIR)/bin-objfmt.Po
+# source='modules/objfmts/bin/bin-objfmt.c' object='bin-objfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bin-objfmt.o `test -f 'modules/objfmts/bin/bin-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/bin/bin-objfmt.c
+
+bin-objfmt.obj: modules/objfmts/bin/bin-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bin-objfmt.obj -MD -MP -MF $(DEPDIR)/bin-objfmt.Tpo -c -o bin-objfmt.obj `if test -f 'modules/objfmts/bin/bin-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/bin/bin-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/bin/bin-objfmt.c'; fi`
+ mv -f $(DEPDIR)/bin-objfmt.Tpo $(DEPDIR)/bin-objfmt.Po
+# source='modules/objfmts/bin/bin-objfmt.c' object='bin-objfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bin-objfmt.obj `if test -f 'modules/objfmts/bin/bin-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/bin/bin-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/bin/bin-objfmt.c'; fi`
+
+elf.o: modules/objfmts/elf/elf.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT elf.o -MD -MP -MF $(DEPDIR)/elf.Tpo -c -o elf.o `test -f 'modules/objfmts/elf/elf.c' || echo '$(srcdir)/'`modules/objfmts/elf/elf.c
+ mv -f $(DEPDIR)/elf.Tpo $(DEPDIR)/elf.Po
+# source='modules/objfmts/elf/elf.c' object='elf.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o elf.o `test -f 'modules/objfmts/elf/elf.c' || echo '$(srcdir)/'`modules/objfmts/elf/elf.c
+
+elf.obj: modules/objfmts/elf/elf.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT elf.obj -MD -MP -MF $(DEPDIR)/elf.Tpo -c -o elf.obj `if test -f 'modules/objfmts/elf/elf.c'; then $(CYGPATH_W) 'modules/objfmts/elf/elf.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/elf/elf.c'; fi`
+ mv -f $(DEPDIR)/elf.Tpo $(DEPDIR)/elf.Po
+# source='modules/objfmts/elf/elf.c' object='elf.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o elf.obj `if test -f 'modules/objfmts/elf/elf.c'; then $(CYGPATH_W) 'modules/objfmts/elf/elf.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/elf/elf.c'; fi`
+
+elf-objfmt.o: modules/objfmts/elf/elf-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT elf-objfmt.o -MD -MP -MF $(DEPDIR)/elf-objfmt.Tpo -c -o elf-objfmt.o `test -f 'modules/objfmts/elf/elf-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/elf/elf-objfmt.c
+ mv -f $(DEPDIR)/elf-objfmt.Tpo $(DEPDIR)/elf-objfmt.Po
+# source='modules/objfmts/elf/elf-objfmt.c' object='elf-objfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o elf-objfmt.o `test -f 'modules/objfmts/elf/elf-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/elf/elf-objfmt.c
+
+elf-objfmt.obj: modules/objfmts/elf/elf-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT elf-objfmt.obj -MD -MP -MF $(DEPDIR)/elf-objfmt.Tpo -c -o elf-objfmt.obj `if test -f 'modules/objfmts/elf/elf-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/elf/elf-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/elf/elf-objfmt.c'; fi`
+ mv -f $(DEPDIR)/elf-objfmt.Tpo $(DEPDIR)/elf-objfmt.Po
+# source='modules/objfmts/elf/elf-objfmt.c' object='elf-objfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o elf-objfmt.obj `if test -f 'modules/objfmts/elf/elf-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/elf/elf-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/elf/elf-objfmt.c'; fi`
+
+elf-x86-x86.o: modules/objfmts/elf/elf-x86-x86.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT elf-x86-x86.o -MD -MP -MF $(DEPDIR)/elf-x86-x86.Tpo -c -o elf-x86-x86.o `test -f 'modules/objfmts/elf/elf-x86-x86.c' || echo '$(srcdir)/'`modules/objfmts/elf/elf-x86-x86.c
+ mv -f $(DEPDIR)/elf-x86-x86.Tpo $(DEPDIR)/elf-x86-x86.Po
+# source='modules/objfmts/elf/elf-x86-x86.c' object='elf-x86-x86.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o elf-x86-x86.o `test -f 'modules/objfmts/elf/elf-x86-x86.c' || echo '$(srcdir)/'`modules/objfmts/elf/elf-x86-x86.c
+
+elf-x86-x86.obj: modules/objfmts/elf/elf-x86-x86.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT elf-x86-x86.obj -MD -MP -MF $(DEPDIR)/elf-x86-x86.Tpo -c -o elf-x86-x86.obj `if test -f 'modules/objfmts/elf/elf-x86-x86.c'; then $(CYGPATH_W) 'modules/objfmts/elf/elf-x86-x86.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/elf/elf-x86-x86.c'; fi`
+ mv -f $(DEPDIR)/elf-x86-x86.Tpo $(DEPDIR)/elf-x86-x86.Po
+# source='modules/objfmts/elf/elf-x86-x86.c' object='elf-x86-x86.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o elf-x86-x86.obj `if test -f 'modules/objfmts/elf/elf-x86-x86.c'; then $(CYGPATH_W) 'modules/objfmts/elf/elf-x86-x86.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/elf/elf-x86-x86.c'; fi`
+
+elf-x86-amd64.o: modules/objfmts/elf/elf-x86-amd64.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT elf-x86-amd64.o -MD -MP -MF $(DEPDIR)/elf-x86-amd64.Tpo -c -o elf-x86-amd64.o `test -f 'modules/objfmts/elf/elf-x86-amd64.c' || echo '$(srcdir)/'`modules/objfmts/elf/elf-x86-amd64.c
+ mv -f $(DEPDIR)/elf-x86-amd64.Tpo $(DEPDIR)/elf-x86-amd64.Po
+# source='modules/objfmts/elf/elf-x86-amd64.c' object='elf-x86-amd64.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o elf-x86-amd64.o `test -f 'modules/objfmts/elf/elf-x86-amd64.c' || echo '$(srcdir)/'`modules/objfmts/elf/elf-x86-amd64.c
+
+elf-x86-amd64.obj: modules/objfmts/elf/elf-x86-amd64.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT elf-x86-amd64.obj -MD -MP -MF $(DEPDIR)/elf-x86-amd64.Tpo -c -o elf-x86-amd64.obj `if test -f 'modules/objfmts/elf/elf-x86-amd64.c'; then $(CYGPATH_W) 'modules/objfmts/elf/elf-x86-amd64.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/elf/elf-x86-amd64.c'; fi`
+ mv -f $(DEPDIR)/elf-x86-amd64.Tpo $(DEPDIR)/elf-x86-amd64.Po
+# source='modules/objfmts/elf/elf-x86-amd64.c' object='elf-x86-amd64.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o elf-x86-amd64.obj `if test -f 'modules/objfmts/elf/elf-x86-amd64.c'; then $(CYGPATH_W) 'modules/objfmts/elf/elf-x86-amd64.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/elf/elf-x86-amd64.c'; fi`
+
+coff-objfmt.o: modules/objfmts/coff/coff-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT coff-objfmt.o -MD -MP -MF $(DEPDIR)/coff-objfmt.Tpo -c -o coff-objfmt.o `test -f 'modules/objfmts/coff/coff-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/coff/coff-objfmt.c
+ mv -f $(DEPDIR)/coff-objfmt.Tpo $(DEPDIR)/coff-objfmt.Po
+# source='modules/objfmts/coff/coff-objfmt.c' object='coff-objfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o coff-objfmt.o `test -f 'modules/objfmts/coff/coff-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/coff/coff-objfmt.c
+
+coff-objfmt.obj: modules/objfmts/coff/coff-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT coff-objfmt.obj -MD -MP -MF $(DEPDIR)/coff-objfmt.Tpo -c -o coff-objfmt.obj `if test -f 'modules/objfmts/coff/coff-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/coff/coff-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/coff/coff-objfmt.c'; fi`
+ mv -f $(DEPDIR)/coff-objfmt.Tpo $(DEPDIR)/coff-objfmt.Po
+# source='modules/objfmts/coff/coff-objfmt.c' object='coff-objfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o coff-objfmt.obj `if test -f 'modules/objfmts/coff/coff-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/coff/coff-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/coff/coff-objfmt.c'; fi`
+
+win64-except.o: modules/objfmts/coff/win64-except.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT win64-except.o -MD -MP -MF $(DEPDIR)/win64-except.Tpo -c -o win64-except.o `test -f 'modules/objfmts/coff/win64-except.c' || echo '$(srcdir)/'`modules/objfmts/coff/win64-except.c
+ mv -f $(DEPDIR)/win64-except.Tpo $(DEPDIR)/win64-except.Po
+# source='modules/objfmts/coff/win64-except.c' object='win64-except.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o win64-except.o `test -f 'modules/objfmts/coff/win64-except.c' || echo '$(srcdir)/'`modules/objfmts/coff/win64-except.c
+
+win64-except.obj: modules/objfmts/coff/win64-except.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT win64-except.obj -MD -MP -MF $(DEPDIR)/win64-except.Tpo -c -o win64-except.obj `if test -f 'modules/objfmts/coff/win64-except.c'; then $(CYGPATH_W) 'modules/objfmts/coff/win64-except.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/coff/win64-except.c'; fi`
+ mv -f $(DEPDIR)/win64-except.Tpo $(DEPDIR)/win64-except.Po
+# source='modules/objfmts/coff/win64-except.c' object='win64-except.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o win64-except.obj `if test -f 'modules/objfmts/coff/win64-except.c'; then $(CYGPATH_W) 'modules/objfmts/coff/win64-except.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/coff/win64-except.c'; fi`
+
+macho-objfmt.o: modules/objfmts/macho/macho-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT macho-objfmt.o -MD -MP -MF $(DEPDIR)/macho-objfmt.Tpo -c -o macho-objfmt.o `test -f 'modules/objfmts/macho/macho-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/macho/macho-objfmt.c
+ mv -f $(DEPDIR)/macho-objfmt.Tpo $(DEPDIR)/macho-objfmt.Po
+# source='modules/objfmts/macho/macho-objfmt.c' object='macho-objfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o macho-objfmt.o `test -f 'modules/objfmts/macho/macho-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/macho/macho-objfmt.c
+
+macho-objfmt.obj: modules/objfmts/macho/macho-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT macho-objfmt.obj -MD -MP -MF $(DEPDIR)/macho-objfmt.Tpo -c -o macho-objfmt.obj `if test -f 'modules/objfmts/macho/macho-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/macho/macho-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/macho/macho-objfmt.c'; fi`
+ mv -f $(DEPDIR)/macho-objfmt.Tpo $(DEPDIR)/macho-objfmt.Po
+# source='modules/objfmts/macho/macho-objfmt.c' object='macho-objfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o macho-objfmt.obj `if test -f 'modules/objfmts/macho/macho-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/macho/macho-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/macho/macho-objfmt.c'; fi`
+
+rdf-objfmt.o: modules/objfmts/rdf/rdf-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rdf-objfmt.o -MD -MP -MF $(DEPDIR)/rdf-objfmt.Tpo -c -o rdf-objfmt.o `test -f 'modules/objfmts/rdf/rdf-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/rdf/rdf-objfmt.c
+ mv -f $(DEPDIR)/rdf-objfmt.Tpo $(DEPDIR)/rdf-objfmt.Po
+# source='modules/objfmts/rdf/rdf-objfmt.c' object='rdf-objfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rdf-objfmt.o `test -f 'modules/objfmts/rdf/rdf-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/rdf/rdf-objfmt.c
+
+rdf-objfmt.obj: modules/objfmts/rdf/rdf-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rdf-objfmt.obj -MD -MP -MF $(DEPDIR)/rdf-objfmt.Tpo -c -o rdf-objfmt.obj `if test -f 'modules/objfmts/rdf/rdf-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/rdf/rdf-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/rdf/rdf-objfmt.c'; fi`
+ mv -f $(DEPDIR)/rdf-objfmt.Tpo $(DEPDIR)/rdf-objfmt.Po
+# source='modules/objfmts/rdf/rdf-objfmt.c' object='rdf-objfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rdf-objfmt.obj `if test -f 'modules/objfmts/rdf/rdf-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/rdf/rdf-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/rdf/rdf-objfmt.c'; fi`
+
+xdf-objfmt.o: modules/objfmts/xdf/xdf-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xdf-objfmt.o -MD -MP -MF $(DEPDIR)/xdf-objfmt.Tpo -c -o xdf-objfmt.o `test -f 'modules/objfmts/xdf/xdf-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/xdf/xdf-objfmt.c
+ mv -f $(DEPDIR)/xdf-objfmt.Tpo $(DEPDIR)/xdf-objfmt.Po
+# source='modules/objfmts/xdf/xdf-objfmt.c' object='xdf-objfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xdf-objfmt.o `test -f 'modules/objfmts/xdf/xdf-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/xdf/xdf-objfmt.c
+
+xdf-objfmt.obj: modules/objfmts/xdf/xdf-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xdf-objfmt.obj -MD -MP -MF $(DEPDIR)/xdf-objfmt.Tpo -c -o xdf-objfmt.obj `if test -f 'modules/objfmts/xdf/xdf-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/xdf/xdf-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/xdf/xdf-objfmt.c'; fi`
+ mv -f $(DEPDIR)/xdf-objfmt.Tpo $(DEPDIR)/xdf-objfmt.Po
+# source='modules/objfmts/xdf/xdf-objfmt.c' object='xdf-objfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xdf-objfmt.obj `if test -f 'modules/objfmts/xdf/xdf-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/xdf/xdf-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/xdf/xdf-objfmt.c'; fi`
+
+assocdat.o: libyasm/assocdat.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT assocdat.o -MD -MP -MF $(DEPDIR)/assocdat.Tpo -c -o assocdat.o `test -f 'libyasm/assocdat.c' || echo '$(srcdir)/'`libyasm/assocdat.c
+ mv -f $(DEPDIR)/assocdat.Tpo $(DEPDIR)/assocdat.Po
+# source='libyasm/assocdat.c' object='assocdat.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o assocdat.o `test -f 'libyasm/assocdat.c' || echo '$(srcdir)/'`libyasm/assocdat.c
+
+assocdat.obj: libyasm/assocdat.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT assocdat.obj -MD -MP -MF $(DEPDIR)/assocdat.Tpo -c -o assocdat.obj `if test -f 'libyasm/assocdat.c'; then $(CYGPATH_W) 'libyasm/assocdat.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/assocdat.c'; fi`
+ mv -f $(DEPDIR)/assocdat.Tpo $(DEPDIR)/assocdat.Po
+# source='libyasm/assocdat.c' object='assocdat.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o assocdat.obj `if test -f 'libyasm/assocdat.c'; then $(CYGPATH_W) 'libyasm/assocdat.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/assocdat.c'; fi`
+
+bitvect.o: libyasm/bitvect.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bitvect.o -MD -MP -MF $(DEPDIR)/bitvect.Tpo -c -o bitvect.o `test -f 'libyasm/bitvect.c' || echo '$(srcdir)/'`libyasm/bitvect.c
+ mv -f $(DEPDIR)/bitvect.Tpo $(DEPDIR)/bitvect.Po
+# source='libyasm/bitvect.c' object='bitvect.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bitvect.o `test -f 'libyasm/bitvect.c' || echo '$(srcdir)/'`libyasm/bitvect.c
+
+bitvect.obj: libyasm/bitvect.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bitvect.obj -MD -MP -MF $(DEPDIR)/bitvect.Tpo -c -o bitvect.obj `if test -f 'libyasm/bitvect.c'; then $(CYGPATH_W) 'libyasm/bitvect.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bitvect.c'; fi`
+ mv -f $(DEPDIR)/bitvect.Tpo $(DEPDIR)/bitvect.Po
+# source='libyasm/bitvect.c' object='bitvect.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bitvect.obj `if test -f 'libyasm/bitvect.c'; then $(CYGPATH_W) 'libyasm/bitvect.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bitvect.c'; fi`
+
+bc-align.o: libyasm/bc-align.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bc-align.o -MD -MP -MF $(DEPDIR)/bc-align.Tpo -c -o bc-align.o `test -f 'libyasm/bc-align.c' || echo '$(srcdir)/'`libyasm/bc-align.c
+ mv -f $(DEPDIR)/bc-align.Tpo $(DEPDIR)/bc-align.Po
+# source='libyasm/bc-align.c' object='bc-align.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bc-align.o `test -f 'libyasm/bc-align.c' || echo '$(srcdir)/'`libyasm/bc-align.c
+
+bc-align.obj: libyasm/bc-align.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bc-align.obj -MD -MP -MF $(DEPDIR)/bc-align.Tpo -c -o bc-align.obj `if test -f 'libyasm/bc-align.c'; then $(CYGPATH_W) 'libyasm/bc-align.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bc-align.c'; fi`
+ mv -f $(DEPDIR)/bc-align.Tpo $(DEPDIR)/bc-align.Po
+# source='libyasm/bc-align.c' object='bc-align.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bc-align.obj `if test -f 'libyasm/bc-align.c'; then $(CYGPATH_W) 'libyasm/bc-align.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bc-align.c'; fi`
+
+bc-data.o: libyasm/bc-data.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bc-data.o -MD -MP -MF $(DEPDIR)/bc-data.Tpo -c -o bc-data.o `test -f 'libyasm/bc-data.c' || echo '$(srcdir)/'`libyasm/bc-data.c
+ mv -f $(DEPDIR)/bc-data.Tpo $(DEPDIR)/bc-data.Po
+# source='libyasm/bc-data.c' object='bc-data.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bc-data.o `test -f 'libyasm/bc-data.c' || echo '$(srcdir)/'`libyasm/bc-data.c
+
+bc-data.obj: libyasm/bc-data.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bc-data.obj -MD -MP -MF $(DEPDIR)/bc-data.Tpo -c -o bc-data.obj `if test -f 'libyasm/bc-data.c'; then $(CYGPATH_W) 'libyasm/bc-data.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bc-data.c'; fi`
+ mv -f $(DEPDIR)/bc-data.Tpo $(DEPDIR)/bc-data.Po
+# source='libyasm/bc-data.c' object='bc-data.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bc-data.obj `if test -f 'libyasm/bc-data.c'; then $(CYGPATH_W) 'libyasm/bc-data.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bc-data.c'; fi`
+
+bc-incbin.o: libyasm/bc-incbin.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bc-incbin.o -MD -MP -MF $(DEPDIR)/bc-incbin.Tpo -c -o bc-incbin.o `test -f 'libyasm/bc-incbin.c' || echo '$(srcdir)/'`libyasm/bc-incbin.c
+ mv -f $(DEPDIR)/bc-incbin.Tpo $(DEPDIR)/bc-incbin.Po
+# source='libyasm/bc-incbin.c' object='bc-incbin.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bc-incbin.o `test -f 'libyasm/bc-incbin.c' || echo '$(srcdir)/'`libyasm/bc-incbin.c
+
+bc-incbin.obj: libyasm/bc-incbin.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bc-incbin.obj -MD -MP -MF $(DEPDIR)/bc-incbin.Tpo -c -o bc-incbin.obj `if test -f 'libyasm/bc-incbin.c'; then $(CYGPATH_W) 'libyasm/bc-incbin.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bc-incbin.c'; fi`
+ mv -f $(DEPDIR)/bc-incbin.Tpo $(DEPDIR)/bc-incbin.Po
+# source='libyasm/bc-incbin.c' object='bc-incbin.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bc-incbin.obj `if test -f 'libyasm/bc-incbin.c'; then $(CYGPATH_W) 'libyasm/bc-incbin.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bc-incbin.c'; fi`
+
+bc-org.o: libyasm/bc-org.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bc-org.o -MD -MP -MF $(DEPDIR)/bc-org.Tpo -c -o bc-org.o `test -f 'libyasm/bc-org.c' || echo '$(srcdir)/'`libyasm/bc-org.c
+ mv -f $(DEPDIR)/bc-org.Tpo $(DEPDIR)/bc-org.Po
+# source='libyasm/bc-org.c' object='bc-org.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bc-org.o `test -f 'libyasm/bc-org.c' || echo '$(srcdir)/'`libyasm/bc-org.c
+
+bc-org.obj: libyasm/bc-org.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bc-org.obj -MD -MP -MF $(DEPDIR)/bc-org.Tpo -c -o bc-org.obj `if test -f 'libyasm/bc-org.c'; then $(CYGPATH_W) 'libyasm/bc-org.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bc-org.c'; fi`
+ mv -f $(DEPDIR)/bc-org.Tpo $(DEPDIR)/bc-org.Po
+# source='libyasm/bc-org.c' object='bc-org.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bc-org.obj `if test -f 'libyasm/bc-org.c'; then $(CYGPATH_W) 'libyasm/bc-org.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bc-org.c'; fi`
+
+bc-reserve.o: libyasm/bc-reserve.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bc-reserve.o -MD -MP -MF $(DEPDIR)/bc-reserve.Tpo -c -o bc-reserve.o `test -f 'libyasm/bc-reserve.c' || echo '$(srcdir)/'`libyasm/bc-reserve.c
+ mv -f $(DEPDIR)/bc-reserve.Tpo $(DEPDIR)/bc-reserve.Po
+# source='libyasm/bc-reserve.c' object='bc-reserve.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bc-reserve.o `test -f 'libyasm/bc-reserve.c' || echo '$(srcdir)/'`libyasm/bc-reserve.c
+
+bc-reserve.obj: libyasm/bc-reserve.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bc-reserve.obj -MD -MP -MF $(DEPDIR)/bc-reserve.Tpo -c -o bc-reserve.obj `if test -f 'libyasm/bc-reserve.c'; then $(CYGPATH_W) 'libyasm/bc-reserve.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bc-reserve.c'; fi`
+ mv -f $(DEPDIR)/bc-reserve.Tpo $(DEPDIR)/bc-reserve.Po
+# source='libyasm/bc-reserve.c' object='bc-reserve.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bc-reserve.obj `if test -f 'libyasm/bc-reserve.c'; then $(CYGPATH_W) 'libyasm/bc-reserve.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bc-reserve.c'; fi`
+
+bytecode.o: libyasm/bytecode.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bytecode.o -MD -MP -MF $(DEPDIR)/bytecode.Tpo -c -o bytecode.o `test -f 'libyasm/bytecode.c' || echo '$(srcdir)/'`libyasm/bytecode.c
+ mv -f $(DEPDIR)/bytecode.Tpo $(DEPDIR)/bytecode.Po
+# source='libyasm/bytecode.c' object='bytecode.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bytecode.o `test -f 'libyasm/bytecode.c' || echo '$(srcdir)/'`libyasm/bytecode.c
+
+bytecode.obj: libyasm/bytecode.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bytecode.obj -MD -MP -MF $(DEPDIR)/bytecode.Tpo -c -o bytecode.obj `if test -f 'libyasm/bytecode.c'; then $(CYGPATH_W) 'libyasm/bytecode.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bytecode.c'; fi`
+ mv -f $(DEPDIR)/bytecode.Tpo $(DEPDIR)/bytecode.Po
+# source='libyasm/bytecode.c' object='bytecode.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bytecode.obj `if test -f 'libyasm/bytecode.c'; then $(CYGPATH_W) 'libyasm/bytecode.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bytecode.c'; fi`
+
+errwarn.o: libyasm/errwarn.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT errwarn.o -MD -MP -MF $(DEPDIR)/errwarn.Tpo -c -o errwarn.o `test -f 'libyasm/errwarn.c' || echo '$(srcdir)/'`libyasm/errwarn.c
+ mv -f $(DEPDIR)/errwarn.Tpo $(DEPDIR)/errwarn.Po
+# source='libyasm/errwarn.c' object='errwarn.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o errwarn.o `test -f 'libyasm/errwarn.c' || echo '$(srcdir)/'`libyasm/errwarn.c
+
+errwarn.obj: libyasm/errwarn.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT errwarn.obj -MD -MP -MF $(DEPDIR)/errwarn.Tpo -c -o errwarn.obj `if test -f 'libyasm/errwarn.c'; then $(CYGPATH_W) 'libyasm/errwarn.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/errwarn.c'; fi`
+ mv -f $(DEPDIR)/errwarn.Tpo $(DEPDIR)/errwarn.Po
+# source='libyasm/errwarn.c' object='errwarn.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o errwarn.obj `if test -f 'libyasm/errwarn.c'; then $(CYGPATH_W) 'libyasm/errwarn.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/errwarn.c'; fi`
+
+expr.o: libyasm/expr.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT expr.o -MD -MP -MF $(DEPDIR)/expr.Tpo -c -o expr.o `test -f 'libyasm/expr.c' || echo '$(srcdir)/'`libyasm/expr.c
+ mv -f $(DEPDIR)/expr.Tpo $(DEPDIR)/expr.Po
+# source='libyasm/expr.c' object='expr.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o expr.o `test -f 'libyasm/expr.c' || echo '$(srcdir)/'`libyasm/expr.c
+
+expr.obj: libyasm/expr.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT expr.obj -MD -MP -MF $(DEPDIR)/expr.Tpo -c -o expr.obj `if test -f 'libyasm/expr.c'; then $(CYGPATH_W) 'libyasm/expr.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/expr.c'; fi`
+ mv -f $(DEPDIR)/expr.Tpo $(DEPDIR)/expr.Po
+# source='libyasm/expr.c' object='expr.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o expr.obj `if test -f 'libyasm/expr.c'; then $(CYGPATH_W) 'libyasm/expr.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/expr.c'; fi`
+
+file.o: libyasm/file.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT file.o -MD -MP -MF $(DEPDIR)/file.Tpo -c -o file.o `test -f 'libyasm/file.c' || echo '$(srcdir)/'`libyasm/file.c
+ mv -f $(DEPDIR)/file.Tpo $(DEPDIR)/file.Po
+# source='libyasm/file.c' object='file.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o file.o `test -f 'libyasm/file.c' || echo '$(srcdir)/'`libyasm/file.c
+
+file.obj: libyasm/file.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT file.obj -MD -MP -MF $(DEPDIR)/file.Tpo -c -o file.obj `if test -f 'libyasm/file.c'; then $(CYGPATH_W) 'libyasm/file.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/file.c'; fi`
+ mv -f $(DEPDIR)/file.Tpo $(DEPDIR)/file.Po
+# source='libyasm/file.c' object='file.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o file.obj `if test -f 'libyasm/file.c'; then $(CYGPATH_W) 'libyasm/file.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/file.c'; fi`
+
+floatnum.o: libyasm/floatnum.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT floatnum.o -MD -MP -MF $(DEPDIR)/floatnum.Tpo -c -o floatnum.o `test -f 'libyasm/floatnum.c' || echo '$(srcdir)/'`libyasm/floatnum.c
+ mv -f $(DEPDIR)/floatnum.Tpo $(DEPDIR)/floatnum.Po
+# source='libyasm/floatnum.c' object='floatnum.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o floatnum.o `test -f 'libyasm/floatnum.c' || echo '$(srcdir)/'`libyasm/floatnum.c
+
+floatnum.obj: libyasm/floatnum.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT floatnum.obj -MD -MP -MF $(DEPDIR)/floatnum.Tpo -c -o floatnum.obj `if test -f 'libyasm/floatnum.c'; then $(CYGPATH_W) 'libyasm/floatnum.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/floatnum.c'; fi`
+ mv -f $(DEPDIR)/floatnum.Tpo $(DEPDIR)/floatnum.Po
+# source='libyasm/floatnum.c' object='floatnum.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o floatnum.obj `if test -f 'libyasm/floatnum.c'; then $(CYGPATH_W) 'libyasm/floatnum.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/floatnum.c'; fi`
+
+hamt.o: libyasm/hamt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT hamt.o -MD -MP -MF $(DEPDIR)/hamt.Tpo -c -o hamt.o `test -f 'libyasm/hamt.c' || echo '$(srcdir)/'`libyasm/hamt.c
+ mv -f $(DEPDIR)/hamt.Tpo $(DEPDIR)/hamt.Po
+# source='libyasm/hamt.c' object='hamt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o hamt.o `test -f 'libyasm/hamt.c' || echo '$(srcdir)/'`libyasm/hamt.c
+
+hamt.obj: libyasm/hamt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT hamt.obj -MD -MP -MF $(DEPDIR)/hamt.Tpo -c -o hamt.obj `if test -f 'libyasm/hamt.c'; then $(CYGPATH_W) 'libyasm/hamt.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/hamt.c'; fi`
+ mv -f $(DEPDIR)/hamt.Tpo $(DEPDIR)/hamt.Po
+# source='libyasm/hamt.c' object='hamt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o hamt.obj `if test -f 'libyasm/hamt.c'; then $(CYGPATH_W) 'libyasm/hamt.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/hamt.c'; fi`
+
+insn.o: libyasm/insn.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT insn.o -MD -MP -MF $(DEPDIR)/insn.Tpo -c -o insn.o `test -f 'libyasm/insn.c' || echo '$(srcdir)/'`libyasm/insn.c
+ mv -f $(DEPDIR)/insn.Tpo $(DEPDIR)/insn.Po
+# source='libyasm/insn.c' object='insn.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o insn.o `test -f 'libyasm/insn.c' || echo '$(srcdir)/'`libyasm/insn.c
+
+insn.obj: libyasm/insn.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT insn.obj -MD -MP -MF $(DEPDIR)/insn.Tpo -c -o insn.obj `if test -f 'libyasm/insn.c'; then $(CYGPATH_W) 'libyasm/insn.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/insn.c'; fi`
+ mv -f $(DEPDIR)/insn.Tpo $(DEPDIR)/insn.Po
+# source='libyasm/insn.c' object='insn.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o insn.obj `if test -f 'libyasm/insn.c'; then $(CYGPATH_W) 'libyasm/insn.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/insn.c'; fi`
+
+intnum.o: libyasm/intnum.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT intnum.o -MD -MP -MF $(DEPDIR)/intnum.Tpo -c -o intnum.o `test -f 'libyasm/intnum.c' || echo '$(srcdir)/'`libyasm/intnum.c
+ mv -f $(DEPDIR)/intnum.Tpo $(DEPDIR)/intnum.Po
+# source='libyasm/intnum.c' object='intnum.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o intnum.o `test -f 'libyasm/intnum.c' || echo '$(srcdir)/'`libyasm/intnum.c
+
+intnum.obj: libyasm/intnum.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT intnum.obj -MD -MP -MF $(DEPDIR)/intnum.Tpo -c -o intnum.obj `if test -f 'libyasm/intnum.c'; then $(CYGPATH_W) 'libyasm/intnum.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/intnum.c'; fi`
+ mv -f $(DEPDIR)/intnum.Tpo $(DEPDIR)/intnum.Po
+# source='libyasm/intnum.c' object='intnum.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o intnum.obj `if test -f 'libyasm/intnum.c'; then $(CYGPATH_W) 'libyasm/intnum.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/intnum.c'; fi`
+
+inttree.o: libyasm/inttree.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT inttree.o -MD -MP -MF $(DEPDIR)/inttree.Tpo -c -o inttree.o `test -f 'libyasm/inttree.c' || echo '$(srcdir)/'`libyasm/inttree.c
+ mv -f $(DEPDIR)/inttree.Tpo $(DEPDIR)/inttree.Po
+# source='libyasm/inttree.c' object='inttree.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o inttree.o `test -f 'libyasm/inttree.c' || echo '$(srcdir)/'`libyasm/inttree.c
+
+inttree.obj: libyasm/inttree.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT inttree.obj -MD -MP -MF $(DEPDIR)/inttree.Tpo -c -o inttree.obj `if test -f 'libyasm/inttree.c'; then $(CYGPATH_W) 'libyasm/inttree.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/inttree.c'; fi`
+ mv -f $(DEPDIR)/inttree.Tpo $(DEPDIR)/inttree.Po
+# source='libyasm/inttree.c' object='inttree.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o inttree.obj `if test -f 'libyasm/inttree.c'; then $(CYGPATH_W) 'libyasm/inttree.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/inttree.c'; fi`
+
+linemap.o: libyasm/linemap.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT linemap.o -MD -MP -MF $(DEPDIR)/linemap.Tpo -c -o linemap.o `test -f 'libyasm/linemap.c' || echo '$(srcdir)/'`libyasm/linemap.c
+ mv -f $(DEPDIR)/linemap.Tpo $(DEPDIR)/linemap.Po
+# source='libyasm/linemap.c' object='linemap.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o linemap.o `test -f 'libyasm/linemap.c' || echo '$(srcdir)/'`libyasm/linemap.c
+
+linemap.obj: libyasm/linemap.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT linemap.obj -MD -MP -MF $(DEPDIR)/linemap.Tpo -c -o linemap.obj `if test -f 'libyasm/linemap.c'; then $(CYGPATH_W) 'libyasm/linemap.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/linemap.c'; fi`
+ mv -f $(DEPDIR)/linemap.Tpo $(DEPDIR)/linemap.Po
+# source='libyasm/linemap.c' object='linemap.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o linemap.obj `if test -f 'libyasm/linemap.c'; then $(CYGPATH_W) 'libyasm/linemap.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/linemap.c'; fi`
+
+md5.o: libyasm/md5.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT md5.o -MD -MP -MF $(DEPDIR)/md5.Tpo -c -o md5.o `test -f 'libyasm/md5.c' || echo '$(srcdir)/'`libyasm/md5.c
+ mv -f $(DEPDIR)/md5.Tpo $(DEPDIR)/md5.Po
+# source='libyasm/md5.c' object='md5.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o md5.o `test -f 'libyasm/md5.c' || echo '$(srcdir)/'`libyasm/md5.c
+
+md5.obj: libyasm/md5.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT md5.obj -MD -MP -MF $(DEPDIR)/md5.Tpo -c -o md5.obj `if test -f 'libyasm/md5.c'; then $(CYGPATH_W) 'libyasm/md5.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/md5.c'; fi`
+ mv -f $(DEPDIR)/md5.Tpo $(DEPDIR)/md5.Po
+# source='libyasm/md5.c' object='md5.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o md5.obj `if test -f 'libyasm/md5.c'; then $(CYGPATH_W) 'libyasm/md5.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/md5.c'; fi`
+
+mergesort.o: libyasm/mergesort.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mergesort.o -MD -MP -MF $(DEPDIR)/mergesort.Tpo -c -o mergesort.o `test -f 'libyasm/mergesort.c' || echo '$(srcdir)/'`libyasm/mergesort.c
+ mv -f $(DEPDIR)/mergesort.Tpo $(DEPDIR)/mergesort.Po
+# source='libyasm/mergesort.c' object='mergesort.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mergesort.o `test -f 'libyasm/mergesort.c' || echo '$(srcdir)/'`libyasm/mergesort.c
+
+mergesort.obj: libyasm/mergesort.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mergesort.obj -MD -MP -MF $(DEPDIR)/mergesort.Tpo -c -o mergesort.obj `if test -f 'libyasm/mergesort.c'; then $(CYGPATH_W) 'libyasm/mergesort.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/mergesort.c'; fi`
+ mv -f $(DEPDIR)/mergesort.Tpo $(DEPDIR)/mergesort.Po
+# source='libyasm/mergesort.c' object='mergesort.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mergesort.obj `if test -f 'libyasm/mergesort.c'; then $(CYGPATH_W) 'libyasm/mergesort.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/mergesort.c'; fi`
+
+phash.o: libyasm/phash.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT phash.o -MD -MP -MF $(DEPDIR)/phash.Tpo -c -o phash.o `test -f 'libyasm/phash.c' || echo '$(srcdir)/'`libyasm/phash.c
+ mv -f $(DEPDIR)/phash.Tpo $(DEPDIR)/phash.Po
+# source='libyasm/phash.c' object='phash.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o phash.o `test -f 'libyasm/phash.c' || echo '$(srcdir)/'`libyasm/phash.c
+
+phash.obj: libyasm/phash.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT phash.obj -MD -MP -MF $(DEPDIR)/phash.Tpo -c -o phash.obj `if test -f 'libyasm/phash.c'; then $(CYGPATH_W) 'libyasm/phash.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/phash.c'; fi`
+ mv -f $(DEPDIR)/phash.Tpo $(DEPDIR)/phash.Po
+# source='libyasm/phash.c' object='phash.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o phash.obj `if test -f 'libyasm/phash.c'; then $(CYGPATH_W) 'libyasm/phash.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/phash.c'; fi`
+
+section.o: libyasm/section.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT section.o -MD -MP -MF $(DEPDIR)/section.Tpo -c -o section.o `test -f 'libyasm/section.c' || echo '$(srcdir)/'`libyasm/section.c
+ mv -f $(DEPDIR)/section.Tpo $(DEPDIR)/section.Po
+# source='libyasm/section.c' object='section.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o section.o `test -f 'libyasm/section.c' || echo '$(srcdir)/'`libyasm/section.c
+
+section.obj: libyasm/section.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT section.obj -MD -MP -MF $(DEPDIR)/section.Tpo -c -o section.obj `if test -f 'libyasm/section.c'; then $(CYGPATH_W) 'libyasm/section.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/section.c'; fi`
+ mv -f $(DEPDIR)/section.Tpo $(DEPDIR)/section.Po
+# source='libyasm/section.c' object='section.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o section.obj `if test -f 'libyasm/section.c'; then $(CYGPATH_W) 'libyasm/section.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/section.c'; fi`
+
+strcasecmp.o: libyasm/strcasecmp.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT strcasecmp.o -MD -MP -MF $(DEPDIR)/strcasecmp.Tpo -c -o strcasecmp.o `test -f 'libyasm/strcasecmp.c' || echo '$(srcdir)/'`libyasm/strcasecmp.c
+ mv -f $(DEPDIR)/strcasecmp.Tpo $(DEPDIR)/strcasecmp.Po
+# source='libyasm/strcasecmp.c' object='strcasecmp.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o strcasecmp.o `test -f 'libyasm/strcasecmp.c' || echo '$(srcdir)/'`libyasm/strcasecmp.c
+
+strcasecmp.obj: libyasm/strcasecmp.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT strcasecmp.obj -MD -MP -MF $(DEPDIR)/strcasecmp.Tpo -c -o strcasecmp.obj `if test -f 'libyasm/strcasecmp.c'; then $(CYGPATH_W) 'libyasm/strcasecmp.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/strcasecmp.c'; fi`
+ mv -f $(DEPDIR)/strcasecmp.Tpo $(DEPDIR)/strcasecmp.Po
+# source='libyasm/strcasecmp.c' object='strcasecmp.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o strcasecmp.obj `if test -f 'libyasm/strcasecmp.c'; then $(CYGPATH_W) 'libyasm/strcasecmp.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/strcasecmp.c'; fi`
+
+strsep.o: libyasm/strsep.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT strsep.o -MD -MP -MF $(DEPDIR)/strsep.Tpo -c -o strsep.o `test -f 'libyasm/strsep.c' || echo '$(srcdir)/'`libyasm/strsep.c
+ mv -f $(DEPDIR)/strsep.Tpo $(DEPDIR)/strsep.Po
+# source='libyasm/strsep.c' object='strsep.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o strsep.o `test -f 'libyasm/strsep.c' || echo '$(srcdir)/'`libyasm/strsep.c
+
+strsep.obj: libyasm/strsep.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT strsep.obj -MD -MP -MF $(DEPDIR)/strsep.Tpo -c -o strsep.obj `if test -f 'libyasm/strsep.c'; then $(CYGPATH_W) 'libyasm/strsep.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/strsep.c'; fi`
+ mv -f $(DEPDIR)/strsep.Tpo $(DEPDIR)/strsep.Po
+# source='libyasm/strsep.c' object='strsep.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o strsep.obj `if test -f 'libyasm/strsep.c'; then $(CYGPATH_W) 'libyasm/strsep.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/strsep.c'; fi`
+
+symrec.o: libyasm/symrec.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT symrec.o -MD -MP -MF $(DEPDIR)/symrec.Tpo -c -o symrec.o `test -f 'libyasm/symrec.c' || echo '$(srcdir)/'`libyasm/symrec.c
+ mv -f $(DEPDIR)/symrec.Tpo $(DEPDIR)/symrec.Po
+# source='libyasm/symrec.c' object='symrec.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o symrec.o `test -f 'libyasm/symrec.c' || echo '$(srcdir)/'`libyasm/symrec.c
+
+symrec.obj: libyasm/symrec.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT symrec.obj -MD -MP -MF $(DEPDIR)/symrec.Tpo -c -o symrec.obj `if test -f 'libyasm/symrec.c'; then $(CYGPATH_W) 'libyasm/symrec.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/symrec.c'; fi`
+ mv -f $(DEPDIR)/symrec.Tpo $(DEPDIR)/symrec.Po
+# source='libyasm/symrec.c' object='symrec.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o symrec.obj `if test -f 'libyasm/symrec.c'; then $(CYGPATH_W) 'libyasm/symrec.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/symrec.c'; fi`
+
+valparam.o: libyasm/valparam.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT valparam.o -MD -MP -MF $(DEPDIR)/valparam.Tpo -c -o valparam.o `test -f 'libyasm/valparam.c' || echo '$(srcdir)/'`libyasm/valparam.c
+ mv -f $(DEPDIR)/valparam.Tpo $(DEPDIR)/valparam.Po
+# source='libyasm/valparam.c' object='valparam.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o valparam.o `test -f 'libyasm/valparam.c' || echo '$(srcdir)/'`libyasm/valparam.c
+
+valparam.obj: libyasm/valparam.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT valparam.obj -MD -MP -MF $(DEPDIR)/valparam.Tpo -c -o valparam.obj `if test -f 'libyasm/valparam.c'; then $(CYGPATH_W) 'libyasm/valparam.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/valparam.c'; fi`
+ mv -f $(DEPDIR)/valparam.Tpo $(DEPDIR)/valparam.Po
+# source='libyasm/valparam.c' object='valparam.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o valparam.obj `if test -f 'libyasm/valparam.c'; then $(CYGPATH_W) 'libyasm/valparam.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/valparam.c'; fi`
+
+value.o: libyasm/value.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT value.o -MD -MP -MF $(DEPDIR)/value.Tpo -c -o value.o `test -f 'libyasm/value.c' || echo '$(srcdir)/'`libyasm/value.c
+ mv -f $(DEPDIR)/value.Tpo $(DEPDIR)/value.Po
+# source='libyasm/value.c' object='value.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o value.o `test -f 'libyasm/value.c' || echo '$(srcdir)/'`libyasm/value.c
+
+value.obj: libyasm/value.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT value.obj -MD -MP -MF $(DEPDIR)/value.Tpo -c -o value.obj `if test -f 'libyasm/value.c'; then $(CYGPATH_W) 'libyasm/value.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/value.c'; fi`
+ mv -f $(DEPDIR)/value.Tpo $(DEPDIR)/value.Po
+# source='libyasm/value.c' object='value.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o value.obj `if test -f 'libyasm/value.c'; then $(CYGPATH_W) 'libyasm/value.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/value.c'; fi`
+
+xmalloc.o: libyasm/xmalloc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xmalloc.o -MD -MP -MF $(DEPDIR)/xmalloc.Tpo -c -o xmalloc.o `test -f 'libyasm/xmalloc.c' || echo '$(srcdir)/'`libyasm/xmalloc.c
+ mv -f $(DEPDIR)/xmalloc.Tpo $(DEPDIR)/xmalloc.Po
+# source='libyasm/xmalloc.c' object='xmalloc.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xmalloc.o `test -f 'libyasm/xmalloc.c' || echo '$(srcdir)/'`libyasm/xmalloc.c
+
+xmalloc.obj: libyasm/xmalloc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xmalloc.obj -MD -MP -MF $(DEPDIR)/xmalloc.Tpo -c -o xmalloc.obj `if test -f 'libyasm/xmalloc.c'; then $(CYGPATH_W) 'libyasm/xmalloc.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/xmalloc.c'; fi`
+ mv -f $(DEPDIR)/xmalloc.Tpo $(DEPDIR)/xmalloc.Po
+# source='libyasm/xmalloc.c' object='xmalloc.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xmalloc.obj `if test -f 'libyasm/xmalloc.c'; then $(CYGPATH_W) 'libyasm/xmalloc.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/xmalloc.c'; fi`
+
+xstrdup.o: libyasm/xstrdup.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xstrdup.o -MD -MP -MF $(DEPDIR)/xstrdup.Tpo -c -o xstrdup.o `test -f 'libyasm/xstrdup.c' || echo '$(srcdir)/'`libyasm/xstrdup.c
+ mv -f $(DEPDIR)/xstrdup.Tpo $(DEPDIR)/xstrdup.Po
+# source='libyasm/xstrdup.c' object='xstrdup.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xstrdup.o `test -f 'libyasm/xstrdup.c' || echo '$(srcdir)/'`libyasm/xstrdup.c
+
+xstrdup.obj: libyasm/xstrdup.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xstrdup.obj -MD -MP -MF $(DEPDIR)/xstrdup.Tpo -c -o xstrdup.obj `if test -f 'libyasm/xstrdup.c'; then $(CYGPATH_W) 'libyasm/xstrdup.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/xstrdup.c'; fi`
+ mv -f $(DEPDIR)/xstrdup.Tpo $(DEPDIR)/xstrdup.Po
+# source='libyasm/xstrdup.c' object='xstrdup.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xstrdup.obj `if test -f 'libyasm/xstrdup.c'; then $(CYGPATH_W) 'libyasm/xstrdup.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/xstrdup.c'; fi`
+
+bitvect_test.o: libyasm/tests/bitvect_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bitvect_test.o -MD -MP -MF $(DEPDIR)/bitvect_test.Tpo -c -o bitvect_test.o `test -f 'libyasm/tests/bitvect_test.c' || echo '$(srcdir)/'`libyasm/tests/bitvect_test.c
+ mv -f $(DEPDIR)/bitvect_test.Tpo $(DEPDIR)/bitvect_test.Po
+# source='libyasm/tests/bitvect_test.c' object='bitvect_test.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bitvect_test.o `test -f 'libyasm/tests/bitvect_test.c' || echo '$(srcdir)/'`libyasm/tests/bitvect_test.c
+
+bitvect_test.obj: libyasm/tests/bitvect_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bitvect_test.obj -MD -MP -MF $(DEPDIR)/bitvect_test.Tpo -c -o bitvect_test.obj `if test -f 'libyasm/tests/bitvect_test.c'; then $(CYGPATH_W) 'libyasm/tests/bitvect_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/bitvect_test.c'; fi`
+ mv -f $(DEPDIR)/bitvect_test.Tpo $(DEPDIR)/bitvect_test.Po
+# source='libyasm/tests/bitvect_test.c' object='bitvect_test.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bitvect_test.obj `if test -f 'libyasm/tests/bitvect_test.c'; then $(CYGPATH_W) 'libyasm/tests/bitvect_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/bitvect_test.c'; fi`
+
+combpath_test.o: libyasm/tests/combpath_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT combpath_test.o -MD -MP -MF $(DEPDIR)/combpath_test.Tpo -c -o combpath_test.o `test -f 'libyasm/tests/combpath_test.c' || echo '$(srcdir)/'`libyasm/tests/combpath_test.c
+ mv -f $(DEPDIR)/combpath_test.Tpo $(DEPDIR)/combpath_test.Po
+# source='libyasm/tests/combpath_test.c' object='combpath_test.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o combpath_test.o `test -f 'libyasm/tests/combpath_test.c' || echo '$(srcdir)/'`libyasm/tests/combpath_test.c
+
+combpath_test.obj: libyasm/tests/combpath_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT combpath_test.obj -MD -MP -MF $(DEPDIR)/combpath_test.Tpo -c -o combpath_test.obj `if test -f 'libyasm/tests/combpath_test.c'; then $(CYGPATH_W) 'libyasm/tests/combpath_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/combpath_test.c'; fi`
+ mv -f $(DEPDIR)/combpath_test.Tpo $(DEPDIR)/combpath_test.Po
+# source='libyasm/tests/combpath_test.c' object='combpath_test.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o combpath_test.obj `if test -f 'libyasm/tests/combpath_test.c'; then $(CYGPATH_W) 'libyasm/tests/combpath_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/combpath_test.c'; fi`
+
+floatnum_test.o: libyasm/tests/floatnum_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT floatnum_test.o -MD -MP -MF $(DEPDIR)/floatnum_test.Tpo -c -o floatnum_test.o `test -f 'libyasm/tests/floatnum_test.c' || echo '$(srcdir)/'`libyasm/tests/floatnum_test.c
+ mv -f $(DEPDIR)/floatnum_test.Tpo $(DEPDIR)/floatnum_test.Po
+# source='libyasm/tests/floatnum_test.c' object='floatnum_test.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o floatnum_test.o `test -f 'libyasm/tests/floatnum_test.c' || echo '$(srcdir)/'`libyasm/tests/floatnum_test.c
+
+floatnum_test.obj: libyasm/tests/floatnum_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT floatnum_test.obj -MD -MP -MF $(DEPDIR)/floatnum_test.Tpo -c -o floatnum_test.obj `if test -f 'libyasm/tests/floatnum_test.c'; then $(CYGPATH_W) 'libyasm/tests/floatnum_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/floatnum_test.c'; fi`
+ mv -f $(DEPDIR)/floatnum_test.Tpo $(DEPDIR)/floatnum_test.Po
+# source='libyasm/tests/floatnum_test.c' object='floatnum_test.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o floatnum_test.obj `if test -f 'libyasm/tests/floatnum_test.c'; then $(CYGPATH_W) 'libyasm/tests/floatnum_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/floatnum_test.c'; fi`
+
+leb128_test.o: libyasm/tests/leb128_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT leb128_test.o -MD -MP -MF $(DEPDIR)/leb128_test.Tpo -c -o leb128_test.o `test -f 'libyasm/tests/leb128_test.c' || echo '$(srcdir)/'`libyasm/tests/leb128_test.c
+ mv -f $(DEPDIR)/leb128_test.Tpo $(DEPDIR)/leb128_test.Po
+# source='libyasm/tests/leb128_test.c' object='leb128_test.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o leb128_test.o `test -f 'libyasm/tests/leb128_test.c' || echo '$(srcdir)/'`libyasm/tests/leb128_test.c
+
+leb128_test.obj: libyasm/tests/leb128_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT leb128_test.obj -MD -MP -MF $(DEPDIR)/leb128_test.Tpo -c -o leb128_test.obj `if test -f 'libyasm/tests/leb128_test.c'; then $(CYGPATH_W) 'libyasm/tests/leb128_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/leb128_test.c'; fi`
+ mv -f $(DEPDIR)/leb128_test.Tpo $(DEPDIR)/leb128_test.Po
+# source='libyasm/tests/leb128_test.c' object='leb128_test.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o leb128_test.obj `if test -f 'libyasm/tests/leb128_test.c'; then $(CYGPATH_W) 'libyasm/tests/leb128_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/leb128_test.c'; fi`
+
+splitpath_test.o: libyasm/tests/splitpath_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT splitpath_test.o -MD -MP -MF $(DEPDIR)/splitpath_test.Tpo -c -o splitpath_test.o `test -f 'libyasm/tests/splitpath_test.c' || echo '$(srcdir)/'`libyasm/tests/splitpath_test.c
+ mv -f $(DEPDIR)/splitpath_test.Tpo $(DEPDIR)/splitpath_test.Po
+# source='libyasm/tests/splitpath_test.c' object='splitpath_test.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o splitpath_test.o `test -f 'libyasm/tests/splitpath_test.c' || echo '$(srcdir)/'`libyasm/tests/splitpath_test.c
+
+splitpath_test.obj: libyasm/tests/splitpath_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT splitpath_test.obj -MD -MP -MF $(DEPDIR)/splitpath_test.Tpo -c -o splitpath_test.obj `if test -f 'libyasm/tests/splitpath_test.c'; then $(CYGPATH_W) 'libyasm/tests/splitpath_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/splitpath_test.c'; fi`
+ mv -f $(DEPDIR)/splitpath_test.Tpo $(DEPDIR)/splitpath_test.Po
+# source='libyasm/tests/splitpath_test.c' object='splitpath_test.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o splitpath_test.obj `if test -f 'libyasm/tests/splitpath_test.c'; then $(CYGPATH_W) 'libyasm/tests/splitpath_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/splitpath_test.c'; fi`
+
+uncstring_test.o: libyasm/tests/uncstring_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT uncstring_test.o -MD -MP -MF $(DEPDIR)/uncstring_test.Tpo -c -o uncstring_test.o `test -f 'libyasm/tests/uncstring_test.c' || echo '$(srcdir)/'`libyasm/tests/uncstring_test.c
+ mv -f $(DEPDIR)/uncstring_test.Tpo $(DEPDIR)/uncstring_test.Po
+# source='libyasm/tests/uncstring_test.c' object='uncstring_test.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o uncstring_test.o `test -f 'libyasm/tests/uncstring_test.c' || echo '$(srcdir)/'`libyasm/tests/uncstring_test.c
+
+uncstring_test.obj: libyasm/tests/uncstring_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT uncstring_test.obj -MD -MP -MF $(DEPDIR)/uncstring_test.Tpo -c -o uncstring_test.obj `if test -f 'libyasm/tests/uncstring_test.c'; then $(CYGPATH_W) 'libyasm/tests/uncstring_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/uncstring_test.c'; fi`
+ mv -f $(DEPDIR)/uncstring_test.Tpo $(DEPDIR)/uncstring_test.Po
+# source='libyasm/tests/uncstring_test.c' object='uncstring_test.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o uncstring_test.obj `if test -f 'libyasm/tests/uncstring_test.c'; then $(CYGPATH_W) 'libyasm/tests/uncstring_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/uncstring_test.c'; fi`
+
+yasm.o: frontends/yasm/yasm.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT yasm.o -MD -MP -MF $(DEPDIR)/yasm.Tpo -c -o yasm.o `test -f 'frontends/yasm/yasm.c' || echo '$(srcdir)/'`frontends/yasm/yasm.c
+ mv -f $(DEPDIR)/yasm.Tpo $(DEPDIR)/yasm.Po
+# source='frontends/yasm/yasm.c' object='yasm.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o yasm.o `test -f 'frontends/yasm/yasm.c' || echo '$(srcdir)/'`frontends/yasm/yasm.c
+
+yasm.obj: frontends/yasm/yasm.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT yasm.obj -MD -MP -MF $(DEPDIR)/yasm.Tpo -c -o yasm.obj `if test -f 'frontends/yasm/yasm.c'; then $(CYGPATH_W) 'frontends/yasm/yasm.c'; else $(CYGPATH_W) '$(srcdir)/frontends/yasm/yasm.c'; fi`
+ mv -f $(DEPDIR)/yasm.Tpo $(DEPDIR)/yasm.Po
+# source='frontends/yasm/yasm.c' object='yasm.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o yasm.obj `if test -f 'frontends/yasm/yasm.c'; then $(CYGPATH_W) 'frontends/yasm/yasm.c'; else $(CYGPATH_W) '$(srcdir)/frontends/yasm/yasm.c'; fi`
+
+yasm-options.o: frontends/yasm/yasm-options.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT yasm-options.o -MD -MP -MF $(DEPDIR)/yasm-options.Tpo -c -o yasm-options.o `test -f 'frontends/yasm/yasm-options.c' || echo '$(srcdir)/'`frontends/yasm/yasm-options.c
+ mv -f $(DEPDIR)/yasm-options.Tpo $(DEPDIR)/yasm-options.Po
+# source='frontends/yasm/yasm-options.c' object='yasm-options.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o yasm-options.o `test -f 'frontends/yasm/yasm-options.c' || echo '$(srcdir)/'`frontends/yasm/yasm-options.c
+
+yasm-options.obj: frontends/yasm/yasm-options.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT yasm-options.obj -MD -MP -MF $(DEPDIR)/yasm-options.Tpo -c -o yasm-options.obj `if test -f 'frontends/yasm/yasm-options.c'; then $(CYGPATH_W) 'frontends/yasm/yasm-options.c'; else $(CYGPATH_W) '$(srcdir)/frontends/yasm/yasm-options.c'; fi`
+ mv -f $(DEPDIR)/yasm-options.Tpo $(DEPDIR)/yasm-options.Po
+# source='frontends/yasm/yasm-options.c' object='yasm-options.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o yasm-options.obj `if test -f 'frontends/yasm/yasm-options.c'; then $(CYGPATH_W) 'frontends/yasm/yasm-options.c'; else $(CYGPATH_W) '$(srcdir)/frontends/yasm/yasm-options.c'; fi`
+
+tasm.o: frontends/tasm/tasm.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tasm.o -MD -MP -MF $(DEPDIR)/tasm.Tpo -c -o tasm.o `test -f 'frontends/tasm/tasm.c' || echo '$(srcdir)/'`frontends/tasm/tasm.c
+ mv -f $(DEPDIR)/tasm.Tpo $(DEPDIR)/tasm.Po
+# source='frontends/tasm/tasm.c' object='tasm.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tasm.o `test -f 'frontends/tasm/tasm.c' || echo '$(srcdir)/'`frontends/tasm/tasm.c
+
+tasm.obj: frontends/tasm/tasm.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tasm.obj -MD -MP -MF $(DEPDIR)/tasm.Tpo -c -o tasm.obj `if test -f 'frontends/tasm/tasm.c'; then $(CYGPATH_W) 'frontends/tasm/tasm.c'; else $(CYGPATH_W) '$(srcdir)/frontends/tasm/tasm.c'; fi`
+ mv -f $(DEPDIR)/tasm.Tpo $(DEPDIR)/tasm.Po
+# source='frontends/tasm/tasm.c' object='tasm.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tasm.obj `if test -f 'frontends/tasm/tasm.c'; then $(CYGPATH_W) 'frontends/tasm/tasm.c'; else $(CYGPATH_W) '$(srcdir)/frontends/tasm/tasm.c'; fi`
+
+tasm-options.o: frontends/tasm/tasm-options.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tasm-options.o -MD -MP -MF $(DEPDIR)/tasm-options.Tpo -c -o tasm-options.o `test -f 'frontends/tasm/tasm-options.c' || echo '$(srcdir)/'`frontends/tasm/tasm-options.c
+ mv -f $(DEPDIR)/tasm-options.Tpo $(DEPDIR)/tasm-options.Po
+# source='frontends/tasm/tasm-options.c' object='tasm-options.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tasm-options.o `test -f 'frontends/tasm/tasm-options.c' || echo '$(srcdir)/'`frontends/tasm/tasm-options.c
+
+tasm-options.obj: frontends/tasm/tasm-options.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tasm-options.obj -MD -MP -MF $(DEPDIR)/tasm-options.Tpo -c -o tasm-options.obj `if test -f 'frontends/tasm/tasm-options.c'; then $(CYGPATH_W) 'frontends/tasm/tasm-options.c'; else $(CYGPATH_W) '$(srcdir)/frontends/tasm/tasm-options.c'; fi`
+ mv -f $(DEPDIR)/tasm-options.Tpo $(DEPDIR)/tasm-options.Po
+# source='frontends/tasm/tasm-options.c' object='tasm-options.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tasm-options.obj `if test -f 'frontends/tasm/tasm-options.c'; then $(CYGPATH_W) 'frontends/tasm/tasm-options.c'; else $(CYGPATH_W) '$(srcdir)/frontends/tasm/tasm-options.c'; fi`
+install-man1: $(man1_MANS) $(man_MANS)
+ @$(NORMAL_INSTALL)
+ test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)"
+ @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.1*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
+ else file=$$i; fi; \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 1*) ;; \
+ *) ext='1' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \
+ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst"; \
+ done
+uninstall-man1:
+ @$(NORMAL_UNINSTALL)
+ @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.1*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 1*) ;; \
+ *) ext='1' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " rm -f '$(DESTDIR)$(man1dir)/$$inst'"; \
+ rm -f "$(DESTDIR)$(man1dir)/$$inst"; \
+ done
+install-man7: $(man7_MANS) $(man_MANS)
+ @$(NORMAL_INSTALL)
+ test -z "$(man7dir)" || $(MKDIR_P) "$(DESTDIR)$(man7dir)"
+ @list='$(man7_MANS) $(dist_man7_MANS) $(nodist_man7_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.7*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
+ else file=$$i; fi; \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 7*) ;; \
+ *) ext='7' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man7dir)/$$inst'"; \
+ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man7dir)/$$inst"; \
+ done
+uninstall-man7:
+ @$(NORMAL_UNINSTALL)
+ @list='$(man7_MANS) $(dist_man7_MANS) $(nodist_man7_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.7*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 7*) ;; \
+ *) ext='7' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " rm -f '$(DESTDIR)$(man7dir)/$$inst'"; \
+ rm -f "$(DESTDIR)$(man7dir)/$$inst"; \
+ done
+install-includeHEADERS: $(include_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)"
+ @list='$(include_HEADERS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includedir)/$$f'"; \
+ $(includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includedir)/$$f"; \
+ done
+
+uninstall-includeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(include_HEADERS)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(includedir)/$$f'"; \
+ rm -f "$(DESTDIR)$(includedir)/$$f"; \
+ done
+install-modincludeHEADERS: $(modinclude_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(modincludedir)" || $(MKDIR_P) "$(DESTDIR)$(modincludedir)"
+ @list='$(modinclude_HEADERS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(modincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(modincludedir)/$$f'"; \
+ $(modincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(modincludedir)/$$f"; \
+ done
+
+uninstall-modincludeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(modinclude_HEADERS)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(modincludedir)/$$f'"; \
+ rm -f "$(DESTDIR)$(modincludedir)/$$f"; \
+ done
+install-nodist_includeHEADERS: $(nodist_include_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)"
+ @list='$(nodist_include_HEADERS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(nodist_includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includedir)/$$f'"; \
+ $(nodist_includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includedir)/$$f"; \
+ done
+
+uninstall-nodist_includeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(nodist_include_HEADERS)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(includedir)/$$f'"; \
+ rm -f "$(DESTDIR)$(includedir)/$$f"; \
+ done
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+check-TESTS: $(TESTS)
+ @failed=0; all=0; xfail=0; xpass=0; skip=0; ws='[ ]'; \
+ srcdir=$(srcdir); export srcdir; \
+ list=' $(TESTS) '; \
+ if test -n "$$list"; then \
+ for tst in $$list; do \
+ if test -f ./$$tst; then dir=./; \
+ elif test -f $$tst; then dir=; \
+ else dir="$(srcdir)/"; fi; \
+ if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
+ all=`expr $$all + 1`; \
+ case " $(XFAIL_TESTS) " in \
+ *$$ws$$tst$$ws*) \
+ xpass=`expr $$xpass + 1`; \
+ failed=`expr $$failed + 1`; \
+ echo "XPASS: $$tst"; \
+ ;; \
+ *) \
+ echo "PASS: $$tst"; \
+ ;; \
+ esac; \
+ elif test $$? -ne 77; then \
+ all=`expr $$all + 1`; \
+ case " $(XFAIL_TESTS) " in \
+ *$$ws$$tst$$ws*) \
+ xfail=`expr $$xfail + 1`; \
+ echo "XFAIL: $$tst"; \
+ ;; \
+ *) \
+ failed=`expr $$failed + 1`; \
+ echo "FAIL: $$tst"; \
+ ;; \
+ esac; \
+ else \
+ skip=`expr $$skip + 1`; \
+ echo "SKIP: $$tst"; \
+ fi; \
+ done; \
+ if test "$$failed" -eq 0; then \
+ if test "$$xfail" -eq 0; then \
+ banner="All $$all tests passed"; \
+ else \
+ banner="All $$all tests behaved as expected ($$xfail expected failures)"; \
+ fi; \
+ else \
+ if test "$$xpass" -eq 0; then \
+ banner="$$failed of $$all tests failed"; \
+ else \
+ banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \
+ fi; \
+ fi; \
+ dashes="$$banner"; \
+ skipped=""; \
+ if test "$$skip" -ne 0; then \
+ skipped="($$skip tests were not run)"; \
+ test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
+ dashes="$$skipped"; \
+ fi; \
+ report=""; \
+ if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
+ report="Please report to $(PACKAGE_BUGREPORT)"; \
+ test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
+ dashes="$$report"; \
+ fi; \
+ dashes=`echo "$$dashes" | sed s/./=/g`; \
+ echo "$$dashes"; \
+ echo "$$banner"; \
+ test -z "$$skipped" || echo "$$skipped"; \
+ test -z "$$report" || echo "$$report"; \
+ echo "$$dashes"; \
+ test "$$failed" -eq 0; \
+ else :; fi
+
+distdir: $(DISTFILES)
+ $(am__remove_distdir)
+ test -d $(distdir) || mkdir $(distdir)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ distdir=`$(am__cd) $(distdir) && pwd`; \
+ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$top_distdir" \
+ distdir="$$distdir/$$subdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+ -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
+ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
+ || chmod -R a+r $(distdir)
+dist-gzip: distdir
+ tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+ $(am__remove_distdir)
+
+dist-bzip2: distdir
+ tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
+ $(am__remove_distdir)
+
+dist-lzma: distdir
+ tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
+ $(am__remove_distdir)
+
+dist-tarZ: distdir
+ tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
+ $(am__remove_distdir)
+
+dist-shar: distdir
+ shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+ $(am__remove_distdir)
+
+dist-zip: distdir
+ -rm -f $(distdir).zip
+ zip -rq $(distdir).zip $(distdir)
+ $(am__remove_distdir)
+
+dist dist-all: distdir
+ tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+ $(am__remove_distdir)
+
+# This target untars the dist file and tries a VPATH configuration. Then
+# it guarantees that the distribution is self-contained by making another
+# tarfile.
+distcheck: dist
+ case '$(DIST_ARCHIVES)' in \
+ *.tar.gz*) \
+ GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
+ *.tar.bz2*) \
+ bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
+ *.tar.lzma*) \
+ unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\
+ *.tar.Z*) \
+ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
+ *.shar.gz*) \
+ GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
+ *.zip*) \
+ unzip $(distdir).zip ;;\
+ esac
+ chmod -R a-w $(distdir); chmod a+w $(distdir)
+ mkdir $(distdir)/_build
+ mkdir $(distdir)/_inst
+ chmod a-w $(distdir)
+ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
+ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
+ && cd $(distdir)/_build \
+ && ../configure --srcdir=.. --prefix="$$dc_install_base" \
+ $(DISTCHECK_CONFIGURE_FLAGS) \
+ && $(MAKE) $(AM_MAKEFLAGS) \
+ && $(MAKE) $(AM_MAKEFLAGS) dvi \
+ && $(MAKE) $(AM_MAKEFLAGS) check \
+ && $(MAKE) $(AM_MAKEFLAGS) install \
+ && $(MAKE) $(AM_MAKEFLAGS) installcheck \
+ && $(MAKE) $(AM_MAKEFLAGS) uninstall \
+ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
+ distuninstallcheck \
+ && chmod -R a-w "$$dc_install_base" \
+ && ({ \
+ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
+ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
+ } || { rm -rf "$$dc_destdir"; exit 1; }) \
+ && rm -rf "$$dc_destdir" \
+ && $(MAKE) $(AM_MAKEFLAGS) dist \
+ && rm -rf $(DIST_ARCHIVES) \
+ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck
+ $(am__remove_distdir)
+ @(echo "$(distdir) archives ready for distribution: "; \
+ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
+ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
+distuninstallcheck:
+ @cd $(distuninstallcheck_dir) \
+ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
+ || { echo "ERROR: files left after uninstall:" ; \
+ if test -n "$(DESTDIR)"; then \
+ echo " (check DESTDIR support)"; \
+ fi ; \
+ $(distuninstallcheck_listfiles) ; \
+ exit 1; } >&2
+distcleancheck: distclean
+ @if test '$(srcdir)' = . ; then \
+ echo "ERROR: distcleancheck can only run from a VPATH build" ; \
+ exit 1 ; \
+ fi
+ @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
+ || { echo "ERROR: files left in build directory after distclean:" ; \
+ $(distcleancheck_listfiles) ; \
+ exit 1; } >&2
+check-am: all-am
+ $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
+ $(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) check-recursive
+all-am: Makefile $(LIBRARIES) $(PROGRAMS) $(MANS) $(HEADERS) config.h \
+ all-local
+installdirs: installdirs-recursive
+installdirs-am:
+ for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man7dir)" "$(DESTDIR)$(includedir)" "$(DESTDIR)$(modincludedir)" "$(DESTDIR)$(includedir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+ -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
+clean: clean-recursive
+
+clean-am: clean-binPROGRAMS clean-checkPROGRAMS clean-generic \
+ clean-libLIBRARIES clean-noinstPROGRAMS mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-hdr distclean-local distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am: install-includeHEADERS install-man \
+ install-modincludeHEADERS install-nodist_includeHEADERS
+
+install-dvi: install-dvi-recursive
+
+install-exec-am: install-binPROGRAMS install-libLIBRARIES
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) install-exec-hook
+
+install-html: install-html-recursive
+
+install-info: install-info-recursive
+
+install-man: install-man1 install-man7
+
+install-pdf: install-pdf-recursive
+
+install-ps: install-ps-recursive
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+ -rm -rf $(top_srcdir)/autom4te.cache
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS uninstall-includeHEADERS \
+ uninstall-libLIBRARIES uninstall-man \
+ uninstall-modincludeHEADERS uninstall-nodist_includeHEADERS
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) uninstall-hook
+
+uninstall-man: uninstall-man1 uninstall-man7
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+ install-exec-am install-strip uninstall-am
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+ all all-am all-local am--refresh check check-TESTS check-am \
+ clean clean-binPROGRAMS clean-checkPROGRAMS clean-generic \
+ clean-libLIBRARIES clean-noinstPROGRAMS ctags ctags-recursive \
+ dist dist-all dist-bzip2 dist-gzip dist-lzma dist-shar \
+ dist-tarZ dist-zip distcheck distclean distclean-compile \
+ distclean-generic distclean-hdr distclean-local distclean-tags \
+ distcleancheck distdir distuninstallcheck dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-exec-hook install-html \
+ install-html-am install-includeHEADERS install-info \
+ install-info-am install-libLIBRARIES install-man install-man1 \
+ install-man7 install-modincludeHEADERS \
+ install-nodist_includeHEADERS install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs installdirs-am maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic pdf pdf-am ps ps-am tags tags-recursive \
+ uninstall uninstall-am uninstall-binPROGRAMS uninstall-hook \
+ uninstall-includeHEADERS uninstall-libLIBRARIES uninstall-man \
+ uninstall-man1 uninstall-man7 uninstall-modincludeHEADERS \
+ uninstall-nodist_includeHEADERS
+
+
+re2c-main.$(OBJEXT): tools/re2c/main.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/re2c/main.c || echo '$(srcdir)/'`tools/re2c/main.c
+
+re2c-code.$(OBJEXT): tools/re2c/code.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/re2c/code.c || echo '$(srcdir)/'`tools/re2c/code.c
+
+re2c-dfa.$(OBJEXT): tools/re2c/dfa.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/re2c/dfa.c || echo '$(srcdir)/'`tools/re2c/dfa.c
+
+re2c-parser.$(OBJEXT): tools/re2c/parser.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/re2c/parser.c || echo '$(srcdir)/'`tools/re2c/parser.c
+
+re2c-actions.$(OBJEXT): tools/re2c/actions.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/re2c/actions.c || echo '$(srcdir)/'`tools/re2c/actions.c
+
+re2c-scanner.$(OBJEXT): tools/re2c/scanner.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/re2c/scanner.c || echo '$(srcdir)/'`tools/re2c/scanner.c
+
+re2c-mbo_getopt.$(OBJEXT): tools/re2c/mbo_getopt.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/re2c/mbo_getopt.c || echo '$(srcdir)/'`tools/re2c/mbo_getopt.c
+
+re2c-substr.$(OBJEXT): tools/re2c/substr.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/re2c/substr.c || echo '$(srcdir)/'`tools/re2c/substr.c
+
+re2c-translate.$(OBJEXT): tools/re2c/translate.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/re2c/translate.c || echo '$(srcdir)/'`tools/re2c/translate.c
+
+genmacro.$(OBJEXT): tools/genmacro/genmacro.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/genmacro/genmacro.c || echo '$(srcdir)/'`tools/genmacro/genmacro.c
+.gperf.c: genperf$(EXEEXT)
+ $(top_builddir)/genperf$(EXEEXT) $< $@
+
+genperf.$(OBJEXT): tools/genperf/genperf.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/genperf/genperf.c || echo '$(srcdir)/'`tools/genperf/genperf.c
+
+gp-perfect.$(OBJEXT): tools/genperf/perfect.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/genperf/perfect.c || echo '$(srcdir)/'`tools/genperf/perfect.c
+
+gp-phash.$(OBJEXT): libyasm/phash.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f libyasm/phash.c || echo '$(srcdir)/'`libyasm/phash.c
+
+gp-xmalloc.$(OBJEXT): libyasm/xmalloc.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f libyasm/xmalloc.c || echo '$(srcdir)/'`libyasm/xmalloc.c
+
+gp-xstrdup.$(OBJEXT): libyasm/xstrdup.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f libyasm/xstrdup.c || echo '$(srcdir)/'`libyasm/xstrdup.c
+
+# Use Pyxelator to generate Pyrex function headers.
+#_yasm.pxi: ${HEADERS}
+# @rm -rf .tmp
+# @mkdir .tmp
+# $(PYTHON) $(srcdir)/tools/python-yasm/pyxelator/wrap_yasm.py \
+# "YASM_DIR=${srcdir}" "CPP=${CPP}" "CPPFLAGS=${CPPFLAGS}"
+# @rm -rf .tmp
+
+# Need to build a local copy of the main Pyrex input file to include _yasm.pxi
+# from the build directory. Also need to fixup the other .pxi include paths.
+#yasm.pyx: $(srcdir)/tools/python-yasm/yasm.pyx
+# sed -e 's,^include "\([^_]\),include "${srcdir}/tools/python-yasm/\1,' \
+# $(srcdir)/tools/python-yasm/yasm.pyx > $@
+
+# Actually run Pyrex
+#yasm_python.c: yasm.pyx _yasm.pxi $(PYBINDING_DEPS)
+# $(PYTHON) -c "from Pyrex.Compiler.Main import main; main(command_line=1)" \
+# -o $@ yasm.pyx
+
+# Now the Python build magic...
+#python-setup.txt: Makefile
+# echo "includes=${DEFS} ${DEFAULT_INCLUDES} ${INCLUDES} ${AM_CPPFLAGS} ${CPPFLAGS}" > python-setup.txt
+# echo "sources=${libyasm_a_SOURCES}" >> python-setup.txt
+# echo "srcdir=${srcdir}" >> python-setup.txt
+# echo "gcc=${GCC}" >> python-setup.txt
+
+#.python-build: python-setup.txt yasm_python.c ${libyasm_a_SOURCES}
+# $(PYTHON) `test -f tools/python-yasm/setup.py || echo '$(srcdir)/'`tools/python-yasm/setup.py build
+# touch .python-build
+#python-build: .python-build
+
+#python-install: .python-build
+# $(PYTHON) `test -f tools/python-yasm/setup.py || echo '$(srcdir)/'`tools/python-yasm/setup.py install "--install-lib=$(DESTDIR)$(pythondir)"
+
+#python-uninstall:
+# rm -f `$(PYTHON) -c "import sys;sys.path.insert(0, '${DESTDIR}${pythondir}'); import yasm; print yasm.__file__"`
+
+python-build:
+python-install:
+python-uninstall:
+
+modules/arch/x86/x86id.c: x86insn_nasm.c x86insn_gas.c x86insns.c
+
+x86insn_nasm.gperf x86insn_gas.gperf x86insns.c: $(srcdir)/modules/arch/x86/gen_x86_insn.py
+ $(PYTHON) $(srcdir)/modules/arch/x86/gen_x86_insn.py
+#x86insn_nasm.gperf: $(srcdir)/x86insn_nasm.gperf
+# @echo Python must be installed to regenerate x86 instructions files
+# cp $(srcdir)/x86insn_nasm.gperf $@
+#x86insn_gas.gperf: $(srcdir)/x86insn_gas.gperf
+# @echo Python must be installed to regenerate x86 instructions files
+# cp $(srcdir)/x86insn_gas.gperf $@
+
+# Use suffix rules for gperf files
+x86insn_nasm.c: x86insn_nasm.gperf genperf$(EXEEXT)
+x86insn_gas.c: x86insn_gas.gperf genperf$(EXEEXT)
+x86cpu.c: $(srcdir)/modules/arch/x86/x86cpu.gperf genperf$(EXEEXT)
+ $(top_builddir)/genperf$(EXEEXT) $(srcdir)/modules/arch/x86/x86cpu.gperf $@
+x86regtmod.c: $(srcdir)/modules/arch/x86/x86regtmod.gperf genperf$(EXEEXT)
+ $(top_builddir)/genperf$(EXEEXT) $(srcdir)/modules/arch/x86/x86regtmod.gperf $@
+
+lc3bid.c: $(srcdir)/modules/arch/lc3b/lc3bid.re re2c$(EXEEXT)
+ $(top_builddir)/re2c$(EXEEXT) -s -o $@ $(srcdir)/modules/arch/lc3b/lc3bid.re
+
+yasm_arch.7: modules/arch/yasm_arch.xml
+ $(XMLTO) -o $(top_builddir) man $(srcdir)/modules/arch/yasm_arch.xml
+
+#EXTRA_DIST += modules/listfmts/nasm/tests/Makefile.inc
+
+#include modules/listfmts/nasm/tests/Makefile.inc
+
+gas-token.c: $(srcdir)/modules/parsers/gas/gas-token.re re2c$(EXEEXT)
+ $(top_builddir)/re2c$(EXEEXT) -b -o $@ $(srcdir)/modules/parsers/gas/gas-token.re
+
+nasm-token.c: $(srcdir)/modules/parsers/nasm/nasm-token.re re2c$(EXEEXT)
+ $(top_builddir)/re2c$(EXEEXT) -b -o $@ $(srcdir)/modules/parsers/nasm/nasm-token.re
+
+$(top_srcdir)/modules/parsers/nasm/nasm-parser.c: nasm-macros.c
+
+nasm-macros.c: $(srcdir)/modules/parsers/nasm/nasm-std.mac genmacro$(EXEEXT)
+ $(top_builddir)/genmacro$(EXEEXT) $@ nasm_standard_mac $(srcdir)/modules/parsers/nasm/nasm-std.mac
+
+yasm_parsers.7: modules/parsers/yasm_parsers.xml
+ $(XMLTO) -o $(top_builddir) man $(srcdir)/modules/parsers/yasm_parsers.xml
+
+$(top_srcdir)/modules/preprocs/nasm/nasm-preproc.c: nasm-version.c
+
+nasm-version.c: version.mac genmacro$(EXEEXT)
+ $(top_builddir)/genmacro$(EXEEXT) $@ nasm_version_mac version.mac
+
+version.mac: genversion$(EXEEXT)
+ $(top_builddir)/genversion$(EXEEXT) $@
+
+genversion.$(OBJEXT): modules/preprocs/nasm/genversion.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f modules/preprocs/nasm/genversion.c || echo '$(srcdir)/'`modules/preprocs/nasm/genversion.c
+
+#EXTRA_DIST += modules/dbgfmts/codeview/tests/Makefile.inc
+#include modules/dbgfmts/codeview/tests/Makefile.inc
+
+yasm_dbgfmts.7: modules/dbgfmts/yasm_dbgfmts.xml
+ $(XMLTO) -o $(top_builddir) man $(srcdir)/modules/dbgfmts/yasm_dbgfmts.xml
+
+$(top_srcdir)/modules/objfmts/coff/coff-objfmt.c: win64-nasm.c win64-gas.c
+
+win64-nasm.c: $(srcdir)/modules/objfmts/coff/win64-nasm.mac genmacro$(EXEEXT)
+ $(top_builddir)/genmacro$(EXEEXT) $@ win64_nasm_stdmac $(srcdir)/modules/objfmts/coff/win64-nasm.mac
+
+win64-gas.c: $(srcdir)/modules/objfmts/coff/win64-gas.mac genmacro$(EXEEXT)
+ $(top_builddir)/genmacro$(EXEEXT) $@ win64_gas_stdmac $(srcdir)/modules/objfmts/coff/win64-gas.mac
+
+yasm_objfmts.7: modules/objfmts/yasm_objfmts.xml
+ $(XMLTO) -o $(top_builddir) man $(srcdir)/modules/objfmts/yasm_objfmts.xml
+
+module.c: $(top_srcdir)/libyasm/module.in genmodule$(EXEEXT) Makefile
+ $(top_builddir)/genmodule$(EXEEXT) $(top_srcdir)/libyasm/module.in Makefile
+
+genmodule.$(OBJEXT): libyasm/genmodule.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f libyasm/genmodule.c || echo '$(srcdir)/'`libyasm/genmodule.c
+
+yasm.1: frontends/yasm/yasm.xml
+ $(XMLTO) -o $(top_builddir) man $(srcdir)/frontends/yasm/yasm.xml
+
+$(srcdir)/frontends/yasm/yasm.c: license.c
+
+license.c: $(srcdir)/COPYING genstring$(EXEEXT)
+ $(top_builddir)/genstring$(EXEEXT) license_msg $@ $(srcdir)/COPYING
+
+distclean-local:
+ -rm -rf results
+ -rm -rf build
+
+all-local: python-build
+install-exec-hook: python-install
+uninstall-hook: python-uninstall
+
+genstring.$(OBJEXT): genstring.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f genstring.c || echo '$(srcdir)/'`genstring.c
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/chromium/third_party/pdfium/third_party/yasm/source/config/openbsd/config.h b/chromium/third_party/pdfium/third_party/yasm/source/config/openbsd/config.h
new file mode 100644
index 00000000000..4f742881c82
--- /dev/null
+++ b/chromium/third_party/pdfium/third_party/yasm/source/config/openbsd/config.h
@@ -0,0 +1,165 @@
+/* config.h. Generated from config.h.in by configure. */
+/* config.h.in. Generated from configure.ac by autoheader. */
+
+/* Command name to run C preprocessor */
+#define CPP_PROG "cc -E"
+
+/* */
+/* #undef ENABLE_NLS */
+
+/* Define to 1 if you have the `abort' function. */
+#define HAVE_ABORT 1
+
+/* */
+/* #undef HAVE_CATGETS */
+
+/* Define if the GNU dcgettext() function is already present or preinstalled.
+ */
+/* #undef HAVE_DCGETTEXT */
+
+/* Define to 1 if you have the <direct.h> header file. */
+/* #undef HAVE_DIRECT_H */
+
+/* Define to 1 if you have the `ftruncate' function. */
+#define HAVE_FTRUNCATE 1
+
+/* Define to 1 if you have the `getcwd' function. */
+#define HAVE_GETCWD 1
+
+/* */
+/* #undef HAVE_GETTEXT */
+
+/* Define to 1 if you have the GNU C Library */
+/* #undef HAVE_GNU_C_LIBRARY */
+
+/* Define if you have the iconv() function and it works. */
+/* #undef HAVE_ICONV */
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* */
+/* #undef HAVE_LC_MESSAGES */
+
+/* Define to 1 if you have the <libgen.h> header file. */
+#define HAVE_LIBGEN_H 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the `mergesort' function. */
+#define HAVE_MERGESORT 1
+
+/* Define to 1 if you have the `popen' function. */
+#define HAVE_POPEN 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* */
+/* #undef HAVE_STPCPY */
+
+/* Define to 1 if you have the `strcasecmp' function. */
+#define HAVE_STRCASECMP 1
+
+/* Define to 1 if you have the `strcmpi' function. */
+/* #undef HAVE_STRCMPI */
+
+/* Define to 1 if you have the `stricmp' function. */
+/* #undef HAVE_STRICMP */
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the `strncasecmp' function. */
+#define HAVE_STRNCASECMP 1
+
+/* Define to 1 if you have the `strsep' function. */
+#define HAVE_STRSEP 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the `toascii' function. */
+#define HAVE_TOASCII 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define to 1 if you have the `vsnprintf' function. */
+#define HAVE_VSNPRINTF 1
+
+/* Define to 1 if you have the `_stricmp' function. */
+/* #undef HAVE__STRICMP */
+
+/* Name of package */
+#define PACKAGE "yasm"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "bug-yasm@tortall.net"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "yasm"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "yasm 1.2.0"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "yasm"
+
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "1.2.0"
+
+/* Define to 1 if the C compiler supports function prototypes. */
+#define PROTOTYPES 1
+
+/* The size of `char', as computed by sizeof. */
+/* #undef SIZEOF_CHAR */
+
+/* The size of `int', as computed by sizeof. */
+/* #undef SIZEOF_INT */
+
+/* The size of `long', as computed by sizeof. */
+/* #undef SIZEOF_LONG */
+
+/* The size of `short', as computed by sizeof. */
+/* #undef SIZEOF_SHORT */
+
+/* The size of `void*', as computed by sizeof. */
+/* #undef SIZEOF_VOIDP */
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Version number of package */
+#define VERSION "1.2.0"
+
+/* Define if using the dmalloc debugging malloc package */
+/* #undef WITH_DMALLOC */
+
+/* Define like PROTOTYPES; this can be used by system headers. */
+#define __PROTOTYPES 1
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef const */
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+ calls it, or to nothing if 'inline' is not supported under any name. */
+#ifndef __cplusplus
+/* #undef inline */
+#endif
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+/* #undef size_t */
diff --git a/chromium/third_party/pdfium/third_party/yasm/source/config/openbsd/libyasm-stdint.h b/chromium/third_party/pdfium/third_party/yasm/source/config/openbsd/libyasm-stdint.h
new file mode 100644
index 00000000000..b875214c894
--- /dev/null
+++ b/chromium/third_party/pdfium/third_party/yasm/source/config/openbsd/libyasm-stdint.h
@@ -0,0 +1,9 @@
+#ifndef _YASM_LIBYASM_STDINT_H
+#define _YASM_LIBYASM_STDINT_H 1
+#ifndef _GENERATED_STDINT_H
+#define _GENERATED_STDINT_H "yasm 1.1.0"
+/* generated using gcc -std=gnu99 */
+#define _STDINT_HAVE_STDINT_H 1
+#include <stdint.h>
+#endif
+#endif
diff --git a/chromium/third_party/pdfium/third_party/yasm/source/config/win/Makefile b/chromium/third_party/pdfium/third_party/yasm/source/config/win/Makefile
new file mode 100644
index 00000000000..6fccce46a99
--- /dev/null
+++ b/chromium/third_party/pdfium/third_party/yasm/source/config/win/Makefile
@@ -0,0 +1,3822 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# Makefile. Generated from Makefile.in by configure.
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+
+
+# $Id: Makefile.am 2184 2009-03-24 05:04:15Z peter $
+
+# $Id: Makefile.inc 2084 2008-05-09 07:08:17Z peter $
+
+# $Id: Makefile.inc 1718 2006-12-24 00:13:19Z peter $
+
+# These utility programs have to be built for BUILD host in cross-build.
+# This makes things rather non-standard automake
+
+# $Id: Makefile.inc 2084 2008-05-09 07:08:17Z peter $
+
+# These utility programs have to be built for BUILD host in cross-build.
+# This makes things rather non-standard automake
+
+# $Id: Makefile.inc 1939 2007-09-10 07:15:50Z peter $
+
+# These utility programs have to be built for BUILD host in cross-build.
+# This makes things rather non-standard automake
+
+# $Id: Makefile.inc 1948 2007-09-13 02:53:30Z peter $
+
+# $Id: Makefile.inc 1951 2007-09-14 05:19:10Z peter $
+
+# $Id: Makefile.inc 1598 2006-08-10 04:02:59Z peter $
+
+# $Id: Makefile.inc 1914 2007-08-20 05:13:35Z peter $
+
+# $Id: Makefile.inc 2111 2008-07-06 22:26:49Z peter $
+
+# $Id: Makefile.inc 2170 2009-01-14 08:28:13Z peter $
+
+# $Id: Makefile.inc 2192 2009-03-29 23:25:05Z peter $
+
+# $Id: Makefile.inc 1776 2007-02-19 02:36:10Z peter $
+
+# $Id: Makefile.inc 2111 2008-07-06 22:26:49Z peter $
+
+# $Id: Makefile.inc 1928 2007-09-07 22:03:34Z peter $
+
+# $Id: Makefile.inc 1152 2004-10-02 06:18:30Z peter $
+
+# $Id: Makefile.inc 1183 2004-12-01 07:49:18Z peter $
+
+# $Id: Makefile.inc 2130 2008-10-07 05:38:11Z peter $
+
+# $Id: Makefile.inc 1783 2007-02-22 03:40:31Z peter $
+
+# $Id: Makefile.inc 2169 2009-01-02 20:46:57Z peter $
+
+# $Id$
+
+# $Id: Makefile.inc 2130 2008-10-07 05:38:11Z peter $
+
+# $Id: Makefile.inc 2190 2009-03-25 03:40:59Z peter $
+
+# $Id: Makefile.inc 1137 2004-09-04 01:24:57Z peter $
+
+# $Id: Makefile.inc 2082 2008-05-09 06:46:02Z peter $
+
+# $Id: Makefile.inc 2063 2008-04-12 08:30:22Z peter $
+
+# $Id: Makefile.inc 2063 2008-04-12 08:30:22Z peter $
+
+# $Id: Makefile.inc 1966 2007-09-20 03:54:36Z peter $
+
+# $Id: Makefile.inc 2130 2008-10-07 05:38:11Z peter $
+
+# $Id: Makefile.inc 2185 2009-03-24 06:33:32Z peter $
+
+# $Id: Makefile.inc 2172 2009-01-27 06:38:14Z peter $
+
+# $Id: Makefile.inc 2176 2009-03-04 07:39:02Z peter $
+
+# Makefile for cpp module.
+# Copied from raw preprocessor module.
+
+# $Id: Makefile.inc 1662 2006-10-21 18:52:29Z peter $
+
+# $Id: Makefile.inc 1428 2006-03-27 02:15:19Z peter $
+
+# $Id: Makefile.inc 1378 2006-02-12 01:27:39Z peter $
+
+# $Id: Makefile.inc 1350 2006-01-29 21:11:03Z peter $
+
+# $Id: Makefile.inc 1851 2007-05-26 17:56:36Z peter $
+
+# $Id: Makefile.inc 1617 2006-09-16 05:43:41Z peter $
+
+# $Id: Makefile.inc 1350 2006-01-29 21:11:03Z peter $
+
+# $Id: Makefile.inc 1183 2004-12-01 07:49:18Z peter $
+
+# $Id: Makefile.inc 1183 2004-12-01 07:49:18Z peter $
+
+# $Id$
+
+# $Id: Makefile.inc 1732 2007-01-13 19:34:04Z peter $
+
+# $Id: Makefile.inc 1183 2004-12-01 07:49:18Z peter $
+
+# $Id: Makefile.inc 2130 2008-10-07 05:38:11Z peter $
+
+# $Id: Makefile.inc 2010 2007-11-14 08:33:32Z peter $
+
+# $Id: Makefile.inc 2010 2007-11-14 08:33:32Z peter $
+
+# $Id: Makefile.inc 1252 2005-09-28 05:50:51Z peter $
+
+# $Id: Makefile.inc 2036 2008-02-09 04:06:47Z peter $
+
+# $Id: Makefile.inc 2126 2008-10-03 08:13:00Z peter $
+
+# $Id: Makefile.inc 2036 2008-02-09 04:06:47Z peter $
+
+# $Id: Makefile.inc 1168 2004-10-31 01:07:52Z peter $
+
+# $Id: Makefile.inc 2082 2008-05-09 06:46:02Z peter $
+
+# $Id: Makefile.inc 1617 2006-09-16 05:43:41Z peter $
+
+# $Id: Makefile.inc 1732 2007-01-13 19:34:04Z peter $
+
+# $Id: Makefile.inc 1777 2007-02-19 08:21:17Z peter $
+
+# $Id: Makefile.inc 1782 2007-02-21 06:45:39Z peter $
+
+# $Id: Makefile.inc 2108 2008-06-05 08:48:21Z peter $
+
+# $Id: Makefile.inc 1854 2007-05-31 06:16:49Z peter $
+
+# $Id: Makefile.inc 2108 2008-06-05 08:48:21Z peter $
+
+# $Id: Makefile.inc 1653 2006-10-17 06:58:41Z peter $
+
+# $Id: Makefile.inc 1653 2006-10-17 06:58:41Z peter $
+
+# $Id: Makefile.inc 1183 2004-12-01 07:49:18Z peter $
+
+# Assume objfmt_coff is included
+
+# $Id: Makefile.inc 2166 2009-01-02 08:33:21Z peter $
+
+# $Id: Makefile.inc 2166 2009-01-02 08:33:21Z peter $
+
+# $Id: Makefile.inc 1331 2006-01-15 22:48:55Z peter $
+
+# Assume objfmt_coff is included
+
+# $Id: Makefile.inc 2120 2008-09-04 04:45:30Z peter $
+
+# $Id: Makefile.inc 2082 2008-05-09 06:46:02Z peter $
+
+# $Id: Makefile.inc 1183 2004-12-01 07:49:18Z peter $
+
+# $Id: Makefile.inc 1851 2007-05-26 17:56:36Z peter $
+
+# $Id: Makefile.inc 2111 2008-07-06 22:26:49Z peter $
+
+# $Id: Makefile.inc 2123 2008-09-30 03:56:37Z peter $
+
+# $Id: Makefile.inc 2130 2008-10-07 05:38:11Z peter $
+
+# $Id: Makefile.inc 1463 2006-04-05 05:39:23Z peter $
+
+# $Id: Makefile.inc 1463 2006-04-05 05:39:23Z peter $
+
+
+
+
+pkgdatadir = $(datadir)/yasm
+pkglibdir = $(libdir)/yasm
+pkgincludedir = $(includedir)/yasm
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = x86_64-unknown-linux-gnu
+host_triplet = x86_64-unknown-linux-gnu
+bin_PROGRAMS = yasm$(EXEEXT) ytasm$(EXEEXT)
+TESTS = $(am__append_3) modules/arch/x86/tests/x86_test.sh \
+ modules/arch/x86/tests/gas32/x86_gas32_test.sh \
+ modules/arch/x86/tests/gas64/x86_gas64_test.sh \
+ modules/arch/lc3b/tests/lc3b_test.sh \
+ modules/parsers/gas/tests/gas_test.sh \
+ modules/parsers/gas/tests/bin/gas_bin_test.sh \
+ modules/parsers/nasm/tests/nasm_test.sh \
+ modules/parsers/nasm/tests/worphan/nasm_worphan_test.sh \
+ modules/parsers/tasm/tests/tasm_test.sh \
+ modules/parsers/tasm/tests/exe/tasm_exe_test.sh \
+ modules/preprocs/nasm/tests/nasmpp_test.sh \
+ modules/preprocs/raw/tests/rawpp_test.sh \
+ modules/dbgfmts/dwarf2/tests/pass32/dwarf2_pass32_test.sh \
+ modules/dbgfmts/dwarf2/tests/pass64/dwarf2_pass64_test.sh \
+ modules/dbgfmts/dwarf2/tests/passwin64/dwarf2_passwin64_test.sh \
+ modules/dbgfmts/stabs/tests/stabs_test.sh \
+ modules/objfmts/bin/tests/bin_test.sh \
+ modules/objfmts/bin/tests/multisect/bin_multi_test.sh \
+ modules/objfmts/elf/tests/elf_test.sh \
+ modules/objfmts/elf/tests/amd64/elf_amd64_test.sh \
+ modules/objfmts/elf/tests/gas32/elf_gas32_test.sh \
+ modules/objfmts/elf/tests/gas64/elf_gas64_test.sh \
+ modules/objfmts/coff/tests/coff_test.sh \
+ modules/objfmts/macho/tests/gas32/gas_macho32_test.sh \
+ modules/objfmts/macho/tests/gas64/gas_macho64_test.sh \
+ modules/objfmts/macho/tests/nasm32/macho32_test.sh \
+ modules/objfmts/macho/tests/nasm64/macho64_test.sh \
+ modules/objfmts/rdf/tests/rdf_test.sh \
+ modules/objfmts/win32/tests/win32_test.sh \
+ modules/objfmts/win32/tests/gas/win32_gas_test.sh \
+ modules/objfmts/win64/tests/win64_test.sh \
+ modules/objfmts/win64/tests/gas/win64_gas_test.sh \
+ modules/objfmts/xdf/tests/xdf_test.sh bitvect_test$(EXEEXT) \
+ floatnum_test$(EXEEXT) leb128_test$(EXEEXT) \
+ splitpath_test$(EXEEXT) combpath_test$(EXEEXT) \
+ uncstring_test$(EXEEXT) libyasm/tests/libyasm_test.sh
+noinst_PROGRAMS = genstring$(EXEEXT) re2c$(EXEEXT) genmacro$(EXEEXT) \
+ genperf$(EXEEXT) genversion$(EXEEXT) genmodule$(EXEEXT)
+check_PROGRAMS = test_hd$(EXEEXT) bitvect_test$(EXEEXT) \
+ floatnum_test$(EXEEXT) leb128_test$(EXEEXT) \
+ splitpath_test$(EXEEXT) combpath_test$(EXEEXT) \
+ uncstring_test$(EXEEXT)
+DIST_COMMON = README $(am__configure_deps) $(dist_man_MANS) \
+ $(include_HEADERS) $(modinclude_HEADERS) $(noinst_HEADERS) \
+ $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(srcdir)/config.h.in $(srcdir)/frontends/Makefile.inc \
+ $(srcdir)/frontends/tasm/Makefile.inc \
+ $(srcdir)/frontends/yasm/Makefile.inc \
+ $(srcdir)/libyasm/Makefile.inc \
+ $(srcdir)/libyasm/tests/Makefile.inc $(srcdir)/m4/Makefile.inc \
+ $(srcdir)/modules/Makefile.inc \
+ $(srcdir)/modules/arch/Makefile.inc \
+ $(srcdir)/modules/arch/lc3b/Makefile.inc \
+ $(srcdir)/modules/arch/lc3b/tests/Makefile.inc \
+ $(srcdir)/modules/arch/x86/Makefile.inc \
+ $(srcdir)/modules/arch/x86/tests/Makefile.inc \
+ $(srcdir)/modules/arch/x86/tests/gas32/Makefile.inc \
+ $(srcdir)/modules/arch/x86/tests/gas64/Makefile.inc \
+ $(srcdir)/modules/dbgfmts/Makefile.inc \
+ $(srcdir)/modules/dbgfmts/codeview/Makefile.inc \
+ $(srcdir)/modules/dbgfmts/dwarf2/Makefile.inc \
+ $(srcdir)/modules/dbgfmts/dwarf2/tests/Makefile.inc \
+ $(srcdir)/modules/dbgfmts/dwarf2/tests/pass32/Makefile.inc \
+ $(srcdir)/modules/dbgfmts/dwarf2/tests/pass64/Makefile.inc \
+ $(srcdir)/modules/dbgfmts/dwarf2/tests/passwin64/Makefile.inc \
+ $(srcdir)/modules/dbgfmts/null/Makefile.inc \
+ $(srcdir)/modules/dbgfmts/stabs/Makefile.inc \
+ $(srcdir)/modules/dbgfmts/stabs/tests/Makefile.inc \
+ $(srcdir)/modules/listfmts/Makefile.inc \
+ $(srcdir)/modules/listfmts/nasm/Makefile.inc \
+ $(srcdir)/modules/objfmts/Makefile.inc \
+ $(srcdir)/modules/objfmts/bin/Makefile.inc \
+ $(srcdir)/modules/objfmts/bin/tests/Makefile.inc \
+ $(srcdir)/modules/objfmts/bin/tests/multisect/Makefile.inc \
+ $(srcdir)/modules/objfmts/coff/Makefile.inc \
+ $(srcdir)/modules/objfmts/coff/tests/Makefile.inc \
+ $(srcdir)/modules/objfmts/dbg/Makefile.inc \
+ $(srcdir)/modules/objfmts/elf/Makefile.inc \
+ $(srcdir)/modules/objfmts/elf/tests/Makefile.inc \
+ $(srcdir)/modules/objfmts/elf/tests/amd64/Makefile.inc \
+ $(srcdir)/modules/objfmts/elf/tests/gas32/Makefile.inc \
+ $(srcdir)/modules/objfmts/elf/tests/gas64/Makefile.inc \
+ $(srcdir)/modules/objfmts/macho/Makefile.inc \
+ $(srcdir)/modules/objfmts/macho/tests/Makefile.inc \
+ $(srcdir)/modules/objfmts/macho/tests/gas32/Makefile.inc \
+ $(srcdir)/modules/objfmts/macho/tests/gas64/Makefile.inc \
+ $(srcdir)/modules/objfmts/macho/tests/nasm32/Makefile.inc \
+ $(srcdir)/modules/objfmts/macho/tests/nasm64/Makefile.inc \
+ $(srcdir)/modules/objfmts/rdf/Makefile.inc \
+ $(srcdir)/modules/objfmts/rdf/tests/Makefile.inc \
+ $(srcdir)/modules/objfmts/win32/Makefile.inc \
+ $(srcdir)/modules/objfmts/win32/tests/Makefile.inc \
+ $(srcdir)/modules/objfmts/win32/tests/gas/Makefile.inc \
+ $(srcdir)/modules/objfmts/win64/Makefile.inc \
+ $(srcdir)/modules/objfmts/win64/tests/Makefile.inc \
+ $(srcdir)/modules/objfmts/win64/tests/gas/Makefile.inc \
+ $(srcdir)/modules/objfmts/xdf/Makefile.inc \
+ $(srcdir)/modules/objfmts/xdf/tests/Makefile.inc \
+ $(srcdir)/modules/parsers/Makefile.inc \
+ $(srcdir)/modules/parsers/gas/Makefile.inc \
+ $(srcdir)/modules/parsers/gas/tests/Makefile.inc \
+ $(srcdir)/modules/parsers/gas/tests/bin/Makefile.inc \
+ $(srcdir)/modules/parsers/nasm/Makefile.inc \
+ $(srcdir)/modules/parsers/nasm/tests/Makefile.inc \
+ $(srcdir)/modules/parsers/nasm/tests/worphan/Makefile.inc \
+ $(srcdir)/modules/parsers/tasm/Makefile.inc \
+ $(srcdir)/modules/parsers/tasm/tests/Makefile.inc \
+ $(srcdir)/modules/parsers/tasm/tests/exe/Makefile.inc \
+ $(srcdir)/modules/preprocs/Makefile.inc \
+ $(srcdir)/modules/preprocs/cpp/Makefile.inc \
+ $(srcdir)/modules/preprocs/nasm/Makefile.inc \
+ $(srcdir)/modules/preprocs/nasm/tests/Makefile.inc \
+ $(srcdir)/modules/preprocs/raw/Makefile.inc \
+ $(srcdir)/modules/preprocs/raw/tests/Makefile.inc \
+ $(srcdir)/tools/Makefile.inc \
+ $(srcdir)/tools/genmacro/Makefile.inc \
+ $(srcdir)/tools/genperf/Makefile.inc \
+ $(srcdir)/tools/python-yasm/Makefile.inc \
+ $(srcdir)/tools/python-yasm/tests/Makefile.inc \
+ $(srcdir)/tools/re2c/Makefile.inc $(top_srcdir)/configure \
+ ABOUT-NLS AUTHORS COPYING ChangeLog INSTALL NEWS \
+ config/config.guess config/config.rpath config/config.sub \
+ config/depcomp config/install-sh config/ltmain.sh \
+ config/missing
+#am__append_1 = _yasm.pxi yasm.pyx \
+# yasm_python.c python-setup.txt \
+# .python-build
+#am__append_2 = PYTHON=${PYTHON}
+#am__append_3 = tools/python-yasm/tests/python_test.sh
+am__append_4 = $(dist_man_MANS)
+subdir = .
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/ax_create_stdint_h.m4 \
+ $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/iconv.m4 \
+ $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
+ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/nls.m4 \
+ $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \
+ $(top_srcdir)/m4/pyrex.m4 $(top_srcdir)/m4/pythonhead.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
+ configure.lineno config.status.lineno
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = config.h
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \
+ "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man7dir)" \
+ "$(DESTDIR)$(includedir)" "$(DESTDIR)$(modincludedir)" \
+ "$(DESTDIR)$(includedir)"
+libLIBRARIES_INSTALL = $(INSTALL_DATA)
+LIBRARIES = $(lib_LIBRARIES)
+AR = ar
+ARFLAGS = cru
+libyasm_a_AR = $(AR) $(ARFLAGS)
+libyasm_a_LIBADD =
+am_libyasm_a_OBJECTS = x86arch.$(OBJEXT) x86bc.$(OBJEXT) \
+ x86expr.$(OBJEXT) x86id.$(OBJEXT) lc3barch.$(OBJEXT) \
+ lc3bbc.$(OBJEXT) nasm-listfmt.$(OBJEXT) gas-parser.$(OBJEXT) \
+ gas-parse.$(OBJEXT) nasm-parser.$(OBJEXT) nasm-parse.$(OBJEXT) \
+ nasm-preproc.$(OBJEXT) nasm-pp.$(OBJEXT) nasmlib.$(OBJEXT) \
+ nasm-eval.$(OBJEXT) raw-preproc.$(OBJEXT) \
+ cpp-preproc.$(OBJEXT) cv-dbgfmt.$(OBJEXT) cv-symline.$(OBJEXT) \
+ cv-type.$(OBJEXT) dwarf2-dbgfmt.$(OBJEXT) \
+ dwarf2-line.$(OBJEXT) dwarf2-aranges.$(OBJEXT) \
+ dwarf2-info.$(OBJEXT) null-dbgfmt.$(OBJEXT) \
+ stabs-dbgfmt.$(OBJEXT) dbg-objfmt.$(OBJEXT) \
+ bin-objfmt.$(OBJEXT) elf.$(OBJEXT) elf-objfmt.$(OBJEXT) \
+ elf-x86-x86.$(OBJEXT) elf-x86-amd64.$(OBJEXT) \
+ coff-objfmt.$(OBJEXT) win64-except.$(OBJEXT) \
+ macho-objfmt.$(OBJEXT) rdf-objfmt.$(OBJEXT) \
+ xdf-objfmt.$(OBJEXT) assocdat.$(OBJEXT) bitvect.$(OBJEXT) \
+ bc-align.$(OBJEXT) bc-data.$(OBJEXT) bc-incbin.$(OBJEXT) \
+ bc-org.$(OBJEXT) bc-reserve.$(OBJEXT) bytecode.$(OBJEXT) \
+ errwarn.$(OBJEXT) expr.$(OBJEXT) file.$(OBJEXT) \
+ floatnum.$(OBJEXT) hamt.$(OBJEXT) insn.$(OBJEXT) \
+ intnum.$(OBJEXT) inttree.$(OBJEXT) linemap.$(OBJEXT) \
+ md5.$(OBJEXT) mergesort.$(OBJEXT) phash.$(OBJEXT) \
+ section.$(OBJEXT) strcasecmp.$(OBJEXT) strsep.$(OBJEXT) \
+ symrec.$(OBJEXT) valparam.$(OBJEXT) value.$(OBJEXT) \
+ xmalloc.$(OBJEXT) xstrdup.$(OBJEXT)
+nodist_libyasm_a_OBJECTS = x86cpu.$(OBJEXT) x86regtmod.$(OBJEXT) \
+ lc3bid.$(OBJEXT) gas-token.$(OBJEXT) nasm-token.$(OBJEXT) \
+ module.$(OBJEXT)
+libyasm_a_OBJECTS = $(am_libyasm_a_OBJECTS) \
+ $(nodist_libyasm_a_OBJECTS)
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS)
+am_bitvect_test_OBJECTS = bitvect_test.$(OBJEXT)
+bitvect_test_OBJECTS = $(am_bitvect_test_OBJECTS)
+am__DEPENDENCIES_1 =
+bitvect_test_DEPENDENCIES = libyasm.a $(am__DEPENDENCIES_1)
+am_combpath_test_OBJECTS = combpath_test.$(OBJEXT)
+combpath_test_OBJECTS = $(am_combpath_test_OBJECTS)
+combpath_test_DEPENDENCIES = libyasm.a $(am__DEPENDENCIES_1)
+am_floatnum_test_OBJECTS = floatnum_test.$(OBJEXT)
+floatnum_test_OBJECTS = $(am_floatnum_test_OBJECTS)
+floatnum_test_DEPENDENCIES = libyasm.a $(am__DEPENDENCIES_1)
+am_genmacro_OBJECTS =
+genmacro_OBJECTS = $(am_genmacro_OBJECTS)
+genmacro_DEPENDENCIES = genmacro.$(OBJEXT)
+am_genmodule_OBJECTS =
+genmodule_OBJECTS = $(am_genmodule_OBJECTS)
+genmodule_DEPENDENCIES = genmodule.$(OBJEXT)
+am_genperf_OBJECTS =
+genperf_OBJECTS = $(am_genperf_OBJECTS)
+genperf_DEPENDENCIES = genperf.$(OBJEXT) gp-perfect.$(OBJEXT) \
+ gp-phash.$(OBJEXT) gp-xmalloc.$(OBJEXT) gp-xstrdup.$(OBJEXT)
+am_genstring_OBJECTS =
+genstring_OBJECTS = $(am_genstring_OBJECTS)
+genstring_DEPENDENCIES = genstring.$(OBJEXT)
+am_genversion_OBJECTS =
+genversion_OBJECTS = $(am_genversion_OBJECTS)
+genversion_DEPENDENCIES = genversion.$(OBJEXT)
+am_leb128_test_OBJECTS = leb128_test.$(OBJEXT)
+leb128_test_OBJECTS = $(am_leb128_test_OBJECTS)
+leb128_test_DEPENDENCIES = libyasm.a $(am__DEPENDENCIES_1)
+am_re2c_OBJECTS =
+re2c_OBJECTS = $(am_re2c_OBJECTS)
+re2c_DEPENDENCIES = re2c-main.$(OBJEXT) re2c-code.$(OBJEXT) \
+ re2c-dfa.$(OBJEXT) re2c-parser.$(OBJEXT) \
+ re2c-actions.$(OBJEXT) re2c-scanner.$(OBJEXT) \
+ re2c-mbo_getopt.$(OBJEXT) re2c-substr.$(OBJEXT) \
+ re2c-translate.$(OBJEXT)
+am_splitpath_test_OBJECTS = splitpath_test.$(OBJEXT)
+splitpath_test_OBJECTS = $(am_splitpath_test_OBJECTS)
+splitpath_test_DEPENDENCIES = libyasm.a $(am__DEPENDENCIES_1)
+am_test_hd_OBJECTS = test_hd.$(OBJEXT)
+test_hd_OBJECTS = $(am_test_hd_OBJECTS)
+test_hd_LDADD = $(LDADD)
+am_uncstring_test_OBJECTS = uncstring_test.$(OBJEXT)
+uncstring_test_OBJECTS = $(am_uncstring_test_OBJECTS)
+uncstring_test_DEPENDENCIES = libyasm.a $(am__DEPENDENCIES_1)
+am_yasm_OBJECTS = yasm.$(OBJEXT) yasm-options.$(OBJEXT)
+yasm_OBJECTS = $(am_yasm_OBJECTS)
+yasm_DEPENDENCIES = libyasm.a $(am__DEPENDENCIES_1)
+am_ytasm_OBJECTS = tasm.$(OBJEXT) tasm-options.$(OBJEXT)
+ytasm_OBJECTS = $(am_ytasm_OBJECTS)
+ytasm_DEPENDENCIES = libyasm.a $(am__DEPENDENCIES_1)
+DEFAULT_INCLUDES = -I.
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libyasm_a_SOURCES) $(nodist_libyasm_a_SOURCES) \
+ $(bitvect_test_SOURCES) $(combpath_test_SOURCES) \
+ $(floatnum_test_SOURCES) $(genmacro_SOURCES) \
+ $(genmodule_SOURCES) $(genperf_SOURCES) $(genstring_SOURCES) \
+ $(genversion_SOURCES) $(leb128_test_SOURCES) $(re2c_SOURCES) \
+ $(splitpath_test_SOURCES) $(test_hd_SOURCES) \
+ $(uncstring_test_SOURCES) $(yasm_SOURCES) $(ytasm_SOURCES)
+DIST_SOURCES = $(libyasm_a_SOURCES) $(bitvect_test_SOURCES) \
+ $(combpath_test_SOURCES) $(floatnum_test_SOURCES) \
+ $(genmacro_SOURCES) $(genmodule_SOURCES) $(genperf_SOURCES) \
+ $(genstring_SOURCES) $(genversion_SOURCES) \
+ $(leb128_test_SOURCES) $(re2c_SOURCES) \
+ $(splitpath_test_SOURCES) $(test_hd_SOURCES) \
+ $(uncstring_test_SOURCES) $(yasm_SOURCES) $(ytasm_SOURCES)
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-dvi-recursive install-exec-recursive \
+ install-html-recursive install-info-recursive \
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
+man1dir = $(mandir)/man1
+man7dir = $(mandir)/man7
+NROFF = nroff
+MANS = $(dist_man_MANS)
+includeHEADERS_INSTALL = $(INSTALL_HEADER)
+modincludeHEADERS_INSTALL = $(INSTALL_HEADER)
+nodist_includeHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(include_HEADERS) $(modinclude_HEADERS) \
+ $(nodist_include_HEADERS) $(noinst_HEADERS)
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+distdir = $(PACKAGE)-$(VERSION)
+top_distdir = $(distdir)
+am__remove_distdir = \
+ { test ! -d $(distdir) \
+ || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
+ && rm -fr $(distdir); }; }
+DIST_ARCHIVES = $(distdir).tar.gz
+GZIP_ENV = --best
+distuninstallcheck_listfiles = find . -type f -print
+distcleancheck_listfiles = find . -type f -print
+ACLOCAL = ${SHELL} /tmp/yasm/config/missing --run aclocal-1.10
+AMTAR = ${SHELL} /tmp/yasm/config/missing --run tar
+ARCH = x86
+AUTOCONF = ${SHELL} /tmp/yasm/config/missing --run autoconf
+AUTOHEADER = ${SHELL} /tmp/yasm/config/missing --run autoheader
+AUTOMAKE = ${SHELL} /tmp/yasm/config/missing --run automake-1.10
+AWK = gawk
+CC = gcc -std=gnu99
+CCDEPMODE = depmode=gcc3
+CCLD_FOR_BUILD = gcc -std=gnu99
+CC_FOR_BUILD = gcc -std=gnu99
+CFLAGS = -g -O2
+CPP = gcc -E
+CPPFLAGS =
+CYGPATH_W = echo
+DEFS = -DHAVE_CONFIG_H
+DEPDIR = .deps
+ECHO_C =
+ECHO_N = -n
+ECHO_T =
+EGREP = /bin/grep -E
+EXEEXT =
+GCC = yes
+GMSGFMT = /usr/bin/msgfmt
+GMSGFMT_015 = /usr/bin/msgfmt
+GREP = /bin/grep
+HOST_CC = gcc -std=gnu99
+INSTALL = /usr/bin/install -c
+INSTALL_DATA = ${INSTALL} -m 644
+INSTALL_PROGRAM = ${INSTALL}
+INSTALL_SCRIPT = ${INSTALL}
+INSTALL_STRIP_PROGRAM = $(install_sh) -c -s
+INTLLIBS =
+INTL_MACOSX_LIBS =
+LDFLAGS =
+LIBICONV = -liconv
+LIBINTL =
+LIBOBJS =
+LIBS =
+LN_S = ln -s
+LTLIBICONV = -liconv
+LTLIBINTL =
+LTLIBOBJS =
+MAINT =
+MAKEINFO = ${SHELL} /tmp/yasm/config/missing --run makeinfo
+MKDIR_P = /bin/mkdir -p
+MORE_CFLAGS = -ansi -pedantic -Wall -W -Waggregate-return -Wbad-function-cast -Wcast-align -Wcast-qual -Wchar-subscripts -Winline -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wreturn-type -Wshadow -Wsign-compare -Wstrict-prototypes -Wswitch -Wwrite-strings -Wno-undef -Wno-unused-parameter
+MSGFMT = /usr/bin/msgfmt
+MSGFMT_015 = /usr/bin/msgfmt
+MSGMERGE = /usr/bin/msgmerge
+OBJEXT = o
+PACKAGE = yasm
+PACKAGE_BUGREPORT = bug-yasm@tortall.net
+PACKAGE_NAME = yasm
+PACKAGE_STRING = yasm HEAD
+PACKAGE_TARNAME = yasm
+PACKAGE_VERSION = HEAD
+PATH_SEPARATOR = :
+POSUB = po
+PYTHON = /usr/bin/python
+PYTHON_EXEC_PREFIX = ${exec_prefix}
+PYTHON_INCLUDES =
+PYTHON_PLATFORM = linux2
+PYTHON_PREFIX = ${prefix}
+PYTHON_VERSION = 2.5
+RANLIB = ranlib
+SET_MAKE =
+SHELL = /bin/sh
+STRIP =
+USE_NLS = yes
+VERSION = HEAD
+XGETTEXT = /usr/bin/xgettext
+XGETTEXT_015 = /usr/bin/xgettext
+XMLTO = xmlto
+abs_builddir = /tmp/yasm
+abs_srcdir = /tmp/yasm
+abs_top_builddir = /tmp/yasm
+abs_top_srcdir = /tmp/yasm
+ac_ct_CC = gcc
+am__include = include
+am__leading_dot = .
+am__quote =
+am__tar = ${AMTAR} chof - "$$tardir"
+am__untar = ${AMTAR} xf -
+bindir = ${exec_prefix}/bin
+build = x86_64-unknown-linux-gnu
+build_alias =
+build_cpu = x86_64
+build_os = linux-gnu
+build_vendor = unknown
+builddir = .
+datadir = ${datarootdir}
+datarootdir = ${prefix}/share
+docdir = ${datarootdir}/doc/${PACKAGE_TARNAME}
+dvidir = ${docdir}
+exec_prefix = ${prefix}
+host = x86_64-unknown-linux-gnu
+host_alias =
+host_cpu = x86_64
+host_os = linux-gnu
+host_vendor = unknown
+htmldir = ${docdir}
+includedir = ${prefix}/include
+infodir = ${datarootdir}/info
+install_sh = $(SHELL) /tmp/yasm/config/install-sh
+libdir = ${exec_prefix}/lib
+libexecdir = ${exec_prefix}/libexec
+localedir = ${datarootdir}/locale
+localstatedir = ${prefix}/var
+mandir = ${datarootdir}/man
+mkdir_p = /bin/mkdir -p
+oldincludedir = /usr/include
+pdfdir = ${docdir}
+pkgpyexecdir = ${pyexecdir}/yasm
+pkgpythondir = ${pythondir}/yasm
+prefix = /usr/local
+program_transform_name = s,x,x,
+psdir = ${docdir}
+pyexecdir = ${exec_prefix}/lib/python2.5/site-packages
+pythondir = ${prefix}/lib/python2.5/site-packages
+sbindir = ${exec_prefix}/sbin
+sharedstatedir = ${prefix}/com
+srcdir = .
+sysconfdir = ${prefix}/etc
+target_alias =
+top_builddir = .
+top_srcdir = .
+SUBDIRS = po .
+AM_YFLAGS = -d
+AM_CFLAGS = -ansi -pedantic -Wall -W -Waggregate-return -Wbad-function-cast -Wcast-align -Wcast-qual -Wchar-subscripts -Winline -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wreturn-type -Wshadow -Wsign-compare -Wstrict-prototypes -Wswitch -Wwrite-strings -Wno-undef -Wno-unused-parameter
+
+#!include modules/objfmts/omf/Makefile.inc
+dist_man_MANS = yasm_arch.7 yasm_parsers.7 yasm_dbgfmts.7 \
+ yasm_objfmts.7 yasm.1
+TESTS_ENVIRONMENT = $(am__append_2)
+test_hd_SOURCES = test_hd.c
+include_HEADERS = libyasm.h
+nodist_include_HEADERS = libyasm-stdint.h
+noinst_HEADERS = util.h
+BUILT_SOURCES = x86insns.c x86insn_nasm.gperf x86insn_gas.gperf \
+ x86insn_nasm.c x86insn_gas.c gas-token.c nasm-token.c \
+ nasm-macros.c nasm-version.c version.mac win64-nasm.c \
+ win64-gas.c license.c
+MAINTAINERCLEANFILES = x86insns.c x86insn_nasm.gperf x86insn_gas.gperf \
+ $(am__append_4)
+
+# Until this gets fixed in automake
+DISTCLEANFILES = libyasm/stamp-h libyasm/stamp-h[0-9]*
+
+# Suffix rule for genperf
+SUFFIXES = .gperf
+
+# configure.lineno doesn't clean up after itself?
+CLEANFILES = configure.lineno $(am__append_1) x86insn_nasm.c \
+ x86insn_gas.c x86cpu.c x86regtmod.c lc3bid.c gas-token.c \
+ nasm-token.c nasm-macros.c nasm-version.c version.mac \
+ win64-nasm.c win64-gas.c module.c license.c
+
+# automake doesn't distribute mkinstalldirs?
+#!EXTRA_DIST += modules/objfmts/omf/Makefile.inc
+EXTRA_DIST = config/config.rpath config/mkinstalldirs \
+ tools/Makefile.inc libyasm/Makefile.inc modules/Makefile.inc \
+ frontends/Makefile.inc tools/re2c/Makefile.inc \
+ tools/genmacro/Makefile.inc tools/genperf/Makefile.inc \
+ tools/python-yasm/Makefile.inc tools/re2c/main.c \
+ tools/re2c/basics.h tools/re2c/globals.h tools/re2c/ins.h \
+ tools/re2c/re.h tools/re2c/token.h tools/re2c/code.c \
+ tools/re2c/dfa.h tools/re2c/dfa.c tools/re2c/parse.h \
+ tools/re2c/parser.h tools/re2c/parser.c tools/re2c/actions.c \
+ tools/re2c/scanner.h tools/re2c/scanner.c \
+ tools/re2c/mbo_getopt.h tools/re2c/mbo_getopt.c \
+ tools/re2c/substr.h tools/re2c/substr.c tools/re2c/translate.c \
+ tools/re2c/CHANGELOG tools/re2c/NO_WARRANTY tools/re2c/README \
+ tools/re2c/scanner.re tools/re2c/re2c.1 \
+ tools/re2c/bootstrap/scanner.c tools/re2c/doc/loplas.ps.gz \
+ tools/re2c/doc/sample.bib tools/re2c/examples/basemmap.c \
+ tools/re2c/examples/c.re tools/re2c/examples/cmmap.re \
+ tools/re2c/examples/cnokw.re tools/re2c/examples/cunroll.re \
+ tools/re2c/examples/modula.re tools/re2c/examples/repeater.re \
+ tools/re2c/examples/sample.re tools/re2c/examples/simple.re \
+ tools/re2c/examples/rexx/README \
+ tools/re2c/examples/rexx/rexx.l \
+ tools/re2c/examples/rexx/scanio.c tools/genmacro/genmacro.c \
+ tools/genperf/genperf.c tools/genperf/perfect.c \
+ tools/genperf/perfect.h tools/genperf/standard.h \
+ tools/python-yasm/pyxelator/cparse.py \
+ tools/python-yasm/pyxelator/genpyx.py \
+ tools/python-yasm/pyxelator/ir.py \
+ tools/python-yasm/pyxelator/lexer.py \
+ tools/python-yasm/pyxelator/node.py \
+ tools/python-yasm/pyxelator/parse_core.py \
+ tools/python-yasm/pyxelator/work_unit.py \
+ tools/python-yasm/pyxelator/wrap_yasm.py \
+ tools/python-yasm/setup.py tools/python-yasm/yasm.pyx \
+ $(PYBINDING_DEPS) tools/python-yasm/tests/Makefile.inc \
+ tools/python-yasm/tests/python_test.sh \
+ tools/python-yasm/tests/__init__.py \
+ tools/python-yasm/tests/test_bytecode.py \
+ tools/python-yasm/tests/test_expr.py \
+ tools/python-yasm/tests/test_intnum.py \
+ tools/python-yasm/tests/test_symrec.py \
+ modules/arch/Makefile.inc modules/listfmts/Makefile.inc \
+ modules/parsers/Makefile.inc modules/preprocs/Makefile.inc \
+ modules/objfmts/Makefile.inc modules/arch/x86/Makefile.inc \
+ modules/arch/lc3b/Makefile.inc \
+ modules/arch/x86/gen_x86_insn.py x86insns.c x86insn_nasm.gperf \
+ x86insn_gas.gperf modules/arch/x86/x86cpu.gperf \
+ modules/arch/x86/x86regtmod.gperf \
+ modules/arch/x86/tests/Makefile.inc \
+ modules/arch/x86/tests/x86_test.sh \
+ modules/arch/x86/tests/gen-fma-test.py \
+ modules/arch/x86/tests/addbyte.asm \
+ modules/arch/x86/tests/addbyte.errwarn \
+ modules/arch/x86/tests/addbyte.hex \
+ modules/arch/x86/tests/addrop.asm \
+ modules/arch/x86/tests/addrop.errwarn \
+ modules/arch/x86/tests/addrop.hex \
+ modules/arch/x86/tests/addrop-err.asm \
+ modules/arch/x86/tests/addrop-err.errwarn \
+ modules/arch/x86/tests/aes.asm modules/arch/x86/tests/aes.hex \
+ modules/arch/x86/tests/amd200707.asm \
+ modules/arch/x86/tests/amd200707.hex \
+ modules/arch/x86/tests/arithsmall.asm \
+ modules/arch/x86/tests/arithsmall.errwarn \
+ modules/arch/x86/tests/arithsmall.hex \
+ modules/arch/x86/tests/avx.asm modules/arch/x86/tests/avx.hex \
+ modules/arch/x86/tests/avxcc.asm \
+ modules/arch/x86/tests/avxcc.hex \
+ modules/arch/x86/tests/bittest.asm \
+ modules/arch/x86/tests/bittest.hex \
+ modules/arch/x86/tests/bswap64.asm \
+ modules/arch/x86/tests/bswap64.hex \
+ modules/arch/x86/tests/clmul.asm \
+ modules/arch/x86/tests/clmul.hex \
+ modules/arch/x86/tests/cmpxchg.asm \
+ modules/arch/x86/tests/cmpxchg.hex \
+ modules/arch/x86/tests/cpubasic-err.asm \
+ modules/arch/x86/tests/cpubasic-err.errwarn \
+ modules/arch/x86/tests/cyrix.asm \
+ modules/arch/x86/tests/cyrix.hex \
+ modules/arch/x86/tests/div-err.asm \
+ modules/arch/x86/tests/div-err.errwarn \
+ modules/arch/x86/tests/ea-nonzero.asm \
+ modules/arch/x86/tests/ea-nonzero.hex \
+ modules/arch/x86/tests/ea-over.asm \
+ modules/arch/x86/tests/ea-over.errwarn \
+ modules/arch/x86/tests/ea-over.hex \
+ modules/arch/x86/tests/ea-warn.asm \
+ modules/arch/x86/tests/ea-warn.errwarn \
+ modules/arch/x86/tests/ea-warn.hex \
+ modules/arch/x86/tests/ebpindex.asm \
+ modules/arch/x86/tests/ebpindex.hex \
+ modules/arch/x86/tests/effaddr.asm \
+ modules/arch/x86/tests/effaddr.hex \
+ modules/arch/x86/tests/enter.asm \
+ modules/arch/x86/tests/enter.errwarn \
+ modules/arch/x86/tests/enter.hex \
+ modules/arch/x86/tests/far64.asm \
+ modules/arch/x86/tests/far64.hex \
+ modules/arch/x86/tests/farbasic.asm \
+ modules/arch/x86/tests/farbasic.hex \
+ modules/arch/x86/tests/farithr.asm \
+ modules/arch/x86/tests/farithr.hex \
+ modules/arch/x86/tests/fcmov.asm \
+ modules/arch/x86/tests/fcmov.hex \
+ modules/arch/x86/tests/fma.asm modules/arch/x86/tests/fma.hex \
+ modules/arch/x86/tests/fwdequ64.asm \
+ modules/arch/x86/tests/fwdequ64.hex \
+ modules/arch/x86/tests/genopcode.asm \
+ modules/arch/x86/tests/genopcode.hex \
+ modules/arch/x86/tests/imm64.asm \
+ modules/arch/x86/tests/imm64.errwarn \
+ modules/arch/x86/tests/imm64.hex \
+ modules/arch/x86/tests/iret.asm \
+ modules/arch/x86/tests/iret.hex \
+ modules/arch/x86/tests/jmp64-1.asm \
+ modules/arch/x86/tests/jmp64-1.hex \
+ modules/arch/x86/tests/jmp64-2.asm \
+ modules/arch/x86/tests/jmp64-2.hex \
+ modules/arch/x86/tests/jmp64-3.asm \
+ modules/arch/x86/tests/jmp64-3.hex \
+ modules/arch/x86/tests/jmp64-4.asm \
+ modules/arch/x86/tests/jmp64-4.hex \
+ modules/arch/x86/tests/jmp64-5.asm \
+ modules/arch/x86/tests/jmp64-5.hex \
+ modules/arch/x86/tests/jmp64-6.asm \
+ modules/arch/x86/tests/jmp64-6.hex \
+ modules/arch/x86/tests/jmpfar.asm \
+ modules/arch/x86/tests/jmpfar.hex \
+ modules/arch/x86/tests/lds.asm modules/arch/x86/tests/lds.hex \
+ modules/arch/x86/tests/loopadsz.asm \
+ modules/arch/x86/tests/loopadsz.hex \
+ modules/arch/x86/tests/lsahf.asm \
+ modules/arch/x86/tests/lsahf.hex \
+ modules/arch/x86/tests/mem64-err.asm \
+ modules/arch/x86/tests/mem64-err.errwarn \
+ modules/arch/x86/tests/mem64.asm \
+ modules/arch/x86/tests/mem64.errwarn \
+ modules/arch/x86/tests/mem64.hex \
+ modules/arch/x86/tests/mem64hi32.asm \
+ modules/arch/x86/tests/mem64hi32.hex \
+ modules/arch/x86/tests/mem64rip.asm \
+ modules/arch/x86/tests/mem64rip.hex \
+ modules/arch/x86/tests/mixcase.asm \
+ modules/arch/x86/tests/mixcase.hex \
+ modules/arch/x86/tests/movbe.asm \
+ modules/arch/x86/tests/movbe.hex \
+ modules/arch/x86/tests/movdq32.asm \
+ modules/arch/x86/tests/movdq32.hex \
+ modules/arch/x86/tests/movdq64.asm \
+ modules/arch/x86/tests/movdq64.hex \
+ modules/arch/x86/tests/negequ.asm \
+ modules/arch/x86/tests/negequ.hex \
+ modules/arch/x86/tests/nomem64-err.asm \
+ modules/arch/x86/tests/nomem64-err.errwarn \
+ modules/arch/x86/tests/nomem64-err2.asm \
+ modules/arch/x86/tests/nomem64-err2.errwarn \
+ modules/arch/x86/tests/nomem64.asm \
+ modules/arch/x86/tests/nomem64.errwarn \
+ modules/arch/x86/tests/nomem64.hex \
+ modules/arch/x86/tests/o64.asm modules/arch/x86/tests/o64.hex \
+ modules/arch/x86/tests/o64loop.asm \
+ modules/arch/x86/tests/o64loop.errwarn \
+ modules/arch/x86/tests/o64loop.hex \
+ modules/arch/x86/tests/opersize.asm \
+ modules/arch/x86/tests/opersize.hex \
+ modules/arch/x86/tests/opsize-err.asm \
+ modules/arch/x86/tests/opsize-err.errwarn \
+ modules/arch/x86/tests/overflow.asm \
+ modules/arch/x86/tests/overflow.errwarn \
+ modules/arch/x86/tests/overflow.hex \
+ modules/arch/x86/tests/padlock.asm \
+ modules/arch/x86/tests/padlock.hex \
+ modules/arch/x86/tests/pshift.asm \
+ modules/arch/x86/tests/pshift.hex \
+ modules/arch/x86/tests/push64.asm \
+ modules/arch/x86/tests/push64.errwarn \
+ modules/arch/x86/tests/push64.hex \
+ modules/arch/x86/tests/pushf.asm \
+ modules/arch/x86/tests/pushf.hex \
+ modules/arch/x86/tests/pushf-err.asm \
+ modules/arch/x86/tests/pushf-err.errwarn \
+ modules/arch/x86/tests/pushnosize.asm \
+ modules/arch/x86/tests/pushnosize.errwarn \
+ modules/arch/x86/tests/pushnosize.hex \
+ modules/arch/x86/tests/rep.asm modules/arch/x86/tests/rep.hex \
+ modules/arch/x86/tests/ret.asm modules/arch/x86/tests/ret.hex \
+ modules/arch/x86/tests/riprel1.asm \
+ modules/arch/x86/tests/riprel1.hex \
+ modules/arch/x86/tests/riprel2.asm \
+ modules/arch/x86/tests/riprel2.errwarn \
+ modules/arch/x86/tests/riprel2.hex \
+ modules/arch/x86/tests/ripseg.asm \
+ modules/arch/x86/tests/ripseg.errwarn \
+ modules/arch/x86/tests/ripseg.hex \
+ modules/arch/x86/tests/segmov.asm \
+ modules/arch/x86/tests/segmov.hex \
+ modules/arch/x86/tests/segoff.asm \
+ modules/arch/x86/tests/segoff.hex \
+ modules/arch/x86/tests/segoff-err.asm \
+ modules/arch/x86/tests/segoff-err.errwarn \
+ modules/arch/x86/tests/shift.asm \
+ modules/arch/x86/tests/shift.hex \
+ modules/arch/x86/tests/simd-1.asm \
+ modules/arch/x86/tests/simd-1.hex \
+ modules/arch/x86/tests/simd-2.asm \
+ modules/arch/x86/tests/simd-2.hex \
+ modules/arch/x86/tests/simd64-1.asm \
+ modules/arch/x86/tests/simd64-1.hex \
+ modules/arch/x86/tests/simd64-2.asm \
+ modules/arch/x86/tests/simd64-2.hex \
+ modules/arch/x86/tests/sse-prefix.asm \
+ modules/arch/x86/tests/sse-prefix.hex \
+ modules/arch/x86/tests/sse3.asm \
+ modules/arch/x86/tests/sse3.hex \
+ modules/arch/x86/tests/sse4.asm \
+ modules/arch/x86/tests/sse4.hex \
+ modules/arch/x86/tests/sse4-err.asm \
+ modules/arch/x86/tests/sse4-err.errwarn \
+ modules/arch/x86/tests/sse5-all.asm \
+ modules/arch/x86/tests/sse5-all.hex \
+ modules/arch/x86/tests/sse5-basic.asm \
+ modules/arch/x86/tests/sse5-basic.hex \
+ modules/arch/x86/tests/sse5-cc.asm \
+ modules/arch/x86/tests/sse5-cc.hex \
+ modules/arch/x86/tests/sse5-err.asm \
+ modules/arch/x86/tests/sse5-err.errwarn \
+ modules/arch/x86/tests/ssewidth.asm \
+ modules/arch/x86/tests/ssewidth.hex \
+ modules/arch/x86/tests/ssse3.asm \
+ modules/arch/x86/tests/ssse3.c \
+ modules/arch/x86/tests/ssse3.hex \
+ modules/arch/x86/tests/stos.asm \
+ modules/arch/x86/tests/stos.hex modules/arch/x86/tests/str.asm \
+ modules/arch/x86/tests/str.hex \
+ modules/arch/x86/tests/strict.asm \
+ modules/arch/x86/tests/strict.errwarn \
+ modules/arch/x86/tests/strict.hex \
+ modules/arch/x86/tests/strict-err.asm \
+ modules/arch/x86/tests/strict-err.errwarn \
+ modules/arch/x86/tests/stringseg.asm \
+ modules/arch/x86/tests/stringseg.errwarn \
+ modules/arch/x86/tests/stringseg.hex \
+ modules/arch/x86/tests/svm.asm modules/arch/x86/tests/svm.hex \
+ modules/arch/x86/tests/twobytemem.asm \
+ modules/arch/x86/tests/twobytemem.errwarn \
+ modules/arch/x86/tests/twobytemem.hex \
+ modules/arch/x86/tests/vmx.asm modules/arch/x86/tests/vmx.hex \
+ modules/arch/x86/tests/vmx-err.asm \
+ modules/arch/x86/tests/vmx-err.errwarn \
+ modules/arch/x86/tests/x86label.asm \
+ modules/arch/x86/tests/x86label.hex \
+ modules/arch/x86/tests/xchg64.asm \
+ modules/arch/x86/tests/xchg64.hex \
+ modules/arch/x86/tests/xmm64.asm \
+ modules/arch/x86/tests/xmm64.hex \
+ modules/arch/x86/tests/xsave.asm \
+ modules/arch/x86/tests/xsave.hex \
+ modules/arch/x86/tests/gas32/Makefile.inc \
+ modules/arch/x86/tests/gas64/Makefile.inc \
+ modules/arch/x86/tests/gas32/x86_gas32_test.sh \
+ modules/arch/x86/tests/gas32/align32.asm \
+ modules/arch/x86/tests/gas32/align32.hex \
+ modules/arch/x86/tests/gas32/gas-farithr.asm \
+ modules/arch/x86/tests/gas32/gas-farithr.hex \
+ modules/arch/x86/tests/gas32/gas-fpmem.asm \
+ modules/arch/x86/tests/gas32/gas-fpmem.hex \
+ modules/arch/x86/tests/gas32/gas-movdq32.asm \
+ modules/arch/x86/tests/gas32/gas-movdq32.hex \
+ modules/arch/x86/tests/gas32/gas-movsd.asm \
+ modules/arch/x86/tests/gas32/gas-movsd.hex \
+ modules/arch/x86/tests/gas32/gas32-jmpcall.asm \
+ modules/arch/x86/tests/gas32/gas32-jmpcall.hex \
+ modules/arch/x86/tests/gas64/x86_gas64_test.sh \
+ modules/arch/x86/tests/gas64/align64.asm \
+ modules/arch/x86/tests/gas64/align64.hex \
+ modules/arch/x86/tests/gas64/gas-cbw.asm \
+ modules/arch/x86/tests/gas64/gas-cbw.hex \
+ modules/arch/x86/tests/gas64/gas-fp.asm \
+ modules/arch/x86/tests/gas64/gas-fp.hex \
+ modules/arch/x86/tests/gas64/gas-inout.asm \
+ modules/arch/x86/tests/gas64/gas-inout.hex \
+ modules/arch/x86/tests/gas64/gas-moreinsn.asm \
+ modules/arch/x86/tests/gas64/gas-moreinsn.hex \
+ modules/arch/x86/tests/gas64/gas-movabs.asm \
+ modules/arch/x86/tests/gas64/gas-movabs.hex \
+ modules/arch/x86/tests/gas64/gas-movdq64.asm \
+ modules/arch/x86/tests/gas64/gas-movdq64.hex \
+ modules/arch/x86/tests/gas64/gas-movsxs.asm \
+ modules/arch/x86/tests/gas64/gas-movsxs.hex \
+ modules/arch/x86/tests/gas64/gas-muldiv.asm \
+ modules/arch/x86/tests/gas64/gas-muldiv.hex \
+ modules/arch/x86/tests/gas64/gas-prefix.asm \
+ modules/arch/x86/tests/gas64/gas-prefix.errwarn \
+ modules/arch/x86/tests/gas64/gas-prefix.hex \
+ modules/arch/x86/tests/gas64/gas-retenter.asm \
+ modules/arch/x86/tests/gas64/gas-retenter.hex \
+ modules/arch/x86/tests/gas64/gas-shift.asm \
+ modules/arch/x86/tests/gas64/gas-shift.hex \
+ modules/arch/x86/tests/gas64/gas64-jmpcall.asm \
+ modules/arch/x86/tests/gas64/gas64-jmpcall.hex \
+ modules/arch/x86/tests/gas64/riprel.asm \
+ modules/arch/x86/tests/gas64/riprel.hex \
+ modules/arch/lc3b/tests/Makefile.inc \
+ modules/arch/lc3b/lc3bid.re \
+ modules/arch/lc3b/tests/lc3b_test.sh \
+ modules/arch/lc3b/tests/lc3b-basic.asm \
+ modules/arch/lc3b/tests/lc3b-basic.errwarn \
+ modules/arch/lc3b/tests/lc3b-basic.hex \
+ modules/arch/lc3b/tests/lc3b-br.asm \
+ modules/arch/lc3b/tests/lc3b-br.hex \
+ modules/arch/lc3b/tests/lc3b-ea-err.asm \
+ modules/arch/lc3b/tests/lc3b-ea-err.errwarn \
+ modules/arch/lc3b/tests/lc3b-mp22NC.asm \
+ modules/arch/lc3b/tests/lc3b-mp22NC.hex \
+ modules/arch/yasm_arch.xml modules/listfmts/nasm/Makefile.inc \
+ modules/parsers/gas/Makefile.inc \
+ modules/parsers/nasm/Makefile.inc \
+ modules/parsers/gas/tests/Makefile.inc \
+ modules/parsers/gas/gas-token.re \
+ modules/parsers/gas/tests/gas_test.sh \
+ modules/parsers/gas/tests/dataref-imm.asm \
+ modules/parsers/gas/tests/dataref-imm.hex \
+ modules/parsers/gas/tests/datavis.asm \
+ modules/parsers/gas/tests/datavis.errwarn \
+ modules/parsers/gas/tests/datavis.hex \
+ modules/parsers/gas/tests/datavis2.asm \
+ modules/parsers/gas/tests/datavis2.hex \
+ modules/parsers/gas/tests/execsect.asm \
+ modules/parsers/gas/tests/execsect.hex \
+ modules/parsers/gas/tests/gas-fill.asm \
+ modules/parsers/gas/tests/gas-fill.hex \
+ modules/parsers/gas/tests/gas-float.asm \
+ modules/parsers/gas/tests/gas-float.hex \
+ modules/parsers/gas/tests/gas-instlabel.asm \
+ modules/parsers/gas/tests/gas-instlabel.hex \
+ modules/parsers/gas/tests/gas-line-err.asm \
+ modules/parsers/gas/tests/gas-line-err.errwarn \
+ modules/parsers/gas/tests/gas-line2-err.asm \
+ modules/parsers/gas/tests/gas-line2-err.errwarn \
+ modules/parsers/gas/tests/gas-push.asm \
+ modules/parsers/gas/tests/gas-push.hex \
+ modules/parsers/gas/tests/gas-segprefix.asm \
+ modules/parsers/gas/tests/gas-segprefix.hex \
+ modules/parsers/gas/tests/gas-semi.asm \
+ modules/parsers/gas/tests/gas-semi.hex \
+ modules/parsers/gas/tests/gassectalign.asm \
+ modules/parsers/gas/tests/gassectalign.hex \
+ modules/parsers/gas/tests/jmpcall.asm \
+ modules/parsers/gas/tests/jmpcall.errwarn \
+ modules/parsers/gas/tests/jmpcall.hex \
+ modules/parsers/gas/tests/leb128.asm \
+ modules/parsers/gas/tests/leb128.hex \
+ modules/parsers/gas/tests/localcomm.asm \
+ modules/parsers/gas/tests/localcomm.hex \
+ modules/parsers/gas/tests/reggroup-err.asm \
+ modules/parsers/gas/tests/reggroup-err.errwarn \
+ modules/parsers/gas/tests/reggroup.asm \
+ modules/parsers/gas/tests/reggroup.hex \
+ modules/parsers/gas/tests/strzero.asm \
+ modules/parsers/gas/tests/strzero.hex \
+ modules/parsers/gas/tests/varinsn.asm \
+ modules/parsers/gas/tests/varinsn.hex \
+ modules/parsers/gas/tests/bin/Makefile.inc \
+ modules/parsers/gas/tests/bin/gas_bin_test.sh \
+ modules/parsers/gas/tests/bin/gas-comment.asm \
+ modules/parsers/gas/tests/bin/gas-comment.errwarn \
+ modules/parsers/gas/tests/bin/gas-comment.hex \
+ modules/parsers/gas/tests/bin/gas-llabel.asm \
+ modules/parsers/gas/tests/bin/gas-llabel.hex \
+ modules/parsers/gas/tests/bin/gas-set.asm \
+ modules/parsers/gas/tests/bin/gas-set.hex \
+ modules/parsers/gas/tests/bin/rept-err.asm \
+ modules/parsers/gas/tests/bin/rept-err.errwarn \
+ modules/parsers/gas/tests/bin/reptempty.asm \
+ modules/parsers/gas/tests/bin/reptempty.hex \
+ modules/parsers/gas/tests/bin/reptlong.asm \
+ modules/parsers/gas/tests/bin/reptlong.hex \
+ modules/parsers/gas/tests/bin/reptnested-err.asm \
+ modules/parsers/gas/tests/bin/reptnested-err.errwarn \
+ modules/parsers/gas/tests/bin/reptsimple.asm \
+ modules/parsers/gas/tests/bin/reptsimple.hex \
+ modules/parsers/gas/tests/bin/reptwarn.asm \
+ modules/parsers/gas/tests/bin/reptwarn.errwarn \
+ modules/parsers/gas/tests/bin/reptwarn.hex \
+ modules/parsers/gas/tests/bin/reptzero.asm \
+ modules/parsers/gas/tests/bin/reptzero.hex \
+ modules/parsers/nasm/nasm-token.re \
+ modules/parsers/nasm/nasm-std.mac \
+ modules/parsers/nasm/tests/Makefile.inc \
+ modules/parsers/nasm/tests/nasm_test.sh \
+ modules/parsers/nasm/tests/alignnop16.asm \
+ modules/parsers/nasm/tests/alignnop16.hex \
+ modules/parsers/nasm/tests/alignnop32.asm \
+ modules/parsers/nasm/tests/alignnop32.hex \
+ modules/parsers/nasm/tests/charconstmath.asm \
+ modules/parsers/nasm/tests/charconstmath.hex \
+ modules/parsers/nasm/tests/dy.asm \
+ modules/parsers/nasm/tests/dy.hex \
+ modules/parsers/nasm/tests/endcomma.asm \
+ modules/parsers/nasm/tests/endcomma.hex \
+ modules/parsers/nasm/tests/equcolon.asm \
+ modules/parsers/nasm/tests/equcolon.hex \
+ modules/parsers/nasm/tests/equlocal.asm \
+ modules/parsers/nasm/tests/equlocal.hex \
+ modules/parsers/nasm/tests/hexconst.asm \
+ modules/parsers/nasm/tests/hexconst.hex \
+ modules/parsers/nasm/tests/long.asm \
+ modules/parsers/nasm/tests/long.hex \
+ modules/parsers/nasm/tests/locallabel.asm \
+ modules/parsers/nasm/tests/locallabel.hex \
+ modules/parsers/nasm/tests/locallabel2.asm \
+ modules/parsers/nasm/tests/locallabel2.hex \
+ modules/parsers/nasm/tests/nasm-prefix.asm \
+ modules/parsers/nasm/tests/nasm-prefix.hex \
+ modules/parsers/nasm/tests/newsect.asm \
+ modules/parsers/nasm/tests/newsect.hex \
+ modules/parsers/nasm/tests/orphannowarn.asm \
+ modules/parsers/nasm/tests/orphannowarn.hex \
+ modules/parsers/nasm/tests/prevlocalwarn.asm \
+ modules/parsers/nasm/tests/prevlocalwarn.errwarn \
+ modules/parsers/nasm/tests/prevlocalwarn.hex \
+ modules/parsers/nasm/tests/strucalign.asm \
+ modules/parsers/nasm/tests/strucalign.hex \
+ modules/parsers/nasm/tests/struczero.asm \
+ modules/parsers/nasm/tests/struczero.hex \
+ modules/parsers/nasm/tests/syntax-err.asm \
+ modules/parsers/nasm/tests/syntax-err.errwarn \
+ modules/parsers/nasm/tests/uscore.asm \
+ modules/parsers/nasm/tests/uscore.hex \
+ modules/parsers/nasm/tests/worphan/Makefile.inc \
+ modules/parsers/nasm/tests/worphan/nasm_worphan_test.sh \
+ modules/parsers/nasm/tests/worphan/orphanwarn.asm \
+ modules/parsers/nasm/tests/worphan/orphanwarn.errwarn \
+ modules/parsers/nasm/tests/worphan/orphanwarn.hex \
+ modules/parsers/tasm/tests/Makefile.inc \
+ modules/parsers/tasm/tests/tasm_test.sh \
+ modules/parsers/tasm/tests/array.asm \
+ modules/parsers/tasm/tests/array.hex \
+ modules/parsers/tasm/tests/case.asm \
+ modules/parsers/tasm/tests/case.hex \
+ modules/parsers/tasm/tests/charstr.asm \
+ modules/parsers/tasm/tests/charstr.hex \
+ modules/parsers/tasm/tests/dup.asm \
+ modules/parsers/tasm/tests/dup.hex \
+ modules/parsers/tasm/tests/equal.asm \
+ modules/parsers/tasm/tests/equal.hex \
+ modules/parsers/tasm/tests/expr.asm \
+ modules/parsers/tasm/tests/expr.hex \
+ modules/parsers/tasm/tests/irp.asm \
+ modules/parsers/tasm/tests/irp.hex \
+ modules/parsers/tasm/tests/label.asm \
+ modules/parsers/tasm/tests/label.hex \
+ modules/parsers/tasm/tests/les.asm \
+ modules/parsers/tasm/tests/les.hex \
+ modules/parsers/tasm/tests/lidt.asm \
+ modules/parsers/tasm/tests/lidt.hex \
+ modules/parsers/tasm/tests/macro.asm \
+ modules/parsers/tasm/tests/macro.hex \
+ modules/parsers/tasm/tests/offset.asm \
+ modules/parsers/tasm/tests/offset.hex \
+ modules/parsers/tasm/tests/quote.asm \
+ modules/parsers/tasm/tests/quote.hex \
+ modules/parsers/tasm/tests/res.asm \
+ modules/parsers/tasm/tests/res.errwarn \
+ modules/parsers/tasm/tests/res.hex \
+ modules/parsers/tasm/tests/segment.asm \
+ modules/parsers/tasm/tests/segment.hex \
+ modules/parsers/tasm/tests/size.asm \
+ modules/parsers/tasm/tests/size.hex \
+ modules/parsers/tasm/tests/struc.asm \
+ modules/parsers/tasm/tests/struc.errwarn \
+ modules/parsers/tasm/tests/struc.hex \
+ modules/parsers/tasm/tests/exe/Makefile.inc \
+ modules/parsers/tasm/tests/exe/tasm_exe_test.sh \
+ modules/parsers/tasm/tests/exe/exe.asm \
+ modules/parsers/tasm/tests/exe/exe.hex \
+ modules/parsers/yasm_parsers.xml \
+ modules/preprocs/nasm/Makefile.inc \
+ modules/preprocs/raw/Makefile.inc \
+ modules/preprocs/cpp/Makefile.inc \
+ modules/preprocs/nasm/genversion.c \
+ modules/preprocs/nasm/tests/Makefile.inc \
+ modules/preprocs/nasm/tests/nasmpp_test.sh \
+ modules/preprocs/nasm/tests/16args.asm \
+ modules/preprocs/nasm/tests/16args.hex \
+ modules/preprocs/nasm/tests/ifcritical-err.asm \
+ modules/preprocs/nasm/tests/ifcritical-err.errwarn \
+ modules/preprocs/nasm/tests/longline.asm \
+ modules/preprocs/nasm/tests/longline.hex \
+ modules/preprocs/nasm/tests/macroeof-err.asm \
+ modules/preprocs/nasm/tests/macroeof-err.errwarn \
+ modules/preprocs/nasm/tests/noinclude-err.asm \
+ modules/preprocs/nasm/tests/noinclude-err.errwarn \
+ modules/preprocs/nasm/tests/nasmpp-bigint.asm \
+ modules/preprocs/nasm/tests/nasmpp-bigint.hex \
+ modules/preprocs/nasm/tests/nasmpp-decimal.asm \
+ modules/preprocs/nasm/tests/nasmpp-decimal.hex \
+ modules/preprocs/nasm/tests/nasmpp-nested.asm \
+ modules/preprocs/nasm/tests/nasmpp-nested.errwarn \
+ modules/preprocs/nasm/tests/nasmpp-nested.hex \
+ modules/preprocs/nasm/tests/orgsect.asm \
+ modules/preprocs/nasm/tests/orgsect.hex \
+ modules/preprocs/raw/tests/Makefile.inc \
+ modules/preprocs/raw/tests/rawpp_test.sh \
+ modules/preprocs/raw/tests/longline.asm \
+ modules/preprocs/raw/tests/longline.hex \
+ modules/dbgfmts/codeview/Makefile.inc \
+ modules/dbgfmts/dwarf2/Makefile.inc \
+ modules/dbgfmts/null/Makefile.inc \
+ modules/dbgfmts/stabs/Makefile.inc \
+ modules/dbgfmts/codeview/cv8.txt \
+ modules/dbgfmts/dwarf2/tests/Makefile.inc \
+ modules/dbgfmts/dwarf2/tests/pass32/Makefile.inc \
+ modules/dbgfmts/dwarf2/tests/pass64/Makefile.inc \
+ modules/dbgfmts/dwarf2/tests/passwin64/Makefile.inc \
+ modules/dbgfmts/dwarf2/tests/pass32/dwarf2_pass32_test.sh \
+ modules/dbgfmts/dwarf2/tests/pass32/dwarf32-err.asm \
+ modules/dbgfmts/dwarf2/tests/pass32/dwarf32-err.errwarn \
+ modules/dbgfmts/dwarf2/tests/pass32/dwarf32_testhd.asm \
+ modules/dbgfmts/dwarf2/tests/pass32/dwarf32_testhd.hex \
+ modules/dbgfmts/dwarf2/tests/pass64/dwarf2_pass64_test.sh \
+ modules/dbgfmts/dwarf2/tests/pass64/dwarf64_2loc.asm \
+ modules/dbgfmts/dwarf2/tests/pass64/dwarf64_2loc.hex \
+ modules/dbgfmts/dwarf2/tests/pass64/dwarf64_leb128.asm \
+ modules/dbgfmts/dwarf2/tests/pass64/dwarf64_leb128.hex \
+ modules/dbgfmts/dwarf2/tests/passwin64/dwarf2_passwin64_test.sh \
+ modules/dbgfmts/dwarf2/tests/passwin64/dwarfwin64_testhd.asm \
+ modules/dbgfmts/dwarf2/tests/passwin64/dwarfwin64_testhd.errwarn \
+ modules/dbgfmts/dwarf2/tests/passwin64/dwarfwin64_testhd.hex \
+ modules/dbgfmts/stabs/tests/Makefile.inc \
+ modules/dbgfmts/stabs/tests/stabs_test.sh \
+ modules/dbgfmts/stabs/tests/stabs-elf.asm \
+ modules/dbgfmts/stabs/tests/stabs-elf.hex \
+ modules/dbgfmts/yasm_dbgfmts.xml \
+ modules/objfmts/dbg/Makefile.inc \
+ modules/objfmts/bin/Makefile.inc \
+ modules/objfmts/elf/Makefile.inc \
+ modules/objfmts/coff/Makefile.inc \
+ modules/objfmts/macho/Makefile.inc \
+ modules/objfmts/rdf/Makefile.inc \
+ modules/objfmts/win32/Makefile.inc \
+ modules/objfmts/win64/Makefile.inc \
+ modules/objfmts/xdf/Makefile.inc \
+ modules/objfmts/bin/tests/Makefile.inc \
+ modules/objfmts/bin/tests/bin_test.sh \
+ modules/objfmts/bin/tests/abs.asm \
+ modules/objfmts/bin/tests/abs.hex \
+ modules/objfmts/bin/tests/bigorg.asm \
+ modules/objfmts/bin/tests/bigorg.hex \
+ modules/objfmts/bin/tests/bigorg.errwarn \
+ modules/objfmts/bin/tests/bin-farabs.asm \
+ modules/objfmts/bin/tests/bin-farabs.hex \
+ modules/objfmts/bin/tests/bin-rip.asm \
+ modules/objfmts/bin/tests/bin-rip.hex \
+ modules/objfmts/bin/tests/bintest.asm \
+ modules/objfmts/bin/tests/bintest.hex \
+ modules/objfmts/bin/tests/float-err.asm \
+ modules/objfmts/bin/tests/float-err.errwarn \
+ modules/objfmts/bin/tests/float.asm \
+ modules/objfmts/bin/tests/float.hex \
+ modules/objfmts/bin/tests/integer-warn.asm \
+ modules/objfmts/bin/tests/integer-warn.hex \
+ modules/objfmts/bin/tests/integer-warn.errwarn \
+ modules/objfmts/bin/tests/integer.asm \
+ modules/objfmts/bin/tests/integer.hex \
+ modules/objfmts/bin/tests/levelop.asm \
+ modules/objfmts/bin/tests/levelop.hex \
+ modules/objfmts/bin/tests/reserve.asm \
+ modules/objfmts/bin/tests/reserve.hex \
+ modules/objfmts/bin/tests/reserve.errwarn \
+ modules/objfmts/bin/tests/shr.asm \
+ modules/objfmts/bin/tests/shr.hex \
+ modules/objfmts/bin/tests/multisect/Makefile.inc \
+ modules/objfmts/bin/tests/multisect/bin_multi_test.sh \
+ modules/objfmts/bin/tests/multisect/bin-align.asm \
+ modules/objfmts/bin/tests/multisect/bin-align.errwarn \
+ modules/objfmts/bin/tests/multisect/bin-align.hex \
+ modules/objfmts/bin/tests/multisect/bin-align.map \
+ modules/objfmts/bin/tests/multisect/bin-ssym.asm \
+ modules/objfmts/bin/tests/multisect/bin-ssym.hex \
+ modules/objfmts/bin/tests/multisect/bin-ssym.map \
+ modules/objfmts/bin/tests/multisect/follows-loop1-err.asm \
+ modules/objfmts/bin/tests/multisect/follows-loop1-err.errwarn \
+ modules/objfmts/bin/tests/multisect/follows-loop2-err.asm \
+ modules/objfmts/bin/tests/multisect/follows-loop2-err.errwarn \
+ modules/objfmts/bin/tests/multisect/follows-notfound-err.asm \
+ modules/objfmts/bin/tests/multisect/follows-notfound-err.errwarn \
+ modules/objfmts/bin/tests/multisect/initbss.asm \
+ modules/objfmts/bin/tests/multisect/initbss.errwarn \
+ modules/objfmts/bin/tests/multisect/initbss.hex \
+ modules/objfmts/bin/tests/multisect/initbss.map \
+ modules/objfmts/bin/tests/multisect/ldlinux-sects.asm \
+ modules/objfmts/bin/tests/multisect/ldlinux-sects.hex \
+ modules/objfmts/bin/tests/multisect/ldlinux-sects.map \
+ modules/objfmts/bin/tests/multisect/multisect1.asm \
+ modules/objfmts/bin/tests/multisect/multisect1.hex \
+ modules/objfmts/bin/tests/multisect/multisect1.map \
+ modules/objfmts/bin/tests/multisect/multisect2.asm \
+ modules/objfmts/bin/tests/multisect/multisect2.hex \
+ modules/objfmts/bin/tests/multisect/multisect2.map \
+ modules/objfmts/bin/tests/multisect/multisect3.asm \
+ modules/objfmts/bin/tests/multisect/multisect3.hex \
+ modules/objfmts/bin/tests/multisect/multisect3.map \
+ modules/objfmts/bin/tests/multisect/multisect4.asm \
+ modules/objfmts/bin/tests/multisect/multisect4.hex \
+ modules/objfmts/bin/tests/multisect/multisect4.map \
+ modules/objfmts/bin/tests/multisect/multisect5.asm \
+ modules/objfmts/bin/tests/multisect/multisect5.hex \
+ modules/objfmts/bin/tests/multisect/multisect5.map \
+ modules/objfmts/bin/tests/multisect/nomultisect1.asm \
+ modules/objfmts/bin/tests/multisect/nomultisect1.hex \
+ modules/objfmts/bin/tests/multisect/nomultisect1.map \
+ modules/objfmts/bin/tests/multisect/nomultisect2.asm \
+ modules/objfmts/bin/tests/multisect/nomultisect2.hex \
+ modules/objfmts/bin/tests/multisect/nomultisect2.map \
+ modules/objfmts/bin/tests/multisect/vfollows-loop1-err.asm \
+ modules/objfmts/bin/tests/multisect/vfollows-loop1-err.errwarn \
+ modules/objfmts/bin/tests/multisect/vfollows-loop2-err.asm \
+ modules/objfmts/bin/tests/multisect/vfollows-loop2-err.errwarn \
+ modules/objfmts/bin/tests/multisect/vfollows-notfound-err.asm \
+ modules/objfmts/bin/tests/multisect/vfollows-notfound-err.errwarn \
+ modules/objfmts/elf/tests/Makefile.inc \
+ modules/objfmts/elf/tests/elf_test.sh \
+ modules/objfmts/elf/tests/curpos.asm \
+ modules/objfmts/elf/tests/curpos.hex \
+ modules/objfmts/elf/tests/curpos-err.asm \
+ modules/objfmts/elf/tests/curpos-err.errwarn \
+ modules/objfmts/elf/tests/elf-overdef.asm \
+ modules/objfmts/elf/tests/elf-overdef.hex \
+ modules/objfmts/elf/tests/elf-x86id.asm \
+ modules/objfmts/elf/tests/elf-x86id.hex \
+ modules/objfmts/elf/tests/elfabssect.asm \
+ modules/objfmts/elf/tests/elfabssect.hex \
+ modules/objfmts/elf/tests/elfcond.asm \
+ modules/objfmts/elf/tests/elfcond.hex \
+ modules/objfmts/elf/tests/elfequabs.asm \
+ modules/objfmts/elf/tests/elfequabs.hex \
+ modules/objfmts/elf/tests/elfglobal.asm \
+ modules/objfmts/elf/tests/elfglobal.hex \
+ modules/objfmts/elf/tests/elfglobext.asm \
+ modules/objfmts/elf/tests/elfglobext.hex \
+ modules/objfmts/elf/tests/elfglobext2.asm \
+ modules/objfmts/elf/tests/elfglobext2.hex \
+ modules/objfmts/elf/tests/elfmanysym.asm \
+ modules/objfmts/elf/tests/elfmanysym.hex \
+ modules/objfmts/elf/tests/elfreloc.asm \
+ modules/objfmts/elf/tests/elfreloc.hex \
+ modules/objfmts/elf/tests/elfreloc-ext.asm \
+ modules/objfmts/elf/tests/elfreloc-ext.hex \
+ modules/objfmts/elf/tests/elfsectalign.asm \
+ modules/objfmts/elf/tests/elfsectalign.hex \
+ modules/objfmts/elf/tests/elfso.asm \
+ modules/objfmts/elf/tests/elfso.hex \
+ modules/objfmts/elf/tests/elftest.c \
+ modules/objfmts/elf/tests/elftest.asm \
+ modules/objfmts/elf/tests/elftest.hex \
+ modules/objfmts/elf/tests/elftimes.asm \
+ modules/objfmts/elf/tests/elftimes.hex \
+ modules/objfmts/elf/tests/elftypesize.asm \
+ modules/objfmts/elf/tests/elftypesize.hex \
+ modules/objfmts/elf/tests/elfvisibility.asm \
+ modules/objfmts/elf/tests/elfvisibility.errwarn \
+ modules/objfmts/elf/tests/elfvisibility.hex \
+ modules/objfmts/elf/tests/nasm-sectname.asm \
+ modules/objfmts/elf/tests/nasm-sectname.hex \
+ modules/objfmts/elf/tests/nasm-forceident.asm \
+ modules/objfmts/elf/tests/nasm-forceident.hex \
+ modules/objfmts/elf/tests/amd64/Makefile.inc \
+ modules/objfmts/elf/tests/gas32/Makefile.inc \
+ modules/objfmts/elf/tests/gas64/Makefile.inc \
+ modules/objfmts/elf/tests/amd64/elf_amd64_test.sh \
+ modules/objfmts/elf/tests/amd64/elf-rip.asm \
+ modules/objfmts/elf/tests/amd64/elf-rip.hex \
+ modules/objfmts/elf/tests/amd64/elfso64.asm \
+ modules/objfmts/elf/tests/amd64/elfso64.hex \
+ modules/objfmts/elf/tests/amd64/gotpcrel.asm \
+ modules/objfmts/elf/tests/amd64/gotpcrel.hex \
+ modules/objfmts/elf/tests/gas32/elf_gas32_test.sh \
+ modules/objfmts/elf/tests/gas32/elf_gas32_ssym.asm \
+ modules/objfmts/elf/tests/gas32/elf_gas32_ssym.hex \
+ modules/objfmts/elf/tests/gas64/elf_gas64_test.sh \
+ modules/objfmts/elf/tests/gas64/crosssect.asm \
+ modules/objfmts/elf/tests/gas64/crosssect.hex \
+ modules/objfmts/elf/tests/gas64/elf_gas64_curpos.asm \
+ modules/objfmts/elf/tests/gas64/elf_gas64_curpos.hex \
+ modules/objfmts/elf/tests/gas64/elf_gas64_reloc.asm \
+ modules/objfmts/elf/tests/gas64/elf_gas64_reloc.hex \
+ modules/objfmts/elf/tests/gas64/elf_gas64_ssym.asm \
+ modules/objfmts/elf/tests/gas64/elf_gas64_ssym.hex \
+ modules/objfmts/coff/win64-nasm.mac \
+ modules/objfmts/coff/win64-gas.mac \
+ modules/objfmts/coff/tests/Makefile.inc \
+ modules/objfmts/coff/tests/coff_test.sh \
+ modules/objfmts/coff/tests/cofftest.c \
+ modules/objfmts/coff/tests/cofftest.asm \
+ modules/objfmts/coff/tests/cofftest.hex \
+ modules/objfmts/coff/tests/cofftimes.asm \
+ modules/objfmts/coff/tests/cofftimes.hex \
+ modules/objfmts/coff/tests/x86id.asm \
+ modules/objfmts/coff/tests/x86id.hex \
+ modules/objfmts/coff/tests/x86id.errwarn \
+ modules/objfmts/macho/tests/Makefile.inc \
+ modules/objfmts/macho/tests/gas32/Makefile.inc \
+ modules/objfmts/macho/tests/gas64/Makefile.inc \
+ modules/objfmts/macho/tests/nasm32/Makefile.inc \
+ modules/objfmts/macho/tests/nasm64/Makefile.inc \
+ modules/objfmts/macho/tests/gas32/gas_macho32_test.sh \
+ modules/objfmts/macho/tests/gas32/gas-macho32.asm \
+ modules/objfmts/macho/tests/gas32/gas-macho32.hex \
+ modules/objfmts/macho/tests/gas64/gas_macho64_test.sh \
+ modules/objfmts/macho/tests/gas64/gas-macho64.asm \
+ modules/objfmts/macho/tests/gas64/gas-macho64.hex \
+ modules/objfmts/macho/tests/gas64/gas-macho64-pic.asm \
+ modules/objfmts/macho/tests/gas64/gas-macho64-pic.hex \
+ modules/objfmts/macho/tests/nasm32/macho32_test.sh \
+ modules/objfmts/macho/tests/nasm32/machotest.c \
+ modules/objfmts/macho/tests/nasm32/machotest.asm \
+ modules/objfmts/macho/tests/nasm32/machotest.hex \
+ modules/objfmts/macho/tests/nasm32/macho-reloc.asm \
+ modules/objfmts/macho/tests/nasm32/macho-reloc.hex \
+ modules/objfmts/macho/tests/nasm32/macho32-sect.asm \
+ modules/objfmts/macho/tests/nasm32/macho32-sect.errwarn \
+ modules/objfmts/macho/tests/nasm32/macho32-sect.hex \
+ modules/objfmts/macho/tests/nasm64/nasm-macho64-pic.asm \
+ modules/objfmts/macho/tests/nasm64/nasm-macho64-pic.hex \
+ modules/objfmts/macho/tests/nasm64/macho64_test.sh \
+ modules/objfmts/macho/tests/nasm64/machotest64.c \
+ modules/objfmts/macho/tests/nasm64/machotest64.asm \
+ modules/objfmts/macho/tests/nasm64/machotest64.hex \
+ modules/objfmts/macho/tests/nasm64/macho-reloc64-err.asm \
+ modules/objfmts/macho/tests/nasm64/macho-reloc64-err.errwarn \
+ modules/objfmts/rdf/tests/Makefile.inc \
+ modules/objfmts/rdf/tests/rdf_test.sh \
+ modules/objfmts/rdf/tests/rdfabs.asm \
+ modules/objfmts/rdf/tests/rdfabs.errwarn \
+ modules/objfmts/rdf/tests/rdfabs.hex \
+ modules/objfmts/rdf/tests/rdfext.asm \
+ modules/objfmts/rdf/tests/rdfext.hex \
+ modules/objfmts/rdf/tests/rdfseg.asm \
+ modules/objfmts/rdf/tests/rdfseg.hex \
+ modules/objfmts/rdf/tests/rdfseg2.asm \
+ modules/objfmts/rdf/tests/rdfseg2.hex \
+ modules/objfmts/rdf/tests/rdftest1.asm \
+ modules/objfmts/rdf/tests/rdftest1.hex \
+ modules/objfmts/rdf/tests/rdftest2.asm \
+ modules/objfmts/rdf/tests/rdftest2.hex \
+ modules/objfmts/rdf/tests/rdtlib.asm \
+ modules/objfmts/rdf/tests/rdtlib.hex \
+ modules/objfmts/rdf/tests/rdtmain.asm \
+ modules/objfmts/rdf/tests/rdtmain.hex \
+ modules/objfmts/rdf/tests/testlib.asm \
+ modules/objfmts/rdf/tests/testlib.hex \
+ modules/objfmts/win32/tests/Makefile.inc \
+ modules/objfmts/win32/tests/export.asm \
+ modules/objfmts/win32/tests/export.hex \
+ modules/objfmts/win32/tests/win32_test.sh \
+ modules/objfmts/win32/tests/win32-curpos.asm \
+ modules/objfmts/win32/tests/win32-curpos.hex \
+ modules/objfmts/win32/tests/win32-overdef.asm \
+ modules/objfmts/win32/tests/win32-overdef.hex \
+ modules/objfmts/win32/tests/win32-safeseh.asm \
+ modules/objfmts/win32/tests/win32-safeseh.hex \
+ modules/objfmts/win32/tests/win32-safeseh.masm \
+ modules/objfmts/win32/tests/win32-segof.asm \
+ modules/objfmts/win32/tests/win32-segof.hex \
+ modules/objfmts/win32/tests/win32test.c \
+ modules/objfmts/win32/tests/win32test.asm \
+ modules/objfmts/win32/tests/win32test.hex \
+ modules/objfmts/win32/tests/gas/Makefile.inc \
+ modules/objfmts/win32/tests/gas/win32_gas_test.sh \
+ modules/objfmts/win32/tests/gas/win32at.asm \
+ modules/objfmts/win32/tests/gas/win32at.hex \
+ modules/objfmts/win64/tests/Makefile.inc \
+ modules/objfmts/win64/tests/win64_test.sh \
+ modules/objfmts/win64/tests/sce1.asm \
+ modules/objfmts/win64/tests/sce1.hex \
+ modules/objfmts/win64/tests/sce1-err.asm \
+ modules/objfmts/win64/tests/sce1-err.errwarn \
+ modules/objfmts/win64/tests/sce2.asm \
+ modules/objfmts/win64/tests/sce2.hex \
+ modules/objfmts/win64/tests/sce2-err.asm \
+ modules/objfmts/win64/tests/sce2-err.errwarn \
+ modules/objfmts/win64/tests/sce3.asm \
+ modules/objfmts/win64/tests/sce3.hex \
+ modules/objfmts/win64/tests/sce3.masm \
+ modules/objfmts/win64/tests/sce4.asm \
+ modules/objfmts/win64/tests/sce4.hex \
+ modules/objfmts/win64/tests/sce4.masm \
+ modules/objfmts/win64/tests/sce4-err.asm \
+ modules/objfmts/win64/tests/sce4-err.errwarn \
+ modules/objfmts/win64/tests/win64-abs.asm \
+ modules/objfmts/win64/tests/win64-abs.hex \
+ modules/objfmts/win64/tests/win64-curpos.asm \
+ modules/objfmts/win64/tests/win64-curpos.hex \
+ modules/objfmts/win64/tests/win64-dataref.asm \
+ modules/objfmts/win64/tests/win64-dataref.hex \
+ modules/objfmts/win64/tests/win64-dataref.masm \
+ modules/objfmts/win64/tests/win64-dataref2.asm \
+ modules/objfmts/win64/tests/win64-dataref2.hex \
+ modules/objfmts/win64/tests/win64-dataref2.masm \
+ modules/objfmts/win64/tests/gas/Makefile.inc \
+ modules/objfmts/win64/tests/gas/win64_gas_test.sh \
+ modules/objfmts/win64/tests/gas/win64-gas-sce.asm \
+ modules/objfmts/win64/tests/gas/win64-gas-sce.hex \
+ modules/objfmts/xdf/tests/Makefile.inc \
+ modules/objfmts/xdf/tests/xdf_test.sh \
+ modules/objfmts/xdf/tests/xdf-overdef.asm \
+ modules/objfmts/xdf/tests/xdf-overdef.hex \
+ modules/objfmts/xdf/tests/xdflong.asm \
+ modules/objfmts/xdf/tests/xdflong.hex \
+ modules/objfmts/xdf/tests/xdflong.errwarn \
+ modules/objfmts/xdf/tests/xdfother.asm \
+ modules/objfmts/xdf/tests/xdfother.hex \
+ modules/objfmts/xdf/tests/xdfprotect.asm \
+ modules/objfmts/xdf/tests/xdfprotect.hex \
+ modules/objfmts/xdf/tests/xdfsect.asm \
+ modules/objfmts/xdf/tests/xdfsect.hex \
+ modules/objfmts/xdf/tests/xdfsect-err.asm \
+ modules/objfmts/xdf/tests/xdfsect-err.errwarn \
+ modules/objfmts/xdf/tests/xdfvirtual.asm \
+ modules/objfmts/xdf/tests/xdfvirtual.hex \
+ modules/objfmts/yasm_objfmts.xml libyasm/genmodule.c \
+ libyasm/module.in libyasm/tests/Makefile.inc \
+ libyasm/tests/libyasm_test.sh libyasm/tests/1shl0.asm \
+ libyasm/tests/1shl0.hex libyasm/tests/absloop-err.asm \
+ libyasm/tests/absloop-err.errwarn \
+ libyasm/tests/charconst64.asm libyasm/tests/charconst64.hex \
+ libyasm/tests/data-rawvalue.asm \
+ libyasm/tests/data-rawvalue.hex libyasm/tests/duplabel-err.asm \
+ libyasm/tests/duplabel-err.errwarn libyasm/tests/emptydata.asm \
+ libyasm/tests/emptydata.hex libyasm/tests/equ-expand.asm \
+ libyasm/tests/equ-expand.hex libyasm/tests/expr-fold-level.asm \
+ libyasm/tests/expr-fold-level.hex \
+ libyasm/tests/expr-wide-ident.asm \
+ libyasm/tests/expr-wide-ident.hex libyasm/tests/externdef.asm \
+ libyasm/tests/externdef.errwarn libyasm/tests/externdef.hex \
+ libyasm/tests/incbin.asm libyasm/tests/incbin.hex \
+ libyasm/tests/jmpsize1.asm libyasm/tests/jmpsize1.hex \
+ libyasm/tests/jmpsize1-err.asm \
+ libyasm/tests/jmpsize1-err.errwarn \
+ libyasm/tests/opt-align1.asm libyasm/tests/opt-align1.hex \
+ libyasm/tests/opt-align2.asm libyasm/tests/opt-align2.hex \
+ libyasm/tests/opt-align3.asm libyasm/tests/opt-align3.hex \
+ libyasm/tests/opt-circular1-err.asm \
+ libyasm/tests/opt-circular1-err.errwarn \
+ libyasm/tests/opt-circular2-err.asm \
+ libyasm/tests/opt-circular2-err.errwarn \
+ libyasm/tests/opt-circular3-err.asm \
+ libyasm/tests/opt-circular3-err.errwarn \
+ libyasm/tests/opt-gvmat64.asm libyasm/tests/opt-gvmat64.hex \
+ libyasm/tests/opt-immexpand.asm \
+ libyasm/tests/opt-immexpand.hex \
+ libyasm/tests/opt-immnoexpand.asm \
+ libyasm/tests/opt-immnoexpand.hex \
+ libyasm/tests/opt-oldalign.asm libyasm/tests/opt-oldalign.hex \
+ libyasm/tests/opt-struc.asm libyasm/tests/opt-struc.hex \
+ libyasm/tests/reserve-err1.asm \
+ libyasm/tests/reserve-err1.errwarn \
+ libyasm/tests/reserve-err2.asm \
+ libyasm/tests/reserve-err2.errwarn libyasm/tests/strucsize.asm \
+ libyasm/tests/strucsize.hex libyasm/tests/times0.asm \
+ libyasm/tests/times0.hex libyasm/tests/timesover-err.asm \
+ libyasm/tests/timesover-err.errwarn \
+ libyasm/tests/timesunder.asm libyasm/tests/timesunder.hex \
+ libyasm/tests/times-res.asm libyasm/tests/times-res.errwarn \
+ libyasm/tests/times-res.hex libyasm/tests/unary.asm \
+ libyasm/tests/unary.hex libyasm/tests/value-err.asm \
+ libyasm/tests/value-err.errwarn \
+ libyasm/tests/value-samesym.asm \
+ libyasm/tests/value-samesym.errwarn \
+ libyasm/tests/value-samesym.hex libyasm/tests/value-mask.asm \
+ libyasm/tests/value-mask.errwarn libyasm/tests/value-mask.hex \
+ frontends/yasm/Makefile.inc frontends/tasm/Makefile.inc \
+ frontends/yasm/yasm.xml m4/intmax.m4 m4/longdouble.m4 \
+ m4/nls.m4 m4/po.m4 m4/printf-posix.m4 m4/signed.m4 \
+ m4/size_max.m4 m4/ulonglong.m4 m4/wchar_t.m4 m4/wint_t.m4 \
+ m4/xsize.m4 m4/codeset.m4 m4/gettext.m4 m4/glibc21.m4 \
+ m4/iconv.m4 m4/intdiv0.m4 m4/inttypes.m4 m4/inttypes_h.m4 \
+ m4/inttypes-pri.m4 m4/isc-posix.m4 m4/lcmessage.m4 \
+ m4/lib-ld.m4 m4/lib-link.m4 m4/lib-prefix.m4 m4/longlong.m4 \
+ m4/progtest.m4 m4/stdint_h.m4 m4/uintmax_t.m4 m4/pythonhead.m4 \
+ m4/pyrex.m4 out_test.sh Artistic.txt BSD.txt GNU_GPL-2.0 \
+ GNU_LGPL-2.0 splint.sh Mkfiles/Makefile.flat \
+ Mkfiles/Makefile.dj Mkfiles/dj/config.h \
+ Mkfiles/dj/libyasm-stdint.h \
+ Mkfiles/vc9/crt_secure_no_deprecate.vsprops \
+ Mkfiles/vc9/yasm.sln Mkfiles/vc9/yasm.vcproj \
+ Mkfiles/vc9/ytasm.vcproj Mkfiles/vc9/config.h \
+ Mkfiles/vc9/libyasm-stdint.h Mkfiles/vc9/readme.vc9.txt \
+ Mkfiles/vc9/yasm.rules Mkfiles/vc9/vc98_swap.py \
+ Mkfiles/vc9/genmacro/genmacro.vcproj \
+ Mkfiles/vc9/genmacro/run.bat \
+ Mkfiles/vc9/genmodule/genmodule.vcproj \
+ Mkfiles/vc9/genmodule/run.bat \
+ Mkfiles/vc9/genstring/genstring.vcproj \
+ Mkfiles/vc9/genstring/run.bat \
+ Mkfiles/vc9/genversion/genversion.vcproj \
+ Mkfiles/vc9/genversion/run.bat \
+ Mkfiles/vc9/libyasm/libyasm.vcproj \
+ Mkfiles/vc9/modules/modules.vcproj \
+ Mkfiles/vc9/re2c/re2c.vcproj Mkfiles/vc9/re2c/run.bat \
+ Mkfiles/vc9/genperf/genperf.vcproj Mkfiles/vc9/genperf/run.bat \
+ genstring.c
+
+# libyasm-stdint.h doesn't clean up after itself?
+CONFIG_CLEAN_FILES = libyasm-stdint.h
+re2c_SOURCES =
+re2c_LDADD = re2c-main.$(OBJEXT) re2c-code.$(OBJEXT) \
+ re2c-dfa.$(OBJEXT) re2c-parser.$(OBJEXT) \
+ re2c-actions.$(OBJEXT) re2c-scanner.$(OBJEXT) \
+ re2c-mbo_getopt.$(OBJEXT) re2c-substr.$(OBJEXT) \
+ re2c-translate.$(OBJEXT)
+re2c_LINK = $(CCLD_FOR_BUILD) -o $@
+genmacro_SOURCES =
+genmacro_LDADD = genmacro.$(OBJEXT)
+genmacro_LINK = $(CCLD_FOR_BUILD) -o $@
+genperf_SOURCES =
+genperf_LDADD = genperf.$(OBJEXT) gp-perfect.$(OBJEXT) \
+ gp-phash.$(OBJEXT) gp-xmalloc.$(OBJEXT) gp-xstrdup.$(OBJEXT)
+genperf_LINK = $(CCLD_FOR_BUILD) -o $@
+PYBINDING_DEPS = tools/python-yasm/bytecode.pxi \
+ tools/python-yasm/errwarn.pxi tools/python-yasm/expr.pxi \
+ tools/python-yasm/floatnum.pxi tools/python-yasm/intnum.pxi \
+ tools/python-yasm/symrec.pxi tools/python-yasm/value.pxi
+YASM_MODULES = arch_x86 arch_lc3b listfmt_nasm parser_gas parser_gnu \
+ parser_nasm parser_tasm preproc_nasm preproc_tasm preproc_raw \
+ preproc_cpp dbgfmt_cv8 dbgfmt_dwarf2 dbgfmt_null dbgfmt_stabs \
+ objfmt_dbg objfmt_bin objfmt_dosexe objfmt_elf objfmt_elf32 \
+ objfmt_elf64 objfmt_coff objfmt_macho objfmt_macho32 \
+ objfmt_macho64 objfmt_rdf objfmt_win32 objfmt_win64 objfmt_x64 \
+ objfmt_xdf
+lib_LIBRARIES = libyasm.a
+libyasm_a_SOURCES = modules/arch/x86/x86arch.c \
+ modules/arch/x86/x86arch.h modules/arch/x86/x86bc.c \
+ modules/arch/x86/x86expr.c modules/arch/x86/x86id.c \
+ modules/arch/lc3b/lc3barch.c modules/arch/lc3b/lc3barch.h \
+ modules/arch/lc3b/lc3bbc.c \
+ modules/listfmts/nasm/nasm-listfmt.c \
+ modules/parsers/gas/gas-parser.c \
+ modules/parsers/gas/gas-parser.h \
+ modules/parsers/gas/gas-parse.c \
+ modules/parsers/nasm/nasm-parser.c \
+ modules/parsers/nasm/nasm-parser.h \
+ modules/parsers/nasm/nasm-parse.c \
+ modules/preprocs/nasm/nasm-preproc.c \
+ modules/preprocs/nasm/nasm-pp.h \
+ modules/preprocs/nasm/nasm-pp.c modules/preprocs/nasm/nasm.h \
+ modules/preprocs/nasm/nasmlib.h \
+ modules/preprocs/nasm/nasmlib.c \
+ modules/preprocs/nasm/nasm-eval.h \
+ modules/preprocs/nasm/nasm-eval.c \
+ modules/preprocs/raw/raw-preproc.c \
+ modules/preprocs/cpp/cpp-preproc.c \
+ modules/dbgfmts/codeview/cv-dbgfmt.h \
+ modules/dbgfmts/codeview/cv-dbgfmt.c \
+ modules/dbgfmts/codeview/cv-symline.c \
+ modules/dbgfmts/codeview/cv-type.c \
+ modules/dbgfmts/dwarf2/dwarf2-dbgfmt.h \
+ modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c \
+ modules/dbgfmts/dwarf2/dwarf2-line.c \
+ modules/dbgfmts/dwarf2/dwarf2-aranges.c \
+ modules/dbgfmts/dwarf2/dwarf2-info.c \
+ modules/dbgfmts/null/null-dbgfmt.c \
+ modules/dbgfmts/stabs/stabs-dbgfmt.c \
+ modules/objfmts/dbg/dbg-objfmt.c \
+ modules/objfmts/bin/bin-objfmt.c modules/objfmts/elf/elf.c \
+ modules/objfmts/elf/elf.h modules/objfmts/elf/elf-objfmt.c \
+ modules/objfmts/elf/elf-machine.h \
+ modules/objfmts/elf/elf-x86-x86.c \
+ modules/objfmts/elf/elf-x86-amd64.c \
+ modules/objfmts/coff/coff-objfmt.c \
+ modules/objfmts/coff/coff-objfmt.h \
+ modules/objfmts/coff/win64-except.c \
+ modules/objfmts/macho/macho-objfmt.c \
+ modules/objfmts/rdf/rdf-objfmt.c \
+ modules/objfmts/xdf/xdf-objfmt.c libyasm/assocdat.c \
+ libyasm/bitvect.c libyasm/bc-align.c libyasm/bc-data.c \
+ libyasm/bc-incbin.c libyasm/bc-org.c libyasm/bc-reserve.c \
+ libyasm/bytecode.c libyasm/errwarn.c libyasm/expr.c \
+ libyasm/file.c libyasm/floatnum.c libyasm/hamt.c \
+ libyasm/insn.c libyasm/intnum.c libyasm/inttree.c \
+ libyasm/linemap.c libyasm/md5.c libyasm/mergesort.c \
+ libyasm/phash.c libyasm/section.c libyasm/strcasecmp.c \
+ libyasm/strsep.c libyasm/symrec.c libyasm/valparam.c \
+ libyasm/value.c libyasm/xmalloc.c libyasm/xstrdup.c
+nodist_libyasm_a_SOURCES = x86cpu.c x86regtmod.c lc3bid.c gas-token.c \
+ nasm-token.c module.c
+genversion_SOURCES =
+genversion_LDADD = genversion.$(OBJEXT)
+genversion_LINK = $(CCLD_FOR_BUILD) -o $@
+genmodule_SOURCES =
+genmodule_LDADD = genmodule.$(OBJEXT)
+genmodule_LINK = $(CCLD_FOR_BUILD) -o $@
+modincludedir = $(includedir)/libyasm
+modinclude_HEADERS = libyasm/arch.h libyasm/assocdat.h \
+ libyasm/bitvect.h libyasm/bytecode.h libyasm/compat-queue.h \
+ libyasm/coretype.h libyasm/dbgfmt.h libyasm/errwarn.h \
+ libyasm/expr.h libyasm/file.h libyasm/floatnum.h \
+ libyasm/hamt.h libyasm/insn.h libyasm/intnum.h \
+ libyasm/inttree.h libyasm/linemap.h libyasm/listfmt.h \
+ libyasm/md5.h libyasm/module.h libyasm/objfmt.h \
+ libyasm/parser.h libyasm/phash.h libyasm/preproc.h \
+ libyasm/section.h libyasm/symrec.h libyasm/valparam.h \
+ libyasm/value.h
+bitvect_test_SOURCES = libyasm/tests/bitvect_test.c
+bitvect_test_LDADD = libyasm.a $(INTLLIBS)
+floatnum_test_SOURCES = libyasm/tests/floatnum_test.c
+floatnum_test_LDADD = libyasm.a $(INTLLIBS)
+leb128_test_SOURCES = libyasm/tests/leb128_test.c
+leb128_test_LDADD = libyasm.a $(INTLLIBS)
+splitpath_test_SOURCES = libyasm/tests/splitpath_test.c
+splitpath_test_LDADD = libyasm.a $(INTLLIBS)
+combpath_test_SOURCES = libyasm/tests/combpath_test.c
+combpath_test_LDADD = libyasm.a $(INTLLIBS)
+uncstring_test_SOURCES = libyasm/tests/uncstring_test.c
+uncstring_test_LDADD = libyasm.a $(INTLLIBS)
+yasm_SOURCES = frontends/yasm/yasm.c frontends/yasm/yasm-options.c \
+ frontends/yasm/yasm-options.h
+yasm_LDADD = libyasm.a $(INTLLIBS)
+ytasm_SOURCES = frontends/tasm/tasm.c frontends/tasm/tasm-options.c \
+ frontends/tasm/tasm-options.h
+ytasm_LDADD = libyasm.a $(INTLLIBS)
+ACLOCAL_AMFLAGS = -I m4
+
+# genstring build
+genstring_SOURCES =
+genstring_LDADD = genstring.$(OBJEXT)
+genstring_LINK = $(CCLD_FOR_BUILD) -o $@
+all: $(BUILT_SOURCES) config.h
+ $(MAKE) $(AM_MAKEFLAGS) all-recursive
+
+.SUFFIXES:
+.SUFFIXES: .gperf .c .o .obj
+am--refresh:
+ @:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(srcdir)/tools/Makefile.inc $(srcdir)/tools/re2c/Makefile.inc $(srcdir)/tools/genmacro/Makefile.inc $(srcdir)/tools/genperf/Makefile.inc $(srcdir)/tools/python-yasm/Makefile.inc $(srcdir)/tools/python-yasm/tests/Makefile.inc $(srcdir)/modules/Makefile.inc $(srcdir)/modules/arch/Makefile.inc $(srcdir)/modules/arch/x86/Makefile.inc $(srcdir)/modules/arch/x86/tests/Makefile.inc $(srcdir)/modules/arch/x86/tests/gas32/Makefile.inc $(srcdir)/modules/arch/x86/tests/gas64/Makefile.inc $(srcdir)/modules/arch/lc3b/Makefile.inc $(srcdir)/modules/arch/lc3b/tests/Makefile.inc $(srcdir)/modules/listfmts/Makefile.inc $(srcdir)/modules/listfmts/nasm/Makefile.inc $(srcdir)/modules/parsers/Makefile.inc $(srcdir)/modules/parsers/gas/Makefile.inc $(srcdir)/modules/parsers/gas/tests/Makefile.inc $(srcdir)/modules/parsers/gas/tests/bin/Makefile.inc $(srcdir)/modules/parsers/nasm/Makefile.inc $(srcdir)/modules/parsers/nasm/tests/Makefile.inc $(srcdir)/modules/parsers/nasm/tests/worphan/Makefile.inc $(srcdir)/modules/parsers/tasm/Makefile.inc $(srcdir)/modules/parsers/tasm/tests/Makefile.inc $(srcdir)/modules/parsers/tasm/tests/exe/Makefile.inc $(srcdir)/modules/preprocs/Makefile.inc $(srcdir)/modules/preprocs/nasm/Makefile.inc $(srcdir)/modules/preprocs/nasm/tests/Makefile.inc $(srcdir)/modules/preprocs/raw/Makefile.inc $(srcdir)/modules/preprocs/raw/tests/Makefile.inc $(srcdir)/modules/preprocs/cpp/Makefile.inc $(srcdir)/modules/dbgfmts/Makefile.inc $(srcdir)/modules/dbgfmts/codeview/Makefile.inc $(srcdir)/modules/dbgfmts/dwarf2/Makefile.inc $(srcdir)/modules/dbgfmts/dwarf2/tests/Makefile.inc $(srcdir)/modules/dbgfmts/dwarf2/tests/pass32/Makefile.inc $(srcdir)/modules/dbgfmts/dwarf2/tests/pass64/Makefile.inc $(srcdir)/modules/dbgfmts/dwarf2/tests/passwin64/Makefile.inc $(srcdir)/modules/dbgfmts/null/Makefile.inc $(srcdir)/modules/dbgfmts/stabs/Makefile.inc $(srcdir)/modules/dbgfmts/stabs/tests/Makefile.inc $(srcdir)/modules/objfmts/Makefile.inc $(srcdir)/modules/objfmts/dbg/Makefile.inc $(srcdir)/modules/objfmts/bin/Makefile.inc $(srcdir)/modules/objfmts/bin/tests/Makefile.inc $(srcdir)/modules/objfmts/bin/tests/multisect/Makefile.inc $(srcdir)/modules/objfmts/elf/Makefile.inc $(srcdir)/modules/objfmts/elf/tests/Makefile.inc $(srcdir)/modules/objfmts/elf/tests/amd64/Makefile.inc $(srcdir)/modules/objfmts/elf/tests/gas32/Makefile.inc $(srcdir)/modules/objfmts/elf/tests/gas64/Makefile.inc $(srcdir)/modules/objfmts/coff/Makefile.inc $(srcdir)/modules/objfmts/coff/tests/Makefile.inc $(srcdir)/modules/objfmts/macho/Makefile.inc $(srcdir)/modules/objfmts/macho/tests/Makefile.inc $(srcdir)/modules/objfmts/macho/tests/gas32/Makefile.inc $(srcdir)/modules/objfmts/macho/tests/gas64/Makefile.inc $(srcdir)/modules/objfmts/macho/tests/nasm32/Makefile.inc $(srcdir)/modules/objfmts/macho/tests/nasm64/Makefile.inc $(srcdir)/modules/objfmts/rdf/Makefile.inc $(srcdir)/modules/objfmts/rdf/tests/Makefile.inc $(srcdir)/modules/objfmts/win32/Makefile.inc $(srcdir)/modules/objfmts/win32/tests/Makefile.inc $(srcdir)/modules/objfmts/win32/tests/gas/Makefile.inc $(srcdir)/modules/objfmts/win64/Makefile.inc $(srcdir)/modules/objfmts/win64/tests/Makefile.inc $(srcdir)/modules/objfmts/win64/tests/gas/Makefile.inc $(srcdir)/modules/objfmts/xdf/Makefile.inc $(srcdir)/modules/objfmts/xdf/tests/Makefile.inc $(srcdir)/libyasm/Makefile.inc $(srcdir)/libyasm/tests/Makefile.inc $(srcdir)/frontends/Makefile.inc $(srcdir)/frontends/yasm/Makefile.inc $(srcdir)/frontends/tasm/Makefile.inc $(srcdir)/m4/Makefile.inc $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \
+ cd $(srcdir) && $(AUTOMAKE) --gnu \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ echo ' $(SHELL) ./config.status'; \
+ $(SHELL) ./config.status;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ $(SHELL) ./config.status --recheck
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(srcdir) && $(AUTOCONF)
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+
+config.h: stamp-h1
+ @if test ! -f $@; then \
+ rm -f stamp-h1; \
+ $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \
+ else :; fi
+
+stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
+ @rm -f stamp-h1
+ cd $(top_builddir) && $(SHELL) ./config.status config.h
+$(srcdir)/config.h.in: $(am__configure_deps)
+ cd $(top_srcdir) && $(AUTOHEADER)
+ rm -f stamp-h1
+ touch $@
+
+distclean-hdr:
+ -rm -f config.h stamp-h1
+install-libLIBRARIES: $(lib_LIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
+ @list='$(lib_LIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f=$(am__strip_dir) \
+ echo " $(libLIBRARIES_INSTALL) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
+ $(libLIBRARIES_INSTALL) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
+ else :; fi; \
+ done
+ @$(POST_INSTALL)
+ @list='$(lib_LIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ p=$(am__strip_dir) \
+ echo " $(RANLIB) '$(DESTDIR)$(libdir)/$$p'"; \
+ $(RANLIB) "$(DESTDIR)$(libdir)/$$p"; \
+ else :; fi; \
+ done
+
+uninstall-libLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(lib_LIBRARIES)'; for p in $$list; do \
+ p=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(libdir)/$$p'"; \
+ rm -f "$(DESTDIR)$(libdir)/$$p"; \
+ done
+
+clean-libLIBRARIES:
+ -test -z "$(lib_LIBRARIES)" || rm -f $(lib_LIBRARIES)
+libyasm.a: $(libyasm_a_OBJECTS) $(libyasm_a_DEPENDENCIES)
+ -rm -f libyasm.a
+ $(libyasm_a_AR) libyasm.a $(libyasm_a_OBJECTS) $(libyasm_a_LIBADD)
+ $(RANLIB) libyasm.a
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+
+clean-checkPROGRAMS:
+ -test -z "$(check_PROGRAMS)" || rm -f $(check_PROGRAMS)
+
+clean-noinstPROGRAMS:
+ -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS)
+bitvect_test$(EXEEXT): $(bitvect_test_OBJECTS) $(bitvect_test_DEPENDENCIES)
+ @rm -f bitvect_test$(EXEEXT)
+ $(LINK) $(bitvect_test_OBJECTS) $(bitvect_test_LDADD) $(LIBS)
+combpath_test$(EXEEXT): $(combpath_test_OBJECTS) $(combpath_test_DEPENDENCIES)
+ @rm -f combpath_test$(EXEEXT)
+ $(LINK) $(combpath_test_OBJECTS) $(combpath_test_LDADD) $(LIBS)
+floatnum_test$(EXEEXT): $(floatnum_test_OBJECTS) $(floatnum_test_DEPENDENCIES)
+ @rm -f floatnum_test$(EXEEXT)
+ $(LINK) $(floatnum_test_OBJECTS) $(floatnum_test_LDADD) $(LIBS)
+genmacro$(EXEEXT): $(genmacro_OBJECTS) $(genmacro_DEPENDENCIES)
+ @rm -f genmacro$(EXEEXT)
+ $(genmacro_LINK) $(genmacro_OBJECTS) $(genmacro_LDADD) $(LIBS)
+genmodule$(EXEEXT): $(genmodule_OBJECTS) $(genmodule_DEPENDENCIES)
+ @rm -f genmodule$(EXEEXT)
+ $(genmodule_LINK) $(genmodule_OBJECTS) $(genmodule_LDADD) $(LIBS)
+genperf$(EXEEXT): $(genperf_OBJECTS) $(genperf_DEPENDENCIES)
+ @rm -f genperf$(EXEEXT)
+ $(genperf_LINK) $(genperf_OBJECTS) $(genperf_LDADD) $(LIBS)
+genstring$(EXEEXT): $(genstring_OBJECTS) $(genstring_DEPENDENCIES)
+ @rm -f genstring$(EXEEXT)
+ $(genstring_LINK) $(genstring_OBJECTS) $(genstring_LDADD) $(LIBS)
+genversion$(EXEEXT): $(genversion_OBJECTS) $(genversion_DEPENDENCIES)
+ @rm -f genversion$(EXEEXT)
+ $(genversion_LINK) $(genversion_OBJECTS) $(genversion_LDADD) $(LIBS)
+leb128_test$(EXEEXT): $(leb128_test_OBJECTS) $(leb128_test_DEPENDENCIES)
+ @rm -f leb128_test$(EXEEXT)
+ $(LINK) $(leb128_test_OBJECTS) $(leb128_test_LDADD) $(LIBS)
+re2c$(EXEEXT): $(re2c_OBJECTS) $(re2c_DEPENDENCIES)
+ @rm -f re2c$(EXEEXT)
+ $(re2c_LINK) $(re2c_OBJECTS) $(re2c_LDADD) $(LIBS)
+splitpath_test$(EXEEXT): $(splitpath_test_OBJECTS) $(splitpath_test_DEPENDENCIES)
+ @rm -f splitpath_test$(EXEEXT)
+ $(LINK) $(splitpath_test_OBJECTS) $(splitpath_test_LDADD) $(LIBS)
+test_hd$(EXEEXT): $(test_hd_OBJECTS) $(test_hd_DEPENDENCIES)
+ @rm -f test_hd$(EXEEXT)
+ $(LINK) $(test_hd_OBJECTS) $(test_hd_LDADD) $(LIBS)
+uncstring_test$(EXEEXT): $(uncstring_test_OBJECTS) $(uncstring_test_DEPENDENCIES)
+ @rm -f uncstring_test$(EXEEXT)
+ $(LINK) $(uncstring_test_OBJECTS) $(uncstring_test_LDADD) $(LIBS)
+yasm$(EXEEXT): $(yasm_OBJECTS) $(yasm_DEPENDENCIES)
+ @rm -f yasm$(EXEEXT)
+ $(LINK) $(yasm_OBJECTS) $(yasm_LDADD) $(LIBS)
+ytasm$(EXEEXT): $(ytasm_OBJECTS) $(ytasm_DEPENDENCIES)
+ @rm -f ytasm$(EXEEXT)
+ $(LINK) $(ytasm_OBJECTS) $(ytasm_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+include ./$(DEPDIR)/assocdat.Po
+include ./$(DEPDIR)/bc-align.Po
+include ./$(DEPDIR)/bc-data.Po
+include ./$(DEPDIR)/bc-incbin.Po
+include ./$(DEPDIR)/bc-org.Po
+include ./$(DEPDIR)/bc-reserve.Po
+include ./$(DEPDIR)/bin-objfmt.Po
+include ./$(DEPDIR)/bitvect.Po
+include ./$(DEPDIR)/bitvect_test.Po
+include ./$(DEPDIR)/bytecode.Po
+include ./$(DEPDIR)/coff-objfmt.Po
+include ./$(DEPDIR)/combpath_test.Po
+include ./$(DEPDIR)/cpp-preproc.Po
+include ./$(DEPDIR)/cv-dbgfmt.Po
+include ./$(DEPDIR)/cv-symline.Po
+include ./$(DEPDIR)/cv-type.Po
+include ./$(DEPDIR)/dbg-objfmt.Po
+include ./$(DEPDIR)/dwarf2-aranges.Po
+include ./$(DEPDIR)/dwarf2-dbgfmt.Po
+include ./$(DEPDIR)/dwarf2-info.Po
+include ./$(DEPDIR)/dwarf2-line.Po
+include ./$(DEPDIR)/elf-objfmt.Po
+include ./$(DEPDIR)/elf-x86-amd64.Po
+include ./$(DEPDIR)/elf-x86-x86.Po
+include ./$(DEPDIR)/elf.Po
+include ./$(DEPDIR)/errwarn.Po
+include ./$(DEPDIR)/expr.Po
+include ./$(DEPDIR)/file.Po
+include ./$(DEPDIR)/floatnum.Po
+include ./$(DEPDIR)/floatnum_test.Po
+include ./$(DEPDIR)/gas-parse.Po
+include ./$(DEPDIR)/gas-parser.Po
+include ./$(DEPDIR)/gas-token.Po
+include ./$(DEPDIR)/hamt.Po
+include ./$(DEPDIR)/insn.Po
+include ./$(DEPDIR)/intnum.Po
+include ./$(DEPDIR)/inttree.Po
+include ./$(DEPDIR)/lc3barch.Po
+include ./$(DEPDIR)/lc3bbc.Po
+include ./$(DEPDIR)/lc3bid.Po
+include ./$(DEPDIR)/leb128_test.Po
+include ./$(DEPDIR)/linemap.Po
+include ./$(DEPDIR)/macho-objfmt.Po
+include ./$(DEPDIR)/md5.Po
+include ./$(DEPDIR)/mergesort.Po
+include ./$(DEPDIR)/module.Po
+include ./$(DEPDIR)/nasm-eval.Po
+include ./$(DEPDIR)/nasm-listfmt.Po
+include ./$(DEPDIR)/nasm-parse.Po
+include ./$(DEPDIR)/nasm-parser.Po
+include ./$(DEPDIR)/nasm-pp.Po
+include ./$(DEPDIR)/nasm-preproc.Po
+include ./$(DEPDIR)/nasm-token.Po
+include ./$(DEPDIR)/nasmlib.Po
+include ./$(DEPDIR)/null-dbgfmt.Po
+include ./$(DEPDIR)/phash.Po
+include ./$(DEPDIR)/raw-preproc.Po
+include ./$(DEPDIR)/rdf-objfmt.Po
+include ./$(DEPDIR)/section.Po
+include ./$(DEPDIR)/splitpath_test.Po
+include ./$(DEPDIR)/stabs-dbgfmt.Po
+include ./$(DEPDIR)/strcasecmp.Po
+include ./$(DEPDIR)/strsep.Po
+include ./$(DEPDIR)/symrec.Po
+include ./$(DEPDIR)/tasm-options.Po
+include ./$(DEPDIR)/tasm.Po
+include ./$(DEPDIR)/test_hd.Po
+include ./$(DEPDIR)/uncstring_test.Po
+include ./$(DEPDIR)/valparam.Po
+include ./$(DEPDIR)/value.Po
+include ./$(DEPDIR)/win64-except.Po
+include ./$(DEPDIR)/x86arch.Po
+include ./$(DEPDIR)/x86bc.Po
+include ./$(DEPDIR)/x86cpu.Po
+include ./$(DEPDIR)/x86expr.Po
+include ./$(DEPDIR)/x86id.Po
+include ./$(DEPDIR)/x86regtmod.Po
+include ./$(DEPDIR)/xdf-objfmt.Po
+include ./$(DEPDIR)/xmalloc.Po
+include ./$(DEPDIR)/xstrdup.Po
+include ./$(DEPDIR)/yasm-options.Po
+include ./$(DEPDIR)/yasm.Po
+
+.c.o:
+ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+# source='$<' object='$@' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(COMPILE) -c $<
+
+.c.obj:
+ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+# source='$<' object='$@' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+x86arch.o: modules/arch/x86/x86arch.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT x86arch.o -MD -MP -MF $(DEPDIR)/x86arch.Tpo -c -o x86arch.o `test -f 'modules/arch/x86/x86arch.c' || echo '$(srcdir)/'`modules/arch/x86/x86arch.c
+ mv -f $(DEPDIR)/x86arch.Tpo $(DEPDIR)/x86arch.Po
+# source='modules/arch/x86/x86arch.c' object='x86arch.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o x86arch.o `test -f 'modules/arch/x86/x86arch.c' || echo '$(srcdir)/'`modules/arch/x86/x86arch.c
+
+x86arch.obj: modules/arch/x86/x86arch.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT x86arch.obj -MD -MP -MF $(DEPDIR)/x86arch.Tpo -c -o x86arch.obj `if test -f 'modules/arch/x86/x86arch.c'; then $(CYGPATH_W) 'modules/arch/x86/x86arch.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/x86/x86arch.c'; fi`
+ mv -f $(DEPDIR)/x86arch.Tpo $(DEPDIR)/x86arch.Po
+# source='modules/arch/x86/x86arch.c' object='x86arch.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o x86arch.obj `if test -f 'modules/arch/x86/x86arch.c'; then $(CYGPATH_W) 'modules/arch/x86/x86arch.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/x86/x86arch.c'; fi`
+
+x86bc.o: modules/arch/x86/x86bc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT x86bc.o -MD -MP -MF $(DEPDIR)/x86bc.Tpo -c -o x86bc.o `test -f 'modules/arch/x86/x86bc.c' || echo '$(srcdir)/'`modules/arch/x86/x86bc.c
+ mv -f $(DEPDIR)/x86bc.Tpo $(DEPDIR)/x86bc.Po
+# source='modules/arch/x86/x86bc.c' object='x86bc.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o x86bc.o `test -f 'modules/arch/x86/x86bc.c' || echo '$(srcdir)/'`modules/arch/x86/x86bc.c
+
+x86bc.obj: modules/arch/x86/x86bc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT x86bc.obj -MD -MP -MF $(DEPDIR)/x86bc.Tpo -c -o x86bc.obj `if test -f 'modules/arch/x86/x86bc.c'; then $(CYGPATH_W) 'modules/arch/x86/x86bc.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/x86/x86bc.c'; fi`
+ mv -f $(DEPDIR)/x86bc.Tpo $(DEPDIR)/x86bc.Po
+# source='modules/arch/x86/x86bc.c' object='x86bc.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o x86bc.obj `if test -f 'modules/arch/x86/x86bc.c'; then $(CYGPATH_W) 'modules/arch/x86/x86bc.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/x86/x86bc.c'; fi`
+
+x86expr.o: modules/arch/x86/x86expr.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT x86expr.o -MD -MP -MF $(DEPDIR)/x86expr.Tpo -c -o x86expr.o `test -f 'modules/arch/x86/x86expr.c' || echo '$(srcdir)/'`modules/arch/x86/x86expr.c
+ mv -f $(DEPDIR)/x86expr.Tpo $(DEPDIR)/x86expr.Po
+# source='modules/arch/x86/x86expr.c' object='x86expr.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o x86expr.o `test -f 'modules/arch/x86/x86expr.c' || echo '$(srcdir)/'`modules/arch/x86/x86expr.c
+
+x86expr.obj: modules/arch/x86/x86expr.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT x86expr.obj -MD -MP -MF $(DEPDIR)/x86expr.Tpo -c -o x86expr.obj `if test -f 'modules/arch/x86/x86expr.c'; then $(CYGPATH_W) 'modules/arch/x86/x86expr.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/x86/x86expr.c'; fi`
+ mv -f $(DEPDIR)/x86expr.Tpo $(DEPDIR)/x86expr.Po
+# source='modules/arch/x86/x86expr.c' object='x86expr.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o x86expr.obj `if test -f 'modules/arch/x86/x86expr.c'; then $(CYGPATH_W) 'modules/arch/x86/x86expr.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/x86/x86expr.c'; fi`
+
+x86id.o: modules/arch/x86/x86id.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT x86id.o -MD -MP -MF $(DEPDIR)/x86id.Tpo -c -o x86id.o `test -f 'modules/arch/x86/x86id.c' || echo '$(srcdir)/'`modules/arch/x86/x86id.c
+ mv -f $(DEPDIR)/x86id.Tpo $(DEPDIR)/x86id.Po
+# source='modules/arch/x86/x86id.c' object='x86id.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o x86id.o `test -f 'modules/arch/x86/x86id.c' || echo '$(srcdir)/'`modules/arch/x86/x86id.c
+
+x86id.obj: modules/arch/x86/x86id.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT x86id.obj -MD -MP -MF $(DEPDIR)/x86id.Tpo -c -o x86id.obj `if test -f 'modules/arch/x86/x86id.c'; then $(CYGPATH_W) 'modules/arch/x86/x86id.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/x86/x86id.c'; fi`
+ mv -f $(DEPDIR)/x86id.Tpo $(DEPDIR)/x86id.Po
+# source='modules/arch/x86/x86id.c' object='x86id.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o x86id.obj `if test -f 'modules/arch/x86/x86id.c'; then $(CYGPATH_W) 'modules/arch/x86/x86id.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/x86/x86id.c'; fi`
+
+lc3barch.o: modules/arch/lc3b/lc3barch.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lc3barch.o -MD -MP -MF $(DEPDIR)/lc3barch.Tpo -c -o lc3barch.o `test -f 'modules/arch/lc3b/lc3barch.c' || echo '$(srcdir)/'`modules/arch/lc3b/lc3barch.c
+ mv -f $(DEPDIR)/lc3barch.Tpo $(DEPDIR)/lc3barch.Po
+# source='modules/arch/lc3b/lc3barch.c' object='lc3barch.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lc3barch.o `test -f 'modules/arch/lc3b/lc3barch.c' || echo '$(srcdir)/'`modules/arch/lc3b/lc3barch.c
+
+lc3barch.obj: modules/arch/lc3b/lc3barch.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lc3barch.obj -MD -MP -MF $(DEPDIR)/lc3barch.Tpo -c -o lc3barch.obj `if test -f 'modules/arch/lc3b/lc3barch.c'; then $(CYGPATH_W) 'modules/arch/lc3b/lc3barch.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/lc3b/lc3barch.c'; fi`
+ mv -f $(DEPDIR)/lc3barch.Tpo $(DEPDIR)/lc3barch.Po
+# source='modules/arch/lc3b/lc3barch.c' object='lc3barch.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lc3barch.obj `if test -f 'modules/arch/lc3b/lc3barch.c'; then $(CYGPATH_W) 'modules/arch/lc3b/lc3barch.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/lc3b/lc3barch.c'; fi`
+
+lc3bbc.o: modules/arch/lc3b/lc3bbc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lc3bbc.o -MD -MP -MF $(DEPDIR)/lc3bbc.Tpo -c -o lc3bbc.o `test -f 'modules/arch/lc3b/lc3bbc.c' || echo '$(srcdir)/'`modules/arch/lc3b/lc3bbc.c
+ mv -f $(DEPDIR)/lc3bbc.Tpo $(DEPDIR)/lc3bbc.Po
+# source='modules/arch/lc3b/lc3bbc.c' object='lc3bbc.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lc3bbc.o `test -f 'modules/arch/lc3b/lc3bbc.c' || echo '$(srcdir)/'`modules/arch/lc3b/lc3bbc.c
+
+lc3bbc.obj: modules/arch/lc3b/lc3bbc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lc3bbc.obj -MD -MP -MF $(DEPDIR)/lc3bbc.Tpo -c -o lc3bbc.obj `if test -f 'modules/arch/lc3b/lc3bbc.c'; then $(CYGPATH_W) 'modules/arch/lc3b/lc3bbc.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/lc3b/lc3bbc.c'; fi`
+ mv -f $(DEPDIR)/lc3bbc.Tpo $(DEPDIR)/lc3bbc.Po
+# source='modules/arch/lc3b/lc3bbc.c' object='lc3bbc.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lc3bbc.obj `if test -f 'modules/arch/lc3b/lc3bbc.c'; then $(CYGPATH_W) 'modules/arch/lc3b/lc3bbc.c'; else $(CYGPATH_W) '$(srcdir)/modules/arch/lc3b/lc3bbc.c'; fi`
+
+nasm-listfmt.o: modules/listfmts/nasm/nasm-listfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-listfmt.o -MD -MP -MF $(DEPDIR)/nasm-listfmt.Tpo -c -o nasm-listfmt.o `test -f 'modules/listfmts/nasm/nasm-listfmt.c' || echo '$(srcdir)/'`modules/listfmts/nasm/nasm-listfmt.c
+ mv -f $(DEPDIR)/nasm-listfmt.Tpo $(DEPDIR)/nasm-listfmt.Po
+# source='modules/listfmts/nasm/nasm-listfmt.c' object='nasm-listfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-listfmt.o `test -f 'modules/listfmts/nasm/nasm-listfmt.c' || echo '$(srcdir)/'`modules/listfmts/nasm/nasm-listfmt.c
+
+nasm-listfmt.obj: modules/listfmts/nasm/nasm-listfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-listfmt.obj -MD -MP -MF $(DEPDIR)/nasm-listfmt.Tpo -c -o nasm-listfmt.obj `if test -f 'modules/listfmts/nasm/nasm-listfmt.c'; then $(CYGPATH_W) 'modules/listfmts/nasm/nasm-listfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/listfmts/nasm/nasm-listfmt.c'; fi`
+ mv -f $(DEPDIR)/nasm-listfmt.Tpo $(DEPDIR)/nasm-listfmt.Po
+# source='modules/listfmts/nasm/nasm-listfmt.c' object='nasm-listfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-listfmt.obj `if test -f 'modules/listfmts/nasm/nasm-listfmt.c'; then $(CYGPATH_W) 'modules/listfmts/nasm/nasm-listfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/listfmts/nasm/nasm-listfmt.c'; fi`
+
+gas-parser.o: modules/parsers/gas/gas-parser.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gas-parser.o -MD -MP -MF $(DEPDIR)/gas-parser.Tpo -c -o gas-parser.o `test -f 'modules/parsers/gas/gas-parser.c' || echo '$(srcdir)/'`modules/parsers/gas/gas-parser.c
+ mv -f $(DEPDIR)/gas-parser.Tpo $(DEPDIR)/gas-parser.Po
+# source='modules/parsers/gas/gas-parser.c' object='gas-parser.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gas-parser.o `test -f 'modules/parsers/gas/gas-parser.c' || echo '$(srcdir)/'`modules/parsers/gas/gas-parser.c
+
+gas-parser.obj: modules/parsers/gas/gas-parser.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gas-parser.obj -MD -MP -MF $(DEPDIR)/gas-parser.Tpo -c -o gas-parser.obj `if test -f 'modules/parsers/gas/gas-parser.c'; then $(CYGPATH_W) 'modules/parsers/gas/gas-parser.c'; else $(CYGPATH_W) '$(srcdir)/modules/parsers/gas/gas-parser.c'; fi`
+ mv -f $(DEPDIR)/gas-parser.Tpo $(DEPDIR)/gas-parser.Po
+# source='modules/parsers/gas/gas-parser.c' object='gas-parser.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gas-parser.obj `if test -f 'modules/parsers/gas/gas-parser.c'; then $(CYGPATH_W) 'modules/parsers/gas/gas-parser.c'; else $(CYGPATH_W) '$(srcdir)/modules/parsers/gas/gas-parser.c'; fi`
+
+gas-parse.o: modules/parsers/gas/gas-parse.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gas-parse.o -MD -MP -MF $(DEPDIR)/gas-parse.Tpo -c -o gas-parse.o `test -f 'modules/parsers/gas/gas-parse.c' || echo '$(srcdir)/'`modules/parsers/gas/gas-parse.c
+ mv -f $(DEPDIR)/gas-parse.Tpo $(DEPDIR)/gas-parse.Po
+# source='modules/parsers/gas/gas-parse.c' object='gas-parse.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gas-parse.o `test -f 'modules/parsers/gas/gas-parse.c' || echo '$(srcdir)/'`modules/parsers/gas/gas-parse.c
+
+gas-parse.obj: modules/parsers/gas/gas-parse.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gas-parse.obj -MD -MP -MF $(DEPDIR)/gas-parse.Tpo -c -o gas-parse.obj `if test -f 'modules/parsers/gas/gas-parse.c'; then $(CYGPATH_W) 'modules/parsers/gas/gas-parse.c'; else $(CYGPATH_W) '$(srcdir)/modules/parsers/gas/gas-parse.c'; fi`
+ mv -f $(DEPDIR)/gas-parse.Tpo $(DEPDIR)/gas-parse.Po
+# source='modules/parsers/gas/gas-parse.c' object='gas-parse.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gas-parse.obj `if test -f 'modules/parsers/gas/gas-parse.c'; then $(CYGPATH_W) 'modules/parsers/gas/gas-parse.c'; else $(CYGPATH_W) '$(srcdir)/modules/parsers/gas/gas-parse.c'; fi`
+
+nasm-parser.o: modules/parsers/nasm/nasm-parser.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-parser.o -MD -MP -MF $(DEPDIR)/nasm-parser.Tpo -c -o nasm-parser.o `test -f 'modules/parsers/nasm/nasm-parser.c' || echo '$(srcdir)/'`modules/parsers/nasm/nasm-parser.c
+ mv -f $(DEPDIR)/nasm-parser.Tpo $(DEPDIR)/nasm-parser.Po
+# source='modules/parsers/nasm/nasm-parser.c' object='nasm-parser.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-parser.o `test -f 'modules/parsers/nasm/nasm-parser.c' || echo '$(srcdir)/'`modules/parsers/nasm/nasm-parser.c
+
+nasm-parser.obj: modules/parsers/nasm/nasm-parser.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-parser.obj -MD -MP -MF $(DEPDIR)/nasm-parser.Tpo -c -o nasm-parser.obj `if test -f 'modules/parsers/nasm/nasm-parser.c'; then $(CYGPATH_W) 'modules/parsers/nasm/nasm-parser.c'; else $(CYGPATH_W) '$(srcdir)/modules/parsers/nasm/nasm-parser.c'; fi`
+ mv -f $(DEPDIR)/nasm-parser.Tpo $(DEPDIR)/nasm-parser.Po
+# source='modules/parsers/nasm/nasm-parser.c' object='nasm-parser.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-parser.obj `if test -f 'modules/parsers/nasm/nasm-parser.c'; then $(CYGPATH_W) 'modules/parsers/nasm/nasm-parser.c'; else $(CYGPATH_W) '$(srcdir)/modules/parsers/nasm/nasm-parser.c'; fi`
+
+nasm-parse.o: modules/parsers/nasm/nasm-parse.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-parse.o -MD -MP -MF $(DEPDIR)/nasm-parse.Tpo -c -o nasm-parse.o `test -f 'modules/parsers/nasm/nasm-parse.c' || echo '$(srcdir)/'`modules/parsers/nasm/nasm-parse.c
+ mv -f $(DEPDIR)/nasm-parse.Tpo $(DEPDIR)/nasm-parse.Po
+# source='modules/parsers/nasm/nasm-parse.c' object='nasm-parse.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-parse.o `test -f 'modules/parsers/nasm/nasm-parse.c' || echo '$(srcdir)/'`modules/parsers/nasm/nasm-parse.c
+
+nasm-parse.obj: modules/parsers/nasm/nasm-parse.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-parse.obj -MD -MP -MF $(DEPDIR)/nasm-parse.Tpo -c -o nasm-parse.obj `if test -f 'modules/parsers/nasm/nasm-parse.c'; then $(CYGPATH_W) 'modules/parsers/nasm/nasm-parse.c'; else $(CYGPATH_W) '$(srcdir)/modules/parsers/nasm/nasm-parse.c'; fi`
+ mv -f $(DEPDIR)/nasm-parse.Tpo $(DEPDIR)/nasm-parse.Po
+# source='modules/parsers/nasm/nasm-parse.c' object='nasm-parse.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-parse.obj `if test -f 'modules/parsers/nasm/nasm-parse.c'; then $(CYGPATH_W) 'modules/parsers/nasm/nasm-parse.c'; else $(CYGPATH_W) '$(srcdir)/modules/parsers/nasm/nasm-parse.c'; fi`
+
+nasm-preproc.o: modules/preprocs/nasm/nasm-preproc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-preproc.o -MD -MP -MF $(DEPDIR)/nasm-preproc.Tpo -c -o nasm-preproc.o `test -f 'modules/preprocs/nasm/nasm-preproc.c' || echo '$(srcdir)/'`modules/preprocs/nasm/nasm-preproc.c
+ mv -f $(DEPDIR)/nasm-preproc.Tpo $(DEPDIR)/nasm-preproc.Po
+# source='modules/preprocs/nasm/nasm-preproc.c' object='nasm-preproc.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-preproc.o `test -f 'modules/preprocs/nasm/nasm-preproc.c' || echo '$(srcdir)/'`modules/preprocs/nasm/nasm-preproc.c
+
+nasm-preproc.obj: modules/preprocs/nasm/nasm-preproc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-preproc.obj -MD -MP -MF $(DEPDIR)/nasm-preproc.Tpo -c -o nasm-preproc.obj `if test -f 'modules/preprocs/nasm/nasm-preproc.c'; then $(CYGPATH_W) 'modules/preprocs/nasm/nasm-preproc.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/nasm/nasm-preproc.c'; fi`
+ mv -f $(DEPDIR)/nasm-preproc.Tpo $(DEPDIR)/nasm-preproc.Po
+# source='modules/preprocs/nasm/nasm-preproc.c' object='nasm-preproc.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-preproc.obj `if test -f 'modules/preprocs/nasm/nasm-preproc.c'; then $(CYGPATH_W) 'modules/preprocs/nasm/nasm-preproc.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/nasm/nasm-preproc.c'; fi`
+
+nasm-pp.o: modules/preprocs/nasm/nasm-pp.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-pp.o -MD -MP -MF $(DEPDIR)/nasm-pp.Tpo -c -o nasm-pp.o `test -f 'modules/preprocs/nasm/nasm-pp.c' || echo '$(srcdir)/'`modules/preprocs/nasm/nasm-pp.c
+ mv -f $(DEPDIR)/nasm-pp.Tpo $(DEPDIR)/nasm-pp.Po
+# source='modules/preprocs/nasm/nasm-pp.c' object='nasm-pp.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-pp.o `test -f 'modules/preprocs/nasm/nasm-pp.c' || echo '$(srcdir)/'`modules/preprocs/nasm/nasm-pp.c
+
+nasm-pp.obj: modules/preprocs/nasm/nasm-pp.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-pp.obj -MD -MP -MF $(DEPDIR)/nasm-pp.Tpo -c -o nasm-pp.obj `if test -f 'modules/preprocs/nasm/nasm-pp.c'; then $(CYGPATH_W) 'modules/preprocs/nasm/nasm-pp.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/nasm/nasm-pp.c'; fi`
+ mv -f $(DEPDIR)/nasm-pp.Tpo $(DEPDIR)/nasm-pp.Po
+# source='modules/preprocs/nasm/nasm-pp.c' object='nasm-pp.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-pp.obj `if test -f 'modules/preprocs/nasm/nasm-pp.c'; then $(CYGPATH_W) 'modules/preprocs/nasm/nasm-pp.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/nasm/nasm-pp.c'; fi`
+
+nasmlib.o: modules/preprocs/nasm/nasmlib.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasmlib.o -MD -MP -MF $(DEPDIR)/nasmlib.Tpo -c -o nasmlib.o `test -f 'modules/preprocs/nasm/nasmlib.c' || echo '$(srcdir)/'`modules/preprocs/nasm/nasmlib.c
+ mv -f $(DEPDIR)/nasmlib.Tpo $(DEPDIR)/nasmlib.Po
+# source='modules/preprocs/nasm/nasmlib.c' object='nasmlib.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasmlib.o `test -f 'modules/preprocs/nasm/nasmlib.c' || echo '$(srcdir)/'`modules/preprocs/nasm/nasmlib.c
+
+nasmlib.obj: modules/preprocs/nasm/nasmlib.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasmlib.obj -MD -MP -MF $(DEPDIR)/nasmlib.Tpo -c -o nasmlib.obj `if test -f 'modules/preprocs/nasm/nasmlib.c'; then $(CYGPATH_W) 'modules/preprocs/nasm/nasmlib.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/nasm/nasmlib.c'; fi`
+ mv -f $(DEPDIR)/nasmlib.Tpo $(DEPDIR)/nasmlib.Po
+# source='modules/preprocs/nasm/nasmlib.c' object='nasmlib.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasmlib.obj `if test -f 'modules/preprocs/nasm/nasmlib.c'; then $(CYGPATH_W) 'modules/preprocs/nasm/nasmlib.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/nasm/nasmlib.c'; fi`
+
+nasm-eval.o: modules/preprocs/nasm/nasm-eval.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-eval.o -MD -MP -MF $(DEPDIR)/nasm-eval.Tpo -c -o nasm-eval.o `test -f 'modules/preprocs/nasm/nasm-eval.c' || echo '$(srcdir)/'`modules/preprocs/nasm/nasm-eval.c
+ mv -f $(DEPDIR)/nasm-eval.Tpo $(DEPDIR)/nasm-eval.Po
+# source='modules/preprocs/nasm/nasm-eval.c' object='nasm-eval.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-eval.o `test -f 'modules/preprocs/nasm/nasm-eval.c' || echo '$(srcdir)/'`modules/preprocs/nasm/nasm-eval.c
+
+nasm-eval.obj: modules/preprocs/nasm/nasm-eval.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nasm-eval.obj -MD -MP -MF $(DEPDIR)/nasm-eval.Tpo -c -o nasm-eval.obj `if test -f 'modules/preprocs/nasm/nasm-eval.c'; then $(CYGPATH_W) 'modules/preprocs/nasm/nasm-eval.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/nasm/nasm-eval.c'; fi`
+ mv -f $(DEPDIR)/nasm-eval.Tpo $(DEPDIR)/nasm-eval.Po
+# source='modules/preprocs/nasm/nasm-eval.c' object='nasm-eval.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nasm-eval.obj `if test -f 'modules/preprocs/nasm/nasm-eval.c'; then $(CYGPATH_W) 'modules/preprocs/nasm/nasm-eval.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/nasm/nasm-eval.c'; fi`
+
+raw-preproc.o: modules/preprocs/raw/raw-preproc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT raw-preproc.o -MD -MP -MF $(DEPDIR)/raw-preproc.Tpo -c -o raw-preproc.o `test -f 'modules/preprocs/raw/raw-preproc.c' || echo '$(srcdir)/'`modules/preprocs/raw/raw-preproc.c
+ mv -f $(DEPDIR)/raw-preproc.Tpo $(DEPDIR)/raw-preproc.Po
+# source='modules/preprocs/raw/raw-preproc.c' object='raw-preproc.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o raw-preproc.o `test -f 'modules/preprocs/raw/raw-preproc.c' || echo '$(srcdir)/'`modules/preprocs/raw/raw-preproc.c
+
+raw-preproc.obj: modules/preprocs/raw/raw-preproc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT raw-preproc.obj -MD -MP -MF $(DEPDIR)/raw-preproc.Tpo -c -o raw-preproc.obj `if test -f 'modules/preprocs/raw/raw-preproc.c'; then $(CYGPATH_W) 'modules/preprocs/raw/raw-preproc.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/raw/raw-preproc.c'; fi`
+ mv -f $(DEPDIR)/raw-preproc.Tpo $(DEPDIR)/raw-preproc.Po
+# source='modules/preprocs/raw/raw-preproc.c' object='raw-preproc.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o raw-preproc.obj `if test -f 'modules/preprocs/raw/raw-preproc.c'; then $(CYGPATH_W) 'modules/preprocs/raw/raw-preproc.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/raw/raw-preproc.c'; fi`
+
+cpp-preproc.o: modules/preprocs/cpp/cpp-preproc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpp-preproc.o -MD -MP -MF $(DEPDIR)/cpp-preproc.Tpo -c -o cpp-preproc.o `test -f 'modules/preprocs/cpp/cpp-preproc.c' || echo '$(srcdir)/'`modules/preprocs/cpp/cpp-preproc.c
+ mv -f $(DEPDIR)/cpp-preproc.Tpo $(DEPDIR)/cpp-preproc.Po
+# source='modules/preprocs/cpp/cpp-preproc.c' object='cpp-preproc.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpp-preproc.o `test -f 'modules/preprocs/cpp/cpp-preproc.c' || echo '$(srcdir)/'`modules/preprocs/cpp/cpp-preproc.c
+
+cpp-preproc.obj: modules/preprocs/cpp/cpp-preproc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpp-preproc.obj -MD -MP -MF $(DEPDIR)/cpp-preproc.Tpo -c -o cpp-preproc.obj `if test -f 'modules/preprocs/cpp/cpp-preproc.c'; then $(CYGPATH_W) 'modules/preprocs/cpp/cpp-preproc.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/cpp/cpp-preproc.c'; fi`
+ mv -f $(DEPDIR)/cpp-preproc.Tpo $(DEPDIR)/cpp-preproc.Po
+# source='modules/preprocs/cpp/cpp-preproc.c' object='cpp-preproc.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpp-preproc.obj `if test -f 'modules/preprocs/cpp/cpp-preproc.c'; then $(CYGPATH_W) 'modules/preprocs/cpp/cpp-preproc.c'; else $(CYGPATH_W) '$(srcdir)/modules/preprocs/cpp/cpp-preproc.c'; fi`
+
+cv-dbgfmt.o: modules/dbgfmts/codeview/cv-dbgfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cv-dbgfmt.o -MD -MP -MF $(DEPDIR)/cv-dbgfmt.Tpo -c -o cv-dbgfmt.o `test -f 'modules/dbgfmts/codeview/cv-dbgfmt.c' || echo '$(srcdir)/'`modules/dbgfmts/codeview/cv-dbgfmt.c
+ mv -f $(DEPDIR)/cv-dbgfmt.Tpo $(DEPDIR)/cv-dbgfmt.Po
+# source='modules/dbgfmts/codeview/cv-dbgfmt.c' object='cv-dbgfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cv-dbgfmt.o `test -f 'modules/dbgfmts/codeview/cv-dbgfmt.c' || echo '$(srcdir)/'`modules/dbgfmts/codeview/cv-dbgfmt.c
+
+cv-dbgfmt.obj: modules/dbgfmts/codeview/cv-dbgfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cv-dbgfmt.obj -MD -MP -MF $(DEPDIR)/cv-dbgfmt.Tpo -c -o cv-dbgfmt.obj `if test -f 'modules/dbgfmts/codeview/cv-dbgfmt.c'; then $(CYGPATH_W) 'modules/dbgfmts/codeview/cv-dbgfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/codeview/cv-dbgfmt.c'; fi`
+ mv -f $(DEPDIR)/cv-dbgfmt.Tpo $(DEPDIR)/cv-dbgfmt.Po
+# source='modules/dbgfmts/codeview/cv-dbgfmt.c' object='cv-dbgfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cv-dbgfmt.obj `if test -f 'modules/dbgfmts/codeview/cv-dbgfmt.c'; then $(CYGPATH_W) 'modules/dbgfmts/codeview/cv-dbgfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/codeview/cv-dbgfmt.c'; fi`
+
+cv-symline.o: modules/dbgfmts/codeview/cv-symline.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cv-symline.o -MD -MP -MF $(DEPDIR)/cv-symline.Tpo -c -o cv-symline.o `test -f 'modules/dbgfmts/codeview/cv-symline.c' || echo '$(srcdir)/'`modules/dbgfmts/codeview/cv-symline.c
+ mv -f $(DEPDIR)/cv-symline.Tpo $(DEPDIR)/cv-symline.Po
+# source='modules/dbgfmts/codeview/cv-symline.c' object='cv-symline.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cv-symline.o `test -f 'modules/dbgfmts/codeview/cv-symline.c' || echo '$(srcdir)/'`modules/dbgfmts/codeview/cv-symline.c
+
+cv-symline.obj: modules/dbgfmts/codeview/cv-symline.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cv-symline.obj -MD -MP -MF $(DEPDIR)/cv-symline.Tpo -c -o cv-symline.obj `if test -f 'modules/dbgfmts/codeview/cv-symline.c'; then $(CYGPATH_W) 'modules/dbgfmts/codeview/cv-symline.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/codeview/cv-symline.c'; fi`
+ mv -f $(DEPDIR)/cv-symline.Tpo $(DEPDIR)/cv-symline.Po
+# source='modules/dbgfmts/codeview/cv-symline.c' object='cv-symline.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cv-symline.obj `if test -f 'modules/dbgfmts/codeview/cv-symline.c'; then $(CYGPATH_W) 'modules/dbgfmts/codeview/cv-symline.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/codeview/cv-symline.c'; fi`
+
+cv-type.o: modules/dbgfmts/codeview/cv-type.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cv-type.o -MD -MP -MF $(DEPDIR)/cv-type.Tpo -c -o cv-type.o `test -f 'modules/dbgfmts/codeview/cv-type.c' || echo '$(srcdir)/'`modules/dbgfmts/codeview/cv-type.c
+ mv -f $(DEPDIR)/cv-type.Tpo $(DEPDIR)/cv-type.Po
+# source='modules/dbgfmts/codeview/cv-type.c' object='cv-type.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cv-type.o `test -f 'modules/dbgfmts/codeview/cv-type.c' || echo '$(srcdir)/'`modules/dbgfmts/codeview/cv-type.c
+
+cv-type.obj: modules/dbgfmts/codeview/cv-type.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cv-type.obj -MD -MP -MF $(DEPDIR)/cv-type.Tpo -c -o cv-type.obj `if test -f 'modules/dbgfmts/codeview/cv-type.c'; then $(CYGPATH_W) 'modules/dbgfmts/codeview/cv-type.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/codeview/cv-type.c'; fi`
+ mv -f $(DEPDIR)/cv-type.Tpo $(DEPDIR)/cv-type.Po
+# source='modules/dbgfmts/codeview/cv-type.c' object='cv-type.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cv-type.obj `if test -f 'modules/dbgfmts/codeview/cv-type.c'; then $(CYGPATH_W) 'modules/dbgfmts/codeview/cv-type.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/codeview/cv-type.c'; fi`
+
+dwarf2-dbgfmt.o: modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dwarf2-dbgfmt.o -MD -MP -MF $(DEPDIR)/dwarf2-dbgfmt.Tpo -c -o dwarf2-dbgfmt.o `test -f 'modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c' || echo '$(srcdir)/'`modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c
+ mv -f $(DEPDIR)/dwarf2-dbgfmt.Tpo $(DEPDIR)/dwarf2-dbgfmt.Po
+# source='modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c' object='dwarf2-dbgfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dwarf2-dbgfmt.o `test -f 'modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c' || echo '$(srcdir)/'`modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c
+
+dwarf2-dbgfmt.obj: modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dwarf2-dbgfmt.obj -MD -MP -MF $(DEPDIR)/dwarf2-dbgfmt.Tpo -c -o dwarf2-dbgfmt.obj `if test -f 'modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c'; then $(CYGPATH_W) 'modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c'; fi`
+ mv -f $(DEPDIR)/dwarf2-dbgfmt.Tpo $(DEPDIR)/dwarf2-dbgfmt.Po
+# source='modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c' object='dwarf2-dbgfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dwarf2-dbgfmt.obj `if test -f 'modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c'; then $(CYGPATH_W) 'modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c'; fi`
+
+dwarf2-line.o: modules/dbgfmts/dwarf2/dwarf2-line.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dwarf2-line.o -MD -MP -MF $(DEPDIR)/dwarf2-line.Tpo -c -o dwarf2-line.o `test -f 'modules/dbgfmts/dwarf2/dwarf2-line.c' || echo '$(srcdir)/'`modules/dbgfmts/dwarf2/dwarf2-line.c
+ mv -f $(DEPDIR)/dwarf2-line.Tpo $(DEPDIR)/dwarf2-line.Po
+# source='modules/dbgfmts/dwarf2/dwarf2-line.c' object='dwarf2-line.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dwarf2-line.o `test -f 'modules/dbgfmts/dwarf2/dwarf2-line.c' || echo '$(srcdir)/'`modules/dbgfmts/dwarf2/dwarf2-line.c
+
+dwarf2-line.obj: modules/dbgfmts/dwarf2/dwarf2-line.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dwarf2-line.obj -MD -MP -MF $(DEPDIR)/dwarf2-line.Tpo -c -o dwarf2-line.obj `if test -f 'modules/dbgfmts/dwarf2/dwarf2-line.c'; then $(CYGPATH_W) 'modules/dbgfmts/dwarf2/dwarf2-line.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/dwarf2/dwarf2-line.c'; fi`
+ mv -f $(DEPDIR)/dwarf2-line.Tpo $(DEPDIR)/dwarf2-line.Po
+# source='modules/dbgfmts/dwarf2/dwarf2-line.c' object='dwarf2-line.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dwarf2-line.obj `if test -f 'modules/dbgfmts/dwarf2/dwarf2-line.c'; then $(CYGPATH_W) 'modules/dbgfmts/dwarf2/dwarf2-line.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/dwarf2/dwarf2-line.c'; fi`
+
+dwarf2-aranges.o: modules/dbgfmts/dwarf2/dwarf2-aranges.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dwarf2-aranges.o -MD -MP -MF $(DEPDIR)/dwarf2-aranges.Tpo -c -o dwarf2-aranges.o `test -f 'modules/dbgfmts/dwarf2/dwarf2-aranges.c' || echo '$(srcdir)/'`modules/dbgfmts/dwarf2/dwarf2-aranges.c
+ mv -f $(DEPDIR)/dwarf2-aranges.Tpo $(DEPDIR)/dwarf2-aranges.Po
+# source='modules/dbgfmts/dwarf2/dwarf2-aranges.c' object='dwarf2-aranges.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dwarf2-aranges.o `test -f 'modules/dbgfmts/dwarf2/dwarf2-aranges.c' || echo '$(srcdir)/'`modules/dbgfmts/dwarf2/dwarf2-aranges.c
+
+dwarf2-aranges.obj: modules/dbgfmts/dwarf2/dwarf2-aranges.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dwarf2-aranges.obj -MD -MP -MF $(DEPDIR)/dwarf2-aranges.Tpo -c -o dwarf2-aranges.obj `if test -f 'modules/dbgfmts/dwarf2/dwarf2-aranges.c'; then $(CYGPATH_W) 'modules/dbgfmts/dwarf2/dwarf2-aranges.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/dwarf2/dwarf2-aranges.c'; fi`
+ mv -f $(DEPDIR)/dwarf2-aranges.Tpo $(DEPDIR)/dwarf2-aranges.Po
+# source='modules/dbgfmts/dwarf2/dwarf2-aranges.c' object='dwarf2-aranges.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dwarf2-aranges.obj `if test -f 'modules/dbgfmts/dwarf2/dwarf2-aranges.c'; then $(CYGPATH_W) 'modules/dbgfmts/dwarf2/dwarf2-aranges.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/dwarf2/dwarf2-aranges.c'; fi`
+
+dwarf2-info.o: modules/dbgfmts/dwarf2/dwarf2-info.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dwarf2-info.o -MD -MP -MF $(DEPDIR)/dwarf2-info.Tpo -c -o dwarf2-info.o `test -f 'modules/dbgfmts/dwarf2/dwarf2-info.c' || echo '$(srcdir)/'`modules/dbgfmts/dwarf2/dwarf2-info.c
+ mv -f $(DEPDIR)/dwarf2-info.Tpo $(DEPDIR)/dwarf2-info.Po
+# source='modules/dbgfmts/dwarf2/dwarf2-info.c' object='dwarf2-info.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dwarf2-info.o `test -f 'modules/dbgfmts/dwarf2/dwarf2-info.c' || echo '$(srcdir)/'`modules/dbgfmts/dwarf2/dwarf2-info.c
+
+dwarf2-info.obj: modules/dbgfmts/dwarf2/dwarf2-info.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dwarf2-info.obj -MD -MP -MF $(DEPDIR)/dwarf2-info.Tpo -c -o dwarf2-info.obj `if test -f 'modules/dbgfmts/dwarf2/dwarf2-info.c'; then $(CYGPATH_W) 'modules/dbgfmts/dwarf2/dwarf2-info.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/dwarf2/dwarf2-info.c'; fi`
+ mv -f $(DEPDIR)/dwarf2-info.Tpo $(DEPDIR)/dwarf2-info.Po
+# source='modules/dbgfmts/dwarf2/dwarf2-info.c' object='dwarf2-info.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dwarf2-info.obj `if test -f 'modules/dbgfmts/dwarf2/dwarf2-info.c'; then $(CYGPATH_W) 'modules/dbgfmts/dwarf2/dwarf2-info.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/dwarf2/dwarf2-info.c'; fi`
+
+null-dbgfmt.o: modules/dbgfmts/null/null-dbgfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT null-dbgfmt.o -MD -MP -MF $(DEPDIR)/null-dbgfmt.Tpo -c -o null-dbgfmt.o `test -f 'modules/dbgfmts/null/null-dbgfmt.c' || echo '$(srcdir)/'`modules/dbgfmts/null/null-dbgfmt.c
+ mv -f $(DEPDIR)/null-dbgfmt.Tpo $(DEPDIR)/null-dbgfmt.Po
+# source='modules/dbgfmts/null/null-dbgfmt.c' object='null-dbgfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o null-dbgfmt.o `test -f 'modules/dbgfmts/null/null-dbgfmt.c' || echo '$(srcdir)/'`modules/dbgfmts/null/null-dbgfmt.c
+
+null-dbgfmt.obj: modules/dbgfmts/null/null-dbgfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT null-dbgfmt.obj -MD -MP -MF $(DEPDIR)/null-dbgfmt.Tpo -c -o null-dbgfmt.obj `if test -f 'modules/dbgfmts/null/null-dbgfmt.c'; then $(CYGPATH_W) 'modules/dbgfmts/null/null-dbgfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/null/null-dbgfmt.c'; fi`
+ mv -f $(DEPDIR)/null-dbgfmt.Tpo $(DEPDIR)/null-dbgfmt.Po
+# source='modules/dbgfmts/null/null-dbgfmt.c' object='null-dbgfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o null-dbgfmt.obj `if test -f 'modules/dbgfmts/null/null-dbgfmt.c'; then $(CYGPATH_W) 'modules/dbgfmts/null/null-dbgfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/null/null-dbgfmt.c'; fi`
+
+stabs-dbgfmt.o: modules/dbgfmts/stabs/stabs-dbgfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT stabs-dbgfmt.o -MD -MP -MF $(DEPDIR)/stabs-dbgfmt.Tpo -c -o stabs-dbgfmt.o `test -f 'modules/dbgfmts/stabs/stabs-dbgfmt.c' || echo '$(srcdir)/'`modules/dbgfmts/stabs/stabs-dbgfmt.c
+ mv -f $(DEPDIR)/stabs-dbgfmt.Tpo $(DEPDIR)/stabs-dbgfmt.Po
+# source='modules/dbgfmts/stabs/stabs-dbgfmt.c' object='stabs-dbgfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o stabs-dbgfmt.o `test -f 'modules/dbgfmts/stabs/stabs-dbgfmt.c' || echo '$(srcdir)/'`modules/dbgfmts/stabs/stabs-dbgfmt.c
+
+stabs-dbgfmt.obj: modules/dbgfmts/stabs/stabs-dbgfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT stabs-dbgfmt.obj -MD -MP -MF $(DEPDIR)/stabs-dbgfmt.Tpo -c -o stabs-dbgfmt.obj `if test -f 'modules/dbgfmts/stabs/stabs-dbgfmt.c'; then $(CYGPATH_W) 'modules/dbgfmts/stabs/stabs-dbgfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/stabs/stabs-dbgfmt.c'; fi`
+ mv -f $(DEPDIR)/stabs-dbgfmt.Tpo $(DEPDIR)/stabs-dbgfmt.Po
+# source='modules/dbgfmts/stabs/stabs-dbgfmt.c' object='stabs-dbgfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o stabs-dbgfmt.obj `if test -f 'modules/dbgfmts/stabs/stabs-dbgfmt.c'; then $(CYGPATH_W) 'modules/dbgfmts/stabs/stabs-dbgfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/dbgfmts/stabs/stabs-dbgfmt.c'; fi`
+
+dbg-objfmt.o: modules/objfmts/dbg/dbg-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dbg-objfmt.o -MD -MP -MF $(DEPDIR)/dbg-objfmt.Tpo -c -o dbg-objfmt.o `test -f 'modules/objfmts/dbg/dbg-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/dbg/dbg-objfmt.c
+ mv -f $(DEPDIR)/dbg-objfmt.Tpo $(DEPDIR)/dbg-objfmt.Po
+# source='modules/objfmts/dbg/dbg-objfmt.c' object='dbg-objfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dbg-objfmt.o `test -f 'modules/objfmts/dbg/dbg-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/dbg/dbg-objfmt.c
+
+dbg-objfmt.obj: modules/objfmts/dbg/dbg-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dbg-objfmt.obj -MD -MP -MF $(DEPDIR)/dbg-objfmt.Tpo -c -o dbg-objfmt.obj `if test -f 'modules/objfmts/dbg/dbg-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/dbg/dbg-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/dbg/dbg-objfmt.c'; fi`
+ mv -f $(DEPDIR)/dbg-objfmt.Tpo $(DEPDIR)/dbg-objfmt.Po
+# source='modules/objfmts/dbg/dbg-objfmt.c' object='dbg-objfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dbg-objfmt.obj `if test -f 'modules/objfmts/dbg/dbg-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/dbg/dbg-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/dbg/dbg-objfmt.c'; fi`
+
+bin-objfmt.o: modules/objfmts/bin/bin-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bin-objfmt.o -MD -MP -MF $(DEPDIR)/bin-objfmt.Tpo -c -o bin-objfmt.o `test -f 'modules/objfmts/bin/bin-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/bin/bin-objfmt.c
+ mv -f $(DEPDIR)/bin-objfmt.Tpo $(DEPDIR)/bin-objfmt.Po
+# source='modules/objfmts/bin/bin-objfmt.c' object='bin-objfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bin-objfmt.o `test -f 'modules/objfmts/bin/bin-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/bin/bin-objfmt.c
+
+bin-objfmt.obj: modules/objfmts/bin/bin-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bin-objfmt.obj -MD -MP -MF $(DEPDIR)/bin-objfmt.Tpo -c -o bin-objfmt.obj `if test -f 'modules/objfmts/bin/bin-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/bin/bin-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/bin/bin-objfmt.c'; fi`
+ mv -f $(DEPDIR)/bin-objfmt.Tpo $(DEPDIR)/bin-objfmt.Po
+# source='modules/objfmts/bin/bin-objfmt.c' object='bin-objfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bin-objfmt.obj `if test -f 'modules/objfmts/bin/bin-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/bin/bin-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/bin/bin-objfmt.c'; fi`
+
+elf.o: modules/objfmts/elf/elf.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT elf.o -MD -MP -MF $(DEPDIR)/elf.Tpo -c -o elf.o `test -f 'modules/objfmts/elf/elf.c' || echo '$(srcdir)/'`modules/objfmts/elf/elf.c
+ mv -f $(DEPDIR)/elf.Tpo $(DEPDIR)/elf.Po
+# source='modules/objfmts/elf/elf.c' object='elf.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o elf.o `test -f 'modules/objfmts/elf/elf.c' || echo '$(srcdir)/'`modules/objfmts/elf/elf.c
+
+elf.obj: modules/objfmts/elf/elf.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT elf.obj -MD -MP -MF $(DEPDIR)/elf.Tpo -c -o elf.obj `if test -f 'modules/objfmts/elf/elf.c'; then $(CYGPATH_W) 'modules/objfmts/elf/elf.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/elf/elf.c'; fi`
+ mv -f $(DEPDIR)/elf.Tpo $(DEPDIR)/elf.Po
+# source='modules/objfmts/elf/elf.c' object='elf.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o elf.obj `if test -f 'modules/objfmts/elf/elf.c'; then $(CYGPATH_W) 'modules/objfmts/elf/elf.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/elf/elf.c'; fi`
+
+elf-objfmt.o: modules/objfmts/elf/elf-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT elf-objfmt.o -MD -MP -MF $(DEPDIR)/elf-objfmt.Tpo -c -o elf-objfmt.o `test -f 'modules/objfmts/elf/elf-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/elf/elf-objfmt.c
+ mv -f $(DEPDIR)/elf-objfmt.Tpo $(DEPDIR)/elf-objfmt.Po
+# source='modules/objfmts/elf/elf-objfmt.c' object='elf-objfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o elf-objfmt.o `test -f 'modules/objfmts/elf/elf-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/elf/elf-objfmt.c
+
+elf-objfmt.obj: modules/objfmts/elf/elf-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT elf-objfmt.obj -MD -MP -MF $(DEPDIR)/elf-objfmt.Tpo -c -o elf-objfmt.obj `if test -f 'modules/objfmts/elf/elf-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/elf/elf-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/elf/elf-objfmt.c'; fi`
+ mv -f $(DEPDIR)/elf-objfmt.Tpo $(DEPDIR)/elf-objfmt.Po
+# source='modules/objfmts/elf/elf-objfmt.c' object='elf-objfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o elf-objfmt.obj `if test -f 'modules/objfmts/elf/elf-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/elf/elf-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/elf/elf-objfmt.c'; fi`
+
+elf-x86-x86.o: modules/objfmts/elf/elf-x86-x86.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT elf-x86-x86.o -MD -MP -MF $(DEPDIR)/elf-x86-x86.Tpo -c -o elf-x86-x86.o `test -f 'modules/objfmts/elf/elf-x86-x86.c' || echo '$(srcdir)/'`modules/objfmts/elf/elf-x86-x86.c
+ mv -f $(DEPDIR)/elf-x86-x86.Tpo $(DEPDIR)/elf-x86-x86.Po
+# source='modules/objfmts/elf/elf-x86-x86.c' object='elf-x86-x86.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o elf-x86-x86.o `test -f 'modules/objfmts/elf/elf-x86-x86.c' || echo '$(srcdir)/'`modules/objfmts/elf/elf-x86-x86.c
+
+elf-x86-x86.obj: modules/objfmts/elf/elf-x86-x86.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT elf-x86-x86.obj -MD -MP -MF $(DEPDIR)/elf-x86-x86.Tpo -c -o elf-x86-x86.obj `if test -f 'modules/objfmts/elf/elf-x86-x86.c'; then $(CYGPATH_W) 'modules/objfmts/elf/elf-x86-x86.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/elf/elf-x86-x86.c'; fi`
+ mv -f $(DEPDIR)/elf-x86-x86.Tpo $(DEPDIR)/elf-x86-x86.Po
+# source='modules/objfmts/elf/elf-x86-x86.c' object='elf-x86-x86.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o elf-x86-x86.obj `if test -f 'modules/objfmts/elf/elf-x86-x86.c'; then $(CYGPATH_W) 'modules/objfmts/elf/elf-x86-x86.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/elf/elf-x86-x86.c'; fi`
+
+elf-x86-amd64.o: modules/objfmts/elf/elf-x86-amd64.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT elf-x86-amd64.o -MD -MP -MF $(DEPDIR)/elf-x86-amd64.Tpo -c -o elf-x86-amd64.o `test -f 'modules/objfmts/elf/elf-x86-amd64.c' || echo '$(srcdir)/'`modules/objfmts/elf/elf-x86-amd64.c
+ mv -f $(DEPDIR)/elf-x86-amd64.Tpo $(DEPDIR)/elf-x86-amd64.Po
+# source='modules/objfmts/elf/elf-x86-amd64.c' object='elf-x86-amd64.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o elf-x86-amd64.o `test -f 'modules/objfmts/elf/elf-x86-amd64.c' || echo '$(srcdir)/'`modules/objfmts/elf/elf-x86-amd64.c
+
+elf-x86-amd64.obj: modules/objfmts/elf/elf-x86-amd64.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT elf-x86-amd64.obj -MD -MP -MF $(DEPDIR)/elf-x86-amd64.Tpo -c -o elf-x86-amd64.obj `if test -f 'modules/objfmts/elf/elf-x86-amd64.c'; then $(CYGPATH_W) 'modules/objfmts/elf/elf-x86-amd64.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/elf/elf-x86-amd64.c'; fi`
+ mv -f $(DEPDIR)/elf-x86-amd64.Tpo $(DEPDIR)/elf-x86-amd64.Po
+# source='modules/objfmts/elf/elf-x86-amd64.c' object='elf-x86-amd64.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o elf-x86-amd64.obj `if test -f 'modules/objfmts/elf/elf-x86-amd64.c'; then $(CYGPATH_W) 'modules/objfmts/elf/elf-x86-amd64.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/elf/elf-x86-amd64.c'; fi`
+
+coff-objfmt.o: modules/objfmts/coff/coff-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT coff-objfmt.o -MD -MP -MF $(DEPDIR)/coff-objfmt.Tpo -c -o coff-objfmt.o `test -f 'modules/objfmts/coff/coff-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/coff/coff-objfmt.c
+ mv -f $(DEPDIR)/coff-objfmt.Tpo $(DEPDIR)/coff-objfmt.Po
+# source='modules/objfmts/coff/coff-objfmt.c' object='coff-objfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o coff-objfmt.o `test -f 'modules/objfmts/coff/coff-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/coff/coff-objfmt.c
+
+coff-objfmt.obj: modules/objfmts/coff/coff-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT coff-objfmt.obj -MD -MP -MF $(DEPDIR)/coff-objfmt.Tpo -c -o coff-objfmt.obj `if test -f 'modules/objfmts/coff/coff-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/coff/coff-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/coff/coff-objfmt.c'; fi`
+ mv -f $(DEPDIR)/coff-objfmt.Tpo $(DEPDIR)/coff-objfmt.Po
+# source='modules/objfmts/coff/coff-objfmt.c' object='coff-objfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o coff-objfmt.obj `if test -f 'modules/objfmts/coff/coff-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/coff/coff-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/coff/coff-objfmt.c'; fi`
+
+win64-except.o: modules/objfmts/coff/win64-except.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT win64-except.o -MD -MP -MF $(DEPDIR)/win64-except.Tpo -c -o win64-except.o `test -f 'modules/objfmts/coff/win64-except.c' || echo '$(srcdir)/'`modules/objfmts/coff/win64-except.c
+ mv -f $(DEPDIR)/win64-except.Tpo $(DEPDIR)/win64-except.Po
+# source='modules/objfmts/coff/win64-except.c' object='win64-except.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o win64-except.o `test -f 'modules/objfmts/coff/win64-except.c' || echo '$(srcdir)/'`modules/objfmts/coff/win64-except.c
+
+win64-except.obj: modules/objfmts/coff/win64-except.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT win64-except.obj -MD -MP -MF $(DEPDIR)/win64-except.Tpo -c -o win64-except.obj `if test -f 'modules/objfmts/coff/win64-except.c'; then $(CYGPATH_W) 'modules/objfmts/coff/win64-except.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/coff/win64-except.c'; fi`
+ mv -f $(DEPDIR)/win64-except.Tpo $(DEPDIR)/win64-except.Po
+# source='modules/objfmts/coff/win64-except.c' object='win64-except.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o win64-except.obj `if test -f 'modules/objfmts/coff/win64-except.c'; then $(CYGPATH_W) 'modules/objfmts/coff/win64-except.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/coff/win64-except.c'; fi`
+
+macho-objfmt.o: modules/objfmts/macho/macho-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT macho-objfmt.o -MD -MP -MF $(DEPDIR)/macho-objfmt.Tpo -c -o macho-objfmt.o `test -f 'modules/objfmts/macho/macho-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/macho/macho-objfmt.c
+ mv -f $(DEPDIR)/macho-objfmt.Tpo $(DEPDIR)/macho-objfmt.Po
+# source='modules/objfmts/macho/macho-objfmt.c' object='macho-objfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o macho-objfmt.o `test -f 'modules/objfmts/macho/macho-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/macho/macho-objfmt.c
+
+macho-objfmt.obj: modules/objfmts/macho/macho-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT macho-objfmt.obj -MD -MP -MF $(DEPDIR)/macho-objfmt.Tpo -c -o macho-objfmt.obj `if test -f 'modules/objfmts/macho/macho-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/macho/macho-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/macho/macho-objfmt.c'; fi`
+ mv -f $(DEPDIR)/macho-objfmt.Tpo $(DEPDIR)/macho-objfmt.Po
+# source='modules/objfmts/macho/macho-objfmt.c' object='macho-objfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o macho-objfmt.obj `if test -f 'modules/objfmts/macho/macho-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/macho/macho-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/macho/macho-objfmt.c'; fi`
+
+rdf-objfmt.o: modules/objfmts/rdf/rdf-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rdf-objfmt.o -MD -MP -MF $(DEPDIR)/rdf-objfmt.Tpo -c -o rdf-objfmt.o `test -f 'modules/objfmts/rdf/rdf-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/rdf/rdf-objfmt.c
+ mv -f $(DEPDIR)/rdf-objfmt.Tpo $(DEPDIR)/rdf-objfmt.Po
+# source='modules/objfmts/rdf/rdf-objfmt.c' object='rdf-objfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rdf-objfmt.o `test -f 'modules/objfmts/rdf/rdf-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/rdf/rdf-objfmt.c
+
+rdf-objfmt.obj: modules/objfmts/rdf/rdf-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rdf-objfmt.obj -MD -MP -MF $(DEPDIR)/rdf-objfmt.Tpo -c -o rdf-objfmt.obj `if test -f 'modules/objfmts/rdf/rdf-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/rdf/rdf-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/rdf/rdf-objfmt.c'; fi`
+ mv -f $(DEPDIR)/rdf-objfmt.Tpo $(DEPDIR)/rdf-objfmt.Po
+# source='modules/objfmts/rdf/rdf-objfmt.c' object='rdf-objfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rdf-objfmt.obj `if test -f 'modules/objfmts/rdf/rdf-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/rdf/rdf-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/rdf/rdf-objfmt.c'; fi`
+
+xdf-objfmt.o: modules/objfmts/xdf/xdf-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xdf-objfmt.o -MD -MP -MF $(DEPDIR)/xdf-objfmt.Tpo -c -o xdf-objfmt.o `test -f 'modules/objfmts/xdf/xdf-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/xdf/xdf-objfmt.c
+ mv -f $(DEPDIR)/xdf-objfmt.Tpo $(DEPDIR)/xdf-objfmt.Po
+# source='modules/objfmts/xdf/xdf-objfmt.c' object='xdf-objfmt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xdf-objfmt.o `test -f 'modules/objfmts/xdf/xdf-objfmt.c' || echo '$(srcdir)/'`modules/objfmts/xdf/xdf-objfmt.c
+
+xdf-objfmt.obj: modules/objfmts/xdf/xdf-objfmt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xdf-objfmt.obj -MD -MP -MF $(DEPDIR)/xdf-objfmt.Tpo -c -o xdf-objfmt.obj `if test -f 'modules/objfmts/xdf/xdf-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/xdf/xdf-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/xdf/xdf-objfmt.c'; fi`
+ mv -f $(DEPDIR)/xdf-objfmt.Tpo $(DEPDIR)/xdf-objfmt.Po
+# source='modules/objfmts/xdf/xdf-objfmt.c' object='xdf-objfmt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xdf-objfmt.obj `if test -f 'modules/objfmts/xdf/xdf-objfmt.c'; then $(CYGPATH_W) 'modules/objfmts/xdf/xdf-objfmt.c'; else $(CYGPATH_W) '$(srcdir)/modules/objfmts/xdf/xdf-objfmt.c'; fi`
+
+assocdat.o: libyasm/assocdat.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT assocdat.o -MD -MP -MF $(DEPDIR)/assocdat.Tpo -c -o assocdat.o `test -f 'libyasm/assocdat.c' || echo '$(srcdir)/'`libyasm/assocdat.c
+ mv -f $(DEPDIR)/assocdat.Tpo $(DEPDIR)/assocdat.Po
+# source='libyasm/assocdat.c' object='assocdat.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o assocdat.o `test -f 'libyasm/assocdat.c' || echo '$(srcdir)/'`libyasm/assocdat.c
+
+assocdat.obj: libyasm/assocdat.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT assocdat.obj -MD -MP -MF $(DEPDIR)/assocdat.Tpo -c -o assocdat.obj `if test -f 'libyasm/assocdat.c'; then $(CYGPATH_W) 'libyasm/assocdat.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/assocdat.c'; fi`
+ mv -f $(DEPDIR)/assocdat.Tpo $(DEPDIR)/assocdat.Po
+# source='libyasm/assocdat.c' object='assocdat.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o assocdat.obj `if test -f 'libyasm/assocdat.c'; then $(CYGPATH_W) 'libyasm/assocdat.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/assocdat.c'; fi`
+
+bitvect.o: libyasm/bitvect.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bitvect.o -MD -MP -MF $(DEPDIR)/bitvect.Tpo -c -o bitvect.o `test -f 'libyasm/bitvect.c' || echo '$(srcdir)/'`libyasm/bitvect.c
+ mv -f $(DEPDIR)/bitvect.Tpo $(DEPDIR)/bitvect.Po
+# source='libyasm/bitvect.c' object='bitvect.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bitvect.o `test -f 'libyasm/bitvect.c' || echo '$(srcdir)/'`libyasm/bitvect.c
+
+bitvect.obj: libyasm/bitvect.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bitvect.obj -MD -MP -MF $(DEPDIR)/bitvect.Tpo -c -o bitvect.obj `if test -f 'libyasm/bitvect.c'; then $(CYGPATH_W) 'libyasm/bitvect.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bitvect.c'; fi`
+ mv -f $(DEPDIR)/bitvect.Tpo $(DEPDIR)/bitvect.Po
+# source='libyasm/bitvect.c' object='bitvect.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bitvect.obj `if test -f 'libyasm/bitvect.c'; then $(CYGPATH_W) 'libyasm/bitvect.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bitvect.c'; fi`
+
+bc-align.o: libyasm/bc-align.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bc-align.o -MD -MP -MF $(DEPDIR)/bc-align.Tpo -c -o bc-align.o `test -f 'libyasm/bc-align.c' || echo '$(srcdir)/'`libyasm/bc-align.c
+ mv -f $(DEPDIR)/bc-align.Tpo $(DEPDIR)/bc-align.Po
+# source='libyasm/bc-align.c' object='bc-align.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bc-align.o `test -f 'libyasm/bc-align.c' || echo '$(srcdir)/'`libyasm/bc-align.c
+
+bc-align.obj: libyasm/bc-align.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bc-align.obj -MD -MP -MF $(DEPDIR)/bc-align.Tpo -c -o bc-align.obj `if test -f 'libyasm/bc-align.c'; then $(CYGPATH_W) 'libyasm/bc-align.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bc-align.c'; fi`
+ mv -f $(DEPDIR)/bc-align.Tpo $(DEPDIR)/bc-align.Po
+# source='libyasm/bc-align.c' object='bc-align.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bc-align.obj `if test -f 'libyasm/bc-align.c'; then $(CYGPATH_W) 'libyasm/bc-align.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bc-align.c'; fi`
+
+bc-data.o: libyasm/bc-data.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bc-data.o -MD -MP -MF $(DEPDIR)/bc-data.Tpo -c -o bc-data.o `test -f 'libyasm/bc-data.c' || echo '$(srcdir)/'`libyasm/bc-data.c
+ mv -f $(DEPDIR)/bc-data.Tpo $(DEPDIR)/bc-data.Po
+# source='libyasm/bc-data.c' object='bc-data.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bc-data.o `test -f 'libyasm/bc-data.c' || echo '$(srcdir)/'`libyasm/bc-data.c
+
+bc-data.obj: libyasm/bc-data.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bc-data.obj -MD -MP -MF $(DEPDIR)/bc-data.Tpo -c -o bc-data.obj `if test -f 'libyasm/bc-data.c'; then $(CYGPATH_W) 'libyasm/bc-data.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bc-data.c'; fi`
+ mv -f $(DEPDIR)/bc-data.Tpo $(DEPDIR)/bc-data.Po
+# source='libyasm/bc-data.c' object='bc-data.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bc-data.obj `if test -f 'libyasm/bc-data.c'; then $(CYGPATH_W) 'libyasm/bc-data.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bc-data.c'; fi`
+
+bc-incbin.o: libyasm/bc-incbin.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bc-incbin.o -MD -MP -MF $(DEPDIR)/bc-incbin.Tpo -c -o bc-incbin.o `test -f 'libyasm/bc-incbin.c' || echo '$(srcdir)/'`libyasm/bc-incbin.c
+ mv -f $(DEPDIR)/bc-incbin.Tpo $(DEPDIR)/bc-incbin.Po
+# source='libyasm/bc-incbin.c' object='bc-incbin.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bc-incbin.o `test -f 'libyasm/bc-incbin.c' || echo '$(srcdir)/'`libyasm/bc-incbin.c
+
+bc-incbin.obj: libyasm/bc-incbin.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bc-incbin.obj -MD -MP -MF $(DEPDIR)/bc-incbin.Tpo -c -o bc-incbin.obj `if test -f 'libyasm/bc-incbin.c'; then $(CYGPATH_W) 'libyasm/bc-incbin.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bc-incbin.c'; fi`
+ mv -f $(DEPDIR)/bc-incbin.Tpo $(DEPDIR)/bc-incbin.Po
+# source='libyasm/bc-incbin.c' object='bc-incbin.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bc-incbin.obj `if test -f 'libyasm/bc-incbin.c'; then $(CYGPATH_W) 'libyasm/bc-incbin.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bc-incbin.c'; fi`
+
+bc-org.o: libyasm/bc-org.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bc-org.o -MD -MP -MF $(DEPDIR)/bc-org.Tpo -c -o bc-org.o `test -f 'libyasm/bc-org.c' || echo '$(srcdir)/'`libyasm/bc-org.c
+ mv -f $(DEPDIR)/bc-org.Tpo $(DEPDIR)/bc-org.Po
+# source='libyasm/bc-org.c' object='bc-org.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bc-org.o `test -f 'libyasm/bc-org.c' || echo '$(srcdir)/'`libyasm/bc-org.c
+
+bc-org.obj: libyasm/bc-org.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bc-org.obj -MD -MP -MF $(DEPDIR)/bc-org.Tpo -c -o bc-org.obj `if test -f 'libyasm/bc-org.c'; then $(CYGPATH_W) 'libyasm/bc-org.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bc-org.c'; fi`
+ mv -f $(DEPDIR)/bc-org.Tpo $(DEPDIR)/bc-org.Po
+# source='libyasm/bc-org.c' object='bc-org.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bc-org.obj `if test -f 'libyasm/bc-org.c'; then $(CYGPATH_W) 'libyasm/bc-org.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bc-org.c'; fi`
+
+bc-reserve.o: libyasm/bc-reserve.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bc-reserve.o -MD -MP -MF $(DEPDIR)/bc-reserve.Tpo -c -o bc-reserve.o `test -f 'libyasm/bc-reserve.c' || echo '$(srcdir)/'`libyasm/bc-reserve.c
+ mv -f $(DEPDIR)/bc-reserve.Tpo $(DEPDIR)/bc-reserve.Po
+# source='libyasm/bc-reserve.c' object='bc-reserve.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bc-reserve.o `test -f 'libyasm/bc-reserve.c' || echo '$(srcdir)/'`libyasm/bc-reserve.c
+
+bc-reserve.obj: libyasm/bc-reserve.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bc-reserve.obj -MD -MP -MF $(DEPDIR)/bc-reserve.Tpo -c -o bc-reserve.obj `if test -f 'libyasm/bc-reserve.c'; then $(CYGPATH_W) 'libyasm/bc-reserve.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bc-reserve.c'; fi`
+ mv -f $(DEPDIR)/bc-reserve.Tpo $(DEPDIR)/bc-reserve.Po
+# source='libyasm/bc-reserve.c' object='bc-reserve.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bc-reserve.obj `if test -f 'libyasm/bc-reserve.c'; then $(CYGPATH_W) 'libyasm/bc-reserve.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bc-reserve.c'; fi`
+
+bytecode.o: libyasm/bytecode.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bytecode.o -MD -MP -MF $(DEPDIR)/bytecode.Tpo -c -o bytecode.o `test -f 'libyasm/bytecode.c' || echo '$(srcdir)/'`libyasm/bytecode.c
+ mv -f $(DEPDIR)/bytecode.Tpo $(DEPDIR)/bytecode.Po
+# source='libyasm/bytecode.c' object='bytecode.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bytecode.o `test -f 'libyasm/bytecode.c' || echo '$(srcdir)/'`libyasm/bytecode.c
+
+bytecode.obj: libyasm/bytecode.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bytecode.obj -MD -MP -MF $(DEPDIR)/bytecode.Tpo -c -o bytecode.obj `if test -f 'libyasm/bytecode.c'; then $(CYGPATH_W) 'libyasm/bytecode.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bytecode.c'; fi`
+ mv -f $(DEPDIR)/bytecode.Tpo $(DEPDIR)/bytecode.Po
+# source='libyasm/bytecode.c' object='bytecode.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bytecode.obj `if test -f 'libyasm/bytecode.c'; then $(CYGPATH_W) 'libyasm/bytecode.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/bytecode.c'; fi`
+
+errwarn.o: libyasm/errwarn.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT errwarn.o -MD -MP -MF $(DEPDIR)/errwarn.Tpo -c -o errwarn.o `test -f 'libyasm/errwarn.c' || echo '$(srcdir)/'`libyasm/errwarn.c
+ mv -f $(DEPDIR)/errwarn.Tpo $(DEPDIR)/errwarn.Po
+# source='libyasm/errwarn.c' object='errwarn.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o errwarn.o `test -f 'libyasm/errwarn.c' || echo '$(srcdir)/'`libyasm/errwarn.c
+
+errwarn.obj: libyasm/errwarn.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT errwarn.obj -MD -MP -MF $(DEPDIR)/errwarn.Tpo -c -o errwarn.obj `if test -f 'libyasm/errwarn.c'; then $(CYGPATH_W) 'libyasm/errwarn.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/errwarn.c'; fi`
+ mv -f $(DEPDIR)/errwarn.Tpo $(DEPDIR)/errwarn.Po
+# source='libyasm/errwarn.c' object='errwarn.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o errwarn.obj `if test -f 'libyasm/errwarn.c'; then $(CYGPATH_W) 'libyasm/errwarn.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/errwarn.c'; fi`
+
+expr.o: libyasm/expr.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT expr.o -MD -MP -MF $(DEPDIR)/expr.Tpo -c -o expr.o `test -f 'libyasm/expr.c' || echo '$(srcdir)/'`libyasm/expr.c
+ mv -f $(DEPDIR)/expr.Tpo $(DEPDIR)/expr.Po
+# source='libyasm/expr.c' object='expr.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o expr.o `test -f 'libyasm/expr.c' || echo '$(srcdir)/'`libyasm/expr.c
+
+expr.obj: libyasm/expr.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT expr.obj -MD -MP -MF $(DEPDIR)/expr.Tpo -c -o expr.obj `if test -f 'libyasm/expr.c'; then $(CYGPATH_W) 'libyasm/expr.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/expr.c'; fi`
+ mv -f $(DEPDIR)/expr.Tpo $(DEPDIR)/expr.Po
+# source='libyasm/expr.c' object='expr.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o expr.obj `if test -f 'libyasm/expr.c'; then $(CYGPATH_W) 'libyasm/expr.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/expr.c'; fi`
+
+file.o: libyasm/file.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT file.o -MD -MP -MF $(DEPDIR)/file.Tpo -c -o file.o `test -f 'libyasm/file.c' || echo '$(srcdir)/'`libyasm/file.c
+ mv -f $(DEPDIR)/file.Tpo $(DEPDIR)/file.Po
+# source='libyasm/file.c' object='file.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o file.o `test -f 'libyasm/file.c' || echo '$(srcdir)/'`libyasm/file.c
+
+file.obj: libyasm/file.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT file.obj -MD -MP -MF $(DEPDIR)/file.Tpo -c -o file.obj `if test -f 'libyasm/file.c'; then $(CYGPATH_W) 'libyasm/file.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/file.c'; fi`
+ mv -f $(DEPDIR)/file.Tpo $(DEPDIR)/file.Po
+# source='libyasm/file.c' object='file.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o file.obj `if test -f 'libyasm/file.c'; then $(CYGPATH_W) 'libyasm/file.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/file.c'; fi`
+
+floatnum.o: libyasm/floatnum.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT floatnum.o -MD -MP -MF $(DEPDIR)/floatnum.Tpo -c -o floatnum.o `test -f 'libyasm/floatnum.c' || echo '$(srcdir)/'`libyasm/floatnum.c
+ mv -f $(DEPDIR)/floatnum.Tpo $(DEPDIR)/floatnum.Po
+# source='libyasm/floatnum.c' object='floatnum.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o floatnum.o `test -f 'libyasm/floatnum.c' || echo '$(srcdir)/'`libyasm/floatnum.c
+
+floatnum.obj: libyasm/floatnum.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT floatnum.obj -MD -MP -MF $(DEPDIR)/floatnum.Tpo -c -o floatnum.obj `if test -f 'libyasm/floatnum.c'; then $(CYGPATH_W) 'libyasm/floatnum.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/floatnum.c'; fi`
+ mv -f $(DEPDIR)/floatnum.Tpo $(DEPDIR)/floatnum.Po
+# source='libyasm/floatnum.c' object='floatnum.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o floatnum.obj `if test -f 'libyasm/floatnum.c'; then $(CYGPATH_W) 'libyasm/floatnum.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/floatnum.c'; fi`
+
+hamt.o: libyasm/hamt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT hamt.o -MD -MP -MF $(DEPDIR)/hamt.Tpo -c -o hamt.o `test -f 'libyasm/hamt.c' || echo '$(srcdir)/'`libyasm/hamt.c
+ mv -f $(DEPDIR)/hamt.Tpo $(DEPDIR)/hamt.Po
+# source='libyasm/hamt.c' object='hamt.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o hamt.o `test -f 'libyasm/hamt.c' || echo '$(srcdir)/'`libyasm/hamt.c
+
+hamt.obj: libyasm/hamt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT hamt.obj -MD -MP -MF $(DEPDIR)/hamt.Tpo -c -o hamt.obj `if test -f 'libyasm/hamt.c'; then $(CYGPATH_W) 'libyasm/hamt.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/hamt.c'; fi`
+ mv -f $(DEPDIR)/hamt.Tpo $(DEPDIR)/hamt.Po
+# source='libyasm/hamt.c' object='hamt.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o hamt.obj `if test -f 'libyasm/hamt.c'; then $(CYGPATH_W) 'libyasm/hamt.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/hamt.c'; fi`
+
+insn.o: libyasm/insn.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT insn.o -MD -MP -MF $(DEPDIR)/insn.Tpo -c -o insn.o `test -f 'libyasm/insn.c' || echo '$(srcdir)/'`libyasm/insn.c
+ mv -f $(DEPDIR)/insn.Tpo $(DEPDIR)/insn.Po
+# source='libyasm/insn.c' object='insn.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o insn.o `test -f 'libyasm/insn.c' || echo '$(srcdir)/'`libyasm/insn.c
+
+insn.obj: libyasm/insn.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT insn.obj -MD -MP -MF $(DEPDIR)/insn.Tpo -c -o insn.obj `if test -f 'libyasm/insn.c'; then $(CYGPATH_W) 'libyasm/insn.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/insn.c'; fi`
+ mv -f $(DEPDIR)/insn.Tpo $(DEPDIR)/insn.Po
+# source='libyasm/insn.c' object='insn.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o insn.obj `if test -f 'libyasm/insn.c'; then $(CYGPATH_W) 'libyasm/insn.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/insn.c'; fi`
+
+intnum.o: libyasm/intnum.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT intnum.o -MD -MP -MF $(DEPDIR)/intnum.Tpo -c -o intnum.o `test -f 'libyasm/intnum.c' || echo '$(srcdir)/'`libyasm/intnum.c
+ mv -f $(DEPDIR)/intnum.Tpo $(DEPDIR)/intnum.Po
+# source='libyasm/intnum.c' object='intnum.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o intnum.o `test -f 'libyasm/intnum.c' || echo '$(srcdir)/'`libyasm/intnum.c
+
+intnum.obj: libyasm/intnum.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT intnum.obj -MD -MP -MF $(DEPDIR)/intnum.Tpo -c -o intnum.obj `if test -f 'libyasm/intnum.c'; then $(CYGPATH_W) 'libyasm/intnum.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/intnum.c'; fi`
+ mv -f $(DEPDIR)/intnum.Tpo $(DEPDIR)/intnum.Po
+# source='libyasm/intnum.c' object='intnum.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o intnum.obj `if test -f 'libyasm/intnum.c'; then $(CYGPATH_W) 'libyasm/intnum.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/intnum.c'; fi`
+
+inttree.o: libyasm/inttree.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT inttree.o -MD -MP -MF $(DEPDIR)/inttree.Tpo -c -o inttree.o `test -f 'libyasm/inttree.c' || echo '$(srcdir)/'`libyasm/inttree.c
+ mv -f $(DEPDIR)/inttree.Tpo $(DEPDIR)/inttree.Po
+# source='libyasm/inttree.c' object='inttree.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o inttree.o `test -f 'libyasm/inttree.c' || echo '$(srcdir)/'`libyasm/inttree.c
+
+inttree.obj: libyasm/inttree.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT inttree.obj -MD -MP -MF $(DEPDIR)/inttree.Tpo -c -o inttree.obj `if test -f 'libyasm/inttree.c'; then $(CYGPATH_W) 'libyasm/inttree.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/inttree.c'; fi`
+ mv -f $(DEPDIR)/inttree.Tpo $(DEPDIR)/inttree.Po
+# source='libyasm/inttree.c' object='inttree.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o inttree.obj `if test -f 'libyasm/inttree.c'; then $(CYGPATH_W) 'libyasm/inttree.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/inttree.c'; fi`
+
+linemap.o: libyasm/linemap.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT linemap.o -MD -MP -MF $(DEPDIR)/linemap.Tpo -c -o linemap.o `test -f 'libyasm/linemap.c' || echo '$(srcdir)/'`libyasm/linemap.c
+ mv -f $(DEPDIR)/linemap.Tpo $(DEPDIR)/linemap.Po
+# source='libyasm/linemap.c' object='linemap.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o linemap.o `test -f 'libyasm/linemap.c' || echo '$(srcdir)/'`libyasm/linemap.c
+
+linemap.obj: libyasm/linemap.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT linemap.obj -MD -MP -MF $(DEPDIR)/linemap.Tpo -c -o linemap.obj `if test -f 'libyasm/linemap.c'; then $(CYGPATH_W) 'libyasm/linemap.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/linemap.c'; fi`
+ mv -f $(DEPDIR)/linemap.Tpo $(DEPDIR)/linemap.Po
+# source='libyasm/linemap.c' object='linemap.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o linemap.obj `if test -f 'libyasm/linemap.c'; then $(CYGPATH_W) 'libyasm/linemap.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/linemap.c'; fi`
+
+md5.o: libyasm/md5.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT md5.o -MD -MP -MF $(DEPDIR)/md5.Tpo -c -o md5.o `test -f 'libyasm/md5.c' || echo '$(srcdir)/'`libyasm/md5.c
+ mv -f $(DEPDIR)/md5.Tpo $(DEPDIR)/md5.Po
+# source='libyasm/md5.c' object='md5.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o md5.o `test -f 'libyasm/md5.c' || echo '$(srcdir)/'`libyasm/md5.c
+
+md5.obj: libyasm/md5.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT md5.obj -MD -MP -MF $(DEPDIR)/md5.Tpo -c -o md5.obj `if test -f 'libyasm/md5.c'; then $(CYGPATH_W) 'libyasm/md5.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/md5.c'; fi`
+ mv -f $(DEPDIR)/md5.Tpo $(DEPDIR)/md5.Po
+# source='libyasm/md5.c' object='md5.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o md5.obj `if test -f 'libyasm/md5.c'; then $(CYGPATH_W) 'libyasm/md5.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/md5.c'; fi`
+
+mergesort.o: libyasm/mergesort.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mergesort.o -MD -MP -MF $(DEPDIR)/mergesort.Tpo -c -o mergesort.o `test -f 'libyasm/mergesort.c' || echo '$(srcdir)/'`libyasm/mergesort.c
+ mv -f $(DEPDIR)/mergesort.Tpo $(DEPDIR)/mergesort.Po
+# source='libyasm/mergesort.c' object='mergesort.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mergesort.o `test -f 'libyasm/mergesort.c' || echo '$(srcdir)/'`libyasm/mergesort.c
+
+mergesort.obj: libyasm/mergesort.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mergesort.obj -MD -MP -MF $(DEPDIR)/mergesort.Tpo -c -o mergesort.obj `if test -f 'libyasm/mergesort.c'; then $(CYGPATH_W) 'libyasm/mergesort.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/mergesort.c'; fi`
+ mv -f $(DEPDIR)/mergesort.Tpo $(DEPDIR)/mergesort.Po
+# source='libyasm/mergesort.c' object='mergesort.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mergesort.obj `if test -f 'libyasm/mergesort.c'; then $(CYGPATH_W) 'libyasm/mergesort.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/mergesort.c'; fi`
+
+phash.o: libyasm/phash.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT phash.o -MD -MP -MF $(DEPDIR)/phash.Tpo -c -o phash.o `test -f 'libyasm/phash.c' || echo '$(srcdir)/'`libyasm/phash.c
+ mv -f $(DEPDIR)/phash.Tpo $(DEPDIR)/phash.Po
+# source='libyasm/phash.c' object='phash.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o phash.o `test -f 'libyasm/phash.c' || echo '$(srcdir)/'`libyasm/phash.c
+
+phash.obj: libyasm/phash.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT phash.obj -MD -MP -MF $(DEPDIR)/phash.Tpo -c -o phash.obj `if test -f 'libyasm/phash.c'; then $(CYGPATH_W) 'libyasm/phash.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/phash.c'; fi`
+ mv -f $(DEPDIR)/phash.Tpo $(DEPDIR)/phash.Po
+# source='libyasm/phash.c' object='phash.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o phash.obj `if test -f 'libyasm/phash.c'; then $(CYGPATH_W) 'libyasm/phash.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/phash.c'; fi`
+
+section.o: libyasm/section.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT section.o -MD -MP -MF $(DEPDIR)/section.Tpo -c -o section.o `test -f 'libyasm/section.c' || echo '$(srcdir)/'`libyasm/section.c
+ mv -f $(DEPDIR)/section.Tpo $(DEPDIR)/section.Po
+# source='libyasm/section.c' object='section.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o section.o `test -f 'libyasm/section.c' || echo '$(srcdir)/'`libyasm/section.c
+
+section.obj: libyasm/section.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT section.obj -MD -MP -MF $(DEPDIR)/section.Tpo -c -o section.obj `if test -f 'libyasm/section.c'; then $(CYGPATH_W) 'libyasm/section.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/section.c'; fi`
+ mv -f $(DEPDIR)/section.Tpo $(DEPDIR)/section.Po
+# source='libyasm/section.c' object='section.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o section.obj `if test -f 'libyasm/section.c'; then $(CYGPATH_W) 'libyasm/section.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/section.c'; fi`
+
+strcasecmp.o: libyasm/strcasecmp.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT strcasecmp.o -MD -MP -MF $(DEPDIR)/strcasecmp.Tpo -c -o strcasecmp.o `test -f 'libyasm/strcasecmp.c' || echo '$(srcdir)/'`libyasm/strcasecmp.c
+ mv -f $(DEPDIR)/strcasecmp.Tpo $(DEPDIR)/strcasecmp.Po
+# source='libyasm/strcasecmp.c' object='strcasecmp.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o strcasecmp.o `test -f 'libyasm/strcasecmp.c' || echo '$(srcdir)/'`libyasm/strcasecmp.c
+
+strcasecmp.obj: libyasm/strcasecmp.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT strcasecmp.obj -MD -MP -MF $(DEPDIR)/strcasecmp.Tpo -c -o strcasecmp.obj `if test -f 'libyasm/strcasecmp.c'; then $(CYGPATH_W) 'libyasm/strcasecmp.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/strcasecmp.c'; fi`
+ mv -f $(DEPDIR)/strcasecmp.Tpo $(DEPDIR)/strcasecmp.Po
+# source='libyasm/strcasecmp.c' object='strcasecmp.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o strcasecmp.obj `if test -f 'libyasm/strcasecmp.c'; then $(CYGPATH_W) 'libyasm/strcasecmp.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/strcasecmp.c'; fi`
+
+strsep.o: libyasm/strsep.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT strsep.o -MD -MP -MF $(DEPDIR)/strsep.Tpo -c -o strsep.o `test -f 'libyasm/strsep.c' || echo '$(srcdir)/'`libyasm/strsep.c
+ mv -f $(DEPDIR)/strsep.Tpo $(DEPDIR)/strsep.Po
+# source='libyasm/strsep.c' object='strsep.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o strsep.o `test -f 'libyasm/strsep.c' || echo '$(srcdir)/'`libyasm/strsep.c
+
+strsep.obj: libyasm/strsep.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT strsep.obj -MD -MP -MF $(DEPDIR)/strsep.Tpo -c -o strsep.obj `if test -f 'libyasm/strsep.c'; then $(CYGPATH_W) 'libyasm/strsep.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/strsep.c'; fi`
+ mv -f $(DEPDIR)/strsep.Tpo $(DEPDIR)/strsep.Po
+# source='libyasm/strsep.c' object='strsep.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o strsep.obj `if test -f 'libyasm/strsep.c'; then $(CYGPATH_W) 'libyasm/strsep.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/strsep.c'; fi`
+
+symrec.o: libyasm/symrec.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT symrec.o -MD -MP -MF $(DEPDIR)/symrec.Tpo -c -o symrec.o `test -f 'libyasm/symrec.c' || echo '$(srcdir)/'`libyasm/symrec.c
+ mv -f $(DEPDIR)/symrec.Tpo $(DEPDIR)/symrec.Po
+# source='libyasm/symrec.c' object='symrec.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o symrec.o `test -f 'libyasm/symrec.c' || echo '$(srcdir)/'`libyasm/symrec.c
+
+symrec.obj: libyasm/symrec.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT symrec.obj -MD -MP -MF $(DEPDIR)/symrec.Tpo -c -o symrec.obj `if test -f 'libyasm/symrec.c'; then $(CYGPATH_W) 'libyasm/symrec.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/symrec.c'; fi`
+ mv -f $(DEPDIR)/symrec.Tpo $(DEPDIR)/symrec.Po
+# source='libyasm/symrec.c' object='symrec.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o symrec.obj `if test -f 'libyasm/symrec.c'; then $(CYGPATH_W) 'libyasm/symrec.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/symrec.c'; fi`
+
+valparam.o: libyasm/valparam.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT valparam.o -MD -MP -MF $(DEPDIR)/valparam.Tpo -c -o valparam.o `test -f 'libyasm/valparam.c' || echo '$(srcdir)/'`libyasm/valparam.c
+ mv -f $(DEPDIR)/valparam.Tpo $(DEPDIR)/valparam.Po
+# source='libyasm/valparam.c' object='valparam.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o valparam.o `test -f 'libyasm/valparam.c' || echo '$(srcdir)/'`libyasm/valparam.c
+
+valparam.obj: libyasm/valparam.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT valparam.obj -MD -MP -MF $(DEPDIR)/valparam.Tpo -c -o valparam.obj `if test -f 'libyasm/valparam.c'; then $(CYGPATH_W) 'libyasm/valparam.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/valparam.c'; fi`
+ mv -f $(DEPDIR)/valparam.Tpo $(DEPDIR)/valparam.Po
+# source='libyasm/valparam.c' object='valparam.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o valparam.obj `if test -f 'libyasm/valparam.c'; then $(CYGPATH_W) 'libyasm/valparam.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/valparam.c'; fi`
+
+value.o: libyasm/value.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT value.o -MD -MP -MF $(DEPDIR)/value.Tpo -c -o value.o `test -f 'libyasm/value.c' || echo '$(srcdir)/'`libyasm/value.c
+ mv -f $(DEPDIR)/value.Tpo $(DEPDIR)/value.Po
+# source='libyasm/value.c' object='value.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o value.o `test -f 'libyasm/value.c' || echo '$(srcdir)/'`libyasm/value.c
+
+value.obj: libyasm/value.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT value.obj -MD -MP -MF $(DEPDIR)/value.Tpo -c -o value.obj `if test -f 'libyasm/value.c'; then $(CYGPATH_W) 'libyasm/value.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/value.c'; fi`
+ mv -f $(DEPDIR)/value.Tpo $(DEPDIR)/value.Po
+# source='libyasm/value.c' object='value.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o value.obj `if test -f 'libyasm/value.c'; then $(CYGPATH_W) 'libyasm/value.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/value.c'; fi`
+
+xmalloc.o: libyasm/xmalloc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xmalloc.o -MD -MP -MF $(DEPDIR)/xmalloc.Tpo -c -o xmalloc.o `test -f 'libyasm/xmalloc.c' || echo '$(srcdir)/'`libyasm/xmalloc.c
+ mv -f $(DEPDIR)/xmalloc.Tpo $(DEPDIR)/xmalloc.Po
+# source='libyasm/xmalloc.c' object='xmalloc.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xmalloc.o `test -f 'libyasm/xmalloc.c' || echo '$(srcdir)/'`libyasm/xmalloc.c
+
+xmalloc.obj: libyasm/xmalloc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xmalloc.obj -MD -MP -MF $(DEPDIR)/xmalloc.Tpo -c -o xmalloc.obj `if test -f 'libyasm/xmalloc.c'; then $(CYGPATH_W) 'libyasm/xmalloc.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/xmalloc.c'; fi`
+ mv -f $(DEPDIR)/xmalloc.Tpo $(DEPDIR)/xmalloc.Po
+# source='libyasm/xmalloc.c' object='xmalloc.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xmalloc.obj `if test -f 'libyasm/xmalloc.c'; then $(CYGPATH_W) 'libyasm/xmalloc.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/xmalloc.c'; fi`
+
+xstrdup.o: libyasm/xstrdup.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xstrdup.o -MD -MP -MF $(DEPDIR)/xstrdup.Tpo -c -o xstrdup.o `test -f 'libyasm/xstrdup.c' || echo '$(srcdir)/'`libyasm/xstrdup.c
+ mv -f $(DEPDIR)/xstrdup.Tpo $(DEPDIR)/xstrdup.Po
+# source='libyasm/xstrdup.c' object='xstrdup.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xstrdup.o `test -f 'libyasm/xstrdup.c' || echo '$(srcdir)/'`libyasm/xstrdup.c
+
+xstrdup.obj: libyasm/xstrdup.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xstrdup.obj -MD -MP -MF $(DEPDIR)/xstrdup.Tpo -c -o xstrdup.obj `if test -f 'libyasm/xstrdup.c'; then $(CYGPATH_W) 'libyasm/xstrdup.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/xstrdup.c'; fi`
+ mv -f $(DEPDIR)/xstrdup.Tpo $(DEPDIR)/xstrdup.Po
+# source='libyasm/xstrdup.c' object='xstrdup.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xstrdup.obj `if test -f 'libyasm/xstrdup.c'; then $(CYGPATH_W) 'libyasm/xstrdup.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/xstrdup.c'; fi`
+
+bitvect_test.o: libyasm/tests/bitvect_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bitvect_test.o -MD -MP -MF $(DEPDIR)/bitvect_test.Tpo -c -o bitvect_test.o `test -f 'libyasm/tests/bitvect_test.c' || echo '$(srcdir)/'`libyasm/tests/bitvect_test.c
+ mv -f $(DEPDIR)/bitvect_test.Tpo $(DEPDIR)/bitvect_test.Po
+# source='libyasm/tests/bitvect_test.c' object='bitvect_test.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bitvect_test.o `test -f 'libyasm/tests/bitvect_test.c' || echo '$(srcdir)/'`libyasm/tests/bitvect_test.c
+
+bitvect_test.obj: libyasm/tests/bitvect_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bitvect_test.obj -MD -MP -MF $(DEPDIR)/bitvect_test.Tpo -c -o bitvect_test.obj `if test -f 'libyasm/tests/bitvect_test.c'; then $(CYGPATH_W) 'libyasm/tests/bitvect_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/bitvect_test.c'; fi`
+ mv -f $(DEPDIR)/bitvect_test.Tpo $(DEPDIR)/bitvect_test.Po
+# source='libyasm/tests/bitvect_test.c' object='bitvect_test.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bitvect_test.obj `if test -f 'libyasm/tests/bitvect_test.c'; then $(CYGPATH_W) 'libyasm/tests/bitvect_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/bitvect_test.c'; fi`
+
+combpath_test.o: libyasm/tests/combpath_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT combpath_test.o -MD -MP -MF $(DEPDIR)/combpath_test.Tpo -c -o combpath_test.o `test -f 'libyasm/tests/combpath_test.c' || echo '$(srcdir)/'`libyasm/tests/combpath_test.c
+ mv -f $(DEPDIR)/combpath_test.Tpo $(DEPDIR)/combpath_test.Po
+# source='libyasm/tests/combpath_test.c' object='combpath_test.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o combpath_test.o `test -f 'libyasm/tests/combpath_test.c' || echo '$(srcdir)/'`libyasm/tests/combpath_test.c
+
+combpath_test.obj: libyasm/tests/combpath_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT combpath_test.obj -MD -MP -MF $(DEPDIR)/combpath_test.Tpo -c -o combpath_test.obj `if test -f 'libyasm/tests/combpath_test.c'; then $(CYGPATH_W) 'libyasm/tests/combpath_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/combpath_test.c'; fi`
+ mv -f $(DEPDIR)/combpath_test.Tpo $(DEPDIR)/combpath_test.Po
+# source='libyasm/tests/combpath_test.c' object='combpath_test.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o combpath_test.obj `if test -f 'libyasm/tests/combpath_test.c'; then $(CYGPATH_W) 'libyasm/tests/combpath_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/combpath_test.c'; fi`
+
+floatnum_test.o: libyasm/tests/floatnum_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT floatnum_test.o -MD -MP -MF $(DEPDIR)/floatnum_test.Tpo -c -o floatnum_test.o `test -f 'libyasm/tests/floatnum_test.c' || echo '$(srcdir)/'`libyasm/tests/floatnum_test.c
+ mv -f $(DEPDIR)/floatnum_test.Tpo $(DEPDIR)/floatnum_test.Po
+# source='libyasm/tests/floatnum_test.c' object='floatnum_test.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o floatnum_test.o `test -f 'libyasm/tests/floatnum_test.c' || echo '$(srcdir)/'`libyasm/tests/floatnum_test.c
+
+floatnum_test.obj: libyasm/tests/floatnum_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT floatnum_test.obj -MD -MP -MF $(DEPDIR)/floatnum_test.Tpo -c -o floatnum_test.obj `if test -f 'libyasm/tests/floatnum_test.c'; then $(CYGPATH_W) 'libyasm/tests/floatnum_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/floatnum_test.c'; fi`
+ mv -f $(DEPDIR)/floatnum_test.Tpo $(DEPDIR)/floatnum_test.Po
+# source='libyasm/tests/floatnum_test.c' object='floatnum_test.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o floatnum_test.obj `if test -f 'libyasm/tests/floatnum_test.c'; then $(CYGPATH_W) 'libyasm/tests/floatnum_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/floatnum_test.c'; fi`
+
+leb128_test.o: libyasm/tests/leb128_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT leb128_test.o -MD -MP -MF $(DEPDIR)/leb128_test.Tpo -c -o leb128_test.o `test -f 'libyasm/tests/leb128_test.c' || echo '$(srcdir)/'`libyasm/tests/leb128_test.c
+ mv -f $(DEPDIR)/leb128_test.Tpo $(DEPDIR)/leb128_test.Po
+# source='libyasm/tests/leb128_test.c' object='leb128_test.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o leb128_test.o `test -f 'libyasm/tests/leb128_test.c' || echo '$(srcdir)/'`libyasm/tests/leb128_test.c
+
+leb128_test.obj: libyasm/tests/leb128_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT leb128_test.obj -MD -MP -MF $(DEPDIR)/leb128_test.Tpo -c -o leb128_test.obj `if test -f 'libyasm/tests/leb128_test.c'; then $(CYGPATH_W) 'libyasm/tests/leb128_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/leb128_test.c'; fi`
+ mv -f $(DEPDIR)/leb128_test.Tpo $(DEPDIR)/leb128_test.Po
+# source='libyasm/tests/leb128_test.c' object='leb128_test.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o leb128_test.obj `if test -f 'libyasm/tests/leb128_test.c'; then $(CYGPATH_W) 'libyasm/tests/leb128_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/leb128_test.c'; fi`
+
+splitpath_test.o: libyasm/tests/splitpath_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT splitpath_test.o -MD -MP -MF $(DEPDIR)/splitpath_test.Tpo -c -o splitpath_test.o `test -f 'libyasm/tests/splitpath_test.c' || echo '$(srcdir)/'`libyasm/tests/splitpath_test.c
+ mv -f $(DEPDIR)/splitpath_test.Tpo $(DEPDIR)/splitpath_test.Po
+# source='libyasm/tests/splitpath_test.c' object='splitpath_test.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o splitpath_test.o `test -f 'libyasm/tests/splitpath_test.c' || echo '$(srcdir)/'`libyasm/tests/splitpath_test.c
+
+splitpath_test.obj: libyasm/tests/splitpath_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT splitpath_test.obj -MD -MP -MF $(DEPDIR)/splitpath_test.Tpo -c -o splitpath_test.obj `if test -f 'libyasm/tests/splitpath_test.c'; then $(CYGPATH_W) 'libyasm/tests/splitpath_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/splitpath_test.c'; fi`
+ mv -f $(DEPDIR)/splitpath_test.Tpo $(DEPDIR)/splitpath_test.Po
+# source='libyasm/tests/splitpath_test.c' object='splitpath_test.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o splitpath_test.obj `if test -f 'libyasm/tests/splitpath_test.c'; then $(CYGPATH_W) 'libyasm/tests/splitpath_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/splitpath_test.c'; fi`
+
+uncstring_test.o: libyasm/tests/uncstring_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT uncstring_test.o -MD -MP -MF $(DEPDIR)/uncstring_test.Tpo -c -o uncstring_test.o `test -f 'libyasm/tests/uncstring_test.c' || echo '$(srcdir)/'`libyasm/tests/uncstring_test.c
+ mv -f $(DEPDIR)/uncstring_test.Tpo $(DEPDIR)/uncstring_test.Po
+# source='libyasm/tests/uncstring_test.c' object='uncstring_test.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o uncstring_test.o `test -f 'libyasm/tests/uncstring_test.c' || echo '$(srcdir)/'`libyasm/tests/uncstring_test.c
+
+uncstring_test.obj: libyasm/tests/uncstring_test.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT uncstring_test.obj -MD -MP -MF $(DEPDIR)/uncstring_test.Tpo -c -o uncstring_test.obj `if test -f 'libyasm/tests/uncstring_test.c'; then $(CYGPATH_W) 'libyasm/tests/uncstring_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/uncstring_test.c'; fi`
+ mv -f $(DEPDIR)/uncstring_test.Tpo $(DEPDIR)/uncstring_test.Po
+# source='libyasm/tests/uncstring_test.c' object='uncstring_test.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o uncstring_test.obj `if test -f 'libyasm/tests/uncstring_test.c'; then $(CYGPATH_W) 'libyasm/tests/uncstring_test.c'; else $(CYGPATH_W) '$(srcdir)/libyasm/tests/uncstring_test.c'; fi`
+
+yasm.o: frontends/yasm/yasm.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT yasm.o -MD -MP -MF $(DEPDIR)/yasm.Tpo -c -o yasm.o `test -f 'frontends/yasm/yasm.c' || echo '$(srcdir)/'`frontends/yasm/yasm.c
+ mv -f $(DEPDIR)/yasm.Tpo $(DEPDIR)/yasm.Po
+# source='frontends/yasm/yasm.c' object='yasm.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o yasm.o `test -f 'frontends/yasm/yasm.c' || echo '$(srcdir)/'`frontends/yasm/yasm.c
+
+yasm.obj: frontends/yasm/yasm.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT yasm.obj -MD -MP -MF $(DEPDIR)/yasm.Tpo -c -o yasm.obj `if test -f 'frontends/yasm/yasm.c'; then $(CYGPATH_W) 'frontends/yasm/yasm.c'; else $(CYGPATH_W) '$(srcdir)/frontends/yasm/yasm.c'; fi`
+ mv -f $(DEPDIR)/yasm.Tpo $(DEPDIR)/yasm.Po
+# source='frontends/yasm/yasm.c' object='yasm.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o yasm.obj `if test -f 'frontends/yasm/yasm.c'; then $(CYGPATH_W) 'frontends/yasm/yasm.c'; else $(CYGPATH_W) '$(srcdir)/frontends/yasm/yasm.c'; fi`
+
+yasm-options.o: frontends/yasm/yasm-options.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT yasm-options.o -MD -MP -MF $(DEPDIR)/yasm-options.Tpo -c -o yasm-options.o `test -f 'frontends/yasm/yasm-options.c' || echo '$(srcdir)/'`frontends/yasm/yasm-options.c
+ mv -f $(DEPDIR)/yasm-options.Tpo $(DEPDIR)/yasm-options.Po
+# source='frontends/yasm/yasm-options.c' object='yasm-options.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o yasm-options.o `test -f 'frontends/yasm/yasm-options.c' || echo '$(srcdir)/'`frontends/yasm/yasm-options.c
+
+yasm-options.obj: frontends/yasm/yasm-options.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT yasm-options.obj -MD -MP -MF $(DEPDIR)/yasm-options.Tpo -c -o yasm-options.obj `if test -f 'frontends/yasm/yasm-options.c'; then $(CYGPATH_W) 'frontends/yasm/yasm-options.c'; else $(CYGPATH_W) '$(srcdir)/frontends/yasm/yasm-options.c'; fi`
+ mv -f $(DEPDIR)/yasm-options.Tpo $(DEPDIR)/yasm-options.Po
+# source='frontends/yasm/yasm-options.c' object='yasm-options.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o yasm-options.obj `if test -f 'frontends/yasm/yasm-options.c'; then $(CYGPATH_W) 'frontends/yasm/yasm-options.c'; else $(CYGPATH_W) '$(srcdir)/frontends/yasm/yasm-options.c'; fi`
+
+tasm.o: frontends/tasm/tasm.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tasm.o -MD -MP -MF $(DEPDIR)/tasm.Tpo -c -o tasm.o `test -f 'frontends/tasm/tasm.c' || echo '$(srcdir)/'`frontends/tasm/tasm.c
+ mv -f $(DEPDIR)/tasm.Tpo $(DEPDIR)/tasm.Po
+# source='frontends/tasm/tasm.c' object='tasm.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tasm.o `test -f 'frontends/tasm/tasm.c' || echo '$(srcdir)/'`frontends/tasm/tasm.c
+
+tasm.obj: frontends/tasm/tasm.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tasm.obj -MD -MP -MF $(DEPDIR)/tasm.Tpo -c -o tasm.obj `if test -f 'frontends/tasm/tasm.c'; then $(CYGPATH_W) 'frontends/tasm/tasm.c'; else $(CYGPATH_W) '$(srcdir)/frontends/tasm/tasm.c'; fi`
+ mv -f $(DEPDIR)/tasm.Tpo $(DEPDIR)/tasm.Po
+# source='frontends/tasm/tasm.c' object='tasm.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tasm.obj `if test -f 'frontends/tasm/tasm.c'; then $(CYGPATH_W) 'frontends/tasm/tasm.c'; else $(CYGPATH_W) '$(srcdir)/frontends/tasm/tasm.c'; fi`
+
+tasm-options.o: frontends/tasm/tasm-options.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tasm-options.o -MD -MP -MF $(DEPDIR)/tasm-options.Tpo -c -o tasm-options.o `test -f 'frontends/tasm/tasm-options.c' || echo '$(srcdir)/'`frontends/tasm/tasm-options.c
+ mv -f $(DEPDIR)/tasm-options.Tpo $(DEPDIR)/tasm-options.Po
+# source='frontends/tasm/tasm-options.c' object='tasm-options.o' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tasm-options.o `test -f 'frontends/tasm/tasm-options.c' || echo '$(srcdir)/'`frontends/tasm/tasm-options.c
+
+tasm-options.obj: frontends/tasm/tasm-options.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tasm-options.obj -MD -MP -MF $(DEPDIR)/tasm-options.Tpo -c -o tasm-options.obj `if test -f 'frontends/tasm/tasm-options.c'; then $(CYGPATH_W) 'frontends/tasm/tasm-options.c'; else $(CYGPATH_W) '$(srcdir)/frontends/tasm/tasm-options.c'; fi`
+ mv -f $(DEPDIR)/tasm-options.Tpo $(DEPDIR)/tasm-options.Po
+# source='frontends/tasm/tasm-options.c' object='tasm-options.obj' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tasm-options.obj `if test -f 'frontends/tasm/tasm-options.c'; then $(CYGPATH_W) 'frontends/tasm/tasm-options.c'; else $(CYGPATH_W) '$(srcdir)/frontends/tasm/tasm-options.c'; fi`
+install-man1: $(man1_MANS) $(man_MANS)
+ @$(NORMAL_INSTALL)
+ test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)"
+ @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.1*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
+ else file=$$i; fi; \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 1*) ;; \
+ *) ext='1' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \
+ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst"; \
+ done
+uninstall-man1:
+ @$(NORMAL_UNINSTALL)
+ @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.1*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 1*) ;; \
+ *) ext='1' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " rm -f '$(DESTDIR)$(man1dir)/$$inst'"; \
+ rm -f "$(DESTDIR)$(man1dir)/$$inst"; \
+ done
+install-man7: $(man7_MANS) $(man_MANS)
+ @$(NORMAL_INSTALL)
+ test -z "$(man7dir)" || $(MKDIR_P) "$(DESTDIR)$(man7dir)"
+ @list='$(man7_MANS) $(dist_man7_MANS) $(nodist_man7_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.7*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
+ else file=$$i; fi; \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 7*) ;; \
+ *) ext='7' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man7dir)/$$inst'"; \
+ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man7dir)/$$inst"; \
+ done
+uninstall-man7:
+ @$(NORMAL_UNINSTALL)
+ @list='$(man7_MANS) $(dist_man7_MANS) $(nodist_man7_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.7*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 7*) ;; \
+ *) ext='7' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " rm -f '$(DESTDIR)$(man7dir)/$$inst'"; \
+ rm -f "$(DESTDIR)$(man7dir)/$$inst"; \
+ done
+install-includeHEADERS: $(include_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)"
+ @list='$(include_HEADERS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includedir)/$$f'"; \
+ $(includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includedir)/$$f"; \
+ done
+
+uninstall-includeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(include_HEADERS)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(includedir)/$$f'"; \
+ rm -f "$(DESTDIR)$(includedir)/$$f"; \
+ done
+install-modincludeHEADERS: $(modinclude_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(modincludedir)" || $(MKDIR_P) "$(DESTDIR)$(modincludedir)"
+ @list='$(modinclude_HEADERS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(modincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(modincludedir)/$$f'"; \
+ $(modincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(modincludedir)/$$f"; \
+ done
+
+uninstall-modincludeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(modinclude_HEADERS)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(modincludedir)/$$f'"; \
+ rm -f "$(DESTDIR)$(modincludedir)/$$f"; \
+ done
+install-nodist_includeHEADERS: $(nodist_include_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)"
+ @list='$(nodist_include_HEADERS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(nodist_includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includedir)/$$f'"; \
+ $(nodist_includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includedir)/$$f"; \
+ done
+
+uninstall-nodist_includeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(nodist_include_HEADERS)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(includedir)/$$f'"; \
+ rm -f "$(DESTDIR)$(includedir)/$$f"; \
+ done
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+check-TESTS: $(TESTS)
+ @failed=0; all=0; xfail=0; xpass=0; skip=0; ws='[ ]'; \
+ srcdir=$(srcdir); export srcdir; \
+ list=' $(TESTS) '; \
+ if test -n "$$list"; then \
+ for tst in $$list; do \
+ if test -f ./$$tst; then dir=./; \
+ elif test -f $$tst; then dir=; \
+ else dir="$(srcdir)/"; fi; \
+ if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
+ all=`expr $$all + 1`; \
+ case " $(XFAIL_TESTS) " in \
+ *$$ws$$tst$$ws*) \
+ xpass=`expr $$xpass + 1`; \
+ failed=`expr $$failed + 1`; \
+ echo "XPASS: $$tst"; \
+ ;; \
+ *) \
+ echo "PASS: $$tst"; \
+ ;; \
+ esac; \
+ elif test $$? -ne 77; then \
+ all=`expr $$all + 1`; \
+ case " $(XFAIL_TESTS) " in \
+ *$$ws$$tst$$ws*) \
+ xfail=`expr $$xfail + 1`; \
+ echo "XFAIL: $$tst"; \
+ ;; \
+ *) \
+ failed=`expr $$failed + 1`; \
+ echo "FAIL: $$tst"; \
+ ;; \
+ esac; \
+ else \
+ skip=`expr $$skip + 1`; \
+ echo "SKIP: $$tst"; \
+ fi; \
+ done; \
+ if test "$$failed" -eq 0; then \
+ if test "$$xfail" -eq 0; then \
+ banner="All $$all tests passed"; \
+ else \
+ banner="All $$all tests behaved as expected ($$xfail expected failures)"; \
+ fi; \
+ else \
+ if test "$$xpass" -eq 0; then \
+ banner="$$failed of $$all tests failed"; \
+ else \
+ banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \
+ fi; \
+ fi; \
+ dashes="$$banner"; \
+ skipped=""; \
+ if test "$$skip" -ne 0; then \
+ skipped="($$skip tests were not run)"; \
+ test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
+ dashes="$$skipped"; \
+ fi; \
+ report=""; \
+ if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
+ report="Please report to $(PACKAGE_BUGREPORT)"; \
+ test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
+ dashes="$$report"; \
+ fi; \
+ dashes=`echo "$$dashes" | sed s/./=/g`; \
+ echo "$$dashes"; \
+ echo "$$banner"; \
+ test -z "$$skipped" || echo "$$skipped"; \
+ test -z "$$report" || echo "$$report"; \
+ echo "$$dashes"; \
+ test "$$failed" -eq 0; \
+ else :; fi
+
+distdir: $(DISTFILES)
+ $(am__remove_distdir)
+ test -d $(distdir) || mkdir $(distdir)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ distdir=`$(am__cd) $(distdir) && pwd`; \
+ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$top_distdir" \
+ distdir="$$distdir/$$subdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+ -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
+ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
+ || chmod -R a+r $(distdir)
+dist-gzip: distdir
+ tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+ $(am__remove_distdir)
+
+dist-bzip2: distdir
+ tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
+ $(am__remove_distdir)
+
+dist-lzma: distdir
+ tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
+ $(am__remove_distdir)
+
+dist-tarZ: distdir
+ tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
+ $(am__remove_distdir)
+
+dist-shar: distdir
+ shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+ $(am__remove_distdir)
+
+dist-zip: distdir
+ -rm -f $(distdir).zip
+ zip -rq $(distdir).zip $(distdir)
+ $(am__remove_distdir)
+
+dist dist-all: distdir
+ tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+ $(am__remove_distdir)
+
+# This target untars the dist file and tries a VPATH configuration. Then
+# it guarantees that the distribution is self-contained by making another
+# tarfile.
+distcheck: dist
+ case '$(DIST_ARCHIVES)' in \
+ *.tar.gz*) \
+ GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
+ *.tar.bz2*) \
+ bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
+ *.tar.lzma*) \
+ unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\
+ *.tar.Z*) \
+ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
+ *.shar.gz*) \
+ GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
+ *.zip*) \
+ unzip $(distdir).zip ;;\
+ esac
+ chmod -R a-w $(distdir); chmod a+w $(distdir)
+ mkdir $(distdir)/_build
+ mkdir $(distdir)/_inst
+ chmod a-w $(distdir)
+ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
+ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
+ && cd $(distdir)/_build \
+ && ../configure --srcdir=.. --prefix="$$dc_install_base" \
+ $(DISTCHECK_CONFIGURE_FLAGS) \
+ && $(MAKE) $(AM_MAKEFLAGS) \
+ && $(MAKE) $(AM_MAKEFLAGS) dvi \
+ && $(MAKE) $(AM_MAKEFLAGS) check \
+ && $(MAKE) $(AM_MAKEFLAGS) install \
+ && $(MAKE) $(AM_MAKEFLAGS) installcheck \
+ && $(MAKE) $(AM_MAKEFLAGS) uninstall \
+ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
+ distuninstallcheck \
+ && chmod -R a-w "$$dc_install_base" \
+ && ({ \
+ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
+ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
+ } || { rm -rf "$$dc_destdir"; exit 1; }) \
+ && rm -rf "$$dc_destdir" \
+ && $(MAKE) $(AM_MAKEFLAGS) dist \
+ && rm -rf $(DIST_ARCHIVES) \
+ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck
+ $(am__remove_distdir)
+ @(echo "$(distdir) archives ready for distribution: "; \
+ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
+ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
+distuninstallcheck:
+ @cd $(distuninstallcheck_dir) \
+ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
+ || { echo "ERROR: files left after uninstall:" ; \
+ if test -n "$(DESTDIR)"; then \
+ echo " (check DESTDIR support)"; \
+ fi ; \
+ $(distuninstallcheck_listfiles) ; \
+ exit 1; } >&2
+distcleancheck: distclean
+ @if test '$(srcdir)' = . ; then \
+ echo "ERROR: distcleancheck can only run from a VPATH build" ; \
+ exit 1 ; \
+ fi
+ @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
+ || { echo "ERROR: files left in build directory after distclean:" ; \
+ $(distcleancheck_listfiles) ; \
+ exit 1; } >&2
+check-am: all-am
+ $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
+ $(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) check-recursive
+all-am: Makefile $(LIBRARIES) $(PROGRAMS) $(MANS) $(HEADERS) config.h \
+ all-local
+installdirs: installdirs-recursive
+installdirs-am:
+ for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man7dir)" "$(DESTDIR)$(includedir)" "$(DESTDIR)$(modincludedir)" "$(DESTDIR)$(includedir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+ -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
+clean: clean-recursive
+
+clean-am: clean-binPROGRAMS clean-checkPROGRAMS clean-generic \
+ clean-libLIBRARIES clean-noinstPROGRAMS mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-hdr distclean-local distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am: install-includeHEADERS install-man \
+ install-modincludeHEADERS install-nodist_includeHEADERS
+
+install-dvi: install-dvi-recursive
+
+install-exec-am: install-binPROGRAMS install-libLIBRARIES
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) install-exec-hook
+
+install-html: install-html-recursive
+
+install-info: install-info-recursive
+
+install-man: install-man1 install-man7
+
+install-pdf: install-pdf-recursive
+
+install-ps: install-ps-recursive
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+ -rm -rf $(top_srcdir)/autom4te.cache
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS uninstall-includeHEADERS \
+ uninstall-libLIBRARIES uninstall-man \
+ uninstall-modincludeHEADERS uninstall-nodist_includeHEADERS
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) uninstall-hook
+
+uninstall-man: uninstall-man1 uninstall-man7
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+ install-exec-am install-strip uninstall-am
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+ all all-am all-local am--refresh check check-TESTS check-am \
+ clean clean-binPROGRAMS clean-checkPROGRAMS clean-generic \
+ clean-libLIBRARIES clean-noinstPROGRAMS ctags ctags-recursive \
+ dist dist-all dist-bzip2 dist-gzip dist-lzma dist-shar \
+ dist-tarZ dist-zip distcheck distclean distclean-compile \
+ distclean-generic distclean-hdr distclean-local distclean-tags \
+ distcleancheck distdir distuninstallcheck dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-exec-hook install-html \
+ install-html-am install-includeHEADERS install-info \
+ install-info-am install-libLIBRARIES install-man install-man1 \
+ install-man7 install-modincludeHEADERS \
+ install-nodist_includeHEADERS install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs installdirs-am maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic pdf pdf-am ps ps-am tags tags-recursive \
+ uninstall uninstall-am uninstall-binPROGRAMS uninstall-hook \
+ uninstall-includeHEADERS uninstall-libLIBRARIES uninstall-man \
+ uninstall-man1 uninstall-man7 uninstall-modincludeHEADERS \
+ uninstall-nodist_includeHEADERS
+
+
+re2c-main.$(OBJEXT): tools/re2c/main.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/re2c/main.c || echo '$(srcdir)/'`tools/re2c/main.c
+
+re2c-code.$(OBJEXT): tools/re2c/code.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/re2c/code.c || echo '$(srcdir)/'`tools/re2c/code.c
+
+re2c-dfa.$(OBJEXT): tools/re2c/dfa.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/re2c/dfa.c || echo '$(srcdir)/'`tools/re2c/dfa.c
+
+re2c-parser.$(OBJEXT): tools/re2c/parser.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/re2c/parser.c || echo '$(srcdir)/'`tools/re2c/parser.c
+
+re2c-actions.$(OBJEXT): tools/re2c/actions.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/re2c/actions.c || echo '$(srcdir)/'`tools/re2c/actions.c
+
+re2c-scanner.$(OBJEXT): tools/re2c/scanner.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/re2c/scanner.c || echo '$(srcdir)/'`tools/re2c/scanner.c
+
+re2c-mbo_getopt.$(OBJEXT): tools/re2c/mbo_getopt.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/re2c/mbo_getopt.c || echo '$(srcdir)/'`tools/re2c/mbo_getopt.c
+
+re2c-substr.$(OBJEXT): tools/re2c/substr.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/re2c/substr.c || echo '$(srcdir)/'`tools/re2c/substr.c
+
+re2c-translate.$(OBJEXT): tools/re2c/translate.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/re2c/translate.c || echo '$(srcdir)/'`tools/re2c/translate.c
+
+genmacro.$(OBJEXT): tools/genmacro/genmacro.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/genmacro/genmacro.c || echo '$(srcdir)/'`tools/genmacro/genmacro.c
+.gperf.c: genperf$(EXEEXT)
+ $(top_builddir)/genperf$(EXEEXT) $< $@
+
+genperf.$(OBJEXT): tools/genperf/genperf.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/genperf/genperf.c || echo '$(srcdir)/'`tools/genperf/genperf.c
+
+gp-perfect.$(OBJEXT): tools/genperf/perfect.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/genperf/perfect.c || echo '$(srcdir)/'`tools/genperf/perfect.c
+
+gp-phash.$(OBJEXT): libyasm/phash.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f libyasm/phash.c || echo '$(srcdir)/'`libyasm/phash.c
+
+gp-xmalloc.$(OBJEXT): libyasm/xmalloc.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f libyasm/xmalloc.c || echo '$(srcdir)/'`libyasm/xmalloc.c
+
+gp-xstrdup.$(OBJEXT): libyasm/xstrdup.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f libyasm/xstrdup.c || echo '$(srcdir)/'`libyasm/xstrdup.c
+
+# Use Pyxelator to generate Pyrex function headers.
+#_yasm.pxi: ${HEADERS}
+# @rm -rf .tmp
+# @mkdir .tmp
+# $(PYTHON) $(srcdir)/tools/python-yasm/pyxelator/wrap_yasm.py \
+# "YASM_DIR=${srcdir}" "CPP=${CPP}" "CPPFLAGS=${CPPFLAGS}"
+# @rm -rf .tmp
+
+# Need to build a local copy of the main Pyrex input file to include _yasm.pxi
+# from the build directory. Also need to fixup the other .pxi include paths.
+#yasm.pyx: $(srcdir)/tools/python-yasm/yasm.pyx
+# sed -e 's,^include "\([^_]\),include "${srcdir}/tools/python-yasm/\1,' \
+# $(srcdir)/tools/python-yasm/yasm.pyx > $@
+
+# Actually run Pyrex
+#yasm_python.c: yasm.pyx _yasm.pxi $(PYBINDING_DEPS)
+# $(PYTHON) -c "from Pyrex.Compiler.Main import main; main(command_line=1)" \
+# -o $@ yasm.pyx
+
+# Now the Python build magic...
+#python-setup.txt: Makefile
+# echo "includes=${DEFS} ${DEFAULT_INCLUDES} ${INCLUDES} ${AM_CPPFLAGS} ${CPPFLAGS}" > python-setup.txt
+# echo "sources=${libyasm_a_SOURCES}" >> python-setup.txt
+# echo "srcdir=${srcdir}" >> python-setup.txt
+# echo "gcc=${GCC}" >> python-setup.txt
+
+#.python-build: python-setup.txt yasm_python.c ${libyasm_a_SOURCES}
+# $(PYTHON) `test -f tools/python-yasm/setup.py || echo '$(srcdir)/'`tools/python-yasm/setup.py build
+# touch .python-build
+#python-build: .python-build
+
+#python-install: .python-build
+# $(PYTHON) `test -f tools/python-yasm/setup.py || echo '$(srcdir)/'`tools/python-yasm/setup.py install "--install-lib=$(DESTDIR)$(pythondir)"
+
+#python-uninstall:
+# rm -f `$(PYTHON) -c "import sys;sys.path.insert(0, '${DESTDIR}${pythondir}'); import yasm; print yasm.__file__"`
+
+python-build:
+python-install:
+python-uninstall:
+
+modules/arch/x86/x86id.c: x86insn_nasm.c x86insn_gas.c x86insns.c
+
+x86insn_nasm.gperf x86insn_gas.gperf x86insns.c: $(srcdir)/modules/arch/x86/gen_x86_insn.py
+ $(PYTHON) $(srcdir)/modules/arch/x86/gen_x86_insn.py
+#x86insn_nasm.gperf: $(srcdir)/x86insn_nasm.gperf
+# @echo Python must be installed to regenerate x86 instructions files
+# cp $(srcdir)/x86insn_nasm.gperf $@
+#x86insn_gas.gperf: $(srcdir)/x86insn_gas.gperf
+# @echo Python must be installed to regenerate x86 instructions files
+# cp $(srcdir)/x86insn_gas.gperf $@
+
+# Use suffix rules for gperf files
+x86insn_nasm.c: x86insn_nasm.gperf genperf$(EXEEXT)
+x86insn_gas.c: x86insn_gas.gperf genperf$(EXEEXT)
+x86cpu.c: $(srcdir)/modules/arch/x86/x86cpu.gperf genperf$(EXEEXT)
+ $(top_builddir)/genperf$(EXEEXT) $(srcdir)/modules/arch/x86/x86cpu.gperf $@
+x86regtmod.c: $(srcdir)/modules/arch/x86/x86regtmod.gperf genperf$(EXEEXT)
+ $(top_builddir)/genperf$(EXEEXT) $(srcdir)/modules/arch/x86/x86regtmod.gperf $@
+
+lc3bid.c: $(srcdir)/modules/arch/lc3b/lc3bid.re re2c$(EXEEXT)
+ $(top_builddir)/re2c$(EXEEXT) -s -o $@ $(srcdir)/modules/arch/lc3b/lc3bid.re
+
+yasm_arch.7: modules/arch/yasm_arch.xml
+ $(XMLTO) -o $(top_builddir) man $(srcdir)/modules/arch/yasm_arch.xml
+
+#EXTRA_DIST += modules/listfmts/nasm/tests/Makefile.inc
+
+#include modules/listfmts/nasm/tests/Makefile.inc
+
+gas-token.c: $(srcdir)/modules/parsers/gas/gas-token.re re2c$(EXEEXT)
+ $(top_builddir)/re2c$(EXEEXT) -b -o $@ $(srcdir)/modules/parsers/gas/gas-token.re
+
+nasm-token.c: $(srcdir)/modules/parsers/nasm/nasm-token.re re2c$(EXEEXT)
+ $(top_builddir)/re2c$(EXEEXT) -b -o $@ $(srcdir)/modules/parsers/nasm/nasm-token.re
+
+$(top_srcdir)/modules/parsers/nasm/nasm-parser.c: nasm-macros.c
+
+nasm-macros.c: $(srcdir)/modules/parsers/nasm/nasm-std.mac genmacro$(EXEEXT)
+ $(top_builddir)/genmacro$(EXEEXT) $@ nasm_standard_mac $(srcdir)/modules/parsers/nasm/nasm-std.mac
+
+yasm_parsers.7: modules/parsers/yasm_parsers.xml
+ $(XMLTO) -o $(top_builddir) man $(srcdir)/modules/parsers/yasm_parsers.xml
+
+$(top_srcdir)/modules/preprocs/nasm/nasm-preproc.c: nasm-version.c
+
+nasm-version.c: version.mac genmacro$(EXEEXT)
+ $(top_builddir)/genmacro$(EXEEXT) $@ nasm_version_mac version.mac
+
+version.mac: genversion$(EXEEXT)
+ $(top_builddir)/genversion$(EXEEXT) $@
+
+genversion.$(OBJEXT): modules/preprocs/nasm/genversion.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f modules/preprocs/nasm/genversion.c || echo '$(srcdir)/'`modules/preprocs/nasm/genversion.c
+
+#EXTRA_DIST += modules/dbgfmts/codeview/tests/Makefile.inc
+#include modules/dbgfmts/codeview/tests/Makefile.inc
+
+yasm_dbgfmts.7: modules/dbgfmts/yasm_dbgfmts.xml
+ $(XMLTO) -o $(top_builddir) man $(srcdir)/modules/dbgfmts/yasm_dbgfmts.xml
+
+$(top_srcdir)/modules/objfmts/coff/coff-objfmt.c: win64-nasm.c win64-gas.c
+
+win64-nasm.c: $(srcdir)/modules/objfmts/coff/win64-nasm.mac genmacro$(EXEEXT)
+ $(top_builddir)/genmacro$(EXEEXT) $@ win64_nasm_stdmac $(srcdir)/modules/objfmts/coff/win64-nasm.mac
+
+win64-gas.c: $(srcdir)/modules/objfmts/coff/win64-gas.mac genmacro$(EXEEXT)
+ $(top_builddir)/genmacro$(EXEEXT) $@ win64_gas_stdmac $(srcdir)/modules/objfmts/coff/win64-gas.mac
+
+yasm_objfmts.7: modules/objfmts/yasm_objfmts.xml
+ $(XMLTO) -o $(top_builddir) man $(srcdir)/modules/objfmts/yasm_objfmts.xml
+
+module.c: $(top_srcdir)/libyasm/module.in genmodule$(EXEEXT) Makefile
+ $(top_builddir)/genmodule$(EXEEXT) $(top_srcdir)/libyasm/module.in Makefile
+
+genmodule.$(OBJEXT): libyasm/genmodule.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f libyasm/genmodule.c || echo '$(srcdir)/'`libyasm/genmodule.c
+
+yasm.1: frontends/yasm/yasm.xml
+ $(XMLTO) -o $(top_builddir) man $(srcdir)/frontends/yasm/yasm.xml
+
+$(srcdir)/frontends/yasm/yasm.c: license.c
+
+license.c: $(srcdir)/COPYING genstring$(EXEEXT)
+ $(top_builddir)/genstring$(EXEEXT) license_msg $@ $(srcdir)/COPYING
+
+distclean-local:
+ -rm -rf results
+ -rm -rf build
+
+all-local: python-build
+install-exec-hook: python-install
+uninstall-hook: python-uninstall
+
+genstring.$(OBJEXT): genstring.c
+ $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f genstring.c || echo '$(srcdir)/'`genstring.c
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/chromium/third_party/pdfium/third_party/yasm/source/config/win/config.h b/chromium/third_party/pdfium/third_party/yasm/source/config/win/config.h
new file mode 100644
index 00000000000..73ef9270e14
--- /dev/null
+++ b/chromium/third_party/pdfium/third_party/yasm/source/config/win/config.h
@@ -0,0 +1,173 @@
+/* config.h. Generated from config.h.in by configure. */
+/* config.h.in. Generated from configure.ac by autoheader. */
+
+/* Command name to run C preprocessor */
+#define CPP_PROG "gcc -E"
+
+/* */
+/* #undef ENABLE_NLS */
+
+/* Define to 1 if you have the `abort' function. */
+#define HAVE_ABORT 1
+
+/* */
+/* #undef HAVE_CATGETS */
+
+/* Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the
+ CoreFoundation framework. */
+/* #undef HAVE_CFLOCALECOPYCURRENT */
+
+/* Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in
+ the CoreFoundation framework. */
+/* #undef HAVE_CFPREFERENCESCOPYAPPVALUE */
+
+/* Define if the GNU dcgettext() function is already present or preinstalled.
+ */
+#define HAVE_DCGETTEXT 1
+
+/* Define to 1 if you have the <direct.h> header file. */
+#define HAVE_DIRECT_H 1
+
+/* Define to 1 if you have the `ftruncate' function. */
+/* #undef HAVE_FTRUNCATE */
+
+/* Define to 1 if you have the `getcwd' function. */
+#define HAVE_GETCWD 1
+
+/* */
+#define HAVE_GETTEXT 1
+
+/* Define to 1 if you have the GNU C Library */
+#define HAVE_GNU_C_LIBRARY 0
+
+/* Define if you have the iconv() function and it works. */
+/* #undef HAVE_ICONV */
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* */
+/* #undef HAVE_LC_MESSAGES */
+
+/* Define to 1 if you have the <libgen.h> header file. */
+/* #undef HAVE_LIBGEN_H */
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the `mergesort' function. */
+/* #undef HAVE_MERGESORT */
+
+/* Define to 1 if you have the `popen' function. */
+/* #undef HAVE_POPEN */
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* */
+/* #undef HAVE_STPCPY */
+
+/* Define to 1 if you have the `strcasecmp' function. */
+/* #undef HAVE_STRCASECMP */
+
+/* Define to 1 if you have the `strcmpi' function. */
+/* #undef HAVE_STRCMPI */
+
+/* Define to 1 if you have the `stricmp' function. */
+/* #undef HAVE_STRICMP */
+
+/* Define to 1 if you have the <strings.h> header file. */
+/* #undef HAVE_STRINGS_H */
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the `strncasecmp' function. */
+#define HAVE_STRNCASECMP 1
+
+/* Define to 1 if you have the `strsep' function. */
+/* #undef HAVE_STRSEP */
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the `toascii' function. */
+#define HAVE_TOASCII 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+/* #undef HAVE_UNISTD_H */
+
+/* Define to 1 if you have the `vsnprintf' function. */
+#define HAVE_VSNPRINTF 1
+
+/* Define to 1 if you have the `_stricmp' function. */
+/* #undef HAVE__STRICMP */
+
+/* Name of package */
+#define PACKAGE "yasm"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "bug-yasm@tortall.net"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "yasm"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "yasm 1.2.0"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "yasm"
+
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "1.2.0"
+
+/* Define to 1 if the C compiler supports function prototypes. */
+#define PROTOTYPES 1
+
+/* The size of `char', as computed by sizeof. */
+/* #undef SIZEOF_CHAR */
+
+/* The size of `int', as computed by sizeof. */
+/* #undef SIZEOF_INT */
+
+/* The size of `long', as computed by sizeof. */
+/* #undef SIZEOF_LONG */
+
+/* The size of `short', as computed by sizeof. */
+/* #undef SIZEOF_SHORT */
+
+/* The size of `void*', as computed by sizeof. */
+/* #undef SIZEOF_VOIDP */
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Version number of package */
+#define VERSION "1.2.0"
+
+/* Define if using the dmalloc debugging malloc package */
+/* #undef WITH_DMALLOC */
+
+/* Define like PROTOTYPES; this can be used by system headers. */
+#define __PROTOTYPES 1
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef const */
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+ calls it, or to nothing if 'inline' is not supported under any name. */
+#ifndef __cplusplus
+/* #undef inline */
+#endif
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+/* #undef size_t */
diff --git a/chromium/third_party/pdfium/third_party/yasm/source/config/win/libyasm-stdint.h b/chromium/third_party/pdfium/third_party/yasm/source/config/win/libyasm-stdint.h
new file mode 100644
index 00000000000..357610e1c11
--- /dev/null
+++ b/chromium/third_party/pdfium/third_party/yasm/source/config/win/libyasm-stdint.h
@@ -0,0 +1,9 @@
+#ifndef _YASM_LIBYASM_STDINT_H
+#define _YASM_LIBYASM_STDINT_H 1
+#ifndef _GENERATED_STDINT_H
+#define _GENERATED_STDINT_H "yasm HEAD"
+/* generated using gcc -std=gnu99 */
+#define _STDINT_HAVE_STDINT_H 1
+#include <stdint.h>
+#endif
+#endif
diff --git a/chromium/third_party/pdfium/third_party/yasm/source/config/win/stdint.h b/chromium/third_party/pdfium/third_party/yasm/source/config/win/stdint.h
new file mode 100644
index 00000000000..d77df926383
--- /dev/null
+++ b/chromium/third_party/pdfium/third_party/yasm/source/config/win/stdint.h
@@ -0,0 +1,30 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// YASM is written in C99 and requires <stdint.h> and <inttypes.h>.
+
+#ifndef THIRD_PARTY_YASM_SOURCE_CONFIG_WIN_STDINT_H_
+#define THIRD_PARTY_YASM_SOURCE_CONFIG_WIN_STDINT_H_
+
+#if !defined(_MSC_VER)
+#error This file should only be included when compiling with MSVC.
+#endif
+
+// Define C99 equivalent types.
+typedef signed char int8_t;
+typedef signed short int16_t;
+typedef signed int int32_t;
+typedef signed long long int64_t;
+typedef unsigned char uint8_t;
+typedef unsigned short uint16_t;
+typedef unsigned int uint32_t;
+typedef unsigned long long uint64_t;
+
+// Define the C99 INT64_C macro that is used for declaring 64-bit literals.
+// Technically, these should only be definied when __STDC_CONSTANT_MACROS
+// is defined.
+#define INT64_C(value) value##LL
+#define UINT64_C(value) value##ULL
+
+#endif // THIRD_PARTY_YASM_SOURCE_CONFIG_WIN_STDINT_H_
diff --git a/chromium/third_party/pdfium/third_party/yasm/yasm_assemble.gni b/chromium/third_party/pdfium/third_party/yasm/yasm_assemble.gni
new file mode 100644
index 00000000000..73d554856ba
--- /dev/null
+++ b/chromium/third_party/pdfium/third_party/yasm/yasm_assemble.gni
@@ -0,0 +1,196 @@
+# Copyright 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# This provides the yasm_assemble() template which uses YASM to assemble
+# assembly files.
+#
+# Files to be assembled with YASM should have an extension of .asm.
+#
+# Parameters
+#
+# yasm_flags (optional)
+# [list of strings] Pass additional flags into YASM. These are appended
+# to the command line. Note that the target machine type and system is
+# already set up based on the current toolchain so you don't need to
+# specify these things (see below).
+#
+# Example: yasm_flags = [ "--force-strict" ]
+#
+# include_dirs (optional)
+# [list of dir names] List of additional include dirs. Note that the
+# source root and the root generated file dir is always added, just like
+# our C++ build sets up.
+#
+# Example: include_dirs = [ "//some/other/path", target_gen_dir ]
+#
+# defines (optional)
+# [list of strings] List of defines, as with the native code defines.
+#
+# Example: defines = [ "FOO", "BAR=1" ]
+#
+# inputs, deps, visibility (optional)
+# These have the same meaning as in an action.
+#
+# Example
+#
+# yasm_assemble("my_yasm_target") {
+# sources = [
+# "ultra_optimized_awesome.asm",
+# ]
+# include_dirs = [ "assembly_include" ]
+# }
+
+if (is_mac || is_ios) {
+ if (current_cpu == "x86") {
+ _yasm_flags = [
+ "-fmacho32",
+ "-m",
+ "x86",
+ ]
+ } else if (current_cpu == "x64") {
+ _yasm_flags = [
+ "-fmacho64",
+ "-m",
+ "amd64",
+ ]
+ }
+} else if (is_posix) {
+ if (current_cpu == "x86") {
+ _yasm_flags = [
+ "-felf32",
+ "-m",
+ "x86",
+ ]
+ } else if (current_cpu == "x64") {
+ _yasm_flags = [
+ "-DPIC",
+ "-felf64",
+ "-m",
+ "amd64",
+ ]
+ }
+} else if (is_win) {
+ if (current_cpu == "x86") {
+ _yasm_flags = [
+ "-DPREFIX",
+ "-fwin32",
+ "-m",
+ "x86",
+ ]
+ } else if (current_cpu == "x64") {
+ _yasm_flags = [
+ "-fwin64",
+ "-m",
+ "amd64",
+ ]
+ }
+}
+
+if (is_win) {
+ asm_obj_extension = "obj"
+} else {
+ asm_obj_extension = "o"
+}
+
+template("yasm_assemble") {
+ assert(defined(invoker.sources), "Need sources defined for $target_name")
+
+ # Only depend on YASM on x86 systems. Force compilation of .asm files for
+ # ARM to fail.
+ assert(current_cpu == "x86" || current_cpu == "x64")
+
+ action_name = "${target_name}_action"
+ source_set_name = target_name
+
+ action_foreach(action_name) {
+ # Only the source set can depend on this.
+ visibility = [ ":$source_set_name" ]
+
+ script = "//third_party/yasm/run_yasm.py"
+ sources = invoker.sources
+
+ if (defined(invoker.inputs)) {
+ inputs = invoker.inputs
+ }
+
+ # Executable (first in the args). The binary might be in the root build dir
+ # (no cross-compiling) or in a toolchain-specific subdirectory of that
+ # (when cross-compiling).
+ yasm_label = "//third_party/yasm($host_toolchain)"
+ args = [ "./" + # Force current dir.
+ rebase_path(get_label_info(yasm_label, "root_out_dir") + "/yasm",
+ root_build_dir) ]
+
+ # Deps.
+ deps = [
+ yasm_label,
+ ]
+ if (defined(invoker.deps)) {
+ deps += invoker.deps
+ }
+
+ # Flags.
+ args += _yasm_flags
+ if (defined(invoker.yasm_flags)) {
+ args += invoker.yasm_flags
+ }
+
+ # User defined include dirs go first.
+ if (defined(invoker.include_dirs)) {
+ foreach(include, invoker.include_dirs) {
+ args += [ "-I" + rebase_path(include, root_build_dir) ]
+ }
+ }
+
+ # Default yasm include dirs. Make it match the native build (source root and
+ # root generated code directory).
+ # This goes to the end of include list.
+ args += [
+ "-I.",
+
+ # Using "//." will produce a relative path "../.." which looks better than
+ # "../../" which will result from using "//" as the base (although both
+ # work). This is because rebase_path will terminate the result in a
+ # slash if the input ends in a slash.
+ "-I" + rebase_path("//.", root_build_dir),
+ "-I" + rebase_path(root_gen_dir, root_build_dir),
+ ]
+
+ # Extra defines.
+ if (defined(invoker.defines)) {
+ foreach(def, invoker.defines) {
+ args += [ "-D$def" ]
+ }
+ }
+
+ # Output file.
+ outputs = [
+ "$target_out_dir/$source_set_name/{{source_name_part}}.o",
+ ]
+ args += [
+ "-o",
+ rebase_path(outputs[0], root_build_dir),
+ "{{source}}",
+ ]
+
+ # The wrapper script run_yasm will write the depfile to the same name as
+ # the output but with .d appended (like gcc will).
+ depfile = outputs[0] + ".d"
+ }
+
+ # Gather the .o files into a linkable thing. This doesn't actually link
+ # anything (a source set just compiles files to link later), but will pass
+ # the object files generated by the action up the dependency chain.
+ static_library(source_set_name) {
+ if (defined(invoker.visibility)) {
+ visibility = invoker.visibility
+ }
+
+ sources = get_target_outputs(":$action_name")
+
+ deps = [
+ ":$action_name",
+ ]
+ }
+}
diff --git a/chromium/third_party/pdfium/third_party/zlib_v128/adler32.c b/chromium/third_party/pdfium/third_party/zlib_v128/adler32.c
deleted file mode 100644
index 82a84ceed2b..00000000000
--- a/chromium/third_party/pdfium/third_party/zlib_v128/adler32.c
+++ /dev/null
@@ -1,179 +0,0 @@
-/* adler32.c -- compute the Adler-32 checksum of a data stream
- * Copyright (C) 1995-2011 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* @(#) $Id$ */
-
-#include "zutil.h"
-
-#define local static
-
-local uLong adler32_combine_ OF((uLong adler1, uLong adler2, z_off64_t len2));
-
-#define BASE 65521 /* largest prime smaller than 65536 */
-#define NMAX 5552
-/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */
-
-#define DO1(buf,i) {adler += (buf)[i]; sum2 += adler;}
-#define DO2(buf,i) DO1(buf,i); DO1(buf,i+1);
-#define DO4(buf,i) DO2(buf,i); DO2(buf,i+2);
-#define DO8(buf,i) DO4(buf,i); DO4(buf,i+4);
-#define DO16(buf) DO8(buf,0); DO8(buf,8);
-
-/* use NO_DIVIDE if your processor does not do division in hardware --
- try it both ways to see which is faster */
-#ifdef NO_DIVIDE
-/* note that this assumes BASE is 65521, where 65536 % 65521 == 15
- (thank you to John Reiser for pointing this out) */
-# define CHOP(a) \
- do { \
- unsigned long tmp = a >> 16; \
- a &= 0xffffUL; \
- a += (tmp << 4) - tmp; \
- } while (0)
-# define MOD28(a) \
- do { \
- CHOP(a); \
- if (a >= BASE) a -= BASE; \
- } while (0)
-# define MOD(a) \
- do { \
- CHOP(a); \
- MOD28(a); \
- } while (0)
-# define MOD63(a) \
- do { /* this assumes a is not negative */ \
- z_off64_t tmp = a >> 32; \
- a &= 0xffffffffL; \
- a += (tmp << 8) - (tmp << 5) + tmp; \
- tmp = a >> 16; \
- a &= 0xffffL; \
- a += (tmp << 4) - tmp; \
- tmp = a >> 16; \
- a &= 0xffffL; \
- a += (tmp << 4) - tmp; \
- if (a >= BASE) a -= BASE; \
- } while (0)
-#else
-# define MOD(a) a %= BASE
-# define MOD28(a) a %= BASE
-# define MOD63(a) a %= BASE
-#endif
-
-/* ========================================================================= */
-uLong ZEXPORT adler32(
- uLong adler,
- const Bytef *buf,
- uInt len)
-{
- unsigned long sum2;
- unsigned n;
-
- /* split Adler-32 into component sums */
- sum2 = (adler >> 16) & 0xffff;
- adler &= 0xffff;
-
- /* in case user likes doing a byte at a time, keep it fast */
- if (len == 1) {
- adler += buf[0];
- if (adler >= BASE)
- adler -= BASE;
- sum2 += adler;
- if (sum2 >= BASE)
- sum2 -= BASE;
- return adler | (sum2 << 16);
- }
-
- /* initial Adler-32 value (deferred check for len == 1 speed) */
- if (buf == Z_NULL)
- return 1L;
-
- /* in case short lengths are provided, keep it somewhat fast */
- if (len < 16) {
- while (len--) {
- adler += *buf++;
- sum2 += adler;
- }
- if (adler >= BASE)
- adler -= BASE;
- MOD28(sum2); /* only added so many BASE's */
- return adler | (sum2 << 16);
- }
-
- /* do length NMAX blocks -- requires just one modulo operation */
- while (len >= NMAX) {
- len -= NMAX;
- n = NMAX / 16; /* NMAX is divisible by 16 */
- do {
- DO16(buf); /* 16 sums unrolled */
- buf += 16;
- } while (--n);
- MOD(adler);
- MOD(sum2);
- }
-
- /* do remaining bytes (less than NMAX, still just one modulo) */
- if (len) { /* avoid modulos if none remaining */
- while (len >= 16) {
- len -= 16;
- DO16(buf);
- buf += 16;
- }
- while (len--) {
- adler += *buf++;
- sum2 += adler;
- }
- MOD(adler);
- MOD(sum2);
- }
-
- /* return recombined sums */
- return adler | (sum2 << 16);
-}
-
-/* ========================================================================= */
-local uLong adler32_combine_(
- uLong adler1,
- uLong adler2,
- z_off64_t len2)
-{
- unsigned long sum1;
- unsigned long sum2;
- unsigned rem;
-
- /* for negative len, return invalid adler32 as a clue for debugging */
- if (len2 < 0)
- return 0xffffffffUL;
-
- /* the derivation of this formula is left as an exercise for the reader */
- MOD63(len2); /* assumes len2 >= 0 */
- rem = (unsigned)len2;
- sum1 = adler1 & 0xffff;
- sum2 = rem * sum1;
- MOD(sum2);
- sum1 += (adler2 & 0xffff) + BASE - 1;
- sum2 += ((adler1 >> 16) & 0xffff) + ((adler2 >> 16) & 0xffff) + BASE - rem;
- if (sum1 >= BASE) sum1 -= BASE;
- if (sum1 >= BASE) sum1 -= BASE;
- if (sum2 >= (BASE << 1)) sum2 -= (BASE << 1);
- if (sum2 >= BASE) sum2 -= BASE;
- return sum1 | (sum2 << 16);
-}
-
-/* ========================================================================= */
-uLong ZEXPORT adler32_combine(
- uLong adler1,
- uLong adler2,
- z_off_t len2)
-{
- return adler32_combine_(adler1, adler2, len2);
-}
-
-uLong ZEXPORT adler32_combine64(
- uLong adler1,
- uLong adler2,
- z_off64_t len2)
-{
- return adler32_combine_(adler1, adler2, len2);
-}
diff --git a/chromium/third_party/pdfium/third_party/zlib_v128/compress.c b/chromium/third_party/pdfium/third_party/zlib_v128/compress.c
deleted file mode 100644
index 0314fbc61a3..00000000000
--- a/chromium/third_party/pdfium/third_party/zlib_v128/compress.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/* compress.c -- compress a memory buffer
- * Copyright (C) 1995-2005 Jean-loup Gailly.
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* @(#) $Id$ */
-
-#define ZLIB_INTERNAL
-#include "zlib.h"
-
-/* ===========================================================================
- Compresses the source buffer into the destination buffer. The level
- parameter has the same meaning as in deflateInit. sourceLen is the byte
- length of the source buffer. Upon entry, destLen is the total size of the
- destination buffer, which must be at least 0.1% larger than sourceLen plus
- 12 bytes. Upon exit, destLen is the actual size of the compressed buffer.
-
- compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
- memory, Z_BUF_ERROR if there was not enough room in the output buffer,
- Z_STREAM_ERROR if the level parameter is invalid.
-*/
-int ZEXPORT compress2 (
- Bytef *dest,
- uLongf *destLen,
- const Bytef *source,
- uLong sourceLen,
- int level)
-{
- z_stream stream;
- int err;
-
- stream.next_in = (z_const Bytef *)source;
- stream.avail_in = (uInt)sourceLen;
-#ifdef MAXSEG_64K
- /* Check for source > 64K on 16-bit machine: */
- if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR;
-#endif
- stream.next_out = dest;
- stream.avail_out = (uInt)*destLen;
- if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR;
-
- stream.zalloc = (alloc_func)0;
- stream.zfree = (free_func)0;
- stream.opaque = (voidpf)0;
-
- err = deflateInit(&stream, level);
- if (err != Z_OK) return err;
-
- err = deflate(&stream, Z_FINISH);
- if (err != Z_STREAM_END) {
- deflateEnd(&stream);
- return err == Z_OK ? Z_BUF_ERROR : err;
- }
- *destLen = stream.total_out;
-
- err = deflateEnd(&stream);
- return err;
-}
-
-/* ===========================================================================
- */
-int ZEXPORT compress (
- Bytef *dest,
- uLongf *destLen,
- const Bytef *source,
- uLong sourceLen)
-{
- return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION);
-}
-
-/* ===========================================================================
- If the default memLevel or windowBits for deflateInit() is changed, then
- this function needs to be updated.
- */
-uLong ZEXPORT compressBound (
- uLong sourceLen)
-{
- return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) +
- (sourceLen >> 25) + 13;
-}
diff --git a/chromium/third_party/pdfium/third_party/zlib_v128/crc32.c b/chromium/third_party/pdfium/third_party/zlib_v128/crc32.c
deleted file mode 100644
index f0072c94bf9..00000000000
--- a/chromium/third_party/pdfium/third_party/zlib_v128/crc32.c
+++ /dev/null
@@ -1,425 +0,0 @@
-/* crc32.c -- compute the CRC-32 of a data stream
- * Copyright (C) 1995-2006, 2010, 2011, 2012 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- *
- * Thanks to Rodney Brown <rbrown64@csc.com.au> for his contribution of faster
- * CRC methods: exclusive-oring 32 bits of data at a time, and pre-computing
- * tables for updating the shift register in one step with three exclusive-ors
- * instead of four steps with four exclusive-ors. This results in about a
- * factor of two increase in speed on a Power PC G4 (PPC7455) using gcc -O3.
- */
-
-/* @(#) $Id$ */
-
-/*
- Note on the use of DYNAMIC_CRC_TABLE: there is no mutex or semaphore
- protection on the static variables used to control the first-use generation
- of the crc tables. Therefore, if you #define DYNAMIC_CRC_TABLE, you should
- first call get_crc_table() to initialize the tables before allowing more than
- one thread to use crc32().
-
- DYNAMIC_CRC_TABLE and MAKECRCH can be #defined to write out crc32.h.
- */
-
-#ifdef MAKECRCH
-# include <stdio.h>
-# ifndef DYNAMIC_CRC_TABLE
-# define DYNAMIC_CRC_TABLE
-# endif /* !DYNAMIC_CRC_TABLE */
-#endif /* MAKECRCH */
-
-#include "zutil.h" /* for STDC and FAR definitions */
-
-#define local static
-
-/* Definitions for doing the crc four data bytes at a time. */
-#if !defined(NOBYFOUR) && defined(Z_U4)
-# define BYFOUR
-#endif
-#ifdef BYFOUR
- local unsigned long crc32_little OF((unsigned long,
- const unsigned char FAR *, unsigned));
- local unsigned long crc32_big OF((unsigned long,
- const unsigned char FAR *, unsigned));
-# define TBLS 8
-#else
-# define TBLS 1
-#endif /* BYFOUR */
-
-/* Local functions for crc concatenation */
-local unsigned long gf2_matrix_times OF((unsigned long *mat,
- unsigned long vec));
-local void gf2_matrix_square OF((unsigned long *square, unsigned long *mat));
-local uLong crc32_combine_ OF((uLong crc1, uLong crc2, z_off64_t len2));
-
-
-#ifdef DYNAMIC_CRC_TABLE
-
-local volatile int crc_table_empty = 1;
-local z_crc_t FAR crc_table[TBLS][256];
-local void make_crc_table OF((void));
-#ifdef MAKECRCH
- local void write_table OF((FILE *, const z_crc_t FAR *));
-#endif /* MAKECRCH */
-/*
- Generate tables for a byte-wise 32-bit CRC calculation on the polynomial:
- x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1.
-
- Polynomials over GF(2) are represented in binary, one bit per coefficient,
- with the lowest powers in the most significant bit. Then adding polynomials
- is just exclusive-or, and multiplying a polynomial by x is a right shift by
- one. If we call the above polynomial p, and represent a byte as the
- polynomial q, also with the lowest power in the most significant bit (so the
- byte 0xb1 is the polynomial x^7+x^3+x+1), then the CRC is (q*x^32) mod p,
- where a mod b means the remainder after dividing a by b.
-
- This calculation is done using the shift-register method of multiplying and
- taking the remainder. The register is initialized to zero, and for each
- incoming bit, x^32 is added mod p to the register if the bit is a one (where
- x^32 mod p is p+x^32 = x^26+...+1), and the register is multiplied mod p by
- x (which is shifting right by one and adding x^32 mod p if the bit shifted
- out is a one). We start with the highest power (least significant bit) of
- q and repeat for all eight bits of q.
-
- The first table is simply the CRC of all possible eight bit values. This is
- all the information needed to generate CRCs on data a byte at a time for all
- combinations of CRC register values and incoming bytes. The remaining tables
- allow for word-at-a-time CRC calculation for both big-endian and little-
- endian machines, where a word is four bytes.
-*/
-local void make_crc_table()
-{
- z_crc_t c;
- int n, k;
- z_crc_t poly; /* polynomial exclusive-or pattern */
- /* terms of polynomial defining this crc (except x^32): */
- static volatile int first = 1; /* flag to limit concurrent making */
- static const unsigned char p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26};
-
- /* See if another task is already doing this (not thread-safe, but better
- than nothing -- significantly reduces duration of vulnerability in
- case the advice about DYNAMIC_CRC_TABLE is ignored) */
- if (first) {
- first = 0;
-
- /* make exclusive-or pattern from polynomial (0xedb88320UL) */
- poly = 0;
- for (n = 0; n < (int)(sizeof(p)/sizeof(unsigned char)); n++)
- poly |= (z_crc_t)1 << (31 - p[n]);
-
- /* generate a crc for every 8-bit value */
- for (n = 0; n < 256; n++) {
- c = (z_crc_t)n;
- for (k = 0; k < 8; k++)
- c = c & 1 ? poly ^ (c >> 1) : c >> 1;
- crc_table[0][n] = c;
- }
-
-#ifdef BYFOUR
- /* generate crc for each value followed by one, two, and three zeros,
- and then the byte reversal of those as well as the first table */
- for (n = 0; n < 256; n++) {
- c = crc_table[0][n];
- crc_table[4][n] = ZSWAP32(c);
- for (k = 1; k < 4; k++) {
- c = crc_table[0][c & 0xff] ^ (c >> 8);
- crc_table[k][n] = c;
- crc_table[k + 4][n] = ZSWAP32(c);
- }
- }
-#endif /* BYFOUR */
-
- crc_table_empty = 0;
- }
- else { /* not first */
- /* wait for the other guy to finish (not efficient, but rare) */
- while (crc_table_empty)
- ;
- }
-
-#ifdef MAKECRCH
- /* write out CRC tables to crc32.h */
- {
- FILE *out;
-
- out = fopen("crc32.h", "w");
- if (out == NULL) return;
- fprintf(out, "/* crc32.h -- tables for rapid CRC calculation\n");
- fprintf(out, " * Generated automatically by crc32.c\n */\n\n");
- fprintf(out, "local const z_crc_t FAR ");
- fprintf(out, "crc_table[TBLS][256] =\n{\n {\n");
- write_table(out, crc_table[0]);
-# ifdef BYFOUR
- fprintf(out, "#ifdef BYFOUR\n");
- for (k = 1; k < 8; k++) {
- fprintf(out, " },\n {\n");
- write_table(out, crc_table[k]);
- }
- fprintf(out, "#endif\n");
-# endif /* BYFOUR */
- fprintf(out, " }\n};\n");
- fclose(out);
- }
-#endif /* MAKECRCH */
-}
-
-#ifdef MAKECRCH
-local void write_table(
- FILE *out,
- const z_crc_t FAR *table)
-{
- int n;
-
- for (n = 0; n < 256; n++)
- fprintf(out, "%s0x%08lxUL%s", n % 5 ? "" : " ",
- (unsigned long)(table[n]),
- n == 255 ? "\n" : (n % 5 == 4 ? ",\n" : ", "));
-}
-#endif /* MAKECRCH */
-
-#else /* !DYNAMIC_CRC_TABLE */
-/* ========================================================================
- * Tables of CRC-32s of all single-byte values, made by make_crc_table().
- */
-#include "crc32.h"
-#endif /* DYNAMIC_CRC_TABLE */
-
-/* =========================================================================
- * This function can be used by asm versions of crc32()
- */
-const z_crc_t FAR * ZEXPORT get_crc_table()
-{
-#ifdef DYNAMIC_CRC_TABLE
- if (crc_table_empty)
- make_crc_table();
-#endif /* DYNAMIC_CRC_TABLE */
- return (const z_crc_t FAR *)crc_table;
-}
-
-/* ========================================================================= */
-#define DO1 crc = crc_table[0][((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8)
-#define DO8 DO1; DO1; DO1; DO1; DO1; DO1; DO1; DO1
-
-/* ========================================================================= */
-unsigned long ZEXPORT crc32(
- unsigned long crc,
- const unsigned char FAR *buf,
- uInt len)
-{
- if (buf == Z_NULL) return 0UL;
-
-#ifdef DYNAMIC_CRC_TABLE
- if (crc_table_empty)
- make_crc_table();
-#endif /* DYNAMIC_CRC_TABLE */
-
-#ifdef BYFOUR
- if (sizeof(void *) == sizeof(ptrdiff_t)) {
- z_crc_t endian;
-
- endian = 1;
- if (*((unsigned char *)(&endian)))
- return crc32_little(crc, buf, len);
- else
- return crc32_big(crc, buf, len);
- }
-#endif /* BYFOUR */
- crc = crc ^ 0xffffffffUL;
- while (len >= 8) {
- DO8;
- len -= 8;
- }
- if (len) do {
- DO1;
- } while (--len);
- return crc ^ 0xffffffffUL;
-}
-
-#ifdef BYFOUR
-
-/* ========================================================================= */
-#define DOLIT4 c ^= *buf4++; \
- c = crc_table[3][c & 0xff] ^ crc_table[2][(c >> 8) & 0xff] ^ \
- crc_table[1][(c >> 16) & 0xff] ^ crc_table[0][c >> 24]
-#define DOLIT32 DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4
-
-/* ========================================================================= */
-local unsigned long crc32_little(
- unsigned long crc,
- const unsigned char FAR *buf,
- unsigned len)
-{
- register z_crc_t c;
- register const z_crc_t FAR *buf4;
-
- c = (z_crc_t)crc;
- c = ~c;
- while (len && ((ptrdiff_t)buf & 3)) {
- c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8);
- len--;
- }
-
- buf4 = (const z_crc_t FAR *)(const void FAR *)buf;
- while (len >= 32) {
- DOLIT32;
- len -= 32;
- }
- while (len >= 4) {
- DOLIT4;
- len -= 4;
- }
- buf = (const unsigned char FAR *)buf4;
-
- if (len) do {
- c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8);
- } while (--len);
- c = ~c;
- return (unsigned long)c;
-}
-
-/* ========================================================================= */
-#define DOBIG4 c ^= *++buf4; \
- c = crc_table[4][c & 0xff] ^ crc_table[5][(c >> 8) & 0xff] ^ \
- crc_table[6][(c >> 16) & 0xff] ^ crc_table[7][c >> 24]
-#define DOBIG32 DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4
-
-/* ========================================================================= */
-local unsigned long crc32_big(
- unsigned long crc,
- const unsigned char FAR *buf,
- unsigned len)
-{
- register z_crc_t c;
- register const z_crc_t FAR *buf4;
-
- c = ZSWAP32((z_crc_t)crc);
- c = ~c;
- while (len && ((ptrdiff_t)buf & 3)) {
- c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8);
- len--;
- }
-
- buf4 = (const z_crc_t FAR *)(const void FAR *)buf;
- buf4--;
- while (len >= 32) {
- DOBIG32;
- len -= 32;
- }
- while (len >= 4) {
- DOBIG4;
- len -= 4;
- }
- buf4++;
- buf = (const unsigned char FAR *)buf4;
-
- if (len) do {
- c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8);
- } while (--len);
- c = ~c;
- return (unsigned long)(ZSWAP32(c));
-}
-
-#endif /* BYFOUR */
-
-#define GF2_DIM 32 /* dimension of GF(2) vectors (length of CRC) */
-
-/* ========================================================================= */
-local unsigned long gf2_matrix_times(
- unsigned long *mat,
- unsigned long vec)
-{
- unsigned long sum;
-
- sum = 0;
- while (vec) {
- if (vec & 1)
- sum ^= *mat;
- vec >>= 1;
- mat++;
- }
- return sum;
-}
-
-/* ========================================================================= */
-local void gf2_matrix_square(
- unsigned long *square,
- unsigned long *mat)
-{
- int n;
-
- for (n = 0; n < GF2_DIM; n++)
- square[n] = gf2_matrix_times(mat, mat[n]);
-}
-
-/* ========================================================================= */
-local uLong crc32_combine_(
- uLong crc1,
- uLong crc2,
- z_off64_t len2)
-{
- int n;
- unsigned long row;
- unsigned long even[GF2_DIM]; /* even-power-of-two zeros operator */
- unsigned long odd[GF2_DIM]; /* odd-power-of-two zeros operator */
-
- /* degenerate case (also disallow negative lengths) */
- if (len2 <= 0)
- return crc1;
-
- /* put operator for one zero bit in odd */
- odd[0] = 0xedb88320UL; /* CRC-32 polynomial */
- row = 1;
- for (n = 1; n < GF2_DIM; n++) {
- odd[n] = row;
- row <<= 1;
- }
-
- /* put operator for two zero bits in even */
- gf2_matrix_square(even, odd);
-
- /* put operator for four zero bits in odd */
- gf2_matrix_square(odd, even);
-
- /* apply len2 zeros to crc1 (first square will put the operator for one
- zero byte, eight zero bits, in even) */
- do {
- /* apply zeros operator for this bit of len2 */
- gf2_matrix_square(even, odd);
- if (len2 & 1)
- crc1 = gf2_matrix_times(even, crc1);
- len2 >>= 1;
-
- /* if no more bits set, then done */
- if (len2 == 0)
- break;
-
- /* another iteration of the loop with odd and even swapped */
- gf2_matrix_square(odd, even);
- if (len2 & 1)
- crc1 = gf2_matrix_times(odd, crc1);
- len2 >>= 1;
-
- /* if no more bits set, then done */
- } while (len2 != 0);
-
- /* return combined crc */
- crc1 ^= crc2;
- return crc1;
-}
-
-/* ========================================================================= */
-uLong ZEXPORT crc32_combine(
- uLong crc1,
- uLong crc2,
- z_off_t len2)
-{
- return crc32_combine_(crc1, crc2, len2);
-}
-
-uLong ZEXPORT crc32_combine64(
- uLong crc1,
- uLong crc2,
- z_off64_t len2)
-{
- return crc32_combine_(crc1, crc2, len2);
-}
diff --git a/chromium/third_party/pdfium/third_party/zlib_v128/crc32.h b/chromium/third_party/pdfium/third_party/zlib_v128/crc32.h
deleted file mode 100644
index 9e0c7781025..00000000000
--- a/chromium/third_party/pdfium/third_party/zlib_v128/crc32.h
+++ /dev/null
@@ -1,441 +0,0 @@
-/* crc32.h -- tables for rapid CRC calculation
- * Generated automatically by crc32.c
- */
-
-local const z_crc_t FAR crc_table[TBLS][256] =
-{
- {
- 0x00000000UL, 0x77073096UL, 0xee0e612cUL, 0x990951baUL, 0x076dc419UL,
- 0x706af48fUL, 0xe963a535UL, 0x9e6495a3UL, 0x0edb8832UL, 0x79dcb8a4UL,
- 0xe0d5e91eUL, 0x97d2d988UL, 0x09b64c2bUL, 0x7eb17cbdUL, 0xe7b82d07UL,
- 0x90bf1d91UL, 0x1db71064UL, 0x6ab020f2UL, 0xf3b97148UL, 0x84be41deUL,
- 0x1adad47dUL, 0x6ddde4ebUL, 0xf4d4b551UL, 0x83d385c7UL, 0x136c9856UL,
- 0x646ba8c0UL, 0xfd62f97aUL, 0x8a65c9ecUL, 0x14015c4fUL, 0x63066cd9UL,
- 0xfa0f3d63UL, 0x8d080df5UL, 0x3b6e20c8UL, 0x4c69105eUL, 0xd56041e4UL,
- 0xa2677172UL, 0x3c03e4d1UL, 0x4b04d447UL, 0xd20d85fdUL, 0xa50ab56bUL,
- 0x35b5a8faUL, 0x42b2986cUL, 0xdbbbc9d6UL, 0xacbcf940UL, 0x32d86ce3UL,
- 0x45df5c75UL, 0xdcd60dcfUL, 0xabd13d59UL, 0x26d930acUL, 0x51de003aUL,
- 0xc8d75180UL, 0xbfd06116UL, 0x21b4f4b5UL, 0x56b3c423UL, 0xcfba9599UL,
- 0xb8bda50fUL, 0x2802b89eUL, 0x5f058808UL, 0xc60cd9b2UL, 0xb10be924UL,
- 0x2f6f7c87UL, 0x58684c11UL, 0xc1611dabUL, 0xb6662d3dUL, 0x76dc4190UL,
- 0x01db7106UL, 0x98d220bcUL, 0xefd5102aUL, 0x71b18589UL, 0x06b6b51fUL,
- 0x9fbfe4a5UL, 0xe8b8d433UL, 0x7807c9a2UL, 0x0f00f934UL, 0x9609a88eUL,
- 0xe10e9818UL, 0x7f6a0dbbUL, 0x086d3d2dUL, 0x91646c97UL, 0xe6635c01UL,
- 0x6b6b51f4UL, 0x1c6c6162UL, 0x856530d8UL, 0xf262004eUL, 0x6c0695edUL,
- 0x1b01a57bUL, 0x8208f4c1UL, 0xf50fc457UL, 0x65b0d9c6UL, 0x12b7e950UL,
- 0x8bbeb8eaUL, 0xfcb9887cUL, 0x62dd1ddfUL, 0x15da2d49UL, 0x8cd37cf3UL,
- 0xfbd44c65UL, 0x4db26158UL, 0x3ab551ceUL, 0xa3bc0074UL, 0xd4bb30e2UL,
- 0x4adfa541UL, 0x3dd895d7UL, 0xa4d1c46dUL, 0xd3d6f4fbUL, 0x4369e96aUL,
- 0x346ed9fcUL, 0xad678846UL, 0xda60b8d0UL, 0x44042d73UL, 0x33031de5UL,
- 0xaa0a4c5fUL, 0xdd0d7cc9UL, 0x5005713cUL, 0x270241aaUL, 0xbe0b1010UL,
- 0xc90c2086UL, 0x5768b525UL, 0x206f85b3UL, 0xb966d409UL, 0xce61e49fUL,
- 0x5edef90eUL, 0x29d9c998UL, 0xb0d09822UL, 0xc7d7a8b4UL, 0x59b33d17UL,
- 0x2eb40d81UL, 0xb7bd5c3bUL, 0xc0ba6cadUL, 0xedb88320UL, 0x9abfb3b6UL,
- 0x03b6e20cUL, 0x74b1d29aUL, 0xead54739UL, 0x9dd277afUL, 0x04db2615UL,
- 0x73dc1683UL, 0xe3630b12UL, 0x94643b84UL, 0x0d6d6a3eUL, 0x7a6a5aa8UL,
- 0xe40ecf0bUL, 0x9309ff9dUL, 0x0a00ae27UL, 0x7d079eb1UL, 0xf00f9344UL,
- 0x8708a3d2UL, 0x1e01f268UL, 0x6906c2feUL, 0xf762575dUL, 0x806567cbUL,
- 0x196c3671UL, 0x6e6b06e7UL, 0xfed41b76UL, 0x89d32be0UL, 0x10da7a5aUL,
- 0x67dd4accUL, 0xf9b9df6fUL, 0x8ebeeff9UL, 0x17b7be43UL, 0x60b08ed5UL,
- 0xd6d6a3e8UL, 0xa1d1937eUL, 0x38d8c2c4UL, 0x4fdff252UL, 0xd1bb67f1UL,
- 0xa6bc5767UL, 0x3fb506ddUL, 0x48b2364bUL, 0xd80d2bdaUL, 0xaf0a1b4cUL,
- 0x36034af6UL, 0x41047a60UL, 0xdf60efc3UL, 0xa867df55UL, 0x316e8eefUL,
- 0x4669be79UL, 0xcb61b38cUL, 0xbc66831aUL, 0x256fd2a0UL, 0x5268e236UL,
- 0xcc0c7795UL, 0xbb0b4703UL, 0x220216b9UL, 0x5505262fUL, 0xc5ba3bbeUL,
- 0xb2bd0b28UL, 0x2bb45a92UL, 0x5cb36a04UL, 0xc2d7ffa7UL, 0xb5d0cf31UL,
- 0x2cd99e8bUL, 0x5bdeae1dUL, 0x9b64c2b0UL, 0xec63f226UL, 0x756aa39cUL,
- 0x026d930aUL, 0x9c0906a9UL, 0xeb0e363fUL, 0x72076785UL, 0x05005713UL,
- 0x95bf4a82UL, 0xe2b87a14UL, 0x7bb12baeUL, 0x0cb61b38UL, 0x92d28e9bUL,
- 0xe5d5be0dUL, 0x7cdcefb7UL, 0x0bdbdf21UL, 0x86d3d2d4UL, 0xf1d4e242UL,
- 0x68ddb3f8UL, 0x1fda836eUL, 0x81be16cdUL, 0xf6b9265bUL, 0x6fb077e1UL,
- 0x18b74777UL, 0x88085ae6UL, 0xff0f6a70UL, 0x66063bcaUL, 0x11010b5cUL,
- 0x8f659effUL, 0xf862ae69UL, 0x616bffd3UL, 0x166ccf45UL, 0xa00ae278UL,
- 0xd70dd2eeUL, 0x4e048354UL, 0x3903b3c2UL, 0xa7672661UL, 0xd06016f7UL,
- 0x4969474dUL, 0x3e6e77dbUL, 0xaed16a4aUL, 0xd9d65adcUL, 0x40df0b66UL,
- 0x37d83bf0UL, 0xa9bcae53UL, 0xdebb9ec5UL, 0x47b2cf7fUL, 0x30b5ffe9UL,
- 0xbdbdf21cUL, 0xcabac28aUL, 0x53b39330UL, 0x24b4a3a6UL, 0xbad03605UL,
- 0xcdd70693UL, 0x54de5729UL, 0x23d967bfUL, 0xb3667a2eUL, 0xc4614ab8UL,
- 0x5d681b02UL, 0x2a6f2b94UL, 0xb40bbe37UL, 0xc30c8ea1UL, 0x5a05df1bUL,
- 0x2d02ef8dUL
-#ifdef BYFOUR
- },
- {
- 0x00000000UL, 0x191b3141UL, 0x32366282UL, 0x2b2d53c3UL, 0x646cc504UL,
- 0x7d77f445UL, 0x565aa786UL, 0x4f4196c7UL, 0xc8d98a08UL, 0xd1c2bb49UL,
- 0xfaefe88aUL, 0xe3f4d9cbUL, 0xacb54f0cUL, 0xb5ae7e4dUL, 0x9e832d8eUL,
- 0x87981ccfUL, 0x4ac21251UL, 0x53d92310UL, 0x78f470d3UL, 0x61ef4192UL,
- 0x2eaed755UL, 0x37b5e614UL, 0x1c98b5d7UL, 0x05838496UL, 0x821b9859UL,
- 0x9b00a918UL, 0xb02dfadbUL, 0xa936cb9aUL, 0xe6775d5dUL, 0xff6c6c1cUL,
- 0xd4413fdfUL, 0xcd5a0e9eUL, 0x958424a2UL, 0x8c9f15e3UL, 0xa7b24620UL,
- 0xbea97761UL, 0xf1e8e1a6UL, 0xe8f3d0e7UL, 0xc3de8324UL, 0xdac5b265UL,
- 0x5d5daeaaUL, 0x44469febUL, 0x6f6bcc28UL, 0x7670fd69UL, 0x39316baeUL,
- 0x202a5aefUL, 0x0b07092cUL, 0x121c386dUL, 0xdf4636f3UL, 0xc65d07b2UL,
- 0xed705471UL, 0xf46b6530UL, 0xbb2af3f7UL, 0xa231c2b6UL, 0x891c9175UL,
- 0x9007a034UL, 0x179fbcfbUL, 0x0e848dbaUL, 0x25a9de79UL, 0x3cb2ef38UL,
- 0x73f379ffUL, 0x6ae848beUL, 0x41c51b7dUL, 0x58de2a3cUL, 0xf0794f05UL,
- 0xe9627e44UL, 0xc24f2d87UL, 0xdb541cc6UL, 0x94158a01UL, 0x8d0ebb40UL,
- 0xa623e883UL, 0xbf38d9c2UL, 0x38a0c50dUL, 0x21bbf44cUL, 0x0a96a78fUL,
- 0x138d96ceUL, 0x5ccc0009UL, 0x45d73148UL, 0x6efa628bUL, 0x77e153caUL,
- 0xbabb5d54UL, 0xa3a06c15UL, 0x888d3fd6UL, 0x91960e97UL, 0xded79850UL,
- 0xc7cca911UL, 0xece1fad2UL, 0xf5facb93UL, 0x7262d75cUL, 0x6b79e61dUL,
- 0x4054b5deUL, 0x594f849fUL, 0x160e1258UL, 0x0f152319UL, 0x243870daUL,
- 0x3d23419bUL, 0x65fd6ba7UL, 0x7ce65ae6UL, 0x57cb0925UL, 0x4ed03864UL,
- 0x0191aea3UL, 0x188a9fe2UL, 0x33a7cc21UL, 0x2abcfd60UL, 0xad24e1afUL,
- 0xb43fd0eeUL, 0x9f12832dUL, 0x8609b26cUL, 0xc94824abUL, 0xd05315eaUL,
- 0xfb7e4629UL, 0xe2657768UL, 0x2f3f79f6UL, 0x362448b7UL, 0x1d091b74UL,
- 0x04122a35UL, 0x4b53bcf2UL, 0x52488db3UL, 0x7965de70UL, 0x607eef31UL,
- 0xe7e6f3feUL, 0xfefdc2bfUL, 0xd5d0917cUL, 0xcccba03dUL, 0x838a36faUL,
- 0x9a9107bbUL, 0xb1bc5478UL, 0xa8a76539UL, 0x3b83984bUL, 0x2298a90aUL,
- 0x09b5fac9UL, 0x10aecb88UL, 0x5fef5d4fUL, 0x46f46c0eUL, 0x6dd93fcdUL,
- 0x74c20e8cUL, 0xf35a1243UL, 0xea412302UL, 0xc16c70c1UL, 0xd8774180UL,
- 0x9736d747UL, 0x8e2de606UL, 0xa500b5c5UL, 0xbc1b8484UL, 0x71418a1aUL,
- 0x685abb5bUL, 0x4377e898UL, 0x5a6cd9d9UL, 0x152d4f1eUL, 0x0c367e5fUL,
- 0x271b2d9cUL, 0x3e001cddUL, 0xb9980012UL, 0xa0833153UL, 0x8bae6290UL,
- 0x92b553d1UL, 0xddf4c516UL, 0xc4eff457UL, 0xefc2a794UL, 0xf6d996d5UL,
- 0xae07bce9UL, 0xb71c8da8UL, 0x9c31de6bUL, 0x852aef2aUL, 0xca6b79edUL,
- 0xd37048acUL, 0xf85d1b6fUL, 0xe1462a2eUL, 0x66de36e1UL, 0x7fc507a0UL,
- 0x54e85463UL, 0x4df36522UL, 0x02b2f3e5UL, 0x1ba9c2a4UL, 0x30849167UL,
- 0x299fa026UL, 0xe4c5aeb8UL, 0xfdde9ff9UL, 0xd6f3cc3aUL, 0xcfe8fd7bUL,
- 0x80a96bbcUL, 0x99b25afdUL, 0xb29f093eUL, 0xab84387fUL, 0x2c1c24b0UL,
- 0x350715f1UL, 0x1e2a4632UL, 0x07317773UL, 0x4870e1b4UL, 0x516bd0f5UL,
- 0x7a468336UL, 0x635db277UL, 0xcbfad74eUL, 0xd2e1e60fUL, 0xf9ccb5ccUL,
- 0xe0d7848dUL, 0xaf96124aUL, 0xb68d230bUL, 0x9da070c8UL, 0x84bb4189UL,
- 0x03235d46UL, 0x1a386c07UL, 0x31153fc4UL, 0x280e0e85UL, 0x674f9842UL,
- 0x7e54a903UL, 0x5579fac0UL, 0x4c62cb81UL, 0x8138c51fUL, 0x9823f45eUL,
- 0xb30ea79dUL, 0xaa1596dcUL, 0xe554001bUL, 0xfc4f315aUL, 0xd7626299UL,
- 0xce7953d8UL, 0x49e14f17UL, 0x50fa7e56UL, 0x7bd72d95UL, 0x62cc1cd4UL,
- 0x2d8d8a13UL, 0x3496bb52UL, 0x1fbbe891UL, 0x06a0d9d0UL, 0x5e7ef3ecUL,
- 0x4765c2adUL, 0x6c48916eUL, 0x7553a02fUL, 0x3a1236e8UL, 0x230907a9UL,
- 0x0824546aUL, 0x113f652bUL, 0x96a779e4UL, 0x8fbc48a5UL, 0xa4911b66UL,
- 0xbd8a2a27UL, 0xf2cbbce0UL, 0xebd08da1UL, 0xc0fdde62UL, 0xd9e6ef23UL,
- 0x14bce1bdUL, 0x0da7d0fcUL, 0x268a833fUL, 0x3f91b27eUL, 0x70d024b9UL,
- 0x69cb15f8UL, 0x42e6463bUL, 0x5bfd777aUL, 0xdc656bb5UL, 0xc57e5af4UL,
- 0xee530937UL, 0xf7483876UL, 0xb809aeb1UL, 0xa1129ff0UL, 0x8a3fcc33UL,
- 0x9324fd72UL
- },
- {
- 0x00000000UL, 0x01c26a37UL, 0x0384d46eUL, 0x0246be59UL, 0x0709a8dcUL,
- 0x06cbc2ebUL, 0x048d7cb2UL, 0x054f1685UL, 0x0e1351b8UL, 0x0fd13b8fUL,
- 0x0d9785d6UL, 0x0c55efe1UL, 0x091af964UL, 0x08d89353UL, 0x0a9e2d0aUL,
- 0x0b5c473dUL, 0x1c26a370UL, 0x1de4c947UL, 0x1fa2771eUL, 0x1e601d29UL,
- 0x1b2f0bacUL, 0x1aed619bUL, 0x18abdfc2UL, 0x1969b5f5UL, 0x1235f2c8UL,
- 0x13f798ffUL, 0x11b126a6UL, 0x10734c91UL, 0x153c5a14UL, 0x14fe3023UL,
- 0x16b88e7aUL, 0x177ae44dUL, 0x384d46e0UL, 0x398f2cd7UL, 0x3bc9928eUL,
- 0x3a0bf8b9UL, 0x3f44ee3cUL, 0x3e86840bUL, 0x3cc03a52UL, 0x3d025065UL,
- 0x365e1758UL, 0x379c7d6fUL, 0x35dac336UL, 0x3418a901UL, 0x3157bf84UL,
- 0x3095d5b3UL, 0x32d36beaUL, 0x331101ddUL, 0x246be590UL, 0x25a98fa7UL,
- 0x27ef31feUL, 0x262d5bc9UL, 0x23624d4cUL, 0x22a0277bUL, 0x20e69922UL,
- 0x2124f315UL, 0x2a78b428UL, 0x2bbade1fUL, 0x29fc6046UL, 0x283e0a71UL,
- 0x2d711cf4UL, 0x2cb376c3UL, 0x2ef5c89aUL, 0x2f37a2adUL, 0x709a8dc0UL,
- 0x7158e7f7UL, 0x731e59aeUL, 0x72dc3399UL, 0x7793251cUL, 0x76514f2bUL,
- 0x7417f172UL, 0x75d59b45UL, 0x7e89dc78UL, 0x7f4bb64fUL, 0x7d0d0816UL,
- 0x7ccf6221UL, 0x798074a4UL, 0x78421e93UL, 0x7a04a0caUL, 0x7bc6cafdUL,
- 0x6cbc2eb0UL, 0x6d7e4487UL, 0x6f38fadeUL, 0x6efa90e9UL, 0x6bb5866cUL,
- 0x6a77ec5bUL, 0x68315202UL, 0x69f33835UL, 0x62af7f08UL, 0x636d153fUL,
- 0x612bab66UL, 0x60e9c151UL, 0x65a6d7d4UL, 0x6464bde3UL, 0x662203baUL,
- 0x67e0698dUL, 0x48d7cb20UL, 0x4915a117UL, 0x4b531f4eUL, 0x4a917579UL,
- 0x4fde63fcUL, 0x4e1c09cbUL, 0x4c5ab792UL, 0x4d98dda5UL, 0x46c49a98UL,
- 0x4706f0afUL, 0x45404ef6UL, 0x448224c1UL, 0x41cd3244UL, 0x400f5873UL,
- 0x4249e62aUL, 0x438b8c1dUL, 0x54f16850UL, 0x55330267UL, 0x5775bc3eUL,
- 0x56b7d609UL, 0x53f8c08cUL, 0x523aaabbUL, 0x507c14e2UL, 0x51be7ed5UL,
- 0x5ae239e8UL, 0x5b2053dfUL, 0x5966ed86UL, 0x58a487b1UL, 0x5deb9134UL,
- 0x5c29fb03UL, 0x5e6f455aUL, 0x5fad2f6dUL, 0xe1351b80UL, 0xe0f771b7UL,
- 0xe2b1cfeeUL, 0xe373a5d9UL, 0xe63cb35cUL, 0xe7fed96bUL, 0xe5b86732UL,
- 0xe47a0d05UL, 0xef264a38UL, 0xeee4200fUL, 0xeca29e56UL, 0xed60f461UL,
- 0xe82fe2e4UL, 0xe9ed88d3UL, 0xebab368aUL, 0xea695cbdUL, 0xfd13b8f0UL,
- 0xfcd1d2c7UL, 0xfe976c9eUL, 0xff5506a9UL, 0xfa1a102cUL, 0xfbd87a1bUL,
- 0xf99ec442UL, 0xf85cae75UL, 0xf300e948UL, 0xf2c2837fUL, 0xf0843d26UL,
- 0xf1465711UL, 0xf4094194UL, 0xf5cb2ba3UL, 0xf78d95faUL, 0xf64fffcdUL,
- 0xd9785d60UL, 0xd8ba3757UL, 0xdafc890eUL, 0xdb3ee339UL, 0xde71f5bcUL,
- 0xdfb39f8bUL, 0xddf521d2UL, 0xdc374be5UL, 0xd76b0cd8UL, 0xd6a966efUL,
- 0xd4efd8b6UL, 0xd52db281UL, 0xd062a404UL, 0xd1a0ce33UL, 0xd3e6706aUL,
- 0xd2241a5dUL, 0xc55efe10UL, 0xc49c9427UL, 0xc6da2a7eUL, 0xc7184049UL,
- 0xc25756ccUL, 0xc3953cfbUL, 0xc1d382a2UL, 0xc011e895UL, 0xcb4dafa8UL,
- 0xca8fc59fUL, 0xc8c97bc6UL, 0xc90b11f1UL, 0xcc440774UL, 0xcd866d43UL,
- 0xcfc0d31aUL, 0xce02b92dUL, 0x91af9640UL, 0x906dfc77UL, 0x922b422eUL,
- 0x93e92819UL, 0x96a63e9cUL, 0x976454abUL, 0x9522eaf2UL, 0x94e080c5UL,
- 0x9fbcc7f8UL, 0x9e7eadcfUL, 0x9c381396UL, 0x9dfa79a1UL, 0x98b56f24UL,
- 0x99770513UL, 0x9b31bb4aUL, 0x9af3d17dUL, 0x8d893530UL, 0x8c4b5f07UL,
- 0x8e0de15eUL, 0x8fcf8b69UL, 0x8a809decUL, 0x8b42f7dbUL, 0x89044982UL,
- 0x88c623b5UL, 0x839a6488UL, 0x82580ebfUL, 0x801eb0e6UL, 0x81dcdad1UL,
- 0x8493cc54UL, 0x8551a663UL, 0x8717183aUL, 0x86d5720dUL, 0xa9e2d0a0UL,
- 0xa820ba97UL, 0xaa6604ceUL, 0xaba46ef9UL, 0xaeeb787cUL, 0xaf29124bUL,
- 0xad6fac12UL, 0xacadc625UL, 0xa7f18118UL, 0xa633eb2fUL, 0xa4755576UL,
- 0xa5b73f41UL, 0xa0f829c4UL, 0xa13a43f3UL, 0xa37cfdaaUL, 0xa2be979dUL,
- 0xb5c473d0UL, 0xb40619e7UL, 0xb640a7beUL, 0xb782cd89UL, 0xb2cddb0cUL,
- 0xb30fb13bUL, 0xb1490f62UL, 0xb08b6555UL, 0xbbd72268UL, 0xba15485fUL,
- 0xb853f606UL, 0xb9919c31UL, 0xbcde8ab4UL, 0xbd1ce083UL, 0xbf5a5edaUL,
- 0xbe9834edUL
- },
- {
- 0x00000000UL, 0xb8bc6765UL, 0xaa09c88bUL, 0x12b5afeeUL, 0x8f629757UL,
- 0x37def032UL, 0x256b5fdcUL, 0x9dd738b9UL, 0xc5b428efUL, 0x7d084f8aUL,
- 0x6fbde064UL, 0xd7018701UL, 0x4ad6bfb8UL, 0xf26ad8ddUL, 0xe0df7733UL,
- 0x58631056UL, 0x5019579fUL, 0xe8a530faUL, 0xfa109f14UL, 0x42acf871UL,
- 0xdf7bc0c8UL, 0x67c7a7adUL, 0x75720843UL, 0xcdce6f26UL, 0x95ad7f70UL,
- 0x2d111815UL, 0x3fa4b7fbUL, 0x8718d09eUL, 0x1acfe827UL, 0xa2738f42UL,
- 0xb0c620acUL, 0x087a47c9UL, 0xa032af3eUL, 0x188ec85bUL, 0x0a3b67b5UL,
- 0xb28700d0UL, 0x2f503869UL, 0x97ec5f0cUL, 0x8559f0e2UL, 0x3de59787UL,
- 0x658687d1UL, 0xdd3ae0b4UL, 0xcf8f4f5aUL, 0x7733283fUL, 0xeae41086UL,
- 0x525877e3UL, 0x40edd80dUL, 0xf851bf68UL, 0xf02bf8a1UL, 0x48979fc4UL,
- 0x5a22302aUL, 0xe29e574fUL, 0x7f496ff6UL, 0xc7f50893UL, 0xd540a77dUL,
- 0x6dfcc018UL, 0x359fd04eUL, 0x8d23b72bUL, 0x9f9618c5UL, 0x272a7fa0UL,
- 0xbafd4719UL, 0x0241207cUL, 0x10f48f92UL, 0xa848e8f7UL, 0x9b14583dUL,
- 0x23a83f58UL, 0x311d90b6UL, 0x89a1f7d3UL, 0x1476cf6aUL, 0xaccaa80fUL,
- 0xbe7f07e1UL, 0x06c36084UL, 0x5ea070d2UL, 0xe61c17b7UL, 0xf4a9b859UL,
- 0x4c15df3cUL, 0xd1c2e785UL, 0x697e80e0UL, 0x7bcb2f0eUL, 0xc377486bUL,
- 0xcb0d0fa2UL, 0x73b168c7UL, 0x6104c729UL, 0xd9b8a04cUL, 0x446f98f5UL,
- 0xfcd3ff90UL, 0xee66507eUL, 0x56da371bUL, 0x0eb9274dUL, 0xb6054028UL,
- 0xa4b0efc6UL, 0x1c0c88a3UL, 0x81dbb01aUL, 0x3967d77fUL, 0x2bd27891UL,
- 0x936e1ff4UL, 0x3b26f703UL, 0x839a9066UL, 0x912f3f88UL, 0x299358edUL,
- 0xb4446054UL, 0x0cf80731UL, 0x1e4da8dfUL, 0xa6f1cfbaUL, 0xfe92dfecUL,
- 0x462eb889UL, 0x549b1767UL, 0xec277002UL, 0x71f048bbUL, 0xc94c2fdeUL,
- 0xdbf98030UL, 0x6345e755UL, 0x6b3fa09cUL, 0xd383c7f9UL, 0xc1366817UL,
- 0x798a0f72UL, 0xe45d37cbUL, 0x5ce150aeUL, 0x4e54ff40UL, 0xf6e89825UL,
- 0xae8b8873UL, 0x1637ef16UL, 0x048240f8UL, 0xbc3e279dUL, 0x21e91f24UL,
- 0x99557841UL, 0x8be0d7afUL, 0x335cb0caUL, 0xed59b63bUL, 0x55e5d15eUL,
- 0x47507eb0UL, 0xffec19d5UL, 0x623b216cUL, 0xda874609UL, 0xc832e9e7UL,
- 0x708e8e82UL, 0x28ed9ed4UL, 0x9051f9b1UL, 0x82e4565fUL, 0x3a58313aUL,
- 0xa78f0983UL, 0x1f336ee6UL, 0x0d86c108UL, 0xb53aa66dUL, 0xbd40e1a4UL,
- 0x05fc86c1UL, 0x1749292fUL, 0xaff54e4aUL, 0x322276f3UL, 0x8a9e1196UL,
- 0x982bbe78UL, 0x2097d91dUL, 0x78f4c94bUL, 0xc048ae2eUL, 0xd2fd01c0UL,
- 0x6a4166a5UL, 0xf7965e1cUL, 0x4f2a3979UL, 0x5d9f9697UL, 0xe523f1f2UL,
- 0x4d6b1905UL, 0xf5d77e60UL, 0xe762d18eUL, 0x5fdeb6ebUL, 0xc2098e52UL,
- 0x7ab5e937UL, 0x680046d9UL, 0xd0bc21bcUL, 0x88df31eaUL, 0x3063568fUL,
- 0x22d6f961UL, 0x9a6a9e04UL, 0x07bda6bdUL, 0xbf01c1d8UL, 0xadb46e36UL,
- 0x15080953UL, 0x1d724e9aUL, 0xa5ce29ffUL, 0xb77b8611UL, 0x0fc7e174UL,
- 0x9210d9cdUL, 0x2aacbea8UL, 0x38191146UL, 0x80a57623UL, 0xd8c66675UL,
- 0x607a0110UL, 0x72cfaefeUL, 0xca73c99bUL, 0x57a4f122UL, 0xef189647UL,
- 0xfdad39a9UL, 0x45115eccUL, 0x764dee06UL, 0xcef18963UL, 0xdc44268dUL,
- 0x64f841e8UL, 0xf92f7951UL, 0x41931e34UL, 0x5326b1daUL, 0xeb9ad6bfUL,
- 0xb3f9c6e9UL, 0x0b45a18cUL, 0x19f00e62UL, 0xa14c6907UL, 0x3c9b51beUL,
- 0x842736dbUL, 0x96929935UL, 0x2e2efe50UL, 0x2654b999UL, 0x9ee8defcUL,
- 0x8c5d7112UL, 0x34e11677UL, 0xa9362eceUL, 0x118a49abUL, 0x033fe645UL,
- 0xbb838120UL, 0xe3e09176UL, 0x5b5cf613UL, 0x49e959fdUL, 0xf1553e98UL,
- 0x6c820621UL, 0xd43e6144UL, 0xc68bceaaUL, 0x7e37a9cfUL, 0xd67f4138UL,
- 0x6ec3265dUL, 0x7c7689b3UL, 0xc4caeed6UL, 0x591dd66fUL, 0xe1a1b10aUL,
- 0xf3141ee4UL, 0x4ba87981UL, 0x13cb69d7UL, 0xab770eb2UL, 0xb9c2a15cUL,
- 0x017ec639UL, 0x9ca9fe80UL, 0x241599e5UL, 0x36a0360bUL, 0x8e1c516eUL,
- 0x866616a7UL, 0x3eda71c2UL, 0x2c6fde2cUL, 0x94d3b949UL, 0x090481f0UL,
- 0xb1b8e695UL, 0xa30d497bUL, 0x1bb12e1eUL, 0x43d23e48UL, 0xfb6e592dUL,
- 0xe9dbf6c3UL, 0x516791a6UL, 0xccb0a91fUL, 0x740cce7aUL, 0x66b96194UL,
- 0xde0506f1UL
- },
- {
- 0x00000000UL, 0x96300777UL, 0x2c610eeeUL, 0xba510999UL, 0x19c46d07UL,
- 0x8ff46a70UL, 0x35a563e9UL, 0xa395649eUL, 0x3288db0eUL, 0xa4b8dc79UL,
- 0x1ee9d5e0UL, 0x88d9d297UL, 0x2b4cb609UL, 0xbd7cb17eUL, 0x072db8e7UL,
- 0x911dbf90UL, 0x6410b71dUL, 0xf220b06aUL, 0x4871b9f3UL, 0xde41be84UL,
- 0x7dd4da1aUL, 0xebe4dd6dUL, 0x51b5d4f4UL, 0xc785d383UL, 0x56986c13UL,
- 0xc0a86b64UL, 0x7af962fdUL, 0xecc9658aUL, 0x4f5c0114UL, 0xd96c0663UL,
- 0x633d0ffaUL, 0xf50d088dUL, 0xc8206e3bUL, 0x5e10694cUL, 0xe44160d5UL,
- 0x727167a2UL, 0xd1e4033cUL, 0x47d4044bUL, 0xfd850dd2UL, 0x6bb50aa5UL,
- 0xfaa8b535UL, 0x6c98b242UL, 0xd6c9bbdbUL, 0x40f9bcacUL, 0xe36cd832UL,
- 0x755cdf45UL, 0xcf0dd6dcUL, 0x593dd1abUL, 0xac30d926UL, 0x3a00de51UL,
- 0x8051d7c8UL, 0x1661d0bfUL, 0xb5f4b421UL, 0x23c4b356UL, 0x9995bacfUL,
- 0x0fa5bdb8UL, 0x9eb80228UL, 0x0888055fUL, 0xb2d90cc6UL, 0x24e90bb1UL,
- 0x877c6f2fUL, 0x114c6858UL, 0xab1d61c1UL, 0x3d2d66b6UL, 0x9041dc76UL,
- 0x0671db01UL, 0xbc20d298UL, 0x2a10d5efUL, 0x8985b171UL, 0x1fb5b606UL,
- 0xa5e4bf9fUL, 0x33d4b8e8UL, 0xa2c90778UL, 0x34f9000fUL, 0x8ea80996UL,
- 0x18980ee1UL, 0xbb0d6a7fUL, 0x2d3d6d08UL, 0x976c6491UL, 0x015c63e6UL,
- 0xf4516b6bUL, 0x62616c1cUL, 0xd8306585UL, 0x4e0062f2UL, 0xed95066cUL,
- 0x7ba5011bUL, 0xc1f40882UL, 0x57c40ff5UL, 0xc6d9b065UL, 0x50e9b712UL,
- 0xeab8be8bUL, 0x7c88b9fcUL, 0xdf1ddd62UL, 0x492dda15UL, 0xf37cd38cUL,
- 0x654cd4fbUL, 0x5861b24dUL, 0xce51b53aUL, 0x7400bca3UL, 0xe230bbd4UL,
- 0x41a5df4aUL, 0xd795d83dUL, 0x6dc4d1a4UL, 0xfbf4d6d3UL, 0x6ae96943UL,
- 0xfcd96e34UL, 0x468867adUL, 0xd0b860daUL, 0x732d0444UL, 0xe51d0333UL,
- 0x5f4c0aaaUL, 0xc97c0dddUL, 0x3c710550UL, 0xaa410227UL, 0x10100bbeUL,
- 0x86200cc9UL, 0x25b56857UL, 0xb3856f20UL, 0x09d466b9UL, 0x9fe461ceUL,
- 0x0ef9de5eUL, 0x98c9d929UL, 0x2298d0b0UL, 0xb4a8d7c7UL, 0x173db359UL,
- 0x810db42eUL, 0x3b5cbdb7UL, 0xad6cbac0UL, 0x2083b8edUL, 0xb6b3bf9aUL,
- 0x0ce2b603UL, 0x9ad2b174UL, 0x3947d5eaUL, 0xaf77d29dUL, 0x1526db04UL,
- 0x8316dc73UL, 0x120b63e3UL, 0x843b6494UL, 0x3e6a6d0dUL, 0xa85a6a7aUL,
- 0x0bcf0ee4UL, 0x9dff0993UL, 0x27ae000aUL, 0xb19e077dUL, 0x44930ff0UL,
- 0xd2a30887UL, 0x68f2011eUL, 0xfec20669UL, 0x5d5762f7UL, 0xcb676580UL,
- 0x71366c19UL, 0xe7066b6eUL, 0x761bd4feUL, 0xe02bd389UL, 0x5a7ada10UL,
- 0xcc4add67UL, 0x6fdfb9f9UL, 0xf9efbe8eUL, 0x43beb717UL, 0xd58eb060UL,
- 0xe8a3d6d6UL, 0x7e93d1a1UL, 0xc4c2d838UL, 0x52f2df4fUL, 0xf167bbd1UL,
- 0x6757bca6UL, 0xdd06b53fUL, 0x4b36b248UL, 0xda2b0dd8UL, 0x4c1b0aafUL,
- 0xf64a0336UL, 0x607a0441UL, 0xc3ef60dfUL, 0x55df67a8UL, 0xef8e6e31UL,
- 0x79be6946UL, 0x8cb361cbUL, 0x1a8366bcUL, 0xa0d26f25UL, 0x36e26852UL,
- 0x95770cccUL, 0x03470bbbUL, 0xb9160222UL, 0x2f260555UL, 0xbe3bbac5UL,
- 0x280bbdb2UL, 0x925ab42bUL, 0x046ab35cUL, 0xa7ffd7c2UL, 0x31cfd0b5UL,
- 0x8b9ed92cUL, 0x1daede5bUL, 0xb0c2649bUL, 0x26f263ecUL, 0x9ca36a75UL,
- 0x0a936d02UL, 0xa906099cUL, 0x3f360eebUL, 0x85670772UL, 0x13570005UL,
- 0x824abf95UL, 0x147ab8e2UL, 0xae2bb17bUL, 0x381bb60cUL, 0x9b8ed292UL,
- 0x0dbed5e5UL, 0xb7efdc7cUL, 0x21dfdb0bUL, 0xd4d2d386UL, 0x42e2d4f1UL,
- 0xf8b3dd68UL, 0x6e83da1fUL, 0xcd16be81UL, 0x5b26b9f6UL, 0xe177b06fUL,
- 0x7747b718UL, 0xe65a0888UL, 0x706a0fffUL, 0xca3b0666UL, 0x5c0b0111UL,
- 0xff9e658fUL, 0x69ae62f8UL, 0xd3ff6b61UL, 0x45cf6c16UL, 0x78e20aa0UL,
- 0xeed20dd7UL, 0x5483044eUL, 0xc2b30339UL, 0x612667a7UL, 0xf71660d0UL,
- 0x4d476949UL, 0xdb776e3eUL, 0x4a6ad1aeUL, 0xdc5ad6d9UL, 0x660bdf40UL,
- 0xf03bd837UL, 0x53aebca9UL, 0xc59ebbdeUL, 0x7fcfb247UL, 0xe9ffb530UL,
- 0x1cf2bdbdUL, 0x8ac2bacaUL, 0x3093b353UL, 0xa6a3b424UL, 0x0536d0baUL,
- 0x9306d7cdUL, 0x2957de54UL, 0xbf67d923UL, 0x2e7a66b3UL, 0xb84a61c4UL,
- 0x021b685dUL, 0x942b6f2aUL, 0x37be0bb4UL, 0xa18e0cc3UL, 0x1bdf055aUL,
- 0x8def022dUL
- },
- {
- 0x00000000UL, 0x41311b19UL, 0x82623632UL, 0xc3532d2bUL, 0x04c56c64UL,
- 0x45f4777dUL, 0x86a75a56UL, 0xc796414fUL, 0x088ad9c8UL, 0x49bbc2d1UL,
- 0x8ae8effaUL, 0xcbd9f4e3UL, 0x0c4fb5acUL, 0x4d7eaeb5UL, 0x8e2d839eUL,
- 0xcf1c9887UL, 0x5112c24aUL, 0x1023d953UL, 0xd370f478UL, 0x9241ef61UL,
- 0x55d7ae2eUL, 0x14e6b537UL, 0xd7b5981cUL, 0x96848305UL, 0x59981b82UL,
- 0x18a9009bUL, 0xdbfa2db0UL, 0x9acb36a9UL, 0x5d5d77e6UL, 0x1c6c6cffUL,
- 0xdf3f41d4UL, 0x9e0e5acdUL, 0xa2248495UL, 0xe3159f8cUL, 0x2046b2a7UL,
- 0x6177a9beUL, 0xa6e1e8f1UL, 0xe7d0f3e8UL, 0x2483dec3UL, 0x65b2c5daUL,
- 0xaaae5d5dUL, 0xeb9f4644UL, 0x28cc6b6fUL, 0x69fd7076UL, 0xae6b3139UL,
- 0xef5a2a20UL, 0x2c09070bUL, 0x6d381c12UL, 0xf33646dfUL, 0xb2075dc6UL,
- 0x715470edUL, 0x30656bf4UL, 0xf7f32abbUL, 0xb6c231a2UL, 0x75911c89UL,
- 0x34a00790UL, 0xfbbc9f17UL, 0xba8d840eUL, 0x79dea925UL, 0x38efb23cUL,
- 0xff79f373UL, 0xbe48e86aUL, 0x7d1bc541UL, 0x3c2ade58UL, 0x054f79f0UL,
- 0x447e62e9UL, 0x872d4fc2UL, 0xc61c54dbUL, 0x018a1594UL, 0x40bb0e8dUL,
- 0x83e823a6UL, 0xc2d938bfUL, 0x0dc5a038UL, 0x4cf4bb21UL, 0x8fa7960aUL,
- 0xce968d13UL, 0x0900cc5cUL, 0x4831d745UL, 0x8b62fa6eUL, 0xca53e177UL,
- 0x545dbbbaUL, 0x156ca0a3UL, 0xd63f8d88UL, 0x970e9691UL, 0x5098d7deUL,
- 0x11a9ccc7UL, 0xd2fae1ecUL, 0x93cbfaf5UL, 0x5cd76272UL, 0x1de6796bUL,
- 0xdeb55440UL, 0x9f844f59UL, 0x58120e16UL, 0x1923150fUL, 0xda703824UL,
- 0x9b41233dUL, 0xa76bfd65UL, 0xe65ae67cUL, 0x2509cb57UL, 0x6438d04eUL,
- 0xa3ae9101UL, 0xe29f8a18UL, 0x21cca733UL, 0x60fdbc2aUL, 0xafe124adUL,
- 0xeed03fb4UL, 0x2d83129fUL, 0x6cb20986UL, 0xab2448c9UL, 0xea1553d0UL,
- 0x29467efbUL, 0x687765e2UL, 0xf6793f2fUL, 0xb7482436UL, 0x741b091dUL,
- 0x352a1204UL, 0xf2bc534bUL, 0xb38d4852UL, 0x70de6579UL, 0x31ef7e60UL,
- 0xfef3e6e7UL, 0xbfc2fdfeUL, 0x7c91d0d5UL, 0x3da0cbccUL, 0xfa368a83UL,
- 0xbb07919aUL, 0x7854bcb1UL, 0x3965a7a8UL, 0x4b98833bUL, 0x0aa99822UL,
- 0xc9fab509UL, 0x88cbae10UL, 0x4f5def5fUL, 0x0e6cf446UL, 0xcd3fd96dUL,
- 0x8c0ec274UL, 0x43125af3UL, 0x022341eaUL, 0xc1706cc1UL, 0x804177d8UL,
- 0x47d73697UL, 0x06e62d8eUL, 0xc5b500a5UL, 0x84841bbcUL, 0x1a8a4171UL,
- 0x5bbb5a68UL, 0x98e87743UL, 0xd9d96c5aUL, 0x1e4f2d15UL, 0x5f7e360cUL,
- 0x9c2d1b27UL, 0xdd1c003eUL, 0x120098b9UL, 0x533183a0UL, 0x9062ae8bUL,
- 0xd153b592UL, 0x16c5f4ddUL, 0x57f4efc4UL, 0x94a7c2efUL, 0xd596d9f6UL,
- 0xe9bc07aeUL, 0xa88d1cb7UL, 0x6bde319cUL, 0x2aef2a85UL, 0xed796bcaUL,
- 0xac4870d3UL, 0x6f1b5df8UL, 0x2e2a46e1UL, 0xe136de66UL, 0xa007c57fUL,
- 0x6354e854UL, 0x2265f34dUL, 0xe5f3b202UL, 0xa4c2a91bUL, 0x67918430UL,
- 0x26a09f29UL, 0xb8aec5e4UL, 0xf99fdefdUL, 0x3accf3d6UL, 0x7bfde8cfUL,
- 0xbc6ba980UL, 0xfd5ab299UL, 0x3e099fb2UL, 0x7f3884abUL, 0xb0241c2cUL,
- 0xf1150735UL, 0x32462a1eUL, 0x73773107UL, 0xb4e17048UL, 0xf5d06b51UL,
- 0x3683467aUL, 0x77b25d63UL, 0x4ed7facbUL, 0x0fe6e1d2UL, 0xccb5ccf9UL,
- 0x8d84d7e0UL, 0x4a1296afUL, 0x0b238db6UL, 0xc870a09dUL, 0x8941bb84UL,
- 0x465d2303UL, 0x076c381aUL, 0xc43f1531UL, 0x850e0e28UL, 0x42984f67UL,
- 0x03a9547eUL, 0xc0fa7955UL, 0x81cb624cUL, 0x1fc53881UL, 0x5ef42398UL,
- 0x9da70eb3UL, 0xdc9615aaUL, 0x1b0054e5UL, 0x5a314ffcUL, 0x996262d7UL,
- 0xd85379ceUL, 0x174fe149UL, 0x567efa50UL, 0x952dd77bUL, 0xd41ccc62UL,
- 0x138a8d2dUL, 0x52bb9634UL, 0x91e8bb1fUL, 0xd0d9a006UL, 0xecf37e5eUL,
- 0xadc26547UL, 0x6e91486cUL, 0x2fa05375UL, 0xe836123aUL, 0xa9070923UL,
- 0x6a542408UL, 0x2b653f11UL, 0xe479a796UL, 0xa548bc8fUL, 0x661b91a4UL,
- 0x272a8abdUL, 0xe0bccbf2UL, 0xa18dd0ebUL, 0x62defdc0UL, 0x23efe6d9UL,
- 0xbde1bc14UL, 0xfcd0a70dUL, 0x3f838a26UL, 0x7eb2913fUL, 0xb924d070UL,
- 0xf815cb69UL, 0x3b46e642UL, 0x7a77fd5bUL, 0xb56b65dcUL, 0xf45a7ec5UL,
- 0x370953eeUL, 0x763848f7UL, 0xb1ae09b8UL, 0xf09f12a1UL, 0x33cc3f8aUL,
- 0x72fd2493UL
- },
- {
- 0x00000000UL, 0x376ac201UL, 0x6ed48403UL, 0x59be4602UL, 0xdca80907UL,
- 0xebc2cb06UL, 0xb27c8d04UL, 0x85164f05UL, 0xb851130eUL, 0x8f3bd10fUL,
- 0xd685970dUL, 0xe1ef550cUL, 0x64f91a09UL, 0x5393d808UL, 0x0a2d9e0aUL,
- 0x3d475c0bUL, 0x70a3261cUL, 0x47c9e41dUL, 0x1e77a21fUL, 0x291d601eUL,
- 0xac0b2f1bUL, 0x9b61ed1aUL, 0xc2dfab18UL, 0xf5b56919UL, 0xc8f23512UL,
- 0xff98f713UL, 0xa626b111UL, 0x914c7310UL, 0x145a3c15UL, 0x2330fe14UL,
- 0x7a8eb816UL, 0x4de47a17UL, 0xe0464d38UL, 0xd72c8f39UL, 0x8e92c93bUL,
- 0xb9f80b3aUL, 0x3cee443fUL, 0x0b84863eUL, 0x523ac03cUL, 0x6550023dUL,
- 0x58175e36UL, 0x6f7d9c37UL, 0x36c3da35UL, 0x01a91834UL, 0x84bf5731UL,
- 0xb3d59530UL, 0xea6bd332UL, 0xdd011133UL, 0x90e56b24UL, 0xa78fa925UL,
- 0xfe31ef27UL, 0xc95b2d26UL, 0x4c4d6223UL, 0x7b27a022UL, 0x2299e620UL,
- 0x15f32421UL, 0x28b4782aUL, 0x1fdeba2bUL, 0x4660fc29UL, 0x710a3e28UL,
- 0xf41c712dUL, 0xc376b32cUL, 0x9ac8f52eUL, 0xada2372fUL, 0xc08d9a70UL,
- 0xf7e75871UL, 0xae591e73UL, 0x9933dc72UL, 0x1c259377UL, 0x2b4f5176UL,
- 0x72f11774UL, 0x459bd575UL, 0x78dc897eUL, 0x4fb64b7fUL, 0x16080d7dUL,
- 0x2162cf7cUL, 0xa4748079UL, 0x931e4278UL, 0xcaa0047aUL, 0xfdcac67bUL,
- 0xb02ebc6cUL, 0x87447e6dUL, 0xdefa386fUL, 0xe990fa6eUL, 0x6c86b56bUL,
- 0x5bec776aUL, 0x02523168UL, 0x3538f369UL, 0x087faf62UL, 0x3f156d63UL,
- 0x66ab2b61UL, 0x51c1e960UL, 0xd4d7a665UL, 0xe3bd6464UL, 0xba032266UL,
- 0x8d69e067UL, 0x20cbd748UL, 0x17a11549UL, 0x4e1f534bUL, 0x7975914aUL,
- 0xfc63de4fUL, 0xcb091c4eUL, 0x92b75a4cUL, 0xa5dd984dUL, 0x989ac446UL,
- 0xaff00647UL, 0xf64e4045UL, 0xc1248244UL, 0x4432cd41UL, 0x73580f40UL,
- 0x2ae64942UL, 0x1d8c8b43UL, 0x5068f154UL, 0x67023355UL, 0x3ebc7557UL,
- 0x09d6b756UL, 0x8cc0f853UL, 0xbbaa3a52UL, 0xe2147c50UL, 0xd57ebe51UL,
- 0xe839e25aUL, 0xdf53205bUL, 0x86ed6659UL, 0xb187a458UL, 0x3491eb5dUL,
- 0x03fb295cUL, 0x5a456f5eUL, 0x6d2fad5fUL, 0x801b35e1UL, 0xb771f7e0UL,
- 0xeecfb1e2UL, 0xd9a573e3UL, 0x5cb33ce6UL, 0x6bd9fee7UL, 0x3267b8e5UL,
- 0x050d7ae4UL, 0x384a26efUL, 0x0f20e4eeUL, 0x569ea2ecUL, 0x61f460edUL,
- 0xe4e22fe8UL, 0xd388ede9UL, 0x8a36abebUL, 0xbd5c69eaUL, 0xf0b813fdUL,
- 0xc7d2d1fcUL, 0x9e6c97feUL, 0xa90655ffUL, 0x2c101afaUL, 0x1b7ad8fbUL,
- 0x42c49ef9UL, 0x75ae5cf8UL, 0x48e900f3UL, 0x7f83c2f2UL, 0x263d84f0UL,
- 0x115746f1UL, 0x944109f4UL, 0xa32bcbf5UL, 0xfa958df7UL, 0xcdff4ff6UL,
- 0x605d78d9UL, 0x5737bad8UL, 0x0e89fcdaUL, 0x39e33edbUL, 0xbcf571deUL,
- 0x8b9fb3dfUL, 0xd221f5ddUL, 0xe54b37dcUL, 0xd80c6bd7UL, 0xef66a9d6UL,
- 0xb6d8efd4UL, 0x81b22dd5UL, 0x04a462d0UL, 0x33cea0d1UL, 0x6a70e6d3UL,
- 0x5d1a24d2UL, 0x10fe5ec5UL, 0x27949cc4UL, 0x7e2adac6UL, 0x494018c7UL,
- 0xcc5657c2UL, 0xfb3c95c3UL, 0xa282d3c1UL, 0x95e811c0UL, 0xa8af4dcbUL,
- 0x9fc58fcaUL, 0xc67bc9c8UL, 0xf1110bc9UL, 0x740744ccUL, 0x436d86cdUL,
- 0x1ad3c0cfUL, 0x2db902ceUL, 0x4096af91UL, 0x77fc6d90UL, 0x2e422b92UL,
- 0x1928e993UL, 0x9c3ea696UL, 0xab546497UL, 0xf2ea2295UL, 0xc580e094UL,
- 0xf8c7bc9fUL, 0xcfad7e9eUL, 0x9613389cUL, 0xa179fa9dUL, 0x246fb598UL,
- 0x13057799UL, 0x4abb319bUL, 0x7dd1f39aUL, 0x3035898dUL, 0x075f4b8cUL,
- 0x5ee10d8eUL, 0x698bcf8fUL, 0xec9d808aUL, 0xdbf7428bUL, 0x82490489UL,
- 0xb523c688UL, 0x88649a83UL, 0xbf0e5882UL, 0xe6b01e80UL, 0xd1dadc81UL,
- 0x54cc9384UL, 0x63a65185UL, 0x3a181787UL, 0x0d72d586UL, 0xa0d0e2a9UL,
- 0x97ba20a8UL, 0xce0466aaUL, 0xf96ea4abUL, 0x7c78ebaeUL, 0x4b1229afUL,
- 0x12ac6fadUL, 0x25c6adacUL, 0x1881f1a7UL, 0x2feb33a6UL, 0x765575a4UL,
- 0x413fb7a5UL, 0xc429f8a0UL, 0xf3433aa1UL, 0xaafd7ca3UL, 0x9d97bea2UL,
- 0xd073c4b5UL, 0xe71906b4UL, 0xbea740b6UL, 0x89cd82b7UL, 0x0cdbcdb2UL,
- 0x3bb10fb3UL, 0x620f49b1UL, 0x55658bb0UL, 0x6822d7bbUL, 0x5f4815baUL,
- 0x06f653b8UL, 0x319c91b9UL, 0xb48adebcUL, 0x83e01cbdUL, 0xda5e5abfUL,
- 0xed3498beUL
- },
- {
- 0x00000000UL, 0x6567bcb8UL, 0x8bc809aaUL, 0xeeafb512UL, 0x5797628fUL,
- 0x32f0de37UL, 0xdc5f6b25UL, 0xb938d79dUL, 0xef28b4c5UL, 0x8a4f087dUL,
- 0x64e0bd6fUL, 0x018701d7UL, 0xb8bfd64aUL, 0xddd86af2UL, 0x3377dfe0UL,
- 0x56106358UL, 0x9f571950UL, 0xfa30a5e8UL, 0x149f10faUL, 0x71f8ac42UL,
- 0xc8c07bdfUL, 0xada7c767UL, 0x43087275UL, 0x266fcecdUL, 0x707fad95UL,
- 0x1518112dUL, 0xfbb7a43fUL, 0x9ed01887UL, 0x27e8cf1aUL, 0x428f73a2UL,
- 0xac20c6b0UL, 0xc9477a08UL, 0x3eaf32a0UL, 0x5bc88e18UL, 0xb5673b0aUL,
- 0xd00087b2UL, 0x6938502fUL, 0x0c5fec97UL, 0xe2f05985UL, 0x8797e53dUL,
- 0xd1878665UL, 0xb4e03addUL, 0x5a4f8fcfUL, 0x3f283377UL, 0x8610e4eaUL,
- 0xe3775852UL, 0x0dd8ed40UL, 0x68bf51f8UL, 0xa1f82bf0UL, 0xc49f9748UL,
- 0x2a30225aUL, 0x4f579ee2UL, 0xf66f497fUL, 0x9308f5c7UL, 0x7da740d5UL,
- 0x18c0fc6dUL, 0x4ed09f35UL, 0x2bb7238dUL, 0xc518969fUL, 0xa07f2a27UL,
- 0x1947fdbaUL, 0x7c204102UL, 0x928ff410UL, 0xf7e848a8UL, 0x3d58149bUL,
- 0x583fa823UL, 0xb6901d31UL, 0xd3f7a189UL, 0x6acf7614UL, 0x0fa8caacUL,
- 0xe1077fbeUL, 0x8460c306UL, 0xd270a05eUL, 0xb7171ce6UL, 0x59b8a9f4UL,
- 0x3cdf154cUL, 0x85e7c2d1UL, 0xe0807e69UL, 0x0e2fcb7bUL, 0x6b4877c3UL,
- 0xa20f0dcbUL, 0xc768b173UL, 0x29c70461UL, 0x4ca0b8d9UL, 0xf5986f44UL,
- 0x90ffd3fcUL, 0x7e5066eeUL, 0x1b37da56UL, 0x4d27b90eUL, 0x284005b6UL,
- 0xc6efb0a4UL, 0xa3880c1cUL, 0x1ab0db81UL, 0x7fd76739UL, 0x9178d22bUL,
- 0xf41f6e93UL, 0x03f7263bUL, 0x66909a83UL, 0x883f2f91UL, 0xed589329UL,
- 0x546044b4UL, 0x3107f80cUL, 0xdfa84d1eUL, 0xbacff1a6UL, 0xecdf92feUL,
- 0x89b82e46UL, 0x67179b54UL, 0x027027ecUL, 0xbb48f071UL, 0xde2f4cc9UL,
- 0x3080f9dbUL, 0x55e74563UL, 0x9ca03f6bUL, 0xf9c783d3UL, 0x176836c1UL,
- 0x720f8a79UL, 0xcb375de4UL, 0xae50e15cUL, 0x40ff544eUL, 0x2598e8f6UL,
- 0x73888baeUL, 0x16ef3716UL, 0xf8408204UL, 0x9d273ebcUL, 0x241fe921UL,
- 0x41785599UL, 0xafd7e08bUL, 0xcab05c33UL, 0x3bb659edUL, 0x5ed1e555UL,
- 0xb07e5047UL, 0xd519ecffUL, 0x6c213b62UL, 0x094687daUL, 0xe7e932c8UL,
- 0x828e8e70UL, 0xd49eed28UL, 0xb1f95190UL, 0x5f56e482UL, 0x3a31583aUL,
- 0x83098fa7UL, 0xe66e331fUL, 0x08c1860dUL, 0x6da63ab5UL, 0xa4e140bdUL,
- 0xc186fc05UL, 0x2f294917UL, 0x4a4ef5afUL, 0xf3762232UL, 0x96119e8aUL,
- 0x78be2b98UL, 0x1dd99720UL, 0x4bc9f478UL, 0x2eae48c0UL, 0xc001fdd2UL,
- 0xa566416aUL, 0x1c5e96f7UL, 0x79392a4fUL, 0x97969f5dUL, 0xf2f123e5UL,
- 0x05196b4dUL, 0x607ed7f5UL, 0x8ed162e7UL, 0xebb6de5fUL, 0x528e09c2UL,
- 0x37e9b57aUL, 0xd9460068UL, 0xbc21bcd0UL, 0xea31df88UL, 0x8f566330UL,
- 0x61f9d622UL, 0x049e6a9aUL, 0xbda6bd07UL, 0xd8c101bfUL, 0x366eb4adUL,
- 0x53090815UL, 0x9a4e721dUL, 0xff29cea5UL, 0x11867bb7UL, 0x74e1c70fUL,
- 0xcdd91092UL, 0xa8beac2aUL, 0x46111938UL, 0x2376a580UL, 0x7566c6d8UL,
- 0x10017a60UL, 0xfeaecf72UL, 0x9bc973caUL, 0x22f1a457UL, 0x479618efUL,
- 0xa939adfdUL, 0xcc5e1145UL, 0x06ee4d76UL, 0x6389f1ceUL, 0x8d2644dcUL,
- 0xe841f864UL, 0x51792ff9UL, 0x341e9341UL, 0xdab12653UL, 0xbfd69aebUL,
- 0xe9c6f9b3UL, 0x8ca1450bUL, 0x620ef019UL, 0x07694ca1UL, 0xbe519b3cUL,
- 0xdb362784UL, 0x35999296UL, 0x50fe2e2eUL, 0x99b95426UL, 0xfcdee89eUL,
- 0x12715d8cUL, 0x7716e134UL, 0xce2e36a9UL, 0xab498a11UL, 0x45e63f03UL,
- 0x208183bbUL, 0x7691e0e3UL, 0x13f65c5bUL, 0xfd59e949UL, 0x983e55f1UL,
- 0x2106826cUL, 0x44613ed4UL, 0xaace8bc6UL, 0xcfa9377eUL, 0x38417fd6UL,
- 0x5d26c36eUL, 0xb389767cUL, 0xd6eecac4UL, 0x6fd61d59UL, 0x0ab1a1e1UL,
- 0xe41e14f3UL, 0x8179a84bUL, 0xd769cb13UL, 0xb20e77abUL, 0x5ca1c2b9UL,
- 0x39c67e01UL, 0x80fea99cUL, 0xe5991524UL, 0x0b36a036UL, 0x6e511c8eUL,
- 0xa7166686UL, 0xc271da3eUL, 0x2cde6f2cUL, 0x49b9d394UL, 0xf0810409UL,
- 0x95e6b8b1UL, 0x7b490da3UL, 0x1e2eb11bUL, 0x483ed243UL, 0x2d596efbUL,
- 0xc3f6dbe9UL, 0xa6916751UL, 0x1fa9b0ccUL, 0x7ace0c74UL, 0x9461b966UL,
- 0xf10605deUL
-#endif
- }
-};
diff --git a/chromium/third_party/pdfium/third_party/zlib_v128/deflate.c b/chromium/third_party/pdfium/third_party/zlib_v128/deflate.c
deleted file mode 100644
index 1afe233c9ae..00000000000
--- a/chromium/third_party/pdfium/third_party/zlib_v128/deflate.c
+++ /dev/null
@@ -1,1966 +0,0 @@
-/* deflate.c -- compress data using the deflation algorithm
- * Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/*
- * ALGORITHM
- *
- * The "deflation" process depends on being able to identify portions
- * of the input text which are identical to earlier input (within a
- * sliding window trailing behind the input currently being processed).
- *
- * The most straightforward technique turns out to be the fastest for
- * most input files: try all possible matches and select the longest.
- * The key feature of this algorithm is that insertions into the string
- * dictionary are very simple and thus fast, and deletions are avoided
- * completely. Insertions are performed at each input character, whereas
- * string matches are performed only when the previous match ends. So it
- * is preferable to spend more time in matches to allow very fast string
- * insertions and avoid deletions. The matching algorithm for small
- * strings is inspired from that of Rabin & Karp. A brute force approach
- * is used to find longer strings when a small match has been found.
- * A similar algorithm is used in comic (by Jan-Mark Wams) and freeze
- * (by Leonid Broukhis).
- * A previous version of this file used a more sophisticated algorithm
- * (by Fiala and Greene) which is guaranteed to run in linear amortized
- * time, but has a larger average cost, uses more memory and is patented.
- * However the F&G algorithm may be faster for some highly redundant
- * files if the parameter max_chain_length (described below) is too large.
- *
- * ACKNOWLEDGEMENTS
- *
- * The idea of lazy evaluation of matches is due to Jan-Mark Wams, and
- * I found it in 'freeze' written by Leonid Broukhis.
- * Thanks to many people for bug reports and testing.
- *
- * REFERENCES
- *
- * Deutsch, L.P.,"DEFLATE Compressed Data Format Specification".
- * Available in http://tools.ietf.org/html/rfc1951
- *
- * A description of the Rabin and Karp algorithm is given in the book
- * "Algorithms" by R. Sedgewick, Addison-Wesley, p252.
- *
- * Fiala,E.R., and Greene,D.H.
- * Data Compression with Finite Windows, Comm.ACM, 32,4 (1989) 490-595
- *
- */
-
-/* @(#) $Id$ */
-
-#include "deflate.h"
-
-const char deflate_copyright[] =
- " deflate 1.2.8 Copyright 1995-2013 Jean-loup Gailly and Mark Adler ";
-/*
- If you use the zlib library in a product, an acknowledgment is welcome
- in the documentation of your product. If for some reason you cannot
- include such an acknowledgment, I would appreciate that you keep this
- copyright string in the executable of your product.
- */
-
-/* ===========================================================================
- * Function prototypes.
- */
-typedef enum {
- need_more, /* block not completed, need more input or more output */
- block_done, /* block flush performed */
- finish_started, /* finish started, need only more output at next deflate */
- finish_done /* finish done, accept no more input or output */
-} block_state;
-
-typedef block_state (*compress_func) OF((deflate_state *s, int flush));
-/* Compression function. Returns the block state after the call. */
-
-local void fill_window OF((deflate_state *s));
-local block_state deflate_stored OF((deflate_state *s, int flush));
-local block_state deflate_fast OF((deflate_state *s, int flush));
-#ifndef FASTEST
-local block_state deflate_slow OF((deflate_state *s, int flush));
-#endif
-local block_state deflate_rle OF((deflate_state *s, int flush));
-local block_state deflate_huff OF((deflate_state *s, int flush));
-local void lm_init OF((deflate_state *s));
-local void putShortMSB OF((deflate_state *s, uInt b));
-local void flush_pending OF((z_streamp strm));
-local int read_buf OF((z_streamp strm, Bytef *buf, unsigned size));
-#ifdef ASMV
- void match_init OF((void)); /* asm code initialization */
- uInt longest_match OF((deflate_state *s, IPos cur_match));
-#else
-local uInt longest_match OF((deflate_state *s, IPos cur_match));
-#endif
-
-#ifdef DEBUG
-local void check_match OF((deflate_state *s, IPos start, IPos match,
- int length));
-#endif
-
-/* ===========================================================================
- * Local data
- */
-
-#define NIL 0
-/* Tail of hash chains */
-
-#ifndef TOO_FAR
-# define TOO_FAR 4096
-#endif
-/* Matches of length 3 are discarded if their distance exceeds TOO_FAR */
-
-/* Values for max_lazy_match, good_match and max_chain_length, depending on
- * the desired pack level (0..9). The values given below have been tuned to
- * exclude worst case performance for pathological files. Better values may be
- * found for specific files.
- */
-typedef struct config_s {
- ush good_length; /* reduce lazy search above this match length */
- ush max_lazy; /* do not perform lazy search above this match length */
- ush nice_length; /* quit search above this match length */
- ush max_chain;
- compress_func func;
-} config;
-
-#ifdef FASTEST
-local const config configuration_table[2] = {
-/* good lazy nice chain */
-/* 0 */ {0, 0, 0, 0, deflate_stored}, /* store only */
-/* 1 */ {4, 4, 8, 4, deflate_fast}}; /* max speed, no lazy matches */
-#else
-local const config configuration_table[10] = {
-/* good lazy nice chain */
-/* 0 */ {0, 0, 0, 0, deflate_stored}, /* store only */
-/* 1 */ {4, 4, 8, 4, deflate_fast}, /* max speed, no lazy matches */
-/* 2 */ {4, 5, 16, 8, deflate_fast},
-/* 3 */ {4, 6, 32, 32, deflate_fast},
-
-/* 4 */ {4, 4, 16, 16, deflate_slow}, /* lazy matches */
-/* 5 */ {8, 16, 32, 32, deflate_slow},
-/* 6 */ {8, 16, 128, 128, deflate_slow},
-/* 7 */ {8, 32, 128, 256, deflate_slow},
-/* 8 */ {32, 128, 258, 1024, deflate_slow},
-/* 9 */ {32, 258, 258, 4096, deflate_slow}}; /* max compression */
-#endif
-
-/* Note: the deflate() code requires max_lazy >= MIN_MATCH and max_chain >= 4
- * For deflate_fast() (levels <= 3) good is ignored and lazy has a different
- * meaning.
- */
-
-#define EQUAL 0
-/* result of memcmp for equal strings */
-
-#ifndef NO_DUMMY_DECL
-struct static_tree_desc_s {int dummy;}; /* for buggy compilers */
-#endif
-
-/* rank Z_BLOCK between Z_NO_FLUSH and Z_PARTIAL_FLUSH */
-#define RANK(f) (((f) << 1) - ((f) > 4 ? 9 : 0))
-
-/* ===========================================================================
- * Update a hash value with the given input byte
- * IN assertion: all calls to to UPDATE_HASH are made with consecutive
- * input characters, so that a running hash key can be computed from the
- * previous key instead of complete recalculation each time.
- */
-#define UPDATE_HASH(s,h,c) (h = (((h)<<s->hash_shift) ^ (c)) & s->hash_mask)
-
-
-/* ===========================================================================
- * Insert string str in the dictionary and set match_head to the previous head
- * of the hash chain (the most recent string with same hash key). Return
- * the previous length of the hash chain.
- * If this file is compiled with -DFASTEST, the compression level is forced
- * to 1, and no hash chains are maintained.
- * IN assertion: all calls to to INSERT_STRING are made with consecutive
- * input characters and the first MIN_MATCH bytes of str are valid
- * (except for the last MIN_MATCH-1 bytes of the input file).
- */
-#ifdef FASTEST
-#define INSERT_STRING(s, str, match_head) \
- (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \
- match_head = s->head[s->ins_h], \
- s->head[s->ins_h] = (Pos)(str))
-#else
-#define INSERT_STRING(s, str, match_head) \
- (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \
- match_head = s->prev[(str) & s->w_mask] = s->head[s->ins_h], \
- s->head[s->ins_h] = (Pos)(str))
-#endif
-
-/* ===========================================================================
- * Initialize the hash table (avoiding 64K overflow for 16 bit systems).
- * prev[] will be initialized on the fly.
- */
-#define CLEAR_HASH(s) \
- s->head[s->hash_size-1] = NIL; \
- zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head));
-
-/* ========================================================================= */
-int ZEXPORT deflateInit_(
- z_streamp strm,
- int level,
- const char *version,
- int stream_size)
-{
- return deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL,
- Z_DEFAULT_STRATEGY, version, stream_size);
- /* To do: ignore strm->next_in if we use it as window */
-}
-
-/* ========================================================================= */
-int ZEXPORT deflateInit2_(
- z_streamp strm,
- int level,
- int method,
- int windowBits,
- int memLevel,
- int strategy,
- const char *version,
- int stream_size)
-{
- deflate_state *s;
- int wrap = 1;
- static const char my_version[] = ZLIB_VERSION;
-
- ushf *overlay;
- /* We overlay pending_buf and d_buf+l_buf. This works since the average
- * output size for (length,distance) codes is <= 24 bits.
- */
-
- if (version == Z_NULL || version[0] != my_version[0] ||
- stream_size != sizeof(z_stream)) {
- return Z_VERSION_ERROR;
- }
- if (strm == Z_NULL) return Z_STREAM_ERROR;
-
- strm->msg = Z_NULL;
- if (strm->zalloc == (alloc_func)0) {
-#ifdef Z_SOLO
- return Z_STREAM_ERROR;
-#else
- strm->zalloc = zcalloc;
- strm->opaque = (voidpf)0;
-#endif
- }
- if (strm->zfree == (free_func)0)
-#ifdef Z_SOLO
- return Z_STREAM_ERROR;
-#else
- strm->zfree = zcfree;
-#endif
-
-#ifdef FASTEST
- if (level != 0) level = 1;
-#else
- if (level == Z_DEFAULT_COMPRESSION) level = 6;
-#endif
-
- if (windowBits < 0) { /* suppress zlib wrapper */
- wrap = 0;
- windowBits = -windowBits;
- }
-#ifdef GZIP
- else if (windowBits > 15) {
- wrap = 2; /* write gzip wrapper instead */
- windowBits -= 16;
- }
-#endif
- if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED ||
- windowBits < 8 || windowBits > 15 || level < 0 || level > 9 ||
- strategy < 0 || strategy > Z_FIXED) {
- return Z_STREAM_ERROR;
- }
- if (windowBits == 8) windowBits = 9; /* until 256-byte window bug fixed */
- s = (deflate_state *) ZALLOC(strm, 1, sizeof(deflate_state));
- if (s == Z_NULL) return Z_MEM_ERROR;
- strm->state = (struct internal_state FAR *)s;
- s->strm = strm;
-
- s->wrap = wrap;
- s->gzhead = Z_NULL;
- s->w_bits = windowBits;
- s->w_size = 1 << s->w_bits;
- s->w_mask = s->w_size - 1;
-
- s->hash_bits = memLevel + 7;
- s->hash_size = 1 << s->hash_bits;
- s->hash_mask = s->hash_size - 1;
- s->hash_shift = ((s->hash_bits+MIN_MATCH-1)/MIN_MATCH);
-
- s->window = (Bytef *) ZALLOC(strm, s->w_size, 2*sizeof(Byte));
- s->prev = (Posf *) ZALLOC(strm, s->w_size, sizeof(Pos));
- s->head = (Posf *) ZALLOC(strm, s->hash_size, sizeof(Pos));
-
- s->high_water = 0; /* nothing written to s->window yet */
-
- s->lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */
-
- overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2);
- s->pending_buf = (uchf *) overlay;
- s->pending_buf_size = (ulg)s->lit_bufsize * (sizeof(ush)+2L);
-
- if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL ||
- s->pending_buf == Z_NULL) {
- s->status = FINISH_STATE;
- strm->msg = ERR_MSG(Z_MEM_ERROR);
- deflateEnd (strm);
- return Z_MEM_ERROR;
- }
- s->d_buf = overlay + s->lit_bufsize/sizeof(ush);
- s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize;
-
- s->level = level;
- s->strategy = strategy;
- s->method = (Byte)method;
-
- return deflateReset(strm);
-}
-
-/* ========================================================================= */
-int ZEXPORT deflateSetDictionary (
- z_streamp strm,
- const Bytef *dictionary,
- uInt dictLength)
-{
- deflate_state *s;
- uInt str, n;
- int wrap;
- unsigned avail;
- z_const unsigned char *next;
-
- if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL)
- return Z_STREAM_ERROR;
- s = strm->state;
- wrap = s->wrap;
- if (wrap == 2 || (wrap == 1 && s->status != INIT_STATE) || s->lookahead)
- return Z_STREAM_ERROR;
-
- /* when using zlib wrappers, compute Adler-32 for provided dictionary */
- if (wrap == 1)
- strm->adler = adler32(strm->adler, dictionary, dictLength);
- s->wrap = 0; /* avoid computing Adler-32 in read_buf */
-
- /* if dictionary would fill window, just replace the history */
- if (dictLength >= s->w_size) {
- if (wrap == 0) { /* already empty otherwise */
- CLEAR_HASH(s);
- s->strstart = 0;
- s->block_start = 0L;
- s->insert = 0;
- }
- dictionary += dictLength - s->w_size; /* use the tail */
- dictLength = s->w_size;
- }
-
- /* insert dictionary into window and hash */
- avail = strm->avail_in;
- next = strm->next_in;
- strm->avail_in = dictLength;
- strm->next_in = (z_const Bytef *)dictionary;
- fill_window(s);
- while (s->lookahead >= MIN_MATCH) {
- str = s->strstart;
- n = s->lookahead - (MIN_MATCH-1);
- do {
- UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]);
-#ifndef FASTEST
- s->prev[str & s->w_mask] = s->head[s->ins_h];
-#endif
- s->head[s->ins_h] = (Pos)str;
- str++;
- } while (--n);
- s->strstart = str;
- s->lookahead = MIN_MATCH-1;
- fill_window(s);
- }
- s->strstart += s->lookahead;
- s->block_start = (long)s->strstart;
- s->insert = s->lookahead;
- s->lookahead = 0;
- s->match_length = s->prev_length = MIN_MATCH-1;
- s->match_available = 0;
- strm->next_in = next;
- strm->avail_in = avail;
- s->wrap = wrap;
- return Z_OK;
-}
-
-/* ========================================================================= */
-int ZEXPORT deflateResetKeep (
- z_streamp strm)
-{
- deflate_state *s;
-
- if (strm == Z_NULL || strm->state == Z_NULL ||
- strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0) {
- return Z_STREAM_ERROR;
- }
-
- strm->total_in = strm->total_out = 0;
- strm->msg = Z_NULL; /* use zfree if we ever allocate msg dynamically */
- strm->data_type = Z_UNKNOWN;
-
- s = (deflate_state *)strm->state;
- s->pending = 0;
- s->pending_out = s->pending_buf;
-
- if (s->wrap < 0) {
- s->wrap = -s->wrap; /* was made negative by deflate(..., Z_FINISH); */
- }
- s->status = s->wrap ? INIT_STATE : BUSY_STATE;
- strm->adler =
-#ifdef GZIP
- s->wrap == 2 ? crc32(0L, Z_NULL, 0) :
-#endif
- adler32(0L, Z_NULL, 0);
- s->last_flush = Z_NO_FLUSH;
-
- _tr_init(s);
-
- return Z_OK;
-}
-
-/* ========================================================================= */
-int ZEXPORT deflateReset (
- z_streamp strm)
-{
- int ret;
-
- ret = deflateResetKeep(strm);
- if (ret == Z_OK)
- lm_init(strm->state);
- return ret;
-}
-
-/* ========================================================================= */
-int ZEXPORT deflateSetHeader (strm, head)
- z_streamp strm;
- gz_headerp head;
-{
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
- if (strm->state->wrap != 2) return Z_STREAM_ERROR;
- strm->state->gzhead = head;
- return Z_OK;
-}
-
-/* ========================================================================= */
-int ZEXPORT deflatePending (
- z_streamp strm,
- unsigned *pending,
- int *bits)
-{
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
- if (pending != Z_NULL)
- *pending = strm->state->pending;
- if (bits != Z_NULL)
- *bits = strm->state->bi_valid;
- return Z_OK;
-}
-
-/* ========================================================================= */
-int ZEXPORT deflatePrime (strm, bits, value)
- z_streamp strm;
- int bits;
- int value;
-{
- deflate_state *s;
- int put;
-
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
- s = strm->state;
- if ((Bytef *)(s->d_buf) < s->pending_out + ((Buf_size + 7) >> 3))
- return Z_BUF_ERROR;
- do {
- put = Buf_size - s->bi_valid;
- if (put > bits)
- put = bits;
- s->bi_buf |= (ush)((value & ((1 << put) - 1)) << s->bi_valid);
- s->bi_valid += put;
- _tr_flush_bits(s);
- value >>= put;
- bits -= put;
- } while (bits);
- return Z_OK;
-}
-
-/* ========================================================================= */
-int ZEXPORT deflateParams(
- z_streamp strm,
- int level,
- int strategy)
-{
- deflate_state *s;
- compress_func func;
- int err = Z_OK;
-
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
- s = strm->state;
-
-#ifdef FASTEST
- if (level != 0) level = 1;
-#else
- if (level == Z_DEFAULT_COMPRESSION) level = 6;
-#endif
- if (level < 0 || level > 9 || strategy < 0 || strategy > Z_FIXED) {
- return Z_STREAM_ERROR;
- }
- func = configuration_table[s->level].func;
-
- if ((strategy != s->strategy || func != configuration_table[level].func) &&
- strm->total_in != 0) {
- /* Flush the last buffer: */
- err = deflate(strm, Z_BLOCK);
- if (err == Z_BUF_ERROR && s->pending == 0)
- err = Z_OK;
- }
- if (s->level != level) {
- s->level = level;
- s->max_lazy_match = configuration_table[level].max_lazy;
- s->good_match = configuration_table[level].good_length;
- s->nice_match = configuration_table[level].nice_length;
- s->max_chain_length = configuration_table[level].max_chain;
- }
- s->strategy = strategy;
- return err;
-}
-
-/* ========================================================================= */
-int ZEXPORT deflateTune(
- z_streamp strm,
- int good_length,
- int max_lazy,
- int nice_length,
- int max_chain)
-{
- deflate_state *s;
-
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
- s = strm->state;
- s->good_match = good_length;
- s->max_lazy_match = max_lazy;
- s->nice_match = nice_length;
- s->max_chain_length = max_chain;
- return Z_OK;
-}
-
-/* =========================================================================
- * For the default windowBits of 15 and memLevel of 8, this function returns
- * a close to exact, as well as small, upper bound on the compressed size.
- * They are coded as constants here for a reason--if the #define's are
- * changed, then this function needs to be changed as well. The return
- * value for 15 and 8 only works for those exact settings.
- *
- * For any setting other than those defaults for windowBits and memLevel,
- * the value returned is a conservative worst case for the maximum expansion
- * resulting from using fixed blocks instead of stored blocks, which deflate
- * can emit on compressed data for some combinations of the parameters.
- *
- * This function could be more sophisticated to provide closer upper bounds for
- * every combination of windowBits and memLevel. But even the conservative
- * upper bound of about 14% expansion does not seem onerous for output buffer
- * allocation.
- */
-uLong ZEXPORT deflateBound(
- z_streamp strm,
- uLong sourceLen)
-{
- deflate_state *s;
- uLong complen, wraplen;
- Bytef *str;
-
- /* conservative upper bound for compressed data */
- complen = sourceLen +
- ((sourceLen + 7) >> 3) + ((sourceLen + 63) >> 6) + 5;
-
- /* if can't get parameters, return conservative bound plus zlib wrapper */
- if (strm == Z_NULL || strm->state == Z_NULL)
- return complen + 6;
-
- /* compute wrapper length */
- s = strm->state;
- switch (s->wrap) {
- case 0: /* raw deflate */
- wraplen = 0;
- break;
- case 1: /* zlib wrapper */
- wraplen = 6 + (s->strstart ? 4 : 0);
- break;
- case 2: /* gzip wrapper */
- wraplen = 18;
- if (s->gzhead != Z_NULL) { /* user-supplied gzip header */
- if (s->gzhead->extra != Z_NULL)
- wraplen += 2 + s->gzhead->extra_len;
- str = s->gzhead->name;
- if (str != Z_NULL)
- do {
- wraplen++;
- } while (*str++);
- str = s->gzhead->comment;
- if (str != Z_NULL)
- do {
- wraplen++;
- } while (*str++);
- if (s->gzhead->hcrc)
- wraplen += 2;
- }
- break;
- default: /* for compiler happiness */
- wraplen = 6;
- }
-
- /* if not default parameters, return conservative bound */
- if (s->w_bits != 15 || s->hash_bits != 8 + 7)
- return complen + wraplen;
-
- /* default settings: return tight bound for that case */
- return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) +
- (sourceLen >> 25) + 13 - 6 + wraplen;
-}
-
-/* =========================================================================
- * Put a short in the pending buffer. The 16-bit value is put in MSB order.
- * IN assertion: the stream state is correct and there is enough room in
- * pending_buf.
- */
-local void putShortMSB (
- deflate_state *s,
- uInt b)
-{
- put_byte(s, (Byte)(b >> 8));
- put_byte(s, (Byte)(b & 0xff));
-}
-
-/* =========================================================================
- * Flush as much pending output as possible. All deflate() output goes
- * through this function so some applications may wish to modify it
- * to avoid allocating a large strm->next_out buffer and copying into it.
- * (See also read_buf()).
- */
-local void flush_pending(
- z_streamp strm)
-{
- unsigned len;
- deflate_state *s = strm->state;
-
- _tr_flush_bits(s);
- len = s->pending;
- if (len > strm->avail_out) len = strm->avail_out;
- if (len == 0) return;
-
- zmemcpy(strm->next_out, s->pending_out, len);
- strm->next_out += len;
- s->pending_out += len;
- strm->total_out += len;
- strm->avail_out -= len;
- s->pending -= len;
- if (s->pending == 0) {
- s->pending_out = s->pending_buf;
- }
-}
-
-/* ========================================================================= */
-int ZEXPORT deflate (
- z_streamp strm,
- int flush)
-{
- int old_flush; /* value of flush param for previous deflate call */
- deflate_state *s;
-
- if (strm == Z_NULL || strm->state == Z_NULL ||
- flush > Z_BLOCK || flush < 0) {
- return Z_STREAM_ERROR;
- }
- s = strm->state;
-
- if (strm->next_out == Z_NULL ||
- (strm->next_in == Z_NULL && strm->avail_in != 0) ||
- (s->status == FINISH_STATE && flush != Z_FINISH)) {
- ERR_RETURN(strm, Z_STREAM_ERROR);
- }
- if (strm->avail_out == 0) ERR_RETURN(strm, Z_BUF_ERROR);
-
- s->strm = strm; /* just in case */
- old_flush = s->last_flush;
- s->last_flush = flush;
-
- /* Write the header */
- if (s->status == INIT_STATE) {
-#ifdef GZIP
- if (s->wrap == 2) {
- strm->adler = crc32(0L, Z_NULL, 0);
- put_byte(s, 31);
- put_byte(s, 139);
- put_byte(s, 8);
- if (s->gzhead == Z_NULL) {
- put_byte(s, 0);
- put_byte(s, 0);
- put_byte(s, 0);
- put_byte(s, 0);
- put_byte(s, 0);
- put_byte(s, s->level == 9 ? 2 :
- (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ?
- 4 : 0));
- put_byte(s, OS_CODE);
- s->status = BUSY_STATE;
- }
- else {
- put_byte(s, (s->gzhead->text ? 1 : 0) +
- (s->gzhead->hcrc ? 2 : 0) +
- (s->gzhead->extra == Z_NULL ? 0 : 4) +
- (s->gzhead->name == Z_NULL ? 0 : 8) +
- (s->gzhead->comment == Z_NULL ? 0 : 16)
- );
- put_byte(s, (Byte)(s->gzhead->time & 0xff));
- put_byte(s, (Byte)((s->gzhead->time >> 8) & 0xff));
- put_byte(s, (Byte)((s->gzhead->time >> 16) & 0xff));
- put_byte(s, (Byte)((s->gzhead->time >> 24) & 0xff));
- put_byte(s, s->level == 9 ? 2 :
- (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ?
- 4 : 0));
- put_byte(s, s->gzhead->os & 0xff);
- if (s->gzhead->extra != Z_NULL) {
- put_byte(s, s->gzhead->extra_len & 0xff);
- put_byte(s, (s->gzhead->extra_len >> 8) & 0xff);
- }
- if (s->gzhead->hcrc)
- strm->adler = crc32(strm->adler, s->pending_buf,
- s->pending);
- s->gzindex = 0;
- s->status = EXTRA_STATE;
- }
- }
- else
-#endif
- {
- uInt header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8;
- uInt level_flags;
-
- if (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2)
- level_flags = 0;
- else if (s->level < 6)
- level_flags = 1;
- else if (s->level == 6)
- level_flags = 2;
- else
- level_flags = 3;
- header |= (level_flags << 6);
- if (s->strstart != 0) header |= PRESET_DICT;
- header += 31 - (header % 31);
-
- s->status = BUSY_STATE;
- putShortMSB(s, header);
-
- /* Save the adler32 of the preset dictionary: */
- if (s->strstart != 0) {
- putShortMSB(s, (uInt)(strm->adler >> 16));
- putShortMSB(s, (uInt)(strm->adler & 0xffff));
- }
- strm->adler = adler32(0L, Z_NULL, 0);
- }
- }
-#ifdef GZIP
- if (s->status == EXTRA_STATE) {
- if (s->gzhead->extra != Z_NULL) {
- uInt beg = s->pending; /* start of bytes to update crc */
-
- while (s->gzindex < (s->gzhead->extra_len & 0xffff)) {
- if (s->pending == s->pending_buf_size) {
- if (s->gzhead->hcrc && s->pending > beg)
- strm->adler = crc32(strm->adler, s->pending_buf + beg,
- s->pending - beg);
- flush_pending(strm);
- beg = s->pending;
- if (s->pending == s->pending_buf_size)
- break;
- }
- put_byte(s, s->gzhead->extra[s->gzindex]);
- s->gzindex++;
- }
- if (s->gzhead->hcrc && s->pending > beg)
- strm->adler = crc32(strm->adler, s->pending_buf + beg,
- s->pending - beg);
- if (s->gzindex == s->gzhead->extra_len) {
- s->gzindex = 0;
- s->status = NAME_STATE;
- }
- }
- else
- s->status = NAME_STATE;
- }
- if (s->status == NAME_STATE) {
- if (s->gzhead->name != Z_NULL) {
- uInt beg = s->pending; /* start of bytes to update crc */
- int val;
-
- do {
- if (s->pending == s->pending_buf_size) {
- if (s->gzhead->hcrc && s->pending > beg)
- strm->adler = crc32(strm->adler, s->pending_buf + beg,
- s->pending - beg);
- flush_pending(strm);
- beg = s->pending;
- if (s->pending == s->pending_buf_size) {
- val = 1;
- break;
- }
- }
- val = s->gzhead->name[s->gzindex++];
- put_byte(s, val);
- } while (val != 0);
- if (s->gzhead->hcrc && s->pending > beg)
- strm->adler = crc32(strm->adler, s->pending_buf + beg,
- s->pending - beg);
- if (val == 0) {
- s->gzindex = 0;
- s->status = COMMENT_STATE;
- }
- }
- else
- s->status = COMMENT_STATE;
- }
- if (s->status == COMMENT_STATE) {
- if (s->gzhead->comment != Z_NULL) {
- uInt beg = s->pending; /* start of bytes to update crc */
- int val;
-
- do {
- if (s->pending == s->pending_buf_size) {
- if (s->gzhead->hcrc && s->pending > beg)
- strm->adler = crc32(strm->adler, s->pending_buf + beg,
- s->pending - beg);
- flush_pending(strm);
- beg = s->pending;
- if (s->pending == s->pending_buf_size) {
- val = 1;
- break;
- }
- }
- val = s->gzhead->comment[s->gzindex++];
- put_byte(s, val);
- } while (val != 0);
- if (s->gzhead->hcrc && s->pending > beg)
- strm->adler = crc32(strm->adler, s->pending_buf + beg,
- s->pending - beg);
- if (val == 0)
- s->status = HCRC_STATE;
- }
- else
- s->status = HCRC_STATE;
- }
- if (s->status == HCRC_STATE) {
- if (s->gzhead->hcrc) {
- if (s->pending + 2 > s->pending_buf_size)
- flush_pending(strm);
- if (s->pending + 2 <= s->pending_buf_size) {
- put_byte(s, (Byte)(strm->adler & 0xff));
- put_byte(s, (Byte)((strm->adler >> 8) & 0xff));
- strm->adler = crc32(0L, Z_NULL, 0);
- s->status = BUSY_STATE;
- }
- }
- else
- s->status = BUSY_STATE;
- }
-#endif
-
- /* Flush as much pending output as possible */
- if (s->pending != 0) {
- flush_pending(strm);
- if (strm->avail_out == 0) {
- /* Since avail_out is 0, deflate will be called again with
- * more output space, but possibly with both pending and
- * avail_in equal to zero. There won't be anything to do,
- * but this is not an error situation so make sure we
- * return OK instead of BUF_ERROR at next call of deflate:
- */
- s->last_flush = -1;
- return Z_OK;
- }
-
- /* Make sure there is something to do and avoid duplicate consecutive
- * flushes. For repeated and useless calls with Z_FINISH, we keep
- * returning Z_STREAM_END instead of Z_BUF_ERROR.
- */
- } else if (strm->avail_in == 0 && RANK(flush) <= RANK(old_flush) &&
- flush != Z_FINISH) {
- ERR_RETURN(strm, Z_BUF_ERROR);
- }
-
- /* User must not provide more input after the first FINISH: */
- if (s->status == FINISH_STATE && strm->avail_in != 0) {
- ERR_RETURN(strm, Z_BUF_ERROR);
- }
-
- /* Start a new block or continue the current one.
- */
- if (strm->avail_in != 0 || s->lookahead != 0 ||
- (flush != Z_NO_FLUSH && s->status != FINISH_STATE)) {
- block_state bstate;
-
- bstate = s->strategy == Z_HUFFMAN_ONLY ? deflate_huff(s, flush) :
- (s->strategy == Z_RLE ? deflate_rle(s, flush) :
- (*(configuration_table[s->level].func))(s, flush));
-
- if (bstate == finish_started || bstate == finish_done) {
- s->status = FINISH_STATE;
- }
- if (bstate == need_more || bstate == finish_started) {
- if (strm->avail_out == 0) {
- s->last_flush = -1; /* avoid BUF_ERROR next call, see above */
- }
- return Z_OK;
- /* If flush != Z_NO_FLUSH && avail_out == 0, the next call
- * of deflate should use the same flush parameter to make sure
- * that the flush is complete. So we don't have to output an
- * empty block here, this will be done at next call. This also
- * ensures that for a very small output buffer, we emit at most
- * one empty block.
- */
- }
- if (bstate == block_done) {
- if (flush == Z_PARTIAL_FLUSH) {
- _tr_align(s);
- } else if (flush != Z_BLOCK) { /* FULL_FLUSH or SYNC_FLUSH */
- _tr_stored_block(s, (char*)0, 0L, 0);
- /* For a full flush, this empty block will be recognized
- * as a special marker by inflate_sync().
- */
- if (flush == Z_FULL_FLUSH) {
- CLEAR_HASH(s); /* forget history */
- if (s->lookahead == 0) {
- s->strstart = 0;
- s->block_start = 0L;
- s->insert = 0;
- }
- }
- }
- flush_pending(strm);
- if (strm->avail_out == 0) {
- s->last_flush = -1; /* avoid BUF_ERROR at next call, see above */
- return Z_OK;
- }
- }
- }
- Assert(strm->avail_out > 0, "bug2");
-
- if (flush != Z_FINISH) return Z_OK;
- if (s->wrap <= 0) return Z_STREAM_END;
-
- /* Write the trailer */
-#ifdef GZIP
- if (s->wrap == 2) {
- put_byte(s, (Byte)(strm->adler & 0xff));
- put_byte(s, (Byte)((strm->adler >> 8) & 0xff));
- put_byte(s, (Byte)((strm->adler >> 16) & 0xff));
- put_byte(s, (Byte)((strm->adler >> 24) & 0xff));
- put_byte(s, (Byte)(strm->total_in & 0xff));
- put_byte(s, (Byte)((strm->total_in >> 8) & 0xff));
- put_byte(s, (Byte)((strm->total_in >> 16) & 0xff));
- put_byte(s, (Byte)((strm->total_in >> 24) & 0xff));
- }
- else
-#endif
- {
- putShortMSB(s, (uInt)(strm->adler >> 16));
- putShortMSB(s, (uInt)(strm->adler & 0xffff));
- }
- flush_pending(strm);
- /* If avail_out is zero, the application will call deflate again
- * to flush the rest.
- */
- if (s->wrap > 0) s->wrap = -s->wrap; /* write the trailer only once! */
- return s->pending != 0 ? Z_OK : Z_STREAM_END;
-}
-
-/* ========================================================================= */
-int ZEXPORT deflateEnd (
- z_streamp strm)
-{
- int status;
-
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
-
- status = strm->state->status;
- if (status != INIT_STATE &&
- status != EXTRA_STATE &&
- status != NAME_STATE &&
- status != COMMENT_STATE &&
- status != HCRC_STATE &&
- status != BUSY_STATE &&
- status != FINISH_STATE) {
- return Z_STREAM_ERROR;
- }
-
- /* Deallocate in reverse order of allocations: */
- TRY_FREE(strm, strm->state->pending_buf);
- TRY_FREE(strm, strm->state->head);
- TRY_FREE(strm, strm->state->prev);
- TRY_FREE(strm, strm->state->window);
-
- ZFREE(strm, strm->state);
- strm->state = Z_NULL;
-
- return status == BUSY_STATE ? Z_DATA_ERROR : Z_OK;
-}
-
-/* =========================================================================
- * Copy the source state to the destination state.
- * To simplify the source, this is not supported for 16-bit MSDOS (which
- * doesn't have enough memory anyway to duplicate compression states).
- */
-int ZEXPORT deflateCopy (
- z_streamp dest,
- z_streamp source)
-{
-#ifdef MAXSEG_64K
- return Z_STREAM_ERROR;
-#else
- deflate_state *ds;
- deflate_state *ss;
- ushf *overlay;
-
-
- if (source == Z_NULL || dest == Z_NULL || source->state == Z_NULL) {
- return Z_STREAM_ERROR;
- }
-
- ss = source->state;
-
- zmemcpy((voidpf)dest, (voidpf)source, sizeof(z_stream));
-
- ds = (deflate_state *) ZALLOC(dest, 1, sizeof(deflate_state));
- if (ds == Z_NULL) return Z_MEM_ERROR;
- dest->state = (struct internal_state FAR *) ds;
- zmemcpy((voidpf)ds, (voidpf)ss, sizeof(deflate_state));
- ds->strm = dest;
-
- ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte));
- ds->prev = (Posf *) ZALLOC(dest, ds->w_size, sizeof(Pos));
- ds->head = (Posf *) ZALLOC(dest, ds->hash_size, sizeof(Pos));
- overlay = (ushf *) ZALLOC(dest, ds->lit_bufsize, sizeof(ush)+2);
- ds->pending_buf = (uchf *) overlay;
-
- if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL ||
- ds->pending_buf == Z_NULL) {
- deflateEnd (dest);
- return Z_MEM_ERROR;
- }
- /* following zmemcpy do not work for 16-bit MSDOS */
- zmemcpy(ds->window, ss->window, ds->w_size * 2 * sizeof(Byte));
- zmemcpy((voidpf)ds->prev, (voidpf)ss->prev, ds->w_size * sizeof(Pos));
- zmemcpy((voidpf)ds->head, (voidpf)ss->head, ds->hash_size * sizeof(Pos));
- zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size);
-
- ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf);
- ds->d_buf = overlay + ds->lit_bufsize/sizeof(ush);
- ds->l_buf = ds->pending_buf + (1+sizeof(ush))*ds->lit_bufsize;
-
- ds->l_desc.dyn_tree = ds->dyn_ltree;
- ds->d_desc.dyn_tree = ds->dyn_dtree;
- ds->bl_desc.dyn_tree = ds->bl_tree;
-
- return Z_OK;
-#endif /* MAXSEG_64K */
-}
-
-/* ===========================================================================
- * Read a new buffer from the current input stream, update the adler32
- * and total number of bytes read. All deflate() input goes through
- * this function so some applications may wish to modify it to avoid
- * allocating a large strm->next_in buffer and copying from it.
- * (See also flush_pending()).
- */
-local int read_buf(
- z_streamp strm,
- Bytef *buf,
- unsigned size)
-{
- unsigned len = strm->avail_in;
-
- if (len > size) len = size;
- if (len == 0) return 0;
-
- strm->avail_in -= len;
-
- zmemcpy(buf, strm->next_in, len);
- if (strm->state->wrap == 1) {
- strm->adler = adler32(strm->adler, buf, len);
- }
-#ifdef GZIP
- else if (strm->state->wrap == 2) {
- strm->adler = crc32(strm->adler, buf, len);
- }
-#endif
- strm->next_in += len;
- strm->total_in += len;
-
- return (int)len;
-}
-
-/* ===========================================================================
- * Initialize the "longest match" routines for a new zlib stream
- */
-local void lm_init (
- deflate_state *s)
-{
- s->window_size = (ulg)2L*s->w_size;
-
- CLEAR_HASH(s);
-
- /* Set the default configuration parameters:
- */
- s->max_lazy_match = configuration_table[s->level].max_lazy;
- s->good_match = configuration_table[s->level].good_length;
- s->nice_match = configuration_table[s->level].nice_length;
- s->max_chain_length = configuration_table[s->level].max_chain;
-
- s->strstart = 0;
- s->block_start = 0L;
- s->lookahead = 0;
- s->insert = 0;
- s->match_length = s->prev_length = MIN_MATCH-1;
- s->match_available = 0;
- s->ins_h = 0;
-#ifndef FASTEST
-#ifdef ASMV
- match_init(); /* initialize the asm code */
-#endif
-#endif
-}
-
-#ifndef FASTEST
-/* ===========================================================================
- * Set match_start to the longest match starting at the given string and
- * return its length. Matches shorter or equal to prev_length are discarded,
- * in which case the result is equal to prev_length and match_start is
- * garbage.
- * IN assertions: cur_match is the head of the hash chain for the current
- * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1
- * OUT assertion: the match length is not greater than s->lookahead.
- */
-#ifndef ASMV
-/* For 80x86 and 680x0, an optimized version will be provided in match.asm or
- * match.S. The code will be functionally equivalent.
- */
-local uInt longest_match(
- deflate_state *s,
- IPos cur_match) /* current match */
-{
- unsigned chain_length = s->max_chain_length;/* max hash chain length */
- register Bytef *scan = s->window + s->strstart; /* current string */
- register Bytef *match; /* matched string */
- register int len; /* length of current match */
- int best_len = s->prev_length; /* best match length so far */
- int nice_match = s->nice_match; /* stop if match long enough */
- IPos limit = s->strstart > (IPos)MAX_DIST(s) ?
- s->strstart - (IPos)MAX_DIST(s) : NIL;
- /* Stop when cur_match becomes <= limit. To simplify the code,
- * we prevent matches with the string of window index 0.
- */
- Posf *prev = s->prev;
- uInt wmask = s->w_mask;
-
-#ifdef UNALIGNED_OK
- /* Compare two bytes at a time. Note: this is not always beneficial.
- * Try with and without -DUNALIGNED_OK to check.
- */
- register Bytef *strend = s->window + s->strstart + MAX_MATCH - 1;
- register ush scan_start = *(ushf*)scan;
- register ush scan_end = *(ushf*)(scan+best_len-1);
-#else
- register Bytef *strend = s->window + s->strstart + MAX_MATCH;
- register Byte scan_end1 = scan[best_len-1];
- register Byte scan_end = scan[best_len];
-#endif
-
- /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.
- * It is easy to get rid of this optimization if necessary.
- */
- Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever");
-
- /* Do not waste too much time if we already have a good match: */
- if (s->prev_length >= s->good_match) {
- chain_length >>= 2;
- }
- /* Do not look for matches beyond the end of the input. This is necessary
- * to make deflate deterministic.
- */
- if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead;
-
- Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead");
-
- do {
- Assert(cur_match < s->strstart, "no future");
- match = s->window + cur_match;
-
- /* Skip to next match if the match length cannot increase
- * or if the match length is less than 2. Note that the checks below
- * for insufficient lookahead only occur occasionally for performance
- * reasons. Therefore uninitialized memory will be accessed, and
- * conditional jumps will be made that depend on those values.
- * However the length of the match is limited to the lookahead, so
- * the output of deflate is not affected by the uninitialized values.
- */
-#if (defined(UNALIGNED_OK) && MAX_MATCH == 258)
- /* This code assumes sizeof(unsigned short) == 2. Do not use
- * UNALIGNED_OK if your compiler uses a different size.
- */
- if (*(ushf*)(match+best_len-1) != scan_end ||
- *(ushf*)match != scan_start) continue;
-
- /* It is not necessary to compare scan[2] and match[2] since they are
- * always equal when the other bytes match, given that the hash keys
- * are equal and that HASH_BITS >= 8. Compare 2 bytes at a time at
- * strstart+3, +5, ... up to strstart+257. We check for insufficient
- * lookahead only every 4th comparison; the 128th check will be made
- * at strstart+257. If MAX_MATCH-2 is not a multiple of 8, it is
- * necessary to put more guard bytes at the end of the window, or
- * to check more often for insufficient lookahead.
- */
- Assert(scan[2] == match[2], "scan[2]?");
- scan++, match++;
- do {
- } while (*(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
- *(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
- *(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
- *(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
- scan < strend);
- /* The funny "do {}" generates better code on most compilers */
-
- /* Here, scan <= window+strstart+257 */
- Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
- if (*scan == *match) scan++;
-
- len = (MAX_MATCH - 1) - (int)(strend-scan);
- scan = strend - (MAX_MATCH-1);
-
-#else /* UNALIGNED_OK */
-
- if (match[best_len] != scan_end ||
- match[best_len-1] != scan_end1 ||
- *match != *scan ||
- *++match != scan[1]) continue;
-
- /* The check at best_len-1 can be removed because it will be made
- * again later. (This heuristic is not always a win.)
- * It is not necessary to compare scan[2] and match[2] since they
- * are always equal when the other bytes match, given that
- * the hash keys are equal and that HASH_BITS >= 8.
- */
- scan += 2, match++;
- Assert(*scan == *match, "match[2]?");
-
- /* We check for insufficient lookahead only every 8th comparison;
- * the 256th check will be made at strstart+258.
- */
- do {
- } while (*++scan == *++match && *++scan == *++match &&
- *++scan == *++match && *++scan == *++match &&
- *++scan == *++match && *++scan == *++match &&
- *++scan == *++match && *++scan == *++match &&
- scan < strend);
-
- Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
-
- len = MAX_MATCH - (int)(strend - scan);
- scan = strend - MAX_MATCH;
-
-#endif /* UNALIGNED_OK */
-
- if (len > best_len) {
- s->match_start = cur_match;
- best_len = len;
- if (len >= nice_match) break;
-#ifdef UNALIGNED_OK
- scan_end = *(ushf*)(scan+best_len-1);
-#else
- scan_end1 = scan[best_len-1];
- scan_end = scan[best_len];
-#endif
- }
- } while ((cur_match = prev[cur_match & wmask]) > limit
- && --chain_length != 0);
-
- if ((uInt)best_len <= s->lookahead) return (uInt)best_len;
- return s->lookahead;
-}
-#endif /* ASMV */
-
-#else /* FASTEST */
-
-/* ---------------------------------------------------------------------------
- * Optimized version for FASTEST only
- */
-local uInt longest_match(
- deflate_state *s,
- IPos cur_match) /* current match */
-{
- register Bytef *scan = s->window + s->strstart; /* current string */
- register Bytef *match; /* matched string */
- register int len; /* length of current match */
- register Bytef *strend = s->window + s->strstart + MAX_MATCH;
-
- /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.
- * It is easy to get rid of this optimization if necessary.
- */
- Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever");
-
- Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead");
-
- Assert(cur_match < s->strstart, "no future");
-
- match = s->window + cur_match;
-
- /* Return failure if the match length is less than 2:
- */
- if (match[0] != scan[0] || match[1] != scan[1]) return MIN_MATCH-1;
-
- /* The check at best_len-1 can be removed because it will be made
- * again later. (This heuristic is not always a win.)
- * It is not necessary to compare scan[2] and match[2] since they
- * are always equal when the other bytes match, given that
- * the hash keys are equal and that HASH_BITS >= 8.
- */
- scan += 2, match += 2;
- Assert(*scan == *match, "match[2]?");
-
- /* We check for insufficient lookahead only every 8th comparison;
- * the 256th check will be made at strstart+258.
- */
- do {
- } while (*++scan == *++match && *++scan == *++match &&
- *++scan == *++match && *++scan == *++match &&
- *++scan == *++match && *++scan == *++match &&
- *++scan == *++match && *++scan == *++match &&
- scan < strend);
-
- Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
-
- len = MAX_MATCH - (int)(strend - scan);
-
- if (len < MIN_MATCH) return MIN_MATCH - 1;
-
- s->match_start = cur_match;
- return (uInt)len <= s->lookahead ? (uInt)len : s->lookahead;
-}
-
-#endif /* FASTEST */
-
-#ifdef DEBUG
-/* ===========================================================================
- * Check that the match at match_start is indeed a match.
- */
-local void check_match(
- deflate_state *s,
- IPos start, IPos match,
- int length)
-{
- /* check that the match is indeed a match */
- if (zmemcmp(s->window + match,
- s->window + start, length) != EQUAL) {
- fprintf(stderr, " start %u, match %u, length %d\n",
- start, match, length);
- do {
- fprintf(stderr, "%c%c", s->window[match++], s->window[start++]);
- } while (--length != 0);
- z_error("invalid match");
- }
- if (z_verbose > 1) {
- fprintf(stderr,"\\[%d,%d]", start-match, length);
- do { putc(s->window[start++], stderr); } while (--length != 0);
- }
-}
-#else
-# define check_match(s, start, match, length)
-#endif /* DEBUG */
-
-/* ===========================================================================
- * Fill the window when the lookahead becomes insufficient.
- * Updates strstart and lookahead.
- *
- * IN assertion: lookahead < MIN_LOOKAHEAD
- * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD
- * At least one byte has been read, or avail_in == 0; reads are
- * performed for at least two bytes (required for the zip translate_eol
- * option -- not supported here).
- */
-local void fill_window(
- deflate_state *s)
-{
- register unsigned n, m;
- register Posf *p;
- unsigned more; /* Amount of free space at the end of the window. */
- uInt wsize = s->w_size;
-
- Assert(s->lookahead < MIN_LOOKAHEAD, "already enough lookahead");
-
- do {
- more = (unsigned)(s->window_size -(ulg)s->lookahead -(ulg)s->strstart);
-
- /* Deal with !@#$% 64K limit: */
- if (sizeof(int) <= 2) {
- if (more == 0 && s->strstart == 0 && s->lookahead == 0) {
- more = wsize;
-
- } else if (more == (unsigned)(-1)) {
- /* Very unlikely, but possible on 16 bit machine if
- * strstart == 0 && lookahead == 1 (input done a byte at time)
- */
- more--;
- }
- }
-
- /* If the window is almost full and there is insufficient lookahead,
- * move the upper half to the lower one to make room in the upper half.
- */
- if (s->strstart >= wsize+MAX_DIST(s)) {
-
- zmemcpy(s->window, s->window+wsize, (unsigned)wsize);
- s->match_start -= wsize;
- s->strstart -= wsize; /* we now have strstart >= MAX_DIST */
- s->block_start -= (long) wsize;
-
- /* Slide the hash table (could be avoided with 32 bit values
- at the expense of memory usage). We slide even when level == 0
- to keep the hash table consistent if we switch back to level > 0
- later. (Using level 0 permanently is not an optimal usage of
- zlib, so we don't care about this pathological case.)
- */
- n = s->hash_size;
- p = &s->head[n];
- do {
- m = *--p;
- *p = (Pos)(m >= wsize ? m-wsize : NIL);
- } while (--n);
-
- n = wsize;
-#ifndef FASTEST
- p = &s->prev[n];
- do {
- m = *--p;
- *p = (Pos)(m >= wsize ? m-wsize : NIL);
- /* If n is not on any hash chain, prev[n] is garbage but
- * its value will never be used.
- */
- } while (--n);
-#endif
- more += wsize;
- }
- if (s->strm->avail_in == 0) break;
-
- /* If there was no sliding:
- * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 &&
- * more == window_size - lookahead - strstart
- * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1)
- * => more >= window_size - 2*WSIZE + 2
- * In the BIG_MEM or MMAP case (not yet supported),
- * window_size == input_size + MIN_LOOKAHEAD &&
- * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD.
- * Otherwise, window_size == 2*WSIZE so more >= 2.
- * If there was sliding, more >= WSIZE. So in all cases, more >= 2.
- */
- Assert(more >= 2, "more < 2");
-
- n = read_buf(s->strm, s->window + s->strstart + s->lookahead, more);
- s->lookahead += n;
-
- /* Initialize the hash value now that we have some input: */
- if (s->lookahead + s->insert >= MIN_MATCH) {
- uInt str = s->strstart - s->insert;
- s->ins_h = s->window[str];
- UPDATE_HASH(s, s->ins_h, s->window[str + 1]);
-#if MIN_MATCH != 3
- Call UPDATE_HASH() MIN_MATCH-3 more times
-#endif
- while (s->insert) {
- UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]);
-#ifndef FASTEST
- s->prev[str & s->w_mask] = s->head[s->ins_h];
-#endif
- s->head[s->ins_h] = (Pos)str;
- str++;
- s->insert--;
- if (s->lookahead + s->insert < MIN_MATCH)
- break;
- }
- }
- /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage,
- * but this is not important since only literal bytes will be emitted.
- */
-
- } while (s->lookahead < MIN_LOOKAHEAD && s->strm->avail_in != 0);
-
- /* If the WIN_INIT bytes after the end of the current data have never been
- * written, then zero those bytes in order to avoid memory check reports of
- * the use of uninitialized (or uninitialised as Julian writes) bytes by
- * the longest match routines. Update the high water mark for the next
- * time through here. WIN_INIT is set to MAX_MATCH since the longest match
- * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead.
- */
- if (s->high_water < s->window_size) {
- ulg curr = s->strstart + (ulg)(s->lookahead);
- ulg init;
-
- if (s->high_water < curr) {
- /* Previous high water mark below current data -- zero WIN_INIT
- * bytes or up to end of window, whichever is less.
- */
- init = s->window_size - curr;
- if (init > WIN_INIT)
- init = WIN_INIT;
- zmemzero(s->window + curr, (unsigned)init);
- s->high_water = curr + init;
- }
- else if (s->high_water < (ulg)curr + WIN_INIT) {
- /* High water mark at or above current data, but below current data
- * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up
- * to end of window, whichever is less.
- */
- init = (ulg)curr + WIN_INIT - s->high_water;
- if (init > s->window_size - s->high_water)
- init = s->window_size - s->high_water;
- zmemzero(s->window + s->high_water, (unsigned)init);
- s->high_water += init;
- }
- }
-
- Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD,
- "not enough room for search");
-}
-
-/* ===========================================================================
- * Flush the current block, with given end-of-file flag.
- * IN assertion: strstart is set to the end of the current match.
- */
-#define FLUSH_BLOCK_ONLY(s, last) { \
- _tr_flush_block(s, (s->block_start >= 0L ? \
- (charf *)&s->window[(unsigned)s->block_start] : \
- (charf *)Z_NULL), \
- (ulg)((long)s->strstart - s->block_start), \
- (last)); \
- s->block_start = s->strstart; \
- flush_pending(s->strm); \
- Tracev((stderr,"[FLUSH]")); \
-}
-
-/* Same but force premature exit if necessary. */
-#define FLUSH_BLOCK(s, last) { \
- FLUSH_BLOCK_ONLY(s, last); \
- if (s->strm->avail_out == 0) return (last) ? finish_started : need_more; \
-}
-
-/* ===========================================================================
- * Copy without compression as much as possible from the input stream, return
- * the current block state.
- * This function does not insert new strings in the dictionary since
- * uncompressible data is probably not useful. This function is used
- * only for the level=0 compression option.
- * NOTE: this function should be optimized to avoid extra copying from
- * window to pending_buf.
- */
-local block_state deflate_stored(
- deflate_state *s,
- int flush)
-{
- /* Stored blocks are limited to 0xffff bytes, pending_buf is limited
- * to pending_buf_size, and each stored block has a 5 byte header:
- */
- ulg max_block_size = 0xffff;
- ulg max_start;
-
- if (max_block_size > s->pending_buf_size - 5) {
- max_block_size = s->pending_buf_size - 5;
- }
-
- /* Copy as much as possible from input to output: */
- for (;;) {
- /* Fill the window as much as possible: */
- if (s->lookahead <= 1) {
-
- Assert(s->strstart < s->w_size+MAX_DIST(s) ||
- s->block_start >= (long)s->w_size, "slide too late");
-
- fill_window(s);
- if (s->lookahead == 0 && flush == Z_NO_FLUSH) return need_more;
-
- if (s->lookahead == 0) break; /* flush the current block */
- }
- Assert(s->block_start >= 0L, "block gone");
-
- s->strstart += s->lookahead;
- s->lookahead = 0;
-
- /* Emit a stored block if pending_buf will be full: */
- max_start = s->block_start + max_block_size;
- if (s->strstart == 0 || (ulg)s->strstart >= max_start) {
- /* strstart == 0 is possible when wraparound on 16-bit machine */
- s->lookahead = (uInt)(s->strstart - max_start);
- s->strstart = (uInt)max_start;
- FLUSH_BLOCK(s, 0);
- }
- /* Flush if we may have to slide, otherwise block_start may become
- * negative and the data will be gone:
- */
- if (s->strstart - (uInt)s->block_start >= MAX_DIST(s)) {
- FLUSH_BLOCK(s, 0);
- }
- }
- s->insert = 0;
- if (flush == Z_FINISH) {
- FLUSH_BLOCK(s, 1);
- return finish_done;
- }
- if ((long)s->strstart > s->block_start)
- FLUSH_BLOCK(s, 0);
- return block_done;
-}
-
-/* ===========================================================================
- * Compress as much as possible from the input stream, return the current
- * block state.
- * This function does not perform lazy evaluation of matches and inserts
- * new strings in the dictionary only for unmatched strings or for short
- * matches. It is used only for the fast compression options.
- */
-local block_state deflate_fast(
- deflate_state *s,
- int flush)
-{
- IPos hash_head; /* head of the hash chain */
- int bflush; /* set if current block must be flushed */
-
- for (;;) {
- /* Make sure that we always have enough lookahead, except
- * at the end of the input file. We need MAX_MATCH bytes
- * for the next match, plus MIN_MATCH bytes to insert the
- * string following the next match.
- */
- if (s->lookahead < MIN_LOOKAHEAD) {
- fill_window(s);
- if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) {
- return need_more;
- }
- if (s->lookahead == 0) break; /* flush the current block */
- }
-
- /* Insert the string window[strstart .. strstart+2] in the
- * dictionary, and set hash_head to the head of the hash chain:
- */
- hash_head = NIL;
- if (s->lookahead >= MIN_MATCH) {
- INSERT_STRING(s, s->strstart, hash_head);
- }
-
- /* Find the longest match, discarding those <= prev_length.
- * At this point we have always match_length < MIN_MATCH
- */
- if (hash_head != NIL && s->strstart - hash_head <= MAX_DIST(s)) {
- /* To simplify the code, we prevent matches with the string
- * of window index 0 (in particular we have to avoid a match
- * of the string with itself at the start of the input file).
- */
- s->match_length = longest_match (s, hash_head);
- /* longest_match() sets match_start */
- }
- if (s->match_length >= MIN_MATCH) {
- check_match(s, s->strstart, s->match_start, s->match_length);
-
- _tr_tally_dist(s, s->strstart - s->match_start,
- s->match_length - MIN_MATCH, bflush);
-
- s->lookahead -= s->match_length;
-
- /* Insert new strings in the hash table only if the match length
- * is not too large. This saves time but degrades compression.
- */
-#ifndef FASTEST
- if (s->match_length <= s->max_insert_length &&
- s->lookahead >= MIN_MATCH) {
- s->match_length--; /* string at strstart already in table */
- do {
- s->strstart++;
- INSERT_STRING(s, s->strstart, hash_head);
- /* strstart never exceeds WSIZE-MAX_MATCH, so there are
- * always MIN_MATCH bytes ahead.
- */
- } while (--s->match_length != 0);
- s->strstart++;
- } else
-#endif
- {
- s->strstart += s->match_length;
- s->match_length = 0;
- s->ins_h = s->window[s->strstart];
- UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]);
-#if MIN_MATCH != 3
- Call UPDATE_HASH() MIN_MATCH-3 more times
-#endif
- /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not
- * matter since it will be recomputed at next deflate call.
- */
- }
- } else {
- /* No match, output a literal byte */
- Tracevv((stderr,"%c", s->window[s->strstart]));
- _tr_tally_lit (s, s->window[s->strstart], bflush);
- s->lookahead--;
- s->strstart++;
- }
- if (bflush) FLUSH_BLOCK(s, 0);
- }
- s->insert = s->strstart < MIN_MATCH-1 ? s->strstart : MIN_MATCH-1;
- if (flush == Z_FINISH) {
- FLUSH_BLOCK(s, 1);
- return finish_done;
- }
- if (s->last_lit)
- FLUSH_BLOCK(s, 0);
- return block_done;
-}
-
-#ifndef FASTEST
-/* ===========================================================================
- * Same as above, but achieves better compression. We use a lazy
- * evaluation for matches: a match is finally adopted only if there is
- * no better match at the next window position.
- */
-local block_state deflate_slow(
- deflate_state *s,
- int flush)
-{
- IPos hash_head; /* head of hash chain */
- int bflush; /* set if current block must be flushed */
-
- /* Process the input block. */
- for (;;) {
- /* Make sure that we always have enough lookahead, except
- * at the end of the input file. We need MAX_MATCH bytes
- * for the next match, plus MIN_MATCH bytes to insert the
- * string following the next match.
- */
- if (s->lookahead < MIN_LOOKAHEAD) {
- fill_window(s);
- if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) {
- return need_more;
- }
- if (s->lookahead == 0) break; /* flush the current block */
- }
-
- /* Insert the string window[strstart .. strstart+2] in the
- * dictionary, and set hash_head to the head of the hash chain:
- */
- hash_head = NIL;
- if (s->lookahead >= MIN_MATCH) {
- INSERT_STRING(s, s->strstart, hash_head);
- }
-
- /* Find the longest match, discarding those <= prev_length.
- */
- s->prev_length = s->match_length, s->prev_match = s->match_start;
- s->match_length = MIN_MATCH-1;
-
- if (hash_head != NIL && s->prev_length < s->max_lazy_match &&
- s->strstart - hash_head <= MAX_DIST(s)) {
- /* To simplify the code, we prevent matches with the string
- * of window index 0 (in particular we have to avoid a match
- * of the string with itself at the start of the input file).
- */
- s->match_length = longest_match (s, hash_head);
- /* longest_match() sets match_start */
-
- if (s->match_length <= 5 && (s->strategy == Z_FILTERED
-#if TOO_FAR <= 32767
- || (s->match_length == MIN_MATCH &&
- s->strstart - s->match_start > TOO_FAR)
-#endif
- )) {
-
- /* If prev_match is also MIN_MATCH, match_start is garbage
- * but we will ignore the current match anyway.
- */
- s->match_length = MIN_MATCH-1;
- }
- }
- /* If there was a match at the previous step and the current
- * match is not better, output the previous match:
- */
- if (s->prev_length >= MIN_MATCH && s->match_length <= s->prev_length) {
- uInt max_insert = s->strstart + s->lookahead - MIN_MATCH;
- /* Do not insert strings in hash table beyond this. */
-
- check_match(s, s->strstart-1, s->prev_match, s->prev_length);
-
- _tr_tally_dist(s, s->strstart -1 - s->prev_match,
- s->prev_length - MIN_MATCH, bflush);
-
- /* Insert in hash table all strings up to the end of the match.
- * strstart-1 and strstart are already inserted. If there is not
- * enough lookahead, the last two strings are not inserted in
- * the hash table.
- */
- s->lookahead -= s->prev_length-1;
- s->prev_length -= 2;
- do {
- if (++s->strstart <= max_insert) {
- INSERT_STRING(s, s->strstart, hash_head);
- }
- } while (--s->prev_length != 0);
- s->match_available = 0;
- s->match_length = MIN_MATCH-1;
- s->strstart++;
-
- if (bflush) FLUSH_BLOCK(s, 0);
-
- } else if (s->match_available) {
- /* If there was no match at the previous position, output a
- * single literal. If there was a match but the current match
- * is longer, truncate the previous match to a single literal.
- */
- Tracevv((stderr,"%c", s->window[s->strstart-1]));
- _tr_tally_lit(s, s->window[s->strstart-1], bflush);
- if (bflush) {
- FLUSH_BLOCK_ONLY(s, 0);
- }
- s->strstart++;
- s->lookahead--;
- if (s->strm->avail_out == 0) return need_more;
- } else {
- /* There is no previous match to compare with, wait for
- * the next step to decide.
- */
- s->match_available = 1;
- s->strstart++;
- s->lookahead--;
- }
- }
- Assert (flush != Z_NO_FLUSH, "no flush?");
- if (s->match_available) {
- Tracevv((stderr,"%c", s->window[s->strstart-1]));
- _tr_tally_lit(s, s->window[s->strstart-1], bflush);
- s->match_available = 0;
- }
- s->insert = s->strstart < MIN_MATCH-1 ? s->strstart : MIN_MATCH-1;
- if (flush == Z_FINISH) {
- FLUSH_BLOCK(s, 1);
- return finish_done;
- }
- if (s->last_lit)
- FLUSH_BLOCK(s, 0);
- return block_done;
-}
-#endif /* FASTEST */
-
-/* ===========================================================================
- * For Z_RLE, simply look for runs of bytes, generate matches only of distance
- * one. Do not maintain a hash table. (It will be regenerated if this run of
- * deflate switches away from Z_RLE.)
- */
-local block_state deflate_rle(
- deflate_state *s,
- int flush)
-{
- int bflush; /* set if current block must be flushed */
- uInt prev; /* byte at distance one to match */
- Bytef *scan, *strend; /* scan goes up to strend for length of run */
-
- for (;;) {
- /* Make sure that we always have enough lookahead, except
- * at the end of the input file. We need MAX_MATCH bytes
- * for the longest run, plus one for the unrolled loop.
- */
- if (s->lookahead <= MAX_MATCH) {
- fill_window(s);
- if (s->lookahead <= MAX_MATCH && flush == Z_NO_FLUSH) {
- return need_more;
- }
- if (s->lookahead == 0) break; /* flush the current block */
- }
-
- /* See how many times the previous byte repeats */
- s->match_length = 0;
- if (s->lookahead >= MIN_MATCH && s->strstart > 0) {
- scan = s->window + s->strstart - 1;
- prev = *scan;
- if (prev == *++scan && prev == *++scan && prev == *++scan) {
- strend = s->window + s->strstart + MAX_MATCH;
- do {
- } while (prev == *++scan && prev == *++scan &&
- prev == *++scan && prev == *++scan &&
- prev == *++scan && prev == *++scan &&
- prev == *++scan && prev == *++scan &&
- scan < strend);
- s->match_length = MAX_MATCH - (int)(strend - scan);
- if (s->match_length > s->lookahead)
- s->match_length = s->lookahead;
- }
- Assert(scan <= s->window+(uInt)(s->window_size-1), "wild scan");
- }
-
- /* Emit match if have run of MIN_MATCH or longer, else emit literal */
- if (s->match_length >= MIN_MATCH) {
- check_match(s, s->strstart, s->strstart - 1, s->match_length);
-
- _tr_tally_dist(s, 1, s->match_length - MIN_MATCH, bflush);
-
- s->lookahead -= s->match_length;
- s->strstart += s->match_length;
- s->match_length = 0;
- } else {
- /* No match, output a literal byte */
- Tracevv((stderr,"%c", s->window[s->strstart]));
- _tr_tally_lit (s, s->window[s->strstart], bflush);
- s->lookahead--;
- s->strstart++;
- }
- if (bflush) FLUSH_BLOCK(s, 0);
- }
- s->insert = 0;
- if (flush == Z_FINISH) {
- FLUSH_BLOCK(s, 1);
- return finish_done;
- }
- if (s->last_lit)
- FLUSH_BLOCK(s, 0);
- return block_done;
-}
-
-/* ===========================================================================
- * For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table.
- * (It will be regenerated if this run of deflate switches away from Huffman.)
- */
-local block_state deflate_huff(
- deflate_state *s,
- int flush)
-{
- int bflush; /* set if current block must be flushed */
-
- for (;;) {
- /* Make sure that we have a literal to write. */
- if (s->lookahead == 0) {
- fill_window(s);
- if (s->lookahead == 0) {
- if (flush == Z_NO_FLUSH)
- return need_more;
- break; /* flush the current block */
- }
- }
-
- /* Output a literal byte */
- s->match_length = 0;
- Tracevv((stderr,"%c", s->window[s->strstart]));
- _tr_tally_lit (s, s->window[s->strstart], bflush);
- s->lookahead--;
- s->strstart++;
- if (bflush) FLUSH_BLOCK(s, 0);
- }
- s->insert = 0;
- if (flush == Z_FINISH) {
- FLUSH_BLOCK(s, 1);
- return finish_done;
- }
- if (s->last_lit)
- FLUSH_BLOCK(s, 0);
- return block_done;
-}
diff --git a/chromium/third_party/pdfium/third_party/zlib_v128/deflate.h b/chromium/third_party/pdfium/third_party/zlib_v128/deflate.h
deleted file mode 100644
index ce0299edd19..00000000000
--- a/chromium/third_party/pdfium/third_party/zlib_v128/deflate.h
+++ /dev/null
@@ -1,346 +0,0 @@
-/* deflate.h -- internal compression state
- * Copyright (C) 1995-2012 Jean-loup Gailly
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* WARNING: this file should *not* be used by applications. It is
- part of the implementation of the compression library and is
- subject to change. Applications should only use zlib.h.
- */
-
-/* @(#) $Id$ */
-
-#ifndef DEFLATE_H
-#define DEFLATE_H
-
-#include "zutil.h"
-
-/* define NO_GZIP when compiling if you want to disable gzip header and
- trailer creation by deflate(). NO_GZIP would be used to avoid linking in
- the crc code when it is not needed. For shared libraries, gzip encoding
- should be left enabled. */
-#ifndef NO_GZIP
-# define GZIP
-#endif
-
-/* ===========================================================================
- * Internal compression state.
- */
-
-#define LENGTH_CODES 29
-/* number of length codes, not counting the special END_BLOCK code */
-
-#define LITERALS 256
-/* number of literal bytes 0..255 */
-
-#define L_CODES (LITERALS+1+LENGTH_CODES)
-/* number of Literal or Length codes, including the END_BLOCK code */
-
-#define D_CODES 30
-/* number of distance codes */
-
-#define BL_CODES 19
-/* number of codes used to transfer the bit lengths */
-
-#define HEAP_SIZE (2*L_CODES+1)
-/* maximum heap size */
-
-#define MAX_BITS 15
-/* All codes must not exceed MAX_BITS bits */
-
-#define Buf_size 16
-/* size of bit buffer in bi_buf */
-
-#define INIT_STATE 42
-#define EXTRA_STATE 69
-#define NAME_STATE 73
-#define COMMENT_STATE 91
-#define HCRC_STATE 103
-#define BUSY_STATE 113
-#define FINISH_STATE 666
-/* Stream status */
-
-
-/* Data structure describing a single value and its code string. */
-typedef struct ct_data_s {
- union {
- ush freq; /* frequency count */
- ush code; /* bit string */
- } fc;
- union {
- ush dad; /* father node in Huffman tree */
- ush len; /* length of bit string */
- } dl;
-} FAR ct_data;
-
-#define Freq fc.freq
-#define Code fc.code
-#define Dad dl.dad
-#define Len dl.len
-
-typedef struct static_tree_desc_s static_tree_desc;
-
-typedef struct tree_desc_s {
- ct_data *dyn_tree; /* the dynamic tree */
- int max_code; /* largest code with non zero frequency */
- static_tree_desc *stat_desc; /* the corresponding static tree */
-} FAR tree_desc;
-
-typedef ush Pos;
-typedef Pos FAR Posf;
-typedef unsigned IPos;
-
-/* A Pos is an index in the character window. We use short instead of int to
- * save space in the various tables. IPos is used only for parameter passing.
- */
-
-typedef struct internal_state {
- z_streamp strm; /* pointer back to this zlib stream */
- int status; /* as the name implies */
- Bytef *pending_buf; /* output still pending */
- ulg pending_buf_size; /* size of pending_buf */
- Bytef *pending_out; /* next pending byte to output to the stream */
- uInt pending; /* nb of bytes in the pending buffer */
- int wrap; /* bit 0 true for zlib, bit 1 true for gzip */
- gz_headerp gzhead; /* gzip header information to write */
- uInt gzindex; /* where in extra, name, or comment */
- Byte method; /* can only be DEFLATED */
- int last_flush; /* value of flush param for previous deflate call */
-
- /* used by deflate.c: */
-
- uInt w_size; /* LZ77 window size (32K by default) */
- uInt w_bits; /* log2(w_size) (8..16) */
- uInt w_mask; /* w_size - 1 */
-
- Bytef *window;
- /* Sliding window. Input bytes are read into the second half of the window,
- * and move to the first half later to keep a dictionary of at least wSize
- * bytes. With this organization, matches are limited to a distance of
- * wSize-MAX_MATCH bytes, but this ensures that IO is always
- * performed with a length multiple of the block size. Also, it limits
- * the window size to 64K, which is quite useful on MSDOS.
- * To do: use the user input buffer as sliding window.
- */
-
- ulg window_size;
- /* Actual size of window: 2*wSize, except when the user input buffer
- * is directly used as sliding window.
- */
-
- Posf *prev;
- /* Link to older string with same hash index. To limit the size of this
- * array to 64K, this link is maintained only for the last 32K strings.
- * An index in this array is thus a window index modulo 32K.
- */
-
- Posf *head; /* Heads of the hash chains or NIL. */
-
- uInt ins_h; /* hash index of string to be inserted */
- uInt hash_size; /* number of elements in hash table */
- uInt hash_bits; /* log2(hash_size) */
- uInt hash_mask; /* hash_size-1 */
-
- uInt hash_shift;
- /* Number of bits by which ins_h must be shifted at each input
- * step. It must be such that after MIN_MATCH steps, the oldest
- * byte no longer takes part in the hash key, that is:
- * hash_shift * MIN_MATCH >= hash_bits
- */
-
- long block_start;
- /* Window position at the beginning of the current output block. Gets
- * negative when the window is moved backwards.
- */
-
- uInt match_length; /* length of best match */
- IPos prev_match; /* previous match */
- int match_available; /* set if previous match exists */
- uInt strstart; /* start of string to insert */
- uInt match_start; /* start of matching string */
- uInt lookahead; /* number of valid bytes ahead in window */
-
- uInt prev_length;
- /* Length of the best match at previous step. Matches not greater than this
- * are discarded. This is used in the lazy match evaluation.
- */
-
- uInt max_chain_length;
- /* To speed up deflation, hash chains are never searched beyond this
- * length. A higher limit improves compression ratio but degrades the
- * speed.
- */
-
- uInt max_lazy_match;
- /* Attempt to find a better match only when the current match is strictly
- * smaller than this value. This mechanism is used only for compression
- * levels >= 4.
- */
-# define max_insert_length max_lazy_match
- /* Insert new strings in the hash table only if the match length is not
- * greater than this length. This saves time but degrades compression.
- * max_insert_length is used only for compression levels <= 3.
- */
-
- int level; /* compression level (1..9) */
- int strategy; /* favor or force Huffman coding*/
-
- uInt good_match;
- /* Use a faster search when the previous match is longer than this */
-
- int nice_match; /* Stop searching when current match exceeds this */
-
- /* used by trees.c: */
- /* Didn't use ct_data typedef below to suppress compiler warning */
- struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */
- struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */
- struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */
-
- struct tree_desc_s l_desc; /* desc. for literal tree */
- struct tree_desc_s d_desc; /* desc. for distance tree */
- struct tree_desc_s bl_desc; /* desc. for bit length tree */
-
- ush bl_count[MAX_BITS+1];
- /* number of codes at each bit length for an optimal tree */
-
- int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */
- int heap_len; /* number of elements in the heap */
- int heap_max; /* element of largest frequency */
- /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used.
- * The same heap array is used to build all trees.
- */
-
- uch depth[2*L_CODES+1];
- /* Depth of each subtree used as tie breaker for trees of equal frequency
- */
-
- uchf *l_buf; /* buffer for literals or lengths */
-
- uInt lit_bufsize;
- /* Size of match buffer for literals/lengths. There are 4 reasons for
- * limiting lit_bufsize to 64K:
- * - frequencies can be kept in 16 bit counters
- * - if compression is not successful for the first block, all input
- * data is still in the window so we can still emit a stored block even
- * when input comes from standard input. (This can also be done for
- * all blocks if lit_bufsize is not greater than 32K.)
- * - if compression is not successful for a file smaller than 64K, we can
- * even emit a stored file instead of a stored block (saving 5 bytes).
- * This is applicable only for zip (not gzip or zlib).
- * - creating new Huffman trees less frequently may not provide fast
- * adaptation to changes in the input data statistics. (Take for
- * example a binary file with poorly compressible code followed by
- * a highly compressible string table.) Smaller buffer sizes give
- * fast adaptation but have of course the overhead of transmitting
- * trees more frequently.
- * - I can't count above 4
- */
-
- uInt last_lit; /* running index in l_buf */
-
- ushf *d_buf;
- /* Buffer for distances. To simplify the code, d_buf and l_buf have
- * the same number of elements. To use different lengths, an extra flag
- * array would be necessary.
- */
-
- ulg opt_len; /* bit length of current block with optimal trees */
- ulg static_len; /* bit length of current block with static trees */
- uInt matches; /* number of string matches in current block */
- uInt insert; /* bytes at end of window left to insert */
-
-#ifdef DEBUG
- ulg compressed_len; /* total bit length of compressed file mod 2^32 */
- ulg bits_sent; /* bit length of compressed data sent mod 2^32 */
-#endif
-
- ush bi_buf;
- /* Output buffer. bits are inserted starting at the bottom (least
- * significant bits).
- */
- int bi_valid;
- /* Number of valid bits in bi_buf. All bits above the last valid bit
- * are always zero.
- */
-
- ulg high_water;
- /* High water mark offset in window for initialized bytes -- bytes above
- * this are set to zero in order to avoid memory check warnings when
- * longest match routines access bytes past the input. This is then
- * updated to the new high water mark.
- */
-
-} FAR deflate_state;
-
-/* Output a byte on the stream.
- * IN assertion: there is enough room in pending_buf.
- */
-#define put_byte(s, c) {s->pending_buf[s->pending++] = (c);}
-
-
-#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
-/* Minimum amount of lookahead, except at the end of the input file.
- * See deflate.c for comments about the MIN_MATCH+1.
- */
-
-#define MAX_DIST(s) ((s)->w_size-MIN_LOOKAHEAD)
-/* In order to simplify the code, particularly on 16 bit machines, match
- * distances are limited to MAX_DIST instead of WSIZE.
- */
-
-#define WIN_INIT MAX_MATCH
-/* Number of bytes after end of data in window to initialize in order to avoid
- memory checker errors from longest match routines */
-
- /* in trees.c */
-void ZLIB_INTERNAL _tr_init OF((deflate_state *s));
-int ZLIB_INTERNAL _tr_tally OF((deflate_state *s, unsigned dist, unsigned lc));
-void ZLIB_INTERNAL _tr_flush_block OF((deflate_state *s, charf *buf,
- ulg stored_len, int last));
-void ZLIB_INTERNAL _tr_flush_bits OF((deflate_state *s));
-void ZLIB_INTERNAL _tr_align OF((deflate_state *s));
-void ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf,
- ulg stored_len, int last));
-
-#define d_code(dist) \
- ((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)])
-/* Mapping from a distance to a distance code. dist is the distance - 1 and
- * must not have side effects. _dist_code[256] and _dist_code[257] are never
- * used.
- */
-
-#ifndef DEBUG
-/* Inline versions of _tr_tally for speed: */
-
-#if defined(GEN_TREES_H) || !defined(STDC)
- extern uch ZLIB_INTERNAL _length_code[];
- extern uch ZLIB_INTERNAL _dist_code[];
-#else
- extern const uch ZLIB_INTERNAL _length_code[];
- extern const uch ZLIB_INTERNAL _dist_code[];
-#endif
-
-# define _tr_tally_lit(s, c, flush) \
- { uch cc = (c); \
- s->d_buf[s->last_lit] = 0; \
- s->l_buf[s->last_lit++] = cc; \
- s->dyn_ltree[cc].Freq++; \
- flush = (s->last_lit == s->lit_bufsize-1); \
- }
-# define _tr_tally_dist(s, distance, length, flush) \
- { uch len = (length); \
- ush dist = (distance); \
- s->d_buf[s->last_lit] = dist; \
- s->l_buf[s->last_lit++] = len; \
- dist--; \
- s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \
- s->dyn_dtree[d_code(dist)].Freq++; \
- flush = (s->last_lit == s->lit_bufsize-1); \
- }
-#else
-# define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c)
-# define _tr_tally_dist(s, distance, length, flush) \
- flush = _tr_tally(s, distance, length)
-#endif
-
-#endif /* DEFLATE_H */
diff --git a/chromium/third_party/pdfium/third_party/zlib_v128/gzclose.c b/chromium/third_party/pdfium/third_party/zlib_v128/gzclose.c
deleted file mode 100644
index 0f010b84c88..00000000000
--- a/chromium/third_party/pdfium/third_party/zlib_v128/gzclose.c
+++ /dev/null
@@ -1,25 +0,0 @@
-/* gzclose.c -- zlib gzclose() function
- * Copyright (C) 2004, 2010 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-#include "gzguts.h"
-
-/* gzclose() is in a separate file so that it is linked in only if it is used.
- That way the other gzclose functions can be used instead to avoid linking in
- unneeded compression or decompression routines. */
-int ZEXPORT gzclose(
- gzFile file)
-{
-#ifndef NO_GZCOMPRESS
- gz_statep state;
-
- if (file == NULL)
- return Z_STREAM_ERROR;
- state = (gz_statep)file;
-
- return state->mode == GZ_READ ? gzclose_r(file) : gzclose_w(file);
-#else
- return gzclose_r(file);
-#endif
-}
diff --git a/chromium/third_party/pdfium/third_party/zlib_v128/gzguts.h b/chromium/third_party/pdfium/third_party/zlib_v128/gzguts.h
deleted file mode 100644
index e2c3b67eede..00000000000
--- a/chromium/third_party/pdfium/third_party/zlib_v128/gzguts.h
+++ /dev/null
@@ -1,217 +0,0 @@
-/* gzguts.h -- zlib internal header definitions for gz* operations
- * Copyright (C) 2004, 2005, 2010, 2011, 2012, 2013 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-#ifdef _LARGEFILE64_SOURCE
-# ifndef _LARGEFILE_SOURCE
-# define _LARGEFILE_SOURCE 1
-# endif
-# ifdef _FILE_OFFSET_BITS
-# undef _FILE_OFFSET_BITS
-# endif
-#endif
-
-#ifdef HAVE_HIDDEN
-# define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
-#else
-# define ZLIB_INTERNAL
-#endif
-
-#include <stdio.h>
-#include "zlib.h"
-#ifdef STDC
-# include <string.h>
-# include <stdlib.h>
-# include <limits.h>
-#endif
-#include <fcntl.h>
-
-#ifdef _WIN32
-# include <stddef.h>
-#else
-# include <unistd.h>
-#endif
-
-#if defined(__TURBOC__) || defined(_MSC_VER) || defined(_WIN32)
-# include <io.h>
-#endif
-
-#ifdef WINAPI_FAMILY
-# define open _open
-# define read _read
-# define write _write
-# define close _close
-#endif
-
-#ifdef NO_DEFLATE /* for compatibility with old definition */
-# define NO_GZCOMPRESS
-#endif
-
-#if defined(STDC99) || (defined(__TURBOC__) && __TURBOC__ >= 0x550)
-# ifndef HAVE_VSNPRINTF
-# define HAVE_VSNPRINTF
-# endif
-#endif
-
-#if defined(__CYGWIN__)
-# ifndef HAVE_VSNPRINTF
-# define HAVE_VSNPRINTF
-# endif
-#endif
-
-#if defined(MSDOS) && defined(__BORLANDC__) && (BORLANDC > 0x410)
-# ifndef HAVE_VSNPRINTF
-# define HAVE_VSNPRINTF
-# endif
-#endif
-
-#ifndef HAVE_VSNPRINTF
-# ifdef MSDOS
-/* vsnprintf may exist on some MS-DOS compilers (DJGPP?),
- but for now we just assume it doesn't. */
-# define NO_vsnprintf
-# endif
-# ifdef __TURBOC__
-# define NO_vsnprintf
-# endif
-# ifdef WIN32
-/* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */
-# if !defined(vsnprintf) && !defined(NO_vsnprintf)
-# if !defined(_MSC_VER) || ( defined(_MSC_VER) && _MSC_VER < 1500 )
-# define vsnprintf _vsnprintf
-# endif
-# endif
-# endif
-# ifdef __SASC
-# define NO_vsnprintf
-# endif
-# ifdef VMS
-# define NO_vsnprintf
-# endif
-# ifdef __OS400__
-# define NO_vsnprintf
-# endif
-# ifdef __MVS__
-# define NO_vsnprintf
-# endif
-#endif
-
-/* unlike snprintf (which is required in C99, yet still not supported by
- Microsoft more than a decade later!), _snprintf does not guarantee null
- termination of the result -- however this is only used in gzlib.c where
- the result is assured to fit in the space provided */
-#ifdef _MSC_VER
-# define snprintf _snprintf
-#endif
-
-#ifndef local
-# define local static
-#endif
-/* compile with -Dlocal if your debugger can't find static symbols */
-
-/* gz* functions always use library allocation functions */
-#ifndef STDC
- extern voidp malloc OF((uInt size));
- extern void free OF((voidpf ptr));
-#endif
-
-extern void* FXMEM_DefaultAlloc(size_t, int);
-extern void FXMEM_DefaultFree(void*, int);
-
-#define malloc(size) FXMEM_DefaultAlloc(size, 0)
-#define free(ptr) FXMEM_DefaultFree(ptr, 0)
-
-/* get errno and strerror definition */
-#if defined UNDER_CE
-# include <windows.h>
-# define zstrerror() gz_strwinerror((DWORD)GetLastError())
-#else
-# ifndef NO_STRERROR
-# include <errno.h>
-# define zstrerror() strerror(errno)
-# else
-# define zstrerror() "stdio error (consult errno)"
-# endif
-#endif
-
-/* provide prototypes for these when building zlib without LFS */
-#if !defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0
- ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
- ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int));
- ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile));
- ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile));
-#endif
-
-/* default memLevel */
-#if MAX_MEM_LEVEL >= 8
-# define DEF_MEM_LEVEL 8
-#else
-# define DEF_MEM_LEVEL MAX_MEM_LEVEL
-#endif
-
-/* default i/o buffer size -- double this for output when reading (this and
- twice this must be able to fit in an unsigned type) */
-#define GZBUFSIZE 8192
-
-/* gzip modes, also provide a little integrity check on the passed structure */
-#define GZ_NONE 0
-#define GZ_READ 7247
-#define GZ_WRITE 31153
-#define GZ_APPEND 1 /* mode set to GZ_WRITE after the file is opened */
-
-/* values for gz_state how */
-#define LOOK 0 /* look for a gzip header */
-#define COPY 1 /* copy input directly */
-#define GZIP 2 /* decompress a gzip stream */
-
-/* internal gzip file state data structure */
-typedef struct {
- /* exposed contents for gzgetc() macro */
- struct gzFile_s x; /* "x" for exposed */
- /* x.have: number of bytes available at x.next */
- /* x.next: next output data to deliver or write */
- /* x.pos: current position in uncompressed data */
- /* used for both reading and writing */
- int mode; /* see gzip modes above */
- int fd; /* file descriptor */
- char *path; /* path or fd for error messages */
- unsigned size; /* buffer size, zero if not allocated yet */
- unsigned want; /* requested buffer size, default is GZBUFSIZE */
- unsigned char *in; /* input buffer */
- unsigned char *out; /* output buffer (double-sized when reading) */
- int direct; /* 0 if processing gzip, 1 if transparent */
- /* just for reading */
- int how; /* 0: get header, 1: copy, 2: decompress */
- z_off64_t start; /* where the gzip data started, for rewinding */
- int eof; /* true if end of input file reached */
- int past; /* true if read requested past end */
- /* just for writing */
- int level; /* compression level */
- int strategy; /* compression strategy */
- /* seek request */
- z_off64_t skip; /* amount to skip (already rewound if backwards) */
- int seek; /* true if seek request pending */
- /* error information */
- int err; /* error code */
- char *msg; /* error message */
- /* zlib inflate or deflate stream */
- z_stream strm; /* stream structure in-place (not a pointer) */
-} gz_state;
-typedef gz_state FAR *gz_statep;
-
-/* shared functions */
-void ZLIB_INTERNAL gz_error OF((gz_statep, int, const char *));
-#if defined UNDER_CE
-char ZLIB_INTERNAL *gz_strwinerror OF((DWORD error));
-#endif
-
-/* GT_OFF(x), where x is an unsigned value, is true if x > maximum z_off64_t
- value -- needed when comparing unsigned to z_off64_t, which is signed
- (possible z_off64_t types off_t, off64_t, and long are all signed) */
-#ifdef INT_MAX
-# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > INT_MAX)
-#else
-unsigned ZLIB_INTERNAL gz_intmax OF((void));
-# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax())
-#endif
diff --git a/chromium/third_party/pdfium/third_party/zlib_v128/gzlib.c b/chromium/third_party/pdfium/third_party/zlib_v128/gzlib.c
deleted file mode 100644
index 68b176478d2..00000000000
--- a/chromium/third_party/pdfium/third_party/zlib_v128/gzlib.c
+++ /dev/null
@@ -1,634 +0,0 @@
-/* gzlib.c -- zlib functions common to reading and writing gzip files
- * Copyright (C) 2004, 2010, 2011, 2012, 2013 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-#include "gzguts.h"
-
-#if defined(_WIN32) && !defined(__BORLANDC__)
-# define LSEEK _lseeki64
-#else
-#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
-# define LSEEK lseek64
-#else
-# define LSEEK lseek
-#endif
-#endif
-
-/* Local functions */
-local void gz_reset OF((gz_statep));
-local gzFile gz_open OF((const void *, int, const char *));
-
-#if defined UNDER_CE
-
-/* Map the Windows error number in ERROR to a locale-dependent error message
- string and return a pointer to it. Typically, the values for ERROR come
- from GetLastError.
-
- The string pointed to shall not be modified by the application, but may be
- overwritten by a subsequent call to gz_strwinerror
-
- The gz_strwinerror function does not change the current setting of
- GetLastError. */
-char ZLIB_INTERNAL *gz_strwinerror (
- DWORD error)
-{
- static char buf[1024];
-
- wchar_t *msgbuf;
- DWORD lasterr = GetLastError();
- DWORD chars = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM
- | FORMAT_MESSAGE_ALLOCATE_BUFFER,
- NULL,
- error,
- 0, /* Default language */
- (LPVOID)&msgbuf,
- 0,
- NULL);
- if (chars != 0) {
- /* If there is an \r\n appended, zap it. */
- if (chars >= 2
- && msgbuf[chars - 2] == '\r' && msgbuf[chars - 1] == '\n') {
- chars -= 2;
- msgbuf[chars] = 0;
- }
-
- if (chars > sizeof (buf) - 1) {
- chars = sizeof (buf) - 1;
- msgbuf[chars] = 0;
- }
-
- wcstombs(buf, msgbuf, chars + 1);
- LocalFree(msgbuf);
- }
- else {
- sprintf(buf, "unknown win32 error (%ld)", error);
- }
-
- SetLastError(lasterr);
- return buf;
-}
-
-#endif /* UNDER_CE */
-
-/* Reset gzip file state */
-local void gz_reset(
- gz_statep state)
-{
- state->x.have = 0; /* no output data available */
- if (state->mode == GZ_READ) { /* for reading ... */
- state->eof = 0; /* not at end of file */
- state->past = 0; /* have not read past end yet */
- state->how = LOOK; /* look for gzip header */
- }
- state->seek = 0; /* no seek request pending */
- gz_error(state, Z_OK, NULL); /* clear error */
- state->x.pos = 0; /* no uncompressed data yet */
- state->strm.avail_in = 0; /* no input data yet */
-}
-
-/* Open a gzip file either by name or file descriptor. */
-local gzFile gz_open(
- const void *path,
- int fd,
- const char *mode)
-{
- gz_statep state;
- size_t len;
- int oflag;
-#ifdef O_CLOEXEC
- int cloexec = 0;
-#endif
-#ifdef O_EXCL
- int exclusive = 0;
-#endif
-
- /* check input */
- if (path == NULL)
- return NULL;
-
- /* allocate gzFile structure to return */
- state = (gz_statep)malloc(sizeof(gz_state));
- if (state == NULL)
- return NULL;
- state->size = 0; /* no buffers allocated yet */
- state->want = GZBUFSIZE; /* requested buffer size */
- state->msg = NULL; /* no error message yet */
-
- /* interpret mode */
- state->mode = GZ_NONE;
- state->level = Z_DEFAULT_COMPRESSION;
- state->strategy = Z_DEFAULT_STRATEGY;
- state->direct = 0;
- while (*mode) {
- if (*mode >= '0' && *mode <= '9')
- state->level = *mode - '0';
- else
- switch (*mode) {
- case 'r':
- state->mode = GZ_READ;
- break;
-#ifndef NO_GZCOMPRESS
- case 'w':
- state->mode = GZ_WRITE;
- break;
- case 'a':
- state->mode = GZ_APPEND;
- break;
-#endif
- case '+': /* can't read and write at the same time */
- free(state);
- return NULL;
- case 'b': /* ignore -- will request binary anyway */
- break;
-#ifdef O_CLOEXEC
- case 'e':
- cloexec = 1;
- break;
-#endif
-#ifdef O_EXCL
- case 'x':
- exclusive = 1;
- break;
-#endif
- case 'f':
- state->strategy = Z_FILTERED;
- break;
- case 'h':
- state->strategy = Z_HUFFMAN_ONLY;
- break;
- case 'R':
- state->strategy = Z_RLE;
- break;
- case 'F':
- state->strategy = Z_FIXED;
- break;
- case 'T':
- state->direct = 1;
- break;
- default: /* could consider as an error, but just ignore */
- ;
- }
- mode++;
- }
-
- /* must provide an "r", "w", or "a" */
- if (state->mode == GZ_NONE) {
- free(state);
- return NULL;
- }
-
- /* can't force transparent read */
- if (state->mode == GZ_READ) {
- if (state->direct) {
- free(state);
- return NULL;
- }
- state->direct = 1; /* for empty file */
- }
-
- /* save the path name for error messages */
-#ifdef _WIN32
- if (fd == -2) {
- len = wcstombs(NULL, path, 0);
- if (len == (size_t)-1)
- len = 0;
- }
- else
-#endif
- len = strlen((const char *)path);
- state->path = (char *)malloc(len + 1);
- if (state->path == NULL) {
- free(state);
- return NULL;
- }
-#ifdef _WIN32
- if (fd == -2)
- if (len)
- wcstombs(state->path, path, len + 1);
- else
- *(state->path) = 0;
- else
-#endif
-#if !defined(NO_snprintf) && !defined(NO_vsnprintf)
- snprintf(state->path, len + 1, "%s", (const char *)path);
-#else
- strcpy(state->path, path);
-#endif
-
- /* compute the flags for open() */
- oflag =
-#ifdef O_LARGEFILE
- O_LARGEFILE |
-#endif
-#ifdef O_BINARY
- O_BINARY |
-#endif
-#ifdef O_CLOEXEC
- (cloexec ? O_CLOEXEC : 0) |
-#endif
- (state->mode == GZ_READ ?
- O_RDONLY :
- (O_WRONLY | O_CREAT |
-#ifdef O_EXCL
- (exclusive ? O_EXCL : 0) |
-#endif
- (state->mode == GZ_WRITE ?
- O_TRUNC :
- O_APPEND)));
-
- /* open the file with the appropriate flags (or just use fd) */
- state->fd = fd > -1 ? fd : (
-#ifdef _WIN32
- fd == -2 ? _wopen(path, oflag, 0666) :
-#endif
- open((const char *)path, oflag, 0666));
- if (state->fd == -1) {
- free(state->path);
- free(state);
- return NULL;
- }
- if (state->mode == GZ_APPEND)
- state->mode = GZ_WRITE; /* simplify later checks */
-
- /* save the current position for rewinding (only if reading) */
- if (state->mode == GZ_READ) {
- state->start = LSEEK(state->fd, 0, SEEK_CUR);
- if (state->start == -1) state->start = 0;
- }
-
- /* initialize stream */
- gz_reset(state);
-
- /* return stream */
- return (gzFile)state;
-}
-
-/* -- see zlib.h -- */
-gzFile ZEXPORT gzopen(
- const char *path,
- const char *mode)
-{
- return gz_open(path, -1, mode);
-}
-
-/* -- see zlib.h -- */
-gzFile ZEXPORT gzopen64(
- const char *path,
- const char *mode)
-{
- return gz_open(path, -1, mode);
-}
-
-/* -- see zlib.h -- */
-gzFile ZEXPORT gzdopen(
- int fd,
- const char *mode)
-{
- char *path; /* identifier for error messages */
- gzFile gz;
-
- if (fd == -1 || (path = (char *)malloc(7 + 3 * sizeof(int))) == NULL)
- return NULL;
-#if !defined(NO_snprintf) && !defined(NO_vsnprintf)
- snprintf(path, 7 + 3 * sizeof(int), "<fd:%d>", fd); /* for debugging */
-#else
- sprintf(path, "<fd:%d>", fd); /* for debugging */
-#endif
- gz = gz_open(path, fd, mode);
- free(path);
- return gz;
-}
-
-/* -- see zlib.h -- */
-#ifdef _WIN32
-gzFile ZEXPORT gzopen_w(
- const wchar_t *path,
- const char *mode)
-{
- return gz_open(path, -2, mode);
-}
-#endif
-
-/* -- see zlib.h -- */
-int ZEXPORT gzbuffer(
- gzFile file,
- unsigned size)
-{
- gz_statep state;
-
- /* get internal structure and check integrity */
- if (file == NULL)
- return -1;
- state = (gz_statep)file;
- if (state->mode != GZ_READ && state->mode != GZ_WRITE)
- return -1;
-
- /* make sure we haven't already allocated memory */
- if (state->size != 0)
- return -1;
-
- /* check and set requested size */
- if (size < 2)
- size = 2; /* need two bytes to check magic header */
- state->want = size;
- return 0;
-}
-
-/* -- see zlib.h -- */
-int ZEXPORT gzrewind(
- gzFile file)
-{
- gz_statep state;
-
- /* get internal structure */
- if (file == NULL)
- return -1;
- state = (gz_statep)file;
-
- /* check that we're reading and that there's no error */
- if (state->mode != GZ_READ ||
- (state->err != Z_OK && state->err != Z_BUF_ERROR))
- return -1;
-
- /* back up and start over */
- if (LSEEK(state->fd, state->start, SEEK_SET) == -1)
- return -1;
- gz_reset(state);
- return 0;
-}
-
-/* -- see zlib.h -- */
-z_off64_t ZEXPORT gzseek64(
- gzFile file,
- z_off64_t offset,
- int whence)
-{
- unsigned n;
- z_off64_t ret;
- gz_statep state;
-
- /* get internal structure and check integrity */
- if (file == NULL)
- return -1;
- state = (gz_statep)file;
- if (state->mode != GZ_READ && state->mode != GZ_WRITE)
- return -1;
-
- /* check that there's no error */
- if (state->err != Z_OK && state->err != Z_BUF_ERROR)
- return -1;
-
- /* can only seek from start or relative to current position */
- if (whence != SEEK_SET && whence != SEEK_CUR)
- return -1;
-
- /* normalize offset to a SEEK_CUR specification */
- if (whence == SEEK_SET)
- offset -= state->x.pos;
- else if (state->seek)
- offset += state->skip;
- state->seek = 0;
-
- /* if within raw area while reading, just go there */
- if (state->mode == GZ_READ && state->how == COPY &&
- state->x.pos + offset >= 0) {
- ret = LSEEK(state->fd, offset - state->x.have, SEEK_CUR);
- if (ret == -1)
- return -1;
- state->x.have = 0;
- state->eof = 0;
- state->past = 0;
- state->seek = 0;
- gz_error(state, Z_OK, NULL);
- state->strm.avail_in = 0;
- state->x.pos += offset;
- return state->x.pos;
- }
-
- /* calculate skip amount, rewinding if needed for back seek when reading */
- if (offset < 0) {
- if (state->mode != GZ_READ) /* writing -- can't go backwards */
- return -1;
- offset += state->x.pos;
- if (offset < 0) /* before start of file! */
- return -1;
- if (gzrewind(file) == -1) /* rewind, then skip to offset */
- return -1;
- }
-
- /* if reading, skip what's in output buffer (one less gzgetc() check) */
- if (state->mode == GZ_READ) {
- n = GT_OFF(state->x.have) || (z_off64_t)state->x.have > offset ?
- (unsigned)offset : state->x.have;
- state->x.have -= n;
- state->x.next += n;
- state->x.pos += n;
- offset -= n;
- }
-
- /* request skip (if not zero) */
- if (offset) {
- state->seek = 1;
- state->skip = offset;
- }
- return state->x.pos + offset;
-}
-
-/* -- see zlib.h -- */
-z_off_t ZEXPORT gzseek(
- gzFile file,
- z_off_t offset,
- int whence)
-{
- z_off64_t ret;
-
- ret = gzseek64(file, (z_off64_t)offset, whence);
- return ret == (z_off_t)ret ? (z_off_t)ret : -1;
-}
-
-/* -- see zlib.h -- */
-z_off64_t ZEXPORT gztell64(
- gzFile file)
-{
- gz_statep state;
-
- /* get internal structure and check integrity */
- if (file == NULL)
- return -1;
- state = (gz_statep)file;
- if (state->mode != GZ_READ && state->mode != GZ_WRITE)
- return -1;
-
- /* return position */
- return state->x.pos + (state->seek ? state->skip : 0);
-}
-
-/* -- see zlib.h -- */
-z_off_t ZEXPORT gztell(
- gzFile file)
-{
- z_off64_t ret;
-
- ret = gztell64(file);
- return ret == (z_off_t)ret ? (z_off_t)ret : -1;
-}
-
-/* -- see zlib.h -- */
-z_off64_t ZEXPORT gzoffset64(
- gzFile file)
-{
- z_off64_t offset;
- gz_statep state;
-
- /* get internal structure and check integrity */
- if (file == NULL)
- return -1;
- state = (gz_statep)file;
- if (state->mode != GZ_READ && state->mode != GZ_WRITE)
- return -1;
-
- /* compute and return effective offset in file */
- offset = LSEEK(state->fd, 0, SEEK_CUR);
- if (offset == -1)
- return -1;
- if (state->mode == GZ_READ) /* reading */
- offset -= state->strm.avail_in; /* don't count buffered input */
- return offset;
-}
-
-/* -- see zlib.h -- */
-z_off_t ZEXPORT gzoffset(
- gzFile file)
-{
- z_off64_t ret;
-
- ret = gzoffset64(file);
- return ret == (z_off_t)ret ? (z_off_t)ret : -1;
-}
-
-/* -- see zlib.h -- */
-int ZEXPORT gzeof(
- gzFile file)
-{
- gz_statep state;
-
- /* get internal structure and check integrity */
- if (file == NULL)
- return 0;
- state = (gz_statep)file;
- if (state->mode != GZ_READ && state->mode != GZ_WRITE)
- return 0;
-
- /* return end-of-file state */
- return state->mode == GZ_READ ? state->past : 0;
-}
-
-/* -- see zlib.h -- */
-const char * ZEXPORT gzerror(
- gzFile file,
- int *errnum)
-{
- gz_statep state;
-
- /* get internal structure and check integrity */
- if (file == NULL)
- return NULL;
- state = (gz_statep)file;
- if (state->mode != GZ_READ && state->mode != GZ_WRITE)
- return NULL;
-
- /* return error information */
- if (errnum != NULL)
- *errnum = state->err;
- return state->err == Z_MEM_ERROR ? "out of memory" :
- (state->msg == NULL ? "" : state->msg);
-}
-
-/* -- see zlib.h -- */
-void ZEXPORT gzclearerr(
- gzFile file)
-{
- gz_statep state;
-
- /* get internal structure and check integrity */
- if (file == NULL)
- return;
- state = (gz_statep)file;
- if (state->mode != GZ_READ && state->mode != GZ_WRITE)
- return;
-
- /* clear error and end-of-file */
- if (state->mode == GZ_READ) {
- state->eof = 0;
- state->past = 0;
- }
- gz_error(state, Z_OK, NULL);
-}
-
-/* Create an error message in allocated memory and set state->err and
- state->msg accordingly. Free any previous error message already there. Do
- not try to free or allocate space if the error is Z_MEM_ERROR (out of
- memory). Simply save the error message as a static string. If there is an
- allocation failure constructing the error message, then convert the error to
- out of memory. */
-void ZLIB_INTERNAL gz_error(
- gz_statep state,
- int err,
- const char *msg)
-{
- /* free previously allocated message and clear */
- if (state->msg != NULL) {
- if (state->err != Z_MEM_ERROR)
- free(state->msg);
- state->msg = NULL;
- }
-
- /* if fatal, set state->x.have to 0 so that the gzgetc() macro fails */
- if (err != Z_OK && err != Z_BUF_ERROR)
- state->x.have = 0;
-
- /* set error code, and if no message, then done */
- state->err = err;
- if (msg == NULL)
- return;
-
- /* for an out of memory error, return literal string when requested */
- if (err == Z_MEM_ERROR)
- return;
-
- /* construct error message with path */
- if ((state->msg = (char *)malloc(strlen(state->path) + strlen(msg) + 3)) ==
- NULL) {
- state->err = Z_MEM_ERROR;
- return;
- }
-#if !defined(NO_snprintf) && !defined(NO_vsnprintf)
- snprintf(state->msg, strlen(state->path) + strlen(msg) + 3,
- "%s%s%s", state->path, ": ", msg);
-#else
- strcpy(state->msg, state->path);
- strcat(state->msg, ": ");
- strcat(state->msg, msg);
-#endif
- return;
-}
-
-#ifndef INT_MAX
-/* portably return maximum value for an int (when limits.h presumed not
- available) -- we need to do this to cover cases where 2's complement not
- used, since C standard permits 1's complement and sign-bit representations,
- otherwise we could just use ((unsigned)-1) >> 1 */
-unsigned ZLIB_INTERNAL gz_intmax()
-{
- unsigned p, q;
-
- p = 1;
- do {
- q = p;
- p <<= 1;
- p++;
- } while (p > q);
- return q >> 1;
-}
-#endif
diff --git a/chromium/third_party/pdfium/third_party/zlib_v128/gzread.c b/chromium/third_party/pdfium/third_party/zlib_v128/gzread.c
deleted file mode 100644
index f162a32f102..00000000000
--- a/chromium/third_party/pdfium/third_party/zlib_v128/gzread.c
+++ /dev/null
@@ -1,594 +0,0 @@
-/* gzread.c -- zlib functions for reading gzip files
- * Copyright (C) 2004, 2005, 2010, 2011, 2012, 2013 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-#include "gzguts.h"
-
-/* Local functions */
-local int gz_load OF((gz_statep, unsigned char *, unsigned, unsigned *));
-local int gz_avail OF((gz_statep));
-local int gz_look OF((gz_statep));
-local int gz_decomp OF((gz_statep));
-local int gz_fetch OF((gz_statep));
-local int gz_skip OF((gz_statep, z_off64_t));
-
-/* Use read() to load a buffer -- return -1 on error, otherwise 0. Read from
- state->fd, and update state->eof, state->err, and state->msg as appropriate.
- This function needs to loop on read(), since read() is not guaranteed to
- read the number of bytes requested, depending on the type of descriptor. */
-local int gz_load(
- gz_statep state,
- unsigned char *buf,
- unsigned len,
- unsigned *have)
-{
- int ret;
-
- *have = 0;
- do {
- ret = read(state->fd, buf + *have, len - *have);
- if (ret <= 0)
- break;
- *have += ret;
- } while (*have < len);
- if (ret < 0) {
- gz_error(state, Z_ERRNO, zstrerror());
- return -1;
- }
- if (ret == 0)
- state->eof = 1;
- return 0;
-}
-
-/* Load up input buffer and set eof flag if last data loaded -- return -1 on
- error, 0 otherwise. Note that the eof flag is set when the end of the input
- file is reached, even though there may be unused data in the buffer. Once
- that data has been used, no more attempts will be made to read the file.
- If strm->avail_in != 0, then the current data is moved to the beginning of
- the input buffer, and then the remainder of the buffer is loaded with the
- available data from the input file. */
-local int gz_avail(
- gz_statep state)
-{
- unsigned got;
- z_streamp strm = &(state->strm);
-
- if (state->err != Z_OK && state->err != Z_BUF_ERROR)
- return -1;
- if (state->eof == 0) {
- if (strm->avail_in) { /* copy what's there to the start */
- unsigned char *p = state->in;
- unsigned const char *q = strm->next_in;
- unsigned n = strm->avail_in;
- do {
- *p++ = *q++;
- } while (--n);
- }
- if (gz_load(state, state->in + strm->avail_in,
- state->size - strm->avail_in, &got) == -1)
- return -1;
- strm->avail_in += got;
- strm->next_in = state->in;
- }
- return 0;
-}
-
-/* Look for gzip header, set up for inflate or copy. state->x.have must be 0.
- If this is the first time in, allocate required memory. state->how will be
- left unchanged if there is no more input data available, will be set to COPY
- if there is no gzip header and direct copying will be performed, or it will
- be set to GZIP for decompression. If direct copying, then leftover input
- data from the input buffer will be copied to the output buffer. In that
- case, all further file reads will be directly to either the output buffer or
- a user buffer. If decompressing, the inflate state will be initialized.
- gz_look() will return 0 on success or -1 on failure. */
-local int gz_look(
- gz_statep state)
-{
- z_streamp strm = &(state->strm);
-
- /* allocate read buffers and inflate memory */
- if (state->size == 0) {
- /* allocate buffers */
- state->in = (unsigned char *)malloc(state->want);
- state->out = (unsigned char *)malloc(state->want << 1);
- if (state->in == NULL || state->out == NULL) {
- if (state->out != NULL)
- free(state->out);
- if (state->in != NULL)
- free(state->in);
- gz_error(state, Z_MEM_ERROR, "out of memory");
- return -1;
- }
- state->size = state->want;
-
- /* allocate inflate memory */
- state->strm.zalloc = Z_NULL;
- state->strm.zfree = Z_NULL;
- state->strm.opaque = Z_NULL;
- state->strm.avail_in = 0;
- state->strm.next_in = Z_NULL;
- if (inflateInit2(&(state->strm), 15 + 16) != Z_OK) { /* gunzip */
- free(state->out);
- free(state->in);
- state->size = 0;
- gz_error(state, Z_MEM_ERROR, "out of memory");
- return -1;
- }
- }
-
- /* get at least the magic bytes in the input buffer */
- if (strm->avail_in < 2) {
- if (gz_avail(state) == -1)
- return -1;
- if (strm->avail_in == 0)
- return 0;
- }
-
- /* look for gzip magic bytes -- if there, do gzip decoding (note: there is
- a logical dilemma here when considering the case of a partially written
- gzip file, to wit, if a single 31 byte is written, then we cannot tell
- whether this is a single-byte file, or just a partially written gzip
- file -- for here we assume that if a gzip file is being written, then
- the header will be written in a single operation, so that reading a
- single byte is sufficient indication that it is not a gzip file) */
- if (strm->avail_in > 1 &&
- strm->next_in[0] == 31 && strm->next_in[1] == 139) {
- inflateReset(strm);
- state->how = GZIP;
- state->direct = 0;
- return 0;
- }
-
- /* no gzip header -- if we were decoding gzip before, then this is trailing
- garbage. Ignore the trailing garbage and finish. */
- if (state->direct == 0) {
- strm->avail_in = 0;
- state->eof = 1;
- state->x.have = 0;
- return 0;
- }
-
- /* doing raw i/o, copy any leftover input to output -- this assumes that
- the output buffer is larger than the input buffer, which also assures
- space for gzungetc() */
- state->x.next = state->out;
- if (strm->avail_in) {
- memcpy(state->x.next, strm->next_in, strm->avail_in);
- state->x.have = strm->avail_in;
- strm->avail_in = 0;
- }
- state->how = COPY;
- state->direct = 1;
- return 0;
-}
-
-/* Decompress from input to the provided next_out and avail_out in the state.
- On return, state->x.have and state->x.next point to the just decompressed
- data. If the gzip stream completes, state->how is reset to LOOK to look for
- the next gzip stream or raw data, once state->x.have is depleted. Returns 0
- on success, -1 on failure. */
-local int gz_decomp(
- gz_statep state)
-{
- int ret = Z_OK;
- unsigned had;
- z_streamp strm = &(state->strm);
-
- /* fill output buffer up to end of deflate stream */
- had = strm->avail_out;
- do {
- /* get more input for inflate() */
- if (strm->avail_in == 0 && gz_avail(state) == -1)
- return -1;
- if (strm->avail_in == 0) {
- gz_error(state, Z_BUF_ERROR, "unexpected end of file");
- break;
- }
-
- /* decompress and handle errors */
- ret = inflate(strm, Z_NO_FLUSH);
- if (ret == Z_STREAM_ERROR || ret == Z_NEED_DICT) {
- gz_error(state, Z_STREAM_ERROR,
- "internal error: inflate stream corrupt");
- return -1;
- }
- if (ret == Z_MEM_ERROR) {
- gz_error(state, Z_MEM_ERROR, "out of memory");
- return -1;
- }
- if (ret == Z_DATA_ERROR) { /* deflate stream invalid */
- gz_error(state, Z_DATA_ERROR,
- strm->msg == NULL ? "compressed data error" : strm->msg);
- return -1;
- }
- } while (strm->avail_out && ret != Z_STREAM_END);
-
- /* update available output */
- state->x.have = had - strm->avail_out;
- state->x.next = strm->next_out - state->x.have;
-
- /* if the gzip stream completed successfully, look for another */
- if (ret == Z_STREAM_END)
- state->how = LOOK;
-
- /* good decompression */
- return 0;
-}
-
-/* Fetch data and put it in the output buffer. Assumes state->x.have is 0.
- Data is either copied from the input file or decompressed from the input
- file depending on state->how. If state->how is LOOK, then a gzip header is
- looked for to determine whether to copy or decompress. Returns -1 on error,
- otherwise 0. gz_fetch() will leave state->how as COPY or GZIP unless the
- end of the input file has been reached and all data has been processed. */
-local int gz_fetch(
- gz_statep state)
-{
- z_streamp strm = &(state->strm);
-
- do {
- switch(state->how) {
- case LOOK: /* -> LOOK, COPY (only if never GZIP), or GZIP */
- if (gz_look(state) == -1)
- return -1;
- if (state->how == LOOK)
- return 0;
- break;
- case COPY: /* -> COPY */
- if (gz_load(state, state->out, state->size << 1, &(state->x.have))
- == -1)
- return -1;
- state->x.next = state->out;
- return 0;
- case GZIP: /* -> GZIP or LOOK (if end of gzip stream) */
- strm->avail_out = state->size << 1;
- strm->next_out = state->out;
- if (gz_decomp(state) == -1)
- return -1;
- }
- } while (state->x.have == 0 && (!state->eof || strm->avail_in));
- return 0;
-}
-
-/* Skip len uncompressed bytes of output. Return -1 on error, 0 on success. */
-local int gz_skip(
- gz_statep state,
- z_off64_t len)
-{
- unsigned n;
-
- /* skip over len bytes or reach end-of-file, whichever comes first */
- while (len)
- /* skip over whatever is in output buffer */
- if (state->x.have) {
- n = GT_OFF(state->x.have) || (z_off64_t)state->x.have > len ?
- (unsigned)len : state->x.have;
- state->x.have -= n;
- state->x.next += n;
- state->x.pos += n;
- len -= n;
- }
-
- /* output buffer empty -- return if we're at the end of the input */
- else if (state->eof && state->strm.avail_in == 0)
- break;
-
- /* need more data to skip -- load up output buffer */
- else {
- /* get more output, looking for header if required */
- if (gz_fetch(state) == -1)
- return -1;
- }
- return 0;
-}
-
-/* -- see zlib.h -- */
-int ZEXPORT gzread(
- gzFile file,
- voidp buf,
- unsigned len)
-{
- unsigned got, n;
- gz_statep state;
- z_streamp strm;
-
- /* get internal structure */
- if (file == NULL)
- return -1;
- state = (gz_statep)file;
- strm = &(state->strm);
-
- /* check that we're reading and that there's no (serious) error */
- if (state->mode != GZ_READ ||
- (state->err != Z_OK && state->err != Z_BUF_ERROR))
- return -1;
-
- /* since an int is returned, make sure len fits in one, otherwise return
- with an error (this avoids the flaw in the interface) */
- if ((int)len < 0) {
- gz_error(state, Z_DATA_ERROR, "requested length does not fit in int");
- return -1;
- }
-
- /* if len is zero, avoid unnecessary operations */
- if (len == 0)
- return 0;
-
- /* process a skip request */
- if (state->seek) {
- state->seek = 0;
- if (gz_skip(state, state->skip) == -1)
- return -1;
- }
-
- /* get len bytes to buf, or less than len if at the end */
- got = 0;
- do {
- /* first just try copying data from the output buffer */
- if (state->x.have) {
- n = state->x.have > len ? len : state->x.have;
- memcpy(buf, state->x.next, n);
- state->x.next += n;
- state->x.have -= n;
- }
-
- /* output buffer empty -- return if we're at the end of the input */
- else if (state->eof && strm->avail_in == 0) {
- state->past = 1; /* tried to read past end */
- break;
- }
-
- /* need output data -- for small len or new stream load up our output
- buffer */
- else if (state->how == LOOK || len < (state->size << 1)) {
- /* get more output, looking for header if required */
- if (gz_fetch(state) == -1)
- return -1;
- continue; /* no progress yet -- go back to copy above */
- /* the copy above assures that we will leave with space in the
- output buffer, allowing at least one gzungetc() to succeed */
- }
-
- /* large len -- read directly into user buffer */
- else if (state->how == COPY) { /* read directly */
- if (gz_load(state, (unsigned char *)buf, len, &n) == -1)
- return -1;
- }
-
- /* large len -- decompress directly into user buffer */
- else { /* state->how == GZIP */
- strm->avail_out = len;
- strm->next_out = (unsigned char *)buf;
- if (gz_decomp(state) == -1)
- return -1;
- n = state->x.have;
- state->x.have = 0;
- }
-
- /* update progress */
- len -= n;
- buf = (char *)buf + n;
- got += n;
- state->x.pos += n;
- } while (len);
-
- /* return number of bytes read into user buffer (will fit in int) */
- return (int)got;
-}
-
-/* -- see zlib.h -- */
-#ifdef Z_PREFIX_SET
-# undef z_gzgetc
-#else
-# undef gzgetc
-#endif
-int ZEXPORT gzgetc(
- gzFile file)
-{
- int ret;
- unsigned char buf[1];
- gz_statep state;
-
- /* get internal structure */
- if (file == NULL)
- return -1;
- state = (gz_statep)file;
-
- /* check that we're reading and that there's no (serious) error */
- if (state->mode != GZ_READ ||
- (state->err != Z_OK && state->err != Z_BUF_ERROR))
- return -1;
-
- /* try output buffer (no need to check for skip request) */
- if (state->x.have) {
- state->x.have--;
- state->x.pos++;
- return *(state->x.next)++;
- }
-
- /* nothing there -- try gzread() */
- ret = gzread(file, buf, 1);
- return ret < 1 ? -1 : buf[0];
-}
-
-int ZEXPORT gzgetc_(
-gzFile file)
-{
- return gzgetc(file);
-}
-
-/* -- see zlib.h -- */
-int ZEXPORT gzungetc(
- int c,
- gzFile file)
-{
- gz_statep state;
-
- /* get internal structure */
- if (file == NULL)
- return -1;
- state = (gz_statep)file;
-
- /* check that we're reading and that there's no (serious) error */
- if (state->mode != GZ_READ ||
- (state->err != Z_OK && state->err != Z_BUF_ERROR))
- return -1;
-
- /* process a skip request */
- if (state->seek) {
- state->seek = 0;
- if (gz_skip(state, state->skip) == -1)
- return -1;
- }
-
- /* can't push EOF */
- if (c < 0)
- return -1;
-
- /* if output buffer empty, put byte at end (allows more pushing) */
- if (state->x.have == 0) {
- state->x.have = 1;
- state->x.next = state->out + (state->size << 1) - 1;
- state->x.next[0] = c;
- state->x.pos--;
- state->past = 0;
- return c;
- }
-
- /* if no room, give up (must have already done a gzungetc()) */
- if (state->x.have == (state->size << 1)) {
- gz_error(state, Z_DATA_ERROR, "out of room to push characters");
- return -1;
- }
-
- /* slide output data if needed and insert byte before existing data */
- if (state->x.next == state->out) {
- unsigned char *src = state->out + state->x.have;
- unsigned char *dest = state->out + (state->size << 1);
- while (src > state->out)
- *--dest = *--src;
- state->x.next = dest;
- }
- state->x.have++;
- state->x.next--;
- state->x.next[0] = c;
- state->x.pos--;
- state->past = 0;
- return c;
-}
-
-/* -- see zlib.h -- */
-char * ZEXPORT gzgets(
- gzFile file,
- char *buf,
- int len)
-{
- unsigned left, n;
- char *str;
- unsigned char *eol;
- gz_statep state;
-
- /* check parameters and get internal structure */
- if (file == NULL || buf == NULL || len < 1)
- return NULL;
- state = (gz_statep)file;
-
- /* check that we're reading and that there's no (serious) error */
- if (state->mode != GZ_READ ||
- (state->err != Z_OK && state->err != Z_BUF_ERROR))
- return NULL;
-
- /* process a skip request */
- if (state->seek) {
- state->seek = 0;
- if (gz_skip(state, state->skip) == -1)
- return NULL;
- }
-
- /* copy output bytes up to new line or len - 1, whichever comes first --
- append a terminating zero to the string (we don't check for a zero in
- the contents, let the user worry about that) */
- str = buf;
- left = (unsigned)len - 1;
- if (left) do {
- /* assure that something is in the output buffer */
- if (state->x.have == 0 && gz_fetch(state) == -1)
- return NULL; /* error */
- if (state->x.have == 0) { /* end of file */
- state->past = 1; /* read past end */
- break; /* return what we have */
- }
-
- /* look for end-of-line in current output buffer */
- n = state->x.have > left ? left : state->x.have;
- eol = (unsigned char *)memchr(state->x.next, '\n', n);
- if (eol != NULL)
- n = (unsigned)(eol - state->x.next) + 1;
-
- /* copy through end-of-line, or remainder if not found */
- memcpy(buf, state->x.next, n);
- state->x.have -= n;
- state->x.next += n;
- state->x.pos += n;
- left -= n;
- buf += n;
- } while (left && eol == NULL);
-
- /* return terminated string, or if nothing, end of file */
- if (buf == str)
- return NULL;
- buf[0] = 0;
- return str;
-}
-
-/* -- see zlib.h -- */
-int ZEXPORT gzdirect(
- gzFile file)
-{
- gz_statep state;
-
- /* get internal structure */
- if (file == NULL)
- return 0;
- state = (gz_statep)file;
-
- /* if the state is not known, but we can find out, then do so (this is
- mainly for right after a gzopen() or gzdopen()) */
- if (state->mode == GZ_READ && state->how == LOOK && state->x.have == 0)
- (void)gz_look(state);
-
- /* return 1 if transparent, 0 if processing a gzip stream */
- return state->direct;
-}
-
-/* -- see zlib.h -- */
-int ZEXPORT gzclose_r(
- gzFile file)
-{
- int ret, err;
- gz_statep state;
-
- /* get internal structure */
- if (file == NULL)
- return Z_STREAM_ERROR;
- state = (gz_statep)file;
-
- /* check that we're reading */
- if (state->mode != GZ_READ)
- return Z_STREAM_ERROR;
-
- /* free memory and close file */
- if (state->size) {
- inflateEnd(&(state->strm));
- free(state->out);
- free(state->in);
- }
- err = state->err == Z_BUF_ERROR ? Z_BUF_ERROR : Z_OK;
- gz_error(state, Z_OK, NULL);
- free(state->path);
- ret = close(state->fd);
- free(state);
- return ret ? Z_ERRNO : err;
-}
diff --git a/chromium/third_party/pdfium/third_party/zlib_v128/gzwrite.c b/chromium/third_party/pdfium/third_party/zlib_v128/gzwrite.c
deleted file mode 100644
index 161070866fd..00000000000
--- a/chromium/third_party/pdfium/third_party/zlib_v128/gzwrite.c
+++ /dev/null
@@ -1,576 +0,0 @@
-/* gzwrite.c -- zlib functions for writing gzip files
- * Copyright (C) 2004, 2005, 2010, 2011, 2012, 2013 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-#include "gzguts.h"
-
-/* Local functions */
-local int gz_init OF((gz_statep));
-local int gz_comp OF((gz_statep, int));
-local int gz_zero OF((gz_statep, z_off64_t));
-
-/* Initialize state for writing a gzip file. Mark initialization by setting
- state->size to non-zero. Return -1 on failure or 0 on success. */
-local int gz_init(
- gz_statep state)
-{
- int ret;
- z_streamp strm = &(state->strm);
-
- /* allocate input buffer */
- state->in = (unsigned char *)malloc(state->want);
- if (state->in == NULL) {
- gz_error(state, Z_MEM_ERROR, "out of memory");
- return -1;
- }
-
- /* only need output buffer and deflate state if compressing */
- if (!state->direct) {
- /* allocate output buffer */
- state->out = (unsigned char *)malloc(state->want);
- if (state->out == NULL) {
- free(state->in);
- gz_error(state, Z_MEM_ERROR, "out of memory");
- return -1;
- }
-
- /* allocate deflate memory, set up for gzip compression */
- strm->zalloc = Z_NULL;
- strm->zfree = Z_NULL;
- strm->opaque = Z_NULL;
- ret = deflateInit2(strm, state->level, Z_DEFLATED,
- MAX_WBITS + 16, DEF_MEM_LEVEL, state->strategy);
- if (ret != Z_OK) {
- free(state->out);
- free(state->in);
- gz_error(state, Z_MEM_ERROR, "out of memory");
- return -1;
- }
- }
-
- /* mark state as initialized */
- state->size = state->want;
-
- /* initialize write buffer if compressing */
- if (!state->direct) {
- strm->avail_out = state->size;
- strm->next_out = state->out;
- state->x.next = strm->next_out;
- }
- return 0;
-}
-
-/* Compress whatever is at avail_in and next_in and write to the output file.
- Return -1 if there is an error writing to the output file, otherwise 0.
- flush is assumed to be a valid deflate() flush value. If flush is Z_FINISH,
- then the deflate() state is reset to start a new gzip stream. If gz->direct
- is true, then simply write to the output file without compressing, and
- ignore flush. */
-local int gz_comp(
- gz_statep state,
- int flush)
-{
- int ret, got;
- unsigned have;
- z_streamp strm = &(state->strm);
-
- /* allocate memory if this is the first time through */
- if (state->size == 0 && gz_init(state) == -1)
- return -1;
-
- /* write directly if requested */
- if (state->direct) {
- got = write(state->fd, strm->next_in, strm->avail_in);
- if (got < 0 || (unsigned)got != strm->avail_in) {
- gz_error(state, Z_ERRNO, zstrerror());
- return -1;
- }
- strm->avail_in = 0;
- return 0;
- }
-
- /* run deflate() on provided input until it produces no more output */
- ret = Z_OK;
- do {
- /* write out current buffer contents if full, or if flushing, but if
- doing Z_FINISH then don't write until we get to Z_STREAM_END */
- if (strm->avail_out == 0 || (flush != Z_NO_FLUSH &&
- (flush != Z_FINISH || ret == Z_STREAM_END))) {
- have = (unsigned)(strm->next_out - state->x.next);
- if (have && ((got = write(state->fd, state->x.next, have)) < 0 ||
- (unsigned)got != have)) {
- gz_error(state, Z_ERRNO, zstrerror());
- return -1;
- }
- if (strm->avail_out == 0) {
- strm->avail_out = state->size;
- strm->next_out = state->out;
- }
- state->x.next = strm->next_out;
- }
-
- /* compress */
- have = strm->avail_out;
- ret = deflate(strm, flush);
- if (ret == Z_STREAM_ERROR) {
- gz_error(state, Z_STREAM_ERROR,
- "internal error: deflate stream corrupt");
- return -1;
- }
- have -= strm->avail_out;
- } while (have);
-
- /* if that completed a deflate stream, allow another to start */
- if (flush == Z_FINISH)
- deflateReset(strm);
-
- /* all done, no errors */
- return 0;
-}
-
-/* Compress len zeros to output. Return -1 on error, 0 on success. */
-local int gz_zero(
- gz_statep state,
- z_off64_t len)
-{
- int first;
- unsigned n;
- z_streamp strm = &(state->strm);
-
- /* consume whatever's left in the input buffer */
- if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1)
- return -1;
-
- /* compress len zeros (len guaranteed > 0) */
- first = 1;
- while (len) {
- n = GT_OFF(state->size) || (z_off64_t)state->size > len ?
- (unsigned)len : state->size;
- if (first) {
- memset(state->in, 0, n);
- first = 0;
- }
- strm->avail_in = n;
- strm->next_in = state->in;
- state->x.pos += n;
- if (gz_comp(state, Z_NO_FLUSH) == -1)
- return -1;
- len -= n;
- }
- return 0;
-}
-
-/* -- see zlib.h -- */
-int ZEXPORT gzwrite(
- gzFile file,
- voidpc buf,
- unsigned len)
-{
- unsigned put = len;
- gz_statep state;
- z_streamp strm;
-
- /* get internal structure */
- if (file == NULL)
- return 0;
- state = (gz_statep)file;
- strm = &(state->strm);
-
- /* check that we're writing and that there's no error */
- if (state->mode != GZ_WRITE || state->err != Z_OK)
- return 0;
-
- /* since an int is returned, make sure len fits in one, otherwise return
- with an error (this avoids the flaw in the interface) */
- if ((int)len < 0) {
- gz_error(state, Z_DATA_ERROR, "requested length does not fit in int");
- return 0;
- }
-
- /* if len is zero, avoid unnecessary operations */
- if (len == 0)
- return 0;
-
- /* allocate memory if this is the first time through */
- if (state->size == 0 && gz_init(state) == -1)
- return 0;
-
- /* check for seek request */
- if (state->seek) {
- state->seek = 0;
- if (gz_zero(state, state->skip) == -1)
- return 0;
- }
-
- /* for small len, copy to input buffer, otherwise compress directly */
- if (len < state->size) {
- /* copy to input buffer, compress when full */
- do {
- unsigned have, copy;
-
- if (strm->avail_in == 0)
- strm->next_in = state->in;
- have = (unsigned)((strm->next_in + strm->avail_in) - state->in);
- copy = state->size - have;
- if (copy > len)
- copy = len;
- memcpy(state->in + have, buf, copy);
- strm->avail_in += copy;
- state->x.pos += copy;
- buf = (const char *)buf + copy;
- len -= copy;
- if (len && gz_comp(state, Z_NO_FLUSH) == -1)
- return 0;
- } while (len);
- }
- else {
- /* consume whatever's left in the input buffer */
- if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1)
- return 0;
-
- /* directly compress user buffer to file */
- strm->avail_in = len;
- strm->next_in = (z_const Bytef *)buf;
- state->x.pos += len;
- if (gz_comp(state, Z_NO_FLUSH) == -1)
- return 0;
- }
-
- /* input was all buffered or compressed (put will fit in int) */
- return (int)put;
-}
-
-/* -- see zlib.h -- */
-int ZEXPORT gzputc(
- gzFile file,
- int c)
-{
- unsigned have;
- unsigned char buf[1];
- gz_statep state;
- z_streamp strm;
-
- /* get internal structure */
- if (file == NULL)
- return -1;
- state = (gz_statep)file;
- strm = &(state->strm);
-
- /* check that we're writing and that there's no error */
- if (state->mode != GZ_WRITE || state->err != Z_OK)
- return -1;
-
- /* check for seek request */
- if (state->seek) {
- state->seek = 0;
- if (gz_zero(state, state->skip) == -1)
- return -1;
- }
-
- /* try writing to input buffer for speed (state->size == 0 if buffer not
- initialized) */
- if (state->size) {
- if (strm->avail_in == 0)
- strm->next_in = state->in;
- have = (unsigned)((strm->next_in + strm->avail_in) - state->in);
- if (have < state->size) {
- state->in[have] = c;
- strm->avail_in++;
- state->x.pos++;
- return c & 0xff;
- }
- }
-
- /* no room in buffer or not initialized, use gz_write() */
- buf[0] = c;
- if (gzwrite(file, buf, 1) != 1)
- return -1;
- return c & 0xff;
-}
-
-/* -- see zlib.h -- */
-int ZEXPORT gzputs(
- gzFile file,
- const char *str)
-{
- int ret;
- unsigned len;
-
- /* write string */
- len = (unsigned)strlen(str);
- ret = gzwrite(file, str, len);
- return ret == 0 && len != 0 ? -1 : ret;
-}
-
-#if defined(STDC) || defined(Z_HAVE_STDARG_H)
-#include <stdarg.h>
-
-/* -- see zlib.h -- */
-int ZEXPORTVA gzvprintf(gzFile file, const char *format, va_list va)
-{
- int size, len;
- gz_statep state;
- z_streamp strm;
-
- /* get internal structure */
- if (file == NULL)
- return -1;
- state = (gz_statep)file;
- strm = &(state->strm);
-
- /* check that we're writing and that there's no error */
- if (state->mode != GZ_WRITE || state->err != Z_OK)
- return 0;
-
- /* make sure we have some buffer space */
- if (state->size == 0 && gz_init(state) == -1)
- return 0;
-
- /* check for seek request */
- if (state->seek) {
- state->seek = 0;
- if (gz_zero(state, state->skip) == -1)
- return 0;
- }
-
- /* consume whatever's left in the input buffer */
- if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1)
- return 0;
-
- /* do the printf() into the input buffer, put length in len */
- size = (int)(state->size);
- state->in[size - 1] = 0;
-#ifdef NO_vsnprintf
-# ifdef HAS_vsprintf_void
- (void)vsprintf((char *)(state->in), format, va);
- for (len = 0; len < size; len++)
- if (state->in[len] == 0) break;
-# else
- len = vsprintf((char *)(state->in), format, va);
-# endif
-#else
-# ifdef HAS_vsnprintf_void
- (void)vsnprintf((char *)(state->in), size, format, va);
- len = strlen((char *)(state->in));
-# else
- len = vsnprintf((char *)(state->in), size, format, va);
-# endif
-#endif
-
- /* check that printf() results fit in buffer */
- if (len <= 0 || len >= (int)size || state->in[size - 1] != 0)
- return 0;
-
- /* update buffer and position, defer compression until needed */
- strm->avail_in = (unsigned)len;
- strm->next_in = state->in;
- state->x.pos += len;
- return len;
-}
-
-int ZEXPORTVA gzprintf(gzFile file, const char *format, ...)
-{
- va_list va;
- int ret;
-
- va_start(va, format);
- ret = gzvprintf(file, format, va);
- va_end(va);
- return ret;
-}
-
-#else /* !STDC && !Z_HAVE_STDARG_H */
-
-/* -- see zlib.h -- */
-int ZEXPORTVA gzprintf (
- gzFile file,
- const char *format,
- int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8, int a9, int a10,
- int a11, int a12, int a13, int a14, int a15, int a16, int a17, int a18, int a19, int a20)
-{
- int size, len;
- gz_statep state;
- z_streamp strm;
-
- /* get internal structure */
- if (file == NULL)
- return -1;
- state = (gz_statep)file;
- strm = &(state->strm);
-
- /* check that can really pass pointer in ints */
- if (sizeof(int) != sizeof(void *))
- return 0;
-
- /* check that we're writing and that there's no error */
- if (state->mode != GZ_WRITE || state->err != Z_OK)
- return 0;
-
- /* make sure we have some buffer space */
- if (state->size == 0 && gz_init(state) == -1)
- return 0;
-
- /* check for seek request */
- if (state->seek) {
- state->seek = 0;
- if (gz_zero(state, state->skip) == -1)
- return 0;
- }
-
- /* consume whatever's left in the input buffer */
- if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1)
- return 0;
-
- /* do the printf() into the input buffer, put length in len */
- size = (int)(state->size);
- state->in[size - 1] = 0;
-#ifdef NO_snprintf
-# ifdef HAS_sprintf_void
- sprintf((char *)(state->in), format, a1, a2, a3, a4, a5, a6, a7, a8,
- a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
- for (len = 0; len < size; len++)
- if (state->in[len] == 0) break;
-# else
- len = sprintf((char *)(state->in), format, a1, a2, a3, a4, a5, a6, a7, a8,
- a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
-# endif
-#else
-# ifdef HAS_snprintf_void
- snprintf((char *)(state->in), size, format, a1, a2, a3, a4, a5, a6, a7, a8,
- a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
- len = strlen((char *)(state->in));
-# else
- len = snprintf((char *)(state->in), size, format, a1, a2, a3, a4, a5, a6,
- a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18,
- a19, a20);
-# endif
-#endif
-
- /* check that printf() results fit in buffer */
- if (len <= 0 || len >= (int)size || state->in[size - 1] != 0)
- return 0;
-
- /* update buffer and position, defer compression until needed */
- strm->avail_in = (unsigned)len;
- strm->next_in = state->in;
- state->x.pos += len;
- return len;
-}
-
-#endif
-
-/* -- see zlib.h -- */
-int ZEXPORT gzflush(
- gzFile file,
- int flush)
-{
- gz_statep state;
-
- /* get internal structure */
- if (file == NULL)
- return -1;
- state = (gz_statep)file;
-
- /* check that we're writing and that there's no error */
- if (state->mode != GZ_WRITE || state->err != Z_OK)
- return Z_STREAM_ERROR;
-
- /* check flush parameter */
- if (flush < 0 || flush > Z_FINISH)
- return Z_STREAM_ERROR;
-
- /* check for seek request */
- if (state->seek) {
- state->seek = 0;
- if (gz_zero(state, state->skip) == -1)
- return -1;
- }
-
- /* compress remaining data with requested flush */
- gz_comp(state, flush);
- return state->err;
-}
-
-/* -- see zlib.h -- */
-int ZEXPORT gzsetparams(
- gzFile file,
- int level,
- int strategy)
-{
- gz_statep state;
- z_streamp strm;
-
- /* get internal structure */
- if (file == NULL)
- return Z_STREAM_ERROR;
- state = (gz_statep)file;
- strm = &(state->strm);
-
- /* check that we're writing and that there's no error */
- if (state->mode != GZ_WRITE || state->err != Z_OK)
- return Z_STREAM_ERROR;
-
- /* if no change is requested, then do nothing */
- if (level == state->level && strategy == state->strategy)
- return Z_OK;
-
- /* check for seek request */
- if (state->seek) {
- state->seek = 0;
- if (gz_zero(state, state->skip) == -1)
- return -1;
- }
-
- /* change compression parameters for subsequent input */
- if (state->size) {
- /* flush previous input with previous parameters before changing */
- if (strm->avail_in && gz_comp(state, Z_PARTIAL_FLUSH) == -1)
- return state->err;
- deflateParams(strm, level, strategy);
- }
- state->level = level;
- state->strategy = strategy;
- return Z_OK;
-}
-
-/* -- see zlib.h -- */
-int ZEXPORT gzclose_w(
- gzFile file)
-{
- int ret = Z_OK;
- gz_statep state;
-
- /* get internal structure */
- if (file == NULL)
- return Z_STREAM_ERROR;
- state = (gz_statep)file;
-
- /* check that we're writing */
- if (state->mode != GZ_WRITE)
- return Z_STREAM_ERROR;
-
- /* check for seek request */
- if (state->seek) {
- state->seek = 0;
- if (gz_zero(state, state->skip) == -1)
- ret = state->err;
- }
-
- /* flush, free memory, and close file */
- if (gz_comp(state, Z_FINISH) == -1)
- ret = state->err;
- if (state->size) {
- if (!state->direct) {
- (void)deflateEnd(&(state->strm));
- free(state->out);
- }
- free(state->in);
- }
- gz_error(state, Z_OK, NULL);
- free(state->path);
- if (close(state->fd) == -1)
- ret = Z_ERRNO;
- free(state);
- return ret;
-}
diff --git a/chromium/third_party/pdfium/third_party/zlib_v128/infback.c b/chromium/third_party/pdfium/third_party/zlib_v128/infback.c
deleted file mode 100644
index 157bbd64e96..00000000000
--- a/chromium/third_party/pdfium/third_party/zlib_v128/infback.c
+++ /dev/null
@@ -1,640 +0,0 @@
-/* infback.c -- inflate using a call-back interface
- * Copyright (C) 1995-2011 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/*
- This code is largely copied from inflate.c. Normally either infback.o or
- inflate.o would be linked into an application--not both. The interface
- with inffast.c is retained so that optimized assembler-coded versions of
- inflate_fast() can be used with either inflate.c or infback.c.
- */
-
-#include "zutil.h"
-#include "inftrees.h"
-#include "inflate.h"
-#include "inffast.h"
-
-/* function prototypes */
-local void fixedtables OF((struct inflate_state FAR *state));
-
-/*
- strm provides memory allocation functions in zalloc and zfree, or
- Z_NULL to use the library memory allocation functions.
-
- windowBits is in the range 8..15, and window is a user-supplied
- window and output buffer that is 2**windowBits bytes.
- */
-int ZEXPORT inflateBackInit_(
-z_streamp strm,
-int windowBits,
-unsigned char FAR *window,
-const char *version,
-int stream_size)
-{
- struct inflate_state FAR *state;
-
- if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
- stream_size != (int)(sizeof(z_stream)))
- return Z_VERSION_ERROR;
- if (strm == Z_NULL || window == Z_NULL ||
- windowBits < 8 || windowBits > 15)
- return Z_STREAM_ERROR;
- strm->msg = Z_NULL; /* in case we return an error */
- if (strm->zalloc == (alloc_func)0) {
-#ifdef Z_SOLO
- return Z_STREAM_ERROR;
-#else
- strm->zalloc = zcalloc;
- strm->opaque = (voidpf)0;
-#endif
- }
- if (strm->zfree == (free_func)0)
-#ifdef Z_SOLO
- return Z_STREAM_ERROR;
-#else
- strm->zfree = zcfree;
-#endif
- state = (struct inflate_state FAR *)ZALLOC(strm, 1,
- sizeof(struct inflate_state));
- if (state == Z_NULL) return Z_MEM_ERROR;
- Tracev((stderr, "inflate: allocated\n"));
- strm->state = (struct internal_state FAR *)state;
- state->dmax = 32768U;
- state->wbits = windowBits;
- state->wsize = 1U << windowBits;
- state->window = window;
- state->wnext = 0;
- state->whave = 0;
- return Z_OK;
-}
-
-/*
- Return state with length and distance decoding tables and index sizes set to
- fixed code decoding. Normally this returns fixed tables from inffixed.h.
- If BUILDFIXED is defined, then instead this routine builds the tables the
- first time it's called, and returns those tables the first time and
- thereafter. This reduces the size of the code by about 2K bytes, in
- exchange for a little execution time. However, BUILDFIXED should not be
- used for threaded applications, since the rewriting of the tables and virgin
- may not be thread-safe.
- */
-local void fixedtables(
-struct inflate_state FAR *state)
-{
-#ifdef BUILDFIXED
- static int virgin = 1;
- static code *lenfix, *distfix;
- static code fixed[544];
-
- /* build fixed huffman tables if first call (may not be thread safe) */
- if (virgin) {
- unsigned sym, bits;
- static code *next;
-
- /* literal/length table */
- sym = 0;
- while (sym < 144) state->lens[sym++] = 8;
- while (sym < 256) state->lens[sym++] = 9;
- while (sym < 280) state->lens[sym++] = 7;
- while (sym < 288) state->lens[sym++] = 8;
- next = fixed;
- lenfix = next;
- bits = 9;
- inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work);
-
- /* distance table */
- sym = 0;
- while (sym < 32) state->lens[sym++] = 5;
- distfix = next;
- bits = 5;
- inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work);
-
- /* do this just once */
- virgin = 0;
- }
-#else /* !BUILDFIXED */
-# include "inffixed.h"
-#endif /* BUILDFIXED */
- state->lencode = lenfix;
- state->lenbits = 9;
- state->distcode = distfix;
- state->distbits = 5;
-}
-
-/* Macros for inflateBack(): */
-
-/* Load returned state from inflate_fast() */
-#define LOAD() \
- do { \
- put = strm->next_out; \
- left = strm->avail_out; \
- next = strm->next_in; \
- have = strm->avail_in; \
- hold = state->hold; \
- bits = state->bits; \
- } while (0)
-
-/* Set state from registers for inflate_fast() */
-#define RESTORE() \
- do { \
- strm->next_out = put; \
- strm->avail_out = left; \
- strm->next_in = next; \
- strm->avail_in = have; \
- state->hold = hold; \
- state->bits = bits; \
- } while (0)
-
-/* Clear the input bit accumulator */
-#define INITBITS() \
- do { \
- hold = 0; \
- bits = 0; \
- } while (0)
-
-/* Assure that some input is available. If input is requested, but denied,
- then return a Z_BUF_ERROR from inflateBack(). */
-#define PULL() \
- do { \
- if (have == 0) { \
- have = in(in_desc, &next); \
- if (have == 0) { \
- next = Z_NULL; \
- ret = Z_BUF_ERROR; \
- goto inf_leave; \
- } \
- } \
- } while (0)
-
-/* Get a byte of input into the bit accumulator, or return from inflateBack()
- with an error if there is no input available. */
-#define PULLBYTE() \
- do { \
- PULL(); \
- have--; \
- hold += (unsigned long)(*next++) << bits; \
- bits += 8; \
- } while (0)
-
-/* Assure that there are at least n bits in the bit accumulator. If there is
- not enough available input to do that, then return from inflateBack() with
- an error. */
-#define NEEDBITS(n) \
- do { \
- while (bits < (unsigned)(n)) \
- PULLBYTE(); \
- } while (0)
-
-/* Return the low n bits of the bit accumulator (n < 16) */
-#define BITS(n) \
- ((unsigned)hold & ((1U << (n)) - 1))
-
-/* Remove n bits from the bit accumulator */
-#define DROPBITS(n) \
- do { \
- hold >>= (n); \
- bits -= (unsigned)(n); \
- } while (0)
-
-/* Remove zero to seven bits as needed to go to a byte boundary */
-#define BYTEBITS() \
- do { \
- hold >>= bits & 7; \
- bits -= bits & 7; \
- } while (0)
-
-/* Assure that some output space is available, by writing out the window
- if it's full. If the write fails, return from inflateBack() with a
- Z_BUF_ERROR. */
-#define ROOM() \
- do { \
- if (left == 0) { \
- put = state->window; \
- left = state->wsize; \
- state->whave = left; \
- if (out(out_desc, put, left)) { \
- ret = Z_BUF_ERROR; \
- goto inf_leave; \
- } \
- } \
- } while (0)
-
-/*
- strm provides the memory allocation functions and window buffer on input,
- and provides information on the unused input on return. For Z_DATA_ERROR
- returns, strm will also provide an error message.
-
- in() and out() are the call-back input and output functions. When
- inflateBack() needs more input, it calls in(). When inflateBack() has
- filled the window with output, or when it completes with data in the
- window, it calls out() to write out the data. The application must not
- change the provided input until in() is called again or inflateBack()
- returns. The application must not change the window/output buffer until
- inflateBack() returns.
-
- in() and out() are called with a descriptor parameter provided in the
- inflateBack() call. This parameter can be a structure that provides the
- information required to do the read or write, as well as accumulated
- information on the input and output such as totals and check values.
-
- in() should return zero on failure. out() should return non-zero on
- failure. If either in() or out() fails, than inflateBack() returns a
- Z_BUF_ERROR. strm->next_in can be checked for Z_NULL to see whether it
- was in() or out() that caused in the error. Otherwise, inflateBack()
- returns Z_STREAM_END on success, Z_DATA_ERROR for an deflate format
- error, or Z_MEM_ERROR if it could not allocate memory for the state.
- inflateBack() can also return Z_STREAM_ERROR if the input parameters
- are not correct, i.e. strm is Z_NULL or the state was not initialized.
- */
-int ZEXPORT inflateBack(
-z_streamp strm,
-in_func in,
-void FAR *in_desc,
-out_func out,
-void FAR *out_desc)
-{
- struct inflate_state FAR *state;
- z_const unsigned char FAR *next; /* next input */
- unsigned char FAR *put; /* next output */
- unsigned have, left; /* available input and output */
- unsigned long hold; /* bit buffer */
- unsigned bits; /* bits in bit buffer */
- unsigned copy; /* number of stored or match bytes to copy */
- unsigned char FAR *from; /* where to copy match bytes from */
- code here; /* current decoding table entry */
- code last; /* parent table entry */
- unsigned len; /* length to copy for repeats, bits to drop */
- int ret; /* return code */
- static const unsigned short order[19] = /* permutation of code lengths */
- {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
-
- /* Check that the strm exists and that the state was initialized */
- if (strm == Z_NULL || strm->state == Z_NULL)
- return Z_STREAM_ERROR;
- state = (struct inflate_state FAR *)strm->state;
-
- /* Reset the state */
- strm->msg = Z_NULL;
- state->mode = TYPE;
- state->last = 0;
- state->whave = 0;
- next = strm->next_in;
- have = next != Z_NULL ? strm->avail_in : 0;
- hold = 0;
- bits = 0;
- put = state->window;
- left = state->wsize;
-
- /* Inflate until end of block marked as last */
- for (;;)
- switch (state->mode) {
- case TYPE:
- /* determine and dispatch block type */
- if (state->last) {
- BYTEBITS();
- state->mode = DONE;
- break;
- }
- NEEDBITS(3);
- state->last = BITS(1);
- DROPBITS(1);
- switch (BITS(2)) {
- case 0: /* stored block */
- Tracev((stderr, "inflate: stored block%s\n",
- state->last ? " (last)" : ""));
- state->mode = STORED;
- break;
- case 1: /* fixed block */
- fixedtables(state);
- Tracev((stderr, "inflate: fixed codes block%s\n",
- state->last ? " (last)" : ""));
- state->mode = LEN; /* decode codes */
- break;
- case 2: /* dynamic block */
- Tracev((stderr, "inflate: dynamic codes block%s\n",
- state->last ? " (last)" : ""));
- state->mode = TABLE;
- break;
- case 3:
- strm->msg = (char *)"invalid block type";
- state->mode = BAD;
- }
- DROPBITS(2);
- break;
-
- case STORED:
- /* get and verify stored block length */
- BYTEBITS(); /* go to byte boundary */
- NEEDBITS(32);
- if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) {
- strm->msg = (char *)"invalid stored block lengths";
- state->mode = BAD;
- break;
- }
- state->length = (unsigned)hold & 0xffff;
- Tracev((stderr, "inflate: stored length %u\n",
- state->length));
- INITBITS();
-
- /* copy stored block from input to output */
- while (state->length != 0) {
- copy = state->length;
- PULL();
- ROOM();
- if (copy > have) copy = have;
- if (copy > left) copy = left;
- zmemcpy(put, next, copy);
- have -= copy;
- next += copy;
- left -= copy;
- put += copy;
- state->length -= copy;
- }
- Tracev((stderr, "inflate: stored end\n"));
- state->mode = TYPE;
- break;
-
- case TABLE:
- /* get dynamic table entries descriptor */
- NEEDBITS(14);
- state->nlen = BITS(5) + 257;
- DROPBITS(5);
- state->ndist = BITS(5) + 1;
- DROPBITS(5);
- state->ncode = BITS(4) + 4;
- DROPBITS(4);
-#ifndef PKZIP_BUG_WORKAROUND
- if (state->nlen > 286 || state->ndist > 30) {
- strm->msg = (char *)"too many length or distance symbols";
- state->mode = BAD;
- break;
- }
-#endif
- Tracev((stderr, "inflate: table sizes ok\n"));
-
- /* get code length code lengths (not a typo) */
- state->have = 0;
- while (state->have < state->ncode) {
- NEEDBITS(3);
- state->lens[order[state->have++]] = (unsigned short)BITS(3);
- DROPBITS(3);
- }
- while (state->have < 19)
- state->lens[order[state->have++]] = 0;
- state->next = state->codes;
- state->lencode = (code const FAR *)(state->next);
- state->lenbits = 7;
- ret = inflate_table(CODES, state->lens, 19, &(state->next),
- &(state->lenbits), state->work);
- if (ret) {
- strm->msg = (char *)"invalid code lengths set";
- state->mode = BAD;
- break;
- }
- Tracev((stderr, "inflate: code lengths ok\n"));
-
- /* get length and distance code code lengths */
- state->have = 0;
- while (state->have < state->nlen + state->ndist) {
- for (;;) {
- here = state->lencode[BITS(state->lenbits)];
- if ((unsigned)(here.bits) <= bits) break;
- PULLBYTE();
- }
- if (here.val < 16) {
- DROPBITS(here.bits);
- state->lens[state->have++] = here.val;
- }
- else {
- if (here.val == 16) {
- NEEDBITS(here.bits + 2);
- DROPBITS(here.bits);
- if (state->have == 0) {
- strm->msg = (char *)"invalid bit length repeat";
- state->mode = BAD;
- break;
- }
- len = (unsigned)(state->lens[state->have - 1]);
- copy = 3 + BITS(2);
- DROPBITS(2);
- }
- else if (here.val == 17) {
- NEEDBITS(here.bits + 3);
- DROPBITS(here.bits);
- len = 0;
- copy = 3 + BITS(3);
- DROPBITS(3);
- }
- else {
- NEEDBITS(here.bits + 7);
- DROPBITS(here.bits);
- len = 0;
- copy = 11 + BITS(7);
- DROPBITS(7);
- }
- if (state->have + copy > state->nlen + state->ndist) {
- strm->msg = (char *)"invalid bit length repeat";
- state->mode = BAD;
- break;
- }
- while (copy--)
- state->lens[state->have++] = (unsigned short)len;
- }
- }
-
- /* handle error breaks in while */
- if (state->mode == BAD) break;
-
- /* check for end-of-block code (better have one) */
- if (state->lens[256] == 0) {
- strm->msg = (char *)"invalid code -- missing end-of-block";
- state->mode = BAD;
- break;
- }
-
- /* build code tables -- note: do not change the lenbits or distbits
- values here (9 and 6) without reading the comments in inftrees.h
- concerning the ENOUGH constants, which depend on those values */
- state->next = state->codes;
- state->lencode = (code const FAR *)(state->next);
- state->lenbits = 9;
- ret = inflate_table(LENS, state->lens, state->nlen, &(state->next),
- &(state->lenbits), state->work);
- if (ret) {
- strm->msg = (char *)"invalid literal/lengths set";
- state->mode = BAD;
- break;
- }
- state->distcode = (code const FAR *)(state->next);
- state->distbits = 6;
- ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist,
- &(state->next), &(state->distbits), state->work);
- if (ret) {
- strm->msg = (char *)"invalid distances set";
- state->mode = BAD;
- break;
- }
- Tracev((stderr, "inflate: codes ok\n"));
- state->mode = LEN;
-
- case LEN:
- /* use inflate_fast() if we have enough input and output */
- if (have >= 6 && left >= 258) {
- RESTORE();
- if (state->whave < state->wsize)
- state->whave = state->wsize - left;
- inflate_fast(strm, state->wsize);
- LOAD();
- break;
- }
-
- /* get a literal, length, or end-of-block code */
- for (;;) {
- here = state->lencode[BITS(state->lenbits)];
- if ((unsigned)(here.bits) <= bits) break;
- PULLBYTE();
- }
- if (here.op && (here.op & 0xf0) == 0) {
- last = here;
- for (;;) {
- here = state->lencode[last.val +
- (BITS(last.bits + last.op) >> last.bits)];
- if ((unsigned)(last.bits + here.bits) <= bits) break;
- PULLBYTE();
- }
- DROPBITS(last.bits);
- }
- DROPBITS(here.bits);
- state->length = (unsigned)here.val;
-
- /* process literal */
- if (here.op == 0) {
- Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
- "inflate: literal '%c'\n" :
- "inflate: literal 0x%02x\n", here.val));
- ROOM();
- *put++ = (unsigned char)(state->length);
- left--;
- state->mode = LEN;
- break;
- }
-
- /* process end of block */
- if (here.op & 32) {
- Tracevv((stderr, "inflate: end of block\n"));
- state->mode = TYPE;
- break;
- }
-
- /* invalid code */
- if (here.op & 64) {
- strm->msg = (char *)"invalid literal/length code";
- state->mode = BAD;
- break;
- }
-
- /* length code -- get extra bits, if any */
- state->extra = (unsigned)(here.op) & 15;
- if (state->extra != 0) {
- NEEDBITS(state->extra);
- state->length += BITS(state->extra);
- DROPBITS(state->extra);
- }
- Tracevv((stderr, "inflate: length %u\n", state->length));
-
- /* get distance code */
- for (;;) {
- here = state->distcode[BITS(state->distbits)];
- if ((unsigned)(here.bits) <= bits) break;
- PULLBYTE();
- }
- if ((here.op & 0xf0) == 0) {
- last = here;
- for (;;) {
- here = state->distcode[last.val +
- (BITS(last.bits + last.op) >> last.bits)];
- if ((unsigned)(last.bits + here.bits) <= bits) break;
- PULLBYTE();
- }
- DROPBITS(last.bits);
- }
- DROPBITS(here.bits);
- if (here.op & 64) {
- strm->msg = (char *)"invalid distance code";
- state->mode = BAD;
- break;
- }
- state->offset = (unsigned)here.val;
-
- /* get distance extra bits, if any */
- state->extra = (unsigned)(here.op) & 15;
- if (state->extra != 0) {
- NEEDBITS(state->extra);
- state->offset += BITS(state->extra);
- DROPBITS(state->extra);
- }
- if (state->offset > state->wsize - (state->whave < state->wsize ?
- left : 0)) {
- strm->msg = (char *)"invalid distance too far back";
- state->mode = BAD;
- break;
- }
- Tracevv((stderr, "inflate: distance %u\n", state->offset));
-
- /* copy match from window to output */
- do {
- ROOM();
- copy = state->wsize - state->offset;
- if (copy < left) {
- from = put + copy;
- copy = left - copy;
- }
- else {
- from = put - state->offset;
- copy = left;
- }
- if (copy > state->length) copy = state->length;
- state->length -= copy;
- left -= copy;
- do {
- *put++ = *from++;
- } while (--copy);
- } while (state->length != 0);
- break;
-
- case DONE:
- /* inflate stream terminated properly -- write leftover output */
- ret = Z_STREAM_END;
- if (left < state->wsize) {
- if (out(out_desc, state->window, state->wsize - left))
- ret = Z_BUF_ERROR;
- }
- goto inf_leave;
-
- case BAD:
- ret = Z_DATA_ERROR;
- goto inf_leave;
-
- default: /* can't happen, but makes compilers happy */
- ret = Z_STREAM_ERROR;
- goto inf_leave;
- }
-
- /* Return unused input */
- inf_leave:
- strm->next_in = next;
- strm->avail_in = have;
- return ret;
-}
-
-int ZEXPORT inflateBackEnd(
-z_streamp strm)
-{
- if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0)
- return Z_STREAM_ERROR;
- ZFREE(strm, strm->state);
- strm->state = Z_NULL;
- Tracev((stderr, "inflate: end\n"));
- return Z_OK;
-}
diff --git a/chromium/third_party/pdfium/third_party/zlib_v128/inffast.c b/chromium/third_party/pdfium/third_party/zlib_v128/inffast.c
deleted file mode 100644
index 3fcffae4981..00000000000
--- a/chromium/third_party/pdfium/third_party/zlib_v128/inffast.c
+++ /dev/null
@@ -1,340 +0,0 @@
-/* inffast.c -- fast decoding
- * Copyright (C) 1995-2008, 2010, 2013 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-#include "zutil.h"
-#include "inftrees.h"
-#include "inflate.h"
-#include "inffast.h"
-
-#ifndef ASMINF
-
-/* Allow machine dependent optimization for post-increment or pre-increment.
- Based on testing to date,
- Pre-increment preferred for:
- - PowerPC G3 (Adler)
- - MIPS R5000 (Randers-Pehrson)
- Post-increment preferred for:
- - none
- No measurable difference:
- - Pentium III (Anderson)
- - M68060 (Nikl)
- */
-#ifdef POSTINC
-# define OFF 0
-# define PUP(a) *(a)++
-#else
-# define OFF 1
-# define PUP(a) *++(a)
-#endif
-
-/*
- Decode literal, length, and distance codes and write out the resulting
- literal and match bytes until either not enough input or output is
- available, an end-of-block is encountered, or a data error is encountered.
- When large enough input and output buffers are supplied to inflate(), for
- example, a 16K input buffer and a 64K output buffer, more than 95% of the
- inflate execution time is spent in this routine.
-
- Entry assumptions:
-
- state->mode == LEN
- strm->avail_in >= 6
- strm->avail_out >= 258
- start >= strm->avail_out
- state->bits < 8
-
- On return, state->mode is one of:
-
- LEN -- ran out of enough output space or enough available input
- TYPE -- reached end of block code, inflate() to interpret next block
- BAD -- error in block data
-
- Notes:
-
- - The maximum input bits used by a length/distance pair is 15 bits for the
- length code, 5 bits for the length extra, 15 bits for the distance code,
- and 13 bits for the distance extra. This totals 48 bits, or six bytes.
- Therefore if strm->avail_in >= 6, then there is enough input to avoid
- checking for available input while decoding.
-
- - The maximum bytes that a single length/distance pair can output is 258
- bytes, which is the maximum length that can be coded. inflate_fast()
- requires strm->avail_out >= 258 for each loop to avoid checking for
- output space.
- */
-void ZLIB_INTERNAL inflate_fast(
-z_streamp strm,
-unsigned start) /* inflate()'s starting value for strm->avail_out */
-{
- struct inflate_state FAR *state;
- z_const unsigned char FAR *in; /* local strm->next_in */
- z_const unsigned char FAR *last; /* have enough input while in < last */
- unsigned char FAR *out; /* local strm->next_out */
- unsigned char FAR *beg; /* inflate()'s initial strm->next_out */
- unsigned char FAR *end; /* while out < end, enough space available */
-#ifdef INFLATE_STRICT
- unsigned dmax; /* maximum distance from zlib header */
-#endif
- unsigned wsize; /* window size or zero if not using window */
- unsigned whave; /* valid bytes in the window */
- unsigned wnext; /* window write index */
- unsigned char FAR *window; /* allocated sliding window, if wsize != 0 */
- unsigned long hold; /* local strm->hold */
- unsigned bits; /* local strm->bits */
- code const FAR *lcode; /* local strm->lencode */
- code const FAR *dcode; /* local strm->distcode */
- unsigned lmask; /* mask for first level of length codes */
- unsigned dmask; /* mask for first level of distance codes */
- code here; /* retrieved table entry */
- unsigned op; /* code bits, operation, extra bits, or */
- /* window position, window bytes to copy */
- unsigned len; /* match length, unused bytes */
- unsigned dist; /* match distance */
- unsigned char FAR *from; /* where to copy match from */
-
- /* copy state to local variables */
- state = (struct inflate_state FAR *)strm->state;
- in = strm->next_in - OFF;
- last = in + (strm->avail_in - 5);
- out = strm->next_out - OFF;
- beg = out - (start - strm->avail_out);
- end = out + (strm->avail_out - 257);
-#ifdef INFLATE_STRICT
- dmax = state->dmax;
-#endif
- wsize = state->wsize;
- whave = state->whave;
- wnext = state->wnext;
- window = state->window;
- hold = state->hold;
- bits = state->bits;
- lcode = state->lencode;
- dcode = state->distcode;
- lmask = (1U << state->lenbits) - 1;
- dmask = (1U << state->distbits) - 1;
-
- /* decode literals and length/distances until end-of-block or not enough
- input data or output space */
- do {
- if (bits < 15) {
- hold += (unsigned long)(PUP(in)) << bits;
- bits += 8;
- hold += (unsigned long)(PUP(in)) << bits;
- bits += 8;
- }
- here = lcode[hold & lmask];
- dolen:
- op = (unsigned)(here.bits);
- hold >>= op;
- bits -= op;
- op = (unsigned)(here.op);
- if (op == 0) { /* literal */
- Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
- "inflate: literal '%c'\n" :
- "inflate: literal 0x%02x\n", here.val));
- PUP(out) = (unsigned char)(here.val);
- }
- else if (op & 16) { /* length base */
- len = (unsigned)(here.val);
- op &= 15; /* number of extra bits */
- if (op) {
- if (bits < op) {
- hold += (unsigned long)(PUP(in)) << bits;
- bits += 8;
- }
- len += (unsigned)hold & ((1U << op) - 1);
- hold >>= op;
- bits -= op;
- }
- Tracevv((stderr, "inflate: length %u\n", len));
- if (bits < 15) {
- hold += (unsigned long)(PUP(in)) << bits;
- bits += 8;
- hold += (unsigned long)(PUP(in)) << bits;
- bits += 8;
- }
- here = dcode[hold & dmask];
- dodist:
- op = (unsigned)(here.bits);
- hold >>= op;
- bits -= op;
- op = (unsigned)(here.op);
- if (op & 16) { /* distance base */
- dist = (unsigned)(here.val);
- op &= 15; /* number of extra bits */
- if (bits < op) {
- hold += (unsigned long)(PUP(in)) << bits;
- bits += 8;
- if (bits < op) {
- hold += (unsigned long)(PUP(in)) << bits;
- bits += 8;
- }
- }
- dist += (unsigned)hold & ((1U << op) - 1);
-#ifdef INFLATE_STRICT
- if (dist > dmax) {
- strm->msg = (char *)"invalid distance too far back";
- state->mode = BAD;
- break;
- }
-#endif
- hold >>= op;
- bits -= op;
- Tracevv((stderr, "inflate: distance %u\n", dist));
- op = (unsigned)(out - beg); /* max distance in output */
- if (dist > op) { /* see if copy from window */
- op = dist - op; /* distance back in window */
- if (op > whave) {
- if (state->sane) {
- strm->msg =
- (char *)"invalid distance too far back";
- state->mode = BAD;
- break;
- }
-#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
- if (len <= op - whave) {
- do {
- PUP(out) = 0;
- } while (--len);
- continue;
- }
- len -= op - whave;
- do {
- PUP(out) = 0;
- } while (--op > whave);
- if (op == 0) {
- from = out - dist;
- do {
- PUP(out) = PUP(from);
- } while (--len);
- continue;
- }
-#endif
- }
- from = window - OFF;
- if (wnext == 0) { /* very common case */
- from += wsize - op;
- if (op < len) { /* some from window */
- len -= op;
- do {
- PUP(out) = PUP(from);
- } while (--op);
- from = out - dist; /* rest from output */
- }
- }
- else if (wnext < op) { /* wrap around window */
- from += wsize + wnext - op;
- op -= wnext;
- if (op < len) { /* some from end of window */
- len -= op;
- do {
- PUP(out) = PUP(from);
- } while (--op);
- from = window - OFF;
- if (wnext < len) { /* some from start of window */
- op = wnext;
- len -= op;
- do {
- PUP(out) = PUP(from);
- } while (--op);
- from = out - dist; /* rest from output */
- }
- }
- }
- else { /* contiguous in window */
- from += wnext - op;
- if (op < len) { /* some from window */
- len -= op;
- do {
- PUP(out) = PUP(from);
- } while (--op);
- from = out - dist; /* rest from output */
- }
- }
- while (len > 2) {
- PUP(out) = PUP(from);
- PUP(out) = PUP(from);
- PUP(out) = PUP(from);
- len -= 3;
- }
- if (len) {
- PUP(out) = PUP(from);
- if (len > 1)
- PUP(out) = PUP(from);
- }
- }
- else {
- from = out - dist; /* copy direct from output */
- do { /* minimum length is three */
- PUP(out) = PUP(from);
- PUP(out) = PUP(from);
- PUP(out) = PUP(from);
- len -= 3;
- } while (len > 2);
- if (len) {
- PUP(out) = PUP(from);
- if (len > 1)
- PUP(out) = PUP(from);
- }
- }
- }
- else if ((op & 64) == 0) { /* 2nd level distance code */
- here = dcode[here.val + (hold & ((1U << op) - 1))];
- goto dodist;
- }
- else {
- strm->msg = (char *)"invalid distance code";
- state->mode = BAD;
- break;
- }
- }
- else if ((op & 64) == 0) { /* 2nd level length code */
- here = lcode[here.val + (hold & ((1U << op) - 1))];
- goto dolen;
- }
- else if (op & 32) { /* end-of-block */
- Tracevv((stderr, "inflate: end of block\n"));
- state->mode = TYPE;
- break;
- }
- else {
- strm->msg = (char *)"invalid literal/length code";
- state->mode = BAD;
- break;
- }
- } while (in < last && out < end);
-
- /* return unused bytes (on entry, bits < 8, so in won't go too far back) */
- len = bits >> 3;
- in -= len;
- bits -= len << 3;
- hold &= (1U << bits) - 1;
-
- /* update state and return */
- strm->next_in = in + OFF;
- strm->next_out = out + OFF;
- strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last));
- strm->avail_out = (unsigned)(out < end ?
- 257 + (end - out) : 257 - (out - end));
- state->hold = hold;
- state->bits = bits;
- return;
-}
-
-/*
- inflate_fast() speedups that turned out slower (on a PowerPC G3 750CXe):
- - Using bit fields for code structure
- - Different op definition to avoid & for extra bits (do & for table bits)
- - Three separate decoding do-loops for direct, window, and wnext == 0
- - Special case for distance > 1 copies to do overlapped load and store copy
- - Explicit branch predictions (based on measured branch probabilities)
- - Deferring match copy and interspersed it with decoding subsequent codes
- - Swapping literal/length else
- - Swapping window/direct else
- - Larger unrolled copy loops (three is about right)
- - Moving len -= 3 statement into middle of loop
- */
-
-#endif /* !ASMINF */
diff --git a/chromium/third_party/pdfium/third_party/zlib_v128/inffast.h b/chromium/third_party/pdfium/third_party/zlib_v128/inffast.h
deleted file mode 100644
index e5c1aa4ca8c..00000000000
--- a/chromium/third_party/pdfium/third_party/zlib_v128/inffast.h
+++ /dev/null
@@ -1,11 +0,0 @@
-/* inffast.h -- header to use inffast.c
- * Copyright (C) 1995-2003, 2010 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* WARNING: this file should *not* be used by applications. It is
- part of the implementation of the compression library and is
- subject to change. Applications should only use zlib.h.
- */
-
-void ZLIB_INTERNAL inflate_fast OF((z_streamp strm, unsigned start));
diff --git a/chromium/third_party/pdfium/third_party/zlib_v128/inffixed.h b/chromium/third_party/pdfium/third_party/zlib_v128/inffixed.h
deleted file mode 100644
index d6283277694..00000000000
--- a/chromium/third_party/pdfium/third_party/zlib_v128/inffixed.h
+++ /dev/null
@@ -1,94 +0,0 @@
- /* inffixed.h -- table for decoding fixed codes
- * Generated automatically by makefixed().
- */
-
- /* WARNING: this file should *not* be used by applications.
- It is part of the implementation of this library and is
- subject to change. Applications should only use zlib.h.
- */
-
- static const code lenfix[512] = {
- {96,7,0},{0,8,80},{0,8,16},{20,8,115},{18,7,31},{0,8,112},{0,8,48},
- {0,9,192},{16,7,10},{0,8,96},{0,8,32},{0,9,160},{0,8,0},{0,8,128},
- {0,8,64},{0,9,224},{16,7,6},{0,8,88},{0,8,24},{0,9,144},{19,7,59},
- {0,8,120},{0,8,56},{0,9,208},{17,7,17},{0,8,104},{0,8,40},{0,9,176},
- {0,8,8},{0,8,136},{0,8,72},{0,9,240},{16,7,4},{0,8,84},{0,8,20},
- {21,8,227},{19,7,43},{0,8,116},{0,8,52},{0,9,200},{17,7,13},{0,8,100},
- {0,8,36},{0,9,168},{0,8,4},{0,8,132},{0,8,68},{0,9,232},{16,7,8},
- {0,8,92},{0,8,28},{0,9,152},{20,7,83},{0,8,124},{0,8,60},{0,9,216},
- {18,7,23},{0,8,108},{0,8,44},{0,9,184},{0,8,12},{0,8,140},{0,8,76},
- {0,9,248},{16,7,3},{0,8,82},{0,8,18},{21,8,163},{19,7,35},{0,8,114},
- {0,8,50},{0,9,196},{17,7,11},{0,8,98},{0,8,34},{0,9,164},{0,8,2},
- {0,8,130},{0,8,66},{0,9,228},{16,7,7},{0,8,90},{0,8,26},{0,9,148},
- {20,7,67},{0,8,122},{0,8,58},{0,9,212},{18,7,19},{0,8,106},{0,8,42},
- {0,9,180},{0,8,10},{0,8,138},{0,8,74},{0,9,244},{16,7,5},{0,8,86},
- {0,8,22},{64,8,0},{19,7,51},{0,8,118},{0,8,54},{0,9,204},{17,7,15},
- {0,8,102},{0,8,38},{0,9,172},{0,8,6},{0,8,134},{0,8,70},{0,9,236},
- {16,7,9},{0,8,94},{0,8,30},{0,9,156},{20,7,99},{0,8,126},{0,8,62},
- {0,9,220},{18,7,27},{0,8,110},{0,8,46},{0,9,188},{0,8,14},{0,8,142},
- {0,8,78},{0,9,252},{96,7,0},{0,8,81},{0,8,17},{21,8,131},{18,7,31},
- {0,8,113},{0,8,49},{0,9,194},{16,7,10},{0,8,97},{0,8,33},{0,9,162},
- {0,8,1},{0,8,129},{0,8,65},{0,9,226},{16,7,6},{0,8,89},{0,8,25},
- {0,9,146},{19,7,59},{0,8,121},{0,8,57},{0,9,210},{17,7,17},{0,8,105},
- {0,8,41},{0,9,178},{0,8,9},{0,8,137},{0,8,73},{0,9,242},{16,7,4},
- {0,8,85},{0,8,21},{16,8,258},{19,7,43},{0,8,117},{0,8,53},{0,9,202},
- {17,7,13},{0,8,101},{0,8,37},{0,9,170},{0,8,5},{0,8,133},{0,8,69},
- {0,9,234},{16,7,8},{0,8,93},{0,8,29},{0,9,154},{20,7,83},{0,8,125},
- {0,8,61},{0,9,218},{18,7,23},{0,8,109},{0,8,45},{0,9,186},{0,8,13},
- {0,8,141},{0,8,77},{0,9,250},{16,7,3},{0,8,83},{0,8,19},{21,8,195},
- {19,7,35},{0,8,115},{0,8,51},{0,9,198},{17,7,11},{0,8,99},{0,8,35},
- {0,9,166},{0,8,3},{0,8,131},{0,8,67},{0,9,230},{16,7,7},{0,8,91},
- {0,8,27},{0,9,150},{20,7,67},{0,8,123},{0,8,59},{0,9,214},{18,7,19},
- {0,8,107},{0,8,43},{0,9,182},{0,8,11},{0,8,139},{0,8,75},{0,9,246},
- {16,7,5},{0,8,87},{0,8,23},{64,8,0},{19,7,51},{0,8,119},{0,8,55},
- {0,9,206},{17,7,15},{0,8,103},{0,8,39},{0,9,174},{0,8,7},{0,8,135},
- {0,8,71},{0,9,238},{16,7,9},{0,8,95},{0,8,31},{0,9,158},{20,7,99},
- {0,8,127},{0,8,63},{0,9,222},{18,7,27},{0,8,111},{0,8,47},{0,9,190},
- {0,8,15},{0,8,143},{0,8,79},{0,9,254},{96,7,0},{0,8,80},{0,8,16},
- {20,8,115},{18,7,31},{0,8,112},{0,8,48},{0,9,193},{16,7,10},{0,8,96},
- {0,8,32},{0,9,161},{0,8,0},{0,8,128},{0,8,64},{0,9,225},{16,7,6},
- {0,8,88},{0,8,24},{0,9,145},{19,7,59},{0,8,120},{0,8,56},{0,9,209},
- {17,7,17},{0,8,104},{0,8,40},{0,9,177},{0,8,8},{0,8,136},{0,8,72},
- {0,9,241},{16,7,4},{0,8,84},{0,8,20},{21,8,227},{19,7,43},{0,8,116},
- {0,8,52},{0,9,201},{17,7,13},{0,8,100},{0,8,36},{0,9,169},{0,8,4},
- {0,8,132},{0,8,68},{0,9,233},{16,7,8},{0,8,92},{0,8,28},{0,9,153},
- {20,7,83},{0,8,124},{0,8,60},{0,9,217},{18,7,23},{0,8,108},{0,8,44},
- {0,9,185},{0,8,12},{0,8,140},{0,8,76},{0,9,249},{16,7,3},{0,8,82},
- {0,8,18},{21,8,163},{19,7,35},{0,8,114},{0,8,50},{0,9,197},{17,7,11},
- {0,8,98},{0,8,34},{0,9,165},{0,8,2},{0,8,130},{0,8,66},{0,9,229},
- {16,7,7},{0,8,90},{0,8,26},{0,9,149},{20,7,67},{0,8,122},{0,8,58},
- {0,9,213},{18,7,19},{0,8,106},{0,8,42},{0,9,181},{0,8,10},{0,8,138},
- {0,8,74},{0,9,245},{16,7,5},{0,8,86},{0,8,22},{64,8,0},{19,7,51},
- {0,8,118},{0,8,54},{0,9,205},{17,7,15},{0,8,102},{0,8,38},{0,9,173},
- {0,8,6},{0,8,134},{0,8,70},{0,9,237},{16,7,9},{0,8,94},{0,8,30},
- {0,9,157},{20,7,99},{0,8,126},{0,8,62},{0,9,221},{18,7,27},{0,8,110},
- {0,8,46},{0,9,189},{0,8,14},{0,8,142},{0,8,78},{0,9,253},{96,7,0},
- {0,8,81},{0,8,17},{21,8,131},{18,7,31},{0,8,113},{0,8,49},{0,9,195},
- {16,7,10},{0,8,97},{0,8,33},{0,9,163},{0,8,1},{0,8,129},{0,8,65},
- {0,9,227},{16,7,6},{0,8,89},{0,8,25},{0,9,147},{19,7,59},{0,8,121},
- {0,8,57},{0,9,211},{17,7,17},{0,8,105},{0,8,41},{0,9,179},{0,8,9},
- {0,8,137},{0,8,73},{0,9,243},{16,7,4},{0,8,85},{0,8,21},{16,8,258},
- {19,7,43},{0,8,117},{0,8,53},{0,9,203},{17,7,13},{0,8,101},{0,8,37},
- {0,9,171},{0,8,5},{0,8,133},{0,8,69},{0,9,235},{16,7,8},{0,8,93},
- {0,8,29},{0,9,155},{20,7,83},{0,8,125},{0,8,61},{0,9,219},{18,7,23},
- {0,8,109},{0,8,45},{0,9,187},{0,8,13},{0,8,141},{0,8,77},{0,9,251},
- {16,7,3},{0,8,83},{0,8,19},{21,8,195},{19,7,35},{0,8,115},{0,8,51},
- {0,9,199},{17,7,11},{0,8,99},{0,8,35},{0,9,167},{0,8,3},{0,8,131},
- {0,8,67},{0,9,231},{16,7,7},{0,8,91},{0,8,27},{0,9,151},{20,7,67},
- {0,8,123},{0,8,59},{0,9,215},{18,7,19},{0,8,107},{0,8,43},{0,9,183},
- {0,8,11},{0,8,139},{0,8,75},{0,9,247},{16,7,5},{0,8,87},{0,8,23},
- {64,8,0},{19,7,51},{0,8,119},{0,8,55},{0,9,207},{17,7,15},{0,8,103},
- {0,8,39},{0,9,175},{0,8,7},{0,8,135},{0,8,71},{0,9,239},{16,7,9},
- {0,8,95},{0,8,31},{0,9,159},{20,7,99},{0,8,127},{0,8,63},{0,9,223},
- {18,7,27},{0,8,111},{0,8,47},{0,9,191},{0,8,15},{0,8,143},{0,8,79},
- {0,9,255}
- };
-
- static const code distfix[32] = {
- {16,5,1},{23,5,257},{19,5,17},{27,5,4097},{17,5,5},{25,5,1025},
- {21,5,65},{29,5,16385},{16,5,3},{24,5,513},{20,5,33},{28,5,8193},
- {18,5,9},{26,5,2049},{22,5,129},{64,5,0},{16,5,2},{23,5,385},
- {19,5,25},{27,5,6145},{17,5,7},{25,5,1537},{21,5,97},{29,5,24577},
- {16,5,4},{24,5,769},{20,5,49},{28,5,12289},{18,5,13},{26,5,3073},
- {22,5,193},{64,5,0}
- };
diff --git a/chromium/third_party/pdfium/third_party/zlib_v128/inflate.c b/chromium/third_party/pdfium/third_party/zlib_v128/inflate.c
deleted file mode 100644
index bc5e448daf1..00000000000
--- a/chromium/third_party/pdfium/third_party/zlib_v128/inflate.c
+++ /dev/null
@@ -1,1513 +0,0 @@
-/* inflate.c -- zlib decompression
- * Copyright (C) 1995-2012 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/*
- * Change history:
- *
- * 1.2.beta0 24 Nov 2002
- * - First version -- complete rewrite of inflate to simplify code, avoid
- * creation of window when not needed, minimize use of window when it is
- * needed, make inffast.c even faster, implement gzip decoding, and to
- * improve code readability and style over the previous zlib inflate code
- *
- * 1.2.beta1 25 Nov 2002
- * - Use pointers for available input and output checking in inffast.c
- * - Remove input and output counters in inffast.c
- * - Change inffast.c entry and loop from avail_in >= 7 to >= 6
- * - Remove unnecessary second byte pull from length extra in inffast.c
- * - Unroll direct copy to three copies per loop in inffast.c
- *
- * 1.2.beta2 4 Dec 2002
- * - Change external routine names to reduce potential conflicts
- * - Correct filename to inffixed.h for fixed tables in inflate.c
- * - Make hbuf[] unsigned char to match parameter type in inflate.c
- * - Change strm->next_out[-state->offset] to *(strm->next_out - state->offset)
- * to avoid negation problem on Alphas (64 bit) in inflate.c
- *
- * 1.2.beta3 22 Dec 2002
- * - Add comments on state->bits assertion in inffast.c
- * - Add comments on op field in inftrees.h
- * - Fix bug in reuse of allocated window after inflateReset()
- * - Remove bit fields--back to byte structure for speed
- * - Remove distance extra == 0 check in inflate_fast()--only helps for lengths
- * - Change post-increments to pre-increments in inflate_fast(), PPC biased?
- * - Add compile time option, POSTINC, to use post-increments instead (Intel?)
- * - Make MATCH copy in inflate() much faster for when inflate_fast() not used
- * - Use local copies of stream next and avail values, as well as local bit
- * buffer and bit count in inflate()--for speed when inflate_fast() not used
- *
- * 1.2.beta4 1 Jan 2003
- * - Split ptr - 257 statements in inflate_table() to avoid compiler warnings
- * - Move a comment on output buffer sizes from inffast.c to inflate.c
- * - Add comments in inffast.c to introduce the inflate_fast() routine
- * - Rearrange window copies in inflate_fast() for speed and simplification
- * - Unroll last copy for window match in inflate_fast()
- * - Use local copies of window variables in inflate_fast() for speed
- * - Pull out common wnext == 0 case for speed in inflate_fast()
- * - Make op and len in inflate_fast() unsigned for consistency
- * - Add FAR to lcode and dcode declarations in inflate_fast()
- * - Simplified bad distance check in inflate_fast()
- * - Added inflateBackInit(), inflateBack(), and inflateBackEnd() in new
- * source file infback.c to provide a call-back interface to inflate for
- * programs like gzip and unzip -- uses window as output buffer to avoid
- * window copying
- *
- * 1.2.beta5 1 Jan 2003
- * - Improved inflateBack() interface to allow the caller to provide initial
- * input in strm.
- * - Fixed stored blocks bug in inflateBack()
- *
- * 1.2.beta6 4 Jan 2003
- * - Added comments in inffast.c on effectiveness of POSTINC
- * - Typecasting all around to reduce compiler warnings
- * - Changed loops from while (1) or do {} while (1) to for (;;), again to
- * make compilers happy
- * - Changed type of window in inflateBackInit() to unsigned char *
- *
- * 1.2.beta7 27 Jan 2003
- * - Changed many types to unsigned or unsigned short to avoid warnings
- * - Added inflateCopy() function
- *
- * 1.2.0 9 Mar 2003
- * - Changed inflateBack() interface to provide separate opaque descriptors
- * for the in() and out() functions
- * - Changed inflateBack() argument and in_func typedef to swap the length
- * and buffer address return values for the input function
- * - Check next_in and next_out for Z_NULL on entry to inflate()
- *
- * The history for versions after 1.2.0 are in ChangeLog in zlib distribution.
- */
-
-#include "zutil.h"
-#include "inftrees.h"
-#include "inflate.h"
-#include "inffast.h"
-
-#ifdef MAKEFIXED
-# ifndef BUILDFIXED
-# define BUILDFIXED
-# endif
-#endif
-
-/* function prototypes */
-local void fixedtables OF((struct inflate_state FAR *state));
-local int updatewindow OF((z_streamp strm, const unsigned char FAR *end,
- unsigned copy));
-#ifdef BUILDFIXED
- void makefixed OF((void));
-#endif
-local unsigned syncsearch OF((unsigned FAR *have, const unsigned char FAR *buf,
- unsigned len));
-
-int ZEXPORT inflateResetKeep(
-z_streamp strm)
-{
- struct inflate_state FAR *state;
-
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
- state = (struct inflate_state FAR *)strm->state;
- strm->total_in = strm->total_out = state->total = 0;
- strm->msg = Z_NULL;
- if (state->wrap) /* to support ill-conceived Java test suite */
- strm->adler = state->wrap & 1;
- state->mode = HEAD;
- state->last = 0;
- state->havedict = 0;
- state->dmax = 32768U;
- state->head = Z_NULL;
- state->hold = 0;
- state->bits = 0;
- state->lencode = state->distcode = state->next = state->codes;
- state->sane = 1;
- state->back = -1;
- Tracev((stderr, "inflate: reset\n"));
- return Z_OK;
-}
-
-int ZEXPORT inflateReset(
-z_streamp strm)
-{
- struct inflate_state FAR *state;
-
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
- state = (struct inflate_state FAR *)strm->state;
- state->wsize = 0;
- state->whave = 0;
- state->wnext = 0;
- return inflateResetKeep(strm);
-}
-
-int ZEXPORT inflateReset2(
-z_streamp strm,
-int windowBits)
-{
- int wrap;
- struct inflate_state FAR *state;
-
- /* get the state */
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
- state = (struct inflate_state FAR *)strm->state;
-
- /* extract wrap request from windowBits parameter */
- if (windowBits < 0) {
- wrap = 0;
- windowBits = -windowBits;
- }
- else {
- wrap = (windowBits >> 4) + 1;
-#ifdef GUNZIP
- if (windowBits < 48)
- windowBits &= 15;
-#endif
- }
-
- /* set number of window bits, free window if different */
- if (windowBits && (windowBits < 8 || windowBits > 15))
- return Z_STREAM_ERROR;
- if (state->window != Z_NULL && state->wbits != (unsigned)windowBits) {
- ZFREE(strm, state->window);
- state->window = Z_NULL;
- }
-
- /* update state and reset the rest of it */
- state->wrap = wrap;
- state->wbits = (unsigned)windowBits;
- return inflateReset(strm);
-}
-
-int ZEXPORT inflateInit2_(
-z_streamp strm,
-int windowBits,
-const char *version,
-int stream_size)
-{
- int ret;
- struct inflate_state FAR *state;
-
- if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
- stream_size != (int)(sizeof(z_stream)))
- return Z_VERSION_ERROR;
- if (strm == Z_NULL) return Z_STREAM_ERROR;
- strm->msg = Z_NULL; /* in case we return an error */
- if (strm->zalloc == (alloc_func)0) {
-#ifdef Z_SOLO
- return Z_STREAM_ERROR;
-#else
- strm->zalloc = zcalloc;
- strm->opaque = (voidpf)0;
-#endif
- }
- if (strm->zfree == (free_func)0)
-#ifdef Z_SOLO
- return Z_STREAM_ERROR;
-#else
- strm->zfree = zcfree;
-#endif
- state = (struct inflate_state FAR *)
- ZALLOC(strm, 1, sizeof(struct inflate_state));
- if (state == Z_NULL) return Z_MEM_ERROR;
- Tracev((stderr, "inflate: allocated\n"));
- strm->state = (struct internal_state FAR *)state;
- state->window = Z_NULL;
- ret = inflateReset2(strm, windowBits);
- if (ret != Z_OK) {
- ZFREE(strm, state);
- strm->state = Z_NULL;
- }
- return ret;
-}
-
-int ZEXPORT inflateInit_(
-z_streamp strm,
-const char *version,
-int stream_size)
-{
- return inflateInit2_(strm, DEF_WBITS, version, stream_size);
-}
-
-int ZEXPORT inflatePrime(
-z_streamp strm,
-int bits,
-int value)
-{
- struct inflate_state FAR *state;
-
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
- state = (struct inflate_state FAR *)strm->state;
- if (bits < 0) {
- state->hold = 0;
- state->bits = 0;
- return Z_OK;
- }
- if (bits > 16 || state->bits + bits > 32) return Z_STREAM_ERROR;
- value &= (1L << bits) - 1;
- state->hold += value << state->bits;
- state->bits += bits;
- return Z_OK;
-}
-
-/*
- Return state with length and distance decoding tables and index sizes set to
- fixed code decoding. Normally this returns fixed tables from inffixed.h.
- If BUILDFIXED is defined, then instead this routine builds the tables the
- first time it's called, and returns those tables the first time and
- thereafter. This reduces the size of the code by about 2K bytes, in
- exchange for a little execution time. However, BUILDFIXED should not be
- used for threaded applications, since the rewriting of the tables and virgin
- may not be thread-safe.
- */
-local void fixedtables(
-struct inflate_state FAR *state)
-{
-#ifdef BUILDFIXED
- static int virgin = 1;
- static code *lenfix, *distfix;
- static code fixed[544];
-
- /* build fixed huffman tables if first call (may not be thread safe) */
- if (virgin) {
- unsigned sym, bits;
- static code *next;
-
- /* literal/length table */
- sym = 0;
- while (sym < 144) state->lens[sym++] = 8;
- while (sym < 256) state->lens[sym++] = 9;
- while (sym < 280) state->lens[sym++] = 7;
- while (sym < 288) state->lens[sym++] = 8;
- next = fixed;
- lenfix = next;
- bits = 9;
- inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work);
-
- /* distance table */
- sym = 0;
- while (sym < 32) state->lens[sym++] = 5;
- distfix = next;
- bits = 5;
- inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work);
-
- /* do this just once */
- virgin = 0;
- }
-#else /* !BUILDFIXED */
-# include "inffixed.h"
-#endif /* BUILDFIXED */
- state->lencode = lenfix;
- state->lenbits = 9;
- state->distcode = distfix;
- state->distbits = 5;
-}
-
-#ifdef MAKEFIXED
-#include <stdio.h>
-
-/*
- Write out the inffixed.h that is #include'd above. Defining MAKEFIXED also
- defines BUILDFIXED, so the tables are built on the fly. makefixed() writes
- those tables to stdout, which would be piped to inffixed.h. A small program
- can simply call makefixed to do this:
-
- void makefixed(void);
-
- int main(void)
- {
- makefixed();
- return 0;
- }
-
- Then that can be linked with zlib built with MAKEFIXED defined and run:
-
- a.out > inffixed.h
- */
-void makefixed()
-{
- unsigned low, size;
- struct inflate_state state;
-
- fixedtables(&state);
- puts(" /* inffixed.h -- table for decoding fixed codes");
- puts(" * Generated automatically by makefixed().");
- puts(" */");
- puts("");
- puts(" /* WARNING: this file should *not* be used by applications.");
- puts(" It is part of the implementation of this library and is");
- puts(" subject to change. Applications should only use zlib.h.");
- puts(" */");
- puts("");
- size = 1U << 9;
- printf(" static const code lenfix[%u] = {", size);
- low = 0;
- for (;;) {
- if ((low % 7) == 0) printf("\n ");
- printf("{%u,%u,%d}", (low & 127) == 99 ? 64 : state.lencode[low].op,
- state.lencode[low].bits, state.lencode[low].val);
- if (++low == size) break;
- putchar(',');
- }
- puts("\n };");
- size = 1U << 5;
- printf("\n static const code distfix[%u] = {", size);
- low = 0;
- for (;;) {
- if ((low % 6) == 0) printf("\n ");
- printf("{%u,%u,%d}", state.distcode[low].op, state.distcode[low].bits,
- state.distcode[low].val);
- if (++low == size) break;
- putchar(',');
- }
- puts("\n };");
-}
-#endif /* MAKEFIXED */
-
-/*
- Update the window with the last wsize (normally 32K) bytes written before
- returning. If window does not exist yet, create it. This is only called
- when a window is already in use, or when output has been written during this
- inflate call, but the end of the deflate stream has not been reached yet.
- It is also called to create a window for dictionary data when a dictionary
- is loaded.
-
- Providing output buffers larger than 32K to inflate() should provide a speed
- advantage, since only the last 32K of output is copied to the sliding window
- upon return from inflate(), and since all distances after the first 32K of
- output will fall in the output data, making match copies simpler and faster.
- The advantage may be dependent on the size of the processor's data caches.
- */
-local int updatewindow(
-z_streamp strm,
-const Bytef *end,
-unsigned copy)
-{
- struct inflate_state FAR *state;
- unsigned dist;
-
- state = (struct inflate_state FAR *)strm->state;
-
- /* if it hasn't been done already, allocate space for the window */
- if (state->window == Z_NULL) {
- state->window = (unsigned char FAR *)
- ZALLOC(strm, 1U << state->wbits,
- sizeof(unsigned char));
- if (state->window == Z_NULL) return 1;
- }
-
- /* if window not in use yet, initialize */
- if (state->wsize == 0) {
- state->wsize = 1U << state->wbits;
- state->wnext = 0;
- state->whave = 0;
- }
-
- /* copy state->wsize or less output bytes into the circular window */
- if (copy >= state->wsize) {
- zmemcpy(state->window, end - state->wsize, state->wsize);
- state->wnext = 0;
- state->whave = state->wsize;
- }
- else {
- dist = state->wsize - state->wnext;
- if (dist > copy) dist = copy;
- zmemcpy(state->window + state->wnext, end - copy, dist);
- copy -= dist;
- if (copy) {
- zmemcpy(state->window, end - copy, copy);
- state->wnext = copy;
- state->whave = state->wsize;
- }
- else {
- state->wnext += dist;
- if (state->wnext == state->wsize) state->wnext = 0;
- if (state->whave < state->wsize) state->whave += dist;
- }
- }
- return 0;
-}
-
-/* Macros for inflate(): */
-
-/* check function to use adler32() for zlib or crc32() for gzip */
-#ifdef GUNZIP
-# define UPDATE(check, buf, len) \
- (state->flags ? crc32(check, buf, len) : adler32(check, buf, len))
-#else
-# define UPDATE(check, buf, len) adler32(check, buf, len)
-#endif
-
-/* check macros for header crc */
-#ifdef GUNZIP
-# define CRC2(check, word) \
- do { \
- hbuf[0] = (unsigned char)(word); \
- hbuf[1] = (unsigned char)((word) >> 8); \
- check = crc32(check, hbuf, 2); \
- } while (0)
-
-# define CRC4(check, word) \
- do { \
- hbuf[0] = (unsigned char)(word); \
- hbuf[1] = (unsigned char)((word) >> 8); \
- hbuf[2] = (unsigned char)((word) >> 16); \
- hbuf[3] = (unsigned char)((word) >> 24); \
- check = crc32(check, hbuf, 4); \
- } while (0)
-#endif
-
-/* Load registers with state in inflate() for speed */
-#define LOAD() \
- do { \
- put = strm->next_out; \
- left = strm->avail_out; \
- next = strm->next_in; \
- have = strm->avail_in; \
- hold = state->hold; \
- bits = state->bits; \
- } while (0)
-
-/* Restore state from registers in inflate() */
-#define RESTORE() \
- do { \
- strm->next_out = put; \
- strm->avail_out = left; \
- strm->next_in = next; \
- strm->avail_in = have; \
- state->hold = hold; \
- state->bits = bits; \
- } while (0)
-
-/* Clear the input bit accumulator */
-#define INITBITS() \
- do { \
- hold = 0; \
- bits = 0; \
- } while (0)
-
-/* Get a byte of input into the bit accumulator, or return from inflate()
- if there is no input available. */
-#define PULLBYTE() \
- do { \
- if (have == 0) goto inf_leave; \
- have--; \
- hold += (unsigned long)(*next++) << bits; \
- bits += 8; \
- } while (0)
-
-/* Assure that there are at least n bits in the bit accumulator. If there is
- not enough available input to do that, then return from inflate(). */
-#define NEEDBITS(n) \
- do { \
- while (bits < (unsigned)(n)) \
- PULLBYTE(); \
- } while (0)
-
-/* Return the low n bits of the bit accumulator (n < 16) */
-#define BITS(n) \
- ((unsigned)hold & ((1U << (n)) - 1))
-
-/* Remove n bits from the bit accumulator */
-#define DROPBITS(n) \
- do { \
- hold >>= (n); \
- bits -= (unsigned)(n); \
- } while (0)
-
-/* Remove zero to seven bits as needed to go to a byte boundary */
-#define BYTEBITS() \
- do { \
- hold >>= bits & 7; \
- bits -= bits & 7; \
- } while (0)
-
-/*
- inflate() uses a state machine to process as much input data and generate as
- much output data as possible before returning. The state machine is
- structured roughly as follows:
-
- for (;;) switch (state) {
- ...
- case STATEn:
- if (not enough input data or output space to make progress)
- return;
- ... make progress ...
- state = STATEm;
- break;
- ...
- }
-
- so when inflate() is called again, the same case is attempted again, and
- if the appropriate resources are provided, the machine proceeds to the
- next state. The NEEDBITS() macro is usually the way the state evaluates
- whether it can proceed or should return. NEEDBITS() does the return if
- the requested bits are not available. The typical use of the BITS macros
- is:
-
- NEEDBITS(n);
- ... do something with BITS(n) ...
- DROPBITS(n);
-
- where NEEDBITS(n) either returns from inflate() if there isn't enough
- input left to load n bits into the accumulator, or it continues. BITS(n)
- gives the low n bits in the accumulator. When done, DROPBITS(n) drops
- the low n bits off the accumulator. INITBITS() clears the accumulator
- and sets the number of available bits to zero. BYTEBITS() discards just
- enough bits to put the accumulator on a byte boundary. After BYTEBITS()
- and a NEEDBITS(8), then BITS(8) would return the next byte in the stream.
-
- NEEDBITS(n) uses PULLBYTE() to get an available byte of input, or to return
- if there is no input available. The decoding of variable length codes uses
- PULLBYTE() directly in order to pull just enough bytes to decode the next
- code, and no more.
-
- Some states loop until they get enough input, making sure that enough
- state information is maintained to continue the loop where it left off
- if NEEDBITS() returns in the loop. For example, want, need, and keep
- would all have to actually be part of the saved state in case NEEDBITS()
- returns:
-
- case STATEw:
- while (want < need) {
- NEEDBITS(n);
- keep[want++] = BITS(n);
- DROPBITS(n);
- }
- state = STATEx;
- case STATEx:
-
- As shown above, if the next state is also the next case, then the break
- is omitted.
-
- A state may also return if there is not enough output space available to
- complete that state. Those states are copying stored data, writing a
- literal byte, and copying a matching string.
-
- When returning, a "goto inf_leave" is used to update the total counters,
- update the check value, and determine whether any progress has been made
- during that inflate() call in order to return the proper return code.
- Progress is defined as a change in either strm->avail_in or strm->avail_out.
- When there is a window, goto inf_leave will update the window with the last
- output written. If a goto inf_leave occurs in the middle of decompression
- and there is no window currently, goto inf_leave will create one and copy
- output to the window for the next call of inflate().
-
- In this implementation, the flush parameter of inflate() only affects the
- return code (per zlib.h). inflate() always writes as much as possible to
- strm->next_out, given the space available and the provided input--the effect
- documented in zlib.h of Z_SYNC_FLUSH. Furthermore, inflate() always defers
- the allocation of and copying into a sliding window until necessary, which
- provides the effect documented in zlib.h for Z_FINISH when the entire input
- stream available. So the only thing the flush parameter actually does is:
- when flush is set to Z_FINISH, inflate() cannot return Z_OK. Instead it
- will return Z_BUF_ERROR if it has not reached the end of the stream.
- */
-
-int ZEXPORT inflate(
-z_streamp strm,
-int flush)
-{
- struct inflate_state FAR *state;
- z_const unsigned char FAR *next; /* next input */
- unsigned char FAR *put; /* next output */
- unsigned have, left; /* available input and output */
- unsigned long hold; /* bit buffer */
- unsigned bits; /* bits in bit buffer */
- unsigned in, out; /* save starting available input and output */
- unsigned copy; /* number of stored or match bytes to copy */
- unsigned char FAR *from; /* where to copy match bytes from */
- code here; /* current decoding table entry */
- code last; /* parent table entry */
- unsigned len; /* length to copy for repeats, bits to drop */
- int ret; /* return code */
-#ifdef GUNZIP
- unsigned char hbuf[4]; /* buffer for gzip header crc calculation */
-#endif
- static const unsigned short order[19] = /* permutation of code lengths */
- {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
-
- if (strm == Z_NULL || strm->state == Z_NULL || strm->next_out == Z_NULL ||
- (strm->next_in == Z_NULL && strm->avail_in != 0))
- return Z_STREAM_ERROR;
-
- state = (struct inflate_state FAR *)strm->state;
- if (state->mode == TYPE) state->mode = TYPEDO; /* skip check */
- LOAD();
- in = have;
- out = left;
- ret = Z_OK;
- for (;;)
- switch (state->mode) {
- case HEAD:
- if (state->wrap == 0) {
- state->mode = TYPEDO;
- break;
- }
- NEEDBITS(16);
-#ifdef GUNZIP
- if ((state->wrap & 2) && hold == 0x8b1f) { /* gzip header */
- state->check = crc32(0L, Z_NULL, 0);
- CRC2(state->check, hold);
- INITBITS();
- state->mode = FLAGS;
- break;
- }
- state->flags = 0; /* expect zlib header */
- if (state->head != Z_NULL)
- state->head->done = -1;
- if (!(state->wrap & 1) || /* check if zlib header allowed */
-#else
- if (
-#endif
- ((BITS(8) << 8) + (hold >> 8)) % 31) {
- strm->msg = (char *)"incorrect header check";
- state->mode = BAD;
- break;
- }
- if (BITS(4) != Z_DEFLATED) {
- strm->msg = (char *)"unknown compression method";
- state->mode = BAD;
- break;
- }
- DROPBITS(4);
- len = BITS(4) + 8;
- if (state->wbits == 0)
- state->wbits = len;
- else if (len > state->wbits) {
- strm->msg = (char *)"invalid window size";
- state->mode = BAD;
- break;
- }
- state->dmax = 1U << len;
- Tracev((stderr, "inflate: zlib header ok\n"));
- strm->adler = state->check = adler32(0L, Z_NULL, 0);
- state->mode = hold & 0x200 ? DICTID : TYPE;
- INITBITS();
- break;
-#ifdef GUNZIP
- case FLAGS:
- NEEDBITS(16);
- state->flags = (int)(hold);
- if ((state->flags & 0xff) != Z_DEFLATED) {
- strm->msg = (char *)"unknown compression method";
- state->mode = BAD;
- break;
- }
- if (state->flags & 0xe000) {
- strm->msg = (char *)"unknown header flags set";
- state->mode = BAD;
- break;
- }
- if (state->head != Z_NULL)
- state->head->text = (int)((hold >> 8) & 1);
- if (state->flags & 0x0200) CRC2(state->check, hold);
- INITBITS();
- state->mode = TIME;
- case TIME:
- NEEDBITS(32);
- if (state->head != Z_NULL)
- state->head->time = hold;
- if (state->flags & 0x0200) CRC4(state->check, hold);
- INITBITS();
- state->mode = OS;
- case OS:
- NEEDBITS(16);
- if (state->head != Z_NULL) {
- state->head->xflags = (int)(hold & 0xff);
- state->head->os = (int)(hold >> 8);
- }
- if (state->flags & 0x0200) CRC2(state->check, hold);
- INITBITS();
- state->mode = EXLEN;
- case EXLEN:
- if (state->flags & 0x0400) {
- NEEDBITS(16);
- state->length = (unsigned)(hold);
- if (state->head != Z_NULL)
- state->head->extra_len = (unsigned)hold;
- if (state->flags & 0x0200) CRC2(state->check, hold);
- INITBITS();
- }
- else if (state->head != Z_NULL)
- state->head->extra = Z_NULL;
- state->mode = EXTRA;
- case EXTRA:
- if (state->flags & 0x0400) {
- copy = state->length;
- if (copy > have) copy = have;
- if (copy) {
- if (state->head != Z_NULL &&
- state->head->extra != Z_NULL) {
- len = state->head->extra_len - state->length;
- zmemcpy(state->head->extra + len, next,
- len + copy > state->head->extra_max ?
- state->head->extra_max - len : copy);
- }
- if (state->flags & 0x0200)
- state->check = crc32(state->check, next, copy);
- have -= copy;
- next += copy;
- state->length -= copy;
- }
- if (state->length) goto inf_leave;
- }
- state->length = 0;
- state->mode = NAME;
- case NAME:
- if (state->flags & 0x0800) {
- if (have == 0) goto inf_leave;
- copy = 0;
- do {
- len = (unsigned)(next[copy++]);
- if (state->head != Z_NULL &&
- state->head->name != Z_NULL &&
- state->length < state->head->name_max)
- state->head->name[state->length++] = len;
- } while (len && copy < have);
- if (state->flags & 0x0200)
- state->check = crc32(state->check, next, copy);
- have -= copy;
- next += copy;
- if (len) goto inf_leave;
- }
- else if (state->head != Z_NULL)
- state->head->name = Z_NULL;
- state->length = 0;
- state->mode = COMMENT;
- case COMMENT:
- if (state->flags & 0x1000) {
- if (have == 0) goto inf_leave;
- copy = 0;
- do {
- len = (unsigned)(next[copy++]);
- if (state->head != Z_NULL &&
- state->head->comment != Z_NULL &&
- state->length < state->head->comm_max)
- state->head->comment[state->length++] = len;
- } while (len && copy < have);
- if (state->flags & 0x0200)
- state->check = crc32(state->check, next, copy);
- have -= copy;
- next += copy;
- if (len) goto inf_leave;
- }
- else if (state->head != Z_NULL)
- state->head->comment = Z_NULL;
- state->mode = HCRC;
- case HCRC:
- if (state->flags & 0x0200) {
- NEEDBITS(16);
- if (hold != (state->check & 0xffff)) {
- strm->msg = (char *)"header crc mismatch";
- state->mode = BAD;
- break;
- }
- INITBITS();
- }
- if (state->head != Z_NULL) {
- state->head->hcrc = (int)((state->flags >> 9) & 1);
- state->head->done = 1;
- }
- strm->adler = state->check = crc32(0L, Z_NULL, 0);
- state->mode = TYPE;
- break;
-#endif
- case DICTID:
- NEEDBITS(32);
- strm->adler = state->check = ZSWAP32(hold);
- INITBITS();
- state->mode = DICT;
- case DICT:
- if (state->havedict == 0) {
- RESTORE();
- return Z_NEED_DICT;
- }
- strm->adler = state->check = adler32(0L, Z_NULL, 0);
- state->mode = TYPE;
- case TYPE:
- if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave;
- case TYPEDO:
- if (state->last) {
- BYTEBITS();
- state->mode = CHECK;
- break;
- }
- NEEDBITS(3);
- state->last = BITS(1);
- DROPBITS(1);
- switch (BITS(2)) {
- case 0: /* stored block */
- Tracev((stderr, "inflate: stored block%s\n",
- state->last ? " (last)" : ""));
- state->mode = STORED;
- break;
- case 1: /* fixed block */
- fixedtables(state);
- Tracev((stderr, "inflate: fixed codes block%s\n",
- state->last ? " (last)" : ""));
- state->mode = LEN_; /* decode codes */
- if (flush == Z_TREES) {
- DROPBITS(2);
- goto inf_leave;
- }
- break;
- case 2: /* dynamic block */
- Tracev((stderr, "inflate: dynamic codes block%s\n",
- state->last ? " (last)" : ""));
- state->mode = TABLE;
- break;
- case 3:
- strm->msg = (char *)"invalid block type";
- state->mode = BAD;
- }
- DROPBITS(2);
- break;
- case STORED:
- BYTEBITS(); /* go to byte boundary */
- NEEDBITS(32);
- if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) {
- strm->msg = (char *)"invalid stored block lengths";
- state->mode = BAD;
- break;
- }
- state->length = (unsigned)hold & 0xffff;
- Tracev((stderr, "inflate: stored length %u\n",
- state->length));
- INITBITS();
- state->mode = COPY_;
- if (flush == Z_TREES) goto inf_leave;
- case COPY_:
- state->mode = COPY;
- case COPY:
- copy = state->length;
- if (copy) {
- if (copy > have) copy = have;
- if (copy > left) copy = left;
- if (copy == 0) goto inf_leave;
- zmemcpy(put, next, copy);
- have -= copy;
- next += copy;
- left -= copy;
- put += copy;
- state->length -= copy;
- break;
- }
- Tracev((stderr, "inflate: stored end\n"));
- state->mode = TYPE;
- break;
- case TABLE:
- NEEDBITS(14);
- state->nlen = BITS(5) + 257;
- DROPBITS(5);
- state->ndist = BITS(5) + 1;
- DROPBITS(5);
- state->ncode = BITS(4) + 4;
- DROPBITS(4);
-#ifndef PKZIP_BUG_WORKAROUND
- if (state->nlen > 286 || state->ndist > 30) {
- strm->msg = (char *)"too many length or distance symbols";
- state->mode = BAD;
- break;
- }
-#endif
- Tracev((stderr, "inflate: table sizes ok\n"));
- state->have = 0;
- state->mode = LENLENS;
- case LENLENS:
- while (state->have < state->ncode) {
- NEEDBITS(3);
- state->lens[order[state->have++]] = (unsigned short)BITS(3);
- DROPBITS(3);
- }
- while (state->have < 19)
- state->lens[order[state->have++]] = 0;
- state->next = state->codes;
- state->lencode = (const code FAR *)(state->next);
- state->lenbits = 7;
- ret = inflate_table(CODES, state->lens, 19, &(state->next),
- &(state->lenbits), state->work);
- if (ret) {
- strm->msg = (char *)"invalid code lengths set";
- state->mode = BAD;
- break;
- }
- Tracev((stderr, "inflate: code lengths ok\n"));
- state->have = 0;
- state->mode = CODELENS;
- case CODELENS:
- while (state->have < state->nlen + state->ndist) {
- for (;;) {
- here = state->lencode[BITS(state->lenbits)];
- if ((unsigned)(here.bits) <= bits) break;
- PULLBYTE();
- }
- if (here.val < 16) {
- DROPBITS(here.bits);
- state->lens[state->have++] = here.val;
- }
- else {
- if (here.val == 16) {
- NEEDBITS(here.bits + 2);
- DROPBITS(here.bits);
- if (state->have == 0) {
- strm->msg = (char *)"invalid bit length repeat";
- state->mode = BAD;
- break;
- }
- len = state->lens[state->have - 1];
- copy = 3 + BITS(2);
- DROPBITS(2);
- }
- else if (here.val == 17) {
- NEEDBITS(here.bits + 3);
- DROPBITS(here.bits);
- len = 0;
- copy = 3 + BITS(3);
- DROPBITS(3);
- }
- else {
- NEEDBITS(here.bits + 7);
- DROPBITS(here.bits);
- len = 0;
- copy = 11 + BITS(7);
- DROPBITS(7);
- }
- if (state->have + copy > state->nlen + state->ndist) {
- strm->msg = (char *)"invalid bit length repeat";
- state->mode = BAD;
- break;
- }
- while (copy--)
- state->lens[state->have++] = (unsigned short)len;
- }
- }
-
- /* handle error breaks in while */
- if (state->mode == BAD) break;
-
- /* check for end-of-block code (better have one) */
- if (state->lens[256] == 0) {
- strm->msg = (char *)"invalid code -- missing end-of-block";
- state->mode = BAD;
- break;
- }
-
- /* build code tables -- note: do not change the lenbits or distbits
- values here (9 and 6) without reading the comments in inftrees.h
- concerning the ENOUGH constants, which depend on those values */
- state->next = state->codes;
- state->lencode = (const code FAR *)(state->next);
- state->lenbits = 9;
- ret = inflate_table(LENS, state->lens, state->nlen, &(state->next),
- &(state->lenbits), state->work);
- if (ret) {
- strm->msg = (char *)"invalid literal/lengths set";
- state->mode = BAD;
- break;
- }
- state->distcode = (const code FAR *)(state->next);
- state->distbits = 6;
- ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist,
- &(state->next), &(state->distbits), state->work);
- if (ret) {
- strm->msg = (char *)"invalid distances set";
- state->mode = BAD;
- break;
- }
- Tracev((stderr, "inflate: codes ok\n"));
- state->mode = LEN_;
- if (flush == Z_TREES) goto inf_leave;
- case LEN_:
- state->mode = LEN;
- case LEN:
- if (have >= 6 && left >= 258) {
- RESTORE();
- inflate_fast(strm, out);
- LOAD();
- if (state->mode == TYPE)
- state->back = -1;
- break;
- }
- state->back = 0;
- for (;;) {
- here = state->lencode[BITS(state->lenbits)];
- if ((unsigned)(here.bits) <= bits) break;
- PULLBYTE();
- }
- if (here.op && (here.op & 0xf0) == 0) {
- last = here;
- for (;;) {
- here = state->lencode[last.val +
- (BITS(last.bits + last.op) >> last.bits)];
- if ((unsigned)(last.bits + here.bits) <= bits) break;
- PULLBYTE();
- }
- DROPBITS(last.bits);
- state->back += last.bits;
- }
- DROPBITS(here.bits);
- state->back += here.bits;
- state->length = (unsigned)here.val;
- if ((int)(here.op) == 0) {
- Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
- "inflate: literal '%c'\n" :
- "inflate: literal 0x%02x\n", here.val));
- state->mode = LIT;
- break;
- }
- if (here.op & 32) {
- Tracevv((stderr, "inflate: end of block\n"));
- state->back = -1;
- state->mode = TYPE;
- break;
- }
- if (here.op & 64) {
- strm->msg = (char *)"invalid literal/length code";
- state->mode = BAD;
- break;
- }
- state->extra = (unsigned)(here.op) & 15;
- state->mode = LENEXT;
- case LENEXT:
- if (state->extra) {
- NEEDBITS(state->extra);
- state->length += BITS(state->extra);
- DROPBITS(state->extra);
- state->back += state->extra;
- }
- Tracevv((stderr, "inflate: length %u\n", state->length));
- state->was = state->length;
- state->mode = DIST;
- case DIST:
- for (;;) {
- here = state->distcode[BITS(state->distbits)];
- if ((unsigned)(here.bits) <= bits) break;
- PULLBYTE();
- }
- if ((here.op & 0xf0) == 0) {
- last = here;
- for (;;) {
- here = state->distcode[last.val +
- (BITS(last.bits + last.op) >> last.bits)];
- if ((unsigned)(last.bits + here.bits) <= bits) break;
- PULLBYTE();
- }
- DROPBITS(last.bits);
- state->back += last.bits;
- }
- DROPBITS(here.bits);
- state->back += here.bits;
- if (here.op & 64) {
- strm->msg = (char *)"invalid distance code";
- state->mode = BAD;
- break;
- }
- state->offset = (unsigned)here.val;
- state->extra = (unsigned)(here.op) & 15;
- state->mode = DISTEXT;
- case DISTEXT:
- if (state->extra) {
- NEEDBITS(state->extra);
- state->offset += BITS(state->extra);
- DROPBITS(state->extra);
- state->back += state->extra;
- }
-#ifdef INFLATE_STRICT
- if (state->offset > state->dmax) {
- strm->msg = (char *)"invalid distance too far back";
- state->mode = BAD;
- break;
- }
-#endif
- Tracevv((stderr, "inflate: distance %u\n", state->offset));
- state->mode = MATCH;
- case MATCH:
- if (left == 0) goto inf_leave;
- copy = out - left;
- if (state->offset > copy) { /* copy from window */
- copy = state->offset - copy;
- if (copy > state->whave) {
- if (state->sane) {
- strm->msg = (char *)"invalid distance too far back";
- state->mode = BAD;
- break;
- }
-#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
- Trace((stderr, "inflate.c too far\n"));
- copy -= state->whave;
- if (copy > state->length) copy = state->length;
- if (copy > left) copy = left;
- left -= copy;
- state->length -= copy;
- do {
- *put++ = 0;
- } while (--copy);
- if (state->length == 0) state->mode = LEN;
- break;
-#endif
- }
- if (copy > state->wnext) {
- copy -= state->wnext;
- from = state->window + (state->wsize - copy);
- }
- else
- from = state->window + (state->wnext - copy);
- if (copy > state->length) copy = state->length;
- }
- else { /* copy from output */
- from = put - state->offset;
- copy = state->length;
- }
- if (copy > left) copy = left;
- left -= copy;
- state->length -= copy;
- do {
- *put++ = *from++;
- } while (--copy);
- if (state->length == 0) state->mode = LEN;
- break;
- case LIT:
- if (left == 0) goto inf_leave;
- *put++ = (unsigned char)(state->length);
- left--;
- state->mode = LEN;
- break;
- case CHECK:
- if (state->wrap) {
- NEEDBITS(32);
- out -= left;
- strm->total_out += out;
- state->total += out;
- if (out)
- strm->adler = state->check =
- UPDATE(state->check, put - out, out);
- out = left;
- if ((
-#ifdef GUNZIP
- state->flags ? hold :
-#endif
- ZSWAP32(hold)) != state->check) {
- strm->msg = (char *)"incorrect data check";
- state->mode = BAD;
- break;
- }
- INITBITS();
- Tracev((stderr, "inflate: check matches trailer\n"));
- }
-#ifdef GUNZIP
- state->mode = LENGTH;
- case LENGTH:
- if (state->wrap && state->flags) {
- NEEDBITS(32);
- if (hold != (state->total & 0xffffffffUL)) {
- strm->msg = (char *)"incorrect length check";
- state->mode = BAD;
- break;
- }
- INITBITS();
- Tracev((stderr, "inflate: length matches trailer\n"));
- }
-#endif
- state->mode = DONE;
- case DONE:
- ret = Z_STREAM_END;
- goto inf_leave;
- case BAD:
- ret = Z_DATA_ERROR;
- goto inf_leave;
- case MEM:
- return Z_MEM_ERROR;
- case SYNC:
- default:
- return Z_STREAM_ERROR;
- }
-
- /*
- Return from inflate(), updating the total counts and the check value.
- If there was no progress during the inflate() call, return a buffer
- error. Call updatewindow() to create and/or update the window state.
- Note: a memory error from inflate() is non-recoverable.
- */
- inf_leave:
- RESTORE();
- if (state->wsize || (out != strm->avail_out && state->mode < BAD &&
- (state->mode < CHECK || flush != Z_FINISH)))
- if (updatewindow(strm, strm->next_out, out - strm->avail_out)) {
- state->mode = MEM;
- return Z_MEM_ERROR;
- }
- in -= strm->avail_in;
- out -= strm->avail_out;
- strm->total_in += in;
- strm->total_out += out;
- state->total += out;
- if (state->wrap && out)
- strm->adler = state->check =
- UPDATE(state->check, strm->next_out - out, out);
- strm->data_type = state->bits + (state->last ? 64 : 0) +
- (state->mode == TYPE ? 128 : 0) +
- (state->mode == LEN_ || state->mode == COPY_ ? 256 : 0);
- if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK)
- ret = Z_BUF_ERROR;
- return ret;
-}
-
-int ZEXPORT inflateEnd(
-z_streamp strm)
-{
- struct inflate_state FAR *state;
- if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0)
- return Z_STREAM_ERROR;
- state = (struct inflate_state FAR *)strm->state;
- if (state->window != Z_NULL) ZFREE(strm, state->window);
- ZFREE(strm, strm->state);
- strm->state = Z_NULL;
- Tracev((stderr, "inflate: end\n"));
- return Z_OK;
-}
-
-int ZEXPORT inflateGetDictionary(
-z_streamp strm,
-Bytef *dictionary,
-uInt *dictLength)
-{
- struct inflate_state FAR *state;
-
- /* check state */
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
- state = (struct inflate_state FAR *)strm->state;
-
- /* copy dictionary */
- if (state->whave && dictionary != Z_NULL) {
- zmemcpy(dictionary, state->window + state->wnext,
- state->whave - state->wnext);
- zmemcpy(dictionary + state->whave - state->wnext,
- state->window, state->wnext);
- }
- if (dictLength != Z_NULL)
- *dictLength = state->whave;
- return Z_OK;
-}
-
-int ZEXPORT inflateSetDictionary(
-z_streamp strm,
-const Bytef *dictionary,
-uInt dictLength)
-{
- struct inflate_state FAR *state;
- unsigned long dictid;
- int ret;
-
- dictid = 0;
- /* check state */
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
- state = (struct inflate_state FAR *)strm->state;
- if (state->wrap != 0 && state->mode != DICT)
- return Z_STREAM_ERROR;
-
- /* check for correct dictionary identifier */
- if (state->mode == DICT) {
- dictid = adler32(0L, Z_NULL, 0);
- dictid = adler32(dictid, dictionary, dictLength);
- if (dictid != state->check)
- return Z_DATA_ERROR;
- }
-
- /* copy dictionary to window using updatewindow(), which will amend the
- existing dictionary if appropriate */
- ret = updatewindow(strm, dictionary + dictLength, dictLength);
- if (ret) {
- state->mode = MEM;
- return Z_MEM_ERROR;
- }
- state->havedict = 1;
- Tracev((stderr, "inflate: dictionary set\n"));
- return Z_OK;
-}
-
-int ZEXPORT inflateGetHeader(
-z_streamp strm,
-gz_headerp head)
-{
- struct inflate_state FAR *state;
-
- /* check state */
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
- state = (struct inflate_state FAR *)strm->state;
- if ((state->wrap & 2) == 0) return Z_STREAM_ERROR;
-
- /* save header structure */
- state->head = head;
- head->done = 0;
- return Z_OK;
-}
-
-/*
- Search buf[0..len-1] for the pattern: 0, 0, 0xff, 0xff. Return when found
- or when out of input. When called, *have is the number of pattern bytes
- found in order so far, in 0..3. On return *have is updated to the new
- state. If on return *have equals four, then the pattern was found and the
- return value is how many bytes were read including the last byte of the
- pattern. If *have is less than four, then the pattern has not been found
- yet and the return value is len. In the latter case, syncsearch() can be
- called again with more data and the *have state. *have is initialized to
- zero for the first call.
- */
-local unsigned syncsearch(
-unsigned FAR *have,
-const unsigned char FAR *buf,
-unsigned len)
-{
- unsigned got;
- unsigned next;
-
- got = *have;
- next = 0;
- while (next < len && got < 4) {
- if ((int)(buf[next]) == (got < 2 ? 0 : 0xff))
- got++;
- else if (buf[next])
- got = 0;
- else
- got = 4 - got;
- next++;
- }
- *have = got;
- return next;
-}
-
-int ZEXPORT inflateSync(
-z_streamp strm)
-{
- unsigned len; /* number of bytes to look at or looked at */
- unsigned long in, out; /* temporary to save total_in and total_out */
- unsigned char buf[4]; /* to restore bit buffer to byte string */
- struct inflate_state FAR *state;
-
- /* check parameters */
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
- state = (struct inflate_state FAR *)strm->state;
- if (strm->avail_in == 0 && state->bits < 8) return Z_BUF_ERROR;
-
- /* if first time, start search in bit buffer */
- if (state->mode != SYNC) {
- state->mode = SYNC;
- state->hold <<= state->bits & 7;
- state->bits -= state->bits & 7;
- len = 0;
- while (state->bits >= 8) {
- buf[len++] = (unsigned char)(state->hold);
- state->hold >>= 8;
- state->bits -= 8;
- }
- state->have = 0;
- syncsearch(&(state->have), buf, len);
- }
-
- /* search available input */
- len = syncsearch(&(state->have), strm->next_in, strm->avail_in);
- strm->avail_in -= len;
- strm->next_in += len;
- strm->total_in += len;
-
- /* return no joy or set up to restart inflate() on a new block */
- if (state->have != 4) return Z_DATA_ERROR;
- in = strm->total_in; out = strm->total_out;
- inflateReset(strm);
- strm->total_in = in; strm->total_out = out;
- state->mode = TYPE;
- return Z_OK;
-}
-
-/*
- Returns true if inflate is currently at the end of a block generated by
- Z_SYNC_FLUSH or Z_FULL_FLUSH. This function is used by one PPP
- implementation to provide an additional safety check. PPP uses
- Z_SYNC_FLUSH but removes the length bytes of the resulting empty stored
- block. When decompressing, PPP checks that at the end of input packet,
- inflate is waiting for these length bytes.
- */
-int ZEXPORT inflateSyncPoint(
-z_streamp strm)
-{
- struct inflate_state FAR *state;
-
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
- state = (struct inflate_state FAR *)strm->state;
- return state->mode == STORED && state->bits == 0;
-}
-
-int ZEXPORT inflateCopy(
-z_streamp dest,
-z_streamp source)
-{
- struct inflate_state FAR *state;
- struct inflate_state FAR *copy;
- unsigned char FAR *window;
- unsigned wsize;
-
- /* check input */
- if (dest == Z_NULL || source == Z_NULL || source->state == Z_NULL ||
- source->zalloc == (alloc_func)0 || source->zfree == (free_func)0)
- return Z_STREAM_ERROR;
- state = (struct inflate_state FAR *)source->state;
-
- /* allocate space */
- copy = (struct inflate_state FAR *)
- ZALLOC(source, 1, sizeof(struct inflate_state));
- if (copy == Z_NULL) return Z_MEM_ERROR;
- window = Z_NULL;
- if (state->window != Z_NULL) {
- window = (unsigned char FAR *)
- ZALLOC(source, 1U << state->wbits, sizeof(unsigned char));
- if (window == Z_NULL) {
- ZFREE(source, copy);
- return Z_MEM_ERROR;
- }
- }
-
- /* copy state */
- zmemcpy((voidpf)dest, (voidpf)source, sizeof(z_stream));
- zmemcpy((voidpf)copy, (voidpf)state, sizeof(struct inflate_state));
- if (state->lencode >= state->codes &&
- state->lencode <= state->codes + ENOUGH - 1) {
- copy->lencode = copy->codes + (state->lencode - state->codes);
- copy->distcode = copy->codes + (state->distcode - state->codes);
- }
- copy->next = copy->codes + (state->next - state->codes);
- if (window != Z_NULL) {
- wsize = 1U << state->wbits;
- zmemcpy(window, state->window, wsize);
- }
- copy->window = window;
- dest->state = (struct internal_state FAR *)copy;
- return Z_OK;
-}
-
-int ZEXPORT inflateUndermine(
-z_streamp strm,
-int subvert)
-{
- struct inflate_state FAR *state;
-
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
- state = (struct inflate_state FAR *)strm->state;
- state->sane = !subvert;
-#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
- return Z_OK;
-#else
- state->sane = 1;
- return Z_DATA_ERROR;
-#endif
-}
-
-long ZEXPORT inflateMark(
-z_streamp strm)
-{
- struct inflate_state FAR *state;
-
- if (strm == Z_NULL || strm->state == Z_NULL) return -1L << 16;
- state = (struct inflate_state FAR *)strm->state;
- return ((long)(state->back) << 16) +
- (state->mode == COPY ? state->length :
- (state->mode == MATCH ? state->was - state->length : 0));
-}
diff --git a/chromium/third_party/pdfium/third_party/zlib_v128/inflate.h b/chromium/third_party/pdfium/third_party/zlib_v128/inflate.h
deleted file mode 100644
index 95f4986d400..00000000000
--- a/chromium/third_party/pdfium/third_party/zlib_v128/inflate.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/* inflate.h -- internal inflate state definition
- * Copyright (C) 1995-2009 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* WARNING: this file should *not* be used by applications. It is
- part of the implementation of the compression library and is
- subject to change. Applications should only use zlib.h.
- */
-
-/* define NO_GZIP when compiling if you want to disable gzip header and
- trailer decoding by inflate(). NO_GZIP would be used to avoid linking in
- the crc code when it is not needed. For shared libraries, gzip decoding
- should be left enabled. */
-#ifndef NO_GZIP
-# define GUNZIP
-#endif
-
-/* Possible inflate modes between inflate() calls */
-typedef enum {
- HEAD, /* i: waiting for magic header */
- FLAGS, /* i: waiting for method and flags (gzip) */
- TIME, /* i: waiting for modification time (gzip) */
- OS, /* i: waiting for extra flags and operating system (gzip) */
- EXLEN, /* i: waiting for extra length (gzip) */
- EXTRA, /* i: waiting for extra bytes (gzip) */
- NAME, /* i: waiting for end of file name (gzip) */
- COMMENT, /* i: waiting for end of comment (gzip) */
- HCRC, /* i: waiting for header crc (gzip) */
- DICTID, /* i: waiting for dictionary check value */
- DICT, /* waiting for inflateSetDictionary() call */
- TYPE, /* i: waiting for type bits, including last-flag bit */
- TYPEDO, /* i: same, but skip check to exit inflate on new block */
- STORED, /* i: waiting for stored size (length and complement) */
- COPY_, /* i/o: same as COPY below, but only first time in */
- COPY, /* i/o: waiting for input or output to copy stored block */
- TABLE, /* i: waiting for dynamic block table lengths */
- LENLENS, /* i: waiting for code length code lengths */
- CODELENS, /* i: waiting for length/lit and distance code lengths */
- LEN_, /* i: same as LEN below, but only first time in */
- LEN, /* i: waiting for length/lit/eob code */
- LENEXT, /* i: waiting for length extra bits */
- DIST, /* i: waiting for distance code */
- DISTEXT, /* i: waiting for distance extra bits */
- MATCH, /* o: waiting for output space to copy string */
- LIT, /* o: waiting for output space to write literal */
- CHECK, /* i: waiting for 32-bit check value */
- LENGTH, /* i: waiting for 32-bit length (gzip) */
- DONE, /* finished check, done -- remain here until reset */
- BAD, /* got a data error -- remain here until reset */
- MEM, /* got an inflate() memory error -- remain here until reset */
- SYNC /* looking for synchronization bytes to restart inflate() */
-} inflate_mode;
-
-/*
- State transitions between above modes -
-
- (most modes can go to BAD or MEM on error -- not shown for clarity)
-
- Process header:
- HEAD -> (gzip) or (zlib) or (raw)
- (gzip) -> FLAGS -> TIME -> OS -> EXLEN -> EXTRA -> NAME -> COMMENT ->
- HCRC -> TYPE
- (zlib) -> DICTID or TYPE
- DICTID -> DICT -> TYPE
- (raw) -> TYPEDO
- Read deflate blocks:
- TYPE -> TYPEDO -> STORED or TABLE or LEN_ or CHECK
- STORED -> COPY_ -> COPY -> TYPE
- TABLE -> LENLENS -> CODELENS -> LEN_
- LEN_ -> LEN
- Read deflate codes in fixed or dynamic block:
- LEN -> LENEXT or LIT or TYPE
- LENEXT -> DIST -> DISTEXT -> MATCH -> LEN
- LIT -> LEN
- Process trailer:
- CHECK -> LENGTH -> DONE
- */
-
-/* state maintained between inflate() calls. Approximately 10K bytes. */
-struct inflate_state {
- inflate_mode mode; /* current inflate mode */
- int last; /* true if processing last block */
- int wrap; /* bit 0 true for zlib, bit 1 true for gzip */
- int havedict; /* true if dictionary provided */
- int flags; /* gzip header method and flags (0 if zlib) */
- unsigned dmax; /* zlib header max distance (INFLATE_STRICT) */
- unsigned long check; /* protected copy of check value */
- unsigned long total; /* protected copy of output count */
- gz_headerp head; /* where to save gzip header information */
- /* sliding window */
- unsigned wbits; /* log base 2 of requested window size */
- unsigned wsize; /* window size or zero if not using window */
- unsigned whave; /* valid bytes in the window */
- unsigned wnext; /* window write index */
- unsigned char FAR *window; /* allocated sliding window, if needed */
- /* bit accumulator */
- unsigned long hold; /* input bit accumulator */
- unsigned bits; /* number of bits in "in" */
- /* for string and stored block copying */
- unsigned length; /* literal or length of data to copy */
- unsigned offset; /* distance back to copy string from */
- /* for table and code decoding */
- unsigned extra; /* extra bits needed */
- /* fixed and dynamic code tables */
- code const FAR *lencode; /* starting table for length/literal codes */
- code const FAR *distcode; /* starting table for distance codes */
- unsigned lenbits; /* index bits for lencode */
- unsigned distbits; /* index bits for distcode */
- /* dynamic table building */
- unsigned ncode; /* number of code length code lengths */
- unsigned nlen; /* number of length code lengths */
- unsigned ndist; /* number of distance code lengths */
- unsigned have; /* number of code lengths in lens[] */
- code FAR *next; /* next available space in codes[] */
- unsigned short lens[320]; /* temporary storage for code lengths */
- unsigned short work[288]; /* work area for code table building */
- code codes[ENOUGH]; /* space for code tables */
- int sane; /* if false, allow invalid distance too far */
- int back; /* bits back of last unprocessed length/lit */
- unsigned was; /* initial length of match */
-};
diff --git a/chromium/third_party/pdfium/third_party/zlib_v128/inftrees.c b/chromium/third_party/pdfium/third_party/zlib_v128/inftrees.c
deleted file mode 100644
index 05ba1324f4f..00000000000
--- a/chromium/third_party/pdfium/third_party/zlib_v128/inftrees.c
+++ /dev/null
@@ -1,306 +0,0 @@
-/* inftrees.c -- generate Huffman trees for efficient decoding
- * Copyright (C) 1995-2013 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-#include "zutil.h"
-#include "inftrees.h"
-
-#define MAXBITS 15
-
-const char inflate_copyright[] =
- " inflate 1.2.8 Copyright 1995-2013 Mark Adler ";
-/*
- If you use the zlib library in a product, an acknowledgment is welcome
- in the documentation of your product. If for some reason you cannot
- include such an acknowledgment, I would appreciate that you keep this
- copyright string in the executable of your product.
- */
-
-/*
- Build a set of tables to decode the provided canonical Huffman code.
- The code lengths are lens[0..codes-1]. The result starts at *table,
- whose indices are 0..2^bits-1. work is a writable array of at least
- lens shorts, which is used as a work area. type is the type of code
- to be generated, CODES, LENS, or DISTS. On return, zero is success,
- -1 is an invalid code, and +1 means that ENOUGH isn't enough. table
- on return points to the next available entry's address. bits is the
- requested root table index bits, and on return it is the actual root
- table index bits. It will differ if the request is greater than the
- longest code or if it is less than the shortest code.
- */
-int ZLIB_INTERNAL inflate_table(
-codetype type,
-unsigned short FAR *lens,
-unsigned codes,
-code FAR * FAR *table,
-unsigned FAR *bits,
-unsigned short FAR *work)
-{
- unsigned len; /* a code's length in bits */
- unsigned sym; /* index of code symbols */
- unsigned min, max; /* minimum and maximum code lengths */
- unsigned root; /* number of index bits for root table */
- unsigned curr; /* number of index bits for current table */
- unsigned drop; /* code bits to drop for sub-table */
- int left; /* number of prefix codes available */
- unsigned used; /* code entries in table used */
- unsigned huff; /* Huffman code */
- unsigned incr; /* for incrementing code, index */
- unsigned fill; /* index for replicating entries */
- unsigned low; /* low bits for current root entry */
- unsigned mask; /* mask for low root bits */
- code here; /* table entry for duplication */
- code FAR *next; /* next available space in table */
- const unsigned short FAR *base; /* base value table to use */
- const unsigned short FAR *extra; /* extra bits table to use */
- int end; /* use base and extra for symbol > end */
- unsigned short count[MAXBITS+1]; /* number of codes of each length */
- unsigned short offs[MAXBITS+1]; /* offsets in table for each length */
- static const unsigned short lbase[31] = { /* Length codes 257..285 base */
- 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
- 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
- static const unsigned short lext[31] = { /* Length codes 257..285 extra */
- 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
- 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78};
- static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
- 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
- 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
- 8193, 12289, 16385, 24577, 0, 0};
- static const unsigned short dext[32] = { /* Distance codes 0..29 extra */
- 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,
- 23, 23, 24, 24, 25, 25, 26, 26, 27, 27,
- 28, 28, 29, 29, 64, 64};
-
- /*
- Process a set of code lengths to create a canonical Huffman code. The
- code lengths are lens[0..codes-1]. Each length corresponds to the
- symbols 0..codes-1. The Huffman code is generated by first sorting the
- symbols by length from short to long, and retaining the symbol order
- for codes with equal lengths. Then the code starts with all zero bits
- for the first code of the shortest length, and the codes are integer
- increments for the same length, and zeros are appended as the length
- increases. For the deflate format, these bits are stored backwards
- from their more natural integer increment ordering, and so when the
- decoding tables are built in the large loop below, the integer codes
- are incremented backwards.
-
- This routine assumes, but does not check, that all of the entries in
- lens[] are in the range 0..MAXBITS. The caller must assure this.
- 1..MAXBITS is interpreted as that code length. zero means that that
- symbol does not occur in this code.
-
- The codes are sorted by computing a count of codes for each length,
- creating from that a table of starting indices for each length in the
- sorted table, and then entering the symbols in order in the sorted
- table. The sorted table is work[], with that space being provided by
- the caller.
-
- The length counts are used for other purposes as well, i.e. finding
- the minimum and maximum length codes, determining if there are any
- codes at all, checking for a valid set of lengths, and looking ahead
- at length counts to determine sub-table sizes when building the
- decoding tables.
- */
-
- /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */
- for (len = 0; len <= MAXBITS; len++)
- count[len] = 0;
- for (sym = 0; sym < codes; sym++)
- count[lens[sym]]++;
-
- /* bound code lengths, force root to be within code lengths */
- root = *bits;
- for (max = MAXBITS; max >= 1; max--)
- if (count[max] != 0) break;
- if (root > max) root = max;
- if (max == 0) { /* no symbols to code at all */
- here.op = (unsigned char)64; /* invalid code marker */
- here.bits = (unsigned char)1;
- here.val = (unsigned short)0;
- *(*table)++ = here; /* make a table to force an error */
- *(*table)++ = here;
- *bits = 1;
- return 0; /* no symbols, but wait for decoding to report error */
- }
- for (min = 1; min < max; min++)
- if (count[min] != 0) break;
- if (root < min) root = min;
-
- /* check for an over-subscribed or incomplete set of lengths */
- left = 1;
- for (len = 1; len <= MAXBITS; len++) {
- left <<= 1;
- left -= count[len];
- if (left < 0) return -1; /* over-subscribed */
- }
- if (left > 0 && (type == CODES || max != 1))
- return -1; /* incomplete set */
-
- /* generate offsets into symbol table for each length for sorting */
- offs[1] = 0;
- for (len = 1; len < MAXBITS; len++)
- offs[len + 1] = offs[len] + count[len];
-
- /* sort symbols by length, by symbol order within each length */
- for (sym = 0; sym < codes; sym++)
- if (lens[sym] != 0) work[offs[lens[sym]]++] = (unsigned short)sym;
-
- /*
- Create and fill in decoding tables. In this loop, the table being
- filled is at next and has curr index bits. The code being used is huff
- with length len. That code is converted to an index by dropping drop
- bits off of the bottom. For codes where len is less than drop + curr,
- those top drop + curr - len bits are incremented through all values to
- fill the table with replicated entries.
-
- root is the number of index bits for the root table. When len exceeds
- root, sub-tables are created pointed to by the root entry with an index
- of the low root bits of huff. This is saved in low to check for when a
- new sub-table should be started. drop is zero when the root table is
- being filled, and drop is root when sub-tables are being filled.
-
- When a new sub-table is needed, it is necessary to look ahead in the
- code lengths to determine what size sub-table is needed. The length
- counts are used for this, and so count[] is decremented as codes are
- entered in the tables.
-
- used keeps track of how many table entries have been allocated from the
- provided *table space. It is checked for LENS and DIST tables against
- the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in
- the initial root table size constants. See the comments in inftrees.h
- for more information.
-
- sym increments through all symbols, and the loop terminates when
- all codes of length max, i.e. all codes, have been processed. This
- routine permits incomplete codes, so another loop after this one fills
- in the rest of the decoding tables with invalid code markers.
- */
-
- /* set up for code type */
- switch (type) {
- case CODES:
- base = extra = work; /* dummy value--not used */
- end = 19;
- break;
- case LENS:
- base = lbase;
- base -= 257;
- extra = lext;
- extra -= 257;
- end = 256;
- break;
- default: /* DISTS */
- base = dbase;
- extra = dext;
- end = -1;
- }
-
- /* initialize state for loop */
- huff = 0; /* starting code */
- sym = 0; /* starting code symbol */
- len = min; /* starting code length */
- next = *table; /* current table to fill in */
- curr = root; /* current table index bits */
- drop = 0; /* current bits to drop from code for index */
- low = (unsigned)(-1); /* trigger new sub-table when len > root */
- used = 1U << root; /* use root table entries */
- mask = used - 1; /* mask for comparing low */
-
- /* check available table space */
- if ((type == LENS && used > ENOUGH_LENS) ||
- (type == DISTS && used > ENOUGH_DISTS))
- return 1;
-
- /* process all codes and make table entries */
- for (;;) {
- /* create table entry */
- here.bits = (unsigned char)(len - drop);
- if ((int)(work[sym]) < end) {
- here.op = (unsigned char)0;
- here.val = work[sym];
- }
- else if ((int)(work[sym]) > end) {
- here.op = (unsigned char)(extra[work[sym]]);
- here.val = base[work[sym]];
- }
- else {
- here.op = (unsigned char)(32 + 64); /* end of block */
- here.val = 0;
- }
-
- /* replicate for those indices with low len bits equal to huff */
- incr = 1U << (len - drop);
- fill = 1U << curr;
- min = fill; /* save offset to next table */
- do {
- fill -= incr;
- next[(huff >> drop) + fill] = here;
- } while (fill != 0);
-
- /* backwards increment the len-bit code huff */
- incr = 1U << (len - 1);
- while (huff & incr)
- incr >>= 1;
- if (incr != 0) {
- huff &= incr - 1;
- huff += incr;
- }
- else
- huff = 0;
-
- /* go to next symbol, update count, len */
- sym++;
- if (--(count[len]) == 0) {
- if (len == max) break;
- len = lens[work[sym]];
- }
-
- /* create new sub-table if needed */
- if (len > root && (huff & mask) != low) {
- /* if first time, transition to sub-tables */
- if (drop == 0)
- drop = root;
-
- /* increment past last table */
- next += min; /* here min is 1 << curr */
-
- /* determine length of next table */
- curr = len - drop;
- left = (int)(1 << curr);
- while (curr + drop < max) {
- left -= count[curr + drop];
- if (left <= 0) break;
- curr++;
- left <<= 1;
- }
-
- /* check for enough space */
- used += 1U << curr;
- if ((type == LENS && used > ENOUGH_LENS) ||
- (type == DISTS && used > ENOUGH_DISTS))
- return 1;
-
- /* point entry in root table to sub-table */
- low = huff & mask;
- (*table)[low].op = (unsigned char)curr;
- (*table)[low].bits = (unsigned char)root;
- (*table)[low].val = (unsigned short)(next - *table);
- }
- }
-
- /* fill in remaining table entry if code is incomplete (guaranteed to have
- at most one remaining entry, since if the code is incomplete, the
- maximum code length that was allowed to get this far is one bit) */
- if (huff != 0) {
- here.op = (unsigned char)64; /* invalid code marker */
- here.bits = (unsigned char)(len - drop);
- here.val = (unsigned short)0;
- next[huff] = here;
- }
-
- /* set return parameters */
- *table += used;
- *bits = root;
- return 0;
-}
diff --git a/chromium/third_party/pdfium/third_party/zlib_v128/inftrees.h b/chromium/third_party/pdfium/third_party/zlib_v128/inftrees.h
deleted file mode 100644
index baa53a0b1a1..00000000000
--- a/chromium/third_party/pdfium/third_party/zlib_v128/inftrees.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* inftrees.h -- header to use inftrees.c
- * Copyright (C) 1995-2005, 2010 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* WARNING: this file should *not* be used by applications. It is
- part of the implementation of the compression library and is
- subject to change. Applications should only use zlib.h.
- */
-
-/* Structure for decoding tables. Each entry provides either the
- information needed to do the operation requested by the code that
- indexed that table entry, or it provides a pointer to another
- table that indexes more bits of the code. op indicates whether
- the entry is a pointer to another table, a literal, a length or
- distance, an end-of-block, or an invalid code. For a table
- pointer, the low four bits of op is the number of index bits of
- that table. For a length or distance, the low four bits of op
- is the number of extra bits to get after the code. bits is
- the number of bits in this code or part of the code to drop off
- of the bit buffer. val is the actual byte to output in the case
- of a literal, the base length or distance, or the offset from
- the current table to the next table. Each entry is four bytes. */
-typedef struct {
- unsigned char op; /* operation, extra bits, table bits */
- unsigned char bits; /* bits in this part of the code */
- unsigned short val; /* offset in table or code value */
-} code;
-
-/* op values as set by inflate_table():
- 00000000 - literal
- 0000tttt - table link, tttt != 0 is the number of table index bits
- 0001eeee - length or distance, eeee is the number of extra bits
- 01100000 - end of block
- 01000000 - invalid code
- */
-
-/* Maximum size of the dynamic table. The maximum number of code structures is
- 1444, which is the sum of 852 for literal/length codes and 592 for distance
- codes. These values were found by exhaustive searches using the program
- examples/enough.c found in the zlib distribtution. The arguments to that
- program are the number of symbols, the initial root table size, and the
- maximum bit length of a code. "enough 286 9 15" for literal/length codes
- returns returns 852, and "enough 30 6 15" for distance codes returns 592.
- The initial root table size (9 or 6) is found in the fifth argument of the
- inflate_table() calls in inflate.c and infback.c. If the root table size is
- changed, then these maximum sizes would be need to be recalculated and
- updated. */
-#define ENOUGH_LENS 852
-#define ENOUGH_DISTS 592
-#define ENOUGH (ENOUGH_LENS+ENOUGH_DISTS)
-
-/* Type of code to build for inflate_table() */
-typedef enum {
- CODES,
- LENS,
- DISTS
-} codetype;
-
-int ZLIB_INTERNAL inflate_table OF((codetype type, unsigned short FAR *lens,
- unsigned codes, code FAR * FAR *table,
- unsigned FAR *bits, unsigned short FAR *work));
diff --git a/chromium/third_party/pdfium/third_party/zlib_v128/trees.c b/chromium/third_party/pdfium/third_party/zlib_v128/trees.c
deleted file mode 100644
index e1fd952046a..00000000000
--- a/chromium/third_party/pdfium/third_party/zlib_v128/trees.c
+++ /dev/null
@@ -1,1226 +0,0 @@
-/* trees.c -- output deflated data using Huffman coding
- * Copyright (C) 1995-2012 Jean-loup Gailly
- * detect_data_type() function provided freely by Cosmin Truta, 2006
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/*
- * ALGORITHM
- *
- * The "deflation" process uses several Huffman trees. The more
- * common source values are represented by shorter bit sequences.
- *
- * Each code tree is stored in a compressed form which is itself
- * a Huffman encoding of the lengths of all the code strings (in
- * ascending order by source values). The actual code strings are
- * reconstructed from the lengths in the inflate process, as described
- * in the deflate specification.
- *
- * REFERENCES
- *
- * Deutsch, L.P.,"'Deflate' Compressed Data Format Specification".
- * Available in ftp.uu.net:/pub/archiving/zip/doc/deflate-1.1.doc
- *
- * Storer, James A.
- * Data Compression: Methods and Theory, pp. 49-50.
- * Computer Science Press, 1988. ISBN 0-7167-8156-5.
- *
- * Sedgewick, R.
- * Algorithms, p290.
- * Addison-Wesley, 1983. ISBN 0-201-06672-6.
- */
-
-/* @(#) $Id$ */
-
-/* #define GEN_TREES_H */
-
-#include "deflate.h"
-
-#ifdef DEBUG
-# include <ctype.h>
-#endif
-
-/* ===========================================================================
- * Constants
- */
-
-#define MAX_BL_BITS 7
-/* Bit length codes must not exceed MAX_BL_BITS bits */
-
-#define END_BLOCK 256
-/* end of block literal code */
-
-#define REP_3_6 16
-/* repeat previous bit length 3-6 times (2 bits of repeat count) */
-
-#define REPZ_3_10 17
-/* repeat a zero length 3-10 times (3 bits of repeat count) */
-
-#define REPZ_11_138 18
-/* repeat a zero length 11-138 times (7 bits of repeat count) */
-
-local const int extra_lbits[LENGTH_CODES] /* extra bits for each length code */
- = {0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0};
-
-local const int extra_dbits[D_CODES] /* extra bits for each distance code */
- = {0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13};
-
-local const int extra_blbits[BL_CODES]/* extra bits for each bit length code */
- = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7};
-
-local const uch bl_order[BL_CODES]
- = {16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15};
-/* The lengths of the bit length codes are sent in order of decreasing
- * probability, to avoid transmitting the lengths for unused bit length codes.
- */
-
-/* ===========================================================================
- * Local data. These are initialized only once.
- */
-
-#define DIST_CODE_LEN 512 /* see definition of array dist_code below */
-
-#if defined(GEN_TREES_H) || !defined(STDC)
-/* non ANSI compilers may not accept trees.h */
-
-local ct_data static_ltree[L_CODES+2];
-/* The static literal tree. Since the bit lengths are imposed, there is no
- * need for the L_CODES extra codes used during heap construction. However
- * The codes 286 and 287 are needed to build a canonical tree (see _tr_init
- * below).
- */
-
-local ct_data static_dtree[D_CODES];
-/* The static distance tree. (Actually a trivial tree since all codes use
- * 5 bits.)
- */
-
-uch _dist_code[DIST_CODE_LEN];
-/* Distance codes. The first 256 values correspond to the distances
- * 3 .. 258, the last 256 values correspond to the top 8 bits of
- * the 15 bit distances.
- */
-
-uch _length_code[MAX_MATCH-MIN_MATCH+1];
-/* length code for each normalized match length (0 == MIN_MATCH) */
-
-local int base_length[LENGTH_CODES];
-/* First normalized length for each code (0 = MIN_MATCH) */
-
-local int base_dist[D_CODES];
-/* First normalized distance for each code (0 = distance of 1) */
-
-#else
-# include "trees.h"
-#endif /* GEN_TREES_H */
-
-struct static_tree_desc_s {
- const ct_data *static_tree; /* static tree or NULL */
- const intf *extra_bits; /* extra bits for each code or NULL */
- int extra_base; /* base index for extra_bits */
- int elems; /* max number of elements in the tree */
- int max_length; /* max bit length for the codes */
-};
-
-local static_tree_desc static_l_desc =
-{static_ltree, extra_lbits, LITERALS+1, L_CODES, MAX_BITS};
-
-local static_tree_desc static_d_desc =
-{static_dtree, extra_dbits, 0, D_CODES, MAX_BITS};
-
-local static_tree_desc static_bl_desc =
-{(const ct_data *)0, extra_blbits, 0, BL_CODES, MAX_BL_BITS};
-
-/* ===========================================================================
- * Local (static) routines in this file.
- */
-
-local void tr_static_init OF((void));
-local void init_block OF((deflate_state *s));
-local void pqdownheap OF((deflate_state *s, ct_data *tree, int k));
-local void gen_bitlen OF((deflate_state *s, tree_desc *desc));
-local void gen_codes OF((ct_data *tree, int max_code, ushf *bl_count));
-local void build_tree OF((deflate_state *s, tree_desc *desc));
-local void scan_tree OF((deflate_state *s, ct_data *tree, int max_code));
-local void send_tree OF((deflate_state *s, ct_data *tree, int max_code));
-local int build_bl_tree OF((deflate_state *s));
-local void send_all_trees OF((deflate_state *s, int lcodes, int dcodes,
- int blcodes));
-local void compress_block OF((deflate_state *s, const ct_data *ltree,
- const ct_data *dtree));
-local int detect_data_type OF((deflate_state *s));
-local unsigned bi_reverse OF((unsigned value, int length));
-local void bi_windup OF((deflate_state *s));
-local void bi_flush OF((deflate_state *s));
-local void copy_block OF((deflate_state *s, charf *buf, unsigned len,
- int header));
-
-#ifdef GEN_TREES_H
-local void gen_trees_header OF((void));
-#endif
-
-#ifndef DEBUG
-# define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len)
- /* Send a code of the given tree. c and tree must not have side effects */
-
-#else /* DEBUG */
-# define send_code(s, c, tree) \
- { if (z_verbose>2) fprintf(stderr,"\ncd %3d ",(c)); \
- send_bits(s, tree[c].Code, tree[c].Len); }
-#endif
-
-/* ===========================================================================
- * Output a short LSB first on the stream.
- * IN assertion: there is enough room in pendingBuf.
- */
-#define put_short(s, w) { \
- put_byte(s, (uch)((w) & 0xff)); \
- put_byte(s, (uch)((ush)(w) >> 8)); \
-}
-
-/* ===========================================================================
- * Send a value on a given number of bits.
- * IN assertion: length <= 16 and value fits in length bits.
- */
-#ifdef DEBUG
-local void send_bits OF((deflate_state *s, int value, int length));
-
-local void send_bits(
- deflate_state *s,
- int value, /* value to send */
- int length) /* number of bits */
-{
- Tracevv((stderr," l %2d v %4x ", length, value));
- Assert(length > 0 && length <= 15, "invalid length");
- s->bits_sent += (ulg)length;
-
- /* If not enough room in bi_buf, use (valid) bits from bi_buf and
- * (16 - bi_valid) bits from value, leaving (width - (16-bi_valid))
- * unused bits in value.
- */
- if (s->bi_valid > (int)Buf_size - length) {
- s->bi_buf |= (ush)value << s->bi_valid;
- put_short(s, s->bi_buf);
- s->bi_buf = (ush)value >> (Buf_size - s->bi_valid);
- s->bi_valid += length - Buf_size;
- } else {
- s->bi_buf |= (ush)value << s->bi_valid;
- s->bi_valid += length;
- }
-}
-#else /* !DEBUG */
-
-#define send_bits(s, value, length) \
-{ int len = length;\
- if (s->bi_valid > (int)Buf_size - len) {\
- int val = value;\
- s->bi_buf |= (ush)val << s->bi_valid;\
- put_short(s, s->bi_buf);\
- s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\
- s->bi_valid += len - Buf_size;\
- } else {\
- s->bi_buf |= (ush)(value) << s->bi_valid;\
- s->bi_valid += len;\
- }\
-}
-#endif /* DEBUG */
-
-
-/* the arguments must not have side effects */
-
-/* ===========================================================================
- * Initialize the various 'constant' tables.
- */
-local void tr_static_init()
-{
-#if defined(GEN_TREES_H) || !defined(STDC)
- static int static_init_done = 0;
- int n; /* iterates over tree elements */
- int bits; /* bit counter */
- int length; /* length value */
- int code; /* code value */
- int dist; /* distance index */
- ush bl_count[MAX_BITS+1];
- /* number of codes at each bit length for an optimal tree */
-
- if (static_init_done) return;
-
- /* For some embedded targets, global variables are not initialized: */
-#ifdef NO_INIT_GLOBAL_POINTERS
- static_l_desc.static_tree = static_ltree;
- static_l_desc.extra_bits = extra_lbits;
- static_d_desc.static_tree = static_dtree;
- static_d_desc.extra_bits = extra_dbits;
- static_bl_desc.extra_bits = extra_blbits;
-#endif
-
- /* Initialize the mapping length (0..255) -> length code (0..28) */
- length = 0;
- for (code = 0; code < LENGTH_CODES-1; code++) {
- base_length[code] = length;
- for (n = 0; n < (1<<extra_lbits[code]); n++) {
- _length_code[length++] = (uch)code;
- }
- }
- Assert (length == 256, "tr_static_init: length != 256");
- /* Note that the length 255 (match length 258) can be represented
- * in two different ways: code 284 + 5 bits or code 285, so we
- * overwrite length_code[255] to use the best encoding:
- */
- _length_code[length-1] = (uch)code;
-
- /* Initialize the mapping dist (0..32K) -> dist code (0..29) */
- dist = 0;
- for (code = 0 ; code < 16; code++) {
- base_dist[code] = dist;
- for (n = 0; n < (1<<extra_dbits[code]); n++) {
- _dist_code[dist++] = (uch)code;
- }
- }
- Assert (dist == 256, "tr_static_init: dist != 256");
- dist >>= 7; /* from now on, all distances are divided by 128 */
- for ( ; code < D_CODES; code++) {
- base_dist[code] = dist << 7;
- for (n = 0; n < (1<<(extra_dbits[code]-7)); n++) {
- _dist_code[256 + dist++] = (uch)code;
- }
- }
- Assert (dist == 256, "tr_static_init: 256+dist != 512");
-
- /* Construct the codes of the static literal tree */
- for (bits = 0; bits <= MAX_BITS; bits++) bl_count[bits] = 0;
- n = 0;
- while (n <= 143) static_ltree[n++].Len = 8, bl_count[8]++;
- while (n <= 255) static_ltree[n++].Len = 9, bl_count[9]++;
- while (n <= 279) static_ltree[n++].Len = 7, bl_count[7]++;
- while (n <= 287) static_ltree[n++].Len = 8, bl_count[8]++;
- /* Codes 286 and 287 do not exist, but we must include them in the
- * tree construction to get a canonical Huffman tree (longest code
- * all ones)
- */
- gen_codes((ct_data *)static_ltree, L_CODES+1, bl_count);
-
- /* The static distance tree is trivial: */
- for (n = 0; n < D_CODES; n++) {
- static_dtree[n].Len = 5;
- static_dtree[n].Code = bi_reverse((unsigned)n, 5);
- }
- static_init_done = 1;
-
-# ifdef GEN_TREES_H
- gen_trees_header();
-# endif
-#endif /* defined(GEN_TREES_H) || !defined(STDC) */
-}
-
-/* ===========================================================================
- * Genererate the file trees.h describing the static trees.
- */
-#ifdef GEN_TREES_H
-# ifndef DEBUG
-# include <stdio.h>
-# endif
-
-# define SEPARATOR(i, last, width) \
- ((i) == (last)? "\n};\n\n" : \
- ((i) % (width) == (width)-1 ? ",\n" : ", "))
-
-void gen_trees_header()
-{
- FILE *header = fopen("trees.h", "w");
- int i;
-
- Assert (header != NULL, "Can't open trees.h");
- fprintf(header,
- "/* header created automatically with -DGEN_TREES_H */\n\n");
-
- fprintf(header, "local const ct_data static_ltree[L_CODES+2] = {\n");
- for (i = 0; i < L_CODES+2; i++) {
- fprintf(header, "{{%3u},{%3u}}%s", static_ltree[i].Code,
- static_ltree[i].Len, SEPARATOR(i, L_CODES+1, 5));
- }
-
- fprintf(header, "local const ct_data static_dtree[D_CODES] = {\n");
- for (i = 0; i < D_CODES; i++) {
- fprintf(header, "{{%2u},{%2u}}%s", static_dtree[i].Code,
- static_dtree[i].Len, SEPARATOR(i, D_CODES-1, 5));
- }
-
- fprintf(header, "const uch ZLIB_INTERNAL _dist_code[DIST_CODE_LEN] = {\n");
- for (i = 0; i < DIST_CODE_LEN; i++) {
- fprintf(header, "%2u%s", _dist_code[i],
- SEPARATOR(i, DIST_CODE_LEN-1, 20));
- }
-
- fprintf(header,
- "const uch ZLIB_INTERNAL _length_code[MAX_MATCH-MIN_MATCH+1]= {\n");
- for (i = 0; i < MAX_MATCH-MIN_MATCH+1; i++) {
- fprintf(header, "%2u%s", _length_code[i],
- SEPARATOR(i, MAX_MATCH-MIN_MATCH, 20));
- }
-
- fprintf(header, "local const int base_length[LENGTH_CODES] = {\n");
- for (i = 0; i < LENGTH_CODES; i++) {
- fprintf(header, "%1u%s", base_length[i],
- SEPARATOR(i, LENGTH_CODES-1, 20));
- }
-
- fprintf(header, "local const int base_dist[D_CODES] = {\n");
- for (i = 0; i < D_CODES; i++) {
- fprintf(header, "%5u%s", base_dist[i],
- SEPARATOR(i, D_CODES-1, 10));
- }
-
- fclose(header);
-}
-#endif /* GEN_TREES_H */
-
-/* ===========================================================================
- * Initialize the tree data structures for a new zlib stream.
- */
-void ZLIB_INTERNAL _tr_init(
- deflate_state *s)
-{
- tr_static_init();
-
- s->l_desc.dyn_tree = s->dyn_ltree;
- s->l_desc.stat_desc = &static_l_desc;
-
- s->d_desc.dyn_tree = s->dyn_dtree;
- s->d_desc.stat_desc = &static_d_desc;
-
- s->bl_desc.dyn_tree = s->bl_tree;
- s->bl_desc.stat_desc = &static_bl_desc;
-
- s->bi_buf = 0;
- s->bi_valid = 0;
-#ifdef DEBUG
- s->compressed_len = 0L;
- s->bits_sent = 0L;
-#endif
-
- /* Initialize the first block of the first file: */
- init_block(s);
-}
-
-/* ===========================================================================
- * Initialize a new block.
- */
-local void init_block(
- deflate_state *s)
-{
- int n; /* iterates over tree elements */
-
- /* Initialize the trees. */
- for (n = 0; n < L_CODES; n++) s->dyn_ltree[n].Freq = 0;
- for (n = 0; n < D_CODES; n++) s->dyn_dtree[n].Freq = 0;
- for (n = 0; n < BL_CODES; n++) s->bl_tree[n].Freq = 0;
-
- s->dyn_ltree[END_BLOCK].Freq = 1;
- s->opt_len = s->static_len = 0L;
- s->last_lit = s->matches = 0;
-}
-
-#define SMALLEST 1
-/* Index within the heap array of least frequent node in the Huffman tree */
-
-
-/* ===========================================================================
- * Remove the smallest element from the heap and recreate the heap with
- * one less element. Updates heap and heap_len.
- */
-#define pqremove(s, tree, top) \
-{\
- top = s->heap[SMALLEST]; \
- s->heap[SMALLEST] = s->heap[s->heap_len--]; \
- pqdownheap(s, tree, SMALLEST); \
-}
-
-/* ===========================================================================
- * Compares to subtrees, using the tree depth as tie breaker when
- * the subtrees have equal frequency. This minimizes the worst case length.
- */
-#define smaller(tree, n, m, depth) \
- (tree[n].Freq < tree[m].Freq || \
- (tree[n].Freq == tree[m].Freq && depth[n] <= depth[m]))
-
-/* ===========================================================================
- * Restore the heap property by moving down the tree starting at node k,
- * exchanging a node with the smallest of its two sons if necessary, stopping
- * when the heap property is re-established (each father smaller than its
- * two sons).
- */
-local void pqdownheap(
- deflate_state *s,
- ct_data *tree, /* the tree to restore */
- int k) /* node to move down */
-{
- int v = s->heap[k];
- int j = k << 1; /* left son of k */
- while (j <= s->heap_len) {
- /* Set j to the smallest of the two sons: */
- if (j < s->heap_len &&
- smaller(tree, s->heap[j+1], s->heap[j], s->depth)) {
- j++;
- }
- /* Exit if v is smaller than both sons */
- if (smaller(tree, v, s->heap[j], s->depth)) break;
-
- /* Exchange v with the smallest son */
- s->heap[k] = s->heap[j]; k = j;
-
- /* And continue down the tree, setting j to the left son of k */
- j <<= 1;
- }
- s->heap[k] = v;
-}
-
-/* ===========================================================================
- * Compute the optimal bit lengths for a tree and update the total bit length
- * for the current block.
- * IN assertion: the fields freq and dad are set, heap[heap_max] and
- * above are the tree nodes sorted by increasing frequency.
- * OUT assertions: the field len is set to the optimal bit length, the
- * array bl_count contains the frequencies for each bit length.
- * The length opt_len is updated; static_len is also updated if stree is
- * not null.
- */
-local void gen_bitlen(
- deflate_state *s,
- tree_desc *desc) /* the tree descriptor */
-{
- ct_data *tree = desc->dyn_tree;
- int max_code = desc->max_code;
- const ct_data *stree = desc->stat_desc->static_tree;
- const intf *extra = desc->stat_desc->extra_bits;
- int base = desc->stat_desc->extra_base;
- int max_length = desc->stat_desc->max_length;
- int h; /* heap index */
- int n, m; /* iterate over the tree elements */
- int bits; /* bit length */
- int xbits; /* extra bits */
- ush f; /* frequency */
- int overflow = 0; /* number of elements with bit length too large */
-
- for (bits = 0; bits <= MAX_BITS; bits++) s->bl_count[bits] = 0;
-
- /* In a first pass, compute the optimal bit lengths (which may
- * overflow in the case of the bit length tree).
- */
- tree[s->heap[s->heap_max]].Len = 0; /* root of the heap */
-
- for (h = s->heap_max+1; h < HEAP_SIZE; h++) {
- n = s->heap[h];
- bits = tree[tree[n].Dad].Len + 1;
- if (bits > max_length) bits = max_length, overflow++;
- tree[n].Len = (ush)bits;
- /* We overwrite tree[n].Dad which is no longer needed */
-
- if (n > max_code) continue; /* not a leaf node */
-
- s->bl_count[bits]++;
- xbits = 0;
- if (n >= base) xbits = extra[n-base];
- f = tree[n].Freq;
- s->opt_len += (ulg)f * (bits + xbits);
- if (stree) s->static_len += (ulg)f * (stree[n].Len + xbits);
- }
- if (overflow == 0) return;
-
- Trace((stderr,"\nbit length overflow\n"));
- /* This happens for example on obj2 and pic of the Calgary corpus */
-
- /* Find the first bit length which could increase: */
- do {
- bits = max_length-1;
- while (s->bl_count[bits] == 0) bits--;
- s->bl_count[bits]--; /* move one leaf down the tree */
- s->bl_count[bits+1] += 2; /* move one overflow item as its brother */
- s->bl_count[max_length]--;
- /* The brother of the overflow item also moves one step up,
- * but this does not affect bl_count[max_length]
- */
- overflow -= 2;
- } while (overflow > 0);
-
- /* Now recompute all bit lengths, scanning in increasing frequency.
- * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all
- * lengths instead of fixing only the wrong ones. This idea is taken
- * from 'ar' written by Haruhiko Okumura.)
- */
- for (bits = max_length; bits != 0; bits--) {
- n = s->bl_count[bits];
- while (n != 0) {
- m = s->heap[--h];
- if (m > max_code) continue;
- if ((unsigned) tree[m].Len != (unsigned) bits) {
- Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits));
- s->opt_len += ((long)bits - (long)tree[m].Len)
- *(long)tree[m].Freq;
- tree[m].Len = (ush)bits;
- }
- n--;
- }
- }
-}
-
-/* ===========================================================================
- * Generate the codes for a given tree and bit counts (which need not be
- * optimal).
- * IN assertion: the array bl_count contains the bit length statistics for
- * the given tree and the field len is set for all tree elements.
- * OUT assertion: the field code is set for all tree elements of non
- * zero code length.
- */
-local void gen_codes (
- ct_data *tree, /* the tree to decorate */
- int max_code, /* largest code with non zero frequency */
- ushf *bl_count) /* number of codes at each bit length */
-{
- ush next_code[MAX_BITS+1]; /* next code value for each bit length */
- ush code = 0; /* running code value */
- int bits; /* bit index */
- int n; /* code index */
-
- /* The distribution counts are first used to generate the code values
- * without bit reversal.
- */
- for (bits = 1; bits <= MAX_BITS; bits++) {
- next_code[bits] = code = (code + bl_count[bits-1]) << 1;
- }
- /* Check that the bit counts in bl_count are consistent. The last code
- * must be all ones.
- */
- Assert (code + bl_count[MAX_BITS]-1 == (1<<MAX_BITS)-1,
- "inconsistent bit counts");
- Tracev((stderr,"\ngen_codes: max_code %d ", max_code));
-
- for (n = 0; n <= max_code; n++) {
- int len = tree[n].Len;
- if (len == 0) continue;
- /* Now reverse the bits */
- tree[n].Code = bi_reverse(next_code[len]++, len);
-
- Tracecv(tree != static_ltree, (stderr,"\nn %3d %c l %2d c %4x (%x) ",
- n, (isgraph(n) ? n : ' '), len, tree[n].Code, next_code[len]-1));
- }
-}
-
-/* ===========================================================================
- * Construct one Huffman tree and assigns the code bit strings and lengths.
- * Update the total bit length for the current block.
- * IN assertion: the field freq is set for all tree elements.
- * OUT assertions: the fields len and code are set to the optimal bit length
- * and corresponding code. The length opt_len is updated; static_len is
- * also updated if stree is not null. The field max_code is set.
- */
-local void build_tree(
- deflate_state *s,
- tree_desc *desc) /* the tree descriptor */
-{
- ct_data *tree = desc->dyn_tree;
- const ct_data *stree = desc->stat_desc->static_tree;
- int elems = desc->stat_desc->elems;
- int n, m; /* iterate over heap elements */
- int max_code = -1; /* largest code with non zero frequency */
- int node; /* new node being created */
-
- /* Construct the initial heap, with least frequent element in
- * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1].
- * heap[0] is not used.
- */
- s->heap_len = 0, s->heap_max = HEAP_SIZE;
-
- for (n = 0; n < elems; n++) {
- if (tree[n].Freq != 0) {
- s->heap[++(s->heap_len)] = max_code = n;
- s->depth[n] = 0;
- } else {
- tree[n].Len = 0;
- }
- }
-
- /* The pkzip format requires that at least one distance code exists,
- * and that at least one bit should be sent even if there is only one
- * possible code. So to avoid special checks later on we force at least
- * two codes of non zero frequency.
- */
- while (s->heap_len < 2) {
- node = s->heap[++(s->heap_len)] = (max_code < 2 ? ++max_code : 0);
- tree[node].Freq = 1;
- s->depth[node] = 0;
- s->opt_len--; if (stree) s->static_len -= stree[node].Len;
- /* node is 0 or 1 so it does not have extra bits */
- }
- desc->max_code = max_code;
-
- /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree,
- * establish sub-heaps of increasing lengths:
- */
- for (n = s->heap_len/2; n >= 1; n--) pqdownheap(s, tree, n);
-
- /* Construct the Huffman tree by repeatedly combining the least two
- * frequent nodes.
- */
- node = elems; /* next internal node of the tree */
- do {
- pqremove(s, tree, n); /* n = node of least frequency */
- m = s->heap[SMALLEST]; /* m = node of next least frequency */
-
- s->heap[--(s->heap_max)] = n; /* keep the nodes sorted by frequency */
- s->heap[--(s->heap_max)] = m;
-
- /* Create a new node father of n and m */
- tree[node].Freq = tree[n].Freq + tree[m].Freq;
- s->depth[node] = (uch)((s->depth[n] >= s->depth[m] ?
- s->depth[n] : s->depth[m]) + 1);
- tree[n].Dad = tree[m].Dad = (ush)node;
-#ifdef DUMP_BL_TREE
- if (tree == s->bl_tree) {
- fprintf(stderr,"\nnode %d(%d), sons %d(%d) %d(%d)",
- node, tree[node].Freq, n, tree[n].Freq, m, tree[m].Freq);
- }
-#endif
- /* and insert the new node in the heap */
- s->heap[SMALLEST] = node++;
- pqdownheap(s, tree, SMALLEST);
-
- } while (s->heap_len >= 2);
-
- s->heap[--(s->heap_max)] = s->heap[SMALLEST];
-
- /* At this point, the fields freq and dad are set. We can now
- * generate the bit lengths.
- */
- gen_bitlen(s, (tree_desc *)desc);
-
- /* The field len is now set, we can generate the bit codes */
- gen_codes ((ct_data *)tree, max_code, s->bl_count);
-}
-
-/* ===========================================================================
- * Scan a literal or distance tree to determine the frequencies of the codes
- * in the bit length tree.
- */
-local void scan_tree (
- deflate_state *s,
- ct_data *tree, /* the tree to be scanned */
- int max_code) /* and its largest code of non zero frequency */
-{
- int n; /* iterates over all tree elements */
- int prevlen = -1; /* last emitted length */
- int curlen; /* length of current code */
- int nextlen = tree[0].Len; /* length of next code */
- int count = 0; /* repeat count of the current code */
- int max_count = 7; /* max repeat count */
- int min_count = 4; /* min repeat count */
-
- if (nextlen == 0) max_count = 138, min_count = 3;
- tree[max_code+1].Len = (ush)0xffff; /* guard */
-
- for (n = 0; n <= max_code; n++) {
- curlen = nextlen; nextlen = tree[n+1].Len;
- if (++count < max_count && curlen == nextlen) {
- continue;
- } else if (count < min_count) {
- s->bl_tree[curlen].Freq += count;
- } else if (curlen != 0) {
- if (curlen != prevlen) s->bl_tree[curlen].Freq++;
- s->bl_tree[REP_3_6].Freq++;
- } else if (count <= 10) {
- s->bl_tree[REPZ_3_10].Freq++;
- } else {
- s->bl_tree[REPZ_11_138].Freq++;
- }
- count = 0; prevlen = curlen;
- if (nextlen == 0) {
- max_count = 138, min_count = 3;
- } else if (curlen == nextlen) {
- max_count = 6, min_count = 3;
- } else {
- max_count = 7, min_count = 4;
- }
- }
-}
-
-/* ===========================================================================
- * Send a literal or distance tree in compressed form, using the codes in
- * bl_tree.
- */
-local void send_tree (
- deflate_state *s,
- ct_data *tree, /* the tree to be scanned */
- int max_code) /* and its largest code of non zero frequency */
-{
- int n; /* iterates over all tree elements */
- int prevlen = -1; /* last emitted length */
- int curlen; /* length of current code */
- int nextlen = tree[0].Len; /* length of next code */
- int count = 0; /* repeat count of the current code */
- int max_count = 7; /* max repeat count */
- int min_count = 4; /* min repeat count */
-
- /* tree[max_code+1].Len = -1; */ /* guard already set */
- if (nextlen == 0) max_count = 138, min_count = 3;
-
- for (n = 0; n <= max_code; n++) {
- curlen = nextlen; nextlen = tree[n+1].Len;
- if (++count < max_count && curlen == nextlen) {
- continue;
- } else if (count < min_count) {
- do { send_code(s, curlen, s->bl_tree); } while (--count != 0);
-
- } else if (curlen != 0) {
- if (curlen != prevlen) {
- send_code(s, curlen, s->bl_tree); count--;
- }
- Assert(count >= 3 && count <= 6, " 3_6?");
- send_code(s, REP_3_6, s->bl_tree); send_bits(s, count-3, 2);
-
- } else if (count <= 10) {
- send_code(s, REPZ_3_10, s->bl_tree); send_bits(s, count-3, 3);
-
- } else {
- send_code(s, REPZ_11_138, s->bl_tree); send_bits(s, count-11, 7);
- }
- count = 0; prevlen = curlen;
- if (nextlen == 0) {
- max_count = 138, min_count = 3;
- } else if (curlen == nextlen) {
- max_count = 6, min_count = 3;
- } else {
- max_count = 7, min_count = 4;
- }
- }
-}
-
-/* ===========================================================================
- * Construct the Huffman tree for the bit lengths and return the index in
- * bl_order of the last bit length code to send.
- */
-local int build_bl_tree(
- deflate_state *s)
-{
- int max_blindex; /* index of last bit length code of non zero freq */
-
- /* Determine the bit length frequencies for literal and distance trees */
- scan_tree(s, (ct_data *)s->dyn_ltree, s->l_desc.max_code);
- scan_tree(s, (ct_data *)s->dyn_dtree, s->d_desc.max_code);
-
- /* Build the bit length tree: */
- build_tree(s, (tree_desc *)(&(s->bl_desc)));
- /* opt_len now includes the length of the tree representations, except
- * the lengths of the bit lengths codes and the 5+5+4 bits for the counts.
- */
-
- /* Determine the number of bit length codes to send. The pkzip format
- * requires that at least 4 bit length codes be sent. (appnote.txt says
- * 3 but the actual value used is 4.)
- */
- for (max_blindex = BL_CODES-1; max_blindex >= 3; max_blindex--) {
- if (s->bl_tree[bl_order[max_blindex]].Len != 0) break;
- }
- /* Update opt_len to include the bit length tree and counts */
- s->opt_len += 3*(max_blindex+1) + 5+5+4;
- Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld",
- s->opt_len, s->static_len));
-
- return max_blindex;
-}
-
-/* ===========================================================================
- * Send the header for a block using dynamic Huffman trees: the counts, the
- * lengths of the bit length codes, the literal tree and the distance tree.
- * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.
- */
-local void send_all_trees(
- deflate_state *s,
- int lcodes, int dcodes, int blcodes) /* number of codes for each tree */
-{
- int rank; /* index in bl_order */
-
- Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes");
- Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES,
- "too many codes");
- Tracev((stderr, "\nbl counts: "));
- send_bits(s, lcodes-257, 5); /* not +255 as stated in appnote.txt */
- send_bits(s, dcodes-1, 5);
- send_bits(s, blcodes-4, 4); /* not -3 as stated in appnote.txt */
- for (rank = 0; rank < blcodes; rank++) {
- Tracev((stderr, "\nbl code %2d ", bl_order[rank]));
- send_bits(s, s->bl_tree[bl_order[rank]].Len, 3);
- }
- Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent));
-
- send_tree(s, (ct_data *)s->dyn_ltree, lcodes-1); /* literal tree */
- Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent));
-
- send_tree(s, (ct_data *)s->dyn_dtree, dcodes-1); /* distance tree */
- Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent));
-}
-
-/* ===========================================================================
- * Send a stored block
- */
-void ZLIB_INTERNAL _tr_stored_block(
- deflate_state *s,
- charf *buf, /* input block */
- ulg stored_len, /* length of input block */
- int last) /* one if this is the last block for a file */
-{
- send_bits(s, (STORED_BLOCK<<1)+last, 3); /* send block type */
-#ifdef DEBUG
- s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L;
- s->compressed_len += (stored_len + 4) << 3;
-#endif
- copy_block(s, buf, (unsigned)stored_len, 1); /* with header */
-}
-
-/* ===========================================================================
- * Flush the bits in the bit buffer to pending output (leaves at most 7 bits)
- */
-void ZLIB_INTERNAL _tr_flush_bits(
- deflate_state *s)
-{
- bi_flush(s);
-}
-
-/* ===========================================================================
- * Send one empty static block to give enough lookahead for inflate.
- * This takes 10 bits, of which 7 may remain in the bit buffer.
- */
-void ZLIB_INTERNAL _tr_align(
- deflate_state *s)
-{
- send_bits(s, STATIC_TREES<<1, 3);
- send_code(s, END_BLOCK, static_ltree);
-#ifdef DEBUG
- s->compressed_len += 10L; /* 3 for block type, 7 for EOB */
-#endif
- bi_flush(s);
-}
-
-/* ===========================================================================
- * Determine the best encoding for the current block: dynamic trees, static
- * trees or store, and output the encoded block to the zip file.
- */
-void ZLIB_INTERNAL _tr_flush_block(
- deflate_state *s,
- charf *buf, /* input block, or NULL if too old */
- ulg stored_len, /* length of input block */
- int last) /* one if this is the last block for a file */
-{
- ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */
- int max_blindex = 0; /* index of last bit length code of non zero freq */
-
- /* Build the Huffman trees unless a stored block is forced */
- if (s->level > 0) {
-
- /* Check if the file is binary or text */
- if (s->strm->data_type == Z_UNKNOWN)
- s->strm->data_type = detect_data_type(s);
-
- /* Construct the literal and distance trees */
- build_tree(s, (tree_desc *)(&(s->l_desc)));
- Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len,
- s->static_len));
-
- build_tree(s, (tree_desc *)(&(s->d_desc)));
- Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len,
- s->static_len));
- /* At this point, opt_len and static_len are the total bit lengths of
- * the compressed block data, excluding the tree representations.
- */
-
- /* Build the bit length tree for the above two trees, and get the index
- * in bl_order of the last bit length code to send.
- */
- max_blindex = build_bl_tree(s);
-
- /* Determine the best encoding. Compute the block lengths in bytes. */
- opt_lenb = (s->opt_len+3+7)>>3;
- static_lenb = (s->static_len+3+7)>>3;
-
- Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ",
- opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,
- s->last_lit));
-
- if (static_lenb <= opt_lenb) opt_lenb = static_lenb;
-
- } else {
- Assert(buf != (char*)0, "lost buf");
- opt_lenb = static_lenb = stored_len + 5; /* force a stored block */
- }
-
-#ifdef FORCE_STORED
- if (buf != (char*)0) { /* force stored block */
-#else
- if (stored_len+4 <= opt_lenb && buf != (char*)0) {
- /* 4: two words for the lengths */
-#endif
- /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE.
- * Otherwise we can't have processed more than WSIZE input bytes since
- * the last block flush, because compression would have been
- * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to
- * transform a block into a stored block.
- */
- _tr_stored_block(s, buf, stored_len, last);
-
-#ifdef FORCE_STATIC
- } else if (static_lenb >= 0) { /* force static trees */
-#else
- } else if (s->strategy == Z_FIXED || static_lenb == opt_lenb) {
-#endif
- send_bits(s, (STATIC_TREES<<1)+last, 3);
- compress_block(s, (const ct_data *)static_ltree,
- (const ct_data *)static_dtree);
-#ifdef DEBUG
- s->compressed_len += 3 + s->static_len;
-#endif
- } else {
- send_bits(s, (DYN_TREES<<1)+last, 3);
- send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1,
- max_blindex+1);
- compress_block(s, (const ct_data *)s->dyn_ltree,
- (const ct_data *)s->dyn_dtree);
-#ifdef DEBUG
- s->compressed_len += 3 + s->opt_len;
-#endif
- }
- Assert (s->compressed_len == s->bits_sent, "bad compressed size");
- /* The above check is made mod 2^32, for files larger than 512 MB
- * and uLong implemented on 32 bits.
- */
- init_block(s);
-
- if (last) {
- bi_windup(s);
-#ifdef DEBUG
- s->compressed_len += 7; /* align on byte boundary */
-#endif
- }
- Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3,
- s->compressed_len-7*last));
-}
-
-/* ===========================================================================
- * Save the match info and tally the frequency counts. Return true if
- * the current block must be flushed.
- */
-int ZLIB_INTERNAL _tr_tally (
- deflate_state *s,
- unsigned dist, /* distance of matched string */
- unsigned lc) /* match length-MIN_MATCH or unmatched char (if dist==0) */
-{
- s->d_buf[s->last_lit] = (ush)dist;
- s->l_buf[s->last_lit++] = (uch)lc;
- if (dist == 0) {
- /* lc is the unmatched char */
- s->dyn_ltree[lc].Freq++;
- } else {
- s->matches++;
- /* Here, lc is the match length - MIN_MATCH */
- dist--; /* dist = match distance - 1 */
- Assert((ush)dist < (ush)MAX_DIST(s) &&
- (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) &&
- (ush)d_code(dist) < (ush)D_CODES, "_tr_tally: bad match");
-
- s->dyn_ltree[_length_code[lc]+LITERALS+1].Freq++;
- s->dyn_dtree[d_code(dist)].Freq++;
- }
-
-#ifdef TRUNCATE_BLOCK
- /* Try to guess if it is profitable to stop the current block here */
- if ((s->last_lit & 0x1fff) == 0 && s->level > 2) {
- /* Compute an upper bound for the compressed length */
- ulg out_length = (ulg)s->last_lit*8L;
- ulg in_length = (ulg)((long)s->strstart - s->block_start);
- int dcode;
- for (dcode = 0; dcode < D_CODES; dcode++) {
- out_length += (ulg)s->dyn_dtree[dcode].Freq *
- (5L+extra_dbits[dcode]);
- }
- out_length >>= 3;
- Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ",
- s->last_lit, in_length, out_length,
- 100L - out_length*100L/in_length));
- if (s->matches < s->last_lit/2 && out_length < in_length/2) return 1;
- }
-#endif
- return (s->last_lit == s->lit_bufsize-1);
- /* We avoid equality with lit_bufsize because of wraparound at 64K
- * on 16 bit machines and because stored blocks are restricted to
- * 64K-1 bytes.
- */
-}
-
-/* ===========================================================================
- * Send the block data compressed using the given Huffman trees
- */
-local void compress_block(
- deflate_state *s,
- const ct_data *ltree, /* literal tree */
- const ct_data *dtree) /* distance tree */
-{
- unsigned dist; /* distance of matched string */
- int lc; /* match length or unmatched char (if dist == 0) */
- unsigned lx = 0; /* running index in l_buf */
- unsigned code; /* the code to send */
- int extra; /* number of extra bits to send */
-
- if (s->last_lit != 0) do {
- dist = s->d_buf[lx];
- lc = s->l_buf[lx++];
- if (dist == 0) {
- send_code(s, lc, ltree); /* send a literal byte */
- Tracecv(isgraph(lc), (stderr," '%c' ", lc));
- } else {
- /* Here, lc is the match length - MIN_MATCH */
- code = _length_code[lc];
- send_code(s, code+LITERALS+1, ltree); /* send the length code */
- extra = extra_lbits[code];
- if (extra != 0) {
- lc -= base_length[code];
- send_bits(s, lc, extra); /* send the extra length bits */
- }
- dist--; /* dist is now the match distance - 1 */
- code = d_code(dist);
- Assert (code < D_CODES, "bad d_code");
-
- send_code(s, code, dtree); /* send the distance code */
- extra = extra_dbits[code];
- if (extra != 0) {
- dist -= base_dist[code];
- send_bits(s, dist, extra); /* send the extra distance bits */
- }
- } /* literal or match pair ? */
-
- /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */
- Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx,
- "pendingBuf overflow");
-
- } while (lx < s->last_lit);
-
- send_code(s, END_BLOCK, ltree);
-}
-
-/* ===========================================================================
- * Check if the data type is TEXT or BINARY, using the following algorithm:
- * - TEXT if the two conditions below are satisfied:
- * a) There are no non-portable control characters belonging to the
- * "black list" (0..6, 14..25, 28..31).
- * b) There is at least one printable character belonging to the
- * "white list" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255).
- * - BINARY otherwise.
- * - The following partially-portable control characters form a
- * "gray list" that is ignored in this detection algorithm:
- * (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}).
- * IN assertion: the fields Freq of dyn_ltree are set.
- */
-local int detect_data_type(
- deflate_state *s)
-{
- /* black_mask is the bit mask of black-listed bytes
- * set bits 0..6, 14..25, and 28..31
- * 0xf3ffc07f = binary 11110011111111111100000001111111
- */
- unsigned long black_mask = 0xf3ffc07fUL;
- int n;
-
- /* Check for non-textual ("black-listed") bytes. */
- for (n = 0; n <= 31; n++, black_mask >>= 1)
- if ((black_mask & 1) && (s->dyn_ltree[n].Freq != 0))
- return Z_BINARY;
-
- /* Check for textual ("white-listed") bytes. */
- if (s->dyn_ltree[9].Freq != 0 || s->dyn_ltree[10].Freq != 0
- || s->dyn_ltree[13].Freq != 0)
- return Z_TEXT;
- for (n = 32; n < LITERALS; n++)
- if (s->dyn_ltree[n].Freq != 0)
- return Z_TEXT;
-
- /* There are no "black-listed" or "white-listed" bytes:
- * this stream either is empty or has tolerated ("gray-listed") bytes only.
- */
- return Z_BINARY;
-}
-
-/* ===========================================================================
- * Reverse the first len bits of a code, using straightforward code (a faster
- * method would use a table)
- * IN assertion: 1 <= len <= 15
- */
-local unsigned bi_reverse(
- unsigned code, /* the value to invert */
- int len) /* its bit length */
-{
- register unsigned res = 0;
- do {
- res |= code & 1;
- code >>= 1, res <<= 1;
- } while (--len > 0);
- return res >> 1;
-}
-
-/* ===========================================================================
- * Flush the bit buffer, keeping at most 7 bits in it.
- */
-local void bi_flush(
- deflate_state *s)
-{
- if (s->bi_valid == 16) {
- put_short(s, s->bi_buf);
- s->bi_buf = 0;
- s->bi_valid = 0;
- } else if (s->bi_valid >= 8) {
- put_byte(s, (Byte)s->bi_buf);
- s->bi_buf >>= 8;
- s->bi_valid -= 8;
- }
-}
-
-/* ===========================================================================
- * Flush the bit buffer and align the output on a byte boundary
- */
-local void bi_windup(
- deflate_state *s)
-{
- if (s->bi_valid > 8) {
- put_short(s, s->bi_buf);
- } else if (s->bi_valid > 0) {
- put_byte(s, (Byte)s->bi_buf);
- }
- s->bi_buf = 0;
- s->bi_valid = 0;
-#ifdef DEBUG
- s->bits_sent = (s->bits_sent+7) & ~7;
-#endif
-}
-
-/* ===========================================================================
- * Copy a stored block, storing first the length and its
- * one's complement if requested.
- */
-local void copy_block(
- deflate_state *s,
- charf *buf, /* the input data */
- unsigned len, /* its length */
- int header) /* true if block header must be written */
-{
- bi_windup(s); /* align on byte boundary */
-
- if (header) {
- put_short(s, (ush)len);
- put_short(s, (ush)~len);
-#ifdef DEBUG
- s->bits_sent += 2*16;
-#endif
- }
-#ifdef DEBUG
- s->bits_sent += (ulg)len<<3;
-#endif
- while (len--) {
- put_byte(s, *buf++);
- }
-}
diff --git a/chromium/third_party/pdfium/third_party/zlib_v128/trees.h b/chromium/third_party/pdfium/third_party/zlib_v128/trees.h
deleted file mode 100644
index 8a09b5803aa..00000000000
--- a/chromium/third_party/pdfium/third_party/zlib_v128/trees.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/* GENERATED FILE */
-/* header created automatically with -DGEN_TREES_H */
-
-local const ct_data static_ltree[L_CODES+2] = {
-{{ 12},{ 8}}, {{140},{ 8}}, {{ 76},{ 8}}, {{204},{ 8}}, {{ 44},{ 8}},
-{{172},{ 8}}, {{108},{ 8}}, {{236},{ 8}}, {{ 28},{ 8}}, {{156},{ 8}},
-{{ 92},{ 8}}, {{220},{ 8}}, {{ 60},{ 8}}, {{188},{ 8}}, {{124},{ 8}},
-{{252},{ 8}}, {{ 2},{ 8}}, {{130},{ 8}}, {{ 66},{ 8}}, {{194},{ 8}},
-{{ 34},{ 8}}, {{162},{ 8}}, {{ 98},{ 8}}, {{226},{ 8}}, {{ 18},{ 8}},
-{{146},{ 8}}, {{ 82},{ 8}}, {{210},{ 8}}, {{ 50},{ 8}}, {{178},{ 8}},
-{{114},{ 8}}, {{242},{ 8}}, {{ 10},{ 8}}, {{138},{ 8}}, {{ 74},{ 8}},
-{{202},{ 8}}, {{ 42},{ 8}}, {{170},{ 8}}, {{106},{ 8}}, {{234},{ 8}},
-{{ 26},{ 8}}, {{154},{ 8}}, {{ 90},{ 8}}, {{218},{ 8}}, {{ 58},{ 8}},
-{{186},{ 8}}, {{122},{ 8}}, {{250},{ 8}}, {{ 6},{ 8}}, {{134},{ 8}},
-{{ 70},{ 8}}, {{198},{ 8}}, {{ 38},{ 8}}, {{166},{ 8}}, {{102},{ 8}},
-{{230},{ 8}}, {{ 22},{ 8}}, {{150},{ 8}}, {{ 86},{ 8}}, {{214},{ 8}},
-{{ 54},{ 8}}, {{182},{ 8}}, {{118},{ 8}}, {{246},{ 8}}, {{ 14},{ 8}},
-{{142},{ 8}}, {{ 78},{ 8}}, {{206},{ 8}}, {{ 46},{ 8}}, {{174},{ 8}},
-{{110},{ 8}}, {{238},{ 8}}, {{ 30},{ 8}}, {{158},{ 8}}, {{ 94},{ 8}},
-{{222},{ 8}}, {{ 62},{ 8}}, {{190},{ 8}}, {{126},{ 8}}, {{254},{ 8}},
-{{ 1},{ 8}}, {{129},{ 8}}, {{ 65},{ 8}}, {{193},{ 8}}, {{ 33},{ 8}},
-{{161},{ 8}}, {{ 97},{ 8}}, {{225},{ 8}}, {{ 17},{ 8}}, {{145},{ 8}},
-{{ 81},{ 8}}, {{209},{ 8}}, {{ 49},{ 8}}, {{177},{ 8}}, {{113},{ 8}},
-{{241},{ 8}}, {{ 9},{ 8}}, {{137},{ 8}}, {{ 73},{ 8}}, {{201},{ 8}},
-{{ 41},{ 8}}, {{169},{ 8}}, {{105},{ 8}}, {{233},{ 8}}, {{ 25},{ 8}},
-{{153},{ 8}}, {{ 89},{ 8}}, {{217},{ 8}}, {{ 57},{ 8}}, {{185},{ 8}},
-{{121},{ 8}}, {{249},{ 8}}, {{ 5},{ 8}}, {{133},{ 8}}, {{ 69},{ 8}},
-{{197},{ 8}}, {{ 37},{ 8}}, {{165},{ 8}}, {{101},{ 8}}, {{229},{ 8}},
-{{ 21},{ 8}}, {{149},{ 8}}, {{ 85},{ 8}}, {{213},{ 8}}, {{ 53},{ 8}},
-{{181},{ 8}}, {{117},{ 8}}, {{245},{ 8}}, {{ 13},{ 8}}, {{141},{ 8}},
-{{ 77},{ 8}}, {{205},{ 8}}, {{ 45},{ 8}}, {{173},{ 8}}, {{109},{ 8}},
-{{237},{ 8}}, {{ 29},{ 8}}, {{157},{ 8}}, {{ 93},{ 8}}, {{221},{ 8}},
-{{ 61},{ 8}}, {{189},{ 8}}, {{125},{ 8}}, {{253},{ 8}}, {{ 19},{ 9}},
-{{275},{ 9}}, {{147},{ 9}}, {{403},{ 9}}, {{ 83},{ 9}}, {{339},{ 9}},
-{{211},{ 9}}, {{467},{ 9}}, {{ 51},{ 9}}, {{307},{ 9}}, {{179},{ 9}},
-{{435},{ 9}}, {{115},{ 9}}, {{371},{ 9}}, {{243},{ 9}}, {{499},{ 9}},
-{{ 11},{ 9}}, {{267},{ 9}}, {{139},{ 9}}, {{395},{ 9}}, {{ 75},{ 9}},
-{{331},{ 9}}, {{203},{ 9}}, {{459},{ 9}}, {{ 43},{ 9}}, {{299},{ 9}},
-{{171},{ 9}}, {{427},{ 9}}, {{107},{ 9}}, {{363},{ 9}}, {{235},{ 9}},
-{{491},{ 9}}, {{ 27},{ 9}}, {{283},{ 9}}, {{155},{ 9}}, {{411},{ 9}},
-{{ 91},{ 9}}, {{347},{ 9}}, {{219},{ 9}}, {{475},{ 9}}, {{ 59},{ 9}},
-{{315},{ 9}}, {{187},{ 9}}, {{443},{ 9}}, {{123},{ 9}}, {{379},{ 9}},
-{{251},{ 9}}, {{507},{ 9}}, {{ 7},{ 9}}, {{263},{ 9}}, {{135},{ 9}},
-{{391},{ 9}}, {{ 71},{ 9}}, {{327},{ 9}}, {{199},{ 9}}, {{455},{ 9}},
-{{ 39},{ 9}}, {{295},{ 9}}, {{167},{ 9}}, {{423},{ 9}}, {{103},{ 9}},
-{{359},{ 9}}, {{231},{ 9}}, {{487},{ 9}}, {{ 23},{ 9}}, {{279},{ 9}},
-{{151},{ 9}}, {{407},{ 9}}, {{ 87},{ 9}}, {{343},{ 9}}, {{215},{ 9}},
-{{471},{ 9}}, {{ 55},{ 9}}, {{311},{ 9}}, {{183},{ 9}}, {{439},{ 9}},
-{{119},{ 9}}, {{375},{ 9}}, {{247},{ 9}}, {{503},{ 9}}, {{ 15},{ 9}},
-{{271},{ 9}}, {{143},{ 9}}, {{399},{ 9}}, {{ 79},{ 9}}, {{335},{ 9}},
-{{207},{ 9}}, {{463},{ 9}}, {{ 47},{ 9}}, {{303},{ 9}}, {{175},{ 9}},
-{{431},{ 9}}, {{111},{ 9}}, {{367},{ 9}}, {{239},{ 9}}, {{495},{ 9}},
-{{ 31},{ 9}}, {{287},{ 9}}, {{159},{ 9}}, {{415},{ 9}}, {{ 95},{ 9}},
-{{351},{ 9}}, {{223},{ 9}}, {{479},{ 9}}, {{ 63},{ 9}}, {{319},{ 9}},
-{{191},{ 9}}, {{447},{ 9}}, {{127},{ 9}}, {{383},{ 9}}, {{255},{ 9}},
-{{511},{ 9}}, {{ 0},{ 7}}, {{ 64},{ 7}}, {{ 32},{ 7}}, {{ 96},{ 7}},
-{{ 16},{ 7}}, {{ 80},{ 7}}, {{ 48},{ 7}}, {{112},{ 7}}, {{ 8},{ 7}},
-{{ 72},{ 7}}, {{ 40},{ 7}}, {{104},{ 7}}, {{ 24},{ 7}}, {{ 88},{ 7}},
-{{ 56},{ 7}}, {{120},{ 7}}, {{ 4},{ 7}}, {{ 68},{ 7}}, {{ 36},{ 7}},
-{{100},{ 7}}, {{ 20},{ 7}}, {{ 84},{ 7}}, {{ 52},{ 7}}, {{116},{ 7}},
-{{ 3},{ 8}}, {{131},{ 8}}, {{ 67},{ 8}}, {{195},{ 8}}, {{ 35},{ 8}},
-{{163},{ 8}}, {{ 99},{ 8}}, {{227},{ 8}}
-};
-
-local const ct_data static_dtree[D_CODES] = {
-{{ 0},{ 5}}, {{16},{ 5}}, {{ 8},{ 5}}, {{24},{ 5}}, {{ 4},{ 5}},
-{{20},{ 5}}, {{12},{ 5}}, {{28},{ 5}}, {{ 2},{ 5}}, {{18},{ 5}},
-{{10},{ 5}}, {{26},{ 5}}, {{ 6},{ 5}}, {{22},{ 5}}, {{14},{ 5}},
-{{30},{ 5}}, {{ 1},{ 5}}, {{17},{ 5}}, {{ 9},{ 5}}, {{25},{ 5}},
-{{ 5},{ 5}}, {{21},{ 5}}, {{13},{ 5}}, {{29},{ 5}}, {{ 3},{ 5}},
-{{19},{ 5}}, {{11},{ 5}}, {{27},{ 5}}, {{ 7},{ 5}}, {{23},{ 5}}
-};
-
-const uch ZLIB_INTERNAL _dist_code[DIST_CODE_LEN] = {
- 0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8,
- 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10,
-10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
-11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
-12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13,
-13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
-13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
-14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
-14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
-14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15,
-15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
-15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
-15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 16, 17,
-18, 18, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22,
-23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
-24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
-26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
-26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27,
-27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
-27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
-28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
-28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
-28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
-29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
-29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
-29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29
-};
-
-const uch ZLIB_INTERNAL _length_code[MAX_MATCH-MIN_MATCH+1]= {
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12,
-13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16,
-17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19,
-19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
-21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22,
-22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23,
-23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
-24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
-25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
-25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26,
-26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
-26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
-27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28
-};
-
-local const int base_length[LENGTH_CODES] = {
-0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 20, 24, 28, 32, 40, 48, 56,
-64, 80, 96, 112, 128, 160, 192, 224, 0
-};
-
-local const int base_dist[D_CODES] = {
- 0, 1, 2, 3, 4, 6, 8, 12, 16, 24,
- 32, 48, 64, 96, 128, 192, 256, 384, 512, 768,
- 1024, 1536, 2048, 3072, 4096, 6144, 8192, 12288, 16384, 24576
-};
-
diff --git a/chromium/third_party/pdfium/third_party/zlib_v128/uncompr.c b/chromium/third_party/pdfium/third_party/zlib_v128/uncompr.c
deleted file mode 100644
index d3cb8fe1835..00000000000
--- a/chromium/third_party/pdfium/third_party/zlib_v128/uncompr.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/* uncompr.c -- decompress a memory buffer
- * Copyright (C) 1995-2003, 2010 Jean-loup Gailly.
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* @(#) $Id$ */
-
-#define ZLIB_INTERNAL
-#include "zlib.h"
-
-/* ===========================================================================
- Decompresses the source buffer into the destination buffer. sourceLen is
- the byte length of the source buffer. Upon entry, destLen is the total
- size of the destination buffer, which must be large enough to hold the
- entire uncompressed data. (The size of the uncompressed data must have
- been saved previously by the compressor and transmitted to the decompressor
- by some mechanism outside the scope of this compression library.)
- Upon exit, destLen is the actual size of the compressed buffer.
-
- uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
- enough memory, Z_BUF_ERROR if there was not enough room in the output
- buffer, or Z_DATA_ERROR if the input data was corrupted.
-*/
-int ZEXPORT uncompress (
- Bytef *dest,
- uLongf *destLen,
- const Bytef *source,
- uLong sourceLen)
-{
- z_stream stream;
- int err;
-
- stream.next_in = (z_const Bytef *)source;
- stream.avail_in = (uInt)sourceLen;
- /* Check for source > 64K on 16-bit machine: */
- if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR;
-
- stream.next_out = dest;
- stream.avail_out = (uInt)*destLen;
- if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR;
-
- stream.zalloc = (alloc_func)0;
- stream.zfree = (free_func)0;
-
- err = inflateInit(&stream);
- if (err != Z_OK) return err;
-
- err = inflate(&stream, Z_FINISH);
- if (err != Z_STREAM_END) {
- inflateEnd(&stream);
- if (err == Z_NEED_DICT || (err == Z_BUF_ERROR && stream.avail_in == 0))
- return Z_DATA_ERROR;
- return err;
- }
- *destLen = stream.total_out;
-
- err = inflateEnd(&stream);
- return err;
-}
diff --git a/chromium/third_party/pdfium/third_party/zlib_v128/zconf.h b/chromium/third_party/pdfium/third_party/zlib_v128/zconf.h
deleted file mode 100644
index 5708a377e04..00000000000
--- a/chromium/third_party/pdfium/third_party/zlib_v128/zconf.h
+++ /dev/null
@@ -1,519 +0,0 @@
-/* zconf.h -- configuration of the zlib compression library
- * Copyright (C) 1995-2013 Jean-loup Gailly.
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* @(#) $Id$ */
-
-#ifndef ZCONF_H
-#define ZCONF_H
-
-/*
- * If you *really* need a unique prefix for all types and library functions,
- * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
- * Even better than compiling with -DZ_PREFIX would be to use configure to set
- * this permanently in zconf.h using "./configure --zprefix".
- */
-#ifdef Z_PREFIX /* may be set to #if 1 by ./configure */
-# define Z_PREFIX_SET
-
-/* all linked symbols */
-# define _dist_code z__dist_code
-# define _length_code z__length_code
-# define _tr_align z__tr_align
-# define _tr_flush_bits z__tr_flush_bits
-# define _tr_flush_block z__tr_flush_block
-# define _tr_init z__tr_init
-# define _tr_stored_block z__tr_stored_block
-# define _tr_tally z__tr_tally
-# define adler32 z_adler32
-# define adler32_combine z_adler32_combine
-# define adler32_combine64 z_adler32_combine64
-# ifndef Z_SOLO
-# define compress z_compress
-# define compress2 z_compress2
-# define compressBound z_compressBound
-# endif
-# define crc32 z_crc32
-# define crc32_combine z_crc32_combine
-# define crc32_combine64 z_crc32_combine64
-# define deflate z_deflate
-# define deflateBound z_deflateBound
-# define deflateCopy z_deflateCopy
-# define deflateEnd z_deflateEnd
-# define deflateInit2_ z_deflateInit2_
-# define deflateInit_ z_deflateInit_
-# define deflateParams z_deflateParams
-# define deflatePending z_deflatePending
-# define deflatePrime z_deflatePrime
-# define deflateReset z_deflateReset
-# define deflateResetKeep z_deflateResetKeep
-# define deflateSetDictionary z_deflateSetDictionary
-# define deflateSetHeader z_deflateSetHeader
-# define deflateTune z_deflateTune
-# define deflate_copyright z_deflate_copyright
-# define get_crc_table z_get_crc_table
-# ifndef Z_SOLO
-# define gz_error z_gz_error
-# define gz_intmax z_gz_intmax
-# define gz_strwinerror z_gz_strwinerror
-# define gzbuffer z_gzbuffer
-# define gzclearerr z_gzclearerr
-# define gzclose z_gzclose
-# define gzclose_r z_gzclose_r
-# define gzclose_w z_gzclose_w
-# define gzdirect z_gzdirect
-# define gzdopen z_gzdopen
-# define gzeof z_gzeof
-# define gzerror z_gzerror
-# define gzflush z_gzflush
-# define gzgetc z_gzgetc
-# define gzgetc_ z_gzgetc_
-# define gzgets z_gzgets
-# define gzoffset z_gzoffset
-# define gzoffset64 z_gzoffset64
-# define gzopen z_gzopen
-# define gzopen64 z_gzopen64
-# ifdef _WIN32
-# define gzopen_w z_gzopen_w
-# endif
-# define gzprintf z_gzprintf
-# define gzvprintf z_gzvprintf
-# define gzputc z_gzputc
-# define gzputs z_gzputs
-# define gzread z_gzread
-# define gzrewind z_gzrewind
-# define gzseek z_gzseek
-# define gzseek64 z_gzseek64
-# define gzsetparams z_gzsetparams
-# define gztell z_gztell
-# define gztell64 z_gztell64
-# define gzungetc z_gzungetc
-# define gzwrite z_gzwrite
-# endif
-# define inflate z_inflate
-# define inflateBack z_inflateBack
-# define inflateBackEnd z_inflateBackEnd
-# define inflateBackInit_ z_inflateBackInit_
-# define inflateCopy z_inflateCopy
-# define inflateEnd z_inflateEnd
-# define inflateGetHeader z_inflateGetHeader
-# define inflateInit2_ z_inflateInit2_
-# define inflateInit_ z_inflateInit_
-# define inflateMark z_inflateMark
-# define inflatePrime z_inflatePrime
-# define inflateReset z_inflateReset
-# define inflateReset2 z_inflateReset2
-# define inflateSetDictionary z_inflateSetDictionary
-# define inflateGetDictionary z_inflateGetDictionary
-# define inflateSync z_inflateSync
-# define inflateSyncPoint z_inflateSyncPoint
-# define inflateUndermine z_inflateUndermine
-# define inflateResetKeep z_inflateResetKeep
-# define inflate_copyright z_inflate_copyright
-# define inflate_fast z_inflate_fast
-# define inflate_table z_inflate_table
-# ifndef Z_SOLO
-# define uncompress z_uncompress
-# endif
-# define zError z_zError
-# ifndef Z_SOLO
-# define zcalloc z_zcalloc
-# define zcfree z_zcfree
-# endif
-# define zlibCompileFlags z_zlibCompileFlags
-# define zlibVersion z_zlibVersion
-
-/* all zlib typedefs in zlib.h and zconf.h */
-# define Byte z_Byte
-# define Bytef z_Bytef
-# define alloc_func z_alloc_func
-# define charf z_charf
-# define free_func z_free_func
-# ifndef Z_SOLO
-# define gzFile z_gzFile
-# endif
-# define gz_header z_gz_header
-# define gz_headerp z_gz_headerp
-# define in_func z_in_func
-# define intf z_intf
-# define out_func z_out_func
-# define uInt z_uInt
-# define uIntf z_uIntf
-# define uLong z_uLong
-# define uLongf z_uLongf
-# define voidp z_voidp
-# define voidpc z_voidpc
-# define voidpf z_voidpf
-
-/* all zlib structs in zlib.h and zconf.h */
-# define gz_header_s z_gz_header_s
-# define internal_state z_internal_state
-
-#endif
-
-#if defined(__MSDOS__) && !defined(MSDOS)
-# define MSDOS
-#endif
-#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2)
-# define OS2
-#endif
-#if defined(_WINDOWS) && !defined(WINDOWS)
-# define WINDOWS
-#endif
-#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__)
-# ifndef WIN32
-# define WIN32
-# endif
-#endif
-#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32)
-# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__)
-# ifndef SYS16BIT
-# define SYS16BIT
-# endif
-# endif
-#endif
-
-/*
- * Compile with -DMAXSEG_64K if the alloc function cannot allocate more
- * than 64k bytes at a time (needed on systems with 16-bit int).
- */
-#ifdef SYS16BIT
-# define MAXSEG_64K
-#endif
-#ifdef MSDOS
-# define UNALIGNED_OK
-#endif
-
-#ifdef __STDC_VERSION__
-# ifndef STDC
-# define STDC
-# endif
-# if __STDC_VERSION__ >= 199901L
-# ifndef STDC99
-# define STDC99
-# endif
-# endif
-#endif
-#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus))
-# define STDC
-#endif
-#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__))
-# define STDC
-#endif
-#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32))
-# define STDC
-#endif
-#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__))
-# define STDC
-#endif
-
-#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */
-# define STDC
-#endif
-
-#ifndef STDC
-# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
-# define const /* note: need a more gentle solution here */
-# endif
-#endif
-
-#if defined(ZLIB_CONST) && !defined(z_const)
-# define z_const const
-#else
-# define z_const
-#endif
-
-/* Some Mac compilers merge all .h files incorrectly: */
-#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__)
-# define NO_DUMMY_DECL
-#endif
-
-/* Maximum value for memLevel in deflateInit2 */
-#ifndef MAX_MEM_LEVEL
-# ifdef MAXSEG_64K
-# define MAX_MEM_LEVEL 8
-# else
-# define MAX_MEM_LEVEL 9
-# endif
-#endif
-
-/* Maximum value for windowBits in deflateInit2 and inflateInit2.
- * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
- * created by gzip. (Files created by minigzip can still be extracted by
- * gzip.)
- */
-#ifndef MAX_WBITS
-# define MAX_WBITS 15 /* 32K LZ77 window */
-#endif
-
-/* The memory requirements for deflate are (in bytes):
- (1 << (windowBits+2)) + (1 << (memLevel+9))
- that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values)
- plus a few kilobytes for small objects. For example, if you want to reduce
- the default memory requirements from 256K to 128K, compile with
- make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
- Of course this will generally degrade compression (there's no free lunch).
-
- The memory requirements for inflate are (in bytes) 1 << windowBits
- that is, 32K for windowBits=15 (default value) plus a few kilobytes
- for small objects.
-*/
-
- /* Type declarations */
-
-#ifndef OF /* function prototypes */
-# ifdef STDC
-# define OF(args) args
-# else
-# define OF(args) ()
-# endif
-#endif
-
-#ifndef Z_ARG /* function prototypes for stdarg */
-# if defined(STDC) || defined(Z_HAVE_STDARG_H)
-# define Z_ARG(args) args
-# else
-# define Z_ARG(args) ()
-# endif
-#endif
-
-/* The following definitions for FAR are needed only for MSDOS mixed
- * model programming (small or medium model with some far allocations).
- * This was tested only with MSC; for other MSDOS compilers you may have
- * to define NO_MEMCPY in zutil.h. If you don't need the mixed model,
- * just define FAR to be empty.
- */
-#ifdef SYS16BIT
-# if defined(M_I86SM) || defined(M_I86MM)
- /* MSC small or medium model */
-# define SMALL_MEDIUM
-# ifdef _MSC_VER
-# define FAR _far
-# else
-# define FAR far
-# endif
-# endif
-# if (defined(__SMALL__) || defined(__MEDIUM__))
- /* Turbo C small or medium model */
-# define SMALL_MEDIUM
-# ifdef __BORLANDC__
-# define FAR _far
-# else
-# define FAR far
-# endif
-# endif
-#endif
-
-#if defined(WINDOWS) || defined(WIN32)
- /* If building or using zlib as a DLL, define ZLIB_DLL.
- * This is not mandatory, but it offers a little performance increase.
- */
-# ifdef ZLIB_DLL
-# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))
-# ifdef ZLIB_INTERNAL
-# define ZEXTERN extern __declspec(dllexport)
-# else
-# define ZEXTERN extern __declspec(dllimport)
-# endif
-# endif
-# endif /* ZLIB_DLL */
- /* If building or using zlib with the WINAPI/WINAPIV calling convention,
- * define ZLIB_WINAPI.
- * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
- */
-# ifdef ZLIB_WINAPI
-# ifdef FAR
-# undef FAR
-# endif
-# include <windows.h>
- /* No need for _export, use ZLIB.DEF instead. */
- /* For complete Windows compatibility, use WINAPI, not __stdcall. */
-# define ZEXPORT WINAPI
-# ifdef WIN32
-# define ZEXPORTVA WINAPIV
-# else
-# define ZEXPORTVA FAR CDECL
-# endif
-# endif
-#endif
-
-#if defined (__BEOS__)
-# ifdef ZLIB_DLL
-# ifdef ZLIB_INTERNAL
-# define ZEXPORT __declspec(dllexport)
-# define ZEXPORTVA __declspec(dllexport)
-# else
-# define ZEXPORT __declspec(dllimport)
-# define ZEXPORTVA __declspec(dllimport)
-# endif
-# endif
-#endif
-
-#ifndef ZEXTERN
-# define ZEXTERN extern
-#endif
-#ifndef ZEXPORT
-# define ZEXPORT
-#endif
-#ifndef ZEXPORTVA
-# define ZEXPORTVA
-#endif
-
-#ifndef FAR
-# define FAR
-#endif
-
-#if !defined(__MACTYPES__)
-typedef unsigned char Byte; /* 8 bits */
-#endif
-typedef unsigned int uInt; /* 16 bits or more */
-typedef unsigned long uLong; /* 32 bits or more */
-
-#ifdef SMALL_MEDIUM
- /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
-# define Bytef Byte FAR
-#else
- typedef Byte FAR Bytef;
-#endif
-typedef char FAR charf;
-typedef int FAR intf;
-typedef uInt FAR uIntf;
-typedef uLong FAR uLongf;
-
-#ifdef STDC
- typedef void const *voidpc;
- typedef void FAR *voidpf;
- typedef void *voidp;
-#else
- typedef Byte const *voidpc;
- typedef Byte FAR *voidpf;
- typedef Byte *voidp;
-#endif
-
-#if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC)
-# include <limits.h>
-# if (UINT_MAX == 0xffffffffUL)
-# define Z_U4 unsigned
-# elif (ULONG_MAX == 0xffffffffUL)
-# define Z_U4 unsigned long
-# elif (USHRT_MAX == 0xffffffffUL)
-# define Z_U4 unsigned short
-# endif
-#endif
-
-#ifdef Z_U4
- typedef Z_U4 z_crc_t;
-#else
- typedef unsigned long z_crc_t;
-#endif
-
-#if 0 /* Sunliang.Liu 20100908 sync the config to the old revision, otherwise, evc compile failed. */
-#ifdef HAVE_UNISTD_H /* may be set to #if 1 by ./configure */
-# define Z_HAVE_UNISTD_H
-#endif
-#endif /* 0 */
-
-#ifdef HAVE_STDARG_H /* may be set to #if 1 by ./configure */
-# define Z_HAVE_STDARG_H
-#endif
-
-#if 0 /* Sunliang.Liu 20100908 sync the config to the old revision, otherwise, evc compile failed. */
-#ifdef STDC
-# ifndef Z_SOLO
-# include <sys/types.h> /* for off_t */
-# endif
-#endif
-#endif /* 0 */
-
-#if defined(STDC) || defined(Z_HAVE_STDARG_H)
-# ifndef Z_SOLO
-# include <stdarg.h> /* for va_list */
-# endif
-#endif
-
-#ifdef _WIN32
-# ifndef Z_SOLO
-# include <stddef.h> /* for wchar_t */
-# endif
-#endif
-
-#if 0 /* Sunliang.Liu 20100908 sync the config to the old revision, otherwise, evc compile failed. */
-/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and
- * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even
- * though the former does not conform to the LFS document), but considering
- * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as
- * equivalently requesting no 64-bit operations
- */
-#if defined(_LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1
-# undef _LARGEFILE64_SOURCE
-#endif
-#endif /* 0 */
-
-#if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H)
-# define Z_HAVE_UNISTD_H
-#endif
-#ifndef Z_SOLO
-#if 0 /* Sunliang.Liu 20100908 sync the config to the old revision, otherwise, evc compile failed. */
-# if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE)
-# include <unistd.h> /* for SEEK_*, off_t, and _LFS64_LARGEFILE */
-# ifdef VMS
-# include <unixio.h> /* for off_t */
-# endif
-# ifndef z_off_t
-# define z_off_t off_t
-# endif
-# endif
-#endif /* 0 */
-#endif
-
-#if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0
-# define Z_LFS64
-#endif
-
-#if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64)
-# define Z_LARGE64
-#endif
-
-#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS-0 == 64 && defined(Z_LFS64)
-# define Z_WANT64
-#endif
-
-#if !defined(SEEK_SET) && !defined(Z_SOLO)
-# define SEEK_SET 0 /* Seek from beginning of file. */
-# define SEEK_CUR 1 /* Seek from current position. */
-# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
-#endif
-
-#ifndef z_off_t
-# define z_off_t long
-#endif
-
-#if !defined(_WIN32) && defined(Z_LARGE64)
-# define z_off64_t off64_t
-#else
-# if defined(_WIN32) && !defined(__GNUC__) && !defined(Z_SOLO)
-# define z_off64_t __int64
-# else
-# define z_off64_t z_off_t
-# endif
-#endif
-
-/* MVS linker does not support external names larger than 8 bytes */
-#if defined(__MVS__)
- #pragma map(deflateInit_,"DEIN")
- #pragma map(deflateInit2_,"DEIN2")
- #pragma map(deflateEnd,"DEEND")
- #pragma map(deflateBound,"DEBND")
- #pragma map(inflateInit_,"ININ")
- #pragma map(inflateInit2_,"ININ2")
- #pragma map(inflateEnd,"INEND")
- #pragma map(inflateSync,"INSY")
- #pragma map(inflateSetDictionary,"INSEDI")
- #pragma map(compressBound,"CMBND")
- #pragma map(inflate_table,"INTABL")
- #pragma map(inflate_fast,"INFA")
- #pragma map(inflate_copyright,"INCOPY")
-#endif
-
-#endif /* ZCONF_H */
diff --git a/chromium/third_party/pdfium/third_party/zlib_v128/zlib.h b/chromium/third_party/pdfium/third_party/zlib_v128/zlib.h
deleted file mode 100644
index 2d5812acf11..00000000000
--- a/chromium/third_party/pdfium/third_party/zlib_v128/zlib.h
+++ /dev/null
@@ -1,1839 +0,0 @@
-/* zlib.h -- interface of the 'zlib' general purpose compression library
- version 1.2.8, April 28th, 2013
-
- Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jean-loup Gailly Mark Adler
- jloup@gzip.org madler@alumni.caltech.edu
-
-
- The data format used by the zlib library is described by RFCs (Request for
- Comments) 1950 to 1952 in the files http://tools.ietf.org/html/rfc1950
- (zlib format), rfc1951 (deflate format) and rfc1952 (gzip format).
-*/
-
-#ifndef ZLIB_H
-#define ZLIB_H
-
-#ifdef _MSC_VER
-#define _CRT_SECURE_NO_WARNINGS
-#endif
-
-#define deflate_copyright FPDFAPI_deflate_copyright
-#define adler32 FPDFAPI_adler32
-#define compress2 FPDFAPI_compress2
-#define compress FPDFAPI_compress
-#define compressBound FPDFAPI_compressBound
-#define get_crc_table FPDFAPI_get_crc_table
-#define crc32 FPDFAPI_crc32
-#define deflateInit_ FPDFAPI_deflateInit_
-#define deflateInit2_ FPDFAPI_deflateInit2_
-#define deflateSetDictionary FPDFAPI_deflateSetDictionary
-#define deflateReset FPDFAPI_deflateReset
-#define deflatePending FPDFAPI_deflatePending
-#define deflatePrime FPDFAPI_deflatePrime
-#define deflateParams FPDFAPI_deflateParams
-#define deflateBound FPDFAPI_deflateBound
-#define deflateSetHeader FPDFAPI_deflateSetHeader
-#define deflateTune FPDFAPI_deflateTune
-#define deflate FPDFAPI_deflate
-#define deflateEnd FPDFAPI_deflateEnd
-#define deflateCopy FPDFAPI_deflateCopy
-#define inflateBackInit_ FPDFAPI_inflateBackInit_
-#define inflateBack FPDFAPI_inflateBack
-#define inflateBackEnd FPDFAPI_inflateBackEnd
-#define inflateReset FPDFAPI_inflateReset
-#define inflateInit2_ FPDFAPI_inflateInit2_
-#define inflateInit_ FPDFAPI_inflateInit_
-#define inflate FPDFAPI_inflate
-#define inflateEnd FPDFAPI_inflateEnd
-#define inflateSetDictionary FPDFAPI_inflateSetDictionary
-#define inflateSync FPDFAPI_inflateSync
-#define inflateSyncPoint FPDFAPI_inflateSyncPoint
-#define inflateCopy FPDFAPI_inflateCopy
-#define uncompress FPDFAPI_uncompress
-#define zlibVersion FPDFAPI_zlibVersion
-#define zlibCompileFlags FPDFAPI_zlibCompileFlags
-#define zError FPDFAPI_zError
-#define z_errmsg FPDFAPI_z_errmsg
-#define zcfree FPDFAPI_zcfree
-#define zcalloc FPDFAPI_zcalloc
-#define inflate_fast FPDFAPI_inflate_fast
-#define inflate_table FPDFAPI_inflate_table
-#define inflate_copyright FPDFAPI_inflate_copyright
-#define _length_code FPDFAPI_length_code
-#define _tr_flush_block FPDFAPI_tr_flush_block
-#define _dist_code FPDFAPI_dist_code
-#define _tr_stored_block FPDFAPI_tr_stored_block
-#define _tr_init FPDFAPI_tr_init
-#define _tr_align FPDFAPI_tr_align
-#define _tr_tally FPDFAPI_tr_tally
-#define _tr_flush_bits FPDFAPI_tr_flush_bits
-#define adler32_combine FPDFAPI_adler32_combine
-#define inflatePrime FPDFAPI_inflatePrime
-#define inflateGetDictionary FPDFAPI_inflateGetDictionary
-#define inflateGetHeader FPDFAPI_inflateGetHeader
-#define crc32_combine FPDFAPI_crc32_combine
-#define inflateReset2 FPDFAPI_inflateReset2
-#define inflateUndermine FPDFAPI_inflateUndermine
-#define inflateMark FPDFAPI_inflateMark
-#define adler32_combine64 FPDFAPI_adler32_combine64
-#define inflateResetKeep FPDFAPI_inflateResetKeep
-#define deflateResetKeep FPDFAPI_deflateResetKeep
-
-#include "zconf.h"
-
-/* Sunliang.Liu 20100908 sync the config to the old revision. NO_GZIP */
-#define NO_GZIP /* XYQ */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define ZLIB_VERSION "1.2.8"
-#define ZLIB_VERNUM 0x1280
-#define ZLIB_VER_MAJOR 1
-#define ZLIB_VER_MINOR 2
-#define ZLIB_VER_REVISION 8
-#define ZLIB_VER_SUBREVISION 0
-
-/*
- The 'zlib' compression library provides in-memory compression and
- decompression functions, including integrity checks of the uncompressed data.
- This version of the library supports only one compression method (deflation)
- but other algorithms will be added later and will have the same stream
- interface.
-
- Compression can be done in a single step if the buffers are large enough,
- or can be done by repeated calls of the compression function. In the latter
- case, the application must provide more input and/or consume the output
- (providing more output space) before each call.
-
- The compressed data format used by default by the in-memory functions is
- the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped
- around a deflate stream, which is itself documented in RFC 1951.
-
- The library also supports reading and writing files in gzip (.gz) format
- with an interface similar to that of stdio using the functions that start
- with "gz". The gzip format is different from the zlib format. gzip is a
- gzip wrapper, documented in RFC 1952, wrapped around a deflate stream.
-
- This library can optionally read and write gzip streams in memory as well.
-
- The zlib format was designed to be compact and fast for use in memory
- and on communications channels. The gzip format was designed for single-
- file compression on file systems, has a larger header than zlib to maintain
- directory information, and uses a different, slower check method than zlib.
-
- The library does not install any signal handler. The decoder checks
- the consistency of the compressed data, so the library should never crash
- even in case of corrupted input.
-*/
-
-typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size));
-typedef void (*free_func) OF((voidpf opaque, voidpf address));
-
-struct internal_state;
-
-typedef struct z_stream_s {
- z_const Bytef *next_in; /* next input byte */
- uInt avail_in; /* number of bytes available at next_in */
- uLong total_in; /* total number of input bytes read so far */
-
- Bytef *next_out; /* next output byte should be put there */
- uInt avail_out; /* remaining free space at next_out */
- uLong total_out; /* total number of bytes output so far */
-
- z_const char *msg; /* last error message, NULL if no error */
- struct internal_state FAR *state; /* not visible by applications */
-
- alloc_func zalloc; /* used to allocate the internal state */
- free_func zfree; /* used to free the internal state */
- voidpf opaque; /* private data object passed to zalloc and zfree */
-
- int data_type; /* best guess about the data type: binary or text */
- uLong adler; /* adler32 value of the uncompressed data */
- uLong reserved; /* reserved for future use */
-} z_stream;
-
-typedef z_stream FAR *z_streamp;
-
-/*
- gzip header information passed to and from zlib routines. See RFC 1952
- for more details on the meanings of these fields.
-*/
-typedef struct gz_header_s {
- int text; /* true if compressed data believed to be text */
- uLong time; /* modification time */
- int xflags; /* extra flags (not used when writing a gzip file) */
- int os; /* operating system */
- Bytef *extra; /* pointer to extra field or Z_NULL if none */
- uInt extra_len; /* extra field length (valid if extra != Z_NULL) */
- uInt extra_max; /* space at extra (only when reading header) */
- Bytef *name; /* pointer to zero-terminated file name or Z_NULL */
- uInt name_max; /* space at name (only when reading header) */
- Bytef *comment; /* pointer to zero-terminated comment or Z_NULL */
- uInt comm_max; /* space at comment (only when reading header) */
- int hcrc; /* true if there was or will be a header crc */
- int done; /* true when done reading gzip header (not used
- when writing a gzip file) */
-} gz_header;
-
-typedef gz_header FAR *gz_headerp;
-
-/*
- The application must update next_in and avail_in when avail_in has dropped
- to zero. It must update next_out and avail_out when avail_out has dropped
- to zero. The application must initialize zalloc, zfree and opaque before
- calling the init function. All other fields are set by the compression
- library and must not be updated by the application.
-
- The opaque value provided by the application will be passed as the first
- parameter for calls of zalloc and zfree. This can be useful for custom
- memory management. The compression library attaches no meaning to the
- opaque value.
-
- zalloc must return Z_NULL if there is not enough memory for the object.
- If zlib is used in a multi-threaded application, zalloc and zfree must be
- thread safe.
-
- On 16-bit systems, the functions zalloc and zfree must be able to allocate
- exactly 65536 bytes, but will not be required to allocate more than this if
- the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, pointers
- returned by zalloc for objects of exactly 65536 bytes *must* have their
- offset normalized to zero. The default allocation function provided by this
- library ensures this (see zutil.c). To reduce memory requirements and avoid
- any allocation of 64K objects, at the expense of compression ratio, compile
- the library with -DMAX_WBITS=14 (see zconf.h).
-
- The fields total_in and total_out can be used for statistics or progress
- reports. After compression, total_in holds the total size of the
- uncompressed data and may be saved for use in the decompressor (particularly
- if the decompressor wants to decompress everything in a single step).
-*/
-
- /* constants */
-
-#define Z_NO_FLUSH 0
-#define Z_PARTIAL_FLUSH 1
-#define Z_SYNC_FLUSH 2
-#define Z_FULL_FLUSH 3
-#define Z_FINISH 4
-#define Z_BLOCK 5
-#define Z_TREES 6
-/* Allowed flush values; see deflate() and inflate() below for details */
-
-#define Z_OK 0
-#define Z_STREAM_END 1
-#define Z_NEED_DICT 2
-#define Z_ERRNO (-1)
-#define Z_STREAM_ERROR (-2)
-#define Z_DATA_ERROR (-3)
-#define Z_MEM_ERROR (-4)
-#define Z_BUF_ERROR (-5)
-#define Z_VERSION_ERROR (-6)
-/* Return codes for the compression/decompression functions. Negative values
- * are errors, positive values are used for special but normal events.
- */
-
-#define Z_NO_COMPRESSION 0
-#define Z_BEST_SPEED 1
-#define Z_BEST_COMPRESSION 9
-#define Z_DEFAULT_COMPRESSION (-1)
-/* compression levels */
-
-#define Z_FILTERED 1
-#define Z_HUFFMAN_ONLY 2
-#define Z_RLE 3
-#define Z_FIXED 4
-#define Z_DEFAULT_STRATEGY 0
-/* compression strategy; see deflateInit2() below for details */
-
-#define Z_BINARY 0
-#define Z_TEXT 1
-#define Z_ASCII Z_TEXT /* for compatibility with 1.2.2 and earlier */
-#define Z_UNKNOWN 2
-/* Possible values of the data_type field (though see inflate()) */
-
-#define Z_DEFLATED 8
-/* The deflate compression method (the only one supported in this version) */
-
-#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */
-
-#define zlib_version zlibVersion()
-/* for compatibility with versions < 1.0.2 */
-
-
- /* basic functions */
-
-ZEXTERN const char * ZEXPORT zlibVersion OF((void));
-/* The application can compare zlibVersion and ZLIB_VERSION for consistency.
- If the first character differs, the library code actually used is not
- compatible with the zlib.h header file used by the application. This check
- is automatically made by deflateInit and inflateInit.
- */
-
-/*
-ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level));
-
- Initializes the internal stream state for compression. The fields
- zalloc, zfree and opaque must be initialized before by the caller. If
- zalloc and zfree are set to Z_NULL, deflateInit updates them to use default
- allocation functions.
-
- The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9:
- 1 gives best speed, 9 gives best compression, 0 gives no compression at all
- (the input data is simply copied a block at a time). Z_DEFAULT_COMPRESSION
- requests a default compromise between speed and compression (currently
- equivalent to level 6).
-
- deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough
- memory, Z_STREAM_ERROR if level is not a valid compression level, or
- Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible
- with the version assumed by the caller (ZLIB_VERSION). msg is set to null
- if there is no error message. deflateInit does not perform any compression:
- this will be done by deflate().
-*/
-
-
-ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
-/*
- deflate compresses as much data as possible, and stops when the input
- buffer becomes empty or the output buffer becomes full. It may introduce
- some output latency (reading input without producing any output) except when
- forced to flush.
-
- The detailed semantics are as follows. deflate performs one or both of the
- following actions:
-
- - Compress more input starting at next_in and update next_in and avail_in
- accordingly. If not all input can be processed (because there is not
- enough room in the output buffer), next_in and avail_in are updated and
- processing will resume at this point for the next call of deflate().
-
- - Provide more output starting at next_out and update next_out and avail_out
- accordingly. This action is forced if the parameter flush is non zero.
- Forcing flush frequently degrades the compression ratio, so this parameter
- should be set only when necessary (in interactive applications). Some
- output may be provided even if flush is not set.
-
- Before the call of deflate(), the application should ensure that at least
- one of the actions is possible, by providing more input and/or consuming more
- output, and updating avail_in or avail_out accordingly; avail_out should
- never be zero before the call. The application can consume the compressed
- output when it wants, for example when the output buffer is full (avail_out
- == 0), or after each call of deflate(). If deflate returns Z_OK and with
- zero avail_out, it must be called again after making room in the output
- buffer because there might be more output pending.
-
- Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to
- decide how much data to accumulate before producing output, in order to
- maximize compression.
-
- If the parameter flush is set to Z_SYNC_FLUSH, all pending output is
- flushed to the output buffer and the output is aligned on a byte boundary, so
- that the decompressor can get all input data available so far. (In
- particular avail_in is zero after the call if enough output space has been
- provided before the call.) Flushing may degrade compression for some
- compression algorithms and so it should be used only when necessary. This
- completes the current deflate block and follows it with an empty stored block
- that is three bits plus filler bits to the next byte, followed by four bytes
- (00 00 ff ff).
-
- If flush is set to Z_PARTIAL_FLUSH, all pending output is flushed to the
- output buffer, but the output is not aligned to a byte boundary. All of the
- input data so far will be available to the decompressor, as for Z_SYNC_FLUSH.
- This completes the current deflate block and follows it with an empty fixed
- codes block that is 10 bits long. This assures that enough bytes are output
- in order for the decompressor to finish the block before the empty fixed code
- block.
-
- If flush is set to Z_BLOCK, a deflate block is completed and emitted, as
- for Z_SYNC_FLUSH, but the output is not aligned on a byte boundary, and up to
- seven bits of the current block are held to be written as the next byte after
- the next deflate block is completed. In this case, the decompressor may not
- be provided enough bits at this point in order to complete decompression of
- the data provided so far to the compressor. It may need to wait for the next
- block to be emitted. This is for advanced applications that need to control
- the emission of deflate blocks.
-
- If flush is set to Z_FULL_FLUSH, all output is flushed as with
- Z_SYNC_FLUSH, and the compression state is reset so that decompression can
- restart from this point if previous compressed data has been damaged or if
- random access is desired. Using Z_FULL_FLUSH too often can seriously degrade
- compression.
-
- If deflate returns with avail_out == 0, this function must be called again
- with the same value of the flush parameter and more output space (updated
- avail_out), until the flush is complete (deflate returns with non-zero
- avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that
- avail_out is greater than six to avoid repeated flush markers due to
- avail_out == 0 on return.
-
- If the parameter flush is set to Z_FINISH, pending input is processed,
- pending output is flushed and deflate returns with Z_STREAM_END if there was
- enough output space; if deflate returns with Z_OK, this function must be
- called again with Z_FINISH and more output space (updated avail_out) but no
- more input data, until it returns with Z_STREAM_END or an error. After
- deflate has returned Z_STREAM_END, the only possible operations on the stream
- are deflateReset or deflateEnd.
-
- Z_FINISH can be used immediately after deflateInit if all the compression
- is to be done in a single step. In this case, avail_out must be at least the
- value returned by deflateBound (see below). Then deflate is guaranteed to
- return Z_STREAM_END. If not enough output space is provided, deflate will
- not return Z_STREAM_END, and it must be called again as described above.
-
- deflate() sets strm->adler to the adler32 checksum of all input read
- so far (that is, total_in bytes).
-
- deflate() may update strm->data_type if it can make a good guess about
- the input data type (Z_BINARY or Z_TEXT). In doubt, the data is considered
- binary. This field is only for information purposes and does not affect the
- compression algorithm in any manner.
-
- deflate() returns Z_OK if some progress has been made (more input
- processed or more output produced), Z_STREAM_END if all input has been
- consumed and all output has been produced (only when flush is set to
- Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example
- if next_in or next_out was Z_NULL), Z_BUF_ERROR if no progress is possible
- (for example avail_in or avail_out was zero). Note that Z_BUF_ERROR is not
- fatal, and deflate() can be called again with more input and more output
- space to continue compressing.
-*/
-
-
-ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm));
-/*
- All dynamically allocated data structures for this stream are freed.
- This function discards any unprocessed input and does not flush any pending
- output.
-
- deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the
- stream state was inconsistent, Z_DATA_ERROR if the stream was freed
- prematurely (some input or output was discarded). In the error case, msg
- may be set but then points to a static string (which must not be
- deallocated).
-*/
-
-
-/*
-ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm));
-
- Initializes the internal stream state for decompression. The fields
- next_in, avail_in, zalloc, zfree and opaque must be initialized before by
- the caller. If next_in is not Z_NULL and avail_in is large enough (the
- exact value depends on the compression method), inflateInit determines the
- compression method from the zlib header and allocates all data structures
- accordingly; otherwise the allocation will be deferred to the first call of
- inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates them to
- use default allocation functions.
-
- inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough
- memory, Z_VERSION_ERROR if the zlib library version is incompatible with the
- version assumed by the caller, or Z_STREAM_ERROR if the parameters are
- invalid, such as a null pointer to the structure. msg is set to null if
- there is no error message. inflateInit does not perform any decompression
- apart from possibly reading the zlib header if present: actual decompression
- will be done by inflate(). (So next_in and avail_in may be modified, but
- next_out and avail_out are unused and unchanged.) The current implementation
- of inflateInit() does not process any header information -- that is deferred
- until inflate() is called.
-*/
-
-
-ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush));
-/*
- inflate decompresses as much data as possible, and stops when the input
- buffer becomes empty or the output buffer becomes full. It may introduce
- some output latency (reading input without producing any output) except when
- forced to flush.
-
- The detailed semantics are as follows. inflate performs one or both of the
- following actions:
-
- - Decompress more input starting at next_in and update next_in and avail_in
- accordingly. If not all input can be processed (because there is not
- enough room in the output buffer), next_in is updated and processing will
- resume at this point for the next call of inflate().
-
- - Provide more output starting at next_out and update next_out and avail_out
- accordingly. inflate() provides as much output as possible, until there is
- no more input data or no more space in the output buffer (see below about
- the flush parameter).
-
- Before the call of inflate(), the application should ensure that at least
- one of the actions is possible, by providing more input and/or consuming more
- output, and updating the next_* and avail_* values accordingly. The
- application can consume the uncompressed output when it wants, for example
- when the output buffer is full (avail_out == 0), or after each call of
- inflate(). If inflate returns Z_OK and with zero avail_out, it must be
- called again after making room in the output buffer because there might be
- more output pending.
-
- The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH, Z_FINISH,
- Z_BLOCK, or Z_TREES. Z_SYNC_FLUSH requests that inflate() flush as much
- output as possible to the output buffer. Z_BLOCK requests that inflate()
- stop if and when it gets to the next deflate block boundary. When decoding
- the zlib or gzip format, this will cause inflate() to return immediately
- after the header and before the first block. When doing a raw inflate,
- inflate() will go ahead and process the first block, and will return when it
- gets to the end of that block, or when it runs out of data.
-
- The Z_BLOCK option assists in appending to or combining deflate streams.
- Also to assist in this, on return inflate() will set strm->data_type to the
- number of unused bits in the last byte taken from strm->next_in, plus 64 if
- inflate() is currently decoding the last block in the deflate stream, plus
- 128 if inflate() returned immediately after decoding an end-of-block code or
- decoding the complete header up to just before the first byte of the deflate
- stream. The end-of-block will not be indicated until all of the uncompressed
- data from that block has been written to strm->next_out. The number of
- unused bits may in general be greater than seven, except when bit 7 of
- data_type is set, in which case the number of unused bits will be less than
- eight. data_type is set as noted here every time inflate() returns for all
- flush options, and so can be used to determine the amount of currently
- consumed input in bits.
-
- The Z_TREES option behaves as Z_BLOCK does, but it also returns when the
- end of each deflate block header is reached, before any actual data in that
- block is decoded. This allows the caller to determine the length of the
- deflate block header for later use in random access within a deflate block.
- 256 is added to the value of strm->data_type when inflate() returns
- immediately after reaching the end of the deflate block header.
-
- inflate() should normally be called until it returns Z_STREAM_END or an
- error. However if all decompression is to be performed in a single step (a
- single call of inflate), the parameter flush should be set to Z_FINISH. In
- this case all pending input is processed and all pending output is flushed;
- avail_out must be large enough to hold all of the uncompressed data for the
- operation to complete. (The size of the uncompressed data may have been
- saved by the compressor for this purpose.) The use of Z_FINISH is not
- required to perform an inflation in one step. However it may be used to
- inform inflate that a faster approach can be used for the single inflate()
- call. Z_FINISH also informs inflate to not maintain a sliding window if the
- stream completes, which reduces inflate's memory footprint. If the stream
- does not complete, either because not all of the stream is provided or not
- enough output space is provided, then a sliding window will be allocated and
- inflate() can be called again to continue the operation as if Z_NO_FLUSH had
- been used.
-
- In this implementation, inflate() always flushes as much output as
- possible to the output buffer, and always uses the faster approach on the
- first call. So the effects of the flush parameter in this implementation are
- on the return value of inflate() as noted below, when inflate() returns early
- when Z_BLOCK or Z_TREES is used, and when inflate() avoids the allocation of
- memory for a sliding window when Z_FINISH is used.
-
- If a preset dictionary is needed after this call (see inflateSetDictionary
- below), inflate sets strm->adler to the Adler-32 checksum of the dictionary
- chosen by the compressor and returns Z_NEED_DICT; otherwise it sets
- strm->adler to the Adler-32 checksum of all output produced so far (that is,
- total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described
- below. At the end of the stream, inflate() checks that its computed adler32
- checksum is equal to that saved by the compressor and returns Z_STREAM_END
- only if the checksum is correct.
-
- inflate() can decompress and check either zlib-wrapped or gzip-wrapped
- deflate data. The header type is detected automatically, if requested when
- initializing with inflateInit2(). Any information contained in the gzip
- header is not retained, so applications that need that information should
- instead use raw inflate, see inflateInit2() below, or inflateBack() and
- perform their own processing of the gzip header and trailer. When processing
- gzip-wrapped deflate data, strm->adler32 is set to the CRC-32 of the output
- producted so far. The CRC-32 is checked against the gzip trailer.
-
- inflate() returns Z_OK if some progress has been made (more input processed
- or more output produced), Z_STREAM_END if the end of the compressed data has
- been reached and all uncompressed output has been produced, Z_NEED_DICT if a
- preset dictionary is needed at this point, Z_DATA_ERROR if the input data was
- corrupted (input stream not conforming to the zlib format or incorrect check
- value), Z_STREAM_ERROR if the stream structure was inconsistent (for example
- next_in or next_out was Z_NULL), Z_MEM_ERROR if there was not enough memory,
- Z_BUF_ERROR if no progress is possible or if there was not enough room in the
- output buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and
- inflate() can be called again with more input and more output space to
- continue decompressing. If Z_DATA_ERROR is returned, the application may
- then call inflateSync() to look for a good compression block if a partial
- recovery of the data is desired.
-*/
-
-
-ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm));
-/*
- All dynamically allocated data structures for this stream are freed.
- This function discards any unprocessed input and does not flush any pending
- output.
-
- inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state
- was inconsistent. In the error case, msg may be set but then points to a
- static string (which must not be deallocated).
-*/
-
-
- /* Advanced functions */
-
-/*
- The following functions are needed only in some special applications.
-*/
-
-/*
-ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm,
- int level,
- int method,
- int windowBits,
- int memLevel,
- int strategy));
-
- This is another version of deflateInit with more compression options. The
- fields next_in, zalloc, zfree and opaque must be initialized before by the
- caller.
-
- The method parameter is the compression method. It must be Z_DEFLATED in
- this version of the library.
-
- The windowBits parameter is the base two logarithm of the window size
- (the size of the history buffer). It should be in the range 8..15 for this
- version of the library. Larger values of this parameter result in better
- compression at the expense of memory usage. The default value is 15 if
- deflateInit is used instead.
-
- windowBits can also be -8..-15 for raw deflate. In this case, -windowBits
- determines the window size. deflate() will then generate raw deflate data
- with no zlib header or trailer, and will not compute an adler32 check value.
-
- windowBits can also be greater than 15 for optional gzip encoding. Add
- 16 to windowBits to write a simple gzip header and trailer around the
- compressed data instead of a zlib wrapper. The gzip header will have no
- file name, no extra data, no comment, no modification time (set to zero), no
- header crc, and the operating system will be set to 255 (unknown). If a
- gzip stream is being written, strm->adler is a crc32 instead of an adler32.
-
- The memLevel parameter specifies how much memory should be allocated
- for the internal compression state. memLevel=1 uses minimum memory but is
- slow and reduces compression ratio; memLevel=9 uses maximum memory for
- optimal speed. The default value is 8. See zconf.h for total memory usage
- as a function of windowBits and memLevel.
-
- The strategy parameter is used to tune the compression algorithm. Use the
- value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a
- filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no
- string match), or Z_RLE to limit match distances to one (run-length
- encoding). Filtered data consists mostly of small values with a somewhat
- random distribution. In this case, the compression algorithm is tuned to
- compress them better. The effect of Z_FILTERED is to force more Huffman
- coding and less string matching; it is somewhat intermediate between
- Z_DEFAULT_STRATEGY and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as
- fast as Z_HUFFMAN_ONLY, but give better compression for PNG image data. The
- strategy parameter only affects the compression ratio but not the
- correctness of the compressed output even if it is not set appropriately.
- Z_FIXED prevents the use of dynamic Huffman codes, allowing for a simpler
- decoder for special applications.
-
- deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
- memory, Z_STREAM_ERROR if any parameter is invalid (such as an invalid
- method), or Z_VERSION_ERROR if the zlib library version (zlib_version) is
- incompatible with the version assumed by the caller (ZLIB_VERSION). msg is
- set to null if there is no error message. deflateInit2 does not perform any
- compression: this will be done by deflate().
-*/
-
-ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm,
- const Bytef *dictionary,
- uInt dictLength));
-/*
- Initializes the compression dictionary from the given byte sequence
- without producing any compressed output. When using the zlib format, this
- function must be called immediately after deflateInit, deflateInit2 or
- deflateReset, and before any call of deflate. When doing raw deflate, this
- function must be called either before any call of deflate, or immediately
- after the completion of a deflate block, i.e. after all input has been
- consumed and all output has been delivered when using any of the flush
- options Z_BLOCK, Z_PARTIAL_FLUSH, Z_SYNC_FLUSH, or Z_FULL_FLUSH. The
- compressor and decompressor must use exactly the same dictionary (see
- inflateSetDictionary).
-
- The dictionary should consist of strings (byte sequences) that are likely
- to be encountered later in the data to be compressed, with the most commonly
- used strings preferably put towards the end of the dictionary. Using a
- dictionary is most useful when the data to be compressed is short and can be
- predicted with good accuracy; the data can then be compressed better than
- with the default empty dictionary.
-
- Depending on the size of the compression data structures selected by
- deflateInit or deflateInit2, a part of the dictionary may in effect be
- discarded, for example if the dictionary is larger than the window size
- provided in deflateInit or deflateInit2. Thus the strings most likely to be
- useful should be put at the end of the dictionary, not at the front. In
- addition, the current implementation of deflate will use at most the window
- size minus 262 bytes of the provided dictionary.
-
- Upon return of this function, strm->adler is set to the adler32 value
- of the dictionary; the decompressor may later use this value to determine
- which dictionary has been used by the compressor. (The adler32 value
- applies to the whole dictionary even if only a subset of the dictionary is
- actually used by the compressor.) If a raw deflate was requested, then the
- adler32 value is not computed and strm->adler is not set.
-
- deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a
- parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is
- inconsistent (for example if deflate has already been called for this stream
- or if not at a block boundary for raw deflate). deflateSetDictionary does
- not perform any compression: this will be done by deflate().
-*/
-
-ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest,
- z_streamp source));
-/*
- Sets the destination stream as a complete copy of the source stream.
-
- This function can be useful when several compression strategies will be
- tried, for example when there are several ways of pre-processing the input
- data with a filter. The streams that will be discarded should then be freed
- by calling deflateEnd. Note that deflateCopy duplicates the internal
- compression state which can be quite large, so this strategy is slow and can
- consume lots of memory.
-
- deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
- enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
- (such as zalloc being Z_NULL). msg is left unchanged in both source and
- destination.
-*/
-
-ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm));
-/*
- This function is equivalent to deflateEnd followed by deflateInit,
- but does not free and reallocate all the internal compression state. The
- stream will keep the same compression level and any other attributes that
- may have been set by deflateInit2.
-
- deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
- stream state was inconsistent (such as zalloc or state being Z_NULL).
-*/
-
-ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,
- int level,
- int strategy));
-/*
- Dynamically update the compression level and compression strategy. The
- interpretation of level and strategy is as in deflateInit2. This can be
- used to switch between compression and straight copy of the input data, or
- to switch to a different kind of input data requiring a different strategy.
- If the compression level is changed, the input available so far is
- compressed with the old level (and may be flushed); the new level will take
- effect only at the next call of deflate().
-
- Before the call of deflateParams, the stream state must be set as for
- a call of deflate(), since the currently available input may have to be
- compressed and flushed. In particular, strm->avail_out must be non-zero.
-
- deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source
- stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR if
- strm->avail_out was zero.
-*/
-
-ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm,
- int good_length,
- int max_lazy,
- int nice_length,
- int max_chain));
-/*
- Fine tune deflate's internal compression parameters. This should only be
- used by someone who understands the algorithm used by zlib's deflate for
- searching for the best matching string, and even then only by the most
- fanatic optimizer trying to squeeze out the last compressed bit for their
- specific input data. Read the deflate.c source code for the meaning of the
- max_lazy, good_length, nice_length, and max_chain parameters.
-
- deflateTune() can be called after deflateInit() or deflateInit2(), and
- returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream.
- */
-
-ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm,
- uLong sourceLen));
-/*
- deflateBound() returns an upper bound on the compressed size after
- deflation of sourceLen bytes. It must be called after deflateInit() or
- deflateInit2(), and after deflateSetHeader(), if used. This would be used
- to allocate an output buffer for deflation in a single pass, and so would be
- called before deflate(). If that first deflate() call is provided the
- sourceLen input bytes, an output buffer allocated to the size returned by
- deflateBound(), and the flush value Z_FINISH, then deflate() is guaranteed
- to return Z_STREAM_END. Note that it is possible for the compressed size to
- be larger than the value returned by deflateBound() if flush options other
- than Z_FINISH or Z_NO_FLUSH are used.
-*/
-
-ZEXTERN int ZEXPORT deflatePending OF((z_streamp strm,
- unsigned *pending,
- int *bits));
-/*
- deflatePending() returns the number of bytes and bits of output that have
- been generated, but not yet provided in the available output. The bytes not
- provided would be due to the available output space having being consumed.
- The number of bits of output not provided are between 0 and 7, where they
- await more bits to join them in order to fill out a full byte. If pending
- or bits are Z_NULL, then those values are not set.
-
- deflatePending returns Z_OK if success, or Z_STREAM_ERROR if the source
- stream state was inconsistent.
- */
-
-ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm,
- int bits,
- int value));
-/*
- deflatePrime() inserts bits in the deflate output stream. The intent
- is that this function is used to start off the deflate output with the bits
- leftover from a previous deflate stream when appending to it. As such, this
- function can only be used for raw deflate, and must be used before the first
- deflate() call after a deflateInit2() or deflateReset(). bits must be less
- than or equal to 16, and that many of the least significant bits of value
- will be inserted in the output.
-
- deflatePrime returns Z_OK if success, Z_BUF_ERROR if there was not enough
- room in the internal buffer to insert the bits, or Z_STREAM_ERROR if the
- source stream state was inconsistent.
-*/
-
-ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm,
- gz_headerp head));
-/*
- deflateSetHeader() provides gzip header information for when a gzip
- stream is requested by deflateInit2(). deflateSetHeader() may be called
- after deflateInit2() or deflateReset() and before the first call of
- deflate(). The text, time, os, extra field, name, and comment information
- in the provided gz_header structure are written to the gzip header (xflag is
- ignored -- the extra flags are set according to the compression level). The
- caller must assure that, if not Z_NULL, name and comment are terminated with
- a zero byte, and that if extra is not Z_NULL, that extra_len bytes are
- available there. If hcrc is true, a gzip header crc is included. Note that
- the current versions of the command-line version of gzip (up through version
- 1.3.x) do not support header crc's, and will report that it is a "multi-part
- gzip file" and give up.
-
- If deflateSetHeader is not used, the default gzip header has text false,
- the time set to zero, and os set to 255, with no extra, name, or comment
- fields. The gzip header is returned to the default state by deflateReset().
-
- deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source
- stream state was inconsistent.
-*/
-
-/*
-ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm,
- int windowBits));
-
- This is another version of inflateInit with an extra parameter. The
- fields next_in, avail_in, zalloc, zfree and opaque must be initialized
- before by the caller.
-
- The windowBits parameter is the base two logarithm of the maximum window
- size (the size of the history buffer). It should be in the range 8..15 for
- this version of the library. The default value is 15 if inflateInit is used
- instead. windowBits must be greater than or equal to the windowBits value
- provided to deflateInit2() while compressing, or it must be equal to 15 if
- deflateInit2() was not used. If a compressed stream with a larger window
- size is given as input, inflate() will return with the error code
- Z_DATA_ERROR instead of trying to allocate a larger window.
-
- windowBits can also be zero to request that inflate use the window size in
- the zlib header of the compressed stream.
-
- windowBits can also be -8..-15 for raw inflate. In this case, -windowBits
- determines the window size. inflate() will then process raw deflate data,
- not looking for a zlib or gzip header, not generating a check value, and not
- looking for any check values for comparison at the end of the stream. This
- is for use with other formats that use the deflate compressed data format
- such as zip. Those formats provide their own check values. If a custom
- format is developed using the raw deflate format for compressed data, it is
- recommended that a check value such as an adler32 or a crc32 be applied to
- the uncompressed data as is done in the zlib, gzip, and zip formats. For
- most applications, the zlib format should be used as is. Note that comments
- above on the use in deflateInit2() applies to the magnitude of windowBits.
-
- windowBits can also be greater than 15 for optional gzip decoding. Add
- 32 to windowBits to enable zlib and gzip decoding with automatic header
- detection, or add 16 to decode only the gzip format (the zlib format will
- return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is a
- crc32 instead of an adler32.
-
- inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
- memory, Z_VERSION_ERROR if the zlib library version is incompatible with the
- version assumed by the caller, or Z_STREAM_ERROR if the parameters are
- invalid, such as a null pointer to the structure. msg is set to null if
- there is no error message. inflateInit2 does not perform any decompression
- apart from possibly reading the zlib header if present: actual decompression
- will be done by inflate(). (So next_in and avail_in may be modified, but
- next_out and avail_out are unused and unchanged.) The current implementation
- of inflateInit2() does not process any header information -- that is
- deferred until inflate() is called.
-*/
-
-ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,
- const Bytef *dictionary,
- uInt dictLength));
-/*
- Initializes the decompression dictionary from the given uncompressed byte
- sequence. This function must be called immediately after a call of inflate,
- if that call returned Z_NEED_DICT. The dictionary chosen by the compressor
- can be determined from the adler32 value returned by that call of inflate.
- The compressor and decompressor must use exactly the same dictionary (see
- deflateSetDictionary). For raw inflate, this function can be called at any
- time to set the dictionary. If the provided dictionary is smaller than the
- window and there is already data in the window, then the provided dictionary
- will amend what's there. The application must insure that the dictionary
- that was used for compression is provided.
-
- inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a
- parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is
- inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the
- expected one (incorrect adler32 value). inflateSetDictionary does not
- perform any decompression: this will be done by subsequent calls of
- inflate().
-*/
-
-ZEXTERN int ZEXPORT inflateGetDictionary OF((z_streamp strm,
- Bytef *dictionary,
- uInt *dictLength));
-/*
- Returns the sliding dictionary being maintained by inflate. dictLength is
- set to the number of bytes in the dictionary, and that many bytes are copied
- to dictionary. dictionary must have enough space, where 32768 bytes is
- always enough. If inflateGetDictionary() is called with dictionary equal to
- Z_NULL, then only the dictionary length is returned, and nothing is copied.
- Similary, if dictLength is Z_NULL, then it is not set.
-
- inflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the
- stream state is inconsistent.
-*/
-
-ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm));
-/*
- Skips invalid compressed data until a possible full flush point (see above
- for the description of deflate with Z_FULL_FLUSH) can be found, or until all
- available input is skipped. No output is provided.
-
- inflateSync searches for a 00 00 FF FF pattern in the compressed data.
- All full flush points have this pattern, but not all occurrences of this
- pattern are full flush points.
-
- inflateSync returns Z_OK if a possible full flush point has been found,
- Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush point
- has been found, or Z_STREAM_ERROR if the stream structure was inconsistent.
- In the success case, the application may save the current current value of
- total_in which indicates where valid compressed data was found. In the
- error case, the application may repeatedly call inflateSync, providing more
- input each time, until success or end of the input data.
-*/
-
-ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest,
- z_streamp source));
-/*
- Sets the destination stream as a complete copy of the source stream.
-
- This function can be useful when randomly accessing a large stream. The
- first pass through the stream can periodically record the inflate state,
- allowing restarting inflate at those points when randomly accessing the
- stream.
-
- inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
- enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
- (such as zalloc being Z_NULL). msg is left unchanged in both source and
- destination.
-*/
-
-ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm));
-/*
- This function is equivalent to inflateEnd followed by inflateInit,
- but does not free and reallocate all the internal decompression state. The
- stream will keep attributes that may have been set by inflateInit2.
-
- inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
- stream state was inconsistent (such as zalloc or state being Z_NULL).
-*/
-
-ZEXTERN int ZEXPORT inflateReset2 OF((z_streamp strm,
- int windowBits));
-/*
- This function is the same as inflateReset, but it also permits changing
- the wrap and window size requests. The windowBits parameter is interpreted
- the same as it is for inflateInit2.
-
- inflateReset2 returns Z_OK if success, or Z_STREAM_ERROR if the source
- stream state was inconsistent (such as zalloc or state being Z_NULL), or if
- the windowBits parameter is invalid.
-*/
-
-ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm,
- int bits,
- int value));
-/*
- This function inserts bits in the inflate input stream. The intent is
- that this function is used to start inflating at a bit position in the
- middle of a byte. The provided bits will be used before any bytes are used
- from next_in. This function should only be used with raw inflate, and
- should be used before the first inflate() call after inflateInit2() or
- inflateReset(). bits must be less than or equal to 16, and that many of the
- least significant bits of value will be inserted in the input.
-
- If bits is negative, then the input stream bit buffer is emptied. Then
- inflatePrime() can be called again to put bits in the buffer. This is used
- to clear out bits leftover after feeding inflate a block description prior
- to feeding inflate codes.
-
- inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source
- stream state was inconsistent.
-*/
-
-ZEXTERN long ZEXPORT inflateMark OF((z_streamp strm));
-/*
- This function returns two values, one in the lower 16 bits of the return
- value, and the other in the remaining upper bits, obtained by shifting the
- return value down 16 bits. If the upper value is -1 and the lower value is
- zero, then inflate() is currently decoding information outside of a block.
- If the upper value is -1 and the lower value is non-zero, then inflate is in
- the middle of a stored block, with the lower value equaling the number of
- bytes from the input remaining to copy. If the upper value is not -1, then
- it is the number of bits back from the current bit position in the input of
- the code (literal or length/distance pair) currently being processed. In
- that case the lower value is the number of bytes already emitted for that
- code.
-
- A code is being processed if inflate is waiting for more input to complete
- decoding of the code, or if it has completed decoding but is waiting for
- more output space to write the literal or match data.
-
- inflateMark() is used to mark locations in the input data for random
- access, which may be at bit positions, and to note those cases where the
- output of a code may span boundaries of random access blocks. The current
- location in the input stream can be determined from avail_in and data_type
- as noted in the description for the Z_BLOCK flush parameter for inflate.
-
- inflateMark returns the value noted above or -1 << 16 if the provided
- source stream state was inconsistent.
-*/
-
-ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm,
- gz_headerp head));
-/*
- inflateGetHeader() requests that gzip header information be stored in the
- provided gz_header structure. inflateGetHeader() may be called after
- inflateInit2() or inflateReset(), and before the first call of inflate().
- As inflate() processes the gzip stream, head->done is zero until the header
- is completed, at which time head->done is set to one. If a zlib stream is
- being decoded, then head->done is set to -1 to indicate that there will be
- no gzip header information forthcoming. Note that Z_BLOCK or Z_TREES can be
- used to force inflate() to return immediately after header processing is
- complete and before any actual data is decompressed.
-
- The text, time, xflags, and os fields are filled in with the gzip header
- contents. hcrc is set to true if there is a header CRC. (The header CRC
- was valid if done is set to one.) If extra is not Z_NULL, then extra_max
- contains the maximum number of bytes to write to extra. Once done is true,
- extra_len contains the actual extra field length, and extra contains the
- extra field, or that field truncated if extra_max is less than extra_len.
- If name is not Z_NULL, then up to name_max characters are written there,
- terminated with a zero unless the length is greater than name_max. If
- comment is not Z_NULL, then up to comm_max characters are written there,
- terminated with a zero unless the length is greater than comm_max. When any
- of extra, name, or comment are not Z_NULL and the respective field is not
- present in the header, then that field is set to Z_NULL to signal its
- absence. This allows the use of deflateSetHeader() with the returned
- structure to duplicate the header. However if those fields are set to
- allocated memory, then the application will need to save those pointers
- elsewhere so that they can be eventually freed.
-
- If inflateGetHeader is not used, then the header information is simply
- discarded. The header is always checked for validity, including the header
- CRC if present. inflateReset() will reset the process to discard the header
- information. The application would need to call inflateGetHeader() again to
- retrieve the header from the next gzip stream.
-
- inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source
- stream state was inconsistent.
-*/
-
-/*
-ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits,
- unsigned char FAR *window));
-
- Initialize the internal stream state for decompression using inflateBack()
- calls. The fields zalloc, zfree and opaque in strm must be initialized
- before the call. If zalloc and zfree are Z_NULL, then the default library-
- derived memory allocation routines are used. windowBits is the base two
- logarithm of the window size, in the range 8..15. window is a caller
- supplied buffer of that size. Except for special applications where it is
- assured that deflate was used with small window sizes, windowBits must be 15
- and a 32K byte window must be supplied to be able to decompress general
- deflate streams.
-
- See inflateBack() for the usage of these routines.
-
- inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of
- the parameters are invalid, Z_MEM_ERROR if the internal state could not be
- allocated, or Z_VERSION_ERROR if the version of the library does not match
- the version of the header file.
-*/
-
-typedef unsigned (*in_func) OF((void FAR *,
- z_const unsigned char FAR * FAR *));
-typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned));
-
-ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm,
- in_func in, void FAR *in_desc,
- out_func out, void FAR *out_desc));
-/*
- inflateBack() does a raw inflate with a single call using a call-back
- interface for input and output. This is potentially more efficient than
- inflate() for file i/o applications, in that it avoids copying between the
- output and the sliding window by simply making the window itself the output
- buffer. inflate() can be faster on modern CPUs when used with large
- buffers. inflateBack() trusts the application to not change the output
- buffer passed by the output function, at least until inflateBack() returns.
-
- inflateBackInit() must be called first to allocate the internal state
- and to initialize the state with the user-provided window buffer.
- inflateBack() may then be used multiple times to inflate a complete, raw
- deflate stream with each call. inflateBackEnd() is then called to free the
- allocated state.
-
- A raw deflate stream is one with no zlib or gzip header or trailer.
- This routine would normally be used in a utility that reads zip or gzip
- files and writes out uncompressed files. The utility would decode the
- header and process the trailer on its own, hence this routine expects only
- the raw deflate stream to decompress. This is different from the normal
- behavior of inflate(), which expects either a zlib or gzip header and
- trailer around the deflate stream.
-
- inflateBack() uses two subroutines supplied by the caller that are then
- called by inflateBack() for input and output. inflateBack() calls those
- routines until it reads a complete deflate stream and writes out all of the
- uncompressed data, or until it encounters an error. The function's
- parameters and return types are defined above in the in_func and out_func
- typedefs. inflateBack() will call in(in_desc, &buf) which should return the
- number of bytes of provided input, and a pointer to that input in buf. If
- there is no input available, in() must return zero--buf is ignored in that
- case--and inflateBack() will return a buffer error. inflateBack() will call
- out(out_desc, buf, len) to write the uncompressed data buf[0..len-1]. out()
- should return zero on success, or non-zero on failure. If out() returns
- non-zero, inflateBack() will return with an error. Neither in() nor out()
- are permitted to change the contents of the window provided to
- inflateBackInit(), which is also the buffer that out() uses to write from.
- The length written by out() will be at most the window size. Any non-zero
- amount of input may be provided by in().
-
- For convenience, inflateBack() can be provided input on the first call by
- setting strm->next_in and strm->avail_in. If that input is exhausted, then
- in() will be called. Therefore strm->next_in must be initialized before
- calling inflateBack(). If strm->next_in is Z_NULL, then in() will be called
- immediately for input. If strm->next_in is not Z_NULL, then strm->avail_in
- must also be initialized, and then if strm->avail_in is not zero, input will
- initially be taken from strm->next_in[0 .. strm->avail_in - 1].
-
- The in_desc and out_desc parameters of inflateBack() is passed as the
- first parameter of in() and out() respectively when they are called. These
- descriptors can be optionally used to pass any information that the caller-
- supplied in() and out() functions need to do their job.
-
- On return, inflateBack() will set strm->next_in and strm->avail_in to
- pass back any unused input that was provided by the last in() call. The
- return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR
- if in() or out() returned an error, Z_DATA_ERROR if there was a format error
- in the deflate stream (in which case strm->msg is set to indicate the nature
- of the error), or Z_STREAM_ERROR if the stream was not properly initialized.
- In the case of Z_BUF_ERROR, an input or output error can be distinguished
- using strm->next_in which will be Z_NULL only if in() returned an error. If
- strm->next_in is not Z_NULL, then the Z_BUF_ERROR was due to out() returning
- non-zero. (in() will always be called before out(), so strm->next_in is
- assured to be defined if out() returns non-zero.) Note that inflateBack()
- cannot return Z_OK.
-*/
-
-ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm));
-/*
- All memory allocated by inflateBackInit() is freed.
-
- inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream
- state was inconsistent.
-*/
-
-ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void));
-/* Return flags indicating compile-time options.
-
- Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other:
- 1.0: size of uInt
- 3.2: size of uLong
- 5.4: size of voidpf (pointer)
- 7.6: size of z_off_t
-
- Compiler, assembler, and debug options:
- 8: DEBUG
- 9: ASMV or ASMINF -- use ASM code
- 10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention
- 11: 0 (reserved)
-
- One-time table building (smaller code, but not thread-safe if true):
- 12: BUILDFIXED -- build static block decoding tables when needed
- 13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed
- 14,15: 0 (reserved)
-
- Library content (indicates missing functionality):
- 16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking
- deflate code when not needed)
- 17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect
- and decode gzip streams (to avoid linking crc code)
- 18-19: 0 (reserved)
-
- Operation variations (changes in library functionality):
- 20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate
- 21: FASTEST -- deflate algorithm with only one, lowest compression level
- 22,23: 0 (reserved)
-
- The sprintf variant used by gzprintf (zero is best):
- 24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format
- 25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure!
- 26: 0 = returns value, 1 = void -- 1 means inferred string length returned
-
- Remainder:
- 27-31: 0 (reserved)
- */
-
-#ifndef Z_SOLO
-
- /* utility functions */
-
-/*
- The following utility functions are implemented on top of the basic
- stream-oriented functions. To simplify the interface, some default options
- are assumed (compression level and memory usage, standard memory allocation
- functions). The source code of these utility functions can be modified if
- you need special options.
-*/
-
-ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen,
- const Bytef *source, uLong sourceLen));
-/*
- Compresses the source buffer into the destination buffer. sourceLen is
- the byte length of the source buffer. Upon entry, destLen is the total size
- of the destination buffer, which must be at least the value returned by
- compressBound(sourceLen). Upon exit, destLen is the actual size of the
- compressed buffer.
-
- compress returns Z_OK if success, Z_MEM_ERROR if there was not
- enough memory, Z_BUF_ERROR if there was not enough room in the output
- buffer.
-*/
-
-ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen,
- const Bytef *source, uLong sourceLen,
- int level));
-/*
- Compresses the source buffer into the destination buffer. The level
- parameter has the same meaning as in deflateInit. sourceLen is the byte
- length of the source buffer. Upon entry, destLen is the total size of the
- destination buffer, which must be at least the value returned by
- compressBound(sourceLen). Upon exit, destLen is the actual size of the
- compressed buffer.
-
- compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
- memory, Z_BUF_ERROR if there was not enough room in the output buffer,
- Z_STREAM_ERROR if the level parameter is invalid.
-*/
-
-ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen));
-/*
- compressBound() returns an upper bound on the compressed size after
- compress() or compress2() on sourceLen bytes. It would be used before a
- compress() or compress2() call to allocate the destination buffer.
-*/
-
-ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen,
- const Bytef *source, uLong sourceLen));
-/*
- Decompresses the source buffer into the destination buffer. sourceLen is
- the byte length of the source buffer. Upon entry, destLen is the total size
- of the destination buffer, which must be large enough to hold the entire
- uncompressed data. (The size of the uncompressed data must have been saved
- previously by the compressor and transmitted to the decompressor by some
- mechanism outside the scope of this compression library.) Upon exit, destLen
- is the actual size of the uncompressed buffer.
-
- uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
- enough memory, Z_BUF_ERROR if there was not enough room in the output
- buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete. In
- the case where there is not enough room, uncompress() will fill the output
- buffer with the uncompressed data up to that point.
-*/
-
- /* gzip file access functions */
-
-/*
- This library supports reading and writing files in gzip (.gz) format with
- an interface similar to that of stdio, using the functions that start with
- "gz". The gzip format is different from the zlib format. gzip is a gzip
- wrapper, documented in RFC 1952, wrapped around a deflate stream.
-*/
-
-typedef struct gzFile_s *gzFile; /* semi-opaque gzip file descriptor */
-
-/*
-ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode));
-
- Opens a gzip (.gz) file for reading or writing. The mode parameter is as
- in fopen ("rb" or "wb") but can also include a compression level ("wb9") or
- a strategy: 'f' for filtered data as in "wb6f", 'h' for Huffman-only
- compression as in "wb1h", 'R' for run-length encoding as in "wb1R", or 'F'
- for fixed code compression as in "wb9F". (See the description of
- deflateInit2 for more information about the strategy parameter.) 'T' will
- request transparent writing or appending with no compression and not using
- the gzip format.
-
- "a" can be used instead of "w" to request that the gzip stream that will
- be written be appended to the file. "+" will result in an error, since
- reading and writing to the same gzip file is not supported. The addition of
- "x" when writing will create the file exclusively, which fails if the file
- already exists. On systems that support it, the addition of "e" when
- reading or writing will set the flag to close the file on an execve() call.
-
- These functions, as well as gzip, will read and decode a sequence of gzip
- streams in a file. The append function of gzopen() can be used to create
- such a file. (Also see gzflush() for another way to do this.) When
- appending, gzopen does not test whether the file begins with a gzip stream,
- nor does it look for the end of the gzip streams to begin appending. gzopen
- will simply append a gzip stream to the existing file.
-
- gzopen can be used to read a file which is not in gzip format; in this
- case gzread will directly read from the file without decompression. When
- reading, this will be detected automatically by looking for the magic two-
- byte gzip header.
-
- gzopen returns NULL if the file could not be opened, if there was
- insufficient memory to allocate the gzFile state, or if an invalid mode was
- specified (an 'r', 'w', or 'a' was not provided, or '+' was provided).
- errno can be checked to determine if the reason gzopen failed was that the
- file could not be opened.
-*/
-
-ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode));
-/*
- gzdopen associates a gzFile with the file descriptor fd. File descriptors
- are obtained from calls like open, dup, creat, pipe or fileno (if the file
- has been previously opened with fopen). The mode parameter is as in gzopen.
-
- The next call of gzclose on the returned gzFile will also close the file
- descriptor fd, just like fclose(fdopen(fd, mode)) closes the file descriptor
- fd. If you want to keep fd open, use fd = dup(fd_keep); gz = gzdopen(fd,
- mode);. The duplicated descriptor should be saved to avoid a leak, since
- gzdopen does not close fd if it fails. If you are using fileno() to get the
- file descriptor from a FILE *, then you will have to use dup() to avoid
- double-close()ing the file descriptor. Both gzclose() and fclose() will
- close the associated file descriptor, so they need to have different file
- descriptors.
-
- gzdopen returns NULL if there was insufficient memory to allocate the
- gzFile state, if an invalid mode was specified (an 'r', 'w', or 'a' was not
- provided, or '+' was provided), or if fd is -1. The file descriptor is not
- used until the next gz* read, write, seek, or close operation, so gzdopen
- will not detect if fd is invalid (unless fd is -1).
-*/
-
-ZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size));
-/*
- Set the internal buffer size used by this library's functions. The
- default buffer size is 8192 bytes. This function must be called after
- gzopen() or gzdopen(), and before any other calls that read or write the
- file. The buffer memory allocation is always deferred to the first read or
- write. Two buffers are allocated, either both of the specified size when
- writing, or one of the specified size and the other twice that size when
- reading. A larger buffer size of, for example, 64K or 128K bytes will
- noticeably increase the speed of decompression (reading).
-
- The new buffer size also affects the maximum length for gzprintf().
-
- gzbuffer() returns 0 on success, or -1 on failure, such as being called
- too late.
-*/
-
-ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy));
-/*
- Dynamically update the compression level or strategy. See the description
- of deflateInit2 for the meaning of these parameters.
-
- gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not
- opened for writing.
-*/
-
-ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len));
-/*
- Reads the given number of uncompressed bytes from the compressed file. If
- the input file is not in gzip format, gzread copies the given number of
- bytes into the buffer directly from the file.
-
- After reaching the end of a gzip stream in the input, gzread will continue
- to read, looking for another gzip stream. Any number of gzip streams may be
- concatenated in the input file, and will all be decompressed by gzread().
- If something other than a gzip stream is encountered after a gzip stream,
- that remaining trailing garbage is ignored (and no error is returned).
-
- gzread can be used to read a gzip file that is being concurrently written.
- Upon reaching the end of the input, gzread will return with the available
- data. If the error code returned by gzerror is Z_OK or Z_BUF_ERROR, then
- gzclearerr can be used to clear the end of file indicator in order to permit
- gzread to be tried again. Z_OK indicates that a gzip stream was completed
- on the last gzread. Z_BUF_ERROR indicates that the input file ended in the
- middle of a gzip stream. Note that gzread does not return -1 in the event
- of an incomplete gzip stream. This error is deferred until gzclose(), which
- will return Z_BUF_ERROR if the last gzread ended in the middle of a gzip
- stream. Alternatively, gzerror can be used before gzclose to detect this
- case.
-
- gzread returns the number of uncompressed bytes actually read, less than
- len for end of file, or -1 for error.
-*/
-
-ZEXTERN int ZEXPORT gzwrite OF((gzFile file,
- voidpc buf, unsigned len));
-/*
- Writes the given number of uncompressed bytes into the compressed file.
- gzwrite returns the number of uncompressed bytes written or 0 in case of
- error.
-*/
-
-ZEXTERN int ZEXPORTVA gzprintf Z_ARG((gzFile file, const char *format, ...));
-/*
- Converts, formats, and writes the arguments to the compressed file under
- control of the format string, as in fprintf. gzprintf returns the number of
- uncompressed bytes actually written, or 0 in case of error. The number of
- uncompressed bytes written is limited to 8191, or one less than the buffer
- size given to gzbuffer(). The caller should assure that this limit is not
- exceeded. If it is exceeded, then gzprintf() will return an error (0) with
- nothing written. In this case, there may also be a buffer overflow with
- unpredictable consequences, which is possible only if zlib was compiled with
- the insecure functions sprintf() or vsprintf() because the secure snprintf()
- or vsnprintf() functions were not available. This can be determined using
- zlibCompileFlags().
-*/
-
-ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s));
-/*
- Writes the given null-terminated string to the compressed file, excluding
- the terminating null character.
-
- gzputs returns the number of characters written, or -1 in case of error.
-*/
-
-ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len));
-/*
- Reads bytes from the compressed file until len-1 characters are read, or a
- newline character is read and transferred to buf, or an end-of-file
- condition is encountered. If any characters are read or if len == 1, the
- string is terminated with a null character. If no characters are read due
- to an end-of-file or len < 1, then the buffer is left untouched.
-
- gzgets returns buf which is a null-terminated string, or it returns NULL
- for end-of-file or in case of error. If there was an error, the contents at
- buf are indeterminate.
-*/
-
-ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c));
-/*
- Writes c, converted to an unsigned char, into the compressed file. gzputc
- returns the value that was written, or -1 in case of error.
-*/
-
-ZEXTERN int ZEXPORT gzgetc OF((gzFile file));
-/*
- Reads one byte from the compressed file. gzgetc returns this byte or -1
- in case of end of file or error. This is implemented as a macro for speed.
- As such, it does not do all of the checking the other functions do. I.e.
- it does not check to see if file is NULL, nor whether the structure file
- points to has been clobbered or not.
-*/
-
-ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file));
-/*
- Push one character back onto the stream to be read as the first character
- on the next read. At least one character of push-back is allowed.
- gzungetc() returns the character pushed, or -1 on failure. gzungetc() will
- fail if c is -1, and may fail if a character has been pushed but not read
- yet. If gzungetc is used immediately after gzopen or gzdopen, at least the
- output buffer size of pushed characters is allowed. (See gzbuffer above.)
- The pushed character will be discarded if the stream is repositioned with
- gzseek() or gzrewind().
-*/
-
-ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush));
-/*
- Flushes all pending output into the compressed file. The parameter flush
- is as in the deflate() function. The return value is the zlib error number
- (see function gzerror below). gzflush is only permitted when writing.
-
- If the flush parameter is Z_FINISH, the remaining data is written and the
- gzip stream is completed in the output. If gzwrite() is called again, a new
- gzip stream will be started in the output. gzread() is able to read such
- concatented gzip streams.
-
- gzflush should be called only when strictly necessary because it will
- degrade compression if called too often.
-*/
-
-/*
-ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file,
- z_off_t offset, int whence));
-
- Sets the starting position for the next gzread or gzwrite on the given
- compressed file. The offset represents a number of bytes in the
- uncompressed data stream. The whence parameter is defined as in lseek(2);
- the value SEEK_END is not supported.
-
- If the file is opened for reading, this function is emulated but can be
- extremely slow. If the file is opened for writing, only forward seeks are
- supported; gzseek then compresses a sequence of zeroes up to the new
- starting position.
-
- gzseek returns the resulting offset location as measured in bytes from
- the beginning of the uncompressed stream, or -1 in case of error, in
- particular if the file is opened for writing and the new starting position
- would be before the current position.
-*/
-
-ZEXTERN int ZEXPORT gzrewind OF((gzFile file));
-/*
- Rewinds the given file. This function is supported only for reading.
-
- gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET)
-*/
-
-/*
-ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file));
-
- Returns the starting position for the next gzread or gzwrite on the given
- compressed file. This position represents a number of bytes in the
- uncompressed data stream, and is zero when starting, even if appending or
- reading a gzip stream from the middle of a file using gzdopen().
-
- gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR)
-*/
-
-/*
-ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile file));
-
- Returns the current offset in the file being read or written. This offset
- includes the count of bytes that precede the gzip stream, for example when
- appending or when using gzdopen() for reading. When reading, the offset
- does not include as yet unused buffered input. This information can be used
- for a progress indicator. On error, gzoffset() returns -1.
-*/
-
-ZEXTERN int ZEXPORT gzeof OF((gzFile file));
-/*
- Returns true (1) if the end-of-file indicator has been set while reading,
- false (0) otherwise. Note that the end-of-file indicator is set only if the
- read tried to go past the end of the input, but came up short. Therefore,
- just like feof(), gzeof() may return false even if there is no more data to
- read, in the event that the last read request was for the exact number of
- bytes remaining in the input file. This will happen if the input file size
- is an exact multiple of the buffer size.
-
- If gzeof() returns true, then the read functions will return no more data,
- unless the end-of-file indicator is reset by gzclearerr() and the input file
- has grown since the previous end of file was detected.
-*/
-
-ZEXTERN int ZEXPORT gzdirect OF((gzFile file));
-/*
- Returns true (1) if file is being copied directly while reading, or false
- (0) if file is a gzip stream being decompressed.
-
- If the input file is empty, gzdirect() will return true, since the input
- does not contain a gzip stream.
-
- If gzdirect() is used immediately after gzopen() or gzdopen() it will
- cause buffers to be allocated to allow reading the file to determine if it
- is a gzip file. Therefore if gzbuffer() is used, it should be called before
- gzdirect().
-
- When writing, gzdirect() returns true (1) if transparent writing was
- requested ("wT" for the gzopen() mode), or false (0) otherwise. (Note:
- gzdirect() is not needed when writing. Transparent writing must be
- explicitly requested, so the application already knows the answer. When
- linking statically, using gzdirect() will include all of the zlib code for
- gzip file reading and decompression, which may not be desired.)
-*/
-
-ZEXTERN int ZEXPORT gzclose OF((gzFile file));
-/*
- Flushes all pending output if necessary, closes the compressed file and
- deallocates the (de)compression state. Note that once file is closed, you
- cannot call gzerror with file, since its structures have been deallocated.
- gzclose must not be called more than once on the same file, just as free
- must not be called more than once on the same allocation.
-
- gzclose will return Z_STREAM_ERROR if file is not valid, Z_ERRNO on a
- file operation error, Z_MEM_ERROR if out of memory, Z_BUF_ERROR if the
- last read ended in the middle of a gzip stream, or Z_OK on success.
-*/
-
-ZEXTERN int ZEXPORT gzclose_r OF((gzFile file));
-ZEXTERN int ZEXPORT gzclose_w OF((gzFile file));
-/*
- Same as gzclose(), but gzclose_r() is only for use when reading, and
- gzclose_w() is only for use when writing or appending. The advantage to
- using these instead of gzclose() is that they avoid linking in zlib
- compression or decompression code that is not used when only reading or only
- writing respectively. If gzclose() is used, then both compression and
- decompression code will be included the application when linking to a static
- zlib library.
-*/
-
-ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum));
-/*
- Returns the error message for the last error which occurred on the given
- compressed file. errnum is set to zlib error number. If an error occurred
- in the file system and not in the compression library, errnum is set to
- Z_ERRNO and the application may consult errno to get the exact error code.
-
- The application must not modify the returned string. Future calls to
- this function may invalidate the previously returned string. If file is
- closed, then the string previously returned by gzerror will no longer be
- available.
-
- gzerror() should be used to distinguish errors from end-of-file for those
- functions above that do not distinguish those cases in their return values.
-*/
-
-ZEXTERN void ZEXPORT gzclearerr OF((gzFile file));
-/*
- Clears the error and end-of-file flags for file. This is analogous to the
- clearerr() function in stdio. This is useful for continuing to read a gzip
- file that is being written concurrently.
-*/
-
-#endif /* !Z_SOLO */
-
- /* checksum functions */
-
-/*
- These functions are not related to compression but are exported
- anyway because they might be useful in applications using the compression
- library.
-*/
-
-ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
-/*
- Update a running Adler-32 checksum with the bytes buf[0..len-1] and
- return the updated checksum. If buf is Z_NULL, this function returns the
- required initial value for the checksum.
-
- An Adler-32 checksum is almost as reliable as a CRC32 but can be computed
- much faster.
-
- Usage example:
-
- uLong adler = adler32(0L, Z_NULL, 0);
-
- while (read_buffer(buffer, length) != EOF) {
- adler = adler32(adler, buffer, length);
- }
- if (adler != original_adler) error();
-*/
-
-/*
-ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2,
- z_off_t len2));
-
- Combine two Adler-32 checksums into one. For two sequences of bytes, seq1
- and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for
- each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of
- seq1 and seq2 concatenated, requiring only adler1, adler2, and len2. Note
- that the z_off_t type (like off_t) is a signed integer. If len2 is
- negative, the result has no meaning or utility.
-*/
-
-ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len));
-/*
- Update a running CRC-32 with the bytes buf[0..len-1] and return the
- updated CRC-32. If buf is Z_NULL, this function returns the required
- initial value for the crc. Pre- and post-conditioning (one's complement) is
- performed within this function so it shouldn't be done by the application.
-
- Usage example:
-
- uLong crc = crc32(0L, Z_NULL, 0);
-
- while (read_buffer(buffer, length) != EOF) {
- crc = crc32(crc, buffer, length);
- }
- if (crc != original_crc) error();
-*/
-
-/*
-ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2));
-
- Combine two CRC-32 check values into one. For two sequences of bytes,
- seq1 and seq2 with lengths len1 and len2, CRC-32 check values were
- calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32
- check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and
- len2.
-*/
-
-
- /* various hacks, don't look :) */
-
-/* deflateInit and inflateInit are macros to allow checking the zlib version
- * and the compiler's view of z_stream:
- */
-ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level,
- const char *version, int stream_size));
-ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm,
- const char *version, int stream_size));
-ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method,
- int windowBits, int memLevel,
- int strategy, const char *version,
- int stream_size));
-ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits,
- const char *version, int stream_size));
-ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits,
- unsigned char FAR *window,
- const char *version,
- int stream_size));
-#define deflateInit(strm, level) \
- deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream))
-#define inflateInit(strm) \
- inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream))
-#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
- deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\
- (strategy), ZLIB_VERSION, (int)sizeof(z_stream))
-#define inflateInit2(strm, windowBits) \
- inflateInit2_((strm), (windowBits), ZLIB_VERSION, \
- (int)sizeof(z_stream))
-#define inflateBackInit(strm, windowBits, window) \
- inflateBackInit_((strm), (windowBits), (window), \
- ZLIB_VERSION, (int)sizeof(z_stream))
-
-#ifndef Z_SOLO
-
-/* gzgetc() macro and its supporting function and exposed data structure. Note
- * that the real internal state is much larger than the exposed structure.
- * This abbreviated structure exposes just enough for the gzgetc() macro. The
- * user should not mess with these exposed elements, since their names or
- * behavior could change in the future, perhaps even capriciously. They can
- * only be used by the gzgetc() macro. You have been warned.
- */
-struct gzFile_s {
- unsigned have;
- unsigned char *next;
- z_off64_t pos;
-};
-ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */
-#ifdef Z_PREFIX_SET
-# undef z_gzgetc
-# define z_gzgetc(g) \
- ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : gzgetc(g))
-#else
-# define gzgetc(g) \
- ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : gzgetc(g))
-#endif
-
-/* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or
- * change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if
- * both are true, the application gets the *64 functions, and the regular
- * functions are changed to 64 bits) -- in case these are set on systems
- * without large file support, _LFS64_LARGEFILE must also be true
- */
-#ifdef Z_LARGE64
- ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
- ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int));
- ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile));
- ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile));
- ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off64_t));
- ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t));
-#endif
-
-#if !defined(ZLIB_INTERNAL) && defined(Z_WANT64)
-# ifdef Z_PREFIX_SET
-# define z_gzopen z_gzopen64
-# define z_gzseek z_gzseek64
-# define z_gztell z_gztell64
-# define z_gzoffset z_gzoffset64
-# define z_adler32_combine z_adler32_combine64
-# define z_crc32_combine z_crc32_combine64
-# else
-# define gzopen gzopen64
-# define gzseek gzseek64
-# define gztell gztell64
-# define gzoffset gzoffset64
-# undef adler32_combine
-# undef crc32_combine
-# define adler32_combine adler32_combine64
-# define crc32_combine crc32_combine64
-# endif
-# ifndef Z_LARGE64
- ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
- ZEXTERN off64_t ZEXPORT gzseek64 OF((gzFile, off64_t, int));
- ZEXTERN off64_t ZEXPORT gztell64 OF((gzFile));
- ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile));
- ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, off64_t));
- ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, off64_t));
-# endif
-#else
- ZEXTERN gzFile ZEXPORT gzopen OF((const char *, const char *));
- ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile, z_off_t, int));
- ZEXTERN z_off_t ZEXPORT gztell OF((gzFile));
- ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile));
- ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t));
- ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t));
-#endif
-
-#else /* Z_SOLO */
-
- ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t));
- ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t));
-
-#endif /* !Z_SOLO */
-
-/* hack for buggy compilers */
-#if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL)
- struct internal_state {int dummy;};
-#endif
-
-/* undocumented functions */
-ZEXTERN const char * ZEXPORT zError OF((int));
-ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp));
-ZEXTERN const z_crc_t FAR * ZEXPORT get_crc_table OF((void));
-ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int));
-ZEXTERN int ZEXPORT inflateResetKeep OF((z_streamp));
-ZEXTERN int ZEXPORT deflateResetKeep OF((z_streamp));
-#if defined(_WIN32) && !defined(Z_SOLO)
-ZEXTERN gzFile ZEXPORT gzopen_w OF((const wchar_t *path,
- const char *mode));
-#endif
-#if defined(STDC) || defined(Z_HAVE_STDARG_H)
-# ifndef Z_SOLO
-ZEXTERN int ZEXPORTVA gzvprintf Z_ARG((gzFile file,
- const char *format,
- va_list va));
-# endif
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* ZLIB_H */
diff --git a/chromium/third_party/pdfium/third_party/zlib_v128/zutil.c b/chromium/third_party/pdfium/third_party/zlib_v128/zutil.c
deleted file mode 100644
index 5fa007964d5..00000000000
--- a/chromium/third_party/pdfium/third_party/zlib_v128/zutil.c
+++ /dev/null
@@ -1,341 +0,0 @@
-/* zutil.c -- target dependent utility functions for the compression library
- * Copyright (C) 1995-2005, 2010, 2011, 2012 Jean-loup Gailly.
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* @(#) $Id$ */
-
-#include "zutil.h"
-#ifndef Z_SOLO
-# include "gzguts.h"
-#endif
-
-#ifndef NO_DUMMY_DECL
-struct internal_state {int dummy;}; /* for buggy compilers */
-#endif
-
-z_const char * const z_errmsg[10] = {
-"need dictionary", /* Z_NEED_DICT 2 */
-"stream end", /* Z_STREAM_END 1 */
-"", /* Z_OK 0 */
-"file error", /* Z_ERRNO (-1) */
-"stream error", /* Z_STREAM_ERROR (-2) */
-"data error", /* Z_DATA_ERROR (-3) */
-"insufficient memory", /* Z_MEM_ERROR (-4) */
-"buffer error", /* Z_BUF_ERROR (-5) */
-"incompatible version",/* Z_VERSION_ERROR (-6) */
-""};
-
-
-const char * ZEXPORT zlibVersion()
-{
- return ZLIB_VERSION;
-}
-
-uLong ZEXPORT zlibCompileFlags()
-{
- uLong flags;
-
- flags = 0;
- switch ((int)(sizeof(uInt))) {
- case 2: break;
- case 4: flags += 1; break;
- case 8: flags += 2; break;
- default: flags += 3;
- }
- switch ((int)(sizeof(uLong))) {
- case 2: break;
- case 4: flags += 1 << 2; break;
- case 8: flags += 2 << 2; break;
- default: flags += 3 << 2;
- }
- switch ((int)(sizeof(voidpf))) {
- case 2: break;
- case 4: flags += 1 << 4; break;
- case 8: flags += 2 << 4; break;
- default: flags += 3 << 4;
- }
- switch ((int)(sizeof(z_off_t))) {
- case 2: break;
- case 4: flags += 1 << 6; break;
- case 8: flags += 2 << 6; break;
- default: flags += 3 << 6;
- }
-#ifdef DEBUG
- flags += 1 << 8;
-#endif
-#if defined(ASMV) || defined(ASMINF)
- flags += 1 << 9;
-#endif
-#ifdef ZLIB_WINAPI
- flags += 1 << 10;
-#endif
-#ifdef BUILDFIXED
- flags += 1 << 12;
-#endif
-#ifdef DYNAMIC_CRC_TABLE
- flags += 1 << 13;
-#endif
-#ifdef NO_GZCOMPRESS
- flags += 1L << 16;
-#endif
-#ifdef NO_GZIP
- flags += 1L << 17;
-#endif
-#ifdef PKZIP_BUG_WORKAROUND
- flags += 1L << 20;
-#endif
-#ifdef FASTEST
- flags += 1L << 21;
-#endif
-#if defined(STDC) || defined(Z_HAVE_STDARG_H)
-# ifdef NO_vsnprintf
- flags += 1L << 25;
-# ifdef HAS_vsprintf_void
- flags += 1L << 26;
-# endif
-# else
-# ifdef HAS_vsnprintf_void
- flags += 1L << 26;
-# endif
-# endif
-#else
- flags += 1L << 24;
-# ifdef NO_snprintf
- flags += 1L << 25;
-# ifdef HAS_sprintf_void
- flags += 1L << 26;
-# endif
-# else
-# ifdef HAS_snprintf_void
- flags += 1L << 26;
-# endif
-# endif
-#endif
- return flags;
-}
-
-#ifdef DEBUG
-
-# ifndef verbose
-# define verbose 0
-# endif
-int ZLIB_INTERNAL z_verbose = verbose;
-
-void ZLIB_INTERNAL z_error (
- char *m)
-{
- fprintf(stderr, "%s\n", m);
- exit(1);
-}
-#endif
-
-/* exported to allow conversion of error code to string for compress() and
- * uncompress()
- */
-const char * ZEXPORT zError(
- int err)
-{
- return ERR_MSG(err);
-}
-
-#if defined(_WIN32_WCE)
- /* The Microsoft C Run-Time Library for Windows CE doesn't have
- * errno. We define it as a global variable to simplify porting.
- * Its value is always 0 and should not be used.
- */
- /* does not exist on WCE. XYQ: and we don't need it! */
- /*int errno = 0;*/
-#endif
-
-#ifndef HAVE_MEMCPY
-
-void ZLIB_INTERNAL zmemcpy(
- Bytef* dest,
- const Bytef* source,
- uInt len)
-{
- if (len == 0) return;
- do {
- *dest++ = *source++; /* ??? to be unrolled */
- } while (--len != 0);
-}
-
-int ZLIB_INTERNAL zmemcmp(
- const Bytef* s1,
- const Bytef* s2,
- uInt len)
-{
- uInt j;
-
- for (j = 0; j < len; j++) {
- if (s1[j] != s2[j]) return 2*(s1[j] > s2[j])-1;
- }
- return 0;
-}
-
-void ZLIB_INTERNAL zmemzero(
- Bytef* dest,
- uInt len)
-{
- if (len == 0) return;
- do {
- *dest++ = 0; /* ??? to be unrolled */
- } while (--len != 0);
-}
-#endif
-
-#if 0
-#ifndef Z_SOLO
-
-#ifdef SYS16BIT
-
-#ifdef __TURBOC__
-/* Turbo C in 16-bit mode */
-
-# define MY_ZCALLOC
-
-/* Turbo C malloc() does not allow dynamic allocation of 64K bytes
- * and farmalloc(64K) returns a pointer with an offset of 8, so we
- * must fix the pointer. Warning: the pointer must be put back to its
- * original form in order to free it, use zcfree().
- */
-
-#define MAX_PTR 10
-/* 10*64K = 640K */
-
-local int next_ptr = 0;
-
-typedef struct ptr_table_s {
- voidpf org_ptr;
- voidpf new_ptr;
-} ptr_table;
-
-local ptr_table table[MAX_PTR];
-/* This table is used to remember the original form of pointers
- * to large buffers (64K). Such pointers are normalized with a zero offset.
- * Since MSDOS is not a preemptive multitasking OS, this table is not
- * protected from concurrent access. This hack doesn't work anyway on
- * a protected system like OS/2. Use Microsoft C instead.
- */
-
-voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, unsigned items, unsigned size)
-{
- voidpf buf = opaque; /* just to make some compilers happy */
- ulg bsize = (ulg)items*size;
-
- /* If we allocate less than 65520 bytes, we assume that farmalloc
- * will return a usable pointer which doesn't have to be normalized.
- */
- if (bsize < 65520L) {
- buf = farmalloc(bsize);
- if (*(ush*)&buf != 0) return buf;
- } else {
- buf = farmalloc(bsize + 16L);
- }
- if (buf == NULL || next_ptr >= MAX_PTR) return NULL;
- table[next_ptr].org_ptr = buf;
-
- /* Normalize the pointer to seg:0 */
- *((ush*)&buf+1) += ((ush)((uch*)buf-0) + 15) >> 4;
- *(ush*)&buf = 0;
- table[next_ptr++].new_ptr = buf;
- return buf;
-}
-
-void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr)
-{
- int n;
- if (*(ush*)&ptr != 0) { /* object < 64K */
- farfree(ptr);
- return;
- }
- /* Find the original pointer */
- for (n = 0; n < next_ptr; n++) {
- if (ptr != table[n].new_ptr) continue;
-
- farfree(table[n].org_ptr);
- while (++n < next_ptr) {
- table[n-1] = table[n];
- }
- next_ptr--;
- return;
- }
- ptr = opaque; /* just to make some compilers happy */
- Assert(0, "zcfree: ptr not found");
-}
-
-#endif /* __TURBOC__ */
-
-
-#ifdef M_I86
-/* Microsoft C in 16-bit mode */
-
-# define MY_ZCALLOC
-
-#if (!defined(_MSC_VER) || (_MSC_VER <= 600))
-# define _halloc halloc
-# define _hfree hfree
-#endif
-
-voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, uInt items, uInt size)
-{
- if (opaque) opaque = 0; /* to make compiler happy */
- return _halloc((long)items, size);
-}
-
-void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr)
-{
- if (opaque) opaque = 0; /* to make compiler happy */
- _hfree(ptr);
-}
-
-#endif /* M_I86 */
-
-#endif /* SYS16BIT */
-
-
-#ifndef MY_ZCALLOC /* Any system without a special alloc function */
-
-#ifndef STDC
-extern voidp malloc OF((uInt size));
-extern voidp calloc OF((uInt items, uInt size));
-extern void free OF((voidpf ptr));
-#endif
-
-voidpf ZLIB_INTERNAL zcalloc (opaque, items, size)
- voidpf opaque;
- unsigned items;
- unsigned size;
-{
- if (opaque) items += size - size; /* make compiler happy */
- return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) :
- (voidpf)calloc(items, size);
-}
-
-void ZLIB_INTERNAL zcfree (opaque, ptr)
- voidpf opaque;
- voidpf ptr;
-{
- free(ptr);
- if (opaque) return; /* make compiler happy */
-}
-
-#endif /* MY_ZCALLOC */
-
-#endif /* !Z_SOLO */
-#endif /* 0 */
-
-extern void* FXMEM_DefaultAlloc(size_t, int);
-extern void FXMEM_DefaultFree(void*, int);
-
-/* XYQ 2007-1-19 */
-voidpf zcalloc(voidpf opaque, unsigned items, unsigned size)
-{
- return FXMEM_DefaultAlloc(items * size, 0);
-}
-
-void zcfree(voidpf opaque, voidpf ptr)
-{
- FXMEM_DefaultFree(ptr, 0);
-}
diff --git a/chromium/third_party/pdfium/third_party/zlib_v128/zutil.h b/chromium/third_party/pdfium/third_party/zlib_v128/zutil.h
deleted file mode 100644
index c3b10e109b6..00000000000
--- a/chromium/third_party/pdfium/third_party/zlib_v128/zutil.h
+++ /dev/null
@@ -1,255 +0,0 @@
-/* zutil.h -- internal interface and configuration of the compression library
- * Copyright (C) 1995-2013 Jean-loup Gailly.
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* WARNING: this file should *not* be used by applications. It is
- part of the implementation of the compression library and is
- subject to change. Applications should only use zlib.h.
- */
-
-/* @(#) $Id$ */
-
-#ifndef ZUTIL_H
-#define ZUTIL_H
-
-#include "core/fxcrt/fx_system.h"
-
-#ifdef HAVE_HIDDEN
-# define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
-#else
-# define ZLIB_INTERNAL
-#endif
-
-#include "zlib.h"
-
-#if defined(STDC) && !defined(Z_SOLO)
-# if !(defined(_WIN32_WCE) && defined(_MSC_VER))
-# include <stddef.h>
-# endif
-# include <string.h>
-# include <stdlib.h>
-#endif
-
-#ifdef Z_SOLO
- typedef long ptrdiff_t; /* guess -- will be caught if guess is wrong */
-#endif
-
-#ifndef local
-# define local static
-#endif
-/* compile with -Dlocal if your debugger can't find static symbols */
-
-typedef unsigned char uch;
-typedef uch FAR uchf;
-typedef unsigned short ush;
-typedef ush FAR ushf;
-typedef unsigned long ulg;
-
-extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
-/* (size given to avoid silly warnings with Visual C++) */
-
-#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)]
-
-#define ERR_RETURN(strm,err) \
- return (strm->msg = ERR_MSG(err), (err))
-/* To be used only when the state is known to be valid */
-
- /* common constants */
-
-#ifndef DEF_WBITS
-# define DEF_WBITS MAX_WBITS
-#endif
-/* default windowBits for decompression. MAX_WBITS is for compression only */
-
-#if MAX_MEM_LEVEL >= 8
-# define DEF_MEM_LEVEL 8
-#else
-# define DEF_MEM_LEVEL MAX_MEM_LEVEL
-#endif
-/* default memLevel */
-
-#define STORED_BLOCK 0
-#define STATIC_TREES 1
-#define DYN_TREES 2
-/* The three kinds of block type */
-
-#define MIN_MATCH 3
-#define MAX_MATCH 258
-/* The minimum and maximum match lengths */
-
-#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */
-
- /* target dependencies */
-
-#if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32))
-# define OS_CODE 0x00
-# ifndef Z_SOLO
-# if defined(__TURBOC__) || defined(__BORLANDC__)
-# if (__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__))
- /* Allow compilation with ANSI keywords only enabled */
- void _Cdecl farfree( void *block );
- void *_Cdecl farmalloc( unsigned long nbytes );
-# else
-# include <alloc.h>
-# endif
-# else /* MSC or DJGPP */
-# include <malloc.h>
-# endif
-# endif
-#endif
-
-#ifdef AMIGA
-# define OS_CODE 0x01
-#endif
-
-#if defined(VAXC) || defined(VMS)
-# define OS_CODE 0x02
-# define F_OPEN(name, mode) \
- FXSYS_fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512")
-#endif
-
-#if defined(ATARI) || defined(atarist)
-# define OS_CODE 0x05
-#endif
-
-#ifdef OS2
-# define OS_CODE 0x06
-# if defined(M_I86) && !defined(Z_SOLO)
-# include <malloc.h>
-# endif
-#endif
-
-#if defined(MACOS) || defined(TARGET_OS_MAC)
-# define OS_CODE 0x07
-# ifndef Z_SOLO
-# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
-# include <unix.h> /* for fdopen */
-# else
-# ifndef fdopen
-# define fdopen(fd,mode) NULL /* No fdopen() */
-# endif
-# endif
-# endif
-#endif
-
-#ifdef TOPS20
-# define OS_CODE 0x0a
-#endif
-
-#ifdef WIN32
-# ifndef __CYGWIN__ /* Cygwin is Unix, not Win32 */
-# define OS_CODE 0x0b
-# endif
-#endif
-
-#ifdef __50SERIES /* Prime/PRIMOS */
-# define OS_CODE 0x0f
-#endif
-
-#if defined(_BEOS_) || defined(RISCOS)
-# define fdopen(fd,mode) NULL /* No fdopen() */
-#endif
-
-#if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX
-# if defined(_WIN32_WCE)
-# define fdopen(fd,mode) NULL /* No fdopen() */
-# ifndef _PTRDIFF_T_DEFINED
- typedef int ptrdiff_t;
-# define _PTRDIFF_T_DEFINED
-# endif
-# else
-# define fdopen(fd,type) _fdopen(fd,type)
-# endif
-#endif
-
-#if defined(__BORLANDC__) && !defined(MSDOS)
- #pragma warn -8004
- #pragma warn -8008
- #pragma warn -8066
-#endif
-
-/* provide prototypes for these when building zlib without LFS */
-#if !defined(_WIN32) && \
- (!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0)
- ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t));
- ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t));
-#endif
-
- /* common defaults */
-
-#ifndef OS_CODE
-# define OS_CODE 0x03 /* assume Unix */
-#endif
-
-#ifndef F_OPEN
-# define F_OPEN(name, mode) FXSYS_fopen((name), (mode))
-#endif
-
- /* functions */
-
-#if defined(pyr) || defined(Z_SOLO)
-# define NO_MEMCPY
-#endif
-#if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__)
- /* Use our own functions for small and medium model with MSC <= 5.0.
- * You may have to use the same strategy for Borland C (untested).
- * The __SC__ check is for Symantec.
- */
-# define NO_MEMCPY
-#endif
-#if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY)
-# define HAVE_MEMCPY
-#endif
-#ifdef HAVE_MEMCPY
-# ifdef SMALL_MEDIUM /* MSDOS small or medium model */
-# define zmemcpy _fmemcpy
-# define zmemcmp _fmemcmp
-# define zmemzero(dest, len) _fmemset(dest, 0, len)
-# else
-# define zmemcpy FXSYS_memcpy
-# define zmemcmp FXSYS_memcmp
-# define zmemzero(dest, len) FXSYS_memset(dest, 0, len)
-# endif
-#else
- void ZLIB_INTERNAL zmemcpy OF((Bytef* dest, const Bytef* source, uInt len));
- int ZLIB_INTERNAL zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len));
- void ZLIB_INTERNAL zmemzero OF((Bytef* dest, uInt len));
-#endif
-
-/* Diagnostic functions */
-#ifdef DEBUG
-# include <stdio.h>
- extern int ZLIB_INTERNAL z_verbose;
- extern void ZLIB_INTERNAL z_error OF((char *m));
-# define Assert(cond,msg) {if(!(cond)) z_error(msg);}
-# define Trace(x) {if (z_verbose>=0) FXSYS_fprintf x ;}
-# define Tracev(x) {if (z_verbose>0) FXSYS_fprintf x ;}
-# define Tracevv(x) {if (z_verbose>1) FXSYS_fprintf x ;}
-# define Tracec(c,x) {if (z_verbose>0 && (c)) FXSYS_fprintf x ;}
-# define Tracecv(c,x) {if (z_verbose>1 && (c)) FXSYS_fprintf x ;}
-#else
-# define Assert(cond,msg)
-# define Trace(x)
-# define Tracev(x)
-# define Tracevv(x)
-# define Tracec(c,x)
-# define Tracecv(c,x)
-#endif
-
-#ifndef Z_SOLO
- voidpf ZLIB_INTERNAL zcalloc OF((voidpf opaque, unsigned items,
- unsigned size));
- void ZLIB_INTERNAL zcfree OF((voidpf opaque, voidpf ptr));
-#endif
-
-#define ZALLOC(strm, items, size) \
- (*((strm)->zalloc))((strm)->opaque, (items), (size))
-#define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
-#define TRY_FREE(s, p) {if (p) ZFREE(s, p);}
-
-/* Reverse the bytes in a 32-bit value */
-#define ZSWAP32(q) ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \
- (((q) & 0xff00) << 8) + (((q) & 0xff) << 24))
-
-#endif /* ZUTIL_H */
diff --git a/chromium/third_party/pdfium/xfa/DEPS b/chromium/third_party/pdfium/xfa/DEPS
index 4aad7ef9581..cc3061d2bc8 100644
--- a/chromium/third_party/pdfium/xfa/DEPS
+++ b/chromium/third_party/pdfium/xfa/DEPS
@@ -2,5 +2,6 @@ include_rules = [
'+core/fpdfapi/parser',
'+core/fxcrt',
'+core/fxge',
+ '+fxbarcode',
'+third_party/bigint'
]
diff --git a/chromium/third_party/pdfium/xfa/fde/cfde_brush.h b/chromium/third_party/pdfium/xfa/fde/cfde_brush.h
new file mode 100644
index 00000000000..7a070c8605c
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fde/cfde_brush.h
@@ -0,0 +1,23 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef XFA_FDE_CFDE_BRUSH_H_
+#define XFA_FDE_CFDE_BRUSH_H_
+
+#include "core/fxge/fx_dib.h"
+
+class CFDE_Brush {
+ public:
+ CFDE_Brush() : m_Color(0xFF000000) {}
+
+ FX_ARGB GetColor() const { return m_Color; }
+ void SetColor(FX_ARGB color) { m_Color = color; }
+
+ private:
+ FX_ARGB m_Color;
+};
+
+#endif // XFA_FDE_CFDE_BRUSH_H_
diff --git a/chromium/third_party/pdfium/xfa/fde/cfde_path.cpp b/chromium/third_party/pdfium/xfa/fde/cfde_path.cpp
index 5e6cf5cf56c..a7d2e47ac1a 100644
--- a/chromium/third_party/pdfium/xfa/fde/cfde_path.cpp
+++ b/chromium/third_party/pdfium/xfa/fde/cfde_path.cpp
@@ -7,7 +7,6 @@
#include "xfa/fde/cfde_path.h"
#include "third_party/base/stl_util.h"
-#include "xfa/fde/fde_object.h"
void CFDE_Path::CloseFigure() {
m_Path.ClosePath();
@@ -36,29 +35,27 @@ void CFDE_Path::BezierTo(const CFX_PointF& p1,
void CFDE_Path::ArcTo(bool bStart,
const CFX_RectF& rect,
- FX_FLOAT startAngle,
- FX_FLOAT endAngle) {
- FX_FLOAT rx = rect.width / 2;
- FX_FLOAT ry = rect.height / 2;
- FX_FLOAT cx = rect.left + rx;
- FX_FLOAT cy = rect.top + ry;
- FX_FLOAT alpha =
- FXSYS_atan2(rx * FXSYS_sin(startAngle), ry * FXSYS_cos(startAngle));
- FX_FLOAT beta =
- FXSYS_atan2(rx * FXSYS_sin(endAngle), ry * FXSYS_cos(endAngle));
- if (FXSYS_fabs(beta - alpha) > FX_PI) {
+ float startAngle,
+ float endAngle) {
+ float rx = rect.width / 2;
+ float ry = rect.height / 2;
+ float cx = rect.left + rx;
+ float cy = rect.top + ry;
+ float alpha = atan2(rx * sin(startAngle), ry * cos(startAngle));
+ float beta = atan2(rx * sin(endAngle), ry * cos(endAngle));
+ if (fabs(beta - alpha) > FX_PI) {
if (beta > alpha)
beta -= 2 * FX_PI;
else
alpha -= 2 * FX_PI;
}
- FX_FLOAT half_delta = (beta - alpha) / 2;
- FX_FLOAT bcp = 4.0f / 3 * (1 - FXSYS_cos(half_delta)) / FXSYS_sin(half_delta);
- FX_FLOAT sin_alpha = FXSYS_sin(alpha);
- FX_FLOAT sin_beta = FXSYS_sin(beta);
- FX_FLOAT cos_alpha = FXSYS_cos(alpha);
- FX_FLOAT cos_beta = FXSYS_cos(beta);
+ float half_delta = (beta - alpha) / 2;
+ float bcp = 4.0f / 3 * (1 - cos(half_delta)) / sin(half_delta);
+ float sin_alpha = sin(alpha);
+ float sin_beta = sin(beta);
+ float cos_alpha = cos(alpha);
+ float cos_beta = cos(beta);
if (bStart)
MoveTo(CFX_PointF(cx + rx * cos_alpha, cy + ry * sin_alpha));
@@ -92,13 +89,13 @@ void CFDE_Path::AddBeziers(const std::vector<CFX_PointF>& points) {
void CFDE_Path::GetCurveTangents(const std::vector<CFX_PointF>& points,
std::vector<CFX_PointF>* tangents,
bool bClosed,
- FX_FLOAT fTension) const {
+ float fTension) const {
int32_t iCount = pdfium::CollectionSize<int32_t>(points);
tangents->resize(iCount);
if (iCount < 3)
return;
- FX_FLOAT fCoefficient = fTension / 3.0f;
+ float fCoefficient = fTension / 3.0f;
const CFX_PointF* pPoints = points.data();
CFX_PointF* pTangents = tangents->data();
for (int32_t i = 0; i < iCount; ++i) {
@@ -116,7 +113,7 @@ void CFDE_Path::GetCurveTangents(const std::vector<CFX_PointF>& points,
void CFDE_Path::AddCurve(const std::vector<CFX_PointF>& points,
bool bClosed,
- FX_FLOAT fTension) {
+ float fTension) {
int32_t iLast = pdfium::CollectionSize<int32_t>(points) - 1;
if (iLast < 1)
return;
@@ -144,8 +141,8 @@ void CFDE_Path::AddCurve(const std::vector<CFX_PointF>& points,
}
void CFDE_Path::AddEllipse(const CFX_RectF& rect) {
- FX_FLOAT fStartAngle = 0;
- FX_FLOAT fEndAngle = FX_PI / 2;
+ float fStartAngle = 0;
+ float fEndAngle = FX_PI / 2;
for (int32_t i = 0; i < 4; ++i) {
ArcTo(i == 0, rect, fStartAngle, fEndAngle);
fStartAngle += FX_PI / 2;
@@ -156,8 +153,8 @@ void CFDE_Path::AddEllipse(const CFX_RectF& rect) {
void CFDE_Path::AddLine(const CFX_PointF& pt1, const CFX_PointF& pt2) {
std::vector<FX_PATHPOINT>& points = m_Path.GetPoints();
- if (points.empty() || FXSYS_fabs(points.back().m_Point.x - pt1.x) > 0.001 ||
- FXSYS_fabs(points.back().m_Point.y - pt1.y) > 0.001) {
+ if (points.empty() || fabs(points.back().m_Point.x - pt1.x) > 0.001 ||
+ fabs(points.back().m_Point.y - pt1.y) > 0.001) {
MoveTo(pt1);
}
LineTo(pt2);
@@ -182,8 +179,8 @@ void CFDE_Path::AddPolygon(const std::vector<CFX_PointF>& points) {
AddLines(points);
const CFX_PointF* p = points.data();
- if (FXSYS_fabs(p[0].x - p[iCount - 1].x) < 0.01f ||
- FXSYS_fabs(p[0].y - p[iCount - 1].y) < 0.01f) {
+ if (fabs(p[0].x - p[iCount - 1].x) < 0.01f ||
+ fabs(p[0].y - p[iCount - 1].y) < 0.01f) {
LineTo(p[0]);
}
CloseFigure();
@@ -216,7 +213,7 @@ CFX_RectF CFDE_Path::GetBBox() const {
return bbox;
}
-CFX_RectF CFDE_Path::GetBBox(FX_FLOAT fLineWidth, FX_FLOAT fMiterLimit) const {
+CFX_RectF CFDE_Path::GetBBox(float fLineWidth, float fMiterLimit) const {
CFX_FloatRect rect = m_Path.GetBoundingBox(fLineWidth, fMiterLimit);
CFX_RectF bbox = CFX_RectF(rect.left, rect.top, rect.Width(), rect.Height());
bbox.Normalize();
diff --git a/chromium/third_party/pdfium/xfa/fde/cfde_path.h b/chromium/third_party/pdfium/xfa/fde/cfde_path.h
index 99ff4d36803..b0a229f172e 100644
--- a/chromium/third_party/pdfium/xfa/fde/cfde_path.h
+++ b/chromium/third_party/pdfium/xfa/fde/cfde_path.h
@@ -20,7 +20,7 @@ class CFDE_Path {
void AddBeziers(const std::vector<CFX_PointF>& points);
void AddCurve(const std::vector<CFX_PointF>& points,
bool bClosed,
- FX_FLOAT fTension = 0.5f);
+ float fTension = 0.5f);
void AddEllipse(const CFX_RectF& rect);
void AddLines(const std::vector<CFX_PointF>& points);
void AddLine(const CFX_PointF& pt1, const CFX_PointF& pt2);
@@ -29,7 +29,7 @@ class CFDE_Path {
void AddRectangle(const CFX_RectF& rect);
CFX_RectF GetBBox() const;
- CFX_RectF GetBBox(FX_FLOAT fLineWidth, FX_FLOAT fMiterLimit) const;
+ CFX_RectF GetBBox(float fLineWidth, float fMiterLimit) const;
bool FigureClosed() const;
void BezierTo(const CFX_PointF& p1,
@@ -37,15 +37,15 @@ class CFDE_Path {
const CFX_PointF& p3);
void ArcTo(bool bStart,
const CFX_RectF& rect,
- FX_FLOAT startAngle,
- FX_FLOAT endAngle);
+ float startAngle,
+ float endAngle);
void MoveTo(const CFX_PointF& p);
void LineTo(const CFX_PointF& p);
void GetCurveTangents(const std::vector<CFX_PointF>& points,
std::vector<CFX_PointF>* tangents,
bool bClosed,
- FX_FLOAT fTension) const;
+ float fTension) const;
CFX_PathData m_Path;
};
diff --git a/chromium/third_party/pdfium/xfa/fde/cfde_pen.h b/chromium/third_party/pdfium/xfa/fde/cfde_pen.h
new file mode 100644
index 00000000000..ac49571bd0c
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fde/cfde_pen.h
@@ -0,0 +1,24 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef XFA_FDE_CFDE_PEN_H_
+#define XFA_FDE_CFDE_PEN_H_
+
+#include "core/fxge/fx_dib.h"
+
+class CFDE_Pen {
+ public:
+ CFDE_Pen() : m_Color(0) {}
+ ~CFDE_Pen() {}
+
+ FX_ARGB GetColor() const { return m_Color; }
+ void SetColor(FX_ARGB color) { m_Color = color; }
+
+ private:
+ FX_ARGB m_Color;
+};
+
+#endif // XFA_FDE_CFDE_PEN_H_
diff --git a/chromium/third_party/pdfium/xfa/fde/cfde_rendercontext.cpp b/chromium/third_party/pdfium/xfa/fde/cfde_rendercontext.cpp
new file mode 100644
index 00000000000..2e690e0ed96
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fde/cfde_rendercontext.cpp
@@ -0,0 +1,128 @@
+// 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
+
+#include "xfa/fde/cfde_rendercontext.h"
+
+#include "third_party/base/ptr_util.h"
+#include "xfa/fde/cfde_brush.h"
+#include "xfa/fde/cfde_renderdevice.h"
+#include "xfa/fde/cfde_txtedttextset.h"
+
+#define FDE_PATHRENDER_Stroke 1
+#define FDE_PATHRENDER_Fill 2
+
+CFDE_RenderContext::CFDE_RenderContext()
+ : m_eStatus(FDE_RENDERSTATUS_Reset),
+ m_pRenderDevice(nullptr),
+ m_Transform() {
+ m_Transform.SetIdentity();
+}
+
+CFDE_RenderContext::~CFDE_RenderContext() {
+ StopRender();
+}
+
+bool CFDE_RenderContext::StartRender(CFDE_RenderDevice* pRenderDevice,
+ CFDE_TxtEdtPage* pCanvasSet,
+ const CFX_Matrix& tmDoc2Device) {
+ if (m_pRenderDevice)
+ return false;
+ if (!pRenderDevice)
+ return false;
+ if (!pCanvasSet)
+ return false;
+
+ m_eStatus = FDE_RENDERSTATUS_Paused;
+ m_pRenderDevice = pRenderDevice;
+ m_Transform = tmDoc2Device;
+ if (!m_pIterator)
+ m_pIterator = pdfium::MakeUnique<CFDE_VisualSetIterator>();
+
+ return m_pIterator->AttachCanvas(pCanvasSet) && m_pIterator->FilterObjects();
+}
+
+FDE_RENDERSTATUS CFDE_RenderContext::DoRender(IFX_Pause* pPause) {
+ if (!m_pRenderDevice)
+ return FDE_RENDERSTATUS_Failed;
+ if (!m_pIterator)
+ return FDE_RENDERSTATUS_Failed;
+
+ FDE_RENDERSTATUS eStatus = FDE_RENDERSTATUS_Paused;
+ CFX_Matrix rm;
+ rm.SetReverse(m_Transform);
+ CFX_RectF rtDocClip = m_pRenderDevice->GetClipRect();
+ if (rtDocClip.IsEmpty()) {
+ rtDocClip.left = rtDocClip.top = 0;
+ rtDocClip.width = (float)m_pRenderDevice->GetWidth();
+ rtDocClip.height = (float)m_pRenderDevice->GetHeight();
+ }
+ rm.TransformRect(rtDocClip);
+ IFDE_VisualSet* pVisualSet;
+ FDE_TEXTEDITPIECE* pPiece;
+ int32_t iCount = 0;
+ while (true) {
+ pPiece = m_pIterator->GetNext(pVisualSet);
+ if (!pPiece || !pVisualSet) {
+ eStatus = FDE_RENDERSTATUS_Done;
+ break;
+ }
+ if (!rtDocClip.IntersectWith(pVisualSet->GetRect(*pPiece)))
+ continue;
+
+ switch (pVisualSet->GetType()) {
+ case FDE_VISUALOBJ_Text:
+ RenderText(static_cast<CFDE_TxtEdtTextSet*>(pVisualSet), pPiece);
+ iCount += 5;
+ break;
+ case FDE_VISUALOBJ_Canvas:
+ ASSERT(false);
+ break;
+ default:
+ break;
+ }
+ if (iCount >= 100 && pPause && pPause->NeedToPauseNow()) {
+ eStatus = FDE_RENDERSTATUS_Paused;
+ break;
+ }
+ }
+ return m_eStatus = eStatus;
+}
+
+void CFDE_RenderContext::StopRender() {
+ m_eStatus = FDE_RENDERSTATUS_Reset;
+ m_pRenderDevice = nullptr;
+ m_Transform.SetIdentity();
+ m_pIterator.reset();
+ m_pBrush.reset();
+ m_CharPos.clear();
+}
+
+void CFDE_RenderContext::RenderText(CFDE_TxtEdtTextSet* pTextSet,
+ FDE_TEXTEDITPIECE* pText) {
+ ASSERT(m_pRenderDevice);
+ ASSERT(pTextSet && pText);
+
+ CFX_RetainPtr<CFGAS_GEFont> pFont = pTextSet->GetFont();
+ if (!pFont)
+ return;
+
+ int32_t iCount = pTextSet->GetDisplayPos(*pText, nullptr, false);
+ if (iCount < 1)
+ return;
+
+ if (!m_pBrush)
+ m_pBrush = pdfium::MakeUnique<CFDE_Brush>();
+
+ if (m_CharPos.size() < static_cast<size_t>(iCount))
+ m_CharPos.resize(iCount, FXTEXT_CHARPOS());
+
+ iCount = pTextSet->GetDisplayPos(*pText, m_CharPos.data(), false);
+ float fFontSize = pTextSet->GetFontSize();
+ FX_ARGB dwColor = pTextSet->GetFontColor();
+ m_pBrush->SetColor(dwColor);
+ m_pRenderDevice->DrawString(m_pBrush.get(), pFont, m_CharPos.data(), iCount,
+ fFontSize, &m_Transform);
+}
diff --git a/chromium/third_party/pdfium/xfa/fde/cfde_rendercontext.h b/chromium/third_party/pdfium/xfa/fde/cfde_rendercontext.h
new file mode 100644
index 00000000000..28b8780052d
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fde/cfde_rendercontext.h
@@ -0,0 +1,50 @@
+// 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 XFA_FDE_CFDE_RENDERCONTEXT_H_
+#define XFA_FDE_CFDE_RENDERCONTEXT_H_
+
+#include <memory>
+#include <vector>
+
+#include "core/fxcrt/fx_coordinates.h"
+#include "xfa/fde/cfde_renderdevice.h"
+#include "xfa/fde/cfde_visualsetiterator.h"
+#include "xfa/fde/ifde_visualset.h"
+
+class CFDE_RenderDevice;
+class CFDE_TxtEdtTextSet;
+
+enum FDE_RENDERSTATUS {
+ FDE_RENDERSTATUS_Reset = 0,
+ FDE_RENDERSTATUS_Paused,
+ FDE_RENDERSTATUS_Done,
+ FDE_RENDERSTATUS_Failed,
+};
+
+class CFDE_RenderContext {
+ public:
+ CFDE_RenderContext();
+ ~CFDE_RenderContext();
+
+ bool StartRender(CFDE_RenderDevice* pRenderDevice,
+ CFDE_TxtEdtPage* pCanvasSet,
+ const CFX_Matrix& tmDoc2Device);
+ FDE_RENDERSTATUS GetStatus() const { return m_eStatus; }
+ FDE_RENDERSTATUS DoRender(IFX_Pause* pPause = nullptr);
+ void StopRender();
+ void RenderText(CFDE_TxtEdtTextSet* pTextSet, FDE_TEXTEDITPIECE* pText);
+
+ protected:
+ FDE_RENDERSTATUS m_eStatus;
+ CFDE_RenderDevice* m_pRenderDevice;
+ CFX_Matrix m_Transform;
+ std::vector<FXTEXT_CHARPOS> m_CharPos;
+ std::unique_ptr<CFDE_Brush> m_pBrush;
+ std::unique_ptr<CFDE_VisualSetIterator> m_pIterator;
+};
+
+#endif // XFA_FDE_CFDE_RENDERCONTEXT_H_
diff --git a/chromium/third_party/pdfium/xfa/fde/cfde_renderdevice.cpp b/chromium/third_party/pdfium/xfa/fde/cfde_renderdevice.cpp
new file mode 100644
index 00000000000..839ffac019c
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fde/cfde_renderdevice.cpp
@@ -0,0 +1,354 @@
+// 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
+
+#include "xfa/fde/cfde_renderdevice.h"
+
+#include <algorithm>
+#include <memory>
+
+#include "core/fxge/cfx_gemodule.h"
+#include "core/fxge/cfx_graphstatedata.h"
+#include "core/fxge/cfx_renderdevice.h"
+#include "core/fxge/cfx_substfont.h"
+#include "core/fxge/dib/cfx_imagerenderer.h"
+#include "xfa/fde/cfde_brush.h"
+#include "xfa/fde/cfde_path.h"
+#include "xfa/fde/cfde_pen.h"
+#include "xfa/fgas/font/cfgas_fontmgr.h"
+#include "xfa/fgas/font/cfgas_gefont.h"
+
+CFDE_RenderDevice::CFDE_RenderDevice(CFX_RenderDevice* pDevice,
+ bool bOwnerDevice)
+ : m_pDevice(pDevice), m_bOwnerDevice(bOwnerDevice), m_iCharCount(0) {
+ ASSERT(pDevice);
+
+ FX_RECT rt = m_pDevice->GetClipBox();
+ m_rtClip = CFX_RectF(static_cast<float>(rt.left), static_cast<float>(rt.top),
+ static_cast<float>(rt.Width()),
+ static_cast<float>(rt.Height()));
+}
+
+CFDE_RenderDevice::~CFDE_RenderDevice() {
+ if (m_bOwnerDevice)
+ delete m_pDevice;
+}
+
+int32_t CFDE_RenderDevice::GetWidth() const {
+ return m_pDevice->GetWidth();
+}
+
+int32_t CFDE_RenderDevice::GetHeight() const {
+ return m_pDevice->GetHeight();
+}
+
+void CFDE_RenderDevice::SaveState() {
+ m_pDevice->SaveState();
+}
+
+void CFDE_RenderDevice::RestoreState() {
+ m_pDevice->RestoreState(false);
+ const FX_RECT& rt = m_pDevice->GetClipBox();
+ m_rtClip = CFX_RectF(static_cast<float>(rt.left), static_cast<float>(rt.top),
+ static_cast<float>(rt.Width()),
+ static_cast<float>(rt.Height()));
+}
+
+bool CFDE_RenderDevice::SetClipRect(const CFX_RectF& rtClip) {
+ m_rtClip = rtClip;
+ return m_pDevice->SetClip_Rect(
+ FX_RECT((int32_t)floor(rtClip.left), (int32_t)floor(rtClip.top),
+ (int32_t)ceil(rtClip.right()), (int32_t)ceil(rtClip.bottom())));
+}
+
+const CFX_RectF& CFDE_RenderDevice::GetClipRect() {
+ return m_rtClip;
+}
+
+bool CFDE_RenderDevice::SetClipPath(const CFDE_Path* pClip) {
+ return false;
+}
+
+CFDE_Path* CFDE_RenderDevice::GetClipPath() const {
+ return nullptr;
+}
+
+float CFDE_RenderDevice::GetDpiX() const {
+ return 96;
+}
+
+float CFDE_RenderDevice::GetDpiY() const {
+ return 96;
+}
+
+bool CFDE_RenderDevice::DrawImage(const CFX_RetainPtr<CFX_DIBSource>& pDib,
+ const CFX_RectF* pSrcRect,
+ const CFX_RectF& dstRect,
+ const CFX_Matrix* pImgMatrix,
+ const CFX_Matrix* pDevMatrix) {
+ CFX_RectF srcRect;
+ if (pSrcRect) {
+ srcRect = *pSrcRect;
+ } else {
+ srcRect = CFX_RectF(0, 0, static_cast<float>(pDib->GetWidth()),
+ static_cast<float>(pDib->GetHeight()));
+ }
+
+ if (srcRect.IsEmpty())
+ return false;
+
+ CFX_Matrix dib2fxdev;
+ if (pImgMatrix) {
+ dib2fxdev = *pImgMatrix;
+ } else {
+ dib2fxdev.SetIdentity();
+ }
+ dib2fxdev.a = dstRect.width;
+ dib2fxdev.d = -dstRect.height;
+ dib2fxdev.e = dstRect.left;
+ dib2fxdev.f = dstRect.bottom();
+ if (pDevMatrix) {
+ dib2fxdev.Concat(*pDevMatrix);
+ }
+ std::unique_ptr<CFX_ImageRenderer> handle;
+ m_pDevice->StartDIBits(pDib, 255, 0, (const CFX_Matrix*)&dib2fxdev, 0,
+ &handle);
+ while (m_pDevice->ContinueDIBits(handle.get(), nullptr)) {
+ }
+ return !!handle;
+}
+
+bool CFDE_RenderDevice::DrawString(CFDE_Brush* pBrush,
+ const CFX_RetainPtr<CFGAS_GEFont>& pFont,
+ const FXTEXT_CHARPOS* pCharPos,
+ int32_t iCount,
+ float fFontSize,
+ const CFX_Matrix* pMatrix) {
+ ASSERT(pBrush && pFont && pCharPos && iCount > 0);
+ CFX_Font* pFxFont = pFont->GetDevFont();
+ FX_ARGB argb = pBrush->GetColor();
+ if ((pFont->GetFontStyles() & FX_FONTSTYLE_Italic) != 0 &&
+ !pFxFont->IsItalic()) {
+ FXTEXT_CHARPOS* pCP = (FXTEXT_CHARPOS*)pCharPos;
+ float* pAM;
+ for (int32_t i = 0; i < iCount; ++i) {
+ static const float mc = 0.267949f;
+ pAM = pCP->m_AdjustMatrix;
+ pAM[2] = mc * pAM[0] + pAM[2];
+ pAM[3] = mc * pAM[1] + pAM[3];
+ pCP++;
+ }
+ }
+ FXTEXT_CHARPOS* pCP = (FXTEXT_CHARPOS*)pCharPos;
+ CFX_RetainPtr<CFGAS_GEFont> pCurFont;
+ CFX_RetainPtr<CFGAS_GEFont> pSTFont;
+ FXTEXT_CHARPOS* pCurCP = nullptr;
+ int32_t iCurCount = 0;
+
+#if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
+ uint32_t dwFontStyle = pFont->GetFontStyles();
+ CFX_Font FxFont;
+ CFX_SubstFont* SubstFxFont = new CFX_SubstFont();
+ FxFont.SetSubstFont(std::unique_ptr<CFX_SubstFont>(SubstFxFont));
+ SubstFxFont->m_Weight = dwFontStyle & FX_FONTSTYLE_Bold ? 700 : 400;
+ SubstFxFont->m_ItalicAngle = dwFontStyle & FX_FONTSTYLE_Italic ? -12 : 0;
+ SubstFxFont->m_WeightCJK = SubstFxFont->m_Weight;
+ SubstFxFont->m_bItalicCJK = !!(dwFontStyle & FX_FONTSTYLE_Italic);
+#endif // _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
+
+ for (int32_t i = 0; i < iCount; ++i) {
+ pSTFont = pFont->GetSubstFont((int32_t)pCP->m_GlyphIndex);
+ pCP->m_GlyphIndex &= 0x00FFFFFF;
+ pCP->m_bFontStyle = false;
+ if (pCurFont != pSTFont) {
+ if (pCurFont) {
+ pFxFont = pCurFont->GetDevFont();
+#if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
+ FxFont.SetFace(pFxFont->GetFace());
+ m_pDevice->DrawNormalText(iCurCount, pCurCP, &FxFont, -fFontSize,
+ pMatrix, argb, FXTEXT_CLEARTYPE);
+#else
+ m_pDevice->DrawNormalText(iCurCount, pCurCP, pFxFont, -fFontSize,
+ pMatrix, argb, FXTEXT_CLEARTYPE);
+#endif // _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
+ }
+ pCurFont = pSTFont;
+ pCurCP = pCP;
+ iCurCount = 1;
+ } else {
+ iCurCount++;
+ }
+ pCP++;
+ }
+ if (pCurFont && iCurCount) {
+ pFxFont = pCurFont->GetDevFont();
+#if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
+ FxFont.SetFace(pFxFont->GetFace());
+ bool bRet =
+ m_pDevice->DrawNormalText(iCurCount, pCurCP, &FxFont, -fFontSize,
+ pMatrix, argb, FXTEXT_CLEARTYPE);
+ FxFont.SetFace(nullptr);
+ return bRet;
+#else
+ return m_pDevice->DrawNormalText(iCurCount, pCurCP, pFxFont, -fFontSize,
+ pMatrix, argb, FXTEXT_CLEARTYPE);
+#endif // _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
+ }
+
+#if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
+ FxFont.SetFace(nullptr);
+#endif // _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
+
+ return true;
+}
+
+bool CFDE_RenderDevice::DrawBezier(CFDE_Pen* pPen,
+ float fPenWidth,
+ const CFX_PointF& pt1,
+ const CFX_PointF& pt2,
+ const CFX_PointF& pt3,
+ const CFX_PointF& pt4,
+ const CFX_Matrix* pMatrix) {
+ std::vector<CFX_PointF> points;
+ points.push_back(pt1);
+ points.push_back(pt2);
+ points.push_back(pt3);
+ points.push_back(pt4);
+ CFDE_Path path;
+ path.AddBezier(points);
+ return DrawPath(pPen, fPenWidth, &path, pMatrix);
+}
+
+bool CFDE_RenderDevice::DrawCurve(CFDE_Pen* pPen,
+ float fPenWidth,
+ const std::vector<CFX_PointF>& points,
+ bool bClosed,
+ float fTension,
+ const CFX_Matrix* pMatrix) {
+ CFDE_Path path;
+ path.AddCurve(points, bClosed, fTension);
+ return DrawPath(pPen, fPenWidth, &path, pMatrix);
+}
+
+bool CFDE_RenderDevice::DrawEllipse(CFDE_Pen* pPen,
+ float fPenWidth,
+ const CFX_RectF& rect,
+ const CFX_Matrix* pMatrix) {
+ CFDE_Path path;
+ path.AddEllipse(rect);
+ return DrawPath(pPen, fPenWidth, &path, pMatrix);
+}
+
+bool CFDE_RenderDevice::DrawLines(CFDE_Pen* pPen,
+ float fPenWidth,
+ const std::vector<CFX_PointF>& points,
+ const CFX_Matrix* pMatrix) {
+ CFDE_Path path;
+ path.AddLines(points);
+ return DrawPath(pPen, fPenWidth, &path, pMatrix);
+}
+
+bool CFDE_RenderDevice::DrawLine(CFDE_Pen* pPen,
+ float fPenWidth,
+ const CFX_PointF& pt1,
+ const CFX_PointF& pt2,
+ const CFX_Matrix* pMatrix) {
+ CFDE_Path path;
+ path.AddLine(pt1, pt2);
+ return DrawPath(pPen, fPenWidth, &path, pMatrix);
+}
+
+bool CFDE_RenderDevice::DrawPath(CFDE_Pen* pPen,
+ float fPenWidth,
+ const CFDE_Path* pPath,
+ const CFX_Matrix* pMatrix) {
+ CFDE_Path* pGePath = (CFDE_Path*)pPath;
+ if (!pGePath)
+ return false;
+
+ CFX_GraphStateData graphState;
+ if (!CreatePen(pPen, fPenWidth, graphState)) {
+ return false;
+ }
+ return m_pDevice->DrawPath(&pGePath->m_Path, (const CFX_Matrix*)pMatrix,
+ &graphState, 0, pPen->GetColor(), 0);
+}
+
+bool CFDE_RenderDevice::DrawPolygon(CFDE_Pen* pPen,
+ float fPenWidth,
+ const std::vector<CFX_PointF>& points,
+ const CFX_Matrix* pMatrix) {
+ CFDE_Path path;
+ path.AddPolygon(points);
+ return DrawPath(pPen, fPenWidth, &path, pMatrix);
+}
+
+bool CFDE_RenderDevice::DrawRectangle(CFDE_Pen* pPen,
+ float fPenWidth,
+ const CFX_RectF& rect,
+ const CFX_Matrix* pMatrix) {
+ CFDE_Path path;
+ path.AddRectangle(rect);
+ return DrawPath(pPen, fPenWidth, &path, pMatrix);
+}
+
+bool CFDE_RenderDevice::FillClosedCurve(CFDE_Brush* pBrush,
+ const std::vector<CFX_PointF>& points,
+ float fTension,
+ const CFX_Matrix* pMatrix) {
+ CFDE_Path path;
+ path.AddCurve(points, true, fTension);
+ return FillPath(pBrush, &path, pMatrix);
+}
+
+bool CFDE_RenderDevice::FillEllipse(CFDE_Brush* pBrush,
+ const CFX_RectF& rect,
+ const CFX_Matrix* pMatrix) {
+ CFDE_Path path;
+ path.AddEllipse(rect);
+ return FillPath(pBrush, &path, pMatrix);
+}
+
+bool CFDE_RenderDevice::FillPolygon(CFDE_Brush* pBrush,
+ const std::vector<CFX_PointF>& points,
+ const CFX_Matrix* pMatrix) {
+ CFDE_Path path;
+ path.AddPolygon(points);
+ return FillPath(pBrush, &path, pMatrix);
+}
+
+bool CFDE_RenderDevice::FillRectangle(CFDE_Brush* pBrush,
+ const CFX_RectF& rect,
+ const CFX_Matrix* pMatrix) {
+ CFDE_Path path;
+ path.AddRectangle(rect);
+ return FillPath(pBrush, &path, pMatrix);
+}
+
+bool CFDE_RenderDevice::CreatePen(CFDE_Pen* pPen,
+ float fPenWidth,
+ CFX_GraphStateData& graphState) {
+ if (!pPen)
+ return false;
+
+ graphState.m_LineCap = CFX_GraphStateData::LineCapButt;
+ graphState.m_LineJoin = CFX_GraphStateData::LineJoinMiter;
+ graphState.m_LineWidth = fPenWidth;
+ graphState.m_MiterLimit = 10;
+ graphState.m_DashPhase = 0;
+ return true;
+}
+
+bool CFDE_RenderDevice::FillPath(CFDE_Brush* pBrush,
+ const CFDE_Path* pPath,
+ const CFX_Matrix* pMatrix) {
+ CFDE_Path* pGePath = (CFDE_Path*)pPath;
+ if (!pGePath)
+ return false;
+ if (!pBrush)
+ return false;
+ return m_pDevice->DrawPath(&pGePath->m_Path, pMatrix, nullptr,
+ pBrush->GetColor(), 0, FXFILL_WINDING);
+}
diff --git a/chromium/third_party/pdfium/xfa/fde/cfde_renderdevice.h b/chromium/third_party/pdfium/xfa/fde/cfde_renderdevice.h
new file mode 100644
index 00000000000..f429ac1703c
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fde/cfde_renderdevice.h
@@ -0,0 +1,127 @@
+// 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 XFA_FDE_CFDE_RENDERDEVICE_H_
+#define XFA_FDE_CFDE_RENDERDEVICE_H_
+
+#include <vector>
+
+#include "core/fxge/cfx_renderdevice.h"
+#include "xfa/fgas/font/cfgas_gefont.h"
+
+class CFDE_Brush;
+class CFDE_Path;
+class CFDE_Pen;
+class CFX_GraphStateData;
+
+class CFDE_RenderDevice {
+ public:
+ CFDE_RenderDevice(CFX_RenderDevice* pDevice, bool bOwnerDevice);
+ ~CFDE_RenderDevice();
+
+ int32_t GetWidth() const;
+ int32_t GetHeight() const;
+ void SaveState();
+ void RestoreState();
+ bool SetClipPath(const CFDE_Path* pClip);
+ CFDE_Path* GetClipPath() const;
+ bool SetClipRect(const CFX_RectF& rtClip);
+ const CFX_RectF& GetClipRect();
+
+ float GetDpiX() const;
+ float GetDpiY() const;
+
+ bool DrawImage(const CFX_RetainPtr<CFX_DIBSource>& pDib,
+ const CFX_RectF* pSrcRect,
+ const CFX_RectF& dstRect,
+ const CFX_Matrix* pImgMatrix = nullptr,
+ const CFX_Matrix* pDevMatrix = nullptr);
+ bool DrawString(CFDE_Brush* pBrush,
+ const CFX_RetainPtr<CFGAS_GEFont>& pFont,
+ const FXTEXT_CHARPOS* pCharPos,
+ int32_t iCount,
+ float fFontSize,
+ const CFX_Matrix* pMatrix = nullptr);
+ bool DrawBezier(CFDE_Pen* pPen,
+ float fPenWidth,
+ const CFX_PointF& pt1,
+ const CFX_PointF& pt2,
+ const CFX_PointF& pt3,
+ const CFX_PointF& pt4,
+ const CFX_Matrix* pMatrix = nullptr);
+ bool DrawCurve(CFDE_Pen* pPen,
+ float fPenWidth,
+ const std::vector<CFX_PointF>& points,
+ bool bClosed,
+ float fTension = 0.5f,
+ const CFX_Matrix* pMatrix = nullptr);
+ bool DrawEllipse(CFDE_Pen* pPen,
+ float fPenWidth,
+ const CFX_RectF& rect,
+ const CFX_Matrix* pMatrix = nullptr);
+ bool DrawLines(CFDE_Pen* pPen,
+ float fPenWidth,
+ const std::vector<CFX_PointF>& points,
+ const CFX_Matrix* pMatrix = nullptr);
+ bool DrawLine(CFDE_Pen* pPen,
+ float fPenWidth,
+ const CFX_PointF& pt1,
+ const CFX_PointF& pt2,
+ const CFX_Matrix* pMatrix = nullptr);
+ bool DrawPath(CFDE_Pen* pPen,
+ float fPenWidth,
+ const CFDE_Path* pPath,
+ const CFX_Matrix* pMatrix = nullptr);
+ bool DrawPolygon(CFDE_Pen* pPen,
+ float fPenWidth,
+ const std::vector<CFX_PointF>& points,
+ const CFX_Matrix* pMatrix = nullptr);
+ bool DrawRectangle(CFDE_Pen* pPen,
+ float fPenWidth,
+ const CFX_RectF& rect,
+ const CFX_Matrix* pMatrix = nullptr);
+ bool FillClosedCurve(CFDE_Brush* pBrush,
+ const std::vector<CFX_PointF>& points,
+ float fTension = 0.5f,
+ const CFX_Matrix* pMatrix = nullptr);
+ bool FillEllipse(CFDE_Brush* pBrush,
+ const CFX_RectF& rect,
+ const CFX_Matrix* pMatrix = nullptr);
+ bool FillPath(CFDE_Brush* pBrush,
+ const CFDE_Path* pPath,
+ const CFX_Matrix* pMatrix = nullptr);
+ bool FillPolygon(CFDE_Brush* pBrush,
+ const std::vector<CFX_PointF>& points,
+ const CFX_Matrix* pMatrix = nullptr);
+ bool FillRectangle(CFDE_Brush* pBrush,
+ const CFX_RectF& rect,
+ const CFX_Matrix* pMatrix = nullptr);
+
+ bool DrawSolidString(CFDE_Brush* pBrush,
+ const CFX_RetainPtr<CFGAS_GEFont>& pFont,
+ const FXTEXT_CHARPOS* pCharPos,
+ int32_t iCount,
+ float fFontSize,
+ const CFX_Matrix* pMatrix);
+ bool DrawStringPath(CFDE_Brush* pBrush,
+ const CFX_RetainPtr<CFGAS_GEFont>& pFont,
+ const FXTEXT_CHARPOS* pCharPos,
+ int32_t iCount,
+ float fFontSize,
+ const CFX_Matrix* pMatrix);
+
+ protected:
+ bool CreatePen(CFDE_Pen* pPen,
+ float fPenWidth,
+ CFX_GraphStateData& graphState);
+
+ CFX_RenderDevice* const m_pDevice;
+ CFX_RectF m_rtClip;
+ bool m_bOwnerDevice;
+ int32_t m_iCharCount;
+};
+
+#endif // XFA_FDE_CFDE_RENDERDEVICE_H_
diff --git a/chromium/third_party/pdfium/xfa/fde/cfde_textout.cpp b/chromium/third_party/pdfium/xfa/fde/cfde_textout.cpp
new file mode 100644
index 00000000000..b85bfef3f60
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fde/cfde_textout.cpp
@@ -0,0 +1,790 @@
+// 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
+
+#include "xfa/fde/cfde_textout.h"
+
+#include <algorithm>
+
+#include "core/fxcrt/fx_coordinates.h"
+#include "core/fxcrt/fx_system.h"
+#include "third_party/base/ptr_util.h"
+#include "third_party/base/stl_util.h"
+#include "xfa/fde/cfde_brush.h"
+#include "xfa/fde/cfde_path.h"
+#include "xfa/fde/cfde_pen.h"
+#include "xfa/fde/cfde_renderdevice.h"
+#include "xfa/fgas/layout/fgas_textbreak.h"
+
+FDE_TTOPIECE::FDE_TTOPIECE() = default;
+
+FDE_TTOPIECE::FDE_TTOPIECE(const FDE_TTOPIECE& that) = default;
+
+FDE_TTOPIECE::~FDE_TTOPIECE() = default;
+
+CFDE_TextOut::CFDE_TextOut()
+ : m_pTxtBreak(pdfium::MakeUnique<CFX_TxtBreak>()),
+ m_pFont(nullptr),
+ m_fFontSize(12.0f),
+ m_fLineSpace(m_fFontSize),
+ m_fLinePos(0.0f),
+ m_fTolerance(0.0f),
+ m_iAlignment(0),
+ m_iTxtBkAlignment(0),
+ m_wParagraphBkChar(L'\n'),
+ m_TxtColor(0xFF000000),
+ m_dwStyles(0),
+ m_dwTxtBkStyles(0),
+ m_bElliChanged(false),
+ m_iEllipsisWidth(0),
+ m_ttoLines(5),
+ m_iCurLine(0),
+ m_iCurPiece(0),
+ m_iTotalLines(0) {
+ m_Matrix.SetIdentity();
+ m_rtClip.Reset();
+ m_rtLogicClip.Reset();
+}
+
+CFDE_TextOut::~CFDE_TextOut() {}
+
+void CFDE_TextOut::SetFont(const CFX_RetainPtr<CFGAS_GEFont>& pFont) {
+ ASSERT(pFont);
+ m_pFont = pFont;
+ m_pTxtBreak->SetFont(pFont);
+}
+
+void CFDE_TextOut::SetFontSize(float fFontSize) {
+ ASSERT(fFontSize > 0);
+ m_fFontSize = fFontSize;
+ m_pTxtBreak->SetFontSize(fFontSize);
+}
+
+void CFDE_TextOut::SetTextColor(FX_ARGB color) {
+ m_TxtColor = color;
+}
+
+void CFDE_TextOut::SetStyles(uint32_t dwStyles) {
+ m_dwStyles = dwStyles;
+ m_dwTxtBkStyles = 0;
+ if (dwStyles & FDE_TTOSTYLE_SingleLine)
+ m_dwTxtBkStyles |= FX_LAYOUTSTYLE_SingleLine;
+
+ m_pTxtBreak->SetLayoutStyles(m_dwTxtBkStyles);
+}
+
+void CFDE_TextOut::SetTabWidth(float fTabWidth) {
+ ASSERT(fTabWidth > 1.0f);
+ m_pTxtBreak->SetTabWidth(fTabWidth);
+}
+
+void CFDE_TextOut::SetEllipsisString(const CFX_WideString& wsEllipsis) {
+ m_bElliChanged = true;
+ m_wsEllipsis = wsEllipsis;
+}
+
+void CFDE_TextOut::SetParagraphBreakChar(wchar_t wch) {
+ m_wParagraphBkChar = wch;
+ m_pTxtBreak->SetParagraphBreakChar(wch);
+}
+
+void CFDE_TextOut::SetAlignment(int32_t iAlignment) {
+ m_iAlignment = iAlignment;
+ switch (m_iAlignment) {
+ case FDE_TTOALIGNMENT_TopCenter:
+ case FDE_TTOALIGNMENT_Center:
+ case FDE_TTOALIGNMENT_BottomCenter:
+ m_iTxtBkAlignment = CFX_TxtLineAlignment_Center;
+ break;
+ case FDE_TTOALIGNMENT_TopRight:
+ case FDE_TTOALIGNMENT_CenterRight:
+ case FDE_TTOALIGNMENT_BottomRight:
+ m_iTxtBkAlignment = CFX_TxtLineAlignment_Right;
+ break;
+ default:
+ m_iTxtBkAlignment = CFX_TxtLineAlignment_Left;
+ break;
+ }
+ m_pTxtBreak->SetAlignment(m_iTxtBkAlignment);
+}
+
+void CFDE_TextOut::SetLineSpace(float fLineSpace) {
+ ASSERT(fLineSpace > 1.0f);
+ m_fLineSpace = fLineSpace;
+}
+
+void CFDE_TextOut::SetDIBitmap(const CFX_RetainPtr<CFX_DIBitmap>& pDIB) {
+ ASSERT(pDIB);
+
+ m_pRenderDevice.reset();
+ CFX_FxgeDevice* device = new CFX_FxgeDevice;
+ device->Attach(pDIB, false, nullptr, false);
+ m_pRenderDevice = pdfium::MakeUnique<CFDE_RenderDevice>(device, false);
+}
+
+void CFDE_TextOut::SetRenderDevice(CFX_RenderDevice* pDevice) {
+ ASSERT(pDevice);
+ m_pRenderDevice = pdfium::MakeUnique<CFDE_RenderDevice>(pDevice, false);
+}
+
+void CFDE_TextOut::SetClipRect(const CFX_Rect& rtClip) {
+ m_rtClip = rtClip.As<float>();
+}
+
+void CFDE_TextOut::SetClipRect(const CFX_RectF& rtClip) {
+ m_rtClip = rtClip;
+}
+
+void CFDE_TextOut::SetLogicClipRect(const CFX_RectF& rtClip) {
+ m_rtLogicClip = rtClip;
+}
+
+void CFDE_TextOut::SetMatrix(const CFX_Matrix& matrix) {
+ m_Matrix = matrix;
+}
+
+void CFDE_TextOut::SetLineBreakTolerance(float fTolerance) {
+ m_fTolerance = fTolerance;
+ m_pTxtBreak->SetLineBreakTolerance(m_fTolerance);
+}
+
+int32_t CFDE_TextOut::GetTotalLines() {
+ return m_iTotalLines;
+}
+
+void CFDE_TextOut::CalcLogicSize(const wchar_t* pwsStr,
+ int32_t iLength,
+ CFX_SizeF& size) {
+ CFX_RectF rtText(0.0f, 0.0f, size.width, size.height);
+ CalcLogicSize(pwsStr, iLength, rtText);
+ size = rtText.Size();
+}
+
+void CFDE_TextOut::CalcLogicSize(const wchar_t* pwsStr,
+ int32_t iLength,
+ CFX_RectF& rect) {
+ if (!pwsStr || iLength < 1) {
+ rect.width = 0.0f;
+ rect.height = 0.0f;
+ } else {
+ CalcTextSize(pwsStr, iLength, rect);
+ }
+}
+
+void CFDE_TextOut::CalcTextSize(const wchar_t* pwsStr,
+ int32_t iLength,
+ CFX_RectF& rect) {
+ ASSERT(m_pFont && m_fFontSize >= 1.0f);
+ SetLineWidth(rect);
+ m_iTotalLines = 0;
+ const wchar_t* pStr = pwsStr;
+ bool bHotKey = !!(m_dwStyles & FDE_TTOSTYLE_HotKey);
+ float fWidth = 0.0f;
+ float fHeight = 0.0f;
+ float fStartPos = rect.right();
+ CFX_BreakType dwBreakStatus = CFX_BreakType::None;
+ wchar_t wPreChar = 0;
+ wchar_t wch;
+ wchar_t wBreak = 0;
+ while (iLength-- > 0) {
+ wch = *pStr++;
+ if (wBreak == 0 && (wch == L'\n' || wch == L'\r')) {
+ wBreak = wch;
+ m_pTxtBreak->SetParagraphBreakChar(wch);
+ }
+ if (bHotKey && wch == L'&' && wPreChar != L'&') {
+ wPreChar = wch;
+ continue;
+ }
+ dwBreakStatus = m_pTxtBreak->AppendChar(wch);
+ if (!CFX_BreakTypeNoneOrPiece(dwBreakStatus))
+ RetrieveLineWidth(dwBreakStatus, fStartPos, fWidth, fHeight);
+
+ wPreChar = 0;
+ }
+ dwBreakStatus = m_pTxtBreak->EndBreak(CFX_BreakType::Paragraph);
+ if (!CFX_BreakTypeNoneOrPiece(dwBreakStatus))
+ RetrieveLineWidth(dwBreakStatus, fStartPos, fWidth, fHeight);
+
+ m_pTxtBreak->Reset();
+ float fInc = rect.Height() - fHeight;
+ if (m_iAlignment >= FDE_TTOALIGNMENT_CenterLeft &&
+ m_iAlignment < FDE_TTOALIGNMENT_BottomLeft) {
+ fInc /= 2.0f;
+ } else if (m_iAlignment < FDE_TTOALIGNMENT_CenterLeft) {
+ fInc = 0.0f;
+ }
+ rect.left += fStartPos;
+ rect.top += fInc;
+ rect.width = std::min(fWidth, rect.Width());
+ rect.height = fHeight;
+ if (m_dwStyles & FDE_TTOSTYLE_LastLineHeight)
+ rect.height -= m_fLineSpace - m_fFontSize;
+}
+
+void CFDE_TextOut::SetLineWidth(CFX_RectF& rect) {
+ if ((m_dwStyles & FDE_TTOSTYLE_SingleLine) == 0) {
+ float fLineWidth = 0.0f;
+ if (rect.Width() < 1.0f)
+ rect.width = m_fFontSize * 1000.0f;
+
+ fLineWidth = rect.Width();
+ m_pTxtBreak->SetLineWidth(fLineWidth);
+ }
+}
+
+bool CFDE_TextOut::RetrieveLineWidth(CFX_BreakType dwBreakStatus,
+ float& fStartPos,
+ float& fWidth,
+ float& fHeight) {
+ if (CFX_BreakTypeNoneOrPiece(dwBreakStatus))
+ return false;
+
+ float fLineStep = (m_fLineSpace > m_fFontSize) ? m_fLineSpace : m_fFontSize;
+ bool bLineWrap = !!(m_dwStyles & FDE_TTOSTYLE_LineWrap);
+ float fLineWidth = 0.0f;
+ int32_t iCount = m_pTxtBreak->CountBreakPieces();
+ for (int32_t i = 0; i < iCount; i++) {
+ const CFX_BreakPiece* pPiece = m_pTxtBreak->GetBreakPieceUnstable(i);
+ fLineWidth += static_cast<float>(pPiece->m_iWidth) / 20000.0f;
+ fStartPos =
+ std::min(fStartPos, static_cast<float>(pPiece->m_iStartPos) / 20000.0f);
+ }
+ m_pTxtBreak->ClearBreakPieces();
+ if (dwBreakStatus == CFX_BreakType::Paragraph) {
+ m_pTxtBreak->Reset();
+ }
+ if (!bLineWrap && dwBreakStatus == CFX_BreakType::Line) {
+ fWidth += fLineWidth;
+ } else {
+ fWidth = std::max(fWidth, fLineWidth);
+ fHeight += fLineStep;
+ }
+ m_iTotalLines++;
+ return true;
+}
+
+void CFDE_TextOut::DrawText(const wchar_t* pwsStr,
+ int32_t iLength,
+ int32_t x,
+ int32_t y) {
+ CFX_RectF rtText(static_cast<float>(x), static_cast<float>(y),
+ m_fFontSize * 1000.0f, m_fFontSize * 1000.0f);
+ DrawText(pwsStr, iLength, rtText);
+}
+
+void CFDE_TextOut::DrawText(const wchar_t* pwsStr,
+ int32_t iLength,
+ float x,
+ float y) {
+ DrawText(pwsStr, iLength,
+ CFX_RectF(x, y, m_fFontSize * 1000.0f, m_fFontSize * 1000.0f));
+}
+
+void CFDE_TextOut::DrawText(const wchar_t* pwsStr,
+ int32_t iLength,
+ const CFX_Rect& rect) {
+ DrawText(pwsStr, iLength, rect.As<float>());
+}
+
+void CFDE_TextOut::DrawText(const wchar_t* pwsStr,
+ int32_t iLength,
+ const CFX_RectF& rect) {
+ CFX_RectF rtText(rect.left, rect.top, rect.width, rect.height);
+ CFX_Matrix rm;
+ rm.SetReverse(m_Matrix);
+ rm.TransformRect(rtText);
+ DrawText(pwsStr, iLength, rtText, m_rtClip);
+}
+
+void CFDE_TextOut::DrawLogicText(const wchar_t* pwsStr,
+ int32_t iLength,
+ float x,
+ float y) {
+ CFX_RectF rtText(x, y, m_fFontSize * 1000.0f, m_fFontSize * 1000.0f);
+ DrawLogicText(pwsStr, iLength, rtText);
+}
+
+void CFDE_TextOut::DrawLogicText(const wchar_t* pwsStr,
+ int32_t iLength,
+ const CFX_RectF& rect) {
+ CFX_RectF rtClip(m_rtLogicClip.left, m_rtLogicClip.top, m_rtLogicClip.width,
+ m_rtLogicClip.height);
+ m_Matrix.TransformRect(rtClip);
+ DrawText(pwsStr, iLength, rect, rtClip);
+}
+
+void CFDE_TextOut::DrawText(const wchar_t* pwsStr,
+ int32_t iLength,
+ const CFX_RectF& rect,
+ const CFX_RectF& rtClip) {
+ ASSERT(m_pFont && m_fFontSize >= 1.0f);
+ if (!pwsStr || iLength < 1)
+ return;
+ if (rect.width < m_fFontSize || rect.height < m_fFontSize)
+ return;
+
+ float fLineWidth = rect.width;
+ m_pTxtBreak->SetLineWidth(fLineWidth);
+ m_ttoLines.clear();
+ m_wsText.clear();
+ LoadText(pwsStr, iLength, rect);
+ if (m_dwStyles & FDE_TTOSTYLE_Ellipsis) {
+ ReplaceWidthEllipsis();
+ }
+ Reload(rect);
+ DoAlignment(rect);
+ OnDraw(rtClip);
+}
+
+void CFDE_TextOut::ExpandBuffer(int32_t iSize, int32_t iType) {
+ ASSERT(iSize >= 0);
+ size_t size = iSize;
+ switch (iType) {
+ case 0:
+ if (m_CharWidths.size() < size)
+ m_CharWidths.resize(size, 0);
+ break;
+ case 1:
+ if (m_EllCharWidths.size() < size)
+ m_EllCharWidths.resize(size, 0);
+ break;
+ case 2:
+ if (m_CharPos.size() < size)
+ m_CharPos.resize(size, FXTEXT_CHARPOS());
+ break;
+ }
+}
+
+void CFDE_TextOut::LoadEllipsis() {
+ if (!m_bElliChanged) {
+ return;
+ }
+ m_bElliChanged = false;
+ m_iEllipsisWidth = 0;
+ int32_t iLength = m_wsEllipsis.GetLength();
+ if (iLength < 1) {
+ return;
+ }
+ ExpandBuffer(iLength, 1);
+ const wchar_t* pStr = m_wsEllipsis.c_str();
+ CFX_BreakType dwBreakStatus;
+ wchar_t wch;
+ while (iLength-- > 0) {
+ wch = *pStr++;
+ dwBreakStatus = m_pTxtBreak->AppendChar(wch);
+ if (!CFX_BreakTypeNoneOrPiece(dwBreakStatus))
+ RetrieveEllPieces(&m_EllCharWidths);
+ }
+ dwBreakStatus = m_pTxtBreak->EndBreak(CFX_BreakType::Paragraph);
+ if (!CFX_BreakTypeNoneOrPiece(dwBreakStatus))
+ RetrieveEllPieces(&m_EllCharWidths);
+
+ m_pTxtBreak->Reset();
+}
+
+void CFDE_TextOut::RetrieveEllPieces(std::vector<int32_t>* pCharWidths) {
+ int32_t iCount = m_pTxtBreak->CountBreakPieces();
+ int32_t iCharIndex = 0;
+ for (int32_t i = 0; i < iCount; i++) {
+ const CFX_BreakPiece* pPiece = m_pTxtBreak->GetBreakPieceUnstable(i);
+ int32_t iPieceChars = pPiece->GetLength();
+ for (int32_t j = 0; j < iPieceChars; j++) {
+ (*pCharWidths)[iCharIndex] =
+ std::max(pPiece->GetChar(j)->m_iCharWidth, 0);
+ m_iEllipsisWidth += (*pCharWidths)[iCharIndex];
+ iCharIndex++;
+ }
+ }
+ m_pTxtBreak->ClearBreakPieces();
+}
+
+void CFDE_TextOut::LoadText(const wchar_t* pwsStr,
+ int32_t iLength,
+ const CFX_RectF& rect) {
+ wchar_t* pStr = m_wsText.GetBuffer(iLength);
+ int32_t iTxtLength = iLength;
+ ExpandBuffer(iTxtLength, 0);
+ bool bHotKey = !!(m_dwStyles & FDE_TTOSTYLE_HotKey);
+ bool bLineWrap = !!(m_dwStyles & FDE_TTOSTYLE_LineWrap);
+ float fLineStep = (m_fLineSpace > m_fFontSize) ? m_fLineSpace : m_fFontSize;
+ float fLineStop = rect.bottom();
+ m_fLinePos = rect.top;
+ m_HotKeys.clear();
+ int32_t iStartChar = 0;
+ int32_t iChars = 0;
+ int32_t iPieceWidths = 0;
+ CFX_BreakType dwBreakStatus;
+ wchar_t wch;
+ bool bRet = false;
+ while (iTxtLength-- > 0) {
+ wch = *pwsStr++;
+ if (bHotKey && wch == L'&' && *(pStr - 1) != L'&') {
+ if (iTxtLength > 0)
+ m_HotKeys.push_back(iChars);
+ continue;
+ }
+ *pStr++ = wch;
+ iChars++;
+ dwBreakStatus = m_pTxtBreak->AppendChar(wch);
+ if (!CFX_BreakTypeNoneOrPiece(dwBreakStatus)) {
+ bool bEndofLine =
+ RetrievePieces(dwBreakStatus, iStartChar, iPieceWidths, false, rect);
+ if (bEndofLine &&
+ (bLineWrap || dwBreakStatus == CFX_BreakType::Paragraph ||
+ dwBreakStatus == CFX_BreakType::Page)) {
+ iPieceWidths = 0;
+ m_iCurLine++;
+ m_fLinePos += fLineStep;
+ }
+ if (m_fLinePos + fLineStep > fLineStop) {
+ int32_t iCurLine = bEndofLine ? m_iCurLine - 1 : m_iCurLine;
+ m_ttoLines[iCurLine].SetNewReload(true);
+ bRet = true;
+ break;
+ }
+ }
+ }
+ dwBreakStatus = m_pTxtBreak->EndBreak(CFX_BreakType::Paragraph);
+ if (!CFX_BreakTypeNoneOrPiece(dwBreakStatus) && !bRet)
+ RetrievePieces(dwBreakStatus, iStartChar, iPieceWidths, false, rect);
+
+ m_pTxtBreak->ClearBreakPieces();
+ m_pTxtBreak->Reset();
+ m_wsText.ReleaseBuffer(iLength);
+}
+
+bool CFDE_TextOut::RetrievePieces(CFX_BreakType dwBreakStatus,
+ int32_t& iStartChar,
+ int32_t& iPieceWidths,
+ bool bReload,
+ const CFX_RectF& rect) {
+ bool bSingleLine = !!(m_dwStyles & FDE_TTOSTYLE_SingleLine);
+ bool bLineWrap = !!(m_dwStyles & FDE_TTOSTYLE_LineWrap);
+ float fLineStep = (m_fLineSpace > m_fFontSize) ? m_fLineSpace : m_fFontSize;
+ bool bNeedReload = false;
+ float fLineWidth = rect.Width();
+ int32_t iLineWidth = FXSYS_round(fLineWidth * 20000.0f);
+ int32_t iCount = m_pTxtBreak->CountBreakPieces();
+ for (int32_t i = 0; i < iCount; i++) {
+ const CFX_BreakPiece* pPiece = m_pTxtBreak->GetBreakPieceUnstable(i);
+ int32_t iPieceChars = pPiece->GetLength();
+ int32_t iChar = iStartChar;
+ int32_t iWidth = 0;
+ int32_t j = 0;
+ for (; j < iPieceChars; j++) {
+ const CFX_Char* pTC = pPiece->GetChar(j);
+ int32_t iCurCharWidth = pTC->m_iCharWidth > 0 ? pTC->m_iCharWidth : 0;
+ if (bSingleLine || !bLineWrap) {
+ if (iLineWidth - iPieceWidths - iWidth < iCurCharWidth) {
+ bNeedReload = true;
+ break;
+ }
+ }
+ iWidth += iCurCharWidth;
+ m_CharWidths[iChar++] = iCurCharWidth;
+ }
+ if (j == 0 && !bReload) {
+ m_ttoLines[m_iCurLine].SetNewReload(true);
+ } else if (j > 0) {
+ CFX_RectF rtPiece;
+ rtPiece.left = rect.left + (float)pPiece->m_iStartPos / 20000.0f;
+ rtPiece.top = m_fLinePos;
+ rtPiece.width = iWidth / 20000.0f;
+ rtPiece.height = fLineStep;
+
+ FDE_TTOPIECE ttoPiece;
+ ttoPiece.iStartChar = iStartChar;
+ ttoPiece.iChars = j;
+ ttoPiece.rtPiece = rtPiece;
+ ttoPiece.dwCharStyles = pPiece->m_dwCharStyles;
+ if (FX_IsOdd(pPiece->m_iBidiLevel)) {
+ ttoPiece.dwCharStyles |= FX_TXTCHARSTYLE_OddBidiLevel;
+ }
+ AppendPiece(ttoPiece, bNeedReload, (bReload && i == iCount - 1));
+ }
+ iStartChar += iPieceChars;
+ iPieceWidths += iWidth;
+ }
+ m_pTxtBreak->ClearBreakPieces();
+ return bSingleLine || bLineWrap || bNeedReload ||
+ dwBreakStatus == CFX_BreakType::Paragraph;
+}
+
+void CFDE_TextOut::AppendPiece(const FDE_TTOPIECE& ttoPiece,
+ bool bNeedReload,
+ bool bEnd) {
+ if (m_iCurLine >= pdfium::CollectionSize<int32_t>(m_ttoLines)) {
+ CFDE_TTOLine ttoLine;
+ ttoLine.SetNewReload(bNeedReload);
+ m_iCurPiece = ttoLine.AddPiece(m_iCurPiece, ttoPiece);
+ m_ttoLines.push_back(ttoLine);
+ m_iCurLine = pdfium::CollectionSize<int32_t>(m_ttoLines) - 1;
+ } else {
+ CFDE_TTOLine* pLine = &m_ttoLines[m_iCurLine];
+ pLine->SetNewReload(bNeedReload);
+ m_iCurPiece = pLine->AddPiece(m_iCurPiece, ttoPiece);
+ if (bEnd) {
+ int32_t iPieces = pLine->GetSize();
+ if (m_iCurPiece < iPieces) {
+ pLine->RemoveLast(iPieces - m_iCurPiece - 1);
+ }
+ }
+ }
+ if (!bEnd && bNeedReload)
+ m_iCurPiece = 0;
+}
+
+void CFDE_TextOut::ReplaceWidthEllipsis() {
+ LoadEllipsis();
+ int32_t iLength = m_wsEllipsis.GetLength();
+ if (iLength < 1)
+ return;
+
+ for (auto& line : m_ttoLines) {
+ if (!line.GetNewReload())
+ continue;
+
+ int32_t iEllipsisCharIndex = iLength - 1;
+ int32_t iCharWidth = 0;
+ int32_t iCharCount = 0;
+ int32_t iPiece = line.GetSize();
+ while (iPiece-- > 0) {
+ FDE_TTOPIECE* pPiece = line.GetPtrAt(iPiece);
+ if (!pPiece)
+ break;
+
+ for (int32_t j = pPiece->iChars - 1; j >= 0; j--) {
+ if (iEllipsisCharIndex < 0)
+ break;
+
+ int32_t index = pPiece->iStartChar + j;
+ iCharWidth += m_CharWidths[index];
+ iCharCount++;
+ if (iCharCount <= iLength) {
+ m_wsText.SetAt(index, m_wsEllipsis.GetAt(iEllipsisCharIndex));
+ m_CharWidths[index] = m_EllCharWidths[iEllipsisCharIndex];
+ } else if (iCharWidth <= m_iEllipsisWidth) {
+ m_wsText.SetAt(index, 0);
+ m_CharWidths[index] = 0;
+ }
+ iEllipsisCharIndex--;
+ }
+ if (iEllipsisCharIndex < 0)
+ break;
+ }
+ }
+}
+
+void CFDE_TextOut::Reload(const CFX_RectF& rect) {
+ int i = 0;
+ for (auto& line : m_ttoLines) {
+ if (line.GetNewReload()) {
+ m_iCurLine = i;
+ m_iCurPiece = 0;
+ ReloadLinePiece(&line, rect);
+ }
+ ++i;
+ }
+}
+
+void CFDE_TextOut::ReloadLinePiece(CFDE_TTOLine* pLine, const CFX_RectF& rect) {
+ const wchar_t* pwsStr = m_wsText.c_str();
+ int32_t iPieceWidths = 0;
+ FDE_TTOPIECE* pPiece = pLine->GetPtrAt(0);
+ int32_t iStartChar = pPiece->iStartChar;
+ m_fLinePos = pPiece->rtPiece.top;
+ int32_t iPieceCount = pLine->GetSize();
+ int32_t iPieceIndex = 0;
+ CFX_BreakType dwBreakStatus = CFX_BreakType::None;
+ wchar_t wch;
+ while (iPieceIndex < iPieceCount) {
+ int32_t iStar = iStartChar;
+ int32_t iEnd = pPiece->iChars + iStar;
+ while (iStar < iEnd) {
+ wch = *(pwsStr + iStar);
+ dwBreakStatus = m_pTxtBreak->AppendChar(wch);
+ if (!CFX_BreakTypeNoneOrPiece(dwBreakStatus))
+ RetrievePieces(dwBreakStatus, iStartChar, iPieceWidths, true, rect);
+ iStar++;
+ }
+ iPieceIndex++;
+ pPiece = pLine->GetPtrAt(iPieceIndex);
+ }
+ dwBreakStatus = m_pTxtBreak->EndBreak(CFX_BreakType::Paragraph);
+ if (!CFX_BreakTypeNoneOrPiece(dwBreakStatus))
+ RetrievePieces(dwBreakStatus, iStartChar, iPieceWidths, true, rect);
+
+ m_pTxtBreak->Reset();
+}
+
+void CFDE_TextOut::DoAlignment(const CFX_RectF& rect) {
+ if (m_ttoLines.empty())
+ return;
+
+ float fLineStopS = rect.bottom();
+ FDE_TTOPIECE* pFirstPiece = m_ttoLines.back().GetPtrAt(0);
+ if (!pFirstPiece)
+ return;
+
+ float fLineStopD = pFirstPiece->rtPiece.bottom();
+ float fInc = fLineStopS - fLineStopD;
+ if (m_iAlignment >= FDE_TTOALIGNMENT_CenterLeft &&
+ m_iAlignment < FDE_TTOALIGNMENT_BottomLeft) {
+ fInc /= 2.0f;
+ } else if (m_iAlignment < FDE_TTOALIGNMENT_CenterLeft) {
+ fInc = 0.0f;
+ }
+ if (fInc < 1.0f)
+ return;
+ for (auto& line : m_ttoLines) {
+ int32_t iPieces = line.GetSize();
+ for (int32_t j = 0; j < iPieces; j++) {
+ FDE_TTOPIECE* pPiece = line.GetPtrAt(j);
+ pPiece->rtPiece.top += fInc;
+ }
+ }
+}
+
+void CFDE_TextOut::OnDraw(const CFX_RectF& rtClip) {
+ if (!m_pRenderDevice || m_ttoLines.empty())
+ return;
+
+ auto pBrush = pdfium::MakeUnique<CFDE_Brush>();
+ pBrush->SetColor(m_TxtColor);
+ m_pRenderDevice->SaveState();
+ if (rtClip.Width() > 0.0f && rtClip.Height() > 0.0f)
+ m_pRenderDevice->SetClipRect(rtClip);
+
+ auto pPen = pdfium::MakeUnique<CFDE_Pen>();
+ pPen->SetColor(m_TxtColor);
+
+ for (auto& line : m_ttoLines) {
+ int32_t iPieces = line.GetSize();
+ for (int32_t j = 0; j < iPieces; j++) {
+ FDE_TTOPIECE* pPiece = line.GetPtrAt(j);
+ if (!pPiece)
+ continue;
+
+ int32_t iCount = GetDisplayPos(pPiece);
+ if (iCount > 0) {
+ m_pRenderDevice->DrawString(pBrush.get(), m_pFont, m_CharPos.data(),
+ iCount, m_fFontSize, &m_Matrix);
+ }
+ DrawLine(pPiece, pPen.get());
+ }
+ }
+ m_pRenderDevice->RestoreState();
+}
+
+int32_t CFDE_TextOut::GetDisplayPos(FDE_TTOPIECE* pPiece) {
+ FX_TXTRUN tr = ToTextRun(pPiece);
+ ExpandBuffer(tr.iLength, 2);
+ return m_pTxtBreak->GetDisplayPos(&tr, m_CharPos.data());
+}
+
+int32_t CFDE_TextOut::GetCharRects(const FDE_TTOPIECE* pPiece) {
+ FX_TXTRUN tr = ToTextRun(pPiece);
+ m_rectArray = m_pTxtBreak->GetCharRects(&tr);
+ return pdfium::CollectionSize<int32_t>(m_rectArray);
+}
+
+FX_TXTRUN CFDE_TextOut::ToTextRun(const FDE_TTOPIECE* pPiece) {
+ FX_TXTRUN tr;
+ tr.wsStr = m_wsText + pPiece->iStartChar;
+ tr.pWidths = &m_CharWidths[pPiece->iStartChar];
+ tr.iLength = pPiece->iChars;
+ tr.pFont = m_pFont;
+ tr.fFontSize = m_fFontSize;
+ tr.dwStyles = m_dwTxtBkStyles;
+ tr.dwCharStyles = pPiece->dwCharStyles;
+ tr.wLineBreakChar = m_wParagraphBkChar;
+ tr.pRect = &pPiece->rtPiece;
+ return tr;
+}
+
+void CFDE_TextOut::DrawLine(const FDE_TTOPIECE* pPiece, CFDE_Pen* pPen) {
+ bool bUnderLine = !!(m_dwStyles & FDE_TTOSTYLE_Underline);
+ bool bStrikeOut = !!(m_dwStyles & FDE_TTOSTYLE_Strikeout);
+ bool bHotKey = !!(m_dwStyles & FDE_TTOSTYLE_HotKey);
+ if (!bUnderLine && !bStrikeOut && !bHotKey)
+ return;
+
+ auto pPath = pdfium::MakeUnique<CFDE_Path>();
+ int32_t iLineCount = 0;
+ CFX_RectF rtText = pPiece->rtPiece;
+ CFX_PointF pt1, pt2;
+ if (bUnderLine) {
+ pt1.x = rtText.left;
+ pt1.y = rtText.bottom();
+ pt2.x = rtText.right();
+ pt2.y = rtText.bottom();
+ pPath->AddLine(pt1, pt2);
+ iLineCount++;
+ }
+ if (bStrikeOut) {
+ pt1.x = rtText.left;
+ pt1.y = rtText.bottom() - rtText.height * 2.0f / 5.0f;
+ pt2.x = rtText.right();
+ pt2.y = pt1.y;
+ pPath->AddLine(pt1, pt2);
+ iLineCount++;
+ }
+ if (bHotKey) {
+ if (GetCharRects(pPiece) > 0) {
+ for (int32_t iCharIndex : m_HotKeys) {
+ if (iCharIndex >= pPiece->iStartChar &&
+ iCharIndex < pPiece->iStartChar + pPiece->iChars) {
+ CFX_RectF rect = m_rectArray[iCharIndex - pPiece->iStartChar];
+ pt1.x = rect.left;
+ pt1.y = rect.bottom();
+ pt2.x = rect.right();
+ pt2.y = rect.bottom();
+ pPath->AddLine(pt1, pt2);
+ iLineCount++;
+ }
+ }
+ }
+ }
+ if (iLineCount > 0)
+ m_pRenderDevice->DrawPath(pPen, 1, pPath.get(), &m_Matrix);
+}
+
+CFDE_TTOLine::CFDE_TTOLine() : m_bNewReload(false) {}
+
+CFDE_TTOLine::CFDE_TTOLine(const CFDE_TTOLine& ttoLine) : m_pieces(5) {
+ m_bNewReload = ttoLine.m_bNewReload;
+ m_pieces = ttoLine.m_pieces;
+}
+
+CFDE_TTOLine::~CFDE_TTOLine() {}
+
+int32_t CFDE_TTOLine::AddPiece(int32_t index, const FDE_TTOPIECE& ttoPiece) {
+ if (index >= pdfium::CollectionSize<int32_t>(m_pieces)) {
+ m_pieces.push_back(ttoPiece);
+ return pdfium::CollectionSize<int32_t>(m_pieces);
+ }
+ m_pieces[index] = ttoPiece;
+ return index;
+}
+
+int32_t CFDE_TTOLine::GetSize() const {
+ return pdfium::CollectionSize<int32_t>(m_pieces);
+}
+
+FDE_TTOPIECE* CFDE_TTOLine::GetPtrAt(int32_t index) {
+ return pdfium::IndexInBounds(m_pieces, index) ? &m_pieces[index] : nullptr;
+}
+
+void CFDE_TTOLine::RemoveLast(int32_t icount) {
+ if (icount < 0)
+ return;
+ icount = std::min(icount, pdfium::CollectionSize<int32_t>(m_pieces));
+ m_pieces.erase(m_pieces.end() - icount, m_pieces.end());
+}
+
+void CFDE_TTOLine::RemoveAll() {
+ m_pieces.clear();
+}
diff --git a/chromium/third_party/pdfium/xfa/fde/cfde_textout.h b/chromium/third_party/pdfium/xfa/fde/cfde_textout.h
new file mode 100644
index 00000000000..c505c0737f3
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fde/cfde_textout.h
@@ -0,0 +1,175 @@
+// 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 XFA_FDE_CFDE_TEXTOUT_H_
+#define XFA_FDE_CFDE_TEXTOUT_H_
+
+#include <deque>
+#include <memory>
+#include <vector>
+
+#include "core/fxcrt/cfx_char.h"
+#include "core/fxge/cfx_fxgedevice.h"
+#include "core/fxge/cfx_renderdevice.h"
+#include "core/fxge/fx_dib.h"
+#include "xfa/fgas/font/cfgas_fontmgr.h"
+
+#define FDE_TTOSTYLE_Underline 0x0001
+#define FDE_TTOSTYLE_Strikeout 0x0002
+#define FDE_TTOSTYLE_SingleLine 0x0010
+#define FDE_TTOSTYLE_HotKey 0x0040
+#define FDE_TTOSTYLE_Ellipsis 0x0080
+#define FDE_TTOSTYLE_LineWrap 0x0100
+#define FDE_TTOSTYLE_LastLineHeight 0x1000
+#define FDE_TTOALIGNMENT_TopLeft 0
+#define FDE_TTOALIGNMENT_TopCenter 1
+#define FDE_TTOALIGNMENT_TopRight 2
+#define FDE_TTOALIGNMENT_TopAuto 3
+#define FDE_TTOALIGNMENT_CenterLeft 4
+#define FDE_TTOALIGNMENT_Center 5
+#define FDE_TTOALIGNMENT_CenterRight 6
+#define FDE_TTOALIGNMENT_CenterAuto 7
+#define FDE_TTOALIGNMENT_BottomLeft 8
+#define FDE_TTOALIGNMENT_BottomCenter 9
+#define FDE_TTOALIGNMENT_BottomRight 10
+#define FDE_TTOALIGNMENT_BottomAuto 11
+
+class CFDE_Pen;
+class CFDE_RenderDevice;
+class CFX_RenderDevice;
+class CFX_TxtBreak;
+struct FX_TXTRUN;
+
+struct FDE_TTOPIECE {
+ FDE_TTOPIECE();
+ FDE_TTOPIECE(const FDE_TTOPIECE& that);
+ ~FDE_TTOPIECE();
+
+ int32_t iStartChar;
+ int32_t iChars;
+ uint32_t dwCharStyles;
+ CFX_RectF rtPiece;
+};
+
+class CFDE_TTOLine {
+ public:
+ CFDE_TTOLine();
+ CFDE_TTOLine(const CFDE_TTOLine& ttoLine);
+ ~CFDE_TTOLine();
+
+ bool GetNewReload() const { return m_bNewReload; }
+ void SetNewReload(bool reload) { m_bNewReload = reload; }
+ int32_t AddPiece(int32_t index, const FDE_TTOPIECE& ttoPiece);
+ int32_t GetSize() const;
+ FDE_TTOPIECE* GetPtrAt(int32_t index);
+ void RemoveLast(int32_t iCount);
+ void RemoveAll();
+
+ private:
+ bool m_bNewReload;
+ std::deque<FDE_TTOPIECE> m_pieces;
+};
+
+class CFDE_TextOut {
+ public:
+ CFDE_TextOut();
+ ~CFDE_TextOut();
+
+ void SetFont(const CFX_RetainPtr<CFGAS_GEFont>& pFont);
+ void SetFontSize(float fFontSize);
+ void SetTextColor(FX_ARGB color);
+ void SetStyles(uint32_t dwStyles);
+ void SetTabWidth(float fTabWidth);
+ void SetEllipsisString(const CFX_WideString& wsEllipsis);
+ void SetParagraphBreakChar(wchar_t wch);
+ void SetAlignment(int32_t iAlignment);
+ void SetLineSpace(float fLineSpace);
+ void SetDIBitmap(const CFX_RetainPtr<CFX_DIBitmap>& pDIB);
+ void SetRenderDevice(CFX_RenderDevice* pDevice);
+ void SetClipRect(const CFX_Rect& rtClip);
+ void SetClipRect(const CFX_RectF& rtClip);
+ void SetMatrix(const CFX_Matrix& matrix);
+ void SetLineBreakTolerance(float fTolerance);
+
+ void DrawText(const wchar_t* pwsStr, int32_t iLength, int32_t x, int32_t y);
+ void DrawText(const wchar_t* pwsStr, int32_t iLength, float x, float y);
+ void DrawText(const wchar_t* pwsStr, int32_t iLength, const CFX_Rect& rect);
+ void DrawText(const wchar_t* pwsStr, int32_t iLength, const CFX_RectF& rect);
+
+ void SetLogicClipRect(const CFX_RectF& rtClip);
+ void CalcLogicSize(const wchar_t* pwsStr, int32_t iLength, CFX_SizeF& size);
+ void CalcLogicSize(const wchar_t* pwsStr, int32_t iLength, CFX_RectF& rect);
+ void DrawLogicText(const wchar_t* pwsStr, int32_t iLength, float x, float y);
+ void DrawLogicText(const wchar_t* pwsStr,
+ int32_t iLength,
+ const CFX_RectF& rect);
+ int32_t GetTotalLines();
+
+ private:
+ void CalcTextSize(const wchar_t* pwsStr, int32_t iLength, CFX_RectF& rect);
+ bool RetrieveLineWidth(CFX_BreakType dwBreakStatus,
+ float& fStartPos,
+ float& fWidth,
+ float& fHeight);
+ void SetLineWidth(CFX_RectF& rect);
+ void DrawText(const wchar_t* pwsStr,
+ int32_t iLength,
+ const CFX_RectF& rect,
+ const CFX_RectF& rtClip);
+ void LoadText(const wchar_t* pwsStr, int32_t iLength, const CFX_RectF& rect);
+ void LoadEllipsis();
+ void ExpandBuffer(int32_t iSize, int32_t iType);
+ void RetrieveEllPieces(std::vector<int32_t>* pCharWidths);
+
+ void Reload(const CFX_RectF& rect);
+ void ReloadLinePiece(CFDE_TTOLine* pLine, const CFX_RectF& rect);
+ bool RetrievePieces(CFX_BreakType dwBreakStatus,
+ int32_t& iStartChar,
+ int32_t& iPieceWidths,
+ bool bReload,
+ const CFX_RectF& rect);
+ void AppendPiece(const FDE_TTOPIECE& ttoPiece, bool bNeedReload, bool bEnd);
+ void ReplaceWidthEllipsis();
+ void DoAlignment(const CFX_RectF& rect);
+ void OnDraw(const CFX_RectF& rtClip);
+ int32_t GetDisplayPos(FDE_TTOPIECE* pPiece);
+ int32_t GetCharRects(const FDE_TTOPIECE* pPiece);
+
+ FX_TXTRUN ToTextRun(const FDE_TTOPIECE* pPiece);
+ void DrawLine(const FDE_TTOPIECE* pPiece, CFDE_Pen* pPen);
+
+ std::unique_ptr<CFX_TxtBreak> m_pTxtBreak;
+ CFX_RetainPtr<CFGAS_GEFont> m_pFont;
+ float m_fFontSize;
+ float m_fLineSpace;
+ float m_fLinePos;
+ float m_fTolerance;
+ int32_t m_iAlignment;
+ int32_t m_iTxtBkAlignment;
+ std::vector<int32_t> m_CharWidths;
+ std::vector<int32_t> m_EllCharWidths;
+ wchar_t m_wParagraphBkChar;
+ FX_ARGB m_TxtColor;
+ uint32_t m_dwStyles;
+ uint32_t m_dwTxtBkStyles;
+ CFX_WideString m_wsEllipsis;
+ bool m_bElliChanged;
+ int32_t m_iEllipsisWidth;
+ CFX_WideString m_wsText;
+ CFX_RectF m_rtClip;
+ CFX_RectF m_rtLogicClip;
+ CFX_Matrix m_Matrix;
+ std::deque<CFDE_TTOLine> m_ttoLines;
+ int32_t m_iCurLine;
+ int32_t m_iCurPiece;
+ int32_t m_iTotalLines;
+ std::vector<FXTEXT_CHARPOS> m_CharPos;
+ std::unique_ptr<CFDE_RenderDevice> m_pRenderDevice;
+ std::vector<int32_t> m_HotKeys;
+ std::vector<CFX_RectF> m_rectArray;
+};
+
+#endif // XFA_FDE_CFDE_TEXTOUT_H_
diff --git a/chromium/third_party/pdfium/xfa/fde/cfde_txtedtbuf.cpp b/chromium/third_party/pdfium/xfa/fde/cfde_txtedtbuf.cpp
index 1c2e0d1f3ff..dc88704a6c5 100644
--- a/chromium/third_party/pdfium/xfa/fde/cfde_txtedtbuf.cpp
+++ b/chromium/third_party/pdfium/xfa/fde/cfde_txtedtbuf.cpp
@@ -44,7 +44,7 @@ void CFDE_TxtEdtBuf::SetText(const CFX_WideString& wsText) {
m_chunks.push_back(NewChunk());
int32_t nTotalCount = m_chunks.size();
- const FX_WCHAR* lpSrcBuf = wsText.c_str();
+ const wchar_t* lpSrcBuf = wsText.c_str();
int32_t nLeave = nTextLength;
int32_t nCopyedLength = GetChunkSize();
for (i = 0; i < nTotalCount && nLeave > 0; i++) {
@@ -53,8 +53,7 @@ void CFDE_TxtEdtBuf::SetText(const CFX_WideString& wsText) {
}
ChunkHeader* chunk = m_chunks[i].get();
- FXSYS_memcpy(chunk->wChars.get(), lpSrcBuf,
- nCopyedLength * sizeof(FX_WCHAR));
+ memcpy(chunk->wChars.get(), lpSrcBuf, nCopyedLength * sizeof(wchar_t));
nLeave -= nCopyedLength;
lpSrcBuf += nCopyedLength;
chunk->nUsed = nCopyedLength;
@@ -66,7 +65,7 @@ CFX_WideString CFDE_TxtEdtBuf::GetText() const {
return GetRange(0, m_nTotal);
}
-FX_WCHAR CFDE_TxtEdtBuf::GetCharByIndex(int32_t nIndex) const {
+wchar_t CFDE_TxtEdtBuf::GetCharByIndex(int32_t nIndex) const {
ASSERT(nIndex >= 0 && nIndex < GetTextLength());
ChunkHeader* pChunkHeader = nullptr;
@@ -79,7 +78,7 @@ FX_WCHAR CFDE_TxtEdtBuf::GetCharByIndex(int32_t nIndex) const {
}
ASSERT(pChunkHeader);
- FX_WCHAR* buf = pChunkHeader->wChars.get();
+ wchar_t* buf = pChunkHeader->wChars.get();
return buf[pChunkHeader->nUsed - (nTotal - nIndex)];
}
@@ -98,17 +97,17 @@ CFX_WideString CFDE_TxtEdtBuf::GetRange(int32_t nBegin, int32_t nLength) const {
int32_t nCount = m_chunks.size();
CFX_WideString wsText;
- FX_WCHAR* lpDstBuf = wsText.GetBuffer(nLength);
+ wchar_t* lpDstBuf = wsText.GetBuffer(nLength);
int32_t nChunkIndex = chunkIndex;
ChunkHeader* chunkHeader = m_chunks[nChunkIndex].get();
int32_t nCopyLength = chunkHeader->nUsed - charIndex;
- FX_WCHAR* lpSrcBuf = chunkHeader->wChars.get() + charIndex;
+ wchar_t* lpSrcBuf = chunkHeader->wChars.get() + charIndex;
while (nLeave > 0) {
if (nLeave <= nCopyLength) {
nCopyLength = nLeave;
}
- FXSYS_memcpy(lpDstBuf, lpSrcBuf, nCopyLength * sizeof(FX_WCHAR));
+ memcpy(lpDstBuf, lpSrcBuf, nCopyLength * sizeof(wchar_t));
nChunkIndex++;
if (nChunkIndex >= nCount) {
break;
@@ -125,7 +124,7 @@ CFX_WideString CFDE_TxtEdtBuf::GetRange(int32_t nBegin, int32_t nLength) const {
}
void CFDE_TxtEdtBuf::Insert(int32_t nPos,
- const FX_WCHAR* lpText,
+ const wchar_t* lpText,
int32_t nLength) {
ASSERT(nPos >= 0 && nPos <= m_nTotal);
ASSERT(nLength > 0);
@@ -141,8 +140,8 @@ void CFDE_TxtEdtBuf::Insert(int32_t nPos,
ChunkHeader* chunk = m_chunks[chunkIndex].get();
int32_t nCopy = chunk->nUsed - charIndex;
- FXSYS_memcpy(newChunk->wChars.get(), chunk->wChars.get() + charIndex,
- nCopy * sizeof(FX_WCHAR));
+ memcpy(newChunk->wChars.get(), chunk->wChars.get() + charIndex,
+ nCopy * sizeof(wchar_t));
chunk->nUsed -= nCopy;
chunkIndex++;
@@ -157,8 +156,8 @@ void CFDE_TxtEdtBuf::Insert(int32_t nPos,
chunkIndex--;
int32_t nFree = GetChunkSize() - chunk->nUsed;
int32_t nCopy = std::min(nLengthTemp, nFree);
- FXSYS_memcpy(chunk->wChars.get() + chunk->nUsed, lpText,
- nCopy * sizeof(FX_WCHAR));
+ memcpy(chunk->wChars.get() + chunk->nUsed, lpText,
+ nCopy * sizeof(wchar_t));
lpText += nCopy;
nLengthTemp -= nCopy;
chunk->nUsed += nCopy;
@@ -170,7 +169,7 @@ void CFDE_TxtEdtBuf::Insert(int32_t nPos,
auto chunk = NewChunk();
int32_t nCopy = std::min(nLengthTemp, GetChunkSize());
- FXSYS_memcpy(chunk->wChars.get(), lpText, nCopy * sizeof(FX_WCHAR));
+ memcpy(chunk->wChars.get(), lpText, nCopy * sizeof(wchar_t));
lpText += nCopy;
nLengthTemp -= nCopy;
chunk->nUsed = nCopy;
@@ -193,9 +192,8 @@ void CFDE_TxtEdtBuf::Delete(int32_t nIndex, int32_t nLength) {
int32_t nMovePart = chunk->nUsed - nFirstPart;
if (nMovePart != 0) {
int32_t nDelete = std::min(nFirstPart, nLength);
- FXSYS_memmove(chunk->wChars.get() + nFirstPart - nDelete,
- chunk->wChars.get() + nFirstPart,
- nMovePart * sizeof(FX_WCHAR));
+ memmove(chunk->wChars.get() + nFirstPart - nDelete,
+ chunk->wChars.get() + nFirstPart, nMovePart * sizeof(wchar_t));
chunk->nUsed -= nDelete;
nLength -= nDelete;
endChunkIndex--;
@@ -255,7 +253,7 @@ std::tuple<int32_t, int32_t> CFDE_TxtEdtBuf::Index2CP(int32_t nIndex) const {
std::unique_ptr<CFDE_TxtEdtBuf::ChunkHeader> CFDE_TxtEdtBuf::NewChunk() {
auto chunk = pdfium::MakeUnique<ChunkHeader>();
- chunk->wChars.reset(FX_Alloc(FX_WCHAR, GetChunkSize()));
+ chunk->wChars.reset(FX_Alloc(wchar_t, GetChunkSize()));
chunk->nUsed = 0;
return chunk;
}
@@ -264,7 +262,7 @@ CFDE_TxtEdtBuf::ChunkHeader::ChunkHeader() {}
CFDE_TxtEdtBuf::ChunkHeader::~ChunkHeader() {}
-CFDE_TxtEdtBuf::Iterator::Iterator(CFDE_TxtEdtBuf* pBuf, FX_WCHAR wcAlias)
+CFDE_TxtEdtBuf::Iterator::Iterator(CFDE_TxtEdtBuf* pBuf, wchar_t wcAlias)
: m_pBuf(pBuf),
m_nCurChunk(0),
m_nCurIndex(0),
@@ -332,10 +330,10 @@ int32_t CFDE_TxtEdtBuf::Iterator::GetAt() const {
return m_nIndex;
}
-FX_WCHAR CFDE_TxtEdtBuf::Iterator::GetChar() {
+wchar_t CFDE_TxtEdtBuf::Iterator::GetChar() {
ASSERT(m_nIndex >= 0 && m_nIndex < m_pBuf->m_nTotal);
if (m_Alias == 0 || m_nIndex == (m_pBuf->m_nTotal - 1)) {
- FX_WCHAR* buf = m_pBuf->m_chunks[m_nCurChunk]->wChars.get();
+ wchar_t* buf = m_pBuf->m_chunks[m_nCurChunk]->wChars.get();
return buf[m_nCurIndex];
}
return m_Alias;
diff --git a/chromium/third_party/pdfium/xfa/fde/cfde_txtedtbuf.h b/chromium/third_party/pdfium/xfa/fde/cfde_txtedtbuf.h
index 9eeee5632ef..650d375bf81 100644
--- a/chromium/third_party/pdfium/xfa/fde/cfde_txtedtbuf.h
+++ b/chromium/third_party/pdfium/xfa/fde/cfde_txtedtbuf.h
@@ -13,7 +13,7 @@
#include "core/fxcrt/fx_basic.h"
#include "core/fxcrt/fx_system.h"
-#include "xfa/fde/ifx_chariter.h"
+#include "core/fxcrt/ifx_chariter.h"
class IFX_Pause;
@@ -21,11 +21,11 @@ class CFDE_TxtEdtBuf {
public:
class Iterator : public IFX_CharIter {
public:
- explicit Iterator(CFDE_TxtEdtBuf* pBuf, FX_WCHAR wcAlias = 0);
+ explicit Iterator(CFDE_TxtEdtBuf* pBuf, wchar_t wcAlias = 0);
~Iterator() override;
bool Next(bool bPrev = false) override;
- FX_WCHAR GetChar() override;
+ wchar_t GetChar() override;
void SetAt(int32_t nIndex) override;
int32_t GetAt() const override;
@@ -38,7 +38,7 @@ class CFDE_TxtEdtBuf {
int32_t m_nCurChunk;
int32_t m_nCurIndex;
int32_t m_nIndex;
- FX_WCHAR m_Alias;
+ wchar_t m_Alias;
};
CFDE_TxtEdtBuf();
@@ -50,10 +50,10 @@ class CFDE_TxtEdtBuf {
void SetText(const CFX_WideString& wsText);
CFX_WideString GetText() const;
- FX_WCHAR GetCharByIndex(int32_t nIndex) const;
+ wchar_t GetCharByIndex(int32_t nIndex) const;
CFX_WideString GetRange(int32_t nBegin, int32_t nCount) const;
- void Insert(int32_t nPos, const FX_WCHAR* lpText, int32_t nLength);
+ void Insert(int32_t nPos, const wchar_t* lpText, int32_t nLength);
void Delete(int32_t nIndex, int32_t nLength);
void Clear(bool bRelease);
@@ -67,7 +67,7 @@ class CFDE_TxtEdtBuf {
~ChunkHeader();
int32_t nUsed;
- std::unique_ptr<FX_WCHAR, FxFreeDeleter> wChars;
+ std::unique_ptr<wchar_t, FxFreeDeleter> wChars;
};
void SetChunkSizeForTesting(size_t size);
diff --git a/chromium/third_party/pdfium/xfa/fde/cfde_txtedtbuf_unittest.cpp b/chromium/third_party/pdfium/xfa/fde/cfde_txtedtbuf_unittest.cpp
index 9c564093e58..aa80a66b606 100644
--- a/chromium/third_party/pdfium/xfa/fde/cfde_txtedtbuf_unittest.cpp
+++ b/chromium/third_party/pdfium/xfa/fde/cfde_txtedtbuf_unittest.cpp
@@ -8,12 +8,14 @@
#include "testing/test_support.h"
#include "third_party/base/ptr_util.h"
-class CFDE_TxtEdtBufTest : public testing::Test {
+class CFDE_TxtEdtBufTest : public pdfium::FPDF_Test {
public:
void SetUp() override {
+ FPDF_Test::SetUp();
buf_ = pdfium::MakeUnique<CFDE_TxtEdtBuf>();
buf_->SetChunkSizeForTesting(5);
}
+
size_t ChunkCount() const { return buf_->m_chunks.size(); }
std::unique_ptr<CFDE_TxtEdtBuf> buf_;
diff --git a/chromium/third_party/pdfium/xfa/fde/cfde_txtedtdorecord_insert.cpp b/chromium/third_party/pdfium/xfa/fde/cfde_txtedtdorecord_insert.cpp
index b80b15dff68..fe79960ebcb 100644
--- a/chromium/third_party/pdfium/xfa/fde/cfde_txtedtdorecord_insert.cpp
+++ b/chromium/third_party/pdfium/xfa/fde/cfde_txtedtdorecord_insert.cpp
@@ -12,12 +12,12 @@
CFDE_TxtEdtDoRecord_Insert::CFDE_TxtEdtDoRecord_Insert(
CFDE_TxtEdtEngine* pEngine,
int32_t nCaret,
- const FX_WCHAR* lpText,
+ const wchar_t* lpText,
int32_t nLength)
: m_pEngine(pEngine), m_nCaret(nCaret) {
ASSERT(pEngine);
- FX_WCHAR* lpBuffer = m_wsInsert.GetBuffer(nLength);
- FXSYS_memcpy(lpBuffer, lpText, nLength * sizeof(FX_WCHAR));
+ wchar_t* lpBuffer = m_wsInsert.GetBuffer(nLength);
+ memcpy(lpBuffer, lpText, nLength * sizeof(wchar_t));
m_wsInsert.ReleaseBuffer();
}
diff --git a/chromium/third_party/pdfium/xfa/fde/cfde_txtedtdorecord_insert.h b/chromium/third_party/pdfium/xfa/fde/cfde_txtedtdorecord_insert.h
index e80453e9e3c..05922378d33 100644
--- a/chromium/third_party/pdfium/xfa/fde/cfde_txtedtdorecord_insert.h
+++ b/chromium/third_party/pdfium/xfa/fde/cfde_txtedtdorecord_insert.h
@@ -17,7 +17,7 @@ class CFDE_TxtEdtDoRecord_Insert : public IFDE_TxtEdtDoRecord {
public:
CFDE_TxtEdtDoRecord_Insert(CFDE_TxtEdtEngine* pEngine,
int32_t nCaret,
- const FX_WCHAR* lpText,
+ const wchar_t* lpText,
int32_t nLength);
~CFDE_TxtEdtDoRecord_Insert() override;
diff --git a/chromium/third_party/pdfium/xfa/fde/cfde_txtedtengine.cpp b/chromium/third_party/pdfium/xfa/fde/cfde_txtedtengine.cpp
index a61f6ab4d90..b6471766db6 100644
--- a/chromium/third_party/pdfium/xfa/fde/cfde_txtedtengine.cpp
+++ b/chromium/third_party/pdfium/xfa/fde/cfde_txtedtengine.cpp
@@ -7,15 +7,16 @@
#include "xfa/fde/cfde_txtedtengine.h"
#include <algorithm>
+#include <utility>
+#include "core/fxcrt/ifx_chariter.h"
#include "third_party/base/ptr_util.h"
+#include "xfa/fde/cfde_textout.h"
#include "xfa/fde/cfde_txtedtbuf.h"
#include "xfa/fde/cfde_txtedtdorecord_deleterange.h"
#include "xfa/fde/cfde_txtedtdorecord_insert.h"
#include "xfa/fde/cfde_txtedtpage.h"
#include "xfa/fde/cfde_txtedtparag.h"
-#include "xfa/fde/ifx_chariter.h"
-#include "xfa/fde/tto/fde_textout.h"
#include "xfa/fgas/layout/fgas_textbreak.h"
#include "xfa/fwl/cfwl_edit.h"
@@ -37,10 +38,8 @@ FDE_TXTEDTPARAMS::FDE_TXTEDTPARAMS()
dwFontColor(0xff000000),
fLineSpace(10.0f),
fTabWidth(36),
- bTabEquidistant(false),
wDefChar(0xFEFF),
wLineBreakChar('\n'),
- nCharRotation(0),
nLineEnd(0),
nHorzScale(100),
fCharSpace(0),
@@ -53,7 +52,7 @@ FDE_TXTEDT_TEXTCHANGE_INFO::FDE_TXTEDT_TEXTCHANGE_INFO() {}
FDE_TXTEDT_TEXTCHANGE_INFO::~FDE_TXTEDT_TEXTCHANGE_INFO() {}
CFDE_TxtEdtEngine::CFDE_TxtEdtEngine()
- : m_pTxtBuf(new CFDE_TxtEdtBuf()),
+ : m_pTxtBuf(pdfium::MakeUnique<CFDE_TxtEdtBuf>()),
m_nPageLineCount(20),
m_nLineCount(0),
m_nAnchorPos(-1),
@@ -81,11 +80,11 @@ CFDE_TxtEdtEngine::~CFDE_TxtEdtEngine() {
void CFDE_TxtEdtEngine::SetEditParams(const FDE_TXTEDTPARAMS& params) {
if (!m_pTextBreak)
- m_pTextBreak = pdfium::MakeUnique<CFX_TxtBreak>(FX_TXTBREAKPOLICY_None);
+ m_pTextBreak = pdfium::MakeUnique<CFX_TxtBreak>();
m_Param = params;
m_wLineEnd = params.wLineBreakChar;
- m_bAutoLineEnd = (m_Param.nLineEnd == FDE_TXTEDIT_LINEEND_Auto);
+ m_bAutoLineEnd = m_Param.nLineEnd == FDE_TXTEDIT_LINEEND_Auto;
UpdateTxtBreak();
}
@@ -100,11 +99,10 @@ int32_t CFDE_TxtEdtEngine::CountPages() const {
return ((m_nLineCount - 1) / m_nPageLineCount) + 1;
}
-IFDE_TxtEdtPage* CFDE_TxtEdtEngine::GetPage(int32_t nIndex) {
- if (m_PagePtrArray.GetSize() <= nIndex) {
+CFDE_TxtEdtPage* CFDE_TxtEdtEngine::GetPage(int32_t nIndex) {
+ if (!pdfium::IndexInBounds(m_PagePtrArray, nIndex))
return nullptr;
- }
- return m_PagePtrArray[nIndex];
+ return m_PagePtrArray[nIndex].get();
}
void CFDE_TxtEdtEngine::SetTextByStream(
@@ -119,11 +117,10 @@ void CFDE_TxtEdtEngine::SetTextByStream(
}
bool bPreIsCR = false;
if (bValid) {
- uint8_t bom[4];
- int32_t nPos = pStream->GetBOM(bom);
+ int32_t nPos = pStream->GetBOMLength();
pStream->Seek(FX_STREAMSEEK_Begin, nPos);
int32_t nPlateSize = std::min(nStreamLength, m_pTxtBuf->GetChunkSize());
- FX_WCHAR* lpwstr = FX_Alloc(FX_WCHAR, nPlateSize);
+ wchar_t* lpwstr = FX_Alloc(wchar_t, nPlateSize);
bool bEos = false;
while (!bEos) {
int32_t nRead = pStream->ReadString(lpwstr, nPlateSize, bEos);
@@ -143,8 +140,8 @@ void CFDE_TxtEdtEngine::SetText(const CFX_WideString& wsText) {
int32_t nLength = wsText.GetLength();
if (nLength > 0) {
CFX_WideString wsTemp;
- FX_WCHAR* lpBuffer = wsTemp.GetBuffer(nLength);
- FXSYS_memcpy(lpBuffer, wsText.c_str(), nLength * sizeof(FX_WCHAR));
+ wchar_t* lpBuffer = wsTemp.GetBuffer(nLength);
+ memcpy(lpBuffer, wsText.c_str(), nLength * sizeof(wchar_t));
ReplaceParagEnd(lpBuffer, nLength, false);
wsTemp.ReleaseBuffer(nLength);
if (m_nLimit > 0 && nLength > m_nLimit) {
@@ -182,20 +179,20 @@ int32_t CFDE_TxtEdtEngine::GetCaretRect(CFX_RectF& rtCaret) const {
}
int32_t CFDE_TxtEdtEngine::GetCaretPos() const {
- if (IsLocked()) {
+ if (IsLocked())
return 0;
- }
+
return m_nCaret + (m_bBefore ? 0 : 1);
}
int32_t CFDE_TxtEdtEngine::SetCaretPos(int32_t nIndex, bool bBefore) {
- if (IsLocked()) {
+ if (IsLocked())
return 0;
- }
+
ASSERT(nIndex >= 0 && nIndex <= GetTextBufLength());
- if (m_PagePtrArray.GetSize() <= m_nCaretPage) {
+ if (!pdfium::IndexInBounds(m_PagePtrArray, m_nCaretPage))
return 0;
- }
+
m_bBefore = bBefore;
m_nCaret = nIndex;
MovePage2Char(m_nCaret);
@@ -213,21 +210,17 @@ int32_t CFDE_TxtEdtEngine::SetCaretPos(int32_t nIndex, bool bBefore) {
int32_t CFDE_TxtEdtEngine::MoveCaretPos(FDE_TXTEDTMOVECARET eMoveCaret,
bool bShift,
bool bCtrl) {
- if (IsLocked()) {
- return 0;
- }
- if (m_PagePtrArray.GetSize() <= m_nCaretPage) {
+ if (IsLocked() || !pdfium::IndexInBounds(m_PagePtrArray, m_nCaretPage))
return 0;
- }
+
bool bSelChange = false;
if (IsSelect()) {
ClearSelection();
bSelChange = true;
}
if (bShift) {
- if (m_nAnchorPos == -1) {
+ if (m_nAnchorPos == -1)
m_nAnchorPos = m_nCaret;
- }
} else {
m_nAnchorPos = -1;
}
@@ -236,31 +229,27 @@ int32_t CFDE_TxtEdtEngine::MoveCaretPos(FDE_TXTEDTMOVECARET eMoveCaret,
case MC_Left: {
bool bBefore = true;
int32_t nIndex = MoveBackward(bBefore);
- if (nIndex >= 0) {
+ if (nIndex >= 0)
UpdateCaretRect(nIndex, bBefore);
- }
break;
}
case MC_Right: {
bool bBefore = true;
int32_t nIndex = MoveForward(bBefore);
- if (nIndex >= 0) {
+ if (nIndex >= 0)
UpdateCaretRect(nIndex, bBefore);
- }
break;
}
case MC_Up: {
CFX_PointF ptCaret;
- if (MoveUp(ptCaret)) {
+ if (MoveUp(ptCaret))
UpdateCaretIndex(ptCaret);
- }
break;
}
case MC_Down: {
CFX_PointF ptCaret;
- if (MoveDown(ptCaret)) {
+ if (MoveDown(ptCaret))
UpdateCaretIndex(ptCaret);
- }
break;
}
case MC_WordBackward:
@@ -293,8 +282,7 @@ int32_t CFDE_TxtEdtEngine::MoveCaretPos(FDE_TXTEDTMOVECARET eMoveCaret,
break;
}
if (bShift && m_nAnchorPos != -1 && (m_nAnchorPos != m_nCaret)) {
- AddSelRange(std::min(m_nAnchorPos, m_nCaret),
- FXSYS_abs(m_nAnchorPos - m_nCaret));
+ AddSelRange(std::min(m_nAnchorPos, m_nCaret), abs(m_nAnchorPos - m_nCaret));
m_Param.pEventSink->OnSelChanged();
}
if (bSelChange)
@@ -316,28 +304,26 @@ bool CFDE_TxtEdtEngine::IsLocked() const {
}
int32_t CFDE_TxtEdtEngine::Insert(int32_t nStart,
- const FX_WCHAR* lpText,
+ const wchar_t* lpText,
int32_t nLength) {
- if (IsLocked()) {
+ if (IsLocked())
return FDE_TXTEDT_MODIFY_RET_F_Locked;
- }
+
CFX_WideString wsTemp;
- FX_WCHAR* lpBuffer = wsTemp.GetBuffer(nLength);
- FXSYS_memcpy(lpBuffer, lpText, nLength * sizeof(FX_WCHAR));
+ wchar_t* lpBuffer = wsTemp.GetBuffer(nLength);
+ memcpy(lpBuffer, lpText, nLength * sizeof(wchar_t));
ReplaceParagEnd(lpBuffer, nLength, false);
wsTemp.ReleaseBuffer(nLength);
bool bPart = false;
if (m_nLimit > 0) {
int32_t nTotalLength = GetTextBufLength();
- int32_t nCount = m_SelRangePtrArr.GetSize();
- for (int32_t i = 0; i < nCount; i++) {
- FDE_TXTEDTSELRANGE* lpSelRange = m_SelRangePtrArr.GetAt(i);
+ for (const auto& lpSelRange : m_SelRangePtrArr)
nTotalLength -= lpSelRange->nCount;
- }
+
int32_t nExpectLength = nTotalLength + nLength;
- if (nTotalLength == m_nLimit) {
+ if (nTotalLength == m_nLimit)
return FDE_TXTEDT_MODIFY_RET_F_Full;
- }
+
if (nExpectLength > m_nLimit) {
nLength -= (nExpectLength - m_nLimit);
bPart = true;
@@ -350,7 +336,7 @@ int32_t CFDE_TxtEdtEngine::Insert(int32_t nStart,
while (nLength > 0) {
CFX_WideString wsText = GetPreInsertText(m_nCaret, lpBuffer, nLength);
int32_t nTotal = wsText.GetLength();
- FX_WCHAR* lpBuf = wsText.GetBuffer(nTotal);
+ wchar_t* lpBuf = wsText.GetBuffer(nTotal);
for (int32_t i = 0; i < nTotal; i++) {
lpBuf[i] = m_wcAliasChar;
}
@@ -394,7 +380,7 @@ int32_t CFDE_TxtEdtEngine::Insert(int32_t nStart,
m_ChangeInfo.wsInsert = CFX_WideString(lpBuffer, nLength);
nStart = m_nCaret;
nStart += nLength;
- FX_WCHAR wChar = m_pTxtBuf->GetCharByIndex(nStart - 1);
+ wchar_t wChar = m_pTxtBuf->GetCharByIndex(nStart - 1);
bool bBefore = true;
if (wChar != L'\n' && wChar != L'\r') {
nStart--;
@@ -499,7 +485,7 @@ int32_t CFDE_TxtEdtEngine::Replace(int32_t nStart,
m_ChangeInfo.wsInsert = CFX_WideString(wsReplace.c_str(), nTextLength);
nStart += nTextLength;
- FX_WCHAR wChar = m_pTxtBuf->GetCharByIndex(nStart - 1);
+ wchar_t wChar = m_pTxtBuf->GetCharByIndex(nStart - 1);
bool bBefore = true;
if (wChar != L'\n' && wChar != L'\r') {
nStart--;
@@ -516,44 +502,39 @@ void CFDE_TxtEdtEngine::SetLimit(int32_t nLimit) {
m_nLimit = nLimit;
}
-void CFDE_TxtEdtEngine::SetAliasChar(FX_WCHAR wcAlias) {
+void CFDE_TxtEdtEngine::SetAliasChar(wchar_t wcAlias) {
m_wcAliasChar = wcAlias;
}
void CFDE_TxtEdtEngine::RemoveSelRange(int32_t nStart, int32_t nCount) {
- FDE_TXTEDTSELRANGE* lpTemp = nullptr;
- int32_t nRangeCount = m_SelRangePtrArr.GetSize();
- int32_t i = 0;
- for (i = 0; i < nRangeCount; i++) {
- lpTemp = m_SelRangePtrArr[i];
+ int32_t nRangeCount = pdfium::CollectionSize<int32_t>(m_SelRangePtrArr);
+ for (int32_t i = 0; i < nRangeCount; i++) {
+ FDE_TXTEDTSELRANGE* lpTemp = m_SelRangePtrArr[i].get();
if (lpTemp->nStart == nStart && lpTemp->nCount == nCount) {
- delete lpTemp;
- m_SelRangePtrArr.RemoveAt(i);
+ m_SelRangePtrArr.erase(m_SelRangePtrArr.begin() + i);
return;
}
}
}
void CFDE_TxtEdtEngine::AddSelRange(int32_t nStart, int32_t nCount) {
- if (nCount == -1) {
+ if (nCount == -1)
nCount = GetTextLength() - nStart;
- }
- int32_t nSize = m_SelRangePtrArr.GetSize();
- if (nSize <= 0) {
- FDE_TXTEDTSELRANGE* lpSelRange = new FDE_TXTEDTSELRANGE;
+
+ if (m_SelRangePtrArr.empty()) {
+ auto lpSelRange = pdfium::MakeUnique<FDE_TXTEDTSELRANGE>();
lpSelRange->nStart = nStart;
lpSelRange->nCount = nCount;
- m_SelRangePtrArr.Add(lpSelRange);
+ m_SelRangePtrArr.push_back(std::move(lpSelRange));
m_Param.pEventSink->OnSelChanged();
return;
}
- FDE_TXTEDTSELRANGE* lpTemp = nullptr;
- lpTemp = m_SelRangePtrArr[nSize - 1];
+ auto* lpTemp = m_SelRangePtrArr.back().get();
if (nStart >= lpTemp->nStart + lpTemp->nCount) {
- FDE_TXTEDTSELRANGE* lpSelRange = new FDE_TXTEDTSELRANGE;
+ auto lpSelRange = pdfium::MakeUnique<FDE_TXTEDTSELRANGE>();
lpSelRange->nStart = nStart;
lpSelRange->nCount = nCount;
- m_SelRangePtrArr.Add(lpSelRange);
+ m_SelRangePtrArr.push_back(std::move(lpSelRange));
m_Param.pEventSink->OnSelChanged();
return;
}
@@ -561,8 +542,9 @@ void CFDE_TxtEdtEngine::AddSelRange(int32_t nStart, int32_t nCount) {
bool bBegin = false;
int32_t nRangeBgn = 0;
int32_t nRangeCnt = 0;
- for (int32_t i = 0; i < nSize; i++) {
- lpTemp = m_SelRangePtrArr[i];
+ for (int32_t i = 0, nSize = pdfium::CollectionSize<int32_t>(m_SelRangePtrArr);
+ i < nSize; i++) {
+ lpTemp = m_SelRangePtrArr[i].get();
int32_t nTempBgn = lpTemp->nStart;
int32_t nTempEnd = nTempBgn + lpTemp->nCount - 1;
if (bBegin) {
@@ -585,26 +567,25 @@ void CFDE_TxtEdtEngine::AddSelRange(int32_t nStart, int32_t nCount) {
}
}
if (nRangeCnt == 0) {
- FDE_TXTEDTSELRANGE* lpSelRange = new FDE_TXTEDTSELRANGE;
+ auto lpSelRange = pdfium::MakeUnique<FDE_TXTEDTSELRANGE>();
lpSelRange->nStart = nStart;
lpSelRange->nCount = nCount;
- m_SelRangePtrArr.InsertAt(nRangeBgn, lpSelRange);
+ m_SelRangePtrArr.insert(m_SelRangePtrArr.begin() + nRangeBgn,
+ std::move(lpSelRange));
} else {
- lpTemp = m_SelRangePtrArr[nRangeBgn];
+ lpTemp = m_SelRangePtrArr[nRangeBgn].get();
lpTemp->nStart = nStart;
lpTemp->nCount = nCount;
nRangeCnt--;
nRangeBgn++;
- while (nRangeCnt--) {
- delete m_SelRangePtrArr[nRangeBgn];
- m_SelRangePtrArr.RemoveAt(nRangeBgn);
- }
+ m_SelRangePtrArr.erase(m_SelRangePtrArr.begin() + nRangeBgn,
+ m_SelRangePtrArr.begin() + nRangeBgn + nRangeCnt);
}
m_Param.pEventSink->OnSelChanged();
}
int32_t CFDE_TxtEdtEngine::CountSelRanges() const {
- return m_SelRangePtrArr.GetSize();
+ return pdfium::CollectionSize<int32_t>(m_SelRangePtrArr);
}
int32_t CFDE_TxtEdtEngine::GetSelRange(int32_t nIndex, int32_t* nStart) const {
@@ -614,11 +595,10 @@ int32_t CFDE_TxtEdtEngine::GetSelRange(int32_t nIndex, int32_t* nStart) const {
}
void CFDE_TxtEdtEngine::ClearSelection() {
- int32_t nCount = m_SelRangePtrArr.GetSize();
- for (int i = 0; i < nCount; ++i)
- delete m_SelRangePtrArr[i];
- m_SelRangePtrArr.RemoveAll();
- if (nCount && m_Param.pEventSink)
+ if (m_SelRangePtrArr.empty())
+ return;
+ m_SelRangePtrArr.clear();
+ if (m_Param.pEventSink)
m_Param.pEventSink->OnSelChanged();
}
@@ -643,11 +623,11 @@ int32_t CFDE_TxtEdtEngine::StartLayout() {
}
int32_t CFDE_TxtEdtEngine::DoLayout(IFX_Pause* pPause) {
- int32_t nCount = m_ParagPtrArray.GetSize();
+ int32_t nCount = pdfium::CollectionSize<int32_t>(m_ParagPtrArray);
CFDE_TxtEdtParag* pParag = nullptr;
int32_t nLineCount = 0;
for (; m_nLayoutPos < nCount; m_nLayoutPos++) {
- pParag = m_ParagPtrArray[m_nLayoutPos];
+ pParag = m_ParagPtrArray[m_nLayoutPos].get();
pParag->CalcLines();
nLineCount += pParag->GetLineCount();
if (nLineCount > m_nPageLineCount && pPause && pPause->NeedToPauseNow()) {
@@ -694,11 +674,11 @@ int32_t CFDE_TxtEdtEngine::GetPageLineCount() const {
}
int32_t CFDE_TxtEdtEngine::CountParags() const {
- return m_ParagPtrArray.GetSize();
+ return pdfium::CollectionSize<int32_t>(m_ParagPtrArray);
}
CFDE_TxtEdtParag* CFDE_TxtEdtEngine::GetParag(int32_t nParagIndex) const {
- return m_ParagPtrArray[nParagIndex];
+ return m_ParagPtrArray[nParagIndex].get();
}
IFX_CharIter* CFDE_TxtEdtEngine::CreateCharIter() {
@@ -712,11 +692,11 @@ int32_t CFDE_TxtEdtEngine::Line2Parag(int32_t nStartParag,
int32_t nLineIndex,
int32_t& nStartLine) const {
int32_t nLineTotal = nStartLineofParag;
- int32_t nCount = m_ParagPtrArray.GetSize();
+ int32_t nCount = pdfium::CollectionSize<int32_t>(m_ParagPtrArray);
CFDE_TxtEdtParag* pParag = nullptr;
int32_t i = nStartParag;
for (; i < nCount; i++) {
- pParag = m_ParagPtrArray[i];
+ pParag = m_ParagPtrArray[i].get();
nLineTotal += pParag->GetLineCount();
if (nLineTotal > nLineIndex) {
break;
@@ -734,7 +714,7 @@ CFX_WideString CFDE_TxtEdtEngine::GetPreDeleteText(int32_t nIndex,
}
CFX_WideString CFDE_TxtEdtEngine::GetPreInsertText(int32_t nIndex,
- const FX_WCHAR* lpText,
+ const wchar_t* lpText,
int32_t nLength) {
CFX_WideString wsText = GetText(0, GetTextBufLength());
int32_t nSelIndex = 0;
@@ -747,12 +727,12 @@ CFX_WideString CFDE_TxtEdtEngine::GetPreInsertText(int32_t nIndex,
}
CFX_WideString wsTemp;
int32_t nOldLength = wsText.GetLength();
- const FX_WCHAR* pOldBuffer = wsText.c_str();
- FX_WCHAR* lpBuffer = wsTemp.GetBuffer(nOldLength + nLength);
- FXSYS_memcpy(lpBuffer, pOldBuffer, (nIndex) * sizeof(FX_WCHAR));
- FXSYS_memcpy(lpBuffer + nIndex, lpText, nLength * sizeof(FX_WCHAR));
- FXSYS_memcpy(lpBuffer + nIndex + nLength, pOldBuffer + nIndex,
- (nOldLength - nIndex) * sizeof(FX_WCHAR));
+ const wchar_t* pOldBuffer = wsText.c_str();
+ wchar_t* lpBuffer = wsTemp.GetBuffer(nOldLength + nLength);
+ memcpy(lpBuffer, pOldBuffer, (nIndex) * sizeof(wchar_t));
+ memcpy(lpBuffer + nIndex, lpText, nLength * sizeof(wchar_t));
+ memcpy(lpBuffer + nIndex + nLength, pOldBuffer + nIndex,
+ (nOldLength - nIndex) * sizeof(wchar_t));
wsTemp.ReleaseBuffer(nOldLength + nLength);
wsText = wsTemp;
return wsText;
@@ -760,7 +740,7 @@ CFX_WideString CFDE_TxtEdtEngine::GetPreInsertText(int32_t nIndex,
CFX_WideString CFDE_TxtEdtEngine::GetPreReplaceText(int32_t nIndex,
int32_t nOriginLength,
- const FX_WCHAR* lpText,
+ const wchar_t* lpText,
int32_t nLength) {
CFX_WideString wsText = GetText(0, GetTextBufLength());
int32_t nSelIndex = 0;
@@ -779,28 +759,27 @@ CFX_WideString CFDE_TxtEdtEngine::GetPreReplaceText(int32_t nIndex,
}
void CFDE_TxtEdtEngine::Inner_Insert(int32_t nStart,
- const FX_WCHAR* lpText,
+ const wchar_t* lpText,
int32_t nLength) {
ASSERT(nLength > 0);
FDE_TXTEDTPARAGPOS ParagPos;
TextPos2ParagPos(nStart, ParagPos);
m_Param.pEventSink->OnPageUnload(m_nCaretPage);
- int32_t nParagCount = m_ParagPtrArray.GetSize();
- int32_t i = 0;
- for (i = ParagPos.nParagIndex + 1; i < nParagCount; i++)
+ int32_t nParagCount = pdfium::CollectionSize<int32_t>(m_ParagPtrArray);
+ for (int32_t i = ParagPos.nParagIndex + 1; i < nParagCount; i++)
m_ParagPtrArray[i]->IncrementStartIndex(nLength);
- CFDE_TxtEdtParag* pParag = m_ParagPtrArray[ParagPos.nParagIndex];
+ CFDE_TxtEdtParag* pParag = m_ParagPtrArray[ParagPos.nParagIndex].get();
int32_t nReserveLineCount = pParag->GetLineCount();
int32_t nReserveCharStart = pParag->GetStartIndex();
int32_t nLeavePart = ParagPos.nCharIndex;
int32_t nCutPart = pParag->GetTextLength() - ParagPos.nCharIndex;
int32_t nTextStart = 0;
- FX_WCHAR wCurChar = L' ';
- const FX_WCHAR* lpPos = lpText;
+ wchar_t wCurChar = L' ';
+ const wchar_t* lpPos = lpText;
bool bFirst = true;
int32_t nParagIndex = ParagPos.nParagIndex;
- for (i = 0; i < nLength; i++, lpPos++) {
+ for (int32_t i = 0; i < nLength; i++, lpPos++) {
wCurChar = *lpPos;
if (wCurChar == m_wLineEnd) {
if (bFirst) {
@@ -809,12 +788,13 @@ void CFDE_TxtEdtEngine::Inner_Insert(int32_t nStart,
nReserveCharStart += pParag->GetTextLength();
bFirst = false;
} else {
- pParag = new CFDE_TxtEdtParag(this);
- pParag->SetLineCount(-1);
- pParag->SetTextLength(i - nTextStart + 1);
- pParag->SetStartIndex(nReserveCharStart);
- m_ParagPtrArray.InsertAt(++nParagIndex, pParag);
- nReserveCharStart += pParag->GetTextLength();
+ auto pParag2 = pdfium::MakeUnique<CFDE_TxtEdtParag>(this);
+ pParag2->SetLineCount(-1);
+ pParag2->SetTextLength(i - nTextStart + 1);
+ pParag2->SetStartIndex(nReserveCharStart);
+ nReserveCharStart += pParag2->GetTextLength();
+ m_ParagPtrArray.insert(m_ParagPtrArray.begin() + ++nParagIndex,
+ std::move(pParag2));
}
nTextStart = i + 1;
}
@@ -824,16 +804,17 @@ void CFDE_TxtEdtEngine::Inner_Insert(int32_t nStart,
pParag->SetLineCount(-1);
bFirst = false;
} else {
- pParag = new CFDE_TxtEdtParag(this);
- pParag->SetLineCount(-1);
- pParag->SetTextLength(nLength - nTextStart + nCutPart);
- pParag->SetStartIndex(nReserveCharStart);
- m_ParagPtrArray.InsertAt(++nParagIndex, pParag);
+ auto pParag2 = pdfium::MakeUnique<CFDE_TxtEdtParag>(this);
+ pParag2->SetLineCount(-1);
+ pParag2->SetTextLength(nLength - nTextStart + nCutPart);
+ pParag2->SetStartIndex(nReserveCharStart);
+ m_ParagPtrArray.insert(m_ParagPtrArray.begin() + ++nParagIndex,
+ std::move(pParag2));
}
m_pTxtBuf->Insert(nStart, lpText, nLength);
int32_t nTotalLineCount = 0;
- for (i = ParagPos.nParagIndex; i <= nParagIndex; i++) {
- pParag = m_ParagPtrArray[i];
+ for (int32_t i = ParagPos.nParagIndex; i <= nParagIndex; i++) {
+ pParag = m_ParagPtrArray[i].get();
pParag->CalcLines();
nTotalLineCount += pParag->GetLineCount();
}
@@ -852,10 +833,11 @@ void CFDE_TxtEdtEngine::Inner_DeleteRange(int32_t nStart, int32_t nCount) {
FDE_TXTEDTPARAGPOS ParagPosBgn, ParagPosEnd;
TextPos2ParagPos(nStart, ParagPosBgn);
TextPos2ParagPos(nEnd, ParagPosEnd);
- CFDE_TxtEdtParag* pParag = m_ParagPtrArray[ParagPosEnd.nParagIndex];
+ CFDE_TxtEdtParag* pParag = m_ParagPtrArray[ParagPosEnd.nParagIndex].get();
bool bLastParag = false;
if (ParagPosEnd.nCharIndex == pParag->GetTextLength() - 1) {
- if (ParagPosEnd.nParagIndex < m_ParagPtrArray.GetSize() - 1) {
+ if (ParagPosEnd.nParagIndex <
+ pdfium::CollectionSize<int32_t>(m_ParagPtrArray) - 1) {
ParagPosEnd.nParagIndex++;
} else {
bLastParag = true;
@@ -865,7 +847,7 @@ void CFDE_TxtEdtEngine::Inner_DeleteRange(int32_t nStart, int32_t nCount) {
int32_t nTotalCharCount = 0;
int32_t i = 0;
for (i = ParagPosBgn.nParagIndex; i <= ParagPosEnd.nParagIndex; i++) {
- CFDE_TxtEdtParag* pTextParag = m_ParagPtrArray[i];
+ CFDE_TxtEdtParag* pTextParag = m_ParagPtrArray[i].get();
pTextParag->CalcLines();
nTotalLineCount += pTextParag->GetLineCount();
nTotalCharCount += pTextParag->GetTextLength();
@@ -874,17 +856,16 @@ void CFDE_TxtEdtEngine::Inner_DeleteRange(int32_t nStart, int32_t nCount) {
int32_t nNextParagIndex = (ParagPosBgn.nCharIndex == 0 && bLastParag)
? ParagPosBgn.nParagIndex
: (ParagPosBgn.nParagIndex + 1);
- for (i = nNextParagIndex; i <= ParagPosEnd.nParagIndex; i++) {
- delete m_ParagPtrArray[nNextParagIndex];
- m_ParagPtrArray.RemoveAt(nNextParagIndex);
- }
+ m_ParagPtrArray.erase(m_ParagPtrArray.begin() + nNextParagIndex,
+ m_ParagPtrArray.begin() + ParagPosEnd.nParagIndex + 1);
+
if (!(bLastParag && ParagPosBgn.nCharIndex == 0)) {
- pParag = m_ParagPtrArray[ParagPosBgn.nParagIndex];
+ pParag = m_ParagPtrArray[ParagPosBgn.nParagIndex].get();
pParag->SetTextLength(nTotalCharCount - nCount);
pParag->CalcLines();
nTotalLineCount -= pParag->GetTextLength();
}
- int32_t nParagCount = m_ParagPtrArray.GetSize();
+ int32_t nParagCount = pdfium::CollectionSize<int32_t>(m_ParagPtrArray);
for (i = nNextParagIndex; i < nParagCount; i++)
m_ParagPtrArray[i]->DecrementStartIndex(nCount);
@@ -927,51 +908,41 @@ void CFDE_TxtEdtEngine::ResetEngine() {
void CFDE_TxtEdtEngine::RebuildParagraphs() {
RemoveAllParags();
- FX_WCHAR wChar = L' ';
+ wchar_t wChar = L' ';
int32_t nParagStart = 0;
int32_t nIndex = 0;
- std::unique_ptr<IFX_CharIter> pIter(
- new CFDE_TxtEdtBuf::Iterator(m_pTxtBuf.get()));
+ auto pIter = pdfium::MakeUnique<CFDE_TxtEdtBuf::Iterator>(m_pTxtBuf.get());
pIter->SetAt(0);
do {
wChar = pIter->GetChar();
nIndex = pIter->GetAt();
if (wChar == m_wLineEnd) {
- CFDE_TxtEdtParag* pParag = new CFDE_TxtEdtParag(this);
+ auto pParag = pdfium::MakeUnique<CFDE_TxtEdtParag>(this);
pParag->SetStartIndex(nParagStart);
pParag->SetTextLength(nIndex - nParagStart + 1);
pParag->SetLineCount(-1);
- m_ParagPtrArray.Add(pParag);
+ m_ParagPtrArray.push_back(std::move(pParag));
nParagStart = nIndex + 1;
}
} while (pIter->Next());
}
void CFDE_TxtEdtEngine::RemoveAllParags() {
- for (int32_t i = 0; i < m_ParagPtrArray.GetSize(); ++i)
- delete m_ParagPtrArray[i];
- m_ParagPtrArray.RemoveAll();
+ m_ParagPtrArray.clear();
}
void CFDE_TxtEdtEngine::RemoveAllPages() {
- for (int32_t i = 0; i < m_PagePtrArray.GetSize(); i++)
- delete m_PagePtrArray[i];
- m_PagePtrArray.RemoveAll();
+ m_PagePtrArray.clear();
}
void CFDE_TxtEdtEngine::UpdateParags() {
- int32_t nCount = m_ParagPtrArray.GetSize();
- if (nCount == 0) {
+ if (m_ParagPtrArray.empty())
return;
- }
- CFDE_TxtEdtParag* pParag = nullptr;
+
int32_t nLineCount = 0;
- int32_t i = 0;
- for (i = 0; i < nCount; i++) {
- pParag = m_ParagPtrArray[i];
+ for (auto& pParag : m_ParagPtrArray) {
if (pParag->GetLineCount() == -1)
pParag->CalcLines();
-
nLineCount += pParag->GetLineCount();
}
m_nLineCount = nLineCount;
@@ -982,88 +953,71 @@ void CFDE_TxtEdtEngine::UpdatePages() {
return;
int32_t nPageCount = (m_nLineCount - 1) / (m_nPageLineCount) + 1;
- int32_t nSize = m_PagePtrArray.GetSize();
+ int32_t nSize = pdfium::CollectionSize<int32_t>(m_PagePtrArray);
if (nSize == nPageCount)
return;
if (nSize > nPageCount) {
- for (int32_t i = nSize - 1; i >= nPageCount; i--) {
- delete m_PagePtrArray[i];
- m_PagePtrArray.RemoveAt(i);
- }
- return;
- }
- if (nSize < nPageCount) {
- for (int32_t i = nSize; i < nPageCount; i++)
- m_PagePtrArray.Add(IFDE_TxtEdtPage::Create(this, i));
+ m_PagePtrArray.erase(m_PagePtrArray.begin() + nPageCount,
+ m_PagePtrArray.end());
return;
}
+ for (int32_t i = nSize; i < nPageCount; i++)
+ m_PagePtrArray.push_back(pdfium::MakeUnique<CFDE_TxtEdtPage>(this, i));
}
void CFDE_TxtEdtEngine::UpdateTxtBreak() {
uint32_t dwStyle = m_pTextBreak->GetLayoutStyles();
- if (m_Param.dwMode & FDE_TEXTEDITMODE_MultiLines) {
- dwStyle &= ~FX_TXTLAYOUTSTYLE_SingleLine;
- } else {
- dwStyle |= FX_TXTLAYOUTSTYLE_SingleLine;
- }
- dwStyle &= ~FX_TXTLAYOUTSTYLE_VerticalLayout;
- dwStyle &= ~FX_TXTLAYOUTSTYLE_ReverseLine;
- dwStyle &= ~FX_TXTLAYOUTSTYLE_RTLReadingOrder;
+ if (m_Param.dwMode & FDE_TEXTEDITMODE_MultiLines)
+ dwStyle &= ~FX_LAYOUTSTYLE_SingleLine;
+ else
+ dwStyle |= FX_LAYOUTSTYLE_SingleLine;
- if (m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_CombText) {
- dwStyle |= FX_TXTLAYOUTSTYLE_CombText;
- } else {
- dwStyle &= ~FX_TXTLAYOUTSTYLE_CombText;
- }
-
- dwStyle &= ~FX_TXTLAYOUTSTYLE_VerticalChars;
- dwStyle &= ~FX_TXTLAYOUTSTYLE_ExpandTab;
- dwStyle &= ~FX_TXTLAYOUTSTYLE_ArabicContext;
- dwStyle &= ~FX_TXTLAYOUTSTYLE_ArabicShapes;
+ if (m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_CombText)
+ dwStyle |= FX_LAYOUTSTYLE_CombText;
+ else
+ dwStyle &= ~FX_LAYOUTSTYLE_CombText;
m_pTextBreak->SetLayoutStyles(dwStyle);
uint32_t dwAligment = 0;
- if (m_Param.dwAlignment & FDE_TEXTEDITALIGN_Justified) {
- dwAligment |= FX_TXTLINEALIGNMENT_Justified;
- }
- if (m_Param.dwAlignment & FDE_TEXTEDITALIGN_Center) {
- dwAligment |= FX_TXTLINEALIGNMENT_Center;
- } else if (m_Param.dwAlignment & FDE_TEXTEDITALIGN_Right) {
- dwAligment |= FX_TXTLINEALIGNMENT_Right;
- }
+ if (m_Param.dwAlignment & FDE_TEXTEDITALIGN_Justified)
+ dwAligment |= CFX_TxtLineAlignment_Justified;
+
+ if (m_Param.dwAlignment & FDE_TEXTEDITALIGN_Center)
+ dwAligment |= CFX_TxtLineAlignment_Center;
+ else if (m_Param.dwAlignment & FDE_TEXTEDITALIGN_Right)
+ dwAligment |= CFX_TxtLineAlignment_Right;
+
m_pTextBreak->SetAlignment(dwAligment);
- if (m_Param.dwMode & FDE_TEXTEDITMODE_AutoLineWrap) {
+ if (m_Param.dwMode & FDE_TEXTEDITMODE_AutoLineWrap)
m_pTextBreak->SetLineWidth(m_Param.fPlateWidth);
- } else {
+ else
m_pTextBreak->SetLineWidth(kPageWidthMax);
- }
m_nPageLineCount = m_Param.nLineCount;
if (m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_CombText) {
- FX_FLOAT fCombWidth = m_Param.fPlateWidth;
- if (m_nLimit > 0) {
+ float fCombWidth = m_Param.fPlateWidth;
+ if (m_nLimit > 0)
fCombWidth /= m_nLimit;
- }
+
m_pTextBreak->SetCombWidth(fCombWidth);
}
m_pTextBreak->SetFont(m_Param.pFont);
m_pTextBreak->SetFontSize(m_Param.fFontSize);
- m_pTextBreak->SetTabWidth(m_Param.fTabWidth, m_Param.bTabEquidistant);
+ m_pTextBreak->SetTabWidth(m_Param.fTabWidth);
m_pTextBreak->SetDefaultChar(m_Param.wDefChar);
m_pTextBreak->SetParagraphBreakChar(m_Param.wLineBreakChar);
- m_pTextBreak->SetCharRotation(m_Param.nCharRotation);
m_pTextBreak->SetLineBreakTolerance(m_Param.fFontSize * 0.2f);
m_pTextBreak->SetHorizontalScale(m_Param.nHorzScale);
m_pTextBreak->SetCharSpace(m_Param.fCharSpace);
}
-bool CFDE_TxtEdtEngine::ReplaceParagEnd(FX_WCHAR*& lpText,
+bool CFDE_TxtEdtEngine::ReplaceParagEnd(wchar_t*& lpText,
int32_t& nLength,
bool bPreIsCR) {
for (int32_t i = 0; i < nLength; i++) {
- FX_WCHAR wc = lpText[i];
+ wchar_t wc = lpText[i];
switch (wc) {
case L'\r': {
lpText[i] = m_wLineEnd;
@@ -1073,8 +1027,8 @@ bool CFDE_TxtEdtEngine::ReplaceParagEnd(FX_WCHAR*& lpText,
if (bPreIsCR == true) {
int32_t nNext = i + 1;
if (nNext < nLength) {
- FXSYS_memmove(lpText + i, lpText + nNext,
- (nLength - nNext) * sizeof(FX_WCHAR));
+ memmove(lpText + i, lpText + nNext,
+ (nLength - nNext) * sizeof(wchar_t));
}
i--;
nLength--;
@@ -1104,43 +1058,42 @@ bool CFDE_TxtEdtEngine::ReplaceParagEnd(FX_WCHAR*& lpText,
}
void CFDE_TxtEdtEngine::RecoverParagEnd(CFX_WideString& wsText) const {
- FX_WCHAR wc = (m_nFirstLineEnd == FDE_TXTEDIT_LINEEND_CR) ? L'\n' : L'\r';
+ wchar_t wc = (m_nFirstLineEnd == FDE_TXTEDIT_LINEEND_CR) ? L'\n' : L'\r';
if (m_nFirstLineEnd == FDE_TXTEDIT_LINEEND_CRLF) {
- CFX_ArrayTemplate<int32_t> PosArr;
+ std::vector<int32_t> PosArr;
int32_t nLength = wsText.GetLength();
- int32_t i = 0;
- FX_WCHAR* lpPos = const_cast<FX_WCHAR*>(wsText.c_str());
- for (i = 0; i < nLength; i++, lpPos++) {
+ wchar_t* lpPos = const_cast<wchar_t*>(wsText.c_str());
+ for (int32_t i = 0; i < nLength; i++, lpPos++) {
if (*lpPos == m_wLineEnd) {
*lpPos = wc;
- PosArr.Add(i);
+ PosArr.push_back(i);
}
}
- const FX_WCHAR* lpSrcBuf = wsText.c_str();
+ const wchar_t* lpSrcBuf = wsText.c_str();
CFX_WideString wsTemp;
- int32_t nCount = PosArr.GetSize();
- FX_WCHAR* lpDstBuf = wsTemp.GetBuffer(nLength + nCount);
+ int32_t nCount = pdfium::CollectionSize<int32_t>(PosArr);
+ wchar_t* lpDstBuf = wsTemp.GetBuffer(nLength + nCount);
int32_t nDstPos = 0;
int32_t nSrcPos = 0;
- for (i = 0; i < nCount; i++) {
+ for (int32_t i = 0; i < nCount; i++) {
int32_t nPos = PosArr[i];
int32_t nCopyLen = nPos - nSrcPos + 1;
- FXSYS_memcpy(lpDstBuf + nDstPos, lpSrcBuf + nSrcPos,
- nCopyLen * sizeof(FX_WCHAR));
+ memcpy(lpDstBuf + nDstPos, lpSrcBuf + nSrcPos,
+ nCopyLen * sizeof(wchar_t));
nDstPos += nCopyLen;
nSrcPos += nCopyLen;
lpDstBuf[nDstPos] = L'\n';
nDstPos++;
}
if (nSrcPos < nLength) {
- FXSYS_memcpy(lpDstBuf + nDstPos, lpSrcBuf + nSrcPos,
- (nLength - nSrcPos) * sizeof(FX_WCHAR));
+ memcpy(lpDstBuf + nDstPos, lpSrcBuf + nSrcPos,
+ (nLength - nSrcPos) * sizeof(wchar_t));
}
wsTemp.ReleaseBuffer(nLength + nCount);
wsText = wsTemp;
} else {
int32_t nLength = wsText.GetLength();
- FX_WCHAR* lpBuf = const_cast<FX_WCHAR*>(wsText.c_str());
+ wchar_t* lpBuf = const_cast<wchar_t*>(wsText.c_str());
for (int32_t i = 0; i < nLength; i++, lpBuf++) {
if (*lpBuf == m_wLineEnd)
*lpBuf = wc;
@@ -1152,7 +1105,7 @@ int32_t CFDE_TxtEdtEngine::MovePage2Char(int32_t nIndex) {
ASSERT(nIndex >= 0);
ASSERT(nIndex <= m_pTxtBuf->GetTextLength());
if (m_nCaretPage >= 0) {
- IFDE_TxtEdtPage* pPage = m_PagePtrArray[m_nCaretPage];
+ CFDE_TxtEdtPage* pPage = m_PagePtrArray[m_nCaretPage].get();
m_Param.pEventSink->OnPageLoad(m_nCaretPage);
int32_t nPageCharStart = pPage->GetCharStart();
int32_t nPageCharCount = pPage->GetCharCount();
@@ -1164,10 +1117,10 @@ int32_t CFDE_TxtEdtEngine::MovePage2Char(int32_t nIndex) {
}
CFDE_TxtEdtParag* pParag = nullptr;
int32_t nLineCount = 0;
- int32_t nParagCount = m_ParagPtrArray.GetSize();
+ int32_t nParagCount = pdfium::CollectionSize<int32_t>(m_ParagPtrArray);
int32_t i = 0;
for (i = 0; i < nParagCount; i++) {
- pParag = m_ParagPtrArray[i];
+ pParag = m_ParagPtrArray[i].get();
if (pParag->GetStartIndex() <= nIndex &&
nIndex < (pParag->GetStartIndex() + pParag->GetTextLength())) {
break;
@@ -1192,13 +1145,13 @@ int32_t CFDE_TxtEdtEngine::MovePage2Char(int32_t nIndex) {
void CFDE_TxtEdtEngine::TextPos2ParagPos(int32_t nIndex,
FDE_TXTEDTPARAGPOS& ParagPos) const {
ASSERT(nIndex >= 0 && nIndex < m_pTxtBuf->GetTextLength());
- int32_t nCount = m_ParagPtrArray.GetSize();
+ int32_t nCount = pdfium::CollectionSize<int32_t>(m_ParagPtrArray);
int32_t nBgn = 0;
int32_t nMid = 0;
int32_t nEnd = nCount - 1;
while (nEnd > nBgn) {
nMid = (nBgn + nEnd) / 2;
- CFDE_TxtEdtParag* pParag = m_ParagPtrArray[nMid];
+ CFDE_TxtEdtParag* pParag = m_ParagPtrArray[nMid].get();
if (nIndex < pParag->GetStartIndex())
nEnd = nMid - 1;
else if (nIndex >= (pParag->GetStartIndex() + pParag->GetTextLength()))
@@ -1246,7 +1199,7 @@ int32_t CFDE_TxtEdtEngine::MoveBackward(bool& bBefore) {
}
bool CFDE_TxtEdtEngine::MoveUp(CFX_PointF& ptCaret) {
- IFDE_TxtEdtPage* pPage = GetPage(m_nCaretPage);
+ CFDE_TxtEdtPage* pPage = GetPage(m_nCaretPage);
const CFX_RectF& rtContent = pPage->GetContentsBox();
ptCaret.x = m_fCaretPosReserve;
ptCaret.y = m_rtCaret.top + m_rtCaret.height / 2 - m_Param.fLineSpace;
@@ -1256,7 +1209,7 @@ bool CFDE_TxtEdtEngine::MoveUp(CFX_PointF& ptCaret) {
}
ptCaret.y -= rtContent.top;
m_nCaretPage--;
- IFDE_TxtEdtPage* pCurPage = GetPage(m_nCaretPage);
+ CFDE_TxtEdtPage* pCurPage = GetPage(m_nCaretPage);
ptCaret.y += pCurPage->GetContentsBox().bottom();
}
@@ -1264,7 +1217,7 @@ bool CFDE_TxtEdtEngine::MoveUp(CFX_PointF& ptCaret) {
}
bool CFDE_TxtEdtEngine::MoveDown(CFX_PointF& ptCaret) {
- IFDE_TxtEdtPage* pPage = GetPage(m_nCaretPage);
+ CFDE_TxtEdtPage* pPage = GetPage(m_nCaretPage);
const CFX_RectF& rtContent = pPage->GetContentsBox();
ptCaret.x = m_fCaretPosReserve;
ptCaret.y = m_rtCaret.top + m_rtCaret.height / 2 + m_Param.fLineSpace;
@@ -1274,7 +1227,7 @@ bool CFDE_TxtEdtEngine::MoveDown(CFX_PointF& ptCaret) {
}
ptCaret.y -= rtContent.bottom();
m_nCaretPage++;
- IFDE_TxtEdtPage* pCurPage = GetPage(m_nCaretPage);
+ CFDE_TxtEdtPage* pCurPage = GetPage(m_nCaretPage);
ptCaret.y += pCurPage->GetContentsBox().top;
}
return true;
@@ -1284,7 +1237,7 @@ bool CFDE_TxtEdtEngine::MoveLineStart() {
int32_t nIndex = m_bBefore ? m_nCaret : m_nCaret - 1;
FDE_TXTEDTPARAGPOS ParagPos;
TextPos2ParagPos(nIndex, ParagPos);
- CFDE_TxtEdtParag* pParag = m_ParagPtrArray[ParagPos.nParagIndex];
+ CFDE_TxtEdtParag* pParag = m_ParagPtrArray[ParagPos.nParagIndex].get();
pParag->LoadParag();
int32_t nLineCount = pParag->GetLineCount();
int32_t i = 0;
@@ -1305,7 +1258,7 @@ bool CFDE_TxtEdtEngine::MoveLineEnd() {
int32_t nIndex = m_bBefore ? m_nCaret : m_nCaret - 1;
FDE_TXTEDTPARAGPOS ParagPos;
TextPos2ParagPos(nIndex, ParagPos);
- CFDE_TxtEdtParag* pParag = m_ParagPtrArray[ParagPos.nParagIndex];
+ CFDE_TxtEdtParag* pParag = m_ParagPtrArray[ParagPos.nParagIndex].get();
pParag->LoadParag();
int32_t nLineCount = pParag->GetLineCount();
int32_t i = 0;
@@ -1319,7 +1272,7 @@ bool CFDE_TxtEdtEngine::MoveLineEnd() {
}
nIndex = nStart + nCount - 1;
ASSERT(nIndex <= GetTextBufLength());
- FX_WCHAR wChar = m_pTxtBuf->GetCharByIndex(nIndex);
+ wchar_t wChar = m_pTxtBuf->GetCharByIndex(nIndex);
bool bBefore = false;
if (nIndex <= GetTextBufLength()) {
if (wChar == L'\r') {
@@ -1339,11 +1292,9 @@ bool CFDE_TxtEdtEngine::MoveLineEnd() {
}
bool CFDE_TxtEdtEngine::MoveParagStart() {
- int32_t nIndex = m_bBefore ? m_nCaret : m_nCaret - 1;
FDE_TXTEDTPARAGPOS ParagPos;
- TextPos2ParagPos(nIndex, ParagPos);
- CFDE_TxtEdtParag* pParag = m_ParagPtrArray[ParagPos.nParagIndex];
- UpdateCaretRect(pParag->GetStartIndex(), true);
+ TextPos2ParagPos(m_bBefore ? m_nCaret : m_nCaret - 1, ParagPos);
+ UpdateCaretRect(m_ParagPtrArray[ParagPos.nParagIndex]->GetStartIndex(), true);
return true;
}
@@ -1351,9 +1302,9 @@ bool CFDE_TxtEdtEngine::MoveParagEnd() {
int32_t nIndex = m_bBefore ? m_nCaret : m_nCaret - 1;
FDE_TXTEDTPARAGPOS ParagPos;
TextPos2ParagPos(nIndex, ParagPos);
- CFDE_TxtEdtParag* pParag = m_ParagPtrArray[ParagPos.nParagIndex];
+ CFDE_TxtEdtParag* pParag = m_ParagPtrArray[ParagPos.nParagIndex].get();
nIndex = pParag->GetStartIndex() + pParag->GetTextLength() - 1;
- FX_WCHAR wChar = m_pTxtBuf->GetCharByIndex(nIndex);
+ wchar_t wChar = m_pTxtBuf->GetCharByIndex(nIndex);
if (wChar == L'\n' && nIndex > 0) {
nIndex--;
wChar = m_pTxtBuf->GetCharByIndex(nIndex);
@@ -1376,7 +1327,7 @@ bool CFDE_TxtEdtEngine::MoveEnd() {
}
bool CFDE_TxtEdtEngine::IsFitArea(CFX_WideString& wsText) {
- std::unique_ptr<CFDE_TextOut> pTextOut(new CFDE_TextOut);
+ auto pTextOut = pdfium::MakeUnique<CFDE_TextOut>();
pTextOut->SetLineSpace(m_Param.fLineSpace);
pTextOut->SetFont(m_Param.pFont);
pTextOut->SetFontSize(m_Param.fFontSize);
@@ -1423,8 +1374,9 @@ void CFDE_TxtEdtEngine::GetCaretRect(CFX_RectF& rtCaret,
int32_t nPageIndex,
int32_t nCaret,
bool bBefore) {
- IFDE_TxtEdtPage* pPage = m_PagePtrArray[m_nCaretPage];
+ CFDE_TxtEdtPage* pPage = m_PagePtrArray[m_nCaretPage].get();
m_Param.pEventSink->OnPageLoad(m_nCaretPage);
+
bool bCombText = !!(m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_CombText);
int32_t nIndexInpage = nCaret - pPage->GetCharStart();
if (bBefore && bCombText && nIndexInpage > 0) {
@@ -1445,7 +1397,7 @@ void CFDE_TxtEdtEngine::GetCaretRect(CFX_RectF& rtCaret,
}
void CFDE_TxtEdtEngine::UpdateCaretIndex(const CFX_PointF& ptCaret) {
- IFDE_TxtEdtPage* pPage = m_PagePtrArray[m_nCaretPage];
+ CFDE_TxtEdtPage* pPage = m_PagePtrArray[m_nCaretPage].get();
m_Param.pEventSink->OnPageLoad(m_nCaretPage);
m_nCaret = pPage->GetCharIndex(ptCaret, m_bBefore);
GetCaretRect(m_rtCaret, m_nCaretPage, m_nCaret, m_bBefore);
@@ -1458,23 +1410,22 @@ void CFDE_TxtEdtEngine::UpdateCaretIndex(const CFX_PointF& ptCaret) {
}
bool CFDE_TxtEdtEngine::IsSelect() {
- return m_SelRangePtrArr.GetSize() > 0;
+ return !m_SelRangePtrArr.empty();
}
void CFDE_TxtEdtEngine::DeleteSelect() {
int32_t nCountRange = CountSelRanges();
- if (nCountRange > 0) {
- int32_t nSelStart = 0;
- while (nCountRange > 0) {
- int32_t nSelCount = GetSelRange(--nCountRange, &nSelStart);
- delete m_SelRangePtrArr[nCountRange];
- m_SelRangePtrArr.RemoveAt(nCountRange);
- DeleteRange_DoRecord(nSelStart, nSelCount, true);
- }
- ClearSelection();
- m_Param.pEventSink->OnTextChanged(m_ChangeInfo);
- m_Param.pEventSink->OnSelChanged();
- SetCaretPos(nSelStart, true);
+ if (nCountRange <= 0)
return;
+
+ int32_t nSelStart = 0;
+ while (nCountRange > 0) {
+ int32_t nSelCount = GetSelRange(--nCountRange, &nSelStart);
+ m_SelRangePtrArr.erase(m_SelRangePtrArr.begin() + nCountRange);
+ DeleteRange_DoRecord(nSelStart, nSelCount, true);
}
+ ClearSelection();
+ m_Param.pEventSink->OnTextChanged(m_ChangeInfo);
+ m_Param.pEventSink->OnSelChanged();
+ SetCaretPos(nSelStart, true);
}
diff --git a/chromium/third_party/pdfium/xfa/fde/cfde_txtedtengine.h b/chromium/third_party/pdfium/xfa/fde/cfde_txtedtengine.h
index 6918d6305f0..020b8c93dfa 100644
--- a/chromium/third_party/pdfium/xfa/fde/cfde_txtedtengine.h
+++ b/chromium/third_party/pdfium/xfa/fde/cfde_txtedtengine.h
@@ -8,11 +8,13 @@
#define XFA_FDE_CFDE_TXTEDTENGINE_H_
#include <memory>
+#include <vector>
#include "core/fxcrt/cfx_retain_ptr.h"
#include "xfa/fde/ifde_txtedtengine.h"
class CFDE_TxtEdtBuf;
+class CFDE_TxtEdtPage;
class CFDE_TxtEdtParag;
class CFX_TxtBreak;
class IFDE_TxtEdtDoRecord;
@@ -27,7 +29,7 @@ class CFDE_TxtEdtEngine {
FDE_TXTEDTPARAMS* GetEditParams();
int32_t CountPages() const;
- IFDE_TxtEdtPage* GetPage(int32_t nIndex);
+ CFDE_TxtEdtPage* GetPage(int32_t nIndex);
void SetTextByStream(const CFX_RetainPtr<IFGAS_Stream>& pStream);
void SetText(const CFX_WideString& wsText);
@@ -45,7 +47,7 @@ class CFDE_TxtEdtEngine {
void Unlock();
bool IsLocked() const;
- int32_t Insert(int32_t nStart, const FX_WCHAR* lpText, int32_t nLength);
+ int32_t Insert(int32_t nStart, const wchar_t* lpText, int32_t nLength);
int32_t Delete(int32_t nStart, bool bBackspace = false);
int32_t DeleteRange(int32_t nStart, int32_t nCount = -1);
int32_t Replace(int32_t nStart,
@@ -53,7 +55,7 @@ class CFDE_TxtEdtEngine {
const CFX_WideString& wsReplace);
void SetLimit(int32_t nLimit);
- void SetAliasChar(FX_WCHAR wcAlias);
+ void SetAliasChar(wchar_t wcAlias);
void RemoveSelRange(int32_t nStart, int32_t nCount);
@@ -82,7 +84,7 @@ class CFDE_TxtEdtEngine {
int32_t nStartLineofParag,
int32_t nLineIndex,
int32_t& nStartLine) const;
- FX_WCHAR GetAliasChar() const { return m_wcAliasChar; }
+ wchar_t GetAliasChar() const { return m_wcAliasChar; }
private:
friend class CFDE_TxtEdtDoRecord_Insert;
@@ -99,14 +101,14 @@ class CFDE_TxtEdtEngine {
int32_t nCharIndex;
};
- void Inner_Insert(int32_t nStart, const FX_WCHAR* lpText, int32_t nLength);
+ void Inner_Insert(int32_t nStart, const wchar_t* lpText, int32_t nLength);
CFX_WideString GetPreDeleteText(int32_t nIndex, int32_t nLength);
CFX_WideString GetPreInsertText(int32_t nIndex,
- const FX_WCHAR* lpText,
+ const wchar_t* lpText,
int32_t nLength);
CFX_WideString GetPreReplaceText(int32_t nIndex,
int32_t nOriginLength,
- const FX_WCHAR* lpText,
+ const wchar_t* lpText,
int32_t nLength);
void Inner_DeleteRange(int32_t nStart, int32_t nCount = -1);
@@ -119,7 +121,7 @@ class CFDE_TxtEdtEngine {
void UpdatePages();
void UpdateTxtBreak();
- bool ReplaceParagEnd(FX_WCHAR*& lpText,
+ bool ReplaceParagEnd(wchar_t*& lpText,
int32_t& nLength,
bool bPreIsCR = false);
void RecoverParagEnd(CFX_WideString& wsText) const;
@@ -149,14 +151,14 @@ class CFDE_TxtEdtEngine {
std::unique_ptr<CFDE_TxtEdtBuf> m_pTxtBuf;
std::unique_ptr<CFX_TxtBreak> m_pTextBreak;
FDE_TXTEDTPARAMS m_Param;
- CFX_ArrayTemplate<IFDE_TxtEdtPage*> m_PagePtrArray;
- CFX_ArrayTemplate<CFDE_TxtEdtParag*> m_ParagPtrArray;
- CFX_ArrayTemplate<FDE_TXTEDTSELRANGE*> m_SelRangePtrArr;
+ std::vector<std::unique_ptr<CFDE_TxtEdtPage>> m_PagePtrArray;
+ std::vector<std::unique_ptr<CFDE_TxtEdtParag>> m_ParagPtrArray;
+ std::vector<std::unique_ptr<FDE_TXTEDTSELRANGE>> m_SelRangePtrArr;
int32_t m_nPageLineCount;
int32_t m_nLineCount;
int32_t m_nAnchorPos;
int32_t m_nLayoutPos;
- FX_FLOAT m_fCaretPosReserve;
+ float m_fCaretPosReserve;
int32_t m_nCaret;
bool m_bBefore;
int32_t m_nCaretPage;
@@ -164,10 +166,10 @@ class CFDE_TxtEdtEngine {
uint32_t m_dwFindFlags;
bool m_bLock;
int32_t m_nLimit;
- FX_WCHAR m_wcAliasChar;
+ wchar_t m_wcAliasChar;
int32_t m_nFirstLineEnd;
bool m_bAutoLineEnd;
- FX_WCHAR m_wLineEnd;
+ wchar_t m_wLineEnd;
FDE_TXTEDT_TEXTCHANGE_INFO m_ChangeInfo;
};
diff --git a/chromium/third_party/pdfium/xfa/fde/cfde_txtedtpage.cpp b/chromium/third_party/pdfium/xfa/fde/cfde_txtedtpage.cpp
index 8b58b2b4435..5bd731f8f51 100644
--- a/chromium/third_party/pdfium/xfa/fde/cfde_txtedtpage.cpp
+++ b/chromium/third_party/pdfium/xfa/fde/cfde_txtedtpage.cpp
@@ -8,15 +8,15 @@
#include <algorithm>
+#include "core/fxcrt/cfx_wordbreak.h"
#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
#include "xfa/fde/cfde_txtedtbuf.h"
#include "xfa/fde/cfde_txtedtengine.h"
#include "xfa/fde/cfde_txtedtparag.h"
#include "xfa/fde/cfde_txtedttextset.h"
-#include "xfa/fde/cfx_wordbreak.h"
#include "xfa/fde/ifde_txtedtengine.h"
-#include "xfa/fde/ifde_txtedtpage.h"
+#include "xfa/fgas/layout/fgas_textbreak.h"
namespace {
@@ -24,11 +24,6 @@ const double kTolerance = 0.1f;
} // namespace
-IFDE_TxtEdtPage* IFDE_TxtEdtPage::Create(CFDE_TxtEdtEngine* pEngine,
- int32_t nIndex) {
- return new CFDE_TxtEdtPage(pEngine, nIndex);
-}
-
CFDE_TxtEdtPage::CFDE_TxtEdtPage(CFDE_TxtEdtEngine* pEngine, int32_t nPageIndex)
: m_pEditEngine(pEngine),
m_pBgnParag(nullptr),
@@ -114,7 +109,7 @@ int32_t CFDE_TxtEdtPage::GetCharIndex(const CFX_PointF& fPoint, bool& bBefore) {
bBefore = true;
return m_pEditEngine->GetTextBufLength();
}
- FX_WCHAR wChar = m_pEditEngine->GetTextBuf()->GetCharByIndex(nCaret);
+ wchar_t wChar = m_pEditEngine->GetTextBuf()->GetCharByIndex(nCaret);
if (wChar == L'\n' || wChar == L'\r') {
if (wChar == L'\n') {
if (m_pEditEngine->GetTextBuf()->GetCharByIndex(nCaret - 1) ==
@@ -163,7 +158,7 @@ int32_t CFDE_TxtEdtPage::GetDisplayPos(const CFX_RectF& rtClip,
}
if ((nCharPosCount * 5) < (m_nCharCount << 2)) {
FXTEXT_CHARPOS* pTemp = FX_Alloc(FXTEXT_CHARPOS, nCharPosCount);
- FXSYS_memcpy(pTemp, pCharPos, sizeof(FXTEXT_CHARPOS) * nCharPosCount);
+ memcpy(pTemp, pCharPos, sizeof(FXTEXT_CHARPOS) * nCharPosCount);
FX_Free(pCharPos);
pCharPos = pTemp;
}
@@ -220,7 +215,7 @@ int32_t CFDE_TxtEdtPage::SelectWord(const CFX_PointF& fPoint, int32_t& nCount) {
if (nIndex < 0) {
return -1;
}
- std::unique_ptr<CFX_WordBreak> pIter(new CFX_WordBreak);
+ auto pIter = pdfium::MakeUnique<CFX_WordBreak>();
pIter->Attach(new CFDE_TxtEdtBuf::Iterator(pBuf));
pIter->SetAt(nIndex);
nCount = pIter->GetWordLength();
@@ -239,14 +234,14 @@ int32_t CFDE_TxtEdtPage::LoadPage(const CFX_RectF* pClipBox,
}
CFDE_TxtEdtBuf* pBuf = m_pEditEngine->GetTextBuf();
const FDE_TXTEDTPARAMS* pParams = m_pEditEngine->GetEditParams();
- FX_WCHAR wcAlias = 0;
+ wchar_t wcAlias = 0;
if (pParams->dwMode & FDE_TEXTEDITMODE_Password) {
wcAlias = m_pEditEngine->GetAliasChar();
}
- m_pIter.reset(new CFDE_TxtEdtBuf::Iterator(static_cast<CFDE_TxtEdtBuf*>(pBuf),
- wcAlias));
+ m_pIter = pdfium::MakeUnique<CFDE_TxtEdtBuf::Iterator>(
+ static_cast<CFDE_TxtEdtBuf*>(pBuf), wcAlias);
CFX_TxtBreak* pBreak = m_pEditEngine->GetTextBreak();
- pBreak->EndBreak(FX_TXTBREAK_ParagraphBreak);
+ pBreak->EndBreak(CFX_BreakType::Paragraph);
pBreak->ClearBreakPieces();
int32_t nPageLineCount = m_pEditEngine->GetPageLineCount();
int32_t nStartLine = nPageLineCount * m_nPageIndex;
@@ -267,57 +262,57 @@ int32_t CFDE_TxtEdtPage::LoadPage(const CFX_RectF* pClipBox,
m_pEndParag->GetLineRange(nEndLine - nEndLineInParag, nPageEnd, nTemp);
nPageEnd += (nTemp - 1);
- FX_FLOAT fLineStart = 0.0f;
- FX_FLOAT fLineStep = pParams->fLineSpace;
- FX_FLOAT fLinePos = fLineStart;
+ float fLineStart = 0.0f;
+ float fLineStep = pParams->fLineSpace;
+ float fLinePos = fLineStart;
if (!m_pTextSet)
m_pTextSet = pdfium::MakeUnique<CFDE_TxtEdtTextSet>(this);
m_Pieces.clear();
- uint32_t dwBreakStatus = FX_TXTBREAK_None;
+ CFX_BreakType dwBreakStatus = CFX_BreakType::None;
int32_t nPieceStart = 0;
m_CharWidths.resize(nPageEnd - nPageStart + 1, 0);
- pBreak->EndBreak(FX_TXTBREAK_ParagraphBreak);
+ pBreak->EndBreak(CFX_BreakType::Paragraph);
pBreak->ClearBreakPieces();
m_nPageStart = nPageStart;
m_nCharCount = nPageEnd - nPageStart + 1;
bool bReload = false;
- FX_FLOAT fDefCharWidth = 0;
+ float fDefCharWidth = 0;
std::unique_ptr<IFX_CharIter> pIter(m_pIter->Clone());
pIter->SetAt(nPageStart);
m_pIter->SetAt(nPageStart);
bool bFirstPiece = true;
do {
if (bReload) {
- dwBreakStatus = pBreak->EndBreak(FX_TXTBREAK_ParagraphBreak);
+ dwBreakStatus = pBreak->EndBreak(CFX_BreakType::Paragraph);
} else {
- FX_WCHAR wAppend = pIter->GetChar();
+ wchar_t wAppend = pIter->GetChar();
dwBreakStatus = pBreak->AppendChar(wAppend);
}
- if (pIter->GetAt() == nPageEnd && dwBreakStatus < FX_TXTBREAK_LineBreak) {
- dwBreakStatus = pBreak->EndBreak(FX_TXTBREAK_ParagraphBreak);
- }
- if (dwBreakStatus > FX_TXTBREAK_PieceBreak) {
+ if (pIter->GetAt() == nPageEnd && CFX_BreakTypeNoneOrPiece(dwBreakStatus))
+ dwBreakStatus = pBreak->EndBreak(CFX_BreakType::Paragraph);
+
+ if (!CFX_BreakTypeNoneOrPiece(dwBreakStatus)) {
int32_t nPieceCount = pBreak->CountBreakPieces();
for (int32_t j = 0; j < nPieceCount; j++) {
- const CFX_TxtPiece* pPiece = pBreak->GetBreakPiece(j);
+ const CFX_BreakPiece* pPiece = pBreak->GetBreakPieceUnstable(j);
FDE_TEXTEDITPIECE TxtEdtPiece;
- FXSYS_memset(&TxtEdtPiece, 0, sizeof(FDE_TEXTEDITPIECE));
+ memset(&TxtEdtPiece, 0, sizeof(FDE_TEXTEDITPIECE));
TxtEdtPiece.nBidiLevel = pPiece->m_iBidiLevel;
TxtEdtPiece.nCount = pPiece->GetLength();
TxtEdtPiece.nStart = nPieceStart;
TxtEdtPiece.dwCharStyles = pPiece->m_dwCharStyles;
- if (FX_IsOdd(pPiece->m_iBidiLevel)) {
+ if (FX_IsOdd(pPiece->m_iBidiLevel))
TxtEdtPiece.dwCharStyles |= FX_TXTCHARSTYLE_OddBidiLevel;
- }
- FX_FLOAT fParaBreakWidth = 0.0f;
- if (pPiece->m_dwStatus > FX_TXTBREAK_PieceBreak) {
- FX_WCHAR wRtChar = pParams->wLineBreakChar;
+
+ float fParaBreakWidth = 0.0f;
+ if (!CFX_BreakTypeNoneOrPiece(pPiece->m_dwStatus)) {
+ wchar_t wRtChar = pParams->wLineBreakChar;
if (TxtEdtPiece.nCount >= 2) {
- FX_WCHAR wChar = pBuf->GetCharByIndex(
+ wchar_t wChar = pBuf->GetCharByIndex(
m_nPageStart + TxtEdtPiece.nStart + TxtEdtPiece.nCount - 1);
- FX_WCHAR wCharPre = pBuf->GetCharByIndex(
+ wchar_t wCharPre = pBuf->GetCharByIndex(
m_nPageStart + TxtEdtPiece.nStart + TxtEdtPiece.nCount - 2);
if (wChar == wRtChar) {
fParaBreakWidth += fDefCharWidth;
@@ -326,7 +321,7 @@ int32_t CFDE_TxtEdtPage::LoadPage(const CFX_RectF* pClipBox,
fParaBreakWidth += fDefCharWidth;
}
} else if (TxtEdtPiece.nCount >= 1) {
- FX_WCHAR wChar = pBuf->GetCharByIndex(
+ wchar_t wChar = pBuf->GetCharByIndex(
m_nPageStart + TxtEdtPiece.nStart + TxtEdtPiece.nCount - 1);
if (wChar == wRtChar) {
fParaBreakWidth += fDefCharWidth;
@@ -334,10 +329,10 @@ int32_t CFDE_TxtEdtPage::LoadPage(const CFX_RectF* pClipBox,
}
}
- TxtEdtPiece.rtPiece.left = (FX_FLOAT)pPiece->m_iStartPos / 20000.0f;
+ TxtEdtPiece.rtPiece.left = (float)pPiece->m_iStartPos / 20000.0f;
TxtEdtPiece.rtPiece.top = fLinePos;
TxtEdtPiece.rtPiece.width =
- (FX_FLOAT)pPiece->m_iWidth / 20000.0f + fParaBreakWidth;
+ (float)pPiece->m_iWidth / 20000.0f + fParaBreakWidth;
TxtEdtPiece.rtPiece.height = pParams->fLineSpace;
if (bFirstPiece) {
@@ -349,20 +344,20 @@ int32_t CFDE_TxtEdtPage::LoadPage(const CFX_RectF* pClipBox,
nPieceStart += TxtEdtPiece.nCount;
m_Pieces.push_back(TxtEdtPiece);
for (int32_t k = 0; k < TxtEdtPiece.nCount; k++) {
- CFX_Char* ptc = pPiece->GetCharPtr(k);
- m_CharWidths[TxtEdtPiece.nStart + k] = ptc->m_iCharWidth;
+ m_CharWidths[TxtEdtPiece.nStart + k] =
+ pPiece->GetChar(k)->m_iCharWidth;
}
}
fLinePos += fLineStep;
pBreak->ClearBreakPieces();
}
- if (pIter->GetAt() == nPageEnd && dwBreakStatus == FX_TXTBREAK_LineBreak) {
+ if (pIter->GetAt() == nPageEnd && dwBreakStatus == CFX_BreakType::Line) {
bReload = true;
pIter->Next(true);
}
} while (pIter->Next(false) && (pIter->GetAt() <= nPageEnd));
if (m_rtPageContents.left != 0) {
- FX_FLOAT fDelta = 0.0f;
+ float fDelta = 0.0f;
if (m_rtPageContents.width < pParams->fPlateWidth) {
if (pParams->dwAlignment & FDE_TEXTEDITALIGN_Right) {
fDelta = pParams->fPlateWidth - m_rtPageContents.width;
@@ -377,7 +372,7 @@ int32_t CFDE_TxtEdtPage::LoadPage(const CFX_RectF* pClipBox,
}
}
}
- FX_FLOAT fOffset = m_rtPageContents.left - fDelta;
+ float fOffset = m_rtPageContents.left - fDelta;
for (auto& piece : m_Pieces)
piece.rtPiece.Offset(-fOffset, 0.0f);
@@ -417,35 +412,36 @@ const CFX_RectF& CFDE_TxtEdtPage::GetContentsBox() {
return m_rtPageContents;
}
-FX_POSITION CFDE_TxtEdtPage::GetFirstPosition() {
- if (m_Pieces.empty())
- return nullptr;
- return (FX_POSITION)1;
+size_t CFDE_TxtEdtPage::GetFirstPosition() {
+ return m_Pieces.empty() ? 0 : 1;
}
-FDE_TEXTEDITPIECE* CFDE_TxtEdtPage::GetNext(FX_POSITION& pos,
+FDE_TEXTEDITPIECE* CFDE_TxtEdtPage::GetNext(size_t* pos,
IFDE_VisualSet*& pVisualSet) {
+ ASSERT(pos);
+
if (!m_pTextSet) {
- pos = nullptr;
+ *pos = 0;
return nullptr;
}
- int32_t nPos = (int32_t)(uintptr_t)pos;
+
+ size_t nPos = *pos;
pVisualSet = m_pTextSet.get();
- if (nPos + 1 > pdfium::CollectionSize<int32_t>(m_Pieces))
- pos = nullptr;
+ if (nPos + 1 > m_Pieces.size())
+ *pos = 0;
else
- pos = (FX_POSITION)(uintptr_t)(nPos + 1);
+ *pos = nPos + 1;
return &m_Pieces[nPos - 1];
}
-FX_WCHAR CFDE_TxtEdtPage::GetChar(const FDE_TEXTEDITPIECE* pIdentity,
- int32_t index) const {
+wchar_t CFDE_TxtEdtPage::GetChar(const FDE_TEXTEDITPIECE* pIdentity,
+ int32_t index) const {
int32_t nIndex = m_nPageStart + pIdentity->nStart + index;
if (nIndex != m_pIter->GetAt())
m_pIter->SetAt(nIndex);
- FX_WCHAR wChar = m_pIter->GetChar();
+ wchar_t wChar = m_pIter->GetChar();
m_pIter->Next();
return wChar;
}
@@ -458,7 +454,7 @@ int32_t CFDE_TxtEdtPage::GetWidth(const FDE_TEXTEDITPIECE* pIdentity,
void CFDE_TxtEdtPage::NormalizePt2Rect(CFX_PointF& ptF,
const CFX_RectF& rtF,
- FX_FLOAT fTolerance) const {
+ float fTolerance) const {
if (rtF.Contains(ptF))
return;
if (ptF.x < rtF.left)
diff --git a/chromium/third_party/pdfium/xfa/fde/cfde_txtedtpage.h b/chromium/third_party/pdfium/xfa/fde/cfde_txtedtpage.h
index 63ec7e7cf36..beebdad2afb 100644
--- a/chromium/third_party/pdfium/xfa/fde/cfde_txtedtpage.h
+++ b/chromium/third_party/pdfium/xfa/fde/cfde_txtedtpage.h
@@ -11,57 +11,51 @@
#include <memory>
#include <vector>
-#include "xfa/fde/ifde_txtedtpage.h"
-#include "xfa/fde/ifx_chariter.h"
+#include "core/fxcrt/ifx_chariter.h"
+#include "xfa/fde/ifde_visualset.h"
class CFDE_TxtEdtEngine;
class CFDE_TxtEdtParag;
class CFDE_TxtEdtTextSet;
-class CFDE_TxtEdtPage : public IFDE_TxtEdtPage {
+class CFDE_TxtEdtPage : public IFDE_VisualSet {
public:
CFDE_TxtEdtPage(CFDE_TxtEdtEngine* pEngine, int32_t nLineIndex);
~CFDE_TxtEdtPage() override;
- // IFDE_TxtEditPage:
- CFDE_TxtEdtEngine* GetEngine() const override;
+ // IFDE_VisualSet:
+ FDE_VISUALOBJTYPE GetType() override;
+ CFX_RectF GetRect(const FDE_TEXTEDITPIECE& pPiece) override;
+
+ CFDE_TxtEdtEngine* GetEngine() const;
int32_t GetCharRect(int32_t nIndex,
CFX_RectF& rect,
- bool bBBox = false) const override;
- int32_t GetCharIndex(const CFX_PointF& fPoint, bool& bBefore) override;
+ bool bBBox = false) const;
+ int32_t GetCharIndex(const CFX_PointF& fPoint, bool& bBefore);
void CalcRangeRectArray(int32_t nStart,
int32_t nCount,
- std::vector<CFX_RectF>* RectFArr) const override;
- int32_t SelectWord(const CFX_PointF& fPoint, int32_t& nCount) override;
- int32_t GetCharStart() const override;
- int32_t GetCharCount() const override;
+ std::vector<CFX_RectF>* RectFArr) const;
+ int32_t SelectWord(const CFX_PointF& fPoint, int32_t& nCount);
+ int32_t GetCharStart() const;
+ int32_t GetCharCount() const;
int32_t GetDisplayPos(const CFX_RectF& rtClip,
FXTEXT_CHARPOS*& pCharPos,
- CFX_RectF* pBBox) const override;
- bool IsLoaded(const CFX_RectF* pClipBox) override;
- int32_t LoadPage(const CFX_RectF* pClipBox, IFX_Pause* pPause) override;
- void UnloadPage(const CFX_RectF* pClipBox) override;
- const CFX_RectF& GetContentsBox() override;
-
- // IFDE_VisualSet:
- FDE_VISUALOBJTYPE GetType() override;
- CFX_RectF GetRect(const FDE_TEXTEDITPIECE& pPiece) override;
+ CFX_RectF* pBBox) const;
+ bool IsLoaded(const CFX_RectF* pClipBox);
+ int32_t LoadPage(const CFX_RectF* pClipBox, IFX_Pause* pPause);
+ void UnloadPage(const CFX_RectF* pClipBox);
+ const CFX_RectF& GetContentsBox();
- // IFDE_CanvasSet:
- FX_POSITION GetFirstPosition() override;
- FDE_TEXTEDITPIECE* GetNext(FX_POSITION& pos,
- IFDE_VisualSet*& pVisualSet) override;
+ size_t GetFirstPosition();
+ FDE_TEXTEDITPIECE* GetNext(size_t* pos, IFDE_VisualSet*& pVisualSet);
- // IFX_TxtAccess:
- FX_WCHAR GetChar(const FDE_TEXTEDITPIECE* pIdentity,
- int32_t index) const override;
- int32_t GetWidth(const FDE_TEXTEDITPIECE* pIdentity,
- int32_t index) const override;
+ wchar_t GetChar(const FDE_TEXTEDITPIECE* pIdentity, int32_t index) const;
+ int32_t GetWidth(const FDE_TEXTEDITPIECE* pIdentity, int32_t index) const;
private:
void NormalizePt2Rect(CFX_PointF& ptF,
const CFX_RectF& rtF,
- FX_FLOAT fTolerance) const;
+ float fTolerance) const;
std::unique_ptr<IFX_CharIter> m_pIter;
std::unique_ptr<CFDE_TxtEdtTextSet> m_pTextSet;
diff --git a/chromium/third_party/pdfium/xfa/fde/cfde_txtedtparag.cpp b/chromium/third_party/pdfium/xfa/fde/cfde_txtedtparag.cpp
index f9f88bfb5d1..bcacc666959 100644
--- a/chromium/third_party/pdfium/xfa/fde/cfde_txtedtparag.cpp
+++ b/chromium/third_party/pdfium/xfa/fde/cfde_txtedtparag.cpp
@@ -7,11 +7,14 @@
#include "xfa/fde/cfde_txtedtparag.h"
#include <memory>
+#include <vector>
+#include "core/fxcrt/ifx_chariter.h"
+#include "third_party/base/ptr_util.h"
+#include "third_party/base/stl_util.h"
#include "xfa/fde/cfde_txtedtbuf.h"
#include "xfa/fde/cfde_txtedtengine.h"
#include "xfa/fde/ifde_txtedtengine.h"
-#include "xfa/fde/ifx_chariter.h"
#include "xfa/fgas/layout/fgas_textbreak.h"
CFDE_TxtEdtParag::CFDE_TxtEdtParag(CFDE_TxtEdtEngine* pEngine)
@@ -36,61 +39,59 @@ void CFDE_TxtEdtParag::LoadParag() {
CFX_TxtBreak* pTxtBreak = m_pEngine->GetTextBreak();
CFDE_TxtEdtBuf* pTxtBuf = m_pEngine->GetTextBuf();
const FDE_TXTEDTPARAMS* pParam = m_pEngine->GetEditParams();
- FX_WCHAR wcAlias = 0;
- if (pParam->dwMode & FDE_TEXTEDITMODE_Password) {
+ wchar_t wcAlias = 0;
+ if (pParam->dwMode & FDE_TEXTEDITMODE_Password)
wcAlias = m_pEngine->GetAliasChar();
- }
- std::unique_ptr<IFX_CharIter> pIter(new CFDE_TxtEdtBuf::Iterator(
- static_cast<CFDE_TxtEdtBuf*>(pTxtBuf), wcAlias));
+
+ auto pIter = pdfium::MakeUnique<CFDE_TxtEdtBuf::Iterator>(
+ static_cast<CFDE_TxtEdtBuf*>(pTxtBuf), wcAlias);
pIter->SetAt(m_nCharStart);
int32_t nEndIndex = m_nCharStart + m_nCharCount;
- CFX_ArrayTemplate<int32_t> LineBaseArr;
+ std::vector<int32_t> LineBaseArr;
bool bReload = false;
- uint32_t dwBreakStatus = FX_TXTBREAK_None;
+ CFX_BreakType dwBreakStatus = CFX_BreakType::None;
do {
if (bReload) {
- dwBreakStatus = pTxtBreak->EndBreak(FX_TXTBREAK_ParagraphBreak);
+ dwBreakStatus = pTxtBreak->EndBreak(CFX_BreakType::Paragraph);
} else {
- FX_WCHAR wAppend = pIter->GetChar();
+ wchar_t wAppend = pIter->GetChar();
dwBreakStatus = pTxtBreak->AppendChar(wAppend);
}
if (pIter->GetAt() + 1 == nEndIndex &&
- dwBreakStatus < FX_TXTBREAK_LineBreak) {
- dwBreakStatus = pTxtBreak->EndBreak(FX_TXTBREAK_ParagraphBreak);
+ CFX_BreakTypeNoneOrPiece(dwBreakStatus)) {
+ dwBreakStatus = pTxtBreak->EndBreak(CFX_BreakType::Paragraph);
}
- if (dwBreakStatus > FX_TXTBREAK_PieceBreak) {
+ if (!CFX_BreakTypeNoneOrPiece(dwBreakStatus)) {
int32_t nCount = pTxtBreak->CountBreakPieces();
int32_t nTotal = 0;
for (int32_t j = 0; j < nCount; j++) {
- const CFX_TxtPiece* Piece = pTxtBreak->GetBreakPiece(j);
+ const CFX_BreakPiece* Piece = pTxtBreak->GetBreakPieceUnstable(j);
nTotal += Piece->GetLength();
}
- LineBaseArr.Add(nTotal);
+ LineBaseArr.push_back(nTotal);
pTxtBreak->ClearBreakPieces();
}
- if ((pIter->GetAt() + 1 == nEndIndex) &&
- (dwBreakStatus == FX_TXTBREAK_LineBreak)) {
+ if (pIter->GetAt() + 1 == nEndIndex &&
+ dwBreakStatus == CFX_BreakType::Line) {
bReload = true;
pIter->Next(true);
}
} while (pIter->Next(false) && (pIter->GetAt() < nEndIndex));
- pTxtBreak->EndBreak(FX_TXTBREAK_ParagraphBreak);
+ pTxtBreak->EndBreak(CFX_BreakType::Paragraph);
pTxtBreak->ClearBreakPieces();
- int32_t nLineCount = LineBaseArr.GetSize();
+ int32_t nLineCount = pdfium::CollectionSize<int32_t>(LineBaseArr);
m_nLineCount = nLineCount;
- if (m_lpData) {
+ if (m_lpData)
m_lpData = FX_Realloc(int32_t, m_lpData, nLineCount + 1);
- } else {
+ else
m_lpData = FX_Alloc(int32_t, nLineCount + 1);
- }
+
int32_t* pIntArr = m_lpData;
pIntArr[0] = 1;
m_nLineCount = nLineCount;
pIntArr++;
- for (int32_t j = 0; j < nLineCount; j++, pIntArr++) {
+ for (int32_t j = 0; j < nLineCount; j++, pIntArr++)
*pIntArr = LineBaseArr[j];
- }
- LineBaseArr.RemoveAll();
}
void CFDE_TxtEdtParag::UnloadParag() {
@@ -106,34 +107,34 @@ void CFDE_TxtEdtParag::CalcLines() {
CFX_TxtBreak* pTxtBreak = m_pEngine->GetTextBreak();
CFDE_TxtEdtBuf* pTxtBuf = m_pEngine->GetTextBuf();
int32_t nCount = 0;
- uint32_t dwBreakStatus = FX_TXTBREAK_None;
+ CFX_BreakType dwBreakStatus = CFX_BreakType::None;
int32_t nEndIndex = m_nCharStart + m_nCharCount;
- std::unique_ptr<IFX_CharIter> pIter(
- new CFDE_TxtEdtBuf::Iterator(static_cast<CFDE_TxtEdtBuf*>(pTxtBuf)));
+ auto pIter = pdfium::MakeUnique<CFDE_TxtEdtBuf::Iterator>(
+ static_cast<CFDE_TxtEdtBuf*>(pTxtBuf));
pIter->SetAt(m_nCharStart);
bool bReload = false;
do {
if (bReload) {
- dwBreakStatus = pTxtBreak->EndBreak(FX_TXTBREAK_ParagraphBreak);
+ dwBreakStatus = pTxtBreak->EndBreak(CFX_BreakType::Paragraph);
} else {
- FX_WCHAR wAppend = pIter->GetChar();
+ wchar_t wAppend = pIter->GetChar();
dwBreakStatus = pTxtBreak->AppendChar(wAppend);
}
if (pIter->GetAt() + 1 == nEndIndex &&
- dwBreakStatus < FX_TXTBREAK_LineBreak) {
- dwBreakStatus = pTxtBreak->EndBreak(FX_TXTBREAK_ParagraphBreak);
+ CFX_BreakTypeNoneOrPiece(dwBreakStatus)) {
+ dwBreakStatus = pTxtBreak->EndBreak(CFX_BreakType::Paragraph);
}
- if (dwBreakStatus > FX_TXTBREAK_PieceBreak) {
+ if (!CFX_BreakTypeNoneOrPiece(dwBreakStatus)) {
nCount++;
pTxtBreak->ClearBreakPieces();
}
- if ((pIter->GetAt() + 1 == nEndIndex) &&
- (dwBreakStatus == FX_TXTBREAK_LineBreak)) {
+ if (pIter->GetAt() + 1 == nEndIndex &&
+ dwBreakStatus == CFX_BreakType::Line) {
bReload = true;
pIter->Next(true);
}
} while (pIter->Next(false) && (pIter->GetAt() < nEndIndex));
- pTxtBreak->EndBreak(FX_TXTBREAK_ParagraphBreak);
+ pTxtBreak->EndBreak(CFX_BreakType::Paragraph);
pTxtBreak->ClearBreakPieces();
m_nLineCount = nCount;
}
diff --git a/chromium/third_party/pdfium/xfa/fde/cfde_txtedttextset.cpp b/chromium/third_party/pdfium/xfa/fde/cfde_txtedttextset.cpp
index 8d32f75ff39..ff7b39bb9f9 100644
--- a/chromium/third_party/pdfium/xfa/fde/cfde_txtedttextset.cpp
+++ b/chromium/third_party/pdfium/xfa/fde/cfde_txtedttextset.cpp
@@ -9,6 +9,7 @@
#include "xfa/fde/cfde_txtedtengine.h"
#include "xfa/fde/cfde_txtedtpage.h"
#include "xfa/fgas/font/cfgas_gefont.h"
+#include "xfa/fgas/layout/fgas_textbreak.h"
CFDE_TxtEdtTextSet::CFDE_TxtEdtTextSet(CFDE_TxtEdtPage* pPage)
: m_pPage(pPage) {}
@@ -25,7 +26,7 @@ CFX_RectF CFDE_TxtEdtTextSet::GetRect(const FDE_TEXTEDITPIECE& pPiece) {
int32_t CFDE_TxtEdtTextSet::GetString(FDE_TEXTEDITPIECE* pPiece,
CFX_WideString& wsText) {
- FX_WCHAR* pBuffer = wsText.GetBuffer(pPiece->nCount);
+ wchar_t* pBuffer = wsText.GetBuffer(pPiece->nCount);
for (int32_t i = 0; i < pPiece->nCount; i++)
pBuffer[i] = m_pPage->GetChar(pPiece, i);
@@ -37,7 +38,7 @@ CFX_RetainPtr<CFGAS_GEFont> CFDE_TxtEdtTextSet::GetFont() {
return m_pPage->GetEngine()->GetEditParams()->pFont;
}
-FX_FLOAT CFDE_TxtEdtTextSet::GetFontSize() {
+float CFDE_TxtEdtTextSet::GetFontSize() {
return m_pPage->GetEngine()->GetEditParams()->fFontSize;
}
@@ -65,7 +66,6 @@ int32_t CFDE_TxtEdtTextSet::GetDisplayPos(const FDE_TEXTEDITPIECE& piece,
tr.pFont = pTextParams->pFont;
tr.fFontSize = pTextParams->fFontSize;
tr.dwStyles = dwLayoutStyle;
- tr.iCharRotation = pTextParams->nCharRotation;
tr.dwCharStyles = piece.dwCharStyles;
tr.pRect = &piece.rtPiece;
tr.wLineBreakChar = pTextParams->wLineBreakChar;
@@ -78,7 +78,7 @@ std::vector<CFX_RectF> CFDE_TxtEdtTextSet::GetCharRects(
if (!pPiece || pPiece->nCount < 1)
return std::vector<CFX_RectF>();
- auto pEngine = static_cast<CFDE_TxtEdtEngine*>(m_pPage->GetEngine());
+ auto* pEngine = static_cast<CFDE_TxtEdtEngine*>(m_pPage->GetEngine());
const FDE_TXTEDTPARAMS* pTextParams = pEngine->GetEditParams();
uint32_t dwLayoutStyle = pEngine->GetTextBreak()->GetLayoutStyles();
FX_TXTRUN tr;
@@ -88,7 +88,6 @@ std::vector<CFX_RectF> CFDE_TxtEdtTextSet::GetCharRects(
tr.pFont = pTextParams->pFont;
tr.fFontSize = pTextParams->fFontSize;
tr.dwStyles = dwLayoutStyle;
- tr.iCharRotation = pTextParams->nCharRotation;
tr.dwCharStyles = pPiece->dwCharStyles;
tr.pRect = &pPiece->rtPiece;
tr.wLineBreakChar = pTextParams->wLineBreakChar;
diff --git a/chromium/third_party/pdfium/xfa/fde/cfde_txtedttextset.h b/chromium/third_party/pdfium/xfa/fde/cfde_txtedttextset.h
index 8ab65787931..8e4c4d01bfe 100644
--- a/chromium/third_party/pdfium/xfa/fde/cfde_txtedttextset.h
+++ b/chromium/third_party/pdfium/xfa/fde/cfde_txtedttextset.h
@@ -9,11 +9,11 @@
#include <vector>
-#include "xfa/fde/fde_visualset.h"
+#include "xfa/fde/ifde_visualset.h"
class CFDE_TxtEdtPage;
-class CFDE_TxtEdtTextSet : public IFDE_TextSet {
+class CFDE_TxtEdtTextSet : public IFDE_VisualSet {
public:
explicit CFDE_TxtEdtTextSet(CFDE_TxtEdtPage* pPage);
~CFDE_TxtEdtTextSet() override;
@@ -22,17 +22,16 @@ class CFDE_TxtEdtTextSet : public IFDE_TextSet {
FDE_VISUALOBJTYPE GetType() override;
CFX_RectF GetRect(const FDE_TEXTEDITPIECE& hVisualObj) override;
- // IFDE_TextSet
- int32_t GetString(FDE_TEXTEDITPIECE* pPiece, CFX_WideString& wsText) override;
- CFX_RetainPtr<CFGAS_GEFont> GetFont() override;
- FX_FLOAT GetFontSize() override;
- FX_ARGB GetFontColor() override;
+ int32_t GetString(FDE_TEXTEDITPIECE* pPiece, CFX_WideString& wsText);
+ CFX_RetainPtr<CFGAS_GEFont> GetFont();
+ float GetFontSize();
+ FX_ARGB GetFontColor();
int32_t GetDisplayPos(const FDE_TEXTEDITPIECE& pPiece,
FXTEXT_CHARPOS* pCharPos,
bool bCharCode = false,
- CFX_WideString* pWSForms = nullptr) override;
+ CFX_WideString* pWSForms = nullptr);
std::vector<CFX_RectF> GetCharRects(const FDE_TEXTEDITPIECE* pPiece,
- bool bBBox) override;
+ bool bBBox);
private:
CFDE_TxtEdtPage* const m_pPage;
diff --git a/chromium/third_party/pdfium/xfa/fde/cfde_visualsetiterator.cpp b/chromium/third_party/pdfium/xfa/fde/cfde_visualsetiterator.cpp
new file mode 100644
index 00000000000..5fd84ede8a5
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fde/cfde_visualsetiterator.cpp
@@ -0,0 +1,94 @@
+// 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
+
+#include "xfa/fde/cfde_visualsetiterator.h"
+
+#include "xfa/fde/cfde_txtedtpage.h"
+
+CFDE_VisualSetIterator::CFDE_VisualSetIterator() : m_dwFilter(0) {}
+
+CFDE_VisualSetIterator::~CFDE_VisualSetIterator() {}
+
+bool CFDE_VisualSetIterator::AttachCanvas(CFDE_TxtEdtPage* pCanvas) {
+ ASSERT(pCanvas);
+ m_CanvasStack = std::stack<FDE_CANVASITEM>();
+
+ FDE_CANVASITEM canvas;
+ canvas.hCanvas = nullptr;
+ canvas.pCanvas = pCanvas;
+ canvas.pos = pCanvas->GetFirstPosition();
+ if (canvas.pos == 0)
+ return false;
+
+ m_CanvasStack.push(canvas);
+ return true;
+}
+
+bool CFDE_VisualSetIterator::FilterObjects(uint32_t dwObjects) {
+ if (m_CanvasStack.empty())
+ return false;
+
+ while (m_CanvasStack.size() > 1)
+ m_CanvasStack.pop();
+
+ m_dwFilter = dwObjects;
+
+ FDE_CANVASITEM* pCanvas = &m_CanvasStack.top();
+ ASSERT(pCanvas && pCanvas->pCanvas);
+
+ pCanvas->pos = pCanvas->pCanvas->GetFirstPosition();
+ return pCanvas->pos != 0;
+}
+
+void CFDE_VisualSetIterator::Reset() {
+ FilterObjects(m_dwFilter);
+}
+
+FDE_TEXTEDITPIECE* CFDE_VisualSetIterator::GetNext(
+ IFDE_VisualSet*& pVisualSet,
+ FDE_TEXTEDITPIECE** phCanvasObj,
+ CFDE_TxtEdtPage** ppCanvasSet) {
+ while (!m_CanvasStack.empty()) {
+ FDE_CANVASITEM* pCanvas = &m_CanvasStack.top();
+ if (pCanvas->pos == 0) {
+ if (m_CanvasStack.size() == 1)
+ break;
+
+ m_CanvasStack.pop();
+ continue;
+ }
+ do {
+ FDE_TEXTEDITPIECE* pObj =
+ pCanvas->pCanvas->GetNext(&pCanvas->pos, pVisualSet);
+ ASSERT(pObj);
+
+ FDE_VISUALOBJTYPE eType = pVisualSet->GetType();
+ if (eType == FDE_VISUALOBJ_Canvas) {
+ FDE_CANVASITEM canvas;
+ canvas.hCanvas = pObj;
+ canvas.pCanvas = static_cast<CFDE_TxtEdtPage*>(pVisualSet);
+ canvas.pos = canvas.pCanvas->GetFirstPosition();
+ m_CanvasStack.push(canvas);
+ break;
+ }
+ uint32_t dwObj = (uint32_t)eType;
+ if ((m_dwFilter & dwObj) != 0) {
+ if (ppCanvasSet)
+ *ppCanvasSet = pCanvas->pCanvas;
+ if (phCanvasObj)
+ *phCanvasObj = pCanvas->hCanvas;
+ return pObj;
+ }
+ } while (pCanvas->pos != 0);
+ }
+ if (ppCanvasSet)
+ *ppCanvasSet = nullptr;
+ if (phCanvasObj)
+ *phCanvasObj = nullptr;
+
+ pVisualSet = nullptr;
+ return nullptr;
+}
diff --git a/chromium/third_party/pdfium/xfa/fde/cfde_visualsetiterator.h b/chromium/third_party/pdfium/xfa/fde/cfde_visualsetiterator.h
new file mode 100644
index 00000000000..a8e311aafbb
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fde/cfde_visualsetiterator.h
@@ -0,0 +1,40 @@
+// 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 XFA_FDE_CFDE_VISUALSETITERATOR_H_
+#define XFA_FDE_CFDE_VISUALSETITERATOR_H_
+
+#include <stack>
+
+#include "xfa/fde/ifde_visualset.h"
+
+class CFDE_TxtEdtPage;
+
+struct FDE_CANVASITEM {
+ CFDE_TxtEdtPage* pCanvas;
+ FDE_TEXTEDITPIECE* hCanvas;
+ size_t pos;
+};
+
+class CFDE_VisualSetIterator {
+ public:
+ CFDE_VisualSetIterator();
+ ~CFDE_VisualSetIterator();
+
+ bool AttachCanvas(CFDE_TxtEdtPage* pCanvas);
+ bool FilterObjects(uint32_t dwObjects = 0xFFFFFFFF);
+
+ void Reset();
+ FDE_TEXTEDITPIECE* GetNext(IFDE_VisualSet*& pVisualSet,
+ FDE_TEXTEDITPIECE** phCanvasObj = nullptr,
+ CFDE_TxtEdtPage** ppCanvasSet = nullptr);
+
+ protected:
+ uint32_t m_dwFilter;
+ std::stack<FDE_CANVASITEM> m_CanvasStack;
+};
+
+#endif // XFA_FDE_CFDE_VISUALSETITERATOR_H_
diff --git a/chromium/third_party/pdfium/xfa/fde/cfx_chariter.cpp b/chromium/third_party/pdfium/xfa/fde/cfx_chariter.cpp
deleted file mode 100644
index 568ecd6cf0d..00000000000
--- a/chromium/third_party/pdfium/xfa/fde/cfx_chariter.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright 2016 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#include "xfa/fde/cfx_chariter.h"
-
-CFX_CharIter::CFX_CharIter(const CFX_WideString& wsText)
- : m_wsText(wsText), m_nIndex(0) {
- ASSERT(!wsText.IsEmpty());
-}
-
-CFX_CharIter::~CFX_CharIter() {}
-
-bool CFX_CharIter::Next(bool bPrev) {
- if (bPrev) {
- if (m_nIndex <= 0)
- return false;
- m_nIndex--;
- } else {
- if (m_nIndex + 1 >= m_wsText.GetLength())
- return false;
- m_nIndex++;
- }
- return true;
-}
-
-FX_WCHAR CFX_CharIter::GetChar() {
- return m_wsText.GetAt(m_nIndex);
-}
-
-void CFX_CharIter::SetAt(int32_t nIndex) {
- if (nIndex < 0 || nIndex >= m_wsText.GetLength())
- return;
- m_nIndex = nIndex;
-}
-
-int32_t CFX_CharIter::GetAt() const {
- return m_nIndex;
-}
-
-bool CFX_CharIter::IsEOF(bool bTail) const {
- return bTail ? (m_nIndex + 1 == m_wsText.GetLength()) : (m_nIndex == 0);
-}
-
-IFX_CharIter* CFX_CharIter::Clone() {
- CFX_CharIter* pIter = new CFX_CharIter(m_wsText);
- pIter->m_nIndex = m_nIndex;
- return pIter;
-}
diff --git a/chromium/third_party/pdfium/xfa/fde/cfx_chariter.h b/chromium/third_party/pdfium/xfa/fde/cfx_chariter.h
deleted file mode 100644
index d122af21f19..00000000000
--- a/chromium/third_party/pdfium/xfa/fde/cfx_chariter.h
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright 2016 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef XFA_FDE_CFX_CHARITER_H_
-#define XFA_FDE_CFX_CHARITER_H_
-
-#include "core/fxcrt/fx_string.h"
-#include "core/fxcrt/fx_system.h"
-#include "xfa/fde/ifx_chariter.h"
-
-class CFX_CharIter : public IFX_CharIter {
- public:
- explicit CFX_CharIter(const CFX_WideString& wsText);
- ~CFX_CharIter() override;
-
- bool Next(bool bPrev = false) override;
- FX_WCHAR GetChar() override;
- void SetAt(int32_t nIndex) override;
- int32_t GetAt() const override;
- bool IsEOF(bool bTail = true) const override;
- IFX_CharIter* Clone() override;
-
- private:
- const CFX_WideString& m_wsText;
- int32_t m_nIndex;
-};
-
-#endif // XFA_FDE_CFX_CHARITER_H_
diff --git a/chromium/third_party/pdfium/xfa/fde/cfx_wordbreak.cpp b/chromium/third_party/pdfium/xfa/fde/cfx_wordbreak.cpp
deleted file mode 100644
index 2d37ba1707e..00000000000
--- a/chromium/third_party/pdfium/xfa/fde/cfx_wordbreak.cpp
+++ /dev/null
@@ -1,2946 +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
-
-#include "xfa/fde/cfx_wordbreak.h"
-
-#include <utility>
-
-#include "third_party/base/ptr_util.h"
-#include "xfa/fde/cfx_chariter.h"
-
-namespace {
-
-enum FX_WordBreakProp {
- FX_WordBreakProp_None = 0,
- FX_WordBreakProp_CR,
- FX_WordBreakProp_LF,
- FX_WordBreakProp_NewLine,
- FX_WordBreakProp_Extend,
- FX_WordBreakProp_Format,
- FX_WordBreakProp_KataKana,
- FX_WordBreakProp_ALetter,
- FX_WordBreakProp_MidLetter,
- FX_WordBreakProp_MidNum,
- FX_WordBreakProp_MidNumLet,
- FX_WordBreakProp_Numberic,
- FX_WordBreakProp_ExtendNumLet,
-};
-
-const uint16_t gs_FX_WordBreak_Table[16] = {
- 0xFFFF, 0xFFF9, 0xFFFB, 0xFFFB, 0xFFFB, 0xFFFB, 0xEFBB, 0xE77B,
- 0xFFFB, 0xFFFB, 0xFFFB, 0xE77B, 0xE73B, 0xFFFB, 0xFFFB, 0xFFFB,
-};
-
-const uint8_t gs_FX_WordBreak_CodePointProperties[(0xFFFF - 1) / 2 + 1] =
- // NOLINTNEXTLINE
- {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x00, 0x90, 0xA0,
- 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0x89, 0x00, 0x00, 0x07, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x70, 0x00, 0x0C,
- 0x07, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x70, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x70, 0x05, 0x00, 0x00, 0x00, 0x07, 0x08, 0x00, 0x70, 0x00, 0x00,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x70,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x70, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x00, 0x00, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x77, 0x70, 0x00,
- 0x00, 0x00, 0x70, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44,
- 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44,
- 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44,
- 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44,
- 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x77, 0x77, 0x70, 0x77,
- 0x00, 0x77, 0x77, 0x90, 0x00, 0x00, 0x00, 0x78, 0x77, 0x70, 0x70, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x07, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x07, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x04, 0x44, 0x44, 0x44, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x07, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x70,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x09, 0x00, 0x00, 0x00, 0x04, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44,
- 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44,
- 0x44, 0x44, 0x44, 0x04, 0x04, 0x40, 0x44, 0x04, 0x00, 0x00, 0x00, 0x00,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x70, 0x00, 0x00, 0x77, 0x77, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x55, 0x55, 0x00, 0x00, 0x00, 0x00, 0x99, 0x00, 0x44, 0x44, 0x44, 0x44,
- 0x44, 0x40, 0x00, 0x00, 0x07, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x74, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x40,
- 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0x0B, 0x90, 0x77, 0x47, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x07, 0x44,
- 0x44, 0x44, 0x45, 0x44, 0x44, 0x44, 0x47, 0x74, 0x40, 0x44, 0x44, 0x77,
- 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0x77, 0x70, 0x07, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x05, 0x74, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x44, 0x44, 0x44, 0x44,
- 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x40, 0x07, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x44, 0x44, 0x44, 0x44, 0x44,
- 0x47, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xBB, 0xBB, 0xBB, 0xBB,
- 0xBB, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x74, 0x44, 0x44, 0x44, 0x44, 0x77, 0x00,
- 0x90, 0x70, 0x00, 0x00, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x44, 0x44, 0x74, 0x44, 0x44, 0x44, 0x44, 0x74, 0x44,
- 0x74, 0x44, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x44, 0x44, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x00, 0x47, 0x44, 0x44, 0x44, 0x44, 0x44,
- 0x44, 0x44, 0x44, 0x40, 0x74, 0x44, 0x44, 0x00, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x44, 0x00, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0x07, 0x70, 0x00, 0x00,
- 0x07, 0x77, 0x77, 0x77, 0x04, 0x44, 0x07, 0x77, 0x77, 0x77, 0x70, 0x07,
- 0x70, 0x07, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x70, 0x77, 0x77, 0x77, 0x70, 0x70, 0x00, 0x77, 0x77, 0x00, 0x47, 0x44,
- 0x44, 0x44, 0x40, 0x04, 0x40, 0x04, 0x44, 0x70, 0x00, 0x00, 0x00, 0x04,
- 0x00, 0x00, 0x77, 0x07, 0x77, 0x44, 0x00, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB,
- 0x77, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x44, 0x07, 0x77,
- 0x77, 0x70, 0x00, 0x07, 0x70, 0x07, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x70, 0x77, 0x77, 0x77, 0x70, 0x77, 0x07, 0x70,
- 0x77, 0x00, 0x40, 0x44, 0x44, 0x40, 0x00, 0x04, 0x40, 0x04, 0x44, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x07, 0x77, 0x70, 0x70, 0x00, 0x00, 0x00, 0xBB,
- 0xBB, 0xBB, 0xBB, 0xBB, 0x44, 0x77, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x04, 0x44, 0x07, 0x77, 0x77, 0x77, 0x77, 0x07, 0x77, 0x07, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x70, 0x77, 0x77, 0x77,
- 0x70, 0x77, 0x07, 0x77, 0x77, 0x00, 0x47, 0x44, 0x44, 0x44, 0x44, 0x04,
- 0x44, 0x04, 0x44, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x77, 0x44, 0x00, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x04, 0x44, 0x07, 0x77, 0x77, 0x77, 0x70, 0x07,
- 0x70, 0x07, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x70, 0x77, 0x77, 0x77, 0x70, 0x77, 0x07, 0x77, 0x77, 0x00, 0x47, 0x44,
- 0x44, 0x44, 0x40, 0x04, 0x40, 0x04, 0x44, 0x00, 0x00, 0x00, 0x00, 0x44,
- 0x00, 0x00, 0x77, 0x07, 0x77, 0x44, 0x00, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB,
- 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x07, 0x77,
- 0x77, 0x70, 0x00, 0x77, 0x70, 0x77, 0x77, 0x00, 0x07, 0x70, 0x70, 0x77,
- 0x00, 0x07, 0x70, 0x00, 0x77, 0x70, 0x00, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x00, 0x00, 0x44, 0x44, 0x40, 0x00, 0x44, 0x40, 0x44, 0x44, 0x00,
- 0x70, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xBB,
- 0xBB, 0xBB, 0xBB, 0xBB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x04, 0x44, 0x07, 0x77, 0x77, 0x77, 0x70, 0x77, 0x70, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x70, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x07, 0x77, 0x77, 0x00, 0x07, 0x44, 0x44, 0x44, 0x40, 0x44,
- 0x40, 0x44, 0x44, 0x00, 0x00, 0x00, 0x04, 0x40, 0x77, 0x00, 0x00, 0x00,
- 0x77, 0x44, 0x00, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x07, 0x77, 0x77, 0x77, 0x70, 0x77,
- 0x70, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x70, 0x77, 0x77, 0x77, 0x77, 0x77, 0x07, 0x77, 0x77, 0x00, 0x47, 0x44,
- 0x44, 0x44, 0x40, 0x44, 0x40, 0x44, 0x44, 0x00, 0x00, 0x00, 0x04, 0x40,
- 0x00, 0x00, 0x00, 0x70, 0x77, 0x44, 0x00, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x07, 0x77,
- 0x77, 0x77, 0x70, 0x77, 0x70, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x70, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x00, 0x07, 0x44, 0x44, 0x44, 0x40, 0x44, 0x40, 0x44, 0x44, 0x00,
- 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x77, 0x44, 0x00, 0xBB,
- 0xBB, 0xBB, 0xBB, 0xBB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x77, 0x77,
- 0x00, 0x44, 0x07, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x70,
- 0x00, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x07, 0x77, 0x77, 0x77, 0x77, 0x07, 0x00, 0x77, 0x77, 0x77, 0x70,
- 0x00, 0x40, 0x00, 0x04, 0x44, 0x44, 0x40, 0x40, 0x44, 0x44, 0x44, 0x44,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x44, 0x44, 0x44, 0x40, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x04, 0x44, 0x44, 0x44, 0x40, 0xBB, 0xBB, 0xBB, 0xBB,
- 0xBB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x44, 0x44,
- 0x44, 0x04, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x44, 0x44, 0x00,
- 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x44, 0x00, 0x00, 0x00, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x04, 0x04, 0x04, 0x00, 0x00, 0x44, 0x77, 0x77, 0x77, 0x77,
- 0x07, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x70, 0x00, 0x04, 0x44, 0x44, 0x44,
- 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x40, 0x44, 0x77, 0x77, 0x00, 0x00,
- 0x44, 0x44, 0x44, 0x44, 0x04, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44,
- 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x40, 0x00,
- 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44,
- 0x44, 0x44, 0x44, 0x40, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x44, 0x44, 0x00, 0x00, 0x44, 0x40, 0x44, 0x40, 0x04,
- 0x44, 0x44, 0x44, 0x00, 0x04, 0x44, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x04, 0xBB, 0xBB, 0xBB, 0xBB,
- 0xBB, 0x44, 0x44, 0x00, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x70, 0x70, 0x00, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x70, 0x77, 0x77, 0x00, 0x77, 0x77, 0x77, 0x70, 0x70, 0x77, 0x77, 0x00,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x70, 0x77, 0x77, 0x00,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x70, 0x77, 0x77, 0x00, 0x77, 0x77, 0x77, 0x70,
- 0x70, 0x77, 0x77, 0x00, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x70,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x70, 0x77, 0x77, 0x00, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x70, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x70, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x07, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x70, 0x07, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x07, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x70, 0x00, 0x00, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x70, 0x00, 0x77, 0x70, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x70, 0x77,
- 0x77, 0x44, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x44, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x44, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x70, 0x77,
- 0x70, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x44,
- 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44,
- 0x44, 0x44, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0xBB, 0xBB, 0xBB, 0xBB,
- 0xBB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x44, 0x00, 0xBB, 0xBB, 0xBB, 0xBB,
- 0xBB, 0x00, 0x00, 0x00, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x00, 0x00, 0x00, 0x00, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x74, 0x70, 0x00, 0x00, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x70, 0x00,
- 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x00, 0x00, 0x44, 0x44, 0x44, 0x44,
- 0x44, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x40, 0x00, 0x00, 0x00,
- 0x44, 0x00, 0x00, 0x00, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xB0, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x74, 0x44, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x44,
- 0x44, 0x44, 0x44, 0x40, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44,
- 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x40, 0x04, 0xBB, 0xBB, 0xBB, 0xBB,
- 0xBB, 0x00, 0x00, 0x00, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x44, 0x44, 0x47, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x47, 0x77,
- 0x77, 0x77, 0x00, 0x00, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x44, 0x44, 0x44, 0x44, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x44, 0x47, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x74, 0x44, 0x44, 0x44,
- 0x44, 0x40, 0x00, 0x77, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44,
- 0x00, 0x00, 0x00, 0x00, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0x00, 0x07, 0x77,
- 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x44, 0x40, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44,
- 0x44, 0x44, 0x44, 0x44, 0x47, 0x77, 0x74, 0x77, 0x77, 0x40, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44,
- 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x44,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x00, 0x77, 0x77, 0x77, 0x00,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x00, 0x77, 0x77, 0x77, 0x00,
- 0x77, 0x77, 0x77, 0x77, 0x07, 0x07, 0x07, 0x07, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x00,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x70, 0x77, 0x77, 0x77, 0x70, 0x70, 0x00, 0x77, 0x70, 0x77,
- 0x77, 0x77, 0x70, 0x00, 0x77, 0x77, 0x00, 0x77, 0x77, 0x77, 0x00, 0x00,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x70, 0x00, 0x00, 0x77, 0x70, 0x77,
- 0x77, 0x77, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x55,
- 0x00, 0x00, 0x00, 0x00, 0xAA, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA0, 0x08,
- 0x33, 0x55, 0x55, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C,
- 0xC0, 0x00, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x55, 0x55, 0x50, 0x00, 0x00, 0x55, 0x55, 0x55,
- 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x77, 0x77, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44,
- 0x44, 0x44, 0x44, 0x44, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x70, 0x00, 0x07, 0x00, 0x77, 0x77, 0x77, 0x77, 0x77, 0x07, 0x00,
- 0x07, 0x77, 0x77, 0x00, 0x00, 0x00, 0x70, 0x70, 0x70, 0x77, 0x77, 0x07,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x00, 0x77, 0x77, 0x00, 0x00, 0x07, 0x77,
- 0x77, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x70, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x70, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x70, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x70, 0x00,
- 0x00, 0x07, 0x77, 0x74, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x70, 0x00, 0x00, 0x00, 0x00, 0x77, 0x77, 0x77, 0x70,
- 0x77, 0x77, 0x77, 0x70, 0x77, 0x77, 0x77, 0x70, 0x77, 0x77, 0x77, 0x70,
- 0x77, 0x77, 0x77, 0x70, 0x77, 0x77, 0x77, 0x70, 0x77, 0x77, 0x77, 0x70,
- 0x77, 0x77, 0x77, 0x70, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44,
- 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x44, 0x44,
- 0x06, 0x66, 0x66, 0x00, 0x00, 0x07, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x04, 0x46, 0x60, 0x00, 0x66, 0x66, 0x66, 0x66,
- 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
- 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
- 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
- 0x66, 0x66, 0x66, 0x66, 0x66, 0x60, 0x66, 0x66, 0x00, 0x00, 0x07, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x00, 0x07, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x70, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66,
- 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
- 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x60,
- 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
- 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
- 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
- 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x00,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x70, 0x00, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0x77, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x00, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x74, 0x44, 0x40, 0x00, 0x00, 0x00, 0x00, 0x44, 0x07,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x00, 0x00, 0x00, 0x00, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x44, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x07, 0x77, 0x77, 0x77, 0x77, 0x00, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x70, 0x07, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x77, 0x77,
- 0x77, 0x47, 0x77, 0x47, 0x77, 0x74, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x74, 0x44, 0x44, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x44, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44,
- 0x44, 0x44, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0xBB, 0xBB, 0xBB, 0xBB,
- 0xBB, 0x00, 0x00, 0x00, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44,
- 0x44, 0x77, 0x77, 0x77, 0x00, 0x07, 0x00, 0x00, 0xBB, 0xBB, 0xBB, 0xBB,
- 0xBB, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x44, 0x44, 0x44, 0x44, 0x00, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x74, 0x44, 0x44, 0x44, 0x44,
- 0x44, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x70, 0x00,
- 0x44, 0x44, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x74, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x40, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x07, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x74, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x40, 0x00, 0x00, 0x00, 0x00,
- 0x77, 0x74, 0x77, 0x77, 0x77, 0x77, 0x44, 0x00, 0xBB, 0xBB, 0xBB, 0xBB,
- 0xBB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x44, 0x40, 0x04,
- 0x40, 0x00, 0x00, 0x44, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x74, 0x44, 0x44, 0x44, 0x40, 0x44, 0x00,
- 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0x00, 0x00, 0x00, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x70, 0x00, 0x07, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x77, 0x77, 0x77, 0x70, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x07, 0x77, 0x77, 0x00, 0x00, 0x07, 0x47, 0x77, 0x77, 0x77, 0x77,
- 0x70, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x70, 0x77, 0x77, 0x70, 0x70,
- 0x77, 0x07, 0x70, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x07, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x00, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x00, 0x00, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44,
- 0x90, 0x08, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x44, 0x44, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0xCC, 0x90, 0xA0, 0x98, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x77, 0x77, 0x70, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x70, 0x05,
- 0x00, 0x00, 0x00, 0x0A, 0x00, 0x00, 0x90, 0xA0, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x89, 0x00, 0x00, 0x07, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x70, 0x00, 0x0C, 0x07, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x70, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
- 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
- 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x44, 0x77, 0x77, 0x77, 0x77,
- 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x70,
- 0x00, 0x77, 0x77, 0x77, 0x00, 0x77, 0x77, 0x77, 0x00, 0x77, 0x77, 0x77,
- 0x00, 0x77, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x05, 0x55, 0x00, 0x00,
-};
-
-FX_WordBreakProp GetWordBreakProperty(FX_WCHAR wcCodePoint) {
- uint32_t dwProperty =
- (uint32_t)gs_FX_WordBreak_CodePointProperties[wcCodePoint >> 1];
- return (FX_WordBreakProp)(((wcCodePoint)&1) ? (dwProperty & 0x0F)
- : (dwProperty >> 4));
-}
-
-} // namespace
-
-CFX_WordBreak::CFX_WordBreak() {}
-
-CFX_WordBreak::~CFX_WordBreak() {}
-
-void CFX_WordBreak::Attach(IFX_CharIter* pIter) {
- ASSERT(pIter);
- m_pCurIter.reset(pIter);
-}
-
-void CFX_WordBreak::Attach(const CFX_WideString& wsText) {
- m_pCurIter = pdfium::MakeUnique<CFX_CharIter>(wsText);
-}
-
-bool CFX_WordBreak::Next(bool bPrev) {
- std::unique_ptr<IFX_CharIter> pIter(
- (bPrev ? m_pPreIter : m_pCurIter)->Clone());
- if (pIter->IsEOF(!bPrev))
- return false;
-
- pIter->Next(bPrev);
- if (!FindNextBreakPos(pIter.get(), bPrev, true))
- return false;
-
- if (bPrev) {
- m_pCurIter = std::move(m_pPreIter);
- m_pCurIter->Next(true);
- m_pPreIter = std::move(pIter);
- } else {
- m_pPreIter = std::move(m_pCurIter);
- m_pPreIter->Next();
- m_pCurIter = std::move(pIter);
- }
- return true;
-}
-
-void CFX_WordBreak::SetAt(int32_t nIndex) {
- m_pPreIter.reset();
- m_pCurIter->SetAt(nIndex);
- FindNextBreakPos(m_pCurIter.get(), true, false);
- m_pPreIter = std::move(m_pCurIter);
- m_pCurIter.reset(m_pPreIter->Clone());
- FindNextBreakPos(m_pCurIter.get(), false, false);
-}
-
-int32_t CFX_WordBreak::GetWordPos() const {
- return m_pPreIter->GetAt();
-}
-
-int32_t CFX_WordBreak::GetWordLength() const {
- return m_pCurIter->GetAt() - m_pPreIter->GetAt() + 1;
-}
-
-void CFX_WordBreak::GetWord(CFX_WideString& wsWord) const {
- int32_t nWordLength = GetWordLength();
- if (nWordLength <= 0) {
- return;
- }
- FX_WCHAR* lpBuf = wsWord.GetBuffer(nWordLength);
- std::unique_ptr<IFX_CharIter> pTempIter(m_pPreIter->Clone());
- int32_t i = 0;
- while (pTempIter->GetAt() <= m_pCurIter->GetAt()) {
- lpBuf[i++] = pTempIter->GetChar();
- if (!pTempIter->Next())
- break;
- }
- wsWord.ReleaseBuffer(nWordLength);
-}
-
-bool CFX_WordBreak::IsEOF(bool bTail) const {
- return m_pCurIter->IsEOF(bTail);
-}
-
-bool CFX_WordBreak::FindNextBreakPos(IFX_CharIter* pIter,
- bool bPrev,
- bool bFromNext) {
- FX_WordBreakProp ePreType = FX_WordBreakProp_None;
- FX_WordBreakProp eCurType = FX_WordBreakProp_None;
- FX_WordBreakProp eNextType = FX_WordBreakProp_None;
- if (pIter->IsEOF(!bPrev)) {
- return true;
- }
- if (!(bFromNext || pIter->IsEOF(bPrev))) {
- pIter->Next(!bPrev);
- ePreType = GetWordBreakProperty(pIter->GetChar());
- pIter->Next(bPrev);
- }
- eCurType = GetWordBreakProperty(pIter->GetChar());
- bool bFirst = true;
- do {
- pIter->Next(bPrev);
- eNextType = GetWordBreakProperty(pIter->GetChar());
- uint16_t wBreak =
- gs_FX_WordBreak_Table[eCurType] & ((uint16_t)(1 << eNextType));
- if (wBreak) {
- if (pIter->IsEOF(!bPrev)) {
- pIter->Next(!bPrev);
- return true;
- }
- if (bFirst) {
- int32_t nFlags = 0;
- if (eCurType == FX_WordBreakProp_MidLetter) {
- if (eNextType == FX_WordBreakProp_ALetter) {
- nFlags = 1;
- }
- } else if (eCurType == FX_WordBreakProp_MidNum) {
- if (eNextType == FX_WordBreakProp_Numberic) {
- nFlags = 2;
- }
- } else if (eCurType == FX_WordBreakProp_MidNumLet) {
- if (eNextType == FX_WordBreakProp_ALetter) {
- nFlags = 1;
- } else if (eNextType == FX_WordBreakProp_Numberic) {
- nFlags = 2;
- }
- }
- if (nFlags > 0) {
- ASSERT(nFlags <= 2);
- if (!((nFlags == 1 && ePreType == FX_WordBreakProp_ALetter) ||
- (nFlags == 2 && ePreType == FX_WordBreakProp_Numberic))) {
- pIter->Next(!bPrev);
- return true;
- }
- pIter->Next(bPrev);
- wBreak = false;
- }
- bFirst = false;
- }
- if (wBreak) {
- int32_t nFlags = 0;
- if (eNextType == FX_WordBreakProp_MidLetter) {
- if (eCurType == FX_WordBreakProp_ALetter) {
- nFlags = 1;
- }
- } else if (eNextType == FX_WordBreakProp_MidNum) {
- if (eCurType == FX_WordBreakProp_Numberic) {
- nFlags = 2;
- }
- } else if (eNextType == FX_WordBreakProp_MidNumLet) {
- if (eCurType == FX_WordBreakProp_ALetter) {
- nFlags = 1;
- } else if (eCurType == FX_WordBreakProp_Numberic) {
- nFlags = 2;
- }
- }
- if (nFlags <= 0) {
- pIter->Next(!bPrev);
- return true;
- }
- ASSERT(nFlags <= 2);
- pIter->Next(bPrev);
- eNextType = (FX_WordBreakProp)GetWordBreakProperty(pIter->GetChar());
- if (!((nFlags == 1 && eNextType == FX_WordBreakProp_ALetter) ||
- (nFlags == 2 && eNextType == FX_WordBreakProp_Numberic))) {
- pIter->Next(!bPrev);
- pIter->Next(!bPrev);
- return true;
- }
- }
- }
- ePreType = eCurType;
- eCurType = eNextType;
- bFirst = false;
- } while (!pIter->IsEOF(!bPrev));
- return true;
-}
diff --git a/chromium/third_party/pdfium/xfa/fde/cfx_wordbreak.h b/chromium/third_party/pdfium/xfa/fde/cfx_wordbreak.h
deleted file mode 100644
index 9df6eda1f59..00000000000
--- a/chromium/third_party/pdfium/xfa/fde/cfx_wordbreak.h
+++ /dev/null
@@ -1,39 +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 XFA_FDE_CFX_WORDBREAK_H_
-#define XFA_FDE_CFX_WORDBREAK_H_
-
-#include <memory>
-
-#include "core/fxcrt/fx_string.h"
-#include "core/fxcrt/fx_system.h"
-
-class IFX_CharIter;
-
-class CFX_WordBreak {
- public:
- CFX_WordBreak();
- ~CFX_WordBreak();
-
- void Attach(IFX_CharIter* pIter);
- void Attach(const CFX_WideString& wsText);
- bool Next(bool bPrev);
- void SetAt(int32_t nIndex);
- int32_t GetWordPos() const;
- int32_t GetWordLength() const;
- void GetWord(CFX_WideString& wsWord) const;
- bool IsEOF(bool bTail) const;
-
- protected:
- bool FindNextBreakPos(IFX_CharIter* pIter, bool bPrev, bool bFromNext = true);
-
- private:
- std::unique_ptr<IFX_CharIter> m_pPreIter;
- std::unique_ptr<IFX_CharIter> m_pCurIter;
-};
-
-#endif // XFA_FDE_CFX_WORDBREAK_H_
diff --git a/chromium/third_party/pdfium/xfa/fde/css/cfde_csscomputedstyle.cpp b/chromium/third_party/pdfium/xfa/fde/css/cfde_csscomputedstyle.cpp
index 01872d18fc4..92184d42593 100644
--- a/chromium/third_party/pdfium/xfa/fde/css/cfde_csscomputedstyle.cpp
+++ b/chromium/third_party/pdfium/xfa/fde/css/cfde_csscomputedstyle.cpp
@@ -50,7 +50,7 @@ FDE_CSSFontStyle CFDE_CSSComputedStyle::GetFontStyle() const {
return m_InheritedData.m_eFontStyle;
}
-FX_FLOAT CFDE_CSSComputedStyle::GetFontSize() const {
+float CFDE_CSSComputedStyle::GetFontSize() const {
return m_InheritedData.m_fFontSize;
}
@@ -70,7 +70,7 @@ void CFDE_CSSComputedStyle::SetFontStyle(FDE_CSSFontStyle eFontStyle) {
m_InheritedData.m_eFontStyle = eFontStyle;
}
-void CFDE_CSSComputedStyle::SetFontSize(FX_FLOAT fFontSize) {
+void CFDE_CSSComputedStyle::SetFontSize(float fFontSize) {
m_InheritedData.m_fFontSize = fFontSize;
}
@@ -107,7 +107,7 @@ FDE_CSSDisplay CFDE_CSSComputedStyle::GetDisplay() const {
return m_NonInheritedData.m_eDisplay;
}
-FX_FLOAT CFDE_CSSComputedStyle::GetLineHeight() const {
+float CFDE_CSSComputedStyle::GetLineHeight() const {
return m_InheritedData.m_fLineHeight;
}
@@ -123,7 +123,7 @@ FDE_CSSVerticalAlign CFDE_CSSComputedStyle::GetVerticalAlign() const {
return m_NonInheritedData.m_eVerticalAlign;
}
-FX_FLOAT CFDE_CSSComputedStyle::GetNumberVerticalAlign() const {
+float CFDE_CSSComputedStyle::GetNumberVerticalAlign() const {
return m_NonInheritedData.m_fVerticalAlign;
}
@@ -135,7 +135,7 @@ const FDE_CSSLength& CFDE_CSSComputedStyle::GetLetterSpacing() const {
return m_InheritedData.m_LetterSpacing;
}
-void CFDE_CSSComputedStyle::SetLineHeight(FX_FLOAT fLineHeight) {
+void CFDE_CSSComputedStyle::SetLineHeight(float fLineHeight) {
m_InheritedData.m_fLineHeight = fLineHeight;
}
@@ -147,7 +147,7 @@ void CFDE_CSSComputedStyle::SetTextAlign(FDE_CSSTextAlign eTextAlign) {
m_InheritedData.m_eTextAlign = eTextAlign;
}
-void CFDE_CSSComputedStyle::SetNumberVerticalAlign(FX_FLOAT fAlign) {
+void CFDE_CSSComputedStyle::SetNumberVerticalAlign(float fAlign) {
m_NonInheritedData.m_eVerticalAlign = FDE_CSSVerticalAlign::Number,
m_NonInheritedData.m_fVerticalAlign = fAlign;
}
diff --git a/chromium/third_party/pdfium/xfa/fde/css/cfde_csscomputedstyle.h b/chromium/third_party/pdfium/xfa/fde/css/cfde_csscomputedstyle.h
index bba4ccbcd44..448d2467abb 100644
--- a/chromium/third_party/pdfium/xfa/fde/css/cfde_csscomputedstyle.h
+++ b/chromium/third_party/pdfium/xfa/fde/css/cfde_csscomputedstyle.h
@@ -27,8 +27,8 @@ class CFDE_CSSComputedStyle : public CFX_Retainable {
FDE_CSSLength m_WordSpacing;
FDE_CSSLength m_TextIndent;
CFX_RetainPtr<CFDE_CSSValueList> m_pFontFamily;
- FX_FLOAT m_fFontSize;
- FX_FLOAT m_fLineHeight;
+ float m_fFontSize;
+ float m_fLineHeight;
FX_ARGB m_dwFontColor;
uint16_t m_wFontWeight;
FDE_CSSFontVariant m_eFontVariant;
@@ -47,7 +47,7 @@ class CFDE_CSSComputedStyle : public CFX_Retainable {
FDE_CSSLength m_Bottom;
FDE_CSSLength m_Left;
FDE_CSSLength m_Right;
- FX_FLOAT m_fVerticalAlign;
+ float m_fVerticalAlign;
FDE_CSSDisplay m_eDisplay;
FDE_CSSVerticalAlign m_eVerticalAlign;
uint8_t m_dwTextDecoration;
@@ -61,12 +61,12 @@ class CFDE_CSSComputedStyle : public CFX_Retainable {
uint16_t GetFontWeight() const;
FDE_CSSFontVariant GetFontVariant() const;
FDE_CSSFontStyle GetFontStyle() const;
- FX_FLOAT GetFontSize() const;
+ float GetFontSize() const;
FX_ARGB GetColor() const;
void SetFontWeight(uint16_t wFontWeight);
void SetFontVariant(FDE_CSSFontVariant eFontVariant);
void SetFontStyle(FDE_CSSFontStyle eFontStyle);
- void SetFontSize(FX_FLOAT fFontSize);
+ void SetFontSize(float fFontSize);
void SetColor(FX_ARGB dwFontColor);
const FDE_CSSRect* GetBorderWidth() const;
@@ -77,17 +77,17 @@ class CFDE_CSSComputedStyle : public CFX_Retainable {
FDE_CSSDisplay GetDisplay() const;
- FX_FLOAT GetLineHeight() const;
+ float GetLineHeight() const;
const FDE_CSSLength& GetTextIndent() const;
FDE_CSSTextAlign GetTextAlign() const;
FDE_CSSVerticalAlign GetVerticalAlign() const;
- FX_FLOAT GetNumberVerticalAlign() const;
+ float GetNumberVerticalAlign() const;
uint32_t GetTextDecoration() const;
const FDE_CSSLength& GetLetterSpacing() const;
- void SetLineHeight(FX_FLOAT fLineHeight);
+ void SetLineHeight(float fLineHeight);
void SetTextIndent(const FDE_CSSLength& textIndent);
void SetTextAlign(FDE_CSSTextAlign eTextAlign);
- void SetNumberVerticalAlign(FX_FLOAT fAlign);
+ void SetNumberVerticalAlign(float fAlign);
void SetTextDecoration(uint32_t dwTextDecoration);
void SetLetterSpacing(const FDE_CSSLength& letterSpacing);
void AddCustomStyle(const CFDE_CSSCustomProperty& prop);
diff --git a/chromium/third_party/pdfium/xfa/fde/css/cfde_cssdeclaration.cpp b/chromium/third_party/pdfium/xfa/fde/css/cfde_cssdeclaration.cpp
index 3c776ca7715..89830592205 100644
--- a/chromium/third_party/pdfium/xfa/fde/css/cfde_cssdeclaration.cpp
+++ b/chromium/third_party/pdfium/xfa/fde/css/cfde_cssdeclaration.cpp
@@ -23,9 +23,9 @@ uint8_t Hex2Dec(uint8_t hexHigh, uint8_t hexLow) {
return (FXSYS_toHexDigit(hexHigh) << 4) + FXSYS_toHexDigit(hexLow);
}
-bool ParseCSSNumber(const FX_WCHAR* pszValue,
+bool ParseCSSNumber(const wchar_t* pszValue,
int32_t iValueLen,
- FX_FLOAT& fValue,
+ float& fValue,
FDE_CSSNumberType& eUnit) {
ASSERT(pszValue && iValueLen > 0);
int32_t iUsedLen = 0;
@@ -50,7 +50,7 @@ bool ParseCSSNumber(const FX_WCHAR* pszValue,
} // namespace
// static
-bool CFDE_CSSDeclaration::ParseCSSString(const FX_WCHAR* pszValue,
+bool CFDE_CSSDeclaration::ParseCSSString(const wchar_t* pszValue,
int32_t iValueLen,
int32_t* iOffset,
int32_t* iLength) {
@@ -58,7 +58,7 @@ bool CFDE_CSSDeclaration::ParseCSSString(const FX_WCHAR* pszValue,
*iOffset = 0;
*iLength = iValueLen;
if (iValueLen >= 2) {
- FX_WCHAR first = pszValue[0], last = pszValue[iValueLen - 1];
+ wchar_t first = pszValue[0], last = pszValue[iValueLen - 1];
if ((first == '\"' && last == '\"') || (first == '\'' && last == '\'')) {
*iOffset = 1;
*iLength -= 2;
@@ -68,7 +68,7 @@ bool CFDE_CSSDeclaration::ParseCSSString(const FX_WCHAR* pszValue,
}
// static.
-bool CFDE_CSSDeclaration::ParseCSSColor(const FX_WCHAR* pszValue,
+bool CFDE_CSSDeclaration::ParseCSSColor(const wchar_t* pszValue,
int32_t iValueLen,
FX_ARGB* dwColor) {
ASSERT(pszValue && iValueLen > 0);
@@ -100,7 +100,7 @@ bool CFDE_CSSDeclaration::ParseCSSColor(const FX_WCHAR* pszValue,
return false;
uint8_t rgb[3] = {0};
- FX_FLOAT fValue;
+ float fValue;
FDE_CSSPrimitiveType eType;
CFDE_CSSValueListParser list(pszValue + 4, iValueLen - 5, ',');
for (int32_t i = 0; i < 3; ++i) {
@@ -159,7 +159,7 @@ void CFDE_CSSDeclaration::AddProperty(const FDE_CSSPropertyTable* pTable,
const CFX_WideStringC& value) {
ASSERT(!value.IsEmpty());
- const FX_WCHAR* pszValue = value.c_str();
+ const wchar_t* pszValue = value.c_str();
int32_t iValueLen = value.GetLength();
bool bImportant = false;
@@ -277,9 +277,9 @@ void CFDE_CSSDeclaration::AddProperty(const CFX_WideString& prop,
}
CFX_RetainPtr<CFDE_CSSValue> CFDE_CSSDeclaration::ParseNumber(
- const FX_WCHAR* pszValue,
+ const wchar_t* pszValue,
int32_t iValueLen) {
- FX_FLOAT fValue;
+ float fValue;
FDE_CSSNumberType eUnit;
if (!ParseCSSNumber(pszValue, iValueLen, fValue, eUnit))
return nullptr;
@@ -287,7 +287,7 @@ CFX_RetainPtr<CFDE_CSSValue> CFDE_CSSDeclaration::ParseNumber(
}
CFX_RetainPtr<CFDE_CSSValue> CFDE_CSSDeclaration::ParseEnum(
- const FX_WCHAR* pszValue,
+ const wchar_t* pszValue,
int32_t iValueLen) {
const FDE_CSSPropertyValueTable* pValue =
FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen));
@@ -296,7 +296,7 @@ CFX_RetainPtr<CFDE_CSSValue> CFDE_CSSDeclaration::ParseEnum(
}
CFX_RetainPtr<CFDE_CSSValue> CFDE_CSSDeclaration::ParseColor(
- const FX_WCHAR* pszValue,
+ const wchar_t* pszValue,
int32_t iValueLen) {
FX_ARGB dwColor;
if (!ParseCSSColor(pszValue, iValueLen, &dwColor))
@@ -305,7 +305,7 @@ CFX_RetainPtr<CFDE_CSSValue> CFDE_CSSDeclaration::ParseColor(
}
CFX_RetainPtr<CFDE_CSSValue> CFDE_CSSDeclaration::ParseString(
- const FX_WCHAR* pszValue,
+ const wchar_t* pszValue,
int32_t iValueLen) {
int32_t iOffset;
if (!ParseCSSString(pszValue, iValueLen, &iOffset, &iValueLen))
@@ -320,10 +320,10 @@ CFX_RetainPtr<CFDE_CSSValue> CFDE_CSSDeclaration::ParseString(
void CFDE_CSSDeclaration::ParseValueListProperty(
const FDE_CSSPropertyTable* pTable,
- const FX_WCHAR* pszValue,
+ const wchar_t* pszValue,
int32_t iValueLen,
bool bImportant) {
- FX_WCHAR separator =
+ wchar_t separator =
(pTable->eName == FDE_CSSProperty::FontFamily) ? ',' : ' ';
CFDE_CSSValueListParser parser(pszValue, iValueLen, separator);
@@ -334,7 +334,7 @@ void CFDE_CSSDeclaration::ParseValueListProperty(
switch (eType) {
case FDE_CSSPrimitiveType::Number:
if (dwType & FDE_CSSVALUETYPE_MaybeNumber) {
- FX_FLOAT fValue;
+ float fValue;
FDE_CSSNumberType eNumType;
if (ParseCSSNumber(pszValue, iValueLen, fValue, eNumType))
list.push_back(
@@ -444,7 +444,7 @@ void CFDE_CSSDeclaration::Add4ValuesProperty(
}
bool CFDE_CSSDeclaration::ParseBorderProperty(
- const FX_WCHAR* pszValue,
+ const wchar_t* pszValue,
int32_t iValueLen,
CFX_RetainPtr<CFDE_CSSValue>& pWidth) const {
pWidth.Reset(nullptr);
@@ -457,7 +457,7 @@ bool CFDE_CSSDeclaration::ParseBorderProperty(
if (pWidth)
continue;
- FX_FLOAT fValue;
+ float fValue;
FDE_CSSNumberType eNumType;
if (ParseCSSNumber(pszValue, iValueLen, fValue, eNumType))
pWidth = pdfium::MakeRetain<CFDE_CSSNumberValue>(eNumType, fValue);
@@ -497,7 +497,7 @@ bool CFDE_CSSDeclaration::ParseBorderProperty(
return true;
}
-void CFDE_CSSDeclaration::ParseFontProperty(const FX_WCHAR* pszValue,
+void CFDE_CSSDeclaration::ParseFontProperty(const wchar_t* pszValue,
int32_t iValueLen,
bool bImportant) {
CFDE_CSSValueListParser parser(pszValue, iValueLen, '/');
@@ -569,7 +569,7 @@ void CFDE_CSSDeclaration::ParseFontProperty(const FX_WCHAR* pszValue,
break;
}
case FDE_CSSPrimitiveType::Number: {
- FX_FLOAT fValue;
+ float fValue;
FDE_CSSNumberType eNumType;
if (!ParseCSSNumber(pszValue, iValueLen, fValue, eNumType))
break;
diff --git a/chromium/third_party/pdfium/xfa/fde/css/cfde_cssdeclaration.h b/chromium/third_party/pdfium/xfa/fde/css/cfde_cssdeclaration.h
index eb287308f8b..3c2e058a43b 100644
--- a/chromium/third_party/pdfium/xfa/fde/css/cfde_cssdeclaration.h
+++ b/chromium/third_party/pdfium/xfa/fde/css/cfde_cssdeclaration.h
@@ -23,11 +23,11 @@ class CFDE_CSSDeclaration {
using const_custom_iterator =
std::vector<std::unique_ptr<CFDE_CSSCustomProperty>>::const_iterator;
- static bool ParseCSSString(const FX_WCHAR* pszValue,
+ static bool ParseCSSString(const wchar_t* pszValue,
int32_t iValueLen,
int32_t* iOffset,
int32_t* iLength);
- static bool ParseCSSColor(const FX_WCHAR* pszValue,
+ static bool ParseCSSColor(const wchar_t* pszValue,
int32_t iValueLen,
FX_ARGB* dwColor);
@@ -53,19 +53,19 @@ class CFDE_CSSDeclaration {
size_t PropertyCountForTesting() const;
- FX_ARGB ParseColorForTest(const FX_WCHAR* pszValue,
+ FX_ARGB ParseColorForTest(const wchar_t* pszValue,
int32_t iValueLen,
FX_ARGB* dwColor) const;
private:
- void ParseFontProperty(const FX_WCHAR* pszValue,
+ void ParseFontProperty(const wchar_t* pszValue,
int32_t iValueLen,
bool bImportant);
- bool ParseBorderProperty(const FX_WCHAR* pszValue,
+ bool ParseBorderProperty(const wchar_t* pszValue,
int32_t iValueLen,
CFX_RetainPtr<CFDE_CSSValue>& pWidth) const;
void ParseValueListProperty(const FDE_CSSPropertyTable* pTable,
- const FX_WCHAR* pszValue,
+ const wchar_t* pszValue,
int32_t iValueLen,
bool bImportant);
void Add4ValuesProperty(const std::vector<CFX_RetainPtr<CFDE_CSSValue>>& list,
@@ -74,13 +74,13 @@ class CFDE_CSSDeclaration {
FDE_CSSProperty eTop,
FDE_CSSProperty eRight,
FDE_CSSProperty eBottom);
- CFX_RetainPtr<CFDE_CSSValue> ParseNumber(const FX_WCHAR* pszValue,
+ CFX_RetainPtr<CFDE_CSSValue> ParseNumber(const wchar_t* pszValue,
int32_t iValueLen);
- CFX_RetainPtr<CFDE_CSSValue> ParseEnum(const FX_WCHAR* pszValue,
+ CFX_RetainPtr<CFDE_CSSValue> ParseEnum(const wchar_t* pszValue,
int32_t iValueLen);
- CFX_RetainPtr<CFDE_CSSValue> ParseColor(const FX_WCHAR* pszValue,
+ CFX_RetainPtr<CFDE_CSSValue> ParseColor(const wchar_t* pszValue,
int32_t iValueLen);
- CFX_RetainPtr<CFDE_CSSValue> ParseString(const FX_WCHAR* pszValue,
+ CFX_RetainPtr<CFDE_CSSValue> ParseString(const wchar_t* pszValue,
int32_t iValueLen);
void AddPropertyHolder(FDE_CSSProperty eProperty,
CFX_RetainPtr<CFDE_CSSValue> pValue,
diff --git a/chromium/third_party/pdfium/xfa/fde/css/cfde_cssdeclaration_unittest.cpp b/chromium/third_party/pdfium/xfa/fde/css/cfde_cssdeclaration_unittest.cpp
index 48a3c72c39b..80cd72c4d33 100644
--- a/chromium/third_party/pdfium/xfa/fde/css/cfde_cssdeclaration_unittest.cpp
+++ b/chromium/third_party/pdfium/xfa/fde/css/cfde_cssdeclaration_unittest.cpp
@@ -5,8 +5,11 @@
#include "xfa/fde/css/cfde_cssdeclaration.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "testing/test_support.h"
-TEST(CFDE_CSSDecalration, HexEncodingParsing) {
+class CFDE_CSSDecalrationTest : public pdfium::FPDF_Test {};
+
+TEST_F(CFDE_CSSDecalrationTest, HexEncodingParsing) {
FX_ARGB color;
// Length value invalid.
@@ -42,7 +45,7 @@ TEST(CFDE_CSSDecalration, HexEncodingParsing) {
EXPECT_EQ(60, FXARGB_B(color));
}
-TEST(CFDE_CSSDecalration, RGBEncodingParsing) {
+TEST_F(CFDE_CSSDecalrationTest, RGBEncodingParsing) {
FX_ARGB color;
// Invalid input for rgb() syntax.
diff --git a/chromium/third_party/pdfium/xfa/fde/css/cfde_cssnumbervalue.cpp b/chromium/third_party/pdfium/xfa/fde/css/cfde_cssnumbervalue.cpp
index 71566ca5a3d..45a9c917b12 100644
--- a/chromium/third_party/pdfium/xfa/fde/css/cfde_cssnumbervalue.cpp
+++ b/chromium/third_party/pdfium/xfa/fde/css/cfde_cssnumbervalue.cpp
@@ -6,15 +6,15 @@
#include "xfa/fde/css/cfde_cssnumbervalue.h"
-CFDE_CSSNumberValue::CFDE_CSSNumberValue(FDE_CSSNumberType type, FX_FLOAT value)
+CFDE_CSSNumberValue::CFDE_CSSNumberValue(FDE_CSSNumberType type, float value)
: CFDE_CSSValue(FDE_CSSPrimitiveType::Number), type_(type), value_(value) {
- if (type_ == FDE_CSSNumberType::Number && FXSYS_fabs(value_) < 0.001f)
+ if (type_ == FDE_CSSNumberType::Number && fabs(value_) < 0.001f)
value_ = 0.0f;
}
CFDE_CSSNumberValue::~CFDE_CSSNumberValue() {}
-FX_FLOAT CFDE_CSSNumberValue::Apply(FX_FLOAT percentBase) const {
+float CFDE_CSSNumberValue::Apply(float percentBase) const {
switch (type_) {
case FDE_CSSNumberType::Pixels:
case FDE_CSSNumberType::Number:
diff --git a/chromium/third_party/pdfium/xfa/fde/css/cfde_cssnumbervalue.h b/chromium/third_party/pdfium/xfa/fde/css/cfde_cssnumbervalue.h
index 29e562e1e35..c4d0bd25f05 100644
--- a/chromium/third_party/pdfium/xfa/fde/css/cfde_cssnumbervalue.h
+++ b/chromium/third_party/pdfium/xfa/fde/css/cfde_cssnumbervalue.h
@@ -25,17 +25,17 @@ enum class FDE_CSSNumberType {
class CFDE_CSSNumberValue : public CFDE_CSSValue {
public:
- CFDE_CSSNumberValue(FDE_CSSNumberType type, FX_FLOAT value);
+ CFDE_CSSNumberValue(FDE_CSSNumberType type, float value);
~CFDE_CSSNumberValue() override;
- FX_FLOAT Value() const { return value_; }
+ float Value() const { return value_; }
FDE_CSSNumberType Kind() const { return type_; }
- FX_FLOAT Apply(FX_FLOAT percentBase) const;
+ float Apply(float percentBase) const;
private:
FDE_CSSNumberType type_;
- FX_FLOAT value_;
+ float value_;
};
#endif // XFA_FDE_CSS_CFDE_CSSNUMBERVALUE_H_
diff --git a/chromium/third_party/pdfium/xfa/fde/css/cfde_cssselector.cpp b/chromium/third_party/pdfium/xfa/fde/css/cfde_cssselector.cpp
index 03580236f52..6842d587388 100644
--- a/chromium/third_party/pdfium/xfa/fde/css/cfde_cssselector.cpp
+++ b/chromium/third_party/pdfium/xfa/fde/css/cfde_cssselector.cpp
@@ -12,14 +12,14 @@
namespace {
-bool IsCSSChar(FX_WCHAR wch) {
+bool IsCSSChar(wchar_t wch) {
return (wch >= 'a' && wch <= 'z') || (wch >= 'A' && wch <= 'Z');
}
-int32_t GetCSSNameLen(const FX_WCHAR* psz, const FX_WCHAR* pEnd) {
- const FX_WCHAR* pStart = psz;
+int32_t GetCSSNameLen(const wchar_t* psz, const wchar_t* pEnd) {
+ const wchar_t* pStart = psz;
while (psz < pEnd) {
- FX_WCHAR wch = *psz;
+ wchar_t wch = *psz;
if (IsCSSChar(wch) || (wch >= '0' && wch <= '9') || wch == '_' ||
wch == '-') {
++psz;
@@ -33,7 +33,7 @@ int32_t GetCSSNameLen(const FX_WCHAR* psz, const FX_WCHAR* pEnd) {
} // namespace
CFDE_CSSSelector::CFDE_CSSSelector(FDE_CSSSelectorType eType,
- const FX_WCHAR* psz,
+ const wchar_t* psz,
int32_t iLen,
bool bIgnoreCase)
: m_eType(eType),
@@ -58,9 +58,9 @@ std::unique_ptr<CFDE_CSSSelector> CFDE_CSSSelector::FromString(
const CFX_WideStringC& str) {
ASSERT(!str.IsEmpty());
- const FX_WCHAR* psz = str.c_str();
- const FX_WCHAR* pStart = psz;
- const FX_WCHAR* pEnd = psz + str.GetLength();
+ const wchar_t* psz = str.c_str();
+ const wchar_t* pStart = psz;
+ const wchar_t* pEnd = psz + str.GetLength();
for (; psz < pEnd; ++psz) {
switch (*psz) {
case '>':
@@ -72,7 +72,7 @@ std::unique_ptr<CFDE_CSSSelector> CFDE_CSSSelector::FromString(
std::unique_ptr<CFDE_CSSSelector> pFirst = nullptr;
for (psz = pStart; psz < pEnd;) {
- FX_WCHAR wch = *psz;
+ wchar_t wch = *psz;
if (IsCSSChar(wch) || wch == '*') {
int32_t iNameLen = wch == '*' ? 1 : GetCSSNameLen(psz, pEnd);
auto p = pdfium::MakeUnique<CFDE_CSSSelector>(
diff --git a/chromium/third_party/pdfium/xfa/fde/css/cfde_cssselector.h b/chromium/third_party/pdfium/xfa/fde/css/cfde_cssselector.h
index d585b3f368e..048c51339e5 100644
--- a/chromium/third_party/pdfium/xfa/fde/css/cfde_cssselector.h
+++ b/chromium/third_party/pdfium/xfa/fde/css/cfde_cssselector.h
@@ -19,7 +19,7 @@ class CFDE_CSSSelector {
const CFX_WideStringC& str);
CFDE_CSSSelector(FDE_CSSSelectorType eType,
- const FX_WCHAR* psz,
+ const wchar_t* psz,
int32_t iLen,
bool bIgnoreCase);
~CFDE_CSSSelector();
diff --git a/chromium/third_party/pdfium/xfa/fde/css/cfde_cssstyleselector.cpp b/chromium/third_party/pdfium/xfa/fde/css/cfde_cssstyleselector.cpp
index 5a7aa1b7ff0..42cc7afc23f 100644
--- a/chromium/third_party/pdfium/xfa/fde/css/cfde_cssstyleselector.cpp
+++ b/chromium/third_party/pdfium/xfa/fde/css/cfde_cssstyleselector.cpp
@@ -27,7 +27,7 @@ CFDE_CSSStyleSelector::CFDE_CSSStyleSelector(CFGAS_FontMgr* pFontMgr)
CFDE_CSSStyleSelector::~CFDE_CSSStyleSelector() {}
-void CFDE_CSSStyleSelector::SetDefFontSize(FX_FLOAT fFontSize) {
+void CFDE_CSSStyleSelector::SetDefFontSize(float fFontSize) {
ASSERT(fFontSize > 0);
m_fDefFontSize = fFontSize;
}
@@ -56,7 +56,7 @@ CFDE_CSSStyleSelector::MatchDeclarations(const CFX_WideString& tagname) {
if (m_UARules.CountSelectors() == 0 || tagname.IsEmpty())
return matchedDecls;
- auto rules = m_UARules.GetTagRuleData(tagname);
+ auto* rules = m_UARules.GetTagRuleData(tagname);
if (!rules)
return matchedDecls;
@@ -106,19 +106,19 @@ void CFDE_CSSStyleSelector::ApplyDeclarations(
std::vector<const CFDE_CSSPropertyHolder*> normals;
std::vector<const CFDE_CSSCustomProperty*> customs;
- for (auto& decl : declArray)
+ for (auto* decl : declArray)
ExtractValues(decl, &importants, &normals, &customs);
if (extraDecl)
ExtractValues(extraDecl, &importants, &normals, &customs);
- for (auto& prop : normals)
+ for (auto* prop : normals)
ApplyProperty(prop->eProperty, prop->pValue, pComputedStyle);
- for (auto& prop : customs)
+ for (auto* prop : customs)
pComputedStyle->AddCustomStyle(*prop);
- for (auto& prop : importants)
+ for (auto* prop : importants)
ApplyProperty(prop->eProperty, prop->pValue, pComputedStyle);
}
@@ -185,7 +185,7 @@ void CFDE_CSSStyleSelector::ApplyProperty(
}
break;
case FDE_CSSProperty::FontSize: {
- FX_FLOAT& fFontSize = pComputedStyle->m_InheritedData.m_fFontSize;
+ float& fFontSize = pComputedStyle->m_InheritedData.m_fFontSize;
if (eType == FDE_CSSPrimitiveType::Number) {
fFontSize = pValue.As<CFDE_CSSNumberValue>()->Apply(fFontSize);
} else if (eType == FDE_CSSPrimitiveType::Enum) {
@@ -478,7 +478,7 @@ bool CFDE_CSSStyleSelector::SetLengthWithPercent(
FDE_CSSLength& width,
FDE_CSSPrimitiveType eType,
const CFX_RetainPtr<CFDE_CSSValue>& pValue,
- FX_FLOAT fFontSize) {
+ float fFontSize) {
if (eType == FDE_CSSPrimitiveType::Number) {
CFX_RetainPtr<CFDE_CSSNumberValue> v = pValue.As<CFDE_CSSNumberValue>();
if (v->Kind() == FDE_CSSNumberType::Percent) {
@@ -487,7 +487,7 @@ bool CFDE_CSSStyleSelector::SetLengthWithPercent(
return width.NonZero();
}
- FX_FLOAT fValue = v->Apply(fFontSize);
+ float fValue = v->Apply(fFontSize);
width.Set(FDE_CSSLengthUnit::Point, fValue);
return width.NonZero();
} else if (eType == FDE_CSSPrimitiveType::Enum) {
@@ -514,8 +514,8 @@ bool CFDE_CSSStyleSelector::SetLengthWithPercent(
return false;
}
-FX_FLOAT CFDE_CSSStyleSelector::ToFontSize(FDE_CSSPropertyValue eValue,
- FX_FLOAT fCurFontSize) {
+float CFDE_CSSStyleSelector::ToFontSize(FDE_CSSPropertyValue eValue,
+ float fCurFontSize) {
switch (eValue) {
case FDE_CSSPropertyValue::XxSmall:
return m_fDefFontSize / 1.2f / 1.2f / 1.2f;
diff --git a/chromium/third_party/pdfium/xfa/fde/css/cfde_cssstyleselector.h b/chromium/third_party/pdfium/xfa/fde/css/cfde_cssstyleselector.h
index c7b6b4164a2..0783e72541e 100644
--- a/chromium/third_party/pdfium/xfa/fde/css/cfde_cssstyleselector.h
+++ b/chromium/third_party/pdfium/xfa/fde/css/cfde_cssstyleselector.h
@@ -30,7 +30,7 @@ class CFDE_CSSStyleSelector {
explicit CFDE_CSSStyleSelector(CFGAS_FontMgr* pFontMgr);
~CFDE_CSSStyleSelector();
- void SetDefFontSize(FX_FLOAT fFontSize);
+ void SetDefFontSize(float fFontSize);
void SetUAStyleSheet(std::unique_ptr<CFDE_CSSStyleSheet> pSheet);
void UpdateStyleIndex();
@@ -68,8 +68,8 @@ class CFDE_CSSStyleSelector {
bool SetLengthWithPercent(FDE_CSSLength& width,
FDE_CSSPrimitiveType eType,
const CFX_RetainPtr<CFDE_CSSValue>& pValue,
- FX_FLOAT fFontSize);
- FX_FLOAT ToFontSize(FDE_CSSPropertyValue eValue, FX_FLOAT fCurFontSize);
+ float fFontSize);
+ float ToFontSize(FDE_CSSPropertyValue eValue, float fCurFontSize);
FDE_CSSDisplay ToDisplay(FDE_CSSPropertyValue eValue);
FDE_CSSTextAlign ToTextAlign(FDE_CSSPropertyValue eValue);
uint16_t ToFontWeight(FDE_CSSPropertyValue eValue);
@@ -79,7 +79,7 @@ class CFDE_CSSStyleSelector {
FDE_CSSFontVariant ToFontVariant(FDE_CSSPropertyValue eValue);
CFGAS_FontMgr* const m_pFontMgr;
- FX_FLOAT m_fDefFontSize;
+ float m_fDefFontSize;
std::unique_ptr<CFDE_CSSStyleSheet> m_UAStyles;
CFDE_CSSRuleCollection m_UARules;
};
diff --git a/chromium/third_party/pdfium/xfa/fde/css/cfde_cssstylesheet.cpp b/chromium/third_party/pdfium/xfa/fde/css/cfde_cssstylesheet.cpp
index c8bf70ec231..175289be11f 100644
--- a/chromium/third_party/pdfium/xfa/fde/css/cfde_cssstylesheet.cpp
+++ b/chromium/third_party/pdfium/xfa/fde/css/cfde_cssstylesheet.cpp
@@ -34,7 +34,7 @@ CFDE_CSSStyleRule* CFDE_CSSStyleSheet::GetRule(int32_t index) const {
return m_RuleArray[index].get();
}
-bool CFDE_CSSStyleSheet::LoadBuffer(const FX_WCHAR* pBuffer, int32_t iBufSize) {
+bool CFDE_CSSStyleSheet::LoadBuffer(const wchar_t* pBuffer, int32_t iBufSize) {
ASSERT(pBuffer && iBufSize > 0);
auto pSyntax = pdfium::MakeUnique<CFDE_CSSSyntaxParser>();
@@ -85,7 +85,7 @@ FDE_CSSSyntaxStatus CFDE_CSSStyleSheet::LoadStyleRule(
case FDE_CSSSyntaxStatus::PropertyValue: {
if (propertyTable || iValueLen > 0) {
CFX_WideStringC strValue = pSyntax->GetCurrentString();
- auto decl = pStyleRule->GetDeclaration();
+ auto* decl = pStyleRule->GetDeclaration();
if (!strValue.IsEmpty()) {
if (propertyTable) {
decl->AddProperty(propertyTable, strValue);
diff --git a/chromium/third_party/pdfium/xfa/fde/css/cfde_cssstylesheet.h b/chromium/third_party/pdfium/xfa/fde/css/cfde_cssstylesheet.h
index 4de377219c5..fa734606340 100644
--- a/chromium/third_party/pdfium/xfa/fde/css/cfde_cssstylesheet.h
+++ b/chromium/third_party/pdfium/xfa/fde/css/cfde_cssstylesheet.h
@@ -21,7 +21,7 @@ class CFDE_CSSStyleSheet {
CFDE_CSSStyleSheet();
~CFDE_CSSStyleSheet();
- bool LoadBuffer(const FX_WCHAR* pBuffer, int32_t iBufSize);
+ bool LoadBuffer(const wchar_t* pBuffer, int32_t iBufSize);
int32_t CountRules() const;
CFDE_CSSStyleRule* GetRule(int32_t index) const;
@@ -34,7 +34,7 @@ class CFDE_CSSStyleSheet {
void SkipRuleSet(CFDE_CSSSyntaxParser* pSyntax);
std::vector<std::unique_ptr<CFDE_CSSStyleRule>> m_RuleArray;
- std::unordered_map<uint32_t, FX_WCHAR*> m_StringCache;
+ std::unordered_map<uint32_t, wchar_t*> m_StringCache;
};
#endif // XFA_FDE_CSS_CFDE_CSSSTYLESHEET_H_
diff --git a/chromium/third_party/pdfium/xfa/fde/css/cfde_cssstylesheet_unittest.cpp b/chromium/third_party/pdfium/xfa/fde/css/cfde_cssstylesheet_unittest.cpp
index fa73a7a9ba7..0f450e9c3a2 100644
--- a/chromium/third_party/pdfium/xfa/fde/css/cfde_cssstylesheet_unittest.cpp
+++ b/chromium/third_party/pdfium/xfa/fde/css/cfde_cssstylesheet_unittest.cpp
@@ -27,7 +27,7 @@ class CFDE_CSSStyleSheetTest : public testing::Test {
void TearDown() override { decl_ = nullptr; }
- void LoadAndVerifyDecl(const FX_WCHAR* buf,
+ void LoadAndVerifyDecl(const wchar_t* buf,
const std::vector<CFX_WideString>& selectors,
size_t decl_count) {
ASSERT(sheet_);
@@ -87,7 +87,7 @@ class CFDE_CSSStyleSheetTest : public testing::Test {
};
TEST_F(CFDE_CSSStyleSheetTest, ParseMultipleSelectors) {
- const FX_WCHAR* buf =
+ const wchar_t* buf =
L"a { border: 10px; }\nb { text-decoration: underline; }";
EXPECT_TRUE(sheet_->LoadBuffer(buf, FXSYS_wcslen(buf)));
EXPECT_EQ(2, sheet_->CountRules());
@@ -136,14 +136,14 @@ TEST_F(CFDE_CSSStyleSheetTest, ParseMultipleSelectors) {
}
TEST_F(CFDE_CSSStyleSheetTest, ParseChildSelectors) {
- const FX_WCHAR* buf = L"a b c { border: 10px; }";
+ const wchar_t* buf = L"a b c { border: 10px; }";
EXPECT_TRUE(sheet_->LoadBuffer(buf, FXSYS_wcslen(buf)));
EXPECT_EQ(1, sheet_->CountRules());
CFDE_CSSStyleRule* style = sheet_->GetRule(0);
EXPECT_EQ(1UL, style->CountSelectorLists());
- auto sel = style->GetSelectorList(0);
+ auto* sel = style->GetSelectorList(0);
EXPECT_TRUE(sel != nullptr);
EXPECT_EQ(FX_HashCode_GetW(L"c", true), sel->GetNameHash());
@@ -171,7 +171,7 @@ TEST_F(CFDE_CSSStyleSheetTest, ParseChildSelectors) {
}
TEST_F(CFDE_CSSStyleSheetTest, ParseUnhandledSelectors) {
- const FX_WCHAR* buf = L"a > b { padding: 0; }";
+ const wchar_t* buf = L"a > b { padding: 0; }";
EXPECT_TRUE(sheet_->LoadBuffer(buf, FXSYS_wcslen(buf)));
EXPECT_EQ(0, sheet_->CountRules());
diff --git a/chromium/third_party/pdfium/xfa/fde/css/cfde_csssyntaxparser.cpp b/chromium/third_party/pdfium/xfa/fde/css/cfde_csssyntaxparser.cpp
index 2f7bcce9d7f..9c45422ebb7 100644
--- a/chromium/third_party/pdfium/xfa/fde/css/cfde_csssyntaxparser.cpp
+++ b/chromium/third_party/pdfium/xfa/fde/css/cfde_csssyntaxparser.cpp
@@ -14,7 +14,7 @@
namespace {
-bool IsSelectorStart(FX_WCHAR wch) {
+bool IsSelectorStart(wchar_t wch) {
return wch == '.' || wch == '#' || wch == '*' || (wch >= 'a' && wch <= 'z') ||
(wch >= 'A' && wch <= 'Z');
}
@@ -23,7 +23,7 @@ bool IsSelectorStart(FX_WCHAR wch) {
CFDE_CSSSyntaxParser::CFDE_CSSSyntaxParser()
: m_iTextDataLen(0),
- m_dwCheck((uint32_t)-1),
+ m_dwCheck(0xFFFFFFFF),
m_eMode(FDE_CSSSyntaxMode::RuleSet),
m_eStatus(FDE_CSSSyntaxStatus::None) {}
@@ -32,7 +32,7 @@ CFDE_CSSSyntaxParser::~CFDE_CSSSyntaxParser() {
m_TextPlane.Reset();
}
-bool CFDE_CSSSyntaxParser::Init(const FX_WCHAR* pBuffer,
+bool CFDE_CSSSyntaxParser::Init(const wchar_t* pBuffer,
int32_t iBufferSize,
int32_t iTextDatSize,
bool bOnlyDeclaration) {
@@ -47,7 +47,7 @@ void CFDE_CSSSyntaxParser::Reset(bool bOnlyDeclaration) {
m_TextPlane.Reset();
m_TextData.Reset();
m_iTextDataLen = 0;
- m_dwCheck = (uint32_t)-1;
+ m_dwCheck = 0xFFFFFFFF;
m_eStatus = FDE_CSSSyntaxStatus::None;
m_eMode = bOnlyDeclaration ? FDE_CSSSyntaxMode::PropertyName
: FDE_CSSSyntaxMode::RuleSet;
@@ -65,7 +65,7 @@ FDE_CSSSyntaxStatus CFDE_CSSSyntaxParser::DoSyntaxParse() {
m_eStatus = FDE_CSSSyntaxStatus::EOS;
return m_eStatus;
}
- FX_WCHAR wch;
+ wchar_t wch;
while (!m_TextPlane.IsEOF()) {
wch = m_TextPlane.GetChar();
switch (m_eMode) {
@@ -198,7 +198,7 @@ bool CFDE_CSSSyntaxParser::IsImportEnabled() const {
return true;
}
-bool CFDE_CSSSyntaxParser::AppendChar(FX_WCHAR wch) {
+bool CFDE_CSSSyntaxParser::AppendChar(wchar_t wch) {
m_TextPlane.MoveNext();
if (m_TextData.GetLength() > 0 || wch > ' ') {
m_TextData.AppendChar(wch);
diff --git a/chromium/third_party/pdfium/xfa/fde/css/cfde_csssyntaxparser.h b/chromium/third_party/pdfium/xfa/fde/css/cfde_csssyntaxparser.h
index b583b98b15f..a5e79d50e54 100644
--- a/chromium/third_party/pdfium/xfa/fde/css/cfde_csssyntaxparser.h
+++ b/chromium/third_party/pdfium/xfa/fde/css/cfde_csssyntaxparser.h
@@ -40,7 +40,7 @@ class CFDE_CSSSyntaxParser {
CFDE_CSSSyntaxParser();
~CFDE_CSSSyntaxParser();
- bool Init(const FX_WCHAR* pBuffer,
+ bool Init(const wchar_t* pBuffer,
int32_t iBufferSize,
int32_t iTextDatSize = 32,
bool bOnlyDeclaration = false);
@@ -53,7 +53,7 @@ class CFDE_CSSSyntaxParser {
int32_t SwitchToComment();
bool RestoreMode();
- bool AppendChar(FX_WCHAR wch);
+ bool AppendChar(wchar_t wch);
int32_t SaveTextData();
bool IsCharsetEnabled() const {
return (m_dwCheck & FDE_CSSSYNTAXCHECK_AllowCharset) != 0;
diff --git a/chromium/third_party/pdfium/xfa/fde/css/cfde_csstextbuf.cpp b/chromium/third_party/pdfium/xfa/fde/css/cfde_csstextbuf.cpp
index 83b2899f198..b8d8b197ae2 100644
--- a/chromium/third_party/pdfium/xfa/fde/css/cfde_csstextbuf.cpp
+++ b/chromium/third_party/pdfium/xfa/fde/css/cfde_csstextbuf.cpp
@@ -6,7 +6,7 @@
#include "xfa/fde/css/cfde_csstextbuf.h"
-#include <algorithm>
+#include "third_party/base/stl_util.h"
CFDE_CSSTextBuf::CFDE_CSSTextBuf()
: m_bExtBuf(false),
@@ -27,9 +27,9 @@ void CFDE_CSSTextBuf::Reset() {
m_iDatPos = m_iDatLen = m_iBufLen;
}
-bool CFDE_CSSTextBuf::AttachBuffer(const FX_WCHAR* pBuffer, int32_t iBufLen) {
+bool CFDE_CSSTextBuf::AttachBuffer(const wchar_t* pBuffer, int32_t iBufLen) {
Reset();
- m_pBuffer = const_cast<FX_WCHAR*>(pBuffer);
+ m_pBuffer = const_cast<wchar_t*>(pBuffer);
m_iDatLen = m_iBufLen = iBufLen;
return m_bExtBuf = true;
}
@@ -63,9 +63,9 @@ bool CFDE_CSSTextBuf::ExpandBuf(int32_t iDesiredSize) {
if (m_bExtBuf)
return false;
if (!m_pBuffer)
- m_pBuffer = FX_Alloc(FX_WCHAR, iDesiredSize);
+ m_pBuffer = FX_Alloc(wchar_t, iDesiredSize);
else if (m_iBufLen != iDesiredSize)
- m_pBuffer = FX_Realloc(FX_WCHAR, m_pBuffer, iDesiredSize);
+ m_pBuffer = FX_Realloc(wchar_t, m_pBuffer, iDesiredSize);
else
return true;
@@ -80,7 +80,7 @@ bool CFDE_CSSTextBuf::ExpandBuf(int32_t iDesiredSize) {
void CFDE_CSSTextBuf::Subtract(int32_t iStart, int32_t iLength) {
ASSERT(iStart >= 0 && iLength >= 0);
- iLength = std::max(std::min(iLength, m_iDatLen - iStart), 0);
- FXSYS_memmove(m_pBuffer, m_pBuffer + iStart, iLength * sizeof(FX_WCHAR));
+ iLength = pdfium::clamp(iLength, 0, m_iDatLen - iStart);
+ memmove(m_pBuffer, m_pBuffer + iStart, iLength * sizeof(wchar_t));
m_iDatLen = iLength;
}
diff --git a/chromium/third_party/pdfium/xfa/fde/css/cfde_csstextbuf.h b/chromium/third_party/pdfium/xfa/fde/css/cfde_csstextbuf.h
index df151e02d81..52c76210ce9 100644
--- a/chromium/third_party/pdfium/xfa/fde/css/cfde_csstextbuf.h
+++ b/chromium/third_party/pdfium/xfa/fde/css/cfde_csstextbuf.h
@@ -10,20 +10,20 @@
#include "core/fxcrt/cfx_retain_ptr.h"
#include "core/fxcrt/fx_memory.h"
#include "core/fxcrt/fx_system.h"
-#include "xfa/fgas/crt/fgas_stream.h"
+#include "xfa/fgas/crt/ifgas_stream.h"
class CFDE_CSSTextBuf {
public:
CFDE_CSSTextBuf();
~CFDE_CSSTextBuf();
- bool AttachBuffer(const FX_WCHAR* pBuffer, int32_t iBufLen);
+ bool AttachBuffer(const wchar_t* pBuffer, int32_t iBufLen);
bool EstimateSize(int32_t iAllocSize);
int32_t LoadFromStream(const CFX_RetainPtr<IFGAS_Stream>& pTxtStream,
int32_t iStreamOffset,
int32_t iMaxChars,
bool& bEOS);
- bool AppendChar(FX_WCHAR wch) {
+ bool AppendChar(wchar_t wch) {
if (m_iDatLen >= m_iBufLen && !ExpandBuf(m_iBufLen * 2))
return false;
m_pBuffer[m_iDatLen++] = wch;
@@ -43,21 +43,21 @@ class CFDE_CSSTextBuf {
void Subtract(int32_t iStart, int32_t iLength);
bool IsEOF() const { return m_iDatPos >= m_iDatLen; }
- FX_WCHAR GetAt(int32_t index) const { return m_pBuffer[index]; }
- FX_WCHAR GetChar() const { return m_pBuffer[m_iDatPos]; }
- FX_WCHAR GetNextChar() const {
+ wchar_t GetAt(int32_t index) const { return m_pBuffer[index]; }
+ wchar_t GetChar() const { return m_pBuffer[m_iDatPos]; }
+ wchar_t GetNextChar() const {
return (m_iDatPos + 1 >= m_iDatLen) ? 0 : m_pBuffer[m_iDatPos + 1];
}
void MoveNext() { m_iDatPos++; }
int32_t GetLength() const { return m_iDatLen; }
- const FX_WCHAR* GetBuffer() const { return m_pBuffer; }
+ const wchar_t* GetBuffer() const { return m_pBuffer; }
protected:
bool ExpandBuf(int32_t iDesiredSize);
bool m_bExtBuf;
- FX_WCHAR* m_pBuffer;
+ wchar_t* m_pBuffer;
int32_t m_iBufLen;
int32_t m_iDatLen;
int32_t m_iDatPos;
diff --git a/chromium/third_party/pdfium/xfa/fde/css/cfde_cssvaluelistparser.cpp b/chromium/third_party/pdfium/xfa/fde/css/cfde_cssvaluelistparser.cpp
index 42c32968654..36d5edc3c7c 100644
--- a/chromium/third_party/pdfium/xfa/fde/css/cfde_cssvaluelistparser.cpp
+++ b/chromium/third_party/pdfium/xfa/fde/css/cfde_cssvaluelistparser.cpp
@@ -6,15 +6,15 @@
#include "xfa/fde/css/cfde_cssvaluelistparser.h"
-CFDE_CSSValueListParser::CFDE_CSSValueListParser(const FX_WCHAR* psz,
+CFDE_CSSValueListParser::CFDE_CSSValueListParser(const wchar_t* psz,
int32_t iLen,
- FX_WCHAR separator)
+ wchar_t separator)
: m_Separator(separator), m_pCur(psz), m_pEnd(psz + iLen) {
ASSERT(psz && iLen > 0);
}
bool CFDE_CSSValueListParser::NextValue(FDE_CSSPrimitiveType& eType,
- const FX_WCHAR*& pStart,
+ const wchar_t*& pStart,
int32_t& iLength) {
while (m_pCur < m_pEnd && (*m_pCur <= ' ' || *m_pCur == m_Separator))
++m_pCur;
@@ -25,7 +25,7 @@ bool CFDE_CSSValueListParser::NextValue(FDE_CSSPrimitiveType& eType,
eType = FDE_CSSPrimitiveType::Unknown;
pStart = m_pCur;
iLength = 0;
- FX_WCHAR wch = *m_pCur;
+ wchar_t wch = *m_pCur;
if (wch == '#') {
iLength = SkipTo(' ', false, false);
if (iLength == 4 || iLength == 7)
@@ -56,10 +56,10 @@ bool CFDE_CSSValueListParser::NextValue(FDE_CSSPrimitiveType& eType,
return m_pCur <= m_pEnd && iLength > 0;
}
-int32_t CFDE_CSSValueListParser::SkipTo(FX_WCHAR wch,
+int32_t CFDE_CSSValueListParser::SkipTo(wchar_t wch,
bool breakOnSpace,
bool matchBrackets) {
- const FX_WCHAR* pStart = m_pCur;
+ const wchar_t* pStart = m_pCur;
int32_t bracketCount = 0;
while (m_pCur < m_pEnd && *m_pCur != wch) {
if (breakOnSpace && *m_pCur <= ' ')
diff --git a/chromium/third_party/pdfium/xfa/fde/css/cfde_cssvaluelistparser.h b/chromium/third_party/pdfium/xfa/fde/css/cfde_cssvaluelistparser.h
index 734aed8a520..e41ee5c3137 100644
--- a/chromium/third_party/pdfium/xfa/fde/css/cfde_cssvaluelistparser.h
+++ b/chromium/third_party/pdfium/xfa/fde/css/cfde_cssvaluelistparser.h
@@ -12,21 +12,19 @@
class CFDE_CSSValueListParser {
public:
- CFDE_CSSValueListParser(const FX_WCHAR* psz,
- int32_t iLen,
- FX_WCHAR separator);
+ CFDE_CSSValueListParser(const wchar_t* psz, int32_t iLen, wchar_t separator);
bool NextValue(FDE_CSSPrimitiveType& eType,
- const FX_WCHAR*& pStart,
+ const wchar_t*& pStart,
int32_t& iLength);
- FX_WCHAR m_Separator;
+ wchar_t m_Separator;
private:
- int32_t SkipTo(FX_WCHAR wch, bool breakOnSpace, bool matchBrackets);
+ int32_t SkipTo(wchar_t wch, bool breakOnSpace, bool matchBrackets);
- const FX_WCHAR* m_pCur;
- const FX_WCHAR* m_pEnd;
+ const wchar_t* m_pCur;
+ const wchar_t* m_pEnd;
};
#endif // XFA_FDE_CSS_CFDE_CSSVALUELISTPARSER_H_
diff --git a/chromium/third_party/pdfium/xfa/fde/css/cfde_cssvaluelistparser_unittest.cpp b/chromium/third_party/pdfium/xfa/fde/css/cfde_cssvaluelistparser_unittest.cpp
index 71bb807f3d1..077fb54e93c 100644
--- a/chromium/third_party/pdfium/xfa/fde/css/cfde_cssvaluelistparser_unittest.cpp
+++ b/chromium/third_party/pdfium/xfa/fde/css/cfde_cssvaluelistparser_unittest.cpp
@@ -7,11 +7,14 @@
#include "xfa/fde/css/cfde_cssvaluelistparser.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "testing/test_support.h"
#include "third_party/base/ptr_util.h"
-TEST(CFDE_CSSValueListParser, rgb_short) {
+class CFDE_CSSValueListParserTest : public pdfium::FPDF_Test {};
+
+TEST_F(CFDE_CSSValueListParserTest, rgb_short) {
FDE_CSSPrimitiveType type;
- const FX_WCHAR* start;
+ const wchar_t* start;
int32_t len;
auto parser = pdfium::MakeUnique<CFDE_CSSValueListParser>(L"#abc", 4, L' ');
@@ -40,9 +43,9 @@ TEST(CFDE_CSSValueListParser, rgb_short) {
EXPECT_FALSE(parser->NextValue(type, start, len));
}
-TEST(CFDE_CSSValueListParser, number_parsing) {
+TEST_F(CFDE_CSSValueListParserTest, number_parsing) {
FDE_CSSPrimitiveType type;
- const FX_WCHAR* start;
+ const wchar_t* start;
int32_t len;
auto parser = pdfium::MakeUnique<CFDE_CSSValueListParser>(L"1234", 4, L' ');
@@ -82,9 +85,9 @@ TEST(CFDE_CSSValueListParser, number_parsing) {
EXPECT_EQ(L"43a1.12.34", CFX_WideString(start, len));
}
-TEST(CFDE_CSSValueListParser, string_parsing) {
+TEST_F(CFDE_CSSValueListParserTest, string_parsing) {
FDE_CSSPrimitiveType type;
- const FX_WCHAR* start;
+ const wchar_t* start;
int32_t len;
auto parser =
@@ -105,9 +108,9 @@ TEST(CFDE_CSSValueListParser, string_parsing) {
EXPECT_EQ(L"standalone", CFX_WideString(start, len));
}
-TEST(CFDE_CSSValueListParser, multiparsing) {
+TEST_F(CFDE_CSSValueListParserTest, multiparsing) {
FDE_CSSPrimitiveType type;
- const FX_WCHAR* start;
+ const wchar_t* start;
int32_t len;
auto parser =
diff --git a/chromium/third_party/pdfium/xfa/fde/css/fde_css.h b/chromium/third_party/pdfium/xfa/fde/css/fde_css.h
index 6c2629f5ec3..ae4f36c93db 100644
--- a/chromium/third_party/pdfium/xfa/fde/css/fde_css.h
+++ b/chromium/third_party/pdfium/xfa/fde/css/fde_css.h
@@ -8,8 +8,7 @@
#define XFA_FDE_CSS_FDE_CSS_H_
#include "core/fxge/fx_dib.h"
-#include "xfa/fgas/crt/fgas_stream.h"
-#include "xfa/fgas/crt/fgas_utils.h"
+#include "xfa/fgas/crt/ifgas_stream.h"
#include "xfa/fgas/font/cfgas_fontmgr.h"
enum FDE_CSSVALUETYPE {
@@ -189,7 +188,7 @@ class FDE_CSSLength {
explicit FDE_CSSLength(FDE_CSSLengthUnit eUnit) : m_unit(eUnit) {}
- FDE_CSSLength(FDE_CSSLengthUnit eUnit, FX_FLOAT fValue)
+ FDE_CSSLength(FDE_CSSLengthUnit eUnit, float fValue)
: m_unit(eUnit), m_fValue(fValue) {}
FDE_CSSLength& Set(FDE_CSSLengthUnit eUnit) {
@@ -197,7 +196,7 @@ class FDE_CSSLength {
return *this;
}
- FDE_CSSLength& Set(FDE_CSSLengthUnit eUnit, FX_FLOAT fValue) {
+ FDE_CSSLength& Set(FDE_CSSLengthUnit eUnit, float fValue) {
m_unit = eUnit;
m_fValue = fValue;
return *this;
@@ -205,19 +204,19 @@ class FDE_CSSLength {
FDE_CSSLengthUnit GetUnit() const { return m_unit; }
- FX_FLOAT GetValue() const { return m_fValue; }
+ float GetValue() const { return m_fValue; }
bool NonZero() const { return static_cast<int>(m_fValue) != 0; }
private:
FDE_CSSLengthUnit m_unit;
- FX_FLOAT m_fValue;
+ float m_fValue;
};
class FDE_CSSRect {
public:
FDE_CSSRect() {}
- FDE_CSSRect(FDE_CSSLengthUnit eUnit, FX_FLOAT val)
+ FDE_CSSRect(FDE_CSSLengthUnit eUnit, float val)
: left(eUnit, val),
top(eUnit, val),
right(eUnit, val),
@@ -230,7 +229,7 @@ class FDE_CSSRect {
bottom.Set(eUnit);
return *this;
}
- FDE_CSSRect& Set(FDE_CSSLengthUnit eUnit, FX_FLOAT fValue) {
+ FDE_CSSRect& Set(FDE_CSSLengthUnit eUnit, float fValue) {
left.Set(eUnit, fValue);
top.Set(eUnit, fValue);
right.Set(eUnit, fValue);
diff --git a/chromium/third_party/pdfium/xfa/fde/css/fde_cssdatatable.h b/chromium/third_party/pdfium/xfa/fde/css/fde_cssdatatable.h
index afb0b8502d7..d1745f5d50a 100644
--- a/chromium/third_party/pdfium/xfa/fde/css/fde_cssdatatable.h
+++ b/chromium/third_party/pdfium/xfa/fde/css/fde_cssdatatable.h
@@ -20,14 +20,14 @@
struct FDE_CSSPropertyTable {
FDE_CSSProperty eName;
- const FX_WCHAR* pszName;
+ const wchar_t* pszName;
uint32_t dwHash;
uint32_t dwType;
};
struct FDE_CSSPropertyValueTable {
FDE_CSSPropertyValue eName;
- const FX_WCHAR* pszName;
+ const wchar_t* pszName;
uint32_t dwHash;
};
diff --git a/chromium/third_party/pdfium/xfa/fde/fde_gedevice.cpp b/chromium/third_party/pdfium/xfa/fde/fde_gedevice.cpp
deleted file mode 100644
index db05f762416..00000000000
--- a/chromium/third_party/pdfium/xfa/fde/fde_gedevice.cpp
+++ /dev/null
@@ -1,355 +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
-
-#include "xfa/fde/fde_gedevice.h"
-
-#include <algorithm>
-#include <memory>
-
-#include "core/fxge/cfx_gemodule.h"
-#include "core/fxge/cfx_graphstatedata.h"
-#include "core/fxge/cfx_renderdevice.h"
-#include "core/fxge/cfx_substfont.h"
-#include "xfa/fde/cfde_path.h"
-#include "xfa/fde/fde_object.h"
-#include "xfa/fgas/font/cfgas_fontmgr.h"
-#include "xfa/fgas/font/cfgas_gefont.h"
-
-CFDE_RenderDevice::CFDE_RenderDevice(CFX_RenderDevice* pDevice,
- bool bOwnerDevice)
- : m_pDevice(pDevice), m_bOwnerDevice(bOwnerDevice), m_iCharCount(0) {
- ASSERT(pDevice);
-
- FX_RECT rt = m_pDevice->GetClipBox();
- m_rtClip = CFX_RectF(
- static_cast<FX_FLOAT>(rt.left), static_cast<FX_FLOAT>(rt.top),
- static_cast<FX_FLOAT>(rt.Width()), static_cast<FX_FLOAT>(rt.Height()));
-}
-
-CFDE_RenderDevice::~CFDE_RenderDevice() {
- if (m_bOwnerDevice)
- delete m_pDevice;
-}
-
-int32_t CFDE_RenderDevice::GetWidth() const {
- return m_pDevice->GetWidth();
-}
-
-int32_t CFDE_RenderDevice::GetHeight() const {
- return m_pDevice->GetHeight();
-}
-
-void CFDE_RenderDevice::SaveState() {
- m_pDevice->SaveState();
-}
-
-void CFDE_RenderDevice::RestoreState() {
- m_pDevice->RestoreState(false);
- const FX_RECT& rt = m_pDevice->GetClipBox();
- m_rtClip = CFX_RectF(
- static_cast<FX_FLOAT>(rt.left), static_cast<FX_FLOAT>(rt.top),
- static_cast<FX_FLOAT>(rt.Width()), static_cast<FX_FLOAT>(rt.Height()));
-}
-
-bool CFDE_RenderDevice::SetClipRect(const CFX_RectF& rtClip) {
- m_rtClip = rtClip;
- return m_pDevice->SetClip_Rect(FX_RECT((int32_t)FXSYS_floor(rtClip.left),
- (int32_t)FXSYS_floor(rtClip.top),
- (int32_t)FXSYS_ceil(rtClip.right()),
- (int32_t)FXSYS_ceil(rtClip.bottom())));
-}
-
-const CFX_RectF& CFDE_RenderDevice::GetClipRect() {
- return m_rtClip;
-}
-
-bool CFDE_RenderDevice::SetClipPath(const CFDE_Path* pClip) {
- return false;
-}
-
-CFDE_Path* CFDE_RenderDevice::GetClipPath() const {
- return nullptr;
-}
-
-FX_FLOAT CFDE_RenderDevice::GetDpiX() const {
- return 96;
-}
-
-FX_FLOAT CFDE_RenderDevice::GetDpiY() const {
- return 96;
-}
-
-bool CFDE_RenderDevice::DrawImage(CFX_DIBSource* pDib,
- const CFX_RectF* pSrcRect,
- const CFX_RectF& dstRect,
- const CFX_Matrix* pImgMatrix,
- const CFX_Matrix* pDevMatrix) {
- CFX_RectF srcRect;
- if (pSrcRect) {
- srcRect = *pSrcRect;
- } else {
- srcRect = CFX_RectF(0, 0, static_cast<FX_FLOAT>(pDib->GetWidth()),
- static_cast<FX_FLOAT>(pDib->GetHeight()));
- }
-
- if (srcRect.IsEmpty())
- return false;
-
- CFX_Matrix dib2fxdev;
- if (pImgMatrix) {
- dib2fxdev = *pImgMatrix;
- } else {
- dib2fxdev.SetIdentity();
- }
- dib2fxdev.a = dstRect.width;
- dib2fxdev.d = -dstRect.height;
- dib2fxdev.e = dstRect.left;
- dib2fxdev.f = dstRect.bottom();
- if (pDevMatrix) {
- dib2fxdev.Concat(*pDevMatrix);
- }
- void* handle = nullptr;
- m_pDevice->StartDIBits(pDib, 255, 0, (const CFX_Matrix*)&dib2fxdev, 0,
- handle);
- while (m_pDevice->ContinueDIBits(handle, nullptr)) {
- }
- m_pDevice->CancelDIBits(handle);
- return !!handle;
-}
-
-bool CFDE_RenderDevice::DrawString(CFDE_Brush* pBrush,
- const CFX_RetainPtr<CFGAS_GEFont>& pFont,
- const FXTEXT_CHARPOS* pCharPos,
- int32_t iCount,
- FX_FLOAT fFontSize,
- const CFX_Matrix* pMatrix) {
- ASSERT(pBrush && pFont && pCharPos && iCount > 0);
- CFX_Font* pFxFont = pFont->GetDevFont();
- FX_ARGB argb = pBrush->GetColor();
- if ((pFont->GetFontStyles() & FX_FONTSTYLE_Italic) != 0 &&
- !pFxFont->IsItalic()) {
- FXTEXT_CHARPOS* pCP = (FXTEXT_CHARPOS*)pCharPos;
- FX_FLOAT* pAM;
- for (int32_t i = 0; i < iCount; ++i) {
- static const FX_FLOAT mc = 0.267949f;
- pAM = pCP->m_AdjustMatrix;
- pAM[2] = mc * pAM[0] + pAM[2];
- pAM[3] = mc * pAM[1] + pAM[3];
- pCP++;
- }
- }
- FXTEXT_CHARPOS* pCP = (FXTEXT_CHARPOS*)pCharPos;
- CFX_RetainPtr<CFGAS_GEFont> pCurFont;
- CFX_RetainPtr<CFGAS_GEFont> pSTFont;
- FXTEXT_CHARPOS* pCurCP = nullptr;
- int32_t iCurCount = 0;
-
-#if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
- uint32_t dwFontStyle = pFont->GetFontStyles();
- CFX_Font FxFont;
- CFX_SubstFont* SubstFxFont = new CFX_SubstFont();
- FxFont.SetSubstFont(std::unique_ptr<CFX_SubstFont>(SubstFxFont));
- SubstFxFont->m_Weight = dwFontStyle & FX_FONTSTYLE_Bold ? 700 : 400;
- SubstFxFont->m_ItalicAngle = dwFontStyle & FX_FONTSTYLE_Italic ? -12 : 0;
- SubstFxFont->m_WeightCJK = SubstFxFont->m_Weight;
- SubstFxFont->m_bItalicCJK = !!(dwFontStyle & FX_FONTSTYLE_Italic);
-#endif // _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
-
- for (int32_t i = 0; i < iCount; ++i) {
- pSTFont = pFont->GetSubstFont((int32_t)pCP->m_GlyphIndex);
- pCP->m_GlyphIndex &= 0x00FFFFFF;
- pCP->m_bFontStyle = false;
- if (pCurFont != pSTFont) {
- if (pCurFont) {
- pFxFont = pCurFont->GetDevFont();
-#if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
- FxFont.SetFace(pFxFont->GetFace());
- m_pDevice->DrawNormalText(iCurCount, pCurCP, &FxFont, -fFontSize,
- pMatrix, argb, FXTEXT_CLEARTYPE);
-#else
- m_pDevice->DrawNormalText(iCurCount, pCurCP, pFxFont, -fFontSize,
- pMatrix, argb, FXTEXT_CLEARTYPE);
-#endif // _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
- }
- pCurFont = pSTFont;
- pCurCP = pCP;
- iCurCount = 1;
- } else {
- iCurCount++;
- }
- pCP++;
- }
- if (pCurFont && iCurCount) {
- pFxFont = pCurFont->GetDevFont();
-#if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
- FxFont.SetFace(pFxFont->GetFace());
- bool bRet =
- m_pDevice->DrawNormalText(iCurCount, pCurCP, &FxFont, -fFontSize,
- pMatrix, argb, FXTEXT_CLEARTYPE);
- FxFont.SetFace(nullptr);
- return bRet;
-#else
- return m_pDevice->DrawNormalText(iCurCount, pCurCP, pFxFont, -fFontSize,
- pMatrix, argb, FXTEXT_CLEARTYPE);
-#endif // _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
- }
-
-#if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
- FxFont.SetFace(nullptr);
-#endif // _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
-
- return true;
-}
-
-bool CFDE_RenderDevice::DrawBezier(CFDE_Pen* pPen,
- FX_FLOAT fPenWidth,
- const CFX_PointF& pt1,
- const CFX_PointF& pt2,
- const CFX_PointF& pt3,
- const CFX_PointF& pt4,
- const CFX_Matrix* pMatrix) {
- std::vector<CFX_PointF> points;
- points.push_back(pt1);
- points.push_back(pt2);
- points.push_back(pt3);
- points.push_back(pt4);
- CFDE_Path path;
- path.AddBezier(points);
- return DrawPath(pPen, fPenWidth, &path, pMatrix);
-}
-
-bool CFDE_RenderDevice::DrawCurve(CFDE_Pen* pPen,
- FX_FLOAT fPenWidth,
- const std::vector<CFX_PointF>& points,
- bool bClosed,
- FX_FLOAT fTension,
- const CFX_Matrix* pMatrix) {
- CFDE_Path path;
- path.AddCurve(points, bClosed, fTension);
- return DrawPath(pPen, fPenWidth, &path, pMatrix);
-}
-
-bool CFDE_RenderDevice::DrawEllipse(CFDE_Pen* pPen,
- FX_FLOAT fPenWidth,
- const CFX_RectF& rect,
- const CFX_Matrix* pMatrix) {
- CFDE_Path path;
- path.AddEllipse(rect);
- return DrawPath(pPen, fPenWidth, &path, pMatrix);
-}
-
-bool CFDE_RenderDevice::DrawLines(CFDE_Pen* pPen,
- FX_FLOAT fPenWidth,
- const std::vector<CFX_PointF>& points,
- const CFX_Matrix* pMatrix) {
- CFDE_Path path;
- path.AddLines(points);
- return DrawPath(pPen, fPenWidth, &path, pMatrix);
-}
-
-bool CFDE_RenderDevice::DrawLine(CFDE_Pen* pPen,
- FX_FLOAT fPenWidth,
- const CFX_PointF& pt1,
- const CFX_PointF& pt2,
- const CFX_Matrix* pMatrix) {
- CFDE_Path path;
- path.AddLine(pt1, pt2);
- return DrawPath(pPen, fPenWidth, &path, pMatrix);
-}
-
-bool CFDE_RenderDevice::DrawPath(CFDE_Pen* pPen,
- FX_FLOAT fPenWidth,
- const CFDE_Path* pPath,
- const CFX_Matrix* pMatrix) {
- CFDE_Path* pGePath = (CFDE_Path*)pPath;
- if (!pGePath)
- return false;
-
- CFX_GraphStateData graphState;
- if (!CreatePen(pPen, fPenWidth, graphState)) {
- return false;
- }
- return m_pDevice->DrawPath(&pGePath->m_Path, (const CFX_Matrix*)pMatrix,
- &graphState, 0, pPen->GetColor(), 0);
-}
-
-bool CFDE_RenderDevice::DrawPolygon(CFDE_Pen* pPen,
- FX_FLOAT fPenWidth,
- const std::vector<CFX_PointF>& points,
- const CFX_Matrix* pMatrix) {
- CFDE_Path path;
- path.AddPolygon(points);
- return DrawPath(pPen, fPenWidth, &path, pMatrix);
-}
-
-bool CFDE_RenderDevice::DrawRectangle(CFDE_Pen* pPen,
- FX_FLOAT fPenWidth,
- const CFX_RectF& rect,
- const CFX_Matrix* pMatrix) {
- CFDE_Path path;
- path.AddRectangle(rect);
- return DrawPath(pPen, fPenWidth, &path, pMatrix);
-}
-
-bool CFDE_RenderDevice::FillClosedCurve(CFDE_Brush* pBrush,
- const std::vector<CFX_PointF>& points,
- FX_FLOAT fTension,
- const CFX_Matrix* pMatrix) {
- CFDE_Path path;
- path.AddCurve(points, true, fTension);
- return FillPath(pBrush, &path, pMatrix);
-}
-
-bool CFDE_RenderDevice::FillEllipse(CFDE_Brush* pBrush,
- const CFX_RectF& rect,
- const CFX_Matrix* pMatrix) {
- CFDE_Path path;
- path.AddEllipse(rect);
- return FillPath(pBrush, &path, pMatrix);
-}
-
-bool CFDE_RenderDevice::FillPolygon(CFDE_Brush* pBrush,
- const std::vector<CFX_PointF>& points,
- const CFX_Matrix* pMatrix) {
- CFDE_Path path;
- path.AddPolygon(points);
- return FillPath(pBrush, &path, pMatrix);
-}
-
-bool CFDE_RenderDevice::FillRectangle(CFDE_Brush* pBrush,
- const CFX_RectF& rect,
- const CFX_Matrix* pMatrix) {
- CFDE_Path path;
- path.AddRectangle(rect);
- return FillPath(pBrush, &path, pMatrix);
-}
-
-bool CFDE_RenderDevice::CreatePen(CFDE_Pen* pPen,
- FX_FLOAT fPenWidth,
- CFX_GraphStateData& graphState) {
- if (!pPen)
- return false;
-
- graphState.m_LineCap = CFX_GraphStateData::LineCapButt;
- graphState.m_LineJoin = CFX_GraphStateData::LineJoinMiter;
- graphState.m_LineWidth = fPenWidth;
- graphState.m_MiterLimit = 10;
- graphState.m_DashPhase = 0;
- return true;
-}
-
-bool CFDE_RenderDevice::FillPath(CFDE_Brush* pBrush,
- const CFDE_Path* pPath,
- const CFX_Matrix* pMatrix) {
- CFDE_Path* pGePath = (CFDE_Path*)pPath;
- if (!pGePath)
- return false;
- if (!pBrush)
- return false;
- return m_pDevice->DrawPath(&pGePath->m_Path, pMatrix, nullptr,
- pBrush->GetColor(), 0, FXFILL_WINDING);
-}
-
diff --git a/chromium/third_party/pdfium/xfa/fde/fde_gedevice.h b/chromium/third_party/pdfium/xfa/fde/fde_gedevice.h
deleted file mode 100644
index 7c772cfd038..00000000000
--- a/chromium/third_party/pdfium/xfa/fde/fde_gedevice.h
+++ /dev/null
@@ -1,127 +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 XFA_FDE_FDE_GEDEVICE_H_
-#define XFA_FDE_FDE_GEDEVICE_H_
-
-#include <vector>
-
-#include "core/fxge/cfx_renderdevice.h"
-#include "xfa/fgas/font/cfgas_gefont.h"
-
-class CFDE_Brush;
-class CFDE_Path;
-class CFDE_Pen;
-class CFX_GraphStateData;
-
-class CFDE_RenderDevice {
- public:
- CFDE_RenderDevice(CFX_RenderDevice* pDevice, bool bOwnerDevice);
- ~CFDE_RenderDevice();
-
- int32_t GetWidth() const;
- int32_t GetHeight() const;
- void SaveState();
- void RestoreState();
- bool SetClipPath(const CFDE_Path* pClip);
- CFDE_Path* GetClipPath() const;
- bool SetClipRect(const CFX_RectF& rtClip);
- const CFX_RectF& GetClipRect();
-
- FX_FLOAT GetDpiX() const;
- FX_FLOAT GetDpiY() const;
-
- bool DrawImage(CFX_DIBSource* pDib,
- const CFX_RectF* pSrcRect,
- const CFX_RectF& dstRect,
- const CFX_Matrix* pImgMatrix = nullptr,
- const CFX_Matrix* pDevMatrix = nullptr);
- bool DrawString(CFDE_Brush* pBrush,
- const CFX_RetainPtr<CFGAS_GEFont>& pFont,
- const FXTEXT_CHARPOS* pCharPos,
- int32_t iCount,
- FX_FLOAT fFontSize,
- const CFX_Matrix* pMatrix = nullptr);
- bool DrawBezier(CFDE_Pen* pPen,
- FX_FLOAT fPenWidth,
- const CFX_PointF& pt1,
- const CFX_PointF& pt2,
- const CFX_PointF& pt3,
- const CFX_PointF& pt4,
- const CFX_Matrix* pMatrix = nullptr);
- bool DrawCurve(CFDE_Pen* pPen,
- FX_FLOAT fPenWidth,
- const std::vector<CFX_PointF>& points,
- bool bClosed,
- FX_FLOAT fTension = 0.5f,
- const CFX_Matrix* pMatrix = nullptr);
- bool DrawEllipse(CFDE_Pen* pPen,
- FX_FLOAT fPenWidth,
- const CFX_RectF& rect,
- const CFX_Matrix* pMatrix = nullptr);
- bool DrawLines(CFDE_Pen* pPen,
- FX_FLOAT fPenWidth,
- const std::vector<CFX_PointF>& points,
- const CFX_Matrix* pMatrix = nullptr);
- bool DrawLine(CFDE_Pen* pPen,
- FX_FLOAT fPenWidth,
- const CFX_PointF& pt1,
- const CFX_PointF& pt2,
- const CFX_Matrix* pMatrix = nullptr);
- bool DrawPath(CFDE_Pen* pPen,
- FX_FLOAT fPenWidth,
- const CFDE_Path* pPath,
- const CFX_Matrix* pMatrix = nullptr);
- bool DrawPolygon(CFDE_Pen* pPen,
- FX_FLOAT fPenWidth,
- const std::vector<CFX_PointF>& points,
- const CFX_Matrix* pMatrix = nullptr);
- bool DrawRectangle(CFDE_Pen* pPen,
- FX_FLOAT fPenWidth,
- const CFX_RectF& rect,
- const CFX_Matrix* pMatrix = nullptr);
- bool FillClosedCurve(CFDE_Brush* pBrush,
- const std::vector<CFX_PointF>& points,
- FX_FLOAT fTension = 0.5f,
- const CFX_Matrix* pMatrix = nullptr);
- bool FillEllipse(CFDE_Brush* pBrush,
- const CFX_RectF& rect,
- const CFX_Matrix* pMatrix = nullptr);
- bool FillPath(CFDE_Brush* pBrush,
- const CFDE_Path* pPath,
- const CFX_Matrix* pMatrix = nullptr);
- bool FillPolygon(CFDE_Brush* pBrush,
- const std::vector<CFX_PointF>& points,
- const CFX_Matrix* pMatrix = nullptr);
- bool FillRectangle(CFDE_Brush* pBrush,
- const CFX_RectF& rect,
- const CFX_Matrix* pMatrix = nullptr);
-
- bool DrawSolidString(CFDE_Brush* pBrush,
- const CFX_RetainPtr<CFGAS_GEFont>& pFont,
- const FXTEXT_CHARPOS* pCharPos,
- int32_t iCount,
- FX_FLOAT fFontSize,
- const CFX_Matrix* pMatrix);
- bool DrawStringPath(CFDE_Brush* pBrush,
- const CFX_RetainPtr<CFGAS_GEFont>& pFont,
- const FXTEXT_CHARPOS* pCharPos,
- int32_t iCount,
- FX_FLOAT fFontSize,
- const CFX_Matrix* pMatrix);
-
- protected:
- bool CreatePen(CFDE_Pen* pPen,
- FX_FLOAT fPenWidth,
- CFX_GraphStateData& graphState);
-
- CFX_RenderDevice* const m_pDevice;
- CFX_RectF m_rtClip;
- bool m_bOwnerDevice;
- int32_t m_iCharCount;
-};
-
-#endif // XFA_FDE_FDE_GEDEVICE_H_
diff --git a/chromium/third_party/pdfium/xfa/fde/fde_iterator.cpp b/chromium/third_party/pdfium/xfa/fde/fde_iterator.cpp
deleted file mode 100644
index 9ca02da6a0b..00000000000
--- a/chromium/third_party/pdfium/xfa/fde/fde_iterator.cpp
+++ /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
-
-#include "xfa/fde/fde_iterator.h"
-
-#include "xfa/fgas/crt/fgas_utils.h"
-
-CFDE_VisualSetIterator::CFDE_VisualSetIterator()
- : m_dwFilter(0), m_CanvasStack(100) {}
-
-CFDE_VisualSetIterator::~CFDE_VisualSetIterator() {
- m_CanvasStack.RemoveAll(false);
-}
-
-bool CFDE_VisualSetIterator::AttachCanvas(IFDE_CanvasSet* pCanvas) {
- ASSERT(pCanvas);
-
- m_CanvasStack.RemoveAll(false);
- FDE_CANVASITEM canvas;
- canvas.hCanvas = nullptr;
- canvas.pCanvas = pCanvas;
- canvas.hPos = pCanvas->GetFirstPosition();
- if (!canvas.hPos)
- return false;
-
- return m_CanvasStack.Push(canvas) == 0;
-}
-
-bool CFDE_VisualSetIterator::FilterObjects(uint32_t dwObjects) {
- if (m_CanvasStack.GetSize() == 0)
- return false;
-
- while (m_CanvasStack.GetSize() > 1)
- m_CanvasStack.Pop();
-
- m_dwFilter = dwObjects;
-
- FDE_CANVASITEM* pCanvas = m_CanvasStack.GetTopElement();
- ASSERT(pCanvas && pCanvas->pCanvas);
-
- pCanvas->hPos = pCanvas->pCanvas->GetFirstPosition();
- return !!pCanvas->hPos;
-}
-
-void CFDE_VisualSetIterator::Reset() {
- FilterObjects(m_dwFilter);
-}
-
-FDE_TEXTEDITPIECE* CFDE_VisualSetIterator::GetNext(
- IFDE_VisualSet*& pVisualSet,
- FDE_TEXTEDITPIECE** phCanvasObj,
- IFDE_CanvasSet** ppCanvasSet) {
- while (m_CanvasStack.GetSize() > 0) {
- FDE_CANVASITEM* pCanvas = m_CanvasStack.GetTopElement();
- ASSERT(pCanvas && pCanvas->pCanvas);
-
- if (!pCanvas->hPos) {
- if (m_CanvasStack.GetSize() == 1)
- break;
-
- m_CanvasStack.Pop();
- continue;
- }
- do {
- FDE_TEXTEDITPIECE* pObj =
- pCanvas->pCanvas->GetNext(pCanvas->hPos, pVisualSet);
- ASSERT(pObj);
-
- FDE_VISUALOBJTYPE eType = pVisualSet->GetType();
- if (eType == FDE_VISUALOBJ_Canvas) {
- FDE_CANVASITEM canvas;
- canvas.hCanvas = pObj;
- canvas.pCanvas = static_cast<IFDE_CanvasSet*>(pVisualSet);
- canvas.hPos = canvas.pCanvas->GetFirstPosition();
- m_CanvasStack.Push(canvas);
- break;
- }
- uint32_t dwObj = (uint32_t)eType;
- if ((m_dwFilter & dwObj) != 0) {
- if (ppCanvasSet)
- *ppCanvasSet = pCanvas->pCanvas;
- if (phCanvasObj)
- *phCanvasObj = pCanvas->hCanvas;
- return pObj;
- }
- } while (pCanvas->hPos);
- }
- if (ppCanvasSet)
- *ppCanvasSet = nullptr;
- if (phCanvasObj)
- *phCanvasObj = nullptr;
-
- pVisualSet = nullptr;
- return nullptr;
-}
diff --git a/chromium/third_party/pdfium/xfa/fde/fde_iterator.h b/chromium/third_party/pdfium/xfa/fde/fde_iterator.h
deleted file mode 100644
index 45659ce87cf..00000000000
--- a/chromium/third_party/pdfium/xfa/fde/fde_iterator.h
+++ /dev/null
@@ -1,37 +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 XFA_FDE_FDE_ITERATOR_H_
-#define XFA_FDE_FDE_ITERATOR_H_
-
-#include "xfa/fde/fde_visualset.h"
-#include "xfa/fgas/crt/fgas_utils.h"
-
-struct FDE_CANVASITEM {
- IFDE_CanvasSet* pCanvas;
- FDE_TEXTEDITPIECE* hCanvas;
- FX_POSITION hPos;
-};
-
-class CFDE_VisualSetIterator {
- public:
- CFDE_VisualSetIterator();
- ~CFDE_VisualSetIterator();
-
- bool AttachCanvas(IFDE_CanvasSet* pCanvas);
- bool FilterObjects(uint32_t dwObjects = 0xFFFFFFFF);
-
- void Reset();
- FDE_TEXTEDITPIECE* GetNext(IFDE_VisualSet*& pVisualSet,
- FDE_TEXTEDITPIECE** phCanvasObj = nullptr,
- IFDE_CanvasSet** ppCanvasSet = nullptr);
-
- protected:
- uint32_t m_dwFilter;
- CFX_StackTemplate<FDE_CANVASITEM> m_CanvasStack;
-};
-
-#endif // XFA_FDE_FDE_ITERATOR_H_
diff --git a/chromium/third_party/pdfium/xfa/fde/fde_object.h b/chromium/third_party/pdfium/xfa/fde/fde_object.h
deleted file mode 100644
index 5c66b202b66..00000000000
--- a/chromium/third_party/pdfium/xfa/fde/fde_object.h
+++ /dev/null
@@ -1,37 +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 XFA_FDE_FDE_OBJECT_H_
-#define XFA_FDE_FDE_OBJECT_H_
-
-#include <cstdint>
-
-#include "core/fxge/fx_dib.h"
-
-class CFDE_Brush {
- public:
- CFDE_Brush() : m_Color(0xFF000000) {}
-
- FX_ARGB GetColor() const { return m_Color; }
- void SetColor(FX_ARGB color) { m_Color = color; }
-
- private:
- FX_ARGB m_Color;
-};
-
-class CFDE_Pen {
- public:
- CFDE_Pen() : m_Color(0) {}
- ~CFDE_Pen() {}
-
- FX_ARGB GetColor() const { return m_Color; }
- void SetColor(FX_ARGB color) { m_Color = color; }
-
- private:
- FX_ARGB m_Color;
-};
-
-#endif // XFA_FDE_FDE_OBJECT_H_
diff --git a/chromium/third_party/pdfium/xfa/fde/fde_render.cpp b/chromium/third_party/pdfium/xfa/fde/fde_render.cpp
deleted file mode 100644
index b6a8f7edd0e..00000000000
--- a/chromium/third_party/pdfium/xfa/fde/fde_render.cpp
+++ /dev/null
@@ -1,128 +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
-
-#include "xfa/fde/fde_render.h"
-
-#include "third_party/base/ptr_util.h"
-#include "xfa/fde/fde_gedevice.h"
-#include "xfa/fde/fde_object.h"
-
-#define FDE_PATHRENDER_Stroke 1
-#define FDE_PATHRENDER_Fill 2
-
-CFDE_RenderContext::CFDE_RenderContext()
- : m_eStatus(FDE_RENDERSTATUS_Reset),
- m_pRenderDevice(nullptr),
- m_Transform() {
- m_Transform.SetIdentity();
-}
-
-CFDE_RenderContext::~CFDE_RenderContext() {
- StopRender();
-}
-
-bool CFDE_RenderContext::StartRender(CFDE_RenderDevice* pRenderDevice,
- IFDE_CanvasSet* pCanvasSet,
- const CFX_Matrix& tmDoc2Device) {
- if (m_pRenderDevice)
- return false;
- if (!pRenderDevice)
- return false;
- if (!pCanvasSet)
- return false;
-
- m_eStatus = FDE_RENDERSTATUS_Paused;
- m_pRenderDevice = pRenderDevice;
- m_Transform = tmDoc2Device;
- if (!m_pIterator)
- m_pIterator = pdfium::MakeUnique<CFDE_VisualSetIterator>();
-
- return m_pIterator->AttachCanvas(pCanvasSet) && m_pIterator->FilterObjects();
-}
-
-FDE_RENDERSTATUS CFDE_RenderContext::DoRender(IFX_Pause* pPause) {
- if (!m_pRenderDevice)
- return FDE_RENDERSTATUS_Failed;
- if (!m_pIterator)
- return FDE_RENDERSTATUS_Failed;
-
- FDE_RENDERSTATUS eStatus = FDE_RENDERSTATUS_Paused;
- CFX_Matrix rm;
- rm.SetReverse(m_Transform);
- CFX_RectF rtDocClip = m_pRenderDevice->GetClipRect();
- if (rtDocClip.IsEmpty()) {
- rtDocClip.left = rtDocClip.top = 0;
- rtDocClip.width = (FX_FLOAT)m_pRenderDevice->GetWidth();
- rtDocClip.height = (FX_FLOAT)m_pRenderDevice->GetHeight();
- }
- rm.TransformRect(rtDocClip);
- IFDE_VisualSet* pVisualSet;
- FDE_TEXTEDITPIECE* pPiece;
- int32_t iCount = 0;
- while (true) {
- pPiece = m_pIterator->GetNext(pVisualSet);
- if (!pPiece || !pVisualSet) {
- eStatus = FDE_RENDERSTATUS_Done;
- break;
- }
- if (!rtDocClip.IntersectWith(pVisualSet->GetRect(*pPiece)))
- continue;
-
- switch (pVisualSet->GetType()) {
- case FDE_VISUALOBJ_Text:
- RenderText(static_cast<IFDE_TextSet*>(pVisualSet), pPiece);
- iCount += 5;
- break;
- case FDE_VISUALOBJ_Canvas:
- ASSERT(false);
- break;
- default:
- break;
- }
- if (iCount >= 100 && pPause && pPause->NeedToPauseNow()) {
- eStatus = FDE_RENDERSTATUS_Paused;
- break;
- }
- }
- return m_eStatus = eStatus;
-}
-
-void CFDE_RenderContext::StopRender() {
- m_eStatus = FDE_RENDERSTATUS_Reset;
- m_pRenderDevice = nullptr;
- m_Transform.SetIdentity();
- m_pIterator.reset();
- m_pBrush.reset();
- m_CharPos.clear();
-}
-
-void CFDE_RenderContext::RenderText(IFDE_TextSet* pTextSet,
- FDE_TEXTEDITPIECE* pText) {
- ASSERT(m_pRenderDevice);
- ASSERT(pTextSet && pText);
-
- CFX_RetainPtr<CFGAS_GEFont> pFont = pTextSet->GetFont();
- if (!pFont)
- return;
-
- int32_t iCount = pTextSet->GetDisplayPos(*pText, nullptr, false);
- if (iCount < 1)
- return;
-
- if (!m_pBrush)
- m_pBrush = pdfium::MakeUnique<CFDE_Brush>();
-
- if (m_CharPos.size() < static_cast<size_t>(iCount))
- m_CharPos.resize(iCount, FXTEXT_CHARPOS());
-
- iCount = pTextSet->GetDisplayPos(*pText, m_CharPos.data(), false);
- FX_FLOAT fFontSize = pTextSet->GetFontSize();
- FX_ARGB dwColor = pTextSet->GetFontColor();
- m_pBrush->SetColor(dwColor);
- m_pRenderDevice->DrawString(m_pBrush.get(), pFont, m_CharPos.data(), iCount,
- fFontSize, &m_Transform);
-}
-
diff --git a/chromium/third_party/pdfium/xfa/fde/fde_render.h b/chromium/third_party/pdfium/xfa/fde/fde_render.h
deleted file mode 100644
index a24d6b54964..00000000000
--- a/chromium/third_party/pdfium/xfa/fde/fde_render.h
+++ /dev/null
@@ -1,49 +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 XFA_FDE_FDE_RENDER_H_
-#define XFA_FDE_FDE_RENDER_H_
-
-#include <memory>
-#include <vector>
-
-#include "core/fxcrt/fx_coordinates.h"
-#include "xfa/fde/fde_gedevice.h"
-#include "xfa/fde/fde_iterator.h"
-#include "xfa/fde/fde_visualset.h"
-
-class CFDE_RenderDevice;
-
-enum FDE_RENDERSTATUS {
- FDE_RENDERSTATUS_Reset = 0,
- FDE_RENDERSTATUS_Paused,
- FDE_RENDERSTATUS_Done,
- FDE_RENDERSTATUS_Failed,
-};
-
-class CFDE_RenderContext {
- public:
- CFDE_RenderContext();
- ~CFDE_RenderContext();
-
- bool StartRender(CFDE_RenderDevice* pRenderDevice,
- IFDE_CanvasSet* pCanvasSet,
- const CFX_Matrix& tmDoc2Device);
- FDE_RENDERSTATUS GetStatus() const { return m_eStatus; }
- FDE_RENDERSTATUS DoRender(IFX_Pause* pPause = nullptr);
- void StopRender();
- void RenderText(IFDE_TextSet* pTextSet, FDE_TEXTEDITPIECE* pText);
-
- protected:
- FDE_RENDERSTATUS m_eStatus;
- CFDE_RenderDevice* m_pRenderDevice;
- CFX_Matrix m_Transform;
- std::vector<FXTEXT_CHARPOS> m_CharPos;
- std::unique_ptr<CFDE_Brush> m_pBrush;
- std::unique_ptr<CFDE_VisualSetIterator> m_pIterator;
-};
-
-#endif // XFA_FDE_FDE_RENDER_H_
diff --git a/chromium/third_party/pdfium/xfa/fde/fde_visualset.h b/chromium/third_party/pdfium/xfa/fde/fde_visualset.h
deleted file mode 100644
index 5cf02cde9ca..00000000000
--- a/chromium/third_party/pdfium/xfa/fde/fde_visualset.h
+++ /dev/null
@@ -1,72 +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 XFA_FDE_FDE_VISUALSET_H_
-#define XFA_FDE_FDE_VISUALSET_H_
-
-#include <vector>
-
-#include "core/fxcrt/cfx_retain_ptr.h"
-#include "core/fxcrt/fx_coordinates.h"
-#include "core/fxcrt/fx_system.h"
-#include "core/fxge/fx_dib.h"
-#include "xfa/fde/cfde_path.h"
-#include "xfa/fde/fde_object.h"
-#include "xfa/fgas/font/cfgas_fontmgr.h"
-
-class FXTEXT_CHARPOS;
-
-enum FDE_VISUALOBJTYPE {
- FDE_VISUALOBJ_Canvas = 0x00,
- FDE_VISUALOBJ_Text = 0x01
-};
-
-struct FDE_TEXTEDITPIECE {
- FDE_TEXTEDITPIECE();
- FDE_TEXTEDITPIECE(const FDE_TEXTEDITPIECE& that);
- ~FDE_TEXTEDITPIECE();
-
- int32_t nStart;
- int32_t nCount;
- int32_t nBidiLevel;
- CFX_RectF rtPiece;
- uint32_t dwCharStyles;
-};
-inline FDE_TEXTEDITPIECE::FDE_TEXTEDITPIECE() = default;
-inline FDE_TEXTEDITPIECE::FDE_TEXTEDITPIECE(const FDE_TEXTEDITPIECE& that) =
- default;
-inline FDE_TEXTEDITPIECE::~FDE_TEXTEDITPIECE() = default;
-
-class IFDE_VisualSet {
- public:
- virtual ~IFDE_VisualSet() {}
- virtual FDE_VISUALOBJTYPE GetType() = 0;
- virtual CFX_RectF GetRect(const FDE_TEXTEDITPIECE& hVisualObj) = 0;
-};
-
-class IFDE_CanvasSet : public IFDE_VisualSet {
- public:
- virtual FX_POSITION GetFirstPosition() = 0;
- virtual FDE_TEXTEDITPIECE* GetNext(FX_POSITION& pos,
- IFDE_VisualSet*& pVisualSet) = 0;
-};
-
-class IFDE_TextSet : public IFDE_VisualSet {
- public:
- virtual int32_t GetString(FDE_TEXTEDITPIECE* hText,
- CFX_WideString& wsText) = 0;
- virtual CFX_RetainPtr<CFGAS_GEFont> GetFont() = 0;
- virtual FX_FLOAT GetFontSize() = 0;
- virtual FX_ARGB GetFontColor() = 0;
- virtual int32_t GetDisplayPos(const FDE_TEXTEDITPIECE& hText,
- FXTEXT_CHARPOS* pCharPos,
- bool bCharCode = false,
- CFX_WideString* pWSForms = nullptr) = 0;
- virtual std::vector<CFX_RectF> GetCharRects(const FDE_TEXTEDITPIECE* hText,
- bool bbox) = 0;
-};
-
-#endif // XFA_FDE_FDE_VISUALSET_H_
diff --git a/chromium/third_party/pdfium/xfa/fde/ifde_txtedtengine.h b/chromium/third_party/pdfium/xfa/fde/ifde_txtedtengine.h
index 6940a8c7d68..7fef6f0315d 100644
--- a/chromium/third_party/pdfium/xfa/fde/ifde_txtedtengine.h
+++ b/chromium/third_party/pdfium/xfa/fde/ifde_txtedtengine.h
@@ -11,7 +11,6 @@
#include "xfa/fgas/font/cfgas_fontmgr.h"
class CFDE_TxtEdtEngine;
-class IFDE_TxtEdtPage;
class CFWL_Edit;
#define FDE_TEXTEDITMODE_MultiLines (1L << 0)
@@ -74,24 +73,22 @@ struct FDE_TXTEDTPARAMS {
FDE_TXTEDTPARAMS();
~FDE_TXTEDTPARAMS();
- FX_FLOAT fPlateWidth;
- FX_FLOAT fPlateHeight;
+ float fPlateWidth;
+ float fPlateHeight;
int32_t nLineCount;
uint32_t dwLayoutStyles;
uint32_t dwAlignment;
uint32_t dwMode;
CFX_RetainPtr<CFGAS_GEFont> pFont;
- FX_FLOAT fFontSize;
+ float fFontSize;
FX_ARGB dwFontColor;
- FX_FLOAT fLineSpace;
- FX_FLOAT fTabWidth;
- bool bTabEquidistant;
- FX_WCHAR wDefChar;
- FX_WCHAR wLineBreakChar;
- int32_t nCharRotation;
+ float fLineSpace;
+ float fTabWidth;
+ wchar_t wDefChar;
+ wchar_t wLineBreakChar;
int32_t nLineEnd;
int32_t nHorzScale;
- FX_FLOAT fCharSpace;
+ float fCharSpace;
CFWL_Edit* pEventSink;
};
diff --git a/chromium/third_party/pdfium/xfa/fde/ifde_txtedtpage.h b/chromium/third_party/pdfium/xfa/fde/ifde_txtedtpage.h
deleted file mode 100644
index 0ab3897b3cf..00000000000
--- a/chromium/third_party/pdfium/xfa/fde/ifde_txtedtpage.h
+++ /dev/null
@@ -1,43 +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 XFA_FDE_IFDE_TXTEDTPAGE_H_
-#define XFA_FDE_IFDE_TXTEDTPAGE_H_
-
-#include <vector>
-
-#include "xfa/fde/fde_visualset.h"
-#include "xfa/fgas/layout/fgas_textbreak.h"
-
-class CFDE_TxtEdtEngine;
-
-class IFDE_TxtEdtPage : public IFDE_CanvasSet, public IFX_TxtAccess {
- public:
- static IFDE_TxtEdtPage* Create(CFDE_TxtEdtEngine* pEngine, int32_t nIndex);
- ~IFDE_TxtEdtPage() override {}
-
- virtual CFDE_TxtEdtEngine* GetEngine() const = 0;
- virtual int32_t GetCharRect(int32_t nIndex,
- CFX_RectF& rect,
- bool bBBox = false) const = 0;
- virtual int32_t GetCharIndex(const CFX_PointF& fPoint, bool& bBefore) = 0;
- virtual void CalcRangeRectArray(int32_t nStart,
- int32_t nCount,
- std::vector<CFX_RectF>* RectFArr) const = 0;
- virtual int32_t SelectWord(const CFX_PointF& fPoint, int32_t& nCount) = 0;
- virtual int32_t GetCharStart() const = 0;
- virtual int32_t GetCharCount() const = 0;
-
- virtual int32_t GetDisplayPos(const CFX_RectF& rtClip,
- FXTEXT_CHARPOS*& pCharPos,
- CFX_RectF* pBBox) const = 0;
- virtual bool IsLoaded(const CFX_RectF* pClipBox) = 0;
- virtual int32_t LoadPage(const CFX_RectF* pClipBox, IFX_Pause* pPause) = 0;
- virtual void UnloadPage(const CFX_RectF* pClipBox) = 0;
- virtual const CFX_RectF& GetContentsBox() = 0;
-};
-
-#endif // XFA_FDE_IFDE_TXTEDTPAGE_H_
diff --git a/chromium/third_party/pdfium/xfa/fde/ifde_visualset.h b/chromium/third_party/pdfium/xfa/fde/ifde_visualset.h
new file mode 100644
index 00000000000..144475f0472
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fde/ifde_visualset.h
@@ -0,0 +1,49 @@
+// 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 XFA_FDE_IFDE_VISUALSET_H_
+#define XFA_FDE_IFDE_VISUALSET_H_
+
+#include <vector>
+
+#include "core/fxcrt/cfx_retain_ptr.h"
+#include "core/fxcrt/fx_coordinates.h"
+#include "core/fxcrt/fx_system.h"
+#include "core/fxge/fx_dib.h"
+#include "xfa/fde/cfde_path.h"
+#include "xfa/fgas/font/cfgas_fontmgr.h"
+
+class FXTEXT_CHARPOS;
+
+enum FDE_VISUALOBJTYPE {
+ FDE_VISUALOBJ_Canvas = 0x00,
+ FDE_VISUALOBJ_Text = 0x01
+};
+
+struct FDE_TEXTEDITPIECE {
+ FDE_TEXTEDITPIECE();
+ FDE_TEXTEDITPIECE(const FDE_TEXTEDITPIECE& that);
+ ~FDE_TEXTEDITPIECE();
+
+ int32_t nStart;
+ int32_t nCount;
+ int32_t nBidiLevel;
+ CFX_RectF rtPiece;
+ uint32_t dwCharStyles;
+};
+inline FDE_TEXTEDITPIECE::FDE_TEXTEDITPIECE() = default;
+inline FDE_TEXTEDITPIECE::FDE_TEXTEDITPIECE(const FDE_TEXTEDITPIECE& that) =
+ default;
+inline FDE_TEXTEDITPIECE::~FDE_TEXTEDITPIECE() = default;
+
+class IFDE_VisualSet {
+ public:
+ virtual ~IFDE_VisualSet() {}
+ virtual FDE_VISUALOBJTYPE GetType() = 0;
+ virtual CFX_RectF GetRect(const FDE_TEXTEDITPIECE& hVisualObj) = 0;
+};
+
+#endif // XFA_FDE_IFDE_VISUALSET_H_
diff --git a/chromium/third_party/pdfium/xfa/fde/ifx_chariter.h b/chromium/third_party/pdfium/xfa/fde/ifx_chariter.h
deleted file mode 100644
index c967efd4d60..00000000000
--- a/chromium/third_party/pdfium/xfa/fde/ifx_chariter.h
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright 2016 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef XFA_FDE_IFX_CHARITER_H_
-#define XFA_FDE_IFX_CHARITER_H_
-
-#include "core/fxcrt/fx_system.h"
-
-class IFX_CharIter {
- public:
- virtual ~IFX_CharIter() {}
-
- virtual bool Next(bool bPrev = false) = 0;
- virtual FX_WCHAR GetChar() = 0;
- virtual void SetAt(int32_t nIndex) = 0;
- virtual int32_t GetAt() const = 0;
- virtual bool IsEOF(bool bTail = true) const = 0;
- virtual IFX_CharIter* Clone() = 0;
-};
-
-#endif // XFA_FDE_IFX_CHARITER_H_
diff --git a/chromium/third_party/pdfium/xfa/fde/tto/fde_textout.cpp b/chromium/third_party/pdfium/xfa/fde/tto/fde_textout.cpp
deleted file mode 100644
index 421876b48d4..00000000000
--- a/chromium/third_party/pdfium/xfa/fde/tto/fde_textout.cpp
+++ /dev/null
@@ -1,876 +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
-
-#include "xfa/fde/tto/fde_textout.h"
-
-#include <algorithm>
-
-#include "core/fxcrt/fx_coordinates.h"
-#include "core/fxcrt/fx_system.h"
-#include "third_party/base/ptr_util.h"
-#include "third_party/base/stl_util.h"
-#include "xfa/fde/cfde_path.h"
-#include "xfa/fde/fde_gedevice.h"
-#include "xfa/fde/fde_object.h"
-#include "xfa/fgas/crt/fgas_utils.h"
-#include "xfa/fgas/layout/fgas_textbreak.h"
-
-FDE_TTOPIECE::FDE_TTOPIECE() = default;
-FDE_TTOPIECE::FDE_TTOPIECE(const FDE_TTOPIECE& that) = default;
-FDE_TTOPIECE::~FDE_TTOPIECE() = default;
-
-CFDE_TextOut::CFDE_TextOut()
- : m_pTxtBreak(new CFX_TxtBreak(FX_TXTBREAKPOLICY_None)),
- m_pFont(nullptr),
- m_fFontSize(12.0f),
- m_fLineSpace(m_fFontSize),
- m_fLinePos(0.0f),
- m_fTolerance(0.0f),
- m_iAlignment(0),
- m_iTxtBkAlignment(0),
- m_wParagraphBkChar(L'\n'),
- m_TxtColor(0xFF000000),
- m_dwStyles(0),
- m_dwTxtBkStyles(0),
- m_bElliChanged(false),
- m_iEllipsisWidth(0),
- m_ttoLines(5),
- m_iCurLine(0),
- m_iCurPiece(0),
- m_iTotalLines(0) {
- m_Matrix.SetIdentity();
- m_rtClip.Reset();
- m_rtLogicClip.Reset();
-}
-
-CFDE_TextOut::~CFDE_TextOut() {}
-
-void CFDE_TextOut::SetFont(const CFX_RetainPtr<CFGAS_GEFont>& pFont) {
- ASSERT(pFont);
- m_pFont = pFont;
- m_pTxtBreak->SetFont(pFont);
-}
-
-void CFDE_TextOut::SetFontSize(FX_FLOAT fFontSize) {
- ASSERT(fFontSize > 0);
- m_fFontSize = fFontSize;
- m_pTxtBreak->SetFontSize(fFontSize);
-}
-
-void CFDE_TextOut::SetTextColor(FX_ARGB color) {
- m_TxtColor = color;
-}
-
-void CFDE_TextOut::SetStyles(uint32_t dwStyles) {
- m_dwStyles = dwStyles;
- m_dwTxtBkStyles = 0;
- if (dwStyles & FDE_TTOSTYLE_SingleLine) {
- m_dwTxtBkStyles |= FX_TXTLAYOUTSTYLE_SingleLine;
- }
- if (dwStyles & FDE_TTOSTYLE_ExpandTab) {
- m_dwTxtBkStyles |= FX_TXTLAYOUTSTYLE_ExpandTab;
- }
- if (dwStyles & FDE_TTOSTYLE_ArabicShapes) {
- m_dwTxtBkStyles |= FX_TXTLAYOUTSTYLE_ArabicShapes;
- }
- if (dwStyles & FDE_TTOSTYLE_ArabicContext) {
- m_dwTxtBkStyles |= FX_TXTLAYOUTSTYLE_ArabicContext;
- }
- if (dwStyles & FDE_TTOSTYLE_VerticalLayout) {
- m_dwTxtBkStyles |=
- (FX_TXTLAYOUTSTYLE_VerticalChars | FX_TXTLAYOUTSTYLE_VerticalLayout);
- }
- m_pTxtBreak->SetLayoutStyles(m_dwTxtBkStyles);
-}
-
-void CFDE_TextOut::SetTabWidth(FX_FLOAT fTabWidth) {
- ASSERT(fTabWidth > 1.0f);
- m_pTxtBreak->SetTabWidth(fTabWidth, false);
-}
-
-void CFDE_TextOut::SetEllipsisString(const CFX_WideString& wsEllipsis) {
- m_bElliChanged = true;
- m_wsEllipsis = wsEllipsis;
-}
-
-void CFDE_TextOut::SetParagraphBreakChar(FX_WCHAR wch) {
- m_wParagraphBkChar = wch;
- m_pTxtBreak->SetParagraphBreakChar(wch);
-}
-
-void CFDE_TextOut::SetAlignment(int32_t iAlignment) {
- m_iAlignment = iAlignment;
- switch (m_iAlignment) {
- case FDE_TTOALIGNMENT_TopCenter:
- case FDE_TTOALIGNMENT_Center:
- case FDE_TTOALIGNMENT_BottomCenter:
- m_iTxtBkAlignment = FX_TXTLINEALIGNMENT_Center;
- break;
- case FDE_TTOALIGNMENT_TopRight:
- case FDE_TTOALIGNMENT_CenterRight:
- case FDE_TTOALIGNMENT_BottomRight:
- m_iTxtBkAlignment = FX_TXTLINEALIGNMENT_Right;
- break;
- default:
- m_iTxtBkAlignment = FX_TXTLINEALIGNMENT_Left;
- break;
- }
- m_pTxtBreak->SetAlignment(m_iTxtBkAlignment);
-}
-
-void CFDE_TextOut::SetLineSpace(FX_FLOAT fLineSpace) {
- ASSERT(fLineSpace > 1.0f);
- m_fLineSpace = fLineSpace;
-}
-
-void CFDE_TextOut::SetDIBitmap(CFX_DIBitmap* pDIB) {
- ASSERT(pDIB);
-
- m_pRenderDevice.reset();
- CFX_FxgeDevice* device = new CFX_FxgeDevice;
- device->Attach(pDIB, false, nullptr, false);
- m_pRenderDevice = pdfium::MakeUnique<CFDE_RenderDevice>(device, false);
-}
-
-void CFDE_TextOut::SetRenderDevice(CFX_RenderDevice* pDevice) {
- ASSERT(pDevice);
- m_pRenderDevice = pdfium::MakeUnique<CFDE_RenderDevice>(pDevice, false);
-}
-
-void CFDE_TextOut::SetClipRect(const CFX_Rect& rtClip) {
- m_rtClip = rtClip.As<FX_FLOAT>();
-}
-
-void CFDE_TextOut::SetClipRect(const CFX_RectF& rtClip) {
- m_rtClip = rtClip;
-}
-
-void CFDE_TextOut::SetLogicClipRect(const CFX_RectF& rtClip) {
- m_rtLogicClip = rtClip;
-}
-
-void CFDE_TextOut::SetMatrix(const CFX_Matrix& matrix) {
- m_Matrix = matrix;
-}
-
-void CFDE_TextOut::SetLineBreakTolerance(FX_FLOAT fTolerance) {
- m_fTolerance = fTolerance;
- m_pTxtBreak->SetLineBreakTolerance(m_fTolerance);
-}
-
-int32_t CFDE_TextOut::GetTotalLines() {
- return m_iTotalLines;
-}
-
-void CFDE_TextOut::CalcLogicSize(const FX_WCHAR* pwsStr,
- int32_t iLength,
- CFX_SizeF& size) {
- CFX_RectF rtText(0.0f, 0.0f, size.width, size.height);
- CalcLogicSize(pwsStr, iLength, rtText);
- size = rtText.Size();
-}
-
-void CFDE_TextOut::CalcLogicSize(const FX_WCHAR* pwsStr,
- int32_t iLength,
- CFX_RectF& rect) {
- if (!pwsStr || iLength < 1) {
- rect.width = 0.0f;
- rect.height = 0.0f;
- } else {
- CalcTextSize(pwsStr, iLength, rect);
- }
-}
-
-void CFDE_TextOut::CalcTextSize(const FX_WCHAR* pwsStr,
- int32_t iLength,
- CFX_RectF& rect) {
- ASSERT(m_pFont && m_fFontSize >= 1.0f);
- SetLineWidth(rect);
- m_iTotalLines = 0;
- const FX_WCHAR* pStr = pwsStr;
- bool bHotKey = !!(m_dwStyles & FDE_TTOSTYLE_HotKey);
- bool bVertical = !!(m_dwStyles & FDE_TTOSTYLE_VerticalLayout);
- FX_FLOAT fWidth = 0.0f;
- FX_FLOAT fHeight = 0.0f;
- FX_FLOAT fStartPos = bVertical ? rect.bottom() : rect.right();
- uint32_t dwBreakStatus = 0;
- FX_WCHAR wPreChar = 0;
- FX_WCHAR wch;
- FX_WCHAR wBreak = 0;
- while (iLength-- > 0) {
- wch = *pStr++;
- if (wBreak == 0 && (wch == L'\n' || wch == L'\r')) {
- wBreak = wch;
- m_pTxtBreak->SetParagraphBreakChar(wch);
- }
- if (bHotKey && wch == L'&' && wPreChar != L'&') {
- wPreChar = wch;
- continue;
- }
- dwBreakStatus = m_pTxtBreak->AppendChar(wch);
- if (dwBreakStatus > FX_TXTBREAK_PieceBreak) {
- RetrieveLineWidth(dwBreakStatus, fStartPos, fWidth, fHeight);
- }
- wPreChar = 0;
- }
- dwBreakStatus = m_pTxtBreak->EndBreak(FX_TXTBREAK_ParagraphBreak);
- if (dwBreakStatus > FX_TXTBREAK_PieceBreak) {
- RetrieveLineWidth(dwBreakStatus, fStartPos, fWidth, fHeight);
- }
- m_pTxtBreak->Reset();
- FX_FLOAT fInc = rect.Height() - fHeight;
- if (bVertical) {
- fInc = rect.Width() - fHeight;
- }
- if (m_iAlignment >= FDE_TTOALIGNMENT_CenterLeft &&
- m_iAlignment < FDE_TTOALIGNMENT_BottomLeft) {
- fInc /= 2.0f;
- } else if (m_iAlignment < FDE_TTOALIGNMENT_CenterLeft) {
- fInc = 0.0f;
- }
- if (bVertical) {
- rect.top += fStartPos;
- rect.left += fInc;
- rect.width = fHeight;
- rect.height = std::min(fWidth, rect.Height());
- } else {
- rect.left += fStartPos;
- rect.top += fInc;
- rect.width = std::min(fWidth, rect.Width());
- rect.height = fHeight;
- if (m_dwStyles & FDE_TTOSTYLE_LastLineHeight) {
- rect.height -= m_fLineSpace - m_fFontSize;
- }
- }
-}
-
-void CFDE_TextOut::SetLineWidth(CFX_RectF& rect) {
- if ((m_dwStyles & FDE_TTOSTYLE_SingleLine) == 0) {
- FX_FLOAT fLineWidth = 0.0f;
- if (m_dwStyles & FDE_TTOSTYLE_VerticalLayout) {
- if (rect.Height() < 1.0f) {
- rect.height = m_fFontSize * 1000.0f;
- }
- fLineWidth = rect.Height();
- } else {
- if (rect.Width() < 1.0f) {
- rect.width = m_fFontSize * 1000.0f;
- }
- fLineWidth = rect.Width();
- }
- m_pTxtBreak->SetLineWidth(fLineWidth);
- }
-}
-
-bool CFDE_TextOut::RetrieveLineWidth(uint32_t dwBreakStatus,
- FX_FLOAT& fStartPos,
- FX_FLOAT& fWidth,
- FX_FLOAT& fHeight) {
- if (dwBreakStatus <= FX_TXTBREAK_PieceBreak) {
- return false;
- }
- FX_FLOAT fLineStep =
- (m_fLineSpace > m_fFontSize) ? m_fLineSpace : m_fFontSize;
- bool bLineWrap = !!(m_dwStyles & FDE_TTOSTYLE_LineWrap);
- FX_FLOAT fLineWidth = 0.0f;
- int32_t iCount = m_pTxtBreak->CountBreakPieces();
- for (int32_t i = 0; i < iCount; i++) {
- const CFX_TxtPiece* pPiece = m_pTxtBreak->GetBreakPiece(i);
- fLineWidth += (FX_FLOAT)pPiece->m_iWidth / 20000.0f;
- fStartPos = std::min(fStartPos, (FX_FLOAT)pPiece->m_iStartPos / 20000.0f);
- }
- m_pTxtBreak->ClearBreakPieces();
- if (dwBreakStatus == FX_TXTBREAK_ParagraphBreak) {
- m_pTxtBreak->Reset();
- }
- if (!bLineWrap && dwBreakStatus == FX_TXTBREAK_LineBreak) {
- fWidth += fLineWidth;
- } else {
- fWidth = std::max(fWidth, fLineWidth);
- fHeight += fLineStep;
- }
- m_iTotalLines++;
- return true;
-}
-
-void CFDE_TextOut::DrawText(const FX_WCHAR* pwsStr,
- int32_t iLength,
- int32_t x,
- int32_t y) {
- CFX_RectF rtText(static_cast<FX_FLOAT>(x), static_cast<FX_FLOAT>(y),
- m_fFontSize * 1000.0f, m_fFontSize * 1000.0f);
- DrawText(pwsStr, iLength, rtText);
-}
-
-void CFDE_TextOut::DrawText(const FX_WCHAR* pwsStr,
- int32_t iLength,
- FX_FLOAT x,
- FX_FLOAT y) {
- DrawText(pwsStr, iLength,
- CFX_RectF(x, y, m_fFontSize * 1000.0f, m_fFontSize * 1000.0f));
-}
-
-void CFDE_TextOut::DrawText(const FX_WCHAR* pwsStr,
- int32_t iLength,
- const CFX_Rect& rect) {
- DrawText(pwsStr, iLength, rect.As<FX_FLOAT>());
-}
-
-void CFDE_TextOut::DrawText(const FX_WCHAR* pwsStr,
- int32_t iLength,
- const CFX_RectF& rect) {
- CFX_RectF rtText(rect.left, rect.top, rect.width, rect.height);
- CFX_Matrix rm;
- rm.SetReverse(m_Matrix);
- rm.TransformRect(rtText);
- DrawText(pwsStr, iLength, rtText, m_rtClip);
-}
-
-void CFDE_TextOut::DrawLogicText(const FX_WCHAR* pwsStr,
- int32_t iLength,
- FX_FLOAT x,
- FX_FLOAT y) {
- CFX_RectF rtText(x, y, m_fFontSize * 1000.0f, m_fFontSize * 1000.0f);
- DrawLogicText(pwsStr, iLength, rtText);
-}
-
-void CFDE_TextOut::DrawLogicText(const FX_WCHAR* pwsStr,
- int32_t iLength,
- const CFX_RectF& rect) {
- CFX_RectF rtClip(m_rtLogicClip.left, m_rtLogicClip.top, m_rtLogicClip.width,
- m_rtLogicClip.height);
- m_Matrix.TransformRect(rtClip);
- DrawText(pwsStr, iLength, rect, rtClip);
-}
-
-void CFDE_TextOut::DrawText(const FX_WCHAR* pwsStr,
- int32_t iLength,
- const CFX_RectF& rect,
- const CFX_RectF& rtClip) {
- ASSERT(m_pFont && m_fFontSize >= 1.0f);
- if (!pwsStr || iLength < 1)
- return;
-
- if (rect.width < m_fFontSize || rect.height < m_fFontSize) {
- return;
- }
- FX_FLOAT fLineWidth = rect.width;
- if (m_dwStyles & FDE_TTOSTYLE_VerticalLayout) {
- fLineWidth = rect.height;
- }
- m_pTxtBreak->SetLineWidth(fLineWidth);
- m_ttoLines.clear();
- m_wsText.clear();
- LoadText(pwsStr, iLength, rect);
- if (m_dwStyles & FDE_TTOSTYLE_Ellipsis) {
- ReplaceWidthEllipsis();
- }
- Reload(rect);
- DoAlignment(rect);
- OnDraw(rtClip);
-}
-
-void CFDE_TextOut::ExpandBuffer(int32_t iSize, int32_t iType) {
- ASSERT(iSize >= 0);
- size_t size = iSize;
- switch (iType) {
- case 0:
- if (m_CharWidths.size() < size)
- m_CharWidths.resize(size, 0);
- break;
- case 1:
- if (m_EllCharWidths.size() < size)
- m_EllCharWidths.resize(size, 0);
- break;
- case 2:
- if (m_CharPos.size() < size)
- m_CharPos.resize(size, FXTEXT_CHARPOS());
- break;
- }
-}
-
-void CFDE_TextOut::LoadEllipsis() {
- if (!m_bElliChanged) {
- return;
- }
- m_bElliChanged = false;
- m_iEllipsisWidth = 0;
- int32_t iLength = m_wsEllipsis.GetLength();
- if (iLength < 1) {
- return;
- }
- ExpandBuffer(iLength, 1);
- const FX_WCHAR* pStr = m_wsEllipsis.c_str();
- uint32_t dwBreakStatus;
- FX_WCHAR wch;
- while (iLength-- > 0) {
- wch = *pStr++;
- dwBreakStatus = m_pTxtBreak->AppendChar(wch);
- if (dwBreakStatus > FX_TXTBREAK_PieceBreak)
- RetrieveEllPieces(&m_EllCharWidths);
- }
- dwBreakStatus = m_pTxtBreak->EndBreak(FX_TXTBREAK_ParagraphBreak);
- if (dwBreakStatus > FX_TXTBREAK_PieceBreak)
- RetrieveEllPieces(&m_EllCharWidths);
- m_pTxtBreak->Reset();
-}
-
-void CFDE_TextOut::RetrieveEllPieces(std::vector<int32_t>* pCharWidths) {
- int32_t iCount = m_pTxtBreak->CountBreakPieces();
- int32_t iCharIndex = 0;
- for (int32_t i = 0; i < iCount; i++) {
- const CFX_TxtPiece* pPiece = m_pTxtBreak->GetBreakPiece(i);
- int32_t iPieceChars = pPiece->GetLength();
- for (int32_t j = 0; j < iPieceChars; j++) {
- CFX_Char* pTC = pPiece->GetCharPtr(j);
- (*pCharWidths)[iCharIndex] = std::max(pTC->m_iCharWidth, 0);
- m_iEllipsisWidth += (*pCharWidths)[iCharIndex];
- iCharIndex++;
- }
- }
- m_pTxtBreak->ClearBreakPieces();
-}
-
-void CFDE_TextOut::LoadText(const FX_WCHAR* pwsStr,
- int32_t iLength,
- const CFX_RectF& rect) {
- FX_WCHAR* pStr = m_wsText.GetBuffer(iLength);
- int32_t iTxtLength = iLength;
- ExpandBuffer(iTxtLength, 0);
- bool bHotKey = !!(m_dwStyles & FDE_TTOSTYLE_HotKey);
- bool bVertical = !!(m_dwStyles & FDE_TTOSTYLE_VerticalLayout);
- bool bLineWrap = !!(m_dwStyles & FDE_TTOSTYLE_LineWrap);
- FX_FLOAT fLineStep =
- (m_fLineSpace > m_fFontSize) ? m_fLineSpace : m_fFontSize;
- FX_FLOAT fLineStop = bVertical ? rect.left : rect.bottom();
- m_fLinePos = bVertical ? rect.right() : rect.top;
- if (bVertical) {
- fLineStep = -fLineStep;
- }
- m_hotKeys.RemoveAll();
- int32_t iStartChar = 0;
- int32_t iChars = 0;
- int32_t iPieceWidths = 0;
- uint32_t dwBreakStatus;
- FX_WCHAR wch;
- bool bRet = false;
- while (iTxtLength-- > 0) {
- wch = *pwsStr++;
- if (bHotKey && wch == L'&' && *(pStr - 1) != L'&') {
- if (iTxtLength > 0)
- m_hotKeys.Add(iChars);
- continue;
- }
- *pStr++ = wch;
- iChars++;
- dwBreakStatus = m_pTxtBreak->AppendChar(wch);
- if (dwBreakStatus > FX_TXTBREAK_PieceBreak) {
- bool bEndofLine =
- RetriecePieces(dwBreakStatus, iStartChar, iPieceWidths, false, rect);
- if (bEndofLine && (bLineWrap || (dwBreakStatus > FX_TXTBREAK_LineBreak &&
- !bLineWrap))) {
- iPieceWidths = 0;
- m_iCurLine++;
- m_fLinePos += fLineStep;
- }
- if ((bVertical && m_fLinePos + fLineStep < fLineStop) ||
- (!bVertical && m_fLinePos + fLineStep > fLineStop)) {
- int32_t iCurLine = bEndofLine ? m_iCurLine - 1 : m_iCurLine;
- m_ttoLines[iCurLine].SetNewReload(true);
- bRet = true;
- break;
- }
- }
- }
- dwBreakStatus = m_pTxtBreak->EndBreak(FX_TXTBREAK_ParagraphBreak);
- if (dwBreakStatus > FX_TXTBREAK_PieceBreak && !bRet) {
- RetriecePieces(dwBreakStatus, iStartChar, iPieceWidths, false, rect);
- }
- m_pTxtBreak->ClearBreakPieces();
- m_pTxtBreak->Reset();
- m_wsText.ReleaseBuffer(iLength);
-}
-
-bool CFDE_TextOut::RetriecePieces(uint32_t dwBreakStatus,
- int32_t& iStartChar,
- int32_t& iPieceWidths,
- bool bReload,
- const CFX_RectF& rect) {
- bool bSingleLine = !!(m_dwStyles & FDE_TTOSTYLE_SingleLine);
- bool bLineWrap = !!(m_dwStyles & FDE_TTOSTYLE_LineWrap);
- bool bVertical = !!(m_dwStyles & FDE_TTOSTYLE_VerticalLayout);
- FX_FLOAT fLineStep =
- (m_fLineSpace > m_fFontSize) ? m_fLineSpace : m_fFontSize;
- if (bVertical) {
- fLineStep = -fLineStep;
- }
- CFX_Char* pTC = nullptr;
- bool bNeedReload = false;
- FX_FLOAT fLineWidth = bVertical ? rect.Height() : rect.Width();
- int32_t iLineWidth = FXSYS_round(fLineWidth * 20000.0f);
- int32_t iCount = m_pTxtBreak->CountBreakPieces();
- for (int32_t i = 0; i < iCount; i++) {
- const CFX_TxtPiece* pPiece = m_pTxtBreak->GetBreakPiece(i);
- int32_t iPieceChars = pPiece->GetLength();
- int32_t iChar = iStartChar;
- int32_t iWidth = 0;
- int32_t j = 0;
- for (; j < iPieceChars; j++) {
- pTC = pPiece->GetCharPtr(j);
- int32_t iCurCharWidth = pTC->m_iCharWidth > 0 ? pTC->m_iCharWidth : 0;
- if (bSingleLine || !bLineWrap) {
- if (iLineWidth - iPieceWidths - iWidth < iCurCharWidth) {
- bNeedReload = true;
- break;
- }
- }
- iWidth += iCurCharWidth;
- m_CharWidths[iChar++] = iCurCharWidth;
- }
- if (j == 0 && !bReload) {
- m_ttoLines[m_iCurLine].SetNewReload(true);
- } else if (j > 0) {
- CFX_RectF rtPiece;
- if (bVertical) {
- rtPiece.left = m_fLinePos;
- rtPiece.top = rect.top + (FX_FLOAT)pPiece->m_iStartPos / 20000.0f;
- rtPiece.width = fLineStep;
- rtPiece.height = iWidth / 20000.0f;
- } else {
- rtPiece.left = rect.left + (FX_FLOAT)pPiece->m_iStartPos / 20000.0f;
- rtPiece.top = m_fLinePos;
- rtPiece.width = iWidth / 20000.0f;
- rtPiece.height = fLineStep;
- }
- FDE_TTOPIECE ttoPiece;
- ttoPiece.iStartChar = iStartChar;
- ttoPiece.iChars = j;
- ttoPiece.rtPiece = rtPiece;
- ttoPiece.dwCharStyles = pPiece->m_dwCharStyles;
- if (FX_IsOdd(pPiece->m_iBidiLevel)) {
- ttoPiece.dwCharStyles |= FX_TXTCHARSTYLE_OddBidiLevel;
- }
- AppendPiece(ttoPiece, bNeedReload, (bReload && i == iCount - 1));
- }
- iStartChar += iPieceChars;
- iPieceWidths += iWidth;
- }
- m_pTxtBreak->ClearBreakPieces();
- bool bRet = bSingleLine || bLineWrap || (!bLineWrap && bNeedReload) ||
- dwBreakStatus == FX_TXTBREAK_ParagraphBreak;
- return bRet;
-}
-
-void CFDE_TextOut::AppendPiece(const FDE_TTOPIECE& ttoPiece,
- bool bNeedReload,
- bool bEnd) {
- if (m_iCurLine >= pdfium::CollectionSize<int32_t>(m_ttoLines)) {
- CFDE_TTOLine ttoLine;
- ttoLine.SetNewReload(bNeedReload);
- m_iCurPiece = ttoLine.AddPiece(m_iCurPiece, ttoPiece);
- m_ttoLines.push_back(ttoLine);
- m_iCurLine = pdfium::CollectionSize<int32_t>(m_ttoLines) - 1;
- } else {
- CFDE_TTOLine* pLine = &m_ttoLines[m_iCurLine];
- pLine->SetNewReload(bNeedReload);
- m_iCurPiece = pLine->AddPiece(m_iCurPiece, ttoPiece);
- if (bEnd) {
- int32_t iPieces = pLine->GetSize();
- if (m_iCurPiece < iPieces) {
- pLine->RemoveLast(iPieces - m_iCurPiece - 1);
- }
- }
- }
- if (!bEnd && bNeedReload)
- m_iCurPiece = 0;
-}
-
-void CFDE_TextOut::ReplaceWidthEllipsis() {
- LoadEllipsis();
- int32_t iLength = m_wsEllipsis.GetLength();
- if (iLength < 1)
- return;
-
- for (auto& line : m_ttoLines) {
- if (!line.GetNewReload())
- continue;
-
- int32_t iEllipsisCharIndex = iLength - 1;
- int32_t iCharWidth = 0;
- int32_t iCharCount = 0;
- int32_t iPiece = line.GetSize();
- while (iPiece-- > 0) {
- FDE_TTOPIECE* pPiece = line.GetPtrAt(iPiece);
- if (!pPiece)
- break;
-
- for (int32_t j = pPiece->iChars - 1; j >= 0; j--) {
- if (iEllipsisCharIndex < 0)
- break;
-
- int32_t index = pPiece->iStartChar + j;
- iCharWidth += m_CharWidths[index];
- iCharCount++;
- if (iCharCount <= iLength) {
- m_wsText.SetAt(index, m_wsEllipsis.GetAt(iEllipsisCharIndex));
- m_CharWidths[index] = m_EllCharWidths[iEllipsisCharIndex];
- } else if (iCharWidth <= m_iEllipsisWidth) {
- m_wsText.SetAt(index, 0);
- m_CharWidths[index] = 0;
- }
- iEllipsisCharIndex--;
- }
- if (iEllipsisCharIndex < 0)
- break;
- }
- }
-}
-
-void CFDE_TextOut::Reload(const CFX_RectF& rect) {
- int i = 0;
- for (auto& line : m_ttoLines) {
- if (line.GetNewReload()) {
- m_iCurLine = i;
- m_iCurPiece = 0;
- ReloadLinePiece(&line, rect);
- }
- ++i;
- }
-}
-
-void CFDE_TextOut::ReloadLinePiece(CFDE_TTOLine* pLine, const CFX_RectF& rect) {
- const FX_WCHAR* pwsStr = m_wsText.c_str();
- bool bVertical = !!(m_dwStyles & FDE_TTOSTYLE_VerticalLayout);
- int32_t iPieceWidths = 0;
- FDE_TTOPIECE* pPiece = pLine->GetPtrAt(0);
- int32_t iStartChar = pPiece->iStartChar;
- m_fLinePos = bVertical ? pPiece->rtPiece.left : pPiece->rtPiece.top;
- int32_t iPieceCount = pLine->GetSize();
- int32_t iPieceIndex = 0;
- uint32_t dwBreakStatus = 0;
- FX_WCHAR wch;
- while (iPieceIndex < iPieceCount) {
- int32_t iStar = iStartChar;
- int32_t iEnd = pPiece->iChars + iStar;
- while (iStar < iEnd) {
- wch = *(pwsStr + iStar);
- dwBreakStatus = m_pTxtBreak->AppendChar(wch);
- if (dwBreakStatus > FX_TXTBREAK_PieceBreak) {
- RetriecePieces(dwBreakStatus, iStartChar, iPieceWidths, true, rect);
- }
- iStar++;
- }
- iPieceIndex++;
- pPiece = pLine->GetPtrAt(iPieceIndex);
- }
- dwBreakStatus = m_pTxtBreak->EndBreak(FX_TXTBREAK_ParagraphBreak);
- if (dwBreakStatus > FX_TXTBREAK_PieceBreak) {
- RetriecePieces(dwBreakStatus, iStartChar, iPieceWidths, true, rect);
- }
- m_pTxtBreak->Reset();
-}
-
-void CFDE_TextOut::DoAlignment(const CFX_RectF& rect) {
- if (m_ttoLines.empty())
- return;
-
- bool bVertical = !!(m_dwStyles & FDE_TTOSTYLE_VerticalLayout);
- FX_FLOAT fLineStopS = bVertical ? rect.right() : rect.bottom();
- FDE_TTOPIECE* pFirstPiece = m_ttoLines.back().GetPtrAt(0);
- if (!pFirstPiece)
- return;
-
- FX_FLOAT fLineStopD =
- bVertical ? pFirstPiece->rtPiece.right() : pFirstPiece->rtPiece.bottom();
- FX_FLOAT fInc = fLineStopS - fLineStopD;
- if (m_iAlignment >= FDE_TTOALIGNMENT_CenterLeft &&
- m_iAlignment < FDE_TTOALIGNMENT_BottomLeft) {
- fInc /= 2.0f;
- } else if (m_iAlignment < FDE_TTOALIGNMENT_CenterLeft) {
- fInc = 0.0f;
- }
- if (fInc < 1.0f)
- return;
- for (auto& line : m_ttoLines) {
- int32_t iPieces = line.GetSize();
- for (int32_t j = 0; j < iPieces; j++) {
- FDE_TTOPIECE* pPiece = line.GetPtrAt(j);
- if (bVertical)
- pPiece->rtPiece.left += fInc;
- else
- pPiece->rtPiece.top += fInc;
- }
- }
-}
-
-void CFDE_TextOut::OnDraw(const CFX_RectF& rtClip) {
- if (!m_pRenderDevice || m_ttoLines.empty())
- return;
-
- auto pBrush = pdfium::MakeUnique<CFDE_Brush>();
- pBrush->SetColor(m_TxtColor);
- m_pRenderDevice->SaveState();
- if (rtClip.Width() > 0.0f && rtClip.Height() > 0.0f)
- m_pRenderDevice->SetClipRect(rtClip);
-
- auto pPen = pdfium::MakeUnique<CFDE_Pen>();
- pPen->SetColor(m_TxtColor);
-
- for (auto& line : m_ttoLines) {
- int32_t iPieces = line.GetSize();
- for (int32_t j = 0; j < iPieces; j++) {
- FDE_TTOPIECE* pPiece = line.GetPtrAt(j);
- if (!pPiece)
- continue;
-
- int32_t iCount = GetDisplayPos(pPiece);
- if (iCount > 0) {
- m_pRenderDevice->DrawString(pBrush.get(), m_pFont, m_CharPos.data(),
- iCount, m_fFontSize, &m_Matrix);
- }
- DrawLine(pPiece, pPen.get());
- }
- }
- m_pRenderDevice->RestoreState();
-}
-
-int32_t CFDE_TextOut::GetDisplayPos(FDE_TTOPIECE* pPiece) {
- FX_TXTRUN tr = ToTextRun(pPiece);
- ExpandBuffer(tr.iLength, 2);
- return m_pTxtBreak->GetDisplayPos(&tr, m_CharPos.data());
-}
-
-int32_t CFDE_TextOut::GetCharRects(const FDE_TTOPIECE* pPiece) {
- FX_TXTRUN tr = ToTextRun(pPiece);
- m_rectArray = m_pTxtBreak->GetCharRects(&tr);
- return pdfium::CollectionSize<int32_t>(m_rectArray);
-}
-
-FX_TXTRUN CFDE_TextOut::ToTextRun(const FDE_TTOPIECE* pPiece) {
- FX_TXTRUN tr;
- tr.wsStr = m_wsText + pPiece->iStartChar;
- tr.pWidths = &m_CharWidths[pPiece->iStartChar];
- tr.iLength = pPiece->iChars;
- tr.pFont = m_pFont;
- tr.fFontSize = m_fFontSize;
- tr.dwStyles = m_dwTxtBkStyles;
- tr.dwCharStyles = pPiece->dwCharStyles;
- tr.wLineBreakChar = m_wParagraphBkChar;
- tr.pRect = &pPiece->rtPiece;
- return tr;
-}
-
-void CFDE_TextOut::DrawLine(const FDE_TTOPIECE* pPiece, CFDE_Pen* pPen) {
- bool bUnderLine = !!(m_dwStyles & FDE_TTOSTYLE_Underline);
- bool bStrikeOut = !!(m_dwStyles & FDE_TTOSTYLE_Strikeout);
- bool bHotKey = !!(m_dwStyles & FDE_TTOSTYLE_HotKey);
- bool bVertical = !!(m_dwStyles & FDE_TTOSTYLE_VerticalLayout);
- if (!bUnderLine && !bStrikeOut && !bHotKey)
- return;
-
- std::unique_ptr<CFDE_Path> pPath(new CFDE_Path);
- int32_t iLineCount = 0;
- CFX_RectF rtText = pPiece->rtPiece;
- CFX_PointF pt1, pt2;
- if (bUnderLine) {
- if (bVertical) {
- pt1.x = rtText.left;
- pt1.y = rtText.top;
- pt2.x = rtText.left;
- pt2.y = rtText.bottom();
- } else {
- pt1.x = rtText.left;
- pt1.y = rtText.bottom();
- pt2.x = rtText.right();
- pt2.y = rtText.bottom();
- }
- pPath->AddLine(pt1, pt2);
- iLineCount++;
- }
- if (bStrikeOut) {
- if (bVertical) {
- pt1.x = rtText.left + rtText.width * 2.0f / 5.0f;
- pt1.y = rtText.top;
- pt2.x = pt1.x;
- pt2.y = rtText.bottom();
- } else {
- pt1.x = rtText.left;
- pt1.y = rtText.bottom() - rtText.height * 2.0f / 5.0f;
- pt2.x = rtText.right();
- pt2.y = pt1.y;
- }
- pPath->AddLine(pt1, pt2);
- iLineCount++;
- }
- if (bHotKey) {
- int32_t iHotKeys = m_hotKeys.GetSize();
- int32_t iCount = GetCharRects(pPiece);
- if (iCount > 0) {
- for (int32_t i = 0; i < iHotKeys; i++) {
- int32_t iCharIndex = m_hotKeys.GetAt(i);
- if (iCharIndex >= pPiece->iStartChar &&
- iCharIndex < pPiece->iStartChar + pPiece->iChars) {
- CFX_RectF rect = m_rectArray[iCharIndex - pPiece->iStartChar];
- if (bVertical) {
- pt1.x = rect.left;
- pt1.y = rect.top;
- pt2.x = rect.left;
- pt2.y = rect.bottom();
- } else {
- pt1.x = rect.left;
- pt1.y = rect.bottom();
- pt2.x = rect.right();
- pt2.y = rect.bottom();
- }
- pPath->AddLine(pt1, pt2);
- iLineCount++;
- }
- }
- }
- }
- if (iLineCount > 0)
- m_pRenderDevice->DrawPath(pPen, 1, pPath.get(), &m_Matrix);
-}
-
-CFDE_TTOLine::CFDE_TTOLine() : m_bNewReload(false) {}
-
-CFDE_TTOLine::CFDE_TTOLine(const CFDE_TTOLine& ttoLine) : m_pieces(5) {
- m_bNewReload = ttoLine.m_bNewReload;
- m_pieces = ttoLine.m_pieces;
-}
-
-CFDE_TTOLine::~CFDE_TTOLine() {}
-
-int32_t CFDE_TTOLine::AddPiece(int32_t index, const FDE_TTOPIECE& ttoPiece) {
- if (index >= pdfium::CollectionSize<int32_t>(m_pieces)) {
- m_pieces.push_back(ttoPiece);
- return pdfium::CollectionSize<int32_t>(m_pieces);
- }
- m_pieces[index] = ttoPiece;
- return index;
-}
-
-int32_t CFDE_TTOLine::GetSize() const {
- return pdfium::CollectionSize<int32_t>(m_pieces);
-}
-
-FDE_TTOPIECE* CFDE_TTOLine::GetPtrAt(int32_t index) {
- if (index < 0 || index >= pdfium::CollectionSize<int32_t>(m_pieces))
- return nullptr;
-
- return &m_pieces[index];
-}
-
-void CFDE_TTOLine::RemoveLast(int32_t icount) {
- if (icount < 0)
- return;
- icount = std::min(icount, pdfium::CollectionSize<int32_t>(m_pieces));
- m_pieces.erase(m_pieces.end() - icount, m_pieces.end());
-}
-
-void CFDE_TTOLine::RemoveAll() {
- m_pieces.clear();
-}
diff --git a/chromium/third_party/pdfium/xfa/fde/tto/fde_textout.h b/chromium/third_party/pdfium/xfa/fde/tto/fde_textout.h
deleted file mode 100644
index 04d656776e6..00000000000
--- a/chromium/third_party/pdfium/xfa/fde/tto/fde_textout.h
+++ /dev/null
@@ -1,185 +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 XFA_FDE_TTO_FDE_TEXTOUT_H_
-#define XFA_FDE_TTO_FDE_TEXTOUT_H_
-
-#include <deque>
-#include <memory>
-#include <vector>
-
-#include "core/fxge/cfx_fxgedevice.h"
-#include "core/fxge/cfx_renderdevice.h"
-#include "core/fxge/fx_dib.h"
-#include "xfa/fde/fde_object.h"
-#include "xfa/fgas/crt/fgas_utils.h"
-#include "xfa/fgas/font/cfgas_fontmgr.h"
-
-#define FDE_TTOSTYLE_Underline 0x0001
-#define FDE_TTOSTYLE_Strikeout 0x0002
-#define FDE_TTOSTYLE_VerticalLayout 0x0004
-#define FDE_TTOSTYLE_SingleLine 0x0010
-#define FDE_TTOSTYLE_ExpandTab 0x0020
-#define FDE_TTOSTYLE_HotKey 0x0040
-#define FDE_TTOSTYLE_Ellipsis 0x0080
-#define FDE_TTOSTYLE_LineWrap 0x0100
-#define FDE_TTOSTYLE_ArabicShapes 0x0200
-#define FDE_TTOSTYLE_ArabicContext 0x0800
-#define FDE_TTOSTYLE_LastLineHeight 0x1000
-#define FDE_TTOALIGNMENT_TopLeft 0
-#define FDE_TTOALIGNMENT_TopCenter 1
-#define FDE_TTOALIGNMENT_TopRight 2
-#define FDE_TTOALIGNMENT_TopAuto 3
-#define FDE_TTOALIGNMENT_CenterLeft 4
-#define FDE_TTOALIGNMENT_Center 5
-#define FDE_TTOALIGNMENT_CenterRight 6
-#define FDE_TTOALIGNMENT_CenterAuto 7
-#define FDE_TTOALIGNMENT_BottomLeft 8
-#define FDE_TTOALIGNMENT_BottomCenter 9
-#define FDE_TTOALIGNMENT_BottomRight 10
-#define FDE_TTOALIGNMENT_BottomAuto 11
-
-class CFDE_RenderDevice;
-class CFX_RenderDevice;
-class CFX_TxtBreak;
-struct FX_TXTRUN;
-
-struct FDE_TTOPIECE {
- FDE_TTOPIECE();
- FDE_TTOPIECE(const FDE_TTOPIECE& that);
- ~FDE_TTOPIECE();
-
- int32_t iStartChar;
- int32_t iChars;
- uint32_t dwCharStyles;
- CFX_RectF rtPiece;
-};
-
-class CFDE_TTOLine {
- public:
- CFDE_TTOLine();
- CFDE_TTOLine(const CFDE_TTOLine& ttoLine);
- ~CFDE_TTOLine();
-
- bool GetNewReload() const { return m_bNewReload; }
- void SetNewReload(bool reload) { m_bNewReload = reload; }
- int32_t AddPiece(int32_t index, const FDE_TTOPIECE& ttoPiece);
- int32_t GetSize() const;
- FDE_TTOPIECE* GetPtrAt(int32_t index);
- void RemoveLast(int32_t iCount);
- void RemoveAll();
-
- private:
- bool m_bNewReload;
- std::deque<FDE_TTOPIECE> m_pieces;
-};
-
-class CFDE_TextOut {
- public:
- CFDE_TextOut();
- ~CFDE_TextOut();
-
- void SetFont(const CFX_RetainPtr<CFGAS_GEFont>& pFont);
- void SetFontSize(FX_FLOAT fFontSize);
- void SetTextColor(FX_ARGB color);
- void SetStyles(uint32_t dwStyles);
- void SetTabWidth(FX_FLOAT fTabWidth);
- void SetEllipsisString(const CFX_WideString& wsEllipsis);
- void SetParagraphBreakChar(FX_WCHAR wch);
- void SetAlignment(int32_t iAlignment);
- void SetLineSpace(FX_FLOAT fLineSpace);
- void SetDIBitmap(CFX_DIBitmap* pDIB);
- void SetRenderDevice(CFX_RenderDevice* pDevice);
- void SetClipRect(const CFX_Rect& rtClip);
- void SetClipRect(const CFX_RectF& rtClip);
- void SetMatrix(const CFX_Matrix& matrix);
- void SetLineBreakTolerance(FX_FLOAT fTolerance);
-
- void DrawText(const FX_WCHAR* pwsStr, int32_t iLength, int32_t x, int32_t y);
- void DrawText(const FX_WCHAR* pwsStr,
- int32_t iLength,
- FX_FLOAT x,
- FX_FLOAT y);
- void DrawText(const FX_WCHAR* pwsStr, int32_t iLength, const CFX_Rect& rect);
- void DrawText(const FX_WCHAR* pwsStr, int32_t iLength, const CFX_RectF& rect);
-
- void SetLogicClipRect(const CFX_RectF& rtClip);
- void CalcLogicSize(const FX_WCHAR* pwsStr, int32_t iLength, CFX_SizeF& size);
- void CalcLogicSize(const FX_WCHAR* pwsStr, int32_t iLength, CFX_RectF& rect);
- void DrawLogicText(const FX_WCHAR* pwsStr,
- int32_t iLength,
- FX_FLOAT x,
- FX_FLOAT y);
- void DrawLogicText(const FX_WCHAR* pwsStr,
- int32_t iLength,
- const CFX_RectF& rect);
- int32_t GetTotalLines();
-
- protected:
- void CalcTextSize(const FX_WCHAR* pwsStr, int32_t iLength, CFX_RectF& rect);
- bool RetrieveLineWidth(uint32_t dwBreakStatus,
- FX_FLOAT& fStartPos,
- FX_FLOAT& fWidth,
- FX_FLOAT& fHeight);
- void SetLineWidth(CFX_RectF& rect);
- void DrawText(const FX_WCHAR* pwsStr,
- int32_t iLength,
- const CFX_RectF& rect,
- const CFX_RectF& rtClip);
- void LoadText(const FX_WCHAR* pwsStr, int32_t iLength, const CFX_RectF& rect);
- void LoadEllipsis();
- void ExpandBuffer(int32_t iSize, int32_t iType);
- void RetrieveEllPieces(std::vector<int32_t>* pCharWidths);
-
- void Reload(const CFX_RectF& rect);
- void ReloadLinePiece(CFDE_TTOLine* pLine, const CFX_RectF& rect);
- bool RetriecePieces(uint32_t dwBreakStatus,
- int32_t& iStartChar,
- int32_t& iPieceWidths,
- bool bReload,
- const CFX_RectF& rect);
- void AppendPiece(const FDE_TTOPIECE& ttoPiece, bool bNeedReload, bool bEnd);
- void ReplaceWidthEllipsis();
- void DoAlignment(const CFX_RectF& rect);
- void OnDraw(const CFX_RectF& rtClip);
- int32_t GetDisplayPos(FDE_TTOPIECE* pPiece);
- int32_t GetCharRects(const FDE_TTOPIECE* pPiece);
-
- FX_TXTRUN ToTextRun(const FDE_TTOPIECE* pPiece);
- void DrawLine(const FDE_TTOPIECE* pPiece, CFDE_Pen* pPen);
-
- std::unique_ptr<CFX_TxtBreak> m_pTxtBreak;
- CFX_RetainPtr<CFGAS_GEFont> m_pFont;
- FX_FLOAT m_fFontSize;
- FX_FLOAT m_fLineSpace;
- FX_FLOAT m_fLinePos;
- FX_FLOAT m_fTolerance;
- int32_t m_iAlignment;
- int32_t m_iTxtBkAlignment;
- std::vector<int32_t> m_CharWidths;
- std::vector<int32_t> m_EllCharWidths;
- FX_WCHAR m_wParagraphBkChar;
- FX_ARGB m_TxtColor;
- uint32_t m_dwStyles;
- uint32_t m_dwTxtBkStyles;
- CFX_WideString m_wsEllipsis;
- bool m_bElliChanged;
- int32_t m_iEllipsisWidth;
- CFX_WideString m_wsText;
- CFX_RectF m_rtClip;
- CFX_RectF m_rtLogicClip;
- CFX_Matrix m_Matrix;
- std::deque<CFDE_TTOLine> m_ttoLines;
- int32_t m_iCurLine;
- int32_t m_iCurPiece;
- int32_t m_iTotalLines;
- std::vector<FXTEXT_CHARPOS> m_CharPos;
- std::unique_ptr<CFDE_RenderDevice> m_pRenderDevice;
- CFX_ArrayTemplate<int32_t> m_hotKeys;
- std::vector<CFX_RectF> m_rectArray;
-};
-
-#endif // XFA_FDE_TTO_FDE_TEXTOUT_H_
diff --git a/chromium/third_party/pdfium/xfa/fde/xml/cfde_xmlattributenode.cpp b/chromium/third_party/pdfium/xfa/fde/xml/cfde_xmlattributenode.cpp
new file mode 100644
index 00000000000..0bfa949b12e
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fde/xml/cfde_xmlattributenode.cpp
@@ -0,0 +1,35 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "xfa/fde/xml/cfde_xmlattributenode.h"
+
+#include "core/fxcrt/fx_ext.h"
+
+CFDE_XMLAttributeNode::CFDE_XMLAttributeNode(const CFX_WideString& name)
+ : CFDE_XMLNode(), name_(name) {
+ ASSERT(name_.GetLength() > 0);
+}
+
+CFDE_XMLAttributeNode::~CFDE_XMLAttributeNode() {}
+
+bool CFDE_XMLAttributeNode::HasAttribute(const CFX_WideString& name) const {
+ return attrs_.find(name) != attrs_.end();
+}
+
+CFX_WideString CFDE_XMLAttributeNode::GetString(
+ const CFX_WideString& name) const {
+ auto it = attrs_.find(name);
+ return it != attrs_.end() ? it->second : CFX_WideString();
+}
+
+void CFDE_XMLAttributeNode::SetString(const CFX_WideString& name,
+ const CFX_WideString& value) {
+ attrs_[name] = value;
+}
+
+void CFDE_XMLAttributeNode::RemoveAttribute(const CFX_WideString& name) {
+ attrs_.erase(name);
+}
diff --git a/chromium/third_party/pdfium/xfa/fde/xml/cfde_xmlattributenode.h b/chromium/third_party/pdfium/xfa/fde/xml/cfde_xmlattributenode.h
new file mode 100644
index 00000000000..07a1ef1610d
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fde/xml/cfde_xmlattributenode.h
@@ -0,0 +1,44 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef XFA_FDE_XML_CFDE_XMLATTRIBUTENODE_H_
+#define XFA_FDE_XML_CFDE_XMLATTRIBUTENODE_H_
+
+#include <map>
+#include <memory>
+
+#include "core/fxcrt/fx_string.h"
+#include "xfa/fde/xml/cfde_xmlnode.h"
+
+class CFDE_XMLAttributeNode : public CFDE_XMLNode {
+ public:
+ explicit CFDE_XMLAttributeNode(const CFX_WideString& name);
+ ~CFDE_XMLAttributeNode() override;
+
+ // CFDE_XMLNode
+ FDE_XMLNODETYPE GetType() const override = 0;
+ std::unique_ptr<CFDE_XMLNode> Clone() override = 0;
+
+ CFX_WideString GetName() const { return name_; }
+ const std::map<CFX_WideString, CFX_WideString>& GetAttributes() const {
+ return attrs_;
+ }
+ void SetAttributes(const std::map<CFX_WideString, CFX_WideString>& attrs) {
+ attrs_ = attrs;
+ }
+ bool HasAttribute(const CFX_WideString& name) const;
+
+ void SetString(const CFX_WideString& name, const CFX_WideString& value);
+ CFX_WideString GetString(const CFX_WideString& name) const;
+
+ void RemoveAttribute(const CFX_WideString& name);
+
+ private:
+ CFX_WideString name_;
+ std::map<CFX_WideString, CFX_WideString> attrs_;
+};
+
+#endif // XFA_FDE_XML_CFDE_XMLATTRIBUTENODE_H_
diff --git a/chromium/third_party/pdfium/xfa/fde/xml/cfde_xmlchardata.cpp b/chromium/third_party/pdfium/xfa/fde/xml/cfde_xmlchardata.cpp
new file mode 100644
index 00000000000..bb2991937b2
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fde/xml/cfde_xmlchardata.cpp
@@ -0,0 +1,22 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "xfa/fde/xml/cfde_xmlchardata.h"
+
+#include "third_party/base/ptr_util.h"
+
+CFDE_XMLCharData::CFDE_XMLCharData(const CFX_WideString& wsCData)
+ : CFDE_XMLText(wsCData) {}
+
+CFDE_XMLCharData::~CFDE_XMLCharData() {}
+
+FDE_XMLNODETYPE CFDE_XMLCharData::GetType() const {
+ return FDE_XMLNODE_CharData;
+}
+
+std::unique_ptr<CFDE_XMLNode> CFDE_XMLCharData::Clone() {
+ return pdfium::MakeUnique<CFDE_XMLCharData>(GetText());
+}
diff --git a/chromium/third_party/pdfium/xfa/fde/xml/cfde_xmlchardata.h b/chromium/third_party/pdfium/xfa/fde/xml/cfde_xmlchardata.h
new file mode 100644
index 00000000000..56babbc8b49
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fde/xml/cfde_xmlchardata.h
@@ -0,0 +1,24 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef XFA_FDE_XML_CFDE_XMLCHARDATA_H_
+#define XFA_FDE_XML_CFDE_XMLCHARDATA_H_
+
+#include <memory>
+
+#include "core/fxcrt/fx_string.h"
+#include "xfa/fde/xml/cfde_xmltext.h"
+
+class CFDE_XMLCharData : public CFDE_XMLText {
+ public:
+ explicit CFDE_XMLCharData(const CFX_WideString& wsCData);
+ ~CFDE_XMLCharData() override;
+
+ FDE_XMLNODETYPE GetType() const override;
+ std::unique_ptr<CFDE_XMLNode> Clone() override;
+};
+
+#endif // XFA_FDE_XML_CFDE_XMLCHARDATA_H_
diff --git a/chromium/third_party/pdfium/xfa/fde/xml/cfde_xmldoc.cpp b/chromium/third_party/pdfium/xfa/fde/xml/cfde_xmldoc.cpp
new file mode 100644
index 00000000000..70327005787
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fde/xml/cfde_xmldoc.cpp
@@ -0,0 +1,159 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "xfa/fde/xml/cfde_xmldoc.h"
+
+#include <utility>
+#include <vector>
+
+#include "third_party/base/ptr_util.h"
+#include "third_party/base/stl_util.h"
+#include "xfa/fde/xml/cfde_xmlchardata.h"
+#include "xfa/fde/xml/cfde_xmlelement.h"
+#include "xfa/fde/xml/cfde_xmlinstruction.h"
+#include "xfa/fde/xml/cfde_xmlnode.h"
+#include "xfa/fde/xml/cfde_xmltext.h"
+#include "xfa/fgas/crt/fgas_codepage.h"
+
+CFDE_XMLDoc::CFDE_XMLDoc()
+ : m_iStatus(0), m_pRoot(pdfium::MakeUnique<CFDE_XMLNode>()) {
+ m_pRoot->InsertChildNode(new CFDE_XMLInstruction(L"xml"));
+}
+
+CFDE_XMLDoc::~CFDE_XMLDoc() {}
+
+bool CFDE_XMLDoc::LoadXML(std::unique_ptr<CFDE_XMLParser> pXMLParser) {
+ if (!pXMLParser)
+ return false;
+
+ m_iStatus = 0;
+ m_pStream.Reset();
+ m_pRoot->DeleteChildren();
+ m_pXMLParser = std::move(pXMLParser);
+ return true;
+}
+
+int32_t CFDE_XMLDoc::DoLoad(IFX_Pause* pPause) {
+ if (m_iStatus < 100)
+ m_iStatus = m_pXMLParser->DoParser(pPause);
+
+ return m_iStatus;
+}
+
+void CFDE_XMLDoc::CloseXML() {
+ m_pXMLParser.reset();
+}
+
+void CFDE_XMLDoc::SaveXMLNode(const CFX_RetainPtr<IFGAS_Stream>& pXMLStream,
+ CFDE_XMLNode* pINode) {
+ CFDE_XMLNode* pNode = (CFDE_XMLNode*)pINode;
+ switch (pNode->GetType()) {
+ case FDE_XMLNODE_Instruction: {
+ CFX_WideString ws;
+ CFDE_XMLInstruction* pInstruction = (CFDE_XMLInstruction*)pNode;
+ if (pInstruction->GetName().CompareNoCase(L"xml") == 0) {
+ ws = L"<?xml version=\"1.0\" encoding=\"";
+ uint16_t wCodePage = pXMLStream->GetCodePage();
+ if (wCodePage == FX_CODEPAGE_UTF16LE) {
+ ws += L"UTF-16";
+ } else if (wCodePage == FX_CODEPAGE_UTF16BE) {
+ ws += L"UTF-16be";
+ } else {
+ ws += L"UTF-8";
+ }
+ ws += L"\"?>";
+ pXMLStream->WriteString(ws.c_str(), ws.GetLength());
+ } else {
+ ws.Format(L"<?%s", pInstruction->GetName().c_str());
+ pXMLStream->WriteString(ws.c_str(), ws.GetLength());
+
+ for (auto it : pInstruction->GetAttributes()) {
+ CFX_WideString wsValue = it.second;
+ wsValue.Replace(L"&", L"&amp;");
+ wsValue.Replace(L"<", L"&lt;");
+ wsValue.Replace(L">", L"&gt;");
+ wsValue.Replace(L"\'", L"&apos;");
+ wsValue.Replace(L"\"", L"&quot;");
+
+ ws = L" ";
+ ws += it.first;
+ ws += L"=\"";
+ ws += wsValue;
+ ws += L"\"";
+ pXMLStream->WriteString(ws.c_str(), ws.GetLength());
+ }
+
+ for (auto target : pInstruction->GetTargetData()) {
+ ws = L" \"";
+ ws += target;
+ ws += L"\"";
+ pXMLStream->WriteString(ws.c_str(), ws.GetLength());
+ }
+ ws = L"?>";
+ pXMLStream->WriteString(ws.c_str(), ws.GetLength());
+ }
+ break;
+ }
+ case FDE_XMLNODE_Element: {
+ CFX_WideString ws;
+ ws = L"<";
+ ws += static_cast<CFDE_XMLElement*>(pNode)->GetName();
+ pXMLStream->WriteString(ws.c_str(), ws.GetLength());
+
+ for (auto it : static_cast<CFDE_XMLElement*>(pNode)->GetAttributes()) {
+ CFX_WideString wsValue = it.second;
+ wsValue.Replace(L"&", L"&amp;");
+ wsValue.Replace(L"<", L"&lt;");
+ wsValue.Replace(L">", L"&gt;");
+ wsValue.Replace(L"\'", L"&apos;");
+ wsValue.Replace(L"\"", L"&quot;");
+
+ ws = L" ";
+ ws += it.first;
+ ws += L"=\"";
+ ws += wsValue;
+ ws += L"\"";
+ pXMLStream->WriteString(ws.c_str(), ws.GetLength());
+ }
+ if (pNode->m_pChild) {
+ ws = L"\n>";
+ pXMLStream->WriteString(ws.c_str(), ws.GetLength());
+ CFDE_XMLNode* pChild = pNode->m_pChild;
+ while (pChild) {
+ SaveXMLNode(pXMLStream, static_cast<CFDE_XMLNode*>(pChild));
+ pChild = pChild->m_pNext;
+ }
+ ws = L"</";
+ ws += static_cast<CFDE_XMLElement*>(pNode)->GetName();
+ ws += L"\n>";
+ } else {
+ ws = L"\n/>";
+ }
+ pXMLStream->WriteString(ws.c_str(), ws.GetLength());
+ break;
+ }
+ case FDE_XMLNODE_Text: {
+ CFX_WideString ws = static_cast<CFDE_XMLText*>(pNode)->GetText();
+ ws.Replace(L"&", L"&amp;");
+ ws.Replace(L"<", L"&lt;");
+ ws.Replace(L">", L"&gt;");
+ ws.Replace(L"\'", L"&apos;");
+ ws.Replace(L"\"", L"&quot;");
+ pXMLStream->WriteString(ws.c_str(), ws.GetLength());
+ break;
+ }
+ case FDE_XMLNODE_CharData: {
+ CFX_WideString ws = L"<![CDATA[";
+ ws += static_cast<CFDE_XMLCharData*>(pNode)->GetText();
+ ws += L"]]>";
+ pXMLStream->WriteString(ws.c_str(), ws.GetLength());
+ break;
+ }
+ case FDE_XMLNODE_Unknown:
+ default:
+ break;
+ }
+}
diff --git a/chromium/third_party/pdfium/xfa/fde/xml/cfde_xmldoc.h b/chromium/third_party/pdfium/xfa/fde/xml/cfde_xmldoc.h
new file mode 100644
index 00000000000..61437504286
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fde/xml/cfde_xmldoc.h
@@ -0,0 +1,37 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef XFA_FDE_XML_CFDE_XMLDOC_H_
+#define XFA_FDE_XML_CFDE_XMLDOC_H_
+
+#include <memory>
+
+#include "core/fxcrt/cfx_retain_ptr.h"
+#include "xfa/fde/xml/cfde_xmlnode.h"
+#include "xfa/fde/xml/cfde_xmlparser.h"
+#include "xfa/fgas/crt/ifgas_stream.h"
+
+class CFDE_XMLDoc {
+ public:
+ CFDE_XMLDoc();
+ ~CFDE_XMLDoc();
+
+ bool LoadXML(std::unique_ptr<CFDE_XMLParser> pXMLParser);
+ int32_t DoLoad(IFX_Pause* pPause);
+ void CloseXML();
+
+ CFDE_XMLNode* GetRoot() const { return m_pRoot.get(); }
+ void SaveXMLNode(const CFX_RetainPtr<IFGAS_Stream>& pXMLStream,
+ CFDE_XMLNode* pNode);
+
+ private:
+ int32_t m_iStatus;
+ std::unique_ptr<CFDE_XMLNode> m_pRoot;
+ std::unique_ptr<CFDE_XMLParser> m_pXMLParser;
+ CFX_RetainPtr<IFGAS_Stream> m_pStream;
+};
+
+#endif // XFA_FDE_XML_CFDE_XMLDOC_H_
diff --git a/chromium/third_party/pdfium/xfa/fde/xml/cfde_xmlelement.cpp b/chromium/third_party/pdfium/xfa/fde/xml/cfde_xmlelement.cpp
new file mode 100644
index 00000000000..560cf892804
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fde/xml/cfde_xmlelement.cpp
@@ -0,0 +1,102 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "xfa/fde/xml/cfde_xmlelement.h"
+
+#include "core/fxcrt/fx_ext.h"
+#include "third_party/base/ptr_util.h"
+#include "third_party/base/stl_util.h"
+#include "xfa/fde/xml/cfde_xmlchardata.h"
+#include "xfa/fde/xml/cfde_xmltext.h"
+
+CFDE_XMLElement::CFDE_XMLElement(const CFX_WideString& wsTag)
+ : CFDE_XMLAttributeNode(wsTag) {}
+
+CFDE_XMLElement::~CFDE_XMLElement() {}
+
+FDE_XMLNODETYPE CFDE_XMLElement::GetType() const {
+ return FDE_XMLNODE_Element;
+}
+
+std::unique_ptr<CFDE_XMLNode> CFDE_XMLElement::Clone() {
+ auto pClone = pdfium::MakeUnique<CFDE_XMLElement>(GetName());
+ pClone->SetAttributes(GetAttributes());
+
+ CFX_WideString wsText;
+ CFDE_XMLNode* pChild = m_pChild;
+ while (pChild) {
+ switch (pChild->GetType()) {
+ case FDE_XMLNODE_Text:
+ wsText += static_cast<CFDE_XMLText*>(pChild)->GetText();
+ break;
+ default:
+ break;
+ }
+ pChild = pChild->m_pNext;
+ }
+ pClone->SetTextData(wsText);
+ return pClone;
+}
+
+CFX_WideString CFDE_XMLElement::GetLocalTagName() const {
+ FX_STRSIZE iFind = GetName().Find(L':', 0);
+ if (iFind < 0)
+ return GetName();
+ return GetName().Right(GetName().GetLength() - iFind - 1);
+}
+
+CFX_WideString CFDE_XMLElement::GetNamespacePrefix() const {
+ FX_STRSIZE iFind = GetName().Find(L':', 0);
+ if (iFind < 0)
+ return CFX_WideString();
+ return GetName().Left(iFind);
+}
+
+CFX_WideString CFDE_XMLElement::GetNamespaceURI() const {
+ CFX_WideString wsAttri(L"xmlns");
+ CFX_WideString wsPrefix = GetNamespacePrefix();
+ if (wsPrefix.GetLength() > 0) {
+ wsAttri += L":";
+ wsAttri += wsPrefix;
+ }
+
+ auto* pNode = static_cast<const CFDE_XMLNode*>(this);
+ while (pNode) {
+ if (pNode->GetType() != FDE_XMLNODE_Element)
+ break;
+
+ auto* pElement = static_cast<const CFDE_XMLElement*>(pNode);
+ if (!pElement->HasAttribute(wsAttri)) {
+ pNode = pNode->GetNodeItem(CFDE_XMLNode::Parent);
+ continue;
+ }
+ return pElement->GetString(wsAttri);
+ }
+ return CFX_WideString();
+}
+
+CFX_WideString CFDE_XMLElement::GetTextData() const {
+ CFX_WideTextBuf buffer;
+ CFDE_XMLNode* pChild = m_pChild;
+ while (pChild) {
+ switch (pChild->GetType()) {
+ case FDE_XMLNODE_Text:
+ case FDE_XMLNODE_CharData:
+ buffer << static_cast<CFDE_XMLText*>(pChild)->GetText();
+ break;
+ default:
+ break;
+ }
+ pChild = pChild->m_pNext;
+ }
+ return buffer.MakeString();
+}
+
+void CFDE_XMLElement::SetTextData(const CFX_WideString& wsText) {
+ if (wsText.GetLength() < 1)
+ return;
+ InsertChildNode(new CFDE_XMLText(wsText));
+}
diff --git a/chromium/third_party/pdfium/xfa/fde/xml/cfde_xmlelement.h b/chromium/third_party/pdfium/xfa/fde/xml/cfde_xmlelement.h
new file mode 100644
index 00000000000..a891ce89280
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fde/xml/cfde_xmlelement.h
@@ -0,0 +1,33 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef XFA_FDE_XML_CFDE_XMLELEMENT_H_
+#define XFA_FDE_XML_CFDE_XMLELEMENT_H_
+
+#include <memory>
+#include <vector>
+
+#include "core/fxcrt/fx_string.h"
+#include "xfa/fde/xml/cfde_xmlattributenode.h"
+
+class CFDE_XMLElement : public CFDE_XMLAttributeNode {
+ public:
+ explicit CFDE_XMLElement(const CFX_WideString& wsTag);
+ ~CFDE_XMLElement() override;
+
+ // CFDE_XMLNode
+ FDE_XMLNODETYPE GetType() const override;
+ std::unique_ptr<CFDE_XMLNode> Clone() override;
+
+ CFX_WideString GetLocalTagName() const;
+ CFX_WideString GetNamespacePrefix() const;
+ CFX_WideString GetNamespaceURI() const;
+
+ CFX_WideString GetTextData() const;
+ void SetTextData(const CFX_WideString& wsText);
+};
+
+#endif // XFA_FDE_XML_CFDE_XMLELEMENT_H_
diff --git a/chromium/third_party/pdfium/xfa/fde/xml/cfde_xmlinstruction.cpp b/chromium/third_party/pdfium/xfa/fde/xml/cfde_xmlinstruction.cpp
new file mode 100644
index 00000000000..d289d9e88a2
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fde/xml/cfde_xmlinstruction.cpp
@@ -0,0 +1,36 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "xfa/fde/xml/cfde_xmlinstruction.h"
+
+#include "core/fxcrt/fx_ext.h"
+#include "third_party/base/ptr_util.h"
+#include "third_party/base/stl_util.h"
+
+CFDE_XMLInstruction::CFDE_XMLInstruction(const CFX_WideString& wsTarget)
+ : CFDE_XMLAttributeNode(wsTarget) {}
+
+CFDE_XMLInstruction::~CFDE_XMLInstruction() {}
+
+FDE_XMLNODETYPE CFDE_XMLInstruction::GetType() const {
+ return FDE_XMLNODE_Instruction;
+}
+
+std::unique_ptr<CFDE_XMLNode> CFDE_XMLInstruction::Clone() {
+ auto pClone = pdfium::MakeUnique<CFDE_XMLInstruction>(GetName());
+ pClone->SetAttributes(GetAttributes());
+ pClone->m_TargetData = m_TargetData;
+ return pClone;
+}
+
+void CFDE_XMLInstruction::AppendData(const CFX_WideString& wsData) {
+ m_TargetData.push_back(wsData);
+}
+
+void CFDE_XMLInstruction::RemoveData(int32_t index) {
+ if (pdfium::IndexInBounds(m_TargetData, index))
+ m_TargetData.erase(m_TargetData.begin() + index);
+}
diff --git a/chromium/third_party/pdfium/xfa/fde/xml/cfde_xmlinstruction.h b/chromium/third_party/pdfium/xfa/fde/xml/cfde_xmlinstruction.h
new file mode 100644
index 00000000000..e9c4ad3dfeb
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fde/xml/cfde_xmlinstruction.h
@@ -0,0 +1,35 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef XFA_FDE_XML_CFDE_XMLINSTRUCTION_H_
+#define XFA_FDE_XML_CFDE_XMLINSTRUCTION_H_
+
+#include <memory>
+#include <vector>
+
+#include "core/fxcrt/fx_string.h"
+#include "xfa/fde/xml/cfde_xmlattributenode.h"
+
+class CFDE_XMLInstruction : public CFDE_XMLAttributeNode {
+ public:
+ explicit CFDE_XMLInstruction(const CFX_WideString& wsTarget);
+ ~CFDE_XMLInstruction() override;
+
+ // CFDE_XMLNode
+ FDE_XMLNODETYPE GetType() const override;
+ std::unique_ptr<CFDE_XMLNode> Clone() override;
+
+ const std::vector<CFX_WideString>& GetTargetData() const {
+ return m_TargetData;
+ }
+ void AppendData(const CFX_WideString& wsData);
+ void RemoveData(int32_t index);
+
+ private:
+ std::vector<CFX_WideString> m_TargetData;
+};
+
+#endif // XFA_FDE_XML_CFDE_XMLINSTRUCTION_H_
diff --git a/chromium/third_party/pdfium/xfa/fde/xml/cfde_xmlnode.cpp b/chromium/third_party/pdfium/xfa/fde/xml/cfde_xmlnode.cpp
new file mode 100644
index 00000000000..82db939a230
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fde/xml/cfde_xmlnode.cpp
@@ -0,0 +1,440 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "xfa/fde/xml/cfde_xmlnode.h"
+
+#include <vector>
+
+#include "third_party/base/stl_util.h"
+#include "xfa/fde/xml/cfde_xmlchardata.h"
+#include "xfa/fde/xml/cfde_xmlelement.h"
+#include "xfa/fde/xml/cfde_xmlinstruction.h"
+#include "xfa/fde/xml/cfde_xmltext.h"
+#include "xfa/fgas/crt/fgas_codepage.h"
+
+CFDE_XMLNode::CFDE_XMLNode()
+ : m_pParent(nullptr),
+ m_pChild(nullptr),
+ m_pPrior(nullptr),
+ m_pNext(nullptr) {}
+
+FDE_XMLNODETYPE CFDE_XMLNode::GetType() const {
+ return FDE_XMLNODE_Unknown;
+}
+
+CFDE_XMLNode::~CFDE_XMLNode() {
+ DeleteChildren();
+}
+
+void CFDE_XMLNode::DeleteChildren() {
+ CFDE_XMLNode* pChild = m_pChild;
+ while (pChild) {
+ CFDE_XMLNode* pNext = pChild->m_pNext;
+ delete pChild;
+ pChild = pNext;
+ }
+ m_pChild = nullptr;
+}
+
+int32_t CFDE_XMLNode::CountChildNodes() const {
+ int32_t iCount = 0;
+ CFDE_XMLNode* pChild = m_pChild;
+ while (pChild) {
+ iCount++;
+ pChild = pChild->m_pNext;
+ }
+ return iCount;
+}
+
+CFDE_XMLNode* CFDE_XMLNode::GetChildNode(int32_t index) const {
+ CFDE_XMLNode* pChild = m_pChild;
+ while (pChild) {
+ if (index == 0) {
+ return pChild;
+ }
+ index--;
+ pChild = pChild->m_pNext;
+ }
+ return nullptr;
+}
+
+int32_t CFDE_XMLNode::GetChildNodeIndex(CFDE_XMLNode* pNode) const {
+ int32_t index = 0;
+ CFDE_XMLNode* pChild = m_pChild;
+ while (pChild) {
+ if (pChild == pNode) {
+ return index;
+ }
+ index++;
+ pChild = pChild->m_pNext;
+ }
+ return -1;
+}
+
+CFDE_XMLNode* CFDE_XMLNode::GetPath(const wchar_t* pPath,
+ int32_t iLength,
+ bool bQualifiedName) const {
+ ASSERT(pPath);
+ if (iLength < 0) {
+ iLength = FXSYS_wcslen(pPath);
+ }
+ if (iLength == 0) {
+ return nullptr;
+ }
+ CFX_WideString csPath;
+ const wchar_t* pStart = pPath;
+ const wchar_t* pEnd = pPath + iLength;
+ wchar_t ch;
+ while (pStart < pEnd) {
+ ch = *pStart++;
+ if (ch == L'/') {
+ break;
+ } else {
+ csPath += ch;
+ }
+ }
+ iLength -= pStart - pPath;
+ CFDE_XMLNode* pFind = nullptr;
+ if (csPath.GetLength() < 1) {
+ pFind = GetNodeItem(CFDE_XMLNode::Root);
+ } else if (csPath.Compare(L"..") == 0) {
+ pFind = m_pParent;
+ } else if (csPath.Compare(L".") == 0) {
+ pFind = (CFDE_XMLNode*)this;
+ } else {
+ CFX_WideString wsTag;
+ CFDE_XMLNode* pNode = m_pChild;
+ while (pNode) {
+ if (pNode->GetType() == FDE_XMLNODE_Element) {
+ if (bQualifiedName)
+ wsTag = static_cast<CFDE_XMLElement*>(pNode)->GetName();
+ else
+ wsTag = static_cast<CFDE_XMLElement*>(pNode)->GetLocalTagName();
+
+ if (wsTag.Compare(csPath) == 0) {
+ if (iLength < 1)
+ pFind = pNode;
+ else
+ pFind = pNode->GetPath(pStart, iLength, bQualifiedName);
+
+ if (pFind)
+ return pFind;
+ }
+ }
+ pNode = pNode->m_pNext;
+ }
+ }
+ if (!pFind || iLength < 1)
+ return pFind;
+ return pFind->GetPath(pStart, iLength, bQualifiedName);
+}
+
+int32_t CFDE_XMLNode::InsertChildNode(CFDE_XMLNode* pNode, int32_t index) {
+ pNode->m_pParent = this;
+ if (!m_pChild) {
+ m_pChild = pNode;
+ pNode->m_pPrior = nullptr;
+ pNode->m_pNext = nullptr;
+ return 0;
+ }
+ if (index == 0) {
+ pNode->m_pNext = m_pChild;
+ pNode->m_pPrior = nullptr;
+ m_pChild->m_pPrior = pNode;
+ m_pChild = pNode;
+ return 0;
+ }
+ int32_t iCount = 0;
+ CFDE_XMLNode* pFind = m_pChild;
+ while (++iCount != index && pFind->m_pNext) {
+ pFind = pFind->m_pNext;
+ }
+ pNode->m_pPrior = pFind;
+ pNode->m_pNext = pFind->m_pNext;
+ if (pFind->m_pNext)
+ pFind->m_pNext->m_pPrior = pNode;
+ pFind->m_pNext = pNode;
+ return iCount;
+}
+
+void CFDE_XMLNode::RemoveChildNode(CFDE_XMLNode* pNode) {
+ ASSERT(m_pChild && pNode);
+ if (m_pChild == pNode) {
+ m_pChild = pNode->m_pNext;
+ } else {
+ pNode->m_pPrior->m_pNext = pNode->m_pNext;
+ }
+ if (pNode->m_pNext)
+ pNode->m_pNext->m_pPrior = pNode->m_pPrior;
+ pNode->m_pParent = nullptr;
+ pNode->m_pNext = nullptr;
+ pNode->m_pPrior = nullptr;
+}
+
+CFDE_XMLNode* CFDE_XMLNode::GetNodeItem(CFDE_XMLNode::NodeItem eItem) const {
+ switch (eItem) {
+ case CFDE_XMLNode::Root: {
+ CFDE_XMLNode* pParent = (CFDE_XMLNode*)this;
+ while (pParent->m_pParent) {
+ pParent = pParent->m_pParent;
+ }
+ return pParent;
+ }
+ case CFDE_XMLNode::Parent:
+ return m_pParent;
+ case CFDE_XMLNode::FirstSibling: {
+ CFDE_XMLNode* pItem = (CFDE_XMLNode*)this;
+ while (pItem->m_pPrior) {
+ pItem = pItem->m_pPrior;
+ }
+ return pItem == (CFDE_XMLNode*)this ? nullptr : pItem;
+ }
+ case CFDE_XMLNode::PriorSibling:
+ return m_pPrior;
+ case CFDE_XMLNode::NextSibling:
+ return m_pNext;
+ case CFDE_XMLNode::LastSibling: {
+ CFDE_XMLNode* pItem = (CFDE_XMLNode*)this;
+ while (pItem->m_pNext)
+ pItem = pItem->m_pNext;
+ return pItem == (CFDE_XMLNode*)this ? nullptr : pItem;
+ }
+ case CFDE_XMLNode::FirstNeighbor: {
+ CFDE_XMLNode* pParent = (CFDE_XMLNode*)this;
+ while (pParent->m_pParent)
+ pParent = pParent->m_pParent;
+ return pParent == (CFDE_XMLNode*)this ? nullptr : pParent;
+ }
+ case CFDE_XMLNode::PriorNeighbor: {
+ if (!m_pPrior)
+ return m_pParent;
+
+ CFDE_XMLNode* pItem = m_pPrior;
+ while (pItem->m_pChild) {
+ pItem = pItem->m_pChild;
+ while (pItem->m_pNext)
+ pItem = pItem->m_pNext;
+ }
+ return pItem;
+ }
+ case CFDE_XMLNode::NextNeighbor: {
+ if (m_pChild)
+ return m_pChild;
+ if (m_pNext)
+ return m_pNext;
+ CFDE_XMLNode* pItem = m_pParent;
+ while (pItem) {
+ if (pItem->m_pNext)
+ return pItem->m_pNext;
+ pItem = pItem->m_pParent;
+ }
+ return nullptr;
+ }
+ case CFDE_XMLNode::LastNeighbor: {
+ CFDE_XMLNode* pItem = (CFDE_XMLNode*)this;
+ while (pItem->m_pParent) {
+ pItem = pItem->m_pParent;
+ }
+ while (true) {
+ while (pItem->m_pNext)
+ pItem = pItem->m_pNext;
+ if (!pItem->m_pChild)
+ break;
+ pItem = pItem->m_pChild;
+ }
+ return pItem == (CFDE_XMLNode*)this ? nullptr : pItem;
+ }
+ case CFDE_XMLNode::FirstChild:
+ return m_pChild;
+ case CFDE_XMLNode::LastChild: {
+ if (!m_pChild)
+ return nullptr;
+
+ CFDE_XMLNode* pChild = m_pChild;
+ while (pChild->m_pNext)
+ pChild = pChild->m_pNext;
+ return pChild;
+ }
+ default:
+ break;
+ }
+ return nullptr;
+}
+
+int32_t CFDE_XMLNode::GetNodeLevel() const {
+ int32_t iLevel = 0;
+ const CFDE_XMLNode* pItem = m_pParent;
+ while (pItem) {
+ iLevel++;
+ pItem = pItem->m_pParent;
+ }
+ return iLevel;
+}
+
+bool CFDE_XMLNode::InsertNodeItem(CFDE_XMLNode::NodeItem eItem,
+ CFDE_XMLNode* pNode) {
+ switch (eItem) {
+ case CFDE_XMLNode::NextSibling: {
+ pNode->m_pParent = m_pParent;
+ pNode->m_pNext = m_pNext;
+ pNode->m_pPrior = this;
+ if (m_pNext) {
+ m_pNext->m_pPrior = pNode;
+ }
+ m_pNext = pNode;
+ return true;
+ }
+ case CFDE_XMLNode::PriorSibling: {
+ pNode->m_pParent = m_pParent;
+ pNode->m_pNext = this;
+ pNode->m_pPrior = m_pPrior;
+ if (m_pPrior) {
+ m_pPrior->m_pNext = pNode;
+ } else if (m_pParent) {
+ m_pParent->m_pChild = pNode;
+ }
+ m_pPrior = pNode;
+ return true;
+ }
+ default:
+ return false;
+ }
+}
+
+CFDE_XMLNode* CFDE_XMLNode::RemoveNodeItem(CFDE_XMLNode::NodeItem eItem) {
+ CFDE_XMLNode* pNode = nullptr;
+ switch (eItem) {
+ case CFDE_XMLNode::NextSibling:
+ if (m_pNext) {
+ pNode = m_pNext;
+ m_pNext = pNode->m_pNext;
+ if (m_pNext) {
+ m_pNext->m_pPrior = this;
+ }
+ pNode->m_pParent = nullptr;
+ pNode->m_pNext = nullptr;
+ pNode->m_pPrior = nullptr;
+ }
+ break;
+ default:
+ break;
+ }
+ return pNode;
+}
+
+std::unique_ptr<CFDE_XMLNode> CFDE_XMLNode::Clone() {
+ return nullptr;
+}
+
+void CFDE_XMLNode::SaveXMLNode(const CFX_RetainPtr<IFGAS_Stream>& pXMLStream) {
+ CFDE_XMLNode* pNode = (CFDE_XMLNode*)this;
+ switch (pNode->GetType()) {
+ case FDE_XMLNODE_Instruction: {
+ CFX_WideString ws;
+ CFDE_XMLInstruction* pInstruction = (CFDE_XMLInstruction*)pNode;
+ if (pInstruction->GetName().CompareNoCase(L"xml") == 0) {
+ ws = L"<?xml version=\"1.0\" encoding=\"";
+ uint16_t wCodePage = pXMLStream->GetCodePage();
+ if (wCodePage == FX_CODEPAGE_UTF16LE) {
+ ws += L"UTF-16";
+ } else if (wCodePage == FX_CODEPAGE_UTF16BE) {
+ ws += L"UTF-16be";
+ } else {
+ ws += L"UTF-8";
+ }
+ ws += L"\"?>";
+ pXMLStream->WriteString(ws.c_str(), ws.GetLength());
+ } else {
+ ws.Format(L"<?%s", pInstruction->GetName().c_str());
+ pXMLStream->WriteString(ws.c_str(), ws.GetLength());
+
+ for (auto it : pInstruction->GetAttributes()) {
+ CFX_WideString wsValue = it.second;
+ wsValue.Replace(L"&", L"&amp;");
+ wsValue.Replace(L"<", L"&lt;");
+ wsValue.Replace(L">", L"&gt;");
+ wsValue.Replace(L"\'", L"&apos;");
+ wsValue.Replace(L"\"", L"&quot;");
+
+ ws = L" ";
+ ws += it.first;
+ ws += L"=\"";
+ ws += wsValue;
+ ws += L"\"";
+ pXMLStream->WriteString(ws.c_str(), ws.GetLength());
+ }
+
+ for (auto target : pInstruction->GetTargetData()) {
+ ws = L" \"";
+ ws += target;
+ ws += L"\"";
+ pXMLStream->WriteString(ws.c_str(), ws.GetLength());
+ }
+ ws = L"?>";
+ pXMLStream->WriteString(ws.c_str(), ws.GetLength());
+ }
+ break;
+ }
+ case FDE_XMLNODE_Element: {
+ CFX_WideString ws;
+ ws = L"<";
+ ws += static_cast<CFDE_XMLElement*>(pNode)->GetName();
+ pXMLStream->WriteString(ws.c_str(), ws.GetLength());
+
+ for (auto it : static_cast<CFDE_XMLElement*>(pNode)->GetAttributes()) {
+ CFX_WideString wsValue = it.second;
+ wsValue.Replace(L"&", L"&amp;");
+ wsValue.Replace(L"<", L"&lt;");
+ wsValue.Replace(L">", L"&gt;");
+ wsValue.Replace(L"\'", L"&apos;");
+ wsValue.Replace(L"\"", L"&quot;");
+
+ ws = L" ";
+ ws += it.first;
+ ws += L"=\"";
+ ws += wsValue;
+ ws += L"\"";
+ pXMLStream->WriteString(ws.c_str(), ws.GetLength());
+ }
+ if (pNode->m_pChild) {
+ ws = L"\n>";
+ pXMLStream->WriteString(ws.c_str(), ws.GetLength());
+ CFDE_XMLNode* pChild = pNode->m_pChild;
+ while (pChild) {
+ pChild->SaveXMLNode(pXMLStream);
+ pChild = pChild->m_pNext;
+ }
+ ws = L"</";
+ ws += static_cast<CFDE_XMLElement*>(pNode)->GetName();
+ ws += L"\n>";
+ } else {
+ ws = L"\n/>";
+ }
+ pXMLStream->WriteString(ws.c_str(), ws.GetLength());
+ break;
+ }
+ case FDE_XMLNODE_Text: {
+ CFX_WideString ws = static_cast<CFDE_XMLText*>(pNode)->GetText();
+ ws.Replace(L"&", L"&amp;");
+ ws.Replace(L"<", L"&lt;");
+ ws.Replace(L">", L"&gt;");
+ ws.Replace(L"\'", L"&apos;");
+ ws.Replace(L"\"", L"&quot;");
+ pXMLStream->WriteString(ws.c_str(), ws.GetLength());
+ break;
+ }
+ case FDE_XMLNODE_CharData: {
+ CFX_WideString ws = L"<![CDATA[";
+ ws += static_cast<CFDE_XMLCharData*>(pNode)->GetText();
+ ws += L"]]>";
+ pXMLStream->WriteString(ws.c_str(), ws.GetLength());
+ break;
+ }
+ case FDE_XMLNODE_Unknown:
+ default:
+ break;
+ }
+}
diff --git a/chromium/third_party/pdfium/xfa/fde/xml/cfde_xmlnode.h b/chromium/third_party/pdfium/xfa/fde/xml/cfde_xmlnode.h
new file mode 100644
index 00000000000..3cfcd5c9806
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fde/xml/cfde_xmlnode.h
@@ -0,0 +1,75 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef XFA_FDE_XML_CFDE_XMLNODE_H_
+#define XFA_FDE_XML_CFDE_XMLNODE_H_
+
+#include <memory>
+
+#include "core/fxcrt/cfx_retain_ptr.h"
+#include "xfa/fgas/crt/ifgas_stream.h"
+
+enum FDE_XMLNODETYPE {
+ FDE_XMLNODE_Unknown = 0,
+ FDE_XMLNODE_Instruction,
+ FDE_XMLNODE_Element,
+ FDE_XMLNODE_Text,
+ FDE_XMLNODE_CharData,
+};
+
+struct FDE_XMLNODE {
+ int32_t iNodeNum;
+ FDE_XMLNODETYPE eNodeType;
+};
+
+class CFDE_XMLNode {
+ public:
+ enum NodeItem {
+ Root = 0,
+ Parent,
+ FirstSibling,
+ PriorSibling,
+ NextSibling,
+ LastSibling,
+ FirstNeighbor,
+ PriorNeighbor,
+ NextNeighbor,
+ LastNeighbor,
+ FirstChild,
+ LastChild
+ };
+
+ CFDE_XMLNode();
+ virtual ~CFDE_XMLNode();
+
+ virtual FDE_XMLNODETYPE GetType() const;
+ virtual std::unique_ptr<CFDE_XMLNode> Clone();
+
+ int32_t CountChildNodes() const;
+ CFDE_XMLNode* GetChildNode(int32_t index) const;
+ int32_t GetChildNodeIndex(CFDE_XMLNode* pNode) const;
+ int32_t InsertChildNode(CFDE_XMLNode* pNode, int32_t index = -1);
+ void RemoveChildNode(CFDE_XMLNode* pNode);
+ void DeleteChildren();
+
+ CFDE_XMLNode* GetPath(const wchar_t* pPath,
+ int32_t iLength = -1,
+ bool bQualifiedName = true) const;
+
+ int32_t GetNodeLevel() const;
+ CFDE_XMLNode* GetNodeItem(CFDE_XMLNode::NodeItem eItem) const;
+ bool InsertNodeItem(CFDE_XMLNode::NodeItem eItem, CFDE_XMLNode* pNode);
+ CFDE_XMLNode* RemoveNodeItem(CFDE_XMLNode::NodeItem eItem);
+
+ void SaveXMLNode(const CFX_RetainPtr<IFGAS_Stream>& pXMLStream);
+
+ CFDE_XMLNode* m_pParent;
+ CFDE_XMLNode* m_pChild;
+ CFDE_XMLNode* m_pPrior;
+ CFDE_XMLNode* m_pNext;
+};
+
+#endif // XFA_FDE_XML_CFDE_XMLNODE_H_
diff --git a/chromium/third_party/pdfium/xfa/fde/xml/cfde_xmlparser.cpp b/chromium/third_party/pdfium/xfa/fde/xml/cfde_xmlparser.cpp
new file mode 100644
index 00000000000..5b8993de1b6
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fde/xml/cfde_xmlparser.cpp
@@ -0,0 +1,170 @@
+// Copyright 2016 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "xfa/fde/xml/cfde_xmlparser.h"
+
+#include "core/fxcrt/fx_basic.h"
+#include "third_party/base/ptr_util.h"
+#include "xfa/fde/xml/cfde_xmlchardata.h"
+#include "xfa/fde/xml/cfde_xmlelement.h"
+#include "xfa/fde/xml/cfde_xmlinstruction.h"
+#include "xfa/fde/xml/cfde_xmlnode.h"
+#include "xfa/fde/xml/cfde_xmltext.h"
+
+CFDE_XMLParser::CFDE_XMLParser(CFDE_XMLNode* pParent,
+ const CFX_RetainPtr<IFGAS_Stream>& pStream)
+ : m_nElementStart(0),
+ m_dwCheckStatus(0),
+ m_dwCurrentCheckStatus(0),
+ m_pStream(pStream),
+ m_pParser(pdfium::MakeUnique<CFDE_XMLSyntaxParser>(m_pStream)),
+ m_pParent(pParent),
+ m_pChild(nullptr),
+ m_syntaxParserResult(FDE_XmlSyntaxResult::None) {
+ ASSERT(m_pParent && m_pStream);
+ m_NodeStack.push(m_pParent);
+}
+
+CFDE_XMLParser::~CFDE_XMLParser() {}
+
+int32_t CFDE_XMLParser::DoParser(IFX_Pause* pPause) {
+ if (m_syntaxParserResult == FDE_XmlSyntaxResult::Error)
+ return -1;
+ if (m_syntaxParserResult == FDE_XmlSyntaxResult::EndOfString)
+ return 100;
+
+ int32_t iCount = 0;
+ while (true) {
+ m_syntaxParserResult = m_pParser->DoSyntaxParse();
+ switch (m_syntaxParserResult) {
+ case FDE_XmlSyntaxResult::InstructionOpen:
+ break;
+ case FDE_XmlSyntaxResult::InstructionClose:
+ if (m_pChild) {
+ if (m_pChild->GetType() != FDE_XMLNODE_Instruction) {
+ m_syntaxParserResult = FDE_XmlSyntaxResult::Error;
+ break;
+ }
+ }
+ m_pChild = m_pParent;
+ break;
+ case FDE_XmlSyntaxResult::ElementOpen:
+ if (m_dwCheckStatus != 0x03 && m_NodeStack.size() == 2)
+ m_nElementStart = m_pParser->GetCurrentPos() - 1;
+ break;
+ case FDE_XmlSyntaxResult::ElementBreak:
+ break;
+ case FDE_XmlSyntaxResult::ElementClose:
+ if (m_pChild->GetType() != FDE_XMLNODE_Element) {
+ m_syntaxParserResult = FDE_XmlSyntaxResult::Error;
+ break;
+ }
+ m_ws1 = m_pParser->GetTagName();
+ m_ws2 = static_cast<CFDE_XMLElement*>(m_pChild)->GetName();
+ if (m_ws1.GetLength() > 0 && m_ws1 != m_ws2) {
+ m_syntaxParserResult = FDE_XmlSyntaxResult::Error;
+ break;
+ }
+ if (!m_NodeStack.empty())
+ m_NodeStack.pop();
+ if (m_NodeStack.empty()) {
+ m_syntaxParserResult = FDE_XmlSyntaxResult::Error;
+ break;
+ } else if (m_dwCurrentCheckStatus != 0 && m_NodeStack.size() == 2) {
+ m_nSize[m_dwCurrentCheckStatus - 1] =
+ m_pParser->GetCurrentBinaryPos() -
+ m_nStart[m_dwCurrentCheckStatus - 1];
+ m_dwCurrentCheckStatus = 0;
+ }
+ m_pParent = m_NodeStack.top();
+ m_pChild = m_pParent;
+ iCount++;
+ break;
+ case FDE_XmlSyntaxResult::TargetName:
+ m_ws1 = m_pParser->GetTargetName();
+ if (m_ws1 == L"originalXFAVersion" || m_ws1 == L"acrobat") {
+ m_pChild = new CFDE_XMLInstruction(m_ws1);
+ m_pParent->InsertChildNode(m_pChild);
+ } else {
+ m_pChild = nullptr;
+ }
+ m_ws1.clear();
+ break;
+ case FDE_XmlSyntaxResult::TagName:
+ m_ws1 = m_pParser->GetTagName();
+ m_pChild = new CFDE_XMLElement(m_ws1);
+ m_pParent->InsertChildNode(m_pChild);
+ m_NodeStack.push(m_pChild);
+ m_pParent = m_pChild;
+
+ if (m_dwCheckStatus != 0x03 && m_NodeStack.size() == 3) {
+ CFX_WideString wsTag =
+ static_cast<CFDE_XMLElement*>(m_pChild)->GetLocalTagName();
+ if (wsTag == L"template") {
+ m_dwCheckStatus |= 0x01;
+ m_dwCurrentCheckStatus = 0x01;
+ m_nStart[0] = m_pParser->GetCurrentBinaryPos() -
+ (m_pParser->GetCurrentPos() - m_nElementStart);
+ } else if (wsTag == L"datasets") {
+ m_dwCheckStatus |= 0x02;
+ m_dwCurrentCheckStatus = 0x02;
+ m_nStart[1] = m_pParser->GetCurrentBinaryPos() -
+ (m_pParser->GetCurrentPos() - m_nElementStart);
+ }
+ }
+ break;
+ case FDE_XmlSyntaxResult::AttriName:
+ m_ws1 = m_pParser->GetAttributeName();
+ break;
+ case FDE_XmlSyntaxResult::AttriValue:
+ if (m_pChild) {
+ m_ws2 = m_pParser->GetAttributeName();
+ if (m_pChild->GetType() == FDE_XMLNODE_Element)
+ static_cast<CFDE_XMLElement*>(m_pChild)->SetString(m_ws1, m_ws2);
+ }
+ m_ws1.clear();
+ break;
+ case FDE_XmlSyntaxResult::Text:
+ m_ws1 = m_pParser->GetTextData();
+ m_pChild = new CFDE_XMLText(m_ws1);
+ m_pParent->InsertChildNode(m_pChild);
+ m_pChild = m_pParent;
+ break;
+ case FDE_XmlSyntaxResult::CData:
+ m_ws1 = m_pParser->GetTextData();
+ m_pChild = new CFDE_XMLCharData(m_ws1);
+ m_pParent->InsertChildNode(m_pChild);
+ m_pChild = m_pParent;
+ break;
+ case FDE_XmlSyntaxResult::TargetData:
+ if (m_pChild) {
+ if (m_pChild->GetType() != FDE_XMLNODE_Instruction) {
+ m_syntaxParserResult = FDE_XmlSyntaxResult::Error;
+ break;
+ }
+ auto* instruction = static_cast<CFDE_XMLInstruction*>(m_pChild);
+ if (!m_ws1.IsEmpty())
+ instruction->AppendData(m_ws1);
+ instruction->AppendData(m_pParser->GetTargetData());
+ }
+ m_ws1.clear();
+ break;
+ default:
+ break;
+ }
+ if (m_syntaxParserResult == FDE_XmlSyntaxResult::Error ||
+ m_syntaxParserResult == FDE_XmlSyntaxResult::EndOfString) {
+ break;
+ }
+ if (pPause && iCount > 500 && pPause->NeedToPauseNow()) {
+ break;
+ }
+ }
+ return (m_syntaxParserResult == FDE_XmlSyntaxResult::Error ||
+ m_NodeStack.size() != 1)
+ ? -1
+ : m_pParser->GetStatus();
+}
diff --git a/chromium/third_party/pdfium/xfa/fde/xml/cfde_xmlparser.h b/chromium/third_party/pdfium/xfa/fde/xml/cfde_xmlparser.h
new file mode 100644
index 00000000000..42f590ce219
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fde/xml/cfde_xmlparser.h
@@ -0,0 +1,47 @@
+// Copyright 2016 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef XFA_FDE_XML_CFDE_XMLPARSER_H_
+#define XFA_FDE_XML_CFDE_XMLPARSER_H_
+
+#include <memory>
+#include <stack>
+
+#include "core/fxcrt/cfx_retain_ptr.h"
+#include "core/fxcrt/fx_string.h"
+#include "xfa/fde/xml/cfde_xmlsyntaxparser.h"
+
+class CFDE_XMLElement;
+class CFDE_XMLNode;
+class IFGAS_Stream;
+class IFX_Pause;
+
+class CFDE_XMLParser {
+ public:
+ CFDE_XMLParser(CFDE_XMLNode* pParent,
+ const CFX_RetainPtr<IFGAS_Stream>& pStream);
+ ~CFDE_XMLParser();
+
+ int32_t DoParser(IFX_Pause* pPause);
+
+ FX_FILESIZE m_nStart[2];
+ size_t m_nSize[2];
+ FX_FILESIZE m_nElementStart;
+ uint16_t m_dwCheckStatus;
+ uint16_t m_dwCurrentCheckStatus;
+
+ private:
+ CFX_RetainPtr<IFGAS_Stream> m_pStream;
+ std::unique_ptr<CFDE_XMLSyntaxParser> m_pParser;
+ CFDE_XMLNode* m_pParent;
+ CFDE_XMLNode* m_pChild;
+ std::stack<CFDE_XMLNode*> m_NodeStack;
+ CFX_WideString m_ws1;
+ CFX_WideString m_ws2;
+ FDE_XmlSyntaxResult m_syntaxParserResult;
+};
+
+#endif // XFA_FDE_XML_CFDE_XMLPARSER_H_
diff --git a/chromium/third_party/pdfium/xfa/fde/xml/cfde_xmlsyntaxparser.cpp b/chromium/third_party/pdfium/xfa/fde/xml/cfde_xmlsyntaxparser.cpp
new file mode 100644
index 00000000000..51507526c2f
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fde/xml/cfde_xmlsyntaxparser.cpp
@@ -0,0 +1,696 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "xfa/fde/xml/cfde_xmlsyntaxparser.h"
+
+#include <algorithm>
+
+#include "core/fxcrt/fx_ext.h"
+#include "core/fxcrt/fx_safe_types.h"
+
+namespace {
+
+const uint32_t kMaxCharRange = 0x10ffff;
+
+bool IsXMLWhiteSpace(wchar_t ch) {
+ return ch == L' ' || ch == 0x0A || ch == 0x0D || ch == 0x09;
+}
+
+struct FDE_XMLNAMECHAR {
+ uint16_t wStart;
+ uint16_t wEnd;
+ bool bStartChar;
+};
+
+const FDE_XMLNAMECHAR g_XMLNameChars[] = {
+ {L'-', L'.', false}, {L'0', L'9', false}, {L':', L':', false},
+ {L'A', L'Z', true}, {L'_', L'_', true}, {L'a', L'z', true},
+ {0xB7, 0xB7, false}, {0xC0, 0xD6, true}, {0xD8, 0xF6, true},
+ {0xF8, 0x02FF, true}, {0x0300, 0x036F, false}, {0x0370, 0x037D, true},
+ {0x037F, 0x1FFF, true}, {0x200C, 0x200D, true}, {0x203F, 0x2040, false},
+ {0x2070, 0x218F, true}, {0x2C00, 0x2FEF, true}, {0x3001, 0xD7FF, true},
+ {0xF900, 0xFDCF, true}, {0xFDF0, 0xFFFD, true},
+};
+
+bool IsXMLNameChar(wchar_t ch, bool bFirstChar) {
+ int32_t iStart = 0;
+ int32_t iEnd = FX_ArraySize(g_XMLNameChars) - 1;
+ while (iStart <= iEnd) {
+ int32_t iMid = (iStart + iEnd) / 2;
+ if (ch < g_XMLNameChars[iMid].wStart) {
+ iEnd = iMid - 1;
+ } else if (ch > g_XMLNameChars[iMid].wEnd) {
+ iStart = iMid + 1;
+ } else {
+ return bFirstChar ? g_XMLNameChars[iMid].bStartChar : true;
+ }
+ }
+ return false;
+}
+
+int32_t GetUTF8EncodeLength(const std::vector<wchar_t>& src,
+ FX_FILESIZE iSrcLen) {
+ uint32_t unicode = 0;
+ int32_t iDstNum = 0;
+ const wchar_t* pSrc = src.data();
+ while (iSrcLen-- > 0) {
+ unicode = *pSrc++;
+ int nbytes = 0;
+ if ((uint32_t)unicode < 0x80) {
+ nbytes = 1;
+ } else if ((uint32_t)unicode < 0x800) {
+ nbytes = 2;
+ } else if ((uint32_t)unicode < 0x10000) {
+ nbytes = 3;
+ } else if ((uint32_t)unicode < 0x200000) {
+ nbytes = 4;
+ } else if ((uint32_t)unicode < 0x4000000) {
+ nbytes = 5;
+ } else {
+ nbytes = 6;
+ }
+ iDstNum += nbytes;
+ }
+ return iDstNum;
+}
+
+} // namespace
+
+CFDE_XMLSyntaxParser::CFDE_XMLSyntaxParser(
+ const CFX_RetainPtr<IFGAS_Stream>& pStream)
+ : m_pStream(pStream),
+ m_iXMLPlaneSize(32 * 1024),
+ m_iCurrentPos(0),
+ m_iCurrentNodeNum(-1),
+ m_iLastNodeNum(-1),
+ m_iParsedBytes(0),
+ m_ParsedChars(0),
+ m_iBufferChars(0),
+ m_bEOS(false),
+ m_Start(0),
+ m_End(0),
+ m_iAllocStep(m_BlockBuffer.GetAllocStep()),
+ m_pCurrentBlock(nullptr),
+ m_iIndexInBlock(0),
+ m_iTextDataLength(0),
+ m_syntaxParserResult(FDE_XmlSyntaxResult::None),
+ m_syntaxParserState(FDE_XmlSyntaxState::Text),
+ m_wQuotationMark(0),
+ m_iEntityStart(-1) {
+ ASSERT(pStream);
+
+ m_CurNode.iNodeNum = -1;
+ m_CurNode.eNodeType = FDE_XMLNODE_Unknown;
+
+ m_iXMLPlaneSize = std::min(m_iXMLPlaneSize, m_pStream->GetLength());
+ m_iCurrentPos = m_pStream->GetBOMLength();
+
+ FX_SAFE_INT32 alloc_size_safe = m_iXMLPlaneSize;
+ alloc_size_safe += 1; // For NUL.
+ if (!alloc_size_safe.IsValid() || alloc_size_safe.ValueOrDie() <= 0) {
+ m_syntaxParserResult = FDE_XmlSyntaxResult::Error;
+ return;
+ }
+
+ m_Buffer.resize(pdfium::base::ValueOrDieForType<size_t>(alloc_size_safe));
+
+ m_BlockBuffer.InitBuffer();
+ std::tie(m_pCurrentBlock, m_iIndexInBlock) =
+ m_BlockBuffer.GetAvailableBlock();
+}
+
+CFDE_XMLSyntaxParser::~CFDE_XMLSyntaxParser() {}
+
+FDE_XmlSyntaxResult CFDE_XMLSyntaxParser::DoSyntaxParse() {
+ if (m_syntaxParserResult == FDE_XmlSyntaxResult::Error ||
+ m_syntaxParserResult == FDE_XmlSyntaxResult::EndOfString) {
+ return m_syntaxParserResult;
+ }
+
+ int32_t iStreamLength = m_pStream->GetLength();
+ int32_t iPos;
+
+ FDE_XmlSyntaxResult syntaxParserResult = FDE_XmlSyntaxResult::None;
+ while (true) {
+ if (m_Start >= m_End) {
+ if (m_bEOS || m_iCurrentPos >= iStreamLength) {
+ m_syntaxParserResult = FDE_XmlSyntaxResult::EndOfString;
+ return m_syntaxParserResult;
+ }
+ m_ParsedChars += m_End;
+ m_iParsedBytes = m_iCurrentPos;
+ if (m_pStream->GetPosition() != m_iCurrentPos) {
+ m_pStream->Seek(FX_STREAMSEEK_Begin, m_iCurrentPos);
+ }
+ m_iBufferChars =
+ m_pStream->ReadString(m_Buffer.data(), m_iXMLPlaneSize, m_bEOS);
+ iPos = m_pStream->GetPosition();
+ if (m_iBufferChars < 1) {
+ m_iCurrentPos = iStreamLength;
+ m_syntaxParserResult = FDE_XmlSyntaxResult::EndOfString;
+ return m_syntaxParserResult;
+ }
+ m_iCurrentPos = iPos;
+ m_Start = 0;
+ m_End = m_iBufferChars;
+ }
+
+ while (m_Start < m_End) {
+ wchar_t ch = m_Buffer[m_Start];
+ switch (m_syntaxParserState) {
+ case FDE_XmlSyntaxState::Text:
+ if (ch == L'<') {
+ if (!m_BlockBuffer.IsEmpty()) {
+ m_iTextDataLength = m_BlockBuffer.GetDataLength();
+ m_BlockBuffer.Reset(true);
+ std::tie(m_pCurrentBlock, m_iIndexInBlock) =
+ m_BlockBuffer.GetAvailableBlock();
+ m_iEntityStart = -1;
+ syntaxParserResult = FDE_XmlSyntaxResult::Text;
+ } else {
+ m_Start++;
+ m_syntaxParserState = FDE_XmlSyntaxState::Node;
+ }
+ } else {
+ ParseTextChar(ch);
+ }
+ break;
+ case FDE_XmlSyntaxState::Node:
+ if (ch == L'!') {
+ m_Start++;
+ m_syntaxParserState = FDE_XmlSyntaxState::SkipCommentOrDecl;
+ } else if (ch == L'/') {
+ m_Start++;
+ m_syntaxParserState = FDE_XmlSyntaxState::CloseElement;
+ } else if (ch == L'?') {
+ m_iLastNodeNum++;
+ m_iCurrentNodeNum = m_iLastNodeNum;
+ m_CurNode.iNodeNum = m_iLastNodeNum;
+ m_CurNode.eNodeType = FDE_XMLNODE_Instruction;
+ m_XMLNodeStack.push(m_CurNode);
+ m_Start++;
+ m_syntaxParserState = FDE_XmlSyntaxState::Target;
+ syntaxParserResult = FDE_XmlSyntaxResult::InstructionOpen;
+ } else {
+ m_iLastNodeNum++;
+ m_iCurrentNodeNum = m_iLastNodeNum;
+ m_CurNode.iNodeNum = m_iLastNodeNum;
+ m_CurNode.eNodeType = FDE_XMLNODE_Element;
+ m_XMLNodeStack.push(m_CurNode);
+ m_syntaxParserState = FDE_XmlSyntaxState::Tag;
+ syntaxParserResult = FDE_XmlSyntaxResult::ElementOpen;
+ }
+ break;
+ case FDE_XmlSyntaxState::Target:
+ case FDE_XmlSyntaxState::Tag:
+ if (!IsXMLNameChar(ch, m_BlockBuffer.IsEmpty())) {
+ if (m_BlockBuffer.IsEmpty()) {
+ m_syntaxParserResult = FDE_XmlSyntaxResult::Error;
+ return m_syntaxParserResult;
+ }
+
+ m_iTextDataLength = m_BlockBuffer.GetDataLength();
+ m_BlockBuffer.Reset(true);
+ std::tie(m_pCurrentBlock, m_iIndexInBlock) =
+ m_BlockBuffer.GetAvailableBlock();
+ if (m_syntaxParserState != FDE_XmlSyntaxState::Target)
+ syntaxParserResult = FDE_XmlSyntaxResult::TagName;
+ else
+ syntaxParserResult = FDE_XmlSyntaxResult::TargetName;
+
+ m_syntaxParserState = FDE_XmlSyntaxState::AttriName;
+ } else {
+ if (m_iIndexInBlock == m_iAllocStep) {
+ std::tie(m_pCurrentBlock, m_iIndexInBlock) =
+ m_BlockBuffer.GetAvailableBlock();
+ if (!m_pCurrentBlock) {
+ return FDE_XmlSyntaxResult::Error;
+ }
+ }
+ m_pCurrentBlock[m_iIndexInBlock++] = ch;
+ m_BlockBuffer.IncrementDataLength();
+ m_Start++;
+ }
+ break;
+ case FDE_XmlSyntaxState::AttriName:
+ if (m_BlockBuffer.IsEmpty() && IsXMLWhiteSpace(ch)) {
+ m_Start++;
+ break;
+ }
+ if (!IsXMLNameChar(ch, m_BlockBuffer.IsEmpty())) {
+ if (m_BlockBuffer.IsEmpty()) {
+ if (m_CurNode.eNodeType == FDE_XMLNODE_Element) {
+ if (ch == L'>' || ch == L'/') {
+ m_syntaxParserState = FDE_XmlSyntaxState::BreakElement;
+ break;
+ }
+ } else if (m_CurNode.eNodeType == FDE_XMLNODE_Instruction) {
+ if (ch == L'?') {
+ m_syntaxParserState = FDE_XmlSyntaxState::CloseInstruction;
+ m_Start++;
+ } else {
+ m_syntaxParserState = FDE_XmlSyntaxState::TargetData;
+ }
+ break;
+ }
+ m_syntaxParserResult = FDE_XmlSyntaxResult::Error;
+ return m_syntaxParserResult;
+ } else {
+ if (m_CurNode.eNodeType == FDE_XMLNODE_Instruction) {
+ if (ch != '=' && !IsXMLWhiteSpace(ch)) {
+ m_syntaxParserState = FDE_XmlSyntaxState::TargetData;
+ break;
+ }
+ }
+ m_iTextDataLength = m_BlockBuffer.GetDataLength();
+ m_BlockBuffer.Reset(true);
+ std::tie(m_pCurrentBlock, m_iIndexInBlock) =
+ m_BlockBuffer.GetAvailableBlock();
+ m_syntaxParserState = FDE_XmlSyntaxState::AttriEqualSign;
+ syntaxParserResult = FDE_XmlSyntaxResult::AttriName;
+ }
+ } else {
+ if (m_iIndexInBlock == m_iAllocStep) {
+ std::tie(m_pCurrentBlock, m_iIndexInBlock) =
+ m_BlockBuffer.GetAvailableBlock();
+ if (!m_pCurrentBlock) {
+ return FDE_XmlSyntaxResult::Error;
+ }
+ }
+ m_pCurrentBlock[m_iIndexInBlock++] = ch;
+ m_BlockBuffer.IncrementDataLength();
+ m_Start++;
+ }
+ break;
+ case FDE_XmlSyntaxState::AttriEqualSign:
+ if (IsXMLWhiteSpace(ch)) {
+ m_Start++;
+ break;
+ }
+ if (ch != L'=') {
+ if (m_CurNode.eNodeType == FDE_XMLNODE_Instruction) {
+ m_syntaxParserState = FDE_XmlSyntaxState::TargetData;
+ break;
+ }
+ m_syntaxParserResult = FDE_XmlSyntaxResult::Error;
+ return m_syntaxParserResult;
+ } else {
+ m_syntaxParserState = FDE_XmlSyntaxState::AttriQuotation;
+ m_Start++;
+ }
+ break;
+ case FDE_XmlSyntaxState::AttriQuotation:
+ if (IsXMLWhiteSpace(ch)) {
+ m_Start++;
+ break;
+ }
+ if (ch != L'\"' && ch != L'\'') {
+ m_syntaxParserResult = FDE_XmlSyntaxResult::Error;
+ return m_syntaxParserResult;
+ } else {
+ m_wQuotationMark = ch;
+ m_syntaxParserState = FDE_XmlSyntaxState::AttriValue;
+ m_Start++;
+ }
+ break;
+ case FDE_XmlSyntaxState::AttriValue:
+ if (ch == m_wQuotationMark) {
+ if (m_iEntityStart > -1) {
+ m_syntaxParserResult = FDE_XmlSyntaxResult::Error;
+ return m_syntaxParserResult;
+ }
+ m_iTextDataLength = m_BlockBuffer.GetDataLength();
+ m_wQuotationMark = 0;
+ m_BlockBuffer.Reset(true);
+ std::tie(m_pCurrentBlock, m_iIndexInBlock) =
+ m_BlockBuffer.GetAvailableBlock();
+ m_Start++;
+ m_syntaxParserState = FDE_XmlSyntaxState::AttriName;
+ syntaxParserResult = FDE_XmlSyntaxResult::AttriValue;
+ } else {
+ ParseTextChar(ch);
+ }
+ break;
+ case FDE_XmlSyntaxState::CloseInstruction:
+ if (ch != L'>') {
+ if (m_iIndexInBlock == m_iAllocStep) {
+ std::tie(m_pCurrentBlock, m_iIndexInBlock) =
+ m_BlockBuffer.GetAvailableBlock();
+ if (!m_pCurrentBlock) {
+ return FDE_XmlSyntaxResult::Error;
+ }
+ }
+ m_pCurrentBlock[m_iIndexInBlock++] = ch;
+ m_BlockBuffer.IncrementDataLength();
+ m_syntaxParserState = FDE_XmlSyntaxState::TargetData;
+ } else if (!m_BlockBuffer.IsEmpty()) {
+ m_iTextDataLength = m_BlockBuffer.GetDataLength();
+ m_BlockBuffer.Reset(true);
+ std::tie(m_pCurrentBlock, m_iIndexInBlock) =
+ m_BlockBuffer.GetAvailableBlock();
+ syntaxParserResult = FDE_XmlSyntaxResult::TargetData;
+ } else {
+ m_Start++;
+ if (m_XMLNodeStack.empty()) {
+ m_syntaxParserResult = FDE_XmlSyntaxResult::Error;
+ return m_syntaxParserResult;
+ }
+ m_XMLNodeStack.pop();
+ if (!m_XMLNodeStack.empty()) {
+ m_CurNode = m_XMLNodeStack.top();
+ } else {
+ m_CurNode.iNodeNum = -1;
+ m_CurNode.eNodeType = FDE_XMLNODE_Unknown;
+ }
+ m_iCurrentNodeNum = m_CurNode.iNodeNum;
+ m_BlockBuffer.Reset(true);
+ std::tie(m_pCurrentBlock, m_iIndexInBlock) =
+ m_BlockBuffer.GetAvailableBlock();
+ m_syntaxParserState = FDE_XmlSyntaxState::Text;
+ syntaxParserResult = FDE_XmlSyntaxResult::InstructionClose;
+ }
+ break;
+ case FDE_XmlSyntaxState::BreakElement:
+ if (ch == L'>') {
+ m_syntaxParserState = FDE_XmlSyntaxState::Text;
+ syntaxParserResult = FDE_XmlSyntaxResult::ElementBreak;
+ } else if (ch == L'/') {
+ m_syntaxParserState = FDE_XmlSyntaxState::CloseElement;
+ } else {
+ m_syntaxParserResult = FDE_XmlSyntaxResult::Error;
+ return m_syntaxParserResult;
+ }
+ m_Start++;
+ break;
+ case FDE_XmlSyntaxState::CloseElement:
+ if (!IsXMLNameChar(ch, m_BlockBuffer.IsEmpty())) {
+ if (ch == L'>') {
+ if (m_XMLNodeStack.empty()) {
+ m_syntaxParserResult = FDE_XmlSyntaxResult::Error;
+ return m_syntaxParserResult;
+ }
+ m_XMLNodeStack.pop();
+ if (!m_XMLNodeStack.empty()) {
+ m_CurNode = m_XMLNodeStack.top();
+ } else {
+ m_CurNode.iNodeNum = -1;
+ m_CurNode.eNodeType = FDE_XMLNODE_Unknown;
+ }
+ m_iCurrentNodeNum = m_CurNode.iNodeNum;
+ m_iTextDataLength = m_BlockBuffer.GetDataLength();
+ m_BlockBuffer.Reset(true);
+ std::tie(m_pCurrentBlock, m_iIndexInBlock) =
+ m_BlockBuffer.GetAvailableBlock();
+ m_syntaxParserState = FDE_XmlSyntaxState::Text;
+ syntaxParserResult = FDE_XmlSyntaxResult::ElementClose;
+ } else if (!IsXMLWhiteSpace(ch)) {
+ m_syntaxParserResult = FDE_XmlSyntaxResult::Error;
+ return m_syntaxParserResult;
+ }
+ } else {
+ if (m_iIndexInBlock == m_iAllocStep) {
+ std::tie(m_pCurrentBlock, m_iIndexInBlock) =
+ m_BlockBuffer.GetAvailableBlock();
+ if (!m_pCurrentBlock) {
+ return FDE_XmlSyntaxResult::Error;
+ }
+ }
+ m_pCurrentBlock[m_iIndexInBlock++] = ch;
+ m_BlockBuffer.IncrementDataLength();
+ }
+ m_Start++;
+ break;
+ case FDE_XmlSyntaxState::SkipCommentOrDecl:
+ if (FXSYS_wcsnicmp(m_Buffer.data() + m_Start, L"--", 2) == 0) {
+ m_Start += 2;
+ m_syntaxParserState = FDE_XmlSyntaxState::SkipComment;
+ } else if (FXSYS_wcsnicmp(m_Buffer.data() + m_Start, L"[CDATA[", 7) ==
+ 0) {
+ m_Start += 7;
+ m_syntaxParserState = FDE_XmlSyntaxState::SkipCData;
+ } else {
+ m_syntaxParserState = FDE_XmlSyntaxState::SkipDeclNode;
+ m_SkipChar = L'>';
+ m_SkipStack.push(L'>');
+ }
+ break;
+ case FDE_XmlSyntaxState::SkipCData: {
+ if (FXSYS_wcsnicmp(m_Buffer.data() + m_Start, L"]]>", 3) == 0) {
+ m_Start += 3;
+ syntaxParserResult = FDE_XmlSyntaxResult::CData;
+ m_iTextDataLength = m_BlockBuffer.GetDataLength();
+ m_BlockBuffer.Reset(true);
+ std::tie(m_pCurrentBlock, m_iIndexInBlock) =
+ m_BlockBuffer.GetAvailableBlock();
+ m_syntaxParserState = FDE_XmlSyntaxState::Text;
+ } else {
+ if (m_iIndexInBlock == m_iAllocStep) {
+ std::tie(m_pCurrentBlock, m_iIndexInBlock) =
+ m_BlockBuffer.GetAvailableBlock();
+ if (!m_pCurrentBlock)
+ return FDE_XmlSyntaxResult::Error;
+ }
+ m_pCurrentBlock[m_iIndexInBlock++] = ch;
+ m_BlockBuffer.IncrementDataLength();
+ m_Start++;
+ }
+ break;
+ }
+ case FDE_XmlSyntaxState::SkipDeclNode:
+ if (m_SkipChar == L'\'' || m_SkipChar == L'\"') {
+ m_Start++;
+ if (ch != m_SkipChar)
+ break;
+
+ m_SkipStack.pop();
+ if (m_SkipStack.empty())
+ m_syntaxParserState = FDE_XmlSyntaxState::Text;
+ else
+ m_SkipChar = m_SkipStack.top();
+ } else {
+ switch (ch) {
+ case L'<':
+ m_SkipChar = L'>';
+ m_SkipStack.push(L'>');
+ break;
+ case L'[':
+ m_SkipChar = L']';
+ m_SkipStack.push(L']');
+ break;
+ case L'(':
+ m_SkipChar = L')';
+ m_SkipStack.push(L')');
+ break;
+ case L'\'':
+ m_SkipChar = L'\'';
+ m_SkipStack.push(L'\'');
+ break;
+ case L'\"':
+ m_SkipChar = L'\"';
+ m_SkipStack.push(L'\"');
+ break;
+ default:
+ if (ch == m_SkipChar) {
+ m_SkipStack.pop();
+ if (m_SkipStack.empty()) {
+ if (m_BlockBuffer.GetDataLength() >= 9)
+ (void)m_BlockBuffer.GetTextData(0, 7);
+
+ m_iTextDataLength = m_BlockBuffer.GetDataLength();
+ m_BlockBuffer.Reset(true);
+ std::tie(m_pCurrentBlock, m_iIndexInBlock) =
+ m_BlockBuffer.GetAvailableBlock();
+ m_syntaxParserState = FDE_XmlSyntaxState::Text;
+ } else {
+ m_SkipChar = m_SkipStack.top();
+ }
+ }
+ break;
+ }
+ if (!m_SkipStack.empty()) {
+ if (m_iIndexInBlock == m_iAllocStep) {
+ std::tie(m_pCurrentBlock, m_iIndexInBlock) =
+ m_BlockBuffer.GetAvailableBlock();
+ if (!m_pCurrentBlock) {
+ return FDE_XmlSyntaxResult::Error;
+ }
+ }
+ m_pCurrentBlock[m_iIndexInBlock++] = ch;
+ m_BlockBuffer.IncrementDataLength();
+ }
+ m_Start++;
+ }
+ break;
+ case FDE_XmlSyntaxState::SkipComment:
+ if (FXSYS_wcsnicmp(m_Buffer.data() + m_Start, L"-->", 3) == 0) {
+ m_Start += 2;
+ m_syntaxParserState = FDE_XmlSyntaxState::Text;
+ }
+
+ m_Start++;
+ break;
+ case FDE_XmlSyntaxState::TargetData:
+ if (IsXMLWhiteSpace(ch)) {
+ if (m_BlockBuffer.IsEmpty()) {
+ m_Start++;
+ break;
+ } else if (m_wQuotationMark == 0) {
+ m_iTextDataLength = m_BlockBuffer.GetDataLength();
+ m_wQuotationMark = 0;
+ m_BlockBuffer.Reset(true);
+ std::tie(m_pCurrentBlock, m_iIndexInBlock) =
+ m_BlockBuffer.GetAvailableBlock();
+ m_Start++;
+ syntaxParserResult = FDE_XmlSyntaxResult::TargetData;
+ break;
+ }
+ }
+ if (ch == '?') {
+ m_syntaxParserState = FDE_XmlSyntaxState::CloseInstruction;
+ m_Start++;
+ } else if (ch == '\"') {
+ if (m_wQuotationMark == 0) {
+ m_wQuotationMark = ch;
+ m_Start++;
+ } else if (ch == m_wQuotationMark) {
+ m_iTextDataLength = m_BlockBuffer.GetDataLength();
+ m_wQuotationMark = 0;
+ m_BlockBuffer.Reset(true);
+ std::tie(m_pCurrentBlock, m_iIndexInBlock) =
+ m_BlockBuffer.GetAvailableBlock();
+ m_Start++;
+ syntaxParserResult = FDE_XmlSyntaxResult::TargetData;
+ } else {
+ m_syntaxParserResult = FDE_XmlSyntaxResult::Error;
+ return m_syntaxParserResult;
+ }
+ } else {
+ if (m_iIndexInBlock == m_iAllocStep) {
+ std::tie(m_pCurrentBlock, m_iIndexInBlock) =
+ m_BlockBuffer.GetAvailableBlock();
+ if (!m_pCurrentBlock) {
+ return FDE_XmlSyntaxResult::Error;
+ }
+ }
+ m_pCurrentBlock[m_iIndexInBlock++] = ch;
+ m_BlockBuffer.IncrementDataLength();
+ m_Start++;
+ }
+ break;
+ default:
+ break;
+ }
+ if (syntaxParserResult != FDE_XmlSyntaxResult::None)
+ return syntaxParserResult;
+ }
+ }
+ return FDE_XmlSyntaxResult::Text;
+}
+
+int32_t CFDE_XMLSyntaxParser::GetStatus() const {
+ if (!m_pStream)
+ return -1;
+
+ int32_t iStreamLength = m_pStream->GetLength();
+ if (iStreamLength < 1)
+ return 100;
+
+ if (m_syntaxParserResult == FDE_XmlSyntaxResult::Error)
+ return -1;
+
+ if (m_syntaxParserResult == FDE_XmlSyntaxResult::EndOfString)
+ return 100;
+ return m_iParsedBytes * 100 / iStreamLength;
+}
+
+FX_FILESIZE CFDE_XMLSyntaxParser::GetCurrentBinaryPos() const {
+ if (!m_pStream)
+ return 0;
+
+ int32_t nDstLen = GetUTF8EncodeLength(m_Buffer, m_Start);
+ return m_iParsedBytes + nDstLen;
+}
+
+void CFDE_XMLSyntaxParser::ParseTextChar(wchar_t character) {
+ if (m_iIndexInBlock == m_iAllocStep) {
+ std::tie(m_pCurrentBlock, m_iIndexInBlock) =
+ m_BlockBuffer.GetAvailableBlock();
+ if (!m_pCurrentBlock)
+ return;
+ }
+
+ m_pCurrentBlock[m_iIndexInBlock++] = character;
+ m_BlockBuffer.IncrementDataLength();
+ if (m_iEntityStart > -1 && character == L';') {
+ CFX_WideString csEntity = m_BlockBuffer.GetTextData(
+ m_iEntityStart + 1,
+ m_BlockBuffer.GetDataLength() - 1 - m_iEntityStart - 1);
+ int32_t iLen = csEntity.GetLength();
+ if (iLen > 0) {
+ if (csEntity[0] == L'#') {
+ uint32_t ch = 0;
+ wchar_t w;
+ if (iLen > 1 && csEntity[1] == L'x') {
+ for (int32_t i = 2; i < iLen; i++) {
+ w = csEntity[i];
+ if (w >= L'0' && w <= L'9') {
+ ch = (ch << 4) + w - L'0';
+ } else if (w >= L'A' && w <= L'F') {
+ ch = (ch << 4) + w - 55;
+ } else if (w >= L'a' && w <= L'f') {
+ ch = (ch << 4) + w - 87;
+ } else {
+ break;
+ }
+ }
+ } else {
+ for (int32_t i = 1; i < iLen; i++) {
+ w = csEntity[i];
+ if (w < L'0' || w > L'9')
+ break;
+ ch = ch * 10 + w - L'0';
+ }
+ }
+ if (ch > kMaxCharRange)
+ ch = ' ';
+
+ character = static_cast<wchar_t>(ch);
+ if (character != 0) {
+ m_BlockBuffer.SetTextChar(m_iEntityStart, character);
+ m_iEntityStart++;
+ }
+ } else {
+ if (csEntity.Compare(L"amp") == 0) {
+ m_BlockBuffer.SetTextChar(m_iEntityStart, L'&');
+ m_iEntityStart++;
+ } else if (csEntity.Compare(L"lt") == 0) {
+ m_BlockBuffer.SetTextChar(m_iEntityStart, L'<');
+ m_iEntityStart++;
+ } else if (csEntity.Compare(L"gt") == 0) {
+ m_BlockBuffer.SetTextChar(m_iEntityStart, L'>');
+ m_iEntityStart++;
+ } else if (csEntity.Compare(L"apos") == 0) {
+ m_BlockBuffer.SetTextChar(m_iEntityStart, L'\'');
+ m_iEntityStart++;
+ } else if (csEntity.Compare(L"quot") == 0) {
+ m_BlockBuffer.SetTextChar(m_iEntityStart, L'\"');
+ m_iEntityStart++;
+ }
+ }
+ }
+ if (m_iEntityStart >= 0 &&
+ m_BlockBuffer.GetDataLength() > static_cast<size_t>(m_iEntityStart)) {
+ m_BlockBuffer.DeleteTextChars(m_BlockBuffer.GetDataLength() -
+ m_iEntityStart);
+ }
+ std::tie(m_pCurrentBlock, m_iIndexInBlock) =
+ m_BlockBuffer.GetAvailableBlock();
+ m_iEntityStart = -1;
+ } else if (m_iEntityStart < 0 && character == L'&') {
+ m_iEntityStart = m_BlockBuffer.GetDataLength() - 1;
+ }
+ m_Start++;
+}
diff --git a/chromium/third_party/pdfium/xfa/fde/xml/cfde_xmlsyntaxparser.h b/chromium/third_party/pdfium/xfa/fde/xml/cfde_xmlsyntaxparser.h
new file mode 100644
index 00000000000..9f1274fa839
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fde/xml/cfde_xmlsyntaxparser.h
@@ -0,0 +1,127 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef XFA_FDE_XML_CFDE_XMLSYNTAXPARSER_H_
+#define XFA_FDE_XML_CFDE_XMLSYNTAXPARSER_H_
+
+#include <stack>
+#include <vector>
+
+#include "core/fxcrt/cfx_blockbuffer.h"
+#include "core/fxcrt/cfx_retain_ptr.h"
+#include "core/fxcrt/fx_string.h"
+#include "xfa/fde/xml/cfde_xmlnode.h"
+#include "xfa/fgas/crt/ifgas_stream.h"
+
+enum class FDE_XmlSyntaxResult {
+ None,
+ InstructionOpen,
+ InstructionClose,
+ ElementOpen,
+ ElementBreak,
+ ElementClose,
+ TargetName,
+ TagName,
+ AttriName,
+ AttriValue,
+ Text,
+ CData,
+ TargetData,
+ Error,
+ EndOfString
+};
+
+class CFDE_XMLSyntaxParser {
+ public:
+ explicit CFDE_XMLSyntaxParser(const CFX_RetainPtr<IFGAS_Stream>& pStream);
+ ~CFDE_XMLSyntaxParser();
+
+ FDE_XmlSyntaxResult DoSyntaxParse();
+
+ int32_t GetStatus() const;
+ FX_FILESIZE GetCurrentPos() const { return m_ParsedChars + m_Start; }
+ FX_FILESIZE GetCurrentBinaryPos() const;
+ int32_t GetCurrentNodeNumber() const { return m_iCurrentNodeNum; }
+ int32_t GetLastNodeNumber() const { return m_iLastNodeNum; }
+
+ CFX_WideString GetTargetName() const {
+ return m_BlockBuffer.GetTextData(0, m_iTextDataLength);
+ }
+
+ CFX_WideString GetTagName() const {
+ return m_BlockBuffer.GetTextData(0, m_iTextDataLength);
+ }
+
+ CFX_WideString GetAttributeName() const {
+ return m_BlockBuffer.GetTextData(0, m_iTextDataLength);
+ }
+
+ CFX_WideString GetAttributeValue() const {
+ return m_BlockBuffer.GetTextData(0, m_iTextDataLength);
+ }
+
+ CFX_WideString GetTextData() const {
+ return m_BlockBuffer.GetTextData(0, m_iTextDataLength);
+ }
+
+ CFX_WideString GetTargetData() const {
+ return m_BlockBuffer.GetTextData(0, m_iTextDataLength);
+ }
+
+ protected:
+ enum class FDE_XmlSyntaxState {
+ Text,
+ Node,
+ Target,
+ Tag,
+ AttriName,
+ AttriEqualSign,
+ AttriQuotation,
+ AttriValue,
+ Entity,
+ EntityDecimal,
+ EntityHex,
+ CloseInstruction,
+ BreakElement,
+ CloseElement,
+ SkipDeclNode,
+ DeclCharData,
+ SkipComment,
+ SkipCommentOrDecl,
+ SkipCData,
+ TargetData
+ };
+
+ void ParseTextChar(wchar_t ch);
+
+ CFX_RetainPtr<IFGAS_Stream> m_pStream;
+ int32_t m_iXMLPlaneSize;
+ int32_t m_iCurrentPos;
+ int32_t m_iCurrentNodeNum;
+ int32_t m_iLastNodeNum;
+ int32_t m_iParsedBytes;
+ FX_FILESIZE m_ParsedChars;
+ std::vector<wchar_t> m_Buffer;
+ int32_t m_iBufferChars;
+ bool m_bEOS;
+ FX_FILESIZE m_Start; // Start position in m_Buffer
+ FX_FILESIZE m_End; // End position in m_Buffer
+ FDE_XMLNODE m_CurNode;
+ std::stack<FDE_XMLNODE> m_XMLNodeStack;
+ CFX_BlockBuffer m_BlockBuffer;
+ int32_t m_iAllocStep;
+ wchar_t* m_pCurrentBlock; // Pointer into CFX_BlockBuffer
+ int32_t m_iIndexInBlock;
+ int32_t m_iTextDataLength;
+ FDE_XmlSyntaxResult m_syntaxParserResult;
+ FDE_XmlSyntaxState m_syntaxParserState;
+ wchar_t m_wQuotationMark;
+ int32_t m_iEntityStart;
+ std::stack<wchar_t> m_SkipStack;
+ wchar_t m_SkipChar;
+};
+
+#endif // XFA_FDE_XML_CFDE_XMLSYNTAXPARSER_H_
diff --git a/chromium/third_party/pdfium/xfa/fde/xml/cfde_xmlsyntaxparser_unittest.cpp b/chromium/third_party/pdfium/xfa/fde/xml/cfde_xmlsyntaxparser_unittest.cpp
new file mode 100644
index 00000000000..a45bb1276a7
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fde/xml/cfde_xmlsyntaxparser_unittest.cpp
@@ -0,0 +1,527 @@
+// Copyright 2016 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "xfa/fde/xml/cfde_xmlsyntaxparser.h"
+
+#include <memory>
+
+#include "testing/gtest/include/gtest/gtest.h"
+#include "testing/test_support.h"
+#include "xfa/fgas/crt/fgas_codepage.h"
+#include "xfa/fgas/crt/ifgas_stream.h"
+
+class CFDE_XMLSyntaxParserTest : public pdfium::FPDF_Test {};
+
+TEST_F(CFDE_XMLSyntaxParserTest, CData) {
+ const char* input =
+ "<script contentType=\"application/x-javascript\">\n"
+ " <![CDATA[\n"
+ " if (a[1] < 3)\n"
+ " app.alert(\"Tclams\");\n"
+ " ]]>\n"
+ "</script>";
+
+ const wchar_t* cdata =
+ L"\n"
+ L" if (a[1] < 3)\n"
+ L" app.alert(\"Tclams\");\n"
+ L" ";
+
+ CFX_RetainPtr<IFGAS_Stream> stream =
+ IFGAS_Stream::CreateReadStream(IFX_MemoryStream::Create(
+ reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)));
+ stream->SetCodePage(FX_CODEPAGE_UTF8);
+
+ CFDE_XMLSyntaxParser parser(stream);
+ ASSERT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
+ ASSERT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
+ ASSERT_EQ(L"script", parser.GetTagName());
+
+ ASSERT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
+ ASSERT_EQ(L"contentType", parser.GetAttributeName());
+ ASSERT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
+ ASSERT_EQ(L"application/x-javascript", parser.GetAttributeValue());
+
+ ASSERT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
+ ASSERT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
+ ASSERT_EQ(L"\n ", parser.GetTextData());
+
+ ASSERT_EQ(FDE_XmlSyntaxResult::CData, parser.DoSyntaxParse());
+ ASSERT_EQ(cdata, parser.GetTextData());
+
+ ASSERT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
+ ASSERT_EQ(L"\n", parser.GetTextData());
+
+ ASSERT_EQ(FDE_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse());
+ ASSERT_EQ(L"script", parser.GetTagName());
+
+ ASSERT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
+}
+
+TEST_F(CFDE_XMLSyntaxParserTest, CDataWithInnerScript) {
+ const char* input =
+ "<script contentType=\"application/x-javascript\">\n"
+ " <![CDATA[\n"
+ " if (a[1] < 3)\n"
+ " app.alert(\"Tclams\");\n"
+ " </script>\n"
+ " ]]>\n"
+ "</script>";
+
+ const wchar_t* cdata =
+ L"\n"
+ L" if (a[1] < 3)\n"
+ L" app.alert(\"Tclams\");\n"
+ L" </script>\n"
+ L" ";
+
+ CFX_RetainPtr<IFGAS_Stream> stream =
+ IFGAS_Stream::CreateReadStream(IFX_MemoryStream::Create(
+ reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)));
+ stream->SetCodePage(FX_CODEPAGE_UTF8);
+
+ CFDE_XMLSyntaxParser parser(stream);
+ ASSERT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
+ ASSERT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
+ ASSERT_EQ(L"script", parser.GetTagName());
+
+ ASSERT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
+ ASSERT_EQ(L"contentType", parser.GetAttributeName());
+ ASSERT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
+ ASSERT_EQ(L"application/x-javascript", parser.GetAttributeValue());
+
+ ASSERT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
+ ASSERT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
+ ASSERT_EQ(L"\n ", parser.GetTextData());
+
+ ASSERT_EQ(FDE_XmlSyntaxResult::CData, parser.DoSyntaxParse());
+ ASSERT_EQ(cdata, parser.GetTextData());
+
+ ASSERT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
+ ASSERT_EQ(L"\n", parser.GetTextData());
+
+ ASSERT_EQ(FDE_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse());
+ ASSERT_EQ(L"script", parser.GetTagName());
+
+ ASSERT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
+}
+
+TEST_F(CFDE_XMLSyntaxParserTest, ArrowBangArrow) {
+ const char* input =
+ "<script contentType=\"application/x-javascript\">\n"
+ " <!>\n"
+ "</script>";
+
+ CFX_RetainPtr<IFGAS_Stream> stream =
+ IFGAS_Stream::CreateReadStream(IFX_MemoryStream::Create(
+ reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)));
+ stream->SetCodePage(FX_CODEPAGE_UTF8);
+
+ CFDE_XMLSyntaxParser parser(stream);
+ ASSERT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
+ ASSERT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
+
+ ASSERT_EQ(L"script", parser.GetTagName());
+
+ ASSERT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
+ ASSERT_EQ(L"contentType", parser.GetAttributeName());
+ ASSERT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
+ ASSERT_EQ(L"application/x-javascript", parser.GetAttributeValue());
+
+ ASSERT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
+ ASSERT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
+ ASSERT_EQ(L"\n ", parser.GetTextData());
+
+ ASSERT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
+ ASSERT_EQ(L"\n", parser.GetTextData());
+
+ ASSERT_EQ(FDE_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse());
+ ASSERT_EQ(L"script", parser.GetTagName());
+
+ ASSERT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
+}
+
+TEST_F(CFDE_XMLSyntaxParserTest, ArrowBangBracketArrow) {
+ const char* input =
+ "<script contentType=\"application/x-javascript\">\n"
+ " <![>\n"
+ "</script>";
+
+ CFX_RetainPtr<IFGAS_Stream> stream =
+ IFGAS_Stream::CreateReadStream(IFX_MemoryStream::Create(
+ reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)));
+ stream->SetCodePage(FX_CODEPAGE_UTF8);
+
+ CFDE_XMLSyntaxParser parser(stream);
+ ASSERT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
+ ASSERT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
+ ASSERT_EQ(L"script", parser.GetTagName());
+
+ ASSERT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
+ ASSERT_EQ(L"contentType", parser.GetAttributeName());
+ ASSERT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
+ ASSERT_EQ(L"application/x-javascript", parser.GetAttributeValue());
+
+ ASSERT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
+ ASSERT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
+ ASSERT_EQ(L"\n ", parser.GetTextData());
+
+ // Parser walks to end of input.
+
+ ASSERT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
+}
+
+TEST_F(CFDE_XMLSyntaxParserTest, IncompleteCData) {
+ const char* input =
+ "<script contentType=\"application/x-javascript\">\n"
+ " <![CDATA>\n"
+ "</script>";
+
+ CFX_RetainPtr<IFGAS_Stream> stream =
+ IFGAS_Stream::CreateReadStream(IFX_MemoryStream::Create(
+ reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)));
+ stream->SetCodePage(FX_CODEPAGE_UTF8);
+
+ CFDE_XMLSyntaxParser parser(stream);
+ ASSERT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
+ ASSERT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
+ ASSERT_EQ(L"script", parser.GetTagName());
+
+ ASSERT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
+ ASSERT_EQ(L"contentType", parser.GetAttributeName());
+ ASSERT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
+ ASSERT_EQ(L"application/x-javascript", parser.GetAttributeValue());
+
+ ASSERT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
+ ASSERT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
+ ASSERT_EQ(L"\n ", parser.GetTextData());
+
+ // Parser walks to end of input.
+
+ ASSERT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
+}
+
+TEST_F(CFDE_XMLSyntaxParserTest, UnClosedCData) {
+ const char* input =
+ "<script contentType=\"application/x-javascript\">\n"
+ " <![CDATA[\n"
+ "</script>";
+
+ CFX_RetainPtr<IFGAS_Stream> stream =
+ IFGAS_Stream::CreateReadStream(IFX_MemoryStream::Create(
+ reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)));
+ stream->SetCodePage(FX_CODEPAGE_UTF8);
+
+ CFDE_XMLSyntaxParser parser(stream);
+ ASSERT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
+ ASSERT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
+ ASSERT_EQ(L"script", parser.GetTagName());
+
+ ASSERT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
+ ASSERT_EQ(L"contentType", parser.GetAttributeName());
+ ASSERT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
+ ASSERT_EQ(L"application/x-javascript", parser.GetAttributeValue());
+
+ ASSERT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
+ ASSERT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
+ ASSERT_EQ(L"\n ", parser.GetTextData());
+
+ // Parser walks to end of input.
+
+ ASSERT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
+}
+
+TEST_F(CFDE_XMLSyntaxParserTest, EmptyCData) {
+ const char* input =
+ "<script contentType=\"application/x-javascript\">\n"
+ " <![CDATA[]]>\n"
+ "</script>";
+
+ CFX_RetainPtr<IFGAS_Stream> stream =
+ IFGAS_Stream::CreateReadStream(IFX_MemoryStream::Create(
+ reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)));
+ stream->SetCodePage(FX_CODEPAGE_UTF8);
+
+ CFDE_XMLSyntaxParser parser(stream);
+ ASSERT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
+ ASSERT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
+ ASSERT_EQ(L"script", parser.GetTagName());
+
+ ASSERT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
+ ASSERT_EQ(L"contentType", parser.GetAttributeName());
+ ASSERT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
+ ASSERT_EQ(L"application/x-javascript", parser.GetAttributeValue());
+
+ ASSERT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
+ ASSERT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
+ ASSERT_EQ(L"\n ", parser.GetTextData());
+
+ ASSERT_EQ(FDE_XmlSyntaxResult::CData, parser.DoSyntaxParse());
+ ASSERT_EQ(L"", parser.GetTextData());
+
+ ASSERT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
+ ASSERT_EQ(L"\n", parser.GetTextData());
+
+ ASSERT_EQ(FDE_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse());
+ ASSERT_EQ(L"script", parser.GetTagName());
+
+ ASSERT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
+}
+
+TEST_F(CFDE_XMLSyntaxParserTest, Comment) {
+ const char* input =
+ "<script contentType=\"application/x-javascript\">\n"
+ " <!-- A Comment -->\n"
+ "</script>";
+
+ CFX_RetainPtr<IFGAS_Stream> stream =
+ IFGAS_Stream::CreateReadStream(IFX_MemoryStream::Create(
+ reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)));
+ stream->SetCodePage(FX_CODEPAGE_UTF8);
+
+ CFDE_XMLSyntaxParser parser(stream);
+ ASSERT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
+ ASSERT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
+ ASSERT_EQ(L"script", parser.GetTagName());
+
+ ASSERT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
+ ASSERT_EQ(L"contentType", parser.GetAttributeName());
+ ASSERT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
+ ASSERT_EQ(L"application/x-javascript", parser.GetAttributeValue());
+
+ ASSERT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
+ ASSERT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
+ ASSERT_EQ(L"\n ", parser.GetTextData());
+
+ ASSERT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
+ ASSERT_EQ(L"\n", parser.GetTextData());
+
+ ASSERT_EQ(FDE_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse());
+ ASSERT_EQ(L"script", parser.GetTagName());
+
+ ASSERT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
+}
+
+TEST_F(CFDE_XMLSyntaxParserTest, IncorrectCommentStart) {
+ const char* input =
+ "<script contentType=\"application/x-javascript\">\n"
+ " <!- A Comment -->\n"
+ "</script>";
+
+ CFX_RetainPtr<IFGAS_Stream> stream =
+ IFGAS_Stream::CreateReadStream(IFX_MemoryStream::Create(
+ reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)));
+ stream->SetCodePage(FX_CODEPAGE_UTF8);
+
+ CFDE_XMLSyntaxParser parser(stream);
+ ASSERT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
+ ASSERT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
+ ASSERT_EQ(L"script", parser.GetTagName());
+
+ ASSERT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
+ ASSERT_EQ(L"contentType", parser.GetAttributeName());
+ ASSERT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
+ ASSERT_EQ(L"application/x-javascript", parser.GetAttributeValue());
+
+ ASSERT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
+ ASSERT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
+ ASSERT_EQ(L"\n ", parser.GetTextData());
+
+ ASSERT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
+ ASSERT_EQ(L"\n", parser.GetTextData());
+
+ ASSERT_EQ(FDE_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse());
+ ASSERT_EQ(L"script", parser.GetTagName());
+
+ ASSERT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
+}
+
+TEST_F(CFDE_XMLSyntaxParserTest, CommentEmpty) {
+ const char* input =
+ "<script contentType=\"application/x-javascript\">\n"
+ " <!---->\n"
+ "</script>";
+
+ CFX_RetainPtr<IFGAS_Stream> stream =
+ IFGAS_Stream::CreateReadStream(IFX_MemoryStream::Create(
+ reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)));
+ stream->SetCodePage(FX_CODEPAGE_UTF8);
+
+ CFDE_XMLSyntaxParser parser(stream);
+ ASSERT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
+ ASSERT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
+ ASSERT_EQ(L"script", parser.GetTagName());
+
+ ASSERT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
+ ASSERT_EQ(L"contentType", parser.GetAttributeName());
+ ASSERT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
+ ASSERT_EQ(L"application/x-javascript", parser.GetAttributeValue());
+
+ ASSERT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
+ ASSERT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
+ ASSERT_EQ(L"\n ", parser.GetTextData());
+
+ ASSERT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
+ ASSERT_EQ(L"\n", parser.GetTextData());
+
+ ASSERT_EQ(FDE_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse());
+ ASSERT_EQ(L"script", parser.GetTagName());
+
+ ASSERT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
+}
+
+TEST_F(CFDE_XMLSyntaxParserTest, CommentThreeDash) {
+ const char* input =
+ "<script contentType=\"application/x-javascript\">\n"
+ " <!--->\n"
+ "</script>";
+
+ CFX_RetainPtr<IFGAS_Stream> stream =
+ IFGAS_Stream::CreateReadStream(IFX_MemoryStream::Create(
+ reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)));
+ stream->SetCodePage(FX_CODEPAGE_UTF8);
+
+ CFDE_XMLSyntaxParser parser(stream);
+ ASSERT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
+ ASSERT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
+ ASSERT_EQ(L"script", parser.GetTagName());
+
+ ASSERT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
+ ASSERT_EQ(L"contentType", parser.GetAttributeName());
+ ASSERT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
+ ASSERT_EQ(L"application/x-javascript", parser.GetAttributeValue());
+
+ ASSERT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
+ ASSERT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
+ ASSERT_EQ(L"\n ", parser.GetTextData());
+
+ ASSERT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
+}
+
+TEST_F(CFDE_XMLSyntaxParserTest, CommentTwoDash) {
+ const char* input =
+ "<script contentType=\"application/x-javascript\">\n"
+ " <!-->\n"
+ "</script>";
+
+ CFX_RetainPtr<IFGAS_Stream> stream =
+ IFGAS_Stream::CreateReadStream(IFX_MemoryStream::Create(
+ reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)));
+ stream->SetCodePage(FX_CODEPAGE_UTF8);
+
+ CFDE_XMLSyntaxParser parser(stream);
+ ASSERT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
+ ASSERT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
+ ASSERT_EQ(L"script", parser.GetTagName());
+
+ ASSERT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
+ ASSERT_EQ(L"contentType", parser.GetAttributeName());
+ ASSERT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
+ ASSERT_EQ(L"application/x-javascript", parser.GetAttributeValue());
+
+ ASSERT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
+ ASSERT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
+ ASSERT_EQ(L"\n ", parser.GetTextData());
+
+ ASSERT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
+}
+
+TEST_F(CFDE_XMLSyntaxParserTest, Entities) {
+ const char* input =
+ "<script contentType=\"application/x-javascript\">"
+ "&#66;"
+ "&#x54;"
+ "&#x00000000000000000048;"
+ "&#x0000000000000000AB48;"
+ "&#x0000000000000000000;"
+ "</script>";
+
+ CFX_RetainPtr<IFGAS_Stream> stream =
+ IFGAS_Stream::CreateReadStream(IFX_MemoryStream::Create(
+ reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)));
+ stream->SetCodePage(FX_CODEPAGE_UTF8);
+
+ CFDE_XMLSyntaxParser parser(stream);
+ ASSERT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
+ ASSERT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
+ ASSERT_EQ(L"script", parser.GetTagName());
+
+ ASSERT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
+ ASSERT_EQ(L"contentType", parser.GetAttributeName());
+ ASSERT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
+ ASSERT_EQ(L"application/x-javascript", parser.GetAttributeValue());
+
+ ASSERT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
+ ASSERT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
+ ASSERT_EQ(L"BTH\xab48", parser.GetTextData());
+
+ ASSERT_EQ(FDE_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse());
+ ASSERT_EQ(L"script", parser.GetTagName());
+
+ ASSERT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
+}
+
+TEST_F(CFDE_XMLSyntaxParserTest, EntityOverflowHex) {
+ const char* input =
+ "<script contentType=\"application/x-javascript\">"
+ "&#xaDBDFFFFF;"
+ "&#xafffffffffffffffffffffffffffffffff;"
+ "</script>";
+
+ CFX_RetainPtr<IFGAS_Stream> stream =
+ IFGAS_Stream::CreateReadStream(IFX_MemoryStream::Create(
+ reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)));
+ stream->SetCodePage(FX_CODEPAGE_UTF8);
+
+ CFDE_XMLSyntaxParser parser(stream);
+ ASSERT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
+ ASSERT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
+ ASSERT_EQ(L"script", parser.GetTagName());
+
+ ASSERT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
+ ASSERT_EQ(L"contentType", parser.GetAttributeName());
+ ASSERT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
+ ASSERT_EQ(L"application/x-javascript", parser.GetAttributeValue());
+
+ ASSERT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
+ ASSERT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
+ ASSERT_EQ(L" ", parser.GetTextData());
+
+ ASSERT_EQ(FDE_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse());
+ ASSERT_EQ(L"script", parser.GetTagName());
+
+ ASSERT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
+}
+
+TEST_F(CFDE_XMLSyntaxParserTest, EntityOverflowDecimal) {
+ const char* input =
+ "<script contentType=\"application/x-javascript\">"
+ "&#2914910205;"
+ "&#29149102052342342134521341234512351234213452315;"
+ "</script>";
+
+ CFX_RetainPtr<IFGAS_Stream> stream =
+ IFGAS_Stream::CreateReadStream(IFX_MemoryStream::Create(
+ reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)));
+ stream->SetCodePage(FX_CODEPAGE_UTF8);
+
+ CFDE_XMLSyntaxParser parser(stream);
+ ASSERT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
+ ASSERT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
+ ASSERT_EQ(L"script", parser.GetTagName());
+
+ ASSERT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
+ ASSERT_EQ(L"contentType", parser.GetAttributeName());
+ ASSERT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
+ ASSERT_EQ(L"application/x-javascript", parser.GetAttributeValue());
+
+ ASSERT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
+ ASSERT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
+ ASSERT_EQ(L" ", parser.GetTextData());
+
+ ASSERT_EQ(FDE_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse());
+ ASSERT_EQ(L"script", parser.GetTagName());
+
+ ASSERT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
+}
diff --git a/chromium/third_party/pdfium/xfa/fde/xml/cfde_xmltext.cpp b/chromium/third_party/pdfium/xfa/fde/xml/cfde_xmltext.cpp
new file mode 100644
index 00000000000..2af66ac70ca
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fde/xml/cfde_xmltext.cpp
@@ -0,0 +1,22 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "xfa/fde/xml/cfde_xmltext.h"
+
+#include "third_party/base/ptr_util.h"
+
+CFDE_XMLText::CFDE_XMLText(const CFX_WideString& wsText)
+ : CFDE_XMLNode(), m_wsText(wsText) {}
+
+CFDE_XMLText::~CFDE_XMLText() {}
+
+FDE_XMLNODETYPE CFDE_XMLText::GetType() const {
+ return FDE_XMLNODE_Text;
+}
+
+std::unique_ptr<CFDE_XMLNode> CFDE_XMLText::Clone() {
+ return pdfium::MakeUnique<CFDE_XMLText>(m_wsText);
+}
diff --git a/chromium/third_party/pdfium/xfa/fde/xml/cfde_xmltext.h b/chromium/third_party/pdfium/xfa/fde/xml/cfde_xmltext.h
new file mode 100644
index 00000000000..6987c499803
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fde/xml/cfde_xmltext.h
@@ -0,0 +1,31 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef XFA_FDE_XML_CFDE_XMLTEXT_H_
+#define XFA_FDE_XML_CFDE_XMLTEXT_H_
+
+#include <memory>
+
+#include "core/fxcrt/fx_string.h"
+#include "xfa/fde/xml/cfde_xmlnode.h"
+
+class CFDE_XMLText : public CFDE_XMLNode {
+ public:
+ explicit CFDE_XMLText(const CFX_WideString& wsText);
+ ~CFDE_XMLText() override;
+
+ // CFDE_XMLNode
+ FDE_XMLNODETYPE GetType() const override;
+ std::unique_ptr<CFDE_XMLNode> Clone() override;
+
+ CFX_WideString GetText() const { return m_wsText; }
+ void SetText(const CFX_WideString& wsText) { m_wsText = wsText; }
+
+ private:
+ CFX_WideString m_wsText;
+};
+
+#endif // XFA_FDE_XML_CFDE_XMLTEXT_H_
diff --git a/chromium/third_party/pdfium/xfa/fde/xml/cfx_saxreader.cpp b/chromium/third_party/pdfium/xfa/fde/xml/cfx_saxreader.cpp
deleted file mode 100644
index 458bed52d6c..00000000000
--- a/chromium/third_party/pdfium/xfa/fde/xml/cfx_saxreader.cpp
+++ /dev/null
@@ -1,739 +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
-
-#include "xfa/fde/xml/cfx_saxreader.h"
-
-#include <algorithm>
-#include <utility>
-
-#include "third_party/base/ptr_util.h"
-#include "xfa/fxfa/xfa_checksum.h"
-
-enum class CFX_SaxMode {
- Text = 0,
- NodeStart,
- DeclOrComment,
- DeclNode,
- Comment,
- CommentContent,
- TagName,
- TagAttributeName,
- TagAttributeEqual,
- TagAttributeValue,
- TagMaybeClose,
- TagClose,
- TagEnd,
- TargetData,
- MAX
-};
-
-class CFX_SAXCommentContext {
- public:
- CFX_SAXCommentContext() : m_iHeaderCount(0), m_iTailCount(0) {}
- int32_t m_iHeaderCount;
- int32_t m_iTailCount;
-};
-
-namespace {
-
-const uint32_t kSaxFileBufSize = 32768;
-
-typedef void (CFX_SAXReader::*FX_SAXReader_LPFParse)();
-static const FX_SAXReader_LPFParse
- g_FX_SAXReader_LPFParse[static_cast<int>(CFX_SaxMode::MAX)] = {
- &CFX_SAXReader::ParseText,
- &CFX_SAXReader::ParseNodeStart,
- &CFX_SAXReader::ParseDeclOrComment,
- &CFX_SAXReader::ParseDeclNode,
- &CFX_SAXReader::ParseComment,
- &CFX_SAXReader::ParseCommentContent,
- &CFX_SAXReader::ParseTagName,
- &CFX_SAXReader::ParseTagAttributeName,
- &CFX_SAXReader::ParseTagAttributeEqual,
- &CFX_SAXReader::ParseTagAttributeValue,
- &CFX_SAXReader::ParseMaybeClose,
- &CFX_SAXReader::ParseTagClose,
- &CFX_SAXReader::ParseTagEnd,
- &CFX_SAXReader::ParseTargetData,
-};
-
-} // namespace
-
-CFX_SAXFile::CFX_SAXFile()
- : m_dwStart(0),
- m_dwEnd(0),
- m_dwCur(0),
- m_pBuf(nullptr),
- m_dwBufSize(0),
- m_dwBufIndex(0) {}
-
-CFX_SAXFile::~CFX_SAXFile() {}
-
-bool CFX_SAXFile::StartFile(const CFX_RetainPtr<IFX_SeekableReadStream>& pFile,
- uint32_t dwStart,
- uint32_t dwLen) {
- ASSERT(!m_pFile && pFile);
- uint32_t dwSize = pFile->GetSize();
- if (dwStart >= dwSize)
- return false;
-
- if (dwLen == static_cast<uint32_t>(-1) || dwStart + dwLen > dwSize)
- dwLen = dwSize - dwStart;
-
- if (dwLen == 0)
- return false;
-
- m_dwBufSize = std::min(dwLen, kSaxFileBufSize);
- m_pBuf = FX_Alloc(uint8_t, m_dwBufSize);
- if (!pFile->ReadBlock(m_pBuf, dwStart, m_dwBufSize))
- return false;
-
- m_dwStart = dwStart;
- m_dwEnd = dwStart + dwLen;
- m_dwCur = dwStart;
- m_pFile = pFile;
- m_dwBufIndex = 0;
- return true;
-}
-
-bool CFX_SAXFile::ReadNextBlock() {
- ASSERT(m_pFile);
- uint32_t dwSize = m_dwEnd - m_dwCur;
- if (dwSize == 0) {
- return false;
- }
- m_dwBufSize = std::min(dwSize, kSaxFileBufSize);
- if (!m_pFile->ReadBlock(m_pBuf, m_dwCur, m_dwBufSize)) {
- return false;
- }
- m_dwBufIndex = 0;
- return true;
-}
-
-void CFX_SAXFile::Reset() {
- if (m_pBuf) {
- FX_Free(m_pBuf);
- m_pBuf = nullptr;
- }
- m_pFile = nullptr;
-}
-
-CFX_SAXReader::CFX_SAXReader()
- : m_File(),
- m_pHandler(nullptr),
- m_iState(-1),
- m_dwItemID(0),
- m_iDataSize(256),
- m_iNameSize(256),
- m_dwParseMode(0),
- m_pCommentContext(nullptr) {
- m_pszData = FX_Alloc(uint8_t, m_iDataSize);
- m_pszName = FX_Alloc(uint8_t, m_iNameSize);
-}
-CFX_SAXReader::~CFX_SAXReader() {
- Reset();
- if (m_pszData) {
- FX_Free(m_pszData);
- m_pszData = nullptr;
- }
- if (m_pszName) {
- FX_Free(m_pszName);
- m_pszName = nullptr;
- }
-}
-
-void CFX_SAXReader::Reset() {
- m_File.Reset();
- while (!m_Stack.empty())
- m_Stack.pop();
-
- m_dwItemID = 0;
- m_SkipStack.RemoveAll();
- m_SkipChar = 0;
- m_iDataLength = 0;
- m_iEntityStart = -1;
- m_iNameLength = 0;
- m_iDataPos = 0;
- delete m_pCommentContext;
- m_pCommentContext = nullptr;
-}
-
-void CFX_SAXReader::Push() {
- std::unique_ptr<CFX_SAXItem> pNew =
- pdfium::MakeUnique<CFX_SAXItem>(++m_dwItemID);
- if (!m_Stack.empty())
- pNew->m_bSkip = m_Stack.top()->m_bSkip;
- m_Stack.push(std::move(pNew));
-}
-
-void CFX_SAXReader::Pop() {
- if (!m_Stack.empty())
- m_Stack.pop();
-}
-
-CFX_SAXItem* CFX_SAXReader::GetCurrentItem() const {
- return m_Stack.empty() ? nullptr : m_Stack.top().get();
-}
-
-void CFX_SAXReader::AppendData(uint8_t ch) {
- ReallocDataBuffer();
- m_pszData[m_iDataPos++] = ch;
-}
-
-void CFX_SAXReader::AppendName(uint8_t ch) {
- ReallocNameBuffer();
- m_pszName[m_iDataPos++] = ch;
-}
-
-void CFX_SAXReader::ReallocDataBuffer() {
- if (m_iDataPos < m_iDataSize) {
- return;
- }
- if (m_iDataSize <= 1024 * 1024) {
- m_iDataSize *= 2;
- } else {
- m_iDataSize += 1024 * 1024;
- }
- m_pszData = (uint8_t*)FX_Realloc(uint8_t, m_pszData, m_iDataSize);
-}
-
-void CFX_SAXReader::ReallocNameBuffer() {
- if (m_iDataPos < m_iNameSize) {
- return;
- }
- if (m_iNameSize <= 1024 * 1024) {
- m_iNameSize *= 2;
- } else {
- m_iNameSize += 1024 * 1024;
- }
- m_pszName = (uint8_t*)FX_Realloc(uint8_t, m_pszName, m_iNameSize);
-}
-
-bool CFX_SAXReader::SkipSpace(uint8_t ch) {
- return (m_dwParseMode & CFX_SaxParseMode_NotSkipSpace) == 0 && ch < 0x21;
-}
-
-int32_t CFX_SAXReader::StartParse(
- const CFX_RetainPtr<IFX_SeekableReadStream>& pFile,
- uint32_t dwStart,
- uint32_t dwLen,
- uint32_t dwParseMode) {
- m_iState = -1;
- Reset();
- if (!m_File.StartFile(pFile, dwStart, dwLen))
- return -1;
-
- m_iState = 0;
- m_eMode = CFX_SaxMode::Text;
- m_ePrevMode = CFX_SaxMode::Text;
- m_bCharData = false;
- m_dwDataOffset = 0;
- m_dwParseMode = dwParseMode;
- m_Stack.emplace(new CFX_SAXItem(++m_dwItemID));
- return 0;
-}
-
-int32_t CFX_SAXReader::ContinueParse(IFX_Pause* pPause) {
- if (m_iState < 0 || m_iState > 99) {
- return m_iState;
- }
- while (m_File.m_dwCur < m_File.m_dwEnd) {
- uint32_t& index = m_File.m_dwBufIndex;
- uint32_t size = m_File.m_dwBufSize;
- const uint8_t* pBuf = m_File.m_pBuf;
- while (index < size) {
- m_CurByte = pBuf[index];
- (this->*g_FX_SAXReader_LPFParse[static_cast<int>(m_eMode)])();
- index++;
- }
- m_File.m_dwCur += index;
- m_iState = (m_File.m_dwCur - m_File.m_dwStart) * 100 /
- (m_File.m_dwEnd - m_File.m_dwStart);
- if (m_File.m_dwCur >= m_File.m_dwEnd) {
- break;
- }
- if (!m_File.ReadNextBlock()) {
- m_iState = -2;
- break;
- }
- m_dwDataOffset = 0;
- if (pPause && pPause->NeedToPauseNow()) {
- break;
- }
- }
- return m_iState;
-}
-void CFX_SAXReader::ParseChar(uint8_t ch) {
- ReallocDataBuffer();
- m_pszData[m_iDataPos] = ch;
- if (m_iEntityStart > -1 && ch == ';') {
- int32_t iSaveEntityStart = m_iEntityStart;
- CFX_ByteString csEntity(m_pszData + m_iEntityStart + 1,
- m_iDataPos - m_iEntityStart - 1);
- int32_t iLen = csEntity.GetLength();
- if (iLen > 0) {
- if (csEntity[0] == '#') {
- if ((m_dwParseMode & CFX_SaxParseMode_NotConvert_sharp) == 0) {
- ch = 0;
- uint8_t w;
- if (iLen > 1 && csEntity[1] == 'x') {
- for (int32_t i = 2; i < iLen; i++) {
- w = csEntity[i];
- if (w >= '0' && w <= '9') {
- ch = (ch << 4) + w - '0';
- } else if (w >= 'A' && w <= 'F') {
- ch = (ch << 4) + w - 55;
- } else if (w >= 'a' && w <= 'f') {
- ch = (ch << 4) + w - 87;
- } else {
- break;
- }
- }
- } else {
- for (int32_t i = 1; i < iLen; i++) {
- w = csEntity[i];
- if (w < '0' || w > '9') {
- break;
- }
- ch = ch * 10 + w - '0';
- }
- }
- if (ch != 0) {
- m_pszData[m_iEntityStart++] = ch;
- }
- }
- } else {
- if (csEntity.Compare("amp") == 0) {
- if ((m_dwParseMode & CFX_SaxParseMode_NotConvert_amp) == 0) {
- m_pszData[m_iEntityStart++] = '&';
- }
- } else if (csEntity.Compare("lt") == 0) {
- if ((m_dwParseMode & CFX_SaxParseMode_NotConvert_lt) == 0) {
- m_pszData[m_iEntityStart++] = '<';
- }
- } else if (csEntity.Compare("gt") == 0) {
- if ((m_dwParseMode & CFX_SaxParseMode_NotConvert_gt) == 0) {
- m_pszData[m_iEntityStart++] = '>';
- }
- } else if (csEntity.Compare("apos") == 0) {
- if ((m_dwParseMode & CFX_SaxParseMode_NotConvert_apos) == 0) {
- m_pszData[m_iEntityStart++] = '\'';
- }
- } else if (csEntity.Compare("quot") == 0) {
- if ((m_dwParseMode & CFX_SaxParseMode_NotConvert_quot) == 0) {
- m_pszData[m_iEntityStart++] = '\"';
- }
- }
- }
- }
- if (iSaveEntityStart != m_iEntityStart) {
- m_iDataPos = m_iEntityStart;
- m_iEntityStart = -1;
- } else {
- m_iDataPos++;
- m_iEntityStart = -1;
- }
- } else {
- if (m_iEntityStart < 0 && ch == '&') {
- m_iEntityStart = m_iDataPos;
- }
- m_iDataPos++;
- }
-}
-
-void CFX_SAXReader::ParseText() {
- if (m_CurByte == '<') {
- if (m_iDataPos > 0) {
- m_iDataLength = m_iDataPos;
- m_iDataPos = 0;
- if (m_pHandler) {
- NotifyData();
- }
- }
- Push();
- m_dwNodePos = m_File.m_dwCur + m_File.m_dwBufIndex;
- m_eMode = CFX_SaxMode::NodeStart;
- return;
- }
- if (m_iDataPos < 1 && SkipSpace(m_CurByte)) {
- return;
- }
- ParseChar(m_CurByte);
-}
-
-void CFX_SAXReader::ParseNodeStart() {
- if (m_CurByte == '?') {
- GetCurrentItem()->m_eNode = CFX_SAXItem::Type::Instruction;
- m_eMode = CFX_SaxMode::TagName;
- return;
- }
- if (m_CurByte == '!') {
- m_eMode = CFX_SaxMode::DeclOrComment;
- return;
- }
- if (m_CurByte == '/') {
- m_eMode = CFX_SaxMode::TagEnd;
- return;
- }
- if (m_CurByte == '>') {
- Pop();
- m_eMode = CFX_SaxMode::Text;
- return;
- }
- if (m_CurByte > 0x20) {
- m_dwDataOffset = m_File.m_dwBufIndex;
- GetCurrentItem()->m_eNode = CFX_SAXItem::Type::Tag;
- m_eMode = CFX_SaxMode::TagName;
- AppendData(m_CurByte);
- }
-}
-
-void CFX_SAXReader::ParseDeclOrComment() {
- if (m_CurByte == '-') {
- m_eMode = CFX_SaxMode::Comment;
- GetCurrentItem()->m_eNode = CFX_SAXItem::Type::Comment;
- if (!m_pCommentContext)
- m_pCommentContext = new CFX_SAXCommentContext;
-
- m_pCommentContext->m_iHeaderCount = 1;
- m_pCommentContext->m_iTailCount = 0;
- } else {
- m_eMode = CFX_SaxMode::DeclNode;
- m_dwDataOffset = m_File.m_dwBufIndex;
- m_SkipChar = '>';
- m_SkipStack.Add('>');
- SkipNode();
- }
-}
-void CFX_SAXReader::ParseComment() {
- m_pCommentContext->m_iHeaderCount = 2;
- m_dwNodePos = m_File.m_dwCur + m_File.m_dwBufIndex;
- m_eMode = CFX_SaxMode::CommentContent;
-}
-void CFX_SAXReader::ParseCommentContent() {
- if (m_CurByte == '-') {
- m_pCommentContext->m_iTailCount++;
- } else if (m_CurByte == '>' && m_pCommentContext->m_iTailCount == 2) {
- m_iDataLength = m_iDataPos;
- m_iDataPos = 0;
- if (m_pHandler) {
- NotifyTargetData();
- }
- Pop();
- m_eMode = CFX_SaxMode::Text;
- } else {
- while (m_pCommentContext->m_iTailCount > 0) {
- AppendData('-');
- m_pCommentContext->m_iTailCount--;
- }
- AppendData(m_CurByte);
- }
-}
-void CFX_SAXReader::ParseDeclNode() {
- SkipNode();
-}
-void CFX_SAXReader::ParseTagName() {
- if (m_CurByte < 0x21 || m_CurByte == '/' || m_CurByte == '>' ||
- m_CurByte == '?') {
- m_iDataLength = m_iDataPos;
- m_iDataPos = 0;
- if (m_pHandler) {
- NotifyEnter();
- }
- if (m_CurByte < 0x21) {
- m_eMode = CFX_SaxMode::TagAttributeName;
- } else if (m_CurByte == '/' || m_CurByte == '?') {
- m_ePrevMode = m_eMode;
- m_eMode = CFX_SaxMode::TagMaybeClose;
- } else {
- if (m_pHandler) {
- NotifyBreak();
- }
- m_eMode = CFX_SaxMode::Text;
- }
- } else {
- AppendData(m_CurByte);
- }
-}
-void CFX_SAXReader::ParseTagAttributeName() {
- if (m_CurByte < 0x21 || m_CurByte == '=') {
- if (m_iDataPos < 1 && m_CurByte < 0x21) {
- return;
- }
- m_iNameLength = m_iDataPos;
- m_iDataPos = 0;
- m_SkipChar = 0;
- m_eMode = m_CurByte == '=' ? CFX_SaxMode::TagAttributeValue
- : CFX_SaxMode::TagAttributeEqual;
- return;
- }
- if (m_CurByte == '/' || m_CurByte == '>' || m_CurByte == '?') {
- if (m_CurByte == '/' || m_CurByte == '?') {
- m_ePrevMode = m_eMode;
- m_eMode = CFX_SaxMode::TagMaybeClose;
- } else {
- if (m_pHandler) {
- NotifyBreak();
- }
- m_eMode = CFX_SaxMode::Text;
- }
- return;
- }
- if (m_iDataPos < 1) {
- m_dwDataOffset = m_File.m_dwBufIndex;
- }
- AppendName(m_CurByte);
-}
-
-void CFX_SAXReader::ParseTagAttributeEqual() {
- if (m_CurByte == '=') {
- m_SkipChar = 0;
- m_eMode = CFX_SaxMode::TagAttributeValue;
- return;
- }
- if (GetCurrentItem()->m_eNode == CFX_SAXItem::Type::Instruction) {
- m_iDataPos = m_iNameLength;
- AppendName(0x20);
- m_eMode = CFX_SaxMode::TargetData;
- ParseTargetData();
- }
-}
-
-void CFX_SAXReader::ParseTagAttributeValue() {
- if (m_SkipChar) {
- if (m_SkipChar == m_CurByte) {
- {
- m_iDataLength = m_iDataPos;
- m_iDataPos = 0;
- if (m_pHandler) {
- NotifyAttribute();
- }
- }
- m_SkipChar = 0;
- m_eMode = CFX_SaxMode::TagAttributeName;
- return;
- }
- ParseChar(m_CurByte);
- return;
- }
- if (m_CurByte < 0x21) {
- return;
- }
- if (m_iDataPos < 1) {
- if (m_CurByte == '\'' || m_CurByte == '\"') {
- m_SkipChar = m_CurByte;
- }
- }
-}
-
-void CFX_SAXReader::ParseMaybeClose() {
- if (m_CurByte == '>') {
- if (GetCurrentItem()->m_eNode == CFX_SAXItem::Type::Instruction) {
- m_iNameLength = m_iDataPos;
- m_iDataPos = 0;
- if (m_pHandler) {
- NotifyTargetData();
- }
- }
- ParseTagClose();
- m_eMode = CFX_SaxMode::Text;
- } else if (m_ePrevMode == CFX_SaxMode::TagName) {
- AppendData('/');
- m_eMode = CFX_SaxMode::TagName;
- m_ePrevMode = CFX_SaxMode::Text;
- ParseTagName();
- } else if (m_ePrevMode == CFX_SaxMode::TagAttributeName) {
- AppendName('/');
- m_eMode = CFX_SaxMode::TagAttributeName;
- m_ePrevMode = CFX_SaxMode::Text;
- ParseTagAttributeName();
- } else if (m_ePrevMode == CFX_SaxMode::TargetData) {
- AppendName('?');
- m_eMode = CFX_SaxMode::TargetData;
- m_ePrevMode = CFX_SaxMode::Text;
- ParseTargetData();
- }
-}
-void CFX_SAXReader::ParseTagClose() {
- m_dwNodePos = m_File.m_dwCur + m_File.m_dwBufIndex;
- if (m_pHandler) {
- NotifyClose();
- }
- Pop();
-}
-void CFX_SAXReader::ParseTagEnd() {
- if (m_CurByte < 0x21) {
- return;
- }
- if (m_CurByte == '>') {
- Pop();
- m_dwNodePos = m_File.m_dwCur + m_File.m_dwBufIndex;
- m_iDataLength = m_iDataPos;
- m_iDataPos = 0;
- if (m_pHandler) {
- NotifyEnd();
- }
- Pop();
- m_eMode = CFX_SaxMode::Text;
- } else {
- ParseChar(m_CurByte);
- }
-}
-void CFX_SAXReader::ParseTargetData() {
- if (m_CurByte == '?') {
- m_ePrevMode = m_eMode;
- m_eMode = CFX_SaxMode::TagMaybeClose;
- } else {
- AppendName(m_CurByte);
- }
-}
-void CFX_SAXReader::SkipNode() {
- int32_t iLen = m_SkipStack.GetSize();
- if (m_SkipChar == '\'' || m_SkipChar == '\"') {
- if (m_CurByte != m_SkipChar) {
- return;
- }
- iLen--;
- ASSERT(iLen > -1);
- m_SkipStack.RemoveAt(iLen, 1);
- m_SkipChar = iLen ? m_SkipStack[iLen - 1] : 0;
- return;
- }
- switch (m_CurByte) {
- case '<':
- m_SkipChar = '>';
- m_SkipStack.Add('>');
- break;
- case '[':
- m_SkipChar = ']';
- m_SkipStack.Add(']');
- break;
- case '(':
- m_SkipChar = ')';
- m_SkipStack.Add(')');
- break;
- case '\'':
- m_SkipChar = '\'';
- m_SkipStack.Add('\'');
- break;
- case '\"':
- m_SkipChar = '\"';
- m_SkipStack.Add('\"');
- break;
- default:
- if (m_CurByte == m_SkipChar) {
- iLen--;
- m_SkipStack.RemoveAt(iLen, 1);
- m_SkipChar = iLen ? m_SkipStack[iLen - 1] : 0;
- if (iLen == 0 && m_CurByte == '>') {
- m_iDataLength = m_iDataPos;
- m_iDataPos = 0;
- if (m_iDataLength >= 9 &&
- FXSYS_memcmp(m_pszData, "[CDATA[", 7 * sizeof(uint8_t)) == 0 &&
- FXSYS_memcmp(m_pszData + m_iDataLength - 2, "]]",
- 2 * sizeof(uint8_t)) == 0) {
- Pop();
- m_iDataLength -= 9;
- m_dwDataOffset += 7;
- FXSYS_memmove(m_pszData, m_pszData + 7,
- m_iDataLength * sizeof(uint8_t));
- m_bCharData = true;
- if (m_pHandler) {
- NotifyData();
- }
- m_bCharData = false;
- } else {
- Pop();
- }
- m_eMode = CFX_SaxMode::Text;
- }
- }
- break;
- }
- if (iLen > 0) {
- ParseChar(m_CurByte);
- }
-}
-
-void CFX_SAXReader::NotifyData() {
- CFX_SAXItem* pItem = GetCurrentItem();
- if (!pItem)
- return;
-
- if (pItem->m_eNode == CFX_SAXItem::Type::Tag)
- m_pHandler->OnTagData(
- pItem->m_pNode,
- m_bCharData ? CFX_SAXItem::Type::CharData : CFX_SAXItem::Type::Text,
- CFX_ByteStringC(m_pszData, m_iDataLength),
- m_File.m_dwCur + m_dwDataOffset);
-}
-
-void CFX_SAXReader::NotifyEnter() {
- CFX_SAXItem* pItem = GetCurrentItem();
- if (pItem->m_eNode == CFX_SAXItem::Type::Tag ||
- pItem->m_eNode == CFX_SAXItem::Type::Instruction) {
- pItem->m_pNode = m_pHandler->OnTagEnter(
- CFX_ByteStringC(m_pszData, m_iDataLength), pItem->m_eNode, m_dwNodePos);
- }
-}
-
-void CFX_SAXReader::NotifyAttribute() {
- CFX_SAXItem* pItem = GetCurrentItem();
- if (pItem->m_eNode == CFX_SAXItem::Type::Tag ||
- pItem->m_eNode == CFX_SAXItem::Type::Instruction) {
- m_pHandler->OnTagAttribute(pItem->m_pNode,
- CFX_ByteStringC(m_pszName, m_iNameLength),
- CFX_ByteStringC(m_pszData, m_iDataLength));
- }
-}
-
-void CFX_SAXReader::NotifyBreak() {
- CFX_SAXItem* pItem = GetCurrentItem();
- if (pItem->m_eNode == CFX_SAXItem::Type::Tag)
- m_pHandler->OnTagBreak(pItem->m_pNode);
-}
-
-void CFX_SAXReader::NotifyClose() {
- CFX_SAXItem* pItem = GetCurrentItem();
- if (pItem->m_eNode == CFX_SAXItem::Type::Tag ||
- pItem->m_eNode == CFX_SAXItem::Type::Instruction) {
- m_pHandler->OnTagClose(pItem->m_pNode, m_dwNodePos);
- }
-}
-
-void CFX_SAXReader::NotifyEnd() {
- CFX_SAXItem* pItem = GetCurrentItem();
- if (!pItem || pItem->m_eNode != CFX_SAXItem::Type::Tag)
- return;
-
- m_pHandler->OnTagEnd(pItem->m_pNode,
- CFX_ByteStringC(m_pszData, m_iDataLength), m_dwNodePos);
-}
-
-void CFX_SAXReader::NotifyTargetData() {
- CFX_SAXItem* pItem = GetCurrentItem();
- if (pItem->m_eNode == CFX_SAXItem::Type::Instruction) {
- m_pHandler->OnTargetData(pItem->m_pNode, pItem->m_eNode,
- CFX_ByteStringC(m_pszName, m_iNameLength),
- m_dwNodePos);
- } else if (pItem->m_eNode == CFX_SAXItem::Type::Comment) {
- m_pHandler->OnTargetData(pItem->m_pNode, pItem->m_eNode,
- CFX_ByteStringC(m_pszData, m_iDataLength),
- m_dwNodePos);
- }
-}
-
-void CFX_SAXReader::SkipCurrentNode() {
- CFX_SAXItem* pItem = GetCurrentItem();
- if (!pItem)
- return;
-
- pItem->m_bSkip = true;
-}
-
-void CFX_SAXReader::SetHandler(CXFA_SAXReaderHandler* pHandler) {
- m_pHandler = pHandler;
-}
diff --git a/chromium/third_party/pdfium/xfa/fde/xml/cfx_saxreader.h b/chromium/third_party/pdfium/xfa/fde/xml/cfx_saxreader.h
deleted file mode 100644
index 129399d88d9..00000000000
--- a/chromium/third_party/pdfium/xfa/fde/xml/cfx_saxreader.h
+++ /dev/null
@@ -1,146 +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 XFA_FDE_XML_CFX_SAXREADER_H_
-#define XFA_FDE_XML_CFX_SAXREADER_H_
-
-#include <memory>
-#include <stack>
-
-#include "core/fxcrt/fx_basic.h"
-
-class CXFA_SAXContext;
-
-class CFX_SAXItem {
- public:
- enum class Type {
- Unknown = 0,
- Instruction,
- Declaration,
- Comment,
- Tag,
- Text,
- CharData,
- };
-
- explicit CFX_SAXItem(uint32_t id)
- : m_pNode(nullptr), m_eNode(Type::Unknown), m_dwID(id), m_bSkip(false) {}
-
- CXFA_SAXContext* m_pNode;
- Type m_eNode;
- const uint32_t m_dwID;
- bool m_bSkip;
-};
-
-class CFX_SAXFile {
- public:
- CFX_SAXFile();
- ~CFX_SAXFile();
-
- bool StartFile(const CFX_RetainPtr<IFX_SeekableReadStream>& pFile,
- uint32_t dwStart,
- uint32_t dwLen);
- bool ReadNextBlock();
- void Reset();
-
- CFX_RetainPtr<IFX_SeekableReadStream> m_pFile;
- uint32_t m_dwStart;
- uint32_t m_dwEnd;
- uint32_t m_dwCur;
- uint8_t* m_pBuf;
- uint32_t m_dwBufSize;
- uint32_t m_dwBufIndex;
-};
-
-class CFX_SAXCommentContext;
-enum class CFX_SaxMode;
-
-enum CFX_SaxParseMode {
- CFX_SaxParseMode_NotConvert_amp = 1 << 0,
- CFX_SaxParseMode_NotConvert_lt = 1 << 1,
- CFX_SaxParseMode_NotConvert_gt = 1 << 2,
- CFX_SaxParseMode_NotConvert_apos = 1 << 3,
- CFX_SaxParseMode_NotConvert_quot = 1 << 4,
- CFX_SaxParseMode_NotConvert_sharp = 1 << 5,
- CFX_SaxParseMode_NotSkipSpace = 1 << 6
-};
-
-class CXFA_SAXReaderHandler;
-
-class CFX_SAXReader {
- public:
- CFX_SAXReader();
- ~CFX_SAXReader();
-
- int32_t StartParse(const CFX_RetainPtr<IFX_SeekableReadStream>& pFile,
- uint32_t dwStart = 0,
- uint32_t dwLen = -1,
- uint32_t dwParseMode = 0);
- int32_t ContinueParse(IFX_Pause* pPause = nullptr);
- void SkipCurrentNode();
- void SetHandler(CXFA_SAXReaderHandler* pHandler);
- void AppendData(uint8_t ch);
- void AppendName(uint8_t ch);
- void ParseText();
- void ParseNodeStart();
- void ParseInstruction();
- void ParseDeclOrComment();
- void ParseDeclNode();
- void ParseComment();
- void ParseCommentContent();
- void ParseTagName();
- void ParseTagAttributeName();
- void ParseTagAttributeEqual();
- void ParseTagAttributeValue();
- void ParseMaybeClose();
- void ParseTagClose();
- void ParseTagEnd();
- void ParseTargetData();
-
- private:
- void Reset();
- void Push();
- void Pop();
- CFX_SAXItem* GetCurrentItem() const;
- bool SkipSpace(uint8_t ch);
- void SkipNode();
- void NotifyData();
- void NotifyEnter();
- void NotifyAttribute();
- void NotifyBreak();
- void NotifyClose();
- void NotifyEnd();
- void NotifyTargetData();
- void ReallocDataBuffer();
- void ReallocNameBuffer();
- void ParseChar(uint8_t ch);
-
- CFX_SAXFile m_File;
- CXFA_SAXReaderHandler* m_pHandler;
- int32_t m_iState;
- std::stack<std::unique_ptr<CFX_SAXItem>> m_Stack;
- uint32_t m_dwItemID;
- CFX_SaxMode m_eMode;
- CFX_SaxMode m_ePrevMode;
- bool m_bCharData;
- uint8_t m_CurByte;
- uint32_t m_dwDataOffset;
- CFX_ArrayTemplate<uint8_t> m_SkipStack;
- uint8_t m_SkipChar;
- uint32_t m_dwNodePos;
- uint8_t* m_pszData;
- int32_t m_iDataSize;
- int32_t m_iDataLength;
- int32_t m_iEntityStart;
- int32_t m_iDataPos;
- uint8_t* m_pszName;
- int32_t m_iNameSize;
- int32_t m_iNameLength;
- uint32_t m_dwParseMode;
- CFX_SAXCommentContext* m_pCommentContext;
-};
-
-#endif // XFA_FDE_XML_CFX_SAXREADER_H_
diff --git a/chromium/third_party/pdfium/xfa/fde/xml/fde_xml.h b/chromium/third_party/pdfium/xfa/fde/xml/fde_xml.h
deleted file mode 100644
index e773b308511..00000000000
--- a/chromium/third_party/pdfium/xfa/fde/xml/fde_xml.h
+++ /dev/null
@@ -1,45 +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 XFA_FDE_XML_FDE_XML_H_
-#define XFA_FDE_XML_FDE_XML_H_
-
-#include "core/fxcrt/fx_system.h"
-
-enum class FDE_XmlSyntaxResult {
- None,
- InstructionOpen,
- InstructionClose,
- ElementOpen,
- ElementBreak,
- ElementClose,
- TargetName,
- TagName,
- AttriName,
- AttriValue,
- Text,
- CData,
- TargetData,
- Error,
- EndOfString
-};
-
-enum FDE_XMLNODETYPE {
- FDE_XMLNODE_Unknown = 0,
- FDE_XMLNODE_Instruction,
- FDE_XMLNODE_Element,
- FDE_XMLNODE_Text,
- FDE_XMLNODE_CharData,
-};
-
-struct FDE_XMLNODE {
- int32_t iNodeNum;
- FDE_XMLNODETYPE eNodeType;
-};
-
-bool FDE_IsXMLValidChar(FX_WCHAR ch);
-
-#endif // XFA_FDE_XML_FDE_XML_H_
diff --git a/chromium/third_party/pdfium/xfa/fde/xml/fde_xml_imp.cpp b/chromium/third_party/pdfium/xfa/fde/xml/fde_xml_imp.cpp
deleted file mode 100644
index 5ce274bbdbc..00000000000
--- a/chromium/third_party/pdfium/xfa/fde/xml/fde_xml_imp.cpp
+++ /dev/null
@@ -1,1897 +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
-
-#include "xfa/fde/xml/fde_xml_imp.h"
-
-#include <algorithm>
-#include <utility>
-
-#include "core/fxcrt/fx_ext.h"
-#include "core/fxcrt/fx_safe_types.h"
-#include "third_party/base/stl_util.h"
-#include "xfa/fgas/crt/fgas_codepage.h"
-
-namespace {
-
-const uint32_t kMaxCharRange = 0x10ffff;
-
-const uint16_t g_XMLValidCharRange[][2] = {{0x09, 0x09},
- {0x0A, 0x0A},
- {0x0D, 0x0D},
- {0x20, 0xD7FF},
- {0xE000, 0xFFFD}};
-
-bool FDE_IsXMLWhiteSpace(FX_WCHAR ch) {
- return ch == L' ' || ch == 0x0A || ch == 0x0D || ch == 0x09;
-}
-
-struct FDE_XMLNAMECHAR {
- uint16_t wStart;
- uint16_t wEnd;
- bool bStartChar;
-};
-
-const FDE_XMLNAMECHAR g_XMLNameChars[] = {
- {L'-', L'.', false}, {L'0', L'9', false}, {L':', L':', false},
- {L'A', L'Z', true}, {L'_', L'_', true}, {L'a', L'z', true},
- {0xB7, 0xB7, false}, {0xC0, 0xD6, true}, {0xD8, 0xF6, true},
- {0xF8, 0x02FF, true}, {0x0300, 0x036F, false}, {0x0370, 0x037D, true},
- {0x037F, 0x1FFF, true}, {0x200C, 0x200D, true}, {0x203F, 0x2040, false},
- {0x2070, 0x218F, true}, {0x2C00, 0x2FEF, true}, {0x3001, 0xD7FF, true},
- {0xF900, 0xFDCF, true}, {0xFDF0, 0xFFFD, true},
-};
-
-bool FDE_IsXMLNameChar(FX_WCHAR ch, bool bFirstChar) {
- int32_t iStart = 0;
- int32_t iEnd = FX_ArraySize(g_XMLNameChars) - 1;
- while (iStart <= iEnd) {
- int32_t iMid = (iStart + iEnd) / 2;
- if (ch < g_XMLNameChars[iMid].wStart) {
- iEnd = iMid - 1;
- } else if (ch > g_XMLNameChars[iMid].wEnd) {
- iStart = iMid + 1;
- } else {
- return bFirstChar ? g_XMLNameChars[iMid].bStartChar : true;
- }
- }
- return false;
-}
-
-} // namespace
-
-bool FDE_IsXMLValidChar(FX_WCHAR ch) {
- int32_t iStart = 0;
- int32_t iEnd = FX_ArraySize(g_XMLValidCharRange) - 1;
- while (iStart <= iEnd) {
- int32_t iMid = (iStart + iEnd) / 2;
- if (ch < g_XMLValidCharRange[iMid][0]) {
- iEnd = iMid - 1;
- } else if (ch > g_XMLValidCharRange[iMid][1]) {
- iStart = iMid + 1;
- } else {
- return true;
- }
- }
- return false;
-}
-
-CFDE_XMLNode::CFDE_XMLNode()
- : m_pParent(nullptr),
- m_pChild(nullptr),
- m_pPrior(nullptr),
- m_pNext(nullptr) {}
-
-FDE_XMLNODETYPE CFDE_XMLNode::GetType() const {
- return FDE_XMLNODE_Unknown;
-}
-
-CFDE_XMLNode::~CFDE_XMLNode() {
- DeleteChildren();
-}
-
-void CFDE_XMLNode::DeleteChildren() {
- CFDE_XMLNode* pChild = m_pChild;
- while (pChild) {
- CFDE_XMLNode* pNext = pChild->m_pNext;
- delete pChild;
- pChild = pNext;
- }
- m_pChild = nullptr;
-}
-
-int32_t CFDE_XMLNode::CountChildNodes() const {
- int32_t iCount = 0;
- CFDE_XMLNode* pChild = m_pChild;
- while (pChild) {
- iCount++;
- pChild = pChild->m_pNext;
- }
- return iCount;
-}
-
-CFDE_XMLNode* CFDE_XMLNode::GetChildNode(int32_t index) const {
- CFDE_XMLNode* pChild = m_pChild;
- while (pChild) {
- if (index == 0) {
- return pChild;
- }
- index--;
- pChild = pChild->m_pNext;
- }
- return nullptr;
-}
-
-int32_t CFDE_XMLNode::GetChildNodeIndex(CFDE_XMLNode* pNode) const {
- int32_t index = 0;
- CFDE_XMLNode* pChild = m_pChild;
- while (pChild) {
- if (pChild == pNode) {
- return index;
- }
- index++;
- pChild = pChild->m_pNext;
- }
- return -1;
-}
-
-CFDE_XMLNode* CFDE_XMLNode::GetPath(const FX_WCHAR* pPath,
- int32_t iLength,
- bool bQualifiedName) const {
- ASSERT(pPath);
- if (iLength < 0) {
- iLength = FXSYS_wcslen(pPath);
- }
- if (iLength == 0) {
- return nullptr;
- }
- CFX_WideString csPath;
- const FX_WCHAR* pStart = pPath;
- const FX_WCHAR* pEnd = pPath + iLength;
- FX_WCHAR ch;
- while (pStart < pEnd) {
- ch = *pStart++;
- if (ch == L'/') {
- break;
- } else {
- csPath += ch;
- }
- }
- iLength -= pStart - pPath;
- CFDE_XMLNode* pFind = nullptr;
- if (csPath.GetLength() < 1) {
- pFind = GetNodeItem(CFDE_XMLNode::Root);
- } else if (csPath.Compare(L"..") == 0) {
- pFind = m_pParent;
- } else if (csPath.Compare(L".") == 0) {
- pFind = (CFDE_XMLNode*)this;
- } else {
- CFX_WideString wsTag;
- CFDE_XMLNode* pNode = m_pChild;
- while (pNode) {
- if (pNode->GetType() == FDE_XMLNODE_Element) {
- if (bQualifiedName) {
- ((CFDE_XMLElement*)pNode)->GetTagName(wsTag);
- } else {
- ((CFDE_XMLElement*)pNode)->GetLocalTagName(wsTag);
- }
- if (wsTag.Compare(csPath) == 0) {
- if (iLength < 1) {
- pFind = pNode;
- } else {
- pFind = pNode->GetPath(pStart, iLength, bQualifiedName);
- }
- if (pFind)
- return pFind;
- }
- }
- pNode = pNode->m_pNext;
- }
- }
- if (!pFind || iLength < 1)
- return pFind;
- return pFind->GetPath(pStart, iLength, bQualifiedName);
-}
-
-int32_t CFDE_XMLNode::InsertChildNode(CFDE_XMLNode* pNode, int32_t index) {
- pNode->m_pParent = this;
- if (!m_pChild) {
- m_pChild = pNode;
- pNode->m_pPrior = nullptr;
- pNode->m_pNext = nullptr;
- return 0;
- }
- if (index == 0) {
- pNode->m_pNext = m_pChild;
- pNode->m_pPrior = nullptr;
- m_pChild->m_pPrior = pNode;
- m_pChild = pNode;
- return 0;
- }
- int32_t iCount = 0;
- CFDE_XMLNode* pFind = m_pChild;
- while (++iCount != index && pFind->m_pNext) {
- pFind = pFind->m_pNext;
- }
- pNode->m_pPrior = pFind;
- pNode->m_pNext = pFind->m_pNext;
- if (pFind->m_pNext)
- pFind->m_pNext->m_pPrior = pNode;
- pFind->m_pNext = pNode;
- return iCount;
-}
-
-void CFDE_XMLNode::RemoveChildNode(CFDE_XMLNode* pNode) {
- ASSERT(m_pChild && pNode);
- if (m_pChild == pNode) {
- m_pChild = pNode->m_pNext;
- } else {
- pNode->m_pPrior->m_pNext = pNode->m_pNext;
- }
- if (pNode->m_pNext)
- pNode->m_pNext->m_pPrior = pNode->m_pPrior;
- pNode->m_pParent = nullptr;
- pNode->m_pNext = nullptr;
- pNode->m_pPrior = nullptr;
-}
-
-CFDE_XMLNode* CFDE_XMLNode::GetNodeItem(CFDE_XMLNode::NodeItem eItem) const {
- switch (eItem) {
- case CFDE_XMLNode::Root: {
- CFDE_XMLNode* pParent = (CFDE_XMLNode*)this;
- while (pParent->m_pParent) {
- pParent = pParent->m_pParent;
- }
- return pParent;
- }
- case CFDE_XMLNode::Parent:
- return m_pParent;
- case CFDE_XMLNode::FirstSibling: {
- CFDE_XMLNode* pItem = (CFDE_XMLNode*)this;
- while (pItem->m_pPrior) {
- pItem = pItem->m_pPrior;
- }
- return pItem == (CFDE_XMLNode*)this ? nullptr : pItem;
- }
- case CFDE_XMLNode::PriorSibling:
- return m_pPrior;
- case CFDE_XMLNode::NextSibling:
- return m_pNext;
- case CFDE_XMLNode::LastSibling: {
- CFDE_XMLNode* pItem = (CFDE_XMLNode*)this;
- while (pItem->m_pNext)
- pItem = pItem->m_pNext;
- return pItem == (CFDE_XMLNode*)this ? nullptr : pItem;
- }
- case CFDE_XMLNode::FirstNeighbor: {
- CFDE_XMLNode* pParent = (CFDE_XMLNode*)this;
- while (pParent->m_pParent)
- pParent = pParent->m_pParent;
- return pParent == (CFDE_XMLNode*)this ? nullptr : pParent;
- }
- case CFDE_XMLNode::PriorNeighbor: {
- if (!m_pPrior)
- return m_pParent;
-
- CFDE_XMLNode* pItem = m_pPrior;
- while (pItem->m_pChild) {
- pItem = pItem->m_pChild;
- while (pItem->m_pNext)
- pItem = pItem->m_pNext;
- }
- return pItem;
- }
- case CFDE_XMLNode::NextNeighbor: {
- if (m_pChild)
- return m_pChild;
- if (m_pNext)
- return m_pNext;
- CFDE_XMLNode* pItem = m_pParent;
- while (pItem) {
- if (pItem->m_pNext)
- return pItem->m_pNext;
- pItem = pItem->m_pParent;
- }
- return nullptr;
- }
- case CFDE_XMLNode::LastNeighbor: {
- CFDE_XMLNode* pItem = (CFDE_XMLNode*)this;
- while (pItem->m_pParent) {
- pItem = pItem->m_pParent;
- }
- while (true) {
- while (pItem->m_pNext)
- pItem = pItem->m_pNext;
- if (!pItem->m_pChild)
- break;
- pItem = pItem->m_pChild;
- }
- return pItem == (CFDE_XMLNode*)this ? nullptr : pItem;
- }
- case CFDE_XMLNode::FirstChild:
- return m_pChild;
- case CFDE_XMLNode::LastChild: {
- if (!m_pChild)
- return nullptr;
-
- CFDE_XMLNode* pChild = m_pChild;
- while (pChild->m_pNext)
- pChild = pChild->m_pNext;
- return pChild;
- }
- default:
- break;
- }
- return nullptr;
-}
-
-int32_t CFDE_XMLNode::GetNodeLevel() const {
- int32_t iLevel = 0;
- const CFDE_XMLNode* pItem = m_pParent;
- while (pItem) {
- iLevel++;
- pItem = pItem->m_pParent;
- }
- return iLevel;
-}
-
-bool CFDE_XMLNode::InsertNodeItem(CFDE_XMLNode::NodeItem eItem,
- CFDE_XMLNode* pNode) {
- switch (eItem) {
- case CFDE_XMLNode::NextSibling: {
- pNode->m_pParent = m_pParent;
- pNode->m_pNext = m_pNext;
- pNode->m_pPrior = this;
- if (m_pNext) {
- m_pNext->m_pPrior = pNode;
- }
- m_pNext = pNode;
- return true;
- }
- case CFDE_XMLNode::PriorSibling: {
- pNode->m_pParent = m_pParent;
- pNode->m_pNext = this;
- pNode->m_pPrior = m_pPrior;
- if (m_pPrior) {
- m_pPrior->m_pNext = pNode;
- } else if (m_pParent) {
- m_pParent->m_pChild = pNode;
- }
- m_pPrior = pNode;
- return true;
- }
- default:
- return false;
- }
-}
-
-CFDE_XMLNode* CFDE_XMLNode::RemoveNodeItem(CFDE_XMLNode::NodeItem eItem) {
- CFDE_XMLNode* pNode = nullptr;
- switch (eItem) {
- case CFDE_XMLNode::NextSibling:
- if (m_pNext) {
- pNode = m_pNext;
- m_pNext = pNode->m_pNext;
- if (m_pNext) {
- m_pNext->m_pPrior = this;
- }
- pNode->m_pParent = nullptr;
- pNode->m_pNext = nullptr;
- pNode->m_pPrior = nullptr;
- }
- break;
- default:
- break;
- }
- return pNode;
-}
-
-CFDE_XMLNode* CFDE_XMLNode::Clone(bool bRecursive) {
- return nullptr;
-}
-
-void CFDE_XMLNode::SaveXMLNode(const CFX_RetainPtr<IFGAS_Stream>& pXMLStream) {
- CFDE_XMLNode* pNode = (CFDE_XMLNode*)this;
- switch (pNode->GetType()) {
- case FDE_XMLNODE_Instruction: {
- CFX_WideString ws;
- CFDE_XMLInstruction* pInstruction = (CFDE_XMLInstruction*)pNode;
- if (pInstruction->m_wsTarget.CompareNoCase(L"xml") == 0) {
- ws = L"<?xml version=\"1.0\" encoding=\"";
- uint16_t wCodePage = pXMLStream->GetCodePage();
- if (wCodePage == FX_CODEPAGE_UTF16LE) {
- ws += L"UTF-16";
- } else if (wCodePage == FX_CODEPAGE_UTF16BE) {
- ws += L"UTF-16be";
- } else {
- ws += L"UTF-8";
- }
- ws += L"\"?>";
- pXMLStream->WriteString(ws.c_str(), ws.GetLength());
- } else {
- ws.Format(L"<?%s", pInstruction->m_wsTarget.c_str());
- pXMLStream->WriteString(ws.c_str(), ws.GetLength());
- std::vector<CFX_WideString>& attributes = pInstruction->m_Attributes;
- int32_t i;
- int32_t iCount = pdfium::CollectionSize<int32_t>(attributes);
- CFX_WideString wsValue;
- for (i = 0; i < iCount; i += 2) {
- ws = L" ";
- ws += attributes[i];
- ws += L"=\"";
- wsValue = attributes[i + 1];
- wsValue.Replace(L"&", L"&amp;");
- wsValue.Replace(L"<", L"&lt;");
- wsValue.Replace(L">", L"&gt;");
- wsValue.Replace(L"\'", L"&apos;");
- wsValue.Replace(L"\"", L"&quot;");
- ws += wsValue;
- ws += L"\"";
- pXMLStream->WriteString(ws.c_str(), ws.GetLength());
- }
- std::vector<CFX_WideString>& targetdata = pInstruction->m_TargetData;
- iCount = pdfium::CollectionSize<int32_t>(targetdata);
- for (i = 0; i < iCount; i++) {
- ws = L" \"";
- ws += targetdata[i];
- ws += L"\"";
- pXMLStream->WriteString(ws.c_str(), ws.GetLength());
- }
- ws = L"?>";
- pXMLStream->WriteString(ws.c_str(), ws.GetLength());
- }
- } break;
- case FDE_XMLNODE_Element: {
- CFX_WideString ws;
- ws = L"<";
- ws += ((CFDE_XMLElement*)pNode)->m_wsTag;
- pXMLStream->WriteString(ws.c_str(), ws.GetLength());
- std::vector<CFX_WideString>& attributes =
- static_cast<CFDE_XMLElement*>(pNode)->m_Attributes;
- int32_t iCount = pdfium::CollectionSize<int32_t>(attributes);
- CFX_WideString wsValue;
- for (int32_t i = 0; i < iCount; i += 2) {
- ws = L" ";
- ws += attributes[i];
- ws += L"=\"";
- wsValue = attributes[i + 1];
- wsValue.Replace(L"&", L"&amp;");
- wsValue.Replace(L"<", L"&lt;");
- wsValue.Replace(L">", L"&gt;");
- wsValue.Replace(L"\'", L"&apos;");
- wsValue.Replace(L"\"", L"&quot;");
- ws += wsValue;
- ws += L"\"";
- pXMLStream->WriteString(ws.c_str(), ws.GetLength());
- }
- if (pNode->m_pChild) {
- ws = L"\n>";
- pXMLStream->WriteString(ws.c_str(), ws.GetLength());
- CFDE_XMLNode* pChild = pNode->m_pChild;
- while (pChild) {
- pChild->SaveXMLNode(pXMLStream);
- pChild = pChild->m_pNext;
- }
- ws = L"</";
- ws += ((CFDE_XMLElement*)pNode)->m_wsTag;
- ws += L"\n>";
- } else {
- ws = L"\n/>";
- }
- pXMLStream->WriteString(ws.c_str(), ws.GetLength());
- } break;
- case FDE_XMLNODE_Text: {
- CFX_WideString ws = ((CFDE_XMLText*)pNode)->m_wsText;
- ws.Replace(L"&", L"&amp;");
- ws.Replace(L"<", L"&lt;");
- ws.Replace(L">", L"&gt;");
- ws.Replace(L"\'", L"&apos;");
- ws.Replace(L"\"", L"&quot;");
- pXMLStream->WriteString(ws.c_str(), ws.GetLength());
- } break;
- case FDE_XMLNODE_CharData: {
- CFX_WideString ws = L"<![CDATA[";
- ws += ((CFDE_XMLCharData*)pNode)->m_wsCharData;
- ws += L"]]>";
- pXMLStream->WriteString(ws.c_str(), ws.GetLength());
- } break;
- case FDE_XMLNODE_Unknown:
- break;
- default:
- break;
- }
-}
-
-void CFDE_XMLNode::CloneChildren(CFDE_XMLNode* pClone) {
- if (!m_pChild) {
- return;
- }
- CFDE_XMLNode* pNext = m_pChild;
- CFDE_XMLNode* pCloneNext = pNext->Clone(true);
- pClone->InsertChildNode(pCloneNext);
- pNext = pNext->m_pNext;
- while (pNext) {
- CFDE_XMLNode* pChild = pNext->Clone(true);
- pCloneNext->InsertNodeItem(CFDE_XMLNode::NextSibling, pChild);
- pCloneNext = pChild;
- pNext = pNext->m_pNext;
- }
-}
-
-CFDE_XMLInstruction::CFDE_XMLInstruction(const CFX_WideString& wsTarget)
- : m_wsTarget(wsTarget) {
- ASSERT(m_wsTarget.GetLength() > 0);
-}
-
-FDE_XMLNODETYPE CFDE_XMLInstruction::GetType() const {
- return FDE_XMLNODE_Instruction;
-}
-
-CFDE_XMLNode* CFDE_XMLInstruction::Clone(bool bRecursive) {
- CFDE_XMLInstruction* pClone = new CFDE_XMLInstruction(m_wsTarget);
- if (!pClone)
- return nullptr;
-
- pClone->m_Attributes = m_Attributes;
- pClone->m_TargetData = m_TargetData;
- if (bRecursive)
- CloneChildren(pClone);
-
- return pClone;
-}
-
-int32_t CFDE_XMLInstruction::CountAttributes() const {
- return pdfium::CollectionSize<int32_t>(m_Attributes) / 2;
-}
-
-bool CFDE_XMLInstruction::GetAttribute(int32_t index,
- CFX_WideString& wsAttriName,
- CFX_WideString& wsAttriValue) const {
- int32_t iCount = pdfium::CollectionSize<int32_t>(m_Attributes);
- ASSERT(index > -1 && index < iCount / 2);
- for (int32_t i = 0; i < iCount; i += 2) {
- if (index == 0) {
- wsAttriName = m_Attributes[i];
- wsAttriValue = m_Attributes[i + 1];
- return true;
- }
- index--;
- }
- return false;
-}
-
-bool CFDE_XMLInstruction::HasAttribute(const FX_WCHAR* pwsAttriName) const {
- int32_t iCount = pdfium::CollectionSize<int32_t>(m_Attributes);
- for (int32_t i = 0; i < iCount; i += 2) {
- if (m_Attributes[i].Compare(pwsAttriName) == 0) {
- return true;
- }
- }
- return false;
-}
-
-void CFDE_XMLInstruction::GetString(const FX_WCHAR* pwsAttriName,
- CFX_WideString& wsAttriValue,
- const FX_WCHAR* pwsDefValue) const {
- int32_t iCount = pdfium::CollectionSize<int32_t>(m_Attributes);
- for (int32_t i = 0; i < iCount; i += 2) {
- if (m_Attributes[i].Compare(pwsAttriName) == 0) {
- wsAttriValue = m_Attributes[i + 1];
- return;
- }
- }
- wsAttriValue = pwsDefValue;
-}
-
-void CFDE_XMLInstruction::SetString(const CFX_WideString& wsAttriName,
- const CFX_WideString& wsAttriValue) {
- ASSERT(wsAttriName.GetLength() > 0);
- int32_t iCount = pdfium::CollectionSize<int32_t>(m_Attributes);
- for (int32_t i = 0; i < iCount; i += 2) {
- if (m_Attributes[i].Compare(wsAttriName) == 0) {
- m_Attributes[i] = wsAttriName;
- m_Attributes[i + 1] = wsAttriValue;
- return;
- }
- }
- m_Attributes.push_back(wsAttriName);
- m_Attributes.push_back(wsAttriValue);
-}
-
-int32_t CFDE_XMLInstruction::GetInteger(const FX_WCHAR* pwsAttriName,
- int32_t iDefValue) const {
- int32_t iCount = pdfium::CollectionSize<int32_t>(m_Attributes);
- for (int32_t i = 0; i < iCount; i += 2) {
- if (m_Attributes[i].Compare(pwsAttriName) == 0) {
- return FXSYS_wtoi(m_Attributes[i + 1].c_str());
- }
- }
- return iDefValue;
-}
-
-void CFDE_XMLInstruction::SetInteger(const FX_WCHAR* pwsAttriName,
- int32_t iAttriValue) {
- CFX_WideString wsValue;
- wsValue.Format(L"%d", iAttriValue);
- SetString(pwsAttriName, wsValue);
-}
-
-FX_FLOAT CFDE_XMLInstruction::GetFloat(const FX_WCHAR* pwsAttriName,
- FX_FLOAT fDefValue) const {
- int32_t iCount = pdfium::CollectionSize<int32_t>(m_Attributes);
- for (int32_t i = 0; i < iCount; i += 2) {
- if (m_Attributes[i].Compare(pwsAttriName) == 0) {
- return FXSYS_wcstof(m_Attributes[i + 1].c_str(), -1, nullptr);
- }
- }
- return fDefValue;
-}
-
-void CFDE_XMLInstruction::SetFloat(const FX_WCHAR* pwsAttriName,
- FX_FLOAT fAttriValue) {
- CFX_WideString wsValue;
- wsValue.Format(L"%f", fAttriValue);
- SetString(pwsAttriName, wsValue);
-}
-
-void CFDE_XMLInstruction::RemoveAttribute(const FX_WCHAR* pwsAttriName) {
- int32_t iCount = pdfium::CollectionSize<int32_t>(m_Attributes);
- for (int32_t i = 0; i < iCount; i += 2) {
- if (m_Attributes[i].Compare(pwsAttriName) == 0) {
- m_Attributes.erase(m_Attributes.begin() + i,
- m_Attributes.begin() + i + 2);
- return;
- }
- }
-}
-
-int32_t CFDE_XMLInstruction::CountData() const {
- return pdfium::CollectionSize<int32_t>(m_TargetData);
-}
-
-bool CFDE_XMLInstruction::GetData(int32_t index, CFX_WideString& wsData) const {
- if (index < 0 || index >= pdfium::CollectionSize<int32_t>(m_TargetData))
- return false;
-
- wsData = m_TargetData[index];
- return true;
-}
-
-void CFDE_XMLInstruction::AppendData(const CFX_WideString& wsData) {
- m_TargetData.push_back(wsData);
-}
-
-void CFDE_XMLInstruction::RemoveData(int32_t index) {
- if (index < 0 || index >= pdfium::CollectionSize<int32_t>(m_TargetData))
- return;
-
- m_TargetData.erase(m_TargetData.begin() + index);
-}
-
-CFDE_XMLInstruction::~CFDE_XMLInstruction() {}
-
-CFDE_XMLElement::CFDE_XMLElement(const CFX_WideString& wsTag)
- : CFDE_XMLNode(), m_wsTag(wsTag), m_Attributes() {
- ASSERT(m_wsTag.GetLength() > 0);
-}
-
-CFDE_XMLElement::~CFDE_XMLElement() {}
-
-FDE_XMLNODETYPE CFDE_XMLElement::GetType() const {
- return FDE_XMLNODE_Element;
-}
-
-CFDE_XMLNode* CFDE_XMLElement::Clone(bool bRecursive) {
- CFDE_XMLElement* pClone = new CFDE_XMLElement(m_wsTag);
- if (!pClone)
- return nullptr;
-
- pClone->m_Attributes = m_Attributes;
- if (bRecursive) {
- CloneChildren(pClone);
- } else {
- CFX_WideString wsText;
- CFDE_XMLNode* pChild = m_pChild;
- while (pChild) {
- switch (pChild->GetType()) {
- case FDE_XMLNODE_Text:
- wsText += ((CFDE_XMLText*)pChild)->m_wsText;
- break;
- default:
- break;
- }
- pChild = pChild->m_pNext;
- }
- pClone->SetTextData(wsText);
- }
- return pClone;
-}
-
-void CFDE_XMLElement::GetTagName(CFX_WideString& wsTag) const {
- wsTag = m_wsTag;
-}
-
-void CFDE_XMLElement::GetLocalTagName(CFX_WideString& wsTag) const {
- FX_STRSIZE iFind = m_wsTag.Find(L':', 0);
- if (iFind < 0) {
- wsTag = m_wsTag;
- } else {
- wsTag = m_wsTag.Right(m_wsTag.GetLength() - iFind - 1);
- }
-}
-
-void CFDE_XMLElement::GetNamespacePrefix(CFX_WideString& wsPrefix) const {
- FX_STRSIZE iFind = m_wsTag.Find(L':', 0);
- if (iFind < 0) {
- wsPrefix.clear();
- } else {
- wsPrefix = m_wsTag.Left(iFind);
- }
-}
-
-void CFDE_XMLElement::GetNamespaceURI(CFX_WideString& wsNamespace) const {
- CFX_WideString wsAttri(L"xmlns"), wsPrefix;
- GetNamespacePrefix(wsPrefix);
- if (wsPrefix.GetLength() > 0) {
- wsAttri += L":";
- wsAttri += wsPrefix;
- }
- wsNamespace.clear();
- CFDE_XMLNode* pNode = (CFDE_XMLNode*)this;
- while (pNode) {
- if (pNode->GetType() != FDE_XMLNODE_Element) {
- break;
- }
- CFDE_XMLElement* pElement = (CFDE_XMLElement*)pNode;
- if (!pElement->HasAttribute(wsAttri.c_str())) {
- pNode = pNode->GetNodeItem(CFDE_XMLNode::Parent);
- continue;
- }
- pElement->GetString(wsAttri.c_str(), wsNamespace);
- break;
- }
-}
-
-int32_t CFDE_XMLElement::CountAttributes() const {
- return pdfium::CollectionSize<int32_t>(m_Attributes) / 2;
-}
-
-bool CFDE_XMLElement::GetAttribute(int32_t index,
- CFX_WideString& wsAttriName,
- CFX_WideString& wsAttriValue) const {
- int32_t iCount = pdfium::CollectionSize<int32_t>(m_Attributes);
- ASSERT(index > -1 && index < iCount / 2);
- for (int32_t i = 0; i < iCount; i += 2) {
- if (index == 0) {
- wsAttriName = m_Attributes[i];
- wsAttriValue = m_Attributes[i + 1];
- return true;
- }
- index--;
- }
- return false;
-}
-
-bool CFDE_XMLElement::HasAttribute(const FX_WCHAR* pwsAttriName) const {
- int32_t iCount = pdfium::CollectionSize<int32_t>(m_Attributes);
- for (int32_t i = 0; i < iCount; i += 2) {
- if (m_Attributes[i].Compare(pwsAttriName) == 0)
- return true;
- }
- return false;
-}
-
-void CFDE_XMLElement::GetString(const FX_WCHAR* pwsAttriName,
- CFX_WideString& wsAttriValue,
- const FX_WCHAR* pwsDefValue) const {
- int32_t iCount = pdfium::CollectionSize<int32_t>(m_Attributes);
- for (int32_t i = 0; i < iCount; i += 2) {
- if (m_Attributes[i].Compare(pwsAttriName) == 0) {
- wsAttriValue = m_Attributes[i + 1];
- return;
- }
- }
- wsAttriValue = pwsDefValue;
-}
-
-void CFDE_XMLElement::SetString(const CFX_WideString& wsAttriName,
- const CFX_WideString& wsAttriValue) {
- ASSERT(wsAttriName.GetLength() > 0);
- int32_t iCount = pdfium::CollectionSize<int32_t>(m_Attributes);
- for (int32_t i = 0; i < iCount; i += 2) {
- if (m_Attributes[i].Compare(wsAttriName) == 0) {
- m_Attributes[i] = wsAttriName;
- m_Attributes[i + 1] = wsAttriValue;
- return;
- }
- }
- m_Attributes.push_back(wsAttriName);
- m_Attributes.push_back(wsAttriValue);
-}
-
-int32_t CFDE_XMLElement::GetInteger(const FX_WCHAR* pwsAttriName,
- int32_t iDefValue) const {
- int32_t iCount = pdfium::CollectionSize<int32_t>(m_Attributes);
- for (int32_t i = 0; i < iCount; i += 2) {
- if (m_Attributes[i].Compare(pwsAttriName) == 0) {
- return FXSYS_wtoi(m_Attributes[i + 1].c_str());
- }
- }
- return iDefValue;
-}
-
-void CFDE_XMLElement::SetInteger(const FX_WCHAR* pwsAttriName,
- int32_t iAttriValue) {
- CFX_WideString wsValue;
- wsValue.Format(L"%d", iAttriValue);
- SetString(pwsAttriName, wsValue);
-}
-
-FX_FLOAT CFDE_XMLElement::GetFloat(const FX_WCHAR* pwsAttriName,
- FX_FLOAT fDefValue) const {
- int32_t iCount = pdfium::CollectionSize<int32_t>(m_Attributes);
- for (int32_t i = 0; i < iCount; i += 2) {
- if (m_Attributes[i].Compare(pwsAttriName) == 0) {
- return FXSYS_wcstof(m_Attributes[i + 1].c_str(), -1, nullptr);
- }
- }
- return fDefValue;
-}
-
-void CFDE_XMLElement::SetFloat(const FX_WCHAR* pwsAttriName,
- FX_FLOAT fAttriValue) {
- CFX_WideString wsValue;
- wsValue.Format(L"%f", fAttriValue);
- SetString(pwsAttriName, wsValue);
-}
-
-void CFDE_XMLElement::RemoveAttribute(const FX_WCHAR* pwsAttriName) {
- int32_t iCount = pdfium::CollectionSize<int32_t>(m_Attributes);
- for (int32_t i = 0; i < iCount; i += 2) {
- if (m_Attributes[i].Compare(pwsAttriName) == 0) {
- m_Attributes.erase(m_Attributes.begin() + i,
- m_Attributes.begin() + i + 2);
- return;
- }
- }
-}
-
-void CFDE_XMLElement::GetTextData(CFX_WideString& wsText) const {
- CFX_WideTextBuf buffer;
- CFDE_XMLNode* pChild = m_pChild;
- while (pChild) {
- switch (pChild->GetType()) {
- case FDE_XMLNODE_Text:
- buffer << ((CFDE_XMLText*)pChild)->m_wsText;
- break;
- case FDE_XMLNODE_CharData:
- buffer << ((CFDE_XMLCharData*)pChild)->m_wsCharData;
- break;
- default:
- break;
- }
- pChild = pChild->m_pNext;
- }
- wsText = buffer.AsStringC();
-}
-
-void CFDE_XMLElement::SetTextData(const CFX_WideString& wsText) {
- if (wsText.GetLength() < 1) {
- return;
- }
- InsertChildNode(new CFDE_XMLText(wsText));
-}
-
-CFDE_XMLText::CFDE_XMLText(const CFX_WideString& wsText)
- : CFDE_XMLNode(), m_wsText(wsText) {}
-
-FDE_XMLNODETYPE CFDE_XMLText::GetType() const {
- return FDE_XMLNODE_Text;
-}
-
-CFDE_XMLNode* CFDE_XMLText::Clone(bool bRecursive) {
- CFDE_XMLText* pClone = new CFDE_XMLText(m_wsText);
- return pClone;
-}
-
-CFDE_XMLText::~CFDE_XMLText() {}
-
-CFDE_XMLCharData::CFDE_XMLCharData(const CFX_WideString& wsCData)
- : CFDE_XMLDeclaration(), m_wsCharData(wsCData) {}
-
-FDE_XMLNODETYPE CFDE_XMLCharData::GetType() const {
- return FDE_XMLNODE_CharData;
-}
-
-CFDE_XMLNode* CFDE_XMLCharData::Clone(bool bRecursive) {
- CFDE_XMLCharData* pClone = new CFDE_XMLCharData(m_wsCharData);
- return pClone;
-}
-
-CFDE_XMLCharData::~CFDE_XMLCharData() {}
-
-CFDE_XMLDoc::CFDE_XMLDoc() : m_pRoot(nullptr) {
- Reset(true);
- CFDE_XMLInstruction* pXML = new CFDE_XMLInstruction(L"xml");
- m_pRoot->InsertChildNode(pXML);
-}
-
-CFDE_XMLDoc::~CFDE_XMLDoc() {
- Reset(false);
-}
-
-void CFDE_XMLDoc::Reset(bool bInitRoot) {
- m_iStatus = 0;
- m_pStream = nullptr;
- if (bInitRoot) {
- if (m_pRoot)
- m_pRoot->DeleteChildren();
- else
- m_pRoot = new CFDE_XMLNode;
- } else {
- delete m_pRoot;
- m_pRoot = nullptr;
- }
- ReleaseParser();
-}
-
-void CFDE_XMLDoc::ReleaseParser() {
- m_pXMLParser.reset();
-}
-
-bool CFDE_XMLDoc::LoadXML(std::unique_ptr<IFDE_XMLParser> pXMLParser) {
- if (!pXMLParser)
- return false;
-
- Reset(true);
- m_pXMLParser = std::move(pXMLParser);
- return true;
-}
-
-int32_t CFDE_XMLDoc::DoLoad(IFX_Pause* pPause) {
- if (m_iStatus < 100)
- m_iStatus = m_pXMLParser->DoParser(pPause);
-
- return m_iStatus;
-}
-
-void CFDE_XMLDoc::CloseXML() {
- ReleaseParser();
-}
-
-void CFDE_XMLDoc::SaveXMLNode(const CFX_RetainPtr<IFGAS_Stream>& pXMLStream,
- CFDE_XMLNode* pINode) {
- CFDE_XMLNode* pNode = (CFDE_XMLNode*)pINode;
- switch (pNode->GetType()) {
- case FDE_XMLNODE_Instruction: {
- CFX_WideString ws;
- CFDE_XMLInstruction* pInstruction = (CFDE_XMLInstruction*)pNode;
- if (pInstruction->m_wsTarget.CompareNoCase(L"xml") == 0) {
- ws = L"<?xml version=\"1.0\" encoding=\"";
- uint16_t wCodePage = pXMLStream->GetCodePage();
- if (wCodePage == FX_CODEPAGE_UTF16LE) {
- ws += L"UTF-16";
- } else if (wCodePage == FX_CODEPAGE_UTF16BE) {
- ws += L"UTF-16be";
- } else {
- ws += L"UTF-8";
- }
- ws += L"\"?>";
- pXMLStream->WriteString(ws.c_str(), ws.GetLength());
- } else {
- ws.Format(L"<?%s", pInstruction->m_wsTarget.c_str());
- pXMLStream->WriteString(ws.c_str(), ws.GetLength());
- std::vector<CFX_WideString>& attributes = pInstruction->m_Attributes;
- int32_t i;
- int32_t iCount = pdfium::CollectionSize<int32_t>(attributes);
- CFX_WideString wsValue;
- for (i = 0; i < iCount; i += 2) {
- ws = L" ";
- ws += attributes[i];
- ws += L"=\"";
- wsValue = attributes[i + 1];
- wsValue.Replace(L"&", L"&amp;");
- wsValue.Replace(L"<", L"&lt;");
- wsValue.Replace(L">", L"&gt;");
- wsValue.Replace(L"\'", L"&apos;");
- wsValue.Replace(L"\"", L"&quot;");
- ws += wsValue;
- ws += L"\"";
- pXMLStream->WriteString(ws.c_str(), ws.GetLength());
- }
- std::vector<CFX_WideString>& targetdata = pInstruction->m_TargetData;
- iCount = pdfium::CollectionSize<int32_t>(targetdata);
- for (i = 0; i < iCount; i++) {
- ws = L" \"";
- ws += targetdata[i];
- ws += L"\"";
- pXMLStream->WriteString(ws.c_str(), ws.GetLength());
- }
- ws = L"?>";
- pXMLStream->WriteString(ws.c_str(), ws.GetLength());
- }
- } break;
- case FDE_XMLNODE_Element: {
- CFX_WideString ws;
- ws = L"<";
- ws += ((CFDE_XMLElement*)pNode)->m_wsTag;
- pXMLStream->WriteString(ws.c_str(), ws.GetLength());
- std::vector<CFX_WideString>& attributes =
- static_cast<CFDE_XMLElement*>(pNode)->m_Attributes;
- int32_t iCount = pdfium::CollectionSize<int32_t>(attributes);
- CFX_WideString wsValue;
- for (int32_t i = 0; i < iCount; i += 2) {
- ws = L" ";
- ws += attributes[i];
- ws += L"=\"";
- wsValue = attributes[i + 1];
- wsValue.Replace(L"&", L"&amp;");
- wsValue.Replace(L"<", L"&lt;");
- wsValue.Replace(L">", L"&gt;");
- wsValue.Replace(L"\'", L"&apos;");
- wsValue.Replace(L"\"", L"&quot;");
- ws += wsValue;
- ws += L"\"";
- pXMLStream->WriteString(ws.c_str(), ws.GetLength());
- }
- if (pNode->m_pChild) {
- ws = L"\n>";
- pXMLStream->WriteString(ws.c_str(), ws.GetLength());
- CFDE_XMLNode* pChild = pNode->m_pChild;
- while (pChild) {
- SaveXMLNode(pXMLStream, static_cast<CFDE_XMLNode*>(pChild));
- pChild = pChild->m_pNext;
- }
- ws = L"</";
- ws += ((CFDE_XMLElement*)pNode)->m_wsTag;
- ws += L"\n>";
- } else {
- ws = L"\n/>";
- }
- pXMLStream->WriteString(ws.c_str(), ws.GetLength());
- } break;
- case FDE_XMLNODE_Text: {
- CFX_WideString ws = ((CFDE_XMLText*)pNode)->m_wsText;
- ws.Replace(L"&", L"&amp;");
- ws.Replace(L"<", L"&lt;");
- ws.Replace(L">", L"&gt;");
- ws.Replace(L"\'", L"&apos;");
- ws.Replace(L"\"", L"&quot;");
- pXMLStream->WriteString(ws.c_str(), ws.GetLength());
- } break;
- case FDE_XMLNODE_CharData: {
- CFX_WideString ws = L"<![CDATA[";
- ws += ((CFDE_XMLCharData*)pNode)->m_wsCharData;
- ws += L"]]>";
- pXMLStream->WriteString(ws.c_str(), ws.GetLength());
- } break;
- case FDE_XMLNODE_Unknown:
- break;
- default:
- break;
- }
-}
-
-void CFDE_XMLDoc::SaveXML(CFX_RetainPtr<IFGAS_Stream>& pXMLStream,
- bool bSaveBOM) {
- if (!pXMLStream || pXMLStream == m_pStream) {
- m_pStream->Seek(FX_STREAMSEEK_Begin, 0);
- pXMLStream = m_pStream;
- }
- ASSERT((pXMLStream->GetAccessModes() & FX_STREAMACCESS_Text) != 0);
- ASSERT((pXMLStream->GetAccessModes() & FX_STREAMACCESS_Write) != 0);
- uint16_t wCodePage = pXMLStream->GetCodePage();
- if (wCodePage != FX_CODEPAGE_UTF16LE && wCodePage != FX_CODEPAGE_UTF16BE &&
- wCodePage != FX_CODEPAGE_UTF8) {
- wCodePage = FX_CODEPAGE_UTF8;
- pXMLStream->SetCodePage(wCodePage);
- }
- if (bSaveBOM) {
- pXMLStream->WriteString(L"\xFEFF", 1);
- }
- CFDE_XMLNode* pNode = m_pRoot->m_pChild;
- while (pNode) {
- SaveXMLNode(pXMLStream, static_cast<CFDE_XMLNode*>(pNode));
- pNode = pNode->m_pNext;
- }
- if (pXMLStream == m_pStream) {
- int32_t iPos = pXMLStream->GetPosition();
- pXMLStream->SetLength(iPos);
- }
-}
-
-CFDE_BlockBuffer::CFDE_BlockBuffer(int32_t iAllocStep)
- : m_iDataLength(0),
- m_iBufferSize(0),
- m_iAllocStep(iAllocStep),
- m_iStartPosition(0) {}
-
-CFDE_BlockBuffer::~CFDE_BlockBuffer() {
- ClearBuffer();
-}
-
-FX_WCHAR* CFDE_BlockBuffer::GetAvailableBlock(int32_t& iIndexInBlock) {
- iIndexInBlock = 0;
- if (!m_BlockArray.GetSize()) {
- return nullptr;
- }
- int32_t iRealIndex = m_iStartPosition + m_iDataLength;
- if (iRealIndex == m_iBufferSize) {
- FX_WCHAR* pBlock = FX_Alloc(FX_WCHAR, m_iAllocStep);
- m_BlockArray.Add(pBlock);
- m_iBufferSize += m_iAllocStep;
- return pBlock;
- }
- iIndexInBlock = iRealIndex % m_iAllocStep;
- return m_BlockArray[iRealIndex / m_iAllocStep];
-}
-
-bool CFDE_BlockBuffer::InitBuffer(int32_t iBufferSize) {
- ClearBuffer();
- int32_t iNumOfBlock = (iBufferSize - 1) / m_iAllocStep + 1;
- for (int32_t i = 0; i < iNumOfBlock; i++) {
- m_BlockArray.Add(FX_Alloc(FX_WCHAR, m_iAllocStep));
- }
- m_iBufferSize = iNumOfBlock * m_iAllocStep;
- return true;
-}
-
-void CFDE_BlockBuffer::SetTextChar(int32_t iIndex, FX_WCHAR ch) {
- if (iIndex < 0) {
- return;
- }
- int32_t iRealIndex = m_iStartPosition + iIndex;
- int32_t iBlockIndex = iRealIndex / m_iAllocStep;
- int32_t iInnerIndex = iRealIndex % m_iAllocStep;
- int32_t iBlockSize = m_BlockArray.GetSize();
- if (iBlockIndex >= iBlockSize) {
- int32_t iNewBlocks = iBlockIndex - iBlockSize + 1;
- do {
- FX_WCHAR* pBlock = FX_Alloc(FX_WCHAR, m_iAllocStep);
- m_BlockArray.Add(pBlock);
- m_iBufferSize += m_iAllocStep;
- } while (--iNewBlocks);
- }
- FX_WCHAR* pTextData = m_BlockArray[iBlockIndex];
- *(pTextData + iInnerIndex) = ch;
- if (m_iDataLength <= iIndex) {
- m_iDataLength = iIndex + 1;
- }
-}
-
-int32_t CFDE_BlockBuffer::DeleteTextChars(int32_t iCount, bool bDirection) {
- if (iCount <= 0) {
- return m_iDataLength;
- }
- if (iCount >= m_iDataLength) {
- Reset(false);
- return 0;
- }
- if (bDirection) {
- m_iStartPosition += iCount;
- m_iDataLength -= iCount;
- } else {
- m_iDataLength -= iCount;
- }
- return m_iDataLength;
-}
-
-void CFDE_BlockBuffer::GetTextData(CFX_WideString& wsTextData,
- int32_t iStart,
- int32_t iLength) const {
- wsTextData.clear();
- int32_t iMaybeDataLength = m_iBufferSize - 1 - m_iStartPosition;
- if (iStart < 0 || iStart > iMaybeDataLength) {
- return;
- }
- if (iLength == -1 || iLength > iMaybeDataLength) {
- iLength = iMaybeDataLength;
- }
- if (iLength <= 0) {
- return;
- }
- FX_WCHAR* pBuf = wsTextData.GetBuffer(iLength);
- if (!pBuf) {
- return;
- }
- int32_t iStartBlockIndex = 0;
- int32_t iStartInnerIndex = 0;
- TextDataIndex2BufIndex(iStart, iStartBlockIndex, iStartInnerIndex);
- int32_t iEndBlockIndex = 0;
- int32_t iEndInnerIndex = 0;
- TextDataIndex2BufIndex(iStart + iLength, iEndBlockIndex, iEndInnerIndex);
- int32_t iPointer = 0;
- for (int32_t i = iStartBlockIndex; i <= iEndBlockIndex; i++) {
- int32_t iBufferPointer = 0;
- int32_t iCopyLength = m_iAllocStep;
- if (i == iStartBlockIndex) {
- iCopyLength -= iStartInnerIndex;
- iBufferPointer = iStartInnerIndex;
- }
- if (i == iEndBlockIndex) {
- iCopyLength -= ((m_iAllocStep - 1) - iEndInnerIndex);
- }
- FX_WCHAR* pBlockBuf = m_BlockArray[i];
- FXSYS_memcpy(pBuf + iPointer, pBlockBuf + iBufferPointer,
- iCopyLength * sizeof(FX_WCHAR));
- iPointer += iCopyLength;
- }
- wsTextData.ReleaseBuffer(iLength);
-}
-
-void CFDE_BlockBuffer::TextDataIndex2BufIndex(const int32_t iIndex,
- int32_t& iBlockIndex,
- int32_t& iInnerIndex) const {
- ASSERT(iIndex >= 0);
- int32_t iRealIndex = m_iStartPosition + iIndex;
- iBlockIndex = iRealIndex / m_iAllocStep;
- iInnerIndex = iRealIndex % m_iAllocStep;
-}
-
-void CFDE_BlockBuffer::ClearBuffer() {
- m_iBufferSize = 0;
- int32_t iSize = m_BlockArray.GetSize();
- for (int32_t i = 0; i < iSize; i++) {
- FX_Free(m_BlockArray[i]);
- }
- m_BlockArray.RemoveAll();
-}
-
-CFDE_XMLSyntaxParser::CFDE_XMLSyntaxParser()
- : m_pStream(nullptr),
- m_iXMLPlaneSize(-1),
- m_iCurrentPos(0),
- m_iCurrentNodeNum(-1),
- m_iLastNodeNum(-1),
- m_iParsedChars(0),
- m_iParsedBytes(0),
- m_pBuffer(nullptr),
- m_iBufferChars(0),
- m_bEOS(false),
- m_pStart(nullptr),
- m_pEnd(nullptr),
- m_XMLNodeStack(16),
- m_iAllocStep(m_BlockBuffer.GetAllocStep()),
- m_iDataLength(m_BlockBuffer.GetDataLengthRef()),
- m_pCurrentBlock(nullptr),
- m_iIndexInBlock(0),
- m_iTextDataLength(0),
- m_syntaxParserResult(FDE_XmlSyntaxResult::None),
- m_syntaxParserState(FDE_XmlSyntaxState::Text),
- m_wQuotationMark(0),
- m_iEntityStart(-1),
- m_SkipStack(16) {
- m_CurNode.iNodeNum = -1;
- m_CurNode.eNodeType = FDE_XMLNODE_Unknown;
-}
-
-void CFDE_XMLSyntaxParser::Init(const CFX_RetainPtr<IFGAS_Stream>& pStream,
- int32_t iXMLPlaneSize,
- int32_t iTextDataSize) {
- ASSERT(!m_pStream && !m_pBuffer);
- ASSERT(pStream && iXMLPlaneSize > 0);
- int32_t iStreamLength = pStream->GetLength();
- ASSERT(iStreamLength > 0);
- m_pStream = pStream;
- m_iXMLPlaneSize = std::min(iXMLPlaneSize, iStreamLength);
- uint8_t bom[4];
- m_iCurrentPos = m_pStream->GetBOM(bom);
- ASSERT(!m_pBuffer);
-
- FX_SAFE_INT32 alloc_size_safe = m_iXMLPlaneSize;
- alloc_size_safe += 1; // For NUL.
- if (!alloc_size_safe.IsValid() || alloc_size_safe.ValueOrDie() <= 0) {
- m_syntaxParserResult = FDE_XmlSyntaxResult::Error;
- return;
- }
-
- m_pBuffer = FX_Alloc(
- FX_WCHAR, pdfium::base::ValueOrDieForType<size_t>(alloc_size_safe));
- m_pStart = m_pEnd = m_pBuffer;
- ASSERT(!m_BlockBuffer.IsInitialized());
- m_BlockBuffer.InitBuffer();
- m_pCurrentBlock = m_BlockBuffer.GetAvailableBlock(m_iIndexInBlock);
- m_iParsedBytes = m_iParsedChars = 0;
- m_iBufferChars = 0;
-}
-
-FDE_XmlSyntaxResult CFDE_XMLSyntaxParser::DoSyntaxParse() {
- if (m_syntaxParserResult == FDE_XmlSyntaxResult::Error ||
- m_syntaxParserResult == FDE_XmlSyntaxResult::EndOfString) {
- return m_syntaxParserResult;
- }
- ASSERT(m_pStream && m_pBuffer && m_BlockBuffer.IsInitialized());
- int32_t iStreamLength = m_pStream->GetLength();
- int32_t iPos;
-
- FDE_XmlSyntaxResult syntaxParserResult = FDE_XmlSyntaxResult::None;
- while (true) {
- if (m_pStart >= m_pEnd) {
- if (m_bEOS || m_iCurrentPos >= iStreamLength) {
- m_syntaxParserResult = FDE_XmlSyntaxResult::EndOfString;
- return m_syntaxParserResult;
- }
- m_iParsedChars += (m_pEnd - m_pBuffer);
- m_iParsedBytes = m_iCurrentPos;
- if (m_pStream->GetPosition() != m_iCurrentPos) {
- m_pStream->Seek(FX_STREAMSEEK_Begin, m_iCurrentPos);
- }
- m_iBufferChars =
- m_pStream->ReadString(m_pBuffer, m_iXMLPlaneSize, m_bEOS);
- iPos = m_pStream->GetPosition();
- if (m_iBufferChars < 1) {
- m_iCurrentPos = iStreamLength;
- m_syntaxParserResult = FDE_XmlSyntaxResult::EndOfString;
- return m_syntaxParserResult;
- }
- m_iCurrentPos = iPos;
- m_pStart = m_pBuffer;
- m_pEnd = m_pBuffer + m_iBufferChars;
- }
-
- while (m_pStart < m_pEnd) {
- FX_WCHAR ch = *m_pStart;
- switch (m_syntaxParserState) {
- case FDE_XmlSyntaxState::Text:
- if (ch == L'<') {
- if (m_iDataLength > 0) {
- m_iTextDataLength = m_iDataLength;
- m_BlockBuffer.Reset();
- m_pCurrentBlock =
- m_BlockBuffer.GetAvailableBlock(m_iIndexInBlock);
- m_iEntityStart = -1;
- syntaxParserResult = FDE_XmlSyntaxResult::Text;
- } else {
- m_pStart++;
- m_syntaxParserState = FDE_XmlSyntaxState::Node;
- }
- } else {
- ParseTextChar(ch);
- }
- break;
- case FDE_XmlSyntaxState::Node:
- if (ch == L'!') {
- m_pStart++;
- m_syntaxParserState = FDE_XmlSyntaxState::SkipCommentOrDecl;
- } else if (ch == L'/') {
- m_pStart++;
- m_syntaxParserState = FDE_XmlSyntaxState::CloseElement;
- } else if (ch == L'?') {
- m_iLastNodeNum++;
- m_iCurrentNodeNum = m_iLastNodeNum;
- m_CurNode.iNodeNum = m_iLastNodeNum;
- m_CurNode.eNodeType = FDE_XMLNODE_Instruction;
- m_XMLNodeStack.Push(m_CurNode);
- m_pStart++;
- m_syntaxParserState = FDE_XmlSyntaxState::Target;
- syntaxParserResult = FDE_XmlSyntaxResult::InstructionOpen;
- } else {
- m_iLastNodeNum++;
- m_iCurrentNodeNum = m_iLastNodeNum;
- m_CurNode.iNodeNum = m_iLastNodeNum;
- m_CurNode.eNodeType = FDE_XMLNODE_Element;
- m_XMLNodeStack.Push(m_CurNode);
- m_syntaxParserState = FDE_XmlSyntaxState::Tag;
- syntaxParserResult = FDE_XmlSyntaxResult::ElementOpen;
- }
- break;
- case FDE_XmlSyntaxState::Target:
- case FDE_XmlSyntaxState::Tag:
- if (!FDE_IsXMLNameChar(ch, m_iDataLength < 1)) {
- if (m_iDataLength < 1) {
- m_syntaxParserResult = FDE_XmlSyntaxResult::Error;
- return m_syntaxParserResult;
- } else {
- m_iTextDataLength = m_iDataLength;
- m_BlockBuffer.Reset();
- m_pCurrentBlock =
- m_BlockBuffer.GetAvailableBlock(m_iIndexInBlock);
- if (m_syntaxParserState != FDE_XmlSyntaxState::Target) {
- syntaxParserResult = FDE_XmlSyntaxResult::TagName;
- } else {
- syntaxParserResult = FDE_XmlSyntaxResult::TargetName;
- }
- m_syntaxParserState = FDE_XmlSyntaxState::AttriName;
- }
- } else {
- if (m_iIndexInBlock == m_iAllocStep) {
- m_pCurrentBlock =
- m_BlockBuffer.GetAvailableBlock(m_iIndexInBlock);
- if (!m_pCurrentBlock) {
- return FDE_XmlSyntaxResult::Error;
- }
- }
- m_pCurrentBlock[m_iIndexInBlock++] = ch;
- m_iDataLength++;
- m_pStart++;
- }
- break;
- case FDE_XmlSyntaxState::AttriName:
- if (m_iDataLength < 1 && FDE_IsXMLWhiteSpace(ch)) {
- m_pStart++;
- break;
- }
- if (!FDE_IsXMLNameChar(ch, m_iDataLength < 1)) {
- if (m_iDataLength < 1) {
- if (m_CurNode.eNodeType == FDE_XMLNODE_Element) {
- if (ch == L'>' || ch == L'/') {
- m_syntaxParserState = FDE_XmlSyntaxState::BreakElement;
- break;
- }
- } else if (m_CurNode.eNodeType == FDE_XMLNODE_Instruction) {
- if (ch == L'?') {
- m_syntaxParserState = FDE_XmlSyntaxState::CloseInstruction;
- m_pStart++;
- } else {
- m_syntaxParserState = FDE_XmlSyntaxState::TargetData;
- }
- break;
- }
- m_syntaxParserResult = FDE_XmlSyntaxResult::Error;
- return m_syntaxParserResult;
- } else {
- if (m_CurNode.eNodeType == FDE_XMLNODE_Instruction) {
- if (ch != '=' && !FDE_IsXMLWhiteSpace(ch)) {
- m_syntaxParserState = FDE_XmlSyntaxState::TargetData;
- break;
- }
- }
- m_iTextDataLength = m_iDataLength;
- m_BlockBuffer.Reset();
- m_pCurrentBlock =
- m_BlockBuffer.GetAvailableBlock(m_iIndexInBlock);
- m_syntaxParserState = FDE_XmlSyntaxState::AttriEqualSign;
- syntaxParserResult = FDE_XmlSyntaxResult::AttriName;
- }
- } else {
- if (m_iIndexInBlock == m_iAllocStep) {
- m_pCurrentBlock =
- m_BlockBuffer.GetAvailableBlock(m_iIndexInBlock);
- if (!m_pCurrentBlock) {
- return FDE_XmlSyntaxResult::Error;
- }
- }
- m_pCurrentBlock[m_iIndexInBlock++] = ch;
- m_iDataLength++;
- m_pStart++;
- }
- break;
- case FDE_XmlSyntaxState::AttriEqualSign:
- if (FDE_IsXMLWhiteSpace(ch)) {
- m_pStart++;
- break;
- }
- if (ch != L'=') {
- if (m_CurNode.eNodeType == FDE_XMLNODE_Instruction) {
- m_syntaxParserState = FDE_XmlSyntaxState::TargetData;
- break;
- }
- m_syntaxParserResult = FDE_XmlSyntaxResult::Error;
- return m_syntaxParserResult;
- } else {
- m_syntaxParserState = FDE_XmlSyntaxState::AttriQuotation;
- m_pStart++;
- }
- break;
- case FDE_XmlSyntaxState::AttriQuotation:
- if (FDE_IsXMLWhiteSpace(ch)) {
- m_pStart++;
- break;
- }
- if (ch != L'\"' && ch != L'\'') {
- m_syntaxParserResult = FDE_XmlSyntaxResult::Error;
- return m_syntaxParserResult;
- } else {
- m_wQuotationMark = ch;
- m_syntaxParserState = FDE_XmlSyntaxState::AttriValue;
- m_pStart++;
- }
- break;
- case FDE_XmlSyntaxState::AttriValue:
- if (ch == m_wQuotationMark) {
- if (m_iEntityStart > -1) {
- m_syntaxParserResult = FDE_XmlSyntaxResult::Error;
- return m_syntaxParserResult;
- }
- m_iTextDataLength = m_iDataLength;
- m_wQuotationMark = 0;
- m_BlockBuffer.Reset();
- m_pCurrentBlock = m_BlockBuffer.GetAvailableBlock(m_iIndexInBlock);
- m_pStart++;
- m_syntaxParserState = FDE_XmlSyntaxState::AttriName;
- syntaxParserResult = FDE_XmlSyntaxResult::AttriValue;
- } else {
- ParseTextChar(ch);
- }
- break;
- case FDE_XmlSyntaxState::CloseInstruction:
- if (ch != L'>') {
- if (m_iIndexInBlock == m_iAllocStep) {
- m_pCurrentBlock =
- m_BlockBuffer.GetAvailableBlock(m_iIndexInBlock);
- if (!m_pCurrentBlock) {
- return FDE_XmlSyntaxResult::Error;
- }
- }
- m_pCurrentBlock[m_iIndexInBlock++] = ch;
- m_iDataLength++;
- m_syntaxParserState = FDE_XmlSyntaxState::TargetData;
- } else if (m_iDataLength > 0) {
- m_iTextDataLength = m_iDataLength;
- m_BlockBuffer.Reset();
- m_pCurrentBlock = m_BlockBuffer.GetAvailableBlock(m_iIndexInBlock);
- syntaxParserResult = FDE_XmlSyntaxResult::TargetData;
- } else {
- m_pStart++;
- FDE_XMLNODE* pXMLNode = m_XMLNodeStack.GetTopElement();
- if (!pXMLNode) {
- m_syntaxParserResult = FDE_XmlSyntaxResult::Error;
- return m_syntaxParserResult;
- }
- m_XMLNodeStack.Pop();
- pXMLNode = m_XMLNodeStack.GetTopElement();
- if (pXMLNode) {
- m_CurNode = *pXMLNode;
- } else {
- m_CurNode.iNodeNum = -1;
- m_CurNode.eNodeType = FDE_XMLNODE_Unknown;
- }
- m_iCurrentNodeNum = m_CurNode.iNodeNum;
- m_BlockBuffer.Reset();
- m_pCurrentBlock = m_BlockBuffer.GetAvailableBlock(m_iIndexInBlock);
- m_syntaxParserState = FDE_XmlSyntaxState::Text;
- syntaxParserResult = FDE_XmlSyntaxResult::InstructionClose;
- }
- break;
- case FDE_XmlSyntaxState::BreakElement:
- if (ch == L'>') {
- m_syntaxParserState = FDE_XmlSyntaxState::Text;
- syntaxParserResult = FDE_XmlSyntaxResult::ElementBreak;
- } else if (ch == L'/') {
- m_syntaxParserState = FDE_XmlSyntaxState::CloseElement;
- } else {
- m_syntaxParserResult = FDE_XmlSyntaxResult::Error;
- return m_syntaxParserResult;
- }
- m_pStart++;
- break;
- case FDE_XmlSyntaxState::CloseElement:
- if (!FDE_IsXMLNameChar(ch, m_iDataLength < 1)) {
- if (ch == L'>') {
- FDE_XMLNODE* pXMLNode = m_XMLNodeStack.GetTopElement();
- if (!pXMLNode) {
- m_syntaxParserResult = FDE_XmlSyntaxResult::Error;
- return m_syntaxParserResult;
- }
- m_XMLNodeStack.Pop();
- pXMLNode = m_XMLNodeStack.GetTopElement();
- if (pXMLNode) {
- m_CurNode = *pXMLNode;
- } else {
- m_CurNode.iNodeNum = -1;
- m_CurNode.eNodeType = FDE_XMLNODE_Unknown;
- }
- m_iCurrentNodeNum = m_CurNode.iNodeNum;
- m_iTextDataLength = m_iDataLength;
- m_BlockBuffer.Reset();
- m_pCurrentBlock =
- m_BlockBuffer.GetAvailableBlock(m_iIndexInBlock);
- m_syntaxParserState = FDE_XmlSyntaxState::Text;
- syntaxParserResult = FDE_XmlSyntaxResult::ElementClose;
- } else if (!FDE_IsXMLWhiteSpace(ch)) {
- m_syntaxParserResult = FDE_XmlSyntaxResult::Error;
- return m_syntaxParserResult;
- }
- } else {
- if (m_iIndexInBlock == m_iAllocStep) {
- m_pCurrentBlock =
- m_BlockBuffer.GetAvailableBlock(m_iIndexInBlock);
- if (!m_pCurrentBlock) {
- return FDE_XmlSyntaxResult::Error;
- }
- }
- m_pCurrentBlock[m_iIndexInBlock++] = ch;
- m_iDataLength++;
- }
- m_pStart++;
- break;
- case FDE_XmlSyntaxState::SkipCommentOrDecl:
- if (FXSYS_wcsnicmp(m_pStart, L"--", 2) == 0) {
- m_pStart += 2;
- m_syntaxParserState = FDE_XmlSyntaxState::SkipComment;
- } else if (FXSYS_wcsnicmp(m_pStart, L"[CDATA[", 7) == 0) {
- m_pStart += 7;
- m_syntaxParserState = FDE_XmlSyntaxState::SkipCData;
- } else {
- m_syntaxParserState = FDE_XmlSyntaxState::SkipDeclNode;
- m_SkipChar = L'>';
- m_SkipStack.Push(L'>');
- }
- break;
- case FDE_XmlSyntaxState::SkipCData: {
- if (FXSYS_wcsnicmp(m_pStart, L"]]>", 3) == 0) {
- m_pStart += 3;
- syntaxParserResult = FDE_XmlSyntaxResult::CData;
- m_iTextDataLength = m_iDataLength;
- m_BlockBuffer.Reset();
- m_pCurrentBlock = m_BlockBuffer.GetAvailableBlock(m_iIndexInBlock);
- m_syntaxParserState = FDE_XmlSyntaxState::Text;
- } else {
- if (m_iIndexInBlock == m_iAllocStep) {
- m_pCurrentBlock =
- m_BlockBuffer.GetAvailableBlock(m_iIndexInBlock);
- if (!m_pCurrentBlock)
- return FDE_XmlSyntaxResult::Error;
- }
- m_pCurrentBlock[m_iIndexInBlock++] = ch;
- m_iDataLength++;
- m_pStart++;
- }
- break;
- }
- case FDE_XmlSyntaxState::SkipDeclNode:
- if (m_SkipChar == L'\'' || m_SkipChar == L'\"') {
- m_pStart++;
- if (ch != m_SkipChar)
- break;
-
- m_SkipStack.Pop();
- uint32_t* pDWord = m_SkipStack.GetTopElement();
- if (!pDWord)
- m_syntaxParserState = FDE_XmlSyntaxState::Text;
- else
- m_SkipChar = (FX_WCHAR)*pDWord;
- } else {
- switch (ch) {
- case L'<':
- m_SkipChar = L'>';
- m_SkipStack.Push(L'>');
- break;
- case L'[':
- m_SkipChar = L']';
- m_SkipStack.Push(L']');
- break;
- case L'(':
- m_SkipChar = L')';
- m_SkipStack.Push(L')');
- break;
- case L'\'':
- m_SkipChar = L'\'';
- m_SkipStack.Push(L'\'');
- break;
- case L'\"':
- m_SkipChar = L'\"';
- m_SkipStack.Push(L'\"');
- break;
- default:
- if (ch == m_SkipChar) {
- m_SkipStack.Pop();
- uint32_t* pDWord = m_SkipStack.GetTopElement();
- if (!pDWord) {
- if (m_iDataLength >= 9) {
- CFX_WideString wsHeader;
- m_BlockBuffer.GetTextData(wsHeader, 0, 7);
- }
- m_iTextDataLength = m_iDataLength;
- m_BlockBuffer.Reset();
- m_pCurrentBlock =
- m_BlockBuffer.GetAvailableBlock(m_iIndexInBlock);
- m_syntaxParserState = FDE_XmlSyntaxState::Text;
- } else {
- m_SkipChar = static_cast<FX_WCHAR>(*pDWord);
- }
- }
- break;
- }
- if (m_SkipStack.GetSize() > 0) {
- if (m_iIndexInBlock == m_iAllocStep) {
- m_pCurrentBlock =
- m_BlockBuffer.GetAvailableBlock(m_iIndexInBlock);
- if (!m_pCurrentBlock) {
- return FDE_XmlSyntaxResult::Error;
- }
- }
- m_pCurrentBlock[m_iIndexInBlock++] = ch;
- m_iDataLength++;
- }
- m_pStart++;
- }
- break;
- case FDE_XmlSyntaxState::SkipComment:
- if (FXSYS_wcsnicmp(m_pStart, L"-->", 3) == 0) {
- m_pStart += 2;
- m_syntaxParserState = FDE_XmlSyntaxState::Text;
- }
-
- m_pStart++;
- break;
- case FDE_XmlSyntaxState::TargetData:
- if (FDE_IsXMLWhiteSpace(ch)) {
- if (m_iDataLength < 1) {
- m_pStart++;
- break;
- } else if (m_wQuotationMark == 0) {
- m_iTextDataLength = m_iDataLength;
- m_wQuotationMark = 0;
- m_BlockBuffer.Reset();
- m_pCurrentBlock =
- m_BlockBuffer.GetAvailableBlock(m_iIndexInBlock);
- m_pStart++;
- syntaxParserResult = FDE_XmlSyntaxResult::TargetData;
- break;
- }
- }
- if (ch == '?') {
- m_syntaxParserState = FDE_XmlSyntaxState::CloseInstruction;
- m_pStart++;
- } else if (ch == '\"') {
- if (m_wQuotationMark == 0) {
- m_wQuotationMark = ch;
- m_pStart++;
- } else if (ch == m_wQuotationMark) {
- m_iTextDataLength = m_iDataLength;
- m_wQuotationMark = 0;
- m_BlockBuffer.Reset();
- m_pCurrentBlock =
- m_BlockBuffer.GetAvailableBlock(m_iIndexInBlock);
- m_pStart++;
- syntaxParserResult = FDE_XmlSyntaxResult::TargetData;
- } else {
- m_syntaxParserResult = FDE_XmlSyntaxResult::Error;
- return m_syntaxParserResult;
- }
- } else {
- if (m_iIndexInBlock == m_iAllocStep) {
- m_pCurrentBlock =
- m_BlockBuffer.GetAvailableBlock(m_iIndexInBlock);
- if (!m_pCurrentBlock) {
- return FDE_XmlSyntaxResult::Error;
- }
- }
- m_pCurrentBlock[m_iIndexInBlock++] = ch;
- m_iDataLength++;
- m_pStart++;
- }
- break;
- default:
- break;
- }
- if (syntaxParserResult != FDE_XmlSyntaxResult::None)
- return syntaxParserResult;
- }
- }
- return FDE_XmlSyntaxResult::Text;
-}
-
-CFDE_XMLSyntaxParser::~CFDE_XMLSyntaxParser() {
- m_pCurrentBlock = nullptr;
- FX_Free(m_pBuffer);
-}
-
-int32_t CFDE_XMLSyntaxParser::GetStatus() const {
- if (!m_pStream)
- return -1;
-
- int32_t iStreamLength = m_pStream->GetLength();
- if (iStreamLength < 1)
- return 100;
-
- if (m_syntaxParserResult == FDE_XmlSyntaxResult::Error)
- return -1;
-
- if (m_syntaxParserResult == FDE_XmlSyntaxResult::EndOfString)
- return 100;
- return m_iParsedBytes * 100 / iStreamLength;
-}
-
-static int32_t FX_GetUTF8EncodeLength(const FX_WCHAR* pSrc, int32_t iSrcLen) {
- uint32_t unicode = 0;
- int32_t iDstNum = 0;
- while (iSrcLen-- > 0) {
- unicode = *pSrc++;
- int nbytes = 0;
- if ((uint32_t)unicode < 0x80) {
- nbytes = 1;
- } else if ((uint32_t)unicode < 0x800) {
- nbytes = 2;
- } else if ((uint32_t)unicode < 0x10000) {
- nbytes = 3;
- } else if ((uint32_t)unicode < 0x200000) {
- nbytes = 4;
- } else if ((uint32_t)unicode < 0x4000000) {
- nbytes = 5;
- } else {
- nbytes = 6;
- }
- iDstNum += nbytes;
- }
- return iDstNum;
-}
-
-FX_FILESIZE CFDE_XMLSyntaxParser::GetCurrentBinaryPos() const {
- if (!m_pStream)
- return 0;
-
- int32_t nSrcLen = m_pStart - m_pBuffer;
- int32_t nDstLen = FX_GetUTF8EncodeLength(m_pBuffer, nSrcLen);
- return m_iParsedBytes + nDstLen;
-}
-
-void CFDE_XMLSyntaxParser::ParseTextChar(FX_WCHAR character) {
- if (m_iIndexInBlock == m_iAllocStep) {
- m_pCurrentBlock = m_BlockBuffer.GetAvailableBlock(m_iIndexInBlock);
- if (!m_pCurrentBlock) {
- return;
- }
- }
- m_pCurrentBlock[m_iIndexInBlock++] = character;
- m_iDataLength++;
- if (m_iEntityStart > -1 && character == L';') {
- CFX_WideString csEntity;
- m_BlockBuffer.GetTextData(csEntity, m_iEntityStart + 1,
- (m_iDataLength - 1) - m_iEntityStart - 1);
- int32_t iLen = csEntity.GetLength();
- if (iLen > 0) {
- if (csEntity[0] == L'#') {
- uint32_t ch = 0;
- FX_WCHAR w;
- if (iLen > 1 && csEntity[1] == L'x') {
- for (int32_t i = 2; i < iLen; i++) {
- w = csEntity[i];
- if (w >= L'0' && w <= L'9') {
- ch = (ch << 4) + w - L'0';
- } else if (w >= L'A' && w <= L'F') {
- ch = (ch << 4) + w - 55;
- } else if (w >= L'a' && w <= L'f') {
- ch = (ch << 4) + w - 87;
- } else {
- break;
- }
- }
- } else {
- for (int32_t i = 1; i < iLen; i++) {
- w = csEntity[i];
- if (w < L'0' || w > L'9')
- break;
- ch = ch * 10 + w - L'0';
- }
- }
- if (ch > kMaxCharRange)
- ch = ' ';
-
- character = static_cast<FX_WCHAR>(ch);
- if (character != 0) {
- m_BlockBuffer.SetTextChar(m_iEntityStart, character);
- m_iEntityStart++;
- }
- } else {
- if (csEntity.Compare(L"amp") == 0) {
- m_BlockBuffer.SetTextChar(m_iEntityStart, L'&');
- m_iEntityStart++;
- } else if (csEntity.Compare(L"lt") == 0) {
- m_BlockBuffer.SetTextChar(m_iEntityStart, L'<');
- m_iEntityStart++;
- } else if (csEntity.Compare(L"gt") == 0) {
- m_BlockBuffer.SetTextChar(m_iEntityStart, L'>');
- m_iEntityStart++;
- } else if (csEntity.Compare(L"apos") == 0) {
- m_BlockBuffer.SetTextChar(m_iEntityStart, L'\'');
- m_iEntityStart++;
- } else if (csEntity.Compare(L"quot") == 0) {
- m_BlockBuffer.SetTextChar(m_iEntityStart, L'\"');
- m_iEntityStart++;
- }
- }
- }
- m_BlockBuffer.DeleteTextChars(m_iDataLength - m_iEntityStart, false);
- m_pCurrentBlock = m_BlockBuffer.GetAvailableBlock(m_iIndexInBlock);
- m_iEntityStart = -1;
- } else {
- if (m_iEntityStart < 0 && character == L'&') {
- m_iEntityStart = m_iDataLength - 1;
- }
- }
- m_pStart++;
-}
diff --git a/chromium/third_party/pdfium/xfa/fde/xml/fde_xml_imp.h b/chromium/third_party/pdfium/xfa/fde/xml/fde_xml_imp.h
deleted file mode 100644
index 41e84bad17b..00000000000
--- a/chromium/third_party/pdfium/xfa/fde/xml/fde_xml_imp.h
+++ /dev/null
@@ -1,344 +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 XFA_FDE_XML_FDE_XML_IMP_H_
-#define XFA_FDE_XML_FDE_XML_IMP_H_
-
-#include <memory>
-#include <vector>
-
-#include "core/fxcrt/fx_system.h"
-#include "xfa/fde/xml/fde_xml.h"
-#include "xfa/fgas/crt/fgas_stream.h"
-#include "xfa/fgas/crt/fgas_utils.h"
-
-class CFDE_BlockBuffer;
-class CFDE_XMLInstruction;
-class CFDE_XMLElement;
-class CFDE_XMLText;
-class CFDE_XMLDoc;
-class CFDE_XMLDOMParser;
-class CFDE_XMLSyntaxParser;
-class IFDE_XMLParser;
-
-class CFDE_XMLNode {
- public:
- enum NodeItem {
- Root = 0,
- Parent,
- FirstSibling,
- PriorSibling,
- NextSibling,
- LastSibling,
- FirstNeighbor,
- PriorNeighbor,
- NextNeighbor,
- LastNeighbor,
- FirstChild,
- LastChild
- };
-
- CFDE_XMLNode();
- virtual ~CFDE_XMLNode();
-
- virtual FDE_XMLNODETYPE GetType() const;
- virtual CFDE_XMLNode* Clone(bool bRecursive);
-
- int32_t CountChildNodes() const;
- CFDE_XMLNode* GetChildNode(int32_t index) const;
- int32_t GetChildNodeIndex(CFDE_XMLNode* pNode) const;
- int32_t InsertChildNode(CFDE_XMLNode* pNode, int32_t index = -1);
- void RemoveChildNode(CFDE_XMLNode* pNode);
- void DeleteChildren();
- void CloneChildren(CFDE_XMLNode* pClone);
-
- CFDE_XMLNode* GetPath(const FX_WCHAR* pPath,
- int32_t iLength = -1,
- bool bQualifiedName = true) const;
-
- int32_t GetNodeLevel() const;
- CFDE_XMLNode* GetNodeItem(CFDE_XMLNode::NodeItem eItem) const;
- bool InsertNodeItem(CFDE_XMLNode::NodeItem eItem, CFDE_XMLNode* pNode);
- CFDE_XMLNode* RemoveNodeItem(CFDE_XMLNode::NodeItem eItem);
-
- void SaveXMLNode(const CFX_RetainPtr<IFGAS_Stream>& pXMLStream);
-
- CFDE_XMLNode* m_pParent;
- CFDE_XMLNode* m_pChild;
- CFDE_XMLNode* m_pPrior;
- CFDE_XMLNode* m_pNext;
-};
-
-class CFDE_XMLInstruction : public CFDE_XMLNode {
- public:
- explicit CFDE_XMLInstruction(const CFX_WideString& wsTarget);
- ~CFDE_XMLInstruction() override;
-
- // CFDE_XMLNode
- FDE_XMLNODETYPE GetType() const override;
- CFDE_XMLNode* Clone(bool bRecursive) override;
-
- void GetTargetName(CFX_WideString& wsTarget) const { wsTarget = m_wsTarget; }
- int32_t CountAttributes() const;
- bool GetAttribute(int32_t index,
- CFX_WideString& wsAttriName,
- CFX_WideString& wsAttriValue) const;
- bool HasAttribute(const FX_WCHAR* pwsAttriName) const;
- void GetString(const FX_WCHAR* pwsAttriName,
- CFX_WideString& wsAttriValue,
- const FX_WCHAR* pwsDefValue = nullptr) const;
- void SetString(const CFX_WideString& wsAttriName,
- const CFX_WideString& wsAttriValue);
- int32_t GetInteger(const FX_WCHAR* pwsAttriName, int32_t iDefValue = 0) const;
- void SetInteger(const FX_WCHAR* pwsAttriName, int32_t iAttriValue);
- FX_FLOAT GetFloat(const FX_WCHAR* pwsAttriName, FX_FLOAT fDefValue = 0) const;
- void SetFloat(const FX_WCHAR* pwsAttriName, FX_FLOAT fAttriValue);
- void RemoveAttribute(const FX_WCHAR* pwsAttriName);
- int32_t CountData() const;
- bool GetData(int32_t index, CFX_WideString& wsData) const;
- void AppendData(const CFX_WideString& wsData);
- void RemoveData(int32_t index);
-
- CFX_WideString m_wsTarget;
- std::vector<CFX_WideString> m_Attributes;
- std::vector<CFX_WideString> m_TargetData;
-};
-
-class CFDE_XMLElement : public CFDE_XMLNode {
- public:
- explicit CFDE_XMLElement(const CFX_WideString& wsTag);
- ~CFDE_XMLElement() override;
-
- // CFDE_XMLNode
- FDE_XMLNODETYPE GetType() const override;
- CFDE_XMLNode* Clone(bool bRecursive) override;
-
- void GetTagName(CFX_WideString& wsTag) const;
- void GetLocalTagName(CFX_WideString& wsTag) const;
-
- void GetNamespacePrefix(CFX_WideString& wsPrefix) const;
- void GetNamespaceURI(CFX_WideString& wsNamespace) const;
-
- int32_t CountAttributes() const;
- bool GetAttribute(int32_t index,
- CFX_WideString& wsAttriName,
- CFX_WideString& wsAttriValue) const;
- bool HasAttribute(const FX_WCHAR* pwsAttriName) const;
- void RemoveAttribute(const FX_WCHAR* pwsAttriName);
-
- void GetString(const FX_WCHAR* pwsAttriName,
- CFX_WideString& wsAttriValue,
- const FX_WCHAR* pwsDefValue = nullptr) const;
- void SetString(const CFX_WideString& wsAttriName,
- const CFX_WideString& wsAttriValue);
-
- int32_t GetInteger(const FX_WCHAR* pwsAttriName, int32_t iDefValue = 0) const;
- void SetInteger(const FX_WCHAR* pwsAttriName, int32_t iAttriValue);
-
- FX_FLOAT GetFloat(const FX_WCHAR* pwsAttriName, FX_FLOAT fDefValue = 0) const;
- void SetFloat(const FX_WCHAR* pwsAttriName, FX_FLOAT fAttriValue);
-
- void GetTextData(CFX_WideString& wsText) const;
- void SetTextData(const CFX_WideString& wsText);
-
- CFX_WideString m_wsTag;
- std::vector<CFX_WideString> m_Attributes;
-};
-
-class CFDE_XMLText : public CFDE_XMLNode {
- public:
- explicit CFDE_XMLText(const CFX_WideString& wsText);
- ~CFDE_XMLText() override;
-
- // CFDE_XMLNode
- FDE_XMLNODETYPE GetType() const override;
- CFDE_XMLNode* Clone(bool bRecursive) override;
-
- void GetText(CFX_WideString& wsText) const { wsText = m_wsText; }
- void SetText(const CFX_WideString& wsText) { m_wsText = wsText; }
-
- CFX_WideString m_wsText;
-};
-
-class CFDE_XMLDeclaration : public CFDE_XMLNode {
- public:
- CFDE_XMLDeclaration() {}
- ~CFDE_XMLDeclaration() override {}
-};
-
-class CFDE_XMLCharData : public CFDE_XMLDeclaration {
- public:
- explicit CFDE_XMLCharData(const CFX_WideString& wsCData);
- ~CFDE_XMLCharData() override;
-
- FDE_XMLNODETYPE GetType() const override;
- CFDE_XMLNode* Clone(bool bRecursive) override;
-
- void GetCharData(CFX_WideString& wsCharData) const {
- wsCharData = m_wsCharData;
- }
- void SetCharData(const CFX_WideString& wsCData) { m_wsCharData = wsCData; }
-
- CFX_WideString m_wsCharData;
-};
-
-class CFDE_XMLDoc {
- public:
- CFDE_XMLDoc();
- ~CFDE_XMLDoc();
-
- bool LoadXML(std::unique_ptr<IFDE_XMLParser> pXMLParser);
- int32_t DoLoad(IFX_Pause* pPause = nullptr);
- void CloseXML();
- CFDE_XMLNode* GetRoot() const { return m_pRoot; }
- void SaveXML(CFX_RetainPtr<IFGAS_Stream>& pXMLStream, bool bSaveBOM = true);
- void SaveXMLNode(const CFX_RetainPtr<IFGAS_Stream>& pXMLStream,
- CFDE_XMLNode* pNode);
-
- protected:
- void Reset(bool bInitRoot);
- void ReleaseParser();
-
- CFX_RetainPtr<IFGAS_Stream> m_pStream;
- int32_t m_iStatus;
- CFDE_XMLNode* m_pRoot;
- std::unique_ptr<IFDE_XMLParser> m_pXMLParser;
-};
-
-class IFDE_XMLParser {
- public:
- virtual ~IFDE_XMLParser() {}
- virtual int32_t DoParser(IFX_Pause* pPause) = 0;
-};
-
-class CFDE_BlockBuffer {
- public:
- explicit CFDE_BlockBuffer(int32_t iAllocStep = 1024 * 1024);
- ~CFDE_BlockBuffer();
-
- bool InitBuffer(int32_t iBufferSize = 1024 * 1024);
- bool IsInitialized() { return m_iBufferSize / m_iAllocStep >= 1; }
- FX_WCHAR* GetAvailableBlock(int32_t& iIndexInBlock);
- inline int32_t GetAllocStep() const { return m_iAllocStep; }
- inline int32_t& GetDataLengthRef() { return m_iDataLength; }
- inline void Reset(bool bReserveData = true) {
- if (!bReserveData) {
- m_iStartPosition = 0;
- }
- m_iDataLength = 0;
- }
- void SetTextChar(int32_t iIndex, FX_WCHAR ch);
- int32_t DeleteTextChars(int32_t iCount, bool bDirection = true);
- void GetTextData(CFX_WideString& wsTextData,
- int32_t iStart = 0,
- int32_t iLength = -1) const;
-
- protected:
- inline void TextDataIndex2BufIndex(const int32_t iIndex,
- int32_t& iBlockIndex,
- int32_t& iInnerIndex) const;
- void ClearBuffer();
-
- CFX_ArrayTemplate<FX_WCHAR*> m_BlockArray;
- int32_t m_iDataLength;
- int32_t m_iBufferSize;
- int32_t m_iAllocStep;
- int32_t m_iStartPosition;
-};
-
-class CFDE_XMLSyntaxParser {
- public:
- CFDE_XMLSyntaxParser();
- ~CFDE_XMLSyntaxParser();
-
- void Init(const CFX_RetainPtr<IFGAS_Stream>& pStream,
- int32_t iXMLPlaneSize,
- int32_t iTextDataSize = 256);
-
- FDE_XmlSyntaxResult DoSyntaxParse();
-
- int32_t GetStatus() const;
- int32_t GetCurrentPos() const {
- return m_iParsedChars + (m_pStart - m_pBuffer);
- }
- FX_FILESIZE GetCurrentBinaryPos() const;
- int32_t GetCurrentNodeNumber() const { return m_iCurrentNodeNum; }
- int32_t GetLastNodeNumber() const { return m_iLastNodeNum; }
-
- void GetTargetName(CFX_WideString& wsTarget) const {
- m_BlockBuffer.GetTextData(wsTarget, 0, m_iTextDataLength);
- }
- void GetTagName(CFX_WideString& wsTag) const {
- m_BlockBuffer.GetTextData(wsTag, 0, m_iTextDataLength);
- }
- void GetAttributeName(CFX_WideString& wsAttriName) const {
- m_BlockBuffer.GetTextData(wsAttriName, 0, m_iTextDataLength);
- }
- void GetAttributeValue(CFX_WideString& wsAttriValue) const {
- m_BlockBuffer.GetTextData(wsAttriValue, 0, m_iTextDataLength);
- }
- void GetTextData(CFX_WideString& wsText) const {
- m_BlockBuffer.GetTextData(wsText, 0, m_iTextDataLength);
- }
- void GetTargetData(CFX_WideString& wsData) const {
- m_BlockBuffer.GetTextData(wsData, 0, m_iTextDataLength);
- }
-
- protected:
- enum class FDE_XmlSyntaxState {
- Text,
- Node,
- Target,
- Tag,
- AttriName,
- AttriEqualSign,
- AttriQuotation,
- AttriValue,
- Entity,
- EntityDecimal,
- EntityHex,
- CloseInstruction,
- BreakElement,
- CloseElement,
- SkipDeclNode,
- DeclCharData,
- SkipComment,
- SkipCommentOrDecl,
- SkipCData,
- TargetData
- };
-
- void ParseTextChar(FX_WCHAR ch);
-
- CFX_RetainPtr<IFGAS_Stream> m_pStream;
- int32_t m_iXMLPlaneSize;
- int32_t m_iCurrentPos;
- int32_t m_iCurrentNodeNum;
- int32_t m_iLastNodeNum;
- int32_t m_iParsedChars;
- int32_t m_iParsedBytes;
- FX_WCHAR* m_pBuffer;
- int32_t m_iBufferChars;
- bool m_bEOS;
- FX_WCHAR* m_pStart;
- FX_WCHAR* m_pEnd;
- FDE_XMLNODE m_CurNode;
- CFX_StackTemplate<FDE_XMLNODE> m_XMLNodeStack;
- CFDE_BlockBuffer m_BlockBuffer;
- int32_t m_iAllocStep;
- int32_t& m_iDataLength;
- FX_WCHAR* m_pCurrentBlock;
- int32_t m_iIndexInBlock;
- int32_t m_iTextDataLength;
- FDE_XmlSyntaxResult m_syntaxParserResult;
- FDE_XmlSyntaxState m_syntaxParserState;
- FX_WCHAR m_wQuotationMark;
- int32_t m_iEntityStart;
- CFX_StackTemplate<uint32_t> m_SkipStack;
- FX_WCHAR m_SkipChar;
-};
-
-#endif // XFA_FDE_XML_FDE_XML_IMP_H_
diff --git a/chromium/third_party/pdfium/xfa/fde/xml/fde_xml_imp_unittest.cpp b/chromium/third_party/pdfium/xfa/fde/xml/fde_xml_imp_unittest.cpp
deleted file mode 100644
index 6db1b1905af..00000000000
--- a/chromium/third_party/pdfium/xfa/fde/xml/fde_xml_imp_unittest.cpp
+++ /dev/null
@@ -1,632 +0,0 @@
-// Copyright 2016 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "xfa/fde/xml/fde_xml_imp.h"
-
-#include <memory>
-
-#include "testing/gtest/include/gtest/gtest.h"
-#include "xfa/fgas/crt/fgas_stream.h"
-
-TEST(CFDE_XMLSyntaxParser, CData) {
- const FX_WCHAR* input =
- L"<script contentType=\"application/x-javascript\">\n"
- L" <![CDATA[\n"
- L" if (a[1] < 3)\n"
- L" app.alert(\"Tclams\");\n"
- L" ]]>\n"
- L"</script>";
-
- const FX_WCHAR* cdata =
- L"\n"
- L" if (a[1] < 3)\n"
- L" app.alert(\"Tclams\");\n"
- L" ";
-
- // We * sizeof(FX_WCHAR) because we pass in the uint8_t, not the FX_WCHAR.
- size_t len = FXSYS_wcslen(input) * sizeof(FX_WCHAR);
- CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream(
- reinterpret_cast<uint8_t*>(const_cast<FX_WCHAR*>(input)), len, 0);
- CFDE_XMLSyntaxParser parser;
- parser.Init(stream, 256);
- EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
- EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
-
- CFX_WideString data;
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
-
- EXPECT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
- parser.GetAttributeName(data);
- EXPECT_EQ(L"contentType", data);
- EXPECT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
- parser.GetAttributeValue(data);
- EXPECT_EQ(L"application/x-javascript", data);
-
- EXPECT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
- EXPECT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(L"\n ", data);
-
- EXPECT_EQ(FDE_XmlSyntaxResult::CData, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(cdata, data);
-
- EXPECT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(L"\n", data);
-
- EXPECT_EQ(FDE_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse());
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
-
- EXPECT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
-}
-
-TEST(CFDE_XMLSyntaxParser, CDataWithInnerScript) {
- const FX_WCHAR* input =
- L"<script contentType=\"application/x-javascript\">\n"
- L" <![CDATA[\n"
- L" if (a[1] < 3)\n"
- L" app.alert(\"Tclams\");\n"
- L" </script>\n"
- L" ]]>\n"
- L"</script>";
-
- const FX_WCHAR* cdata =
- L"\n"
- L" if (a[1] < 3)\n"
- L" app.alert(\"Tclams\");\n"
- L" </script>\n"
- L" ";
-
- // We * sizeof(FX_WCHAR) because we pass in the uint8_t, not the FX_WCHAR.
- size_t len = FXSYS_wcslen(input) * sizeof(FX_WCHAR);
- CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream(
- reinterpret_cast<uint8_t*>(const_cast<FX_WCHAR*>(input)), len, 0);
- CFDE_XMLSyntaxParser parser;
- parser.Init(stream, 256);
- EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
- EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
-
- CFX_WideString data;
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
-
- EXPECT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
- parser.GetAttributeName(data);
- EXPECT_EQ(L"contentType", data);
- EXPECT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
- parser.GetAttributeValue(data);
- EXPECT_EQ(L"application/x-javascript", data);
-
- EXPECT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
- EXPECT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(L"\n ", data);
-
- EXPECT_EQ(FDE_XmlSyntaxResult::CData, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(cdata, data);
-
- EXPECT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(L"\n", data);
-
- EXPECT_EQ(FDE_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse());
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
-
- EXPECT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
-}
-
-TEST(CFDE_XMLSyntaxParser, ArrowBangArrow) {
- const FX_WCHAR* input =
- L"<script contentType=\"application/x-javascript\">\n"
- L" <!>\n"
- L"</script>";
-
- // We * sizeof(FX_WCHAR) because we pass in the uint8_t, not the FX_WCHAR.
- size_t len = FXSYS_wcslen(input) * sizeof(FX_WCHAR);
- CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream(
- reinterpret_cast<uint8_t*>(const_cast<FX_WCHAR*>(input)), len, 0);
- CFDE_XMLSyntaxParser parser;
- parser.Init(stream, 256);
- EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
- EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
-
- CFX_WideString data;
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
-
- EXPECT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
- parser.GetAttributeName(data);
- EXPECT_EQ(L"contentType", data);
- EXPECT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
- parser.GetAttributeValue(data);
- EXPECT_EQ(L"application/x-javascript", data);
-
- EXPECT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
- EXPECT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(L"\n ", data);
-
- EXPECT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(L"\n", data);
-
- EXPECT_EQ(FDE_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse());
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
-
- EXPECT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
-}
-
-TEST(CFDE_XMLSyntaxParser, ArrowBangBracketArrow) {
- const FX_WCHAR* input =
- L"<script contentType=\"application/x-javascript\">\n"
- L" <![>\n"
- L"</script>";
-
- // We * sizeof(FX_WCHAR) because we pass in the uint8_t, not the FX_WCHAR.
- size_t len = FXSYS_wcslen(input) * sizeof(FX_WCHAR);
- CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream(
- reinterpret_cast<uint8_t*>(const_cast<FX_WCHAR*>(input)), len, 0);
- CFDE_XMLSyntaxParser parser;
- parser.Init(stream, 256);
- EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
- EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
-
- CFX_WideString data;
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
-
- EXPECT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
- parser.GetAttributeName(data);
- EXPECT_EQ(L"contentType", data);
- EXPECT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
- parser.GetAttributeValue(data);
- EXPECT_EQ(L"application/x-javascript", data);
-
- EXPECT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
- EXPECT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(L"\n ", data);
-
- // Parser walks to end of input.
-
- EXPECT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
-}
-
-TEST(CFDE_XMLSyntaxParser, IncompleteCData) {
- const FX_WCHAR* input =
- L"<script contentType=\"application/x-javascript\">\n"
- L" <![CDATA>\n"
- L"</script>";
-
- // We * sizeof(FX_WCHAR) because we pass in the uint8_t, not the FX_WCHAR.
- size_t len = FXSYS_wcslen(input) * sizeof(FX_WCHAR);
- CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream(
- reinterpret_cast<uint8_t*>(const_cast<FX_WCHAR*>(input)), len, 0);
- CFDE_XMLSyntaxParser parser;
- parser.Init(stream, 256);
- EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
- EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
-
- CFX_WideString data;
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
-
- EXPECT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
- parser.GetAttributeName(data);
- EXPECT_EQ(L"contentType", data);
- EXPECT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
- parser.GetAttributeValue(data);
- EXPECT_EQ(L"application/x-javascript", data);
-
- EXPECT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
- EXPECT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(L"\n ", data);
-
- // Parser walks to end of input.
-
- EXPECT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
-}
-
-TEST(CFDE_XMLSyntaxParser, UnClosedCData) {
- const FX_WCHAR* input =
- L"<script contentType=\"application/x-javascript\">\n"
- L" <![CDATA[\n"
- L"</script>";
-
- // We * sizeof(FX_WCHAR) because we pass in the uint8_t, not the FX_WCHAR.
- size_t len = FXSYS_wcslen(input) * sizeof(FX_WCHAR);
- CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream(
- reinterpret_cast<uint8_t*>(const_cast<FX_WCHAR*>(input)), len, 0);
- CFDE_XMLSyntaxParser parser;
- parser.Init(stream, 256);
- EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
- EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
-
- CFX_WideString data;
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
-
- EXPECT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
- parser.GetAttributeName(data);
- EXPECT_EQ(L"contentType", data);
- EXPECT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
- parser.GetAttributeValue(data);
- EXPECT_EQ(L"application/x-javascript", data);
-
- EXPECT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
- EXPECT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(L"\n ", data);
-
- // Parser walks to end of input.
-
- EXPECT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
-}
-
-TEST(CFDE_XMLSyntaxParser, EmptyCData) {
- const FX_WCHAR* input =
- L"<script contentType=\"application/x-javascript\">\n"
- L" <![CDATA[]]>\n"
- L"</script>";
-
- // We * sizeof(FX_WCHAR) because we pass in the uint8_t, not the FX_WCHAR.
- size_t len = FXSYS_wcslen(input) * sizeof(FX_WCHAR);
- CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream(
- reinterpret_cast<uint8_t*>(const_cast<FX_WCHAR*>(input)), len, 0);
- CFDE_XMLSyntaxParser parser;
- parser.Init(stream, 256);
- EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
- EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
-
- CFX_WideString data;
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
-
- EXPECT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
- parser.GetAttributeName(data);
- EXPECT_EQ(L"contentType", data);
- EXPECT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
- parser.GetAttributeValue(data);
- EXPECT_EQ(L"application/x-javascript", data);
-
- EXPECT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
- EXPECT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(L"\n ", data);
-
- EXPECT_EQ(FDE_XmlSyntaxResult::CData, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(L"", data);
-
- EXPECT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(L"\n", data);
-
- EXPECT_EQ(FDE_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse());
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
-
- EXPECT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
-}
-
-TEST(CFDE_XMLSyntaxParser, Comment) {
- const FX_WCHAR* input =
- L"<script contentType=\"application/x-javascript\">\n"
- L" <!-- A Comment -->\n"
- L"</script>";
-
- // We * sizeof(FX_WCHAR) because we pass in the uint8_t, not the FX_WCHAR.
- size_t len = FXSYS_wcslen(input) * sizeof(FX_WCHAR);
- CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream(
- reinterpret_cast<uint8_t*>(const_cast<FX_WCHAR*>(input)), len, 0);
- CFDE_XMLSyntaxParser parser;
- parser.Init(stream, 256);
- EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
- EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
-
- CFX_WideString data;
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
-
- EXPECT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
- parser.GetAttributeName(data);
- EXPECT_EQ(L"contentType", data);
- EXPECT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
- parser.GetAttributeValue(data);
- EXPECT_EQ(L"application/x-javascript", data);
-
- EXPECT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
- EXPECT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(L"\n ", data);
-
- EXPECT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(L"\n", data);
-
- EXPECT_EQ(FDE_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse());
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
-
- EXPECT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
-}
-
-TEST(CFDE_XMLSyntaxParser, IncorrectCommentStart) {
- const FX_WCHAR* input =
- L"<script contentType=\"application/x-javascript\">\n"
- L" <!- A Comment -->\n"
- L"</script>";
-
- // We * sizeof(FX_WCHAR) because we pass in the uint8_t, not the FX_WCHAR.
- size_t len = FXSYS_wcslen(input) * sizeof(FX_WCHAR);
- CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream(
- reinterpret_cast<uint8_t*>(const_cast<FX_WCHAR*>(input)), len, 0);
- CFDE_XMLSyntaxParser parser;
- parser.Init(stream, 256);
- EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
- EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
-
- CFX_WideString data;
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
-
- EXPECT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
- parser.GetAttributeName(data);
- EXPECT_EQ(L"contentType", data);
- EXPECT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
- parser.GetAttributeValue(data);
- EXPECT_EQ(L"application/x-javascript", data);
-
- EXPECT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
- EXPECT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(L"\n ", data);
-
- EXPECT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(L"\n", data);
-
- EXPECT_EQ(FDE_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse());
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
-
- EXPECT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
-}
-
-TEST(CFDE_XMLSyntaxParser, CommentEmpty) {
- const FX_WCHAR* input =
- L"<script contentType=\"application/x-javascript\">\n"
- L" <!---->\n"
- L"</script>";
-
- // We * sizeof(FX_WCHAR) because we pass in the uint8_t, not the FX_WCHAR.
- size_t len = FXSYS_wcslen(input) * sizeof(FX_WCHAR);
- CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream(
- reinterpret_cast<uint8_t*>(const_cast<FX_WCHAR*>(input)), len, 0);
- CFDE_XMLSyntaxParser parser;
- parser.Init(stream, 256);
- EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
- EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
-
- CFX_WideString data;
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
-
- EXPECT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
- parser.GetAttributeName(data);
- EXPECT_EQ(L"contentType", data);
- EXPECT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
- parser.GetAttributeValue(data);
- EXPECT_EQ(L"application/x-javascript", data);
-
- EXPECT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
- EXPECT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(L"\n ", data);
-
- EXPECT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(L"\n", data);
-
- EXPECT_EQ(FDE_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse());
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
-
- EXPECT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
-}
-
-TEST(CFDE_XMLSyntaxParser, CommentThreeDash) {
- const FX_WCHAR* input =
- L"<script contentType=\"application/x-javascript\">\n"
- L" <!--->\n"
- L"</script>";
-
- // We * sizeof(FX_WCHAR) because we pass in the uint8_t, not the FX_WCHAR.
- size_t len = FXSYS_wcslen(input) * sizeof(FX_WCHAR);
- CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream(
- reinterpret_cast<uint8_t*>(const_cast<FX_WCHAR*>(input)), len, 0);
- CFDE_XMLSyntaxParser parser;
- parser.Init(stream, 256);
- EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
- EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
-
- CFX_WideString data;
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
-
- EXPECT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
- parser.GetAttributeName(data);
- EXPECT_EQ(L"contentType", data);
- EXPECT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
- parser.GetAttributeValue(data);
- EXPECT_EQ(L"application/x-javascript", data);
-
- EXPECT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
- EXPECT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(L"\n ", data);
-
- EXPECT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
-}
-
-TEST(CFDE_XMLSyntaxParser, CommentTwoDash) {
- const FX_WCHAR* input =
- L"<script contentType=\"application/x-javascript\">\n"
- L" <!-->\n"
- L"</script>";
-
- // We * sizeof(FX_WCHAR) because we pass in the uint8_t, not the FX_WCHAR.
- size_t len = FXSYS_wcslen(input) * sizeof(FX_WCHAR);
- CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream(
- reinterpret_cast<uint8_t*>(const_cast<FX_WCHAR*>(input)), len, 0);
- CFDE_XMLSyntaxParser parser;
- parser.Init(stream, 256);
- EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
- EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
-
- CFX_WideString data;
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
-
- EXPECT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
- parser.GetAttributeName(data);
- EXPECT_EQ(L"contentType", data);
- EXPECT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
- parser.GetAttributeValue(data);
- EXPECT_EQ(L"application/x-javascript", data);
-
- EXPECT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
- EXPECT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(L"\n ", data);
-
- EXPECT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
-}
-
-TEST(CFDE_XMLSyntaxParser, Entities) {
- const FX_WCHAR* input =
- L"<script contentType=\"application/x-javascript\">"
- L"&#66;"
- L"&#x54;"
- L"&#x00000000000000000048;"
- L"&#x0000000000000000AB48;"
- L"&#x0000000000000000000;"
- L"</script>";
-
- // We * sizeof(FX_WCHAR) because we pass in the uint8_t, not the FX_WCHAR.
- size_t len = FXSYS_wcslen(input) * sizeof(FX_WCHAR);
- CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream(
- reinterpret_cast<uint8_t*>(const_cast<FX_WCHAR*>(input)), len, 0);
- CFDE_XMLSyntaxParser parser;
- parser.Init(stream, 256);
- EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
- EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
-
- CFX_WideString data;
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
-
- EXPECT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
- parser.GetAttributeName(data);
- EXPECT_EQ(L"contentType", data);
- EXPECT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
- parser.GetAttributeValue(data);
- EXPECT_EQ(L"application/x-javascript", data);
-
- EXPECT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
- EXPECT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(L"BTH\xab48", data);
-
- EXPECT_EQ(FDE_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse());
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
-
- EXPECT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
-}
-
-TEST(CFDE_XMLSyntaxParser, EntityOverflowHex) {
- const FX_WCHAR* input =
- L"<script contentType=\"application/x-javascript\">"
- L"&#xaDBDFFFFF;"
- L"&#xafffffffffffffffffffffffffffffffff;"
- L"</script>";
-
- // We * sizeof(FX_WCHAR) because we pass in the uint8_t, not the FX_WCHAR.
- size_t len = FXSYS_wcslen(input) * sizeof(FX_WCHAR);
- CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream(
- reinterpret_cast<uint8_t*>(const_cast<FX_WCHAR*>(input)), len, 0);
- CFDE_XMLSyntaxParser parser;
- parser.Init(stream, 256);
- EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
- EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
-
- CFX_WideString data;
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
-
- EXPECT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
- parser.GetAttributeName(data);
- EXPECT_EQ(L"contentType", data);
- EXPECT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
- parser.GetAttributeValue(data);
- EXPECT_EQ(L"application/x-javascript", data);
-
- EXPECT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
- EXPECT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(L" ", data);
-
- EXPECT_EQ(FDE_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse());
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
-
- EXPECT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
-}
-
-TEST(CFDE_XMLSyntaxParser, EntityOverflowDecimal) {
- const FX_WCHAR* input =
- L"<script contentType=\"application/x-javascript\">"
- L"&#2914910205;"
- L"&#29149102052342342134521341234512351234213452315;"
- L"</script>";
-
- // We * sizeof(FX_WCHAR) because we pass in the uint8_t, not the FX_WCHAR.
- size_t len = FXSYS_wcslen(input) * sizeof(FX_WCHAR);
- CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream(
- reinterpret_cast<uint8_t*>(const_cast<FX_WCHAR*>(input)), len, 0);
- CFDE_XMLSyntaxParser parser;
- parser.Init(stream, 256);
- EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
- EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
-
- CFX_WideString data;
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
-
- EXPECT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
- parser.GetAttributeName(data);
- EXPECT_EQ(L"contentType", data);
- EXPECT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
- parser.GetAttributeValue(data);
- EXPECT_EQ(L"application/x-javascript", data);
-
- EXPECT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
- EXPECT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(L" ", data);
-
- EXPECT_EQ(FDE_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse());
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
-
- EXPECT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
-}
diff --git a/chromium/third_party/pdfium/xfa/fgas/crt/cfgas_formatstring.cpp b/chromium/third_party/pdfium/xfa/fgas/crt/cfgas_formatstring.cpp
new file mode 100644
index 00000000000..6cb82819935
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fgas/crt/cfgas_formatstring.cpp
@@ -0,0 +1,2739 @@
+// 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
+
+#include "xfa/fgas/crt/cfgas_formatstring.h"
+
+#include <algorithm>
+#include <vector>
+
+#include "core/fxcrt/cfx_decimal.h"
+#include "core/fxcrt/fx_ext.h"
+#include "core/fxcrt/xml/cxml_element.h"
+
+#define FX_LOCALECATEGORY_DateHash 0xbde9abde
+#define FX_LOCALECATEGORY_TimeHash 0x2d71b00f
+#define FX_LOCALECATEGORY_DateTimeHash 0x158c72ed
+#define FX_LOCALECATEGORY_NumHash 0x0b4ff870
+#define FX_LOCALECATEGORY_TextHash 0x2d08af85
+#define FX_LOCALECATEGORY_ZeroHash 0x568cb500
+#define FX_LOCALECATEGORY_NullHash 0x052931bb
+
+namespace {
+
+struct FX_LOCALESUBCATEGORYINFO {
+ uint32_t uHash;
+ const wchar_t* pName;
+ int32_t eSubCategory;
+};
+
+const FX_LOCALESUBCATEGORYINFO g_FXLocaleDateTimeSubCatData[] = {
+ {0x14da2125, L"default", FX_LOCALEDATETIMESUBCATEGORY_Default},
+ {0x9041d4b0, L"short", FX_LOCALEDATETIMESUBCATEGORY_Short},
+ {0xa084a381, L"medium", FX_LOCALEDATETIMESUBCATEGORY_Medium},
+ {0xcdce56b3, L"full", FX_LOCALEDATETIMESUBCATEGORY_Full},
+ {0xf6b4afb0, L"long", FX_LOCALEDATETIMESUBCATEGORY_Long},
+};
+const int32_t g_iFXLocaleDateTimeSubCatCount =
+ sizeof(g_FXLocaleDateTimeSubCatData) / sizeof(FX_LOCALESUBCATEGORYINFO);
+
+const FX_LOCALESUBCATEGORYINFO g_FXLocaleNumSubCatData[] = {
+ {0x46f95531, L"percent", FX_LOCALENUMPATTERN_Percent},
+ {0x4c4e8acb, L"currency", FX_LOCALENUMPATTERN_Currency},
+ {0x54034c2f, L"decimal", FX_LOCALENUMPATTERN_Decimal},
+ {0x7568e6ae, L"integer", FX_LOCALENUMPATTERN_Integer},
+};
+const int32_t g_iFXLocaleNumSubCatCount =
+ sizeof(g_FXLocaleNumSubCatData) / sizeof(FX_LOCALESUBCATEGORYINFO);
+
+struct FX_LOCALETIMEZONEINFO {
+ uint32_t uHash;
+ int16_t iHour;
+ int16_t iMinute;
+};
+
+const FX_LOCALETIMEZONEINFO g_FXLocaleTimeZoneData[] = {
+ {FXBSTR_ID(0, 'C', 'D', 'T'), -5, 0}, {FXBSTR_ID(0, 'C', 'S', 'T'), -6, 0},
+ {FXBSTR_ID(0, 'E', 'D', 'T'), -4, 0}, {FXBSTR_ID(0, 'E', 'S', 'T'), -5, 0},
+ {FXBSTR_ID(0, 'M', 'D', 'T'), -6, 0}, {FXBSTR_ID(0, 'M', 'S', 'T'), -7, 0},
+ {FXBSTR_ID(0, 'P', 'D', 'T'), -7, 0}, {FXBSTR_ID(0, 'P', 'S', 'T'), -8, 0},
+};
+
+const wchar_t gs_wsTimeSymbols[] = L"hHkKMSFAzZ";
+const wchar_t gs_wsDateSymbols[] = L"DJMEeGgYwW";
+const wchar_t gs_wsConstChars[] = L",-:/. ";
+
+int32_t ParseTimeZone(const wchar_t* pStr, int32_t iLen, FX_TIMEZONE* tz) {
+ tz->tzHour = 0;
+ tz->tzMinute = 0;
+ if (iLen < 0)
+ return 0;
+
+ int32_t iStart = 1;
+ int32_t iEnd = iStart + 2;
+ while (iStart < iLen && iStart < iEnd)
+ tz->tzHour = tz->tzHour * 10 + pStr[iStart++] - '0';
+
+ if (iStart < iLen && pStr[iStart] == ':')
+ iStart++;
+
+ iEnd = iStart + 2;
+ while (iStart < iLen && iStart < iEnd)
+ tz->tzMinute = tz->tzMinute * 10 + pStr[iStart++] - '0';
+
+ if (pStr[0] == '-')
+ tz->tzHour = -tz->tzHour;
+
+ return iStart;
+}
+
+CFX_WideString GetLiteralText(const wchar_t* pStrPattern,
+ int32_t& iPattern,
+ int32_t iLenPattern) {
+ CFX_WideString wsOutput;
+ if (pStrPattern[iPattern] != '\'') {
+ return wsOutput;
+ }
+ iPattern++;
+ int32_t iQuote = 1;
+ while (iPattern < iLenPattern) {
+ if (pStrPattern[iPattern] == '\'') {
+ iQuote++;
+ if ((iPattern + 1 >= iLenPattern) ||
+ ((pStrPattern[iPattern + 1] != '\'') && (iQuote % 2 == 0))) {
+ break;
+ } else {
+ iQuote++;
+ }
+ iPattern++;
+ } else if (pStrPattern[iPattern] == '\\' && (iPattern + 1 < iLenPattern) &&
+ pStrPattern[iPattern + 1] == 'u') {
+ int32_t iKeyValue = 0;
+ iPattern += 2;
+ int32_t i = 0;
+ while (iPattern < iLenPattern && i++ < 4) {
+ wchar_t ch = pStrPattern[iPattern++];
+ if ((ch >= '0' && ch <= '9')) {
+ iKeyValue = iKeyValue * 16 + ch - '0';
+ } else if ((ch >= 'a' && ch <= 'f')) {
+ iKeyValue = iKeyValue * 16 + ch - 'a' + 10;
+ } else if ((ch >= 'A' && ch <= 'F')) {
+ iKeyValue = iKeyValue * 16 + ch - 'A' + 10;
+ }
+ }
+ if (iKeyValue != 0) {
+ wsOutput += (wchar_t)(iKeyValue & 0x0000FFFF);
+ }
+ continue;
+ }
+ wsOutput += pStrPattern[iPattern++];
+ }
+ return wsOutput;
+}
+
+CFX_WideString GetLiteralTextReverse(const wchar_t* pStrPattern,
+ int32_t& iPattern) {
+ CFX_WideString wsOutput;
+ if (pStrPattern[iPattern] != '\'') {
+ return wsOutput;
+ }
+ iPattern--;
+ int32_t iQuote = 1;
+ while (iPattern >= 0) {
+ if (pStrPattern[iPattern] == '\'') {
+ iQuote++;
+ if (iPattern - 1 >= 0 ||
+ ((pStrPattern[iPattern - 1] != '\'') && (iQuote % 2 == 0))) {
+ break;
+ }
+ iQuote++;
+ iPattern--;
+ } else if (pStrPattern[iPattern] == '\\' &&
+ pStrPattern[iPattern + 1] == 'u') {
+ iPattern--;
+ int32_t iKeyValue = 0;
+ int32_t iLen = wsOutput.GetLength();
+ int32_t i = 1;
+ for (; i < iLen && i < 5; i++) {
+ wchar_t ch = wsOutput[i];
+ if ((ch >= '0' && ch <= '9')) {
+ iKeyValue = iKeyValue * 16 + ch - '0';
+ } else if ((ch >= 'a' && ch <= 'f')) {
+ iKeyValue = iKeyValue * 16 + ch - 'a' + 10;
+ } else if ((ch >= 'A' && ch <= 'F')) {
+ iKeyValue = iKeyValue * 16 + ch - 'A' + 10;
+ }
+ }
+ if (iKeyValue != 0) {
+ wsOutput.Delete(0, i);
+ wsOutput = (wchar_t)(iKeyValue & 0x0000FFFF) + wsOutput;
+ }
+ continue;
+ }
+ wsOutput = pStrPattern[iPattern--] + wsOutput;
+ }
+ return wsOutput;
+}
+
+bool GetNumericDotIndex(const CFX_WideString& wsNum,
+ const CFX_WideString& wsDotSymbol,
+ int32_t& iDotIndex) {
+ int32_t ccf = 0;
+ int32_t iLenf = wsNum.GetLength();
+ const wchar_t* pStr = wsNum.c_str();
+ int32_t iLenDot = wsDotSymbol.GetLength();
+ while (ccf < iLenf) {
+ if (pStr[ccf] == '\'') {
+ GetLiteralText(pStr, ccf, iLenf);
+ } else if (ccf + iLenDot <= iLenf &&
+ !wcsncmp(pStr + ccf, wsDotSymbol.c_str(), iLenDot)) {
+ iDotIndex = ccf;
+ return true;
+ }
+ ccf++;
+ }
+ iDotIndex = wsNum.Find('.');
+ if (iDotIndex < 0) {
+ iDotIndex = iLenf;
+ return false;
+ }
+ return true;
+}
+
+bool ParseLocaleDate(const CFX_WideString& wsDate,
+ const CFX_WideString& wsDatePattern,
+ IFX_Locale* pLocale,
+ CFX_DateTime* datetime,
+ int32_t& cc) {
+ int32_t year = 1900;
+ int32_t month = 1;
+ int32_t day = 1;
+ int32_t ccf = 0;
+ const wchar_t* str = wsDate.c_str();
+ int32_t len = wsDate.GetLength();
+ const wchar_t* strf = wsDatePattern.c_str();
+ int32_t lenf = wsDatePattern.GetLength();
+ CFX_WideStringC wsDateSymbols(gs_wsDateSymbols);
+ while (cc < len && ccf < lenf) {
+ if (strf[ccf] == '\'') {
+ CFX_WideString wsLiteral = GetLiteralText(strf, ccf, lenf);
+ int32_t iLiteralLen = wsLiteral.GetLength();
+ if (cc + iLiteralLen > len ||
+ wcsncmp(str + cc, wsLiteral.c_str(), iLiteralLen)) {
+ return false;
+ }
+ cc += iLiteralLen;
+ ccf++;
+ continue;
+ } else if (wsDateSymbols.Find(strf[ccf]) == -1) {
+ if (strf[ccf] != str[cc])
+ return false;
+ cc++;
+ ccf++;
+ continue;
+ }
+ uint32_t dwSymbolNum = 1;
+ wchar_t dwCharSymbol = strf[ccf++];
+ while (ccf < lenf && strf[ccf] == dwCharSymbol) {
+ ccf++;
+ dwSymbolNum++;
+ }
+ uint32_t dwSymbol = (dwCharSymbol << 8) | (dwSymbolNum + '0');
+ if (dwSymbol == FXBSTR_ID(0, 0, 'D', '1')) {
+ if (!FXSYS_isDecimalDigit(str[cc])) {
+ return false;
+ }
+ day = str[cc++] - '0';
+ if (cc < len && FXSYS_isDecimalDigit(str[cc])) {
+ day = day * 10 + str[cc++] - '0';
+ }
+ } else if (dwSymbol == FXBSTR_ID(0, 0, 'D', '2')) {
+ if (!FXSYS_isDecimalDigit(str[cc])) {
+ return false;
+ }
+ day = str[cc++] - '0';
+ if (cc < len) {
+ day = day * 10 + str[cc++] - '0';
+ }
+ } else if (dwSymbol == FXBSTR_ID(0, 0, 'J', '1')) {
+ int i = 0;
+ while (cc < len && i < 3 && FXSYS_isDecimalDigit(str[cc])) {
+ cc++;
+ i++;
+ }
+ } else if (dwSymbol == FXBSTR_ID(0, 0, 'J', '3')) {
+ cc += 3;
+ } else if (dwSymbol == FXBSTR_ID(0, 0, 'M', '1')) {
+ if (!FXSYS_isDecimalDigit(str[cc])) {
+ return false;
+ }
+ month = str[cc++] - '0';
+ if (cc < len && FXSYS_isDecimalDigit(str[cc])) {
+ month = month * 10 + str[cc++] - '0';
+ }
+ } else if (dwSymbol == FXBSTR_ID(0, 0, 'M', '2')) {
+ if (!FXSYS_isDecimalDigit(str[cc])) {
+ return false;
+ }
+ month = str[cc++] - '0';
+ if (cc < len) {
+ month = month * 10 + str[cc++] - '0';
+ }
+ } else if (dwSymbol == FXBSTR_ID(0, 0, 'M', '3')) {
+ CFX_WideString wsMonthNameAbbr;
+ uint16_t i = 0;
+ for (; i < 12; i++) {
+ wsMonthNameAbbr = pLocale->GetMonthName(i, true);
+ if (wsMonthNameAbbr.IsEmpty())
+ continue;
+ if (!wcsncmp(wsMonthNameAbbr.c_str(), str + cc,
+ wsMonthNameAbbr.GetLength())) {
+ break;
+ }
+ }
+ if (i < 12) {
+ cc += wsMonthNameAbbr.GetLength();
+ month = i + 1;
+ }
+ } else if (dwSymbol == FXBSTR_ID(0, 0, 'M', '4')) {
+ CFX_WideString wsMonthName;
+ uint16_t i = 0;
+ for (; i < 12; i++) {
+ wsMonthName = pLocale->GetMonthName(i, false);
+ if (wsMonthName.IsEmpty())
+ continue;
+ if (!wcsncmp(wsMonthName.c_str(), str + cc, wsMonthName.GetLength())) {
+ break;
+ }
+ }
+ if (i < 12) {
+ cc += wsMonthName.GetLength();
+ month = i + 1;
+ }
+ } else if (dwSymbol == FXBSTR_ID(0, 0, 'E', '1')) {
+ cc += 1;
+ } else if (dwSymbol == FXBSTR_ID(0, 0, 'E', '3')) {
+ CFX_WideString wsDayNameAbbr;
+ uint16_t i = 0;
+ for (; i < 7; i++) {
+ wsDayNameAbbr = pLocale->GetDayName(i, true);
+ if (wsDayNameAbbr.IsEmpty())
+ continue;
+ if (!wcsncmp(wsDayNameAbbr.c_str(), str + cc,
+ wsDayNameAbbr.GetLength())) {
+ break;
+ }
+ }
+ if (i < 12) {
+ cc += wsDayNameAbbr.GetLength();
+ }
+ } else if (dwSymbol == FXBSTR_ID(0, 0, 'E', '4')) {
+ CFX_WideString wsDayName;
+ int32_t i = 0;
+ for (; i < 7; i++) {
+ wsDayName = pLocale->GetDayName(i, false);
+ if (wsDayName == L"")
+ continue;
+ if (!wcsncmp(wsDayName.c_str(), str + cc, wsDayName.GetLength())) {
+ break;
+ }
+ }
+ if (i < 12) {
+ cc += wsDayName.GetLength();
+ }
+ } else if (dwSymbol == FXBSTR_ID(0, 0, 'e', '1')) {
+ cc += 1;
+ } else if (dwSymbol == FXBSTR_ID(0, 0, 'G', '1')) {
+ cc += 2;
+ } else if (dwSymbol == FXBSTR_ID(0, 0, 'Y', '2')) {
+ if (cc + 2 > len) {
+ return false;
+ }
+ if (!FXSYS_isDecimalDigit(str[cc])) {
+ return false;
+ }
+ year = str[cc++] - '0';
+ if (cc >= len || !FXSYS_isDecimalDigit(str[cc])) {
+ return false;
+ }
+ year = year * 10 + str[cc++] - '0';
+ if (year <= 29) {
+ year += 2000;
+ } else {
+ year += 1900;
+ }
+ } else if (dwSymbol == FXBSTR_ID(0, 0, 'Y', '4')) {
+ int i = 0;
+ year = 0;
+ if (cc + 4 > len) {
+ return false;
+ }
+ while (i < 4) {
+ if (!FXSYS_isDecimalDigit(str[cc])) {
+ return false;
+ }
+ year = year * 10 + str[cc] - '0';
+ cc++;
+ i++;
+ }
+ } else if (dwSymbol == FXBSTR_ID(0, 0, 'w', '1')) {
+ cc += 1;
+ } else if (dwSymbol == FXBSTR_ID(0, 0, 'W', '2')) {
+ cc += 2;
+ }
+ }
+ if (cc < len)
+ return false;
+
+ datetime->SetDate(year, month, day);
+ return !!cc;
+}
+
+void ResolveZone(uint8_t& wHour,
+ uint8_t& wMinute,
+ FX_TIMEZONE tzDiff,
+ IFX_Locale* pLocale) {
+ int32_t iMinuteDiff = wHour * 60 + wMinute;
+ FX_TIMEZONE tzLocale = pLocale->GetTimeZone();
+ iMinuteDiff += tzLocale.tzHour * 60 +
+ (tzLocale.tzHour < 0 ? -tzLocale.tzMinute : tzLocale.tzMinute);
+ iMinuteDiff -= tzDiff.tzHour * 60 +
+ (tzDiff.tzHour < 0 ? -tzDiff.tzMinute : tzDiff.tzMinute);
+ while (iMinuteDiff > 1440) {
+ iMinuteDiff -= 1440;
+ }
+ while (iMinuteDiff < 0) {
+ iMinuteDiff += 1440;
+ }
+ wHour = iMinuteDiff / 60;
+ wMinute = iMinuteDiff % 60;
+}
+
+bool ParseLocaleTime(const CFX_WideString& wsTime,
+ const CFX_WideString& wsTimePattern,
+ IFX_Locale* pLocale,
+ CFX_DateTime* datetime,
+ int32_t& cc) {
+ uint8_t hour = 0;
+ uint8_t minute = 0;
+ uint8_t second = 0;
+ uint16_t millisecond = 0;
+ int32_t ccf = 0;
+ const wchar_t* str = wsTime.c_str();
+ int len = wsTime.GetLength();
+ const wchar_t* strf = wsTimePattern.c_str();
+ int lenf = wsTimePattern.GetLength();
+ bool bHasA = false;
+ bool bPM = false;
+ CFX_WideStringC wsTimeSymbols(gs_wsTimeSymbols);
+ while (cc < len && ccf < lenf) {
+ if (strf[ccf] == '\'') {
+ CFX_WideString wsLiteral = GetLiteralText(strf, ccf, lenf);
+ int32_t iLiteralLen = wsLiteral.GetLength();
+ if (cc + iLiteralLen > len ||
+ wcsncmp(str + cc, wsLiteral.c_str(), iLiteralLen)) {
+ return false;
+ }
+ cc += iLiteralLen;
+ ccf++;
+ continue;
+ } else if (wsTimeSymbols.Find(strf[ccf]) == -1) {
+ if (strf[ccf] != str[cc])
+ return false;
+ cc++;
+ ccf++;
+ continue;
+ }
+ uint32_t dwSymbolNum = 1;
+ wchar_t dwCharSymbol = strf[ccf++];
+ while (ccf < lenf && strf[ccf] == dwCharSymbol) {
+ ccf++;
+ dwSymbolNum++;
+ }
+ uint32_t dwSymbol = (dwCharSymbol << 8) | (dwSymbolNum + '0');
+ if (dwSymbol == FXBSTR_ID(0, 0, 'k', '1') ||
+ dwSymbol == FXBSTR_ID(0, 0, 'H', '1') ||
+ dwSymbol == FXBSTR_ID(0, 0, 'h', '1') ||
+ dwSymbol == FXBSTR_ID(0, 0, 'K', '1')) {
+ if (!FXSYS_isDecimalDigit(str[cc])) {
+ return false;
+ }
+ hour = str[cc++] - '0';
+ if (cc < len && FXSYS_isDecimalDigit(str[cc])) {
+ hour = hour * 10 + str[cc++] - '0';
+ }
+ if (dwSymbol == FXBSTR_ID(0, 0, 'K', '1') && hour == 24) {
+ hour = 0;
+ }
+ } else if (dwSymbol == FXBSTR_ID(0, 0, 'k', '2') ||
+ dwSymbol == FXBSTR_ID(0, 0, 'H', '2') ||
+ dwSymbol == FXBSTR_ID(0, 0, 'h', '2') ||
+ dwSymbol == FXBSTR_ID(0, 0, 'K', '2')) {
+ if (!FXSYS_isDecimalDigit(str[cc])) {
+ return false;
+ }
+ hour = str[cc++] - '0';
+ if (cc >= len) {
+ return false;
+ }
+ if (!FXSYS_isDecimalDigit(str[cc])) {
+ return false;
+ }
+ hour = hour * 10 + str[cc++] - '0';
+ if (dwSymbol == FXBSTR_ID(0, 0, 'K', '2') && hour == 24) {
+ hour = 0;
+ }
+ } else if (dwSymbol == FXBSTR_ID(0, 0, 'M', '1')) {
+ if (!FXSYS_isDecimalDigit(str[cc])) {
+ return false;
+ }
+ minute = str[cc++] - '0';
+ if (cc < len && FXSYS_isDecimalDigit(str[cc])) {
+ minute = minute * 10 + str[cc++] - '0';
+ }
+ } else if (dwSymbol == FXBSTR_ID(0, 0, 'M', '2')) {
+ if (!FXSYS_isDecimalDigit(str[cc])) {
+ return false;
+ }
+ minute = str[cc++] - '0';
+ if (cc >= len) {
+ return false;
+ }
+ if (!FXSYS_isDecimalDigit(str[cc])) {
+ return false;
+ }
+ minute = minute * 10 + str[cc++] - '0';
+ } else if (dwSymbol == FXBSTR_ID(0, 0, 'S', '1')) {
+ if (!FXSYS_isDecimalDigit(str[cc])) {
+ return false;
+ }
+ second = str[cc++] - '0';
+ if (cc < len && FXSYS_isDecimalDigit(str[cc])) {
+ second = second * 10 + str[cc++] - '0';
+ }
+ } else if (dwSymbol == FXBSTR_ID(0, 0, 'S', '2')) {
+ if (!FXSYS_isDecimalDigit(str[cc])) {
+ return false;
+ }
+ second = str[cc++] - '0';
+ if (cc >= len) {
+ return false;
+ }
+ if (!FXSYS_isDecimalDigit(str[cc])) {
+ return false;
+ }
+ second = second * 10 + str[cc++] - '0';
+ } else if (dwSymbol == FXBSTR_ID(0, 0, 'F', '3')) {
+ if (cc + 3 >= len) {
+ return false;
+ }
+ int i = 0;
+ while (i < 3) {
+ if (!FXSYS_isDecimalDigit(str[cc])) {
+ return false;
+ }
+ millisecond = millisecond * 10 + str[cc++] - '0';
+ i++;
+ }
+ } else if (dwSymbol == FXBSTR_ID(0, 0, 'A', '1')) {
+ CFX_WideString wsAM = pLocale->GetMeridiemName(true);
+ CFX_WideString wsPM = pLocale->GetMeridiemName(false);
+ if ((cc + wsAM.GetLength() <= len) &&
+ (CFX_WideStringC(str + cc, wsAM.GetLength()) == wsAM)) {
+ cc += wsAM.GetLength();
+ bHasA = true;
+ } else if ((cc + wsPM.GetLength() <= len) &&
+ (CFX_WideStringC(str + cc, wsPM.GetLength()) == wsPM)) {
+ cc += wsPM.GetLength();
+ bHasA = true;
+ bPM = true;
+ }
+ } else if (dwSymbol == FXBSTR_ID(0, 0, 'Z', '1')) {
+ if (cc + 3 > len) {
+ continue;
+ }
+ uint32_t dwHash = str[cc++];
+ dwHash = (dwHash << 8) | str[cc++];
+ dwHash = (dwHash << 8) | str[cc++];
+ if (dwHash == FXBSTR_ID(0, 'G', 'M', 'T')) {
+ FX_TIMEZONE tzDiff;
+ tzDiff.tzHour = 0;
+ tzDiff.tzMinute = 0;
+ if (cc < len && (str[cc] == '-' || str[cc] == '+'))
+ cc += ParseTimeZone(str + cc, len - cc, &tzDiff);
+
+ ResolveZone(hour, minute, tzDiff, pLocale);
+ } else {
+ const FX_LOCALETIMEZONEINFO* pEnd =
+ g_FXLocaleTimeZoneData + FX_ArraySize(g_FXLocaleTimeZoneData);
+ const FX_LOCALETIMEZONEINFO* pTimeZoneInfo =
+ std::lower_bound(g_FXLocaleTimeZoneData, pEnd, dwHash,
+ [](const FX_LOCALETIMEZONEINFO& info,
+ uint32_t hash) { return info.uHash < hash; });
+ if (pTimeZoneInfo < pEnd && dwHash == pTimeZoneInfo->uHash) {
+ hour += pTimeZoneInfo->iHour;
+ minute += pTimeZoneInfo->iHour > 0 ? pTimeZoneInfo->iMinute
+ : -pTimeZoneInfo->iMinute;
+ }
+ }
+ } else if (dwSymbol == FXBSTR_ID(0, 0, 'z', '1')) {
+ if (str[cc] != 'Z') {
+ FX_TIMEZONE tzDiff;
+ cc += ParseTimeZone(str + cc, len - cc, &tzDiff);
+ ResolveZone(hour, minute, tzDiff, pLocale);
+ } else {
+ cc++;
+ }
+ }
+ }
+ if (bHasA) {
+ if (bPM) {
+ hour += 12;
+ if (hour == 24) {
+ hour = 12;
+ }
+ } else {
+ if (hour == 12) {
+ hour = 0;
+ }
+ }
+ }
+ datetime->SetTime(hour, minute, second, millisecond);
+ return !!cc;
+}
+
+int32_t GetNumTrailingLimit(const CFX_WideString& wsFormat,
+ int iDotPos,
+ bool& bTrimTailZeros) {
+ if (iDotPos < 0)
+ return 0;
+
+ int32_t iCount = wsFormat.GetLength();
+ int32_t iTreading = 0;
+ for (iDotPos++; iDotPos < iCount; iDotPos++) {
+ wchar_t wc = wsFormat[iDotPos];
+ if (wc == L'z' || wc == L'9' || wc == 'Z') {
+ iTreading++;
+ bTrimTailZeros = (wc == L'9' ? false : true);
+ }
+ }
+ return iTreading;
+}
+
+uint16_t GetSolarMonthDays(uint16_t year, uint16_t month) {
+ if (month % 2)
+ return 31;
+ if (month == 2)
+ return FX_IsLeapYear(year) ? 29 : 28;
+ return 30;
+}
+
+uint16_t GetWeekDay(uint16_t year, uint16_t month, uint16_t day) {
+ uint16_t g_month_day[] = {0, 3, 3, 6, 1, 4, 6, 2, 5, 0, 3, 5};
+ uint16_t nDays =
+ (year - 1) % 7 + (year - 1) / 4 - (year - 1) / 100 + (year - 1) / 400;
+ nDays += g_month_day[month - 1] + day;
+ if (FX_IsLeapYear(year) && month > 2)
+ nDays++;
+ return nDays % 7;
+}
+
+uint16_t GetWeekOfMonth(uint16_t year, uint16_t month, uint16_t day) {
+ uint16_t week_day = GetWeekDay(year, month, 1);
+ uint16_t week_index = 0;
+ week_index += day / 7;
+ day = day % 7;
+ if (week_day + day > 7)
+ week_index++;
+ return week_index;
+}
+
+uint16_t GetWeekOfYear(uint16_t year, uint16_t month, uint16_t day) {
+ uint16_t nDays = 0;
+ for (uint16_t i = 1; i < month; i++)
+ nDays += GetSolarMonthDays(year, i);
+
+ nDays += day;
+ uint16_t week_day = GetWeekDay(year, 1, 1);
+ uint16_t week_index = 1;
+ week_index += nDays / 7;
+ nDays = nDays % 7;
+ if (week_day + nDays > 7)
+ week_index++;
+ return week_index;
+}
+
+bool DateFormat(const CFX_WideString& wsDatePattern,
+ IFX_Locale* pLocale,
+ const CFX_DateTime& datetime,
+ CFX_WideString& wsResult) {
+ bool bRet = true;
+ int32_t year = datetime.GetYear();
+ uint8_t month = datetime.GetMonth();
+ uint8_t day = datetime.GetDay();
+ int32_t ccf = 0;
+ const wchar_t* strf = wsDatePattern.c_str();
+ int32_t lenf = wsDatePattern.GetLength();
+ CFX_WideStringC wsDateSymbols(gs_wsDateSymbols);
+ while (ccf < lenf) {
+ if (strf[ccf] == '\'') {
+ wsResult += GetLiteralText(strf, ccf, lenf);
+ ccf++;
+ continue;
+ } else if (wsDateSymbols.Find(strf[ccf]) == -1) {
+ wsResult += strf[ccf++];
+ continue;
+ }
+ uint32_t dwSymbolNum = 1;
+ wchar_t dwCharSymbol = strf[ccf++];
+ while (ccf < lenf && strf[ccf] == dwCharSymbol) {
+ ccf++;
+ dwSymbolNum++;
+ }
+ uint32_t dwSymbol = (dwCharSymbol << 8) | (dwSymbolNum + '0');
+ if (dwSymbol == FXBSTR_ID(0, 0, 'D', '1')) {
+ CFX_WideString wsDay;
+ wsDay.Format(L"%d", day);
+ wsResult += wsDay;
+ } else if (dwSymbol == FXBSTR_ID(0, 0, 'D', '2')) {
+ CFX_WideString wsDay;
+ wsDay.Format(L"%02d", day);
+ wsResult += wsDay;
+ } else if (dwSymbol == FXBSTR_ID(0, 0, 'J', '1')) {
+ uint16_t nDays = 0;
+ for (int i = 1; i < month; i++) {
+ nDays += GetSolarMonthDays(year, i);
+ }
+ nDays += day;
+ CFX_WideString wsDays;
+ wsDays.Format(L"%d", nDays);
+ wsResult += wsDays;
+ } else if (dwSymbol == FXBSTR_ID(0, 0, 'J', '3')) {
+ uint16_t nDays = 0;
+ for (int i = 1; i < month; i++) {
+ nDays += GetSolarMonthDays(year, i);
+ }
+ nDays += day;
+ CFX_WideString wsDays;
+ wsDays.Format(L"%03d", nDays);
+ wsResult += wsDays;
+ } else if (dwSymbol == FXBSTR_ID(0, 0, 'M', '1')) {
+ CFX_WideString wsMonth;
+ wsMonth.Format(L"%d", month);
+ wsResult += wsMonth;
+ } else if (dwSymbol == FXBSTR_ID(0, 0, 'M', '2')) {
+ CFX_WideString wsMonth;
+ wsMonth.Format(L"%02d", month);
+ wsResult += wsMonth;
+ } else if (dwSymbol == FXBSTR_ID(0, 0, 'M', '3')) {
+ wsResult += pLocale->GetMonthName(month - 1, true);
+ } else if (dwSymbol == FXBSTR_ID(0, 0, 'M', '4')) {
+ wsResult += pLocale->GetMonthName(month - 1, false);
+ } else if (dwSymbol == FXBSTR_ID(0, 0, 'E', '1')) {
+ uint16_t wWeekDay = GetWeekDay(year, month, day);
+ CFX_WideString wsWeekDay;
+ wsWeekDay.Format(L"%d", wWeekDay + 1);
+ wsResult += wsWeekDay;
+ } else if (dwSymbol == FXBSTR_ID(0, 0, 'E', '3')) {
+ uint16_t wWeekDay = GetWeekDay(year, month, day);
+ wsResult += pLocale->GetDayName(wWeekDay, true);
+ } else if (dwSymbol == FXBSTR_ID(0, 0, 'E', '4')) {
+ uint16_t wWeekDay = GetWeekDay(year, month, day);
+ if (pLocale)
+ wsResult += pLocale->GetDayName(wWeekDay, false);
+ } else if (dwSymbol == FXBSTR_ID(0, 0, 'e', '1')) {
+ uint16_t wWeekDay = GetWeekDay(year, month, day);
+ CFX_WideString wsWeekDay;
+ wsWeekDay.Format(L"%d", wWeekDay ? wWeekDay : 7);
+ wsResult += wsWeekDay;
+ } else if (dwSymbol == FXBSTR_ID(0, 0, 'G', '1')) {
+ wsResult += pLocale->GetEraName(year < 0);
+ } else if (dwSymbol == FXBSTR_ID(0, 0, 'Y', '2')) {
+ CFX_WideString wsYear;
+ wsYear.Format(L"%02d", year % 100);
+ wsResult += wsYear;
+ } else if (dwSymbol == FXBSTR_ID(0, 0, 'Y', '4')) {
+ CFX_WideString wsYear;
+ wsYear.Format(L"%d", year);
+ wsResult += wsYear;
+ } else if (dwSymbol == FXBSTR_ID(0, 0, 'w', '1')) {
+ uint16_t week_index = GetWeekOfMonth(year, month, day);
+ CFX_WideString wsWeekInMonth;
+ wsWeekInMonth.Format(L"%d", week_index);
+ wsResult += wsWeekInMonth;
+ } else if (dwSymbol == FXBSTR_ID(0, 0, 'W', '2')) {
+ uint16_t week_index = GetWeekOfYear(year, month, day);
+ CFX_WideString wsWeekInYear;
+ wsWeekInYear.Format(L"%02d", week_index);
+ wsResult += wsWeekInYear;
+ }
+ }
+ return bRet;
+}
+
+bool TimeFormat(const CFX_WideString& wsTimePattern,
+ IFX_Locale* pLocale,
+ const CFX_DateTime& datetime,
+ CFX_WideString& wsResult) {
+ bool bGMT = false;
+ bool bRet = true;
+ uint8_t hour = datetime.GetHour();
+ uint8_t minute = datetime.GetMinute();
+ uint8_t second = datetime.GetSecond();
+ uint16_t millisecond = datetime.GetMillisecond();
+ int32_t ccf = 0;
+ const wchar_t* strf = wsTimePattern.c_str();
+ int32_t lenf = wsTimePattern.GetLength();
+ uint16_t wHour = hour;
+ bool bPM = false;
+ if (wsTimePattern.Find('A') != -1) {
+ if (wHour >= 12) {
+ bPM = true;
+ }
+ }
+ CFX_WideStringC wsTimeSymbols(gs_wsTimeSymbols);
+ while (ccf < lenf) {
+ if (strf[ccf] == '\'') {
+ wsResult += GetLiteralText(strf, ccf, lenf);
+ ccf++;
+ continue;
+ } else if (wsTimeSymbols.Find(strf[ccf]) == -1) {
+ wsResult += strf[ccf++];
+ continue;
+ }
+ uint32_t dwSymbolNum = 1;
+ wchar_t dwCharSymbol = strf[ccf++];
+ while (ccf < lenf && strf[ccf] == dwCharSymbol) {
+ ccf++;
+ dwSymbolNum++;
+ }
+ uint32_t dwSymbol = (dwCharSymbol << 8) | (dwSymbolNum + '0');
+ if (dwSymbol == FXBSTR_ID(0, 0, 'h', '1')) {
+ if (wHour > 12) {
+ wHour -= 12;
+ }
+ CFX_WideString wsHour;
+ wsHour.Format(L"%d", wHour == 0 ? 12 : wHour);
+ wsResult += wsHour;
+ } else if (dwSymbol == FXBSTR_ID(0, 0, 'h', '2')) {
+ if (wHour > 12) {
+ wHour -= 12;
+ }
+ CFX_WideString wsHour;
+ wsHour.Format(L"%02d", wHour == 0 ? 12 : wHour);
+ wsResult += wsHour;
+ } else if (dwSymbol == FXBSTR_ID(0, 0, 'K', '1')) {
+ CFX_WideString wsHour;
+ wsHour.Format(L"%d", wHour == 0 ? 24 : wHour);
+ wsResult += wsHour;
+ } else if (dwSymbol == FXBSTR_ID(0, 0, 'K', '2')) {
+ CFX_WideString wsHour;
+ wsHour.Format(L"%02d", wHour == 0 ? 24 : wHour);
+ wsResult += wsHour;
+ } else if (dwSymbol == FXBSTR_ID(0, 0, 'k', '1')) {
+ if (wHour > 12) {
+ wHour -= 12;
+ }
+ CFX_WideString wsHour;
+ wsHour.Format(L"%d", wHour);
+ wsResult += wsHour;
+ } else if (dwSymbol == FXBSTR_ID(0, 0, 'H', '1')) {
+ CFX_WideString wsHour;
+ wsHour.Format(L"%d", wHour);
+ wsResult += wsHour;
+ } else if (dwSymbol == FXBSTR_ID(0, 0, 'k', '2')) {
+ if (wHour > 12) {
+ wHour -= 12;
+ }
+ CFX_WideString wsHour;
+ wsHour.Format(L"%02d", wHour);
+ wsResult += wsHour;
+ } else if (dwSymbol == FXBSTR_ID(0, 0, 'H', '2')) {
+ CFX_WideString wsHour;
+ wsHour.Format(L"%02d", wHour);
+ wsResult += wsHour;
+ } else if (dwSymbol == FXBSTR_ID(0, 0, 'M', '1')) {
+ CFX_WideString wsMinute;
+ wsMinute.Format(L"%d", minute);
+ wsResult += wsMinute;
+ } else if (dwSymbol == FXBSTR_ID(0, 0, 'M', '2')) {
+ CFX_WideString wsMinute;
+ wsMinute.Format(L"%02d", minute);
+ wsResult += wsMinute;
+ } else if (dwSymbol == FXBSTR_ID(0, 0, 'S', '1')) {
+ CFX_WideString wsSecond;
+ wsSecond.Format(L"%d", second);
+ wsResult += wsSecond;
+ } else if (dwSymbol == FXBSTR_ID(0, 0, 'S', '2')) {
+ CFX_WideString wsSecond;
+ wsSecond.Format(L"%02d", second);
+ wsResult += wsSecond;
+ } else if (dwSymbol == FXBSTR_ID(0, 0, 'F', '3')) {
+ CFX_WideString wsMilliseconds;
+ wsMilliseconds.Format(L"%03d", millisecond);
+ wsResult += wsMilliseconds;
+ } else if (dwSymbol == FXBSTR_ID(0, 0, 'A', '1')) {
+ wsResult += pLocale->GetMeridiemName(!bPM);
+ } else if (dwSymbol == FXBSTR_ID(0, 0, 'Z', '1')) {
+ wsResult += L"GMT";
+ FX_TIMEZONE tz = pLocale->GetTimeZone();
+ if (!bGMT && (tz.tzHour != 0 || tz.tzMinute != 0)) {
+ wsResult += tz.tzHour < 0 ? L"-" : L"+";
+
+ CFX_WideString wsTimezone;
+ wsTimezone.Format(L"%02d:%02d", abs(tz.tzHour), tz.tzMinute);
+ wsResult += wsTimezone;
+ }
+ } else if (dwSymbol == FXBSTR_ID(0, 0, 'z', '1')) {
+ FX_TIMEZONE tz = pLocale->GetTimeZone();
+ if (!bGMT && tz.tzHour != 0 && tz.tzMinute != 0) {
+ wsResult += tz.tzHour < 0 ? L"-" : L"+";
+
+ CFX_WideString wsTimezone;
+ wsTimezone.Format(L"%02d:%02d", abs(tz.tzHour), tz.tzMinute);
+ wsResult += wsTimezone;
+ }
+ }
+ }
+ return bRet;
+}
+
+bool FormatDateTimeInternal(const CFX_DateTime& dt,
+ const CFX_WideString& wsDatePattern,
+ const CFX_WideString& wsTimePattern,
+ bool bDateFirst,
+ IFX_Locale* pLocale,
+ CFX_WideString& wsOutput) {
+ bool bRet = true;
+ CFX_WideString wsDateOut, wsTimeOut;
+ if (!wsDatePattern.IsEmpty())
+ bRet &= DateFormat(wsDatePattern, pLocale, dt, wsDateOut);
+ if (!wsTimePattern.IsEmpty())
+ bRet &= TimeFormat(wsTimePattern, pLocale, dt, wsTimeOut);
+
+ wsOutput = bDateFirst ? wsDateOut + wsTimeOut : wsTimeOut + wsDateOut;
+ return bRet;
+}
+
+} // namespace
+
+bool FX_DateFromCanonical(const CFX_WideString& wsDate,
+ CFX_DateTime* datetime) {
+ int32_t year = 1900;
+ int32_t month = 1;
+ int32_t day = 1;
+ uint16_t wYear = 0;
+ int cc_start = 0, cc = 0;
+ const wchar_t* str = wsDate.c_str();
+ int len = wsDate.GetLength();
+ if (len > 10) {
+ return false;
+ }
+ while (cc < len && cc < 4) {
+ if (!FXSYS_isDecimalDigit(str[cc])) {
+ return false;
+ }
+ wYear = wYear * 10 + str[cc++] - '0';
+ }
+ year = wYear;
+ if (cc < 4 || wYear < 1900) {
+ return false;
+ }
+ if (cc < len) {
+ if (str[cc] == '-') {
+ cc++;
+ }
+ cc_start = cc;
+ uint8_t tmpM = 0;
+ while (cc < len && cc < cc_start + 2) {
+ if (!FXSYS_isDecimalDigit(str[cc])) {
+ return false;
+ }
+ tmpM = tmpM * 10 + str[cc++] - '0';
+ }
+ month = tmpM;
+ if (cc == cc_start + 1 || tmpM > 12 || tmpM < 1) {
+ return false;
+ }
+ if (cc < len) {
+ if (str[cc] == '-') {
+ cc++;
+ }
+ uint8_t tmpD = 0;
+ cc_start = cc;
+ while (cc < len && cc < cc_start + 2) {
+ if (!FXSYS_isDecimalDigit(str[cc])) {
+ return false;
+ }
+ tmpD = tmpD * 10 + str[cc++] - '0';
+ }
+ day = tmpD;
+ if (tmpD < 1) {
+ return false;
+ }
+ if ((tmpM == 1 || tmpM == 3 || tmpM == 5 || tmpM == 7 || tmpM == 8 ||
+ tmpM == 10 || tmpM == 12) &&
+ tmpD > 31) {
+ return false;
+ }
+ if ((tmpM == 4 || tmpM == 6 || tmpM == 9 || tmpM == 11) && tmpD > 30) {
+ return false;
+ }
+ bool iLeapYear;
+ if ((wYear % 4 == 0 && wYear % 100 != 0) || wYear % 400 == 0) {
+ iLeapYear = true;
+ } else {
+ iLeapYear = false;
+ }
+ if ((iLeapYear && tmpM == 2 && tmpD > 29) ||
+ (!iLeapYear && tmpM == 2 && tmpD > 28)) {
+ return false;
+ }
+ }
+ }
+ datetime->SetDate(year, month, day);
+ return true;
+}
+
+bool FX_TimeFromCanonical(const CFX_WideStringC& wsTime,
+ CFX_DateTime* datetime,
+ IFX_Locale* pLocale) {
+ if (wsTime.GetLength() == 0)
+ return false;
+
+ uint8_t hour = 0;
+ uint8_t minute = 0;
+ uint8_t second = 0;
+ uint16_t millisecond = 0;
+ int cc_start = 0, cc = cc_start;
+ const wchar_t* str = wsTime.c_str();
+ int len = wsTime.GetLength();
+ while (cc < len && cc < 2) {
+ if (!FXSYS_isDecimalDigit(str[cc])) {
+ return false;
+ }
+ hour = hour * 10 + str[cc++] - '0';
+ }
+ if (cc < 2 || hour >= 24) {
+ return false;
+ }
+ if (cc < len) {
+ if (str[cc] == ':') {
+ cc++;
+ }
+ cc_start = cc;
+ while (cc < len && cc < cc_start + 2) {
+ if (!FXSYS_isDecimalDigit(str[cc])) {
+ return false;
+ }
+ minute = minute * 10 + str[cc++] - '0';
+ }
+ if (cc == cc_start + 1 || minute >= 60) {
+ return false;
+ }
+ if (cc < len) {
+ if (str[cc] == ':') {
+ cc++;
+ }
+ cc_start = cc;
+ while (cc < len && cc < cc_start + 2) {
+ if (!FXSYS_isDecimalDigit(str[cc])) {
+ return false;
+ }
+ second = second * 10 + str[cc++] - '0';
+ }
+ if (cc == cc_start + 1 || second >= 60) {
+ return false;
+ }
+ if (cc < len) {
+ if (str[cc] == '.') {
+ cc++;
+ cc_start = cc;
+ while (cc < len && cc < cc_start + 3) {
+ if (!FXSYS_isDecimalDigit(str[cc])) {
+ return false;
+ }
+ millisecond = millisecond * 10 + str[cc++] - '0';
+ }
+ if (cc < cc_start + 3)
+ return false;
+ }
+ if (cc < len) {
+ FX_TIMEZONE tzDiff;
+ tzDiff.tzHour = 0;
+ tzDiff.tzMinute = 0;
+ if (str[cc] != 'Z')
+ cc += ParseTimeZone(str + cc, len - cc, &tzDiff);
+ ResolveZone(hour, minute, tzDiff, pLocale);
+ }
+ }
+ }
+ }
+ datetime->SetTime(hour, minute, second, millisecond);
+ return true;
+}
+
+CFGAS_FormatString::CFGAS_FormatString(CXFA_LocaleMgr* pLocaleMgr)
+ : m_pLocaleMgr(pLocaleMgr) {}
+
+CFGAS_FormatString::~CFGAS_FormatString() {}
+
+void CFGAS_FormatString::SplitFormatString(
+ const CFX_WideString& wsFormatString,
+ std::vector<CFX_WideString>& wsPatterns) {
+ int32_t iStrLen = wsFormatString.GetLength();
+ const wchar_t* pStr = wsFormatString.c_str();
+ const wchar_t* pToken = pStr;
+ const wchar_t* pEnd = pStr + iStrLen;
+ bool iQuote = false;
+ while (true) {
+ if (pStr >= pEnd) {
+ wsPatterns.push_back(CFX_WideString(pToken, pStr - pToken));
+ return;
+ }
+ if (*pStr == '\'') {
+ iQuote = !iQuote;
+ } else if (*pStr == L'|' && !iQuote) {
+ wsPatterns.push_back(CFX_WideString(pToken, pStr - pToken));
+ pToken = pStr + 1;
+ }
+ pStr++;
+ }
+}
+
+FX_LOCALECATEGORY CFGAS_FormatString::GetCategory(
+ const CFX_WideString& wsPattern) {
+ FX_LOCALECATEGORY eCategory = FX_LOCALECATEGORY_Unknown;
+ int32_t ccf = 0;
+ int32_t iLenf = wsPattern.GetLength();
+ const wchar_t* pStr = wsPattern.c_str();
+ bool bBraceOpen = false;
+ CFX_WideStringC wsConstChars(gs_wsConstChars);
+ while (ccf < iLenf) {
+ if (pStr[ccf] == '\'') {
+ GetLiteralText(pStr, ccf, iLenf);
+ } else if (!bBraceOpen && wsConstChars.Find(pStr[ccf]) == -1) {
+ CFX_WideString wsCategory(pStr[ccf]);
+ ccf++;
+ while (true) {
+ if (ccf == iLenf) {
+ return eCategory;
+ }
+ if (pStr[ccf] == '.' || pStr[ccf] == '(') {
+ break;
+ }
+ if (pStr[ccf] == '{') {
+ bBraceOpen = true;
+ break;
+ }
+ wsCategory += pStr[ccf];
+ ccf++;
+ }
+ uint32_t dwHash = FX_HashCode_GetW(wsCategory.AsStringC(), false);
+ if (dwHash == FX_LOCALECATEGORY_DateHash) {
+ if (eCategory == FX_LOCALECATEGORY_Time) {
+ return FX_LOCALECATEGORY_DateTime;
+ }
+ eCategory = FX_LOCALECATEGORY_Date;
+ } else if (dwHash == FX_LOCALECATEGORY_TimeHash) {
+ if (eCategory == FX_LOCALECATEGORY_Date) {
+ return FX_LOCALECATEGORY_DateTime;
+ }
+ eCategory = FX_LOCALECATEGORY_Time;
+ } else if (dwHash == FX_LOCALECATEGORY_DateTimeHash) {
+ return FX_LOCALECATEGORY_DateTime;
+ } else if (dwHash == FX_LOCALECATEGORY_TextHash) {
+ return FX_LOCALECATEGORY_Text;
+ } else if (dwHash == FX_LOCALECATEGORY_NumHash) {
+ return FX_LOCALECATEGORY_Num;
+ } else if (dwHash == FX_LOCALECATEGORY_ZeroHash) {
+ return FX_LOCALECATEGORY_Zero;
+ } else if (dwHash == FX_LOCALECATEGORY_NullHash) {
+ return FX_LOCALECATEGORY_Null;
+ }
+ } else if (pStr[ccf] == '}') {
+ bBraceOpen = false;
+ }
+ ccf++;
+ }
+ return eCategory;
+}
+
+CFX_WideString CFGAS_FormatString::GetLocaleName(
+ const CFX_WideString& wsPattern) {
+ int32_t ccf = 0;
+ int32_t iLenf = wsPattern.GetLength();
+ const wchar_t* pStr = wsPattern.c_str();
+ while (ccf < iLenf) {
+ if (pStr[ccf] == '\'') {
+ GetLiteralText(pStr, ccf, iLenf);
+ } else if (pStr[ccf] == '(') {
+ ccf++;
+ CFX_WideString wsLCID;
+ while (ccf < iLenf && pStr[ccf] != ')') {
+ wsLCID += pStr[ccf++];
+ }
+ return wsLCID;
+ }
+ ccf++;
+ }
+ return CFX_WideString();
+}
+
+IFX_Locale* CFGAS_FormatString::GetTextFormat(const CFX_WideString& wsPattern,
+ const CFX_WideStringC& wsCategory,
+ CFX_WideString& wsPurgePattern) {
+ IFX_Locale* pLocale = nullptr;
+ int32_t ccf = 0;
+ int32_t iLenf = wsPattern.GetLength();
+ const wchar_t* pStr = wsPattern.c_str();
+ bool bBrackOpen = false;
+ CFX_WideStringC wsConstChars(gs_wsConstChars);
+ while (ccf < iLenf) {
+ if (pStr[ccf] == '\'') {
+ int32_t iCurChar = ccf;
+ GetLiteralText(pStr, ccf, iLenf);
+ wsPurgePattern += CFX_WideStringC(pStr + iCurChar, ccf - iCurChar + 1);
+ } else if (!bBrackOpen && wsConstChars.Find(pStr[ccf]) == -1) {
+ CFX_WideString wsSearchCategory(pStr[ccf]);
+ ccf++;
+ while (ccf < iLenf && pStr[ccf] != '{' && pStr[ccf] != '.' &&
+ pStr[ccf] != '(') {
+ wsSearchCategory += pStr[ccf];
+ ccf++;
+ }
+ if (wsSearchCategory != wsCategory) {
+ continue;
+ }
+ while (ccf < iLenf) {
+ if (pStr[ccf] == '(') {
+ ccf++;
+ CFX_WideString wsLCID;
+ while (ccf < iLenf && pStr[ccf] != ')') {
+ wsLCID += pStr[ccf++];
+ }
+ pLocale = GetPatternLocale(wsLCID);
+ } else if (pStr[ccf] == '{') {
+ bBrackOpen = true;
+ break;
+ }
+ ccf++;
+ }
+ } else if (pStr[ccf] != '}') {
+ wsPurgePattern += pStr[ccf];
+ }
+ ccf++;
+ }
+ if (!bBrackOpen) {
+ wsPurgePattern = wsPattern;
+ }
+ if (!pLocale) {
+ pLocale = m_pLocaleMgr->GetDefLocale();
+ }
+ return pLocale;
+}
+#define FX_NUMSTYLE_Percent 0x01
+#define FX_NUMSTYLE_Exponent 0x02
+#define FX_NUMSTYLE_DotVorv 0x04
+IFX_Locale* CFGAS_FormatString::GetNumericFormat(
+ const CFX_WideString& wsPattern,
+ int32_t& iDotIndex,
+ uint32_t& dwStyle,
+ CFX_WideString& wsPurgePattern) {
+ dwStyle = 0;
+ IFX_Locale* pLocale = nullptr;
+ int32_t ccf = 0;
+ int32_t iLenf = wsPattern.GetLength();
+ const wchar_t* pStr = wsPattern.c_str();
+ bool bFindDot = false;
+ bool bBrackOpen = false;
+ CFX_WideStringC wsConstChars(gs_wsConstChars);
+ while (ccf < iLenf) {
+ if (pStr[ccf] == '\'') {
+ int32_t iCurChar = ccf;
+ GetLiteralText(pStr, ccf, iLenf);
+ wsPurgePattern += CFX_WideStringC(pStr + iCurChar, ccf - iCurChar + 1);
+ } else if (!bBrackOpen && wsConstChars.Find(pStr[ccf]) == -1) {
+ CFX_WideString wsCategory(pStr[ccf]);
+ ccf++;
+ while (ccf < iLenf && pStr[ccf] != '{' && pStr[ccf] != '.' &&
+ pStr[ccf] != '(') {
+ wsCategory += pStr[ccf];
+ ccf++;
+ }
+ if (wsCategory != L"num") {
+ bBrackOpen = true;
+ ccf = 0;
+ continue;
+ }
+ while (ccf < iLenf) {
+ if (pStr[ccf] == '(') {
+ ccf++;
+ CFX_WideString wsLCID;
+ while (ccf < iLenf && pStr[ccf] != ')') {
+ wsLCID += pStr[ccf++];
+ }
+ pLocale = GetPatternLocale(wsLCID);
+ } else if (pStr[ccf] == '{') {
+ bBrackOpen = true;
+ break;
+ } else if (pStr[ccf] == '.') {
+ CFX_WideString wsSubCategory;
+ ccf++;
+ while (ccf < iLenf && pStr[ccf] != '(' && pStr[ccf] != '{') {
+ wsSubCategory += pStr[ccf++];
+ }
+ uint32_t dwSubHash =
+ FX_HashCode_GetW(wsSubCategory.AsStringC(), false);
+ FX_LOCALENUMSUBCATEGORY eSubCategory = FX_LOCALENUMPATTERN_Decimal;
+ for (int32_t i = 0; i < g_iFXLocaleNumSubCatCount; i++) {
+ if (g_FXLocaleNumSubCatData[i].uHash == dwSubHash) {
+ eSubCategory = (FX_LOCALENUMSUBCATEGORY)g_FXLocaleNumSubCatData[i]
+ .eSubCategory;
+ break;
+ }
+ }
+ if (!pLocale)
+ pLocale = m_pLocaleMgr->GetDefLocale();
+
+ ASSERT(pLocale);
+
+ wsSubCategory = pLocale->GetNumPattern(eSubCategory);
+ iDotIndex = wsSubCategory.Find('.');
+ if (iDotIndex > 0) {
+ iDotIndex += wsPurgePattern.GetLength();
+ bFindDot = true;
+ dwStyle |= FX_NUMSTYLE_DotVorv;
+ }
+ wsPurgePattern += wsSubCategory;
+ if (eSubCategory == FX_LOCALENUMPATTERN_Percent) {
+ dwStyle |= FX_NUMSTYLE_Percent;
+ }
+ continue;
+ }
+ ccf++;
+ }
+ } else if (pStr[ccf] == 'E') {
+ dwStyle |= FX_NUMSTYLE_Exponent;
+ wsPurgePattern += pStr[ccf];
+ } else if (pStr[ccf] == '%') {
+ dwStyle |= FX_NUMSTYLE_Percent;
+ wsPurgePattern += pStr[ccf];
+ } else if (pStr[ccf] != '}') {
+ wsPurgePattern += pStr[ccf];
+ }
+ if (!bFindDot) {
+ if (pStr[ccf] == '.' || pStr[ccf] == 'V' || pStr[ccf] == 'v') {
+ bFindDot = true;
+ iDotIndex = wsPurgePattern.GetLength() - 1;
+ dwStyle |= FX_NUMSTYLE_DotVorv;
+ }
+ }
+ ccf++;
+ }
+ if (!bFindDot) {
+ iDotIndex = wsPurgePattern.GetLength();
+ }
+ if (!pLocale) {
+ pLocale = m_pLocaleMgr->GetDefLocale();
+ }
+ return pLocale;
+}
+
+bool CFGAS_FormatString::ParseText(const CFX_WideString& wsSrcText,
+ const CFX_WideString& wsPattern,
+ CFX_WideString& wsValue) {
+ wsValue.clear();
+ if (wsSrcText.IsEmpty() || wsPattern.IsEmpty()) {
+ return false;
+ }
+ CFX_WideString wsTextFormat;
+ GetTextFormat(wsPattern, L"text", wsTextFormat);
+ if (wsTextFormat.IsEmpty()) {
+ return false;
+ }
+ int32_t iText = 0, iPattern = 0;
+ const wchar_t* pStrText = wsSrcText.c_str();
+ int32_t iLenText = wsSrcText.GetLength();
+ const wchar_t* pStrPattern = wsTextFormat.c_str();
+ int32_t iLenPattern = wsTextFormat.GetLength();
+ while (iPattern < iLenPattern && iText < iLenText) {
+ switch (pStrPattern[iPattern]) {
+ case '\'': {
+ CFX_WideString wsLiteral =
+ GetLiteralText(pStrPattern, iPattern, iLenPattern);
+ int32_t iLiteralLen = wsLiteral.GetLength();
+ if (iText + iLiteralLen > iLenText ||
+ wcsncmp(pStrText + iText, wsLiteral.c_str(), iLiteralLen)) {
+ wsValue = wsSrcText;
+ return false;
+ }
+ iText += iLiteralLen;
+ iPattern++;
+ break;
+ }
+ case 'A':
+ if (FXSYS_iswalpha(pStrText[iText])) {
+ wsValue += pStrText[iText];
+ iText++;
+ }
+ iPattern++;
+ break;
+ case 'X':
+ wsValue += pStrText[iText];
+ iText++;
+ iPattern++;
+ break;
+ case 'O':
+ case '0':
+ if (FXSYS_isDecimalDigit(pStrText[iText]) ||
+ FXSYS_iswalpha(pStrText[iText])) {
+ wsValue += pStrText[iText];
+ iText++;
+ }
+ iPattern++;
+ break;
+ case '9':
+ if (FXSYS_isDecimalDigit(pStrText[iText])) {
+ wsValue += pStrText[iText];
+ iText++;
+ }
+ iPattern++;
+ break;
+ default:
+ if (pStrPattern[iPattern] != pStrText[iText]) {
+ wsValue = wsSrcText;
+ return false;
+ }
+ iPattern++;
+ iText++;
+ break;
+ }
+ }
+ return iPattern == iLenPattern && iText == iLenText;
+}
+
+bool CFGAS_FormatString::ParseNum(const CFX_WideString& wsSrcNum,
+ const CFX_WideString& wsPattern,
+ CFX_WideString& wsValue) {
+ wsValue.clear();
+ if (wsSrcNum.IsEmpty() || wsPattern.IsEmpty())
+ return false;
+
+ int32_t dot_index_f = -1;
+ uint32_t dwFormatStyle = 0;
+ CFX_WideString wsNumFormat;
+ IFX_Locale* pLocale =
+ GetNumericFormat(wsPattern, dot_index_f, dwFormatStyle, wsNumFormat);
+ if (!pLocale || wsNumFormat.IsEmpty())
+ return false;
+
+ int32_t iExponent = 0;
+ CFX_WideString wsDotSymbol =
+ pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Decimal);
+ CFX_WideString wsGroupSymbol =
+ pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Grouping);
+ int32_t iGroupLen = wsGroupSymbol.GetLength();
+ CFX_WideString wsMinus = pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Minus);
+ int32_t iMinusLen = wsMinus.GetLength();
+ int cc = 0, ccf = 0;
+ const wchar_t* str = wsSrcNum.c_str();
+ int len = wsSrcNum.GetLength();
+ const wchar_t* strf = wsNumFormat.c_str();
+ int lenf = wsNumFormat.GetLength();
+ bool bHavePercentSymbol = false;
+ bool bNeg = false;
+ bool bReverseParse = false;
+ int32_t dot_index = 0;
+ if (!GetNumericDotIndex(wsSrcNum, wsDotSymbol, dot_index) &&
+ (dwFormatStyle & FX_NUMSTYLE_DotVorv)) {
+ bReverseParse = true;
+ }
+ bReverseParse = false;
+ ccf = dot_index_f - 1;
+ cc = dot_index - 1;
+ while (ccf >= 0 && cc >= 0) {
+ switch (strf[ccf]) {
+ case '\'': {
+ CFX_WideString wsLiteral = GetLiteralTextReverse(strf, ccf);
+ int32_t iLiteralLen = wsLiteral.GetLength();
+ cc -= iLiteralLen - 1;
+ if (cc < 0 || wcsncmp(str + cc, wsLiteral.c_str(), iLiteralLen)) {
+ return false;
+ }
+ cc--;
+ ccf--;
+ break;
+ }
+ case '9':
+ if (!FXSYS_isDecimalDigit(str[cc])) {
+ return false;
+ }
+ wsValue = str[cc] + wsValue;
+ cc--;
+ ccf--;
+ break;
+ case 'z':
+ if (FXSYS_isDecimalDigit(str[cc])) {
+ wsValue = str[cc] + wsValue;
+ cc--;
+ }
+ ccf--;
+ break;
+ case 'Z':
+ if (str[cc] != ' ') {
+ if (FXSYS_isDecimalDigit(str[cc])) {
+ wsValue = str[cc] + wsValue;
+ cc--;
+ }
+ } else {
+ cc--;
+ }
+ ccf--;
+ break;
+ case 'S':
+ if (str[cc] == '+' || str[cc] == ' ') {
+ cc--;
+ } else {
+ cc -= iMinusLen - 1;
+ if (cc < 0 || wcsncmp(str + cc, wsMinus.c_str(), iMinusLen)) {
+ return false;
+ }
+ cc--;
+ bNeg = true;
+ }
+ ccf--;
+ break;
+ case 's':
+ if (str[cc] == '+') {
+ cc--;
+ } else {
+ cc -= iMinusLen - 1;
+ if (cc < 0 || wcsncmp(str + cc, wsMinus.c_str(), iMinusLen)) {
+ return false;
+ }
+ cc--;
+ bNeg = true;
+ }
+ ccf--;
+ break;
+ case 'E': {
+ if (cc >= dot_index) {
+ return false;
+ }
+ bool bExpSign = false;
+ while (cc >= 0) {
+ if (str[cc] == 'E' || str[cc] == 'e') {
+ break;
+ }
+ if (FXSYS_isDecimalDigit(str[cc])) {
+ iExponent = iExponent + (str[cc] - '0') * 10;
+ cc--;
+ continue;
+ } else if (str[cc] == '+') {
+ cc--;
+ continue;
+ } else if (cc - iMinusLen + 1 > 0 &&
+ !wcsncmp(str + (cc - iMinusLen + 1), wsMinus.c_str(),
+ iMinusLen)) {
+ bExpSign = true;
+ cc -= iMinusLen;
+ } else {
+ return false;
+ }
+ }
+ cc--;
+ iExponent = bExpSign ? -iExponent : iExponent;
+ ccf--;
+ } break;
+ case '$': {
+ CFX_WideString wsSymbol =
+ pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_CurrencySymbol);
+ int32_t iSymbolLen = wsSymbol.GetLength();
+ cc -= iSymbolLen - 1;
+ if (cc < 0 || wcsncmp(str + cc, wsSymbol.c_str(), iSymbolLen)) {
+ return false;
+ }
+ cc--;
+ ccf--;
+ } break;
+ case 'r':
+ if (ccf - 1 >= 0 && strf[ccf - 1] == 'c') {
+ if (str[cc] == 'R' && cc - 1 >= 0 && str[cc - 1] == 'C') {
+ bNeg = true;
+ cc -= 2;
+ }
+ ccf -= 2;
+ } else {
+ ccf--;
+ }
+ break;
+ case 'R':
+ if (ccf - 1 >= 0 && strf[ccf - 1] == 'C') {
+ if (str[cc] == ' ') {
+ cc++;
+ } else if (str[cc] == 'R' && cc - 1 >= 0 && str[cc - 1] == 'C') {
+ bNeg = true;
+ cc -= 2;
+ }
+ ccf -= 2;
+ } else {
+ ccf--;
+ }
+ break;
+ case 'b':
+ if (ccf - 1 >= 0 && strf[ccf - 1] == 'd') {
+ if (str[cc] == 'B' && cc - 1 >= 0 && str[cc - 1] == 'D') {
+ bNeg = true;
+ cc -= 2;
+ }
+ ccf -= 2;
+ } else {
+ ccf--;
+ }
+ break;
+ case 'B':
+ if (ccf - 1 >= 0 && strf[ccf - 1] == 'D') {
+ if (str[cc] == ' ') {
+ cc++;
+ } else if (str[cc] == 'B' && cc - 1 >= 0 && str[cc - 1] == 'D') {
+ bNeg = true;
+ cc -= 2;
+ }
+ ccf -= 2;
+ } else {
+ ccf--;
+ }
+ break;
+ case '.':
+ case 'V':
+ case 'v':
+ return false;
+ case '%': {
+ CFX_WideString wsSymbol =
+ pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Percent);
+ int32_t iSysmbolLen = wsSymbol.GetLength();
+ cc -= iSysmbolLen - 1;
+ if (cc < 0 || wcsncmp(str + cc, wsSymbol.c_str(), iSysmbolLen)) {
+ return false;
+ }
+ cc--;
+ ccf--;
+ bHavePercentSymbol = true;
+ } break;
+ case '8':
+ return false;
+ case ',': {
+ if (cc >= 0) {
+ cc -= iGroupLen - 1;
+ if (cc >= 0 &&
+ wcsncmp(str + cc, wsGroupSymbol.c_str(), iGroupLen) == 0) {
+ cc--;
+ } else {
+ cc += iGroupLen - 1;
+ }
+ }
+ ccf--;
+ } break;
+ case '(':
+ if (str[cc] == L'(') {
+ bNeg = true;
+ } else if (str[cc] != L' ') {
+ return false;
+ }
+ cc--;
+ ccf--;
+ break;
+ case ')':
+ if (str[cc] == L')') {
+ bNeg = true;
+ } else if (str[cc] != L' ') {
+ return false;
+ }
+ cc--;
+ ccf--;
+ break;
+ default:
+ if (strf[ccf] != str[cc]) {
+ return false;
+ }
+ cc--;
+ ccf--;
+ }
+ }
+ if (cc >= 0) {
+ if (str[cc] == '-') {
+ bNeg = true;
+ cc--;
+ }
+ if (cc >= 0) {
+ return false;
+ }
+ }
+ if (dot_index < len && (dwFormatStyle & FX_NUMSTYLE_DotVorv)) {
+ wsValue += '.';
+ }
+ if (!bReverseParse) {
+ ccf = dot_index_f + 1;
+ cc = (dot_index == len) ? len : dot_index + 1;
+ while (cc < len && ccf < lenf) {
+ switch (strf[ccf]) {
+ case '\'': {
+ CFX_WideString wsLiteral = GetLiteralText(strf, ccf, lenf);
+ int32_t iLiteralLen = wsLiteral.GetLength();
+ if (cc + iLiteralLen > len ||
+ wcsncmp(str + cc, wsLiteral.c_str(), iLiteralLen)) {
+ return false;
+ }
+ cc += iLiteralLen;
+ ccf++;
+ break;
+ }
+ case '9':
+ if (!FXSYS_isDecimalDigit(str[cc])) {
+ return false;
+ }
+ { wsValue += str[cc]; }
+ cc++;
+ ccf++;
+ break;
+ case 'z':
+ if (FXSYS_isDecimalDigit(str[cc])) {
+ wsValue += str[cc];
+ cc++;
+ }
+ ccf++;
+ break;
+ case 'Z':
+ if (str[cc] != ' ') {
+ if (FXSYS_isDecimalDigit(str[cc])) {
+ wsValue += str[cc];
+ cc++;
+ }
+ } else {
+ cc++;
+ }
+ ccf++;
+ break;
+ case 'S':
+ if (str[cc] == '+' || str[cc] == ' ') {
+ cc++;
+ } else {
+ if (cc + iMinusLen > len ||
+ wcsncmp(str + cc, wsMinus.c_str(), iMinusLen)) {
+ return false;
+ }
+ bNeg = true;
+ cc += iMinusLen;
+ }
+ ccf++;
+ break;
+ case 's':
+ if (str[cc] == '+') {
+ cc++;
+ } else {
+ if (cc + iMinusLen > len ||
+ wcsncmp(str + cc, wsMinus.c_str(), iMinusLen)) {
+ return false;
+ }
+ bNeg = true;
+ cc += iMinusLen;
+ }
+ ccf++;
+ break;
+ case 'E': {
+ if (cc >= len || (str[cc] != 'E' && str[cc] != 'e')) {
+ return false;
+ }
+ bool bExpSign = false;
+ cc++;
+ if (cc < len) {
+ if (str[cc] == '+') {
+ cc++;
+ } else if (str[cc] == '-') {
+ bExpSign = true;
+ cc++;
+ }
+ }
+ while (cc < len) {
+ if (!FXSYS_isDecimalDigit(str[cc])) {
+ break;
+ }
+ iExponent = iExponent * 10 + str[cc] - '0';
+ cc++;
+ }
+ iExponent = bExpSign ? -iExponent : iExponent;
+ ccf++;
+ } break;
+ case '$': {
+ CFX_WideString wsSymbol =
+ pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_CurrencySymbol);
+ int32_t iSymbolLen = wsSymbol.GetLength();
+ if (cc + iSymbolLen > len ||
+ wcsncmp(str + cc, wsSymbol.c_str(), iSymbolLen)) {
+ return false;
+ }
+ cc += iSymbolLen;
+ ccf++;
+ } break;
+ case 'c':
+ if (ccf + 1 < lenf && strf[ccf + 1] == 'r') {
+ if (str[cc] == 'C' && cc + 1 < len && str[cc + 1] == 'R') {
+ bNeg = true;
+ cc += 2;
+ }
+ ccf += 2;
+ }
+ break;
+ case 'C':
+ if (ccf + 1 < lenf && strf[ccf + 1] == 'R') {
+ if (str[cc] == ' ') {
+ cc++;
+ } else if (str[cc] == 'C' && cc + 1 < len && str[cc + 1] == 'R') {
+ bNeg = true;
+ cc += 2;
+ }
+ ccf += 2;
+ }
+ break;
+ case 'd':
+ if (ccf + 1 < lenf && strf[ccf + 1] == 'b') {
+ if (str[cc] == 'D' && cc + 1 < len && str[cc + 1] == 'B') {
+ bNeg = true;
+ cc += 2;
+ }
+ ccf += 2;
+ }
+ break;
+ case 'D':
+ if (ccf + 1 < lenf && strf[ccf + 1] == 'B') {
+ if (str[cc] == ' ') {
+ cc++;
+ } else if (str[cc] == 'D' && cc + 1 < len && str[cc + 1] == 'B') {
+ bNeg = true;
+ cc += 2;
+ }
+ ccf += 2;
+ }
+ break;
+ case '.':
+ case 'V':
+ case 'v':
+ return false;
+ case '%': {
+ CFX_WideString wsSymbol =
+ pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Percent);
+ int32_t iSysmbolLen = wsSymbol.GetLength();
+ if (cc + iSysmbolLen <= len &&
+ !wcsncmp(str + cc, wsSymbol.c_str(), iSysmbolLen)) {
+ cc += iSysmbolLen;
+ }
+ ccf++;
+ bHavePercentSymbol = true;
+ } break;
+ case '8': {
+ while (ccf < lenf && strf[ccf] == '8') {
+ ccf++;
+ }
+ while (cc < len && FXSYS_isDecimalDigit(str[cc])) {
+ wsValue += str[cc];
+ cc++;
+ }
+ } break;
+ case ',': {
+ if (cc + iGroupLen <= len &&
+ wcsncmp(str + cc, wsGroupSymbol.c_str(), iGroupLen) == 0) {
+ cc += iGroupLen;
+ }
+ ccf++;
+ } break;
+ case '(':
+ if (str[cc] == L'(') {
+ bNeg = true;
+ } else if (str[cc] != L' ') {
+ return false;
+ }
+ cc++;
+ ccf++;
+ break;
+ case ')':
+ if (str[cc] == L')') {
+ bNeg = true;
+ } else if (str[cc] != L' ') {
+ return false;
+ }
+ cc++;
+ ccf++;
+ break;
+ default:
+ if (strf[ccf] != str[cc]) {
+ return false;
+ }
+ cc++;
+ ccf++;
+ }
+ }
+ if (cc != len) {
+ return false;
+ }
+ }
+ if (iExponent || bHavePercentSymbol) {
+ CFX_Decimal decimal = CFX_Decimal(wsValue.AsStringC());
+ if (iExponent) {
+ decimal = decimal *
+ CFX_Decimal(FXSYS_pow(10, static_cast<float>(iExponent)), 3);
+ }
+ if (bHavePercentSymbol) {
+ decimal = decimal / CFX_Decimal(100);
+ }
+ wsValue = decimal;
+ }
+ if (bNeg) {
+ wsValue = L'-' + wsValue;
+ }
+ return true;
+}
+
+FX_DATETIMETYPE CFGAS_FormatString::GetDateTimeFormat(
+ const CFX_WideString& wsPattern,
+ IFX_Locale*& pLocale,
+ CFX_WideString& wsDatePattern,
+ CFX_WideString& wsTimePattern) {
+ pLocale = nullptr;
+ CFX_WideString wsTempPattern;
+ FX_LOCALECATEGORY eCategory = FX_LOCALECATEGORY_Unknown;
+ int32_t ccf = 0;
+ int32_t iLenf = wsPattern.GetLength();
+ const wchar_t* pStr = wsPattern.c_str();
+ int32_t iFindCategory = 0;
+ bool bBraceOpen = false;
+ CFX_WideStringC wsConstChars(gs_wsConstChars);
+ while (ccf < iLenf) {
+ if (pStr[ccf] == '\'') {
+ int32_t iCurChar = ccf;
+ GetLiteralText(pStr, ccf, iLenf);
+ wsTempPattern += CFX_WideStringC(pStr + iCurChar, ccf - iCurChar + 1);
+ } else if (!bBraceOpen && iFindCategory != 3 &&
+ wsConstChars.Find(pStr[ccf]) == -1) {
+ CFX_WideString wsCategory(pStr[ccf]);
+ ccf++;
+ while (ccf < iLenf && pStr[ccf] != '{' && pStr[ccf] != '.' &&
+ pStr[ccf] != '(') {
+ if (pStr[ccf] == 'T') {
+ wsDatePattern = wsPattern.Left(ccf);
+ wsTimePattern = wsPattern.Right(wsPattern.GetLength() - ccf);
+ wsTimePattern.SetAt(0, ' ');
+ if (!pLocale) {
+ pLocale = m_pLocaleMgr->GetDefLocale();
+ }
+ return FX_DATETIMETYPE_DateTime;
+ }
+ wsCategory += pStr[ccf];
+ ccf++;
+ }
+ if (!(iFindCategory & 1) && wsCategory == L"date") {
+ iFindCategory |= 1;
+ eCategory = FX_LOCALECATEGORY_Date;
+ if (iFindCategory & 2) {
+ iFindCategory = 4;
+ }
+ } else if (!(iFindCategory & 2) && wsCategory == L"time") {
+ iFindCategory |= 2;
+ eCategory = FX_LOCALECATEGORY_Time;
+ } else if (wsCategory == L"datetime") {
+ iFindCategory = 3;
+ eCategory = FX_LOCALECATEGORY_DateTime;
+ } else {
+ continue;
+ }
+ while (ccf < iLenf) {
+ if (pStr[ccf] == '(') {
+ ccf++;
+ CFX_WideString wsLCID;
+ while (ccf < iLenf && pStr[ccf] != ')') {
+ wsLCID += pStr[ccf++];
+ }
+ pLocale = GetPatternLocale(wsLCID);
+ } else if (pStr[ccf] == '{') {
+ bBraceOpen = true;
+ break;
+ } else if (pStr[ccf] == '.') {
+ CFX_WideString wsSubCategory;
+ ccf++;
+ while (ccf < iLenf && pStr[ccf] != '(' && pStr[ccf] != '{') {
+ wsSubCategory += pStr[ccf++];
+ }
+ uint32_t dwSubHash =
+ FX_HashCode_GetW(wsSubCategory.AsStringC(), false);
+ FX_LOCALEDATETIMESUBCATEGORY eSubCategory =
+ FX_LOCALEDATETIMESUBCATEGORY_Medium;
+ for (int32_t i = 0; i < g_iFXLocaleDateTimeSubCatCount; i++) {
+ if (g_FXLocaleDateTimeSubCatData[i].uHash == dwSubHash) {
+ eSubCategory =
+ (FX_LOCALEDATETIMESUBCATEGORY)g_FXLocaleDateTimeSubCatData[i]
+ .eSubCategory;
+ break;
+ }
+ }
+ if (!pLocale) {
+ pLocale = m_pLocaleMgr->GetDefLocale();
+ }
+ ASSERT(pLocale);
+ switch (eCategory) {
+ case FX_LOCALECATEGORY_Date:
+ wsDatePattern =
+ wsTempPattern + pLocale->GetDatePattern(eSubCategory);
+ break;
+ case FX_LOCALECATEGORY_Time:
+ wsTimePattern =
+ wsTempPattern + pLocale->GetTimePattern(eSubCategory);
+ break;
+ case FX_LOCALECATEGORY_DateTime:
+ wsDatePattern =
+ wsTempPattern + pLocale->GetDatePattern(eSubCategory);
+ wsTimePattern = pLocale->GetTimePattern(eSubCategory);
+ break;
+ default:
+ break;
+ }
+ wsTempPattern.clear();
+ continue;
+ }
+ ccf++;
+ }
+ } else if (pStr[ccf] == '}') {
+ bBraceOpen = false;
+ if (!wsTempPattern.IsEmpty()) {
+ if (eCategory == FX_LOCALECATEGORY_Time) {
+ wsTimePattern = wsTempPattern;
+ } else if (eCategory == FX_LOCALECATEGORY_Date) {
+ wsDatePattern = wsTempPattern;
+ }
+ wsTempPattern.clear();
+ }
+ } else {
+ wsTempPattern += pStr[ccf];
+ }
+ ccf++;
+ }
+ if (!wsTempPattern.IsEmpty()) {
+ if (eCategory == FX_LOCALECATEGORY_Date) {
+ wsDatePattern += wsTempPattern;
+ } else {
+ wsTimePattern += wsTempPattern;
+ }
+ }
+ if (!pLocale) {
+ pLocale = m_pLocaleMgr->GetDefLocale();
+ }
+ if (!iFindCategory) {
+ wsTimePattern.clear();
+ wsDatePattern = wsPattern;
+ }
+ return (FX_DATETIMETYPE)iFindCategory;
+}
+
+bool CFGAS_FormatString::ParseDateTime(const CFX_WideString& wsSrcDateTime,
+ const CFX_WideString& wsPattern,
+ FX_DATETIMETYPE eDateTimeType,
+ CFX_DateTime* dtValue) {
+ dtValue->Reset();
+
+ if (wsSrcDateTime.IsEmpty() || wsPattern.IsEmpty()) {
+ return false;
+ }
+ CFX_WideString wsDatePattern, wsTimePattern;
+ IFX_Locale* pLocale = nullptr;
+ FX_DATETIMETYPE eCategory =
+ GetDateTimeFormat(wsPattern, pLocale, wsDatePattern, wsTimePattern);
+ if (!pLocale) {
+ return false;
+ }
+ if (eCategory == FX_DATETIMETYPE_Unknown) {
+ eCategory = eDateTimeType;
+ }
+ if (eCategory == FX_DATETIMETYPE_Unknown) {
+ return false;
+ }
+ if (eCategory == FX_DATETIMETYPE_TimeDate) {
+ int32_t iStart = 0;
+ if (!ParseLocaleTime(wsSrcDateTime, wsTimePattern, pLocale, dtValue,
+ iStart)) {
+ return false;
+ }
+ if (!ParseLocaleDate(wsSrcDateTime, wsDatePattern, pLocale, dtValue,
+ iStart)) {
+ return false;
+ }
+ } else {
+ int32_t iStart = 0;
+ if ((eCategory & FX_DATETIMETYPE_Date) &&
+ !ParseLocaleDate(wsSrcDateTime, wsDatePattern, pLocale, dtValue,
+ iStart)) {
+ return false;
+ }
+ if ((eCategory & FX_DATETIMETYPE_Time) &&
+ !ParseLocaleTime(wsSrcDateTime, wsTimePattern, pLocale, dtValue,
+ iStart)) {
+ return false;
+ }
+ }
+ return true;
+}
+bool CFGAS_FormatString::ParseZero(const CFX_WideString& wsSrcText,
+ const CFX_WideString& wsPattern) {
+ CFX_WideString wsTextFormat;
+ GetTextFormat(wsPattern, L"zero", wsTextFormat);
+ int32_t iText = 0, iPattern = 0;
+ const wchar_t* pStrText = wsSrcText.c_str();
+ int32_t iLenText = wsSrcText.GetLength();
+ const wchar_t* pStrPattern = wsTextFormat.c_str();
+ int32_t iLenPattern = wsTextFormat.GetLength();
+ while (iPattern < iLenPattern && iText < iLenText) {
+ if (pStrPattern[iPattern] == '\'') {
+ CFX_WideString wsLiteral =
+ GetLiteralText(pStrPattern, iPattern, iLenPattern);
+ int32_t iLiteralLen = wsLiteral.GetLength();
+ if (iText + iLiteralLen > iLenText ||
+ wcsncmp(pStrText + iText, wsLiteral.c_str(), iLiteralLen)) {
+ return false;
+ }
+ iText += iLiteralLen;
+ iPattern++;
+ continue;
+ } else if (pStrPattern[iPattern] != pStrText[iText]) {
+ return false;
+ } else {
+ iText++;
+ iPattern++;
+ }
+ }
+ return iPattern == iLenPattern && iText == iLenText;
+}
+bool CFGAS_FormatString::ParseNull(const CFX_WideString& wsSrcText,
+ const CFX_WideString& wsPattern) {
+ CFX_WideString wsTextFormat;
+ GetTextFormat(wsPattern, L"null", wsTextFormat);
+ int32_t iText = 0, iPattern = 0;
+ const wchar_t* pStrText = wsSrcText.c_str();
+ int32_t iLenText = wsSrcText.GetLength();
+ const wchar_t* pStrPattern = wsTextFormat.c_str();
+ int32_t iLenPattern = wsTextFormat.GetLength();
+ while (iPattern < iLenPattern && iText < iLenText) {
+ if (pStrPattern[iPattern] == '\'') {
+ CFX_WideString wsLiteral =
+ GetLiteralText(pStrPattern, iPattern, iLenPattern);
+ int32_t iLiteralLen = wsLiteral.GetLength();
+ if (iText + iLiteralLen > iLenText ||
+ wcsncmp(pStrText + iText, wsLiteral.c_str(), iLiteralLen)) {
+ return false;
+ }
+ iText += iLiteralLen;
+ iPattern++;
+ continue;
+ } else if (pStrPattern[iPattern] != pStrText[iText]) {
+ return false;
+ } else {
+ iText++;
+ iPattern++;
+ }
+ }
+ return iPattern == iLenPattern && iText == iLenText;
+}
+bool CFGAS_FormatString::FormatText(const CFX_WideString& wsSrcText,
+ const CFX_WideString& wsPattern,
+ CFX_WideString& wsOutput) {
+ if (wsPattern.IsEmpty()) {
+ return false;
+ }
+ int32_t iLenText = wsSrcText.GetLength();
+ if (iLenText == 0) {
+ return false;
+ }
+ CFX_WideString wsTextFormat;
+ GetTextFormat(wsPattern, L"text", wsTextFormat);
+ int32_t iText = 0, iPattern = 0;
+ const wchar_t* pStrText = wsSrcText.c_str();
+ const wchar_t* pStrPattern = wsTextFormat.c_str();
+ int32_t iLenPattern = wsTextFormat.GetLength();
+ while (iPattern < iLenPattern) {
+ switch (pStrPattern[iPattern]) {
+ case '\'': {
+ wsOutput += GetLiteralText(pStrPattern, iPattern, iLenPattern);
+ iPattern++;
+ break;
+ }
+ case 'A':
+ if (iText >= iLenText || !FXSYS_iswalpha(pStrText[iText])) {
+ return false;
+ }
+ wsOutput += pStrText[iText++];
+ iPattern++;
+ break;
+ case 'X':
+ if (iText >= iLenText) {
+ return false;
+ }
+ wsOutput += pStrText[iText++];
+ iPattern++;
+ break;
+ case 'O':
+ case '0':
+ if (iText >= iLenText || (!FXSYS_isDecimalDigit(pStrText[iText]) &&
+ !FXSYS_iswalpha(pStrText[iText]))) {
+ return false;
+ }
+ wsOutput += pStrText[iText++];
+ iPattern++;
+ break;
+ case '9':
+ if (iText >= iLenText || !FXSYS_isDecimalDigit(pStrText[iText])) {
+ return false;
+ }
+ wsOutput += pStrText[iText++];
+ iPattern++;
+ break;
+ default:
+ wsOutput += pStrPattern[iPattern++];
+ break;
+ }
+ }
+ return iText == iLenText;
+}
+
+bool CFGAS_FormatString::FormatStrNum(const CFX_WideStringC& wsInputNum,
+ const CFX_WideString& wsPattern,
+ CFX_WideString& wsOutput) {
+ if (wsInputNum.IsEmpty() || wsPattern.IsEmpty()) {
+ return false;
+ }
+ int32_t dot_index_f = -1;
+ uint32_t dwNumStyle = 0;
+ CFX_WideString wsNumFormat;
+ IFX_Locale* pLocale =
+ GetNumericFormat(wsPattern, dot_index_f, dwNumStyle, wsNumFormat);
+ if (!pLocale || wsNumFormat.IsEmpty()) {
+ return false;
+ }
+ int32_t cc = 0, ccf = 0;
+ const wchar_t* strf = wsNumFormat.c_str();
+ int lenf = wsNumFormat.GetLength();
+ CFX_WideString wsSrcNum(wsInputNum);
+ wsSrcNum.TrimLeft('0');
+ if (wsSrcNum.IsEmpty() || wsSrcNum[0] == '.') {
+ wsSrcNum.Insert(0, '0');
+ }
+ CFX_Decimal decimal = CFX_Decimal(wsSrcNum.AsStringC());
+ if (dwNumStyle & FX_NUMSTYLE_Percent) {
+ decimal = decimal * CFX_Decimal(100);
+ wsSrcNum = decimal;
+ }
+ int32_t exponent = 0;
+ if (dwNumStyle & FX_NUMSTYLE_Exponent) {
+ int fixed_count = 0;
+ while (ccf < dot_index_f) {
+ switch (strf[ccf]) {
+ case '\'':
+ GetLiteralText(strf, ccf, dot_index_f);
+ break;
+ case '9':
+ case 'z':
+ case 'Z':
+ fixed_count++;
+ break;
+ }
+ ccf++;
+ }
+ int threshold = 1;
+ while (fixed_count > 1) {
+ threshold *= 10;
+ fixed_count--;
+ }
+ if (decimal != CFX_Decimal(0)) {
+ if (decimal < CFX_Decimal(threshold)) {
+ decimal = decimal * CFX_Decimal(10);
+ exponent = -1;
+ while (decimal < CFX_Decimal(threshold)) {
+ decimal = decimal * CFX_Decimal(10);
+ exponent -= 1;
+ }
+ } else if (decimal > CFX_Decimal(threshold)) {
+ threshold *= 10;
+ while (decimal > CFX_Decimal(threshold)) {
+ decimal = decimal / CFX_Decimal(10);
+ exponent += 1;
+ }
+ }
+ }
+ }
+ bool bTrimTailZeros = false;
+ int32_t iTreading =
+ GetNumTrailingLimit(wsNumFormat, dot_index_f, bTrimTailZeros);
+ int32_t scale = decimal.GetScale();
+ if (iTreading < scale) {
+ decimal.SetScale(iTreading);
+ wsSrcNum = decimal;
+ }
+ if (bTrimTailZeros && scale > 0 && iTreading > 0) {
+ wsSrcNum.TrimRight(L"0");
+ wsSrcNum.TrimRight(L".");
+ }
+ CFX_WideString wsGroupSymbol =
+ pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Grouping);
+ bool bNeg = false;
+ if (wsSrcNum[0] == '-') {
+ bNeg = true;
+ wsSrcNum.Delete(0, 1);
+ }
+ bool bAddNeg = false;
+ const wchar_t* str = wsSrcNum.c_str();
+ int len = wsSrcNum.GetLength();
+ int dot_index = wsSrcNum.Find('.');
+ if (dot_index == -1) {
+ dot_index = len;
+ }
+ ccf = dot_index_f - 1;
+ cc = dot_index - 1;
+ while (ccf >= 0) {
+ switch (strf[ccf]) {
+ case '9':
+ if (cc >= 0) {
+ if (!FXSYS_isDecimalDigit(str[cc])) {
+ return false;
+ }
+ wsOutput = str[cc] + wsOutput;
+ cc--;
+ } else {
+ wsOutput = L'0' + wsOutput;
+ }
+ ccf--;
+ break;
+ case 'z':
+ if (cc >= 0) {
+ if (!FXSYS_isDecimalDigit(str[cc])) {
+ return false;
+ }
+ if (str[0] != '0') {
+ wsOutput = str[cc] + wsOutput;
+ }
+ cc--;
+ }
+ ccf--;
+ break;
+ case 'Z':
+ if (cc >= 0) {
+ if (!FXSYS_isDecimalDigit(str[cc])) {
+ return false;
+ }
+ if (str[0] == '0') {
+ wsOutput = L' ' + wsOutput;
+ } else {
+ wsOutput = str[cc] + wsOutput;
+ }
+ cc--;
+ } else {
+ wsOutput = L' ' + wsOutput;
+ }
+ ccf--;
+ break;
+ case 'S':
+ if (bNeg) {
+ wsOutput =
+ pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Minus) + wsOutput;
+ bAddNeg = true;
+ } else {
+ wsOutput = L' ' + wsOutput;
+ }
+ ccf--;
+ break;
+ case 's':
+ if (bNeg) {
+ wsOutput =
+ pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Minus) + wsOutput;
+ bAddNeg = true;
+ }
+ ccf--;
+ break;
+ case 'E': {
+ CFX_WideString wsExp;
+ wsExp.Format(L"E%+d", exponent);
+ wsOutput = wsExp + wsOutput;
+ }
+ ccf--;
+ break;
+ case '$': {
+ wsOutput =
+ pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_CurrencySymbol) +
+ wsOutput;
+ }
+ ccf--;
+ break;
+ case 'r':
+ if (ccf - 1 >= 0 && strf[ccf - 1] == 'c') {
+ if (bNeg) {
+ wsOutput = L"CR" + wsOutput;
+ }
+ ccf -= 2;
+ bAddNeg = true;
+ }
+ break;
+ case 'R':
+ if (ccf - 1 >= 0 && strf[ccf - 1] == 'C') {
+ if (bNeg) {
+ wsOutput = L"CR" + wsOutput;
+ } else {
+ wsOutput = L" " + wsOutput;
+ }
+ ccf -= 2;
+ bAddNeg = true;
+ }
+ break;
+ case 'b':
+ if (ccf - 1 >= 0 && strf[ccf - 1] == 'd') {
+ if (bNeg) {
+ wsOutput = L"db" + wsOutput;
+ }
+ ccf -= 2;
+ bAddNeg = true;
+ }
+ break;
+ case 'B':
+ if (ccf - 1 >= 0 && strf[ccf - 1] == 'D') {
+ if (bNeg) {
+ wsOutput = L"DB" + wsOutput;
+ } else {
+ wsOutput = L" " + wsOutput;
+ }
+ ccf -= 2;
+ bAddNeg = true;
+ }
+ break;
+ case '%': {
+ wsOutput =
+ pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Percent) + wsOutput;
+ }
+ ccf--;
+ break;
+ case ',':
+ if (cc >= 0) {
+ wsOutput = wsGroupSymbol + wsOutput;
+ }
+ ccf--;
+ break;
+ case '(':
+ if (bNeg) {
+ wsOutput = L"(" + wsOutput;
+ } else {
+ wsOutput = L" " + wsOutput;
+ }
+ bAddNeg = true;
+ ccf--;
+ break;
+ case ')':
+ if (bNeg) {
+ wsOutput = L")" + wsOutput;
+ } else {
+ wsOutput = L" " + wsOutput;
+ }
+ ccf--;
+ break;
+ case '\'':
+ wsOutput = GetLiteralTextReverse(strf, ccf) + wsOutput;
+ ccf--;
+ break;
+ default:
+ wsOutput = strf[ccf] + wsOutput;
+ ccf--;
+ }
+ }
+ if (cc >= 0) {
+ int nPos = dot_index % 3;
+ wsOutput.clear();
+ for (int32_t i = 0; i < dot_index; i++) {
+ if (i % 3 == nPos && i != 0) {
+ wsOutput += wsGroupSymbol;
+ }
+ wsOutput += wsSrcNum[i];
+ }
+ if (dot_index < len) {
+ wsOutput += pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Decimal);
+ wsOutput += wsSrcNum.Right(len - dot_index - 1);
+ }
+ if (bNeg) {
+ wsOutput =
+ pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Minus) + wsOutput;
+ }
+ return false;
+ }
+ if (dot_index_f == wsNumFormat.GetLength()) {
+ if (!bAddNeg && bNeg) {
+ wsOutput =
+ pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Minus) + wsOutput;
+ }
+ return true;
+ }
+
+ CFX_WideString wsDotSymbol =
+ pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Decimal);
+ if (strf[dot_index_f] == 'V') {
+ wsOutput += wsDotSymbol;
+ } else if (strf[dot_index_f] == '.') {
+ if (dot_index < len) {
+ wsOutput += wsDotSymbol;
+ } else {
+ if (strf[dot_index_f + 1] == '9' || strf[dot_index_f + 1] == 'Z') {
+ wsOutput += wsDotSymbol;
+ }
+ }
+ }
+ ccf = dot_index_f + 1;
+ cc = dot_index + 1;
+ while (ccf < lenf) {
+ switch (strf[ccf]) {
+ case '\'':
+ wsOutput += GetLiteralText(strf, ccf, lenf);
+ ccf++;
+ break;
+ case '9':
+ if (cc < len) {
+ if (!FXSYS_isDecimalDigit(str[cc])) {
+ return false;
+ }
+ wsOutput += str[cc];
+ cc++;
+ } else {
+ wsOutput += L'0';
+ }
+ ccf++;
+ break;
+ case 'z':
+ if (cc < len) {
+ if (!FXSYS_isDecimalDigit(str[cc])) {
+ return false;
+ }
+ wsOutput += str[cc];
+ cc++;
+ }
+ ccf++;
+ break;
+ case 'Z':
+ if (cc < len) {
+ if (!FXSYS_isDecimalDigit(str[cc])) {
+ return false;
+ }
+ wsOutput += str[cc];
+ cc++;
+ } else {
+ wsOutput += L'0';
+ }
+ ccf++;
+ break;
+ case 'E': {
+ CFX_WideString wsExp;
+ wsExp.Format(L"E%+d", exponent);
+ wsOutput += wsExp;
+ ccf++;
+ } break;
+ case '$':
+ wsOutput +=
+ pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_CurrencySymbol);
+ ccf++;
+ break;
+ case 'c':
+ if (ccf + 1 < lenf && strf[ccf + 1] == 'r') {
+ if (bNeg) {
+ wsOutput += L"CR";
+ }
+ ccf += 2;
+ bAddNeg = true;
+ }
+ break;
+ case 'C':
+ if (ccf + 1 < lenf && strf[ccf + 1] == 'R') {
+ if (bNeg) {
+ wsOutput += L"CR";
+ } else {
+ wsOutput += L" ";
+ }
+ ccf += 2;
+ bAddNeg = true;
+ }
+ break;
+ case 'd':
+ if (ccf + 1 < lenf && strf[ccf + 1] == 'b') {
+ if (bNeg) {
+ wsOutput += L"db";
+ }
+ ccf += 2;
+ bAddNeg = true;
+ }
+ break;
+ case 'D':
+ if (ccf + 1 < lenf && strf[ccf + 1] == 'B') {
+ if (bNeg) {
+ wsOutput += L"DB";
+ } else {
+ wsOutput += L" ";
+ }
+ ccf += 2;
+ bAddNeg = true;
+ }
+ break;
+ case '%':
+ wsOutput += pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Percent);
+ ccf++;
+ break;
+ case '8':
+ while (ccf < lenf && strf[ccf] == '8')
+ ccf++;
+ while (cc < len && FXSYS_isDecimalDigit(str[cc])) {
+ wsOutput += str[cc];
+ cc++;
+ }
+ break;
+ case ',':
+ wsOutput += wsGroupSymbol;
+ ccf++;
+ break;
+ case '(':
+ if (bNeg) {
+ wsOutput += '(';
+ } else {
+ wsOutput += ' ';
+ }
+ bAddNeg = true;
+ ccf++;
+ break;
+ case ')':
+ if (bNeg) {
+ wsOutput += ')';
+ } else {
+ wsOutput += ' ';
+ }
+ ccf++;
+ break;
+ default:
+ ccf++;
+ }
+ }
+ if (!bAddNeg && bNeg) {
+ wsOutput = pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Minus) +
+ wsOutput[0] + wsOutput.Mid(1, wsOutput.GetLength() - 1);
+ }
+ return true;
+}
+
+bool CFGAS_FormatString::FormatNum(const CFX_WideString& wsSrcNum,
+ const CFX_WideString& wsPattern,
+ CFX_WideString& wsOutput) {
+ if (wsSrcNum.IsEmpty() || wsPattern.IsEmpty()) {
+ return false;
+ }
+ return FormatStrNum(wsSrcNum.AsStringC(), wsPattern, wsOutput);
+}
+
+bool CFGAS_FormatString::FormatDateTime(const CFX_WideString& wsSrcDateTime,
+ const CFX_WideString& wsPattern,
+ CFX_WideString& wsOutput,
+ FX_DATETIMETYPE eDateTimeType) {
+ if (wsSrcDateTime.IsEmpty() || wsPattern.IsEmpty()) {
+ return false;
+ }
+ CFX_WideString wsDatePattern, wsTimePattern;
+ IFX_Locale* pLocale = nullptr;
+ FX_DATETIMETYPE eCategory =
+ GetDateTimeFormat(wsPattern, pLocale, wsDatePattern, wsTimePattern);
+ if (!pLocale) {
+ return false;
+ }
+ if (eCategory == FX_DATETIMETYPE_Unknown) {
+ if (eDateTimeType == FX_DATETIMETYPE_Time) {
+ wsTimePattern = wsDatePattern;
+ wsDatePattern.clear();
+ }
+ eCategory = eDateTimeType;
+ }
+ if (eCategory == FX_DATETIMETYPE_Unknown) {
+ return false;
+ }
+ CFX_DateTime dt;
+ int32_t iT = wsSrcDateTime.Find(L"T");
+ if (iT < 0) {
+ if (eCategory == FX_DATETIMETYPE_Date &&
+ FX_DateFromCanonical(wsSrcDateTime, &dt)) {
+ return FormatDateTimeInternal(dt, wsDatePattern, wsTimePattern, true,
+ pLocale, wsOutput);
+ }
+ if (eCategory == FX_DATETIMETYPE_Time &&
+ FX_TimeFromCanonical(wsSrcDateTime.AsStringC(), &dt, pLocale)) {
+ return FormatDateTimeInternal(dt, wsDatePattern, wsTimePattern, true,
+ pLocale, wsOutput);
+ }
+ } else {
+ CFX_WideString wsSrcDate(wsSrcDateTime.c_str(), iT);
+ CFX_WideStringC wsSrcTime(wsSrcDateTime.c_str() + iT + 1,
+ wsSrcDateTime.GetLength() - iT - 1);
+ if (wsSrcDate.IsEmpty() || wsSrcTime.IsEmpty())
+ return false;
+
+ if (FX_DateFromCanonical(wsSrcDate, &dt) &&
+ FX_TimeFromCanonical(wsSrcTime, &dt, pLocale)) {
+ return FormatDateTimeInternal(dt, wsDatePattern, wsTimePattern,
+ eCategory != FX_DATETIMETYPE_TimeDate,
+ pLocale, wsOutput);
+ }
+ }
+ return false;
+}
+
+bool CFGAS_FormatString::FormatZero(const CFX_WideString& wsPattern,
+ CFX_WideString& wsOutput) {
+ if (wsPattern.IsEmpty()) {
+ return false;
+ }
+ CFX_WideString wsTextFormat;
+ GetTextFormat(wsPattern, L"zero", wsTextFormat);
+ int32_t iPattern = 0;
+ const wchar_t* pStrPattern = wsTextFormat.c_str();
+ int32_t iLenPattern = wsTextFormat.GetLength();
+ while (iPattern < iLenPattern) {
+ if (pStrPattern[iPattern] == '\'') {
+ wsOutput += GetLiteralText(pStrPattern, iPattern, iLenPattern);
+ iPattern++;
+ continue;
+ } else {
+ wsOutput += pStrPattern[iPattern++];
+ continue;
+ }
+ }
+ return true;
+}
+bool CFGAS_FormatString::FormatNull(const CFX_WideString& wsPattern,
+ CFX_WideString& wsOutput) {
+ if (wsPattern.IsEmpty()) {
+ return false;
+ }
+ CFX_WideString wsTextFormat;
+ GetTextFormat(wsPattern, L"null", wsTextFormat);
+ int32_t iPattern = 0;
+ const wchar_t* pStrPattern = wsTextFormat.c_str();
+ int32_t iLenPattern = wsTextFormat.GetLength();
+ while (iPattern < iLenPattern) {
+ if (pStrPattern[iPattern] == '\'') {
+ wsOutput += GetLiteralText(pStrPattern, iPattern, iLenPattern);
+ iPattern++;
+ continue;
+ } else {
+ wsOutput += pStrPattern[iPattern++];
+ continue;
+ }
+ }
+ return true;
+}
+
+IFX_Locale* CFGAS_FormatString::GetPatternLocale(
+ const CFX_WideString& wsLocale) {
+ return m_pLocaleMgr->GetLocaleByName(wsLocale);
+}
diff --git a/chromium/third_party/pdfium/xfa/fgas/crt/cfgas_formatstring.h b/chromium/third_party/pdfium/xfa/fgas/crt/cfgas_formatstring.h
new file mode 100644
index 00000000000..d2d35a3042d
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fgas/crt/cfgas_formatstring.h
@@ -0,0 +1,76 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef XFA_FGAS_CRT_CFGAS_FORMATSTRING_H_
+#define XFA_FGAS_CRT_CFGAS_FORMATSTRING_H_
+
+#include <vector>
+
+#include "core/fxcrt/ifx_locale.h"
+#include "xfa/fxfa/parser/cxfa_localemgr.h"
+
+bool FX_DateFromCanonical(const CFX_WideString& wsDate, CFX_DateTime* datetime);
+bool FX_TimeFromCanonical(const CFX_WideStringC& wsTime,
+ CFX_DateTime* datetime,
+ IFX_Locale* pLocale);
+
+class CFGAS_FormatString {
+ public:
+ explicit CFGAS_FormatString(CXFA_LocaleMgr* pLocaleMgr);
+ ~CFGAS_FormatString();
+
+ void SplitFormatString(const CFX_WideString& wsFormatString,
+ std::vector<CFX_WideString>& wsPatterns);
+ FX_LOCALECATEGORY GetCategory(const CFX_WideString& wsPattern);
+ CFX_WideString GetLocaleName(const CFX_WideString& wsPattern);
+ bool ParseText(const CFX_WideString& wsSrcText,
+ const CFX_WideString& wsPattern,
+ CFX_WideString& wsValue);
+ bool ParseNum(const CFX_WideString& wsSrcNum,
+ const CFX_WideString& wsPattern,
+ CFX_WideString& wsValue);
+ bool ParseDateTime(const CFX_WideString& wsSrcDateTime,
+ const CFX_WideString& wsPattern,
+ FX_DATETIMETYPE eDateTimeType,
+ CFX_DateTime* dtValue);
+ bool ParseZero(const CFX_WideString& wsSrcText,
+ const CFX_WideString& wsPattern);
+ bool ParseNull(const CFX_WideString& wsSrcText,
+ const CFX_WideString& wsPattern);
+ bool FormatText(const CFX_WideString& wsSrcText,
+ const CFX_WideString& wsPattern,
+ CFX_WideString& wsOutput);
+ bool FormatNum(const CFX_WideString& wsSrcNum,
+ const CFX_WideString& wsPattern,
+ CFX_WideString& wsOutput);
+ bool FormatDateTime(const CFX_WideString& wsSrcDateTime,
+ const CFX_WideString& wsPattern,
+ CFX_WideString& wsOutput,
+ FX_DATETIMETYPE eDateTimeType);
+ bool FormatZero(const CFX_WideString& wsPattern, CFX_WideString& wsOutput);
+ bool FormatNull(const CFX_WideString& wsPattern, CFX_WideString& wsOutput);
+
+ private:
+ IFX_Locale* GetTextFormat(const CFX_WideString& wsPattern,
+ const CFX_WideStringC& wsCategory,
+ CFX_WideString& wsPurgePattern);
+ IFX_Locale* GetNumericFormat(const CFX_WideString& wsPattern,
+ int32_t& iDotIndex,
+ uint32_t& dwStyle,
+ CFX_WideString& wsPurgePattern);
+ bool FormatStrNum(const CFX_WideStringC& wsInputNum,
+ const CFX_WideString& wsPattern,
+ CFX_WideString& wsOutput);
+ FX_DATETIMETYPE GetDateTimeFormat(const CFX_WideString& wsPattern,
+ IFX_Locale*& pLocale,
+ CFX_WideString& wsDatePattern,
+ CFX_WideString& wsTimePattern);
+ IFX_Locale* GetPatternLocale(const CFX_WideString& wsLocale);
+
+ CXFA_LocaleMgr* m_pLocaleMgr;
+};
+
+#endif // XFA_FGAS_CRT_CFGAS_FORMATSTRING_H_
diff --git a/chromium/third_party/pdfium/xfa/fgas/crt/fgas_codepage.cpp b/chromium/third_party/pdfium/xfa/fgas/crt/fgas_codepage.cpp
index 36f87a36f3f..cae2dd72340 100644
--- a/chromium/third_party/pdfium/xfa/fgas/crt/fgas_codepage.cpp
+++ b/chromium/third_party/pdfium/xfa/fgas/crt/fgas_codepage.cpp
@@ -10,404 +10,134 @@
namespace {
-struct FX_STR2CPHASH {
- uint32_t uHash;
- uint16_t uCodePage;
-};
-
struct FX_CHARSET_MAP {
uint16_t charset;
uint16_t codepage;
};
-struct FX_LANG2CPMAP {
- uint16_t wLanguage;
- uint16_t wCodepage;
-};
-
const FX_CHARSET_MAP g_FXCharset2CodePageTable[] = {
- {0, 1252}, {1, 0}, {2, 42}, {77, 10000}, {78, 10001},
- {79, 10003}, {80, 10008}, {81, 10002}, {83, 10005}, {84, 10004},
- {85, 10006}, {86, 10081}, {87, 10021}, {88, 10029}, {89, 10007},
- {128, 932}, {129, 949}, {130, 1361}, {134, 936}, {136, 950},
- {161, 1253}, {162, 1254}, {163, 1258}, {177, 1255}, {178, 1256},
- {186, 1257}, {204, 1251}, {222, 874}, {238, 1250}, {254, 437},
- {255, 850},
-};
-
-const FX_LANG2CPMAP g_FXLang2CodepageTable[] = {
- {FX_LANG_Arabic_SaudiArabia, FX_CODEPAGE_MSWin_Arabic},
- {FX_LANG_Bulgarian_Bulgaria, FX_CODEPAGE_MSWin_Cyrillic},
- {FX_LANG_Catalan_Catalan, FX_CODEPAGE_MSWin_WesternEuropean},
- {FX_LANG_Chinese_Taiwan, FX_CODEPAGE_ChineseTraditional},
- {FX_LANG_CzechRepublic, FX_CODEPAGE_MSWin_EasternEuropean},
- {FX_LANG_Danish_Denmark, FX_CODEPAGE_MSWin_WesternEuropean},
- {FX_LANG_German_Germany, FX_CODEPAGE_MSWin_WesternEuropean},
- {FX_LANG_Greek_Greece, FX_CODEPAGE_MSWin_Greek},
- {FX_LANG_English_UnitedStates, FX_CODEPAGE_MSWin_WesternEuropean},
- {FX_LANG_Spanish_TraditionalSort, FX_CODEPAGE_MSWin_WesternEuropean},
- {FX_LANG_Finnish_Finland, FX_CODEPAGE_MSWin_WesternEuropean},
- {FX_LANG_French_France, FX_CODEPAGE_MSWin_WesternEuropean},
- {FX_LANG_Hebrew_Israel, FX_CODEPAGE_MSWin_Hebrew},
- {FX_LANG_Hungarian_Hungary, FX_CODEPAGE_MSWin_EasternEuropean},
- {FX_LANG_Icelandic_Iceland, FX_CODEPAGE_MSWin_WesternEuropean},
- {FX_LANG_Italian_Italy, FX_CODEPAGE_MSWin_WesternEuropean},
- {FX_LANG_Japanese_Japan, FX_CODEPAGE_ShiftJIS},
- {FX_LANG_Korean_Korea, FX_CODEPAGE_Korean},
- {FX_LANG_Dutch_Netherlands, FX_CODEPAGE_MSWin_WesternEuropean},
- {FX_LANG_Norwegian_Bokmal, FX_CODEPAGE_MSWin_WesternEuropean},
- {FX_LANG_Polish_Poland, FX_CODEPAGE_MSWin_EasternEuropean},
- {FX_LANG_Portuguese_Brazil, FX_CODEPAGE_MSWin_WesternEuropean},
- {FX_LANG_Romanian_Romania, FX_CODEPAGE_MSWin_EasternEuropean},
- {FX_LANG_Russian_Russia, FX_CODEPAGE_MSWin_Cyrillic},
- {FX_LANG_Croatian_Croatia, FX_CODEPAGE_MSWin_EasternEuropean},
- {FX_LANG_Slovak_Slovakia, FX_CODEPAGE_MSWin_EasternEuropean},
- {FX_LANG_Albanian_Albania, FX_CODEPAGE_MSWin_EasternEuropean},
- {FX_LANG_Swedish_Sweden, FX_CODEPAGE_MSWin_WesternEuropean},
- {FX_LANG_Thai_Thailand, FX_CODEPAGE_MSDOS_Thai},
- {FX_LANG_Turkish_Turkey, FX_CODEPAGE_MSWin_Turkish},
- {FX_LANG_Urdu_Pakistan, FX_CODEPAGE_MSWin_Arabic},
- {FX_LANG_Indonesian_Indonesia, FX_CODEPAGE_MSWin_WesternEuropean},
- {FX_LANG_Ukrainian_Ukraine, FX_CODEPAGE_MSWin_Cyrillic},
- {FX_LANG_Belarusian_Belarus, FX_CODEPAGE_MSWin_Cyrillic},
- {FX_LANG_Slovenian_Slovenia, FX_CODEPAGE_MSWin_EasternEuropean},
- {FX_LANG_Estonian_Estonia, FX_CODEPAGE_MSWin_Baltic},
- {FX_LANG_Latvian_Latvia, FX_CODEPAGE_MSWin_Baltic},
- {FX_LANG_Lithuanian_Lithuania, FX_CODEPAGE_MSWin_Baltic},
- {FX_LANG_Persian, FX_CODEPAGE_MSWin_Arabic},
- {FX_LANG_Vietnamese_Vietnam, FX_CODEPAGE_MSWin_Vietnamese},
- {FX_LANG_Armenian_Armenia, FX_CODEPAGE_DefANSI},
- {FX_LANG_Azerbaijan_Latin, FX_CODEPAGE_MSWin_Turkish},
- {FX_LANG_Basque_Basque, FX_CODEPAGE_MSWin_WesternEuropean},
- {FX_LANG_Macedonian, FX_CODEPAGE_MSWin_Cyrillic},
- {FX_LANG_Afrikaans_SouthAfrica, FX_CODEPAGE_MSWin_WesternEuropean},
- {FX_LANG_Georgian_Georgia, FX_CODEPAGE_DefANSI},
- {FX_LANG_Faroese_FaroeIslands, FX_CODEPAGE_MSWin_WesternEuropean},
- {FX_LANG_Hindi_India, FX_CODEPAGE_DefANSI},
- {FX_LANG_Malay_Malaysia, FX_CODEPAGE_MSWin_WesternEuropean},
- {FX_LANG_Kazakh_Kazakhstan, FX_CODEPAGE_MSWin_Cyrillic},
- {FX_LANG_Kyrgyz_Kyrgyzstan, FX_CODEPAGE_MSWin_Cyrillic},
- {FX_LANG_Kiswahili_Kenya, FX_CODEPAGE_MSWin_WesternEuropean},
- {FX_LANG_Uzbek_LatinUzbekistan, FX_CODEPAGE_MSWin_Turkish},
- {FX_LANG_Tatar_Russia, FX_CODEPAGE_MSWin_Cyrillic},
- {FX_LANG_Punjabi_India, FX_CODEPAGE_DefANSI},
- {FX_LANG_Gujarati_India, FX_CODEPAGE_DefANSI},
- {FX_LANG_Tamil_India, FX_CODEPAGE_DefANSI},
- {FX_LANG_Telugu_India, FX_CODEPAGE_DefANSI},
- {FX_LANG_Kannada_India, FX_CODEPAGE_DefANSI},
- {FX_LANG_Marathi_India, FX_CODEPAGE_DefANSI},
- {FX_LANG_SanskritIndia, FX_CODEPAGE_DefANSI},
- {FX_LANG_Mongolian_CyrillicMongolia, FX_CODEPAGE_MSWin_Cyrillic},
- {FX_LANG_Galician_Galician, FX_CODEPAGE_MSWin_WesternEuropean},
- {FX_LANG_Konkani_India, FX_CODEPAGE_DefANSI},
- {FX_LANG_Syriac_Syria, FX_CODEPAGE_DefANSI},
- {FX_LANG_Divehi_Maldives, FX_CODEPAGE_DefANSI},
- {FX_LANG_Arabic_Iraq, FX_CODEPAGE_MSWin_Arabic},
- {FX_LANG_Chinese_PRC, FX_CODEPAGE_ChineseSimplified},
- {FX_LANG_German_Switzerland, FX_CODEPAGE_MSWin_WesternEuropean},
- {FX_LANG_English_UnitedKingdom, FX_CODEPAGE_MSWin_WesternEuropean},
- {FX_LANG_Spanish_Mexico, FX_CODEPAGE_MSWin_WesternEuropean},
- {FX_LANG_French_Belgium, FX_CODEPAGE_MSWin_WesternEuropean},
- {FX_LANG_Italian_Switzerland, FX_CODEPAGE_MSWin_WesternEuropean},
- {FX_LANG_Dutch_Belgium, FX_CODEPAGE_MSWin_WesternEuropean},
- {FX_LANG_Norwegian_Nynorsk, FX_CODEPAGE_MSWin_WesternEuropean},
- {FX_LANG_Portuguese_Portugal, FX_CODEPAGE_MSWin_WesternEuropean},
- {FX_LANG_SerbianLatin_Serbia, FX_CODEPAGE_MSWin_EasternEuropean},
- {FX_LANG_Swedish_Finland, FX_CODEPAGE_MSWin_WesternEuropean},
- {FX_LANG_Azerbaijan_Cyrillic, FX_CODEPAGE_MSWin_Cyrillic},
- {FX_LANG_Malay_BruneiDarussalam, FX_CODEPAGE_MSWin_WesternEuropean},
- {FX_LANG_Uzbek_CyrillicUzbekistan, FX_CODEPAGE_MSWin_Cyrillic},
- {FX_LANG_Arabic_Egypt, FX_CODEPAGE_MSWin_Arabic},
- {FX_LANG_Chinese_HongKong, FX_CODEPAGE_ChineseTraditional},
- {FX_LANG_German_Austria, FX_CODEPAGE_MSWin_WesternEuropean},
- {FX_LANG_English_Australia, FX_CODEPAGE_MSWin_WesternEuropean},
- {FX_LANG_Spanish_InternationalSort, FX_CODEPAGE_MSWin_WesternEuropean},
- {FX_LANG_French_Canada, FX_CODEPAGE_MSWin_WesternEuropean},
- {FX_LANG_SerbianCyrillic_Serbia, FX_CODEPAGE_MSWin_Cyrillic},
- {FX_LANG_Arabic_Libya, FX_CODEPAGE_MSWin_Arabic},
- {FX_LANG_Chinese_Singapore, FX_CODEPAGE_ChineseSimplified},
- {FX_LANG_German_Luxembourg, FX_CODEPAGE_MSWin_WesternEuropean},
- {FX_LANG_English_Canada, FX_CODEPAGE_MSWin_WesternEuropean},
- {FX_LANG_Spanish_Guatemala, FX_CODEPAGE_MSWin_WesternEuropean},
- {FX_LANG_French_Switzerland, FX_CODEPAGE_MSWin_WesternEuropean},
- {FX_LANG_Arabic_Algeria, FX_CODEPAGE_MSWin_Arabic},
- {FX_LANG_Chinese_Macao, FX_CODEPAGE_ChineseTraditional},
- {FX_LANG_German_Liechtenstein, FX_CODEPAGE_MSWin_WesternEuropean},
- {FX_LANG_English_NewZealand, FX_CODEPAGE_MSWin_WesternEuropean},
- {FX_LANG_Spanish_CostaRica, FX_CODEPAGE_MSWin_WesternEuropean},
- {FX_LANG_French_Luxembourg, FX_CODEPAGE_MSWin_WesternEuropean},
- {FX_LANG_Arabic_Morocco, FX_CODEPAGE_MSWin_Arabic},
- {FX_LANG_English_Ireland, FX_CODEPAGE_MSWin_WesternEuropean},
- {FX_LANG_Spanish_Panama, FX_CODEPAGE_MSWin_WesternEuropean},
- {FX_LANG_French_Monaco, FX_CODEPAGE_MSWin_WesternEuropean},
- {FX_LANG_Arabic_Tunisia, FX_CODEPAGE_MSWin_Arabic},
- {FX_LANG_English_SouthAfrica, FX_CODEPAGE_MSWin_WesternEuropean},
- {FX_LANG_Spanish_DominicanRepublic, FX_CODEPAGE_MSWin_WesternEuropean},
- {FX_LANG_Arabic_Oman, FX_CODEPAGE_MSWin_Arabic},
- {FX_LANG_English_Jamaica, FX_CODEPAGE_MSWin_WesternEuropean},
- {FX_LANG_Spanish_Venezuela, FX_CODEPAGE_MSWin_WesternEuropean},
- {FX_LANG_Arabic_Yemen, FX_CODEPAGE_MSWin_Arabic},
- {FX_LANG_English_Caribbean, FX_CODEPAGE_MSWin_WesternEuropean},
- {FX_LANG_Spanish_Colombia, FX_CODEPAGE_MSWin_WesternEuropean},
- {FX_LANG_Arabic_Syria, FX_CODEPAGE_MSWin_Arabic},
- {FX_LANG_English_Belize, FX_CODEPAGE_MSWin_WesternEuropean},
- {FX_LANG_Spanish_Peru, FX_CODEPAGE_MSWin_WesternEuropean},
- {FX_LANG_Arabic_Jordan, FX_CODEPAGE_MSWin_Arabic},
- {FX_LANG_English_TrinidadTobago, FX_CODEPAGE_MSWin_WesternEuropean},
- {FX_LANG_Spanish_Argentina, FX_CODEPAGE_MSWin_WesternEuropean},
- {FX_LANG_Arabic_Lebanon, FX_CODEPAGE_MSWin_Arabic},
- {FX_LANG_English_Zimbabwe, FX_CODEPAGE_MSWin_WesternEuropean},
- {FX_LANG_Spanish_Ecuador, FX_CODEPAGE_MSWin_WesternEuropean},
- {FX_LANG_Arabic_Kuwait, FX_CODEPAGE_MSWin_Arabic},
- {FX_LANG_English_Philippines, FX_CODEPAGE_MSWin_WesternEuropean},
- {FX_LANG_Spanish_Chile, FX_CODEPAGE_MSWin_WesternEuropean},
- {FX_LANG_Arabic_UAE, FX_CODEPAGE_MSWin_Arabic},
- {FX_LANG_Spanish_Uruguay, FX_CODEPAGE_MSWin_WesternEuropean},
- {FX_LANG_Arabic_Bahrain, FX_CODEPAGE_MSWin_Arabic},
- {FX_LANG_Spanish_Paraguay, FX_CODEPAGE_MSWin_WesternEuropean},
- {FX_LANG_Arabic_Qatar, FX_CODEPAGE_MSWin_Arabic},
- {FX_LANG_Spanish_Bolivia, FX_CODEPAGE_MSWin_WesternEuropean},
- {FX_LANG_Spanish_ElSalvador, FX_CODEPAGE_MSWin_WesternEuropean},
- {FX_LANG_Spanish_Honduras, FX_CODEPAGE_MSWin_WesternEuropean},
- {FX_LANG_Spanish_Nicaragua, FX_CODEPAGE_MSWin_WesternEuropean},
- {FX_LANG_Spanish_PuertoRico, FX_CODEPAGE_MSWin_WesternEuropean},
-};
-
-const FX_STR2CPHASH g_FXCPHashTable[] = {
- {0xd45, 0x6faf}, {0xd46, 0x6fb0}, {0xd47, 0x6fb1},
- {0xd48, 0x6fb2}, {0xd49, 0x4e6}, {0xd4d, 0x6fbd},
- {0xe9e, 0x4e4}, {0xc998, 0x1b5}, {0x18ef0, 0x3a8},
- {0x19f85, 0x5182}, {0x2e2335, 0x3b6}, {0x325153, 0x5182},
- {0x145bded, 0x2716}, {0x3c9a5f2, 0xc6f3}, {0x4c45f2d, 0x3a4},
- {0x4c45f4e, 0xc431}, {0x58caf51, 0x4e4}, {0x5a5cd7d, 0x3a8},
- {0x5a6c6a7, 0x4e4}, {0x5a6ca0b, 0x1b5}, {0x5a6cd68, 0x307},
- {0x5a6d8d3, 0x4e4}, {0x5a6d948, 0x354}, {0x5a6d96b, 0x362},
- {0x5a6d984, 0x366}, {0x5a90e35, 0x1b5}, {0x5e0cf00, 0x6fb5},
- {0x609c324, 0x551}, {0x617d97f, 0x5182}, {0x6a6fd91, 0xfde8},
- {0x6a6fd92, 0xfde9}, {0x6b102de, 0xcadc}, {0x6b10f48, 0x4e89},
- {0x1020805f, 0x4e4}, {0x10f0524c, 0x6fb5}, {0x11d558fe, 0x6fb0},
- {0x13898d19, 0xc42d}, {0x13898d3a, 0xc431}, {0x138a319e, 0x6fb1},
- {0x14679c09, 0x96c6}, {0x153f0a3d, 0x6fb2}, {0x1576eeb3, 0x4e20},
- {0x169a0ce6, 0xc6f9}, {0x16f3e2dc, 0x6fb3}, {0x18a8bb7a, 0x6fb4},
- {0x1a5d9419, 0x6fb5}, {0x1a847b48, 0x3a8}, {0x1b762419, 0xcec8},
- {0x1b9d7847, 0x475}, {0x1c126cb9, 0x6fb6}, {0x1ccdbc7d, 0x4f42},
- {0x1d330f5f, 0x2714}, {0x1dc74559, 0x4e6}, {0x1edd80da, 0x4e4},
- {0x23e4b03d, 0xfde8}, {0x24f28a16, 0x4f3d}, {0x286e7a32, 0x2715},
- {0x2c7c18ed, 0x3a8}, {0x2e2103b7, 0x2713}, {0x304bf479, 0x6fb4},
- {0x304bf47d, 0x6fb5}, {0x309bb869, 0xfde8}, {0x309bb86a, 0xfde9},
- {0x33664357, 0x3b6}, {0x352d6b49, 0x3a4}, {0x36f5661c, 0x1b5},
- {0x392e8f48, 0xcadc}, {0x3dc7c64c, 0x47c}, {0x3ed2e8e1, 0x4e4},
- {0x3f0c2fea, 0xcaed}, {0x3f0fef8f, 0xc6f2}, {0x3f5e130f, 0x5182},
- {0x47174d1f, 0x3a8}, {0x49686b7b, 0x6fb4}, {0x4b80b0d9, 0x3a4},
- {0x4dcda97a, 0x4e4}, {0x4dcda9b6, 0x4e4}, {0x4e881e6a, 0x5221},
- {0x4ffdf5a1, 0x36a}, {0x4ffdf5a5, 0x6fbd}, {0x5241ce16, 0x4e8b},
- {0x546bab9d, 0x4e4}, {0x54a3d64e, 0x6fb6}, {0x562179bd, 0x5161},
- {0x57c1df15, 0xc6f7}, {0x61ff6e62, 0x4f36}, {0x6359c7d8, 0x4f35},
- {0x63f3c335, 0x3a8}, {0x645a0f78, 0x477}, {0x691ac2fd, 0x275f},
- {0x6dc2eab0, 0x2d0}, {0x6dc2eeef, 0x35e}, {0x6dc2ef10, 0x36a},
- {0x7103138a, 0x47d}, {0x710dfbd0, 0xc6f5}, {0x7319f6cb, 0x36a},
- {0x745096ad, 0x3a8}, {0x74866229, 0x4e8c}, {0x77185fa5, 0x3a8},
- {0x7953f002, 0x6faf}, {0x7953f003, 0x6fb0}, {0x7953f004, 0x6fb1},
- {0x7953f005, 0x6fb2}, {0x7953f006, 0x6fb7}, {0x7953f00a, 0x6fbd},
- {0x7c577571, 0x2761}, {0x7e8c8ff1, 0x479}, {0x8031f47f, 0x3b5},
- {0x8031f481, 0x3b5}, {0x80c4a710, 0x5187}, {0x857c7e14, 0xfde8},
- {0x857c7e15, 0xfde9}, {0x86b59c90, 0x4e4}, {0x86b59c91, 0x6fb0},
- {0x86b59c92, 0x6fb1}, {0x86b59c93, 0x6fb2}, {0x86b59c94, 0x6fb3},
- {0x86b59c95, 0x6fb4}, {0x86b59c96, 0x6fb5}, {0x86b59c97, 0x4e7},
- {0x86b59c98, 0x4e6}, {0x8b4b24ec, 0x5190}, {0x8face362, 0x4e4},
- {0x8ff9ec2a, 0xfde9}, {0x919d3989, 0xcadc}, {0x9967e5ad, 0x4e22},
- {0x99f8b933, 0x6fbd}, {0x9bd2a380, 0x4fc7}, {0x9befad23, 0x4f38},
- {0x9c7ac649, 0x4f3c}, {0xa02468db, 0xdeae}, {0xa02468ec, 0xdeab},
- {0xa024692a, 0xdeaa}, {0xa0246997, 0xdeb2}, {0xa02469ff, 0xdeb0},
- {0xa0246a3d, 0xdeb1}, {0xa0246a8c, 0xdeaf}, {0xa0246a9a, 0xdeb3},
- {0xa0246b16, 0xdeac}, {0xa0246b1a, 0xdead}, {0xa071addc, 0x4b1},
- {0xa38b62dc, 0x474}, {0xa4c09fed, 0x3a8}, {0xa51e86e5, 0x4e7},
- {0xa67ab13e, 0x3a4}, {0xa7414244, 0x51a9}, {0xa9ddbead, 0xc6fb},
- {0xab24ffab, 0x4e8a}, {0xabef8ac4, 0x2710}, {0xabfa20ac, 0x6fb4},
- {0xad36895e, 0x4e2}, {0xad36895f, 0x4e3}, {0xaf310e90, 0x402},
- {0xaf31166f, 0x4e8}, {0xaf7277a5, 0x3b6}, {0xafc0d8b3, 0x96c6},
- {0xb0fd5dba, 0xcae0}, {0xb0fd5e95, 0xcadc}, {0xb1052893, 0x7149},
- {0xb1e98745, 0x36a}, {0xb277e91c, 0x5166}, {0xb2f7eac5, 0xcae0},
- {0xb2f7eba0, 0xcadc}, {0xb2f7ebc1, 0x3b5}, {0xb53fa77d, 0x3a8},
- {0xb6391138, 0x6fb5}, {0xb7358b7f, 0x6fb6}, {0xb8c42b40, 0x4e4},
- {0xb8c42ea4, 0x1b5}, {0xb8c439e7, 0x2e1}, {0xb8c43a61, 0x307},
- {0xb8c43d6c, 0x4e4}, {0xb8c43ddf, 0x352}, {0xb8c43de1, 0x354},
- {0xb8c43de6, 0x359}, {0xb8c43dff, 0x35d}, {0xb8c43e04, 0x362},
- {0xb8c43e07, 0x365}, {0xbcd29a7f, 0x3a8}, {0xbce34e78, 0x5182},
- {0xbce34e7b, 0x556a}, {0xbce81504, 0x3b5}, {0xbd8a4c95, 0x272d},
- {0xbdd89dad, 0x4e4}, {0xbdd89dae, 0x6fb0}, {0xbdd89daf, 0x6fb1},
- {0xbdd89db0, 0x6fb2}, {0xbdd89db1, 0x4e6}, {0xbdd89db5, 0x6fbd},
- {0xc1756e9f, 0x36b}, {0xc7482444, 0x47a}, {0xc9281c18, 0x4e4},
- {0xc9ef95df, 0x47b}, {0xccc9db0d, 0x4e4}, {0xccc9db0e, 0x6fb0},
- {0xcd73425f, 0x3b6}, {0xce38b40b, 0x4b0}, {0xce99e549, 0x25},
- {0xcf598740, 0x4e7}, {0xcf6d6f78, 0x4e4}, {0xcf758df6, 0x3a4},
- {0xd1266e51, 0x6fb5}, {0xd2910213, 0x2718}, {0xd29196bb, 0x2712},
- {0xd3eb2fc2, 0x476}, {0xd442dc2c, 0x4fc4}, {0xd9da4da4, 0x2711},
- {0xdbad2f42, 0x4e4}, {0xdbad2f43, 0x6fb0}, {0xdbad2f44, 0x6fb1},
- {0xdbad2f45, 0x6fb2}, {0xdbad2f46, 0x6fb3}, {0xdbad2f47, 0x6fb4},
- {0xdbad2f48, 0x6fb5}, {0xdbad2f49, 0x6fb6}, {0xdbad2f4a, 0x4e6},
- {0xdc438033, 0x4f31}, {0xdccb439b, 0x477}, {0xdccdc626, 0x3b5},
- {0xdd80a595, 0x4e4}, {0xdd80a596, 0x6fb0}, {0xdd80a59e, 0x6fb1},
- {0xdd80a5b4, 0x6fb2}, {0xdd80a5d9, 0x6fb5}, {0xdd80a5da, 0x6fb4},
- {0xdd80a5fa, 0x6fb6}, {0xdd80a615, 0x6fb3}, {0xdd80a619, 0x4e6},
- {0xdd80a61a, 0x3b5}, {0xdd80c0f8, 0x4e9f}, {0xdf7e46ff, 0x4fc8},
- {0xdf8680fd, 0x556a}, {0xdfb0bd6e, 0xc42d}, {0xdff05486, 0x2c4},
- {0xe3323399, 0x3a4}, {0xe60412dd, 0x3b5}, {0xeee47add, 0x4b0},
- {0xf021a186, 0x4e2}, {0xf021a187, 0x4e3}, {0xf021a188, 0x4e4},
- {0xf021a189, 0x4e5}, {0xf021a18a, 0x4e6}, {0xf021a18b, 0x4e7},
- {0xf021a18c, 0x4e8}, {0xf021a18d, 0x4e9}, {0xf021a18e, 0x4ea},
- {0xf0700456, 0x6fb3}, {0xf274f175, 0x3b5}, {0xf2a9730b, 0x3a8},
- {0xf3d463c2, 0x3a4}, {0xf52a70a3, 0xc42e}, {0xf5693147, 0x6fb3},
- {0xf637e157, 0x478}, {0xfc213f3a, 0x2717}, {0xff654d14, 0x3b5},
+ {FX_CHARSET_ANSI, FX_CODEPAGE_MSWin_WesternEuropean},
+ {FX_CHARSET_Default, FX_CODEPAGE_DefANSI},
+ {FX_CHARSET_Symbol, FX_CODEPAGE_Symbol},
+ {FX_CHARSET_MAC_Roman, FX_CODEPAGE_MAC_Roman},
+ {FX_CHARSET_MAC_ShiftJIS, FX_CODEPAGE_MAC_ShiftJIS},
+ {FX_CHARSET_MAC_Korean, FX_CODEPAGE_MAC_Korean},
+ {FX_CHARSET_MAC_ChineseSimplified, FX_CODEPAGE_MAC_ChineseSimplified},
+ {FX_CHARSET_MAC_ChineseTriditional, FX_CODEPAGE_MAC_ChineseTraditional},
+ {FX_CHARSET_MAC_Hebrew, FX_CODEPAGE_MAC_Hebrew},
+ {FX_CHARSET_MAC_Arabic, FX_CODEPAGE_MAC_Arabic},
+ {FX_CHARSET_MAC_Greek, FX_CODEPAGE_MAC_Greek},
+ {FX_CHARSET_MAC_Turkish, FX_CODEPAGE_MAC_Turkish},
+ {FX_CHARSET_MAC_Thai, FX_CODEPAGE_MAC_Thai},
+ {FX_CHARSET_MAC_EasternEuropean, FX_CODEPAGE_MAC_EasternEuropean},
+ {FX_CHARSET_MAC_Cyrillic, FX_CODEPAGE_MAC_Cyrillic},
+ {FX_CHARSET_ShiftJIS, FX_CODEPAGE_ShiftJIS},
+ {FX_CHARSET_Korean, FX_CODEPAGE_Korean},
+ {FX_CHARSET_Johab, FX_CODEPAGE_Johab},
+ {FX_CHARSET_ChineseSimplified, FX_CODEPAGE_ChineseSimplified},
+ {FX_CHARSET_ChineseTriditional, FX_CODEPAGE_ChineseTraditional},
+ {FX_CHARSET_MSWin_Greek, FX_CODEPAGE_MSWin_Greek},
+ {FX_CHARSET_MSWin_Turkish, FX_CODEPAGE_MSWin_Turkish},
+ {FX_CHARSET_MSWin_Vietnamese, FX_CODEPAGE_MSWin_Vietnamese},
+ {FX_CHARSET_MSWin_Hebrew, FX_CODEPAGE_MSWin_Hebrew},
+ {FX_CHARSET_MSWin_Arabic, FX_CODEPAGE_MSWin_Arabic},
+ {FX_CHARSET_MSWin_Baltic, FX_CODEPAGE_MSWin_Baltic},
+ {FX_CHARSET_MSWin_Cyrillic, FX_CODEPAGE_MSWin_Cyrillic},
+ {FX_CHARSET_Thai, FX_CODEPAGE_MSDOS_Thai},
+ {FX_CHARSET_MSWin_EasterEuropean, FX_CODEPAGE_MSWin_EasternEuropean},
+ {FX_CHARSET_US, FX_CODEPAGE_MSDOS_US},
+ {FX_CHARSET_OEM, FX_CODEPAGE_MSDOS_WesternEuropean},
};
-uint16_t GetCodePageFromStringA(const FX_CHAR* pStr, int32_t iLength) {
- ASSERT(pStr);
- if (iLength < 0) {
- iLength = FXSYS_strlen(pStr);
- }
- if (iLength == 0) {
- return 0xFFFF;
- }
- uint32_t uHash = FX_HashCode_GetA(CFX_ByteStringC(pStr, iLength), true);
- int32_t iStart = 0;
- int32_t iEnd = sizeof(g_FXCPHashTable) / sizeof(FX_STR2CPHASH) - 1;
- ASSERT(iEnd >= 0);
- do {
- int32_t iMid = (iStart + iEnd) / 2;
- const FX_STR2CPHASH& cp = g_FXCPHashTable[iMid];
- if (uHash == cp.uHash) {
- return (uint16_t)cp.uCodePage;
- } else if (uHash < cp.uHash) {
- iEnd = iMid - 1;
- } else {
- iStart = iMid + 1;
- }
- } while (iStart <= iEnd);
- return 0xFFFF;
-}
-
} // namespace
uint16_t FX_GetCodePageFromCharset(uint8_t charset) {
int32_t iEnd = sizeof(g_FXCharset2CodePageTable) / sizeof(FX_CHARSET_MAP) - 1;
ASSERT(iEnd >= 0);
+
int32_t iStart = 0, iMid;
do {
iMid = (iStart + iEnd) / 2;
const FX_CHARSET_MAP& cp = g_FXCharset2CodePageTable[iMid];
- if (charset == cp.charset) {
+ if (charset == cp.charset)
return cp.codepage;
- } else if (charset < cp.charset) {
+ if (charset < cp.charset)
iEnd = iMid - 1;
- } else {
+ else
iStart = iMid + 1;
- }
} while (iStart <= iEnd);
return 0xFFFF;
}
-uint16_t FX_GetDefCodePageByLanguage(uint16_t wLanguage) {
- int32_t iEnd = sizeof(g_FXLang2CodepageTable) / sizeof(FX_LANG2CPMAP) - 1;
- ASSERT(iEnd >= 0);
- int32_t iStart = 0, iMid;
- do {
- iMid = (iStart + iEnd) / 2;
- const FX_LANG2CPMAP& cp = g_FXLang2CodepageTable[iMid];
- if (wLanguage == cp.wLanguage) {
- return cp.wCodepage;
- } else if (wLanguage < cp.wLanguage) {
- iEnd = iMid - 1;
- } else {
- iStart = iMid + 1;
- }
- } while (iStart <= iEnd);
- return 0xFFFF;
-}
+void FX_SwapByteOrder(wchar_t* pStr, int32_t iLength) {
+ ASSERT(pStr);
-uint16_t FX_GetCodePageFromStringW(const FX_WCHAR* pStr, int32_t iLength) {
- if (iLength < 0) {
+ if (iLength < 0)
iLength = FXSYS_wcslen(pStr);
- }
- if (iLength == 0) {
- return 0xFFFF;
- }
- CFX_ByteString csStr;
- FX_CHAR* pBuf = csStr.GetBuffer(iLength + 1);
- for (int32_t i = 0; i < iLength; ++i) {
- *pBuf++ = (FX_CHAR)*pStr++;
- }
- csStr.ReleaseBuffer(iLength);
- return GetCodePageFromStringA(csStr.c_str(), iLength);
-}
-void FX_SwapByteOrder(FX_WCHAR* pStr, int32_t iLength) {
- ASSERT(pStr);
- if (iLength < 0) {
- iLength = FXSYS_wcslen(pStr);
- }
uint16_t wch;
- if (sizeof(FX_WCHAR) > 2) {
+ if (sizeof(wchar_t) > 2) {
while (iLength-- > 0) {
wch = (uint16_t)*pStr;
wch = (wch >> 8) | (wch << 8);
wch &= 0x00FF;
*pStr++ = wch;
}
- } else {
- while (iLength-- > 0) {
- wch = (uint16_t)*pStr;
- wch = (wch >> 8) | (wch << 8);
- *pStr++ = wch;
- }
+ return;
+ }
+
+ while (iLength-- > 0) {
+ wch = (uint16_t)*pStr;
+ wch = (wch >> 8) | (wch << 8);
+ *pStr++ = wch;
}
}
void FX_UTF16ToWChar(void* pBuffer, int32_t iLength) {
ASSERT(pBuffer && iLength > 0);
- if (sizeof(FX_WCHAR) == 2) {
+ if (sizeof(wchar_t) == 2)
return;
- }
- uint16_t* pSrc = (uint16_t*)pBuffer;
- FX_WCHAR* pDst = (FX_WCHAR*)pBuffer;
- while (--iLength >= 0) {
- pDst[iLength] = (FX_WCHAR)pSrc[iLength];
- }
+
+ uint16_t* pSrc = static_cast<uint16_t*>(pBuffer);
+ wchar_t* pDst = static_cast<wchar_t*>(pBuffer);
+ while (--iLength >= 0)
+ pDst[iLength] = static_cast<wchar_t>(pSrc[iLength]);
}
int32_t FX_DecodeString(uint16_t wCodePage,
- const FX_CHAR* pSrc,
+ const char* pSrc,
int32_t* pSrcLen,
- FX_WCHAR* pDst,
+ wchar_t* pDst,
int32_t* pDstLen,
bool bErrBreak) {
- if (wCodePage == FX_CODEPAGE_UTF8) {
+ if (wCodePage == FX_CODEPAGE_UTF8)
return FX_UTF8Decode(pSrc, pSrcLen, pDst, pDstLen);
- }
return -1;
}
-int32_t FX_UTF8Decode(const FX_CHAR* pSrc,
+
+int32_t FX_UTF8Decode(const char* pSrc,
int32_t* pSrcLen,
- FX_WCHAR* pDst,
+ wchar_t* pDst,
int32_t* pDstLen) {
- if (!pSrcLen || !pDstLen) {
+ if (!pSrcLen || !pDstLen)
return -1;
- }
+
int32_t iSrcLen = *pSrcLen;
if (iSrcLen < 1) {
*pSrcLen = *pDstLen = 0;
return 1;
}
+
int32_t iDstLen = *pDstLen;
bool bValidDst = (pDst && iDstLen > 0);
uint32_t dwCode = 0;
int32_t iPending = 0;
- int32_t iSrcNum = 0, iDstNum = 0;
- int32_t k = 0;
+ int32_t iSrcNum = 0;
+ int32_t iDstNum = 0;
int32_t iIndex = 0;
- k = 1;
+ int32_t k = 1;
while (iIndex < iSrcLen) {
- uint8_t byte = (uint8_t) * (pSrc + iIndex);
+ uint8_t byte = static_cast<uint8_t>(*(pSrc + iIndex));
if (byte < 0x80) {
iPending = 0;
k = 1;
@@ -415,14 +145,13 @@ int32_t FX_UTF8Decode(const FX_CHAR* pSrc,
iSrcNum += k;
if (bValidDst) {
*pDst++ = byte;
- if (iDstNum >= iDstLen) {
+ if (iDstNum >= iDstLen)
break;
- }
}
} else if (byte < 0xc0) {
- if (iPending < 1) {
+ if (iPending < 1)
break;
- }
+
iPending--;
dwCode |= (byte & 0x3f) << (iPending * 6);
if (iPending == 0) {
@@ -430,9 +159,8 @@ int32_t FX_UTF8Decode(const FX_CHAR* pSrc,
iSrcNum += k;
if (bValidDst) {
*pDst++ = dwCode;
- if (iDstNum >= iDstLen) {
+ if (iDstNum >= iDstLen)
break;
- }
}
}
} else if (byte < 0xe0) {
diff --git a/chromium/third_party/pdfium/xfa/fgas/crt/fgas_codepage.h b/chromium/third_party/pdfium/xfa/fgas/crt/fgas_codepage.h
index 780c20e2335..3dfabe600e8 100644
--- a/chromium/third_party/pdfium/xfa/fgas/crt/fgas_codepage.h
+++ b/chromium/third_party/pdfium/xfa/fgas/crt/fgas_codepage.h
@@ -134,20 +134,18 @@
#define FX_CHARSET_OEM 255
uint16_t FX_GetCodePageFromCharset(uint8_t charset);
-uint16_t FX_GetCodePageFromStringW(const FX_WCHAR* pStr, int32_t iLength);
-uint16_t FX_GetDefCodePageByLanguage(uint16_t wLanguage);
-void FX_SwapByteOrder(FX_WCHAR* pStr, int32_t iLength);
+void FX_SwapByteOrder(wchar_t* pStr, int32_t iLength);
void FX_UTF16ToWChar(void* pBuffer, int32_t iLength);
int32_t FX_DecodeString(uint16_t wCodePage,
- const FX_CHAR* pSrc,
+ const char* pSrc,
int32_t* pSrcLen,
- FX_WCHAR* pDst,
+ wchar_t* pDst,
int32_t* pDstLen,
bool bErrBreak);
-int32_t FX_UTF8Decode(const FX_CHAR* pSrc,
+int32_t FX_UTF8Decode(const char* pSrc,
int32_t* pSrcLen,
- FX_WCHAR* pDst,
+ wchar_t* pDst,
int32_t* pDstLen);
#endif // XFA_FGAS_CRT_FGAS_CODEPAGE_H_
diff --git a/chromium/third_party/pdfium/xfa/fgas/crt/fgas_stream.cpp b/chromium/third_party/pdfium/xfa/fgas/crt/fgas_stream.cpp
deleted file mode 100644
index 424b191cb8e..00000000000
--- a/chromium/third_party/pdfium/xfa/fgas/crt/fgas_stream.cpp
+++ /dev/null
@@ -1,1483 +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
-
-#include "xfa/fgas/crt/fgas_stream.h"
-
-#if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN32_MOBILE_ || \
- _FX_OS_ == _FX_WIN64_
-#include <io.h>
-#endif
-
-#include <algorithm>
-#include <memory>
-
-#include "third_party/base/ptr_util.h"
-#include "xfa/fgas/crt/fgas_codepage.h"
-
-namespace {
-
-class IFGAS_StreamImp {
- public:
- virtual ~IFGAS_StreamImp() {}
-
- virtual int32_t GetLength() const = 0;
- virtual int32_t Seek(FX_STREAMSEEK eSeek, int32_t iOffset) = 0;
- virtual int32_t GetPosition() = 0;
- virtual bool IsEOF() const = 0;
- virtual int32_t ReadData(uint8_t* pBuffer, int32_t iBufferSize) = 0;
- virtual int32_t ReadString(FX_WCHAR* pStr,
- int32_t iMaxLength,
- bool& bEOS) = 0;
- virtual int32_t WriteData(const uint8_t* pBuffer, int32_t iBufferSize) = 0;
- virtual int32_t WriteString(const FX_WCHAR* pStr, int32_t iLength) = 0;
- virtual void Flush() = 0;
- virtual bool SetLength(int32_t iLength) = 0;
-
- protected:
- IFGAS_StreamImp();
-
- uint32_t GetAccessModes() const { return m_dwAccess; }
- void SetAccessModes(uint32_t modes) { m_dwAccess = modes; }
-
- private:
- uint32_t m_dwAccess;
-};
-
-class CFGAS_FileStreamImp : public IFGAS_StreamImp {
- public:
- CFGAS_FileStreamImp();
- ~CFGAS_FileStreamImp() override;
-
- bool LoadFile(const FX_WCHAR* pszSrcFileName, uint32_t dwAccess);
-
- // IFGAS_StreamImp:
- int32_t GetLength() const override;
- int32_t Seek(FX_STREAMSEEK eSeek, int32_t iOffset) override;
- int32_t GetPosition() override;
- bool IsEOF() const override;
- int32_t ReadData(uint8_t* pBuffer, int32_t iBufferSize) override;
- int32_t ReadString(FX_WCHAR* pStr, int32_t iMaxLength, bool& bEOS) override;
- int32_t WriteData(const uint8_t* pBuffer, int32_t iBufferSize) override;
- int32_t WriteString(const FX_WCHAR* pStr, int32_t iLength) override;
- void Flush() override;
- bool SetLength(int32_t iLength) override;
-
- protected:
- FXSYS_FILE* m_hFile;
- int32_t m_iLength;
-};
-
-class CFGAS_BufferStreamImp : public IFGAS_StreamImp {
- public:
- CFGAS_BufferStreamImp();
- ~CFGAS_BufferStreamImp() override {}
-
- bool LoadBuffer(uint8_t* pData, int32_t iTotalSize, uint32_t dwAccess);
-
- // IFGAS_StreamImp:
- int32_t GetLength() const override;
- int32_t Seek(FX_STREAMSEEK eSeek, int32_t iOffset) override;
- int32_t GetPosition() override;
- bool IsEOF() const override;
- int32_t ReadData(uint8_t* pBuffer, int32_t iBufferSize) override;
- int32_t ReadString(FX_WCHAR* pStr, int32_t iMaxLength, bool& bEOS) override;
- int32_t WriteData(const uint8_t* pBuffer, int32_t iBufferSize) override;
- int32_t WriteString(const FX_WCHAR* pStr, int32_t iLength) override;
- void Flush() override {}
- bool SetLength(int32_t iLength) override { return false; }
-
- protected:
- uint8_t* m_pData;
- int32_t m_iTotalSize;
- int32_t m_iPosition;
- int32_t m_iLength;
-};
-
-class CFGAS_FileReadStreamImp : public IFGAS_StreamImp {
- public:
- CFGAS_FileReadStreamImp();
- ~CFGAS_FileReadStreamImp() override {}
-
- bool LoadFileRead(const CFX_RetainPtr<IFX_SeekableReadStream>& pFileRead,
- uint32_t dwAccess);
-
- // IFGAS_StreamImp:
- int32_t GetLength() const override;
- int32_t Seek(FX_STREAMSEEK eSeek, int32_t iOffset) override;
- int32_t GetPosition() override { return m_iPosition; }
- bool IsEOF() const override;
- int32_t ReadData(uint8_t* pBuffer, int32_t iBufferSize) override;
- int32_t ReadString(FX_WCHAR* pStr, int32_t iMaxLength, bool& bEOS) override;
- int32_t WriteData(const uint8_t* pBuffer, int32_t iBufferSize) override {
- return 0;
- }
- int32_t WriteString(const FX_WCHAR* pStr, int32_t iLength) override {
- return 0;
- }
- void Flush() override {}
- bool SetLength(int32_t iLength) override { return false; }
-
- protected:
- CFX_RetainPtr<IFX_SeekableReadStream> m_pFileRead;
- int32_t m_iPosition;
- int32_t m_iLength;
-};
-
-class CFGAS_BufferReadStreamImp : public IFGAS_StreamImp {
- public:
- CFGAS_BufferReadStreamImp();
- ~CFGAS_BufferReadStreamImp() override;
-
- bool LoadBufferRead(const CFX_RetainPtr<IFX_BufferedReadStream>& pBufferRead,
- int32_t iFileSize,
- uint32_t dwAccess);
-
- // IFGAS_StreamImp:
- int32_t GetLength() const override;
- int32_t Seek(FX_STREAMSEEK eSeek, int32_t iOffset) override;
- int32_t GetPosition() override { return m_iPosition; }
- bool IsEOF() const override;
- int32_t ReadData(uint8_t* pBuffer, int32_t iBufferSize) override;
- int32_t ReadString(FX_WCHAR* pStr, int32_t iMaxLength, bool& bEOS) override;
- int32_t WriteData(const uint8_t* pBuffer, int32_t iBufferSize) override {
- return 0;
- }
- int32_t WriteString(const FX_WCHAR* pStr, int32_t iLength) override {
- return 0;
- }
- void Flush() override {}
- bool SetLength(int32_t iLength) override { return false; }
-
- private:
- CFX_RetainPtr<IFX_BufferedReadStream> m_pBufferRead;
- int32_t m_iPosition;
- int32_t m_iBufferSize;
-};
-
-class CFGAS_FileWriteStreamImp : public IFGAS_StreamImp {
- public:
- CFGAS_FileWriteStreamImp();
- ~CFGAS_FileWriteStreamImp() override {}
-
- bool LoadFileWrite(const CFX_RetainPtr<IFX_SeekableWriteStream>& pFileWrite,
- uint32_t dwAccess);
-
- // IFGAS_StreamImp:
- int32_t GetLength() const override;
- int32_t Seek(FX_STREAMSEEK eSeek, int32_t iOffset) override;
- int32_t GetPosition() override { return m_iPosition; }
- bool IsEOF() const override;
- int32_t ReadData(uint8_t* pBuffer, int32_t iBufferSize) override { return 0; }
- int32_t ReadString(FX_WCHAR* pStr, int32_t iMaxLength, bool& bEOS) override {
- return 0;
- }
- int32_t WriteData(const uint8_t* pBuffer, int32_t iBufferSize) override;
- int32_t WriteString(const FX_WCHAR* pStr, int32_t iLength) override;
- void Flush() override;
- bool SetLength(int32_t iLength) override { return false; }
-
- protected:
- CFX_RetainPtr<IFX_SeekableWriteStream> m_pFileWrite;
- int32_t m_iPosition;
-};
-
-enum FX_STREAMTYPE {
- FX_SREAMTYPE_Unknown = 0,
- FX_STREAMTYPE_File,
- FX_STREAMTYPE_Buffer,
- FX_STREAMTYPE_Stream,
- FX_STREAMTYPE_BufferRead,
-};
-
-class CFGAS_Stream : public IFGAS_Stream {
- public:
- template <typename T, typename... Args>
- friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args);
-
- bool LoadFile(const FX_WCHAR* pszSrcFileName, uint32_t dwAccess);
- bool LoadBuffer(uint8_t* pData, int32_t iTotalSize, uint32_t dwAccess);
- bool LoadFileRead(const CFX_RetainPtr<IFX_SeekableReadStream>& pFileRead,
- uint32_t dwAccess);
- bool LoadFileWrite(const CFX_RetainPtr<IFX_SeekableWriteStream>& pFileWrite,
- uint32_t dwAccess);
- bool LoadBufferRead(const CFX_RetainPtr<IFX_BufferedReadStream>& pBufferRead,
- int32_t iFileSize,
- uint32_t dwAccess);
-
- // IFGAS_Stream
- uint32_t GetAccessModes() const override;
- int32_t GetLength() const override;
- int32_t Seek(FX_STREAMSEEK eSeek, int32_t iOffset) override;
- int32_t GetPosition() override;
- bool IsEOF() const override;
- int32_t ReadData(uint8_t* pBuffer, int32_t iBufferSize) override;
- int32_t ReadString(FX_WCHAR* pStr, int32_t iMaxLength, bool& bEOS) override;
- int32_t WriteData(const uint8_t* pBuffer, int32_t iBufferSize) override;
- int32_t WriteString(const FX_WCHAR* pStr, int32_t iLength) override;
- void Flush() override;
- bool SetLength(int32_t iLength) override;
- int32_t GetBOM(uint8_t bom[4]) const override;
- uint16_t GetCodePage() const override;
- uint16_t SetCodePage(uint16_t wCodePage) override;
- CFX_RetainPtr<IFGAS_Stream> CreateSharedStream(uint32_t dwAccess,
- int32_t iOffset,
- int32_t iLength) override;
-
- protected:
- CFGAS_Stream();
- ~CFGAS_Stream() override;
-
- FX_STREAMTYPE m_eStreamType;
- IFGAS_StreamImp* m_pStreamImp;
- uint32_t m_dwAccess;
- int32_t m_iTotalSize;
- int32_t m_iPosition;
- int32_t m_iStart;
- int32_t m_iLength;
- int32_t m_iRefCount;
-};
-
-class CFGAS_TextStream : public IFGAS_Stream {
- public:
- template <typename T, typename... Args>
- friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args);
-
- // IFGAS_Stream
- uint32_t GetAccessModes() const override;
- int32_t GetLength() const override;
- int32_t Seek(FX_STREAMSEEK eSeek, int32_t iOffset) override;
- int32_t GetPosition() override;
- bool IsEOF() const override;
- int32_t ReadData(uint8_t* pBuffer, int32_t iBufferSize) override;
- int32_t ReadString(FX_WCHAR* pStr, int32_t iMaxLength, bool& bEOS) override;
- int32_t WriteData(const uint8_t* pBuffer, int32_t iBufferSize) override;
- int32_t WriteString(const FX_WCHAR* pStr, int32_t iLength) override;
- void Flush() override;
- bool SetLength(int32_t iLength) override;
- int32_t GetBOM(uint8_t bom[4]) const override;
- uint16_t GetCodePage() const override;
- uint16_t SetCodePage(uint16_t wCodePage) override;
- CFX_RetainPtr<IFGAS_Stream> CreateSharedStream(uint32_t dwAccess,
- int32_t iOffset,
- int32_t iLength) override;
-
- protected:
- explicit CFGAS_TextStream(const CFX_RetainPtr<IFGAS_Stream>& pStream);
- ~CFGAS_TextStream() override;
-
- void InitStream();
-
- uint16_t m_wCodePage;
- int32_t m_wBOMLength;
- uint32_t m_dwBOM;
- uint8_t* m_pBuf;
- int32_t m_iBufSize;
- CFX_RetainPtr<IFGAS_Stream> m_pStreamImp;
-};
-
-class CFGAS_FileRead : public IFX_SeekableReadStream {
- public:
- static CFX_RetainPtr<CFGAS_FileRead> Create(
- const CFX_RetainPtr<IFGAS_Stream>& pStream);
-
- explicit CFGAS_FileRead(const CFX_RetainPtr<IFGAS_Stream>& pStream);
- ~CFGAS_FileRead() override;
-
- // IFX_SeekableReadStream
- FX_FILESIZE GetSize() override;
- bool ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override;
-
- protected:
- CFX_RetainPtr<IFGAS_Stream> m_pStream;
-};
-
-int32_t FileLength(FXSYS_FILE* file) {
- ASSERT(file);
-#if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_
- return _filelength(_fileno(file));
-#else
- int32_t iPos = FXSYS_ftell(file);
- FXSYS_fseek(file, 0, FXSYS_SEEK_END);
- int32_t iLen = FXSYS_ftell(file);
- FXSYS_fseek(file, iPos, FXSYS_SEEK_SET);
- return iLen;
-#endif
-}
-
-bool FileSetSize(FXSYS_FILE* file, int32_t size) {
- ASSERT(file);
-#if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_
- return _chsize(_fileno(file), size) == 0;
-#elif _FX_OS_ == _FX_WIN32_MOBILE_
- HANDLE hFile = _fileno(file);
- uint32_t dwPos = ::SetFilePointer(hFile, 0, 0, FILE_CURRENT);
- ::SetFilePointer(hFile, size, 0, FILE_BEGIN);
- bool bRet = ::SetEndOfFile(hFile);
- ::SetFilePointer(hFile, (int32_t)dwPos, 0, FILE_BEGIN);
- return bRet;
-#else
- return false;
-#endif
-}
-
-} // namespace
-
-// static
-CFX_RetainPtr<IFGAS_Stream> IFGAS_Stream::CreateStream(
- const CFX_RetainPtr<IFX_SeekableReadStream>& pFileRead,
- uint32_t dwAccess) {
- auto pSR = pdfium::MakeRetain<CFGAS_Stream>();
- if (!pSR->LoadFileRead(pFileRead, dwAccess))
- return nullptr;
-
- if (dwAccess & FX_STREAMACCESS_Text)
- return pdfium::MakeRetain<CFGAS_TextStream>(pSR);
-
- return pSR;
-}
-
-// static
-CFX_RetainPtr<IFGAS_Stream> IFGAS_Stream::CreateStream(
- const CFX_RetainPtr<IFX_SeekableWriteStream>& pFileWrite,
- uint32_t dwAccess) {
- auto pSR = pdfium::MakeRetain<CFGAS_Stream>();
- if (!pSR->LoadFileWrite(pFileWrite, dwAccess))
- return nullptr;
-
- if (dwAccess & FX_STREAMACCESS_Text)
- return pdfium::MakeRetain<CFGAS_TextStream>(pSR);
-
- return pSR;
-}
-
-// static
-CFX_RetainPtr<IFGAS_Stream> IFGAS_Stream::CreateStream(uint8_t* pData,
- int32_t length,
- uint32_t dwAccess) {
- auto pSR = pdfium::MakeRetain<CFGAS_Stream>();
- if (!pSR->LoadBuffer(pData, length, dwAccess))
- return nullptr;
-
- if (dwAccess & FX_STREAMACCESS_Text)
- return pdfium::MakeRetain<CFGAS_TextStream>(pSR);
-
- return pSR;
-}
-
-IFGAS_StreamImp::IFGAS_StreamImp() : m_dwAccess(0) {}
-
-CFGAS_FileStreamImp::CFGAS_FileStreamImp() : m_hFile(nullptr), m_iLength(0) {}
-
-CFGAS_FileStreamImp::~CFGAS_FileStreamImp() {
- if (m_hFile)
- FXSYS_fclose(m_hFile);
-}
-
-bool CFGAS_FileStreamImp::LoadFile(const FX_WCHAR* pszSrcFileName,
- uint32_t dwAccess) {
- ASSERT(!m_hFile);
- ASSERT(pszSrcFileName && FXSYS_wcslen(pszSrcFileName) > 0);
-#if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN32_MOBILE_ || \
- _FX_OS_ == _FX_WIN64_
- const FX_WCHAR* wsMode;
- if (dwAccess & FX_STREAMACCESS_Write) {
- if (dwAccess & FX_STREAMACCESS_Append) {
- wsMode = L"a+b";
- } else if (dwAccess & FX_STREAMACCESS_Truncate) {
- wsMode = L"w+b";
- } else {
- wsMode = L"r+b";
- }
- } else {
- wsMode = L"rb";
- }
- m_hFile = FXSYS_wfopen(pszSrcFileName, wsMode);
-
- if (!m_hFile) {
- if (dwAccess & FX_STREAMACCESS_Write) {
- if (dwAccess & FX_STREAMACCESS_Create)
- m_hFile = FXSYS_wfopen(pszSrcFileName, L"w+b");
-
- if (!m_hFile) {
- m_hFile = FXSYS_wfopen(pszSrcFileName, L"r+b");
- if (!m_hFile)
- return false;
-
- if (dwAccess & FX_STREAMACCESS_Truncate)
- FileSetSize(m_hFile, 0);
- }
- } else {
- return false;
- }
- }
-#else
- const FX_CHAR* wsMode = "rb";
- if (dwAccess & FX_STREAMACCESS_Write) {
- if (dwAccess & FX_STREAMACCESS_Append) {
- wsMode = "a+b";
- } else if (dwAccess & FX_STREAMACCESS_Truncate) {
- wsMode = "w+b";
- } else {
- wsMode = "r+b";
- }
- }
- CFX_ByteString szFileName = CFX_ByteString::FromUnicode(pszSrcFileName);
- m_hFile = FXSYS_fopen(szFileName.c_str(), wsMode);
- if (!m_hFile) {
- if (dwAccess & FX_STREAMACCESS_Write) {
- if (dwAccess & FX_STREAMACCESS_Create) {
- m_hFile = FXSYS_fopen(szFileName.c_str(), "w+b");
- }
- if (!m_hFile) {
- m_hFile = FXSYS_fopen(szFileName.c_str(), "r+b");
- if (!m_hFile) {
- return false;
- }
- if (dwAccess & FX_STREAMACCESS_Truncate) {
- FileSetSize(m_hFile, 0);
- }
- }
- } else {
- return false;
- }
- }
-#endif
- SetAccessModes(dwAccess);
- if ((dwAccess & (FX_STREAMACCESS_Write | FX_STREAMACCESS_Truncate)) ==
- (FX_STREAMACCESS_Write | FX_STREAMACCESS_Truncate)) {
- m_iLength = 0;
- } else {
- m_iLength = FileLength(m_hFile);
- }
- return true;
-}
-int32_t CFGAS_FileStreamImp::GetLength() const {
- ASSERT(m_hFile);
- return m_iLength;
-}
-int32_t CFGAS_FileStreamImp::Seek(FX_STREAMSEEK eSeek, int32_t iOffset) {
- ASSERT(m_hFile);
- FXSYS_fseek(m_hFile, iOffset, eSeek);
- return FXSYS_ftell(m_hFile);
-}
-int32_t CFGAS_FileStreamImp::GetPosition() {
- ASSERT(m_hFile);
- return FXSYS_ftell(m_hFile);
-}
-bool CFGAS_FileStreamImp::IsEOF() const {
- ASSERT(m_hFile);
- return FXSYS_ftell(m_hFile) >= m_iLength;
-}
-int32_t CFGAS_FileStreamImp::ReadData(uint8_t* pBuffer, int32_t iBufferSize) {
- ASSERT(m_hFile);
- ASSERT(pBuffer && iBufferSize > 0);
- return FXSYS_fread(pBuffer, 1, iBufferSize, m_hFile);
-}
-int32_t CFGAS_FileStreamImp::ReadString(FX_WCHAR* pStr,
- int32_t iMaxLength,
- bool& bEOS) {
- ASSERT(m_hFile);
- ASSERT(pStr && iMaxLength > 0);
- if (m_iLength <= 0) {
- return 0;
- }
- int32_t iPosition = FXSYS_ftell(m_hFile);
- int32_t iLen = std::min((m_iLength - iPosition) / 2, iMaxLength);
- if (iLen <= 0) {
- return 0;
- }
- iLen = FXSYS_fread(pStr, 2, iLen, m_hFile);
- int32_t iCount = 0;
- while (*pStr != L'\0' && iCount < iLen) {
- pStr++, iCount++;
- }
- iPosition += iCount * 2;
- if (FXSYS_ftell(m_hFile) != iPosition) {
- FXSYS_fseek(m_hFile, iPosition, 0);
- }
- bEOS = (iPosition >= m_iLength);
- return iCount;
-}
-int32_t CFGAS_FileStreamImp::WriteData(const uint8_t* pBuffer,
- int32_t iBufferSize) {
- ASSERT(m_hFile && (GetAccessModes() & FX_STREAMACCESS_Write) != 0);
- ASSERT(pBuffer && iBufferSize > 0);
- int32_t iRet = FXSYS_fwrite(pBuffer, 1, iBufferSize, m_hFile);
- if (iRet != 0) {
- int32_t iPos = FXSYS_ftell(m_hFile);
- if (iPos > m_iLength) {
- m_iLength = iPos;
- }
- }
- return iRet;
-}
-int32_t CFGAS_FileStreamImp::WriteString(const FX_WCHAR* pStr,
- int32_t iLength) {
- ASSERT(m_hFile && (GetAccessModes() & FX_STREAMACCESS_Write) != 0);
- ASSERT(pStr && iLength > 0);
- int32_t iRet = FXSYS_fwrite(pStr, 2, iLength, m_hFile);
- if (iRet != 0) {
- int32_t iPos = FXSYS_ftell(m_hFile);
- if (iPos > m_iLength) {
- m_iLength = iPos;
- }
- }
- return iRet;
-}
-void CFGAS_FileStreamImp::Flush() {
- ASSERT(m_hFile && (GetAccessModes() & FX_STREAMACCESS_Write) != 0);
- FXSYS_fflush(m_hFile);
-}
-bool CFGAS_FileStreamImp::SetLength(int32_t iLength) {
- ASSERT(m_hFile && (GetAccessModes() & FX_STREAMACCESS_Write) != 0);
- bool bRet = FileSetSize(m_hFile, iLength);
- m_iLength = FileLength(m_hFile);
- return bRet;
-}
-
-CFGAS_FileReadStreamImp::CFGAS_FileReadStreamImp()
- : m_pFileRead(nullptr), m_iPosition(0), m_iLength(0) {}
-
-bool CFGAS_FileReadStreamImp::LoadFileRead(
- const CFX_RetainPtr<IFX_SeekableReadStream>& pFileRead,
- uint32_t dwAccess) {
- ASSERT(!m_pFileRead && pFileRead);
- if (dwAccess & FX_STREAMACCESS_Write)
- return false;
-
- m_pFileRead = pFileRead;
- m_iLength = m_pFileRead->GetSize();
- return true;
-}
-
-int32_t CFGAS_FileReadStreamImp::GetLength() const {
- return m_iLength;
-}
-int32_t CFGAS_FileReadStreamImp::Seek(FX_STREAMSEEK eSeek, int32_t iOffset) {
- switch (eSeek) {
- case FX_STREAMSEEK_Begin:
- m_iPosition = iOffset;
- break;
- case FX_STREAMSEEK_Current:
- m_iPosition += iOffset;
- break;
- case FX_STREAMSEEK_End:
- m_iPosition = m_iLength + iOffset;
- break;
- }
- if (m_iPosition < 0) {
- m_iPosition = 0;
- } else if (m_iPosition >= m_iLength) {
- m_iPosition = m_iLength;
- }
- return m_iPosition;
-}
-bool CFGAS_FileReadStreamImp::IsEOF() const {
- return m_iPosition >= m_iLength;
-}
-int32_t CFGAS_FileReadStreamImp::ReadData(uint8_t* pBuffer,
- int32_t iBufferSize) {
- ASSERT(m_pFileRead);
- ASSERT(pBuffer && iBufferSize > 0);
- if (iBufferSize > m_iLength - m_iPosition) {
- iBufferSize = m_iLength - m_iPosition;
- }
- if (m_pFileRead->ReadBlock(pBuffer, m_iPosition, iBufferSize)) {
- m_iPosition += iBufferSize;
- return iBufferSize;
- }
- return 0;
-}
-int32_t CFGAS_FileReadStreamImp::ReadString(FX_WCHAR* pStr,
- int32_t iMaxLength,
- bool& bEOS) {
- ASSERT(m_pFileRead);
- ASSERT(pStr && iMaxLength > 0);
- iMaxLength = ReadData((uint8_t*)pStr, iMaxLength * 2) / 2;
- if (iMaxLength <= 0) {
- return 0;
- }
- int32_t i = 0;
- while (i < iMaxLength && pStr[i] != L'\0') {
- ++i;
- }
- bEOS = (m_iPosition >= m_iLength) || pStr[i] == L'\0';
- return i;
-}
-
-CFGAS_BufferReadStreamImp::CFGAS_BufferReadStreamImp()
- : m_iPosition(0), m_iBufferSize(0) {}
-
-CFGAS_BufferReadStreamImp::~CFGAS_BufferReadStreamImp() {}
-
-bool CFGAS_BufferReadStreamImp::LoadBufferRead(
- const CFX_RetainPtr<IFX_BufferedReadStream>& pBufferRead,
- int32_t iFileSize,
- uint32_t dwAccess) {
- ASSERT(!m_pBufferRead && pBufferRead);
- if (dwAccess & FX_STREAMACCESS_Write)
- return false;
-
- m_pBufferRead = pBufferRead;
- m_iBufferSize = iFileSize;
- if (m_iBufferSize >= 0)
- return true;
-
- if (!m_pBufferRead->ReadNextBlock(true))
- return false;
-
- m_iBufferSize = m_pBufferRead->GetBlockSize();
- while (!m_pBufferRead->IsEOF()) {
- m_pBufferRead->ReadNextBlock(false);
- m_iBufferSize += m_pBufferRead->GetBlockSize();
- }
- return true;
-}
-int32_t CFGAS_BufferReadStreamImp::GetLength() const {
- return m_iBufferSize;
-}
-int32_t CFGAS_BufferReadStreamImp::Seek(FX_STREAMSEEK eSeek, int32_t iOffset) {
- int32_t iLength = GetLength();
- switch (eSeek) {
- case FX_STREAMSEEK_Begin:
- m_iPosition = iOffset;
- break;
- case FX_STREAMSEEK_Current:
- m_iPosition += iOffset;
- break;
- case FX_STREAMSEEK_End:
- m_iPosition = iLength + iOffset;
- break;
- }
- if (m_iPosition < 0) {
- m_iPosition = 0;
- } else if (m_iPosition >= iLength) {
- m_iPosition = iLength;
- }
- return m_iPosition;
-}
-bool CFGAS_BufferReadStreamImp::IsEOF() const {
- return m_pBufferRead ? m_pBufferRead->IsEOF() : true;
-}
-int32_t CFGAS_BufferReadStreamImp::ReadData(uint8_t* pBuffer,
- int32_t iBufferSize) {
- ASSERT(m_pBufferRead);
- ASSERT(pBuffer && iBufferSize > 0);
- int32_t iLength = GetLength();
- if (m_iPosition >= iLength) {
- return 0;
- }
- if (iBufferSize > iLength - m_iPosition) {
- iBufferSize = iLength - m_iPosition;
- }
- uint32_t dwBlockOffset = m_pBufferRead->GetBlockOffset();
- uint32_t dwBlockSize = m_pBufferRead->GetBlockSize();
- if (m_iPosition < (int32_t)dwBlockOffset) {
- if (!m_pBufferRead->ReadNextBlock(true)) {
- return 0;
- }
- dwBlockOffset = m_pBufferRead->GetBlockOffset();
- dwBlockSize = m_pBufferRead->GetBlockSize();
- }
- while (m_iPosition < (int32_t)dwBlockOffset ||
- m_iPosition >= (int32_t)(dwBlockOffset + dwBlockSize)) {
- if (m_pBufferRead->IsEOF() || !m_pBufferRead->ReadNextBlock(false)) {
- break;
- }
- dwBlockOffset = m_pBufferRead->GetBlockOffset();
- dwBlockSize = m_pBufferRead->GetBlockSize();
- }
- if (m_iPosition < (int32_t)dwBlockOffset ||
- m_iPosition >= (int32_t)(dwBlockOffset + dwBlockSize)) {
- return 0;
- }
- const uint8_t* pBufferTmp = m_pBufferRead->GetBlockBuffer();
- uint32_t dwOffsetTmp = m_iPosition - dwBlockOffset;
- uint32_t dwCopySize =
- std::min(iBufferSize, (int32_t)(dwBlockSize - dwOffsetTmp));
- FXSYS_memcpy(pBuffer, pBufferTmp + dwOffsetTmp, dwCopySize);
- dwOffsetTmp = dwCopySize;
- iBufferSize -= dwCopySize;
- while (iBufferSize > 0) {
- if (!m_pBufferRead->ReadNextBlock(false)) {
- break;
- }
- dwBlockOffset = m_pBufferRead->GetBlockOffset();
- dwBlockSize = m_pBufferRead->GetBlockSize();
- pBufferTmp = m_pBufferRead->GetBlockBuffer();
- dwCopySize = std::min((uint32_t)iBufferSize, dwBlockSize);
- FXSYS_memcpy(pBuffer + dwOffsetTmp, pBufferTmp, dwCopySize);
- dwOffsetTmp += dwCopySize;
- iBufferSize -= dwCopySize;
- }
- m_iPosition += dwOffsetTmp;
- return dwOffsetTmp;
-}
-int32_t CFGAS_BufferReadStreamImp::ReadString(FX_WCHAR* pStr,
- int32_t iMaxLength,
- bool& bEOS) {
- ASSERT(m_pBufferRead);
- ASSERT(pStr && iMaxLength > 0);
- iMaxLength = ReadData((uint8_t*)pStr, iMaxLength * 2) / 2;
- if (iMaxLength <= 0) {
- return 0;
- }
- int32_t i = 0;
- while (i < iMaxLength && pStr[i] != L'\0') {
- ++i;
- }
- bEOS = (m_iPosition >= GetLength()) || pStr[i] == L'\0';
- return i;
-}
-CFGAS_FileWriteStreamImp::CFGAS_FileWriteStreamImp()
- : m_pFileWrite(nullptr), m_iPosition(0) {}
-
-bool CFGAS_FileWriteStreamImp::LoadFileWrite(
- const CFX_RetainPtr<IFX_SeekableWriteStream>& pFileWrite,
- uint32_t dwAccess) {
- ASSERT(!m_pFileWrite && pFileWrite);
- if (dwAccess & FX_STREAMACCESS_Read)
- return false;
-
- if (dwAccess & FX_STREAMACCESS_Append)
- m_iPosition = pFileWrite->GetSize();
-
- m_pFileWrite = pFileWrite;
- return true;
-}
-
-int32_t CFGAS_FileWriteStreamImp::GetLength() const {
- if (!m_pFileWrite)
- return 0;
-
- return (int32_t)m_pFileWrite->GetSize();
-}
-int32_t CFGAS_FileWriteStreamImp::Seek(FX_STREAMSEEK eSeek, int32_t iOffset) {
- int32_t iLength = GetLength();
- switch (eSeek) {
- case FX_STREAMSEEK_Begin:
- m_iPosition = iOffset;
- break;
- case FX_STREAMSEEK_Current:
- m_iPosition += iOffset;
- break;
- case FX_STREAMSEEK_End:
- m_iPosition = iLength + iOffset;
- break;
- }
- if (m_iPosition < 0) {
- m_iPosition = 0;
- } else if (m_iPosition >= iLength) {
- m_iPosition = iLength;
- }
- return m_iPosition;
-}
-bool CFGAS_FileWriteStreamImp::IsEOF() const {
- return m_iPosition >= GetLength();
-}
-int32_t CFGAS_FileWriteStreamImp::WriteData(const uint8_t* pBuffer,
- int32_t iBufferSize) {
- if (!m_pFileWrite) {
- return 0;
- }
- if (m_pFileWrite->WriteBlock(pBuffer, m_iPosition, iBufferSize)) {
- m_iPosition += iBufferSize;
- }
- return iBufferSize;
-}
-int32_t CFGAS_FileWriteStreamImp::WriteString(const FX_WCHAR* pStr,
- int32_t iLength) {
- return WriteData((const uint8_t*)pStr, iLength * sizeof(FX_WCHAR));
-}
-void CFGAS_FileWriteStreamImp::Flush() {
- if (m_pFileWrite) {
- m_pFileWrite->Flush();
- }
-}
-CFGAS_BufferStreamImp::CFGAS_BufferStreamImp()
- : m_pData(nullptr), m_iTotalSize(0), m_iPosition(0), m_iLength(0) {}
-
-bool CFGAS_BufferStreamImp::LoadBuffer(uint8_t* pData,
- int32_t iTotalSize,
- uint32_t dwAccess) {
- ASSERT(!m_pData && pData && iTotalSize > 0);
- SetAccessModes(dwAccess);
- m_pData = pData;
- m_iTotalSize = iTotalSize;
- m_iPosition = 0;
- m_iLength = (dwAccess & FX_STREAMACCESS_Write) != 0 ? 0 : iTotalSize;
- return true;
-}
-int32_t CFGAS_BufferStreamImp::GetLength() const {
- ASSERT(m_pData);
- return m_iLength;
-}
-int32_t CFGAS_BufferStreamImp::Seek(FX_STREAMSEEK eSeek, int32_t iOffset) {
- ASSERT(m_pData);
- if (eSeek == FX_STREAMSEEK_Begin) {
- m_iPosition = iOffset;
- } else if (eSeek == FX_STREAMSEEK_Current) {
- m_iPosition += iOffset;
- } else if (eSeek == FX_STREAMSEEK_End) {
- m_iPosition = m_iLength + iOffset;
- }
- if (m_iPosition > m_iLength) {
- m_iPosition = m_iLength;
- }
- if (m_iPosition < 0) {
- m_iPosition = 0;
- }
- return m_iPosition;
-}
-int32_t CFGAS_BufferStreamImp::GetPosition() {
- ASSERT(m_pData);
- return m_iPosition;
-}
-bool CFGAS_BufferStreamImp::IsEOF() const {
- ASSERT(m_pData);
- return m_iPosition >= m_iLength;
-}
-int32_t CFGAS_BufferStreamImp::ReadData(uint8_t* pBuffer, int32_t iBufferSize) {
- ASSERT(m_pData);
- ASSERT(pBuffer && iBufferSize > 0);
- int32_t iLen = std::min(m_iLength - m_iPosition, iBufferSize);
- if (iLen <= 0) {
- return 0;
- }
- FXSYS_memcpy(pBuffer, m_pData + m_iPosition, iLen);
- m_iPosition += iLen;
- return iLen;
-}
-int32_t CFGAS_BufferStreamImp::ReadString(FX_WCHAR* pStr,
- int32_t iMaxLength,
- bool& bEOS) {
- ASSERT(m_pData);
- ASSERT(pStr && iMaxLength > 0);
- int32_t iLen = std::min((m_iLength - m_iPosition) / 2, iMaxLength);
- if (iLen <= 0) {
- return 0;
- }
- const FX_WCHAR* pSrc = (const FX_WCHAR*)(FX_CHAR*)(m_pData + m_iPosition);
- int32_t iCount = 0;
- while (*pSrc && iCount < iLen) {
- *pStr++ = *pSrc++;
- iCount++;
- }
- m_iPosition += iCount * 2;
- bEOS = (*pSrc == L'\0') || (m_iPosition >= m_iLength);
- return iCount;
-}
-int32_t CFGAS_BufferStreamImp::WriteData(const uint8_t* pBuffer,
- int32_t iBufferSize) {
- ASSERT(m_pData && (GetAccessModes() & FX_STREAMACCESS_Write) != 0);
- ASSERT(pBuffer && iBufferSize > 0);
- int32_t iLen = std::min(m_iTotalSize - m_iPosition, iBufferSize);
- if (iLen <= 0) {
- return 0;
- }
- FXSYS_memcpy(m_pData + m_iPosition, pBuffer, iLen);
- m_iPosition += iLen;
- if (m_iPosition > m_iLength) {
- m_iLength = m_iPosition;
- }
- return iLen;
-}
-int32_t CFGAS_BufferStreamImp::WriteString(const FX_WCHAR* pStr,
- int32_t iLength) {
- ASSERT(m_pData && (GetAccessModes() & FX_STREAMACCESS_Write) != 0);
- ASSERT(pStr && iLength > 0);
- int32_t iLen = std::min((m_iTotalSize - m_iPosition) / 2, iLength);
- if (iLen <= 0) {
- return 0;
- }
- FXSYS_memcpy(m_pData + m_iPosition, pStr, iLen * 2);
- m_iPosition += iLen * 2;
- if (m_iPosition > m_iLength) {
- m_iLength = m_iPosition;
- }
- return iLen;
-}
-
-// static
-CFX_RetainPtr<IFGAS_Stream> IFGAS_Stream::CreateTextStream(
- const CFX_RetainPtr<IFGAS_Stream>& pBaseStream) {
- ASSERT(pBaseStream);
- return pdfium::MakeRetain<CFGAS_TextStream>(pBaseStream);
-}
-
-CFGAS_TextStream::CFGAS_TextStream(const CFX_RetainPtr<IFGAS_Stream>& pStream)
- : m_wCodePage(FX_CODEPAGE_DefANSI),
- m_wBOMLength(0),
- m_dwBOM(0),
- m_pBuf(nullptr),
- m_iBufSize(0),
- m_pStreamImp(pStream) {
- ASSERT(m_pStreamImp);
- InitStream();
-}
-
-CFGAS_TextStream::~CFGAS_TextStream() {
- if (m_pBuf)
- FX_Free(m_pBuf);
-}
-
-void CFGAS_TextStream::InitStream() {
- int32_t iPosition = m_pStreamImp->GetPosition();
- m_pStreamImp->Seek(FX_STREAMSEEK_Begin, 0);
- m_pStreamImp->ReadData((uint8_t*)&m_dwBOM, 3);
-#if _FX_ENDIAN_ == _FX_LITTLE_ENDIAN_
- m_dwBOM &= 0x00FFFFFF;
- if (m_dwBOM == 0x00BFBBEF) {
- m_wBOMLength = 3;
- m_wCodePage = FX_CODEPAGE_UTF8;
- } else {
- m_dwBOM &= 0x0000FFFF;
- if (m_dwBOM == 0x0000FFFE) {
- m_wBOMLength = 2;
- m_wCodePage = FX_CODEPAGE_UTF16BE;
- } else if (m_dwBOM == 0x0000FEFF) {
- m_wBOMLength = 2;
- m_wCodePage = FX_CODEPAGE_UTF16LE;
- } else {
- m_wBOMLength = 0;
- m_dwBOM = 0;
- m_wCodePage = FXSYS_GetACP();
- }
- }
-#else
- m_dwBOM &= 0xFFFFFF00;
- if (m_dwBOM == 0xEFBBBF00) {
- m_wBOMLength = 3;
- m_wCodePage = FX_CODEPAGE_UTF8;
- } else {
- m_dwBOM &= 0xFFFF0000;
- if (m_dwBOM == 0xFEFF0000) {
- m_wBOMLength = 2;
- m_wCodePage = FX_CODEPAGE_UTF16BE;
- } else if (m_dwBOM == 0xFFFE0000) {
- m_wBOMLength = 2;
- m_wCodePage = FX_CODEPAGE_UTF16LE;
- } else {
- m_wBOMLength = 0;
- m_dwBOM = 0;
- m_wCodePage = FXSYS_GetACP();
- }
- }
-#endif
- m_pStreamImp->Seek(FX_STREAMSEEK_Begin, std::max(m_wBOMLength, iPosition));
-}
-
-uint32_t CFGAS_TextStream::GetAccessModes() const {
- return m_pStreamImp->GetAccessModes() | FX_STREAMACCESS_Text;
-}
-
-int32_t CFGAS_TextStream::GetLength() const {
- return m_pStreamImp->GetLength();
-}
-
-int32_t CFGAS_TextStream::Seek(FX_STREAMSEEK eSeek, int32_t iOffset) {
- return m_pStreamImp->Seek(eSeek, iOffset);
-}
-
-int32_t CFGAS_TextStream::GetPosition() {
- return m_pStreamImp->GetPosition();
-}
-
-bool CFGAS_TextStream::IsEOF() const {
- return m_pStreamImp->IsEOF();
-}
-
-int32_t CFGAS_TextStream::ReadData(uint8_t* pBuffer, int32_t iBufferSize) {
- return m_pStreamImp->ReadData(pBuffer, iBufferSize);
-}
-
-int32_t CFGAS_TextStream::WriteData(const uint8_t* pBuffer,
- int32_t iBufferSize) {
- return m_pStreamImp->WriteData(pBuffer, iBufferSize);
-}
-
-void CFGAS_TextStream::Flush() {
- m_pStreamImp->Flush();
-}
-
-bool CFGAS_TextStream::SetLength(int32_t iLength) {
- return m_pStreamImp->SetLength(iLength);
-}
-
-uint16_t CFGAS_TextStream::GetCodePage() const {
- return m_wCodePage;
-}
-
-CFX_RetainPtr<IFGAS_Stream> CFGAS_TextStream::CreateSharedStream(
- uint32_t dwAccess,
- int32_t iOffset,
- int32_t iLength) {
- CFX_RetainPtr<IFGAS_Stream> pSR =
- m_pStreamImp->CreateSharedStream(dwAccess, iOffset, iLength);
- if (!pSR)
- return nullptr;
-
- if (dwAccess & FX_STREAMACCESS_Text)
- return pdfium::MakeRetain<CFGAS_TextStream>(pSR);
-
- return pSR;
-}
-
-int32_t CFGAS_TextStream::GetBOM(uint8_t bom[4]) const {
- if (m_wBOMLength < 1)
- return 0;
-
- *(uint32_t*)bom = m_dwBOM;
- return m_wBOMLength;
-}
-
-uint16_t CFGAS_TextStream::SetCodePage(uint16_t wCodePage) {
- if (m_wBOMLength > 0)
- return m_wCodePage;
-
- uint16_t v = m_wCodePage;
- m_wCodePage = wCodePage;
- return v;
-}
-
-int32_t CFGAS_TextStream::ReadString(FX_WCHAR* pStr,
- int32_t iMaxLength,
- bool& bEOS) {
- ASSERT(pStr && iMaxLength > 0);
- if (!m_pStreamImp) {
- return -1;
- }
- int32_t iLen;
- if (m_wCodePage == FX_CODEPAGE_UTF16LE ||
- m_wCodePage == FX_CODEPAGE_UTF16BE) {
- int32_t iBytes = iMaxLength * 2;
- iLen = m_pStreamImp->ReadData((uint8_t*)pStr, iBytes);
- iMaxLength = iLen / 2;
- if (sizeof(FX_WCHAR) > 2) {
- FX_UTF16ToWChar(pStr, iMaxLength);
- }
-#if _FX_ENDIAN_ == _FX_BIG_ENDIAN_
- if (m_wCodePage == FX_CODEPAGE_UTF16LE) {
- FX_SwapByteOrder(pStr, iMaxLength);
- }
-#else
- if (m_wCodePage == FX_CODEPAGE_UTF16BE) {
- FX_SwapByteOrder(pStr, iMaxLength);
- }
-#endif
- } else {
- int32_t pos = m_pStreamImp->GetPosition();
- int32_t iBytes = iMaxLength;
- iBytes = std::min(iBytes, m_pStreamImp->GetLength() - pos);
- if (iBytes > 0) {
- if (!m_pBuf) {
- m_pBuf = FX_Alloc(uint8_t, iBytes);
- m_iBufSize = iBytes;
- } else if (iBytes > m_iBufSize) {
- m_pBuf = FX_Realloc(uint8_t, m_pBuf, iBytes);
- m_iBufSize = iBytes;
- }
- iLen = m_pStreamImp->ReadData(m_pBuf, iBytes);
- int32_t iSrc = iLen;
- int32_t iDecode = FX_DecodeString(m_wCodePage, (const FX_CHAR*)m_pBuf,
- &iSrc, pStr, &iMaxLength, true);
- m_pStreamImp->Seek(FX_STREAMSEEK_Current, iSrc - iLen);
- if (iDecode < 1) {
- return -1;
- }
- } else {
- iMaxLength = 0;
- }
- }
- bEOS = m_pStreamImp->IsEOF();
- return iMaxLength;
-}
-
-int32_t CFGAS_TextStream::WriteString(const FX_WCHAR* pStr, int32_t iLength) {
- ASSERT(pStr && iLength > 0);
- if ((m_pStreamImp->GetAccessModes() & FX_STREAMACCESS_Write) == 0)
- return -1;
-
- if (m_wCodePage == FX_CODEPAGE_UTF8) {
- int32_t len = iLength;
- CFX_UTF8Encoder encoder;
- while (len-- > 0) {
- encoder.Input(*pStr++);
- }
- CFX_ByteStringC bsResult = encoder.GetResult();
- m_pStreamImp->WriteData((const uint8_t*)bsResult.c_str(),
- bsResult.GetLength());
- }
- return iLength;
-}
-
-CFGAS_Stream::CFGAS_Stream()
- : m_eStreamType(FX_SREAMTYPE_Unknown),
- m_pStreamImp(nullptr),
- m_dwAccess(0),
- m_iTotalSize(0),
- m_iPosition(0),
- m_iStart(0),
- m_iLength(0),
- m_iRefCount(1) {}
-
-CFGAS_Stream::~CFGAS_Stream() {
- if (m_eStreamType != FX_STREAMTYPE_Stream)
- delete m_pStreamImp;
-}
-
-bool CFGAS_Stream::LoadFile(const FX_WCHAR* pszSrcFileName, uint32_t dwAccess) {
- if (m_eStreamType != FX_SREAMTYPE_Unknown || m_pStreamImp)
- return false;
-
- if (!pszSrcFileName || FXSYS_wcslen(pszSrcFileName) < 1)
- return false;
-
- std::unique_ptr<CFGAS_FileStreamImp> pImp(new CFGAS_FileStreamImp());
- if (!pImp->LoadFile(pszSrcFileName, dwAccess))
- return false;
-
- m_pStreamImp = pImp.release();
- m_eStreamType = FX_STREAMTYPE_File;
- m_dwAccess = dwAccess;
- m_iLength = m_pStreamImp->GetLength();
- return true;
-}
-
-bool CFGAS_Stream::LoadFileRead(
- const CFX_RetainPtr<IFX_SeekableReadStream>& pFileRead,
- uint32_t dwAccess) {
- if (m_eStreamType != FX_SREAMTYPE_Unknown || m_pStreamImp)
- return false;
-
- if (!pFileRead)
- return false;
-
- std::unique_ptr<CFGAS_FileReadStreamImp> pImp(new CFGAS_FileReadStreamImp());
- if (!pImp->LoadFileRead(pFileRead, dwAccess))
- return false;
-
- m_pStreamImp = pImp.release();
- m_eStreamType = FX_STREAMTYPE_File;
- m_dwAccess = dwAccess;
- m_iLength = m_pStreamImp->GetLength();
- return true;
-}
-
-bool CFGAS_Stream::LoadFileWrite(
- const CFX_RetainPtr<IFX_SeekableWriteStream>& pFileWrite,
- uint32_t dwAccess) {
- if (m_eStreamType != FX_SREAMTYPE_Unknown || m_pStreamImp)
- return false;
-
- if (!pFileWrite)
- return false;
-
- auto pImp = pdfium::MakeUnique<CFGAS_FileWriteStreamImp>();
- if (!pImp->LoadFileWrite(pFileWrite, dwAccess))
- return false;
-
- m_pStreamImp = pImp.release();
- m_eStreamType = FX_STREAMTYPE_File;
- m_dwAccess = dwAccess;
- m_iLength = m_pStreamImp->GetLength();
- return true;
-}
-
-bool CFGAS_Stream::LoadBuffer(uint8_t* pData,
- int32_t iTotalSize,
- uint32_t dwAccess) {
- if (m_eStreamType != FX_SREAMTYPE_Unknown || m_pStreamImp)
- return false;
-
- if (!pData || iTotalSize < 1)
- return false;
-
- std::unique_ptr<CFGAS_BufferStreamImp> pImp(new CFGAS_BufferStreamImp());
- if (!pImp->LoadBuffer(pData, iTotalSize, dwAccess))
- return false;
-
- m_pStreamImp = pImp.release();
- m_eStreamType = FX_STREAMTYPE_Buffer;
- m_dwAccess = dwAccess;
- m_iLength = m_pStreamImp->GetLength();
- return true;
-}
-
-bool CFGAS_Stream::LoadBufferRead(
- const CFX_RetainPtr<IFX_BufferedReadStream>& pBufferRead,
- int32_t iFileSize,
- uint32_t dwAccess) {
- if (m_eStreamType != FX_SREAMTYPE_Unknown || m_pStreamImp)
- return false;
-
- if (!pBufferRead)
- return false;
-
- auto pImp = pdfium::MakeUnique<CFGAS_BufferReadStreamImp>();
- if (!pImp->LoadBufferRead(pBufferRead, iFileSize, dwAccess))
- return false;
-
- m_pStreamImp = pImp.release();
- m_eStreamType = FX_STREAMTYPE_BufferRead;
- m_dwAccess = dwAccess;
- m_iLength = m_pStreamImp->GetLength();
- return true;
-}
-
-uint32_t CFGAS_Stream::GetAccessModes() const {
- return m_dwAccess;
-}
-
-int32_t CFGAS_Stream::GetLength() const {
- if (!m_pStreamImp) {
- return -1;
- }
- if (m_eStreamType == FX_STREAMTYPE_File ||
- m_eStreamType == FX_STREAMTYPE_Buffer) {
- return m_pStreamImp->GetLength();
- }
- return m_iLength;
-}
-int32_t CFGAS_Stream::Seek(FX_STREAMSEEK eSeek, int32_t iOffset) {
- if (!m_pStreamImp) {
- return -1;
- }
- if (m_eStreamType == FX_STREAMTYPE_File ||
- m_eStreamType == FX_STREAMTYPE_Buffer) {
- return m_iPosition = m_pStreamImp->Seek(eSeek, iOffset);
- }
- int32_t iEnd = m_iStart + m_iLength;
- int32_t iPosition = m_iStart + iOffset;
- if (eSeek == FX_STREAMSEEK_Begin) {
- m_iPosition = iPosition;
- } else if (eSeek == FX_STREAMSEEK_Current) {
- m_iPosition += iOffset;
- } else if (eSeek == FX_STREAMSEEK_End) {
- m_iPosition = iEnd + iOffset;
- }
- if (m_iPosition > iEnd) {
- m_iPosition = iEnd;
- }
- if (m_iPosition < m_iStart) {
- m_iPosition = m_iStart;
- }
- return m_iPosition - m_iStart;
-}
-int32_t CFGAS_Stream::GetPosition() {
- if (!m_pStreamImp) {
- return -1;
- }
- if (m_eStreamType == FX_STREAMTYPE_File ||
- m_eStreamType == FX_STREAMTYPE_Buffer) {
- return m_iPosition = m_pStreamImp->GetPosition();
- }
- return m_iPosition - m_iStart;
-}
-bool CFGAS_Stream::IsEOF() const {
- if (!m_pStreamImp) {
- return true;
- }
- if (m_eStreamType == FX_STREAMTYPE_File ||
- m_eStreamType == FX_STREAMTYPE_Buffer) {
- return m_pStreamImp->IsEOF();
- }
- return m_iPosition >= m_iStart + m_iLength;
-}
-int32_t CFGAS_Stream::ReadData(uint8_t* pBuffer, int32_t iBufferSize) {
- ASSERT(pBuffer && iBufferSize > 0);
- if (!m_pStreamImp) {
- return -1;
- }
- int32_t iLen = std::min(m_iStart + m_iLength - m_iPosition, iBufferSize);
- if (iLen <= 0) {
- return 0;
- }
- if (m_pStreamImp->GetPosition() != m_iPosition) {
- m_pStreamImp->Seek(FX_STREAMSEEK_Begin, m_iPosition);
- }
- iLen = m_pStreamImp->ReadData(pBuffer, iLen);
- m_iPosition = m_pStreamImp->GetPosition();
- return iLen;
-}
-int32_t CFGAS_Stream::ReadString(FX_WCHAR* pStr,
- int32_t iMaxLength,
- bool& bEOS) {
- ASSERT(pStr && iMaxLength > 0);
- if (!m_pStreamImp) {
- return -1;
- }
- int32_t iEnd = m_iStart + m_iLength;
- int32_t iLen = iEnd - m_iPosition;
- iLen = std::min(iEnd / 2, iMaxLength);
- if (iLen <= 0) {
- return 0;
- }
- if (m_pStreamImp->GetPosition() != m_iPosition) {
- m_pStreamImp->Seek(FX_STREAMSEEK_Begin, m_iPosition);
- }
- iLen = m_pStreamImp->ReadString(pStr, iLen, bEOS);
- m_iPosition = m_pStreamImp->GetPosition();
- if (iLen > 0 && m_iPosition >= iEnd) {
- bEOS = true;
- }
- return iLen;
-}
-
-int32_t CFGAS_Stream::WriteData(const uint8_t* pBuffer, int32_t iBufferSize) {
- ASSERT(pBuffer && iBufferSize > 0);
- if (!m_pStreamImp) {
- return -1;
- }
- if ((m_dwAccess & FX_STREAMACCESS_Write) == 0) {
- return -1;
- }
- int32_t iLen = iBufferSize;
- if (m_eStreamType == FX_STREAMTYPE_Stream) {
- iLen = std::min(m_iStart + m_iTotalSize - m_iPosition, iBufferSize);
- if (iLen <= 0) {
- return 0;
- }
- }
- int32_t iEnd = m_iStart + m_iLength;
- if (m_pStreamImp->GetPosition() != m_iPosition) {
- m_pStreamImp->Seek(FX_STREAMSEEK_Begin, m_iPosition);
- }
- iLen = m_pStreamImp->WriteData(pBuffer, iLen);
- m_iPosition = m_pStreamImp->GetPosition();
- if (m_iPosition > iEnd) {
- m_iLength = m_iPosition - m_iStart;
- }
- return iLen;
-}
-int32_t CFGAS_Stream::WriteString(const FX_WCHAR* pStr, int32_t iLength) {
- ASSERT(pStr && iLength > 0);
- if (!m_pStreamImp) {
- return -1;
- }
- if ((m_dwAccess & FX_STREAMACCESS_Write) == 0) {
- return -1;
- }
- int32_t iLen = iLength;
- if (m_eStreamType == FX_STREAMTYPE_Stream) {
- iLen = std::min((m_iStart + m_iTotalSize - m_iPosition) / 2, iLength);
- if (iLen <= 0) {
- return 0;
- }
- }
- int32_t iEnd = m_iStart + m_iLength;
- if (m_pStreamImp->GetPosition() != m_iPosition) {
- m_pStreamImp->Seek(FX_STREAMSEEK_Begin, m_iPosition);
- }
- iLen = m_pStreamImp->WriteString(pStr, iLen);
- m_iPosition = m_pStreamImp->GetPosition();
- if (m_iPosition > iEnd) {
- m_iLength = m_iPosition - m_iStart;
- }
- return iLen;
-}
-void CFGAS_Stream::Flush() {
- if (!m_pStreamImp) {
- return;
- }
- if ((m_dwAccess & FX_STREAMACCESS_Write) == 0) {
- return;
- }
- m_pStreamImp->Flush();
-}
-bool CFGAS_Stream::SetLength(int32_t iLength) {
- if (!m_pStreamImp) {
- return false;
- }
- if ((m_dwAccess & FX_STREAMACCESS_Write) == 0) {
- return false;
- }
- return m_pStreamImp->SetLength(iLength);
-}
-int32_t CFGAS_Stream::GetBOM(uint8_t bom[4]) const {
- if (!m_pStreamImp) {
- return -1;
- }
- return 0;
-}
-uint16_t CFGAS_Stream::GetCodePage() const {
-#if _FX_ENDIAN_ == _FX_LITTLE_ENDIAN_
- return FX_CODEPAGE_UTF16LE;
-#else
- return FX_CODEPAGE_UTF16BE;
-#endif
-}
-uint16_t CFGAS_Stream::SetCodePage(uint16_t wCodePage) {
-#if _FX_ENDIAN_ == _FX_LITTLE_ENDIAN_
- return FX_CODEPAGE_UTF16LE;
-#else
- return FX_CODEPAGE_UTF16BE;
-#endif
-}
-
-CFX_RetainPtr<IFGAS_Stream> CFGAS_Stream::CreateSharedStream(uint32_t dwAccess,
- int32_t iOffset,
- int32_t iLength) {
- ASSERT(iLength > 0);
- if (!m_pStreamImp)
- return nullptr;
-
- if ((m_dwAccess & FX_STREAMACCESS_Text) != 0 &&
- (dwAccess & FX_STREAMACCESS_Text) == 0) {
- return nullptr;
- }
- if ((m_dwAccess & FX_STREAMACCESS_Write) == 0 &&
- (dwAccess & FX_STREAMACCESS_Write) != 0) {
- return nullptr;
- }
- int32_t iStart = m_iStart + iOffset;
- int32_t iTotal = m_iStart + m_iLength;
- if (iStart < m_iStart || iStart >= iTotal)
- return nullptr;
-
- int32_t iEnd = iStart + iLength;
- if (iEnd < iStart || iEnd > iTotal)
- return nullptr;
-
- auto pShared = pdfium::MakeRetain<CFGAS_Stream>();
- pShared->m_eStreamType = FX_STREAMTYPE_Stream;
- pShared->m_pStreamImp = m_pStreamImp;
- pShared->m_dwAccess = dwAccess;
- pShared->m_iTotalSize = iLength;
- pShared->m_iPosition = iStart;
- pShared->m_iStart = iStart;
- pShared->m_iLength = (dwAccess & FX_STREAMACCESS_Write) != 0 ? 0 : iLength;
- if (dwAccess & FX_STREAMACCESS_Text)
- return IFGAS_Stream::CreateTextStream(pShared);
-
- return pShared;
-}
-
-CFX_RetainPtr<IFX_SeekableReadStream> IFGAS_Stream::MakeSeekableReadStream() {
- return CFGAS_FileRead::Create(CFX_RetainPtr<IFGAS_Stream>(this));
-}
-
-CFX_RetainPtr<CFGAS_FileRead> CFGAS_FileRead::Create(
- const CFX_RetainPtr<IFGAS_Stream>& pStream) {
- return pdfium::MakeRetain<CFGAS_FileRead>(pStream);
-}
-
-CFGAS_FileRead::CFGAS_FileRead(const CFX_RetainPtr<IFGAS_Stream>& pStream)
- : m_pStream(pStream) {
- ASSERT(m_pStream);
-}
-
-CFGAS_FileRead::~CFGAS_FileRead() {}
-
-FX_FILESIZE CFGAS_FileRead::GetSize() {
- return (FX_FILESIZE)m_pStream->GetLength();
-}
-
-bool CFGAS_FileRead::ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) {
- m_pStream->Seek(FX_STREAMSEEK_Begin, (int32_t)offset);
- int32_t iLen = m_pStream->ReadData((uint8_t*)buffer, (int32_t)size);
- return iLen == (int32_t)size;
-}
diff --git a/chromium/third_party/pdfium/xfa/fgas/crt/fgas_stream.h b/chromium/third_party/pdfium/xfa/fgas/crt/fgas_stream.h
deleted file mode 100644
index 79fda58d2a5..00000000000
--- a/chromium/third_party/pdfium/xfa/fgas/crt/fgas_stream.h
+++ /dev/null
@@ -1,69 +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 XFA_FGAS_CRT_FGAS_STREAM_H_
-#define XFA_FGAS_CRT_FGAS_STREAM_H_
-
-#include "core/fxcrt/cfx_retain_ptr.h"
-#include "core/fxcrt/fx_stream.h"
-#include "core/fxcrt/fx_system.h"
-
-enum FX_STREAMACCESS {
- FX_STREAMACCESS_Binary = 0x00,
- FX_STREAMACCESS_Text = 0x01,
- FX_STREAMACCESS_Read = 0x02,
- FX_STREAMACCESS_Write = 0x04,
- FX_STREAMACCESS_Truncate = 0x10,
- FX_STREAMACCESS_Append = 0x20,
- FX_STREAMACCESS_Create = 0x80,
-};
-
-enum FX_STREAMSEEK {
- FX_STREAMSEEK_Begin = 0,
- FX_STREAMSEEK_Current,
- FX_STREAMSEEK_End,
-};
-
-class IFGAS_Stream : public CFX_Retainable {
- public:
- static CFX_RetainPtr<IFGAS_Stream> CreateStream(
- const CFX_RetainPtr<IFX_SeekableReadStream>& pFileRead,
- uint32_t dwAccess);
- static CFX_RetainPtr<IFGAS_Stream> CreateStream(
- const CFX_RetainPtr<IFX_SeekableWriteStream>& pFileWrite,
- uint32_t dwAccess);
- static CFX_RetainPtr<IFGAS_Stream> CreateStream(uint8_t* pData,
- int32_t length,
- uint32_t dwAccess);
- static CFX_RetainPtr<IFGAS_Stream> CreateTextStream(
- const CFX_RetainPtr<IFGAS_Stream>& pBaseStream);
-
- virtual CFX_RetainPtr<IFGAS_Stream> CreateSharedStream(uint32_t dwAccess,
- int32_t iOffset,
- int32_t iLength) = 0;
-
- virtual uint32_t GetAccessModes() const = 0;
- virtual int32_t GetLength() const = 0;
- virtual int32_t Seek(FX_STREAMSEEK eSeek, int32_t iOffset) = 0;
- virtual int32_t GetPosition() = 0;
- virtual bool IsEOF() const = 0;
- virtual int32_t ReadData(uint8_t* pBuffer, int32_t iBufferSize) = 0;
- virtual int32_t ReadString(FX_WCHAR* pStr,
- int32_t iMaxLength,
- bool& bEOS) = 0;
- virtual int32_t WriteData(const uint8_t* pBuffer, int32_t iBufferSize) = 0;
- virtual int32_t WriteString(const FX_WCHAR* pStr, int32_t iLength) = 0;
- virtual void Flush() = 0;
- virtual bool SetLength(int32_t iLength) = 0;
- virtual int32_t GetBOM(uint8_t bom[4]) const = 0;
- virtual uint16_t GetCodePage() const = 0;
- virtual uint16_t SetCodePage(uint16_t wCodePage) = 0;
-
- CFX_RetainPtr<IFX_SeekableReadStream> MakeSeekableReadStream();
-};
-
-
-#endif // XFA_FGAS_CRT_FGAS_STREAM_H_
diff --git a/chromium/third_party/pdfium/xfa/fgas/crt/fgas_utils.cpp b/chromium/third_party/pdfium/xfa/fgas/crt/fgas_utils.cpp
deleted file mode 100644
index c09198f6e0a..00000000000
--- a/chromium/third_party/pdfium/xfa/fgas/crt/fgas_utils.cpp
+++ /dev/null
@@ -1,401 +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
-
-#include "xfa/fgas/crt/fgas_utils.h"
-
-#include <algorithm>
-
-#include "core/fxcrt/fx_basic.h"
-
-class FX_BASEARRAYDATA {
- public:
- FX_BASEARRAYDATA(int32_t growsize, int32_t blocksize);
- ~FX_BASEARRAYDATA();
-
- int32_t iGrowSize;
- int32_t iBlockSize;
- int32_t iTotalCount;
- int32_t iBlockCount;
- uint8_t* pBuffer;
-};
-
-FX_BASEARRAYDATA::FX_BASEARRAYDATA(int32_t growsize, int32_t blocksize)
- : iGrowSize(growsize),
- iBlockSize(blocksize),
- iTotalCount(0),
- iBlockCount(0),
- pBuffer(nullptr) {}
-
-FX_BASEARRAYDATA::~FX_BASEARRAYDATA() {
- FX_Free(pBuffer);
-}
-
-CFX_BaseArray::CFX_BaseArray(int32_t iGrowSize, int32_t iBlockSize) {
- ASSERT(iGrowSize > 0 && iBlockSize > 0);
- m_pData = new FX_BASEARRAYDATA(iGrowSize, iBlockSize);
-}
-CFX_BaseArray::~CFX_BaseArray() {
- RemoveAll(false);
- delete m_pData;
-}
-int32_t CFX_BaseArray::GetSize() const {
- return m_pData->iBlockCount;
-}
-int32_t CFX_BaseArray::GetBlockSize() const {
- return m_pData->iBlockSize;
-}
-uint8_t* CFX_BaseArray::AddSpaceTo(int32_t index) {
- ASSERT(index > -1);
- uint8_t*& pBuffer = m_pData->pBuffer;
- int32_t& iTotalCount = m_pData->iTotalCount;
- int32_t iBlockSize = m_pData->iBlockSize;
- if (index >= iTotalCount) {
- int32_t iGrowSize = m_pData->iGrowSize;
- iTotalCount = (index / iGrowSize + 1) * iGrowSize;
- int32_t iNewSize = iTotalCount * iBlockSize;
- if (!pBuffer) {
- pBuffer = FX_Alloc(uint8_t, iNewSize);
- } else {
- pBuffer = FX_Realloc(uint8_t, pBuffer, iNewSize);
- }
- }
- int32_t& iBlockCount = m_pData->iBlockCount;
- if (index >= iBlockCount) {
- iBlockCount = index + 1;
- }
- return pBuffer + index * iBlockSize;
-}
-uint8_t* CFX_BaseArray::GetAt(int32_t index) const {
- ASSERT(index > -1 && index < m_pData->iBlockCount);
- return m_pData->pBuffer + index * m_pData->iBlockSize;
-}
-uint8_t* CFX_BaseArray::GetBuffer() const {
- return m_pData->pBuffer;
-}
-int32_t CFX_BaseArray::Append(const CFX_BaseArray& src,
- int32_t iStart,
- int32_t iCount) {
- int32_t iBlockSize = m_pData->iBlockSize;
- ASSERT(iBlockSize == src.m_pData->iBlockSize);
- int32_t& iBlockCount = m_pData->iBlockCount;
- int32_t iAdded = src.GetSize();
- ASSERT(iStart > -1 && iStart < iAdded);
- if (iCount < 0) {
- iCount = iAdded;
- }
- if (iStart + iCount > iAdded) {
- iCount = iAdded - iStart;
- }
- if (iCount < 1) {
- return 0;
- }
- uint8_t* pDst = m_pData->pBuffer + iBlockCount * iBlockSize;
- AddSpaceTo(iBlockCount + iCount - 1);
- FXSYS_memcpy(pDst, src.m_pData->pBuffer + iStart * iBlockSize,
- iCount * iBlockSize);
- return iCount;
-}
-int32_t CFX_BaseArray::Copy(const CFX_BaseArray& src,
- int32_t iStart,
- int32_t iCount) {
- int32_t iBlockSize = m_pData->iBlockSize;
- ASSERT(iBlockSize == src.m_pData->iBlockSize);
- int32_t iCopied = src.GetSize();
- ASSERT(iStart > -1 && iStart < iCopied);
- if (iCount < 0) {
- iCount = iCopied;
- }
- if (iStart + iCount > iCopied) {
- iCount = iCopied - iStart;
- }
- if (iCount < 1) {
- return 0;
- }
- RemoveAll(true);
- AddSpaceTo(iCount - 1);
- FXSYS_memcpy(m_pData->pBuffer, src.m_pData->pBuffer + iStart * iBlockSize,
- iCount * iBlockSize);
- return iCount;
-}
-int32_t CFX_BaseArray::RemoveLast(int32_t iCount) {
- int32_t& iBlockCount = m_pData->iBlockCount;
- if (iCount < 0 || iCount > iBlockCount) {
- iCount = iBlockCount;
- iBlockCount = 0;
- } else {
- iBlockCount -= iCount;
- }
- return iCount;
-}
-void CFX_BaseArray::RemoveAll(bool bLeaveMemory) {
- if (!bLeaveMemory) {
- uint8_t*& pBuffer = m_pData->pBuffer;
- if (pBuffer) {
- FX_Free(pBuffer);
- pBuffer = nullptr;
- }
- m_pData->iTotalCount = 0;
- }
- m_pData->iBlockCount = 0;
-}
-
-CFX_BaseMassArrayImp::CFX_BaseMassArrayImp(int32_t iChunkSize,
- int32_t iBlockSize)
- : m_iChunkSize(iChunkSize),
- m_iBlockSize(iBlockSize),
- m_iChunkCount(0),
- m_iBlockCount(0),
- m_pData(new CFX_ArrayTemplate<void*>()) {
- ASSERT(m_iChunkSize > 0 && m_iBlockSize > 0);
- m_pData->SetSize(16);
-}
-CFX_BaseMassArrayImp::~CFX_BaseMassArrayImp() {
- RemoveAll(false);
- delete m_pData;
-}
-uint8_t* CFX_BaseMassArrayImp::AddSpaceTo(int32_t index) {
- ASSERT(index > -1);
- uint8_t* pChunk;
- if (index < m_iBlockCount) {
- pChunk = (uint8_t*)m_pData->GetAt(index / m_iChunkSize);
- } else {
- int32_t iMemSize = m_iChunkSize * m_iBlockSize;
- while (true) {
- if (index < m_iChunkCount * m_iChunkSize) {
- pChunk = (uint8_t*)m_pData->GetAt(index / m_iChunkSize);
- break;
- } else {
- pChunk = FX_Alloc(uint8_t, iMemSize);
- if (m_iChunkCount < m_pData->GetSize()) {
- m_pData->SetAt(m_iChunkCount, pChunk);
- } else {
- m_pData->Add(pChunk);
- }
- m_iChunkCount++;
- }
- }
- }
- ASSERT(pChunk);
- m_iBlockCount = index + 1;
- return pChunk + (index % m_iChunkSize) * m_iBlockSize;
-}
-uint8_t* CFX_BaseMassArrayImp::GetAt(int32_t index) const {
- ASSERT(index > -1 && index < m_iBlockCount);
- uint8_t* pChunk = (uint8_t*)m_pData->GetAt(index / m_iChunkSize);
- ASSERT(pChunk);
- return pChunk + (index % m_iChunkSize) * m_iBlockSize;
-}
-int32_t CFX_BaseMassArrayImp::Append(const CFX_BaseMassArrayImp& src,
- int32_t iStart,
- int32_t iCount) {
- ASSERT(m_iBlockSize == src.m_iBlockSize);
- int32_t iAdded = src.m_iBlockCount;
- ASSERT(iStart > -1 && iStart < iAdded);
- if (iCount < 0) {
- iCount = iAdded;
- }
- if (iStart + iCount > iAdded) {
- iCount = iAdded - iStart;
- }
- if (iCount < 1) {
- return m_iBlockCount;
- }
- int32_t iBlockCount = m_iBlockCount;
- int32_t iTotal = m_iBlockCount + iCount;
- AddSpaceTo(iTotal - 1);
- Append(iBlockCount, src, iStart, iCount);
- return m_iBlockCount;
-}
-int32_t CFX_BaseMassArrayImp::Copy(const CFX_BaseMassArrayImp& src,
- int32_t iStart,
- int32_t iCount) {
- ASSERT(m_iBlockSize == src.m_iBlockSize);
- int32_t iCopied = src.m_iBlockCount;
- ASSERT(iStart > -1);
- if (iStart >= iCopied) {
- return 0;
- }
- RemoveAll(true);
- if (iCount < 0) {
- iCount = iCopied;
- }
- if (iStart + iCount > iCopied) {
- iCount = iCopied - iStart;
- }
- if (iCount < 1) {
- return 0;
- }
- if (m_iBlockCount < iCount) {
- AddSpaceTo(iCount - 1);
- }
- Append(0, src, iStart, iCount);
- return m_iBlockCount;
-}
-
-void CFX_BaseMassArrayImp::Append(int32_t iDstStart,
- const CFX_BaseMassArrayImp& src,
- int32_t iSrcStart,
- int32_t iSrcCount) {
- ASSERT(iDstStart > -1);
- ASSERT(m_iBlockSize == src.m_iBlockSize);
- ASSERT(src.m_iBlockCount > 0);
- ASSERT(m_iBlockCount >= iDstStart + iSrcCount);
- ASSERT(iSrcStart > -1);
- ASSERT(iSrcStart < src.m_iBlockCount);
- ASSERT(iSrcCount > 0);
- ASSERT(iSrcStart + iSrcCount <= src.m_iBlockCount);
-
- int32_t iDstChunkIndex = iDstStart / m_iChunkSize;
- int32_t iSrcChunkIndex = iSrcStart / src.m_iChunkSize;
- uint8_t* pDstChunk = (uint8_t*)GetAt(iDstStart);
- uint8_t* pSrcChunk = (uint8_t*)src.GetAt(iSrcStart);
- int32_t iDstChunkSize = m_iChunkSize - (iDstStart % m_iChunkSize);
- int32_t iSrcChunkSize = src.m_iChunkSize - (iSrcStart % src.m_iChunkSize);
- int32_t iCopySize =
- std::min(iSrcCount, std::min(iSrcChunkSize, iDstChunkSize));
- int32_t iCopyBytes = iCopySize * m_iBlockSize;
- while (iSrcCount > 0) {
- ASSERT(pDstChunk && pSrcChunk);
- FXSYS_memcpy(pDstChunk, pSrcChunk, iCopyBytes);
- iSrcCount -= iCopySize;
- iSrcChunkSize -= iCopySize;
- if (iSrcChunkSize < 1) {
- iSrcChunkSize = src.m_iChunkSize;
- iSrcChunkIndex++;
- pSrcChunk = (uint8_t*)src.m_pData->GetAt(iSrcChunkIndex);
- } else {
- pSrcChunk += iCopyBytes;
- }
- iDstChunkSize -= iCopySize;
- if (iDstChunkSize < 1) {
- iDstChunkSize = m_iChunkSize;
- iDstChunkIndex++;
- pDstChunk = (uint8_t*)m_pData->GetAt(iDstChunkIndex);
- } else {
- pDstChunk += iCopyBytes;
- }
- iCopySize = std::min(iSrcCount, std::min(iSrcChunkSize, iDstChunkSize));
- iCopyBytes = iCopySize * m_iBlockSize;
- }
-}
-int32_t CFX_BaseMassArrayImp::RemoveLast(int32_t iCount) {
- if (iCount < 0 || iCount >= m_iBlockCount) {
- m_iBlockCount = 0;
- } else {
- m_iBlockCount -= iCount;
- }
- return m_iBlockCount;
-}
-void CFX_BaseMassArrayImp::RemoveAll(bool bLeaveMemory) {
- if (bLeaveMemory) {
- m_iBlockCount = 0;
- return;
- }
- for (int32_t i = 0; i < m_iChunkCount; i++)
- FX_Free(m_pData->GetAt(i));
-
- m_pData->RemoveAll();
- m_iChunkCount = 0;
- m_iBlockCount = 0;
-}
-
-struct FX_BASEDISCRETEARRAYDATA {
- int32_t iBlockSize;
- int32_t iChunkSize;
- int32_t iChunkCount;
- CFX_ArrayTemplate<uint8_t*> ChunkBuffer;
-};
-
-CFX_BaseDiscreteArray::CFX_BaseDiscreteArray(int32_t iChunkSize,
- int32_t iBlockSize) {
- ASSERT(iChunkSize > 0 && iBlockSize > 0);
- FX_BASEDISCRETEARRAYDATA* pData = new FX_BASEDISCRETEARRAYDATA;
- m_pData = pData;
- pData->ChunkBuffer.SetSize(16);
- pData->iChunkCount = 0;
- pData->iChunkSize = iChunkSize;
- pData->iBlockSize = iBlockSize;
-}
-CFX_BaseDiscreteArray::~CFX_BaseDiscreteArray() {
- RemoveAll();
- delete static_cast<FX_BASEDISCRETEARRAYDATA*>(m_pData);
-}
-uint8_t* CFX_BaseDiscreteArray::AddSpaceTo(int32_t index) {
- ASSERT(index > -1);
- FX_BASEDISCRETEARRAYDATA* pData = (FX_BASEDISCRETEARRAYDATA*)m_pData;
- int32_t& iChunkCount = pData->iChunkCount;
- int32_t iChunkSize = pData->iChunkSize;
- uint8_t* pChunk = nullptr;
- int32_t iChunk = index / iChunkSize;
- if (iChunk < iChunkCount) {
- pChunk = pData->ChunkBuffer.GetAt(iChunk);
- }
- if (!pChunk) {
- pChunk = FX_Alloc2D(uint8_t, iChunkSize, pData->iBlockSize);
- FXSYS_memset(pChunk, 0, iChunkSize * pData->iBlockSize);
- pData->ChunkBuffer.SetAtGrow(iChunk, pChunk);
- if (iChunkCount <= iChunk) {
- iChunkCount = iChunk + 1;
- }
- }
- return pChunk + (index % iChunkSize) * pData->iBlockSize;
-}
-uint8_t* CFX_BaseDiscreteArray::GetAt(int32_t index) const {
- ASSERT(index >= 0);
- FX_BASEDISCRETEARRAYDATA* pData = (FX_BASEDISCRETEARRAYDATA*)m_pData;
- int32_t iChunkSize = pData->iChunkSize;
- int32_t iChunk = index / iChunkSize;
- if (iChunk >= pData->iChunkCount)
- return nullptr;
-
- uint8_t* pChunk = pData->ChunkBuffer.GetAt(iChunk);
- if (!pChunk)
- return nullptr;
-
- return pChunk + (index % iChunkSize) * pData->iBlockSize;
-}
-void CFX_BaseDiscreteArray::RemoveAll() {
- FX_BASEDISCRETEARRAYDATA* pData = (FX_BASEDISCRETEARRAYDATA*)m_pData;
- CFX_ArrayTemplate<uint8_t*>& ChunkBuffer = pData->ChunkBuffer;
- int32_t& iChunkCount = pData->iChunkCount;
- for (int32_t i = 0; i < iChunkCount; i++)
- FX_Free(ChunkBuffer.GetAt(i));
-
- ChunkBuffer.RemoveAll();
- iChunkCount = 0;
-}
-CFX_BaseStack::CFX_BaseStack(int32_t iChunkSize, int32_t iBlockSize) {
- m_pData = new CFX_BaseMassArrayImp(iChunkSize, iBlockSize);
-}
-CFX_BaseStack::~CFX_BaseStack() {
- delete (CFX_BaseMassArrayImp*)m_pData;
-}
-uint8_t* CFX_BaseStack::Push() {
- return m_pData->AddSpace();
-}
-void CFX_BaseStack::Pop() {
- int32_t& iBlockCount = m_pData->m_iBlockCount;
- if (iBlockCount < 1) {
- return;
- }
- iBlockCount--;
-}
-uint8_t* CFX_BaseStack::GetTopElement() const {
- int32_t iSize = m_pData->m_iBlockCount;
- if (iSize < 1) {
- return nullptr;
- }
- return m_pData->GetAt(iSize - 1);
-}
-int32_t CFX_BaseStack::GetSize() const {
- return m_pData->m_iBlockCount;
-}
-uint8_t* CFX_BaseStack::GetAt(int32_t index) const {
- return m_pData->GetAt(index);
-}
-void CFX_BaseStack::RemoveAll(bool bLeaveMemory) {
- m_pData->RemoveAll(bLeaveMemory);
-}
diff --git a/chromium/third_party/pdfium/xfa/fgas/crt/fgas_utils.h b/chromium/third_party/pdfium/xfa/fgas/crt/fgas_utils.h
deleted file mode 100644
index 105920dc551..00000000000
--- a/chromium/third_party/pdfium/xfa/fgas/crt/fgas_utils.h
+++ /dev/null
@@ -1,173 +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 XFA_FGAS_CRT_FGAS_UTILS_H_
-#define XFA_FGAS_CRT_FGAS_UTILS_H_
-
-#include "core/fxcrt/fx_coordinates.h"
-
-class FX_BASEARRAYDATA;
-
-class CFX_BaseArray {
- protected:
- CFX_BaseArray(int32_t iGrowSize, int32_t iBlockSize);
- ~CFX_BaseArray();
-
- int32_t GetSize() const;
- int32_t GetBlockSize() const;
- uint8_t* AddSpaceTo(int32_t index);
- uint8_t* GetAt(int32_t index) const;
- uint8_t* GetBuffer() const;
- int32_t Append(const CFX_BaseArray& src, int32_t iStart, int32_t iCount);
- int32_t Copy(const CFX_BaseArray& src, int32_t iStart, int32_t iCount);
- int32_t RemoveLast(int32_t iCount);
- void RemoveAll(bool bLeaveMemory);
-
- FX_BASEARRAYDATA* m_pData;
-};
-
-template <class baseType>
-class CFX_BaseArrayTemplate : public CFX_BaseArray {
- public:
- explicit CFX_BaseArrayTemplate(int32_t iGrowSize)
- : CFX_BaseArray(iGrowSize, sizeof(baseType)) {}
- CFX_BaseArrayTemplate(int32_t iGrowSize, int32_t iBlockSize)
- : CFX_BaseArray(iGrowSize, iBlockSize) {}
-
- int32_t GetSize() const { return CFX_BaseArray::GetSize(); }
- int32_t GetBlockSize() const { return CFX_BaseArray::GetBlockSize(); }
- baseType* AddSpace() {
- return (baseType*)CFX_BaseArray::AddSpaceTo(CFX_BaseArray::GetSize());
- }
- int32_t Add(const baseType& element) {
- int32_t index = CFX_BaseArray::GetSize();
- *(baseType*)CFX_BaseArray::AddSpaceTo(index) = element;
- return index;
- }
- baseType* GetBuffer() const { return (baseType*)CFX_BaseArray::GetBuffer(); }
- baseType& GetAt(int32_t index) const {
- return *(baseType*)CFX_BaseArray::GetAt(index);
- }
- baseType* GetPtrAt(int32_t index) const {
- return (baseType*)CFX_BaseArray::GetAt(index);
- }
- void SetAt(int32_t index, const baseType& element) {
- *(baseType*)CFX_BaseArray::GetAt(index) = element;
- }
- void SetAtGrow(int32_t index, const baseType& element) {
- *(baseType*)CFX_BaseArray::AddSpaceTo(index) = element;
- }
- int32_t Append(const CFX_BaseArrayTemplate& src,
- int32_t iStart,
- int32_t iCount) {
- return CFX_BaseArray::Append(src, iStart, iCount);
- }
- int32_t Copy(const CFX_BaseArrayTemplate& src,
- int32_t iStart,
- int32_t iCount) {
- return CFX_BaseArray::Copy(src, iStart, iCount);
- }
- int32_t RemoveLast(int32_t iCount) {
- return CFX_BaseArray::RemoveLast(iCount);
- }
- void RemoveAll(bool bLeaveMemory) { CFX_BaseArray::RemoveAll(bLeaveMemory); }
-};
-
-class CFX_BaseMassArrayImp {
- public:
- CFX_BaseMassArrayImp(int32_t iChunkSize, int32_t iBlockSize);
- ~CFX_BaseMassArrayImp();
-
- uint8_t* AddSpace() { return AddSpaceTo(m_iBlockCount); }
- uint8_t* AddSpaceTo(int32_t index);
- uint8_t* GetAt(int32_t index) const;
- int32_t Append(const CFX_BaseMassArrayImp& src,
- int32_t iStart,
- int32_t iCount);
- int32_t Copy(const CFX_BaseMassArrayImp& src, int32_t iStart, int32_t iCount);
- int32_t RemoveLast(int32_t iCount);
- void RemoveAll(bool bLeaveMemory);
-
- int32_t m_iChunkSize;
- int32_t m_iBlockSize;
- int32_t m_iChunkCount;
- int32_t m_iBlockCount;
- CFX_ArrayTemplate<void*>* m_pData;
-
- protected:
- void Append(int32_t iDstStart,
- const CFX_BaseMassArrayImp& src,
- int32_t iSrcStart,
- int32_t iSrcCount);
-};
-
-class CFX_BaseDiscreteArray {
- protected:
- CFX_BaseDiscreteArray(int32_t iChunkSize, int32_t iBlockSize);
- ~CFX_BaseDiscreteArray();
-
- uint8_t* AddSpaceTo(int32_t index);
- uint8_t* GetAt(int32_t index) const;
- void RemoveAll();
- void* m_pData;
-};
-
-template <class baseType>
-class CFX_DiscreteArrayTemplate : public CFX_BaseDiscreteArray {
- public:
- explicit CFX_DiscreteArrayTemplate(int32_t iChunkSize)
- : CFX_BaseDiscreteArray(iChunkSize, sizeof(baseType)) {}
-
- baseType& GetAt(int32_t index, const baseType& defValue) const {
- baseType* p = (baseType*)CFX_BaseDiscreteArray::GetAt(index);
- return p ? *p : (baseType&)defValue;
- }
- baseType* GetPtrAt(int32_t index) const {
- return (baseType*)CFX_BaseDiscreteArray::GetAt(index);
- }
- void SetAtGrow(int32_t index, const baseType& element) {
- *(baseType*)CFX_BaseDiscreteArray::AddSpaceTo(index) = element;
- }
- void RemoveAll() { CFX_BaseDiscreteArray::RemoveAll(); }
-};
-
-class CFX_BaseStack {
- protected:
- CFX_BaseStack(int32_t iChunkSize, int32_t iBlockSize);
- ~CFX_BaseStack();
-
- uint8_t* Push();
- void Pop();
- uint8_t* GetTopElement() const;
- int32_t GetSize() const;
- uint8_t* GetAt(int32_t index) const;
- void RemoveAll(bool bLeaveMemory);
- CFX_BaseMassArrayImp* m_pData;
-};
-
-template <class baseType>
-class CFX_StackTemplate : public CFX_BaseStack {
- public:
- explicit CFX_StackTemplate(int32_t iChunkSize)
- : CFX_BaseStack(iChunkSize, sizeof(baseType)) {}
-
- int32_t Push(const baseType& element) {
- int32_t index = CFX_BaseStack::GetSize();
- *(baseType*)CFX_BaseStack::Push() = element;
- return index;
- }
- void Pop() { CFX_BaseStack::Pop(); }
- baseType* GetTopElement() const {
- return (baseType*)CFX_BaseStack::GetTopElement();
- }
- int32_t GetSize() const { return CFX_BaseStack::GetSize(); }
- baseType* GetAt(int32_t index) const {
- return (baseType*)CFX_BaseStack::GetAt(index);
- }
- void RemoveAll(bool bLeaveMemory) { CFX_BaseStack::RemoveAll(bLeaveMemory); }
-};
-
-#endif // XFA_FGAS_CRT_FGAS_UTILS_H_
diff --git a/chromium/third_party/pdfium/xfa/fgas/crt/ifgas_stream.cpp b/chromium/third_party/pdfium/xfa/fgas/crt/ifgas_stream.cpp
new file mode 100644
index 00000000000..712243d7017
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fgas/crt/ifgas_stream.cpp
@@ -0,0 +1,593 @@
+// 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
+
+#include "xfa/fgas/crt/ifgas_stream.h"
+
+#if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN32_MOBILE_ || \
+ _FX_OS_ == _FX_WIN64_
+#include <io.h>
+#endif
+
+#include <algorithm>
+#include <memory>
+#include <utility>
+#include <vector>
+
+#include "core/fxcrt/fx_ext.h"
+#include "third_party/base/ptr_util.h"
+#include "third_party/base/stl_util.h"
+#include "xfa/fgas/crt/fgas_codepage.h"
+
+namespace {
+
+class IFGAS_StreamImp {
+ public:
+ virtual ~IFGAS_StreamImp() {}
+
+ virtual int32_t GetLength() const = 0;
+ virtual int32_t Seek(FX_STREAMSEEK eSeek, int32_t iOffset) = 0;
+ virtual int32_t GetPosition() = 0;
+ virtual bool IsEOF() const = 0;
+ virtual int32_t ReadData(uint8_t* pBuffer, int32_t iBufferSize) = 0;
+ virtual int32_t ReadString(wchar_t* pStr, int32_t iMaxLength, bool& bEOS) = 0;
+ virtual int32_t WriteData(const uint8_t* pBuffer, int32_t iBufferSize) = 0;
+ virtual int32_t WriteString(const wchar_t* pStr, int32_t iLength) = 0;
+ virtual void Flush() = 0;
+ virtual bool SetLength(int32_t iLength) = 0;
+
+ protected:
+ IFGAS_StreamImp();
+};
+
+class CFGAS_FileReadStreamImp : public IFGAS_StreamImp {
+ public:
+ CFGAS_FileReadStreamImp();
+ ~CFGAS_FileReadStreamImp() override {}
+
+ bool LoadFileRead(const CFX_RetainPtr<IFX_SeekableReadStream>& pFileRead);
+
+ // IFGAS_StreamImp:
+ int32_t GetLength() const override;
+ int32_t Seek(FX_STREAMSEEK eSeek, int32_t iOffset) override;
+ int32_t GetPosition() override { return m_iPosition; }
+ bool IsEOF() const override;
+ int32_t ReadData(uint8_t* pBuffer, int32_t iBufferSize) override;
+ int32_t ReadString(wchar_t* pStr, int32_t iMaxLength, bool& bEOS) override;
+ int32_t WriteData(const uint8_t* pBuffer, int32_t iBufferSize) override {
+ return 0;
+ }
+ int32_t WriteString(const wchar_t* pStr, int32_t iLength) override {
+ return 0;
+ }
+ void Flush() override {}
+ bool SetLength(int32_t iLength) override { return false; }
+
+ private:
+ CFX_RetainPtr<IFX_SeekableReadStream> m_pFileRead;
+ int32_t m_iPosition;
+ int32_t m_iLength;
+};
+
+class CFGAS_FileWriteStreamImp : public IFGAS_StreamImp {
+ public:
+ CFGAS_FileWriteStreamImp();
+ ~CFGAS_FileWriteStreamImp() override {}
+
+ bool LoadFileWrite(const CFX_RetainPtr<IFX_SeekableWriteStream>& pFileWrite);
+
+ // IFGAS_StreamImp:
+ int32_t GetLength() const override;
+ int32_t Seek(FX_STREAMSEEK eSeek, int32_t iOffset) override;
+ int32_t GetPosition() override { return m_iPosition; }
+ bool IsEOF() const override;
+ int32_t ReadData(uint8_t* pBuffer, int32_t iBufferSize) override { return 0; }
+ int32_t ReadString(wchar_t* pStr, int32_t iMaxLength, bool& bEOS) override {
+ return 0;
+ }
+ int32_t WriteData(const uint8_t* pBuffer, int32_t iBufferSize) override;
+ int32_t WriteString(const wchar_t* pStr, int32_t iLength) override;
+ void Flush() override;
+ bool SetLength(int32_t iLength) override { return false; }
+
+ private:
+ CFX_RetainPtr<IFX_SeekableWriteStream> m_pFileWrite;
+ int32_t m_iPosition;
+};
+
+class CFGAS_TextStream : public IFGAS_Stream {
+ public:
+ template <typename T, typename... Args>
+ friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args);
+
+ // IFGAS_Stream
+ int32_t GetLength() const override;
+ int32_t Seek(FX_STREAMSEEK eSeek, int32_t iOffset) override;
+ int32_t GetPosition() override;
+ bool IsEOF() const override;
+ int32_t ReadData(uint8_t* pBuffer, int32_t iBufferSize) override;
+ int32_t ReadString(wchar_t* pStr, int32_t iMaxLength, bool& bEOS) override;
+ int32_t WriteData(const uint8_t* pBuffer, int32_t iBufferSize) override;
+ int32_t WriteString(const wchar_t* pStr, int32_t iLength) override;
+ void Flush() override;
+ bool SetLength(int32_t iLength) override;
+ int32_t GetBOMLength() const override;
+ uint16_t GetCodePage() const override;
+ uint16_t SetCodePage(uint16_t wCodePage) override;
+
+ private:
+ CFGAS_TextStream(std::unique_ptr<IFGAS_StreamImp> imp, bool isWriteSteam);
+ ~CFGAS_TextStream() override;
+
+ void InitStream();
+
+ uint16_t m_wCodePage;
+ int32_t m_wBOMLength;
+ bool m_IsWriteStream;
+ std::unique_ptr<IFGAS_StreamImp> m_pStreamImp;
+};
+
+class CFGAS_WideStringReadStream : public IFGAS_Stream {
+ public:
+ template <typename T, typename... Args>
+ friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args);
+
+ // IFGAS_Stream
+ int32_t GetLength() const override;
+ int32_t Seek(FX_STREAMSEEK eSeek, int32_t iOffset) override;
+ int32_t GetPosition() override;
+ bool IsEOF() const override;
+ int32_t ReadData(uint8_t* pBuffer, int32_t iBufferSize) override;
+ int32_t ReadString(wchar_t* pStr, int32_t iMaxLength, bool& bEOS) override;
+ int32_t WriteData(const uint8_t* pBuffer, int32_t iBufferSize) override;
+ int32_t WriteString(const wchar_t* pStr, int32_t iLength) override;
+ void Flush() override {}
+ bool SetLength(int32_t iLength) override;
+ int32_t GetBOMLength() const override;
+ uint16_t GetCodePage() const override;
+ uint16_t SetCodePage(uint16_t wCodePage) override;
+
+ private:
+ explicit CFGAS_WideStringReadStream(const CFX_WideString& wsBuffer);
+ ~CFGAS_WideStringReadStream() override;
+
+ CFX_WideString m_wsBuffer;
+ int32_t m_iPosition;
+};
+
+IFGAS_StreamImp::IFGAS_StreamImp() {}
+
+CFGAS_FileReadStreamImp::CFGAS_FileReadStreamImp()
+ : m_pFileRead(nullptr), m_iPosition(0), m_iLength(0) {}
+
+bool CFGAS_FileReadStreamImp::LoadFileRead(
+ const CFX_RetainPtr<IFX_SeekableReadStream>& pFileRead) {
+ ASSERT(!m_pFileRead && pFileRead);
+
+ m_pFileRead = pFileRead;
+ m_iLength = m_pFileRead->GetSize();
+ return true;
+}
+
+int32_t CFGAS_FileReadStreamImp::GetLength() const {
+ return m_iLength;
+}
+
+int32_t CFGAS_FileReadStreamImp::Seek(FX_STREAMSEEK eSeek, int32_t iOffset) {
+ switch (eSeek) {
+ case FX_STREAMSEEK_Begin:
+ m_iPosition = iOffset;
+ break;
+ case FX_STREAMSEEK_Current:
+ m_iPosition += iOffset;
+ break;
+ case FX_STREAMSEEK_End:
+ m_iPosition = m_iLength + iOffset;
+ break;
+ }
+ if (m_iPosition < 0) {
+ m_iPosition = 0;
+ } else if (m_iPosition >= m_iLength) {
+ m_iPosition = m_iLength;
+ }
+ return m_iPosition;
+}
+
+bool CFGAS_FileReadStreamImp::IsEOF() const {
+ return m_iPosition >= m_iLength;
+}
+int32_t CFGAS_FileReadStreamImp::ReadData(uint8_t* pBuffer,
+ int32_t iBufferSize) {
+ ASSERT(m_pFileRead);
+ ASSERT(pBuffer && iBufferSize > 0);
+ if (iBufferSize > m_iLength - m_iPosition) {
+ iBufferSize = m_iLength - m_iPosition;
+ }
+ if (m_pFileRead->ReadBlock(pBuffer, m_iPosition, iBufferSize)) {
+ m_iPosition += iBufferSize;
+ return iBufferSize;
+ }
+ return 0;
+}
+int32_t CFGAS_FileReadStreamImp::ReadString(wchar_t* pStr,
+ int32_t iMaxLength,
+ bool& bEOS) {
+ ASSERT(m_pFileRead);
+ ASSERT(pStr && iMaxLength > 0);
+ iMaxLength = ReadData((uint8_t*)pStr, iMaxLength * 2) / 2;
+ if (iMaxLength <= 0) {
+ return 0;
+ }
+ int32_t i = 0;
+ while (i < iMaxLength && pStr[i] != L'\0') {
+ ++i;
+ }
+ bEOS = (m_iPosition >= m_iLength) || pStr[i] == L'\0';
+ return i;
+}
+
+CFGAS_FileWriteStreamImp::CFGAS_FileWriteStreamImp()
+ : m_pFileWrite(nullptr), m_iPosition(0) {}
+
+bool CFGAS_FileWriteStreamImp::LoadFileWrite(
+ const CFX_RetainPtr<IFX_SeekableWriteStream>& pFileWrite) {
+ ASSERT(!m_pFileWrite && pFileWrite);
+
+ m_iPosition = pFileWrite->GetSize();
+ m_pFileWrite = pFileWrite;
+ return true;
+}
+
+int32_t CFGAS_FileWriteStreamImp::GetLength() const {
+ if (!m_pFileWrite)
+ return 0;
+
+ return (int32_t)m_pFileWrite->GetSize();
+}
+int32_t CFGAS_FileWriteStreamImp::Seek(FX_STREAMSEEK eSeek, int32_t iOffset) {
+ int32_t iLength = GetLength();
+ switch (eSeek) {
+ case FX_STREAMSEEK_Begin:
+ m_iPosition = iOffset;
+ break;
+ case FX_STREAMSEEK_Current:
+ m_iPosition += iOffset;
+ break;
+ case FX_STREAMSEEK_End:
+ m_iPosition = iLength + iOffset;
+ break;
+ }
+ if (m_iPosition < 0) {
+ m_iPosition = 0;
+ } else if (m_iPosition >= iLength) {
+ m_iPosition = iLength;
+ }
+ return m_iPosition;
+}
+bool CFGAS_FileWriteStreamImp::IsEOF() const {
+ return m_iPosition >= GetLength();
+}
+int32_t CFGAS_FileWriteStreamImp::WriteData(const uint8_t* pBuffer,
+ int32_t iBufferSize) {
+ if (!m_pFileWrite) {
+ return 0;
+ }
+ if (m_pFileWrite->WriteBlock(pBuffer, m_iPosition, iBufferSize)) {
+ m_iPosition += iBufferSize;
+ }
+ return iBufferSize;
+}
+int32_t CFGAS_FileWriteStreamImp::WriteString(const wchar_t* pStr,
+ int32_t iLength) {
+ return WriteData((const uint8_t*)pStr, iLength * sizeof(wchar_t));
+}
+void CFGAS_FileWriteStreamImp::Flush() {
+ if (m_pFileWrite) {
+ m_pFileWrite->Flush();
+ }
+}
+
+CFGAS_TextStream::CFGAS_TextStream(std::unique_ptr<IFGAS_StreamImp> imp,
+ bool isWriteStream)
+ : m_wCodePage(FX_CODEPAGE_DefANSI),
+ m_wBOMLength(0),
+ m_IsWriteStream(isWriteStream),
+ m_pStreamImp(std::move(imp)) {
+ ASSERT(m_pStreamImp);
+ InitStream();
+}
+
+CFGAS_TextStream::~CFGAS_TextStream() {}
+
+#if _FX_ENDIAN_ == _FX_LITTLE_ENDIAN_
+#define BOM_MASK 0x00FFFFFF
+#define BOM_UTF8 0x00BFBBEF
+#define BOM_UTF16_MASK 0x0000FFFF
+#define BOM_UTF16_BE 0x0000FFFE
+#define BOM_UTF16_LE 0x0000FEFF
+#else
+#define BOM_MASK 0xFFFFFF00
+#define BOM_UTF8 0xEFBBBF00
+#define BOM_UTF16_MASK 0xFFFF0000
+#define BOM_UTF16_BE 0xFEFF0000
+#define BOM_UTF16_LE 0xFFFE0000
+#endif // _FX_ENDIAN_ == _FX_LITTLE_ENDIAN_
+
+void CFGAS_TextStream::InitStream() {
+ int32_t iPosition = m_pStreamImp->GetPosition();
+ m_pStreamImp->Seek(FX_STREAMSEEK_Begin, 0);
+
+ uint32_t bom;
+ m_pStreamImp->ReadData(reinterpret_cast<uint8_t*>(&bom), 3);
+
+ bom &= BOM_MASK;
+ if (bom == BOM_UTF8) {
+ m_wBOMLength = 3;
+ m_wCodePage = FX_CODEPAGE_UTF8;
+ } else {
+ bom &= BOM_UTF16_MASK;
+ if (bom == BOM_UTF16_BE) {
+ m_wBOMLength = 2;
+ m_wCodePage = FX_CODEPAGE_UTF16BE;
+ } else if (bom == BOM_UTF16_LE) {
+ m_wBOMLength = 2;
+ m_wCodePage = FX_CODEPAGE_UTF16LE;
+ } else {
+ m_wBOMLength = 0;
+ m_wCodePage = FXSYS_GetACP();
+ }
+ }
+
+ m_pStreamImp->Seek(FX_STREAMSEEK_Begin, std::max(m_wBOMLength, iPosition));
+}
+
+int32_t CFGAS_TextStream::GetLength() const {
+ return m_pStreamImp->GetLength();
+}
+
+int32_t CFGAS_TextStream::Seek(FX_STREAMSEEK eSeek, int32_t iOffset) {
+ return m_pStreamImp->Seek(eSeek, iOffset);
+}
+
+int32_t CFGAS_TextStream::GetPosition() {
+ return m_pStreamImp->GetPosition();
+}
+
+bool CFGAS_TextStream::IsEOF() const {
+ return m_pStreamImp->IsEOF();
+}
+
+int32_t CFGAS_TextStream::ReadData(uint8_t* pBuffer, int32_t iBufferSize) {
+ ASSERT(pBuffer && iBufferSize > 0);
+
+ if (m_IsWriteStream)
+ return -1;
+
+ int32_t iLen = std::min(
+ m_pStreamImp->GetLength() - m_pStreamImp->GetPosition(), iBufferSize);
+ if (iLen <= 0)
+ return 0;
+
+ return m_pStreamImp->ReadData(pBuffer, iLen);
+}
+
+int32_t CFGAS_TextStream::WriteData(const uint8_t* pBuffer,
+ int32_t iBufferSize) {
+ ASSERT(pBuffer && iBufferSize > 0);
+
+ if (!m_IsWriteStream)
+ return -1;
+ return m_pStreamImp->WriteData(pBuffer, iBufferSize);
+}
+
+void CFGAS_TextStream::Flush() {
+ if (!m_IsWriteStream)
+ return;
+ m_pStreamImp->Flush();
+}
+
+bool CFGAS_TextStream::SetLength(int32_t iLength) {
+ if (!m_IsWriteStream)
+ return false;
+ return m_pStreamImp->SetLength(iLength);
+}
+
+int32_t CFGAS_TextStream::GetBOMLength() const {
+ if (m_wBOMLength < 1)
+ return 0;
+ return m_wBOMLength;
+}
+
+uint16_t CFGAS_TextStream::GetCodePage() const {
+ return m_wCodePage;
+}
+
+uint16_t CFGAS_TextStream::SetCodePage(uint16_t wCodePage) {
+ if (m_wBOMLength > 0)
+ return m_wCodePage;
+
+ uint16_t v = m_wCodePage;
+ m_wCodePage = wCodePage;
+ return v;
+}
+
+int32_t CFGAS_TextStream::ReadString(wchar_t* pStr,
+ int32_t iMaxLength,
+ bool& bEOS) {
+ ASSERT(pStr && iMaxLength > 0);
+ if (m_IsWriteStream)
+ return -1;
+
+ if (m_wCodePage == FX_CODEPAGE_UTF16LE ||
+ m_wCodePage == FX_CODEPAGE_UTF16BE) {
+ int32_t iBytes = iMaxLength * 2;
+ int32_t iLen = m_pStreamImp->ReadData((uint8_t*)pStr, iBytes);
+ iMaxLength = iLen / 2;
+ if (sizeof(wchar_t) > 2)
+ FX_UTF16ToWChar(pStr, iMaxLength);
+
+#if _FX_ENDIAN_ == _FX_BIG_ENDIAN_
+ if (m_wCodePage == FX_CODEPAGE_UTF16LE)
+ FX_SwapByteOrder(pStr, iMaxLength);
+#else
+ if (m_wCodePage == FX_CODEPAGE_UTF16BE)
+ FX_SwapByteOrder(pStr, iMaxLength);
+#endif
+
+ } else {
+ int32_t pos = m_pStreamImp->GetPosition();
+ int32_t iBytes = std::min(iMaxLength, m_pStreamImp->GetLength() - pos);
+ if (iBytes > 0) {
+ std::vector<uint8_t> buf(iBytes);
+
+ int32_t iLen = m_pStreamImp->ReadData(buf.data(), iBytes);
+ int32_t iSrc = iLen;
+ int32_t iDecode = FX_DecodeString(
+ m_wCodePage, reinterpret_cast<const char*>(buf.data()), &iSrc, pStr,
+ &iMaxLength, true);
+ m_pStreamImp->Seek(FX_STREAMSEEK_Current, iSrc - iLen);
+ if (iDecode < 1)
+ return -1;
+ } else {
+ iMaxLength = 0;
+ }
+ }
+ bEOS = m_pStreamImp->IsEOF();
+ return iMaxLength;
+}
+
+int32_t CFGAS_TextStream::WriteString(const wchar_t* pStr, int32_t iLength) {
+ ASSERT(pStr && iLength > 0);
+ if (!m_IsWriteStream)
+ return -1;
+
+ if (m_wCodePage == FX_CODEPAGE_UTF8) {
+ int32_t len = iLength;
+ CFX_UTF8Encoder encoder;
+ while (len-- > 0) {
+ encoder.Input(*pStr++);
+ }
+ CFX_ByteStringC bsResult = encoder.GetResult();
+ m_pStreamImp->WriteData((const uint8_t*)bsResult.c_str(),
+ bsResult.GetLength());
+ }
+ return iLength;
+}
+
+CFGAS_WideStringReadStream::CFGAS_WideStringReadStream(
+ const CFX_WideString& wsBuffer)
+ : m_wsBuffer(wsBuffer), m_iPosition(0) {}
+
+CFGAS_WideStringReadStream::~CFGAS_WideStringReadStream() {}
+
+int32_t CFGAS_WideStringReadStream::GetLength() const {
+ return m_wsBuffer.GetLength() * sizeof(wchar_t);
+}
+
+int32_t CFGAS_WideStringReadStream::Seek(FX_STREAMSEEK eSeek, int32_t iOffset) {
+ switch (eSeek) {
+ case FX_STREAMSEEK_Begin:
+ m_iPosition = iOffset;
+ break;
+ case FX_STREAMSEEK_Current:
+ m_iPosition += iOffset;
+ break;
+ case FX_STREAMSEEK_End:
+ m_iPosition = m_wsBuffer.GetLength() + iOffset;
+ break;
+ }
+ m_iPosition = pdfium::clamp(0, m_iPosition, m_wsBuffer.GetLength());
+ return GetPosition();
+}
+
+int32_t CFGAS_WideStringReadStream::GetPosition() {
+ return m_iPosition * sizeof(wchar_t);
+}
+
+bool CFGAS_WideStringReadStream::IsEOF() const {
+ return m_iPosition >= m_wsBuffer.GetLength();
+}
+
+int32_t CFGAS_WideStringReadStream::ReadData(uint8_t* pBuffer,
+ int32_t iBufferSize) {
+ return 0;
+}
+
+int32_t CFGAS_WideStringReadStream::ReadString(wchar_t* pStr,
+ int32_t iMaxLength,
+ bool& bEOS) {
+ iMaxLength = std::min(iMaxLength, m_wsBuffer.GetLength() - m_iPosition);
+ if (iMaxLength == 0)
+ return 0;
+
+ FXSYS_wcsncpy(pStr, m_wsBuffer.c_str() + m_iPosition, iMaxLength);
+ m_iPosition += iMaxLength;
+ bEOS = IsEOF();
+ return iMaxLength;
+}
+
+int32_t CFGAS_WideStringReadStream::WriteData(const uint8_t* pBuffer,
+ int32_t iBufferSize) {
+ return 0;
+}
+
+int32_t CFGAS_WideStringReadStream::WriteString(const wchar_t* pStr,
+ int32_t iLength) {
+ return 0;
+}
+
+bool CFGAS_WideStringReadStream::SetLength(int32_t iLength) {
+ return false;
+}
+
+int32_t CFGAS_WideStringReadStream::GetBOMLength() const {
+ return 0;
+}
+
+uint16_t CFGAS_WideStringReadStream::GetCodePage() const {
+ return (sizeof(wchar_t) == 2) ? FX_CODEPAGE_UTF16LE : FX_CODEPAGE_UTF32LE;
+}
+
+uint16_t CFGAS_WideStringReadStream::SetCodePage(uint16_t wCodePage) {
+ return GetCodePage();
+}
+
+} // namespace
+
+// static
+CFX_RetainPtr<IFGAS_Stream> IFGAS_Stream::CreateReadStream(
+ const CFX_RetainPtr<IFX_SeekableReadStream>& pFileRead) {
+ if (!pFileRead)
+ return nullptr;
+
+ std::unique_ptr<IFGAS_StreamImp> pImp =
+ pdfium::MakeUnique<CFGAS_FileReadStreamImp>();
+ if (!static_cast<CFGAS_FileReadStreamImp*>(pImp.get())
+ ->LoadFileRead(pFileRead)) {
+ return nullptr;
+ }
+ return pdfium::MakeRetain<CFGAS_TextStream>(std::move(pImp), false);
+}
+
+// static
+CFX_RetainPtr<IFGAS_Stream> IFGAS_Stream::CreateWriteStream(
+ const CFX_RetainPtr<IFX_SeekableWriteStream>& pFileWrite) {
+ if (!pFileWrite)
+ return nullptr;
+
+ std::unique_ptr<IFGAS_StreamImp> pImp =
+ pdfium::MakeUnique<CFGAS_FileWriteStreamImp>();
+ if (!static_cast<CFGAS_FileWriteStreamImp*>(pImp.get())
+ ->LoadFileWrite(pFileWrite)) {
+ return nullptr;
+ }
+ return pdfium::MakeRetain<CFGAS_TextStream>(std::move(pImp), true);
+}
+
+// static
+CFX_RetainPtr<IFGAS_Stream> IFGAS_Stream::CreateWideStringReadStream(
+ const CFX_WideString& buffer) {
+ return pdfium::MakeRetain<CFGAS_WideStringReadStream>(buffer);
+}
diff --git a/chromium/third_party/pdfium/xfa/fgas/crt/ifgas_stream.h b/chromium/third_party/pdfium/xfa/fgas/crt/ifgas_stream.h
new file mode 100644
index 00000000000..b3f8a928d8e
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fgas/crt/ifgas_stream.h
@@ -0,0 +1,44 @@
+// 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 XFA_FGAS_CRT_IFGAS_STREAM_H_
+#define XFA_FGAS_CRT_IFGAS_STREAM_H_
+
+#include "core/fxcrt/cfx_retain_ptr.h"
+#include "core/fxcrt/fx_stream.h"
+#include "core/fxcrt/fx_system.h"
+
+enum FX_STREAMSEEK {
+ FX_STREAMSEEK_Begin = 0,
+ FX_STREAMSEEK_Current,
+ FX_STREAMSEEK_End,
+};
+
+class IFGAS_Stream : public CFX_Retainable {
+ public:
+ static CFX_RetainPtr<IFGAS_Stream> CreateReadStream(
+ const CFX_RetainPtr<IFX_SeekableReadStream>& pFileRead);
+ static CFX_RetainPtr<IFGAS_Stream> CreateWriteStream(
+ const CFX_RetainPtr<IFX_SeekableWriteStream>& pFileWrite);
+ static CFX_RetainPtr<IFGAS_Stream> CreateWideStringReadStream(
+ const CFX_WideString& buffer);
+
+ virtual int32_t GetLength() const = 0;
+ virtual int32_t Seek(FX_STREAMSEEK eSeek, int32_t iOffset) = 0;
+ virtual int32_t GetPosition() = 0;
+ virtual bool IsEOF() const = 0;
+ virtual int32_t ReadData(uint8_t* pBuffer, int32_t iBufferSize) = 0;
+ virtual int32_t ReadString(wchar_t* pStr, int32_t iMaxLength, bool& bEOS) = 0;
+ virtual int32_t WriteData(const uint8_t* pBuffer, int32_t iBufferSize) = 0;
+ virtual int32_t WriteString(const wchar_t* pStr, int32_t iLength) = 0;
+ virtual void Flush() = 0;
+ virtual bool SetLength(int32_t iLength) = 0;
+ virtual int32_t GetBOMLength() const = 0;
+ virtual uint16_t GetCodePage() const = 0;
+ virtual uint16_t SetCodePage(uint16_t wCodePage) = 0;
+};
+
+#endif // XFA_FGAS_CRT_IFGAS_STREAM_H_
diff --git a/chromium/third_party/pdfium/xfa/fgas/font/DEPS b/chromium/third_party/pdfium/xfa/fgas/font/DEPS
deleted file mode 100644
index 2930dd036a4..00000000000
--- a/chromium/third_party/pdfium/xfa/fgas/font/DEPS
+++ /dev/null
@@ -1,3 +0,0 @@
-include_rules = [
- '+third_party/freetype/include',
-]
diff --git a/chromium/third_party/pdfium/xfa/fgas/font/cfgas_fontmgr.cpp b/chromium/third_party/pdfium/xfa/fgas/font/cfgas_fontmgr.cpp
index aa41318f5d2..766422e381c 100644
--- a/chromium/third_party/pdfium/xfa/fgas/font/cfgas_fontmgr.cpp
+++ b/chromium/third_party/pdfium/xfa/fgas/font/cfgas_fontmgr.cpp
@@ -95,6 +95,36 @@ const FX_FONTDESCRIPTOR* MatchDefaultFont(
return iBestSimilar < 1 ? nullptr : pBestFont;
}
+uint32_t GetFontHashCode(uint16_t wCodePage, uint32_t dwFontStyles) {
+ uint32_t dwHash = wCodePage;
+ if (dwFontStyles & FX_FONTSTYLE_FixedPitch)
+ dwHash |= 0x00010000;
+ if (dwFontStyles & FX_FONTSTYLE_Serif)
+ dwHash |= 0x00020000;
+ if (dwFontStyles & FX_FONTSTYLE_Symbolic)
+ dwHash |= 0x00040000;
+ if (dwFontStyles & FX_FONTSTYLE_Script)
+ dwHash |= 0x00080000;
+ if (dwFontStyles & FX_FONTSTYLE_Italic)
+ dwHash |= 0x00100000;
+ if (dwFontStyles & FX_FONTSTYLE_Bold)
+ dwHash |= 0x00200000;
+ return dwHash;
+}
+
+uint32_t GetFontFamilyHash(const wchar_t* pszFontFamily,
+ uint32_t dwFontStyles,
+ uint16_t wCodePage) {
+ CFX_WideString wsFont(pszFontFamily);
+ if (dwFontStyles & FX_FONTSTYLE_Bold)
+ wsFont += L"Bold";
+ if (dwFontStyles & FX_FONTSTYLE_Italic)
+ wsFont += L"Italic";
+
+ wsFont += wCodePage;
+ return FX_HashCode_GetW(wsFont.AsStringC(), false);
+}
+
} // namespace
std::unique_ptr<CFGAS_FontMgr> CFGAS_FontMgr::Create(
@@ -113,8 +143,8 @@ CFGAS_FontMgr::~CFGAS_FontMgr() {}
CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::GetFontByCodePage(
uint16_t wCodePage,
uint32_t dwFontStyles,
- const FX_WCHAR* pszFontFamily) {
- uint32_t dwHash = FGAS_GetFontHashCode(wCodePage, dwFontStyles);
+ const wchar_t* pszFontFamily) {
+ uint32_t dwHash = GetFontHashCode(wCodePage, dwFontStyles);
auto it = m_CPFonts.find(dwHash);
if (it != m_CPFonts.end()) {
return it->second ? LoadFont(it->second, dwFontStyles, wCodePage) : nullptr;
@@ -135,21 +165,21 @@ CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::GetFontByCodePage(
m_Fonts.push_back(pFont);
m_CPFonts[dwHash] = pFont;
- dwHash = FGAS_GetFontFamilyHash(pFD->wsFontFace, dwFontStyles, wCodePage);
+ dwHash = GetFontFamilyHash(pFD->wsFontFace, dwFontStyles, wCodePage);
m_FamilyFonts[dwHash] = pFont;
return LoadFont(pFont, dwFontStyles, wCodePage);
}
CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::GetFontByUnicode(
- FX_WCHAR wUnicode,
+ wchar_t wUnicode,
uint32_t dwFontStyles,
- const FX_WCHAR* pszFontFamily) {
+ const wchar_t* pszFontFamily) {
const FGAS_FONTUSB* pRet = FGAS_GetUnicodeBitField(wUnicode);
if (pRet->wBitField == 999)
return nullptr;
uint32_t dwHash =
- FGAS_GetFontFamilyHash(pszFontFamily, dwFontStyles, pRet->wBitField);
+ GetFontFamilyHash(pszFontFamily, dwFontStyles, pRet->wBitField);
auto it = m_UnicodeFonts.find(dwHash);
if (it != m_UnicodeFonts.end()) {
return it->second ? LoadFont(it->second, dwFontStyles, pRet->wCodePage)
@@ -166,7 +196,7 @@ CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::GetFontByUnicode(
return nullptr;
uint16_t wCodePage = FX_GetCodePageFromCharset(pFD->uCharSet);
- const FX_WCHAR* pFontFace = pFD->wsFontFace;
+ const wchar_t* pFontFace = pFD->wsFontFace;
CFX_RetainPtr<CFGAS_GEFont> pFont =
CFGAS_GEFont::LoadFont(pFontFace, dwFontStyles, wCodePage, this);
if (!pFont)
@@ -174,19 +204,17 @@ CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::GetFontByUnicode(
m_Fonts.push_back(pFont);
m_UnicodeFonts[dwHash] = pFont;
- m_CPFonts[FGAS_GetFontHashCode(wCodePage, dwFontStyles)] = pFont;
- m_FamilyFonts[FGAS_GetFontFamilyHash(pFontFace, dwFontStyles, wCodePage)] =
- pFont;
+ m_CPFonts[GetFontHashCode(wCodePage, dwFontStyles)] = pFont;
+ m_FamilyFonts[GetFontFamilyHash(pFontFace, dwFontStyles, wCodePage)] = pFont;
return LoadFont(pFont, dwFontStyles, wCodePage);
}
CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::LoadFont(
- const FX_WCHAR* pszFontFamily,
+ const wchar_t* pszFontFamily,
uint32_t dwFontStyles,
uint16_t wCodePage) {
CFX_RetainPtr<CFGAS_GEFont> pFont;
- uint32_t dwHash =
- FGAS_GetFontFamilyHash(pszFontFamily, dwFontStyles, wCodePage);
+ uint32_t dwHash = GetFontFamilyHash(pszFontFamily, dwFontStyles, wCodePage);
auto it = m_FamilyFonts.find(dwHash);
if (it != m_FamilyFonts.end())
return it->second ? LoadFont(it->second, dwFontStyles, wCodePage) : nullptr;
@@ -208,7 +236,7 @@ CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::LoadFont(
m_Fonts.push_back(pFont);
m_FamilyFonts[dwHash] = pFont;
- dwHash = FGAS_GetFontHashCode(wCodePage, dwFontStyles);
+ dwHash = GetFontHashCode(wCodePage, dwFontStyles);
m_CPFonts[dwHash] = pFont;
return LoadFont(pFont, dwFontStyles, wCodePage);
}
@@ -262,14 +290,14 @@ void CFGAS_FontMgr::RemoveFont(const CFX_RetainPtr<CFGAS_GEFont>& pFont) {
m_Fonts.erase(it);
}
-const FX_FONTDESCRIPTOR* CFGAS_FontMgr::FindFont(const FX_WCHAR* pszFontFamily,
+const FX_FONTDESCRIPTOR* CFGAS_FontMgr::FindFont(const wchar_t* pszFontFamily,
uint32_t dwFontStyles,
uint32_t dwMatchFlags,
uint16_t wCodePage,
uint32_t dwUSB,
- FX_WCHAR wUnicode) {
+ wchar_t wUnicode) {
FX_FONTMATCHPARAMS params;
- FXSYS_memset(&params, 0, sizeof(params));
+ memset(&params, 0, sizeof(params));
params.dwUSB = dwUSB;
params.wUnicode = wUnicode;
params.wCodePage = wCodePage;
@@ -322,24 +350,24 @@ static int32_t CALLBACK FX_GdiFontEnumProc(ENUMLOGFONTEX* lpelfe,
if (lf.lfFaceName[0] == L'@')
return 1;
FX_FONTDESCRIPTOR* pFont = FX_Alloc(FX_FONTDESCRIPTOR, 1);
- FXSYS_memset(pFont, 0, sizeof(FX_FONTDESCRIPTOR));
+ memset(pFont, 0, sizeof(FX_FONTDESCRIPTOR));
pFont->uCharSet = lf.lfCharSet;
pFont->dwFontStyles = FX_GetGdiFontStyles(lf);
- FXSYS_wcsncpy(pFont->wsFontFace, (const FX_WCHAR*)lf.lfFaceName, 31);
+ FXSYS_wcsncpy(pFont->wsFontFace, (const wchar_t*)lf.lfFaceName, 31);
pFont->wsFontFace[31] = 0;
- FXSYS_memcpy(&pFont->FontSignature, &lpntme->ntmFontSig,
- sizeof(lpntme->ntmFontSig));
+ memcpy(&pFont->FontSignature, &lpntme->ntmFontSig,
+ sizeof(lpntme->ntmFontSig));
reinterpret_cast<std::deque<FX_FONTDESCRIPTOR>*>(lParam)->push_back(*pFont);
FX_Free(pFont);
return 1;
}
static void FX_EnumGdiFonts(std::deque<FX_FONTDESCRIPTOR>* fonts,
- const FX_WCHAR* pwsFaceName,
- FX_WCHAR wUnicode) {
+ const wchar_t* pwsFaceName,
+ wchar_t wUnicode) {
HDC hDC = ::GetDC(nullptr);
LOGFONTW lfFind;
- FXSYS_memset(&lfFind, 0, sizeof(lfFind));
+ memset(&lfFind, 0, sizeof(lfFind));
lfFind.lfCharSet = DEFAULT_CHARSET;
if (pwsFaceName) {
FXSYS_wcsncpy(lfFind.lfFaceName, pwsFaceName, 31);
@@ -358,7 +386,7 @@ FX_LPEnumAllFonts FX_GetDefFontEnumerator() {
namespace {
-const FX_CHAR* g_FontFolders[] = {
+const char* g_FontFolders[] = {
#if _FXM_PLATFORM_ == _FXM_PLATFORM_LINUX_
"/usr/share/fonts", "/usr/share/X11/fonts/Type1",
"/usr/share/X11/fonts/TTF", "/usr/local/share/fonts",
@@ -369,34 +397,80 @@ const FX_CHAR* g_FontFolders[] = {
#endif
};
-struct FX_BitCodePage {
- uint16_t wBit;
- uint16_t wCodePage;
-};
-
-const FX_BitCodePage g_Bit2CodePage[] = {
- {0, 1252}, {1, 1250}, {2, 1251}, {3, 1253}, {4, 1254}, {5, 1255},
- {6, 1256}, {7, 1257}, {8, 1258}, {9, 0}, {10, 0}, {11, 0},
- {12, 0}, {13, 0}, {14, 0}, {15, 0}, {16, 874}, {17, 932},
- {18, 936}, {19, 949}, {20, 950}, {21, 1361}, {22, 0}, {23, 0},
- {24, 0}, {25, 0}, {26, 0}, {27, 0}, {28, 0}, {29, 0},
- {30, 0}, {31, 0}, {32, 0}, {33, 0}, {34, 0}, {35, 0},
- {36, 0}, {37, 0}, {38, 0}, {39, 0}, {40, 0}, {41, 0},
- {42, 0}, {43, 0}, {44, 0}, {45, 0}, {46, 0}, {47, 0},
- {48, 869}, {49, 866}, {50, 865}, {51, 864}, {52, 863}, {53, 862},
- {54, 861}, {55, 860}, {56, 857}, {57, 855}, {58, 852}, {59, 775},
- {60, 737}, {61, 708}, {62, 850}, {63, 437},
-};
+const uint16_t g_CodePages[] = {FX_CODEPAGE_MSWin_WesternEuropean,
+ FX_CODEPAGE_MSWin_EasternEuropean,
+ FX_CODEPAGE_MSWin_Cyrillic,
+ FX_CODEPAGE_MSWin_Greek,
+ FX_CODEPAGE_MSWin_Turkish,
+ FX_CODEPAGE_MSWin_Hebrew,
+ FX_CODEPAGE_MSWin_Arabic,
+ FX_CODEPAGE_MSWin_Baltic,
+ FX_CODEPAGE_MSWin_Vietnamese,
+ FX_CODEPAGE_DefANSI,
+ FX_CODEPAGE_DefANSI,
+ FX_CODEPAGE_DefANSI,
+ FX_CODEPAGE_DefANSI,
+ FX_CODEPAGE_DefANSI,
+ FX_CODEPAGE_DefANSI,
+ FX_CODEPAGE_DefANSI,
+ FX_CODEPAGE_MSDOS_Thai,
+ FX_CODEPAGE_ShiftJIS,
+ FX_CODEPAGE_ChineseSimplified,
+ FX_CODEPAGE_Korean,
+ FX_CODEPAGE_ChineseTraditional,
+ FX_CODEPAGE_Johab,
+ FX_CODEPAGE_DefANSI,
+ FX_CODEPAGE_DefANSI,
+ FX_CODEPAGE_DefANSI,
+ FX_CODEPAGE_DefANSI,
+ FX_CODEPAGE_DefANSI,
+ FX_CODEPAGE_DefANSI,
+ FX_CODEPAGE_DefANSI,
+ FX_CODEPAGE_DefANSI,
+ FX_CODEPAGE_DefANSI,
+ FX_CODEPAGE_DefANSI,
+ FX_CODEPAGE_DefANSI,
+ FX_CODEPAGE_DefANSI,
+ FX_CODEPAGE_DefANSI,
+ FX_CODEPAGE_DefANSI,
+ FX_CODEPAGE_DefANSI,
+ FX_CODEPAGE_DefANSI,
+ FX_CODEPAGE_DefANSI,
+ FX_CODEPAGE_DefANSI,
+ FX_CODEPAGE_DefANSI,
+ FX_CODEPAGE_DefANSI,
+ FX_CODEPAGE_DefANSI,
+ FX_CODEPAGE_DefANSI,
+ FX_CODEPAGE_DefANSI,
+ FX_CODEPAGE_DefANSI,
+ FX_CODEPAGE_DefANSI,
+ FX_CODEPAGE_DefANSI,
+ FX_CODEPAGE_MSDOS_Greek2,
+ FX_CODEPAGE_MSDOS_Russian,
+ FX_CODEPAGE_MSDOS_Norwegian,
+ FX_CODEPAGE_MSDOS_Arabic,
+ FX_CODEPAGE_MSDOS_FrenchCanadian,
+ FX_CODEPAGE_MSDOS_Hebrew,
+ FX_CODEPAGE_MSDOS_Icelandic,
+ FX_CODEPAGE_MSDOS_Portuguese,
+ FX_CODEPAGE_MSDOS_Turkish,
+ FX_CODEPAGE_MSDOS_Cyrillic,
+ FX_CODEPAGE_MSDOS_EasternEuropean,
+ FX_CODEPAGE_MSDOS_Baltic,
+ FX_CODEPAGE_MSDOS_Greek1,
+ FX_CODEPAGE_Arabic_ASMO708,
+ FX_CODEPAGE_MSDOS_WesternEuropean,
+ FX_CODEPAGE_MSDOS_US};
uint16_t FX_GetCodePageBit(uint16_t wCodePage) {
- for (size_t i = 0; i < FX_ArraySize(g_Bit2CodePage); ++i) {
- if (g_Bit2CodePage[i].wCodePage == wCodePage)
- return g_Bit2CodePage[i].wBit;
+ for (size_t i = 0; i < FX_ArraySize(g_CodePages); ++i) {
+ if (g_CodePages[i] == wCodePage)
+ return static_cast<uint16_t>(i);
}
return static_cast<uint16_t>(-1);
}
-uint16_t FX_GetUnicodeBit(FX_WCHAR wcUnicode) {
+uint16_t FX_GetUnicodeBit(wchar_t wcUnicode) {
const FGAS_FONTUSB* x = FGAS_GetUnicodeBitField(wcUnicode);
return x ? x->wBitField : 999;
}
@@ -542,19 +616,18 @@ CFX_ByteString CFX_FontSourceEnum_File::GetNextFile() {
return bsName;
}
-FX_POSITION CFX_FontSourceEnum_File::GetStartPosition() {
+bool CFX_FontSourceEnum_File::HasStartPosition() {
m_wsNext = GetNextFile().UTF8Decode();
- if (m_wsNext.GetLength() == 0)
- return (FX_POSITION)0;
- return (FX_POSITION)-1;
+ return m_wsNext.GetLength() != 0;
}
-CFX_RetainPtr<IFX_FileAccess> CFX_FontSourceEnum_File::GetNext(
- FX_POSITION& pos) {
+CFX_RetainPtr<IFX_FileAccess> CFX_FontSourceEnum_File::GetNext() {
+ if (m_wsNext.GetLength() == 0)
+ return nullptr;
+
CFX_RetainPtr<IFX_FileAccess> pAccess =
IFX_FileAccess::CreateDefault(m_wsNext.AsStringC());
m_wsNext = GetNextFile().UTF8Decode();
- pos = m_wsNext.GetLength() != 0 ? pAccess.Get() : nullptr;
return pAccess;
}
@@ -600,9 +673,10 @@ bool CFGAS_FontMgr::EnumFontsFromFontMapper() {
bool CFGAS_FontMgr::EnumFontsFromFiles() {
CFX_GEModule::Get()->GetFontMgr()->InitFTLibrary();
- FX_POSITION pos = m_pFontSource->GetStartPosition();
- while (pos) {
- CFX_RetainPtr<IFX_FileAccess> pFontSource = m_pFontSource->GetNext(pos);
+ if (!m_pFontSource->HasStartPosition())
+ return !m_InstalledFonts.empty();
+
+ while (CFX_RetainPtr<IFX_FileAccess> pFontSource = m_pFontSource->GetNext()) {
CFX_RetainPtr<IFX_SeekableReadStream> pFontStream =
pFontSource->CreateFileStream(FX_FILEMODE_ReadOnly);
if (pFontStream)
@@ -616,7 +690,7 @@ bool CFGAS_FontMgr::EnumFonts() {
}
CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::LoadFont(
- const FX_WCHAR* pszFontFamily,
+ const wchar_t* pszFontFamily,
uint32_t dwFontStyles,
uint16_t wCodePage) {
return GetFontByCodePage(wCodePage, dwFontStyles, pszFontFamily);
@@ -625,7 +699,7 @@ CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::LoadFont(
CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::GetFontByCodePage(
uint16_t wCodePage,
uint32_t dwFontStyles,
- const FX_WCHAR* pszFontFamily) {
+ const wchar_t* pszFontFamily) {
CFX_ByteString bsHash;
bsHash.Format("%d, %d", wCodePage, dwFontStyles);
bsHash += FX_UTF8Encode(CFX_WideStringC(pszFontFamily));
@@ -658,9 +732,9 @@ CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::GetFontByCodePage(
}
CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::GetFontByUnicode(
- FX_WCHAR wUnicode,
+ wchar_t wUnicode,
uint32_t dwFontStyles,
- const FX_WCHAR* pszFontFamily) {
+ const wchar_t* pszFontFamily) {
if (pdfium::ContainsKey(m_FailedUnicodesSet, wUnicode))
return nullptr;
@@ -706,7 +780,7 @@ CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::GetFontByUnicode(
}
bool CFGAS_FontMgr::VerifyUnicode(CFX_FontDescriptor* pDesc,
- FX_WCHAR wcUnicode) {
+ wchar_t wcUnicode) {
CFX_RetainPtr<IFX_SeekableReadStream> pFileRead =
CreateFontStream(pDesc->m_wsFaceName.UTF8Encode());
if (!pFileRead)
@@ -726,7 +800,7 @@ bool CFGAS_FontMgr::VerifyUnicode(CFX_FontDescriptor* pDesc,
}
bool CFGAS_FontMgr::VerifyUnicode(const CFX_RetainPtr<CFGAS_GEFont>& pFont,
- FX_WCHAR wcUnicode) {
+ wchar_t wcUnicode) {
if (!pFont)
return false;
@@ -810,7 +884,7 @@ FXFT_Face CFGAS_FontMgr::LoadFace(
return nullptr;
FXFT_Stream ftStream = FX_Alloc(FXFT_StreamRec, 1);
- FXSYS_memset(ftStream, 0, sizeof(FXFT_StreamRec));
+ memset(ftStream, 0, sizeof(FXFT_StreamRec));
ftStream->base = nullptr;
ftStream->descriptor.pointer = static_cast<void*>(pFontStream.Get());
ftStream->pos = 0;
@@ -819,7 +893,7 @@ FXFT_Face CFGAS_FontMgr::LoadFace(
ftStream->close = _ftStreamClose;
FXFT_Open_Args ftArgs;
- FXSYS_memset(&ftArgs, 0, sizeof(FXFT_Open_Args));
+ memset(&ftArgs, 0, sizeof(FXFT_Open_Args));
ftArgs.flags |= FT_OPEN_STREAM;
ftArgs.stream = ftStream;
@@ -878,7 +952,7 @@ void CFGAS_FontMgr::MatchFonts(
uint16_t wCodePage,
uint32_t dwFontStyles,
const CFX_WideString& FontName,
- FX_WCHAR wcUnicode) {
+ wchar_t wcUnicode) {
pMatchedFonts->clear();
for (const auto& pFont : m_InstalledFonts) {
int32_t nPenalty =
@@ -896,7 +970,7 @@ int32_t CFGAS_FontMgr::CalcPenalty(CFX_FontDescriptor* pInstalled,
uint16_t wCodePage,
uint32_t dwFontStyles,
const CFX_WideString& FontName,
- FX_WCHAR wcUnicode) {
+ wchar_t wcUnicode) {
int32_t nPenalty = 30000;
if (FontName.GetLength() != 0) {
if (FontName != pInstalled->m_wsFaceName) {
@@ -941,7 +1015,7 @@ int32_t CFGAS_FontMgr::CalcPenalty(CFX_FontDescriptor* pInstalled,
if (nPenalty >= 0xFFFF)
return 0xFFFF;
- uint16_t wBit = (wCodePage == 0 || wCodePage == 0xFFFF)
+ uint16_t wBit = (wCodePage == FX_CODEPAGE_DefANSI || wCodePage == 0xFFFF)
? static_cast<uint16_t>(-1)
: FX_GetCodePageBit(wCodePage);
if (wBit != static_cast<uint16_t>(-1)) {
@@ -1077,14 +1151,14 @@ void CFGAS_FontMgr::GetNames(const uint8_t* name_table,
wsFamily.clear();
if (nPlatformID != 1) {
for (uint16_t k = 0; k < nNameLength / 2; k++) {
- FX_WCHAR wcTemp = GetUInt16(lpStr + nNameOffset + k * 2);
+ wchar_t wcTemp = GetUInt16(lpStr + nNameOffset + k * 2);
wsFamily += wcTemp;
}
Names.push_back(wsFamily);
continue;
}
for (uint16_t k = 0; k < nNameLength; k++) {
- FX_WCHAR wcTemp = GetUInt8(lpStr + nNameOffset + k);
+ wchar_t wcTemp = GetUInt8(lpStr + nNameOffset + k);
wsFamily += wcTemp;
}
Names.push_back(wsFamily);
diff --git a/chromium/third_party/pdfium/xfa/fgas/font/cfgas_fontmgr.h b/chromium/third_party/pdfium/xfa/fgas/font/cfgas_fontmgr.h
index dffdb8a665b..c0b59f4dd72 100644
--- a/chromium/third_party/pdfium/xfa/fgas/font/cfgas_fontmgr.h
+++ b/chromium/third_party/pdfium/xfa/fgas/font/cfgas_fontmgr.h
@@ -18,12 +18,7 @@
#include "core/fxge/cfx_fontmapper.h"
#include "core/fxge/fx_freetype.h"
#include "core/fxge/ifx_systemfontinfo.h"
-#include "third_party/freetype/include/freetype/fttypes.h"
-#include "xfa/fgas/crt/fgas_stream.h"
-
-#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
-#include "xfa/fgas/crt/fgas_utils.h"
-#endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
+#include "xfa/fgas/crt/ifgas_stream.h"
#define FX_FONTSTYLE_Normal 0x00
#define FX_FONTSTYLE_FixedPitch 0x01
@@ -44,11 +39,11 @@ class CFGAS_GEFont;
#define FX_FONTMATCHPARA_MatchStyle 0x01
struct FX_FONTMATCHPARAMS {
- const FX_WCHAR* pwsFamily;
+ const wchar_t* pwsFamily;
uint32_t dwFontStyles;
uint32_t dwUSB;
uint32_t dwMatchFlags;
- FX_WCHAR wUnicode;
+ wchar_t wUnicode;
uint16_t wCodePage;
};
@@ -65,7 +60,7 @@ inline bool operator==(const FX_FONTSIGNATURE& left,
}
struct FX_FONTDESCRIPTOR {
- FX_WCHAR wsFontFace[32];
+ wchar_t wsFontFace[32];
uint32_t dwFontStyles;
uint8_t uCharSet;
FX_FONTSIGNATURE FontSignature;
@@ -76,12 +71,12 @@ inline bool operator==(const FX_FONTDESCRIPTOR& left,
return left.uCharSet == right.uCharSet &&
left.dwFontStyles == right.dwFontStyles &&
left.FontSignature == right.FontSignature &&
- FXSYS_wcscmp(left.wsFontFace, right.wsFontFace) == 0;
+ wcscmp(left.wsFontFace, right.wsFontFace) == 0;
}
typedef void (*FX_LPEnumAllFonts)(std::deque<FX_FONTDESCRIPTOR>* fonts,
- const FX_WCHAR* pwsFaceName,
- FX_WCHAR wUnicode);
+ const wchar_t* pwsFaceName,
+ wchar_t wUnicode);
FX_LPEnumAllFonts FX_GetDefFontEnumerator();
@@ -94,11 +89,11 @@ class CFGAS_FontMgr {
CFX_RetainPtr<CFGAS_GEFont> GetFontByCodePage(uint16_t wCodePage,
uint32_t dwFontStyles,
- const FX_WCHAR* pszFontFamily);
- CFX_RetainPtr<CFGAS_GEFont> GetFontByUnicode(FX_WCHAR wUnicode,
+ const wchar_t* pszFontFamily);
+ CFX_RetainPtr<CFGAS_GEFont> GetFontByUnicode(wchar_t wUnicode,
uint32_t dwFontStyles,
- const FX_WCHAR* pszFontFamily);
- CFX_RetainPtr<CFGAS_GEFont> LoadFont(const FX_WCHAR* pszFontFamily,
+ const wchar_t* pszFontFamily);
+ CFX_RetainPtr<CFGAS_GEFont> LoadFont(const wchar_t* pszFontFamily,
uint32_t dwFontStyles,
uint16_t wCodePage);
void RemoveFont(const CFX_RetainPtr<CFGAS_GEFont>& pFont);
@@ -110,12 +105,12 @@ class CFGAS_FontMgr {
uint16_t wCodePage);
void RemoveFont(std::map<uint32_t, CFX_RetainPtr<CFGAS_GEFont>>* pFontMap,
const CFX_RetainPtr<CFGAS_GEFont>& pFont);
- const FX_FONTDESCRIPTOR* FindFont(const FX_WCHAR* pszFontFamily,
+ const FX_FONTDESCRIPTOR* FindFont(const wchar_t* pszFontFamily,
uint32_t dwFontStyles,
uint32_t dwMatchFlags,
uint16_t wCodePage,
uint32_t dwUSB = 999,
- FX_WCHAR wUnicode = 0);
+ wchar_t wUnicode = 0);
FX_LPEnumAllFonts m_pEnumerator;
std::deque<FX_FONTDESCRIPTOR> m_FontFaces;
@@ -173,8 +168,8 @@ class CFX_FontSourceEnum_File {
CFX_FontSourceEnum_File();
~CFX_FontSourceEnum_File();
- FX_POSITION GetStartPosition();
- CFX_RetainPtr<IFX_FileAccess> GetNext(FX_POSITION& pos);
+ bool HasStartPosition();
+ CFX_RetainPtr<IFX_FileAccess> GetNext();
private:
CFX_ByteString GetNextFile();
@@ -194,11 +189,11 @@ class CFGAS_FontMgr {
CFX_RetainPtr<CFGAS_GEFont> GetFontByCodePage(uint16_t wCodePage,
uint32_t dwFontStyles,
- const FX_WCHAR* pszFontFamily);
- CFX_RetainPtr<CFGAS_GEFont> GetFontByUnicode(FX_WCHAR wUnicode,
+ const wchar_t* pszFontFamily);
+ CFX_RetainPtr<CFGAS_GEFont> GetFontByUnicode(wchar_t wUnicode,
uint32_t dwFontStyles,
- const FX_WCHAR* pszFontFamily);
- CFX_RetainPtr<CFGAS_GEFont> LoadFont(const FX_WCHAR* pszFontFamily,
+ const wchar_t* pszFontFamily);
+ CFX_RetainPtr<CFGAS_GEFont> LoadFont(const wchar_t* pszFontFamily,
uint32_t dwFontStyles,
uint16_t wCodePage);
void RemoveFont(const CFX_RetainPtr<CFGAS_GEFont>& pFont);
@@ -214,20 +209,20 @@ class CFGAS_FontMgr {
std::vector<uint16_t> GetCharsets(FXFT_Face pFace) const;
void GetUSBCSB(FXFT_Face pFace, uint32_t* USB, uint32_t* CSB);
uint32_t GetFlags(FXFT_Face pFace);
- bool VerifyUnicode(CFX_FontDescriptor* pDesc, FX_WCHAR wcUnicode);
+ bool VerifyUnicode(CFX_FontDescriptor* pDesc, wchar_t wcUnicode);
bool VerifyUnicode(const CFX_RetainPtr<CFGAS_GEFont>& pFont,
- FX_WCHAR wcUnicode);
+ wchar_t wcUnicode);
int32_t IsPartName(const CFX_WideString& Name1, const CFX_WideString& Name2);
void MatchFonts(std::vector<CFX_FontDescriptorInfo>* MatchedFonts,
uint16_t wCodePage,
uint32_t dwFontStyles,
const CFX_WideString& FontName,
- FX_WCHAR wcUnicode = 0xFFFE);
+ wchar_t wcUnicode = 0xFFFE);
int32_t CalcPenalty(CFX_FontDescriptor* pInstalled,
uint16_t wCodePage,
uint32_t dwFontStyles,
const CFX_WideString& FontName,
- FX_WCHAR wcUnicode = 0xFFFE);
+ wchar_t wcUnicode = 0xFFFE);
CFX_RetainPtr<CFGAS_GEFont> LoadFont(const CFX_WideString& wsFaceName,
int32_t iFaceIndex,
int32_t* pFaceCount);
@@ -247,7 +242,7 @@ class CFGAS_FontMgr {
std::map<uint32_t, std::vector<CFX_RetainPtr<CFGAS_GEFont>>> m_Hash2Fonts;
std::map<CFX_RetainPtr<CFGAS_GEFont>, CFX_RetainPtr<IFX_SeekableReadStream>>
m_IFXFont2FileRead;
- std::set<FX_WCHAR> m_FailedUnicodesSet;
+ std::set<wchar_t> m_FailedUnicodesSet;
};
#endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
diff --git a/chromium/third_party/pdfium/xfa/fgas/font/cfgas_gefont.cpp b/chromium/third_party/pdfium/xfa/fgas/font/cfgas_gefont.cpp
index a57962d084b..fdeb2ce533c 100644
--- a/chromium/third_party/pdfium/xfa/fgas/font/cfgas_gefont.cpp
+++ b/chromium/third_party/pdfium/xfa/fgas/font/cfgas_gefont.cpp
@@ -15,14 +15,13 @@
#include "third_party/base/ptr_util.h"
#include "xfa/fgas/crt/fgas_codepage.h"
#include "xfa/fgas/font/fgas_fontutils.h"
-#include "xfa/fxfa/xfa_fontmgr.h"
+#include "xfa/fxfa/cxfa_fontmgr.h"
// static
-CFX_RetainPtr<CFGAS_GEFont> CFGAS_GEFont::LoadFont(
- const FX_WCHAR* pszFontFamily,
- uint32_t dwFontStyles,
- uint16_t wCodePage,
- CFGAS_FontMgr* pFontMgr) {
+CFX_RetainPtr<CFGAS_GEFont> CFGAS_GEFont::LoadFont(const wchar_t* pszFontFamily,
+ uint32_t dwFontStyles,
+ uint16_t wCodePage,
+ CFGAS_FontMgr* pFontMgr) {
#if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
if (!pFontMgr)
return nullptr;
@@ -55,29 +54,6 @@ CFX_RetainPtr<CFGAS_GEFont> CFGAS_GEFont::LoadFont(
return pFont;
}
-#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
-// static
-CFX_RetainPtr<CFGAS_GEFont> CFGAS_GEFont::LoadFont(const uint8_t* pBuffer,
- int32_t iLength,
- CFGAS_FontMgr* pFontMgr) {
- auto pFont = pdfium::MakeRetain<CFGAS_GEFont>(pFontMgr);
- if (pFont->LoadFontInternal(pBuffer, iLength))
- return nullptr;
- return pFont;
-}
-
-// static
-CFX_RetainPtr<CFGAS_GEFont> CFGAS_GEFont::LoadFont(
- const CFX_RetainPtr<IFGAS_Stream>& pFontStream,
- CFGAS_FontMgr* pFontMgr,
- bool bSaveStream) {
- auto pFont = pdfium::MakeRetain<CFGAS_GEFont>(pFontMgr);
- if (!pFont->LoadFontInternal(pFontStream, bSaveStream))
- return nullptr;
- return pFont;
-}
-#endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
-
CFGAS_GEFont::CFGAS_GEFont(CFGAS_FontMgr* pFontMgr)
:
#if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
@@ -123,7 +99,7 @@ CFGAS_GEFont::~CFGAS_GEFont() {
}
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
-bool CFGAS_GEFont::LoadFontInternal(const FX_WCHAR* pszFontFamily,
+bool CFGAS_GEFont::LoadFontInternal(const wchar_t* pszFontFamily,
uint32_t dwFontStyles,
uint16_t wCodePage) {
if (m_pFont)
@@ -160,33 +136,6 @@ bool CFGAS_GEFont::LoadFontInternal(const FX_WCHAR* pszFontFamily,
return false;
return InitFont();
}
-
-bool CFGAS_GEFont::LoadFontInternal(const uint8_t* pBuffer, int32_t length) {
- if (m_pFont)
- return false;
-
- m_pFont = new CFX_Font;
- if (!m_pFont->LoadEmbedded(pBuffer, length))
- return false;
- return InitFont();
-}
-
-bool CFGAS_GEFont::LoadFontInternal(
- const CFX_RetainPtr<IFGAS_Stream>& pFontStream,
- bool bSaveStream) {
- if (m_pFont || m_pFileRead || !pFontStream || pFontStream->GetLength() < 1)
- return false;
- if (bSaveStream)
- m_pStream = pFontStream;
-
- m_pFileRead = pFontStream->MakeSeekableReadStream();
- m_pFont = new CFX_Font;
- if (!m_pFont->LoadFile(m_pFileRead)) {
- m_pFileRead.Reset();
- return false;
- }
- return InitFont();
-}
#endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
bool CFGAS_GEFont::LoadFontInternal(CFX_Font* pExternalFont) {
@@ -216,10 +165,6 @@ bool CFGAS_GEFont::InitFont() {
if (!m_pFontEncoding)
return false;
}
- if (!m_pCharWidthMap) {
- m_pCharWidthMap =
- pdfium::MakeUnique<CFX_DiscreteArrayTemplate<uint16_t>>(1024);
- }
return true;
}
@@ -263,18 +208,18 @@ uint32_t CFGAS_GEFont::GetFontStyles() const {
return dwStyles;
}
-bool CFGAS_GEFont::GetCharWidth(FX_WCHAR wUnicode,
+bool CFGAS_GEFont::GetCharWidth(wchar_t wUnicode,
int32_t& iWidth,
bool bCharCode) {
return GetCharWidthInternal(wUnicode, iWidth, true, bCharCode);
}
-bool CFGAS_GEFont::GetCharWidthInternal(FX_WCHAR wUnicode,
+bool CFGAS_GEFont::GetCharWidthInternal(wchar_t wUnicode,
int32_t& iWidth,
bool bRecursive,
bool bCharCode) {
- ASSERT(m_pCharWidthMap);
- iWidth = m_pCharWidthMap->GetAt(wUnicode, 0);
+ auto it = m_CharWidthMap.find(wUnicode);
+ iWidth = it != m_CharWidthMap.end() ? it->second : 0;
if (iWidth == 65535)
return false;
@@ -299,17 +244,17 @@ bool CFGAS_GEFont::GetCharWidthInternal(FX_WCHAR wUnicode,
iWidth = -1;
}
}
- m_pCharWidthMap->SetAtGrow(wUnicode, iWidth);
+ m_CharWidthMap[wUnicode] = iWidth;
return iWidth > 0;
}
-bool CFGAS_GEFont::GetCharBBox(FX_WCHAR wUnicode,
+bool CFGAS_GEFont::GetCharBBox(wchar_t wUnicode,
CFX_Rect* bbox,
bool bCharCode) {
return GetCharBBoxInternal(wUnicode, bbox, true, bCharCode);
}
-bool CFGAS_GEFont::GetCharBBoxInternal(FX_WCHAR wUnicode,
+bool CFGAS_GEFont::GetCharBBoxInternal(wchar_t wUnicode,
CFX_Rect* bbox,
bool bRecursive,
bool bCharCode) {
@@ -349,11 +294,11 @@ bool CFGAS_GEFont::GetBBox(CFX_Rect* bbox) {
return true;
}
-int32_t CFGAS_GEFont::GetGlyphIndex(FX_WCHAR wUnicode, bool bCharCode) {
+int32_t CFGAS_GEFont::GetGlyphIndex(wchar_t wUnicode, bool bCharCode) {
return GetGlyphIndex(wUnicode, true, nullptr, bCharCode);
}
-int32_t CFGAS_GEFont::GetGlyphIndex(FX_WCHAR wUnicode,
+int32_t CFGAS_GEFont::GetGlyphIndex(wchar_t wUnicode,
bool bRecursive,
CFX_RetainPtr<CFGAS_GEFont>* ppFont,
bool bCharCode) {
diff --git a/chromium/third_party/pdfium/xfa/fgas/font/cfgas_gefont.h b/chromium/third_party/pdfium/xfa/fgas/font/cfgas_gefont.h
index 2201721a934..14029be1e08 100644
--- a/chromium/third_party/pdfium/xfa/fgas/font/cfgas_gefont.h
+++ b/chromium/third_party/pdfium/xfa/fgas/font/cfgas_gefont.h
@@ -13,7 +13,6 @@
#include "core/fxcrt/cfx_retain_ptr.h"
#include "core/fxcrt/fx_memory.h"
-#include "xfa/fgas/crt/fgas_utils.h"
#include "xfa/fgas/font/cfgas_fontmgr.h"
#define FXFONT_SUBST_ITALIC 0x02
@@ -29,7 +28,7 @@ class CFGAS_GEFont : public CFX_Retainable {
template <typename T, typename... Args>
friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args);
- static CFX_RetainPtr<CFGAS_GEFont> LoadFont(const FX_WCHAR* pszFontFamily,
+ static CFX_RetainPtr<CFGAS_GEFont> LoadFont(const wchar_t* pszFontFamily,
uint32_t dwFontStyles,
uint16_t wCodePage,
CFGAS_FontMgr* pFontMgr);
@@ -38,24 +37,15 @@ class CFGAS_GEFont : public CFX_Retainable {
static CFX_RetainPtr<CFGAS_GEFont> LoadFont(
std::unique_ptr<CFX_Font> pInternalFont,
CFGAS_FontMgr* pFontMgr);
-#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
- static CFX_RetainPtr<CFGAS_GEFont> LoadFont(const uint8_t* pBuffer,
- int32_t iLength,
- CFGAS_FontMgr* pFontMgr);
- static CFX_RetainPtr<CFGAS_GEFont> LoadFont(
- const CFX_RetainPtr<IFGAS_Stream>& pFontStream,
- CFGAS_FontMgr* pFontMgr,
- bool bSaveStream);
-#endif
CFX_RetainPtr<CFGAS_GEFont> Derive(uint32_t dwFontStyles,
uint16_t wCodePage = 0);
uint32_t GetFontStyles() const;
- bool GetCharWidth(FX_WCHAR wUnicode, int32_t& iWidth, bool bCharCode);
- int32_t GetGlyphIndex(FX_WCHAR wUnicode, bool bCharCode = false);
+ bool GetCharWidth(wchar_t wUnicode, int32_t& iWidth, bool bCharCode);
+ int32_t GetGlyphIndex(wchar_t wUnicode, bool bCharCode = false);
int32_t GetAscent() const;
int32_t GetDescent() const;
- bool GetCharBBox(FX_WCHAR wUnicode, CFX_Rect* bbox, bool bCharCode = false);
+ bool GetCharBBox(wchar_t wUnicode, CFX_Rect* bbox, bool bCharCode = false);
bool GetBBox(CFX_Rect* bbox);
CFX_RetainPtr<CFGAS_GEFont> GetSubstFont(int32_t iGlyphIndex);
CFX_Font* GetDevFont() const { return m_pFont; }
@@ -73,7 +63,7 @@ class CFGAS_GEFont : public CFX_Retainable {
~CFGAS_GEFont() override;
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
- bool LoadFontInternal(const FX_WCHAR* pszFontFamily,
+ bool LoadFontInternal(const wchar_t* pszFontFamily,
uint32_t dwFontStyles,
uint16_t wCodePage);
bool LoadFontInternal(const uint8_t* pBuffer, int32_t length);
@@ -83,15 +73,15 @@ class CFGAS_GEFont : public CFX_Retainable {
bool LoadFontInternal(CFX_Font* pExternalFont);
bool LoadFontInternal(std::unique_ptr<CFX_Font> pInternalFont);
bool InitFont();
- bool GetCharBBoxInternal(FX_WCHAR wUnicode,
+ bool GetCharBBoxInternal(wchar_t wUnicode,
CFX_Rect* bbox,
bool bRecursive,
bool bCharCode = false);
- bool GetCharWidthInternal(FX_WCHAR wUnicode,
+ bool GetCharWidthInternal(wchar_t wUnicode,
int32_t& iWidth,
bool bRecursive,
bool bCharCode);
- int32_t GetGlyphIndex(FX_WCHAR wUnicode,
+ int32_t GetGlyphIndex(wchar_t wUnicode,
bool bRecursive,
CFX_RetainPtr<CFGAS_GEFont>* ppFont,
bool bCharCode = false);
@@ -108,11 +98,11 @@ class CFGAS_GEFont : public CFX_Retainable {
CFX_RetainPtr<IFGAS_Stream> m_pStream;
CFX_RetainPtr<IFX_SeekableReadStream> m_pFileRead;
std::unique_ptr<CFX_UnicodeEncoding> m_pFontEncoding;
- std::unique_ptr<CFX_DiscreteArrayTemplate<uint16_t>> m_pCharWidthMap;
- std::map<FX_WCHAR, CFX_Rect> m_BBoxMap;
+ std::map<wchar_t, int32_t> m_CharWidthMap;
+ std::map<wchar_t, CFX_Rect> m_BBoxMap;
CXFA_PDFFontMgr* m_pProvider; // not owned.
std::vector<CFX_RetainPtr<CFGAS_GEFont>> m_SubstFonts;
- std::map<FX_WCHAR, CFX_RetainPtr<CFGAS_GEFont>> m_FontMapper;
+ std::map<wchar_t, CFX_RetainPtr<CFGAS_GEFont>> m_FontMapper;
};
#endif // XFA_FGAS_FONT_CFGAS_GEFONT_H_
diff --git a/chromium/third_party/pdfium/xfa/fgas/font/fgas_fontutils.cpp b/chromium/third_party/pdfium/xfa/fgas/font/fgas_fontutils.cpp
index e74056b53ed..4dc599cd4be 100644
--- a/chromium/third_party/pdfium/xfa/fgas/font/fgas_fontutils.cpp
+++ b/chromium/third_party/pdfium/xfa/fgas/font/fgas_fontutils.cpp
@@ -7,147 +7,204 @@
#include "xfa/fgas/font/fgas_fontutils.h"
#include "core/fxcrt/fx_ext.h"
+#include "xfa/fgas/crt/fgas_codepage.h"
#include "xfa/fgas/font/cfgas_fontmgr.h"
-uint32_t FGAS_GetFontHashCode(uint16_t wCodePage, uint32_t dwFontStyles) {
- uint32_t dwHash = wCodePage;
- if (dwFontStyles & FX_FONTSTYLE_FixedPitch) {
- dwHash |= 0x00010000;
- }
- if (dwFontStyles & FX_FONTSTYLE_Serif) {
- dwHash |= 0x00020000;
- }
- if (dwFontStyles & FX_FONTSTYLE_Symbolic) {
- dwHash |= 0x00040000;
- }
- if (dwFontStyles & FX_FONTSTYLE_Script) {
- dwHash |= 0x00080000;
- }
- if (dwFontStyles & FX_FONTSTYLE_Italic) {
- dwHash |= 0x00100000;
- }
- if (dwFontStyles & FX_FONTSTYLE_Bold) {
- dwHash |= 0x00200000;
- }
- return dwHash;
-}
-uint32_t FGAS_GetFontFamilyHash(const FX_WCHAR* pszFontFamily,
- uint32_t dwFontStyles,
- uint16_t wCodePage) {
- CFX_WideString wsFont(pszFontFamily);
- if (dwFontStyles & FX_FONTSTYLE_Bold) {
- wsFont += L"Bold";
- }
- if (dwFontStyles & FX_FONTSTYLE_Italic) {
- wsFont += L"Italic";
- }
- wsFont += wCodePage;
- return FX_HashCode_GetW(wsFont.AsStringC(), false);
-}
-static const FGAS_FONTUSB g_FXGdiFontUSBTable[] = {
- {0x0000, 0x007F, 0, 1252}, {0x0080, 0x00FF, 1, 1252},
- {0x0100, 0x017F, 2, 1250}, {0x0180, 0x024F, 3, 1250},
- {0x0250, 0x02AF, 4, 0xFFFF}, {0x02B0, 0x02FF, 5, 0xFFFF},
- {0x0300, 0x036F, 6, 0xFFFF}, {0x0370, 0x03FF, 7, 1253},
- {0x0400, 0x04FF, 9, 1251}, {0x0500, 0x052F, 9, 0xFFFF},
- {0x0530, 0x058F, 10, 0xFFFF}, {0x0590, 0x05FF, 11, 1255},
- {0x0600, 0x06FF, 13, 1256}, {0x0700, 0x074F, 71, 0xFFFF},
- {0x0750, 0x077F, 13, 0xFFFF}, {0x0780, 0x07BF, 72, 0xFFFF},
- {0x07C0, 0x07FF, 14, 0xFFFF}, {0x0800, 0x08FF, 999, 0xFFFF},
- {0x0900, 0x097F, 15, 0xFFFF}, {0x0980, 0x09FF, 16, 0xFFFF},
- {0x0A00, 0x0A7F, 17, 0xFFFF}, {0x0A80, 0x0AFF, 18, 0xFFFF},
- {0x0B00, 0x0B7F, 19, 0xFFFF}, {0x0B80, 0x0BFF, 20, 0xFFFF},
- {0x0C00, 0x0C7F, 21, 0xFFFF}, {0x0C80, 0x0CFF, 22, 0xFFFF},
- {0x0D00, 0x0D7F, 23, 0xFFFF}, {0x0D80, 0x0DFF, 73, 0xFFFF},
- {0x0E00, 0x0E7F, 24, 874}, {0x0E80, 0x0EFF, 25, 0xFFFF},
- {0x0F00, 0x0FFF, 70, 0xFFFF}, {0x1000, 0x109F, 74, 0xFFFF},
- {0x10A0, 0x10FF, 26, 0xFFFF}, {0x1100, 0x11FF, 28, 0xFFFF},
- {0x1200, 0x137F, 75, 0xFFFF}, {0x1380, 0x139F, 75, 0xFFFF},
- {0x13A0, 0x13FF, 76, 0xFFFF}, {0x1400, 0x167F, 77, 0xFFFF},
- {0x1680, 0x169F, 78, 0xFFFF}, {0x16A0, 0x16FF, 79, 0xFFFF},
- {0x1700, 0x171F, 84, 0xFFFF}, {0x1720, 0x173F, 84, 0xFFFF},
- {0x1740, 0x175F, 84, 0xFFFF}, {0x1760, 0x177F, 84, 0xFFFF},
- {0x1780, 0x17FF, 80, 0xFFFF}, {0x1800, 0x18AF, 81, 0xFFFF},
- {0x18B0, 0x18FF, 999, 0xFFFF}, {0x1900, 0x194F, 93, 0xFFFF},
- {0x1950, 0x197F, 94, 0xFFFF}, {0x1980, 0x19DF, 95, 0xFFFF},
- {0x19E0, 0x19FF, 80, 0xFFFF}, {0x1A00, 0x1A1F, 96, 0xFFFF},
- {0x1A20, 0x1AFF, 999, 0xFFFF}, {0x1B00, 0x1B7F, 27, 0xFFFF},
- {0x1B80, 0x1BBF, 112, 0xFFFF}, {0x1BC0, 0x1BFF, 999, 0xFFFF},
- {0x1C00, 0x1C4F, 113, 0xFFFF}, {0x1C50, 0x1C7F, 114, 0xFFFF},
- {0x1C80, 0x1CFF, 999, 0xFFFF}, {0x1D00, 0x1D7F, 4, 0xFFFF},
- {0x1D80, 0x1DBF, 4, 0xFFFF}, {0x1DC0, 0x1DFF, 6, 0xFFFF},
- {0x1E00, 0x1EFF, 29, 0xFFFF}, {0x1F00, 0x1FFF, 30, 0xFFFF},
- {0x2000, 0x206F, 31, 0xFFFF}, {0x2070, 0x209F, 32, 0xFFFF},
- {0x20A0, 0x20CF, 33, 0xFFFF}, {0x20D0, 0x20FF, 34, 0xFFFF},
- {0x2100, 0x214F, 35, 0xFFFF}, {0x2150, 0x215F, 36, 0xFFFF},
- {0x2160, 0x216B, 36, 936}, {0x216C, 0x216F, 36, 0xFFFF},
- {0x2170, 0x2179, 36, 936}, {0x217A, 0x218F, 36, 0xFFFF},
- {0x2190, 0x2199, 37, 949}, {0x219A, 0x21FF, 37, 0xFFFF},
- {0x2200, 0x22FF, 38, 0xFFFF}, {0x2300, 0x23FF, 39, 0xFFFF},
- {0x2400, 0x243F, 40, 0xFFFF}, {0x2440, 0x245F, 41, 0xFFFF},
- {0x2460, 0x2473, 42, 932}, {0x2474, 0x249B, 42, 936},
- {0x249C, 0x24E9, 42, 949}, {0x24EA, 0x24FF, 42, 0xFFFF},
- {0x2500, 0x2573, 43, 936}, {0x2574, 0x257F, 43, 0xFFFF},
- {0x2580, 0x2580, 44, 0xFFFF}, {0x2581, 0x258F, 44, 936},
- {0x2590, 0x259F, 44, 0xFFFF}, {0x25A0, 0x25FF, 45, 0xFFFF},
- {0x2600, 0x26FF, 46, 0xFFFF}, {0x2700, 0x27BF, 47, 0xFFFF},
- {0x27C0, 0x27EF, 38, 0xFFFF}, {0x27F0, 0x27FF, 37, 0xFFFF},
- {0x2800, 0x28FF, 82, 0xFFFF}, {0x2900, 0x297F, 37, 0xFFFF},
- {0x2980, 0x29FF, 38, 0xFFFF}, {0x2A00, 0x2AFF, 38, 0xFFFF},
- {0x2B00, 0x2BFF, 37, 0xFFFF}, {0x2C00, 0x2C5F, 97, 0xFFFF},
- {0x2C60, 0x2C7F, 29, 0xFFFF}, {0x2C80, 0x2CFF, 8, 0xFFFF},
- {0x2D00, 0x2D2F, 26, 0xFFFF}, {0x2D30, 0x2D7F, 98, 0xFFFF},
- {0x2D80, 0x2DDF, 75, 0xFFFF}, {0x2DE0, 0x2DFF, 9, 0xFFFF},
- {0x2E00, 0x2E7F, 31, 0xFFFF}, {0x2E80, 0x2EFF, 59, 0xFFFF},
- {0x2F00, 0x2FDF, 59, 0xFFFF}, {0x2FE0, 0x2FEF, 999, 0xFFFF},
- {0x2FF0, 0x2FFF, 59, 0xFFFF}, {0x3000, 0x303F, 48, 0xFFFF},
- {0x3040, 0x309F, 49, 932}, {0x30A0, 0x30FF, 50, 932},
- {0x3100, 0x3129, 51, 936}, {0x312A, 0x312F, 51, 0xFFFF},
- {0x3130, 0x318F, 52, 949}, {0x3190, 0x319F, 59, 0xFFFF},
- {0x31A0, 0x31BF, 51, 0xFFFF}, {0x31C0, 0x31EF, 61, 0xFFFF},
- {0x31F0, 0x31FF, 50, 0xFFFF}, {0x3200, 0x321C, 54, 949},
- {0x321D, 0x325F, 54, 0xFFFF}, {0x3260, 0x327F, 54, 949},
- {0x3280, 0x32FF, 54, 0xFFFF}, {0x3300, 0x3387, 55, 0xFFFF},
- {0x3388, 0x33D0, 55, 949}, {0x33D1, 0x33FF, 55, 0xFFFF},
- {0x3400, 0x4DBF, 59, 0xFFFF}, {0x4DC0, 0x4DFF, 99, 0xFFFF},
- {0x4E00, 0x9FA5, 59, 936}, {0x9FA6, 0x9FFF, 59, 0xFFFF},
- {0xA000, 0xA48F, 83, 0xFFFF}, {0xA490, 0xA4CF, 83, 0xFFFF},
- {0xA4D0, 0xA4FF, 999, 0xFFFF}, {0xA500, 0xA63F, 12, 0xFFFF},
- {0xA640, 0xA69F, 9, 0xFFFF}, {0xA6A0, 0xA6FF, 999, 0xFFFF},
- {0xA700, 0xA71F, 5, 0xFFFF}, {0xA720, 0xA7FF, 29, 0xFFFF},
- {0xA800, 0xA82F, 100, 0xFFFF}, {0xA830, 0xA8FF, 999, 0xFFFF},
- {0xA840, 0xA87F, 53, 0xFFFF}, {0xA880, 0xA8DF, 115, 0xFFFF},
- {0xA8E0, 0xA8FF, 999, 0xFFFF}, {0xA900, 0xA92F, 116, 0xFFFF},
- {0xA930, 0xA95F, 117, 0xFFFF}, {0xA960, 0xA9FF, 999, 0xFFFF},
- {0xAA00, 0xAA5F, 118, 0xFFFF}, {0xAA60, 0xABFF, 999, 0xFFFF},
- {0xAC00, 0xD7AF, 56, 949}, {0xD7B0, 0xD7FF, 999, 0xFFFF},
- {0xD800, 0xDB7F, 57, 0xFFFF}, {0xDB80, 0xDBFF, 57, 0xFFFF},
- {0xDC00, 0xDFFF, 57, 0xFFFF}, {0xE000, 0xE814, 60, 0xFFFF},
- {0xE815, 0xE864, 60, 936}, {0xE865, 0xF8FF, 60, 0xFFFF},
- {0xF900, 0xFA0B, 61, 949}, {0xFA0C, 0xFA0D, 61, 936},
- {0xFA0E, 0xFA2D, 61, 932}, {0xFA2E, 0xFAFF, 61, 0xFFFF},
- {0xFB00, 0xFB4F, 62, 0xFFFF}, {0xFB50, 0xFDFF, 63, 1256},
- {0xFE00, 0xFE0F, 91, 0xFFFF}, {0xFE10, 0xFE1F, 65, 0xFFFF},
- {0xFE20, 0xFE2F, 64, 0xFFFF}, {0xFE30, 0xFE4F, 65, 0xFFFF},
- {0xFE50, 0xFE6F, 66, 0xFFFF}, {0xFE70, 0xFEFF, 67, 1256},
- {0xFF00, 0xFF5F, 68, 936}, {0xFF60, 0xFF9F, 68, 932},
+namespace {
+
+const FGAS_FONTUSB g_FXGdiFontUSBTable[] = {
+ {0x0000, 0x007F, 0, FX_CODEPAGE_MSWin_WesternEuropean},
+ {0x0080, 0x00FF, 1, FX_CODEPAGE_MSWin_WesternEuropean},
+ {0x0100, 0x017F, 2, FX_CODEPAGE_MSWin_EasternEuropean},
+ {0x0180, 0x024F, 3, FX_CODEPAGE_MSWin_EasternEuropean},
+ {0x0250, 0x02AF, 4, 0xFFFF},
+ {0x02B0, 0x02FF, 5, 0xFFFF},
+ {0x0300, 0x036F, 6, 0xFFFF},
+ {0x0370, 0x03FF, 7, FX_CODEPAGE_MSWin_Greek},
+ {0x0400, 0x04FF, 9, FX_CODEPAGE_MSWin_Cyrillic},
+ {0x0500, 0x052F, 9, 0xFFFF},
+ {0x0530, 0x058F, 10, 0xFFFF},
+ {0x0590, 0x05FF, 11, FX_CODEPAGE_MSWin_Hebrew},
+ {0x0600, 0x06FF, 13, FX_CODEPAGE_MSWin_Arabic},
+ {0x0700, 0x074F, 71, 0xFFFF},
+ {0x0750, 0x077F, 13, 0xFFFF},
+ {0x0780, 0x07BF, 72, 0xFFFF},
+ {0x07C0, 0x07FF, 14, 0xFFFF},
+ {0x0800, 0x08FF, 999, 0xFFFF},
+ {0x0900, 0x097F, 15, 0xFFFF},
+ {0x0980, 0x09FF, 16, 0xFFFF},
+ {0x0A00, 0x0A7F, 17, 0xFFFF},
+ {0x0A80, 0x0AFF, 18, 0xFFFF},
+ {0x0B00, 0x0B7F, 19, 0xFFFF},
+ {0x0B80, 0x0BFF, 20, 0xFFFF},
+ {0x0C00, 0x0C7F, 21, 0xFFFF},
+ {0x0C80, 0x0CFF, 22, 0xFFFF},
+ {0x0D00, 0x0D7F, 23, 0xFFFF},
+ {0x0D80, 0x0DFF, 73, 0xFFFF},
+ {0x0E00, 0x0E7F, 24, FX_CODEPAGE_MSDOS_Thai},
+ {0x0E80, 0x0EFF, 25, 0xFFFF},
+ {0x0F00, 0x0FFF, 70, 0xFFFF},
+ {0x1000, 0x109F, 74, 0xFFFF},
+ {0x10A0, 0x10FF, 26, 0xFFFF},
+ {0x1100, 0x11FF, 28, 0xFFFF},
+ {0x1200, 0x137F, 75, 0xFFFF},
+ {0x1380, 0x139F, 75, 0xFFFF},
+ {0x13A0, 0x13FF, 76, 0xFFFF},
+ {0x1400, 0x167F, 77, 0xFFFF},
+ {0x1680, 0x169F, 78, 0xFFFF},
+ {0x16A0, 0x16FF, 79, 0xFFFF},
+ {0x1700, 0x171F, 84, 0xFFFF},
+ {0x1720, 0x173F, 84, 0xFFFF},
+ {0x1740, 0x175F, 84, 0xFFFF},
+ {0x1760, 0x177F, 84, 0xFFFF},
+ {0x1780, 0x17FF, 80, 0xFFFF},
+ {0x1800, 0x18AF, 81, 0xFFFF},
+ {0x18B0, 0x18FF, 999, 0xFFFF},
+ {0x1900, 0x194F, 93, 0xFFFF},
+ {0x1950, 0x197F, 94, 0xFFFF},
+ {0x1980, 0x19DF, 95, 0xFFFF},
+ {0x19E0, 0x19FF, 80, 0xFFFF},
+ {0x1A00, 0x1A1F, 96, 0xFFFF},
+ {0x1A20, 0x1AFF, 999, 0xFFFF},
+ {0x1B00, 0x1B7F, 27, 0xFFFF},
+ {0x1B80, 0x1BBF, 112, 0xFFFF},
+ {0x1BC0, 0x1BFF, 999, 0xFFFF},
+ {0x1C00, 0x1C4F, 113, 0xFFFF},
+ {0x1C50, 0x1C7F, 114, 0xFFFF},
+ {0x1C80, 0x1CFF, 999, 0xFFFF},
+ {0x1D00, 0x1D7F, 4, 0xFFFF},
+ {0x1D80, 0x1DBF, 4, 0xFFFF},
+ {0x1DC0, 0x1DFF, 6, 0xFFFF},
+ {0x1E00, 0x1EFF, 29, 0xFFFF},
+ {0x1F00, 0x1FFF, 30, 0xFFFF},
+ {0x2000, 0x206F, 31, 0xFFFF},
+ {0x2070, 0x209F, 32, 0xFFFF},
+ {0x20A0, 0x20CF, 33, 0xFFFF},
+ {0x20D0, 0x20FF, 34, 0xFFFF},
+ {0x2100, 0x214F, 35, 0xFFFF},
+ {0x2150, 0x215F, 36, 0xFFFF},
+ {0x2160, 0x216B, 36, FX_CODEPAGE_ChineseSimplified},
+ {0x216C, 0x216F, 36, 0xFFFF},
+ {0x2170, 0x2179, 36, FX_CODEPAGE_ChineseSimplified},
+ {0x217A, 0x218F, 36, 0xFFFF},
+ {0x2190, 0x2199, 37, FX_CODEPAGE_Korean},
+ {0x219A, 0x21FF, 37, 0xFFFF},
+ {0x2200, 0x22FF, 38, 0xFFFF},
+ {0x2300, 0x23FF, 39, 0xFFFF},
+ {0x2400, 0x243F, 40, 0xFFFF},
+ {0x2440, 0x245F, 41, 0xFFFF},
+ {0x2460, 0x2473, 42, FX_CODEPAGE_ShiftJIS},
+ {0x2474, 0x249B, 42, FX_CODEPAGE_ChineseSimplified},
+ {0x249C, 0x24E9, 42, FX_CODEPAGE_Korean},
+ {0x24EA, 0x24FF, 42, 0xFFFF},
+ {0x2500, 0x2573, 43, FX_CODEPAGE_ChineseSimplified},
+ {0x2574, 0x257F, 43, 0xFFFF},
+ {0x2580, 0x2580, 44, 0xFFFF},
+ {0x2581, 0x258F, 44, FX_CODEPAGE_ChineseSimplified},
+ {0x2590, 0x259F, 44, 0xFFFF},
+ {0x25A0, 0x25FF, 45, 0xFFFF},
+ {0x2600, 0x26FF, 46, 0xFFFF},
+ {0x2700, 0x27BF, 47, 0xFFFF},
+ {0x27C0, 0x27EF, 38, 0xFFFF},
+ {0x27F0, 0x27FF, 37, 0xFFFF},
+ {0x2800, 0x28FF, 82, 0xFFFF},
+ {0x2900, 0x297F, 37, 0xFFFF},
+ {0x2980, 0x29FF, 38, 0xFFFF},
+ {0x2A00, 0x2AFF, 38, 0xFFFF},
+ {0x2B00, 0x2BFF, 37, 0xFFFF},
+ {0x2C00, 0x2C5F, 97, 0xFFFF},
+ {0x2C60, 0x2C7F, 29, 0xFFFF},
+ {0x2C80, 0x2CFF, 8, 0xFFFF},
+ {0x2D00, 0x2D2F, 26, 0xFFFF},
+ {0x2D30, 0x2D7F, 98, 0xFFFF},
+ {0x2D80, 0x2DDF, 75, 0xFFFF},
+ {0x2DE0, 0x2DFF, 9, 0xFFFF},
+ {0x2E00, 0x2E7F, 31, 0xFFFF},
+ {0x2E80, 0x2EFF, 59, 0xFFFF},
+ {0x2F00, 0x2FDF, 59, 0xFFFF},
+ {0x2FE0, 0x2FEF, 999, 0xFFFF},
+ {0x2FF0, 0x2FFF, 59, 0xFFFF},
+ {0x3000, 0x303F, 48, 0xFFFF},
+ {0x3040, 0x309F, 49, FX_CODEPAGE_ShiftJIS},
+ {0x30A0, 0x30FF, 50, FX_CODEPAGE_ShiftJIS},
+ {0x3100, 0x3129, 51, FX_CODEPAGE_ChineseSimplified},
+ {0x312A, 0x312F, 51, 0xFFFF},
+ {0x3130, 0x318F, 52, FX_CODEPAGE_Korean},
+ {0x3190, 0x319F, 59, 0xFFFF},
+ {0x31A0, 0x31BF, 51, 0xFFFF},
+ {0x31C0, 0x31EF, 61, 0xFFFF},
+ {0x31F0, 0x31FF, 50, 0xFFFF},
+ {0x3200, 0x321C, 54, FX_CODEPAGE_Korean},
+ {0x321D, 0x325F, 54, 0xFFFF},
+ {0x3260, 0x327F, 54, FX_CODEPAGE_Korean},
+ {0x3280, 0x32FF, 54, 0xFFFF},
+ {0x3300, 0x3387, 55, 0xFFFF},
+ {0x3388, 0x33D0, 55, FX_CODEPAGE_Korean},
+ {0x33D1, 0x33FF, 55, 0xFFFF},
+ {0x3400, 0x4DBF, 59, 0xFFFF},
+ {0x4DC0, 0x4DFF, 99, 0xFFFF},
+ {0x4E00, 0x9FA5, 59, FX_CODEPAGE_ChineseSimplified},
+ {0x9FA6, 0x9FFF, 59, 0xFFFF},
+ {0xA000, 0xA48F, 83, 0xFFFF},
+ {0xA490, 0xA4CF, 83, 0xFFFF},
+ {0xA4D0, 0xA4FF, 999, 0xFFFF},
+ {0xA500, 0xA63F, 12, 0xFFFF},
+ {0xA640, 0xA69F, 9, 0xFFFF},
+ {0xA6A0, 0xA6FF, 999, 0xFFFF},
+ {0xA700, 0xA71F, 5, 0xFFFF},
+ {0xA720, 0xA7FF, 29, 0xFFFF},
+ {0xA800, 0xA82F, 100, 0xFFFF},
+ {0xA830, 0xA8FF, 999, 0xFFFF},
+ {0xA840, 0xA87F, 53, 0xFFFF},
+ {0xA880, 0xA8DF, 115, 0xFFFF},
+ {0xA8E0, 0xA8FF, 999, 0xFFFF},
+ {0xA900, 0xA92F, 116, 0xFFFF},
+ {0xA930, 0xA95F, 117, 0xFFFF},
+ {0xA960, 0xA9FF, 999, 0xFFFF},
+ {0xAA00, 0xAA5F, 118, 0xFFFF},
+ {0xAA60, 0xABFF, 999, 0xFFFF},
+ {0xAC00, 0xD7AF, 56, FX_CODEPAGE_Korean},
+ {0xD7B0, 0xD7FF, 999, 0xFFFF},
+ {0xD800, 0xDB7F, 57, 0xFFFF},
+ {0xDB80, 0xDBFF, 57, 0xFFFF},
+ {0xDC00, 0xDFFF, 57, 0xFFFF},
+ {0xE000, 0xE814, 60, 0xFFFF},
+ {0xE815, 0xE864, 60, FX_CODEPAGE_ChineseSimplified},
+ {0xE865, 0xF8FF, 60, 0xFFFF},
+ {0xF900, 0xFA0B, 61, FX_CODEPAGE_Korean},
+ {0xFA0C, 0xFA0D, 61, FX_CODEPAGE_ChineseSimplified},
+ {0xFA0E, 0xFA2D, 61, FX_CODEPAGE_ShiftJIS},
+ {0xFA2E, 0xFAFF, 61, 0xFFFF},
+ {0xFB00, 0xFB4F, 62, 0xFFFF},
+ {0xFB50, 0xFDFF, 63, FX_CODEPAGE_MSWin_Arabic},
+ {0xFE00, 0xFE0F, 91, 0xFFFF},
+ {0xFE10, 0xFE1F, 65, 0xFFFF},
+ {0xFE20, 0xFE2F, 64, 0xFFFF},
+ {0xFE30, 0xFE4F, 65, 0xFFFF},
+ {0xFE50, 0xFE6F, 66, 0xFFFF},
+ {0xFE70, 0xFEFF, 67, FX_CODEPAGE_MSWin_Arabic},
+ {0xFF00, 0xFF5F, 68, FX_CODEPAGE_ChineseSimplified},
+ {0xFF60, 0xFF9F, 68, FX_CODEPAGE_ShiftJIS},
{0xFFA0, 0xFFEF, 68, 0xFFFF},
};
-const FGAS_FONTUSB* FGAS_GetUnicodeBitField(FX_WCHAR wUnicode) {
+} // namespace
+
+const FGAS_FONTUSB* FGAS_GetUnicodeBitField(wchar_t wUnicode) {
int32_t iEnd = sizeof(g_FXGdiFontUSBTable) / sizeof(FGAS_FONTUSB) - 1;
ASSERT(iEnd >= 0);
- int32_t iStart = 0, iMid;
+
+ int32_t iStart = 0;
+ int32_t iMid;
do {
iMid = (iStart + iEnd) / 2;
const FGAS_FONTUSB& usb = g_FXGdiFontUSBTable[iMid];
- if (wUnicode < usb.wStartUnicode) {
+ if (wUnicode < usb.wStartUnicode)
iEnd = iMid - 1;
- } else if (wUnicode > usb.wEndUnicode) {
+ else if (wUnicode > usb.wEndUnicode)
iStart = iMid + 1;
- } else {
+ else
return &usb;
- }
} while (iStart <= iEnd);
return nullptr;
}
diff --git a/chromium/third_party/pdfium/xfa/fgas/font/fgas_fontutils.h b/chromium/third_party/pdfium/xfa/fgas/font/fgas_fontutils.h
index d7055ced9b4..f247a1fe537 100644
--- a/chromium/third_party/pdfium/xfa/fgas/font/fgas_fontutils.h
+++ b/chromium/third_party/pdfium/xfa/fgas/font/fgas_fontutils.h
@@ -16,10 +16,6 @@ struct FGAS_FONTUSB {
uint16_t wCodePage;
};
-uint32_t FGAS_GetFontHashCode(uint16_t wCodePage, uint32_t dwFontStyles);
-uint32_t FGAS_GetFontFamilyHash(const FX_WCHAR* pszFontFamily,
- uint32_t dwFontStyles,
- uint16_t wCodePage);
-const FGAS_FONTUSB* FGAS_GetUnicodeBitField(FX_WCHAR wUnicode);
+const FGAS_FONTUSB* FGAS_GetUnicodeBitField(wchar_t wUnicode);
#endif // XFA_FGAS_FONT_FGAS_FONTUTILS_H_
diff --git a/chromium/third_party/pdfium/xfa/fgas/layout/cfx_break.cpp b/chromium/third_party/pdfium/xfa/fgas/layout/cfx_break.cpp
new file mode 100644
index 00000000000..52236f31760
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fgas/layout/cfx_break.cpp
@@ -0,0 +1,201 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "xfa/fgas/layout/cfx_break.h"
+
+#include <algorithm>
+#include <vector>
+
+#include "third_party/base/stl_util.h"
+
+namespace {
+
+const int kMinimumTabWidth = 160000;
+
+} // namespace
+
+CFX_Break::CFX_Break(uint32_t dwLayoutStyles)
+ : m_eCharType(FX_CHARTYPE_Unknown),
+ m_bSingleLine(false),
+ m_bCombText(false),
+ m_dwIdentity(0),
+ m_dwLayoutStyles(dwLayoutStyles),
+ m_iLineStart(0),
+ m_iLineWidth(2000000),
+ m_wParagraphBreakChar(L'\n'),
+ m_iFontSize(240),
+ m_iTabWidth(720000),
+ m_iHorizontalScale(100),
+ m_iVerticalScale(100),
+ m_iTolerance(0),
+ m_iCharSpace(0),
+ m_iDefChar(0),
+ m_wDefChar(0xFEFF),
+ m_pFont(nullptr),
+ m_pCurLine(nullptr),
+ m_iReadyLineIndex(-1) {
+ m_pCurLine = &m_Line[0];
+}
+
+CFX_Break::~CFX_Break() {}
+
+void CFX_Break::Reset() {
+ m_eCharType = FX_CHARTYPE_Unknown;
+ m_Line[0].Clear();
+ m_Line[1].Clear();
+}
+
+void CFX_Break::SetLayoutStyles(uint32_t dwLayoutStyles) {
+ m_dwLayoutStyles = dwLayoutStyles;
+ m_bSingleLine = (m_dwLayoutStyles & FX_LAYOUTSTYLE_SingleLine) != 0;
+ m_bCombText = (m_dwLayoutStyles & FX_LAYOUTSTYLE_CombText) != 0;
+}
+
+void CFX_Break::SetHorizontalScale(int32_t iScale) {
+ iScale = std::max(iScale, 0);
+ if (m_iHorizontalScale == iScale)
+ return;
+
+ SetBreakStatus();
+ m_iHorizontalScale = iScale;
+}
+
+void CFX_Break::SetVerticalScale(int32_t iScale) {
+ if (iScale < 0)
+ iScale = 0;
+ if (m_iVerticalScale == iScale)
+ return;
+
+ SetBreakStatus();
+ m_iVerticalScale = iScale;
+}
+
+void CFX_Break::SetFont(const CFX_RetainPtr<CFGAS_GEFont>& pFont) {
+ if (!pFont || pFont == m_pFont)
+ return;
+
+ SetBreakStatus();
+ m_pFont = pFont;
+ FontChanged();
+}
+
+void CFX_Break::SetFontSize(float fFontSize) {
+ int32_t iFontSize = FXSYS_round(fFontSize * 20.0f);
+ if (m_iFontSize == iFontSize)
+ return;
+
+ SetBreakStatus();
+ m_iFontSize = iFontSize;
+ FontChanged();
+}
+
+void CFX_Break::SetBreakStatus() {
+ ++m_dwIdentity;
+ int32_t iCount = m_pCurLine->CountChars();
+ if (iCount < 1)
+ return;
+
+ CFX_Char* tc = m_pCurLine->GetChar(iCount - 1);
+ if (tc->m_dwStatus == CFX_BreakType::None)
+ tc->m_dwStatus = CFX_BreakType::Piece;
+}
+
+FX_CHARTYPE CFX_Break::GetUnifiedCharType(FX_CHARTYPE chartype) const {
+ return chartype >= FX_CHARTYPE_ArabicAlef ? FX_CHARTYPE_Arabic : chartype;
+}
+
+void CFX_Break::FontChanged() {
+ m_iDefChar = 0;
+ if (!m_pFont || m_wDefChar == 0xFEFF)
+ return;
+
+ m_pFont->GetCharWidth(m_wDefChar, m_iDefChar, false);
+ m_iDefChar *= m_iFontSize;
+}
+
+void CFX_Break::SetTabWidth(float fTabWidth) {
+ // Note, the use of max here was only done in the TxtBreak code. Leaving this
+ // in for the RTFBreak code for consistency. If we see issues with tab widths
+ // we may need to fix this.
+ m_iTabWidth = std::max(FXSYS_round(fTabWidth * 20000.0f), kMinimumTabWidth);
+}
+
+void CFX_Break::SetDefaultChar(wchar_t wch) {
+ m_wDefChar = wch;
+ m_iDefChar = 0;
+ if (m_wDefChar == 0xFEFF || !m_pFont)
+ return;
+
+ m_pFont->GetCharWidth(m_wDefChar, m_iDefChar, false);
+ if (m_iDefChar < 0)
+ m_iDefChar = 0;
+ else
+ m_iDefChar *= m_iFontSize;
+}
+
+void CFX_Break::SetParagraphBreakChar(wchar_t wch) {
+ if (wch != L'\r' && wch != L'\n')
+ return;
+ m_wParagraphBreakChar = wch;
+}
+
+void CFX_Break::SetLineBreakTolerance(float fTolerance) {
+ m_iTolerance = FXSYS_round(fTolerance * 20000.0f);
+}
+
+void CFX_Break::SetCharSpace(float fCharSpace) {
+ m_iCharSpace = FXSYS_round(fCharSpace * 20000.0f);
+}
+
+void CFX_Break::SetLineBoundary(float fLineStart, float fLineEnd) {
+ if (fLineStart > fLineEnd)
+ return;
+
+ m_iLineStart = FXSYS_round(fLineStart * 20000.0f);
+ m_iLineWidth = FXSYS_round(fLineEnd * 20000.0f);
+ m_pCurLine->m_iStart = std::min(m_pCurLine->m_iStart, m_iLineWidth);
+ m_pCurLine->m_iStart = std::max(m_pCurLine->m_iStart, m_iLineStart);
+}
+
+CFX_Char* CFX_Break::GetLastChar(int32_t index,
+ bool bOmitChar,
+ bool bRichText) const {
+ std::vector<CFX_Char>& tca = m_pCurLine->m_LineChars;
+ if (!pdfium::IndexInBounds(tca, index))
+ return nullptr;
+
+ int32_t iStart = pdfium::CollectionSize<int32_t>(tca) - 1;
+ while (iStart > -1) {
+ CFX_Char* pTC = &tca[iStart--];
+ if (((bRichText && pTC->m_iCharWidth < 0) || bOmitChar) &&
+ pTC->GetCharType() == FX_CHARTYPE_Combination) {
+ continue;
+ }
+ if (--index < 0)
+ return pTC;
+ }
+ return nullptr;
+}
+
+int32_t CFX_Break::CountBreakPieces() const {
+ return HasLine() ? pdfium::CollectionSize<int32_t>(
+ m_Line[m_iReadyLineIndex].m_LinePieces)
+ : 0;
+}
+
+const CFX_BreakPiece* CFX_Break::GetBreakPieceUnstable(int32_t index) const {
+ if (!HasLine())
+ return nullptr;
+ if (!pdfium::IndexInBounds(m_Line[m_iReadyLineIndex].m_LinePieces, index))
+ return nullptr;
+ return &m_Line[m_iReadyLineIndex].m_LinePieces[index];
+}
+
+void CFX_Break::ClearBreakPieces() {
+ if (HasLine())
+ m_Line[m_iReadyLineIndex].Clear();
+ m_iReadyLineIndex = -1;
+}
diff --git a/chromium/third_party/pdfium/xfa/fgas/layout/cfx_break.h b/chromium/third_party/pdfium/xfa/fgas/layout/cfx_break.h
new file mode 100644
index 00000000000..4a7185bd700
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fgas/layout/cfx_break.h
@@ -0,0 +1,91 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef XFA_FGAS_LAYOUT_CFX_BREAK_H_
+#define XFA_FGAS_LAYOUT_CFX_BREAK_H_
+
+#include <stdint.h>
+
+#include "core/fxcrt/cfx_retain_ptr.h"
+#include "xfa/fgas/font/cfgas_gefont.h"
+#include "xfa/fgas/layout/cfx_breakline.h"
+
+struct FX_TPO {
+ bool operator<(const FX_TPO& that) const { return pos < that.pos; }
+
+ int32_t index;
+ int32_t pos;
+};
+
+enum FX_LAYOUTSTYLE {
+ FX_LAYOUTSTYLE_None = 0,
+ FX_LAYOUTSTYLE_Pagination = 0x01,
+ FX_LAYOUTSTYLE_ExpandTab = 0x10,
+ FX_LAYOUTSTYLE_SingleLine = 0x200,
+ FX_LAYOUTSTYLE_CombText = 0x400
+};
+
+class CFX_Break {
+ public:
+ virtual ~CFX_Break();
+
+ void Reset();
+
+ void SetLayoutStyles(uint32_t dwLayoutStyles);
+ uint32_t GetLayoutStyles() const { return m_dwLayoutStyles; }
+
+ void SetFont(const CFX_RetainPtr<CFGAS_GEFont>& pFont);
+ void SetFontSize(float fFontSize);
+ void SetTabWidth(float fTabWidth);
+
+ void SetHorizontalScale(int32_t iScale);
+ void SetVerticalScale(int32_t iScale);
+ void SetLineBreakTolerance(float fTolerance);
+ void SetLineBoundary(float fLineStart, float fLineEnd);
+
+ void SetCharSpace(float fCharSpace);
+ void SetParagraphBreakChar(wchar_t wch);
+ void SetDefaultChar(wchar_t wch);
+
+ int32_t CountBreakPieces() const;
+ const CFX_BreakPiece* GetBreakPieceUnstable(int32_t index) const;
+ void ClearBreakPieces();
+
+ CFX_Char* GetLastChar(int32_t index, bool bOmitChar, bool bRichText) const;
+
+ protected:
+ explicit CFX_Break(uint32_t dwLayoutStyles);
+
+ void SetBreakStatus();
+ bool HasLine() const { return m_iReadyLineIndex >= 0; }
+ FX_CHARTYPE GetUnifiedCharType(FX_CHARTYPE dwType) const;
+
+ FX_CHARTYPE m_eCharType;
+ bool m_bSingleLine;
+ bool m_bCombText;
+ uint32_t m_dwIdentity;
+ uint32_t m_dwLayoutStyles;
+ int32_t m_iLineStart;
+ int32_t m_iLineWidth;
+ wchar_t m_wParagraphBreakChar;
+ int32_t m_iFontSize;
+ int32_t m_iTabWidth;
+ int32_t m_iHorizontalScale;
+ int32_t m_iVerticalScale;
+ int32_t m_iTolerance;
+ int32_t m_iCharSpace;
+ int32_t m_iDefChar;
+ wchar_t m_wDefChar;
+ CFX_RetainPtr<CFGAS_GEFont> m_pFont;
+ CFX_BreakLine m_Line[2];
+ CFX_BreakLine* m_pCurLine;
+ int8_t m_iReadyLineIndex;
+
+ private:
+ void FontChanged();
+};
+
+#endif // XFA_FGAS_LAYOUT_CFX_BREAK_H_
diff --git a/chromium/third_party/pdfium/xfa/fgas/layout/cfx_breakline.cpp b/chromium/third_party/pdfium/xfa/fgas/layout/cfx_breakline.cpp
new file mode 100644
index 00000000000..562f984ffe2
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fgas/layout/cfx_breakline.cpp
@@ -0,0 +1,55 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "xfa/fgas/layout/cfx_breakline.h"
+
+#include "third_party/base/stl_util.h"
+
+CFX_BreakLine::CFX_BreakLine() : m_iStart(0), m_iWidth(0), m_iArabicChars(0) {}
+
+CFX_BreakLine::~CFX_BreakLine() {}
+
+int32_t CFX_BreakLine::CountChars() const {
+ return pdfium::CollectionSize<int32_t>(m_LineChars);
+}
+
+CFX_Char* CFX_BreakLine::GetChar(int32_t index) {
+ ASSERT(pdfium::IndexInBounds(m_LineChars, index));
+ return &m_LineChars[index];
+}
+
+const CFX_Char* CFX_BreakLine::GetChar(int32_t index) const {
+ ASSERT(pdfium::IndexInBounds(m_LineChars, index));
+ return &m_LineChars[index];
+}
+
+int32_t CFX_BreakLine::CountPieces() const {
+ return pdfium::CollectionSize<int32_t>(m_LinePieces);
+}
+
+const CFX_BreakPiece* CFX_BreakLine::GetPiece(int32_t index) const {
+ ASSERT(index >= 0 && index < CountPieces());
+ return &m_LinePieces[index];
+}
+
+void CFX_BreakLine::GetString(CFX_WideString& wsStr) const {
+ int32_t iCount = pdfium::CollectionSize<int32_t>(m_LineChars);
+ wchar_t* pBuf = wsStr.GetBuffer(iCount);
+ for (int32_t i = 0; i < iCount; i++)
+ *pBuf++ = static_cast<wchar_t>(m_LineChars[i].m_wCharCode);
+ wsStr.ReleaseBuffer(iCount);
+}
+
+int32_t CFX_BreakLine::GetLineEnd() const {
+ return m_iStart + m_iWidth;
+}
+
+void CFX_BreakLine::Clear() {
+ m_LineChars.clear();
+ m_LinePieces.clear();
+ m_iWidth = 0;
+ m_iArabicChars = 0;
+}
diff --git a/chromium/third_party/pdfium/xfa/fgas/layout/cfx_breakline.h b/chromium/third_party/pdfium/xfa/fgas/layout/cfx_breakline.h
new file mode 100644
index 00000000000..138ee3104e0
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fgas/layout/cfx_breakline.h
@@ -0,0 +1,39 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef XFA_FGAS_LAYOUT_CFX_BREAKLINE_H_
+#define XFA_FGAS_LAYOUT_CFX_BREAKLINE_H_
+
+#include <vector>
+
+#include "core/fxcrt/cfx_char.h"
+#include "xfa/fgas/layout/cfx_breakpiece.h"
+
+class CFX_BreakLine {
+ public:
+ CFX_BreakLine();
+ ~CFX_BreakLine();
+
+ int32_t CountChars() const;
+ CFX_Char* GetChar(int32_t index);
+ const CFX_Char* GetChar(int32_t index) const;
+
+ int32_t CountPieces() const;
+ const CFX_BreakPiece* GetPiece(int32_t index) const;
+
+ void GetString(CFX_WideString& wsStr) const;
+ int32_t GetLineEnd() const;
+
+ void Clear();
+
+ std::vector<CFX_Char> m_LineChars;
+ std::vector<CFX_BreakPiece> m_LinePieces;
+ int32_t m_iStart;
+ int32_t m_iWidth;
+ int32_t m_iArabicChars;
+};
+
+#endif // XFA_FGAS_LAYOUT_CFX_BREAKLINE_H_
diff --git a/chromium/third_party/pdfium/xfa/fgas/layout/cfx_breakpiece.cpp b/chromium/third_party/pdfium/xfa/fgas/layout/cfx_breakpiece.cpp
new file mode 100644
index 00000000000..8cb676b58fb
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fgas/layout/cfx_breakpiece.cpp
@@ -0,0 +1,52 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "xfa/fgas/layout/cfx_breakpiece.h"
+
+CFX_BreakPiece::CFX_BreakPiece()
+ : m_dwStatus(CFX_BreakType::Piece),
+ m_iStartPos(0),
+ m_iWidth(-1),
+ m_iStartChar(0),
+ m_iChars(0),
+ m_iBidiLevel(0),
+ m_iBidiPos(0),
+ m_iFontSize(0),
+ m_iHorizontalScale(100),
+ m_iVerticalScale(100),
+ m_dwIdentity(0),
+ m_dwCharStyles(0),
+ m_pChars(nullptr),
+ m_pUserData(nullptr) {}
+
+CFX_BreakPiece::CFX_BreakPiece(const CFX_BreakPiece& other) = default;
+
+CFX_BreakPiece::~CFX_BreakPiece() = default;
+
+int32_t CFX_BreakPiece::GetEndPos() const {
+ return m_iWidth < 0 ? m_iStartPos : m_iStartPos + m_iWidth;
+}
+
+CFX_Char* CFX_BreakPiece::GetChar(int32_t index) const {
+ ASSERT(index >= 0 && index < m_iChars && m_pChars);
+ return &(*m_pChars)[m_iStartChar + index];
+}
+
+CFX_WideString CFX_BreakPiece::GetString() const {
+ CFX_WideString ret;
+ ret.Reserve(m_iChars);
+ for (int32_t i = m_iStartChar; i < m_iStartChar + m_iChars; i++)
+ ret += static_cast<wchar_t>((*m_pChars)[i].m_wCharCode);
+ return ret;
+}
+
+std::vector<int32_t> CFX_BreakPiece::GetWidths() const {
+ std::vector<int32_t> ret;
+ ret.reserve(m_iChars);
+ for (int32_t i = m_iStartChar; i < m_iStartChar + m_iChars; i++)
+ ret.push_back((*m_pChars)[i].m_iCharWidth);
+ return ret;
+}
diff --git a/chromium/third_party/pdfium/xfa/fgas/layout/cfx_breakpiece.h b/chromium/third_party/pdfium/xfa/fgas/layout/cfx_breakpiece.h
new file mode 100644
index 00000000000..87627fef40d
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fgas/layout/cfx_breakpiece.h
@@ -0,0 +1,45 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef XFA_FGAS_LAYOUT_CFX_BREAKPIECE_H_
+#define XFA_FGAS_LAYOUT_CFX_BREAKPIECE_H_
+
+#include <vector>
+
+#include "core/fxcrt/cfx_char.h"
+#include "core/fxcrt/cfx_retain_ptr.h"
+#include "core/fxcrt/fx_string.h"
+
+class CFX_BreakPiece {
+ public:
+ CFX_BreakPiece();
+ CFX_BreakPiece(const CFX_BreakPiece& other);
+ ~CFX_BreakPiece();
+
+ int32_t GetEndPos() const;
+ int32_t GetLength() const { return m_iChars; }
+
+ CFX_Char* GetChar(int32_t index) const;
+ CFX_WideString GetString() const;
+ std::vector<int32_t> GetWidths() const;
+
+ CFX_BreakType m_dwStatus;
+ int32_t m_iStartPos;
+ int32_t m_iWidth;
+ int32_t m_iStartChar;
+ int32_t m_iChars;
+ int32_t m_iBidiLevel;
+ int32_t m_iBidiPos;
+ int32_t m_iFontSize;
+ int32_t m_iHorizontalScale;
+ int32_t m_iVerticalScale;
+ uint32_t m_dwIdentity;
+ uint32_t m_dwCharStyles;
+ std::vector<CFX_Char>* m_pChars; // not owned.
+ CFX_RetainPtr<CFX_Retainable> m_pUserData;
+};
+
+#endif // XFA_FGAS_LAYOUT_CFX_BREAKPIECE_H_
diff --git a/chromium/third_party/pdfium/xfa/fgas/layout/fgas_linebreak.h b/chromium/third_party/pdfium/xfa/fgas/layout/fgas_linebreak.h
index 99333dfa47c..918c2e5caf4 100644
--- a/chromium/third_party/pdfium/xfa/fgas/layout/fgas_linebreak.h
+++ b/chromium/third_party/pdfium/xfa/fgas/layout/fgas_linebreak.h
@@ -8,7 +8,6 @@
#define XFA_FGAS_LAYOUT_FGAS_LINEBREAK_H_
#include "core/fxcrt/fx_system.h"
-#include "xfa/fgas/crt/fgas_utils.h"
enum FX_LINEBREAKTYPE : uint8_t {
FX_LBT_UNKNOWN = 0x00,
diff --git a/chromium/third_party/pdfium/xfa/fgas/layout/fgas_rtfbreak.cpp b/chromium/third_party/pdfium/xfa/fgas/layout/fgas_rtfbreak.cpp
index 9a83be65ac3..842e7292174 100644
--- a/chromium/third_party/pdfium/xfa/fgas/layout/fgas_rtfbreak.cpp
+++ b/chromium/third_party/pdfium/xfa/fgas/layout/fgas_rtfbreak.cpp
@@ -9,118 +9,31 @@
#include <algorithm>
#include "core/fxcrt/fx_arabic.h"
-#include "core/fxcrt/fx_arb.h"
#include "third_party/base/stl_util.h"
#include "xfa/fgas/font/cfgas_gefont.h"
#include "xfa/fgas/layout/fgas_linebreak.h"
-namespace {
-
-typedef CFX_RTFBreakType (CFX_RTFBreak::*FX_RTFBreak_LPFAppendChar)(
- CFX_RTFChar* pCurChar);
-const FX_RTFBreak_LPFAppendChar g_FX_RTFBreak_lpfAppendChar[16] = {
- &CFX_RTFBreak::AppendChar_Others, &CFX_RTFBreak::AppendChar_Tab,
- &CFX_RTFBreak::AppendChar_Others, &CFX_RTFBreak::AppendChar_Control,
- &CFX_RTFBreak::AppendChar_Combination, &CFX_RTFBreak::AppendChar_Others,
- &CFX_RTFBreak::AppendChar_Others, &CFX_RTFBreak::AppendChar_Arabic,
- &CFX_RTFBreak::AppendChar_Arabic, &CFX_RTFBreak::AppendChar_Arabic,
- &CFX_RTFBreak::AppendChar_Arabic, &CFX_RTFBreak::AppendChar_Arabic,
- &CFX_RTFBreak::AppendChar_Arabic, &CFX_RTFBreak::AppendChar_Others,
- &CFX_RTFBreak::AppendChar_Others, &CFX_RTFBreak::AppendChar_Others,
-};
-
-} // namespace
-
CFX_RTFBreak::CFX_RTFBreak(uint32_t dwLayoutStyles)
- : m_iBoundaryStart(0),
- m_iBoundaryEnd(2000000),
- m_dwLayoutStyles(dwLayoutStyles),
+ : CFX_Break(dwLayoutStyles),
m_bPagination(false),
- m_pFont(nullptr),
- m_iFontHeight(240),
- m_iFontSize(240),
- m_iTabWidth(720000),
- m_wDefChar(0xFEFF),
- m_iDefChar(0),
- m_wLineBreakChar(L'\n'),
- m_iHorizontalScale(100),
- m_iVerticalScale(100),
- m_iCharSpace(0),
m_iAlignment(CFX_RTFLineAlignment::Left),
- m_pUserData(nullptr),
- m_eCharType(FX_CHARTYPE_Unknown),
- m_dwIdentity(0),
- m_RTFLine1(),
- m_RTFLine2(),
- m_pCurLine(nullptr),
- m_iReady(0),
- m_iTolerance(0) {
- m_pCurLine = &m_RTFLine1;
-
+ m_pUserData(nullptr) {
SetBreakStatus();
- m_bPagination = (m_dwLayoutStyles & FX_RTFLAYOUTSTYLE_Pagination) != 0;
-}
-
-CFX_RTFBreak::~CFX_RTFBreak() {
- Reset();
+ m_bPagination = !!(m_dwLayoutStyles & FX_LAYOUTSTYLE_Pagination);
}
-void CFX_RTFBreak::SetLineBoundary(FX_FLOAT fLineStart, FX_FLOAT fLineEnd) {
- if (fLineStart > fLineEnd)
- return;
-
- m_iBoundaryStart = FXSYS_round(fLineStart * 20000.0f);
- m_iBoundaryEnd = FXSYS_round(fLineEnd * 20000.0f);
- m_pCurLine->m_iStart = std::min(m_pCurLine->m_iStart, m_iBoundaryEnd);
- m_pCurLine->m_iStart = std::max(m_pCurLine->m_iStart, m_iBoundaryStart);
-}
+CFX_RTFBreak::~CFX_RTFBreak() {}
-void CFX_RTFBreak::SetLineStartPos(FX_FLOAT fLinePos) {
+void CFX_RTFBreak::SetLineStartPos(float fLinePos) {
int32_t iLinePos = FXSYS_round(fLinePos * 20000.0f);
- iLinePos = std::min(iLinePos, m_iBoundaryEnd);
- iLinePos = std::max(iLinePos, m_iBoundaryStart);
+ iLinePos = std::min(iLinePos, m_iLineWidth);
+ iLinePos = std::max(iLinePos, m_iLineStart);
m_pCurLine->m_iStart = iLinePos;
}
-void CFX_RTFBreak::SetFont(const CFX_RetainPtr<CFGAS_GEFont>& pFont) {
- if (!pFont || pFont == m_pFont)
- return;
-
- SetBreakStatus();
- m_pFont = pFont;
- FontChanged();
-}
-
-void CFX_RTFBreak::SetFontSize(FX_FLOAT fFontSize) {
- int32_t iFontSize = FXSYS_round(fFontSize * 20.0f);
- if (m_iFontSize == iFontSize)
- return;
-
- SetBreakStatus();
- m_iFontSize = iFontSize;
- FontChanged();
-}
-
-void CFX_RTFBreak::FontChanged() {
- m_iDefChar = 0;
- if (!m_pFont)
- return;
-
- m_iFontHeight = m_iFontSize;
- if (m_wDefChar == 0xFEFF)
- return;
-
- m_pFont->GetCharWidth(m_wDefChar, m_iDefChar, false);
- m_iDefChar *= m_iFontSize;
-}
-
-void CFX_RTFBreak::SetTabWidth(FX_FLOAT fTabWidth) {
- m_iTabWidth = FXSYS_round(fTabWidth * 20000.0f);
-}
-
-void CFX_RTFBreak::AddPositionedTab(FX_FLOAT fTabPos) {
- int32_t iTabPos = std::min(FXSYS_round(fTabPos * 20000.0f) + m_iBoundaryStart,
- m_iBoundaryEnd);
+void CFX_RTFBreak::AddPositionedTab(float fTabPos) {
+ int32_t iTabPos =
+ std::min(FXSYS_round(fTabPos * 20000.0f) + m_iLineStart, m_iLineWidth);
auto it = std::lower_bound(m_PositionedTabs.begin(), m_PositionedTabs.end(),
iTabPos);
if (it != m_PositionedTabs.end() && *it == iTabPos)
@@ -128,34 +41,6 @@ void CFX_RTFBreak::AddPositionedTab(FX_FLOAT fTabPos) {
m_PositionedTabs.insert(it, iTabPos);
}
-void CFX_RTFBreak::SetLineBreakTolerance(FX_FLOAT fTolerance) {
- m_iTolerance = FXSYS_round(fTolerance * 20000.0f);
-}
-
-void CFX_RTFBreak::SetHorizontalScale(int32_t iScale) {
- if (iScale < 0)
- iScale = 0;
- if (m_iHorizontalScale == iScale)
- return;
-
- SetBreakStatus();
- m_iHorizontalScale = iScale;
-}
-
-void CFX_RTFBreak::SetVerticalScale(int32_t iScale) {
- if (iScale < 0)
- iScale = 0;
- if (m_iVerticalScale == iScale)
- return;
-
- SetBreakStatus();
- m_iVerticalScale = iScale;
-}
-
-void CFX_RTFBreak::SetCharSpace(FX_FLOAT fCharSpace) {
- m_iCharSpace = FXSYS_round(fCharSpace * 20000.0f);
-}
-
void CFX_RTFBreak::SetUserData(const CFX_RetainPtr<CFX_Retainable>& pUserData) {
if (m_pUserData == pUserData)
return;
@@ -164,55 +49,8 @@ void CFX_RTFBreak::SetUserData(const CFX_RetainPtr<CFX_Retainable>& pUserData) {
m_pUserData = pUserData;
}
-void CFX_RTFBreak::SetBreakStatus() {
- m_dwIdentity++;
- int32_t iCount = m_pCurLine->CountChars();
- if (iCount < 1)
- return;
-
- CFX_RTFChar& tc = m_pCurLine->GetChar(iCount - 1);
- if (tc.m_dwStatus == CFX_RTFBreakType::None)
- tc.m_dwStatus = CFX_RTFBreakType::Piece;
-}
-
-CFX_RTFChar* CFX_RTFBreak::GetLastChar(int32_t index) const {
- std::vector<CFX_RTFChar>& tca = m_pCurLine->m_LineChars;
- int32_t iCount = pdfium::CollectionSize<int32_t>(tca);
- if (index < 0 || index >= iCount)
- return nullptr;
-
- int32_t iStart = iCount - 1;
- while (iStart > -1) {
- CFX_RTFChar* pTC = &tca[iStart--];
- if (pTC->m_iCharWidth >= 0 ||
- pTC->GetCharType() != FX_CHARTYPE_Combination) {
- if (--index < 0)
- return pTC;
- }
- }
- return nullptr;
-}
-
-const CFX_RTFLine* CFX_RTFBreak::GetRTFLine() const {
- if (m_iReady == 1)
- return &m_RTFLine1;
- if (m_iReady == 2)
- return &m_RTFLine2;
- return nullptr;
-}
-
-const CFX_RTFPieceArray* CFX_RTFBreak::GetRTFPieces() const {
- const CFX_RTFLine* pRTFLine = GetRTFLine();
- return pRTFLine ? &pRTFLine->m_LinePieces : nullptr;
-}
-
-inline FX_CHARTYPE CFX_RTFBreak::GetUnifiedCharType(
- FX_CHARTYPE chartype) const {
- return chartype >= FX_CHARTYPE_ArabicAlef ? FX_CHARTYPE_Arabic : chartype;
-}
-
int32_t CFX_RTFBreak::GetLastPositionedTab() const {
- return m_PositionedTabs.empty() ? m_iBoundaryStart : m_PositionedTabs.back();
+ return m_PositionedTabs.empty() ? m_iLineStart : m_PositionedTabs.back();
}
bool CFX_RTFBreak::GetPositionedTab(int32_t* iTabPos) const {
@@ -225,52 +63,76 @@ bool CFX_RTFBreak::GetPositionedTab(int32_t* iTabPos) const {
return true;
}
-CFX_RTFBreakType CFX_RTFBreak::AppendChar(FX_WCHAR wch) {
+CFX_BreakType CFX_RTFBreak::AppendChar(wchar_t wch) {
ASSERT(m_pFont && m_pCurLine);
uint32_t dwProps = kTextLayoutCodeProperties[static_cast<uint16_t>(wch)];
FX_CHARTYPE chartype = GetCharTypeFromProp(dwProps);
m_pCurLine->m_LineChars.emplace_back();
- CFX_RTFChar* pCurChar = &m_pCurLine->m_LineChars.back();
- pCurChar->m_dwStatus = CFX_RTFBreakType::None;
+ CFX_Char* pCurChar = &m_pCurLine->m_LineChars.back();
+ pCurChar->m_dwStatus = CFX_BreakType::None;
pCurChar->m_wCharCode = wch;
pCurChar->m_dwCharProps = dwProps;
pCurChar->m_iFontSize = m_iFontSize;
- pCurChar->m_iFontHeight = m_iFontHeight;
pCurChar->m_iHorizontalScale = m_iHorizontalScale;
pCurChar->m_iVerticalScale = m_iVerticalScale;
pCurChar->m_iCharWidth = 0;
pCurChar->m_dwIdentity = m_dwIdentity;
pCurChar->m_pUserData = m_pUserData;
- CFX_RTFBreakType dwRet1 = CFX_RTFBreakType::None;
+ CFX_BreakType dwRet1 = CFX_BreakType::None;
if (chartype != FX_CHARTYPE_Combination &&
GetUnifiedCharType(m_eCharType) != GetUnifiedCharType(chartype) &&
m_eCharType != FX_CHARTYPE_Unknown &&
- m_pCurLine->GetLineEnd() > m_iBoundaryEnd + m_iTolerance &&
+ m_pCurLine->GetLineEnd() > m_iLineWidth + m_iTolerance &&
(m_eCharType != FX_CHARTYPE_Space || chartype != FX_CHARTYPE_Control)) {
- dwRet1 = EndBreak(CFX_RTFBreakType::Line);
+ dwRet1 = EndBreak(CFX_BreakType::Line);
int32_t iCount = m_pCurLine->CountChars();
if (iCount > 0)
pCurChar = &m_pCurLine->m_LineChars[iCount - 1];
}
- CFX_RTFBreakType dwRet2 =
- (this->*g_FX_RTFBreak_lpfAppendChar[chartype >> FX_CHARTYPEBITS])(
- pCurChar);
+ CFX_BreakType dwRet2 = CFX_BreakType::None;
+ switch (chartype) {
+ case FX_CHARTYPE_Tab:
+ AppendChar_Tab(pCurChar);
+ break;
+ case FX_CHARTYPE_Control:
+ dwRet2 = AppendChar_Control(pCurChar);
+ break;
+ case FX_CHARTYPE_Combination:
+ AppendChar_Combination(pCurChar);
+ break;
+ case FX_CHARTYPE_ArabicAlef:
+ case FX_CHARTYPE_ArabicSpecial:
+ case FX_CHARTYPE_ArabicDistortion:
+ case FX_CHARTYPE_ArabicNormal:
+ case FX_CHARTYPE_ArabicForm:
+ case FX_CHARTYPE_Arabic:
+ dwRet2 = AppendChar_Arabic(pCurChar);
+ break;
+ case FX_CHARTYPE_Unknown:
+ case FX_CHARTYPE_Space:
+ case FX_CHARTYPE_Numeric:
+ case FX_CHARTYPE_Normal:
+ default:
+ dwRet2 = AppendChar_Others(pCurChar);
+ break;
+ }
+
m_eCharType = chartype;
return std::max(dwRet1, dwRet2);
}
-CFX_RTFBreakType CFX_RTFBreak::AppendChar_Combination(CFX_RTFChar* pCurChar) {
+void CFX_RTFBreak::AppendChar_Combination(CFX_Char* pCurChar) {
int32_t iCharWidth = 0;
if (!m_pFont->GetCharWidth(pCurChar->m_wCharCode, iCharWidth, false))
iCharWidth = 0;
iCharWidth *= m_iFontSize;
iCharWidth = iCharWidth * m_iHorizontalScale / 100;
- CFX_RTFChar* pLastChar = GetLastChar(0);
+ CFX_Char* pLastChar = GetLastChar(0, false, true);
if (pLastChar && pLastChar->GetCharType() > FX_CHARTYPE_Combination)
iCharWidth = -iCharWidth;
else
@@ -279,13 +141,11 @@ CFX_RTFBreakType CFX_RTFBreak::AppendChar_Combination(CFX_RTFChar* pCurChar) {
pCurChar->m_iCharWidth = iCharWidth;
if (iCharWidth > 0)
m_pCurLine->m_iWidth += iCharWidth;
-
- return CFX_RTFBreakType::None;
}
-CFX_RTFBreakType CFX_RTFBreak::AppendChar_Tab(CFX_RTFChar* pCurChar) {
- if (!(m_dwLayoutStyles & FX_RTFLAYOUTSTYLE_ExpandTab))
- return CFX_RTFBreakType::None;
+void CFX_RTFBreak::AppendChar_Tab(CFX_Char* pCurChar) {
+ if (!(m_dwLayoutStyles & FX_LAYOUTSTYLE_ExpandTab))
+ return;
int32_t& iLineWidth = m_pCurLine->m_iWidth;
int32_t iCharWidth = iLineWidth;
@@ -296,44 +156,43 @@ CFX_RTFBreakType CFX_RTFBreak::AppendChar_Tab(CFX_RTFChar* pCurChar) {
pCurChar->m_iCharWidth = iCharWidth;
iLineWidth += iCharWidth;
- return CFX_RTFBreakType::None;
}
-CFX_RTFBreakType CFX_RTFBreak::AppendChar_Control(CFX_RTFChar* pCurChar) {
- CFX_RTFBreakType dwRet2 = CFX_RTFBreakType::None;
+CFX_BreakType CFX_RTFBreak::AppendChar_Control(CFX_Char* pCurChar) {
+ CFX_BreakType dwRet2 = CFX_BreakType::None;
switch (pCurChar->m_wCharCode) {
case L'\v':
case 0x2028:
- dwRet2 = CFX_RTFBreakType::Line;
+ dwRet2 = CFX_BreakType::Line;
break;
case L'\f':
- dwRet2 = CFX_RTFBreakType::Page;
+ dwRet2 = CFX_BreakType::Page;
break;
case 0x2029:
- dwRet2 = CFX_RTFBreakType::Paragraph;
+ dwRet2 = CFX_BreakType::Paragraph;
break;
default:
- if (pCurChar->m_wCharCode == m_wLineBreakChar)
- dwRet2 = CFX_RTFBreakType::Paragraph;
+ if (pCurChar->m_wCharCode == m_wParagraphBreakChar)
+ dwRet2 = CFX_BreakType::Paragraph;
break;
}
- if (dwRet2 != CFX_RTFBreakType::None)
+ if (dwRet2 != CFX_BreakType::None)
dwRet2 = EndBreak(dwRet2);
return dwRet2;
}
-CFX_RTFBreakType CFX_RTFBreak::AppendChar_Arabic(CFX_RTFChar* pCurChar) {
- CFX_RTFChar* pLastChar = nullptr;
+CFX_BreakType CFX_RTFBreak::AppendChar_Arabic(CFX_Char* pCurChar) {
+ CFX_Char* pLastChar = nullptr;
int32_t iCharWidth = 0;
- FX_WCHAR wForm;
+ wchar_t wForm;
bool bAlef = false;
if (m_eCharType >= FX_CHARTYPE_ArabicAlef &&
m_eCharType <= FX_CHARTYPE_ArabicDistortion) {
- pLastChar = GetLastChar(1);
+ pLastChar = GetLastChar(1, false, true);
if (pLastChar) {
m_pCurLine->m_iWidth -= pLastChar->m_iCharWidth;
- CFX_RTFChar* pPrevChar = GetLastChar(2);
+ CFX_Char* pPrevChar = GetLastChar(2, false, true);
wForm = pdfium::arabic::GetFormChar(pLastChar, pPrevChar, pCurChar);
bAlef = (wForm == 0xFEFF &&
pLastChar->GetCharType() == FX_CHARTYPE_ArabicAlef);
@@ -363,14 +222,14 @@ CFX_RTFBreakType CFX_RTFBreak::AppendChar_Arabic(CFX_RTFChar* pCurChar) {
m_pCurLine->m_iWidth += iCharWidth;
m_pCurLine->m_iArabicChars++;
- if (m_pCurLine->GetLineEnd() > m_iBoundaryEnd + m_iTolerance)
- return EndBreak(CFX_RTFBreakType::Line);
- return CFX_RTFBreakType::None;
+ if (m_pCurLine->GetLineEnd() > m_iLineWidth + m_iTolerance)
+ return EndBreak(CFX_BreakType::Line);
+ return CFX_BreakType::None;
}
-CFX_RTFBreakType CFX_RTFBreak::AppendChar_Others(CFX_RTFChar* pCurChar) {
+CFX_BreakType CFX_RTFBreak::AppendChar_Others(CFX_Char* pCurChar) {
FX_CHARTYPE chartype = pCurChar->GetCharType();
- FX_WCHAR wForm = pCurChar->m_wCharCode;
+ wchar_t wForm = pCurChar->m_wCharCode;
int32_t iCharWidth = 0;
if (!m_pFont->GetCharWidth(wForm, iCharWidth, false))
iCharWidth = m_iDefChar;
@@ -382,54 +241,42 @@ CFX_RTFBreakType CFX_RTFBreak::AppendChar_Others(CFX_RTFChar* pCurChar) {
pCurChar->m_iCharWidth = iCharWidth;
m_pCurLine->m_iWidth += iCharWidth;
if (chartype != FX_CHARTYPE_Space &&
- m_pCurLine->GetLineEnd() > m_iBoundaryEnd + m_iTolerance) {
- return EndBreak(CFX_RTFBreakType::Line);
+ m_pCurLine->GetLineEnd() > m_iLineWidth + m_iTolerance) {
+ return EndBreak(CFX_BreakType::Line);
}
- return CFX_RTFBreakType::None;
+ return CFX_BreakType::None;
}
-CFX_RTFBreakType CFX_RTFBreak::EndBreak(CFX_RTFBreakType dwStatus) {
- ASSERT(dwStatus != CFX_RTFBreakType::None);
-
- m_dwIdentity++;
- const CFX_RTFPieceArray* pCurPieces = &m_pCurLine->m_LinePieces;
- int32_t iCount = pCurPieces->GetSize();
- if (iCount > 0) {
- CFX_RTFPiece* pLastPiece = pCurPieces->GetPtrAt(--iCount);
- if (dwStatus != CFX_RTFBreakType::Piece)
- pLastPiece->m_dwStatus = dwStatus;
- else
- dwStatus = pLastPiece->m_dwStatus;
- return dwStatus;
+CFX_BreakType CFX_RTFBreak::EndBreak(CFX_BreakType dwStatus) {
+ ASSERT(dwStatus != CFX_BreakType::None);
+
+ ++m_dwIdentity;
+ if (!m_pCurLine->m_LinePieces.empty()) {
+ if (dwStatus != CFX_BreakType::Piece)
+ m_pCurLine->m_LinePieces.back().m_dwStatus = dwStatus;
+ return m_pCurLine->m_LinePieces.back().m_dwStatus;
}
- const CFX_RTFLine* pLastLine = GetRTFLine();
- if (pLastLine) {
- pCurPieces = &pLastLine->m_LinePieces;
- iCount = pCurPieces->GetSize();
- if (iCount-- > 0) {
- CFX_RTFPiece* pLastPiece = pCurPieces->GetPtrAt(iCount);
- if (dwStatus != CFX_RTFBreakType::Piece)
- pLastPiece->m_dwStatus = dwStatus;
- else
- dwStatus = pLastPiece->m_dwStatus;
- return dwStatus;
+ if (HasLine()) {
+ if (!m_Line[m_iReadyLineIndex].m_LinePieces.empty()) {
+ if (dwStatus != CFX_BreakType::Piece)
+ m_Line[m_iReadyLineIndex].m_LinePieces.back().m_dwStatus = dwStatus;
+ return m_Line[m_iReadyLineIndex].m_LinePieces.back().m_dwStatus;
}
- return CFX_RTFBreakType::None;
+ return CFX_BreakType::None;
}
- iCount = m_pCurLine->CountChars();
+ int32_t iCount = m_pCurLine->CountChars();
if (iCount < 1)
- return CFX_RTFBreakType::None;
+ return CFX_BreakType::None;
- CFX_RTFChar& tc = m_pCurLine->GetChar(iCount - 1);
- tc.m_dwStatus = dwStatus;
- if (dwStatus == CFX_RTFBreakType::Piece)
+ CFX_Char* tc = m_pCurLine->GetChar(iCount - 1);
+ tc->m_dwStatus = dwStatus;
+ if (dwStatus == CFX_BreakType::Piece)
return dwStatus;
- m_iReady = m_pCurLine == &m_RTFLine1 ? 1 : 2;
- CFX_RTFLine* pNextLine =
- m_pCurLine == &m_RTFLine1 ? &m_RTFLine2 : &m_RTFLine1;
+ m_iReadyLineIndex = m_pCurLine == &m_Line[0] ? 0 : 1;
+ CFX_BreakLine* pNextLine = &m_Line[1 - m_iReadyLineIndex];
bool bAllChars = m_iAlignment == CFX_RTFLineAlignment::Justified ||
m_iAlignment == CFX_RTFLineAlignment::Distributed;
@@ -440,20 +287,20 @@ CFX_RTFBreakType CFX_RTFBreak::EndBreak(CFX_RTFBreakType dwStatus) {
EndBreak_Alignment(tpos, bAllChars, dwStatus);
}
m_pCurLine = pNextLine;
- m_pCurLine->m_iStart = m_iBoundaryStart;
+ m_pCurLine->m_iStart = m_iLineStart;
- CFX_RTFChar* pTC = GetLastChar(0);
+ CFX_Char* pTC = GetLastChar(0, false, true);
m_eCharType = pTC ? pTC->GetCharType() : FX_CHARTYPE_Unknown;
return dwStatus;
}
-bool CFX_RTFBreak::EndBreak_SplitLine(CFX_RTFLine* pNextLine,
+bool CFX_RTFBreak::EndBreak_SplitLine(CFX_BreakLine* pNextLine,
bool bAllChars,
- CFX_RTFBreakType dwStatus) {
+ CFX_BreakType dwStatus) {
bool bDone = false;
- if (m_pCurLine->GetLineEnd() > m_iBoundaryEnd + m_iTolerance) {
- const CFX_RTFChar& tc = m_pCurLine->GetChar(m_pCurLine->CountChars() - 1);
- switch (tc.GetCharType()) {
+ if (m_pCurLine->GetLineEnd() > m_iLineWidth + m_iTolerance) {
+ const CFX_Char* tc = m_pCurLine->GetChar(m_pCurLine->CountChars() - 1);
+ switch (tc->GetCharType()) {
case FX_CHARTYPE_Tab:
case FX_CHARTYPE_Control:
case FX_CHARTYPE_Space:
@@ -465,7 +312,7 @@ bool CFX_RTFBreak::EndBreak_SplitLine(CFX_RTFLine* pNextLine,
}
}
- if (!m_bPagination && m_pCurLine->m_iMBCSChars <= 0) {
+ if (!m_bPagination) {
if (bAllChars && !bDone) {
int32_t endPos = m_pCurLine->GetLineEnd();
GetBreakPos(m_pCurLine->m_LineChars, endPos, bAllChars, true);
@@ -473,24 +320,21 @@ bool CFX_RTFBreak::EndBreak_SplitLine(CFX_RTFLine* pNextLine,
return false;
}
- const CFX_RTFChar* pCurChars = m_pCurLine->m_LineChars.data();
- const CFX_RTFChar* pTC;
- CFX_RTFPieceArray* pCurPieces = &m_pCurLine->m_LinePieces;
- CFX_RTFPiece tp;
+ const CFX_Char* pCurChars = m_pCurLine->m_LineChars.data();
+ CFX_BreakPiece tp;
tp.m_pChars = &m_pCurLine->m_LineChars;
bool bNew = true;
uint32_t dwIdentity = static_cast<uint32_t>(-1);
int32_t iLast = m_pCurLine->CountChars() - 1;
int32_t j = 0;
for (int32_t i = 0; i <= iLast;) {
- pTC = pCurChars + i;
+ const CFX_Char* pTC = pCurChars + i;
if (bNew) {
tp.m_iStartChar = i;
tp.m_iStartPos += tp.m_iWidth;
tp.m_iWidth = 0;
tp.m_dwStatus = pTC->m_dwStatus;
tp.m_iFontSize = pTC->m_iFontSize;
- tp.m_iFontHeight = pTC->m_iFontHeight;
tp.m_iHorizontalScale = pTC->m_iHorizontalScale;
tp.m_iVerticalScale = pTC->m_iVerticalScale;
dwIdentity = pTC->m_dwIdentity;
@@ -500,37 +344,33 @@ bool CFX_RTFBreak::EndBreak_SplitLine(CFX_RTFLine* pNextLine,
bNew = false;
}
- if (i == iLast || pTC->m_dwStatus != CFX_RTFBreakType::None ||
+ if (i == iLast || pTC->m_dwStatus != CFX_BreakType::None ||
pTC->m_dwIdentity != dwIdentity) {
tp.m_iChars = i - j;
if (pTC->m_dwIdentity == dwIdentity) {
tp.m_dwStatus = pTC->m_dwStatus;
tp.m_iWidth += pTC->m_iCharWidth;
tp.m_iChars += 1;
- i++;
+ ++i;
}
- pCurPieces->Add(tp);
+ m_pCurLine->m_LinePieces.push_back(tp);
bNew = true;
} else {
tp.m_iWidth += pTC->m_iCharWidth;
- i++;
+ ++i;
}
}
return true;
}
void CFX_RTFBreak::EndBreak_BidiLine(std::deque<FX_TPO>* tpos,
- CFX_RTFBreakType dwStatus) {
- FX_TPO tpo;
- CFX_RTFPiece tp;
- CFX_RTFChar* pTC;
- int32_t i;
- int32_t j;
- std::vector<CFX_RTFChar>& chars = m_pCurLine->m_LineChars;
+ CFX_BreakType dwStatus) {
+ CFX_Char* pTC;
+ std::vector<CFX_Char>& chars = m_pCurLine->m_LineChars;
int32_t iCount = m_pCurLine->CountChars();
if (!m_bPagination && m_pCurLine->m_iArabicChars > 0) {
int32_t iBidiNum = 0;
- for (i = 0; i < iCount; i++) {
+ for (int32_t i = 0; i < iCount; ++i) {
pTC = &chars[i];
pTC->m_iBidiPos = i;
if (pTC->GetCharType() != FX_CHARTYPE_Control)
@@ -538,9 +378,9 @@ void CFX_RTFBreak::EndBreak_BidiLine(std::deque<FX_TPO>* tpos,
if (i == 0)
pTC->m_iBidiLevel = 1;
}
- FX_BidiLine(chars, iBidiNum + 1, 0);
+ FX_BidiLine(&chars, iBidiNum + 1);
} else {
- for (i = 0; i < iCount; i++) {
+ for (int32_t i = 0; i < iCount; ++i) {
pTC = &chars[i];
pTC->m_iBidiLevel = 0;
pTC->m_iBidiPos = 0;
@@ -548,15 +388,17 @@ void CFX_RTFBreak::EndBreak_BidiLine(std::deque<FX_TPO>* tpos,
}
}
- tp.m_dwStatus = CFX_RTFBreakType::Piece;
+ CFX_BreakPiece tp;
+ tp.m_dwStatus = CFX_BreakType::Piece;
tp.m_iStartPos = m_pCurLine->m_iStart;
tp.m_pChars = &chars;
- CFX_RTFPieceArray* pCurPieces = &m_pCurLine->m_LinePieces;
+
int32_t iBidiLevel = -1;
int32_t iCharWidth;
+ FX_TPO tpo;
uint32_t dwIdentity = static_cast<uint32_t>(-1);
- i = 0;
- j = 0;
+ int32_t i = 0;
+ int32_t j = 0;
while (i < iCount) {
pTC = &chars[i];
if (iBidiLevel < 0) {
@@ -566,18 +408,18 @@ void CFX_RTFBreak::EndBreak_BidiLine(std::deque<FX_TPO>* tpos,
tp.m_iBidiLevel = iBidiLevel;
tp.m_iBidiPos = pTC->m_iBidiOrder;
tp.m_iFontSize = pTC->m_iFontSize;
- tp.m_iFontHeight = pTC->m_iFontHeight;
tp.m_iHorizontalScale = pTC->m_iHorizontalScale;
tp.m_iVerticalScale = pTC->m_iVerticalScale;
dwIdentity = pTC->m_dwIdentity;
tp.m_dwIdentity = dwIdentity;
tp.m_pUserData = pTC->m_pUserData;
- tp.m_dwStatus = CFX_RTFBreakType::Piece;
- i++;
+ tp.m_dwStatus = CFX_BreakType::Piece;
+ ++i;
} else if (iBidiLevel != pTC->m_iBidiLevel ||
pTC->m_dwIdentity != dwIdentity) {
tp.m_iChars = i - tp.m_iStartChar;
- pCurPieces->Add(tp);
+ m_pCurLine->m_LinePieces.push_back(tp);
+
tp.m_iStartPos += tp.m_iWidth;
tp.m_iStartChar = i;
tpo.index = j++;
@@ -588,14 +430,15 @@ void CFX_RTFBreak::EndBreak_BidiLine(std::deque<FX_TPO>* tpos,
iCharWidth = pTC->m_iCharWidth;
if (iCharWidth > 0)
tp.m_iWidth += iCharWidth;
- i++;
+ ++i;
}
}
if (i > tp.m_iStartChar) {
tp.m_dwStatus = dwStatus;
tp.m_iChars = i - tp.m_iStartChar;
- pCurPieces->Add(tp);
+ m_pCurLine->m_LinePieces.push_back(tp);
+
tpo.index = j;
tpo.pos = tp.m_iBidiPos;
tpos->push_back(tpo);
@@ -604,7 +447,7 @@ void CFX_RTFBreak::EndBreak_BidiLine(std::deque<FX_TPO>* tpos,
std::sort(tpos->begin(), tpos->end());
int32_t iStartPos = m_pCurLine->m_iStart;
for (const auto& it : *tpos) {
- CFX_RTFPiece& ttp = pCurPieces->GetAt(it.index);
+ CFX_BreakPiece& ttp = m_pCurLine->m_LinePieces[it.index];
ttp.m_iStartPos = iStartPos;
iStartPos += ttp.m_iWidth;
}
@@ -612,36 +455,28 @@ void CFX_RTFBreak::EndBreak_BidiLine(std::deque<FX_TPO>* tpos,
void CFX_RTFBreak::EndBreak_Alignment(const std::deque<FX_TPO>& tpos,
bool bAllChars,
- CFX_RTFBreakType dwStatus) {
- CFX_RTFPieceArray* pCurPieces = &m_pCurLine->m_LinePieces;
+ CFX_BreakType dwStatus) {
int32_t iNetWidth = m_pCurLine->m_iWidth;
int32_t iGapChars = 0;
- int32_t iCharWidth;
- int32_t iCount = pCurPieces->GetSize();
bool bFind = false;
- uint32_t dwCharType;
- int32_t i;
- int32_t j;
- FX_TPO tpo;
- for (i = iCount - 1; i > -1; i--) {
- tpo = tpos[i];
- CFX_RTFPiece& ttp = pCurPieces->GetAt(tpo.index);
+ for (auto it = tpos.rbegin(); it != tpos.rend(); it++) {
+ CFX_BreakPiece& ttp = m_pCurLine->m_LinePieces[it->index];
if (!bFind)
iNetWidth = ttp.GetEndPos();
bool bArabic = FX_IsOdd(ttp.m_iBidiLevel);
- j = bArabic ? 0 : ttp.m_iChars - 1;
+ int32_t j = bArabic ? 0 : ttp.m_iChars - 1;
while (j > -1 && j < ttp.m_iChars) {
- const CFX_RTFChar& tc = ttp.GetChar(j);
- if (tc.m_nBreakType == FX_LBT_DIRECT_BRK)
- iGapChars++;
+ const CFX_Char* tc = ttp.GetChar(j);
+ if (tc->m_nBreakType == FX_LBT_DIRECT_BRK)
+ ++iGapChars;
if (!bFind || !bAllChars) {
- dwCharType = tc.GetCharType();
+ uint32_t dwCharType = tc->GetCharType();
if (dwCharType == FX_CHARTYPE_Space ||
dwCharType == FX_CHARTYPE_Control) {
if (!bFind) {
- iCharWidth = tc.m_iCharWidth;
+ int32_t iCharWidth = tc->m_iCharWidth;
if (bAllChars && iCharWidth > 0)
iNetWidth -= iCharWidth;
}
@@ -657,29 +492,28 @@ void CFX_RTFBreak::EndBreak_Alignment(const std::deque<FX_TPO>& tpos,
break;
}
- int32_t iOffset = m_iBoundaryEnd - iNetWidth;
+ int32_t iOffset = m_iLineWidth - iNetWidth;
if (iGapChars > 0 && (m_iAlignment == CFX_RTFLineAlignment::Distributed ||
(m_iAlignment == CFX_RTFLineAlignment::Justified &&
- dwStatus != CFX_RTFBreakType::Paragraph))) {
+ dwStatus != CFX_BreakType::Paragraph))) {
int32_t iStart = -1;
- for (i = 0; i < iCount; i++) {
- tpo = tpos[i];
- CFX_RTFPiece& ttp = pCurPieces->GetAt(tpo.index);
+ for (const auto& tpo : tpos) {
+ CFX_BreakPiece& ttp = m_pCurLine->m_LinePieces[tpo.index];
if (iStart < 0)
iStart = ttp.m_iStartPos;
else
ttp.m_iStartPos = iStart;
- for (j = 0; j < ttp.m_iChars; j++) {
- CFX_RTFChar& tc = ttp.GetChar(j);
- if (tc.m_nBreakType != FX_LBT_DIRECT_BRK || tc.m_iCharWidth < 0)
+ for (int32_t j = 0; j < ttp.m_iChars; ++j) {
+ CFX_Char* tc = ttp.GetChar(j);
+ if (tc->m_nBreakType != FX_LBT_DIRECT_BRK || tc->m_iCharWidth < 0)
continue;
int32_t k = iOffset / iGapChars;
- tc.m_iCharWidth += k;
+ tc->m_iCharWidth += k;
ttp.m_iWidth += k;
iOffset -= k;
- iGapChars--;
+ --iGapChars;
if (iGapChars < 1)
break;
}
@@ -690,15 +524,13 @@ void CFX_RTFBreak::EndBreak_Alignment(const std::deque<FX_TPO>& tpos,
if (m_iAlignment == CFX_RTFLineAlignment::Center)
iOffset /= 2;
if (iOffset > 0) {
- for (i = 0; i < iCount; i++) {
- CFX_RTFPiece& ttp = pCurPieces->GetAt(i);
+ for (auto& ttp : m_pCurLine->m_LinePieces)
ttp.m_iStartPos += iOffset;
- }
}
}
}
-int32_t CFX_RTFBreak::GetBreakPos(std::vector<CFX_RTFChar>& tca,
+int32_t CFX_RTFBreak::GetBreakPos(std::vector<CFX_Char>& tca,
int32_t& iEndPos,
bool bAllChars,
bool bOnlyBrk) {
@@ -712,7 +544,7 @@ int32_t CFX_RTFBreak::GetBreakPos(std::vector<CFX_RTFChar>& tca,
int32_t iIndirectPos = -1;
int32_t iLast = -1;
int32_t iLastPos = -1;
- if (iEndPos <= m_iBoundaryEnd) {
+ if (iEndPos <= m_iLineWidth) {
if (!bAllChars)
return iLength;
@@ -720,8 +552,8 @@ int32_t CFX_RTFBreak::GetBreakPos(std::vector<CFX_RTFChar>& tca,
iBreakPos = iEndPos;
}
- CFX_RTFChar* pCharArray = tca.data();
- CFX_RTFChar* pCur = pCharArray + iLength;
+ CFX_Char* pCharArray = tca.data();
+ CFX_Char* pCur = pCharArray + iLength;
--iLength;
if (bAllChars)
pCur->m_nBreakType = FX_LBT_UNKNOWN;
@@ -754,7 +586,7 @@ int32_t CFX_RTFBreak::GetBreakPos(std::vector<CFX_RTFChar>& tca,
if (!bOnlyBrk) {
iCharWidth = pCur->m_iCharWidth;
- if (iEndPos <= m_iBoundaryEnd || bNeedBreak) {
+ if (iEndPos <= m_iLineWidth || bNeedBreak) {
if (eType == FX_LBT_DIRECT_BRK && iBreak < 0) {
iBreak = iLength;
iBreakPos = iEndPos;
@@ -773,7 +605,7 @@ int32_t CFX_RTFBreak::GetBreakPos(std::vector<CFX_RTFChar>& tca,
iEndPos -= iCharWidth;
}
nNext = nCodeProp & 0x003F;
- iLength--;
+ --iLength;
}
if (bOnlyBrk)
return 0;
@@ -793,8 +625,8 @@ int32_t CFX_RTFBreak::GetBreakPos(std::vector<CFX_RTFChar>& tca,
return 0;
}
-void CFX_RTFBreak::SplitTextLine(CFX_RTFLine* pCurLine,
- CFX_RTFLine* pNextLine,
+void CFX_RTFBreak::SplitTextLine(CFX_BreakLine* pCurLine,
+ CFX_BreakLine* pNextLine,
bool bAllChars) {
ASSERT(pCurLine && pNextLine);
int32_t iCount = pCurLine->CountChars();
@@ -802,63 +634,35 @@ void CFX_RTFBreak::SplitTextLine(CFX_RTFLine* pCurLine,
return;
int32_t iEndPos = pCurLine->GetLineEnd();
- std::vector<CFX_RTFChar>& curChars = pCurLine->m_LineChars;
+ std::vector<CFX_Char>& curChars = pCurLine->m_LineChars;
int32_t iCharPos = GetBreakPos(curChars, iEndPos, bAllChars, false);
if (iCharPos < 0)
iCharPos = 0;
- iCharPos++;
+ ++iCharPos;
if (iCharPos >= iCount) {
- pNextLine->RemoveAll(true);
- CFX_Char* pTC = &curChars[iCharPos - 1];
- pTC->m_nBreakType = FX_LBT_UNKNOWN;
+ pNextLine->Clear();
+ curChars[iCharPos - 1].m_nBreakType = FX_LBT_UNKNOWN;
return;
}
pNextLine->m_LineChars =
- std::vector<CFX_RTFChar>(curChars.begin() + iCharPos, curChars.end());
+ std::vector<CFX_Char>(curChars.begin() + iCharPos, curChars.end());
curChars.erase(curChars.begin() + iCharPos, curChars.end());
pNextLine->m_iStart = pCurLine->m_iStart;
pNextLine->m_iWidth = pCurLine->GetLineEnd() - iEndPos;
pCurLine->m_iWidth = iEndPos;
curChars[iCharPos - 1].m_nBreakType = FX_LBT_UNKNOWN;
- for (size_t i = 0; i < pNextLine->m_LineChars.size(); i++) {
+ for (size_t i = 0; i < pNextLine->m_LineChars.size(); ++i) {
if (pNextLine->m_LineChars[i].GetCharType() >= FX_CHARTYPE_ArabicAlef) {
pCurLine->m_iArabicChars--;
pNextLine->m_iArabicChars++;
}
- pNextLine->m_LineChars[i].m_dwStatus = CFX_RTFBreakType::None;
+ pNextLine->m_LineChars[i].m_dwStatus = CFX_BreakType::None;
}
}
-int32_t CFX_RTFBreak::CountBreakPieces() const {
- const CFX_RTFPieceArray* pRTFPieces = GetRTFPieces();
- return pRTFPieces ? pRTFPieces->GetSize() : 0;
-}
-
-const CFX_RTFPiece* CFX_RTFBreak::GetBreakPiece(int32_t index) const {
- const CFX_RTFPieceArray* pRTFPieces = GetRTFPieces();
- if (!pRTFPieces)
- return nullptr;
- if (index < 0 || index >= pRTFPieces->GetSize())
- return nullptr;
- return pRTFPieces->GetPtrAt(index);
-}
-
-void CFX_RTFBreak::ClearBreakPieces() {
- const CFX_RTFLine* pRTFLine = GetRTFLine();
- if (pRTFLine)
- const_cast<CFX_RTFLine*>(pRTFLine)->RemoveAll(true);
- m_iReady = 0;
-}
-
-void CFX_RTFBreak::Reset() {
- m_eCharType = FX_CHARTYPE_Unknown;
- m_RTFLine1.RemoveAll(true);
- m_RTFLine2.RemoveAll(true);
-}
-
int32_t CFX_RTFBreak::GetDisplayPos(const FX_RTFTEXTOBJ* pText,
FXTEXT_CHARPOS* pCharPos,
bool bCharCode) const {
@@ -870,56 +674,44 @@ int32_t CFX_RTFBreak::GetDisplayPos(const FX_RTFTEXTOBJ* pText,
CFX_RetainPtr<CFGAS_GEFont> pFont = pText->pFont;
CFX_RectF rtText(*pText->pRect);
bool bRTLPiece = FX_IsOdd(pText->iBidiLevel);
- FX_FLOAT fFontSize = pText->fFontSize;
+ float fFontSize = pText->fFontSize;
int32_t iFontSize = FXSYS_round(fFontSize * 20.0f);
int32_t iAscent = pFont->GetAscent();
int32_t iDescent = pFont->GetDescent();
int32_t iMaxHeight = iAscent - iDescent;
- FX_FLOAT fFontHeight = fFontSize;
- FX_FLOAT fAscent = fFontHeight * static_cast<FX_FLOAT>(iAscent) /
- static_cast<FX_FLOAT>(iMaxHeight);
- FX_WCHAR wch;
- FX_WCHAR wPrev = 0xFEFF;
- FX_WCHAR wNext;
- FX_WCHAR wForm;
- int32_t iWidth;
- int32_t iCharWidth;
- int32_t iCharHeight;
- FX_FLOAT fX = rtText.left;
- FX_FLOAT fY = rtText.top;
- FX_FLOAT fCharWidth;
- FX_FLOAT fCharHeight;
+ float fFontHeight = fFontSize;
+ float fAscent = fFontHeight * static_cast<float>(iAscent) /
+ static_cast<float>(iMaxHeight);
+ wchar_t wPrev = 0xFEFF;
+ wchar_t wNext;
+ float fX = rtText.left;
int32_t iHorScale = pText->iHorizontalScale;
int32_t iVerScale = pText->iVerticalScale;
- bool bEmptyChar;
- uint32_t dwProps;
- uint32_t dwCharType;
-
if (bRTLPiece)
fX = rtText.right();
- fY += fAscent;
+ float fY = rtText.top + fAscent;
int32_t iCount = 0;
- for (int32_t i = 0; i < pText->iLength; i++) {
- wch = pText->pStr[i];
- iWidth = pText->pWidths[i];
- dwProps = FX_GetUnicodeProperties(wch);
- dwCharType = (dwProps & FX_CHARTYPEBITSMASK);
+ for (int32_t i = 0; i < pText->iLength; ++i) {
+ wchar_t wch = pText->pStr[i];
+ int32_t iWidth = pText->pWidths[i];
+ uint32_t dwProps = FX_GetUnicodeProperties(wch);
+ uint32_t dwCharType = (dwProps & FX_CHARTYPEBITSMASK);
if (iWidth == 0) {
if (dwCharType == FX_CHARTYPE_ArabicAlef)
wPrev = 0xFEFF;
continue;
}
- iCharWidth = FXSYS_abs(iWidth);
- bEmptyChar =
+ int32_t iCharWidth = abs(iWidth);
+ bool bEmptyChar =
(dwCharType >= FX_CHARTYPE_Tab && dwCharType <= FX_CHARTYPE_Control);
if (!bEmptyChar)
- iCount++;
+ ++iCount;
if (pCharPos) {
iCharWidth /= iFontSize;
- wForm = wch;
+ wchar_t wForm = wch;
if (dwCharType >= FX_CHARTYPE_ArabicAlef) {
if (i + 1 < pText->iLength) {
wNext = pText->pStr[i + 1];
@@ -947,10 +739,8 @@ int32_t CFX_RTFBreak::GetDisplayPos(const FX_RTFTEXTOBJ* pText,
#endif
pCharPos->m_FontCharWidth = iCharWidth;
}
- iCharHeight = 1000;
- fCharWidth = fFontSize * iCharWidth / 1000.0f;
- fCharHeight = fFontSize * iCharHeight / 1000.0f;
+ float fCharWidth = fFontSize * iCharWidth / 1000.0f;
if (bRTLPiece && dwCharType != FX_CHARTYPE_Combination)
fX -= fCharWidth;
@@ -978,7 +768,7 @@ int32_t CFX_RTFBreak::GetDisplayPos(const FX_RTFTEXTOBJ* pText,
pCharPos->m_AdjustMatrix[3] =
pCharPos->m_AdjustMatrix[3] * iVerScale / 100.0f;
}
- pCharPos++;
+ ++pCharPos;
}
}
if (iWidth > 0)
@@ -987,37 +777,6 @@ int32_t CFX_RTFBreak::GetDisplayPos(const FX_RTFTEXTOBJ* pText,
return iCount;
}
-CFX_RTFPiece::CFX_RTFPiece()
- : m_dwStatus(CFX_RTFBreakType::Piece),
- m_iStartPos(0),
- m_iWidth(-1),
- m_iStartChar(0),
- m_iChars(0),
- m_iBidiLevel(0),
- m_iBidiPos(0),
- m_iFontSize(0),
- m_iFontHeight(0),
- m_iHorizontalScale(100),
- m_iVerticalScale(100),
- m_dwIdentity(0),
- m_pChars(nullptr),
- m_pUserData(nullptr) {}
-
-CFX_RTFPiece::~CFX_RTFPiece() {
- Reset();
-}
-
-CFX_RTFLine::CFX_RTFLine()
- : m_LinePieces(16),
- m_iStart(0),
- m_iWidth(0),
- m_iArabicChars(0),
- m_iMBCSChars(0) {}
-
-CFX_RTFLine::~CFX_RTFLine() {
- RemoveAll(false);
-}
-
FX_RTFTEXTOBJ::FX_RTFTEXTOBJ()
: pFont(nullptr),
pRect(nullptr),
diff --git a/chromium/third_party/pdfium/xfa/fgas/layout/fgas_rtfbreak.h b/chromium/third_party/pdfium/xfa/fgas/layout/fgas_rtfbreak.h
index 4d999ec682a..7cbd250218f 100644
--- a/chromium/third_party/pdfium/xfa/fgas/layout/fgas_rtfbreak.h
+++ b/chromium/third_party/pdfium/xfa/fgas/layout/fgas_rtfbreak.h
@@ -12,15 +12,13 @@
#include "core/fxcrt/cfx_retain_ptr.h"
#include "core/fxcrt/fx_basic.h"
+#include "core/fxcrt/fx_coordinates.h"
#include "core/fxcrt/fx_ucd.h"
-#include "xfa/fgas/crt/fgas_utils.h"
-#include "xfa/fgas/layout/fgas_textbreak.h"
+#include "core/fxge/cfx_renderdevice.h"
+#include "xfa/fgas/layout/cfx_break.h"
class CFGAS_GEFont;
-#define FX_RTFLAYOUTSTYLE_Pagination 0x01
-#define FX_RTFLAYOUTSTYLE_ExpandTab 0x10
-
enum class CFX_RTFLineAlignment {
Left = 0,
Center,
@@ -37,193 +35,64 @@ struct FX_RTFTEXTOBJ {
std::vector<int32_t> pWidths;
CFX_RetainPtr<CFGAS_GEFont> pFont;
const CFX_RectF* pRect;
- FX_WCHAR wLineBreakChar;
- FX_FLOAT fFontSize;
+ wchar_t wLineBreakChar;
+ float fFontSize;
int32_t iLength;
int32_t iBidiLevel;
int32_t iHorizontalScale;
int32_t iVerticalScale;
};
-class CFX_RTFPiece {
+class CFX_RTFBreak : public CFX_Break {
public:
- CFX_RTFPiece();
- ~CFX_RTFPiece();
-
- int32_t GetEndPos() const {
- return m_iWidth < 0 ? m_iStartPos : m_iStartPos + m_iWidth;
- }
-
- CFX_RTFChar& GetChar(int32_t index) {
- ASSERT(index > -1 && index < m_iChars && m_pChars);
- return (*m_pChars)[m_iStartChar + index];
- }
-
- CFX_WideString GetString() const {
- CFX_WideString ret;
- ret.Reserve(m_iChars);
- for (int32_t i = m_iStartChar; i < m_iStartChar + m_iChars; i++)
- ret += static_cast<FX_WCHAR>((*m_pChars)[i].m_wCharCode);
- return ret;
- }
-
- std::vector<int32_t> GetWidths() const {
- std::vector<int32_t> ret;
- ret.reserve(m_iChars);
- for (int32_t i = m_iStartChar; i < m_iStartChar + m_iChars; i++)
- ret.push_back((*m_pChars)[i].m_iCharWidth);
- return ret;
- }
-
- void Reset() {
- m_dwStatus = CFX_RTFBreakType::Piece;
- if (m_iWidth > -1)
- m_iStartPos += m_iWidth;
-
- m_iWidth = -1;
- m_iStartChar += m_iChars;
- m_iChars = 0;
- m_iBidiLevel = 0;
- m_iBidiPos = 0;
- m_iHorizontalScale = 100;
- m_iVerticalScale = 100;
- }
-
- CFX_RTFBreakType m_dwStatus;
- int32_t m_iStartPos;
- int32_t m_iWidth;
- int32_t m_iStartChar;
- int32_t m_iChars;
- int32_t m_iBidiLevel;
- int32_t m_iBidiPos;
- int32_t m_iFontSize;
- int32_t m_iFontHeight;
- int32_t m_iHorizontalScale;
- int32_t m_iVerticalScale;
- uint32_t m_dwIdentity;
- std::vector<CFX_RTFChar>* m_pChars; // not owned.
- CFX_RetainPtr<CFX_Retainable> m_pUserData;
-};
+ explicit CFX_RTFBreak(uint32_t dwLayoutStyles);
+ ~CFX_RTFBreak() override;
-typedef CFX_BaseArrayTemplate<CFX_RTFPiece> CFX_RTFPieceArray;
+ void SetLineStartPos(float fLinePos);
-class CFX_RTFLine {
- public:
- CFX_RTFLine();
- ~CFX_RTFLine();
-
- int32_t CountChars() const {
- return pdfium::CollectionSize<int32_t>(m_LineChars);
- }
-
- CFX_RTFChar& GetChar(int32_t index) {
- ASSERT(index >= 0 && index < pdfium::CollectionSize<int32_t>(m_LineChars));
- return m_LineChars[index];
- }
-
- int32_t GetLineEnd() const { return m_iStart + m_iWidth; }
- void RemoveAll(bool bLeaveMemory) {
- m_LineChars.clear();
- m_LinePieces.RemoveAll(bLeaveMemory);
- m_iWidth = 0;
- m_iArabicChars = 0;
- m_iMBCSChars = 0;
- }
-
- std::vector<CFX_RTFChar> m_LineChars;
- CFX_RTFPieceArray m_LinePieces;
- int32_t m_iStart;
- int32_t m_iWidth;
- int32_t m_iArabicChars;
- int32_t m_iMBCSChars;
-};
-
-class CFX_RTFBreak {
- public:
- explicit CFX_RTFBreak(uint32_t dwLayoutStyles);
- ~CFX_RTFBreak();
-
- void SetLineBoundary(FX_FLOAT fLineStart, FX_FLOAT fLineEnd);
- void SetLineStartPos(FX_FLOAT fLinePos);
- void SetFont(const CFX_RetainPtr<CFGAS_GEFont>& pFont);
- void SetFontSize(FX_FLOAT fFontSize);
- void SetTabWidth(FX_FLOAT fTabWidth);
- void SetLineBreakTolerance(FX_FLOAT fTolerance);
- void SetHorizontalScale(int32_t iScale);
- void SetVerticalScale(int32_t iScale);
- void SetCharSpace(FX_FLOAT fCharSpace);
void SetAlignment(CFX_RTFLineAlignment align) { m_iAlignment = align; }
void SetUserData(const CFX_RetainPtr<CFX_Retainable>& pUserData);
- void AddPositionedTab(FX_FLOAT fTabPos);
+ void AddPositionedTab(float fTabPos);
- CFX_RTFBreakType EndBreak(CFX_RTFBreakType dwStatus);
- int32_t CountBreakPieces() const;
- const CFX_RTFPiece* GetBreakPiece(int32_t index) const;
- void ClearBreakPieces();
-
- void Reset();
+ CFX_BreakType EndBreak(CFX_BreakType dwStatus);
int32_t GetDisplayPos(const FX_RTFTEXTOBJ* pText,
FXTEXT_CHARPOS* pCharPos,
bool bCharCode) const;
- CFX_RTFBreakType AppendChar(FX_WCHAR wch);
- CFX_RTFBreakType AppendChar_Combination(CFX_RTFChar* pCurChar);
- CFX_RTFBreakType AppendChar_Tab(CFX_RTFChar* pCurChar);
- CFX_RTFBreakType AppendChar_Control(CFX_RTFChar* pCurChar);
- CFX_RTFBreakType AppendChar_Arabic(CFX_RTFChar* pCurChar);
- CFX_RTFBreakType AppendChar_Others(CFX_RTFChar* pCurChar);
+ CFX_BreakType AppendChar(wchar_t wch);
+
+ CFX_BreakLine* GetCurrentLineForTesting() const { return m_pCurLine; }
private:
- void FontChanged();
- void SetBreakStatus();
- CFX_RTFChar* GetLastChar(int32_t index) const;
- const CFX_RTFLine* GetRTFLine() const;
- const CFX_RTFPieceArray* GetRTFPieces() const;
- FX_CHARTYPE GetUnifiedCharType(FX_CHARTYPE chartype) const;
+ void AppendChar_Combination(CFX_Char* pCurChar);
+ void AppendChar_Tab(CFX_Char* pCurChar);
+ CFX_BreakType AppendChar_Control(CFX_Char* pCurChar);
+ CFX_BreakType AppendChar_Arabic(CFX_Char* pCurChar);
+ CFX_BreakType AppendChar_Others(CFX_Char* pCurChar);
int32_t GetLastPositionedTab() const;
bool GetPositionedTab(int32_t* iTabPos) const;
- int32_t GetBreakPos(std::vector<CFX_RTFChar>& tca,
+ int32_t GetBreakPos(std::vector<CFX_Char>& tca,
int32_t& iEndPos,
bool bAllChars,
bool bOnlyBrk);
- void SplitTextLine(CFX_RTFLine* pCurLine,
- CFX_RTFLine* pNextLine,
+ void SplitTextLine(CFX_BreakLine* pCurLine,
+ CFX_BreakLine* pNextLine,
bool bAllChars);
- bool EndBreak_SplitLine(CFX_RTFLine* pNextLine,
+ bool EndBreak_SplitLine(CFX_BreakLine* pNextLine,
bool bAllChars,
- CFX_RTFBreakType dwStatus);
- void EndBreak_BidiLine(std::deque<FX_TPO>* tpos, CFX_RTFBreakType dwStatus);
+ CFX_BreakType dwStatus);
+ void EndBreak_BidiLine(std::deque<FX_TPO>* tpos, CFX_BreakType dwStatus);
void EndBreak_Alignment(const std::deque<FX_TPO>& tpos,
bool bAllChars,
- CFX_RTFBreakType dwStatus);
+ CFX_BreakType dwStatus);
- int32_t m_iBoundaryStart;
- int32_t m_iBoundaryEnd;
- uint32_t m_dwLayoutStyles;
bool m_bPagination;
- CFX_RetainPtr<CFGAS_GEFont> m_pFont;
- int32_t m_iFontHeight;
- int32_t m_iFontSize;
- int32_t m_iTabWidth;
std::vector<int32_t> m_PositionedTabs;
- FX_WCHAR m_wDefChar;
- int32_t m_iDefChar;
- FX_WCHAR m_wLineBreakChar;
- int32_t m_iHorizontalScale;
- int32_t m_iVerticalScale;
- int32_t m_iCharSpace;
CFX_RTFLineAlignment m_iAlignment;
CFX_RetainPtr<CFX_Retainable> m_pUserData;
- FX_CHARTYPE m_eCharType;
- uint32_t m_dwIdentity;
- CFX_RTFLine m_RTFLine1;
- CFX_RTFLine m_RTFLine2;
- CFX_RTFLine* m_pCurLine;
- int32_t m_iReady;
- int32_t m_iTolerance;
};
#endif // XFA_FGAS_LAYOUT_FGAS_RTFBREAK_H_
diff --git a/chromium/third_party/pdfium/xfa/fgas/layout/fgas_rtfbreak_unittest.cpp b/chromium/third_party/pdfium/xfa/fgas/layout/fgas_rtfbreak_unittest.cpp
new file mode 100644
index 00000000000..d84621a595f
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fgas/layout/fgas_rtfbreak_unittest.cpp
@@ -0,0 +1,87 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "xfa/fgas/layout/fgas_rtfbreak.h"
+
+#include <memory>
+
+#include "testing/gtest/include/gtest/gtest.h"
+#include "testing/test_support.h"
+#include "third_party/base/ptr_util.h"
+#include "xfa/fgas/font/cfgas_fontmgr.h"
+#include "xfa/fgas/font/cfgas_gefont.h"
+
+class RTFBreakTest : public testing::Test {
+ public:
+ void SetUp() override {
+ CFX_GEModule::Get()->GetFontMgr()->SetSystemFontInfo(
+ IFX_SystemFontInfo::CreateDefault(nullptr));
+
+#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
+ font_mgr_ = CFGAS_FontMgr::Create(FX_GetDefFontEnumerator());
+#else
+ font_source_ = pdfium::MakeUnique<CFX_FontSourceEnum_File>();
+ font_mgr_ = CFGAS_FontMgr::Create(font_source_.get());
+#endif
+
+ font_ = CFGAS_GEFont::LoadFont(L"Arial Black", 0, 0, font_mgr_.get());
+ ASSERT(font_.Get() != nullptr);
+ }
+
+ std::unique_ptr<CFX_RTFBreak> CreateBreak(int32_t args) {
+ auto b = pdfium::MakeUnique<CFX_RTFBreak>(args);
+ b->SetFont(font_);
+ return b;
+ }
+
+ private:
+ std::unique_ptr<CFGAS_FontMgr> font_mgr_;
+ CFX_RetainPtr<CFGAS_GEFont> font_;
+
+#if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
+ std::unique_ptr<CFX_FontSourceEnum_File> font_source_;
+#endif
+};
+
+// As soon as you get one of the control characters the break is complete
+// and must be consumed before you get any more characters ....
+
+TEST_F(RTFBreakTest, AddChars) {
+ auto b = CreateBreak(FX_LAYOUTSTYLE_ExpandTab);
+
+ CFX_WideString str(L"Input String.");
+ for (int32_t i = 0; i < str.GetLength(); i++)
+ EXPECT_EQ(CFX_BreakType::None, b->AppendChar(str.GetAt(i)));
+
+ EXPECT_EQ(CFX_BreakType::Paragraph, b->AppendChar(L'\n'));
+ ASSERT_EQ(1, b->CountBreakPieces());
+ EXPECT_EQ(str + L"\n", b->GetBreakPieceUnstable(0)->GetString());
+
+ b->ClearBreakPieces();
+ b->Reset();
+ EXPECT_EQ(0, b->GetCurrentLineForTesting()->GetLineEnd());
+
+ str = L"Second str.";
+ for (int32_t i = 0; i < str.GetLength(); i++)
+ EXPECT_EQ(CFX_BreakType::None, b->AppendChar(str.GetAt(i)));
+
+ // Force the end of the break at the end of the string.
+ b->EndBreak(CFX_BreakType::Paragraph);
+ ASSERT_EQ(1, b->CountBreakPieces());
+ EXPECT_EQ(str, b->GetBreakPieceUnstable(0)->GetString());
+}
+
+TEST_F(RTFBreakTest, ControlCharacters) {
+ auto b = CreateBreak(FX_LAYOUTSTYLE_ExpandTab);
+ EXPECT_EQ(CFX_BreakType::Line, b->AppendChar(L'\v'));
+ EXPECT_EQ(CFX_BreakType::Page, b->AppendChar(L'\f'));
+ // 0x2029 is the Paragraph Separator unicode character.
+ EXPECT_EQ(CFX_BreakType::Paragraph, b->AppendChar(0x2029));
+ EXPECT_EQ(CFX_BreakType::Paragraph, b->AppendChar(L'\n'));
+
+ ASSERT_EQ(1, b->CountBreakPieces());
+ EXPECT_EQ(L"\v", b->GetBreakPieceUnstable(0)->GetString());
+}
diff --git a/chromium/third_party/pdfium/xfa/fgas/layout/fgas_textbreak.cpp b/chromium/third_party/pdfium/xfa/fgas/layout/fgas_textbreak.cpp
index 8be72f2c7bf..83a03eed5ef 100644
--- a/chromium/third_party/pdfium/xfa/fgas/layout/fgas_textbreak.cpp
+++ b/chromium/third_party/pdfium/xfa/fgas/layout/fgas_textbreak.cpp
@@ -9,7 +9,6 @@
#include <algorithm>
#include "core/fxcrt/fx_arabic.h"
-#include "core/fxcrt/fx_arb.h"
#include "core/fxcrt/fx_memory.h"
#include "third_party/base/ptr_util.h"
#include "xfa/fgas/font/cfgas_gefont.h"
@@ -17,457 +16,138 @@
namespace {
-typedef uint32_t (CFX_TxtBreak::*FX_TxtBreak_LPFAppendChar)(
- CFX_TxtChar* pCurChar,
- int32_t iRotation);
-const FX_TxtBreak_LPFAppendChar g_FX_TxtBreak_lpfAppendChar[16] = {
- &CFX_TxtBreak::AppendChar_Others, &CFX_TxtBreak::AppendChar_Tab,
- &CFX_TxtBreak::AppendChar_Others, &CFX_TxtBreak::AppendChar_Control,
- &CFX_TxtBreak::AppendChar_Combination, &CFX_TxtBreak::AppendChar_Others,
- &CFX_TxtBreak::AppendChar_Others, &CFX_TxtBreak::AppendChar_Arabic,
- &CFX_TxtBreak::AppendChar_Arabic, &CFX_TxtBreak::AppendChar_Arabic,
- &CFX_TxtBreak::AppendChar_Arabic, &CFX_TxtBreak::AppendChar_Arabic,
- &CFX_TxtBreak::AppendChar_Arabic, &CFX_TxtBreak::AppendChar_Others,
- &CFX_TxtBreak::AppendChar_Others, &CFX_TxtBreak::AppendChar_Others,
-};
+bool IsCtrlCode(wchar_t ch) {
+ uint32_t dwRet = (FX_GetUnicodeProperties(ch) & FX_CHARTYPEBITSMASK);
+ return dwRet == FX_CHARTYPE_Tab || dwRet == FX_CHARTYPE_Control;
+}
} // namespace
-CFX_TxtBreak::CFX_TxtBreak(uint32_t dwPolicies)
- : m_dwPolicies(dwPolicies),
- m_iLineWidth(2000000),
- m_dwLayoutStyles(0),
- m_bVertical(false),
- m_bArabicContext(false),
- m_bArabicShapes(false),
- m_bRTL(false),
- m_bSingleLine(false),
- m_bCombText(false),
- m_iArabicContext(1),
- m_iCurArabicContext(1),
- m_pFont(nullptr),
- m_iFontSize(240),
- m_bEquidistant(true),
- m_iTabWidth(720000),
- m_wDefChar(0xFEFF),
- m_wParagBreakChar(L'\n'),
- m_iDefChar(0),
- m_iLineRotation(0),
- m_iCharRotation(0),
- m_iRotation(0),
- m_iAlignment(FX_TXTLINEALIGNMENT_Left),
- m_dwContextCharStyles(0),
- m_iCombWidth(360000),
- m_pUserData(nullptr),
- m_eCharType(FX_CHARTYPE_Unknown),
- m_bArabicNumber(false),
- m_bArabicComma(false),
- m_pCurLine(nullptr),
- m_iReady(0),
- m_iTolerance(0),
- m_iHorScale(100),
- m_iCharSpace(0) {
- m_bPagination = (m_dwPolicies & FX_TXTBREAKPOLICY_Pagination) != 0;
- int32_t iSize = m_bPagination ? sizeof(CFX_Char) : sizeof(CFX_TxtChar);
- m_pTxtLine1 = pdfium::MakeUnique<CFX_TxtLine>(iSize);
- m_pTxtLine2 = pdfium::MakeUnique<CFX_TxtLine>(iSize);
- m_pCurLine = m_pTxtLine1.get();
- ResetArabicContext();
-}
+CFX_TxtBreak::CFX_TxtBreak()
+ : CFX_Break(FX_LAYOUTSTYLE_None),
+ m_iAlignment(CFX_TxtLineAlignment_Left),
+ m_iCombWidth(360000) {}
-CFX_TxtBreak::~CFX_TxtBreak() {
- Reset();
-}
+CFX_TxtBreak::~CFX_TxtBreak() {}
-void CFX_TxtBreak::SetLineWidth(FX_FLOAT fLineWidth) {
+void CFX_TxtBreak::SetLineWidth(float fLineWidth) {
m_iLineWidth = FXSYS_round(fLineWidth * 20000.0f);
ASSERT(m_iLineWidth >= 20000);
}
-void CFX_TxtBreak::SetLinePos(FX_FLOAT fLinePos) {
- int32_t iLinePos =
- std::min(std::max(FXSYS_round(fLinePos * 20000.0f), 0), m_iLineWidth);
- m_pCurLine->m_iStart = iLinePos;
- m_pCurLine->m_iWidth += iLinePos;
-}
-
-void CFX_TxtBreak::SetLayoutStyles(uint32_t dwLayoutStyles) {
- m_dwLayoutStyles = dwLayoutStyles;
- m_bVertical = (m_dwLayoutStyles & FX_TXTLAYOUTSTYLE_VerticalChars) != 0;
- m_bArabicContext = (m_dwLayoutStyles & FX_TXTLAYOUTSTYLE_ArabicContext) != 0;
- m_bArabicShapes = (m_dwLayoutStyles & FX_TXTLAYOUTSTYLE_ArabicShapes) != 0;
- m_bRTL = (m_dwLayoutStyles & FX_TXTLAYOUTSTYLE_RTLReadingOrder) != 0;
- m_bSingleLine = (m_dwLayoutStyles & FX_TXTLAYOUTSTYLE_SingleLine) != 0;
- m_bCombText = (m_dwLayoutStyles & FX_TXTLAYOUTSTYLE_CombText) != 0;
- ResetArabicContext();
- m_iLineRotation = GetLineRotation(m_dwLayoutStyles);
- m_iRotation = m_iLineRotation + m_iCharRotation;
- m_iRotation %= 4;
-}
-
-void CFX_TxtBreak::SetFont(const CFX_RetainPtr<CFGAS_GEFont>& pFont) {
- if (!pFont || pFont == m_pFont)
- return;
-
- SetBreakStatus();
- m_pFont = pFont;
- FontChanged();
-}
-
-void CFX_TxtBreak::SetFontSize(FX_FLOAT fFontSize) {
- int32_t iFontSize = FXSYS_round(fFontSize * 20.0f);
- if (m_iFontSize == iFontSize)
- return;
-
- SetBreakStatus();
- m_iFontSize = iFontSize;
- FontChanged();
-}
-
-void CFX_TxtBreak::FontChanged() {
- m_iDefChar = 0;
- if (m_wDefChar == 0xFEFF || !m_pFont)
- return;
-
- m_pFont->GetCharWidth(m_wDefChar, m_iDefChar, false);
- m_iDefChar *= m_iFontSize;
-}
-
-void CFX_TxtBreak::SetTabWidth(FX_FLOAT fTabWidth, bool bEquidistant) {
- m_iTabWidth = FXSYS_round(fTabWidth * 20000.0f);
- if (m_iTabWidth < FX_TXTBREAK_MinimumTabWidth)
- m_iTabWidth = FX_TXTBREAK_MinimumTabWidth;
-
- m_bEquidistant = bEquidistant;
-}
-
-void CFX_TxtBreak::SetDefaultChar(FX_WCHAR wch) {
- m_wDefChar = wch;
- m_iDefChar = 0;
- if (m_wDefChar == 0xFEFF || !m_pFont)
- return;
-
- m_pFont->GetCharWidth(m_wDefChar, m_iDefChar, false);
- if (m_iDefChar < 0)
- m_iDefChar = 0;
- else
- m_iDefChar *= m_iFontSize;
-}
-
-void CFX_TxtBreak::SetParagraphBreakChar(FX_WCHAR wch) {
- if (wch != L'\r' && wch != L'\n')
- return;
- m_wParagBreakChar = wch;
-}
-
-void CFX_TxtBreak::SetLineBreakTolerance(FX_FLOAT fTolerance) {
- m_iTolerance = FXSYS_round(fTolerance * 20000.0f);
-}
-
-void CFX_TxtBreak::SetCharRotation(int32_t iCharRotation) {
- if (iCharRotation < 0)
- iCharRotation += (-iCharRotation / 4 + 1) * 4;
- else if (iCharRotation > 3)
- iCharRotation -= (iCharRotation / 4) * 4;
-
- if (m_iCharRotation == iCharRotation)
- return;
-
- SetBreakStatus();
- m_iCharRotation = iCharRotation;
- m_iRotation = m_iLineRotation + m_iCharRotation;
- m_iRotation %= 4;
-}
void CFX_TxtBreak::SetAlignment(int32_t iAlignment) {
- ASSERT(iAlignment >= FX_TXTLINEALIGNMENT_Left &&
- iAlignment <= FX_TXTLINEALIGNMENT_Distributed);
+ ASSERT(iAlignment >= CFX_TxtLineAlignment_Left &&
+ iAlignment <= CFX_TxtLineAlignment_Justified);
m_iAlignment = iAlignment;
- ResetArabicContext();
}
-void CFX_TxtBreak::ResetContextCharStyles() {
- m_dwContextCharStyles = m_bArabicContext ? m_iCurAlignment : m_iAlignment;
- if (m_bArabicNumber)
- m_dwContextCharStyles |= FX_TXTCHARSTYLE_ArabicNumber;
- if (m_bArabicComma)
- m_dwContextCharStyles |= FX_TXTCHARSTYLE_ArabicComma;
- if ((m_bArabicContext && m_bCurRTL) || (!m_bArabicContext && m_bRTL))
- m_dwContextCharStyles |= FX_TXTCHARSTYLE_RTLReadingOrder;
- m_dwContextCharStyles |= (m_iArabicContext << 8);
-}
-
-void CFX_TxtBreak::SetCombWidth(FX_FLOAT fCombWidth) {
+void CFX_TxtBreak::SetCombWidth(float fCombWidth) {
m_iCombWidth = FXSYS_round(fCombWidth * 20000.0f);
}
-void CFX_TxtBreak::SetUserData(void* pUserData) {
- if (m_pUserData == pUserData)
- return;
-
- SetBreakStatus();
- m_pUserData = pUserData;
-}
-
-void CFX_TxtBreak::SetBreakStatus() {
- if (m_bPagination)
- return;
-
- int32_t iCount = m_pCurLine->CountChars();
- if (iCount < 1)
- return;
-
- CFX_TxtChar* pTC = m_pCurLine->GetCharPtr(iCount - 1);
- if (pTC->m_dwStatus == 0)
- pTC->m_dwStatus = FX_TXTBREAK_PieceBreak;
-}
-
-void CFX_TxtBreak::SetHorizontalScale(int32_t iScale) {
- if (iScale < 0)
- iScale = 0;
- if (iScale == m_iHorScale)
- return;
-
- SetBreakStatus();
- m_iHorScale = iScale;
-}
-
-void CFX_TxtBreak::SetCharSpace(FX_FLOAT fCharSpace) {
- m_iCharSpace = FXSYS_round(fCharSpace * 20000.0f);
-}
-
-static const int32_t gs_FX_TxtLineRotations[8] = {0, 3, 1, 0, 2, 1, 3, 2};
-
-int32_t CFX_TxtBreak::GetLineRotation(uint32_t dwStyles) const {
- return gs_FX_TxtLineRotations[(dwStyles & 0x0E) >> 1];
-}
-
-CFX_TxtChar* CFX_TxtBreak::GetLastChar(int32_t index, bool bOmitChar) const {
- std::vector<CFX_TxtChar>& ca = *m_pCurLine->m_pLineChars.get();
- int32_t iCount = pdfium::CollectionSize<int32_t>(ca);
- if (index < 0 || index >= iCount)
- return nullptr;
-
- int32_t iStart = iCount - 1;
- while (iStart > -1) {
- CFX_TxtChar* pTC = &ca[iStart--];
- if (bOmitChar && pTC->GetCharType() == FX_CHARTYPE_Combination)
- continue;
- if (--index < 0)
- return pTC;
- }
- return nullptr;
-}
-
-CFX_TxtLine* CFX_TxtBreak::GetTxtLine() const {
- if (m_iReady == 1)
- return m_pTxtLine1.get();
- if (m_iReady == 2)
- return m_pTxtLine2.get();
- return nullptr;
-}
-
-CFX_TxtPieceArray* CFX_TxtBreak::GetTxtPieces() const {
- CFX_TxtLine* pTxtLine = GetTxtLine();
- return pTxtLine ? pTxtLine->m_pLinePieces.get() : nullptr;
+void CFX_TxtBreak::AppendChar_PageLoad(CFX_Char* pCurChar, uint32_t dwProps) {
+ pCurChar->m_dwStatus = CFX_BreakType::None;
+ pCurChar->m_dwCharStyles = m_iAlignment | (1 << 8);
}
-inline FX_CHARTYPE CFX_TxtBreak::GetUnifiedCharType(
- FX_CHARTYPE chartype) const {
- return chartype >= FX_CHARTYPE_ArabicAlef ? FX_CHARTYPE_Arabic : chartype;
-}
-
-void CFX_TxtBreak::ResetArabicContext() {
- if (m_bArabicContext) {
- m_bCurRTL = m_iCurArabicContext > 1;
- m_iCurAlignment = m_iCurArabicContext > 1 ? FX_TXTLINEALIGNMENT_Right
- : FX_TXTLINEALIGNMENT_Left;
- m_iCurAlignment |= (m_iAlignment & FX_TXTLINEALIGNMENT_HigherMask);
- m_bArabicNumber = m_iArabicContext >= 1 && m_bArabicShapes;
- } else {
- if (m_bPagination) {
- m_bCurRTL = false;
- m_iCurAlignment = 0;
- } else {
- m_bCurRTL = m_bRTL;
- m_iCurAlignment = m_iAlignment;
- }
- if (m_bRTL)
- m_bArabicNumber = m_iArabicContext >= 1;
- else
- m_bArabicNumber = m_iArabicContext > 1;
- m_bArabicNumber = m_bArabicNumber && m_bArabicShapes;
- }
- m_bArabicComma = m_bArabicNumber;
- ResetContextCharStyles();
-}
-
-void CFX_TxtBreak::AppendChar_PageLoad(CFX_TxtChar* pCurChar,
- uint32_t dwProps) {
- if (!m_bPagination) {
- pCurChar->m_dwStatus = 0;
- pCurChar->m_pUserData = m_pUserData;
- }
- if (m_bArabicContext || m_bArabicShapes) {
- int32_t iBidiCls = (dwProps & FX_BIDICLASSBITSMASK) >> FX_BIDICLASSBITS;
- int32_t iArabicContext =
- (iBidiCls == FX_BIDICLASS_R || iBidiCls == FX_BIDICLASS_AL)
- ? 2
- : ((iBidiCls == FX_BIDICLASS_L || iBidiCls == FX_BIDICLASS_S) ? 0
- : 1);
- if (iArabicContext != m_iArabicContext && iArabicContext != 1) {
- m_iArabicContext = iArabicContext;
- if (m_iCurArabicContext == 1)
- m_iCurArabicContext = iArabicContext;
-
- ResetArabicContext();
- if (!m_bPagination) {
- CFX_TxtChar* pLastChar = GetLastChar(1, false);
- if (pLastChar && pLastChar->m_dwStatus < 1)
- pLastChar->m_dwStatus = FX_TXTBREAK_PieceBreak;
- }
- }
- }
- pCurChar->m_dwCharStyles = m_dwContextCharStyles;
-}
-
-uint32_t CFX_TxtBreak::AppendChar_Combination(CFX_TxtChar* pCurChar,
- int32_t iRotation) {
- FX_WCHAR wch = pCurChar->m_wCharCode;
- FX_WCHAR wForm;
+void CFX_TxtBreak::AppendChar_Combination(CFX_Char* pCurChar) {
+ wchar_t wch = pCurChar->m_wCharCode;
+ wchar_t wForm;
int32_t iCharWidth = 0;
pCurChar->m_iCharWidth = -1;
if (m_bCombText) {
iCharWidth = m_iCombWidth;
} else {
- if (m_bVertical != FX_IsOdd(iRotation)) {
- iCharWidth = 1000;
- } else {
- wForm = wch;
- if (!m_bPagination) {
- CFX_TxtChar* pLastChar = GetLastChar(0, false);
- if (pLastChar &&
- (pLastChar->m_dwCharStyles & FX_TXTCHARSTYLE_ArabicShadda) == 0) {
- bool bShadda = false;
- if (wch == 0x0651) {
- FX_WCHAR wLast = pLastChar->m_wCharCode;
- if (wLast >= 0x064C && wLast <= 0x0650) {
- wForm = FX_GetArabicFromShaddaTable(wLast);
- bShadda = true;
- }
- } else if (wch >= 0x064C && wch <= 0x0650) {
- if (pLastChar->m_wCharCode == 0x0651) {
- wForm = FX_GetArabicFromShaddaTable(wch);
- bShadda = true;
- }
- }
- if (bShadda) {
- pLastChar->m_dwCharStyles |= FX_TXTCHARSTYLE_ArabicShadda;
- pLastChar->m_iCharWidth = 0;
- pCurChar->m_dwCharStyles |= FX_TXTCHARSTYLE_ArabicShadda;
- }
+ wForm = wch;
+ CFX_Char* pLastChar = GetLastChar(0, false, false);
+ if (pLastChar &&
+ (pLastChar->m_dwCharStyles & FX_TXTCHARSTYLE_ArabicShadda) == 0) {
+ bool bShadda = false;
+ if (wch == 0x0651) {
+ wchar_t wLast = pLastChar->m_wCharCode;
+ if (wLast >= 0x064C && wLast <= 0x0650) {
+ wForm = FX_GetArabicFromShaddaTable(wLast);
+ bShadda = true;
+ }
+ } else if (wch >= 0x064C && wch <= 0x0650) {
+ if (pLastChar->m_wCharCode == 0x0651) {
+ wForm = FX_GetArabicFromShaddaTable(wch);
+ bShadda = true;
}
}
- if (!m_pFont->GetCharWidth(wForm, iCharWidth, false))
- iCharWidth = 0;
+ if (bShadda) {
+ pLastChar->m_dwCharStyles |= FX_TXTCHARSTYLE_ArabicShadda;
+ pLastChar->m_iCharWidth = 0;
+ pCurChar->m_dwCharStyles |= FX_TXTCHARSTYLE_ArabicShadda;
+ }
}
+ if (!m_pFont->GetCharWidth(wForm, iCharWidth, false))
+ iCharWidth = 0;
+
iCharWidth *= m_iFontSize;
- iCharWidth = iCharWidth * m_iHorScale / 100;
+ iCharWidth = iCharWidth * m_iHorizontalScale / 100;
}
pCurChar->m_iCharWidth = -iCharWidth;
- return FX_TXTBREAK_None;
}
-uint32_t CFX_TxtBreak::AppendChar_Tab(CFX_TxtChar* pCurChar,
- int32_t iRotation) {
+void CFX_TxtBreak::AppendChar_Tab(CFX_Char* pCurChar) {
m_eCharType = FX_CHARTYPE_Tab;
- if ((m_dwLayoutStyles & FX_TXTLAYOUTSTYLE_ExpandTab) == 0)
- return FX_TXTBREAK_None;
-
- int32_t& iLineWidth = m_pCurLine->m_iWidth;
- int32_t iCharWidth;
- if (m_bCombText) {
- iCharWidth = m_iCombWidth;
- } else {
- if (m_bEquidistant) {
- iCharWidth = iLineWidth;
- iCharWidth = m_iTabWidth * (iCharWidth / m_iTabWidth + 1) - iCharWidth;
- if (iCharWidth < FX_TXTBREAK_MinimumTabWidth)
- iCharWidth += m_iTabWidth;
- } else {
- iCharWidth = m_iTabWidth;
- }
- }
-
- pCurChar->m_iCharWidth = iCharWidth;
- iLineWidth += iCharWidth;
- if (!m_bSingleLine && iLineWidth >= m_iLineWidth + m_iTolerance)
- return EndBreak(FX_TXTBREAK_LineBreak);
-
- return FX_TXTBREAK_None;
}
-uint32_t CFX_TxtBreak::AppendChar_Control(CFX_TxtChar* pCurChar,
- int32_t iRotation) {
+CFX_BreakType CFX_TxtBreak::AppendChar_Control(CFX_Char* pCurChar) {
m_eCharType = FX_CHARTYPE_Control;
- uint32_t dwRet = FX_TXTBREAK_None;
+ CFX_BreakType dwRet = CFX_BreakType::None;
if (!m_bSingleLine) {
- FX_WCHAR wch = pCurChar->m_wCharCode;
+ wchar_t wch = pCurChar->m_wCharCode;
switch (wch) {
case L'\v':
case 0x2028:
- dwRet = FX_TXTBREAK_LineBreak;
+ dwRet = CFX_BreakType::Line;
break;
case L'\f':
- dwRet = FX_TXTBREAK_PageBreak;
+ dwRet = CFX_BreakType::Page;
break;
case 0x2029:
- dwRet = FX_TXTBREAK_ParagraphBreak;
+ dwRet = CFX_BreakType::Paragraph;
break;
default:
- if (wch == m_wParagBreakChar)
- dwRet = FX_TXTBREAK_ParagraphBreak;
+ if (wch == m_wParagraphBreakChar)
+ dwRet = CFX_BreakType::Paragraph;
break;
}
- if (dwRet != FX_TXTBREAK_None)
+ if (dwRet != CFX_BreakType::None)
dwRet = EndBreak(dwRet);
}
return dwRet;
}
-uint32_t CFX_TxtBreak::AppendChar_Arabic(CFX_TxtChar* pCurChar,
- int32_t iRotation) {
+CFX_BreakType CFX_TxtBreak::AppendChar_Arabic(CFX_Char* pCurChar) {
FX_CHARTYPE chartype = pCurChar->GetCharType();
int32_t& iLineWidth = m_pCurLine->m_iWidth;
- FX_WCHAR wForm;
+ wchar_t wForm;
int32_t iCharWidth = 0;
- CFX_TxtChar* pLastChar = nullptr;
+ CFX_Char* pLastChar = nullptr;
bool bAlef = false;
if (!m_bCombText && m_eCharType >= FX_CHARTYPE_ArabicAlef &&
m_eCharType <= FX_CHARTYPE_ArabicDistortion) {
- pLastChar = GetLastChar(1);
+ pLastChar = GetLastChar(1, true, false);
if (pLastChar) {
iCharWidth = pLastChar->m_iCharWidth;
if (iCharWidth > 0)
iLineWidth -= iCharWidth;
- CFX_Char* pPrevChar = GetLastChar(2);
+ CFX_Char* pPrevChar = GetLastChar(2, true, false);
wForm = pdfium::arabic::GetFormChar(pLastChar, pPrevChar, pCurChar);
bAlef = (wForm == 0xFEFF &&
pLastChar->GetCharType() == FX_CHARTYPE_ArabicAlef);
- int32_t iLastRotation = pLastChar->m_nRotation + m_iLineRotation;
- if (m_bVertical && (pLastChar->m_dwCharProps & 0x8000) != 0)
- iLastRotation++;
- if (m_bVertical != FX_IsOdd(iLastRotation))
- iCharWidth = 1000;
- else
- m_pFont->GetCharWidth(wForm, iCharWidth, false);
+ m_pFont->GetCharWidth(wForm, iCharWidth, false);
if (wForm == 0xFEFF)
iCharWidth = m_iDefChar;
iCharWidth *= m_iFontSize;
- iCharWidth = iCharWidth * m_iHorScale / 100;
+ iCharWidth = iCharWidth * m_iHorizontalScale / 100;
pLastChar->m_iCharWidth = iCharWidth;
iLineWidth += iCharWidth;
iCharWidth = 0;
@@ -480,231 +160,152 @@ uint32_t CFX_TxtBreak::AppendChar_Arabic(CFX_TxtChar* pCurChar,
if (m_bCombText) {
iCharWidth = m_iCombWidth;
} else {
- if (m_bVertical != FX_IsOdd(iRotation))
- iCharWidth = 1000;
- else
- m_pFont->GetCharWidth(wForm, iCharWidth, false);
+ m_pFont->GetCharWidth(wForm, iCharWidth, false);
if (wForm == 0xFEFF)
iCharWidth = m_iDefChar;
iCharWidth *= m_iFontSize;
- iCharWidth = iCharWidth * m_iHorScale / 100;
+ iCharWidth = iCharWidth * m_iHorizontalScale / 100;
}
pCurChar->m_iCharWidth = iCharWidth;
iLineWidth += iCharWidth;
m_pCurLine->m_iArabicChars++;
if (!m_bSingleLine && iLineWidth > m_iLineWidth + m_iTolerance)
- return EndBreak(FX_TXTBREAK_LineBreak);
- return FX_TXTBREAK_None;
+ return EndBreak(CFX_BreakType::Line);
+ return CFX_BreakType::None;
}
-uint32_t CFX_TxtBreak::AppendChar_Others(CFX_TxtChar* pCurChar,
- int32_t iRotation) {
- uint32_t dwProps = pCurChar->m_dwCharProps;
+CFX_BreakType CFX_TxtBreak::AppendChar_Others(CFX_Char* pCurChar) {
FX_CHARTYPE chartype = pCurChar->GetCharType();
int32_t& iLineWidth = m_pCurLine->m_iWidth;
int32_t iCharWidth = 0;
m_eCharType = chartype;
- FX_WCHAR wch = pCurChar->m_wCharCode;
- FX_WCHAR wForm = wch;
- if (chartype == FX_CHARTYPE_Numeric) {
- if (m_bArabicNumber) {
- wForm = wch + 0x0630;
- pCurChar->m_dwCharStyles |= FX_TXTCHARSTYLE_ArabicIndic;
- }
- } else if (wch == L',') {
- if (m_bArabicShapes && m_iCurArabicContext > 0) {
- wForm = 0x060C;
- pCurChar->m_dwCharStyles |= FX_TXTCHARSTYLE_ArabicComma;
- }
- } else if (m_bCurRTL || m_bVertical) {
- wForm = FX_GetMirrorChar(wch, dwProps, m_bCurRTL, m_bVertical);
- }
+ wchar_t wch = pCurChar->m_wCharCode;
+ wchar_t wForm = wch;
if (m_bCombText) {
iCharWidth = m_iCombWidth;
} else {
- if (m_bVertical != FX_IsOdd(iRotation))
- iCharWidth = 1000;
- else if (!m_pFont->GetCharWidth(wForm, iCharWidth, false))
+ if (!m_pFont->GetCharWidth(wForm, iCharWidth, false))
iCharWidth = m_iDefChar;
iCharWidth *= m_iFontSize;
- iCharWidth = iCharWidth * m_iHorScale / 100;
+ iCharWidth = iCharWidth * m_iHorizontalScale / 100;
}
iCharWidth += m_iCharSpace;
pCurChar->m_iCharWidth = iCharWidth;
iLineWidth += iCharWidth;
- bool bBreak = (chartype != FX_CHARTYPE_Space ||
- (m_dwPolicies & FX_TXTBREAKPOLICY_SpaceBreak) != 0);
- if (!m_bSingleLine && bBreak && iLineWidth > m_iLineWidth + m_iTolerance)
- return EndBreak(FX_TXTBREAK_LineBreak);
+ if (!m_bSingleLine && chartype != FX_CHARTYPE_Space &&
+ iLineWidth > m_iLineWidth + m_iTolerance) {
+ return EndBreak(CFX_BreakType::Line);
+ }
- return FX_TXTBREAK_None;
+ return CFX_BreakType::None;
}
-uint32_t CFX_TxtBreak::AppendChar(FX_WCHAR wch) {
+CFX_BreakType CFX_TxtBreak::AppendChar(wchar_t wch) {
uint32_t dwProps = kTextLayoutCodeProperties[static_cast<uint16_t>(wch)];
FX_CHARTYPE chartype = GetCharTypeFromProp(dwProps);
- m_pCurLine->m_pLineChars->emplace_back();
+ m_pCurLine->m_LineChars.emplace_back();
- CFX_TxtChar* pCurChar = &m_pCurLine->m_pLineChars->back();
+ CFX_Char* pCurChar = &m_pCurLine->m_LineChars.back();
pCurChar->m_wCharCode = static_cast<uint16_t>(wch);
- pCurChar->m_nRotation = m_iCharRotation;
pCurChar->m_dwCharProps = dwProps;
pCurChar->m_dwCharStyles = 0;
pCurChar->m_iCharWidth = 0;
- pCurChar->m_iHorizontalScale = m_iHorScale;
- pCurChar->m_iVerticalScale = 100;
- pCurChar->m_dwStatus = 0;
+ pCurChar->m_iHorizontalScale = m_iHorizontalScale;
+ pCurChar->m_iVerticalScale = m_iVerticalScale;
+ pCurChar->m_dwStatus = CFX_BreakType::None;
pCurChar->m_iBidiClass = 0;
pCurChar->m_iBidiLevel = 0;
pCurChar->m_iBidiPos = 0;
pCurChar->m_iBidiOrder = 0;
- pCurChar->m_pUserData = nullptr;
+
AppendChar_PageLoad(pCurChar, dwProps);
- uint32_t dwRet1 = FX_TXTBREAK_None;
+ CFX_BreakType dwRet1 = CFX_BreakType::None;
if (chartype != FX_CHARTYPE_Combination &&
GetUnifiedCharType(m_eCharType) != GetUnifiedCharType(chartype) &&
m_eCharType != FX_CHARTYPE_Unknown &&
m_pCurLine->m_iWidth > m_iLineWidth + m_iTolerance && !m_bSingleLine &&
(m_eCharType != FX_CHARTYPE_Space || chartype != FX_CHARTYPE_Control)) {
- dwRet1 = EndBreak(FX_TXTBREAK_LineBreak);
+ dwRet1 = EndBreak(CFX_BreakType::Line);
int32_t iCount = m_pCurLine->CountChars();
if (iCount > 0)
- pCurChar = &(*m_pCurLine->m_pLineChars)[iCount - 1];
+ pCurChar = &m_pCurLine->m_LineChars[iCount - 1];
}
- int32_t iRotation = m_iRotation;
- if (m_bVertical && (dwProps & 0x8000) != 0)
- iRotation = (iRotation + 1) % 4;
+ CFX_BreakType dwRet2 = CFX_BreakType::None;
+ switch (chartype) {
+ case FX_CHARTYPE_Tab:
+ AppendChar_Tab(pCurChar);
+ break;
+ case FX_CHARTYPE_Control:
+ dwRet2 = AppendChar_Control(pCurChar);
+ break;
+ case FX_CHARTYPE_Combination:
+ AppendChar_Combination(pCurChar);
+ break;
+ case FX_CHARTYPE_ArabicAlef:
+ case FX_CHARTYPE_ArabicSpecial:
+ case FX_CHARTYPE_ArabicDistortion:
+ case FX_CHARTYPE_ArabicNormal:
+ case FX_CHARTYPE_ArabicForm:
+ case FX_CHARTYPE_Arabic:
+ dwRet2 = AppendChar_Arabic(pCurChar);
+ break;
+ case FX_CHARTYPE_Unknown:
+ case FX_CHARTYPE_Space:
+ case FX_CHARTYPE_Numeric:
+ case FX_CHARTYPE_Normal:
+ default:
+ dwRet2 = AppendChar_Others(pCurChar);
+ break;
+ }
- uint32_t dwRet2 =
- (this->*g_FX_TxtBreak_lpfAppendChar[chartype >> FX_CHARTYPEBITS])(
- pCurChar, iRotation);
return std::max(dwRet1, dwRet2);
}
-void CFX_TxtBreak::EndBreak_UpdateArabicShapes() {
- ASSERT(m_bArabicShapes);
- int32_t iCount = m_pCurLine->CountChars();
- if (iCount < 2)
- return;
-
- int32_t& iLineWidth = m_pCurLine->m_iWidth;
- CFX_TxtChar* pCur = m_pCurLine->GetCharPtr(0);
- bool bPrevNum = (pCur->m_dwCharStyles & FX_TXTCHARSTYLE_ArabicIndic) != 0;
- pCur = m_pCurLine->GetCharPtr(1);
- FX_WCHAR wch, wForm;
- bool bNextNum;
- int32_t i = 1;
- int32_t iCharWidth;
- int32_t iRotation;
- CFX_TxtChar* pNext;
- do {
- i++;
- if (i < iCount) {
- pNext = m_pCurLine->GetCharPtr(i);
- bNextNum = (pNext->m_dwCharStyles & FX_TXTCHARSTYLE_ArabicIndic) != 0;
- } else {
- pNext = nullptr;
- bNextNum = false;
- }
-
- wch = pCur->m_wCharCode;
- if (wch == L'.') {
- if (bPrevNum && bNextNum) {
- iRotation = m_iRotation;
- if (m_bVertical && (pCur->m_dwCharProps & 0x8000) != 0)
- iRotation = ((iRotation + 1) & 0x03);
-
- wForm = wch == L'.' ? 0x066B : 0x066C;
- iLineWidth -= pCur->m_iCharWidth;
- if (m_bCombText) {
- iCharWidth = m_iCombWidth;
- } else {
- if (m_bVertical != FX_IsOdd(iRotation))
- iCharWidth = 1000;
- else if (!m_pFont->GetCharWidth(wForm, iCharWidth, false))
- iCharWidth = m_iDefChar;
-
- iCharWidth *= m_iFontSize;
- iCharWidth = iCharWidth * m_iHorScale / 100;
- }
- pCur->m_iCharWidth = iCharWidth;
- iLineWidth += iCharWidth;
- }
- }
- bPrevNum = (pCur->m_dwCharStyles & FX_TXTCHARSTYLE_ArabicIndic) != 0;
- pCur = pNext;
- } while (i < iCount);
-}
-
-bool CFX_TxtBreak::EndBreak_SplitLine(CFX_TxtLine* pNextLine,
- bool bAllChars,
- uint32_t dwStatus) {
+bool CFX_TxtBreak::EndBreak_SplitLine(CFX_BreakLine* pNextLine,
+ bool bAllChars) {
int32_t iCount = m_pCurLine->CountChars();
bool bDone = false;
- CFX_TxtChar* pTC;
+ CFX_Char* pTC;
if (!m_bSingleLine && m_pCurLine->m_iWidth > m_iLineWidth + m_iTolerance) {
- pTC = m_pCurLine->GetCharPtr(iCount - 1);
+ pTC = m_pCurLine->GetChar(iCount - 1);
switch (pTC->GetCharType()) {
case FX_CHARTYPE_Tab:
case FX_CHARTYPE_Control:
- break;
case FX_CHARTYPE_Space:
- if ((m_dwPolicies & FX_TXTBREAKPOLICY_SpaceBreak) != 0) {
- SplitTextLine(m_pCurLine, pNextLine, !m_bPagination && bAllChars);
- bDone = true;
- }
break;
default:
- SplitTextLine(m_pCurLine, pNextLine, !m_bPagination && bAllChars);
+ SplitTextLine(m_pCurLine, pNextLine, bAllChars);
bDone = true;
break;
}
}
iCount = m_pCurLine->CountChars();
- CFX_TxtPieceArray* pCurPieces = m_pCurLine->m_pLinePieces.get();
- CFX_TxtPiece tp;
- if (m_bPagination) {
- tp.m_dwStatus = dwStatus;
- tp.m_iStartPos = m_pCurLine->m_iStart;
- tp.m_iWidth = m_pCurLine->m_iWidth;
- tp.m_iStartChar = 0;
- tp.m_iChars = iCount;
- tp.m_pChars = m_pCurLine->m_pLineChars.get();
- tp.m_pUserData = m_pUserData;
- pTC = m_pCurLine->GetCharPtr(0);
- tp.m_dwCharStyles = pTC->m_dwCharStyles;
- tp.m_iHorizontalScale = pTC->m_iHorizontalScale;
- tp.m_iVerticalScale = pTC->m_iVerticalScale;
- pCurPieces->Add(tp);
- m_pCurLine = pNextLine;
- m_eCharType = FX_CHARTYPE_Unknown;
- return true;
- }
+ CFX_BreakPiece tp;
if (bAllChars && !bDone) {
int32_t iEndPos = m_pCurLine->m_iWidth;
- GetBreakPos(*m_pCurLine->m_pLineChars.get(), iEndPos, bAllChars, true);
+ GetBreakPos(m_pCurLine->m_LineChars, iEndPos, bAllChars, true);
}
return false;
}
void CFX_TxtBreak::EndBreak_BidiLine(std::deque<FX_TPO>* tpos,
- uint32_t dwStatus) {
- CFX_TxtPiece tp;
+ CFX_BreakType dwStatus) {
+ CFX_BreakPiece tp;
FX_TPO tpo;
- CFX_TxtChar* pTC;
+ CFX_Char* pTC;
int32_t i;
int32_t j;
- std::vector<CFX_TxtChar>& chars = *m_pCurLine->m_pLineChars.get();
+ std::vector<CFX_Char>& chars = m_pCurLine->m_LineChars;
int32_t iCount = m_pCurLine->CountChars();
- bool bDone = (m_pCurLine->m_iArabicChars > 0 || m_bCurRTL);
- if (!m_bPagination && bDone) {
+ bool bDone = m_pCurLine->m_iArabicChars > 0;
+ if (bDone) {
int32_t iBidiNum = 0;
for (i = 0; i < iCount; i++) {
pTC = &chars[i];
@@ -714,15 +315,13 @@ void CFX_TxtBreak::EndBreak_BidiLine(std::deque<FX_TPO>* tpos,
if (i == 0)
pTC->m_iBidiLevel = 1;
}
- FX_BidiLine(chars, iBidiNum + 1, m_bCurRTL ? 1 : 0);
+ FX_BidiLine(&chars, iBidiNum + 1);
}
- CFX_TxtPieceArray* pCurPieces = m_pCurLine->m_pLinePieces.get();
- if (!m_bPagination &&
- (bDone || (m_dwLayoutStyles & FX_TXTLAYOUTSTYLE_MutipleFormat) != 0)) {
- tp.m_dwStatus = FX_TXTBREAK_PieceBreak;
+ if (bDone) {
+ tp.m_dwStatus = CFX_BreakType::Piece;
tp.m_iStartPos = m_pCurLine->m_iStart;
- tp.m_pChars = m_pCurLine->m_pLineChars.get();
+ tp.m_pChars = &m_pCurLine->m_LineChars;
int32_t iBidiLevel = -1;
int32_t iCharWidth;
i = 0;
@@ -735,12 +334,12 @@ void CFX_TxtBreak::EndBreak_BidiLine(std::deque<FX_TPO>* tpos,
tp.m_iBidiLevel = iBidiLevel;
tp.m_iBidiPos = pTC->m_iBidiOrder;
tp.m_dwCharStyles = pTC->m_dwCharStyles;
- tp.m_pUserData = pTC->m_pUserData;
tp.m_iHorizontalScale = pTC->m_iHorizontalScale;
tp.m_iVerticalScale = pTC->m_iVerticalScale;
- tp.m_dwStatus = FX_TXTBREAK_PieceBreak;
+ tp.m_dwStatus = CFX_BreakType::Piece;
}
- if (iBidiLevel != pTC->m_iBidiLevel || pTC->m_dwStatus != 0) {
+ if (iBidiLevel != pTC->m_iBidiLevel ||
+ pTC->m_dwStatus != CFX_BreakType::None) {
if (iBidiLevel == pTC->m_iBidiLevel) {
tp.m_dwStatus = pTC->m_dwStatus;
iCharWidth = pTC->m_iCharWidth;
@@ -750,7 +349,7 @@ void CFX_TxtBreak::EndBreak_BidiLine(std::deque<FX_TPO>* tpos,
i++;
}
tp.m_iChars = i - tp.m_iStartChar;
- pCurPieces->Add(tp);
+ m_pCurLine->m_LinePieces.push_back(tp);
tp.m_iStartPos += tp.m_iWidth;
tp.m_iStartChar = i;
tpo.index = ++j;
@@ -768,7 +367,7 @@ void CFX_TxtBreak::EndBreak_BidiLine(std::deque<FX_TPO>* tpos,
if (i > tp.m_iStartChar) {
tp.m_dwStatus = dwStatus;
tp.m_iChars = i - tp.m_iStartChar;
- pCurPieces->Add(tp);
+ m_pCurLine->m_LinePieces.push_back(tp);
tpo.index = ++j;
tpo.pos = tp.m_iBidiPos;
tpos->push_back(tpo);
@@ -779,13 +378,12 @@ void CFX_TxtBreak::EndBreak_BidiLine(std::deque<FX_TPO>* tpos,
int32_t iStartPos = 0;
for (i = 0; i <= j; i++) {
tpo = (*tpos)[i];
- CFX_TxtPiece& ttp = pCurPieces->GetAt(tpo.index);
+ CFX_BreakPiece& ttp = m_pCurLine->m_LinePieces[tpo.index];
ttp.m_iStartPos = iStartPos;
iStartPos += ttp.m_iWidth;
}
}
- CFX_TxtPiece& ttp = pCurPieces->GetAt(j);
- ttp.m_dwStatus = dwStatus;
+ m_pCurLine->m_LinePieces[j].m_dwStatus = dwStatus;
}
} else {
tp.m_dwStatus = dwStatus;
@@ -793,51 +391,38 @@ void CFX_TxtBreak::EndBreak_BidiLine(std::deque<FX_TPO>* tpos,
tp.m_iWidth = m_pCurLine->m_iWidth;
tp.m_iStartChar = 0;
tp.m_iChars = iCount;
- tp.m_pChars = m_pCurLine->m_pLineChars.get();
- tp.m_pUserData = m_pUserData;
+ tp.m_pChars = &m_pCurLine->m_LineChars;
pTC = &chars[0];
tp.m_dwCharStyles = pTC->m_dwCharStyles;
tp.m_iHorizontalScale = pTC->m_iHorizontalScale;
tp.m_iVerticalScale = pTC->m_iVerticalScale;
- pCurPieces->Add(tp);
+ m_pCurLine->m_LinePieces.push_back(tp);
tpos->push_back({0, 0});
}
}
void CFX_TxtBreak::EndBreak_Alignment(const std::deque<FX_TPO>& tpos,
bool bAllChars,
- uint32_t dwStatus) {
+ CFX_BreakType dwStatus) {
int32_t iNetWidth = m_pCurLine->m_iWidth;
int32_t iGapChars = 0;
- int32_t iCharWidth;
- CFX_TxtPieceArray* pCurPieces = m_pCurLine->m_pLinePieces.get();
- int32_t i;
- int32_t j;
- int32_t iCount = pCurPieces->GetSize();
bool bFind = false;
- FX_TPO tpo;
- CFX_TxtChar* pTC;
- FX_CHARTYPE chartype;
- for (i = iCount - 1; i > -1; i--) {
- tpo = tpos[i];
- CFX_TxtPiece& ttp = pCurPieces->GetAt(tpo.index);
+ for (auto it = tpos.rbegin(); it != tpos.rend(); ++it) {
+ CFX_BreakPiece& ttp = m_pCurLine->m_LinePieces[it->index];
if (!bFind)
iNetWidth = ttp.GetEndPos();
bool bArabic = FX_IsOdd(ttp.m_iBidiLevel);
- j = bArabic ? 0 : ttp.m_iChars - 1;
+ int32_t j = bArabic ? 0 : ttp.m_iChars - 1;
while (j > -1 && j < ttp.m_iChars) {
- pTC = ttp.GetCharPtr(j);
+ const CFX_Char* pTC = ttp.GetChar(j);
if (pTC->m_nBreakType == FX_LBT_DIRECT_BRK)
iGapChars++;
if (!bFind || !bAllChars) {
- chartype = pTC->GetCharType();
+ FX_CHARTYPE chartype = pTC->GetCharType();
if (chartype == FX_CHARTYPE_Space || chartype == FX_CHARTYPE_Control) {
- if (!bFind) {
- iCharWidth = pTC->m_iCharWidth;
- if (bAllChars && iCharWidth > 0)
- iNetWidth -= iCharWidth;
- }
+ if (!bFind && bAllChars && pTC->m_iCharWidth > 0)
+ iNetWidth -= pTC->m_iCharWidth;
} else {
bFind = true;
if (!bAllChars)
@@ -851,22 +436,18 @@ void CFX_TxtBreak::EndBreak_Alignment(const std::deque<FX_TPO>& tpos,
}
int32_t iOffset = m_iLineWidth - iNetWidth;
- int32_t iLowerAlignment = (m_iCurAlignment & FX_TXTLINEALIGNMENT_LowerMask);
- int32_t iHigherAlignment = (m_iCurAlignment & FX_TXTLINEALIGNMENT_HigherMask);
- if (iGapChars > 0 && (iHigherAlignment == FX_TXTLINEALIGNMENT_Distributed ||
- (iHigherAlignment == FX_TXTLINEALIGNMENT_Justified &&
- dwStatus != FX_TXTBREAK_ParagraphBreak))) {
+ if (iGapChars > 0 && m_iAlignment & CFX_TxtLineAlignment_Justified &&
+ dwStatus != CFX_BreakType::Paragraph) {
int32_t iStart = -1;
- for (i = 0; i < iCount; i++) {
- tpo = tpos[i];
- CFX_TxtPiece& ttp = pCurPieces->GetAt(tpo.index);
+ for (auto& tpo : tpos) {
+ CFX_BreakPiece& ttp = m_pCurLine->m_LinePieces[tpo.index];
if (iStart < -1)
iStart = ttp.m_iStartPos;
else
ttp.m_iStartPos = iStart;
- for (j = 0; j < ttp.m_iChars; j++) {
- pTC = ttp.GetCharPtr(j);
+ for (int32_t j = 0; j < ttp.m_iChars; j++) {
+ CFX_Char* pTC = ttp.GetChar(j);
if (pTC->m_nBreakType != FX_LBT_DIRECT_BRK || pTC->m_iCharWidth < 0)
continue;
@@ -880,82 +461,63 @@ void CFX_TxtBreak::EndBreak_Alignment(const std::deque<FX_TPO>& tpos,
}
iStart += ttp.m_iWidth;
}
- } else if (iLowerAlignment > FX_TXTLINEALIGNMENT_Left) {
- if (iLowerAlignment == FX_TXTLINEALIGNMENT_Center)
+ } else if (m_iAlignment & CFX_TxtLineAlignment_Center ||
+ m_iAlignment & CFX_TxtLineAlignment_Right) {
+ if (m_iAlignment & CFX_TxtLineAlignment_Center &&
+ !(m_iAlignment & CFX_TxtLineAlignment_Right)) {
iOffset /= 2;
+ }
if (iOffset > 0) {
- for (i = 0; i < iCount; i++) {
- CFX_TxtPiece& ttp = pCurPieces->GetAt(i);
+ for (auto& ttp : m_pCurLine->m_LinePieces)
ttp.m_iStartPos += iOffset;
- }
}
}
}
-uint32_t CFX_TxtBreak::EndBreak(uint32_t dwStatus) {
- ASSERT(dwStatus >= FX_TXTBREAK_PieceBreak &&
- dwStatus <= FX_TXTBREAK_PageBreak);
- CFX_TxtPieceArray* pCurPieces = m_pCurLine->m_pLinePieces.get();
- int32_t iCount = pCurPieces->GetSize();
- if (iCount > 0) {
- CFX_TxtPiece* pLastPiece = pCurPieces->GetPtrAt(--iCount);
- if (dwStatus > FX_TXTBREAK_PieceBreak)
- pLastPiece->m_dwStatus = dwStatus;
- else
- dwStatus = pLastPiece->m_dwStatus;
- return dwStatus;
- } else {
- CFX_TxtLine* pLastLine = GetTxtLine();
- if (pLastLine) {
- pCurPieces = pLastLine->m_pLinePieces.get();
- iCount = pCurPieces->GetSize();
- if (iCount-- > 0) {
- CFX_TxtPiece* pLastPiece = pCurPieces->GetPtrAt(iCount);
- if (dwStatus > FX_TXTBREAK_PieceBreak)
- pLastPiece->m_dwStatus = dwStatus;
- else
- dwStatus = pLastPiece->m_dwStatus;
- return dwStatus;
- }
- return FX_TXTBREAK_None;
- }
+CFX_BreakType CFX_TxtBreak::EndBreak(CFX_BreakType dwStatus) {
+ ASSERT(dwStatus != CFX_BreakType::None);
- iCount = m_pCurLine->CountChars();
- if (iCount < 1)
- return FX_TXTBREAK_None;
- if (!m_bPagination) {
- CFX_TxtChar* pTC = m_pCurLine->GetCharPtr(iCount - 1);
- pTC->m_dwStatus = dwStatus;
+ if (!m_pCurLine->m_LinePieces.empty()) {
+ if (dwStatus != CFX_BreakType::Piece)
+ m_pCurLine->m_LinePieces.back().m_dwStatus = dwStatus;
+ return m_pCurLine->m_LinePieces.back().m_dwStatus;
+ }
+
+ if (HasLine()) {
+ if (!m_Line[m_iReadyLineIndex].m_LinePieces.empty()) {
+ if (dwStatus != CFX_BreakType::Piece)
+ m_Line[m_iReadyLineIndex].m_LinePieces.back().m_dwStatus = dwStatus;
+ return m_Line[m_iReadyLineIndex].m_LinePieces.back().m_dwStatus;
}
- if (dwStatus <= FX_TXTBREAK_PieceBreak)
- return dwStatus;
+ return CFX_BreakType::None;
}
- m_iReady = (m_pCurLine == m_pTxtLine1.get()) ? 1 : 2;
- CFX_TxtLine* pNextLine =
- (m_pCurLine == m_pTxtLine1.get()) ? m_pTxtLine2.get() : m_pTxtLine1.get();
- bool bAllChars = (m_iCurAlignment > FX_TXTLINEALIGNMENT_Right);
- if (m_bArabicShapes)
- EndBreak_UpdateArabicShapes();
+ int32_t iCount = m_pCurLine->CountChars();
+ if (iCount < 1)
+ return CFX_BreakType::None;
- if (!EndBreak_SplitLine(pNextLine, bAllChars, dwStatus)) {
+ m_pCurLine->GetChar(iCount - 1)->m_dwStatus = dwStatus;
+ if (dwStatus == CFX_BreakType::Piece)
+ return dwStatus;
+
+ m_iReadyLineIndex = m_pCurLine == &m_Line[0] ? 0 : 1;
+ CFX_BreakLine* pNextLine = &m_Line[1 - m_iReadyLineIndex];
+ bool bAllChars = m_iAlignment > CFX_TxtLineAlignment_Right;
+ if (!EndBreak_SplitLine(pNextLine, bAllChars)) {
std::deque<FX_TPO> tpos;
EndBreak_BidiLine(&tpos, dwStatus);
- if (!m_bPagination && m_iCurAlignment > FX_TXTLINEALIGNMENT_Left)
+ if (m_iAlignment > CFX_TxtLineAlignment_Left)
EndBreak_Alignment(tpos, bAllChars, dwStatus);
}
m_pCurLine = pNextLine;
- CFX_Char* pTC = GetLastChar(0, false);
+ CFX_Char* pTC = GetLastChar(0, false, false);
m_eCharType = pTC ? pTC->GetCharType() : FX_CHARTYPE_Unknown;
- if (dwStatus == FX_TXTBREAK_ParagraphBreak) {
- m_iArabicContext = m_iCurArabicContext = 1;
- ResetArabicContext();
- }
+
return dwStatus;
}
-int32_t CFX_TxtBreak::GetBreakPos(std::vector<CFX_TxtChar>& ca,
+int32_t CFX_TxtBreak::GetBreakPos(std::vector<CFX_Char>& ca,
int32_t& iEndPos,
bool bAllChars,
bool bOnlyBrk) {
@@ -977,8 +539,6 @@ int32_t CFX_TxtBreak::GetBreakPos(std::vector<CFX_TxtChar>& ca,
iBreakPos = iEndPos;
}
- bool bSpaceBreak = (m_dwPolicies & FX_TXTBREAKPOLICY_SpaceBreak) != 0;
- bool bNumberBreak = (m_dwPolicies & FX_TXTBREAKPOLICY_NumberBreak) != 0;
FX_LINEBREAKTYPE eType;
uint32_t nCodeProp;
uint32_t nCur;
@@ -999,11 +559,9 @@ int32_t CFX_TxtBreak::GetBreakPos(std::vector<CFX_TxtChar>& ca,
nCur = nCodeProp & 0x003F;
if (nCur == FX_CBP_SP) {
if (nNext == FX_CBP_SP)
- eType = bSpaceBreak ? FX_LBT_DIRECT_BRK : FX_LBT_PROHIBITED_BRK;
+ eType = FX_LBT_PROHIBITED_BRK;
else
eType = gs_FX_LineBreak_PairTable[nCur][nNext];
- } else if (bNumberBreak && nCur == FX_CBP_NU && nNext == FX_CBP_NU) {
- eType = FX_LBT_DIRECT_BRK;
} else {
if (nNext == FX_CBP_SP)
eType = FX_LBT_PROHIBITED_BRK;
@@ -1013,8 +571,7 @@ int32_t CFX_TxtBreak::GetBreakPos(std::vector<CFX_TxtChar>& ca,
if (bAllChars)
pCur->m_nBreakType = static_cast<uint8_t>(eType);
if (!bOnlyBrk) {
- if (m_bSingleLine || iEndPos <= m_iLineWidth ||
- (nCur == FX_CBP_SP && !bSpaceBreak)) {
+ if (m_bSingleLine || iEndPos <= m_iLineWidth || nCur == FX_CBP_SP) {
if (eType == FX_LBT_DIRECT_BRK && iBreak < 0) {
iBreak = iLength;
iBreakPos = iEndPos;
@@ -1053,8 +610,8 @@ int32_t CFX_TxtBreak::GetBreakPos(std::vector<CFX_TxtChar>& ca,
return 0;
}
-void CFX_TxtBreak::SplitTextLine(CFX_TxtLine* pCurLine,
- CFX_TxtLine* pNextLine,
+void CFX_TxtBreak::SplitTextLine(CFX_BreakLine* pCurLine,
+ CFX_BreakLine* pNextLine,
bool bAllChars) {
ASSERT(pCurLine && pNextLine);
int32_t iCount = pCurLine->CountChars();
@@ -1062,76 +619,38 @@ void CFX_TxtBreak::SplitTextLine(CFX_TxtLine* pCurLine,
return;
int32_t iEndPos = pCurLine->m_iWidth;
- std::vector<CFX_TxtChar>& curChars = *pCurLine->m_pLineChars;
+ std::vector<CFX_Char>& curChars = pCurLine->m_LineChars;
int32_t iCharPos = GetBreakPos(curChars, iEndPos, bAllChars, false);
if (iCharPos < 0)
iCharPos = 0;
iCharPos++;
if (iCharPos >= iCount) {
- pNextLine->RemoveAll(true);
+ pNextLine->Clear();
CFX_Char* pTC = &curChars[iCharPos - 1];
pTC->m_nBreakType = FX_LBT_UNKNOWN;
return;
}
- // m_pLineChars is a unique_ptr<vector>. Assign the ref into nextChars
- // so we can change the m_pLineChars vector ...
- std::vector<CFX_TxtChar>& nextChars = *pNextLine->m_pLineChars;
- nextChars =
- std::vector<CFX_TxtChar>(curChars.begin() + iCharPos, curChars.end());
+ pNextLine->m_LineChars =
+ std::vector<CFX_Char>(curChars.begin() + iCharPos, curChars.end());
curChars.erase(curChars.begin() + iCharPos, curChars.end());
pCurLine->m_iWidth = iEndPos;
- CFX_TxtChar* pTC = &curChars[iCharPos - 1];
+ CFX_Char* pTC = &curChars[iCharPos - 1];
pTC->m_nBreakType = FX_LBT_UNKNOWN;
- iCount = pdfium::CollectionSize<int>(nextChars);
+ iCount = pdfium::CollectionSize<int>(pNextLine->m_LineChars);
int32_t iWidth = 0;
for (int32_t i = 0; i < iCount; i++) {
- if (nextChars[i].GetCharType() >= FX_CHARTYPE_ArabicAlef) {
+ if (pNextLine->m_LineChars[i].GetCharType() >= FX_CHARTYPE_ArabicAlef) {
pCurLine->m_iArabicChars--;
pNextLine->m_iArabicChars++;
}
- int32_t iCharWidth = nextChars[i].m_iCharWidth;
- if (iCharWidth > 0)
- iWidth += iCharWidth;
- if (m_bPagination)
- continue;
-
- nextChars[i].m_dwStatus = 0;
+ iWidth += std::max(0, pNextLine->m_LineChars[i].m_iCharWidth);
+ pNextLine->m_LineChars[i].m_dwStatus = CFX_BreakType::None;
}
pNextLine->m_iWidth = iWidth;
}
-int32_t CFX_TxtBreak::CountBreakPieces() const {
- CFX_TxtPieceArray* pTxtPieces = GetTxtPieces();
- return pTxtPieces ? pTxtPieces->GetSize() : 0;
-}
-
-const CFX_TxtPiece* CFX_TxtBreak::GetBreakPiece(int32_t index) const {
- CFX_TxtPieceArray* pTxtPieces = GetTxtPieces();
- if (!pTxtPieces)
- return nullptr;
- if (index < 0 || index >= pTxtPieces->GetSize())
- return nullptr;
- return pTxtPieces->GetPtrAt(index);
-}
-
-void CFX_TxtBreak::ClearBreakPieces() {
- CFX_TxtLine* pTxtLine = GetTxtLine();
- if (pTxtLine)
- pTxtLine->RemoveAll(true);
- m_iReady = 0;
-}
-
-void CFX_TxtBreak::Reset() {
- m_eCharType = FX_CHARTYPE_Unknown;
- m_iArabicContext = 1;
- m_iCurArabicContext = 1;
- ResetArabicContext();
- m_pTxtLine1->RemoveAll(true);
- m_pTxtLine2->RemoveAll(true);
-}
-
struct FX_FORMCHAR {
uint16_t wch;
uint16_t wForm;
@@ -1145,63 +664,49 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun,
if (!pTxtRun || pTxtRun->iLength < 1)
return 0;
- IFX_TxtAccess* pAccess = pTxtRun->pAccess;
+ CFDE_TxtEdtPage* pAccess = pTxtRun->pAccess;
const FDE_TEXTEDITPIECE* pIdentity = pTxtRun->pIdentity;
- const FX_WCHAR* pStr = pTxtRun->wsStr.c_str();
+ const wchar_t* pStr = pTxtRun->wsStr.c_str();
int32_t* pWidths = pTxtRun->pWidths;
int32_t iLength = pTxtRun->iLength - 1;
CFX_RetainPtr<CFGAS_GEFont> pFont = pTxtRun->pFont;
uint32_t dwStyles = pTxtRun->dwStyles;
CFX_RectF rtText(*pTxtRun->pRect);
bool bRTLPiece = (pTxtRun->dwCharStyles & FX_TXTCHARSTYLE_OddBidiLevel) != 0;
- bool bArabicNumber =
- (pTxtRun->dwCharStyles & FX_TXTCHARSTYLE_ArabicNumber) != 0;
- bool bArabicComma =
- (pTxtRun->dwCharStyles & FX_TXTCHARSTYLE_ArabicComma) != 0;
- FX_FLOAT fFontSize = pTxtRun->fFontSize;
+ float fFontSize = pTxtRun->fFontSize;
int32_t iFontSize = FXSYS_round(fFontSize * 20.0f);
int32_t iAscent = pFont->GetAscent();
int32_t iDescent = pFont->GetDescent();
int32_t iMaxHeight = iAscent - iDescent;
- FX_FLOAT fFontHeight = fFontSize;
- FX_FLOAT fAscent = fFontHeight * (FX_FLOAT)iAscent / (FX_FLOAT)iMaxHeight;
- FX_FLOAT fDescent = fFontHeight * (FX_FLOAT)iDescent / (FX_FLOAT)iMaxHeight;
- bool bVerticalDoc = (dwStyles & FX_TXTLAYOUTSTYLE_VerticalLayout) != 0;
- bool bVerticalChar = (dwStyles & FX_TXTLAYOUTSTYLE_VerticalChars) != 0;
- int32_t iRotation = GetLineRotation(dwStyles) + pTxtRun->iCharRotation;
- FX_FLOAT fX = rtText.left;
- FX_FLOAT fY;
- FX_FLOAT fCharWidth;
- FX_FLOAT fCharHeight;
+ float fFontHeight = fFontSize;
+ float fAscent = fFontHeight * (float)iAscent / (float)iMaxHeight;
+ float fX = rtText.left;
+ float fY;
+ float fCharWidth;
+ float fCharHeight;
int32_t iHorScale = pTxtRun->iHorizontalScale;
int32_t iVerScale = pTxtRun->iVerticalScale;
bool bSkipSpace = pTxtRun->bSkipSpace;
FX_FORMCHAR formChars[3];
- FX_FLOAT fYBase;
+ float fYBase;
- if (bVerticalDoc) {
- fX += (rtText.width - fFontSize) / 2.0f;
- fYBase = bRTLPiece ? rtText.bottom() : rtText.top;
- fY = fYBase;
- } else {
- if (bRTLPiece)
- fX = rtText.right();
+ if (bRTLPiece)
+ fX = rtText.right();
- fYBase = rtText.top + (rtText.height - fFontSize) / 2.0f;
- fY = fYBase + fAscent;
- }
+ fYBase = rtText.top + (rtText.height - fFontSize) / 2.0f;
+ fY = fYBase + fAscent;
int32_t iCount = 0;
int32_t iNext = 0;
- FX_WCHAR wPrev = 0xFEFF;
- FX_WCHAR wNext = 0xFEFF;
- FX_WCHAR wForm = 0xFEFF;
- FX_WCHAR wLast = 0xFEFF;
+ wchar_t wPrev = 0xFEFF;
+ wchar_t wNext = 0xFEFF;
+ wchar_t wForm = 0xFEFF;
+ wchar_t wLast = 0xFEFF;
bool bShadda = false;
bool bLam = false;
for (int32_t i = 0; i <= iLength; i++) {
int32_t iWidth;
- FX_WCHAR wch;
+ wchar_t wch;
if (pAccess) {
wch = pAccess->GetChar(pIdentity, i);
iWidth = pAccess->GetWidth(pIdentity, i);
@@ -1284,29 +789,12 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun,
}
} else if (chartype == FX_CHARTYPE_Numeric) {
wForm = wch;
- if (bArabicNumber)
- wForm += 0x0630;
} else if (wch == L'.') {
wForm = wch;
- if (bArabicNumber) {
- wNext = 0xFEFF;
- if (pAccess) {
- iNext = i + 1;
- if (iNext <= iLength)
- wNext = pAccess->GetChar(pIdentity, iNext);
- } else {
- if (i < iLength)
- wNext = *pStr;
- }
- if (wNext >= L'0' && wNext <= L'9')
- wForm = 0x066B;
- }
} else if (wch == L',') {
wForm = wch;
- if (bArabicComma)
- wForm = 0x060C;
- } else if (bRTLPiece || bVerticalChar) {
- wForm = FX_GetMirrorChar(wch, dwProps, bRTLPiece, bVerticalChar);
+ } else if (bRTLPiece) {
+ wForm = FX_GetMirrorChar(wch, dwProps, bRTLPiece, false);
} else {
wForm = wch;
}
@@ -1316,11 +804,6 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun,
bLam = false;
dwProps = FX_GetUnicodeProperties(wForm);
- int32_t iCharRotation = iRotation;
- if (bVerticalChar && (dwProps & 0x8000) != 0)
- iCharRotation++;
-
- iCharRotation %= 4;
bool bEmptyChar =
(chartype >= FX_CHARTYPE_Tab && chartype <= FX_CHARTYPE_Control);
if (wForm == 0xFEFF)
@@ -1355,12 +838,12 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun,
}
for (int32_t j = 0; j < iForms; j++) {
- wForm = (FX_WCHAR)formChars[j].wForm;
+ wForm = (wchar_t)formChars[j].wForm;
iCharWidth = formChars[j].iWidth;
if (j > 0) {
chartype = FX_CHARTYPE_Combination;
wch = wForm;
- wLast = (FX_WCHAR)formChars[j - 1].wForm;
+ wLast = (wchar_t)formChars[j - 1].wForm;
}
if (!bEmptyChar || (bEmptyChar && !bSkipSpace)) {
pCharPos->m_GlyphIndex =
@@ -1373,32 +856,20 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun,
*pWSForms += wForm;
}
- int32_t iCharHeight;
- if (bVerticalDoc) {
- iCharHeight = iCharWidth;
- iCharWidth = 1000;
- } else {
- iCharHeight = 1000;
- }
+ int32_t iCharHeight = 1000;
fCharWidth = fFontSize * iCharWidth / 1000.0f;
fCharHeight = fFontSize * iCharHeight / 1000.0f;
- if (bRTLPiece && chartype != FX_CHARTYPE_Combination) {
- if (bVerticalDoc)
- fY -= fCharHeight;
- else
- fX -= fCharWidth;
- }
+ if (bRTLPiece && chartype != FX_CHARTYPE_Combination)
+ fX -= fCharWidth;
+
if (!bEmptyChar || (bEmptyChar && !bSkipSpace)) {
pCharPos->m_Origin = CFX_PointF(fX, fY);
- if ((dwStyles & FX_TXTLAYOUTSTYLE_CombText) != 0) {
+ if ((dwStyles & FX_LAYOUTSTYLE_CombText) != 0) {
int32_t iFormWidth = iCharWidth;
pFont->GetCharWidth(wForm, iFormWidth, false);
- FX_FLOAT fOffset = fFontSize * (iCharWidth - iFormWidth) / 2000.0f;
- if (bVerticalDoc)
- pCharPos->m_Origin.y += fOffset;
- else
- pCharPos->m_Origin.x += fOffset;
+ float fOffset = fFontSize * (iCharWidth - iFormWidth) / 2000.0f;
+ pCharPos->m_Origin.x += fOffset;
}
if (chartype == FX_CHARTYPE_Combination) {
@@ -1406,7 +877,7 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun,
if (pFont->GetCharBBox(wForm, &rtBBox, false)) {
pCharPos->m_Origin.y =
fYBase + fFontSize -
- fFontSize * (FX_FLOAT)rtBBox.height / (FX_FLOAT)iMaxHeight;
+ fFontSize * (float)rtBBox.height / (float)iMaxHeight;
}
if (wForm == wch && wLast != 0xFEFF) {
uint32_t dwLastProps = FX_GetUnicodeProperties(wLast);
@@ -1419,80 +890,19 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun,
}
}
CFX_PointF ptOffset;
- if (bVerticalChar && (dwProps & 0x00010000) != 0) {
- CFX_Rect rtBBox;
- if (pFont->GetCharBBox(wForm, &rtBBox, false)) {
- ptOffset.x = fFontSize * (850 - rtBBox.right()) / iMaxHeight;
- ptOffset.y = fFontSize * (iAscent - rtBBox.top - 150) / iMaxHeight;
- }
- }
pCharPos->m_Origin.x += ptOffset.x;
pCharPos->m_Origin.y -= ptOffset.y;
}
- if (!bRTLPiece && chartype != FX_CHARTYPE_Combination) {
- if (bVerticalDoc)
- fY += fCharHeight;
- else
- fX += fCharWidth;
- }
+ if (!bRTLPiece && chartype != FX_CHARTYPE_Combination)
+ fX += fCharWidth;
if (!bEmptyChar || (bEmptyChar && !bSkipSpace)) {
pCharPos->m_bGlyphAdjust = true;
- if (bVerticalDoc) {
- if (iCharRotation == 0) {
- pCharPos->m_AdjustMatrix[0] = -1;
- pCharPos->m_AdjustMatrix[1] = 0;
- pCharPos->m_AdjustMatrix[2] = 0;
- pCharPos->m_AdjustMatrix[3] = 1;
- pCharPos->m_Origin.y += fAscent;
- } else if (iCharRotation == 1) {
- pCharPos->m_AdjustMatrix[0] = 0;
- pCharPos->m_AdjustMatrix[1] = -1;
- pCharPos->m_AdjustMatrix[2] = -1;
- pCharPos->m_AdjustMatrix[3] = 0;
- pCharPos->m_Origin.x -= fDescent;
- } else if (iCharRotation == 2) {
- pCharPos->m_AdjustMatrix[0] = 1;
- pCharPos->m_AdjustMatrix[1] = 0;
- pCharPos->m_AdjustMatrix[2] = 0;
- pCharPos->m_AdjustMatrix[3] = -1;
- pCharPos->m_Origin.x += fCharWidth;
- pCharPos->m_Origin.y += fAscent;
- } else {
- pCharPos->m_AdjustMatrix[0] = 0;
- pCharPos->m_AdjustMatrix[1] = 1;
- pCharPos->m_AdjustMatrix[2] = 1;
- pCharPos->m_AdjustMatrix[3] = 0;
- pCharPos->m_Origin.x += fAscent;
- }
- } else {
- if (iCharRotation == 0) {
- pCharPos->m_AdjustMatrix[0] = -1;
- pCharPos->m_AdjustMatrix[1] = 0;
- pCharPos->m_AdjustMatrix[2] = 0;
- pCharPos->m_AdjustMatrix[3] = 1;
- } else if (iCharRotation == 1) {
- pCharPos->m_AdjustMatrix[0] = 0;
- pCharPos->m_AdjustMatrix[1] = -1;
- pCharPos->m_AdjustMatrix[2] = -1;
- pCharPos->m_AdjustMatrix[3] = 0;
- pCharPos->m_Origin.x -= fDescent;
- pCharPos->m_Origin.y -= fAscent + fDescent;
- } else if (iCharRotation == 2) {
- pCharPos->m_AdjustMatrix[0] = 1;
- pCharPos->m_AdjustMatrix[1] = 0;
- pCharPos->m_AdjustMatrix[2] = 0;
- pCharPos->m_AdjustMatrix[3] = -1;
- pCharPos->m_Origin.x += fCharWidth;
- pCharPos->m_Origin.y -= fAscent;
- } else {
- pCharPos->m_AdjustMatrix[0] = 0;
- pCharPos->m_AdjustMatrix[1] = 1;
- pCharPos->m_AdjustMatrix[2] = 1;
- pCharPos->m_AdjustMatrix[3] = 0;
- pCharPos->m_Origin.x += fAscent;
- }
- }
+ pCharPos->m_AdjustMatrix[0] = -1;
+ pCharPos->m_AdjustMatrix[1] = 0;
+ pCharPos->m_AdjustMatrix[2] = 0;
+ pCharPos->m_AdjustMatrix[3] = 1;
+
if (iHorScale != 100 || iVerScale != 100) {
pCharPos->m_AdjustMatrix[0] =
pCharPos->m_AdjustMatrix[0] * iHorScale / 100.0f;
@@ -1507,7 +917,7 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun,
}
}
if (iWidth > 0)
- wPrev = static_cast<FX_WCHAR>(formChars[0].wch);
+ wPrev = static_cast<wchar_t>(formChars[0].wch);
wLast = wch;
}
return iCount;
@@ -1518,15 +928,15 @@ std::vector<CFX_RectF> CFX_TxtBreak::GetCharRects(const FX_TXTRUN* pTxtRun,
if (!pTxtRun || pTxtRun->iLength < 1)
return std::vector<CFX_RectF>();
- IFX_TxtAccess* pAccess = pTxtRun->pAccess;
+ CFDE_TxtEdtPage* pAccess = pTxtRun->pAccess;
const FDE_TEXTEDITPIECE* pIdentity = pTxtRun->pIdentity;
- const FX_WCHAR* pStr = pTxtRun->wsStr.c_str();
+ const wchar_t* pStr = pTxtRun->wsStr.c_str();
int32_t* pWidths = pTxtRun->pWidths;
int32_t iLength = pTxtRun->iLength;
CFX_RectF rect(*pTxtRun->pRect);
- FX_FLOAT fFontSize = pTxtRun->fFontSize;
+ float fFontSize = pTxtRun->fFontSize;
int32_t iFontSize = FXSYS_round(fFontSize * 20.0f);
- FX_FLOAT fScale = fFontSize / 1000.0f;
+ float fScale = fFontSize / 1000.0f;
CFX_RetainPtr<CFGAS_GEFont> pFont = pTxtRun->pFont;
if (!pFont)
bCharBBox = false;
@@ -1535,21 +945,16 @@ std::vector<CFX_RectF> CFX_TxtBreak::GetCharRects(const FX_TXTRUN* pTxtRun,
if (bCharBBox)
bCharBBox = pFont->GetBBox(&bbox);
- FX_FLOAT fLeft = std::max(0.0f, bbox.left * fScale);
- FX_FLOAT fHeight = FXSYS_fabs(bbox.height * fScale);
+ float fLeft = std::max(0.0f, bbox.left * fScale);
+ float fHeight = fabs(bbox.height * fScale);
bool bRTLPiece = !!(pTxtRun->dwCharStyles & FX_TXTCHARSTYLE_OddBidiLevel);
- bool bVertical = !!(pTxtRun->dwStyles & FX_TXTLAYOUTSTYLE_VerticalLayout);
- bool bSingleLine = !!(pTxtRun->dwStyles & FX_TXTLAYOUTSTYLE_SingleLine);
- bool bCombText = !!(pTxtRun->dwStyles & FX_TXTLAYOUTSTYLE_CombText);
- FX_WCHAR wch;
- FX_WCHAR wLineBreakChar = pTxtRun->wLineBreakChar;
+ bool bSingleLine = !!(pTxtRun->dwStyles & FX_LAYOUTSTYLE_SingleLine);
+ bool bCombText = !!(pTxtRun->dwStyles & FX_LAYOUTSTYLE_CombText);
+ wchar_t wch;
+ wchar_t wLineBreakChar = pTxtRun->wLineBreakChar;
int32_t iCharSize;
- FX_FLOAT fCharSize;
- FX_FLOAT fStart;
- if (bVertical)
- fStart = bRTLPiece ? rect.bottom() : rect.top;
- else
- fStart = bRTLPiece ? rect.right() : rect.left;
+ float fCharSize;
+ float fStart = bRTLPiece ? rect.right() : rect.left;
std::vector<CFX_RectF> rtArray(iLength);
for (int32_t i = 0; i < iLength; i++) {
@@ -1560,8 +965,8 @@ std::vector<CFX_RectF> CFX_TxtBreak::GetCharRects(const FX_TXTRUN* pTxtRun,
wch = *pStr++;
iCharSize = *pWidths++;
}
- fCharSize = static_cast<FX_FLOAT>(iCharSize) / 20000.0f;
- bool bRet = (!bSingleLine && FX_IsCtrlCode(wch));
+ fCharSize = static_cast<float>(iCharSize) / 20000.0f;
+ bool bRet = (!bSingleLine && IsCtrlCode(wch));
if (!(wch == L'\v' || wch == L'\f' || wch == 0x2028 || wch == 0x2029 ||
(wLineBreakChar != 0xFEFF && wch == wLineBreakChar))) {
bRet = false;
@@ -1570,30 +975,19 @@ std::vector<CFX_RectF> CFX_TxtBreak::GetCharRects(const FX_TXTRUN* pTxtRun,
iCharSize = iFontSize * 500;
fCharSize = fFontSize / 2.0f;
}
- if (bVertical) {
- rect.top = fStart;
- if (bRTLPiece) {
- rect.top -= fCharSize;
- fStart -= fCharSize;
- } else {
- fStart += fCharSize;
- }
- rect.height = fCharSize;
+ rect.left = fStart;
+ if (bRTLPiece) {
+ rect.left -= fCharSize;
+ fStart -= fCharSize;
} else {
- rect.left = fStart;
- if (bRTLPiece) {
- rect.left -= fCharSize;
- fStart -= fCharSize;
- } else {
- fStart += fCharSize;
- }
- rect.width = fCharSize;
+ fStart += fCharSize;
}
+ rect.width = fCharSize;
if (bCharBBox && !bRet) {
int32_t iCharWidth = 1000;
pFont->GetCharWidth(wch, iCharWidth, false);
- FX_FLOAT fRTLeft = 0, fCharWidth = 0;
+ float fRTLeft = 0, fCharWidth = 0;
if (iCharWidth > 0) {
fCharWidth = iCharWidth * fScale;
fRTLeft = fLeft;
@@ -1601,19 +995,11 @@ std::vector<CFX_RectF> CFX_TxtBreak::GetCharRects(const FX_TXTRUN* pTxtRun,
fRTLeft = (rect.width - fCharWidth) / 2.0f;
}
CFX_RectF rtBBoxF;
- if (bVertical) {
- rtBBoxF.top = rect.left + fRTLeft;
- rtBBoxF.left = rect.top + (rect.height - fHeight) / 2.0f;
- rtBBoxF.height = fCharWidth;
- rtBBoxF.width = fHeight;
- rtBBoxF.left = std::max(rtBBoxF.left, 0.0f);
- } else {
- rtBBoxF.left = rect.left + fRTLeft;
- rtBBoxF.top = rect.top + (rect.height - fHeight) / 2.0f;
- rtBBoxF.width = fCharWidth;
- rtBBoxF.height = fHeight;
- rtBBoxF.top = std::max(rtBBoxF.top, 0.0f);
- }
+ rtBBoxF.left = rect.left + fRTLeft;
+ rtBBoxF.top = rect.top + (rect.height - fHeight) / 2.0f;
+ rtBBoxF.width = fCharWidth;
+ rtBBoxF.height = fHeight;
+ rtBBoxF.top = std::max(rtBBoxF.top, 0.0f);
rtArray[i] = rtBBoxF;
continue;
}
@@ -1632,7 +1018,6 @@ FX_TXTRUN::FX_TXTRUN()
dwStyles(0),
iHorizontalScale(100),
iVerticalScale(100),
- iCharRotation(0),
dwCharStyles(0),
pRect(nullptr),
wLineBreakChar(L'\n'),
@@ -1641,28 +1026,3 @@ FX_TXTRUN::FX_TXTRUN()
FX_TXTRUN::~FX_TXTRUN() {}
FX_TXTRUN::FX_TXTRUN(const FX_TXTRUN& other) = default;
-
-CFX_TxtPiece::CFX_TxtPiece()
- : m_dwStatus(FX_TXTBREAK_PieceBreak),
- m_iStartPos(0),
- m_iWidth(-1),
- m_iStartChar(0),
- m_iChars(0),
- m_iBidiLevel(0),
- m_iBidiPos(0),
- m_iHorizontalScale(100),
- m_iVerticalScale(100),
- m_dwCharStyles(0),
- m_pChars(nullptr),
- m_pUserData(nullptr) {}
-
-CFX_TxtLine::CFX_TxtLine(int32_t iBlockSize)
- : m_pLineChars(new std::vector<CFX_TxtChar>),
- m_pLinePieces(new CFX_TxtPieceArray(16)),
- m_iStart(0),
- m_iWidth(0),
- m_iArabicChars(0) {}
-
-CFX_TxtLine::~CFX_TxtLine() {
- RemoveAll();
-}
diff --git a/chromium/third_party/pdfium/xfa/fgas/layout/fgas_textbreak.h b/chromium/third_party/pdfium/xfa/fgas/layout/fgas_textbreak.h
index 69ca835fadf..81aaf582191 100644
--- a/chromium/third_party/pdfium/xfa/fgas/layout/fgas_textbreak.h
+++ b/chromium/third_party/pdfium/xfa/fgas/layout/fgas_textbreak.h
@@ -11,302 +11,92 @@
#include <memory>
#include <vector>
-#include "core/fxcrt/fx_ucd.h"
+#include "core/fxcrt/cfx_char.h"
#include "core/fxge/cfx_renderdevice.h"
#include "third_party/base/stl_util.h"
-#include "xfa/fgas/crt/fgas_utils.h"
+#include "xfa/fde/cfde_txtedtpage.h"
+#include "xfa/fgas/layout/cfx_break.h"
-class CFX_Char;
class CFGAS_GEFont;
-class CFX_TxtChar;
-class CFX_TxtPiece;
-class IFX_TxtAccess;
struct FDE_TEXTEDITPIECE;
-#define FX_TXTBREAKPOLICY_None 0x00
-#define FX_TXTBREAKPOLICY_Pagination 0x01
-#define FX_TXTBREAKPOLICY_SpaceBreak 0x02
-#define FX_TXTBREAKPOLICY_NumberBreak 0x04
-#define FX_TXTBREAK_None 0x00
-#define FX_TXTBREAK_PieceBreak 0x01
-#define FX_TXTBREAK_LineBreak 0x02
-#define FX_TXTBREAK_ParagraphBreak 0x03
-#define FX_TXTBREAK_PageBreak 0x04
-#define FX_TXTBREAK_ControlChar 0x10
-#define FX_TXTBREAK_BreakChar 0x20
-#define FX_TXTBREAK_UnknownChar 0x40
-#define FX_TXTBREAK_RemoveChar 0x80
-#define FX_TXTLAYOUTSTYLE_MutipleFormat 0x0001
-#define FX_TXTLAYOUTSTYLE_VerticalLayout 0x0002
-#define FX_TXTLAYOUTSTYLE_VerticalChars 0x0004
-#define FX_TXTLAYOUTSTYLE_ReverseLine 0x0008
-#define FX_TXTLAYOUTSTYLE_ArabicContext 0x0010
-#define FX_TXTLAYOUTSTYLE_ArabicShapes 0x0020
-#define FX_TXTLAYOUTSTYLE_RTLReadingOrder 0x0040
-#define FX_TXTLAYOUTSTYLE_ExpandTab 0x0100
-#define FX_TXTLAYOUTSTYLE_SingleLine 0x0200
-#define FX_TXTLAYOUTSTYLE_CombText 0x0400
-#define FX_TXTCHARSTYLE_Alignment 0x000F
-#define FX_TXTCHARSTYLE_ArabicNumber 0x0010
#define FX_TXTCHARSTYLE_ArabicShadda 0x0020
#define FX_TXTCHARSTYLE_OddBidiLevel 0x0040
-#define FX_TXTCHARSTYLE_RTLReadingOrder 0x0080
-#define FX_TXTCHARSTYLE_ArabicContext 0x0300
-#define FX_TXTCHARSTYLE_ArabicIndic 0x0400
-#define FX_TXTCHARSTYLE_ArabicComma 0x0800
-#define FX_TXTLINEALIGNMENT_Left 0
-#define FX_TXTLINEALIGNMENT_Center 1
-#define FX_TXTLINEALIGNMENT_Right 2
-#define FX_TXTLINEALIGNMENT_Justified (1 << 2)
-#define FX_TXTLINEALIGNMENT_Distributed (2 << 2)
-#define FX_TXTLINEALIGNMENT_JustifiedLeft \
- (FX_TXTLINEALIGNMENT_Left | FX_TXTLINEALIGNMENT_Justified)
-#define FX_TXTLINEALIGNMENT_JustifiedCenter \
- (FX_TXTLINEALIGNMENT_Center | FX_TXTLINEALIGNMENT_Justified)
-#define FX_TXTLINEALIGNMENT_JustifiedRight \
- (FX_TXTLINEALIGNMENT_Right | FX_TXTLINEALIGNMENT_Justified)
-#define FX_TXTLINEALIGNMENT_DistributedLeft \
- (FX_TXTLINEALIGNMENT_Left | FX_TXTLINEALIGNMENT_Distributed)
-#define FX_TXTLINEALIGNMENT_DistributedCenter \
- (FX_TXTLINEALIGNMENT_Center | FX_TXTLINEALIGNMENT_Distributed)
-#define FX_TXTLINEALIGNMENT_DistributedRight \
- (FX_TXTLINEALIGNMENT_Right | FX_TXTLINEALIGNMENT_Distributed)
-#define FX_TXTLINEALIGNMENT_LowerMask 0x03
-#define FX_TXTLINEALIGNMENT_HigherMask 0x0C
-#define FX_TXTBREAK_MinimumTabWidth 160000
-struct FX_TPO {
- int32_t index;
- int32_t pos;
-
- bool operator<(const FX_TPO& that) const { return pos < that.pos; }
+enum CFX_TxtLineAlignment {
+ CFX_TxtLineAlignment_Left = 0,
+ CFX_TxtLineAlignment_Center = 1 << 0,
+ CFX_TxtLineAlignment_Right = 1 << 1,
+ CFX_TxtLineAlignment_Justified = 1 << 2
};
-class IFX_TxtAccess {
- public:
- virtual ~IFX_TxtAccess() {}
- virtual FX_WCHAR GetChar(const FDE_TEXTEDITPIECE* pIdentity,
- int32_t index) const = 0;
- virtual int32_t GetWidth(const FDE_TEXTEDITPIECE* pIdentity,
- int32_t index) const = 0;
-};
+inline bool CFX_BreakTypeNoneOrPiece(CFX_BreakType type) {
+ return type == CFX_BreakType::None || type == CFX_BreakType::Piece;
+}
struct FX_TXTRUN {
FX_TXTRUN();
FX_TXTRUN(const FX_TXTRUN& other);
~FX_TXTRUN();
- IFX_TxtAccess* pAccess;
+ CFDE_TxtEdtPage* pAccess;
const FDE_TEXTEDITPIECE* pIdentity;
CFX_WideString wsStr;
int32_t* pWidths;
int32_t iLength;
CFX_RetainPtr<CFGAS_GEFont> pFont;
- FX_FLOAT fFontSize;
+ float fFontSize;
uint32_t dwStyles;
int32_t iHorizontalScale;
int32_t iVerticalScale;
- int32_t iCharRotation;
uint32_t dwCharStyles;
const CFX_RectF* pRect;
- FX_WCHAR wLineBreakChar;
+ wchar_t wLineBreakChar;
bool bSkipSpace;
};
-class CFX_TxtPiece {
+class CFX_TxtBreak : public CFX_Break {
public:
- CFX_TxtPiece();
-
- int32_t GetEndPos() const {
- return m_iWidth < 0 ? m_iStartPos : m_iStartPos + m_iWidth;
- }
- int32_t GetLength() const { return m_iChars; }
- int32_t GetEndChar() const { return m_iStartChar + m_iChars; }
- CFX_TxtChar* GetCharPtr(int32_t index) const {
- ASSERT(index > -1 && index < m_iChars && m_pChars);
- return &(*m_pChars)[m_iStartChar + index];
- }
- void GetString(FX_WCHAR* pText) const {
- ASSERT(pText);
- int32_t iEndChar = m_iStartChar + m_iChars;
- for (int32_t i = m_iStartChar; i < iEndChar; i++)
- *pText++ = static_cast<FX_WCHAR>((*m_pChars)[i].m_wCharCode);
- }
- void GetString(CFX_WideString& wsText) const {
- FX_WCHAR* pText = wsText.GetBuffer(m_iChars);
- GetString(pText);
- wsText.ReleaseBuffer(m_iChars);
- }
- void GetWidths(int32_t* pWidths) const {
- ASSERT(pWidths);
- int32_t iEndChar = m_iStartChar + m_iChars;
- for (int32_t i = m_iStartChar; i < iEndChar; i++)
- *pWidths++ = (*m_pChars)[i].m_iCharWidth;
- }
-
- uint32_t m_dwStatus;
- int32_t m_iStartPos;
- int32_t m_iWidth;
- int32_t m_iStartChar;
- int32_t m_iChars;
- int32_t m_iBidiLevel;
- int32_t m_iBidiPos;
- int32_t m_iHorizontalScale;
- int32_t m_iVerticalScale;
- uint32_t m_dwCharStyles;
- std::vector<CFX_TxtChar>* m_pChars;
- void* m_pUserData;
-};
-
-typedef CFX_BaseArrayTemplate<CFX_TxtPiece> CFX_TxtPieceArray;
-
-class CFX_TxtLine {
- public:
- explicit CFX_TxtLine(int32_t iBlockSize);
- ~CFX_TxtLine();
-
- int32_t CountChars() const {
- return pdfium::CollectionSize<int32_t>(*m_pLineChars);
- }
-
- CFX_TxtChar* GetCharPtr(int32_t index) const {
- ASSERT(index >= 0 &&
- index < pdfium::CollectionSize<int32_t>(*m_pLineChars));
- return &(*m_pLineChars)[index];
- }
+ CFX_TxtBreak();
+ ~CFX_TxtBreak() override;
- int32_t CountPieces() const { return m_pLinePieces->GetSize(); }
- CFX_TxtPiece* GetPiecePtr(int32_t index) const {
- ASSERT(index > -1 && index < m_pLinePieces->GetSize());
- return m_pLinePieces->GetPtrAt(index);
- }
-
- void GetString(CFX_WideString& wsStr) const {
- int32_t iCount = pdfium::CollectionSize<int32_t>(*m_pLineChars);
- FX_WCHAR* pBuf = wsStr.GetBuffer(iCount);
- for (int32_t i = 0; i < iCount; i++)
- *pBuf++ = static_cast<FX_WCHAR>((*m_pLineChars)[i].m_wCharCode);
- wsStr.ReleaseBuffer(iCount);
- }
-
- void RemoveAll(bool bLeaveMemory = false) {
- m_pLineChars->clear();
- m_pLinePieces->RemoveAll(bLeaveMemory);
- m_iWidth = 0;
- m_iArabicChars = 0;
- }
-
- std::unique_ptr<std::vector<CFX_TxtChar>> m_pLineChars;
- std::unique_ptr<CFX_TxtPieceArray> m_pLinePieces;
- int32_t m_iStart;
- int32_t m_iWidth;
- int32_t m_iArabicChars;
-};
-
-class CFX_TxtBreak {
- public:
- explicit CFX_TxtBreak(uint32_t dwPolicies);
- ~CFX_TxtBreak();
-
- void SetLineWidth(FX_FLOAT fLineWidth);
- void SetLinePos(FX_FLOAT fLinePos);
- uint32_t GetLayoutStyles() const { return m_dwLayoutStyles; }
- void SetLayoutStyles(uint32_t dwLayoutStyles);
- void SetFont(const CFX_RetainPtr<CFGAS_GEFont>& pFont);
- void SetFontSize(FX_FLOAT fFontSize);
- void SetTabWidth(FX_FLOAT fTabWidth, bool bEquidistant);
- void SetDefaultChar(FX_WCHAR wch);
- void SetParagraphBreakChar(FX_WCHAR wch);
- void SetLineBreakTolerance(FX_FLOAT fTolerance);
- void SetHorizontalScale(int32_t iScale);
- void SetCharRotation(int32_t iCharRotation);
- void SetCharSpace(FX_FLOAT fCharSpace);
+ void SetLineWidth(float fLineWidth);
void SetAlignment(int32_t iAlignment);
- void SetCombWidth(FX_FLOAT fCombWidth);
- void SetUserData(void* pUserData);
- uint32_t AppendChar(FX_WCHAR wch);
- uint32_t EndBreak(uint32_t dwStatus = FX_TXTBREAK_PieceBreak);
- int32_t CountBreakPieces() const;
- const CFX_TxtPiece* GetBreakPiece(int32_t index) const;
- void ClearBreakPieces();
- void Reset();
+ void SetCombWidth(float fCombWidth);
+ CFX_BreakType EndBreak(CFX_BreakType dwStatus);
+
int32_t GetDisplayPos(const FX_TXTRUN* pTxtRun,
FXTEXT_CHARPOS* pCharPos,
bool bCharCode = false,
CFX_WideString* pWSForms = nullptr) const;
std::vector<CFX_RectF> GetCharRects(const FX_TXTRUN* pTxtRun,
bool bCharBBox = false) const;
- void AppendChar_PageLoad(CFX_TxtChar* pCurChar, uint32_t dwProps);
- uint32_t AppendChar_Combination(CFX_TxtChar* pCurChar, int32_t iRotation);
- uint32_t AppendChar_Tab(CFX_TxtChar* pCurChar, int32_t iRotation);
- uint32_t AppendChar_Control(CFX_TxtChar* pCurChar, int32_t iRotation);
- uint32_t AppendChar_Arabic(CFX_TxtChar* pCurChar, int32_t iRotation);
- uint32_t AppendChar_Others(CFX_TxtChar* pCurChar, int32_t iRotation);
+ CFX_BreakType AppendChar(wchar_t wch);
private:
- void FontChanged();
- void SetBreakStatus();
- int32_t GetLineRotation(uint32_t dwStyles) const;
- CFX_TxtChar* GetLastChar(int32_t index, bool bOmitChar = true) const;
- CFX_TxtLine* GetTxtLine() const;
- CFX_TxtPieceArray* GetTxtPieces() const;
- FX_CHARTYPE GetUnifiedCharType(FX_CHARTYPE dwType) const;
- void ResetArabicContext();
+ void AppendChar_Combination(CFX_Char* pCurChar);
+ void AppendChar_Tab(CFX_Char* pCurChar);
+ void AppendChar_PageLoad(CFX_Char* pCurChar, uint32_t dwProps);
+ CFX_BreakType AppendChar_Control(CFX_Char* pCurChar);
+ CFX_BreakType AppendChar_Arabic(CFX_Char* pCurChar);
+ CFX_BreakType AppendChar_Others(CFX_Char* pCurChar);
+
void ResetContextCharStyles();
- void EndBreak_UpdateArabicShapes();
- bool EndBreak_SplitLine(CFX_TxtLine* pNextLine,
- bool bAllChars,
- uint32_t dwStatus);
- void EndBreak_BidiLine(std::deque<FX_TPO>* tpos, uint32_t dwStatus);
+ bool EndBreak_SplitLine(CFX_BreakLine* pNextLine, bool bAllChars);
+ void EndBreak_BidiLine(std::deque<FX_TPO>* tpos, CFX_BreakType dwStatus);
void EndBreak_Alignment(const std::deque<FX_TPO>& tpos,
bool bAllChars,
- uint32_t dwStatus);
- int32_t GetBreakPos(std::vector<CFX_TxtChar>& ca,
+ CFX_BreakType dwStatus);
+ int32_t GetBreakPos(std::vector<CFX_Char>& ca,
int32_t& iEndPos,
bool bAllChars = false,
bool bOnlyBrk = false);
- void SplitTextLine(CFX_TxtLine* pCurLine,
- CFX_TxtLine* pNextLine,
+ void SplitTextLine(CFX_BreakLine* pCurLine,
+ CFX_BreakLine* pNextLine,
bool bAllChars = false);
- uint32_t m_dwPolicies;
- bool m_bPagination;
- int32_t m_iLineWidth;
- uint32_t m_dwLayoutStyles;
- bool m_bVertical;
- bool m_bArabicContext;
- bool m_bArabicShapes;
- bool m_bRTL;
- bool m_bSingleLine;
- bool m_bCombText;
- int32_t m_iArabicContext;
- int32_t m_iCurArabicContext;
- CFX_RetainPtr<CFGAS_GEFont> m_pFont;
- int32_t m_iFontSize;
- bool m_bEquidistant;
- int32_t m_iTabWidth;
- FX_WCHAR m_wDefChar;
- FX_WCHAR m_wParagBreakChar;
- int32_t m_iDefChar;
- int32_t m_iLineRotation;
- int32_t m_iCharRotation;
- int32_t m_iRotation;
int32_t m_iAlignment;
- uint32_t m_dwContextCharStyles;
int32_t m_iCombWidth;
- void* m_pUserData;
- FX_CHARTYPE m_eCharType;
- bool m_bCurRTL;
- int32_t m_iCurAlignment;
- bool m_bArabicNumber;
- bool m_bArabicComma;
- std::unique_ptr<CFX_TxtLine> m_pTxtLine1;
- std::unique_ptr<CFX_TxtLine> m_pTxtLine2;
- CFX_TxtLine* m_pCurLine;
- int32_t m_iReady;
- int32_t m_iTolerance;
- int32_t m_iHorScale;
- int32_t m_iCharSpace;
};
#endif // XFA_FGAS_LAYOUT_FGAS_TEXTBREAK_H_
diff --git a/chromium/third_party/pdfium/xfa/fgas/localization/fgas_datetime.cpp b/chromium/third_party/pdfium/xfa/fgas/localization/fgas_datetime.cpp
deleted file mode 100644
index 83000a4f205..00000000000
--- a/chromium/third_party/pdfium/xfa/fgas/localization/fgas_datetime.cpp
+++ /dev/null
@@ -1,550 +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
-
-#include "core/fxcrt/fx_system.h"
-#include "xfa/fgas/localization/fgas_datetime.h"
-
-#if _FX_OS_ == _FX_LINUX_DESKTOP_ || _FX_OS_ == _FX_ANDROID_ || \
- _FX_OS_ == _FX_MACOSX_ || _FX_OS_ == _FX_IOS_
-#include <sys/time.h>
-#include <time.h>
-#endif
-
-const uint8_t g_FXDaysPerMonth[12] = {31, 28, 31, 30, 31, 30,
- 31, 31, 30, 31, 30, 31};
-const uint8_t g_FXDaysPerLeapMonth[12] = {31, 29, 31, 30, 31, 30,
- 31, 31, 30, 31, 30, 31};
-const int32_t g_FXDaysBeforeMonth[12] = {0, 31, 59, 90, 120, 151,
- 181, 212, 243, 273, 304, 334};
-const int32_t g_FXDaysBeforeLeapMonth[12] = {0, 31, 60, 91, 121, 152,
- 182, 213, 244, 274, 305, 335};
-const int32_t g_FXDaysPerYear = 365;
-const int32_t g_FXDaysPerLeapYear = 366;
-const int32_t g_FXDaysPer4Years = 1461;
-const int32_t g_FXDaysPer100Years = 36524;
-const int32_t g_FXDaysPer400Years = 146097;
-const int64_t g_FXMillisecondsPerSecond = 1000;
-const int64_t g_FXMillisecondsPerMinute = 60000;
-const int64_t g_FXMillisecondsPerHour = 3600000;
-const int64_t g_FXMillisecondsPerDay = 86400000;
-bool FX_IsLeapYear(int32_t iYear) {
- ASSERT(iYear != 0);
- return ((iYear % 4) == 0 && (iYear % 100) != 0) || (iYear % 400) == 0;
-}
-int32_t FX_DaysInYear(int32_t iYear) {
- ASSERT(iYear != 0);
- return FX_IsLeapYear(iYear) ? g_FXDaysPerLeapYear : g_FXDaysPerYear;
-}
-uint8_t FX_DaysInMonth(int32_t iYear, uint8_t iMonth) {
- ASSERT(iYear != 0);
- ASSERT(iMonth >= 1 && iMonth <= 12);
- const uint8_t* p =
- FX_IsLeapYear(iYear) ? g_FXDaysPerLeapMonth : g_FXDaysPerMonth;
- return p[iMonth - 1];
-}
-static int32_t FX_DaysBeforeMonthInYear(int32_t iYear, uint8_t iMonth) {
- ASSERT(iYear != 0);
- ASSERT(iMonth >= 1 && iMonth <= 12);
- const int32_t* p =
- FX_IsLeapYear(iYear) ? g_FXDaysBeforeLeapMonth : g_FXDaysBeforeMonth;
- return p[iMonth - 1];
-}
-static int64_t FX_DateToDays(int32_t iYear,
- uint8_t iMonth,
- uint8_t iDay,
- bool bIncludeThisDay = false) {
- ASSERT(iYear != 0);
- ASSERT(iMonth >= 1 && iMonth <= 12);
- ASSERT(iDay >= 1 && iDay <= FX_DaysInMonth(iYear, iMonth));
- int64_t iDays = FX_DaysBeforeMonthInYear(iYear, iMonth);
- iDays += iDay;
- if (!bIncludeThisDay) {
- iDays--;
- }
- if (iYear > 0) {
- iYear--;
- } else {
- iDays -= FX_DaysInYear(iYear);
- iYear++;
- }
- return iDays + (int64_t)iYear * 365 + iYear / 4 - iYear / 100 + iYear / 400;
-}
-static void FX_DaysToDate(int64_t iDays,
- int32_t& iYear,
- uint8_t& iMonth,
- uint8_t& iDay) {
- bool bBC = iDays < 0;
- if (bBC) {
- iDays = -iDays;
- }
- iYear = 1;
- iMonth = 1;
- iDay = 1;
- if (iDays >= g_FXDaysPer400Years) {
- iYear += (int32_t)(iDays / g_FXDaysPer400Years * 400);
- iDays %= g_FXDaysPer400Years;
- }
- if (iDays >= g_FXDaysPer100Years) {
- if (iDays == g_FXDaysPer100Years * 4) {
- iYear += 300;
- iDays -= g_FXDaysPer100Years * 3;
- } else {
- iYear += (int32_t)(iDays / g_FXDaysPer100Years * 100);
- iDays %= g_FXDaysPer100Years;
- }
- }
- if (iDays >= g_FXDaysPer4Years) {
- iYear += (int32_t)(iDays / g_FXDaysPer4Years * 4);
- iDays %= g_FXDaysPer4Years;
- }
- while (true) {
- int32_t iYearDays = FX_DaysInYear(iYear);
- if (iDays < iYearDays) {
- if (bBC) {
- iYear = -iYear;
- iDays = iYearDays - iDays;
- }
- break;
- }
- iYear++;
- iDays -= iYearDays;
- }
- while (true) {
- int32_t iMonthDays = FX_DaysInMonth(iYear, iMonth);
- if (iDays < iMonthDays) {
- break;
- }
- iMonth++;
- iDays -= iMonthDays;
- }
- iDay += (uint8_t)iDays;
-}
-
-struct FXUT_SYSTEMTIME {
- uint16_t wYear;
- uint16_t wMonth;
- uint16_t wDayOfWeek;
- uint16_t wDay;
- uint16_t wHour;
- uint16_t wMinute;
- uint16_t wSecond;
- uint16_t wMilliseconds;
-};
-
-void CFX_Unitime::Now() {
- FXUT_SYSTEMTIME utLocal;
-#if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN32_MOBILE_ || \
- _FX_OS_ == _FX_WIN64_
- ::GetLocalTime((LPSYSTEMTIME)&utLocal);
-#elif _FX_OS_ != _FX_EMBEDDED_
-#if 1
- timeval curTime;
- gettimeofday(&curTime, nullptr);
-#else
- struct timespec curTime;
- clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &curTime);
-#endif
- struct tm st;
- localtime_r(&curTime.tv_sec, &st);
- utLocal.wYear = st.tm_year + 1900;
- utLocal.wMonth = st.tm_mon + 1;
- utLocal.wDayOfWeek = st.tm_wday;
- utLocal.wDay = st.tm_mday;
- utLocal.wHour = st.tm_hour;
- utLocal.wMinute = st.tm_min;
- utLocal.wSecond = st.tm_sec;
- utLocal.wMilliseconds = curTime.tv_usec / 1000;
-#endif
- Set(utLocal.wYear, (uint8_t)utLocal.wMonth, (uint8_t)utLocal.wDay,
- (uint8_t)utLocal.wHour, (uint8_t)utLocal.wMinute,
- (uint8_t)utLocal.wSecond, (uint16_t)utLocal.wMilliseconds);
-}
-void CFX_Unitime::SetGMTime() {
- FXUT_SYSTEMTIME utLocal;
-#if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN32_MOBILE_ || \
- _FX_OS_ == _FX_WIN64_
- ::GetSystemTime((LPSYSTEMTIME)&utLocal);
-#elif _FX_OS_ != _FX_EMBEDDED_
-#if 1
- timeval curTime;
- gettimeofday(&curTime, nullptr);
-#else
- struct timespec curTime;
- clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &curTime);
-#endif
- struct tm st;
- gmtime_r(&curTime.tv_sec, &st);
- utLocal.wYear = st.tm_year + 1900;
- utLocal.wMonth = st.tm_mon + 1;
- utLocal.wDayOfWeek = st.tm_wday;
- utLocal.wDay = st.tm_mday;
- utLocal.wHour = st.tm_hour;
- utLocal.wMinute = st.tm_min;
- utLocal.wSecond = st.tm_sec;
- utLocal.wMilliseconds = curTime.tv_usec / 1000;
-#endif
- Set(utLocal.wYear, (uint8_t)utLocal.wMonth, (uint8_t)utLocal.wDay,
- (uint8_t)utLocal.wHour, (uint8_t)utLocal.wMinute,
- (uint8_t)utLocal.wSecond, (uint16_t)utLocal.wMilliseconds);
-}
-void CFX_Unitime::Set(int32_t year,
- uint8_t month,
- uint8_t day,
- uint8_t hour,
- uint8_t minute,
- uint8_t second,
- uint16_t millisecond) {
- ASSERT(hour <= 23);
- ASSERT(minute <= 59);
- ASSERT(second <= 59);
- ASSERT(millisecond <= 999);
- m_iUnitime = (int64_t)hour * g_FXMillisecondsPerHour +
- (int64_t)minute * g_FXMillisecondsPerMinute +
- (int64_t)second * g_FXMillisecondsPerSecond + millisecond;
- if (year > 0) {
- m_iUnitime =
- m_iUnitime +
- FX_DateToDays(year, month, day, false) * g_FXMillisecondsPerDay;
- }
-}
-void CFX_Unitime::Set(FX_UNITIME t) {
- m_iUnitime = t;
-}
-int32_t CFX_Unitime::GetYear() const {
- int32_t iYear;
- uint8_t iMonth, iDay;
- FX_DaysToDate(GetDayOfAD(), iYear, iMonth, iDay);
- return iYear;
-}
-uint8_t CFX_Unitime::GetMonth() const {
- int32_t iYear;
- uint8_t iMonth, iDay;
- FX_DaysToDate(GetDayOfAD(), iYear, iMonth, iDay);
- return iMonth;
-}
-uint8_t CFX_Unitime::GetDay() const {
- int32_t iYear;
- uint8_t iMonth, iDay;
- FX_DaysToDate(GetDayOfAD(), iYear, iMonth, iDay);
- return iDay;
-}
-FX_WEEKDAY CFX_Unitime::GetDayOfWeek() const {
- int32_t v = (int32_t)((m_iUnitime / g_FXMillisecondsPerDay + 1) % 7);
- if (v < 0) {
- v += 7;
- }
- return (FX_WEEKDAY)v;
-}
-uint16_t CFX_Unitime::GetDayOfYear() const {
- int32_t iYear;
- uint8_t iMonth, iDay;
- FX_DaysToDate(GetDayOfAD(), iYear, iMonth, iDay);
- return FX_DaysBeforeMonthInYear(iYear, iMonth) + iDay;
-}
-int64_t CFX_Unitime::GetDayOfAD() const {
- bool bBC = m_iUnitime < 0;
- int64_t iDays = m_iUnitime / g_FXMillisecondsPerDay;
- iDays += bBC ? -1 : 0;
- if (bBC && (m_iUnitime % g_FXMillisecondsPerDay) == 0) {
- iDays++;
- }
- return iDays;
-}
-uint8_t CFX_Unitime::GetHour() const {
- int32_t v = (int32_t)(m_iUnitime % g_FXMillisecondsPerDay);
- if (v < 0) {
- v += g_FXMillisecondsPerDay;
- }
- return (uint8_t)(v / g_FXMillisecondsPerHour);
-}
-uint8_t CFX_Unitime::GetMinute() const {
- int32_t v = (int32_t)(m_iUnitime % g_FXMillisecondsPerHour);
- if (v < 0) {
- v += g_FXMillisecondsPerHour;
- }
- return (uint8_t)(v / g_FXMillisecondsPerMinute);
-}
-uint8_t CFX_Unitime::GetSecond() const {
- int32_t v = (int32_t)(m_iUnitime % g_FXMillisecondsPerMinute);
- if (v < 0) {
- v += g_FXMillisecondsPerMinute;
- }
- return (uint8_t)(v / g_FXMillisecondsPerSecond);
-}
-uint16_t CFX_Unitime::GetMillisecond() const {
- int32_t v = (int32_t)(m_iUnitime % g_FXMillisecondsPerSecond);
- if (v < 0) {
- v += g_FXMillisecondsPerSecond;
- }
- return (uint16_t)v;
-}
-bool CFX_Unitime::AddYears(int32_t iYears) {
- FX_UNITIME ut = m_iUnitime;
- if (ut < 0) {
- ut = -ut;
- }
- FX_UNITIME r = ut % g_FXMillisecondsPerDay;
- int32_t iYear;
- uint8_t iMonth, iDay;
- FX_DaysToDate(GetDayOfAD(), iYear, iMonth, iDay);
- iYear += iYears;
- if (iYear == 0) {
- iYear = iYears > 0 ? 1 : -1;
- }
- m_iUnitime =
- FX_DateToDays(iYear, iMonth, iDay, false) * g_FXMillisecondsPerDay;
- m_iUnitime += (iYear < 0) ? -r : r;
- return true;
-}
-bool CFX_Unitime::AddMonths(int32_t iMonths) {
- bool b = iMonths > 0;
- FX_UNITIME ut = m_iUnitime;
- if (ut < 0) {
- ut = -ut;
- }
- FX_UNITIME r = ut % g_FXMillisecondsPerDay;
- int32_t iYear;
- uint8_t iMonth, iDay;
- FX_DaysToDate(GetDayOfAD(), iYear, iMonth, iDay);
- iMonths += iMonth;
- while (iMonths < 1) {
- iYear--, iMonths += 12;
- }
- while (iMonths > 12) {
- iYear++, iMonths -= 12;
- }
- if (iYear == 0) {
- iYear = b ? 1 : -1;
- }
- m_iUnitime = FX_DateToDays(iYear, (uint8_t)iMonths, iDay, false) *
- g_FXMillisecondsPerDay;
- m_iUnitime += (iYear < 0) ? -r : r;
- return true;
-}
-bool CFX_Unitime::AddDays(int32_t iDays) {
- m_iUnitime += (int64_t)iDays * g_FXMillisecondsPerDay;
- return true;
-}
-bool CFX_Unitime::AddHours(int32_t iHours) {
- m_iUnitime += (int64_t)iHours * g_FXMillisecondsPerHour;
- return true;
-}
-bool CFX_Unitime::AddMinutes(int32_t iMinutes) {
- m_iUnitime += (int64_t)iMinutes * g_FXMillisecondsPerMinute;
- return true;
-}
-bool CFX_Unitime::AddSeconds(int32_t iSeconds) {
- m_iUnitime += ((int64_t)iSeconds) * g_FXMillisecondsPerSecond;
- return true;
-}
-bool CFX_Unitime::AddMilliseconds(int32_t iMilliseconds) {
- m_iUnitime += iMilliseconds;
- return true;
-}
-bool CFX_DateTime::Set(int32_t year,
- uint8_t month,
- uint8_t day,
- uint8_t hour,
- uint8_t minute,
- uint8_t second,
- uint16_t millisecond) {
- ASSERT(year != 0);
- ASSERT(month >= 1 && month <= 12);
- ASSERT(day >= 1 && day <= FX_DaysInMonth(year, month));
- ASSERT(hour <= 23);
- ASSERT(minute <= 59);
- ASSERT(second <= 59);
- ASSERT(millisecond <= 999);
- m_DateTime.Date.sDate.year = year;
- m_DateTime.Date.sDate.month = month;
- m_DateTime.Date.sDate.day = day;
- m_DateTime.Time.sTime.hour = hour;
- m_DateTime.Time.sTime.minute = minute;
- m_DateTime.Time.sTime.second = second;
- m_DateTime.Time.sTime.millisecond = millisecond;
- return true;
-}
-bool CFX_DateTime::FromUnitime(FX_UNITIME t) {
- CFX_Unitime ut(t);
- FX_DaysToDate(ut.GetDayOfAD(), m_DateTime.Date.sDate.year,
- m_DateTime.Date.sDate.month, m_DateTime.Date.sDate.day);
- m_DateTime.Date.sDate.day = ut.GetHour();
- m_DateTime.Time.sTime.minute = ut.GetMinute();
- m_DateTime.Time.sTime.second = ut.GetSecond();
- m_DateTime.Time.sTime.millisecond = ut.GetMillisecond();
- return true;
-}
-FX_UNITIME CFX_DateTime::ToUnitime() const {
- FX_UNITIME v =
- (int64_t)m_DateTime.Date.sDate.day * g_FXMillisecondsPerHour +
- (int64_t)m_DateTime.Time.sTime.minute * g_FXMillisecondsPerMinute +
- (int64_t)m_DateTime.Time.sTime.second * g_FXMillisecondsPerSecond +
- m_DateTime.Time.sTime.millisecond;
- v += FX_DateToDays(m_DateTime.Date.sDate.year, m_DateTime.Date.sDate.month,
- m_DateTime.Date.sDate.day, false) *
- g_FXMillisecondsPerDay;
- return v;
-}
-int32_t CFX_DateTime::GetYear() const {
- return m_DateTime.Date.sDate.year;
-}
-uint8_t CFX_DateTime::GetMonth() const {
- return m_DateTime.Date.sDate.month;
-}
-uint8_t CFX_DateTime::GetDay() const {
- return m_DateTime.Date.sDate.day;
-}
-FX_WEEKDAY CFX_DateTime::GetDayOfWeek() const {
- int32_t v = (int32_t)(FX_DateToDays(m_DateTime.Date.sDate.year,
- m_DateTime.Date.sDate.month,
- m_DateTime.Date.sDate.day, true) %
- 7);
- if (v < 0) {
- v += 7;
- }
- return (FX_WEEKDAY)v;
-}
-uint16_t CFX_DateTime::GetDayOfYear() const {
- return FX_DaysBeforeMonthInYear(m_DateTime.Date.sDate.year,
- m_DateTime.Date.sDate.month) +
- m_DateTime.Date.sDate.day;
-}
-int64_t CFX_DateTime::GetDayOfAD() const {
- return FX_DateToDays(m_DateTime.Date.sDate.year, m_DateTime.Date.sDate.month,
- m_DateTime.Date.sDate.day, true);
-}
-uint8_t CFX_DateTime::GetHour() const {
- return m_DateTime.Date.sDate.day;
-}
-uint8_t CFX_DateTime::GetMinute() const {
- return m_DateTime.Time.sTime.minute;
-}
-uint8_t CFX_DateTime::GetSecond() const {
- return m_DateTime.Time.sTime.second;
-}
-uint16_t CFX_DateTime::GetMillisecond() const {
- return m_DateTime.Time.sTime.millisecond;
-}
-bool CFX_DateTime::AddYears(int32_t iYears) {
- if (iYears == 0) {
- return false;
- }
- int32_t v = m_DateTime.Date.sDate.year + iYears;
- if (v >= 0 && m_DateTime.Date.sDate.year < 0) {
- v++;
- } else if (v <= 0 && m_DateTime.Date.sDate.year > 0) {
- v--;
- }
- m_DateTime.Date.sDate.year = v;
- return true;
-}
-bool CFX_DateTime::AddMonths(int32_t iMonths) {
- if (iMonths == 0) {
- return false;
- }
- bool b = iMonths > 0;
- iMonths += m_DateTime.Date.sDate.month;
- while (iMonths < 1) {
- m_DateTime.Date.sDate.year--;
- if (m_DateTime.Date.sDate.year == 0) {
- m_DateTime.Date.sDate.year = -1;
- }
- iMonths += 12;
- }
- while (iMonths > 12) {
- m_DateTime.Date.sDate.year++;
- if (m_DateTime.Date.sDate.year == 0) {
- m_DateTime.Date.sDate.year = 1;
- }
- iMonths -= 12;
- }
- if (m_DateTime.Date.sDate.year == 0) {
- m_DateTime.Date.sDate.year = b ? 1 : -1;
- }
- m_DateTime.Date.sDate.month = (uint8_t)iMonths;
- return true;
-}
-bool CFX_DateTime::AddDays(int32_t iDays) {
- if (iDays == 0) {
- return false;
- }
- int64_t v1 =
- FX_DateToDays(m_DateTime.Date.sDate.year, m_DateTime.Date.sDate.month,
- m_DateTime.Date.sDate.day, true);
- int64_t v2 = v1 + iDays;
- if (v2 <= 0 && v1 > 0) {
- v2--;
- } else if (v2 >= 0 && v1 < 0) {
- v2++;
- }
- FX_DaysToDate(v2, m_DateTime.Date.sDate.year, m_DateTime.Date.sDate.month,
- m_DateTime.Date.sDate.day);
- return true;
-}
-bool CFX_DateTime::AddHours(int32_t iHours) {
- if (iHours == 0) {
- return false;
- }
- iHours += m_DateTime.Date.sDate.day;
- int32_t iDays = iHours / 24;
- iHours %= 24;
- if (iHours < 0) {
- iDays--, iHours += 24;
- }
- m_DateTime.Date.sDate.day = (uint8_t)iHours;
- if (iDays != 0) {
- AddDays(iDays);
- }
- return true;
-}
-bool CFX_DateTime::AddMinutes(int32_t iMinutes) {
- if (iMinutes == 0) {
- return false;
- }
- iMinutes += m_DateTime.Time.sTime.minute;
- int32_t iHours = iMinutes / 60;
- iMinutes %= 60;
- if (iMinutes < 0) {
- iHours--, iMinutes += 60;
- }
- m_DateTime.Time.sTime.minute = (uint8_t)iMinutes;
- if (iHours != 0) {
- AddHours(iHours);
- }
- return true;
-}
-bool CFX_DateTime::AddSeconds(int32_t iSeconds) {
- if (iSeconds == 0) {
- return false;
- }
- iSeconds += m_DateTime.Time.sTime.second;
- int32_t iMinutes = iSeconds / 60;
- iSeconds %= 60;
- if (iSeconds < 0) {
- iMinutes--, iSeconds += 60;
- }
- m_DateTime.Time.sTime.second = (uint8_t)iSeconds;
- if (iMinutes != 0) {
- AddMinutes(iMinutes);
- }
- return true;
-}
-bool CFX_DateTime::AddMilliseconds(int32_t iMilliseconds) {
- if (iMilliseconds == 0) {
- return false;
- }
- iMilliseconds += m_DateTime.Time.sTime.millisecond;
- int32_t iSeconds = (int32_t)(iMilliseconds / g_FXMillisecondsPerSecond);
- iMilliseconds %= g_FXMillisecondsPerSecond;
- if (iMilliseconds < 0) {
- iSeconds--, iMilliseconds += g_FXMillisecondsPerSecond;
- }
- m_DateTime.Time.sTime.millisecond = (uint16_t)iMilliseconds;
- if (iSeconds != 0) {
- AddSeconds(iSeconds);
- }
- return true;
-}
diff --git a/chromium/third_party/pdfium/xfa/fgas/localization/fgas_datetime.h b/chromium/third_party/pdfium/xfa/fgas/localization/fgas_datetime.h
deleted file mode 100644
index d3ea9fa4a6a..00000000000
--- a/chromium/third_party/pdfium/xfa/fgas/localization/fgas_datetime.h
+++ /dev/null
@@ -1,375 +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 XFA_FGAS_LOCALIZATION_FGAS_DATETIME_H_
-#define XFA_FGAS_LOCALIZATION_FGAS_DATETIME_H_
-
-#include "core/fxcrt/fx_system.h"
-
-class CFX_Unitime;
-class CFX_DateTime;
-
-typedef int64_t FX_UNITIME;
-enum FX_WEEKDAY {
- FX_Sunday = 0,
- FX_Monday,
- FX_Tuesday,
- FX_Wednesday,
- FX_Thursday,
- FX_Friday,
- FX_Saturday,
-};
-
-bool FX_IsLeapYear(int32_t iYear);
-int32_t FX_DaysInYear(int32_t iYear);
-uint8_t FX_DaysInMonth(int32_t iYear, uint8_t iMonth);
-
-class CFX_Unitime {
- public:
- CFX_Unitime() { m_iUnitime = 0; }
- explicit CFX_Unitime(FX_UNITIME iUnitime) { m_iUnitime = iUnitime; }
- CFX_Unitime(const CFX_Unitime& unitime) { m_iUnitime = unitime.m_iUnitime; }
- operator FX_UNITIME*() { return &m_iUnitime; }
- operator FX_UNITIME const*() const { return &m_iUnitime; }
- operator FX_UNITIME&() { return m_iUnitime; }
- operator const FX_UNITIME&() const { return m_iUnitime; }
- CFX_Unitime& operator=(const CFX_Unitime& t) {
- m_iUnitime = t.m_iUnitime;
- return *this;
- }
- CFX_Unitime& operator=(FX_UNITIME t) {
- m_iUnitime = t;
- return *this;
- }
- CFX_Unitime& operator+=(const CFX_Unitime& t) {
- m_iUnitime += t.m_iUnitime;
- return *this;
- }
- CFX_Unitime& operator+=(FX_UNITIME t) {
- m_iUnitime += t;
- return *this;
- }
- CFX_Unitime& operator-=(const CFX_Unitime& t) {
- m_iUnitime -= t.m_iUnitime;
- return *this;
- }
- CFX_Unitime& operator-=(FX_UNITIME t) {
- m_iUnitime -= t;
- return *this;
- }
- void Now();
- void SetGMTime();
- void Set(int32_t year,
- uint8_t month,
- uint8_t day,
- uint8_t hour = 0,
- uint8_t minute = 0,
- uint8_t second = 0,
- uint16_t millisecond = 0);
- void Set(FX_UNITIME t);
- int32_t GetYear() const;
- uint8_t GetMonth() const;
- uint8_t GetDay() const;
- FX_WEEKDAY GetDayOfWeek() const;
- uint16_t GetDayOfYear() const;
- int64_t GetDayOfAD() const;
- uint8_t GetHour() const;
- uint8_t GetMinute() const;
- uint8_t GetSecond() const;
- uint16_t GetMillisecond() const;
- bool AddYears(int32_t iYears);
- bool AddMonths(int32_t iMonths);
- bool AddDays(int32_t iDays);
- bool AddHours(int32_t iHours);
- bool AddMinutes(int32_t iMinutes);
- bool AddSeconds(int32_t iSeconds);
- bool AddMilliseconds(int32_t iMilliseconds);
- friend CFX_Unitime operator+(const CFX_Unitime& t1, const CFX_Unitime& t2) {
- return CFX_Unitime(t1.m_iUnitime + t2.m_iUnitime);
- }
- friend CFX_Unitime operator+(const CFX_Unitime& t1, FX_UNITIME t2) {
- return CFX_Unitime(t1.m_iUnitime + t2);
- }
- friend CFX_Unitime operator+(FX_UNITIME t1, const CFX_Unitime& t2) {
- return CFX_Unitime(t1 + t2.m_iUnitime);
- }
- friend CFX_Unitime operator-(const CFX_Unitime& t1, const CFX_Unitime& t2) {
- return CFX_Unitime(t1.m_iUnitime + t2.m_iUnitime);
- }
- friend CFX_Unitime operator-(const CFX_Unitime& t1, FX_UNITIME t2) {
- return CFX_Unitime(t1.m_iUnitime + t2);
- }
- friend CFX_Unitime operator-(FX_UNITIME t1, const CFX_Unitime& t2) {
- return CFX_Unitime(t1 + t2.m_iUnitime);
- }
- friend bool operator==(const CFX_Unitime& t1, const CFX_Unitime& t2) {
- return t1.m_iUnitime == t2.m_iUnitime;
- }
- friend bool operator==(const CFX_Unitime& t1, FX_UNITIME t2) {
- return t1.m_iUnitime == t2;
- }
- friend bool operator==(FX_UNITIME t1, const CFX_Unitime& t2) {
- return t1 == t2.m_iUnitime;
- }
- friend bool operator!=(const CFX_Unitime& t1, const CFX_Unitime& t2) {
- return t1.m_iUnitime != t2.m_iUnitime;
- }
- friend bool operator!=(const CFX_Unitime& t1, FX_UNITIME t2) {
- return t1.m_iUnitime != t2;
- }
- friend bool operator!=(FX_UNITIME t1, const CFX_Unitime& t2) {
- return t1 != t2.m_iUnitime;
- }
- friend bool operator>(const CFX_Unitime& t1, const CFX_Unitime& t2) {
- return t1.m_iUnitime > t2.m_iUnitime;
- }
- friend bool operator>(const CFX_Unitime& t1, FX_UNITIME t2) {
- return t1.m_iUnitime > t2;
- }
- friend bool operator>(FX_UNITIME t1, const CFX_Unitime& t2) {
- return t1 > t2.m_iUnitime;
- }
- friend bool operator>=(const CFX_Unitime& t1, const CFX_Unitime& t2) {
- return t1.m_iUnitime >= t2.m_iUnitime;
- }
- friend bool operator>=(const CFX_Unitime& t1, FX_UNITIME t2) {
- return t1.m_iUnitime >= t2;
- }
- friend bool operator>=(FX_UNITIME t1, const CFX_Unitime& t2) {
- return t1 >= t2.m_iUnitime;
- }
- friend bool operator<(const CFX_Unitime& t1, const CFX_Unitime& t2) {
- return t1.m_iUnitime < t2.m_iUnitime;
- }
- friend bool operator<(const CFX_Unitime& t1, FX_UNITIME t2) {
- return t1.m_iUnitime < t2;
- }
- friend bool operator<(FX_UNITIME t1, const CFX_Unitime& t2) {
- return t1 < t2.m_iUnitime;
- }
- friend bool operator<=(const CFX_Unitime& t1, const CFX_Unitime& t2) {
- return t1.m_iUnitime <= t2.m_iUnitime;
- }
- friend bool operator<=(const CFX_Unitime& t1, FX_UNITIME t2) {
- return t1.m_iUnitime <= t2;
- }
- friend bool operator<=(FX_UNITIME t1, const CFX_Unitime& t2) {
- return t1 <= t2.m_iUnitime;
- }
-
- private:
- FX_UNITIME m_iUnitime;
-};
-
-#if _FX_OS_ != _FX_ANDROID_
-#pragma pack(push, 1)
-#endif
-struct FX_DATE {
- int32_t year;
- uint8_t month;
- uint8_t day;
-};
-
-struct FX_TIME {
- uint8_t hour;
- uint8_t minute;
- uint8_t second;
- uint16_t millisecond;
-};
-
-struct FX_TIMEZONE {
- int8_t tzHour;
- uint8_t tzMinute;
-};
-
-struct FX_DATETIME {
- union {
- struct {
- int32_t year;
- uint8_t month;
- uint8_t day;
- } sDate;
- FX_DATE aDate;
- } Date;
- union {
- struct {
- uint8_t hour;
- uint8_t minute;
- uint8_t second;
- uint16_t millisecond;
- } sTime;
- FX_TIME aTime;
- } Time;
-};
-
-#if _FX_OS_ != _FX_ANDROID_
-#pragma pack(pop)
-#endif
-
-class CFX_DateTime {
- public:
- CFX_DateTime() {}
- explicit CFX_DateTime(const FX_DATETIME& dt) { m_DateTime = dt; }
- CFX_DateTime(const CFX_DateTime& dt) { m_DateTime = dt.m_DateTime; }
- virtual ~CFX_DateTime() {}
- operator FX_DATETIME*() { return &m_DateTime; }
- operator const FX_DATETIME*() const { return &m_DateTime; }
- operator FX_DATETIME&() { return m_DateTime; }
- operator const FX_DATETIME&() const { return m_DateTime; }
- CFX_DateTime& operator=(const CFX_DateTime& dt) {
- m_DateTime = dt.m_DateTime;
- return *this;
- }
- CFX_DateTime& operator=(const FX_DATETIME& dt) {
- m_DateTime = dt;
- return *this;
- }
- CFX_DateTime& operator+=(const CFX_DateTime& dt) {
- FromUnitime(ToUnitime() + dt.ToUnitime());
- return *this;
- }
- CFX_DateTime& operator+=(const FX_DATETIME& dt) {
- FromUnitime(ToUnitime() + ((const CFX_DateTime&)dt).ToUnitime());
- return *this;
- }
- CFX_DateTime& operator-=(const CFX_DateTime& dt) {
- FromUnitime(ToUnitime() - dt.ToUnitime());
- return *this;
- }
- CFX_DateTime& operator-=(const FX_DATETIME& dt) {
- FromUnitime(ToUnitime() - ((const CFX_DateTime&)dt).ToUnitime());
- return *this;
- }
- virtual bool Set(int32_t year,
- uint8_t month,
- uint8_t day,
- uint8_t hour = 0,
- uint8_t minute = 0,
- uint8_t second = 0,
- uint16_t millisecond = 0);
- virtual bool FromUnitime(FX_UNITIME t);
- virtual FX_UNITIME ToUnitime() const;
- virtual int32_t GetYear() const;
- virtual uint8_t GetMonth() const;
- virtual uint8_t GetDay() const;
- virtual FX_WEEKDAY GetDayOfWeek() const;
- virtual uint16_t GetDayOfYear() const;
- virtual int64_t GetDayOfAD() const;
- virtual uint8_t GetHour() const;
- virtual uint8_t GetMinute() const;
- virtual uint8_t GetSecond() const;
- virtual uint16_t GetMillisecond() const;
- virtual bool AddYears(int32_t iYears);
- virtual bool AddMonths(int32_t iMonths);
- virtual bool AddDays(int32_t iDays);
- virtual bool AddHours(int32_t iHours);
- virtual bool AddMinutes(int32_t iMinutes);
- virtual bool AddSeconds(int32_t iSeconds);
- virtual bool AddMilliseconds(int32_t iMilliseconds);
- friend CFX_DateTime operator+(const CFX_DateTime& dt1,
- const CFX_DateTime& dt2) {
- CFX_DateTime dt;
- dt.FromUnitime(dt1.ToUnitime() + dt2.ToUnitime());
- return dt;
- }
- friend CFX_DateTime operator+(const CFX_DateTime& dt1,
- const FX_DATETIME& dt2) {
- CFX_DateTime dt;
- dt.FromUnitime(dt1.ToUnitime() + ((const CFX_DateTime&)dt2).ToUnitime());
- return dt;
- }
- friend CFX_DateTime operator+(const FX_DATETIME& dt1,
- const CFX_DateTime& dt2) {
- CFX_DateTime dt;
- dt.FromUnitime(((const CFX_DateTime&)dt1).ToUnitime() + dt2.ToUnitime());
- return dt;
- }
- friend CFX_DateTime operator-(const CFX_DateTime& dt1,
- const CFX_DateTime& dt2) {
- CFX_DateTime dt;
- dt.FromUnitime(dt1.ToUnitime() - dt2.ToUnitime());
- return dt;
- }
- friend CFX_DateTime operator-(const CFX_DateTime& dt1,
- const FX_DATETIME& dt2) {
- CFX_DateTime dt;
- dt.FromUnitime(dt1.ToUnitime() - ((const CFX_DateTime&)dt2).ToUnitime());
- return dt;
- }
- friend CFX_DateTime operator-(const FX_DATETIME& dt1,
- const CFX_DateTime& dt2) {
- CFX_DateTime dt;
- dt.FromUnitime(((const CFX_DateTime&)dt1).ToUnitime() - dt2.ToUnitime());
- return dt;
- }
- friend bool operator==(const CFX_DateTime& dt1, const CFX_DateTime& dt2) {
- return FXSYS_memcmp(static_cast<const FX_DATETIME*>(dt1),
- static_cast<const FX_DATETIME*>(dt2),
- sizeof(FX_DATETIME)) == 0;
- }
- friend bool operator==(const CFX_DateTime& dt1, const FX_DATETIME& dt2) {
- return FXSYS_memcmp(static_cast<const FX_DATETIME*>(dt1), &dt2,
- sizeof(FX_DATETIME)) == 0;
- }
- friend bool operator==(const FX_DATETIME& dt1, const CFX_DateTime& dt2) {
- return FXSYS_memcmp(&dt1, static_cast<const FX_DATETIME*>(dt2),
- sizeof(FX_DATETIME)) == 0;
- }
- friend bool operator!=(const CFX_DateTime& dt1, const CFX_DateTime& dt2) {
- return FXSYS_memcmp(static_cast<const FX_DATETIME*>(dt1),
- static_cast<const FX_DATETIME*>(dt2),
- sizeof(FX_DATETIME)) != 0;
- }
- friend bool operator!=(const CFX_DateTime& dt1, const FX_DATETIME& dt2) {
- return FXSYS_memcmp(static_cast<const FX_DATETIME*>(dt1), &dt2,
- sizeof(FX_DATETIME)) != 0;
- }
- friend bool operator!=(const FX_DATETIME& dt1, const CFX_DateTime& dt2) {
- return FXSYS_memcmp(&dt1, static_cast<const FX_DATETIME*>(dt2),
- sizeof(FX_DATETIME)) != 0;
- }
- friend bool operator>(const CFX_DateTime& dt1, const CFX_DateTime& dt2) {
- return dt1.ToUnitime() > dt2.ToUnitime();
- }
- friend bool operator>(const CFX_DateTime& dt1, const FX_DATETIME& dt2) {
- return dt1.ToUnitime() > ((const CFX_DateTime&)dt2).ToUnitime();
- }
- friend bool operator>(const FX_DATETIME& dt1, const CFX_DateTime& dt2) {
- return ((const CFX_DateTime&)dt1).ToUnitime() > dt2.ToUnitime();
- }
- friend bool operator>=(const CFX_DateTime& dt1, const CFX_DateTime& dt2) {
- return dt1.ToUnitime() >= dt2.ToUnitime();
- }
- friend bool operator>=(const CFX_DateTime& dt1, const FX_DATETIME& dt2) {
- return dt1.ToUnitime() >= ((const CFX_DateTime&)dt2).ToUnitime();
- }
- friend bool operator>=(const FX_DATETIME& dt1, const CFX_DateTime& dt2) {
- return ((const CFX_DateTime&)dt1).ToUnitime() >= dt2.ToUnitime();
- }
- friend bool operator<(const CFX_DateTime& dt1, const CFX_DateTime& dt2) {
- return dt1.ToUnitime() < dt2.ToUnitime();
- }
- friend bool operator<(const CFX_DateTime& dt1, const FX_DATETIME& dt2) {
- return dt1.ToUnitime() < ((const CFX_DateTime&)dt2).ToUnitime();
- }
- friend bool operator<(const FX_DATETIME& dt1, const CFX_DateTime& dt2) {
- return ((const CFX_DateTime&)dt1).ToUnitime() < dt2.ToUnitime();
- }
- friend bool operator<=(const CFX_DateTime& dt1, const CFX_DateTime& dt2) {
- return dt1.ToUnitime() <= dt2.ToUnitime();
- }
- friend bool operator<=(const CFX_DateTime& dt1, const FX_DATETIME& dt2) {
- return dt1.ToUnitime() <= ((const CFX_DateTime&)dt2).ToUnitime();
- }
- friend bool operator<=(const FX_DATETIME& dt1, const CFX_DateTime& dt2) {
- return ((const CFX_DateTime&)dt1).ToUnitime() <= dt2.ToUnitime();
- }
-
- private:
- FX_DATETIME m_DateTime;
-};
-
-#endif // XFA_FGAS_LOCALIZATION_FGAS_DATETIME_H_
diff --git a/chromium/third_party/pdfium/xfa/fgas/localization/fgas_locale.cpp b/chromium/third_party/pdfium/xfa/fgas/localization/fgas_locale.cpp
deleted file mode 100644
index 7d538411f52..00000000000
--- a/chromium/third_party/pdfium/xfa/fgas/localization/fgas_locale.cpp
+++ /dev/null
@@ -1,4766 +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
-
-#include "xfa/fgas/localization/fgas_locale.h"
-
-#include <algorithm>
-#include <vector>
-
-#include "core/fxcrt/fx_ext.h"
-#include "core/fxcrt/fx_xml.h"
-#include "xfa/fgas/localization/fgas_localeimp.h"
-
-#define FX_LOCALECATEGORY_DateHash 0xbde9abde
-#define FX_LOCALECATEGORY_TimeHash 0x2d71b00f
-#define FX_LOCALECATEGORY_DateTimeHash 0x158c72ed
-#define FX_LOCALECATEGORY_NumHash 0x0b4ff870
-#define FX_LOCALECATEGORY_TextHash 0x2d08af85
-#define FX_LOCALECATEGORY_ZeroHash 0x568cb500
-#define FX_LOCALECATEGORY_NullHash 0x052931bb
-
-struct FX_LOCALESUBCATEGORYINFO {
- uint32_t uHash;
- const FX_WCHAR* pName;
- int32_t eSubCategory;
-};
-
-static const FX_LOCALESUBCATEGORYINFO g_FXLocaleDateTimeSubCatData[] = {
- {0x14da2125, L"default", FX_LOCALEDATETIMESUBCATEGORY_Default},
- {0x9041d4b0, L"short", FX_LOCALEDATETIMESUBCATEGORY_Short},
- {0xa084a381, L"medium", FX_LOCALEDATETIMESUBCATEGORY_Medium},
- {0xcdce56b3, L"full", FX_LOCALEDATETIMESUBCATEGORY_Full},
- {0xf6b4afb0, L"long", FX_LOCALEDATETIMESUBCATEGORY_Long},
-};
-static const int32_t g_iFXLocaleDateTimeSubCatCount =
- sizeof(g_FXLocaleDateTimeSubCatData) / sizeof(FX_LOCALESUBCATEGORYINFO);
-
-static const FX_LOCALESUBCATEGORYINFO g_FXLocaleNumSubCatData[] = {
- {0x46f95531, L"percent", FX_LOCALENUMPATTERN_Percent},
- {0x4c4e8acb, L"currency", FX_LOCALENUMPATTERN_Currency},
- {0x54034c2f, L"decimal", FX_LOCALENUMPATTERN_Decimal},
- {0x7568e6ae, L"integer", FX_LOCALENUMPATTERN_Integer},
-};
-static const int32_t g_iFXLocaleNumSubCatCount =
- sizeof(g_FXLocaleNumSubCatData) / sizeof(FX_LOCALESUBCATEGORYINFO);
-
-struct FX_LOCALETIMEZONEINFO {
- uint32_t uHash;
- int16_t iHour;
- int16_t iMinute;
-};
-
-static const FX_LOCALETIMEZONEINFO g_FXLocaleTimeZoneData[] = {
- {FXBSTR_ID(0, 'C', 'D', 'T'), -5, 0}, {FXBSTR_ID(0, 'C', 'S', 'T'), -6, 0},
- {FXBSTR_ID(0, 'E', 'D', 'T'), -4, 0}, {FXBSTR_ID(0, 'E', 'S', 'T'), -5, 0},
- {FXBSTR_ID(0, 'M', 'D', 'T'), -6, 0}, {FXBSTR_ID(0, 'M', 'S', 'T'), -7, 0},
- {FXBSTR_ID(0, 'P', 'D', 'T'), -7, 0}, {FXBSTR_ID(0, 'P', 'S', 'T'), -8, 0},
-};
-
-static const FX_WCHAR gs_wsTimeSymbols[] = L"hHkKMSFAzZ";
-static const FX_WCHAR gs_wsDateSymbols[] = L"DJMEeGgYwW";
-static const FX_WCHAR gs_wsConstChars[] = L",-:/. ";
-
-static int32_t FX_ParseTimeZone(const FX_WCHAR* pStr,
- int32_t iLen,
- FX_TIMEZONE& tz) {
- tz.tzHour = 0;
- tz.tzMinute = 0;
- if (iLen < 0) {
- return 0;
- }
- int32_t iStart = 1;
- int32_t iEnd = iStart + 2;
- while (iStart < iLen && iStart < iEnd) {
- tz.tzHour = tz.tzHour * 10 + pStr[iStart++] - '0';
- }
- if (iStart < iLen && pStr[iStart] == ':') {
- iStart++;
- }
- iEnd = iStart + 2;
- while (iStart < iLen && iStart < iEnd) {
- tz.tzMinute = tz.tzMinute * 10 + pStr[iStart++] - '0';
- }
- if (pStr[0] == '-') {
- tz.tzHour = -tz.tzHour;
- }
- return iStart;
-}
-
-class CFX_LCNumeric {
- public:
- CFX_LCNumeric();
- CFX_LCNumeric(int64_t integral,
- uint32_t fractional = 0,
- int32_t exponent = 0);
- explicit CFX_LCNumeric(FX_FLOAT dbRetValue);
- explicit CFX_LCNumeric(double dbvalue);
- explicit CFX_LCNumeric(CFX_WideString& wsNumeric);
-
- FX_FLOAT GetFloat() const;
- double GetDouble() const;
- CFX_WideString ToString() const;
- CFX_WideString ToString(int32_t nTreading, bool bTrimTailZeros) const;
-
- int64_t m_Integral;
- uint32_t m_Fractional;
- int32_t m_Exponent;
-};
-
-static bool FX_WStringToNumeric(const CFX_WideString& wsValue,
- CFX_LCNumeric& lcnum) {
- lcnum.m_Integral = 0;
- lcnum.m_Fractional = 0;
- lcnum.m_Exponent = 0;
-
- if (wsValue.IsEmpty())
- return false;
-
- const int32_t nIntegralMaxLen = 17;
- int32_t cc = 0;
- bool bNegative = false;
- bool bExpSign = false;
- const FX_WCHAR* str = wsValue.c_str();
- int32_t len = wsValue.GetLength();
- while (cc < len && FXSYS_iswspace(str[cc]))
- cc++;
-
- if (cc >= len)
- return false;
-
- if (str[cc] == '+') {
- cc++;
- } else if (str[cc] == '-') {
- bNegative = true;
- cc++;
- }
- int32_t nIntegralLen = 0;
- while (cc < len) {
- if (str[cc] == '.')
- break;
-
- if (!FXSYS_isDecimalDigit(str[cc])) {
- if ((str[cc] == 'E' || str[cc] == 'e'))
- break;
- return false;
- }
- if (nIntegralLen < nIntegralMaxLen) {
- lcnum.m_Integral = lcnum.m_Integral * 10 + str[cc] - '0';
- nIntegralLen++;
- }
- cc++;
- }
-
- lcnum.m_Integral = bNegative ? -lcnum.m_Integral : lcnum.m_Integral;
- if (cc < len && str[cc] == '.') {
- int scale = 0;
- double fraction = 0.0;
- cc++;
- while (cc < len) {
- if (scale >= FXSYS_FractionalScaleCount()) {
- while (cc < len) {
- if (!FXSYS_isDecimalDigit(str[cc]))
- break;
- cc++;
- }
- }
- if (!FXSYS_isDecimalDigit(str[cc])) {
- if ((str[cc] == 'E' || str[cc] == 'e'))
- break;
- return false;
- }
- fraction += FXSYS_FractionalScale(scale, FXSYS_toDecimalDigit(str[cc]));
- scale++;
- cc++;
- }
- lcnum.m_Fractional = (uint32_t)(fraction * 4294967296.0);
- }
- if (cc < len && (str[cc] == 'E' || str[cc] == 'e')) {
- cc++;
- if (cc < len) {
- if (str[cc] == '+') {
- cc++;
- } else if (str[cc] == '-') {
- bExpSign = true;
- cc++;
- }
- }
- while (cc < len) {
- if (FXSYS_isDecimalDigit(str[cc]))
- return false;
- lcnum.m_Exponent = lcnum.m_Exponent * 10 + str[cc] - '0';
- cc++;
- }
- lcnum.m_Exponent = bExpSign ? -lcnum.m_Exponent : lcnum.m_Exponent;
- }
- return true;
-}
-
-CFX_LCNumeric::CFX_LCNumeric() {
- m_Integral = 0;
- m_Fractional = 0;
- m_Exponent = 0;
-}
-CFX_LCNumeric::CFX_LCNumeric(int64_t integral,
- uint32_t fractional,
- int32_t exponent) {
- m_Integral = integral;
- m_Fractional = fractional;
- m_Exponent = exponent;
-}
-CFX_LCNumeric::CFX_LCNumeric(FX_FLOAT dbRetValue) {
- m_Integral = (int64_t)dbRetValue;
- m_Fractional = (uint32_t)(((dbRetValue > 0) ? (dbRetValue - m_Integral)
- : (m_Integral - dbRetValue)) *
- 4294967296);
- m_Exponent = 0;
-}
-CFX_LCNumeric::CFX_LCNumeric(double dbvalue) {
- m_Integral = (int64_t)dbvalue;
- m_Fractional = (uint32_t)(
- ((dbvalue > 0) ? (dbvalue - m_Integral) : (m_Integral - dbvalue)) *
- 4294967296);
- m_Exponent = 0;
-}
-CFX_LCNumeric::CFX_LCNumeric(CFX_WideString& wsNumeric) {
- FX_WStringToNumeric(wsNumeric, *this);
-}
-FX_FLOAT CFX_LCNumeric::GetFloat() const {
- FX_FLOAT dbRetValue = m_Fractional / 4294967296.0f;
- dbRetValue = m_Integral + (m_Integral >= 0 ? dbRetValue : -dbRetValue);
- if (m_Exponent != 0) {
- dbRetValue *= FXSYS_pow(10, (FX_FLOAT)m_Exponent);
- }
- return dbRetValue;
-}
-double CFX_LCNumeric::GetDouble() const {
- double value = m_Fractional / 4294967296.0;
- value = m_Integral + (m_Integral >= 0 ? value : -value);
- if (m_Exponent != 0) {
- value *= FXSYS_pow(10, (FX_FLOAT)m_Exponent);
- }
- return value;
-}
-
-CFX_WideString CFX_LCNumeric::ToString() const {
- return ToString(8, true);
-}
-
-CFX_WideString CFX_LCNumeric::ToString(int32_t nTreading,
- bool bTrimTailZeros) const {
- CFX_WideString wsFormat;
- wsFormat.Format(L"%%.%df", nTreading);
- CFX_WideString wsResult;
- wsResult.Format(wsFormat.c_str(), GetDouble());
- if (bTrimTailZeros && nTreading > 0) {
- wsResult.TrimRight(L"0");
- wsResult.TrimRight(L".");
- }
- return wsResult;
-}
-
-CFX_FormatString::CFX_FormatString(IFX_LocaleMgr* pLocaleMgr, bool bUseLCID)
- : m_pLocaleMgr(pLocaleMgr), m_bUseLCID(bUseLCID) {}
-
-CFX_FormatString::~CFX_FormatString() {}
-
-void CFX_FormatString::SplitFormatString(
- const CFX_WideString& wsFormatString,
- std::vector<CFX_WideString>& wsPatterns) {
- int32_t iStrLen = wsFormatString.GetLength();
- const FX_WCHAR* pStr = wsFormatString.c_str();
- const FX_WCHAR* pToken = pStr;
- const FX_WCHAR* pEnd = pStr + iStrLen;
- bool iQuote = false;
- while (true) {
- if (pStr >= pEnd) {
- wsPatterns.push_back(CFX_WideString(pToken, pStr - pToken));
- return;
- }
- if (*pStr == '\'') {
- iQuote = !iQuote;
- } else if (*pStr == L'|' && !iQuote) {
- wsPatterns.push_back(CFX_WideString(pToken, pStr - pToken));
- pToken = pStr + 1;
- }
- pStr++;
- }
-}
-
-static CFX_WideString FX_GetLiteralText(const FX_WCHAR* pStrPattern,
- int32_t& iPattern,
- int32_t iLenPattern) {
- CFX_WideString wsOutput;
- if (pStrPattern[iPattern] != '\'') {
- return wsOutput;
- }
- iPattern++;
- int32_t iQuote = 1;
- while (iPattern < iLenPattern) {
- if (pStrPattern[iPattern] == '\'') {
- iQuote++;
- if ((iPattern + 1 >= iLenPattern) ||
- ((pStrPattern[iPattern + 1] != '\'') && (iQuote % 2 == 0))) {
- break;
- } else {
- iQuote++;
- }
- iPattern++;
- } else if (pStrPattern[iPattern] == '\\' && (iPattern + 1 < iLenPattern) &&
- pStrPattern[iPattern + 1] == 'u') {
- int32_t iKeyValue = 0;
- iPattern += 2;
- int32_t i = 0;
- while (iPattern < iLenPattern && i++ < 4) {
- FX_WCHAR ch = pStrPattern[iPattern++];
- if ((ch >= '0' && ch <= '9')) {
- iKeyValue = iKeyValue * 16 + ch - '0';
- } else if ((ch >= 'a' && ch <= 'f')) {
- iKeyValue = iKeyValue * 16 + ch - 'a' + 10;
- } else if ((ch >= 'A' && ch <= 'F')) {
- iKeyValue = iKeyValue * 16 + ch - 'A' + 10;
- }
- }
- if (iKeyValue != 0) {
- wsOutput += (FX_WCHAR)(iKeyValue & 0x0000FFFF);
- }
- continue;
- }
- wsOutput += pStrPattern[iPattern++];
- }
- return wsOutput;
-}
-static CFX_WideString FX_GetLiteralTextReverse(const FX_WCHAR* pStrPattern,
- int32_t& iPattern) {
- CFX_WideString wsOutput;
- if (pStrPattern[iPattern] != '\'') {
- return wsOutput;
- }
- iPattern--;
- int32_t iQuote = 1;
- while (iPattern >= 0) {
- if (pStrPattern[iPattern] == '\'') {
- iQuote++;
- if (iPattern - 1 >= 0 ||
- ((pStrPattern[iPattern - 1] != '\'') && (iQuote % 2 == 0))) {
- break;
- }
- iQuote++;
- iPattern--;
- } else if (pStrPattern[iPattern] == '\\' &&
- pStrPattern[iPattern + 1] == 'u') {
- iPattern--;
- int32_t iKeyValue = 0;
- int32_t iLen = wsOutput.GetLength();
- int32_t i = 1;
- for (; i < iLen && i < 5; i++) {
- FX_WCHAR ch = wsOutput[i];
- if ((ch >= '0' && ch <= '9')) {
- iKeyValue = iKeyValue * 16 + ch - '0';
- } else if ((ch >= 'a' && ch <= 'f')) {
- iKeyValue = iKeyValue * 16 + ch - 'a' + 10;
- } else if ((ch >= 'A' && ch <= 'F')) {
- iKeyValue = iKeyValue * 16 + ch - 'A' + 10;
- }
- }
- if (iKeyValue != 0) {
- wsOutput.Delete(0, i);
- wsOutput = (FX_WCHAR)(iKeyValue & 0x0000FFFF) + wsOutput;
- }
- continue;
- }
- wsOutput = pStrPattern[iPattern--] + wsOutput;
- }
- return wsOutput;
-}
-FX_LOCALECATEGORY CFX_FormatString::GetCategory(
- const CFX_WideString& wsPattern) {
- FX_LOCALECATEGORY eCategory = FX_LOCALECATEGORY_Unknown;
- int32_t ccf = 0;
- int32_t iLenf = wsPattern.GetLength();
- const FX_WCHAR* pStr = wsPattern.c_str();
- bool bBraceOpen = false;
- CFX_WideStringC wsConstChars(gs_wsConstChars);
- while (ccf < iLenf) {
- if (pStr[ccf] == '\'') {
- FX_GetLiteralText(pStr, ccf, iLenf);
- } else if (!bBraceOpen && wsConstChars.Find(pStr[ccf]) == -1) {
- CFX_WideString wsCategory(pStr[ccf]);
- ccf++;
- while (true) {
- if (ccf == iLenf) {
- return eCategory;
- }
- if (pStr[ccf] == '.' || pStr[ccf] == '(') {
- break;
- }
- if (pStr[ccf] == '{') {
- bBraceOpen = true;
- break;
- }
- wsCategory += pStr[ccf];
- ccf++;
- }
- uint32_t dwHash = FX_HashCode_GetW(wsCategory.AsStringC(), false);
- if (dwHash == FX_LOCALECATEGORY_DateHash) {
- if (eCategory == FX_LOCALECATEGORY_Time) {
- return FX_LOCALECATEGORY_DateTime;
- }
- eCategory = FX_LOCALECATEGORY_Date;
- } else if (dwHash == FX_LOCALECATEGORY_TimeHash) {
- if (eCategory == FX_LOCALECATEGORY_Date) {
- return FX_LOCALECATEGORY_DateTime;
- }
- eCategory = FX_LOCALECATEGORY_Time;
- } else if (dwHash == FX_LOCALECATEGORY_DateTimeHash) {
- return FX_LOCALECATEGORY_DateTime;
- } else if (dwHash == FX_LOCALECATEGORY_TextHash) {
- return FX_LOCALECATEGORY_Text;
- } else if (dwHash == FX_LOCALECATEGORY_NumHash) {
- return FX_LOCALECATEGORY_Num;
- } else if (dwHash == FX_LOCALECATEGORY_ZeroHash) {
- return FX_LOCALECATEGORY_Zero;
- } else if (dwHash == FX_LOCALECATEGORY_NullHash) {
- return FX_LOCALECATEGORY_Null;
- }
- } else if (pStr[ccf] == '}') {
- bBraceOpen = false;
- }
- ccf++;
- }
- return eCategory;
-}
-static uint16_t FX_WStringToLCID(const FX_WCHAR* pstrLCID) {
- if (!pstrLCID) {
- return 0;
- }
- wchar_t* pEnd;
- return (uint16_t)wcstol((wchar_t*)pstrLCID, &pEnd, 16);
-}
-uint16_t CFX_FormatString::GetLCID(const CFX_WideString& wsPattern) {
- return FX_WStringToLCID(GetLocaleName(wsPattern).c_str());
-}
-CFX_WideString CFX_FormatString::GetLocaleName(
- const CFX_WideString& wsPattern) {
- int32_t ccf = 0;
- int32_t iLenf = wsPattern.GetLength();
- const FX_WCHAR* pStr = wsPattern.c_str();
- while (ccf < iLenf) {
- if (pStr[ccf] == '\'') {
- FX_GetLiteralText(pStr, ccf, iLenf);
- } else if (pStr[ccf] == '(') {
- ccf++;
- CFX_WideString wsLCID;
- while (ccf < iLenf && pStr[ccf] != ')') {
- wsLCID += pStr[ccf++];
- }
- return wsLCID;
- }
- ccf++;
- }
- return CFX_WideString();
-}
-IFX_Locale* CFX_FormatString::GetTextFormat(const CFX_WideString& wsPattern,
- const CFX_WideStringC& wsCategory,
- CFX_WideString& wsPurgePattern) {
- IFX_Locale* pLocale = nullptr;
- int32_t ccf = 0;
- int32_t iLenf = wsPattern.GetLength();
- const FX_WCHAR* pStr = wsPattern.c_str();
- bool bBrackOpen = false;
- CFX_WideStringC wsConstChars(gs_wsConstChars);
- while (ccf < iLenf) {
- if (pStr[ccf] == '\'') {
- int32_t iCurChar = ccf;
- FX_GetLiteralText(pStr, ccf, iLenf);
- wsPurgePattern += CFX_WideStringC(pStr + iCurChar, ccf - iCurChar + 1);
- } else if (!bBrackOpen && wsConstChars.Find(pStr[ccf]) == -1) {
- CFX_WideString wsSearchCategory(pStr[ccf]);
- ccf++;
- while (ccf < iLenf && pStr[ccf] != '{' && pStr[ccf] != '.' &&
- pStr[ccf] != '(') {
- wsSearchCategory += pStr[ccf];
- ccf++;
- }
- if (wsSearchCategory != wsCategory) {
- continue;
- }
- while (ccf < iLenf) {
- if (pStr[ccf] == '(') {
- ccf++;
- CFX_WideString wsLCID;
- while (ccf < iLenf && pStr[ccf] != ')') {
- wsLCID += pStr[ccf++];
- }
- pLocale = GetPatternLocale(wsLCID);
- } else if (pStr[ccf] == '{') {
- bBrackOpen = true;
- break;
- }
- ccf++;
- }
- } else if (pStr[ccf] != '}') {
- wsPurgePattern += pStr[ccf];
- }
- ccf++;
- }
- if (!bBrackOpen) {
- wsPurgePattern = wsPattern;
- }
- if (!pLocale) {
- pLocale = m_pLocaleMgr->GetDefLocale();
- }
- return pLocale;
-}
-#define FX_NUMSTYLE_Percent 0x01
-#define FX_NUMSTYLE_Exponent 0x02
-#define FX_NUMSTYLE_DotVorv 0x04
-IFX_Locale* CFX_FormatString::GetNumericFormat(const CFX_WideString& wsPattern,
- int32_t& iDotIndex,
- uint32_t& dwStyle,
- CFX_WideString& wsPurgePattern) {
- dwStyle = 0;
- IFX_Locale* pLocale = nullptr;
- int32_t ccf = 0;
- int32_t iLenf = wsPattern.GetLength();
- const FX_WCHAR* pStr = wsPattern.c_str();
- bool bFindDot = false;
- bool bBrackOpen = false;
- CFX_WideStringC wsConstChars(gs_wsConstChars);
- while (ccf < iLenf) {
- if (pStr[ccf] == '\'') {
- int32_t iCurChar = ccf;
- FX_GetLiteralText(pStr, ccf, iLenf);
- wsPurgePattern += CFX_WideStringC(pStr + iCurChar, ccf - iCurChar + 1);
- } else if (!bBrackOpen && wsConstChars.Find(pStr[ccf]) == -1) {
- CFX_WideString wsCategory(pStr[ccf]);
- ccf++;
- while (ccf < iLenf && pStr[ccf] != '{' && pStr[ccf] != '.' &&
- pStr[ccf] != '(') {
- wsCategory += pStr[ccf];
- ccf++;
- }
- if (wsCategory != L"num") {
- bBrackOpen = true;
- ccf = 0;
- continue;
- }
- while (ccf < iLenf) {
- if (pStr[ccf] == '(') {
- ccf++;
- CFX_WideString wsLCID;
- while (ccf < iLenf && pStr[ccf] != ')') {
- wsLCID += pStr[ccf++];
- }
- pLocale = GetPatternLocale(wsLCID);
- } else if (pStr[ccf] == '{') {
- bBrackOpen = true;
- break;
- } else if (pStr[ccf] == '.') {
- CFX_WideString wsSubCategory;
- ccf++;
- while (ccf < iLenf && pStr[ccf] != '(' && pStr[ccf] != '{') {
- wsSubCategory += pStr[ccf++];
- }
- uint32_t dwSubHash =
- FX_HashCode_GetW(wsSubCategory.AsStringC(), false);
- FX_LOCALENUMSUBCATEGORY eSubCategory = FX_LOCALENUMPATTERN_Decimal;
- for (int32_t i = 0; i < g_iFXLocaleNumSubCatCount; i++) {
- if (g_FXLocaleNumSubCatData[i].uHash == dwSubHash) {
- eSubCategory = (FX_LOCALENUMSUBCATEGORY)g_FXLocaleNumSubCatData[i]
- .eSubCategory;
- break;
- }
- }
- wsSubCategory.clear();
- if (!pLocale) {
- pLocale = m_pLocaleMgr->GetDefLocale();
- }
- ASSERT(pLocale);
- pLocale->GetNumPattern(eSubCategory, wsSubCategory);
- iDotIndex = wsSubCategory.Find('.');
- if (iDotIndex > 0) {
- iDotIndex += wsPurgePattern.GetLength();
- bFindDot = true;
- dwStyle |= FX_NUMSTYLE_DotVorv;
- }
- wsPurgePattern += wsSubCategory;
- if (eSubCategory == FX_LOCALENUMPATTERN_Percent) {
- dwStyle |= FX_NUMSTYLE_Percent;
- }
- continue;
- }
- ccf++;
- }
- } else if (pStr[ccf] == 'E') {
- dwStyle |= FX_NUMSTYLE_Exponent;
- wsPurgePattern += pStr[ccf];
- } else if (pStr[ccf] == '%') {
- dwStyle |= FX_NUMSTYLE_Percent;
- wsPurgePattern += pStr[ccf];
- } else if (pStr[ccf] != '}') {
- wsPurgePattern += pStr[ccf];
- }
- if (!bFindDot) {
- if (pStr[ccf] == '.' || pStr[ccf] == 'V' || pStr[ccf] == 'v') {
- bFindDot = true;
- iDotIndex = wsPurgePattern.GetLength() - 1;
- dwStyle |= FX_NUMSTYLE_DotVorv;
- }
- }
- ccf++;
- }
- if (!bFindDot) {
- iDotIndex = wsPurgePattern.GetLength();
- }
- if (!pLocale) {
- pLocale = m_pLocaleMgr->GetDefLocale();
- }
- return pLocale;
-}
-static bool FX_GetNumericDotIndex(const CFX_WideString& wsNum,
- const CFX_WideString& wsDotSymbol,
- int32_t& iDotIndex) {
- int32_t ccf = 0;
- int32_t iLenf = wsNum.GetLength();
- const FX_WCHAR* pStr = wsNum.c_str();
- int32_t iLenDot = wsDotSymbol.GetLength();
- while (ccf < iLenf) {
- if (pStr[ccf] == '\'') {
- FX_GetLiteralText(pStr, ccf, iLenf);
- } else if (ccf + iLenDot <= iLenf &&
- !FXSYS_wcsncmp(pStr + ccf, wsDotSymbol.c_str(), iLenDot)) {
- iDotIndex = ccf;
- return true;
- }
- ccf++;
- }
- iDotIndex = wsNum.Find('.');
- if (iDotIndex < 0) {
- iDotIndex = iLenf;
- return false;
- }
- return true;
-}
-bool CFX_FormatString::ParseText(const CFX_WideString& wsSrcText,
- const CFX_WideString& wsPattern,
- CFX_WideString& wsValue) {
- wsValue.clear();
- if (wsSrcText.IsEmpty() || wsPattern.IsEmpty()) {
- return false;
- }
- CFX_WideString wsTextFormat;
- GetTextFormat(wsPattern, L"text", wsTextFormat);
- if (wsTextFormat.IsEmpty()) {
- return false;
- }
- int32_t iText = 0, iPattern = 0;
- const FX_WCHAR* pStrText = wsSrcText.c_str();
- int32_t iLenText = wsSrcText.GetLength();
- const FX_WCHAR* pStrPattern = wsTextFormat.c_str();
- int32_t iLenPattern = wsTextFormat.GetLength();
- while (iPattern < iLenPattern && iText < iLenText) {
- switch (pStrPattern[iPattern]) {
- case '\'': {
- CFX_WideString wsLiteral =
- FX_GetLiteralText(pStrPattern, iPattern, iLenPattern);
- int32_t iLiteralLen = wsLiteral.GetLength();
- if (iText + iLiteralLen > iLenText ||
- FXSYS_wcsncmp(pStrText + iText, wsLiteral.c_str(), iLiteralLen)) {
- wsValue = wsSrcText;
- return false;
- }
- iText += iLiteralLen;
- iPattern++;
- break;
- }
- case 'A':
- if (FXSYS_iswalpha(pStrText[iText])) {
- wsValue += pStrText[iText];
- iText++;
- }
- iPattern++;
- break;
- case 'X':
- wsValue += pStrText[iText];
- iText++;
- iPattern++;
- break;
- case 'O':
- case '0':
- if (FXSYS_isDecimalDigit(pStrText[iText]) ||
- FXSYS_iswalpha(pStrText[iText])) {
- wsValue += pStrText[iText];
- iText++;
- }
- iPattern++;
- break;
- case '9':
- if (FXSYS_isDecimalDigit(pStrText[iText])) {
- wsValue += pStrText[iText];
- iText++;
- }
- iPattern++;
- break;
- default:
- if (pStrPattern[iPattern] != pStrText[iText]) {
- wsValue = wsSrcText;
- return false;
- }
- iPattern++;
- iText++;
- break;
- }
- }
- return iPattern == iLenPattern && iText == iLenText;
-}
-bool CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum,
- const CFX_WideString& wsPattern,
- FX_FLOAT& fValue) {
- fValue = 0.0f;
- if (wsSrcNum.IsEmpty() || wsPattern.IsEmpty()) {
- return false;
- }
- int32_t dot_index_f = -1;
- uint32_t dwFormatStyle = 0;
- CFX_WideString wsNumFormat;
- IFX_Locale* pLocale =
- GetNumericFormat(wsPattern, dot_index_f, dwFormatStyle, wsNumFormat);
- if (!pLocale || wsNumFormat.IsEmpty()) {
- return false;
- }
- int32_t iExponent = 0;
- CFX_WideString wsDotSymbol;
- pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Decimal, wsDotSymbol);
- CFX_WideString wsGroupSymbol;
- pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Grouping, wsGroupSymbol);
- int32_t iGroupLen = wsGroupSymbol.GetLength();
- CFX_WideString wsMinus;
- pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Minus, wsMinus);
- int32_t iMinusLen = wsMinus.GetLength();
- int cc = 0, ccf = 0;
- const FX_WCHAR* str = wsSrcNum.c_str();
- int len = wsSrcNum.GetLength();
- const FX_WCHAR* strf = wsNumFormat.c_str();
- int lenf = wsNumFormat.GetLength();
- double dbRetValue = 0;
- double coeff = 1;
- bool bHavePercentSymbol = false;
- bool bNeg = false;
- bool bReverseParse = false;
- int32_t dot_index = 0;
- if (!FX_GetNumericDotIndex(wsSrcNum, wsDotSymbol, dot_index) &&
- (dwFormatStyle & FX_NUMSTYLE_DotVorv)) {
- bReverseParse = true;
- }
- bReverseParse = false;
- if (bReverseParse) {
- ccf = lenf - 1;
- cc = len - 1;
- while (ccf > dot_index_f && cc >= 0) {
- switch (strf[ccf]) {
- case '\'': {
- CFX_WideString wsLiteral = FX_GetLiteralTextReverse(strf, ccf);
- int32_t iLiteralLen = wsLiteral.GetLength();
- cc -= iLiteralLen - 1;
- if (cc < 0 ||
- FXSYS_wcsncmp(str + cc, wsLiteral.c_str(), iLiteralLen)) {
- return false;
- }
- cc--;
- ccf--;
- break;
- }
- case '9':
- if (!FXSYS_isDecimalDigit(str[cc])) {
- return false;
- }
- dbRetValue = dbRetValue * coeff + (str[cc] - '0') * 0.1;
- coeff *= 0.1;
- cc--;
- ccf--;
- break;
- case 'z':
- if (cc >= 0) {
- dbRetValue = dbRetValue * coeff + (str[cc] - '0') * 0.1;
- coeff *= 0.1;
- cc--;
- }
- ccf--;
- break;
- case 'Z':
- if (str[cc] != ' ') {
- dbRetValue = dbRetValue * coeff + (str[cc] - '0') * 0.1;
- coeff *= 0.1;
- }
- cc--;
- ccf--;
- break;
- case 'S':
- if (str[cc] == '+' || str[cc] == ' ') {
- cc--;
- } else {
- cc -= iMinusLen - 1;
- if (cc < 0 || FXSYS_wcsncmp(str + cc, wsMinus.c_str(), iMinusLen)) {
- return false;
- }
- cc--;
- bNeg = true;
- }
- ccf--;
- break;
- case 's':
- if (str[cc] == '+') {
- cc--;
- } else {
- cc -= iMinusLen - 1;
- if (cc < 0 || FXSYS_wcsncmp(str + cc, wsMinus.c_str(), iMinusLen)) {
- return false;
- }
- cc--;
- bNeg = true;
- }
- ccf--;
- break;
- case 'E': {
- if (cc >= dot_index) {
- return false;
- }
- bool bExpSign = false;
- while (cc >= 0) {
- if (str[cc] == 'E' || str[cc] == 'e') {
- break;
- }
- if (FXSYS_isDecimalDigit(str[cc])) {
- iExponent = iExponent + (str[cc] - '0') * 10;
- cc--;
- continue;
- } else if (str[cc] == '+') {
- cc--;
- continue;
- } else if (cc - iMinusLen + 1 > 0 &&
- !FXSYS_wcsncmp(str + (cc - iMinusLen + 1),
- wsMinus.c_str(), iMinusLen)) {
- bExpSign = true;
- cc -= iMinusLen;
- } else {
- return false;
- }
- }
- cc--;
- iExponent = bExpSign ? -iExponent : iExponent;
- ccf--;
- } break;
- case '$': {
- CFX_WideString wsSymbol;
- pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_CurrencySymbol,
- wsSymbol);
- int32_t iSymbolLen = wsSymbol.GetLength();
- cc -= iSymbolLen - 1;
- if (cc < 0 || FXSYS_wcsncmp(str + cc, wsSymbol.c_str(), iSymbolLen)) {
- return false;
- }
- cc--;
- ccf--;
- } break;
- case 'r':
- if (ccf - 1 >= 0 && strf[ccf - 1] == 'c') {
- if (str[cc] == 'R' && cc - 1 >= 0 && str[cc - 1] == 'C') {
- bNeg = true;
- cc -= 2;
- }
- ccf -= 2;
- } else {
- ccf--;
- }
- break;
- case 'R':
- if (ccf - 1 >= 0 && strf[ccf - 1] == 'C') {
- if (str[cc] == ' ') {
- cc++;
- } else if (str[cc] == 'R' && cc - 1 >= 0 && str[cc - 1] == 'C') {
- bNeg = true;
- cc -= 2;
- }
- ccf -= 2;
- } else {
- ccf--;
- }
- break;
- case 'b':
- if (ccf - 1 >= 0 && strf[ccf - 1] == 'd') {
- if (str[cc] == 'B' && cc - 1 >= 0 && str[cc - 1] == 'D') {
- bNeg = true;
- cc -= 2;
- }
- ccf -= 2;
- } else {
- ccf--;
- }
- break;
- case 'B':
- if (ccf - 1 >= 0 && strf[ccf - 1] == 'D') {
- if (str[cc] == ' ') {
- cc++;
- } else if (str[cc] == 'B' && cc - 1 >= 0 && str[cc - 1] == 'D') {
- bNeg = true;
- cc -= 2;
- }
- ccf -= 2;
- } else {
- ccf--;
- }
- break;
- case '.':
- case 'V':
- case 'v':
- return false;
- case '%': {
- CFX_WideString wsSymbol;
- pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Percent, wsSymbol);
- int32_t iSysmbolLen = wsSymbol.GetLength();
- cc -= iSysmbolLen - 1;
- if (cc < 0 ||
- FXSYS_wcsncmp(str + cc, wsSymbol.c_str(), iSysmbolLen)) {
- return false;
- }
- cc--;
- ccf--;
- bHavePercentSymbol = true;
- } break;
- case '8':
- while (ccf < lenf && strf[ccf] == '8') {
- ccf++;
- }
- while (cc < len && FXSYS_isDecimalDigit(str[cc])) {
- dbRetValue = (str[cc] - '0') * coeff + dbRetValue;
- coeff *= 0.1;
- cc++;
- }
- break;
- case ',': {
- if (cc >= 0) {
- cc -= iGroupLen - 1;
- if (cc >= 0 &&
- FXSYS_wcsncmp(str + cc, wsGroupSymbol.c_str(), iGroupLen) ==
- 0) {
- cc--;
- } else {
- cc += iGroupLen - 1;
- }
- }
- ccf--;
- } break;
- case '(':
- if (str[cc] == L'(') {
- bNeg = true;
- } else if (str[cc] != L' ') {
- return false;
- }
- cc--;
- ccf--;
- break;
- case ')':
- if (str[cc] == L')') {
- bNeg = true;
- } else if (str[cc] != L' ') {
- return false;
- }
- cc--;
- ccf--;
- break;
- default:
- if (strf[ccf] != str[cc]) {
- return false;
- }
- cc--;
- ccf--;
- }
- }
- dot_index = cc + 1;
- }
- ccf = dot_index_f - 1;
- cc = dot_index - 1;
- coeff = 1;
- while (ccf >= 0 && cc >= 0) {
- switch (strf[ccf]) {
- case '\'': {
- CFX_WideString wsLiteral = FX_GetLiteralTextReverse(strf, ccf);
- int32_t iLiteralLen = wsLiteral.GetLength();
- cc -= iLiteralLen - 1;
- if (cc < 0 || FXSYS_wcsncmp(str + cc, wsLiteral.c_str(), iLiteralLen)) {
- return false;
- }
- cc--;
- ccf--;
- break;
- }
- case '9':
- if (!FXSYS_isDecimalDigit(str[cc])) {
- return false;
- }
- dbRetValue = dbRetValue + (str[cc] - '0') * coeff;
- coeff *= 10;
- cc--;
- ccf--;
- break;
- case 'z':
- if (FXSYS_isDecimalDigit(str[cc])) {
- dbRetValue = dbRetValue + (str[cc] - '0') * coeff;
- coeff *= 10;
- cc--;
- }
- ccf--;
- break;
- case 'Z':
- if (str[cc] != ' ') {
- if (FXSYS_isDecimalDigit(str[cc])) {
- dbRetValue = dbRetValue + (str[cc] - '0') * coeff;
- coeff *= 10;
- cc--;
- }
- } else {
- cc--;
- }
- ccf--;
- break;
- case 'S':
- if (str[cc] == '+' || str[cc] == ' ') {
- cc--;
- } else {
- cc -= iMinusLen - 1;
- if (cc < 0 || FXSYS_wcsncmp(str + cc, wsMinus.c_str(), iMinusLen)) {
- return false;
- }
- cc--;
- bNeg = true;
- }
- ccf--;
- break;
- case 's':
- if (str[cc] == '+') {
- cc--;
- } else {
- cc -= iMinusLen - 1;
- if (cc < 0 || FXSYS_wcsncmp(str + cc, wsMinus.c_str(), iMinusLen)) {
- return false;
- }
- cc--;
- bNeg = true;
- }
- ccf--;
- break;
- case 'E': {
- if (cc >= dot_index) {
- return false;
- }
- bool bExpSign = false;
- while (cc >= 0) {
- if (str[cc] == 'E' || str[cc] == 'e') {
- break;
- }
- if (FXSYS_isDecimalDigit(str[cc])) {
- iExponent = iExponent + (str[cc] - '0') * 10;
- cc--;
- continue;
- } else if (str[cc] == '+') {
- cc--;
- continue;
- } else if (cc - iMinusLen + 1 > 0 &&
- !FXSYS_wcsncmp(str + (cc - iMinusLen + 1), wsMinus.c_str(),
- iMinusLen)) {
- bExpSign = true;
- cc -= iMinusLen;
- } else {
- return false;
- }
- }
- cc--;
- iExponent = bExpSign ? -iExponent : iExponent;
- ccf--;
- } break;
- case '$': {
- CFX_WideString wsSymbol;
- pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_CurrencySymbol, wsSymbol);
- int32_t iSymbolLen = wsSymbol.GetLength();
- cc -= iSymbolLen - 1;
- if (cc < 0 || FXSYS_wcsncmp(str + cc, wsSymbol.c_str(), iSymbolLen)) {
- return false;
- }
- cc--;
- ccf--;
- } break;
- case 'r':
- if (ccf - 1 >= 0 && strf[ccf - 1] == 'c') {
- if (str[cc] == 'R' && cc - 1 >= 0 && str[cc - 1] == 'C') {
- bNeg = true;
- cc -= 2;
- }
- ccf -= 2;
- } else {
- ccf--;
- }
- break;
- case 'R':
- if (ccf - 1 >= 0 && strf[ccf - 1] == 'C') {
- if (str[cc] == ' ') {
- cc++;
- } else if (str[cc] == 'R' && cc - 1 >= 0 && str[cc - 1] == 'C') {
- bNeg = true;
- cc -= 2;
- }
- ccf -= 2;
- } else {
- ccf--;
- }
- break;
- case 'b':
- if (ccf - 1 >= 0 && strf[ccf - 1] == 'd') {
- if (str[cc] == 'B' && cc - 1 >= 0 && str[cc - 1] == 'D') {
- bNeg = true;
- cc -= 2;
- }
- ccf -= 2;
- } else {
- ccf--;
- }
- break;
- case 'B':
- if (ccf - 1 >= 0 && strf[ccf - 1] == 'D') {
- if (str[cc] == ' ') {
- cc++;
- } else if (str[cc] == 'B' && cc - 1 >= 0 && str[cc - 1] == 'D') {
- bNeg = true;
- cc -= 2;
- }
- ccf -= 2;
- } else {
- ccf--;
- }
- break;
- case '.':
- case 'V':
- case 'v':
- return false;
- case '%': {
- CFX_WideString wsSymbol;
- pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Percent, wsSymbol);
- int32_t iSysmbolLen = wsSymbol.GetLength();
- cc -= iSysmbolLen - 1;
- if (cc < 0 || FXSYS_wcsncmp(str + cc, wsSymbol.c_str(), iSysmbolLen)) {
- return false;
- }
- cc--;
- ccf--;
- bHavePercentSymbol = true;
- } break;
- case '8':
- return false;
- case ',': {
- if (cc >= 0) {
- cc -= iGroupLen - 1;
- if (cc >= 0 &&
- FXSYS_wcsncmp(str + cc, wsGroupSymbol.c_str(), iGroupLen) == 0) {
- cc--;
- } else {
- cc += iGroupLen - 1;
- }
- }
- ccf--;
- } break;
- case '(':
- if (str[cc] == L'(') {
- bNeg = true;
- } else if (str[cc] != L' ') {
- return false;
- }
- cc--;
- ccf--;
- break;
- case ')':
- if (str[cc] == L')') {
- bNeg = true;
- } else if (str[cc] != L' ') {
- return false;
- }
- cc--;
- ccf--;
- break;
- default:
- if (strf[ccf] != str[cc]) {
- return false;
- }
- cc--;
- ccf--;
- }
- }
- if (cc >= 0) {
- return false;
- }
- if (!bReverseParse) {
- ccf = dot_index_f + 1;
- cc = (dot_index == len) ? len : dot_index + 1;
- coeff = 0.1;
- while (cc < len && ccf < lenf) {
- switch (strf[ccf]) {
- case '\'': {
- CFX_WideString wsLiteral = FX_GetLiteralText(strf, ccf, lenf);
- int32_t iLiteralLen = wsLiteral.GetLength();
- if (cc + iLiteralLen > len ||
- FXSYS_wcsncmp(str + cc, wsLiteral.c_str(), iLiteralLen)) {
- return false;
- }
- cc += iLiteralLen;
- ccf++;
- break;
- }
- case '9':
- if (!FXSYS_isDecimalDigit(str[cc])) {
- return false;
- }
- {
- dbRetValue = dbRetValue + (str[cc] - '0') * coeff;
- coeff *= 0.1;
- }
- cc++;
- ccf++;
- break;
- case 'z':
- if (FXSYS_isDecimalDigit(str[cc])) {
- dbRetValue = dbRetValue + (str[cc] - '0') * coeff;
- coeff *= 0.1;
- cc++;
- }
- ccf++;
- break;
- case 'Z':
- if (str[cc] != ' ') {
- if (FXSYS_isDecimalDigit(str[cc])) {
- dbRetValue = dbRetValue + (str[cc] - '0') * coeff;
- coeff *= 0.1;
- cc++;
- }
- } else {
- cc++;
- }
- ccf++;
- break;
- case 'S':
- if (str[cc] == '+' || str[cc] == ' ') {
- cc++;
- } else {
- if (cc + iMinusLen > len ||
- FXSYS_wcsncmp(str + cc, wsMinus.c_str(), iMinusLen)) {
- return false;
- }
- bNeg = true;
- cc += iMinusLen;
- }
- ccf++;
- break;
- case 's':
- if (str[cc] == '+') {
- cc++;
- } else {
- if (cc + iMinusLen > len ||
- FXSYS_wcsncmp(str + cc, wsMinus.c_str(), iMinusLen)) {
- return false;
- }
- bNeg = true;
- cc += iMinusLen;
- }
- ccf++;
- break;
- case 'E': {
- if (cc >= len || (str[cc] != 'E' && str[cc] != 'e')) {
- return false;
- }
- bool bExpSign = false;
- cc++;
- if (cc < len) {
- if (str[cc] == '+') {
- cc++;
- } else if (str[cc] == '-') {
- bExpSign = true;
- cc++;
- }
- }
- while (cc < len) {
- if (!FXSYS_isDecimalDigit(str[cc])) {
- break;
- }
- iExponent = iExponent * 10 + str[cc] - '0';
- cc++;
- }
- iExponent = bExpSign ? -iExponent : iExponent;
- ccf++;
- } break;
- case '$': {
- CFX_WideString wsSymbol;
- pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_CurrencySymbol,
- wsSymbol);
- int32_t iSymbolLen = wsSymbol.GetLength();
- if (cc + iSymbolLen > len ||
- FXSYS_wcsncmp(str + cc, wsSymbol.c_str(), iSymbolLen)) {
- return false;
- }
- cc += iSymbolLen;
- ccf++;
- } break;
- case 'c':
- if (ccf + 1 < lenf && strf[ccf + 1] == 'r') {
- if (str[cc] == 'C' && cc + 1 < len && str[cc + 1] == 'R') {
- bNeg = true;
- cc += 2;
- }
- ccf += 2;
- }
- break;
- case 'C':
- if (ccf + 1 < lenf && strf[ccf + 1] == 'R') {
- if (str[cc] == ' ') {
- cc++;
- } else if (str[cc] == 'C' && cc + 1 < len && str[cc + 1] == 'R') {
- bNeg = true;
- cc += 2;
- }
- ccf += 2;
- }
- break;
- case 'd':
- if (ccf + 1 < lenf && strf[ccf + 1] == 'b') {
- if (str[cc] == 'D' && cc + 1 < len && str[cc + 1] == 'B') {
- bNeg = true;
- cc += 2;
- }
- ccf += 2;
- }
- break;
- case 'D':
- if (ccf + 1 < lenf && strf[ccf + 1] == 'B') {
- if (str[cc] == ' ') {
- cc++;
- } else if (str[cc] == 'D' && cc + 1 < len && str[cc + 1] == 'B') {
- bNeg = true;
- cc += 2;
- }
- ccf += 2;
- }
- break;
- case '.':
- case 'V':
- case 'v':
- return false;
- case '%': {
- CFX_WideString wsSymbol;
- pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Percent, wsSymbol);
- int32_t iSysmbolLen = wsSymbol.GetLength();
- if (cc + iSysmbolLen <= len &&
- !FXSYS_wcsncmp(str + cc, wsSymbol.c_str(), iSysmbolLen)) {
- cc += iSysmbolLen;
- }
- ccf++;
- bHavePercentSymbol = true;
- } break;
- case '8': {
- while (ccf < lenf && strf[ccf] == '8') {
- ccf++;
- }
- while (cc < len && FXSYS_isDecimalDigit(str[cc])) {
- dbRetValue = (str[cc] - '0') * coeff + dbRetValue;
- coeff *= 0.1;
- cc++;
- }
- } break;
- case ',': {
- if (cc + iGroupLen <= len &&
- FXSYS_wcsncmp(str + cc, wsGroupSymbol.c_str(), iGroupLen) == 0) {
- cc += iGroupLen;
- }
- ccf++;
- } break;
- case '(':
- if (str[cc] == L'(') {
- bNeg = true;
- } else if (str[cc] != L' ') {
- return false;
- }
- cc++;
- ccf++;
- break;
- case ')':
- if (str[cc] == L')') {
- bNeg = true;
- } else if (str[cc] != L' ') {
- return false;
- }
- cc++;
- ccf++;
- break;
- default:
- if (strf[ccf] != str[cc]) {
- return false;
- }
- cc++;
- ccf++;
- }
- }
- if (cc != len) {
- return false;
- }
- }
- if (iExponent) {
- dbRetValue *= FXSYS_pow(10, (FX_FLOAT)iExponent);
- }
- if (bHavePercentSymbol) {
- dbRetValue /= 100.0;
- }
- if (bNeg) {
- dbRetValue = -dbRetValue;
- }
- fValue = (FX_FLOAT)dbRetValue;
- return true;
-}
-
-bool CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum,
- const CFX_WideString& wsPattern,
- CFX_WideString& wsValue) {
- wsValue.clear();
- if (wsSrcNum.IsEmpty() || wsPattern.IsEmpty()) {
- return false;
- }
- int32_t dot_index_f = -1;
- uint32_t dwFormatStyle = 0;
- CFX_WideString wsNumFormat;
- IFX_Locale* pLocale =
- GetNumericFormat(wsPattern, dot_index_f, dwFormatStyle, wsNumFormat);
- if (!pLocale || wsNumFormat.IsEmpty()) {
- return false;
- }
- int32_t iExponent = 0;
- CFX_WideString wsDotSymbol;
- pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Decimal, wsDotSymbol);
- CFX_WideString wsGroupSymbol;
- pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Grouping, wsGroupSymbol);
- int32_t iGroupLen = wsGroupSymbol.GetLength();
- CFX_WideString wsMinus;
- pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Minus, wsMinus);
- int32_t iMinusLen = wsMinus.GetLength();
- int cc = 0, ccf = 0;
- const FX_WCHAR* str = wsSrcNum.c_str();
- int len = wsSrcNum.GetLength();
- const FX_WCHAR* strf = wsNumFormat.c_str();
- int lenf = wsNumFormat.GetLength();
- bool bHavePercentSymbol = false;
- bool bNeg = false;
- bool bReverseParse = false;
- int32_t dot_index = 0;
- if (!FX_GetNumericDotIndex(wsSrcNum, wsDotSymbol, dot_index) &&
- (dwFormatStyle & FX_NUMSTYLE_DotVorv)) {
- bReverseParse = true;
- }
- bReverseParse = false;
- ccf = dot_index_f - 1;
- cc = dot_index - 1;
- while (ccf >= 0 && cc >= 0) {
- switch (strf[ccf]) {
- case '\'': {
- CFX_WideString wsLiteral = FX_GetLiteralTextReverse(strf, ccf);
- int32_t iLiteralLen = wsLiteral.GetLength();
- cc -= iLiteralLen - 1;
- if (cc < 0 || FXSYS_wcsncmp(str + cc, wsLiteral.c_str(), iLiteralLen)) {
- return false;
- }
- cc--;
- ccf--;
- break;
- }
- case '9':
- if (!FXSYS_isDecimalDigit(str[cc])) {
- return false;
- }
- wsValue = str[cc] + wsValue;
- cc--;
- ccf--;
- break;
- case 'z':
- if (FXSYS_isDecimalDigit(str[cc])) {
- wsValue = str[cc] + wsValue;
- cc--;
- }
- ccf--;
- break;
- case 'Z':
- if (str[cc] != ' ') {
- if (FXSYS_isDecimalDigit(str[cc])) {
- wsValue = str[cc] + wsValue;
- cc--;
- }
- } else {
- cc--;
- }
- ccf--;
- break;
- case 'S':
- if (str[cc] == '+' || str[cc] == ' ') {
- cc--;
- } else {
- cc -= iMinusLen - 1;
- if (cc < 0 || FXSYS_wcsncmp(str + cc, wsMinus.c_str(), iMinusLen)) {
- return false;
- }
- cc--;
- bNeg = true;
- }
- ccf--;
- break;
- case 's':
- if (str[cc] == '+') {
- cc--;
- } else {
- cc -= iMinusLen - 1;
- if (cc < 0 || FXSYS_wcsncmp(str + cc, wsMinus.c_str(), iMinusLen)) {
- return false;
- }
- cc--;
- bNeg = true;
- }
- ccf--;
- break;
- case 'E': {
- if (cc >= dot_index) {
- return false;
- }
- bool bExpSign = false;
- while (cc >= 0) {
- if (str[cc] == 'E' || str[cc] == 'e') {
- break;
- }
- if (FXSYS_isDecimalDigit(str[cc])) {
- iExponent = iExponent + (str[cc] - '0') * 10;
- cc--;
- continue;
- } else if (str[cc] == '+') {
- cc--;
- continue;
- } else if (cc - iMinusLen + 1 > 0 &&
- !FXSYS_wcsncmp(str + (cc - iMinusLen + 1), wsMinus.c_str(),
- iMinusLen)) {
- bExpSign = true;
- cc -= iMinusLen;
- } else {
- return false;
- }
- }
- cc--;
- iExponent = bExpSign ? -iExponent : iExponent;
- ccf--;
- } break;
- case '$': {
- CFX_WideString wsSymbol;
- pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_CurrencySymbol, wsSymbol);
- int32_t iSymbolLen = wsSymbol.GetLength();
- cc -= iSymbolLen - 1;
- if (cc < 0 || FXSYS_wcsncmp(str + cc, wsSymbol.c_str(), iSymbolLen)) {
- return false;
- }
- cc--;
- ccf--;
- } break;
- case 'r':
- if (ccf - 1 >= 0 && strf[ccf - 1] == 'c') {
- if (str[cc] == 'R' && cc - 1 >= 0 && str[cc - 1] == 'C') {
- bNeg = true;
- cc -= 2;
- }
- ccf -= 2;
- } else {
- ccf--;
- }
- break;
- case 'R':
- if (ccf - 1 >= 0 && strf[ccf - 1] == 'C') {
- if (str[cc] == ' ') {
- cc++;
- } else if (str[cc] == 'R' && cc - 1 >= 0 && str[cc - 1] == 'C') {
- bNeg = true;
- cc -= 2;
- }
- ccf -= 2;
- } else {
- ccf--;
- }
- break;
- case 'b':
- if (ccf - 1 >= 0 && strf[ccf - 1] == 'd') {
- if (str[cc] == 'B' && cc - 1 >= 0 && str[cc - 1] == 'D') {
- bNeg = true;
- cc -= 2;
- }
- ccf -= 2;
- } else {
- ccf--;
- }
- break;
- case 'B':
- if (ccf - 1 >= 0 && strf[ccf - 1] == 'D') {
- if (str[cc] == ' ') {
- cc++;
- } else if (str[cc] == 'B' && cc - 1 >= 0 && str[cc - 1] == 'D') {
- bNeg = true;
- cc -= 2;
- }
- ccf -= 2;
- } else {
- ccf--;
- }
- break;
- case '.':
- case 'V':
- case 'v':
- return false;
- case '%': {
- CFX_WideString wsSymbol;
- pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Percent, wsSymbol);
- int32_t iSysmbolLen = wsSymbol.GetLength();
- cc -= iSysmbolLen - 1;
- if (cc < 0 || FXSYS_wcsncmp(str + cc, wsSymbol.c_str(), iSysmbolLen)) {
- return false;
- }
- cc--;
- ccf--;
- bHavePercentSymbol = true;
- } break;
- case '8':
- return false;
- case ',': {
- if (cc >= 0) {
- cc -= iGroupLen - 1;
- if (cc >= 0 &&
- FXSYS_wcsncmp(str + cc, wsGroupSymbol.c_str(), iGroupLen) == 0) {
- cc--;
- } else {
- cc += iGroupLen - 1;
- }
- }
- ccf--;
- } break;
- case '(':
- if (str[cc] == L'(') {
- bNeg = true;
- } else if (str[cc] != L' ') {
- return false;
- }
- cc--;
- ccf--;
- break;
- case ')':
- if (str[cc] == L')') {
- bNeg = true;
- } else if (str[cc] != L' ') {
- return false;
- }
- cc--;
- ccf--;
- break;
- default:
- if (strf[ccf] != str[cc]) {
- return false;
- }
- cc--;
- ccf--;
- }
- }
- if (cc >= 0) {
- if (str[cc] == '-') {
- bNeg = true;
- cc--;
- }
- if (cc >= 0) {
- return false;
- }
- }
- if (dot_index < len && (dwFormatStyle & FX_NUMSTYLE_DotVorv)) {
- wsValue += '.';
- }
- if (!bReverseParse) {
- ccf = dot_index_f + 1;
- cc = (dot_index == len) ? len : dot_index + 1;
- while (cc < len && ccf < lenf) {
- switch (strf[ccf]) {
- case '\'': {
- CFX_WideString wsLiteral = FX_GetLiteralText(strf, ccf, lenf);
- int32_t iLiteralLen = wsLiteral.GetLength();
- if (cc + iLiteralLen > len ||
- FXSYS_wcsncmp(str + cc, wsLiteral.c_str(), iLiteralLen)) {
- return false;
- }
- cc += iLiteralLen;
- ccf++;
- break;
- }
- case '9':
- if (!FXSYS_isDecimalDigit(str[cc])) {
- return false;
- }
- { wsValue += str[cc]; }
- cc++;
- ccf++;
- break;
- case 'z':
- if (FXSYS_isDecimalDigit(str[cc])) {
- wsValue += str[cc];
- cc++;
- }
- ccf++;
- break;
- case 'Z':
- if (str[cc] != ' ') {
- if (FXSYS_isDecimalDigit(str[cc])) {
- wsValue += str[cc];
- cc++;
- }
- } else {
- cc++;
- }
- ccf++;
- break;
- case 'S':
- if (str[cc] == '+' || str[cc] == ' ') {
- cc++;
- } else {
- if (cc + iMinusLen > len ||
- FXSYS_wcsncmp(str + cc, wsMinus.c_str(), iMinusLen)) {
- return false;
- }
- bNeg = true;
- cc += iMinusLen;
- }
- ccf++;
- break;
- case 's':
- if (str[cc] == '+') {
- cc++;
- } else {
- if (cc + iMinusLen > len ||
- FXSYS_wcsncmp(str + cc, wsMinus.c_str(), iMinusLen)) {
- return false;
- }
- bNeg = true;
- cc += iMinusLen;
- }
- ccf++;
- break;
- case 'E': {
- if (cc >= len || (str[cc] != 'E' && str[cc] != 'e')) {
- return false;
- }
- bool bExpSign = false;
- cc++;
- if (cc < len) {
- if (str[cc] == '+') {
- cc++;
- } else if (str[cc] == '-') {
- bExpSign = true;
- cc++;
- }
- }
- while (cc < len) {
- if (!FXSYS_isDecimalDigit(str[cc])) {
- break;
- }
- iExponent = iExponent * 10 + str[cc] - '0';
- cc++;
- }
- iExponent = bExpSign ? -iExponent : iExponent;
- ccf++;
- } break;
- case '$': {
- CFX_WideString wsSymbol;
- pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_CurrencySymbol,
- wsSymbol);
- int32_t iSymbolLen = wsSymbol.GetLength();
- if (cc + iSymbolLen > len ||
- FXSYS_wcsncmp(str + cc, wsSymbol.c_str(), iSymbolLen)) {
- return false;
- }
- cc += iSymbolLen;
- ccf++;
- } break;
- case 'c':
- if (ccf + 1 < lenf && strf[ccf + 1] == 'r') {
- if (str[cc] == 'C' && cc + 1 < len && str[cc + 1] == 'R') {
- bNeg = true;
- cc += 2;
- }
- ccf += 2;
- }
- break;
- case 'C':
- if (ccf + 1 < lenf && strf[ccf + 1] == 'R') {
- if (str[cc] == ' ') {
- cc++;
- } else if (str[cc] == 'C' && cc + 1 < len && str[cc + 1] == 'R') {
- bNeg = true;
- cc += 2;
- }
- ccf += 2;
- }
- break;
- case 'd':
- if (ccf + 1 < lenf && strf[ccf + 1] == 'b') {
- if (str[cc] == 'D' && cc + 1 < len && str[cc + 1] == 'B') {
- bNeg = true;
- cc += 2;
- }
- ccf += 2;
- }
- break;
- case 'D':
- if (ccf + 1 < lenf && strf[ccf + 1] == 'B') {
- if (str[cc] == ' ') {
- cc++;
- } else if (str[cc] == 'D' && cc + 1 < len && str[cc + 1] == 'B') {
- bNeg = true;
- cc += 2;
- }
- ccf += 2;
- }
- break;
- case '.':
- case 'V':
- case 'v':
- return false;
- case '%': {
- CFX_WideString wsSymbol;
- pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Percent, wsSymbol);
- int32_t iSysmbolLen = wsSymbol.GetLength();
- if (cc + iSysmbolLen <= len &&
- !FXSYS_wcsncmp(str + cc, wsSymbol.c_str(), iSysmbolLen)) {
- cc += iSysmbolLen;
- }
- ccf++;
- bHavePercentSymbol = true;
- } break;
- case '8': {
- while (ccf < lenf && strf[ccf] == '8') {
- ccf++;
- }
- while (cc < len && FXSYS_isDecimalDigit(str[cc])) {
- wsValue += str[cc];
- cc++;
- }
- } break;
- case ',': {
- if (cc + iGroupLen <= len &&
- FXSYS_wcsncmp(str + cc, wsGroupSymbol.c_str(), iGroupLen) == 0) {
- cc += iGroupLen;
- }
- ccf++;
- } break;
- case '(':
- if (str[cc] == L'(') {
- bNeg = true;
- } else if (str[cc] != L' ') {
- return false;
- }
- cc++;
- ccf++;
- break;
- case ')':
- if (str[cc] == L')') {
- bNeg = true;
- } else if (str[cc] != L' ') {
- return false;
- }
- cc++;
- ccf++;
- break;
- default:
- if (strf[ccf] != str[cc]) {
- return false;
- }
- cc++;
- ccf++;
- }
- }
- if (cc != len) {
- return false;
- }
- }
- if (iExponent || bHavePercentSymbol) {
- CFX_Decimal decimal = CFX_Decimal(wsValue.AsStringC());
- if (iExponent) {
- decimal = decimal * CFX_Decimal(FXSYS_pow(10, (FX_FLOAT)iExponent));
- }
- if (bHavePercentSymbol) {
- decimal = decimal / CFX_Decimal(100);
- }
- wsValue = decimal;
- }
- if (bNeg) {
- wsValue = L'-' + wsValue;
- }
- return true;
-}
-FX_DATETIMETYPE CFX_FormatString::GetDateTimeFormat(
- const CFX_WideString& wsPattern,
- IFX_Locale*& pLocale,
- CFX_WideString& wsDatePattern,
- CFX_WideString& wsTimePattern) {
- pLocale = nullptr;
- CFX_WideString wsTempPattern;
- FX_LOCALECATEGORY eCategory = FX_LOCALECATEGORY_Unknown;
- int32_t ccf = 0;
- int32_t iLenf = wsPattern.GetLength();
- const FX_WCHAR* pStr = wsPattern.c_str();
- int32_t iFindCategory = 0;
- bool bBraceOpen = false;
- CFX_WideStringC wsConstChars(gs_wsConstChars);
- while (ccf < iLenf) {
- if (pStr[ccf] == '\'') {
- int32_t iCurChar = ccf;
- FX_GetLiteralText(pStr, ccf, iLenf);
- wsTempPattern += CFX_WideStringC(pStr + iCurChar, ccf - iCurChar + 1);
- } else if (!bBraceOpen && iFindCategory != 3 &&
- wsConstChars.Find(pStr[ccf]) == -1) {
- CFX_WideString wsCategory(pStr[ccf]);
- ccf++;
- while (ccf < iLenf && pStr[ccf] != '{' && pStr[ccf] != '.' &&
- pStr[ccf] != '(') {
- if (pStr[ccf] == 'T') {
- wsDatePattern = wsPattern.Left(ccf);
- wsTimePattern = wsPattern.Right(wsPattern.GetLength() - ccf);
- wsTimePattern.SetAt(0, ' ');
- if (!pLocale) {
- pLocale = m_pLocaleMgr->GetDefLocale();
- }
- return FX_DATETIMETYPE_DateTime;
- }
- wsCategory += pStr[ccf];
- ccf++;
- }
- if (!(iFindCategory & 1) && wsCategory == L"date") {
- iFindCategory |= 1;
- eCategory = FX_LOCALECATEGORY_Date;
- if (iFindCategory & 2) {
- iFindCategory = 4;
- }
- } else if (!(iFindCategory & 2) && wsCategory == L"time") {
- iFindCategory |= 2;
- eCategory = FX_LOCALECATEGORY_Time;
- } else if (wsCategory == L"datetime") {
- iFindCategory = 3;
- eCategory = FX_LOCALECATEGORY_DateTime;
- } else {
- continue;
- }
- while (ccf < iLenf) {
- if (pStr[ccf] == '(') {
- ccf++;
- CFX_WideString wsLCID;
- while (ccf < iLenf && pStr[ccf] != ')') {
- wsLCID += pStr[ccf++];
- }
- pLocale = GetPatternLocale(wsLCID);
- } else if (pStr[ccf] == '{') {
- bBraceOpen = true;
- break;
- } else if (pStr[ccf] == '.') {
- CFX_WideString wsSubCategory;
- ccf++;
- while (ccf < iLenf && pStr[ccf] != '(' && pStr[ccf] != '{') {
- wsSubCategory += pStr[ccf++];
- }
- uint32_t dwSubHash =
- FX_HashCode_GetW(wsSubCategory.AsStringC(), false);
- FX_LOCALEDATETIMESUBCATEGORY eSubCategory =
- FX_LOCALEDATETIMESUBCATEGORY_Medium;
- for (int32_t i = 0; i < g_iFXLocaleDateTimeSubCatCount; i++) {
- if (g_FXLocaleDateTimeSubCatData[i].uHash == dwSubHash) {
- eSubCategory =
- (FX_LOCALEDATETIMESUBCATEGORY)g_FXLocaleDateTimeSubCatData[i]
- .eSubCategory;
- break;
- }
- }
- if (!pLocale) {
- pLocale = m_pLocaleMgr->GetDefLocale();
- }
- ASSERT(pLocale);
- switch (eCategory) {
- case FX_LOCALECATEGORY_Date:
- pLocale->GetDatePattern(eSubCategory, wsDatePattern);
- wsDatePattern = wsTempPattern + wsDatePattern;
- break;
- case FX_LOCALECATEGORY_Time:
- pLocale->GetTimePattern(eSubCategory, wsTimePattern);
- wsTimePattern = wsTempPattern + wsTimePattern;
- break;
- case FX_LOCALECATEGORY_DateTime:
- pLocale->GetDatePattern(eSubCategory, wsDatePattern);
- wsDatePattern = wsTempPattern + wsDatePattern;
- pLocale->GetTimePattern(eSubCategory, wsTimePattern);
- break;
- default:
- break;
- }
- wsTempPattern.clear();
- continue;
- }
- ccf++;
- }
- } else if (pStr[ccf] == '}') {
- bBraceOpen = false;
- if (!wsTempPattern.IsEmpty()) {
- if (eCategory == FX_LOCALECATEGORY_Time) {
- wsTimePattern = wsTempPattern;
- } else if (eCategory == FX_LOCALECATEGORY_Date) {
- wsDatePattern = wsTempPattern;
- }
- wsTempPattern.clear();
- }
- } else {
- wsTempPattern += pStr[ccf];
- }
- ccf++;
- }
- if (!wsTempPattern.IsEmpty()) {
- if (eCategory == FX_LOCALECATEGORY_Date) {
- wsDatePattern += wsTempPattern;
- } else {
- wsTimePattern += wsTempPattern;
- }
- }
- if (!pLocale) {
- pLocale = m_pLocaleMgr->GetDefLocale();
- }
- if (!iFindCategory) {
- wsTimePattern.clear();
- wsDatePattern = wsPattern;
- }
- return (FX_DATETIMETYPE)iFindCategory;
-}
-static bool FX_ParseLocaleDate(const CFX_WideString& wsDate,
- const CFX_WideString& wsDatePattern,
- IFX_Locale* pLocale,
- CFX_Unitime& datetime,
- int32_t& cc) {
- int32_t year = 1900;
- int32_t month = 1;
- int32_t day = 1;
- int32_t ccf = 0;
- const FX_WCHAR* str = wsDate.c_str();
- int32_t len = wsDate.GetLength();
- const FX_WCHAR* strf = wsDatePattern.c_str();
- int32_t lenf = wsDatePattern.GetLength();
- CFX_WideStringC wsDateSymbols(gs_wsDateSymbols);
- while (cc < len && ccf < lenf) {
- if (strf[ccf] == '\'') {
- CFX_WideString wsLiteral = FX_GetLiteralText(strf, ccf, lenf);
- int32_t iLiteralLen = wsLiteral.GetLength();
- if (cc + iLiteralLen > len ||
- FXSYS_wcsncmp(str + cc, wsLiteral.c_str(), iLiteralLen)) {
- return false;
- }
- cc += iLiteralLen;
- ccf++;
- continue;
- } else if (wsDateSymbols.Find(strf[ccf]) == -1) {
- if (strf[ccf] != str[cc])
- return false;
- cc++;
- ccf++;
- continue;
- }
- uint32_t dwSymbolNum = 1;
- FX_WCHAR dwCharSymbol = strf[ccf++];
- while (ccf < lenf && strf[ccf] == dwCharSymbol) {
- ccf++;
- dwSymbolNum++;
- }
- uint32_t dwSymbol = (dwCharSymbol << 8) | (dwSymbolNum + '0');
- if (dwSymbol == FXBSTR_ID(0, 0, 'D', '1')) {
- if (!FXSYS_isDecimalDigit(str[cc])) {
- return false;
- }
- day = str[cc++] - '0';
- if (cc < len && FXSYS_isDecimalDigit(str[cc])) {
- day = day * 10 + str[cc++] - '0';
- }
- } else if (dwSymbol == FXBSTR_ID(0, 0, 'D', '2')) {
- if (!FXSYS_isDecimalDigit(str[cc])) {
- return false;
- }
- day = str[cc++] - '0';
- if (cc < len) {
- day = day * 10 + str[cc++] - '0';
- }
- } else if (dwSymbol == FXBSTR_ID(0, 0, 'J', '1')) {
- int i = 0;
- while (cc < len && i < 3 && FXSYS_isDecimalDigit(str[cc])) {
- cc++;
- i++;
- }
- } else if (dwSymbol == FXBSTR_ID(0, 0, 'J', '3')) {
- cc += 3;
- } else if (dwSymbol == FXBSTR_ID(0, 0, 'M', '1')) {
- if (!FXSYS_isDecimalDigit(str[cc])) {
- return false;
- }
- month = str[cc++] - '0';
- if (cc < len && FXSYS_isDecimalDigit(str[cc])) {
- month = month * 10 + str[cc++] - '0';
- }
- } else if (dwSymbol == FXBSTR_ID(0, 0, 'M', '2')) {
- if (!FXSYS_isDecimalDigit(str[cc])) {
- return false;
- }
- month = str[cc++] - '0';
- if (cc < len) {
- month = month * 10 + str[cc++] - '0';
- }
- } else if (dwSymbol == FXBSTR_ID(0, 0, 'M', '3')) {
- CFX_WideString wsMonthNameAbbr;
- uint16_t i = 0;
- for (; i < 12; i++) {
- pLocale->GetMonthName(i, wsMonthNameAbbr, true);
- if (wsMonthNameAbbr.IsEmpty()) {
- continue;
- }
- if (!FXSYS_wcsncmp(wsMonthNameAbbr.c_str(), str + cc,
- wsMonthNameAbbr.GetLength())) {
- break;
- }
- }
- if (i < 12) {
- cc += wsMonthNameAbbr.GetLength();
- month = i + 1;
- }
- } else if (dwSymbol == FXBSTR_ID(0, 0, 'M', '4')) {
- CFX_WideString wsMonthName;
- uint16_t i = 0;
- for (; i < 12; i++) {
- pLocale->GetMonthName(i, wsMonthName, false);
- if (wsMonthName.IsEmpty()) {
- continue;
- }
- if (!FXSYS_wcsncmp(wsMonthName.c_str(), str + cc,
- wsMonthName.GetLength())) {
- break;
- }
- }
- if (i < 12) {
- cc += wsMonthName.GetLength();
- month = i + 1;
- }
- } else if (dwSymbol == FXBSTR_ID(0, 0, 'E', '1')) {
- cc += 1;
- } else if (dwSymbol == FXBSTR_ID(0, 0, 'E', '3')) {
- CFX_WideString wsDayNameAbbr;
- uint16_t i = 0;
- for (; i < 7; i++) {
- pLocale->GetDayName(i, wsDayNameAbbr, true);
- if (wsDayNameAbbr.IsEmpty()) {
- continue;
- }
- if (!FXSYS_wcsncmp(wsDayNameAbbr.c_str(), str + cc,
- wsDayNameAbbr.GetLength())) {
- break;
- }
- }
- if (i < 12) {
- cc += wsDayNameAbbr.GetLength();
- }
- } else if (dwSymbol == FXBSTR_ID(0, 0, 'E', '4')) {
- CFX_WideString wsDayName;
- int32_t i = 0;
- for (; i < 7; i++) {
- pLocale->GetDayName(i, wsDayName, false);
- if (wsDayName == L"") {
- continue;
- }
- if (!FXSYS_wcsncmp(wsDayName.c_str(), str + cc,
- wsDayName.GetLength())) {
- break;
- }
- }
- if (i < 12) {
- cc += wsDayName.GetLength();
- }
- } else if (dwSymbol == FXBSTR_ID(0, 0, 'e', '1')) {
- cc += 1;
- } else if (dwSymbol == FXBSTR_ID(0, 0, 'G', '1')) {
- cc += 2;
- } else if (dwSymbol == FXBSTR_ID(0, 0, 'Y', '2')) {
- if (cc + 2 > len) {
- return false;
- }
- if (!FXSYS_isDecimalDigit(str[cc])) {
- return false;
- }
- year = str[cc++] - '0';
- if (cc >= len || !FXSYS_isDecimalDigit(str[cc])) {
- return false;
- }
- year = year * 10 + str[cc++] - '0';
- if (year <= 29) {
- year += 2000;
- } else {
- year += 1900;
- }
- } else if (dwSymbol == FXBSTR_ID(0, 0, 'Y', '4')) {
- int i = 0;
- year = 0;
- if (cc + 4 > len) {
- return false;
- }
- while (i < 4) {
- if (!FXSYS_isDecimalDigit(str[cc])) {
- return false;
- }
- year = year * 10 + str[cc] - '0';
- cc++;
- i++;
- }
- } else if (dwSymbol == FXBSTR_ID(0, 0, 'w', '1')) {
- cc += 1;
- } else if (dwSymbol == FXBSTR_ID(0, 0, 'W', '2')) {
- cc += 2;
- }
- }
- if (cc < len) {
- return false;
- }
- CFX_Unitime ut;
- ut.Set(year, month, day);
- datetime = datetime + ut;
- return !!cc;
-}
-
-static void FX_ResolveZone(uint8_t& wHour,
- uint8_t& wMinute,
- FX_TIMEZONE tzDiff,
- IFX_Locale* pLocale) {
- int32_t iMinuteDiff = wHour * 60 + wMinute;
- FX_TIMEZONE tzLocale;
- pLocale->GetTimeZone(&tzLocale);
- iMinuteDiff += tzLocale.tzHour * 60 +
- (tzLocale.tzHour < 0 ? -tzLocale.tzMinute : tzLocale.tzMinute);
- iMinuteDiff -= tzDiff.tzHour * 60 +
- (tzDiff.tzHour < 0 ? -tzDiff.tzMinute : tzDiff.tzMinute);
- while (iMinuteDiff > 1440) {
- iMinuteDiff -= 1440;
- }
- while (iMinuteDiff < 0) {
- iMinuteDiff += 1440;
- }
- wHour = iMinuteDiff / 60;
- wMinute = iMinuteDiff % 60;
-}
-static bool FX_ParseLocaleTime(const CFX_WideString& wsTime,
- const CFX_WideString& wsTimePattern,
- IFX_Locale* pLocale,
- CFX_Unitime& datetime,
- int32_t& cc) {
- uint8_t hour = 0;
- uint8_t minute = 0;
- uint8_t second = 0;
- uint16_t millisecond = 0;
- int32_t ccf = 0;
- const FX_WCHAR* str = wsTime.c_str();
- int len = wsTime.GetLength();
- const FX_WCHAR* strf = wsTimePattern.c_str();
- int lenf = wsTimePattern.GetLength();
- bool bHasA = false;
- bool bPM = false;
- CFX_WideStringC wsTimeSymbols(gs_wsTimeSymbols);
- while (cc < len && ccf < lenf) {
- if (strf[ccf] == '\'') {
- CFX_WideString wsLiteral = FX_GetLiteralText(strf, ccf, lenf);
- int32_t iLiteralLen = wsLiteral.GetLength();
- if (cc + iLiteralLen > len ||
- FXSYS_wcsncmp(str + cc, wsLiteral.c_str(), iLiteralLen)) {
- return false;
- }
- cc += iLiteralLen;
- ccf++;
- continue;
- } else if (wsTimeSymbols.Find(strf[ccf]) == -1) {
- if (strf[ccf] != str[cc])
- return false;
- cc++;
- ccf++;
- continue;
- }
- uint32_t dwSymbolNum = 1;
- FX_WCHAR dwCharSymbol = strf[ccf++];
- while (ccf < lenf && strf[ccf] == dwCharSymbol) {
- ccf++;
- dwSymbolNum++;
- }
- uint32_t dwSymbol = (dwCharSymbol << 8) | (dwSymbolNum + '0');
- if (dwSymbol == FXBSTR_ID(0, 0, 'k', '1') ||
- dwSymbol == FXBSTR_ID(0, 0, 'H', '1') ||
- dwSymbol == FXBSTR_ID(0, 0, 'h', '1') ||
- dwSymbol == FXBSTR_ID(0, 0, 'K', '1')) {
- if (!FXSYS_isDecimalDigit(str[cc])) {
- return false;
- }
- hour = str[cc++] - '0';
- if (cc < len && FXSYS_isDecimalDigit(str[cc])) {
- hour = hour * 10 + str[cc++] - '0';
- }
- if (dwSymbol == FXBSTR_ID(0, 0, 'K', '1') && hour == 24) {
- hour = 0;
- }
- } else if (dwSymbol == FXBSTR_ID(0, 0, 'k', '2') ||
- dwSymbol == FXBSTR_ID(0, 0, 'H', '2') ||
- dwSymbol == FXBSTR_ID(0, 0, 'h', '2') ||
- dwSymbol == FXBSTR_ID(0, 0, 'K', '2')) {
- if (!FXSYS_isDecimalDigit(str[cc])) {
- return false;
- }
- hour = str[cc++] - '0';
- if (cc >= len) {
- return false;
- }
- if (!FXSYS_isDecimalDigit(str[cc])) {
- return false;
- }
- hour = hour * 10 + str[cc++] - '0';
- if (dwSymbol == FXBSTR_ID(0, 0, 'K', '2') && hour == 24) {
- hour = 0;
- }
- } else if (dwSymbol == FXBSTR_ID(0, 0, 'M', '1')) {
- if (!FXSYS_isDecimalDigit(str[cc])) {
- return false;
- }
- minute = str[cc++] - '0';
- if (cc < len && FXSYS_isDecimalDigit(str[cc])) {
- minute = minute * 10 + str[cc++] - '0';
- }
- } else if (dwSymbol == FXBSTR_ID(0, 0, 'M', '2')) {
- if (!FXSYS_isDecimalDigit(str[cc])) {
- return false;
- }
- minute = str[cc++] - '0';
- if (cc >= len) {
- return false;
- }
- if (!FXSYS_isDecimalDigit(str[cc])) {
- return false;
- }
- minute = minute * 10 + str[cc++] - '0';
- } else if (dwSymbol == FXBSTR_ID(0, 0, 'S', '1')) {
- if (!FXSYS_isDecimalDigit(str[cc])) {
- return false;
- }
- second = str[cc++] - '0';
- if (cc < len && FXSYS_isDecimalDigit(str[cc])) {
- second = second * 10 + str[cc++] - '0';
- }
- } else if (dwSymbol == FXBSTR_ID(0, 0, 'S', '2')) {
- if (!FXSYS_isDecimalDigit(str[cc])) {
- return false;
- }
- second = str[cc++] - '0';
- if (cc >= len) {
- return false;
- }
- if (!FXSYS_isDecimalDigit(str[cc])) {
- return false;
- }
- second = second * 10 + str[cc++] - '0';
- } else if (dwSymbol == FXBSTR_ID(0, 0, 'F', '3')) {
- if (cc + 3 >= len) {
- return false;
- }
- int i = 0;
- while (i < 3) {
- if (!FXSYS_isDecimalDigit(str[cc])) {
- return false;
- }
- millisecond = millisecond * 10 + str[cc++] - '0';
- i++;
- }
- } else if (dwSymbol == FXBSTR_ID(0, 0, 'A', '1')) {
- CFX_WideString wsAM;
- pLocale->GetMeridiemName(wsAM, true);
- CFX_WideString wsPM;
- pLocale->GetMeridiemName(wsPM, false);
- if ((cc + wsAM.GetLength() <= len) &&
- (CFX_WideStringC(str + cc, wsAM.GetLength()) == wsAM)) {
- cc += wsAM.GetLength();
- bHasA = true;
- } else if ((cc + wsPM.GetLength() <= len) &&
- (CFX_WideStringC(str + cc, wsPM.GetLength()) == wsPM)) {
- cc += wsPM.GetLength();
- bHasA = true;
- bPM = true;
- }
- } else if (dwSymbol == FXBSTR_ID(0, 0, 'Z', '1')) {
- if (cc + 3 > len) {
- continue;
- }
- uint32_t dwHash = str[cc++];
- dwHash = (dwHash << 8) | str[cc++];
- dwHash = (dwHash << 8) | str[cc++];
- if (dwHash == FXBSTR_ID(0, 'G', 'M', 'T')) {
- FX_TIMEZONE tzDiff;
- tzDiff.tzHour = 0;
- tzDiff.tzMinute = 0;
- if (cc < len && (str[cc] == '-' || str[cc] == '+')) {
- cc += FX_ParseTimeZone(str + cc, len - cc, tzDiff);
- }
- FX_ResolveZone(hour, minute, tzDiff, pLocale);
- } else {
- const FX_LOCALETIMEZONEINFO* pEnd =
- g_FXLocaleTimeZoneData + FX_ArraySize(g_FXLocaleTimeZoneData);
- const FX_LOCALETIMEZONEINFO* pTimeZoneInfo =
- std::lower_bound(g_FXLocaleTimeZoneData, pEnd, dwHash,
- [](const FX_LOCALETIMEZONEINFO& info,
- uint32_t hash) { return info.uHash < hash; });
- if (pTimeZoneInfo < pEnd && dwHash == pTimeZoneInfo->uHash) {
- hour += pTimeZoneInfo->iHour;
- minute += pTimeZoneInfo->iHour > 0 ? pTimeZoneInfo->iMinute
- : -pTimeZoneInfo->iMinute;
- }
- }
- } else if (dwSymbol == FXBSTR_ID(0, 0, 'z', '1')) {
- if (str[cc] != 'Z') {
- FX_TIMEZONE tzDiff;
- cc += FX_ParseTimeZone(str + cc, len - cc, tzDiff);
- FX_ResolveZone(hour, minute, tzDiff, pLocale);
- } else {
- cc++;
- }
- }
- }
- if (bHasA) {
- if (bPM) {
- hour += 12;
- if (hour == 24) {
- hour = 12;
- }
- } else {
- if (hour == 12) {
- hour = 0;
- }
- }
- }
- CFX_Unitime ut;
- ut.Set(0, 0, 0, hour, minute, second, millisecond);
- datetime = datetime + ut;
- return !!cc;
-}
-
-bool CFX_FormatString::ParseDateTime(const CFX_WideString& wsSrcDateTime,
- const CFX_WideString& wsPattern,
- FX_DATETIMETYPE eDateTimeType,
- CFX_Unitime& dtValue) {
- dtValue.Set(0);
- if (wsSrcDateTime.IsEmpty() || wsPattern.IsEmpty()) {
- return false;
- }
- CFX_WideString wsDatePattern, wsTimePattern;
- IFX_Locale* pLocale = nullptr;
- FX_DATETIMETYPE eCategory =
- GetDateTimeFormat(wsPattern, pLocale, wsDatePattern, wsTimePattern);
- if (!pLocale) {
- return false;
- }
- if (eCategory == FX_DATETIMETYPE_Unknown) {
- eCategory = eDateTimeType;
- }
- if (eCategory == FX_DATETIMETYPE_Unknown) {
- return false;
- }
- if (eCategory == FX_DATETIMETYPE_TimeDate) {
- int32_t iStart = 0;
- if (!FX_ParseLocaleTime(wsSrcDateTime, wsTimePattern, pLocale, dtValue,
- iStart)) {
- return false;
- }
- if (!FX_ParseLocaleDate(wsSrcDateTime, wsDatePattern, pLocale, dtValue,
- iStart)) {
- return false;
- }
- } else {
- int32_t iStart = 0;
- if ((eCategory & FX_DATETIMETYPE_Date) &&
- !FX_ParseLocaleDate(wsSrcDateTime, wsDatePattern, pLocale, dtValue,
- iStart)) {
- return false;
- }
- if ((eCategory & FX_DATETIMETYPE_Time) &&
- !FX_ParseLocaleTime(wsSrcDateTime, wsTimePattern, pLocale, dtValue,
- iStart)) {
- return false;
- }
- }
- return true;
-}
-bool CFX_FormatString::ParseZero(const CFX_WideString& wsSrcText,
- const CFX_WideString& wsPattern) {
- CFX_WideString wsTextFormat;
- GetTextFormat(wsPattern, L"zero", wsTextFormat);
- int32_t iText = 0, iPattern = 0;
- const FX_WCHAR* pStrText = wsSrcText.c_str();
- int32_t iLenText = wsSrcText.GetLength();
- const FX_WCHAR* pStrPattern = wsTextFormat.c_str();
- int32_t iLenPattern = wsTextFormat.GetLength();
- while (iPattern < iLenPattern && iText < iLenText) {
- if (pStrPattern[iPattern] == '\'') {
- CFX_WideString wsLiteral =
- FX_GetLiteralText(pStrPattern, iPattern, iLenPattern);
- int32_t iLiteralLen = wsLiteral.GetLength();
- if (iText + iLiteralLen > iLenText ||
- FXSYS_wcsncmp(pStrText + iText, wsLiteral.c_str(), iLiteralLen)) {
- return false;
- }
- iText += iLiteralLen;
- iPattern++;
- continue;
- } else if (pStrPattern[iPattern] != pStrText[iText]) {
- return false;
- } else {
- iText++;
- iPattern++;
- }
- }
- return iPattern == iLenPattern && iText == iLenText;
-}
-bool CFX_FormatString::ParseNull(const CFX_WideString& wsSrcText,
- const CFX_WideString& wsPattern) {
- CFX_WideString wsTextFormat;
- GetTextFormat(wsPattern, L"null", wsTextFormat);
- int32_t iText = 0, iPattern = 0;
- const FX_WCHAR* pStrText = wsSrcText.c_str();
- int32_t iLenText = wsSrcText.GetLength();
- const FX_WCHAR* pStrPattern = wsTextFormat.c_str();
- int32_t iLenPattern = wsTextFormat.GetLength();
- while (iPattern < iLenPattern && iText < iLenText) {
- if (pStrPattern[iPattern] == '\'') {
- CFX_WideString wsLiteral =
- FX_GetLiteralText(pStrPattern, iPattern, iLenPattern);
- int32_t iLiteralLen = wsLiteral.GetLength();
- if (iText + iLiteralLen > iLenText ||
- FXSYS_wcsncmp(pStrText + iText, wsLiteral.c_str(), iLiteralLen)) {
- return false;
- }
- iText += iLiteralLen;
- iPattern++;
- continue;
- } else if (pStrPattern[iPattern] != pStrText[iText]) {
- return false;
- } else {
- iText++;
- iPattern++;
- }
- }
- return iPattern == iLenPattern && iText == iLenText;
-}
-bool CFX_FormatString::FormatText(const CFX_WideString& wsSrcText,
- const CFX_WideString& wsPattern,
- CFX_WideString& wsOutput) {
- if (wsPattern.IsEmpty()) {
- return false;
- }
- int32_t iLenText = wsSrcText.GetLength();
- if (iLenText == 0) {
- return false;
- }
- CFX_WideString wsTextFormat;
- GetTextFormat(wsPattern, L"text", wsTextFormat);
- int32_t iText = 0, iPattern = 0;
- const FX_WCHAR* pStrText = wsSrcText.c_str();
- const FX_WCHAR* pStrPattern = wsTextFormat.c_str();
- int32_t iLenPattern = wsTextFormat.GetLength();
- while (iPattern < iLenPattern) {
- switch (pStrPattern[iPattern]) {
- case '\'': {
- wsOutput += FX_GetLiteralText(pStrPattern, iPattern, iLenPattern);
- iPattern++;
- break;
- }
- case 'A':
- if (iText >= iLenText || !FXSYS_iswalpha(pStrText[iText])) {
- return false;
- }
- wsOutput += pStrText[iText++];
- iPattern++;
- break;
- case 'X':
- if (iText >= iLenText) {
- return false;
- }
- wsOutput += pStrText[iText++];
- iPattern++;
- break;
- case 'O':
- case '0':
- if (iText >= iLenText || (!FXSYS_isDecimalDigit(pStrText[iText]) &&
- !FXSYS_iswalpha(pStrText[iText]))) {
- return false;
- }
- wsOutput += pStrText[iText++];
- iPattern++;
- break;
- case '9':
- if (iText >= iLenText || !FXSYS_isDecimalDigit(pStrText[iText])) {
- return false;
- }
- wsOutput += pStrText[iText++];
- iPattern++;
- break;
- default:
- wsOutput += pStrPattern[iPattern++];
- break;
- }
- }
- return iText == iLenText;
-}
-static int32_t FX_GetNumTrailingLimit(const CFX_WideString& wsFormat,
- int iDotPos,
- bool& bTrimTailZeros) {
- if (iDotPos < 0) {
- return 0;
- }
- int32_t iCount = wsFormat.GetLength();
- int32_t iTreading = 0;
- for (iDotPos++; iDotPos < iCount; iDotPos++) {
- FX_WCHAR wc = wsFormat[iDotPos];
- if (wc == L'z' || wc == L'9' || wc == 'Z') {
- iTreading++;
- bTrimTailZeros = (wc == L'9' ? false : true);
- }
- }
- return iTreading;
-}
-bool CFX_FormatString::FormatStrNum(const CFX_WideStringC& wsInputNum,
- const CFX_WideString& wsPattern,
- CFX_WideString& wsOutput) {
- if (wsInputNum.IsEmpty() || wsPattern.IsEmpty()) {
- return false;
- }
- int32_t dot_index_f = -1;
- uint32_t dwNumStyle = 0;
- CFX_WideString wsNumFormat;
- IFX_Locale* pLocale =
- GetNumericFormat(wsPattern, dot_index_f, dwNumStyle, wsNumFormat);
- if (!pLocale || wsNumFormat.IsEmpty()) {
- return false;
- }
- int32_t cc = 0, ccf = 0;
- const FX_WCHAR* strf = wsNumFormat.c_str();
- int lenf = wsNumFormat.GetLength();
- CFX_WideString wsSrcNum(wsInputNum);
- wsSrcNum.TrimLeft('0');
- if (wsSrcNum.IsEmpty() || wsSrcNum[0] == '.') {
- wsSrcNum.Insert(0, '0');
- }
- CFX_Decimal decimal = CFX_Decimal(wsSrcNum.AsStringC());
- if (dwNumStyle & FX_NUMSTYLE_Percent) {
- decimal = decimal * CFX_Decimal(100);
- wsSrcNum = decimal;
- }
- int32_t exponent = 0;
- if (dwNumStyle & FX_NUMSTYLE_Exponent) {
- int fixed_count = 0;
- while (ccf < dot_index_f) {
- switch (strf[ccf]) {
- case '\'':
- FX_GetLiteralText(strf, ccf, dot_index_f);
- break;
- case '9':
- case 'z':
- case 'Z':
- fixed_count++;
- break;
- }
- ccf++;
- }
- int threshold = 1;
- while (fixed_count > 1) {
- threshold *= 10;
- fixed_count--;
- }
- if (decimal != CFX_Decimal(0)) {
- if (decimal < CFX_Decimal(threshold)) {
- decimal = decimal * CFX_Decimal(10);
- exponent = -1;
- while (decimal < CFX_Decimal(threshold)) {
- decimal = decimal * CFX_Decimal(10);
- exponent -= 1;
- }
- } else if (decimal > CFX_Decimal(threshold)) {
- threshold *= 10;
- while (decimal > CFX_Decimal(threshold)) {
- decimal = decimal / CFX_Decimal(10);
- exponent += 1;
- }
- }
- }
- }
- bool bTrimTailZeros = false;
- int32_t iTreading =
- FX_GetNumTrailingLimit(wsNumFormat, dot_index_f, bTrimTailZeros);
- int32_t scale = decimal.GetScale();
- if (iTreading < scale) {
- decimal.SetScale(iTreading);
- wsSrcNum = decimal;
- }
- if (bTrimTailZeros && scale > 0 && iTreading > 0) {
- wsSrcNum.TrimRight(L"0");
- wsSrcNum.TrimRight(L".");
- }
- CFX_WideString wsGroupSymbol;
- pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Grouping, wsGroupSymbol);
- bool bNeg = false;
- if (wsSrcNum[0] == '-') {
- bNeg = true;
- wsSrcNum.Delete(0, 1);
- }
- bool bAddNeg = false;
- const FX_WCHAR* str = wsSrcNum.c_str();
- int len = wsSrcNum.GetLength();
- int dot_index = wsSrcNum.Find('.');
- if (dot_index == -1) {
- dot_index = len;
- }
- ccf = dot_index_f - 1;
- cc = dot_index - 1;
- while (ccf >= 0) {
- switch (strf[ccf]) {
- case '9':
- if (cc >= 0) {
- if (!FXSYS_isDecimalDigit(str[cc])) {
- return false;
- }
- wsOutput = str[cc] + wsOutput;
- cc--;
- } else {
- wsOutput = L'0' + wsOutput;
- }
- ccf--;
- break;
- case 'z':
- if (cc >= 0) {
- if (!FXSYS_isDecimalDigit(str[cc])) {
- return false;
- }
- if (str[0] != '0') {
- wsOutput = str[cc] + wsOutput;
- }
- cc--;
- }
- ccf--;
- break;
- case 'Z':
- if (cc >= 0) {
- if (!FXSYS_isDecimalDigit(str[cc])) {
- return false;
- }
- if (str[0] == '0') {
- wsOutput = L' ' + wsOutput;
- } else {
- wsOutput = str[cc] + wsOutput;
- }
- cc--;
- } else {
- wsOutput = L' ' + wsOutput;
- }
- ccf--;
- break;
- case 'S':
- if (bNeg) {
- CFX_WideString wsMinusSymbol;
- pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Minus, wsMinusSymbol);
- wsOutput = wsMinusSymbol + wsOutput;
- bAddNeg = true;
- } else {
- wsOutput = L' ' + wsOutput;
- }
- ccf--;
- break;
- case 's':
- if (bNeg) {
- CFX_WideString wsMinusSymbol;
- pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Minus, wsMinusSymbol);
- wsOutput = wsMinusSymbol + wsOutput;
- bAddNeg = true;
- }
- ccf--;
- break;
- case 'E': {
- CFX_WideString wsExp;
- wsExp.Format(L"E%+d", exponent);
- wsOutput = wsExp + wsOutput;
- }
- ccf--;
- break;
- case '$': {
- CFX_WideString wsSymbol;
- pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_CurrencySymbol, wsSymbol);
- wsOutput = wsSymbol + wsOutput;
- }
- ccf--;
- break;
- case 'r':
- if (ccf - 1 >= 0 && strf[ccf - 1] == 'c') {
- if (bNeg) {
- wsOutput = L"CR" + wsOutput;
- }
- ccf -= 2;
- bAddNeg = true;
- }
- break;
- case 'R':
- if (ccf - 1 >= 0 && strf[ccf - 1] == 'C') {
- if (bNeg) {
- wsOutput = L"CR" + wsOutput;
- } else {
- wsOutput = L" " + wsOutput;
- }
- ccf -= 2;
- bAddNeg = true;
- }
- break;
- case 'b':
- if (ccf - 1 >= 0 && strf[ccf - 1] == 'd') {
- if (bNeg) {
- wsOutput = L"db" + wsOutput;
- }
- ccf -= 2;
- bAddNeg = true;
- }
- break;
- case 'B':
- if (ccf - 1 >= 0 && strf[ccf - 1] == 'D') {
- if (bNeg) {
- wsOutput = L"DB" + wsOutput;
- } else {
- wsOutput = L" " + wsOutput;
- }
- ccf -= 2;
- bAddNeg = true;
- }
- break;
- case '%': {
- CFX_WideString wsSymbol;
- pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Percent, wsSymbol);
- wsOutput = wsSymbol + wsOutput;
- }
- ccf--;
- break;
- case ',':
- if (cc >= 0) {
- wsOutput = wsGroupSymbol + wsOutput;
- }
- ccf--;
- break;
- case '(':
- if (bNeg) {
- wsOutput = L"(" + wsOutput;
- } else {
- wsOutput = L" " + wsOutput;
- }
- bAddNeg = true;
- ccf--;
- break;
- case ')':
- if (bNeg) {
- wsOutput = L")" + wsOutput;
- } else {
- wsOutput = L" " + wsOutput;
- }
- ccf--;
- break;
- case '\'':
- wsOutput = FX_GetLiteralTextReverse(strf, ccf) + wsOutput;
- ccf--;
- break;
- default:
- wsOutput = strf[ccf] + wsOutput;
- ccf--;
- }
- }
- if (cc >= 0) {
- int nPos = dot_index % 3;
- wsOutput.clear();
- for (int32_t i = 0; i < dot_index; i++) {
- if (i % 3 == nPos && i != 0) {
- wsOutput += wsGroupSymbol;
- }
- wsOutput += wsSrcNum[i];
- }
- if (dot_index < len) {
- CFX_WideString wsSymbol;
- pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Decimal, wsSymbol);
- wsOutput += wsSymbol;
- wsOutput += wsSrcNum.Right(len - dot_index - 1);
- }
- if (bNeg) {
- CFX_WideString wsMinusymbol;
- pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Minus, wsMinusymbol);
- wsOutput = wsMinusymbol + wsOutput;
- }
- return false;
- }
- if (dot_index_f == wsNumFormat.GetLength()) {
- if (!bAddNeg && bNeg) {
- CFX_WideString wsMinusymbol;
- pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Minus, wsMinusymbol);
- wsOutput = wsMinusymbol + wsOutput;
- }
- return true;
- }
- CFX_WideString wsDotSymbol;
- pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Decimal, wsDotSymbol);
- if (strf[dot_index_f] == 'V') {
- wsOutput += wsDotSymbol;
- } else if (strf[dot_index_f] == '.') {
- if (dot_index < len) {
- wsOutput += wsDotSymbol;
- } else {
- if (strf[dot_index_f + 1] == '9' || strf[dot_index_f + 1] == 'Z') {
- wsOutput += wsDotSymbol;
- }
- }
- }
- ccf = dot_index_f + 1;
- cc = dot_index + 1;
- while (ccf < lenf) {
- switch (strf[ccf]) {
- case '\'':
- wsOutput += FX_GetLiteralText(strf, ccf, lenf);
- ccf++;
- break;
- case '9':
- if (cc < len) {
- if (!FXSYS_isDecimalDigit(str[cc])) {
- return false;
- }
- wsOutput += str[cc];
- cc++;
- } else {
- wsOutput += L'0';
- }
- ccf++;
- break;
- case 'z':
- if (cc < len) {
- if (!FXSYS_isDecimalDigit(str[cc])) {
- return false;
- }
- wsOutput += str[cc];
- cc++;
- }
- ccf++;
- break;
- case 'Z':
- if (cc < len) {
- if (!FXSYS_isDecimalDigit(str[cc])) {
- return false;
- }
- wsOutput += str[cc];
- cc++;
- } else {
- wsOutput += L'0';
- }
- ccf++;
- break;
- case 'E': {
- CFX_WideString wsExp;
- wsExp.Format(L"E%+d", exponent);
- wsOutput += wsExp;
- }
- ccf++;
- break;
- case '$': {
- CFX_WideString wsSymbol;
- pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_CurrencySymbol, wsSymbol);
- wsOutput += wsSymbol;
- }
- ccf++;
- break;
- case 'c':
- if (ccf + 1 < lenf && strf[ccf + 1] == 'r') {
- if (bNeg) {
- wsOutput += L"CR";
- }
- ccf += 2;
- bAddNeg = true;
- }
- break;
- case 'C':
- if (ccf + 1 < lenf && strf[ccf + 1] == 'R') {
- if (bNeg) {
- wsOutput += L"CR";
- } else {
- wsOutput += L" ";
- }
- ccf += 2;
- bAddNeg = true;
- }
- break;
- case 'd':
- if (ccf + 1 < lenf && strf[ccf + 1] == 'b') {
- if (bNeg) {
- wsOutput += L"db";
- }
- ccf += 2;
- bAddNeg = true;
- }
- break;
- case 'D':
- if (ccf + 1 < lenf && strf[ccf + 1] == 'B') {
- if (bNeg) {
- wsOutput += L"DB";
- } else {
- wsOutput += L" ";
- }
- ccf += 2;
- bAddNeg = true;
- }
- break;
- case '%': {
- CFX_WideString wsSymbol;
- pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Percent, wsSymbol);
- wsOutput += wsSymbol;
- }
- ccf++;
- break;
- case '8': {
- while (ccf < lenf && strf[ccf] == '8') {
- ccf++;
- }
- while (cc < len && FXSYS_isDecimalDigit(str[cc])) {
- wsOutput += str[cc];
- cc++;
- }
- } break;
- case ',':
- wsOutput += wsGroupSymbol;
- ccf++;
- break;
- case '(':
- if (bNeg) {
- wsOutput += '(';
- } else {
- wsOutput += ' ';
- }
- bAddNeg = true;
- ccf++;
- break;
- case ')':
- if (bNeg) {
- wsOutput += ')';
- } else {
- wsOutput += ' ';
- }
- ccf++;
- break;
- default:
- ccf++;
- }
- }
- if (!bAddNeg && bNeg) {
- CFX_WideString wsMinusymbol;
- pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Minus, wsMinusymbol);
- wsOutput =
- wsMinusymbol + wsOutput[0] + wsOutput.Mid(1, wsOutput.GetLength() - 1);
- }
- return true;
-}
-bool CFX_FormatString::FormatLCNumeric(CFX_LCNumeric& lcNum,
- const CFX_WideString& wsPattern,
- CFX_WideString& wsOutput) {
- int32_t dot_index_f = -1;
- uint32_t dwNumStyle = 0;
- CFX_WideString wsNumFormat;
- IFX_Locale* pLocale =
- GetNumericFormat(wsPattern, dot_index_f, dwNumStyle, wsNumFormat);
- if (!pLocale || wsNumFormat.IsEmpty()) {
- return false;
- }
- int32_t cc = 0, ccf = 0;
- const FX_WCHAR* strf = wsNumFormat.c_str();
- int lenf = wsNumFormat.GetLength();
- double dbOrgRaw = lcNum.GetDouble();
- double dbRetValue = dbOrgRaw;
- if (dwNumStyle & FX_NUMSTYLE_Percent) {
- dbRetValue *= 100;
- }
- int32_t exponent = 0;
- if (dwNumStyle & FX_NUMSTYLE_Exponent) {
- int fixed_count = 0;
- while (ccf < dot_index_f) {
- switch (strf[ccf]) {
- case '\'':
- FX_GetLiteralText(strf, ccf, dot_index_f);
- break;
- case '9':
- case 'z':
- case 'Z':
- fixed_count++;
- break;
- }
- ccf++;
- }
- int threshold = 1;
- while (fixed_count > 1) {
- threshold *= 10;
- fixed_count--;
- }
- if (dbRetValue != 0) {
- if (dbRetValue < threshold) {
- dbRetValue *= 10;
- exponent = -1;
- while (dbRetValue < threshold) {
- dbRetValue *= 10;
- exponent -= 1;
- }
- } else if (dbRetValue > threshold) {
- threshold *= 10;
- while (dbRetValue > threshold) {
- dbRetValue /= 10;
- exponent += 1;
- }
- }
- }
- }
- if (dwNumStyle & (FX_NUMSTYLE_Percent | FX_NUMSTYLE_Exponent)) {
- lcNum = CFX_LCNumeric(dbRetValue);
- }
- bool bTrimTailZeros = false;
- int32_t iTreading =
- FX_GetNumTrailingLimit(wsNumFormat, dot_index_f, bTrimTailZeros);
- CFX_WideString wsNumeric = lcNum.ToString(iTreading, bTrimTailZeros);
- if (wsNumeric.IsEmpty()) {
- return false;
- }
- CFX_WideString wsGroupSymbol;
- pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Grouping, wsGroupSymbol);
- bool bNeg = false;
- if (wsNumeric[0] == '-') {
- bNeg = true;
- wsNumeric.Delete(0, 1);
- }
- bool bAddNeg = false;
- const FX_WCHAR* str = wsNumeric.c_str();
- int len = wsNumeric.GetLength();
- int dot_index = wsNumeric.Find('.');
- if (dot_index == -1) {
- dot_index = len;
- }
- ccf = dot_index_f - 1;
- cc = dot_index - 1;
- while (ccf >= 0) {
- switch (strf[ccf]) {
- case '9':
- if (cc >= 0) {
- wsOutput = str[cc] + wsOutput;
- cc--;
- } else {
- wsOutput = L'0' + wsOutput;
- }
- ccf--;
- break;
- case 'z':
- if (cc >= 0) {
- if (lcNum.m_Integral != 0) {
- wsOutput = str[cc] + wsOutput;
- }
- cc--;
- }
- ccf--;
- break;
- case 'Z':
- if (cc >= 0) {
- if (lcNum.m_Integral == 0) {
- wsOutput = L' ' + wsOutput;
- } else {
- wsOutput = str[cc] + wsOutput;
- }
- cc--;
- } else {
- wsOutput = L' ' + wsOutput;
- }
- ccf--;
- break;
- case 'S':
- if (bNeg) {
- CFX_WideString wsMinusSymbol;
- pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Minus, wsMinusSymbol);
- wsOutput = wsMinusSymbol + wsOutput;
- bAddNeg = true;
- } else {
- wsOutput = L' ' + wsOutput;
- }
- ccf--;
- break;
- case 's':
- if (bNeg) {
- CFX_WideString wsMinusSymbol;
- pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Minus, wsMinusSymbol);
- wsOutput = wsMinusSymbol + wsOutput;
- bAddNeg = true;
- }
- ccf--;
- break;
- case 'E': {
- CFX_WideString wsExp;
- wsExp.Format(L"E%+d", exponent);
- wsOutput = wsExp + wsOutput;
- }
- ccf--;
- break;
- case '$': {
- CFX_WideString wsSymbol;
- pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_CurrencySymbol, wsSymbol);
- wsOutput = wsSymbol + wsOutput;
- }
- ccf--;
- break;
- case 'r':
- if (ccf - 1 >= 0 && strf[ccf - 1] == 'c') {
- if (bNeg) {
- wsOutput = L"CR" + wsOutput;
- }
- ccf -= 2;
- bAddNeg = true;
- }
- break;
- case 'R':
- if (ccf - 1 >= 0 && strf[ccf - 1] == 'C') {
- if (bNeg) {
- wsOutput = L"CR" + wsOutput;
- } else {
- wsOutput = L" " + wsOutput;
- }
- ccf -= 2;
- bAddNeg = true;
- }
- break;
- case 'b':
- if (ccf - 1 >= 0 && strf[ccf - 1] == 'd') {
- if (bNeg) {
- wsOutput = L"db" + wsOutput;
- }
- ccf -= 2;
- bAddNeg = true;
- }
- break;
- case 'B':
- if (ccf - 1 >= 0 && strf[ccf - 1] == 'D') {
- if (bNeg) {
- wsOutput = L"DB" + wsOutput;
- } else {
- wsOutput = L" " + wsOutput;
- }
- ccf -= 2;
- bAddNeg = true;
- }
- break;
- case '%': {
- CFX_WideString wsSymbol;
- pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Percent, wsSymbol);
- wsOutput = wsSymbol + wsOutput;
- }
- ccf--;
- break;
- case ',':
- if (cc >= 0) {
- wsOutput = wsGroupSymbol + wsOutput;
- }
- ccf--;
- break;
- case '(':
- if (bNeg) {
- wsOutput = L"(" + wsOutput;
- } else {
- wsOutput = L" " + wsOutput;
- }
- bAddNeg = true;
- ccf--;
- break;
- case ')':
- if (bNeg) {
- wsOutput = L")" + wsOutput;
- } else {
- wsOutput = L" " + wsOutput;
- }
- ccf--;
- break;
- case '\'':
- wsOutput = FX_GetLiteralTextReverse(strf, ccf) + wsOutput;
- ccf--;
- break;
- default:
- wsOutput = strf[ccf] + wsOutput;
- ccf--;
- }
- }
- if (cc >= 0) {
- int nPos = dot_index % 3;
- wsOutput.clear();
- for (int32_t i = 0; i < dot_index; i++) {
- if (i % 3 == nPos && i != 0) {
- wsOutput += wsGroupSymbol;
- }
- wsOutput += wsNumeric[i];
- }
- if (dot_index < len) {
- CFX_WideString wsSymbol;
- pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Decimal, wsSymbol);
- wsOutput += wsSymbol;
- wsOutput += wsNumeric.Right(len - dot_index - 1);
- }
- if (bNeg) {
- CFX_WideString wsMinusymbol;
- pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Minus, wsMinusymbol);
- wsOutput = wsMinusymbol + wsOutput;
- }
- return false;
- }
- if (dot_index_f == wsNumFormat.GetLength()) {
- if (!bAddNeg && bNeg) {
- CFX_WideString wsMinusymbol;
- pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Minus, wsMinusymbol);
- wsOutput = wsMinusymbol + wsOutput;
- }
- return true;
- }
- CFX_WideString wsDotSymbol;
- pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Decimal, wsDotSymbol);
- if (strf[dot_index_f] == 'V') {
- wsOutput += wsDotSymbol;
- } else if (strf[dot_index_f] == '.') {
- if (dot_index < len) {
- wsOutput += wsDotSymbol;
- } else {
- if (strf[dot_index_f + 1] == '9' || strf[dot_index_f + 1] == 'Z') {
- wsOutput += wsDotSymbol;
- }
- }
- }
- ccf = dot_index_f + 1;
- cc = dot_index + 1;
- while (ccf < lenf) {
- switch (strf[ccf]) {
- case '\'':
- wsOutput += FX_GetLiteralText(strf, ccf, lenf);
- ccf++;
- break;
- case '9':
- if (cc < len) {
- wsOutput += str[cc];
- cc++;
- } else {
- wsOutput += L'0';
- }
- ccf++;
- break;
- case 'z':
- if (cc < len) {
- wsOutput += str[cc];
- cc++;
- }
- ccf++;
- break;
- case 'Z':
- if (cc < len) {
- wsOutput += str[cc];
- cc++;
- } else {
- wsOutput += L'0';
- }
- ccf++;
- break;
- case 'E': {
- CFX_WideString wsExp;
- wsExp.Format(L"E%+d", exponent);
- wsOutput += wsExp;
- }
- ccf++;
- break;
- case '$': {
- CFX_WideString wsSymbol;
- pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_CurrencySymbol, wsSymbol);
- wsOutput += wsSymbol;
- }
- ccf++;
- break;
- case 'c':
- if (ccf + 1 < lenf && strf[ccf + 1] == 'r') {
- if (bNeg) {
- wsOutput += L"CR";
- }
- ccf += 2;
- bAddNeg = true;
- }
- break;
- case 'C':
- if (ccf + 1 < lenf && strf[ccf + 1] == 'R') {
- if (bNeg) {
- wsOutput += L"CR";
- } else {
- wsOutput += L" ";
- }
- ccf += 2;
- bAddNeg = true;
- }
- break;
- case 'd':
- if (ccf + 1 < lenf && strf[ccf + 1] == 'b') {
- if (bNeg) {
- wsOutput += L"db";
- }
- ccf += 2;
- bAddNeg = true;
- }
- break;
- case 'D':
- if (ccf + 1 < lenf && strf[ccf + 1] == 'B') {
- if (bNeg) {
- wsOutput += L"DB";
- } else {
- wsOutput += L" ";
- }
- ccf += 2;
- bAddNeg = true;
- }
- break;
- case '%': {
- CFX_WideString wsSymbol;
- pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Percent, wsSymbol);
- wsOutput += wsSymbol;
- }
- ccf++;
- break;
- case '8': {
- while (ccf < lenf && strf[ccf] == '8') {
- ccf++;
- }
- while (cc < len && FXSYS_isDecimalDigit(str[cc])) {
- wsOutput += str[cc];
- cc++;
- }
- } break;
- case ',':
- wsOutput += wsGroupSymbol;
- ccf++;
- break;
- case '(':
- if (bNeg) {
- wsOutput += '(';
- } else {
- wsOutput += ' ';
- }
- bAddNeg = true;
- ccf++;
- break;
- case ')':
- if (bNeg) {
- wsOutput += ')';
- } else {
- wsOutput += ' ';
- }
- ccf++;
- break;
- default:
- ccf++;
- }
- }
- if (!bAddNeg && bNeg) {
- CFX_WideString wsMinusymbol;
- pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Minus, wsMinusymbol);
- wsOutput =
- wsOutput[0] + wsMinusymbol + wsOutput.Mid(1, wsOutput.GetLength() - 1);
- }
- return true;
-}
-bool CFX_FormatString::FormatNum(const CFX_WideString& wsSrcNum,
- const CFX_WideString& wsPattern,
- CFX_WideString& wsOutput) {
- if (wsSrcNum.IsEmpty() || wsPattern.IsEmpty()) {
- return false;
- }
- return FormatStrNum(wsSrcNum.AsStringC(), wsPattern, wsOutput);
-}
-bool CFX_FormatString::FormatNum(FX_FLOAT fNum,
- const CFX_WideString& wsPattern,
- CFX_WideString& wsOutput) {
- if (wsPattern.IsEmpty()) {
- return false;
- }
- CFX_LCNumeric lcNum(fNum);
- return FormatLCNumeric(lcNum, wsPattern, wsOutput);
-}
-bool FX_DateFromCanonical(const CFX_WideString& wsDate, CFX_Unitime& datetime) {
- int32_t year = 1900;
- int32_t month = 1;
- int32_t day = 1;
- uint16_t wYear = 0;
- int cc_start = 0, cc = 0;
- const FX_WCHAR* str = wsDate.c_str();
- int len = wsDate.GetLength();
- if (len > 10) {
- return false;
- }
- while (cc < len && cc < 4) {
- if (!FXSYS_isDecimalDigit(str[cc])) {
- return false;
- }
- wYear = wYear * 10 + str[cc++] - '0';
- }
- year = wYear;
- if (cc < 4 || wYear < 1900) {
- return false;
- }
- if (cc < len) {
- if (str[cc] == '-') {
- cc++;
- }
- cc_start = cc;
- uint8_t tmpM = 0;
- while (cc < len && cc < cc_start + 2) {
- if (!FXSYS_isDecimalDigit(str[cc])) {
- return false;
- }
- tmpM = tmpM * 10 + str[cc++] - '0';
- }
- month = tmpM;
- if (cc == cc_start + 1 || tmpM > 12 || tmpM < 1) {
- return false;
- }
- if (cc < len) {
- if (str[cc] == '-') {
- cc++;
- }
- uint8_t tmpD = 0;
- cc_start = cc;
- while (cc < len && cc < cc_start + 2) {
- if (!FXSYS_isDecimalDigit(str[cc])) {
- return false;
- }
- tmpD = tmpD * 10 + str[cc++] - '0';
- }
- day = tmpD;
- if (tmpD < 1) {
- return false;
- }
- if ((tmpM == 1 || tmpM == 3 || tmpM == 5 || tmpM == 7 || tmpM == 8 ||
- tmpM == 10 || tmpM == 12) &&
- tmpD > 31) {
- return false;
- }
- if ((tmpM == 4 || tmpM == 6 || tmpM == 9 || tmpM == 11) && tmpD > 30) {
- return false;
- }
- bool iLeapYear;
- if ((wYear % 4 == 0 && wYear % 100 != 0) || wYear % 400 == 0) {
- iLeapYear = true;
- } else {
- iLeapYear = false;
- }
- if ((iLeapYear && tmpM == 2 && tmpD > 29) ||
- (!iLeapYear && tmpM == 2 && tmpD > 28)) {
- return false;
- }
- }
- }
- CFX_Unitime ut;
- ut.Set(year, month, day);
- datetime = datetime + ut;
- return true;
-}
-bool FX_TimeFromCanonical(const CFX_WideStringC& wsTime,
- CFX_Unitime& datetime,
- IFX_Locale* pLocale) {
- if (wsTime.GetLength() == 0) {
- return false;
- }
- uint8_t hour = 0;
- uint8_t minute = 0;
- uint8_t second = 0;
- uint16_t millisecond = 0;
- int cc_start = 0, cc = cc_start;
- const FX_WCHAR* str = wsTime.c_str();
- int len = wsTime.GetLength();
- while (cc < len && cc < 2) {
- if (!FXSYS_isDecimalDigit(str[cc])) {
- return false;
- }
- hour = hour * 10 + str[cc++] - '0';
- }
- if (cc < 2 || hour >= 24) {
- return false;
- }
- if (cc < len) {
- if (str[cc] == ':') {
- cc++;
- }
- cc_start = cc;
- while (cc < len && cc < cc_start + 2) {
- if (!FXSYS_isDecimalDigit(str[cc])) {
- return false;
- }
- minute = minute * 10 + str[cc++] - '0';
- }
- if (cc == cc_start + 1 || minute >= 60) {
- return false;
- }
- if (cc < len) {
- if (str[cc] == ':') {
- cc++;
- }
- cc_start = cc;
- while (cc < len && cc < cc_start + 2) {
- if (!FXSYS_isDecimalDigit(str[cc])) {
- return false;
- }
- second = second * 10 + str[cc++] - '0';
- }
- if (cc == cc_start + 1 || second >= 60) {
- return false;
- }
- if (cc < len) {
- if (str[cc] == '.') {
- cc++;
- cc_start = cc;
- while (cc < len && cc < cc_start + 3) {
- if (!FXSYS_isDecimalDigit(str[cc])) {
- return false;
- }
- millisecond = millisecond * 10 + str[cc++] - '0';
- }
- if (cc < cc_start + 3)
- return false;
- }
- if (cc < len) {
- FX_TIMEZONE tzDiff;
- tzDiff.tzHour = 0;
- tzDiff.tzMinute = 0;
- if (str[cc] != 'Z') {
- cc += FX_ParseTimeZone(str + cc, len - cc, tzDiff);
- }
- FX_ResolveZone(hour, minute, tzDiff, pLocale);
- }
- }
- }
- }
- CFX_Unitime ut;
- ut.Set(0, 0, 0, hour, minute, second, millisecond);
- datetime = datetime + ut;
- return true;
-}
-static uint16_t FX_GetSolarMonthDays(uint16_t year, uint16_t month) {
- if (month % 2) {
- return 31;
- } else if (month == 2) {
- return FX_IsLeapYear(year) ? 29 : 28;
- }
- return 30;
-}
-static uint16_t FX_GetWeekDay(uint16_t year, uint16_t month, uint16_t day) {
- uint16_t g_month_day[] = {0, 3, 3, 6, 1, 4, 6, 2, 5, 0, 3, 5};
- uint16_t nDays =
- (year - 1) % 7 + (year - 1) / 4 - (year - 1) / 100 + (year - 1) / 400;
- nDays += g_month_day[month - 1] + day;
- if (FX_IsLeapYear(year) && month > 2) {
- nDays++;
- }
- return nDays % 7;
-}
-static uint16_t FX_GetWeekOfMonth(uint16_t year, uint16_t month, uint16_t day) {
- uint16_t week_day = FX_GetWeekDay(year, month, 1);
- uint16_t week_index = 0;
- week_index += day / 7;
- day = day % 7;
- if (week_day + day > 7) {
- week_index++;
- }
- return week_index;
-}
-static uint16_t FX_GetWeekOfYear(uint16_t year, uint16_t month, uint16_t day) {
- uint16_t nDays = 0;
- for (uint16_t i = 1; i < month; i++) {
- nDays += FX_GetSolarMonthDays(year, i);
- }
- nDays += day;
- uint16_t week_day = FX_GetWeekDay(year, 1, 1);
- uint16_t week_index = 1;
- week_index += nDays / 7;
- nDays = nDays % 7;
- if (week_day + nDays > 7) {
- week_index++;
- }
- return week_index;
-}
-static bool FX_DateFormat(const CFX_WideString& wsDatePattern,
- IFX_Locale* pLocale,
- const CFX_Unitime& datetime,
- CFX_WideString& wsResult) {
- bool bRet = true;
- int32_t year = datetime.GetYear();
- uint8_t month = datetime.GetMonth();
- uint8_t day = datetime.GetDay();
- int32_t ccf = 0;
- const FX_WCHAR* strf = wsDatePattern.c_str();
- int32_t lenf = wsDatePattern.GetLength();
- CFX_WideStringC wsDateSymbols(gs_wsDateSymbols);
- while (ccf < lenf) {
- if (strf[ccf] == '\'') {
- wsResult += FX_GetLiteralText(strf, ccf, lenf);
- ccf++;
- continue;
- } else if (wsDateSymbols.Find(strf[ccf]) == -1) {
- wsResult += strf[ccf++];
- continue;
- }
- uint32_t dwSymbolNum = 1;
- FX_WCHAR dwCharSymbol = strf[ccf++];
- while (ccf < lenf && strf[ccf] == dwCharSymbol) {
- ccf++;
- dwSymbolNum++;
- }
- uint32_t dwSymbol = (dwCharSymbol << 8) | (dwSymbolNum + '0');
- if (dwSymbol == FXBSTR_ID(0, 0, 'D', '1')) {
- CFX_WideString wsDay;
- wsDay.Format(L"%d", day);
- wsResult += wsDay;
- } else if (dwSymbol == FXBSTR_ID(0, 0, 'D', '2')) {
- CFX_WideString wsDay;
- wsDay.Format(L"%02d", day);
- wsResult += wsDay;
- } else if (dwSymbol == FXBSTR_ID(0, 0, 'J', '1')) {
- uint16_t nDays = 0;
- for (int i = 1; i < month; i++) {
- nDays += FX_GetSolarMonthDays(year, i);
- }
- nDays += day;
- CFX_WideString wsDays;
- wsDays.Format(L"%d", nDays);
- wsResult += wsDays;
- } else if (dwSymbol == FXBSTR_ID(0, 0, 'J', '3')) {
- uint16_t nDays = 0;
- for (int i = 1; i < month; i++) {
- nDays += FX_GetSolarMonthDays(year, i);
- }
- nDays += day;
- CFX_WideString wsDays;
- wsDays.Format(L"%03d", nDays);
- wsResult += wsDays;
- } else if (dwSymbol == FXBSTR_ID(0, 0, 'M', '1')) {
- CFX_WideString wsMonth;
- wsMonth.Format(L"%d", month);
- wsResult += wsMonth;
- } else if (dwSymbol == FXBSTR_ID(0, 0, 'M', '2')) {
- CFX_WideString wsMonth;
- wsMonth.Format(L"%02d", month);
- wsResult += wsMonth;
- } else if (dwSymbol == FXBSTR_ID(0, 0, 'M', '3')) {
- CFX_WideString wsTemp;
- pLocale->GetMonthName(month - 1, wsTemp, true);
- wsResult += wsTemp;
- } else if (dwSymbol == FXBSTR_ID(0, 0, 'M', '4')) {
- CFX_WideString wsTemp;
- pLocale->GetMonthName(month - 1, wsTemp, false);
- wsResult += wsTemp;
- } else if (dwSymbol == FXBSTR_ID(0, 0, 'E', '1')) {
- uint16_t wWeekDay = FX_GetWeekDay(year, month, day);
- CFX_WideString wsWeekDay;
- wsWeekDay.Format(L"%d", wWeekDay + 1);
- wsResult += wsWeekDay;
- } else if (dwSymbol == FXBSTR_ID(0, 0, 'E', '3')) {
- uint16_t wWeekDay = FX_GetWeekDay(year, month, day);
- CFX_WideString wsTemp;
- pLocale->GetDayName(wWeekDay, wsTemp, true);
- wsResult += wsTemp;
- } else if (dwSymbol == FXBSTR_ID(0, 0, 'E', '4')) {
- uint16_t wWeekDay = FX_GetWeekDay(year, month, day);
- if (pLocale) {
- CFX_WideString wsTemp;
- pLocale->GetDayName(wWeekDay, wsTemp, false);
- wsResult += wsTemp;
- }
- } else if (dwSymbol == FXBSTR_ID(0, 0, 'e', '1')) {
- uint16_t wWeekDay = FX_GetWeekDay(year, month, day);
- CFX_WideString wsWeekDay;
- wsWeekDay.Format(L"%d", wWeekDay ? wWeekDay : 7);
- wsResult += wsWeekDay;
- } else if (dwSymbol == FXBSTR_ID(0, 0, 'G', '1')) {
- CFX_WideString wsTemp;
- pLocale->GetEraName(wsTemp, year < 0);
- wsResult += wsTemp;
- } else if (dwSymbol == FXBSTR_ID(0, 0, 'Y', '2')) {
- CFX_WideString wsYear;
- wsYear.Format(L"%02d", year % 100);
- wsResult += wsYear;
- } else if (dwSymbol == FXBSTR_ID(0, 0, 'Y', '4')) {
- CFX_WideString wsYear;
- wsYear.Format(L"%d", year);
- wsResult += wsYear;
- } else if (dwSymbol == FXBSTR_ID(0, 0, 'w', '1')) {
- uint16_t week_index = FX_GetWeekOfMonth(year, month, day);
- CFX_WideString wsWeekInMonth;
- wsWeekInMonth.Format(L"%d", week_index);
- wsResult += wsWeekInMonth;
- } else if (dwSymbol == FXBSTR_ID(0, 0, 'W', '2')) {
- uint16_t week_index = FX_GetWeekOfYear(year, month, day);
- CFX_WideString wsWeekInYear;
- wsWeekInYear.Format(L"%02d", week_index);
- wsResult += wsWeekInYear;
- }
- }
- return bRet;
-}
-static bool FX_TimeFormat(const CFX_WideString& wsTimePattern,
- IFX_Locale* pLocale,
- const CFX_Unitime& datetime,
- CFX_WideString& wsResult) {
- bool bGMT = false;
- bool bRet = true;
- uint8_t hour = datetime.GetHour();
- uint8_t minute = datetime.GetMinute();
- uint8_t second = datetime.GetSecond();
- uint16_t millisecond = datetime.GetMillisecond();
- int32_t ccf = 0;
- const FX_WCHAR* strf = wsTimePattern.c_str();
- int32_t lenf = wsTimePattern.GetLength();
- uint16_t wHour = hour;
- bool bPM = false;
- if (wsTimePattern.Find('A') != -1) {
- if (wHour >= 12) {
- bPM = true;
- }
- }
- CFX_WideStringC wsTimeSymbols(gs_wsTimeSymbols);
- while (ccf < lenf) {
- if (strf[ccf] == '\'') {
- wsResult += FX_GetLiteralText(strf, ccf, lenf);
- ccf++;
- continue;
- } else if (wsTimeSymbols.Find(strf[ccf]) == -1) {
- wsResult += strf[ccf++];
- continue;
- }
- uint32_t dwSymbolNum = 1;
- FX_WCHAR dwCharSymbol = strf[ccf++];
- while (ccf < lenf && strf[ccf] == dwCharSymbol) {
- ccf++;
- dwSymbolNum++;
- }
- uint32_t dwSymbol = (dwCharSymbol << 8) | (dwSymbolNum + '0');
- if (dwSymbol == FXBSTR_ID(0, 0, 'h', '1')) {
- if (wHour > 12) {
- wHour -= 12;
- }
- CFX_WideString wsHour;
- wsHour.Format(L"%d", wHour == 0 ? 12 : wHour);
- wsResult += wsHour;
- } else if (dwSymbol == FXBSTR_ID(0, 0, 'h', '2')) {
- if (wHour > 12) {
- wHour -= 12;
- }
- CFX_WideString wsHour;
- wsHour.Format(L"%02d", wHour == 0 ? 12 : wHour);
- wsResult += wsHour;
- } else if (dwSymbol == FXBSTR_ID(0, 0, 'K', '1')) {
- CFX_WideString wsHour;
- wsHour.Format(L"%d", wHour == 0 ? 24 : wHour);
- wsResult += wsHour;
- } else if (dwSymbol == FXBSTR_ID(0, 0, 'K', '2')) {
- CFX_WideString wsHour;
- wsHour.Format(L"%02d", wHour == 0 ? 24 : wHour);
- wsResult += wsHour;
- } else if (dwSymbol == FXBSTR_ID(0, 0, 'k', '1')) {
- if (wHour > 12) {
- wHour -= 12;
- }
- CFX_WideString wsHour;
- wsHour.Format(L"%d", wHour);
- wsResult += wsHour;
- } else if (dwSymbol == FXBSTR_ID(0, 0, 'H', '1')) {
- CFX_WideString wsHour;
- wsHour.Format(L"%d", wHour);
- wsResult += wsHour;
- } else if (dwSymbol == FXBSTR_ID(0, 0, 'k', '2')) {
- if (wHour > 12) {
- wHour -= 12;
- }
- CFX_WideString wsHour;
- wsHour.Format(L"%02d", wHour);
- wsResult += wsHour;
- } else if (dwSymbol == FXBSTR_ID(0, 0, 'H', '2')) {
- CFX_WideString wsHour;
- wsHour.Format(L"%02d", wHour);
- wsResult += wsHour;
- } else if (dwSymbol == FXBSTR_ID(0, 0, 'M', '1')) {
- CFX_WideString wsMinute;
- wsMinute.Format(L"%d", minute);
- wsResult += wsMinute;
- } else if (dwSymbol == FXBSTR_ID(0, 0, 'M', '2')) {
- CFX_WideString wsMinute;
- wsMinute.Format(L"%02d", minute);
- wsResult += wsMinute;
- } else if (dwSymbol == FXBSTR_ID(0, 0, 'S', '1')) {
- CFX_WideString wsSecond;
- wsSecond.Format(L"%d", second);
- wsResult += wsSecond;
- } else if (dwSymbol == FXBSTR_ID(0, 0, 'S', '2')) {
- CFX_WideString wsSecond;
- wsSecond.Format(L"%02d", second);
- wsResult += wsSecond;
- } else if (dwSymbol == FXBSTR_ID(0, 0, 'F', '3')) {
- CFX_WideString wsMilliseconds;
- wsMilliseconds.Format(L"%03d", millisecond);
- wsResult += wsMilliseconds;
- } else if (dwSymbol == FXBSTR_ID(0, 0, 'A', '1')) {
- CFX_WideString wsMeridiem;
- pLocale->GetMeridiemName(wsMeridiem, !bPM);
- wsResult += wsMeridiem;
- } else if (dwSymbol == FXBSTR_ID(0, 0, 'Z', '1')) {
- wsResult += L"GMT";
- FX_TIMEZONE tz;
- pLocale->GetTimeZone(&tz);
- if (!bGMT && (tz.tzHour != 0 || tz.tzMinute != 0)) {
- if (tz.tzHour < 0) {
- wsResult += L"-";
- } else {
- wsResult += L"+";
- }
- CFX_WideString wsTimezone;
- wsTimezone.Format(L"%02d:%02d", FXSYS_abs(tz.tzHour), tz.tzMinute);
- wsResult += wsTimezone;
- }
- } else if (dwSymbol == FXBSTR_ID(0, 0, 'z', '1')) {
- FX_TIMEZONE tz;
- pLocale->GetTimeZone(&tz);
- if (!bGMT && tz.tzHour != 0 && tz.tzMinute != 0) {
- if (tz.tzHour < 0) {
- wsResult += L"-";
- } else {
- wsResult += L"+";
- }
- CFX_WideString wsTimezone;
- wsTimezone.Format(L"%02d:%02d", FXSYS_abs(tz.tzHour), tz.tzMinute);
- wsResult += wsTimezone;
- }
- }
- }
- return bRet;
-}
-static bool FX_FormatDateTime(const CFX_Unitime& dt,
- const CFX_WideString& wsDatePattern,
- const CFX_WideString& wsTimePattern,
- bool bDateFirst,
- IFX_Locale* pLocale,
- CFX_WideString& wsOutput) {
- bool bRet = true;
- CFX_WideString wsDateOut, wsTimeOut;
- if (!wsDatePattern.IsEmpty()) {
- bRet &= FX_DateFormat(wsDatePattern, pLocale, dt, wsDateOut);
- }
- if (!wsTimePattern.IsEmpty()) {
- bRet &= FX_TimeFormat(wsTimePattern, pLocale, dt, wsTimeOut);
- }
- wsOutput = bDateFirst ? wsDateOut + wsTimeOut : wsTimeOut + wsDateOut;
- return bRet;
-}
-bool CFX_FormatString::FormatDateTime(const CFX_WideString& wsSrcDateTime,
- const CFX_WideString& wsPattern,
- CFX_WideString& wsOutput) {
- if (wsSrcDateTime.IsEmpty() || wsPattern.IsEmpty()) {
- return false;
- }
- CFX_WideString wsDatePattern, wsTimePattern;
- IFX_Locale* pLocale = nullptr;
- FX_DATETIMETYPE eCategory =
- GetDateTimeFormat(wsPattern, pLocale, wsDatePattern, wsTimePattern);
- if (!pLocale || eCategory == FX_DATETIMETYPE_Unknown) {
- return false;
- }
- CFX_Unitime dt(0);
- int32_t iT = wsSrcDateTime.Find(L"T");
- if (iT < 0) {
- if (eCategory == FX_DATETIMETYPE_Date) {
- FX_DateFromCanonical(wsSrcDateTime, dt);
- } else if (eCategory == FX_DATETIMETYPE_Time) {
- FX_TimeFromCanonical(wsSrcDateTime.AsStringC(), dt, pLocale);
- }
- } else {
- FX_DateFromCanonical(wsSrcDateTime.Left(iT), dt);
- FX_TimeFromCanonical(
- wsSrcDateTime.Right(wsSrcDateTime.GetLength() - iT - 1).AsStringC(), dt,
- pLocale);
- }
- return FX_FormatDateTime(dt, wsDatePattern, wsTimePattern,
- eCategory != FX_DATETIMETYPE_TimeDate, pLocale,
- wsOutput);
-}
-bool CFX_FormatString::FormatDateTime(const CFX_WideString& wsSrcDateTime,
- const CFX_WideString& wsPattern,
- CFX_WideString& wsOutput,
- FX_DATETIMETYPE eDateTimeType) {
- if (wsSrcDateTime.IsEmpty() || wsPattern.IsEmpty()) {
- return false;
- }
- CFX_WideString wsDatePattern, wsTimePattern;
- IFX_Locale* pLocale = nullptr;
- FX_DATETIMETYPE eCategory =
- GetDateTimeFormat(wsPattern, pLocale, wsDatePattern, wsTimePattern);
- if (!pLocale) {
- return false;
- }
- if (eCategory == FX_DATETIMETYPE_Unknown) {
- if (eDateTimeType == FX_DATETIMETYPE_Time) {
- wsTimePattern = wsDatePattern;
- wsDatePattern.clear();
- }
- eCategory = eDateTimeType;
- }
- if (eCategory == FX_DATETIMETYPE_Unknown) {
- return false;
- }
- CFX_Unitime dt(0);
- int32_t iT = wsSrcDateTime.Find(L"T");
- if (iT < 0) {
- if (eCategory == FX_DATETIMETYPE_Date &&
- FX_DateFromCanonical(wsSrcDateTime, dt)) {
- return FX_FormatDateTime(dt, wsDatePattern, wsTimePattern, true, pLocale,
- wsOutput);
- } else if (eCategory == FX_DATETIMETYPE_Time &&
- FX_TimeFromCanonical(wsSrcDateTime.AsStringC(), dt, pLocale)) {
- return FX_FormatDateTime(dt, wsDatePattern, wsTimePattern, true, pLocale,
- wsOutput);
- }
- } else {
- CFX_WideString wsSrcDate(wsSrcDateTime.c_str(), iT);
- CFX_WideStringC wsSrcTime(wsSrcDateTime.c_str() + iT + 1,
- wsSrcDateTime.GetLength() - iT - 1);
- if (wsSrcDate.IsEmpty() || wsSrcTime.IsEmpty()) {
- return false;
- }
- if (FX_DateFromCanonical(wsSrcDate, dt) &&
- FX_TimeFromCanonical(wsSrcTime, dt, pLocale)) {
- return FX_FormatDateTime(dt, wsDatePattern, wsTimePattern,
- eCategory != FX_DATETIMETYPE_TimeDate, pLocale,
- wsOutput);
- }
- }
- return false;
-}
-bool CFX_FormatString::FormatDateTime(const CFX_Unitime& dt,
- const CFX_WideString& wsPattern,
- CFX_WideString& wsOutput) {
- if (wsPattern.IsEmpty()) {
- return false;
- }
- CFX_WideString wsDatePattern, wsTimePattern;
- IFX_Locale* pLocale = nullptr;
- FX_DATETIMETYPE eCategory =
- GetDateTimeFormat(wsPattern, pLocale, wsDatePattern, wsTimePattern);
- if (!pLocale) {
- return false;
- }
- return FX_FormatDateTime(dt, wsPattern, wsTimePattern,
- eCategory != FX_DATETIMETYPE_TimeDate, pLocale,
- wsOutput);
-}
-bool CFX_FormatString::FormatZero(const CFX_WideString& wsPattern,
- CFX_WideString& wsOutput) {
- if (wsPattern.IsEmpty()) {
- return false;
- }
- CFX_WideString wsTextFormat;
- GetTextFormat(wsPattern, L"zero", wsTextFormat);
- int32_t iPattern = 0;
- const FX_WCHAR* pStrPattern = wsTextFormat.c_str();
- int32_t iLenPattern = wsTextFormat.GetLength();
- while (iPattern < iLenPattern) {
- if (pStrPattern[iPattern] == '\'') {
- wsOutput += FX_GetLiteralText(pStrPattern, iPattern, iLenPattern);
- iPattern++;
- continue;
- } else {
- wsOutput += pStrPattern[iPattern++];
- continue;
- }
- }
- return true;
-}
-bool CFX_FormatString::FormatNull(const CFX_WideString& wsPattern,
- CFX_WideString& wsOutput) {
- if (wsPattern.IsEmpty()) {
- return false;
- }
- CFX_WideString wsTextFormat;
- GetTextFormat(wsPattern, L"null", wsTextFormat);
- int32_t iPattern = 0;
- const FX_WCHAR* pStrPattern = wsTextFormat.c_str();
- int32_t iLenPattern = wsTextFormat.GetLength();
- while (iPattern < iLenPattern) {
- if (pStrPattern[iPattern] == '\'') {
- wsOutput += FX_GetLiteralText(pStrPattern, iPattern, iLenPattern);
- iPattern++;
- continue;
- } else {
- wsOutput += pStrPattern[iPattern++];
- continue;
- }
- }
- return true;
-}
-IFX_Locale* CFX_FormatString::GetPatternLocale(const CFX_WideString& wsLocale) {
- return m_pLocaleMgr->GetLocaleByName(wsLocale);
-}
-#define FXMATH_DECIMAL_SCALELIMIT 0x1c
-#define FXMATH_DECIMAL_NEGMASK (0x80000000L)
-#define FXMATH_DECIMAL_FORCEBOOL(x) (!(!(x)))
-#define FXMATH_DECIMAL_MAKEFLAGS(NEG, SCALE) \
- (((SCALE) << 0x10) | ((NEG) ? FXMATH_DECIMAL_NEGMASK : 0))
-#define FXMATH_DECIMAL_FLAGS2NEG(FLAGS) \
- FXMATH_DECIMAL_FORCEBOOL((FLAGS)&FXMATH_DECIMAL_NEGMASK)
-#define FXMATH_DECIMAL_FLAGS2SCALE(FLAGS) \
- ((uint8_t)(((FLAGS) & ~FXMATH_DECIMAL_NEGMASK) >> 0x10))
-#define FXMATH_DECIMAL_RSHIFT32BIT(x) ((x) >> 0x10 >> 0x10)
-#define FXMATH_DECIMAL_LSHIFT32BIT(x) ((x) << 0x10 << 0x10)
-static inline uint8_t fxmath_decimal_helper_div10(uint64_t& phi,
- uint64_t& pmid,
- uint64_t& plo) {
- uint8_t retVal;
- pmid += FXMATH_DECIMAL_LSHIFT32BIT(phi % 0xA);
- phi /= 0xA;
- plo += FXMATH_DECIMAL_LSHIFT32BIT(pmid % 0xA);
- pmid /= 0xA;
- retVal = plo % 0xA;
- plo /= 0xA;
- return retVal;
-}
-static inline uint8_t fxmath_decimal_helper_div10_any(uint64_t nums[],
- uint8_t numcount) {
- uint8_t retVal = 0;
- for (int i = numcount - 1; i > 0; i--) {
- nums[i - 1] += FXMATH_DECIMAL_LSHIFT32BIT(nums[i] % 0xA);
- nums[i] /= 0xA;
- }
- if (numcount) {
- retVal = nums[0] % 0xA;
- nums[0] /= 0xA;
- }
- return retVal;
-}
-static inline void fxmath_decimal_helper_mul10(uint64_t& phi,
- uint64_t& pmid,
- uint64_t& plo) {
- plo *= 0xA;
- pmid = pmid * 0xA + FXMATH_DECIMAL_RSHIFT32BIT(plo);
- plo = (uint32_t)plo;
- phi = phi * 0xA + FXMATH_DECIMAL_RSHIFT32BIT(pmid);
- pmid = (uint32_t)pmid;
-}
-static inline void fxmath_decimal_helper_mul10_any(uint64_t nums[],
- uint8_t numcount) {
- nums[0] *= 0xA;
- for (int i = 1; i < numcount; i++) {
- nums[i] = nums[i] * 0xA + FXMATH_DECIMAL_RSHIFT32BIT(nums[i - 1]);
- nums[i - 1] = (uint32_t)nums[i - 1];
- }
-}
-static inline void fxmath_decimal_helper_normalize(uint64_t& phi,
- uint64_t& pmid,
- uint64_t& plo) {
- phi += FXMATH_DECIMAL_RSHIFT32BIT(pmid);
- pmid = (uint32_t)pmid;
- pmid += FXMATH_DECIMAL_RSHIFT32BIT(plo);
- plo = (uint32_t)plo;
- phi += FXMATH_DECIMAL_RSHIFT32BIT(pmid);
- pmid = (uint32_t)pmid;
-}
-static inline void fxmath_decimal_helper_normalize_any(uint64_t nums[],
- uint8_t len) {
- {
- for (int i = len - 2; i > 0; i--) {
- nums[i + 1] += FXMATH_DECIMAL_RSHIFT32BIT(nums[i]);
- nums[i] = (uint32_t)nums[i];
- }
- }
- {
- for (int i = 0; i < len - 1; i++) {
- nums[i + 1] += FXMATH_DECIMAL_RSHIFT32BIT(nums[i]);
- nums[i] = (uint32_t)nums[i];
- }
- }
-}
-static inline int8_t fxmath_decimal_helper_raw_compare(uint32_t hi1,
- uint32_t mid1,
- uint32_t lo1,
- uint32_t hi2,
- uint32_t mid2,
- uint32_t lo2) {
- int8_t retVal = 0;
- if (!retVal) {
- retVal += (hi1 > hi2 ? 1 : (hi1 < hi2 ? -1 : 0));
- }
- if (!retVal) {
- retVal += (mid1 > mid2 ? 1 : (mid1 < mid2 ? -1 : 0));
- }
- if (!retVal) {
- retVal += (lo1 > lo2 ? 1 : (lo1 < lo2 ? -1 : 0));
- }
- return retVal;
-}
-static inline int8_t fxmath_decimal_helper_raw_compare_any(uint64_t a[],
- uint8_t al,
- uint64_t b[],
- uint8_t bl) {
- int8_t retVal = 0;
- for (int i = std::max(al - 1, bl - 1); i >= 0; i--) {
- uint64_t l = (i >= al ? 0 : a[i]), r = (i >= bl ? 0 : b[i]);
- retVal += (l > r ? 1 : (l < r ? -1 : 0));
- if (retVal) {
- return retVal;
- }
- }
- return retVal;
-}
-static inline void fxmath_decimal_helper_dec_any(uint64_t a[], uint8_t al) {
- for (int i = 0; i < al; i++) {
- if (a[i]--) {
- return;
- }
- }
-}
-static inline void fxmath_decimal_helper_inc_any(uint64_t a[], uint8_t al) {
- for (int i = 0; i < al; i++) {
- a[i]++;
- if ((uint32_t)a[i] == a[i]) {
- return;
- }
- a[i] = 0;
- }
-}
-static inline void fxmath_decimal_helper_raw_mul(uint64_t a[],
- uint8_t al,
- uint64_t b[],
- uint8_t bl,
- uint64_t c[],
- uint8_t cl) {
- ASSERT(al + bl <= cl);
- {
- for (int i = 0; i < cl; i++) {
- c[i] = 0;
- }
- }
- {
- for (int i = 0; i < al; i++) {
- for (int j = 0; j < bl; j++) {
- uint64_t m = (uint64_t)a[i] * b[j];
- c[i + j] += (uint32_t)m;
- c[i + j + 1] += FXMATH_DECIMAL_RSHIFT32BIT(m);
- }
- }
- }
- {
- for (int i = 0; i < cl - 1; i++) {
- c[i + 1] += FXMATH_DECIMAL_RSHIFT32BIT(c[i]);
- c[i] = (uint32_t)c[i];
- }
- }
- {
- for (int i = 0; i < cl; i++) {
- c[i] = (uint32_t)c[i];
- }
- }
-}
-static inline void fxmath_decimal_helper_raw_div(uint64_t a[],
- uint8_t al,
- uint64_t b[],
- uint8_t bl,
- uint64_t c[],
- uint8_t cl) {
- int i;
- for (i = 0; i < cl; i++) {
- c[i] = 0;
- }
- uint64_t left[16] = {0}, right[16] = {0};
- left[0] = 0;
- for (i = 0; i < al; i++) {
- right[i] = a[i];
- }
- uint64_t tmp[16];
- while (fxmath_decimal_helper_raw_compare_any(left, al, right, al) <= 0) {
- uint64_t cur[16];
- for (i = 0; i < al; i++) {
- cur[i] = left[i] + right[i];
- }
- for (i = al - 1; i >= 0; i--) {
- if (i) {
- cur[i - 1] += FXMATH_DECIMAL_LSHIFT32BIT(cur[i] % 2);
- }
- cur[i] /= 2;
- }
- fxmath_decimal_helper_raw_mul(cur, al, b, bl, tmp, 16);
- switch (fxmath_decimal_helper_raw_compare_any(tmp, 16, a, al)) {
- case -1:
- for (i = 0; i < 16; i++) {
- left[i] = cur[i];
- }
- left[0]++;
- fxmath_decimal_helper_normalize_any(left, al);
- break;
- case 1:
- for (i = 0; i < 16; i++) {
- right[i] = cur[i];
- }
- fxmath_decimal_helper_dec_any(right, al);
- break;
- case 0:
- for (i = 0; i < std::min(al, cl); i++) {
- c[i] = cur[i];
- }
- return;
- }
- }
- for (i = 0; i < std::min(al, cl); i++) {
- c[i] = left[i];
- }
-}
-static inline bool fxmath_decimal_helper_outofrange(uint64_t a[],
- uint8_t al,
- uint8_t goal) {
- for (int i = goal; i < al; i++) {
- if (a[i]) {
- return true;
- }
- }
- return false;
-}
-static inline void fxmath_decimal_helper_shrinkintorange(uint64_t a[],
- uint8_t al,
- uint8_t goal,
- uint8_t& scale) {
- bool bRoundUp = false;
- while (scale != 0 && (scale > FXMATH_DECIMAL_SCALELIMIT ||
- fxmath_decimal_helper_outofrange(a, al, goal))) {
- bRoundUp = fxmath_decimal_helper_div10_any(a, al) >= 5;
- scale--;
- }
- if (bRoundUp) {
- fxmath_decimal_helper_normalize_any(a, goal);
- fxmath_decimal_helper_inc_any(a, goal);
- }
-}
-static inline void fxmath_decimal_helper_truncate(uint64_t& phi,
- uint64_t& pmid,
- uint64_t& plo,
- uint8_t& scale,
- uint8_t minscale = 0) {
- while (scale > minscale) {
- uint64_t thi = phi, tmid = pmid, tlo = plo;
- if (fxmath_decimal_helper_div10(thi, tmid, tlo) != 0) {
- break;
- }
- phi = thi, pmid = tmid, plo = tlo;
- scale--;
- }
-}
-CFX_Decimal::CFX_Decimal() {
- m_uLo = m_uMid = m_uHi = m_uFlags = 0;
-}
-CFX_Decimal::CFX_Decimal(uint64_t val) {
- m_uLo = (uint32_t)val;
- m_uMid = (uint32_t)FXMATH_DECIMAL_RSHIFT32BIT(val);
- m_uHi = 0;
- m_uFlags = 0;
-}
-CFX_Decimal::CFX_Decimal(uint32_t val) {
- m_uLo = (uint32_t)val;
- m_uMid = m_uHi = 0;
- m_uFlags = 0;
-}
-CFX_Decimal::CFX_Decimal(uint32_t lo,
- uint32_t mid,
- uint32_t hi,
- bool neg,
- uint8_t scale) {
- scale = (scale > FXMATH_DECIMAL_SCALELIMIT ? 0 : scale);
- m_uLo = lo;
- m_uMid = mid;
- m_uHi = hi;
- m_uFlags = FXMATH_DECIMAL_MAKEFLAGS(neg && IsNotZero(), scale);
-}
-CFX_Decimal::CFX_Decimal(int32_t val) {
- if (val >= 0) {
- *this = CFX_Decimal((uint32_t)val);
- } else {
- *this = CFX_Decimal((uint32_t)-val);
- SetNegate();
- }
-}
-CFX_Decimal::CFX_Decimal(int64_t val) {
- if (val >= 0) {
- *this = CFX_Decimal((uint64_t)val);
- } else {
- *this = CFX_Decimal((uint64_t)-val);
- SetNegate();
- }
-}
-CFX_Decimal::CFX_Decimal(FX_FLOAT val, uint8_t scale) {
- FX_FLOAT newval = fabs(val);
- uint64_t phi, pmid, plo;
- plo = (uint64_t)newval;
- pmid = (uint64_t)(newval / 1e32);
- phi = (uint64_t)(newval / 1e64);
- newval = FXSYS_fmod(newval, 1.0f);
- for (uint8_t iter = 0; iter < scale; iter++) {
- fxmath_decimal_helper_mul10(phi, pmid, plo);
- newval *= 10;
- plo += (uint64_t)newval;
- newval = FXSYS_fmod(newval, 1.0f);
- }
- plo += FXSYS_round(newval);
- fxmath_decimal_helper_normalize(phi, pmid, plo);
- m_uHi = (uint32_t)phi;
- m_uMid = (uint32_t)pmid;
- m_uLo = (uint32_t)plo;
- m_uFlags = FXMATH_DECIMAL_MAKEFLAGS(val < 0 && IsNotZero(), scale);
-}
-CFX_Decimal::CFX_Decimal(const CFX_WideStringC& strObj) {
- const FX_WCHAR* str = strObj.c_str();
- const FX_WCHAR* strBound = str + strObj.GetLength();
- bool pointmet = 0;
- bool negmet = 0;
- uint8_t scale = 0;
- m_uHi = m_uMid = m_uLo = 0;
- while (str != strBound && *str == ' ') {
- str++;
- }
- if (str != strBound && *str == '-') {
- negmet = 1;
- str++;
- } else if (str != strBound && *str == '+') {
- str++;
- }
- while (str != strBound && ((*str >= '0' && *str <= '9') || *str == '.') &&
- scale < FXMATH_DECIMAL_SCALELIMIT) {
- if (*str == '.') {
- if (pointmet) {
- goto cont;
- }
- pointmet = 1;
- } else {
- m_uHi = m_uHi * 0xA + FXMATH_DECIMAL_RSHIFT32BIT((uint64_t)m_uMid * 0xA);
- m_uMid = m_uMid * 0xA + FXMATH_DECIMAL_RSHIFT32BIT((uint64_t)m_uLo * 0xA);
- m_uLo = m_uLo * 0xA + (*str - '0');
- if (pointmet) {
- scale++;
- }
- }
- cont:
- str++;
- }
- m_uFlags = FXMATH_DECIMAL_MAKEFLAGS(negmet && IsNotZero(), scale);
-}
-
-CFX_Decimal::CFX_Decimal(const CFX_ByteStringC& strObj) {
- *this = CFX_Decimal(CFX_WideString::FromLocal(strObj).AsStringC());
-}
-
-CFX_Decimal::operator CFX_WideString() const {
- CFX_WideString retString;
- CFX_WideString tmpbuf;
- uint64_t phi = m_uHi, pmid = m_uMid, plo = m_uLo;
- while (phi || pmid || plo) {
- tmpbuf += fxmath_decimal_helper_div10(phi, pmid, plo) + '0';
- }
- uint8_t outputlen = (uint8_t)tmpbuf.GetLength();
- uint8_t scale = (uint8_t)FXMATH_DECIMAL_FLAGS2SCALE(m_uFlags);
- while (scale >= outputlen) {
- tmpbuf += '0';
- outputlen++;
- }
- if (FXMATH_DECIMAL_FLAGS2NEG(m_uFlags) && IsNotZero()) {
- retString += '-';
- }
- for (uint8_t idx = 0; idx < outputlen; idx++) {
- if (idx == (outputlen - scale) && scale != 0) {
- retString += '.';
- }
- retString += tmpbuf[outputlen - 1 - idx];
- }
- return retString;
-}
-CFX_Decimal::operator double() const {
- double pow = (double)(1 << 16) * (1 << 16);
- double base =
- ((double)m_uHi) * pow * pow + ((double)m_uMid) * pow + ((double)m_uLo);
- int8_t scale = FXMATH_DECIMAL_FLAGS2SCALE(m_uFlags);
- bool bNeg = FXMATH_DECIMAL_FLAGS2NEG(m_uFlags);
- return (bNeg ? -1 : 1) * base * ::pow(10.0, -scale);
-}
-void CFX_Decimal::SetScale(uint8_t newscale) {
- uint8_t oldscale = FXMATH_DECIMAL_FLAGS2SCALE(m_uFlags);
- if (newscale > oldscale) {
- uint64_t phi = m_uHi, pmid = m_uMid, plo = m_uLo;
- for (uint8_t iter = 0; iter < newscale - oldscale; iter++) {
- fxmath_decimal_helper_mul10(phi, pmid, plo);
- }
- m_uHi = (uint32_t)phi;
- m_uMid = (uint32_t)pmid;
- m_uLo = (uint32_t)plo;
- m_uFlags = FXMATH_DECIMAL_MAKEFLAGS(
- FXMATH_DECIMAL_FLAGS2NEG(m_uFlags) && IsNotZero(), newscale);
- } else if (newscale < oldscale) {
- uint64_t phi, pmid, plo;
- phi = 0, pmid = 0, plo = 5;
- {
- for (uint8_t iter = 0; iter < oldscale - newscale - 1; iter++) {
- fxmath_decimal_helper_mul10(phi, pmid, plo);
- }
- }
- phi += m_uHi;
- pmid += m_uMid;
- plo += m_uLo;
- fxmath_decimal_helper_normalize(phi, pmid, plo);
- {
- for (uint8_t iter = 0; iter < oldscale - newscale; iter++) {
- fxmath_decimal_helper_div10(phi, pmid, plo);
- }
- }
- m_uHi = (uint32_t)phi;
- m_uMid = (uint32_t)pmid;
- m_uLo = (uint32_t)plo;
- m_uFlags = FXMATH_DECIMAL_MAKEFLAGS(
- FXMATH_DECIMAL_FLAGS2NEG(m_uFlags) && IsNotZero(), newscale);
- }
-}
-uint8_t CFX_Decimal::GetScale() {
- uint8_t oldscale = FXMATH_DECIMAL_FLAGS2SCALE(m_uFlags);
- return oldscale;
-}
-void CFX_Decimal::SetAbs() {
- m_uFlags &= ~FXMATH_DECIMAL_NEGMASK;
-}
-void CFX_Decimal::SetNegate() {
- if (IsNotZero()) {
- m_uFlags ^= FXMATH_DECIMAL_NEGMASK;
- }
-}
-void CFX_Decimal::FloorOrCeil(bool bFloor) {
- uint64_t nums[3] = {m_uLo, m_uMid, m_uHi};
- bool bDataLoss = false;
- for (int i = FXMATH_DECIMAL_FLAGS2SCALE(m_uFlags); i > 0; i--) {
- bDataLoss = fxmath_decimal_helper_div10_any(nums, 3) || bDataLoss;
- }
- if (bDataLoss && (bFloor ? FXMATH_DECIMAL_FLAGS2NEG(m_uFlags)
- : !FXMATH_DECIMAL_FLAGS2NEG(m_uFlags))) {
- fxmath_decimal_helper_inc_any(nums, 3);
- }
- m_uHi = (uint32_t)nums[2];
- m_uMid = (uint32_t)nums[1];
- m_uLo = (uint32_t)nums[0];
- m_uFlags = FXMATH_DECIMAL_MAKEFLAGS(
- FXMATH_DECIMAL_FLAGS2NEG(m_uFlags) && IsNotZero(), 0);
-}
-void CFX_Decimal::SetFloor() {
- FloorOrCeil(true);
-}
-void CFX_Decimal::SetCeiling() {
- FloorOrCeil(false);
-}
-void CFX_Decimal::SetTruncate() {
- FloorOrCeil(!FXMATH_DECIMAL_FLAGS2NEG(m_uFlags));
-}
-void CFX_Decimal::Swap(CFX_Decimal& val) {
- uint32_t tmp;
- tmp = m_uHi;
- m_uHi = val.m_uHi;
- val.m_uHi = tmp;
- tmp = m_uMid;
- m_uMid = val.m_uMid;
- val.m_uMid = tmp;
- tmp = m_uLo;
- m_uLo = val.m_uLo;
- val.m_uLo = tmp;
- tmp = m_uFlags;
- m_uFlags = val.m_uFlags;
- val.m_uFlags = tmp;
-}
-int8_t CFX_Decimal::Compare(const CFX_Decimal& val) const {
- CFX_Decimal lhs = *this, rhs = val;
- int8_t retVal = 0;
- if (FXMATH_DECIMAL_FLAGS2SCALE(lhs.m_uFlags) !=
- FXMATH_DECIMAL_FLAGS2SCALE(rhs.m_uFlags)) {
- uint8_t scale = std::min(FXMATH_DECIMAL_FLAGS2SCALE(lhs.m_uFlags),
- FXMATH_DECIMAL_FLAGS2SCALE(rhs.m_uFlags));
- lhs.SetScale(scale);
- rhs.SetScale(scale);
- }
- retVal = -(FXMATH_DECIMAL_FLAGS2NEG(lhs.m_uFlags) -
- FXMATH_DECIMAL_FLAGS2NEG(rhs.m_uFlags));
- if (retVal) {
- return retVal;
- }
- retVal = fxmath_decimal_helper_raw_compare(lhs.m_uHi, lhs.m_uMid, lhs.m_uLo,
- rhs.m_uHi, rhs.m_uMid, rhs.m_uLo);
- return (FXMATH_DECIMAL_FLAGS2NEG(lhs.m_uFlags) ? -retVal : retVal);
-}
-CFX_Decimal CFX_Decimal::AddOrMinus(const CFX_Decimal& val,
- bool isAdding) const {
- CFX_Decimal lhs = *this, rhs = val;
- if (FXMATH_DECIMAL_FLAGS2SCALE(lhs.m_uFlags) !=
- FXMATH_DECIMAL_FLAGS2SCALE(rhs.m_uFlags)) {
- uint8_t scale = std::max(FXMATH_DECIMAL_FLAGS2SCALE(lhs.m_uFlags),
- FXMATH_DECIMAL_FLAGS2SCALE(rhs.m_uFlags));
- lhs.SetScale(scale);
- rhs.SetScale(scale);
- }
- if (!isAdding) {
- rhs.SetNegate();
- }
- if (FXMATH_DECIMAL_FLAGS2NEG(lhs.m_uFlags) ==
- FXMATH_DECIMAL_FLAGS2NEG(rhs.m_uFlags)) {
- uint64_t phi = lhs.m_uHi, pmid = lhs.m_uMid, plo = lhs.m_uLo;
- phi += rhs.m_uHi;
- pmid += rhs.m_uMid;
- plo += rhs.m_uLo;
- fxmath_decimal_helper_normalize(phi, pmid, plo);
- if (FXMATH_DECIMAL_RSHIFT32BIT(phi) &&
- FXMATH_DECIMAL_FLAGS2SCALE(lhs.m_uFlags) != 0) {
- fxmath_decimal_helper_div10(phi, pmid, plo);
- lhs.m_uFlags = FXMATH_DECIMAL_MAKEFLAGS(
- FXMATH_DECIMAL_FLAGS2NEG(lhs.m_uFlags),
- FXMATH_DECIMAL_FLAGS2SCALE(lhs.m_uFlags) - 1);
- }
- lhs.m_uHi = (uint32_t)phi;
- lhs.m_uMid = (uint32_t)pmid;
- lhs.m_uLo = (uint32_t)plo;
- return lhs;
- } else {
- if (fxmath_decimal_helper_raw_compare(lhs.m_uHi, lhs.m_uMid, lhs.m_uLo,
- rhs.m_uHi, rhs.m_uMid,
- rhs.m_uLo) < 0) {
- lhs.Swap(rhs);
- }
- lhs.m_uHi -= rhs.m_uHi;
- if (lhs.m_uMid < rhs.m_uMid) {
- lhs.m_uHi--;
- }
- lhs.m_uMid -= rhs.m_uMid;
- if (lhs.m_uLo < rhs.m_uLo) {
- if (!lhs.m_uMid) {
- lhs.m_uHi--;
- }
- lhs.m_uMid--;
- }
- lhs.m_uLo -= rhs.m_uLo;
- return lhs;
- }
-}
-CFX_Decimal CFX_Decimal::Multiply(const CFX_Decimal& val) const {
- uint64_t a[3] = {m_uLo, m_uMid, m_uHi},
- b[3] = {val.m_uLo, val.m_uMid, val.m_uHi};
- uint64_t c[6];
- fxmath_decimal_helper_raw_mul(a, 3, b, 3, c, 6);
- bool neg = FXMATH_DECIMAL_FLAGS2NEG(m_uFlags) ^
- FXMATH_DECIMAL_FLAGS2NEG(val.m_uFlags);
- uint8_t scale = FXMATH_DECIMAL_FLAGS2SCALE(m_uFlags) +
- FXMATH_DECIMAL_FLAGS2SCALE(val.m_uFlags);
- fxmath_decimal_helper_shrinkintorange(c, 6, 3, scale);
- return CFX_Decimal((uint32_t)c[0], (uint32_t)c[1], (uint32_t)c[2], neg,
- scale);
-}
-CFX_Decimal CFX_Decimal::Divide(const CFX_Decimal& val) const {
- if (!val.IsNotZero()) {
- return CFX_Decimal();
- }
- bool neg = FXMATH_DECIMAL_FLAGS2NEG(m_uFlags) ^
- FXMATH_DECIMAL_FLAGS2NEG(val.m_uFlags);
- uint64_t a[7] = {m_uLo, m_uMid, m_uHi},
- b[3] = {val.m_uLo, val.m_uMid, val.m_uHi}, c[7] = {0};
- uint8_t scale = 0;
- if (FXMATH_DECIMAL_FLAGS2SCALE(m_uFlags) <
- FXMATH_DECIMAL_FLAGS2SCALE(val.m_uFlags)) {
- for (int i = FXMATH_DECIMAL_FLAGS2SCALE(val.m_uFlags) -
- FXMATH_DECIMAL_FLAGS2SCALE(m_uFlags);
- i > 0; i--) {
- fxmath_decimal_helper_mul10_any(a, 7);
- }
- } else {
- scale = FXMATH_DECIMAL_FLAGS2SCALE(m_uFlags) -
- FXMATH_DECIMAL_FLAGS2SCALE(val.m_uFlags);
- }
- uint8_t minscale = scale;
- if (!IsNotZero()) {
- return CFX_Decimal(0, 0, 0, 0, minscale);
- }
- while (!a[6]) {
- fxmath_decimal_helper_mul10_any(a, 7);
- scale++;
- }
- fxmath_decimal_helper_div10_any(a, 7);
- scale--;
- fxmath_decimal_helper_raw_div(a, 6, b, 3, c, 7);
- fxmath_decimal_helper_shrinkintorange(c, 6, 3, scale);
- fxmath_decimal_helper_truncate(c[2], c[1], c[0], scale, minscale);
- return CFX_Decimal((uint32_t)c[0], (uint32_t)c[1], (uint32_t)c[2], neg,
- scale);
-}
-CFX_Decimal CFX_Decimal::Modulus(const CFX_Decimal& val) const {
- CFX_Decimal lhs = *this, rhs_abs = val;
- rhs_abs.SetAbs();
- if (!rhs_abs.IsNotZero()) {
- return *this;
- }
- while (true) {
- CFX_Decimal lhs_abs = lhs;
- lhs_abs.SetAbs();
- if (lhs_abs < rhs_abs) {
- break;
- }
- CFX_Decimal quot = lhs / rhs_abs;
- quot.SetTruncate();
- lhs = lhs - quot * rhs_abs;
- }
- return lhs;
-}
-bool CFX_Decimal::operator==(const CFX_Decimal& val) const {
- return Compare(val) == 0;
-}
-bool CFX_Decimal::operator<=(const CFX_Decimal& val) const {
- return Compare(val) <= 0;
-}
-bool CFX_Decimal::operator>=(const CFX_Decimal& val) const {
- return Compare(val) >= 0;
-}
-bool CFX_Decimal::operator!=(const CFX_Decimal& val) const {
- return Compare(val) != 0;
-}
-bool CFX_Decimal::operator<(const CFX_Decimal& val) const {
- return Compare(val) < 0;
-}
-bool CFX_Decimal::operator>(const CFX_Decimal& val) const {
- return Compare(val) > 0;
-}
-CFX_Decimal CFX_Decimal::operator+(const CFX_Decimal& val) const {
- return AddOrMinus(val, true);
-}
-CFX_Decimal CFX_Decimal::operator-(const CFX_Decimal& val) const {
- return AddOrMinus(val, false);
-}
-CFX_Decimal CFX_Decimal::operator*(const CFX_Decimal& val) const {
- return Multiply(val);
-}
-CFX_Decimal CFX_Decimal::operator/(const CFX_Decimal& val) const {
- return Divide(val);
-}
-CFX_Decimal CFX_Decimal::operator%(const CFX_Decimal& val) const {
- return Modulus(val);
-}
diff --git a/chromium/third_party/pdfium/xfa/fgas/localization/fgas_locale.h b/chromium/third_party/pdfium/xfa/fgas/localization/fgas_locale.h
deleted file mode 100644
index f15766d2dd2..00000000000
--- a/chromium/third_party/pdfium/xfa/fgas/localization/fgas_locale.h
+++ /dev/null
@@ -1,146 +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 XFA_FGAS_LOCALIZATION_FGAS_LOCALE_H_
-#define XFA_FGAS_LOCALIZATION_FGAS_LOCALE_H_
-
-#include <memory>
-
-#include "core/fxcrt/fx_xml.h"
-#include "xfa/fgas/localization/fgas_datetime.h"
-
-class CFX_Unitime;
-
-enum FX_LOCALENUMSYMBOL {
- FX_LOCALENUMSYMBOL_Decimal,
- FX_LOCALENUMSYMBOL_Grouping,
- FX_LOCALENUMSYMBOL_Percent,
- FX_LOCALENUMSYMBOL_Minus,
- FX_LOCALENUMSYMBOL_Zero,
- FX_LOCALENUMSYMBOL_CurrencySymbol,
- FX_LOCALENUMSYMBOL_CurrencyName,
-};
-enum FX_LOCALEDATETIMESUBCATEGORY {
- FX_LOCALEDATETIMESUBCATEGORY_Default,
- FX_LOCALEDATETIMESUBCATEGORY_Short,
- FX_LOCALEDATETIMESUBCATEGORY_Medium,
- FX_LOCALEDATETIMESUBCATEGORY_Full,
- FX_LOCALEDATETIMESUBCATEGORY_Long,
-};
-enum FX_LOCALENUMSUBCATEGORY {
- FX_LOCALENUMPATTERN_Percent,
- FX_LOCALENUMPATTERN_Currency,
- FX_LOCALENUMPATTERN_Decimal,
- FX_LOCALENUMPATTERN_Integer,
-};
-enum FX_LOCALECATEGORY {
- FX_LOCALECATEGORY_Unknown,
- FX_LOCALECATEGORY_Date,
- FX_LOCALECATEGORY_Time,
- FX_LOCALECATEGORY_DateTime,
- FX_LOCALECATEGORY_Num,
- FX_LOCALECATEGORY_Text,
- FX_LOCALECATEGORY_Zero,
- FX_LOCALECATEGORY_Null,
-};
-enum FX_DATETIMETYPE {
- FX_DATETIMETYPE_Unknown,
- FX_DATETIMETYPE_Date,
- FX_DATETIMETYPE_Time,
- FX_DATETIMETYPE_DateTime,
- FX_DATETIMETYPE_TimeDate,
-};
-
-class IFX_Locale {
- public:
- virtual ~IFX_Locale() {}
-
- virtual CFX_WideString GetName() const = 0;
- virtual void GetNumbericSymbol(FX_LOCALENUMSYMBOL eType,
- CFX_WideString& wsNumSymbol) const = 0;
- virtual void GetDateTimeSymbols(CFX_WideString& wsDtSymbol) const = 0;
- virtual void GetMonthName(int32_t nMonth,
- CFX_WideString& wsMonthName,
- bool bAbbr = true) const = 0;
- virtual void GetDayName(int32_t nWeek,
- CFX_WideString& wsDayName,
- bool bAbbr = true) const = 0;
- virtual void GetMeridiemName(CFX_WideString& wsMeridiemName,
- bool bAM = true) const = 0;
- virtual void GetTimeZone(FX_TIMEZONE* tz) const = 0;
- virtual void GetEraName(CFX_WideString& wsEraName, bool bAD = true) const = 0;
- virtual void GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY eType,
- CFX_WideString& wsPattern) const = 0;
- virtual void GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY eType,
- CFX_WideString& wsPattern) const = 0;
- virtual void GetNumPattern(FX_LOCALENUMSUBCATEGORY eType,
- CFX_WideString& wsPattern) const = 0;
-};
-
-class IFX_LocaleMgr {
- public:
- virtual ~IFX_LocaleMgr() {}
-
- virtual uint16_t GetDefLocaleID() const = 0;
- virtual IFX_Locale* GetDefLocale() = 0;
- virtual IFX_Locale* GetLocaleByName(const CFX_WideString& wsLocaleName) = 0;
-
- protected:
- virtual std::unique_ptr<IFX_Locale> GetLocale(uint16_t lcid) = 0;
-};
-
-bool FX_DateFromCanonical(const CFX_WideString& wsDate, CFX_Unitime& datetime);
-bool FX_TimeFromCanonical(const CFX_WideStringC& wsTime,
- CFX_Unitime& datetime,
- IFX_Locale* pLocale);
-class CFX_Decimal {
- public:
- CFX_Decimal();
- explicit CFX_Decimal(uint32_t val);
- explicit CFX_Decimal(uint64_t val);
- explicit CFX_Decimal(int32_t val);
- explicit CFX_Decimal(int64_t val);
- explicit CFX_Decimal(FX_FLOAT val, uint8_t scale = 3);
- explicit CFX_Decimal(const CFX_WideStringC& str);
- explicit CFX_Decimal(const CFX_ByteStringC& str);
- operator CFX_WideString() const;
- operator double() const;
- bool operator==(const CFX_Decimal& val) const;
- bool operator<=(const CFX_Decimal& val) const;
- bool operator>=(const CFX_Decimal& val) const;
- bool operator!=(const CFX_Decimal& val) const;
- bool operator<(const CFX_Decimal& val) const;
- bool operator>(const CFX_Decimal& val) const;
- CFX_Decimal operator+(const CFX_Decimal& val) const;
- CFX_Decimal operator-(const CFX_Decimal& val) const;
- CFX_Decimal operator*(const CFX_Decimal& val) const;
- CFX_Decimal operator/(const CFX_Decimal& val) const;
- CFX_Decimal operator%(const CFX_Decimal& val) const;
- void SetScale(uint8_t newScale);
- uint8_t GetScale();
- void SetAbs();
- void SetNegate();
- void SetFloor();
- void SetCeiling();
- void SetTruncate();
-
- protected:
- CFX_Decimal(uint32_t hi, uint32_t mid, uint32_t lo, bool neg, uint8_t scale);
- inline bool IsNotZero() const { return m_uHi || m_uMid || m_uLo; }
- inline int8_t Compare(const CFX_Decimal& val) const;
- inline void Swap(CFX_Decimal& val);
- inline void FloorOrCeil(bool bFloor);
- CFX_Decimal AddOrMinus(const CFX_Decimal& val, bool isAdding) const;
- CFX_Decimal Multiply(const CFX_Decimal& val) const;
- CFX_Decimal Divide(const CFX_Decimal& val) const;
- CFX_Decimal Modulus(const CFX_Decimal& val) const;
- uint32_t m_uFlags;
- uint32_t m_uHi;
- uint32_t m_uLo;
- uint32_t m_uMid;
-};
-
-#endif // XFA_FGAS_LOCALIZATION_FGAS_LOCALE_H_
diff --git a/chromium/third_party/pdfium/xfa/fgas/localization/fgas_localeimp.h b/chromium/third_party/pdfium/xfa/fgas/localization/fgas_localeimp.h
deleted file mode 100644
index a66921b61c0..00000000000
--- a/chromium/third_party/pdfium/xfa/fgas/localization/fgas_localeimp.h
+++ /dev/null
@@ -1,89 +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 XFA_FGAS_LOCALIZATION_FGAS_LOCALEIMP_H_
-#define XFA_FGAS_LOCALIZATION_FGAS_LOCALEIMP_H_
-
-#include <vector>
-
-#include "xfa/fgas/localization/fgas_locale.h"
-
-class CFX_LCNumeric;
-
-class CFX_FormatString {
- public:
- CFX_FormatString(IFX_LocaleMgr* pLocaleMgr, bool bUseLCID);
- ~CFX_FormatString();
-
- void SplitFormatString(const CFX_WideString& wsFormatString,
- std::vector<CFX_WideString>& wsPatterns);
- FX_LOCALECATEGORY GetCategory(const CFX_WideString& wsPattern);
- uint16_t GetLCID(const CFX_WideString& wsPattern);
- CFX_WideString GetLocaleName(const CFX_WideString& wsPattern);
- bool ParseText(const CFX_WideString& wsSrcText,
- const CFX_WideString& wsPattern,
- CFX_WideString& wsValue);
- bool ParseNum(const CFX_WideString& wsSrcNum,
- const CFX_WideString& wsPattern,
- FX_FLOAT& fValue);
- bool ParseNum(const CFX_WideString& wsSrcNum,
- const CFX_WideString& wsPattern,
- CFX_WideString& wsValue);
- bool ParseDateTime(const CFX_WideString& wsSrcDateTime,
- const CFX_WideString& wsPattern,
- FX_DATETIMETYPE eDateTimeType,
- CFX_Unitime& dtValue);
- bool ParseZero(const CFX_WideString& wsSrcText,
- const CFX_WideString& wsPattern);
- bool ParseNull(const CFX_WideString& wsSrcText,
- const CFX_WideString& wsPattern);
- bool FormatText(const CFX_WideString& wsSrcText,
- const CFX_WideString& wsPattern,
- CFX_WideString& wsOutput);
- bool FormatNum(const CFX_WideString& wsSrcNum,
- const CFX_WideString& wsPattern,
- CFX_WideString& wsOutput);
- bool FormatNum(FX_FLOAT fNum,
- const CFX_WideString& wsPattern,
- CFX_WideString& wsOutput);
- bool FormatDateTime(const CFX_WideString& wsSrcDateTime,
- const CFX_WideString& wsPattern,
- CFX_WideString& wsOutput);
- bool FormatDateTime(const CFX_WideString& wsSrcDateTime,
- const CFX_WideString& wsPattern,
- CFX_WideString& wsOutput,
- FX_DATETIMETYPE eDateTimeType);
- bool FormatDateTime(const CFX_Unitime& dt,
- const CFX_WideString& wsPattern,
- CFX_WideString& wsOutput);
- bool FormatZero(const CFX_WideString& wsPattern, CFX_WideString& wsOutput);
- bool FormatNull(const CFX_WideString& wsPattern, CFX_WideString& wsOutput);
-
- protected:
- IFX_Locale* GetTextFormat(const CFX_WideString& wsPattern,
- const CFX_WideStringC& wsCategory,
- CFX_WideString& wsPurgePattern);
- IFX_Locale* GetNumericFormat(const CFX_WideString& wsPattern,
- int32_t& iDotIndex,
- uint32_t& dwStyle,
- CFX_WideString& wsPurgePattern);
- bool FormatStrNum(const CFX_WideStringC& wsInputNum,
- const CFX_WideString& wsPattern,
- CFX_WideString& wsOutput);
- bool FormatLCNumeric(CFX_LCNumeric& lcNum,
- const CFX_WideString& wsPattern,
- CFX_WideString& wsOutput);
- FX_DATETIMETYPE GetDateTimeFormat(const CFX_WideString& wsPattern,
- IFX_Locale*& pLocale,
- CFX_WideString& wsDatePattern,
- CFX_WideString& wsTimePattern);
- IFX_Locale* GetPatternLocale(const CFX_WideString& wsLocale);
-
- IFX_LocaleMgr* m_pLocaleMgr;
- bool m_bUseLCID;
-};
-
-#endif // XFA_FGAS_LOCALIZATION_FGAS_LOCALEIMP_H_
diff --git a/chromium/third_party/pdfium/xfa/fwl/cfwl_barcode.cpp b/chromium/third_party/pdfium/xfa/fwl/cfwl_barcode.cpp
index 0412b86958b..87ecee13b5f 100644
--- a/chromium/third_party/pdfium/xfa/fwl/cfwl_barcode.cpp
+++ b/chromium/third_party/pdfium/xfa/fwl/cfwl_barcode.cpp
@@ -136,12 +136,12 @@ void CFWL_Barcode::SetWideNarrowRatio(int32_t ratio) {
m_nWideNarrowRatio = ratio;
}
-void CFWL_Barcode::SetStartChar(FX_CHAR startChar) {
+void CFWL_Barcode::SetStartChar(char startChar) {
m_dwAttributeMask |= FWL_BCDATTRIBUTE_STARTCHAR;
m_cStartChar = startChar;
}
-void CFWL_Barcode::SetEndChar(FX_CHAR endChar) {
+void CFWL_Barcode::SetEndChar(char endChar) {
m_dwAttributeMask |= FWL_BCDATTRIBUTE_ENDCHAR;
m_cEndChar = endChar;
}
@@ -201,8 +201,6 @@ void CFWL_Barcode::GenerateBarcodeImageCache() {
m_pBarcodeEngine->SetStartChar(m_cStartChar);
if (m_dwAttributeMask & FWL_BCDATTRIBUTE_ENDCHAR)
m_pBarcodeEngine->SetEndChar(m_cEndChar);
- if (m_dwAttributeMask & FWL_BCDATTRIBUTE_VERSION)
- m_pBarcodeEngine->SetVersion(0);
if (m_dwAttributeMask & FWL_BCDATTRIBUTE_ECLEVEL)
m_pBarcodeEngine->SetErrorCorrectionLevel(m_nECLevel);
if (m_dwAttributeMask & FWL_BCDATTRIBUTE_TRUNCATED)
@@ -218,7 +216,7 @@ void CFWL_Barcode::CreateBarcodeEngine() {
if (m_pBarcodeEngine || m_type == BC_UNKNOWN)
return;
- std::unique_ptr<CFX_Barcode> pBarcode(new CFX_Barcode);
+ auto pBarcode = pdfium::MakeUnique<CFX_Barcode>();
if (pBarcode->Create(m_type))
m_pBarcodeEngine = std::move(pBarcode);
}
diff --git a/chromium/third_party/pdfium/xfa/fwl/cfwl_barcode.h b/chromium/third_party/pdfium/xfa/fwl/cfwl_barcode.h
index 2e9799172b6..ce62d73ddef 100644
--- a/chromium/third_party/pdfium/xfa/fwl/cfwl_barcode.h
+++ b/chromium/third_party/pdfium/xfa/fwl/cfwl_barcode.h
@@ -9,10 +9,10 @@
#include <memory>
+#include "fxbarcode/BC_Library.h"
#include "xfa/fwl/cfwl_edit.h"
#include "xfa/fwl/cfwl_scrollbar.h"
#include "xfa/fwl/cfwl_widget.h"
-#include "xfa/fxbarcode/BC_Library.h"
class CFWL_WidgetProperties;
class CFX_Barcode;
@@ -33,9 +33,8 @@ enum FWL_BCDAttribute {
FWL_BCDATTRIBUTE_WIDENARROWRATIO = 1 << 7,
FWL_BCDATTRIBUTE_STARTCHAR = 1 << 8,
FWL_BCDATTRIBUTE_ENDCHAR = 1 << 9,
- FWL_BCDATTRIBUTE_VERSION = 1 << 10,
- FWL_BCDATTRIBUTE_ECLEVEL = 1 << 11,
- FWL_BCDATTRIBUTE_TRUNCATED = 1 << 12
+ FWL_BCDATTRIBUTE_ECLEVEL = 1 << 10,
+ FWL_BCDATTRIBUTE_TRUNCATED = 1 << 11,
};
class CFWL_Barcode : public CFWL_Edit {
@@ -63,8 +62,8 @@ class CFWL_Barcode : public CFWL_Edit {
void SetPrintChecksum(bool printChecksum);
void SetTextLocation(BC_TEXT_LOC location);
void SetWideNarrowRatio(int32_t ratio);
- void SetStartChar(FX_CHAR startChar);
- void SetEndChar(FX_CHAR endChar);
+ void SetStartChar(char startChar);
+ void SetEndChar(char endChar);
void SetErrorCorrectionLevel(int32_t ecLevel);
void SetTruncated(bool truncated);
@@ -83,8 +82,8 @@ class CFWL_Barcode : public CFWL_Edit {
bool m_bPrintChecksum;
BC_TEXT_LOC m_eTextLocation;
int32_t m_nWideNarrowRatio;
- FX_CHAR m_cStartChar;
- FX_CHAR m_cEndChar;
+ char m_cStartChar;
+ char m_cEndChar;
int32_t m_nECLevel;
bool m_bTruncated;
uint32_t m_dwAttributeMask;
diff --git a/chromium/third_party/pdfium/xfa/fwl/cfwl_checkbox.cpp b/chromium/third_party/pdfium/xfa/fwl/cfwl_checkbox.cpp
index 0102bc7cc42..5ec3504caec 100644
--- a/chromium/third_party/pdfium/xfa/fwl/cfwl_checkbox.cpp
+++ b/chromium/third_party/pdfium/xfa/fwl/cfwl_checkbox.cpp
@@ -12,7 +12,7 @@
#include <vector>
#include "third_party/base/ptr_util.h"
-#include "xfa/fde/tto/fde_textout.h"
+#include "xfa/fde/cfde_textout.h"
#include "xfa/fwl/cfwl_app.h"
#include "xfa/fwl/cfwl_event.h"
#include "xfa/fwl/cfwl_messagekey.h"
@@ -47,7 +47,7 @@ FWL_Type CFWL_CheckBox::GetClassID() const {
return FWL_Type::CheckBox;
}
-void CFWL_CheckBox::SetBoxSize(FX_FLOAT fHeight) {
+void CFWL_CheckBox::SetBoxSize(float fHeight) {
m_fBoxHeight = fHeight;
}
@@ -129,7 +129,7 @@ void CFWL_CheckBox::Layout() {
FXSYS_round(m_pProperties->m_rtWidget.height);
m_rtClient = GetClientRect();
- FX_FLOAT fTextLeft = m_rtClient.left + m_fBoxHeight;
+ float fTextLeft = m_rtClient.left + m_fBoxHeight;
m_rtBox = CFX_RectF(m_rtClient.TopLeft(), m_fBoxHeight, m_fBoxHeight);
m_rtCaption = CFX_RectF(fTextLeft, m_rtClient.top,
m_rtClient.right() - fTextLeft, m_rtClient.height);
@@ -184,7 +184,7 @@ void CFWL_CheckBox::NextStates() {
if (!pWidgetMgr->IsFormDisabled()) {
std::vector<CFWL_Widget*> radioarr =
pWidgetMgr->GetSameGroupRadioButton(this);
- for (const auto& pWidget : radioarr) {
+ for (auto* pWidget : radioarr) {
CFWL_CheckBox* pCheckBox = static_cast<CFWL_CheckBox*>(pWidget);
if (pCheckBox != this &&
pCheckBox->GetStates() & FWL_STATE_CKB_Checked) {
diff --git a/chromium/third_party/pdfium/xfa/fwl/cfwl_checkbox.h b/chromium/third_party/pdfium/xfa/fwl/cfwl_checkbox.h
index 6df7440894e..2f434f23cf3 100644
--- a/chromium/third_party/pdfium/xfa/fwl/cfwl_checkbox.h
+++ b/chromium/third_party/pdfium/xfa/fwl/cfwl_checkbox.h
@@ -47,7 +47,7 @@ class CFWL_CheckBox : public CFWL_Widget {
void OnDrawWidget(CFX_Graphics* pGraphics,
const CFX_Matrix* pMatrix) override;
- void SetBoxSize(FX_FLOAT fHeight);
+ void SetBoxSize(float fHeight);
private:
void SetCheckState(int32_t iCheck);
@@ -69,7 +69,7 @@ class CFWL_CheckBox : public CFWL_Widget {
uint32_t m_dwTTOStyles;
int32_t m_iTTOAlign;
bool m_bBtnDown;
- FX_FLOAT m_fBoxHeight;
+ float m_fBoxHeight;
};
#endif // XFA_FWL_CFWL_CHECKBOX_H_
diff --git a/chromium/third_party/pdfium/xfa/fwl/cfwl_combobox.cpp b/chromium/third_party/pdfium/xfa/fwl/cfwl_combobox.cpp
index 6083943f94e..b5931d1c04b 100644
--- a/chromium/third_party/pdfium/xfa/fwl/cfwl_combobox.cpp
+++ b/chromium/third_party/pdfium/xfa/fwl/cfwl_combobox.cpp
@@ -11,8 +11,8 @@
#include <utility>
#include "third_party/base/ptr_util.h"
+#include "xfa/fde/cfde_textout.h"
#include "xfa/fde/cfde_txtedtengine.h"
-#include "xfa/fde/tto/fde_textout.h"
#include "xfa/fwl/cfwl_app.h"
#include "xfa/fwl/cfwl_event.h"
#include "xfa/fwl/cfwl_eventselectchanged.h"
@@ -376,7 +376,7 @@ void CFWL_ComboBox::Layout() {
if (!theme)
return;
- FX_FLOAT fBtn = theme->GetScrollBarWidth();
+ float fBtn = theme->GetScrollBarWidth();
m_rtBtn = CFX_RectF(m_rtClient.right() - fBtn, m_rtClient.top, fBtn,
m_rtClient.height);
if (!IsDropDownStyle() || !m_pEdit)
@@ -543,13 +543,13 @@ void CFWL_ComboBox::DisForm_ShowDropList(bool bActivate) {
ResetListItemAlignment();
pComboList->ChangeSelected(m_iCurSel);
- FX_FLOAT fItemHeight = pComboList->CalcItemHeight();
- FX_FLOAT fBorder = GetBorderSize(true);
- FX_FLOAT fPopupMin = 0.0f;
+ float fItemHeight = pComboList->CalcItemHeight();
+ float fBorder = GetBorderSize(true);
+ float fPopupMin = 0.0f;
if (iItems > 3)
fPopupMin = fItemHeight * 3 + fBorder * 2;
- FX_FLOAT fPopupMax = fItemHeight * iItems + fBorder * 2;
+ float fPopupMax = fItemHeight * iItems + fBorder * 2;
CFX_RectF rtList(m_rtClient.left, 0, m_pProperties->m_rtWidget.width, 0);
GetPopupPos(fPopupMin, fPopupMax, m_pProperties->m_rtWidget, rtList);
@@ -666,8 +666,8 @@ void CFWL_ComboBox::DisForm_Layout() {
if (!theme)
return;
- FX_FLOAT borderWidth = 1;
- FX_FLOAT fBtn = theme->GetScrollBarWidth();
+ float borderWidth = 1;
+ float fBtn = theme->GetScrollBarWidth();
if (!(GetStylesEx() & FWL_STYLEEXT_CMB_ReadOnly)) {
m_rtBtn =
CFX_RectF(m_rtClient.right() - fBtn, m_rtClient.top + borderWidth,
diff --git a/chromium/third_party/pdfium/xfa/fwl/cfwl_datetimepicker.cpp b/chromium/third_party/pdfium/xfa/fwl/cfwl_datetimepicker.cpp
index a6ba65a3b21..e1d3a748d6c 100644
--- a/chromium/third_party/pdfium/xfa/fwl/cfwl_datetimepicker.cpp
+++ b/chromium/third_party/pdfium/xfa/fwl/cfwl_datetimepicker.cpp
@@ -81,7 +81,7 @@ void CFWL_DateTimePicker::Update() {
if (!theme)
return;
- FX_FLOAT fBtn = theme->GetScrollBarWidth();
+ float fBtn = theme->GetScrollBarWidth();
m_rtBtn = CFX_RectF(m_rtClient.right() - fBtn, m_rtClient.top, fBtn - 1,
m_rtClient.height - 1);
@@ -349,8 +349,8 @@ void CFWL_DateTimePicker::DisForm_ShowMonthCalendar(bool bActivate) {
if (bActivate) {
CFX_RectF rtMonthCal = m_pMonthCal->GetAutosizedWidgetRect();
- FX_FLOAT fPopupMin = rtMonthCal.height;
- FX_FLOAT fPopupMax = rtMonthCal.height;
+ float fPopupMin = rtMonthCal.height;
+ float fPopupMax = rtMonthCal.height;
CFX_RectF rtAnchor(m_pProperties->m_rtWidget);
rtAnchor.width = rtMonthCal.width;
rtMonthCal.left = m_rtClient.left;
diff --git a/chromium/third_party/pdfium/xfa/fwl/cfwl_datetimepicker.h b/chromium/third_party/pdfium/xfa/fwl/cfwl_datetimepicker.h
index 2935ee8b1c8..0f086d6b329 100644
--- a/chromium/third_party/pdfium/xfa/fwl/cfwl_datetimepicker.h
+++ b/chromium/third_party/pdfium/xfa/fwl/cfwl_datetimepicker.h
@@ -101,7 +101,7 @@ class CFWL_DateTimePicker : public CFWL_Widget {
std::unique_ptr<CFWL_DateTimeEdit> m_pEdit;
std::unique_ptr<CFWL_MonthCalendar> m_pMonthCal;
std::unique_ptr<CFWL_FormProxy> m_pForm;
- FX_FLOAT m_fBtn;
+ float m_fBtn;
};
#endif // XFA_FWL_CFWL_DATETIMEPICKER_H_
diff --git a/chromium/third_party/pdfium/xfa/fwl/cfwl_edit.cpp b/chromium/third_party/pdfium/xfa/fwl/cfwl_edit.cpp
index d36e28ab56d..1b76ec62403 100644
--- a/chromium/third_party/pdfium/xfa/fwl/cfwl_edit.cpp
+++ b/chromium/third_party/pdfium/xfa/fwl/cfwl_edit.cpp
@@ -13,10 +13,10 @@
#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
+#include "xfa/fde/cfde_rendercontext.h"
+#include "xfa/fde/cfde_renderdevice.h"
#include "xfa/fde/cfde_txtedtengine.h"
-#include "xfa/fde/fde_gedevice.h"
-#include "xfa/fde/fde_render.h"
-#include "xfa/fde/ifde_txtedtpage.h"
+#include "xfa/fde/cfde_txtedtpage.h"
#include "xfa/fgas/font/cfgas_gefont.h"
#include "xfa/fwl/cfwl_app.h"
#include "xfa/fwl/cfwl_caret.h"
@@ -30,28 +30,28 @@
#include "xfa/fwl/cfwl_themepart.h"
#include "xfa/fwl/cfwl_widgetmgr.h"
#include "xfa/fwl/ifwl_themeprovider.h"
-#include "xfa/fxfa/xfa_ffdoc.h"
-#include "xfa/fxfa/xfa_ffwidget.h"
+#include "xfa/fxfa/cxfa_ffdoc.h"
+#include "xfa/fxfa/cxfa_ffwidget.h"
#include "xfa/fxgraphics/cfx_path.h"
namespace {
const int kEditMargin = 3;
-bool FX_EDIT_ISLATINWORD(FX_WCHAR c) {
+bool FX_EDIT_ISLATINWORD(wchar_t c) {
return c == 0x2D || (c <= 0x005A && c >= 0x0041) ||
(c <= 0x007A && c >= 0x0061) || (c <= 0x02AF && c >= 0x00C0) ||
c == 0x0027;
}
void AddSquigglyPath(CFX_Path* pPathData,
- FX_FLOAT fStartX,
- FX_FLOAT fEndX,
- FX_FLOAT fY,
- FX_FLOAT fStep) {
+ float fStartX,
+ float fEndX,
+ float fY,
+ float fStep) {
pPathData->MoveTo(CFX_PointF(fStartX, fY));
int i = 1;
- for (FX_FLOAT fx = fStartX + fStep; fx < fEndX; fx += fStep, ++i)
+ for (float fx = fStartX + fStep; fx < fEndX; fx += fStep, ++i)
pPathData->LineTo(CFX_PointF(fx, fY + (i & 1) * fStep));
}
@@ -161,16 +161,16 @@ FWL_WidgetHit CFWL_Edit::HitTest(const CFX_PointF& point) {
void CFWL_Edit::AddSpellCheckObj(CFX_Path& PathData,
int32_t nStart,
int32_t nCount,
- FX_FLOAT fOffSetX,
- FX_FLOAT fOffSetY) {
- FX_FLOAT fStartX = 0.0f;
- FX_FLOAT fEndX = 0.0f;
- FX_FLOAT fY = 0.0f;
- FX_FLOAT fStep = 0.0f;
- IFDE_TxtEdtPage* pPage = m_EdtEngine.GetPage(0);
+ float fOffSetX,
+ float fOffSetY) {
+ float fStartX = 0.0f;
+ float fEndX = 0.0f;
+ float fY = 0.0f;
+ float fStep = 0.0f;
+ CFDE_TxtEdtPage* pPage = m_EdtEngine.GetPage(0);
const FDE_TXTEDTPARAMS* txtEdtParams = m_EdtEngine.GetEditParams();
- FX_FLOAT fAsent = static_cast<FX_FLOAT>(txtEdtParams->pFont->GetAscent()) *
- txtEdtParams->fFontSize / 1000;
+ float fAsent = static_cast<float>(txtEdtParams->pFont->GetAscent()) *
+ txtEdtParams->fFontSize / 1000;
std::vector<CFX_RectF> rectArray;
pPage->CalcRangeRectArray(nStart, nCount, &rectArray);
@@ -195,15 +195,15 @@ void CFWL_Edit::DrawSpellCheck(CFX_Graphics* pGraphics,
CFX_ByteString sLatinWord;
CFX_Path pathSpell;
int32_t nStart = 0;
- FX_FLOAT fOffSetX = m_rtEngine.left - m_fScrollOffsetX;
- FX_FLOAT fOffSetY = m_rtEngine.top - m_fScrollOffsetY + m_fVAlignOffset;
+ float fOffSetX = m_rtEngine.left - m_fScrollOffsetX;
+ float fOffSetY = m_rtEngine.top - m_fScrollOffsetY + m_fVAlignOffset;
CFX_WideString wsSpell = GetText();
int32_t nContentLen = wsSpell.GetLength();
for (int i = 0; i < nContentLen; i++) {
if (FX_EDIT_ISLATINWORD(wsSpell[i])) {
if (sLatinWord.IsEmpty())
nStart = i;
- sLatinWord += (FX_CHAR)wsSpell[i];
+ sLatinWord += (char)wsSpell[i];
continue;
}
checkWordEvent.bsWord = sLatinWord;
@@ -314,7 +314,7 @@ void CFWL_Edit::SetLimit(int32_t nLimit) {
m_EdtEngine.SetLimit(nLimit);
}
-void CFWL_Edit::SetAliasChar(FX_WCHAR wAlias) {
+void CFWL_Edit::SetAliasChar(wchar_t wAlias) {
m_EdtEngine.SetAliasChar(wAlias);
}
@@ -435,7 +435,7 @@ void CFWL_Edit::OnSelChanged() {
}
bool CFWL_Edit::OnPageLoad(int32_t nPageIndex) {
- IFDE_TxtEdtPage* pPage = m_EdtEngine.GetPage(nPageIndex);
+ CFDE_TxtEdtPage* pPage = m_EdtEngine.GetPage(nPageIndex);
if (!pPage)
return false;
@@ -444,7 +444,7 @@ bool CFWL_Edit::OnPageLoad(int32_t nPageIndex) {
}
bool CFWL_Edit::OnPageUnload(int32_t nPageIndex) {
- IFDE_TxtEdtPage* pPage = m_EdtEngine.GetPage(nPageIndex);
+ CFDE_TxtEdtPage* pPage = m_EdtEngine.GetPage(nPageIndex);
if (!pPage)
return false;
@@ -468,7 +468,7 @@ bool CFWL_Edit::OnValidate(const CFX_WideString& wsText) {
return event.bValidate;
}
-void CFWL_Edit::SetScrollOffset(FX_FLOAT fScrollOffset) {
+void CFWL_Edit::SetScrollOffset(float fScrollOffset) {
m_fScrollOffsetY = fScrollOffset;
}
@@ -507,7 +507,7 @@ void CFWL_Edit::DrawTextBk(CFX_Graphics* pGraphics,
void CFWL_Edit::DrawContent(CFX_Graphics* pGraphics,
IFWL_ThemeProvider* pTheme,
const CFX_Matrix* pMatrix) {
- IFDE_TxtEdtPage* pPage = m_EdtEngine.GetPage(0);
+ CFDE_TxtEdtPage* pPage = m_EdtEngine.GetPage(0);
if (!pPage)
return;
@@ -516,8 +516,8 @@ void CFWL_Edit::DrawContent(CFX_Graphics* pGraphics,
pGraphics->SaveGraphState();
CFX_RectF rtClip = m_rtEngine;
- FX_FLOAT fOffSetX = m_rtEngine.left - m_fScrollOffsetX;
- FX_FLOAT fOffSetY = m_rtEngine.top - m_fScrollOffsetY + m_fVAlignOffset;
+ float fOffSetX = m_rtEngine.left - m_fScrollOffsetX;
+ float fOffSetY = m_rtEngine.top - m_fScrollOffsetY + m_fVAlignOffset;
CFX_Matrix mt(1, 0, 0, 1, fOffSetX, fOffSetY);
if (pMatrix) {
pMatrix->TransformRect(rtClip);
@@ -566,9 +566,8 @@ void CFWL_Edit::DrawContent(CFX_Graphics* pGraphics,
if (!pRenderDev)
return;
- std::unique_ptr<CFDE_RenderDevice> pRenderDevice(
- new CFDE_RenderDevice(pRenderDev, false));
- std::unique_ptr<CFDE_RenderContext> pRenderContext(new CFDE_RenderContext);
+ auto pRenderDevice = pdfium::MakeUnique<CFDE_RenderDevice>(pRenderDev, false);
+ auto pRenderContext = pdfium::MakeUnique<CFDE_RenderContext>();
pRenderDevice->SetClipRect(rtClip);
pRenderContext->StartRender(pRenderDevice.get(), pPage, mt);
pRenderContext->DoRender(nullptr);
@@ -577,8 +576,8 @@ void CFWL_Edit::DrawContent(CFX_Graphics* pGraphics,
pGraphics->RestoreGraphState();
CFX_Path path;
int32_t iLimit = m_nLimit > 0 ? m_nLimit : 1;
- FX_FLOAT fStep = m_rtEngine.width / iLimit;
- FX_FLOAT fLeft = m_rtEngine.left + 1;
+ float fStep = m_rtEngine.width / iLimit;
+ float fLeft = m_rtEngine.left + 1;
for (int32_t i = 1; i < iLimit; i++) {
fLeft += fStep;
path.AddLine(CFX_PointF(fLeft, m_rtClient.top),
@@ -685,9 +684,7 @@ void CFWL_Edit::UpdateEditParams() {
if (params.nLineCount <= 0)
params.nLineCount = 1;
params.fTabWidth = params.fFontSize * 1;
- params.bTabEquidistant = true;
params.wLineBreakChar = L'\n';
- params.nCharRotation = 0;
params.pEventSink = this;
m_EdtEngine.SetEditParams(params);
}
@@ -696,7 +693,7 @@ void CFWL_Edit::UpdateEditLayout() {
if (m_EdtEngine.GetTextLength() <= 0)
m_EdtEngine.SetTextByStream(nullptr);
- IFDE_TxtEdtPage* pPage = m_EdtEngine.GetPage(0);
+ CFDE_TxtEdtPage* pPage = m_EdtEngine.GetPage(0);
if (pPage)
pPage->UnloadPage(nullptr);
@@ -711,12 +708,12 @@ void CFWL_Edit::UpdateEditLayout() {
bool CFWL_Edit::UpdateOffset() {
CFX_RectF rtCaret;
m_EdtEngine.GetCaretRect(rtCaret);
- FX_FLOAT fOffSetX = m_rtEngine.left - m_fScrollOffsetX;
- FX_FLOAT fOffSetY = m_rtEngine.top - m_fScrollOffsetY + m_fVAlignOffset;
+ float fOffSetX = m_rtEngine.left - m_fScrollOffsetX;
+ float fOffSetY = m_rtEngine.top - m_fScrollOffsetY + m_fVAlignOffset;
rtCaret.Offset(fOffSetX, fOffSetY);
const CFX_RectF& rtEidt = m_rtEngine;
if (rtEidt.Contains(rtCaret)) {
- IFDE_TxtEdtPage* pPage = m_EdtEngine.GetPage(0);
+ CFDE_TxtEdtPage* pPage = m_EdtEngine.GetPage(0);
if (!pPage)
return false;
@@ -733,8 +730,8 @@ bool CFWL_Edit::UpdateOffset() {
return false;
}
- FX_FLOAT offsetX = 0.0;
- FX_FLOAT offsetY = 0.0;
+ float offsetX = 0.0;
+ float offsetY = 0.0;
if (rtCaret.left < rtEidt.left)
offsetX = rtCaret.left - rtEidt.left;
if (rtCaret.right() > rtEidt.right())
@@ -750,7 +747,7 @@ bool CFWL_Edit::UpdateOffset() {
return true;
}
-bool CFWL_Edit::UpdateOffset(CFWL_ScrollBar* pScrollBar, FX_FLOAT fPosChanged) {
+bool CFWL_Edit::UpdateOffset(CFWL_ScrollBar* pScrollBar, float fPosChanged) {
if (pScrollBar == m_pHorzScrollBar.get())
m_fScrollOffsetX += fPosChanged;
else
@@ -759,14 +756,14 @@ bool CFWL_Edit::UpdateOffset(CFWL_ScrollBar* pScrollBar, FX_FLOAT fPosChanged) {
}
void CFWL_Edit::UpdateVAlignment() {
- IFDE_TxtEdtPage* pPage = m_EdtEngine.GetPage(0);
+ CFDE_TxtEdtPage* pPage = m_EdtEngine.GetPage(0);
if (!pPage)
return;
const CFX_RectF& rtFDE = pPage->GetContentsBox();
- FX_FLOAT fOffsetY = 0.0f;
- FX_FLOAT fSpaceAbove = 0.0f;
- FX_FLOAT fSpaceBelow = 0.0f;
+ float fOffsetY = 0.0f;
+ float fSpaceAbove = 0.0f;
+ float fSpaceBelow = 0.0f;
IFWL_ThemeProvider* theme = GetAvailableTheme();
if (theme) {
CFWL_ThemePart part;
@@ -808,7 +805,7 @@ void CFWL_Edit::UpdateCaret() {
CFX_RectF rtClient = GetClientRect();
rtCaret.Intersect(rtClient);
if (rtCaret.left > rtClient.right()) {
- FX_FLOAT right = rtCaret.right();
+ float right = rtCaret.right();
rtCaret.left = rtClient.right() - 1;
rtCaret.width = right - rtCaret.left;
}
@@ -829,7 +826,7 @@ CFWL_ScrollBar* CFWL_Edit::UpdateScroll() {
if (!bShowHorz && !bShowVert)
return nullptr;
- IFDE_TxtEdtPage* pPage = m_EdtEngine.GetPage(0);
+ CFDE_TxtEdtPage* pPage = m_EdtEngine.GetPage(0);
if (!pPage)
return nullptr;
@@ -839,10 +836,10 @@ CFWL_ScrollBar* CFWL_Edit::UpdateScroll() {
CFX_RectF rtScroll = m_pHorzScrollBar->GetWidgetRect();
if (rtScroll.width < rtFDE.width) {
m_pHorzScrollBar->LockUpdate();
- FX_FLOAT fRange = rtFDE.width - rtScroll.width;
+ float fRange = rtFDE.width - rtScroll.width;
m_pHorzScrollBar->SetRange(0.0f, fRange);
- FX_FLOAT fPos = std::min(std::max(m_fScrollOffsetX, 0.0f), fRange);
+ float fPos = pdfium::clamp(m_fScrollOffsetX, 0.0f, fRange);
m_pHorzScrollBar->SetPos(fPos);
m_pHorzScrollBar->SetTrackPos(fPos);
m_pHorzScrollBar->SetPageSize(rtScroll.width);
@@ -865,11 +862,11 @@ CFWL_ScrollBar* CFWL_Edit::UpdateScroll() {
CFX_RectF rtScroll = m_pVertScrollBar->GetWidgetRect();
if (rtScroll.height < rtFDE.height) {
m_pVertScrollBar->LockUpdate();
- FX_FLOAT fStep = m_EdtEngine.GetEditParams()->fLineSpace;
- FX_FLOAT fRange = std::max(rtFDE.height - m_rtEngine.height, fStep);
+ float fStep = m_EdtEngine.GetEditParams()->fLineSpace;
+ float fRange = std::max(rtFDE.height - m_rtEngine.height, fStep);
m_pVertScrollBar->SetRange(0.0f, fRange);
- FX_FLOAT fPos = std::min(std::max(m_fScrollOffsetY, 0.0f), fRange);
+ float fPos = pdfium::clamp(m_fScrollOffsetY, 0.0f, fRange);
m_pVertScrollBar->SetPos(fPos);
m_pVertScrollBar->SetTrackPos(fPos);
m_pVertScrollBar->SetPageSize(rtScroll.height);
@@ -891,21 +888,20 @@ CFWL_ScrollBar* CFWL_Edit::UpdateScroll() {
}
bool CFWL_Edit::IsShowScrollBar(bool bVert) {
+ if (!bVert)
+ return false;
bool bShow =
(m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_ShowScrollbarFocus)
? (m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) ==
FWL_WGTSTATE_Focused
: true;
- if (bVert) {
- return bShow && (m_pProperties->m_dwStyles & FWL_WGTSTYLE_VScroll) &&
- (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_MultiLine) &&
- IsContentHeightOverflow();
- }
- return false;
+ return bShow && (m_pProperties->m_dwStyles & FWL_WGTSTYLE_VScroll) &&
+ (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_MultiLine) &&
+ IsContentHeightOverflow();
}
bool CFWL_Edit::IsContentHeightOverflow() {
- IFDE_TxtEdtPage* pPage = m_EdtEngine.GetPage(0);
+ CFDE_TxtEdtPage* pPage = m_EdtEngine.GetPage(0);
if (!pPage)
return false;
return pPage->GetContentsBox().height > m_rtEngine.height + 1.0f;
@@ -935,7 +931,7 @@ void CFWL_Edit::Layout() {
if (!theme)
return;
- FX_FLOAT fWidth = theme->GetScrollBarWidth();
+ float fWidth = theme->GetScrollBarWidth();
CFWL_ThemePart part;
if (!m_pOuter) {
part.m_pWidget = this;
@@ -1005,7 +1001,7 @@ void CFWL_Edit::LayoutScrollBar() {
bool bShowHorzScrollbar = IsShowScrollBar(false);
IFWL_ThemeProvider* theme = GetAvailableTheme();
- FX_FLOAT fWidth = theme ? theme->GetScrollBarWidth() : 0;
+ float fWidth = theme ? theme->GetScrollBarWidth() : 0;
if (bShowVertScrollbar) {
if (!m_pVertScrollBar) {
InitVerticalScrollBar();
@@ -1138,7 +1134,7 @@ void CFWL_Edit::HideCaret(CFX_RectF* pRect) {
pDocEnvironment->DisplayCaret(pXFAWidget, false, pRect);
}
-bool CFWL_Edit::ValidateNumberChar(FX_WCHAR cNum) {
+bool CFWL_Edit::ValidateNumberChar(wchar_t cNum) {
if (!m_bSetRange)
return true;
@@ -1259,7 +1255,7 @@ void CFWL_Edit::DoButtonDown(CFWL_MessageMouse* pMsg) {
if ((m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) == 0)
SetFocus(true);
- IFDE_TxtEdtPage* pPage = m_EdtEngine.GetPage(0);
+ CFDE_TxtEdtPage* pPage = m_EdtEngine.GetPage(0);
if (!pPage)
return;
@@ -1335,7 +1331,7 @@ void CFWL_Edit::OnLButtonUp(CFWL_MessageMouse* pMsg) {
}
void CFWL_Edit::OnButtonDblClk(CFWL_MessageMouse* pMsg) {
- IFDE_TxtEdtPage* pPage = m_EdtEngine.GetPage(0);
+ CFDE_TxtEdtPage* pPage = m_EdtEngine.GetPage(0);
if (!pPage)
return;
@@ -1353,7 +1349,7 @@ void CFWL_Edit::OnMouseMove(CFWL_MessageMouse* pMsg) {
if (m_nSelStart == -1 || !m_bLButtonDown)
return;
- IFDE_TxtEdtPage* pPage = m_EdtEngine.GetPage(0);
+ CFDE_TxtEdtPage* pPage = m_EdtEngine.GetPage(0);
if (!pPage)
return;
@@ -1371,7 +1367,7 @@ void CFWL_Edit::OnMouseMove(CFWL_MessageMouse* pMsg) {
m_nSelStart = nLen;
m_EdtEngine.AddSelRange(std::min(m_nSelStart, nIndex),
- FXSYS_abs(nIndex - m_nSelStart));
+ abs(nIndex - m_nSelStart));
}
void CFWL_Edit::OnKeyDown(CFWL_MessageKey* pMsg) {
@@ -1435,7 +1431,7 @@ void CFWL_Edit::OnChar(CFWL_MessageKey* pMsg) {
}
int32_t iError = 0;
- FX_WCHAR c = static_cast<FX_WCHAR>(pMsg->m_dwKeyCode);
+ wchar_t c = static_cast<wchar_t>(pMsg->m_dwKeyCode);
int32_t nCaret = m_EdtEngine.GetCaretPos();
switch (c) {
case FWL_VKEY_Back:
@@ -1484,11 +1480,11 @@ void CFWL_Edit::OnChar(CFWL_MessageKey* pMsg) {
bool CFWL_Edit::OnScroll(CFWL_ScrollBar* pScrollBar,
CFWL_EventScroll::Code dwCode,
- FX_FLOAT fPos) {
+ float fPos) {
CFX_SizeF fs;
pScrollBar->GetRange(&fs.width, &fs.height);
- FX_FLOAT iCurPos = pScrollBar->GetPos();
- FX_FLOAT fStep = pScrollBar->GetStepSize();
+ float iCurPos = pScrollBar->GetPos();
+ float fStep = pScrollBar->GetStepSize();
switch (dwCode) {
case CFWL_EventScroll::Code::Min: {
fPos = fs.width;
diff --git a/chromium/third_party/pdfium/xfa/fwl/cfwl_edit.h b/chromium/third_party/pdfium/xfa/fwl/cfwl_edit.h
index 154e286331f..0dbbcd6eefa 100644
--- a/chromium/third_party/pdfium/xfa/fwl/cfwl_edit.h
+++ b/chromium/third_party/pdfium/xfa/fwl/cfwl_edit.h
@@ -80,7 +80,7 @@ class CFWL_Edit : public CFWL_Widget {
void ClearSelections();
int32_t GetLimit() const;
void SetLimit(int32_t nLimit);
- void SetAliasChar(FX_WCHAR wAlias);
+ void SetAliasChar(wchar_t wAlias);
bool Copy(CFX_WideString& wsCopy);
bool Cut(CFX_WideString& wsCut);
bool Paste(const CFX_WideString& wsPaste);
@@ -100,7 +100,7 @@ class CFWL_Edit : public CFWL_Widget {
bool OnPageUnload(int32_t nPageIndex);
void OnAddDoRecord(std::unique_ptr<IFDE_TxtEdtDoRecord> pRecord);
bool OnValidate(const CFX_WideString& wsText);
- void SetScrollOffset(FX_FLOAT fScrollOffset);
+ void SetScrollOffset(float fScrollOffset);
protected:
void ShowCaret(CFX_RectF* pRect);
@@ -121,7 +121,7 @@ class CFWL_Edit : public CFWL_Widget {
void UpdateEditParams();
void UpdateEditLayout();
bool UpdateOffset();
- bool UpdateOffset(CFWL_ScrollBar* pScrollBar, FX_FLOAT fPosChanged);
+ bool UpdateOffset(CFWL_ScrollBar* pScrollBar, float fPosChanged);
void UpdateVAlignment();
void UpdateCaret();
CFWL_ScrollBar* UpdateScroll();
@@ -132,7 +132,7 @@ class CFWL_Edit : public CFWL_Widget {
void InitHorizontalScrollBar();
void InitEngine();
void InitCaret();
- bool ValidateNumberChar(FX_WCHAR cNum);
+ bool ValidateNumberChar(wchar_t cNum);
void ClearRecord();
bool IsShowScrollBar(bool bVert);
bool IsContentHeightOverflow();
@@ -141,8 +141,8 @@ class CFWL_Edit : public CFWL_Widget {
void AddSpellCheckObj(CFX_Path& PathData,
int32_t nStart,
int32_t nCount,
- FX_FLOAT fOffSetX,
- FX_FLOAT fOffSetY);
+ float fOffSetX,
+ float fOffSetY);
void DoButtonDown(CFWL_MessageMouse* pMsg);
void OnFocusChanged(CFWL_Message* pMsg, bool bSet);
@@ -154,19 +154,19 @@ class CFWL_Edit : public CFWL_Widget {
void OnChar(CFWL_MessageKey* pMsg);
bool OnScroll(CFWL_ScrollBar* pScrollBar,
CFWL_EventScroll::Code dwCode,
- FX_FLOAT fPos);
+ float fPos);
CFX_RectF m_rtClient;
CFX_RectF m_rtEngine;
CFX_RectF m_rtStatic;
- FX_FLOAT m_fVAlignOffset;
- FX_FLOAT m_fScrollOffsetX;
- FX_FLOAT m_fScrollOffsetY;
+ float m_fVAlignOffset;
+ float m_fScrollOffsetX;
+ float m_fScrollOffsetY;
CFDE_TxtEdtEngine m_EdtEngine;
bool m_bLButtonDown;
int32_t m_nSelStart;
int32_t m_nLimit;
- FX_FLOAT m_fFontSize;
+ float m_fFontSize;
bool m_bSetRange;
int32_t m_iMax;
std::unique_ptr<CFWL_ScrollBar> m_pVertScrollBar;
diff --git a/chromium/third_party/pdfium/xfa/fwl/cfwl_eventscroll.h b/chromium/third_party/pdfium/xfa/fwl/cfwl_eventscroll.h
index 2fdef9e7b17..a13eeef0201 100644
--- a/chromium/third_party/pdfium/xfa/fwl/cfwl_eventscroll.h
+++ b/chromium/third_party/pdfium/xfa/fwl/cfwl_eventscroll.h
@@ -28,7 +28,7 @@ class CFWL_EventScroll : public CFWL_Event {
~CFWL_EventScroll() override;
Code m_iScrollCode;
- FX_FLOAT m_fPos;
+ float m_fPos;
};
#endif // XFA_FWL_CFWL_EVENTSCROLL_H_
diff --git a/chromium/third_party/pdfium/xfa/fwl/cfwl_form.cpp b/chromium/third_party/pdfium/xfa/fwl/cfwl_form.cpp
index 5e956ade2d0..3e606b3eb93 100644
--- a/chromium/third_party/pdfium/xfa/fwl/cfwl_form.cpp
+++ b/chromium/third_party/pdfium/xfa/fwl/cfwl_form.cpp
@@ -9,7 +9,7 @@
#include <utility>
#include "third_party/base/ptr_util.h"
-#include "xfa/fde/tto/fde_textout.h"
+#include "xfa/fde/cfde_textout.h"
#include "xfa/fwl/cfwl_app.h"
#include "xfa/fwl/cfwl_event.h"
#include "xfa/fwl/cfwl_formproxy.h"
@@ -161,8 +161,8 @@ void CFWL_Form::DrawBackground(CFX_Graphics* pGraphics,
CFX_RectF CFWL_Form::GetEdgeRect() {
CFX_RectF rtEdge = m_rtRelative;
if (m_pProperties->m_dwStyles & FWL_WGTSTYLE_Border) {
- FX_FLOAT fCX = GetBorderSize(true);
- FX_FLOAT fCY = GetBorderSize(false);
+ float fCX = GetBorderSize(true);
+ float fCY = GetBorderSize(false);
rtEdge.Deflate(fCX, fCY, fCX, fCY);
}
return rtEdge;
diff --git a/chromium/third_party/pdfium/xfa/fwl/cfwl_form.h b/chromium/third_party/pdfium/xfa/fwl/cfwl_form.h
index 7202cb279b2..ec7fc137beb 100644
--- a/chromium/third_party/pdfium/xfa/fwl/cfwl_form.h
+++ b/chromium/third_party/pdfium/xfa/fwl/cfwl_form.h
@@ -63,8 +63,8 @@ class CFWL_Form : public CFWL_Widget {
CFX_RectF m_rtRelative;
std::unique_ptr<CFWL_NoteLoop> m_pNoteLoop;
CFWL_Widget* m_pSubFocus;
- FX_FLOAT m_fCXBorder;
- FX_FLOAT m_fCYBorder;
+ float m_fCXBorder;
+ float m_fCYBorder;
};
#endif // XFA_FWL_CFWL_FORM_H_
diff --git a/chromium/third_party/pdfium/xfa/fwl/cfwl_listbox.cpp b/chromium/third_party/pdfium/xfa/fwl/cfwl_listbox.cpp
index 0b827099723..9d9bf72f4ce 100644
--- a/chromium/third_party/pdfium/xfa/fwl/cfwl_listbox.cpp
+++ b/chromium/third_party/pdfium/xfa/fwl/cfwl_listbox.cpp
@@ -12,7 +12,7 @@
#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
-#include "xfa/fde/tto/fde_textout.h"
+#include "xfa/fde/cfde_textout.h"
#include "xfa/fwl/cfwl_app.h"
#include "xfa/fwl/cfwl_messagekey.h"
#include "xfa/fwl/cfwl_messagemouse.h"
@@ -306,11 +306,11 @@ void CFWL_ListBox::SetFocusItem(CFWL_ListItem* pItem) {
CFWL_ListItem* CFWL_ListBox::GetItemAtPoint(const CFX_PointF& point) {
CFX_PointF pos = point - m_rtConent.TopLeft();
- FX_FLOAT fPosX = 0.0f;
+ float fPosX = 0.0f;
if (m_pHorzScrollBar)
fPosX = m_pHorzScrollBar->GetPos();
- FX_FLOAT fPosY = 0.0;
+ float fPosY = 0.0;
if (m_pVertScrollBar)
fPosY = m_pVertScrollBar->GetPos();
@@ -334,7 +334,7 @@ bool CFWL_ListBox::ScrollToVisible(CFWL_ListItem* pItem) {
CFX_RectF rtItem = pItem ? pItem->GetRect() : CFX_RectF();
bool bScroll = false;
- FX_FLOAT fPosY = m_pVertScrollBar->GetPos();
+ float fPosY = m_pVertScrollBar->GetPos();
rtItem.Offset(0, -fPosY + m_rtConent.top);
if (rtItem.top < m_rtConent.top) {
fPosY += rtItem.top - m_rtConent.top;
@@ -378,11 +378,11 @@ void CFWL_ListBox::DrawBkground(CFX_Graphics* pGraphics,
void CFWL_ListBox::DrawItems(CFX_Graphics* pGraphics,
IFWL_ThemeProvider* pTheme,
const CFX_Matrix* pMatrix) {
- FX_FLOAT fPosX = 0.0f;
+ float fPosX = 0.0f;
if (m_pHorzScrollBar)
fPosX = m_pHorzScrollBar->GetPos();
- FX_FLOAT fPosY = 0.0f;
+ float fPosY = 0.0f;
if (m_pVertScrollBar)
fPosY = m_pVertScrollBar->GetPos();
@@ -484,11 +484,10 @@ CFX_SizeF CFWL_ListBox::CalcSize(bool bAutoSize) {
pUIMargin.height);
}
- FX_FLOAT fWidth = GetMaxTextWidth();
+ float fWidth = GetMaxTextWidth();
fWidth += 2 * kItemTextMargin;
if (!bAutoSize) {
- FX_FLOAT fActualWidth =
- m_rtClient.width - rtUIMargin.left - rtUIMargin.width;
+ float fActualWidth = m_rtClient.width - rtUIMargin.left - rtUIMargin.width;
fWidth = std::max(fWidth, fActualWidth);
}
m_fItemHeight = CalcItemHeight();
@@ -502,7 +501,7 @@ CFX_SizeF CFWL_ListBox::CalcSize(bool bAutoSize) {
if (bAutoSize)
return fs;
- FX_FLOAT iHeight = m_rtClient.height;
+ float iHeight = m_rtClient.height;
bool bShowVertScr = false;
bool bShowHorzScr = false;
if (!bShowVertScr && (m_pProperties->m_dwStyles & FWL_WGTSTYLE_VScroll))
@@ -527,8 +526,8 @@ CFX_SizeF CFWL_ListBox::CalcSize(bool bAutoSize) {
m_pVertScrollBar->SetPageSize(rtScrollBar.height * 9 / 10);
m_pVertScrollBar->SetStepSize(m_fItemHeight);
- FX_FLOAT fPos =
- std::min(std::max(m_pVertScrollBar->GetPos(), 0.f), szRange.height);
+ float fPos =
+ pdfium::clamp(m_pVertScrollBar->GetPos(), 0.0f, szRange.height);
m_pVertScrollBar->SetPos(fPos);
m_pVertScrollBar->SetTrackPos(fPos);
if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_ShowScrollBarFocus) ==
@@ -559,8 +558,8 @@ CFX_SizeF CFWL_ListBox::CalcSize(bool bAutoSize) {
m_pHorzScrollBar->SetPageSize(fWidth * 9 / 10);
m_pHorzScrollBar->SetStepSize(fWidth / 10);
- FX_FLOAT fPos =
- std::min(std::max(m_pHorzScrollBar->GetPos(), 0.f), szRange.height);
+ float fPos =
+ pdfium::clamp(m_pHorzScrollBar->GetPos(), 0.0f, szRange.height);
m_pHorzScrollBar->SetPos(fPos);
m_pHorzScrollBar->SetTrackPos(fPos);
if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_ShowScrollBarFocus) ==
@@ -584,8 +583,8 @@ CFX_SizeF CFWL_ListBox::CalcSize(bool bAutoSize) {
void CFWL_ListBox::UpdateItemSize(CFWL_ListItem* pItem,
CFX_SizeF& size,
- FX_FLOAT fWidth,
- FX_FLOAT fItemHeight,
+ float fWidth,
+ float fItemHeight,
bool bAutoSize) const {
if (!bAutoSize && pItem) {
CFX_RectF rtItem(0, size.height, fWidth, fItemHeight);
@@ -595,8 +594,8 @@ void CFWL_ListBox::UpdateItemSize(CFWL_ListItem* pItem,
size.height += fItemHeight;
}
-FX_FLOAT CFWL_ListBox::GetMaxTextWidth() {
- FX_FLOAT fRet = 0.0f;
+float CFWL_ListBox::GetMaxTextWidth() {
+ float fRet = 0.0f;
int32_t iCount = CountItems(this);
for (int32_t i = 0; i < iCount; i++) {
CFWL_ListItem* pItem = GetItem(this, i);
@@ -610,12 +609,12 @@ FX_FLOAT CFWL_ListBox::GetMaxTextWidth() {
return fRet;
}
-FX_FLOAT CFWL_ListBox::GetScrollWidth() {
+float CFWL_ListBox::GetScrollWidth() {
IFWL_ThemeProvider* theme = GetAvailableTheme();
return theme ? theme->GetScrollBarWidth() : 0.0f;
}
-FX_FLOAT CFWL_ListBox::CalcItemHeight() {
+float CFWL_ListBox::CalcItemHeight() {
IFWL_ThemeProvider* theme = GetAvailableTheme();
CFWL_ThemePart part;
part.m_pWidget = this;
@@ -838,11 +837,11 @@ void CFWL_ListBox::OnVK(CFWL_ListItem* pItem, bool bShift, bool bCtrl) {
bool CFWL_ListBox::OnScroll(CFWL_ScrollBar* pScrollBar,
CFWL_EventScroll::Code dwCode,
- FX_FLOAT fPos) {
+ float fPos) {
CFX_SizeF fs;
pScrollBar->GetRange(&fs.width, &fs.height);
- FX_FLOAT iCurPos = pScrollBar->GetPos();
- FX_FLOAT fStep = pScrollBar->GetStepSize();
+ float iCurPos = pScrollBar->GetPos();
+ float fStep = pScrollBar->GetStepSize();
switch (dwCode) {
case CFWL_EventScroll::Code::Min: {
fPos = fs.width;
diff --git a/chromium/third_party/pdfium/xfa/fwl/cfwl_listbox.h b/chromium/third_party/pdfium/xfa/fwl/cfwl_listbox.h
index caa4f509f82..18aaf4cbd50 100644
--- a/chromium/third_party/pdfium/xfa/fwl/cfwl_listbox.h
+++ b/chromium/third_party/pdfium/xfa/fwl/cfwl_listbox.h
@@ -63,8 +63,8 @@ class CFWL_ListBox : public CFWL_Widget {
int32_t GetSelIndex(int32_t nIndex);
void SetSelItem(CFWL_ListItem* hItem, bool bSelect);
- FX_FLOAT GetItemHeight() const { return m_fItemHeight; }
- FX_FLOAT CalcItemHeight();
+ float GetItemHeight() const { return m_fItemHeight; }
+ float CalcItemHeight();
protected:
CFWL_ListItem* GetListItem(CFWL_ListItem* hItem, uint32_t dwKeyCode);
@@ -101,11 +101,11 @@ class CFWL_ListBox : public CFWL_Widget {
CFX_SizeF CalcSize(bool bAutoSize);
void UpdateItemSize(CFWL_ListItem* hItem,
CFX_SizeF& size,
- FX_FLOAT fWidth,
- FX_FLOAT fHeight,
+ float fWidth,
+ float fHeight,
bool bAutoSize) const;
- FX_FLOAT GetMaxTextWidth();
- FX_FLOAT GetScrollWidth();
+ float GetMaxTextWidth();
+ float GetScrollWidth();
void OnFocusChanged(CFWL_Message* pMsg, bool bSet);
void OnLButtonDown(CFWL_MessageMouse* pMsg);
@@ -115,7 +115,7 @@ class CFWL_ListBox : public CFWL_Widget {
void OnVK(CFWL_ListItem* hItem, bool bShift, bool bCtrl);
bool OnScroll(CFWL_ScrollBar* pScrollBar,
CFWL_EventScroll::Code dwCode,
- FX_FLOAT fPos);
+ float fPos);
CFX_RectF m_rtClient;
CFX_RectF m_rtStatic;
@@ -125,8 +125,8 @@ class CFWL_ListBox : public CFWL_Widget {
uint32_t m_dwTTOStyles;
int32_t m_iTTOAligns;
CFWL_ListItem* m_hAnchor;
- FX_FLOAT m_fItemHeight;
- FX_FLOAT m_fScorllBarWidth;
+ float m_fItemHeight;
+ float m_fScorllBarWidth;
bool m_bLButtonDown;
IFWL_ThemeProvider* m_pScrollBarTP;
std::vector<std::unique_ptr<CFWL_ListItem>> m_ItemArray;
diff --git a/chromium/third_party/pdfium/xfa/fwl/cfwl_monthcalendar.cpp b/chromium/third_party/pdfium/xfa/fwl/cfwl_monthcalendar.cpp
index 6882d709bfa..4ef0c694c55 100644
--- a/chromium/third_party/pdfium/xfa/fwl/cfwl_monthcalendar.cpp
+++ b/chromium/third_party/pdfium/xfa/fwl/cfwl_monthcalendar.cpp
@@ -12,7 +12,7 @@
#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
-#include "xfa/fde/tto/fde_textout.h"
+#include "xfa/fde/cfde_textout.h"
#include "xfa/fwl/cfwl_datetimepicker.h"
#include "xfa/fwl/cfwl_formproxy.h"
#include "xfa/fwl/cfwl_messagemouse.h"
@@ -90,7 +90,6 @@ CFWL_MonthCalendar::CFWL_MonthCalendar(
CFWL_Widget* pOuter)
: CFWL_Widget(app, std::move(properties), pOuter),
m_bInitialized(false),
- m_pDateTime(new CFX_DateTime),
m_iCurYear(2011),
m_iCurMonth(1),
m_iYear(2011),
@@ -415,8 +414,8 @@ CFX_SizeF CFWL_MonthCalendar::CalcSize() {
CFWL_ThemePart params;
params.m_pWidget = this;
IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider;
- FX_FLOAT fMaxWeekW = 0.0f;
- FX_FLOAT fMaxWeekH = 0.0f;
+ float fMaxWeekW = 0.0f;
+ float fMaxWeekH = 0.0f;
for (uint32_t i = 0; i < 7; ++i) {
CFX_SizeF sz = CalcTextSize(GetCapacityForDay(pTheme, params, i),
@@ -425,8 +424,8 @@ CFX_SizeF CFWL_MonthCalendar::CalcSize() {
fMaxWeekH = (fMaxWeekH >= sz.height) ? fMaxWeekH : sz.height;
}
- FX_FLOAT fDayMaxW = 0.0f;
- FX_FLOAT fDayMaxH = 0.0f;
+ float fDayMaxW = 0.0f;
+ float fDayMaxH = 0.0f;
for (int day = 10; day <= 31; day++) {
CFX_WideString wsDay;
wsDay.Format(L"%d", day);
@@ -434,16 +433,16 @@ CFX_SizeF CFWL_MonthCalendar::CalcSize() {
fDayMaxW = (fDayMaxW >= sz.width) ? fDayMaxW : sz.width;
fDayMaxH = (fDayMaxH >= sz.height) ? fDayMaxH : sz.height;
}
- m_szCell.width = FX_FLOAT((fMaxWeekW >= fDayMaxW) ? (int)(fMaxWeekW + 0.5)
- : (int)(fDayMaxW + 0.5));
+ m_szCell.width = float((fMaxWeekW >= fDayMaxW) ? (int)(fMaxWeekW + 0.5)
+ : (int)(fDayMaxW + 0.5));
m_szCell.height = (fMaxWeekH >= fDayMaxH) ? fMaxWeekH : fDayMaxH;
CFX_SizeF fs;
fs.width = m_szCell.width * MONTHCAL_COLUMNS +
MONTHCAL_HMARGIN * MONTHCAL_COLUMNS * 2 +
MONTHCAL_HEADER_BTN_HMARGIN * 2;
- FX_FLOAT fMonthMaxW = 0.0f;
- FX_FLOAT fMonthMaxH = 0.0f;
+ float fMonthMaxW = 0.0f;
+ float fMonthMaxH = 0.0f;
for (uint32_t i = 0; i < 12; ++i) {
CFX_SizeF sz = CalcTextSize(GetCapacityForMonth(pTheme, params, i),
@@ -472,8 +471,8 @@ CFX_SizeF CFWL_MonthCalendar::CalcSize() {
}
void CFWL_MonthCalendar::CalcHeadSize() {
- FX_FLOAT fHeadHMargin = (m_rtClient.width - m_szHead.width) / 2;
- FX_FLOAT fHeadVMargin = (m_szCell.width - m_szHead.height) / 2;
+ float fHeadHMargin = (m_rtClient.width - m_szHead.width) / 2;
+ float fHeadVMargin = (m_szCell.width - m_szHead.height) / 2;
m_rtHeadText = CFX_RectF(m_rtClient.left + fHeadHMargin,
m_rtClient.top + MONTHCAL_HEADER_BTN_VMARGIN +
MONTHCAL_VMARGIN + fHeadVMargin,
@@ -527,8 +526,8 @@ void CFWL_MonthCalendar::Layout() {
void CFWL_MonthCalendar::CalDateItem() {
bool bNewWeek = false;
int32_t iWeekOfMonth = 0;
- FX_FLOAT fLeft = m_rtDates.left;
- FX_FLOAT fTop = m_rtDates.top;
+ float fLeft = m_rtDates.left;
+ float fTop = m_rtDates.top;
for (const auto& pDateInfo : m_arrDates) {
if (bNewWeek) {
iWeekOfMonth++;
@@ -570,9 +569,9 @@ void CFWL_MonthCalendar::ClearDateItem() {
}
void CFWL_MonthCalendar::ResetDateItem() {
- m_pDateTime->Set(m_iCurYear, m_iCurMonth, 1);
int32_t iDays = FX_DaysInMonth(m_iCurYear, m_iCurMonth);
- int32_t iDayOfWeek = m_pDateTime->GetDayOfWeek();
+ int32_t iDayOfWeek =
+ CFX_DateTime(m_iCurYear, m_iCurMonth, 1, 0, 0, 0, 0).GetDayOfWeek();
for (int32_t i = 0; i < iDays; i++) {
if (iDayOfWeek >= 7)
iDayOfWeek = 0;
@@ -674,10 +673,10 @@ void CFWL_MonthCalendar::JumpToToday() {
CFX_WideString CFWL_MonthCalendar::GetHeadText(int32_t iYear, int32_t iMonth) {
ASSERT(iMonth > 0 && iMonth < 13);
- static const FX_WCHAR* const pMonth[] = {
- L"January", L"February", L"March", L"April",
- L"May", L"June", L"July", L"August",
- L"September", L"October", L"November", L"December"};
+ static const wchar_t* const pMonth[] = {L"January", L"February", L"March",
+ L"April", L"May", L"June",
+ L"July", L"August", L"September",
+ L"October", L"November", L"December"};
CFX_WideString wsHead;
wsHead.Format(L"%s, %d", pMonth[iMonth - 1], iYear);
return wsHead;
diff --git a/chromium/third_party/pdfium/xfa/fwl/cfwl_monthcalendar.h b/chromium/third_party/pdfium/xfa/fwl/cfwl_monthcalendar.h
index a110ee82970..70c0401b7d8 100644
--- a/chromium/third_party/pdfium/xfa/fwl/cfwl_monthcalendar.h
+++ b/chromium/third_party/pdfium/xfa/fwl/cfwl_monthcalendar.h
@@ -10,7 +10,7 @@
#include <memory>
#include <vector>
-#include "xfa/fgas/localization/fgas_datetime.h"
+#include "core/fxcrt/cfx_datetime.h"
#include "xfa/fwl/cfwl_event.h"
#include "xfa/fwl/cfwl_widget.h"
#include "xfa/fwl/cfwl_widgetproperties.h"
@@ -165,7 +165,6 @@ class CFWL_MonthCalendar : public CFWL_Widget {
CFX_RectF m_rtWeekNumSep;
CFX_WideString m_wsHead;
CFX_WideString m_wsToday;
- std::unique_ptr<CFX_DateTime> m_pDateTime;
std::vector<std::unique_ptr<DATEINFO>> m_arrDates;
int32_t m_iCurYear;
int32_t m_iCurMonth;
diff --git a/chromium/third_party/pdfium/xfa/fwl/cfwl_pushbutton.cpp b/chromium/third_party/pdfium/xfa/fwl/cfwl_pushbutton.cpp
index fe4c3f621ac..42925414f8d 100644
--- a/chromium/third_party/pdfium/xfa/fwl/cfwl_pushbutton.cpp
+++ b/chromium/third_party/pdfium/xfa/fwl/cfwl_pushbutton.cpp
@@ -10,7 +10,7 @@
#include <utility>
#include "third_party/base/ptr_util.h"
-#include "xfa/fde/tto/fde_textout.h"
+#include "xfa/fde/cfde_textout.h"
#include "xfa/fwl/cfwl_event.h"
#include "xfa/fwl/cfwl_eventmouse.h"
#include "xfa/fwl/cfwl_messagekey.h"
diff --git a/chromium/third_party/pdfium/xfa/fwl/cfwl_scrollbar.cpp b/chromium/third_party/pdfium/xfa/fwl/cfwl_scrollbar.cpp
index 1da26745504..72797ed315e 100644
--- a/chromium/third_party/pdfium/xfa/fwl/cfwl_scrollbar.cpp
+++ b/chromium/third_party/pdfium/xfa/fwl/cfwl_scrollbar.cpp
@@ -11,6 +11,7 @@
#include <utility>
#include "third_party/base/ptr_util.h"
+#include "third_party/base/stl_util.h"
#include "xfa/fwl/cfwl_messagemouse.h"
#include "xfa/fwl/cfwl_messagemousewheel.h"
#include "xfa/fwl/cfwl_notedriver.h"
@@ -90,14 +91,14 @@ void CFWL_ScrollBar::DrawWidget(CFX_Graphics* pGraphics,
DrawThumb(pGraphics, pTheme, pMatrix);
}
-void CFWL_ScrollBar::SetTrackPos(FX_FLOAT fTrackPos) {
+void CFWL_ScrollBar::SetTrackPos(float fTrackPos) {
m_fTrackPos = fTrackPos;
m_rtThumb = CalcThumbButtonRect(m_rtThumb);
m_rtMinTrack = CalcMinTrackRect(m_rtMinTrack);
m_rtMaxTrack = CalcMaxTrackRect(m_rtMaxTrack);
}
-bool CFWL_ScrollBar::DoScroll(CFWL_EventScroll::Code dwCode, FX_FLOAT fPos) {
+bool CFWL_ScrollBar::DoScroll(CFWL_EventScroll::Code dwCode, float fPos) {
if (dwCode == CFWL_EventScroll::Code::None)
return false;
return OnScroll(dwCode, fPos);
@@ -164,7 +165,7 @@ void CFWL_ScrollBar::Layout() {
void CFWL_ScrollBar::CalcButtonLen() {
m_fButtonLen = IsVertical() ? m_rtClient.width : m_rtClient.height;
- FX_FLOAT fLength = IsVertical() ? m_rtClient.height : m_rtClient.width;
+ float fLength = IsVertical() ? m_rtClient.height : m_rtClient.width;
if (fLength < m_fButtonLen * 2) {
m_fButtonLen = fLength / 2;
m_bMinSize = true;
@@ -199,7 +200,7 @@ CFX_RectF CFWL_ScrollBar::CalcThumbButtonRect(const CFX_RectF& rtThumb) {
return rect;
}
- FX_FLOAT fRange = m_fRangeMax - m_fRangeMin;
+ float fRange = m_fRangeMax - m_fRangeMin;
if (fRange < 0) {
if (IsVertical()) {
return CFX_RectF(m_rtClient.left, m_rtMaxBtn.bottom(), m_rtClient.width,
@@ -209,22 +210,21 @@ CFX_RectF CFWL_ScrollBar::CalcThumbButtonRect(const CFX_RectF& rtThumb) {
}
CFX_RectF rtClient = m_rtClient;
- FX_FLOAT fLength = IsVertical() ? rtClient.height : rtClient.width;
- FX_FLOAT fSize = m_fButtonLen;
+ float fLength = IsVertical() ? rtClient.height : rtClient.width;
+ float fSize = m_fButtonLen;
fLength -= fSize * 2.0f;
if (fLength < fSize)
fLength = 0.0f;
- FX_FLOAT fThumbSize = fLength * fLength / (fRange + fLength);
+ float fThumbSize = fLength * fLength / (fRange + fLength);
fThumbSize = std::max(fThumbSize, kMinThumbSize);
- FX_FLOAT fDiff = std::max(fLength - fThumbSize, 0.0f);
- FX_FLOAT fTrackPos =
- std::max(std::min(m_fTrackPos, m_fRangeMax), m_fRangeMin);
+ float fDiff = std::max(fLength - fThumbSize, 0.0f);
+ float fTrackPos = pdfium::clamp(m_fTrackPos, m_fRangeMin, m_fRangeMax);
if (!fRange)
return rect;
- FX_FLOAT iPos = fSize + fDiff * (fTrackPos - m_fRangeMin) / fRange;
+ float iPos = fSize + fDiff * (fTrackPos - m_fRangeMin) / fRange;
rect.left = rtClient.left;
rect.top = rtClient.top;
if (IsVertical()) {
@@ -264,20 +264,20 @@ CFX_RectF CFWL_ScrollBar::CalcMaxTrackRect(const CFX_RectF& rtMaxRect) {
return CFX_RectF(rtMaxRect.TopLeft(), 0, 0);
if (IsVertical()) {
- FX_FLOAT iy = (m_rtThumb.top + m_rtThumb.bottom()) / 2;
+ float iy = (m_rtThumb.top + m_rtThumb.bottom()) / 2;
return CFX_RectF(m_rtClient.left, iy, m_rtClient.width,
m_rtClient.bottom() - iy);
}
- FX_FLOAT ix = (m_rtThumb.left + m_rtThumb.right()) / 2;
+ float ix = (m_rtThumb.left + m_rtThumb.right()) / 2;
return CFX_RectF(ix, m_rtClient.top, m_rtClient.height - ix,
m_rtClient.height);
}
-FX_FLOAT CFWL_ScrollBar::GetTrackPointPos(const CFX_PointF& point) {
+float CFWL_ScrollBar::GetTrackPointPos(const CFX_PointF& point) {
CFX_PointF diff = point - m_cpTrackPoint;
- FX_FLOAT fRange = m_fRangeMax - m_fRangeMin;
- FX_FLOAT fPos;
+ float fRange = m_fRangeMax - m_fRangeMin;
+ float fPos;
if (IsVertical()) {
fPos = fRange * diff.y /
@@ -288,7 +288,7 @@ FX_FLOAT CFWL_ScrollBar::GetTrackPointPos(const CFX_PointF& point) {
}
fPos += m_fLastTrackPos;
- return std::min(std::max(fPos, m_fRangeMin), m_fRangeMax);
+ return pdfium::clamp(fPos, m_fRangeMin, m_fRangeMax);
}
bool CFWL_ScrollBar::SendEvent() {
@@ -317,7 +317,7 @@ bool CFWL_ScrollBar::SendEvent() {
return true;
}
-bool CFWL_ScrollBar::OnScroll(CFWL_EventScroll::Code dwCode, FX_FLOAT fPos) {
+bool CFWL_ScrollBar::OnScroll(CFWL_EventScroll::Code dwCode, float fPos) {
CFWL_EventScroll ev(this);
ev.m_iScrollCode = dwCode;
ev.m_fPos = fPos;
diff --git a/chromium/third_party/pdfium/xfa/fwl/cfwl_scrollbar.h b/chromium/third_party/pdfium/xfa/fwl/cfwl_scrollbar.h
index 6a67fa8687d..262d0794d8e 100644
--- a/chromium/third_party/pdfium/xfa/fwl/cfwl_scrollbar.h
+++ b/chromium/third_party/pdfium/xfa/fwl/cfwl_scrollbar.h
@@ -35,23 +35,23 @@ class CFWL_ScrollBar : public CFWL_Widget {
void OnDrawWidget(CFX_Graphics* pGraphics,
const CFX_Matrix* pMatrix) override;
- void GetRange(FX_FLOAT* fMin, FX_FLOAT* fMax) const {
+ void GetRange(float* fMin, float* fMax) const {
ASSERT(fMin);
ASSERT(fMax);
*fMin = m_fRangeMin;
*fMax = m_fRangeMax;
}
- void SetRange(FX_FLOAT fMin, FX_FLOAT fMax) {
+ void SetRange(float fMin, float fMax) {
m_fRangeMin = fMin;
m_fRangeMax = fMax;
}
- FX_FLOAT GetPageSize() const { return m_fPageSize; }
- void SetPageSize(FX_FLOAT fPageSize) { m_fPageSize = fPageSize; }
- FX_FLOAT GetStepSize() const { return m_fStepSize; }
- void SetStepSize(FX_FLOAT fStepSize) { m_fStepSize = fStepSize; }
- FX_FLOAT GetPos() const { return m_fPos; }
- void SetPos(FX_FLOAT fPos) { m_fPos = fPos; }
- void SetTrackPos(FX_FLOAT fTrackPos);
+ float GetPageSize() const { return m_fPageSize; }
+ void SetPageSize(float fPageSize) { m_fPageSize = fPageSize; }
+ float GetStepSize() const { return m_fStepSize; }
+ void SetStepSize(float fStepSize) { m_fStepSize = fStepSize; }
+ float GetPos() const { return m_fPos; }
+ void SetPos(float fPos) { m_fPos = fPos; }
+ void SetTrackPos(float fTrackPos);
private:
class Timer : public CFWL_Timer {
@@ -84,16 +84,16 @@ class CFWL_ScrollBar : public CFWL_Widget {
CFX_RectF CalcThumbButtonRect(const CFX_RectF& rtThumbRect);
CFX_RectF CalcMinTrackRect(const CFX_RectF& rtMinRect);
CFX_RectF CalcMaxTrackRect(const CFX_RectF& rtMaxRect);
- FX_FLOAT GetTrackPointPos(const CFX_PointF& point);
+ float GetTrackPointPos(const CFX_PointF& point);
bool SendEvent();
- bool OnScroll(CFWL_EventScroll::Code dwCode, FX_FLOAT fPos);
+ bool OnScroll(CFWL_EventScroll::Code dwCode, float fPos);
void OnLButtonDown(const CFX_PointF& point);
void OnLButtonUp(const CFX_PointF& point);
void OnMouseMove(const CFX_PointF& point);
void OnMouseLeave();
void OnMouseWheel(const CFX_PointF& delta);
- bool DoScroll(CFWL_EventScroll::Code dwCode, FX_FLOAT fPos);
+ bool DoScroll(CFWL_EventScroll::Code dwCode, float fPos);
void DoMouseDown(int32_t iItem,
const CFX_RectF& rtItem,
int32_t& iState,
@@ -110,22 +110,22 @@ class CFWL_ScrollBar : public CFWL_Widget {
void DoMouseHover(int32_t iItem, const CFX_RectF& rtItem, int32_t& iState);
CFWL_TimerInfo* m_pTimerInfo;
- FX_FLOAT m_fRangeMin;
- FX_FLOAT m_fRangeMax;
- FX_FLOAT m_fPageSize;
- FX_FLOAT m_fStepSize;
- FX_FLOAT m_fPos;
- FX_FLOAT m_fTrackPos;
+ float m_fRangeMin;
+ float m_fRangeMax;
+ float m_fPageSize;
+ float m_fStepSize;
+ float m_fPos;
+ float m_fTrackPos;
int32_t m_iMinButtonState;
int32_t m_iMaxButtonState;
int32_t m_iThumbButtonState;
int32_t m_iMinTrackState;
int32_t m_iMaxTrackState;
- FX_FLOAT m_fLastTrackPos;
+ float m_fLastTrackPos;
CFX_PointF m_cpTrackPoint;
int32_t m_iMouseWheel;
bool m_bMouseDown;
- FX_FLOAT m_fButtonLen;
+ float m_fButtonLen;
bool m_bMinSize;
CFX_RectF m_rtClient;
CFX_RectF m_rtThumb;
diff --git a/chromium/third_party/pdfium/xfa/fwl/cfwl_themebackground.h b/chromium/third_party/pdfium/xfa/fwl/cfwl_themebackground.h
index 3f204888301..f23f26e2297 100644
--- a/chromium/third_party/pdfium/xfa/fwl/cfwl_themebackground.h
+++ b/chromium/third_party/pdfium/xfa/fwl/cfwl_themebackground.h
@@ -16,12 +16,17 @@ class CFX_Path;
class CFWL_ThemeBackground : public CFWL_ThemePart {
public:
- CFWL_ThemeBackground()
- : m_pGraphics(nullptr), m_pImage(nullptr), m_pPath(nullptr) {}
+ CFWL_ThemeBackground();
+ ~CFWL_ThemeBackground();
CFX_Graphics* m_pGraphics;
- CFX_DIBitmap* m_pImage;
CFX_Path* m_pPath;
+ CFX_RetainPtr<CFX_DIBitmap> m_pImage;
};
+inline CFWL_ThemeBackground::CFWL_ThemeBackground()
+ : m_pGraphics(nullptr), m_pPath(nullptr) {}
+
+inline CFWL_ThemeBackground::~CFWL_ThemeBackground() {}
+
#endif // XFA_FWL_CFWL_THEMEBACKGROUND_H_
diff --git a/chromium/third_party/pdfium/xfa/fwl/cfwl_timer.cpp b/chromium/third_party/pdfium/xfa/fwl/cfwl_timer.cpp
index c7214a4f72d..0cd3b2b7686 100644
--- a/chromium/third_party/pdfium/xfa/fwl/cfwl_timer.cpp
+++ b/chromium/third_party/pdfium/xfa/fwl/cfwl_timer.cpp
@@ -10,7 +10,7 @@
#include "xfa/fwl/cfwl_timerinfo.h"
#include "xfa/fwl/cfwl_widget.h"
#include "xfa/fwl/ifwl_adaptertimermgr.h"
-#include "xfa/fxfa/xfa_ffapp.h"
+#include "xfa/fxfa/cxfa_ffapp.h"
CFWL_TimerInfo* CFWL_Timer::StartTimer(uint32_t dwElapse, bool bImmediately) {
const CFWL_App* pApp = m_pWidget->GetOwnerApp();
diff --git a/chromium/third_party/pdfium/xfa/fwl/cfwl_widget.cpp b/chromium/third_party/pdfium/xfa/fwl/cfwl_widget.cpp
index b5b8bf4c7d1..172014da62d 100644
--- a/chromium/third_party/pdfium/xfa/fwl/cfwl_widget.cpp
+++ b/chromium/third_party/pdfium/xfa/fwl/cfwl_widget.cpp
@@ -11,7 +11,7 @@
#include <vector>
#include "third_party/base/stl_util.h"
-#include "xfa/fde/tto/fde_textout.h"
+#include "xfa/fde/cfde_textout.h"
#include "xfa/fwl/cfwl_app.h"
#include "xfa/fwl/cfwl_combobox.h"
#include "xfa/fwl/cfwl_event.h"
@@ -28,7 +28,7 @@
#include "xfa/fwl/cfwl_themetext.h"
#include "xfa/fwl/cfwl_widgetmgr.h"
#include "xfa/fwl/ifwl_themeprovider.h"
-#include "xfa/fxfa/xfa_ffapp.h"
+#include "xfa/fxfa/cxfa_ffapp.h"
#define FWL_STYLEEXT_MNU_Vert (1L << 0)
#define FWL_WGT_CalcHeight 2048
@@ -77,7 +77,7 @@ CFX_RectF CFWL_Widget::GetWidgetRect() {
void CFWL_Widget::InflateWidgetRect(CFX_RectF& rect) {
if (HasBorder()) {
- FX_FLOAT fBorder = GetBorderSize(true);
+ float fBorder = GetBorderSize(true);
rect.Inflate(fBorder, fBorder);
}
}
@@ -269,14 +269,14 @@ CFX_RectF CFWL_Widget::GetEdgeRect() {
CFX_RectF rtEdge(0, 0, m_pProperties->m_rtWidget.width,
m_pProperties->m_rtWidget.height);
if (HasBorder()) {
- FX_FLOAT fCX = GetBorderSize(true);
- FX_FLOAT fCY = GetBorderSize(false);
+ float fCX = GetBorderSize(true);
+ float fCY = GetBorderSize(false);
rtEdge.Deflate(fCX, fCY);
}
return rtEdge;
}
-FX_FLOAT CFWL_Widget::GetBorderSize(bool bCX) {
+float CFWL_Widget::GetBorderSize(bool bCX) {
IFWL_ThemeProvider* theme = GetAvailableTheme();
if (!theme)
return 0.0f;
@@ -328,8 +328,7 @@ CFX_SizeF CFWL_Widget::CalcTextSize(const CFX_WideString& wsText,
calPart.m_dwTTOStyles =
bMultiLine ? FDE_TTOSTYLE_LineWrap : FDE_TTOSTYLE_SingleLine;
calPart.m_iTTOAlign = FDE_TTOALIGNMENT_TopLeft;
- FX_FLOAT fWidth =
- bMultiLine ? FWL_WGT_CalcMultiLineDefWidth : FWL_WGT_CalcWidth;
+ float fWidth = bMultiLine ? FWL_WGT_CalcMultiLineDefWidth : FWL_WGT_CalcWidth;
CFX_RectF rect(0, 0, fWidth, FWL_WGT_CalcHeight);
pTheme->CalcTextRect(&calPart, rect);
return CFX_SizeF(rect.width, rect.height);
@@ -378,8 +377,8 @@ void CFWL_Widget::SetGrab(bool bSet) {
pDriver->SetGrab(this, bSet);
}
-void CFWL_Widget::GetPopupPos(FX_FLOAT fMinHeight,
- FX_FLOAT fMaxHeight,
+void CFWL_Widget::GetPopupPos(float fMinHeight,
+ float fMaxHeight,
const CFX_RectF& rtAnchor,
CFX_RectF& rtPopup) {
if (GetClassID() == FWL_Type::ComboBox) {
@@ -400,13 +399,13 @@ void CFWL_Widget::GetPopupPos(FX_FLOAT fMinHeight,
GetPopupPosGeneral(fMinHeight, fMaxHeight, rtAnchor, rtPopup);
}
-bool CFWL_Widget::GetPopupPosMenu(FX_FLOAT fMinHeight,
- FX_FLOAT fMaxHeight,
+bool CFWL_Widget::GetPopupPosMenu(float fMinHeight,
+ float fMaxHeight,
const CFX_RectF& rtAnchor,
CFX_RectF& rtPopup) {
if (GetStylesEx() & FWL_STYLEEXT_MNU_Vert) {
bool bLeft = m_pProperties->m_rtWidget.left < 0;
- FX_FLOAT fRight = rtAnchor.right() + rtPopup.width;
+ float fRight = rtAnchor.right() + rtPopup.width;
CFX_PointF point = TransformTo(nullptr, CFX_PointF());
if (fRight + point.x > 0.0f || bLeft) {
rtPopup = CFX_RectF(rtAnchor.left - rtPopup.width, rtAnchor.top,
@@ -419,7 +418,7 @@ bool CFWL_Widget::GetPopupPosMenu(FX_FLOAT fMinHeight,
return true;
}
- FX_FLOAT fBottom = rtAnchor.bottom() + rtPopup.height;
+ float fBottom = rtAnchor.bottom() + rtPopup.height;
CFX_PointF point = TransformTo(nullptr, point);
if (fBottom + point.y > 0.0f) {
rtPopup = CFX_RectF(rtAnchor.left, rtAnchor.top - rtPopup.height,
@@ -432,18 +431,18 @@ bool CFWL_Widget::GetPopupPosMenu(FX_FLOAT fMinHeight,
return true;
}
-bool CFWL_Widget::GetPopupPosComboBox(FX_FLOAT fMinHeight,
- FX_FLOAT fMaxHeight,
+bool CFWL_Widget::GetPopupPosComboBox(float fMinHeight,
+ float fMaxHeight,
const CFX_RectF& rtAnchor,
CFX_RectF& rtPopup) {
- FX_FLOAT fPopHeight = rtPopup.height;
+ float fPopHeight = rtPopup.height;
if (rtPopup.height > fMaxHeight)
fPopHeight = fMaxHeight;
else if (rtPopup.height < fMinHeight)
fPopHeight = fMinHeight;
- FX_FLOAT fWidth = std::max(rtAnchor.width, rtPopup.width);
- FX_FLOAT fBottom = rtAnchor.bottom() + fPopHeight;
+ float fWidth = std::max(rtAnchor.width, rtPopup.width);
+ float fBottom = rtAnchor.bottom() + fPopHeight;
CFX_PointF point = TransformTo(nullptr, CFX_PointF());
if (fBottom + point.y > 0.0f) {
rtPopup =
@@ -456,8 +455,8 @@ bool CFWL_Widget::GetPopupPosComboBox(FX_FLOAT fMinHeight,
return true;
}
-bool CFWL_Widget::GetPopupPosGeneral(FX_FLOAT fMinHeight,
- FX_FLOAT fMaxHeight,
+bool CFWL_Widget::GetPopupPosGeneral(float fMinHeight,
+ float fMaxHeight,
const CFX_RectF& rtAnchor,
CFX_RectF& rtPopup) {
CFX_PointF point = TransformTo(nullptr, CFX_PointF());
diff --git a/chromium/third_party/pdfium/xfa/fwl/cfwl_widget.h b/chromium/third_party/pdfium/xfa/fwl/cfwl_widget.h
index 2387b753e58..b556e7a424d 100644
--- a/chromium/third_party/pdfium/xfa/fwl/cfwl_widget.h
+++ b/chromium/third_party/pdfium/xfa/fwl/cfwl_widget.h
@@ -122,7 +122,7 @@ class CFWL_Widget : public IFWL_WidgetDelegate {
bool IsLocked() const { return m_iLock > 0; }
bool HasBorder() const;
CFX_RectF GetEdgeRect();
- FX_FLOAT GetBorderSize(bool bCX);
+ float GetBorderSize(bool bCX);
CFX_RectF GetRelativeRect();
IFWL_ThemeProvider* GetAvailableTheme();
CFX_SizeF CalcTextSize(const CFX_WideString& wsText,
@@ -134,8 +134,8 @@ class CFWL_Widget : public IFWL_WidgetDelegate {
int32_t iTTOAlign,
CFX_RectF& rect);
void SetGrab(bool bSet);
- void GetPopupPos(FX_FLOAT fMinHeight,
- FX_FLOAT fMaxHeight,
+ void GetPopupPos(float fMinHeight,
+ float fMaxHeight,
const CFX_RectF& rtAnchor,
CFX_RectF& rtPopup);
void RegisterEventTarget(CFWL_Widget* pEventSource);
@@ -161,16 +161,16 @@ class CFWL_Widget : public IFWL_WidgetDelegate {
bool IsPopup() const;
bool IsChild() const;
CFWL_Widget* GetRootOuter();
- bool GetPopupPosMenu(FX_FLOAT fMinHeight,
- FX_FLOAT fMaxHeight,
+ bool GetPopupPosMenu(float fMinHeight,
+ float fMaxHeight,
const CFX_RectF& rtAnchor,
CFX_RectF& rtPopup);
- bool GetPopupPosComboBox(FX_FLOAT fMinHeight,
- FX_FLOAT fMaxHeight,
+ bool GetPopupPosComboBox(float fMinHeight,
+ float fMaxHeight,
const CFX_RectF& rtAnchor,
CFX_RectF& rtPopup);
- bool GetPopupPosGeneral(FX_FLOAT fMinHeight,
- FX_FLOAT fMaxHeight,
+ bool GetPopupPosGeneral(float fMinHeight,
+ float fMaxHeight,
const CFX_RectF& rtAnchor,
CFX_RectF& rtPopup);
void DrawBackground(CFX_Graphics* pGraphics,
diff --git a/chromium/third_party/pdfium/xfa/fwl/cfwl_widgetmgr.cpp b/chromium/third_party/pdfium/xfa/fwl/cfwl_widgetmgr.cpp
index 7c0fddd4193..d0dbf1f773b 100644
--- a/chromium/third_party/pdfium/xfa/fwl/cfwl_widgetmgr.cpp
+++ b/chromium/third_party/pdfium/xfa/fwl/cfwl_widgetmgr.cpp
@@ -13,7 +13,7 @@
#include "xfa/fwl/cfwl_form.h"
#include "xfa/fwl/cfwl_notedriver.h"
#include "xfa/fxfa/app/xfa_fwladapter.h"
-#include "xfa/fxfa/xfa_ffapp.h"
+#include "xfa/fxfa/cxfa_ffapp.h"
namespace {
@@ -383,8 +383,8 @@ bool CFWL_WidgetMgr::IsAbleNative(CFWL_Widget* pWidget) const {
}
void CFWL_WidgetMgr::GetAdapterPopupPos(CFWL_Widget* pWidget,
- FX_FLOAT fMinHeight,
- FX_FLOAT fMaxHeight,
+ float fMinHeight,
+ float fMaxHeight,
const CFX_RectF& rtAnchor,
CFX_RectF& rtPopup) const {
m_pAdapter->GetPopupPos(pWidget, fMinHeight, fMaxHeight, rtAnchor, rtPopup);
@@ -532,9 +532,9 @@ bool CFWL_WidgetMgr::IsNeedRepaint(CFWL_Widget* pWidget,
bool bOrginPtIntersectWidthChild = false;
bool bOrginPtIntersectWidthDirty = rtDirty.Contains(rtWidget.TopLeft());
static FWL_NEEDREPAINTHITDATA hitPoint[kNeedRepaintHitPoints];
- FXSYS_memset(hitPoint, 0, sizeof(hitPoint));
- FX_FLOAT fxPiece = rtWidget.width / kNeedRepaintHitPiece;
- FX_FLOAT fyPiece = rtWidget.height / kNeedRepaintHitPiece;
+ memset(hitPoint, 0, sizeof(hitPoint));
+ float fxPiece = rtWidget.width / kNeedRepaintHitPiece;
+ float fyPiece = rtWidget.height / kNeedRepaintHitPiece;
hitPoint[2].hitPoint.x = hitPoint[6].hitPoint.x = rtWidget.left;
hitPoint[0].hitPoint.x = hitPoint[3].hitPoint.x = hitPoint[7].hitPoint.x =
hitPoint[10].hitPoint.x = fxPiece + rtWidget.left;
diff --git a/chromium/third_party/pdfium/xfa/fwl/cfwl_widgetmgr.h b/chromium/third_party/pdfium/xfa/fwl/cfwl_widgetmgr.h
index 2d436bd8e29..c3dca31d763 100644
--- a/chromium/third_party/pdfium/xfa/fwl/cfwl_widgetmgr.h
+++ b/chromium/third_party/pdfium/xfa/fwl/cfwl_widgetmgr.h
@@ -64,8 +64,8 @@ class CFWL_WidgetMgr : public CFWL_WidgetMgrDelegate {
}
void GetAdapterPopupPos(CFWL_Widget* pWidget,
- FX_FLOAT fMinHeight,
- FX_FLOAT fMaxHeight,
+ float fMinHeight,
+ float fMaxHeight,
const CFX_RectF& rtAnchor,
CFX_RectF& rtPopup) const;
diff --git a/chromium/third_party/pdfium/xfa/fwl/cfx_barcode.cpp b/chromium/third_party/pdfium/xfa/fwl/cfx_barcode.cpp
index 7af3aa18884..9d01ae26ef3 100644
--- a/chromium/third_party/pdfium/xfa/fwl/cfx_barcode.cpp
+++ b/chromium/third_party/pdfium/xfa/fwl/cfx_barcode.cpp
@@ -6,17 +6,17 @@
#include "xfa/fwl/cfx_barcode.h"
-#include "xfa/fxbarcode/cbc_codabar.h"
-#include "xfa/fxbarcode/cbc_code128.h"
-#include "xfa/fxbarcode/cbc_code39.h"
-#include "xfa/fxbarcode/cbc_codebase.h"
-#include "xfa/fxbarcode/cbc_datamatrix.h"
-#include "xfa/fxbarcode/cbc_ean13.h"
-#include "xfa/fxbarcode/cbc_ean8.h"
-#include "xfa/fxbarcode/cbc_pdf417i.h"
-#include "xfa/fxbarcode/cbc_qrcode.h"
-#include "xfa/fxbarcode/cbc_upca.h"
-#include "xfa/fxbarcode/utils.h"
+#include "fxbarcode/cbc_codabar.h"
+#include "fxbarcode/cbc_code128.h"
+#include "fxbarcode/cbc_code39.h"
+#include "fxbarcode/cbc_codebase.h"
+#include "fxbarcode/cbc_datamatrix.h"
+#include "fxbarcode/cbc_ean13.h"
+#include "fxbarcode/cbc_ean8.h"
+#include "fxbarcode/cbc_pdf417i.h"
+#include "fxbarcode/cbc_qrcode.h"
+#include "fxbarcode/cbc_upca.h"
+#include "fxbarcode/utils.h"
namespace {
@@ -160,7 +160,7 @@ bool CFX_Barcode::SetFont(CFX_Font* pFont) {
}
}
-bool CFX_Barcode::SetFontSize(FX_FLOAT size) {
+bool CFX_Barcode::SetFontSize(float size) {
switch (GetType()) {
case BC_CODE39:
case BC_CODABAR:
@@ -235,8 +235,8 @@ bool CFX_Barcode::SetWideNarrowRatio(int32_t ratio) {
return m_pBCEngine && memptr ? (m_pBCEngine.get()->*memptr)(ratio) : false;
}
-bool CFX_Barcode::SetStartChar(FX_CHAR start) {
- typedef bool (CBC_CodeBase::*memptrtype)(FX_CHAR);
+bool CFX_Barcode::SetStartChar(char start) {
+ typedef bool (CBC_CodeBase::*memptrtype)(char);
memptrtype memptr = nullptr;
switch (GetType()) {
case BC_CODABAR:
@@ -248,8 +248,8 @@ bool CFX_Barcode::SetStartChar(FX_CHAR start) {
return m_pBCEngine && memptr ? (m_pBCEngine.get()->*memptr)(start) : false;
}
-bool CFX_Barcode::SetEndChar(FX_CHAR end) {
- typedef bool (CBC_CodeBase::*memptrtype)(FX_CHAR);
+bool CFX_Barcode::SetEndChar(char end) {
+ typedef bool (CBC_CodeBase::*memptrtype)(char);
memptrtype memptr = nullptr;
switch (GetType()) {
case BC_CODABAR:
@@ -261,19 +261,6 @@ bool CFX_Barcode::SetEndChar(FX_CHAR end) {
return m_pBCEngine && memptr ? (m_pBCEngine.get()->*memptr)(end) : false;
}
-bool CFX_Barcode::SetVersion(int32_t version) {
- typedef bool (CBC_CodeBase::*memptrtype)(int32_t);
- memptrtype memptr = nullptr;
- switch (GetType()) {
- case BC_QR_CODE:
- memptr = (memptrtype)&CBC_QRCode::SetVersion;
- break;
- default:
- break;
- }
- return m_pBCEngine && memptr ? (m_pBCEngine.get()->*memptr)(version) : false;
-}
-
bool CFX_Barcode::SetErrorCorrectionLevel(int32_t level) {
typedef bool (CBC_CodeBase::*memptrtype)(int32_t);
memptrtype memptr = nullptr;
diff --git a/chromium/third_party/pdfium/xfa/fwl/cfx_barcode.h b/chromium/third_party/pdfium/xfa/fwl/cfx_barcode.h
index f639977cfc1..20155ca0a2b 100644
--- a/chromium/third_party/pdfium/xfa/fwl/cfx_barcode.h
+++ b/chromium/third_party/pdfium/xfa/fwl/cfx_barcode.h
@@ -13,7 +13,7 @@
#include "core/fxcrt/fx_string.h"
#include "core/fxcrt/fx_system.h"
#include "core/fxge/fx_dib.h"
-#include "xfa/fxbarcode/BC_Library.h"
+#include "fxbarcode/BC_Library.h"
class CBC_CodeBase;
class CFX_Font;
@@ -46,15 +46,14 @@ class CFX_Barcode {
bool SetCalChecksum(bool state);
bool SetFont(CFX_Font* pFont);
- bool SetFontSize(FX_FLOAT size);
+ bool SetFontSize(float size);
bool SetFontColor(FX_ARGB color);
bool SetTextLocation(BC_TEXT_LOC location);
bool SetWideNarrowRatio(int32_t ratio);
- bool SetStartChar(FX_CHAR start);
- bool SetEndChar(FX_CHAR end);
- bool SetVersion(int32_t version);
+ bool SetStartChar(char start);
+ bool SetEndChar(char end);
bool SetErrorCorrectionLevel(int32_t level);
bool SetTruncated(bool truncated);
diff --git a/chromium/third_party/pdfium/xfa/fwl/theme/cfwl_checkboxtp.cpp b/chromium/third_party/pdfium/xfa/fwl/theme/cfwl_checkboxtp.cpp
index 1d185b4c337..0a3ae88a460 100644
--- a/chromium/third_party/pdfium/xfa/fwl/theme/cfwl_checkboxtp.cpp
+++ b/chromium/third_party/pdfium/xfa/fwl/theme/cfwl_checkboxtp.cpp
@@ -8,7 +8,7 @@
#include "core/fxge/cfx_pathdata.h"
#include "third_party/base/ptr_util.h"
-#include "xfa/fde/tto/fde_textout.h"
+#include "xfa/fde/cfde_textout.h"
#include "xfa/fwl/cfwl_checkbox.h"
#include "xfa/fwl/cfwl_themebackground.h"
#include "xfa/fwl/cfwl_themetext.h"
@@ -92,8 +92,8 @@ void CFWL_CheckBoxTP::DrawSignCross(CFX_Graphics* pGraphics,
FX_ARGB argbFill,
CFX_Matrix* pMatrix) {
CFX_Path path;
- FX_FLOAT fRight = pRtSign->right();
- FX_FLOAT fBottom = pRtSign->bottom();
+ float fRight = pRtSign->right();
+ float fBottom = pRtSign->bottom();
path.AddLine(pRtSign->TopLeft(), CFX_PointF(fRight, fBottom));
path.AddLine(CFX_PointF(pRtSign->left, fBottom),
CFX_PointF(fRight, pRtSign->top));
@@ -111,9 +111,9 @@ void CFWL_CheckBoxTP::DrawSignDiamond(CFX_Graphics* pGraphics,
FX_ARGB argbFill,
CFX_Matrix* pMatrix) {
CFX_Path path;
- FX_FLOAT fWidth = pRtSign->width;
- FX_FLOAT fHeight = pRtSign->height;
- FX_FLOAT fBottom = pRtSign->bottom();
+ float fWidth = pRtSign->width;
+ float fHeight = pRtSign->height;
+ float fBottom = pRtSign->bottom();
path.MoveTo(CFX_PointF(pRtSign->left + fWidth / 2, pRtSign->top));
path.LineTo(CFX_PointF(pRtSign->left, pRtSign->top + fHeight / 2));
path.LineTo(CFX_PointF(pRtSign->left + fWidth / 2, fBottom));
@@ -146,18 +146,18 @@ void CFWL_CheckBoxTP::DrawSignStar(CFX_Graphics* pGraphics,
FX_ARGB argbFill,
CFX_Matrix* pMatrix) {
CFX_Path path;
- FX_FLOAT fBottom = pRtSign->bottom();
- FX_FLOAT fRadius =
- (pRtSign->top - fBottom) / (1 + static_cast<FX_FLOAT>(cos(FX_PI / 5.0f)));
+ float fBottom = pRtSign->bottom();
+ float fRadius =
+ (pRtSign->top - fBottom) / (1 + static_cast<float>(cos(FX_PI / 5.0f)));
CFX_PointF ptCenter((pRtSign->left + pRtSign->right()) / 2.0f,
(pRtSign->top + fBottom) / 2.0f);
CFX_PointF points[5];
- FX_FLOAT fAngel = FX_PI / 10.0f;
+ float fAngel = FX_PI / 10.0f;
for (int32_t i = 0; i < 5; i++) {
points[i] =
- ptCenter + CFX_PointF(fRadius * static_cast<FX_FLOAT>(cos(fAngel)),
- fRadius * static_cast<FX_FLOAT>(sin(fAngel)));
+ ptCenter + CFX_PointF(fRadius * static_cast<float>(cos(fAngel)),
+ fRadius * static_cast<float>(sin(fAngel)));
fAngel += FX_PI * 2 / 5.0f;
}
@@ -216,13 +216,13 @@ void CFWL_CheckBoxTP::SetThemeData() {
m_pThemeData->clrSignNeutralPressed = ArgbEncode(255, 28, 134, 26);
}
-void CFWL_CheckBoxTP::InitCheckPath(FX_FLOAT fCheckLen) {
+void CFWL_CheckBoxTP::InitCheckPath(float fCheckLen) {
if (!m_pCheckPath) {
m_pCheckPath = pdfium::MakeUnique<CFX_Path>();
- FX_FLOAT fWidth = kSignPath;
- FX_FLOAT fHeight = -kSignPath;
- FX_FLOAT fBottom = kSignPath;
+ float fWidth = kSignPath;
+ float fHeight = -kSignPath;
+ float fBottom = kSignPath;
CFX_PointF pt1(fWidth / 15.0f, fBottom + fHeight * 2 / 5.0f);
CFX_PointF pt2(fWidth / 4.5f, fBottom + fHeight / 16.0f);
CFX_PointF pt3(fWidth / 3.0f, fBottom);
@@ -262,7 +262,7 @@ void CFWL_CheckBoxTP::InitCheckPath(FX_FLOAT fCheckLen) {
p2 = CFX_PointF(pt15.x - pt1.x, pt15.y - pt1.y) * FX_BEZIER;
m_pCheckPath->BezierTo(pt5 + p1, pt1 + p2, pt1);
- FX_FLOAT fScale = fCheckLen / kSignPath;
+ float fScale = fCheckLen / kSignPath;
CFX_Matrix mt(1, 0, 0, 1, 0, 0);
mt.Scale(fScale, fScale);
diff --git a/chromium/third_party/pdfium/xfa/fwl/theme/cfwl_checkboxtp.h b/chromium/third_party/pdfium/xfa/fwl/theme/cfwl_checkboxtp.h
index 979b970b393..1070b125981 100644
--- a/chromium/third_party/pdfium/xfa/fwl/theme/cfwl_checkboxtp.h
+++ b/chromium/third_party/pdfium/xfa/fwl/theme/cfwl_checkboxtp.h
@@ -65,7 +65,7 @@ class CFWL_CheckBoxTP : public CFWL_WidgetTP {
FX_ARGB argbFill,
CFX_Matrix* pMatrix);
- void InitCheckPath(FX_FLOAT fCheckLen);
+ void InitCheckPath(float fCheckLen);
std::unique_ptr<CKBThemeData> m_pThemeData;
std::unique_ptr<CFX_Path> m_pCheckPath;
diff --git a/chromium/third_party/pdfium/xfa/fwl/theme/cfwl_edittp.cpp b/chromium/third_party/pdfium/xfa/fwl/theme/cfwl_edittp.cpp
index 43160177d75..138a99e59d1 100644
--- a/chromium/third_party/pdfium/xfa/fwl/theme/cfwl_edittp.cpp
+++ b/chromium/third_party/pdfium/xfa/fwl/theme/cfwl_edittp.cpp
@@ -10,7 +10,7 @@
#include "xfa/fwl/cfwl_themebackground.h"
#include "xfa/fwl/cfwl_widget.h"
#include "xfa/fxfa/app/xfa_fwltheme.h"
-#include "xfa/fxfa/xfa_ffwidget.h"
+#include "xfa/fxfa/cxfa_ffwidget.h"
#include "xfa/fxgraphics/cfx_color.h"
#include "xfa/fxgraphics/cfx_path.h"
@@ -22,7 +22,7 @@ void CFWL_EditTP::DrawBackground(CFWL_ThemeBackground* pParams) {
if (CFWL_Part::CombTextLine == pParams->m_iPart) {
CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pParams->m_pWidget);
FX_ARGB cr = 0xFF000000;
- FX_FLOAT fWidth = 1.0f;
+ float fWidth = 1.0f;
if (CXFA_Border borderUI = pWidget->GetDataAcc()->GetUIBorder()) {
CXFA_Edge edge = borderUI.GetEdge(0);
if (edge) {
@@ -74,7 +74,7 @@ void CFWL_EditTP::DrawBackground(CFWL_ThemeBackground* pParams) {
}
case CFWL_Part::CombTextLine: {
FX_ARGB cr = 0xFF000000;
- FX_FLOAT fWidth = 1.0f;
+ float fWidth = 1.0f;
CFX_Color crLine(cr);
pParams->m_pGraphics->SetStrokeColor(&crLine);
pParams->m_pGraphics->SetLineWidth(fWidth);
diff --git a/chromium/third_party/pdfium/xfa/fwl/theme/cfwl_monthcalendartp.cpp b/chromium/third_party/pdfium/xfa/fwl/theme/cfwl_monthcalendartp.cpp
index b14109d0136..b9961af8b0c 100644
--- a/chromium/third_party/pdfium/xfa/fwl/theme/cfwl_monthcalendartp.cpp
+++ b/chromium/third_party/pdfium/xfa/fwl/theme/cfwl_monthcalendartp.cpp
@@ -6,7 +6,7 @@
#include "xfa/fwl/theme/cfwl_monthcalendartp.h"
-#include "xfa/fde/tto/fde_textout.h"
+#include "xfa/fde/cfde_textout.h"
#include "xfa/fwl/cfwl_monthcalendar.h"
#include "xfa/fwl/cfwl_themebackground.h"
#include "xfa/fwl/cfwl_themetext.h"
diff --git a/chromium/third_party/pdfium/xfa/fwl/theme/cfwl_pushbuttontp.cpp b/chromium/third_party/pdfium/xfa/fwl/theme/cfwl_pushbuttontp.cpp
index 56268a8507a..6bb34d06572 100644
--- a/chromium/third_party/pdfium/xfa/fwl/theme/cfwl_pushbuttontp.cpp
+++ b/chromium/third_party/pdfium/xfa/fwl/theme/cfwl_pushbuttontp.cpp
@@ -29,8 +29,8 @@ void CFWL_PushButtonTP::DrawBackground(CFWL_ThemeBackground* pParams) {
}
case CFWL_Part::Background: {
CFX_RectF& rect = pParams->m_rtPart;
- FX_FLOAT fRight = rect.right();
- FX_FLOAT fBottom = rect.bottom();
+ float fRight = rect.right();
+ float fBottom = rect.bottom();
CFX_Path strokePath;
strokePath.MoveTo(
diff --git a/chromium/third_party/pdfium/xfa/fwl/theme/cfwl_scrollbartp.cpp b/chromium/third_party/pdfium/xfa/fwl/theme/cfwl_scrollbartp.cpp
index 121d4dea341..bab9a3f3be9 100644
--- a/chromium/third_party/pdfium/xfa/fwl/theme/cfwl_scrollbartp.cpp
+++ b/chromium/third_party/pdfium/xfa/fwl/theme/cfwl_scrollbartp.cpp
@@ -124,13 +124,13 @@ void CFWL_ScrollBarTP::DrawPaw(CFX_Graphics* pGraphics,
CFX_Matrix* pMatrix) {
CFX_Path path;
if (bVert) {
- FX_FLOAT fPawLen = kPawLength;
+ float fPawLen = kPawLength;
if (pRect->width / 2 <= fPawLen) {
fPawLen = (pRect->width - 6) / 2;
}
- FX_FLOAT fX = pRect->left + pRect->width / 4;
- FX_FLOAT fY = pRect->top + pRect->height / 2;
+ float fX = pRect->left + pRect->width / 4;
+ float fY = pRect->top + pRect->height / 2;
path.MoveTo(CFX_PointF(fX, fY - 4));
path.LineTo(CFX_PointF(fX + fPawLen, fY - 4));
path.MoveTo(CFX_PointF(fX, fY - 2));
@@ -161,13 +161,13 @@ void CFWL_ScrollBarTP::DrawPaw(CFX_Graphics* pGraphics,
pGraphics->SetStrokeColor(&clrDark);
pGraphics->StrokePath(&path, pMatrix);
} else {
- FX_FLOAT fPawLen = kPawLength;
+ float fPawLen = kPawLength;
if (pRect->height / 2 <= fPawLen) {
fPawLen = (pRect->height - 6) / 2;
}
- FX_FLOAT fX = pRect->left + pRect->width / 2;
- FX_FLOAT fY = pRect->top + pRect->height / 4;
+ float fX = pRect->left + pRect->width / 2;
+ float fY = pRect->top + pRect->height / 4;
path.MoveTo(CFX_PointF(fX - 4, fY));
path.LineTo(CFX_PointF(fX - 4, fY + fPawLen));
path.MoveTo(CFX_PointF(fX - 2, fY));
@@ -212,8 +212,8 @@ void CFWL_ScrollBarTP::DrawTrack(CFX_Graphics* pGraphics,
pGraphics->SaveGraphState();
CFX_Color colorLine(ArgbEncode(255, 238, 237, 229));
CFX_Path path;
- FX_FLOAT fRight = pRect->right();
- FX_FLOAT fBottom = pRect->bottom();
+ float fRight = pRect->right();
+ float fBottom = pRect->bottom();
if (bVert) {
path.AddRectangle(pRect->left, pRect->top, 1, pRect->height);
path.AddRectangle(fRight - 1, pRect->top, 1, pRect->height);
@@ -226,10 +226,10 @@ void CFWL_ScrollBarTP::DrawTrack(CFX_Graphics* pGraphics,
path.Clear();
path.AddRectangle(pRect->left + 1, pRect->top, pRect->width - 2,
pRect->height);
- FX_FLOAT x1 = bVert ? pRect->left + 1 : pRect->left;
- FX_FLOAT y1 = bVert ? pRect->top : pRect->top + 1;
- FX_FLOAT x2 = bVert ? fRight - 1 : pRect->left;
- FX_FLOAT y2 = bVert ? pRect->top : fBottom - 1;
+ float x1 = bVert ? pRect->left + 1 : pRect->left;
+ float y1 = bVert ? pRect->top : pRect->top + 1;
+ float x2 = bVert ? fRight - 1 : pRect->left;
+ float y2 = bVert ? pRect->top : fBottom - 1;
pGraphics->RestoreGraphState();
DrawAxialShading(pGraphics, x1, y1, x2, y2, m_pThemeData->clrTrackBKStart,
m_pThemeData->clrTrackBKEnd, &path, FXFILL_WINDING, pMatrix);
diff --git a/chromium/third_party/pdfium/xfa/fwl/theme/cfwl_widgettp.cpp b/chromium/third_party/pdfium/xfa/fwl/theme/cfwl_widgettp.cpp
index fbcbcffb858..a45716ad6b7 100644
--- a/chromium/third_party/pdfium/xfa/fwl/theme/cfwl_widgettp.cpp
+++ b/chromium/third_party/pdfium/xfa/fwl/theme/cfwl_widgettp.cpp
@@ -10,7 +10,7 @@
#include <utility>
#include "third_party/base/ptr_util.h"
-#include "xfa/fde/tto/fde_textout.h"
+#include "xfa/fde/cfde_textout.h"
#include "xfa/fgas/font/cfgas_fontmgr.h"
#include "xfa/fgas/font/cfgas_gefont.h"
#include "xfa/fwl/cfwl_themebackground.h"
@@ -138,10 +138,10 @@ void CFWL_WidgetTP::FillSoildRect(CFX_Graphics* pGraphics,
}
void CFWL_WidgetTP::DrawAxialShading(CFX_Graphics* pGraphics,
- FX_FLOAT fx1,
- FX_FLOAT fy1,
- FX_FLOAT fx2,
- FX_FLOAT fy2,
+ float fx1,
+ float fy1,
+ float fx2,
+ float fy2,
FX_ARGB beginColor,
FX_ARGB endColor,
CFX_Path* path,
@@ -170,7 +170,7 @@ void CFWL_WidgetTP::DrawFocus(CFX_Graphics* pGraphics,
pGraphics->SaveGraphState();
CFX_Color cr(0xFF000000);
pGraphics->SetStrokeColor(&cr);
- FX_FLOAT DashPattern[2] = {1, 1};
+ float DashPattern[2] = {1, 1};
pGraphics->SetLineDash(0.0f, DashPattern, 2);
CFX_Path path;
path.AddRectangle(pRect->left, pRect->top, pRect->width, pRect->height);
@@ -185,10 +185,10 @@ void CFWL_WidgetTP::DrawArrow(CFX_Graphics* pGraphics,
CFX_Matrix* pMatrix) {
bool bVert =
(eDict == FWLTHEME_DIRECTION_Up || eDict == FWLTHEME_DIRECTION_Down);
- FX_FLOAT fLeft =
- (FX_FLOAT)(((pRect->width - (bVert ? 9 : 6)) / 2 + pRect->left) + 0.5);
- FX_FLOAT fTop =
- (FX_FLOAT)(((pRect->height - (bVert ? 6 : 9)) / 2 + pRect->top) + 0.5);
+ float fLeft =
+ (float)(((pRect->width - (bVert ? 9 : 6)) / 2 + pRect->left) + 0.5);
+ float fTop =
+ (float)(((pRect->height - (bVert ? 6 : 9)) / 2 + pRect->top) + 0.5);
CFX_Path path;
switch (eDict) {
case FWLTHEME_DIRECTION_Down: {
@@ -240,8 +240,8 @@ void CFWL_WidgetTP::DrawBtn(CFX_Graphics* pGraphics,
CFX_Path path;
InitializeArrowColorData();
- FX_FLOAT fRight = pRect->right();
- FX_FLOAT fBottom = pRect->bottom();
+ float fRight = pRect->right();
+ float fBottom = pRect->bottom();
path.AddRectangle(pRect->left, pRect->top, pRect->width, pRect->height);
DrawAxialShading(pGraphics, pRect->left, pRect->top, fRight, fBottom,
m_pColorData->clrStart[eState - 1],
diff --git a/chromium/third_party/pdfium/xfa/fwl/theme/cfwl_widgettp.h b/chromium/third_party/pdfium/xfa/fwl/theme/cfwl_widgettp.h
index c81950793a1..730a39cd17b 100644
--- a/chromium/third_party/pdfium/xfa/fwl/theme/cfwl_widgettp.h
+++ b/chromium/third_party/pdfium/xfa/fwl/theme/cfwl_widgettp.h
@@ -66,10 +66,10 @@ class CFWL_WidgetTP {
const CFX_RectF* pRect,
CFX_Matrix* pMatrix = nullptr);
void DrawAxialShading(CFX_Graphics* pGraphics,
- FX_FLOAT fx1,
- FX_FLOAT fy1,
- FX_FLOAT fx2,
- FX_FLOAT fy2,
+ float fx1,
+ float fy1,
+ float fx2,
+ float fy2,
FX_ARGB beginColor,
FX_ARGB endColor,
CFX_Path* path,
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/BC_Dimension.cpp b/chromium/third_party/pdfium/xfa/fxbarcode/BC_Dimension.cpp
deleted file mode 100644
index 0cb076ce22c..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/BC_Dimension.cpp
+++ /dev/null
@@ -1,46 +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
-// Original code is licensed as follows:
-/*
- * Copyright 2012 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "xfa/fxbarcode/BC_Dimension.h"
-#include "xfa/fxbarcode/datamatrix/BC_Encoder.h"
-
-CBC_Dimension::CBC_Dimension() {}
-CBC_Dimension::CBC_Dimension(int32_t width, int32_t height, int32_t& e) {
- if (width < 0 || height < 0) {
- e = BCExceptionHeightAndWidthMustBeAtLeast1;
- }
- m_width = width;
- m_height = height;
-}
-CBC_Dimension::~CBC_Dimension() {}
-int32_t CBC_Dimension::getWidth() {
- return m_width;
-}
-int32_t CBC_Dimension::getHeight() {
- return m_height;
-}
-int32_t CBC_Dimension::hashCode() {
- return m_width * 32713 + m_height;
-}
-CFX_WideString CBC_Dimension::toString() {
- return (FX_WCHAR)(m_width + (FX_WCHAR)'x' + m_height);
-}
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/BC_Dimension.h b/chromium/third_party/pdfium/xfa/fxbarcode/BC_Dimension.h
deleted file mode 100644
index 2050b0faaf1..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/BC_Dimension.h
+++ /dev/null
@@ -1,29 +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 XFA_FXBARCODE_BC_DIMENSION_H_
-#define XFA_FXBARCODE_BC_DIMENSION_H_
-
-#include <cstdint>
-
-#include "core/fxcrt/fx_string.h"
-
-class CBC_Dimension {
- public:
- CBC_Dimension();
- CBC_Dimension(int32_t width, int32_t height, int32_t& e);
- virtual ~CBC_Dimension();
- int32_t getWidth();
- int32_t getHeight();
- int32_t hashCode();
- CFX_WideString toString();
-
- private:
- int32_t m_width;
- int32_t m_height;
-};
-
-#endif // XFA_FXBARCODE_BC_DIMENSION_H_
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/BC_Library.cpp b/chromium/third_party/pdfium/xfa/fxbarcode/BC_Library.cpp
deleted file mode 100644
index 075bc2247d2..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/BC_Library.cpp
+++ /dev/null
@@ -1,36 +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
-
-#include "xfa/fxbarcode/BC_Library.h"
-
-#include <stdint.h>
-
-#include "xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.h"
-#include "xfa/fxbarcode/datamatrix/BC_ErrorCorrection.h"
-#include "xfa/fxbarcode/datamatrix/BC_SymbolInfo.h"
-#include "xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h"
-#include "xfa/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.h"
-#include "xfa/fxbarcode/qrcode/BC_QRCoderMode.h"
-#include "xfa/fxbarcode/qrcode/BC_QRCoderVersion.h"
-
-void BC_Library_Init() {
- CBC_QRCoderErrorCorrectionLevel::Initialize();
- CBC_QRCoderMode::Initialize();
- CBC_QRCoderVersion::Initialize();
- CBC_ReedSolomonGF256::Initialize();
- CBC_SymbolInfo::Initialize();
- CBC_ErrorCorrection::Initialize();
- CBC_PDF417HighLevelEncoder::Initialize();
-}
-void BC_Library_Destory() {
- CBC_QRCoderErrorCorrectionLevel::Finalize();
- CBC_QRCoderMode::Finalize();
- CBC_QRCoderVersion::Finalize();
- CBC_ReedSolomonGF256::Finalize();
- CBC_SymbolInfo::Finalize();
- CBC_ErrorCorrection::Finalize();
- CBC_PDF417HighLevelEncoder::Finalize();
-}
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/BC_Library.h b/chromium/third_party/pdfium/xfa/fxbarcode/BC_Library.h
deleted file mode 100644
index 47ef9d1532e..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/BC_Library.h
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright 2016 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef XFA_FXBARCODE_BC_LIBRARY_H_
-#define XFA_FXBARCODE_BC_LIBRARY_H_
-
-enum BC_TEXT_LOC {
- BC_TEXT_LOC_NONE = 0,
- BC_TEXT_LOC_ABOVE,
- BC_TEXT_LOC_BELOW,
- BC_TEXT_LOC_ABOVEEMBED,
- BC_TEXT_LOC_BELOWEMBED
-};
-
-enum BC_CHAR_ENCODING { CHAR_ENCODING_UTF8 = 0, CHAR_ENCODING_UNICODE };
-
-enum BC_TYPE {
- BC_UNKNOWN = -1,
- BC_CODE39 = 0,
- BC_CODABAR,
- BC_CODE128,
- BC_CODE128_B,
- BC_CODE128_C,
- BC_EAN8,
- BC_UPCA,
- BC_EAN13,
- BC_QR_CODE,
- BC_PDF417,
- BC_DATAMATRIX
-};
-
-void BC_Library_Init();
-void BC_Library_Destory();
-
-#endif // XFA_FXBARCODE_BC_LIBRARY_H_
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/BC_TwoDimWriter.cpp b/chromium/third_party/pdfium/xfa/fxbarcode/BC_TwoDimWriter.cpp
deleted file mode 100644
index b9aae361d64..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/BC_TwoDimWriter.cpp
+++ /dev/null
@@ -1,153 +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
-
-#include <algorithm>
-
-#include "core/fxge/cfx_graphstatedata.h"
-#include "core/fxge/cfx_pathdata.h"
-#include "core/fxge/cfx_renderdevice.h"
-#include "third_party/base/numerics/safe_math.h"
-#include "third_party/base/ptr_util.h"
-#include "xfa/fxbarcode/BC_TwoDimWriter.h"
-#include "xfa/fxbarcode/BC_Writer.h"
-#include "xfa/fxbarcode/common/BC_CommonBitMatrix.h"
-
-CBC_TwoDimWriter::CBC_TwoDimWriter() : m_iCorrectLevel(1), m_bFixedSize(true) {}
-
-CBC_TwoDimWriter::~CBC_TwoDimWriter() {}
-
-void CBC_TwoDimWriter::RenderDeviceResult(CFX_RenderDevice* device,
- const CFX_Matrix* matrix) {
- CFX_GraphStateData stateData;
- CFX_PathData path;
- path.AppendRect(0, 0, (FX_FLOAT)m_Width, (FX_FLOAT)m_Height);
- device->DrawPath(&path, matrix, &stateData, m_backgroundColor,
- m_backgroundColor, FXFILL_ALTERNATE);
- int32_t leftPos = 0;
- int32_t topPos = 0;
- if (m_bFixedSize) {
- leftPos = (m_Width - m_output->GetWidth()) / 2;
- topPos = (m_Height - m_output->GetHeight()) / 2;
- }
- CFX_Matrix matri = *matrix;
- if (m_Width < m_output->GetWidth() && m_Height < m_output->GetHeight()) {
- CFX_Matrix matriScale(
- (FX_FLOAT)m_Width / (FX_FLOAT)m_output->GetWidth(), 0.0, 0.0,
- (FX_FLOAT)m_Height / (FX_FLOAT)m_output->GetHeight(), 0.0, 0.0);
- matriScale.Concat(*matrix);
- matri = matriScale;
- }
- for (int32_t x = 0; x < m_output->GetWidth(); x++) {
- for (int32_t y = 0; y < m_output->GetHeight(); y++) {
- CFX_PathData rect;
- rect.AppendRect((FX_FLOAT)leftPos + x, (FX_FLOAT)topPos + y,
- (FX_FLOAT)(leftPos + x + 1), (FX_FLOAT)(topPos + y + 1));
- if (m_output->Get(x, y)) {
- CFX_GraphStateData data;
- device->DrawPath(&rect, &matri, &data, m_barColor, 0, FXFILL_WINDING);
- }
- }
- }
-}
-
-int32_t CBC_TwoDimWriter::GetErrorCorrectionLevel() const {
- return m_iCorrectLevel;
-}
-
-void CBC_TwoDimWriter::RenderBitmapResult(CFX_DIBitmap*& pOutBitmap,
- int32_t& e) {
- if (m_bFixedSize) {
- pOutBitmap = CreateDIBitmap(m_Width, m_Height);
- } else {
- pOutBitmap = CreateDIBitmap(m_output->GetWidth(), m_output->GetHeight());
- }
- if (!pOutBitmap) {
- e = BCExceptionFailToCreateBitmap;
- return;
- }
- pOutBitmap->Clear(m_backgroundColor);
- int32_t leftPos = 0;
- int32_t topPos = 0;
- if (m_bFixedSize) {
- leftPos = (m_Width - m_output->GetWidth()) / 2;
- topPos = (m_Height - m_output->GetHeight()) / 2;
- }
- for (int32_t x = 0; x < m_output->GetWidth(); x++) {
- for (int32_t y = 0; y < m_output->GetHeight(); y++) {
- if (m_output->Get(x, y)) {
- pOutBitmap->SetPixel(leftPos + x, topPos + y, m_barColor);
- }
- }
- }
- if (!m_bFixedSize) {
- std::unique_ptr<CFX_DIBitmap> pStretchBitmap =
- pOutBitmap->StretchTo(m_Width, m_Height);
- delete pOutBitmap;
- pOutBitmap = pStretchBitmap.release();
- }
-}
-
-void CBC_TwoDimWriter::RenderResult(uint8_t* code,
- int32_t codeWidth,
- int32_t codeHeight,
- int32_t& e) {
- int32_t inputWidth = codeWidth;
- int32_t inputHeight = codeHeight;
- int32_t tempWidth = inputWidth + 2;
- int32_t tempHeight = inputHeight + 2;
- FX_FLOAT moduleHSize = std::min(m_ModuleWidth, m_ModuleHeight);
- moduleHSize = std::min(moduleHSize, 8.0f);
- moduleHSize = std::max(moduleHSize, 1.0f);
- pdfium::base::CheckedNumeric<int32_t> scaledWidth = tempWidth;
- pdfium::base::CheckedNumeric<int32_t> scaledHeight = tempHeight;
- scaledWidth *= moduleHSize;
- scaledHeight *= moduleHSize;
-
- int32_t outputWidth = scaledWidth.ValueOrDie();
- int32_t outputHeight = scaledHeight.ValueOrDie();
- if (m_bFixedSize) {
- if (m_Width < outputWidth || m_Height < outputHeight) {
- e = BCExceptionBitmapSizeError;
- return;
- }
- } else {
- if (m_Width > outputWidth || m_Height > outputHeight) {
- outputWidth = (int32_t)(outputWidth *
- ceil((FX_FLOAT)m_Width / (FX_FLOAT)outputWidth));
- outputHeight = (int32_t)(
- outputHeight * ceil((FX_FLOAT)m_Height / (FX_FLOAT)outputHeight));
- }
- }
- int32_t multiX = (int32_t)ceil((FX_FLOAT)outputWidth / (FX_FLOAT)tempWidth);
- int32_t multiY = (int32_t)ceil((FX_FLOAT)outputHeight / (FX_FLOAT)tempHeight);
- if (m_bFixedSize) {
- multiX = std::min(multiX, multiY);
- multiY = multiX;
- }
- int32_t leftPadding = (outputWidth - (inputWidth * multiX)) / 2;
- int32_t topPadding = (outputHeight - (inputHeight * multiY)) / 2;
- if (leftPadding < 0) {
- leftPadding = 0;
- }
- if (topPadding < 0) {
- topPadding = 0;
- }
- m_output = pdfium::MakeUnique<CBC_CommonBitMatrix>();
- m_output->Init(outputWidth, outputHeight);
- for (int32_t inputY = 0, outputY = topPadding;
- (inputY < inputHeight) && (outputY < outputHeight - multiY);
- inputY++, outputY += multiY) {
- for (int32_t inputX = 0, outputX = leftPadding;
- (inputX < inputWidth) && (outputX < outputWidth - multiX);
- inputX++, outputX += multiX) {
- if (code[inputX + inputY * inputWidth] == 1) {
- m_output->SetRegion(outputX, outputY, multiX, multiY, e);
- if (e != BCExceptionNO)
- return;
- }
- }
- }
-}
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/BC_TwoDimWriter.h b/chromium/third_party/pdfium/xfa/fxbarcode/BC_TwoDimWriter.h
deleted file mode 100644
index ad4658b008c..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/BC_TwoDimWriter.h
+++ /dev/null
@@ -1,39 +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 XFA_FXBARCODE_BC_TWODIMWRITER_H_
-#define XFA_FXBARCODE_BC_TWODIMWRITER_H_
-
-#include <memory>
-
-#include "xfa/fxbarcode/BC_Writer.h"
-
-class CBC_CommonBitMatrix;
-class CFX_RenderDevice;
-
-class CBC_TwoDimWriter : public CBC_Writer {
- public:
- CBC_TwoDimWriter();
- ~CBC_TwoDimWriter() override;
-
- virtual void RenderResult(uint8_t* code,
- int32_t codeWidth,
- int32_t codeHeight,
- int32_t& e);
- virtual void RenderBitmapResult(CFX_DIBitmap*& pOutBitmap, int32_t& e);
- virtual void RenderDeviceResult(CFX_RenderDevice* device,
- const CFX_Matrix* matrix);
- virtual bool SetErrorCorrectionLevel(int32_t level) = 0;
-
- int32_t GetErrorCorrectionLevel() const;
-
- protected:
- int32_t m_iCorrectLevel;
- bool m_bFixedSize;
- std::unique_ptr<CBC_CommonBitMatrix> m_output;
-};
-
-#endif // XFA_FXBARCODE_BC_TWODIMWRITER_H_
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/BC_UtilCodingConvert.cpp b/chromium/third_party/pdfium/xfa/fxbarcode/BC_UtilCodingConvert.cpp
deleted file mode 100644
index c06cffc218a..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/BC_UtilCodingConvert.cpp
+++ /dev/null
@@ -1,54 +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
-
-#include "xfa/fxbarcode/BC_UtilCodingConvert.h"
-
-CBC_UtilCodingConvert::CBC_UtilCodingConvert() {}
-
-CBC_UtilCodingConvert::~CBC_UtilCodingConvert() {}
-
-void CBC_UtilCodingConvert::UnicodeToLocale(const CFX_WideString& src,
- CFX_ByteString& dst) {
- dst = CFX_ByteString::FromUnicode(src);
-}
-
-void CBC_UtilCodingConvert::LocaleToUtf8(const CFX_ByteString& src,
- CFX_ByteString& dst) {
- CFX_WideString unicode = CFX_WideString::FromLocal(src.AsStringC());
- dst = unicode.UTF8Encode();
-}
-
-void CBC_UtilCodingConvert::LocaleToUtf8(const CFX_ByteString& src,
- CFX_ArrayTemplate<uint8_t>& dst) {
- CFX_WideString unicode = CFX_WideString::FromLocal(src.AsStringC());
- CFX_ByteString utf8 = unicode.UTF8Encode();
- for (int32_t i = 0; i < utf8.GetLength(); i++) {
- dst.Add(utf8[i]);
- }
-}
-
-void CBC_UtilCodingConvert::Utf8ToLocale(const CFX_ArrayTemplate<uint8_t>& src,
- CFX_ByteString& dst) {
- CFX_ByteString utf8;
- for (int32_t i = 0; i < src.GetSize(); i++) {
- utf8 += src[i];
- }
- CFX_WideString unicode = CFX_WideString::FromUTF8(utf8.AsStringC());
- dst = CFX_ByteString::FromUnicode(unicode);
-}
-
-void CBC_UtilCodingConvert::Utf8ToLocale(const uint8_t* src,
- int32_t count,
- CFX_ByteString& dst) {
- CFX_WideString unicode =
- CFX_WideString::FromUTF8(CFX_ByteStringC(src, count));
- dst = CFX_ByteString::FromUnicode(unicode);
-}
-
-void CBC_UtilCodingConvert::UnicodeToUTF8(const CFX_WideString& src,
- CFX_ByteString& dst) {
- dst = src.UTF8Encode();
-}
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/BC_UtilCodingConvert.h b/chromium/third_party/pdfium/xfa/fxbarcode/BC_UtilCodingConvert.h
deleted file mode 100644
index 859eeea1e9c..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/BC_UtilCodingConvert.h
+++ /dev/null
@@ -1,31 +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 XFA_FXBARCODE_BC_UTILCODINGCONVERT_H_
-#define XFA_FXBARCODE_BC_UTILCODINGCONVERT_H_
-
-#include "core/fxcrt/fx_basic.h"
-
-class CBC_UtilCodingConvert {
- public:
- CBC_UtilCodingConvert();
- virtual ~CBC_UtilCodingConvert();
- static void UnicodeToLocale(const CFX_WideString& source,
- CFX_ByteString& result);
- static void LocaleToUtf8(const CFX_ByteString& source,
- CFX_ByteString& result);
- static void LocaleToUtf8(const CFX_ByteString& source,
- CFX_ArrayTemplate<uint8_t>& result);
- static void Utf8ToLocale(const CFX_ArrayTemplate<uint8_t>& source,
- CFX_ByteString& result);
- static void Utf8ToLocale(const uint8_t* source,
- int32_t count,
- CFX_ByteString& result);
- static void UnicodeToUTF8(const CFX_WideString& source,
- CFX_ByteString& result);
-};
-
-#endif // XFA_FXBARCODE_BC_UTILCODINGCONVERT_H_
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/BC_Utils.cpp b/chromium/third_party/pdfium/xfa/fxbarcode/BC_Utils.cpp
deleted file mode 100644
index 5d881c7be16..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/BC_Utils.cpp
+++ /dev/null
@@ -1,34 +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
-
-#include "core/fxcrt/fx_basic.h"
-#include "xfa/fxbarcode/utils.h"
-
-bool BC_FX_ByteString_Replace(CFX_ByteString& dst,
- uint32_t first,
- uint32_t last,
- int32_t count,
- FX_CHAR c) {
- if (first > last || count <= 0) {
- return false;
- }
- dst.Delete(first, last - first);
- for (int32_t i = 0; i < count; i++) {
- dst.Insert(0, c);
- }
- return true;
-}
-void BC_FX_ByteString_Append(CFX_ByteString& dst, int32_t count, FX_CHAR c) {
- for (int32_t i = 0; i < count; i++) {
- dst += c;
- }
-}
-void BC_FX_ByteString_Append(CFX_ByteString& dst,
- const CFX_ArrayTemplate<uint8_t>& ba) {
- for (int32_t i = 0; i < ba.GetSize(); i++) {
- dst += ba[i];
- }
-}
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/BC_Writer.cpp b/chromium/third_party/pdfium/xfa/fxbarcode/BC_Writer.cpp
deleted file mode 100644
index 73163522cb1..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/BC_Writer.cpp
+++ /dev/null
@@ -1,56 +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
-
-#include "xfa/fxbarcode/BC_Writer.h"
-
-CBC_Writer::CBC_Writer() {
- m_CharEncoding = 0;
- m_ModuleHeight = 1;
- m_ModuleWidth = 1;
- m_Height = 320;
- m_Width = 640;
- m_colorSpace = FXDIB_Argb;
- m_barColor = 0xff000000;
- m_backgroundColor = 0xffffffff;
-}
-CBC_Writer::~CBC_Writer() {}
-bool CBC_Writer::SetCharEncoding(int32_t encoding) {
- m_CharEncoding = encoding;
- return true;
-}
-bool CBC_Writer::SetModuleHeight(int32_t moduleHeight) {
- if (moduleHeight > 10 || moduleHeight < 1) {
- return false;
- }
- m_ModuleHeight = moduleHeight;
- return true;
-}
-bool CBC_Writer::SetModuleWidth(int32_t moduleWidth) {
- if (moduleWidth > 10 || moduleWidth < 1) {
- return false;
- }
- m_ModuleWidth = moduleWidth;
- return true;
-}
-bool CBC_Writer::SetHeight(int32_t height) {
- m_Height = height;
- return true;
-}
-bool CBC_Writer::SetWidth(int32_t width) {
- m_Width = width;
- return true;
-}
-void CBC_Writer::SetBackgroundColor(FX_ARGB backgroundColor) {
- m_backgroundColor = backgroundColor;
-}
-void CBC_Writer::SetBarcodeColor(FX_ARGB foregroundColor) {
- m_barColor = foregroundColor;
-}
-CFX_DIBitmap* CBC_Writer::CreateDIBitmap(int32_t width, int32_t height) {
- CFX_DIBitmap* pDIBitmap = new CFX_DIBitmap;
- pDIBitmap->Create(width, height, m_colorSpace);
- return pDIBitmap;
-}
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/BC_Writer.h b/chromium/third_party/pdfium/xfa/fxbarcode/BC_Writer.h
deleted file mode 100644
index 90ea06a3971..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/BC_Writer.h
+++ /dev/null
@@ -1,38 +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 XFA_FXBARCODE_BC_WRITER_H_
-#define XFA_FXBARCODE_BC_WRITER_H_
-
-#include "core/fxcrt/fx_string.h"
-#include "core/fxge/fx_dib.h"
-#include "xfa/fxbarcode/utils.h"
-
-class CBC_Writer {
- public:
- CBC_Writer();
- virtual ~CBC_Writer();
- virtual bool SetCharEncoding(int32_t encoding);
- virtual bool SetModuleHeight(int32_t moduleHeight);
- virtual bool SetModuleWidth(int32_t moduleWidth);
- virtual bool SetHeight(int32_t height);
- virtual bool SetWidth(int32_t width);
- virtual void SetBackgroundColor(FX_ARGB backgroundColor);
- virtual void SetBarcodeColor(FX_ARGB foregroundColor);
-
- protected:
- CFX_DIBitmap* CreateDIBitmap(int32_t width, int32_t height);
- int32_t m_CharEncoding;
- int32_t m_ModuleHeight;
- int32_t m_ModuleWidth;
- int32_t m_Height;
- int32_t m_Width;
- FXDIB_Format m_colorSpace;
- FX_ARGB m_barColor;
- FX_ARGB m_backgroundColor;
-};
-
-#endif // XFA_FXBARCODE_BC_WRITER_H_
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/DEPS b/chromium/third_party/pdfium/xfa/fxbarcode/DEPS
deleted file mode 100644
index 1519ceaa936..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/DEPS
+++ /dev/null
@@ -1,3 +0,0 @@
-include_rules = [
- '+core/fxcodec',
-]
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/cbc_codabar.cpp b/chromium/third_party/pdfium/xfa/fxbarcode/cbc_codabar.cpp
deleted file mode 100644
index 6f6ab4a96cc..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/cbc_codabar.cpp
+++ /dev/null
@@ -1,109 +0,0 @@
-// Copyright 2016 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-/*
- * Copyright 2011 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "xfa/fxbarcode/cbc_codabar.h"
-
-#include "xfa/fxbarcode/oned/BC_OnedCodaBarWriter.h"
-
-CBC_Codabar::CBC_Codabar() : CBC_OneCode(new CBC_OnedCodaBarWriter) {}
-
-CBC_Codabar::~CBC_Codabar() {}
-
-bool CBC_Codabar::SetStartChar(FX_CHAR start) {
- if (!m_pBCWriter)
- return false;
- return static_cast<CBC_OnedCodaBarWriter*>(m_pBCWriter.get())
- ->SetStartChar(start);
-}
-
-bool CBC_Codabar::SetEndChar(FX_CHAR end) {
- if (m_pBCWriter)
- return static_cast<CBC_OnedCodaBarWriter*>(m_pBCWriter.get())
- ->SetEndChar(end);
- return false;
-}
-
-bool CBC_Codabar::SetTextLocation(BC_TEXT_LOC location) {
- return static_cast<CBC_OnedCodaBarWriter*>(m_pBCWriter.get())
- ->SetTextLocation(location);
-}
-
-bool CBC_Codabar::SetWideNarrowRatio(int32_t ratio) {
- if (m_pBCWriter)
- return static_cast<CBC_OnedCodaBarWriter*>(m_pBCWriter.get())
- ->SetWideNarrowRatio(ratio);
- return false;
-}
-
-bool CBC_Codabar::Encode(const CFX_WideStringC& contents,
- bool isDevice,
- int32_t& e) {
- if (contents.IsEmpty()) {
- e = BCExceptionNoContents;
- return false;
- }
- BCFORMAT format = BCFORMAT_CODABAR;
- int32_t outWidth = 0;
- int32_t outHeight = 0;
- CFX_WideString filtercontents =
- static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())
- ->FilterContents(contents);
- CFX_ByteString byteString = filtercontents.UTF8Encode();
- m_renderContents = filtercontents;
- uint8_t* data = static_cast<CBC_OnedCodaBarWriter*>(m_pBCWriter.get())
- ->Encode(byteString, format, outWidth, outHeight, e);
- if (e != BCExceptionNO)
- return false;
- static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())
- ->RenderResult(filtercontents.AsStringC(), data, outWidth, isDevice, e);
- FX_Free(data);
- if (e != BCExceptionNO)
- return false;
- return true;
-}
-
-bool CBC_Codabar::RenderDevice(CFX_RenderDevice* device,
- const CFX_Matrix* matrix,
- int32_t& e) {
- CFX_WideString renderCon =
- static_cast<CBC_OnedCodaBarWriter*>(m_pBCWriter.get())
- ->encodedContents(m_renderContents.AsStringC());
- static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())
- ->RenderDeviceResult(device, matrix, renderCon.AsStringC(), e);
- if (e != BCExceptionNO)
- return false;
- return true;
-}
-
-bool CBC_Codabar::RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) {
- CFX_WideString renderCon =
- static_cast<CBC_OnedCodaBarWriter*>(m_pBCWriter.get())
- ->encodedContents(m_renderContents.AsStringC());
- static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())
- ->RenderBitmapResult(pOutBitmap, renderCon.AsStringC(), e);
- if (e != BCExceptionNO)
- return false;
- return true;
-}
-
-BC_TYPE CBC_Codabar::GetType() {
- return BC_CODABAR;
-}
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/cbc_codabar.h b/chromium/third_party/pdfium/xfa/fxbarcode/cbc_codabar.h
deleted file mode 100644
index 28631a9cb57..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/cbc_codabar.h
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright 2016 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef XFA_FXBARCODE_CBC_CODABAR_H_
-#define XFA_FXBARCODE_CBC_CODABAR_H_
-
-#include "core/fxcrt/fx_coordinates.h"
-#include "core/fxcrt/fx_system.h"
-#include "core/fxge/fx_dib.h"
-#include "xfa/fxbarcode/cbc_onecode.h"
-
-class CBC_Codabar : public CBC_OneCode {
- public:
- CBC_Codabar();
- ~CBC_Codabar() override;
-
- // CBC_OneCode:
- bool Encode(const CFX_WideStringC& contents,
- bool isDevice,
- int32_t& e) override;
- bool RenderDevice(CFX_RenderDevice* device,
- const CFX_Matrix* matrix,
- int32_t& e) override;
- bool RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) override;
- BC_TYPE GetType() override;
-
- bool SetStartChar(FX_CHAR start);
- bool SetEndChar(FX_CHAR end);
- bool SetTextLocation(BC_TEXT_LOC location);
- bool SetWideNarrowRatio(int32_t ratio);
-
- private:
- CFX_WideString m_renderContents;
-};
-
-#endif // XFA_FXBARCODE_CBC_CODABAR_H_
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/cbc_code128.cpp b/chromium/third_party/pdfium/xfa/fxbarcode/cbc_code128.cpp
deleted file mode 100644
index 35bd136fd05..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/cbc_code128.cpp
+++ /dev/null
@@ -1,92 +0,0 @@
-// Copyright 2016 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-/*
- * Copyright 2011 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "xfa/fxbarcode/cbc_code128.h"
-
-#include "xfa/fxbarcode/oned/BC_OnedCode128Writer.h"
-
-CBC_Code128::CBC_Code128(BC_TYPE type)
- : CBC_OneCode(new CBC_OnedCode128Writer(type)) {}
-
-CBC_Code128::~CBC_Code128() {}
-
-bool CBC_Code128::SetTextLocation(BC_TEXT_LOC location) {
- if (m_pBCWriter)
- return static_cast<CBC_OnedCode128Writer*>(m_pBCWriter.get())
- ->SetTextLocation(location);
- return false;
-}
-
-bool CBC_Code128::Encode(const CFX_WideStringC& contents,
- bool isDevice,
- int32_t& e) {
- if (contents.IsEmpty()) {
- e = BCExceptionNoContents;
- return false;
- }
- BCFORMAT format = BCFORMAT_CODE_128;
- int32_t outWidth = 0;
- int32_t outHeight = 0;
- CFX_WideString content(contents);
- if (contents.GetLength() % 2 &&
- static_cast<CBC_OnedCode128Writer*>(m_pBCWriter.get())->GetType() ==
- BC_CODE128_C) {
- content += '0';
- }
- CFX_WideString encodeContents =
- static_cast<CBC_OnedCode128Writer*>(m_pBCWriter.get())
- ->FilterContents(content.AsStringC());
- m_renderContents = encodeContents;
- CFX_ByteString byteString = encodeContents.UTF8Encode();
- uint8_t* data = static_cast<CBC_OnedCode128Writer*>(m_pBCWriter.get())
- ->Encode(byteString, format, outWidth, outHeight, e);
- if (e != BCExceptionNO)
- return false;
- static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())
- ->RenderResult(encodeContents.AsStringC(), data, outWidth, isDevice, e);
- FX_Free(data);
- if (e != BCExceptionNO)
- return false;
- return true;
-}
-
-bool CBC_Code128::RenderDevice(CFX_RenderDevice* device,
- const CFX_Matrix* matrix,
- int32_t& e) {
- static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())
- ->RenderDeviceResult(device, matrix, m_renderContents.AsStringC(), e);
- if (e != BCExceptionNO)
- return false;
- return true;
-}
-
-bool CBC_Code128::RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) {
- static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())
- ->RenderBitmapResult(pOutBitmap, m_renderContents.AsStringC(), e);
- if (e != BCExceptionNO)
- return false;
- return true;
-}
-
-BC_TYPE CBC_Code128::GetType() {
- return BC_CODE128;
-}
-
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/cbc_code128.h b/chromium/third_party/pdfium/xfa/fxbarcode/cbc_code128.h
deleted file mode 100644
index 0dd9c84f685..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/cbc_code128.h
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright 2016 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef XFA_FXBARCODE_CBC_CODE128_H_
-#define XFA_FXBARCODE_CBC_CODE128_H_
-
-#include "core/fxcrt/fx_coordinates.h"
-#include "core/fxcrt/fx_system.h"
-#include "core/fxge/fx_dib.h"
-#include "xfa/fxbarcode/cbc_onecode.h"
-
-class CBC_Code128 : public CBC_OneCode {
- public:
- explicit CBC_Code128(BC_TYPE type);
- ~CBC_Code128() override;
-
- // CBC_OneCode:
- bool Encode(const CFX_WideStringC& contents,
- bool isDevice,
- int32_t& e) override;
- bool RenderDevice(CFX_RenderDevice* device,
- const CFX_Matrix* matrix,
- int32_t& e) override;
- bool RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) override;
- BC_TYPE GetType() override;
-
- bool SetTextLocation(BC_TEXT_LOC loction);
-
- private:
- CFX_WideString m_renderContents;
-};
-
-#endif // XFA_FXBARCODE_CBC_CODE128_H_
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/cbc_code39.cpp b/chromium/third_party/pdfium/xfa/fxbarcode/cbc_code39.cpp
deleted file mode 100644
index af45ad40633..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/cbc_code39.cpp
+++ /dev/null
@@ -1,100 +0,0 @@
-// Copyright 2016 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-/*
- * Copyright 2011 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "xfa/fxbarcode/cbc_code39.h"
-
-#include "xfa/fxbarcode/oned/BC_OnedCode39Writer.h"
-
-CBC_Code39::CBC_Code39() : CBC_OneCode(new CBC_OnedCode39Writer) {}
-
-CBC_Code39::~CBC_Code39() {}
-
-bool CBC_Code39::Encode(const CFX_WideStringC& contents,
- bool isDevice,
- int32_t& e) {
- if (contents.IsEmpty()) {
- e = BCExceptionNoContents;
- return false;
- }
- BCFORMAT format = BCFORMAT_CODE_39;
- int32_t outWidth = 0;
- int32_t outHeight = 0;
- CFX_WideString filtercontents =
- static_cast<CBC_OnedCode39Writer*>(m_pBCWriter.get())
- ->FilterContents(contents);
- CFX_WideString renderContents =
- static_cast<CBC_OnedCode39Writer*>(m_pBCWriter.get())
- ->RenderTextContents(contents);
- m_renderContents = renderContents;
- CFX_ByteString byteString = filtercontents.UTF8Encode();
- uint8_t* data = static_cast<CBC_OnedCode39Writer*>(m_pBCWriter.get())
- ->Encode(byteString, format, outWidth, outHeight, e);
- if (e != BCExceptionNO)
- return false;
- static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())
- ->RenderResult(renderContents.AsStringC(), data, outWidth, isDevice, e);
- FX_Free(data);
- if (e != BCExceptionNO)
- return false;
- return true;
-}
-
-bool CBC_Code39::RenderDevice(CFX_RenderDevice* device,
- const CFX_Matrix* matrix,
- int32_t& e) {
- CFX_WideString renderCon =
- static_cast<CBC_OnedCode39Writer*>(m_pBCWriter.get())
- ->encodedContents(m_renderContents.AsStringC(), e);
- static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())
- ->RenderDeviceResult(device, matrix, renderCon.AsStringC(), e);
- if (e != BCExceptionNO)
- return false;
- return true;
-}
-
-bool CBC_Code39::RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) {
- CFX_WideString renderCon =
- static_cast<CBC_OnedCode39Writer*>(m_pBCWriter.get())
- ->encodedContents(m_renderContents.AsStringC(), e);
- static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())
- ->RenderBitmapResult(pOutBitmap, renderCon.AsStringC(), e);
- if (e != BCExceptionNO)
- return false;
- return true;
-}
-
-BC_TYPE CBC_Code39::GetType() {
- return BC_CODE39;
-}
-
-bool CBC_Code39::SetTextLocation(BC_TEXT_LOC location) {
- if (m_pBCWriter)
- return static_cast<CBC_OnedCode39Writer*>(m_pBCWriter.get())
- ->SetTextLocation(location);
- return false;
-}
-
-bool CBC_Code39::SetWideNarrowRatio(int32_t ratio) {
- if (m_pBCWriter)
- return static_cast<CBC_OnedCode39Writer*>(m_pBCWriter.get())
- ->SetWideNarrowRatio(ratio);
- return false;
-}
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/cbc_code39.h b/chromium/third_party/pdfium/xfa/fxbarcode/cbc_code39.h
deleted file mode 100644
index 7f5c627c6ca..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/cbc_code39.h
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright 2016 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef XFA_FXBARCODE_CBC_CODE39_H_
-#define XFA_FXBARCODE_CBC_CODE39_H_
-
-#include "core/fxcrt/fx_string.h"
-#include "core/fxcrt/fx_system.h"
-#include "core/fxge/fx_dib.h"
-#include "xfa/fxbarcode/cbc_onecode.h"
-
-class CBC_Code39 : public CBC_OneCode {
- public:
- CBC_Code39();
- ~CBC_Code39() override;
-
- // CBC_OneCode:
- bool Encode(const CFX_WideStringC& contents,
- bool isDevice,
- int32_t& e) override;
- bool RenderDevice(CFX_RenderDevice* device,
- const CFX_Matrix* matrix,
- int32_t& e) override;
- bool RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) override;
- BC_TYPE GetType() override;
-
- bool SetTextLocation(BC_TEXT_LOC location);
- bool SetWideNarrowRatio(int32_t ratio);
-
- private:
- CFX_WideString m_renderContents;
-};
-
-#endif // XFA_FXBARCODE_CBC_CODE39_H_
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/cbc_codebase.cpp b/chromium/third_party/pdfium/xfa/fxbarcode/cbc_codebase.cpp
deleted file mode 100644
index 5b4cb713bb8..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/cbc_codebase.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright 2016 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-/*
- * Copyright 2011 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "xfa/fxbarcode/cbc_codebase.h"
-
-#include "xfa/fxbarcode/BC_Writer.h"
-
-CBC_CodeBase::CBC_CodeBase(CBC_Writer* pWriter) : m_pBCWriter(pWriter) {}
-
-CBC_CodeBase::~CBC_CodeBase() {}
-
-bool CBC_CodeBase::SetCharEncoding(int32_t encoding) {
- return m_pBCWriter && m_pBCWriter->SetCharEncoding(encoding);
-}
-
-bool CBC_CodeBase::SetModuleHeight(int32_t moduleHeight) {
- return m_pBCWriter && m_pBCWriter->SetModuleHeight(moduleHeight);
-}
-
-bool CBC_CodeBase::SetModuleWidth(int32_t moduleWidth) {
- return m_pBCWriter && m_pBCWriter->SetModuleWidth(moduleWidth);
-}
-
-bool CBC_CodeBase::SetHeight(int32_t height) {
- return m_pBCWriter && m_pBCWriter->SetHeight(height);
-}
-
-bool CBC_CodeBase::SetWidth(int32_t width) {
- return m_pBCWriter && m_pBCWriter->SetWidth(width);
-}
-
-void CBC_CodeBase::SetBackgroundColor(FX_ARGB backgroundColor) {
- if (m_pBCWriter)
- m_pBCWriter->SetBackgroundColor(backgroundColor);
-}
-
-void CBC_CodeBase::SetBarcodeColor(FX_ARGB foregroundColor) {
- if (m_pBCWriter)
- m_pBCWriter->SetBarcodeColor(foregroundColor);
-}
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/cbc_codebase.h b/chromium/third_party/pdfium/xfa/fxbarcode/cbc_codebase.h
deleted file mode 100644
index c28c08b7e75..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/cbc_codebase.h
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright 2016 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef XFA_FXBARCODE_CBC_CODEBASE_H_
-#define XFA_FXBARCODE_CBC_CODEBASE_H_
-
-#include <memory>
-
-#include "core/fxcrt/fx_system.h"
-#include "core/fxge/fx_dib.h"
-#include "xfa/fxbarcode/BC_Library.h"
-
-class CBC_Writer;
-class CBC_Reader;
-class CFX_DIBitmap;
-class CFX_RenderDevice;
-
-class CBC_CodeBase {
- public:
- explicit CBC_CodeBase(CBC_Writer* pWriter);
- virtual ~CBC_CodeBase();
-
- virtual BC_TYPE GetType() = 0;
- virtual bool Encode(const CFX_WideStringC& contents,
- bool isDevice,
- int32_t& e) = 0;
- virtual bool RenderDevice(CFX_RenderDevice* device,
- const CFX_Matrix* matrix,
- int32_t& e) = 0;
- virtual bool RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) = 0;
-
- bool SetCharEncoding(int32_t encoding);
- bool SetModuleHeight(int32_t moduleHeight);
- bool SetModuleWidth(int32_t moduleWidth);
- bool SetHeight(int32_t height);
- bool SetWidth(int32_t width);
- void SetBackgroundColor(FX_ARGB backgroundColor);
- void SetBarcodeColor(FX_ARGB foregroundColor);
-
- protected:
- std::unique_ptr<CBC_Writer> m_pBCWriter;
-};
-
-#endif // XFA_FXBARCODE_CBC_CODEBASE_H_
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/cbc_datamatrix.cpp b/chromium/third_party/pdfium/xfa/fxbarcode/cbc_datamatrix.cpp
deleted file mode 100644
index 6122368e842..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/cbc_datamatrix.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-// Copyright 2016 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-/*
- * Copyright 2011 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "xfa/fxbarcode/cbc_datamatrix.h"
-
-#include "xfa/fxbarcode/datamatrix/BC_DataMatrixWriter.h"
-
-CBC_DataMatrix::CBC_DataMatrix() : CBC_CodeBase(new CBC_DataMatrixWriter) {}
-
-CBC_DataMatrix::~CBC_DataMatrix() {}
-
-bool CBC_DataMatrix::Encode(const CFX_WideStringC& contents,
- bool isDevice,
- int32_t& e) {
- int32_t outWidth = 0;
- int32_t outHeight = 0;
- uint8_t* data =
- static_cast<CBC_DataMatrixWriter*>(m_pBCWriter.get())
- ->Encode(CFX_WideString(contents), outWidth, outHeight, e);
- if (e != BCExceptionNO)
- return false;
- static_cast<CBC_TwoDimWriter*>(m_pBCWriter.get())
- ->RenderResult(data, outWidth, outHeight, e);
- FX_Free(data);
- if (e != BCExceptionNO)
- return false;
- return true;
-}
-
-bool CBC_DataMatrix::RenderDevice(CFX_RenderDevice* device,
- const CFX_Matrix* matrix,
- int32_t& e) {
- static_cast<CBC_TwoDimWriter*>(m_pBCWriter.get())
- ->RenderDeviceResult(device, matrix);
- return true;
-}
-
-bool CBC_DataMatrix::RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) {
- static_cast<CBC_TwoDimWriter*>(m_pBCWriter.get())
- ->RenderBitmapResult(pOutBitmap, e);
- if (e != BCExceptionNO)
- return false;
- return true;
-}
-
-BC_TYPE CBC_DataMatrix::GetType() {
- return BC_DATAMATRIX;
-}
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/cbc_datamatrix.h b/chromium/third_party/pdfium/xfa/fxbarcode/cbc_datamatrix.h
deleted file mode 100644
index 661b48d744f..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/cbc_datamatrix.h
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright 2016 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef XFA_FXBARCODE_CBC_DATAMATRIX_H_
-#define XFA_FXBARCODE_CBC_DATAMATRIX_H_
-
-#include "core/fxcrt/fx_string.h"
-#include "core/fxcrt/fx_system.h"
-#include "core/fxge/fx_dib.h"
-#include "xfa/fxbarcode/cbc_codebase.h"
-
-class CBC_DataMatrix : public CBC_CodeBase {
- public:
- CBC_DataMatrix();
- ~CBC_DataMatrix() override;
-
- // CBC_OneCode:
- bool Encode(const CFX_WideStringC& contents,
- bool isDevice,
- int32_t& e) override;
- bool RenderDevice(CFX_RenderDevice* device,
- const CFX_Matrix* matrix,
- int32_t& e) override;
- bool RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) override;
- BC_TYPE GetType() override;
-};
-
-#endif // XFA_FXBARCODE_CBC_DATAMATRIX_H_
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/cbc_ean13.cpp b/chromium/third_party/pdfium/xfa/fxbarcode/cbc_ean13.cpp
deleted file mode 100644
index 450fba04c9b..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/cbc_ean13.cpp
+++ /dev/null
@@ -1,96 +0,0 @@
-// Copyright 2016 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-/*
- * Copyright 2011 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "xfa/fxbarcode/cbc_ean13.h"
-
-#include "xfa/fxbarcode/oned/BC_OnedEAN13Writer.h"
-
-CBC_EAN13::CBC_EAN13() : CBC_OneCode(new CBC_OnedEAN13Writer) {}
-
-CBC_EAN13::~CBC_EAN13() {}
-
-CFX_WideString CBC_EAN13::Preprocess(const CFX_WideStringC& contents) {
- CFX_WideString encodeContents =
- static_cast<CBC_OnedEAN13Writer*>(m_pBCWriter.get())
- ->FilterContents(contents);
- int32_t length = encodeContents.GetLength();
- if (length <= 12) {
- for (int32_t i = 0; i < 12 - length; i++)
- encodeContents = FX_WCHAR('0') + encodeContents;
-
- CFX_ByteString byteString = encodeContents.UTF8Encode();
- int32_t checksum = static_cast<CBC_OnedEAN13Writer*>(m_pBCWriter.get())
- ->CalcChecksum(byteString);
- byteString += checksum - 0 + '0';
- encodeContents = byteString.UTF8Decode();
- }
- if (length > 13)
- encodeContents = encodeContents.Mid(0, 13);
-
- return encodeContents;
-}
-
-bool CBC_EAN13::Encode(const CFX_WideStringC& contents,
- bool isDevice,
- int32_t& e) {
- if (contents.IsEmpty()) {
- e = BCExceptionNoContents;
- return false;
- }
- BCFORMAT format = BCFORMAT_EAN_13;
- int32_t outWidth = 0;
- int32_t outHeight = 0;
- CFX_WideString encodeContents = Preprocess(contents);
- CFX_ByteString byteString = encodeContents.UTF8Encode();
- m_renderContents = encodeContents;
- uint8_t* data = static_cast<CBC_OnedEAN13Writer*>(m_pBCWriter.get())
- ->Encode(byteString, format, outWidth, outHeight, e);
- if (e != BCExceptionNO)
- return false;
- static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())
- ->RenderResult(encodeContents.AsStringC(), data, outWidth, isDevice, e);
- FX_Free(data);
- if (e != BCExceptionNO)
- return false;
- return true;
-}
-
-bool CBC_EAN13::RenderDevice(CFX_RenderDevice* device,
- const CFX_Matrix* matrix,
- int32_t& e) {
- static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())
- ->RenderDeviceResult(device, matrix, m_renderContents.AsStringC(), e);
- if (e != BCExceptionNO)
- return false;
- return true;
-}
-
-bool CBC_EAN13::RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) {
- static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())
- ->RenderBitmapResult(pOutBitmap, m_renderContents.AsStringC(), e);
- if (e != BCExceptionNO)
- return false;
- return true;
-}
-
-BC_TYPE CBC_EAN13::GetType() {
- return BC_EAN13;
-}
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/cbc_ean13.h b/chromium/third_party/pdfium/xfa/fxbarcode/cbc_ean13.h
deleted file mode 100644
index f0e7940a042..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/cbc_ean13.h
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright 2016 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef XFA_FXBARCODE_CBC_EAN13_H_
-#define XFA_FXBARCODE_CBC_EAN13_H_
-
-#include "core/fxcrt/fx_string.h"
-#include "core/fxcrt/fx_system.h"
-#include "core/fxge/fx_dib.h"
-#include "xfa/fxbarcode/cbc_onecode.h"
-
-class CBC_EAN13 : public CBC_OneCode {
- public:
- CBC_EAN13();
- ~CBC_EAN13() override;
-
- // CBC_OneCode:
- bool Encode(const CFX_WideStringC& contents,
- bool isDevice,
- int32_t& e) override;
- bool RenderDevice(CFX_RenderDevice* device,
- const CFX_Matrix* matrix,
- int32_t& e) override;
- bool RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) override;
- BC_TYPE GetType() override;
-
- private:
- CFX_WideString Preprocess(const CFX_WideStringC& contents);
- CFX_WideString m_renderContents;
-};
-
-#endif // XFA_FXBARCODE_CBC_EAN13_H_
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/cbc_ean8.cpp b/chromium/third_party/pdfium/xfa/fxbarcode/cbc_ean8.cpp
deleted file mode 100644
index 64ba617331f..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/cbc_ean8.cpp
+++ /dev/null
@@ -1,95 +0,0 @@
-// Copyright 2016 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-/*
- * Copyright 2011 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "xfa/fxbarcode/cbc_ean8.h"
-
-#include "xfa/fxbarcode/oned/BC_OnedEAN8Writer.h"
-
-CBC_EAN8::CBC_EAN8() : CBC_OneCode(new CBC_OnedEAN8Writer) {}
-
-CBC_EAN8::~CBC_EAN8() {}
-
-CFX_WideString CBC_EAN8::Preprocess(const CFX_WideStringC& contents) {
- CFX_WideString encodeContents =
- static_cast<CBC_OnedEAN8Writer*>(m_pBCWriter.get())
- ->FilterContents(contents);
- int32_t length = encodeContents.GetLength();
- if (length <= 7) {
- for (int32_t i = 0; i < 7 - length; i++)
- encodeContents = FX_WCHAR('0') + encodeContents;
-
- CFX_ByteString byteString = encodeContents.UTF8Encode();
- int32_t checksum = static_cast<CBC_OnedEAN8Writer*>(m_pBCWriter.get())
- ->CalcChecksum(byteString);
- encodeContents += FX_WCHAR(checksum - 0 + '0');
- }
- if (length > 8)
- encodeContents = encodeContents.Mid(0, 8);
-
- return encodeContents;
-}
-
-bool CBC_EAN8::Encode(const CFX_WideStringC& contents,
- bool isDevice,
- int32_t& e) {
- if (contents.IsEmpty()) {
- e = BCExceptionNoContents;
- return false;
- }
- BCFORMAT format = BCFORMAT_EAN_8;
- int32_t outWidth = 0;
- int32_t outHeight = 0;
- CFX_WideString encodeContents = Preprocess(contents);
- CFX_ByteString byteString = encodeContents.UTF8Encode();
- m_renderContents = encodeContents;
- uint8_t* data = static_cast<CBC_OnedEAN8Writer*>(m_pBCWriter.get())
- ->Encode(byteString, format, outWidth, outHeight, e);
- if (e != BCExceptionNO)
- return false;
- static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())
- ->RenderResult(encodeContents.AsStringC(), data, outWidth, isDevice, e);
- FX_Free(data);
- if (e != BCExceptionNO)
- return false;
- return true;
-}
-
-bool CBC_EAN8::RenderDevice(CFX_RenderDevice* device,
- const CFX_Matrix* matrix,
- int32_t& e) {
- static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())
- ->RenderDeviceResult(device, matrix, m_renderContents.AsStringC(), e);
- if (e != BCExceptionNO)
- return false;
- return true;
-}
-
-bool CBC_EAN8::RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) {
- static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())
- ->RenderBitmapResult(pOutBitmap, m_renderContents.AsStringC(), e);
- if (e != BCExceptionNO)
- return false;
- return true;
-}
-
-BC_TYPE CBC_EAN8::GetType() {
- return BC_EAN8;
-}
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/cbc_ean8.h b/chromium/third_party/pdfium/xfa/fxbarcode/cbc_ean8.h
deleted file mode 100644
index 6a475cb795c..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/cbc_ean8.h
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright 2016 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef XFA_FXBARCODE_CBC_EAN8_H_
-#define XFA_FXBARCODE_CBC_EAN8_H_
-
-#include "core/fxcrt/fx_string.h"
-#include "core/fxcrt/fx_system.h"
-#include "core/fxge/fx_dib.h"
-#include "xfa/fxbarcode/cbc_onecode.h"
-
-class CBC_EAN8 : public CBC_OneCode {
- public:
- CBC_EAN8();
- ~CBC_EAN8() override;
-
- // CBC_OneCode:
- bool Encode(const CFX_WideStringC& contents,
- bool isDevice,
- int32_t& e) override;
- bool RenderDevice(CFX_RenderDevice* device,
- const CFX_Matrix* matrix,
- int32_t& e) override;
- bool RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) override;
- BC_TYPE GetType() override;
-
- private:
- CFX_WideString Preprocess(const CFX_WideStringC& contents);
- CFX_WideString m_renderContents;
-};
-
-#endif // XFA_FXBARCODE_CBC_EAN8_H_
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/cbc_onecode.cpp b/chromium/third_party/pdfium/xfa/fxbarcode/cbc_onecode.cpp
deleted file mode 100644
index 55c2837bd49..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/cbc_onecode.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-// Copyright 2016 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-/*
- * Copyright 2011 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "xfa/fxbarcode/cbc_onecode.h"
-
-#include "xfa/fxbarcode/oned/BC_OneDimWriter.h"
-
-CBC_OneCode::CBC_OneCode(CBC_Writer* pWriter) : CBC_CodeBase(pWriter) {}
-
-CBC_OneCode::~CBC_OneCode() {}
-
-bool CBC_OneCode::CheckContentValidity(const CFX_WideStringC& contents) {
- return m_pBCWriter &&
- static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())
- ->CheckContentValidity(contents);
-}
-
-CFX_WideString CBC_OneCode::FilterContents(const CFX_WideStringC& contents) {
- if (!m_pBCWriter)
- return CFX_WideString();
- return static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())
- ->FilterContents(contents);
-}
-
-void CBC_OneCode::SetPrintChecksum(bool checksum) {
- if (m_pBCWriter)
- static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())
- ->SetPrintChecksum(checksum);
-}
-
-void CBC_OneCode::SetDataLength(int32_t length) {
- if (m_pBCWriter)
- static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())->SetDataLength(length);
-}
-
-void CBC_OneCode::SetCalChecksum(bool calc) {
- if (m_pBCWriter)
- static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())->SetCalcChecksum(calc);
-}
-
-bool CBC_OneCode::SetFont(CFX_Font* cFont) {
- if (m_pBCWriter)
- return static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())->SetFont(cFont);
- return false;
-}
-
-void CBC_OneCode::SetFontSize(FX_FLOAT size) {
- if (m_pBCWriter)
- static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())->SetFontSize(size);
-}
-
-void CBC_OneCode::SetFontStyle(int32_t style) {
- if (m_pBCWriter)
- static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())->SetFontStyle(style);
-}
-
-void CBC_OneCode::SetFontColor(FX_ARGB color) {
- if (m_pBCWriter)
- static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())->SetFontColor(color);
-}
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/cbc_onecode.h b/chromium/third_party/pdfium/xfa/fxbarcode/cbc_onecode.h
deleted file mode 100644
index e348b4ee2c4..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/cbc_onecode.h
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright 2016 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef XFA_FXBARCODE_CBC_ONECODE_H_
-#define XFA_FXBARCODE_CBC_ONECODE_H_
-
-#include "core/fxcrt/fx_string.h"
-#include "core/fxcrt/fx_system.h"
-#include "xfa/fxbarcode/cbc_codebase.h"
-
-class CFX_DIBitmap;
-class CFX_Font;
-class CFX_RenderDevice;
-
-class CBC_OneCode : public CBC_CodeBase {
- public:
- explicit CBC_OneCode(CBC_Writer* pWriter);
- ~CBC_OneCode() override;
-
- virtual bool CheckContentValidity(const CFX_WideStringC& contents);
- virtual CFX_WideString FilterContents(const CFX_WideStringC& contents);
-
- virtual void SetPrintChecksum(bool checksum);
- virtual void SetDataLength(int32_t length);
- virtual void SetCalChecksum(bool calc);
- virtual bool SetFont(CFX_Font* cFont);
- virtual void SetFontSize(FX_FLOAT size);
- virtual void SetFontStyle(int32_t style);
- virtual void SetFontColor(FX_ARGB color);
-};
-
-#endif // XFA_FXBARCODE_CBC_ONECODE_H_
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/cbc_pdf417i.cpp b/chromium/third_party/pdfium/xfa/fxbarcode/cbc_pdf417i.cpp
deleted file mode 100644
index 1c5547d445e..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/cbc_pdf417i.cpp
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright 2016 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-/*
- * Copyright 2011 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "xfa/fxbarcode/cbc_pdf417i.h"
-
-#include "xfa/fxbarcode/pdf417/BC_PDF417Writer.h"
-
-CBC_PDF417I::CBC_PDF417I() : CBC_CodeBase(new CBC_PDF417Writer) {}
-
-CBC_PDF417I::~CBC_PDF417I() {}
-
-bool CBC_PDF417I::SetErrorCorrectionLevel(int32_t level) {
- static_cast<CBC_PDF417Writer*>(m_pBCWriter.get())
- ->SetErrorCorrectionLevel(level);
- return true;
-}
-
-void CBC_PDF417I::SetTruncated(bool truncated) {
- static_cast<CBC_PDF417Writer*>(m_pBCWriter.get())->SetTruncated(truncated);
-}
-
-bool CBC_PDF417I::Encode(const CFX_WideStringC& contents,
- bool isDevice,
- int32_t& e) {
- int32_t outWidth = 0;
- int32_t outHeight = 0;
- uint8_t* data =
- static_cast<CBC_PDF417Writer*>(m_pBCWriter.get())
- ->Encode(CFX_WideString(contents), outWidth, outHeight, e);
- if (e != BCExceptionNO)
- return false;
- static_cast<CBC_TwoDimWriter*>(m_pBCWriter.get())
- ->RenderResult(data, outWidth, outHeight, e);
- FX_Free(data);
- if (e != BCExceptionNO)
- return false;
- return true;
-}
-
-bool CBC_PDF417I::RenderDevice(CFX_RenderDevice* device,
- const CFX_Matrix* matrix,
- int32_t& e) {
- static_cast<CBC_TwoDimWriter*>(m_pBCWriter.get())
- ->RenderDeviceResult(device, matrix);
- return true;
-}
-
-bool CBC_PDF417I::RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) {
- static_cast<CBC_TwoDimWriter*>(m_pBCWriter.get())
- ->RenderBitmapResult(pOutBitmap, e);
- if (e != BCExceptionNO)
- return false;
- return true;
-}
-
-BC_TYPE CBC_PDF417I::GetType() {
- return BC_PDF417;
-}
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/cbc_pdf417i.h b/chromium/third_party/pdfium/xfa/fxbarcode/cbc_pdf417i.h
deleted file mode 100644
index 70ea9298209..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/cbc_pdf417i.h
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright 2016 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef XFA_FXBARCODE_CBC_PDF417I_H_
-#define XFA_FXBARCODE_CBC_PDF417I_H_
-
-#include "core/fxcrt/fx_string.h"
-#include "core/fxcrt/fx_system.h"
-#include "core/fxge/fx_dib.h"
-#include "xfa/fxbarcode/cbc_codebase.h"
-
-class CBC_PDF417I : public CBC_CodeBase {
- public:
- CBC_PDF417I();
- ~CBC_PDF417I() override;
-
- // CBC_CodeBase::
- bool Encode(const CFX_WideStringC& contents,
- bool isDevice,
- int32_t& e) override;
- bool RenderDevice(CFX_RenderDevice* device,
- const CFX_Matrix* matrix,
- int32_t& e) override;
- bool RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) override;
- BC_TYPE GetType() override;
-
- bool SetErrorCorrectionLevel(int32_t level);
- void SetTruncated(bool truncated);
-};
-
-#endif // XFA_FXBARCODE_CBC_PDF417I_H_
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/cbc_qrcode.cpp b/chromium/third_party/pdfium/xfa/fxbarcode/cbc_qrcode.cpp
deleted file mode 100644
index 26b74ca4008..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/cbc_qrcode.cpp
+++ /dev/null
@@ -1,82 +0,0 @@
-// Copyright 2016 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-/*
- * Copyright 2011 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "xfa/fxbarcode/cbc_qrcode.h"
-
-#include "xfa/fxbarcode/qrcode/BC_QRCodeWriter.h"
-
-CBC_QRCode::CBC_QRCode() : CBC_CodeBase(new CBC_QRCodeWriter) {}
-
-CBC_QRCode::~CBC_QRCode() {}
-
-bool CBC_QRCode::SetVersion(int32_t version) {
- if (version < 0 || version > 40)
- return false;
- return m_pBCWriter &&
- static_cast<CBC_QRCodeWriter*>(m_pBCWriter.get())->SetVersion(version);
-}
-
-bool CBC_QRCode::SetErrorCorrectionLevel(int32_t level) {
- if (level < 0 || level > 3)
- return false;
-
- return m_pBCWriter &&
- static_cast<CBC_TwoDimWriter*>(m_pBCWriter.get())
- ->SetErrorCorrectionLevel(level);
-}
-
-bool CBC_QRCode::Encode(const CFX_WideStringC& contents,
- bool isDevice,
- int32_t& e) {
- int32_t outWidth = 0;
- int32_t outHeight = 0;
- CBC_QRCodeWriter* pWriter = static_cast<CBC_QRCodeWriter*>(m_pBCWriter.get());
- uint8_t* data = pWriter->Encode(CFX_WideString(contents),
- pWriter->GetErrorCorrectionLevel(), outWidth,
- outHeight, e);
- if (e != BCExceptionNO)
- return false;
- pWriter->RenderResult(data, outWidth, outHeight, e);
- FX_Free(data);
- if (e != BCExceptionNO)
- return false;
- return true;
-}
-
-bool CBC_QRCode::RenderDevice(CFX_RenderDevice* device,
- const CFX_Matrix* matrix,
- int32_t& e) {
- static_cast<CBC_TwoDimWriter*>(m_pBCWriter.get())
- ->RenderDeviceResult(device, matrix);
- return true;
-}
-
-bool CBC_QRCode::RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) {
- static_cast<CBC_TwoDimWriter*>(m_pBCWriter.get())
- ->RenderBitmapResult(pOutBitmap, e);
- if (e != BCExceptionNO)
- return false;
- return true;
-}
-
-BC_TYPE CBC_QRCode::GetType() {
- return BC_QR_CODE;
-}
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/cbc_qrcode.h b/chromium/third_party/pdfium/xfa/fxbarcode/cbc_qrcode.h
deleted file mode 100644
index ac2d93d9151..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/cbc_qrcode.h
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright 2016 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef XFA_FXBARCODE_CBC_QRCODE_H_
-#define XFA_FXBARCODE_CBC_QRCODE_H_
-
-#include "core/fxcrt/fx_string.h"
-#include "core/fxcrt/fx_system.h"
-#include "core/fxge/fx_dib.h"
-#include "xfa/fxbarcode/cbc_codebase.h"
-
-class CBC_QRCode : public CBC_CodeBase {
- public:
- CBC_QRCode();
- ~CBC_QRCode() override;
-
- // CBC_CodeBase:
- bool Encode(const CFX_WideStringC& contents,
- bool isDevice,
- int32_t& e) override;
- bool RenderDevice(CFX_RenderDevice* device,
- const CFX_Matrix* matrix,
- int32_t& e) override;
- bool RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) override;
- BC_TYPE GetType() override;
-
- bool SetVersion(int32_t version);
- bool SetErrorCorrectionLevel(int32_t level);
-};
-
-#endif // XFA_FXBARCODE_CBC_QRCODE_H_
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/cbc_upca.cpp b/chromium/third_party/pdfium/xfa/fxbarcode/cbc_upca.cpp
deleted file mode 100644
index b282d5cd791..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/cbc_upca.cpp
+++ /dev/null
@@ -1,99 +0,0 @@
-// Copyright 2016 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-/*
- * Copyright 2011 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "xfa/fxbarcode/cbc_upca.h"
-
-#include "xfa/fxbarcode/oned/BC_OnedUPCAWriter.h"
-
-CBC_UPCA::CBC_UPCA() : CBC_OneCode(new CBC_OnedUPCAWriter) {}
-
-CBC_UPCA::~CBC_UPCA() {}
-
-CFX_WideString CBC_UPCA::Preprocess(const CFX_WideStringC& contents) {
- CBC_OnedUPCAWriter* pWriter =
- static_cast<CBC_OnedUPCAWriter*>(m_pBCWriter.get());
- CFX_WideString encodeContents = pWriter->FilterContents(contents);
- int32_t length = encodeContents.GetLength();
- if (length <= 11) {
- for (int32_t i = 0; i < 11 - length; i++)
- encodeContents = FX_WCHAR('0') + encodeContents;
-
- CFX_ByteString byteString = encodeContents.UTF8Encode();
- int32_t checksum = pWriter->CalcChecksum(byteString);
- byteString += checksum - 0 + '0';
- encodeContents = byteString.UTF8Decode();
- }
- if (length > 12)
- encodeContents = encodeContents.Mid(0, 12);
-
- return encodeContents;
-}
-
-bool CBC_UPCA::Encode(const CFX_WideStringC& contents,
- bool isDevice,
- int32_t& e) {
- if (contents.IsEmpty()) {
- e = BCExceptionNoContents;
- return false;
- }
- BCFORMAT format = BCFORMAT_UPC_A;
- int32_t outWidth = 0;
- int32_t outHeight = 0;
- CFX_WideString encodeContents = Preprocess(contents);
- CFX_ByteString byteString = encodeContents.UTF8Encode();
- m_renderContents = encodeContents;
-
- CBC_OnedUPCAWriter* pWriter =
- static_cast<CBC_OnedUPCAWriter*>(m_pBCWriter.get());
-
- pWriter->Init();
- uint8_t* data = pWriter->Encode(byteString, format, outWidth, outHeight, e);
- if (e != BCExceptionNO)
- return false;
- pWriter->RenderResult(encodeContents.AsStringC(), data, outWidth, isDevice,
- e);
- FX_Free(data);
- if (e != BCExceptionNO)
- return false;
- return true;
-}
-
-bool CBC_UPCA::RenderDevice(CFX_RenderDevice* device,
- const CFX_Matrix* matrix,
- int32_t& e) {
- static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())
- ->RenderDeviceResult(device, matrix, m_renderContents.AsStringC(), e);
- if (e != BCExceptionNO)
- return false;
- return true;
-}
-
-bool CBC_UPCA::RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) {
- static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())
- ->RenderBitmapResult(pOutBitmap, m_renderContents.AsStringC(), e);
- if (e != BCExceptionNO)
- return false;
- return true;
-}
-
-BC_TYPE CBC_UPCA::GetType() {
- return BC_UPCA;
-}
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/cbc_upca.h b/chromium/third_party/pdfium/xfa/fxbarcode/cbc_upca.h
deleted file mode 100644
index bf90b922b50..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/cbc_upca.h
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright 2016 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef XFA_FXBARCODE_CBC_UPCA_H_
-#define XFA_FXBARCODE_CBC_UPCA_H_
-
-#include "core/fxcrt/fx_string.h"
-#include "core/fxcrt/fx_system.h"
-#include "core/fxge/fx_dib.h"
-#include "xfa/fxbarcode/cbc_onecode.h"
-
-class CBC_UPCA : public CBC_OneCode {
- public:
- CBC_UPCA();
- ~CBC_UPCA() override;
-
- // CBC_CodeBase
- bool Encode(const CFX_WideStringC& contents,
- bool isDevice,
- int32_t& e) override;
- bool RenderDevice(CFX_RenderDevice* device,
- const CFX_Matrix* matrix,
- int32_t& e) override;
- bool RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) override;
- BC_TYPE GetType() override;
-
- private:
- CFX_WideString Preprocess(const CFX_WideStringC& contents);
- CFX_WideString m_renderContents;
-};
-
-#endif // XFA_FXBARCODE_CBC_UPCA_H_
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/common/BC_CommonBitArray.cpp b/chromium/third_party/pdfium/xfa/fxbarcode/common/BC_CommonBitArray.cpp
deleted file mode 100644
index 0371837fdec..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/common/BC_CommonBitArray.cpp
+++ /dev/null
@@ -1,113 +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
-// Original code is licensed as follows:
-/*
- * Copyright 2007 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "xfa/fxbarcode/common/BC_CommonBitArray.h"
-#include "xfa/fxbarcode/utils.h"
-
-CBC_CommonBitArray::CBC_CommonBitArray(CBC_CommonBitArray* array) {
- m_size = array->GetSize();
- m_bits.Copy(array->GetBits());
-}
-CBC_CommonBitArray::CBC_CommonBitArray() {
- m_bits.SetSize(1);
- m_size = 0;
-}
-CBC_CommonBitArray::CBC_CommonBitArray(int32_t size) {
- m_bits.SetSize((size + 31) >> 5);
- m_size = size;
-}
-CBC_CommonBitArray::~CBC_CommonBitArray() {
- m_size = 0;
-}
-int32_t CBC_CommonBitArray::GetSize() {
- return m_size;
-}
-CFX_ArrayTemplate<int32_t>& CBC_CommonBitArray::GetBits() {
- return m_bits;
-}
-int32_t CBC_CommonBitArray::GetSizeInBytes() {
- return (m_size + 7) >> 3;
-}
-bool CBC_CommonBitArray::Get(int32_t i) {
- return (m_bits[i >> 5] & (1 << (i & 0x1f))) != 0;
-}
-void CBC_CommonBitArray::Set(int32_t i) {
- m_bits[i >> 5] |= 1 << (i & 0x1F);
-}
-void CBC_CommonBitArray::Flip(int32_t i) {
- m_bits[i >> 5] ^= 1 << (i & 0x1F);
-}
-void CBC_CommonBitArray::SetBulk(int32_t i, int32_t newBits) {
- m_bits[i >> 5] = newBits;
-}
-void CBC_CommonBitArray::Clear() {
- FXSYS_memset(&m_bits[0], 0x00, m_bits.GetSize() * sizeof(int32_t));
-}
-bool CBC_CommonBitArray::IsRange(int32_t start,
- int32_t end,
- bool value,
- int32_t& e) {
- if (end < start) {
- e = BCExceptionEndLessThanStart;
- return false;
- }
- if (end == start) {
- return true;
- }
- end--;
- int32_t firstInt = start >> 5;
- int32_t lastInt = end >> 5;
- int32_t i;
- for (i = firstInt; i <= lastInt; i++) {
- int32_t firstBit = i > firstInt ? 0 : start & 0x1F;
- int32_t lastBit = i < lastInt ? 31 : end & 0x1F;
- int32_t mask;
- if (firstBit == 0 && lastBit == 31) {
- mask = -1;
- } else {
- mask = 0;
- for (int32_t j = firstBit; j <= lastBit; j++) {
- mask |= 1 << j;
- }
- }
- if ((m_bits[i] & mask) != (value ? mask : 0)) {
- return false;
- }
- }
- return true;
-}
-int32_t* CBC_CommonBitArray::GetBitArray() {
- return &m_bits[0];
-}
-void CBC_CommonBitArray::Reverse() {
- int32_t* newBits = FX_Alloc(int32_t, m_bits.GetSize());
- FXSYS_memset(newBits, 0x00, m_bits.GetSize() * sizeof(int32_t));
- int32_t size = m_size;
- int32_t i;
- for (i = 0; i < size; i++) {
- if (Get(size - i - 1)) {
- newBits[i >> 5] |= 1 << (i & 0x1F);
- }
- }
- FXSYS_memcpy(&m_bits[0], newBits, m_bits.GetSize() * sizeof(int32_t));
- FX_Free(newBits);
-}
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/common/BC_CommonBitArray.h b/chromium/third_party/pdfium/xfa/fxbarcode/common/BC_CommonBitArray.h
deleted file mode 100644
index 6ad8ab321d8..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/common/BC_CommonBitArray.h
+++ /dev/null
@@ -1,36 +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 XFA_FXBARCODE_COMMON_BC_COMMONBITARRAY_H_
-#define XFA_FXBARCODE_COMMON_BC_COMMONBITARRAY_H_
-
-#include "core/fxcrt/fx_basic.h"
-
-class CBC_CommonBitArray {
- public:
- explicit CBC_CommonBitArray(CBC_CommonBitArray* array);
- explicit CBC_CommonBitArray(int32_t size);
- CBC_CommonBitArray();
- virtual ~CBC_CommonBitArray();
-
- int32_t GetSize();
- CFX_ArrayTemplate<int32_t>& GetBits();
- int32_t GetSizeInBytes();
- bool Get(int32_t i);
- void Set(int32_t i);
- void Flip(int32_t i);
- void SetBulk(int32_t i, int32_t newBits);
- bool IsRange(int32_t start, int32_t end, bool value, int32_t& e);
- int32_t* GetBitArray();
- void Reverse();
- void Clear();
-
- private:
- int32_t m_size;
- CFX_ArrayTemplate<int32_t> m_bits;
-};
-
-#endif // XFA_FXBARCODE_COMMON_BC_COMMONBITARRAY_H_
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/common/BC_CommonBitMatrix.cpp b/chromium/third_party/pdfium/xfa/fxbarcode/common/BC_CommonBitMatrix.cpp
deleted file mode 100644
index b9b218c60f3..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/common/BC_CommonBitMatrix.cpp
+++ /dev/null
@@ -1,146 +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
-// Original code is licensed as follows:
-/*
- * Copyright 2007 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "xfa/fxbarcode/common/BC_CommonBitArray.h"
-#include "xfa/fxbarcode/common/BC_CommonBitMatrix.h"
-#include "xfa/fxbarcode/utils.h"
-
-CBC_CommonBitMatrix::CBC_CommonBitMatrix() {
- m_width = 0;
- m_height = 0;
- m_rowSize = 0;
- m_bits = nullptr;
-}
-void CBC_CommonBitMatrix::Init(int32_t dimension) {
- m_width = dimension;
- m_height = dimension;
- int32_t rowSize = (m_height + 31) >> 5;
- m_rowSize = rowSize;
- m_bits = FX_Alloc2D(int32_t, m_rowSize, m_height);
- FXSYS_memset(m_bits, 0, m_rowSize * m_height * sizeof(int32_t));
-}
-void CBC_CommonBitMatrix::Init(int32_t width, int32_t height) {
- m_width = width;
- m_height = height;
- int32_t rowSize = (width + 31) >> 5;
- m_rowSize = rowSize;
- m_bits = FX_Alloc2D(int32_t, m_rowSize, m_height);
- FXSYS_memset(m_bits, 0, m_rowSize * m_height * sizeof(int32_t));
-}
-CBC_CommonBitMatrix::~CBC_CommonBitMatrix() {
- FX_Free(m_bits);
-}
-bool CBC_CommonBitMatrix::Get(int32_t x, int32_t y) {
- int32_t offset = y * m_rowSize + (x >> 5);
- if (offset >= m_rowSize * m_height || offset < 0) {
- return false;
- }
- return ((((uint32_t)m_bits[offset]) >> (x & 0x1f)) & 1) != 0;
-}
-int32_t* CBC_CommonBitMatrix::GetBits() {
- return m_bits;
-}
-void CBC_CommonBitMatrix::Set(int32_t x, int32_t y) {
- int32_t offset = y * m_rowSize + (x >> 5);
- if (offset >= m_rowSize * m_height || offset < 0) {
- return;
- }
- m_bits[offset] |= 1 << (x & 0x1f);
-}
-void CBC_CommonBitMatrix::Flip(int32_t x, int32_t y) {
- int32_t offset = y * m_rowSize + (x >> 5);
- m_bits[offset] ^= 1 << (x & 0x1f);
-}
-void CBC_CommonBitMatrix::Clear() {
- FXSYS_memset(m_bits, 0, m_rowSize * m_height * sizeof(int32_t));
-}
-void CBC_CommonBitMatrix::SetRegion(int32_t left,
- int32_t top,
- int32_t width,
- int32_t height,
- int32_t& e) {
- if (top < 0 || left < 0) {
- e = BCExceptionLeftAndTopMustBeNonnegative;
- return;
- }
- if (height < 1 || width < 1) {
- e = BCExceptionHeightAndWidthMustBeAtLeast1;
- return;
- }
- int32_t right = left + width;
- int32_t bottom = top + height;
- if (m_height < bottom || m_width < right) {
- e = BCExceptionRegionMustFitInsideMatrix;
- return;
- }
- int32_t y;
- for (y = top; y < bottom; y++) {
- int32_t offset = y * m_rowSize;
- int32_t x;
- for (x = left; x < right; x++) {
- m_bits[offset + (x >> 5)] |= 1 << (x & 0x1f);
- }
- }
-}
-CBC_CommonBitArray* CBC_CommonBitMatrix::GetRow(int32_t y,
- CBC_CommonBitArray* row) {
- CBC_CommonBitArray* rowArray = nullptr;
- if (!row || row->GetSize() < m_width) {
- rowArray = new CBC_CommonBitArray(m_width);
- } else {
- rowArray = new CBC_CommonBitArray(row);
- }
- int32_t offset = y * m_rowSize;
- int32_t x;
- for (x = 0; x < m_rowSize; x++) {
- rowArray->SetBulk(x << 5, m_bits[offset + x]);
- }
- return rowArray;
-}
-void CBC_CommonBitMatrix::SetRow(int32_t y, CBC_CommonBitArray* row) {
- int32_t l = y * m_rowSize;
- for (int32_t i = 0; i < m_rowSize; i++) {
- m_bits[l] = row->GetBitArray()[i];
- l++;
- }
-}
-void CBC_CommonBitMatrix::SetCol(int32_t y, CBC_CommonBitArray* col) {
- for (int32_t i = 0; i < col->GetBits().GetSize(); i++) {
- m_bits[i * m_rowSize + y] = col->GetBitArray()[i];
- }
-}
-int32_t CBC_CommonBitMatrix::GetWidth() {
- return m_width;
-}
-int32_t CBC_CommonBitMatrix::GetHeight() {
- return m_height;
-}
-int32_t CBC_CommonBitMatrix::GetRowSize() {
- return m_rowSize;
-}
-int32_t CBC_CommonBitMatrix::GetDimension(int32_t& e) {
- if (m_width != m_height) {
- e = BCExceptionCanNotCallGetDimensionOnNonSquareMatrix;
- return 0;
- }
- return m_width;
-}
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/common/BC_CommonBitMatrix.h b/chromium/third_party/pdfium/xfa/fxbarcode/common/BC_CommonBitMatrix.h
deleted file mode 100644
index ed1f684a375..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/common/BC_CommonBitMatrix.h
+++ /dev/null
@@ -1,48 +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 XFA_FXBARCODE_COMMON_BC_COMMONBITMATRIX_H_
-#define XFA_FXBARCODE_COMMON_BC_COMMONBITMATRIX_H_
-
-#include "core/fxcrt/fx_system.h"
-
-class CBC_CommonBitArray;
-
-class CBC_CommonBitMatrix {
- public:
- CBC_CommonBitMatrix();
- virtual ~CBC_CommonBitMatrix();
-
- virtual void Init(int32_t dimension);
- virtual void Init(int32_t width, int32_t height);
-
- bool Get(int32_t x, int32_t y);
- void Set(int32_t x, int32_t y);
- void Flip(int32_t x, int32_t y);
- void Clear();
- void SetRegion(int32_t left,
- int32_t top,
- int32_t width,
- int32_t height,
- int32_t& e);
- CBC_CommonBitArray* GetRow(int32_t y, CBC_CommonBitArray* row);
- void SetRow(int32_t y, CBC_CommonBitArray* row);
- CBC_CommonBitArray* GetCol(int32_t y, CBC_CommonBitArray* row);
- void SetCol(int32_t y, CBC_CommonBitArray* col);
- int32_t GetWidth();
- int32_t GetHeight();
- int32_t GetRowSize();
- int32_t GetDimension(int32_t& e);
- int32_t* GetBits();
-
- private:
- int32_t m_width;
- int32_t m_height;
- int32_t m_rowSize;
- int32_t* m_bits;
-};
-
-#endif // XFA_FXBARCODE_COMMON_BC_COMMONBITMATRIX_H_
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/common/BC_CommonByteArray.cpp b/chromium/third_party/pdfium/xfa/fxbarcode/common/BC_CommonByteArray.cpp
deleted file mode 100644
index 050ecb0bf84..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/common/BC_CommonByteArray.cpp
+++ /dev/null
@@ -1,99 +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
-// Original code is licensed as follows:
-/*
- * Copyright 2008 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <algorithm>
-
-#include "xfa/fxbarcode/common/BC_CommonByteArray.h"
-
-CBC_CommonByteArray::CBC_CommonByteArray() {
- m_bytes = nullptr;
- m_size = 0;
- m_index = 0;
-}
-CBC_CommonByteArray::CBC_CommonByteArray(int32_t size) {
- m_size = size;
- m_bytes = FX_Alloc(uint8_t, size);
- FXSYS_memset(m_bytes, 0, size);
- m_index = 0;
-}
-CBC_CommonByteArray::CBC_CommonByteArray(uint8_t* byteArray, int32_t size) {
- m_size = size;
- m_bytes = FX_Alloc(uint8_t, size);
- FXSYS_memcpy(m_bytes, byteArray, size);
- m_index = size;
-}
-CBC_CommonByteArray::~CBC_CommonByteArray() {
- FX_Free(m_bytes);
-}
-int32_t CBC_CommonByteArray::At(int32_t index) const {
- return m_bytes[index] & 0xff;
-}
-void CBC_CommonByteArray::Set(int32_t index, int32_t value) {
- m_bytes[index] = (uint8_t)value;
-}
-int32_t CBC_CommonByteArray::Size() const {
- return m_size;
-}
-bool CBC_CommonByteArray::IsEmpty() const {
- return m_size == 0;
-}
-void CBC_CommonByteArray::AppendByte(int32_t value) {
- if (m_size == 0 || m_index >= m_size) {
- int32_t newSize = std::max(32, m_size << 1);
- Reserve(newSize);
- }
- m_bytes[m_index] = (uint8_t)value;
- m_index++;
-}
-void CBC_CommonByteArray::Reserve(int32_t capacity) {
- if (!m_bytes || m_size < capacity) {
- uint8_t* newArray = FX_Alloc(uint8_t, capacity);
- if (m_bytes) {
- FXSYS_memcpy(newArray, m_bytes, m_size);
- FXSYS_memset(newArray + m_size, 0, capacity - m_size);
- } else {
- FXSYS_memset(newArray, 0, capacity);
- }
- FX_Free(m_bytes);
- m_bytes = newArray;
- m_size = capacity;
- }
-}
-void CBC_CommonByteArray::Set(uint8_t* source, int32_t offset, int32_t count) {
- FX_Free(m_bytes);
- m_bytes = FX_Alloc(uint8_t, count);
- m_size = count;
- FXSYS_memcpy(m_bytes, source + offset, count);
- m_index = count;
-}
-void CBC_CommonByteArray::Set(CFX_ArrayTemplate<uint8_t>* source,
- int32_t offset,
- int32_t count) {
- FX_Free(m_bytes);
- m_bytes = FX_Alloc(uint8_t, count);
- m_size = count;
- int32_t i;
- for (i = 0; i < count; i++) {
- m_bytes[i] = source->operator[](i + offset);
- }
- m_index = m_size;
-}
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/common/BC_CommonByteArray.h b/chromium/third_party/pdfium/xfa/fxbarcode/common/BC_CommonByteArray.h
deleted file mode 100644
index 009f625a864..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/common/BC_CommonByteArray.h
+++ /dev/null
@@ -1,36 +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 XFA_FXBARCODE_COMMON_BC_COMMONBYTEARRAY_H_
-#define XFA_FXBARCODE_COMMON_BC_COMMONBYTEARRAY_H_
-
-#include "core/fxcrt/fx_basic.h"
-
-// TODO(weili): The usage of this class should be replaced by
-// std::vector<uint8_t>.
-class CBC_CommonByteArray {
- public:
- CBC_CommonByteArray();
- explicit CBC_CommonByteArray(int32_t size);
- CBC_CommonByteArray(uint8_t* byteArray, int32_t size);
- virtual ~CBC_CommonByteArray();
-
- int32_t At(int32_t index) const;
- int32_t Size() const;
- bool IsEmpty() const;
- void Set(int32_t index, int32_t value);
- void AppendByte(int32_t value);
- void Reserve(int32_t capacity);
- void Set(uint8_t* source, int32_t offset, int32_t count);
- void Set(CFX_ArrayTemplate<uint8_t>* source, int32_t offset, int32_t count);
-
- private:
- int32_t m_size;
- int32_t m_index;
- uint8_t* m_bytes;
-};
-
-#endif // XFA_FXBARCODE_COMMON_BC_COMMONBYTEARRAY_H_
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/common/BC_CommonByteMatrix.cpp b/chromium/third_party/pdfium/xfa/fxbarcode/common/BC_CommonByteMatrix.cpp
deleted file mode 100644
index 0e7ce80e29c..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/common/BC_CommonByteMatrix.cpp
+++ /dev/null
@@ -1,64 +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
-// Original code is licensed as follows:
-/*
- * Copyright 2008 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "core/fxcrt/fx_memory.h"
-#include "xfa/fxbarcode/common/BC_CommonByteMatrix.h"
-
-CBC_CommonByteMatrix::CBC_CommonByteMatrix(int32_t width, int32_t height) {
- m_height = height;
- m_width = width;
- m_bytes = nullptr;
-}
-void CBC_CommonByteMatrix::Init() {
- m_bytes = FX_Alloc2D(uint8_t, m_height, m_width);
- FXSYS_memset(m_bytes, 0xff, m_height * m_width);
-}
-CBC_CommonByteMatrix::~CBC_CommonByteMatrix() {
- FX_Free(m_bytes);
-}
-int32_t CBC_CommonByteMatrix::GetHeight() {
- return m_height;
-}
-int32_t CBC_CommonByteMatrix::GetWidth() {
- return m_width;
-}
-uint8_t CBC_CommonByteMatrix::Get(int32_t x, int32_t y) {
- return m_bytes[y * m_width + x];
-}
-void CBC_CommonByteMatrix::Set(int32_t x, int32_t y, int32_t value) {
- m_bytes[y * m_width + x] = (uint8_t)value;
-}
-void CBC_CommonByteMatrix::Set(int32_t x, int32_t y, uint8_t value) {
- m_bytes[y * m_width + x] = value;
-}
-void CBC_CommonByteMatrix::clear(uint8_t value) {
- int32_t y;
- for (y = 0; y < m_height; y++) {
- int32_t x;
- for (x = 0; x < m_width; x++) {
- m_bytes[y * m_width + x] = value;
- }
- }
-}
-uint8_t* CBC_CommonByteMatrix::GetArray() {
- return m_bytes;
-}
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/common/BC_CommonByteMatrix.h b/chromium/third_party/pdfium/xfa/fxbarcode/common/BC_CommonByteMatrix.h
deleted file mode 100644
index 13cf5c330e7..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/common/BC_CommonByteMatrix.h
+++ /dev/null
@@ -1,35 +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 XFA_FXBARCODE_COMMON_BC_COMMONBYTEMATRIX_H_
-#define XFA_FXBARCODE_COMMON_BC_COMMONBYTEMATRIX_H_
-
-#include <stdint.h>
-
-#include "core/fxcrt/fx_system.h"
-
-class CBC_CommonByteMatrix {
- public:
- CBC_CommonByteMatrix(int32_t width, int32_t height);
- virtual ~CBC_CommonByteMatrix();
-
- int32_t GetHeight();
- int32_t GetWidth();
- uint8_t Get(int32_t x, int32_t y);
- uint8_t* GetArray();
-
- void Set(int32_t x, int32_t y, int32_t value);
- void Set(int32_t x, int32_t y, uint8_t value);
- void clear(uint8_t value);
- virtual void Init();
-
- private:
- uint8_t* m_bytes;
- int32_t m_width;
- int32_t m_height;
-};
-
-#endif // XFA_FXBARCODE_COMMON_BC_COMMONBYTEMATRIX_H_
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomon.cpp b/chromium/third_party/pdfium/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomon.cpp
deleted file mode 100644
index 7698890366e..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomon.cpp
+++ /dev/null
@@ -1,108 +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
-// Original code is licensed as follows:
-/*
- * Copyright 2007 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "xfa/fxbarcode/common/reedsolomon/BC_ReedSolomon.h"
-
-#include <memory>
-
-#include "xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.h"
-#include "xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.h"
-
-CBC_ReedSolomonEncoder::CBC_ReedSolomonEncoder(CBC_ReedSolomonGF256* field) {
- m_field = field;
-}
-void CBC_ReedSolomonEncoder::Init() {
- m_cachedGenerators.Add(new CBC_ReedSolomonGF256Poly(m_field, 1));
-}
-CBC_ReedSolomonGF256Poly* CBC_ReedSolomonEncoder::BuildGenerator(int32_t degree,
- int32_t& e) {
- if (degree >= m_cachedGenerators.GetSize()) {
- CBC_ReedSolomonGF256Poly* lastGenerator =
- m_cachedGenerators[m_cachedGenerators.GetSize() - 1];
- for (int32_t d = m_cachedGenerators.GetSize(); d <= degree; d++) {
- CFX_ArrayTemplate<int32_t> temp;
- temp.Add(1);
- temp.Add(m_field->Exp(d - 1));
- CBC_ReedSolomonGF256Poly temp_poly;
- temp_poly.Init(m_field, &temp, e);
- if (e != BCExceptionNO)
- return nullptr;
- CBC_ReedSolomonGF256Poly* nextGenerator =
- lastGenerator->Multiply(&temp_poly, e);
- if (e != BCExceptionNO)
- return nullptr;
- m_cachedGenerators.Add(nextGenerator);
- lastGenerator = nextGenerator;
- }
- }
- return m_cachedGenerators[degree];
-}
-void CBC_ReedSolomonEncoder::Encode(CFX_ArrayTemplate<int32_t>* toEncode,
- int32_t ecBytes,
- int32_t& e) {
- if (ecBytes == 0) {
- e = BCExceptionNoCorrectionBytes;
- return;
- }
- int32_t dataBytes = toEncode->GetSize() - ecBytes;
- if (dataBytes <= 0) {
- e = BCExceptionNoDataBytesProvided;
- return;
- }
- CBC_ReedSolomonGF256Poly* generator = BuildGenerator(ecBytes, e);
- if (e != BCExceptionNO)
- return;
- CFX_ArrayTemplate<int32_t> infoCoefficients;
- infoCoefficients.SetSize(dataBytes);
- for (int32_t x = 0; x < dataBytes; x++) {
- infoCoefficients[x] = toEncode->operator[](x);
- }
- CBC_ReedSolomonGF256Poly info;
- info.Init(m_field, &infoCoefficients, e);
- if (e != BCExceptionNO)
- return;
- std::unique_ptr<CBC_ReedSolomonGF256Poly> infoTemp(
- info.MultiplyByMonomial(ecBytes, 1, e));
- if (e != BCExceptionNO)
- return;
- std::unique_ptr<CFX_ArrayTemplate<CBC_ReedSolomonGF256Poly*>> temp(
- infoTemp->Divide(generator, e));
- if (e != BCExceptionNO)
- return;
- CBC_ReedSolomonGF256Poly* remainder = (*temp)[1];
- CFX_ArrayTemplate<int32_t>* coefficients = remainder->GetCoefficients();
- int32_t numZeroCoefficients = ecBytes - coefficients->GetSize();
- for (int32_t i = 0; i < numZeroCoefficients; i++) {
- (*toEncode)[dataBytes + i] = 0;
- }
- for (int32_t y = 0; y < coefficients->GetSize(); y++) {
- (*toEncode)[dataBytes + numZeroCoefficients + y] =
- coefficients->operator[](y);
- }
- for (int32_t k = 0; k < temp->GetSize(); k++) {
- delete (*temp)[k];
- }
-}
-CBC_ReedSolomonEncoder::~CBC_ReedSolomonEncoder() {
- for (int32_t i = 0; i < m_cachedGenerators.GetSize(); i++)
- delete m_cachedGenerators[i];
-}
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomon.h b/chromium/third_party/pdfium/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomon.h
deleted file mode 100644
index 95828f1a0e1..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomon.h
+++ /dev/null
@@ -1,32 +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 XFA_FXBARCODE_COMMON_REEDSOLOMON_BC_REEDSOLOMON_H_
-#define XFA_FXBARCODE_COMMON_REEDSOLOMON_BC_REEDSOLOMON_H_
-
-#include "core/fxcrt/fx_basic.h"
-
-class CBC_ReedSolomonGF256;
-class CBC_ReedSolomonGF256Poly;
-
-class CBC_ReedSolomonEncoder {
- public:
- explicit CBC_ReedSolomonEncoder(CBC_ReedSolomonGF256* field);
- virtual ~CBC_ReedSolomonEncoder();
-
- void Encode(CFX_ArrayTemplate<int32_t>* toEncode,
- int32_t ecBytes,
- int32_t& e);
- virtual void Init();
-
- private:
- CBC_ReedSolomonGF256Poly* BuildGenerator(int32_t degree, int32_t& e);
-
- CBC_ReedSolomonGF256* m_field;
- CFX_ArrayTemplate<CBC_ReedSolomonGF256Poly*> m_cachedGenerators;
-};
-
-#endif // XFA_FXBARCODE_COMMON_REEDSOLOMON_BC_REEDSOLOMON_H_
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp b/chromium/third_party/pdfium/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp
deleted file mode 100644
index ce84d8e08d0..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp
+++ /dev/null
@@ -1,134 +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
-// Original code is licensed as follows:
-/*
- * Copyright 2007 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.h"
-
-#include "third_party/base/ptr_util.h"
-#include "xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.h"
-
-CBC_ReedSolomonGF256* CBC_ReedSolomonGF256::QRCodeField = nullptr;
-CBC_ReedSolomonGF256* CBC_ReedSolomonGF256::DataMatrixField = nullptr;
-
-void CBC_ReedSolomonGF256::Initialize() {
- QRCodeField = new CBC_ReedSolomonGF256(0x011D);
- QRCodeField->Init();
- DataMatrixField = new CBC_ReedSolomonGF256(0x012D);
- DataMatrixField->Init();
-}
-
-void CBC_ReedSolomonGF256::Finalize() {
- delete QRCodeField;
- QRCodeField = nullptr;
- delete DataMatrixField;
- DataMatrixField = nullptr;
-}
-
-CBC_ReedSolomonGF256::CBC_ReedSolomonGF256(int32_t primitive) {
- int32_t x = 1;
- for (int32_t j = 0; j < 256; j++) {
- m_expTable[j] = x;
- x <<= 1;
- if (x >= 0x100) {
- x ^= primitive;
- }
- }
- for (int32_t i = 0; i < 255; i++) {
- m_logTable[m_expTable[i]] = i;
- }
- m_logTable[0] = 0;
-}
-
-void CBC_ReedSolomonGF256::Init() {
- m_zero = pdfium::MakeUnique<CBC_ReedSolomonGF256Poly>(this, 0);
- m_one = pdfium::MakeUnique<CBC_ReedSolomonGF256Poly>(this, 1);
-}
-
-CBC_ReedSolomonGF256::~CBC_ReedSolomonGF256() {}
-
-CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256::GetZero() const {
- return m_zero.get();
-}
-
-CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256::GetOne() const {
- return m_one.get();
-}
-
-CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256::BuildMonomial(
- int32_t degree,
- int32_t coefficient,
- int32_t& e) {
- if (degree < 0) {
- e = BCExceptionDegreeIsNegative;
- return nullptr;
- }
- if (coefficient == 0) {
- CBC_ReedSolomonGF256Poly* temp = m_zero->Clone(e);
- if (e != BCExceptionNO)
- return nullptr;
- return temp;
- }
- CFX_ArrayTemplate<int32_t> coefficients;
- coefficients.SetSize(degree + 1);
- coefficients[0] = coefficient;
- CBC_ReedSolomonGF256Poly* temp = new CBC_ReedSolomonGF256Poly();
- temp->Init(this, &coefficients, e);
- if (e != BCExceptionNO)
- return nullptr;
- return temp;
-}
-
-int32_t CBC_ReedSolomonGF256::AddOrSubtract(int32_t a, int32_t b) {
- return a ^ b;
-}
-
-int32_t CBC_ReedSolomonGF256::Exp(int32_t a) {
- return m_expTable[a];
-}
-
-int32_t CBC_ReedSolomonGF256::Log(int32_t a, int32_t& e) {
- if (a == 0) {
- e = BCExceptionAIsZero;
- return 0;
- }
- return m_logTable[a];
-}
-
-int32_t CBC_ReedSolomonGF256::Inverse(int32_t a, int32_t& e) {
- if (a == 0) {
- e = BCExceptionAIsZero;
- return 0;
- }
- return m_expTable[255 - m_logTable[a]];
-}
-
-int32_t CBC_ReedSolomonGF256::Multiply(int32_t a, int32_t b) {
- if (a == 0 || b == 0) {
- return 0;
- }
- if (a == 1) {
- return b;
- }
- if (b == 1) {
- return a;
- }
- return m_expTable[(m_logTable[a] + m_logTable[b]) % 255];
-}
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.h b/chromium/third_party/pdfium/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.h
deleted file mode 100644
index 16f1ad17f75..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.h
+++ /dev/null
@@ -1,47 +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 XFA_FXBARCODE_COMMON_REEDSOLOMON_BC_REEDSOLOMONGF256_H_
-#define XFA_FXBARCODE_COMMON_REEDSOLOMON_BC_REEDSOLOMONGF256_H_
-
-#include <memory>
-
-#include "core/fxcrt/fx_basic.h"
-#include "xfa/fxbarcode/utils.h"
-
-class CBC_ReedSolomonGF256Poly;
-
-class CBC_ReedSolomonGF256 {
- public:
- explicit CBC_ReedSolomonGF256(int32_t primitive);
- virtual ~CBC_ReedSolomonGF256();
-
- static void Initialize();
- static void Finalize();
-
- CBC_ReedSolomonGF256Poly* GetZero() const;
- CBC_ReedSolomonGF256Poly* GetOne() const;
- CBC_ReedSolomonGF256Poly* BuildMonomial(int32_t degree,
- int32_t coefficient,
- int32_t& e);
- static int32_t AddOrSubtract(int32_t a, int32_t b);
- int32_t Exp(int32_t a);
- int32_t Log(int32_t a, int32_t& e);
- int32_t Inverse(int32_t a, int32_t& e);
- int32_t Multiply(int32_t a, int32_t b);
- virtual void Init();
-
- static CBC_ReedSolomonGF256* QRCodeField;
- static CBC_ReedSolomonGF256* DataMatrixField;
-
- private:
- int32_t m_expTable[256];
- int32_t m_logTable[256];
- std::unique_ptr<CBC_ReedSolomonGF256Poly> m_zero;
- std::unique_ptr<CBC_ReedSolomonGF256Poly> m_one;
-};
-
-#endif // XFA_FXBARCODE_COMMON_REEDSOLOMON_BC_REEDSOLOMONGF256_H_
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp b/chromium/third_party/pdfium/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp
deleted file mode 100644
index a0bbc025c4a..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp
+++ /dev/null
@@ -1,259 +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
-// Original code is licensed as follows:
-/*
- * Copyright 2007 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.h"
-
-#include <memory>
-
-#include "xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.h"
-
-CBC_ReedSolomonGF256Poly::CBC_ReedSolomonGF256Poly(CBC_ReedSolomonGF256* field,
- int32_t coefficients) {
- if (!field)
- return;
-
- m_field = field;
- m_coefficients.Add(coefficients);
-}
-CBC_ReedSolomonGF256Poly::CBC_ReedSolomonGF256Poly() {
- m_field = nullptr;
-}
-void CBC_ReedSolomonGF256Poly::Init(CBC_ReedSolomonGF256* field,
- CFX_ArrayTemplate<int32_t>* coefficients,
- int32_t& e) {
- if (!coefficients || coefficients->GetSize() == 0) {
- e = BCExceptionCoefficientsSizeIsNull;
- return;
- }
- m_field = field;
- int32_t coefficientsLength = coefficients->GetSize();
- if ((coefficientsLength > 1 && (*coefficients)[0] == 0)) {
- int32_t firstNonZero = 1;
- while ((firstNonZero < coefficientsLength) &&
- ((*coefficients)[firstNonZero] == 0)) {
- firstNonZero++;
- }
- if (firstNonZero == coefficientsLength) {
- m_coefficients.Copy(*(m_field->GetZero()->GetCoefficients()));
- } else {
- m_coefficients.SetSize(coefficientsLength - firstNonZero);
- for (int32_t i = firstNonZero, j = 0; i < coefficientsLength; i++, j++) {
- m_coefficients[j] = coefficients->operator[](i);
- }
- }
- } else {
- m_coefficients.Copy(*coefficients);
- }
-}
-CFX_ArrayTemplate<int32_t>* CBC_ReedSolomonGF256Poly::GetCoefficients() {
- return &m_coefficients;
-}
-int32_t CBC_ReedSolomonGF256Poly::GetDegree() {
- return m_coefficients.GetSize() - 1;
-}
-bool CBC_ReedSolomonGF256Poly::IsZero() {
- return m_coefficients[0] == 0;
-}
-int32_t CBC_ReedSolomonGF256Poly::GetCoefficients(int32_t degree) {
- return m_coefficients[m_coefficients.GetSize() - 1 - degree];
-}
-int32_t CBC_ReedSolomonGF256Poly::EvaluateAt(int32_t a) {
- if (a == 0) {
- return GetCoefficients(0);
- }
- int32_t size = m_coefficients.GetSize();
- if (a == 1) {
- int32_t result = 0;
- for (int32_t i = 0; i < size; i++) {
- result = CBC_ReedSolomonGF256::AddOrSubtract(result, m_coefficients[i]);
- }
- return result;
- }
- int32_t result = m_coefficients[0];
- for (int32_t j = 1; j < size; j++) {
- result = CBC_ReedSolomonGF256::AddOrSubtract(m_field->Multiply(a, result),
- m_coefficients[j]);
- }
- return result;
-}
-CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256Poly::Clone(int32_t& e) {
- CBC_ReedSolomonGF256Poly* temp = new CBC_ReedSolomonGF256Poly();
- temp->Init(m_field, &m_coefficients, e);
- if (e != BCExceptionNO)
- return nullptr;
- return temp;
-}
-CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256Poly::AddOrSubtract(
- CBC_ReedSolomonGF256Poly* other,
- int32_t& e) {
- if (IsZero())
- return other->Clone(e);
- if (other->IsZero())
- return Clone(e);
-
- CFX_ArrayTemplate<int32_t> smallerCoefficients;
- smallerCoefficients.Copy(m_coefficients);
- CFX_ArrayTemplate<int32_t> largerCoefficients;
- largerCoefficients.Copy(*(other->GetCoefficients()));
- if (smallerCoefficients.GetSize() > largerCoefficients.GetSize()) {
- CFX_ArrayTemplate<int32_t> temp;
- temp.Copy(smallerCoefficients);
- smallerCoefficients.Copy(largerCoefficients);
- largerCoefficients.Copy(temp);
- }
- CFX_ArrayTemplate<int32_t> sumDiff;
- sumDiff.SetSize(largerCoefficients.GetSize());
- int32_t lengthDiff =
- largerCoefficients.GetSize() - smallerCoefficients.GetSize();
- for (int32_t i = 0; i < lengthDiff; i++) {
- sumDiff[i] = largerCoefficients[i];
- }
- for (int32_t j = lengthDiff; j < largerCoefficients.GetSize(); j++) {
- sumDiff[j] = (CBC_ReedSolomonGF256::AddOrSubtract(
- smallerCoefficients[j - lengthDiff], largerCoefficients[j]));
- }
- CBC_ReedSolomonGF256Poly* temp = new CBC_ReedSolomonGF256Poly();
- temp->Init(m_field, &sumDiff, e);
- if (e != BCExceptionNO)
- return nullptr;
- return temp;
-}
-CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256Poly::Multiply(
- CBC_ReedSolomonGF256Poly* other,
- int32_t& e) {
- if (IsZero() || other->IsZero())
- return m_field->GetZero()->Clone(e);
-
- CFX_ArrayTemplate<int32_t> aCoefficients;
- aCoefficients.Copy(m_coefficients);
- int32_t aLength = m_coefficients.GetSize();
- CFX_ArrayTemplate<int32_t> bCoefficients;
- bCoefficients.Copy(*(other->GetCoefficients()));
- int32_t bLength = other->GetCoefficients()->GetSize();
- CFX_ArrayTemplate<int32_t> product;
- product.SetSize(aLength + bLength - 1);
- for (int32_t i = 0; i < aLength; i++) {
- int32_t aCoeff = m_coefficients[i];
- for (int32_t j = 0; j < bLength; j++) {
- product[i + j] = CBC_ReedSolomonGF256::AddOrSubtract(
- product[i + j],
- m_field->Multiply(aCoeff, other->GetCoefficients()->operator[](j)));
- }
- }
- CBC_ReedSolomonGF256Poly* temp = new CBC_ReedSolomonGF256Poly();
- temp->Init(m_field, &product, e);
- if (e != BCExceptionNO)
- return nullptr;
- return temp;
-}
-CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256Poly::Multiply(int32_t scalar,
- int32_t& e) {
- if (scalar == 0)
- return m_field->GetZero()->Clone(e);
- if (scalar == 1)
- return Clone(e);
-
- int32_t size = m_coefficients.GetSize();
- CFX_ArrayTemplate<int32_t> product;
- product.SetSize(size);
- for (int32_t i = 0; i < size; i++) {
- product[i] = m_field->Multiply(m_coefficients[i], scalar);
- }
- CBC_ReedSolomonGF256Poly* temp = new CBC_ReedSolomonGF256Poly();
- temp->Init(m_field, &product, e);
- if (e != BCExceptionNO)
- return nullptr;
- return temp;
-}
-CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256Poly::MultiplyByMonomial(
- int32_t degree,
- int32_t coefficient,
- int32_t& e) {
- if (degree < 0) {
- e = BCExceptionDegreeIsNegative;
- return nullptr;
- }
- if (coefficient == 0)
- return m_field->GetZero()->Clone(e);
-
- int32_t size = m_coefficients.GetSize();
- CFX_ArrayTemplate<int32_t> product;
- product.SetSize(size + degree);
- for (int32_t i = 0; i < size; i++) {
- product[i] = (m_field->Multiply(m_coefficients[i], coefficient));
- }
- CBC_ReedSolomonGF256Poly* temp = new CBC_ReedSolomonGF256Poly();
- temp->Init(m_field, &product, e);
- if (e != BCExceptionNO)
- return nullptr;
- return temp;
-}
-
-CFX_ArrayTemplate<CBC_ReedSolomonGF256Poly*>* CBC_ReedSolomonGF256Poly::Divide(
- CBC_ReedSolomonGF256Poly* other,
- int32_t& e) {
- if (other->IsZero()) {
- e = BCExceptionDivideByZero;
- return nullptr;
- }
- std::unique_ptr<CBC_ReedSolomonGF256Poly> quotient(
- m_field->GetZero()->Clone(e));
- if (e != BCExceptionNO)
- return nullptr;
- std::unique_ptr<CBC_ReedSolomonGF256Poly> remainder(Clone(e));
- if (e != BCExceptionNO)
- return nullptr;
- int32_t denominatorLeadingTerm = other->GetCoefficients(other->GetDegree());
- int32_t inverseDenominatorLeadingTeam =
- m_field->Inverse(denominatorLeadingTerm, e);
- if (e != BCExceptionNO)
- return nullptr;
- while (remainder->GetDegree() >= other->GetDegree() && !remainder->IsZero()) {
- int32_t degreeDifference = remainder->GetDegree() - other->GetDegree();
- int32_t scale =
- m_field->Multiply(remainder->GetCoefficients((remainder->GetDegree())),
- inverseDenominatorLeadingTeam);
- std::unique_ptr<CBC_ReedSolomonGF256Poly> term(
- other->MultiplyByMonomial(degreeDifference, scale, e));
- if (e != BCExceptionNO)
- return nullptr;
- std::unique_ptr<CBC_ReedSolomonGF256Poly> iteratorQuotient(
- m_field->BuildMonomial(degreeDifference, scale, e));
- if (e != BCExceptionNO)
- return nullptr;
- quotient.reset(quotient->AddOrSubtract(iteratorQuotient.get(), e));
- if (e != BCExceptionNO)
- return nullptr;
- remainder.reset(remainder->AddOrSubtract(term.get(), e));
- if (e != BCExceptionNO)
- return nullptr;
- }
- CFX_ArrayTemplate<CBC_ReedSolomonGF256Poly*>* tempPtrA =
- new CFX_ArrayTemplate<CBC_ReedSolomonGF256Poly*>();
- tempPtrA->Add(quotient.release());
- tempPtrA->Add(remainder.release());
- return tempPtrA;
-}
-
-CBC_ReedSolomonGF256Poly::~CBC_ReedSolomonGF256Poly() {
- m_coefficients.RemoveAll();
-}
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.h b/chromium/third_party/pdfium/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.h
deleted file mode 100644
index ff93264e00d..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.h
+++ /dev/null
@@ -1,47 +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 XFA_FXBARCODE_COMMON_REEDSOLOMON_BC_REEDSOLOMONGF256POLY_H_
-#define XFA_FXBARCODE_COMMON_REEDSOLOMON_BC_REEDSOLOMONGF256POLY_H_
-
-#include "core/fxcrt/fx_basic.h"
-
-class CBC_ReedSolomonGF256;
-
-class CBC_ReedSolomonGF256Poly final {
- public:
- CBC_ReedSolomonGF256Poly(CBC_ReedSolomonGF256* field, int32_t coefficients);
- CBC_ReedSolomonGF256Poly();
- ~CBC_ReedSolomonGF256Poly();
- void Init(CBC_ReedSolomonGF256* field,
- CFX_ArrayTemplate<int32_t>* coefficients,
- int32_t& e);
-
- int32_t GetCoefficients(int32_t degree);
- CFX_ArrayTemplate<int32_t>* GetCoefficients();
- int32_t GetDegree();
- bool IsZero();
- int32_t EvaluateAt(int32_t a);
- CBC_ReedSolomonGF256Poly* AddOrSubtract(CBC_ReedSolomonGF256Poly* other,
- int32_t& e);
- CBC_ReedSolomonGF256Poly* Multiply(CBC_ReedSolomonGF256Poly* other,
- int32_t& e);
- CBC_ReedSolomonGF256Poly* Multiply(int32_t scalar, int32_t& e);
- CBC_ReedSolomonGF256Poly* MultiplyByMonomial(int32_t degree,
- int32_t coefficient,
- int32_t& e);
- CFX_ArrayTemplate<CBC_ReedSolomonGF256Poly*>* Divide(
- CBC_ReedSolomonGF256Poly* other,
- int32_t& e);
-
- CBC_ReedSolomonGF256Poly* Clone(int32_t& e);
-
- private:
- CBC_ReedSolomonGF256* m_field;
- CFX_ArrayTemplate<int32_t> m_coefficients;
-};
-
-#endif // XFA_FXBARCODE_COMMON_REEDSOLOMON_BC_REEDSOLOMONGF256POLY_H_
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_ASCIIEncoder.cpp b/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_ASCIIEncoder.cpp
deleted file mode 100644
index 00d8fc16157..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_ASCIIEncoder.cpp
+++ /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
-// Original code is licensed as follows:
-/*
- * Copyright 2006-2007 Jeremias Maerki.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "xfa/fxbarcode/BC_Dimension.h"
-#include "xfa/fxbarcode/datamatrix/BC_ASCIIEncoder.h"
-#include "xfa/fxbarcode/datamatrix/BC_Encoder.h"
-#include "xfa/fxbarcode/datamatrix/BC_EncoderContext.h"
-#include "xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.h"
-#include "xfa/fxbarcode/datamatrix/BC_SymbolInfo.h"
-#include "xfa/fxbarcode/datamatrix/BC_SymbolShapeHint.h"
-
-CBC_ASCIIEncoder::CBC_ASCIIEncoder() {}
-CBC_ASCIIEncoder::~CBC_ASCIIEncoder() {}
-int32_t CBC_ASCIIEncoder::getEncodingMode() {
- return ASCII_ENCODATION;
-}
-void CBC_ASCIIEncoder::Encode(CBC_EncoderContext& context, int32_t& e) {
- int32_t n = CBC_HighLevelEncoder::determineConsecutiveDigitCount(
- context.m_msg, context.m_pos);
- if (n >= 2) {
- FX_WCHAR code =
- encodeASCIIDigits(context.m_msg.GetAt(context.m_pos),
- context.m_msg.GetAt(context.m_pos + 1), e);
- if (e != BCExceptionNO) {
- return;
- }
- context.writeCodeword(code);
- context.m_pos += 2;
- } else {
- FX_WCHAR c = context.getCurrentChar();
- int32_t newMode = CBC_HighLevelEncoder::lookAheadTest(
- context.m_msg, context.m_pos, getEncodingMode());
- if (newMode != getEncodingMode()) {
- switch (newMode) {
- case BASE256_ENCODATION:
- context.writeCodeword(CBC_HighLevelEncoder::LATCH_TO_BASE256);
- context.signalEncoderChange(BASE256_ENCODATION);
- return;
- case C40_ENCODATION:
- context.writeCodeword(CBC_HighLevelEncoder::LATCH_TO_C40);
- context.signalEncoderChange(C40_ENCODATION);
- return;
- case X12_ENCODATION:
- context.writeCodeword(CBC_HighLevelEncoder::LATCH_TO_ANSIX12);
- context.signalEncoderChange(X12_ENCODATION);
- break;
- case TEXT_ENCODATION:
- context.writeCodeword(CBC_HighLevelEncoder::LATCH_TO_TEXT);
- context.signalEncoderChange(TEXT_ENCODATION);
- break;
- case EDIFACT_ENCODATION:
- context.writeCodeword(CBC_HighLevelEncoder::LATCH_TO_EDIFACT);
- context.signalEncoderChange(EDIFACT_ENCODATION);
- break;
- default:
- e = BCExceptionIllegalStateIllegalMode;
- return;
- }
- } else if (CBC_HighLevelEncoder::isExtendedASCII(c)) {
- context.writeCodeword(CBC_HighLevelEncoder::UPPER_SHIFT);
- context.writeCodeword((FX_WCHAR)(c - 128 + 1));
- context.m_pos++;
- } else {
- context.writeCodeword((FX_WCHAR)(c + 1));
- context.m_pos++;
- }
- }
-}
-FX_WCHAR CBC_ASCIIEncoder::encodeASCIIDigits(FX_WCHAR digit1,
- FX_WCHAR digit2,
- int32_t& e) {
- if (CBC_HighLevelEncoder::isDigit(digit1) &&
- CBC_HighLevelEncoder::isDigit(digit2)) {
- int32_t num = (digit1 - 48) * 10 + (digit2 - 48);
- return (FX_WCHAR)(num + 130);
- }
- e = BCExceptionIllegalArgumentNotGigits;
- return 0;
-}
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_ASCIIEncoder.h b/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_ASCIIEncoder.h
deleted file mode 100644
index 40559b532d8..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_ASCIIEncoder.h
+++ /dev/null
@@ -1,29 +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 XFA_FXBARCODE_DATAMATRIX_BC_ASCIIENCODER_H_
-#define XFA_FXBARCODE_DATAMATRIX_BC_ASCIIENCODER_H_
-
-#include "xfa/fxbarcode/datamatrix/BC_Encoder.h"
-
-class CBC_EncoderContext;
-
-class CBC_ASCIIEncoder : public CBC_Encoder {
- public:
- CBC_ASCIIEncoder();
- ~CBC_ASCIIEncoder() override;
-
- // CBC_Encoder
- int32_t getEncodingMode() override;
- void Encode(CBC_EncoderContext& context, int32_t& e) override;
-
- private:
- static FX_WCHAR encodeASCIIDigits(FX_WCHAR digit1,
- FX_WCHAR digit2,
- int32_t& e);
-};
-
-#endif // XFA_FXBARCODE_DATAMATRIX_BC_ASCIIENCODER_H_
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_Base256Encoder.cpp b/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_Base256Encoder.cpp
deleted file mode 100644
index b8e427c7fc7..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_Base256Encoder.cpp
+++ /dev/null
@@ -1,87 +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
-// Original code is licensed as follows:
-/*
- * Copyright 2006-2007 Jeremias Maerki.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "xfa/fxbarcode/BC_Dimension.h"
-#include "xfa/fxbarcode/datamatrix/BC_Base256Encoder.h"
-#include "xfa/fxbarcode/datamatrix/BC_Encoder.h"
-#include "xfa/fxbarcode/datamatrix/BC_EncoderContext.h"
-#include "xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.h"
-#include "xfa/fxbarcode/datamatrix/BC_SymbolInfo.h"
-#include "xfa/fxbarcode/datamatrix/BC_SymbolShapeHint.h"
-
-CBC_Base256Encoder::CBC_Base256Encoder() {}
-CBC_Base256Encoder::~CBC_Base256Encoder() {}
-int32_t CBC_Base256Encoder::getEncodingMode() {
- return BASE256_ENCODATION;
-}
-void CBC_Base256Encoder::Encode(CBC_EncoderContext& context, int32_t& e) {
- CFX_WideString buffer;
- buffer += (FX_WCHAR)'\0';
- while (context.hasMoreCharacters()) {
- FX_WCHAR c = context.getCurrentChar();
- buffer += c;
- context.m_pos++;
- int32_t newMode = CBC_HighLevelEncoder::lookAheadTest(
- context.m_msg, context.m_pos, getEncodingMode());
- if (newMode != getEncodingMode()) {
- context.signalEncoderChange(newMode);
- break;
- }
- }
- int32_t dataCount = buffer.GetLength() - 1;
- FX_CHAR buf[128];
- FXSYS_itoa(dataCount, buf, 10);
- buffer.SetAt(0, FX_WCHAR(*buf) - '0');
- int32_t lengthFieldSize = 1;
- int32_t currentSize =
- context.getCodewordCount() + dataCount + lengthFieldSize;
- context.updateSymbolInfo(currentSize, e);
- if (e != BCExceptionNO) {
- return;
- }
- bool mustPad = (context.m_symbolInfo->m_dataCapacity - currentSize) > 0;
- if (context.hasMoreCharacters() || mustPad) {
- if (dataCount <= 249) {
- buffer.SetAt(0, (FX_WCHAR)dataCount);
- } else if (dataCount > 249 && dataCount <= 1555) {
- buffer.SetAt(0, (FX_WCHAR)((dataCount / 250) + 249));
- buffer.Insert(1, (FX_WCHAR)(dataCount % 250));
- } else {
- e = BCExceptionIllegalStateMessageLengthInvalid;
- return;
- }
- }
- for (int32_t i = 0, c = buffer.GetLength(); i < c; i++) {
- context.writeCodeword(
- randomize255State(buffer.GetAt(i), context.getCodewordCount() + 1));
- }
-}
-FX_WCHAR CBC_Base256Encoder::randomize255State(FX_WCHAR ch,
- int32_t codewordPosition) {
- int32_t pseudoRandom = ((149 * codewordPosition) % 255) + 1;
- int32_t tempVariable = ch + pseudoRandom;
- if (tempVariable <= 255) {
- return (FX_WCHAR)tempVariable;
- } else {
- return (FX_WCHAR)(tempVariable - 256);
- }
-}
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_Base256Encoder.h b/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_Base256Encoder.h
deleted file mode 100644
index c41c79db081..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_Base256Encoder.h
+++ /dev/null
@@ -1,25 +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 XFA_FXBARCODE_DATAMATRIX_BC_BASE256ENCODER_H_
-#define XFA_FXBARCODE_DATAMATRIX_BC_BASE256ENCODER_H_
-
-#include "xfa/fxbarcode/datamatrix/BC_Encoder.h"
-
-class CBC_Base256Encoder : public CBC_Encoder {
- public:
- CBC_Base256Encoder();
- ~CBC_Base256Encoder() override;
-
- // CBC_Encoder
- int32_t getEncodingMode() override;
- void Encode(CBC_EncoderContext& context, int32_t& e) override;
-
- private:
- static FX_WCHAR randomize255State(FX_WCHAR ch, int32_t codewordPosition);
-};
-
-#endif // XFA_FXBARCODE_DATAMATRIX_BC_BASE256ENCODER_H_
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_C40Encoder.cpp b/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_C40Encoder.cpp
deleted file mode 100644
index 50f02ca52de..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_C40Encoder.cpp
+++ /dev/null
@@ -1,200 +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
-// Original code is licensed as follows:
-/*
- * Copyright 2006-2007 Jeremias Maerki.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "xfa/fxbarcode/BC_Dimension.h"
-#include "xfa/fxbarcode/common/BC_CommonBitMatrix.h"
-#include "xfa/fxbarcode/datamatrix/BC_C40Encoder.h"
-#include "xfa/fxbarcode/datamatrix/BC_Encoder.h"
-#include "xfa/fxbarcode/datamatrix/BC_EncoderContext.h"
-#include "xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.h"
-#include "xfa/fxbarcode/datamatrix/BC_SymbolInfo.h"
-#include "xfa/fxbarcode/datamatrix/BC_SymbolShapeHint.h"
-
-CBC_C40Encoder::CBC_C40Encoder() {}
-CBC_C40Encoder::~CBC_C40Encoder() {}
-int32_t CBC_C40Encoder::getEncodingMode() {
- return C40_ENCODATION;
-}
-void CBC_C40Encoder::Encode(CBC_EncoderContext& context, int32_t& e) {
- CFX_WideString buffer;
- while (context.hasMoreCharacters()) {
- FX_WCHAR c = context.getCurrentChar();
- context.m_pos++;
- int32_t lastCharSize = encodeChar(c, buffer, e);
- if (e != BCExceptionNO) {
- return;
- }
- int32_t unwritten = (buffer.GetLength() / 3) * 2;
- int32_t curCodewordCount = context.getCodewordCount() + unwritten;
- context.updateSymbolInfo(curCodewordCount, e);
- if (e != BCExceptionNO) {
- return;
- }
- int32_t available = context.m_symbolInfo->m_dataCapacity - curCodewordCount;
- if (!context.hasMoreCharacters()) {
- CFX_WideString removed;
- if ((buffer.GetLength() % 3) == 2) {
- if (available < 2 || available > 2) {
- lastCharSize =
- backtrackOneCharacter(context, buffer, removed, lastCharSize, e);
- if (e != BCExceptionNO) {
- return;
- }
- }
- }
- while ((buffer.GetLength() % 3) == 1 &&
- ((lastCharSize <= 3 && available != 1) || lastCharSize > 3)) {
- lastCharSize =
- backtrackOneCharacter(context, buffer, removed, lastCharSize, e);
- if (e != BCExceptionNO) {
- return;
- }
- }
- break;
- }
- int32_t count = buffer.GetLength();
- if ((count % 3) == 0) {
- int32_t newMode = CBC_HighLevelEncoder::lookAheadTest(
- context.m_msg, context.m_pos, getEncodingMode());
- if (newMode != getEncodingMode()) {
- context.signalEncoderChange(newMode);
- break;
- }
- }
- }
- handleEOD(context, buffer, e);
-}
-void CBC_C40Encoder::writeNextTriplet(CBC_EncoderContext& context,
- CFX_WideString& buffer) {
- context.writeCodewords(encodeToCodewords(buffer, 0));
- buffer.Delete(0, 3);
-}
-void CBC_C40Encoder::handleEOD(CBC_EncoderContext& context,
- CFX_WideString& buffer,
- int32_t& e) {
- int32_t unwritten = (buffer.GetLength() / 3) * 2;
- int32_t rest = buffer.GetLength() % 3;
- int32_t curCodewordCount = context.getCodewordCount() + unwritten;
- context.updateSymbolInfo(curCodewordCount, e);
- if (e != BCExceptionNO) {
- return;
- }
- int32_t available = context.m_symbolInfo->m_dataCapacity - curCodewordCount;
- if (rest == 2) {
- buffer += (FX_WCHAR)'\0';
- while (buffer.GetLength() >= 3) {
- writeNextTriplet(context, buffer);
- }
- if (context.hasMoreCharacters()) {
- context.writeCodeword(CBC_HighLevelEncoder::C40_UNLATCH);
- }
- } else if (available == 1 && rest == 1) {
- while (buffer.GetLength() >= 3) {
- writeNextTriplet(context, buffer);
- }
- if (context.hasMoreCharacters()) {
- context.writeCodeword(CBC_HighLevelEncoder::C40_UNLATCH);
- }
- context.m_pos--;
- } else if (rest == 0) {
- while (buffer.GetLength() >= 3) {
- writeNextTriplet(context, buffer);
- }
- if (available > 0 || context.hasMoreCharacters()) {
- context.writeCodeword(CBC_HighLevelEncoder::C40_UNLATCH);
- }
- } else {
- e = BCExceptionIllegalStateUnexpectedCase;
- return;
- }
- context.signalEncoderChange(ASCII_ENCODATION);
-}
-int32_t CBC_C40Encoder::encodeChar(FX_WCHAR c, CFX_WideString& sb, int32_t& e) {
- if (c == ' ') {
- sb += (FX_WCHAR)'\3';
- return 1;
- } else if ((c >= '0') && (c <= '9')) {
- sb += (FX_WCHAR)(c - 48 + 4);
- return 1;
- } else if ((c >= 'A') && (c <= 'Z')) {
- sb += (FX_WCHAR)(c - 65 + 14);
- return 1;
- } else if (c <= 0x1f) {
- sb += (FX_WCHAR)'\0';
- sb += c;
- return 2;
- } else if ((c >= '!') && (c <= '/')) {
- sb += (FX_WCHAR)'\1';
- sb += (FX_WCHAR)(c - 33);
- return 2;
- } else if ((c >= ':') && (c <= '@')) {
- sb += (FX_WCHAR)'\1';
- sb += (FX_WCHAR)(c - 58 + 15);
- return 2;
- } else if ((c >= '[') && (c <= '_')) {
- sb += (FX_WCHAR)'\1';
- sb += (FX_WCHAR)(c - 91 + 22);
- return 2;
- } else if ((c >= 60) && (c <= 0x7f)) {
- sb += (FX_WCHAR)'\2';
- sb += (FX_WCHAR)(c - 96);
- return 2;
- } else if (c >= 80) {
- sb += (FX_WCHAR)'\1';
- sb += (FX_WCHAR)0x001e;
- int32_t len = 2;
- len += encodeChar((c - 128), sb, e);
- if (e != BCExceptionNO)
- return 0;
- return len;
- } else {
- e = BCExceptionIllegalArgument;
- return 0;
- }
-}
-int32_t CBC_C40Encoder::backtrackOneCharacter(CBC_EncoderContext& context,
- CFX_WideString& buffer,
- CFX_WideString& removed,
- int32_t lastCharSize,
- int32_t& e) {
- int32_t count = buffer.GetLength();
- buffer.Delete(count - lastCharSize, count);
- context.m_pos--;
- FX_WCHAR c = context.getCurrentChar();
- lastCharSize = encodeChar(c, removed, e);
- if (e != BCExceptionNO)
- return -1;
- context.resetSymbolInfo();
- return lastCharSize;
-}
-CFX_WideString CBC_C40Encoder::encodeToCodewords(CFX_WideString sb,
- int32_t startPos) {
- FX_WCHAR c1 = sb.GetAt(startPos);
- FX_WCHAR c2 = sb.GetAt(startPos + 1);
- FX_WCHAR c3 = sb.GetAt(startPos + 2);
- int32_t v = (1600 * c1) + (40 * c2) + c3 + 1;
- FX_WCHAR cw1 = (FX_WCHAR)(v / 256);
- FX_WCHAR cw2 = (FX_WCHAR)(v % 256);
- CFX_WideString b1(cw1);
- CFX_WideString b2(cw2);
- return b1 + b2;
-}
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_C40Encoder.h b/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_C40Encoder.h
deleted file mode 100644
index 9737981f75b..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_C40Encoder.h
+++ /dev/null
@@ -1,38 +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 XFA_FXBARCODE_DATAMATRIX_BC_C40ENCODER_H_
-#define XFA_FXBARCODE_DATAMATRIX_BC_C40ENCODER_H_
-
-#include "xfa/fxbarcode/datamatrix/BC_Encoder.h"
-
-class CBC_C40Encoder : public CBC_Encoder {
- public:
- CBC_C40Encoder();
- ~CBC_C40Encoder() override;
-
- // CBC_Encoder
- int32_t getEncodingMode() override;
- void Encode(CBC_EncoderContext& context, int32_t& e) override;
-
- static void writeNextTriplet(CBC_EncoderContext& context,
- CFX_WideString& buffer);
-
- virtual void handleEOD(CBC_EncoderContext& context,
- CFX_WideString& buffer,
- int32_t& e);
- virtual int32_t encodeChar(FX_WCHAR c, CFX_WideString& sb, int32_t& e);
-
- private:
- int32_t backtrackOneCharacter(CBC_EncoderContext& context,
- CFX_WideString& buffer,
- CFX_WideString& removed,
- int32_t lastCharSize,
- int32_t& e);
- static CFX_WideString encodeToCodewords(CFX_WideString sb, int32_t startPos);
-};
-
-#endif // XFA_FXBARCODE_DATAMATRIX_BC_C40ENCODER_H_
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_DataMatrixSymbolInfo144.cpp b/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_DataMatrixSymbolInfo144.cpp
deleted file mode 100644
index e580bb583f7..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_DataMatrixSymbolInfo144.cpp
+++ /dev/null
@@ -1,40 +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
-// Original code is licensed as follows:
-/*
- * Copyright 2006 Jeremias Maerki
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "xfa/fxbarcode/datamatrix/BC_DataMatrixSymbolInfo144.h"
-#include "xfa/fxbarcode/datamatrix/BC_Encoder.h"
-#include "xfa/fxbarcode/datamatrix/BC_SymbolInfo.h"
-#include "xfa/fxbarcode/datamatrix/BC_SymbolShapeHint.h"
-
-CBC_DataMatrixSymbolInfo144::CBC_DataMatrixSymbolInfo144()
- : CBC_SymbolInfo(false, 1558, 620, 22, 22, 36) {
- m_rsBlockData = -1;
- m_rsBlockError = 62;
-}
-CBC_DataMatrixSymbolInfo144::~CBC_DataMatrixSymbolInfo144() {}
-int32_t CBC_DataMatrixSymbolInfo144::getInterleavedBlockCount() {
- return 10;
-}
-int32_t CBC_DataMatrixSymbolInfo144getDataLengthForInterleavedBlock(
- int32_t index) {
- return (index <= 8) ? 156 : 155;
-}
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_DataMatrixSymbolInfo144.h b/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_DataMatrixSymbolInfo144.h
deleted file mode 100644
index 2cd0cd0e6f2..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_DataMatrixSymbolInfo144.h
+++ /dev/null
@@ -1,20 +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 XFA_FXBARCODE_DATAMATRIX_BC_DATAMATRIXSYMBOLINFO144_H_
-#define XFA_FXBARCODE_DATAMATRIX_BC_DATAMATRIXSYMBOLINFO144_H_
-
-#include "xfa/fxbarcode/datamatrix/BC_SymbolInfo.h"
-
-class CBC_DataMatrixSymbolInfo144 : public CBC_SymbolInfo {
- public:
- CBC_DataMatrixSymbolInfo144();
- ~CBC_DataMatrixSymbolInfo144() override;
-
- int32_t getInterleavedBlockCount();
-};
-
-#endif // XFA_FXBARCODE_DATAMATRIX_BC_DATAMATRIXSYMBOLINFO144_H_
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_DataMatrixWriter.cpp b/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_DataMatrixWriter.cpp
deleted file mode 100644
index f1ce798af07..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_DataMatrixWriter.cpp
+++ /dev/null
@@ -1,143 +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
-// Original code is licensed as follows:
-/*
- * Copyright 2008 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "xfa/fxbarcode/BC_Dimension.h"
-#include "xfa/fxbarcode/BC_TwoDimWriter.h"
-#include "xfa/fxbarcode/BC_UtilCodingConvert.h"
-#include "xfa/fxbarcode/BC_Writer.h"
-#include "xfa/fxbarcode/common/BC_CommonBitMatrix.h"
-#include "xfa/fxbarcode/common/BC_CommonByteMatrix.h"
-#include "xfa/fxbarcode/datamatrix/BC_ASCIIEncoder.h"
-#include "xfa/fxbarcode/datamatrix/BC_Base256Encoder.h"
-#include "xfa/fxbarcode/datamatrix/BC_C40Encoder.h"
-#include "xfa/fxbarcode/datamatrix/BC_DataMatrixSymbolInfo144.h"
-#include "xfa/fxbarcode/datamatrix/BC_DataMatrixWriter.h"
-#include "xfa/fxbarcode/datamatrix/BC_DefaultPlacement.h"
-#include "xfa/fxbarcode/datamatrix/BC_EdifactEncoder.h"
-#include "xfa/fxbarcode/datamatrix/BC_Encoder.h"
-#include "xfa/fxbarcode/datamatrix/BC_EncoderContext.h"
-#include "xfa/fxbarcode/datamatrix/BC_ErrorCorrection.h"
-#include "xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.h"
-#include "xfa/fxbarcode/datamatrix/BC_SymbolInfo.h"
-#include "xfa/fxbarcode/datamatrix/BC_SymbolShapeHint.h"
-#include "xfa/fxbarcode/datamatrix/BC_TextEncoder.h"
-#include "xfa/fxbarcode/datamatrix/BC_X12Encoder.h"
-
-CBC_DataMatrixWriter::CBC_DataMatrixWriter() {}
-CBC_DataMatrixWriter::~CBC_DataMatrixWriter() {}
-bool CBC_DataMatrixWriter::SetErrorCorrectionLevel(int32_t level) {
- m_iCorrectLevel = level;
- return true;
-}
-uint8_t* CBC_DataMatrixWriter::Encode(const CFX_WideString& contents,
- int32_t& outWidth,
- int32_t& outHeight,
- int32_t& e) {
- if (outWidth < 0 || outHeight < 0) {
- e = BCExceptionHeightAndWidthMustBeAtLeast1;
- return nullptr;
- }
- CBC_SymbolShapeHint::SymbolShapeHint shape =
- CBC_SymbolShapeHint::FORCE_SQUARE;
- CBC_Dimension* minSize = nullptr;
- CBC_Dimension* maxSize = nullptr;
- CFX_WideString ecLevel;
- CFX_WideString encoded = CBC_HighLevelEncoder::encodeHighLevel(
- contents, ecLevel, shape, minSize, maxSize, e);
- if (e != BCExceptionNO)
- return nullptr;
- CBC_SymbolInfo* symbolInfo = CBC_SymbolInfo::lookup(
- encoded.GetLength(), shape, minSize, maxSize, true, e);
- if (e != BCExceptionNO)
- return nullptr;
- CFX_WideString codewords =
- CBC_ErrorCorrection::encodeECC200(encoded, symbolInfo, e);
- if (e != BCExceptionNO)
- return nullptr;
- CBC_DefaultPlacement* placement =
- new CBC_DefaultPlacement(codewords, symbolInfo->getSymbolDataWidth(e),
- symbolInfo->getSymbolDataHeight(e));
- if (e != BCExceptionNO)
- return nullptr;
- placement->place();
- CBC_CommonByteMatrix* bytematrix = encodeLowLevel(placement, symbolInfo, e);
- if (e != BCExceptionNO)
- return nullptr;
- outWidth = bytematrix->GetWidth();
- outHeight = bytematrix->GetHeight();
- uint8_t* result = FX_Alloc2D(uint8_t, outWidth, outHeight);
- FXSYS_memcpy(result, bytematrix->GetArray(), outWidth * outHeight);
- delete bytematrix;
- delete placement;
- return result;
-}
-CBC_CommonByteMatrix* CBC_DataMatrixWriter::encodeLowLevel(
- CBC_DefaultPlacement* placement,
- CBC_SymbolInfo* symbolInfo,
- int32_t& e) {
- int32_t symbolWidth = symbolInfo->getSymbolDataWidth(e);
- if (e != BCExceptionNO)
- return nullptr;
- int32_t symbolHeight = symbolInfo->getSymbolDataHeight(e);
- if (e != BCExceptionNO)
- return nullptr;
- CBC_CommonByteMatrix* matrix = new CBC_CommonByteMatrix(
- symbolInfo->getSymbolWidth(e), symbolInfo->getSymbolHeight(e));
- if (e != BCExceptionNO)
- return nullptr;
- matrix->Init();
- int32_t matrixY = 0;
- for (int32_t y = 0; y < symbolHeight; y++) {
- int32_t matrixX;
- if ((y % symbolInfo->m_matrixHeight) == 0) {
- matrixX = 0;
- for (int32_t x = 0; x < symbolInfo->getSymbolWidth(e); x++) {
- matrix->Set(matrixX, matrixY, (x % 2) == 0);
- matrixX++;
- }
- matrixY++;
- }
- matrixX = 0;
- for (int32_t x = 0; x < symbolWidth; x++) {
- if ((x % symbolInfo->m_matrixWidth) == 0) {
- matrix->Set(matrixX, matrixY, true);
- matrixX++;
- }
- matrix->Set(matrixX, matrixY, placement->getBit(x, y));
- matrixX++;
- if ((x % symbolInfo->m_matrixWidth) == symbolInfo->m_matrixWidth - 1) {
- matrix->Set(matrixX, matrixY, (y % 2) == 0);
- matrixX++;
- }
- }
- matrixY++;
- if ((y % symbolInfo->m_matrixHeight) == symbolInfo->m_matrixHeight - 1) {
- matrixX = 0;
- for (int32_t x = 0; x < symbolInfo->getSymbolWidth(e); x++) {
- matrix->Set(matrixX, matrixY, true);
- matrixX++;
- }
- matrixY++;
- }
- }
- return matrix;
-}
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_DataMatrixWriter.h b/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_DataMatrixWriter.h
deleted file mode 100644
index af1417b588a..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_DataMatrixWriter.h
+++ /dev/null
@@ -1,36 +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 XFA_FXBARCODE_DATAMATRIX_BC_DATAMATRIXWRITER_H_
-#define XFA_FXBARCODE_DATAMATRIX_BC_DATAMATRIXWRITER_H_
-
-#include "xfa/fxbarcode/BC_TwoDimWriter.h"
-
-class CBC_CommonByteMatrix;
-class CBC_DefaultPlacement;
-class CBC_SymbolInfo;
-
-class CBC_DataMatrixWriter : public CBC_TwoDimWriter {
- public:
- CBC_DataMatrixWriter();
- ~CBC_DataMatrixWriter() override;
-
- virtual uint8_t* Encode(const CFX_WideString& contents,
- int32_t& outWidth,
- int32_t& outHeight,
- int32_t& e);
-
- // CBC_TwoDimWriter
- bool SetErrorCorrectionLevel(int32_t level) override;
-
- private:
- static CBC_CommonByteMatrix* encodeLowLevel(CBC_DefaultPlacement* placement,
- CBC_SymbolInfo* symbolInfo,
- int32_t& e);
- int32_t m_iCorrectLevel;
-};
-
-#endif // XFA_FXBARCODE_DATAMATRIX_BC_DATAMATRIXWRITER_H_
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_DefaultPlacement.cpp b/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_DefaultPlacement.cpp
deleted file mode 100644
index e7eef07b471..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_DefaultPlacement.cpp
+++ /dev/null
@@ -1,164 +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
-// Original code is licensed as follows:
-/*
- * Copyright 2006 Jeremias Maerki.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "xfa/fxbarcode/datamatrix/BC_DefaultPlacement.h"
-#include "xfa/fxbarcode/datamatrix/BC_Encoder.h"
-
-CBC_DefaultPlacement::CBC_DefaultPlacement(CFX_WideString codewords,
- int32_t numcols,
- int32_t numrows) {
- m_codewords = codewords;
- m_numcols = numcols;
- m_numrows = numrows;
- m_bits.SetSize(numcols * numrows);
- for (int32_t i = 0; i < numcols * numrows; i++) {
- m_bits[i] = (uint8_t)2;
- }
-}
-CBC_DefaultPlacement::~CBC_DefaultPlacement() {
- m_bits.RemoveAll();
-}
-int32_t CBC_DefaultPlacement::getNumrows() {
- return m_numrows;
-}
-int32_t CBC_DefaultPlacement::getNumcols() {
- return m_numcols;
-}
-CFX_ArrayTemplate<uint8_t>& CBC_DefaultPlacement::getBits() {
- return m_bits;
-}
-bool CBC_DefaultPlacement::getBit(int32_t col, int32_t row) {
- return m_bits[row * m_numcols + col] == 1;
-}
-void CBC_DefaultPlacement::setBit(int32_t col, int32_t row, bool bit) {
- m_bits[row * m_numcols + col] = bit ? (uint8_t)1 : (uint8_t)0;
-}
-bool CBC_DefaultPlacement::hasBit(int32_t col, int32_t row) {
- return m_bits[row * m_numcols + col] != 2;
-}
-void CBC_DefaultPlacement::place() {
- int32_t pos = 0;
- int32_t row = 4;
- int32_t col = 0;
- do {
- if ((row == m_numrows) && (col == 0)) {
- corner1(pos++);
- }
- if ((row == m_numrows - 2) && (col == 0) && ((m_numcols % 4) != 0)) {
- corner2(pos++);
- }
- if ((row == m_numrows - 2) && (col == 0) && (m_numcols % 8 == 4)) {
- corner3(pos++);
- }
- if ((row == m_numrows + 4) && (col == 2) && ((m_numcols % 8) == 0)) {
- corner4(pos++);
- }
- do {
- if ((row < m_numrows) && (col >= 0) && !hasBit(col, row)) {
- utah(row, col, pos++);
- }
- row -= 2;
- col += 2;
- } while (row >= 0 && (col < m_numcols));
- row++;
- col += 3;
- do {
- if ((row >= 0) && (col < m_numcols) && !hasBit(col, row)) {
- utah(row, col, pos++);
- }
- row += 2;
- col -= 2;
- } while ((row < m_numrows) && (col >= 0));
- row += 3;
- col++;
- } while ((row < m_numrows) || (col < m_numcols));
- if (!hasBit(m_numcols - 1, m_numrows - 1)) {
- setBit(m_numcols - 1, m_numrows - 1, true);
- setBit(m_numcols - 2, m_numrows - 2, true);
- }
-}
-void CBC_DefaultPlacement::module(int32_t row,
- int32_t col,
- int32_t pos,
- int32_t bit) {
- if (row < 0) {
- row += m_numrows;
- col += 4 - ((m_numrows + 4) % 8);
- }
- if (col < 0) {
- col += m_numcols;
- row += 4 - ((m_numcols + 4) % 8);
- }
- int32_t v = m_codewords.GetAt(pos);
- v &= 1 << (8 - bit);
- setBit(col, row, v != 0);
-}
-void CBC_DefaultPlacement::utah(int32_t row, int32_t col, int32_t pos) {
- module(row - 2, col - 2, pos, 1);
- module(row - 2, col - 1, pos, 2);
- module(row - 1, col - 2, pos, 3);
- module(row - 1, col - 1, pos, 4);
- module(row - 1, col, pos, 5);
- module(row, col - 2, pos, 6);
- module(row, col - 1, pos, 7);
- module(row, col, pos, 8);
-}
-void CBC_DefaultPlacement::corner1(int32_t pos) {
- module(m_numrows - 1, 0, pos, 1);
- module(m_numrows - 1, 1, pos, 2);
- module(m_numrows - 1, 2, pos, 3);
- module(0, m_numcols - 2, pos, 4);
- module(0, m_numcols - 1, pos, 5);
- module(1, m_numcols - 1, pos, 6);
- module(2, m_numcols - 1, pos, 7);
- module(3, m_numcols - 1, pos, 8);
-}
-void CBC_DefaultPlacement::corner2(int32_t pos) {
- module(m_numrows - 3, 0, pos, 1);
- module(m_numrows - 2, 0, pos, 2);
- module(m_numrows - 1, 0, pos, 3);
- module(0, m_numcols - 4, pos, 4);
- module(0, m_numcols - 3, pos, 5);
- module(0, m_numcols - 2, pos, 6);
- module(0, m_numcols - 1, pos, 7);
- module(1, m_numcols - 1, pos, 8);
-}
-void CBC_DefaultPlacement::corner3(int32_t pos) {
- module(m_numrows - 3, 0, pos, 1);
- module(m_numrows - 2, 0, pos, 2);
- module(m_numrows - 1, 0, pos, 3);
- module(0, m_numcols - 2, pos, 4);
- module(0, m_numcols - 1, pos, 5);
- module(1, m_numcols - 1, pos, 6);
- module(2, m_numcols - 1, pos, 7);
- module(3, m_numcols - 1, pos, 8);
-}
-void CBC_DefaultPlacement::corner4(int32_t pos) {
- module(m_numrows - 1, 0, pos, 1);
- module(m_numrows - 1, m_numcols - 1, pos, 2);
- module(0, m_numcols - 3, pos, 3);
- module(0, m_numcols - 2, pos, 4);
- module(0, m_numcols - 1, pos, 5);
- module(1, m_numcols - 3, pos, 6);
- module(1, m_numcols - 2, pos, 7);
- module(1, m_numcols - 1, pos, 8);
-}
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_DefaultPlacement.h b/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_DefaultPlacement.h
deleted file mode 100644
index 36a7ab2615c..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_DefaultPlacement.h
+++ /dev/null
@@ -1,40 +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 XFA_FXBARCODE_DATAMATRIX_BC_DEFAULTPLACEMENT_H_
-#define XFA_FXBARCODE_DATAMATRIX_BC_DEFAULTPLACEMENT_H_
-
-#include "core/fxcrt/fx_basic.h"
-
-class CBC_DefaultPlacement {
- public:
- CBC_DefaultPlacement(CFX_WideString codewords,
- int32_t numcols,
- int32_t numrows);
- virtual ~CBC_DefaultPlacement();
-
- int32_t getNumrows();
- int32_t getNumcols();
- CFX_ArrayTemplate<uint8_t>& getBits();
- bool getBit(int32_t col, int32_t row);
- void setBit(int32_t col, int32_t row, bool bit);
- bool hasBit(int32_t col, int32_t row);
- void place();
-
- private:
- CFX_WideString m_codewords;
- int32_t m_numrows;
- int32_t m_numcols;
- CFX_ArrayTemplate<uint8_t> m_bits;
- void module(int32_t row, int32_t col, int32_t pos, int32_t bit);
- void utah(int32_t row, int32_t col, int32_t pos);
- void corner1(int32_t pos);
- void corner2(int32_t pos);
- void corner3(int32_t pos);
- void corner4(int32_t pos);
-};
-
-#endif // XFA_FXBARCODE_DATAMATRIX_BC_DEFAULTPLACEMENT_H_
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_EdifactEncoder.cpp b/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_EdifactEncoder.cpp
deleted file mode 100644
index 7db117d0037..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_EdifactEncoder.cpp
+++ /dev/null
@@ -1,154 +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
-// Original code is licensed as follows:
-/*
- * Copyright 2006-2007 Jeremias Maerki.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "xfa/fxbarcode/BC_Dimension.h"
-#include "xfa/fxbarcode/common/BC_CommonBitMatrix.h"
-#include "xfa/fxbarcode/datamatrix/BC_EdifactEncoder.h"
-#include "xfa/fxbarcode/datamatrix/BC_Encoder.h"
-#include "xfa/fxbarcode/datamatrix/BC_EncoderContext.h"
-#include "xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.h"
-#include "xfa/fxbarcode/datamatrix/BC_SymbolInfo.h"
-#include "xfa/fxbarcode/datamatrix/BC_SymbolShapeHint.h"
-
-CBC_EdifactEncoder::CBC_EdifactEncoder() {}
-CBC_EdifactEncoder::~CBC_EdifactEncoder() {}
-int32_t CBC_EdifactEncoder::getEncodingMode() {
- return EDIFACT_ENCODATION;
-}
-void CBC_EdifactEncoder::Encode(CBC_EncoderContext& context, int32_t& e) {
- CFX_WideString buffer;
- while (context.hasMoreCharacters()) {
- FX_WCHAR c = context.getCurrentChar();
- encodeChar(c, buffer, e);
- if (e != BCExceptionNO) {
- return;
- }
- context.m_pos++;
- int32_t count = buffer.GetLength();
- if (count >= 4) {
- context.writeCodewords(encodeToCodewords(buffer, 0, e));
- if (e != BCExceptionNO) {
- return;
- }
- buffer.Delete(0, 4);
- int32_t newMode = CBC_HighLevelEncoder::lookAheadTest(
- context.m_msg, context.m_pos, getEncodingMode());
- if (newMode != getEncodingMode()) {
- context.signalEncoderChange(ASCII_ENCODATION);
- break;
- }
- }
- }
- buffer += (FX_WCHAR)31;
- handleEOD(context, buffer, e);
-}
-void CBC_EdifactEncoder::handleEOD(CBC_EncoderContext& context,
- CFX_WideString buffer,
- int32_t& e) {
- int32_t count = buffer.GetLength();
- if (count == 0) {
- return;
- }
- if (count == 1) {
- context.updateSymbolInfo(e);
- if (e != BCExceptionNO) {
- return;
- }
- int32_t available =
- context.m_symbolInfo->m_dataCapacity - context.getCodewordCount();
- int32_t remaining = context.getRemainingCharacters();
- if (remaining == 0 && available <= 2) {
- return;
- }
- }
- if (count > 4) {
- e = BCExceptionIllegalStateCountMustNotExceed4;
- return;
- }
- int32_t restChars = count - 1;
- CFX_WideString encoded = encodeToCodewords(buffer, 0, e);
- if (e != BCExceptionNO) {
- return;
- }
- bool endOfSymbolReached = !context.hasMoreCharacters();
- bool restInAscii = endOfSymbolReached && restChars <= 2;
- if (restChars <= 2) {
- context.updateSymbolInfo(context.getCodewordCount() + restChars, e);
- if (e != BCExceptionNO) {
- return;
- }
- int32_t available =
- context.m_symbolInfo->m_dataCapacity - context.getCodewordCount();
- if (available >= 3) {
- restInAscii = false;
- context.updateSymbolInfo(context.getCodewordCount() + encoded.GetLength(),
- e);
- if (e != BCExceptionNO) {
- return;
- }
- }
- }
- if (restInAscii) {
- context.resetSymbolInfo();
- context.m_pos -= restChars;
- } else {
- context.writeCodewords(encoded);
- }
- context.signalEncoderChange(ASCII_ENCODATION);
-}
-void CBC_EdifactEncoder::encodeChar(FX_WCHAR c,
- CFX_WideString& sb,
- int32_t& e) {
- if (c >= ' ' && c <= '?') {
- sb += c;
- } else if (c >= '@' && c <= '^') {
- sb += (FX_WCHAR)(c - 64);
- } else {
- CBC_HighLevelEncoder::illegalCharacter(c, e);
- }
-}
-CFX_WideString CBC_EdifactEncoder::encodeToCodewords(CFX_WideString sb,
- int32_t startPos,
- int32_t& e) {
- int32_t len = sb.GetLength() - startPos;
- if (len == 0) {
- e = BCExceptionNoContents;
- return CFX_WideString();
- }
- FX_WCHAR c1 = sb.GetAt(startPos);
- FX_WCHAR c2 = len >= 2 ? sb.GetAt(startPos + 1) : 0;
- FX_WCHAR c3 = len >= 3 ? sb.GetAt(startPos + 2) : 0;
- FX_WCHAR c4 = len >= 4 ? sb.GetAt(startPos + 3) : 0;
- int32_t v = (c1 << 18) + (c2 << 12) + (c3 << 6) + c4;
- FX_WCHAR cw1 = (FX_WCHAR)((v >> 16) & 255);
- FX_WCHAR cw2 = (FX_WCHAR)((v >> 8) & 255);
- FX_WCHAR cw3 = (FX_WCHAR)(v & 255);
- CFX_WideString res;
- res += cw1;
- if (len >= 2) {
- res += cw2;
- }
- if (len >= 3) {
- res += cw3;
- }
- return res;
-}
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_EdifactEncoder.h b/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_EdifactEncoder.h
deleted file mode 100644
index 3eb762fe6d1..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_EdifactEncoder.h
+++ /dev/null
@@ -1,31 +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 XFA_FXBARCODE_DATAMATRIX_BC_EDIFACTENCODER_H_
-#define XFA_FXBARCODE_DATAMATRIX_BC_EDIFACTENCODER_H_
-
-#include "xfa/fxbarcode/datamatrix/BC_Encoder.h"
-
-class CBC_EdifactEncoder : public CBC_Encoder {
- public:
- CBC_EdifactEncoder();
- ~CBC_EdifactEncoder() override;
-
- // CBC_Encoder
- int32_t getEncodingMode() override;
- void Encode(CBC_EncoderContext& context, int32_t& e) override;
-
- private:
- static void handleEOD(CBC_EncoderContext& context,
- CFX_WideString buffer,
- int32_t& e);
- static void encodeChar(FX_WCHAR c, CFX_WideString& sb, int32_t& e);
- static CFX_WideString encodeToCodewords(CFX_WideString sb,
- int32_t startPos,
- int32_t& e);
-};
-
-#endif // XFA_FXBARCODE_DATAMATRIX_BC_EDIFACTENCODER_H_
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_Encoder.cpp b/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_Encoder.cpp
deleted file mode 100644
index bf815bdfa7d..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_Encoder.cpp
+++ /dev/null
@@ -1,10 +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
-
-#include "xfa/fxbarcode/datamatrix/BC_Encoder.h"
-
-CBC_Encoder::CBC_Encoder() {}
-CBC_Encoder::~CBC_Encoder() {}
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_Encoder.h b/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_Encoder.h
deleted file mode 100644
index 68a223fee1c..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_Encoder.h
+++ /dev/null
@@ -1,23 +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 XFA_FXBARCODE_DATAMATRIX_BC_ENCODER_H_
-#define XFA_FXBARCODE_DATAMATRIX_BC_ENCODER_H_
-
-#include "xfa/fxbarcode/utils.h"
-
-class CBC_EncoderContext;
-
-class CBC_Encoder {
- public:
- CBC_Encoder();
- virtual ~CBC_Encoder();
-
- virtual int32_t getEncodingMode() = 0;
- virtual void Encode(CBC_EncoderContext& context, int32_t& e) = 0;
-};
-
-#endif // XFA_FXBARCODE_DATAMATRIX_BC_ENCODER_H_
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_EncoderContext.cpp b/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_EncoderContext.cpp
deleted file mode 100644
index b01b3120e33..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_EncoderContext.cpp
+++ /dev/null
@@ -1,112 +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
-// Original code is licensed as follows:
-/*
- * Copyright 2006-2007 Jeremias Maerki.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "xfa/fxbarcode/BC_Dimension.h"
-#include "xfa/fxbarcode/BC_UtilCodingConvert.h"
-#include "xfa/fxbarcode/common/BC_CommonBitMatrix.h"
-#include "xfa/fxbarcode/datamatrix/BC_Encoder.h"
-#include "xfa/fxbarcode/datamatrix/BC_EncoderContext.h"
-#include "xfa/fxbarcode/datamatrix/BC_SymbolInfo.h"
-#include "xfa/fxbarcode/datamatrix/BC_SymbolShapeHint.h"
-
-CBC_EncoderContext::CBC_EncoderContext(const CFX_WideString msg,
- CFX_WideString ecLevel,
- int32_t& e) {
- CFX_ByteString dststr;
- CBC_UtilCodingConvert::UnicodeToUTF8(msg, dststr);
- CFX_WideString sb;
- int32_t c = dststr.GetLength();
- for (int32_t i = 0; i < c; i++) {
- FX_WCHAR ch = (FX_WCHAR)(dststr.GetAt(i) & 0xff);
- if (ch == '?' && dststr.GetAt(i) != '?') {
- e = BCExceptionCharactersOutsideISO88591Encoding;
- }
- sb += ch;
- }
- m_msg = sb;
- m_shape = FORCE_NONE;
- m_newEncoding = -1;
- m_pos = 0;
- m_symbolInfo = nullptr;
- m_skipAtEnd = 0;
- m_maxSize = nullptr;
- m_minSize = nullptr;
-}
-CBC_EncoderContext::~CBC_EncoderContext() {}
-void CBC_EncoderContext::setSymbolShape(SymbolShapeHint shape) {
- m_shape = shape;
-}
-void CBC_EncoderContext::setSizeConstraints(CBC_Dimension* minSize,
- CBC_Dimension* maxSize) {
- m_maxSize = maxSize;
- m_minSize = minSize;
-}
-CFX_WideString CBC_EncoderContext::getMessage() {
- return m_msg;
-}
-void CBC_EncoderContext::setSkipAtEnd(int32_t count) {
- m_skipAtEnd = count;
-}
-FX_WCHAR CBC_EncoderContext::getCurrentChar() {
- return m_msg.GetAt(m_pos);
-}
-FX_WCHAR CBC_EncoderContext::getCurrent() {
- return m_msg.GetAt(m_pos);
-}
-void CBC_EncoderContext::writeCodewords(CFX_WideString codewords) {
- m_codewords += codewords;
-}
-void CBC_EncoderContext::writeCodeword(FX_WCHAR codeword) {
- m_codewords += codeword;
-}
-int32_t CBC_EncoderContext::getCodewordCount() {
- return m_codewords.GetLength();
-}
-void CBC_EncoderContext::signalEncoderChange(int32_t encoding) {
- m_newEncoding = encoding;
-}
-void CBC_EncoderContext::resetEncoderSignal() {
- m_newEncoding = -1;
-}
-bool CBC_EncoderContext::hasMoreCharacters() {
- return m_pos < getTotalMessageCharCount();
-}
-int32_t CBC_EncoderContext::getRemainingCharacters() {
- return getTotalMessageCharCount() - m_pos;
-}
-void CBC_EncoderContext::updateSymbolInfo(int32_t& e) {
- updateSymbolInfo(getCodewordCount(), e);
-}
-void CBC_EncoderContext::updateSymbolInfo(int32_t len, int32_t& e) {
- if (!m_symbolInfo || len > m_symbolInfo->m_dataCapacity) {
- m_symbolInfo =
- CBC_SymbolInfo::lookup(len, m_shape, m_minSize, m_maxSize, true, e);
- if (e != BCExceptionNO)
- return;
- }
-}
-void CBC_EncoderContext::resetSymbolInfo() {
- m_shape = FORCE_NONE;
-}
-int32_t CBC_EncoderContext::getTotalMessageCharCount() {
- return m_msg.GetLength() - m_skipAtEnd;
-}
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_EncoderContext.h b/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_EncoderContext.h
deleted file mode 100644
index 8d0ea5d7ed6..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_EncoderContext.h
+++ /dev/null
@@ -1,56 +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 XFA_FXBARCODE_DATAMATRIX_BC_ENCODERCONTEXT_H_
-#define XFA_FXBARCODE_DATAMATRIX_BC_ENCODERCONTEXT_H_
-
-#include "xfa/fxbarcode/datamatrix/BC_SymbolShapeHint.h"
-
-class CBC_SymbolInfo;
-class CBC_Dimension;
-
-class CBC_EncoderContext : public CBC_SymbolShapeHint {
- public:
- CBC_EncoderContext(const CFX_WideString msg,
- CFX_WideString ecLevel,
- int32_t& e);
- ~CBC_EncoderContext() override;
-
- void setSymbolShape(SymbolShapeHint shape);
- void setSizeConstraints(CBC_Dimension* minSize, CBC_Dimension* maxSize);
- CFX_WideString getMessage();
- void setSkipAtEnd(int32_t count);
- FX_WCHAR getCurrentChar();
- FX_WCHAR getCurrent();
- void writeCodewords(CFX_WideString codewords);
- void writeCodeword(FX_WCHAR codeword);
- int32_t getCodewordCount();
- void signalEncoderChange(int32_t encoding);
- void resetEncoderSignal();
- bool hasMoreCharacters();
- int32_t getRemainingCharacters();
- void updateSymbolInfo(int32_t& e);
- void updateSymbolInfo(int32_t len, int32_t& e);
- void resetSymbolInfo();
-
- public:
- CFX_WideString m_msg;
- CFX_WideString m_codewords;
- int32_t m_pos;
- int32_t m_newEncoding;
- CBC_SymbolInfo* m_symbolInfo;
-
- private:
- int32_t getTotalMessageCharCount();
-
- private:
- SymbolShapeHint m_shape;
- CBC_Dimension* m_minSize;
- CBC_Dimension* m_maxSize;
- int32_t m_skipAtEnd;
-};
-
-#endif // XFA_FXBARCODE_DATAMATRIX_BC_ENCODERCONTEXT_H_
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_ErrorCorrection.cpp b/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_ErrorCorrection.cpp
deleted file mode 100644
index 17eec1ee4f1..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_ErrorCorrection.cpp
+++ /dev/null
@@ -1,210 +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
-// Original code is licensed as follows:
-/*
- * Copyright 2006 Jeremias Maerki.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "xfa/fxbarcode/datamatrix/BC_Encoder.h"
-#include "xfa/fxbarcode/datamatrix/BC_ErrorCorrection.h"
-#include "xfa/fxbarcode/datamatrix/BC_SymbolInfo.h"
-#include "xfa/fxbarcode/datamatrix/BC_SymbolShapeHint.h"
-
-namespace {
-
-const uint8_t FACTOR_SETS[] = {5, 7, 10, 11, 12, 14, 18, 20,
- 24, 28, 36, 42, 48, 56, 62, 68};
-
-const uint8_t FACTORS_0[5] = {228, 48, 15, 111, 62};
-const uint8_t FACTORS_1[7] = {23, 68, 144, 134, 240, 92, 254};
-const uint8_t FACTORS_2[10] = {28, 24, 185, 166, 223, 248, 116, 255, 110, 61};
-const uint8_t FACTORS_3[11] = {175, 138, 205, 12, 194, 168,
- 39, 245, 60, 97, 120};
-
-const uint8_t FACTORS_4[12] = {41, 153, 158, 91, 61, 42,
- 142, 213, 97, 178, 100, 242};
-
-const uint8_t FACTORS_5[14] = {156, 97, 192, 252, 95, 9, 157,
- 119, 138, 45, 18, 186, 83, 185};
-
-const uint8_t FACTORS_6[18] = {83, 195, 100, 39, 188, 75, 66, 61, 241,
- 213, 109, 129, 94, 254, 225, 48, 90, 188};
-
-const uint8_t FACTORS_7[20] = {15, 195, 244, 9, 233, 71, 168, 2, 188, 160,
- 153, 145, 253, 79, 108, 82, 27, 174, 186, 172};
-
-const uint8_t FACTORS_8[24] = {52, 190, 88, 205, 109, 39, 176, 21,
- 155, 197, 251, 223, 155, 21, 5, 172,
- 254, 124, 12, 181, 184, 96, 50, 193};
-
-const uint8_t FACTORS_9[28] = {211, 231, 43, 97, 71, 96, 103, 174, 37, 151,
- 170, 53, 75, 34, 249, 121, 17, 138, 110, 213,
- 141, 136, 120, 151, 233, 168, 93, 255};
-
-const uint8_t FACTORS_10[36] = {245, 127, 242, 218, 130, 250, 162, 181, 102,
- 120, 84, 179, 220, 251, 80, 182, 229, 18,
- 2, 4, 68, 33, 101, 137, 95, 119, 115,
- 44, 175, 184, 59, 25, 225, 98, 81, 112};
-
-const uint8_t FACTORS_11[42] = {
- 77, 193, 137, 31, 19, 38, 22, 153, 247, 105, 122, 2, 245, 133,
- 242, 8, 175, 95, 100, 9, 167, 105, 214, 111, 57, 121, 21, 1,
- 253, 57, 54, 101, 248, 202, 69, 50, 150, 177, 226, 5, 9, 5};
-
-const uint8_t FACTORS_12[48] = {
- 245, 132, 172, 223, 96, 32, 117, 22, 238, 133, 238, 231,
- 205, 188, 237, 87, 191, 106, 16, 147, 118, 23, 37, 90,
- 170, 205, 131, 88, 120, 100, 66, 138, 186, 240, 82, 44,
- 176, 87, 187, 147, 160, 175, 69, 213, 92, 253, 225, 19};
-
-const uint8_t FACTORS_13[56] = {
- 175, 9, 223, 238, 12, 17, 220, 208, 100, 29, 175, 170, 230, 192,
- 215, 235, 150, 159, 36, 223, 38, 200, 132, 54, 228, 146, 218, 234,
- 117, 203, 29, 232, 144, 238, 22, 150, 201, 117, 62, 207, 164, 13,
- 137, 245, 127, 67, 247, 28, 155, 43, 203, 107, 233, 53, 143, 46};
-
-const uint8_t FACTORS_14[62] = {
- 242, 93, 169, 50, 144, 210, 39, 118, 202, 188, 201, 189, 143,
- 108, 196, 37, 185, 112, 134, 230, 245, 63, 197, 190, 250, 106,
- 185, 221, 175, 64, 114, 71, 161, 44, 147, 6, 27, 218, 51,
- 63, 87, 10, 40, 130, 188, 17, 163, 31, 176, 170, 4, 107,
- 232, 7, 94, 166, 224, 124, 86, 47, 11, 204};
-
-const uint8_t FACTORS_15[68] = {
- 220, 228, 173, 89, 251, 149, 159, 56, 89, 33, 147, 244, 154, 36,
- 73, 127, 213, 136, 248, 180, 234, 197, 158, 177, 68, 122, 93, 213,
- 15, 160, 227, 236, 66, 139, 153, 185, 202, 167, 179, 25, 220, 232,
- 96, 210, 231, 136, 223, 239, 181, 241, 59, 52, 172, 25, 49, 232,
- 211, 189, 64, 54, 108, 153, 132, 63, 96, 103, 82, 186};
-
-const uint8_t* const FACTORS[16] = {
- FACTORS_0, FACTORS_1, FACTORS_2, FACTORS_3, FACTORS_4, FACTORS_5,
- FACTORS_6, FACTORS_7, FACTORS_8, FACTORS_9, FACTORS_10, FACTORS_11,
- FACTORS_12, FACTORS_13, FACTORS_14, FACTORS_15};
-
-} // namespace
-
-int32_t CBC_ErrorCorrection::MODULO_VALUE = 0x12D;
-int32_t CBC_ErrorCorrection::LOG[256] = {0};
-int32_t CBC_ErrorCorrection::ALOG[256] = {0};
-void CBC_ErrorCorrection::Initialize() {
- int32_t p = 1;
- for (int32_t i = 0; i < 255; i++) {
- ALOG[i] = p;
- LOG[p] = i;
- p <<= 1;
- if (p >= 256) {
- p ^= MODULO_VALUE;
- }
- }
-}
-void CBC_ErrorCorrection::Finalize() {}
-CBC_ErrorCorrection::CBC_ErrorCorrection() {}
-CBC_ErrorCorrection::~CBC_ErrorCorrection() {}
-CFX_WideString CBC_ErrorCorrection::encodeECC200(CFX_WideString codewords,
- CBC_SymbolInfo* symbolInfo,
- int32_t& e) {
- if (codewords.GetLength() != symbolInfo->m_dataCapacity) {
- e = BCExceptionIllegalArgument;
- return CFX_WideString();
- }
- CFX_WideString sb;
- sb += codewords;
- int32_t blockCount = symbolInfo->getInterleavedBlockCount();
- if (blockCount == 1) {
- CFX_WideString ecc =
- createECCBlock(codewords, symbolInfo->m_errorCodewords, e);
- if (e != BCExceptionNO)
- return CFX_WideString();
- sb += ecc;
- } else {
- CFX_ArrayTemplate<int32_t> dataSizes;
- dataSizes.SetSize(blockCount);
- CFX_ArrayTemplate<int32_t> errorSizes;
- errorSizes.SetSize(blockCount);
- CFX_ArrayTemplate<int32_t> startPos;
- startPos.SetSize(blockCount);
- for (int32_t i = 0; i < blockCount; i++) {
- dataSizes[i] = symbolInfo->getDataLengthForInterleavedBlock(i + 1);
- errorSizes[i] = symbolInfo->getErrorLengthForInterleavedBlock(i + 1);
- startPos[i] = 0;
- if (i > 0) {
- startPos[i] = startPos[i - 1] + dataSizes[i];
- }
- }
- for (int32_t block = 0; block < blockCount; block++) {
- CFX_WideString temp;
- for (int32_t d = block; d < symbolInfo->m_dataCapacity; d += blockCount) {
- temp += (FX_WCHAR)codewords.GetAt(d);
- }
- CFX_WideString ecc = createECCBlock(temp, errorSizes[block], e);
- if (e != BCExceptionNO)
- return CFX_WideString();
- int32_t pos = 0;
- for (int32_t l = block; l < errorSizes[block] * blockCount;
- l += blockCount) {
- sb.SetAt(symbolInfo->m_dataCapacity + l, ecc.GetAt(pos++));
- }
- }
- }
- return sb;
-}
-CFX_WideString CBC_ErrorCorrection::createECCBlock(CFX_WideString codewords,
- int32_t numECWords,
- int32_t& e) {
- return createECCBlock(codewords, 0, codewords.GetLength(), numECWords, e);
-}
-CFX_WideString CBC_ErrorCorrection::createECCBlock(CFX_WideString codewords,
- int32_t start,
- int32_t len,
- int32_t numECWords,
- int32_t& e) {
- static const size_t kFactorTableNum = sizeof(FACTOR_SETS) / sizeof(int32_t);
- size_t table = 0;
- while (table < kFactorTableNum && FACTOR_SETS[table] != numECWords)
- table++;
-
- if (table >= kFactorTableNum) {
- e = BCExceptionIllegalArgument;
- return CFX_WideString();
- }
- uint16_t* ecc = FX_Alloc(uint16_t, numECWords);
- FXSYS_memset(ecc, 0, numECWords * sizeof(uint16_t));
- for (int32_t l = start; l < start + len; l++) {
- uint16_t m = ecc[numECWords - 1] ^ codewords.GetAt(l);
- for (int32_t k = numECWords - 1; k > 0; k--) {
- if (m != 0 && FACTORS[table][k] != 0) {
- ecc[k] = (uint16_t)(ecc[k - 1] ^
- ALOG[(LOG[m] + LOG[FACTORS[table][k]]) % 255]);
- } else {
- ecc[k] = ecc[k - 1];
- }
- }
- if (m != 0 && FACTORS[table][0] != 0) {
- ecc[0] = (uint16_t)ALOG[(LOG[m] + LOG[FACTORS[table][0]]) % 255];
- } else {
- ecc[0] = 0;
- }
- }
- CFX_WideString strecc;
- for (int32_t j = 0; j < numECWords; j++) {
- strecc += (FX_WCHAR)ecc[numECWords - j - 1];
- }
- FX_Free(ecc);
- return strecc;
-}
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_ErrorCorrection.h b/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_ErrorCorrection.h
deleted file mode 100644
index d3b9da80567..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_ErrorCorrection.h
+++ /dev/null
@@ -1,39 +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 XFA_FXBARCODE_DATAMATRIX_BC_ERRORCORRECTION_H_
-#define XFA_FXBARCODE_DATAMATRIX_BC_ERRORCORRECTION_H_
-
-class CBC_SymbolInfo;
-
-class CBC_ErrorCorrection {
- public:
- CBC_ErrorCorrection();
- virtual ~CBC_ErrorCorrection();
-
- static void Initialize();
- static void Finalize();
- static CFX_WideString encodeECC200(CFX_WideString codewords,
- CBC_SymbolInfo* symbolInfo,
- int32_t& e);
-
- private:
- static int32_t MODULO_VALUE;
- static int32_t LOG[256];
- static int32_t ALOG[256];
-
- private:
- static CFX_WideString createECCBlock(CFX_WideString codewords,
- int32_t numECWords,
- int32_t& e);
- static CFX_WideString createECCBlock(CFX_WideString codewords,
- int32_t start,
- int32_t len,
- int32_t numECWords,
- int32_t& e);
-};
-
-#endif // XFA_FXBARCODE_DATAMATRIX_BC_ERRORCORRECTION_H_
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp b/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp
deleted file mode 100644
index abd3584761b..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp
+++ /dev/null
@@ -1,371 +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
-// Original code is licensed as follows:
-/*
- * Copyright 2006-2007 Jeremias Maerki.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <limits>
-#include <memory>
-#include <vector>
-
-#include "xfa/fxbarcode/BC_Dimension.h"
-#include "xfa/fxbarcode/BC_UtilCodingConvert.h"
-#include "xfa/fxbarcode/common/BC_CommonBitMatrix.h"
-#include "xfa/fxbarcode/datamatrix/BC_ASCIIEncoder.h"
-#include "xfa/fxbarcode/datamatrix/BC_Base256Encoder.h"
-#include "xfa/fxbarcode/datamatrix/BC_C40Encoder.h"
-#include "xfa/fxbarcode/datamatrix/BC_EdifactEncoder.h"
-#include "xfa/fxbarcode/datamatrix/BC_Encoder.h"
-#include "xfa/fxbarcode/datamatrix/BC_EncoderContext.h"
-#include "xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.h"
-#include "xfa/fxbarcode/datamatrix/BC_SymbolInfo.h"
-#include "xfa/fxbarcode/datamatrix/BC_SymbolShapeHint.h"
-#include "xfa/fxbarcode/datamatrix/BC_TextEncoder.h"
-#include "xfa/fxbarcode/datamatrix/BC_X12Encoder.h"
-#include "xfa/fxbarcode/utils.h"
-
-FX_WCHAR CBC_HighLevelEncoder::LATCH_TO_C40 = 230;
-FX_WCHAR CBC_HighLevelEncoder::LATCH_TO_BASE256 = 231;
-FX_WCHAR CBC_HighLevelEncoder::UPPER_SHIFT = 235;
-FX_WCHAR CBC_HighLevelEncoder::LATCH_TO_ANSIX12 = 238;
-FX_WCHAR CBC_HighLevelEncoder::LATCH_TO_TEXT = 239;
-FX_WCHAR CBC_HighLevelEncoder::LATCH_TO_EDIFACT = 240;
-FX_WCHAR CBC_HighLevelEncoder::C40_UNLATCH = 254;
-FX_WCHAR CBC_HighLevelEncoder::X12_UNLATCH = 254;
-FX_WCHAR CBC_HighLevelEncoder::PAD = 129;
-FX_WCHAR CBC_HighLevelEncoder::MACRO_05 = 236;
-FX_WCHAR CBC_HighLevelEncoder::MACRO_06 = 237;
-const wchar_t* CBC_HighLevelEncoder::MACRO_05_HEADER = L"[)>05";
-const wchar_t* CBC_HighLevelEncoder::MACRO_06_HEADER = L"[)>06";
-const wchar_t CBC_HighLevelEncoder::MACRO_TRAILER = 0x0004;
-
-CBC_HighLevelEncoder::CBC_HighLevelEncoder() {}
-CBC_HighLevelEncoder::~CBC_HighLevelEncoder() {}
-
-CFX_ArrayTemplate<uint8_t>& CBC_HighLevelEncoder::getBytesForMessage(
- CFX_WideString msg) {
- CFX_ByteString bytestr;
- CBC_UtilCodingConvert::UnicodeToUTF8(msg, bytestr);
- for (int32_t i = 0; i < bytestr.GetLength(); i++) {
- m_bytearray.Add(bytestr.GetAt(i));
- }
- return m_bytearray;
-}
-CFX_WideString CBC_HighLevelEncoder::encodeHighLevel(CFX_WideString msg,
- CFX_WideString ecLevel,
- int32_t& e) {
- return encodeHighLevel(msg, ecLevel, FORCE_NONE, nullptr, nullptr, e);
-}
-CFX_WideString CBC_HighLevelEncoder::encodeHighLevel(CFX_WideString msg,
- CFX_WideString ecLevel,
- SymbolShapeHint shape,
- CBC_Dimension* minSize,
- CBC_Dimension* maxSize,
- int32_t& e) {
- CBC_EncoderContext context(msg, ecLevel, e);
- if (e != BCExceptionNO)
- return CFX_WideString();
- context.setSymbolShape(shape);
- context.setSizeConstraints(minSize, maxSize);
- if ((msg.Mid(0, 6) == MACRO_05_HEADER) &&
- (msg.Mid(msg.GetLength() - 1, 1) == MACRO_TRAILER)) {
- context.writeCodeword(MACRO_05);
- context.setSkipAtEnd(2);
- context.m_pos += 6;
- } else if ((msg.Mid(0, 6) == MACRO_06_HEADER) &&
- (msg.Mid(msg.GetLength() - 1, 1) == MACRO_TRAILER)) {
- context.writeCodeword(MACRO_06);
- context.setSkipAtEnd(2);
- context.m_pos += 6;
- }
-
- std::vector<std::unique_ptr<CBC_Encoder>> encoders;
- encoders.push_back(std::unique_ptr<CBC_Encoder>(new CBC_ASCIIEncoder()));
- encoders.push_back(std::unique_ptr<CBC_Encoder>(new CBC_C40Encoder()));
- encoders.push_back(std::unique_ptr<CBC_Encoder>(new CBC_TextEncoder()));
- encoders.push_back(std::unique_ptr<CBC_Encoder>(new CBC_X12Encoder()));
- encoders.push_back(std::unique_ptr<CBC_Encoder>(new CBC_EdifactEncoder()));
- encoders.push_back(std::unique_ptr<CBC_Encoder>(new CBC_Base256Encoder()));
- int32_t encodingMode = ASCII_ENCODATION;
- while (context.hasMoreCharacters()) {
- encoders[encodingMode]->Encode(context, e);
- if (e != BCExceptionNO)
- return L"";
-
- if (context.m_newEncoding >= 0) {
- encodingMode = context.m_newEncoding;
- context.resetEncoderSignal();
- }
- }
- int32_t len = context.m_codewords.GetLength();
- context.updateSymbolInfo(e);
- if (e != BCExceptionNO)
- return L"";
-
- int32_t capacity = context.m_symbolInfo->m_dataCapacity;
- if (len < capacity) {
- if (encodingMode != ASCII_ENCODATION &&
- encodingMode != BASE256_ENCODATION) {
- context.writeCodeword(0x00fe);
- }
- }
- CFX_WideString codewords = context.m_codewords;
- if (codewords.GetLength() < capacity) {
- codewords += PAD;
- }
- while (codewords.GetLength() < capacity) {
- codewords += (randomize253State(PAD, codewords.GetLength() + 1));
- }
- return codewords;
-}
-int32_t CBC_HighLevelEncoder::lookAheadTest(CFX_WideString msg,
- int32_t startpos,
- int32_t currentMode) {
- if (startpos >= msg.GetLength()) {
- return currentMode;
- }
- std::vector<FX_FLOAT> charCounts;
- if (currentMode == ASCII_ENCODATION) {
- charCounts.push_back(0);
- charCounts.push_back(1);
- charCounts.push_back(1);
- charCounts.push_back(1);
- charCounts.push_back(1);
- charCounts.push_back(1.25f);
- } else {
- charCounts.push_back(1);
- charCounts.push_back(2);
- charCounts.push_back(2);
- charCounts.push_back(2);
- charCounts.push_back(2);
- charCounts.push_back(2.25f);
- charCounts[currentMode] = 0;
- }
- int32_t charsProcessed = 0;
- while (true) {
- if ((startpos + charsProcessed) == msg.GetLength()) {
- int32_t min = std::numeric_limits<int32_t>::max();
- CFX_ArrayTemplate<uint8_t> mins;
- mins.SetSize(6);
- CFX_ArrayTemplate<int32_t> intCharCounts;
- intCharCounts.SetSize(6);
- min = findMinimums(charCounts, intCharCounts, min, mins);
- int32_t minCount = getMinimumCount(mins);
- if (intCharCounts[ASCII_ENCODATION] == min) {
- return ASCII_ENCODATION;
- }
- if (minCount == 1 && mins[BASE256_ENCODATION] > 0) {
- return BASE256_ENCODATION;
- }
- if (minCount == 1 && mins[EDIFACT_ENCODATION] > 0) {
- return EDIFACT_ENCODATION;
- }
- if (minCount == 1 && mins[TEXT_ENCODATION] > 0) {
- return TEXT_ENCODATION;
- }
- if (minCount == 1 && mins[X12_ENCODATION] > 0) {
- return X12_ENCODATION;
- }
- return C40_ENCODATION;
- }
- FX_WCHAR c = msg.GetAt(startpos + charsProcessed);
- charsProcessed++;
- if (isDigit(c)) {
- charCounts[ASCII_ENCODATION] += 0.5;
- } else if (isExtendedASCII(c)) {
- charCounts[ASCII_ENCODATION] =
- (FX_FLOAT)ceil(charCounts[ASCII_ENCODATION]);
- charCounts[ASCII_ENCODATION] += 2;
- } else {
- charCounts[ASCII_ENCODATION] =
- (FX_FLOAT)ceil(charCounts[ASCII_ENCODATION]);
- charCounts[ASCII_ENCODATION]++;
- }
- if (isNativeC40(c)) {
- charCounts[C40_ENCODATION] += 2.0f / 3.0f;
- } else if (isExtendedASCII(c)) {
- charCounts[C40_ENCODATION] += 8.0f / 3.0f;
- } else {
- charCounts[C40_ENCODATION] += 4.0f / 3.0f;
- }
- if (isNativeText(c)) {
- charCounts[TEXT_ENCODATION] += 2.0f / 3.0f;
- } else if (isExtendedASCII(c)) {
- charCounts[TEXT_ENCODATION] += 8.0f / 3.0f;
- } else {
- charCounts[TEXT_ENCODATION] += 4.0f / 3.0f;
- }
- if (isNativeX12(c)) {
- charCounts[X12_ENCODATION] += 2.0f / 3.0f;
- } else if (isExtendedASCII(c)) {
- charCounts[X12_ENCODATION] += 13.0f / 3.0f;
- } else {
- charCounts[X12_ENCODATION] += 10.0f / 3.0f;
- }
- if (isNativeEDIFACT(c)) {
- charCounts[EDIFACT_ENCODATION] += 3.0f / 4.0f;
- } else if (isExtendedASCII(c)) {
- charCounts[EDIFACT_ENCODATION] += 17.0f / 4.0f;
- } else {
- charCounts[EDIFACT_ENCODATION] += 13.0f / 4.0f;
- }
- if (isSpecialB256(c)) {
- charCounts[BASE256_ENCODATION] += 4;
- } else {
- charCounts[BASE256_ENCODATION]++;
- }
- if (charsProcessed >= 4) {
- CFX_ArrayTemplate<int32_t> intCharCounts;
- intCharCounts.SetSize(6);
- CFX_ArrayTemplate<uint8_t> mins;
- mins.SetSize(6);
- findMinimums(charCounts, intCharCounts,
- std::numeric_limits<int32_t>::max(), mins);
- int32_t minCount = getMinimumCount(mins);
- if (intCharCounts[ASCII_ENCODATION] < intCharCounts[BASE256_ENCODATION] &&
- intCharCounts[ASCII_ENCODATION] < intCharCounts[C40_ENCODATION] &&
- intCharCounts[ASCII_ENCODATION] < intCharCounts[TEXT_ENCODATION] &&
- intCharCounts[ASCII_ENCODATION] < intCharCounts[X12_ENCODATION] &&
- intCharCounts[ASCII_ENCODATION] < intCharCounts[EDIFACT_ENCODATION]) {
- return ASCII_ENCODATION;
- }
- if (intCharCounts[BASE256_ENCODATION] < intCharCounts[ASCII_ENCODATION] ||
- (mins[C40_ENCODATION] + mins[TEXT_ENCODATION] + mins[X12_ENCODATION] +
- mins[EDIFACT_ENCODATION]) == 0) {
- return BASE256_ENCODATION;
- }
- if (minCount == 1 && mins[EDIFACT_ENCODATION] > 0) {
- return EDIFACT_ENCODATION;
- }
- if (minCount == 1 && mins[TEXT_ENCODATION] > 0) {
- return TEXT_ENCODATION;
- }
- if (minCount == 1 && mins[X12_ENCODATION] > 0) {
- return X12_ENCODATION;
- }
- if (intCharCounts[C40_ENCODATION] + 1 < intCharCounts[ASCII_ENCODATION] &&
- intCharCounts[C40_ENCODATION] + 1 <
- intCharCounts[BASE256_ENCODATION] &&
- intCharCounts[C40_ENCODATION] + 1 <
- intCharCounts[EDIFACT_ENCODATION] &&
- intCharCounts[C40_ENCODATION] + 1 < intCharCounts[TEXT_ENCODATION]) {
- if (intCharCounts[C40_ENCODATION] < intCharCounts[X12_ENCODATION]) {
- return C40_ENCODATION;
- }
- if (intCharCounts[C40_ENCODATION] == intCharCounts[X12_ENCODATION]) {
- int32_t p = startpos + charsProcessed + 1;
- while (p < msg.GetLength()) {
- FX_WCHAR tc = msg.GetAt(p);
- if (isX12TermSep(tc)) {
- return X12_ENCODATION;
- }
- if (!isNativeX12(tc)) {
- break;
- }
- p++;
- }
- return C40_ENCODATION;
- }
- }
- }
- }
-}
-bool CBC_HighLevelEncoder::isDigit(FX_WCHAR ch) {
- return ch >= '0' && ch <= '9';
-}
-bool CBC_HighLevelEncoder::isExtendedASCII(FX_WCHAR ch) {
- return ch >= 128 && ch <= 255;
-}
-int32_t CBC_HighLevelEncoder::determineConsecutiveDigitCount(CFX_WideString msg,
- int32_t startpos) {
- int32_t count = 0;
- int32_t len = msg.GetLength();
- int32_t idx = startpos;
- if (idx < len) {
- FX_WCHAR ch = msg.GetAt(idx);
- while (isDigit(ch) && idx < len) {
- count++;
- idx++;
- if (idx < len) {
- ch = msg.GetAt(idx);
- }
- }
- }
- return count;
-}
-void CBC_HighLevelEncoder::illegalCharacter(FX_WCHAR c, int32_t& e) {
- e = BCExceptionIllegalArgument;
-}
-FX_WCHAR CBC_HighLevelEncoder::randomize253State(FX_WCHAR ch,
- int32_t codewordPosition) {
- int32_t pseudoRandom = ((149 * codewordPosition) % 253) + 1;
- int32_t tempVariable = ch + pseudoRandom;
- return tempVariable <= 254 ? (FX_WCHAR)tempVariable
- : (FX_WCHAR)(tempVariable - 254);
-}
-int32_t CBC_HighLevelEncoder::findMinimums(
- std::vector<FX_FLOAT>& charCounts,
- CFX_ArrayTemplate<int32_t>& intCharCounts,
- int32_t min,
- CFX_ArrayTemplate<uint8_t>& mins) {
- for (int32_t l = 0; l < mins.GetSize(); l++) {
- mins[l] = (uint8_t)0;
- }
- for (int32_t i = 0; i < 6; i++) {
- intCharCounts[i] = (int32_t)ceil(charCounts[i]);
- int32_t current = intCharCounts[i];
- if (min > current) {
- min = current;
- for (int32_t j = 0; j < mins.GetSize(); j++) {
- mins[j] = (uint8_t)0;
- }
- }
- if (min == current) {
- mins[i]++;
- }
- }
- return min;
-}
-int32_t CBC_HighLevelEncoder::getMinimumCount(
- CFX_ArrayTemplate<uint8_t>& mins) {
- int32_t minCount = 0;
- for (int32_t i = 0; i < 6; i++) {
- minCount += mins[i];
- }
- return minCount;
-}
-bool CBC_HighLevelEncoder::isNativeC40(FX_WCHAR ch) {
- return (ch == ' ') || (ch >= '0' && ch <= '9') || (ch >= 'A' && ch <= 'Z');
-}
-bool CBC_HighLevelEncoder::isNativeText(FX_WCHAR ch) {
- return (ch == ' ') || (ch >= '0' && ch <= '9') || (ch >= 'a' && ch <= 'z');
-}
-bool CBC_HighLevelEncoder::isNativeX12(FX_WCHAR ch) {
- return isX12TermSep(ch) || (ch == ' ') || (ch >= '0' && ch <= '9') ||
- (ch >= 'A' && ch <= 'Z');
-}
-bool CBC_HighLevelEncoder::isX12TermSep(FX_WCHAR ch) {
- return (ch == '\r') || (ch == '*') || (ch == '>');
-}
-bool CBC_HighLevelEncoder::isNativeEDIFACT(FX_WCHAR ch) {
- return ch >= ' ' && ch <= '^';
-}
-bool CBC_HighLevelEncoder::isSpecialB256(FX_WCHAR ch) {
- return false;
-}
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.h b/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.h
deleted file mode 100644
index 5d72f1074e3..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.h
+++ /dev/null
@@ -1,79 +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 XFA_FXBARCODE_DATAMATRIX_BC_HIGHLEVELENCODER_H_
-#define XFA_FXBARCODE_DATAMATRIX_BC_HIGHLEVELENCODER_H_
-
-#include <vector>
-
-#include "xfa/fxbarcode/datamatrix/BC_SymbolShapeHint.h"
-
-#define ASCII_ENCODATION 0
-#define C40_ENCODATION 1
-#define TEXT_ENCODATION 2
-#define X12_ENCODATION 3
-#define EDIFACT_ENCODATION 4
-#define BASE256_ENCODATION 5
-
-class CBC_HighLevelEncoder : public CBC_SymbolShapeHint {
- public:
- CBC_HighLevelEncoder();
- ~CBC_HighLevelEncoder() override;
-
- CFX_ArrayTemplate<uint8_t>& getBytesForMessage(CFX_WideString msg);
- static CFX_WideString encodeHighLevel(CFX_WideString msg,
- CFX_WideString ecLevel,
- int32_t& e);
- static CFX_WideString encodeHighLevel(CFX_WideString msg,
- CFX_WideString ecLevel,
- SymbolShapeHint shape,
- CBC_Dimension* minSize,
- CBC_Dimension* maxSize,
- int32_t& e);
- static int32_t lookAheadTest(CFX_WideString msg,
- int32_t startpos,
- int32_t currentMode);
- static bool isDigit(FX_WCHAR ch);
- static bool isExtendedASCII(FX_WCHAR ch);
- static int32_t determineConsecutiveDigitCount(CFX_WideString msg,
- int32_t startpos);
- static void illegalCharacter(FX_WCHAR c, int32_t& e);
-
- public:
- static FX_WCHAR LATCH_TO_C40;
- static FX_WCHAR LATCH_TO_BASE256;
- static FX_WCHAR UPPER_SHIFT;
- static FX_WCHAR LATCH_TO_ANSIX12;
- static FX_WCHAR LATCH_TO_TEXT;
- static FX_WCHAR LATCH_TO_EDIFACT;
- static FX_WCHAR C40_UNLATCH;
- static FX_WCHAR X12_UNLATCH;
-
- private:
- static FX_WCHAR PAD;
- static FX_WCHAR MACRO_05;
- static FX_WCHAR MACRO_06;
- static const wchar_t* MACRO_05_HEADER;
- static const wchar_t* MACRO_06_HEADER;
- static const wchar_t MACRO_TRAILER;
- CFX_ArrayTemplate<uint8_t> m_bytearray;
-
- private:
- static FX_WCHAR randomize253State(FX_WCHAR ch, int32_t codewordPosition);
- static int32_t findMinimums(std::vector<FX_FLOAT>& charCounts,
- CFX_ArrayTemplate<int32_t>& intCharCounts,
- int32_t min,
- CFX_ArrayTemplate<uint8_t>& mins);
- static int32_t getMinimumCount(CFX_ArrayTemplate<uint8_t>& mins);
- static bool isNativeC40(FX_WCHAR ch);
- static bool isNativeText(FX_WCHAR ch);
- static bool isNativeX12(FX_WCHAR ch);
- static bool isX12TermSep(FX_WCHAR ch);
- static bool isNativeEDIFACT(FX_WCHAR ch);
- static bool isSpecialB256(FX_WCHAR ch);
-};
-
-#endif // XFA_FXBARCODE_DATAMATRIX_BC_HIGHLEVELENCODER_H_
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_SymbolInfo.cpp b/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_SymbolInfo.cpp
deleted file mode 100644
index ae74b8b2d43..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_SymbolInfo.cpp
+++ /dev/null
@@ -1,230 +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
-// Original code is licensed as follows:
-/*
- * Copyright 2006 Jeremias Maerki
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "xfa/fxbarcode/datamatrix/BC_SymbolInfo.h"
-
-#include "xfa/fxbarcode/BC_Dimension.h"
-#include "xfa/fxbarcode/common/BC_CommonBitMatrix.h"
-#include "xfa/fxbarcode/datamatrix/BC_DataMatrixSymbolInfo144.h"
-#include "xfa/fxbarcode/datamatrix/BC_Encoder.h"
-#include "xfa/fxbarcode/datamatrix/BC_SymbolShapeHint.h"
-
-namespace {
-
-const size_t kSymbolsCount = 30;
-
-CBC_SymbolInfo* g_symbols[kSymbolsCount] = {
- nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
- nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
- nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
- nullptr, nullptr, nullptr, nullptr, nullptr, nullptr};
-
-} // namespace
-
-void CBC_SymbolInfo::Initialize() {
- g_symbols[0] = new CBC_SymbolInfo(false, 3, 5, 8, 8, 1);
- g_symbols[1] = new CBC_SymbolInfo(false, 5, 7, 10, 10, 1);
- g_symbols[2] = new CBC_SymbolInfo(true, 5, 7, 16, 6, 1);
- g_symbols[3] = new CBC_SymbolInfo(false, 8, 10, 12, 12, 1);
- g_symbols[4] = new CBC_SymbolInfo(true, 10, 11, 14, 6, 2);
- g_symbols[5] = new CBC_SymbolInfo(false, 12, 12, 14, 14, 1);
- g_symbols[6] = new CBC_SymbolInfo(true, 16, 14, 24, 10, 1);
- g_symbols[7] = new CBC_SymbolInfo(false, 18, 14, 16, 16, 1);
- g_symbols[8] = new CBC_SymbolInfo(false, 22, 18, 18, 18, 1);
- g_symbols[9] = new CBC_SymbolInfo(true, 22, 18, 16, 10, 2);
- g_symbols[10] = new CBC_SymbolInfo(false, 30, 20, 20, 20, 1);
- g_symbols[11] = new CBC_SymbolInfo(true, 32, 24, 16, 14, 2);
- g_symbols[12] = new CBC_SymbolInfo(false, 36, 24, 22, 22, 1);
- g_symbols[13] = new CBC_SymbolInfo(false, 44, 28, 24, 24, 1);
- g_symbols[14] = new CBC_SymbolInfo(true, 49, 28, 22, 14, 2);
- g_symbols[15] = new CBC_SymbolInfo(false, 62, 36, 14, 14, 4);
- g_symbols[16] = new CBC_SymbolInfo(false, 86, 42, 16, 16, 4);
- g_symbols[17] = new CBC_SymbolInfo(false, 114, 48, 18, 18, 4);
- g_symbols[18] = new CBC_SymbolInfo(false, 144, 56, 20, 20, 4);
- g_symbols[19] = new CBC_SymbolInfo(false, 174, 68, 22, 22, 4);
- g_symbols[20] = new CBC_SymbolInfo(false, 204, 84, 24, 24, 4, 102, 42);
- g_symbols[21] = new CBC_SymbolInfo(false, 280, 112, 14, 14, 16, 140, 56);
- g_symbols[22] = new CBC_SymbolInfo(false, 368, 144, 16, 16, 16, 92, 36);
- g_symbols[23] = new CBC_SymbolInfo(false, 456, 192, 18, 18, 16, 114, 48);
- g_symbols[24] = new CBC_SymbolInfo(false, 576, 224, 20, 20, 16, 144, 56);
- g_symbols[25] = new CBC_SymbolInfo(false, 696, 272, 22, 22, 16, 174, 68);
- g_symbols[26] = new CBC_SymbolInfo(false, 816, 336, 24, 24, 16, 136, 56);
- g_symbols[27] = new CBC_SymbolInfo(false, 1050, 408, 18, 18, 36, 175, 68);
- g_symbols[28] = new CBC_SymbolInfo(false, 1304, 496, 20, 20, 36, 163, 62);
- g_symbols[29] = new CBC_DataMatrixSymbolInfo144();
-}
-
-void CBC_SymbolInfo::Finalize() {
- for (size_t i = 0; i < kSymbolsCount; i++) {
- delete g_symbols[i];
- g_symbols[i] = nullptr;
- }
-}
-
-CBC_SymbolInfo::CBC_SymbolInfo(bool rectangular,
- int32_t dataCapacity,
- int32_t errorCodewords,
- int32_t matrixWidth,
- int32_t matrixHeight,
- int32_t dataRegions) {
- m_rectangular = rectangular;
- m_dataCapacity = dataCapacity;
- m_errorCodewords = errorCodewords;
- m_matrixWidth = matrixWidth;
- m_matrixHeight = matrixHeight;
- m_dataRegions = dataRegions;
- m_rsBlockData = dataCapacity;
- m_rsBlockError = errorCodewords;
-}
-CBC_SymbolInfo::CBC_SymbolInfo(bool rectangular,
- int32_t dataCapacity,
- int32_t errorCodewords,
- int32_t matrixWidth,
- int32_t matrixHeight,
- int32_t dataRegions,
- int32_t rsBlockData,
- int32_t rsBlockError) {
- m_rectangular = rectangular;
- m_dataCapacity = dataCapacity;
- m_errorCodewords = errorCodewords;
- m_matrixWidth = matrixWidth;
- m_matrixHeight = matrixHeight;
- m_dataRegions = dataRegions;
- m_rsBlockData = rsBlockData;
- m_rsBlockError = rsBlockError;
-}
-CBC_SymbolInfo::~CBC_SymbolInfo() {}
-
-CBC_SymbolInfo* CBC_SymbolInfo::lookup(int32_t dataCodewords, int32_t& e) {
- return lookup(dataCodewords, FORCE_NONE, true, e);
-}
-CBC_SymbolInfo* CBC_SymbolInfo::lookup(int32_t dataCodewords,
- SymbolShapeHint shape,
- int32_t& e) {
- return lookup(dataCodewords, shape, true, e);
-}
-CBC_SymbolInfo* CBC_SymbolInfo::lookup(int32_t dataCodewords,
- bool allowRectangular,
- bool fail,
- int32_t& e) {
- SymbolShapeHint shape = allowRectangular ? FORCE_NONE : FORCE_SQUARE;
- return lookup(dataCodewords, shape, fail, e);
-}
-CBC_SymbolInfo* CBC_SymbolInfo::lookup(int32_t dataCodewords,
- SymbolShapeHint shape,
- bool fail,
- int32_t& e) {
- return lookup(dataCodewords, shape, nullptr, nullptr, fail, e);
-}
-CBC_SymbolInfo* CBC_SymbolInfo::lookup(int32_t dataCodewords,
- SymbolShapeHint shape,
- CBC_Dimension* minSize,
- CBC_Dimension* maxSize,
- bool fail,
- int32_t& e) {
- for (size_t i = 0; i < kSymbolsCount; i++) {
- CBC_SymbolInfo* symbol = g_symbols[i];
- if (shape == FORCE_SQUARE && symbol->m_rectangular) {
- continue;
- }
- if (shape == FORCE_RECTANGLE && !symbol->m_rectangular) {
- continue;
- }
- if (minSize && (symbol->getSymbolWidth(e) < minSize->getWidth() ||
- symbol->getSymbolHeight(e) < minSize->getHeight())) {
- if (e != BCExceptionNO)
- return nullptr;
- continue;
- }
- if (maxSize && (symbol->getSymbolWidth(e) > maxSize->getWidth() ||
- symbol->getSymbolHeight(e) > maxSize->getHeight())) {
- if (e != BCExceptionNO)
- return nullptr;
- continue;
- }
- if (dataCodewords <= symbol->m_dataCapacity) {
- return symbol;
- }
- }
- if (fail)
- e = BCExceptionIllegalDataCodewords;
- return nullptr;
-}
-
-int32_t CBC_SymbolInfo::getHorizontalDataRegions(int32_t& e) {
- switch (m_dataRegions) {
- case 1:
- return 1;
- case 2:
- return 2;
- case 4:
- return 2;
- case 16:
- return 4;
- case 36:
- return 6;
- default:
- e = BCExceptionCannotHandleThisNumberOfDataRegions;
- return 0;
- }
-}
-int32_t CBC_SymbolInfo::getVerticalDataRegions(int32_t& e) {
- switch (m_dataRegions) {
- case 1:
- return 1;
- case 2:
- return 1;
- case 4:
- return 2;
- case 16:
- return 4;
- case 36:
- return 6;
- default:
- e = BCExceptionCannotHandleThisNumberOfDataRegions;
- return 0;
- }
-}
-int32_t CBC_SymbolInfo::getSymbolDataWidth(int32_t& e) {
- return getHorizontalDataRegions(e) * m_matrixWidth;
-}
-int32_t CBC_SymbolInfo::getSymbolDataHeight(int32_t& e) {
- return getVerticalDataRegions(e) * m_matrixHeight;
-}
-int32_t CBC_SymbolInfo::getSymbolWidth(int32_t& e) {
- return getSymbolDataWidth(e) + (getHorizontalDataRegions(e) * 2);
-}
-int32_t CBC_SymbolInfo::getSymbolHeight(int32_t& e) {
- return getSymbolDataHeight(e) + (getVerticalDataRegions(e) * 2);
-}
-int32_t CBC_SymbolInfo::getCodewordCount() {
- return m_dataCapacity + m_errorCodewords;
-}
-int32_t CBC_SymbolInfo::getInterleavedBlockCount() {
- return m_dataCapacity / m_rsBlockData;
-}
-int32_t CBC_SymbolInfo::getDataLengthForInterleavedBlock(int32_t index) {
- return m_rsBlockData;
-}
-int32_t CBC_SymbolInfo::getErrorLengthForInterleavedBlock(int32_t index) {
- return m_rsBlockError;
-}
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_SymbolInfo.h b/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_SymbolInfo.h
deleted file mode 100644
index d2730025db6..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_SymbolInfo.h
+++ /dev/null
@@ -1,79 +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 XFA_FXBARCODE_DATAMATRIX_BC_SYMBOLINFO_H_
-#define XFA_FXBARCODE_DATAMATRIX_BC_SYMBOLINFO_H_
-
-#include "core/fxcrt/fx_string.h"
-#include "core/fxcrt/fx_system.h"
-#include "xfa/fxbarcode/datamatrix/BC_SymbolShapeHint.h"
-
-class CBC_Dimension;
-
-class CBC_SymbolInfo : public CBC_SymbolShapeHint {
- public:
- CBC_SymbolInfo(bool rectangular,
- int32_t dataCapacity,
- int32_t errorCodewords,
- int32_t matrixWidth,
- int32_t matrixHeight,
- int32_t dataRegions);
- ~CBC_SymbolInfo() override;
-
- static void Initialize();
- static void Finalize();
- static void overrideSymbolSet(CBC_SymbolInfo* override);
- static CBC_SymbolInfo* lookup(int32_t dataCodewords, int32_t& e);
- static CBC_SymbolInfo* lookup(int32_t dataCodewords,
- SymbolShapeHint shape,
- int32_t& e);
- static CBC_SymbolInfo* lookup(int32_t dataCodewords,
- bool allowRectangular,
- bool fail,
- int32_t& e);
- static CBC_SymbolInfo* lookup(int32_t dataCodewords,
- SymbolShapeHint shape,
- bool fail,
- int32_t& e);
- static CBC_SymbolInfo* lookup(int32_t dataCodewords,
- SymbolShapeHint shape,
- CBC_Dimension* minSize,
- CBC_Dimension* maxSize,
- bool fail,
- int32_t& e);
- int32_t getHorizontalDataRegions(int32_t& e);
- int32_t getVerticalDataRegions(int32_t& e);
- int32_t getSymbolDataWidth(int32_t& e);
- int32_t getSymbolDataHeight(int32_t& e);
- int32_t getSymbolWidth(int32_t& e);
- int32_t getSymbolHeight(int32_t& e);
- int32_t getCodewordCount();
- int32_t getInterleavedBlockCount();
- int32_t getDataLengthForInterleavedBlock(int32_t index);
- int32_t getErrorLengthForInterleavedBlock(int32_t index);
-
- int32_t m_dataCapacity;
- int32_t m_errorCodewords;
- int32_t m_matrixWidth;
- int32_t m_matrixHeight;
- int32_t m_rsBlockData;
- int32_t m_rsBlockError;
-
- private:
- CBC_SymbolInfo(bool rectangular,
- int32_t dataCapacity,
- int32_t errorCodewords,
- int32_t matrixWidth,
- int32_t matrixHeight,
- int32_t dataRegions,
- int32_t rsBlockData,
- int32_t rsBlockError);
-
- bool m_rectangular;
- int32_t m_dataRegions;
-};
-
-#endif // XFA_FXBARCODE_DATAMATRIX_BC_SYMBOLINFO_H_
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_SymbolShapeHint.cpp b/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_SymbolShapeHint.cpp
deleted file mode 100644
index 8f91dd837aa..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_SymbolShapeHint.cpp
+++ /dev/null
@@ -1,26 +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
-// Original code is licensed as follows:
-/*
- * Copyright 2007 Jeremias Maerki.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "xfa/fxbarcode/datamatrix/BC_SymbolShapeHint.h"
-
-CBC_SymbolShapeHint::CBC_SymbolShapeHint() {}
-CBC_SymbolShapeHint::~CBC_SymbolShapeHint() {}
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_SymbolShapeHint.h b/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_SymbolShapeHint.h
deleted file mode 100644
index 7cd4c86931b..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_SymbolShapeHint.h
+++ /dev/null
@@ -1,22 +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 XFA_FXBARCODE_DATAMATRIX_BC_SYMBOLSHAPEHINT_H_
-#define XFA_FXBARCODE_DATAMATRIX_BC_SYMBOLSHAPEHINT_H_
-
-class CBC_SymbolShapeHint {
- public:
- CBC_SymbolShapeHint();
- virtual ~CBC_SymbolShapeHint();
-
- enum SymbolShapeHint {
- FORCE_NONE,
- FORCE_SQUARE,
- FORCE_RECTANGLE,
- };
-};
-
-#endif // XFA_FXBARCODE_DATAMATRIX_BC_SYMBOLSHAPEHINT_H_
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_TextEncoder.cpp b/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_TextEncoder.cpp
deleted file mode 100644
index e3eb4a8c4ed..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_TextEncoder.cpp
+++ /dev/null
@@ -1,99 +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
-// Original code is licensed as follows:
-/*
- * Copyright 2006-2007 Jeremias Maerki.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "xfa/fxbarcode/BC_Dimension.h"
-#include "xfa/fxbarcode/common/BC_CommonBitMatrix.h"
-#include "xfa/fxbarcode/datamatrix/BC_C40Encoder.h"
-#include "xfa/fxbarcode/datamatrix/BC_Encoder.h"
-#include "xfa/fxbarcode/datamatrix/BC_EncoderContext.h"
-#include "xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.h"
-#include "xfa/fxbarcode/datamatrix/BC_SymbolInfo.h"
-#include "xfa/fxbarcode/datamatrix/BC_SymbolShapeHint.h"
-#include "xfa/fxbarcode/datamatrix/BC_TextEncoder.h"
-
-CBC_TextEncoder::CBC_TextEncoder() {}
-CBC_TextEncoder::~CBC_TextEncoder() {}
-int32_t CBC_TextEncoder::getEncodingMode() {
- return TEXT_ENCODATION;
-}
-int32_t CBC_TextEncoder::encodeChar(FX_WCHAR c,
- CFX_WideString& sb,
- int32_t& e) {
- if (c == ' ') {
- sb += (FX_WCHAR)'\3';
- return 1;
- }
- if (c >= '0' && c <= '9') {
- sb += (FX_WCHAR)(c - 48 + 4);
- return 1;
- }
- if (c >= 'a' && c <= 'z') {
- sb += (FX_WCHAR)(c - 97 + 14);
- return 1;
- }
- if (c <= 0x1f) {
- sb += (FX_WCHAR)'\0';
- sb += c;
- return 2;
- }
- if (c >= '!' && c <= '/') {
- sb += (FX_WCHAR)'\1';
- sb += (FX_WCHAR)(c - 33);
- return 2;
- }
- if (c >= ':' && c <= '@') {
- sb += (FX_WCHAR)'\1';
- sb += (FX_WCHAR)(c - 58 + 15);
- return 2;
- }
- if (c >= '[' && c <= '_') {
- sb += (FX_WCHAR)'\1';
- sb += (FX_WCHAR)(c - 91 + 22);
- return 2;
- }
- if (c == 0x0060) {
- sb += (FX_WCHAR)'\2';
- sb += (FX_WCHAR)(c - 96);
- return 2;
- }
- if (c >= 'A' && c <= 'Z') {
- sb += (FX_WCHAR)'\2';
- sb += (FX_WCHAR)(c - 65 + 1);
- return 2;
- }
- if (c >= '{' && c <= 0x007f) {
- sb += (FX_WCHAR)'\2';
- sb += (FX_WCHAR)(c - 123 + 27);
- return 2;
- }
- if (c >= 0x0080) {
- sb += (FX_WCHAR)'\1';
- sb += (FX_WCHAR)0x001e;
- int32_t len = 2;
- len += encodeChar((FX_WCHAR)(c - 128), sb, e);
- if (e != BCExceptionNO)
- return -1;
- return len;
- }
- CBC_HighLevelEncoder::illegalCharacter(c, e);
- return -1;
-}
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_TextEncoder.h b/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_TextEncoder.h
deleted file mode 100644
index e6013b9508f..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_TextEncoder.h
+++ /dev/null
@@ -1,22 +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 XFA_FXBARCODE_DATAMATRIX_BC_TEXTENCODER_H_
-#define XFA_FXBARCODE_DATAMATRIX_BC_TEXTENCODER_H_
-
-class CBC_TextEncoder;
-
-class CBC_TextEncoder : public CBC_C40Encoder {
- public:
- CBC_TextEncoder();
- ~CBC_TextEncoder() override;
-
- // CBC_C40Encoder
- int32_t getEncodingMode() override;
- int32_t encodeChar(FX_WCHAR c, CFX_WideString& sb, int32_t& e) override;
-};
-
-#endif // XFA_FXBARCODE_DATAMATRIX_BC_TEXTENCODER_H_
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_X12Encoder.cpp b/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_X12Encoder.cpp
deleted file mode 100644
index d77af9318a9..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_X12Encoder.cpp
+++ /dev/null
@@ -1,101 +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
-// Original code is licensed as follows:
-/*
- * Copyright 2006-2007 Jeremias Maerki.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "xfa/fxbarcode/BC_Dimension.h"
-#include "xfa/fxbarcode/common/BC_CommonBitMatrix.h"
-#include "xfa/fxbarcode/datamatrix/BC_C40Encoder.h"
-#include "xfa/fxbarcode/datamatrix/BC_Encoder.h"
-#include "xfa/fxbarcode/datamatrix/BC_EncoderContext.h"
-#include "xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.h"
-#include "xfa/fxbarcode/datamatrix/BC_SymbolInfo.h"
-#include "xfa/fxbarcode/datamatrix/BC_SymbolShapeHint.h"
-#include "xfa/fxbarcode/datamatrix/BC_X12Encoder.h"
-
-CBC_X12Encoder::CBC_X12Encoder() {}
-CBC_X12Encoder::~CBC_X12Encoder() {}
-int32_t CBC_X12Encoder::getEncodingMode() {
- return X12_ENCODATION;
-}
-void CBC_X12Encoder::Encode(CBC_EncoderContext& context, int32_t& e) {
- CFX_WideString buffer;
- while (context.hasMoreCharacters()) {
- FX_WCHAR c = context.getCurrentChar();
- context.m_pos++;
- encodeChar(c, buffer, e);
- if (e != BCExceptionNO) {
- return;
- }
- int32_t count = buffer.GetLength();
- if ((count % 3) == 0) {
- writeNextTriplet(context, buffer);
- int32_t newMode = CBC_HighLevelEncoder::lookAheadTest(
- context.m_msg, context.m_pos, getEncodingMode());
- if (newMode != getEncodingMode()) {
- context.signalEncoderChange(newMode);
- break;
- }
- }
- }
- handleEOD(context, buffer, e);
-}
-void CBC_X12Encoder::handleEOD(CBC_EncoderContext& context,
- CFX_WideString& buffer,
- int32_t& e) {
- context.updateSymbolInfo(e);
- if (e != BCExceptionNO) {
- return;
- }
- int32_t available =
- context.m_symbolInfo->m_dataCapacity - context.getCodewordCount();
- int32_t count = buffer.GetLength();
- if (count == 2) {
- context.writeCodeword(CBC_HighLevelEncoder::X12_UNLATCH);
- context.m_pos -= 2;
- context.signalEncoderChange(ASCII_ENCODATION);
- } else if (count == 1) {
- context.m_pos--;
- if (available > 1) {
- context.writeCodeword(CBC_HighLevelEncoder::X12_UNLATCH);
- }
- context.signalEncoderChange(ASCII_ENCODATION);
- }
-}
-int32_t CBC_X12Encoder::encodeChar(FX_WCHAR c, CFX_WideString& sb, int32_t& e) {
- if (c == '\r') {
- sb += (FX_WCHAR)'\0';
- } else if (c == '*') {
- sb += (FX_WCHAR)'\1';
- } else if (c == '>') {
- sb += (FX_WCHAR)'\2';
- } else if (c == ' ') {
- sb += (FX_WCHAR)'\3';
- } else if (c >= '0' && c <= '9') {
- sb += (FX_WCHAR)(c - 48 + 4);
- } else if (c >= 'A' && c <= 'Z') {
- sb += (FX_WCHAR)(c - 65 + 14);
- } else {
- CBC_HighLevelEncoder::illegalCharacter(c, e);
- if (e != BCExceptionNO)
- return -1;
- }
- return 1;
-}
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_X12Encoder.h b/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_X12Encoder.h
deleted file mode 100644
index 52239ce529b..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/datamatrix/BC_X12Encoder.h
+++ /dev/null
@@ -1,26 +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 XFA_FXBARCODE_DATAMATRIX_BC_X12ENCODER_H_
-#define XFA_FXBARCODE_DATAMATRIX_BC_X12ENCODER_H_
-
-class CBC_C40Encoder;
-class CBC_X12Encoder;
-class CBC_X12Encoder : public CBC_C40Encoder {
- public:
- CBC_X12Encoder();
- ~CBC_X12Encoder() override;
-
- // CBC_C40Encoder
- int32_t getEncodingMode() override;
- void Encode(CBC_EncoderContext& context, int32_t& e) override;
- void handleEOD(CBC_EncoderContext& context,
- CFX_WideString& buffer,
- int32_t& e) override;
- int32_t encodeChar(FX_WCHAR c, CFX_WideString& sb, int32_t& e) override;
-};
-
-#endif // XFA_FXBARCODE_DATAMATRIX_BC_X12ENCODER_H_
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/oned/BC_OneDimWriter.cpp b/chromium/third_party/pdfium/xfa/fxbarcode/oned/BC_OneDimWriter.cpp
deleted file mode 100644
index bc0d61fd250..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/oned/BC_OneDimWriter.cpp
+++ /dev/null
@@ -1,485 +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
-// Original code is licensed as follows:
-/*
- * Copyright 2011 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "xfa/fxbarcode/oned/BC_OneDimWriter.h"
-
-#include <algorithm>
-#include <memory>
-
-#include "core/fxge/cfx_fxgedevice.h"
-#include "core/fxge/cfx_gemodule.h"
-#include "core/fxge/cfx_graphstatedata.h"
-#include "core/fxge/cfx_pathdata.h"
-#include "core/fxge/cfx_renderdevice.h"
-#include "core/fxge/cfx_unicodeencodingex.h"
-#include "third_party/base/ptr_util.h"
-#include "xfa/fxbarcode/BC_Writer.h"
-#include "xfa/fxbarcode/common/BC_CommonBitMatrix.h"
-
-CBC_OneDimWriter::CBC_OneDimWriter() {
- m_locTextLoc = BC_TEXT_LOC_BELOWEMBED;
- m_bPrintChecksum = true;
- m_iDataLenth = 0;
- m_bCalcChecksum = false;
- m_pFont = nullptr;
- m_fFontSize = 10;
- m_iFontStyle = 0;
- m_fontColor = 0xff000000;
- m_iContentLen = 0;
- m_bLeftPadding = false;
- m_bRightPadding = false;
-}
-
-CBC_OneDimWriter::~CBC_OneDimWriter() {}
-
-void CBC_OneDimWriter::SetPrintChecksum(bool checksum) {
- m_bPrintChecksum = checksum;
-}
-
-void CBC_OneDimWriter::SetDataLength(int32_t length) {
- m_iDataLenth = length;
-}
-
-void CBC_OneDimWriter::SetCalcChecksum(bool state) {
- m_bCalcChecksum = state;
-}
-
-bool CBC_OneDimWriter::SetFont(CFX_Font* cFont) {
- if (!cFont)
- return false;
-
- m_pFont = cFont;
- return true;
-}
-
-void CBC_OneDimWriter::SetFontSize(FX_FLOAT size) {
- m_fFontSize = size;
-}
-
-void CBC_OneDimWriter::SetFontStyle(int32_t style) {
- m_iFontStyle = style;
-}
-
-void CBC_OneDimWriter::SetFontColor(FX_ARGB color) {
- m_fontColor = color;
-}
-
-FX_WCHAR CBC_OneDimWriter::Upper(FX_WCHAR ch) {
- if (ch >= 'a' && ch <= 'z') {
- ch = ch - ('a' - 'A');
- }
- return ch;
-}
-
-uint8_t* CBC_OneDimWriter::Encode(const CFX_ByteString& contents,
- BCFORMAT format,
- int32_t& outWidth,
- int32_t& outHeight,
- int32_t hints,
- int32_t& e) {
- uint8_t* ret = nullptr;
- outHeight = 1;
- if (m_Width >= 20) {
- ret = Encode(contents, outWidth, e);
- } else {
- ret = Encode(contents, outWidth, e);
- }
- if (e != BCExceptionNO)
- return nullptr;
- return ret;
-}
-
-uint8_t* CBC_OneDimWriter::Encode(const CFX_ByteString& contents,
- BCFORMAT format,
- int32_t& outWidth,
- int32_t& outHeight,
- int32_t& e) {
- uint8_t* ret = Encode(contents, format, outWidth, outHeight, 0, e);
- if (e != BCExceptionNO)
- return nullptr;
- return ret;
-}
-
-uint8_t* CBC_OneDimWriter::Encode(const CFX_ByteString& contents,
- int32_t& outLength,
- int32_t& e) {
- return nullptr;
-}
-
-int32_t CBC_OneDimWriter::AppendPattern(uint8_t* target,
- int32_t pos,
- const int32_t* pattern,
- int32_t patternLength,
- int32_t startColor,
- int32_t& e) {
- if (startColor != 0 && startColor != 1) {
- e = BCExceptionValueMustBeEither0or1;
- return 0;
- }
- uint8_t color = (uint8_t)startColor;
- int32_t numAdded = 0;
- for (int32_t i = 0; i < patternLength; i++) {
- for (int32_t j = 0; j < pattern[i]; j++) {
- target[pos] = color;
- pos += 1;
- numAdded += 1;
- }
- color ^= 1;
- }
- return numAdded;
-}
-
-void CBC_OneDimWriter::CalcTextInfo(const CFX_ByteString& text,
- FXTEXT_CHARPOS* charPos,
- CFX_Font* cFont,
- FX_FLOAT geWidth,
- int32_t fontSize,
- FX_FLOAT& charsLen) {
- std::unique_ptr<CFX_UnicodeEncodingEx> encoding(
- FX_CreateFontEncodingEx(cFont));
-
- int32_t length = text.GetLength();
- uint32_t* pCharCode = FX_Alloc(uint32_t, text.GetLength());
- FX_FLOAT charWidth = 0;
- for (int32_t j = 0; j < text.GetLength(); j++) {
- pCharCode[j] = encoding->CharCodeFromUnicode(text[j]);
- int32_t glyp_code = encoding->GlyphFromCharCode(pCharCode[j]);
- int32_t glyp_value = cFont->GetGlyphWidth(glyp_code);
- FX_FLOAT temp = (FX_FLOAT)((glyp_value)*fontSize / 1000.0);
- charWidth += temp;
- }
- charsLen = charWidth;
- FX_FLOAT leftPositon = (FX_FLOAT)(geWidth - charsLen) / 2.0f;
- if (leftPositon < 0 && geWidth == 0) {
- leftPositon = 0;
- }
- FX_FLOAT penX = 0.0;
- FX_FLOAT penY =
- (FX_FLOAT)FXSYS_abs(cFont->GetDescent()) * (FX_FLOAT)fontSize / 1000.0f;
- FX_FLOAT left = leftPositon;
- FX_FLOAT top = 0.0;
- charPos[0].m_Origin = CFX_PointF(penX + left, penY + top);
- charPos[0].m_GlyphIndex = encoding->GlyphFromCharCode(pCharCode[0]);
- charPos[0].m_FontCharWidth = cFont->GetGlyphWidth(charPos[0].m_GlyphIndex);
-#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
- charPos[0].m_ExtGID = charPos[0].m_GlyphIndex;
-#endif
- penX += (FX_FLOAT)(charPos[0].m_FontCharWidth) * (FX_FLOAT)fontSize / 1000.0f;
- for (int32_t i = 1; i < length; i++) {
- charPos[i].m_Origin = CFX_PointF(penX + left, penY + top);
- charPos[i].m_GlyphIndex = encoding->GlyphFromCharCode(pCharCode[i]);
- charPos[i].m_FontCharWidth = cFont->GetGlyphWidth(charPos[i].m_GlyphIndex);
-#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
- charPos[i].m_ExtGID = charPos[i].m_GlyphIndex;
-#endif
- penX +=
- (FX_FLOAT)(charPos[i].m_FontCharWidth) * (FX_FLOAT)fontSize / 1000.0f;
- }
- FX_Free(pCharCode);
-}
-
-void CBC_OneDimWriter::ShowDeviceChars(CFX_RenderDevice* device,
- const CFX_Matrix* matrix,
- const CFX_ByteString str,
- FX_FLOAT geWidth,
- FXTEXT_CHARPOS* pCharPos,
- FX_FLOAT locX,
- FX_FLOAT locY,
- int32_t barWidth) {
- int32_t iFontSize = (int32_t)fabs(m_fFontSize);
- int32_t iTextHeight = iFontSize + 1;
- CFX_FloatRect rect((FX_FLOAT)locX, (FX_FLOAT)locY, (FX_FLOAT)(locX + geWidth),
- (FX_FLOAT)(locY + iTextHeight));
- if (geWidth != m_Width) {
- rect.right -= 1;
- }
- matrix->TransformRect(rect);
- FX_RECT re = rect.GetOuterRect();
- device->FillRect(&re, m_backgroundColor);
- CFX_Matrix affine_matrix(1.0, 0.0, 0.0, -1.0, (FX_FLOAT)locX,
- (FX_FLOAT)(locY + iFontSize));
- if (matrix) {
- affine_matrix.Concat(*matrix);
- }
- device->DrawNormalText(str.GetLength(), pCharPos, m_pFont,
- static_cast<FX_FLOAT>(iFontSize), &affine_matrix,
- m_fontColor, FXTEXT_CLEARTYPE);
-}
-
-void CBC_OneDimWriter::ShowBitmapChars(CFX_DIBitmap* pOutBitmap,
- const CFX_ByteString str,
- FX_FLOAT geWidth,
- FXTEXT_CHARPOS* pCharPos,
- FX_FLOAT locX,
- FX_FLOAT locY,
- int32_t barWidth) {
- int32_t iFontSize = (int32_t)fabs(m_fFontSize);
- int32_t iTextHeight = iFontSize + 1;
- CFX_FxgeDevice ge;
- ge.Create((int)geWidth, iTextHeight, m_colorSpace, nullptr);
- FX_RECT geRect(0, 0, (int)geWidth, iTextHeight);
- ge.FillRect(&geRect, m_backgroundColor);
- CFX_Matrix affine_matrix(1.0, 0.0, 0.0, -1.0, 0.0,
- static_cast<FX_FLOAT>(iFontSize));
- ge.DrawNormalText(str.GetLength(), pCharPos, m_pFont,
- static_cast<FX_FLOAT>(iFontSize), &affine_matrix,
- m_fontColor, FXTEXT_CLEARTYPE);
- CFX_FxgeDevice geBitmap;
- geBitmap.Attach(pOutBitmap, false, nullptr, false);
- geBitmap.SetDIBits(ge.GetBitmap(), (int)locX, (int)locY);
-}
-
-void CBC_OneDimWriter::ShowChars(const CFX_WideStringC& contents,
- CFX_DIBitmap* pOutBitmap,
- CFX_RenderDevice* device,
- const CFX_Matrix* matrix,
- int32_t barWidth,
- int32_t multiple,
- int32_t& e) {
- if (!device && !pOutBitmap) {
- e = BCExceptionIllegalArgument;
- return;
- }
- if (!m_pFont) {
- e = BCExceptionNullPointer;
- return;
- }
- CFX_ByteString str = FX_UTF8Encode(contents);
- int32_t iLen = str.GetLength();
- FXTEXT_CHARPOS* pCharPos = FX_Alloc(FXTEXT_CHARPOS, iLen);
- FXSYS_memset(pCharPos, 0, sizeof(FXTEXT_CHARPOS) * iLen);
- FX_FLOAT charsLen = 0;
- FX_FLOAT geWidth = 0;
- if (m_locTextLoc == BC_TEXT_LOC_ABOVEEMBED ||
- m_locTextLoc == BC_TEXT_LOC_BELOWEMBED) {
- geWidth = 0;
- } else if (m_locTextLoc == BC_TEXT_LOC_ABOVE ||
- m_locTextLoc == BC_TEXT_LOC_BELOW) {
- geWidth = (FX_FLOAT)barWidth;
- }
- int32_t iFontSize = (int32_t)fabs(m_fFontSize);
- int32_t iTextHeight = iFontSize + 1;
- CalcTextInfo(str, pCharPos, m_pFont, geWidth, iFontSize, charsLen);
- if (charsLen < 1) {
- return;
- }
- int32_t locX = 0;
- int32_t locY = 0;
- switch (m_locTextLoc) {
- case BC_TEXT_LOC_ABOVEEMBED:
- locX = (int32_t)(barWidth - charsLen) / 2;
- locY = 0;
- geWidth = charsLen;
- break;
- case BC_TEXT_LOC_ABOVE:
- locX = 0;
- locY = 0;
- geWidth = (FX_FLOAT)barWidth;
- break;
- case BC_TEXT_LOC_BELOWEMBED:
- locX = (int32_t)(barWidth - charsLen) / 2;
- locY = m_Height - iTextHeight;
- geWidth = charsLen;
- break;
- case BC_TEXT_LOC_BELOW:
- default:
- locX = 0;
- locY = m_Height - iTextHeight;
- geWidth = (FX_FLOAT)barWidth;
- break;
- }
- if (device) {
- ShowDeviceChars(device, matrix, str, geWidth, pCharPos, (FX_FLOAT)locX,
- (FX_FLOAT)locY, barWidth);
- } else {
- ShowBitmapChars(pOutBitmap, str, geWidth, pCharPos, (FX_FLOAT)locX,
- (FX_FLOAT)locY, barWidth);
- }
- FX_Free(pCharPos);
-}
-
-void CBC_OneDimWriter::RenderBitmapResult(CFX_DIBitmap*& pOutBitmap,
- const CFX_WideStringC& contents,
- int32_t& e) {
- if (!m_output)
- if (e != BCExceptionNO)
- return;
-
- pOutBitmap = CreateDIBitmap(m_output->GetWidth(), m_output->GetHeight());
- pOutBitmap->Clear(m_backgroundColor);
- if (!pOutBitmap) {
- e = BCExceptionFailToCreateBitmap;
- return;
- }
- for (int32_t x = 0; x < m_output->GetWidth(); x++) {
- for (int32_t y = 0; y < m_output->GetHeight(); y++) {
- if (m_output->Get(x, y)) {
- pOutBitmap->SetPixel(x, y, m_barColor);
- }
- }
- }
- int32_t i = 0;
- for (; i < contents.GetLength(); i++)
- if (contents.GetAt(i) != ' ') {
- break;
- }
- if (m_locTextLoc != BC_TEXT_LOC_NONE && i < contents.GetLength()) {
- ShowChars(contents, pOutBitmap, nullptr, nullptr, m_barWidth, m_multiple,
- e);
- if (e != BCExceptionNO)
- return;
- }
- std::unique_ptr<CFX_DIBitmap> pStretchBitmap =
- pOutBitmap->StretchTo(m_Width, m_Height);
- delete pOutBitmap;
- pOutBitmap = pStretchBitmap.release();
-}
-
-void CBC_OneDimWriter::RenderDeviceResult(CFX_RenderDevice* device,
- const CFX_Matrix* matrix,
- const CFX_WideStringC& contents,
- int32_t& e) {
- if (!m_output)
- if (e != BCExceptionNO)
- return;
-
- CFX_GraphStateData stateData;
- CFX_PathData path;
- path.AppendRect(0, 0, (FX_FLOAT)m_Width, (FX_FLOAT)m_Height);
- device->DrawPath(&path, matrix, &stateData, m_backgroundColor,
- m_backgroundColor, FXFILL_ALTERNATE);
- CFX_Matrix matri(m_outputHScale, 0.0, 0.0, (FX_FLOAT)m_Height, 0.0, 0.0);
- matri.Concat(*matrix);
- for (int32_t x = 0; x < m_output->GetWidth(); x++) {
- for (int32_t y = 0; y < m_output->GetHeight(); y++) {
- CFX_PathData rect;
- rect.AppendRect((FX_FLOAT)x, (FX_FLOAT)y, (FX_FLOAT)(x + 1),
- (FX_FLOAT)(y + 1));
- if (m_output->Get(x, y)) {
- CFX_GraphStateData data;
- device->DrawPath(&rect, &matri, &data, m_barColor, 0, FXFILL_WINDING);
- }
- }
- }
- int32_t i = 0;
- for (; i < contents.GetLength(); i++)
- if (contents.GetAt(i) != ' ') {
- break;
- }
- if (m_locTextLoc != BC_TEXT_LOC_NONE && i < contents.GetLength()) {
- ShowChars(contents, nullptr, device, matrix, m_barWidth, m_multiple, e);
- if (e != BCExceptionNO)
- return;
- }
-}
-
-void CBC_OneDimWriter::RenderResult(const CFX_WideStringC& contents,
- uint8_t* code,
- int32_t codeLength,
- bool isDevice,
- int32_t& e) {
- if (codeLength < 1) {
- if (e != BCExceptionNO)
- return;
- }
- if (m_ModuleHeight < 20.0) {
- m_ModuleHeight = 20;
- }
- int32_t codeOldLength = codeLength;
- int32_t leftPadding = 0;
- int32_t rightPadding = 0;
- if (m_bLeftPadding) {
- leftPadding = 7;
- }
- if (m_bRightPadding) {
- rightPadding = 7;
- }
- codeLength += leftPadding;
- codeLength += rightPadding;
- m_outputHScale = 1.0;
- if (m_Width > 0) {
- m_outputHScale = (FX_FLOAT)m_Width / (FX_FLOAT)codeLength;
- }
- if (!isDevice) {
- m_outputHScale =
- std::max(m_outputHScale, static_cast<FX_FLOAT>(m_ModuleWidth));
- }
- FX_FLOAT dataLengthScale = 1.0;
- if (m_iDataLenth > 0 && contents.GetLength() != 0) {
- dataLengthScale = FX_FLOAT(contents.GetLength()) / FX_FLOAT(m_iDataLenth);
- }
- if (m_iDataLenth > 0 && contents.GetLength() == 0) {
- dataLengthScale = FX_FLOAT(1) / FX_FLOAT(m_iDataLenth);
- }
- m_multiple = 1;
- if (!isDevice) {
- m_multiple = (int32_t)ceil(m_outputHScale * dataLengthScale);
- }
- int32_t outputHeight = 1;
- if (!isDevice) {
- if (m_Height == 0) {
- outputHeight = std::max(20, m_ModuleHeight);
- } else {
- outputHeight = m_Height;
- }
- }
- int32_t outputWidth = codeLength;
- if (!isDevice) {
- outputWidth = (int32_t)(codeLength * m_multiple / dataLengthScale);
- }
- m_barWidth = m_Width;
- if (!isDevice) {
- m_barWidth = codeLength * m_multiple;
- }
- m_output = pdfium::MakeUnique<CBC_CommonBitMatrix>();
- m_output->Init(outputWidth, outputHeight);
- int32_t outputX = leftPadding * m_multiple;
- for (int32_t inputX = 0; inputX < codeOldLength; inputX++) {
- if (code[inputX] == 1) {
- if (outputX >= outputWidth) {
- break;
- }
- if (outputX + m_multiple > outputWidth && outputWidth - outputX > 0) {
- m_output->SetRegion(outputX, 0, outputWidth - outputX, outputHeight, e);
- break;
- }
- m_output->SetRegion(outputX, 0, m_multiple, outputHeight, e);
- if (e != BCExceptionNO)
- return;
- }
- outputX += m_multiple;
- }
-}
-
-bool CBC_OneDimWriter::CheckContentValidity(const CFX_WideStringC& contents) {
- return true;
-}
-
-CFX_WideString CBC_OneDimWriter::FilterContents(
- const CFX_WideStringC& contents) {
- return CFX_WideString();
-}
-
-CFX_WideString CBC_OneDimWriter::RenderTextContents(
- const CFX_WideStringC& contents) {
- return CFX_WideString();
-}
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/oned/BC_OneDimWriter.h b/chromium/third_party/pdfium/xfa/fxbarcode/oned/BC_OneDimWriter.h
deleted file mode 100644
index e37d7743416..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/oned/BC_OneDimWriter.h
+++ /dev/null
@@ -1,118 +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 XFA_FXBARCODE_ONED_BC_ONEDIMWRITER_H_
-#define XFA_FXBARCODE_ONED_BC_ONEDIMWRITER_H_
-
-#include <memory>
-
-#include "core/fxge/cfx_renderdevice.h"
-#include "xfa/fxbarcode/BC_Library.h"
-#include "xfa/fxbarcode/BC_Writer.h"
-
-class CBC_CommonBitMatrix;
-class CFX_Font;
-class CFX_RenderDevice;
-
-class CBC_OneDimWriter : public CBC_Writer {
- public:
- CBC_OneDimWriter();
- ~CBC_OneDimWriter() override;
-
- virtual uint8_t* Encode(const CFX_ByteString& contents,
- BCFORMAT format,
- int32_t& outWidth,
- int32_t& outHeight,
- int32_t& e);
- virtual uint8_t* Encode(const CFX_ByteString& contents,
- BCFORMAT format,
- int32_t& outWidth,
- int32_t& outHeight,
- int32_t hints,
- int32_t& e);
- virtual uint8_t* Encode(const CFX_ByteString& contents,
- int32_t& outLength,
- int32_t& e);
-
- virtual void RenderResult(const CFX_WideStringC& contents,
- uint8_t* code,
- int32_t codeLength,
- bool isDevice,
- int32_t& e);
- virtual void RenderBitmapResult(CFX_DIBitmap*& pOutBitmap,
- const CFX_WideStringC& contents,
- int32_t& e);
- virtual void RenderDeviceResult(CFX_RenderDevice* device,
- const CFX_Matrix* matrix,
- const CFX_WideStringC& contents,
- int32_t& e);
- virtual bool CheckContentValidity(const CFX_WideStringC& contents);
- virtual CFX_WideString FilterContents(const CFX_WideStringC& contents);
- virtual CFX_WideString RenderTextContents(const CFX_WideStringC& contents);
- virtual void SetPrintChecksum(bool checksum);
- virtual void SetDataLength(int32_t length);
- virtual void SetCalcChecksum(bool state);
- virtual void SetFontSize(FX_FLOAT size);
- virtual void SetFontStyle(int32_t style);
- virtual void SetFontColor(FX_ARGB color);
- bool SetFont(CFX_Font* cFont);
-
- protected:
- virtual void CalcTextInfo(const CFX_ByteString& text,
- FXTEXT_CHARPOS* charPos,
- CFX_Font* cFont,
- FX_FLOAT geWidth,
- int32_t fontSize,
- FX_FLOAT& charsLen);
- virtual void ShowChars(const CFX_WideStringC& contents,
- CFX_DIBitmap* pOutBitmap,
- CFX_RenderDevice* device,
- const CFX_Matrix* matrix,
- int32_t barWidth,
- int32_t multiple,
- int32_t& e);
- virtual void ShowBitmapChars(CFX_DIBitmap* pOutBitmap,
- const CFX_ByteString str,
- FX_FLOAT geWidth,
- FXTEXT_CHARPOS* pCharPos,
- FX_FLOAT locX,
- FX_FLOAT locY,
- int32_t barWidth);
- virtual void ShowDeviceChars(CFX_RenderDevice* device,
- const CFX_Matrix* matrix,
- const CFX_ByteString str,
- FX_FLOAT geWidth,
- FXTEXT_CHARPOS* pCharPos,
- FX_FLOAT locX,
- FX_FLOAT locY,
- int32_t barWidth);
- virtual int32_t AppendPattern(uint8_t* target,
- int32_t pos,
- const int32_t* pattern,
- int32_t patternLength,
- int32_t startColor,
- int32_t& e);
-
- FX_WCHAR Upper(FX_WCHAR ch);
-
- bool m_bPrintChecksum;
- int32_t m_iDataLenth;
- bool m_bCalcChecksum;
- CFX_Font* m_pFont;
- FX_FLOAT m_fFontSize;
- int32_t m_iFontStyle;
- uint32_t m_fontColor;
- BC_TEXT_LOC m_locTextLoc;
- int32_t m_iContentLen;
- bool m_bLeftPadding;
- bool m_bRightPadding;
- std::unique_ptr<CBC_CommonBitMatrix> m_output;
- int32_t m_barWidth;
- int32_t m_multiple;
- FX_FLOAT m_outputHScale;
-};
-
-#endif // XFA_FXBARCODE_ONED_BC_ONEDIMWRITER_H_
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/oned/BC_OnedCodaBarWriter.cpp b/chromium/third_party/pdfium/xfa/fxbarcode/oned/BC_OnedCodaBarWriter.cpp
deleted file mode 100644
index 399e5e7d406..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/oned/BC_OnedCodaBarWriter.cpp
+++ /dev/null
@@ -1,239 +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
-// Original code is licensed as follows:
-/*
- * Copyright 2011 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "xfa/fxbarcode/BC_Writer.h"
-#include "xfa/fxbarcode/common/BC_CommonBitArray.h"
-#include "xfa/fxbarcode/common/BC_CommonBitMatrix.h"
-#include "xfa/fxbarcode/oned/BC_OneDimWriter.h"
-#include "xfa/fxbarcode/oned/BC_OnedCodaBarWriter.h"
-
-namespace {
-
-const FX_CHAR ALPHABET_STRING[] = "0123456789-$:/.+ABCDTN";
-
-const int32_t CHARACTER_ENCODINGS[22] = {
- 0x003, 0x006, 0x009, 0x060, 0x012, 0x042, 0x021, 0x024,
- 0x030, 0x048, 0x00c, 0x018, 0x045, 0x051, 0x054, 0x015,
- 0x01A, 0x029, 0x00B, 0x00E, 0x01A, 0x029};
-
-const FX_CHAR START_END_CHARS[] = {'A', 'B', 'C', 'D', 'T', 'N', '*', 'E',
- 'a', 'b', 'c', 'd', 't', 'n', 'e'};
-const FX_CHAR CONTENT_CHARS[] = {'0', '1', '2', '3', '4', '5', '6', '7',
- '8', '9', '-', '$', '/', ':', '+', '.'};
-
-} // namespace
-
-CBC_OnedCodaBarWriter::CBC_OnedCodaBarWriter() {
- m_chStart = 'A';
- m_chEnd = 'B';
- m_iWideNarrRatio = 2;
-}
-CBC_OnedCodaBarWriter::~CBC_OnedCodaBarWriter() {}
-bool CBC_OnedCodaBarWriter::SetStartChar(FX_CHAR start) {
- for (size_t i = 0; i < FX_ArraySize(START_END_CHARS); ++i) {
- if (START_END_CHARS[i] == start) {
- m_chStart = start;
- return true;
- }
- }
- return false;
-}
-
-bool CBC_OnedCodaBarWriter::SetEndChar(FX_CHAR end) {
- for (size_t i = 0; i < FX_ArraySize(START_END_CHARS); ++i) {
- if (START_END_CHARS[i] == end) {
- m_chEnd = end;
- return true;
- }
- }
- return false;
-}
-void CBC_OnedCodaBarWriter::SetDataLength(int32_t length) {
- m_iDataLenth = length + 2;
-}
-bool CBC_OnedCodaBarWriter::SetTextLocation(BC_TEXT_LOC location) {
- if (location < BC_TEXT_LOC_NONE || location > BC_TEXT_LOC_BELOWEMBED) {
- return false;
- }
- m_locTextLoc = location;
- return true;
-}
-bool CBC_OnedCodaBarWriter::SetWideNarrowRatio(int32_t ratio) {
- if (ratio < 2 || ratio > 3) {
- return false;
- }
- m_iWideNarrRatio = ratio;
- return true;
-}
-bool CBC_OnedCodaBarWriter::FindChar(FX_WCHAR ch, bool isContent) {
- if (isContent) {
- for (size_t i = 0; i < FX_ArraySize(CONTENT_CHARS); ++i) {
- if (ch == (FX_WCHAR)CONTENT_CHARS[i]) {
- return true;
- }
- }
- for (size_t j = 0; j < FX_ArraySize(START_END_CHARS); ++j) {
- if (ch == (FX_WCHAR)START_END_CHARS[j]) {
- return true;
- }
- }
- return false;
- } else {
- for (size_t i = 0; i < FX_ArraySize(CONTENT_CHARS); ++i) {
- if (ch == (FX_WCHAR)CONTENT_CHARS[i]) {
- return true;
- }
- }
- return false;
- }
-}
-bool CBC_OnedCodaBarWriter::CheckContentValidity(
- const CFX_WideStringC& contents) {
- FX_WCHAR ch;
- int32_t index = 0;
- for (index = 0; index < contents.GetLength(); index++) {
- ch = contents.GetAt(index);
- if (FindChar(ch, false)) {
- continue;
- } else {
- return false;
- }
- }
- return true;
-}
-CFX_WideString CBC_OnedCodaBarWriter::FilterContents(
- const CFX_WideStringC& contents) {
- CFX_WideString filtercontents;
- FX_WCHAR ch;
- for (int32_t index = 0; index < contents.GetLength(); index++) {
- ch = contents.GetAt(index);
- if (ch > 175) {
- index++;
- continue;
- }
- if (FindChar(ch, true)) {
- filtercontents += ch;
- } else {
- continue;
- }
- }
- return filtercontents;
-}
-uint8_t* CBC_OnedCodaBarWriter::Encode(const CFX_ByteString& contents,
- BCFORMAT format,
- int32_t& outWidth,
- int32_t& outHeight,
- int32_t& e) {
- uint8_t* ret = Encode(contents, format, outWidth, outHeight, 0, e);
- if (e != BCExceptionNO)
- return nullptr;
- return ret;
-}
-uint8_t* CBC_OnedCodaBarWriter::Encode(const CFX_ByteString& contents,
- BCFORMAT format,
- int32_t& outWidth,
- int32_t& outHeight,
- int32_t hints,
- int32_t& e) {
- if (format != BCFORMAT_CODABAR) {
- e = BCExceptionOnlyEncodeCODEBAR;
- return nullptr;
- }
- uint8_t* ret =
- CBC_OneDimWriter::Encode(contents, format, outWidth, outHeight, hints, e);
- if (e != BCExceptionNO)
- return nullptr;
- return ret;
-}
-uint8_t* CBC_OnedCodaBarWriter::Encode(const CFX_ByteString& contents,
- int32_t& outLength,
- int32_t& e) {
- CFX_ByteString data = m_chStart + contents + m_chEnd;
- m_iContentLen = data.GetLength();
- uint8_t* result = FX_Alloc2D(uint8_t, m_iWideNarrRatio * 7, data.GetLength());
- FX_CHAR ch;
- int32_t position = 0;
- for (int32_t index = 0; index < data.GetLength(); index++) {
- ch = data.GetAt(index);
- if (((ch >= 'a') && (ch <= 'z'))) {
- ch = ch - 32;
- }
- switch (ch) {
- case 'T':
- ch = 'A';
- break;
- case 'N':
- ch = 'B';
- break;
- case '*':
- ch = 'C';
- break;
- case 'E':
- ch = 'D';
- break;
- default:
- break;
- }
- int32_t code = 0;
- int32_t len = (int32_t)strlen(ALPHABET_STRING);
- for (int32_t i = 0; i < len; i++) {
- if (ch == ALPHABET_STRING[i]) {
- code = CHARACTER_ENCODINGS[i];
- break;
- }
- }
- uint8_t color = 1;
- int32_t counter = 0;
- int32_t bit = 0;
- while (bit < 7) {
- result[position] = color;
- position++;
- if (((code >> (6 - bit)) & 1) == 0 || counter == m_iWideNarrRatio - 1) {
- color = !color;
- bit++;
- counter = 0;
- } else {
- counter++;
- }
- }
- if (index < data.GetLength() - 1) {
- result[position] = 0;
- position++;
- }
- }
- outLength = position;
- return result;
-}
-CFX_WideString CBC_OnedCodaBarWriter::encodedContents(
- const CFX_WideStringC& contents) {
- CFX_WideString strStart(m_chStart);
- CFX_WideString strEnd(m_chEnd);
- return strStart + contents + strEnd;
-}
-void CBC_OnedCodaBarWriter::RenderResult(const CFX_WideStringC& contents,
- uint8_t* code,
- int32_t codeLength,
- bool isDevice,
- int32_t& e) {
- CBC_OneDimWriter::RenderResult(encodedContents(contents).AsStringC(), code,
- codeLength, isDevice, e);
-}
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/oned/BC_OnedCodaBarWriter.h b/chromium/third_party/pdfium/xfa/fxbarcode/oned/BC_OnedCodaBarWriter.h
deleted file mode 100644
index 301c34a7516..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/oned/BC_OnedCodaBarWriter.h
+++ /dev/null
@@ -1,58 +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 XFA_FXBARCODE_ONED_BC_ONEDCODABARWRITER_H_
-#define XFA_FXBARCODE_ONED_BC_ONEDCODABARWRITER_H_
-
-#include "core/fxcrt/fx_string.h"
-#include "core/fxcrt/fx_system.h"
-#include "xfa/fxbarcode/BC_Library.h"
-#include "xfa/fxbarcode/oned/BC_OneDimWriter.h"
-
-class CBC_OnedCodaBarWriter : public CBC_OneDimWriter {
- public:
- CBC_OnedCodaBarWriter();
- ~CBC_OnedCodaBarWriter() override;
-
- // CBC_OneDimWriter
- uint8_t* Encode(const CFX_ByteString& contents,
- int32_t& outLength,
- int32_t& e) override;
- uint8_t* Encode(const CFX_ByteString& contents,
- BCFORMAT format,
- int32_t& outWidth,
- int32_t& outHeight,
- int32_t& e) override;
- uint8_t* Encode(const CFX_ByteString& contents,
- BCFORMAT format,
- int32_t& outWidth,
- int32_t& outHeight,
- int32_t hints,
- int32_t& e) override;
- bool CheckContentValidity(const CFX_WideStringC& contents) override;
- CFX_WideString FilterContents(const CFX_WideStringC& contents) override;
- void SetDataLength(int32_t length) override;
-
- virtual CFX_WideString encodedContents(const CFX_WideStringC& contents);
- virtual bool SetStartChar(FX_CHAR start);
- virtual bool SetEndChar(FX_CHAR end);
- virtual bool SetTextLocation(BC_TEXT_LOC location);
- virtual bool SetWideNarrowRatio(int32_t ratio);
- virtual bool FindChar(FX_WCHAR ch, bool isContent);
-
- private:
- void RenderResult(const CFX_WideStringC& contents,
- uint8_t* code,
- int32_t codeLength,
- bool isDevice,
- int32_t& e) override;
-
- FX_CHAR m_chStart;
- FX_CHAR m_chEnd;
- int32_t m_iWideNarrRatio;
-};
-
-#endif // XFA_FXBARCODE_ONED_BC_ONEDCODABARWRITER_H_
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/oned/BC_OnedCode128Writer.cpp b/chromium/third_party/pdfium/xfa/fxbarcode/oned/BC_OnedCode128Writer.cpp
deleted file mode 100644
index f163b186638..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/oned/BC_OnedCode128Writer.cpp
+++ /dev/null
@@ -1,276 +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
-// Original code is licensed as follows:
-/*
- * Copyright 2010 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "xfa/fxbarcode/BC_Writer.h"
-#include "xfa/fxbarcode/oned/BC_OneDimWriter.h"
-#include "xfa/fxbarcode/oned/BC_OnedCode128Writer.h"
-
-namespace {
-
-const int32_t CODE_PATTERNS[107][7] = {
- {2, 1, 2, 2, 2, 2, 0}, {2, 2, 2, 1, 2, 2, 0}, {2, 2, 2, 2, 2, 1, 0},
- {1, 2, 1, 2, 2, 3, 0}, {1, 2, 1, 3, 2, 2, 0}, {1, 3, 1, 2, 2, 2, 0},
- {1, 2, 2, 2, 1, 3, 0}, {1, 2, 2, 3, 1, 2, 0}, {1, 3, 2, 2, 1, 2, 0},
- {2, 2, 1, 2, 1, 3, 0}, {2, 2, 1, 3, 1, 2, 0}, {2, 3, 1, 2, 1, 2, 0},
- {1, 1, 2, 2, 3, 2, 0}, {1, 2, 2, 1, 3, 2, 0}, {1, 2, 2, 2, 3, 1, 0},
- {1, 1, 3, 2, 2, 2, 0}, {1, 2, 3, 1, 2, 2, 0}, {1, 2, 3, 2, 2, 1, 0},
- {2, 2, 3, 2, 1, 1, 0}, {2, 2, 1, 1, 3, 2, 0}, {2, 2, 1, 2, 3, 1, 0},
- {2, 1, 3, 2, 1, 2, 0}, {2, 2, 3, 1, 1, 2, 0}, {3, 1, 2, 1, 3, 1, 0},
- {3, 1, 1, 2, 2, 2, 0}, {3, 2, 1, 1, 2, 2, 0}, {3, 2, 1, 2, 2, 1, 0},
- {3, 1, 2, 2, 1, 2, 0}, {3, 2, 2, 1, 1, 2, 0}, {3, 2, 2, 2, 1, 1, 0},
- {2, 1, 2, 1, 2, 3, 0}, {2, 1, 2, 3, 2, 1, 0}, {2, 3, 2, 1, 2, 1, 0},
- {1, 1, 1, 3, 2, 3, 0}, {1, 3, 1, 1, 2, 3, 0}, {1, 3, 1, 3, 2, 1, 0},
- {1, 1, 2, 3, 1, 3, 0}, {1, 3, 2, 1, 1, 3, 0}, {1, 3, 2, 3, 1, 1, 0},
- {2, 1, 1, 3, 1, 3, 0}, {2, 3, 1, 1, 1, 3, 0}, {2, 3, 1, 3, 1, 1, 0},
- {1, 1, 2, 1, 3, 3, 0}, {1, 1, 2, 3, 3, 1, 0}, {1, 3, 2, 1, 3, 1, 0},
- {1, 1, 3, 1, 2, 3, 0}, {1, 1, 3, 3, 2, 1, 0}, {1, 3, 3, 1, 2, 1, 0},
- {3, 1, 3, 1, 2, 1, 0}, {2, 1, 1, 3, 3, 1, 0}, {2, 3, 1, 1, 3, 1, 0},
- {2, 1, 3, 1, 1, 3, 0}, {2, 1, 3, 3, 1, 1, 0}, {2, 1, 3, 1, 3, 1, 0},
- {3, 1, 1, 1, 2, 3, 0}, {3, 1, 1, 3, 2, 1, 0}, {3, 3, 1, 1, 2, 1, 0},
- {3, 1, 2, 1, 1, 3, 0}, {3, 1, 2, 3, 1, 1, 0}, {3, 3, 2, 1, 1, 1, 0},
- {3, 1, 4, 1, 1, 1, 0}, {2, 2, 1, 4, 1, 1, 0}, {4, 3, 1, 1, 1, 1, 0},
- {1, 1, 1, 2, 2, 4, 0}, {1, 1, 1, 4, 2, 2, 0}, {1, 2, 1, 1, 2, 4, 0},
- {1, 2, 1, 4, 2, 1, 0}, {1, 4, 1, 1, 2, 2, 0}, {1, 4, 1, 2, 2, 1, 0},
- {1, 1, 2, 2, 1, 4, 0}, {1, 1, 2, 4, 1, 2, 0}, {1, 2, 2, 1, 1, 4, 0},
- {1, 2, 2, 4, 1, 1, 0}, {1, 4, 2, 1, 1, 2, 0}, {1, 4, 2, 2, 1, 1, 0},
- {2, 4, 1, 2, 1, 1, 0}, {2, 2, 1, 1, 1, 4, 0}, {4, 1, 3, 1, 1, 1, 0},
- {2, 4, 1, 1, 1, 2, 0}, {1, 3, 4, 1, 1, 1, 0}, {1, 1, 1, 2, 4, 2, 0},
- {1, 2, 1, 1, 4, 2, 0}, {1, 2, 1, 2, 4, 1, 0}, {1, 1, 4, 2, 1, 2, 0},
- {1, 2, 4, 1, 1, 2, 0}, {1, 2, 4, 2, 1, 1, 0}, {4, 1, 1, 2, 1, 2, 0},
- {4, 2, 1, 1, 1, 2, 0}, {4, 2, 1, 2, 1, 1, 0}, {2, 1, 2, 1, 4, 1, 0},
- {2, 1, 4, 1, 2, 1, 0}, {4, 1, 2, 1, 2, 1, 0}, {1, 1, 1, 1, 4, 3, 0},
- {1, 1, 1, 3, 4, 1, 0}, {1, 3, 1, 1, 4, 1, 0}, {1, 1, 4, 1, 1, 3, 0},
- {1, 1, 4, 3, 1, 1, 0}, {4, 1, 1, 1, 1, 3, 0}, {4, 1, 1, 3, 1, 1, 0},
- {1, 1, 3, 1, 4, 1, 0}, {1, 1, 4, 1, 3, 1, 0}, {3, 1, 1, 1, 4, 1, 0},
- {4, 1, 1, 1, 3, 1, 0}, {2, 1, 1, 4, 1, 2, 0}, {2, 1, 1, 2, 1, 4, 0},
- {2, 1, 1, 2, 3, 2, 0}, {2, 3, 3, 1, 1, 1, 2}};
-
-const int32_t CODE_START_B = 104;
-const int32_t CODE_START_C = 105;
-const int32_t CODE_STOP = 106;
-
-} // namespace
-
-CBC_OnedCode128Writer::CBC_OnedCode128Writer() {
- m_codeFormat = BC_CODE128_B;
-}
-CBC_OnedCode128Writer::CBC_OnedCode128Writer(BC_TYPE type) {
- m_codeFormat = type;
-}
-CBC_OnedCode128Writer::~CBC_OnedCode128Writer() {}
-BC_TYPE CBC_OnedCode128Writer::GetType() {
- return m_codeFormat;
-}
-bool CBC_OnedCode128Writer::CheckContentValidity(
- const CFX_WideStringC& contents) {
- bool ret = true;
- int32_t position = 0;
- int32_t patternIndex = -1;
- if (m_codeFormat == BC_CODE128_B || m_codeFormat == BC_CODE128_C) {
- while (position < contents.GetLength()) {
- patternIndex = (int32_t)contents.GetAt(position);
- if (patternIndex < 32 || patternIndex > 126 || patternIndex == 34) {
- ret = false;
- break;
- }
- position++;
- }
- } else {
- ret = false;
- }
- return ret;
-}
-CFX_WideString CBC_OnedCode128Writer::FilterContents(
- const CFX_WideStringC& contents) {
- CFX_WideString filterChineseChar;
- FX_WCHAR ch;
- for (int32_t i = 0; i < contents.GetLength(); i++) {
- ch = contents.GetAt(i);
- if (ch > 175) {
- i++;
- continue;
- }
- filterChineseChar += ch;
- }
- CFX_WideString filtercontents;
- if (m_codeFormat == BC_CODE128_B) {
- for (int32_t i = 0; i < filterChineseChar.GetLength(); i++) {
- ch = filterChineseChar.GetAt(i);
- if (ch >= 32 && ch <= 126) {
- filtercontents += ch;
- } else {
- continue;
- }
- }
- } else if (m_codeFormat == BC_CODE128_C) {
- for (int32_t i = 0; i < filterChineseChar.GetLength(); i++) {
- ch = filterChineseChar.GetAt(i);
- if (ch >= 32 && ch <= 106) {
- filtercontents += ch;
- } else {
- continue;
- }
- }
- } else {
- filtercontents = contents;
- }
- return filtercontents;
-}
-bool CBC_OnedCode128Writer::SetTextLocation(BC_TEXT_LOC location) {
- if (location < BC_TEXT_LOC_NONE || location > BC_TEXT_LOC_BELOWEMBED) {
- return false;
- }
- m_locTextLoc = location;
- return true;
-}
-uint8_t* CBC_OnedCode128Writer::Encode(const CFX_ByteString& contents,
- BCFORMAT format,
- int32_t& outWidth,
- int32_t& outHeight,
- int32_t hints,
- int32_t& e) {
- if (format != BCFORMAT_CODE_128) {
- e = BCExceptionOnlyEncodeCODE_128;
- return nullptr;
- }
- uint8_t* ret =
- CBC_OneDimWriter::Encode(contents, format, outWidth, outHeight, hints, e);
- if (e != BCExceptionNO)
- return nullptr;
- return ret;
-}
-uint8_t* CBC_OnedCode128Writer::Encode(const CFX_ByteString& contents,
- BCFORMAT format,
- int32_t& outWidth,
- int32_t& outHeight,
- int32_t& e) {
- uint8_t* ret = Encode(contents, format, outWidth, outHeight, 0, e);
- if (e != BCExceptionNO)
- return nullptr;
- return ret;
-}
-bool CBC_OnedCode128Writer::IsDigits(const CFX_ByteString& contents,
- int32_t start,
- int32_t length) {
- int32_t end = start + length;
- for (int32_t i = start; i < end; i++) {
- if (contents[i] < '0' || contents[i] > '9') {
- return false;
- }
- }
- return true;
-}
-
-uint8_t* CBC_OnedCode128Writer::Encode(const CFX_ByteString& contents,
- int32_t& outLength,
- int32_t& e) {
- if (contents.GetLength() < 1 || contents.GetLength() > 80) {
- e = BCExceptionContentsLengthShouldBetween1and80;
- return nullptr;
- }
- CFX_ArrayTemplate<const int32_t*> patterns;
- int32_t checkSum = 0;
- if (m_codeFormat == BC_CODE128_B) {
- checkSum = Encode128B(contents, &patterns);
- } else if (m_codeFormat == BC_CODE128_C) {
- checkSum = Encode128C(contents, &patterns);
- } else {
- e = BCExceptionFormatException;
- return nullptr;
- }
- checkSum %= 103;
- patterns.Add(CODE_PATTERNS[checkSum]);
- patterns.Add(CODE_PATTERNS[CODE_STOP]);
- m_iContentLen = contents.GetLength() + 3;
- int32_t codeWidth = 0;
- for (int32_t k = 0; k < patterns.GetSize(); k++) {
- const int32_t* pattern = patterns[k];
- for (int32_t j = 0; j < 7; j++) {
- codeWidth += pattern[j];
- }
- }
- outLength = codeWidth;
- uint8_t* result = FX_Alloc(uint8_t, outLength);
- int32_t pos = 0;
- for (int32_t j = 0; j < patterns.GetSize(); j++) {
- const int32_t* pattern = patterns[j];
- pos += AppendPattern(result, pos, pattern, 7, 1, e);
- if (e != BCExceptionNO) {
- FX_Free(result);
- return nullptr;
- }
- }
- return result;
-}
-
-int32_t CBC_OnedCode128Writer::Encode128B(
- const CFX_ByteString& contents,
- CFX_ArrayTemplate<const int32_t*>* patterns) {
- int32_t checkSum = 0;
- int32_t checkWeight = 1;
- int32_t position = 0;
- patterns->Add(CODE_PATTERNS[CODE_START_B]);
- checkSum += CODE_START_B * checkWeight;
- while (position < contents.GetLength()) {
- int32_t patternIndex = 0;
- patternIndex = contents[position] - ' ';
- position += 1;
- patterns->Add(CODE_PATTERNS[patternIndex]);
- checkSum += patternIndex * checkWeight;
- if (position != 0) {
- checkWeight++;
- }
- }
- return checkSum;
-}
-
-int32_t CBC_OnedCode128Writer::Encode128C(
- const CFX_ByteString& contents,
- CFX_ArrayTemplate<const int32_t*>* patterns) {
- int32_t checkSum = 0;
- int32_t checkWeight = 1;
- int32_t position = 0;
- patterns->Add(CODE_PATTERNS[CODE_START_C]);
- checkSum += CODE_START_C * checkWeight;
- while (position < contents.GetLength()) {
- int32_t patternIndex = 0;
- FX_CHAR ch = contents.GetAt(position);
- if (ch < '0' || ch > '9') {
- patternIndex = (int32_t)ch;
- position++;
- } else {
- patternIndex = FXSYS_atoi(contents.Mid(position, 2).c_str());
- if (contents.GetAt(position + 1) < '0' ||
- contents.GetAt(position + 1) > '9') {
- position += 1;
- } else {
- position += 2;
- }
- }
- patterns->Add(CODE_PATTERNS[patternIndex]);
- checkSum += patternIndex * checkWeight;
- if (position != 0) {
- checkWeight++;
- }
- }
- return checkSum;
-}
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/oned/BC_OnedCode128Writer.h b/chromium/third_party/pdfium/xfa/fxbarcode/oned/BC_OnedCode128Writer.h
deleted file mode 100644
index 60a2f03acc2..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/oned/BC_OnedCode128Writer.h
+++ /dev/null
@@ -1,53 +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 XFA_FXBARCODE_ONED_BC_ONEDCODE128WRITER_H_
-#define XFA_FXBARCODE_ONED_BC_ONEDCODE128WRITER_H_
-
-#include "core/fxcrt/fx_string.h"
-#include "core/fxcrt/fx_system.h"
-#include "xfa/fxbarcode/oned/BC_OneDimWriter.h"
-
-class CBC_OnedCode128Writer : public CBC_OneDimWriter {
- public:
- CBC_OnedCode128Writer();
- explicit CBC_OnedCode128Writer(BC_TYPE type);
- ~CBC_OnedCode128Writer() override;
-
- // CBC_OneDimWriter
- uint8_t* Encode(const CFX_ByteString& contents,
- BCFORMAT format,
- int32_t& outWidth,
- int32_t& outHeight,
- int32_t hints,
- int32_t& e) override;
- uint8_t* Encode(const CFX_ByteString& contents,
- BCFORMAT format,
- int32_t& outWidth,
- int32_t& outHeight,
- int32_t& e) override;
- uint8_t* Encode(const CFX_ByteString& contents,
- int32_t& outLength,
- int32_t& e) override;
-
- bool CheckContentValidity(const CFX_WideStringC& contents) override;
- CFX_WideString FilterContents(const CFX_WideStringC& contents) override;
-
- bool SetTextLocation(BC_TEXT_LOC location);
-
- BC_TYPE GetType();
-
- private:
- bool IsDigits(const CFX_ByteString& contents, int32_t start, int32_t length);
- int32_t Encode128B(const CFX_ByteString& contents,
- CFX_ArrayTemplate<const int32_t*>* patterns);
- int32_t Encode128C(const CFX_ByteString& contents,
- CFX_ArrayTemplate<const int32_t*>* patterns);
-
- BC_TYPE m_codeFormat;
-};
-
-#endif // XFA_FXBARCODE_ONED_BC_ONEDCODE128WRITER_H_
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/oned/BC_OnedCode39Writer.cpp b/chromium/third_party/pdfium/xfa/fxbarcode/oned/BC_OnedCode39Writer.cpp
deleted file mode 100644
index a1ba5c80861..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/oned/BC_OnedCode39Writer.cpp
+++ /dev/null
@@ -1,285 +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
-// Original code is licensed as follows:
-/*
- * Copyright 2010 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "xfa/fxbarcode/BC_Writer.h"
-#include "xfa/fxbarcode/common/BC_CommonBitMatrix.h"
-#include "xfa/fxbarcode/oned/BC_OneDimWriter.h"
-#include "xfa/fxbarcode/oned/BC_OnedCode39Writer.h"
-
-namespace {
-
-const FX_CHAR ALPHABET_STRING[] =
- "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. *$/+%";
-
-const FX_CHAR CHECKSUM_STRING[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%";
-
-const int32_t CHARACTER_ENCODINGS[44] = {
- 0x034, 0x121, 0x061, 0x160, 0x031, 0x130, 0x070, 0x025, 0x124,
- 0x064, 0x109, 0x049, 0x148, 0x019, 0x118, 0x058, 0x00D, 0x10C,
- 0x04C, 0x01C, 0x103, 0x043, 0x142, 0x013, 0x112, 0x052, 0x007,
- 0x106, 0x046, 0x016, 0x181, 0x0C1, 0x1C0, 0x091, 0x190, 0x0D0,
- 0x085, 0x184, 0x0C4, 0x094, 0x0A8, 0x0A2, 0x08A, 0x02A};
-
-} // namespace
-
-CBC_OnedCode39Writer::CBC_OnedCode39Writer() {
- m_iWideNarrRatio = 3;
-}
-CBC_OnedCode39Writer::~CBC_OnedCode39Writer() {}
-bool CBC_OnedCode39Writer::CheckContentValidity(
- const CFX_WideStringC& contents) {
- for (int32_t i = 0; i < contents.GetLength(); i++) {
- FX_WCHAR ch = contents.GetAt(i);
- if ((ch >= (FX_WCHAR)'0' && ch <= (FX_WCHAR)'9') ||
- (ch >= (FX_WCHAR)'A' && ch <= (FX_WCHAR)'Z') || ch == (FX_WCHAR)'-' ||
- ch == (FX_WCHAR)'.' || ch == (FX_WCHAR)' ' || ch == (FX_WCHAR)'*' ||
- ch == (FX_WCHAR)'$' || ch == (FX_WCHAR)'/' || ch == (FX_WCHAR)'+' ||
- ch == (FX_WCHAR)'%') {
- continue;
- }
- return false;
- }
- return true;
-}
-
-CFX_WideString CBC_OnedCode39Writer::FilterContents(
- const CFX_WideStringC& contents) {
- CFX_WideString filtercontents;
- for (int32_t i = 0; i < contents.GetLength(); i++) {
- FX_WCHAR ch = contents.GetAt(i);
- if (ch == (FX_WCHAR)'*' && (i == 0 || i == contents.GetLength() - 1)) {
- continue;
- }
- if (ch > 175) {
- i++;
- continue;
- } else {
- ch = Upper(ch);
- }
- if ((ch >= (FX_WCHAR)'0' && ch <= (FX_WCHAR)'9') ||
- (ch >= (FX_WCHAR)'A' && ch <= (FX_WCHAR)'Z') || ch == (FX_WCHAR)'-' ||
- ch == (FX_WCHAR)'.' || ch == (FX_WCHAR)' ' || ch == (FX_WCHAR)'*' ||
- ch == (FX_WCHAR)'$' || ch == (FX_WCHAR)'/' || ch == (FX_WCHAR)'+' ||
- ch == (FX_WCHAR)'%') {
- filtercontents += ch;
- }
- }
- return filtercontents;
-}
-
-CFX_WideString CBC_OnedCode39Writer::RenderTextContents(
- const CFX_WideStringC& contents) {
- CFX_WideString renderContents;
- for (int32_t i = 0; i < contents.GetLength(); i++) {
- FX_WCHAR ch = contents.GetAt(i);
- if (ch == (FX_WCHAR)'*' && (i == 0 || i == contents.GetLength() - 1)) {
- continue;
- }
- if (ch > 175) {
- i++;
- continue;
- }
- if ((ch >= (FX_WCHAR)'0' && ch <= (FX_WCHAR)'9') ||
- (ch >= (FX_WCHAR)'A' && ch <= (FX_WCHAR)'Z') ||
- (ch >= (FX_WCHAR)'a' && ch <= (FX_WCHAR)'z') || ch == (FX_WCHAR)'-' ||
- ch == (FX_WCHAR)'.' || ch == (FX_WCHAR)' ' || ch == (FX_WCHAR)'*' ||
- ch == (FX_WCHAR)'$' || ch == (FX_WCHAR)'/' || ch == (FX_WCHAR)'+' ||
- ch == (FX_WCHAR)'%') {
- renderContents += ch;
- }
- }
- return renderContents;
-}
-
-bool CBC_OnedCode39Writer::SetTextLocation(BC_TEXT_LOC location) {
- if (location < BC_TEXT_LOC_NONE || location > BC_TEXT_LOC_BELOWEMBED) {
- return false;
- }
- m_locTextLoc = location;
- return true;
-}
-bool CBC_OnedCode39Writer::SetWideNarrowRatio(int32_t ratio) {
- if (ratio < 2 || ratio > 3) {
- return false;
- }
- m_iWideNarrRatio = ratio;
- return true;
-}
-uint8_t* CBC_OnedCode39Writer::Encode(const CFX_ByteString& contents,
- BCFORMAT format,
- int32_t& outWidth,
- int32_t& outHeight,
- int32_t& e) {
- uint8_t* ret = Encode(contents, format, outWidth, outHeight, 0, e);
- if (e != BCExceptionNO)
- return nullptr;
- return ret;
-}
-uint8_t* CBC_OnedCode39Writer::Encode(const CFX_ByteString& contents,
- BCFORMAT format,
- int32_t& outWidth,
- int32_t& outHeight,
- int32_t hints,
- int32_t& e) {
- if (format != BCFORMAT_CODE_39) {
- e = BCExceptionOnlyEncodeCODE_39;
- return nullptr;
- }
- uint8_t* ret =
- CBC_OneDimWriter::Encode(contents, format, outWidth, outHeight, hints, e);
- if (e != BCExceptionNO)
- return nullptr;
- return ret;
-}
-void CBC_OnedCode39Writer::ToIntArray(int32_t a, int32_t* toReturn) {
- for (int32_t i = 0; i < 9; i++) {
- toReturn[i] = (a & (1 << i)) == 0 ? 1 : m_iWideNarrRatio;
- }
-}
-FX_CHAR CBC_OnedCode39Writer::CalcCheckSum(const CFX_ByteString& contents,
- int32_t& e) {
- int32_t length = contents.GetLength();
- if (length > 80) {
- e = BCExceptionContentsLengthShouldBetween1and80;
- return '*';
- }
- int32_t checksum = 0;
- int32_t len = (int32_t)strlen(ALPHABET_STRING);
- for (int32_t i = 0; i < contents.GetLength(); i++) {
- int32_t j = 0;
- for (; j < len; j++) {
- if (ALPHABET_STRING[j] == contents[i]) {
- if (contents[i] != '*') {
- checksum += j;
- break;
- } else {
- break;
- }
- }
- }
- if (j >= len) {
- e = BCExceptionUnSupportedString;
- return '*';
- }
- }
- checksum = checksum % 43;
- return CHECKSUM_STRING[checksum];
-}
-uint8_t* CBC_OnedCode39Writer::Encode(const CFX_ByteString& contents,
- int32_t& outlength,
- int32_t& e) {
- FX_CHAR checksum = CalcCheckSum(contents, e);
- if (checksum == '*') {
- return nullptr;
- }
- int32_t widths[9] = {0};
- int32_t wideStrideNum = 3;
- int32_t narrStrideNum = 9 - wideStrideNum;
- CFX_ByteString encodedContents = contents;
- if (m_bCalcChecksum) {
- encodedContents += checksum;
- }
- m_iContentLen = encodedContents.GetLength();
- int32_t codeWidth = (wideStrideNum * m_iWideNarrRatio + narrStrideNum) * 2 +
- 1 + m_iContentLen;
- int32_t len = (int32_t)strlen(ALPHABET_STRING);
- for (int32_t j = 0; j < m_iContentLen; j++) {
- for (int32_t i = 0; i < len; i++) {
- if (ALPHABET_STRING[i] == encodedContents[j]) {
- ToIntArray(CHARACTER_ENCODINGS[i], widths);
- for (int32_t k = 0; k < 9; k++) {
- codeWidth += widths[k];
- }
- }
- }
- }
- outlength = codeWidth;
- uint8_t* result = FX_Alloc(uint8_t, codeWidth);
- ToIntArray(CHARACTER_ENCODINGS[39], widths);
- int32_t pos = AppendPattern(result, 0, widths, 9, 1, e);
- if (e != BCExceptionNO) {
- FX_Free(result);
- return nullptr;
- }
- int32_t narrowWhite[] = {1};
- pos += AppendPattern(result, pos, narrowWhite, 1, 0, e);
- if (e != BCExceptionNO) {
- FX_Free(result);
- return nullptr;
- }
- for (int32_t l = m_iContentLen - 1; l >= 0; l--) {
- for (int32_t i = 0; i < len; i++) {
- if (ALPHABET_STRING[i] == encodedContents[l]) {
- ToIntArray(CHARACTER_ENCODINGS[i], widths);
- pos += AppendPattern(result, pos, widths, 9, 1, e);
- if (e != BCExceptionNO) {
- FX_Free(result);
- return nullptr;
- }
- }
- }
- pos += AppendPattern(result, pos, narrowWhite, 1, 0, e);
- if (e != BCExceptionNO) {
- FX_Free(result);
- return nullptr;
- }
- }
- ToIntArray(CHARACTER_ENCODINGS[39], widths);
- pos += AppendPattern(result, pos, widths, 9, 1, e);
- if (e != BCExceptionNO) {
- FX_Free(result);
- return nullptr;
- }
- for (int32_t i = 0; i < codeWidth / 2; i++) {
- result[i] ^= result[codeWidth - 1 - i];
- result[codeWidth - 1 - i] ^= result[i];
- result[i] ^= result[codeWidth - 1 - i];
- }
- return result;
-}
-CFX_WideString CBC_OnedCode39Writer::encodedContents(
- const CFX_WideStringC& contents,
- int32_t& e) {
- CFX_WideString encodedContents(contents);
- if (m_bCalcChecksum && m_bPrintChecksum) {
- CFX_WideString checksumContent = FilterContents(contents);
- CFX_ByteString str = checksumContent.UTF8Encode();
- FX_CHAR checksum;
- checksum = CalcCheckSum(str, e);
- if (e != BCExceptionNO)
- return CFX_WideString();
- str += checksum;
- encodedContents += checksum;
- }
- return encodedContents;
-}
-void CBC_OnedCode39Writer::RenderResult(const CFX_WideStringC& contents,
- uint8_t* code,
- int32_t codeLength,
- bool isDevice,
- int32_t& e) {
- CFX_WideString encodedCon = encodedContents(contents, e);
- if (e != BCExceptionNO)
- return;
- CBC_OneDimWriter::RenderResult(encodedCon.AsStringC(), code, codeLength,
- isDevice, e);
-}
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/oned/BC_OnedCode39Writer.h b/chromium/third_party/pdfium/xfa/fxbarcode/oned/BC_OnedCode39Writer.h
deleted file mode 100644
index c8755a3e698..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/oned/BC_OnedCode39Writer.h
+++ /dev/null
@@ -1,54 +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 XFA_FXBARCODE_ONED_BC_ONEDCODE39WRITER_H_
-#define XFA_FXBARCODE_ONED_BC_ONEDCODE39WRITER_H_
-
-#include "xfa/fxbarcode/BC_Library.h"
-#include "xfa/fxbarcode/oned/BC_OneDimWriter.h"
-
-class CBC_OnedCode39Writer : public CBC_OneDimWriter {
- public:
- CBC_OnedCode39Writer();
- ~CBC_OnedCode39Writer() override;
-
- // CBC_OneDimWriter
- uint8_t* Encode(const CFX_ByteString& contents,
- BCFORMAT format,
- int32_t& outWidth,
- int32_t& outHeight,
- int32_t& e) override;
- uint8_t* Encode(const CFX_ByteString& contents,
- BCFORMAT format,
- int32_t& outWidth,
- int32_t& outHeight,
- int32_t hints,
- int32_t& e) override;
- uint8_t* Encode(const CFX_ByteString& contents,
- int32_t& outLength,
- int32_t& e) override;
- void RenderResult(const CFX_WideStringC& contents,
- uint8_t* code,
- int32_t codeLength,
- bool isDevice,
- int32_t& e) override;
- bool CheckContentValidity(const CFX_WideStringC& contents) override;
- CFX_WideString FilterContents(const CFX_WideStringC& contents) override;
- CFX_WideString RenderTextContents(const CFX_WideStringC& contents) override;
-
- virtual CFX_WideString encodedContents(const CFX_WideStringC& contents,
- int32_t& e);
- virtual bool SetTextLocation(BC_TEXT_LOC loction);
- virtual bool SetWideNarrowRatio(int32_t ratio);
-
- private:
- void ToIntArray(int32_t a, int32_t* toReturn);
- FX_CHAR CalcCheckSum(const CFX_ByteString& contents, int32_t& e);
-
- int32_t m_iWideNarrRatio;
-};
-
-#endif // XFA_FXBARCODE_ONED_BC_ONEDCODE39WRITER_H_
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/oned/BC_OnedEAN13Writer.cpp b/chromium/third_party/pdfium/xfa/fxbarcode/oned/BC_OnedEAN13Writer.cpp
deleted file mode 100644
index bcbc80a61d0..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/oned/BC_OnedEAN13Writer.cpp
+++ /dev/null
@@ -1,309 +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
-// Original code is licensed as follows:
-/*
- * Copyright 2009 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "core/fxge/cfx_fxgedevice.h"
-#include "core/fxge/cfx_gemodule.h"
-#include "xfa/fxbarcode/BC_Writer.h"
-#include "xfa/fxbarcode/oned/BC_OneDimWriter.h"
-#include "xfa/fxbarcode/oned/BC_OnedEAN13Writer.h"
-
-namespace {
-
-const int32_t FIRST_DIGIT_ENCODINGS[10] = {0x00, 0x0B, 0x0D, 0xE, 0x13,
- 0x19, 0x1C, 0x15, 0x16, 0x1A};
-const int32_t START_END_PATTERN[3] = {1, 1, 1};
-const int32_t MIDDLE_PATTERN[5] = {1, 1, 1, 1, 1};
-const int32_t L_PATTERNS[10][4] = {
- {3, 2, 1, 1}, {2, 2, 2, 1}, {2, 1, 2, 2}, {1, 4, 1, 1}, {1, 1, 3, 2},
- {1, 2, 3, 1}, {1, 1, 1, 4}, {1, 3, 1, 2}, {1, 2, 1, 3}, {3, 1, 1, 2}};
-const int32_t L_AND_G_PATTERNS[20][4] = {
- {3, 2, 1, 1}, {2, 2, 2, 1}, {2, 1, 2, 2}, {1, 4, 1, 1}, {1, 1, 3, 2},
- {1, 2, 3, 1}, {1, 1, 1, 4}, {1, 3, 1, 2}, {1, 2, 1, 3}, {3, 1, 1, 2},
- {1, 1, 2, 3}, {1, 2, 2, 2}, {2, 2, 1, 2}, {1, 1, 4, 1}, {2, 3, 1, 1},
- {1, 3, 2, 1}, {4, 1, 1, 1}, {2, 1, 3, 1}, {3, 1, 2, 1}, {2, 1, 1, 3}};
-
-} // namespace
-
-CBC_OnedEAN13Writer::CBC_OnedEAN13Writer() {
- m_bLeftPadding = true;
- m_codeWidth = 3 + (7 * 6) + 5 + (7 * 6) + 3;
-}
-CBC_OnedEAN13Writer::~CBC_OnedEAN13Writer() {}
-bool CBC_OnedEAN13Writer::CheckContentValidity(
- const CFX_WideStringC& contents) {
- for (int32_t i = 0; i < contents.GetLength(); i++) {
- if (contents.GetAt(i) >= '0' && contents.GetAt(i) <= '9') {
- continue;
- } else {
- return false;
- }
- }
- return true;
-}
-CFX_WideString CBC_OnedEAN13Writer::FilterContents(
- const CFX_WideStringC& contents) {
- CFX_WideString filtercontents;
- FX_WCHAR ch;
- for (int32_t i = 0; i < contents.GetLength(); i++) {
- ch = contents.GetAt(i);
- if (ch > 175) {
- i++;
- continue;
- }
- if (ch >= '0' && ch <= '9') {
- filtercontents += ch;
- }
- }
- return filtercontents;
-}
-int32_t CBC_OnedEAN13Writer::CalcChecksum(const CFX_ByteString& contents) {
- int32_t odd = 0;
- int32_t even = 0;
- int32_t j = 1;
- for (int32_t i = contents.GetLength() - 1; i >= 0; i--) {
- if (j % 2) {
- odd += FXSYS_atoi(contents.Mid(i, 1).c_str());
- } else {
- even += FXSYS_atoi(contents.Mid(i, 1).c_str());
- }
- j++;
- }
- int32_t checksum = (odd * 3 + even) % 10;
- checksum = (10 - checksum) % 10;
- return (checksum);
-}
-uint8_t* CBC_OnedEAN13Writer::Encode(const CFX_ByteString& contents,
- BCFORMAT format,
- int32_t& outWidth,
- int32_t& outHeight,
- int32_t& e) {
- uint8_t* ret = Encode(contents, format, outWidth, outHeight, 0, e);
- if (e != BCExceptionNO)
- return nullptr;
- return ret;
-}
-uint8_t* CBC_OnedEAN13Writer::Encode(const CFX_ByteString& contents,
- BCFORMAT format,
- int32_t& outWidth,
- int32_t& outHeight,
- int32_t hints,
- int32_t& e) {
- if (format != BCFORMAT_EAN_13) {
- e = BCExceptionOnlyEncodeEAN_13;
- }
- uint8_t* ret =
- CBC_OneDimWriter::Encode(contents, format, outWidth, outHeight, hints, e);
- if (e != BCExceptionNO)
- return nullptr;
- return ret;
-}
-uint8_t* CBC_OnedEAN13Writer::Encode(const CFX_ByteString& contents,
- int32_t& outLength,
- int32_t& e) {
- if (contents.GetLength() != 13) {
- e = BCExceptionDigitLengthShould13;
- return nullptr;
- }
- m_iDataLenth = 13;
- int32_t firstDigit = FXSYS_atoi(contents.Mid(0, 1).c_str());
- int32_t parities = FIRST_DIGIT_ENCODINGS[firstDigit];
- outLength = m_codeWidth;
- uint8_t* result = FX_Alloc(uint8_t, m_codeWidth);
- int32_t pos = 0;
- pos += AppendPattern(result, pos, START_END_PATTERN, 3, 1, e);
- if (e != BCExceptionNO) {
- FX_Free(result);
- return nullptr;
- }
- int32_t i = 0;
- for (i = 1; i <= 6; i++) {
- int32_t digit = FXSYS_atoi(contents.Mid(i, 1).c_str());
- if ((parities >> (6 - i) & 1) == 1) {
- digit += 10;
- }
- pos += AppendPattern(result, pos, L_AND_G_PATTERNS[digit], 4, 0, e);
- if (e != BCExceptionNO) {
- FX_Free(result);
- return nullptr;
- }
- }
- pos += AppendPattern(result, pos, MIDDLE_PATTERN, 5, 0, e);
- if (e != BCExceptionNO) {
- FX_Free(result);
- return nullptr;
- }
- for (i = 7; i <= 12; i++) {
- int32_t digit = FXSYS_atoi(contents.Mid(i, 1).c_str());
- pos += AppendPattern(result, pos, L_PATTERNS[digit], 4, 1, e);
- if (e != BCExceptionNO) {
- FX_Free(result);
- return nullptr;
- }
- }
- pos += AppendPattern(result, pos, START_END_PATTERN, 3, 1, e);
- if (e != BCExceptionNO) {
- FX_Free(result);
- return nullptr;
- }
- return result;
-}
-
-void CBC_OnedEAN13Writer::ShowChars(const CFX_WideStringC& contents,
- CFX_DIBitmap* pOutBitmap,
- CFX_RenderDevice* device,
- const CFX_Matrix* matrix,
- int32_t barWidth,
- int32_t multiple,
- int32_t& e) {
- if (!device && !pOutBitmap) {
- e = BCExceptionIllegalArgument;
- return;
- }
- int32_t leftPadding = 7 * multiple;
- int32_t leftPosition = 3 * multiple + leftPadding;
- CFX_ByteString str = FX_UTF8Encode(contents);
- int32_t iLen = str.GetLength();
- FXTEXT_CHARPOS* pCharPos = FX_Alloc(FXTEXT_CHARPOS, iLen);
- FXSYS_memset(pCharPos, 0, sizeof(FXTEXT_CHARPOS) * iLen);
- CFX_FxgeDevice geBitmap;
- if (pOutBitmap)
- geBitmap.Attach(pOutBitmap, false, nullptr, false);
-
- int32_t iFontSize = (int32_t)fabs(m_fFontSize);
- int32_t iTextHeight = iFontSize + 1;
- CFX_ByteString tempStr = str.Mid(1, 6);
- int32_t strWidth = multiple * 42;
- if (!pOutBitmap) {
- CFX_Matrix matr(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0);
- CFX_FloatRect rect(
- (FX_FLOAT)leftPosition, (FX_FLOAT)(m_Height - iTextHeight),
- (FX_FLOAT)(leftPosition + strWidth - 0.5), (FX_FLOAT)m_Height);
- matr.Concat(*matrix);
- matr.TransformRect(rect);
- FX_RECT re = rect.GetOuterRect();
- device->FillRect(&re, m_backgroundColor);
- CFX_FloatRect rect1(
- (FX_FLOAT)(leftPosition + 47 * multiple),
- (FX_FLOAT)(m_Height - iTextHeight),
- (FX_FLOAT)(leftPosition + 47 * multiple + strWidth - 0.5),
- (FX_FLOAT)m_Height);
- CFX_Matrix matr1(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0);
- matr1.Concat(*matrix);
- matr1.TransformRect(rect1);
- re = rect1.GetOuterRect();
- device->FillRect(&re, m_backgroundColor);
- int32_t strWidth1 = multiple * 7;
- CFX_Matrix matr2(m_outputHScale, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f);
- CFX_FloatRect rect2(0.0f, (FX_FLOAT)(m_Height - iTextHeight),
- (FX_FLOAT)strWidth1 - 0.5f, (FX_FLOAT)m_Height);
- matr2.Concat(*matrix);
- matr2.TransformRect(rect2);
- re = rect2.GetOuterRect();
- device->FillRect(&re, m_backgroundColor);
- }
- FX_FLOAT blank = 0.0;
- iLen = tempStr.GetLength();
- if (!pOutBitmap) {
- strWidth = (int32_t)(strWidth * m_outputHScale);
- }
- CalcTextInfo(tempStr, pCharPos + 1, m_pFont, (FX_FLOAT)strWidth, iFontSize,
- blank);
- CFX_Matrix affine_matrix(1.0, 0.0, 0.0, -1.0, 0.0, (FX_FLOAT)iFontSize);
- CFX_FxgeDevice ge;
- if (pOutBitmap) {
- ge.Create(strWidth, iTextHeight, FXDIB_Argb, nullptr);
- FX_RECT rect(0, 0, strWidth, iTextHeight);
- ge.FillRect(&rect, m_backgroundColor);
- ge.DrawNormalText(iLen, pCharPos + 1, m_pFont,
- static_cast<FX_FLOAT>(iFontSize), &affine_matrix,
- m_fontColor, FXTEXT_CLEARTYPE);
- geBitmap.SetDIBits(ge.GetBitmap(), leftPosition, m_Height - iTextHeight);
- } else {
- CFX_Matrix affine_matrix1(1.0, 0.0, 0.0, -1.0,
- (FX_FLOAT)leftPosition * m_outputHScale,
- (FX_FLOAT)(m_Height - iTextHeight) + iFontSize);
- if (matrix) {
- affine_matrix1.Concat(*matrix);
- }
- device->DrawNormalText(iLen, pCharPos + 1, m_pFont,
- static_cast<FX_FLOAT>(iFontSize), &affine_matrix1,
- m_fontColor, FXTEXT_CLEARTYPE);
- }
- tempStr = str.Mid(7, 6);
- iLen = tempStr.GetLength();
- CalcTextInfo(tempStr, pCharPos + 7, m_pFont, (FX_FLOAT)strWidth, iFontSize,
- blank);
- if (pOutBitmap) {
- FX_RECT rect1(0, 0, strWidth, iTextHeight);
- ge.FillRect(&rect1, m_backgroundColor);
- ge.DrawNormalText(iLen, pCharPos + 7, m_pFont,
- static_cast<FX_FLOAT>(iFontSize), &affine_matrix,
- m_fontColor, FXTEXT_CLEARTYPE);
- geBitmap.SetDIBits(ge.GetBitmap(), leftPosition + 47 * multiple,
- m_Height - iTextHeight);
- } else {
- CFX_Matrix affine_matrix1(
- 1.0, 0.0, 0.0, -1.0,
- (FX_FLOAT)(leftPosition + 47 * multiple) * m_outputHScale,
- (FX_FLOAT)(m_Height - iTextHeight + iFontSize));
- if (matrix) {
- affine_matrix1.Concat(*matrix);
- }
- device->DrawNormalText(iLen, pCharPos + 7, m_pFont,
- static_cast<FX_FLOAT>(iFontSize), &affine_matrix1,
- m_fontColor, FXTEXT_CLEARTYPE);
- }
- tempStr = str.Mid(0, 1);
- iLen = tempStr.GetLength();
- strWidth = multiple * 7;
- if (!pOutBitmap)
- strWidth = (int32_t)(strWidth * m_outputHScale);
-
- CalcTextInfo(tempStr, pCharPos, m_pFont, (FX_FLOAT)strWidth, iFontSize,
- blank);
- if (pOutBitmap) {
- delete ge.GetBitmap();
- ge.Create(strWidth, iTextHeight, FXDIB_Argb, nullptr);
- ge.GetBitmap()->Clear(m_backgroundColor);
- ge.DrawNormalText(iLen, pCharPos, m_pFont, static_cast<FX_FLOAT>(iFontSize),
- &affine_matrix, m_fontColor, FXTEXT_CLEARTYPE);
- geBitmap.SetDIBits(ge.GetBitmap(), 0, m_Height - iTextHeight);
- } else {
- CFX_Matrix affine_matrix1(1.0, 0.0, 0.0, -1.0, 0.0,
- (FX_FLOAT)(m_Height - iTextHeight + iFontSize));
- if (matrix) {
- affine_matrix1.Concat(*matrix);
- }
- device->DrawNormalText(iLen, pCharPos, m_pFont,
- static_cast<FX_FLOAT>(iFontSize), &affine_matrix1,
- m_fontColor, FXTEXT_CLEARTYPE);
- }
- FX_Free(pCharPos);
-}
-
-void CBC_OnedEAN13Writer::RenderResult(const CFX_WideStringC& contents,
- uint8_t* code,
- int32_t codeLength,
- bool isDevice,
- int32_t& e) {
- CBC_OneDimWriter::RenderResult(contents, code, codeLength, isDevice, e);
-}
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/oned/BC_OnedEAN13Writer.h b/chromium/third_party/pdfium/xfa/fxbarcode/oned/BC_OnedEAN13Writer.h
deleted file mode 100644
index 5775f890467..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/oned/BC_OnedEAN13Writer.h
+++ /dev/null
@@ -1,60 +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 XFA_FXBARCODE_ONED_BC_ONEDEAN13WRITER_H_
-#define XFA_FXBARCODE_ONED_BC_ONEDEAN13WRITER_H_
-
-#include "core/fxcrt/fx_string.h"
-#include "core/fxcrt/fx_system.h"
-#include "xfa/fxbarcode/oned/BC_OneDimWriter.h"
-
-class CFX_DIBitmap;
-class CFX_RenderDevice;
-
-class CBC_OnedEAN13Writer : public CBC_OneDimWriter {
- public:
- CBC_OnedEAN13Writer();
- ~CBC_OnedEAN13Writer() override;
-
- // CBC_OneDimWriter
- uint8_t* Encode(const CFX_ByteString& contents,
- BCFORMAT format,
- int32_t& outWidth,
- int32_t& outHeight,
- int32_t& e) override;
- uint8_t* Encode(const CFX_ByteString& contents,
- BCFORMAT format,
- int32_t& outWidth,
- int32_t& outHeight,
- int32_t hints,
- int32_t& e) override;
- uint8_t* Encode(const CFX_ByteString& contents,
- int32_t& outLength,
- int32_t& e) override;
- void RenderResult(const CFX_WideStringC& contents,
- uint8_t* code,
- int32_t codeLength,
- bool isDevice,
- int32_t& e) override;
- bool CheckContentValidity(const CFX_WideStringC& contents) override;
- CFX_WideString FilterContents(const CFX_WideStringC& contents) override;
-
- int32_t CalcChecksum(const CFX_ByteString& contents);
-
- protected:
- void ShowChars(const CFX_WideStringC& contents,
- CFX_DIBitmap* pOutBitmap,
- CFX_RenderDevice* device,
- const CFX_Matrix* matrix,
- int32_t barWidth,
- int32_t multiple,
- int32_t& e) override;
-
- private:
- int32_t m_codeWidth;
-};
-
-#endif // XFA_FXBARCODE_ONED_BC_ONEDEAN13WRITER_H_
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp b/chromium/third_party/pdfium/xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp
deleted file mode 100644
index c40223818ff..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp
+++ /dev/null
@@ -1,272 +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
-// Original code is licensed as follows:
-/*
- * Copyright 2009 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "core/fxge/cfx_fxgedevice.h"
-#include "core/fxge/cfx_gemodule.h"
-#include "xfa/fxbarcode/BC_Writer.h"
-#include "xfa/fxbarcode/common/BC_CommonBitMatrix.h"
-#include "xfa/fxbarcode/oned/BC_OneDimWriter.h"
-#include "xfa/fxbarcode/oned/BC_OnedEAN8Writer.h"
-
-namespace {
-
-const int32_t START_END_PATTERN[3] = {1, 1, 1};
-const int32_t MIDDLE_PATTERN[5] = {1, 1, 1, 1, 1};
-const int32_t L_PATTERNS[10][4] = {
- {3, 2, 1, 1}, {2, 2, 2, 1}, {2, 1, 2, 2}, {1, 4, 1, 1}, {1, 1, 3, 2},
- {1, 2, 3, 1}, {1, 1, 1, 4}, {1, 3, 1, 2}, {1, 2, 1, 3}, {3, 1, 1, 2}};
-
-} // namespace
-
-CBC_OnedEAN8Writer::CBC_OnedEAN8Writer() {
- m_iDataLenth = 8;
- m_codeWidth = 3 + (7 * 4) + 5 + (7 * 4) + 3;
-}
-CBC_OnedEAN8Writer::~CBC_OnedEAN8Writer() {}
-void CBC_OnedEAN8Writer::SetDataLength(int32_t length) {
- m_iDataLenth = 8;
-}
-bool CBC_OnedEAN8Writer::SetTextLocation(BC_TEXT_LOC location) {
- if (location == BC_TEXT_LOC_BELOWEMBED) {
- m_locTextLoc = location;
- return true;
- }
- return false;
-}
-bool CBC_OnedEAN8Writer::CheckContentValidity(const CFX_WideStringC& contents) {
- for (int32_t i = 0; i < contents.GetLength(); i++) {
- if (contents.GetAt(i) >= '0' && contents.GetAt(i) <= '9') {
- continue;
- } else {
- return false;
- }
- }
- return true;
-}
-CFX_WideString CBC_OnedEAN8Writer::FilterContents(
- const CFX_WideStringC& contents) {
- CFX_WideString filtercontents;
- FX_WCHAR ch;
- for (int32_t i = 0; i < contents.GetLength(); i++) {
- ch = contents.GetAt(i);
- if (ch > 175) {
- i++;
- continue;
- }
- if (ch >= '0' && ch <= '9') {
- filtercontents += ch;
- }
- }
- return filtercontents;
-}
-int32_t CBC_OnedEAN8Writer::CalcChecksum(const CFX_ByteString& contents) {
- int32_t odd = 0;
- int32_t even = 0;
- int32_t j = 1;
- for (int32_t i = contents.GetLength() - 1; i >= 0; i--) {
- if (j % 2) {
- odd += FXSYS_atoi(contents.Mid(i, 1).c_str());
- } else {
- even += FXSYS_atoi(contents.Mid(i, 1).c_str());
- }
- j++;
- }
- int32_t checksum = (odd * 3 + even) % 10;
- checksum = (10 - checksum) % 10;
- return (checksum);
-}
-uint8_t* CBC_OnedEAN8Writer::Encode(const CFX_ByteString& contents,
- BCFORMAT format,
- int32_t& outWidth,
- int32_t& outHeight,
- int32_t& e) {
- uint8_t* ret = Encode(contents, format, outWidth, outHeight, 0, e);
- if (e != BCExceptionNO)
- return nullptr;
- return ret;
-}
-uint8_t* CBC_OnedEAN8Writer::Encode(const CFX_ByteString& contents,
- BCFORMAT format,
- int32_t& outWidth,
- int32_t& outHeight,
- int32_t hints,
- int32_t& e) {
- if (format != BCFORMAT_EAN_8) {
- e = BCExceptionOnlyEncodeEAN_8;
- return nullptr;
- }
- uint8_t* ret =
- CBC_OneDimWriter::Encode(contents, format, outWidth, outHeight, hints, e);
- if (e != BCExceptionNO)
- return nullptr;
- return ret;
-}
-uint8_t* CBC_OnedEAN8Writer::Encode(const CFX_ByteString& contents,
- int32_t& outLength,
- int32_t& e) {
- if (contents.GetLength() != 8) {
- e = BCExceptionDigitLengthMustBe8;
- return nullptr;
- }
- outLength = m_codeWidth;
- uint8_t* result = FX_Alloc(uint8_t, m_codeWidth);
- int32_t pos = 0;
- pos += AppendPattern(result, pos, START_END_PATTERN, 3, 1, e);
- if (e != BCExceptionNO) {
- FX_Free(result);
- return nullptr;
- }
- int32_t i = 0;
- for (i = 0; i <= 3; i++) {
- int32_t digit = FXSYS_atoi(contents.Mid(i, 1).c_str());
- pos += AppendPattern(result, pos, L_PATTERNS[digit], 4, 0, e);
- if (e != BCExceptionNO) {
- FX_Free(result);
- return nullptr;
- }
- }
- pos += AppendPattern(result, pos, MIDDLE_PATTERN, 5, 0, e);
- if (e != BCExceptionNO) {
- FX_Free(result);
- return nullptr;
- }
- for (i = 4; i <= 7; i++) {
- int32_t digit = FXSYS_atoi(contents.Mid(i, 1).c_str());
- pos += AppendPattern(result, pos, L_PATTERNS[digit], 4, 1, e);
- if (e != BCExceptionNO) {
- FX_Free(result);
- return nullptr;
- }
- }
- pos += AppendPattern(result, pos, START_END_PATTERN, 3, 1, e);
- if (e != BCExceptionNO) {
- FX_Free(result);
- return nullptr;
- }
- return result;
-}
-
-void CBC_OnedEAN8Writer::ShowChars(const CFX_WideStringC& contents,
- CFX_DIBitmap* pOutBitmap,
- CFX_RenderDevice* device,
- const CFX_Matrix* matrix,
- int32_t barWidth,
- int32_t multiple,
- int32_t& e) {
- if (!device && !pOutBitmap) {
- e = BCExceptionIllegalArgument;
- return;
- }
-
- int32_t leftPosition = 3 * multiple;
- CFX_ByteString str = FX_UTF8Encode(contents);
- int32_t iLength = str.GetLength();
- FXTEXT_CHARPOS* pCharPos = FX_Alloc(FXTEXT_CHARPOS, iLength);
- FXSYS_memset(pCharPos, 0, sizeof(FXTEXT_CHARPOS) * iLength);
- CFX_ByteString tempStr = str.Mid(0, 4);
- int32_t iLen = tempStr.GetLength();
- int32_t strWidth = 7 * multiple * 4;
- FX_FLOAT blank = 0.0;
- CFX_FxgeDevice geBitmap;
- if (pOutBitmap)
- geBitmap.Attach(pOutBitmap, false, nullptr, false);
-
- int32_t iFontSize = (int32_t)fabs(m_fFontSize);
- int32_t iTextHeight = iFontSize + 1;
- if (!pOutBitmap) {
- CFX_Matrix matr(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0);
- CFX_FloatRect rect(
- (FX_FLOAT)leftPosition, (FX_FLOAT)(m_Height - iTextHeight),
- (FX_FLOAT)(leftPosition + strWidth - 0.5), (FX_FLOAT)m_Height);
- matr.Concat(*matrix);
- matr.TransformRect(rect);
- FX_RECT re = rect.GetOuterRect();
- device->FillRect(&re, m_backgroundColor);
- CFX_Matrix matr1(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0);
- CFX_FloatRect rect1(
- (FX_FLOAT)(leftPosition + 33 * multiple),
- (FX_FLOAT)(m_Height - iTextHeight),
- (FX_FLOAT)(leftPosition + 33 * multiple + strWidth - 0.5),
- (FX_FLOAT)m_Height);
- matr1.Concat(*matrix);
- matr1.TransformRect(rect1);
- re = rect1.GetOuterRect();
- device->FillRect(&re, m_backgroundColor);
- }
- if (!pOutBitmap)
- strWidth = (int32_t)(strWidth * m_outputHScale);
-
- CalcTextInfo(tempStr, pCharPos, m_pFont, (FX_FLOAT)strWidth, iFontSize,
- blank);
- CFX_Matrix affine_matrix(1.0, 0.0, 0.0, -1.0, 0.0, (FX_FLOAT)iFontSize);
- CFX_FxgeDevice ge;
- if (pOutBitmap) {
- delete ge.GetBitmap();
- ge.Create(strWidth, iTextHeight, FXDIB_Argb, nullptr);
- ge.GetBitmap()->Clear(m_backgroundColor);
- ge.DrawNormalText(iLen, pCharPos, m_pFont, static_cast<FX_FLOAT>(iFontSize),
- &affine_matrix, m_fontColor, FXTEXT_CLEARTYPE);
- geBitmap.SetDIBits(ge.GetBitmap(), leftPosition, m_Height - iTextHeight);
- } else {
- CFX_Matrix affine_matrix1(1.0, 0.0, 0.0, -1.0,
- (FX_FLOAT)leftPosition * m_outputHScale,
- (FX_FLOAT)(m_Height - iTextHeight + iFontSize));
- affine_matrix1.Concat(*matrix);
- device->DrawNormalText(iLen, pCharPos, m_pFont,
- static_cast<FX_FLOAT>(iFontSize), &affine_matrix1,
- m_fontColor, FXTEXT_CLEARTYPE);
- }
- tempStr = str.Mid(4, 4);
- iLen = tempStr.GetLength();
- CalcTextInfo(tempStr, pCharPos + 4, m_pFont, (FX_FLOAT)strWidth, iFontSize,
- blank);
- if (pOutBitmap) {
- delete ge.GetBitmap();
- ge.Create(strWidth, iTextHeight, FXDIB_Argb, nullptr);
- ge.GetBitmap()->Clear(m_backgroundColor);
- ge.DrawNormalText(iLen, pCharPos + 4, m_pFont,
- static_cast<FX_FLOAT>(iFontSize), &affine_matrix,
- m_fontColor, FXTEXT_CLEARTYPE);
- geBitmap.SetDIBits(ge.GetBitmap(), leftPosition + 33 * multiple,
- m_Height - iTextHeight);
- } else {
- CFX_Matrix affine_matrix1(
- 1.0, 0.0, 0.0, -1.0,
- (FX_FLOAT)(leftPosition + 33 * multiple) * m_outputHScale,
- (FX_FLOAT)(m_Height - iTextHeight + iFontSize));
- if (matrix) {
- affine_matrix1.Concat(*matrix);
- }
- device->DrawNormalText(iLen, pCharPos + 4, m_pFont,
- static_cast<FX_FLOAT>(iFontSize), &affine_matrix1,
- m_fontColor, FXTEXT_CLEARTYPE);
- }
- FX_Free(pCharPos);
-}
-
-void CBC_OnedEAN8Writer::RenderResult(const CFX_WideStringC& contents,
- uint8_t* code,
- int32_t codeLength,
- bool isDevice,
- int32_t& e) {
- CBC_OneDimWriter::RenderResult(contents, code, codeLength, isDevice, e);
-}
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/oned/BC_OnedEAN8Writer.h b/chromium/third_party/pdfium/xfa/fxbarcode/oned/BC_OnedEAN8Writer.h
deleted file mode 100644
index 844fc33afa1..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/oned/BC_OnedEAN8Writer.h
+++ /dev/null
@@ -1,64 +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 XFA_FXBARCODE_ONED_BC_ONEDEAN8WRITER_H_
-#define XFA_FXBARCODE_ONED_BC_ONEDEAN8WRITER_H_
-
-#include "core/fxcrt/fx_string.h"
-#include "core/fxcrt/fx_system.h"
-#include "xfa/fxbarcode/BC_Library.h"
-#include "xfa/fxbarcode/oned/BC_OneDimWriter.h"
-
-class CFX_DIBitmap;
-class CFX_RenderDevice;
-
-class CBC_OnedEAN8Writer : public CBC_OneDimWriter {
- public:
- CBC_OnedEAN8Writer();
- ~CBC_OnedEAN8Writer() override;
-
- // CBC_OneDimWriter
- uint8_t* Encode(const CFX_ByteString& contents,
- BCFORMAT format,
- int32_t& outWidth,
- int32_t& outHeight,
- int32_t& e) override;
- uint8_t* Encode(const CFX_ByteString& contents,
- BCFORMAT format,
- int32_t& outWidth,
- int32_t& outHeight,
- int32_t hints,
- int32_t& e) override;
- uint8_t* Encode(const CFX_ByteString& contents,
- int32_t& outLength,
- int32_t& e) override;
-
- void RenderResult(const CFX_WideStringC& contents,
- uint8_t* code,
- int32_t codeLength,
- bool isDevice,
- int32_t& e) override;
- bool CheckContentValidity(const CFX_WideStringC& contents) override;
- CFX_WideString FilterContents(const CFX_WideStringC& contents) override;
- void SetDataLength(int32_t length) override;
-
- bool SetTextLocation(BC_TEXT_LOC location);
- int32_t CalcChecksum(const CFX_ByteString& contents);
-
- protected:
- void ShowChars(const CFX_WideStringC& contents,
- CFX_DIBitmap* pOutBitmap,
- CFX_RenderDevice* device,
- const CFX_Matrix* matrix,
- int32_t barWidth,
- int32_t multiple,
- int32_t& e) override;
-
- private:
- int32_t m_codeWidth;
-};
-
-#endif // XFA_FXBARCODE_ONED_BC_ONEDEAN8WRITER_H_
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/oned/BC_OnedUPCAWriter.cpp b/chromium/third_party/pdfium/xfa/fxbarcode/oned/BC_OnedUPCAWriter.cpp
deleted file mode 100644
index 6d6e79637c5..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/oned/BC_OnedUPCAWriter.cpp
+++ /dev/null
@@ -1,290 +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
-// Original code is licensed as follows:
-/*
- * Copyright 2010 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "core/fxge/cfx_fxgedevice.h"
-#include "core/fxge/cfx_gemodule.h"
-#include "third_party/base/ptr_util.h"
-#include "xfa/fxbarcode/BC_Writer.h"
-#include "xfa/fxbarcode/oned/BC_OneDimWriter.h"
-#include "xfa/fxbarcode/oned/BC_OnedEAN13Writer.h"
-#include "xfa/fxbarcode/oned/BC_OnedUPCAWriter.h"
-
-CBC_OnedUPCAWriter::CBC_OnedUPCAWriter() {
- m_bLeftPadding = true;
- m_bRightPadding = true;
-}
-
-void CBC_OnedUPCAWriter::Init() {
- m_subWriter = pdfium::MakeUnique<CBC_OnedEAN13Writer>();
-}
-
-CBC_OnedUPCAWriter::~CBC_OnedUPCAWriter() {}
-
-bool CBC_OnedUPCAWriter::CheckContentValidity(const CFX_WideStringC& contents) {
- for (FX_STRSIZE i = 0; i < contents.GetLength(); ++i) {
- if (contents.GetAt(i) < '0' || contents.GetAt(i) > '9')
- return false;
- }
- return true;
-}
-
-CFX_WideString CBC_OnedUPCAWriter::FilterContents(
- const CFX_WideStringC& contents) {
- CFX_WideString filtercontents;
- FX_WCHAR ch;
- for (int32_t i = 0; i < contents.GetLength(); i++) {
- ch = contents.GetAt(i);
- if (ch > 175) {
- i++;
- continue;
- }
- if (ch >= '0' && ch <= '9') {
- filtercontents += ch;
- }
- }
- return filtercontents;
-}
-
-int32_t CBC_OnedUPCAWriter::CalcChecksum(const CFX_ByteString& contents) {
- int32_t odd = 0;
- int32_t even = 0;
- int32_t j = 1;
- for (int32_t i = contents.GetLength() - 1; i >= 0; i--) {
- if (j % 2) {
- odd += FXSYS_atoi(contents.Mid(i, 1).c_str());
- } else {
- even += FXSYS_atoi(contents.Mid(i, 1).c_str());
- }
- j++;
- }
- int32_t checksum = (odd * 3 + even) % 10;
- checksum = (10 - checksum) % 10;
- return (checksum);
-}
-
-uint8_t* CBC_OnedUPCAWriter::Encode(const CFX_ByteString& contents,
- BCFORMAT format,
- int32_t& outWidth,
- int32_t& outHeight,
- int32_t& e) {
- uint8_t* ret = Encode(contents, format, outWidth, outHeight, 0, e);
- if (e != BCExceptionNO)
- return nullptr;
- return ret;
-}
-
-uint8_t* CBC_OnedUPCAWriter::Encode(const CFX_ByteString& contents,
- BCFORMAT format,
- int32_t& outWidth,
- int32_t& outHeight,
- int32_t hints,
- int32_t& e) {
- if (format != BCFORMAT_UPC_A) {
- e = BCExceptionOnlyEncodeUPC_A;
- return nullptr;
- }
- CFX_ByteString toEAN13String = '0' + contents;
- m_iDataLenth = 13;
- uint8_t* ret = m_subWriter->Encode(toEAN13String, BCFORMAT_EAN_13, outWidth,
- outHeight, hints, e);
- if (e != BCExceptionNO)
- return nullptr;
- return ret;
-}
-
-uint8_t* CBC_OnedUPCAWriter::Encode(const CFX_ByteString& contents,
- int32_t& outLength,
- int32_t& e) {
- return nullptr;
-}
-
-void CBC_OnedUPCAWriter::ShowChars(const CFX_WideStringC& contents,
- CFX_DIBitmap* pOutBitmap,
- CFX_RenderDevice* device,
- const CFX_Matrix* matrix,
- int32_t barWidth,
- int32_t multiple,
- int32_t& e) {
- if (!device && !pOutBitmap) {
- e = BCExceptionIllegalArgument;
- return;
- }
-
- int32_t leftPadding = 7 * multiple;
- int32_t leftPosition = 10 * multiple + leftPadding;
- CFX_ByteString str = FX_UTF8Encode(contents);
- int32_t iLen = str.GetLength();
- FXTEXT_CHARPOS* pCharPos = FX_Alloc(FXTEXT_CHARPOS, iLen);
- FXSYS_memset(pCharPos, 0, sizeof(FXTEXT_CHARPOS) * iLen);
- CFX_ByteString tempStr = str.Mid(1, 5);
- FX_FLOAT strWidth = (FX_FLOAT)35 * multiple;
- FX_FLOAT blank = 0.0;
- CFX_FxgeDevice geBitmap;
- if (pOutBitmap)
- geBitmap.Attach(pOutBitmap, false, nullptr, false);
-
- iLen = tempStr.GetLength();
- int32_t iFontSize = (int32_t)fabs(m_fFontSize);
- int32_t iTextHeight = iFontSize + 1;
- if (!pOutBitmap) {
- CFX_Matrix matr(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0);
- CFX_FloatRect rect(
- (FX_FLOAT)leftPosition, (FX_FLOAT)(m_Height - iTextHeight),
- (FX_FLOAT)(leftPosition + strWidth - 0.5), (FX_FLOAT)m_Height);
- matr.Concat(*matrix);
- matr.TransformRect(rect);
- FX_RECT re = rect.GetOuterRect();
- device->FillRect(&re, m_backgroundColor);
- CFX_Matrix matr1(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0);
- CFX_FloatRect rect1(
- (FX_FLOAT)(leftPosition + 40 * multiple),
- (FX_FLOAT)(m_Height - iTextHeight),
- (FX_FLOAT)((leftPosition + 40 * multiple) + strWidth - 0.5),
- (FX_FLOAT)m_Height);
- matr1.Concat(*matrix);
- matr1.TransformRect(rect1);
- re = rect1.GetOuterRect();
- device->FillRect(&re, m_backgroundColor);
- FX_FLOAT strWidth1 = (FX_FLOAT)multiple * 7;
- CFX_Matrix matr2(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0);
- CFX_FloatRect rect2(0.0, (FX_FLOAT)(m_Height - iTextHeight),
- (FX_FLOAT)strWidth1 - 1, (FX_FLOAT)m_Height);
- matr2.Concat(*matrix);
- matr2.TransformRect(rect2);
- re = rect2.GetOuterRect();
- device->FillRect(&re, m_backgroundColor);
- CFX_Matrix matr3(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0);
- CFX_FloatRect rect3(
- (FX_FLOAT)(leftPosition + 85 * multiple),
- (FX_FLOAT)(m_Height - iTextHeight),
- (FX_FLOAT)((leftPosition + 85 * multiple) + strWidth1 - 0.5),
- (FX_FLOAT)m_Height);
- matr3.Concat(*matrix);
- matr3.TransformRect(rect3);
- re = rect3.GetOuterRect();
- device->FillRect(&re, m_backgroundColor);
- }
- if (!pOutBitmap)
- strWidth = strWidth * m_outputHScale;
-
- CalcTextInfo(tempStr, pCharPos + 1, m_pFont, strWidth, iFontSize, blank);
- CFX_Matrix affine_matrix(1.0, 0.0, 0.0, -1.0, 0.0, (FX_FLOAT)iFontSize);
- CFX_FxgeDevice ge;
- if (pOutBitmap) {
- ge.Create((int)strWidth, iTextHeight, FXDIB_Argb, nullptr);
- ge.GetBitmap()->Clear(m_backgroundColor);
- ge.DrawNormalText(iLen, pCharPos + 1, m_pFont,
- static_cast<FX_FLOAT>(iFontSize), &affine_matrix,
- m_fontColor, FXTEXT_CLEARTYPE);
- geBitmap.SetDIBits(ge.GetBitmap(), leftPosition, m_Height - iTextHeight);
- } else {
- CFX_Matrix affine_matrix1(1.0, 0.0, 0.0, -1.0,
- (FX_FLOAT)leftPosition * m_outputHScale,
- (FX_FLOAT)(m_Height - iTextHeight + iFontSize));
- if (matrix) {
- affine_matrix1.Concat(*matrix);
- }
- device->DrawNormalText(iLen, pCharPos + 1, m_pFont,
- static_cast<FX_FLOAT>(iFontSize), &affine_matrix1,
- m_fontColor, FXTEXT_CLEARTYPE);
- }
- tempStr = str.Mid(6, 5);
- iLen = tempStr.GetLength();
- CalcTextInfo(tempStr, pCharPos + 6, m_pFont, strWidth, iFontSize, blank);
- if (pOutBitmap) {
- FX_RECT rect2(0, 0, (int)strWidth, iTextHeight);
- ge.FillRect(&rect2, m_backgroundColor);
- ge.DrawNormalText(iLen, pCharPos + 6, m_pFont,
- static_cast<FX_FLOAT>(iFontSize), &affine_matrix,
- m_fontColor, FXTEXT_CLEARTYPE);
- geBitmap.SetDIBits(ge.GetBitmap(), leftPosition + 40 * multiple,
- m_Height - iTextHeight);
- } else {
- CFX_Matrix affine_matrix1(
- 1.0, 0.0, 0.0, -1.0,
- (FX_FLOAT)(leftPosition + 40 * multiple) * m_outputHScale,
- (FX_FLOAT)(m_Height - iTextHeight + iFontSize));
- if (matrix) {
- affine_matrix1.Concat(*matrix);
- }
- device->DrawNormalText(iLen, pCharPos + 6, m_pFont,
- static_cast<FX_FLOAT>(iFontSize), &affine_matrix1,
- m_fontColor, FXTEXT_CLEARTYPE);
- }
- tempStr = str.Mid(0, 1);
- iLen = tempStr.GetLength();
- strWidth = (FX_FLOAT)multiple * 7;
- if (!pOutBitmap)
- strWidth = strWidth * m_outputHScale;
-
- CalcTextInfo(tempStr, pCharPos, m_pFont, strWidth, iFontSize, blank);
- if (pOutBitmap) {
- delete ge.GetBitmap();
- ge.Create((int)strWidth, iTextHeight, FXDIB_Argb, nullptr);
- ge.GetBitmap()->Clear(m_backgroundColor);
- ge.DrawNormalText(iLen, pCharPos, m_pFont, static_cast<FX_FLOAT>(iFontSize),
- &affine_matrix, m_fontColor, FXTEXT_CLEARTYPE);
- geBitmap.SetDIBits(ge.GetBitmap(), 0, m_Height - iTextHeight);
- } else {
- CFX_Matrix affine_matrix1(1.0, 0.0, 0.0, -1.0, 0,
- (FX_FLOAT)(m_Height - iTextHeight + iFontSize));
- if (matrix) {
- affine_matrix1.Concat(*matrix);
- }
- device->DrawNormalText(iLen, pCharPos, m_pFont,
- static_cast<FX_FLOAT>(iFontSize), &affine_matrix1,
- m_fontColor, FXTEXT_CLEARTYPE);
- }
- tempStr = str.Mid(11, 1);
- iLen = tempStr.GetLength();
- CalcTextInfo(tempStr, pCharPos + 11, m_pFont, strWidth, iFontSize, blank);
- if (pOutBitmap) {
- delete ge.GetBitmap();
- ge.Create((int)strWidth, iTextHeight, FXDIB_Argb, nullptr);
- ge.GetBitmap()->Clear(m_backgroundColor);
- ge.DrawNormalText(iLen, pCharPos + 11, m_pFont,
- static_cast<FX_FLOAT>(iFontSize), &affine_matrix,
- m_fontColor, FXTEXT_CLEARTYPE);
- geBitmap.SetDIBits(ge.GetBitmap(), leftPosition + 85 * multiple,
- m_Height - iTextHeight);
- } else {
- CFX_Matrix affine_matrix1(
- 1.0, 0.0, 0.0, -1.0,
- (FX_FLOAT)(leftPosition + 85 * multiple) * m_outputHScale,
- (FX_FLOAT)(m_Height - iTextHeight + iFontSize));
- if (matrix) {
- affine_matrix1.Concat(*matrix);
- }
- device->DrawNormalText(iLen, pCharPos + 11, m_pFont,
- static_cast<FX_FLOAT>(iFontSize), &affine_matrix1,
- m_fontColor, FXTEXT_CLEARTYPE);
- }
- FX_Free(pCharPos);
-}
-
-void CBC_OnedUPCAWriter::RenderResult(const CFX_WideStringC& contents,
- uint8_t* code,
- int32_t codeLength,
- bool isDevice,
- int32_t& e) {
- CBC_OneDimWriter::RenderResult(contents, code, codeLength, isDevice, e);
-}
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/oned/BC_OnedUPCAWriter.h b/chromium/third_party/pdfium/xfa/fxbarcode/oned/BC_OnedUPCAWriter.h
deleted file mode 100644
index 6b786ce3b8c..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/oned/BC_OnedUPCAWriter.h
+++ /dev/null
@@ -1,66 +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 XFA_FXBARCODE_ONED_BC_ONEDUPCAWRITER_H_
-#define XFA_FXBARCODE_ONED_BC_ONEDUPCAWRITER_H_
-
-#include <memory>
-
-#include "core/fxcrt/fx_string.h"
-#include "core/fxcrt/fx_system.h"
-#include "xfa/fxbarcode/oned/BC_OneDimWriter.h"
-
-class CBC_OnedEAN13Writer;
-class CFX_DIBitmap;
-class CFX_Matrix;
-class CFX_RenderDevice;
-
-class CBC_OnedUPCAWriter : public CBC_OneDimWriter {
- public:
- CBC_OnedUPCAWriter();
- ~CBC_OnedUPCAWriter() override;
-
- // CBC_OneDimWriter
- uint8_t* Encode(const CFX_ByteString& contents,
- BCFORMAT format,
- int32_t& outWidth,
- int32_t& outHeight,
- int32_t& e) override;
- uint8_t* Encode(const CFX_ByteString& contents,
- BCFORMAT format,
- int32_t& outWidth,
- int32_t& outHeight,
- int32_t hints,
- int32_t& e) override;
- uint8_t* Encode(const CFX_ByteString& contents,
- int32_t& outLength,
- int32_t& e) override;
-
- void RenderResult(const CFX_WideStringC& contents,
- uint8_t* code,
- int32_t codeLength,
- bool isDevice,
- int32_t& e) override;
- bool CheckContentValidity(const CFX_WideStringC& contents) override;
- CFX_WideString FilterContents(const CFX_WideStringC& contents) override;
-
- void Init();
- int32_t CalcChecksum(const CFX_ByteString& contents);
-
- protected:
- void ShowChars(const CFX_WideStringC& contents,
- CFX_DIBitmap* pOutBitmap,
- CFX_RenderDevice* device,
- const CFX_Matrix* matrix,
- int32_t barWidth,
- int32_t multiple,
- int32_t& e) override;
-
- private:
- std::unique_ptr<CBC_OnedEAN13Writer> m_subWriter;
-};
-
-#endif // XFA_FXBARCODE_ONED_BC_ONEDUPCAWRITER_H_
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/pdf417/BC_PDF417.cpp b/chromium/third_party/pdfium/xfa/fxbarcode/pdf417/BC_PDF417.cpp
deleted file mode 100644
index 2f01564b11a..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/pdf417/BC_PDF417.cpp
+++ /dev/null
@@ -1,584 +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
-// Original code is licensed as follows:
-/*
- * Copyright 2006 Jeremias Maerki in part, and ZXing Authors in part
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "xfa/fxbarcode/pdf417/BC_PDF417.h"
-
-#include "third_party/base/ptr_util.h"
-#include "xfa/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.h"
-#include "xfa/fxbarcode/pdf417/BC_PDF417BarcodeRow.h"
-#include "xfa/fxbarcode/pdf417/BC_PDF417Compaction.h"
-#include "xfa/fxbarcode/pdf417/BC_PDF417ErrorCorrection.h"
-#include "xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h"
-#include "xfa/fxbarcode/utils.h"
-
-const int32_t CBC_PDF417::CODEWORD_TABLE[][929] = {
- {0x1d5c0, 0x1eaf0, 0x1f57c, 0x1d4e0, 0x1ea78, 0x1f53e, 0x1a8c0, 0x1d470,
- 0x1a860, 0x15040, 0x1a830, 0x15020, 0x1adc0, 0x1d6f0, 0x1eb7c, 0x1ace0,
- 0x1d678, 0x1eb3e, 0x158c0, 0x1ac70, 0x15860, 0x15dc0, 0x1aef0, 0x1d77c,
- 0x15ce0, 0x1ae78, 0x1d73e, 0x15c70, 0x1ae3c, 0x15ef0, 0x1af7c, 0x15e78,
- 0x1af3e, 0x15f7c, 0x1f5fa, 0x1d2e0, 0x1e978, 0x1f4be, 0x1a4c0, 0x1d270,
- 0x1e93c, 0x1a460, 0x1d238, 0x14840, 0x1a430, 0x1d21c, 0x14820, 0x1a418,
- 0x14810, 0x1a6e0, 0x1d378, 0x1e9be, 0x14cc0, 0x1a670, 0x1d33c, 0x14c60,
- 0x1a638, 0x1d31e, 0x14c30, 0x1a61c, 0x14ee0, 0x1a778, 0x1d3be, 0x14e70,
- 0x1a73c, 0x14e38, 0x1a71e, 0x14f78, 0x1a7be, 0x14f3c, 0x14f1e, 0x1a2c0,
- 0x1d170, 0x1e8bc, 0x1a260, 0x1d138, 0x1e89e, 0x14440, 0x1a230, 0x1d11c,
- 0x14420, 0x1a218, 0x14410, 0x14408, 0x146c0, 0x1a370, 0x1d1bc, 0x14660,
- 0x1a338, 0x1d19e, 0x14630, 0x1a31c, 0x14618, 0x1460c, 0x14770, 0x1a3bc,
- 0x14738, 0x1a39e, 0x1471c, 0x147bc, 0x1a160, 0x1d0b8, 0x1e85e, 0x14240,
- 0x1a130, 0x1d09c, 0x14220, 0x1a118, 0x1d08e, 0x14210, 0x1a10c, 0x14208,
- 0x1a106, 0x14360, 0x1a1b8, 0x1d0de, 0x14330, 0x1a19c, 0x14318, 0x1a18e,
- 0x1430c, 0x14306, 0x1a1de, 0x1438e, 0x14140, 0x1a0b0, 0x1d05c, 0x14120,
- 0x1a098, 0x1d04e, 0x14110, 0x1a08c, 0x14108, 0x1a086, 0x14104, 0x141b0,
- 0x14198, 0x1418c, 0x140a0, 0x1d02e, 0x1a04c, 0x1a046, 0x14082, 0x1cae0,
- 0x1e578, 0x1f2be, 0x194c0, 0x1ca70, 0x1e53c, 0x19460, 0x1ca38, 0x1e51e,
- 0x12840, 0x19430, 0x12820, 0x196e0, 0x1cb78, 0x1e5be, 0x12cc0, 0x19670,
- 0x1cb3c, 0x12c60, 0x19638, 0x12c30, 0x12c18, 0x12ee0, 0x19778, 0x1cbbe,
- 0x12e70, 0x1973c, 0x12e38, 0x12e1c, 0x12f78, 0x197be, 0x12f3c, 0x12fbe,
- 0x1dac0, 0x1ed70, 0x1f6bc, 0x1da60, 0x1ed38, 0x1f69e, 0x1b440, 0x1da30,
- 0x1ed1c, 0x1b420, 0x1da18, 0x1ed0e, 0x1b410, 0x1da0c, 0x192c0, 0x1c970,
- 0x1e4bc, 0x1b6c0, 0x19260, 0x1c938, 0x1e49e, 0x1b660, 0x1db38, 0x1ed9e,
- 0x16c40, 0x12420, 0x19218, 0x1c90e, 0x16c20, 0x1b618, 0x16c10, 0x126c0,
- 0x19370, 0x1c9bc, 0x16ec0, 0x12660, 0x19338, 0x1c99e, 0x16e60, 0x1b738,
- 0x1db9e, 0x16e30, 0x12618, 0x16e18, 0x12770, 0x193bc, 0x16f70, 0x12738,
- 0x1939e, 0x16f38, 0x1b79e, 0x16f1c, 0x127bc, 0x16fbc, 0x1279e, 0x16f9e,
- 0x1d960, 0x1ecb8, 0x1f65e, 0x1b240, 0x1d930, 0x1ec9c, 0x1b220, 0x1d918,
- 0x1ec8e, 0x1b210, 0x1d90c, 0x1b208, 0x1b204, 0x19160, 0x1c8b8, 0x1e45e,
- 0x1b360, 0x19130, 0x1c89c, 0x16640, 0x12220, 0x1d99c, 0x1c88e, 0x16620,
- 0x12210, 0x1910c, 0x16610, 0x1b30c, 0x19106, 0x12204, 0x12360, 0x191b8,
- 0x1c8de, 0x16760, 0x12330, 0x1919c, 0x16730, 0x1b39c, 0x1918e, 0x16718,
- 0x1230c, 0x12306, 0x123b8, 0x191de, 0x167b8, 0x1239c, 0x1679c, 0x1238e,
- 0x1678e, 0x167de, 0x1b140, 0x1d8b0, 0x1ec5c, 0x1b120, 0x1d898, 0x1ec4e,
- 0x1b110, 0x1d88c, 0x1b108, 0x1d886, 0x1b104, 0x1b102, 0x12140, 0x190b0,
- 0x1c85c, 0x16340, 0x12120, 0x19098, 0x1c84e, 0x16320, 0x1b198, 0x1d8ce,
- 0x16310, 0x12108, 0x19086, 0x16308, 0x1b186, 0x16304, 0x121b0, 0x190dc,
- 0x163b0, 0x12198, 0x190ce, 0x16398, 0x1b1ce, 0x1638c, 0x12186, 0x16386,
- 0x163dc, 0x163ce, 0x1b0a0, 0x1d858, 0x1ec2e, 0x1b090, 0x1d84c, 0x1b088,
- 0x1d846, 0x1b084, 0x1b082, 0x120a0, 0x19058, 0x1c82e, 0x161a0, 0x12090,
- 0x1904c, 0x16190, 0x1b0cc, 0x19046, 0x16188, 0x12084, 0x16184, 0x12082,
- 0x120d8, 0x161d8, 0x161cc, 0x161c6, 0x1d82c, 0x1d826, 0x1b042, 0x1902c,
- 0x12048, 0x160c8, 0x160c4, 0x160c2, 0x18ac0, 0x1c570, 0x1e2bc, 0x18a60,
- 0x1c538, 0x11440, 0x18a30, 0x1c51c, 0x11420, 0x18a18, 0x11410, 0x11408,
- 0x116c0, 0x18b70, 0x1c5bc, 0x11660, 0x18b38, 0x1c59e, 0x11630, 0x18b1c,
- 0x11618, 0x1160c, 0x11770, 0x18bbc, 0x11738, 0x18b9e, 0x1171c, 0x117bc,
- 0x1179e, 0x1cd60, 0x1e6b8, 0x1f35e, 0x19a40, 0x1cd30, 0x1e69c, 0x19a20,
- 0x1cd18, 0x1e68e, 0x19a10, 0x1cd0c, 0x19a08, 0x1cd06, 0x18960, 0x1c4b8,
- 0x1e25e, 0x19b60, 0x18930, 0x1c49c, 0x13640, 0x11220, 0x1cd9c, 0x1c48e,
- 0x13620, 0x19b18, 0x1890c, 0x13610, 0x11208, 0x13608, 0x11360, 0x189b8,
- 0x1c4de, 0x13760, 0x11330, 0x1cdde, 0x13730, 0x19b9c, 0x1898e, 0x13718,
- 0x1130c, 0x1370c, 0x113b8, 0x189de, 0x137b8, 0x1139c, 0x1379c, 0x1138e,
- 0x113de, 0x137de, 0x1dd40, 0x1eeb0, 0x1f75c, 0x1dd20, 0x1ee98, 0x1f74e,
- 0x1dd10, 0x1ee8c, 0x1dd08, 0x1ee86, 0x1dd04, 0x19940, 0x1ccb0, 0x1e65c,
- 0x1bb40, 0x19920, 0x1eedc, 0x1e64e, 0x1bb20, 0x1dd98, 0x1eece, 0x1bb10,
- 0x19908, 0x1cc86, 0x1bb08, 0x1dd86, 0x19902, 0x11140, 0x188b0, 0x1c45c,
- 0x13340, 0x11120, 0x18898, 0x1c44e, 0x17740, 0x13320, 0x19998, 0x1ccce,
- 0x17720, 0x1bb98, 0x1ddce, 0x18886, 0x17710, 0x13308, 0x19986, 0x17708,
- 0x11102, 0x111b0, 0x188dc, 0x133b0, 0x11198, 0x188ce, 0x177b0, 0x13398,
- 0x199ce, 0x17798, 0x1bbce, 0x11186, 0x13386, 0x111dc, 0x133dc, 0x111ce,
- 0x177dc, 0x133ce, 0x1dca0, 0x1ee58, 0x1f72e, 0x1dc90, 0x1ee4c, 0x1dc88,
- 0x1ee46, 0x1dc84, 0x1dc82, 0x198a0, 0x1cc58, 0x1e62e, 0x1b9a0, 0x19890,
- 0x1ee6e, 0x1b990, 0x1dccc, 0x1cc46, 0x1b988, 0x19884, 0x1b984, 0x19882,
- 0x1b982, 0x110a0, 0x18858, 0x1c42e, 0x131a0, 0x11090, 0x1884c, 0x173a0,
- 0x13190, 0x198cc, 0x18846, 0x17390, 0x1b9cc, 0x11084, 0x17388, 0x13184,
- 0x11082, 0x13182, 0x110d8, 0x1886e, 0x131d8, 0x110cc, 0x173d8, 0x131cc,
- 0x110c6, 0x173cc, 0x131c6, 0x110ee, 0x173ee, 0x1dc50, 0x1ee2c, 0x1dc48,
- 0x1ee26, 0x1dc44, 0x1dc42, 0x19850, 0x1cc2c, 0x1b8d0, 0x19848, 0x1cc26,
- 0x1b8c8, 0x1dc66, 0x1b8c4, 0x19842, 0x1b8c2, 0x11050, 0x1882c, 0x130d0,
- 0x11048, 0x18826, 0x171d0, 0x130c8, 0x19866, 0x171c8, 0x1b8e6, 0x11042,
- 0x171c4, 0x130c2, 0x171c2, 0x130ec, 0x171ec, 0x171e6, 0x1ee16, 0x1dc22,
- 0x1cc16, 0x19824, 0x19822, 0x11028, 0x13068, 0x170e8, 0x11022, 0x13062,
- 0x18560, 0x10a40, 0x18530, 0x10a20, 0x18518, 0x1c28e, 0x10a10, 0x1850c,
- 0x10a08, 0x18506, 0x10b60, 0x185b8, 0x1c2de, 0x10b30, 0x1859c, 0x10b18,
- 0x1858e, 0x10b0c, 0x10b06, 0x10bb8, 0x185de, 0x10b9c, 0x10b8e, 0x10bde,
- 0x18d40, 0x1c6b0, 0x1e35c, 0x18d20, 0x1c698, 0x18d10, 0x1c68c, 0x18d08,
- 0x1c686, 0x18d04, 0x10940, 0x184b0, 0x1c25c, 0x11b40, 0x10920, 0x1c6dc,
- 0x1c24e, 0x11b20, 0x18d98, 0x1c6ce, 0x11b10, 0x10908, 0x18486, 0x11b08,
- 0x18d86, 0x10902, 0x109b0, 0x184dc, 0x11bb0, 0x10998, 0x184ce, 0x11b98,
- 0x18dce, 0x11b8c, 0x10986, 0x109dc, 0x11bdc, 0x109ce, 0x11bce, 0x1cea0,
- 0x1e758, 0x1f3ae, 0x1ce90, 0x1e74c, 0x1ce88, 0x1e746, 0x1ce84, 0x1ce82,
- 0x18ca0, 0x1c658, 0x19da0, 0x18c90, 0x1c64c, 0x19d90, 0x1cecc, 0x1c646,
- 0x19d88, 0x18c84, 0x19d84, 0x18c82, 0x19d82, 0x108a0, 0x18458, 0x119a0,
- 0x10890, 0x1c66e, 0x13ba0, 0x11990, 0x18ccc, 0x18446, 0x13b90, 0x19dcc,
- 0x10884, 0x13b88, 0x11984, 0x10882, 0x11982, 0x108d8, 0x1846e, 0x119d8,
- 0x108cc, 0x13bd8, 0x119cc, 0x108c6, 0x13bcc, 0x119c6, 0x108ee, 0x119ee,
- 0x13bee, 0x1ef50, 0x1f7ac, 0x1ef48, 0x1f7a6, 0x1ef44, 0x1ef42, 0x1ce50,
- 0x1e72c, 0x1ded0, 0x1ef6c, 0x1e726, 0x1dec8, 0x1ef66, 0x1dec4, 0x1ce42,
- 0x1dec2, 0x18c50, 0x1c62c, 0x19cd0, 0x18c48, 0x1c626, 0x1bdd0, 0x19cc8,
- 0x1ce66, 0x1bdc8, 0x1dee6, 0x18c42, 0x1bdc4, 0x19cc2, 0x1bdc2, 0x10850,
- 0x1842c, 0x118d0, 0x10848, 0x18426, 0x139d0, 0x118c8, 0x18c66, 0x17bd0,
- 0x139c8, 0x19ce6, 0x10842, 0x17bc8, 0x1bde6, 0x118c2, 0x17bc4, 0x1086c,
- 0x118ec, 0x10866, 0x139ec, 0x118e6, 0x17bec, 0x139e6, 0x17be6, 0x1ef28,
- 0x1f796, 0x1ef24, 0x1ef22, 0x1ce28, 0x1e716, 0x1de68, 0x1ef36, 0x1de64,
- 0x1ce22, 0x1de62, 0x18c28, 0x1c616, 0x19c68, 0x18c24, 0x1bce8, 0x19c64,
- 0x18c22, 0x1bce4, 0x19c62, 0x1bce2, 0x10828, 0x18416, 0x11868, 0x18c36,
- 0x138e8, 0x11864, 0x10822, 0x179e8, 0x138e4, 0x11862, 0x179e4, 0x138e2,
- 0x179e2, 0x11876, 0x179f6, 0x1ef12, 0x1de34, 0x1de32, 0x19c34, 0x1bc74,
- 0x1bc72, 0x11834, 0x13874, 0x178f4, 0x178f2, 0x10540, 0x10520, 0x18298,
- 0x10510, 0x10508, 0x10504, 0x105b0, 0x10598, 0x1058c, 0x10586, 0x105dc,
- 0x105ce, 0x186a0, 0x18690, 0x1c34c, 0x18688, 0x1c346, 0x18684, 0x18682,
- 0x104a0, 0x18258, 0x10da0, 0x186d8, 0x1824c, 0x10d90, 0x186cc, 0x10d88,
- 0x186c6, 0x10d84, 0x10482, 0x10d82, 0x104d8, 0x1826e, 0x10dd8, 0x186ee,
- 0x10dcc, 0x104c6, 0x10dc6, 0x104ee, 0x10dee, 0x1c750, 0x1c748, 0x1c744,
- 0x1c742, 0x18650, 0x18ed0, 0x1c76c, 0x1c326, 0x18ec8, 0x1c766, 0x18ec4,
- 0x18642, 0x18ec2, 0x10450, 0x10cd0, 0x10448, 0x18226, 0x11dd0, 0x10cc8,
- 0x10444, 0x11dc8, 0x10cc4, 0x10442, 0x11dc4, 0x10cc2, 0x1046c, 0x10cec,
- 0x10466, 0x11dec, 0x10ce6, 0x11de6, 0x1e7a8, 0x1e7a4, 0x1e7a2, 0x1c728,
- 0x1cf68, 0x1e7b6, 0x1cf64, 0x1c722, 0x1cf62, 0x18628, 0x1c316, 0x18e68,
- 0x1c736, 0x19ee8, 0x18e64, 0x18622, 0x19ee4, 0x18e62, 0x19ee2, 0x10428,
- 0x18216, 0x10c68, 0x18636, 0x11ce8, 0x10c64, 0x10422, 0x13de8, 0x11ce4,
- 0x10c62, 0x13de4, 0x11ce2, 0x10436, 0x10c76, 0x11cf6, 0x13df6, 0x1f7d4,
- 0x1f7d2, 0x1e794, 0x1efb4, 0x1e792, 0x1efb2, 0x1c714, 0x1cf34, 0x1c712,
- 0x1df74, 0x1cf32, 0x1df72, 0x18614, 0x18e34, 0x18612, 0x19e74, 0x18e32,
- 0x1bef4},
- {0x1f560, 0x1fab8, 0x1ea40, 0x1f530, 0x1fa9c, 0x1ea20, 0x1f518, 0x1fa8e,
- 0x1ea10, 0x1f50c, 0x1ea08, 0x1f506, 0x1ea04, 0x1eb60, 0x1f5b8, 0x1fade,
- 0x1d640, 0x1eb30, 0x1f59c, 0x1d620, 0x1eb18, 0x1f58e, 0x1d610, 0x1eb0c,
- 0x1d608, 0x1eb06, 0x1d604, 0x1d760, 0x1ebb8, 0x1f5de, 0x1ae40, 0x1d730,
- 0x1eb9c, 0x1ae20, 0x1d718, 0x1eb8e, 0x1ae10, 0x1d70c, 0x1ae08, 0x1d706,
- 0x1ae04, 0x1af60, 0x1d7b8, 0x1ebde, 0x15e40, 0x1af30, 0x1d79c, 0x15e20,
- 0x1af18, 0x1d78e, 0x15e10, 0x1af0c, 0x15e08, 0x1af06, 0x15f60, 0x1afb8,
- 0x1d7de, 0x15f30, 0x1af9c, 0x15f18, 0x1af8e, 0x15f0c, 0x15fb8, 0x1afde,
- 0x15f9c, 0x15f8e, 0x1e940, 0x1f4b0, 0x1fa5c, 0x1e920, 0x1f498, 0x1fa4e,
- 0x1e910, 0x1f48c, 0x1e908, 0x1f486, 0x1e904, 0x1e902, 0x1d340, 0x1e9b0,
- 0x1f4dc, 0x1d320, 0x1e998, 0x1f4ce, 0x1d310, 0x1e98c, 0x1d308, 0x1e986,
- 0x1d304, 0x1d302, 0x1a740, 0x1d3b0, 0x1e9dc, 0x1a720, 0x1d398, 0x1e9ce,
- 0x1a710, 0x1d38c, 0x1a708, 0x1d386, 0x1a704, 0x1a702, 0x14f40, 0x1a7b0,
- 0x1d3dc, 0x14f20, 0x1a798, 0x1d3ce, 0x14f10, 0x1a78c, 0x14f08, 0x1a786,
- 0x14f04, 0x14fb0, 0x1a7dc, 0x14f98, 0x1a7ce, 0x14f8c, 0x14f86, 0x14fdc,
- 0x14fce, 0x1e8a0, 0x1f458, 0x1fa2e, 0x1e890, 0x1f44c, 0x1e888, 0x1f446,
- 0x1e884, 0x1e882, 0x1d1a0, 0x1e8d8, 0x1f46e, 0x1d190, 0x1e8cc, 0x1d188,
- 0x1e8c6, 0x1d184, 0x1d182, 0x1a3a0, 0x1d1d8, 0x1e8ee, 0x1a390, 0x1d1cc,
- 0x1a388, 0x1d1c6, 0x1a384, 0x1a382, 0x147a0, 0x1a3d8, 0x1d1ee, 0x14790,
- 0x1a3cc, 0x14788, 0x1a3c6, 0x14784, 0x14782, 0x147d8, 0x1a3ee, 0x147cc,
- 0x147c6, 0x147ee, 0x1e850, 0x1f42c, 0x1e848, 0x1f426, 0x1e844, 0x1e842,
- 0x1d0d0, 0x1e86c, 0x1d0c8, 0x1e866, 0x1d0c4, 0x1d0c2, 0x1a1d0, 0x1d0ec,
- 0x1a1c8, 0x1d0e6, 0x1a1c4, 0x1a1c2, 0x143d0, 0x1a1ec, 0x143c8, 0x1a1e6,
- 0x143c4, 0x143c2, 0x143ec, 0x143e6, 0x1e828, 0x1f416, 0x1e824, 0x1e822,
- 0x1d068, 0x1e836, 0x1d064, 0x1d062, 0x1a0e8, 0x1d076, 0x1a0e4, 0x1a0e2,
- 0x141e8, 0x1a0f6, 0x141e4, 0x141e2, 0x1e814, 0x1e812, 0x1d034, 0x1d032,
- 0x1a074, 0x1a072, 0x1e540, 0x1f2b0, 0x1f95c, 0x1e520, 0x1f298, 0x1f94e,
- 0x1e510, 0x1f28c, 0x1e508, 0x1f286, 0x1e504, 0x1e502, 0x1cb40, 0x1e5b0,
- 0x1f2dc, 0x1cb20, 0x1e598, 0x1f2ce, 0x1cb10, 0x1e58c, 0x1cb08, 0x1e586,
- 0x1cb04, 0x1cb02, 0x19740, 0x1cbb0, 0x1e5dc, 0x19720, 0x1cb98, 0x1e5ce,
- 0x19710, 0x1cb8c, 0x19708, 0x1cb86, 0x19704, 0x19702, 0x12f40, 0x197b0,
- 0x1cbdc, 0x12f20, 0x19798, 0x1cbce, 0x12f10, 0x1978c, 0x12f08, 0x19786,
- 0x12f04, 0x12fb0, 0x197dc, 0x12f98, 0x197ce, 0x12f8c, 0x12f86, 0x12fdc,
- 0x12fce, 0x1f6a0, 0x1fb58, 0x16bf0, 0x1f690, 0x1fb4c, 0x169f8, 0x1f688,
- 0x1fb46, 0x168fc, 0x1f684, 0x1f682, 0x1e4a0, 0x1f258, 0x1f92e, 0x1eda0,
- 0x1e490, 0x1fb6e, 0x1ed90, 0x1f6cc, 0x1f246, 0x1ed88, 0x1e484, 0x1ed84,
- 0x1e482, 0x1ed82, 0x1c9a0, 0x1e4d8, 0x1f26e, 0x1dba0, 0x1c990, 0x1e4cc,
- 0x1db90, 0x1edcc, 0x1e4c6, 0x1db88, 0x1c984, 0x1db84, 0x1c982, 0x1db82,
- 0x193a0, 0x1c9d8, 0x1e4ee, 0x1b7a0, 0x19390, 0x1c9cc, 0x1b790, 0x1dbcc,
- 0x1c9c6, 0x1b788, 0x19384, 0x1b784, 0x19382, 0x1b782, 0x127a0, 0x193d8,
- 0x1c9ee, 0x16fa0, 0x12790, 0x193cc, 0x16f90, 0x1b7cc, 0x193c6, 0x16f88,
- 0x12784, 0x16f84, 0x12782, 0x127d8, 0x193ee, 0x16fd8, 0x127cc, 0x16fcc,
- 0x127c6, 0x16fc6, 0x127ee, 0x1f650, 0x1fb2c, 0x165f8, 0x1f648, 0x1fb26,
- 0x164fc, 0x1f644, 0x1647e, 0x1f642, 0x1e450, 0x1f22c, 0x1ecd0, 0x1e448,
- 0x1f226, 0x1ecc8, 0x1f666, 0x1ecc4, 0x1e442, 0x1ecc2, 0x1c8d0, 0x1e46c,
- 0x1d9d0, 0x1c8c8, 0x1e466, 0x1d9c8, 0x1ece6, 0x1d9c4, 0x1c8c2, 0x1d9c2,
- 0x191d0, 0x1c8ec, 0x1b3d0, 0x191c8, 0x1c8e6, 0x1b3c8, 0x1d9e6, 0x1b3c4,
- 0x191c2, 0x1b3c2, 0x123d0, 0x191ec, 0x167d0, 0x123c8, 0x191e6, 0x167c8,
- 0x1b3e6, 0x167c4, 0x123c2, 0x167c2, 0x123ec, 0x167ec, 0x123e6, 0x167e6,
- 0x1f628, 0x1fb16, 0x162fc, 0x1f624, 0x1627e, 0x1f622, 0x1e428, 0x1f216,
- 0x1ec68, 0x1f636, 0x1ec64, 0x1e422, 0x1ec62, 0x1c868, 0x1e436, 0x1d8e8,
- 0x1c864, 0x1d8e4, 0x1c862, 0x1d8e2, 0x190e8, 0x1c876, 0x1b1e8, 0x1d8f6,
- 0x1b1e4, 0x190e2, 0x1b1e2, 0x121e8, 0x190f6, 0x163e8, 0x121e4, 0x163e4,
- 0x121e2, 0x163e2, 0x121f6, 0x163f6, 0x1f614, 0x1617e, 0x1f612, 0x1e414,
- 0x1ec34, 0x1e412, 0x1ec32, 0x1c834, 0x1d874, 0x1c832, 0x1d872, 0x19074,
- 0x1b0f4, 0x19072, 0x1b0f2, 0x120f4, 0x161f4, 0x120f2, 0x161f2, 0x1f60a,
- 0x1e40a, 0x1ec1a, 0x1c81a, 0x1d83a, 0x1903a, 0x1b07a, 0x1e2a0, 0x1f158,
- 0x1f8ae, 0x1e290, 0x1f14c, 0x1e288, 0x1f146, 0x1e284, 0x1e282, 0x1c5a0,
- 0x1e2d8, 0x1f16e, 0x1c590, 0x1e2cc, 0x1c588, 0x1e2c6, 0x1c584, 0x1c582,
- 0x18ba0, 0x1c5d8, 0x1e2ee, 0x18b90, 0x1c5cc, 0x18b88, 0x1c5c6, 0x18b84,
- 0x18b82, 0x117a0, 0x18bd8, 0x1c5ee, 0x11790, 0x18bcc, 0x11788, 0x18bc6,
- 0x11784, 0x11782, 0x117d8, 0x18bee, 0x117cc, 0x117c6, 0x117ee, 0x1f350,
- 0x1f9ac, 0x135f8, 0x1f348, 0x1f9a6, 0x134fc, 0x1f344, 0x1347e, 0x1f342,
- 0x1e250, 0x1f12c, 0x1e6d0, 0x1e248, 0x1f126, 0x1e6c8, 0x1f366, 0x1e6c4,
- 0x1e242, 0x1e6c2, 0x1c4d0, 0x1e26c, 0x1cdd0, 0x1c4c8, 0x1e266, 0x1cdc8,
- 0x1e6e6, 0x1cdc4, 0x1c4c2, 0x1cdc2, 0x189d0, 0x1c4ec, 0x19bd0, 0x189c8,
- 0x1c4e6, 0x19bc8, 0x1cde6, 0x19bc4, 0x189c2, 0x19bc2, 0x113d0, 0x189ec,
- 0x137d0, 0x113c8, 0x189e6, 0x137c8, 0x19be6, 0x137c4, 0x113c2, 0x137c2,
- 0x113ec, 0x137ec, 0x113e6, 0x137e6, 0x1fba8, 0x175f0, 0x1bafc, 0x1fba4,
- 0x174f8, 0x1ba7e, 0x1fba2, 0x1747c, 0x1743e, 0x1f328, 0x1f996, 0x132fc,
- 0x1f768, 0x1fbb6, 0x176fc, 0x1327e, 0x1f764, 0x1f322, 0x1767e, 0x1f762,
- 0x1e228, 0x1f116, 0x1e668, 0x1e224, 0x1eee8, 0x1f776, 0x1e222, 0x1eee4,
- 0x1e662, 0x1eee2, 0x1c468, 0x1e236, 0x1cce8, 0x1c464, 0x1dde8, 0x1cce4,
- 0x1c462, 0x1dde4, 0x1cce2, 0x1dde2, 0x188e8, 0x1c476, 0x199e8, 0x188e4,
- 0x1bbe8, 0x199e4, 0x188e2, 0x1bbe4, 0x199e2, 0x1bbe2, 0x111e8, 0x188f6,
- 0x133e8, 0x111e4, 0x177e8, 0x133e4, 0x111e2, 0x177e4, 0x133e2, 0x177e2,
- 0x111f6, 0x133f6, 0x1fb94, 0x172f8, 0x1b97e, 0x1fb92, 0x1727c, 0x1723e,
- 0x1f314, 0x1317e, 0x1f734, 0x1f312, 0x1737e, 0x1f732, 0x1e214, 0x1e634,
- 0x1e212, 0x1ee74, 0x1e632, 0x1ee72, 0x1c434, 0x1cc74, 0x1c432, 0x1dcf4,
- 0x1cc72, 0x1dcf2, 0x18874, 0x198f4, 0x18872, 0x1b9f4, 0x198f2, 0x1b9f2,
- 0x110f4, 0x131f4, 0x110f2, 0x173f4, 0x131f2, 0x173f2, 0x1fb8a, 0x1717c,
- 0x1713e, 0x1f30a, 0x1f71a, 0x1e20a, 0x1e61a, 0x1ee3a, 0x1c41a, 0x1cc3a,
- 0x1dc7a, 0x1883a, 0x1987a, 0x1b8fa, 0x1107a, 0x130fa, 0x171fa, 0x170be,
- 0x1e150, 0x1f0ac, 0x1e148, 0x1f0a6, 0x1e144, 0x1e142, 0x1c2d0, 0x1e16c,
- 0x1c2c8, 0x1e166, 0x1c2c4, 0x1c2c2, 0x185d0, 0x1c2ec, 0x185c8, 0x1c2e6,
- 0x185c4, 0x185c2, 0x10bd0, 0x185ec, 0x10bc8, 0x185e6, 0x10bc4, 0x10bc2,
- 0x10bec, 0x10be6, 0x1f1a8, 0x1f8d6, 0x11afc, 0x1f1a4, 0x11a7e, 0x1f1a2,
- 0x1e128, 0x1f096, 0x1e368, 0x1e124, 0x1e364, 0x1e122, 0x1e362, 0x1c268,
- 0x1e136, 0x1c6e8, 0x1c264, 0x1c6e4, 0x1c262, 0x1c6e2, 0x184e8, 0x1c276,
- 0x18de8, 0x184e4, 0x18de4, 0x184e2, 0x18de2, 0x109e8, 0x184f6, 0x11be8,
- 0x109e4, 0x11be4, 0x109e2, 0x11be2, 0x109f6, 0x11bf6, 0x1f9d4, 0x13af8,
- 0x19d7e, 0x1f9d2, 0x13a7c, 0x13a3e, 0x1f194, 0x1197e, 0x1f3b4, 0x1f192,
- 0x13b7e, 0x1f3b2, 0x1e114, 0x1e334, 0x1e112, 0x1e774, 0x1e332, 0x1e772,
- 0x1c234, 0x1c674, 0x1c232, 0x1cef4, 0x1c672, 0x1cef2, 0x18474, 0x18cf4,
- 0x18472, 0x19df4, 0x18cf2, 0x19df2, 0x108f4, 0x119f4, 0x108f2, 0x13bf4,
- 0x119f2, 0x13bf2, 0x17af0, 0x1bd7c, 0x17a78, 0x1bd3e, 0x17a3c, 0x17a1e,
- 0x1f9ca, 0x1397c, 0x1fbda, 0x17b7c, 0x1393e, 0x17b3e, 0x1f18a, 0x1f39a,
- 0x1f7ba, 0x1e10a, 0x1e31a, 0x1e73a, 0x1ef7a, 0x1c21a, 0x1c63a, 0x1ce7a,
- 0x1defa, 0x1843a, 0x18c7a, 0x19cfa, 0x1bdfa, 0x1087a, 0x118fa, 0x139fa,
- 0x17978, 0x1bcbe, 0x1793c, 0x1791e, 0x138be, 0x179be, 0x178bc, 0x1789e,
- 0x1785e, 0x1e0a8, 0x1e0a4, 0x1e0a2, 0x1c168, 0x1e0b6, 0x1c164, 0x1c162,
- 0x182e8, 0x1c176, 0x182e4, 0x182e2, 0x105e8, 0x182f6, 0x105e4, 0x105e2,
- 0x105f6, 0x1f0d4, 0x10d7e, 0x1f0d2, 0x1e094, 0x1e1b4, 0x1e092, 0x1e1b2,
- 0x1c134, 0x1c374, 0x1c132, 0x1c372, 0x18274, 0x186f4, 0x18272, 0x186f2,
- 0x104f4, 0x10df4, 0x104f2, 0x10df2, 0x1f8ea, 0x11d7c, 0x11d3e, 0x1f0ca,
- 0x1f1da, 0x1e08a, 0x1e19a, 0x1e3ba, 0x1c11a, 0x1c33a, 0x1c77a, 0x1823a,
- 0x1867a, 0x18efa, 0x1047a, 0x10cfa, 0x11dfa, 0x13d78, 0x19ebe, 0x13d3c,
- 0x13d1e, 0x11cbe, 0x13dbe, 0x17d70, 0x1bebc, 0x17d38, 0x1be9e, 0x17d1c,
- 0x17d0e, 0x13cbc, 0x17dbc, 0x13c9e, 0x17d9e, 0x17cb8, 0x1be5e, 0x17c9c,
- 0x17c8e, 0x13c5e, 0x17cde, 0x17c5c, 0x17c4e, 0x17c2e, 0x1c0b4, 0x1c0b2,
- 0x18174, 0x18172, 0x102f4, 0x102f2, 0x1e0da, 0x1c09a, 0x1c1ba, 0x1813a,
- 0x1837a, 0x1027a, 0x106fa, 0x10ebe, 0x11ebc, 0x11e9e, 0x13eb8, 0x19f5e,
- 0x13e9c, 0x13e8e, 0x11e5e, 0x13ede, 0x17eb0, 0x1bf5c, 0x17e98, 0x1bf4e,
- 0x17e8c, 0x17e86, 0x13e5c, 0x17edc, 0x13e4e, 0x17ece, 0x17e58, 0x1bf2e,
- 0x17e4c, 0x17e46, 0x13e2e, 0x17e6e, 0x17e2c, 0x17e26, 0x10f5e, 0x11f5c,
- 0x11f4e, 0x13f58, 0x19fae, 0x13f4c, 0x13f46, 0x11f2e, 0x13f6e, 0x13f2c,
- 0x13f26},
- {0x1abe0, 0x1d5f8, 0x153c0, 0x1a9f0, 0x1d4fc, 0x151e0, 0x1a8f8, 0x1d47e,
- 0x150f0, 0x1a87c, 0x15078, 0x1fad0, 0x15be0, 0x1adf8, 0x1fac8, 0x159f0,
- 0x1acfc, 0x1fac4, 0x158f8, 0x1ac7e, 0x1fac2, 0x1587c, 0x1f5d0, 0x1faec,
- 0x15df8, 0x1f5c8, 0x1fae6, 0x15cfc, 0x1f5c4, 0x15c7e, 0x1f5c2, 0x1ebd0,
- 0x1f5ec, 0x1ebc8, 0x1f5e6, 0x1ebc4, 0x1ebc2, 0x1d7d0, 0x1ebec, 0x1d7c8,
- 0x1ebe6, 0x1d7c4, 0x1d7c2, 0x1afd0, 0x1d7ec, 0x1afc8, 0x1d7e6, 0x1afc4,
- 0x14bc0, 0x1a5f0, 0x1d2fc, 0x149e0, 0x1a4f8, 0x1d27e, 0x148f0, 0x1a47c,
- 0x14878, 0x1a43e, 0x1483c, 0x1fa68, 0x14df0, 0x1a6fc, 0x1fa64, 0x14cf8,
- 0x1a67e, 0x1fa62, 0x14c7c, 0x14c3e, 0x1f4e8, 0x1fa76, 0x14efc, 0x1f4e4,
- 0x14e7e, 0x1f4e2, 0x1e9e8, 0x1f4f6, 0x1e9e4, 0x1e9e2, 0x1d3e8, 0x1e9f6,
- 0x1d3e4, 0x1d3e2, 0x1a7e8, 0x1d3f6, 0x1a7e4, 0x1a7e2, 0x145e0, 0x1a2f8,
- 0x1d17e, 0x144f0, 0x1a27c, 0x14478, 0x1a23e, 0x1443c, 0x1441e, 0x1fa34,
- 0x146f8, 0x1a37e, 0x1fa32, 0x1467c, 0x1463e, 0x1f474, 0x1477e, 0x1f472,
- 0x1e8f4, 0x1e8f2, 0x1d1f4, 0x1d1f2, 0x1a3f4, 0x1a3f2, 0x142f0, 0x1a17c,
- 0x14278, 0x1a13e, 0x1423c, 0x1421e, 0x1fa1a, 0x1437c, 0x1433e, 0x1f43a,
- 0x1e87a, 0x1d0fa, 0x14178, 0x1a0be, 0x1413c, 0x1411e, 0x141be, 0x140bc,
- 0x1409e, 0x12bc0, 0x195f0, 0x1cafc, 0x129e0, 0x194f8, 0x1ca7e, 0x128f0,
- 0x1947c, 0x12878, 0x1943e, 0x1283c, 0x1f968, 0x12df0, 0x196fc, 0x1f964,
- 0x12cf8, 0x1967e, 0x1f962, 0x12c7c, 0x12c3e, 0x1f2e8, 0x1f976, 0x12efc,
- 0x1f2e4, 0x12e7e, 0x1f2e2, 0x1e5e8, 0x1f2f6, 0x1e5e4, 0x1e5e2, 0x1cbe8,
- 0x1e5f6, 0x1cbe4, 0x1cbe2, 0x197e8, 0x1cbf6, 0x197e4, 0x197e2, 0x1b5e0,
- 0x1daf8, 0x1ed7e, 0x169c0, 0x1b4f0, 0x1da7c, 0x168e0, 0x1b478, 0x1da3e,
- 0x16870, 0x1b43c, 0x16838, 0x1b41e, 0x1681c, 0x125e0, 0x192f8, 0x1c97e,
- 0x16de0, 0x124f0, 0x1927c, 0x16cf0, 0x1b67c, 0x1923e, 0x16c78, 0x1243c,
- 0x16c3c, 0x1241e, 0x16c1e, 0x1f934, 0x126f8, 0x1937e, 0x1fb74, 0x1f932,
- 0x16ef8, 0x1267c, 0x1fb72, 0x16e7c, 0x1263e, 0x16e3e, 0x1f274, 0x1277e,
- 0x1f6f4, 0x1f272, 0x16f7e, 0x1f6f2, 0x1e4f4, 0x1edf4, 0x1e4f2, 0x1edf2,
- 0x1c9f4, 0x1dbf4, 0x1c9f2, 0x1dbf2, 0x193f4, 0x193f2, 0x165c0, 0x1b2f0,
- 0x1d97c, 0x164e0, 0x1b278, 0x1d93e, 0x16470, 0x1b23c, 0x16438, 0x1b21e,
- 0x1641c, 0x1640e, 0x122f0, 0x1917c, 0x166f0, 0x12278, 0x1913e, 0x16678,
- 0x1b33e, 0x1663c, 0x1221e, 0x1661e, 0x1f91a, 0x1237c, 0x1fb3a, 0x1677c,
- 0x1233e, 0x1673e, 0x1f23a, 0x1f67a, 0x1e47a, 0x1ecfa, 0x1c8fa, 0x1d9fa,
- 0x191fa, 0x162e0, 0x1b178, 0x1d8be, 0x16270, 0x1b13c, 0x16238, 0x1b11e,
- 0x1621c, 0x1620e, 0x12178, 0x190be, 0x16378, 0x1213c, 0x1633c, 0x1211e,
- 0x1631e, 0x121be, 0x163be, 0x16170, 0x1b0bc, 0x16138, 0x1b09e, 0x1611c,
- 0x1610e, 0x120bc, 0x161bc, 0x1209e, 0x1619e, 0x160b8, 0x1b05e, 0x1609c,
- 0x1608e, 0x1205e, 0x160de, 0x1605c, 0x1604e, 0x115e0, 0x18af8, 0x1c57e,
- 0x114f0, 0x18a7c, 0x11478, 0x18a3e, 0x1143c, 0x1141e, 0x1f8b4, 0x116f8,
- 0x18b7e, 0x1f8b2, 0x1167c, 0x1163e, 0x1f174, 0x1177e, 0x1f172, 0x1e2f4,
- 0x1e2f2, 0x1c5f4, 0x1c5f2, 0x18bf4, 0x18bf2, 0x135c0, 0x19af0, 0x1cd7c,
- 0x134e0, 0x19a78, 0x1cd3e, 0x13470, 0x19a3c, 0x13438, 0x19a1e, 0x1341c,
- 0x1340e, 0x112f0, 0x1897c, 0x136f0, 0x11278, 0x1893e, 0x13678, 0x19b3e,
- 0x1363c, 0x1121e, 0x1361e, 0x1f89a, 0x1137c, 0x1f9ba, 0x1377c, 0x1133e,
- 0x1373e, 0x1f13a, 0x1f37a, 0x1e27a, 0x1e6fa, 0x1c4fa, 0x1cdfa, 0x189fa,
- 0x1bae0, 0x1dd78, 0x1eebe, 0x174c0, 0x1ba70, 0x1dd3c, 0x17460, 0x1ba38,
- 0x1dd1e, 0x17430, 0x1ba1c, 0x17418, 0x1ba0e, 0x1740c, 0x132e0, 0x19978,
- 0x1ccbe, 0x176e0, 0x13270, 0x1993c, 0x17670, 0x1bb3c, 0x1991e, 0x17638,
- 0x1321c, 0x1761c, 0x1320e, 0x1760e, 0x11178, 0x188be, 0x13378, 0x1113c,
- 0x17778, 0x1333c, 0x1111e, 0x1773c, 0x1331e, 0x1771e, 0x111be, 0x133be,
- 0x177be, 0x172c0, 0x1b970, 0x1dcbc, 0x17260, 0x1b938, 0x1dc9e, 0x17230,
- 0x1b91c, 0x17218, 0x1b90e, 0x1720c, 0x17206, 0x13170, 0x198bc, 0x17370,
- 0x13138, 0x1989e, 0x17338, 0x1b99e, 0x1731c, 0x1310e, 0x1730e, 0x110bc,
- 0x131bc, 0x1109e, 0x173bc, 0x1319e, 0x1739e, 0x17160, 0x1b8b8, 0x1dc5e,
- 0x17130, 0x1b89c, 0x17118, 0x1b88e, 0x1710c, 0x17106, 0x130b8, 0x1985e,
- 0x171b8, 0x1309c, 0x1719c, 0x1308e, 0x1718e, 0x1105e, 0x130de, 0x171de,
- 0x170b0, 0x1b85c, 0x17098, 0x1b84e, 0x1708c, 0x17086, 0x1305c, 0x170dc,
- 0x1304e, 0x170ce, 0x17058, 0x1b82e, 0x1704c, 0x17046, 0x1302e, 0x1706e,
- 0x1702c, 0x17026, 0x10af0, 0x1857c, 0x10a78, 0x1853e, 0x10a3c, 0x10a1e,
- 0x10b7c, 0x10b3e, 0x1f0ba, 0x1e17a, 0x1c2fa, 0x185fa, 0x11ae0, 0x18d78,
- 0x1c6be, 0x11a70, 0x18d3c, 0x11a38, 0x18d1e, 0x11a1c, 0x11a0e, 0x10978,
- 0x184be, 0x11b78, 0x1093c, 0x11b3c, 0x1091e, 0x11b1e, 0x109be, 0x11bbe,
- 0x13ac0, 0x19d70, 0x1cebc, 0x13a60, 0x19d38, 0x1ce9e, 0x13a30, 0x19d1c,
- 0x13a18, 0x19d0e, 0x13a0c, 0x13a06, 0x11970, 0x18cbc, 0x13b70, 0x11938,
- 0x18c9e, 0x13b38, 0x1191c, 0x13b1c, 0x1190e, 0x13b0e, 0x108bc, 0x119bc,
- 0x1089e, 0x13bbc, 0x1199e, 0x13b9e, 0x1bd60, 0x1deb8, 0x1ef5e, 0x17a40,
- 0x1bd30, 0x1de9c, 0x17a20, 0x1bd18, 0x1de8e, 0x17a10, 0x1bd0c, 0x17a08,
- 0x1bd06, 0x17a04, 0x13960, 0x19cb8, 0x1ce5e, 0x17b60, 0x13930, 0x19c9c,
- 0x17b30, 0x1bd9c, 0x19c8e, 0x17b18, 0x1390c, 0x17b0c, 0x13906, 0x17b06,
- 0x118b8, 0x18c5e, 0x139b8, 0x1189c, 0x17bb8, 0x1399c, 0x1188e, 0x17b9c,
- 0x1398e, 0x17b8e, 0x1085e, 0x118de, 0x139de, 0x17bde, 0x17940, 0x1bcb0,
- 0x1de5c, 0x17920, 0x1bc98, 0x1de4e, 0x17910, 0x1bc8c, 0x17908, 0x1bc86,
- 0x17904, 0x17902, 0x138b0, 0x19c5c, 0x179b0, 0x13898, 0x19c4e, 0x17998,
- 0x1bcce, 0x1798c, 0x13886, 0x17986, 0x1185c, 0x138dc, 0x1184e, 0x179dc,
- 0x138ce, 0x179ce, 0x178a0, 0x1bc58, 0x1de2e, 0x17890, 0x1bc4c, 0x17888,
- 0x1bc46, 0x17884, 0x17882, 0x13858, 0x19c2e, 0x178d8, 0x1384c, 0x178cc,
- 0x13846, 0x178c6, 0x1182e, 0x1386e, 0x178ee, 0x17850, 0x1bc2c, 0x17848,
- 0x1bc26, 0x17844, 0x17842, 0x1382c, 0x1786c, 0x13826, 0x17866, 0x17828,
- 0x1bc16, 0x17824, 0x17822, 0x13816, 0x17836, 0x10578, 0x182be, 0x1053c,
- 0x1051e, 0x105be, 0x10d70, 0x186bc, 0x10d38, 0x1869e, 0x10d1c, 0x10d0e,
- 0x104bc, 0x10dbc, 0x1049e, 0x10d9e, 0x11d60, 0x18eb8, 0x1c75e, 0x11d30,
- 0x18e9c, 0x11d18, 0x18e8e, 0x11d0c, 0x11d06, 0x10cb8, 0x1865e, 0x11db8,
- 0x10c9c, 0x11d9c, 0x10c8e, 0x11d8e, 0x1045e, 0x10cde, 0x11dde, 0x13d40,
- 0x19eb0, 0x1cf5c, 0x13d20, 0x19e98, 0x1cf4e, 0x13d10, 0x19e8c, 0x13d08,
- 0x19e86, 0x13d04, 0x13d02, 0x11cb0, 0x18e5c, 0x13db0, 0x11c98, 0x18e4e,
- 0x13d98, 0x19ece, 0x13d8c, 0x11c86, 0x13d86, 0x10c5c, 0x11cdc, 0x10c4e,
- 0x13ddc, 0x11cce, 0x13dce, 0x1bea0, 0x1df58, 0x1efae, 0x1be90, 0x1df4c,
- 0x1be88, 0x1df46, 0x1be84, 0x1be82, 0x13ca0, 0x19e58, 0x1cf2e, 0x17da0,
- 0x13c90, 0x19e4c, 0x17d90, 0x1becc, 0x19e46, 0x17d88, 0x13c84, 0x17d84,
- 0x13c82, 0x17d82, 0x11c58, 0x18e2e, 0x13cd8, 0x11c4c, 0x17dd8, 0x13ccc,
- 0x11c46, 0x17dcc, 0x13cc6, 0x17dc6, 0x10c2e, 0x11c6e, 0x13cee, 0x17dee,
- 0x1be50, 0x1df2c, 0x1be48, 0x1df26, 0x1be44, 0x1be42, 0x13c50, 0x19e2c,
- 0x17cd0, 0x13c48, 0x19e26, 0x17cc8, 0x1be66, 0x17cc4, 0x13c42, 0x17cc2,
- 0x11c2c, 0x13c6c, 0x11c26, 0x17cec, 0x13c66, 0x17ce6, 0x1be28, 0x1df16,
- 0x1be24, 0x1be22, 0x13c28, 0x19e16, 0x17c68, 0x13c24, 0x17c64, 0x13c22,
- 0x17c62, 0x11c16, 0x13c36, 0x17c76, 0x1be14, 0x1be12, 0x13c14, 0x17c34,
- 0x13c12, 0x17c32, 0x102bc, 0x1029e, 0x106b8, 0x1835e, 0x1069c, 0x1068e,
- 0x1025e, 0x106de, 0x10eb0, 0x1875c, 0x10e98, 0x1874e, 0x10e8c, 0x10e86,
- 0x1065c, 0x10edc, 0x1064e, 0x10ece, 0x11ea0, 0x18f58, 0x1c7ae, 0x11e90,
- 0x18f4c, 0x11e88, 0x18f46, 0x11e84, 0x11e82, 0x10e58, 0x1872e, 0x11ed8,
- 0x18f6e, 0x11ecc, 0x10e46, 0x11ec6, 0x1062e, 0x10e6e, 0x11eee, 0x19f50,
- 0x1cfac, 0x19f48, 0x1cfa6, 0x19f44, 0x19f42, 0x11e50, 0x18f2c, 0x13ed0,
- 0x19f6c, 0x18f26, 0x13ec8, 0x11e44, 0x13ec4, 0x11e42, 0x13ec2, 0x10e2c,
- 0x11e6c, 0x10e26, 0x13eec, 0x11e66, 0x13ee6, 0x1dfa8, 0x1efd6, 0x1dfa4,
- 0x1dfa2, 0x19f28, 0x1cf96, 0x1bf68, 0x19f24, 0x1bf64, 0x19f22, 0x1bf62,
- 0x11e28, 0x18f16, 0x13e68, 0x11e24, 0x17ee8, 0x13e64, 0x11e22, 0x17ee4,
- 0x13e62, 0x17ee2, 0x10e16, 0x11e36, 0x13e76, 0x17ef6, 0x1df94, 0x1df92,
- 0x19f14, 0x1bf34, 0x19f12, 0x1bf32, 0x11e14, 0x13e34, 0x11e12, 0x17e74,
- 0x13e32, 0x17e72, 0x1df8a, 0x19f0a, 0x1bf1a, 0x11e0a, 0x13e1a, 0x17e3a,
- 0x1035c, 0x1034e, 0x10758, 0x183ae, 0x1074c, 0x10746, 0x1032e, 0x1076e,
- 0x10f50, 0x187ac, 0x10f48, 0x187a6, 0x10f44, 0x10f42, 0x1072c, 0x10f6c,
- 0x10726, 0x10f66, 0x18fa8, 0x1c7d6, 0x18fa4, 0x18fa2, 0x10f28, 0x18796,
- 0x11f68, 0x18fb6, 0x11f64, 0x10f22, 0x11f62, 0x10716, 0x10f36, 0x11f76,
- 0x1cfd4, 0x1cfd2, 0x18f94, 0x19fb4, 0x18f92, 0x19fb2, 0x10f14, 0x11f34,
- 0x10f12, 0x13f74, 0x11f32, 0x13f72, 0x1cfca, 0x18f8a, 0x19f9a, 0x10f0a,
- 0x11f1a, 0x13f3a, 0x103ac, 0x103a6, 0x107a8, 0x183d6, 0x107a4, 0x107a2,
- 0x10396, 0x107b6, 0x187d4, 0x187d2, 0x10794, 0x10fb4, 0x10792, 0x10fb2,
- 0x1c7ea}};
-
-CBC_PDF417::CBC_PDF417() : CBC_PDF417(false) {}
-
-CBC_PDF417::CBC_PDF417(bool compact)
- : m_compact(compact),
- m_compaction(AUTO),
- m_minCols(1),
- m_maxCols(30),
- m_maxRows(90),
- m_minRows(3) {}
-
-CBC_PDF417::~CBC_PDF417() {}
-
-CBC_BarcodeMatrix* CBC_PDF417::getBarcodeMatrix() {
- return m_barcodeMatrix.get();
-}
-
-void CBC_PDF417::generateBarcodeLogic(CFX_WideString msg,
- int32_t errorCorrectionLevel,
- int32_t& e) {
- int32_t errorCorrectionCodeWords =
- CBC_PDF417ErrorCorrection::getErrorCorrectionCodewordCount(
- errorCorrectionLevel, e);
- if (e != BCExceptionNO)
- return;
- CFX_WideString highLevel =
- CBC_PDF417HighLevelEncoder::encodeHighLevel(msg, m_compaction, e);
- if (e != BCExceptionNO)
- return;
- int32_t sourceCodeWords = highLevel.GetLength();
- CFX_ArrayTemplate<int32_t>* dimension =
- determineDimensions(sourceCodeWords, errorCorrectionCodeWords, e);
- if (e != BCExceptionNO)
- return;
- int32_t cols = dimension->GetAt(0);
- int32_t rows = dimension->GetAt(1);
- delete dimension;
- int32_t pad = getNumberOfPadCodewords(sourceCodeWords,
- errorCorrectionCodeWords, cols, rows);
- if (sourceCodeWords + errorCorrectionCodeWords + 1 > 929) {
- e = BCExceptionEncodedMessageContainsTooManyCodeWords;
- return;
- }
- int32_t n = sourceCodeWords + pad + 1;
- CFX_WideString sb;
- sb += (FX_WCHAR)n;
- sb += highLevel;
- for (int32_t i = 0; i < pad; i++) {
- sb += (FX_WCHAR)900;
- }
- CFX_WideString dataCodewords(sb);
- CFX_WideString ec = CBC_PDF417ErrorCorrection::generateErrorCorrection(
- dataCodewords, errorCorrectionLevel, e);
- if (e != BCExceptionNO)
- return;
- CFX_WideString fullCodewords = dataCodewords + ec;
- m_barcodeMatrix = pdfium::MakeUnique<CBC_BarcodeMatrix>(rows, cols);
- encodeLowLevel(fullCodewords, cols, rows, errorCorrectionLevel,
- m_barcodeMatrix.get());
-}
-
-void CBC_PDF417::setDimensions(int32_t maxCols,
- int32_t minCols,
- int32_t maxRows,
- int32_t minRows) {
- m_maxCols = maxCols;
- m_minCols = minCols;
- m_maxRows = maxRows;
- m_minRows = minRows;
-}
-
-void CBC_PDF417::setCompaction(Compaction compaction) {
- m_compaction = compaction;
-}
-
-void CBC_PDF417::setCompact(bool compact) {
- m_compact = compact;
-}
-
-int32_t CBC_PDF417::calculateNumberOfRows(int32_t m, int32_t k, int32_t c) {
- int32_t r = ((m + 1 + k) / c) + 1;
- if (c * r >= (m + 1 + k + c)) {
- r--;
- }
- return r;
-}
-
-int32_t CBC_PDF417::getNumberOfPadCodewords(int32_t m,
- int32_t k,
- int32_t c,
- int32_t r) {
- int32_t n = c * r - k;
- return n > m + 1 ? n - m - 1 : 0;
-}
-
-void CBC_PDF417::encodeChar(int32_t pattern,
- int32_t len,
- CBC_BarcodeRow* logic) {
- int32_t map = 1 << (len - 1);
- bool last = ((pattern & map) != 0);
- int32_t width = 0;
- for (int32_t i = 0; i < len; i++) {
- bool black = ((pattern & map) != 0);
- if (last == black) {
- width++;
- } else {
- logic->addBar(last, width);
- last = black;
- width = 1;
- }
- map >>= 1;
- }
- logic->addBar(last, width);
-}
-
-void CBC_PDF417::encodeLowLevel(CFX_WideString fullCodewords,
- int32_t c,
- int32_t r,
- int32_t errorCorrectionLevel,
- CBC_BarcodeMatrix* logic) {
- int32_t idx = 0;
- for (int32_t y = 0; y < r; y++) {
- int32_t cluster = y % 3;
- logic->startRow();
- encodeChar(START_PATTERN, 17, logic->getCurrentRow());
- int32_t left;
- int32_t right;
- if (cluster == 0) {
- left = (30 * (y / 3)) + ((r - 1) / 3);
- right = (30 * (y / 3)) + (c - 1);
- } else if (cluster == 1) {
- left = (30 * (y / 3)) + (errorCorrectionLevel * 3) + ((r - 1) % 3);
- right = (30 * (y / 3)) + ((r - 1) / 3);
- } else {
- left = (30 * (y / 3)) + (c - 1);
- right = (30 * (y / 3)) + (errorCorrectionLevel * 3) + ((r - 1) % 3);
- }
- int32_t pattern = CODEWORD_TABLE[cluster][left];
- encodeChar(pattern, 17, logic->getCurrentRow());
- for (int32_t x = 0; x < c; x++) {
- pattern = CODEWORD_TABLE[cluster][fullCodewords.GetAt(idx)];
- encodeChar(pattern, 17, logic->getCurrentRow());
- idx++;
- }
- if (m_compact) {
- encodeChar(STOP_PATTERN, 1, logic->getCurrentRow());
- } else {
- pattern = CODEWORD_TABLE[cluster][right];
- encodeChar(pattern, 17, logic->getCurrentRow());
- encodeChar(STOP_PATTERN, 18, logic->getCurrentRow());
- }
- }
-}
-
-CFX_ArrayTemplate<int32_t>* CBC_PDF417::determineDimensions(
- int32_t sourceCodeWords,
- int32_t errorCorrectionCodeWords,
- int32_t& e) {
- FX_FLOAT ratio = 0.0f;
- CFX_ArrayTemplate<int32_t>* dimension = nullptr;
- for (int32_t cols = m_minCols; cols <= m_maxCols; cols++) {
- int32_t rows =
- calculateNumberOfRows(sourceCodeWords, errorCorrectionCodeWords, cols);
- if (rows < m_minRows) {
- break;
- }
- if (rows > m_maxRows) {
- continue;
- }
- FX_FLOAT newRatio =
- ((17 * cols + 69) * DEFAULT_MODULE_WIDTH) / (rows * HEIGHT);
- if (dimension &&
- fabsf(newRatio - PREFERRED_RATIO) > fabsf(ratio - PREFERRED_RATIO)) {
- continue;
- }
- ratio = newRatio;
- delete dimension;
- dimension = new CFX_ArrayTemplate<int32_t>;
- dimension->Add(cols);
- dimension->Add(rows);
- }
- if (!dimension) {
- int32_t rows = calculateNumberOfRows(sourceCodeWords,
- errorCorrectionCodeWords, m_minCols);
- if (rows < m_minRows) {
- dimension = new CFX_ArrayTemplate<int32_t>;
- dimension->Add(m_minCols);
- dimension->Add(m_minRows);
- } else if (rows >= 3 && rows <= 90) {
- dimension = new CFX_ArrayTemplate<int32_t>;
- dimension->Add(m_minCols);
- dimension->Add(rows);
- }
- }
- if (!dimension) {
- e = BCExceptionUnableToFitMessageInColumns;
- return nullptr;
- }
- return dimension;
-}
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/pdf417/BC_PDF417.h b/chromium/third_party/pdfium/xfa/fxbarcode/pdf417/BC_PDF417.h
deleted file mode 100644
index 3ba5aa2f0c0..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/pdf417/BC_PDF417.h
+++ /dev/null
@@ -1,68 +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 XFA_FXBARCODE_PDF417_BC_PDF417_H_
-#define XFA_FXBARCODE_PDF417_BC_PDF417_H_
-
-#include <memory>
-
-#include "core/fxcrt/fx_basic.h"
-#include "xfa/fxbarcode/pdf417/BC_PDF417Compaction.h"
-
-class CBC_BarcodeRow;
-class CBC_BarcodeMatrix;
-
-class CBC_PDF417 {
- public:
- CBC_PDF417();
- explicit CBC_PDF417(bool compact);
- virtual ~CBC_PDF417();
-
- CBC_BarcodeMatrix* getBarcodeMatrix();
- void generateBarcodeLogic(CFX_WideString msg,
- int32_t errorCorrectionLevel,
- int32_t& e);
- void setDimensions(int32_t maxCols,
- int32_t minCols,
- int32_t maxRows,
- int32_t minRows);
- void setCompaction(Compaction compaction);
- void setCompact(bool compact);
-
- private:
- static const int32_t START_PATTERN = 0x1fea8;
- static const int32_t STOP_PATTERN = 0x3fa29;
- static const int32_t CODEWORD_TABLE[][929];
- static constexpr FX_FLOAT PREFERRED_RATIO = 3.0f;
- static constexpr FX_FLOAT DEFAULT_MODULE_WIDTH = 0.357f;
- static constexpr FX_FLOAT HEIGHT = 2.0f;
-
- static int32_t calculateNumberOfRows(int32_t m, int32_t k, int32_t c);
- static int32_t getNumberOfPadCodewords(int32_t m,
- int32_t k,
- int32_t c,
- int32_t r);
- static void encodeChar(int32_t pattern, int32_t len, CBC_BarcodeRow* logic);
- void encodeLowLevel(CFX_WideString fullCodewords,
- int32_t c,
- int32_t r,
- int32_t errorCorrectionLevel,
- CBC_BarcodeMatrix* logic);
- CFX_ArrayTemplate<int32_t>* determineDimensions(
- int32_t sourceCodeWords,
- int32_t errorCorrectionCodeWords,
- int32_t& e);
-
- std::unique_ptr<CBC_BarcodeMatrix> m_barcodeMatrix;
- bool m_compact;
- Compaction m_compaction;
- int32_t m_minCols;
- int32_t m_maxCols;
- int32_t m_maxRows;
- int32_t m_minRows;
-};
-
-#endif // XFA_FXBARCODE_PDF417_BC_PDF417_H_
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.cpp b/chromium/third_party/pdfium/xfa/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.cpp
deleted file mode 100644
index c1f4da1e3be..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.cpp
+++ /dev/null
@@ -1,88 +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
-// Original code is licensed as follows:
-/*
- * Copyright 2011 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "xfa/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.h"
-#include "xfa/fxbarcode/pdf417/BC_PDF417BarcodeRow.h"
-
-CBC_BarcodeMatrix::CBC_BarcodeMatrix(int32_t height, int32_t width) {
- m_matrix.SetSize(height + 2);
- for (int32_t i = 0, matrixLength = m_matrix.GetSize(); i < matrixLength;
- i++) {
- m_matrix[i] = new CBC_BarcodeRow((width + 4) * 17 + 1);
- }
- m_width = width * 17;
- m_height = height + 2;
- m_currentRow = 0;
- m_outHeight = 0;
- m_outWidth = 0;
-}
-CBC_BarcodeMatrix::~CBC_BarcodeMatrix() {
- for (int32_t i = 0; i < m_matrix.GetSize(); i++)
- delete m_matrix.GetAt(i);
-
- m_matrixOut.RemoveAll();
-}
-void CBC_BarcodeMatrix::set(int32_t x, int32_t y, uint8_t value) {
- m_matrix[y]->set(x, value);
-}
-void CBC_BarcodeMatrix::setMatrix(int32_t x, int32_t y, bool black) {
- set(x, y, (uint8_t)(black ? 1 : 0));
-}
-void CBC_BarcodeMatrix::startRow() {
- ++m_currentRow;
-}
-CBC_BarcodeRow* CBC_BarcodeMatrix::getCurrentRow() {
- return m_matrix[m_currentRow];
-}
-int32_t CBC_BarcodeMatrix::getWidth() {
- return m_outWidth;
-}
-int32_t CBC_BarcodeMatrix::getHeight() {
- return m_outHeight;
-}
-CFX_ArrayTemplate<uint8_t>& CBC_BarcodeMatrix::getMatrix() {
- return getScaledMatrix(1, 1);
-}
-CFX_ArrayTemplate<uint8_t>& CBC_BarcodeMatrix::getScaledMatrix(int32_t scale) {
- return getScaledMatrix(scale, scale);
-}
-CFX_ArrayTemplate<uint8_t>& CBC_BarcodeMatrix::getScaledMatrix(int32_t xScale,
- int32_t yScale) {
- int32_t yMax = m_height * yScale;
- CFX_ArrayTemplate<uint8_t> bytearray;
- bytearray.Copy(m_matrix[0]->getScaledRow(xScale));
- int32_t xMax = bytearray.GetSize();
- m_matrixOut.SetSize(xMax * yMax);
- m_outWidth = xMax;
- m_outHeight = yMax;
- int32_t k = 0;
- for (int32_t i = 0; i < yMax; i++) {
- if (i != 0) {
- bytearray.Copy(m_matrix[i / yScale]->getScaledRow(xScale));
- }
- k = i * xMax;
- for (int32_t l = 0; l < xMax; l++) {
- m_matrixOut[k + l] = bytearray.GetAt(l);
- }
- }
- return m_matrixOut;
-}
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.h b/chromium/third_party/pdfium/xfa/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.h
deleted file mode 100644
index 95ab547c902..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.h
+++ /dev/null
@@ -1,40 +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 XFA_FXBARCODE_PDF417_BC_PDF417BARCODEMATRIX_H_
-#define XFA_FXBARCODE_PDF417_BC_PDF417BARCODEMATRIX_H_
-
-#include "core/fxcrt/fx_basic.h"
-
-class CBC_BarcodeRow;
-
-class CBC_BarcodeMatrix {
- public:
- CBC_BarcodeMatrix();
- CBC_BarcodeMatrix(int32_t height, int32_t width);
- virtual ~CBC_BarcodeMatrix();
-
- void set(int32_t x, int32_t y, uint8_t value);
- void setMatrix(int32_t x, int32_t y, bool black);
- void startRow();
- CBC_BarcodeRow* getCurrentRow();
- CFX_ArrayTemplate<uint8_t>& getMatrix();
- CFX_ArrayTemplate<uint8_t>& getScaledMatrix(int32_t scale);
- CFX_ArrayTemplate<uint8_t>& getScaledMatrix(int32_t xScale, int32_t yScale);
- int32_t getWidth();
- int32_t getHeight();
-
- private:
- CFX_ArrayTemplate<CBC_BarcodeRow*> m_matrix;
- CFX_ArrayTemplate<uint8_t> m_matrixOut;
- int32_t m_currentRow;
- int32_t m_height;
- int32_t m_width;
- int32_t m_outWidth;
- int32_t m_outHeight;
-};
-
-#endif // XFA_FXBARCODE_PDF417_BC_PDF417BARCODEMATRIX_H_
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/pdf417/BC_PDF417BarcodeRow.cpp b/chromium/third_party/pdfium/xfa/fxbarcode/pdf417/BC_PDF417BarcodeRow.cpp
deleted file mode 100644
index 243af70d943..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/pdf417/BC_PDF417BarcodeRow.cpp
+++ /dev/null
@@ -1,53 +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
-// Original code is licensed as follows:
-/*
- * Copyright 2011 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "xfa/fxbarcode/pdf417/BC_PDF417BarcodeRow.h"
-
-CBC_BarcodeRow::CBC_BarcodeRow(int32_t width) {
- m_row.SetSize(width);
- m_currentLocation = 0;
-}
-CBC_BarcodeRow::~CBC_BarcodeRow() {
- m_output.RemoveAll();
- m_row.RemoveAll();
-}
-void CBC_BarcodeRow::set(int32_t x, uint8_t value) {
- m_row.SetAt(x, value);
-}
-void CBC_BarcodeRow::set(int32_t x, bool black) {
- m_row.SetAt(x, (uint8_t)(black ? 1 : 0));
-}
-void CBC_BarcodeRow::addBar(bool black, int32_t width) {
- for (int32_t ii = 0; ii < width; ii++) {
- set(m_currentLocation++, black);
- }
-}
-CFX_ArrayTemplate<uint8_t>& CBC_BarcodeRow::getRow() {
- return m_row;
-}
-CFX_ArrayTemplate<uint8_t>& CBC_BarcodeRow::getScaledRow(int32_t scale) {
- m_output.SetSize(m_row.GetSize() * scale);
- for (int32_t i = 0; i < m_output.GetSize(); i++) {
- m_output[i] = (m_row[i / scale]);
- }
- return m_output;
-}
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/pdf417/BC_PDF417BarcodeRow.h b/chromium/third_party/pdfium/xfa/fxbarcode/pdf417/BC_PDF417BarcodeRow.h
deleted file mode 100644
index 7d9d19cb561..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/pdf417/BC_PDF417BarcodeRow.h
+++ /dev/null
@@ -1,29 +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 XFA_FXBARCODE_PDF417_BC_PDF417BARCODEROW_H_
-#define XFA_FXBARCODE_PDF417_BC_PDF417BARCODEROW_H_
-
-#include "core/fxcrt/fx_basic.h"
-
-class CBC_BarcodeRow {
- public:
- explicit CBC_BarcodeRow(int32_t width);
- virtual ~CBC_BarcodeRow();
-
- void set(int32_t x, uint8_t value);
- void set(int32_t x, bool black);
- void addBar(bool black, int32_t width);
- CFX_ArrayTemplate<uint8_t>& getRow();
- CFX_ArrayTemplate<uint8_t>& getScaledRow(int32_t scale);
-
- private:
- CFX_ArrayTemplate<uint8_t> m_row;
- CFX_ArrayTemplate<uint8_t> m_output;
- int32_t m_currentLocation;
-};
-
-#endif // XFA_FXBARCODE_PDF417_BC_PDF417BARCODEROW_H_
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/pdf417/BC_PDF417Compaction.cpp b/chromium/third_party/pdfium/xfa/fxbarcode/pdf417/BC_PDF417Compaction.cpp
deleted file mode 100644
index d3a1663eb67..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/pdf417/BC_PDF417Compaction.cpp
+++ /dev/null
@@ -1,26 +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
-// Original code is licensed as follows:
-/*
- * Copyright 2011 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "xfa/fxbarcode/pdf417/BC_PDF417Compaction.h"
-
-CBC_Compaction::CBC_Compaction() {}
-CBC_Compaction::~CBC_Compaction() {}
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/pdf417/BC_PDF417Compaction.h b/chromium/third_party/pdfium/xfa/fxbarcode/pdf417/BC_PDF417Compaction.h
deleted file mode 100644
index 2df0fce3033..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/pdf417/BC_PDF417Compaction.h
+++ /dev/null
@@ -1,18 +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 XFA_FXBARCODE_PDF417_BC_PDF417COMPACTION_H_
-#define XFA_FXBARCODE_PDF417_BC_PDF417COMPACTION_H_
-
-class CBC_Compaction;
-enum Compaction { AUTO, TEXT, BYTES, NUMERIC };
-class CBC_Compaction {
- public:
- CBC_Compaction();
- virtual ~CBC_Compaction();
-};
-
-#endif // XFA_FXBARCODE_PDF417_BC_PDF417COMPACTION_H_
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/pdf417/BC_PDF417ErrorCorrection.cpp b/chromium/third_party/pdfium/xfa/fxbarcode/pdf417/BC_PDF417ErrorCorrection.cpp
deleted file mode 100644
index bdec4039705..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/pdf417/BC_PDF417ErrorCorrection.cpp
+++ /dev/null
@@ -1,191 +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
-// Original code is licensed as follows:
-/*
- * Copyright 2006 Jeremias Maerki in part, and ZXing Authors in part
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "xfa/fxbarcode/pdf417/BC_PDF417ErrorCorrection.h"
-#include "xfa/fxbarcode/utils.h"
-
-namespace {
-
-const uint16_t EC_LEVEL_0_COEFFICIENTS[2] = {27, 917};
-const uint16_t EC_LEVEL_1_COEFFICIENTS[4] = {522, 568, 723, 809};
-const uint16_t EC_LEVEL_2_COEFFICIENTS[8] = {237, 308, 436, 284,
- 646, 653, 428, 379};
-
-const uint16_t EC_LEVEL_3_COEFFICIENTS[16] = {274, 562, 232, 755, 599, 524,
- 801, 132, 295, 116, 442, 428,
- 295, 42, 176, 65};
-
-const uint16_t EC_LEVEL_4_COEFFICIENTS[32] = {
- 361, 575, 922, 525, 176, 586, 640, 321, 536, 742, 677,
- 742, 687, 284, 193, 517, 273, 494, 263, 147, 593, 800,
- 571, 320, 803, 133, 231, 390, 685, 330, 63, 410};
-
-const uint16_t EC_LEVEL_5_COEFFICIENTS[64] = {
- 539, 422, 6, 93, 862, 771, 453, 106, 610, 287, 107, 505, 733,
- 877, 381, 612, 723, 476, 462, 172, 430, 609, 858, 822, 543, 376,
- 511, 400, 672, 762, 283, 184, 440, 35, 519, 31, 460, 594, 225,
- 535, 517, 352, 605, 158, 651, 201, 488, 502, 648, 733, 717, 83,
- 404, 97, 280, 771, 840, 629, 4, 381, 843, 623, 264, 543};
-
-const uint16_t EC_LEVEL_6_COEFFICIENTS[128] = {
- 521, 310, 864, 547, 858, 580, 296, 379, 53, 779, 897, 444, 400, 925, 749,
- 415, 822, 93, 217, 208, 928, 244, 583, 620, 246, 148, 447, 631, 292, 908,
- 490, 704, 516, 258, 457, 907, 594, 723, 674, 292, 272, 96, 684, 432, 686,
- 606, 860, 569, 193, 219, 129, 186, 236, 287, 192, 775, 278, 173, 40, 379,
- 712, 463, 646, 776, 171, 491, 297, 763, 156, 732, 95, 270, 447, 90, 507,
- 48, 228, 821, 808, 898, 784, 663, 627, 378, 382, 262, 380, 602, 754, 336,
- 89, 614, 87, 432, 670, 616, 157, 374, 242, 726, 600, 269, 375, 898, 845,
- 454, 354, 130, 814, 587, 804, 34, 211, 330, 539, 297, 827, 865, 37, 517,
- 834, 315, 550, 86, 801, 4, 108, 539};
-
-const uint16_t EC_LEVEL_7_COEFFICIENTS[256] = {
- 524, 894, 75, 766, 882, 857, 74, 204, 82, 586, 708, 250, 905, 786, 138,
- 720, 858, 194, 311, 913, 275, 190, 375, 850, 438, 733, 194, 280, 201, 280,
- 828, 757, 710, 814, 919, 89, 68, 569, 11, 204, 796, 605, 540, 913, 801,
- 700, 799, 137, 439, 418, 592, 668, 353, 859, 370, 694, 325, 240, 216, 257,
- 284, 549, 209, 884, 315, 70, 329, 793, 490, 274, 877, 162, 749, 812, 684,
- 461, 334, 376, 849, 521, 307, 291, 803, 712, 19, 358, 399, 908, 103, 511,
- 51, 8, 517, 225, 289, 470, 637, 731, 66, 255, 917, 269, 463, 830, 730,
- 433, 848, 585, 136, 538, 906, 90, 2, 290, 743, 199, 655, 903, 329, 49,
- 802, 580, 355, 588, 188, 462, 10, 134, 628, 320, 479, 130, 739, 71, 263,
- 318, 374, 601, 192, 605, 142, 673, 687, 234, 722, 384, 177, 752, 607, 640,
- 455, 193, 689, 707, 805, 641, 48, 60, 732, 621, 895, 544, 261, 852, 655,
- 309, 697, 755, 756, 60, 231, 773, 434, 421, 726, 528, 503, 118, 49, 795,
- 32, 144, 500, 238, 836, 394, 280, 566, 319, 9, 647, 550, 73, 914, 342,
- 126, 32, 681, 331, 792, 620, 60, 609, 441, 180, 791, 893, 754, 605, 383,
- 228, 749, 760, 213, 54, 297, 134, 54, 834, 299, 922, 191, 910, 532, 609,
- 829, 189, 20, 167, 29, 872, 449, 83, 402, 41, 656, 505, 579, 481, 173,
- 404, 251, 688, 95, 497, 555, 642, 543, 307, 159, 924, 558, 648, 55, 497,
- 10};
-
-const uint16_t EC_LEVEL_8_COEFFICIENTS[512] = {
- 352, 77, 373, 504, 35, 599, 428, 207, 409, 574, 118, 498, 285, 380, 350,
- 492, 197, 265, 920, 155, 914, 299, 229, 643, 294, 871, 306, 88, 87, 193,
- 352, 781, 846, 75, 327, 520, 435, 543, 203, 666, 249, 346, 781, 621, 640,
- 268, 794, 534, 539, 781, 408, 390, 644, 102, 476, 499, 290, 632, 545, 37,
- 858, 916, 552, 41, 542, 289, 122, 272, 383, 800, 485, 98, 752, 472, 761,
- 107, 784, 860, 658, 741, 290, 204, 681, 407, 855, 85, 99, 62, 482, 180,
- 20, 297, 451, 593, 913, 142, 808, 684, 287, 536, 561, 76, 653, 899, 729,
- 567, 744, 390, 513, 192, 516, 258, 240, 518, 794, 395, 768, 848, 51, 610,
- 384, 168, 190, 826, 328, 596, 786, 303, 570, 381, 415, 641, 156, 237, 151,
- 429, 531, 207, 676, 710, 89, 168, 304, 402, 40, 708, 575, 162, 864, 229,
- 65, 861, 841, 512, 164, 477, 221, 92, 358, 785, 288, 357, 850, 836, 827,
- 736, 707, 94, 8, 494, 114, 521, 2, 499, 851, 543, 152, 729, 771, 95,
- 248, 361, 578, 323, 856, 797, 289, 51, 684, 466, 533, 820, 669, 45, 902,
- 452, 167, 342, 244, 173, 35, 463, 651, 51, 699, 591, 452, 578, 37, 124,
- 298, 332, 552, 43, 427, 119, 662, 777, 475, 850, 764, 364, 578, 911, 283,
- 711, 472, 420, 245, 288, 594, 394, 511, 327, 589, 777, 699, 688, 43, 408,
- 842, 383, 721, 521, 560, 644, 714, 559, 62, 145, 873, 663, 713, 159, 672,
- 729, 624, 59, 193, 417, 158, 209, 563, 564, 343, 693, 109, 608, 563, 365,
- 181, 772, 677, 310, 248, 353, 708, 410, 579, 870, 617, 841, 632, 860, 289,
- 536, 35, 777, 618, 586, 424, 833, 77, 597, 346, 269, 757, 632, 695, 751,
- 331, 247, 184, 45, 787, 680, 18, 66, 407, 369, 54, 492, 228, 613, 830,
- 922, 437, 519, 644, 905, 789, 420, 305, 441, 207, 300, 892, 827, 141, 537,
- 381, 662, 513, 56, 252, 341, 242, 797, 838, 837, 720, 224, 307, 631, 61,
- 87, 560, 310, 756, 665, 397, 808, 851, 309, 473, 795, 378, 31, 647, 915,
- 459, 806, 590, 731, 425, 216, 548, 249, 321, 881, 699, 535, 673, 782, 210,
- 815, 905, 303, 843, 922, 281, 73, 469, 791, 660, 162, 498, 308, 155, 422,
- 907, 817, 187, 62, 16, 425, 535, 336, 286, 437, 375, 273, 610, 296, 183,
- 923, 116, 667, 751, 353, 62, 366, 691, 379, 687, 842, 37, 357, 720, 742,
- 330, 5, 39, 923, 311, 424, 242, 749, 321, 54, 669, 316, 342, 299, 534,
- 105, 667, 488, 640, 672, 576, 540, 316, 486, 721, 610, 46, 656, 447, 171,
- 616, 464, 190, 531, 297, 321, 762, 752, 533, 175, 134, 14, 381, 433, 717,
- 45, 111, 20, 596, 284, 736, 138, 646, 411, 877, 669, 141, 919, 45, 780,
- 407, 164, 332, 899, 165, 726, 600, 325, 498, 655, 357, 752, 768, 223, 849,
- 647, 63, 310, 863, 251, 366, 304, 282, 738, 675, 410, 389, 244, 31, 121,
- 303, 263};
-
-const uint16_t* const EC_COEFFICIENTS[9] = {
- EC_LEVEL_0_COEFFICIENTS, EC_LEVEL_1_COEFFICIENTS, EC_LEVEL_2_COEFFICIENTS,
- EC_LEVEL_3_COEFFICIENTS, EC_LEVEL_4_COEFFICIENTS, EC_LEVEL_5_COEFFICIENTS,
- EC_LEVEL_6_COEFFICIENTS, EC_LEVEL_7_COEFFICIENTS, EC_LEVEL_8_COEFFICIENTS};
-
-} // namespace
-
-CBC_PDF417ErrorCorrection::CBC_PDF417ErrorCorrection() {}
-CBC_PDF417ErrorCorrection::~CBC_PDF417ErrorCorrection() {}
-int32_t CBC_PDF417ErrorCorrection::getErrorCorrectionCodewordCount(
- int32_t errorCorrectionLevel,
- int32_t& e) {
- if (errorCorrectionLevel < 0 || errorCorrectionLevel > 8) {
- e = BCExceptionErrorCorrectionLevelMustBeBetween0And8;
- return -1;
- }
- return 1 << (errorCorrectionLevel + 1);
-}
-
-int32_t CBC_PDF417ErrorCorrection::getRecommendedMinimumErrorCorrectionLevel(
- int32_t n,
- int32_t& e) {
- if (n <= 0) {
- e = BCExceptionIllegalArgumentnMustBeAbove0;
- return -1;
- }
- if (n <= 40) {
- return 2;
- }
- if (n <= 160) {
- return 3;
- }
- if (n <= 320) {
- return 4;
- }
- if (n <= 863) {
- return 5;
- }
- e = BCExceptionNoRecommendationPossible;
- return -1;
-}
-
-CFX_WideString CBC_PDF417ErrorCorrection::generateErrorCorrection(
- CFX_WideString dataCodewords,
- int32_t errorCorrectionLevel,
- int32_t& e) {
- int32_t k = getErrorCorrectionCodewordCount(errorCorrectionLevel, e);
- if (e != BCExceptionNO)
- return L" ";
- FX_WCHAR* ech = FX_Alloc(FX_WCHAR, k);
- FXSYS_memset(ech, 0, k * sizeof(FX_WCHAR));
- int32_t sld = dataCodewords.GetLength();
- for (int32_t i = 0; i < sld; i++) {
- int32_t t1 = (dataCodewords.GetAt(i) + ech[k - 1]) % 929;
- int32_t t2;
- int32_t t3;
- for (int32_t j = k - 1; j >= 1; j--) {
- t2 = (t1 * EC_COEFFICIENTS[errorCorrectionLevel][j]) % 929;
- t3 = 929 - t2;
- ech[j] = (FX_WCHAR)((ech[j - 1] + t3) % 929);
- }
- t2 = (t1 * EC_COEFFICIENTS[errorCorrectionLevel][0]) % 929;
- t3 = 929 - t2;
- ech[0] = (FX_WCHAR)(t3 % 929);
- }
- CFX_WideString sb;
- for (int32_t j = k - 1; j >= 0; j--) {
- if (ech[j] != 0) {
- ech[j] = (FX_WCHAR)(929 - ech[j]);
- }
- sb += (FX_WCHAR)ech[j];
- }
- FX_Free(ech);
- return sb;
-}
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/pdf417/BC_PDF417ErrorCorrection.h b/chromium/third_party/pdfium/xfa/fxbarcode/pdf417/BC_PDF417ErrorCorrection.h
deleted file mode 100644
index 6822ae4e114..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/pdf417/BC_PDF417ErrorCorrection.h
+++ /dev/null
@@ -1,28 +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 XFA_FXBARCODE_PDF417_BC_PDF417ERRORCORRECTION_H_
-#define XFA_FXBARCODE_PDF417_BC_PDF417ERRORCORRECTION_H_
-
-#include <stdint.h>
-
-#include "core/fxcrt/fx_string.h"
-
-class CBC_PDF417ErrorCorrection {
- public:
- CBC_PDF417ErrorCorrection();
- virtual ~CBC_PDF417ErrorCorrection();
-
- static int32_t getErrorCorrectionCodewordCount(int32_t errorCorrectionLevel,
- int32_t& e);
- static int32_t getRecommendedMinimumErrorCorrectionLevel(int32_t n,
- int32_t& e);
- static CFX_WideString generateErrorCorrection(CFX_WideString dataCodewords,
- int32_t errorCorrectionLevel,
- int32_t& e);
-};
-
-#endif // XFA_FXBARCODE_PDF417_BC_PDF417ERRORCORRECTION_H_
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp b/chromium/third_party/pdfium/xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp
deleted file mode 100644
index 08a40c51b3b..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp
+++ /dev/null
@@ -1,430 +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
-// Original code is licensed as follows:
-/*
- * Copyright 2006 Jeremias Maerki in part, and ZXing Authors in part
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h"
-
-#include "third_party/bigint/BigIntegerLibrary.hh"
-#include "xfa/fxbarcode/BC_UtilCodingConvert.h"
-#include "xfa/fxbarcode/pdf417/BC_PDF417Compaction.h"
-#include "xfa/fxbarcode/utils.h"
-
-#define SUBMODE_ALPHA 0
-#define SUBMODE_LOWER 1
-#define SUBMODE_MIXED 2
-
-int32_t CBC_PDF417HighLevelEncoder::TEXT_COMPACTION = 0;
-int32_t CBC_PDF417HighLevelEncoder::BYTE_COMPACTION = 1;
-int32_t CBC_PDF417HighLevelEncoder::NUMERIC_COMPACTION = 2;
-int32_t CBC_PDF417HighLevelEncoder::SUBMODE_PUNCTUATION = 3;
-int32_t CBC_PDF417HighLevelEncoder::LATCH_TO_TEXT = 900;
-int32_t CBC_PDF417HighLevelEncoder::LATCH_TO_BYTE_PADDED = 901;
-int32_t CBC_PDF417HighLevelEncoder::LATCH_TO_NUMERIC = 902;
-int32_t CBC_PDF417HighLevelEncoder::SHIFT_TO_BYTE = 913;
-int32_t CBC_PDF417HighLevelEncoder::LATCH_TO_BYTE = 924;
-uint8_t CBC_PDF417HighLevelEncoder::TEXT_MIXED_RAW[] = {
- 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 38, 13, 9, 44, 58,
- 35, 45, 46, 36, 47, 43, 37, 42, 61, 94, 0, 32, 0, 0, 0};
-uint8_t CBC_PDF417HighLevelEncoder::TEXT_PUNCTUATION_RAW[] = {
- 59, 60, 62, 64, 91, 92, 93, 95, 96, 126, 33, 13, 9, 44, 58,
- 10, 45, 46, 36, 47, 34, 124, 42, 40, 41, 63, 123, 125, 39, 0};
-int32_t CBC_PDF417HighLevelEncoder::MIXED[128] = {0};
-int32_t CBC_PDF417HighLevelEncoder::PUNCTUATION[128] = {0};
-
-void CBC_PDF417HighLevelEncoder::Initialize() {
- Inverse();
-}
-
-void CBC_PDF417HighLevelEncoder::Finalize() {}
-
-CFX_WideString CBC_PDF417HighLevelEncoder::encodeHighLevel(
- CFX_WideString wideMsg,
- Compaction compaction,
- int32_t& e) {
- CFX_ByteString bytes;
- CBC_UtilCodingConvert::UnicodeToUTF8(wideMsg, bytes);
- CFX_WideString msg;
- int32_t len = bytes.GetLength();
- for (int32_t i = 0; i < len; i++) {
- FX_WCHAR ch = (FX_WCHAR)(bytes.GetAt(i) & 0xff);
- if (ch == '?' && bytes.GetAt(i) != '?') {
- e = BCExceptionCharactersOutsideISO88591Encoding;
- return CFX_WideString();
- }
- msg += ch;
- }
- CFX_ArrayTemplate<uint8_t> byteArr;
- for (int32_t k = 0; k < bytes.GetLength(); k++) {
- byteArr.Add(bytes.GetAt(k));
- }
- CFX_WideString sb;
- len = msg.GetLength();
- int32_t p = 0;
- int32_t textSubMode = SUBMODE_ALPHA;
- if (compaction == TEXT) {
- encodeText(msg, p, len, sb, textSubMode);
- } else if (compaction == BYTES) {
- encodeBinary(&byteArr, p, byteArr.GetSize(), BYTE_COMPACTION, sb);
- } else if (compaction == NUMERIC) {
- sb += (FX_WCHAR)LATCH_TO_NUMERIC;
- encodeNumeric(msg, p, len, sb);
- } else {
- int32_t encodingMode = LATCH_TO_TEXT;
- while (p < len) {
- int32_t n = determineConsecutiveDigitCount(msg, p);
- if (n >= 13) {
- sb += (FX_WCHAR)LATCH_TO_NUMERIC;
- encodingMode = NUMERIC_COMPACTION;
- textSubMode = SUBMODE_ALPHA;
- encodeNumeric(msg, p, n, sb);
- p += n;
- } else {
- int32_t t = determineConsecutiveTextCount(msg, p);
- if (t >= 5 || n == len) {
- if (encodingMode != TEXT_COMPACTION) {
- sb += (FX_WCHAR)LATCH_TO_TEXT;
- encodingMode = TEXT_COMPACTION;
- textSubMode = SUBMODE_ALPHA;
- }
- textSubMode = encodeText(msg, p, t, sb, textSubMode);
- p += t;
- } else {
- int32_t b = determineConsecutiveBinaryCount(msg, &byteArr, p, e);
- if (e != BCExceptionNO)
- return L" ";
- if (b == 0) {
- b = 1;
- }
- if (b == 1 && encodingMode == TEXT_COMPACTION) {
- encodeBinary(&byteArr, p, 1, TEXT_COMPACTION, sb);
- } else {
- encodeBinary(&byteArr, p, b, encodingMode, sb);
- encodingMode = BYTE_COMPACTION;
- textSubMode = SUBMODE_ALPHA;
- }
- p += b;
- }
- }
- }
- }
- return sb;
-}
-
-void CBC_PDF417HighLevelEncoder::Inverse() {
- for (size_t l = 0; l < FX_ArraySize(MIXED); ++l)
- MIXED[l] = -1;
-
- for (uint8_t i = 0; i < FX_ArraySize(TEXT_MIXED_RAW); ++i) {
- uint8_t b = TEXT_MIXED_RAW[i];
- if (b != 0)
- MIXED[b] = i;
- }
-
- for (size_t l = 0; l < FX_ArraySize(PUNCTUATION); ++l)
- PUNCTUATION[l] = -1;
-
- for (uint8_t i = 0; i < FX_ArraySize(TEXT_PUNCTUATION_RAW); ++i) {
- uint8_t b = TEXT_PUNCTUATION_RAW[i];
- if (b != 0)
- PUNCTUATION[b] = i;
- }
-}
-
-int32_t CBC_PDF417HighLevelEncoder::encodeText(CFX_WideString msg,
- int32_t startpos,
- int32_t count,
- CFX_WideString& sb,
- int32_t initialSubmode) {
- CFX_WideString tmp;
- int32_t submode = initialSubmode;
- int32_t idx = 0;
- while (true) {
- FX_WCHAR ch = msg.GetAt(startpos + idx);
- switch (submode) {
- case SUBMODE_ALPHA:
- if (isAlphaUpper(ch)) {
- if (ch == ' ') {
- tmp += (FX_WCHAR)26;
- } else {
- tmp += (FX_WCHAR)(ch - 65);
- }
- } else {
- if (isAlphaLower(ch)) {
- submode = SUBMODE_LOWER;
- tmp += (FX_WCHAR)27;
- continue;
- } else if (isMixed(ch)) {
- submode = SUBMODE_MIXED;
- tmp += (FX_WCHAR)28;
- continue;
- } else {
- tmp += (FX_WCHAR)29;
- tmp += PUNCTUATION[ch];
- break;
- }
- }
- break;
- case SUBMODE_LOWER:
- if (isAlphaLower(ch)) {
- if (ch == ' ') {
- tmp += (FX_WCHAR)26;
- } else {
- tmp += (FX_WCHAR)(ch - 97);
- }
- } else {
- if (isAlphaUpper(ch)) {
- tmp += (FX_WCHAR)27;
- tmp += (FX_WCHAR)(ch - 65);
- break;
- } else if (isMixed(ch)) {
- submode = SUBMODE_MIXED;
- tmp += (FX_WCHAR)28;
- continue;
- } else {
- tmp += (FX_WCHAR)29;
- tmp += PUNCTUATION[ch];
- break;
- }
- }
- break;
- case SUBMODE_MIXED:
- if (isMixed(ch)) {
- tmp += MIXED[ch];
- } else {
- if (isAlphaUpper(ch)) {
- submode = SUBMODE_ALPHA;
- tmp += (FX_WCHAR)28;
- continue;
- } else if (isAlphaLower(ch)) {
- submode = SUBMODE_LOWER;
- tmp += (FX_WCHAR)27;
- continue;
- } else {
- if (startpos + idx + 1 < count) {
- FX_WCHAR next = msg.GetAt(startpos + idx + 1);
- if (isPunctuation(next)) {
- submode = SUBMODE_PUNCTUATION;
- tmp += (FX_WCHAR)25;
- continue;
- }
- }
- tmp += (FX_WCHAR)29;
- tmp += PUNCTUATION[ch];
- }
- }
- break;
- default:
- if (isPunctuation(ch)) {
- tmp += PUNCTUATION[ch];
- } else {
- submode = SUBMODE_ALPHA;
- tmp += (FX_WCHAR)29;
- continue;
- }
- }
- idx++;
- if (idx >= count) {
- break;
- }
- }
- FX_WCHAR h = 0;
- int32_t len = tmp.GetLength();
- for (int32_t i = 0; i < len; i++) {
- bool odd = (i % 2) != 0;
- if (odd) {
- h = (FX_WCHAR)((h * 30) + tmp.GetAt(i));
- sb += h;
- } else {
- h = tmp.GetAt(i);
- }
- }
- if ((len % 2) != 0) {
- sb += (FX_WCHAR)((h * 30) + 29);
- }
- return submode;
-}
-void CBC_PDF417HighLevelEncoder::encodeBinary(CFX_ArrayTemplate<uint8_t>* bytes,
- int32_t startpos,
- int32_t count,
- int32_t startmode,
- CFX_WideString& sb) {
- if (count == 1 && startmode == TEXT_COMPACTION) {
- sb += (FX_WCHAR)SHIFT_TO_BYTE;
- }
- int32_t idx = startpos;
- int32_t i = 0;
- if (count >= 6) {
- sb += (FX_WCHAR)LATCH_TO_BYTE;
- FX_WCHAR chars[5];
- while ((startpos + count - idx) >= 6) {
- int64_t t = 0;
- for (i = 0; i < 6; i++) {
- t <<= 8;
- t += bytes->GetAt(idx + i) & 0xff;
- }
- for (i = 0; i < 5; i++) {
- chars[i] = (FX_WCHAR)(t % 900);
- t /= 900;
- }
- for (i = 4; i >= 0; i--) {
- sb += (chars[i]);
- }
- idx += 6;
- }
- }
- if (idx < startpos + count) {
- sb += (FX_WCHAR)LATCH_TO_BYTE_PADDED;
- }
- for (i = idx; i < startpos + count; i++) {
- int32_t ch = bytes->GetAt(i) & 0xff;
- sb += (FX_WCHAR)ch;
- }
-}
-void CBC_PDF417HighLevelEncoder::encodeNumeric(CFX_WideString msg,
- int32_t startpos,
- int32_t count,
- CFX_WideString& sb) {
- int32_t idx = 0;
- BigInteger num900 = 900;
- while (idx < count) {
- CFX_WideString tmp;
- int32_t len = 44 < count - idx ? 44 : count - idx;
- CFX_ByteString part =
- ((FX_WCHAR)'1' + msg.Mid(startpos + idx, len)).UTF8Encode();
- BigInteger bigint = stringToBigInteger(part.c_str());
- do {
- int32_t c = (bigint % num900).toInt();
- tmp += (FX_WCHAR)(c);
- bigint = bigint / num900;
- } while (!bigint.isZero());
- for (int32_t i = tmp.GetLength() - 1; i >= 0; i--) {
- sb += tmp.GetAt(i);
- }
- idx += len;
- }
-}
-bool CBC_PDF417HighLevelEncoder::isDigit(FX_WCHAR ch) {
- return ch >= '0' && ch <= '9';
-}
-bool CBC_PDF417HighLevelEncoder::isAlphaUpper(FX_WCHAR ch) {
- return ch == ' ' || (ch >= 'A' && ch <= 'Z');
-}
-bool CBC_PDF417HighLevelEncoder::isAlphaLower(FX_WCHAR ch) {
- return ch == ' ' || (ch >= 'a' && ch <= 'z');
-}
-bool CBC_PDF417HighLevelEncoder::isMixed(FX_WCHAR ch) {
- return MIXED[ch] != -1;
-}
-bool CBC_PDF417HighLevelEncoder::isPunctuation(FX_WCHAR ch) {
- return PUNCTUATION[ch] != -1;
-}
-bool CBC_PDF417HighLevelEncoder::isText(FX_WCHAR ch) {
- return ch == '\t' || ch == '\n' || ch == '\r' || (ch >= 32 && ch <= 126);
-}
-int32_t CBC_PDF417HighLevelEncoder::determineConsecutiveDigitCount(
- CFX_WideString msg,
- int32_t startpos) {
- int32_t count = 0;
- int32_t len = msg.GetLength();
- int32_t idx = startpos;
- if (idx < len) {
- FX_WCHAR ch = msg.GetAt(idx);
- while (isDigit(ch) && idx < len) {
- count++;
- idx++;
- if (idx < len) {
- ch = msg.GetAt(idx);
- }
- }
- }
- return count;
-}
-int32_t CBC_PDF417HighLevelEncoder::determineConsecutiveTextCount(
- CFX_WideString msg,
- int32_t startpos) {
- int32_t len = msg.GetLength();
- int32_t idx = startpos;
- while (idx < len) {
- FX_WCHAR ch = msg.GetAt(idx);
- int32_t numericCount = 0;
- while (numericCount < 13 && isDigit(ch) && idx < len) {
- numericCount++;
- idx++;
- if (idx < len) {
- ch = msg.GetAt(idx);
- }
- }
- if (numericCount >= 13) {
- return idx - startpos - numericCount;
- }
- if (numericCount > 0) {
- continue;
- }
- ch = msg.GetAt(idx);
- if (!isText(ch)) {
- break;
- }
- idx++;
- }
- return idx - startpos;
-}
-int32_t CBC_PDF417HighLevelEncoder::determineConsecutiveBinaryCount(
- CFX_WideString msg,
- CFX_ArrayTemplate<uint8_t>* bytes,
- int32_t startpos,
- int32_t& e) {
- int32_t len = msg.GetLength();
- int32_t idx = startpos;
- while (idx < len) {
- FX_WCHAR ch = msg.GetAt(idx);
- int32_t numericCount = 0;
- while (numericCount < 13 && isDigit(ch)) {
- numericCount++;
- int32_t i = idx + numericCount;
- if (i >= len) {
- break;
- }
- ch = msg.GetAt(i);
- }
- if (numericCount >= 13) {
- return idx - startpos;
- }
- int32_t textCount = 0;
- while (textCount < 5 && isText(ch)) {
- textCount++;
- int32_t i = idx + textCount;
- if (i >= len) {
- break;
- }
- ch = msg.GetAt(i);
- }
- if (textCount >= 5) {
- return idx - startpos;
- }
- ch = msg.GetAt(idx);
- if (bytes->GetAt(idx) == 63 && ch != '?') {
- e = BCExceptionNonEncodableCharacterDetected;
- return -1;
- }
- idx++;
- }
- return idx - startpos;
-}
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h b/chromium/third_party/pdfium/xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h
deleted file mode 100644
index 38382c891c4..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h
+++ /dev/null
@@ -1,75 +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 XFA_FXBARCODE_PDF417_BC_PDF417HIGHLEVELENCODER_H_
-#define XFA_FXBARCODE_PDF417_BC_PDF417HIGHLEVELENCODER_H_
-
-#include "core/fxcrt/fx_basic.h"
-#include "core/fxcrt/fx_string.h"
-#include "xfa/fxbarcode/pdf417/BC_PDF417Compaction.h"
-
-class CBC_PDF417HighLevelEncoder {
- public:
- static CFX_WideString encodeHighLevel(CFX_WideString msg,
- Compaction compaction,
- int32_t& e);
- static void Inverse();
- static void Initialize();
- static void Finalize();
-
- private:
- static int32_t TEXT_COMPACTION;
- static int32_t BYTE_COMPACTION;
- static int32_t NUMERIC_COMPACTION;
- static int32_t SUBMODE_PUNCTUATION;
- static int32_t LATCH_TO_TEXT;
- static int32_t LATCH_TO_BYTE_PADDED;
- static int32_t LATCH_TO_NUMERIC;
- static int32_t SHIFT_TO_BYTE;
- static int32_t LATCH_TO_BYTE;
- static uint8_t TEXT_MIXED_RAW[];
- static uint8_t TEXT_PUNCTUATION_RAW[];
- static int32_t MIXED[128];
- static int32_t PUNCTUATION[128];
- static int32_t encodeText(CFX_WideString msg,
- int32_t startpos,
- int32_t count,
- CFX_WideString& sb,
- int32_t initialSubmode);
- static void encodeBinary(CFX_ArrayTemplate<uint8_t>* bytes,
- int32_t startpos,
- int32_t count,
- int32_t startmode,
- CFX_WideString& sb);
- static void encodeNumeric(CFX_WideString msg,
- int32_t startpos,
- int32_t count,
- CFX_WideString& sb);
- static bool isDigit(FX_WCHAR ch);
- static bool isAlphaUpper(FX_WCHAR ch);
- static bool isAlphaLower(FX_WCHAR ch);
- static bool isMixed(FX_WCHAR ch);
- static bool isPunctuation(FX_WCHAR ch);
- static bool isText(FX_WCHAR ch);
- static int32_t determineConsecutiveDigitCount(CFX_WideString msg,
- int32_t startpos);
- static int32_t determineConsecutiveTextCount(CFX_WideString msg,
- int32_t startpos);
- static int32_t determineConsecutiveBinaryCount(
- CFX_WideString msg,
- CFX_ArrayTemplate<uint8_t>* bytes,
- int32_t startpos,
- int32_t& e);
-
- friend class PDF417HighLevelEncoder_EncodeNumeric_Test;
- friend class PDF417HighLevelEncoder_EncodeBinary_Test;
- friend class PDF417HighLevelEncoder_EncodeText_Test;
- friend class PDF417HighLevelEncoder_ConsecutiveDigitCount_Test;
- friend class PDF417HighLevelEncoder_ConsecutiveTextCount_Test;
- friend class PDF417HighLevelEncoder_ConsecutiveBinaryCount_Test;
-};
-
-#endif // XFA_FXBARCODE_PDF417_BC_PDF417HIGHLEVELENCODER_H_
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder_unittest.cpp b/chromium/third_party/pdfium/xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder_unittest.cpp
deleted file mode 100644
index 2cd60fef413..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder_unittest.cpp
+++ /dev/null
@@ -1,231 +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.
-
-#include "core/fxcrt/fx_basic.h"
-#include "testing/fx_string_testhelpers.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h"
-
-TEST(PDF417HighLevelEncoder, EncodeHighLevel) {
- // TODO(tsepez): implement test cases.
-}
-
-TEST(PDF417HighLevelEncoder, EncodeText) {
- // TODO(tsepez): implement test cases.
-}
-
-TEST(PDF417HighLevelEncoder, EncodeBinary) {
- struct EncodeBinaryCase {
- const char* input;
- int offset;
- int count;
- int startmode;
- const wchar_t* expected;
- int expected_length;
- } encode_binary_cases[] = {
- // Empty string encodes as empty string.
- {"", 0, 0, CBC_PDF417HighLevelEncoder::TEXT_COMPACTION, L"", 0},
-
- // Fewer than 6 characters encodes as prefix without compaction.
- {"xxxxx", 0, 5, CBC_PDF417HighLevelEncoder::TEXT_COMPACTION,
- L"\x0385xxxxx", 6},
-
- // 6 charcters triggerst text encoding compaction.
- {"xxxxxx", 0, 6, CBC_PDF417HighLevelEncoder::TEXT_COMPACTION,
- L"\u039c\u00c9\u031f\u012a\u00d2\u02d0", 6},
-
- // Same result if initially in numeric compaction mode.
- {"xxxxxx", 0, 6, CBC_PDF417HighLevelEncoder::NUMERIC_COMPACTION,
- L"\u039c\u00c9\u031f\u012a\u00d2\u02d0", 6},
- };
-
- CBC_PDF417HighLevelEncoder::Initialize();
- for (size_t i = 0; i < FX_ArraySize(encode_binary_cases); ++i) {
- EncodeBinaryCase* ptr = &encode_binary_cases[i];
- CFX_ArrayTemplate<uint8_t> input_array;
- size_t input_length = strlen(ptr->input);
- input_array.SetSize(input_length);
- for (size_t j = 0; j < input_length; ++j) {
- input_array.SetAt(j, ptr->input[j]);
- }
- CFX_WideString expected(ptr->expected, ptr->expected_length);
- CFX_WideString result;
- CBC_PDF417HighLevelEncoder::encodeBinary(
- &input_array, ptr->offset, ptr->count, ptr->startmode, result);
- EXPECT_EQ(expected, result) << " for case number " << i;
- }
- CBC_PDF417HighLevelEncoder::Finalize();
-}
-
-TEST(PDF417HighLevelEncoder, EncodeNumeric) {
- struct EncodeNumericCase {
- const wchar_t* input;
- int offset;
- int count;
- const wchar_t* expected;
- int expected_length;
- } encode_numeric_cases[] = {
- // Empty string encodes as empty string.
- {L"", 0, 0, L"", 0},
-
- // Single 0 should encode as 10 base-900 == a.
- {L"0", 0, 1, L"\x000a", 1},
-
- // 800 should encode as 1800 base-900 == 2,0.
- {L"800", 0, 3, L"\x0002\x0000", 2},
-
- // Test longer strings and sub-strings.
- {L"123456", 0, 6, L"\x0001\x015c\x0100", 3},
- {L"123456", 0, 5, L"\x007c\x02e9", 2},
- {L"123456", 1, 5, L"\x0089\x009c", 2},
- {L"123456", 2, 2, L"\x0086", 1},
-
- // Up to 44 characters encodes as 15 base-900 words.
- {L"00000000000000000000000000000000000000000000", 0, 44,
- L"\x01b5\x006f\x02cc\x0084\x01bc\x0076\x00b3\x005c\x01f0\x034f\x01e6"
- L"\x0090\x020b\x019b\x0064",
- 15},
-
- // 45 characters should encode as same 15 words followed by one additional
- // word.
- {L"000000000000000000000000000000000000000000000", 0, 45,
- L"\x01b5\x006f\x02cc\x0084\x01bc\x0076\x00b3\x005c\x01f0\x034f\x01e6"
- L"\x0090\x020b\x019b\x0064\x000a",
- 16},
-
- // 44 characters followed by 800 should encode as 15 words followed by
- // 1800 base-900 == 2,0.
- {L"00000000000000000000000000000000000000000000800", 0, 47,
- L"\x01b5\x006f\x02cc\x0084\x01bc\x0076\x00b3\x005c\x01f0\x034f\x01e6"
- L"\x0090\x020b\x019b\x0064\x0002\x0000",
- 17},
-
- // Even longer input.
- {L"10000000000000000000000000000000000000000000000000", 0, 50,
- L"\x01e0\x02f0\x036d\x02ad\x029c\x01ea\x0011\x000b\x02d6\x023c\x0108"
- L"\x02bb\x0023\x02d2\x00c8\x0001\x00d3\x0064",
- 18},
- };
-
- CBC_PDF417HighLevelEncoder::Initialize();
- for (size_t i = 0; i < FX_ArraySize(encode_numeric_cases); ++i) {
- EncodeNumericCase* ptr = &encode_numeric_cases[i];
- CFX_WideString input(ptr->input);
- CFX_WideString expected(ptr->expected, ptr->expected_length);
- CFX_WideString result;
- CBC_PDF417HighLevelEncoder::encodeNumeric(input, ptr->offset, ptr->count,
- result);
- EXPECT_EQ(expected, result) << " for case number " << i;
- }
- CBC_PDF417HighLevelEncoder::Finalize();
-}
-
-TEST(PDF417HighLevelEncoder, ConsecutiveDigitCount) {
- struct ConsecutiveDigitCase {
- const wchar_t* input;
- int offset;
- int expected_count;
- } consecutive_digit_cases[] = {
- // Empty string contains 0 consecuitve digits.
- {L"", 0, 0},
-
- // Single non-digit character contains 0 consecutive digits.
- {L"X", 0, 0},
-
- // Leading non-digit followed by digits contains 0 consecutive.
- {L"X123", 0, 0},
-
- // Single digit contains 1 consecutive digit.
- {L"1", 0, 1},
-
- // Single digit followe by non-digit contains 1 consecutive digit.
- {L"1Z", 0, 1},
-
- // Test longer strings.
- {L"123FOO45678", 0, 3},
-
- // Test subtring starting in digits field.
- {L"123FOO45678", 3, 0},
-
- // Test subtring starting in non-digits field.
- {L"123FOO45678", 3, 0},
-
- // Test substring starting in digits field following non-digit field.
- {L"123FOO45678", 6, 5},
- };
-
- CBC_PDF417HighLevelEncoder::Initialize();
- for (size_t i = 0; i < FX_ArraySize(consecutive_digit_cases); ++i) {
- ConsecutiveDigitCase* ptr = &consecutive_digit_cases[i];
- CFX_WideString input(ptr->input);
- int actual_count =
- CBC_PDF417HighLevelEncoder::determineConsecutiveDigitCount(input,
- ptr->offset);
- EXPECT_EQ(ptr->expected_count, actual_count) << " for case number " << i;
- }
- CBC_PDF417HighLevelEncoder::Finalize();
-}
-
-TEST(PDF417HighLevelEncoder, ConsecutiveTextCount) {
- struct ConsecutiveTextCase {
- const wchar_t* input;
- int offset;
- int expected_count;
- } consecutive_text_cases[] = {
- // Empty string contains 0 consecutive text characters.
- {L"", 0, 0},
-
- // Single text character is 1 consecutive text characters.
- {L"X", 0, 1},
-
- // Trailing numbers count as text characters.
- {L"X123", 0, 4},
-
- // Leading numbers count as text characters.
- {L"123X", 0, 4},
-
- // Embedded lo-value binary characters terminate text runs.
- {L"ABC\x0001XXXX", 0, 3},
-
- // Embedded hi-value binary characters terminate text runs.
- {L"ABC\x0100XXXX", 0, 3},
-
- // Text run still found after indexing past lo-value character.
- {L"ABC\x0001XXXX", 4, 4},
-
- // Text run still found after indexing past hi-value character.
- {L"ABC\x0100XXXX", 4, 4},
-
- // Leading hi-value character results in 0 consecutive characters.
- {L"\x0100XXX", 0, 0},
-
- // Up to 12 numbers count as text.
- {L"123456789012", 0, 12},
-
- // 13 or more numbers are compresssed using numeric compression, not text.
- {L"1234567890123", 0, 0},
-
- // Leading Text character doesn't affect the 12 character case.
- {L"X123456789012", 0, 13},
-
- // Leading Text character doesn't affect the 13 character case.
- {L"X1234567890123", 0, 1},
-
- // Jumping between numbers and letters works properly.
- {L"XXX121XXX12345678901234", 0, 9},
- };
-
- CBC_PDF417HighLevelEncoder::Initialize();
- for (size_t i = 0; i < FX_ArraySize(consecutive_text_cases); ++i) {
- ConsecutiveTextCase* ptr = &consecutive_text_cases[i];
- CFX_WideString input(ptr->input);
- int actual_count =
- CBC_PDF417HighLevelEncoder::determineConsecutiveTextCount(input,
- ptr->offset);
- EXPECT_EQ(ptr->expected_count, actual_count) << " for case number " << i;
- }
- CBC_PDF417HighLevelEncoder::Finalize();
-}
-
-TEST(PDF417HighLevelEncoder, ConsecutiveBinaryCount) {}
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/pdf417/BC_PDF417Writer.cpp b/chromium/third_party/pdfium/xfa/fxbarcode/pdf417/BC_PDF417Writer.cpp
deleted file mode 100644
index 2c75a14a807..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/pdf417/BC_PDF417Writer.cpp
+++ /dev/null
@@ -1,116 +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
-// Original code is licensed as follows:
-/*
- * Copyright 2012 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "xfa/fxbarcode/BC_TwoDimWriter.h"
-#include "xfa/fxbarcode/common/BC_CommonBitArray.h"
-#include "xfa/fxbarcode/common/BC_CommonBitMatrix.h"
-#include "xfa/fxbarcode/pdf417/BC_PDF417.h"
-#include "xfa/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.h"
-#include "xfa/fxbarcode/pdf417/BC_PDF417Compaction.h"
-#include "xfa/fxbarcode/pdf417/BC_PDF417Writer.h"
-
-CBC_PDF417Writer::CBC_PDF417Writer() {
- m_bFixedSize = false;
-}
-CBC_PDF417Writer::~CBC_PDF417Writer() {
- m_bTruncated = true;
-}
-bool CBC_PDF417Writer::SetErrorCorrectionLevel(int32_t level) {
- if (level < 0 || level > 8) {
- return false;
- }
- m_iCorrectLevel = level;
- return true;
-}
-void CBC_PDF417Writer::SetTruncated(bool truncated) {
- m_bTruncated = truncated;
-}
-uint8_t* CBC_PDF417Writer::Encode(const CFX_WideString& contents,
- int32_t& outWidth,
- int32_t& outHeight,
- int32_t& e) {
- CBC_PDF417 encoder;
- int32_t col = (m_Width / m_ModuleWidth - 69) / 17;
- int32_t row = m_Height / (m_ModuleWidth * 20);
- if (row >= 3 && row <= 90 && col >= 1 && col <= 30) {
- encoder.setDimensions(col, col, row, row);
- } else if (col >= 1 && col <= 30) {
- encoder.setDimensions(col, col, 90, 3);
- } else if (row >= 3 && row <= 90) {
- encoder.setDimensions(30, 1, row, row);
- }
- encoder.generateBarcodeLogic(contents, m_iCorrectLevel, e);
- if (e != BCExceptionNO)
- return nullptr;
- int32_t lineThickness = 2;
- int32_t aspectRatio = 4;
- CBC_BarcodeMatrix* barcodeMatrix = encoder.getBarcodeMatrix();
- CFX_ArrayTemplate<uint8_t> originalScale;
- originalScale.Copy(barcodeMatrix->getScaledMatrix(
- lineThickness, aspectRatio * lineThickness));
- int32_t width = outWidth;
- int32_t height = outHeight;
- outWidth = barcodeMatrix->getWidth();
- outHeight = barcodeMatrix->getHeight();
- bool rotated = false;
- if ((height > width) ^ (outWidth < outHeight)) {
- rotateArray(originalScale, outHeight, outWidth);
- rotated = true;
- int32_t temp = outHeight;
- outHeight = outWidth;
- outWidth = temp;
- }
- int32_t scaleX = width / outWidth;
- int32_t scaleY = height / outHeight;
- int32_t scale;
- if (scaleX < scaleY) {
- scale = scaleX;
- } else {
- scale = scaleY;
- }
- if (scale > 1) {
- originalScale.RemoveAll();
- originalScale.Copy(barcodeMatrix->getScaledMatrix(
- scale * lineThickness, scale * aspectRatio * lineThickness));
- if (rotated) {
- rotateArray(originalScale, outHeight, outWidth);
- int32_t temp = outHeight;
- outHeight = outWidth;
- outWidth = temp;
- }
- }
- uint8_t* result = FX_Alloc2D(uint8_t, outHeight, outWidth);
- FXSYS_memcpy(result, originalScale.GetData(), outHeight * outWidth);
- return result;
-}
-void CBC_PDF417Writer::rotateArray(CFX_ArrayTemplate<uint8_t>& bitarray,
- int32_t height,
- int32_t width) {
- CFX_ArrayTemplate<uint8_t> temp;
- temp.Copy(bitarray);
- for (int32_t ii = 0; ii < height; ii++) {
- int32_t inverseii = height - ii - 1;
- for (int32_t jj = 0; jj < width; jj++) {
- bitarray[jj * height + inverseii] = temp[ii * width + jj];
- }
- }
-}
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/pdf417/BC_PDF417Writer.h b/chromium/third_party/pdfium/xfa/fxbarcode/pdf417/BC_PDF417Writer.h
deleted file mode 100644
index 420c441bc90..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/pdf417/BC_PDF417Writer.h
+++ /dev/null
@@ -1,36 +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 XFA_FXBARCODE_PDF417_BC_PDF417WRITER_H_
-#define XFA_FXBARCODE_PDF417_BC_PDF417WRITER_H_
-
-#include "core/fxcrt/fx_string.h"
-#include "core/fxcrt/fx_system.h"
-#include "xfa/fxbarcode/BC_TwoDimWriter.h"
-
-class CBC_PDF417Writer : public CBC_TwoDimWriter {
- public:
- CBC_PDF417Writer();
- ~CBC_PDF417Writer() override;
-
- uint8_t* Encode(const CFX_WideString& contents,
- int32_t& outWidth,
- int32_t& outHeight,
- int32_t& e);
-
- // CBC_TwoDimWriter
- bool SetErrorCorrectionLevel(int32_t level) override;
-
- void SetTruncated(bool truncated);
-
- private:
- void rotateArray(CFX_ArrayTemplate<uint8_t>& bitarray,
- int32_t width,
- int32_t height);
- bool m_bTruncated;
-};
-
-#endif // XFA_FXBARCODE_PDF417_BC_PDF417WRITER_H_
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCodeWriter.cpp b/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCodeWriter.cpp
deleted file mode 100644
index 8a6499cbb7c..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCodeWriter.cpp
+++ /dev/null
@@ -1,122 +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
-// Original code is licensed as follows:
-/*
- * Copyright 2008 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "xfa/fxbarcode/BC_TwoDimWriter.h"
-#include "xfa/fxbarcode/common/BC_CommonByteMatrix.h"
-#include "xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.h"
-#include "xfa/fxbarcode/qrcode/BC_QRCodeWriter.h"
-#include "xfa/fxbarcode/qrcode/BC_QRCoder.h"
-#include "xfa/fxbarcode/qrcode/BC_QRCoderEncoder.h"
-#include "xfa/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.h"
-#include "xfa/fxbarcode/qrcode/BC_QRCoderMode.h"
-#include "xfa/fxbarcode/qrcode/BC_QRCoderVersion.h"
-
-CBC_QRCodeWriter::CBC_QRCodeWriter() {
- m_bFixedSize = true;
- m_iCorrectLevel = 1;
- m_iVersion = 0;
-}
-
-CBC_QRCodeWriter::~CBC_QRCodeWriter() {}
-
-void CBC_QRCodeWriter::ReleaseAll() {
- delete CBC_ReedSolomonGF256::QRCodeField;
- CBC_ReedSolomonGF256::QRCodeField = nullptr;
- delete CBC_ReedSolomonGF256::DataMatrixField;
- CBC_ReedSolomonGF256::DataMatrixField = nullptr;
- CBC_QRCoderMode::Destroy();
- CBC_QRCoderErrorCorrectionLevel::Destroy();
- CBC_QRCoderVersion::Destroy();
-}
-
-bool CBC_QRCodeWriter::SetVersion(int32_t version) {
- if (version < 0 || version > 40) {
- return false;
- }
- m_iVersion = version;
- return true;
-}
-
-bool CBC_QRCodeWriter::SetErrorCorrectionLevel(int32_t level) {
- if (level < 0 || level > 3) {
- return false;
- }
- m_iCorrectLevel = level;
- return true;
-}
-
-uint8_t* CBC_QRCodeWriter::Encode(const CFX_WideString& contents,
- int32_t ecLevel,
- int32_t& outWidth,
- int32_t& outHeight,
- int32_t& e) {
- CBC_QRCoderErrorCorrectionLevel* ec = nullptr;
- switch (ecLevel) {
- case 0:
- ec = CBC_QRCoderErrorCorrectionLevel::L;
- break;
- case 1:
- ec = CBC_QRCoderErrorCorrectionLevel::M;
- break;
- case 2:
- ec = CBC_QRCoderErrorCorrectionLevel::Q;
- break;
- case 3:
- ec = CBC_QRCoderErrorCorrectionLevel::H;
- break;
- default: {
- e = BCExceptionUnSupportEclevel;
- return nullptr;
- }
- }
- CBC_QRCoder qr;
- if (m_iVersion > 0 && m_iVersion < 41) {
- CFX_ByteString byteStr = contents.UTF8Encode();
- CBC_QRCoderEncoder::Encode(byteStr, ec, &qr, e, m_iVersion);
- } else {
- CBC_QRCoderEncoder::Encode(contents, ec, &qr, e);
- }
- if (e != BCExceptionNO)
- return nullptr;
- outWidth = qr.GetMatrixWidth();
- outHeight = qr.GetMatrixWidth();
- uint8_t* result = FX_Alloc2D(uint8_t, outWidth, outHeight);
- FXSYS_memcpy(result, qr.GetMatrix()->GetArray(), outWidth * outHeight);
- return result;
-}
-
-uint8_t* CBC_QRCodeWriter::Encode(const CFX_ByteString& contents,
- BCFORMAT format,
- int32_t& outWidth,
- int32_t& outHeight,
- int32_t hints,
- int32_t& e) {
- return nullptr;
-}
-
-uint8_t* CBC_QRCodeWriter::Encode(const CFX_ByteString& contents,
- BCFORMAT format,
- int32_t& outWidth,
- int32_t& outHeight,
- int32_t& e) {
- return nullptr;
-}
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCodeWriter.h b/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCodeWriter.h
deleted file mode 100644
index 5585fa55c15..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCodeWriter.h
+++ /dev/null
@@ -1,45 +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 XFA_FXBARCODE_QRCODE_BC_QRCODEWRITER_H_
-#define XFA_FXBARCODE_QRCODE_BC_QRCODEWRITER_H_
-
-#include "xfa/fxbarcode/BC_TwoDimWriter.h"
-
-class CBC_TwoDimWriter;
-class CBC_QRCodeWriter : public CBC_TwoDimWriter {
- public:
- CBC_QRCodeWriter();
- ~CBC_QRCodeWriter() override;
-
- uint8_t* Encode(const CFX_WideString& contents,
- int32_t ecLevel,
- int32_t& outWidth,
- int32_t& outHeight,
- int32_t& e);
- uint8_t* Encode(const CFX_ByteString& contents,
- BCFORMAT format,
- int32_t& outWidth,
- int32_t& outHeight,
- int32_t hints,
- int32_t& e);
- uint8_t* Encode(const CFX_ByteString& contents,
- BCFORMAT format,
- int32_t& outWidth,
- int32_t& outHeight,
- int32_t& e);
- bool SetVersion(int32_t version);
-
- // CBC_TwoDimWriter
- bool SetErrorCorrectionLevel(int32_t level) override;
-
- static void ReleaseAll();
-
- private:
- int32_t m_iVersion;
-};
-
-#endif // XFA_FXBARCODE_QRCODE_BC_QRCODEWRITER_H_
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoder.cpp b/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoder.cpp
deleted file mode 100644
index a5c849780db..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoder.cpp
+++ /dev/null
@@ -1,145 +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
-// Original code is licensed as follows:
-/*
- * Copyright 2008 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <utility>
-
-#include "xfa/fxbarcode/common/BC_CommonByteMatrix.h"
-#include "xfa/fxbarcode/qrcode/BC_QRCoder.h"
-#include "xfa/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.h"
-#include "xfa/fxbarcode/qrcode/BC_QRCoderMode.h"
-#include "xfa/fxbarcode/utils.h"
-
-CBC_QRCoder::CBC_QRCoder()
- : m_mode(nullptr),
- m_ecLevel(nullptr),
- m_version(-1),
- m_matrixWidth(-1),
- m_maskPattern(-1),
- m_numTotalBytes(-1),
- m_numDataBytes(-1),
- m_numECBytes(-1),
- m_numRSBlocks(-1) {}
-
-CBC_QRCoder::~CBC_QRCoder() {}
-
-CBC_QRCoderMode* CBC_QRCoder::GetMode() const {
- return m_mode;
-}
-
-CBC_QRCoderErrorCorrectionLevel* CBC_QRCoder::GetECLevel() const {
- return m_ecLevel;
-}
-
-int32_t CBC_QRCoder::GetVersion() const {
- return m_version;
-}
-
-int32_t CBC_QRCoder::GetMatrixWidth() const {
- return m_matrixWidth;
-}
-
-int32_t CBC_QRCoder::GetMaskPattern() const {
- return m_maskPattern;
-}
-
-int32_t CBC_QRCoder::GetNumTotalBytes() const {
- return m_numTotalBytes;
-}
-
-int32_t CBC_QRCoder::GetNumDataBytes() const {
- return m_numDataBytes;
-}
-
-int32_t CBC_QRCoder::GetNumECBytes() const {
- return m_numECBytes;
-}
-
-int32_t CBC_QRCoder::GetNumRSBlocks() const {
- return m_numRSBlocks;
-}
-
-CBC_CommonByteMatrix* CBC_QRCoder::GetMatrix() const {
- return m_matrix.get();
-}
-
-int32_t CBC_QRCoder::At(int32_t x, int32_t y, int32_t& e) {
- int32_t value = m_matrix->Get(x, y);
- if (!(value == 0 || value == 1)) {
- e = BCExceptionValueMustBeEither0or1;
- return 0;
- }
- return value;
-}
-
-bool CBC_QRCoder::IsValid() {
- return m_mode && m_ecLevel && m_version != -1 && m_matrixWidth != -1 &&
- m_maskPattern != -1 && m_numTotalBytes != -1 && m_numDataBytes != -1 &&
- m_numECBytes != -1 && m_numRSBlocks != -1 &&
- IsValidMaskPattern(m_maskPattern) &&
- m_numTotalBytes == m_numDataBytes + m_numECBytes && m_matrix &&
- m_matrixWidth == m_matrix->GetWidth() &&
- m_matrix->GetWidth() == m_matrix->GetHeight();
-}
-
-void CBC_QRCoder::SetMode(CBC_QRCoderMode* value) {
- m_mode = value;
-}
-
-void CBC_QRCoder::SetECLevel(CBC_QRCoderErrorCorrectionLevel* ecLevel) {
- m_ecLevel = ecLevel;
-}
-
-void CBC_QRCoder::SetVersion(int32_t version) {
- m_version = version;
-}
-
-void CBC_QRCoder::SetMatrixWidth(int32_t width) {
- m_matrixWidth = width;
-}
-
-void CBC_QRCoder::SetMaskPattern(int32_t pattern) {
- m_maskPattern = pattern;
-}
-
-void CBC_QRCoder::SetNumDataBytes(int32_t bytes) {
- m_numDataBytes = bytes;
-}
-
-void CBC_QRCoder::SetNumTotalBytes(int32_t value) {
- m_numTotalBytes = value;
-}
-
-void CBC_QRCoder::SetNumRSBlocks(int32_t block) {
- m_numRSBlocks = block;
-}
-
-void CBC_QRCoder::SetNumECBytes(int32_t value) {
- m_numECBytes = value;
-}
-
-bool CBC_QRCoder::IsValidMaskPattern(int32_t maskPattern) {
- return maskPattern >= 0 && maskPattern < kNumMaskPatterns;
-}
-
-void CBC_QRCoder::SetMatrix(std::unique_ptr<CBC_CommonByteMatrix> pMatrix) {
- m_matrix = std::move(pMatrix);
-}
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoder.h b/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoder.h
deleted file mode 100644
index 5e949920a76..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoder.h
+++ /dev/null
@@ -1,63 +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 XFA_FXBARCODE_QRCODE_BC_QRCODER_H_
-#define XFA_FXBARCODE_QRCODE_BC_QRCODER_H_
-
-#include <memory>
-
-class CBC_QRCoderErrorCorrectionLevel;
-class CBC_QRCoderMode;
-class CBC_CommonByteMatrix;
-
-class CBC_QRCoder {
- public:
- static constexpr int32_t kNumMaskPatterns = 8;
-
- CBC_QRCoder();
- virtual ~CBC_QRCoder();
-
- static bool IsValidMaskPattern(int32_t maskPattern);
-
- CBC_QRCoderMode* GetMode() const;
- CBC_QRCoderErrorCorrectionLevel* GetECLevel() const;
- int32_t GetVersion() const;
- int32_t GetMatrixWidth() const;
- int32_t GetMaskPattern() const;
- int32_t GetNumTotalBytes() const;
- int32_t GetNumDataBytes() const;
- int32_t GetNumECBytes() const;
- int32_t GetNumRSBlocks() const;
- CBC_CommonByteMatrix* GetMatrix() const;
-
- int32_t At(int32_t x, int32_t y, int32_t& e);
- bool IsValid();
-
- void SetMode(CBC_QRCoderMode* value);
- void SetECLevel(CBC_QRCoderErrorCorrectionLevel* ecLevel);
- void SetVersion(int32_t version);
- void SetMatrixWidth(int32_t width);
- void SetMaskPattern(int32_t pattern);
- void SetNumDataBytes(int32_t bytes);
- void SetNumTotalBytes(int32_t value);
- void SetNumECBytes(int32_t value);
- void SetNumRSBlocks(int32_t block);
- void SetMatrix(std::unique_ptr<CBC_CommonByteMatrix> pMatrix);
-
- private:
- CBC_QRCoderMode* m_mode;
- CBC_QRCoderErrorCorrectionLevel* m_ecLevel;
- int32_t m_version;
- int32_t m_matrixWidth;
- int32_t m_maskPattern;
- int32_t m_numTotalBytes;
- int32_t m_numDataBytes;
- int32_t m_numECBytes;
- int32_t m_numRSBlocks;
- std::unique_ptr<CBC_CommonByteMatrix> m_matrix;
-};
-
-#endif // XFA_FXBARCODE_QRCODE_BC_QRCODER_H_
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderBitVector.cpp b/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderBitVector.cpp
deleted file mode 100644
index e4140a87a0c..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderBitVector.cpp
+++ /dev/null
@@ -1,127 +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
-// Original code is licensed as follows:
-/*
- * Copyright 2007 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "core/fxcrt/fx_memory.h"
-#include "xfa/fxbarcode/qrcode/BC_QRCoderBitVector.h"
-#include "xfa/fxbarcode/utils.h"
-
-CBC_QRCoderBitVector::CBC_QRCoderBitVector() {
- m_sizeInBits = 0;
- m_size = 32;
-}
-void CBC_QRCoderBitVector::Init() {
- m_array = FX_Alloc(uint8_t, m_size);
-}
-CBC_QRCoderBitVector::~CBC_QRCoderBitVector() {
- FX_Free(m_array);
-}
-void CBC_QRCoderBitVector::Clear() {
- FX_Free(m_array);
- m_sizeInBits = 0;
- m_size = 32;
- m_array = FX_Alloc(uint8_t, m_size);
-}
-int32_t CBC_QRCoderBitVector::At(int32_t index, int32_t& e) {
- if (index < 0 || index >= m_sizeInBits) {
- e = BCExceptionBadIndexException;
- return 0;
- }
- int32_t value = m_array[index >> 3] & 0xff;
- return (value >> (7 - (index & 0x7))) & 1;
-}
-int32_t CBC_QRCoderBitVector::sizeInBytes() {
- return (m_sizeInBits + 7) >> 3;
-}
-int32_t CBC_QRCoderBitVector::Size() {
- return m_sizeInBits;
-}
-void CBC_QRCoderBitVector::AppendBit(int32_t bit, int32_t& e) {
- if (!(bit == 0 || bit == 1)) {
- e = BCExceptionBadValueException;
- return;
- }
- int32_t numBitsInLastByte = m_sizeInBits & 0x7;
- if (numBitsInLastByte == 0) {
- AppendByte(0);
- m_sizeInBits -= 8;
- }
- m_array[m_sizeInBits >> 3] |= (bit << (7 - numBitsInLastByte));
- ++m_sizeInBits;
-}
-void CBC_QRCoderBitVector::AppendBits(int32_t value,
- int32_t numBits,
- int32_t& e) {
- if (numBits < 0 || numBits > 32) {
- e = BCExceptionBadNumBitsException;
- return;
- }
- int32_t numBitsLeft = numBits;
- while (numBitsLeft > 0) {
- if ((m_sizeInBits & 0x7) == 0 && numBitsLeft >= 8) {
- int32_t newByte = (value >> (numBitsLeft - 8)) & 0xff;
- AppendByte(newByte);
- numBitsLeft -= 8;
- } else {
- int32_t bit = (value >> (numBitsLeft - 1)) & 1;
- AppendBit(bit, e);
- if (e != BCExceptionNO)
- return;
- --numBitsLeft;
- }
- }
-}
-void CBC_QRCoderBitVector::AppendBitVector(CBC_QRCoderBitVector* bits,
- int32_t& e) {
- int32_t size = bits->Size();
- for (int32_t i = 0; i < size; i++) {
- int32_t num = bits->At(i, e);
- if (e != BCExceptionNO)
- return;
- AppendBit(num, e);
- if (e != BCExceptionNO)
- return;
- }
-}
-void CBC_QRCoderBitVector::XOR(CBC_QRCoderBitVector* other, int32_t& e) {
- if (m_sizeInBits != other->Size()) {
- e = BCExceptioncanNotOperatexorOperator;
- return;
- }
- int32_t sizeInBytes = (m_sizeInBits + 7) >> 3;
- for (int32_t i = 0; i < sizeInBytes; ++i) {
- m_array[i] ^= (other->GetArray())[i];
- }
-}
-uint8_t* CBC_QRCoderBitVector::GetArray() {
- return m_array;
-}
-void CBC_QRCoderBitVector::AppendByte(int32_t value) {
- if ((m_sizeInBits >> 3) == m_size) {
- uint8_t* newArray = FX_Alloc(uint8_t, m_size << 1);
- FXSYS_memcpy(newArray, m_array, m_size);
- FX_Free(m_array);
- m_array = newArray;
- m_size = m_size << 1;
- }
- m_array[m_sizeInBits >> 3] = (uint8_t)value;
- m_sizeInBits += 8;
-}
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderBitVector.h b/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderBitVector.h
deleted file mode 100644
index 7742541a067..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderBitVector.h
+++ /dev/null
@@ -1,35 +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 XFA_FXBARCODE_QRCODE_BC_QRCODERBITVECTOR_H_
-#define XFA_FXBARCODE_QRCODE_BC_QRCODERBITVECTOR_H_
-
-#include <stdint.h>
-
-class CBC_QRCoderBitVector {
- private:
- int32_t m_sizeInBits;
- uint8_t* m_array;
- int32_t m_size;
-
- void AppendByte(int32_t value);
-
- public:
- CBC_QRCoderBitVector();
- virtual ~CBC_QRCoderBitVector();
- int32_t At(int32_t index, int32_t& e);
- int32_t Size();
- int32_t sizeInBytes();
- void AppendBit(int32_t bit, int32_t& e);
- void AppendBits(int32_t value, int32_t numBits, int32_t& e);
- void AppendBitVector(CBC_QRCoderBitVector* bits, int32_t& e);
- void XOR(CBC_QRCoderBitVector* other, int32_t& e);
- uint8_t* GetArray();
- void Clear();
- virtual void Init();
-};
-
-#endif // XFA_FXBARCODE_QRCODE_BC_QRCODERBITVECTOR_H_
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderBlockPair.cpp b/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderBlockPair.cpp
deleted file mode 100644
index 8dc73c4be4a..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderBlockPair.cpp
+++ /dev/null
@@ -1,44 +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
-// Original code is licensed as follows:
-/*
- * Copyright 2008 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "xfa/fxbarcode/qrcode/BC_QRCoderBlockPair.h"
-
-#include <utility>
-
-#include "xfa/fxbarcode/common/BC_CommonByteArray.h"
-
-CBC_QRCoderBlockPair::CBC_QRCoderBlockPair(
- std::unique_ptr<CBC_CommonByteArray> data,
- std::unique_ptr<CBC_CommonByteArray> errorCorrection)
- : m_dataBytes(std::move(data)),
- m_errorCorrectionBytes(std::move(errorCorrection)) {}
-
-CBC_QRCoderBlockPair::~CBC_QRCoderBlockPair() {}
-
-const CBC_CommonByteArray* CBC_QRCoderBlockPair::GetDataBytes() const {
- return m_dataBytes.get();
-}
-
-const CBC_CommonByteArray* CBC_QRCoderBlockPair::GetErrorCorrectionBytes()
- const {
- return m_errorCorrectionBytes.get();
-}
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderBlockPair.h b/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderBlockPair.h
deleted file mode 100644
index 4259d6badde..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderBlockPair.h
+++ /dev/null
@@ -1,28 +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 XFA_FXBARCODE_QRCODE_BC_QRCODERBLOCKPAIR_H_
-#define XFA_FXBARCODE_QRCODE_BC_QRCODERBLOCKPAIR_H_
-
-#include <memory>
-
-class CBC_CommonByteArray;
-
-class CBC_QRCoderBlockPair {
- public:
- CBC_QRCoderBlockPair(std::unique_ptr<CBC_CommonByteArray> data,
- std::unique_ptr<CBC_CommonByteArray> errorCorrection);
- virtual ~CBC_QRCoderBlockPair();
-
- const CBC_CommonByteArray* GetDataBytes() const;
- const CBC_CommonByteArray* GetErrorCorrectionBytes() const;
-
- private:
- std::unique_ptr<CBC_CommonByteArray> m_dataBytes;
- std::unique_ptr<CBC_CommonByteArray> m_errorCorrectionBytes;
-};
-
-#endif // XFA_FXBARCODE_QRCODE_BC_QRCODERBLOCKPAIR_H_
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderECB.cpp b/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderECB.cpp
deleted file mode 100644
index 2b5a2a6fef1..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderECB.cpp
+++ /dev/null
@@ -1,35 +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
-// Original code is licensed as follows:
-/*
- * Copyright 2007 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "xfa/fxbarcode/qrcode/BC_QRCoderECB.h"
-
-CBC_QRCoderECB::CBC_QRCoderECB(int32_t count, int32_t dataCodeWords) {
- m_dataCodeWords = dataCodeWords;
- m_count = count;
-}
-CBC_QRCoderECB::~CBC_QRCoderECB() {}
-int32_t CBC_QRCoderECB::GetCount() {
- return m_count;
-}
-int32_t CBC_QRCoderECB::GetDataCodeWords() {
- return m_dataCodeWords;
-}
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderECB.h b/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderECB.h
deleted file mode 100644
index 25b0b20fe3d..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderECB.h
+++ /dev/null
@@ -1,24 +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 XFA_FXBARCODE_QRCODE_BC_QRCODERECB_H_
-#define XFA_FXBARCODE_QRCODE_BC_QRCODERECB_H_
-
-#include <stdint.h>
-
-class CBC_QRCoderECB {
- private:
- int32_t m_count;
- int32_t m_dataCodeWords;
-
- public:
- CBC_QRCoderECB(int32_t count, int32_t dataCodeWords);
- virtual ~CBC_QRCoderECB();
- int32_t GetCount();
- int32_t GetDataCodeWords();
-};
-
-#endif // XFA_FXBARCODE_QRCODE_BC_QRCODERECB_H_
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderECBlocks.cpp b/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderECBlocks.cpp
deleted file mode 100644
index 507c91878e9..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderECBlocks.cpp
+++ /dev/null
@@ -1,63 +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
-// Original code is licensed as follows:
-/*
- * Copyright 2007 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "xfa/fxbarcode/qrcode/BC_QRCoderECB.h"
-#include "xfa/fxbarcode/qrcode/BC_QRCoderECBlocks.h"
-
-CBC_QRCoderECBlocks::CBC_QRCoderECBlocks(int32_t ecCodeWordsPerBlock,
- CBC_QRCoderECB* ecBlocks)
- : m_ecCodeWordsPerBlock(ecCodeWordsPerBlock) {
- m_ecBlocksArray.Add(ecBlocks);
-}
-
-CBC_QRCoderECBlocks::CBC_QRCoderECBlocks(int32_t ecCodeWordsPerBlock,
- CBC_QRCoderECB* ecBlocks1,
- CBC_QRCoderECB* ecBlocks2)
- : m_ecCodeWordsPerBlock(ecCodeWordsPerBlock) {
- m_ecBlocksArray.Add(ecBlocks1);
- m_ecBlocksArray.Add(ecBlocks2);
-}
-
-CBC_QRCoderECBlocks::~CBC_QRCoderECBlocks() {
- for (int32_t i = 0; i < m_ecBlocksArray.GetSize(); i++)
- delete m_ecBlocksArray[i];
-}
-
-int32_t CBC_QRCoderECBlocks::GetECCodeWordsPerBlock() const {
- return m_ecCodeWordsPerBlock;
-}
-
-int32_t CBC_QRCoderECBlocks::GetNumBlocks() const {
- int32_t total = 0;
- for (int32_t i = 0; i < m_ecBlocksArray.GetSize(); i++)
- total += m_ecBlocksArray[i]->GetCount();
-
- return total;
-}
-
-int32_t CBC_QRCoderECBlocks::GetTotalECCodeWords() const {
- return m_ecCodeWordsPerBlock * GetNumBlocks();
-}
-
-CFX_ArrayTemplate<CBC_QRCoderECB*>* CBC_QRCoderECBlocks::GetECBlocks() {
- return &m_ecBlocksArray;
-}
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderECBlocks.h b/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderECBlocks.h
deleted file mode 100644
index a428f063556..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderECBlocks.h
+++ /dev/null
@@ -1,32 +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 XFA_FXBARCODE_QRCODE_BC_QRCODERECBLOCKS_H_
-#define XFA_FXBARCODE_QRCODE_BC_QRCODERECBLOCKS_H_
-
-#include "core/fxcrt/fx_basic.h"
-
-class CBC_QRCoderECB;
-
-class CBC_QRCoderECBlocks {
- public:
- CBC_QRCoderECBlocks(int32_t ecCodeWordsPerBlock, CBC_QRCoderECB* ecBlocks);
- CBC_QRCoderECBlocks(int32_t ecCodeWordsPerBlock,
- CBC_QRCoderECB* ecBlocks1,
- CBC_QRCoderECB* ecBlocks2);
- ~CBC_QRCoderECBlocks();
-
- int32_t GetECCodeWordsPerBlock() const;
- int32_t GetNumBlocks() const;
- int32_t GetTotalECCodeWords() const;
- CFX_ArrayTemplate<CBC_QRCoderECB*>* GetECBlocks();
-
- private:
- int32_t m_ecCodeWordsPerBlock;
- CFX_ArrayTemplate<CBC_QRCoderECB*> m_ecBlocksArray;
-};
-
-#endif // XFA_FXBARCODE_QRCODE_BC_QRCODERECBLOCKS_H_
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderEncoder.cpp b/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderEncoder.cpp
deleted file mode 100644
index 2c262f006be..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderEncoder.cpp
+++ /dev/null
@@ -1,971 +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
-// Original code is licensed as follows:
-/*
- * Copyright 2008 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "xfa/fxbarcode/qrcode/BC_QRCoderEncoder.h"
-
-#include <algorithm>
-#include <memory>
-#include <utility>
-
-#include "xfa/fxbarcode/BC_UtilCodingConvert.h"
-#include "xfa/fxbarcode/common/BC_CommonByteArray.h"
-#include "xfa/fxbarcode/common/BC_CommonByteMatrix.h"
-#include "xfa/fxbarcode/common/reedsolomon/BC_ReedSolomon.h"
-#include "xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.h"
-#include "xfa/fxbarcode/qrcode/BC_QRCoder.h"
-#include "xfa/fxbarcode/qrcode/BC_QRCoderBitVector.h"
-#include "xfa/fxbarcode/qrcode/BC_QRCoderBlockPair.h"
-#include "xfa/fxbarcode/qrcode/BC_QRCoderECBlocks.h"
-#include "xfa/fxbarcode/qrcode/BC_QRCoderMaskUtil.h"
-#include "xfa/fxbarcode/qrcode/BC_QRCoderMatrixUtil.h"
-#include "xfa/fxbarcode/qrcode/BC_QRCoderMode.h"
-#include "xfa/fxbarcode/qrcode/BC_QRCoderVersion.h"
-
-namespace {
-
-const int8_t g_alphaNumericTable[] = {
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 36, -1, -1, -1, 37, 38, -1, -1, -1, -1, 39, 40, -1, 41, 42, 43,
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 44, -1, -1, -1, -1, -1,
- -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
- 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, -1, -1, -1, -1};
-
-} // namespace
-
-CBC_QRCoderEncoder::CBC_QRCoderEncoder() {}
-
-CBC_QRCoderEncoder::~CBC_QRCoderEncoder() {}
-
-void CBC_QRCoderEncoder::Encode(const CFX_ByteString& content,
- CBC_QRCoderErrorCorrectionLevel* ecLevel,
- CBC_QRCoder* qrCode,
- int32_t& e,
- int32_t versionSpecify) {
- if (versionSpecify == 0) {
- EncodeWithAutoVersion(content, ecLevel, qrCode, e);
- if (e != BCExceptionNO)
- return;
- } else if (versionSpecify > 0 && versionSpecify <= 40) {
- EncodeWithSpecifyVersion(content, ecLevel, qrCode, versionSpecify, e);
- if (e != BCExceptionNO)
- return;
- } else {
- e = BCExceptionVersionMust1_40;
- if (e != BCExceptionNO)
- return;
- }
-}
-
-void CBC_QRCoderEncoder::AppendECI(CBC_QRCoderBitVector* bits) {}
-
-void CBC_QRCoderEncoder::AppendDataModeLenghInfo(
- const std::vector<std::pair<CBC_QRCoderMode*, CFX_ByteString>>&
- splitResults,
- CBC_QRCoderBitVector& headerAndDataBits,
- CBC_QRCoderMode* tempMode,
- CBC_QRCoder* qrCode,
- CFX_ByteString& encoding,
- int32_t& e) {
- for (const auto& splitResult : splitResults) {
- tempMode = splitResult.first;
- if (tempMode == CBC_QRCoderMode::sGBK) {
- AppendModeInfo(tempMode, &headerAndDataBits, e);
- if (e != BCExceptionNO)
- return;
- AppendLengthInfo(splitResult.second.GetLength(), qrCode->GetVersion(),
- tempMode, &headerAndDataBits, e);
- if (e != BCExceptionNO)
- return;
- AppendBytes(splitResult.second, tempMode, &headerAndDataBits, encoding,
- e);
- if (e != BCExceptionNO)
- return;
- } else if (tempMode == CBC_QRCoderMode::sBYTE) {
- CFX_ArrayTemplate<uint8_t> bytes;
- CBC_UtilCodingConvert::LocaleToUtf8(splitResult.second, bytes);
- AppendModeInfo(tempMode, &headerAndDataBits, e);
- if (e != BCExceptionNO)
- return;
- AppendLengthInfo(bytes.GetSize(), qrCode->GetVersion(), tempMode,
- &headerAndDataBits, e);
- if (e != BCExceptionNO)
- return;
- Append8BitBytes(bytes, &headerAndDataBits, e);
- if (e != BCExceptionNO)
- return;
- } else if (tempMode == CBC_QRCoderMode::sALPHANUMERIC) {
- AppendModeInfo(tempMode, &headerAndDataBits, e);
- if (e != BCExceptionNO)
- return;
- AppendLengthInfo(splitResult.second.GetLength(), qrCode->GetVersion(),
- tempMode, &headerAndDataBits, e);
- if (e != BCExceptionNO)
- return;
- AppendBytes(splitResult.second, tempMode, &headerAndDataBits, encoding,
- e);
- if (e != BCExceptionNO)
- return;
- } else if (tempMode == CBC_QRCoderMode::sNUMERIC) {
- AppendModeInfo(tempMode, &headerAndDataBits, e);
- if (e != BCExceptionNO)
- return;
- AppendLengthInfo(splitResult.second.GetLength(), qrCode->GetVersion(),
- tempMode, &headerAndDataBits, e);
- if (e != BCExceptionNO)
- return;
- AppendBytes(splitResult.second, tempMode, &headerAndDataBits, encoding,
- e);
- if (e != BCExceptionNO)
- return;
- } else {
- e = BCExceptionUnknown;
- return;
- }
- }
-}
-
-void CBC_QRCoderEncoder::SplitString(
- const CFX_ByteString& content,
- std::vector<std::pair<CBC_QRCoderMode*, CFX_ByteString>>* result) {
- int32_t index = 0, flag = 0;
- while (
- (((uint8_t)content[index] >= 0xA1 && (uint8_t)content[index] <= 0xAA) ||
- ((uint8_t)content[index] >= 0xB0 && (uint8_t)content[index] <= 0xFA)) &&
- (index < content.GetLength())) {
- index += 2;
- }
- if (index != flag) {
- result->push_back({CBC_QRCoderMode::sGBK, content.Mid(flag, index - flag)});
- }
- flag = index;
- if (index >= content.GetLength()) {
- return;
- }
- while (
- GetAlphaNumericCode((uint8_t)content[index]) == -1 &&
- !(((uint8_t)content[index] >= 0xA1 && (uint8_t)content[index] <= 0xAA) ||
- ((uint8_t)content[index] >= 0xB0 && (uint8_t)content[index] <= 0xFA)) &&
- (index < content.GetLength())) {
-#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
- if (IsDBCSLeadByte((uint8_t)content[index]))
-#else
- if ((uint8_t)content[index] > 127)
-#endif
- {
- index += 2;
- } else {
- index++;
- }
- }
- if (index != flag) {
- result->push_back(
- {CBC_QRCoderMode::sBYTE, content.Mid(flag, index - flag)});
- }
- flag = index;
- if (index >= content.GetLength()) {
- return;
- }
- while (FXSYS_Isdigit((uint8_t)content[index]) &&
- (index < content.GetLength())) {
- index++;
- }
- if (index != flag) {
- result->push_back(
- {CBC_QRCoderMode::sNUMERIC, content.Mid(flag, index - flag)});
- }
- flag = index;
- if (index >= content.GetLength()) {
- return;
- }
- while (GetAlphaNumericCode((uint8_t)content[index]) != -1 &&
- (index < content.GetLength())) {
- index++;
- }
- if (index != flag) {
- result->push_back(
- {CBC_QRCoderMode::sALPHANUMERIC, content.Mid(flag, index - flag)});
- }
- flag = index;
- if (index < content.GetLength())
- SplitString(content.Mid(index, content.GetLength() - index), result);
-}
-
-int32_t CBC_QRCoderEncoder::GetSpanByVersion(CBC_QRCoderMode* modeFirst,
- CBC_QRCoderMode* modeSecond,
- int32_t versionNum,
- int32_t& e) {
- if (versionNum == 0)
- return 0;
-
- if (modeFirst == CBC_QRCoderMode::sALPHANUMERIC &&
- modeSecond == CBC_QRCoderMode::sBYTE) {
- if (versionNum >= 1 && versionNum <= 9)
- return 11;
- if (versionNum >= 10 && versionNum <= 26)
- return 15;
- if (versionNum >= 27 && versionNum <= 40)
- return 16;
- e = BCExceptionNoSuchVersion;
- return 0;
- }
- if (modeSecond == CBC_QRCoderMode::sALPHANUMERIC &&
- modeFirst == CBC_QRCoderMode::sNUMERIC) {
- if (versionNum >= 1 && versionNum <= 9)
- return 13;
- if (versionNum >= 10 && versionNum <= 26)
- return 15;
- if (versionNum >= 27 && versionNum <= 40)
- return 17;
- e = BCExceptionNoSuchVersion;
- return 0;
- }
- if (modeSecond == CBC_QRCoderMode::sBYTE &&
- modeFirst == CBC_QRCoderMode::sNUMERIC) {
- if (versionNum >= 1 && versionNum <= 9)
- return 6;
- if (versionNum >= 10 && versionNum <= 26)
- return 8;
- if (versionNum >= 27 && versionNum <= 40)
- return 9;
- e = BCExceptionNoSuchVersion;
- return 0;
- }
- return -1;
-}
-
-void CBC_QRCoderEncoder::MergeString(
- std::vector<std::pair<CBC_QRCoderMode*, CFX_ByteString>>* result,
- int32_t versionNum,
- int32_t& e) {
- size_t mergeNum = 0;
- for (size_t i = 0; i + 1 < result->size(); i++) {
- auto element1 = &(*result)[i];
- auto element2 = &(*result)[i + 1];
- if (element1->first == CBC_QRCoderMode::sALPHANUMERIC) {
- int32_t tmp = GetSpanByVersion(CBC_QRCoderMode::sALPHANUMERIC,
- CBC_QRCoderMode::sBYTE, versionNum, e);
- if (e != BCExceptionNO)
- return;
- if (element2->first == CBC_QRCoderMode::sBYTE &&
- element1->second.GetLength() < tmp) {
- element2->second = element1->second + element2->second;
- result->erase(result->begin() + i);
- i--;
- mergeNum++;
- }
- } else if (element1->first == CBC_QRCoderMode::sBYTE) {
- if (element2->first == CBC_QRCoderMode::sBYTE) {
- element1->second += element2->second;
- result->erase(result->begin() + i + 1);
- i--;
- mergeNum++;
- }
- } else if (element1->first == CBC_QRCoderMode::sNUMERIC) {
- int32_t tmp = GetSpanByVersion(CBC_QRCoderMode::sNUMERIC,
- CBC_QRCoderMode::sBYTE, versionNum, e);
- if (e != BCExceptionNO)
- return;
- if (element2->first == CBC_QRCoderMode::sBYTE &&
- element1->second.GetLength() < tmp) {
- element2->second = element1->second + element2->second;
- result->erase(result->begin() + i);
- i--;
- mergeNum++;
- }
- tmp = GetSpanByVersion(CBC_QRCoderMode::sNUMERIC,
- CBC_QRCoderMode::sALPHANUMERIC, versionNum, e);
- if (e != BCExceptionNO)
- return;
- if (element2->first == CBC_QRCoderMode::sALPHANUMERIC &&
- element1->second.GetLength() < tmp) {
- element2->second = element1->second + element2->second;
- result->erase(result->begin() + i);
- i--;
- mergeNum++;
- }
- }
- }
- if (mergeNum == 0) {
- return;
- }
- MergeString(result, versionNum, e);
- if (e != BCExceptionNO)
- return;
-}
-
-void CBC_QRCoderEncoder::InitQRCode(int32_t numInputBytes,
- int32_t versionNumber,
- CBC_QRCoderErrorCorrectionLevel* ecLevel,
- CBC_QRCoderMode* mode,
- CBC_QRCoder* qrCode,
- int32_t& e) {
- qrCode->SetECLevel(ecLevel);
- qrCode->SetMode(mode);
- CBC_QRCoderVersion* version =
- CBC_QRCoderVersion::GetVersionForNumber(versionNumber, e);
- if (e != BCExceptionNO)
- return;
- int32_t numBytes = version->GetTotalCodeWords();
- CBC_QRCoderECBlocks* ecBlocks = version->GetECBlocksForLevel(ecLevel);
- int32_t numEcBytes = ecBlocks->GetTotalECCodeWords();
- int32_t numRSBlocks = ecBlocks->GetNumBlocks();
- int32_t numDataBytes = numBytes - numEcBytes;
- if (numDataBytes < numInputBytes + 3) {
- e = BCExceptionCannotFindBlockInfo;
- return;
- }
- qrCode->SetVersion(versionNumber);
- qrCode->SetNumTotalBytes(numBytes);
- qrCode->SetNumDataBytes(numDataBytes);
- qrCode->SetNumRSBlocks(numRSBlocks);
- qrCode->SetNumECBytes(numEcBytes);
- qrCode->SetMatrixWidth(version->GetDimensionForVersion());
-}
-
-void CBC_QRCoderEncoder::EncodeWithSpecifyVersion(
- const CFX_ByteString& content,
- CBC_QRCoderErrorCorrectionLevel* ecLevel,
- CBC_QRCoder* qrCode,
- int32_t versionSpecify,
- int32_t& e) {
- CFX_ByteString encoding = "utf8";
- CBC_QRCoderMode* mode = CBC_QRCoderMode::sBYTE;
- std::vector<std::pair<CBC_QRCoderMode*, CFX_ByteString>> splitResult;
- CBC_QRCoderBitVector dataBits;
- dataBits.Init();
- SplitString(content, &splitResult);
- MergeString(&splitResult, versionSpecify, e);
- if (e != BCExceptionNO)
- return;
- CBC_QRCoderMode* tempMode = nullptr;
- for (const auto& result : splitResult) {
- AppendBytes(result.second, result.first, &dataBits, encoding, e);
- if (e != BCExceptionNO)
- return;
- }
- int32_t numInputBytes = dataBits.sizeInBytes();
- CBC_QRCoderBitVector headerAndDataBits;
- headerAndDataBits.Init();
- InitQRCode(numInputBytes, versionSpecify, ecLevel, mode, qrCode, e);
- if (e != BCExceptionNO)
- return;
-
- AppendDataModeLenghInfo(splitResult, headerAndDataBits, tempMode, qrCode,
- encoding, e);
- if (e != BCExceptionNO)
- return;
-
- numInputBytes = headerAndDataBits.sizeInBytes();
- TerminateBits(qrCode->GetNumDataBytes(), &headerAndDataBits, e);
- if (e != BCExceptionNO)
- return;
-
- CBC_QRCoderBitVector finalBits;
- finalBits.Init();
- InterleaveWithECBytes(&headerAndDataBits, qrCode->GetNumTotalBytes(),
- qrCode->GetNumDataBytes(), qrCode->GetNumRSBlocks(),
- &finalBits, e);
- if (e != BCExceptionNO)
- return;
-
- std::unique_ptr<CBC_CommonByteMatrix> matrix(new CBC_CommonByteMatrix(
- qrCode->GetMatrixWidth(), qrCode->GetMatrixWidth()));
- matrix->Init();
- int32_t maskPattern = ChooseMaskPattern(
- &finalBits, qrCode->GetECLevel(), qrCode->GetVersion(), matrix.get(), e);
- if (e != BCExceptionNO)
- return;
-
- qrCode->SetMaskPattern(maskPattern);
- CBC_QRCoderMatrixUtil::BuildMatrix(&finalBits, qrCode->GetECLevel(),
- qrCode->GetVersion(),
- qrCode->GetMaskPattern(), matrix.get(), e);
- if (e != BCExceptionNO)
- return;
-
- qrCode->SetMatrix(std::move(matrix));
- if (!qrCode->IsValid())
- e = BCExceptionInvalidQRCode;
-}
-
-void CBC_QRCoderEncoder::EncodeWithAutoVersion(
- const CFX_ByteString& content,
- CBC_QRCoderErrorCorrectionLevel* ecLevel,
- CBC_QRCoder* qrCode,
- int32_t& e) {
- CFX_ByteString encoding = "utf8";
- CBC_QRCoderMode* mode = CBC_QRCoderMode::sBYTE;
- std::vector<std::pair<CBC_QRCoderMode*, CFX_ByteString>> splitResult;
- CBC_QRCoderBitVector dataBits;
- dataBits.Init();
- SplitString(content, &splitResult);
- MergeString(&splitResult, 8, e);
- if (e != BCExceptionNO)
- return;
- CBC_QRCoderMode* tempMode = nullptr;
- for (const auto& result : splitResult) {
- AppendBytes(result.second, result.first, &dataBits, encoding, e);
- if (e != BCExceptionNO)
- return;
- }
- int32_t numInputBytes = dataBits.sizeInBytes();
- InitQRCode(numInputBytes, ecLevel, mode, qrCode, e);
- if (e != BCExceptionNO)
- return;
- CBC_QRCoderBitVector headerAndDataBits;
- headerAndDataBits.Init();
- tempMode = nullptr;
- int32_t versionNum = qrCode->GetVersion();
-sign:
- AppendDataModeLenghInfo(splitResult, headerAndDataBits, tempMode, qrCode,
- encoding, e);
- if (e != BCExceptionNO) {
- goto catchException;
- }
- numInputBytes = headerAndDataBits.sizeInBytes();
- TerminateBits(qrCode->GetNumDataBytes(), &headerAndDataBits, e);
- if (e != BCExceptionNO) {
- goto catchException;
- }
-catchException:
- if (e != BCExceptionNO) {
- int32_t e1 = BCExceptionNO;
- InitQRCode(numInputBytes, ecLevel, mode, qrCode, e1);
- if (e1 != BCExceptionNO) {
- e = e1;
- return;
- }
- versionNum++;
- if (versionNum <= 40) {
- headerAndDataBits.Clear();
- e = BCExceptionNO;
- goto sign;
- } else {
- return;
- }
- }
-
- CBC_QRCoderBitVector finalBits;
- finalBits.Init();
- InterleaveWithECBytes(&headerAndDataBits, qrCode->GetNumTotalBytes(),
- qrCode->GetNumDataBytes(), qrCode->GetNumRSBlocks(),
- &finalBits, e);
- if (e != BCExceptionNO)
- return;
-
- std::unique_ptr<CBC_CommonByteMatrix> matrix(new CBC_CommonByteMatrix(
- qrCode->GetMatrixWidth(), qrCode->GetMatrixWidth()));
- matrix->Init();
- int32_t maskPattern = ChooseMaskPattern(
- &finalBits, qrCode->GetECLevel(), qrCode->GetVersion(), matrix.get(), e);
- if (e != BCExceptionNO)
- return;
-
- qrCode->SetMaskPattern(maskPattern);
- CBC_QRCoderMatrixUtil::BuildMatrix(&finalBits, qrCode->GetECLevel(),
- qrCode->GetVersion(),
- qrCode->GetMaskPattern(), matrix.get(), e);
- if (e != BCExceptionNO)
- return qrCode->SetMatrix(std::move(matrix));
-
- if (!qrCode->IsValid())
- e = BCExceptionInvalidQRCode;
-}
-
-void CBC_QRCoderEncoder::Encode(const CFX_WideString& content,
- CBC_QRCoderErrorCorrectionLevel* ecLevel,
- CBC_QRCoder* qrCode,
- int32_t& e) {
- CFX_ByteString encoding = "utf8";
- CFX_ByteString utf8Data;
- CBC_UtilCodingConvert::UnicodeToUTF8(content, utf8Data);
- CBC_QRCoderMode* mode = ChooseMode(utf8Data, encoding);
- CBC_QRCoderBitVector dataBits;
- dataBits.Init();
- AppendBytes(utf8Data, mode, &dataBits, encoding, e);
- if (e != BCExceptionNO)
- return;
- int32_t numInputBytes = dataBits.sizeInBytes();
- InitQRCode(numInputBytes, ecLevel, mode, qrCode, e);
- if (e != BCExceptionNO)
- return;
- CBC_QRCoderBitVector headerAndDataBits;
- headerAndDataBits.Init();
- AppendModeInfo(mode, &headerAndDataBits, e);
- if (e != BCExceptionNO)
- return;
- int32_t numLetters = mode == CBC_QRCoderMode::sBYTE ? dataBits.sizeInBytes()
- : content.GetLength();
- AppendLengthInfo(numLetters, qrCode->GetVersion(), mode, &headerAndDataBits,
- e);
- if (e != BCExceptionNO)
- return;
- headerAndDataBits.AppendBitVector(&dataBits, e);
- if (e != BCExceptionNO)
- return TerminateBits(qrCode->GetNumDataBytes(), &headerAndDataBits, e);
- if (e != BCExceptionNO)
- return;
- CBC_QRCoderBitVector finalBits;
- finalBits.Init();
- InterleaveWithECBytes(&headerAndDataBits, qrCode->GetNumTotalBytes(),
- qrCode->GetNumDataBytes(), qrCode->GetNumRSBlocks(),
- &finalBits, e);
- if (e != BCExceptionNO)
- return;
-
- std::unique_ptr<CBC_CommonByteMatrix> matrix(new CBC_CommonByteMatrix(
- qrCode->GetMatrixWidth(), qrCode->GetMatrixWidth()));
- matrix->Init();
- int32_t maskPattern = ChooseMaskPattern(
- &finalBits, qrCode->GetECLevel(), qrCode->GetVersion(), matrix.get(), e);
- if (e != BCExceptionNO)
- return;
-
- qrCode->SetMaskPattern(maskPattern);
- CBC_QRCoderMatrixUtil::BuildMatrix(&finalBits, qrCode->GetECLevel(),
- qrCode->GetVersion(),
- qrCode->GetMaskPattern(), matrix.get(), e);
- if (e != BCExceptionNO)
- return qrCode->SetMatrix(std::move(matrix));
-
- if (!qrCode->IsValid())
- e = BCExceptionInvalidQRCode;
-}
-
-void CBC_QRCoderEncoder::TerminateBits(int32_t numDataBytes,
- CBC_QRCoderBitVector* bits,
- int32_t& e) {
- int32_t capacity = numDataBytes << 3;
- if (bits->Size() > capacity) {
- e = BCExceptionDataTooMany;
- return;
- }
- for (int32_t i = 0; i < 4 && bits->Size() < capacity; ++i) {
- bits->AppendBit(0, e);
- if (e != BCExceptionNO)
- return;
- }
- int32_t numBitsInLastByte = bits->Size() % 8;
- if (numBitsInLastByte > 0) {
- int32_t numPaddingBits = 8 - numBitsInLastByte;
- for (int32_t j = 0; j < numPaddingBits; ++j) {
- bits->AppendBit(0, e);
- if (e != BCExceptionNO)
- return;
- }
- }
- if (bits->Size() % 8 != 0) {
- e = BCExceptionDigitLengthMustBe8;
- return;
- }
- int32_t numPaddingBytes = numDataBytes - bits->sizeInBytes();
- for (int32_t k = 0; k < numPaddingBytes; ++k) {
- if (k % 2 == 0) {
- bits->AppendBits(0xec, 8, e);
- if (e != BCExceptionNO)
- return;
- } else {
- bits->AppendBits(0x11, 8, e);
- if (e != BCExceptionNO)
- return;
- }
- }
- if (bits->Size() != capacity)
- e = BCExceptionBitsNotEqualCacity;
-}
-
-int32_t CBC_QRCoderEncoder::ChooseMaskPattern(
- CBC_QRCoderBitVector* bits,
- CBC_QRCoderErrorCorrectionLevel* ecLevel,
- int32_t version,
- CBC_CommonByteMatrix* matrix,
- int32_t& e) {
- int32_t minPenalty = 65535;
- int32_t bestMaskPattern = -1;
- for (int32_t maskPattern = 0; maskPattern < CBC_QRCoder::kNumMaskPatterns;
- maskPattern++) {
- CBC_QRCoderMatrixUtil::BuildMatrix(bits, ecLevel, version, maskPattern,
- matrix, e);
- if (e != BCExceptionNO)
- return 0;
- int32_t penalty = CalculateMaskPenalty(matrix);
- if (penalty < minPenalty) {
- minPenalty = penalty;
- bestMaskPattern = maskPattern;
- }
- }
- return bestMaskPattern;
-}
-
-int32_t CBC_QRCoderEncoder::CalculateMaskPenalty(CBC_CommonByteMatrix* matrix) {
- int32_t penalty = 0;
- penalty += CBC_QRCoderMaskUtil::ApplyMaskPenaltyRule1(matrix);
- penalty += CBC_QRCoderMaskUtil::ApplyMaskPenaltyRule2(matrix);
- penalty += CBC_QRCoderMaskUtil::ApplyMaskPenaltyRule3(matrix);
- penalty += CBC_QRCoderMaskUtil::ApplyMaskPenaltyRule4(matrix);
- return penalty;
-}
-
-CBC_QRCoderMode* CBC_QRCoderEncoder::ChooseMode(const CFX_ByteString& content,
- CFX_ByteString encoding) {
- if (encoding.Compare("SHIFT_JIS") == 0) {
- return CBC_QRCoderMode::sKANJI;
- }
- bool hasNumeric = false;
- bool hasAlphaNumeric = false;
- for (int32_t i = 0; i < content.GetLength(); i++) {
- if (isdigit((uint8_t)content[i])) {
- hasNumeric = true;
- } else if (GetAlphaNumericCode((uint8_t)content[i]) != -1) {
- hasAlphaNumeric = true;
- } else {
- return CBC_QRCoderMode::sBYTE;
- }
- }
- if (hasAlphaNumeric) {
- return CBC_QRCoderMode::sALPHANUMERIC;
- } else if (hasNumeric) {
- return CBC_QRCoderMode::sNUMERIC;
- }
- return CBC_QRCoderMode::sBYTE;
-}
-
-int32_t CBC_QRCoderEncoder::GetAlphaNumericCode(int32_t code) {
- return (code >= 0 && code < 96) ? g_alphaNumericTable[code] : -1;
-}
-
-void CBC_QRCoderEncoder::AppendBytes(const CFX_ByteString& content,
- CBC_QRCoderMode* mode,
- CBC_QRCoderBitVector* bits,
- CFX_ByteString encoding,
- int32_t& e) {
- if (mode == CBC_QRCoderMode::sNUMERIC)
- AppendNumericBytes(content, bits, e);
- else if (mode == CBC_QRCoderMode::sALPHANUMERIC)
- AppendAlphaNumericBytes(content, bits, e);
- else if (mode == CBC_QRCoderMode::sBYTE)
- Append8BitBytes(content, bits, encoding, e);
- else if (mode == CBC_QRCoderMode::sKANJI)
- AppendKanjiBytes(content, bits, e);
- else if (mode == CBC_QRCoderMode::sGBK)
- AppendGBKBytes(content, bits, e);
- else
- e = BCExceptionUnsupportedMode;
-}
-
-void CBC_QRCoderEncoder::AppendNumericBytes(const CFX_ByteString& content,
- CBC_QRCoderBitVector* bits,
- int32_t& e) {
- int32_t length = content.GetLength();
- int32_t i = 0;
- while (i < length) {
- int32_t num1 = content[i] - '0';
- if (i + 2 < length) {
- int32_t num2 = content[i + 1] - '0';
- int32_t num3 = content[i + 2] - '0';
- bits->AppendBits(num1 * 100 + num2 * 10 + num3, 10, e);
- if (e != BCExceptionNO)
- return;
- i += 3;
- } else if (i + 1 < length) {
- int32_t num2 = content[i + 1] - '0';
- bits->AppendBits(num1 * 10 + num2, 7, e);
- if (e != BCExceptionNO)
- return;
- i += 2;
- } else {
- bits->AppendBits(num1, 4, e);
- if (e != BCExceptionNO)
- return;
- i++;
- }
- }
-}
-
-void CBC_QRCoderEncoder::AppendAlphaNumericBytes(const CFX_ByteString& content,
- CBC_QRCoderBitVector* bits,
- int32_t& e) {
- int32_t length = content.GetLength();
- int32_t i = 0;
- while (i < length) {
- int32_t code1 = GetAlphaNumericCode(content[i]);
- if (code1 == -1) {
- e = BCExceptionInvalidateCharacter;
- return;
- }
- if (i + 1 < length) {
- int32_t code2 = GetAlphaNumericCode(content[i + 1]);
- if (code2 == -1) {
- e = BCExceptionInvalidateCharacter;
- return;
- }
- bits->AppendBits(code1 * 45 + code2, 11, e);
- if (e != BCExceptionNO)
- return;
- i += 2;
- } else {
- bits->AppendBits(code1, 6, e);
- if (e != BCExceptionNO)
- return;
- i++;
- }
- }
-}
-
-void CBC_QRCoderEncoder::AppendGBKBytes(const CFX_ByteString& content,
- CBC_QRCoderBitVector* bits,
- int32_t& e) {
- int32_t length = content.GetLength();
- uint32_t value = 0;
- for (int32_t i = 0; i < length; i += 2) {
- value = (uint32_t)((uint8_t)content[i] << 8 | (uint8_t)content[i + 1]);
- if (value <= 0xAAFE && value >= 0xA1A1) {
- value -= 0xA1A1;
- } else if (value <= 0xFAFE && value >= 0xB0A1) {
- value -= 0xA6A1;
- } else {
- e = BCExceptionInvalidateCharacter;
- return;
- }
- value = (uint32_t)((value >> 8) * 0x60) + (uint32_t)(value & 0xff);
- bits->AppendBits(value, 13, e);
- if (e != BCExceptionNO)
- return;
- }
-}
-
-void CBC_QRCoderEncoder::Append8BitBytes(const CFX_ByteString& content,
- CBC_QRCoderBitVector* bits,
- CFX_ByteString encoding,
- int32_t& e) {
- for (int32_t i = 0; i < content.GetLength(); i++) {
- bits->AppendBits(content[i], 8, e);
- if (e != BCExceptionNO)
- return;
- }
-}
-
-void CBC_QRCoderEncoder::Append8BitBytes(CFX_ArrayTemplate<uint8_t>& bytes,
- CBC_QRCoderBitVector* bits,
- int32_t& e) {
- for (int32_t i = 0; i < bytes.GetSize(); i++) {
- bits->AppendBits(bytes[i], 8, e);
- if (e != BCExceptionNO)
- return;
- }
-}
-
-void CBC_QRCoderEncoder::AppendKanjiBytes(const CFX_ByteString& content,
- CBC_QRCoderBitVector* bits,
- int32_t& e) {
- CFX_ArrayTemplate<uint8_t> bytes;
- uint32_t value = 0;
- for (int32_t i = 0; i < bytes.GetSize(); i += 2) {
- value = (uint32_t)((uint8_t)(content[i] << 8) | (uint8_t)content[i + 1]);
- if (value <= 0x9ffc && value >= 0x8140) {
- value -= 0x8140;
- } else if (value <= 0xebbf && value >= 0xe040) {
- value -= 0xc140;
- } else {
- e = BCExceptionInvalidateCharacter;
- return;
- }
- value = (uint32_t)((value >> 8) * 0xc0) + (uint32_t)(value & 0xff);
- bits->AppendBits(value, 13, e);
- if (e != BCExceptionNO)
- return;
- }
-}
-
-void CBC_QRCoderEncoder::InitQRCode(int32_t numInputBytes,
- CBC_QRCoderErrorCorrectionLevel* ecLevel,
- CBC_QRCoderMode* mode,
- CBC_QRCoder* qrCode,
- int32_t& e) {
- qrCode->SetECLevel(ecLevel);
- qrCode->SetMode(mode);
- for (int32_t versionNum = 1; versionNum <= 40; versionNum++) {
- CBC_QRCoderVersion* version =
- CBC_QRCoderVersion::GetVersionForNumber(versionNum, e);
- if (e != BCExceptionNO)
- return;
- int32_t numBytes = version->GetTotalCodeWords();
- CBC_QRCoderECBlocks* ecBlocks = version->GetECBlocksForLevel(ecLevel);
- int32_t numEcBytes = ecBlocks->GetTotalECCodeWords();
- int32_t numRSBlocks = ecBlocks->GetNumBlocks();
- int32_t numDataBytes = numBytes - numEcBytes;
- if (numDataBytes >= numInputBytes + 3) {
- qrCode->SetVersion(versionNum);
- qrCode->SetNumTotalBytes(numBytes);
- qrCode->SetNumDataBytes(numDataBytes);
- qrCode->SetNumRSBlocks(numRSBlocks);
- qrCode->SetNumECBytes(numEcBytes);
- qrCode->SetMatrixWidth(version->GetDimensionForVersion());
- return;
- }
- }
- e = BCExceptionCannotFindBlockInfo;
-}
-
-void CBC_QRCoderEncoder::AppendModeInfo(CBC_QRCoderMode* mode,
- CBC_QRCoderBitVector* bits,
- int32_t& e) {
- bits->AppendBits(mode->GetBits(), 4, e);
- if (mode == CBC_QRCoderMode::sGBK)
- bits->AppendBits(1, 4, e);
-}
-
-void CBC_QRCoderEncoder::AppendLengthInfo(int32_t numLetters,
- int32_t version,
- CBC_QRCoderMode* mode,
- CBC_QRCoderBitVector* bits,
- int32_t& e) {
- CBC_QRCoderVersion* qcv = CBC_QRCoderVersion::GetVersionForNumber(version, e);
- if (e != BCExceptionNO)
- return;
- int32_t numBits = mode->GetCharacterCountBits(qcv, e);
- if (e != BCExceptionNO)
- return;
- if (numBits > ((1 << numBits) - 1)) {
- return;
- }
- if (mode == CBC_QRCoderMode::sGBK) {
- bits->AppendBits(numLetters / 2, numBits, e);
- if (e != BCExceptionNO)
- return;
- }
- bits->AppendBits(numLetters, numBits, e);
-}
-
-void CBC_QRCoderEncoder::InterleaveWithECBytes(CBC_QRCoderBitVector* bits,
- int32_t numTotalBytes,
- int32_t numDataBytes,
- int32_t numRSBlocks,
- CBC_QRCoderBitVector* result,
- int32_t& e) {
- if (bits->sizeInBytes() != numDataBytes) {
- e = BCExceptionBitsBytesNotMatch;
- return;
- }
- int32_t dataBytesOffset = 0;
- int32_t maxNumDataBytes = 0;
- int32_t maxNumEcBytes = 0;
- CFX_ArrayTemplate<CBC_QRCoderBlockPair*> blocks;
- int32_t i;
- for (i = 0; i < numRSBlocks; i++) {
- int32_t numDataBytesInBlock;
- int32_t numEcBytesInBlosk;
- GetNumDataBytesAndNumECBytesForBlockID(numTotalBytes, numDataBytes,
- numRSBlocks, i, numDataBytesInBlock,
- numEcBytesInBlosk);
- std::unique_ptr<CBC_CommonByteArray> dataBytes(new CBC_CommonByteArray);
- dataBytes->Set(bits->GetArray(), dataBytesOffset, numDataBytesInBlock);
- std::unique_ptr<CBC_CommonByteArray> ecBytes(
- GenerateECBytes(dataBytes.get(), numEcBytesInBlosk, e));
- if (e != BCExceptionNO)
- return;
- maxNumDataBytes = std::max(maxNumDataBytes, dataBytes->Size());
- maxNumEcBytes = std::max(maxNumEcBytes, ecBytes->Size());
- blocks.Add(
- new CBC_QRCoderBlockPair(std::move(dataBytes), std::move(ecBytes)));
- dataBytesOffset += numDataBytesInBlock;
- }
- if (numDataBytes != dataBytesOffset) {
- e = BCExceptionBytesNotMatchOffset;
- return;
- }
- for (int32_t x = 0; x < maxNumDataBytes; x++) {
- for (int32_t j = 0; j < blocks.GetSize(); j++) {
- const CBC_CommonByteArray* dataBytes = blocks[j]->GetDataBytes();
- if (x < dataBytes->Size()) {
- result->AppendBits(dataBytes->At(x), 8, e);
- if (e != BCExceptionNO)
- return;
- }
- }
- }
- for (int32_t y = 0; y < maxNumEcBytes; y++) {
- for (int32_t l = 0; l < blocks.GetSize(); l++) {
- const CBC_CommonByteArray* ecBytes = blocks[l]->GetErrorCorrectionBytes();
- if (y < ecBytes->Size()) {
- result->AppendBits(ecBytes->At(y), 8, e);
- if (e != BCExceptionNO)
- return;
- }
- }
- }
- for (int32_t k = 0; k < blocks.GetSize(); k++) {
- delete blocks[k];
- }
- if (numTotalBytes != result->sizeInBytes())
- e = BCExceptionSizeInBytesDiffer;
-}
-
-void CBC_QRCoderEncoder::GetNumDataBytesAndNumECBytesForBlockID(
- int32_t numTotalBytes,
- int32_t numDataBytes,
- int32_t numRSBlocks,
- int32_t blockID,
- int32_t& numDataBytesInBlock,
- int32_t& numECBytesInBlock) {
- if (blockID >= numRSBlocks) {
- return;
- }
- int32_t numRsBlocksInGroup2 = numTotalBytes % numRSBlocks;
- int32_t numRsBlocksInGroup1 = numRSBlocks - numRsBlocksInGroup2;
- int32_t numTotalBytesInGroup1 = numTotalBytes / numRSBlocks;
- int32_t numTotalBytesInGroup2 = numTotalBytesInGroup1 + 1;
- int32_t numDataBytesInGroup1 = numDataBytes / numRSBlocks;
- int32_t numDataBytesInGroup2 = numDataBytesInGroup1 + 1;
- int32_t numEcBytesInGroup1 = numTotalBytesInGroup1 - numDataBytesInGroup1;
- int32_t numEcBytesInGroup2 = numTotalBytesInGroup2 - numDataBytesInGroup2;
- if (blockID < numRsBlocksInGroup1) {
- numDataBytesInBlock = numDataBytesInGroup1;
- numECBytesInBlock = numEcBytesInGroup1;
- } else {
- numDataBytesInBlock = numDataBytesInGroup2;
- numECBytesInBlock = numEcBytesInGroup2;
- }
-}
-
-CBC_CommonByteArray* CBC_QRCoderEncoder::GenerateECBytes(
- CBC_CommonByteArray* dataBytes,
- int32_t numEcBytesInBlock,
- int32_t& e) {
- int32_t numDataBytes = dataBytes->Size();
- CFX_ArrayTemplate<int32_t> toEncode;
- toEncode.SetSize(numDataBytes + numEcBytesInBlock);
- for (int32_t i = 0; i < numDataBytes; i++) {
- toEncode[i] = (dataBytes->At(i));
- }
- CBC_ReedSolomonEncoder encode(CBC_ReedSolomonGF256::QRCodeField);
- encode.Init();
- encode.Encode(&toEncode, numEcBytesInBlock, e);
- if (e != BCExceptionNO)
- return nullptr;
- CBC_CommonByteArray* ecBytes = new CBC_CommonByteArray(numEcBytesInBlock);
- for (int32_t j = 0; j < numEcBytesInBlock; j++) {
- ecBytes->Set(j, toEncode[numDataBytes + j]);
- }
- return ecBytes;
-}
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderEncoder.h b/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderEncoder.h
deleted file mode 100644
index a1b078f24c9..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderEncoder.h
+++ /dev/null
@@ -1,140 +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 XFA_FXBARCODE_QRCODE_BC_QRCODERENCODER_H_
-#define XFA_FXBARCODE_QRCODE_BC_QRCODERENCODER_H_
-
-#include <utility>
-#include <vector>
-
-#include "core/fxcrt/fx_basic.h"
-#include "core/fxcrt/fx_string.h"
-
-class CBC_QRCoder;
-class CBC_QRCoderErrorCorrectionLevel;
-class CBC_QRCoderMode;
-class CBC_QRCoderBitVector;
-class CBC_CommonByteArray;
-class CBC_CommonByteMatrix;
-
-class CBC_QRCoderEncoder {
- public:
- CBC_QRCoderEncoder();
- virtual ~CBC_QRCoderEncoder();
-
- static void Encode(const CFX_ByteString& content,
- CBC_QRCoderErrorCorrectionLevel* ecLevel,
- CBC_QRCoder* qrCode,
- int32_t& e,
- int32_t versionSpecify = 0);
- static void Encode(const CFX_WideString& content,
- CBC_QRCoderErrorCorrectionLevel* ecLevel,
- CBC_QRCoder* qrCode,
- int32_t& e);
- static void EncodeWithSpecifyVersion(const CFX_ByteString& content,
- CBC_QRCoderErrorCorrectionLevel* ecLevel,
- CBC_QRCoder* qrCode,
- int32_t versionSpecify,
- int32_t& e);
- static void EncodeWithAutoVersion(const CFX_ByteString& content,
- CBC_QRCoderErrorCorrectionLevel* ecLevel,
- CBC_QRCoder* qrCode,
- int32_t& e);
- static CBC_QRCoderMode* ChooseMode(const CFX_ByteString& content,
- CFX_ByteString encoding);
- static int32_t GetAlphaNumericCode(int32_t code);
- static void AppendECI(CBC_QRCoderBitVector* bits);
- static void AppendBytes(const CFX_ByteString& content,
- CBC_QRCoderMode* mode,
- CBC_QRCoderBitVector* bits,
- CFX_ByteString encoding,
- int32_t& e);
- static void AppendNumericBytes(const CFX_ByteString& content,
- CBC_QRCoderBitVector* bits,
- int32_t& e);
- static void AppendAlphaNumericBytes(const CFX_ByteString& content,
- CBC_QRCoderBitVector* bits,
- int32_t& e);
- static void Append8BitBytes(const CFX_ByteString& content,
- CBC_QRCoderBitVector* bits,
- CFX_ByteString encoding,
- int32_t& e);
- static void Append8BitBytes(CFX_ArrayTemplate<uint8_t>& bytes,
- CBC_QRCoderBitVector* bits,
- int32_t& e);
- static void AppendKanjiBytes(const CFX_ByteString& content,
- CBC_QRCoderBitVector* bits,
- int32_t& e);
- static void AppendGBKBytes(const CFX_ByteString& content,
- CBC_QRCoderBitVector* bits,
- int32_t& e);
- static void InitQRCode(int32_t numInputBytes,
- int32_t versionNumber,
- CBC_QRCoderErrorCorrectionLevel* ecLevel,
- CBC_QRCoderMode* mode,
- CBC_QRCoder* qrCode,
- int32_t& e);
- static void InitQRCode(int32_t numInputBytes,
- CBC_QRCoderErrorCorrectionLevel* ecLevel,
- CBC_QRCoderMode* mode,
- CBC_QRCoder* qrCode,
- int32_t& e);
- static void AppendModeInfo(CBC_QRCoderMode* mode,
- CBC_QRCoderBitVector* bits,
- int32_t& e);
- static void AppendLengthInfo(int32_t numLetters,
- int32_t version,
- CBC_QRCoderMode* mode,
- CBC_QRCoderBitVector* bits,
- int32_t& e);
-
- static void InterleaveWithECBytes(CBC_QRCoderBitVector* bits,
- int32_t numTotalBytes,
- int32_t numDataBytes,
- int32_t numRSBlocks,
- CBC_QRCoderBitVector* result,
- int32_t& e);
- static void GetNumDataBytesAndNumECBytesForBlockID(
- int32_t numTotalBytes,
- int32_t numDataBytes,
- int32_t numRSBlocks,
- int32_t blockID,
- int32_t& numDataBytesInBlock,
- int32_t& numECBytesInBlocks);
- static CBC_CommonByteArray* GenerateECBytes(CBC_CommonByteArray* dataBytes,
- int32_t numEcBytesInBlock,
- int32_t& e);
- static int32_t ChooseMaskPattern(CBC_QRCoderBitVector* bits,
- CBC_QRCoderErrorCorrectionLevel* ecLevel,
- int32_t version,
- CBC_CommonByteMatrix* matrix,
- int32_t& e);
- static int32_t CalculateMaskPenalty(CBC_CommonByteMatrix* matrix);
- static void TerminateBits(int32_t numDataBytes,
- CBC_QRCoderBitVector* bits,
- int32_t& e);
- static int32_t GetSpanByVersion(CBC_QRCoderMode* modeFirst,
- CBC_QRCoderMode* modeSecond,
- int32_t versionNum,
- int32_t& e);
- static void MergeString(
- std::vector<std::pair<CBC_QRCoderMode*, CFX_ByteString>>* result,
- int32_t versionNum,
- int32_t& e);
- static void SplitString(
- const CFX_ByteString& content,
- std::vector<std::pair<CBC_QRCoderMode*, CFX_ByteString>>* result);
- static void AppendDataModeLenghInfo(
- const std::vector<std::pair<CBC_QRCoderMode*, CFX_ByteString>>&
- splitResult,
- CBC_QRCoderBitVector& headerAndDataBits,
- CBC_QRCoderMode* tempMode,
- CBC_QRCoder* qrCode,
- CFX_ByteString& encoding,
- int32_t& e);
-};
-
-#endif // XFA_FXBARCODE_QRCODE_BC_QRCODERENCODER_H_
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.cpp b/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.cpp
deleted file mode 100644
index a5450cf085d..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.cpp
+++ /dev/null
@@ -1,84 +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
-// Original code is licensed as follows:
-/*
- * Copyright 2007 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "xfa/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.h"
-
-CBC_QRCoderErrorCorrectionLevel* CBC_QRCoderErrorCorrectionLevel::L = nullptr;
-CBC_QRCoderErrorCorrectionLevel* CBC_QRCoderErrorCorrectionLevel::M = nullptr;
-CBC_QRCoderErrorCorrectionLevel* CBC_QRCoderErrorCorrectionLevel::Q = nullptr;
-CBC_QRCoderErrorCorrectionLevel* CBC_QRCoderErrorCorrectionLevel::H = nullptr;
-
-CBC_QRCoderErrorCorrectionLevel::CBC_QRCoderErrorCorrectionLevel(
- int32_t ordinal,
- int32_t bits,
- const FX_CHAR* name)
- : m_ordinal(ordinal), m_bits(bits), m_name(name) {}
-
-CBC_QRCoderErrorCorrectionLevel::~CBC_QRCoderErrorCorrectionLevel() {}
-
-void CBC_QRCoderErrorCorrectionLevel::Initialize() {
- L = new CBC_QRCoderErrorCorrectionLevel(0, 0x01, "L");
- M = new CBC_QRCoderErrorCorrectionLevel(1, 0x00, "M");
- Q = new CBC_QRCoderErrorCorrectionLevel(2, 0x03, "Q");
- H = new CBC_QRCoderErrorCorrectionLevel(3, 0x02, "H");
-}
-
-void CBC_QRCoderErrorCorrectionLevel::Finalize() {
- delete L;
- delete M;
- delete Q;
- delete H;
-}
-
-CBC_QRCoderErrorCorrectionLevel* CBC_QRCoderErrorCorrectionLevel::ForBits(
- int32_t bits) {
- switch (bits) {
- case 0x00:
- return M;
- case 0x01:
- return L;
- case 0x02:
- return H;
- case 0x03:
- return Q;
- default:
- return nullptr;
- }
-}
-void CBC_QRCoderErrorCorrectionLevel::Destroy() {
- if (L) {
- delete CBC_QRCoderErrorCorrectionLevel::L;
- L = nullptr;
- }
- if (M) {
- delete CBC_QRCoderErrorCorrectionLevel::M;
- M = nullptr;
- }
- if (H) {
- delete CBC_QRCoderErrorCorrectionLevel::H;
- H = nullptr;
- }
- if (Q) {
- delete CBC_QRCoderErrorCorrectionLevel::Q;
- Q = nullptr;
- }
-}
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.h b/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.h
deleted file mode 100644
index e433ee11272..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.h
+++ /dev/null
@@ -1,41 +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 XFA_FXBARCODE_QRCODE_BC_QRCODERERRORCORRECTIONLEVEL_H_
-#define XFA_FXBARCODE_QRCODE_BC_QRCODERERRORCORRECTIONLEVEL_H_
-
-#include "core/fxcrt/fx_string.h"
-
-class CBC_QRCoderErrorCorrectionLevel {
- public:
- static CBC_QRCoderErrorCorrectionLevel* L;
- static CBC_QRCoderErrorCorrectionLevel* M;
- static CBC_QRCoderErrorCorrectionLevel* Q;
- static CBC_QRCoderErrorCorrectionLevel* H;
-
- static void Initialize();
- static void Finalize();
- static void Destroy();
- static CBC_QRCoderErrorCorrectionLevel* ForBits(int32_t bits);
-
- ~CBC_QRCoderErrorCorrectionLevel();
-
- int32_t Ordinal() const { return m_ordinal; }
- int32_t GetBits() const { return m_bits; }
- CFX_ByteString GetName() const { return m_name; }
-
- private:
- CBC_QRCoderErrorCorrectionLevel(int32_t ordinal,
- int32_t bits,
- const FX_CHAR* name);
- CBC_QRCoderErrorCorrectionLevel();
-
- int32_t m_ordinal;
- int32_t m_bits;
- CFX_ByteString m_name;
-};
-
-#endif // XFA_FXBARCODE_QRCODE_BC_QRCODERERRORCORRECTIONLEVEL_H_
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderMaskUtil.cpp b/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderMaskUtil.cpp
deleted file mode 100644
index 7953701bb2c..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderMaskUtil.cpp
+++ /dev/null
@@ -1,198 +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
-// Original code is licensed as follows:
-/*
- * Copyright 2008 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "xfa/fxbarcode/common/BC_CommonByteMatrix.h"
-#include "xfa/fxbarcode/qrcode/BC_QRCoder.h"
-#include "xfa/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.h"
-#include "xfa/fxbarcode/qrcode/BC_QRCoderMaskUtil.h"
-#include "xfa/fxbarcode/utils.h"
-
-CBC_QRCoderMaskUtil::CBC_QRCoderMaskUtil() {}
-CBC_QRCoderMaskUtil::~CBC_QRCoderMaskUtil() {}
-int32_t CBC_QRCoderMaskUtil::ApplyMaskPenaltyRule1(
- CBC_CommonByteMatrix* matrix) {
- return ApplyMaskPenaltyRule1Internal(matrix, true) +
- ApplyMaskPenaltyRule1Internal(matrix, false);
-}
-
-int32_t CBC_QRCoderMaskUtil::ApplyMaskPenaltyRule2(
- CBC_CommonByteMatrix* matrix) {
- int32_t penalty = 0;
- uint8_t* array = matrix->GetArray();
- int32_t width = matrix->GetWidth();
- int32_t height = matrix->GetHeight();
- for (int32_t y = 0; y < height - 1; y++) {
- for (int32_t x = 0; x < width - 1; x++) {
- int32_t value = array[y * width + x];
- if (value == array[y * width + x + 1] &&
- value == array[(y + 1) * width + x] &&
- value == array[(y + 1) * width + x + 1]) {
- penalty++;
- }
- }
- }
- return 3 * penalty;
-}
-
-int32_t CBC_QRCoderMaskUtil::ApplyMaskPenaltyRule3(
- CBC_CommonByteMatrix* matrix) {
- int32_t penalty = 0;
- uint8_t* array = matrix->GetArray();
- int32_t width = matrix->GetWidth();
- int32_t height = matrix->GetHeight();
- for (int32_t y = 0; y < height; ++y) {
- for (int32_t x = 0; x < width; ++x) {
- if (x == 0 &&
- ((y >= 0 && y <= 6) || (y >= height - 7 && y <= height - 1))) {
- continue;
- }
- if (x == width - 7 && (y >= 0 && y <= 6)) {
- continue;
- }
- if (y == 0 &&
- ((x >= 0 && x <= 6) || (x >= width - 7 && x <= width - 1))) {
- continue;
- }
- if (y == height - 7 && (x >= 0 && x <= 6)) {
- continue;
- }
- if (x + 6 < width && array[y * width + x] == 1 &&
- array[y * width + x + 1] == 0 && array[y * width + x + 2] == 1 &&
- array[y * width + x + 3] == 1 && array[y * width + x + 4] == 1 &&
- array[y * width + x + 5] == 0 && array[y * width + x + 6] == 1 &&
- ((x + 10 < width && array[y * width + x + 7] == 0 &&
- array[y * width + x + 8] == 0 && array[y * width + x + 9] == 0 &&
- array[y * width + x + 10] == 0) ||
- (x - 4 >= 0 && array[y * width + x - 1] == 0 &&
- array[y * width + x - 2] == 0 && array[y * width + x - 3] == 0 &&
- array[y * width + x - 4] == 0))) {
- penalty += 40;
- }
- if (y + 6 < height && array[y * width + x] == 1 &&
- array[(y + 1) * width + x] == 0 && array[(y + 2) * width + x] == 1 &&
- array[(y + 3) * width + x] == 1 && array[(y + 4) * width + x] == 1 &&
- array[(y + 5) * width + x] == 0 && array[(y + 6) * width + x] == 1 &&
- ((y + 10 < height && array[(y + 7) * width + x] == 0 &&
- array[(y + 8) * width + x] == 0 &&
- array[(y + 9) * width + x] == 0 &&
- array[(y + 10) * width + x] == 0) ||
- (y - 4 >= 0 && array[(y - 1) * width + x] == 0 &&
- array[(y - 2) * width + x] == 0 &&
- array[(y - 3) * width + x] == 0 &&
- array[(y - 4) * width + x] == 0))) {
- penalty += 40;
- }
- }
- }
- return penalty;
-}
-int32_t CBC_QRCoderMaskUtil::ApplyMaskPenaltyRule4(
- CBC_CommonByteMatrix* matrix) {
- int32_t numDarkCells = 0;
- uint8_t* array = matrix->GetArray();
- int32_t width = matrix->GetWidth();
- int32_t height = matrix->GetHeight();
- for (int32_t y = 0; y < height; ++y) {
- for (int32_t x = 0; x < width; ++x) {
- if (array[y * width + x] == 1) {
- numDarkCells += 1;
- }
- }
- }
- int32_t numTotalCells = matrix->GetHeight() * matrix->GetWidth();
- double darkRatio = (double)numDarkCells / numTotalCells;
- return abs((int32_t)(darkRatio * 100 - 50) / 5) * 5 * 10;
-}
-bool CBC_QRCoderMaskUtil::GetDataMaskBit(int32_t maskPattern,
- int32_t x,
- int32_t y,
- int32_t& e) {
- if (!CBC_QRCoder::IsValidMaskPattern(maskPattern)) {
- e = (BCExceptionInvalidateMaskPattern);
- return false;
- }
- int32_t intermediate = 0, temp = 0;
- switch (maskPattern) {
- case 0:
- intermediate = (y + x) & 0x1;
- break;
- case 1:
- intermediate = y & 0x1;
- break;
- case 2:
- intermediate = x % 3;
- break;
- case 3:
- intermediate = (y + x) % 3;
- break;
- case 4:
- intermediate = ((y >> 1) + (x / 3)) & 0x1;
- break;
- case 5:
- temp = y * x;
- intermediate = (temp & 0x1) + (temp % 3);
- break;
- case 6:
- temp = y * x;
- intermediate = (((temp & 0x1) + (temp % 3)) & 0x1);
- break;
- case 7:
- temp = y * x;
- intermediate = (((temp % 3) + ((y + x) & 0x1)) & 0x1);
- break;
- default: {
- e = BCExceptionInvalidateMaskPattern;
- return false;
- }
- }
- return intermediate == 0;
-}
-int32_t CBC_QRCoderMaskUtil::ApplyMaskPenaltyRule1Internal(
- CBC_CommonByteMatrix* matrix,
- bool isHorizontal) {
- int32_t penalty = 0;
- int32_t numSameBitCells = 0;
- int32_t prevBit = -1;
- int32_t width = matrix->GetWidth();
- int32_t height = matrix->GetHeight();
- int32_t iLimit = isHorizontal ? height : width;
- int32_t jLimit = isHorizontal ? width : height;
- uint8_t* array = matrix->GetArray();
- for (int32_t i = 0; i < iLimit; ++i) {
- for (int32_t j = 0; j < jLimit; ++j) {
- int32_t bit = isHorizontal ? array[i * width + j] : array[j * width + i];
- if (bit == prevBit) {
- numSameBitCells += 1;
- if (numSameBitCells == 5) {
- penalty += 3;
- } else if (numSameBitCells > 5) {
- penalty += 1;
- }
- } else {
- numSameBitCells = 1;
- prevBit = bit;
- }
- }
- numSameBitCells = 0;
- }
- return penalty;
-}
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderMaskUtil.h b/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderMaskUtil.h
deleted file mode 100644
index 9fbe073e7e9..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderMaskUtil.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 XFA_FXBARCODE_QRCODE_BC_QRCODERMASKUTIL_H_
-#define XFA_FXBARCODE_QRCODE_BC_QRCODERMASKUTIL_H_
-class CBC_CommonByteMatrix;
-class CBC_QRCoderMaskUtil {
- public:
- CBC_QRCoderMaskUtil();
- virtual ~CBC_QRCoderMaskUtil();
- static bool GetDataMaskBit(int32_t maskPattern,
- int32_t x,
- int32_t y,
- int32_t& e);
-
- static int32_t ApplyMaskPenaltyRule1(CBC_CommonByteMatrix* matrix);
- static int32_t ApplyMaskPenaltyRule2(CBC_CommonByteMatrix* matrix);
- static int32_t ApplyMaskPenaltyRule3(CBC_CommonByteMatrix* matrix);
- static int32_t ApplyMaskPenaltyRule4(CBC_CommonByteMatrix* matrix);
- static int32_t ApplyMaskPenaltyRule1Internal(CBC_CommonByteMatrix* matrix,
- bool isHorizontal);
-};
-
-#endif // XFA_FXBARCODE_QRCODE_BC_QRCODERMASKUTIL_H_
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderMatrixUtil.cpp b/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderMatrixUtil.cpp
deleted file mode 100644
index d48d81c091b..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderMatrixUtil.cpp
+++ /dev/null
@@ -1,506 +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
-// Original code is licensed as follows:
-/*
- * Copyright 2008 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "xfa/fxbarcode/common/BC_CommonByteMatrix.h"
-#include "xfa/fxbarcode/qrcode/BC_QRCoder.h"
-#include "xfa/fxbarcode/qrcode/BC_QRCoderBitVector.h"
-#include "xfa/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.h"
-#include "xfa/fxbarcode/qrcode/BC_QRCoderMaskUtil.h"
-#include "xfa/fxbarcode/qrcode/BC_QRCoderMatrixUtil.h"
-#include "xfa/fxbarcode/utils.h"
-
-const int32_t CBC_QRCoderMatrixUtil::POSITION_DETECTION_PATTERN[7][7] = {
- {1, 1, 1, 1, 1, 1, 1}, {1, 0, 0, 0, 0, 0, 1}, {1, 0, 1, 1, 1, 0, 1},
- {1, 0, 1, 1, 1, 0, 1}, {1, 0, 1, 1, 1, 0, 1}, {1, 0, 0, 0, 0, 0, 1},
- {1, 1, 1, 1, 1, 1, 1}};
-const int32_t CBC_QRCoderMatrixUtil::HORIZONTAL_SEPARATION_PATTERN[1][8] = {
- {0, 0, 0, 0, 0, 0, 0, 0}};
-const int32_t CBC_QRCoderMatrixUtil::VERTICAL_SEPARATION_PATTERN[7][1] = {
- {0}, {0}, {0}, {0}, {0}, {0}, {0}};
-const int32_t CBC_QRCoderMatrixUtil::POSITION_ADJUSTMENT_PATTERN[5][5] = {
- {1, 1, 1, 1, 1},
- {1, 0, 0, 0, 1},
- {1, 0, 1, 0, 1},
- {1, 0, 0, 0, 1},
- {1, 1, 1, 1, 1}};
-const int32_t
- CBC_QRCoderMatrixUtil::POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[40][7] =
- // NOLINTNEXTLINE
- {
- {-1, -1, -1, -1, -1, -1, -1}, {6, 18, -1, -1, -1, -1, -1},
- {6, 22, -1, -1, -1, -1, -1}, {6, 26, -1, -1, -1, -1, -1},
- {6, 30, -1, -1, -1, -1, -1}, {6, 34, -1, -1, -1, -1, -1},
- {6, 22, 38, -1, -1, -1, -1}, {6, 24, 42, -1, -1, -1, -1},
- {6, 26, 46, -1, -1, -1, -1}, {6, 28, 50, -1, -1, -1, -1},
- {6, 30, 54, -1, -1, -1, -1}, {6, 32, 58, -1, -1, -1, -1},
- {6, 34, 62, -1, -1, -1, -1}, {6, 26, 46, 66, -1, -1, -1},
- {6, 26, 48, 70, -1, -1, -1}, {6, 26, 50, 74, -1, -1, -1},
- {6, 30, 54, 78, -1, -1, -1}, {6, 30, 56, 82, -1, -1, -1},
- {6, 30, 58, 86, -1, -1, -1}, {6, 34, 62, 90, -1, -1, -1},
- {6, 28, 50, 72, 94, -1, -1}, {6, 26, 50, 74, 98, -1, -1},
- {6, 30, 54, 78, 102, -1, -1}, {6, 28, 54, 80, 106, -1, -1},
- {6, 32, 58, 84, 110, -1, -1}, {6, 30, 58, 86, 114, -1, -1},
- {6, 34, 62, 90, 118, -1, -1}, {6, 26, 50, 74, 98, 122, -1},
- {6, 30, 54, 78, 102, 126, -1}, {6, 26, 52, 78, 104, 130, -1},
- {6, 30, 56, 82, 108, 134, -1}, {6, 34, 60, 86, 112, 138, -1},
- {6, 30, 58, 86, 114, 142, -1}, {6, 34, 62, 90, 118, 146, -1},
- {6, 30, 54, 78, 102, 126, 150}, {6, 24, 50, 76, 102, 128, 154},
- {6, 28, 54, 80, 106, 132, 158}, {6, 32, 58, 84, 110, 136, 162},
- {6, 26, 54, 82, 110, 138, 166}, {6, 30, 58, 86, 114, 142, 170},
-};
-const int32_t CBC_QRCoderMatrixUtil::TYPE_INFO_COORDINATES[15][2] = {
- {8, 0}, {8, 1}, {8, 2}, {8, 3}, {8, 4}, {8, 5}, {8, 7}, {8, 8},
- {7, 8}, {5, 8}, {4, 8}, {3, 8}, {2, 8}, {1, 8}, {0, 8},
-};
-const int32_t CBC_QRCoderMatrixUtil::VERSION_INFO_POLY = 0x1f25;
-const int32_t CBC_QRCoderMatrixUtil::TYPE_INFO_POLY = 0x0537;
-const int32_t CBC_QRCoderMatrixUtil::TYPE_INFO_MASK_PATTERN = 0x5412;
-
-void CBC_QRCoderMatrixUtil::ClearMatrix(CBC_CommonByteMatrix* matrix,
- int32_t& e) {
- if (!matrix) {
- e = BCExceptionNullPointer;
- return;
- }
- matrix->clear((uint8_t)-1);
-}
-void CBC_QRCoderMatrixUtil::BuildMatrix(
- CBC_QRCoderBitVector* dataBits,
- CBC_QRCoderErrorCorrectionLevel* ecLevel,
- int32_t version,
- int32_t maskPattern,
- CBC_CommonByteMatrix* matrix,
- int32_t& e) {
- if (!matrix) {
- e = BCExceptionNullPointer;
- return;
- }
- ClearMatrix(matrix, e);
- if (e != BCExceptionNO)
- return;
- EmbedBasicPatterns(version, matrix, e);
- if (e != BCExceptionNO)
- return;
- EmbedTypeInfo(ecLevel, maskPattern, matrix, e);
- if (e != BCExceptionNO)
- return;
- MaybeEmbedVersionInfo(version, matrix, e);
- if (e != BCExceptionNO)
- return;
- EmbedDataBits(dataBits, maskPattern, matrix, e);
- if (e != BCExceptionNO)
- return;
-}
-void CBC_QRCoderMatrixUtil::EmbedBasicPatterns(int32_t version,
- CBC_CommonByteMatrix* matrix,
- int32_t& e) {
- if (!matrix) {
- e = BCExceptionNullPointer;
- return;
- }
- EmbedPositionDetectionPatternsAndSeparators(matrix, e);
- if (e != BCExceptionNO)
- return;
- EmbedDarkDotAtLeftBottomCorner(matrix, e);
- if (e != BCExceptionNO)
- return;
- MaybeEmbedPositionAdjustmentPatterns(version, matrix, e);
- if (e != BCExceptionNO)
- return;
- EmbedTimingPatterns(matrix, e);
- if (e != BCExceptionNO)
- return;
-}
-void CBC_QRCoderMatrixUtil::EmbedTypeInfo(
- CBC_QRCoderErrorCorrectionLevel* ecLevel,
- int32_t maskPattern,
- CBC_CommonByteMatrix* matrix,
- int32_t& e) {
- if (!matrix) {
- e = BCExceptionNullPointer;
- return;
- }
- CBC_QRCoderBitVector typeInfoBits;
- typeInfoBits.Init();
- MakeTypeInfoBits(ecLevel, maskPattern, &typeInfoBits, e);
- if (e != BCExceptionNO)
- return;
- for (int32_t i = 0; i < typeInfoBits.Size(); i++) {
- int32_t bit = typeInfoBits.At(typeInfoBits.Size() - 1 - i, e);
- if (e != BCExceptionNO)
- return;
- int32_t x1 = TYPE_INFO_COORDINATES[i][0];
- int32_t y1 = TYPE_INFO_COORDINATES[i][1];
- matrix->Set(x1, y1, bit);
- if (i < 8) {
- int32_t x2 = matrix->GetWidth() - i - 1;
- int32_t y2 = 8;
- matrix->Set(x2, y2, bit);
- } else {
- int32_t x2 = 8;
- int32_t y2 = matrix->GetHeight() - 7 + (i - 8);
- matrix->Set(x2, y2, bit);
- }
- }
-}
-void CBC_QRCoderMatrixUtil::MaybeEmbedVersionInfo(int32_t version,
- CBC_CommonByteMatrix* matrix,
- int32_t& e) {
- if (!matrix) {
- e = BCExceptionNullPointer;
- return;
- }
- if (version < 7) {
- return;
- }
- CBC_QRCoderBitVector versionInfoBits;
- versionInfoBits.Init();
- MakeVersionInfoBits(version, &versionInfoBits, e);
- if (e != BCExceptionNO)
- return;
- int32_t bitIndex = 6 * 3 - 1;
- for (int32_t i = 0; i < 6; i++) {
- for (int32_t j = 0; j < 3; j++) {
- int32_t bit = versionInfoBits.At(bitIndex, e);
- if (e != BCExceptionNO)
- return;
- bitIndex--;
- matrix->Set(i, matrix->GetHeight() - 11 + j, bit);
- matrix->Set(matrix->GetHeight() - 11 + j, i, bit);
- }
- }
-}
-void CBC_QRCoderMatrixUtil::EmbedDataBits(CBC_QRCoderBitVector* dataBits,
- int32_t maskPattern,
- CBC_CommonByteMatrix* matrix,
- int32_t& e) {
- if (!matrix || !dataBits) {
- e = BCExceptionNullPointer;
- return;
- }
- int32_t bitIndex = 0;
- int32_t direction = -1;
- int32_t x = matrix->GetWidth() - 1;
- int32_t y = matrix->GetHeight() - 1;
- while (x > 0) {
- if (x == 6) {
- x -= 1;
- }
- while (y >= 0 && y < matrix->GetHeight()) {
- if (y == 6) {
- y += direction;
- continue;
- }
- for (int32_t i = 0; i < 2; i++) {
- int32_t xx = x - i;
- if (!IsEmpty(matrix->Get(xx, y))) {
- continue;
- }
- int32_t bit;
- if (bitIndex < dataBits->Size()) {
- bit = dataBits->At(bitIndex, e);
- if (e != BCExceptionNO)
- return;
- bitIndex++;
- } else {
- bit = 0;
- }
- if (maskPattern != -1) {
- bool bol = CBC_QRCoderMaskUtil::GetDataMaskBit(maskPattern, xx, y, e);
- if (e != BCExceptionNO)
- return;
- if (bol) {
- bit ^= 0x01;
- }
- }
- matrix->Set(xx, y, bit);
- }
- y += direction;
- }
- direction = -direction;
- y += direction;
- x -= 2;
- }
- if (bitIndex != dataBits->Size()) {
- return;
- }
-}
-int32_t CBC_QRCoderMatrixUtil::CalculateBCHCode(int32_t value, int32_t poly) {
- int32_t msbSetInPoly = FindMSBSet(poly);
- value <<= msbSetInPoly - 1;
- while (FindMSBSet(value) >= msbSetInPoly) {
- value ^= poly << (FindMSBSet(value) - msbSetInPoly);
- }
- return value;
-}
-void CBC_QRCoderMatrixUtil::MakeTypeInfoBits(
- CBC_QRCoderErrorCorrectionLevel* ecLevel,
- int32_t maskPattern,
- CBC_QRCoderBitVector* bits,
- int32_t& e) {
- if (!bits) {
- e = BCExceptionNullPointer;
- return;
- }
- if (!CBC_QRCoder::IsValidMaskPattern(maskPattern)) {
- e = BCExceptionBadMask;
- return;
- }
- int32_t typeInfo = (ecLevel->GetBits() << 3) | maskPattern;
- if (e != BCExceptionNO)
- return;
- bits->AppendBits(typeInfo, 5, e);
- int32_t bchCode = CalculateBCHCode(typeInfo, TYPE_INFO_POLY);
- if (e != BCExceptionNO)
- return;
- bits->AppendBits(bchCode, 10, e);
- CBC_QRCoderBitVector maskBits;
- maskBits.Init();
- maskBits.AppendBits(TYPE_INFO_MASK_PATTERN, 15, e);
- if (e != BCExceptionNO)
- return;
- bits->XOR(&maskBits, e);
- if (e != BCExceptionNO)
- return;
- if (bits->Size() != 15)
- e = BCExceptionBitSizeNot15;
-}
-
-void CBC_QRCoderMatrixUtil::MakeVersionInfoBits(int32_t version,
- CBC_QRCoderBitVector* bits,
- int32_t& e) {
- if (!bits) {
- e = BCExceptionNullPointer;
- return;
- }
- bits->AppendBits(version, 6, e);
- if (e != BCExceptionNO)
- return;
-
- int32_t bchCode = CalculateBCHCode(version, VERSION_INFO_POLY);
- bits->AppendBits(bchCode, 12, e);
- if (e != BCExceptionNO)
- return;
-
- if (bits->Size() != 18)
- e = BCExceptionBitSizeNot18;
-}
-
-bool CBC_QRCoderMatrixUtil::IsEmpty(int32_t value) {
- return (uint8_t)value == 0xff;
-}
-bool CBC_QRCoderMatrixUtil::IsValidValue(int32_t value) {
- return ((uint8_t)value == 0xff || (uint8_t)value == 0x00 ||
- (uint8_t)value == 0x01);
-}
-
-void CBC_QRCoderMatrixUtil::EmbedTimingPatterns(CBC_CommonByteMatrix* matrix,
- int32_t& e) {
- if (!matrix) {
- e = BCExceptionNullPointer;
- return;
- }
- for (int32_t i = 8; i < matrix->GetWidth() - 8; i++) {
- int32_t bit = (i + 1) % 2;
- if (!IsValidValue(matrix->Get(i, 6))) {
- e = BCExceptionInvalidateImageData;
- return;
- }
- if (IsEmpty(matrix->Get(i, 6))) {
- matrix->Set(i, 6, bit);
- }
- if (!IsValidValue(matrix->Get(6, i))) {
- e = BCExceptionInvalidateImageData;
- return;
- }
- if (IsEmpty(matrix->Get(6, i))) {
- matrix->Set(6, i, bit);
- }
- }
-}
-void CBC_QRCoderMatrixUtil::EmbedDarkDotAtLeftBottomCorner(
- CBC_CommonByteMatrix* matrix,
- int32_t& e) {
- if (!matrix) {
- e = BCExceptionNullPointer;
- return;
- }
- if (matrix->Get(8, matrix->GetHeight() - 8) == 0) {
- e = BCExceptionHeight_8BeZero;
- return;
- }
- matrix->Set(8, matrix->GetHeight() - 8, 1);
-}
-void CBC_QRCoderMatrixUtil::EmbedHorizontalSeparationPattern(
- int32_t xStart,
- int32_t yStart,
- CBC_CommonByteMatrix* matrix,
- int32_t& e) {
- if (!matrix) {
- e = BCExceptionNullPointer;
- return;
- }
- for (int32_t x = 0; x < 8; x++) {
- if (!IsEmpty(matrix->Get(xStart + x, yStart))) {
- e = BCExceptionInvalidateData;
- return;
- }
- matrix->Set(xStart + x, yStart, HORIZONTAL_SEPARATION_PATTERN[0][x]);
- }
-}
-void CBC_QRCoderMatrixUtil::EmbedVerticalSeparationPattern(
- int32_t xStart,
- int32_t yStart,
- CBC_CommonByteMatrix* matrix,
- int32_t& e) {
- if (!matrix) {
- e = BCExceptionNullPointer;
- return;
- }
- for (int32_t y = 0; y < 7; y++) {
- if (!IsEmpty(matrix->Get(xStart, yStart + y))) {
- e = BCExceptionInvalidateData;
- return;
- }
- matrix->Set(xStart, yStart + y, VERTICAL_SEPARATION_PATTERN[y][0]);
- }
-}
-void CBC_QRCoderMatrixUtil::EmbedPositionAdjustmentPattern(
- int32_t xStart,
- int32_t yStart,
- CBC_CommonByteMatrix* matrix,
- int32_t& e) {
- if (!matrix) {
- e = BCExceptionNullPointer;
- if (e != BCExceptionNO)
- return;
- }
- for (int32_t y = 0; y < 5; y++) {
- for (int32_t x = 0; x < 5; x++) {
- if (!IsEmpty(matrix->Get(xStart + x, y + yStart))) {
- e = BCExceptionInvalidateData;
- return;
- }
- matrix->Set(xStart + x, yStart + y, POSITION_ADJUSTMENT_PATTERN[y][x]);
- }
- }
-}
-void CBC_QRCoderMatrixUtil::EmbedPositionDetectionPattern(
- int32_t xStart,
- int32_t yStart,
- CBC_CommonByteMatrix* matrix,
- int32_t& e) {
- if (!matrix) {
- e = BCExceptionNullPointer;
- return;
- }
- for (int32_t y = 0; y < 7; y++) {
- for (int32_t x = 0; x < 7; x++) {
- if (!IsEmpty(matrix->Get(xStart + x, yStart + y))) {
- e = BCExceptionInvalidateData;
- return;
- }
- matrix->Set(xStart + x, yStart + y, POSITION_DETECTION_PATTERN[y][x]);
- }
- }
-}
-void CBC_QRCoderMatrixUtil::EmbedPositionDetectionPatternsAndSeparators(
- CBC_CommonByteMatrix* matrix,
- int32_t& e) {
- if (!matrix) {
- e = BCExceptionNullPointer;
- return;
- }
- int32_t pdpWidth = 7;
- EmbedPositionDetectionPattern(0, 0, matrix, e);
- if (e != BCExceptionNO)
- return;
- EmbedPositionDetectionPattern(matrix->GetWidth() - pdpWidth, 0, matrix, e);
- if (e != BCExceptionNO)
- return;
- EmbedPositionDetectionPattern(0, matrix->GetWidth() - pdpWidth, matrix, e);
- if (e != BCExceptionNO)
- return;
- int32_t hspWidth = 8;
- EmbedHorizontalSeparationPattern(0, hspWidth - 1, matrix, e);
- if (e != BCExceptionNO)
- return;
- EmbedHorizontalSeparationPattern(matrix->GetWidth() - hspWidth, hspWidth - 1,
- matrix, e);
- if (e != BCExceptionNO)
- return;
- EmbedHorizontalSeparationPattern(0, matrix->GetWidth() - hspWidth, matrix, e);
- if (e != BCExceptionNO)
- return;
- int32_t vspSize = 7;
- EmbedVerticalSeparationPattern(vspSize, 0, matrix, e);
- if (e != BCExceptionNO)
- return;
- EmbedVerticalSeparationPattern(matrix->GetHeight() - vspSize - 1, 0, matrix,
- e);
- if (e != BCExceptionNO)
- return;
- EmbedVerticalSeparationPattern(vspSize, matrix->GetHeight() - vspSize, matrix,
- e);
- if (e != BCExceptionNO)
- return;
-}
-void CBC_QRCoderMatrixUtil::MaybeEmbedPositionAdjustmentPatterns(
- int32_t version,
- CBC_CommonByteMatrix* matrix,
- int32_t& e) {
- if (!matrix) {
- e = BCExceptionNullPointer;
- return;
- }
- if (version < 2) {
- return;
- }
- int32_t index = version - 1;
- int32_t const* coordinates =
- &(POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[index][0]);
- int32_t numCoordinate = 7;
- for (int32_t i = 0; i < numCoordinate; i++) {
- for (int32_t j = 0; j < numCoordinate; j++) {
- int32_t y = coordinates[i];
- int32_t x = coordinates[j];
- if (x == -1 || y == -1) {
- continue;
- }
- if (IsEmpty(matrix->Get(x, y))) {
- EmbedPositionAdjustmentPattern(x - 2, y - 2, matrix, e);
- if (e != BCExceptionNO)
- return;
- }
- }
- }
-}
-int32_t CBC_QRCoderMatrixUtil::FindMSBSet(int32_t value) {
- int32_t numDigits = 0;
- while (value != 0) {
- value >>= 1;
- ++numDigits;
- }
- return numDigits;
-}
-CBC_QRCoderMatrixUtil::CBC_QRCoderMatrixUtil() {}
-CBC_QRCoderMatrixUtil::~CBC_QRCoderMatrixUtil() {}
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderMatrixUtil.h b/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderMatrixUtil.h
deleted file mode 100644
index 3ce4b7510be..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderMatrixUtil.h
+++ /dev/null
@@ -1,87 +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 XFA_FXBARCODE_QRCODE_BC_QRCODERMATRIXUTIL_H_
-#define XFA_FXBARCODE_QRCODE_BC_QRCODERMATRIXUTIL_H_
-
-class CBC_CommonByteMatrix;
-class CBC_QRCoderErrorCorrectionLevel;
-class CBC_QRCoderBitVector;
-class CBC_QRCoderMatrixUtil {
- private:
- static const int32_t POSITION_DETECTION_PATTERN[7][7];
- static const int32_t VERTICAL_SEPARATION_PATTERN[7][1];
- static const int32_t HORIZONTAL_SEPARATION_PATTERN[1][8];
- static const int32_t POSITION_ADJUSTMENT_PATTERN[5][5];
- static const int32_t POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[40][7];
- static const int32_t TYPE_INFO_COORDINATES[15][2];
- static const int32_t VERSION_INFO_POLY;
- static const int32_t TYPE_INFO_POLY;
- static const int32_t TYPE_INFO_MASK_PATTERN;
-
- public:
- CBC_QRCoderMatrixUtil();
- virtual ~CBC_QRCoderMatrixUtil();
- static void ClearMatrix(CBC_CommonByteMatrix* matrix, int32_t& e);
- static void BuildMatrix(CBC_QRCoderBitVector* dataBits,
- CBC_QRCoderErrorCorrectionLevel* ecLevel,
- int32_t version,
- int32_t maskPattern,
- CBC_CommonByteMatrix* matrix,
- int32_t& e);
- static void EmbedBasicPatterns(int32_t version,
- CBC_CommonByteMatrix* matrix,
- int32_t& e);
- static void EmbedTypeInfo(CBC_QRCoderErrorCorrectionLevel* ecLevel,
- int32_t maskPattern,
- CBC_CommonByteMatrix* matrix,
- int32_t& e);
- static void EmbedDataBits(CBC_QRCoderBitVector* dataBits,
- int32_t maskPattern,
- CBC_CommonByteMatrix* matrix,
- int32_t& e);
- static void MaybeEmbedVersionInfo(int32_t version,
- CBC_CommonByteMatrix* matrix,
- int32_t& e);
- static int32_t FindMSBSet(int32_t value);
- static int32_t CalculateBCHCode(int32_t code, int32_t poly);
- static void MakeTypeInfoBits(CBC_QRCoderErrorCorrectionLevel* ecLevel,
- int32_t maskPattern,
- CBC_QRCoderBitVector* bits,
- int32_t& e);
- static void MakeVersionInfoBits(int32_t version,
- CBC_QRCoderBitVector* bits,
- int32_t& e);
- static bool IsEmpty(int32_t value);
- static bool IsValidValue(int32_t value);
- static void EmbedTimingPatterns(CBC_CommonByteMatrix* matrix, int32_t& e);
- static void EmbedDarkDotAtLeftBottomCorner(CBC_CommonByteMatrix* matrix,
- int32_t& e);
- static void EmbedHorizontalSeparationPattern(int32_t xStart,
- int32_t yStart,
- CBC_CommonByteMatrix* matrix,
- int32_t& e);
- static void EmbedVerticalSeparationPattern(int32_t xStart,
- int32_t yStart,
- CBC_CommonByteMatrix* matrix,
- int32_t& e);
- static void EmbedPositionAdjustmentPattern(int32_t xStart,
- int32_t yStart,
- CBC_CommonByteMatrix* matrix,
- int32_t& e);
- static void EmbedPositionDetectionPattern(int32_t xStart,
- int32_t yStart,
- CBC_CommonByteMatrix* matrix,
- int32_t& e);
- static void EmbedPositionDetectionPatternsAndSeparators(
- CBC_CommonByteMatrix* matrix,
- int32_t& e);
- static void MaybeEmbedPositionAdjustmentPatterns(int32_t version,
- CBC_CommonByteMatrix* matrix,
- int32_t& e);
-};
-
-#endif // XFA_FXBARCODE_QRCODE_BC_QRCODERMATRIXUTIL_H_
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderMode.cpp b/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderMode.cpp
deleted file mode 100644
index a1283dda936..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderMode.cpp
+++ /dev/null
@@ -1,174 +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
-// Original code is licensed as follows:
-/*
- * Copyright 2007 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "xfa/fxbarcode/qrcode/BC_QRCoderMode.h"
-
-#include <utility>
-
-#include "xfa/fxbarcode/qrcode/BC_QRCoderVersion.h"
-#include "xfa/fxbarcode/utils.h"
-
-CBC_QRCoderMode* CBC_QRCoderMode::sBYTE = nullptr;
-CBC_QRCoderMode* CBC_QRCoderMode::sNUMERIC = nullptr;
-CBC_QRCoderMode* CBC_QRCoderMode::sALPHANUMERIC = nullptr;
-CBC_QRCoderMode* CBC_QRCoderMode::sKANJI = nullptr;
-CBC_QRCoderMode* CBC_QRCoderMode::sECI = nullptr;
-CBC_QRCoderMode* CBC_QRCoderMode::sGBK = nullptr;
-CBC_QRCoderMode* CBC_QRCoderMode::sTERMINATOR = nullptr;
-CBC_QRCoderMode* CBC_QRCoderMode::sFNC1_FIRST_POSITION = nullptr;
-CBC_QRCoderMode* CBC_QRCoderMode::sFNC1_SECOND_POSITION = nullptr;
-CBC_QRCoderMode* CBC_QRCoderMode::sSTRUCTURED_APPEND = nullptr;
-
-CBC_QRCoderMode::CBC_QRCoderMode(std::vector<int32_t> charCountBits,
- int32_t bits,
- CFX_ByteString name)
- : m_characterCountBitsForVersions(std::move(charCountBits)),
- m_bits(bits),
- m_name(name) {}
-
-CBC_QRCoderMode::~CBC_QRCoderMode() {}
-
-void CBC_QRCoderMode::Initialize() {
- sBYTE = new CBC_QRCoderMode({8, 16, 16}, 0x4, "BYTE");
- sALPHANUMERIC = new CBC_QRCoderMode({9, 11, 13}, 0x2, "ALPHANUMERIC");
- sECI = new CBC_QRCoderMode(std::vector<int32_t>(), 0x7, "ECI");
- sKANJI = new CBC_QRCoderMode({8, 10, 12}, 0x8, "KANJI");
- sNUMERIC = new CBC_QRCoderMode({10, 12, 14}, 0x1, "NUMERIC");
- sGBK = new CBC_QRCoderMode({8, 10, 12}, 0x0D, "GBK");
- sTERMINATOR = new CBC_QRCoderMode(std::vector<int32_t>(), 0x00, "TERMINATOR");
- sFNC1_FIRST_POSITION =
- new CBC_QRCoderMode(std::vector<int32_t>(), 0x05, "FNC1_FIRST_POSITION");
- sFNC1_SECOND_POSITION =
- new CBC_QRCoderMode(std::vector<int32_t>(), 0x09, "FNC1_SECOND_POSITION");
- sSTRUCTURED_APPEND =
- new CBC_QRCoderMode(std::vector<int32_t>(), 0x03, "STRUCTURED_APPEND");
-}
-
-void CBC_QRCoderMode::Finalize() {
- delete sBYTE;
- delete sALPHANUMERIC;
- delete sECI;
- delete sKANJI;
- delete sNUMERIC;
- delete sGBK;
- delete sTERMINATOR;
- delete sFNC1_FIRST_POSITION;
- delete sFNC1_SECOND_POSITION;
- delete sSTRUCTURED_APPEND;
-}
-
-CBC_QRCoderMode* CBC_QRCoderMode::ForBits(int32_t bits, int32_t& e) {
- switch (bits) {
- case 0x0:
- return sTERMINATOR;
- case 0x1:
- return sNUMERIC;
- case 0x2:
- return sALPHANUMERIC;
- case 0x3:
- return sSTRUCTURED_APPEND;
- case 0x4:
- return sBYTE;
- case 0x5:
- return sFNC1_FIRST_POSITION;
- case 0x7:
- return sECI;
- case 0x8:
- return sKANJI;
- case 0x9:
- return sFNC1_SECOND_POSITION;
- case 0x0D:
- return sGBK;
- default:
- e = BCExceptionUnsupportedMode;
- return nullptr;
- }
-}
-
-int32_t CBC_QRCoderMode::GetBits() const {
- return m_bits;
-}
-
-CFX_ByteString CBC_QRCoderMode::GetName() const {
- return m_name;
-}
-
-int32_t CBC_QRCoderMode::GetCharacterCountBits(CBC_QRCoderVersion* version,
- int32_t& e) const {
- if (m_characterCountBitsForVersions.empty()) {
- e = BCExceptionCharacterNotThisMode;
- return 0;
- }
- int32_t number = version->GetVersionNumber();
- int32_t offset;
- if (number <= 9) {
- offset = 0;
- } else if (number <= 26) {
- offset = 1;
- } else {
- offset = 2;
- }
- return m_characterCountBitsForVersions[offset];
-}
-
-void CBC_QRCoderMode::Destroy() {
- if (sBYTE) {
- delete CBC_QRCoderMode::sBYTE;
- sBYTE = nullptr;
- }
- if (sNUMERIC) {
- delete CBC_QRCoderMode::sNUMERIC;
- sNUMERIC = nullptr;
- }
- if (sALPHANUMERIC) {
- delete CBC_QRCoderMode::sALPHANUMERIC;
- sALPHANUMERIC = nullptr;
- }
- if (sKANJI) {
- delete CBC_QRCoderMode::sKANJI;
- sKANJI = nullptr;
- }
- if (sECI) {
- delete CBC_QRCoderMode::sECI;
- sECI = nullptr;
- }
- if (sGBK) {
- delete CBC_QRCoderMode::sGBK;
- sGBK = nullptr;
- }
- if (sTERMINATOR) {
- delete CBC_QRCoderMode::sTERMINATOR;
- sTERMINATOR = nullptr;
- }
- if (sFNC1_FIRST_POSITION) {
- delete CBC_QRCoderMode::sFNC1_FIRST_POSITION;
- sFNC1_FIRST_POSITION = nullptr;
- }
- if (sFNC1_SECOND_POSITION) {
- delete CBC_QRCoderMode::sFNC1_SECOND_POSITION;
- sFNC1_SECOND_POSITION = nullptr;
- }
- if (sSTRUCTURED_APPEND) {
- delete CBC_QRCoderMode::sSTRUCTURED_APPEND;
- sSTRUCTURED_APPEND = nullptr;
- }
-}
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderMode.h b/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderMode.h
deleted file mode 100644
index f876d81f039..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderMode.h
+++ /dev/null
@@ -1,53 +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 XFA_FXBARCODE_QRCODE_BC_QRCODERMODE_H_
-#define XFA_FXBARCODE_QRCODE_BC_QRCODERMODE_H_
-
-#include <stdint.h>
-
-#include <vector>
-
-#include "core/fxcrt/fx_string.h"
-
-class CBC_QRCoderVersion;
-
-class CBC_QRCoderMode {
- public:
- virtual ~CBC_QRCoderMode();
-
- static void Initialize();
- static void Finalize();
- static CBC_QRCoderMode* ForBits(int32_t bits, int32_t& e);
- static void Destroy();
-
- int32_t GetCharacterCountBits(CBC_QRCoderVersion* version, int32_t& e) const;
- int32_t GetBits() const;
- CFX_ByteString GetName() const;
-
- static CBC_QRCoderMode* sBYTE;
- static CBC_QRCoderMode* sNUMERIC;
- static CBC_QRCoderMode* sALPHANUMERIC;
- static CBC_QRCoderMode* sKANJI;
- static CBC_QRCoderMode* sECI;
- static CBC_QRCoderMode* sGBK;
- static CBC_QRCoderMode* sTERMINATOR;
- static CBC_QRCoderMode* sFNC1_FIRST_POSITION;
- static CBC_QRCoderMode* sFNC1_SECOND_POSITION;
- static CBC_QRCoderMode* sSTRUCTURED_APPEND;
-
- private:
- CBC_QRCoderMode();
- CBC_QRCoderMode(std::vector<int32_t> charCountBits,
- int32_t bits,
- CFX_ByteString name);
-
- std::vector<int32_t> m_characterCountBitsForVersions;
- const int32_t m_bits;
- const CFX_ByteString m_name;
-};
-
-#endif // XFA_FXBARCODE_QRCODE_BC_QRCODERMODE_H_
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderVersion.cpp b/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderVersion.cpp
deleted file mode 100644
index befdc17a986..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderVersion.cpp
+++ /dev/null
@@ -1,794 +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
-// Original code is licensed as follows:
-/*
- * Copyright 2007 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "xfa/fxbarcode/common/BC_CommonBitMatrix.h"
-#include "xfa/fxbarcode/qrcode/BC_QRCoderBitVector.h"
-#include "xfa/fxbarcode/qrcode/BC_QRCoderECB.h"
-#include "xfa/fxbarcode/qrcode/BC_QRCoderECBlocks.h"
-#include "xfa/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.h"
-#include "xfa/fxbarcode/qrcode/BC_QRCoderVersion.h"
-#include "xfa/fxbarcode/utils.h"
-
-namespace {
-
-const uint8_t BITS_SET_IN_HALF_BYTE[] = {0, 1, 1, 2, 1, 2, 2, 3,
- 1, 2, 2, 3, 2, 3, 3, 4};
-
-int32_t NumBitsDiffering(int32_t a, int32_t b) {
- a ^= b;
- return BITS_SET_IN_HALF_BYTE[a & 0x0F] +
- BITS_SET_IN_HALF_BYTE[(a >> 4) & 0x0F] +
- BITS_SET_IN_HALF_BYTE[(a >> 8) & 0x0F] +
- BITS_SET_IN_HALF_BYTE[(a >> 12) & 0x0F] +
- BITS_SET_IN_HALF_BYTE[(a >> 16) & 0x0F] +
- BITS_SET_IN_HALF_BYTE[(a >> 20) & 0x0F] +
- BITS_SET_IN_HALF_BYTE[(a >> 24) & 0x0F] +
- BITS_SET_IN_HALF_BYTE[(a >> 28) & 0x0F];
-}
-
-} // namespace
-
-const int32_t CBC_QRCoderVersion::VERSION_DECODE_INFO[] = {
- 0x07C94, 0x085BC, 0x09A99, 0x0A4D3, 0x0BBF6, 0x0C762, 0x0D847,
- 0x0E60D, 0x0F928, 0x10B78, 0x1145D, 0x12A17, 0x13532, 0x149A6,
- 0x15683, 0x168C9, 0x177EC, 0x18EC4, 0x191E1, 0x1AFAB, 0x1B08E,
- 0x1CC1A, 0x1D33F, 0x1ED75, 0x1F250, 0x209D5, 0x216F0, 0x228BA,
- 0x2379F, 0x24B0B, 0x2542E, 0x26A64, 0x27541, 0x28C69};
-
-CFX_ArrayTemplate<CBC_QRCoderVersion*>* CBC_QRCoderVersion::VERSION = nullptr;
-
-void CBC_QRCoderVersion::Initialize() {
- VERSION = new CFX_ArrayTemplate<CBC_QRCoderVersion*>();
-}
-void CBC_QRCoderVersion::Finalize() {
- for (int32_t i = 0; i < VERSION->GetSize(); i++)
- delete VERSION->GetAt(i);
-
- delete VERSION;
- VERSION = nullptr;
-}
-CBC_QRCoderVersion::CBC_QRCoderVersion(int32_t versionNumber,
- CBC_QRCoderECBlocks* ecBlocks1,
- CBC_QRCoderECBlocks* ecBlocks2,
- CBC_QRCoderECBlocks* ecBlocks3,
- CBC_QRCoderECBlocks* ecBlocks4) {
- m_versionNumber = versionNumber;
- m_ecBlocksArray.Add(ecBlocks1);
- m_ecBlocksArray.Add(ecBlocks2);
- m_ecBlocksArray.Add(ecBlocks3);
- m_ecBlocksArray.Add(ecBlocks4);
- int32_t total = 0;
- int32_t ecCodeWords = ecBlocks1->GetECCodeWordsPerBlock();
- CFX_ArrayTemplate<CBC_QRCoderECB*>* ecbArray = ecBlocks1->GetECBlocks();
- for (int32_t i = 0; i < ecbArray->GetSize(); i++) {
- CBC_QRCoderECB* ecBlock = (*ecbArray)[i];
- total += ecBlock->GetCount() * (ecBlock->GetDataCodeWords() + ecCodeWords);
- }
- m_totalCodeWords = total;
- switch (versionNumber) {
- case 1:
- break;
- case 2:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(18);
- break;
- case 3:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(22);
- break;
- case 4:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(26);
- break;
- case 5:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(30);
- break;
- case 6:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(34);
- break;
- case 7:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(22);
- m_alignmentPatternCenters.Add(38);
- break;
- case 8:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(24);
- m_alignmentPatternCenters.Add(42);
- break;
- case 9:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(26);
- m_alignmentPatternCenters.Add(46);
- break;
- case 10:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(28);
- m_alignmentPatternCenters.Add(50);
- break;
- case 11:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(30);
- m_alignmentPatternCenters.Add(54);
- break;
- case 12:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(32);
- m_alignmentPatternCenters.Add(58);
- break;
- case 13:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(34);
- m_alignmentPatternCenters.Add(62);
- break;
- case 14:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(26);
- m_alignmentPatternCenters.Add(46);
- m_alignmentPatternCenters.Add(66);
- break;
- case 15:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(26);
- m_alignmentPatternCenters.Add(48);
- m_alignmentPatternCenters.Add(70);
- break;
- case 16:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(26);
- m_alignmentPatternCenters.Add(50);
- m_alignmentPatternCenters.Add(74);
- break;
- case 17:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(30);
- m_alignmentPatternCenters.Add(54);
- m_alignmentPatternCenters.Add(78);
- break;
- case 18:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(30);
- m_alignmentPatternCenters.Add(56);
- m_alignmentPatternCenters.Add(82);
- break;
- case 19:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(30);
- m_alignmentPatternCenters.Add(58);
- m_alignmentPatternCenters.Add(86);
- break;
- case 20:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(34);
- m_alignmentPatternCenters.Add(62);
- m_alignmentPatternCenters.Add(90);
- break;
- case 21:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(28);
- m_alignmentPatternCenters.Add(50);
- m_alignmentPatternCenters.Add(72);
- m_alignmentPatternCenters.Add(94);
- break;
- case 22:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(26);
- m_alignmentPatternCenters.Add(50);
- m_alignmentPatternCenters.Add(74);
- m_alignmentPatternCenters.Add(98);
- break;
- case 23:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(30);
- m_alignmentPatternCenters.Add(54);
- m_alignmentPatternCenters.Add(74);
- m_alignmentPatternCenters.Add(102);
- break;
- case 24:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(28);
- m_alignmentPatternCenters.Add(54);
- m_alignmentPatternCenters.Add(80);
- m_alignmentPatternCenters.Add(106);
- break;
- case 25:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(32);
- m_alignmentPatternCenters.Add(58);
- m_alignmentPatternCenters.Add(84);
- m_alignmentPatternCenters.Add(110);
- break;
- case 26:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(30);
- m_alignmentPatternCenters.Add(58);
- m_alignmentPatternCenters.Add(86);
- m_alignmentPatternCenters.Add(114);
- break;
- case 27:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(34);
- m_alignmentPatternCenters.Add(62);
- m_alignmentPatternCenters.Add(90);
- m_alignmentPatternCenters.Add(118);
- break;
- case 28:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(26);
- m_alignmentPatternCenters.Add(50);
- m_alignmentPatternCenters.Add(74);
- m_alignmentPatternCenters.Add(98);
- m_alignmentPatternCenters.Add(122);
- break;
- case 29:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(30);
- m_alignmentPatternCenters.Add(54);
- m_alignmentPatternCenters.Add(78);
- m_alignmentPatternCenters.Add(102);
- m_alignmentPatternCenters.Add(126);
- break;
- case 30:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(26);
- m_alignmentPatternCenters.Add(52);
- m_alignmentPatternCenters.Add(78);
- m_alignmentPatternCenters.Add(104);
- m_alignmentPatternCenters.Add(130);
- break;
- case 31:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(30);
- m_alignmentPatternCenters.Add(56);
- m_alignmentPatternCenters.Add(82);
- m_alignmentPatternCenters.Add(108);
- m_alignmentPatternCenters.Add(134);
- break;
- case 32:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(34);
- m_alignmentPatternCenters.Add(60);
- m_alignmentPatternCenters.Add(86);
- m_alignmentPatternCenters.Add(112);
- m_alignmentPatternCenters.Add(138);
- break;
- case 33:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(30);
- m_alignmentPatternCenters.Add(58);
- m_alignmentPatternCenters.Add(86);
- m_alignmentPatternCenters.Add(114);
- m_alignmentPatternCenters.Add(142);
- break;
- case 34:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(34);
- m_alignmentPatternCenters.Add(62);
- m_alignmentPatternCenters.Add(90);
- m_alignmentPatternCenters.Add(118);
- m_alignmentPatternCenters.Add(146);
- break;
- case 35:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(30);
- m_alignmentPatternCenters.Add(54);
- m_alignmentPatternCenters.Add(78);
- m_alignmentPatternCenters.Add(102);
- m_alignmentPatternCenters.Add(126);
- m_alignmentPatternCenters.Add(150);
- break;
- case 36:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(24);
- m_alignmentPatternCenters.Add(50);
- m_alignmentPatternCenters.Add(76);
- m_alignmentPatternCenters.Add(102);
- m_alignmentPatternCenters.Add(128);
- m_alignmentPatternCenters.Add(154);
- break;
- case 37:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(28);
- m_alignmentPatternCenters.Add(54);
- m_alignmentPatternCenters.Add(80);
- m_alignmentPatternCenters.Add(106);
- m_alignmentPatternCenters.Add(132);
- m_alignmentPatternCenters.Add(158);
- break;
- case 38:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(32);
- m_alignmentPatternCenters.Add(58);
- m_alignmentPatternCenters.Add(84);
- m_alignmentPatternCenters.Add(110);
- m_alignmentPatternCenters.Add(136);
- m_alignmentPatternCenters.Add(162);
- break;
- case 39:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(26);
- m_alignmentPatternCenters.Add(54);
- m_alignmentPatternCenters.Add(82);
- m_alignmentPatternCenters.Add(110);
- m_alignmentPatternCenters.Add(138);
- m_alignmentPatternCenters.Add(166);
- break;
- case 40:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(30);
- m_alignmentPatternCenters.Add(58);
- m_alignmentPatternCenters.Add(86);
- m_alignmentPatternCenters.Add(114);
- m_alignmentPatternCenters.Add(142);
- m_alignmentPatternCenters.Add(170);
- break;
- }
-}
-
-CBC_QRCoderVersion::~CBC_QRCoderVersion() {
- for (int32_t i = 0; i < m_ecBlocksArray.GetSize(); ++i)
- delete m_ecBlocksArray[i];
-}
-
-int32_t CBC_QRCoderVersion::GetVersionNumber() {
- return m_versionNumber;
-}
-CFX_ArrayTemplate<int32_t>* CBC_QRCoderVersion::GetAlignmentPatternCenters() {
- return &m_alignmentPatternCenters;
-}
-int32_t CBC_QRCoderVersion::GetTotalCodeWords() {
- return m_totalCodeWords;
-}
-int32_t CBC_QRCoderVersion::GetDimensionForVersion() {
- return 17 + 4 * m_versionNumber;
-}
-CBC_QRCoderECBlocks* CBC_QRCoderVersion::GetECBlocksForLevel(
- CBC_QRCoderErrorCorrectionLevel* ecLevel) {
- return m_ecBlocksArray[ecLevel->Ordinal()];
-}
-CBC_QRCoderVersion* CBC_QRCoderVersion::GetProvisionalVersionForDimension(
- int32_t dimension,
- int32_t& e) {
- if ((dimension % 4) != 1) {
- e = BCExceptionRead;
- return nullptr;
- }
- CBC_QRCoderVersion* qcv = GetVersionForNumber((dimension - 17) >> 2, e);
- if (e != BCExceptionNO)
- return nullptr;
- return qcv;
-}
-CBC_QRCoderVersion* CBC_QRCoderVersion::DecodeVersionInformation(
- int32_t versionBits,
- int32_t& e) {
- int32_t bestDifference = FXSYS_IntMax;
- int32_t bestVersion = 0;
- for (int32_t i = 0; i < 34; i++) {
- int32_t targetVersion = VERSION_DECODE_INFO[i];
- if (targetVersion == versionBits) {
- CBC_QRCoderVersion* qcv = GetVersionForNumber(i + 7, e);
- if (e != BCExceptionNO)
- return nullptr;
- return qcv;
- }
- int32_t bitsDifference = NumBitsDiffering(versionBits, targetVersion);
- if (bitsDifference < bestDifference) {
- bestVersion = i + 7;
- bestDifference = bitsDifference;
- }
- }
- if (bestDifference <= 3) {
- CBC_QRCoderVersion* qcv = GetVersionForNumber(bestVersion, e);
- if (e != BCExceptionNO)
- return nullptr;
- return qcv;
- }
- return nullptr;
-}
-CBC_CommonBitMatrix* CBC_QRCoderVersion::BuildFunctionPattern(int32_t& e) {
- int32_t dimension = GetDimensionForVersion();
- CBC_CommonBitMatrix* bitMatrix = new CBC_CommonBitMatrix();
- bitMatrix->Init(dimension);
- bitMatrix->SetRegion(0, 0, 9, 9, e);
- if (e != BCExceptionNO)
- return nullptr;
- bitMatrix->SetRegion(dimension - 8, 0, 8, 9, e);
- if (e != BCExceptionNO)
- return nullptr;
- bitMatrix->SetRegion(0, dimension - 8, 9, 8, e);
- if (e != BCExceptionNO)
- return nullptr;
- int32_t max = m_alignmentPatternCenters.GetSize();
- for (int32_t x = 0; x < max; x++) {
- int32_t i = m_alignmentPatternCenters[x] - 2;
- for (int32_t y = 0; y < max; y++) {
- if ((x == 0 && (y == 0 || y == max - 1)) || (x == max - 1 && y == 0)) {
- continue;
- }
- bitMatrix->SetRegion(m_alignmentPatternCenters[y] - 2, i, 5, 5, e);
- if (e != BCExceptionNO)
- return nullptr;
- }
- }
- bitMatrix->SetRegion(6, 9, 1, dimension - 17, e);
- if (e != BCExceptionNO)
- return nullptr;
- bitMatrix->SetRegion(9, 6, dimension - 17, 1, e);
- if (e != BCExceptionNO)
- return nullptr;
- if (m_versionNumber > 6) {
- bitMatrix->SetRegion(dimension - 11, 0, 3, 6, e);
- if (e != BCExceptionNO)
- return nullptr;
- bitMatrix->SetRegion(0, dimension - 11, 6, 3, e);
- if (e != BCExceptionNO)
- return nullptr;
- }
- return bitMatrix;
-}
-CBC_QRCoderVersion* CBC_QRCoderVersion::GetVersionForNumber(
- int32_t versionNumber,
- int32_t& e) {
- if (VERSION->GetSize() == 0) {
- VERSION->Add(new CBC_QRCoderVersion(
- 1, new CBC_QRCoderECBlocks(7, new CBC_QRCoderECB(1, 19)),
- new CBC_QRCoderECBlocks(10, new CBC_QRCoderECB(1, 16)),
- new CBC_QRCoderECBlocks(13, new CBC_QRCoderECB(1, 13)),
- new CBC_QRCoderECBlocks(17, new CBC_QRCoderECB(1, 9))));
- VERSION->Add(new CBC_QRCoderVersion(
- 2, new CBC_QRCoderECBlocks(10, new CBC_QRCoderECB(1, 34)),
- new CBC_QRCoderECBlocks(16, new CBC_QRCoderECB(1, 28)),
- new CBC_QRCoderECBlocks(22, new CBC_QRCoderECB(1, 22)),
- new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(1, 16))));
- VERSION->Add(new CBC_QRCoderVersion(
- 3, new CBC_QRCoderECBlocks(15, new CBC_QRCoderECB(1, 55)),
- new CBC_QRCoderECBlocks(26, new CBC_QRCoderECB(1, 44)),
- new CBC_QRCoderECBlocks(18, new CBC_QRCoderECB(2, 17)),
- new CBC_QRCoderECBlocks(22, new CBC_QRCoderECB(2, 13))));
- VERSION->Add(new CBC_QRCoderVersion(
- 4, new CBC_QRCoderECBlocks(20, new CBC_QRCoderECB(1, 80)),
- new CBC_QRCoderECBlocks(18, new CBC_QRCoderECB(2, 32)),
- new CBC_QRCoderECBlocks(26, new CBC_QRCoderECB(2, 24)),
- new CBC_QRCoderECBlocks(16, new CBC_QRCoderECB(4, 9))));
- VERSION->Add(new CBC_QRCoderVersion(
- 5, new CBC_QRCoderECBlocks(26, new CBC_QRCoderECB(1, 108)),
- new CBC_QRCoderECBlocks(24, new CBC_QRCoderECB(2, 43)),
- new CBC_QRCoderECBlocks(18, new CBC_QRCoderECB(2, 15),
- new CBC_QRCoderECB(2, 16)),
- new CBC_QRCoderECBlocks(22, new CBC_QRCoderECB(2, 11),
- new CBC_QRCoderECB(2, 12))));
- VERSION->Add(new CBC_QRCoderVersion(
- 6, new CBC_QRCoderECBlocks(18, new CBC_QRCoderECB(2, 68)),
- new CBC_QRCoderECBlocks(16, new CBC_QRCoderECB(4, 27)),
- new CBC_QRCoderECBlocks(24, new CBC_QRCoderECB(4, 19)),
- new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(4, 15))));
- VERSION->Add(new CBC_QRCoderVersion(
- 7, new CBC_QRCoderECBlocks(20, new CBC_QRCoderECB(2, 78)),
- new CBC_QRCoderECBlocks(18, new CBC_QRCoderECB(4, 31)),
- new CBC_QRCoderECBlocks(18, new CBC_QRCoderECB(2, 14),
- new CBC_QRCoderECB(4, 15)),
- new CBC_QRCoderECBlocks(26, new CBC_QRCoderECB(4, 13),
- new CBC_QRCoderECB(1, 14))));
- VERSION->Add(new CBC_QRCoderVersion(
- 8, new CBC_QRCoderECBlocks(24, new CBC_QRCoderECB(2, 97)),
- new CBC_QRCoderECBlocks(22, new CBC_QRCoderECB(2, 38),
- new CBC_QRCoderECB(2, 39)),
- new CBC_QRCoderECBlocks(22, new CBC_QRCoderECB(4, 18),
- new CBC_QRCoderECB(2, 19)),
- new CBC_QRCoderECBlocks(26, new CBC_QRCoderECB(4, 14),
- new CBC_QRCoderECB(2, 15))));
- VERSION->Add(new CBC_QRCoderVersion(
- 9, new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(2, 116)),
- new CBC_QRCoderECBlocks(22, new CBC_QRCoderECB(3, 36),
- new CBC_QRCoderECB(2, 37)),
- new CBC_QRCoderECBlocks(20, new CBC_QRCoderECB(4, 16),
- new CBC_QRCoderECB(4, 17)),
- new CBC_QRCoderECBlocks(24, new CBC_QRCoderECB(4, 12),
- new CBC_QRCoderECB(4, 13))));
- VERSION->Add(new CBC_QRCoderVersion(
- 10, new CBC_QRCoderECBlocks(18, new CBC_QRCoderECB(2, 68),
- new CBC_QRCoderECB(2, 69)),
- new CBC_QRCoderECBlocks(26, new CBC_QRCoderECB(4, 43),
- new CBC_QRCoderECB(1, 44)),
- new CBC_QRCoderECBlocks(24, new CBC_QRCoderECB(6, 19),
- new CBC_QRCoderECB(2, 20)),
- new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(6, 15),
- new CBC_QRCoderECB(2, 16))));
- VERSION->Add(new CBC_QRCoderVersion(
- 11, new CBC_QRCoderECBlocks(20, new CBC_QRCoderECB(4, 81)),
- new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(1, 50),
- new CBC_QRCoderECB(4, 51)),
- new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(4, 22),
- new CBC_QRCoderECB(4, 23)),
- new CBC_QRCoderECBlocks(24, new CBC_QRCoderECB(3, 12),
- new CBC_QRCoderECB(8, 13))));
- VERSION->Add(new CBC_QRCoderVersion(
- 12, new CBC_QRCoderECBlocks(24, new CBC_QRCoderECB(2, 92),
- new CBC_QRCoderECB(2, 93)),
- new CBC_QRCoderECBlocks(22, new CBC_QRCoderECB(6, 36),
- new CBC_QRCoderECB(2, 37)),
- new CBC_QRCoderECBlocks(26, new CBC_QRCoderECB(4, 20),
- new CBC_QRCoderECB(6, 21)),
- new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(7, 14),
- new CBC_QRCoderECB(4, 15))));
- VERSION->Add(new CBC_QRCoderVersion(
- 13, new CBC_QRCoderECBlocks(26, new CBC_QRCoderECB(4, 107)),
- new CBC_QRCoderECBlocks(22, new CBC_QRCoderECB(8, 37),
- new CBC_QRCoderECB(1, 38)),
- new CBC_QRCoderECBlocks(24, new CBC_QRCoderECB(8, 20),
- new CBC_QRCoderECB(4, 21)),
- new CBC_QRCoderECBlocks(22, new CBC_QRCoderECB(12, 11),
- new CBC_QRCoderECB(4, 12))));
- VERSION->Add(new CBC_QRCoderVersion(
- 14, new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(3, 115),
- new CBC_QRCoderECB(1, 116)),
- new CBC_QRCoderECBlocks(24, new CBC_QRCoderECB(4, 40),
- new CBC_QRCoderECB(5, 41)),
- new CBC_QRCoderECBlocks(20, new CBC_QRCoderECB(11, 16),
- new CBC_QRCoderECB(5, 17)),
- new CBC_QRCoderECBlocks(24, new CBC_QRCoderECB(11, 12),
- new CBC_QRCoderECB(5, 13))));
- VERSION->Add(new CBC_QRCoderVersion(
- 15, new CBC_QRCoderECBlocks(22, new CBC_QRCoderECB(5, 87),
- new CBC_QRCoderECB(1, 88)),
- new CBC_QRCoderECBlocks(24, new CBC_QRCoderECB(5, 41),
- new CBC_QRCoderECB(5, 42)),
- new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(5, 24),
- new CBC_QRCoderECB(7, 25)),
- new CBC_QRCoderECBlocks(24, new CBC_QRCoderECB(11, 12),
- new CBC_QRCoderECB(7, 13))));
- VERSION->Add(new CBC_QRCoderVersion(
- 16, new CBC_QRCoderECBlocks(24, new CBC_QRCoderECB(5, 98),
- new CBC_QRCoderECB(1, 99)),
- new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(7, 45),
- new CBC_QRCoderECB(3, 46)),
- new CBC_QRCoderECBlocks(24, new CBC_QRCoderECB(15, 19),
- new CBC_QRCoderECB(2, 20)),
- new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(3, 15),
- new CBC_QRCoderECB(13, 16))));
- VERSION->Add(new CBC_QRCoderVersion(
- 17, new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(1, 107),
- new CBC_QRCoderECB(5, 108)),
- new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(10, 46),
- new CBC_QRCoderECB(1, 47)),
- new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(1, 22),
- new CBC_QRCoderECB(15, 23)),
- new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(2, 14),
- new CBC_QRCoderECB(17, 15))));
- VERSION->Add(new CBC_QRCoderVersion(
- 18, new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(5, 120),
- new CBC_QRCoderECB(1, 121)),
- new CBC_QRCoderECBlocks(26, new CBC_QRCoderECB(9, 43),
- new CBC_QRCoderECB(4, 44)),
- new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(17, 22),
- new CBC_QRCoderECB(1, 23)),
- new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(2, 14),
- new CBC_QRCoderECB(19, 15))));
- VERSION->Add(new CBC_QRCoderVersion(
- 19, new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(3, 113),
- new CBC_QRCoderECB(4, 114)),
- new CBC_QRCoderECBlocks(26, new CBC_QRCoderECB(3, 44),
- new CBC_QRCoderECB(11, 45)),
- new CBC_QRCoderECBlocks(26, new CBC_QRCoderECB(17, 21),
- new CBC_QRCoderECB(4, 22)),
- new CBC_QRCoderECBlocks(26, new CBC_QRCoderECB(9, 13),
- new CBC_QRCoderECB(16, 14))));
- VERSION->Add(new CBC_QRCoderVersion(
- 20, new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(3, 107),
- new CBC_QRCoderECB(5, 108)),
- new CBC_QRCoderECBlocks(26, new CBC_QRCoderECB(3, 41),
- new CBC_QRCoderECB(13, 42)),
- new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(15, 24),
- new CBC_QRCoderECB(5, 25)),
- new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(15, 15),
- new CBC_QRCoderECB(10, 16))));
- VERSION->Add(new CBC_QRCoderVersion(
- 21, new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(4, 116),
- new CBC_QRCoderECB(4, 117)),
- new CBC_QRCoderECBlocks(26, new CBC_QRCoderECB(17, 42)),
- new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(17, 22),
- new CBC_QRCoderECB(6, 23)),
- new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(19, 16),
- new CBC_QRCoderECB(6, 17))));
- VERSION->Add(new CBC_QRCoderVersion(
- 22, new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(2, 111),
- new CBC_QRCoderECB(7, 112)),
- new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(17, 46)),
- new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(7, 24),
- new CBC_QRCoderECB(16, 25)),
- new CBC_QRCoderECBlocks(24, new CBC_QRCoderECB(34, 13))));
- VERSION->Add(new CBC_QRCoderVersion(
- 23, new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(4, 121),
- new CBC_QRCoderECB(5, 122)),
- new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(4, 47),
- new CBC_QRCoderECB(14, 48)),
- new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(11, 24),
- new CBC_QRCoderECB(14, 25)),
- new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(16, 15),
- new CBC_QRCoderECB(14, 16))));
- VERSION->Add(new CBC_QRCoderVersion(
- 24, new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(6, 117),
- new CBC_QRCoderECB(4, 118)),
- new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(6, 45),
- new CBC_QRCoderECB(14, 46)),
- new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(11, 24),
- new CBC_QRCoderECB(16, 25)),
- new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(30, 16),
- new CBC_QRCoderECB(2, 17))));
- VERSION->Add(new CBC_QRCoderVersion(
- 25, new CBC_QRCoderECBlocks(26, new CBC_QRCoderECB(8, 106),
- new CBC_QRCoderECB(4, 107)),
- new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(8, 47),
- new CBC_QRCoderECB(13, 48)),
- new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(7, 24),
- new CBC_QRCoderECB(22, 25)),
- new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(22, 15),
- new CBC_QRCoderECB(13, 16))));
- VERSION->Add(new CBC_QRCoderVersion(
- 26, new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(10, 114),
- new CBC_QRCoderECB(2, 115)),
- new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(19, 46),
- new CBC_QRCoderECB(4, 47)),
- new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(28, 22),
- new CBC_QRCoderECB(6, 23)),
- new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(33, 16),
- new CBC_QRCoderECB(4, 17))));
- VERSION->Add(new CBC_QRCoderVersion(
- 27, new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(8, 122),
- new CBC_QRCoderECB(4, 123)),
- new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(22, 45),
- new CBC_QRCoderECB(3, 46)),
- new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(8, 23),
- new CBC_QRCoderECB(26, 24)),
- new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(12, 15),
- new CBC_QRCoderECB(28, 16))));
- VERSION->Add(new CBC_QRCoderVersion(
- 28, new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(3, 117),
- new CBC_QRCoderECB(10, 118)),
- new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(3, 45),
- new CBC_QRCoderECB(23, 46)),
- new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(4, 24),
- new CBC_QRCoderECB(31, 25)),
- new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(11, 15),
- new CBC_QRCoderECB(31, 16))));
- VERSION->Add(new CBC_QRCoderVersion(
- 29, new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(7, 116),
- new CBC_QRCoderECB(7, 117)),
- new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(21, 45),
- new CBC_QRCoderECB(7, 46)),
- new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(1, 23),
- new CBC_QRCoderECB(37, 24)),
- new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(19, 15),
- new CBC_QRCoderECB(26, 16))));
- VERSION->Add(new CBC_QRCoderVersion(
- 30, new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(5, 115),
- new CBC_QRCoderECB(10, 116)),
- new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(19, 47),
- new CBC_QRCoderECB(10, 48)),
- new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(15, 24),
- new CBC_QRCoderECB(25, 25)),
- new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(23, 15),
- new CBC_QRCoderECB(25, 16))));
- VERSION->Add(new CBC_QRCoderVersion(
- 31, new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(13, 115),
- new CBC_QRCoderECB(3, 116)),
- new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(2, 46),
- new CBC_QRCoderECB(29, 47)),
- new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(42, 24),
- new CBC_QRCoderECB(1, 25)),
- new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(23, 15),
- new CBC_QRCoderECB(28, 16))));
- VERSION->Add(new CBC_QRCoderVersion(
- 32, new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(17, 115)),
- new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(10, 46),
- new CBC_QRCoderECB(23, 47)),
- new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(10, 24),
- new CBC_QRCoderECB(35, 25)),
- new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(19, 15),
- new CBC_QRCoderECB(35, 16))));
- VERSION->Add(new CBC_QRCoderVersion(
- 33, new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(17, 115),
- new CBC_QRCoderECB(1, 116)),
- new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(14, 46),
- new CBC_QRCoderECB(21, 47)),
- new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(29, 24),
- new CBC_QRCoderECB(19, 25)),
- new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(11, 15),
- new CBC_QRCoderECB(46, 16))));
- VERSION->Add(new CBC_QRCoderVersion(
- 34, new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(13, 115),
- new CBC_QRCoderECB(6, 116)),
- new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(14, 46),
- new CBC_QRCoderECB(23, 47)),
- new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(44, 24),
- new CBC_QRCoderECB(7, 25)),
- new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(59, 16),
- new CBC_QRCoderECB(1, 17))));
- VERSION->Add(new CBC_QRCoderVersion(
- 35, new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(12, 121),
- new CBC_QRCoderECB(7, 122)),
- new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(12, 47),
- new CBC_QRCoderECB(26, 48)),
- new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(39, 24),
- new CBC_QRCoderECB(14, 25)),
- new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(22, 15),
- new CBC_QRCoderECB(41, 16))));
- VERSION->Add(new CBC_QRCoderVersion(
- 36, new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(6, 121),
- new CBC_QRCoderECB(14, 122)),
- new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(6, 47),
- new CBC_QRCoderECB(34, 48)),
- new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(46, 24),
- new CBC_QRCoderECB(10, 25)),
- new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(2, 15),
- new CBC_QRCoderECB(64, 16))));
- VERSION->Add(new CBC_QRCoderVersion(
- 37, new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(17, 122),
- new CBC_QRCoderECB(4, 123)),
- new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(29, 46),
- new CBC_QRCoderECB(14, 47)),
- new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(49, 24),
- new CBC_QRCoderECB(10, 25)),
- new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(24, 15),
- new CBC_QRCoderECB(46, 16))));
- VERSION->Add(new CBC_QRCoderVersion(
- 38, new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(4, 122),
- new CBC_QRCoderECB(18, 123)),
- new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(13, 46),
- new CBC_QRCoderECB(32, 47)),
- new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(48, 24),
- new CBC_QRCoderECB(14, 25)),
- new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(42, 15),
- new CBC_QRCoderECB(32, 16))));
- VERSION->Add(new CBC_QRCoderVersion(
- 39, new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(20, 117),
- new CBC_QRCoderECB(4, 118)),
- new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(40, 47),
- new CBC_QRCoderECB(7, 48)),
- new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(43, 24),
- new CBC_QRCoderECB(22, 25)),
- new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(10, 15),
- new CBC_QRCoderECB(67, 16))));
- VERSION->Add(new CBC_QRCoderVersion(
- 40, new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(19, 118),
- new CBC_QRCoderECB(6, 119)),
- new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(18, 47),
- new CBC_QRCoderECB(31, 48)),
- new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(34, 24),
- new CBC_QRCoderECB(34, 25)),
- new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(20, 15),
- new CBC_QRCoderECB(61, 16))));
- }
- if (versionNumber < 1 || versionNumber > 40) {
- e = BCExceptionIllegalArgument;
- return nullptr;
- }
- return (*VERSION)[versionNumber - 1];
-}
-
-void CBC_QRCoderVersion::Destroy() {
- for (int32_t i = 0; i < VERSION->GetSize(); i++)
- delete (*VERSION)[i];
- VERSION->RemoveAll();
-}
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderVersion.h b/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderVersion.h
deleted file mode 100644
index 030dd512a0a..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/qrcode/BC_QRCoderVersion.h
+++ /dev/null
@@ -1,55 +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 XFA_FXBARCODE_QRCODE_BC_QRCODERVERSION_H_
-#define XFA_FXBARCODE_QRCODE_BC_QRCODERVERSION_H_
-
-#include "core/fxcrt/fx_basic.h"
-
-class CBC_CommonBitMatrix;
-class CBC_QRCoderECBlocks;
-class CBC_QRCoderErrorCorrectionLevel;
-
-class CBC_QRCoderVersion {
- public:
- virtual ~CBC_QRCoderVersion();
- static void Initialize();
- static void Finalize();
-
- int32_t GetVersionNumber();
- int32_t GetTotalCodeWords();
- int32_t GetDimensionForVersion();
- CBC_CommonBitMatrix* BuildFunctionPattern(int32_t& e);
- CFX_ArrayTemplate<int32_t>* GetAlignmentPatternCenters();
- CBC_QRCoderECBlocks* GetECBlocksForLevel(
- CBC_QRCoderErrorCorrectionLevel* ecLevel);
- static CBC_QRCoderVersion* GetVersionForNumber(int32_t versionNumber,
- int32_t& e);
- static CBC_QRCoderVersion* GetProvisionalVersionForDimension(
- int32_t dimension,
- int32_t& e);
- static CBC_QRCoderVersion* DecodeVersionInformation(int32_t versionBits,
- int32_t& e);
- static void Destroy();
-
- private:
- CBC_QRCoderVersion();
- CBC_QRCoderVersion(int32_t versionNumber,
- CBC_QRCoderECBlocks* ecBlocks1,
- CBC_QRCoderECBlocks* ecBlocks2,
- CBC_QRCoderECBlocks* ecBlocks3,
- CBC_QRCoderECBlocks* ecBlocks4);
-
- static const int32_t VERSION_DECODE_INFO[34];
- static CFX_ArrayTemplate<CBC_QRCoderVersion*>* VERSION;
-
- int32_t m_versionNumber;
- int32_t m_totalCodeWords;
- CFX_ArrayTemplate<int32_t> m_alignmentPatternCenters;
- CFX_ArrayTemplate<CBC_QRCoderECBlocks*> m_ecBlocksArray;
-};
-
-#endif // XFA_FXBARCODE_QRCODE_BC_QRCODERVERSION_H_
diff --git a/chromium/third_party/pdfium/xfa/fxbarcode/utils.h b/chromium/third_party/pdfium/xfa/fxbarcode/utils.h
deleted file mode 100644
index 1cb8d85013e..00000000000
--- a/chromium/third_party/pdfium/xfa/fxbarcode/utils.h
+++ /dev/null
@@ -1,169 +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 XFA_FXBARCODE_UTILS_H_
-#define XFA_FXBARCODE_UTILS_H_
-
-#include "core/fxcrt/fx_basic.h"
-
-bool BC_FX_ByteString_Replace(CFX_ByteString& dst,
- uint32_t first,
- uint32_t last,
- int32_t count,
- FX_CHAR c);
-void BC_FX_ByteString_Append(CFX_ByteString& dst, int32_t count, FX_CHAR c);
-void BC_FX_ByteString_Append(CFX_ByteString& dst,
- const CFX_ArrayTemplate<uint8_t>& ba);
-
-#if (_FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_)
-#include <limits>
-#elif(_FX_OS_ == _FX_MACOSX_ || _FX_OS_ == _FX_LINUX_DESKTOP_ || \
- _FX_OS_ == _FX_IOS_)
-#include <limits.h>
-#endif
-#if (_FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_)
-#define FXSYS_isnan(x) _isnan(x)
-#elif(_FX_OS_ == _FX_MACOSX_ || _FX_OS_ == _FX_IOS_ || \
- _FX_OS_ == _FX_LINUX_DESKTOP_ || _FX_OS_ == _FX_ANDROID_)
-#include <cmath>
-#define FXSYS_isnan(x) std::isnan(x)
-#endif
-#if (_FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_)
-#define FXSYS_nan() (std::numeric_limits<float>::quiet_NaN())
-#elif(_FX_OS_ == _FX_MACOSX_ || _FX_OS_ == _FX_LINUX_DESKTOP_ || \
- _FX_OS_ == _FX_IOS_ || _FX_OS_ == _FX_ANDROID_)
-#define FXSYS_nan() NAN
-#endif
-enum BCFORMAT {
- BCFORMAT_UNSPECIFY = -1,
- BCFORMAT_CODABAR,
- BCFORMAT_CODE_39,
- BCFORMAT_CODE_128,
- BCFORMAT_CODE_128B,
- BCFORMAT_CODE_128C,
- BCFORMAT_EAN_8,
- BCFORMAT_UPC_A,
- BCFORMAT_EAN_13,
- BCFORMAT_PDF_417,
- BCFORMAT_DATAMATRIX,
- BCFORMAT_QR_CODE
-};
-#define BCFORMAT_ECLEVEL_L 0
-#define BCFORMAT_ECLEVEL_M 1
-#define BCFORMAT_ECLEVEL_Q 2
-#define BCFORMAT_ECLEVEL_H 3
-#include <ctype.h>
-#define FXSYS_IntMax INT_MAX
-#define FXSYS_Isdigit isdigit
-#define BCExceptionNO 0
-#define BCExceptionNotFound 1
-#define BCExceptionEndLessThanStart 2
-#define BCExceptionUnknownDecoder 3
-#define BCExceptionRotateNotSupported 4
-#define BCExceptionHeightAndWidthMustBeAtLeast1 5
-#define BCExceptionRegionMustFitInsideMatrix 6
-#define BCExceptionCanNotCallGetDimensionOnNonSquareMatrix 7
-#define BCExceptionFormatException 8
-#define BCExceptionIllegalArgumentMustMatchVersionSize 9
-#define BCExceptionChecksumException 10
-#define BCExceptionIllegalArgumentInvalidFirstDigit 11
-#define BCExceptionIllegalArgumentInvalidSecondDigit 12
-#define BCExceptionRuntimeDecodingInvalidISO_IEC 13
-#define BCExceptionRuntimeDecodingInvalidAlphanumeric 14
-#define BCExceptionLeftAndTopMustBeNonnegative 15
-#define BCExceptionIllegalArgument 16
-#define BCExceptionBadECI 17
-#define BCExceptionUnSupportedBarcode 18
-#define BCExceptionUnSupportedString 19
-#define BCExceptionDigitLengthMustBe8 20
-#define BCExceptionDataCheckException 21
-#define BCExceptionExtractNumberValueFromBitArray 22
-#define BCExceptionRead 23
-#define BCExceptionRequestedRowIsOutSizeTheImage 24
-#define BCExceptionNoContents 26
-#define BCExceptionUnSupportEclevel 27
-#define BCExceptionUnSupportMode 28
-#define BCExceptionReferenceMustBeBetween0And7 29
-#define BCExceptionBadErrorLocation 30
-#define BCExceptionDegreeIsNegative 31
-#define BCExceptionDivideByZero 32
-#define BCExceptionCoefficientsSizeIsNull 33
-#define BCExceptionNoCorrectionBytes 34
-#define BCExceptionNoDataBytesProvided 35
-#define BCExceptionR_I_1IsZero 36
-#define BCExceptionAIsZero 37
-#define BCExceptionIsZero 38
-#define BCExceptionDegreeNotMatchRoots 39
-#define BCExceptionContentsLengthShouldBetween1and80 40
-#define BCExceptionOnlyEncodeCODE_128 41
-#define BCExceptionOnlyEncodeCODE_39 42
-#define BCExceptionOnlyEncodeEAN_13 43
-#define BCExceptionOnlyEncodeEAN_8 44
-#define BCExceptionOnlyEncodeITF 45
-#define BCExceptionDigitLengthShould13 46
-#define BCExceptionDigitLengthMustBe6or8or10or12or14or16or20or24or44 47
-#define BCExceptionOnlyEncodeUPC_A 48
-#define BCExceptionDigitLengthShouldBe12 49
-#define BCExceptionValueMustBeEither0or1 50
-#define BCExceptionReedsolomnDecodeException 51
-#define BCExceptionBadIndexException 52
-#define BCExceptionBadValueException 53
-#define BCExceptionBadNumBitsException 54
-#define BCExceptioncanNotOperatexorOperator 55
-#define BCExceptionVersionMust1_40 56
-#define BCExceptionUnknown 57
-#define BCExceptionNoSuchVersion 58
-#define BCExceptionCannotFindBlockInfo 59
-#define BCExceptionDataTooBig 60
-#define BCExceptionInvalidQRCode 61
-#define BCExceptionDataTooMany 62
-#define BCExceptionBitsNotEqualCacity 63
-#define BCExceptionUnsupportedMode 64
-#define BCExceptionInvalidateCharacter 65
-#define BCExceptionBytesNotMatchOffset 66
-#define BCExceptionSizeInBytesDiffer 67
-#define BCExceptionInvalidateMaskPattern 68
-#define BCExceptionNullPointer 69
-#define BCExceptionBadMask 70
-#define BCExceptionBitSizeNot15 71
-#define BCExceptionBitSizeNot18 72
-#define BCExceptionInvalidateImageData 73
-#define BCExceptionHeight_8BeZero 74
-#define BCExceptionCharacterNotThisMode 75
-#define BCExceptionBitsBytesNotMatch 76
-#define BCExceptionInvalidateData 77
-#define BCExceptionLoadFile 78
-#define BCExceptionPDF417EncodeFail 79
-#define BCExceptionFailToCreateBitmap 80
-#define BCExceptionLoadFontFail 81
-#define BCExceptionOnlyEncodeCODEBAR 82
-#define BCExceptionCodabarShouldStartWithOneOfABCD 83
-#define BCExceptionCodabarShouldEndWithOneOfTNE 84
-#define BCExceptionCodabarEncodeCharsInvalid 85
-#define BCExceptionOnlyEncodeDATAMATRIX 86
-#define BCExceptionCharactersOutsideISO88591Encoding 87
-#define BCExceptionIllegalDataCodewords 88
-#define BCExceptionCannotHandleThisNumberOfDataRegions 89
-#define BCExceptionIllegalStateUnexpectedCase 90
-#define BCExceptionIllegalStateCountMustNotExceed4 91
-#define BCExceptionIllegalStateMessageLengthInvalid 92
-#define BCExceptionIllegalArgumentNotGigits 93
-#define BCExceptionIllegalStateIllegalMode 94
-#define BCExceptionOnlyEncodePDF417 95
-#define BCExceptionNonEncodableCharacterDetected 96
-#define BCExceptionErrorCorrectionLevelMustBeBetween0And8 97
-#define BCExceptionNoRecommendationPossible 98
-#define BCExceptionIllegalArgumentnMustBeAbove0 99
-#define BCExceptionUnableToFitMessageInColumns 100
-#define BCExceptionEncodedMessageContainsTooManyCodeWords 101
-#define BCExceptionBitmapSizeError 102
-#define BCExceptionFormatInstance 102
-#define BCExceptionChecksumInstance 103
-#define BCExceptiontNotFoundInstance 104
-#define BCExceptionNotFoundInstance 105
-#define BCExceptionCannotMetadata 106
-
-#endif // XFA_FXBARCODE_UTILS_H_
diff --git a/chromium/third_party/pdfium/xfa/fxfa/DEPS b/chromium/third_party/pdfium/xfa/fxfa/DEPS
index 93a9acbc136..97e9f52afa9 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/DEPS
+++ b/chromium/third_party/pdfium/xfa/fxfa/DEPS
@@ -1,5 +1,8 @@
include_rules = [
'+core/fdrm/crypto',
+ '+core/fpdfapi/font',
+ '+core/fpdfapi/page',
+ '+core/fpdfdoc',
'+core/fxcodec',
'+fxjs',
]
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/DEPS b/chromium/third_party/pdfium/xfa/fxfa/app/DEPS
index 5c72d1d0b2e..f722184c917 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/DEPS
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/DEPS
@@ -1,6 +1,3 @@
include_rules = [
'+core/fdrm/crypto',
- '+core/fpdfapi/font',
- '+core/fpdfapi/page',
- '+core/fpdfdoc',
]
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_eventparam.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_eventparam.cpp
deleted file mode 100644
index bcce7219bc3..00000000000
--- a/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_eventparam.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright 2016 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#include "xfa/fxfa/cxfa_eventparam.h"
-
-#include "xfa/fxfa/fxfa.h"
-
-CXFA_EventParam::CXFA_EventParam()
- : m_pTarget(nullptr),
- m_eType(XFA_EVENT_Unknown),
- m_bCancelAction(false),
- m_iCommitKey(0),
- m_bKeyDown(false),
- m_bModifier(false),
- m_bReenter(false),
- m_iSelEnd(0),
- m_iSelStart(0),
- m_bShift(false),
- m_bIsFormReady(false),
- m_iValidateActivities(XFA_VALIDATE_preSubmit) {}
-
-CXFA_EventParam::~CXFA_EventParam() {}
-
-CXFA_EventParam::CXFA_EventParam(const CXFA_EventParam& other) = default;
-
-void CXFA_EventParam::Reset() {
- m_wsChange.clear();
- m_bCancelAction = false;
- m_iCommitKey = 0;
- m_wsFullText.clear();
- m_bKeyDown = false;
- m_bModifier = false;
- m_wsNewContentType.clear();
- m_wsNewText.clear();
- m_wsPrevContentType.clear();
- m_wsPrevText.clear();
- m_bReenter = false;
- m_iSelEnd = 0;
- m_iSelStart = 0;
- m_bShift = false;
- m_wsSoapFaultCode.clear();
- m_wsSoapFaultString.clear();
- m_bIsFormReady = false;
- m_iValidateActivities = XFA_VALIDATE_preSubmit;
-}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_linkuserdata.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_linkuserdata.cpp
index 4128cd88220..d657b285395 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_linkuserdata.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_linkuserdata.cpp
@@ -6,7 +6,7 @@
#include "xfa/fxfa/app/cxfa_linkuserdata.h"
-CXFA_LinkUserData::CXFA_LinkUserData(FX_WCHAR* pszText)
+CXFA_LinkUserData::CXFA_LinkUserData(wchar_t* pszText)
: m_wsURLContent(pszText) {}
CXFA_LinkUserData::~CXFA_LinkUserData() {}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_linkuserdata.h b/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_linkuserdata.h
index 852b4676483..a3ccd927124 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_linkuserdata.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_linkuserdata.h
@@ -17,10 +17,10 @@ class CXFA_LinkUserData : public CFX_Retainable {
template <typename T, typename... Args>
friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args);
- const FX_WCHAR* GetLinkURL() const { return m_wsURLContent.c_str(); }
+ const wchar_t* GetLinkURL() const { return m_wsURLContent.c_str(); }
- protected:
- explicit CXFA_LinkUserData(FX_WCHAR* pszText);
+ private:
+ explicit CXFA_LinkUserData(wchar_t* pszText);
~CXFA_LinkUserData() override;
CFX_WideString m_wsURLContent;
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_loadercontext.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_loadercontext.cpp
index 0733c52dfcc..2ac58ba07a1 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_loadercontext.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_loadercontext.cpp
@@ -14,8 +14,8 @@ CXFA_LoaderContext::CXFA_LoaderContext()
m_fStartLineOffset(0),
m_iChar(0),
m_iTotalLines(-1),
+ m_dwFlags(0),
m_pXMLNode(nullptr),
- m_pNode(nullptr),
- m_dwFlags(0) {}
+ m_pNode(nullptr) {}
CXFA_LoaderContext::~CXFA_LoaderContext() {}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_loadercontext.h b/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_loadercontext.h
index d8ccdbe7e27..16d9608bace 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_loadercontext.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_loadercontext.h
@@ -22,19 +22,19 @@ class CXFA_LoaderContext {
~CXFA_LoaderContext();
bool m_bSaveLineHeight;
- FX_FLOAT m_fWidth;
- FX_FLOAT m_fHeight;
- FX_FLOAT m_fLastPos;
- FX_FLOAT m_fStartLineOffset;
+ float m_fWidth;
+ float m_fHeight;
+ float m_fLastPos;
+ float m_fStartLineOffset;
int32_t m_iChar;
int32_t m_iLines;
int32_t m_iTotalLines;
+ uint32_t m_dwFlags;
CFDE_XMLNode* m_pXMLNode;
CXFA_Node* m_pNode;
CFX_RetainPtr<CFDE_CSSComputedStyle> m_pParentStyle;
- CFX_ArrayTemplate<FX_FLOAT> m_lineHeights;
- uint32_t m_dwFlags;
- std::vector<FX_FLOAT> m_BlocksHeight;
+ std::vector<float> m_lineHeights;
+ std::vector<float> m_BlocksHeight;
};
#endif // XFA_FXFA_APP_CXFA_LOADERCONTEXT_H_
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_pieceline.h b/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_pieceline.h
index 3e6bb99876a..87f71fc1924 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_pieceline.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_pieceline.h
@@ -20,7 +20,7 @@ class CXFA_PieceLine {
~CXFA_PieceLine();
std::vector<std::unique_ptr<XFA_TextPiece>> m_textPieces;
- CFX_ArrayTemplate<int32_t> m_charCounts;
+ std::vector<int32_t> m_charCounts;
};
#endif // XFA_FXFA_APP_CXFA_PIECELINE_H_
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_textlayout.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_textlayout.cpp
index 06cbfe0c70b..880bdf45852 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_textlayout.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_textlayout.cpp
@@ -11,12 +11,15 @@
#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
+#include "xfa/fde/cfde_brush.h"
#include "xfa/fde/cfde_path.h"
+#include "xfa/fde/cfde_pen.h"
+#include "xfa/fde/cfde_renderdevice.h"
#include "xfa/fde/css/cfde_csscomputedstyle.h"
#include "xfa/fde/css/cfde_cssstyleselector.h"
-#include "xfa/fde/fde_gedevice.h"
-#include "xfa/fde/fde_object.h"
-#include "xfa/fde/xml/fde_xml_imp.h"
+#include "xfa/fde/xml/cfde_xmlelement.h"
+#include "xfa/fde/xml/cfde_xmlnode.h"
+#include "xfa/fde/xml/cfde_xmltext.h"
#include "xfa/fxfa/app/cxfa_linkuserdata.h"
#include "xfa/fxfa/app/cxfa_loadercontext.h"
#include "xfa/fxfa/app/cxfa_pieceline.h"
@@ -26,8 +29,8 @@
#include "xfa/fxfa/app/xfa_ffwidgetacc.h"
#include "xfa/fxfa/app/xfa_textpiece.h"
#include "xfa/fxfa/parser/cxfa_font.h"
+#include "xfa/fxfa/parser/cxfa_node.h"
#include "xfa/fxfa/parser/cxfa_para.h"
-#include "xfa/fxfa/parser/xfa_object.h"
#define XFA_LOADERCNTXTFLG_FILTERSPACE 0x001
@@ -78,8 +81,7 @@ CFDE_XMLNode* CXFA_TextLayout::GetXMLContainerNode() {
pXMLChild = pXMLChild->GetNodeItem(CFDE_XMLNode::NextSibling)) {
if (pXMLChild->GetType() == FDE_XMLNODE_Element) {
CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLChild);
- CFX_WideString wsTag;
- pXMLElement->GetLocalTagName(wsTag);
+ CFX_WideString wsTag = pXMLElement->GetLocalTagName();
if (wsTag == L"body" || wsTag == L"html") {
pXMLContainer = pXMLChild;
break;
@@ -90,9 +92,9 @@ CFDE_XMLNode* CXFA_TextLayout::GetXMLContainerNode() {
}
std::unique_ptr<CFX_RTFBreak> CXFA_TextLayout::CreateBreak(bool bDefault) {
- uint32_t dwStyle = FX_RTFLAYOUTSTYLE_ExpandTab;
+ uint32_t dwStyle = FX_LAYOUTSTYLE_ExpandTab;
if (!bDefault)
- dwStyle |= FX_RTFLAYOUTSTYLE_Pagination;
+ dwStyle |= FX_LAYOUTSTYLE_Pagination;
auto pBreak = pdfium::MakeUnique<CFX_RTFBreak>(dwStyle);
pBreak->SetLineBreakTolerance(1);
@@ -101,11 +103,11 @@ std::unique_ptr<CFX_RTFBreak> CXFA_TextLayout::CreateBreak(bool bDefault) {
return pBreak;
}
-void CXFA_TextLayout::InitBreak(FX_FLOAT fLineWidth) {
+void CXFA_TextLayout::InitBreak(float fLineWidth) {
CXFA_Font font = m_pTextProvider->GetFontNode();
CXFA_Para para = m_pTextProvider->GetParaNode();
- FX_FLOAT fStart = 0;
- FX_FLOAT fStartPos = 0;
+ float fStart = 0;
+ float fStartPos = 0;
if (para) {
CFX_RTFLineAlignment iAlign = CFX_RTFLineAlignment::Left;
switch (para.GetHorizontalAlign()) {
@@ -135,7 +137,7 @@ void CXFA_TextLayout::InitBreak(FX_FLOAT fLineWidth) {
fLineWidth = fStart;
fStartPos = fStart;
- FX_FLOAT fIndent = para.GetTextIndent();
+ float fIndent = para.GetTextIndent();
if (fIndent > 0)
fStartPos += fIndent;
}
@@ -148,7 +150,7 @@ void CXFA_TextLayout::InitBreak(FX_FLOAT fLineWidth) {
m_pBreak->SetCharSpace(font.GetLetterSpacing());
}
- FX_FLOAT fFontSize = m_textParser.GetFontSize(m_pTextProvider, nullptr);
+ float fFontSize = m_textParser.GetFontSize(m_pTextProvider, nullptr);
m_pBreak->SetFontSize(fFontSize);
m_pBreak->SetFont(m_textParser.GetFont(m_pTextProvider, nullptr));
m_pBreak->SetLineBreakTolerance(fFontSize * 0.2f);
@@ -156,7 +158,7 @@ void CXFA_TextLayout::InitBreak(FX_FLOAT fLineWidth) {
void CXFA_TextLayout::InitBreak(CFDE_CSSComputedStyle* pStyle,
FDE_CSSDisplay eDisplay,
- FX_FLOAT fLineWidth,
+ float fLineWidth,
CFDE_XMLNode* pXMLNode,
CFDE_CSSComputedStyle* pParentStyle) {
if (!pStyle) {
@@ -185,7 +187,7 @@ void CXFA_TextLayout::InitBreak(CFDE_CSSComputedStyle* pStyle,
}
m_pBreak->SetAlignment(iAlign);
- FX_FLOAT fStart = 0;
+ float fStart = 0;
const FDE_CSSRect* pRect = pStyle->GetMarginWidth();
const FDE_CSSRect* pPaddingRect = pStyle->GetPaddingWidth();
if (pRect) {
@@ -215,7 +217,7 @@ void CXFA_TextLayout::InitBreak(CFDE_CSSComputedStyle* pStyle,
}
}
m_pBreak->SetLineBoundary(fStart, fLineWidth);
- FX_FLOAT fIndent = pStyle->GetTextIndent().GetValue();
+ float fIndent = pStyle->GetTextIndent().GetValue();
if (fIndent > 0)
fStart += fIndent;
@@ -224,13 +226,10 @@ void CXFA_TextLayout::InitBreak(CFDE_CSSComputedStyle* pStyle,
if (!m_pTabstopContext)
m_pTabstopContext = pdfium::MakeUnique<CXFA_TextTabstopsContext>();
m_textParser.GetTabstops(pStyle, m_pTabstopContext.get());
- for (int32_t i = 0; i < m_pTabstopContext->m_iTabCount; i++) {
- XFA_TABSTOPS* pTab = m_pTabstopContext->m_tabstops.GetDataPtr(i);
- m_pBreak->AddPositionedTab(pTab->fTabstops);
- }
+ for (const auto& stop : m_pTabstopContext->m_tabstops)
+ m_pBreak->AddPositionedTab(stop.fTabstops);
}
-
- FX_FLOAT fFontSize = m_textParser.GetFontSize(m_pTextProvider, pStyle);
+ float fFontSize = m_textParser.GetFontSize(m_pTextProvider, pStyle);
m_pBreak->SetFontSize(fFontSize);
m_pBreak->SetLineBreakTolerance(fFontSize * 0.2f);
m_pBreak->SetFont(m_textParser.GetFont(m_pTextProvider, pStyle));
@@ -248,12 +247,11 @@ int32_t CXFA_TextLayout::GetText(CFX_WideString& wsText) {
return wsText.GetLength();
}
-FX_FLOAT CXFA_TextLayout::GetLayoutHeight() {
+float CXFA_TextLayout::GetLayoutHeight() {
if (!m_pLoader)
return 0;
- int32_t iCount = m_pLoader->m_lineHeights.GetSize();
- if (iCount == 0 && m_pLoader->m_fWidth > 0) {
+ if (m_pLoader->m_lineHeights.empty() && m_pLoader->m_fWidth > 0) {
CFX_SizeF szMax(m_pLoader->m_fWidth, m_pLoader->m_fHeight);
CFX_SizeF szDef;
m_pLoader->m_bSaveLineHeight = true;
@@ -263,23 +261,23 @@ FX_FLOAT CXFA_TextLayout::GetLayoutHeight() {
return szDef.height;
}
- FX_FLOAT fHeight = m_pLoader->m_fHeight;
+ float fHeight = m_pLoader->m_fHeight;
if (fHeight < 0.1f) {
fHeight = 0;
- for (int32_t i = 0; i < iCount; i++)
- fHeight += m_pLoader->m_lineHeights.ElementAt(i);
+ for (float value : m_pLoader->m_lineHeights)
+ fHeight += value;
}
return fHeight;
}
-FX_FLOAT CXFA_TextLayout::StartLayout(FX_FLOAT fWidth) {
+float CXFA_TextLayout::StartLayout(float fWidth) {
if (!m_pLoader)
m_pLoader = pdfium::MakeUnique<CXFA_LoaderContext>();
- if (fWidth < 0 || (m_pLoader->m_fWidth > -1 &&
- FXSYS_fabs(fWidth - m_pLoader->m_fWidth) > 0)) {
- m_pLoader->m_lineHeights.RemoveAll();
- m_Blocks.RemoveAll();
+ if (fWidth < 0 ||
+ (m_pLoader->m_fWidth > -1 && fabs(fWidth - m_pLoader->m_fWidth) > 0)) {
+ m_pLoader->m_lineHeights.clear();
+ m_Blocks.clear();
Unload();
m_pLoader->m_fStartLineOffset = 0;
}
@@ -298,14 +296,14 @@ FX_FLOAT CXFA_TextLayout::StartLayout(FX_FLOAT fWidth) {
}
bool CXFA_TextLayout::DoLayout(int32_t iBlockIndex,
- FX_FLOAT& fCalcHeight,
- FX_FLOAT fContentAreaHeight,
- FX_FLOAT fTextHeight) {
+ float& fCalcHeight,
+ float fContentAreaHeight,
+ float fTextHeight) {
if (!m_pLoader)
return false;
- int32_t iBlockCount = m_Blocks.GetSize();
- FX_FLOAT fHeight = fTextHeight;
+ int32_t iBlockCount = pdfium::CollectionSize<int32_t>(m_Blocks);
+ float fHeight = fTextHeight;
if (fHeight < 0)
fHeight = GetLayoutHeight();
@@ -326,14 +324,13 @@ bool CXFA_TextLayout::DoLayout(int32_t iBlockIndex,
}
}
- FX_FLOAT fLinePos = m_pLoader->m_fStartLineOffset;
+ float fLinePos = m_pLoader->m_fStartLineOffset;
int32_t iLineIndex = 0;
if (iBlockCount > 1) {
if (iBlockCount >= (iBlockIndex + 1) * 2) {
- iLineIndex = m_Blocks.ElementAt(iBlockIndex * 2);
+ iLineIndex = m_Blocks[iBlockIndex * 2];
} else {
- iLineIndex = m_Blocks.ElementAt(iBlockCount - 1) +
- m_Blocks.ElementAt(iBlockCount - 2);
+ iLineIndex = m_Blocks[iBlockCount - 1] + m_Blocks[iBlockCount - 2];
}
if (!m_pLoader->m_BlocksHeight.empty()) {
for (int32_t i = 0; i < iBlockIndex; i++)
@@ -341,21 +338,21 @@ bool CXFA_TextLayout::DoLayout(int32_t iBlockIndex,
}
}
- int32_t iCount = m_pLoader->m_lineHeights.GetSize();
+ int32_t iCount = pdfium::CollectionSize<int32_t>(m_pLoader->m_lineHeights);
int32_t i = 0;
for (i = iLineIndex; i < iCount; i++) {
- FX_FLOAT fLineHeight = m_pLoader->m_lineHeights.ElementAt(i);
- if ((i == iLineIndex) && (fLineHeight - fContentAreaHeight > 0.001)) {
+ float fLineHeight = m_pLoader->m_lineHeights[i];
+ if (i == iLineIndex && fLineHeight - fContentAreaHeight > 0.001) {
fCalcHeight = 0;
return true;
}
if (fLinePos + fLineHeight - fContentAreaHeight > 0.001) {
if (iBlockCount >= (iBlockIndex + 1) * 2) {
- m_Blocks.SetAt(iBlockIndex * 2, iLineIndex);
- m_Blocks.SetAt(iBlockIndex * 2 + 1, i - iLineIndex);
+ m_Blocks[iBlockIndex * 2] = iLineIndex;
+ m_Blocks[iBlockIndex * 2 + 1] = i - iLineIndex;
} else {
- m_Blocks.Add(iLineIndex);
- m_Blocks.Add(i - iLineIndex);
+ m_Blocks.push_back(iLineIndex);
+ m_Blocks.push_back(i - iLineIndex);
}
if (i == iLineIndex) {
if (fCalcHeight <= fLinePos) {
@@ -364,7 +361,7 @@ bool CXFA_TextLayout::DoLayout(int32_t iBlockIndex,
(m_pLoader->m_BlocksHeight[iBlockIndex * 2] == iBlockIndex)) {
m_pLoader->m_BlocksHeight[iBlockIndex * 2 + 1] = fCalcHeight;
} else {
- m_pLoader->m_BlocksHeight.push_back((FX_FLOAT)iBlockIndex);
+ m_pLoader->m_BlocksHeight.push_back((float)iBlockIndex);
m_pLoader->m_BlocksHeight.push_back(fCalcHeight);
}
}
@@ -380,7 +377,7 @@ bool CXFA_TextLayout::DoLayout(int32_t iBlockIndex,
}
int32_t CXFA_TextLayout::CountBlocks() const {
- int32_t iCount = m_Blocks.GetSize() / 2;
+ int32_t iCount = pdfium::CollectionSize<int32_t>(m_Blocks) / 2;
return iCount > 0 ? iCount : 1;
}
@@ -392,7 +389,7 @@ bool CXFA_TextLayout::CalcSize(const CFX_SizeF& minSize,
defaultSize.width = 0xFFFF;
m_pBreak = CreateBreak(false);
- FX_FLOAT fLinePos = 0;
+ float fLinePos = 0;
m_iLines = 0;
m_fMaxWidth = 0;
Loader(defaultSize, fLinePos, false);
@@ -404,7 +401,7 @@ bool CXFA_TextLayout::CalcSize(const CFX_SizeF& minSize,
return true;
}
-bool CXFA_TextLayout::Layout(const CFX_SizeF& size, FX_FLOAT* fHeight) {
+bool CXFA_TextLayout::Layout(const CFX_SizeF& size, float* fHeight) {
if (size.width < 1)
return false;
@@ -416,7 +413,7 @@ bool CXFA_TextLayout::Layout(const CFX_SizeF& size, FX_FLOAT* fHeight) {
}
m_iLines = 0;
- FX_FLOAT fLinePos = 0;
+ float fLinePos = 0;
Loader(size, fLinePos, true);
UpdateAlign(size.height, fLinePos);
m_pTabstopContext.reset();
@@ -433,10 +430,10 @@ bool CXFA_TextLayout::Layout(int32_t iBlock) {
m_pLoader->m_iTotalLines = -1;
m_iLines = 0;
- FX_FLOAT fLinePos = 0;
+ float fLinePos = 0;
CXFA_Node* pNode = nullptr;
CFX_SizeF szText(m_pLoader->m_fWidth, m_pLoader->m_fHeight);
- int32_t iCount = m_Blocks.GetSize();
+ int32_t iCount = pdfium::CollectionSize<int32_t>(m_Blocks);
int32_t iBlocksHeightCount =
pdfium::CollectionSize<int32_t>(m_pLoader->m_BlocksHeight);
iBlocksHeightCount /= 2;
@@ -451,7 +448,7 @@ bool CXFA_TextLayout::Layout(int32_t iBlock) {
m_pLoader->m_iChar = 0;
if (iCount > 1)
- m_pLoader->m_iTotalLines = m_Blocks.ElementAt(iBlock * 2 + 1);
+ m_pLoader->m_iTotalLines = m_Blocks[iBlock * 2 + 1];
Loader(szText, fLinePos, true);
if (iCount == 0 && m_pLoader->m_fStartLineOffset < 0.1f)
@@ -459,7 +456,7 @@ bool CXFA_TextLayout::Layout(int32_t iBlock) {
} else if (m_pTextDataNode) {
iBlock *= 2;
if (iBlock < iCount - 2)
- m_pLoader->m_iTotalLines = m_Blocks.ElementAt(iBlock + 1);
+ m_pLoader->m_iTotalLines = m_Blocks[iBlock + 1];
m_pBreak->Reset();
if (m_bRichText) {
@@ -517,13 +514,14 @@ void CXFA_TextLayout::ItemBlocks(const CFX_RectF& rtText, int32_t iBlockIndex) {
if (!m_pLoader)
return;
- int32_t iCountHeight = m_pLoader->m_lineHeights.GetSize();
+ int32_t iCountHeight =
+ pdfium::CollectionSize<int32_t>(m_pLoader->m_lineHeights);
if (iCountHeight == 0)
return;
bool bEndItem = true;
- int32_t iBlockCount = m_Blocks.GetSize();
- FX_FLOAT fLinePos = m_pLoader->m_fStartLineOffset;
+ int32_t iBlockCount = pdfium::CollectionSize<int32_t>(m_Blocks);
+ float fLinePos = m_pLoader->m_fStartLineOffset;
int32_t iLineIndex = 0;
if (iBlockIndex > 0) {
int32_t iBlockHeightCount =
@@ -540,18 +538,18 @@ void CXFA_TextLayout::ItemBlocks(const CFX_RectF& rtText, int32_t iBlockIndex) {
int32_t i = 0;
for (i = iLineIndex; i < iCountHeight; i++) {
- FX_FLOAT fLineHeight = m_pLoader->m_lineHeights.ElementAt(i);
+ float fLineHeight = m_pLoader->m_lineHeights[i];
if (fLinePos + fLineHeight - rtText.height > 0.001) {
- m_Blocks.Add(iLineIndex);
- m_Blocks.Add(i - iLineIndex);
+ m_Blocks.push_back(iLineIndex);
+ m_Blocks.push_back(i - iLineIndex);
bEndItem = false;
break;
}
fLinePos += fLineHeight;
}
if (iCountHeight > 0 && (i - iLineIndex) > 0 && bEndItem) {
- m_Blocks.Add(iLineIndex);
- m_Blocks.Add(i - iLineIndex);
+ m_Blocks.push_back(iLineIndex);
+ m_Blocks.push_back(i - iLineIndex);
}
}
@@ -562,8 +560,7 @@ bool CXFA_TextLayout::DrawString(CFX_RenderDevice* pFxDevice,
if (!pFxDevice)
return false;
- std::unique_ptr<CFDE_RenderDevice> pDevice(
- new CFDE_RenderDevice(pFxDevice, false));
+ auto pDevice = pdfium::MakeUnique<CFDE_RenderDevice>(pFxDevice, false);
pDevice->SaveState();
pDevice->SetClipRect(rtClip);
@@ -579,12 +576,12 @@ bool CXFA_TextLayout::DrawString(CFX_RenderDevice* pFxDevice,
int32_t iCharCount = 0;
int32_t iLineStart = 0;
int32_t iPieceLines = pdfium::CollectionSize<int32_t>(m_pieceLines);
- int32_t iCount = m_Blocks.GetSize();
+ int32_t iCount = pdfium::CollectionSize<int32_t>(m_Blocks);
if (iCount > 0) {
iBlock *= 2;
if (iBlock < iCount) {
- iLineStart = m_Blocks.ElementAt(iBlock);
- iPieceLines = m_Blocks.ElementAt(iBlock + 1);
+ iLineStart = m_Blocks[iBlock];
+ iPieceLines = m_Blocks[iBlock + 1];
} else {
iPieceLines = 0;
}
@@ -605,7 +602,7 @@ bool CXFA_TextLayout::DrawString(CFX_RenderDevice* pFxDevice,
pCharPos = FX_Alloc(FXTEXT_CHARPOS, iChars);
iCharCount = iChars;
}
- FXSYS_memset(pCharPos, 0, iCharCount * sizeof(FXTEXT_CHARPOS));
+ memset(pCharPos, 0, iCharCount * sizeof(FXTEXT_CHARPOS));
RenderString(pDevice.get(), pSolidBrush.get(), pPieceLine, j, pCharPos,
tmDoc2Device);
}
@@ -619,7 +616,7 @@ bool CXFA_TextLayout::DrawString(CFX_RenderDevice* pFxDevice,
return iPieceLines > 0;
}
-void CXFA_TextLayout::UpdateAlign(FX_FLOAT fHeight, FX_FLOAT fBottom) {
+void CXFA_TextLayout::UpdateAlign(float fHeight, float fBottom) {
fHeight -= fBottom;
if (fHeight < 0.1f)
return;
@@ -641,7 +638,7 @@ void CXFA_TextLayout::UpdateAlign(FX_FLOAT fHeight, FX_FLOAT fBottom) {
}
bool CXFA_TextLayout::Loader(const CFX_SizeF& szText,
- FX_FLOAT& fLinePos,
+ float& fLinePos,
bool bSavePieces) {
GetTextDataNode();
if (!m_pTextDataNode)
@@ -665,12 +662,12 @@ bool CXFA_TextLayout::Loader(const CFX_SizeF& szText,
void CXFA_TextLayout::LoadText(CXFA_Node* pNode,
const CFX_SizeF& szText,
- FX_FLOAT& fLinePos,
+ float& fLinePos,
bool bSavePieces) {
InitBreak(szText.width);
CXFA_Para para = m_pTextProvider->GetParaNode();
- FX_FLOAT fSpaceAbove = 0;
+ float fSpaceAbove = 0;
if (para) {
fSpaceAbove = para.GetSpaceAbove();
if (fSpaceAbove < 0.1f) {
@@ -693,13 +690,13 @@ void CXFA_TextLayout::LoadText(CXFA_Node* pNode,
if (bRet && m_pLoader)
m_pLoader->m_pNode = pNode;
else
- EndBreak(CFX_RTFBreakType::Paragraph, fLinePos, bSavePieces);
+ EndBreak(CFX_BreakType::Paragraph, fLinePos, bSavePieces);
}
bool CXFA_TextLayout::LoadRichText(
CFDE_XMLNode* pXMLNode,
const CFX_SizeF& szText,
- FX_FLOAT& fLinePos,
+ float& fLinePos,
const CFX_RetainPtr<CFDE_CSSComputedStyle>& pParentStyle,
bool bSavePieces,
CFX_RetainPtr<CXFA_LinkUserData> pLinkData,
@@ -713,7 +710,7 @@ bool CXFA_TextLayout::LoadRichText(
m_textParser.GetParseContextFromMap(pXMLNode);
FDE_CSSDisplay eDisplay = FDE_CSSDisplay::None;
bool bContentNode = false;
- FX_FLOAT fSpaceBelow = 0;
+ float fSpaceBelow = 0;
CFX_RetainPtr<CFDE_CSSComputedStyle> pStyle;
CFX_WideString wsName;
if (bEndBreak) {
@@ -729,7 +726,7 @@ bool CXFA_TextLayout::LoadRichText(
bContentNode = true;
} else if (pXMLNode->GetType() == FDE_XMLNODE_Element) {
pElement = static_cast<CFDE_XMLElement*>(pXMLNode);
- pElement->GetLocalTagName(wsName);
+ wsName = pElement->GetLocalTagName();
}
if (wsName == L"ol") {
bIsOl = true;
@@ -759,9 +756,8 @@ bool CXFA_TextLayout::LoadRichText(
}
if (wsName == L"a") {
- CFX_WideString wsLinkContent;
ASSERT(pElement);
- pElement->GetString(L"href", wsLinkContent);
+ CFX_WideString wsLinkContent = pElement->GetString(L"href");
if (!wsLinkContent.IsEmpty()) {
pLinkData = pdfium::MakeRetain<CXFA_LinkUserData>(
wsLinkContent.GetBuffer(wsLinkContent.GetLength()));
@@ -775,7 +771,7 @@ bool CXFA_TextLayout::LoadRichText(
bContentNode ? pParentStyle.Get() : pStyle.Get());
CFX_WideString wsText;
if (bContentNode && iTabCount == 0) {
- static_cast<CFDE_XMLText*>(pXMLNode)->GetText(wsText);
+ wsText = static_cast<CFDE_XMLText*>(pXMLNode)->GetText();
} else if (wsName == L"br") {
wsText = L'\n';
} else if (wsName == L"li") {
@@ -856,7 +852,7 @@ bool CXFA_TextLayout::LoadRichText(
m_pLoader->m_dwFlags |= XFA_LOADERCNTXTFLG_FILTERSPACE;
}
if (bCurLi)
- EndBreak(CFX_RTFBreakType::Line, fLinePos, bSavePieces);
+ EndBreak(CFX_BreakType::Line, fLinePos, bSavePieces);
} else {
if (pContext)
eDisplay = pContext->GetDisplay();
@@ -864,9 +860,9 @@ bool CXFA_TextLayout::LoadRichText(
if (m_bBlockContinue) {
if (pContext && !bContentNode) {
- CFX_RTFBreakType dwStatus = (eDisplay == FDE_CSSDisplay::Block)
- ? CFX_RTFBreakType::Paragraph
- : CFX_RTFBreakType::Piece;
+ CFX_BreakType dwStatus = (eDisplay == FDE_CSSDisplay::Block)
+ ? CFX_BreakType::Paragraph
+ : CFX_BreakType::Piece;
EndBreak(dwStatus, fLinePos, bSavePieces);
if (eDisplay == FDE_CSSDisplay::Block) {
fLinePos += fSpaceBelow;
@@ -887,30 +883,29 @@ bool CXFA_TextLayout::LoadRichText(
}
bool CXFA_TextLayout::AppendChar(const CFX_WideString& wsText,
- FX_FLOAT& fLinePos,
- FX_FLOAT fSpaceAbove,
+ float& fLinePos,
+ float fSpaceAbove,
bool bSavePieces) {
- CFX_RTFBreakType dwStatus = CFX_RTFBreakType::None;
+ CFX_BreakType dwStatus = CFX_BreakType::None;
int32_t iChar = 0;
if (m_pLoader)
iChar = m_pLoader->m_iChar;
int32_t iLength = wsText.GetLength();
for (int32_t i = iChar; i < iLength; i++) {
- FX_WCHAR wch = wsText.GetAt(i);
+ wchar_t wch = wsText.GetAt(i);
if (wch == 0xA0)
wch = 0x20;
dwStatus = m_pBreak->AppendChar(wch);
- if (dwStatus != CFX_RTFBreakType::None &&
- dwStatus != CFX_RTFBreakType::Piece) {
+ if (dwStatus != CFX_BreakType::None && dwStatus != CFX_BreakType::Piece) {
AppendTextLine(dwStatus, fLinePos, bSavePieces);
if (IsEnd(bSavePieces)) {
if (m_pLoader)
m_pLoader->m_iChar = i;
return true;
}
- if (dwStatus == CFX_RTFBreakType::Paragraph && m_bRichText)
+ if (dwStatus == CFX_BreakType::Paragraph && m_bRichText)
fLinePos += fSpaceAbove;
}
}
@@ -933,9 +928,9 @@ void CXFA_TextLayout::ProcessText(CFX_WideString& wsText) {
if (iLen == 0)
return;
- FX_WCHAR* psz = wsText.GetBuffer(iLen);
+ wchar_t* psz = wsText.GetBuffer(iLen);
int32_t iTrimLeft = 0;
- FX_WCHAR wch = 0, wPrev = 0;
+ wchar_t wch = 0, wPrev = 0;
for (int32_t i = 0; i < iLen; i++) {
wch = psz[i];
if (wch < 0x20)
@@ -950,21 +945,22 @@ void CXFA_TextLayout::ProcessText(CFX_WideString& wsText) {
wsText = wsText.Left(iTrimLeft);
}
-void CXFA_TextLayout::EndBreak(CFX_RTFBreakType dwStatus,
- FX_FLOAT& fLinePos,
+void CXFA_TextLayout::EndBreak(CFX_BreakType dwStatus,
+ float& fLinePos,
bool bSavePieces) {
dwStatus = m_pBreak->EndBreak(dwStatus);
- if (dwStatus != CFX_RTFBreakType::None && dwStatus != CFX_RTFBreakType::Piece)
+ if (dwStatus != CFX_BreakType::None && dwStatus != CFX_BreakType::Piece)
AppendTextLine(dwStatus, fLinePos, bSavePieces, true);
}
void CXFA_TextLayout::DoTabstops(CFDE_CSSComputedStyle* pStyle,
CXFA_PieceLine* pPieceLine) {
- if (!m_pTabstopContext || m_pTabstopContext->m_iTabCount == 0)
- return;
if (!pStyle || !pPieceLine)
return;
+ if (!m_pTabstopContext || m_pTabstopContext->m_tabstops.empty())
+ return;
+
int32_t iPieces = pdfium::CollectionSize<int32_t>(pPieceLine->m_textPieces);
if (iPieces == 0)
return;
@@ -972,13 +968,13 @@ void CXFA_TextLayout::DoTabstops(CFDE_CSSComputedStyle* pStyle,
XFA_TextPiece* pPiece = pPieceLine->m_textPieces[iPieces - 1].get();
int32_t& iTabstopsIndex = m_pTabstopContext->m_iTabIndex;
int32_t iCount = m_textParser.CountTabs(pStyle);
- if (iTabstopsIndex > m_pTabstopContext->m_iTabCount - 1)
+ if (!pdfium::IndexInBounds(m_pTabstopContext->m_tabstops, iTabstopsIndex))
return;
if (iCount > 0) {
iTabstopsIndex++;
m_pTabstopContext->m_bTabstops = true;
- FX_FLOAT fRight = 0;
+ float fRight = 0;
if (iPieces > 1) {
XFA_TextPiece* p = pPieceLine->m_textPieces[iPieces - 2].get();
fRight = p->rtPiece.right();
@@ -986,11 +982,9 @@ void CXFA_TextLayout::DoTabstops(CFDE_CSSComputedStyle* pStyle,
m_pTabstopContext->m_fTabWidth =
pPiece->rtPiece.width + pPiece->rtPiece.left - fRight;
} else if (iTabstopsIndex > -1) {
- FX_FLOAT fLeft = 0;
+ float fLeft = 0;
if (m_pTabstopContext->m_bTabstops) {
- XFA_TABSTOPS* pTabstops =
- m_pTabstopContext->m_tabstops.GetDataPtr(iTabstopsIndex);
- uint32_t dwAlign = pTabstops->dwAlign;
+ uint32_t dwAlign = m_pTabstopContext->m_tabstops[iTabstopsIndex].dwAlign;
if (dwAlign == FX_HashCode_GetW(L"center", false)) {
fLeft = pPiece->rtPiece.width / 2.0f;
} else if (dwAlign == FX_HashCode_GetW(L"right", false) ||
@@ -1014,8 +1008,8 @@ void CXFA_TextLayout::DoTabstops(CFDE_CSSComputedStyle* pStyle,
}
}
-void CXFA_TextLayout::AppendTextLine(CFX_RTFBreakType dwStatus,
- FX_FLOAT& fLinePos,
+void CXFA_TextLayout::AppendTextLine(CFX_BreakType dwStatus,
+ float& fLinePos,
bool bSavePieces,
bool bEndBreak) {
int32_t iPieces = m_pBreak->CountBreakPieces();
@@ -1030,15 +1024,15 @@ void CXFA_TextLayout::AppendTextLine(CFX_RTFBreakType dwStatus,
if (m_pTabstopContext)
m_pTabstopContext->Reset();
- FX_FLOAT fLineStep = 0, fBaseLine = 0;
+ float fLineStep = 0, fBaseLine = 0;
int32_t i = 0;
for (i = 0; i < iPieces; i++) {
- const CFX_RTFPiece* pPiece = m_pBreak->GetBreakPiece(i);
+ const CFX_BreakPiece* pPiece = m_pBreak->GetBreakPieceUnstable(i);
CXFA_TextUserData* pUserData =
static_cast<CXFA_TextUserData*>(pPiece->m_pUserData.Get());
if (pUserData)
pStyle = pUserData->m_pStyle;
- FX_FLOAT fVerScale = pPiece->m_iVerticalScale / 100.0f;
+ float fVerScale = pPiece->m_iVerticalScale / 100.0f;
auto pTP = pdfium::MakeUnique<XFA_TextPiece>();
pTP->iChars = pPiece->m_iChars;
@@ -1056,15 +1050,15 @@ void CXFA_TextLayout::AppendTextLine(CFX_RTFBreakType dwStatus,
pTP->fFontSize = m_textParser.GetFontSize(m_pTextProvider, pStyle.Get());
pTP->rtPiece.left = pPiece->m_iStartPos / 20000.0f;
pTP->rtPiece.width = pPiece->m_iWidth / 20000.0f;
- pTP->rtPiece.height = (FX_FLOAT)pPiece->m_iFontSize * fVerScale / 20.0f;
- FX_FLOAT fBaseLineTemp =
+ pTP->rtPiece.height = (float)pPiece->m_iFontSize * fVerScale / 20.0f;
+ float fBaseLineTemp =
m_textParser.GetBaseline(m_pTextProvider, pStyle.Get());
pTP->rtPiece.top = fBaseLineTemp;
- FX_FLOAT fLineHeight = m_textParser.GetLineHeight(
+ float fLineHeight = m_textParser.GetLineHeight(
m_pTextProvider, pStyle.Get(), m_iLines == 0, fVerScale);
if (fBaseLineTemp > 0) {
- FX_FLOAT fLineHeightTmp = fBaseLineTemp + pTP->rtPiece.height;
+ float fLineHeightTmp = fBaseLineTemp + pTP->rtPiece.height;
if (fLineHeight < fLineHeightTmp)
fLineHeight = fLineHeightTmp;
else
@@ -1078,29 +1072,28 @@ void CXFA_TextLayout::AppendTextLine(CFX_RTFBreakType dwStatus,
DoTabstops(pStyle.Get(), pPieceLine);
}
for (const auto& pTP : pPieceLine->m_textPieces) {
- FX_FLOAT& fTop = pTP->rtPiece.top;
- FX_FLOAT fBaseLineTemp = fTop;
+ float& fTop = pTP->rtPiece.top;
+ float fBaseLineTemp = fTop;
fTop = fLinePos + fLineStep - pTP->rtPiece.height - fBaseLineTemp;
fTop = std::max(0.0f, fTop);
}
fLinePos += fLineStep + fBaseLine;
} else {
- FX_FLOAT fLineStep = 0;
- FX_FLOAT fLineWidth = 0;
+ float fLineStep = 0;
+ float fLineWidth = 0;
for (int32_t i = 0; i < iPieces; i++) {
- const CFX_RTFPiece* pPiece = m_pBreak->GetBreakPiece(i);
+ const CFX_BreakPiece* pPiece = m_pBreak->GetBreakPieceUnstable(i);
CXFA_TextUserData* pUserData =
static_cast<CXFA_TextUserData*>(pPiece->m_pUserData.Get());
if (pUserData)
pStyle = pUserData->m_pStyle;
- FX_FLOAT fVerScale = pPiece->m_iVerticalScale / 100.0f;
- FX_FLOAT fBaseLine =
- m_textParser.GetBaseline(m_pTextProvider, pStyle.Get());
- FX_FLOAT fLineHeight = m_textParser.GetLineHeight(
+ float fVerScale = pPiece->m_iVerticalScale / 100.0f;
+ float fBaseLine = m_textParser.GetBaseline(m_pTextProvider, pStyle.Get());
+ float fLineHeight = m_textParser.GetLineHeight(
m_pTextProvider, pStyle.Get(), m_iLines == 0, fVerScale);
if (fBaseLine > 0) {
- FX_FLOAT fLineHeightTmp =
- fBaseLine + (FX_FLOAT)pPiece->m_iFontSize * fVerScale / 20.0f;
+ float fLineHeightTmp =
+ fBaseLine + (float)pPiece->m_iFontSize * fVerScale / 20.0f;
if (fLineHeight < fLineHeightTmp) {
fLineHeight = fLineHeightTmp;
}
@@ -1111,24 +1104,24 @@ void CXFA_TextLayout::AppendTextLine(CFX_RTFBreakType dwStatus,
fLinePos += fLineStep;
m_fMaxWidth = std::max(m_fMaxWidth, fLineWidth);
if (m_pLoader && m_pLoader->m_bSaveLineHeight) {
- FX_FLOAT fHeight = fLinePos - m_pLoader->m_fLastPos;
+ float fHeight = fLinePos - m_pLoader->m_fLastPos;
m_pLoader->m_fLastPos = fLinePos;
- m_pLoader->m_lineHeights.Add(fHeight);
+ m_pLoader->m_lineHeights.push_back(fHeight);
}
}
m_pBreak->ClearBreakPieces();
- if (dwStatus == CFX_RTFBreakType::Paragraph) {
+ if (dwStatus == CFX_BreakType::Paragraph) {
m_pBreak->Reset();
if (!pStyle && bEndBreak) {
CXFA_Para para = m_pTextProvider->GetParaNode();
if (para) {
- FX_FLOAT fStartPos = para.GetMarginLeft();
- FX_FLOAT fIndent = para.GetTextIndent();
+ float fStartPos = para.GetMarginLeft();
+ float fIndent = para.GetTextIndent();
if (fIndent > 0)
fStartPos += fIndent;
- FX_FLOAT fSpaceBelow = para.GetSpaceBelow();
+ float fSpaceBelow = para.GetSpaceBelow();
if (fSpaceBelow < 0.1f)
fSpaceBelow = 0;
@@ -1139,12 +1132,12 @@ void CXFA_TextLayout::AppendTextLine(CFX_RTFBreakType dwStatus,
}
if (pStyle) {
- FX_FLOAT fStart = 0;
+ float fStart = 0;
const FDE_CSSRect* pRect = pStyle->GetMarginWidth();
if (pRect)
fStart = pRect->left.GetValue();
- FX_FLOAT fTextIndent = pStyle->GetTextIndent().GetValue();
+ float fTextIndent = pStyle->GetTextIndent().GetValue();
if (fTextIndent < 0)
fStart -= fTextIndent;
@@ -1166,7 +1159,7 @@ void CXFA_TextLayout::RenderString(CFDE_RenderDevice* pDevice,
pDevice->DrawString(pBrush, pPiece->pFont, pCharPos, iCount,
pPiece->fFontSize, &tmDoc2Device);
}
- pPieceLine->m_charCounts.Add(iCount);
+ pPieceLine->m_charCounts.push_back(iCount);
}
void CXFA_TextLayout::RenderPath(CFDE_RenderDevice* pDevice,
@@ -1182,11 +1175,11 @@ void CXFA_TextLayout::RenderPath(CFDE_RenderDevice* pDevice,
return;
pPen->SetColor(pPiece->dwColor);
- std::unique_ptr<CFDE_Path> pPath(new CFDE_Path);
+ auto pPath = pdfium::MakeUnique<CFDE_Path>();
int32_t iChars = GetDisplayPos(pPiece, pCharPos);
if (iChars > 0) {
CFX_PointF pt1, pt2;
- FX_FLOAT fEndY = pCharPos[0].m_Origin.y + 1.05f;
+ float fEndY = pCharPos[0].m_Origin.y + 1.05f;
if (pPiece->iPeriod == XFA_ATTRIBUTEENUM_Word) {
for (int32_t i = 0; i < pPiece->iUnderline; i++) {
for (int32_t j = 0; j < iChars; j++) {
@@ -1224,10 +1217,11 @@ void CXFA_TextLayout::RenderPath(CFDE_RenderDevice* pDevice,
return;
}
int32_t iCharsTmp = 0;
- int32_t iPiecePrev = iPiece, iPieceNext = iPiece;
+ int32_t iPiecePrev = iPiece;
+ int32_t iPieceNext = iPiece;
while (iPiecePrev > 0) {
iPiecePrev--;
- iCharsTmp = pPieceLine->m_charCounts.GetAt(iPiecePrev);
+ iCharsTmp = pPieceLine->m_charCounts[iPiecePrev];
if (iCharsTmp > 0)
break;
}
@@ -1238,15 +1232,15 @@ void CXFA_TextLayout::RenderPath(CFDE_RenderDevice* pDevice,
int32_t iPieces = pdfium::CollectionSize<int32_t>(pPieceLine->m_textPieces);
while (iPieceNext < iPieces - 1) {
iPieceNext++;
- iCharsTmp = pPieceLine->m_charCounts.GetAt(iPieceNext);
+ iCharsTmp = pPieceLine->m_charCounts[iPieceNext];
if (iCharsTmp > 0)
break;
}
if (iCharsTmp == 0)
return;
- FX_FLOAT fOrgX = 0.0f;
- FX_FLOAT fEndX = 0.0f;
+ float fOrgX = 0.0f;
+ float fEndX = 0.0f;
pPiece = pPieceLine->m_textPieces[iPiecePrev].get();
iChars = GetDisplayPos(pPiece, pCharPos);
if (iChars < 1)
@@ -1264,7 +1258,7 @@ void CXFA_TextLayout::RenderPath(CFDE_RenderDevice* pDevice,
CFX_PointF pt2;
pt1.x = fOrgX;
pt2.x = fEndX;
- FX_FLOAT fEndY = pCharPos[0].m_Origin.y + 1.05f;
+ float fEndY = pCharPos[0].m_Origin.y + 1.05f;
for (int32_t i = 0; i < pPiece->iUnderline; i++) {
pt1.y = fEndY;
pt2.y = fEndY;
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_textlayout.h b/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_textlayout.h
index d4d60cf81e6..9bfc9772474 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_textlayout.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_textlayout.h
@@ -37,17 +37,17 @@ class CXFA_TextLayout {
~CXFA_TextLayout();
int32_t GetText(CFX_WideString& wsText);
- FX_FLOAT GetLayoutHeight();
- FX_FLOAT StartLayout(FX_FLOAT fWidth = -1);
+ float GetLayoutHeight();
+ float StartLayout(float fWidth = -1);
bool DoLayout(int32_t iBlockIndex,
- FX_FLOAT& fCalcHeight,
- FX_FLOAT fContentAreaHeight = -1,
- FX_FLOAT fTextHeight = -1);
+ float& fCalcHeight,
+ float fContentAreaHeight = -1,
+ float fTextHeight = -1);
bool CalcSize(const CFX_SizeF& minSize,
const CFX_SizeF& maxSize,
CFX_SizeF& defaultSize);
- bool Layout(const CFX_SizeF& size, FX_FLOAT* fHeight = nullptr);
+ bool Layout(const CFX_SizeF& size, float* fHeight = nullptr);
void ItemBlocks(const CFX_RectF& rtText, int32_t iBlockIndex);
bool DrawString(CFX_RenderDevice* pFxDevice,
const CFX_Matrix& tmDoc2Device,
@@ -60,28 +60,28 @@ class CXFA_TextLayout {
}
bool m_bHasBlock;
- CFX_ArrayTemplate<int32_t> m_Blocks;
+ std::vector<int32_t> m_Blocks;
private:
void GetTextDataNode();
CFDE_XMLNode* GetXMLContainerNode();
std::unique_ptr<CFX_RTFBreak> CreateBreak(bool bDefault);
- void InitBreak(FX_FLOAT fLineWidth);
+ void InitBreak(float fLineWidth);
void InitBreak(CFDE_CSSComputedStyle* pStyle,
FDE_CSSDisplay eDisplay,
- FX_FLOAT fLineWidth,
+ float fLineWidth,
CFDE_XMLNode* pXMLNode,
CFDE_CSSComputedStyle* pParentStyle = nullptr);
bool Loader(const CFX_SizeF& szText,
- FX_FLOAT& fLinePos,
+ float& fLinePos,
bool bSavePieces = true);
void LoadText(CXFA_Node* pNode,
const CFX_SizeF& szText,
- FX_FLOAT& fLinePos,
+ float& fLinePos,
bool bSavePieces);
bool LoadRichText(CFDE_XMLNode* pXMLNode,
const CFX_SizeF& szText,
- FX_FLOAT& fLinePos,
+ float& fLinePos,
const CFX_RetainPtr<CFDE_CSSComputedStyle>& pParentStyle,
bool bSavePieces,
CFX_RetainPtr<CXFA_LinkUserData> pLinkData,
@@ -89,17 +89,17 @@ class CXFA_TextLayout {
bool bIsOl = false,
int32_t iLiCount = 0);
bool AppendChar(const CFX_WideString& wsText,
- FX_FLOAT& fLinePos,
- FX_FLOAT fSpaceAbove,
+ float& fLinePos,
+ float fSpaceAbove,
bool bSavePieces);
- void AppendTextLine(CFX_RTFBreakType dwStatus,
- FX_FLOAT& fLinePos,
+ void AppendTextLine(CFX_BreakType dwStatus,
+ float& fLinePos,
bool bSavePieces,
bool bEndBreak = false);
- void EndBreak(CFX_RTFBreakType dwStatus, FX_FLOAT& fLinePos, bool bDefault);
+ void EndBreak(CFX_BreakType dwStatus, float& fLinePos, bool bDefault);
bool IsEnd(bool bSavePieces);
void ProcessText(CFX_WideString& wsText);
- void UpdateAlign(FX_FLOAT fHeight, FX_FLOAT fBottom);
+ void UpdateAlign(float fHeight, float fBottom);
void RenderString(CFDE_RenderDevice* pDevice,
CFDE_Brush* pBrush,
CXFA_PieceLine* pPieceLine,
@@ -126,7 +126,7 @@ class CXFA_TextLayout {
std::unique_ptr<CFX_RTFBreak> m_pBreak;
std::unique_ptr<CXFA_LoaderContext> m_pLoader;
int32_t m_iLines;
- FX_FLOAT m_fMaxWidth;
+ float m_fMaxWidth;
CXFA_TextParser m_textParser;
std::vector<std::unique_ptr<CXFA_PieceLine>> m_pieceLines;
std::unique_ptr<CXFA_TextTabstopsContext> m_pTabstopContext;
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_textparsecontext.h b/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_textparsecontext.h
index 5ea68e94739..514d5d74783 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_textparsecontext.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_textparsecontext.h
@@ -31,7 +31,7 @@ class CXFA_TextParseContext {
CFX_RetainPtr<CFDE_CSSComputedStyle> m_pParentStyle;
- protected:
+ private:
std::vector<const CFDE_CSSDeclaration*> decls_;
FDE_CSSDisplay m_eDisplay;
};
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_textparser.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_textparser.cpp
index 9759cb219d2..6f394dd5e24 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_textparser.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_textparser.cpp
@@ -15,16 +15,18 @@
#include "xfa/fde/css/cfde_cssstyleselector.h"
#include "xfa/fde/css/cfde_cssstylesheet.h"
#include "xfa/fde/css/fde_css.h"
+#include "xfa/fde/xml/cfde_xmlelement.h"
+#include "xfa/fde/xml/cfde_xmlnode.h"
#include "xfa/fgas/crt/fgas_codepage.h"
#include "xfa/fgas/font/cfgas_fontmgr.h"
#include "xfa/fxfa/app/cxfa_csstagprovider.h"
#include "xfa/fxfa/app/cxfa_textparsecontext.h"
#include "xfa/fxfa/app/cxfa_texttabstopscontext.h"
#include "xfa/fxfa/app/xfa_ffwidgetacc.h"
+#include "xfa/fxfa/cxfa_ffapp.h"
+#include "xfa/fxfa/cxfa_ffdoc.h"
+#include "xfa/fxfa/cxfa_fontmgr.h"
#include "xfa/fxfa/parser/cxfa_measurement.h"
-#include "xfa/fxfa/xfa_ffapp.h"
-#include "xfa/fxfa/xfa_ffdoc.h"
-#include "xfa/fxfa/xfa_fontmgr.h"
namespace {
@@ -43,21 +45,13 @@ enum class TabStopStatus {
CXFA_TextParser::CXFA_TextParser()
: m_bParsed(false), m_cssInitialized(false) {}
-CXFA_TextParser::~CXFA_TextParser() {
- for (auto& pair : m_mapXMLNodeToParseContext) {
- if (pair.second)
- delete pair.second;
- }
-}
+CXFA_TextParser::~CXFA_TextParser() {}
void CXFA_TextParser::Reset() {
- for (auto& pair : m_mapXMLNodeToParseContext) {
- if (pair.second)
- delete pair.second;
- }
m_mapXMLNodeToParseContext.clear();
m_bParsed = false;
}
+
void CXFA_TextParser::InitCSSData(CXFA_TextProvider* pTextProvider) {
if (!pTextProvider)
return;
@@ -67,12 +61,8 @@ void CXFA_TextParser::InitCSSData(CXFA_TextProvider* pTextProvider) {
CFGAS_FontMgr* pFontMgr = pDoc->GetApp()->GetFDEFontMgr();
ASSERT(pFontMgr);
m_pSelector = pdfium::MakeUnique<CFDE_CSSStyleSelector>(pFontMgr);
- FX_FLOAT fFontSize = 10;
CXFA_Font font = pTextProvider->GetFontNode();
- if (font) {
- fFontSize = font.GetFontSize();
- }
- m_pSelector->SetDefFontSize(fFontSize);
+ m_pSelector->SetDefFontSize(font ? font.GetFontSize() : 10.0f);
}
if (m_cssInitialized)
@@ -85,7 +75,7 @@ void CXFA_TextParser::InitCSSData(CXFA_TextProvider* pTextProvider) {
}
std::unique_ptr<CFDE_CSSStyleSheet> CXFA_TextParser::LoadDefaultSheetStyle() {
- static const FX_WCHAR s_pStyle[] =
+ static const wchar_t s_pStyle[] =
L"html,body,ol,p,ul{display:block}"
L"li{display:list-item}"
L"ol,ul{padding-left:33px;margin:1.12em 0}"
@@ -106,8 +96,8 @@ CFX_RetainPtr<CFDE_CSSComputedStyle> CXFA_TextParser::CreateRootStyle(
CXFA_Font font = pTextProvider->GetFontNode();
CXFA_Para para = pTextProvider->GetParaNode();
auto pStyle = m_pSelector->CreateComputedStyle(nullptr);
- FX_FLOAT fLineHeight = 0;
- FX_FLOAT fFontSize = 10;
+ float fLineHeight = 0;
+ float fFontSize = 10;
if (para) {
fLineHeight = para.GetLineHeight();
@@ -171,7 +161,7 @@ CFX_RetainPtr<CFDE_CSSComputedStyle> CXFA_TextParser::CreateStyle(
return pNewStyle;
uint32_t dwDecoration = pParentStyle->GetTextDecoration();
- FX_FLOAT fBaseLine = 0;
+ float fBaseLine = 0;
if (pParentStyle->GetVerticalAlign() == FDE_CSSVerticalAlign::Number)
fBaseLine = pParentStyle->GetNumberVerticalAlign();
@@ -191,7 +181,7 @@ CFX_RetainPtr<CFDE_CSSComputedStyle> CXFA_TextParser::ComputeStyle(
if (it == m_mapXMLNodeToParseContext.end())
return nullptr;
- CXFA_TextParseContext* pContext = it->second;
+ CXFA_TextParseContext* pContext = it->second.get();
if (!pContext)
return nullptr;
@@ -231,7 +221,7 @@ void CXFA_TextParser::ParseRichText(CFDE_XMLNode* pXMLNode,
CFX_RetainPtr<CFDE_CSSComputedStyle> pNewStyle;
if ((tagProvider->GetTagName() != L"body") ||
(tagProvider->GetTagName() != L"html")) {
- CXFA_TextParseContext* pTextContext = new CXFA_TextParseContext;
+ auto pTextContext = pdfium::MakeUnique<CXFA_TextParseContext>();
FDE_CSSDisplay eDisplay = FDE_CSSDisplay::Inline;
if (!tagProvider->m_bContent) {
auto declArray =
@@ -247,7 +237,7 @@ void CXFA_TextParser::ParseRichText(CFDE_XMLNode* pXMLNode,
eDisplay = pNewStyle->GetDisplay();
}
pTextContext->SetDisplay(eDisplay);
- m_mapXMLNodeToParseContext[pXMLNode] = pTextContext;
+ m_mapXMLNodeToParseContext[pXMLNode] = std::move(pTextContext);
}
for (CFDE_XMLNode* pXMLChild =
@@ -287,12 +277,11 @@ std::unique_ptr<CXFA_CSSTagProvider> CXFA_TextParser::ParseTagInfo(
CFX_WideString wsName;
if (pXMLNode->GetType() == FDE_XMLNODE_Element) {
CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode);
- pXMLElement->GetLocalTagName(wsName);
+ wsName = pXMLElement->GetLocalTagName();
tagProvider->SetTagName(wsName);
tagProvider->m_bTagAvailable = TagValidate(wsName);
- CFX_WideString wsValue;
- pXMLElement->GetString(L"style", wsValue);
+ CFX_WideString wsValue = pXMLElement->GetString(L"style");
if (!wsValue.IsEmpty())
tagProvider->SetAttribute(L"style", wsValue);
} else if (pXMLNode->GetType() == FDE_XMLNODE_Text) {
@@ -307,7 +296,7 @@ int32_t CXFA_TextParser::GetVAlign(CXFA_TextProvider* pTextProvider) const {
return para ? para.GetVerticalAlign() : XFA_ATTRIBUTEENUM_Top;
}
-FX_FLOAT CXFA_TextParser::GetTabInterval(CFDE_CSSComputedStyle* pStyle) const {
+float CXFA_TextParser::GetTabInterval(CFDE_CSSComputedStyle* pStyle) const {
CFX_WideString wsValue;
if (pStyle && pStyle->GetCustomStyle(L"tab-interval", wsValue))
return CXFA_Measurement(wsValue.AsStringC()).ToUnit(XFA_UNIT_Pt);
@@ -361,8 +350,8 @@ CFX_RetainPtr<CFGAS_GEFont> CXFA_TextParser::GetFont(
return pFontMgr->GetFont(pDoc, wsFamily, dwStyle);
}
-FX_FLOAT CXFA_TextParser::GetFontSize(CXFA_TextProvider* pTextProvider,
- CFDE_CSSComputedStyle* pStyle) const {
+float CXFA_TextParser::GetFontSize(CXFA_TextProvider* pTextProvider,
+ CFDE_CSSComputedStyle* pStyle) const {
if (pStyle)
return pStyle->GetFontSize();
@@ -383,7 +372,7 @@ int32_t CXFA_TextParser::GetHorScale(CXFA_TextProvider* pTextProvider,
while (pXMLNode) {
auto it = m_mapXMLNodeToParseContext.find(pXMLNode);
if (it != m_mapXMLNodeToParseContext.end()) {
- CXFA_TextParseContext* pContext = it->second;
+ CXFA_TextParseContext* pContext = it->second.get();
if (pContext && pContext->m_pParentStyle &&
pContext->m_pParentStyle->GetCustomStyle(
L"xfa-font-horizontal-scale", wsValue)) {
@@ -466,8 +455,8 @@ FX_ARGB CXFA_TextParser::GetColor(CXFA_TextProvider* pTextProvider,
return 0xFF000000;
}
-FX_FLOAT CXFA_TextParser::GetBaseline(CXFA_TextProvider* pTextProvider,
- CFDE_CSSComputedStyle* pStyle) const {
+float CXFA_TextParser::GetBaseline(CXFA_TextProvider* pTextProvider,
+ CFDE_CSSComputedStyle* pStyle) const {
if (pStyle) {
if (pStyle->GetVerticalAlign() == FDE_CSSVerticalAlign::Number)
return pStyle->GetNumberVerticalAlign();
@@ -477,18 +466,18 @@ FX_FLOAT CXFA_TextParser::GetBaseline(CXFA_TextProvider* pTextProvider,
return 0;
}
-FX_FLOAT CXFA_TextParser::GetLineHeight(CXFA_TextProvider* pTextProvider,
- CFDE_CSSComputedStyle* pStyle,
- bool bFirst,
- FX_FLOAT fVerScale) const {
- FX_FLOAT fLineHeight = 0;
+float CXFA_TextParser::GetLineHeight(CXFA_TextProvider* pTextProvider,
+ CFDE_CSSComputedStyle* pStyle,
+ bool bFirst,
+ float fVerScale) const {
+ float fLineHeight = 0;
if (pStyle)
fLineHeight = pStyle->GetLineHeight();
else if (CXFA_Para para = pTextProvider->GetParaNode())
fLineHeight = para.GetLineHeight();
if (bFirst) {
- FX_FLOAT fFontSize = GetFontSize(pTextProvider, pStyle);
+ float fFontSize = GetFontSize(pTextProvider, pStyle);
if (fLineHeight < 0.1f)
fLineHeight = fFontSize;
else
@@ -510,15 +499,13 @@ bool CXFA_TextParser::GetEmbbedObj(CXFA_TextProvider* pTextProvider,
bool bRet = false;
if (pXMLNode->GetType() == FDE_XMLNODE_Element) {
CFDE_XMLElement* pElement = static_cast<CFDE_XMLElement*>(pXMLNode);
- CFX_WideString wsAttr;
- pElement->GetString(L"xfa:embed", wsAttr);
+ CFX_WideString wsAttr = pElement->GetString(L"xfa:embed");
if (wsAttr.IsEmpty())
return false;
if (wsAttr.GetAt(0) == L'#')
wsAttr.Delete(0);
- CFX_WideString ws;
- pElement->GetString(L"xfa:embedType", ws);
+ CFX_WideString ws = pElement->GetString(L"xfa:embedType");
if (ws.IsEmpty())
ws = L"som";
else
@@ -528,8 +515,7 @@ bool CXFA_TextParser::GetEmbbedObj(CXFA_TextProvider* pTextProvider,
if (!bURI && ws != L"som")
return false;
- ws.clear();
- pElement->GetString(L"xfa:embedMode", ws);
+ ws = pElement->GetString(L"xfa:embedMode");
if (ws.IsEmpty())
ws = L"formatted";
else
@@ -547,7 +533,7 @@ bool CXFA_TextParser::GetEmbbedObj(CXFA_TextProvider* pTextProvider,
CXFA_TextParseContext* CXFA_TextParser::GetParseContextFromMap(
CFDE_XMLNode* pXMLNode) {
auto it = m_mapXMLNodeToParseContext.find(pXMLNode);
- return it != m_mapXMLNodeToParseContext.end() ? it->second : nullptr;
+ return it != m_mapXMLNodeToParseContext.end() ? it->second.get() : nullptr;
}
bool CXFA_TextParser::GetTabstops(CFDE_CSSComputedStyle* pStyle,
@@ -562,12 +548,12 @@ bool CXFA_TextParser::GetTabstops(CFDE_CSSComputedStyle* pStyle,
}
int32_t iLength = wsValue.GetLength();
- const FX_WCHAR* pTabStops = wsValue.c_str();
+ const wchar_t* pTabStops = wsValue.c_str();
int32_t iCur = 0;
int32_t iLast = 0;
CFX_WideString wsAlign;
TabStopStatus eStatus = TabStopStatus::None;
- FX_WCHAR ch;
+ wchar_t ch;
while (iCur < iLength) {
ch = pTabStops[iCur];
switch (eStatus) {
@@ -618,7 +604,7 @@ bool CXFA_TextParser::GetTabstops(CFDE_CSSComputedStyle* pStyle,
if (ch == ' ') {
uint32_t dwHashCode = FX_HashCode_GetW(wsAlign.AsStringC(), true);
CXFA_Measurement ms(CFX_WideStringC(pTabStops + iLast, iCur - iLast));
- FX_FLOAT fPos = ms.ToUnit(XFA_UNIT_Pt);
+ float fPos = ms.ToUnit(XFA_UNIT_Pt);
pTabstopContext->Append(dwHashCode, fPos);
wsAlign.clear();
eStatus = TabStopStatus::None;
@@ -633,7 +619,7 @@ bool CXFA_TextParser::GetTabstops(CFDE_CSSComputedStyle* pStyle,
if (!wsAlign.IsEmpty()) {
uint32_t dwHashCode = FX_HashCode_GetW(wsAlign.AsStringC(), true);
CXFA_Measurement ms(CFX_WideStringC(pTabStops + iLast, iCur - iLast));
- FX_FLOAT fPos = ms.ToUnit(XFA_UNIT_Pt);
+ float fPos = ms.ToUnit(XFA_UNIT_Pt);
pTabstopContext->Append(dwHashCode, fPos);
}
return true;
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_textparser.h b/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_textparser.h
index 86da502dbf0..29f03a8dea7 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_textparser.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_textparser.h
@@ -43,7 +43,7 @@ class CXFA_TextParser {
int32_t GetVAlign(CXFA_TextProvider* pTextProvider) const;
- FX_FLOAT GetTabInterval(CFDE_CSSComputedStyle* pStyle) const;
+ float GetTabInterval(CFDE_CSSComputedStyle* pStyle) const;
int32_t CountTabs(CFDE_CSSComputedStyle* pStyle) const;
bool IsSpaceRun(CFDE_CSSComputedStyle* pStyle) const;
@@ -52,8 +52,8 @@ class CXFA_TextParser {
CFX_RetainPtr<CFGAS_GEFont> GetFont(CXFA_TextProvider* pTextProvider,
CFDE_CSSComputedStyle* pStyle) const;
- FX_FLOAT GetFontSize(CXFA_TextProvider* pTextProvider,
- CFDE_CSSComputedStyle* pStyle) const;
+ float GetFontSize(CXFA_TextProvider* pTextProvider,
+ CFDE_CSSComputedStyle* pStyle) const;
int32_t GetHorScale(CXFA_TextProvider* pTextProvider,
CFDE_CSSComputedStyle* pStyle,
@@ -70,12 +70,12 @@ class CXFA_TextParser {
int32_t& iLinethrough) const;
FX_ARGB GetColor(CXFA_TextProvider* pTextProvider,
CFDE_CSSComputedStyle* pStyle) const;
- FX_FLOAT GetBaseline(CXFA_TextProvider* pTextProvider,
- CFDE_CSSComputedStyle* pStyle) const;
- FX_FLOAT GetLineHeight(CXFA_TextProvider* pTextProvider,
- CFDE_CSSComputedStyle* pStyle,
- bool bFirst,
- FX_FLOAT fVerScale) const;
+ float GetBaseline(CXFA_TextProvider* pTextProvider,
+ CFDE_CSSComputedStyle* pStyle) const;
+ float GetLineHeight(CXFA_TextProvider* pTextProvider,
+ CFDE_CSSComputedStyle* pStyle,
+ bool bFirst,
+ float fVerScale) const;
bool GetEmbbedObj(CXFA_TextProvider* pTextProvider,
CFDE_XMLNode* pXMLNode,
@@ -94,10 +94,11 @@ class CXFA_TextParser {
CFX_RetainPtr<CFDE_CSSComputedStyle> CreateStyle(
CFDE_CSSComputedStyle* pParentStyle);
- std::unique_ptr<CFDE_CSSStyleSelector> m_pSelector;
- std::map<CFDE_XMLNode*, CXFA_TextParseContext*> m_mapXMLNodeToParseContext;
bool m_bParsed;
bool m_cssInitialized;
+ std::unique_ptr<CFDE_CSSStyleSelector> m_pSelector;
+ std::map<CFDE_XMLNode*, std::unique_ptr<CXFA_TextParseContext>>
+ m_mapXMLNodeToParseContext;
};
#endif // XFA_FXFA_APP_CXFA_TEXTPARSER_H_
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_texttabstopscontext.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_texttabstopscontext.cpp
index 3209603af3b..58ceb21a4b1 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_texttabstopscontext.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_texttabstopscontext.cpp
@@ -7,33 +7,21 @@
#include "xfa/fxfa/app/cxfa_texttabstopscontext.h"
CXFA_TextTabstopsContext::CXFA_TextTabstopsContext()
- : m_iTabCount(0),
- m_iTabIndex(-1),
- m_bTabstops(false),
- m_fTabWidth(0),
- m_fLeft(0) {}
+ : m_iTabIndex(-1), m_bTabstops(false), m_fTabWidth(0), m_fLeft(0) {}
CXFA_TextTabstopsContext::~CXFA_TextTabstopsContext() {}
-void CXFA_TextTabstopsContext::Append(uint32_t dwAlign, FX_FLOAT fTabstops) {
- int32_t i = 0;
- for (i = 0; i < m_iTabCount; i++) {
- XFA_TABSTOPS* pTabstop = m_tabstops.GetDataPtr(i);
- if (fTabstops < pTabstop->fTabstops) {
- break;
- }
- }
- m_tabstops.InsertSpaceAt(i, 1);
+void CXFA_TextTabstopsContext::Append(uint32_t dwAlign, float fTabstops) {
XFA_TABSTOPS tabstop;
tabstop.dwAlign = dwAlign;
tabstop.fTabstops = fTabstops;
- m_tabstops.SetAt(i, tabstop);
- m_iTabCount++;
+
+ auto it = std::lower_bound(m_tabstops.begin(), m_tabstops.end(), tabstop);
+ m_tabstops.insert(it, tabstop);
}
void CXFA_TextTabstopsContext::RemoveAll() {
- m_tabstops.RemoveAll();
- m_iTabCount = 0;
+ m_tabstops.clear();
}
void CXFA_TextTabstopsContext::Reset() {
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_texttabstopscontext.h b/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_texttabstopscontext.h
index 8fe0e6273f3..9be10dd61d0 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_texttabstopscontext.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_texttabstopscontext.h
@@ -7,11 +7,17 @@
#ifndef XFA_FXFA_APP_CXFA_TEXTTABSTOPSCONTEXT_H_
#define XFA_FXFA_APP_CXFA_TEXTTABSTOPSCONTEXT_H_
+#include <vector>
+
#include "core/fxcrt/fx_basic.h"
struct XFA_TABSTOPS {
uint32_t dwAlign;
- FX_FLOAT fTabstops;
+ float fTabstops;
+
+ bool operator<(const XFA_TABSTOPS& that) const {
+ return fTabstops < that.fTabstops;
+ }
};
class CXFA_TextTabstopsContext {
@@ -19,16 +25,15 @@ class CXFA_TextTabstopsContext {
CXFA_TextTabstopsContext();
~CXFA_TextTabstopsContext();
- void Append(uint32_t dwAlign, FX_FLOAT fTabstops);
+ void Append(uint32_t dwAlign, float fTabstops);
void RemoveAll();
void Reset();
- CFX_ArrayTemplate<XFA_TABSTOPS> m_tabstops;
- int32_t m_iTabCount;
int32_t m_iTabIndex;
bool m_bTabstops;
- FX_FLOAT m_fTabWidth;
- FX_FLOAT m_fLeft;
+ float m_fTabWidth;
+ float m_fLeft;
+ std::vector<XFA_TABSTOPS> m_tabstops;
};
#endif // XFA_FXFA_APP_CXFA_TEXTTABSTOPSCONTEXT_H_
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_textuserdata.h b/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_textuserdata.h
index b0eff73f2e9..18a20cdc2ad 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_textuserdata.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/cxfa_textuserdata.h
@@ -21,7 +21,7 @@ class CXFA_TextUserData : public CFX_Retainable {
CFX_RetainPtr<CFDE_CSSComputedStyle> m_pStyle;
CFX_RetainPtr<CXFA_LinkUserData> m_pLinkData;
- protected:
+ private:
explicit CXFA_TextUserData(
const CFX_RetainPtr<CFDE_CSSComputedStyle>& pStyle);
CXFA_TextUserData(const CFX_RetainPtr<CFDE_CSSComputedStyle>& pStyle,
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_checksum.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_checksum.cpp
deleted file mode 100644
index 09c42719c11..00000000000
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_checksum.cpp
+++ /dev/null
@@ -1,271 +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
-
-#include "xfa/fxfa/xfa_checksum.h"
-
-#include "core/fdrm/crypto/fx_crypt.h"
-#include "third_party/base/ptr_util.h"
-
-namespace {
-
-struct FX_BASE64DATA {
- uint32_t data1 : 2;
- uint32_t data2 : 6;
- uint32_t data3 : 4;
- uint32_t data4 : 4;
- uint32_t data5 : 6;
- uint32_t data6 : 2;
- uint32_t data7 : 8;
-};
-
-const FX_CHAR g_FXBase64EncoderMap[64] = {
- 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
- 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
- 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
- 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
- '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/',
-};
-
-void Base64EncodePiece(const FX_BASE64DATA& src,
- int32_t iBytes,
- FX_CHAR dst[4]) {
- dst[0] = g_FXBase64EncoderMap[src.data2];
- uint32_t b = src.data1 << 4;
- if (iBytes > 1) {
- b |= src.data4;
- }
- dst[1] = g_FXBase64EncoderMap[b];
- if (iBytes > 1) {
- b = src.data3 << 2;
- if (iBytes > 2) {
- b |= src.data6;
- }
- dst[2] = g_FXBase64EncoderMap[b];
- if (iBytes > 2) {
- dst[3] = g_FXBase64EncoderMap[src.data5];
- } else {
- dst[3] = '=';
- }
- } else {
- dst[2] = dst[3] = '=';
- }
-}
-
-int32_t Base64EncodeA(const uint8_t* pSrc, int32_t iSrcLen, FX_CHAR* pDst) {
- ASSERT(pSrc);
- if (iSrcLen < 1) {
- return 0;
- }
- if (!pDst) {
- int32_t iDstLen = iSrcLen / 3 * 4;
- if ((iSrcLen % 3) != 0) {
- iDstLen += 4;
- }
- return iDstLen;
- }
- FX_BASE64DATA srcData;
- int32_t iBytes = 3;
- FX_CHAR* pDstEnd = pDst;
- while (iSrcLen > 0) {
- if (iSrcLen > 2) {
- ((uint8_t*)&srcData)[0] = *pSrc++;
- ((uint8_t*)&srcData)[1] = *pSrc++;
- ((uint8_t*)&srcData)[2] = *pSrc++;
- iSrcLen -= 3;
- } else {
- *((uint32_t*)&srcData) = 0;
- ((uint8_t*)&srcData)[0] = *pSrc++;
- if (iSrcLen > 1) {
- ((uint8_t*)&srcData)[1] = *pSrc++;
- }
- iBytes = iSrcLen;
- iSrcLen = 0;
- }
- Base64EncodePiece(srcData, iBytes, pDstEnd);
- pDstEnd += 4;
- }
- return pDstEnd - pDst;
-}
-
-} // namespace
-
-CXFA_SAXReaderHandler::CXFA_SAXReaderHandler(CXFA_ChecksumContext* pContext)
- : m_pContext(pContext) {
- ASSERT(m_pContext);
-}
-CXFA_SAXReaderHandler::~CXFA_SAXReaderHandler() {}
-CXFA_SAXContext* CXFA_SAXReaderHandler::OnTagEnter(
- const CFX_ByteStringC& bsTagName,
- CFX_SAXItem::Type eType,
- uint32_t dwStartPos) {
- UpdateChecksum(true);
- if (eType != CFX_SAXItem::Type::Tag &&
- eType != CFX_SAXItem::Type::Instruction) {
- return nullptr;
- }
- m_SAXContext.m_eNode = eType;
- CFX_ByteTextBuf& textBuf = m_SAXContext.m_TextBuf;
- textBuf << "<";
- if (eType == CFX_SAXItem::Type::Instruction) {
- textBuf << "?";
- }
- textBuf << bsTagName;
- m_SAXContext.m_bsTagName = bsTagName;
- return &m_SAXContext;
-}
-
-void CXFA_SAXReaderHandler::OnTagAttribute(CXFA_SAXContext* pTag,
- const CFX_ByteStringC& bsAttri,
- const CFX_ByteStringC& bsValue) {
- if (!pTag)
- return;
-
- pTag->m_TextBuf << " " << bsAttri << "=\"" << bsValue << "\"";
-}
-
-void CXFA_SAXReaderHandler::OnTagBreak(CXFA_SAXContext* pTag) {
- if (!pTag)
- return;
-
- pTag->m_TextBuf << ">";
- UpdateChecksum(false);
-}
-
-void CXFA_SAXReaderHandler::OnTagData(CXFA_SAXContext* pTag,
- CFX_SAXItem::Type eType,
- const CFX_ByteStringC& bsData,
- uint32_t dwStartPos) {
- if (!pTag)
- return;
-
- CFX_ByteTextBuf& textBuf = pTag->m_TextBuf;
- if (eType == CFX_SAXItem::Type::CharData)
- textBuf << "<![CDATA[";
-
- textBuf << bsData;
- if (eType == CFX_SAXItem::Type::CharData)
- textBuf << "]]>";
-}
-
-void CXFA_SAXReaderHandler::OnTagClose(CXFA_SAXContext* pTag,
- uint32_t dwEndPos) {
- if (!pTag)
- return;
-
- CFX_ByteTextBuf& textBuf = pTag->m_TextBuf;
- if (pTag->m_eNode == CFX_SAXItem::Type::Instruction)
- textBuf << "?>";
- else if (pTag->m_eNode == CFX_SAXItem::Type::Tag)
- textBuf << "></" << pTag->m_bsTagName.AsStringC() << ">";
-
- UpdateChecksum(false);
-}
-
-void CXFA_SAXReaderHandler::OnTagEnd(CXFA_SAXContext* pTag,
- const CFX_ByteStringC& bsTagName,
- uint32_t dwEndPos) {
- if (!pTag)
- return;
-
- pTag->m_TextBuf << "</" << bsTagName << ">";
- UpdateChecksum(false);
-}
-
-void CXFA_SAXReaderHandler::OnTargetData(CXFA_SAXContext* pTag,
- CFX_SAXItem::Type eType,
- const CFX_ByteStringC& bsData,
- uint32_t dwStartPos) {
- if (!pTag && eType != CFX_SAXItem::Type::Comment)
- return;
-
- if (eType == CFX_SAXItem::Type::Comment) {
- m_SAXContext.m_TextBuf << "<!--" << bsData << "-->";
- UpdateChecksum(false);
- } else {
- pTag->m_TextBuf << " " << bsData;
- }
-}
-
-void CXFA_SAXReaderHandler::UpdateChecksum(bool bCheckSpace) {
- int32_t iLength = m_SAXContext.m_TextBuf.GetLength();
- if (iLength < 1) {
- return;
- }
- uint8_t* pBuffer = m_SAXContext.m_TextBuf.GetBuffer();
- bool bUpdata = true;
- if (bCheckSpace) {
- bUpdata = false;
- for (int32_t i = 0; i < iLength; i++) {
- bUpdata = (pBuffer[i] > 0x20);
- if (bUpdata) {
- break;
- }
- }
- }
- if (bUpdata) {
- m_pContext->Update(CFX_ByteStringC(pBuffer, iLength));
- }
- m_SAXContext.m_TextBuf.Clear();
-}
-
-CXFA_ChecksumContext::CXFA_ChecksumContext() {}
-
-CXFA_ChecksumContext::~CXFA_ChecksumContext() {}
-
-void CXFA_ChecksumContext::StartChecksum() {
- FinishChecksum();
- m_pByteContext = pdfium::MakeUnique<CRYPT_sha1_context>();
- CRYPT_SHA1Start(m_pByteContext.get());
- m_bsChecksum.clear();
- m_pSAXReader = pdfium::MakeUnique<CFX_SAXReader>();
-}
-
-bool CXFA_ChecksumContext::UpdateChecksum(
- const CFX_RetainPtr<IFX_SeekableReadStream>& pSrcFile,
- FX_FILESIZE offset,
- size_t size) {
- if (!m_pSAXReader || !pSrcFile)
- return false;
-
- if (size < 1)
- size = pSrcFile->GetSize();
-
- CXFA_SAXReaderHandler handler(this);
- m_pSAXReader->SetHandler(&handler);
- if (m_pSAXReader->StartParse(
- pSrcFile, (uint32_t)offset, (uint32_t)size,
- CFX_SaxParseMode_NotSkipSpace | CFX_SaxParseMode_NotConvert_amp |
- CFX_SaxParseMode_NotConvert_lt | CFX_SaxParseMode_NotConvert_gt |
- CFX_SaxParseMode_NotConvert_sharp) < 0) {
- return false;
- }
- return m_pSAXReader->ContinueParse(nullptr) > 99;
-}
-
-void CXFA_ChecksumContext::FinishChecksum() {
- m_pSAXReader.reset();
- if (m_pByteContext) {
- uint8_t digest[20];
- FXSYS_memset(digest, 0, 20);
- CRYPT_SHA1Finish(m_pByteContext.get(), digest);
- int32_t nLen = Base64EncodeA(digest, 20, nullptr);
- FX_CHAR* pBuffer = m_bsChecksum.GetBuffer(nLen);
- Base64EncodeA(digest, 20, pBuffer);
- m_bsChecksum.ReleaseBuffer(nLen);
- m_pByteContext.reset();
- }
-}
-
-CFX_ByteString CXFA_ChecksumContext::GetChecksum() const {
- return m_bsChecksum;
-}
-
-void CXFA_ChecksumContext::Update(const CFX_ByteStringC& bsText) {
- if (!m_pByteContext)
- return;
-
- CRYPT_SHA1Update(m_pByteContext.get(), bsText.raw_str(), bsText.GetLength());
-}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffapp.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffapp.cpp
deleted file mode 100644
index 219f06e4ff7..00000000000
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffapp.cpp
+++ /dev/null
@@ -1,162 +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
-
-#include "xfa/fxfa/xfa_ffapp.h"
-
-#include <algorithm>
-#include <memory>
-#include <utility>
-#include <vector>
-
-#include "third_party/base/ptr_util.h"
-#include "third_party/base/stl_util.h"
-#include "xfa/fgas/font/cfgas_fontmgr.h"
-#include "xfa/fwl/cfwl_notedriver.h"
-#include "xfa/fwl/cfwl_widgetmgr.h"
-#include "xfa/fxfa/app/xfa_fwladapter.h"
-#include "xfa/fxfa/app/xfa_fwltheme.h"
-#include "xfa/fxfa/xfa_ffdoc.h"
-#include "xfa/fxfa/xfa_ffdochandler.h"
-#include "xfa/fxfa/xfa_ffwidgethandler.h"
-#include "xfa/fxfa/xfa_fontmgr.h"
-
-namespace {
-
-class CXFA_FileRead : public IFX_SeekableReadStream {
- public:
- explicit CXFA_FileRead(const std::vector<CPDF_Stream*>& streams);
- ~CXFA_FileRead() override;
-
- // IFX_SeekableReadStream
- FX_FILESIZE GetSize() override;
- bool ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override;
-
- private:
- std::vector<std::unique_ptr<CPDF_StreamAcc>> m_Data;
-};
-
-CXFA_FileRead::CXFA_FileRead(const std::vector<CPDF_Stream*>& streams) {
- for (CPDF_Stream* pStream : streams) {
- m_Data.push_back(pdfium::MakeUnique<CPDF_StreamAcc>());
- m_Data.back()->LoadAllData(pStream);
- }
-}
-
-CXFA_FileRead::~CXFA_FileRead() {}
-
-FX_FILESIZE CXFA_FileRead::GetSize() {
- uint32_t dwSize = 0;
- for (const auto& acc : m_Data)
- dwSize += acc->GetSize();
- return dwSize;
-}
-
-bool CXFA_FileRead::ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) {
- int32_t iCount = pdfium::CollectionSize<int32_t>(m_Data);
- int32_t index = 0;
- while (index < iCount) {
- const auto& acc = m_Data[index];
- FX_FILESIZE dwSize = acc->GetSize();
- if (offset < dwSize)
- break;
-
- offset -= dwSize;
- index++;
- }
- while (index < iCount) {
- const auto& acc = m_Data[index];
- uint32_t dwSize = acc->GetSize();
- size_t dwRead = std::min(size, static_cast<size_t>(dwSize - offset));
- FXSYS_memcpy(buffer, acc->GetData() + offset, dwRead);
- size -= dwRead;
- if (size == 0)
- return true;
-
- buffer = (uint8_t*)buffer + dwRead;
- offset = 0;
- index++;
- }
- return false;
-}
-
-} // namespace
-
-CFX_RetainPtr<IFX_SeekableReadStream> MakeSeekableReadStream(
- const std::vector<CPDF_Stream*>& streams) {
- return CFX_RetainPtr<IFX_SeekableReadStream>(new CXFA_FileRead(streams));
-}
-
-CXFA_FFApp::CXFA_FFApp(IXFA_AppProvider* pProvider)
- : m_pProvider(pProvider),
- m_pWidgetMgrDelegate(nullptr),
- m_pFWLApp(new CFWL_App(this)) {}
-
-CXFA_FFApp::~CXFA_FFApp() {}
-
-CXFA_FFDocHandler* CXFA_FFApp::GetDocHandler() {
- if (!m_pDocHandler)
- m_pDocHandler = pdfium::MakeUnique<CXFA_FFDocHandler>();
- return m_pDocHandler.get();
-}
-
-std::unique_ptr<CXFA_FFDoc> CXFA_FFApp::CreateDoc(
- IXFA_DocEnvironment* pDocEnvironment,
- CPDF_Document* pPDFDoc) {
- if (!pPDFDoc)
- return nullptr;
-
- auto pDoc = pdfium::MakeUnique<CXFA_FFDoc>(this, pDocEnvironment);
- if (!pDoc->OpenDoc(pPDFDoc))
- return nullptr;
-
- return pDoc;
-}
-
-void CXFA_FFApp::SetDefaultFontMgr(std::unique_ptr<CXFA_DefFontMgr> pFontMgr) {
- if (!m_pFontMgr)
- m_pFontMgr = pdfium::MakeUnique<CXFA_FontMgr>();
- m_pFontMgr->SetDefFontMgr(std::move(pFontMgr));
-}
-
-CXFA_FontMgr* CXFA_FFApp::GetXFAFontMgr() const {
- return m_pFontMgr.get();
-}
-
-CFGAS_FontMgr* CXFA_FFApp::GetFDEFontMgr() {
- if (!m_pFDEFontMgr) {
-#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
- m_pFDEFontMgr = CFGAS_FontMgr::Create(FX_GetDefFontEnumerator());
-#else
- m_pFontSource = pdfium::MakeUnique<CFX_FontSourceEnum_File>();
- m_pFDEFontMgr = CFGAS_FontMgr::Create(m_pFontSource.get());
-#endif
- }
- return m_pFDEFontMgr.get();
-}
-
-CXFA_FWLTheme* CXFA_FFApp::GetFWLTheme() {
- if (!m_pFWLTheme)
- m_pFWLTheme = pdfium::MakeUnique<CXFA_FWLTheme>(this);
- return m_pFWLTheme.get();
-}
-
-CXFA_FWLAdapterWidgetMgr* CXFA_FFApp::GetWidgetMgr(
- CFWL_WidgetMgrDelegate* pDelegate) {
- if (!m_pAdapterWidgetMgr) {
- m_pAdapterWidgetMgr = pdfium::MakeUnique<CXFA_FWLAdapterWidgetMgr>();
- pDelegate->OnSetCapability(FWL_WGTMGR_DisableForm);
- m_pWidgetMgrDelegate = pDelegate;
- }
- return m_pAdapterWidgetMgr.get();
-}
-
-IFWL_AdapterTimerMgr* CXFA_FFApp::GetTimerMgr() const {
- return m_pProvider->GetTimerMgr();
-}
-
-void CXFA_FFApp::ClearEventTargets() {
- m_pFWLApp->GetNoteDriver()->ClearEventTargets(false);
-}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffapp_unittest.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffapp_unittest.cpp
deleted file mode 100644
index b0879012b42..00000000000
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffapp_unittest.cpp
+++ /dev/null
@@ -1,87 +0,0 @@
-// Copyright 2016 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "xfa/fxfa/xfa_ffapp.h"
-
-#include <memory>
-#include <vector>
-
-#include "core/fpdfapi/parser/cpdf_dictionary.h"
-#include "core/fpdfapi/parser/cpdf_stream.h"
-#include "core/fxcrt/fx_memory.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/base/ptr_util.h"
-
-TEST(CXFAFileRead, NoStreams) {
- std::vector<CPDF_Stream*> streams;
- CFX_RetainPtr<IFX_SeekableReadStream> fileread =
- MakeSeekableReadStream(streams);
-
- uint8_t output_buffer[16];
- memset(output_buffer, 0xbd, sizeof(output_buffer));
- EXPECT_FALSE(fileread->ReadBlock(output_buffer, 0, 0));
- EXPECT_EQ(0xbd, output_buffer[0]);
-}
-
-TEST(CXFAFileRead, EmptyStreams) {
- std::vector<CPDF_Stream*> streams;
- auto stream1 = pdfium::MakeUnique<CPDF_Stream>();
- streams.push_back(stream1.get());
- CFX_RetainPtr<IFX_SeekableReadStream> fileread =
- MakeSeekableReadStream(streams);
-
- uint8_t output_buffer[16];
- memset(output_buffer, 0xbd, sizeof(output_buffer));
- EXPECT_FALSE(fileread->ReadBlock(output_buffer, 0, 0));
- EXPECT_EQ(0xbd, output_buffer[0]);
-}
-
-TEST(CXFAFileRead, NormalStreams) {
- std::vector<CPDF_Stream*> streams;
- auto stream1 = pdfium::MakeUnique<CPDF_Stream>();
- auto stream2 = pdfium::MakeUnique<CPDF_Stream>();
- auto stream3 = pdfium::MakeUnique<CPDF_Stream>();
-
- // 16 chars total.
- stream1->InitStream(reinterpret_cast<const uint8_t*>("one t"), 5,
- pdfium::MakeUnique<CPDF_Dictionary>());
- stream2->InitStream(reinterpret_cast<const uint8_t*>("wo "), 3,
- pdfium::MakeUnique<CPDF_Dictionary>());
- stream3->InitStream(reinterpret_cast<const uint8_t*>("three!!!"), 8,
- pdfium::MakeUnique<CPDF_Dictionary>());
-
- streams.push_back(stream1.get());
- streams.push_back(stream2.get());
- streams.push_back(stream3.get());
- CFX_RetainPtr<IFX_SeekableReadStream> fileread =
- MakeSeekableReadStream(streams);
-
- uint8_t output_buffer[16];
- memset(output_buffer, 0xbd, sizeof(output_buffer));
- EXPECT_TRUE(fileread->ReadBlock(output_buffer, 0, 0));
- EXPECT_EQ(0xbd, output_buffer[0]);
-
- memset(output_buffer, 0xbd, sizeof(output_buffer));
- EXPECT_TRUE(fileread->ReadBlock(output_buffer, 1, 0));
- EXPECT_EQ(0xbd, output_buffer[0]);
-
- memset(output_buffer, 0xbd, sizeof(output_buffer));
- EXPECT_TRUE(fileread->ReadBlock(output_buffer, 0, 1));
- EXPECT_EQ(0, memcmp(output_buffer, "o", 1));
- EXPECT_EQ(0xbd, output_buffer[1]);
-
- memset(output_buffer, 0xbd, sizeof(output_buffer));
- EXPECT_TRUE(fileread->ReadBlock(output_buffer, 0, sizeof(output_buffer)));
- EXPECT_EQ(0, memcmp(output_buffer, "one two three!!!", 16));
-
- memset(output_buffer, 0xbd, sizeof(output_buffer));
- EXPECT_TRUE(fileread->ReadBlock(output_buffer, 2, 10));
- EXPECT_EQ(0, memcmp(output_buffer, "e two thre", 10));
- EXPECT_EQ(0xbd, output_buffer[11]);
-
- memset(output_buffer, 0xbd, sizeof(output_buffer));
- EXPECT_FALSE(fileread->ReadBlock(output_buffer, 1, sizeof(output_buffer)));
- EXPECT_EQ(0, memcmp(output_buffer, "ne two three!!!", 15));
- EXPECT_EQ(0xbd, output_buffer[15]);
-}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffbarcode.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffbarcode.cpp
index b136b8da5a5..72adb3c96b1 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffbarcode.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffbarcode.cpp
@@ -13,8 +13,8 @@
#include "xfa/fxfa/app/xfa_fffield.h"
#include "xfa/fxfa/app/xfa_fftextedit.h"
#include "xfa/fxfa/app/xfa_fwladapter.h"
-#include "xfa/fxfa/xfa_ffpageview.h"
-#include "xfa/fxfa/xfa_ffwidget.h"
+#include "xfa/fxfa/cxfa_ffpageview.h"
+#include "xfa/fxfa/cxfa_ffwidget.h"
namespace {
@@ -174,9 +174,9 @@ void CXFA_FFBarcode::UpdateWidgetProperty() {
pBarCodeWidget->SetType(pBarcodeTypeInfo->eBCType);
CXFA_WidgetAcc* pAcc = GetDataAcc();
int32_t intVal;
- FX_CHAR charVal;
+ char charVal;
bool boolVal;
- FX_FLOAT floatVal;
+ float floatVal;
if (pAcc->GetBarcodeAttribute_CharEncoding(intVal)) {
pBarCodeWidget->SetCharEncoding((BC_CHAR_ENCODING)intVal);
}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffbarcode.h b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffbarcode.h
index c20feb5167b..ad12218f3d5 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffbarcode.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffbarcode.h
@@ -7,9 +7,9 @@
#ifndef XFA_FXFA_APP_XFA_FFBARCODE_H_
#define XFA_FXFA_APP_XFA_FFBARCODE_H_
-#include "xfa/fxbarcode/BC_Library.h"
+#include "fxbarcode/BC_Library.h"
#include "xfa/fxfa/app/xfa_fftextedit.h"
-#include "xfa/fxfa/xfa_ffpageview.h"
+#include "xfa/fxfa/cxfa_ffpageview.h"
class CXFA_FFBarcode : public CXFA_FFTextEdit {
public:
@@ -93,7 +93,7 @@ enum XFA_BARCODETYPEENUM {
struct XFA_BARCODETYPEENUMINFO {
uint32_t uHash;
- const FX_WCHAR* pName;
+ const wchar_t* pName;
XFA_BARCODETYPEENUM eName;
BC_TYPE eBCType;
};
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffcheckbutton.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffcheckbutton.cpp
index f088b5d4dda..9f003ad3a10 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffcheckbutton.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffcheckbutton.cpp
@@ -12,11 +12,11 @@
#include "xfa/fwl/cfwl_widgetmgr.h"
#include "xfa/fxfa/app/xfa_ffexclgroup.h"
#include "xfa/fxfa/app/xfa_fffield.h"
-#include "xfa/fxfa/xfa_ffapp.h"
-#include "xfa/fxfa/xfa_ffdoc.h"
-#include "xfa/fxfa/xfa_ffdocview.h"
-#include "xfa/fxfa/xfa_ffpageview.h"
-#include "xfa/fxfa/xfa_ffwidget.h"
+#include "xfa/fxfa/cxfa_ffapp.h"
+#include "xfa/fxfa/cxfa_ffdoc.h"
+#include "xfa/fxfa/cxfa_ffdocview.h"
+#include "xfa/fxfa/cxfa_ffpageview.h"
+#include "xfa/fxfa/cxfa_ffwidget.h"
CXFA_FFCheckButton::CXFA_FFCheckButton(CXFA_WidgetAcc* pDataAcc)
: CXFA_FFField(pDataAcc), m_pOldDelegate(nullptr) {}
@@ -49,7 +49,7 @@ void CXFA_FFCheckButton::UpdateWidgetProperty() {
if (!m_pNormalWidget) {
return;
}
- FX_FLOAT fSize = m_pDataAcc->GetCheckButtonSize();
+ float fSize = m_pDataAcc->GetCheckButtonSize();
pCheckBox->SetBoxSize(fSize);
uint32_t dwStyleEx = FWL_STYLEEXT_CKB_SignShapeCross;
int32_t iCheckMark = m_pDataAcc->GetCheckButtonMark();
@@ -86,14 +86,14 @@ void CXFA_FFCheckButton::UpdateWidgetProperty() {
}
bool CXFA_FFCheckButton::PerformLayout() {
CXFA_FFWidget::PerformLayout();
- FX_FLOAT fCheckSize = m_pDataAcc->GetCheckButtonSize();
+ float fCheckSize = m_pDataAcc->GetCheckButtonSize();
CXFA_Margin mgWidget = m_pDataAcc->GetMargin();
CFX_RectF rtWidget = GetRectWithoutRotate();
if (mgWidget) {
XFA_RectWidthoutMargin(rtWidget, mgWidget);
}
int32_t iCapPlacement = -1;
- FX_FLOAT fCapReserve = 0;
+ float fCapReserve = 0;
CXFA_Caption caption = m_pDataAcc->GetCaption();
if (caption && caption.GetPresence()) {
m_rtCaption = rtWidget;
@@ -189,8 +189,8 @@ void CXFA_FFCheckButton::CapLeftRightPlacement(CXFA_Margin mgCap) {
void CXFA_FFCheckButton::AddUIMargin(int32_t iCapPlacement) {
CFX_RectF rtUIMargin = m_pDataAcc->GetUIMargin();
m_rtUI.top -= rtUIMargin.top / 2 - rtUIMargin.height / 2;
- FX_FLOAT fLeftAddRight = rtUIMargin.left + rtUIMargin.width;
- FX_FLOAT fTopAddBottom = rtUIMargin.top + rtUIMargin.height;
+ float fLeftAddRight = rtUIMargin.left + rtUIMargin.width;
+ float fTopAddBottom = rtUIMargin.top + rtUIMargin.height;
if (m_rtUI.width < fLeftAddRight) {
if (iCapPlacement == XFA_ATTRIBUTEENUM_Right ||
iCapPlacement == XFA_ATTRIBUTEENUM_Left) {
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffcheckbutton.h b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffcheckbutton.h
index 2c0acd6e3ec..75f884144d6 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffcheckbutton.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffcheckbutton.h
@@ -8,7 +8,7 @@
#define XFA_FXFA_APP_XFA_FFCHECKBUTTON_H_
#include "xfa/fxfa/app/xfa_fffield.h"
-#include "xfa/fxfa/xfa_ffpageview.h"
+#include "xfa/fxfa/cxfa_ffpageview.h"
class CXFA_FFCheckButton : public CXFA_FFField {
public:
@@ -32,7 +32,7 @@ class CXFA_FFCheckButton : public CXFA_FFField {
void SetFWLCheckState(XFA_CHECKSTATE eCheckState);
- protected:
+ private:
bool CommitData() override;
bool IsDataChanged() override;
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffchoicelist.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffchoicelist.cpp
index 3aabde870af..c628d2e47f6 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffchoicelist.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffchoicelist.cpp
@@ -6,6 +6,7 @@
#include "xfa/fxfa/app/xfa_ffchoicelist.h"
+#include <algorithm>
#include <vector>
#include "third_party/base/ptr_util.h"
@@ -20,10 +21,10 @@
#include "xfa/fxfa/app/xfa_fffield.h"
#include "xfa/fxfa/app/xfa_fwladapter.h"
#include "xfa/fxfa/cxfa_eventparam.h"
-#include "xfa/fxfa/xfa_ffdoc.h"
-#include "xfa/fxfa/xfa_ffdocview.h"
-#include "xfa/fxfa/xfa_ffpageview.h"
-#include "xfa/fxfa/xfa_ffwidget.h"
+#include "xfa/fxfa/cxfa_ffdoc.h"
+#include "xfa/fxfa/cxfa_ffdocview.h"
+#include "xfa/fxfa/cxfa_ffpageview.h"
+#include "xfa/fxfa/cxfa_ffwidget.h"
CXFA_FFListBox::CXFA_FFListBox(CXFA_WidgetAcc* pDataAcc)
: CXFA_FFField(pDataAcc), m_pOldDelegate(nullptr) {}
@@ -52,25 +53,18 @@ bool CXFA_FFListBox::LoadWidget() {
m_pNormalWidget->SetDelegate(this);
m_pNormalWidget->LockUpdate();
- std::vector<CFX_WideString> wsLabelArray;
- m_pDataAcc->GetChoiceListItems(wsLabelArray, false);
- int32_t iItems = pdfium::CollectionSize<int32_t>(wsLabelArray);
- for (int32_t i = 0; i < iItems; i++) {
- pListBox->AddString(wsLabelArray[i].AsStringC());
- }
+ for (const auto& label : m_pDataAcc->GetChoiceListItems(false))
+ pListBox->AddString(label.AsStringC());
+
uint32_t dwExtendedStyle = FWL_STYLEEXT_LTB_ShowScrollBarFocus;
- if (m_pDataAcc->GetChoiceListOpen() == XFA_ATTRIBUTEENUM_MultiSelect) {
+ if (m_pDataAcc->GetChoiceListOpen() == XFA_ATTRIBUTEENUM_MultiSelect)
dwExtendedStyle |= FWL_STYLEEXT_LTB_MultiSelection;
- }
+
dwExtendedStyle |= GetAlignment();
m_pNormalWidget->ModifyStylesEx(dwExtendedStyle, 0xFFFFFFFF);
- CFX_ArrayTemplate<int32_t> iSelArray;
- m_pDataAcc->GetSelectedItems(iSelArray);
- int32_t iSelCount = iSelArray.GetSize();
- for (int32_t j = 0; j < iSelCount; j++) {
- CFWL_ListItem* item = pListBox->GetItem(nullptr, iSelArray[j]);
- pListBox->SetSelItem(item, true);
- }
+ for (int32_t selected : m_pDataAcc->GetSelectedItems())
+ pListBox->SetSelItem(pListBox->GetItem(nullptr, selected), true);
+
m_pNormalWidget->UnlockUpdate();
return CXFA_FFField::LoadWidget();
}
@@ -84,19 +78,18 @@ bool CXFA_FFListBox::OnKillFocus(CXFA_FFWidget* pNewFocus) {
bool CXFA_FFListBox::CommitData() {
CFWL_ListBox* pListBox = static_cast<CFWL_ListBox*>(m_pNormalWidget);
+ std::vector<int32_t> iSelArray;
int32_t iSels = pListBox->CountSelItems();
- CFX_ArrayTemplate<int32_t> iSelArray;
for (int32_t i = 0; i < iSels; ++i)
- iSelArray.Add(pListBox->GetSelIndex(i));
+ iSelArray.push_back(pListBox->GetSelIndex(i));
m_pDataAcc->SetSelectedItems(iSelArray, true, false, true);
return true;
}
bool CXFA_FFListBox::IsDataChanged() {
- CFX_ArrayTemplate<int32_t> iSelArray;
- m_pDataAcc->GetSelectedItems(iSelArray);
- int32_t iOldSels = iSelArray.GetSize();
- CFWL_ListBox* pListBox = (CFWL_ListBox*)m_pNormalWidget;
+ std::vector<int32_t> iSelArray = m_pDataAcc->GetSelectedItems();
+ int32_t iOldSels = pdfium::CollectionSize<int32_t>(iSelArray);
+ auto* pListBox = static_cast<CFWL_ListBox*>(m_pNormalWidget);
int32_t iSels = pListBox->CountSelItems();
if (iOldSels != iSels)
return true;
@@ -134,28 +127,24 @@ uint32_t CXFA_FFListBox::GetAlignment() {
return dwExtendedStyle;
}
bool CXFA_FFListBox::UpdateFWLData() {
- if (!m_pNormalWidget) {
+ if (!m_pNormalWidget)
return false;
- }
- CFWL_ListBox* pListBox = ((CFWL_ListBox*)m_pNormalWidget);
- CFX_ArrayTemplate<CFWL_ListItem*> selItemArray;
- CFX_ArrayTemplate<int32_t> iSelArray;
- m_pDataAcc->GetSelectedItems(iSelArray);
- int32_t iSelCount = iSelArray.GetSize();
- for (int32_t j = 0; j < iSelCount; j++) {
- CFWL_ListItem* lpItemSel = pListBox->GetSelItem(iSelArray[j]);
- selItemArray.Add(lpItemSel);
- }
+
+ auto* pListBox = static_cast<CFWL_ListBox*>(m_pNormalWidget);
+ std::vector<int32_t> iSelArray = m_pDataAcc->GetSelectedItems();
+ std::vector<CFWL_ListItem*> selItemArray(iSelArray.size());
+ std::transform(iSelArray.begin(), iSelArray.end(), selItemArray.begin(),
+ [pListBox](int32_t val) { return pListBox->GetSelItem(val); });
+
pListBox->SetSelItem(pListBox->GetSelItem(-1), false);
- for (int32_t i = 0; i < iSelCount; i++) {
- ((CFWL_ListBox*)m_pNormalWidget)->SetSelItem(selItemArray[i], true);
- }
+ for (CFWL_ListItem* pItem : selItemArray)
+ pListBox->SetSelItem(pItem, true);
+
m_pNormalWidget->Update();
return true;
}
-void CXFA_FFListBox::OnSelectChanged(
- CFWL_Widget* pWidget,
- const CFX_ArrayTemplate<int32_t>& arrSels) {
+void CXFA_FFListBox::OnSelectChanged(CFWL_Widget* pWidget,
+ const std::vector<int32_t>& arrSels) {
CXFA_EventParam eParam;
eParam.m_eType = XFA_EVENT_Change;
eParam.m_pTarget = m_pDataAcc;
@@ -201,7 +190,7 @@ void CXFA_FFListBox::OnProcessEvent(CFWL_Event* pEvent) {
CXFA_FFField::OnProcessEvent(pEvent);
switch (pEvent->GetType()) {
case CFWL_Event::Type::SelectChanged: {
- CFX_ArrayTemplate<int32_t> arrSels;
+ std::vector<int32_t> arrSels;
OnSelectChanged(m_pNormalWidget, arrSels);
break;
}
@@ -227,7 +216,7 @@ CFX_RectF CXFA_FFComboBox::GetBBox(uint32_t dwStatus, bool bDrawFocus) {
}
bool CXFA_FFComboBox::PtInActiveRect(const CFX_PointF& point) {
- auto pComboBox = static_cast<CFWL_ComboBox*>(m_pNormalWidget);
+ auto* pComboBox = static_cast<CFWL_ComboBox*>(m_pNormalWidget);
return pComboBox && pComboBox->GetBBox().Contains(point);
}
@@ -244,17 +233,12 @@ bool CXFA_FFComboBox::LoadWidget() {
m_pNormalWidget->SetDelegate(this);
m_pNormalWidget->LockUpdate();
- std::vector<CFX_WideString> wsLabelArray;
- m_pDataAcc->GetChoiceListItems(wsLabelArray, false);
- int32_t iItems = pdfium::CollectionSize<int32_t>(wsLabelArray);
- for (int32_t i = 0; i < iItems; i++) {
- pComboBox->AddString(wsLabelArray[i].AsStringC());
- }
- CFX_ArrayTemplate<int32_t> iSelArray;
- m_pDataAcc->GetSelectedItems(iSelArray);
- int32_t iSelCount = iSelArray.GetSize();
- if (iSelCount > 0) {
- pComboBox->SetCurSel(iSelArray[0]);
+ for (const auto& label : m_pDataAcc->GetChoiceListItems(false))
+ pComboBox->AddString(label.AsStringC());
+
+ std::vector<int32_t> iSelArray = m_pDataAcc->GetSelectedItems();
+ if (!iSelArray.empty()) {
+ pComboBox->SetCurSel(iSelArray.front());
} else {
CFX_WideString wsText;
m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Raw);
@@ -375,24 +359,25 @@ uint32_t CXFA_FFComboBox::GetAlignment() {
}
return dwExtendedStyle;
}
+
bool CXFA_FFComboBox::UpdateFWLData() {
- if (!m_pNormalWidget) {
+ auto* pComboBox = static_cast<CFWL_ComboBox*>(m_pNormalWidget);
+ if (!pComboBox)
return false;
- }
- CFX_ArrayTemplate<int32_t> iSelArray;
- m_pDataAcc->GetSelectedItems(iSelArray);
- int32_t iSelCount = iSelArray.GetSize();
- if (iSelCount > 0) {
- ((CFWL_ComboBox*)m_pNormalWidget)->SetCurSel(iSelArray[0]);
+
+ std::vector<int32_t> iSelArray = m_pDataAcc->GetSelectedItems();
+ if (!iSelArray.empty()) {
+ pComboBox->SetCurSel(iSelArray.front());
} else {
CFX_WideString wsText;
- ((CFWL_ComboBox*)m_pNormalWidget)->SetCurSel(-1);
+ pComboBox->SetCurSel(-1);
m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Raw);
- ((CFWL_ComboBox*)m_pNormalWidget)->SetEditText(wsText);
+ pComboBox->SetEditText(wsText);
}
- m_pNormalWidget->Update();
+ pComboBox->Update();
return true;
}
+
bool CXFA_FFComboBox::CanUndo() {
return m_pDataAcc->IsChoiceListAllowTextEntry() &&
((CFWL_ComboBox*)m_pNormalWidget)->EditCanUndo();
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffchoicelist.h b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffchoicelist.h
index e89366ad13d..8875655901c 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffchoicelist.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffchoicelist.h
@@ -7,8 +7,10 @@
#ifndef XFA_FXFA_APP_XFA_FFCHOICELIST_H_
#define XFA_FXFA_APP_XFA_FFCHOICELIST_H_
+#include <vector>
+
#include "xfa/fxfa/app/xfa_fffield.h"
-#include "xfa/fxfa/xfa_ffpageview.h"
+#include "xfa/fxfa/cxfa_ffpageview.h"
class CXFA_FFListBox : public CXFA_FFField {
public:
@@ -24,12 +26,12 @@ class CXFA_FFListBox : public CXFA_FFField {
const CFX_Matrix* pMatrix = nullptr) override;
void OnSelectChanged(CFWL_Widget* pWidget,
- const CFX_ArrayTemplate<int32_t>& arrSels);
+ const std::vector<int32_t>& arrSels);
void SetItemState(int32_t nIndex, bool bSelected);
void InsertItem(const CFX_WideStringC& wsLabel, int32_t nIndex = -1);
void DeleteItem(int32_t nIndex);
- protected:
+ private:
bool CommitData() override;
bool UpdateFWLData() override;
bool IsDataChanged() override;
@@ -82,7 +84,7 @@ class CXFA_FFComboBox : public CXFA_FFField {
void InsertItem(const CFX_WideStringC& wsLabel, int32_t nIndex = -1);
void DeleteItem(int32_t nIndex);
- protected:
+ private:
// CXFA_FFField
bool PtInActiveRect(const CFX_PointF& point) override;
bool CommitData() override;
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffdoc.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffdoc.cpp
deleted file mode 100644
index 911bdf84006..00000000000
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffdoc.cpp
+++ /dev/null
@@ -1,441 +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
-
-#include "xfa/fxfa/xfa_ffdoc.h"
-
-#include <algorithm>
-#include <memory>
-#include <vector>
-
-#include "core/fpdfapi/parser/cpdf_array.h"
-#include "core/fpdfapi/parser/cpdf_document.h"
-#include "core/fpdfapi/parser/fpdf_parser_decode.h"
-#include "core/fpdfdoc/cpdf_nametree.h"
-#include "core/fxcrt/fx_ext.h"
-#include "core/fxcrt/fx_memory.h"
-#include "third_party/base/ptr_util.h"
-#include "xfa/fde/xml/fde_xml_imp.h"
-#include "xfa/fwl/cfwl_notedriver.h"
-#include "xfa/fxfa/app/xfa_ffnotify.h"
-#include "xfa/fxfa/parser/cxfa_dataexporter.h"
-#include "xfa/fxfa/parser/cxfa_dataimporter.h"
-#include "xfa/fxfa/parser/cxfa_document.h"
-#include "xfa/fxfa/xfa_checksum.h"
-#include "xfa/fxfa/xfa_ffapp.h"
-#include "xfa/fxfa/xfa_ffdocview.h"
-#include "xfa/fxfa/xfa_ffwidget.h"
-#include "xfa/fxfa/xfa_fontmgr.h"
-
-namespace {
-
-struct FX_BASE64DATA {
- uint32_t data1 : 2;
- uint32_t data2 : 6;
- uint32_t data3 : 4;
- uint32_t data4 : 4;
- uint32_t data5 : 6;
- uint32_t data6 : 2;
- uint32_t data7 : 8;
-};
-
-const uint8_t kStartValuesRemoved = 43;
-const uint8_t kDecoderMapSize = 80;
-const uint8_t g_FXBase64DecoderMap[kDecoderMapSize] = {
- 0x3E, 0xFF, 0xFF, 0xFF, 0x3F, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A,
- 0x3B, 0x3C, 0x3D, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x01,
- 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
- 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F,
- 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B,
- 0x2C, 0x2D, 0x2E, 0x2F, 0x30, 0x31, 0x32, 0x33,
-};
-
-uint8_t base64DecoderValue(uint8_t val) {
- if (val < kStartValuesRemoved || val >= kStartValuesRemoved + kDecoderMapSize)
- return 0xFF;
- return g_FXBase64DecoderMap[val - kStartValuesRemoved];
-}
-
-void Base64DecodePiece(const FX_CHAR src[4],
- int32_t iChars,
- FX_BASE64DATA& dst,
- int32_t& iBytes) {
- ASSERT(iChars > 0 && iChars < 5);
- iBytes = 1;
- dst.data2 = base64DecoderValue(static_cast<uint8_t>(src[0]));
- if (iChars > 1) {
- uint8_t b = base64DecoderValue(static_cast<uint8_t>(src[1]));
- dst.data1 = b >> 4;
- dst.data4 = b;
- if (iChars > 2) {
- iBytes = 2;
- b = base64DecoderValue(static_cast<uint8_t>(src[2]));
- dst.data3 = b >> 2;
- dst.data6 = b;
- if (iChars > 3) {
- iBytes = 3;
- dst.data5 = base64DecoderValue(static_cast<uint8_t>(src[3]));
- } else {
- dst.data5 = 0;
- }
- } else {
- dst.data3 = 0;
- }
- } else {
- dst.data1 = 0;
- }
-}
-
-int32_t Base64DecodeW(const FX_WCHAR* pSrc, int32_t iSrcLen, uint8_t* pDst) {
- ASSERT(pSrc);
- if (iSrcLen < 1) {
- return 0;
- }
- while (iSrcLen > 0 && pSrc[iSrcLen - 1] == '=') {
- iSrcLen--;
- }
- if (iSrcLen < 1) {
- return 0;
- }
- if (!pDst) {
- int32_t iDstLen = iSrcLen / 4 * 3;
- iSrcLen %= 4;
- if (iSrcLen == 1) {
- iDstLen += 1;
- } else if (iSrcLen == 2) {
- iDstLen += 1;
- } else if (iSrcLen == 3) {
- iDstLen += 2;
- }
- return iDstLen;
- }
- FX_CHAR srcData[4];
- FX_BASE64DATA dstData;
- int32_t iChars = 4, iBytes;
- uint8_t* pDstEnd = pDst;
- while (iSrcLen > 0) {
- if (iSrcLen > 3) {
- srcData[0] = (FX_CHAR)*pSrc++;
- srcData[1] = (FX_CHAR)*pSrc++;
- srcData[2] = (FX_CHAR)*pSrc++;
- srcData[3] = (FX_CHAR)*pSrc++;
- iSrcLen -= 4;
- } else {
- *((uint32_t*)&dstData) = 0;
- *((uint32_t*)srcData) = 0;
- srcData[0] = (FX_CHAR)*pSrc++;
- if (iSrcLen > 1) {
- srcData[1] = (FX_CHAR)*pSrc++;
- }
- if (iSrcLen > 2) {
- srcData[2] = (FX_CHAR)*pSrc++;
- }
- iChars = iSrcLen;
- iSrcLen = 0;
- }
- Base64DecodePiece(srcData, iChars, dstData, iBytes);
- *pDstEnd++ = ((uint8_t*)&dstData)[0];
- if (iBytes > 1) {
- *pDstEnd++ = ((uint8_t*)&dstData)[1];
- }
- if (iBytes > 2) {
- *pDstEnd++ = ((uint8_t*)&dstData)[2];
- }
- }
- return pDstEnd - pDst;
-}
-
-} // namespace
-
-CXFA_FFDoc::CXFA_FFDoc(CXFA_FFApp* pApp, IXFA_DocEnvironment* pDocEnvironment)
- : m_pDocEnvironment(pDocEnvironment),
- m_pDocumentParser(nullptr),
- m_pApp(pApp),
- m_pNotify(nullptr),
- m_pPDFDoc(nullptr),
- m_dwDocType(XFA_DOCTYPE_Static) {}
-
-CXFA_FFDoc::~CXFA_FFDoc() {
- CloseDoc();
-}
-
-uint32_t CXFA_FFDoc::GetDocType() {
- return m_dwDocType;
-}
-
-int32_t CXFA_FFDoc::StartLoad() {
- m_pNotify = pdfium::MakeUnique<CXFA_FFNotify>(this);
- m_pDocumentParser = pdfium::MakeUnique<CXFA_DocumentParser>(m_pNotify.get());
- return m_pDocumentParser->StartParse(m_pStream, XFA_XDPPACKET_XDP);
-}
-
-bool XFA_GetPDFContentsFromPDFXML(CFDE_XMLNode* pPDFElement,
- uint8_t*& pByteBuffer,
- int32_t& iBufferSize) {
- CFDE_XMLElement* pDocumentElement = nullptr;
- for (CFDE_XMLNode* pXMLNode =
- pPDFElement->GetNodeItem(CFDE_XMLNode::FirstChild);
- pXMLNode; pXMLNode = pXMLNode->GetNodeItem(CFDE_XMLNode::NextSibling)) {
- if (pXMLNode->GetType() == FDE_XMLNODE_Element) {
- CFX_WideString wsTagName;
- CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode);
- pXMLElement->GetTagName(wsTagName);
- if (wsTagName == L"document") {
- pDocumentElement = pXMLElement;
- break;
- }
- }
- }
- if (!pDocumentElement) {
- return false;
- }
- CFDE_XMLElement* pChunkElement = nullptr;
- for (CFDE_XMLNode* pXMLNode =
- pDocumentElement->GetNodeItem(CFDE_XMLNode::FirstChild);
- pXMLNode; pXMLNode = pXMLNode->GetNodeItem(CFDE_XMLNode::NextSibling)) {
- if (pXMLNode->GetType() == FDE_XMLNODE_Element) {
- CFX_WideString wsTagName;
- CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode);
- pXMLElement->GetTagName(wsTagName);
- if (wsTagName == L"chunk") {
- pChunkElement = pXMLElement;
- break;
- }
- }
- }
- if (!pChunkElement) {
- return false;
- }
- CFX_WideString wsPDFContent;
- pChunkElement->GetTextData(wsPDFContent);
- iBufferSize =
- Base64DecodeW(wsPDFContent.c_str(), wsPDFContent.GetLength(), nullptr);
- pByteBuffer = FX_Alloc(uint8_t, iBufferSize + 1);
- pByteBuffer[iBufferSize] = '0'; // FIXME: I bet this is wrong.
- Base64DecodeW(wsPDFContent.c_str(), wsPDFContent.GetLength(), pByteBuffer);
- return true;
-}
-void XFA_XPDPacket_MergeRootNode(CXFA_Node* pOriginRoot, CXFA_Node* pNewRoot) {
- CXFA_Node* pChildNode = pNewRoot->GetNodeItem(XFA_NODEITEM_FirstChild);
- while (pChildNode) {
- CXFA_Node* pOriginChild =
- pOriginRoot->GetFirstChildByName(pChildNode->GetNameHash());
- if (pOriginChild) {
- pChildNode = pChildNode->GetNodeItem(XFA_NODEITEM_NextSibling);
- } else {
- CXFA_Node* pNextSibling =
- pChildNode->GetNodeItem(XFA_NODEITEM_NextSibling);
- pNewRoot->RemoveChild(pChildNode);
- pOriginRoot->InsertChild(pChildNode);
- pChildNode = pNextSibling;
- pNextSibling = nullptr;
- }
- }
-}
-
-int32_t CXFA_FFDoc::DoLoad(IFX_Pause* pPause) {
- int32_t iStatus = m_pDocumentParser->DoParse(pPause);
- if (iStatus == XFA_PARSESTATUS_Done && !m_pPDFDoc)
- return XFA_PARSESTATUS_SyntaxErr;
- return iStatus;
-}
-
-void CXFA_FFDoc::StopLoad() {
- m_pApp->GetXFAFontMgr()->LoadDocFonts(this);
- m_dwDocType = XFA_DOCTYPE_Static;
- CXFA_Node* pConfig = ToNode(
- m_pDocumentParser->GetDocument()->GetXFAObject(XFA_HASHCODE_Config));
- if (!pConfig) {
- return;
- }
- CXFA_Node* pAcrobat = pConfig->GetFirstChildByClass(XFA_Element::Acrobat);
- if (!pAcrobat) {
- return;
- }
- CXFA_Node* pAcrobat7 = pAcrobat->GetFirstChildByClass(XFA_Element::Acrobat7);
- if (!pAcrobat7) {
- return;
- }
- CXFA_Node* pDynamicRender =
- pAcrobat7->GetFirstChildByClass(XFA_Element::DynamicRender);
- if (!pDynamicRender) {
- return;
- }
- CFX_WideString wsType;
- if (pDynamicRender->TryContent(wsType) && wsType == L"required") {
- m_dwDocType = XFA_DOCTYPE_Dynamic;
- }
-}
-
-CXFA_FFDocView* CXFA_FFDoc::CreateDocView(uint32_t dwView) {
- if (!m_TypeToDocViewMap[dwView])
- m_TypeToDocViewMap[dwView] = pdfium::MakeUnique<CXFA_FFDocView>(this);
-
- return m_TypeToDocViewMap[dwView].get();
-}
-
-CXFA_FFDocView* CXFA_FFDoc::GetDocView(CXFA_LayoutProcessor* pLayout) {
- for (const auto& pair : m_TypeToDocViewMap) {
- if (pair.second->GetXFALayout() == pLayout)
- return pair.second.get();
- }
- return nullptr;
-}
-
-CXFA_FFDocView* CXFA_FFDoc::GetDocView() {
- auto it = m_TypeToDocViewMap.begin();
- return it != m_TypeToDocViewMap.end() ? it->second.get() : nullptr;
-}
-
-bool CXFA_FFDoc::OpenDoc(const CFX_RetainPtr<IFX_SeekableReadStream>& pStream) {
- m_pStream = pStream;
- return true;
-}
-bool CXFA_FFDoc::OpenDoc(CPDF_Document* pPDFDoc) {
- if (!pPDFDoc)
- return false;
-
- CPDF_Dictionary* pRoot = pPDFDoc->GetRoot();
- if (!pRoot)
- return false;
-
- CPDF_Dictionary* pAcroForm = pRoot->GetDictFor("AcroForm");
- if (!pAcroForm)
- return false;
-
- CPDF_Object* pElementXFA = pAcroForm->GetDirectObjectFor("XFA");
- if (!pElementXFA)
- return false;
-
- std::vector<CPDF_Stream*> xfaStreams;
- if (pElementXFA->IsArray()) {
- CPDF_Array* pXFAArray = (CPDF_Array*)pElementXFA;
- for (size_t i = 0; i < pXFAArray->GetCount() / 2; i++) {
- if (CPDF_Stream* pStream = pXFAArray->GetStreamAt(i * 2 + 1))
- xfaStreams.push_back(pStream);
- }
- } else if (pElementXFA->IsStream()) {
- xfaStreams.push_back((CPDF_Stream*)pElementXFA);
- }
- if (xfaStreams.empty())
- return false;
-
- m_pPDFDoc = pPDFDoc;
- m_pStream = MakeSeekableReadStream(xfaStreams);
- return true;
-}
-
-bool CXFA_FFDoc::CloseDoc() {
- for (const auto& pair : m_TypeToDocViewMap)
- pair.second->RunDocClose();
-
- CXFA_Document* doc =
- m_pDocumentParser ? m_pDocumentParser->GetDocument() : nullptr;
- if (doc)
- doc->ClearLayoutData();
-
- m_TypeToDocViewMap.clear();
-
- m_pNotify.reset(nullptr);
- m_pApp->GetXFAFontMgr()->ReleaseDocFonts(this);
-
- for (const auto& pair : m_HashToDibDpiMap)
- delete pair.second.pDibSource;
-
- m_HashToDibDpiMap.clear();
- m_pApp->ClearEventTargets();
- return true;
-}
-void CXFA_FFDoc::SetDocType(uint32_t dwType) {
- m_dwDocType = dwType;
-}
-CPDF_Document* CXFA_FFDoc::GetPDFDoc() {
- return m_pPDFDoc;
-}
-
-CFX_DIBitmap* CXFA_FFDoc::GetPDFNamedImage(const CFX_WideStringC& wsName,
- int32_t& iImageXDpi,
- int32_t& iImageYDpi) {
- if (!m_pPDFDoc)
- return nullptr;
-
- uint32_t dwHash = FX_HashCode_GetW(wsName, false);
- auto it = m_HashToDibDpiMap.find(dwHash);
- if (it != m_HashToDibDpiMap.end()) {
- iImageXDpi = it->second.iImageXDpi;
- iImageYDpi = it->second.iImageYDpi;
- return static_cast<CFX_DIBitmap*>(it->second.pDibSource);
- }
-
- CPDF_Dictionary* pRoot = m_pPDFDoc->GetRoot();
- if (!pRoot)
- return nullptr;
-
- CPDF_Dictionary* pNames = pRoot->GetDictFor("Names");
- if (!pNames)
- return nullptr;
-
- CPDF_Dictionary* pXFAImages = pNames->GetDictFor("XFAImages");
- if (!pXFAImages)
- return nullptr;
-
- CPDF_NameTree nametree(pXFAImages);
- CFX_ByteString bsName = PDF_EncodeText(wsName.c_str(), wsName.GetLength());
- CPDF_Object* pObject = nametree.LookupValue(bsName);
- if (!pObject) {
- for (size_t i = 0; i < nametree.GetCount(); i++) {
- CFX_ByteString bsTemp;
- CPDF_Object* pTempObject = nametree.LookupValue(i, bsTemp);
- if (bsTemp == bsName) {
- pObject = pTempObject;
- break;
- }
- }
- }
-
- CPDF_Stream* pStream = ToStream(pObject);
- if (!pStream)
- return nullptr;
-
- CPDF_StreamAcc streamAcc;
- streamAcc.LoadAllData(pStream);
-
- CFX_RetainPtr<IFX_SeekableReadStream> pImageFileRead =
- IFX_MemoryStream::Create((uint8_t*)streamAcc.GetData(),
- streamAcc.GetSize());
-
- CFX_DIBitmap* pDibSource = XFA_LoadImageFromBuffer(
- pImageFileRead, FXCODEC_IMAGE_UNKNOWN, iImageXDpi, iImageYDpi);
- m_HashToDibDpiMap[dwHash] = {pDibSource, iImageXDpi, iImageYDpi};
- return pDibSource;
-}
-
-bool CXFA_FFDoc::SavePackage(
- XFA_HashCode code,
- const CFX_RetainPtr<IFX_SeekableWriteStream>& pFile,
- CXFA_ChecksumContext* pCSContext) {
- CXFA_Document* doc = m_pDocumentParser->GetDocument();
- std::unique_ptr<CXFA_DataExporter> pExport(new CXFA_DataExporter(doc));
- CXFA_Node* pNode = code == XFA_HASHCODE_Xfa ? doc->GetRoot()
- : ToNode(doc->GetXFAObject(code));
- if (!pNode)
- return !!pExport->Export(pFile);
-
- CFX_ByteString bsChecksum;
- if (pCSContext)
- bsChecksum = pCSContext->GetChecksum();
-
- return !!pExport->Export(
- pFile, pNode, 0, bsChecksum.GetLength() ? bsChecksum.c_str() : nullptr);
-}
-
-bool CXFA_FFDoc::ImportData(
- const CFX_RetainPtr<IFX_SeekableReadStream>& pStream,
- bool bXDP) {
- auto importer =
- pdfium::MakeUnique<CXFA_DataImporter>(m_pDocumentParser->GetDocument());
- return importer->ImportData(pStream);
-}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffdochandler.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffdochandler.cpp
deleted file mode 100644
index db73531ccc5..00000000000
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffdochandler.cpp
+++ /dev/null
@@ -1,60 +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
-
-#include "xfa/fxfa/xfa_ffdochandler.h"
-
-#include "xfa/fxfa/parser/cxfa_scriptcontext.h"
-#include "xfa/fxfa/parser/xfa_resolvenode_rs.h"
-#include "xfa/fxfa/xfa_checksum.h"
-#include "xfa/fxfa/xfa_ffdoc.h"
-
-CXFA_FFDocHandler::CXFA_FFDocHandler() {}
-
-CXFA_FFDocHandler::~CXFA_FFDocHandler() {}
-
-CFXJSE_Value* CXFA_FFDocHandler::GetXFAScriptObject(CXFA_FFDoc* hDoc) {
- CXFA_Document* pXFADoc = hDoc->GetXFADoc();
- if (!pXFADoc)
- return nullptr;
-
- CXFA_ScriptContext* pScriptContext = pXFADoc->GetScriptContext();
- if (!pScriptContext)
- return nullptr;
- return pScriptContext->GetJSValueFromMap(pXFADoc->GetRoot());
-}
-
-XFA_ATTRIBUTEENUM CXFA_FFDocHandler::GetRestoreState(CXFA_FFDoc* hDoc) {
- CXFA_Document* pXFADoc = hDoc->GetXFADoc();
- if (!pXFADoc)
- return XFA_ATTRIBUTEENUM_Unknown;
-
- CXFA_Node* pForm = ToNode(pXFADoc->GetXFAObject(XFA_HASHCODE_Form));
- if (!pForm)
- return XFA_ATTRIBUTEENUM_Unknown;
-
- CXFA_Node* pSubForm = pForm->GetFirstChildByClass(XFA_Element::Subform);
- if (!pSubForm)
- return XFA_ATTRIBUTEENUM_Unknown;
- return pSubForm->GetEnum(XFA_ATTRIBUTE_RestoreState);
-}
-
-bool CXFA_FFDocHandler::RunDocScript(CXFA_FFDoc* hDoc,
- XFA_SCRIPTTYPE eScriptType,
- const CFX_WideStringC& wsScript,
- CFXJSE_Value* pRetValue,
- CFXJSE_Value* pThisValue) {
- CXFA_Document* pXFADoc = hDoc->GetXFADoc();
- if (!pXFADoc)
- return false;
-
- CXFA_ScriptContext* pScriptContext = pXFADoc->GetScriptContext();
- if (!pScriptContext)
- return false;
-
- return pScriptContext->RunScript(
- (XFA_SCRIPTLANGTYPE)eScriptType, wsScript, pRetValue,
- pThisValue ? CXFA_ScriptContext::ToObject(pThisValue, nullptr) : nullptr);
-}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffdocview.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffdocview.cpp
deleted file mode 100644
index 87441814e53..00000000000
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffdocview.cpp
+++ /dev/null
@@ -1,850 +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
-
-#include "xfa/fxfa/xfa_ffdocview.h"
-
-#include "core/fxcrt/fx_ext.h"
-#include "third_party/base/ptr_util.h"
-#include "third_party/base/stl_util.h"
-#include "xfa/fxfa/app/xfa_ffbarcode.h"
-#include "xfa/fxfa/app/xfa_ffcheckbutton.h"
-#include "xfa/fxfa/app/xfa_ffchoicelist.h"
-#include "xfa/fxfa/app/xfa_ffdraw.h"
-#include "xfa/fxfa/app/xfa_ffexclgroup.h"
-#include "xfa/fxfa/app/xfa_fffield.h"
-#include "xfa/fxfa/app/xfa_ffimage.h"
-#include "xfa/fxfa/app/xfa_ffimageedit.h"
-#include "xfa/fxfa/app/xfa_ffpath.h"
-#include "xfa/fxfa/app/xfa_ffpushbutton.h"
-#include "xfa/fxfa/app/xfa_ffsignature.h"
-#include "xfa/fxfa/app/xfa_ffsubform.h"
-#include "xfa/fxfa/app/xfa_fftext.h"
-#include "xfa/fxfa/app/xfa_fftextedit.h"
-#include "xfa/fxfa/app/xfa_ffwidgetacc.h"
-#include "xfa/fxfa/app/xfa_fwladapter.h"
-#include "xfa/fxfa/parser/cxfa_binditems.h"
-#include "xfa/fxfa/parser/cxfa_layoutprocessor.h"
-#include "xfa/fxfa/parser/cxfa_scriptcontext.h"
-#include "xfa/fxfa/parser/xfa_resolvenode_rs.h"
-#include "xfa/fxfa/xfa_ffapp.h"
-#include "xfa/fxfa/xfa_ffdoc.h"
-#include "xfa/fxfa/xfa_ffpageview.h"
-#include "xfa/fxfa/xfa_ffwidget.h"
-#include "xfa/fxfa/xfa_ffwidgethandler.h"
-
-const XFA_ATTRIBUTEENUM gs_EventActivity[] = {
- XFA_ATTRIBUTEENUM_Click, XFA_ATTRIBUTEENUM_Change,
- XFA_ATTRIBUTEENUM_DocClose, XFA_ATTRIBUTEENUM_DocReady,
- XFA_ATTRIBUTEENUM_Enter, XFA_ATTRIBUTEENUM_Exit,
- XFA_ATTRIBUTEENUM_Full, XFA_ATTRIBUTEENUM_IndexChange,
- XFA_ATTRIBUTEENUM_Initialize, XFA_ATTRIBUTEENUM_MouseDown,
- XFA_ATTRIBUTEENUM_MouseEnter, XFA_ATTRIBUTEENUM_MouseExit,
- XFA_ATTRIBUTEENUM_MouseUp, XFA_ATTRIBUTEENUM_PostExecute,
- XFA_ATTRIBUTEENUM_PostOpen, XFA_ATTRIBUTEENUM_PostPrint,
- XFA_ATTRIBUTEENUM_PostSave, XFA_ATTRIBUTEENUM_PostSign,
- XFA_ATTRIBUTEENUM_PostSubmit, XFA_ATTRIBUTEENUM_PreExecute,
- XFA_ATTRIBUTEENUM_PreOpen, XFA_ATTRIBUTEENUM_PrePrint,
- XFA_ATTRIBUTEENUM_PreSave, XFA_ATTRIBUTEENUM_PreSign,
- XFA_ATTRIBUTEENUM_PreSubmit, XFA_ATTRIBUTEENUM_Ready,
- XFA_ATTRIBUTEENUM_Unknown,
-};
-
-CXFA_FFDocView::CXFA_FFDocView(CXFA_FFDoc* pDoc)
- : m_bLayoutEvent(false),
- m_pListFocusWidget(nullptr),
- m_bInLayoutStatus(false),
- m_pDoc(pDoc),
- m_pXFADocLayout(nullptr),
- m_pFocusAcc(nullptr),
- m_pFocusWidget(nullptr),
- m_pOldFocusWidget(nullptr),
- m_iStatus(XFA_DOCVIEW_LAYOUTSTATUS_None),
- m_iLock(0) {}
-
-CXFA_FFDocView::~CXFA_FFDocView() {
- DestroyDocView();
-}
-
-void CXFA_FFDocView::InitLayout(CXFA_Node* pNode) {
- RunBindItems();
- ExecEventActivityByDeepFirst(pNode, XFA_EVENT_Initialize, false, true,
- nullptr);
- ExecEventActivityByDeepFirst(pNode, XFA_EVENT_IndexChange, false, true,
- nullptr);
-}
-int32_t CXFA_FFDocView::StartLayout(int32_t iStartPage) {
- m_iStatus = XFA_DOCVIEW_LAYOUTSTATUS_Start;
- m_pDoc->GetXFADoc()->DoProtoMerge();
- m_pDoc->GetXFADoc()->DoDataMerge();
- m_pXFADocLayout = GetXFALayout();
- int32_t iStatus = m_pXFADocLayout->StartLayout();
- if (iStatus < 0) {
- return iStatus;
- }
- CXFA_Node* pRootItem =
- ToNode(m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form));
- if (!pRootItem) {
- return iStatus;
- }
- InitLayout(pRootItem);
- InitCalculate(pRootItem);
- InitValidate(pRootItem);
- ExecEventActivityByDeepFirst(pRootItem, XFA_EVENT_Ready, true, true, nullptr);
- m_iStatus = XFA_DOCVIEW_LAYOUTSTATUS_Start;
- return iStatus;
-}
-int32_t CXFA_FFDocView::DoLayout(IFX_Pause* pPause) {
- int32_t iStatus = 100;
- iStatus = m_pXFADocLayout->DoLayout(pPause);
- if (iStatus != 100) {
- return iStatus;
- }
- m_iStatus = XFA_DOCVIEW_LAYOUTSTATUS_Doing;
- return iStatus;
-}
-void CXFA_FFDocView::StopLayout() {
- CXFA_Node* pRootItem =
- ToNode(m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form));
- if (!pRootItem) {
- return;
- }
- CXFA_Node* pSubformNode = pRootItem->GetChild(0, XFA_Element::Subform);
- if (!pSubformNode) {
- return;
- }
- CXFA_Node* pPageSetNode =
- pSubformNode->GetFirstChildByClass(XFA_Element::PageSet);
- if (!pPageSetNode) {
- return;
- }
- RunCalculateWidgets();
- RunValidate();
- InitLayout(pPageSetNode);
- InitCalculate(pPageSetNode);
- InitValidate(pPageSetNode);
- ExecEventActivityByDeepFirst(pPageSetNode, XFA_EVENT_Ready, true, true,
- nullptr);
- ExecEventActivityByDeepFirst(pRootItem, XFA_EVENT_Ready, false, true,
- nullptr);
- ExecEventActivityByDeepFirst(pRootItem, XFA_EVENT_DocReady, false, true,
- nullptr);
- RunCalculateWidgets();
- RunValidate();
- if (RunLayout()) {
- ExecEventActivityByDeepFirst(pRootItem, XFA_EVENT_Ready, false, true,
- nullptr);
- }
- m_CalculateAccs.clear();
- if (m_pFocusAcc && !m_pFocusWidget) {
- SetFocusWidgetAcc(m_pFocusAcc);
- }
- m_iStatus = XFA_DOCVIEW_LAYOUTSTATUS_End;
-}
-int32_t CXFA_FFDocView::GetLayoutStatus() {
- return m_iStatus;
-}
-void CXFA_FFDocView::ShowNullTestMsg() {
- int32_t iCount = pdfium::CollectionSize<int32_t>(m_arrNullTestMsg);
- CXFA_FFApp* pApp = m_pDoc->GetApp();
- IXFA_AppProvider* pAppProvider = pApp->GetAppProvider();
- if (pAppProvider && iCount) {
- int32_t iRemain = iCount > 7 ? iCount - 7 : 0;
- iCount -= iRemain;
- CFX_WideString wsMsg;
- for (int32_t i = 0; i < iCount; i++) {
- wsMsg += m_arrNullTestMsg[i] + L"\n";
- }
- if (iRemain > 0) {
- CFX_WideString wsTemp;
- wsTemp.Format(
- L"Message limit exceeded. Remaining %d "
- L"validation errors not reported.",
- iRemain);
- wsMsg += L"\n" + wsTemp;
- }
- pAppProvider->MsgBox(wsMsg, pAppProvider->GetAppTitle(), XFA_MBICON_Status,
- XFA_MB_OK);
- }
- m_arrNullTestMsg.clear();
-}
-
-void CXFA_FFDocView::UpdateDocView() {
- if (IsUpdateLocked())
- return;
-
- LockUpdate();
- for (CXFA_Node* pNode : m_NewAddedNodes) {
- InitCalculate(pNode);
- InitValidate(pNode);
- ExecEventActivityByDeepFirst(pNode, XFA_EVENT_Ready, true, true, nullptr);
- }
- m_NewAddedNodes.clear();
- RunSubformIndexChange();
- RunCalculateWidgets();
- RunValidate();
- ShowNullTestMsg();
- if (RunLayout() && m_bLayoutEvent)
- RunEventLayoutReady();
-
- m_bLayoutEvent = false;
- m_CalculateAccs.clear();
- RunInvalidate();
- UnlockUpdate();
-}
-
-int32_t CXFA_FFDocView::CountPageViews() {
- if (!m_pXFADocLayout) {
- return 0;
- }
- return m_pXFADocLayout->CountPages();
-}
-CXFA_FFPageView* CXFA_FFDocView::GetPageView(int32_t nIndex) {
- if (!m_pXFADocLayout) {
- return nullptr;
- }
- return static_cast<CXFA_FFPageView*>(m_pXFADocLayout->GetPage(nIndex));
-}
-
-CXFA_LayoutProcessor* CXFA_FFDocView::GetXFALayout() const {
- return m_pDoc->GetXFADoc()->GetDocLayout();
-}
-bool CXFA_FFDocView::ResetSingleWidgetAccData(CXFA_WidgetAcc* pWidgetAcc) {
- CXFA_Node* pNode = pWidgetAcc->GetNode();
- XFA_Element eType = pNode->GetElementType();
- if (eType != XFA_Element::Field && eType != XFA_Element::ExclGroup) {
- return false;
- }
- pWidgetAcc->ResetData();
- pWidgetAcc->UpdateUIDisplay();
- if (CXFA_Validate validate = pWidgetAcc->GetValidate()) {
- AddValidateWidget(pWidgetAcc);
- validate.GetNode()->SetFlag(XFA_NodeFlag_NeedsInitApp, false);
- }
- return true;
-}
-void CXFA_FFDocView::ResetWidgetData(CXFA_WidgetAcc* pWidgetAcc) {
- m_bLayoutEvent = true;
- bool bChanged = false;
- CXFA_Node* pFormNode = nullptr;
- if (pWidgetAcc) {
- bChanged = ResetSingleWidgetAccData(pWidgetAcc);
- pFormNode = pWidgetAcc->GetNode();
- } else {
- pFormNode = GetRootSubform();
- }
- if (!pFormNode) {
- return;
- }
- if (pFormNode->GetElementType() != XFA_Element::Field &&
- pFormNode->GetElementType() != XFA_Element::ExclGroup) {
- CXFA_WidgetAccIterator Iterator(this, pFormNode);
- while (CXFA_WidgetAcc* pAcc = Iterator.MoveToNext()) {
- bChanged |= ResetSingleWidgetAccData(pAcc);
- if (pAcc->GetNode()->GetElementType() == XFA_Element::ExclGroup) {
- Iterator.SkipTree();
- }
- }
- }
- if (bChanged) {
- m_pDoc->GetDocEnvironment()->SetChangeMark(m_pDoc);
- }
-}
-int32_t CXFA_FFDocView::ProcessWidgetEvent(CXFA_EventParam* pParam,
- CXFA_WidgetAcc* pWidgetAcc) {
- if (!pParam)
- return XFA_EVENTERROR_Error;
-
- if (pParam->m_eType == XFA_EVENT_Validate) {
- CFX_WideString wsValidateStr(L"preSubmit");
- CXFA_Node* pConfigItem =
- ToNode(m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Config));
- if (pConfigItem) {
- CXFA_Node* pValidateNode = nullptr;
- CXFA_Node* pAcrobatNode = pConfigItem->GetChild(0, XFA_Element::Acrobat);
- pValidateNode = pAcrobatNode
- ? pAcrobatNode->GetChild(0, XFA_Element::Validate)
- : nullptr;
- if (!pValidateNode) {
- CXFA_Node* pPresentNode =
- pConfigItem->GetChild(0, XFA_Element::Present);
- pValidateNode = pPresentNode
- ? pPresentNode->GetChild(0, XFA_Element::Validate)
- : nullptr;
- }
- if (pValidateNode) {
- wsValidateStr = pValidateNode->GetContent();
- }
- }
- bool bValidate = false;
- switch (pParam->m_iValidateActivities) {
- case XFA_VALIDATE_preSubmit:
- bValidate = wsValidateStr.Find(L"preSubmit") != -1;
- break;
- case XFA_VALIDATE_prePrint:
- bValidate = wsValidateStr.Find(L"prePrint") != -1;
- break;
- case XFA_VALIDATE_preExecute:
- bValidate = wsValidateStr.Find(L"preExecute") != -1;
- break;
- case XFA_VALIDATE_preSave:
- bValidate = wsValidateStr.Find(L"preSave") != -1;
- break;
- }
- if (!bValidate) {
- return XFA_EVENTERROR_Success;
- }
- }
- CXFA_Node* pNode = pWidgetAcc ? pWidgetAcc->GetNode() : nullptr;
- if (!pNode) {
- CXFA_Node* pRootItem =
- ToNode(m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form));
- if (!pRootItem) {
- return XFA_EVENTERROR_Error;
- }
- pNode = pRootItem->GetChild(0, XFA_Element::Subform);
- }
- ExecEventActivityByDeepFirst(pNode, pParam->m_eType, pParam->m_bIsFormReady,
- true, nullptr);
- return XFA_EVENTERROR_Success;
-}
-CXFA_FFWidgetHandler* CXFA_FFDocView::GetWidgetHandler() {
- if (!m_pWidgetHandler)
- m_pWidgetHandler = pdfium::MakeUnique<CXFA_FFWidgetHandler>(this);
-
- return m_pWidgetHandler.get();
-}
-
-CXFA_WidgetAccIterator* CXFA_FFDocView::CreateWidgetAccIterator(
- XFA_WIDGETORDER eOrder) {
- CXFA_Node* pFormRoot = GetRootSubform();
- return pFormRoot ? new CXFA_WidgetAccIterator(this, pFormRoot) : nullptr;
-}
-CXFA_FFWidget* CXFA_FFDocView::GetFocusWidget() {
- return m_pFocusWidget;
-}
-void CXFA_FFDocView::KillFocus() {
- if (m_pFocusWidget &&
- (m_pFocusWidget->GetStatus() & XFA_WidgetStatus_Focused)) {
- (m_pFocusWidget)->OnKillFocus(nullptr);
- }
- m_pFocusAcc = nullptr;
- m_pFocusWidget = nullptr;
- m_pOldFocusWidget = nullptr;
-}
-bool CXFA_FFDocView::SetFocus(CXFA_FFWidget* hWidget) {
- CXFA_FFWidget* pNewFocus = hWidget;
- if (m_pOldFocusWidget == pNewFocus) {
- return false;
- }
- CXFA_FFWidget* pOldFocus = m_pOldFocusWidget;
- m_pOldFocusWidget = pNewFocus;
- if (pOldFocus) {
- if (m_pFocusWidget != m_pOldFocusWidget &&
- (pOldFocus->GetStatus() & XFA_WidgetStatus_Focused)) {
- m_pFocusWidget = pOldFocus;
- pOldFocus->OnKillFocus(pNewFocus);
- } else if ((pOldFocus->GetStatus() & XFA_WidgetStatus_Visible)) {
- if (!pOldFocus->IsLoaded()) {
- pOldFocus->LoadWidget();
- }
- pOldFocus->OnSetFocus(m_pFocusWidget);
- m_pFocusWidget = pOldFocus;
- pOldFocus->OnKillFocus(pNewFocus);
- }
- }
- if (m_pFocusWidget == m_pOldFocusWidget) {
- return false;
- }
- pNewFocus = m_pOldFocusWidget;
- if (m_pListFocusWidget && pNewFocus == m_pListFocusWidget) {
- m_pFocusAcc = nullptr;
- m_pFocusWidget = nullptr;
- m_pListFocusWidget = nullptr;
- m_pOldFocusWidget = nullptr;
- return false;
- }
- if (pNewFocus && (pNewFocus->GetStatus() & XFA_WidgetStatus_Visible)) {
- if (!pNewFocus->IsLoaded()) {
- pNewFocus->LoadWidget();
- }
- pNewFocus->OnSetFocus(m_pFocusWidget);
- }
- m_pFocusAcc = pNewFocus ? pNewFocus->GetDataAcc() : nullptr;
- m_pFocusWidget = pNewFocus;
- m_pOldFocusWidget = m_pFocusWidget;
- return true;
-}
-CXFA_WidgetAcc* CXFA_FFDocView::GetFocusWidgetAcc() {
- return m_pFocusAcc;
-}
-void CXFA_FFDocView::SetFocusWidgetAcc(CXFA_WidgetAcc* pWidgetAcc) {
- CXFA_FFWidget* pNewFocus =
- pWidgetAcc ? pWidgetAcc->GetNextWidget(nullptr) : nullptr;
- if (SetFocus(pNewFocus)) {
- m_pFocusAcc = pWidgetAcc;
- if (m_iStatus == XFA_DOCVIEW_LAYOUTSTATUS_End) {
- m_pDoc->GetDocEnvironment()->SetFocusWidget(m_pDoc, m_pFocusWidget);
- }
- }
-}
-void CXFA_FFDocView::DeleteLayoutItem(CXFA_FFWidget* pWidget) {
- if (m_pFocusAcc == pWidget->GetDataAcc()) {
- m_pFocusAcc = nullptr;
- m_pFocusWidget = nullptr;
- m_pOldFocusWidget = nullptr;
- }
-}
-static int32_t XFA_ProcessEvent(CXFA_FFDocView* pDocView,
- CXFA_WidgetAcc* pWidgetAcc,
- CXFA_EventParam* pParam) {
- if (!pParam || pParam->m_eType == XFA_EVENT_Unknown) {
- return XFA_EVENTERROR_NotExist;
- }
- if (!pWidgetAcc || pWidgetAcc->GetElementType() == XFA_Element::Draw) {
- return XFA_EVENTERROR_NotExist;
- }
- switch (pParam->m_eType) {
- case XFA_EVENT_Calculate:
- return pWidgetAcc->ProcessCalculate();
- case XFA_EVENT_Validate:
- if (((CXFA_FFDoc*)pDocView->GetDoc())
- ->GetDocEnvironment()
- ->IsValidationsEnabled(pDocView->GetDoc())) {
- return pWidgetAcc->ProcessValidate(0x01);
- }
- return XFA_EVENTERROR_Disabled;
- case XFA_EVENT_InitCalculate: {
- CXFA_Calculate calc = pWidgetAcc->GetCalculate();
- if (!calc) {
- return XFA_EVENTERROR_NotExist;
- }
- if (pWidgetAcc->GetNode()->IsUserInteractive())
- return XFA_EVENTERROR_Disabled;
-
- CXFA_Script script = calc.GetScript();
- return pWidgetAcc->ExecuteScript(script, pParam);
- }
- default:
- break;
- }
- int32_t iRet =
- pWidgetAcc->ProcessEvent(gs_EventActivity[pParam->m_eType], pParam);
- return iRet;
-}
-int32_t CXFA_FFDocView::ExecEventActivityByDeepFirst(CXFA_Node* pFormNode,
- XFA_EVENTTYPE eEventType,
- bool bIsFormReady,
- bool bRecursive,
- CXFA_Node* pExclude) {
- int32_t iRet = XFA_EVENTERROR_NotExist;
- if (pFormNode == pExclude) {
- return iRet;
- }
- XFA_Element elementType = pFormNode->GetElementType();
- if (elementType == XFA_Element::Field) {
- if (eEventType == XFA_EVENT_IndexChange) {
- return iRet;
- }
- CXFA_WidgetAcc* pWidgetAcc = (CXFA_WidgetAcc*)pFormNode->GetWidgetData();
- if (!pWidgetAcc) {
- return iRet;
- }
- CXFA_EventParam eParam;
- eParam.m_eType = eEventType;
- eParam.m_pTarget = pWidgetAcc;
- eParam.m_bIsFormReady = bIsFormReady;
- return XFA_ProcessEvent(this, pWidgetAcc, &eParam);
- }
- if (bRecursive) {
- for (CXFA_Node* pNode = pFormNode->GetNodeItem(
- XFA_NODEITEM_FirstChild, XFA_ObjectType::ContainerNode);
- pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling,
- XFA_ObjectType::ContainerNode)) {
- elementType = pNode->GetElementType();
- if (elementType != XFA_Element::Variables &&
- elementType != XFA_Element::Draw) {
- iRet |= ExecEventActivityByDeepFirst(pNode, eEventType, bIsFormReady,
- bRecursive, pExclude);
- }
- }
- }
- CXFA_WidgetAcc* pWidgetAcc = (CXFA_WidgetAcc*)pFormNode->GetWidgetData();
- if (!pWidgetAcc) {
- return iRet;
- }
- CXFA_EventParam eParam;
- eParam.m_eType = eEventType;
- eParam.m_pTarget = pWidgetAcc;
- eParam.m_bIsFormReady = bIsFormReady;
- iRet |= XFA_ProcessEvent(this, pWidgetAcc, &eParam);
- return iRet;
-}
-
-CXFA_FFWidget* CXFA_FFDocView::GetWidgetByName(const CFX_WideString& wsName,
- CXFA_FFWidget* pRefWidget) {
- CXFA_WidgetAcc* pRefAcc = pRefWidget ? pRefWidget->GetDataAcc() : nullptr;
- CXFA_WidgetAcc* pAcc = GetWidgetAccByName(wsName, pRefAcc);
- return pAcc ? pAcc->GetNextWidget(nullptr) : nullptr;
-}
-
-CXFA_WidgetAcc* CXFA_FFDocView::GetWidgetAccByName(
- const CFX_WideString& wsName,
- CXFA_WidgetAcc* pRefWidgetAcc) {
- CFX_WideString wsExpression;
- uint32_t dwStyle = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties |
- XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent;
- CXFA_ScriptContext* pScriptContext = m_pDoc->GetXFADoc()->GetScriptContext();
- if (!pScriptContext) {
- return nullptr;
- }
- CXFA_Node* refNode = nullptr;
- if (pRefWidgetAcc) {
- refNode = pRefWidgetAcc->GetNode();
- wsExpression = wsName;
- } else {
- wsExpression = L"$form." + wsName;
- }
- XFA_RESOLVENODE_RS resoveNodeRS;
- int32_t iRet = pScriptContext->ResolveObjects(
- refNode, wsExpression.AsStringC(), resoveNodeRS, dwStyle);
- if (iRet < 1) {
- return nullptr;
- }
- if (resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) {
- CXFA_Node* pNode = resoveNodeRS.nodes[0]->AsNode();
- if (pNode) {
- return (CXFA_WidgetAcc*)pNode->GetWidgetData();
- }
- }
- return nullptr;
-}
-
-void CXFA_FFDocView::OnPageEvent(CXFA_ContainerLayoutItem* pSender,
- uint32_t dwEvent) {
- CXFA_FFPageView* pFFPageView = static_cast<CXFA_FFPageView*>(pSender);
- m_pDoc->GetDocEnvironment()->PageViewEvent(pFFPageView, dwEvent);
-}
-
-void CXFA_FFDocView::LockUpdate() {
- m_iLock++;
-}
-void CXFA_FFDocView::UnlockUpdate() {
- m_iLock--;
-}
-bool CXFA_FFDocView::IsUpdateLocked() {
- return m_iLock > 0;
-}
-void CXFA_FFDocView::ClearInvalidateList() {
- m_mapPageInvalidate.clear();
-}
-void CXFA_FFDocView::AddInvalidateRect(CXFA_FFWidget* pWidget,
- const CFX_RectF& rtInvalidate) {
- AddInvalidateRect(pWidget->GetPageView(), rtInvalidate);
-}
-
-void CXFA_FFDocView::AddInvalidateRect(CXFA_FFPageView* pPageView,
- const CFX_RectF& rtInvalidate) {
- if (m_mapPageInvalidate[pPageView]) {
- m_mapPageInvalidate[pPageView]->Union(rtInvalidate);
- return;
- }
- m_mapPageInvalidate[pPageView] = pdfium::MakeUnique<CFX_RectF>(rtInvalidate);
-}
-
-void CXFA_FFDocView::RunInvalidate() {
- for (const auto& pair : m_mapPageInvalidate)
- m_pDoc->GetDocEnvironment()->InvalidateRect(pair.first, *pair.second, 0);
- m_mapPageInvalidate.clear();
-}
-
-bool CXFA_FFDocView::RunLayout() {
- LockUpdate();
- m_bInLayoutStatus = true;
- if (!m_pXFADocLayout->IncrementLayout() &&
- m_pXFADocLayout->StartLayout() < 100) {
- m_pXFADocLayout->DoLayout();
- UnlockUpdate();
- m_bInLayoutStatus = false;
- m_pDoc->GetDocEnvironment()->PageViewEvent(nullptr,
- XFA_PAGEVIEWEVENT_StopLayout);
- return true;
- }
- m_bInLayoutStatus = false;
- m_pDoc->GetDocEnvironment()->PageViewEvent(nullptr,
- XFA_PAGEVIEWEVENT_StopLayout);
- UnlockUpdate();
- return false;
-}
-
-void CXFA_FFDocView::RunSubformIndexChange() {
- for (CXFA_Node* pSubformNode : m_IndexChangedSubforms) {
- CXFA_WidgetAcc* pWidgetAcc =
- static_cast<CXFA_WidgetAcc*>(pSubformNode->GetWidgetData());
- if (!pWidgetAcc)
- continue;
-
- CXFA_EventParam eParam;
- eParam.m_eType = XFA_EVENT_IndexChange;
- eParam.m_pTarget = pWidgetAcc;
- pWidgetAcc->ProcessEvent(XFA_ATTRIBUTEENUM_IndexChange, &eParam);
- }
- m_IndexChangedSubforms.clear();
-}
-
-void CXFA_FFDocView::AddNewFormNode(CXFA_Node* pNode) {
- m_NewAddedNodes.push_back(pNode);
- InitLayout(pNode);
-}
-
-void CXFA_FFDocView::AddIndexChangedSubform(CXFA_Node* pNode) {
- ASSERT(pNode->GetElementType() == XFA_Element::Subform);
- m_IndexChangedSubforms.push_back(pNode);
-}
-
-void CXFA_FFDocView::RunDocClose() {
- CXFA_Node* pRootItem =
- ToNode(m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form));
- if (!pRootItem) {
- return;
- }
- ExecEventActivityByDeepFirst(pRootItem, XFA_EVENT_DocClose, false, true,
- nullptr);
-}
-void CXFA_FFDocView::DestroyDocView() {
- ClearInvalidateList();
- m_iStatus = XFA_DOCVIEW_LAYOUTSTATUS_None;
- m_iLock = 0;
- m_ValidateAccs.clear();
- m_BindItems.clear();
- m_CalculateAccs.clear();
-}
-bool CXFA_FFDocView::IsStaticNotify() {
- return m_pDoc->GetDocType() == XFA_DOCTYPE_Static;
-}
-
-void CXFA_FFDocView::AddCalculateWidgetAcc(CXFA_WidgetAcc* pWidgetAcc) {
- CXFA_WidgetAcc* pCurrentAcc =
- !m_CalculateAccs.empty() ? m_CalculateAccs.back() : nullptr;
- if (pCurrentAcc != pWidgetAcc)
- m_CalculateAccs.push_back(pWidgetAcc);
-}
-
-void CXFA_FFDocView::AddCalculateNodeNotify(CXFA_Node* pNodeChange) {
- auto pGlobalData =
- static_cast<CXFA_CalcData*>(pNodeChange->GetUserData(XFA_CalcData));
- if (!pGlobalData)
- return;
-
- for (const auto& pResultAcc : pGlobalData->m_Globals) {
- if (!pResultAcc->GetNode()->HasRemovedChildren())
- AddCalculateWidgetAcc(pResultAcc);
- }
-}
-
-void CXFA_FFDocView::RunCalculateRecursive(int32_t& iIndex) {
- while (iIndex < pdfium::CollectionSize<int32_t>(m_CalculateAccs)) {
- CXFA_WidgetAcc* pCurAcc = m_CalculateAccs[iIndex];
- AddCalculateNodeNotify(pCurAcc->GetNode());
- int32_t iRefCount =
- (int32_t)(uintptr_t)pCurAcc->GetNode()->GetUserData(XFA_CalcRefCount);
- iRefCount++;
- pCurAcc->GetNode()->SetUserData(XFA_CalcRefCount,
- (void*)(uintptr_t)iRefCount);
- if (iRefCount > 11) {
- break;
- }
- if ((pCurAcc->ProcessCalculate()) == XFA_EVENTERROR_Success) {
- AddValidateWidget(pCurAcc);
- }
- iIndex++;
- RunCalculateRecursive(iIndex);
- }
-}
-
-int32_t CXFA_FFDocView::RunCalculateWidgets() {
- if (!m_pDoc->GetDocEnvironment()->IsCalculationsEnabled(m_pDoc)) {
- return XFA_EVENTERROR_Disabled;
- }
- int32_t iCounts = pdfium::CollectionSize<int32_t>(m_CalculateAccs);
- int32_t iIndex = 0;
- if (iCounts > 0)
- RunCalculateRecursive(iIndex);
-
- for (CXFA_WidgetAcc* pCurAcc : m_CalculateAccs)
- pCurAcc->GetNode()->SetUserData(XFA_CalcRefCount, (void*)(uintptr_t)0);
-
- m_CalculateAccs.clear();
- return XFA_EVENTERROR_Success;
-}
-
-void CXFA_FFDocView::AddValidateWidget(CXFA_WidgetAcc* pWidget) {
- if (!pdfium::ContainsValue(m_ValidateAccs, pWidget))
- m_ValidateAccs.push_back(pWidget);
-}
-
-bool CXFA_FFDocView::InitCalculate(CXFA_Node* pNode) {
- ExecEventActivityByDeepFirst(pNode, XFA_EVENT_InitCalculate, false, true,
- nullptr);
- return true;
-}
-
-bool CXFA_FFDocView::InitValidate(CXFA_Node* pNode) {
- if (!m_pDoc->GetDocEnvironment()->IsValidationsEnabled(m_pDoc))
- return false;
-
- ExecEventActivityByDeepFirst(pNode, XFA_EVENT_Validate, false, true, nullptr);
- m_ValidateAccs.clear();
- return true;
-}
-
-bool CXFA_FFDocView::RunValidate() {
- if (!m_pDoc->GetDocEnvironment()->IsValidationsEnabled(m_pDoc))
- return false;
-
- for (CXFA_WidgetAcc* pAcc : m_ValidateAccs) {
- if (!pAcc->GetNode()->HasRemovedChildren())
- pAcc->ProcessValidate();
- }
- m_ValidateAccs.clear();
- return true;
-}
-bool CXFA_FFDocView::RunEventLayoutReady() {
- CXFA_Node* pRootItem =
- ToNode(m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form));
- if (!pRootItem) {
- return false;
- }
- ExecEventActivityByDeepFirst(pRootItem, XFA_EVENT_Ready, false, true,
- nullptr);
- RunLayout();
- return true;
-}
-void CXFA_FFDocView::RunBindItems() {
- for (const auto& item : m_BindItems) {
- if (item->HasRemovedChildren())
- continue;
-
- CXFA_Node* pWidgetNode = item->GetNodeItem(XFA_NODEITEM_Parent);
- CXFA_WidgetAcc* pAcc =
- static_cast<CXFA_WidgetAcc*>(pWidgetNode->GetWidgetData());
- if (!pAcc)
- continue;
-
- CXFA_BindItems binditems(item);
- CXFA_ScriptContext* pScriptContext =
- pWidgetNode->GetDocument()->GetScriptContext();
- CFX_WideStringC wsRef;
- binditems.GetRef(wsRef);
- uint32_t dwStyle = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties |
- XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent |
- XFA_RESOLVENODE_ALL;
- XFA_RESOLVENODE_RS rs;
- pScriptContext->ResolveObjects(pWidgetNode, wsRef, rs, dwStyle);
- int32_t iCount = rs.nodes.GetSize();
- pAcc->DeleteItem(-1);
- if (rs.dwFlags != XFA_RESOVENODE_RSTYPE_Nodes || iCount < 1)
- continue;
-
- CFX_WideStringC wsValueRef, wsLabelRef;
- binditems.GetValueRef(wsValueRef);
- binditems.GetLabelRef(wsLabelRef);
- const bool bUseValue = wsLabelRef.IsEmpty() || wsLabelRef == wsValueRef;
- const bool bLabelUseContent = wsLabelRef.IsEmpty() || wsLabelRef == L"$";
- const bool bValueUseContent = wsValueRef.IsEmpty() || wsValueRef == L"$";
- CFX_WideString wsValue;
- CFX_WideString wsLabel;
- uint32_t uValueHash = FX_HashCode_GetW(wsValueRef, false);
- for (int32_t j = 0; j < iCount; j++) {
- CXFA_Object* refObj = rs.nodes[j];
- if (!refObj->IsNode()) {
- continue;
- }
- CXFA_Node* refNode = refObj->AsNode();
- if (bValueUseContent) {
- wsValue = refNode->GetContent();
- } else {
- CXFA_Node* nodeValue = refNode->GetFirstChildByName(uValueHash);
- wsValue = nodeValue ? nodeValue->GetContent() : refNode->GetContent();
- }
- if (!bUseValue) {
- if (bLabelUseContent) {
- wsLabel = refNode->GetContent();
- } else {
- CXFA_Node* nodeLabel = refNode->GetFirstChildByName(wsLabelRef);
- if (nodeLabel)
- wsLabel = nodeLabel->GetContent();
- }
- } else {
- wsLabel = wsValue;
- }
- pAcc->InsertItem(wsLabel, wsValue);
- }
- }
- m_BindItems.clear();
-}
-void CXFA_FFDocView::SetChangeMark() {
- if (m_iStatus < XFA_DOCVIEW_LAYOUTSTATUS_End) {
- return;
- }
- m_pDoc->GetDocEnvironment()->SetChangeMark(m_pDoc);
-}
-CXFA_Node* CXFA_FFDocView::GetRootSubform() {
- CXFA_Node* pFormPacketNode =
- ToNode(m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form));
- if (!pFormPacketNode) {
- return nullptr;
- }
- return pFormPacketNode->GetFirstChildByClass(XFA_Element::Subform);
-}
-
-CXFA_WidgetAccIterator::CXFA_WidgetAccIterator(CXFA_FFDocView* pDocView,
- CXFA_Node* pTravelRoot)
- : m_ContentIterator(pTravelRoot),
- m_pDocView(pDocView),
- m_pCurWidgetAcc(nullptr) {}
-
-CXFA_WidgetAccIterator::~CXFA_WidgetAccIterator() {}
-void CXFA_WidgetAccIterator::Reset() {
- m_pCurWidgetAcc = nullptr;
- m_ContentIterator.Reset();
-}
-
-CXFA_WidgetAcc* CXFA_WidgetAccIterator::MoveToFirst() {
- return nullptr;
-}
-
-CXFA_WidgetAcc* CXFA_WidgetAccIterator::MoveToLast() {
- return nullptr;
-}
-
-CXFA_WidgetAcc* CXFA_WidgetAccIterator::MoveToNext() {
- CXFA_Node* pItem = m_pCurWidgetAcc ? m_ContentIterator.MoveToNext()
- : m_ContentIterator.GetCurrent();
- while (pItem) {
- m_pCurWidgetAcc = static_cast<CXFA_WidgetAcc*>(pItem->GetWidgetData());
- if (m_pCurWidgetAcc)
- return m_pCurWidgetAcc;
- pItem = m_ContentIterator.MoveToNext();
- }
- return nullptr;
-}
-
-CXFA_WidgetAcc* CXFA_WidgetAccIterator::MoveToPrevious() {
- return nullptr;
-}
-
-CXFA_WidgetAcc* CXFA_WidgetAccIterator::GetCurrentWidgetAcc() {
- return nullptr;
-}
-
-bool CXFA_WidgetAccIterator::SetCurrentWidgetAcc(CXFA_WidgetAcc* hWidget) {
- return false;
-}
-
-void CXFA_WidgetAccIterator::SkipTree() {
- m_ContentIterator.SkipChildrenAndMoveToNext();
- m_pCurWidgetAcc = nullptr;
-}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffdraw.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffdraw.cpp
index 37095ddb49b..8742b83c5bf 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffdraw.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffdraw.cpp
@@ -6,10 +6,10 @@
#include "xfa/fxfa/app/xfa_ffdraw.h"
-#include "xfa/fxfa/xfa_ffapp.h"
-#include "xfa/fxfa/xfa_ffdoc.h"
-#include "xfa/fxfa/xfa_ffpageview.h"
-#include "xfa/fxfa/xfa_ffwidget.h"
+#include "xfa/fxfa/cxfa_ffapp.h"
+#include "xfa/fxfa/cxfa_ffdoc.h"
+#include "xfa/fxfa/cxfa_ffpageview.h"
+#include "xfa/fxfa/cxfa_ffwidget.h"
CXFA_FFDraw::CXFA_FFDraw(CXFA_WidgetAcc* pDataAcc) : CXFA_FFWidget(pDataAcc) {}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffdraw.h b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffdraw.h
index 0212dcca0a7..bcd74f204c8 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffdraw.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffdraw.h
@@ -7,8 +7,8 @@
#ifndef XFA_FXFA_APP_XFA_FFDRAW_H_
#define XFA_FXFA_APP_XFA_FFDRAW_H_
-#include "xfa/fxfa/xfa_ffpageview.h"
-#include "xfa/fxfa/xfa_ffwidget.h"
+#include "xfa/fxfa/cxfa_ffpageview.h"
+#include "xfa/fxfa/cxfa_ffwidget.h"
class CXFA_FFDraw : public CXFA_FFWidget {
public:
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffexclgroup.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffexclgroup.cpp
index 7d63daddbc7..9f2560f82fb 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffexclgroup.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffexclgroup.cpp
@@ -6,10 +6,10 @@
#include "xfa/fxfa/app/xfa_ffexclgroup.h"
-#include "xfa/fxfa/xfa_ffapp.h"
-#include "xfa/fxfa/xfa_ffdoc.h"
-#include "xfa/fxfa/xfa_ffpageview.h"
-#include "xfa/fxfa/xfa_ffwidget.h"
+#include "xfa/fxfa/cxfa_ffapp.h"
+#include "xfa/fxfa/cxfa_ffdoc.h"
+#include "xfa/fxfa/cxfa_ffpageview.h"
+#include "xfa/fxfa/cxfa_ffwidget.h"
CXFA_FFExclGroup::CXFA_FFExclGroup(CXFA_WidgetAcc* pDataAcc)
: CXFA_FFWidget(pDataAcc) {}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffexclgroup.h b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffexclgroup.h
index 12a13aea92c..a14894566c4 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffexclgroup.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffexclgroup.h
@@ -7,8 +7,8 @@
#ifndef XFA_FXFA_APP_XFA_FFEXCLGROUP_H_
#define XFA_FXFA_APP_XFA_FFEXCLGROUP_H_
-#include "xfa/fxfa/xfa_ffpageview.h"
-#include "xfa/fxfa/xfa_ffwidget.h"
+#include "xfa/fxfa/cxfa_ffpageview.h"
+#include "xfa/fxfa/cxfa_ffwidget.h"
class CXFA_FFExclGroup : public CXFA_FFWidget {
public:
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fffield.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fffield.cpp
index 630d04311fb..4193af82b48 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fffield.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fffield.cpp
@@ -17,11 +17,12 @@
#include "xfa/fwl/cfwl_widgetmgr.h"
#include "xfa/fxfa/app/cxfa_textlayout.h"
#include "xfa/fxfa/app/xfa_fwltheme.h"
-#include "xfa/fxfa/xfa_ffapp.h"
-#include "xfa/fxfa/xfa_ffdoc.h"
-#include "xfa/fxfa/xfa_ffdocview.h"
-#include "xfa/fxfa/xfa_ffpageview.h"
-#include "xfa/fxfa/xfa_ffwidget.h"
+#include "xfa/fxfa/cxfa_ffapp.h"
+#include "xfa/fxfa/cxfa_ffdoc.h"
+#include "xfa/fxfa/cxfa_ffdocview.h"
+#include "xfa/fxfa/cxfa_ffpageview.h"
+#include "xfa/fxfa/cxfa_ffwidget.h"
+#include "xfa/fxfa/parser/cxfa_node.h"
#include "xfa/fxgraphics/cfx_color.h"
#include "xfa/fxgraphics/cfx_path.h"
@@ -94,7 +95,7 @@ void CXFA_FFField::DrawFocus(CFX_Graphics* pGS, CFX_Matrix* pMatrix) {
if (m_dwStatus & XFA_WidgetStatus_Focused) {
CFX_Color cr(0xFF000000);
pGS->SetStrokeColor(&cr);
- FX_FLOAT DashPattern[2] = {1, 1};
+ float DashPattern[2] = {1, 1};
pGS->SetLineDash(0.0f, DashPattern, 2);
pGS->SetLineWidth(0, false);
@@ -124,7 +125,7 @@ void CXFA_FFField::SetEditScrollOffset() {
XFA_Element eType = m_pDataAcc->GetUIType();
if (eType == XFA_Element::TextEdit || eType == XFA_Element::NumericEdit ||
eType == XFA_Element::PasswordEdit) {
- FX_FLOAT fScrollOffset = 0;
+ float fScrollOffset = 0;
CXFA_FFField* pPrev = static_cast<CXFA_FFField*>(GetPrev());
if (pPrev) {
CFX_RectF rtMargin = m_pDataAcc->GetUIMargin();
@@ -153,7 +154,7 @@ void CXFA_FFField::CapPlacement() {
CXFA_Margin mgWidget = m_pDataAcc->GetMargin();
if (mgWidget) {
CXFA_LayoutItem* pItem = this;
- FX_FLOAT fLeftInset = 0, fRightInset = 0, fTopInset = 0, fBottomInset = 0;
+ float fLeftInset = 0, fRightInset = 0, fTopInset = 0, fBottomInset = 0;
mgWidget.GetLeftInset(fLeftInset);
mgWidget.GetRightInset(fRightInset);
mgWidget.GetTopInset(fTopInset);
@@ -171,7 +172,7 @@ void CXFA_FFField::CapPlacement() {
}
XFA_ATTRIBUTEENUM iCapPlacement = XFA_ATTRIBUTEENUM_Unknown;
- FX_FLOAT fCapReserve = 0;
+ float fCapReserve = 0;
CXFA_Caption caption = m_pDataAcc->GetCaption();
if (caption && caption.GetPresence() != XFA_ATTRIBUTEENUM_Hidden) {
iCapPlacement = (XFA_ATTRIBUTEENUM)caption.GetPlacementType();
@@ -260,8 +261,8 @@ void CXFA_FFField::CapTopBottomPlacement(CXFA_Caption caption,
m_rtCaption.top += m_rtCaption.height;
}
}
- FX_FLOAT fWidth = rtUIMargin.left + rtUIMargin.width;
- FX_FLOAT fHeight = m_rtCaption.height + rtUIMargin.top + rtUIMargin.height;
+ float fWidth = rtUIMargin.left + rtUIMargin.width;
+ float fHeight = m_rtCaption.height + rtUIMargin.top + rtUIMargin.height;
if (fWidth > rtWidget.width) {
m_rtUI.width += fWidth - rtWidget.width;
}
@@ -287,8 +288,8 @@ void CXFA_FFField::CapLeftRightPlacement(CXFA_Caption caption,
m_rtCaption.top += m_rtCaption.height;
}
}
- FX_FLOAT fWidth = m_rtCaption.width + rtUIMargin.left + rtUIMargin.width;
- FX_FLOAT fHeight = rtUIMargin.top + rtUIMargin.height;
+ float fWidth = m_rtCaption.width + rtUIMargin.left + rtUIMargin.width;
+ float fHeight = rtUIMargin.top + rtUIMargin.height;
if (fWidth > rtWidget.width) {
m_rtUI.width += fWidth - rtWidget.width;
if (iCapPlacement == XFA_ATTRIBUTEENUM_Right) {
@@ -323,7 +324,7 @@ void CXFA_FFField::SetFWLRect() {
if (rtUi.width < 1.0)
rtUi.width = 1.0;
if (!m_pDataAcc->GetDoc()->GetXFADoc()->IsInteractive()) {
- FX_FLOAT fFontSize = m_pDataAcc->GetFontSize();
+ float fFontSize = m_pDataAcc->GetFontSize();
if (rtUi.height < fFontSize) {
rtUi.height = fFontSize;
}
@@ -563,7 +564,7 @@ void CXFA_FFField::LayoutCaption() {
if (!pCapTextLayout)
return;
- FX_FLOAT fHeight = 0;
+ float fHeight = 0;
pCapTextLayout->Layout(CFX_SizeF(m_rtCaption.width, m_rtCaption.height),
&fHeight);
if (m_rtCaption.height < fHeight)
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fffield.h b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fffield.h
index f10ce617388..0e9ac8661c2 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fffield.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fffield.h
@@ -9,8 +9,8 @@
#include "xfa/fwl/cfwl_widget.h"
#include "xfa/fwl/ifwl_widgetdelegate.h"
-#include "xfa/fxfa/xfa_ffpageview.h"
-#include "xfa/fxfa/xfa_ffwidget.h"
+#include "xfa/fxfa/cxfa_ffpageview.h"
+#include "xfa/fxfa/cxfa_ffwidget.h"
#define XFA_MINUI_HEIGHT 4.32f
#define XFA_DEFAULTUI_HEIGHT 2.0f
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffimage.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffimage.cpp
index a613221ea63..23ed88616d8 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffimage.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffimage.cpp
@@ -7,10 +7,10 @@
#include "xfa/fxfa/app/xfa_ffimage.h"
#include "xfa/fxfa/app/xfa_ffdraw.h"
-#include "xfa/fxfa/xfa_ffapp.h"
-#include "xfa/fxfa/xfa_ffdoc.h"
-#include "xfa/fxfa/xfa_ffpageview.h"
-#include "xfa/fxfa/xfa_ffwidget.h"
+#include "xfa/fxfa/cxfa_ffapp.h"
+#include "xfa/fxfa/cxfa_ffdoc.h"
+#include "xfa/fxfa/cxfa_ffpageview.h"
+#include "xfa/fxfa/cxfa_ffwidget.h"
CXFA_FFImage::CXFA_FFImage(CXFA_WidgetAcc* pDataAcc) : CXFA_FFDraw(pDataAcc) {}
@@ -43,7 +43,7 @@ void CXFA_FFImage::RenderWidget(CFX_Graphics* pGS,
CXFA_FFWidget::RenderWidget(pGS, &mtRotate, dwStatus);
- CFX_DIBitmap* pDIBitmap = GetDataAcc()->GetImageImage();
+ CFX_RetainPtr<CFX_DIBitmap> pDIBitmap = GetDataAcc()->GetImageImage();
if (!pDIBitmap)
return;
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffimageedit.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffimageedit.cpp
index 01d29eed419..624ef3f4426 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffimageedit.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffimageedit.cpp
@@ -11,10 +11,10 @@
#include "xfa/fwl/cfwl_notedriver.h"
#include "xfa/fwl/cfwl_picturebox.h"
#include "xfa/fxfa/app/xfa_fffield.h"
-#include "xfa/fxfa/xfa_ffdoc.h"
-#include "xfa/fxfa/xfa_ffdocview.h"
-#include "xfa/fxfa/xfa_ffpageview.h"
-#include "xfa/fxfa/xfa_ffwidget.h"
+#include "xfa/fxfa/cxfa_ffdoc.h"
+#include "xfa/fxfa/cxfa_ffdocview.h"
+#include "xfa/fxfa/cxfa_ffpageview.h"
+#include "xfa/fxfa/cxfa_ffwidget.h"
CXFA_FFImageEdit::CXFA_FFImageEdit(CXFA_WidgetAcc* pDataAcc)
: CXFA_FFField(pDataAcc), m_pOldDelegate(nullptr) {}
@@ -60,7 +60,7 @@ void CXFA_FFImageEdit::RenderWidget(CFX_Graphics* pGS,
CXFA_Border borderUI = m_pDataAcc->GetUIBorder();
DrawBorder(pGS, borderUI, m_rtUI, &mtRotate);
RenderCaption(pGS, &mtRotate);
- CFX_DIBitmap* pDIBitmap = m_pDataAcc->GetImageEditImage();
+ CFX_RetainPtr<CFX_DIBitmap> pDIBitmap = m_pDataAcc->GetImageEditImage();
if (!pDIBitmap)
return;
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffimageedit.h b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffimageedit.h
index 73032b98150..ee91a772e00 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffimageedit.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffimageedit.h
@@ -26,7 +26,7 @@ class CXFA_FFImageEdit : public CXFA_FFField {
void OnDrawWidget(CFX_Graphics* pGraphics,
const CFX_Matrix* pMatrix = nullptr) override;
- protected:
+ private:
void SetFWLRect() override;
bool UpdateFWLData() override;
bool CommitData() override;
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffnotify.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffnotify.cpp
index 951b4fd3f1d..d9ec99aba9f 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffnotify.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffnotify.cpp
@@ -24,12 +24,13 @@
#include "xfa/fxfa/app/xfa_fftextedit.h"
#include "xfa/fxfa/app/xfa_ffwidgetacc.h"
#include "xfa/fxfa/app/xfa_fwladapter.h"
-#include "xfa/fxfa/xfa_ffapp.h"
-#include "xfa/fxfa/xfa_ffdoc.h"
-#include "xfa/fxfa/xfa_ffdocview.h"
-#include "xfa/fxfa/xfa_ffpageview.h"
-#include "xfa/fxfa/xfa_ffwidget.h"
-#include "xfa/fxfa/xfa_ffwidgethandler.h"
+#include "xfa/fxfa/cxfa_ffapp.h"
+#include "xfa/fxfa/cxfa_ffdoc.h"
+#include "xfa/fxfa/cxfa_ffdocview.h"
+#include "xfa/fxfa/cxfa_ffpageview.h"
+#include "xfa/fxfa/cxfa_ffwidget.h"
+#include "xfa/fxfa/cxfa_ffwidgethandler.h"
+#include "xfa/fxfa/parser/cxfa_node.h"
static void XFA_FFDeleteWidgetAcc(void* pData) {
delete static_cast<CXFA_WidgetAcc*>(pData);
@@ -49,8 +50,8 @@ void CXFA_FFNotify::OnPageEvent(CXFA_ContainerLayoutItem* pSender,
}
void CXFA_FFNotify::OnWidgetListItemAdded(CXFA_WidgetData* pSender,
- const FX_WCHAR* pLabel,
- const FX_WCHAR* pValue,
+ const wchar_t* pLabel,
+ const wchar_t* pValue,
int32_t iIndex) {
CXFA_WidgetAcc* pWidgetAcc = static_cast<CXFA_WidgetAcc*>(pSender);
if (pWidgetAcc->GetUIType() != XFA_Element::ChoiceList)
@@ -171,8 +172,8 @@ CXFA_LayoutItem* CXFA_FFNotify::OnCreateLayoutItem(CXFA_Node* pNode) {
}
void CXFA_FFNotify::StartFieldDrawLayout(CXFA_Node* pItem,
- FX_FLOAT& fCalcWidth,
- FX_FLOAT& fCalcHeight) {
+ float& fCalcWidth,
+ float& fCalcHeight) {
CXFA_WidgetAcc* pAcc = static_cast<CXFA_WidgetAcc*>(pItem->GetWidgetData());
if (!pAcc)
return;
@@ -182,7 +183,7 @@ void CXFA_FFNotify::StartFieldDrawLayout(CXFA_Node* pItem,
bool CXFA_FFNotify::FindSplitPos(CXFA_Node* pItem,
int32_t iBlockIndex,
- FX_FLOAT& fCalcHeightPos) {
+ float& fCalcHeightPos) {
CXFA_WidgetAcc* pAcc = static_cast<CXFA_WidgetAcc*>(pItem->GetWidgetData());
return pAcc && pAcc->FindSplitPos(iBlockIndex, fCalcHeightPos);
}
@@ -262,8 +263,9 @@ void CXFA_FFNotify::OpenDropDownList(CXFA_FFWidget* hWidget) {
pDocView->UpdateDocView();
}
CFX_WideString CXFA_FFNotify::GetCurrentDateTime() {
- CFX_Unitime dataTime;
+ CFX_DateTime dataTime;
dataTime.Now();
+
CFX_WideString wsDateTime;
wsDateTime.Format(L"%d%02d%02dT%02d%02d%02d", dataTime.GetYear(),
dataTime.GetMonth(), dataTime.GetDay(), dataTime.GetHour(),
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffnotify.h b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffnotify.h
index 1bfaffec896..c002ed4c156 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffnotify.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffnotify.h
@@ -20,8 +20,8 @@ class CXFA_FFNotify {
void OnPageEvent(CXFA_ContainerLayoutItem* pSender, uint32_t dwEvent);
void OnWidgetListItemAdded(CXFA_WidgetData* pSender,
- const FX_WCHAR* pLabel,
- const FX_WCHAR* pValue,
+ const wchar_t* pLabel,
+ const wchar_t* pValue,
int32_t iIndex);
void OnWidgetListItemRemoved(CXFA_WidgetData* pSender, int32_t iIndex);
@@ -44,11 +44,11 @@ class CXFA_FFNotify {
CXFA_LayoutItem* pSender);
void StartFieldDrawLayout(CXFA_Node* pItem,
- FX_FLOAT& fCalcWidth,
- FX_FLOAT& fCalcHeight);
+ float& fCalcWidth,
+ float& fCalcHeight);
bool FindSplitPos(CXFA_Node* pItem,
int32_t iBlockIndex,
- FX_FLOAT& fCalcHeightPos);
+ float& fCalcHeightPos);
bool RunScript(CXFA_Node* pScript, CXFA_Node* pFormItem);
int32_t ExecEventByDeepFirst(CXFA_Node* pFormNode,
XFA_EVENTTYPE eEventType,
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffpageview.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffpageview.cpp
deleted file mode 100644
index 7ae5493ba60..00000000000
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffpageview.cpp
+++ /dev/null
@@ -1,468 +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
-
-#include "xfa/fxfa/xfa_ffpageview.h"
-
-#include <memory>
-#include <vector>
-
-#include "third_party/base/ptr_util.h"
-#include "third_party/base/stl_util.h"
-#include "xfa/fde/fde_render.h"
-#include "xfa/fxfa/app/xfa_ffcheckbutton.h"
-#include "xfa/fxfa/app/xfa_ffchoicelist.h"
-#include "xfa/fxfa/app/xfa_fffield.h"
-#include "xfa/fxfa/app/xfa_ffimageedit.h"
-#include "xfa/fxfa/app/xfa_ffpushbutton.h"
-#include "xfa/fxfa/app/xfa_fftextedit.h"
-#include "xfa/fxfa/app/xfa_fwladapter.h"
-#include "xfa/fxfa/xfa_ffdoc.h"
-#include "xfa/fxfa/xfa_ffdocview.h"
-#include "xfa/fxfa/xfa_ffwidget.h"
-
-namespace {
-
-CFX_Matrix GetPageMatrix(const CFX_RectF& docPageRect,
- const CFX_Rect& devicePageRect,
- int32_t iRotate,
- uint32_t dwCoordinatesType) {
- ASSERT(iRotate >= 0 && iRotate <= 3);
-
- bool bFlipX = (dwCoordinatesType & 0x01) != 0;
- bool bFlipY = (dwCoordinatesType & 0x02) != 0;
- CFX_Matrix m((bFlipX ? -1.0f : 1.0f), 0, 0, (bFlipY ? -1.0f : 1.0f), 0, 0);
- if (iRotate == 0 || iRotate == 2) {
- m.a *= (FX_FLOAT)devicePageRect.width / docPageRect.width;
- m.d *= (FX_FLOAT)devicePageRect.height / docPageRect.height;
- } else {
- m.a *= (FX_FLOAT)devicePageRect.height / docPageRect.width;
- m.d *= (FX_FLOAT)devicePageRect.width / docPageRect.height;
- }
- m.Rotate(iRotate * 1.57079632675f);
- switch (iRotate) {
- case 0:
- m.e = bFlipX ? (FX_FLOAT)devicePageRect.right()
- : (FX_FLOAT)devicePageRect.left;
- m.f = bFlipY ? (FX_FLOAT)devicePageRect.bottom()
- : (FX_FLOAT)devicePageRect.top;
- break;
- case 1:
- m.e = bFlipY ? (FX_FLOAT)devicePageRect.left
- : (FX_FLOAT)devicePageRect.right();
- m.f = bFlipX ? (FX_FLOAT)devicePageRect.bottom()
- : (FX_FLOAT)devicePageRect.top;
- break;
- case 2:
- m.e = bFlipX ? (FX_FLOAT)devicePageRect.left
- : (FX_FLOAT)devicePageRect.right();
- m.f = bFlipY ? (FX_FLOAT)devicePageRect.top
- : (FX_FLOAT)devicePageRect.bottom();
- break;
- case 3:
- m.e = bFlipY ? (FX_FLOAT)devicePageRect.right()
- : (FX_FLOAT)devicePageRect.left;
- m.f = bFlipX ? (FX_FLOAT)devicePageRect.top
- : (FX_FLOAT)devicePageRect.bottom();
- break;
- default:
- break;
- }
- return m;
-}
-
-bool PageWidgetFilter(CXFA_FFWidget* pWidget,
- uint32_t dwFilter,
- bool bTraversal,
- bool bIgnorerelevant) {
- CXFA_WidgetAcc* pWidgetAcc = pWidget->GetDataAcc();
-
- if (!!(dwFilter & XFA_WidgetStatus_Focused) &&
- pWidgetAcc->GetElementType() != XFA_Element::Field) {
- return false;
- }
-
- uint32_t dwStatus = pWidget->GetStatus();
- if (bTraversal && (dwStatus & XFA_WidgetStatus_Disabled))
- return false;
- if (bIgnorerelevant)
- return !!(dwStatus & XFA_WidgetStatus_Visible);
-
- dwFilter &= (XFA_WidgetStatus_Visible | XFA_WidgetStatus_Viewable |
- XFA_WidgetStatus_Printable);
- return (dwFilter & dwStatus) == dwFilter;
-}
-
-bool IsLayoutElement(XFA_Element eElement, bool bLayoutContainer) {
- switch (eElement) {
- case XFA_Element::Draw:
- case XFA_Element::Field:
- case XFA_Element::InstanceManager:
- return !bLayoutContainer;
- case XFA_Element::Area:
- case XFA_Element::Subform:
- case XFA_Element::ExclGroup:
- case XFA_Element::SubformSet:
- case XFA_Element::PageArea:
- case XFA_Element::Form:
- return true;
- default:
- return false;
- }
-}
-
-} // namespace
-
-CXFA_FFPageView::CXFA_FFPageView(CXFA_FFDocView* pDocView, CXFA_Node* pPageArea)
- : CXFA_ContainerLayoutItem(pPageArea), m_pDocView(pDocView) {}
-
-CXFA_FFPageView::~CXFA_FFPageView() {}
-
-CXFA_FFDocView* CXFA_FFPageView::GetDocView() const {
- return m_pDocView;
-}
-
-CFX_RectF CXFA_FFPageView::GetPageViewRect() const {
- return CFX_RectF(0, 0, GetPageSize());
-}
-
-CFX_Matrix CXFA_FFPageView::GetDisplayMatrix(const CFX_Rect& rtDisp,
- int32_t iRotate) const {
- return GetPageMatrix(CFX_RectF(0, 0, GetPageSize()), rtDisp, iRotate, 0);
-}
-
-IXFA_WidgetIterator* CXFA_FFPageView::CreateWidgetIterator(
- uint32_t dwTraverseWay,
- uint32_t dwWidgetFilter) {
- switch (dwTraverseWay) {
- case XFA_TRAVERSEWAY_Tranvalse:
- return new CXFA_FFTabOrderPageWidgetIterator(this, dwWidgetFilter);
- case XFA_TRAVERSEWAY_Form:
- return new CXFA_FFPageWidgetIterator(this, dwWidgetFilter);
- }
- return nullptr;
-}
-
-CXFA_FFPageWidgetIterator::CXFA_FFPageWidgetIterator(CXFA_FFPageView* pPageView,
- uint32_t dwFilter) {
- m_pPageView = pPageView;
- m_dwFilter = dwFilter;
- m_sIterator.Init(pPageView);
- m_bIgnorerelevant =
- m_pPageView->GetDocView()->GetDoc()->GetXFADoc()->GetCurVersionMode() <
- XFA_VERSION_205;
-}
-CXFA_FFPageWidgetIterator::~CXFA_FFPageWidgetIterator() {}
-void CXFA_FFPageWidgetIterator::Reset() {
- m_sIterator.Reset();
-}
-CXFA_FFWidget* CXFA_FFPageWidgetIterator::MoveToFirst() {
- m_sIterator.Reset();
- for (CXFA_LayoutItem* pLayoutItem = m_sIterator.GetCurrent(); pLayoutItem;
- pLayoutItem = m_sIterator.MoveToNext()) {
- if (CXFA_FFWidget* hWidget = GetWidget(pLayoutItem)) {
- return hWidget;
- }
- }
- return nullptr;
-}
-CXFA_FFWidget* CXFA_FFPageWidgetIterator::MoveToLast() {
- m_sIterator.SetCurrent(nullptr);
- return MoveToPrevious();
-}
-CXFA_FFWidget* CXFA_FFPageWidgetIterator::MoveToNext() {
- for (CXFA_LayoutItem* pLayoutItem = m_sIterator.MoveToNext(); pLayoutItem;
- pLayoutItem = m_sIterator.MoveToNext()) {
- if (CXFA_FFWidget* hWidget = GetWidget(pLayoutItem)) {
- return hWidget;
- }
- }
- return nullptr;
-}
-CXFA_FFWidget* CXFA_FFPageWidgetIterator::MoveToPrevious() {
- for (CXFA_LayoutItem* pLayoutItem = m_sIterator.MoveToPrev(); pLayoutItem;
- pLayoutItem = m_sIterator.MoveToPrev()) {
- if (CXFA_FFWidget* hWidget = GetWidget(pLayoutItem)) {
- return hWidget;
- }
- }
- return nullptr;
-}
-CXFA_FFWidget* CXFA_FFPageWidgetIterator::GetCurrentWidget() {
- CXFA_LayoutItem* pLayoutItem = m_sIterator.GetCurrent();
- return pLayoutItem ? XFA_GetWidgetFromLayoutItem(pLayoutItem) : nullptr;
-}
-bool CXFA_FFPageWidgetIterator::SetCurrentWidget(CXFA_FFWidget* hWidget) {
- return hWidget && m_sIterator.SetCurrent(hWidget);
-}
-CXFA_FFWidget* CXFA_FFPageWidgetIterator::GetWidget(
- CXFA_LayoutItem* pLayoutItem) {
- if (CXFA_FFWidget* pWidget = XFA_GetWidgetFromLayoutItem(pLayoutItem)) {
- if (!PageWidgetFilter(pWidget, m_dwFilter, false, m_bIgnorerelevant)) {
- return nullptr;
- }
- if (!pWidget->IsLoaded() &&
- (pWidget->GetStatus() & XFA_WidgetStatus_Visible) != 0) {
- pWidget->LoadWidget();
- }
- return pWidget;
- }
- return nullptr;
-}
-
-CXFA_FFTabOrderPageWidgetIterator::CXFA_FFTabOrderPageWidgetIterator(
- CXFA_FFPageView* pPageView,
- uint32_t dwFilter)
- : m_pPageView(pPageView), m_dwFilter(dwFilter), m_iCurWidget(-1) {
- m_bIgnorerelevant =
- m_pPageView->GetDocView()->GetDoc()->GetXFADoc()->GetCurVersionMode() <
- XFA_VERSION_205;
- Reset();
-}
-
-CXFA_FFTabOrderPageWidgetIterator::~CXFA_FFTabOrderPageWidgetIterator() {}
-
-void CXFA_FFTabOrderPageWidgetIterator::Reset() {
- CreateTabOrderWidgetArray();
- m_iCurWidget = -1;
-}
-
-CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::MoveToFirst() {
- for (int32_t i = 0;
- i < pdfium::CollectionSize<int32_t>(m_TabOrderWidgetArray); i++) {
- if (PageWidgetFilter(m_TabOrderWidgetArray[i], m_dwFilter, true,
- m_bIgnorerelevant)) {
- m_iCurWidget = i;
- return m_TabOrderWidgetArray[m_iCurWidget];
- }
- }
- return nullptr;
-}
-
-CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::MoveToLast() {
- for (int32_t i = pdfium::CollectionSize<int32_t>(m_TabOrderWidgetArray) - 1;
- i >= 0; i--) {
- if (PageWidgetFilter(m_TabOrderWidgetArray[i], m_dwFilter, true,
- m_bIgnorerelevant)) {
- m_iCurWidget = i;
- return m_TabOrderWidgetArray[m_iCurWidget];
- }
- }
- return nullptr;
-}
-
-CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::MoveToNext() {
- for (int32_t i = m_iCurWidget + 1;
- i < pdfium::CollectionSize<int32_t>(m_TabOrderWidgetArray); i++) {
- if (PageWidgetFilter(m_TabOrderWidgetArray[i], m_dwFilter, true,
- m_bIgnorerelevant)) {
- m_iCurWidget = i;
- return m_TabOrderWidgetArray[m_iCurWidget];
- }
- }
- m_iCurWidget = -1;
- return nullptr;
-}
-
-CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::MoveToPrevious() {
- for (int32_t i = m_iCurWidget - 1; i >= 0; i--) {
- if (PageWidgetFilter(m_TabOrderWidgetArray[i], m_dwFilter, true,
- m_bIgnorerelevant)) {
- m_iCurWidget = i;
- return m_TabOrderWidgetArray[m_iCurWidget];
- }
- }
- m_iCurWidget = -1;
- return nullptr;
-}
-
-CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::GetCurrentWidget() {
- return m_iCurWidget >= 0 ? m_TabOrderWidgetArray[m_iCurWidget] : nullptr;
-}
-
-bool CXFA_FFTabOrderPageWidgetIterator::SetCurrentWidget(
- CXFA_FFWidget* hWidget) {
- auto it = std::find(m_TabOrderWidgetArray.begin(),
- m_TabOrderWidgetArray.end(), hWidget);
- if (it == m_TabOrderWidgetArray.end())
- return false;
-
- m_iCurWidget = it - m_TabOrderWidgetArray.begin();
- return true;
-}
-
-CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::GetTraverseWidget(
- CXFA_FFWidget* pWidget) {
- CXFA_WidgetAcc* pAcc = pWidget->GetDataAcc();
- CXFA_Node* pTraversal = pAcc->GetNode()->GetChild(0, XFA_Element::Traversal);
- if (pTraversal) {
- CXFA_Node* pTraverse = pTraversal->GetChild(0, XFA_Element::Traverse);
- if (pTraverse) {
- CFX_WideString wsTraverseWidgetName;
- if (pTraverse->GetAttribute(XFA_ATTRIBUTE_Ref, wsTraverseWidgetName)) {
- return FindWidgetByName(wsTraverseWidgetName, pWidget);
- }
- }
- }
- return nullptr;
-}
-CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::FindWidgetByName(
- const CFX_WideString& wsWidgetName,
- CXFA_FFWidget* pRefWidget) {
- return pRefWidget->GetDocView()->GetWidgetByName(wsWidgetName, pRefWidget);
-}
-
-void CXFA_FFTabOrderPageWidgetIterator::CreateTabOrderWidgetArray() {
- m_TabOrderWidgetArray.clear();
-
- std::vector<CXFA_FFWidget*> SpaceOrderWidgetArray;
- CreateSpaceOrderWidgetArray(&SpaceOrderWidgetArray);
- if (SpaceOrderWidgetArray.empty())
- return;
-
- int32_t nWidgetCount = pdfium::CollectionSize<int32_t>(SpaceOrderWidgetArray);
- CXFA_FFWidget* hWidget = SpaceOrderWidgetArray[0];
- while (pdfium::CollectionSize<int32_t>(m_TabOrderWidgetArray) <
- nWidgetCount) {
- if (!pdfium::ContainsValue(m_TabOrderWidgetArray, hWidget)) {
- m_TabOrderWidgetArray.push_back(hWidget);
- CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc();
- if (pWidgetAcc->GetUIType() == XFA_Element::ExclGroup) {
- auto it = std::find(SpaceOrderWidgetArray.begin(),
- SpaceOrderWidgetArray.end(), hWidget);
- int32_t iWidgetIndex = it != SpaceOrderWidgetArray.end()
- ? it - SpaceOrderWidgetArray.begin() + 1
- : 0;
- while (true) {
- CXFA_FFWidget* pRadio =
- SpaceOrderWidgetArray[iWidgetIndex % nWidgetCount];
- if (pRadio->GetDataAcc()->GetExclGroup() != pWidgetAcc) {
- break;
- }
- if (!pdfium::ContainsValue(m_TabOrderWidgetArray, hWidget)) {
- m_TabOrderWidgetArray.push_back(pRadio);
- }
- iWidgetIndex++;
- }
- }
- if (CXFA_FFWidget* hTraverseWidget = GetTraverseWidget(hWidget)) {
- hWidget = hTraverseWidget;
- continue;
- }
- }
- auto it = std::find(SpaceOrderWidgetArray.begin(),
- SpaceOrderWidgetArray.end(), hWidget);
- int32_t iWidgetIndex = it != SpaceOrderWidgetArray.end()
- ? it - SpaceOrderWidgetArray.begin() + 1
- : 0;
- hWidget = SpaceOrderWidgetArray[iWidgetIndex % nWidgetCount];
- }
-}
-
-static int32_t XFA_TabOrderWidgetComparator(const void* phWidget1,
- const void* phWidget2) {
- auto param1 = *static_cast<CXFA_TabParam**>(const_cast<void*>(phWidget1));
- auto param2 = *static_cast<CXFA_TabParam**>(const_cast<void*>(phWidget2));
- CFX_RectF rt1 = param1->m_pWidget->GetWidgetRect();
- CFX_RectF rt2 = param2->m_pWidget->GetWidgetRect();
- FX_FLOAT x1 = rt1.left, y1 = rt1.top, x2 = rt2.left, y2 = rt2.top;
- if (y1 < y2 || (y1 - y2 < XFA_FLOAT_PERCISION && x1 < x2))
- return -1;
- return 1;
-}
-
-void CXFA_FFTabOrderPageWidgetIterator::OrderContainer(
- CXFA_LayoutItemIterator* sIterator,
- CXFA_LayoutItem* pContainerItem,
- CXFA_TabParam* pContainer,
- bool& bCurrentItem,
- bool& bContentArea,
- bool bMarsterPage) {
- CFX_ArrayTemplate<CXFA_TabParam*> tabParams;
- CXFA_LayoutItem* pSearchItem = sIterator->MoveToNext();
- while (pSearchItem) {
- if (!pSearchItem->IsContentLayoutItem()) {
- bContentArea = true;
- pSearchItem = sIterator->MoveToNext();
- continue;
- }
- if (bMarsterPage && bContentArea) {
- break;
- }
- if (bMarsterPage || bContentArea) {
- CXFA_FFWidget* hWidget = GetWidget(pSearchItem);
- if (!hWidget) {
- pSearchItem = sIterator->MoveToNext();
- continue;
- }
- if (pContainerItem && (pSearchItem->GetParent() != pContainerItem)) {
- bCurrentItem = true;
- break;
- }
- CXFA_TabParam* pParam = new CXFA_TabParam;
- pParam->m_pWidget = hWidget;
- tabParams.Add(pParam);
- if (IsLayoutElement(pSearchItem->GetFormNode()->GetElementType(), true)) {
- OrderContainer(sIterator, pSearchItem, pParam, bCurrentItem,
- bContentArea, bMarsterPage);
- }
- }
- if (bCurrentItem) {
- pSearchItem = sIterator->GetCurrent();
- bCurrentItem = false;
- } else {
- pSearchItem = sIterator->MoveToNext();
- }
- }
- int32_t iChildren = tabParams.GetSize();
- if (iChildren > 1) {
- FXSYS_qsort(tabParams.GetData(), iChildren, sizeof(void*),
- XFA_TabOrderWidgetComparator);
- }
- for (int32_t iStart = 0; iStart < iChildren; iStart++) {
- std::unique_ptr<CXFA_TabParam> pParam(tabParams[iStart]);
- pContainer->m_Children.push_back(pParam->m_pWidget);
- pContainer->m_Children.insert(pContainer->m_Children.end(),
- pParam->m_Children.begin(),
- pParam->m_Children.end());
- }
- tabParams.RemoveAll();
-}
-void CXFA_FFTabOrderPageWidgetIterator::CreateSpaceOrderWidgetArray(
- std::vector<CXFA_FFWidget*>* WidgetArray) {
- CXFA_LayoutItemIterator sIterator;
- sIterator.Init(m_pPageView);
- auto pParam = pdfium::MakeUnique<CXFA_TabParam>();
- bool bCurrentItem = false;
- bool bContentArea = false;
- OrderContainer(&sIterator, nullptr, pParam.get(), bCurrentItem, bContentArea);
- WidgetArray->insert(WidgetArray->end(), pParam->m_Children.begin(),
- pParam->m_Children.end());
-
- sIterator.Reset();
- bCurrentItem = false;
- bContentArea = false;
- pParam->m_Children.clear();
- OrderContainer(&sIterator, nullptr, pParam.get(), bCurrentItem, bContentArea,
- true);
- WidgetArray->insert(WidgetArray->end(), pParam->m_Children.begin(),
- pParam->m_Children.end());
-}
-
-CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::GetWidget(
- CXFA_LayoutItem* pLayoutItem) {
- if (CXFA_FFWidget* pWidget = XFA_GetWidgetFromLayoutItem(pLayoutItem)) {
- if (!pWidget->IsLoaded() &&
- (pWidget->GetStatus() & XFA_WidgetStatus_Visible)) {
- pWidget->LoadWidget();
- }
- return pWidget;
- }
- return nullptr;
-}
-
-CXFA_TabParam::CXFA_TabParam() : m_pWidget(nullptr) {}
-
-CXFA_TabParam::~CXFA_TabParam() {}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffpath.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffpath.cpp
index 43016fe5c63..854a028aaca 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffpath.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffpath.cpp
@@ -7,10 +7,10 @@
#include "xfa/fxfa/app/xfa_ffpath.h"
#include "xfa/fxfa/app/xfa_ffdraw.h"
-#include "xfa/fxfa/xfa_ffapp.h"
-#include "xfa/fxfa/xfa_ffdoc.h"
-#include "xfa/fxfa/xfa_ffpageview.h"
-#include "xfa/fxfa/xfa_ffwidget.h"
+#include "xfa/fxfa/cxfa_ffapp.h"
+#include "xfa/fxfa/cxfa_ffdoc.h"
+#include "xfa/fxfa/cxfa_ffpageview.h"
+#include "xfa/fxfa/cxfa_ffwidget.h"
#include "xfa/fxgraphics/cfx_color.h"
#include "xfa/fxgraphics/cfx_path.h"
@@ -20,8 +20,8 @@ CXFA_FFLine::~CXFA_FFLine() {}
void CXFA_FFLine::GetRectFromHand(CFX_RectF& rect,
int32_t iHand,
- FX_FLOAT fLineWidth) {
- FX_FLOAT fHalfWidth = fLineWidth / 2.0f;
+ float fLineWidth) {
+ float fHalfWidth = fLineWidth / 2.0f;
if (rect.height < 1.0f) {
switch (iHand) {
case XFA_ATTRIBUTEENUM_Left:
@@ -64,7 +64,7 @@ void CXFA_FFLine::RenderWidget(CFX_Graphics* pGS,
CXFA_Line lineObj = value.GetLine();
FX_ARGB lineColor = 0xFF000000;
int32_t iStrokeType = 0;
- FX_FLOAT fLineWidth = 1.0f;
+ float fLineWidth = 1.0f;
int32_t iCap = 0;
CXFA_Edge edge = lineObj.GetEdge();
if (edge) {
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffpath.h b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffpath.h
index 002f75d262f..6df53f4e1d6 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffpath.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffpath.h
@@ -20,7 +20,7 @@ class CXFA_FFLine : public CXFA_FFDraw {
uint32_t dwStatus) override;
private:
- void GetRectFromHand(CFX_RectF& rect, int32_t iHand, FX_FLOAT fLineWidth);
+ void GetRectFromHand(CFX_RectF& rect, int32_t iHand, float fLineWidth);
};
class CXFA_FFArc : public CXFA_FFDraw {
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffpushbutton.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffpushbutton.cpp
index 7b6be820356..fa5c0dc9a14 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffpushbutton.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffpushbutton.cpp
@@ -12,19 +12,14 @@
#include "xfa/fxfa/app/cxfa_textlayout.h"
#include "xfa/fxfa/app/xfa_fffield.h"
#include "xfa/fxfa/app/xfa_ffwidgetacc.h"
-#include "xfa/fxfa/xfa_ffapp.h"
-#include "xfa/fxfa/xfa_ffpageview.h"
-#include "xfa/fxfa/xfa_ffwidget.h"
+#include "xfa/fxfa/cxfa_ffapp.h"
+#include "xfa/fxfa/cxfa_ffpageview.h"
+#include "xfa/fxfa/cxfa_ffwidget.h"
#include "xfa/fxgraphics/cfx_color.h"
#include "xfa/fxgraphics/cfx_path.h"
CXFA_FFPushButton::CXFA_FFPushButton(CXFA_WidgetAcc* pDataAcc)
- : CXFA_FFField(pDataAcc),
- m_pRolloverTextLayout(nullptr),
- m_pDownTextLayout(nullptr),
- m_pDownProvider(nullptr),
- m_pRollProvider(nullptr),
- m_pOldDelegate(nullptr) {}
+ : CXFA_FFField(pDataAcc), m_pOldDelegate(nullptr) {}
CXFA_FFPushButton::~CXFA_FFPushButton() {
CXFA_FFPushButton::UnloadWidget();
@@ -86,14 +81,10 @@ void CXFA_FFPushButton::UpdateWidgetProperty() {
}
void CXFA_FFPushButton::UnloadWidget() {
- delete m_pRolloverTextLayout;
- m_pRolloverTextLayout = nullptr;
- delete m_pDownTextLayout;
- m_pDownTextLayout = nullptr;
- delete m_pDownProvider;
- m_pDownProvider = nullptr;
- delete m_pRollProvider;
- m_pRollProvider = nullptr;
+ m_pRolloverTextLayout.reset();
+ m_pDownTextLayout.reset();
+ m_pRollProvider.reset();
+ m_pDownProvider.reset();
CXFA_FFField::UnloadWidget();
}
@@ -117,7 +108,7 @@ bool CXFA_FFPushButton::PerformLayout() {
return true;
}
-FX_FLOAT CXFA_FFPushButton::GetLineWidth() {
+float CXFA_FFPushButton::GetLineWidth() {
CXFA_Border border = m_pDataAcc->GetBorder();
if (border && border.GetPresence() == XFA_ATTRIBUTEENUM_Visible) {
CXFA_Edge edge = border.GetEdge(0);
@@ -125,36 +116,41 @@ FX_FLOAT CXFA_FFPushButton::GetLineWidth() {
}
return 0;
}
+
FX_ARGB CXFA_FFPushButton::GetLineColor() {
return 0xFF000000;
}
+
FX_ARGB CXFA_FFPushButton::GetFillColor() {
return 0xFFFFFFFF;
}
+
void CXFA_FFPushButton::LoadHighlightCaption() {
CXFA_Caption caption = m_pDataAcc->GetCaption();
- if (caption && caption.GetPresence() != XFA_ATTRIBUTEENUM_Hidden) {
- {
- CFX_WideString wsRollover;
- bool bRichText;
- if (m_pDataAcc->GetButtonRollover(wsRollover, bRichText)) {
- if (!m_pRollProvider) {
- m_pRollProvider =
- new CXFA_TextProvider(m_pDataAcc, XFA_TEXTPROVIDERTYPE_Rollover);
- }
- m_pRolloverTextLayout = new CXFA_TextLayout(m_pRollProvider);
- }
- CFX_WideString wsDown;
- if (m_pDataAcc->GetButtonDown(wsDown, bRichText)) {
- if (!m_pDownProvider) {
- m_pDownProvider =
- new CXFA_TextProvider(m_pDataAcc, XFA_TEXTPROVIDERTYPE_Down);
- }
- m_pDownTextLayout = new CXFA_TextLayout(m_pDownProvider);
- }
+ if (!caption || caption.GetPresence() == XFA_ATTRIBUTEENUM_Hidden)
+ return;
+
+ bool bRichText;
+ CFX_WideString wsRollover;
+ if (m_pDataAcc->GetButtonRollover(wsRollover, bRichText)) {
+ if (!m_pRollProvider) {
+ m_pRollProvider = pdfium::MakeUnique<CXFA_TextProvider>(
+ m_pDataAcc, XFA_TEXTPROVIDERTYPE_Rollover);
+ }
+ m_pRolloverTextLayout =
+ pdfium::MakeUnique<CXFA_TextLayout>(m_pRollProvider.get());
+ }
+ CFX_WideString wsDown;
+ if (m_pDataAcc->GetButtonDown(wsDown, bRichText)) {
+ if (!m_pDownProvider) {
+ m_pDownProvider = pdfium::MakeUnique<CXFA_TextProvider>(
+ m_pDataAcc, XFA_TEXTPROVIDERTYPE_Down);
}
+ m_pDownTextLayout =
+ pdfium::MakeUnique<CXFA_TextLayout>(m_pDownProvider.get());
}
}
+
void CXFA_FFPushButton::LayoutHighlightCaption() {
CFX_SizeF sz(m_rtCaption.width, m_rtCaption.height);
LayoutCaption();
@@ -210,7 +206,7 @@ void CXFA_FFPushButton::OnDrawWidget(CFX_Graphics* pGraphics,
if ((m_pNormalWidget->GetStates() & FWL_STATE_PSB_Pressed) &&
(m_pNormalWidget->GetStates() & FWL_STATE_PSB_Hovered)) {
CFX_RectF rtFill(0, 0, m_pNormalWidget->GetWidgetRect().Size());
- FX_FLOAT fLineWith = GetLineWidth();
+ float fLineWith = GetLineWidth();
rtFill.Deflate(fLineWith, fLineWith);
CFX_Color cr(FXARGB_MAKE(128, 128, 255, 255));
pGraphics->SetFillColor(&cr);
@@ -223,7 +219,7 @@ void CXFA_FFPushButton::OnDrawWidget(CFX_Graphics* pGraphics,
XFA_FWL_PSBSTYLEEXT_HiliteOutLine) {
if ((m_pNormalWidget->GetStates() & FWL_STATE_PSB_Pressed) &&
(m_pNormalWidget->GetStates() & FWL_STATE_PSB_Hovered)) {
- FX_FLOAT fLineWidth = GetLineWidth();
+ float fLineWidth = GetLineWidth();
CFX_Color cr(FXARGB_MAKE(255, 128, 255, 255));
pGraphics->SetStrokeColor(&cr);
pGraphics->SetLineWidth(fLineWidth);
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffpushbutton.h b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffpushbutton.h
index eb18ccb11ca..d2f5746fe92 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffpushbutton.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffpushbutton.h
@@ -7,6 +7,8 @@
#ifndef XFA_FXFA_APP_XFA_FFPUSHBUTTON_H_
#define XFA_FXFA_APP_XFA_FFPUSHBUTTON_H_
+#include <memory>
+
#include "xfa/fxfa/app/xfa_fffield.h"
#define XFA_FWL_PSBSTYLEEXT_HiliteNone (0L << 0)
@@ -34,18 +36,18 @@ class CXFA_FFPushButton : public CXFA_FFField {
void OnDrawWidget(CFX_Graphics* pGraphics,
const CFX_Matrix* pMatrix = nullptr) override;
- protected:
+ private:
void LoadHighlightCaption();
void LayoutHighlightCaption();
void RenderHighlightCaption(CFX_Graphics* pGS, CFX_Matrix* pMatrix = nullptr);
- FX_FLOAT GetLineWidth();
+ float GetLineWidth();
FX_ARGB GetLineColor();
FX_ARGB GetFillColor();
- CXFA_TextLayout* m_pRolloverTextLayout;
- CXFA_TextLayout* m_pDownTextLayout;
- CXFA_TextProvider* m_pDownProvider;
- CXFA_TextProvider* m_pRollProvider;
+ std::unique_ptr<CXFA_TextLayout> m_pRolloverTextLayout;
+ std::unique_ptr<CXFA_TextLayout> m_pDownTextLayout;
+ std::unique_ptr<CXFA_TextProvider> m_pRollProvider;
+ std::unique_ptr<CXFA_TextProvider> m_pDownProvider;
IFWL_WidgetDelegate* m_pOldDelegate;
};
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffsignature.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffsignature.cpp
index bf2bba3adff..edc34336c69 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffsignature.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffsignature.cpp
@@ -7,9 +7,9 @@
#include "xfa/fxfa/app/xfa_ffsignature.h"
#include "xfa/fxfa/app/xfa_fffield.h"
-#include "xfa/fxfa/xfa_ffdoc.h"
-#include "xfa/fxfa/xfa_ffpageview.h"
-#include "xfa/fxfa/xfa_ffwidget.h"
+#include "xfa/fxfa/cxfa_ffdoc.h"
+#include "xfa/fxfa/cxfa_ffpageview.h"
+#include "xfa/fxfa/cxfa_ffwidget.h"
CXFA_FFSignature::CXFA_FFSignature(CXFA_WidgetAcc* pDataAcc)
: CXFA_FFField(pDataAcc) {}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffsubform.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffsubform.cpp
index 0b479f4d4cd..d008c5b4f91 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffsubform.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffsubform.cpp
@@ -6,10 +6,10 @@
#include "xfa/fxfa/app/xfa_ffsubform.h"
-#include "xfa/fxfa/xfa_ffapp.h"
-#include "xfa/fxfa/xfa_ffdoc.h"
-#include "xfa/fxfa/xfa_ffpageview.h"
-#include "xfa/fxfa/xfa_ffwidget.h"
+#include "xfa/fxfa/cxfa_ffapp.h"
+#include "xfa/fxfa/cxfa_ffdoc.h"
+#include "xfa/fxfa/cxfa_ffpageview.h"
+#include "xfa/fxfa/cxfa_ffwidget.h"
CXFA_FFSubForm::CXFA_FFSubForm(CXFA_WidgetAcc* pDataAcc)
: CXFA_FFWidget(pDataAcc) {}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffsubform.h b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffsubform.h
index e6b77a8b33e..c87688fdcef 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffsubform.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffsubform.h
@@ -7,8 +7,8 @@
#ifndef XFA_FXFA_APP_XFA_FFSUBFORM_H_
#define XFA_FXFA_APP_XFA_FFSUBFORM_H_
-#include "xfa/fxfa/xfa_ffpageview.h"
-#include "xfa/fxfa/xfa_ffwidget.h"
+#include "xfa/fxfa/cxfa_ffpageview.h"
+#include "xfa/fxfa/cxfa_ffwidget.h"
class CXFA_FFSubForm : public CXFA_FFWidget {
public:
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fftext.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fftext.cpp
index e8d7aa32d02..6885bfc93f6 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fftext.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fftext.cpp
@@ -13,10 +13,10 @@
#include "xfa/fxfa/app/cxfa_textlayout.h"
#include "xfa/fxfa/app/xfa_ffdraw.h"
#include "xfa/fxfa/app/xfa_textpiece.h"
-#include "xfa/fxfa/xfa_ffapp.h"
-#include "xfa/fxfa/xfa_ffdoc.h"
-#include "xfa/fxfa/xfa_ffpageview.h"
-#include "xfa/fxfa/xfa_ffwidget.h"
+#include "xfa/fxfa/cxfa_ffapp.h"
+#include "xfa/fxfa/cxfa_ffdoc.h"
+#include "xfa/fxfa/cxfa_ffpageview.h"
+#include "xfa/fxfa/cxfa_ffwidget.h"
#include "xfa/fxgraphics/cfx_graphics.h"
CXFA_FFText::CXFA_FFText(CXFA_WidgetAcc* pDataAcc) : CXFA_FFDraw(pDataAcc) {}
@@ -46,10 +46,10 @@ void CXFA_FFText::RenderWidget(CFX_Graphics* pGS,
if (!pItem->GetPrev() && !pItem->GetNext()) {
XFA_RectWidthoutMargin(rtText, mgWidget);
} else {
- FX_FLOAT fLeftInset;
- FX_FLOAT fRightInset;
- FX_FLOAT fTopInset = 0;
- FX_FLOAT fBottomInset = 0;
+ float fLeftInset;
+ float fRightInset;
+ float fTopInset = 0;
+ float fBottomInset = 0;
mgWidget.GetLeftInset(fLeftInset);
mgWidget.GetRightInset(fRightInset);
if (!pItem->GetPrev())
@@ -75,13 +75,13 @@ bool CXFA_FFText::IsLoaded() {
bool CXFA_FFText::PerformLayout() {
CXFA_FFDraw::PerformLayout();
CXFA_TextLayout* pTextLayout = m_pDataAcc->GetTextLayout();
- if (!pTextLayout) {
+ if (!pTextLayout)
return false;
- }
- if (!pTextLayout->m_bHasBlock) {
+
+ if (!pTextLayout->m_bHasBlock)
return true;
- }
- pTextLayout->m_Blocks.RemoveAll();
+
+ pTextLayout->m_Blocks.clear();
CXFA_LayoutItem* pItem = this;
if (!pItem->GetPrev() && !pItem->GetNext()) {
return true;
@@ -91,11 +91,11 @@ bool CXFA_FFText::PerformLayout() {
CFX_RectF rtText = pItem->GetRect(false);
if (CXFA_Margin mgWidget = m_pDataAcc->GetMargin()) {
if (!pItem->GetPrev()) {
- FX_FLOAT fTopInset;
+ float fTopInset;
mgWidget.GetTopInset(fTopInset);
rtText.height -= fTopInset;
} else if (!pItem->GetNext()) {
- FX_FLOAT fBottomInset;
+ float fBottomInset;
mgWidget.GetBottomInset(fBottomInset);
rtText.height -= fBottomInset;
}
@@ -111,7 +111,7 @@ bool CXFA_FFText::OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) {
if (!GetRectWithoutRotate().Contains(point))
return false;
- const FX_WCHAR* wsURLContent = GetLinkURLAtPoint(point);
+ const wchar_t* wsURLContent = GetLinkURLAtPoint(point);
if (!wsURLContent)
return false;
@@ -128,7 +128,7 @@ bool CXFA_FFText::OnLButtonUp(uint32_t dwFlags, const CFX_PointF& point) {
return false;
SetButtonDown(false);
- const FX_WCHAR* wsURLContent = GetLinkURLAtPoint(point);
+ const wchar_t* wsURLContent = GetLinkURLAtPoint(point);
if (!wsURLContent)
return false;
@@ -145,7 +145,7 @@ FWL_WidgetHit CXFA_FFText::OnHitTest(const CFX_PointF& point) {
return FWL_WidgetHit::HyperLink;
}
-const FX_WCHAR* CXFA_FFText::GetLinkURLAtPoint(const CFX_PointF& point) {
+const wchar_t* CXFA_FFText::GetLinkURLAtPoint(const CFX_PointF& point) {
CXFA_TextLayout* pTextLayout = m_pDataAcc->GetTextLayout();
if (!pTextLayout)
return nullptr;
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fftext.h b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fftext.h
index c5538217914..eddc1224aca 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fftext.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fftext.h
@@ -26,7 +26,7 @@ class CXFA_FFText : public CXFA_FFDraw {
bool PerformLayout() override;
private:
- const FX_WCHAR* GetLinkURLAtPoint(const CFX_PointF& point);
+ const wchar_t* GetLinkURLAtPoint(const CFX_PointF& point);
};
#endif // XFA_FXFA_APP_XFA_FFTEXT_H_
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fftextedit.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fftextedit.cpp
index 094839f4862..2658758718d 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fftextedit.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fftextedit.cpp
@@ -21,12 +21,13 @@
#include "xfa/fxfa/app/xfa_fffield.h"
#include "xfa/fxfa/app/xfa_fwladapter.h"
#include "xfa/fxfa/cxfa_eventparam.h"
-#include "xfa/fxfa/parser/xfa_localevalue.h"
-#include "xfa/fxfa/xfa_ffapp.h"
-#include "xfa/fxfa/xfa_ffdoc.h"
-#include "xfa/fxfa/xfa_ffdocview.h"
-#include "xfa/fxfa/xfa_ffpageview.h"
-#include "xfa/fxfa/xfa_ffwidget.h"
+#include "xfa/fxfa/cxfa_ffapp.h"
+#include "xfa/fxfa/cxfa_ffdoc.h"
+#include "xfa/fxfa/cxfa_ffdocview.h"
+#include "xfa/fxfa/cxfa_ffpageview.h"
+#include "xfa/fxfa/cxfa_ffwidget.h"
+#include "xfa/fxfa/parser/cxfa_localevalue.h"
+#include "xfa/fxfa/parser/cxfa_node.h"
CXFA_FFTextEdit::CXFA_FFTextEdit(CXFA_WidgetAcc* pDataAcc)
: CXFA_FFField(pDataAcc), m_pOldDelegate(nullptr) {}
@@ -521,10 +522,9 @@ bool CXFA_FFDateTimeEdit::LoadWidget() {
case XFA_Element::Date: {
if (!wsText.IsEmpty()) {
CXFA_LocaleValue lcValue = XFA_GetLocaleValue(m_pDataAcc);
- CFX_Unitime date = lcValue.GetDate();
- if ((FX_UNITIME)date != 0) {
+ CFX_DateTime date = lcValue.GetDate();
+ if (date.IsSet())
pWidget->SetCurSel(date.GetYear(), date.GetMonth(), date.GetDay());
- }
}
} break;
default:
@@ -618,10 +618,10 @@ bool CXFA_FFDateTimeEdit::UpdateFWLData() {
((CFWL_DateTimePicker*)m_pNormalWidget)->SetEditText(wsText);
if (IsFocused() && !wsText.IsEmpty()) {
CXFA_LocaleValue lcValue = XFA_GetLocaleValue(m_pDataAcc);
- CFX_Unitime date = lcValue.GetDate();
+ CFX_DateTime date = lcValue.GetDate();
if (lcValue.IsValid()) {
- if ((FX_UNITIME)date != 0) {
- ((CFWL_DateTimePicker*)m_pNormalWidget)
+ if (date.IsSet()) {
+ static_cast<CFWL_DateTimePicker*>(m_pNormalWidget)
->SetCurSel(date.GetYear(), date.GetMonth(), date.GetDay());
}
}
@@ -647,9 +647,8 @@ void CXFA_FFDateTimeEdit::OnSelectChanged(CFWL_Widget* pWidget,
CFX_WideString wsPicture;
m_pDataAcc->GetPictureContent(wsPicture, XFA_VALUEPICTURE_Edit);
CXFA_LocaleValue date(XFA_VT_DATE, GetDoc()->GetXFADoc()->GetLocalMgr());
- CFX_Unitime dt;
- dt.Set(iYear, iMonth, iDay);
- date.SetDate(dt);
+ date.SetDate(CFX_DateTime(iYear, iMonth, iDay, 0, 0, 0, 0));
+
CFX_WideString wsDate;
date.FormatPatterns(wsDate, wsPicture, m_pDataAcc->GetLocal(),
XFA_VALUEPICTURE_Edit);
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fftextedit.h b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fftextedit.h
index 1e0562a75b3..9b9324f9d21 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fftextedit.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fftextedit.h
@@ -36,14 +36,15 @@ class CXFA_FFTextEdit : public CXFA_FFField {
bool CheckWord(const CFX_ByteStringC& sWord);
protected:
+ uint32_t GetAlignment();
+
+ IFWL_WidgetDelegate* m_pOldDelegate;
+
+ private:
bool CommitData() override;
bool UpdateFWLData() override;
bool IsDataChanged() override;
-
- uint32_t GetAlignment();
void ValidateNumberField(const CFX_WideString& wsText);
-
- IFWL_WidgetDelegate* m_pOldDelegate;
};
class CXFA_FFNumericEdit : public CXFA_FFTextEdit {
@@ -56,7 +57,7 @@ class CXFA_FFNumericEdit : public CXFA_FFTextEdit {
void UpdateWidgetProperty() override;
void OnProcessEvent(CFWL_Event* pEvent) override;
- public:
+ private:
bool OnValidate(CFWL_Widget* pWidget, CFX_WideString& wsText);
};
@@ -68,8 +69,6 @@ class CXFA_FFPasswordEdit : public CXFA_FFTextEdit {
// CXFA_FFTextEdit
bool LoadWidget() override;
void UpdateWidgetProperty() override;
-
- protected:
};
enum XFA_DATETIMETYPE {
@@ -94,7 +93,7 @@ class CXFA_FFDateTimeEdit : public CXFA_FFTextEdit {
int32_t iMonth,
int32_t iDay);
- protected:
+ private:
bool PtInActiveRect(const CFX_PointF& point) override;
bool CommitData() override;
bool UpdateFWLData() override;
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffwidget.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffwidget.cpp
deleted file mode 100644
index 9995fd11b2a..00000000000
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffwidget.cpp
+++ /dev/null
@@ -1,2050 +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
-
-#include "xfa/fxfa/xfa_ffwidget.h"
-
-#include <algorithm>
-#include <memory>
-#include <vector>
-
-#include "core/fpdfapi/page/cpdf_pageobjectholder.h"
-#include "core/fxcodec/codec/ccodec_progressivedecoder.h"
-#include "core/fxcodec/fx_codec.h"
-#include "core/fxcrt/cfx_maybe_owned.h"
-#include "core/fxge/cfx_gemodule.h"
-#include "core/fxge/cfx_pathdata.h"
-#include "core/fxge/cfx_renderdevice.h"
-#include "xfa/fwl/fwl_widgethit.h"
-#include "xfa/fxfa/app/cxfa_textlayout.h"
-#include "xfa/fxfa/cxfa_eventparam.h"
-#include "xfa/fxfa/fxfa_widget.h"
-#include "xfa/fxfa/parser/cxfa_corner.h"
-#include "xfa/fxfa/xfa_ffapp.h"
-#include "xfa/fxfa/xfa_ffdoc.h"
-#include "xfa/fxfa/xfa_ffdocview.h"
-#include "xfa/fxfa/xfa_ffpageview.h"
-#include "xfa/fxgraphics/cfx_color.h"
-#include "xfa/fxgraphics/cfx_graphics.h"
-#include "xfa/fxgraphics/cfx_path.h"
-#include "xfa/fxgraphics/cfx_pattern.h"
-#include "xfa/fxgraphics/cfx_shading.h"
-
-CXFA_FFWidget::CXFA_FFWidget(CXFA_WidgetAcc* pDataAcc)
- : CXFA_ContentLayoutItem(pDataAcc->GetNode()),
- m_pPageView(nullptr),
- m_pDataAcc(pDataAcc) {}
-
-CXFA_FFWidget::~CXFA_FFWidget() {}
-
-const CFWL_App* CXFA_FFWidget::GetFWLApp() {
- return GetPageView()->GetDocView()->GetDoc()->GetApp()->GetFWLApp();
-}
-
-CFX_RectF CXFA_FFWidget::GetWidgetRect() {
- if ((m_dwStatus & XFA_WidgetStatus_RectCached) == 0)
- RecacheWidgetRect();
- return m_rtWidget;
-}
-
-CFX_RectF CXFA_FFWidget::RecacheWidgetRect() {
- m_dwStatus |= XFA_WidgetStatus_RectCached;
- m_rtWidget = GetRect(false);
- return m_rtWidget;
-}
-
-CFX_RectF CXFA_FFWidget::GetRectWithoutRotate() {
- CFX_RectF rtWidget = GetWidgetRect();
- FX_FLOAT fValue = 0;
- switch (m_pDataAcc->GetRotate()) {
- case 90:
- rtWidget.top = rtWidget.bottom();
- fValue = rtWidget.width;
- rtWidget.width = rtWidget.height;
- rtWidget.height = fValue;
- break;
- case 180:
- rtWidget.left = rtWidget.right();
- rtWidget.top = rtWidget.bottom();
- break;
- case 270:
- rtWidget.left = rtWidget.right();
- fValue = rtWidget.width;
- rtWidget.width = rtWidget.height;
- rtWidget.height = fValue;
- break;
- }
- return rtWidget;
-}
-
-uint32_t CXFA_FFWidget::GetStatus() {
- return m_dwStatus;
-}
-
-void CXFA_FFWidget::ModifyStatus(uint32_t dwAdded, uint32_t dwRemoved) {
- m_dwStatus = (m_dwStatus & ~dwRemoved) | dwAdded;
-}
-
-CFX_RectF CXFA_FFWidget::GetBBox(uint32_t dwStatus, bool bDrawFocus) {
- if (bDrawFocus || !m_pPageView)
- return CFX_RectF();
- return m_pPageView->GetPageViewRect();
-}
-
-CXFA_WidgetAcc* CXFA_FFWidget::GetDataAcc() {
- return m_pDataAcc;
-}
-
-bool CXFA_FFWidget::GetToolTip(CFX_WideString& wsToolTip) {
- if (CXFA_Assist assist = m_pDataAcc->GetAssist()) {
- if (CXFA_ToolTip toolTip = assist.GetToolTip()) {
- return toolTip.GetTip(wsToolTip);
- }
- }
- return GetCaptionText(wsToolTip);
-}
-
-void CXFA_FFWidget::RenderWidget(CFX_Graphics* pGS,
- CFX_Matrix* pMatrix,
- uint32_t dwStatus) {
- if (!IsMatchVisibleStatus(dwStatus))
- return;
-
- CXFA_Border border = m_pDataAcc->GetBorder();
- if (!border)
- return;
-
- CFX_RectF rtBorder = GetRectWithoutRotate();
- CXFA_Margin margin = border.GetMargin();
- if (margin)
- XFA_RectWidthoutMargin(rtBorder, margin);
-
- rtBorder.Normalize();
- DrawBorder(pGS, border, rtBorder, pMatrix);
-}
-
-bool CXFA_FFWidget::IsLoaded() {
- return !!m_pPageView;
-}
-bool CXFA_FFWidget::LoadWidget() {
- PerformLayout();
- return true;
-}
-void CXFA_FFWidget::UnloadWidget() {}
-bool CXFA_FFWidget::PerformLayout() {
- RecacheWidgetRect();
- return true;
-}
-bool CXFA_FFWidget::UpdateFWLData() {
- return false;
-}
-void CXFA_FFWidget::UpdateWidgetProperty() {}
-void CXFA_FFWidget::DrawBorder(CFX_Graphics* pGS,
- CXFA_Box box,
- const CFX_RectF& rtBorder,
- CFX_Matrix* pMatrix,
- uint32_t dwFlags) {
- XFA_DrawBox(box, pGS, rtBorder, pMatrix, dwFlags);
-}
-
-void CXFA_FFWidget::InvalidateWidget(const CFX_RectF* pRect) {
- if (pRect) {
- GetDoc()->GetDocEnvironment()->InvalidateRect(m_pPageView, *pRect,
- XFA_INVALIDATE_CurrentPage);
- return;
- }
-
- CFX_RectF rtWidget = GetBBox(XFA_WidgetStatus_Focused);
- rtWidget.Inflate(2, 2);
- GetDoc()->GetDocEnvironment()->InvalidateRect(m_pPageView, rtWidget,
- XFA_INVALIDATE_CurrentPage);
-}
-
-void CXFA_FFWidget::AddInvalidateRect(const CFX_RectF* pRect) {
- CFX_RectF rtWidget;
- if (pRect) {
- rtWidget = *pRect;
- } else {
- rtWidget = GetBBox(XFA_WidgetStatus_Focused);
- rtWidget.Inflate(2, 2);
- }
- m_pDocView->AddInvalidateRect(m_pPageView, rtWidget);
-}
-
-bool CXFA_FFWidget::GetCaptionText(CFX_WideString& wsCap) {
- CXFA_TextLayout* pCapTextlayout = m_pDataAcc->GetCaptionTextLayout();
- if (!pCapTextlayout) {
- return false;
- }
- pCapTextlayout->GetText(wsCap);
- return true;
-}
-
-bool CXFA_FFWidget::IsFocused() {
- return !!(m_dwStatus & XFA_WidgetStatus_Focused);
-}
-
-bool CXFA_FFWidget::OnMouseEnter() {
- return false;
-}
-
-bool CXFA_FFWidget::OnMouseExit() {
- return false;
-}
-
-bool CXFA_FFWidget::OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) {
- return false;
-}
-
-bool CXFA_FFWidget::OnLButtonUp(uint32_t dwFlags, const CFX_PointF& point) {
- return false;
-}
-
-bool CXFA_FFWidget::OnLButtonDblClk(uint32_t dwFlags, const CFX_PointF& point) {
- return false;
-}
-
-bool CXFA_FFWidget::OnMouseMove(uint32_t dwFlags, const CFX_PointF& point) {
- return false;
-}
-
-bool CXFA_FFWidget::OnMouseWheel(uint32_t dwFlags,
- int16_t zDelta,
- const CFX_PointF& point) {
- return false;
-}
-
-bool CXFA_FFWidget::OnRButtonDown(uint32_t dwFlags, const CFX_PointF& point) {
- return false;
-}
-
-bool CXFA_FFWidget::OnRButtonUp(uint32_t dwFlags, const CFX_PointF& point) {
- return false;
-}
-
-bool CXFA_FFWidget::OnRButtonDblClk(uint32_t dwFlags, const CFX_PointF& point) {
- return false;
-}
-
-bool CXFA_FFWidget::OnSetFocus(CXFA_FFWidget* pOldWidget) {
- CXFA_FFWidget* pParent = GetParent();
- if (pParent && !pParent->IsAncestorOf(pOldWidget)) {
- pParent->OnSetFocus(pOldWidget);
- }
- m_dwStatus |= XFA_WidgetStatus_Focused;
- CXFA_EventParam eParam;
- eParam.m_eType = XFA_EVENT_Enter;
- eParam.m_pTarget = m_pDataAcc;
- m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Enter, &eParam);
- return true;
-}
-
-bool CXFA_FFWidget::OnKillFocus(CXFA_FFWidget* pNewWidget) {
- m_dwStatus &= ~XFA_WidgetStatus_Focused;
- EventKillFocus();
- if (pNewWidget) {
- CXFA_FFWidget* pParent = GetParent();
- if (pParent && !pParent->IsAncestorOf(pNewWidget)) {
- pParent->OnKillFocus(pNewWidget);
- }
- }
- return true;
-}
-
-bool CXFA_FFWidget::OnKeyDown(uint32_t dwKeyCode, uint32_t dwFlags) {
- return false;
-}
-
-bool CXFA_FFWidget::OnKeyUp(uint32_t dwKeyCode, uint32_t dwFlags) {
- return false;
-}
-
-bool CXFA_FFWidget::OnChar(uint32_t dwChar, uint32_t dwFlags) {
- return false;
-}
-
-FWL_WidgetHit CXFA_FFWidget::OnHitTest(const CFX_PointF& point) {
- return FWL_WidgetHit::Unknown;
-}
-
-bool CXFA_FFWidget::OnSetCursor(const CFX_PointF& point) {
- return false;
-}
-
-bool CXFA_FFWidget::CanUndo() {
- return false;
-}
-
-bool CXFA_FFWidget::CanRedo() {
- return false;
-}
-
-bool CXFA_FFWidget::Undo() {
- return false;
-}
-
-bool CXFA_FFWidget::Redo() {
- return false;
-}
-
-bool CXFA_FFWidget::CanCopy() {
- return false;
-}
-
-bool CXFA_FFWidget::CanCut() {
- return false;
-}
-
-bool CXFA_FFWidget::CanPaste() {
- return false;
-}
-
-bool CXFA_FFWidget::CanSelectAll() {
- return false;
-}
-
-bool CXFA_FFWidget::CanDelete() {
- return CanCut();
-}
-
-bool CXFA_FFWidget::CanDeSelect() {
- return CanCopy();
-}
-
-bool CXFA_FFWidget::Copy(CFX_WideString& wsCopy) {
- return false;
-}
-
-bool CXFA_FFWidget::Cut(CFX_WideString& wsCut) {
- return false;
-}
-
-bool CXFA_FFWidget::Paste(const CFX_WideString& wsPaste) {
- return false;
-}
-
-void CXFA_FFWidget::SelectAll() {}
-
-void CXFA_FFWidget::Delete() {}
-
-void CXFA_FFWidget::DeSelect() {}
-
-bool CXFA_FFWidget::GetSuggestWords(CFX_PointF pointf,
- std::vector<CFX_ByteString>& sSuggest) {
- return false;
-}
-bool CXFA_FFWidget::ReplaceSpellCheckWord(CFX_PointF pointf,
- const CFX_ByteStringC& bsReplace) {
- return false;
-}
-
-CFX_PointF CXFA_FFWidget::Rotate2Normal(const CFX_PointF& point) {
- CFX_Matrix mt = GetRotateMatrix();
- if (mt.IsIdentity())
- return point;
-
- CFX_Matrix mtReverse;
- mtReverse.SetReverse(mt);
- return mtReverse.Transform(point);
-}
-
-static void XFA_GetMatrix(CFX_Matrix& m,
- int32_t iRotate,
- XFA_ATTRIBUTEENUM at,
- const CFX_RectF& rt) {
- if (!iRotate) {
- return;
- }
- FX_FLOAT fAnchorX = 0;
- FX_FLOAT fAnchorY = 0;
- switch (at) {
- case XFA_ATTRIBUTEENUM_TopLeft:
- fAnchorX = rt.left, fAnchorY = rt.top;
- break;
- case XFA_ATTRIBUTEENUM_TopCenter:
- fAnchorX = (rt.left + rt.right()) / 2, fAnchorY = rt.top;
- break;
- case XFA_ATTRIBUTEENUM_TopRight:
- fAnchorX = rt.right(), fAnchorY = rt.top;
- break;
- case XFA_ATTRIBUTEENUM_MiddleLeft:
- fAnchorX = rt.left, fAnchorY = (rt.top + rt.bottom()) / 2;
- break;
- case XFA_ATTRIBUTEENUM_MiddleCenter:
- fAnchorX = (rt.left + rt.right()) / 2,
- fAnchorY = (rt.top + rt.bottom()) / 2;
- break;
- case XFA_ATTRIBUTEENUM_MiddleRight:
- fAnchorX = rt.right(), fAnchorY = (rt.top + rt.bottom()) / 2;
- break;
- case XFA_ATTRIBUTEENUM_BottomLeft:
- fAnchorX = rt.left, fAnchorY = rt.bottom();
- break;
- case XFA_ATTRIBUTEENUM_BottomCenter:
- fAnchorX = (rt.left + rt.right()) / 2, fAnchorY = rt.bottom();
- break;
- case XFA_ATTRIBUTEENUM_BottomRight:
- fAnchorX = rt.right(), fAnchorY = rt.bottom();
- break;
- default:
- break;
- }
- switch (iRotate) {
- case 90:
- m.a = 0, m.b = -1, m.c = 1, m.d = 0, m.e = fAnchorX - fAnchorY,
- m.f = fAnchorX + fAnchorY;
- break;
- case 180:
- m.a = -1, m.b = 0, m.c = 0, m.d = -1, m.e = fAnchorX * 2,
- m.f = fAnchorY * 2;
- break;
- case 270:
- m.a = 0, m.b = 1, m.c = -1, m.d = 0, m.e = fAnchorX + fAnchorY,
- m.f = fAnchorY - fAnchorX;
- break;
- }
-}
-
-CFX_Matrix CXFA_FFWidget::GetRotateMatrix() {
- CFX_Matrix mt;
- int32_t iRotate = m_pDataAcc->GetRotate();
- if (!iRotate)
- return mt;
-
- CFX_RectF rcWidget = GetRectWithoutRotate();
- XFA_ATTRIBUTEENUM at = XFA_ATTRIBUTEENUM_TopLeft;
- XFA_GetMatrix(mt, iRotate, at, rcWidget);
-
- return mt;
-}
-
-bool CXFA_FFWidget::IsLayoutRectEmpty() {
- CFX_RectF rtLayout = GetRectWithoutRotate();
- return rtLayout.width < 0.1f && rtLayout.height < 0.1f;
-}
-CXFA_FFWidget* CXFA_FFWidget::GetParent() {
- CXFA_Node* pParentNode =
- m_pDataAcc->GetNode()->GetNodeItem(XFA_NODEITEM_Parent);
- if (pParentNode) {
- CXFA_WidgetAcc* pParentWidgetAcc =
- static_cast<CXFA_WidgetAcc*>(pParentNode->GetWidgetData());
- if (pParentWidgetAcc) {
- return pParentWidgetAcc->GetNextWidget(nullptr);
- }
- }
- return nullptr;
-}
-
-bool CXFA_FFWidget::IsAncestorOf(CXFA_FFWidget* pWidget) {
- if (!pWidget)
- return false;
-
- CXFA_Node* pNode = m_pDataAcc->GetNode();
- CXFA_Node* pChildNode = pWidget->GetDataAcc()->GetNode();
- while (pChildNode) {
- if (pChildNode == pNode)
- return true;
-
- pChildNode = pChildNode->GetNodeItem(XFA_NODEITEM_Parent);
- }
- return false;
-}
-
-bool CXFA_FFWidget::PtInActiveRect(const CFX_PointF& point) {
- return GetWidgetRect().Contains(point);
-}
-
-CXFA_FFDocView* CXFA_FFWidget::GetDocView() {
- return m_pDocView;
-}
-
-void CXFA_FFWidget::SetDocView(CXFA_FFDocView* pDocView) {
- m_pDocView = pDocView;
-}
-
-CXFA_FFDoc* CXFA_FFWidget::GetDoc() {
- return m_pDocView->GetDoc();
-}
-
-CXFA_FFApp* CXFA_FFWidget::GetApp() {
- return GetDoc()->GetApp();
-}
-
-IXFA_AppProvider* CXFA_FFWidget::GetAppProvider() {
- return GetApp()->GetAppProvider();
-}
-
-bool CXFA_FFWidget::IsMatchVisibleStatus(uint32_t dwStatus) {
- return !!(m_dwStatus & XFA_WidgetStatus_Visible);
-}
-
-void CXFA_FFWidget::EventKillFocus() {
- if (m_dwStatus & XFA_WidgetStatus_Access) {
- m_dwStatus &= ~XFA_WidgetStatus_Access;
- return;
- }
- CXFA_EventParam eParam;
- eParam.m_eType = XFA_EVENT_Exit;
- eParam.m_pTarget = m_pDataAcc;
- m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Exit, &eParam);
-}
-bool CXFA_FFWidget::IsButtonDown() {
- return (m_dwStatus & XFA_WidgetStatus_ButtonDown) != 0;
-}
-void CXFA_FFWidget::SetButtonDown(bool bSet) {
- bSet ? m_dwStatus |= XFA_WidgetStatus_ButtonDown
- : m_dwStatus &= ~XFA_WidgetStatus_ButtonDown;
-}
-int32_t XFA_StrokeTypeSetLineDash(CFX_Graphics* pGraphics,
- int32_t iStrokeType,
- int32_t iCapType) {
- switch (iStrokeType) {
- case XFA_ATTRIBUTEENUM_DashDot: {
- FX_FLOAT dashArray[] = {4, 1, 2, 1};
- if (iCapType != XFA_ATTRIBUTEENUM_Butt) {
- dashArray[1] = 2;
- dashArray[3] = 2;
- }
- pGraphics->SetLineDash(0, dashArray, 4);
- return FX_DASHSTYLE_DashDot;
- }
- case XFA_ATTRIBUTEENUM_DashDotDot: {
- FX_FLOAT dashArray[] = {4, 1, 2, 1, 2, 1};
- if (iCapType != XFA_ATTRIBUTEENUM_Butt) {
- dashArray[1] = 2;
- dashArray[3] = 2;
- dashArray[5] = 2;
- }
- pGraphics->SetLineDash(0, dashArray, 6);
- return FX_DASHSTYLE_DashDotDot;
- }
- case XFA_ATTRIBUTEENUM_Dashed: {
- FX_FLOAT dashArray[] = {5, 1};
- if (iCapType != XFA_ATTRIBUTEENUM_Butt) {
- dashArray[1] = 2;
- }
- pGraphics->SetLineDash(0, dashArray, 2);
- return FX_DASHSTYLE_Dash;
- }
- case XFA_ATTRIBUTEENUM_Dotted: {
- FX_FLOAT dashArray[] = {2, 1};
- if (iCapType != XFA_ATTRIBUTEENUM_Butt) {
- dashArray[1] = 2;
- }
- pGraphics->SetLineDash(0, dashArray, 2);
- return FX_DASHSTYLE_Dot;
- }
- default:
- break;
- }
- pGraphics->SetLineDash(FX_DASHSTYLE_Solid);
- return FX_DASHSTYLE_Solid;
-}
-CFX_GraphStateData::LineCap XFA_LineCapToFXGE(int32_t iLineCap) {
- switch (iLineCap) {
- case XFA_ATTRIBUTEENUM_Round:
- return CFX_GraphStateData::LineCapRound;
- case XFA_ATTRIBUTEENUM_Butt:
- return CFX_GraphStateData::LineCapButt;
- default:
- break;
- }
- return CFX_GraphStateData::LineCapSquare;
-}
-
-class CXFA_ImageRenderer {
- public:
- CXFA_ImageRenderer();
- ~CXFA_ImageRenderer();
-
- bool Start(CFX_RenderDevice* pDevice,
- CFX_DIBSource* pDIBSource,
- FX_ARGB bitmap_argb,
- int bitmap_alpha,
- const CFX_Matrix* pImage2Device,
- uint32_t flags,
- int blendType = FXDIB_BLEND_NORMAL);
- bool Continue(IFX_Pause* pPause);
-
- protected:
- bool StartDIBSource();
- void CompositeDIBitmap(CFX_DIBitmap* pDIBitmap,
- int left,
- int top,
- FX_ARGB mask_argb,
- int bitmap_alpha,
- int blend_mode,
- int Transparency);
-
- CFX_RenderDevice* m_pDevice;
- int m_Status;
- CFX_Matrix m_ImageMatrix;
- CFX_DIBSource* m_pDIBSource;
- std::unique_ptr<CFX_DIBitmap> m_pCloneConvert;
- int m_BitmapAlpha;
- FX_ARGB m_FillArgb;
- uint32_t m_Flags;
- std::unique_ptr<CFX_ImageTransformer> m_pTransformer;
- void* m_DeviceHandle;
- int32_t m_BlendType;
- bool m_Result;
- bool m_bPrint;
-};
-
-CXFA_ImageRenderer::CXFA_ImageRenderer()
- : m_pDevice(nullptr),
- m_Status(0),
- m_pDIBSource(nullptr),
- m_BitmapAlpha(255),
- m_FillArgb(0),
- m_Flags(0),
- m_DeviceHandle(nullptr),
- m_BlendType(FXDIB_BLEND_NORMAL),
- m_Result(true),
- m_bPrint(false) {}
-
-CXFA_ImageRenderer::~CXFA_ImageRenderer() {
- if (m_DeviceHandle)
- m_pDevice->CancelDIBits(m_DeviceHandle);
-}
-
-bool CXFA_ImageRenderer::Start(CFX_RenderDevice* pDevice,
- CFX_DIBSource* pDIBSource,
- FX_ARGB bitmap_argb,
- int bitmap_alpha,
- const CFX_Matrix* pImage2Device,
- uint32_t flags,
- int blendType) {
- m_pDevice = pDevice;
- m_pDIBSource = pDIBSource;
- m_FillArgb = bitmap_argb;
- m_BitmapAlpha = bitmap_alpha;
- m_ImageMatrix = *pImage2Device;
- m_Flags = flags;
- m_BlendType = blendType;
- return StartDIBSource();
-}
-
-bool CXFA_ImageRenderer::StartDIBSource() {
- if (m_pDevice->StartDIBitsWithBlend(m_pDIBSource, m_BitmapAlpha, m_FillArgb,
- &m_ImageMatrix, m_Flags, m_DeviceHandle,
- m_BlendType)) {
- if (m_DeviceHandle) {
- m_Status = 3;
- return true;
- }
- return false;
- }
- CFX_FloatRect image_rect_f = m_ImageMatrix.GetUnitRect();
- FX_RECT image_rect = image_rect_f.GetOuterRect();
- int dest_width = image_rect.Width();
- int dest_height = image_rect.Height();
- if ((FXSYS_fabs(m_ImageMatrix.b) >= 0.5f || m_ImageMatrix.a == 0) ||
- (FXSYS_fabs(m_ImageMatrix.c) >= 0.5f || m_ImageMatrix.d == 0)) {
- if (m_bPrint && !(m_pDevice->GetRenderCaps() & FXRC_BLEND_MODE)) {
- m_Result = false;
- return false;
- }
- CFX_DIBSource* pDib = m_pDIBSource;
- if (m_pDIBSource->HasAlpha() &&
- !(m_pDevice->GetRenderCaps() & FXRC_ALPHA_IMAGE) &&
- !(m_pDevice->GetRenderCaps() & FXRC_GET_BITS)) {
- m_pCloneConvert = m_pDIBSource->CloneConvert(FXDIB_Rgb);
- if (!m_pCloneConvert) {
- m_Result = false;
- return false;
- }
- pDib = m_pCloneConvert.get();
- }
- FX_RECT clip_box = m_pDevice->GetClipBox();
- clip_box.Intersect(image_rect);
- m_Status = 2;
- m_pTransformer.reset(
- new CFX_ImageTransformer(pDib, &m_ImageMatrix, m_Flags, &clip_box));
- m_pTransformer->Start();
- return true;
- }
- if (m_ImageMatrix.a < 0) {
- dest_width = -dest_width;
- }
- if (m_ImageMatrix.d > 0) {
- dest_height = -dest_height;
- }
- int dest_left, dest_top;
- dest_left = dest_width > 0 ? image_rect.left : image_rect.right;
- dest_top = dest_height > 0 ? image_rect.top : image_rect.bottom;
- if (m_pDIBSource->IsOpaqueImage() && m_BitmapAlpha == 255) {
- if (m_pDevice->StretchDIBitsWithFlagsAndBlend(
- m_pDIBSource, dest_left, dest_top, dest_width, dest_height, m_Flags,
- m_BlendType)) {
- return false;
- }
- }
- if (m_pDIBSource->IsAlphaMask()) {
- if (m_BitmapAlpha != 255) {
- m_FillArgb = FXARGB_MUL_ALPHA(m_FillArgb, m_BitmapAlpha);
- }
- if (m_pDevice->StretchBitMaskWithFlags(m_pDIBSource, dest_left, dest_top,
- dest_width, dest_height, m_FillArgb,
- m_Flags)) {
- return false;
- }
- }
- if (m_bPrint && !(m_pDevice->GetRenderCaps() & FXRC_BLEND_MODE)) {
- m_Result = false;
- return true;
- }
- FX_RECT clip_box = m_pDevice->GetClipBox();
- FX_RECT dest_rect = clip_box;
- dest_rect.Intersect(image_rect);
- FX_RECT dest_clip(
- dest_rect.left - image_rect.left, dest_rect.top - image_rect.top,
- dest_rect.right - image_rect.left, dest_rect.bottom - image_rect.top);
- std::unique_ptr<CFX_DIBitmap> pStretched(
- m_pDIBSource->StretchTo(dest_width, dest_height, m_Flags, &dest_clip));
- if (pStretched) {
- CompositeDIBitmap(pStretched.get(), dest_rect.left, dest_rect.top,
- m_FillArgb, m_BitmapAlpha, m_BlendType, false);
- }
- return false;
-}
-
-bool CXFA_ImageRenderer::Continue(IFX_Pause* pPause) {
- if (m_Status == 2) {
- if (m_pTransformer->Continue(pPause))
- return true;
-
- std::unique_ptr<CFX_DIBitmap> pBitmap(m_pTransformer->DetachBitmap());
- if (!pBitmap)
- return false;
-
- if (pBitmap->IsAlphaMask()) {
- if (m_BitmapAlpha != 255)
- m_FillArgb = FXARGB_MUL_ALPHA(m_FillArgb, m_BitmapAlpha);
- m_Result =
- m_pDevice->SetBitMask(pBitmap.get(), m_pTransformer->result().left,
- m_pTransformer->result().top, m_FillArgb);
- } else {
- if (m_BitmapAlpha != 255)
- pBitmap->MultiplyAlpha(m_BitmapAlpha);
- m_Result = m_pDevice->SetDIBitsWithBlend(
- pBitmap.get(), m_pTransformer->result().left,
- m_pTransformer->result().top, m_BlendType);
- }
- return false;
- }
- if (m_Status == 3)
- return m_pDevice->ContinueDIBits(m_DeviceHandle, pPause);
-
- return false;
-}
-
-void CXFA_ImageRenderer::CompositeDIBitmap(CFX_DIBitmap* pDIBitmap,
- int left,
- int top,
- FX_ARGB mask_argb,
- int bitmap_alpha,
- int blend_mode,
- int Transparency) {
- if (!pDIBitmap) {
- return;
- }
- bool bIsolated = !!(Transparency & PDFTRANS_ISOLATED);
- bool bGroup = !!(Transparency & PDFTRANS_GROUP);
- if (blend_mode == FXDIB_BLEND_NORMAL) {
- if (!pDIBitmap->IsAlphaMask()) {
- if (bitmap_alpha < 255) {
- pDIBitmap->MultiplyAlpha(bitmap_alpha);
- }
- if (m_pDevice->SetDIBits(pDIBitmap, left, top)) {
- return;
- }
- } else {
- uint32_t fill_argb = (mask_argb);
- if (bitmap_alpha < 255) {
- ((uint8_t*)&fill_argb)[3] =
- ((uint8_t*)&fill_argb)[3] * bitmap_alpha / 255;
- }
- if (m_pDevice->SetBitMask(pDIBitmap, left, top, fill_argb)) {
- return;
- }
- }
- }
- bool bBackAlphaRequired = blend_mode && bIsolated;
- bool bGetBackGround =
- ((m_pDevice->GetRenderCaps() & FXRC_ALPHA_OUTPUT)) ||
- (!(m_pDevice->GetRenderCaps() & FXRC_ALPHA_OUTPUT) &&
- (m_pDevice->GetRenderCaps() & FXRC_GET_BITS) && !bBackAlphaRequired);
- if (bGetBackGround) {
- if (bIsolated || !bGroup) {
- if (pDIBitmap->IsAlphaMask()) {
- return;
- }
- m_pDevice->SetDIBitsWithBlend(pDIBitmap, left, top, blend_mode);
- } else {
- FX_RECT rect(left, top, left + pDIBitmap->GetWidth(),
- top + pDIBitmap->GetHeight());
- rect.Intersect(m_pDevice->GetClipBox());
- CFX_MaybeOwned<CFX_DIBitmap> pClone;
- if (m_pDevice->GetBackDrop() && m_pDevice->GetBitmap()) {
- pClone = m_pDevice->GetBackDrop()->Clone(&rect);
- CFX_DIBitmap* pForeBitmap = m_pDevice->GetBitmap();
- pClone->CompositeBitmap(0, 0, pClone->GetWidth(), pClone->GetHeight(),
- pForeBitmap, rect.left, rect.top);
- left = left >= 0 ? 0 : left;
- top = top >= 0 ? 0 : top;
- if (!pDIBitmap->IsAlphaMask())
- pClone->CompositeBitmap(0, 0, pClone->GetWidth(), pClone->GetHeight(),
- pDIBitmap, left, top, blend_mode);
- else
- pClone->CompositeMask(0, 0, pClone->GetWidth(), pClone->GetHeight(),
- pDIBitmap, mask_argb, left, top, blend_mode);
- } else {
- pClone = pDIBitmap;
- }
- if (m_pDevice->GetBackDrop()) {
- m_pDevice->SetDIBits(pClone.Get(), rect.left, rect.top);
- } else {
- if (pDIBitmap->IsAlphaMask())
- return;
- m_pDevice->SetDIBitsWithBlend(pDIBitmap, rect.left, rect.top,
- blend_mode);
- }
- }
- return;
- }
- if (!pDIBitmap->HasAlpha() ||
- (m_pDevice->GetRenderCaps() & FXRC_ALPHA_IMAGE)) {
- return;
- }
- std::unique_ptr<CFX_DIBitmap> pCloneConvert =
- pDIBitmap->CloneConvert(FXDIB_Rgb);
- if (!pCloneConvert)
- return;
-
- CXFA_ImageRenderer imageRender;
- if (!imageRender.Start(m_pDevice, pCloneConvert.get(), m_FillArgb,
- m_BitmapAlpha, &m_ImageMatrix, m_Flags)) {
- return;
- }
- while (imageRender.Continue(nullptr))
- continue;
-}
-
-void XFA_DrawImage(CFX_Graphics* pGS,
- const CFX_RectF& rtImage,
- CFX_Matrix* pMatrix,
- CFX_DIBitmap* pDIBitmap,
- int32_t iAspect,
- int32_t iImageXDpi,
- int32_t iImageYDpi,
- int32_t iHorzAlign,
- int32_t iVertAlign) {
- if (rtImage.IsEmpty())
- return;
- if (!pDIBitmap || !pDIBitmap->GetBuffer())
- return;
-
- CFX_RectF rtFit(
- rtImage.TopLeft(),
- XFA_UnitPx2Pt((FX_FLOAT)pDIBitmap->GetWidth(), (FX_FLOAT)iImageXDpi),
- XFA_UnitPx2Pt((FX_FLOAT)pDIBitmap->GetHeight(), (FX_FLOAT)iImageYDpi));
- switch (iAspect) {
- case XFA_ATTRIBUTEENUM_Fit: {
- FX_FLOAT f1 = rtImage.height / rtFit.height;
- FX_FLOAT f2 = rtImage.width / rtFit.width;
- f1 = std::min(f1, f2);
- rtFit.height = rtFit.height * f1;
- rtFit.width = rtFit.width * f1;
- } break;
- case XFA_ATTRIBUTEENUM_Actual:
- break;
- case XFA_ATTRIBUTEENUM_Height: {
- FX_FLOAT f1 = rtImage.height / rtFit.height;
- rtFit.height = rtImage.height;
- rtFit.width = f1 * rtFit.width;
- } break;
- case XFA_ATTRIBUTEENUM_None:
- rtFit.height = rtImage.height;
- rtFit.width = rtImage.width;
- break;
- case XFA_ATTRIBUTEENUM_Width: {
- FX_FLOAT f1 = rtImage.width / rtFit.width;
- rtFit.width = rtImage.width;
- rtFit.height = rtFit.height * f1;
- } break;
- }
- if (iHorzAlign == XFA_ATTRIBUTEENUM_Center) {
- rtFit.left += (rtImage.width - rtFit.width) / 2;
- } else if (iHorzAlign == XFA_ATTRIBUTEENUM_Right) {
- rtFit.left = rtImage.right() - rtFit.width;
- }
- if (iVertAlign == XFA_ATTRIBUTEENUM_Middle) {
- rtFit.top += (rtImage.height - rtFit.height) / 2;
- } else if (iVertAlign == XFA_ATTRIBUTEENUM_Bottom) {
- rtFit.top = rtImage.bottom() - rtImage.height;
- }
- CFX_RenderDevice* pRenderDevice = pGS->GetRenderDevice();
- pRenderDevice->SaveState();
-
- CFX_PathData path;
- path.AppendRect(rtImage.left, rtImage.bottom(), rtImage.right(), rtImage.top);
- pRenderDevice->SetClip_PathFill(&path, pMatrix, FXFILL_WINDING);
-
- CFX_Matrix mtImage(1, 0, 0, -1, 0, 1);
- mtImage.Concat(
- CFX_Matrix(rtFit.width, 0, 0, rtFit.height, rtFit.left, rtFit.top));
- mtImage.Concat(*pMatrix);
-
- CXFA_ImageRenderer imageRender;
- bool bRet = imageRender.Start(pRenderDevice, pDIBitmap, 0, 255, &mtImage,
- FXDIB_INTERPOL);
- while (bRet)
- bRet = imageRender.Continue(nullptr);
-
- pRenderDevice->RestoreState(false);
-}
-
-static const uint8_t g_inv_base64[128] = {
- 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
- 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
- 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 62, 255,
- 255, 255, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 255, 255,
- 255, 255, 255, 255, 255, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
- 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
- 25, 255, 255, 255, 255, 255, 255, 26, 27, 28, 29, 30, 31, 32, 33,
- 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
- 49, 50, 51, 255, 255, 255, 255, 255,
-};
-
-static uint8_t* XFA_RemoveBase64Whitespace(const uint8_t* pStr, int32_t iLen) {
- uint8_t* pCP;
- int32_t i = 0, j = 0;
- if (iLen == 0) {
- iLen = FXSYS_strlen((FX_CHAR*)pStr);
- }
- pCP = FX_Alloc(uint8_t, iLen + 1);
- for (; i < iLen; i++) {
- if ((pStr[i] & 128) == 0) {
- if (g_inv_base64[pStr[i]] != 0xFF || pStr[i] == '=') {
- pCP[j++] = pStr[i];
- }
- }
- }
- pCP[j] = '\0';
- return pCP;
-}
-static int32_t XFA_Base64Decode(const FX_CHAR* pStr, uint8_t* pOutBuffer) {
- if (!pStr) {
- return 0;
- }
- uint8_t* pBuffer =
- XFA_RemoveBase64Whitespace((uint8_t*)pStr, FXSYS_strlen((FX_CHAR*)pStr));
- if (!pBuffer) {
- return 0;
- }
- int32_t iLen = FXSYS_strlen((FX_CHAR*)pBuffer);
- int32_t i = 0, j = 0;
- uint32_t dwLimb = 0;
- for (; i + 3 < iLen; i += 4) {
- if (pBuffer[i] == '=' || pBuffer[i + 1] == '=' || pBuffer[i + 2] == '=' ||
- pBuffer[i + 3] == '=') {
- if (pBuffer[i] == '=' || pBuffer[i + 1] == '=') {
- break;
- }
- if (pBuffer[i + 2] == '=') {
- dwLimb = ((uint32_t)g_inv_base64[pBuffer[i]] << 6) |
- ((uint32_t)g_inv_base64[pBuffer[i + 1]]);
- pOutBuffer[j] = (uint8_t)(dwLimb >> 4) & 0xFF;
- j++;
- } else {
- dwLimb = ((uint32_t)g_inv_base64[pBuffer[i]] << 12) |
- ((uint32_t)g_inv_base64[pBuffer[i + 1]] << 6) |
- ((uint32_t)g_inv_base64[pBuffer[i + 2]]);
- pOutBuffer[j] = (uint8_t)(dwLimb >> 10) & 0xFF;
- pOutBuffer[j + 1] = (uint8_t)(dwLimb >> 2) & 0xFF;
- j += 2;
- }
- } else {
- dwLimb = ((uint32_t)g_inv_base64[pBuffer[i]] << 18) |
- ((uint32_t)g_inv_base64[pBuffer[i + 1]] << 12) |
- ((uint32_t)g_inv_base64[pBuffer[i + 2]] << 6) |
- ((uint32_t)g_inv_base64[pBuffer[i + 3]]);
- pOutBuffer[j] = (uint8_t)(dwLimb >> 16) & 0xff;
- pOutBuffer[j + 1] = (uint8_t)(dwLimb >> 8) & 0xff;
- pOutBuffer[j + 2] = (uint8_t)(dwLimb)&0xff;
- j += 3;
- }
- }
- FX_Free(pBuffer);
- return j;
-}
-
-static const FX_CHAR g_base64_chars[] =
- "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-
-FX_CHAR* XFA_Base64Encode(const uint8_t* buf, int32_t buf_len) {
- FX_CHAR* out = nullptr;
- int i, j;
- uint32_t limb;
- out = FX_Alloc(FX_CHAR, ((buf_len * 8 + 5) / 6) + 5);
- for (i = 0, j = 0, limb = 0; i + 2 < buf_len; i += 3, j += 4) {
- limb = ((uint32_t)buf[i] << 16) | ((uint32_t)buf[i + 1] << 8) |
- ((uint32_t)buf[i + 2]);
- out[j] = g_base64_chars[(limb >> 18) & 63];
- out[j + 1] = g_base64_chars[(limb >> 12) & 63];
- out[j + 2] = g_base64_chars[(limb >> 6) & 63];
- out[j + 3] = g_base64_chars[(limb)&63];
- }
- switch (buf_len - i) {
- case 0:
- break;
- case 1:
- limb = ((uint32_t)buf[i]);
- out[j++] = g_base64_chars[(limb >> 2) & 63];
- out[j++] = g_base64_chars[(limb << 4) & 63];
- out[j++] = '=';
- out[j++] = '=';
- break;
- case 2:
- limb = ((uint32_t)buf[i] << 8) | ((uint32_t)buf[i + 1]);
- out[j++] = g_base64_chars[(limb >> 10) & 63];
- out[j++] = g_base64_chars[(limb >> 4) & 63];
- out[j++] = g_base64_chars[(limb << 2) & 63];
- out[j++] = '=';
- break;
- default:
- break;
- }
- out[j] = '\0';
- return out;
-}
-FXCODEC_IMAGE_TYPE XFA_GetImageType(const CFX_WideString& wsType) {
- CFX_WideString wsContentType(wsType);
- wsContentType.MakeLower();
- if (wsContentType == L"image/jpg")
- return FXCODEC_IMAGE_JPG;
- if (wsContentType == L"image/png")
- return FXCODEC_IMAGE_PNG;
- if (wsContentType == L"image/gif")
- return FXCODEC_IMAGE_GIF;
- if (wsContentType == L"image/bmp")
- return FXCODEC_IMAGE_BMP;
- if (wsContentType == L"image/tif")
- return FXCODEC_IMAGE_TIF;
- return FXCODEC_IMAGE_UNKNOWN;
-}
-CFX_DIBitmap* XFA_LoadImageData(CXFA_FFDoc* pDoc,
- CXFA_Image* pImage,
- bool& bNameImage,
- int32_t& iImageXDpi,
- int32_t& iImageYDpi) {
- CFX_WideString wsHref;
- pImage->GetHref(wsHref);
- CFX_WideString wsImage;
- pImage->GetContent(wsImage);
- if (wsHref.IsEmpty() && wsImage.IsEmpty()) {
- return nullptr;
- }
- CFX_WideString wsContentType;
- pImage->GetContentType(wsContentType);
- FXCODEC_IMAGE_TYPE type = XFA_GetImageType(wsContentType);
- CFX_ByteString bsContent;
- uint8_t* pImageBuffer = nullptr;
- CFX_RetainPtr<IFX_SeekableReadStream> pImageFileRead;
- if (wsImage.GetLength() > 0) {
- XFA_ATTRIBUTEENUM iEncoding =
- (XFA_ATTRIBUTEENUM)pImage->GetTransferEncoding();
- if (iEncoding == XFA_ATTRIBUTEENUM_Base64) {
- CFX_ByteString bsData = wsImage.UTF8Encode();
- int32_t iLength = bsData.GetLength();
- pImageBuffer = FX_Alloc(uint8_t, iLength);
- int32_t iRead = XFA_Base64Decode(bsData.c_str(), pImageBuffer);
- if (iRead > 0) {
- pImageFileRead = IFX_MemoryStream::Create(pImageBuffer, iRead);
- }
- } else {
- bsContent = CFX_ByteString::FromUnicode(wsImage);
- pImageFileRead = IFX_MemoryStream::Create(
- const_cast<uint8_t*>(bsContent.raw_str()), bsContent.GetLength());
- }
- } else {
- CFX_WideString wsURL = wsHref;
- if (wsURL.Left(7) != L"http://" && wsURL.Left(6) != L"ftp://") {
- CFX_DIBitmap* pBitmap =
- pDoc->GetPDFNamedImage(wsURL.AsStringC(), iImageXDpi, iImageYDpi);
- if (pBitmap) {
- bNameImage = true;
- return pBitmap;
- }
- }
- pImageFileRead = pDoc->GetDocEnvironment()->OpenLinkedFile(pDoc, wsURL);
- }
- if (!pImageFileRead) {
- FX_Free(pImageBuffer);
- return nullptr;
- }
- bNameImage = false;
- CFX_DIBitmap* pBitmap =
- XFA_LoadImageFromBuffer(pImageFileRead, type, iImageXDpi, iImageYDpi);
- FX_Free(pImageBuffer);
- return pBitmap;
-}
-static FXDIB_Format XFA_GetDIBFormat(FXCODEC_IMAGE_TYPE type,
- int32_t iComponents,
- int32_t iBitsPerComponent) {
- FXDIB_Format dibFormat = FXDIB_Argb;
- switch (type) {
- case FXCODEC_IMAGE_BMP:
- case FXCODEC_IMAGE_JPG:
- case FXCODEC_IMAGE_TIF: {
- dibFormat = FXDIB_Rgb32;
- int32_t bpp = iComponents * iBitsPerComponent;
- if (bpp <= 24) {
- dibFormat = FXDIB_Rgb;
- }
- } break;
- case FXCODEC_IMAGE_PNG:
- default:
- break;
- }
- return dibFormat;
-}
-
-CFX_DIBitmap* XFA_LoadImageFromBuffer(
- const CFX_RetainPtr<IFX_SeekableReadStream>& pImageFileRead,
- FXCODEC_IMAGE_TYPE type,
- int32_t& iImageXDpi,
- int32_t& iImageYDpi) {
- CFX_GEModule* pGeModule = CFX_GEModule::Get();
- if (!pGeModule)
- return nullptr;
-
- CCodec_ModuleMgr* pCodecMgr = pGeModule->GetCodecModule();
- if (!pCodecMgr)
- return nullptr;
-
- CFX_DIBAttribute dibAttr;
- CFX_DIBitmap* pBitmap = nullptr;
- std::unique_ptr<CCodec_ProgressiveDecoder> pProgressiveDecoder =
- pCodecMgr->CreateProgressiveDecoder();
- pProgressiveDecoder->LoadImageInfo(pImageFileRead, type, &dibAttr, false);
- switch (dibAttr.m_wDPIUnit) {
- case FXCODEC_RESUNIT_CENTIMETER:
- dibAttr.m_nXDPI = (int32_t)(dibAttr.m_nXDPI * 2.54f);
- dibAttr.m_nYDPI = (int32_t)(dibAttr.m_nYDPI * 2.54f);
- break;
- case FXCODEC_RESUNIT_METER:
- dibAttr.m_nXDPI = (int32_t)(dibAttr.m_nXDPI / (FX_FLOAT)100 * 2.54f);
- dibAttr.m_nYDPI = (int32_t)(dibAttr.m_nYDPI / (FX_FLOAT)100 * 2.54f);
- break;
- default:
- break;
- }
- iImageXDpi = dibAttr.m_nXDPI > 1 ? dibAttr.m_nXDPI : (96);
- iImageYDpi = dibAttr.m_nYDPI > 1 ? dibAttr.m_nYDPI : (96);
- if (pProgressiveDecoder->GetWidth() > 0 &&
- pProgressiveDecoder->GetHeight() > 0) {
- type = pProgressiveDecoder->GetType();
- int32_t iComponents = pProgressiveDecoder->GetNumComponents();
- int32_t iBpc = pProgressiveDecoder->GetBPC();
- FXDIB_Format dibFormat = XFA_GetDIBFormat(type, iComponents, iBpc);
- pBitmap = new CFX_DIBitmap();
- pBitmap->Create(pProgressiveDecoder->GetWidth(),
- pProgressiveDecoder->GetHeight(), dibFormat);
- pBitmap->Clear(0xffffffff);
- int32_t nFrames;
- if ((pProgressiveDecoder->GetFrames(nFrames) ==
- FXCODEC_STATUS_DECODE_READY) &&
- (nFrames > 0)) {
- pProgressiveDecoder->StartDecode(pBitmap, 0, 0, pBitmap->GetWidth(),
- pBitmap->GetHeight());
- pProgressiveDecoder->ContinueDecode();
- }
- }
- return pBitmap;
-}
-
-void XFA_RectWidthoutMargin(CFX_RectF& rt, const CXFA_Margin& mg, bool bUI) {
- if (!mg) {
- return;
- }
- FX_FLOAT fLeftInset, fTopInset, fRightInset, fBottomInset;
- mg.GetLeftInset(fLeftInset);
- mg.GetTopInset(fTopInset);
- mg.GetRightInset(fRightInset);
- mg.GetBottomInset(fBottomInset);
- rt.Deflate(fLeftInset, fTopInset, fRightInset, fBottomInset);
-}
-CXFA_FFWidget* XFA_GetWidgetFromLayoutItem(CXFA_LayoutItem* pLayoutItem) {
- if (XFA_IsCreateWidget(pLayoutItem->GetFormNode()->GetElementType()))
- return static_cast<CXFA_FFWidget*>(pLayoutItem);
- return nullptr;
-}
-bool XFA_IsCreateWidget(XFA_Element eType) {
- return eType == XFA_Element::Field || eType == XFA_Element::Draw ||
- eType == XFA_Element::Subform || eType == XFA_Element::ExclGroup;
-}
-static void XFA_BOX_GetPath_Arc(CXFA_Box box,
- CFX_RectF rtDraw,
- CFX_Path& fillPath,
- uint32_t dwFlags) {
- FX_FLOAT a, b;
- a = rtDraw.width / 2.0f;
- b = rtDraw.height / 2.0f;
- if (box.IsCircular() || (dwFlags & XFA_DRAWBOX_ForceRound) != 0) {
- a = b = std::min(a, b);
- }
- CFX_PointF center = rtDraw.Center();
- rtDraw.left = center.x - a;
- rtDraw.top = center.y - b;
- rtDraw.width = a + a;
- rtDraw.height = b + b;
- FX_FLOAT startAngle = 0, sweepAngle = 360;
- bool bStart = box.GetStartAngle(startAngle);
- bool bEnd = box.GetSweepAngle(sweepAngle);
- if (!bStart && !bEnd) {
- fillPath.AddEllipse(rtDraw);
- return;
- }
- startAngle = -startAngle * FX_PI / 180.0f;
- sweepAngle = -sweepAngle * FX_PI / 180.0f;
- fillPath.AddArc(rtDraw.TopLeft(), rtDraw.Size(), startAngle, sweepAngle);
-}
-
-static void XFA_BOX_GetPath(CXFA_Box box,
- const std::vector<CXFA_Stroke>& strokes,
- CFX_RectF rtWidget,
- CFX_Path& path,
- int32_t nIndex,
- bool bStart,
- bool bCorner) {
- ASSERT(nIndex >= 0 && nIndex < 8);
- int32_t n = (nIndex & 1) ? nIndex - 1 : nIndex;
- CXFA_Corner corner1(strokes[n].GetNode());
- CXFA_Corner corner2(strokes[(n + 2) % 8].GetNode());
- FX_FLOAT fRadius1 = bCorner ? corner1.GetRadius() : 0.0f;
- FX_FLOAT fRadius2 = bCorner ? corner2.GetRadius() : 0.0f;
- bool bInverted = corner1.IsInverted();
- FX_FLOAT offsetY = 0.0f;
- FX_FLOAT offsetX = 0.0f;
- bool bRound = corner1.GetJoinType() == XFA_ATTRIBUTEENUM_Round;
- FX_FLOAT halfAfter = 0.0f;
- FX_FLOAT halfBefore = 0.0f;
- CXFA_Stroke stroke = strokes[nIndex];
- if (stroke.IsCorner()) {
- CXFA_Stroke edgeBefore = strokes[(nIndex + 1 * 8 - 1) % 8];
- CXFA_Stroke edgeAfter = strokes[nIndex + 1];
- if (stroke.IsInverted()) {
- if (!stroke.SameStyles(edgeBefore)) {
- halfBefore = edgeBefore.GetThickness() / 2;
- }
- if (!stroke.SameStyles(edgeAfter)) {
- halfAfter = edgeAfter.GetThickness() / 2;
- }
- }
- } else {
- CXFA_Stroke edgeBefore = strokes[(nIndex + 8 - 2) % 8];
- CXFA_Stroke edgeAfter = strokes[(nIndex + 2) % 8];
- if (!bRound && !bInverted) {
- halfBefore = edgeBefore.GetThickness() / 2;
- halfAfter = edgeAfter.GetThickness() / 2;
- }
- }
- FX_FLOAT offsetEX = 0.0f;
- FX_FLOAT offsetEY = 0.0f;
- FX_FLOAT sx = 0.0f;
- FX_FLOAT sy = 0.0f;
- FX_FLOAT vx = 1.0f;
- FX_FLOAT vy = 1.0f;
- FX_FLOAT nx = 1.0f;
- FX_FLOAT ny = 1.0f;
- CFX_PointF cpStart;
- CFX_PointF cp1;
- CFX_PointF cp2;
- if (bRound) {
- sy = FX_PI / 2;
- }
- switch (nIndex) {
- case 0:
- case 1:
- cp1 = rtWidget.TopLeft();
- cp2 = rtWidget.TopRight();
- if (nIndex == 0) {
- cpStart.x = cp1.x - halfBefore;
- cpStart.y = cp1.y + fRadius1, offsetY = -halfAfter;
- } else {
- cpStart.x = cp1.x + fRadius1 - halfBefore, cpStart.y = cp1.y,
- offsetEX = halfAfter;
- }
- vx = 1, vy = 1;
- nx = -1, ny = 0;
- if (bRound) {
- sx = bInverted ? FX_PI / 2 : FX_PI;
- } else {
- sx = 1, sy = 0;
- }
- break;
- case 2:
- case 3:
- cp1 = rtWidget.TopRight();
- cp2 = rtWidget.BottomRight();
- if (nIndex == 2) {
- cpStart.x = cp1.x - fRadius1, cpStart.y = cp1.y - halfBefore,
- offsetX = halfAfter;
- } else {
- cpStart.x = cp1.x, cpStart.y = cp1.y + fRadius1 - halfBefore,
- offsetEY = halfAfter;
- }
- vx = -1, vy = 1;
- nx = 0, ny = -1;
- if (bRound) {
- sx = bInverted ? FX_PI : FX_PI * 3 / 2;
- } else {
- sx = 0, sy = 1;
- }
- break;
- case 4:
- case 5:
- cp1 = rtWidget.BottomRight();
- cp2 = rtWidget.BottomLeft();
- if (nIndex == 4) {
- cpStart.x = cp1.x + halfBefore, cpStart.y = cp1.y - fRadius1,
- offsetY = halfAfter;
- } else {
- cpStart.x = cp1.x - fRadius1 + halfBefore, cpStart.y = cp1.y,
- offsetEX = -halfAfter;
- }
- vx = -1, vy = -1;
- nx = 1, ny = 0;
- if (bRound) {
- sx = bInverted ? FX_PI * 3 / 2 : 0;
- } else {
- sx = -1, sy = 0;
- }
- break;
- case 6:
- case 7:
- cp1 = rtWidget.BottomLeft();
- cp2 = rtWidget.TopLeft();
- if (nIndex == 6) {
- cpStart.x = cp1.x + fRadius1, cpStart.y = cp1.y + halfBefore,
- offsetX = -halfAfter;
- } else {
- cpStart.x = cp1.x, cpStart.y = cp1.y - fRadius1 + halfBefore,
- offsetEY = -halfAfter;
- }
- vx = 1;
- vy = -1;
- nx = 0;
- ny = 1;
- if (bRound) {
- sx = bInverted ? 0 : FX_PI / 2;
- } else {
- sx = 0;
- sy = -1;
- }
- break;
- }
- if (bStart) {
- path.MoveTo(cpStart);
- }
- if (nIndex & 1) {
- path.LineTo(CFX_PointF(cp2.x + fRadius2 * nx + offsetEX,
- cp2.y + fRadius2 * ny + offsetEY));
- return;
- }
- if (bRound) {
- if (fRadius1 < 0)
- sx -= FX_PI;
- if (bInverted)
- sy *= -1;
-
- CFX_RectF rtRadius(cp1.x + offsetX * 2, cp1.y + offsetY * 2,
- fRadius1 * 2 * vx - offsetX * 2,
- fRadius1 * 2 * vy - offsetY * 2);
- rtRadius.Normalize();
- if (bInverted)
- rtRadius.Offset(-fRadius1 * vx, -fRadius1 * vy);
-
- path.ArcTo(rtRadius.TopLeft(), rtRadius.Size(), sx, sy);
- } else {
- CFX_PointF cp;
- if (bInverted) {
- cp.x = cp1.x + fRadius1 * vx;
- cp.y = cp1.y + fRadius1 * vy;
- } else {
- cp = cp1;
- }
- path.LineTo(cp);
- path.LineTo(CFX_PointF(cp1.x + fRadius1 * sx + offsetX,
- cp1.y + fRadius1 * sy + offsetY));
- }
-}
-static void XFA_BOX_GetFillPath(CXFA_Box box,
- const std::vector<CXFA_Stroke>& strokes,
- CFX_RectF rtWidget,
- CFX_Path& fillPath,
- uint16_t dwFlags) {
- if (box.IsArc() || (dwFlags & XFA_DRAWBOX_ForceRound) != 0) {
- CXFA_Edge edge = box.GetEdge(0);
- FX_FLOAT fThickness = edge.GetThickness();
- if (fThickness < 0) {
- fThickness = 0;
- }
- FX_FLOAT fHalf = fThickness / 2;
- int32_t iHand = box.GetHand();
- if (iHand == XFA_ATTRIBUTEENUM_Left) {
- rtWidget.Inflate(fHalf, fHalf);
- } else if (iHand == XFA_ATTRIBUTEENUM_Right) {
- rtWidget.Deflate(fHalf, fHalf);
- }
- XFA_BOX_GetPath_Arc(box, rtWidget, fillPath, dwFlags);
- return;
- }
- bool bSameStyles = true;
- CXFA_Stroke stroke1 = strokes[0];
- for (int32_t i = 1; i < 8; i++) {
- CXFA_Stroke stroke2 = strokes[i];
- if (!stroke1.SameStyles(stroke2)) {
- bSameStyles = false;
- break;
- }
- stroke1 = stroke2;
- }
- if (bSameStyles) {
- stroke1 = strokes[0];
- for (int32_t i = 2; i < 8; i += 2) {
- CXFA_Stroke stroke2 = strokes[i];
- if (!stroke1.SameStyles(stroke2, XFA_STROKE_SAMESTYLE_NoPresence |
- XFA_STROKE_SAMESTYLE_Corner)) {
- bSameStyles = false;
- break;
- }
- stroke1 = stroke2;
- }
- if (bSameStyles) {
- stroke1 = strokes[0];
- if (stroke1.IsInverted()) {
- bSameStyles = false;
- }
- if (stroke1.GetJoinType() != XFA_ATTRIBUTEENUM_Square) {
- bSameStyles = false;
- }
- }
- }
- if (bSameStyles) {
- fillPath.AddRectangle(rtWidget.left, rtWidget.top, rtWidget.width,
- rtWidget.height);
- return;
- }
-
- for (int32_t i = 0; i < 8; i += 2) {
- FX_FLOAT sx = 0.0f;
- FX_FLOAT sy = 0.0f;
- FX_FLOAT vx = 1.0f;
- FX_FLOAT vy = 1.0f;
- FX_FLOAT nx = 1.0f;
- FX_FLOAT ny = 1.0f;
- CFX_PointF cp1, cp2;
- CXFA_Corner corner1(strokes[i].GetNode());
- CXFA_Corner corner2(strokes[(i + 2) % 8].GetNode());
- FX_FLOAT fRadius1 = corner1.GetRadius();
- FX_FLOAT fRadius2 = corner2.GetRadius();
- bool bInverted = corner1.IsInverted();
- bool bRound = corner1.GetJoinType() == XFA_ATTRIBUTEENUM_Round;
- if (bRound) {
- sy = FX_PI / 2;
- }
- switch (i) {
- case 0:
- cp1 = rtWidget.TopLeft();
- cp2 = rtWidget.TopRight();
- vx = 1, vy = 1;
- nx = -1, ny = 0;
- if (bRound) {
- sx = bInverted ? FX_PI / 2 : FX_PI;
- } else {
- sx = 1, sy = 0;
- }
- break;
- case 2:
- cp1 = rtWidget.TopRight();
- cp2 = rtWidget.BottomRight();
- vx = -1, vy = 1;
- nx = 0, ny = -1;
- if (bRound) {
- sx = bInverted ? FX_PI : FX_PI * 3 / 2;
- } else {
- sx = 0, sy = 1;
- }
- break;
- case 4:
- cp1 = rtWidget.BottomRight();
- cp2 = rtWidget.BottomLeft();
- vx = -1, vy = -1;
- nx = 1, ny = 0;
- if (bRound) {
- sx = bInverted ? FX_PI * 3 / 2 : 0;
- } else {
- sx = -1, sy = 0;
- }
- break;
- case 6:
- cp1 = rtWidget.BottomLeft();
- cp2 = rtWidget.TopLeft();
- vx = 1, vy = -1;
- nx = 0, ny = 1;
- if (bRound) {
- sx = bInverted ? 0 : FX_PI / 2;
- } else {
- sx = 0;
- sy = -1;
- }
- break;
- }
- if (i == 0)
- fillPath.MoveTo(CFX_PointF(cp1.x, cp1.y + fRadius1));
-
- if (bRound) {
- if (fRadius1 < 0)
- sx -= FX_PI;
- if (bInverted)
- sy *= -1;
-
- CFX_RectF rtRadius(cp1.x, cp1.y, fRadius1 * 2 * vx, fRadius1 * 2 * vy);
- rtRadius.Normalize();
- if (bInverted)
- rtRadius.Offset(-fRadius1 * vx, -fRadius1 * vy);
-
- fillPath.ArcTo(rtRadius.TopLeft(), rtRadius.Size(), sx, sy);
- } else {
- CFX_PointF cp;
- if (bInverted) {
- cp.x = cp1.x + fRadius1 * vx;
- cp.y = cp1.y + fRadius1 * vy;
- } else {
- cp = cp1;
- }
- fillPath.LineTo(cp);
- fillPath.LineTo(CFX_PointF(cp1.x + fRadius1 * sx, cp1.y + fRadius1 * sy));
- }
- fillPath.LineTo(CFX_PointF(cp2.x + fRadius2 * nx, cp2.y + fRadius2 * ny));
- }
-}
-static void XFA_BOX_Fill_Radial(CXFA_Box box,
- CFX_Graphics* pGS,
- CFX_Path& fillPath,
- CFX_RectF rtFill,
- CFX_Matrix* pMatrix) {
- CXFA_Fill fill = box.GetFill();
- FX_ARGB crStart, crEnd;
- crStart = fill.GetColor();
- int32_t iType = fill.GetRadial(crEnd);
- if (iType != XFA_ATTRIBUTEENUM_ToEdge) {
- FX_ARGB temp = crEnd;
- crEnd = crStart;
- crStart = temp;
- }
- CFX_Shading shading(rtFill.Center(), rtFill.Center(), 0,
- FXSYS_sqrt(rtFill.Width() * rtFill.Width() +
- rtFill.Height() * rtFill.Height()) /
- 2,
- true, true, crStart, crEnd);
- CFX_Color cr(&shading);
- pGS->SetFillColor(&cr);
- pGS->FillPath(&fillPath, FXFILL_WINDING, pMatrix);
-}
-static void XFA_BOX_Fill_Pattern(CXFA_Box box,
- CFX_Graphics* pGS,
- CFX_Path& fillPath,
- CFX_RectF rtFill,
- CFX_Matrix* pMatrix) {
- CXFA_Fill fill = box.GetFill();
- FX_ARGB crStart, crEnd;
- crStart = fill.GetColor();
- int32_t iType = fill.GetPattern(crEnd);
- FX_HatchStyle iHatch = FX_HatchStyle::Cross;
- switch (iType) {
- case XFA_ATTRIBUTEENUM_CrossDiagonal:
- iHatch = FX_HatchStyle::DiagonalCross;
- break;
- case XFA_ATTRIBUTEENUM_DiagonalLeft:
- iHatch = FX_HatchStyle::ForwardDiagonal;
- break;
- case XFA_ATTRIBUTEENUM_DiagonalRight:
- iHatch = FX_HatchStyle::BackwardDiagonal;
- break;
- case XFA_ATTRIBUTEENUM_Horizontal:
- iHatch = FX_HatchStyle::Horizontal;
- break;
- case XFA_ATTRIBUTEENUM_Vertical:
- iHatch = FX_HatchStyle::Vertical;
- break;
- default:
- break;
- }
-
- CFX_Pattern pattern(iHatch, crEnd, crStart);
- CFX_Color cr(&pattern, 0x0);
- pGS->SetFillColor(&cr);
- pGS->FillPath(&fillPath, FXFILL_WINDING, pMatrix);
-}
-static void XFA_BOX_Fill_Linear(CXFA_Box box,
- CFX_Graphics* pGS,
- CFX_Path& fillPath,
- CFX_RectF rtFill,
- CFX_Matrix* pMatrix) {
- CXFA_Fill fill = box.GetFill();
- FX_ARGB crStart = fill.GetColor();
- FX_ARGB crEnd;
- int32_t iType = fill.GetLinear(crEnd);
- CFX_PointF ptStart;
- CFX_PointF ptEnd;
- switch (iType) {
- case XFA_ATTRIBUTEENUM_ToRight:
- ptStart = CFX_PointF(rtFill.left, rtFill.top);
- ptEnd = CFX_PointF(rtFill.right(), rtFill.top);
- break;
- case XFA_ATTRIBUTEENUM_ToBottom:
- ptStart = CFX_PointF(rtFill.left, rtFill.top);
- ptEnd = CFX_PointF(rtFill.left, rtFill.bottom());
- break;
- case XFA_ATTRIBUTEENUM_ToLeft:
- ptStart = CFX_PointF(rtFill.right(), rtFill.top);
- ptEnd = CFX_PointF(rtFill.left, rtFill.top);
- break;
- case XFA_ATTRIBUTEENUM_ToTop:
- ptStart = CFX_PointF(rtFill.left, rtFill.bottom());
- ptEnd = CFX_PointF(rtFill.left, rtFill.top);
- break;
- default:
- break;
- }
- CFX_Shading shading(ptStart, ptEnd, false, false, crStart, crEnd);
- CFX_Color cr(&shading);
- pGS->SetFillColor(&cr);
- pGS->FillPath(&fillPath, FXFILL_WINDING, pMatrix);
-}
-static void XFA_BOX_Fill(CXFA_Box box,
- const std::vector<CXFA_Stroke>& strokes,
- CFX_Graphics* pGS,
- const CFX_RectF& rtWidget,
- CFX_Matrix* pMatrix,
- uint32_t dwFlags) {
- CXFA_Fill fill = box.GetFill();
- if (!fill || fill.GetPresence() != XFA_ATTRIBUTEENUM_Visible)
- return;
-
- pGS->SaveGraphState();
- CFX_Path fillPath;
- XFA_BOX_GetFillPath(box, strokes, rtWidget, fillPath,
- (dwFlags & XFA_DRAWBOX_ForceRound) != 0);
- fillPath.Close();
- XFA_Element eType = fill.GetFillType();
- switch (eType) {
- case XFA_Element::Radial:
- XFA_BOX_Fill_Radial(box, pGS, fillPath, rtWidget, pMatrix);
- break;
- case XFA_Element::Pattern:
- XFA_BOX_Fill_Pattern(box, pGS, fillPath, rtWidget, pMatrix);
- break;
- case XFA_Element::Linear:
- XFA_BOX_Fill_Linear(box, pGS, fillPath, rtWidget, pMatrix);
- break;
- default: {
- FX_ARGB cr;
- if (eType == XFA_Element::Stipple) {
- int32_t iRate = fill.GetStipple(cr);
- if (iRate == 0) {
- iRate = 100;
- }
- int32_t a = 0;
- FX_COLORREF rgb;
- ArgbDecode(cr, a, rgb);
- cr = ArgbEncode(iRate * a / 100, rgb);
- } else {
- cr = fill.GetColor();
- }
- CFX_Color fillColor(cr);
- pGS->SetFillColor(&fillColor);
- pGS->FillPath(&fillPath, FXFILL_WINDING, pMatrix);
- } break;
- }
- pGS->RestoreGraphState();
-}
-static void XFA_BOX_StrokePath(CXFA_Stroke stroke,
- CFX_Path* pPath,
- CFX_Graphics* pGS,
- CFX_Matrix* pMatrix) {
- if (!stroke || !stroke.IsVisible()) {
- return;
- }
- FX_FLOAT fThickness = stroke.GetThickness();
- if (fThickness < 0.001f) {
- return;
- }
- pGS->SaveGraphState();
- if (stroke.IsCorner() && fThickness > 2 * stroke.GetRadius()) {
- fThickness = 2 * stroke.GetRadius();
- }
- pGS->SetLineWidth(fThickness, true);
- pGS->SetLineCap(CFX_GraphStateData::LineCapButt);
- XFA_StrokeTypeSetLineDash(pGS, stroke.GetStrokeType(),
- XFA_ATTRIBUTEENUM_Butt);
- CFX_Color fxColor(stroke.GetColor());
- pGS->SetStrokeColor(&fxColor);
- pGS->StrokePath(pPath, pMatrix);
- pGS->RestoreGraphState();
-}
-static void XFA_BOX_StrokeArc(CXFA_Box box,
- CFX_Graphics* pGS,
- CFX_RectF rtWidget,
- CFX_Matrix* pMatrix,
- uint32_t dwFlags) {
- CXFA_Edge edge = box.GetEdge(0);
- if (!edge || !edge.IsVisible()) {
- return;
- }
- bool bVisible = false;
- FX_FLOAT fThickness = 0;
- int32_t i3DType = box.Get3DStyle(bVisible, fThickness);
- if (i3DType) {
- if (bVisible && fThickness >= 0.001f) {
- dwFlags |= XFA_DRAWBOX_Lowered3D;
- }
- }
- FX_FLOAT fHalf = edge.GetThickness() / 2;
- if (fHalf < 0) {
- fHalf = 0;
- }
- int32_t iHand = box.GetHand();
- if (iHand == XFA_ATTRIBUTEENUM_Left) {
- rtWidget.Inflate(fHalf, fHalf);
- } else if (iHand == XFA_ATTRIBUTEENUM_Right) {
- rtWidget.Deflate(fHalf, fHalf);
- }
- if ((dwFlags & XFA_DRAWBOX_ForceRound) == 0 ||
- (dwFlags & XFA_DRAWBOX_Lowered3D) == 0) {
- if (fHalf < 0.001f)
- return;
-
- CFX_Path arcPath;
- XFA_BOX_GetPath_Arc(box, rtWidget, arcPath, dwFlags);
- XFA_BOX_StrokePath(edge, &arcPath, pGS, pMatrix);
- return;
- }
- pGS->SaveGraphState();
- pGS->SetLineWidth(fHalf);
-
- FX_FLOAT a, b;
- a = rtWidget.width / 2.0f;
- b = rtWidget.height / 2.0f;
- if (dwFlags & XFA_DRAWBOX_ForceRound) {
- a = std::min(a, b);
- b = a;
- }
-
- CFX_PointF center = rtWidget.Center();
- rtWidget.left = center.x - a;
- rtWidget.top = center.y - b;
- rtWidget.width = a + a;
- rtWidget.height = b + b;
-
- FX_FLOAT startAngle = 0, sweepAngle = 360;
- startAngle = startAngle * FX_PI / 180.0f;
- sweepAngle = -sweepAngle * FX_PI / 180.0f;
-
- CFX_Path arcPath;
- arcPath.AddArc(rtWidget.TopLeft(), rtWidget.Size(), 3.0f * FX_PI / 4.0f,
- FX_PI);
-
- CFX_Color cr(0xFF808080);
- pGS->SetStrokeColor(&cr);
- pGS->StrokePath(&arcPath, pMatrix);
- arcPath.Clear();
- arcPath.AddArc(rtWidget.TopLeft(), rtWidget.Size(), -1.0f * FX_PI / 4.0f,
- FX_PI);
-
- cr.Set(0xFFFFFFFF);
- pGS->SetStrokeColor(&cr);
- pGS->StrokePath(&arcPath, pMatrix);
- rtWidget.Deflate(fHalf, fHalf);
- arcPath.Clear();
- arcPath.AddArc(rtWidget.TopLeft(), rtWidget.Size(), 3.0f * FX_PI / 4.0f,
- FX_PI);
-
- cr.Set(0xFF404040);
- pGS->SetStrokeColor(&cr);
- pGS->StrokePath(&arcPath, pMatrix);
- arcPath.Clear();
- arcPath.AddArc(rtWidget.TopLeft(), rtWidget.Size(), -1.0f * FX_PI / 4.0f,
- FX_PI);
-
- cr.Set(0xFFC0C0C0);
- pGS->SetStrokeColor(&cr);
- pGS->StrokePath(&arcPath, pMatrix);
- pGS->RestoreGraphState();
-}
-static void XFA_Draw3DRect(CFX_Graphics* pGraphic,
- const CFX_RectF& rt,
- FX_FLOAT fLineWidth,
- CFX_Matrix* pMatrix,
- FX_ARGB argbTopLeft,
- FX_ARGB argbBottomRight) {
- CFX_Color crLT(argbTopLeft);
- pGraphic->SetFillColor(&crLT);
- FX_FLOAT fBottom = rt.bottom();
- FX_FLOAT fRight = rt.right();
- CFX_Path pathLT;
- pathLT.MoveTo(CFX_PointF(rt.left, fBottom));
- pathLT.LineTo(CFX_PointF(rt.left, rt.top));
- pathLT.LineTo(CFX_PointF(fRight, rt.top));
- pathLT.LineTo(CFX_PointF(fRight - fLineWidth, rt.top + fLineWidth));
- pathLT.LineTo(CFX_PointF(rt.left + fLineWidth, rt.top + fLineWidth));
- pathLT.LineTo(CFX_PointF(rt.left + fLineWidth, fBottom - fLineWidth));
- pathLT.LineTo(CFX_PointF(rt.left, fBottom));
- pGraphic->FillPath(&pathLT, FXFILL_WINDING, pMatrix);
-
- CFX_Color crRB(argbBottomRight);
- pGraphic->SetFillColor(&crRB);
-
- CFX_Path pathRB;
- pathRB.MoveTo(CFX_PointF(fRight, rt.top));
- pathRB.LineTo(CFX_PointF(fRight, fBottom));
- pathRB.LineTo(CFX_PointF(rt.left, fBottom));
- pathRB.LineTo(CFX_PointF(rt.left + fLineWidth, fBottom - fLineWidth));
- pathRB.LineTo(CFX_PointF(fRight - fLineWidth, fBottom - fLineWidth));
- pathRB.LineTo(CFX_PointF(fRight - fLineWidth, rt.top + fLineWidth));
- pathRB.LineTo(CFX_PointF(fRight, rt.top));
- pGraphic->FillPath(&pathRB, FXFILL_WINDING, pMatrix);
-}
-static void XFA_BOX_Stroke_3DRect_Lowered(CFX_Graphics* pGS,
- CFX_RectF rt,
- FX_FLOAT fThickness,
- CFX_Matrix* pMatrix) {
- FX_FLOAT fHalfWidth = fThickness / 2.0f;
- CFX_RectF rtInner(rt);
- rtInner.Deflate(fHalfWidth, fHalfWidth);
- CFX_Color cr(0xFF000000);
- pGS->SetFillColor(&cr);
- CFX_Path path;
- path.AddRectangle(rt.left, rt.top, rt.width, rt.height);
- path.AddRectangle(rtInner.left, rtInner.top, rtInner.width, rtInner.height);
- pGS->FillPath(&path, FXFILL_ALTERNATE, pMatrix);
- XFA_Draw3DRect(pGS, rtInner, fHalfWidth, pMatrix, 0xFF808080, 0xFFC0C0C0);
-}
-static void XFA_BOX_Stroke_3DRect_Raised(CFX_Graphics* pGS,
- CFX_RectF rt,
- FX_FLOAT fThickness,
- CFX_Matrix* pMatrix) {
- FX_FLOAT fHalfWidth = fThickness / 2.0f;
- CFX_RectF rtInner(rt);
- rtInner.Deflate(fHalfWidth, fHalfWidth);
- CFX_Color cr(0xFF000000);
- pGS->SetFillColor(&cr);
- CFX_Path path;
- path.AddRectangle(rt.left, rt.top, rt.width, rt.height);
- path.AddRectangle(rtInner.left, rtInner.top, rtInner.width, rtInner.height);
- pGS->FillPath(&path, FXFILL_ALTERNATE, pMatrix);
- XFA_Draw3DRect(pGS, rtInner, fHalfWidth, pMatrix, 0xFFFFFFFF, 0xFF808080);
-}
-static void XFA_BOX_Stroke_3DRect_Etched(CFX_Graphics* pGS,
- CFX_RectF rt,
- FX_FLOAT fThickness,
- CFX_Matrix* pMatrix) {
- FX_FLOAT fHalfWidth = fThickness / 2.0f;
- XFA_Draw3DRect(pGS, rt, fThickness, pMatrix, 0xFF808080, 0xFFFFFFFF);
- CFX_RectF rtInner(rt);
- rtInner.Deflate(fHalfWidth, fHalfWidth);
- XFA_Draw3DRect(pGS, rtInner, fHalfWidth, pMatrix, 0xFFFFFFFF, 0xFF808080);
-}
-static void XFA_BOX_Stroke_3DRect_Embossed(CFX_Graphics* pGS,
- CFX_RectF rt,
- FX_FLOAT fThickness,
- CFX_Matrix* pMatrix) {
- FX_FLOAT fHalfWidth = fThickness / 2.0f;
- XFA_Draw3DRect(pGS, rt, fThickness, pMatrix, 0xFF808080, 0xFF000000);
- CFX_RectF rtInner(rt);
- rtInner.Deflate(fHalfWidth, fHalfWidth);
- XFA_Draw3DRect(pGS, rtInner, fHalfWidth, pMatrix, 0xFF000000, 0xFF808080);
-}
-static void XFA_BOX_Stroke_Rect(CXFA_Box box,
- const std::vector<CXFA_Stroke>& strokes,
- CFX_Graphics* pGS,
- CFX_RectF rtWidget,
- CFX_Matrix* pMatrix) {
- bool bVisible = false;
- FX_FLOAT fThickness = 0;
- int32_t i3DType = box.Get3DStyle(bVisible, fThickness);
- if (i3DType) {
- if (!bVisible || fThickness < 0.001f) {
- return;
- }
- switch (i3DType) {
- case XFA_ATTRIBUTEENUM_Lowered:
- XFA_BOX_Stroke_3DRect_Lowered(pGS, rtWidget, fThickness, pMatrix);
- break;
- case XFA_ATTRIBUTEENUM_Raised:
- XFA_BOX_Stroke_3DRect_Raised(pGS, rtWidget, fThickness, pMatrix);
- break;
- case XFA_ATTRIBUTEENUM_Etched:
- XFA_BOX_Stroke_3DRect_Etched(pGS, rtWidget, fThickness, pMatrix);
- break;
- case XFA_ATTRIBUTEENUM_Embossed:
- XFA_BOX_Stroke_3DRect_Embossed(pGS, rtWidget, fThickness, pMatrix);
- break;
- }
- return;
- }
- bool bClose = false;
- bool bSameStyles = true;
- CXFA_Stroke stroke1 = strokes[0];
- for (int32_t i = 1; i < 8; i++) {
- CXFA_Stroke stroke2 = strokes[i];
- if (!stroke1.SameStyles(stroke2)) {
- bSameStyles = false;
- break;
- }
- stroke1 = stroke2;
- }
- if (bSameStyles) {
- stroke1 = strokes[0];
- bClose = true;
- for (int32_t i = 2; i < 8; i += 2) {
- CXFA_Stroke stroke2 = strokes[i];
- if (!stroke1.SameStyles(stroke2, XFA_STROKE_SAMESTYLE_NoPresence |
- XFA_STROKE_SAMESTYLE_Corner)) {
- bSameStyles = false;
- break;
- }
- stroke1 = stroke2;
- }
- if (bSameStyles) {
- stroke1 = strokes[0];
- if (stroke1.IsInverted())
- bSameStyles = false;
- if (stroke1.GetJoinType() != XFA_ATTRIBUTEENUM_Square)
- bSameStyles = false;
- }
- }
- bool bStart = true;
- CFX_Path path;
- for (int32_t i = 0; i < 8; i++) {
- CXFA_Stroke stroke = strokes[i];
- if ((i % 1) == 0 && stroke.GetRadius() < 0) {
- bool bEmpty = path.IsEmpty();
- if (!bEmpty) {
- XFA_BOX_StrokePath(stroke, &path, pGS, pMatrix);
- path.Clear();
- }
- bStart = true;
- continue;
- }
- XFA_BOX_GetPath(box, strokes, rtWidget, path, i, bStart, !bSameStyles);
- CXFA_Stroke stroke2 = strokes[(i + 1) % 8];
- bStart = !stroke.SameStyles(stroke2);
- if (bStart) {
- XFA_BOX_StrokePath(stroke, &path, pGS, pMatrix);
- path.Clear();
- }
- }
- bool bEmpty = path.IsEmpty();
- if (!bEmpty) {
- if (bClose) {
- path.Close();
- }
- XFA_BOX_StrokePath(strokes[7], &path, pGS, pMatrix);
- }
-}
-static void XFA_BOX_Stroke(CXFA_Box box,
- const std::vector<CXFA_Stroke>& strokes,
- CFX_Graphics* pGS,
- CFX_RectF rtWidget,
- CFX_Matrix* pMatrix,
- uint32_t dwFlags) {
- if (box.IsArc() || (dwFlags & XFA_DRAWBOX_ForceRound) != 0) {
- XFA_BOX_StrokeArc(box, pGS, rtWidget, pMatrix, dwFlags);
- return;
- }
- bool bVisible = false;
- for (int32_t j = 0; j < 4; j++) {
- if (strokes[j * 2 + 1].IsVisible()) {
- bVisible = true;
- break;
- }
- }
- if (!bVisible) {
- return;
- }
- for (int32_t i = 1; i < 8; i += 2) {
- CXFA_Edge edge(strokes[i].GetNode());
- FX_FLOAT fThickness = edge.GetThickness();
- if (fThickness < 0) {
- fThickness = 0;
- }
- FX_FLOAT fHalf = fThickness / 2;
- int32_t iHand = box.GetHand();
- switch (i) {
- case 1:
- if (iHand == XFA_ATTRIBUTEENUM_Left) {
- rtWidget.top -= fHalf;
- rtWidget.height += fHalf;
- } else if (iHand == XFA_ATTRIBUTEENUM_Right) {
- rtWidget.top += fHalf;
- rtWidget.height -= fHalf;
- }
- break;
- case 3:
- if (iHand == XFA_ATTRIBUTEENUM_Left) {
- rtWidget.width += fHalf;
- } else if (iHand == XFA_ATTRIBUTEENUM_Right) {
- rtWidget.width -= fHalf;
- }
- break;
- case 5:
- if (iHand == XFA_ATTRIBUTEENUM_Left) {
- rtWidget.height += fHalf;
- } else if (iHand == XFA_ATTRIBUTEENUM_Right) {
- rtWidget.height -= fHalf;
- }
- break;
- case 7:
- if (iHand == XFA_ATTRIBUTEENUM_Left) {
- rtWidget.left -= fHalf;
- rtWidget.width += fHalf;
- } else if (iHand == XFA_ATTRIBUTEENUM_Right) {
- rtWidget.left += fHalf;
- rtWidget.width -= fHalf;
- }
- break;
- }
- }
- XFA_BOX_Stroke_Rect(box, strokes, pGS, rtWidget, pMatrix);
-}
-void XFA_DrawBox(CXFA_Box box,
- CFX_Graphics* pGS,
- const CFX_RectF& rtWidget,
- CFX_Matrix* pMatrix,
- uint32_t dwFlags) {
- if (!box || box.GetPresence() != XFA_ATTRIBUTEENUM_Visible)
- return;
-
- XFA_Element eType = box.GetElementType();
- if (eType != XFA_Element::Arc && eType != XFA_Element::Border &&
- eType != XFA_Element::Rectangle) {
- return;
- }
- std::vector<CXFA_Stroke> strokes;
- if (!(dwFlags & XFA_DRAWBOX_ForceRound) && eType != XFA_Element::Arc)
- box.GetStrokes(&strokes);
-
- XFA_BOX_Fill(box, strokes, pGS, rtWidget, pMatrix, dwFlags);
- XFA_BOX_Stroke(box, strokes, pGS, rtWidget, pMatrix, dwFlags);
-}
-
-CXFA_CalcData::CXFA_CalcData() : m_iRefCount(0) {}
-
-CXFA_CalcData::~CXFA_CalcData() {}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffwidgetacc.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffwidgetacc.cpp
index adc5c31cc66..760def2759f 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffwidgetacc.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffwidgetacc.cpp
@@ -13,1525 +13,26 @@
#include "fxjs/cfxjse_value.h"
#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
-#include "xfa/fde/tto/fde_textout.h"
-#include "xfa/fde/xml/fde_xml_imp.h"
+#include "xfa/fde/cfde_textout.h"
+#include "xfa/fde/xml/cfde_xmlelement.h"
+#include "xfa/fde/xml/cfde_xmlnode.h"
#include "xfa/fxfa/app/xfa_ffcheckbutton.h"
#include "xfa/fxfa/app/xfa_ffchoicelist.h"
#include "xfa/fxfa/app/xfa_fffield.h"
#include "xfa/fxfa/app/xfa_fwladapter.h"
#include "xfa/fxfa/cxfa_eventparam.h"
+#include "xfa/fxfa/cxfa_ffapp.h"
+#include "xfa/fxfa/cxfa_ffdoc.h"
+#include "xfa/fxfa/cxfa_ffdocview.h"
+#include "xfa/fxfa/cxfa_ffpageview.h"
+#include "xfa/fxfa/cxfa_ffwidget.h"
+#include "xfa/fxfa/cxfa_fontmgr.h"
#include "xfa/fxfa/parser/cxfa_layoutprocessor.h"
+#include "xfa/fxfa/parser/cxfa_localevalue.h"
+#include "xfa/fxfa/parser/cxfa_node.h"
#include "xfa/fxfa/parser/cxfa_scriptcontext.h"
-#include "xfa/fxfa/parser/xfa_localevalue.h"
#include "xfa/fxfa/parser/xfa_resolvenode_rs.h"
-#include "xfa/fxfa/xfa_ffapp.h"
-#include "xfa/fxfa/xfa_ffdoc.h"
-#include "xfa/fxfa/xfa_ffdocview.h"
-#include "xfa/fxfa/xfa_ffpageview.h"
-#include "xfa/fxfa/xfa_ffwidget.h"
-#include "xfa/fxfa/xfa_fontmgr.h"
-static void XFA_FFDeleteCalcData(void* pData) {
- if (pData) {
- delete ((CXFA_CalcData*)pData);
- }
-}
-
-static XFA_MAPDATABLOCKCALLBACKINFO gs_XFADeleteCalcData = {
- XFA_FFDeleteCalcData, nullptr};
-
-class CXFA_WidgetLayoutData {
- public:
- CXFA_WidgetLayoutData() : m_fWidgetHeight(-1) {}
- virtual ~CXFA_WidgetLayoutData() {}
-
- FX_FLOAT m_fWidgetHeight;
-};
-
-class CXFA_TextLayoutData : public CXFA_WidgetLayoutData {
- public:
- CXFA_TextLayoutData() {}
- ~CXFA_TextLayoutData() override {}
-
- CXFA_TextLayout* GetTextLayout() const { return m_pTextLayout.get(); }
- CXFA_TextProvider* GetTextProvider() const { return m_pTextProvider.get(); }
-
- void LoadText(CXFA_WidgetAcc* pAcc) {
- if (m_pTextLayout)
- return;
-
- m_pTextProvider =
- pdfium::MakeUnique<CXFA_TextProvider>(pAcc, XFA_TEXTPROVIDERTYPE_Text);
- m_pTextLayout = pdfium::MakeUnique<CXFA_TextLayout>(m_pTextProvider.get());
- }
-
- private:
- std::unique_ptr<CXFA_TextLayout> m_pTextLayout;
- std::unique_ptr<CXFA_TextProvider> m_pTextProvider;
-};
-
-class CXFA_ImageLayoutData : public CXFA_WidgetLayoutData {
- public:
- CXFA_ImageLayoutData()
- : m_pDIBitmap(nullptr),
- m_bNamedImage(false),
- m_iImageXDpi(0),
- m_iImageYDpi(0) {}
-
- ~CXFA_ImageLayoutData() override {
- if (m_pDIBitmap && !m_bNamedImage)
- delete m_pDIBitmap;
- }
-
- bool LoadImageData(CXFA_WidgetAcc* pAcc) {
- if (m_pDIBitmap)
- return true;
-
- CXFA_Value value = pAcc->GetFormValue();
- if (!value)
- return false;
-
- CXFA_Image imageObj = value.GetImage();
- if (!imageObj)
- return false;
-
- CXFA_FFDoc* pFFDoc = pAcc->GetDoc();
- pAcc->SetImageImage(XFA_LoadImageData(pFFDoc, &imageObj, m_bNamedImage,
- m_iImageXDpi, m_iImageYDpi));
- return !!m_pDIBitmap;
- }
-
- CFX_DIBitmap* m_pDIBitmap;
- bool m_bNamedImage;
- int32_t m_iImageXDpi;
- int32_t m_iImageYDpi;
-};
-
-class CXFA_FieldLayoutData : public CXFA_WidgetLayoutData {
- public:
- CXFA_FieldLayoutData() {}
- ~CXFA_FieldLayoutData() override {}
-
- bool LoadCaption(CXFA_WidgetAcc* pAcc) {
- if (m_pCapTextLayout)
- return true;
- CXFA_Caption caption = pAcc->GetCaption();
- if (!caption || caption.GetPresence() == XFA_ATTRIBUTEENUM_Hidden)
- return false;
- m_pCapTextProvider.reset(
- new CXFA_TextProvider(pAcc, XFA_TEXTPROVIDERTYPE_Caption));
- m_pCapTextLayout =
- pdfium::MakeUnique<CXFA_TextLayout>(m_pCapTextProvider.get());
- return true;
- }
-
- std::unique_ptr<CXFA_TextLayout> m_pCapTextLayout;
- std::unique_ptr<CXFA_TextProvider> m_pCapTextProvider;
- std::unique_ptr<CFDE_TextOut> m_pTextOut;
- std::vector<FX_FLOAT> m_FieldSplitArray;
-};
-
-class CXFA_TextEditData : public CXFA_FieldLayoutData {
- public:
-};
-
-class CXFA_ImageEditData : public CXFA_FieldLayoutData {
- public:
- CXFA_ImageEditData()
- : m_pDIBitmap(nullptr),
- m_bNamedImage(false),
- m_iImageXDpi(0),
- m_iImageYDpi(0) {}
-
- ~CXFA_ImageEditData() override {
- if (m_pDIBitmap && !m_bNamedImage)
- delete m_pDIBitmap;
- }
-
- bool LoadImageData(CXFA_WidgetAcc* pAcc) {
- if (m_pDIBitmap)
- return true;
-
- CXFA_Value value = pAcc->GetFormValue();
- if (!value)
- return false;
-
- CXFA_Image imageObj = value.GetImage();
- CXFA_FFDoc* pFFDoc = pAcc->GetDoc();
- pAcc->SetImageEditImage(XFA_LoadImageData(pFFDoc, &imageObj, m_bNamedImage,
- m_iImageXDpi, m_iImageYDpi));
- return !!m_pDIBitmap;
- }
-
- CFX_DIBitmap* m_pDIBitmap;
- bool m_bNamedImage;
- int32_t m_iImageXDpi;
- int32_t m_iImageYDpi;
-};
-
-CXFA_WidgetAcc::CXFA_WidgetAcc(CXFA_FFDocView* pDocView, CXFA_Node* pNode)
- : CXFA_WidgetData(pNode),
- m_pDocView(pDocView),
- m_nRecursionDepth(0) {}
-
-CXFA_WidgetAcc::~CXFA_WidgetAcc() {}
-
-bool CXFA_WidgetAcc::GetName(CFX_WideString& wsName, int32_t iNameType) {
- if (iNameType == 0) {
- m_pNode->TryCData(XFA_ATTRIBUTE_Name, wsName);
- return !wsName.IsEmpty();
- }
- m_pNode->GetSOMExpression(wsName);
- if (iNameType == 2 && wsName.GetLength() >= 15) {
- CFX_WideStringC wsPre = L"xfa[0].form[0].";
- if (wsPre == CFX_WideStringC(wsName.c_str(), wsPre.GetLength())) {
- wsName.Delete(0, wsPre.GetLength());
- }
- }
- return true;
-}
-CXFA_Node* CXFA_WidgetAcc::GetDatasets() {
- return m_pNode->GetBindData();
-}
-bool CXFA_WidgetAcc::ProcessValueChanged() {
- m_pDocView->AddValidateWidget(this);
- m_pDocView->AddCalculateWidgetAcc(this);
- m_pDocView->RunCalculateWidgets();
- m_pDocView->RunValidate();
- return true;
-}
-void CXFA_WidgetAcc::ResetData() {
- CFX_WideString wsValue;
- XFA_Element eUIType = GetUIType();
- switch (eUIType) {
- case XFA_Element::ImageEdit: {
- CXFA_Value imageValue = GetDefaultValue();
- CXFA_Image image = imageValue.GetImage();
- CFX_WideString wsContentType, wsHref;
- if (image) {
- image.GetContent(wsValue);
- image.GetContentType(wsContentType);
- image.GetHref(wsHref);
- }
- SetImageEdit(wsContentType, wsHref, wsValue);
- } break;
- case XFA_Element::ExclGroup: {
- CXFA_Node* pNextChild = m_pNode->GetNodeItem(
- XFA_NODEITEM_FirstChild, XFA_ObjectType::ContainerNode);
- while (pNextChild) {
- CXFA_Node* pChild = pNextChild;
- CXFA_WidgetAcc* pAcc =
- static_cast<CXFA_WidgetAcc*>(pChild->GetWidgetData());
- if (!pAcc) {
- continue;
- }
- CXFA_Value defValue(nullptr);
- if (wsValue.IsEmpty() && (defValue = pAcc->GetDefaultValue())) {
- defValue.GetChildValueContent(wsValue);
- SetValue(wsValue, XFA_VALUEPICTURE_Raw);
- pAcc->SetValue(wsValue, XFA_VALUEPICTURE_Raw);
- } else {
- CXFA_Node* pItems = pChild->GetChild(0, XFA_Element::Items);
- if (!pItems) {
- continue;
- }
- CFX_WideString itemText;
- if (pItems->CountChildren(XFA_Element::Unknown) > 1) {
- itemText = pItems->GetChild(1, XFA_Element::Unknown)->GetContent();
- }
- pAcc->SetValue(itemText, XFA_VALUEPICTURE_Raw);
- }
- pNextChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling,
- XFA_ObjectType::ContainerNode);
- }
- } break;
- case XFA_Element::ChoiceList:
- ClearAllSelections();
- default:
- if (CXFA_Value defValue = GetDefaultValue()) {
- defValue.GetChildValueContent(wsValue);
- }
- SetValue(wsValue, XFA_VALUEPICTURE_Raw);
- break;
- }
-}
-void CXFA_WidgetAcc::SetImageEdit(const CFX_WideString& wsContentType,
- const CFX_WideString& wsHref,
- const CFX_WideString& wsData) {
- CXFA_Image image = GetFormValue().GetImage();
- if (image) {
- image.SetContentType(CFX_WideString(wsContentType));
- image.SetHref(wsHref);
- }
- CFX_WideString wsFormatValue(wsData);
- GetFormatDataValue(wsData, wsFormatValue);
- m_pNode->SetContent(wsData, wsFormatValue, true);
- CXFA_Node* pBind = GetDatasets();
- if (!pBind) {
- image.SetTransferEncoding(XFA_ATTRIBUTEENUM_Base64);
- return;
- }
- pBind->SetCData(XFA_ATTRIBUTE_ContentType, wsContentType);
- CXFA_Node* pHrefNode = pBind->GetNodeItem(XFA_NODEITEM_FirstChild);
- if (pHrefNode) {
- pHrefNode->SetCData(XFA_ATTRIBUTE_Value, wsHref);
- } else {
- CFDE_XMLNode* pXMLNode = pBind->GetXMLMappingNode();
- ASSERT(pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element);
- static_cast<CFDE_XMLElement*>(pXMLNode)->SetString(L"href", wsHref);
- }
-}
-
-CXFA_WidgetAcc* CXFA_WidgetAcc::GetExclGroup() {
- CXFA_Node* pExcl = m_pNode->GetNodeItem(XFA_NODEITEM_Parent);
- if (!pExcl || pExcl->GetElementType() != XFA_Element::ExclGroup) {
- return nullptr;
- }
- return static_cast<CXFA_WidgetAcc*>(pExcl->GetWidgetData());
-}
-CXFA_FFDocView* CXFA_WidgetAcc::GetDocView() {
- return m_pDocView;
-}
-CXFA_FFDoc* CXFA_WidgetAcc::GetDoc() {
- return m_pDocView->GetDoc();
-}
-CXFA_FFApp* CXFA_WidgetAcc::GetApp() {
- return GetDoc()->GetApp();
-}
-IXFA_AppProvider* CXFA_WidgetAcc::GetAppProvider() {
- return GetApp()->GetAppProvider();
-}
-int32_t CXFA_WidgetAcc::ProcessEvent(int32_t iActivity,
- CXFA_EventParam* pEventParam) {
- if (GetElementType() == XFA_Element::Draw) {
- return XFA_EVENTERROR_NotExist;
- }
- int32_t iRet = XFA_EVENTERROR_NotExist;
- CXFA_NodeArray eventArray;
- int32_t iCounts =
- GetEventByActivity(iActivity, eventArray, pEventParam->m_bIsFormReady);
- for (int32_t i = 0; i < iCounts; i++) {
- CXFA_Event event(eventArray[i]);
- int32_t result = ProcessEvent(event, pEventParam);
- if (i == 0) {
- iRet = result;
- } else if (result == XFA_EVENTERROR_Success) {
- iRet = result;
- }
- }
- return iRet;
-}
-int32_t CXFA_WidgetAcc::ProcessEvent(CXFA_Event& event,
- CXFA_EventParam* pEventParam) {
- if (!event)
- return XFA_EVENTERROR_NotExist;
-
- switch (event.GetEventType()) {
- case XFA_Element::Execute:
- break;
- case XFA_Element::Script: {
- CXFA_Script script = event.GetScript();
- return ExecuteScript(script, pEventParam);
- } break;
- case XFA_Element::SignData:
- break;
- case XFA_Element::Submit: {
- CXFA_Submit submit = event.GetSubmit();
- return GetDoc()->GetDocEnvironment()->SubmitData(GetDoc(), submit);
- }
- default:
- break;
- }
- return XFA_EVENTERROR_NotExist;
-}
-
-int32_t CXFA_WidgetAcc::ProcessCalculate() {
- if (GetElementType() == XFA_Element::Draw)
- return XFA_EVENTERROR_NotExist;
-
- CXFA_Calculate calc = GetCalculate();
- if (!calc)
- return XFA_EVENTERROR_NotExist;
- if (GetNode()->IsUserInteractive())
- return XFA_EVENTERROR_Disabled;
-
- CXFA_EventParam EventParam;
- EventParam.m_eType = XFA_EVENT_Calculate;
- CXFA_Script script = calc.GetScript();
- int32_t iRet = ExecuteScript(script, &EventParam);
- if (iRet != XFA_EVENTERROR_Success)
- return iRet;
-
- if (GetRawValue() != EventParam.m_wsResult) {
- SetValue(EventParam.m_wsResult, XFA_VALUEPICTURE_Raw);
- UpdateUIDisplay();
- }
- return XFA_EVENTERROR_Success;
-}
-
-void CXFA_WidgetAcc::ProcessScriptTestValidate(CXFA_Validate validate,
- int32_t iRet,
- CFXJSE_Value* pRetValue,
- bool bVersionFlag) {
- if (iRet == XFA_EVENTERROR_Success && pRetValue) {
- if (pRetValue->IsBoolean() && !pRetValue->ToBoolean()) {
- IXFA_AppProvider* pAppProvider = GetAppProvider();
- if (!pAppProvider) {
- return;
- }
- CFX_WideString wsTitle = pAppProvider->GetAppTitle();
- CFX_WideString wsScriptMsg;
- validate.GetScriptMessageText(wsScriptMsg);
- int32_t eScriptTest = validate.GetScriptTest();
- if (eScriptTest == XFA_ATTRIBUTEENUM_Warning) {
- if (GetNode()->IsUserInteractive())
- return;
- if (wsScriptMsg.IsEmpty())
- wsScriptMsg = GetValidateMessage(false, bVersionFlag);
-
- if (bVersionFlag) {
- pAppProvider->MsgBox(wsScriptMsg, wsTitle, XFA_MBICON_Warning,
- XFA_MB_OK);
- return;
- }
- if (pAppProvider->MsgBox(wsScriptMsg, wsTitle, XFA_MBICON_Warning,
- XFA_MB_YesNo) == XFA_IDYes) {
- GetNode()->SetFlag(XFA_NodeFlag_UserInteractive, false);
- }
- } else {
- if (wsScriptMsg.IsEmpty())
- wsScriptMsg = GetValidateMessage(true, bVersionFlag);
- pAppProvider->MsgBox(wsScriptMsg, wsTitle, XFA_MBICON_Error, XFA_MB_OK);
- }
- }
- }
-}
-int32_t CXFA_WidgetAcc::ProcessFormatTestValidate(CXFA_Validate validate,
- bool bVersionFlag) {
- CFX_WideString wsRawValue = GetRawValue();
- if (!wsRawValue.IsEmpty()) {
- CFX_WideString wsPicture;
- validate.GetPicture(wsPicture);
- if (wsPicture.IsEmpty()) {
- return XFA_EVENTERROR_NotExist;
- }
- IFX_Locale* pLocale = GetLocal();
- if (!pLocale) {
- return XFA_EVENTERROR_NotExist;
- }
- CXFA_LocaleValue lcValue = XFA_GetLocaleValue(this);
- if (!lcValue.ValidateValue(lcValue.GetValue(), wsPicture, pLocale)) {
- IXFA_AppProvider* pAppProvider = GetAppProvider();
- if (!pAppProvider) {
- return XFA_EVENTERROR_NotExist;
- }
- CFX_WideString wsFormatMsg;
- validate.GetFormatMessageText(wsFormatMsg);
- CFX_WideString wsTitle = pAppProvider->GetAppTitle();
- int32_t eFormatTest = validate.GetFormatTest();
- if (eFormatTest == XFA_ATTRIBUTEENUM_Error) {
- if (wsFormatMsg.IsEmpty())
- wsFormatMsg = GetValidateMessage(true, bVersionFlag);
- pAppProvider->MsgBox(wsFormatMsg, wsTitle, XFA_MBICON_Error, XFA_MB_OK);
- return XFA_EVENTERROR_Success;
- }
- if (GetNode()->IsUserInteractive())
- return XFA_EVENTERROR_NotExist;
- if (wsFormatMsg.IsEmpty())
- wsFormatMsg = GetValidateMessage(false, bVersionFlag);
-
- if (bVersionFlag) {
- pAppProvider->MsgBox(wsFormatMsg, wsTitle, XFA_MBICON_Warning,
- XFA_MB_OK);
- return XFA_EVENTERROR_Success;
- }
- if (pAppProvider->MsgBox(wsFormatMsg, wsTitle, XFA_MBICON_Warning,
- XFA_MB_YesNo) == XFA_IDYes) {
- GetNode()->SetFlag(XFA_NodeFlag_UserInteractive, false);
- }
- return XFA_EVENTERROR_Success;
- }
- }
- return XFA_EVENTERROR_NotExist;
-}
-int32_t CXFA_WidgetAcc::ProcessNullTestValidate(CXFA_Validate validate,
- int32_t iFlags,
- bool bVersionFlag) {
- CFX_WideString wsValue;
- GetValue(wsValue, XFA_VALUEPICTURE_Raw);
- if (!wsValue.IsEmpty()) {
- return XFA_EVENTERROR_Success;
- }
- if (m_bIsNull && (m_bPreNull == m_bIsNull)) {
- return XFA_EVENTERROR_Success;
- }
- int32_t eNullTest = validate.GetNullTest();
- CFX_WideString wsNullMsg;
- validate.GetNullMessageText(wsNullMsg);
- if (iFlags & 0x01) {
- int32_t iRet = XFA_EVENTERROR_Success;
- if (eNullTest != XFA_ATTRIBUTEENUM_Disabled) {
- iRet = XFA_EVENTERROR_Error;
- }
- if (!wsNullMsg.IsEmpty()) {
- if (eNullTest != XFA_ATTRIBUTEENUM_Disabled) {
- m_pDocView->m_arrNullTestMsg.push_back(wsNullMsg);
- return XFA_EVENTERROR_Error;
- }
- return XFA_EVENTERROR_Success;
- }
- return iRet;
- }
- if (wsNullMsg.IsEmpty() && bVersionFlag &&
- eNullTest != XFA_ATTRIBUTEENUM_Disabled) {
- return XFA_EVENTERROR_Error;
- }
- IXFA_AppProvider* pAppProvider = GetAppProvider();
- if (!pAppProvider) {
- return XFA_EVENTERROR_NotExist;
- }
- CFX_WideString wsCaptionName;
- CFX_WideString wsTitle = pAppProvider->GetAppTitle();
- switch (eNullTest) {
- case XFA_ATTRIBUTEENUM_Error: {
- if (wsNullMsg.IsEmpty()) {
- wsCaptionName = GetValidateCaptionName(bVersionFlag);
- wsNullMsg.Format(L"%s cannot be blank.", wsCaptionName.c_str());
- }
- pAppProvider->MsgBox(wsNullMsg, wsTitle, XFA_MBICON_Status, XFA_MB_OK);
- return XFA_EVENTERROR_Error;
- }
- case XFA_ATTRIBUTEENUM_Warning: {
- if (GetNode()->IsUserInteractive())
- return true;
-
- if (wsNullMsg.IsEmpty()) {
- wsCaptionName = GetValidateCaptionName(bVersionFlag);
- wsNullMsg.Format(
- L"%s cannot be blank. To ignore validations for %s, click Ignore.",
- wsCaptionName.c_str(), wsCaptionName.c_str());
- }
- if (pAppProvider->MsgBox(wsNullMsg, wsTitle, XFA_MBICON_Warning,
- XFA_MB_YesNo) == XFA_IDYes) {
- GetNode()->SetFlag(XFA_NodeFlag_UserInteractive, false);
- }
- return XFA_EVENTERROR_Error;
- }
- case XFA_ATTRIBUTEENUM_Disabled:
- default:
- break;
- }
- return XFA_EVENTERROR_Success;
-}
-
-CFX_WideString CXFA_WidgetAcc::GetValidateCaptionName(bool bVersionFlag) {
- CFX_WideString wsCaptionName;
-
- if (!bVersionFlag) {
- if (CXFA_Caption caption = GetCaption()) {
- if (CXFA_Value capValue = caption.GetValue()) {
- if (CXFA_Text capText = capValue.GetText())
- capText.GetContent(wsCaptionName);
- }
- }
- }
- if (wsCaptionName.IsEmpty())
- GetName(wsCaptionName);
-
- return wsCaptionName;
-}
-
-CFX_WideString CXFA_WidgetAcc::GetValidateMessage(bool bError,
- bool bVersionFlag) {
- CFX_WideString wsCaptionName = GetValidateCaptionName(bVersionFlag);
- CFX_WideString wsMessage;
- if (bVersionFlag) {
- wsMessage.Format(L"%s validation failed", wsCaptionName.c_str());
- return wsMessage;
- }
- if (bError) {
- wsMessage.Format(L"The value you entered for %s is invalid.",
- wsCaptionName.c_str());
- return wsMessage;
- }
- wsMessage.Format(
- L"The value you entered for %s is invalid. To ignore "
- L"validations for %s, click Ignore.",
- wsCaptionName.c_str(), wsCaptionName.c_str());
- return wsMessage;
-}
-
-int32_t CXFA_WidgetAcc::ProcessValidate(int32_t iFlags) {
- if (GetElementType() == XFA_Element::Draw) {
- return XFA_EVENTERROR_NotExist;
- }
- CXFA_Validate validate = GetValidate();
- if (!validate) {
- return XFA_EVENTERROR_NotExist;
- }
- bool bInitDoc = validate.GetNode()->NeedsInitApp();
- bool bStatus = m_pDocView->GetLayoutStatus() < XFA_DOCVIEW_LAYOUTSTATUS_End;
- int32_t iFormat = 0;
- CFXJSE_Value* pRetValue = nullptr;
- int32_t iRet = XFA_EVENTERROR_NotExist;
- CXFA_Script script = validate.GetScript();
- if (script) {
- CXFA_EventParam eParam;
- eParam.m_eType = XFA_EVENT_Validate;
- eParam.m_pTarget = this;
- iRet = ExecuteScript(script, &eParam,
- ((bInitDoc || bStatus) && GetRawValue().IsEmpty())
- ? nullptr
- : &pRetValue);
- }
- XFA_VERSION version = GetDoc()->GetXFADoc()->GetCurVersionMode();
- bool bVersionFlag = false;
- if (version < XFA_VERSION_208) {
- bVersionFlag = true;
- }
- if (bInitDoc) {
- validate.GetNode()->ClearFlag(XFA_NodeFlag_NeedsInitApp);
- } else {
- iFormat = ProcessFormatTestValidate(validate, bVersionFlag);
- if (!bVersionFlag) {
- bVersionFlag = GetDoc()->GetXFADoc()->HasFlag(XFA_DOCFLAG_Scripting);
- }
- iRet |= ProcessNullTestValidate(validate, iFlags, bVersionFlag);
- }
- if (iFormat != XFA_EVENTERROR_Success) {
- ProcessScriptTestValidate(validate, iRet, pRetValue, bVersionFlag);
- }
- delete pRetValue;
-
- return iRet | iFormat;
-}
-int32_t CXFA_WidgetAcc::ExecuteScript(CXFA_Script script,
- CXFA_EventParam* pEventParam,
- CFXJSE_Value** pRetValue) {
- static const uint32_t MAX_RECURSION_DEPTH = 2;
- if (m_nRecursionDepth > MAX_RECURSION_DEPTH)
- return XFA_EVENTERROR_Success;
- ASSERT(pEventParam);
- if (!script) {
- return XFA_EVENTERROR_NotExist;
- }
- if (script.GetRunAt() == XFA_ATTRIBUTEENUM_Server) {
- return XFA_EVENTERROR_Disabled;
- }
- CFX_WideString wsExpression;
- script.GetExpression(wsExpression);
- if (wsExpression.IsEmpty()) {
- return XFA_EVENTERROR_NotExist;
- }
- XFA_SCRIPTTYPE eScriptType = script.GetContentType();
- if (eScriptType == XFA_SCRIPTTYPE_Unkown) {
- return XFA_EVENTERROR_Success;
- }
- CXFA_FFDoc* pDoc = GetDoc();
- CXFA_ScriptContext* pContext = pDoc->GetXFADoc()->GetScriptContext();
- pContext->SetEventParam(*pEventParam);
- pContext->SetRunAtType((XFA_ATTRIBUTEENUM)script.GetRunAt());
- CXFA_NodeArray refNodes;
- if (pEventParam->m_eType == XFA_EVENT_InitCalculate ||
- pEventParam->m_eType == XFA_EVENT_Calculate) {
- pContext->SetNodesOfRunScript(&refNodes);
- }
- std::unique_ptr<CFXJSE_Value> pTmpRetValue(
- new CFXJSE_Value(pContext->GetRuntime()));
- ++m_nRecursionDepth;
- bool bRet = pContext->RunScript((XFA_SCRIPTLANGTYPE)eScriptType,
- wsExpression.AsStringC(), pTmpRetValue.get(),
- m_pNode);
- --m_nRecursionDepth;
- int32_t iRet = XFA_EVENTERROR_Error;
- if (bRet) {
- iRet = XFA_EVENTERROR_Success;
- if (pEventParam->m_eType == XFA_EVENT_Calculate ||
- pEventParam->m_eType == XFA_EVENT_InitCalculate) {
- if (!pTmpRetValue->IsUndefined()) {
- if (!pTmpRetValue->IsNull())
- pEventParam->m_wsResult = pTmpRetValue->ToWideString();
-
- iRet = XFA_EVENTERROR_Success;
- } else {
- iRet = XFA_EVENTERROR_Error;
- }
- if (pEventParam->m_eType == XFA_EVENT_InitCalculate) {
- if ((iRet == XFA_EVENTERROR_Success) &&
- (GetRawValue() != pEventParam->m_wsResult)) {
- SetValue(pEventParam->m_wsResult, XFA_VALUEPICTURE_Raw);
- m_pDocView->AddValidateWidget(this);
- }
- }
- int32_t iRefs = refNodes.GetSize();
- for (int32_t r = 0; r < iRefs; r++) {
- CXFA_WidgetAcc* pRefAcc =
- static_cast<CXFA_WidgetAcc*>(refNodes[r]->GetWidgetData());
- if (pRefAcc && pRefAcc == this) {
- continue;
- }
- CXFA_Node* pRefNode = refNodes[r];
- CXFA_CalcData* pGlobalData =
- (CXFA_CalcData*)pRefNode->GetUserData(XFA_CalcData);
- if (!pGlobalData) {
- pGlobalData = new CXFA_CalcData;
- pRefNode->SetUserData(XFA_CalcData, pGlobalData,
- &gs_XFADeleteCalcData);
- }
- if (!pdfium::ContainsValue(pGlobalData->m_Globals, this))
- pGlobalData->m_Globals.push_back(this);
- }
- }
- }
- if (pRetValue)
- *pRetValue = pTmpRetValue.release();
-
- pContext->SetNodesOfRunScript(nullptr);
- return iRet;
-}
-CXFA_FFWidget* CXFA_WidgetAcc::GetNextWidget(CXFA_FFWidget* pWidget) {
- CXFA_LayoutItem* pLayout = nullptr;
- if (pWidget) {
- pLayout = pWidget->GetNext();
- } else {
- pLayout = m_pDocView->GetXFALayout()->GetLayoutItem(m_pNode);
- }
- return static_cast<CXFA_FFWidget*>(pLayout);
-}
-void CXFA_WidgetAcc::UpdateUIDisplay(CXFA_FFWidget* pExcept) {
- CXFA_FFWidget* pWidget = nullptr;
- while ((pWidget = GetNextWidget(pWidget)) != nullptr) {
- if (pWidget == pExcept || !pWidget->IsLoaded() ||
- (GetUIType() != XFA_Element::CheckButton && pWidget->IsFocused())) {
- continue;
- }
- pWidget->UpdateFWLData();
- pWidget->AddInvalidateRect();
- }
-}
-
-void CXFA_WidgetAcc::CalcCaptionSize(CFX_SizeF& szCap) {
- CXFA_Caption caption = GetCaption();
- if (!caption || caption.GetPresence() != XFA_ATTRIBUTEENUM_Visible) {
- return;
- }
- LoadCaption();
- XFA_Element eUIType = GetUIType();
- int32_t iCapPlacement = caption.GetPlacementType();
- FX_FLOAT fCapReserve = caption.GetReserve();
- const bool bVert = iCapPlacement == XFA_ATTRIBUTEENUM_Top ||
- iCapPlacement == XFA_ATTRIBUTEENUM_Bottom;
- const bool bReserveExit = fCapReserve > 0.01;
- CXFA_TextLayout* pCapTextLayout =
- static_cast<CXFA_FieldLayoutData*>(m_pLayoutData.get())
- ->m_pCapTextLayout.get();
- if (pCapTextLayout) {
- if (!bVert && eUIType != XFA_Element::Button) {
- szCap.width = fCapReserve;
- }
- CFX_SizeF minSize;
- pCapTextLayout->CalcSize(minSize, szCap, szCap);
- if (bReserveExit) {
- bVert ? szCap.height = fCapReserve : szCap.width = fCapReserve;
- }
- } else {
- FX_FLOAT fFontSize = 10.0f;
- if (CXFA_Font font = caption.GetFont()) {
- fFontSize = font.GetFontSize();
- } else if (CXFA_Font widgetfont = GetFont()) {
- fFontSize = widgetfont.GetFontSize();
- }
- if (bVert) {
- szCap.height = fCapReserve > 0 ? fCapReserve : fFontSize;
- } else {
- szCap.width = fCapReserve > 0 ? fCapReserve : 0;
- szCap.height = fFontSize;
- }
- }
- if (CXFA_Margin mgCap = caption.GetMargin()) {
- FX_FLOAT fLeftInset, fTopInset, fRightInset, fBottomInset;
- mgCap.GetLeftInset(fLeftInset);
- mgCap.GetTopInset(fTopInset);
- mgCap.GetRightInset(fRightInset);
- mgCap.GetBottomInset(fBottomInset);
- if (bReserveExit) {
- bVert ? (szCap.width += fLeftInset + fRightInset)
- : (szCap.height += fTopInset + fBottomInset);
- } else {
- szCap.width += fLeftInset + fRightInset;
- szCap.height += fTopInset + fBottomInset;
- }
- }
-}
-bool CXFA_WidgetAcc::CalculateFieldAutoSize(CFX_SizeF& size) {
- CFX_SizeF szCap;
- CalcCaptionSize(szCap);
- CFX_RectF rtUIMargin = GetUIMargin();
- size.width += rtUIMargin.left + rtUIMargin.width;
- size.height += rtUIMargin.top + rtUIMargin.height;
- if (szCap.width > 0 && szCap.height > 0) {
- int32_t iCapPlacement = GetCaption().GetPlacementType();
- switch (iCapPlacement) {
- case XFA_ATTRIBUTEENUM_Left:
- case XFA_ATTRIBUTEENUM_Right:
- case XFA_ATTRIBUTEENUM_Inline: {
- size.width += szCap.width;
- size.height = std::max(size.height, szCap.height);
- } break;
- case XFA_ATTRIBUTEENUM_Top:
- case XFA_ATTRIBUTEENUM_Bottom: {
- size.height += szCap.height;
- size.width = std::max(size.width, szCap.width);
- }
- default:
- break;
- }
- }
- return CalculateWidgetAutoSize(size);
-}
-bool CXFA_WidgetAcc::CalculateWidgetAutoSize(CFX_SizeF& size) {
- CXFA_Margin mgWidget = GetMargin();
- if (mgWidget) {
- FX_FLOAT fLeftInset, fTopInset, fRightInset, fBottomInset;
- mgWidget.GetLeftInset(fLeftInset);
- mgWidget.GetTopInset(fTopInset);
- mgWidget.GetRightInset(fRightInset);
- mgWidget.GetBottomInset(fBottomInset);
- size.width += fLeftInset + fRightInset;
- size.height += fTopInset + fBottomInset;
- }
- CXFA_Para para = GetPara();
- if (para)
- size.width += para.GetMarginLeft() + para.GetTextIndent();
-
- FX_FLOAT fVal = 0;
- FX_FLOAT fMin = 0;
- FX_FLOAT fMax = 0;
- if (GetWidth(fVal)) {
- size.width = fVal;
- } else {
- if (GetMinWidth(fMin))
- size.width = std::max(size.width, fMin);
- if (GetMaxWidth(fMax) && fMax > 0)
- size.width = std::min(size.width, fMax);
- }
- fVal = 0;
- fMin = 0;
- fMax = 0;
- if (GetHeight(fVal)) {
- size.height = fVal;
- } else {
- if (GetMinHeight(fMin))
- size.height = std::max(size.height, fMin);
- if (GetMaxHeight(fMax) && fMax > 0)
- size.height = std::min(size.height, fMax);
- }
- return true;
-}
-
-void CXFA_WidgetAcc::CalculateTextContentSize(CFX_SizeF& size) {
- FX_FLOAT fFontSize = GetFontSize();
- CFX_WideString wsText;
- GetValue(wsText, XFA_VALUEPICTURE_Display);
- if (wsText.IsEmpty()) {
- size.height += fFontSize;
- return;
- }
-
- FX_WCHAR wcEnter = '\n';
- FX_WCHAR wsLast = wsText.GetAt(wsText.GetLength() - 1);
- if (wsLast == wcEnter) {
- wsText = wsText + wcEnter;
- }
-
- CXFA_FieldLayoutData* layoutData =
- static_cast<CXFA_FieldLayoutData*>(m_pLayoutData.get());
- if (!layoutData->m_pTextOut) {
- layoutData->m_pTextOut = pdfium::MakeUnique<CFDE_TextOut>();
- CFDE_TextOut* pTextOut = layoutData->m_pTextOut.get();
- pTextOut->SetFont(GetFDEFont());
- pTextOut->SetFontSize(fFontSize);
- pTextOut->SetLineBreakTolerance(fFontSize * 0.2f);
- pTextOut->SetLineSpace(GetLineHeight());
- uint32_t dwStyles = FDE_TTOSTYLE_LastLineHeight;
- if (GetUIType() == XFA_Element::TextEdit && IsMultiLine()) {
- dwStyles |= FDE_TTOSTYLE_LineWrap;
- }
- pTextOut->SetStyles(dwStyles);
- }
- layoutData->m_pTextOut->CalcLogicSize(wsText.c_str(), wsText.GetLength(),
- size);
-}
-bool CXFA_WidgetAcc::CalculateTextEditAutoSize(CFX_SizeF& size) {
- if (size.width > 0) {
- CFX_SizeF szOrz = size;
- CFX_SizeF szCap;
- CalcCaptionSize(szCap);
- bool bCapExit = szCap.width > 0.01 && szCap.height > 0.01;
- int32_t iCapPlacement = XFA_ATTRIBUTEENUM_Unknown;
- if (bCapExit) {
- iCapPlacement = GetCaption().GetPlacementType();
- switch (iCapPlacement) {
- case XFA_ATTRIBUTEENUM_Left:
- case XFA_ATTRIBUTEENUM_Right:
- case XFA_ATTRIBUTEENUM_Inline: {
- size.width -= szCap.width;
- }
- default:
- break;
- }
- }
- CFX_RectF rtUIMargin = GetUIMargin();
- size.width -= rtUIMargin.left + rtUIMargin.width;
- CXFA_Margin mgWidget = GetMargin();
- if (mgWidget) {
- FX_FLOAT fLeftInset, fRightInset;
- mgWidget.GetLeftInset(fLeftInset);
- mgWidget.GetRightInset(fRightInset);
- size.width -= fLeftInset + fRightInset;
- }
- CalculateTextContentSize(size);
- size.height += rtUIMargin.top + rtUIMargin.height;
- if (bCapExit) {
- switch (iCapPlacement) {
- case XFA_ATTRIBUTEENUM_Left:
- case XFA_ATTRIBUTEENUM_Right:
- case XFA_ATTRIBUTEENUM_Inline: {
- size.height = std::max(size.height, szCap.height);
- } break;
- case XFA_ATTRIBUTEENUM_Top:
- case XFA_ATTRIBUTEENUM_Bottom: {
- size.height += szCap.height;
- }
- default:
- break;
- }
- }
- size.width = szOrz.width;
- return CalculateWidgetAutoSize(size);
- }
- CalculateTextContentSize(size);
- return CalculateFieldAutoSize(size);
-}
-bool CXFA_WidgetAcc::CalculateCheckButtonAutoSize(CFX_SizeF& size) {
- FX_FLOAT fCheckSize = GetCheckButtonSize();
- size = CFX_SizeF(fCheckSize, fCheckSize);
- return CalculateFieldAutoSize(size);
-}
-bool CXFA_WidgetAcc::CalculatePushButtonAutoSize(CFX_SizeF& size) {
- CalcCaptionSize(size);
- return CalculateWidgetAutoSize(size);
-}
-bool CXFA_WidgetAcc::CalculateImageAutoSize(CFX_SizeF& size) {
- if (!GetImageImage()) {
- LoadImageImage();
- }
- size.clear();
- if (CFX_DIBitmap* pBitmap = GetImageImage()) {
- int32_t iImageXDpi = 0;
- int32_t iImageYDpi = 0;
- GetImageDpi(iImageXDpi, iImageYDpi);
- CFX_RectF rtImage(
- 0, 0,
- XFA_UnitPx2Pt((FX_FLOAT)pBitmap->GetWidth(), (FX_FLOAT)iImageXDpi),
- XFA_UnitPx2Pt((FX_FLOAT)pBitmap->GetHeight(), (FX_FLOAT)iImageYDpi));
-
- CFX_RectF rtFit;
- if (GetWidth(rtFit.width)) {
- GetWidthWithoutMargin(rtFit.width);
- } else {
- rtFit.width = rtImage.width;
- }
- if (GetHeight(rtFit.height)) {
- GetHeightWithoutMargin(rtFit.height);
- } else {
- rtFit.height = rtImage.height;
- }
- size = rtFit.Size();
- }
- return CalculateWidgetAutoSize(size);
-}
-bool CXFA_WidgetAcc::CalculateImageEditAutoSize(CFX_SizeF& size) {
- if (!GetImageEditImage()) {
- LoadImageEditImage();
- }
- size.clear();
- if (CFX_DIBitmap* pBitmap = GetImageEditImage()) {
- int32_t iImageXDpi = 0;
- int32_t iImageYDpi = 0;
- GetImageEditDpi(iImageXDpi, iImageYDpi);
- CFX_RectF rtImage(
- 0, 0,
- XFA_UnitPx2Pt((FX_FLOAT)pBitmap->GetWidth(), (FX_FLOAT)iImageXDpi),
- XFA_UnitPx2Pt((FX_FLOAT)pBitmap->GetHeight(), (FX_FLOAT)iImageYDpi));
-
- CFX_RectF rtFit;
- if (GetWidth(rtFit.width)) {
- GetWidthWithoutMargin(rtFit.width);
- } else {
- rtFit.width = rtImage.width;
- }
- if (GetHeight(rtFit.height)) {
- GetHeightWithoutMargin(rtFit.height);
- } else {
- rtFit.height = rtImage.height;
- }
- size.width = rtFit.width;
- size.height = rtFit.height;
- }
- return CalculateFieldAutoSize(size);
-}
-bool CXFA_WidgetAcc::LoadImageImage() {
- InitLayoutData();
- return static_cast<CXFA_ImageLayoutData*>(m_pLayoutData.get())
- ->LoadImageData(this);
-}
-bool CXFA_WidgetAcc::LoadImageEditImage() {
- InitLayoutData();
- return static_cast<CXFA_ImageEditData*>(m_pLayoutData.get())
- ->LoadImageData(this);
-}
-void CXFA_WidgetAcc::GetImageDpi(int32_t& iImageXDpi, int32_t& iImageYDpi) {
- CXFA_ImageLayoutData* pData =
- static_cast<CXFA_ImageLayoutData*>(m_pLayoutData.get());
- iImageXDpi = pData->m_iImageXDpi;
- iImageYDpi = pData->m_iImageYDpi;
-}
-void CXFA_WidgetAcc::GetImageEditDpi(int32_t& iImageXDpi, int32_t& iImageYDpi) {
- CXFA_ImageEditData* pData =
- static_cast<CXFA_ImageEditData*>(m_pLayoutData.get());
- iImageXDpi = pData->m_iImageXDpi;
- iImageYDpi = pData->m_iImageYDpi;
-}
-bool CXFA_WidgetAcc::CalculateTextAutoSize(CFX_SizeF& size) {
- LoadText();
- CXFA_TextLayout* pTextLayout =
- static_cast<CXFA_TextLayoutData*>(m_pLayoutData.get())->GetTextLayout();
- if (pTextLayout) {
- size.width = pTextLayout->StartLayout(size.width);
- size.height = pTextLayout->GetLayoutHeight();
- }
- return CalculateWidgetAutoSize(size);
-}
-void CXFA_WidgetAcc::LoadText() {
- InitLayoutData();
- static_cast<CXFA_TextLayoutData*>(m_pLayoutData.get())->LoadText(this);
-}
-FX_FLOAT CXFA_WidgetAcc::CalculateWidgetAutoWidth(FX_FLOAT fWidthCalc) {
- CXFA_Margin mgWidget = GetMargin();
- if (mgWidget) {
- FX_FLOAT fLeftInset, fRightInset;
- mgWidget.GetLeftInset(fLeftInset);
- mgWidget.GetRightInset(fRightInset);
- fWidthCalc += fLeftInset + fRightInset;
- }
- FX_FLOAT fMin = 0, fMax = 0;
- if (GetMinWidth(fMin)) {
- fWidthCalc = std::max(fWidthCalc, fMin);
- }
- if (GetMaxWidth(fMax) && fMax > 0) {
- fWidthCalc = std::min(fWidthCalc, fMax);
- }
- return fWidthCalc;
-}
-FX_FLOAT CXFA_WidgetAcc::GetWidthWithoutMargin(FX_FLOAT fWidthCalc) {
- CXFA_Margin mgWidget = GetMargin();
- if (mgWidget) {
- FX_FLOAT fLeftInset, fRightInset;
- mgWidget.GetLeftInset(fLeftInset);
- mgWidget.GetRightInset(fRightInset);
- fWidthCalc -= fLeftInset + fRightInset;
- }
- return fWidthCalc;
-}
-FX_FLOAT CXFA_WidgetAcc::CalculateWidgetAutoHeight(FX_FLOAT fHeightCalc) {
- CXFA_Margin mgWidget = GetMargin();
- if (mgWidget) {
- FX_FLOAT fTopInset, fBottomInset;
- mgWidget.GetTopInset(fTopInset);
- mgWidget.GetBottomInset(fBottomInset);
- fHeightCalc += fTopInset + fBottomInset;
- }
- FX_FLOAT fMin = 0, fMax = 0;
- if (GetMinHeight(fMin)) {
- fHeightCalc = std::max(fHeightCalc, fMin);
- }
- if (GetMaxHeight(fMax) && fMax > 0) {
- fHeightCalc = std::min(fHeightCalc, fMax);
- }
- return fHeightCalc;
-}
-FX_FLOAT CXFA_WidgetAcc::GetHeightWithoutMargin(FX_FLOAT fHeightCalc) {
- CXFA_Margin mgWidget = GetMargin();
- if (mgWidget) {
- FX_FLOAT fTopInset, fBottomInset;
- mgWidget.GetTopInset(fTopInset);
- mgWidget.GetBottomInset(fBottomInset);
- fHeightCalc -= fTopInset + fBottomInset;
- }
- return fHeightCalc;
-}
-void CXFA_WidgetAcc::StartWidgetLayout(FX_FLOAT& fCalcWidth,
- FX_FLOAT& fCalcHeight) {
- InitLayoutData();
- XFA_Element eUIType = GetUIType();
- if (eUIType == XFA_Element::Text) {
- m_pLayoutData->m_fWidgetHeight = -1;
- GetHeight(m_pLayoutData->m_fWidgetHeight);
- StartTextLayout(fCalcWidth, fCalcHeight);
- return;
- }
- if (fCalcWidth > 0 && fCalcHeight > 0) {
- return;
- }
- m_pLayoutData->m_fWidgetHeight = -1;
- FX_FLOAT fWidth = 0;
- if (fCalcWidth > 0 && fCalcHeight < 0) {
- if (!GetHeight(fCalcHeight)) {
- CalculateAccWidthAndHeight(eUIType, fCalcWidth, fCalcHeight);
- }
- m_pLayoutData->m_fWidgetHeight = fCalcHeight;
- return;
- }
- if (fCalcWidth < 0 && fCalcHeight < 0) {
- if (!GetWidth(fWidth) || !GetHeight(fCalcHeight)) {
- CalculateAccWidthAndHeight(eUIType, fWidth, fCalcHeight);
- }
- fCalcWidth = fWidth;
- }
- m_pLayoutData->m_fWidgetHeight = fCalcHeight;
-}
-void CXFA_WidgetAcc::CalculateAccWidthAndHeight(XFA_Element eUIType,
- FX_FLOAT& fWidth,
- FX_FLOAT& fCalcHeight) {
- CFX_SizeF sz(fWidth, m_pLayoutData->m_fWidgetHeight);
- switch (eUIType) {
- case XFA_Element::Barcode:
- case XFA_Element::ChoiceList:
- case XFA_Element::Signature:
- CalculateFieldAutoSize(sz);
- break;
- case XFA_Element::ImageEdit:
- CalculateImageEditAutoSize(sz);
- break;
- case XFA_Element::Button:
- CalculatePushButtonAutoSize(sz);
- break;
- case XFA_Element::CheckButton:
- CalculateCheckButtonAutoSize(sz);
- break;
- case XFA_Element::DateTimeEdit:
- case XFA_Element::NumericEdit:
- case XFA_Element::PasswordEdit:
- case XFA_Element::TextEdit:
- CalculateTextEditAutoSize(sz);
- break;
- case XFA_Element::Image:
- CalculateImageAutoSize(sz);
- break;
- case XFA_Element::Arc:
- case XFA_Element::Line:
- case XFA_Element::Rectangle:
- case XFA_Element::Subform:
- case XFA_Element::ExclGroup:
- CalculateWidgetAutoSize(sz);
- break;
- default:
- break;
- }
- fWidth = sz.width;
- m_pLayoutData->m_fWidgetHeight = sz.height;
- fCalcHeight = sz.height;
-}
-bool CXFA_WidgetAcc::FindSplitPos(int32_t iBlockIndex, FX_FLOAT& fCalcHeight) {
- XFA_Element eUIType = GetUIType();
- if (eUIType == XFA_Element::Subform) {
- return false;
- }
- if (eUIType != XFA_Element::Text && eUIType != XFA_Element::TextEdit &&
- eUIType != XFA_Element::NumericEdit &&
- eUIType != XFA_Element::PasswordEdit) {
- fCalcHeight = 0;
- return true;
- }
- FX_FLOAT fTopInset = 0;
- FX_FLOAT fBottomInset = 0;
- if (iBlockIndex == 0) {
- CXFA_Margin mgWidget = GetMargin();
- if (mgWidget) {
- mgWidget.GetTopInset(fTopInset);
- mgWidget.GetBottomInset(fBottomInset);
- }
- CFX_RectF rtUIMargin = GetUIMargin();
- fTopInset += rtUIMargin.top;
- fBottomInset += rtUIMargin.width;
- }
- if (eUIType == XFA_Element::Text) {
- FX_FLOAT fHeight = fCalcHeight;
- if (iBlockIndex == 0) {
- fCalcHeight = fCalcHeight - fTopInset;
- if (fCalcHeight < 0) {
- fCalcHeight = 0;
- }
- }
- CXFA_TextLayout* pTextLayout =
- static_cast<CXFA_TextLayoutData*>(m_pLayoutData.get())->GetTextLayout();
- pTextLayout->DoLayout(iBlockIndex, fCalcHeight, fCalcHeight,
- m_pLayoutData->m_fWidgetHeight - fTopInset);
- if (fCalcHeight != 0) {
- if (iBlockIndex == 0) {
- fCalcHeight = fCalcHeight + fTopInset;
- }
- if (fabs(fHeight - fCalcHeight) < XFA_FLOAT_PERCISION) {
- return false;
- }
- }
- return true;
- }
- XFA_ATTRIBUTEENUM iCapPlacement = XFA_ATTRIBUTEENUM_Unknown;
- FX_FLOAT fCapReserve = 0;
- if (iBlockIndex == 0) {
- CXFA_Caption caption = GetCaption();
- if (caption && caption.GetPresence() != XFA_ATTRIBUTEENUM_Hidden) {
- iCapPlacement = (XFA_ATTRIBUTEENUM)caption.GetPlacementType();
- fCapReserve = caption.GetReserve();
- }
- if (iCapPlacement == XFA_ATTRIBUTEENUM_Top &&
- fCalcHeight < fCapReserve + fTopInset) {
- fCalcHeight = 0;
- return true;
- }
- if (iCapPlacement == XFA_ATTRIBUTEENUM_Bottom &&
- m_pLayoutData->m_fWidgetHeight - fCapReserve - fBottomInset) {
- fCalcHeight = 0;
- return true;
- }
- if (iCapPlacement != XFA_ATTRIBUTEENUM_Top) {
- fCapReserve = 0;
- }
- }
- CXFA_FieldLayoutData* pFieldData =
- static_cast<CXFA_FieldLayoutData*>(m_pLayoutData.get());
- int32_t iLinesCount = 0;
- FX_FLOAT fHeight = m_pLayoutData->m_fWidgetHeight;
- CFX_WideString wsText;
- GetValue(wsText, XFA_VALUEPICTURE_Display);
- if (wsText.IsEmpty()) {
- iLinesCount = 1;
- } else {
- if (!pFieldData->m_pTextOut) {
- FX_FLOAT fWidth = 0;
- GetWidth(fWidth);
- CalculateAccWidthAndHeight(eUIType, fWidth, fHeight);
- }
- iLinesCount = pFieldData->m_pTextOut->GetTotalLines();
- }
- std::vector<FX_FLOAT>* pFieldArray = &pFieldData->m_FieldSplitArray;
- int32_t iFieldSplitCount = pdfium::CollectionSize<int32_t>(*pFieldArray);
- for (int32_t i = 0; i < iBlockIndex * 3; i += 3) {
- iLinesCount -= (int32_t)(*pFieldArray)[i + 1];
- fHeight -= (*pFieldArray)[i + 2];
- }
- if (iLinesCount == 0) {
- return false;
- }
- FX_FLOAT fLineHeight = GetLineHeight();
- FX_FLOAT fFontSize = GetFontSize();
- FX_FLOAT fTextHeight = iLinesCount * fLineHeight - fLineHeight + fFontSize;
- FX_FLOAT fSpaceAbove = 0;
- FX_FLOAT fStartOffset = 0;
- if (fHeight > 0.1f && iBlockIndex == 0) {
- fStartOffset = fTopInset;
- fHeight -= (fTopInset + fBottomInset);
- if (CXFA_Para para = GetPara()) {
- fSpaceAbove = para.GetSpaceAbove();
- FX_FLOAT fSpaceBelow = para.GetSpaceBelow();
- fHeight -= (fSpaceAbove + fSpaceBelow);
- switch (para.GetVerticalAlign()) {
- case XFA_ATTRIBUTEENUM_Top:
- fStartOffset += fSpaceAbove;
- break;
- case XFA_ATTRIBUTEENUM_Middle:
- fStartOffset += ((fHeight - fTextHeight) / 2 + fSpaceAbove);
- break;
- case XFA_ATTRIBUTEENUM_Bottom:
- fStartOffset += (fHeight - fTextHeight + fSpaceAbove);
- break;
- }
- }
- if (fStartOffset < 0.1f)
- fStartOffset = 0;
- }
- for (int32_t i = iBlockIndex - 1; iBlockIndex > 0 && i < iBlockIndex; i++) {
- fStartOffset = (*pFieldArray)[i * 3] - (*pFieldArray)[i * 3 + 2];
- if (fStartOffset < 0.1f)
- fStartOffset = 0;
- }
- if (iFieldSplitCount / 3 == (iBlockIndex + 1)) {
- (*pFieldArray)[0] = fStartOffset;
- } else {
- pFieldArray->push_back(fStartOffset);
- }
- XFA_VERSION version = GetDoc()->GetXFADoc()->GetCurVersionMode();
- bool bCanSplitNoContent = false;
- XFA_ATTRIBUTEENUM eLayoutMode;
- GetNode()
- ->GetNodeItem(XFA_NODEITEM_Parent)
- ->TryEnum(XFA_ATTRIBUTE_Layout, eLayoutMode, true);
- if ((eLayoutMode == XFA_ATTRIBUTEENUM_Position ||
- eLayoutMode == XFA_ATTRIBUTEENUM_Tb ||
- eLayoutMode == XFA_ATTRIBUTEENUM_Row ||
- eLayoutMode == XFA_ATTRIBUTEENUM_Table) &&
- version > XFA_VERSION_208) {
- bCanSplitNoContent = true;
- }
- if ((eLayoutMode == XFA_ATTRIBUTEENUM_Tb ||
- eLayoutMode == XFA_ATTRIBUTEENUM_Row ||
- eLayoutMode == XFA_ATTRIBUTEENUM_Table) &&
- version <= XFA_VERSION_208) {
- if (fStartOffset < fCalcHeight) {
- bCanSplitNoContent = true;
- } else {
- fCalcHeight = 0;
- return true;
- }
- }
- if (bCanSplitNoContent) {
- if ((fCalcHeight - fTopInset - fSpaceAbove < fLineHeight)) {
- fCalcHeight = 0;
- return true;
- }
- if (fStartOffset + XFA_FLOAT_PERCISION >= fCalcHeight) {
- if (iFieldSplitCount / 3 == (iBlockIndex + 1)) {
- (*pFieldArray)[iBlockIndex * 3 + 1] = 0;
- (*pFieldArray)[iBlockIndex * 3 + 2] = fCalcHeight;
- } else {
- pFieldArray->push_back(0);
- pFieldArray->push_back(fCalcHeight);
- }
- return false;
- }
- if (fCalcHeight - fStartOffset < fLineHeight) {
- fCalcHeight = fStartOffset;
- if (iFieldSplitCount / 3 == (iBlockIndex + 1)) {
- (*pFieldArray)[iBlockIndex * 3 + 1] = 0;
- (*pFieldArray)[iBlockIndex * 3 + 2] = fCalcHeight;
- } else {
- pFieldArray->push_back(0);
- pFieldArray->push_back(fCalcHeight);
- }
- return true;
- }
- FX_FLOAT fTextNum =
- fCalcHeight + XFA_FLOAT_PERCISION - fCapReserve - fStartOffset;
- int32_t iLineNum =
- (int32_t)((fTextNum + (fLineHeight - fFontSize)) / fLineHeight);
- if (iLineNum >= iLinesCount) {
- if (fCalcHeight - fStartOffset - fTextHeight >= fFontSize) {
- if (iFieldSplitCount / 3 == (iBlockIndex + 1)) {
- (*pFieldArray)[iBlockIndex * 3 + 1] = (FX_FLOAT)iLinesCount;
- (*pFieldArray)[iBlockIndex * 3 + 2] = fCalcHeight;
- } else {
- pFieldArray->push_back((FX_FLOAT)iLinesCount);
- pFieldArray->push_back(fCalcHeight);
- }
- return false;
- }
- if (fHeight - fStartOffset - fTextHeight < fFontSize) {
- iLineNum -= 1;
- if (iLineNum == 0) {
- fCalcHeight = 0;
- return true;
- }
- } else {
- iLineNum = (int32_t)(fTextNum / fLineHeight);
- }
- }
- if (iLineNum > 0) {
- FX_FLOAT fSplitHeight =
- iLineNum * fLineHeight + fCapReserve + fStartOffset;
- if (iFieldSplitCount / 3 == (iBlockIndex + 1)) {
- (*pFieldArray)[iBlockIndex * 3 + 1] = (FX_FLOAT)iLineNum;
- (*pFieldArray)[iBlockIndex * 3 + 2] = fSplitHeight;
- } else {
- pFieldArray->push_back((FX_FLOAT)iLineNum);
- pFieldArray->push_back(fSplitHeight);
- }
- if (fabs(fSplitHeight - fCalcHeight) < XFA_FLOAT_PERCISION) {
- return false;
- }
- fCalcHeight = fSplitHeight;
- return true;
- }
- }
- fCalcHeight = 0;
- return true;
-}
-void CXFA_WidgetAcc::InitLayoutData() {
- if (m_pLayoutData) {
- return;
- }
- switch (GetUIType()) {
- case XFA_Element::Text:
- m_pLayoutData = pdfium::MakeUnique<CXFA_TextLayoutData>();
- return;
- case XFA_Element::TextEdit:
- m_pLayoutData = pdfium::MakeUnique<CXFA_TextEditData>();
- return;
- case XFA_Element::Image:
- m_pLayoutData = pdfium::MakeUnique<CXFA_ImageLayoutData>();
- return;
- case XFA_Element::ImageEdit:
- m_pLayoutData = pdfium::MakeUnique<CXFA_ImageEditData>();
- return;
- default:
- break;
- }
- if (GetElementType() == XFA_Element::Field) {
- m_pLayoutData = pdfium::MakeUnique<CXFA_FieldLayoutData>();
- return;
- }
- m_pLayoutData = pdfium::MakeUnique<CXFA_WidgetLayoutData>();
-}
-
-void CXFA_WidgetAcc::StartTextLayout(FX_FLOAT& fCalcWidth,
- FX_FLOAT& fCalcHeight) {
- LoadText();
- CXFA_TextLayout* pTextLayout =
- static_cast<CXFA_TextLayoutData*>(m_pLayoutData.get())->GetTextLayout();
- FX_FLOAT fTextHeight = 0;
- if (fCalcWidth > 0 && fCalcHeight > 0) {
- FX_FLOAT fWidth = GetWidthWithoutMargin(fCalcWidth);
- pTextLayout->StartLayout(fWidth);
- fTextHeight = fCalcHeight;
- fTextHeight = GetHeightWithoutMargin(fTextHeight);
- pTextLayout->DoLayout(0, fTextHeight, -1, fTextHeight);
- return;
- }
- if (fCalcWidth > 0 && fCalcHeight < 0) {
- FX_FLOAT fWidth = GetWidthWithoutMargin(fCalcWidth);
- pTextLayout->StartLayout(fWidth);
- }
- if (fCalcWidth < 0 && fCalcHeight < 0) {
- FX_FLOAT fMaxWidth = -1;
- bool bRet = GetWidth(fMaxWidth);
- if (bRet) {
- FX_FLOAT fWidth = GetWidthWithoutMargin(fMaxWidth);
- pTextLayout->StartLayout(fWidth);
- } else {
- FX_FLOAT fWidth = pTextLayout->StartLayout(fMaxWidth);
- fMaxWidth = CalculateWidgetAutoWidth(fWidth);
- fWidth = GetWidthWithoutMargin(fMaxWidth);
- pTextLayout->StartLayout(fWidth);
- }
- fCalcWidth = fMaxWidth;
- }
- if (m_pLayoutData->m_fWidgetHeight < 0) {
- m_pLayoutData->m_fWidgetHeight = pTextLayout->GetLayoutHeight();
- m_pLayoutData->m_fWidgetHeight =
- CalculateWidgetAutoHeight(m_pLayoutData->m_fWidgetHeight);
- }
- fTextHeight = m_pLayoutData->m_fWidgetHeight;
- fTextHeight = GetHeightWithoutMargin(fTextHeight);
- pTextLayout->DoLayout(0, fTextHeight, -1, fTextHeight);
- fCalcHeight = m_pLayoutData->m_fWidgetHeight;
-}
-bool CXFA_WidgetAcc::LoadCaption() {
- InitLayoutData();
- return static_cast<CXFA_FieldLayoutData*>(m_pLayoutData.get())
- ->LoadCaption(this);
-}
-CXFA_TextLayout* CXFA_WidgetAcc::GetCaptionTextLayout() {
- return m_pLayoutData
- ? static_cast<CXFA_FieldLayoutData*>(m_pLayoutData.get())
- ->m_pCapTextLayout.get()
- : nullptr;
-}
-CXFA_TextLayout* CXFA_WidgetAcc::GetTextLayout() {
- return m_pLayoutData
- ? static_cast<CXFA_TextLayoutData*>(m_pLayoutData.get())
- ->GetTextLayout()
- : nullptr;
-}
-CFX_DIBitmap* CXFA_WidgetAcc::GetImageImage() {
- return m_pLayoutData
- ? static_cast<CXFA_ImageLayoutData*>(m_pLayoutData.get())
- ->m_pDIBitmap
- : nullptr;
-}
-CFX_DIBitmap* CXFA_WidgetAcc::GetImageEditImage() {
- return m_pLayoutData
- ? static_cast<CXFA_ImageEditData*>(m_pLayoutData.get())
- ->m_pDIBitmap
- : nullptr;
-}
-
-void CXFA_WidgetAcc::SetImageImage(CFX_DIBitmap* newImage) {
- CXFA_ImageLayoutData* pData =
- static_cast<CXFA_ImageLayoutData*>(m_pLayoutData.get());
- if (pData->m_pDIBitmap == newImage)
- return;
-
- if (pData->m_pDIBitmap && !pData->m_bNamedImage)
- delete pData->m_pDIBitmap;
-
- pData->m_pDIBitmap = newImage;
-}
-
-void CXFA_WidgetAcc::SetImageEditImage(CFX_DIBitmap* newImage) {
- CXFA_ImageEditData* pData =
- static_cast<CXFA_ImageEditData*>(m_pLayoutData.get());
- if (pData->m_pDIBitmap == newImage)
- return;
-
- if (pData->m_pDIBitmap && !pData->m_bNamedImage)
- delete pData->m_pDIBitmap;
-
- pData->m_pDIBitmap = newImage;
-}
-
-CXFA_WidgetLayoutData* CXFA_WidgetAcc::GetWidgetLayoutData() {
- return m_pLayoutData.get();
-}
-
-CFX_RetainPtr<CFGAS_GEFont> CXFA_WidgetAcc::GetFDEFont() {
- CFX_WideStringC wsFontName = L"Courier";
- uint32_t dwFontStyle = 0;
- if (CXFA_Font font = GetFont()) {
- if (font.IsBold())
- dwFontStyle |= FX_FONTSTYLE_Bold;
- if (font.IsItalic())
- dwFontStyle |= FX_FONTSTYLE_Italic;
- font.GetTypeface(wsFontName);
- }
-
- auto pDoc = GetDoc();
- return pDoc->GetApp()->GetXFAFontMgr()->GetFont(pDoc, wsFontName,
- dwFontStyle);
-}
-FX_FLOAT CXFA_WidgetAcc::GetFontSize() {
- FX_FLOAT fFontSize = 10.0f;
- if (CXFA_Font font = GetFont()) {
- fFontSize = font.GetFontSize();
- }
- return fFontSize < 0.1f ? 10.0f : fFontSize;
-}
-FX_FLOAT CXFA_WidgetAcc::GetLineHeight() {
- FX_FLOAT fLineHeight = 0;
- if (CXFA_Para para = GetPara()) {
- fLineHeight = para.GetLineHeight();
- }
- if (fLineHeight < 1) {
- fLineHeight = GetFontSize() * 1.2f;
- }
- return fLineHeight;
-}
-FX_ARGB CXFA_WidgetAcc::GetTextColor() {
- if (CXFA_Font font = GetFont()) {
- return font.GetColor();
- }
- return 0xFF000000;
-}
CXFA_Node* CXFA_TextProvider::GetTextNode(bool& bRichText) {
bRichText = false;
if (m_pTextNode) {
@@ -1636,7 +137,7 @@ CXFA_Font CXFA_TextProvider::GetFontNode() {
bool CXFA_TextProvider::IsCheckButtonAndAutoWidth() {
XFA_Element eType = m_pWidgetAcc->GetUIType();
if (eType == XFA_Element::CheckButton) {
- FX_FLOAT fWidth = 0;
+ float fWidth = 0;
return !m_pWidgetAcc->GetWidth(fWidth);
}
return false;
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffwidgetacc.h b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffwidgetacc.h
index 2daa35e6cd5..c4988fde661 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffwidgetacc.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffwidgetacc.h
@@ -9,7 +9,7 @@
#include "core/fxcrt/fx_string.h"
#include "xfa/fxfa/app/cxfa_textlayout.h"
-#include "xfa/fxfa/fxfa_widget.h"
+#include "xfa/fxfa/cxfa_widgetacc.h"
#include "xfa/fxfa/parser/cxfa_font.h"
#include "xfa/fxfa/parser/cxfa_para.h"
@@ -44,7 +44,7 @@ class CXFA_TextProvider {
const CFX_WideString& wsAttr,
CFX_WideString& wsValue);
- protected:
+ private:
CXFA_WidgetAcc* m_pWidgetAcc;
XFA_TEXTPROVIDERTYPE m_eType;
CXFA_Node* m_pTextNode;
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffwidgethandler.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffwidgethandler.cpp
deleted file mode 100644
index 2fddfb61569..00000000000
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_ffwidgethandler.cpp
+++ /dev/null
@@ -1,533 +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
-
-#include "xfa/fxfa/xfa_ffwidgethandler.h"
-
-#include <vector>
-
-#include "xfa/fxfa/app/xfa_ffchoicelist.h"
-#include "xfa/fxfa/app/xfa_fffield.h"
-#include "xfa/fxfa/app/xfa_fwladapter.h"
-#include "xfa/fxfa/parser/cxfa_layoutprocessor.h"
-#include "xfa/fxfa/parser/cxfa_measurement.h"
-#include "xfa/fxfa/xfa_ffdoc.h"
-#include "xfa/fxfa/xfa_ffdocview.h"
-#include "xfa/fxfa/xfa_ffwidget.h"
-
-CXFA_FFWidgetHandler::CXFA_FFWidgetHandler(CXFA_FFDocView* pDocView)
- : m_pDocView(pDocView) {}
-
-CXFA_FFWidgetHandler::~CXFA_FFWidgetHandler() {}
-
-bool CXFA_FFWidgetHandler::OnMouseEnter(CXFA_FFWidget* hWidget) {
- m_pDocView->LockUpdate();
- bool bRet = hWidget->OnMouseEnter();
- m_pDocView->UnlockUpdate();
- m_pDocView->UpdateDocView();
- return bRet;
-}
-
-bool CXFA_FFWidgetHandler::OnMouseExit(CXFA_FFWidget* hWidget) {
- m_pDocView->LockUpdate();
- bool bRet = hWidget->OnMouseExit();
- m_pDocView->UnlockUpdate();
- m_pDocView->UpdateDocView();
- return bRet;
-}
-
-bool CXFA_FFWidgetHandler::OnLButtonDown(CXFA_FFWidget* hWidget,
- uint32_t dwFlags,
- const CFX_PointF& point) {
- m_pDocView->LockUpdate();
- bool bRet = hWidget->OnLButtonDown(dwFlags, hWidget->Rotate2Normal(point));
- if (bRet && m_pDocView->SetFocus(hWidget)) {
- m_pDocView->GetDoc()->GetDocEnvironment()->SetFocusWidget(
- m_pDocView->GetDoc(), hWidget);
- }
- m_pDocView->UnlockUpdate();
- m_pDocView->UpdateDocView();
- return bRet;
-}
-
-bool CXFA_FFWidgetHandler::OnLButtonUp(CXFA_FFWidget* hWidget,
- uint32_t dwFlags,
- const CFX_PointF& point) {
- m_pDocView->LockUpdate();
- m_pDocView->m_bLayoutEvent = true;
- bool bRet = hWidget->OnLButtonUp(dwFlags, hWidget->Rotate2Normal(point));
- m_pDocView->UnlockUpdate();
- m_pDocView->UpdateDocView();
- return bRet;
-}
-
-bool CXFA_FFWidgetHandler::OnLButtonDblClk(CXFA_FFWidget* hWidget,
- uint32_t dwFlags,
- const CFX_PointF& point) {
- bool bRet = hWidget->OnLButtonDblClk(dwFlags, hWidget->Rotate2Normal(point));
- m_pDocView->RunInvalidate();
- return bRet;
-}
-
-bool CXFA_FFWidgetHandler::OnMouseMove(CXFA_FFWidget* hWidget,
- uint32_t dwFlags,
- const CFX_PointF& point) {
- bool bRet = hWidget->OnMouseMove(dwFlags, hWidget->Rotate2Normal(point));
- m_pDocView->RunInvalidate();
- return bRet;
-}
-
-bool CXFA_FFWidgetHandler::OnMouseWheel(CXFA_FFWidget* hWidget,
- uint32_t dwFlags,
- int16_t zDelta,
- const CFX_PointF& point) {
- bool bRet =
- hWidget->OnMouseWheel(dwFlags, zDelta, hWidget->Rotate2Normal(point));
- m_pDocView->RunInvalidate();
- return bRet;
-}
-
-bool CXFA_FFWidgetHandler::OnRButtonDown(CXFA_FFWidget* hWidget,
- uint32_t dwFlags,
- const CFX_PointF& point) {
- bool bRet = hWidget->OnRButtonDown(dwFlags, hWidget->Rotate2Normal(point));
- if (bRet && m_pDocView->SetFocus(hWidget)) {
- m_pDocView->GetDoc()->GetDocEnvironment()->SetFocusWidget(
- m_pDocView->GetDoc(), hWidget);
- }
- m_pDocView->RunInvalidate();
- return bRet;
-}
-
-bool CXFA_FFWidgetHandler::OnRButtonUp(CXFA_FFWidget* hWidget,
- uint32_t dwFlags,
- const CFX_PointF& point) {
- bool bRet = hWidget->OnRButtonUp(dwFlags, hWidget->Rotate2Normal(point));
- m_pDocView->RunInvalidate();
- return bRet;
-}
-
-bool CXFA_FFWidgetHandler::OnRButtonDblClk(CXFA_FFWidget* hWidget,
- uint32_t dwFlags,
- const CFX_PointF& point) {
- bool bRet = hWidget->OnRButtonDblClk(dwFlags, hWidget->Rotate2Normal(point));
- m_pDocView->RunInvalidate();
- return bRet;
-}
-
-bool CXFA_FFWidgetHandler::OnKeyDown(CXFA_FFWidget* hWidget,
- uint32_t dwKeyCode,
- uint32_t dwFlags) {
- bool bRet = hWidget->OnKeyDown(dwKeyCode, dwFlags);
- m_pDocView->RunInvalidate();
- m_pDocView->UpdateDocView();
- return bRet;
-}
-
-bool CXFA_FFWidgetHandler::OnKeyUp(CXFA_FFWidget* hWidget,
- uint32_t dwKeyCode,
- uint32_t dwFlags) {
- bool bRet = hWidget->OnKeyUp(dwKeyCode, dwFlags);
- m_pDocView->RunInvalidate();
- return bRet;
-}
-
-bool CXFA_FFWidgetHandler::OnChar(CXFA_FFWidget* hWidget,
- uint32_t dwChar,
- uint32_t dwFlags) {
- bool bRet = hWidget->OnChar(dwChar, dwFlags);
- m_pDocView->RunInvalidate();
- return bRet;
-}
-
-FWL_WidgetHit CXFA_FFWidgetHandler::OnHitTest(CXFA_FFWidget* hWidget,
- const CFX_PointF& point) {
- if (!(hWidget->GetStatus() & XFA_WidgetStatus_Visible))
- return FWL_WidgetHit::Unknown;
- return hWidget->OnHitTest(hWidget->Rotate2Normal(point));
-}
-
-bool CXFA_FFWidgetHandler::OnSetCursor(CXFA_FFWidget* hWidget,
- const CFX_PointF& point) {
- return hWidget->OnSetCursor(hWidget->Rotate2Normal(point));
-}
-
-void CXFA_FFWidgetHandler::RenderWidget(CXFA_FFWidget* hWidget,
- CFX_Graphics* pGS,
- CFX_Matrix* pMatrix,
- bool bHighlight) {
- hWidget->RenderWidget(pGS, pMatrix,
- bHighlight ? XFA_WidgetStatus_Highlight : 0);
-}
-
-bool CXFA_FFWidgetHandler::HasEvent(CXFA_WidgetAcc* pWidgetAcc,
- XFA_EVENTTYPE eEventType) {
- if (!pWidgetAcc || eEventType == XFA_EVENT_Unknown)
- return false;
- if (pWidgetAcc->GetElementType() == XFA_Element::Draw)
- return false;
-
- switch (eEventType) {
- case XFA_EVENT_Calculate: {
- CXFA_Calculate calc = pWidgetAcc->GetCalculate();
- if (!calc)
- return false;
- if (calc.GetScript())
- return true;
- return false;
- }
- case XFA_EVENT_Validate: {
- CXFA_Validate val = pWidgetAcc->GetValidate();
- if (!val)
- return false;
- if (val.GetScript())
- return true;
- return false;
- }
- default:
- break;
- }
- CXFA_NodeArray eventArray;
- return pWidgetAcc->GetEventByActivity(gs_EventActivity[eEventType],
- eventArray) > 0;
-}
-
-int32_t CXFA_FFWidgetHandler::ProcessEvent(CXFA_WidgetAcc* pWidgetAcc,
- CXFA_EventParam* pParam) {
- if (!pParam || pParam->m_eType == XFA_EVENT_Unknown)
- return XFA_EVENTERROR_NotExist;
- if (!pWidgetAcc || pWidgetAcc->GetElementType() == XFA_Element::Draw)
- return XFA_EVENTERROR_NotExist;
-
- switch (pParam->m_eType) {
- case XFA_EVENT_Calculate:
- return pWidgetAcc->ProcessCalculate();
- case XFA_EVENT_Validate:
- if (m_pDocView->GetDoc()->GetDocEnvironment()->IsValidationsEnabled(
- m_pDocView->GetDoc())) {
- return pWidgetAcc->ProcessValidate();
- }
- return XFA_EVENTERROR_Disabled;
- case XFA_EVENT_InitCalculate: {
- CXFA_Calculate calc = pWidgetAcc->GetCalculate();
- if (!calc)
- return XFA_EVENTERROR_NotExist;
- if (pWidgetAcc->GetNode()->IsUserInteractive())
- return XFA_EVENTERROR_Disabled;
-
- CXFA_Script script = calc.GetScript();
- return pWidgetAcc->ExecuteScript(script, pParam);
- }
- default:
- break;
- }
- int32_t iRet =
- pWidgetAcc->ProcessEvent(gs_EventActivity[pParam->m_eType], pParam);
- return iRet;
-}
-
-CXFA_FFWidget* CXFA_FFWidgetHandler::CreateWidget(CXFA_FFWidget* hParent,
- XFA_WIDGETTYPE eType,
- CXFA_FFWidget* hBefore) {
- CXFA_Node* pParentFormItem =
- hParent ? hParent->GetDataAcc()->GetNode() : nullptr;
- CXFA_Node* pBeforeFormItem =
- hBefore ? hBefore->GetDataAcc()->GetNode() : nullptr;
- CXFA_Node* pNewFormItem =
- CreateWidgetFormItem(eType, pParentFormItem, pBeforeFormItem);
- if (!pNewFormItem)
- return nullptr;
-
- pNewFormItem->GetTemplateNode()->SetFlag(XFA_NodeFlag_Initialized, true);
- pNewFormItem->SetFlag(XFA_NodeFlag_Initialized, true);
- m_pDocView->RunLayout();
- CXFA_LayoutItem* pLayout =
- m_pDocView->GetXFALayout()->GetLayoutItem(pNewFormItem);
- return static_cast<CXFA_FFWidget*>(pLayout);
-}
-
-CXFA_Node* CXFA_FFWidgetHandler::CreateWidgetFormItem(
- XFA_WIDGETTYPE eType,
- CXFA_Node* pParent,
- CXFA_Node* pBefore) const {
- switch (eType) {
- case XFA_WIDGETTYPE_Barcode:
- return nullptr;
- case XFA_WIDGETTYPE_PushButton:
- return CreatePushButton(pParent, pBefore);
- case XFA_WIDGETTYPE_CheckButton:
- return CreateCheckButton(pParent, pBefore);
- case XFA_WIDGETTYPE_ExcludeGroup:
- return CreateExclGroup(pParent, pBefore);
- case XFA_WIDGETTYPE_RadioButton:
- return CreateRadioButton(pParent, pBefore);
- case XFA_WIDGETTYPE_Arc:
- return CreateArc(pParent, pBefore);
- case XFA_WIDGETTYPE_Rectangle:
- return CreateRectangle(pParent, pBefore);
- case XFA_WIDGETTYPE_Image:
- return CreateImage(pParent, pBefore);
- case XFA_WIDGETTYPE_Line:
- return CreateLine(pParent, pBefore);
- case XFA_WIDGETTYPE_Text:
- return CreateText(pParent, pBefore);
- case XFA_WIDGETTYPE_DatetimeEdit:
- return CreateDatetimeEdit(pParent, pBefore);
- case XFA_WIDGETTYPE_DecimalField:
- return CreateDecimalField(pParent, pBefore);
- case XFA_WIDGETTYPE_NumericField:
- return CreateNumericField(pParent, pBefore);
- case XFA_WIDGETTYPE_Signature:
- return CreateSignature(pParent, pBefore);
- case XFA_WIDGETTYPE_TextEdit:
- return CreateTextEdit(pParent, pBefore);
- case XFA_WIDGETTYPE_DropdownList:
- return CreateDropdownList(pParent, pBefore);
- case XFA_WIDGETTYPE_ListBox:
- return CreateListBox(pParent, pBefore);
- case XFA_WIDGETTYPE_ImageField:
- return CreateImageField(pParent, pBefore);
- case XFA_WIDGETTYPE_PasswordEdit:
- return CreatePasswordEdit(pParent, pBefore);
- case XFA_WIDGETTYPE_Subform:
- return CreateSubform(pParent, pBefore);
- default:
- return nullptr;
- }
-}
-
-CXFA_Node* CXFA_FFWidgetHandler::CreatePushButton(CXFA_Node* pParent,
- CXFA_Node* pBefore) const {
- CXFA_Node* pField = CreateField(XFA_Element::Button, pParent, pBefore);
- CXFA_Node* pCaption = CreateCopyNode(XFA_Element::Caption, pField);
- CXFA_Node* pValue = CreateCopyNode(XFA_Element::Value, pCaption);
- CXFA_Node* pText = CreateCopyNode(XFA_Element::Text, pValue);
- pText->SetContent(L"Button", L"Button", false);
-
- CXFA_Node* pPara = CreateCopyNode(XFA_Element::Para, pCaption);
- pPara->SetEnum(XFA_ATTRIBUTE_VAlign, XFA_ATTRIBUTEENUM_Middle, false);
- pPara->SetEnum(XFA_ATTRIBUTE_HAlign, XFA_ATTRIBUTEENUM_Center, false);
- CreateFontNode(pCaption);
-
- CXFA_Node* pBorder = CreateCopyNode(XFA_Element::Border, pField);
- pBorder->SetEnum(XFA_ATTRIBUTE_Hand, XFA_ATTRIBUTEENUM_Right, false);
-
- CXFA_Node* pEdge = CreateCopyNode(XFA_Element::Edge, pBorder);
- pEdge->SetEnum(XFA_ATTRIBUTE_Stroke, XFA_ATTRIBUTEENUM_Raised, false);
-
- CXFA_Node* pFill = CreateCopyNode(XFA_Element::Fill, pBorder);
- CXFA_Node* pColor = CreateCopyNode(XFA_Element::Color, pFill);
- pColor->SetCData(XFA_ATTRIBUTE_Value, L"212, 208, 200", false);
-
- CXFA_Node* pBind = CreateCopyNode(XFA_Element::Bind, pField);
- pBind->SetEnum(XFA_ATTRIBUTE_Match, XFA_ATTRIBUTEENUM_None);
-
- return pField;
-}
-
-CXFA_Node* CXFA_FFWidgetHandler::CreateCheckButton(CXFA_Node* pParent,
- CXFA_Node* pBefore) const {
- return CreateField(XFA_Element::CheckButton, pParent, pBefore);
-}
-
-CXFA_Node* CXFA_FFWidgetHandler::CreateExclGroup(CXFA_Node* pParent,
- CXFA_Node* pBefore) const {
- return CreateFormItem(XFA_Element::ExclGroup, pParent, pBefore);
-}
-
-CXFA_Node* CXFA_FFWidgetHandler::CreateRadioButton(CXFA_Node* pParent,
- CXFA_Node* pBefore) const {
- CXFA_Node* pField = CreateField(XFA_Element::CheckButton, pParent, pBefore);
- CXFA_Node* pUi = pField->GetFirstChildByClass(XFA_Element::Ui);
- CXFA_Node* pWidget = pUi->GetFirstChildByClass(XFA_Element::CheckButton);
- pWidget->SetEnum(XFA_ATTRIBUTE_Shape, XFA_ATTRIBUTEENUM_Round);
- return pField;
-}
-
-CXFA_Node* CXFA_FFWidgetHandler::CreateDatetimeEdit(CXFA_Node* pParent,
- CXFA_Node* pBefore) const {
- CXFA_Node* pField = CreateField(XFA_Element::DateTimeEdit, pParent, pBefore);
- CreateValueNode(XFA_Element::Date, pField);
- return pField;
-}
-
-CXFA_Node* CXFA_FFWidgetHandler::CreateDecimalField(CXFA_Node* pParent,
- CXFA_Node* pBefore) const {
- CXFA_Node* pField = CreateNumericField(pParent, pBefore);
- CreateValueNode(XFA_Element::Decimal, pField);
- return pField;
-}
-
-CXFA_Node* CXFA_FFWidgetHandler::CreateNumericField(CXFA_Node* pParent,
- CXFA_Node* pBefore) const {
- return CreateField(XFA_Element::NumericEdit, pParent, pBefore);
-}
-
-CXFA_Node* CXFA_FFWidgetHandler::CreateSignature(CXFA_Node* pParent,
- CXFA_Node* pBefore) const {
- return CreateField(XFA_Element::Signature, pParent, pBefore);
-}
-
-CXFA_Node* CXFA_FFWidgetHandler::CreateTextEdit(CXFA_Node* pParent,
- CXFA_Node* pBefore) const {
- return CreateField(XFA_Element::TextEdit, pParent, pBefore);
-}
-
-CXFA_Node* CXFA_FFWidgetHandler::CreateDropdownList(CXFA_Node* pParent,
- CXFA_Node* pBefore) const {
- return CreateField(XFA_Element::ChoiceList, pParent, pBefore);
-}
-
-CXFA_Node* CXFA_FFWidgetHandler::CreateListBox(CXFA_Node* pParent,
- CXFA_Node* pBefore) const {
- CXFA_Node* pField = CreateDropdownList(pParent, pBefore);
- CXFA_Node* pUi = pField->GetNodeItem(XFA_NODEITEM_FirstChild);
- CXFA_Node* pListBox = pUi->GetNodeItem(XFA_NODEITEM_FirstChild);
- pListBox->SetEnum(XFA_ATTRIBUTE_Open, XFA_ATTRIBUTEENUM_Always);
- pListBox->SetEnum(XFA_ATTRIBUTE_CommitOn, XFA_ATTRIBUTEENUM_Exit);
- return pField;
-}
-
-CXFA_Node* CXFA_FFWidgetHandler::CreateImageField(CXFA_Node* pParent,
- CXFA_Node* pBefore) const {
- return CreateField(XFA_Element::ImageEdit, pParent, pBefore);
-}
-
-CXFA_Node* CXFA_FFWidgetHandler::CreatePasswordEdit(CXFA_Node* pParent,
- CXFA_Node* pBefore) const {
- CXFA_Node* pField = CreateField(XFA_Element::PasswordEdit, pParent, pBefore);
- CXFA_Node* pBind = CreateCopyNode(XFA_Element::Bind, pField);
- pBind->SetEnum(XFA_ATTRIBUTE_Match, XFA_ATTRIBUTEENUM_None, false);
- return pField;
-}
-
-CXFA_Node* CXFA_FFWidgetHandler::CreateField(XFA_Element eElement,
- CXFA_Node* pParent,
- CXFA_Node* pBefore) const {
- CXFA_Node* pField = CreateFormItem(XFA_Element::Field, pParent, pBefore);
- CreateCopyNode(eElement, CreateCopyNode(XFA_Element::Ui, pField));
- CreateFontNode(pField);
- return pField;
-}
-
-CXFA_Node* CXFA_FFWidgetHandler::CreateArc(CXFA_Node* pParent,
- CXFA_Node* pBefore) const {
- return CreateDraw(XFA_Element::Arc, pParent, pBefore);
-}
-
-CXFA_Node* CXFA_FFWidgetHandler::CreateRectangle(CXFA_Node* pParent,
- CXFA_Node* pBefore) const {
- return CreateDraw(XFA_Element::Rectangle, pParent, pBefore);
-}
-
-CXFA_Node* CXFA_FFWidgetHandler::CreateImage(CXFA_Node* pParent,
- CXFA_Node* pBefore) const {
- CXFA_Node* pField = CreateDraw(XFA_Element::Image, pParent, pBefore);
- CreateCopyNode(XFA_Element::ImageEdit,
- CreateCopyNode(XFA_Element::Ui, pField));
- return pField;
-}
-
-CXFA_Node* CXFA_FFWidgetHandler::CreateLine(CXFA_Node* pParent,
- CXFA_Node* pBefore) const {
- return CreateDraw(XFA_Element::Line, pParent, pBefore);
-}
-
-CXFA_Node* CXFA_FFWidgetHandler::CreateText(CXFA_Node* pParent,
- CXFA_Node* pBefore) const {
- CXFA_Node* pField = CreateDraw(XFA_Element::Text, pParent, pBefore);
- CreateCopyNode(XFA_Element::TextEdit,
- CreateCopyNode(XFA_Element::Ui, pField));
- CreateFontNode(pField);
- return pField;
-}
-
-CXFA_Node* CXFA_FFWidgetHandler::CreateDraw(XFA_Element eElement,
- CXFA_Node* pParent,
- CXFA_Node* pBefore) const {
- CXFA_Node* pDraw = CreateFormItem(XFA_Element::Draw, pParent, pBefore);
- CreateValueNode(eElement, pDraw);
- return pDraw;
-}
-
-CXFA_Node* CXFA_FFWidgetHandler::CreateSubform(CXFA_Node* pParent,
- CXFA_Node* pBefore) const {
- return CreateFormItem(XFA_Element::Subform, pParent, pBefore);
-}
-
-CXFA_Node* CXFA_FFWidgetHandler::CreateFormItem(XFA_Element eElement,
- CXFA_Node* pParent,
- CXFA_Node* pBefore) const {
- CXFA_Node* pTemplateParent = pParent ? pParent->GetTemplateNode() : nullptr;
- CXFA_Node* pNewFormItem = pTemplateParent->CloneTemplateToForm(false);
- if (pParent)
- pParent->InsertChild(pNewFormItem, pBefore);
- return pNewFormItem;
-}
-
-CXFA_Node* CXFA_FFWidgetHandler::CreateCopyNode(XFA_Element eElement,
- CXFA_Node* pParent,
- CXFA_Node* pBefore) const {
- CXFA_Node* pTemplateParent = pParent ? pParent->GetTemplateNode() : nullptr;
- CXFA_Node* pNewNode =
- CreateTemplateNode(eElement, pTemplateParent,
- pBefore ? pBefore->GetTemplateNode() : nullptr)
- ->Clone(false);
- if (pParent)
- pParent->InsertChild(pNewNode, pBefore);
- return pNewNode;
-}
-
-CXFA_Node* CXFA_FFWidgetHandler::CreateTemplateNode(XFA_Element eElement,
- CXFA_Node* pParent,
- CXFA_Node* pBefore) const {
- CXFA_Document* pXFADoc = GetXFADoc();
- CXFA_Node* pNewTemplateNode =
- pXFADoc->CreateNode(XFA_XDPPACKET_Template, eElement);
- if (pParent)
- pParent->InsertChild(pNewTemplateNode, pBefore);
- return pNewTemplateNode;
-}
-
-CXFA_Node* CXFA_FFWidgetHandler::CreateFontNode(CXFA_Node* pParent) const {
- CXFA_Node* pFont = CreateCopyNode(XFA_Element::Font, pParent);
- pFont->SetCData(XFA_ATTRIBUTE_Typeface, L"Myriad Pro", false);
- return pFont;
-}
-
-CXFA_Node* CXFA_FFWidgetHandler::CreateMarginNode(CXFA_Node* pParent,
- uint32_t dwFlags,
- FX_FLOAT fInsets[4]) const {
- CXFA_Node* pMargin = CreateCopyNode(XFA_Element::Margin, pParent);
- if (dwFlags & 0x01)
- pMargin->SetMeasure(XFA_ATTRIBUTE_LeftInset,
- CXFA_Measurement(fInsets[0], XFA_UNIT_Pt), false);
- if (dwFlags & 0x02)
- pMargin->SetMeasure(XFA_ATTRIBUTE_TopInset,
- CXFA_Measurement(fInsets[1], XFA_UNIT_Pt), false);
- if (dwFlags & 0x04)
- pMargin->SetMeasure(XFA_ATTRIBUTE_RightInset,
- CXFA_Measurement(fInsets[2], XFA_UNIT_Pt), false);
- if (dwFlags & 0x08)
- pMargin->SetMeasure(XFA_ATTRIBUTE_BottomInset,
- CXFA_Measurement(fInsets[3], XFA_UNIT_Pt), false);
- return pMargin;
-}
-
-CXFA_Node* CXFA_FFWidgetHandler::CreateValueNode(XFA_Element eValue,
- CXFA_Node* pParent) const {
- CXFA_Node* pValue = CreateCopyNode(XFA_Element::Value, pParent);
- CreateCopyNode(eValue, pValue);
- return pValue;
-}
-
-CXFA_Document* CXFA_FFWidgetHandler::GetObjFactory() const {
- return GetXFADoc();
-}
-
-CXFA_Document* CXFA_FFWidgetHandler::GetXFADoc() const {
- return m_pDocView->GetDoc()->GetXFADoc();
-}
-
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fontmgr.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fontmgr.cpp
deleted file mode 100644
index 5db389663a6..00000000000
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fontmgr.cpp
+++ /dev/null
@@ -1,2055 +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
-
-#include "xfa/fxfa/xfa_fontmgr.h"
-
-#include <algorithm>
-#include <memory>
-#include <utility>
-
-#include "core/fpdfapi/font/cpdf_font.h"
-#include "core/fpdfapi/parser/cpdf_dictionary.h"
-#include "core/fpdfapi/parser/cpdf_document.h"
-#include "third_party/base/ptr_util.h"
-#include "xfa/fgas/font/cfgas_gefont.h"
-#include "xfa/fxfa/xfa_ffapp.h"
-#include "xfa/fxfa/xfa_ffdoc.h"
-
-namespace {
-
-// The 5 names per entry are: PsName, Normal, Bold, Italic, BoldItalic.
-const char* const g_XFAPDFFontName[][5] = {
- {"Adobe PI Std", "AdobePIStd", "AdobePIStd", "AdobePIStd", "AdobePIStd"},
- {"Myriad Pro Light", "MyriadPro-Light", "MyriadPro-Semibold",
- "MyriadPro-LightIt", "MyriadPro-SemiboldIt"},
-};
-
-#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
-const XFA_FONTINFO g_XFAFontsMap[] = {
- {0x01d5d33e, L"SimSun", L"Arial", 0, 936},
- {0x01e4f102, L"YouYuan", L"Arial", 1, 936},
- {0x030549dc, L"LiSu", L"Arial", 1, 936},
- {0x032edd44, L"Simhei", L"Arial", 1, 936},
- {0x03eac6fc, L"PoorRichard-Regular", L"Arial", 2, 1252},
- {0x03ed90e6, L"Nina", L"Arial", 0, 1252},
- {0x077b56b3, L"KingsoftPhoneticPlain", L"Arial", 0, 1252},
- {0x078ed524, L"MicrosoftSansSerif", L"Arial", 0, 1252},
- {0x089b18a9, L"Arial", L"Arial", 0, 1252},
- {0x0b2cad72, L"MonotypeCorsiva", L"Arial", 8, 1252},
- {0x0bb003e7, L"Kartika", L"Arial", 2, 1252},
- {0x0bb469df, L"VinerHandITC", L"Arial", 8, 1252},
- {0x0bc1a851, L"SegoeUI", L"Arial", 0, 1252},
- {0x0c112ebd, L"KozukaGothicPro-VIM", L"Arial", 0, 1252},
- {0x0cfcb9c1, L"AdobeThai", L"Kokila,Arial Narrow", 0, 847},
- {0x0e7de0f9, L"Playbill", L"Arial", 0, 1252},
- {0x0eff47c3, L"STHupo", L"Arial", 0, 936},
- {0x107ad374, L"Constantia", L"Arial", 2, 1252},
- {0x12194c2d, L"KunstlerScript", L"Arial", 8, 1252},
- {0x135ef6a1, L"MinionProSmBd",
- L"Bell MT,Corbel,Times New Roman,Cambria,Berlin Sans FB", 0, 1252},
- {0x158c4049, L"Garamond", L"Arial", 2, 1252},
- {0x160ecb24, L"STZhongsong", L"Arial", 0, 936},
- {0x161ed07e, L"MSGothic", L"Arial", 1, 1252},
- {0x171d1ed1, L"SnapITC-Regular", L"Arial", 0, 1252},
- {0x18d1188f, L"Cambria", L"Arial", 2, 1252},
- {0x18eaf350, L"ArialUnicodeMS", L"Arial", 0, 936},
- {0x1a92d115, L"MingLiU", L"Arial", 1, 1252},
- {0x1cc217c6, L"TrebuchetMS", L"Arial", 0, 1252},
- {0x1d649596, L"BasemicTimes", L"Arial", 0, 1252},
- {0x1e34ee60, L"BellMT", L"Arial", 2, 1252},
- {0x1eb36945, L"CooperBlack", L"Arial", 2, 1252},
- {0x1ef7787d, L"BatangChe", L"Arial", 1, 1252},
- {0x20b3bd3a, L"BrushScriptMT", L"Arial", 8, 1252},
- {0x220877aa, L"Candara", L"Arial", 0, 1252},
- {0x22135007, L"FreestyleScript-Regular", L"Arial", 8, 1252},
- {0x251059c3, L"Chiller", L"Arial", 0, 1252},
- {0x25bed6dd, L"MSReferenceSansSerif", L"Arial", 0, 1252},
- {0x28154c81, L"Parchment-Regular", L"Arial", 8, 1252},
- {0x29711eb9, L"STLiti", L"Arial", 0, 936},
- {0x2b1993b4, L"Basemic", L"Arial", 0, 1252},
- {0x2b316339, L"NiagaraSolid-Reg", L"Arial", 0, 1252},
- {0x2c147529, L"FootlightMTLight", L"Arial", 0, 1252},
- {0x2c198928, L"HarlowSolid", L"Arial", 0, 1252},
- {0x2c6ac6b2, L"LucidaBright", L"Arial", 2, 1252},
- {0x2c9f38e2, L"KozukaMinchoPro-VIR", L"Arial", 0, 1252},
- {0x2d5a47b0, L"STCaiyun", L"Arial", 0, 936},
- {0x2def26bf, L"BernardMT-Condensed", L"Arial", 0, 1252},
- {0x2fd8930b, L"KozukaMinchoPr6NR", L"Arial", 0, 1252},
- {0x3115525a, L"FangSong_GB2312", L"Arial", 0, 1252},
- {0x31327817, L"MyriadPro",
- L"Calibri,Corbel,Candara,Cambria Math,Franklin Gothic Medium,Arial "
- L"Narrow,Times New Roman",
- 0, 1252},
- {0x32244975, L"Helvetica", L"Arial", 0, 1252},
- {0x32ac995c, L"Terminal", L"Arial", 0, 1252},
- {0x338d648a, L"NiagaraEngraved-Reg", L"Arial", 0, 1252},
- {0x33bb65f2, L"Sylfaen", L"Arial", 2, 1252},
- {0x3402c30e, L"MSPMincho", L"Arial", 2, 1252},
- {0x3412bf31, L"SimSun-PUA", L"Arial", 0, 936},
- {0x36eb39b9, L"BerlinSansFB", L"Arial", 0, 1252},
- {0x36f42055, L"UniversATT", L"Microsoft Sans Serif", 0, 1252},
- {0x3864c4f6, L"HighTowerText", L"Arial", 2, 1252},
- {0x3a257d03, L"FangSong_GB2312", L"Arial", 0, 1252},
- {0x3cdae668, L"FreestyleScript", L"Arial", 8, 1252},
- {0x3d55aed7, L"Jokerman", L"Arial", 0, 1252},
- {0x3d5b4385, L"PMingLiU", L"Arial", 2, 1252},
- {0x3d9b7669, L"EstrangeloEdessa", L"Arial", 0, 1252},
- {0x3e532d74, L"FranklinGothicMedium", L"Arial", 0, 1252},
- {0x3e6aa32d, L"NSimSun", L"Arial", 1, 936},
- {0x3f6c36a8, L"Gautami", L"Arial", 0, 1252},
- {0x3ff32662, L"Chiller-Regular", L"Arial", 0, 1252},
- {0x409de312, L"ModernNo.20", L"Arial", 2, 1252},
- {0x41443c5e, L"Georgia", L"Arial", 2, 1252},
- {0x4160ade5, L"BellGothicStdBlack",
- L"Arial,Arial Unicode MS,Book Antiqua,Dotum,Georgia", 0, 1252},
- {0x421976c4, L"Modern-Regular", L"Arial", 2, 1252},
- {0x422a7252, L"Stencil", L"Arial", 0, 1252},
- {0x42c8554f, L"Fixedsys", L"Arial", 0, 1252},
- {0x435cb41d, L"Roman", L"Arial", 0, 1252},
- {0x47882383, L"CourierNew", L"Arial", 1, 1252},
- {0x480a2338, L"BerlinSansFBDemi", L"Arial", 0, 1252},
- {0x480bf7a4, L"CourierStd", L"Courier New,Verdana", 0, 1252},
- {0x481ad6ed, L"VladimirScript", L"Arial", 8, 1252},
- {0x4911577a, L"YouYuan", L"Arial", 1, 936},
- {0x4a788d72, L"STXingkai", L"Arial", 0, 936},
- {0x4bf88566, L"SegoeCondensed", L"Arial", 0, 1252},
- {0x4ccf51a4, L"BerlinSansFB-Reg", L"Arial", 0, 1252},
- {0x4ea967ce, L"GulimChe", L"Arial", 1, 1252},
- {0x4f68bd79, L"LetterGothicStd", L"Courier New,Verdana", 0, 1252},
- {0x51a0d0e6, L"KozukaGothicPr6NM", L"Arial", 0, 1252},
- {0x531b3dea, L"BasemicSymbol", L"Arial", 0, 1252},
- {0x5333fd39, L"CalifornianFB-Reg", L"Arial", 2, 1252},
- {0x53561a54, L"FZYTK--GBK1-0", L"Arial", 0, 936},
- {0x55e0dde6, L"LucidaSansTypewriter", L"Arial", 0, 1252},
- {0x574d4d3d, L"AdobeArabic", L"Arial Narrow", 0, 1252},
- {0x5792e759, L"STKaiti", L"Arial", 0, 936},
- {0x5921978e, L"LucidaSansUnicode", L"Arial", 0, 1252},
- {0x594e2da4, L"Vrinda", L"Arial", 0, 1252},
- {0x59baa9a2, L"KaiTi_GB2312", L"Arial", 0, 1252},
- {0x5cfedf4f, L"BaskOldFace", L"Arial", 0, 1252},
- {0x5f97921c, L"AdobeMyungjoStdM",
- L"Batang,Bookman Old Style,Consolas,STZhongsong", 0, 936},
- {0x5fefbfad, L"Batang", L"Arial", 2, 1252},
- {0x605342b9, L"DotumChe", L"Arial", 1, 1252},
- {0x608c5f9a, L"KaiTi_GB2312", L"Arial", 0, 936},
- {0x61efd0d1, L"MaturaMTScriptCapitals", L"Arial", 0, 1252},
- {0x626608a9, L"MVBoli", L"Arial", 0, 1252},
- {0x630501a3, L"SmallFonts", L"Arial", 0, 1252},
- {0x65d0e2a9, L"FZYTK--GBK1-0", L"Arial", 0, 936},
- {0x669f29e1, L"FZSTK--GBK1-0", L"Arial", 0, 936},
- {0x673a9e5f, L"Tunga", L"Arial", 0, 1252},
- {0x691aa4ce, L"NiagaraSolid", L"Arial", 0, 1252},
- {0x696259b7, L"Corbel", L"Arial", 0, 1252},
- {0x696ee9be, L"STXihei", L"Arial", 0, 936},
- {0x6c59cf69, L"Dotum", L"Arial", 0, 1252},
- {0x707fa561, L"Gungsuh", L"Arial", 2, 1252},
- {0x71416bb2, L"ZWAdobeF", L"Arial", 0, 1252},
- {0x71b41801, L"Verdana", L"Arial", 0, 1252},
- {0x73f25e4c, L"PalatinoLinotype", L"Arial", 0, 1252},
- {0x73f4d19f, L"NiagaraEngraved", L"Arial", 0, 1252},
- {0x74001694, L"MyriadProBlack", L"Book Antiqua,Constantia,Dotum,Georgia", 0,
- 1252},
- {0x74b14d8f, L"Haettenschweiler", L"Arial", 0, 1252},
- {0x74cb44ee, L"NSimSun", L"Arial", 1, 936},
- {0x76b4d7ff, L"Shruti", L"Arial", 0, 1252},
- {0x788b3533, L"Webdings", L"Arial", 6, 42},
- {0x797dde99, L"MSSerif", L"Arial", 0, 1252},
- {0x7a0f9e9e, L"MSMincho", L"Arial", 1, 1252},
- {0x7b439caf, L"OldEnglishTextMT", L"Arial", 0, 1252},
- {0x8213a433, L"LucidaSans-Typewriter", L"Arial", 0, 1252},
- {0x82fec929, L"AdobeSongStdL",
- L"Centaur,Calibri,STSong,Bell MT,Garamond,Times New Roman", 0, 936},
- {0x83581825, L"Modern", L"Arial", 0, 1252},
- {0x835a2823, L"Algerian", L"Arial", 0, 1252},
- {0x83dab9f5, L"Script", L"Arial", 0, 1252},
- {0x847b56da, L"Tahoma", L"Arial", 0, 1252},
- {0x8a783cb2, L"SimSun-PUA", L"Arial", 0, 1252},
- {0x8b5cac0e, L"Onyx", L"Arial", 0, 1252},
- {0x8c6a499e, L"Gulim", L"Arial", 0, 1252},
- {0x8e0af790, L"JuiceITC", L"Arial", 0, 1252},
- {0x8e8d43b2, L"Centaur", L"Arial", 2, 1252},
- {0x8ee4dcca, L"BookshelfSymbol7", L"Arial", 0, 1252},
- {0x90794800, L"BellGothicStdLight", L"Bell MT,Calibri,Times New Roman", 0,
- 1252},
- {0x909b516a, L"Century", L"Arial", 2, 1252},
- {0x92ae370d, L"MSOutlook", L"Arial", 4, 42},
- {0x93c9fbf1, L"LucidaFax", L"Arial", 2, 1252},
- {0x9565085e, L"BookAntiqua", L"Arial", 2, 1252},
- {0x9856d95d, L"AdobeMingStdL", L"Arial,Arial Unicode MS,Cambria,BatangChe",
- 0, 949},
- {0x9bbadd6b, L"ColonnaMT", L"Arial", 0, 1252},
- {0x9cbd16a4, L"ShowcardGothic-Reg", L"Arial", 0, 1252},
- {0x9d73008e, L"MSSansSerif", L"Arial", 0, 1252},
- {0xa0607db1, L"GungsuhChe", L"Arial", 1, 1252},
- {0xa0bcf6a1, L"LatinWide", L"Arial", 2, 1252},
- {0xa1429b36, L"Symbol", L"Arial", 6, 42},
- {0xa1fa5abc, L"Wingdings2", L"Arial", 6, 42},
- {0xa1fa5abd, L"Wingdings3", L"Arial", 6, 42},
- {0xa427bad4, L"InformalRoman-Regular", L"Arial", 8, 1252},
- {0xa8b92ece, L"FZSTK--GBK1-0", L"Arial", 0, 936},
- {0xa8d83ece, L"CalifornianFB", L"Arial", 2, 1252},
- {0xaa3e082c, L"Kingsoft-Phonetic", L"Arial", 0, 1252},
- {0xaa6bcabe, L"HarlowSolidItalic", L"Arial", 0, 1252},
- {0xade5337c, L"MSUIGothic", L"Arial", 0, 1252},
- {0xb08dd941, L"WideLatin", L"Arial", 2, 1252},
- {0xb207f05d, L"PoorRichard", L"Arial", 2, 1252},
- {0xb3bc492f, L"JuiceITC-Regular", L"Arial", 0, 1252},
- {0xb5545399, L"Marlett", L"Arial", 4, 42},
- {0xb5dd1ebb, L"BritannicBold", L"Arial", 0, 1252},
- {0xb699c1c5, L"LucidaCalligraphy-Italic", L"Arial", 0, 1252},
- {0xb725d629, L"TimesNewRoman", L"Arial", 2, 1252},
- {0xb7eaebeb, L"AdobeHeitiStdR", L"Batang,Century,Dotum", 0, 936},
- {0xbd29c486, L"BerlinSansFBDemi-Bold", L"Arial", 0, 1252},
- {0xbe8a8db4, L"BookshelfSymbolSeven", L"Arial", 0, 1252},
- {0xc16c0118, L"AdobeHebrew", L"Bell MT,Berlin Sans FB,Calibri", 0, 1252},
- {0xc318b0af, L"MyriadProLight", L"Calibri,STFangsong,Times New Roman", 0,
- 1252},
- {0xc65e5659, L"CambriaMath", L"Arial", 2, 1252},
- {0xc75c8f05, L"LucidaConsole", L"Arial", 1, 1252},
- {0xca7c35d6, L"Calibri", L"Arial", 0, 1252},
- {0xcb053f53, L"MicrosoftYaHei", L"Arial", 0, 936},
- {0xcb7190f9, L"Magneto-Bold", L"Arial", 0, 1252},
- {0xcca00cc5, L"System", L"Arial", 0, 1252},
- {0xccad6f76, L"Jokerman-Regular", L"Arial", 0, 1252},
- {0xccc5818c, L"EuroSign", L"Arial", 0, 1252},
- {0xcf3d7234, L"LucidaHandwriting-Italic", L"Arial", 0, 1252},
- {0xcf7b8fdb, L"MinionPro",
- L"Bell MT,Corbel,Times New Roman,Cambria,Berlin Sans FB", 0, 1252},
- {0xcfe5755f, L"Simhei", L"Arial", 1, 936},
- {0xd011f4ee, L"MSPGothic", L"Arial", 0, 1252},
- {0xd060e7ef, L"Vivaldi", L"Arial", 8, 1252},
- {0xd07edec1, L"FranklinGothic-Medium", L"Arial", 0, 1252},
- {0xd107243f, L"SimSun", L"Arial", 0, 936},
- {0xd1881562, L"ArialNarrow", L"Arial Narrow", 0, 1252},
- {0xd22b7dce, L"BodoniMTPosterCompressed", L"Arial", 0, 1252},
- {0xd22bfa60, L"ComicSansMS", L"Arial", 8, 1252},
- {0xd3bd0e35, L"Bauhaus93", L"Arial", 0, 1252},
- {0xd429ee7a, L"STFangsong", L"Arial", 0, 936},
- {0xd6679c12, L"BernardMTCondensed", L"Arial", 0, 1252},
- {0xd8e8a027, L"LucidaSans", L"Arial", 0, 1252},
- {0xd9fe7761, L"HighTowerText-Reg", L"Arial", 2, 1252},
- {0xda7e551e, L"STSong", L"Arial", 0, 936},
- {0xdaa6842d, L"STZhongsong", L"Arial", 0, 936},
- {0xdaaab93f, L"STFangsong", L"Arial", 0, 936},
- {0xdaeb0713, L"STSong", L"Arial", 0, 936},
- {0xdafedbef, L"STCaiyun", L"Arial", 0, 936},
- {0xdb00a3d9, L"Broadway", L"Arial", 0, 1252},
- {0xdb1f5ad4, L"STXinwei", L"Arial", 0, 936},
- {0xdb326e7f, L"STKaiti", L"Arial", 0, 936},
- {0xdb69595a, L"STHupo", L"Arial", 0, 936},
- {0xdba0082c, L"STXihei", L"Arial", 0, 936},
- {0xdbd0ab18, L"STXingkai", L"Arial", 0, 936},
- {0xdc1a7db1, L"STLiti", L"Arial", 0, 936},
- {0xdc33075f, L"KristenITC-Regular", L"Arial", 8, 1252},
- {0xdcc7009c, L"Harrington", L"Arial", 0, 1252},
- {0xdd712466, L"ArialBlack", L"Arial", 0, 1252},
- {0xdde87b3e, L"Impact", L"Arial", 0, 1252},
- {0xdf69fb32, L"SnapITC", L"Arial", 0, 1252},
- {0xdf8b25e8, L"CenturyGothic", L"Arial", 0, 1252},
- {0xe0f705c0, L"KristenITC", L"Arial", 8, 1252},
- {0xe1427573, L"Raavi", L"Arial", 0, 1252},
- {0xe2cea0cb, L"Magneto", L"Arial", 0, 1252},
- {0xe36a9e17, L"Ravie", L"Arial", 0, 1252},
- {0xe433f8e2, L"Parchment", L"Arial", 8, 1252},
- {0xe43dff4a, L"Wingdings", L"Arial", 4, 42},
- {0xe4e2c405, L"MTExtra", L"Arial", 6, 42},
- {0xe618cc35, L"InformalRoman", L"Arial", 8, 1252},
- {0xe6c27ffc, L"Mistral", L"Arial", 8, 1252},
- {0xe7ebf4b9, L"Courier", L"Courier New", 0, 1252},
- {0xe8bc4a9d, L"MSReferenceSpecialty", L"Arial", 0, 1252},
- {0xe90fb013, L"TempusSansITC", L"Arial", 0, 1252},
- {0xec637b42, L"Consolas", L"Verdana", 1, 1252},
- {0xed3a683b, L"STXinwei", L"Arial", 0, 936},
- {0xef264cd1, L"LucidaHandwriting", L"Arial", 0, 1252},
- {0xf086bca2, L"BaskervilleOldFace", L"Arial", 0, 1252},
- {0xf1028030, L"Mangal", L"Arial", 2, 1252},
- {0xf1da7eb9, L"ShowcardGothic", L"Arial", 0, 1252},
- {0xf210f06a, L"ArialMT", L"Arial", 0, 1252},
- {0xf477f16a, L"Latha", L"Arial", 0, 1252},
- {0xf616f3dd, L"LiSu", L"Arial", 1, 936},
- {0xfa479aa6, L"MicrosoftYaHei", L"Arial", 0, 936},
- {0xfcd19697, L"BookmanOldStyle", L"Arial", 0, 1252},
- {0xfe209a82, L"LucidaCalligraphy", L"Arial", 0, 1252},
- {0xfef135f8, L"AdobeHeitiStd-Regular", L"Batang,Century,Dotum", 0, 936},
-};
-#elif _FXM_PLATFORM_ == _FXM_PLATFORM_LINUX_
-const XFA_FONTINFO g_XFAFontsMap[] = {
- {0x01d5d33e, L"SimSun",
- L"WenQuanYi Zen Hei Mono,AR PL UMing CN,AR PL UMing HK,AR PL UMing TW,AR "
- L"PL UMing TW MBE",
- 0, 936},
- {0x01e4f102, L"YouYuan",
- L"WenQuanYi Zen Hei Mono,AR PL UMing CN,AR PL UMing HK,AR PL UMing TW,AR "
- L"PL UMing TW MBE",
- 1, 936},
- {0x030549dc, L"LiSu",
- L"WenQuanYi Zen Hei,WenQuanYi Zen Hei Sharp,WenQuanYi Zen Hei "
- L"Mono,WenQuanYi Micro Hei",
- 1, 936},
- {0x032edd44, L"Simhei",
- L"WenQuanYi Zen Hei,WenQuanYi Zen Hei Sharp,WenQuanYi Zen Hei "
- L"Mono,WenQuanYi Micro Hei",
- 1, 936},
- {0x03eac6fc, L"PoorRichard-Regular", L"Droid Sans Japanese,FreeSerif", 2,
- 1252},
- {0x03ed90e6, L"Nina", L"FreeSerif", 0, 1252},
- {0x077b56b3, L"KingsoftPhoneticPlain",
- L"Tibetan Machine Uni,LKLUG,Samyak Gujarati,Droid Sans Thai,Droid Sans "
- L"Armenian,Untitled1,utkal,Lohit Oriya",
- 0, 1252},
- {0x078ed524, L"MicrosoftSansSerif",
- L"Droid Sans Japanese,FreeSerif,WenQuanYi Micro Hei", 0, 1252},
- {0x089b18a9, L"Arial",
- L"Droid Sans Japanese,DejaVu Sans Condensed,FreeSerif,WenQuanYi Micro Hei",
- 0, 1252},
- {0x0b2cad72, L"MonotypeCorsiva", L"Droid Sans Japanese,FreeSerif", 8, 1252},
- {0x0bb003e7, L"Kartika",
- L"FreeSans,Liberation Sans,Liberation Sans Narrow,Nimbus Sans "
- L"L,Garuda,FreeSerif,WenQuanYi Micro Hei",
- 2, 1252},
- {0x0bb469df, L"VinerHandITC",
- L"Droid Sans Japanese,Ubuntu,Liberation Sans,Liberation Serif", 8, 1252},
- {0x0bc1a851, L"SegoeUI", L"Droid Sans Japanese,DejaVu Sans", 0, 1252},
- {0x0c112ebd, L"KozukaGothicPro-VIM", L"FreeSerif", 0, 1252},
- {0x0cfcb9c1, L"AdobeThai", L"Droid Sans Japanese,Waree", 0, 847},
- {0x0e7de0f9, L"Playbill",
- L"KacstQurn,Droid Arabic Naskh,Droid Sans Ethiopic,mry_KacstQurn,Droid "
- L"Sans Ethiopic,Droid Sans Japanese,FreeSerif",
- 0, 1252},
- {0x0eff47c3, L"STHupo", L"AR PL UKai HK,AR PL UMing HK,AR PL UKai CN", 0,
- 936},
- {0x107ad374, L"Constantia",
- L"Droid Sans Japanese,FreeSerif,WenQuanYi Micro Hei,Ubuntu", 2, 1252},
- {0x12194c2d, L"KunstlerScript", L"Droid Sans Japanese,Liberation Serif", 8,
- 1252},
- {0x135ef6a1, L"MinionProSmBd", L"Liberation Serif", 0, 1252},
- {0x158c4049, L"Garamond",
- L"Droid Sans Japanese,Liberation Serif,Ubuntu,FreeSerif", 2, 1252},
- {0x160ecb24, L"STZhongsong",
- L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,WenQuanYi Zen Hei "
- L"Sharp,WenQuanYi Micro Hei",
- 0, 936},
- {0x161ed07e, L"MSGothic",
- L"WenQuanYi Micro Hei Mono,WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,AR PL "
- L"UMing CN,AR PL UMing HK,AR PL UMing TW",
- 1, 1252},
- {0x171d1ed1, L"SnapITC-Regular",
- L"Liberation Sans Narrow,Ubuntu Condensed,Nimbus Sans L,DejaVu Sans", 0,
- 1252},
- {0x18d1188f, L"Cambria", L"Droid Sans Japanese,FreeSerif,FreeMono", 2,
- 1252},
- {0x18eaf350, L"ArialUnicodeMS",
- L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,WenQuanYi Zen Hei "
- L"Sharp,WenQuanYi Micro Hei",
- 0, 936},
- {0x1a92d115, L"MingLiU",
- L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,WenQuanYi Zen Hei "
- L"Sharp,WenQuanYi Micro Hei",
- 1, 1252},
- {0x1cc217c6, L"TrebuchetMS",
- L"Droid Sans Japanese,Liberation Serif,FreeSerif,Ubuntu", 0, 1252},
- {0x1d649596, L"BasemicTimes",
- L"Liberation Serif,Times New Roman,Droid Sans Japanese,FreeSerif,Ubuntu",
- 0, 1252},
- {0x1e34ee60, L"BellMT",
- L"KacstQurn,Droid Sans Japanese,Ubuntu,Liberation Serif", 2, 1252},
- {0x1eb36945, L"CooperBlack",
- L"KacstQurn,Droid Sans Japanese,FreeMono,Liberation Mono, WenQuanYi Micro "
- L"Hei Mono",
- 2, 1252},
- {0x1ef7787d, L"BatangChe",
- L"WenQuanYi Zen Hei Mono,AR PL UMing CN,AR PL UMing HK,AR PL UMing "
- L"TW,WenQuanYi Zen Hei,WenQuanYi Micro Hei",
- 1, 1252},
- {0x20b3bd3a, L"BrushScriptMT",
- L"KacstQurn,Droid Arabic Naskh,Droid Sans Ethiopic,Droid Sans "
- L"Japanese,URW Chancery L,Liberation Sans",
- 8, 1252},
- {0x220877aa, L"Candara", L"Droid Sans Japanese,DejaVu Sans", 0, 1252},
- {0x22135007, L"FreestyleScript-Regular",
- L"KacstQurn,Droid Sans Japanese,Liberation Sans", 8, 1252},
- {0x251059c3, L"Chiller",
- L"KacstQurn,Droid Arabic Naskh,Droid Sans Ethiopic,Droid Sans "
- L"Japanese,Liberation Sans",
- 0, 1252},
- {0x25bed6dd, L"MSReferenceSansSerif",
- L"DejaVu Sans Condensed,Ubuntu Condensed,Droid Sans Japanese,AR PL UKai "
- L"HK",
- 0, 1252},
- {0x28154c81, L"Parchment-Regular", L"Droid Sans Japanese,Liberation Sans",
- 8, 1252},
- {0x29711eb9, L"STLiti", L"AR PL UKai HK", 0, 936},
- {0x2b1993b4, L"Basemic",
- L"Liberation Serif,Droid Sans Japanese,Liberation Sans", 0, 1252},
- {0x2b316339, L"NiagaraSolid-Reg", L"Droid Sans Japanese,Liberation Sans", 0,
- 1252},
- {0x2c147529, L"FootlightMTLight",
- L"KacstQurn,Droid Sans Japanese,Liberation Sans", 0, 1252},
- {0x2c198928, L"HarlowSolid",
- L"KacstQurn,Droid Sans Japanese,Liberation Sans", 0, 1252},
- {0x2c6ac6b2, L"LucidaBright",
- L"KacstQurn,Droid Arabic Naskh,Droid Sans Ethiopic,mry_KacstQurn,Droid "
- L"Sans Japanese,Liberation Sans",
- 2, 1252},
- {0x2c9f38e2, L"KozukaMinchoPro-VIR", L"DejaVu Sans", 0, 1252},
- {0x2d5a47b0, L"STCaiyun", L"AR PL UKai HK", 0, 936},
- {0x2def26bf, L"BernardMT-Condensed",
- L"KacstQurn,Droid Sans Japanese,DejaVu Serif", 0, 1252},
- {0x2fd8930b, L"KozukaMinchoPr6NR", L"DejaVu Serif", 0, 1252},
- {0x3115525a, L"FangSong_GB2312",
- L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,WenQuanYi Zen Hei "
- L"Sharp,WenQuanYi Micro Hei",
- 0, 1252},
- {0x31327817, L"MyriadPro",
- L"Ubuntu Condensed,Droid Sans Japanese, FreeSerif", 0, 1252},
- {0x32244975, L"Helvetica",
- L"Ubuntu,DejaVu Sans Condensed,Liberation Sans,Liberation Sans "
- L"Narrow,Nimbus Sans L",
- 0, 1252},
- {0x32ac995c, L"Terminal", L"DejaVu Serif", 0, 1252},
- {0x338d648a, L"NiagaraEngraved-Reg", L"Droid Sans Japanese,DejaVu Serif", 0,
- 1252},
- {0x33bb65f2, L"Sylfaen", L"Droid Sans Japanese,DejaVu Sans", 2, 1252},
- {0x3402c30e, L"MSPMincho",
- L"WenQuanYi Zen Hei Mono,AR PL UMing CN,AR PL UMing HK,AR PL UMing TW", 2,
- 1252},
- {0x3412bf31, L"SimSun-PUA",
- L"WenQuanYi Zen Hei Mono,AR PL UMing CN,AR PL UMing CN,AR PL UMing HK", 0,
- 936},
- {0x36eb39b9, L"BerlinSansFB",
- L"Droid Sans Japanese,Liberation Serif,Ubuntu,FreeSerif", 0, 1252},
- {0x36f42055, L"UniversATT", L"Microsoft Sans Serif", 0, 1252},
- {0x3864c4f6, L"HighTowerText", L"Droid Sans Japanese,DejaVu Serif", 2,
- 1252},
- {0x3a257d03, L"FangSong_GB2312",
- L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei", 0, 1252},
- {0x3c7d1d07, L"Garamond3LTStd",
- L"Droid Sans Japanese,Ubuntu Condensed,DejaVu Sans Condensed,Liberation "
- L"Serif,Ubuntu,FreeSerif",
- 2, 1252},
- {0x3cdae668, L"FreestyleScript",
- L"KacstQurn,Droid Sans Japanese,DejaVu Sans", 8, 1252},
- {0x3d55aed7, L"Jokerman", L"Droid Sans Japanese,DejaVu Sans", 0, 1252},
- {0x3d5b4385, L"PMingLiU",
- L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,WenQuanYi Zen Hei "
- L"Sharp,WenQuanYi Micro Hei",
- 2, 1252},
- {0x3d9b7669, L"EstrangeloEdessa", L"Droid Sans Japanese,DejaVu Sans", 0,
- 1252},
- {0x3e532d74, L"FranklinGothicMedium", L"Droid Sans Japanese,Ubuntu", 0,
- 1252},
- {0x3e6aa32d, L"NSimSun",
- L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,WenQuanYi Zen Hei "
- L"Sharp,WenQuanYi Micro Hei",
- 1, 936},
- {0x3f6c36a8, L"Gautami",
- L"Droid Arabic Naskh,Droid Sans Ethiopic, mry_KacstQurn,Droid Sans "
- L"Japanese,FreeSans",
- 0, 1252},
- {0x3ff32662, L"Chiller-Regular",
- L"KacstQurn,Droid Arabic Naskh,Droid Sans Ethiopic,FreeSans", 0, 1252},
- {0x409de312, L"ModernNo.20",
- L"KacstQurn,Droid Sans Japanese,Nimbus Sans L,Nimbus Sans L,FreeSans", 2,
- 1252},
- {0x41443c5e, L"Georgia", L"Droid Sans Japanese,FreeSans", 2, 1252},
- {0x4160ade5, L"BellGothicStdBlack", L"FreeSans", 0, 1252},
- {0x421976c4, L"Modern-Regular", L"FreeSans", 2, 1252},
- {0x422a7252, L"Stencil", L"Droid Sans Japanese,FreeSans,Liberation Sans", 0,
- 1252},
- {0x42c8554f, L"Fixedsys", L"FreeSerif", 0, 1252},
- {0x435cb41d, L"Roman", L"FreeSerif", 0, 1252},
- {0x47882383, L"CourierNew",
- L"FreeMono,WenQuanYi Micro Hei Mono,AR PL UKai CN,AR PL UKai HK,AR PL "
- L"UKai TW,AR PL UKai TW MBE,DejaVu Sans",
- 1, 1252},
- {0x480a2338, L"BerlinSansFBDemi", L"Droid Sans Japanese,Liberation Serif",
- 0, 1252},
- {0x480bf7a4, L"CourierStd", L"DejaVu Sans", 0, 1252},
- {0x481ad6ed, L"VladimirScript", L"Droid Sans Japanese,DejaVu Serif", 8,
- 1252},
- {0x4911577a, L"YouYuan",
- L"WenQuanYi Zen Hei Mono,AR PL UMing CN,AR PL UMing HK,AR PL UMing TW", 1,
- 936},
- {0x4a788d72, L"STXingkai", L"AR PL UKai HK,AR PL UMing HK,AR PL UKai CN", 0,
- 936},
- {0x4bf88566, L"SegoeCondensed", L"FreeSerif", 0, 1252},
- {0x4ccf51a4, L"BerlinSansFB-Reg", L"Droid Sans Japanese,Liberation Serif",
- 0, 1252},
- {0x4ea967ce, L"GulimChe",
- L"WenQuanYi Zen Hei Mono,AR PL UKai CN,AR PL UKai HK,AR PL UKai TW,AR PL "
- L"UKai TW MBE",
- 1, 1252},
- {0x4f68bd79, L"LetterGothicStd",
- L"FreeMono,Liberation Mono,Andale Mono,WenQuanYi Micro Hei Mono", 0, 1252},
- {0x51a0d0e6, L"KozukaGothicPr6NM", L"FreeSerif", 0, 1252},
- {0x531b3dea, L"BasemicSymbol", L"FreeSerif", 0, 1252},
- {0x5333fd39, L"CalifornianFB-Reg",
- L"Droid Sans Japanese,URW Chancery L,FreeSerif", 2, 1252},
- {0x53561a54, L"FZYTK--GBK1-0",
- L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,WenQuanYi Zen Hei "
- L"Sharp,WenQuanYi Micro Hei",
- 0, 936},
- {0x55e0dde6, L"LucidaSansTypewriter",
- L"Ubuntu Mono,DejaVu Sans Mono,Nimbus Mono L,Liberation Mono,Courier 10 "
- L"Pitch,FreeMono",
- 0, 1252},
- {0x574d4d3d, L"AdobeArabic", L"Droid Sans Japanese,DejaVu Sans", 0, 1252},
- {0x5792e759, L"STKaiti", L"WenQuanYi Micro Hei Mono", 0, 936},
- {0x5921978e, L"LucidaSansUnicode", L"Droid Sans Japanese,DejaVu Sans", 0,
- 1252},
- {0x594e2da4, L"Vrinda",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,Droid Arabic "
- L"Naskh,mry_KacstQurn,Droid Sans Japanese,FreeSans,FreeSerif",
- 0, 1252},
- {0x59baa9a2, L"KaiTi_GB2312",
- L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,WenQuanYi Zen Hei "
- L"Sharp,WenQuanYi Micro Hei",
- 0, 1252},
- {0x5cfedf4f, L"BaskOldFace",
- L"KacstQurn,Droid Sans Japanese,Ubuntu,Liberation Serif", 0, 1252},
- {0x5e16ac91, L"TrajanPro",
- L"Nimbus Sans L,AR PL UMing HK,AR PL UKai HK,AR PL UMing TW,AR PL UMing "
- L"TW MBE,DejaVu Sans,DejaVu Serif",
- 0, 1252},
- {0x5f388196, L"ITCLegacySansStdMedium",
- L"Liberation Serif,FreeSerif,FreeSans,Ubuntu", 0, 1252},
- {0x5f97921c, L"AdobeMyungjoStdM",
- L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,WenQuanYi Zen Hei "
- L"Sharp,WenQuanYi Micro Hei",
- 0, 936},
- {0x5fefbfad, L"Batang",
- L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,WenQuanYi Zen Hei "
- L"Sharp,WenQuanYi Micro Hei",
- 2, 1252},
- {0x605342b9, L"DotumChe",
- L"WenQuanYi Zen Hei Mono,AR PL UMing CN,AR PL UMing HK,AR PL UMing TW", 1,
- 1252},
- {0x608c5f9a, L"KaiTi_GB2312",
- L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,WenQuanYi Zen Hei "
- L"Sharp,WenQuanYi Micro Hei",
- 0, 936},
- {0x61efd0d1, L"MaturaMTScriptCapitals",
- L"KacstQurn,Droid Arabic Naskh,Droid Sans Ethiopic,mry_KacstQurn,Droid "
- L"Sans Japanese,DejaVu Serif,DejaVu Sans",
- 0, 1252},
- {0x626608a9, L"MVBoli",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,mry_KacstQurn,Droid Sans "
- L"Ethiopic,Droid Sans Japanese,DejaVu Sans",
- 0, 1252},
- {0x630501a3, L"SmallFonts", L"DejaVu Serif", 0, 1252},
- {0x65d0e2a9, L"FZYTK--GBK1-0",
- L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,WenQuanYi Zen Hei "
- L"Sharp,WenQuanYi Micro Hei",
- 0, 936},
- {0x669f29e1, L"FZSTK--GBK1-0",
- L"AR PL UMing CN,AR PL UKai CN, AR PL UMing HK", 0, 936},
- {0x673a9e5f, L"Tunga",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,mry_KacstQurn,Droid Sans "
- L"Japanese,DejaVu Serif",
- 0, 1252},
- {0x691aa4ce, L"NiagaraSolid", L"Droid Sans Japanese,DejaVu Serif", 0, 1252},
- {0x696259b7, L"Corbel", L"Droid Sans Japanese,DejaVu Sans", 0, 1252},
- {0x696ee9be, L"STXihei", L"WenQuanYi Micro Hei Mono", 0, 936},
- {0x6c59cf69, L"Dotum", L"WenQuanYi Zen Hei Mono", 0, 1252},
- {0x707fa561, L"Gungsuh", L"WenQuanYi Zen Hei Mono", 2, 1252},
- {0x71416bb2, L"ZWAdobeF",
- L"KacstArt,KacstBookm,KacstDecorative,KacstDigital,KacstFarsi,KacstLetter,"
- L"KacstOffice,Dingbats,FreeSerif",
- 0, 1252},
- {0x71b41801, L"Verdana",
- L"DejaVu Sans Condensed,Ubuntu Condensed,Droid Sans Japanese,DejaVu Sans",
- 0, 1252},
- {0x73f25e4c, L"PalatinoLinotype", L"Droid Sans Japanese,FreeSerif", 0,
- 1252},
- {0x73f4d19f, L"NiagaraEngraved", L"Droid Sans Japanese,FreeSerif", 0, 1252},
- {0x74001694, L"MyriadProBlack", L"Droid Sans Japanese,AR PL UKai HK", 0,
- 1252},
- {0x74b14d8f, L"Haettenschweiler", L"Droid Sans Japanese,DejaVu Serif", 0,
- 1252},
- {0x74cb44ee, L"NSimSun", L"WenQuanYi Zen Hei Mono", 1, 936},
- {0x76b4d7ff, L"Shruti",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,mry_KacstQurn,Droid Sans "
- L"Japanese,FreeSans",
- 0, 1252},
- {0x788b3533, L"Webdings", L"FreeSans", 6, 42},
- {0x797dde99, L"MSSerif", L"FreeSans", 0, 1252},
- {0x7a0f9e9e, L"MSMincho",
- L"WenQuanYi Micro Hei Mono,AR PL UMing CN,AR PL UMing HK,AR PL UMing TW",
- 1, 1252},
- {0x7b439caf, L"OldEnglishTextMT",
- L"Droid Sans Japanese,Liberation Sans,Ubuntu", 0, 1252},
- {0x8213a433, L"LucidaSans-Typewriter",
- L"Ubuntu Mono,Liberation Mono,DejaVu Sans Mono", 0, 1252},
- {0x82fec929, L"AdobeSongStdL",
- L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,WenQuanYi Zen Hei "
- L"Sharp,WenQuanYi Micro Hei",
- 0, 936},
- {0x83581825, L"Modern", L"FreeSans", 0, 1252},
- {0x835a2823, L"Algerian",
- L"KacstQurn,Droid Sans Japanese,FreeSans,Liberation Sans,Ubuntu", 0, 1252},
- {0x83dab9f5, L"Script", L"FreeSans", 0, 1252},
- {0x847b56da, L"Tahoma",
- L"Droid Sans Japanese,DejaVu Sans Condensed,FreeSerif", 0, 1252},
- {0x8a783cb2, L"SimSun-PUA",
- L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,WenQuanYi Zen Hei "
- L"Sharp,WenQuanYi Micro Hei",
- 0, 1252},
- {0x8b5cac0e, L"Onyx", L"Droid Sans Japanese,Liberation Sans", 0, 1252},
- {0x8c6a499e, L"Gulim",
- L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,WenQuanYi Zen Hei "
- L"Sharp,WenQuanYi Micro Hei",
- 0, 1252},
- {0x8e0af790, L"JuiceITC", L"Droid Sans Japanese,Liberation Sans", 0, 1252},
- {0x8e8d43b2, L"Centaur",
- L"KacstQurn,Droid Sans Japanese,Khmer OS,Khmer OS System", 2, 1252},
- {0x8ee4dcca, L"BookshelfSymbol7", L"Liberation Sans", 0, 1252},
- {0x90794800, L"BellGothicStdLight", L"Liberation Sans", 0, 1252},
- {0x909b516a, L"Century",
- L"Droid Sans Japanese,Liberation Sans,Liberation Mono,Liberation Serif", 2,
- 1252},
- {0x92ae370d, L"MSOutlook", L"Liberation Sans", 4, 42},
- {0x93c9fbf1, L"LucidaFax",
- L"KacstQurn,Droid Arabic Naskh,Droid Sans "
- L"Ethiopic,mry_KacstQurn,Liberation Sans",
- 2, 1252},
- {0x9565085e, L"BookAntiqua",
- L"Droid Sans Japanese,Liberation Sans,Liberation Serif", 2, 1252},
- {0x9856d95d, L"AdobeMingStdL", L"AR PL UMing HK", 0, 949},
- {0x9bbadd6b, L"ColonnaMT",
- L"KacstQurn,Droid Sans Japanese,Khmer OS,Khmer OS System", 0, 1252},
- {0x9cbd16a4, L"ShowcardGothic-Reg",
- L"Droid Sans Japanese,Liberation Sans,Ubuntu", 0, 1252},
- {0x9d73008e, L"MSSansSerif", L"FreeSerif", 0, 1252},
- {0xa0607db1, L"GungsuhChe",
- L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,WenQuanYi Zen Hei "
- L"Sharp,WenQuanYi Micro Hei",
- 1, 1252},
- {0xa0bcf6a1, L"LatinWide", L"FreeSerif", 2, 1252},
- {0xa1429b36, L"Symbol", L"FreeSerif", 6, 42},
- {0xa1fa5abc, L"Wingdings2", L"FreeSerif", 6, 42},
- {0xa1fa5abd, L"Wingdings3", L"FreeSerif", 6, 42},
- {0xa427bad4, L"InformalRoman-Regular",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,mry_KacstQurn,Droid Sans "
- L"Japanese,FreeSerif",
- 8, 1252},
- {0xa8b92ece, L"FZSTK--GBK1-0", L"AR PL UMing CN", 0, 936},
- {0xa8d83ece, L"CalifornianFB", L"Droid Sans Japanese,FreeSerif", 2, 1252},
- {0xaa3e082c, L"Kingsoft-Phonetic",
- L"Tibetan Machine Uni,LKLUG,Samyak Gujarati,Droid Sans "
- L"Thai,utkal,Kedage,Mallige,AR PL UKai CN",
- 0, 1252},
- {0xaa6bcabe, L"HarlowSolidItalic",
- L"KacstQurn,Droid Sans Japanese,Liberation Serif", 0, 1252},
- {0xade5337c, L"MSUIGothic",
- L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,WenQuanYi Zen Hei "
- L"Sharp,WenQuanYi Micro Hei",
- 0, 1252},
- {0xb08dd941, L"WideLatin",
- L"KacstQurn,Droid Arabic Naskh,Droid Sans Ethiopic,mry_KacstQurn,Droid "
- L"Sans Japanese,Liberation Serif",
- 2, 1252},
- {0xb12765e0, L"ITCLegacySansStdBook",
- L"AR PL UMing HK,AR PL UKai HK,FreeSerif,Ubuntu,FreeSans", 0, 1252},
- {0xb207f05d, L"PoorRichard", L"Droid Sans Japanese,Liberation Serif", 2,
- 1252},
- {0xb3bc492f, L"JuiceITC-Regular", L"Droid Sans Japanese,Liberation Serif",
- 0, 1252},
- {0xb5545399, L"Marlett", L"Liberation Serif", 4, 42},
- {0xb5dd1ebb, L"BritannicBold",
- L"KacstQurn,Droid Arabic Naskh,Droid Sans "
- L"Ethiopic,mry_KacstQurn,Liberation Serif",
- 0, 1252},
- {0xb699c1c5, L"LucidaCalligraphy-Italic",
- L"KacstQurn,Droid Arabic Naskh,Droid Sans Ethiopic,mry_KacstQurn,Droid "
- L"Sans Japanese,DejaVu Serif",
- 0, 1252},
- {0xb725d629, L"TimesNewRoman", L"Droid Sans Japanese,Liberation Sans", 2,
- 1252},
- {0xb7eaebeb, L"AdobeHeitiStdR",
- L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,WenQuanYi Zen Hei "
- L"Sharp,WenQuanYi Micro Hei",
- 0, 936},
- {0xbd29c486, L"BerlinSansFBDemi-Bold", L"Droid Sans Japanese,DejaVu Serif",
- 0, 1252},
- {0xbe8a8db4, L"BookshelfSymbolSeven", L"DejaVu Sans", 0, 1252},
- {0xc16c0118, L"AdobeHebrew", L"Droid Sans Japanese,Ubuntu,Liberation Serif",
- 0, 1252},
- {0xc318b0af, L"MyriadProLight",
- L"Droid Sans Japanese,AR PL UKai HK,AR PL UMing HK,AR PL UKai CN", 0,
- 1252},
- {0xc65e5659, L"CambriaMath", L"Droid Sans Japanese,FreeSerif,FreeMono", 2,
- 1252},
- {0xc75c8f05, L"LucidaConsole",
- L"Liberation Mono,DejaVu Sans Mono,FreeMono,WenQuanYi Micro Hei Mono", 1,
- 1252},
- {0xca7c35d6, L"Calibri", L"Droid Sans Japanese,DejaVu Sans", 0, 1252},
- {0xcb053f53, L"MicrosoftYaHei",
- L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,WenQuanYi Zen Hei "
- L"Sharp,WenQuanYi Micro Hei",
- 0, 936},
- {0xcb7190f9, L"Magneto-Bold",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,mry_KacstQurn,Droid Sans "
- L"Japanese,DejaVu Serif",
- 0, 1252},
- {0xcca00cc5, L"System", L"DejaVu Sans", 0, 1252},
- {0xccad6f76, L"Jokerman-Regular", L"Droid Sans Japanese,DejaVu Sans", 0,
- 1252},
- {0xccc5818c, L"EuroSign", L"DejaVu Serif", 0, 1252},
- {0xcf3d7234, L"LucidaHandwriting-Italic",
- L"Liberation Sans Narrow,Ubuntu Condensed,Nimbus Sans L,DejaVu Serif", 0,
- 1252},
- {0xcf7b8fdb, L"MinionPro", L"DejaVu Sans", 0, 1252},
- {0xcfe5755f, L"Simhei",
- L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,WenQuanYi Zen Hei "
- L"Sharp,WenQuanYi Micro Hei",
- 1, 936},
- {0xd011f4ee, L"MSPGothic",
- L"WenQuanYi Zen Hei Mono,AR PL UMing CN,AR PL UMing HK,AR PL UMing TW", 0,
- 1252},
- {0xd060e7ef, L"Vivaldi",
- L"KacstQurn,Droid Sans Japanese,Liberation Sans,Ubuntu", 8, 1252},
- {0xd07edec1, L"FranklinGothic-Medium", L"Droid Sans Japanese,Ubuntu", 0,
- 1252},
- {0xd107243f, L"SimSun", L"WenQuanYi Zen Hei Mono", 0, 936},
- {0xd1881562, L"ArialNarrow",
- L"Liberation Sans Narrow,Droid Sans Japanese,FreeSerif", 0, 1252},
- {0xd22b7dce, L"BodoniMTPosterCompressed",
- L"Droid Sans Japanese,DejaVu Serif", 0, 1252},
- {0xd22bfa60, L"ComicSansMS",
- L"Droid Sans Japanese,FreeMono,Liberation Mono", 8, 1252},
- {0xd3bd0e35, L"Bauhaus93",
- L"KacstQurn,Droid Sans Japanese,Liberation Sans,Ubuntu", 0, 1252},
- {0xd429ee7a, L"STFangsong", L"WenQuanYi Micro Hei Mono", 0, 936},
- {0xd6679c12, L"BernardMTCondensed",
- L"KacstQurn,Droid Sans Japanese,Nimbus Sans L,URW Chancery "
- L"L,KacstOne,Liberation Sans",
- 0, 1252},
- {0xd8e8a027, L"LucidaSans",
- L"Liberation Sans Narrow,Nimbus Sans L,KacstQurn,Droid Arabic Naskh,Droid "
- L"Sans Ethiopic,DejaVu Serif Condensed,Liberation Mono,Ubuntu",
- 0, 1252},
- {0xd9fe7761, L"HighTowerText-Reg",
- L"Droid Sans Japanese,Ubuntu,Liberation Serif", 2, 1252},
- {0xda7e551e, L"STSong", L"WenQuanYi Micro Hei Mono", 0, 936},
- {0xdaa6842d, L"STZhongsong",
- L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,WenQuanYi Zen Hei "
- L"Sharp,WenQuanYi Micro Hei",
- 0, 936},
- {0xdaaab93f, L"STFangsong",
- L"WenQuanYi Micro Hei Mono,WenQuanYi Zen Hei Mono,WenQuanYi Zen "
- L"Hei,WenQuanYi Zen Hei Sharp",
- 0, 936},
- {0xdaeb0713, L"STSong",
- L"WenQuanYi Micro Hei Mono,WenQuanYi Zen Hei Mono,WenQuanYi Zen "
- L"Hei,WenQuanYi Zen Hei Sharp",
- 0, 936},
- {0xdafedbef, L"STCaiyun", L"AR PL UKai HK,AR PL UMing HK,AR PL UKai CN", 0,
- 936},
- {0xdb00a3d9, L"Broadway",
- L"KacstQurn,Droid Sans Japanese,DejaVu Sans,FreeMono,Liberation Mono", 0,
- 1252},
- {0xdb1f5ad4, L"STXinwei", L"AR PL UKai HK,AR PL UMing HK,AR PL UKai CN", 0,
- 936},
- {0xdb326e7f, L"STKaiti",
- L"WenQuanYi Micro Hei Mono,WenQuanYi Zen Hei Mono,WenQuanYi Zen "
- L"Hei,WenQuanYi Zen Hei Sharp",
- 0, 936},
- {0xdb69595a, L"STHupo",
- L"WenQuanYi Micro Hei Mono,WenQuanYi Zen Hei Mono,WenQuanYi Zen "
- L"Hei,WenQuanYi Zen Hei Sharp",
- 0, 936},
- {0xdba0082c, L"STXihei",
- L" WenQuanYi Micro Hei Mono,WenQuanYi Zen Hei Mono,WenQuanYi Zen "
- L"Hei,WenQuanYi Zen Hei Sharp",
- 0, 936},
- {0xdbd0ab18, L"STXingkai", L"AR PL UKai HK,AR PL UMing HK,AR PL UKai CN", 0,
- 936},
- {0xdc1a7db1, L"STLiti", L"AR PL UKai HK,AR PL UMing HK,AR PL UKai CN", 0,
- 936},
- {0xdc33075f, L"KristenITC-Regular",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,mry_KacstQurn,DejaVu Sans "
- L"Condensed,Ubuntu,Liberation Sans",
- 8, 1252},
- {0xdcc7009c, L"Harrington",
- L"KacstQurn,Droid Sans Japanese,Liberation Serif,FreeSerif,Ubuntu", 0,
- 1252},
- {0xdd712466, L"ArialBlack",
- L"Droid Sans Japanese,DejaVu Sans,DejaVu Serif,FreeMono", 0, 1252},
- {0xdde87b3e, L"Impact", L"Droid Sans Japanese,DejaVu Serif", 0, 1252},
- {0xdf69fb32, L"SnapITC",
- L"Liberation Sans Narrow,Ubuntu Condensed,DejaVu Sans,DejaVu "
- L"Serif,FreeMono",
- 0, 1252},
- {0xdf8b25e8, L"CenturyGothic",
- L"Droid Sans Japanese,Liberation Mono,Liberation Sans,Liberation Serif", 0,
- 1252},
- {0xe0f705c0, L"KristenITC",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,mry_KacstQurn,DejaVu Sans "
- L"Condensed,Ubuntu,Liberation Sans",
- 8, 1252},
- {0xe1427573, L"Raavi",
- L"Droid Arabic Naskh,Droid Sans "
- L"Ethiopic,mry_KacstQurn,FreeSerif,Liberation Serif,Khmer OS",
- 0, 1252},
- {0xe2cea0cb, L"Magneto",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,mry_KacstQurn,DejaVu "
- L"Serif,DejaVu Serif Condensed,DejaVu Sans",
- 0, 1252},
- {0xe36a9e17, L"Ravie",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,mry_KacstQurn,DejaVu "
- L"Serif,DejaVu Sans,FreeMono",
- 0, 1252},
- {0xe433f8e2, L"Parchment", L"Droid Sans Japanese,DejaVu Serif", 8, 1252},
- {0xe43dff4a, L"Wingdings", L"DejaVu Serif", 4, 42},
- {0xe4e2c405, L"MTExtra", L"DejaVu Serif", 6, 42},
- {0xe618cc35, L"InformalRoman",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,mry_KacstQurn,Droid Sans "
- L"Japanese,Nimbus Sans L,DejaVu Sans Condensed,Ubuntu,Liberation Sans",
- 8, 1252},
- {0xe6c27ffc, L"Mistral", L"Droid Sans Japanese,DejaVu Serif", 8, 1252},
- {0xe7ebf4b9, L"Courier", L"DejaVu Sans,DejaVu Sans Condensed,FreeSerif", 0,
- 1252},
- {0xe8bc4a9d, L"MSReferenceSpecialty", L"DejaVu Serif", 0, 1252},
- {0xe90fb013, L"TempusSansITC",
- L"Droid Sans Japanese,Ubuntu,Liberation Serif,FreeSerif", 0, 1252},
- {0xec637b42, L"Consolas",
- L"DejaVu Sans Condensed,AR PL UKai CN,AR PL UKai HK,AR PL UKai "
- L"TW,FreeSerif,FreeSans",
- 1, 1252},
- {0xed3a683b, L"STXinwei", L"AR PL UKai HK,AR PL UMing HK,AR PL UKai CN", 0,
- 936},
- {0xef264cd1, L"LucidaHandwriting",
- L"Liberation Sans Narrow,Ubuntu Condensed,Nimbus Sans "
- L"L,KacstQurn,Liberation Mono",
- 0, 1252},
- {0xf086bca2, L"BaskervilleOldFace",
- L"KacstQurn,Droid Sans Japanese,Liberation Serif,Ubuntu,FreeSerif", 0,
- 1252},
- {0xf1028030, L"Mangal",
- L"FreeSans,TSCu_Paranar,Garuda,Liberation Sans,Liberation Sans "
- L"Narrow,Nimbus Sans L",
- 2, 1252},
- {0xf1da7eb9, L"ShowcardGothic",
- L"Droid Sans Japanese,DejaVu Serif Condensed,DejaVu Sans "
- L"Condensed,Liberation Sans,Ubuntu",
- 0, 1252},
- {0xf210f06a, L"ArialMT",
- L"Liberation Sans,Liberation Sans Narrow,FreeSans,Nimbus Sans L,Khmer OS "
- L"System,Khmer OS",
- 0, 1252},
- {0xf477f16a, L"Latha",
- L"Liberation Sans Narrow,Nimbus Sans L,Droid Arabic "
- L"Naskh,mry_KacstQurn,FreeSerif,Nimbus Sans L",
- 0, 1252},
- {0xf616f3dd, L"LiSu",
- L"WenQuanYi Zen Hei Mono,AR PL UMing CN,AR PL UMing HK,AR PL UMing TW,AR "
- L"PL UMing TW MBE",
- 1, 936},
- {0xfa479aa6, L"MicrosoftYaHei",
- L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,WenQuanYi Zen Hei "
- L"Sharp,WenQuanYi Micro Hei",
- 0, 936},
- {0xfcd19697, L"BookmanOldStyle",
- L"Droid Sans Japanese,Liberation Mono,Liberation Sans,Liberation Serif", 0,
- 1252},
- {0xfe209a82, L"LucidaCalligraphy",
- L"KacstQurn,Droid Arabic Naskh,Droid Sans Ethiopic,mry_KacstQurn,Droid "
- L"Sans Japanese,DejaVu Serif,DejaVu Sans,FreeMono",
- 0, 1252},
- {0xfef135f8, L"AdobeHeitiStd-Regular",
- L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,WenQuanYi Zen Hei "
- L"Sharp,WenQuanYi Micro Hei",
- 0, 936},
-};
-#elif _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
-const XFA_FONTINFO g_XFAFontsMap[] = {
- {0x01d5d33e, L"SimSun", L"STHeiti,Heiti TC,STFangsong", 0, 936},
- {0x01e4f102, L"YouYuan", L"STHeiti,Heiti TC,STFangsong", 1, 936},
- {0x030549dc, L"LiSu", L"STHeiti,Heiti TC,STFangsong", 1, 936},
- {0x032edd44, L"Simhei", L"STHeiti,Heiti TC,STFangsong", 1, 936},
- {0x03eac6fc, L"PoorRichard-Regular",
- L"Noteworthy,Avenir Next Condensed,Impact", 2, 1252},
- {0x03ed90e6, L"Nina", L"Microsoft Sans Serif", 0, 1252},
- {0x077b56b3, L"KingsoftPhoneticPlain",
- L"LastResort,Apple "
- L"Chancery,STIXVariants,STIXSizeOneSym,STIXSizeOneSym,Apple Braille",
- 0, 1252},
- {0x078ed524, L"MicrosoftSansSerif", L"Songti SC,Apple Symbols", 0, 1252},
- {0x089b18a9, L"Arial",
- L"Arial Unicode MS,Microsoft Sans Serif,Apple Symbols", 0, 1252},
- {0x0b2cad72, L"MonotypeCorsiva", L"Arial Narrow,Impact", 8, 1252},
- {0x0bb003e7, L"Kartika",
- L"Arial Unicode MS,Microsoft Sans Serif,Arial Narrow,Damascus", 2, 1252},
- {0x0bb469df, L"VinerHandITC", L"Comic Sans MS,Songti SC,STSong", 8, 1252},
- {0x0bc1a851, L"SegoeUI", L"Apple Symbols", 0, 1252},
- {0x0c112ebd, L"KozukaGothicPro-VIM", L"Microsoft Sans Serif,Apple Symbols",
- 0, 1252},
- {0x0cfcb9c1, L"AdobeThai", L"Avenir Next Condensed Ultra Light", 0, 847},
- {0x0e7de0f9, L"Playbill", L"STIXNonUnicode", 0, 1252},
- {0x0eff47c3, L"STHupo", L"Kaiti SC,Songti SC,STHeiti", 0, 936},
- {0x107ad374, L"Constantia", L"Arial Unicode MS,Palatino,Baskerville", 2,
- 1252},
- {0x12194c2d, L"KunstlerScript",
- L"Avenir Next Condensed Demi Bold,Arial Narrow", 8, 1252},
- {0x135ef6a1, L"MinionProSmBd", L"Microsoft Sans Serif,Apple Symbols", 0,
- 1252},
- {0x158c4049, L"Garamond", L"Impact,Arial Narrow", 2, 1252},
- {0x160ecb24, L"STZhongsong", L"STFangsong,Songti SC", 0, 936},
- {0x161ed07e, L"MSGothic",
- L"WenQuanYi Zen Hei Mono,AR PL UMing CN,AR PL UMing HK,AR PL UMing "
- L"TW,Microsoft Sans Serif,Apple Symbols",
- 1, 1252},
- {0x171d1ed1, L"SnapITC-Regular", L"STHeiti,Arial Black", 0, 1252},
- {0x18d1188f, L"Cambria", L"Arial Unicode MS", 2, 1252},
- {0x18eaf350, L"ArialUnicodeMS", L"Microsoft Sans Serif,Apple Symbols", 0,
- 936},
- {0x1a92d115, L"MingLiU", L"Heiti SC,STHeiti", 1, 1252},
- {0x1cc217c6, L"TrebuchetMS", L"Damascus,Impact,Arial Narrow", 0, 1252},
- {0x1d649596, L"BasemicTimes", L"Liberation Serif,Impact,Arial Narrow", 0,
- 1252},
- {0x1e34ee60, L"BellMT",
- L"Papyrus,STIXNonUnicode,Microsoft Sans Serif,Avenir Light", 2, 1252},
- {0x1eb36945, L"CooperBlack",
- L"Marion,STIXNonUnicode,Arial Rounded MT Bold,Lucida Grande", 2, 1252},
- {0x1ef7787d, L"BatangChe",
- L"WenQuanYi Zen Hei Mono,AR PL UMing CN,,AR PL UMing HK,AR PL UMing TW,AR "
- L"PL UMing TW MBE,Arial Unicode MS,Heiti TC",
- 1, 1252},
- {0x20b3bd3a, L"BrushScriptMT",
- L"STIXNonUnicode,Damascus,Arial Narrow,Avenir Next Condensed,Cochin", 8,
- 1252},
- {0x220877aa, L"Candara", L"Cochin,Baskerville,Marion", 0, 1252},
- {0x22135007, L"FreestyleScript-Regular",
- L"STIXNonUnicode,Nadeem,Zapf Dingbats", 8, 1252},
- {0x251059c3, L"Chiller",
- L"Zapf Dingbats,Damascus,STIXNonUnicode,Papyrus,KufiStandardGK,Baghdad", 0,
- 1252},
- {0x25bed6dd, L"MSReferenceSansSerif",
- L"Tahoma,Apple Symbols,Apple LiGothic,Arial Unicode MS,Lucida "
- L"Grande,Microsoft Sans Serif",
- 0, 1252},
- {0x28154c81, L"Parchment-Regular", L"Microsoft Sans Serif,Apple Symbols", 8,
- 1252},
- {0x29711eb9, L"STLiti", L"Kaiti SC,Songti SC", 0, 936},
- {0x2b1993b4, L"Basemic", L"Impact,Arial Narrow", 0, 1252},
- {0x2b316339, L"NiagaraSolid-Reg", L"Microsoft Sans Serif,Apple Symbols", 0,
- 1252},
- {0x2c147529, L"FootlightMTLight",
- L"STIXNonUnicode,Avenir Next Condensed Heavy,PT Sans,Noteworthy", 0, 1252},
- {0x2c198928, L"HarlowSolid",
- L"Avenir Medium,Avenir Next Medium,Arial Unicode MS", 0, 1252},
- {0x2c6ac6b2, L"LucidaBright",
- L"PT Sans Narrow,Papyrus,Damascus,STIXNonUnicode,Arial Rounded MT "
- L"Bold,Comic Sans MS,Avenir Next",
- 2, 1252},
- {0x2c9f38e2, L"KozukaMinchoPro-VIR", L"Microsoft Sans Serif,Apple Symbols",
- 0, 1252},
- {0x2d5a47b0, L"STCaiyun", L"Kaiti SC,Songti SC", 0, 936},
- {0x2def26bf, L"BernardMT-Condensed",
- L"Impact,Avenir Next Condensed Demi Bold,American Typewriter", 0, 1252},
- {0x2fd8930b, L"KozukaMinchoPr6NR", L"Microsoft Sans Serif,Apple Symbols", 0,
- 1252},
- {0x3115525a, L"FangSong_GB2312", L"Hiragino Sans GB,STHeiti", 0, 1252},
- {0x31327817, L"MyriadPro", L"Microsoft Sans Serif,Apple Symbols", 0, 1252},
- {0x32244975, L"Helvetica",
- L"Arial Narrow,Arial Unicode MS,Damascus,STIXNonUnicode", 0, 1252},
- {0x32ac995c, L"Terminal", L"Microsoft Sans Serif,Apple Symbols", 0, 1252},
- {0x338d648a, L"NiagaraEngraved-Reg", L"Microsoft Sans Serif,Apple Symbols",
- 0, 1252},
- {0x33bb65f2, L"Sylfaen", L"Arial Unicode MS,Marion", 2, 1252},
- {0x3402c30e, L"MSPMincho", L"Arial Unicode MS,Apple SD Gothic Neo", 2,
- 1252},
- {0x3412bf31, L"SimSun-PUA", L"STHeiti,Heiti TC,STFangsong", 0, 936},
- {0x36eb39b9, L"BerlinSansFB", L"American Typewriter,Impact", 0, 1252},
- {0x36f42055, L"UniversATT", L"Microsoft Sans Serif", 0, 1252},
- {0x3864c4f6, L"HighTowerText", L"STIXGeneral,.Helvetica Neue Desk UI", 2,
- 1252},
- {0x3a257d03, L"FangSong_GB2312", L"Hiragino Sans GB,STHeiti", 0, 1252},
- {0x3cdae668, L"FreestyleScript", L"Nadeem,Zapf Dingbats,STIXNonUnicode", 8,
- 1252},
- {0x3d55aed7, L"Jokerman",
- L"Papyrus,Lucida Grande,Heiti TC,American Typewriter", 0, 1252},
- {0x3d5b4385, L"PMingLiU", L"Heiti SC,STHeiti", 2, 1252},
- {0x3d9b7669, L"EstrangeloEdessa", L"American Typewriter,Marion", 0, 1252},
- {0x3e532d74, L"FranklinGothicMedium", L"Impact,Arial Narrow", 0, 1252},
- {0x3e6aa32d, L"NSimSun", L"STHeiti,STFangsong", 1, 936},
- {0x3f6c36a8, L"Gautami",
- L"Damascus,STIXNonUnicode,STIXGeneral,American Typewriter", 0, 1252},
- {0x3ff32662, L"Chiller-Regular", L"Papyrus,KufiStandardGK,Baghdad", 0,
- 1252},
- {0x409de312, L"ModernNo.20", L"Avenir Next Condensed,Impact", 2, 1252},
- {0x41443c5e, L"Georgia", L".Helvetica Neue Desk UI,Arial Unicode MS", 2,
- 1252},
- {0x4160ade5, L"BellGothicStdBlack", L"Microsoft Sans Serif,Apple Symbols",
- 0, 1252},
- {0x421976c4, L"Modern-Regular", L"Impact", 2, 1252},
- {0x422a7252, L"Stencil", L"STIXNonUnicode,Songti SC,Georgia,Baskerville", 0,
- 1252},
- {0x42c8554f, L"Fixedsys", L"Microsoft Sans Serif,Apple Symbols", 0, 1252},
- {0x435cb41d, L"Roman", L"Arial Narrow", 0, 1252},
- {0x47882383, L"CourierNew", L"PCMyungjo,Osaka,Arial Unicode MS,Songti SC",
- 1, 1252},
- {0x480a2338, L"BerlinSansFBDemi",
- L"STIXNonUnicode,American Typewriter,Avenir Next Condensed Heavy", 0,
- 1252},
- {0x480bf7a4, L"CourierStd", L"Courier New", 0, 1252},
- {0x481ad6ed, L"VladimirScript",
- L"STIXNonUnicode,Avenir Next Condensed,Impact", 8, 1252},
- {0x4911577a, L"YouYuan", L"STHeiti,Heiti TC", 1, 936},
- {0x4a788d72, L"STXingkai", L"Kaiti SC,Songti SC", 0, 936},
- {0x4bf88566, L"SegoeCondensed", L"Microsoft Sans Serif,Apple Symbols", 0,
- 1252},
- {0x4ccf51a4, L"BerlinSansFB-Reg",
- L"STIXNonUnicode,American Typewriter,Impact", 0, 1252},
- {0x4ea967ce, L"GulimChe", L"Arial Unicode MS,Heiti TC,STFangsong", 1, 1252},
- {0x4f68bd79, L"LetterGothicStd",
- L"Courier New,Andale Mono,Ayuthaya,PCMyungjo,Osaka", 0, 1252},
- {0x51a0d0e6, L"KozukaGothicPr6NM", L"Microsoft Sans Serif,Apple Symbols", 0,
- 1252},
- {0x531b3dea, L"BasemicSymbol", L"Microsoft Sans Serif,Apple Symbols", 0,
- 1252},
- {0x5333fd39, L"CalifornianFB-Reg",
- L"American Typewriter,Avenir Next Condensed,Impact", 2, 1252},
- {0x53561a54, L"FZYTK--GBK1-0", L"STFangsong,Songti SC,STSong", 0, 936},
- {0x55e0dde6, L"LucidaSansTypewriter", L"Menlo,Courier New,Andale Mono", 0,
- 1252},
- {0x574d4d3d, L"AdobeArabic", L"Arial Narrow", 0, 1252},
- {0x5792e759, L"STKaiti", L"Songti SC,Arial Unicode MS", 0, 936},
- {0x5921978e, L"LucidaSansUnicode", L"Lucida Grande,Arial Unicode MS,Menlo",
- 0, 1252},
- {0x594e2da4, L"Vrinda", L"Geeza Pro,Damascus,STIXGeneral,Gill Sans", 0,
- 1252},
- {0x59baa9a2, L"KaiTi_GB2312", L"Hiragino Sans GB,STHeiti", 0, 1252},
- {0x5cfedf4f, L"BaskOldFace",
- L"Avenir Next Condensed Heavy,PT Sans,Avenir Next Condensed", 0, 1252},
- {0x5e16ac91, L"TrajanPro", L"Arial Narrow,PT Sans Narrow,Damascus", 0,
- 1252},
- {0x5f97921c, L"AdobeMyungjoStdM",
- L"AppleMyungjo,AppleGothic,Arial Unicode MS", 0, 936},
- {0x5fefbfad, L"Batang", L"Arial Unicode MS,Songti SC", 2, 1252},
- {0x605342b9, L"DotumChe", L"Arial Unicode MS,Heiti TC", 1, 1252},
- {0x608c5f9a, L"KaiTi_GB2312", L"Hiragino Sans GB,STHeiti,Heiti TC", 0, 936},
- {0x61efd0d1, L"MaturaMTScriptCapitals",
- L"Kokonor,Damascus,STIXNonUnicode,STHeiti,Arial Black,Avenir Next Heavy",
- 0, 1252},
- {0x626608a9, L"MVBoli",
- L"Apple Braille,Geeza Pro,Microsoft Sans Serif,Apple Symbols", 0, 1252},
- {0x630501a3, L"SmallFonts", L"Microsoft Sans Serif,Apple Symbols", 0, 1252},
- {0x65d0e2a9, L"FZYTK--GBK1-0", L"STFangsong,Songti SC,STSong", 0, 936},
- {0x669f29e1, L"FZSTK--GBK1-0", L"STHeiti,Heiti TC", 0, 936},
- {0x673a9e5f, L"Tunga",
- L"Damascus,STIXNonUnicode,Avenir Next Condensed,Avenir Next Condensed "
- L"Ultra Light,Futura",
- 0, 1252},
- {0x691aa4ce, L"NiagaraSolid", L"Microsoft Sans Serif,Apple Symbols", 0,
- 1252},
- {0x696259b7, L"Corbel", L"Cochin,Baskerville,Marion", 0, 1252},
- {0x696ee9be, L"STXihei", L"STHeiti,Heiti TC,Songti SC,Arial Unicode MS", 0,
- 936},
- {0x6c59cf69, L"Dotum", L"Arial Unicode MS,Songti SC", 0, 1252},
- {0x707fa561, L"Gungsuh", L"Arial Unicode MS,Heiti TC", 2, 1252},
- {0x71416bb2, L"ZWAdobeF",
- L"STIXSizeFourSym,STIXSizeThreeSym,STIXSizeTwoSym,STIXSizeOneSym", 0,
- 1252},
- {0x71b41801, L"Verdana",
- L"Tahoma,Marion,Apple Symbols,.Helvetica Neue Desk UI,Lucida "
- L"Grande,Courier New",
- 0, 1252},
- {0x73f25e4c, L"PalatinoLinotype", L"Palatino,Arial Unicode MS", 0, 1252},
- {0x73f4d19f, L"NiagaraEngraved", L"Microsoft Sans Serif,Apple Symbols", 0,
- 1252},
- {0x74001694, L"MyriadProBlack", L"Palatino,Baskerville,Marion,Cochin", 0,
- 1252},
- {0x74b14d8f, L"Haettenschweiler", L"Microsoft Sans Serif,Apple Symbols", 0,
- 1252},
- {0x74cb44ee, L"NSimSun", L"STHeiti,Heiti TC,STFangsong", 1, 936},
- {0x76b4d7ff, L"Shruti",
- L"Damascus,STIXNonUnicode,Arial Unicode MS,American Typewriter", 0, 1252},
- {0x788b3533, L"Webdings", L"Microsoft Sans Serif,Apple Symbols", 6, 42},
- {0x797dde99, L"MSSerif", L"Microsoft Sans Serif,Apple Symbols", 0, 1252},
- {0x7a0f9e9e, L"MSMincho",
- L"WenQuanYi Zen Hei Mono,AR PL UMing CN,AR PL UMing HK,AR PL UMing TW,AR "
- L"PL UMing TW MBE,Arial Unicode MS,Apple SD Gothic Neo",
- 1, 1252},
- {0x7b439caf, L"OldEnglishTextMT",
- L"STIXNonUnicode,Arial Unicode MS,Baskerville,Avenir Next Medium", 0,
- 1252},
- {0x8213a433, L"LucidaSans-Typewriter",
- L"Comic Sans MS,Avenir Next,Arial Rounded MT Bold", 0, 1252},
- {0x82fec929, L"AdobeSongStdL", L"Heiti TC,STHeiti", 0, 936},
- {0x83581825, L"Modern", L"Avenir Next Condensed,Impact", 0, 1252},
- {0x835a2823, L"Algerian",
- L"STIXNonUnicode,Baskerville,Avenir Next Medium,American Typewriter", 0,
- 1252},
- {0x83dab9f5, L"Script", L"Arial Narrow", 0, 1252},
- {0x847b56da, L"Tahoma", L"Songti SC,Apple Symbols", 0, 1252},
- {0x8a783cb2, L"SimSun-PUA", L"STHeiti,Heiti TC,STFangsong", 0, 1252},
- {0x8b5cac0e, L"Onyx", L"Microsoft Sans Serif,Apple Symbols", 0, 1252},
- {0x8c6a499e, L"Gulim", L"Arial Unicode MS,Songti SC", 0, 1252},
- {0x8e0af790, L"JuiceITC", L"Nadeem,Al Bayan", 0, 1252},
- {0x8e8d43b2, L"Centaur", L"Avenir Next Condensed,Noteworthy,Impact", 2,
- 1252},
- {0x8ee4dcca, L"BookshelfSymbol7", L"Microsoft Sans Serif,Apple Symbols", 0,
- 1252},
- {0x90794800, L"BellGothicStdLight", L"Microsoft Sans Serif,Apple Symbols",
- 0, 1252},
- {0x909b516a, L"Century", L"Damascus,Andale Mono,Songti SC,Arial Unicode MS",
- 2, 1252},
- {0x92ae370d, L"MSOutlook", L"Microsoft Sans Serif,Apple Symbols", 4, 42},
- {0x93c9fbf1, L"LucidaFax",
- L"PT Sans Narrow,Papyrus,Kokonor,Geeza Pro,Arial Rounded MT Bold,Lucida "
- L"Grande,Futura",
- 2, 1252},
- {0x9565085e, L"BookAntiqua", L"Palatino,Microsoft Sans Serif,Apple Symbols",
- 2, 1252},
- {0x9856d95d, L"AdobeMingStdL", L"AHiragino Sans GB,Heiti TC,STHeiti", 0,
- 949},
- {0x9bbadd6b, L"ColonnaMT", L"Noteworthy,Avenir Next Condensed,Impact", 0,
- 1252},
- {0x9cbd16a4, L"ShowcardGothic-Reg",
- L"Arial Unicode MS,Georgia,American Typewriter", 0, 1252},
- {0x9d73008e, L"MSSansSerif", L"Songti SC,Apple Symbols", 0, 1252},
- {0xa0607db1, L"GungsuhChe",
- L"WenQuanYi Zen Hei Mono,AR PL UMing CN,AR PL UMing HK,AR PL UMing TW,AR "
- L"PL UMing TW MBE,Arial Unicode MS,Heiti TC,STFangsong",
- 1, 1252},
- {0xa0bcf6a1, L"LatinWide", L"Zapfino,Arial Black,STHeiti", 2, 1252},
- {0xa1429b36, L"Symbol", L"Microsoft Sans Serif,Apple Symbols", 6, 42},
- {0xa1fa5abc, L"Wingdings2", L"Microsoft Sans Serif,Apple Symbols", 6, 42},
- {0xa1fa5abd, L"Wingdings3", L"Microsoft Sans Serif,Apple Symbols", 6, 42},
- {0xa427bad4, L"InformalRoman-Regular",
- L"STIXNonUnicode,Arial Narrow,Avenir Next Condensed Demi Bold", 8, 1252},
- {0xa8b92ece, L"FZSTK--GBK1-0", L"STHeiti,Heiti TC,STFangsong", 0, 936},
- {0xa8d83ece, L"CalifornianFB",
- L"American Typewriter,Avenir Next Condensed,Impact", 2, 1252},
- {0xaa3e082c, L"Kingsoft-Phonetic",
- L"STIXVariants,STIXSizeOneSym,Apple Braille", 0, 1252},
- {0xaa6bcabe, L"HarlowSolidItalic",
- L"STIXNonUnicode,Avenir Medium,Avenir Next Medium,Arial Unicode MS", 0,
- 1252},
- {0xade5337c, L"MSUIGothic", L"Arial Unicode MS,Apple SD Gothic Neo", 0,
- 1252},
- {0xb08dd941, L"WideLatin",
- L"Marion,Papyrus,Nanum Pen Script,Zapf Dingbats,Damascus,Zapfino,Arial "
- L"Black,STHeiti",
- 2, 1252},
- {0xb12765e0, L"ITCLegacySansStdBook",
- L"LastResort,.Helvetica Neue Desk UI,Arial Unicode MS,Palatino", 0, 1252},
- {0xb207f05d, L"PoorRichard", L"Noteworthy,Avenir Next Condensed,Impact", 2,
- 1252},
- {0xb3bc492f, L"JuiceITC-Regular", L"Nadeem,Al Bayan,STIXNonUnicode", 0,
- 1252},
- {0xb5545399, L"Marlett", L"Microsoft Sans Serif,Apple Symbols", 4, 42},
- {0xb5dd1ebb, L"BritannicBold",
- L"Damascus,STIXNonUnicode,Avenir Next Condensed Heavy,PT Sans", 0, 1252},
- {0xb699c1c5, L"LucidaCalligraphy-Italic", L"STHeiti,Arial Black", 0, 1252},
- {0xb725d629, L"TimesNewRoman", L"Microsoft Sans Serif,Apple Symbols", 2,
- 1252},
- {0xb7eaebeb, L"AdobeHeitiStdR", L"Heiti TC,STHeiti", 0, 936},
- {0xbd29c486, L"BerlinSansFBDemi-Bold",
- L"American Typewriter,Avenir Next Condensed Heavy", 0, 1252},
- {0xbe8a8db4, L"BookshelfSymbolSeven", L"Microsoft Sans Serif,Apple Symbols",
- 0, 1252},
- {0xc16c0118, L"AdobeHebrew",
- L".Helvetica Neue Desk UI,Palatino,American Typewriter", 0, 1252},
- {0xc318b0af, L"MyriadProLight", L"Palatino,Baskerville,Marion", 0, 1252},
- {0xc65e5659, L"CambriaMath", L"Arial Unicode MS", 2, 1252},
- {0xc75c8f05, L"LucidaConsole", L"Courier New,Menlo,Andale Mono", 1, 1252},
- {0xca7c35d6, L"Calibri", L"Apple Symbols,HeadLineA", 0, 1252},
- {0xcb053f53, L"MicrosoftYaHei", L"Arial Unicode MS", 0, 936},
- {0xcb7190f9, L"Magneto-Bold", L"Lucida Grande", 0, 1252},
- {0xcca00cc5, L"System", L"Microsoft Sans Serif,Apple Symbols", 0, 1252},
- {0xccad6f76, L"Jokerman-Regular", L"Lucida Grande", 0, 1252},
- {0xccc5818c, L"EuroSign", L"Microsoft Sans Serif,Apple Symbols", 0, 1252},
- {0xcf3d7234, L"LucidaHandwriting-Italic",
- L"Microsoft Sans Serif,Apple Symbols", 0, 1252},
- {0xcf7b8fdb, L"MinionPro",
- L"Bell MT,Corbel,Times New Roman,Cambria,Berlin Sans FB", 0, 1252},
- {0xcfe5755f, L"Simhei", L"STHeiti,Heiti TC,STFangsong", 1, 936},
- {0xd011f4ee, L"MSPGothic", L"Arial Unicode MS,Apple SD Gothic Neo", 0,
- 1252},
- {0xd060e7ef, L"Vivaldi",
- L"STIXNonUnicode,Arial Unicode MS,Avenir Medium,Avenir Next Medium", 8,
- 1252},
- {0xd07edec1, L"FranklinGothic-Medium", L"Impact,Arial Narrow", 0, 1252},
- {0xd107243f, L"SimSun", L"STHeiti,Heiti TC,STFangsong", 0, 936},
- {0xd1881562, L"ArialNarrow", L"PT Sans Narrow,Apple Symbols", 0, 1252},
- {0xd22b7dce, L"BodoniMTPosterCompressed",
- L"Microsoft Sans Serif,Apple Symbols", 0, 1252},
- {0xd22bfa60, L"ComicSansMS",
- L"Damascus,Georgia,.Helvetica Neue Desk UI,Lucida Grande,Arial Unicode MS",
- 8, 1252},
- {0xd3bd0e35, L"Bauhaus93",
- L"STIXNonUnicode,Arial Unicode MS,Avenir Next,Avenir", 0, 1252},
- {0xd429ee7a, L"STFangsong", L"Songti SC,Arial Unicode MS", 0, 936},
- {0xd6679c12, L"BernardMTCondensed",
- L"Impact,Avenir Next Condensed Demi Bold", 0, 1252},
- {0xd8e8a027, L"LucidaSans",
- L"Arial Narrow,Khmer MN,Kokonor,Damascus,Microsoft Sans Serif,Apple "
- L"Symbols",
- 0, 1252},
- {0xd9fe7761, L"HighTowerText-Reg",
- L"STIXGeneral,.Helvetica Neue Desk UI,Trebuchet MS", 2, 1252},
- {0xda7e551e, L"STSong", L"Arial Unicode MS", 0, 936},
- {0xdaa6842d, L"STZhongsong", L"STFangsong,Songti SC,STSong", 0, 936},
- {0xdaaab93f, L"STFangsong", L"Songti SC,Arial Unicode MS", 0, 936},
- {0xdaeb0713, L"STSong", L"Songti SC,Arial Unicode MS", 0, 936},
- {0xdafedbef, L"STCaiyun", L"Kaiti SC,Songti SC,STHeiti", 0, 936},
- {0xdb00a3d9, L"Broadway",
- L"Papyrus,STIXNonUnicode,Arial Black,Avenir Next Heavy,Heiti TC", 0, 1252},
- {0xdb1f5ad4, L"STXinwei", L"Kaiti SC,Songti SC,STHeiti", 0, 936},
- {0xdb326e7f, L"STKaiti", L"Songti SC,Arial Unicode MS", 0, 936},
- {0xdb69595a, L"STHupo", L"Kaiti SC,Songti SC,STHeiti", 0, 936},
- {0xdba0082c, L"STXihei", L"Songti SC,Arial Unicode MS", 0, 936},
- {0xdbd0ab18, L"STXingkai", L"Kaiti SC,Songti SC", 0, 936},
- {0xdc1a7db1, L"STLiti", L"Kaiti SC,Songti SC", 0, 936},
- {0xdc33075f, L"KristenITC-Regular",
- L"STIXNonUnicode,Damascus,Songti SC,STSong", 8, 1252},
- {0xdcc7009c, L"Harrington",
- L"STIXNonUnicode,Avenir Next Condensed Heavy,Noteworthy", 0, 1252},
- {0xdd712466, L"ArialBlack", L"Geeza Pro,Damascus,Songti SC,STSong", 0,
- 1252},
- {0xdde87b3e, L"Impact", L"Arial Narrow,Marion", 0, 1252},
- {0xdf69fb32, L"SnapITC",
- L"Arial Narrow,PT Sans Narrow,Marion,STHeiti,Arial Black", 0, 1252},
- {0xdf8b25e8, L"CenturyGothic",
- L"Damascus,Andale Mono,Songti SC,Arial Unicode MS", 0, 1252},
- {0xe0f705c0, L"KristenITC", L"Songti SC,STSong", 8, 1252},
- {0xe1427573, L"Raavi",
- L"Damascus,STIXNonUnicode,Marion,Papyrus,Avenir Next Condensed "
- L"Heavy,American Typewriter",
- 0, 1252},
- {0xe2cea0cb, L"Magneto",
- L"STIXNonUnicode,Damascus,Geeza Pro,Lucida Grande,Georgia,Heiti TC", 0,
- 1252},
- {0xe36a9e17, L"Ravie", L"STHeiti,Arial Black", 0, 1252},
- {0xe433f8e2, L"Parchment", L"Microsoft Sans Serif,Apple Symbols", 8, 1252},
- {0xe43dff4a, L"Wingdings", L"Microsoft Sans Serif,Apple Symbols", 4, 42},
- {0xe4e2c405, L"MTExtra", L"Microsoft Sans Serif,Apple Symbols", 6, 42},
- {0xe618cc35, L"InformalRoman", L"Arial Narrow", 8, 1252},
- {0xe6c27ffc, L"Mistral", L"Apple Symbols", 8, 1252},
- {0xe7ebf4b9, L"Courier", L"Courier New", 0, 1252},
- {0xe8bc4a9d, L"MSReferenceSpecialty", L"Microsoft Sans Serif,Apple Symbols",
- 0, 1252},
- {0xe90fb013, L"TempusSansITC",
- L"STIXNonUnicode,Microsoft Sans Serif,Avenir Light", 0, 1252},
- {0xec637b42, L"Consolas",
- L"AR PL UKai CN,AR PL UKai HK,AR PL UKai TW,AR PL UKai TW MBE,AR PL UMing "
- L"CN,AR PL UMing HK,Microsoft Sans Serif,Tahoma",
- 1, 1252},
- {0xed3a683b, L"STXinwei", L"Kaiti SC,Songti SC,", 0, 936},
- {0xef264cd1, L"LucidaHandwriting",
- L"Arial Narrow,Avenir Next Condensed Demi Bold,Avenir Next "
- L"Condensed,Avenir Next Condensed Medium,STHeiti,Arial Black",
- 0, 1252},
- {0xf086bca2, L"BaskervilleOldFace",
- L"STIXNonUnicode,Avenir Next Condensed Heavy,PT Sans", 0, 1252},
- {0xf1028030, L"Mangal",
- L"Arial Unicode MS,Microsoft Sans Serif,Arial Narrow,Tahoma", 2, 1252},
- {0xf1da7eb9, L"ShowcardGothic",
- L"Papyrus,Arial Unicode MS,Georgia,American Typewriter", 0, 1252},
- {0xf210f06a, L"ArialMT",
- L"Arial Unicode MS,Arial Narrow,STIXNonUnicode,Damascus,Avenir Next "
- L"Condensed Demi Bold,Avenir Next Condensed Medium,Avenir Next Condensed",
- 0, 1252},
- {0xf477f16a, L"Latha",
- L"Arial Narrow,Damascus,STIXNonUnicode,American Typewriter", 0, 1252},
- {0xf616f3dd, L"LiSu", L"STHeiti,Heiti TC,STFangsong", 1, 936},
- {0xfa479aa6, L"MicrosoftYaHei", L"Arial Unicode MS", 0, 936},
- {0xfcd19697, L"BookmanOldStyle",
- L"Geeza Pro,Damascus,Andale Mono,Songti SC,Arial Unicode MS", 0, 1252},
- {0xfe209a82, L"LucidaCalligraphy",
- L"Kokonor,Damascus,STIXNonUnicode,STHeiti,Arial Black", 0, 1252},
- {0xfef135f8, L"AdobeHeitiStd-Regular", L"Heiti TC,STHeiti", 0, 936},
-};
-#elif _FXM_PLATFORM_ == _FXM_PLATFORM_ANDROID_
-const XFA_FONTINFO g_XFAFontsMap[] = {
- {0x01d5d33e, L"SimSun", L"Droid Sans Fallback", 0, 936},
- {0x01e4f102, L"YouYuan", L"Droid Sans Fallback", 1, 936},
- {0x030549dc, L"LiSu", L"Droid Sans Fallback", 1, 936},
- {0x032edd44, L"Simhei", L"Droid Sans Fallback", 1, 936},
- {0x03eac6fc, L"PoorRichard-Regular",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback,Droid Arabic "
- L"Naskh,Droid Sans Ethiopic",
- 2, 1252},
- {0x03ed90e6, L"Nina",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x077b56b3, L"KingsoftPhoneticPlain",
- L"Droid Sans Thai,Droid Sans Armenian,Droid Arabic Naskh,Droid Sans "
- L"Ethiopic,Droid Sans Fallback",
- 0, 1252},
- {0x078ed524, L"MicrosoftSansSerif", L"Droid Sans Fallback", 0, 1252},
- {0x089b18a9, L"Arial", L"Droid Sans Fallback", 0, 1252},
- {0x0b2cad72, L"MonotypeCorsiva",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 8, 1252},
- {0x0bb003e7, L"Kartika",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,Roboto,Droid Serif,Droid Sans "
- L"Mono",
- 2, 1252},
- {0x0bb469df, L"VinerHandITC",
- L"Droid Serif,Roboto,Droid Sans Mono,Droid Sans Fallback", 8, 1252},
- {0x0bc1a851, L"SegoeUI", L"Droid Sans Fallback", 0, 1252},
- {0x0c112ebd, L"KozukaGothicPro-VIM",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x0cfcb9c1, L"AdobeThai",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 847},
- {0x0e7de0f9, L"Playbill",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,Roboto,Droid Serif,Droid Sans "
- L"Mono",
- 0, 1252},
- {0x0eff47c3, L"STHupo", L"Droid Sans Fallback", 0, 936},
- {0x107ad374, L"Constantia",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 2, 1252},
- {0x12194c2d, L"KunstlerScript",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 8, 1252},
- {0x135ef6a1, L"MinionProSmBd",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x158c4049, L"Garamond",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 2, 1252},
- {0x160ecb24, L"STZhongsong", L"Droid Sans Fallback", 0, 936},
- {0x161ed07e, L"MSGothic", L"Droid Sans Fallback", 1, 1252},
- {0x171d1ed1, L"SnapITC-Regular",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x18d1188f, L"Cambria", L"Droid Sans Fallback", 2, 1252},
- {0x18eaf350, L"ArialUnicodeMS", L"Droid Sans Fallback", 0, 936},
- {0x1a92d115, L"MingLiU", L"Droid Sans Fallback", 1, 1252},
- {0x1cc217c6, L"TrebuchetMS",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x1d649596, L"BasemicTimes",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x1e34ee60, L"BellMT",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 2, 1252},
- {0x1eb36945, L"CooperBlack",
- L"Droid Serif,Roboto,Droid Sans Mono,Droid Sans Fallback", 2, 1252},
- {0x1ef7787d, L"BatangChe", L"Droid Sans Fallback", 1, 1252},
- {0x20b3bd3a, L"BrushScriptMT", L"Droid Arabic Naskh,Droid Sans Ethiopic", 8,
- 1252},
- {0x220877aa, L"Candara",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x22135007, L"FreestyleScript-Regular",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 8, 1252},
- {0x251059c3, L"Chiller",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,Roboto,Droid Serif", 0, 1252},
- {0x25bed6dd, L"MSReferenceSansSerif", L"Droid Sans Fallback", 0, 1252},
- {0x28154c81, L"Parchment-Regular",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 8, 1252},
- {0x29711eb9, L"STLiti", L"Droid Sans Fallback", 0, 936},
- {0x2b1993b4, L"Basemic",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x2b316339, L"NiagaraSolid-Reg",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x2c147529, L"FootlightMTLight",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x2c198928, L"HarlowSolid",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x2c6ac6b2, L"LucidaBright",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,Droid Serif,Roboto", 2, 1252},
- {0x2c9f38e2, L"KozukaMinchoPro-VIR",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x2d5a47b0, L"STCaiyun", L"Droid Sans Fallback", 0, 936},
- {0x2def26bf, L"BernardMT-Condensed",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x2fd8930b, L"KozukaMinchoPr6NR",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x3115525a, L"FangSong_GB2312", L"Droid Sans Fallback", 0, 1252},
- {0x31327817, L"MyriadPro",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x32244975, L"Helvetica",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,Droid Serif,Roboto", 0, 1252},
- {0x32ac995c, L"Terminal",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x338d648a, L"NiagaraEngraved-Reg",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x33bb65f2, L"Sylfaen",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 2, 1252},
- {0x3402c30e, L"MSPMincho", L"Droid Sans Fallback", 2, 1252},
- {0x3412bf31, L"SimSun-PUA", L"Droid Sans Fallback", 0, 936},
- {0x36eb39b9, L"BerlinSansFB",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x36f42055, L"UniversATT", L"Microsoft Sans Serif", 0, 1252},
- {0x3864c4f6, L"HighTowerText",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 2, 1252},
- {0x3a257d03, L"FangSong_GB2312", L"Droid Sans Fallback", 0, 1252},
- {0x3cdae668, L"FreestyleScript",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 8, 1252},
- {0x3d55aed7, L"Jokerman",
- L"Droid Serif,Roboto,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x3d5b4385, L"PMingLiU", L"Droid Sans Fallback", 2, 1252},
- {0x3d9b7669, L"EstrangeloEdessa",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x3e532d74, L"FranklinGothicMedium",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x3e6aa32d, L"NSimSun", L"Droid Sans Fallback", 1, 936},
- {0x3f6c36a8, L"Gautami",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,Roboto,Droid Serif,Droid Sans "
- L"Mono,Droid Sans Fallback",
- 0, 1252},
- {0x3ff32662, L"Chiller-Regular",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x409de312, L"ModernNo.20",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 2, 1252},
- {0x41443c5e, L"Georgia",
- L"Droid Serif,Roboto,Droid Sans Mono,Droid Sans Fallback", 2, 1252},
- {0x4160ade5, L"BellGothicStdBlack",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x421976c4, L"Modern-Regular",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 2, 1252},
- {0x422a7252, L"Stencil",
- L"Droid Serif,Roboto,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x42c8554f, L"Fixedsys",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x435cb41d, L"Roman",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x47882383, L"CourierNew", L"Droid Sans Fallback", 1, 1252},
- {0x480a2338, L"BerlinSansFBDemi",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x480bf7a4, L"CourierStd", L"Droid Sans Fallback", 0, 1252},
- {0x481ad6ed, L"VladimirScript",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 8, 1252},
- {0x4911577a, L"YouYuan", L"Droid Sans Fallback", 1, 936},
- {0x4a788d72, L"STXingkai", L"Droid Sans Fallback", 0, 936},
- {0x4bf88566, L"SegoeCondensed",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x4ccf51a4, L"BerlinSansFB-Reg",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x4ea967ce, L"GulimChe", L"Droid Sans Fallback", 1, 1252},
- {0x4f68bd79, L"LetterGothicStd",
- L"Droid Sans Mono,Droid Arabic Naskh,Droid Sans Ethiopic,Droid Sans "
- L"Mono,Droid Serif,Droid Sans Fallback",
- 0, 1252},
- {0x51a0d0e6, L"KozukaGothicPr6NM",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x531b3dea, L"BasemicSymbol",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x5333fd39, L"CalifornianFB-Reg",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 2, 1252},
- {0x53561a54, L"FZYTK--GBK1-0", L"Droid Sans Fallback", 0, 936},
- {0x55e0dde6, L"LucidaSansTypewriter",
- L"Droid Sans Mono,Droid Arabic Naskh,Droid Sans Ethiopic", 0, 1252},
- {0x574d4d3d, L"AdobeArabic",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x5792e759, L"STKaiti", L"Droid Sans Fallback", 0, 936},
- {0x5921978e, L"LucidaSansUnicode", L"Droid Sans Fallback", 0, 1252},
- {0x594e2da4, L"Vrinda",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,Roboto,Droid Serif,Droid Sans "
- L"Mono",
- 0, 1252},
- {0x59baa9a2, L"KaiTi_GB2312", L"Droid Sans Fallback", 0, 1252},
- {0x5cfedf4f, L"BaskOldFace",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x5f97921c, L"AdobeMyungjoStdM", L"Droid Sans Fallback", 0, 936},
- {0x5fefbfad, L"Batang", L"Droid Sans Fallback", 2, 1252},
- {0x605342b9, L"DotumChe", L"Droid Sans Fallback", 1, 1252},
- {0x608c5f9a, L"KaiTi_GB2312", L"Droid Sans Fallback", 0, 936},
- {0x61efd0d1, L"MaturaMTScriptCapitals",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,Droid Serif,Roboto,Droid Sans "
- L"Mono",
- 0, 1252},
- {0x626608a9, L"MVBoli",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,Droid Serif,Roboto,Droid Sans "
- L"Mono",
- 0, 1252},
- {0x630501a3, L"SmallFonts",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x65d0e2a9, L"FZYTK--GBK1-0", L"Droid Sans Fallback", 0, 936},
- {0x669f29e1, L"FZSTK--GBK1-0", L"Droid Sans Fallback", 0, 936},
- {0x673a9e5f, L"Tunga",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,Roboto,Droid Serif,Droid Sans "
- L"Mono,Droid Sans Fallback",
- 0, 1252},
- {0x691aa4ce, L"NiagaraSolid",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x696259b7, L"Corbel",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x696ee9be, L"STXihei", L"Droid Sans Fallback", 0, 936},
- {0x6c59cf69, L"Dotum", L"Droid Sans Fallback", 0, 1252},
- {0x707fa561, L"Gungsuh", L"Droid Sans Fallback", 2, 1252},
- {0x71416bb2, L"ZWAdobeF",
- L"Droid Arabic Naskh,Droid Sans Armenian,Droid Sans Ethiopic,Droid Sans "
- L"Georgian,Droid Sans Hebrew,Droid Sans Thai",
- 0, 1252},
- {0x71b41801, L"Verdana",
- L"Droid Serif,Roboto,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x73f25e4c, L"PalatinoLinotype", L"Droid Sans Fallback", 0, 1252},
- {0x73f4d19f, L"NiagaraEngraved",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x74001694, L"MyriadProBlack", L"Book Antiqua,Constantia,Dotum,Georgia", 0,
- 1252},
- {0x74b14d8f, L"Haettenschweiler",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x74cb44ee, L"NSimSun", L"Droid Sans Fallback", 1, 936},
- {0x76b4d7ff, L"Shruti",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,Roboto,Droid Serif,Droid Sans "
- L"Mono",
- 0, 1252},
- {0x788b3533, L"Webdings",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 6, 42},
- {0x797dde99, L"MSSerif",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x7a0f9e9e, L"MSMincho", L"Droid Sans Fallback", 1, 1252},
- {0x7b439caf, L"OldEnglishTextMT",
- L"Droid Serif,Roboto,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x8213a433, L"LucidaSans-Typewriter",
- L"Droid Sans Mono,Droid Serif,Roboto,Droid Sans Fallback", 0, 1252},
- {0x82fec929, L"AdobeSongStdL", L"Droid Sans Fallback", 0, 936},
- {0x83581825, L"Modern",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x835a2823, L"Algerian",
- L"Droid Serif,Roboto,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x83dab9f5, L"Script",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x847b56da, L"Tahoma", L"Droid Sans Fallback", 0, 1252},
- {0x8a783cb2, L"SimSun-PUA", L"Droid Sans Fallback", 0, 1252},
- {0x8b5cac0e, L"Onyx",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x8c6a499e, L"Gulim", L"Droid Sans Fallback", 0, 1252},
- {0x8e0af790, L"JuiceITC",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x8e8d43b2, L"Centaur",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 2, 1252},
- {0x8ee4dcca, L"BookshelfSymbol7",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x90794800, L"BellGothicStdLight",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x909b516a, L"Century",
- L"Droid Serif,Roboto,Droid Sans Mono,Droid Sans Fallback", 2, 1252},
- {0x92ae370d, L"MSOutlook",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 4, 42},
- {0x93c9fbf1, L"LucidaFax",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,Droid Serif,Roboto,Droid Sans "
- L"Mono",
- 2, 1252},
- {0x9565085e, L"BookAntiqua",
- L"Droid Serif,Roboto,Droid Sans Mono,Droid Sans Fallback", 2, 1252},
- {0x9856d95d, L"AdobeMingStdL", L"Droid Sans Fallback", 0, 949},
- {0x9bbadd6b, L"ColonnaMT",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0x9cbd16a4, L"ShowcardGothic-Reg",
- L"Droid Serif,Roboto,Droid Sans Mono,Droid Sans Fallbac", 0, 1252},
- {0x9d73008e, L"MSSansSerif",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0xa0607db1, L"GungsuhChe", L"Droid Sans Fallback", 1, 1252},
- {0xa0bcf6a1, L"LatinWide",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 2, 1252},
- {0xa1429b36, L"Symbol",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 6, 42},
- {0xa1fa5abc, L"Wingdings2",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 6, 42},
- {0xa1fa5abd, L"Wingdings3",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 6, 42},
- {0xa427bad4, L"InformalRoman-Regular",
- L"Droid Arabic Naskh,Droid Sans Ethiopic", 8, 1252},
- {0xa8b92ece, L"FZSTK--GBK1-0", L"Droid Sans Fallback", 0, 936},
- {0xa8d83ece, L"CalifornianFB",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 2, 1252},
- {0xaa3e082c, L"Kingsoft-Phonetic",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0xaa6bcabe, L"HarlowSolidItalic",
- L"Droid Serif,Roboto,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0xade5337c, L"MSUIGothic",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0xb08dd941, L"WideLatin",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,Droid Serif,Roboto,Droid Sans "
- L"Mono",
- 2, 1252},
- {0xb207f05d, L"PoorRichard",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 2, 1252},
- {0xb3bc492f, L"JuiceITC-Regular",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0xb5545399, L"Marlett",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 4, 42},
- {0xb5dd1ebb, L"BritannicBold", L"Droid Arabic Naskh,Droid Sans Ethiopic", 0,
- 1252},
- {0xb699c1c5, L"LucidaCalligraphy-Italic",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0xb725d629, L"TimesNewRoman", L"Droid Sans Fallback", 2, 1252},
- {0xb7eaebeb, L"AdobeHeitiStdR", L"Droid Sans Fallback", 0, 936},
- {0xbd29c486, L"BerlinSansFBDemi-Bold",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0xbe8a8db4, L"BookshelfSymbolSeven",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0xc16c0118, L"AdobeHebrew",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback,Droid Arabic "
- L"Naskh,Droid Sans Ethiopic",
- 0, 1252},
- {0xc318b0af, L"MyriadProLight",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0xc65e5659, L"CambriaMath", L"Droid Sans Fallback", 2, 1252},
- {0xc75c8f05, L"LucidaConsole",
- L"Droid Sans Mono,Droid Serif,Roboto,Droid Sans Fallback", 1, 1252},
- {0xca7c35d6, L"Calibri", L"Droid Sans Fallback", 0, 1252},
- {0xcb053f53, L"MicrosoftYaHei", L"Droid Sans Fallback", 0, 936},
- {0xcb7190f9, L"Magneto-Bold",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0xcca00cc5, L"System",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0xccad6f76, L"Jokerman-Regular",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0xccc5818c, L"EuroSign",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0xcf3d7234, L"LucidaHandwriting-Italic",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0xcf7b8fdb, L"MinionPro",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0xcfe5755f, L"Simhei", L"Droid Sans Fallback", 1, 936},
- {0xd011f4ee, L"MSPGothic", L"Droid Sans Fallback", 0, 1252},
- {0xd060e7ef, L"Vivaldi",
- L"Droid Serif,Roboto,Droid Sans Mono,Droid Sans Fallback", 8, 1252},
- {0xd07edec1, L"FranklinGothic-Medium",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0xd107243f, L"SimSun", L"Droid Sans Fallback", 0, 936},
- {0xd1881562, L"ArialNarrow",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0xd22b7dce, L"BodoniMTPosterCompressed",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0xd22bfa60, L"ComicSansMS", L"Droid Serif,Roboto,Droid Sans Fallback", 8,
- 1252},
- {0xd3bd0e35, L"Bauhaus93",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0xd429ee7a, L"STFangsong", L"Droid Sans Fallback", 0, 936},
- {0xd6679c12, L"BernardMTCondensed",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0xd8e8a027, L"LucidaSans",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,Droid Serif,Roboto", 0, 1252},
- {0xd9fe7761, L"HighTowerText-Reg",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 2, 1252},
- {0xda7e551e, L"STSong", L"Droid Sans Fallback", 0, 936},
- {0xdaa6842d, L"STZhongsong", L"Droid Sans Fallback", 0, 936},
- {0xdaaab93f, L"STFangsong", L"Droid Sans Fallback", 0, 936},
- {0xdaeb0713, L"STSong",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 936},
- {0xdafedbef, L"STCaiyun", L"Droid Sans Fallback", 0, 936},
- {0xdb00a3d9, L"Broadway",
- L"Droid Serif,Roboto,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0xdb1f5ad4, L"STXinwei", L"Droid Sans Fallback", 0, 936},
- {0xdb326e7f, L"STKaiti", L"Droid Sans Fallback", 0, 936},
- {0xdb69595a, L"STHupo", L"Droid Sans Fallback", 0, 936},
- {0xdba0082c, L"STXihei", L"Droid Sans Fallback", 0, 936},
- {0xdbd0ab18, L"STXingkai", L"Droid Sans Fallback", 0, 936},
- {0xdc1a7db1, L"STLiti", L"Droid Sans Fallback", 0, 936},
- {0xdc33075f, L"KristenITC-Regular",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,Droid Serif,Roboto", 8, 1252},
- {0xdcc7009c, L"Harrington",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0xdd712466, L"ArialBlack",
- L"Droid Serif,Roboto,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0xdde87b3e, L"Impact",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0xdf69fb32, L"SnapITC",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,Droid Serif,Roboto,Droid Sans "
- L"Mono",
- 0, 1252},
- {0xdf8b25e8, L"CenturyGothic",
- L"Droid Serif,Roboto,Droid Serif,Droid Sans Mono", 0, 1252},
- {0xe0f705c0, L"KristenITC",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,Droid Serif,Roboto", 8, 1252},
- {0xe1427573, L"Raavi",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,Roboto,Droid Serif,Droid Sans "
- L"Mono",
- 0, 1252},
- {0xe2cea0cb, L"Magneto",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,Droid Serif,Roboto,Droid Sans "
- L"Mono",
- 0, 1252},
- {0xe36a9e17, L"Ravie",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,Roboto,Droid Serif,Droid Sans "
- L"Mono",
- 0, 1252},
- {0xe433f8e2, L"Parchment",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 8, 1252},
- {0xe43dff4a, L"Wingdings",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 4, 42},
- {0xe4e2c405, L"MTExtra",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 6, 42},
- {0xe618cc35, L"InformalRoman",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,Roboto,Droid Serif", 8, 1252},
- {0xe6c27ffc, L"Mistral",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 8, 1252},
- {0xe7ebf4b9, L"Courier", L"Droid Sans Fallback", 0, 1252},
- {0xe8bc4a9d, L"MSReferenceSpecialty",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0xe90fb013, L"TempusSansITC",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0xec637b42, L"Consolas", L"Droid Sans Fallback", 1, 1252},
- {0xed3a683b, L"STXinwei", L"Droid Sans Fallback", 0, 936},
- {0xef264cd1, L"LucidaHandwriting",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,Droid Serif,Roboto,Droid Sans "
- L"Mono",
- 0, 1252},
- {0xf086bca2, L"BaskervilleOldFace",
- L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0xf1028030, L"Mangal",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,Droid Serif,Roboto,Droid Sans "
- L"Mono",
- 2, 1252},
- {0xf1da7eb9, L"ShowcardGothic",
- L"Droid Serif,Roboto,Droid Sans Mono,Droid Sans Fallbac", 0, 1252},
- {0xf210f06a, L"ArialMT",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,Roboto,Droid Serif", 0, 1252},
- {0xf477f16a, L"Latha",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,Roboto,Droid Serif,Droid Sans "
- L"Mono",
- 0, 1252},
- {0xf616f3dd, L"LiSu", L"Droid Sans Fallback", 1, 936},
- {0xfa479aa6, L"MicrosoftYaHei", L"Droid Sans Fallback", 0, 936},
- {0xfcd19697, L"BookmanOldStyle",
- L"Droid Serif,Roboto,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
- {0xfe209a82, L"LucidaCalligraphy",
- L"Droid Arabic Naskh,Droid Sans Ethiopic,Droid Serif,Roboto,Droid Sans "
- L"Mono",
- 0, 1252},
- {0xfef135f8, L"AdobeHeitiStd-Regular", L"Droid Sans Fallback", 0, 936},
-};
-#endif
-
-CFX_WideString XFA_LocalFontNameToEnglishName(
- const CFX_WideStringC& wsLocalName) {
- uint32_t dwLocalNameHash = FX_HashCode_GetW(wsLocalName, true);
- const XFA_FONTINFO* pEnd = g_XFAFontsMap + FX_ArraySize(g_XFAFontsMap);
- const XFA_FONTINFO* pFontInfo =
- std::lower_bound(g_XFAFontsMap, pEnd, dwLocalNameHash,
- [](const XFA_FONTINFO& entry, uint32_t hash) {
- return entry.dwFontNameHash < hash;
- });
- if (pFontInfo < pEnd && pFontInfo->dwFontNameHash == dwLocalNameHash)
- return pFontInfo->pPsName;
- return CFX_WideString(wsLocalName);
-}
-
-const XFA_FONTINFO* XFA_GetFontINFOByFontName(
- const CFX_WideStringC& wsFontName) {
- CFX_WideString wsFontNameTemp(wsFontName);
- wsFontNameTemp.Remove(L' ');
- uint32_t dwCurFontNameHash =
- FX_HashCode_GetW(wsFontNameTemp.AsStringC(), true);
- const XFA_FONTINFO* pEnd = g_XFAFontsMap + FX_ArraySize(g_XFAFontsMap);
- const XFA_FONTINFO* pFontInfo =
- std::lower_bound(g_XFAFontsMap, pEnd, dwCurFontNameHash,
- [](const XFA_FONTINFO& entry, uint32_t hash) {
- return entry.dwFontNameHash < hash;
- });
- if (pFontInfo < pEnd && pFontInfo->dwFontNameHash == dwCurFontNameHash)
- return pFontInfo;
- return nullptr;
-}
-
-} // namespace
-
-CXFA_DefFontMgr::CXFA_DefFontMgr() {}
-
-CXFA_DefFontMgr::~CXFA_DefFontMgr() {}
-
-CFX_RetainPtr<CFGAS_GEFont> CXFA_DefFontMgr::GetFont(
- CXFA_FFDoc* hDoc,
- const CFX_WideStringC& wsFontFamily,
- uint32_t dwFontStyles,
- uint16_t wCodePage) {
- CFX_WideString wsFontName(wsFontFamily);
- CFGAS_FontMgr* pFDEFontMgr = hDoc->GetApp()->GetFDEFontMgr();
- CFX_RetainPtr<CFGAS_GEFont> pFont =
- pFDEFontMgr->LoadFont(wsFontName.c_str(), dwFontStyles, wCodePage);
- if (!pFont) {
- const XFA_FONTINFO* pCurFont =
- XFA_GetFontINFOByFontName(wsFontName.AsStringC());
- if (pCurFont && pCurFont->pReplaceFont) {
- uint32_t dwStyle = 0;
- if (dwFontStyles & FX_FONTSTYLE_Bold) {
- dwStyle |= FX_FONTSTYLE_Bold;
- }
- if (dwFontStyles & FX_FONTSTYLE_Italic) {
- dwStyle |= FX_FONTSTYLE_Italic;
- }
- const FX_WCHAR* pReplace = pCurFont->pReplaceFont;
- int32_t iLength = FXSYS_wcslen(pReplace);
- while (iLength > 0) {
- const FX_WCHAR* pNameText = pReplace;
- while (*pNameText != L',' && iLength > 0) {
- pNameText++;
- iLength--;
- }
- CFX_WideString wsReplace =
- CFX_WideString(pReplace, pNameText - pReplace);
- pFont = pFDEFontMgr->LoadFont(wsReplace.c_str(), dwStyle, wCodePage);
- if (pFont)
- break;
-
- iLength--;
- pNameText++;
- pReplace = pNameText;
- }
- }
- }
- if (pFont)
- m_CacheFonts.push_back(pFont);
- return pFont;
-}
-
-CFX_RetainPtr<CFGAS_GEFont> CXFA_DefFontMgr::GetDefaultFont(
- CXFA_FFDoc* hDoc,
- const CFX_WideStringC& wsFontFamily,
- uint32_t dwFontStyles,
- uint16_t wCodePage) {
- CFGAS_FontMgr* pFDEFontMgr = hDoc->GetApp()->GetFDEFontMgr();
- CFX_RetainPtr<CFGAS_GEFont> pFont =
- pFDEFontMgr->LoadFont(L"Arial Narrow", dwFontStyles, wCodePage);
- if (!pFont) {
- pFont = pFDEFontMgr->LoadFont(static_cast<const FX_WCHAR*>(nullptr),
- dwFontStyles, wCodePage);
- }
- if (pFont)
- m_CacheFonts.push_back(pFont);
- return pFont;
-}
-
-CXFA_PDFFontMgr::CXFA_PDFFontMgr(CXFA_FFDoc* pDoc) : m_pDoc(pDoc) {}
-
-CXFA_PDFFontMgr::~CXFA_PDFFontMgr() {}
-
-CFX_RetainPtr<CFGAS_GEFont> CXFA_PDFFontMgr::FindFont(
- const CFX_ByteString& strPsName,
- bool bBold,
- bool bItalic,
- CPDF_Font** pDstPDFFont,
- bool bStrictMatch) {
- CPDF_Document* pDoc = m_pDoc->GetPDFDoc();
- if (!pDoc)
- return nullptr;
-
- CPDF_Dictionary* pFontSetDict =
- pDoc->GetRoot()->GetDictFor("AcroForm")->GetDictFor("DR");
- if (!pFontSetDict)
- return nullptr;
-
- pFontSetDict = pFontSetDict->GetDictFor("Font");
- if (!pFontSetDict)
- return nullptr;
-
- CFX_ByteString name = strPsName;
- name.Remove(' ');
- CFGAS_FontMgr* pFDEFontMgr = m_pDoc->GetApp()->GetFDEFontMgr();
- for (const auto& it : *pFontSetDict) {
- const CFX_ByteString& key = it.first;
- CPDF_Object* pObj = it.second.get();
- if (!PsNameMatchDRFontName(name.AsStringC(), bBold, bItalic, key,
- bStrictMatch)) {
- continue;
- }
- CPDF_Dictionary* pFontDict = ToDictionary(pObj->GetDirect());
- if (!pFontDict || pFontDict->GetStringFor("Type") != "Font") {
- return nullptr;
- }
- CPDF_Font* pPDFFont = pDoc->LoadFont(pFontDict);
- if (!pPDFFont) {
- return nullptr;
- }
- if (!pPDFFont->IsEmbedded()) {
- *pDstPDFFont = pPDFFont;
- return nullptr;
- }
- return CFGAS_GEFont::LoadFont(&pPDFFont->m_Font, pFDEFontMgr);
- }
- return nullptr;
-}
-
-CFX_RetainPtr<CFGAS_GEFont> CXFA_PDFFontMgr::GetFont(
- const CFX_WideStringC& wsFontFamily,
- uint32_t dwFontStyles,
- CPDF_Font** pPDFFont,
- bool bStrictMatch) {
- uint32_t dwHashCode = FX_HashCode_GetW(wsFontFamily, false);
- CFX_ByteString strKey;
- strKey.Format("%u%u", dwHashCode, dwFontStyles);
- auto it = m_FontMap.find(strKey);
- if (it != m_FontMap.end())
- return it->second;
- CFX_ByteString bsPsName =
- CFX_ByteString::FromUnicode(CFX_WideString(wsFontFamily));
- bool bBold = (dwFontStyles & FX_FONTSTYLE_Bold) == FX_FONTSTYLE_Bold;
- bool bItalic = (dwFontStyles & FX_FONTSTYLE_Italic) == FX_FONTSTYLE_Italic;
- CFX_ByteString strFontName = PsNameToFontName(bsPsName, bBold, bItalic);
- CFX_RetainPtr<CFGAS_GEFont> pFont =
- FindFont(strFontName, bBold, bItalic, pPDFFont, bStrictMatch);
- if (pFont)
- m_FontMap[strKey] = pFont;
- return pFont;
-}
-
-CFX_ByteString CXFA_PDFFontMgr::PsNameToFontName(
- const CFX_ByteString& strPsName,
- bool bBold,
- bool bItalic) {
- for (size_t i = 0; i < FX_ArraySize(g_XFAPDFFontName); ++i) {
- if (strPsName == g_XFAPDFFontName[i][0]) {
- size_t index = 1;
- if (bBold)
- ++index;
- if (bItalic)
- index += 2;
- return g_XFAPDFFontName[i][index];
- }
- }
- return strPsName;
-}
-
-bool CXFA_PDFFontMgr::PsNameMatchDRFontName(const CFX_ByteStringC& bsPsName,
- bool bBold,
- bool bItalic,
- const CFX_ByteString& bsDRFontName,
- bool bStrictMatch) {
- CFX_ByteString bsDRName = bsDRFontName;
- bsDRName.Remove('-');
- int32_t iPsLen = bsPsName.GetLength();
- int32_t nIndex = bsDRName.Find(bsPsName);
- if (nIndex != -1 && !bStrictMatch)
- return true;
-
- if (nIndex != 0)
- return false;
-
- int32_t iDifferLength = bsDRName.GetLength() - iPsLen;
- if (iDifferLength > 1 || (bBold || bItalic)) {
- int32_t iBoldIndex = bsDRName.Find("Bold");
- bool bBoldFont = iBoldIndex > 0;
- if (bBold != bBoldFont)
- return false;
-
- if (bBoldFont) {
- iDifferLength =
- std::min(iDifferLength - 4, bsDRName.GetLength() - iBoldIndex - 4);
- }
- bool bItalicFont = true;
- if (bsDRName.Find("Italic") > 0) {
- iDifferLength -= 6;
- } else if (bsDRName.Find("It") > 0) {
- iDifferLength -= 2;
- } else if (bsDRName.Find("Oblique") > 0) {
- iDifferLength -= 7;
- } else {
- bItalicFont = false;
- }
- if (bItalic != bItalicFont)
- return false;
-
- if (iDifferLength > 1) {
- CFX_ByteString bsDRTailer = bsDRName.Right(iDifferLength);
- if (bsDRTailer == "MT" || bsDRTailer == "PSMT" ||
- bsDRTailer == "Regular" || bsDRTailer == "Reg") {
- return true;
- }
- if (bBoldFont || bItalicFont)
- return false;
-
- bool bMatch = false;
- switch (bsPsName.GetAt(iPsLen - 1)) {
- case 'L': {
- if (bsDRName.Right(5) == "Light") {
- bMatch = true;
- }
- } break;
- case 'R': {
- if (bsDRName.Right(7) == "Regular" || bsDRName.Right(3) == "Reg") {
- bMatch = true;
- }
- } break;
- case 'M': {
- if (bsDRName.Right(5) == "Medium") {
- bMatch = true;
- }
- } break;
- default:
- break;
- }
- return bMatch;
- }
- }
- return true;
-}
-
-bool CXFA_PDFFontMgr::GetCharWidth(const CFX_RetainPtr<CFGAS_GEFont>& pFont,
- FX_WCHAR wUnicode,
- bool bCharCode,
- int32_t* pWidth) {
- if (wUnicode != 0x20 || bCharCode)
- return false;
-
- auto it = m_FDE2PDFFont.find(pFont);
- if (it == m_FDE2PDFFont.end())
- return false;
-
- CPDF_Font* pPDFFont = it->second;
- *pWidth = pPDFFont->GetCharWidthF(pPDFFont->CharCodeFromUnicode(wUnicode));
- return true;
-}
-
-void CXFA_PDFFontMgr::SetFont(const CFX_RetainPtr<CFGAS_GEFont>& pFont,
- CPDF_Font* pPDFFont) {
- m_FDE2PDFFont[pFont] = pPDFFont;
-}
-
-CXFA_FontMgr::CXFA_FontMgr() {}
-
-CXFA_FontMgr::~CXFA_FontMgr() {}
-
-CFX_RetainPtr<CFGAS_GEFont> CXFA_FontMgr::GetFont(
- CXFA_FFDoc* hDoc,
- const CFX_WideStringC& wsFontFamily,
- uint32_t dwFontStyles,
- uint16_t wCodePage) {
- uint32_t dwHash = FX_HashCode_GetW(wsFontFamily, false);
- CFX_ByteString bsKey;
- bsKey.Format("%u%u%u", dwHash, dwFontStyles, wCodePage);
- auto iter = m_FontMap.find(bsKey);
- if (iter != m_FontMap.end())
- return iter->second;
-
- CFX_WideString wsEnglishName = XFA_LocalFontNameToEnglishName(wsFontFamily);
- auto it = m_PDFFontMgrMap.find(hDoc);
- CXFA_PDFFontMgr* pMgr =
- it != m_PDFFontMgrMap.end() ? it->second.get() : nullptr;
- CPDF_Font* pPDFFont = nullptr;
- CFX_RetainPtr<CFGAS_GEFont> pFont;
- if (pMgr) {
- pFont =
- pMgr->GetFont(wsEnglishName.AsStringC(), dwFontStyles, &pPDFFont, true);
- if (pFont)
- return pFont;
- }
- if (!pFont && m_pDefFontMgr)
- pFont = m_pDefFontMgr->GetFont(hDoc, wsFontFamily, dwFontStyles, wCodePage);
-
- if (!pFont && pMgr) {
- pPDFFont = nullptr;
- pFont = pMgr->GetFont(wsEnglishName.AsStringC(), dwFontStyles, &pPDFFont,
- false);
- if (pFont)
- return pFont;
- }
- if (!pFont && m_pDefFontMgr) {
- pFont = m_pDefFontMgr->GetDefaultFont(hDoc, wsFontFamily, dwFontStyles,
- wCodePage);
- }
- if (pFont) {
- if (pPDFFont) {
- pMgr->SetFont(pFont, pPDFFont);
- pFont->SetFontProvider(pMgr);
- }
- m_FontMap[bsKey] = pFont;
- }
- return pFont;
-}
-
-void CXFA_FontMgr::LoadDocFonts(CXFA_FFDoc* hDoc) {
- if (!m_PDFFontMgrMap[hDoc])
- m_PDFFontMgrMap[hDoc] = pdfium::MakeUnique<CXFA_PDFFontMgr>(hDoc);
-}
-
-void CXFA_FontMgr::ReleaseDocFonts(CXFA_FFDoc* hDoc) {
- m_PDFFontMgrMap.erase(hDoc);
-}
-
-void CXFA_FontMgr::SetDefFontMgr(std::unique_ptr<CXFA_DefFontMgr> pFontMgr) {
- m_pDefFontMgr = std::move(pFontMgr);
-}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fwladapter.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fwladapter.cpp
index e1f3e202ed3..3cf6e5e8fdd 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fwladapter.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fwladapter.cpp
@@ -7,7 +7,7 @@
#include "xfa/fxfa/app/xfa_fwladapter.h"
#include "xfa/fxfa/app/xfa_fffield.h"
-#include "xfa/fxfa/xfa_ffdoc.h"
+#include "xfa/fxfa/cxfa_ffdoc.h"
CXFA_FWLAdapterWidgetMgr::CXFA_FWLAdapterWidgetMgr() {}
@@ -25,8 +25,8 @@ void CXFA_FWLAdapterWidgetMgr::RepaintWidget(CFWL_Widget* pWidget) {
}
bool CXFA_FWLAdapterWidgetMgr::GetPopupPos(CFWL_Widget* pWidget,
- FX_FLOAT fMinHeight,
- FX_FLOAT fMaxHeight,
+ float fMinHeight,
+ float fMaxHeight,
const CFX_RectF& rtAnchor,
CFX_RectF& rtPopup) {
CXFA_FFWidget* pFFWidget = pWidget->GetLayoutItem();
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fwladapter.h b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fwladapter.h
index c68fb7015f2..b4a34815885 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fwladapter.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fwladapter.h
@@ -19,8 +19,8 @@ class CXFA_FWLAdapterWidgetMgr {
void RepaintWidget(CFWL_Widget* pWidget);
bool GetPopupPos(CFWL_Widget* pWidget,
- FX_FLOAT fMinHeight,
- FX_FLOAT fMaxHeight,
+ float fMinHeight,
+ float fMaxHeight,
const CFX_RectF& rtAnchor,
CFX_RectF& rtPopup);
};
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fwltheme.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fwltheme.cpp
index 73abaecbc89..629cd509e83 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fwltheme.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fwltheme.cpp
@@ -6,7 +6,7 @@
#include "xfa/fxfa/app/xfa_fwltheme.h"
-#include "xfa/fde/tto/fde_textout.h"
+#include "xfa/fde/cfde_textout.h"
#include "xfa/fgas/crt/fgas_codepage.h"
#include "xfa/fgas/font/cfgas_gefont.h"
#include "xfa/fwl/cfwl_barcode.h"
@@ -22,13 +22,13 @@
#include "xfa/fwl/cfwl_scrollbar.h"
#include "xfa/fwl/cfwl_themebackground.h"
#include "xfa/fwl/cfwl_themetext.h"
-#include "xfa/fxfa/xfa_ffapp.h"
-#include "xfa/fxfa/xfa_ffwidget.h"
+#include "xfa/fxfa/cxfa_ffapp.h"
+#include "xfa/fxfa/cxfa_ffwidget.h"
#include "xfa/fxgraphics/cfx_color.h"
namespace {
-const FX_WCHAR* const g_FWLTheme_CalFonts[] = {
+const wchar_t* const g_FWLTheme_CalFonts[] = {
L"Arial", L"Courier New", L"DejaVu Sans",
};
@@ -44,18 +44,18 @@ CXFA_FFWidget* XFA_ThemeGetOuterWidget(CFWL_Widget* pWidget) {
}
CXFA_FWLTheme::CXFA_FWLTheme(CXFA_FFApp* pApp)
- : m_pCheckBoxTP(new CFWL_CheckBoxTP),
- m_pListBoxTP(new CFWL_ListBoxTP),
- m_pPictureBoxTP(new CFWL_PictureBoxTP),
- m_pSrollBarTP(new CFWL_ScrollBarTP),
- m_pEditTP(new CFWL_EditTP),
- m_pComboBoxTP(new CFWL_ComboBoxTP),
- m_pMonthCalendarTP(new CFWL_MonthCalendarTP),
- m_pDateTimePickerTP(new CFWL_DateTimePickerTP),
- m_pPushButtonTP(new CFWL_PushButtonTP),
- m_pCaretTP(new CFWL_CaretTP),
- m_pBarcodeTP(new CFWL_BarcodeTP),
- m_pTextOut(new CFDE_TextOut),
+ : m_pCheckBoxTP(pdfium::MakeUnique<CFWL_CheckBoxTP>()),
+ m_pListBoxTP(pdfium::MakeUnique<CFWL_ListBoxTP>()),
+ m_pPictureBoxTP(pdfium::MakeUnique<CFWL_PictureBoxTP>()),
+ m_pSrollBarTP(pdfium::MakeUnique<CFWL_ScrollBarTP>()),
+ m_pEditTP(pdfium::MakeUnique<CFWL_EditTP>()),
+ m_pComboBoxTP(pdfium::MakeUnique<CFWL_ComboBoxTP>()),
+ m_pMonthCalendarTP(pdfium::MakeUnique<CFWL_MonthCalendarTP>()),
+ m_pDateTimePickerTP(pdfium::MakeUnique<CFWL_DateTimePickerTP>()),
+ m_pPushButtonTP(pdfium::MakeUnique<CFWL_PushButtonTP>()),
+ m_pCaretTP(pdfium::MakeUnique<CFWL_CaretTP>()),
+ m_pBarcodeTP(pdfium::MakeUnique<CFWL_BarcodeTP>()),
+ m_pTextOut(pdfium::MakeUnique<CFDE_TextOut>()),
m_pCalendarFont(nullptr),
m_pApp(pApp) {
m_Rect.Reset();
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fwltheme.h b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fwltheme.h
index a8efad0ccff..33ea8e80a52 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fwltheme.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_fwltheme.h
@@ -22,7 +22,7 @@
#include "xfa/fwl/theme/cfwl_pushbuttontp.h"
#include "xfa/fwl/theme/cfwl_scrollbartp.h"
#include "xfa/fwl/theme/cfwl_widgettp.h"
-#include "xfa/fxfa/xfa_ffapp.h"
+#include "xfa/fxfa/cxfa_ffapp.h"
class CXFA_FWLTheme final : public IFWL_ThemeProvider {
public:
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_rendercontext.cpp b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_rendercontext.cpp
deleted file mode 100644
index a855105e3dc..00000000000
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_rendercontext.cpp
+++ /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
-
-#include "xfa/fxfa/xfa_rendercontext.h"
-
-#include "xfa/fxfa/xfa_ffpageview.h"
-#include "xfa/fxfa/xfa_ffwidget.h"
-#include "xfa/fxgraphics/cfx_graphics.h"
-
-namespace {
-
-const int32_t kMaxCount = 30;
-
-} // namsepace
-
-CXFA_RenderContext::CXFA_RenderContext()
- : m_pWidget(nullptr), m_pPageView(nullptr), m_pGS(nullptr), m_dwStatus(0) {
- m_matrix.SetIdentity();
- m_rtClipRect.Reset();
-}
-
-CXFA_RenderContext::~CXFA_RenderContext() {}
-
-int32_t CXFA_RenderContext::StartRender(CXFA_FFPageView* pPageView,
- CFX_Graphics* pGS,
- const CFX_Matrix& matrix,
- const CXFA_RenderOptions& options) {
- m_pPageView = pPageView;
- m_pGS = pGS;
- m_matrix = matrix;
- m_options = options;
-
- CFX_Matrix mtRes;
- mtRes.SetReverse(matrix);
- m_rtClipRect = pGS->GetClipRect();
- mtRes.TransformRect(m_rtClipRect);
- m_dwStatus = m_options.m_bHighlight ? XFA_WidgetStatus_Highlight : 0;
- uint32_t dwFilterType = XFA_WidgetStatus_Visible |
- (m_options.m_bPrint ? XFA_WidgetStatus_Printable
- : XFA_WidgetStatus_Viewable);
- m_pWidgetIterator.reset(
- m_pPageView->CreateWidgetIterator(XFA_TRAVERSEWAY_Form, dwFilterType));
- m_pWidget = m_pWidgetIterator->MoveToNext();
- return XFA_RENDERSTATUS_Ready;
-}
-
-int32_t CXFA_RenderContext::DoRender(IFX_Pause* pPause) {
- int32_t iCount = 0;
- while (m_pWidget) {
- CXFA_FFWidget* pWidget = m_pWidget;
- CFX_RectF rtWidgetBox = pWidget->GetBBox(XFA_WidgetStatus_Visible);
- rtWidgetBox.width += 1;
- rtWidgetBox.height += 1;
- if (rtWidgetBox.IntersectWith(m_rtClipRect))
- pWidget->RenderWidget(m_pGS, &m_matrix, m_dwStatus);
-
- m_pWidget = m_pWidgetIterator->MoveToNext();
- iCount++;
- if (iCount > kMaxCount && pPause && pPause->NeedToPauseNow())
- return XFA_RENDERSTATUS_ToBeContinued;
- }
- return XFA_RENDERSTATUS_Done;
-}
-
-void CXFA_RenderContext::StopRender() {
- m_pWidgetIterator.reset();
-}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_textpiece.h b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_textpiece.h
index 6802df55664..fd1f3bdbaa4 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/app/xfa_textpiece.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/app/xfa_textpiece.h
@@ -32,7 +32,7 @@ class XFA_TextPiece {
int32_t iPeriod;
int32_t iLineThrough;
FX_ARGB dwColor;
- FX_FLOAT fFontSize;
+ float fFontSize;
CFX_RectF rtPiece;
CFX_RetainPtr<CFGAS_GEFont> pFont;
CFX_RetainPtr<CXFA_LinkUserData> pLinkData;
diff --git a/chromium/third_party/pdfium/xfa/fxfa/cxfa_deffontmgr.cpp b/chromium/third_party/pdfium/xfa/fxfa/cxfa_deffontmgr.cpp
new file mode 100644
index 00000000000..db730677b5c
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fxfa/cxfa_deffontmgr.cpp
@@ -0,0 +1,77 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "xfa/fxfa/cxfa_deffontmgr.h"
+
+#include "xfa/fxfa/cxfa_ffapp.h"
+#include "xfa/fxfa/cxfa_ffdoc.h"
+#include "xfa/fxfa/cxfa_fontmgr.h"
+
+CXFA_DefFontMgr::CXFA_DefFontMgr() {}
+
+CXFA_DefFontMgr::~CXFA_DefFontMgr() {}
+
+CFX_RetainPtr<CFGAS_GEFont> CXFA_DefFontMgr::GetFont(
+ CXFA_FFDoc* hDoc,
+ const CFX_WideStringC& wsFontFamily,
+ uint32_t dwFontStyles,
+ uint16_t wCodePage) {
+ CFX_WideString wsFontName(wsFontFamily);
+ CFGAS_FontMgr* pFDEFontMgr = hDoc->GetApp()->GetFDEFontMgr();
+ CFX_RetainPtr<CFGAS_GEFont> pFont =
+ pFDEFontMgr->LoadFont(wsFontName.c_str(), dwFontStyles, wCodePage);
+ if (!pFont) {
+ const XFA_FONTINFO* pCurFont =
+ XFA_GetFontINFOByFontName(wsFontName.AsStringC());
+ if (pCurFont && pCurFont->pReplaceFont) {
+ uint32_t dwStyle = 0;
+ if (dwFontStyles & FX_FONTSTYLE_Bold) {
+ dwStyle |= FX_FONTSTYLE_Bold;
+ }
+ if (dwFontStyles & FX_FONTSTYLE_Italic) {
+ dwStyle |= FX_FONTSTYLE_Italic;
+ }
+ const wchar_t* pReplace = pCurFont->pReplaceFont;
+ int32_t iLength = FXSYS_wcslen(pReplace);
+ while (iLength > 0) {
+ const wchar_t* pNameText = pReplace;
+ while (*pNameText != L',' && iLength > 0) {
+ pNameText++;
+ iLength--;
+ }
+ CFX_WideString wsReplace =
+ CFX_WideString(pReplace, pNameText - pReplace);
+ pFont = pFDEFontMgr->LoadFont(wsReplace.c_str(), dwStyle, wCodePage);
+ if (pFont)
+ break;
+
+ iLength--;
+ pNameText++;
+ pReplace = pNameText;
+ }
+ }
+ }
+ if (pFont)
+ m_CacheFonts.push_back(pFont);
+ return pFont;
+}
+
+CFX_RetainPtr<CFGAS_GEFont> CXFA_DefFontMgr::GetDefaultFont(
+ CXFA_FFDoc* hDoc,
+ const CFX_WideStringC& wsFontFamily,
+ uint32_t dwFontStyles,
+ uint16_t wCodePage) {
+ CFGAS_FontMgr* pFDEFontMgr = hDoc->GetApp()->GetFDEFontMgr();
+ CFX_RetainPtr<CFGAS_GEFont> pFont =
+ pFDEFontMgr->LoadFont(L"Arial Narrow", dwFontStyles, wCodePage);
+ if (!pFont) {
+ pFont = pFDEFontMgr->LoadFont(static_cast<const wchar_t*>(nullptr),
+ dwFontStyles, wCodePage);
+ }
+ if (pFont)
+ m_CacheFonts.push_back(pFont);
+ return pFont;
+}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/cxfa_deffontmgr.h b/chromium/third_party/pdfium/xfa/fxfa/cxfa_deffontmgr.h
new file mode 100644
index 00000000000..5f50ffb08d4
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fxfa/cxfa_deffontmgr.h
@@ -0,0 +1,37 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef XFA_FXFA_CXFA_DEFFONTMGR_H_
+#define XFA_FXFA_CXFA_DEFFONTMGR_H_
+
+#include <vector>
+
+#include "core/fxcrt/cfx_retain_ptr.h"
+#include "core/fxcrt/fx_string.h"
+#include "xfa/fgas/font/cfgas_gefont.h"
+
+class CXFA_FFDoc;
+
+class CXFA_DefFontMgr {
+ public:
+ CXFA_DefFontMgr();
+ ~CXFA_DefFontMgr();
+
+ CFX_RetainPtr<CFGAS_GEFont> GetFont(CXFA_FFDoc* hDoc,
+ const CFX_WideStringC& wsFontFamily,
+ uint32_t dwFontStyles,
+ uint16_t wCodePage = 0xFFFF);
+ CFX_RetainPtr<CFGAS_GEFont> GetDefaultFont(
+ CXFA_FFDoc* hDoc,
+ const CFX_WideStringC& wsFontFamily,
+ uint32_t dwFontStyles,
+ uint16_t wCodePage = 0xFFFF);
+
+ private:
+ std::vector<CFX_RetainPtr<CFGAS_GEFont>> m_CacheFonts;
+};
+
+#endif // XFA_FXFA_CXFA_DEFFONTMGR_H_
diff --git a/chromium/third_party/pdfium/xfa/fxfa/cxfa_eventparam.cpp b/chromium/third_party/pdfium/xfa/fxfa/cxfa_eventparam.cpp
new file mode 100644
index 00000000000..bd6742f4dd9
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fxfa/cxfa_eventparam.cpp
@@ -0,0 +1,46 @@
+// Copyright 2016 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "xfa/fxfa/cxfa_eventparam.h"
+
+#include "xfa/fxfa/fxfa.h"
+
+CXFA_EventParam::CXFA_EventParam()
+ : m_pTarget(nullptr),
+ m_eType(XFA_EVENT_Unknown),
+ m_bCancelAction(false),
+ m_iCommitKey(0),
+ m_bKeyDown(false),
+ m_bModifier(false),
+ m_bReenter(false),
+ m_iSelEnd(0),
+ m_iSelStart(0),
+ m_bShift(false),
+ m_bIsFormReady(false) {}
+
+CXFA_EventParam::~CXFA_EventParam() {}
+
+CXFA_EventParam::CXFA_EventParam(const CXFA_EventParam& other) = default;
+
+void CXFA_EventParam::Reset() {
+ m_wsChange.clear();
+ m_bCancelAction = false;
+ m_iCommitKey = 0;
+ m_wsFullText.clear();
+ m_bKeyDown = false;
+ m_bModifier = false;
+ m_wsNewContentType.clear();
+ m_wsNewText.clear();
+ m_wsPrevContentType.clear();
+ m_wsPrevText.clear();
+ m_bReenter = false;
+ m_iSelEnd = 0;
+ m_iSelStart = 0;
+ m_bShift = false;
+ m_wsSoapFaultCode.clear();
+ m_wsSoapFaultString.clear();
+ m_bIsFormReady = false;
+}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/cxfa_eventparam.h b/chromium/third_party/pdfium/xfa/fxfa/cxfa_eventparam.h
index 3ba7a8b7f27..1e7c12a34a2 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/cxfa_eventparam.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/cxfa_eventparam.h
@@ -73,7 +73,6 @@ class CXFA_EventParam {
CFX_WideString m_wsSoapFaultCode;
CFX_WideString m_wsSoapFaultString;
bool m_bIsFormReady;
- int32_t m_iValidateActivities;
};
#endif // XFA_FXFA_CXFA_EVENTPARAM_H_
diff --git a/chromium/third_party/pdfium/xfa/fxfa/cxfa_ffapp.cpp b/chromium/third_party/pdfium/xfa/fxfa/cxfa_ffapp.cpp
new file mode 100644
index 00000000000..c02fd30e860
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fxfa/cxfa_ffapp.cpp
@@ -0,0 +1,96 @@
+// 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
+
+#include "xfa/fxfa/cxfa_ffapp.h"
+
+#include <algorithm>
+#include <memory>
+#include <utility>
+#include <vector>
+
+#include "third_party/base/ptr_util.h"
+#include "third_party/base/stl_util.h"
+#include "xfa/fgas/font/cfgas_fontmgr.h"
+#include "xfa/fwl/cfwl_notedriver.h"
+#include "xfa/fwl/cfwl_widgetmgr.h"
+#include "xfa/fxfa/app/xfa_fwladapter.h"
+#include "xfa/fxfa/app/xfa_fwltheme.h"
+#include "xfa/fxfa/cxfa_ffdoc.h"
+#include "xfa/fxfa/cxfa_ffdochandler.h"
+#include "xfa/fxfa/cxfa_ffwidgethandler.h"
+#include "xfa/fxfa/cxfa_fontmgr.h"
+
+CXFA_FFApp::CXFA_FFApp(IXFA_AppProvider* pProvider)
+ : m_pProvider(pProvider),
+ m_pWidgetMgrDelegate(nullptr),
+ m_pFWLApp(new CFWL_App(this)) {}
+
+CXFA_FFApp::~CXFA_FFApp() {}
+
+CXFA_FFDocHandler* CXFA_FFApp::GetDocHandler() {
+ if (!m_pDocHandler)
+ m_pDocHandler = pdfium::MakeUnique<CXFA_FFDocHandler>();
+ return m_pDocHandler.get();
+}
+
+std::unique_ptr<CXFA_FFDoc> CXFA_FFApp::CreateDoc(
+ IXFA_DocEnvironment* pDocEnvironment,
+ CPDF_Document* pPDFDoc) {
+ if (!pPDFDoc)
+ return nullptr;
+
+ auto pDoc = pdfium::MakeUnique<CXFA_FFDoc>(this, pDocEnvironment);
+ if (!pDoc->OpenDoc(pPDFDoc))
+ return nullptr;
+
+ return pDoc;
+}
+
+void CXFA_FFApp::SetDefaultFontMgr(std::unique_ptr<CXFA_DefFontMgr> pFontMgr) {
+ if (!m_pFontMgr)
+ m_pFontMgr = pdfium::MakeUnique<CXFA_FontMgr>();
+ m_pFontMgr->SetDefFontMgr(std::move(pFontMgr));
+}
+
+CXFA_FontMgr* CXFA_FFApp::GetXFAFontMgr() const {
+ return m_pFontMgr.get();
+}
+
+CFGAS_FontMgr* CXFA_FFApp::GetFDEFontMgr() {
+ if (!m_pFDEFontMgr) {
+#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
+ m_pFDEFontMgr = CFGAS_FontMgr::Create(FX_GetDefFontEnumerator());
+#else
+ m_pFontSource = pdfium::MakeUnique<CFX_FontSourceEnum_File>();
+ m_pFDEFontMgr = CFGAS_FontMgr::Create(m_pFontSource.get());
+#endif
+ }
+ return m_pFDEFontMgr.get();
+}
+
+CXFA_FWLTheme* CXFA_FFApp::GetFWLTheme() {
+ if (!m_pFWLTheme)
+ m_pFWLTheme = pdfium::MakeUnique<CXFA_FWLTheme>(this);
+ return m_pFWLTheme.get();
+}
+
+CXFA_FWLAdapterWidgetMgr* CXFA_FFApp::GetWidgetMgr(
+ CFWL_WidgetMgrDelegate* pDelegate) {
+ if (!m_pAdapterWidgetMgr) {
+ m_pAdapterWidgetMgr = pdfium::MakeUnique<CXFA_FWLAdapterWidgetMgr>();
+ pDelegate->OnSetCapability(FWL_WGTMGR_DisableForm);
+ m_pWidgetMgrDelegate = pDelegate;
+ }
+ return m_pAdapterWidgetMgr.get();
+}
+
+IFWL_AdapterTimerMgr* CXFA_FFApp::GetTimerMgr() const {
+ return m_pProvider->GetTimerMgr();
+}
+
+void CXFA_FFApp::ClearEventTargets() {
+ m_pFWLApp->GetNoteDriver()->ClearEventTargets(false);
+}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/cxfa_ffapp.h b/chromium/third_party/pdfium/xfa/fxfa/cxfa_ffapp.h
new file mode 100644
index 00000000000..0a6409d3d13
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fxfa/cxfa_ffapp.h
@@ -0,0 +1,81 @@
+// 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 XFA_FXFA_CXFA_FFAPP_H_
+#define XFA_FXFA_CXFA_FFAPP_H_
+
+#include <memory>
+#include <vector>
+
+#include "core/fpdfapi/parser/cpdf_stream.h"
+#include "core/fpdfapi/parser/cpdf_stream_acc.h"
+#include "core/fxcrt/cfx_retain_ptr.h"
+#include "xfa/fgas/font/cfgas_fontmgr.h"
+#include "xfa/fwl/cfwl_app.h"
+#include "xfa/fxfa/fxfa.h"
+
+class CXFA_DefFontMgr;
+class CXFA_FWLAdapterWidgetMgr;
+class CXFA_FWLTheme;
+class CXFA_FFDocHandler;
+class CXFA_FontMgr;
+class IFWL_AdapterTimerMgr;
+class CFWL_WidgetMgrDelegate;
+
+class CXFA_FFApp {
+ public:
+ explicit CXFA_FFApp(IXFA_AppProvider* pProvider);
+ ~CXFA_FFApp();
+
+ std::unique_ptr<CXFA_FFDoc> CreateDoc(IXFA_DocEnvironment* pDocEnvironment,
+ CPDF_Document* pPDFDoc);
+ void SetDefaultFontMgr(std::unique_ptr<CXFA_DefFontMgr> pFontMgr);
+
+ CXFA_FFDocHandler* GetDocHandler();
+ CXFA_FWLAdapterWidgetMgr* GetWidgetMgr(CFWL_WidgetMgrDelegate* pDelegate);
+ CFGAS_FontMgr* GetFDEFontMgr();
+ CXFA_FWLTheme* GetFWLTheme();
+
+ IXFA_AppProvider* GetAppProvider() const { return m_pProvider; }
+ const CFWL_App* GetFWLApp() const { return m_pFWLApp.get(); }
+ IFWL_AdapterTimerMgr* GetTimerMgr() const;
+ CXFA_FontMgr* GetXFAFontMgr() const;
+ CFWL_WidgetMgrDelegate* GetWidgetMgrDelegate() const {
+ return m_pWidgetMgrDelegate;
+ }
+
+ void ClearEventTargets();
+
+ private:
+ std::unique_ptr<CXFA_FFDocHandler> m_pDocHandler;
+ IXFA_AppProvider* const m_pProvider;
+
+ // The fonts stored in the font manager may have been created by the default
+ // font manager. The GEFont::LoadFont call takes the manager as a param and
+ // stores it internally. When you destroy the GEFont it tries to unregister
+ // from the font manager and if the default font manager was destroyed first
+ // get get a use-after-free. The m_pFWLTheme can try to cleanup a GEFont
+ // when it frees, so make sure it gets cleaned up first. That requires
+ // m_pFWLApp to be cleaned up as well.
+ //
+ // TODO(dsinclair): The GEFont should have the FontMgr as the pointer instead
+ // of the DEFFontMgr so this goes away. Bug 561.
+ std::unique_ptr<CFGAS_FontMgr> m_pFDEFontMgr;
+ std::unique_ptr<CXFA_FontMgr> m_pFontMgr;
+
+#if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
+ std::unique_ptr<CFX_FontSourceEnum_File> m_pFontSource;
+#endif
+ std::unique_ptr<CXFA_FWLAdapterWidgetMgr> m_pAdapterWidgetMgr;
+ CFWL_WidgetMgrDelegate* m_pWidgetMgrDelegate; // not owned.
+
+ // |m_pFWLApp| has to be released first, then |m_pFWLTheme| since the former
+ // may refers to theme manager and the latter refers to font manager.
+ std::unique_ptr<CXFA_FWLTheme> m_pFWLTheme;
+ std::unique_ptr<CFWL_App> m_pFWLApp;
+};
+
+#endif // XFA_FXFA_CXFA_FFAPP_H_
diff --git a/chromium/third_party/pdfium/xfa/fxfa/cxfa_ffapp_unittest.cpp b/chromium/third_party/pdfium/xfa/fxfa/cxfa_ffapp_unittest.cpp
new file mode 100644
index 00000000000..fc1d038bacd
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fxfa/cxfa_ffapp_unittest.cpp
@@ -0,0 +1,88 @@
+// Copyright 2016 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "xfa/fxfa/cxfa_ffapp.h"
+
+#include <memory>
+#include <vector>
+
+#include "core/fpdfapi/parser/cpdf_dictionary.h"
+#include "core/fpdfapi/parser/cpdf_stream.h"
+#include "core/fxcrt/fx_memory.h"
+#include "testing/gtest/include/gtest/gtest.h"
+#include "testing/test_support.h"
+#include "third_party/base/ptr_util.h"
+#include "xfa/fxfa/cxfa_fileread.h"
+
+class CXFAFileReadTest : public pdfium::FPDF_Test {};
+
+TEST_F(CXFAFileReadTest, NoStreams) {
+ std::vector<CPDF_Stream*> streams;
+ auto fileread = pdfium::MakeRetain<CXFA_FileRead>(streams);
+
+ uint8_t output_buffer[16];
+ memset(output_buffer, 0xbd, sizeof(output_buffer));
+ EXPECT_FALSE(fileread->ReadBlock(output_buffer, 0, 0));
+ EXPECT_EQ(0xbd, output_buffer[0]);
+}
+
+TEST_F(CXFAFileReadTest, EmptyStreams) {
+ std::vector<CPDF_Stream*> streams;
+ auto stream1 = pdfium::MakeUnique<CPDF_Stream>();
+ streams.push_back(stream1.get());
+ auto fileread = pdfium::MakeRetain<CXFA_FileRead>(streams);
+
+ uint8_t output_buffer[16];
+ memset(output_buffer, 0xbd, sizeof(output_buffer));
+ EXPECT_FALSE(fileread->ReadBlock(output_buffer, 0, 0));
+ EXPECT_EQ(0xbd, output_buffer[0]);
+}
+
+TEST_F(CXFAFileReadTest, NormalStreams) {
+ std::vector<CPDF_Stream*> streams;
+ auto stream1 = pdfium::MakeUnique<CPDF_Stream>();
+ auto stream2 = pdfium::MakeUnique<CPDF_Stream>();
+ auto stream3 = pdfium::MakeUnique<CPDF_Stream>();
+
+ // 16 chars total.
+ stream1->InitStream(reinterpret_cast<const uint8_t*>("one t"), 5,
+ pdfium::MakeUnique<CPDF_Dictionary>());
+ stream2->InitStream(reinterpret_cast<const uint8_t*>("wo "), 3,
+ pdfium::MakeUnique<CPDF_Dictionary>());
+ stream3->InitStream(reinterpret_cast<const uint8_t*>("three!!!"), 8,
+ pdfium::MakeUnique<CPDF_Dictionary>());
+
+ streams.push_back(stream1.get());
+ streams.push_back(stream2.get());
+ streams.push_back(stream3.get());
+ auto fileread = pdfium::MakeRetain<CXFA_FileRead>(streams);
+
+ uint8_t output_buffer[16];
+ memset(output_buffer, 0xbd, sizeof(output_buffer));
+ EXPECT_TRUE(fileread->ReadBlock(output_buffer, 0, 0));
+ EXPECT_EQ(0xbd, output_buffer[0]);
+
+ memset(output_buffer, 0xbd, sizeof(output_buffer));
+ EXPECT_TRUE(fileread->ReadBlock(output_buffer, 1, 0));
+ EXPECT_EQ(0xbd, output_buffer[0]);
+
+ memset(output_buffer, 0xbd, sizeof(output_buffer));
+ EXPECT_TRUE(fileread->ReadBlock(output_buffer, 0, 1));
+ EXPECT_EQ(0, memcmp(output_buffer, "o", 1));
+ EXPECT_EQ(0xbd, output_buffer[1]);
+
+ memset(output_buffer, 0xbd, sizeof(output_buffer));
+ EXPECT_TRUE(fileread->ReadBlock(output_buffer, 0, sizeof(output_buffer)));
+ EXPECT_EQ(0, memcmp(output_buffer, "one two three!!!", 16));
+
+ memset(output_buffer, 0xbd, sizeof(output_buffer));
+ EXPECT_TRUE(fileread->ReadBlock(output_buffer, 2, 10));
+ EXPECT_EQ(0, memcmp(output_buffer, "e two thre", 10));
+ EXPECT_EQ(0xbd, output_buffer[11]);
+
+ memset(output_buffer, 0xbd, sizeof(output_buffer));
+ EXPECT_FALSE(fileread->ReadBlock(output_buffer, 1, sizeof(output_buffer)));
+ EXPECT_EQ(0, memcmp(output_buffer, "ne two three!!!", 15));
+ EXPECT_EQ(0xbd, output_buffer[15]);
+}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/cxfa_ffdoc.cpp b/chromium/third_party/pdfium/xfa/fxfa/cxfa_ffdoc.cpp
new file mode 100644
index 00000000000..2bbdfa1b9c8
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fxfa/cxfa_ffdoc.cpp
@@ -0,0 +1,427 @@
+// 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
+
+#include "xfa/fxfa/cxfa_ffdoc.h"
+
+#include <algorithm>
+#include <memory>
+#include <vector>
+
+#include "core/fpdfapi/parser/cpdf_array.h"
+#include "core/fpdfapi/parser/cpdf_document.h"
+#include "core/fpdfapi/parser/fpdf_parser_decode.h"
+#include "core/fpdfdoc/cpdf_nametree.h"
+#include "core/fxcrt/cfx_checksumcontext.h"
+#include "core/fxcrt/fx_ext.h"
+#include "core/fxcrt/fx_memory.h"
+#include "third_party/base/ptr_util.h"
+#include "xfa/fde/xml/cfde_xmlelement.h"
+#include "xfa/fde/xml/cfde_xmlnode.h"
+#include "xfa/fwl/cfwl_notedriver.h"
+#include "xfa/fxfa/app/xfa_ffnotify.h"
+#include "xfa/fxfa/cxfa_ffapp.h"
+#include "xfa/fxfa/cxfa_ffdocview.h"
+#include "xfa/fxfa/cxfa_ffwidget.h"
+#include "xfa/fxfa/cxfa_fileread.h"
+#include "xfa/fxfa/cxfa_fontmgr.h"
+#include "xfa/fxfa/parser/cxfa_dataexporter.h"
+#include "xfa/fxfa/parser/cxfa_dataimporter.h"
+#include "xfa/fxfa/parser/cxfa_document.h"
+#include "xfa/fxfa/parser/cxfa_node.h"
+
+namespace {
+
+struct FX_BASE64DATA {
+ uint32_t data1 : 2;
+ uint32_t data2 : 6;
+ uint32_t data3 : 4;
+ uint32_t data4 : 4;
+ uint32_t data5 : 6;
+ uint32_t data6 : 2;
+ uint32_t data7 : 8;
+};
+
+const uint8_t kStartValuesRemoved = 43;
+const uint8_t kDecoderMapSize = 80;
+const uint8_t g_FXBase64DecoderMap[kDecoderMapSize] = {
+ 0x3E, 0xFF, 0xFF, 0xFF, 0x3F, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A,
+ 0x3B, 0x3C, 0x3D, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x01,
+ 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
+ 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F,
+ 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B,
+ 0x2C, 0x2D, 0x2E, 0x2F, 0x30, 0x31, 0x32, 0x33,
+};
+
+uint8_t base64DecoderValue(uint8_t val) {
+ if (val < kStartValuesRemoved || val >= kStartValuesRemoved + kDecoderMapSize)
+ return 0xFF;
+ return g_FXBase64DecoderMap[val - kStartValuesRemoved];
+}
+
+void Base64DecodePiece(const char src[4],
+ int32_t iChars,
+ FX_BASE64DATA& dst,
+ int32_t& iBytes) {
+ ASSERT(iChars > 0 && iChars < 5);
+ iBytes = 1;
+ dst.data2 = base64DecoderValue(static_cast<uint8_t>(src[0]));
+ if (iChars > 1) {
+ uint8_t b = base64DecoderValue(static_cast<uint8_t>(src[1]));
+ dst.data1 = b >> 4;
+ dst.data4 = b;
+ if (iChars > 2) {
+ iBytes = 2;
+ b = base64DecoderValue(static_cast<uint8_t>(src[2]));
+ dst.data3 = b >> 2;
+ dst.data6 = b;
+ if (iChars > 3) {
+ iBytes = 3;
+ dst.data5 = base64DecoderValue(static_cast<uint8_t>(src[3]));
+ } else {
+ dst.data5 = 0;
+ }
+ } else {
+ dst.data3 = 0;
+ }
+ } else {
+ dst.data1 = 0;
+ }
+}
+
+int32_t Base64DecodeW(const wchar_t* pSrc, int32_t iSrcLen, uint8_t* pDst) {
+ ASSERT(pSrc);
+ if (iSrcLen < 1) {
+ return 0;
+ }
+ while (iSrcLen > 0 && pSrc[iSrcLen - 1] == '=') {
+ iSrcLen--;
+ }
+ if (iSrcLen < 1) {
+ return 0;
+ }
+ if (!pDst) {
+ int32_t iDstLen = iSrcLen / 4 * 3;
+ iSrcLen %= 4;
+ if (iSrcLen == 1) {
+ iDstLen += 1;
+ } else if (iSrcLen == 2) {
+ iDstLen += 1;
+ } else if (iSrcLen == 3) {
+ iDstLen += 2;
+ }
+ return iDstLen;
+ }
+ char srcData[4];
+ FX_BASE64DATA dstData;
+ int32_t iChars = 4, iBytes;
+ uint8_t* pDstEnd = pDst;
+ while (iSrcLen > 0) {
+ if (iSrcLen > 3) {
+ srcData[0] = (char)*pSrc++;
+ srcData[1] = (char)*pSrc++;
+ srcData[2] = (char)*pSrc++;
+ srcData[3] = (char)*pSrc++;
+ iSrcLen -= 4;
+ } else {
+ *((uint32_t*)&dstData) = 0;
+ *((uint32_t*)srcData) = 0;
+ srcData[0] = (char)*pSrc++;
+ if (iSrcLen > 1) {
+ srcData[1] = (char)*pSrc++;
+ }
+ if (iSrcLen > 2) {
+ srcData[2] = (char)*pSrc++;
+ }
+ iChars = iSrcLen;
+ iSrcLen = 0;
+ }
+ Base64DecodePiece(srcData, iChars, dstData, iBytes);
+ *pDstEnd++ = ((uint8_t*)&dstData)[0];
+ if (iBytes > 1) {
+ *pDstEnd++ = ((uint8_t*)&dstData)[1];
+ }
+ if (iBytes > 2) {
+ *pDstEnd++ = ((uint8_t*)&dstData)[2];
+ }
+ }
+ return pDstEnd - pDst;
+}
+
+} // namespace
+
+CXFA_FFDoc::CXFA_FFDoc(CXFA_FFApp* pApp, IXFA_DocEnvironment* pDocEnvironment)
+ : m_pDocEnvironment(pDocEnvironment),
+ m_pDocumentParser(nullptr),
+ m_pApp(pApp),
+ m_pNotify(nullptr),
+ m_pPDFDoc(nullptr),
+ m_dwDocType(XFA_DocType::Static) {}
+
+CXFA_FFDoc::~CXFA_FFDoc() {
+ CloseDoc();
+}
+
+int32_t CXFA_FFDoc::StartLoad() {
+ m_pNotify = pdfium::MakeUnique<CXFA_FFNotify>(this);
+ m_pDocumentParser = pdfium::MakeUnique<CXFA_DocumentParser>(m_pNotify.get());
+ return m_pDocumentParser->StartParse(m_pStream, XFA_XDPPACKET_XDP);
+}
+
+bool XFA_GetPDFContentsFromPDFXML(CFDE_XMLNode* pPDFElement,
+ uint8_t*& pByteBuffer,
+ int32_t& iBufferSize) {
+ CFDE_XMLElement* pDocumentElement = nullptr;
+ for (CFDE_XMLNode* pXMLNode =
+ pPDFElement->GetNodeItem(CFDE_XMLNode::FirstChild);
+ pXMLNode; pXMLNode = pXMLNode->GetNodeItem(CFDE_XMLNode::NextSibling)) {
+ if (pXMLNode->GetType() == FDE_XMLNODE_Element) {
+ CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode);
+ CFX_WideString wsTagName = pXMLElement->GetName();
+ if (wsTagName == L"document") {
+ pDocumentElement = pXMLElement;
+ break;
+ }
+ }
+ }
+ if (!pDocumentElement) {
+ return false;
+ }
+ CFDE_XMLElement* pChunkElement = nullptr;
+ for (CFDE_XMLNode* pXMLNode =
+ pDocumentElement->GetNodeItem(CFDE_XMLNode::FirstChild);
+ pXMLNode; pXMLNode = pXMLNode->GetNodeItem(CFDE_XMLNode::NextSibling)) {
+ if (pXMLNode->GetType() == FDE_XMLNODE_Element) {
+ CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode);
+ CFX_WideString wsTagName = pXMLElement->GetName();
+ if (wsTagName == L"chunk") {
+ pChunkElement = pXMLElement;
+ break;
+ }
+ }
+ }
+ if (!pChunkElement) {
+ return false;
+ }
+ CFX_WideString wsPDFContent = pChunkElement->GetTextData();
+ iBufferSize =
+ Base64DecodeW(wsPDFContent.c_str(), wsPDFContent.GetLength(), nullptr);
+ pByteBuffer = FX_Alloc(uint8_t, iBufferSize + 1);
+ pByteBuffer[iBufferSize] = '0'; // FIXME: I bet this is wrong.
+ Base64DecodeW(wsPDFContent.c_str(), wsPDFContent.GetLength(), pByteBuffer);
+ return true;
+}
+void XFA_XPDPacket_MergeRootNode(CXFA_Node* pOriginRoot, CXFA_Node* pNewRoot) {
+ CXFA_Node* pChildNode = pNewRoot->GetNodeItem(XFA_NODEITEM_FirstChild);
+ while (pChildNode) {
+ CXFA_Node* pOriginChild =
+ pOriginRoot->GetFirstChildByName(pChildNode->GetNameHash());
+ if (pOriginChild) {
+ pChildNode = pChildNode->GetNodeItem(XFA_NODEITEM_NextSibling);
+ } else {
+ CXFA_Node* pNextSibling =
+ pChildNode->GetNodeItem(XFA_NODEITEM_NextSibling);
+ pNewRoot->RemoveChild(pChildNode);
+ pOriginRoot->InsertChild(pChildNode);
+ pChildNode = pNextSibling;
+ pNextSibling = nullptr;
+ }
+ }
+}
+
+int32_t CXFA_FFDoc::DoLoad(IFX_Pause* pPause) {
+ int32_t iStatus = m_pDocumentParser->DoParse(pPause);
+ if (iStatus == XFA_PARSESTATUS_Done && !m_pPDFDoc)
+ return XFA_PARSESTATUS_SyntaxErr;
+ return iStatus;
+}
+
+void CXFA_FFDoc::StopLoad() {
+ m_pApp->GetXFAFontMgr()->LoadDocFonts(this);
+ m_dwDocType = XFA_DocType::Static;
+ CXFA_Node* pConfig = ToNode(
+ m_pDocumentParser->GetDocument()->GetXFAObject(XFA_HASHCODE_Config));
+ if (!pConfig)
+ return;
+
+ CXFA_Node* pAcrobat = pConfig->GetFirstChildByClass(XFA_Element::Acrobat);
+ if (!pAcrobat)
+ return;
+
+ CXFA_Node* pAcrobat7 = pAcrobat->GetFirstChildByClass(XFA_Element::Acrobat7);
+ if (!pAcrobat7)
+ return;
+
+ CXFA_Node* pDynamicRender =
+ pAcrobat7->GetFirstChildByClass(XFA_Element::DynamicRender);
+ if (!pDynamicRender)
+ return;
+
+ CFX_WideString wsType;
+ if (pDynamicRender->TryContent(wsType) && wsType == L"required")
+ m_dwDocType = XFA_DocType::Dynamic;
+}
+
+CXFA_FFDocView* CXFA_FFDoc::CreateDocView() {
+ if (!m_DocView)
+ m_DocView = pdfium::MakeUnique<CXFA_FFDocView>(this);
+
+ return m_DocView.get();
+}
+
+CXFA_FFDocView* CXFA_FFDoc::GetDocView(CXFA_LayoutProcessor* pLayout) {
+ return m_DocView && m_DocView->GetXFALayout() == pLayout ? m_DocView.get()
+ : nullptr;
+}
+
+CXFA_FFDocView* CXFA_FFDoc::GetDocView() {
+ return m_DocView.get();
+}
+
+bool CXFA_FFDoc::OpenDoc(const CFX_RetainPtr<IFX_SeekableReadStream>& pStream) {
+ m_pStream = pStream;
+ return true;
+}
+
+bool CXFA_FFDoc::OpenDoc(CPDF_Document* pPDFDoc) {
+ if (!pPDFDoc)
+ return false;
+
+ CPDF_Dictionary* pRoot = pPDFDoc->GetRoot();
+ if (!pRoot)
+ return false;
+
+ CPDF_Dictionary* pAcroForm = pRoot->GetDictFor("AcroForm");
+ if (!pAcroForm)
+ return false;
+
+ CPDF_Object* pElementXFA = pAcroForm->GetDirectObjectFor("XFA");
+ if (!pElementXFA)
+ return false;
+
+ std::vector<CPDF_Stream*> xfaStreams;
+ if (pElementXFA->IsArray()) {
+ CPDF_Array* pXFAArray = (CPDF_Array*)pElementXFA;
+ for (size_t i = 0; i < pXFAArray->GetCount() / 2; i++) {
+ if (CPDF_Stream* pStream = pXFAArray->GetStreamAt(i * 2 + 1))
+ xfaStreams.push_back(pStream);
+ }
+ } else if (pElementXFA->IsStream()) {
+ xfaStreams.push_back((CPDF_Stream*)pElementXFA);
+ }
+ if (xfaStreams.empty())
+ return false;
+
+ m_pPDFDoc = pPDFDoc;
+ m_pStream = pdfium::MakeRetain<CXFA_FileRead>(xfaStreams);
+ return true;
+}
+
+bool CXFA_FFDoc::CloseDoc() {
+ if (m_DocView)
+ m_DocView->RunDocClose();
+
+ CXFA_Document* doc =
+ m_pDocumentParser ? m_pDocumentParser->GetDocument() : nullptr;
+ if (doc)
+ doc->ClearLayoutData();
+
+ m_DocView.reset();
+ m_pNotify.reset(nullptr);
+ m_pApp->GetXFAFontMgr()->ReleaseDocFonts(this);
+ m_HashToDibDpiMap.clear();
+ m_pApp->ClearEventTargets();
+ return true;
+}
+
+CPDF_Document* CXFA_FFDoc::GetPDFDoc() {
+ return m_pPDFDoc;
+}
+
+CFX_RetainPtr<CFX_DIBitmap> CXFA_FFDoc::GetPDFNamedImage(
+ const CFX_WideStringC& wsName,
+ int32_t& iImageXDpi,
+ int32_t& iImageYDpi) {
+ if (!m_pPDFDoc)
+ return nullptr;
+
+ uint32_t dwHash = FX_HashCode_GetW(wsName, false);
+ auto it = m_HashToDibDpiMap.find(dwHash);
+ if (it != m_HashToDibDpiMap.end()) {
+ iImageXDpi = it->second.iImageXDpi;
+ iImageYDpi = it->second.iImageYDpi;
+ return it->second.pDibSource.As<CFX_DIBitmap>();
+ }
+
+ CPDF_Dictionary* pRoot = m_pPDFDoc->GetRoot();
+ if (!pRoot)
+ return nullptr;
+
+ CPDF_Dictionary* pNames = pRoot->GetDictFor("Names");
+ if (!pNames)
+ return nullptr;
+
+ CPDF_Dictionary* pXFAImages = pNames->GetDictFor("XFAImages");
+ if (!pXFAImages)
+ return nullptr;
+
+ CPDF_NameTree nametree(pXFAImages);
+ CFX_ByteString bsName = PDF_EncodeText(wsName.c_str(), wsName.GetLength());
+ CPDF_Object* pObject = nametree.LookupValue(bsName);
+ if (!pObject) {
+ for (size_t i = 0; i < nametree.GetCount(); i++) {
+ CFX_ByteString bsTemp;
+ CPDF_Object* pTempObject = nametree.LookupValueAndName(i, &bsTemp);
+ if (bsTemp == bsName) {
+ pObject = pTempObject;
+ break;
+ }
+ }
+ }
+
+ CPDF_Stream* pStream = ToStream(pObject);
+ if (!pStream)
+ return nullptr;
+
+ auto pAcc = pdfium::MakeRetain<CPDF_StreamAcc>(pStream);
+ pAcc->LoadAllData();
+
+ CFX_RetainPtr<IFX_SeekableReadStream> pImageFileRead =
+ IFX_MemoryStream::Create(const_cast<uint8_t*>(pAcc->GetData()),
+ pAcc->GetSize());
+
+ CFX_RetainPtr<CFX_DIBitmap> pDibSource = XFA_LoadImageFromBuffer(
+ pImageFileRead, FXCODEC_IMAGE_UNKNOWN, iImageXDpi, iImageYDpi);
+ m_HashToDibDpiMap[dwHash] = {pDibSource, iImageXDpi, iImageYDpi};
+ return pDibSource;
+}
+
+bool CXFA_FFDoc::SavePackage(
+ XFA_HashCode code,
+ const CFX_RetainPtr<IFX_SeekableWriteStream>& pFile,
+ CFX_ChecksumContext* pCSContext) {
+ CXFA_Document* doc = m_pDocumentParser->GetDocument();
+ auto pExport = pdfium::MakeUnique<CXFA_DataExporter>(doc);
+ CXFA_Node* pNode = code == XFA_HASHCODE_Xfa ? doc->GetRoot()
+ : ToNode(doc->GetXFAObject(code));
+ if (!pNode)
+ return !!pExport->Export(pFile);
+
+ CFX_ByteString bsChecksum;
+ if (pCSContext)
+ bsChecksum = pCSContext->GetChecksum();
+
+ return !!pExport->Export(
+ pFile, pNode, 0, bsChecksum.GetLength() ? bsChecksum.c_str() : nullptr);
+}
+
+bool CXFA_FFDoc::ImportData(
+ const CFX_RetainPtr<IFX_SeekableReadStream>& pStream,
+ bool bXDP) {
+ auto importer =
+ pdfium::MakeUnique<CXFA_DataImporter>(m_pDocumentParser->GetDocument());
+ return importer->ImportData(pStream);
+}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/cxfa_ffdoc.h b/chromium/third_party/pdfium/xfa/fxfa/cxfa_ffdoc.h
new file mode 100644
index 00000000000..0bba956f147
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fxfa/cxfa_ffdoc.h
@@ -0,0 +1,92 @@
+// 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 XFA_FXFA_CXFA_FFDOC_H_
+#define XFA_FXFA_CXFA_FFDOC_H_
+
+#include <map>
+#include <memory>
+
+#include "xfa/fxfa/fxfa.h"
+#include "xfa/fxfa/parser/cxfa_document.h"
+#include "xfa/fxfa/parser/cxfa_document_parser.h"
+
+class CFX_ChecksumContext;
+class CXFA_FFApp;
+class CXFA_FFNotify;
+class CXFA_FFDocView;
+
+struct FX_IMAGEDIB_AND_DPI {
+ FX_IMAGEDIB_AND_DPI();
+ FX_IMAGEDIB_AND_DPI(const FX_IMAGEDIB_AND_DPI& that);
+ FX_IMAGEDIB_AND_DPI(const CFX_RetainPtr<CFX_DIBSource>& pDib,
+ int32_t xDpi,
+ int32_t yDpi);
+ ~FX_IMAGEDIB_AND_DPI();
+
+ CFX_RetainPtr<CFX_DIBSource> pDibSource;
+ int32_t iImageXDpi;
+ int32_t iImageYDpi;
+};
+
+inline FX_IMAGEDIB_AND_DPI::FX_IMAGEDIB_AND_DPI() = default;
+inline FX_IMAGEDIB_AND_DPI::FX_IMAGEDIB_AND_DPI(
+ const FX_IMAGEDIB_AND_DPI& that) = default;
+
+inline FX_IMAGEDIB_AND_DPI::FX_IMAGEDIB_AND_DPI(
+ const CFX_RetainPtr<CFX_DIBSource>& pDib,
+ int32_t xDpi,
+ int32_t yDpi)
+ : pDibSource(pDib), iImageXDpi(xDpi), iImageYDpi(yDpi) {}
+
+inline FX_IMAGEDIB_AND_DPI::~FX_IMAGEDIB_AND_DPI() = default;
+
+class CXFA_FFDoc {
+ public:
+ CXFA_FFDoc(CXFA_FFApp* pApp, IXFA_DocEnvironment* pDocEnvironment);
+ ~CXFA_FFDoc();
+
+ IXFA_DocEnvironment* GetDocEnvironment() const { return m_pDocEnvironment; }
+ XFA_DocType GetDocType() const { return m_dwDocType; }
+
+ int32_t StartLoad();
+ int32_t DoLoad(IFX_Pause* pPause = nullptr);
+ void StopLoad();
+
+ CXFA_FFDocView* CreateDocView();
+
+ bool OpenDoc(const CFX_RetainPtr<IFX_SeekableReadStream>& pStream);
+ bool OpenDoc(CPDF_Document* pPDFDoc);
+ bool CloseDoc();
+
+ CXFA_Document* GetXFADoc() { return m_pDocumentParser->GetDocument(); }
+ CXFA_FFApp* GetApp() { return m_pApp; }
+ CXFA_FFDocView* GetDocView(CXFA_LayoutProcessor* pLayout);
+ CXFA_FFDocView* GetDocView();
+ CPDF_Document* GetPDFDoc();
+ CFX_RetainPtr<CFX_DIBitmap> GetPDFNamedImage(const CFX_WideStringC& wsName,
+ int32_t& iImageXDpi,
+ int32_t& iImageYDpi);
+
+ bool SavePackage(XFA_HashCode code,
+ const CFX_RetainPtr<IFX_SeekableWriteStream>& pFile,
+ CFX_ChecksumContext* pCSContext);
+ bool ImportData(const CFX_RetainPtr<IFX_SeekableReadStream>& pStream,
+ bool bXDP = true);
+
+ private:
+ IXFA_DocEnvironment* const m_pDocEnvironment;
+ std::unique_ptr<CXFA_DocumentParser> m_pDocumentParser;
+ CFX_RetainPtr<IFX_SeekableReadStream> m_pStream;
+ CXFA_FFApp* m_pApp;
+ std::unique_ptr<CXFA_FFNotify> m_pNotify;
+ CPDF_Document* m_pPDFDoc;
+ std::map<uint32_t, FX_IMAGEDIB_AND_DPI> m_HashToDibDpiMap;
+ std::unique_ptr<CXFA_FFDocView> m_DocView;
+ XFA_DocType m_dwDocType;
+};
+
+#endif // XFA_FXFA_CXFA_FFDOC_H_
diff --git a/chromium/third_party/pdfium/xfa/fxfa/cxfa_ffdochandler.cpp b/chromium/third_party/pdfium/xfa/fxfa/cxfa_ffdochandler.cpp
new file mode 100644
index 00000000000..b0a84fa29a4
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fxfa/cxfa_ffdochandler.cpp
@@ -0,0 +1,61 @@
+// 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
+
+#include "xfa/fxfa/cxfa_ffdochandler.h"
+
+#include "core/fxcrt/cfx_checksumcontext.h"
+#include "xfa/fxfa/cxfa_ffdoc.h"
+#include "xfa/fxfa/parser/cxfa_node.h"
+#include "xfa/fxfa/parser/cxfa_scriptcontext.h"
+#include "xfa/fxfa/parser/xfa_resolvenode_rs.h"
+
+CXFA_FFDocHandler::CXFA_FFDocHandler() {}
+
+CXFA_FFDocHandler::~CXFA_FFDocHandler() {}
+
+CFXJSE_Value* CXFA_FFDocHandler::GetXFAScriptObject(CXFA_FFDoc* hDoc) {
+ CXFA_Document* pXFADoc = hDoc->GetXFADoc();
+ if (!pXFADoc)
+ return nullptr;
+
+ CXFA_ScriptContext* pScriptContext = pXFADoc->GetScriptContext();
+ if (!pScriptContext)
+ return nullptr;
+ return pScriptContext->GetJSValueFromMap(pXFADoc->GetRoot());
+}
+
+XFA_ATTRIBUTEENUM CXFA_FFDocHandler::GetRestoreState(CXFA_FFDoc* hDoc) {
+ CXFA_Document* pXFADoc = hDoc->GetXFADoc();
+ if (!pXFADoc)
+ return XFA_ATTRIBUTEENUM_Unknown;
+
+ CXFA_Node* pForm = ToNode(pXFADoc->GetXFAObject(XFA_HASHCODE_Form));
+ if (!pForm)
+ return XFA_ATTRIBUTEENUM_Unknown;
+
+ CXFA_Node* pSubForm = pForm->GetFirstChildByClass(XFA_Element::Subform);
+ if (!pSubForm)
+ return XFA_ATTRIBUTEENUM_Unknown;
+ return pSubForm->GetEnum(XFA_ATTRIBUTE_RestoreState);
+}
+
+bool CXFA_FFDocHandler::RunDocScript(CXFA_FFDoc* hDoc,
+ XFA_SCRIPTTYPE eScriptType,
+ const CFX_WideStringC& wsScript,
+ CFXJSE_Value* pRetValue,
+ CFXJSE_Value* pThisValue) {
+ CXFA_Document* pXFADoc = hDoc->GetXFADoc();
+ if (!pXFADoc)
+ return false;
+
+ CXFA_ScriptContext* pScriptContext = pXFADoc->GetScriptContext();
+ if (!pScriptContext)
+ return false;
+
+ return pScriptContext->RunScript(
+ (XFA_SCRIPTLANGTYPE)eScriptType, wsScript, pRetValue,
+ pThisValue ? CXFA_ScriptContext::ToObject(pThisValue, nullptr) : nullptr);
+}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/cxfa_ffdochandler.h b/chromium/third_party/pdfium/xfa/fxfa/cxfa_ffdochandler.h
new file mode 100644
index 00000000000..45b2ee07e10
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fxfa/cxfa_ffdochandler.h
@@ -0,0 +1,29 @@
+// 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 XFA_FXFA_CXFA_FFDOCHANDLER_H_
+#define XFA_FXFA_CXFA_FFDOCHANDLER_H_
+
+#include "xfa/fxfa/fxfa.h"
+
+class CFX_ChecksumContext;
+
+class CXFA_FFDocHandler {
+ public:
+ CXFA_FFDocHandler();
+ ~CXFA_FFDocHandler();
+
+ CFXJSE_Value* GetXFAScriptObject(CXFA_FFDoc* hDoc);
+ XFA_ATTRIBUTEENUM GetRestoreState(CXFA_FFDoc* hDoc);
+
+ bool RunDocScript(CXFA_FFDoc* hDoc,
+ XFA_SCRIPTTYPE eScriptType,
+ const CFX_WideStringC& wsScript,
+ CFXJSE_Value* pRetValue,
+ CFXJSE_Value* pThisObject);
+};
+
+#endif // XFA_FXFA_CXFA_FFDOCHANDLER_H_
diff --git a/chromium/third_party/pdfium/xfa/fxfa/cxfa_ffdocview.cpp b/chromium/third_party/pdfium/xfa/fxfa/cxfa_ffdocview.cpp
new file mode 100644
index 00000000000..488a31f299a
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fxfa/cxfa_ffdocview.cpp
@@ -0,0 +1,792 @@
+// 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
+
+#include "xfa/fxfa/cxfa_ffdocview.h"
+
+#include "core/fxcrt/fx_ext.h"
+#include "third_party/base/ptr_util.h"
+#include "third_party/base/stl_util.h"
+#include "xfa/fxfa/app/xfa_ffbarcode.h"
+#include "xfa/fxfa/app/xfa_ffcheckbutton.h"
+#include "xfa/fxfa/app/xfa_ffchoicelist.h"
+#include "xfa/fxfa/app/xfa_ffdraw.h"
+#include "xfa/fxfa/app/xfa_ffexclgroup.h"
+#include "xfa/fxfa/app/xfa_fffield.h"
+#include "xfa/fxfa/app/xfa_ffimage.h"
+#include "xfa/fxfa/app/xfa_ffimageedit.h"
+#include "xfa/fxfa/app/xfa_ffpath.h"
+#include "xfa/fxfa/app/xfa_ffpushbutton.h"
+#include "xfa/fxfa/app/xfa_ffsignature.h"
+#include "xfa/fxfa/app/xfa_ffsubform.h"
+#include "xfa/fxfa/app/xfa_fftext.h"
+#include "xfa/fxfa/app/xfa_fftextedit.h"
+#include "xfa/fxfa/app/xfa_ffwidgetacc.h"
+#include "xfa/fxfa/app/xfa_fwladapter.h"
+#include "xfa/fxfa/cxfa_ffapp.h"
+#include "xfa/fxfa/cxfa_ffdoc.h"
+#include "xfa/fxfa/cxfa_ffpageview.h"
+#include "xfa/fxfa/cxfa_ffwidget.h"
+#include "xfa/fxfa/cxfa_ffwidgethandler.h"
+#include "xfa/fxfa/cxfa_widgetacciterator.h"
+#include "xfa/fxfa/parser/cxfa_binditems.h"
+#include "xfa/fxfa/parser/cxfa_layoutprocessor.h"
+#include "xfa/fxfa/parser/cxfa_scriptcontext.h"
+#include "xfa/fxfa/parser/xfa_resolvenode_rs.h"
+
+#define XFA_CalcRefCount (void*)(uintptr_t) FXBSTR_ID('X', 'F', 'A', 'R')
+
+const XFA_ATTRIBUTEENUM gs_EventActivity[] = {
+ XFA_ATTRIBUTEENUM_Click, XFA_ATTRIBUTEENUM_Change,
+ XFA_ATTRIBUTEENUM_DocClose, XFA_ATTRIBUTEENUM_DocReady,
+ XFA_ATTRIBUTEENUM_Enter, XFA_ATTRIBUTEENUM_Exit,
+ XFA_ATTRIBUTEENUM_Full, XFA_ATTRIBUTEENUM_IndexChange,
+ XFA_ATTRIBUTEENUM_Initialize, XFA_ATTRIBUTEENUM_MouseDown,
+ XFA_ATTRIBUTEENUM_MouseEnter, XFA_ATTRIBUTEENUM_MouseExit,
+ XFA_ATTRIBUTEENUM_MouseUp, XFA_ATTRIBUTEENUM_PostExecute,
+ XFA_ATTRIBUTEENUM_PostOpen, XFA_ATTRIBUTEENUM_PostPrint,
+ XFA_ATTRIBUTEENUM_PostSave, XFA_ATTRIBUTEENUM_PostSign,
+ XFA_ATTRIBUTEENUM_PostSubmit, XFA_ATTRIBUTEENUM_PreExecute,
+ XFA_ATTRIBUTEENUM_PreOpen, XFA_ATTRIBUTEENUM_PrePrint,
+ XFA_ATTRIBUTEENUM_PreSave, XFA_ATTRIBUTEENUM_PreSign,
+ XFA_ATTRIBUTEENUM_PreSubmit, XFA_ATTRIBUTEENUM_Ready,
+ XFA_ATTRIBUTEENUM_Unknown,
+};
+
+CXFA_FFDocView::CXFA_FFDocView(CXFA_FFDoc* pDoc)
+ : m_bLayoutEvent(false),
+ m_pListFocusWidget(nullptr),
+ m_bInLayoutStatus(false),
+ m_pDoc(pDoc),
+ m_pXFADocLayout(nullptr),
+ m_pFocusAcc(nullptr),
+ m_pFocusWidget(nullptr),
+ m_pOldFocusWidget(nullptr),
+ m_iStatus(XFA_DOCVIEW_LAYOUTSTATUS_None),
+ m_iLock(0) {}
+
+CXFA_FFDocView::~CXFA_FFDocView() {
+ DestroyDocView();
+}
+
+void CXFA_FFDocView::InitLayout(CXFA_Node* pNode) {
+ RunBindItems();
+ ExecEventActivityByDeepFirst(pNode, XFA_EVENT_Initialize, false, true,
+ nullptr);
+ ExecEventActivityByDeepFirst(pNode, XFA_EVENT_IndexChange, false, true,
+ nullptr);
+}
+int32_t CXFA_FFDocView::StartLayout(int32_t iStartPage) {
+ m_iStatus = XFA_DOCVIEW_LAYOUTSTATUS_Start;
+ m_pDoc->GetXFADoc()->DoProtoMerge();
+ m_pDoc->GetXFADoc()->DoDataMerge();
+ m_pXFADocLayout = GetXFALayout();
+ int32_t iStatus = m_pXFADocLayout->StartLayout();
+ if (iStatus < 0) {
+ return iStatus;
+ }
+ CXFA_Node* pRootItem =
+ ToNode(m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form));
+ if (!pRootItem) {
+ return iStatus;
+ }
+ InitLayout(pRootItem);
+ InitCalculate(pRootItem);
+ InitValidate(pRootItem);
+ ExecEventActivityByDeepFirst(pRootItem, XFA_EVENT_Ready, true, true, nullptr);
+ m_iStatus = XFA_DOCVIEW_LAYOUTSTATUS_Start;
+ return iStatus;
+}
+int32_t CXFA_FFDocView::DoLayout(IFX_Pause* pPause) {
+ int32_t iStatus = 100;
+ iStatus = m_pXFADocLayout->DoLayout(pPause);
+ if (iStatus != 100) {
+ return iStatus;
+ }
+ m_iStatus = XFA_DOCVIEW_LAYOUTSTATUS_Doing;
+ return iStatus;
+}
+void CXFA_FFDocView::StopLayout() {
+ CXFA_Node* pRootItem =
+ ToNode(m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form));
+ if (!pRootItem) {
+ return;
+ }
+ CXFA_Node* pSubformNode = pRootItem->GetChild(0, XFA_Element::Subform);
+ if (!pSubformNode) {
+ return;
+ }
+ CXFA_Node* pPageSetNode =
+ pSubformNode->GetFirstChildByClass(XFA_Element::PageSet);
+ if (!pPageSetNode) {
+ return;
+ }
+ RunCalculateWidgets();
+ RunValidate();
+ InitLayout(pPageSetNode);
+ InitCalculate(pPageSetNode);
+ InitValidate(pPageSetNode);
+ ExecEventActivityByDeepFirst(pPageSetNode, XFA_EVENT_Ready, true, true,
+ nullptr);
+ ExecEventActivityByDeepFirst(pRootItem, XFA_EVENT_Ready, false, true,
+ nullptr);
+ ExecEventActivityByDeepFirst(pRootItem, XFA_EVENT_DocReady, false, true,
+ nullptr);
+ RunCalculateWidgets();
+ RunValidate();
+ if (RunLayout()) {
+ ExecEventActivityByDeepFirst(pRootItem, XFA_EVENT_Ready, false, true,
+ nullptr);
+ }
+ m_CalculateAccs.clear();
+ if (m_pFocusAcc && !m_pFocusWidget) {
+ SetFocusWidgetAcc(m_pFocusAcc);
+ }
+ m_iStatus = XFA_DOCVIEW_LAYOUTSTATUS_End;
+}
+int32_t CXFA_FFDocView::GetLayoutStatus() {
+ return m_iStatus;
+}
+void CXFA_FFDocView::ShowNullTestMsg() {
+ int32_t iCount = pdfium::CollectionSize<int32_t>(m_arrNullTestMsg);
+ CXFA_FFApp* pApp = m_pDoc->GetApp();
+ IXFA_AppProvider* pAppProvider = pApp->GetAppProvider();
+ if (pAppProvider && iCount) {
+ int32_t iRemain = iCount > 7 ? iCount - 7 : 0;
+ iCount -= iRemain;
+ CFX_WideString wsMsg;
+ for (int32_t i = 0; i < iCount; i++) {
+ wsMsg += m_arrNullTestMsg[i] + L"\n";
+ }
+ if (iRemain > 0) {
+ CFX_WideString wsTemp;
+ wsTemp.Format(
+ L"Message limit exceeded. Remaining %d "
+ L"validation errors not reported.",
+ iRemain);
+ wsMsg += L"\n" + wsTemp;
+ }
+ pAppProvider->MsgBox(wsMsg, pAppProvider->GetAppTitle(), XFA_MBICON_Status,
+ XFA_MB_OK);
+ }
+ m_arrNullTestMsg.clear();
+}
+
+void CXFA_FFDocView::UpdateDocView() {
+ if (IsUpdateLocked())
+ return;
+
+ LockUpdate();
+ for (CXFA_Node* pNode : m_NewAddedNodes) {
+ InitCalculate(pNode);
+ InitValidate(pNode);
+ ExecEventActivityByDeepFirst(pNode, XFA_EVENT_Ready, true, true, nullptr);
+ }
+ m_NewAddedNodes.clear();
+ RunSubformIndexChange();
+ RunCalculateWidgets();
+ RunValidate();
+ ShowNullTestMsg();
+ if (RunLayout() && m_bLayoutEvent)
+ RunEventLayoutReady();
+
+ m_bLayoutEvent = false;
+ m_CalculateAccs.clear();
+ RunInvalidate();
+ UnlockUpdate();
+}
+
+int32_t CXFA_FFDocView::CountPageViews() {
+ if (!m_pXFADocLayout) {
+ return 0;
+ }
+ return m_pXFADocLayout->CountPages();
+}
+CXFA_FFPageView* CXFA_FFDocView::GetPageView(int32_t nIndex) {
+ if (!m_pXFADocLayout) {
+ return nullptr;
+ }
+ return static_cast<CXFA_FFPageView*>(m_pXFADocLayout->GetPage(nIndex));
+}
+
+CXFA_LayoutProcessor* CXFA_FFDocView::GetXFALayout() const {
+ return m_pDoc->GetXFADoc()->GetDocLayout();
+}
+bool CXFA_FFDocView::ResetSingleWidgetAccData(CXFA_WidgetAcc* pWidgetAcc) {
+ CXFA_Node* pNode = pWidgetAcc->GetNode();
+ XFA_Element eType = pNode->GetElementType();
+ if (eType != XFA_Element::Field && eType != XFA_Element::ExclGroup) {
+ return false;
+ }
+ pWidgetAcc->ResetData();
+ pWidgetAcc->UpdateUIDisplay();
+ if (CXFA_Validate validate = pWidgetAcc->GetValidate()) {
+ AddValidateWidget(pWidgetAcc);
+ validate.GetNode()->SetFlag(XFA_NodeFlag_NeedsInitApp, false);
+ }
+ return true;
+}
+void CXFA_FFDocView::ResetWidgetData(CXFA_WidgetAcc* pWidgetAcc) {
+ m_bLayoutEvent = true;
+ bool bChanged = false;
+ CXFA_Node* pFormNode = nullptr;
+ if (pWidgetAcc) {
+ bChanged = ResetSingleWidgetAccData(pWidgetAcc);
+ pFormNode = pWidgetAcc->GetNode();
+ } else {
+ pFormNode = GetRootSubform();
+ }
+ if (!pFormNode) {
+ return;
+ }
+ if (pFormNode->GetElementType() != XFA_Element::Field &&
+ pFormNode->GetElementType() != XFA_Element::ExclGroup) {
+ CXFA_WidgetAccIterator Iterator(pFormNode);
+ while (CXFA_WidgetAcc* pAcc = Iterator.MoveToNext()) {
+ bChanged |= ResetSingleWidgetAccData(pAcc);
+ if (pAcc->GetNode()->GetElementType() == XFA_Element::ExclGroup) {
+ Iterator.SkipTree();
+ }
+ }
+ }
+ if (bChanged) {
+ m_pDoc->GetDocEnvironment()->SetChangeMark(m_pDoc);
+ }
+}
+int32_t CXFA_FFDocView::ProcessWidgetEvent(CXFA_EventParam* pParam,
+ CXFA_WidgetAcc* pWidgetAcc) {
+ if (!pParam)
+ return XFA_EVENTERROR_Error;
+
+ if (pParam->m_eType == XFA_EVENT_Validate) {
+ CFX_WideString wsValidateStr(L"preSubmit");
+ CXFA_Node* pConfigItem =
+ ToNode(m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Config));
+ if (pConfigItem) {
+ CXFA_Node* pValidateNode = nullptr;
+ CXFA_Node* pAcrobatNode = pConfigItem->GetChild(0, XFA_Element::Acrobat);
+ pValidateNode = pAcrobatNode
+ ? pAcrobatNode->GetChild(0, XFA_Element::Validate)
+ : nullptr;
+ if (!pValidateNode) {
+ CXFA_Node* pPresentNode =
+ pConfigItem->GetChild(0, XFA_Element::Present);
+ pValidateNode = pPresentNode
+ ? pPresentNode->GetChild(0, XFA_Element::Validate)
+ : nullptr;
+ }
+ if (pValidateNode)
+ wsValidateStr = pValidateNode->GetContent();
+ }
+
+ if (wsValidateStr.Find(L"preSubmit") == -1)
+ return XFA_EVENTERROR_Success;
+ }
+
+ CXFA_Node* pNode = pWidgetAcc ? pWidgetAcc->GetNode() : nullptr;
+ if (!pNode) {
+ CXFA_Node* pRootItem =
+ ToNode(m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form));
+ if (!pRootItem)
+ return XFA_EVENTERROR_Error;
+
+ pNode = pRootItem->GetChild(0, XFA_Element::Subform);
+ }
+ ExecEventActivityByDeepFirst(pNode, pParam->m_eType, pParam->m_bIsFormReady,
+ true, nullptr);
+ return XFA_EVENTERROR_Success;
+}
+
+CXFA_FFWidgetHandler* CXFA_FFDocView::GetWidgetHandler() {
+ if (!m_pWidgetHandler)
+ m_pWidgetHandler = pdfium::MakeUnique<CXFA_FFWidgetHandler>(this);
+
+ return m_pWidgetHandler.get();
+}
+
+CXFA_WidgetAccIterator* CXFA_FFDocView::CreateWidgetAccIterator(
+ XFA_WIDGETORDER eOrder) {
+ CXFA_Node* pFormRoot = GetRootSubform();
+ return pFormRoot ? new CXFA_WidgetAccIterator(pFormRoot) : nullptr;
+}
+
+CXFA_FFWidget* CXFA_FFDocView::GetFocusWidget() {
+ return m_pFocusWidget;
+}
+
+void CXFA_FFDocView::KillFocus() {
+ if (m_pFocusWidget &&
+ (m_pFocusWidget->GetStatus() & XFA_WidgetStatus_Focused)) {
+ (m_pFocusWidget)->OnKillFocus(nullptr);
+ }
+ m_pFocusAcc = nullptr;
+ m_pFocusWidget = nullptr;
+ m_pOldFocusWidget = nullptr;
+}
+bool CXFA_FFDocView::SetFocus(CXFA_FFWidget* hWidget) {
+ CXFA_FFWidget* pNewFocus = hWidget;
+ if (m_pOldFocusWidget == pNewFocus) {
+ return false;
+ }
+ CXFA_FFWidget* pOldFocus = m_pOldFocusWidget;
+ m_pOldFocusWidget = pNewFocus;
+ if (pOldFocus) {
+ if (m_pFocusWidget != m_pOldFocusWidget &&
+ (pOldFocus->GetStatus() & XFA_WidgetStatus_Focused)) {
+ m_pFocusWidget = pOldFocus;
+ pOldFocus->OnKillFocus(pNewFocus);
+ } else if ((pOldFocus->GetStatus() & XFA_WidgetStatus_Visible)) {
+ if (!pOldFocus->IsLoaded()) {
+ pOldFocus->LoadWidget();
+ }
+ pOldFocus->OnSetFocus(m_pFocusWidget);
+ m_pFocusWidget = pOldFocus;
+ pOldFocus->OnKillFocus(pNewFocus);
+ }
+ }
+ if (m_pFocusWidget == m_pOldFocusWidget) {
+ return false;
+ }
+ pNewFocus = m_pOldFocusWidget;
+ if (m_pListFocusWidget && pNewFocus == m_pListFocusWidget) {
+ m_pFocusAcc = nullptr;
+ m_pFocusWidget = nullptr;
+ m_pListFocusWidget = nullptr;
+ m_pOldFocusWidget = nullptr;
+ return false;
+ }
+ if (pNewFocus && (pNewFocus->GetStatus() & XFA_WidgetStatus_Visible)) {
+ if (!pNewFocus->IsLoaded()) {
+ pNewFocus->LoadWidget();
+ }
+ pNewFocus->OnSetFocus(m_pFocusWidget);
+ }
+ m_pFocusAcc = pNewFocus ? pNewFocus->GetDataAcc() : nullptr;
+ m_pFocusWidget = pNewFocus;
+ m_pOldFocusWidget = m_pFocusWidget;
+ return true;
+}
+CXFA_WidgetAcc* CXFA_FFDocView::GetFocusWidgetAcc() {
+ return m_pFocusAcc;
+}
+void CXFA_FFDocView::SetFocusWidgetAcc(CXFA_WidgetAcc* pWidgetAcc) {
+ CXFA_FFWidget* pNewFocus =
+ pWidgetAcc ? pWidgetAcc->GetNextWidget(nullptr) : nullptr;
+ if (SetFocus(pNewFocus)) {
+ m_pFocusAcc = pWidgetAcc;
+ if (m_iStatus == XFA_DOCVIEW_LAYOUTSTATUS_End) {
+ m_pDoc->GetDocEnvironment()->SetFocusWidget(m_pDoc, m_pFocusWidget);
+ }
+ }
+}
+void CXFA_FFDocView::DeleteLayoutItem(CXFA_FFWidget* pWidget) {
+ if (m_pFocusAcc == pWidget->GetDataAcc()) {
+ m_pFocusAcc = nullptr;
+ m_pFocusWidget = nullptr;
+ m_pOldFocusWidget = nullptr;
+ }
+}
+static int32_t XFA_ProcessEvent(CXFA_FFDocView* pDocView,
+ CXFA_WidgetAcc* pWidgetAcc,
+ CXFA_EventParam* pParam) {
+ if (!pParam || pParam->m_eType == XFA_EVENT_Unknown) {
+ return XFA_EVENTERROR_NotExist;
+ }
+ if (!pWidgetAcc || pWidgetAcc->GetElementType() == XFA_Element::Draw) {
+ return XFA_EVENTERROR_NotExist;
+ }
+ switch (pParam->m_eType) {
+ case XFA_EVENT_Calculate:
+ return pWidgetAcc->ProcessCalculate();
+ case XFA_EVENT_Validate:
+ if (((CXFA_FFDoc*)pDocView->GetDoc())
+ ->GetDocEnvironment()
+ ->IsValidationsEnabled(pDocView->GetDoc())) {
+ return pWidgetAcc->ProcessValidate(0x01);
+ }
+ return XFA_EVENTERROR_Disabled;
+ case XFA_EVENT_InitCalculate: {
+ CXFA_Calculate calc = pWidgetAcc->GetCalculate();
+ if (!calc) {
+ return XFA_EVENTERROR_NotExist;
+ }
+ if (pWidgetAcc->GetNode()->IsUserInteractive())
+ return XFA_EVENTERROR_Disabled;
+
+ CXFA_Script script = calc.GetScript();
+ return pWidgetAcc->ExecuteScript(script, pParam);
+ }
+ default:
+ break;
+ }
+ int32_t iRet =
+ pWidgetAcc->ProcessEvent(gs_EventActivity[pParam->m_eType], pParam);
+ return iRet;
+}
+int32_t CXFA_FFDocView::ExecEventActivityByDeepFirst(CXFA_Node* pFormNode,
+ XFA_EVENTTYPE eEventType,
+ bool bIsFormReady,
+ bool bRecursive,
+ CXFA_Node* pExclude) {
+ int32_t iRet = XFA_EVENTERROR_NotExist;
+ if (pFormNode == pExclude) {
+ return iRet;
+ }
+ XFA_Element elementType = pFormNode->GetElementType();
+ if (elementType == XFA_Element::Field) {
+ if (eEventType == XFA_EVENT_IndexChange) {
+ return iRet;
+ }
+ CXFA_WidgetAcc* pWidgetAcc = (CXFA_WidgetAcc*)pFormNode->GetWidgetData();
+ if (!pWidgetAcc) {
+ return iRet;
+ }
+ CXFA_EventParam eParam;
+ eParam.m_eType = eEventType;
+ eParam.m_pTarget = pWidgetAcc;
+ eParam.m_bIsFormReady = bIsFormReady;
+ return XFA_ProcessEvent(this, pWidgetAcc, &eParam);
+ }
+ if (bRecursive) {
+ for (CXFA_Node* pNode = pFormNode->GetNodeItem(
+ XFA_NODEITEM_FirstChild, XFA_ObjectType::ContainerNode);
+ pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling,
+ XFA_ObjectType::ContainerNode)) {
+ elementType = pNode->GetElementType();
+ if (elementType != XFA_Element::Variables &&
+ elementType != XFA_Element::Draw) {
+ iRet |= ExecEventActivityByDeepFirst(pNode, eEventType, bIsFormReady,
+ bRecursive, pExclude);
+ }
+ }
+ }
+ CXFA_WidgetAcc* pWidgetAcc = (CXFA_WidgetAcc*)pFormNode->GetWidgetData();
+ if (!pWidgetAcc) {
+ return iRet;
+ }
+ CXFA_EventParam eParam;
+ eParam.m_eType = eEventType;
+ eParam.m_pTarget = pWidgetAcc;
+ eParam.m_bIsFormReady = bIsFormReady;
+ iRet |= XFA_ProcessEvent(this, pWidgetAcc, &eParam);
+ return iRet;
+}
+
+CXFA_FFWidget* CXFA_FFDocView::GetWidgetByName(const CFX_WideString& wsName,
+ CXFA_FFWidget* pRefWidget) {
+ CXFA_WidgetAcc* pRefAcc = pRefWidget ? pRefWidget->GetDataAcc() : nullptr;
+ CXFA_WidgetAcc* pAcc = GetWidgetAccByName(wsName, pRefAcc);
+ return pAcc ? pAcc->GetNextWidget(nullptr) : nullptr;
+}
+
+CXFA_WidgetAcc* CXFA_FFDocView::GetWidgetAccByName(
+ const CFX_WideString& wsName,
+ CXFA_WidgetAcc* pRefWidgetAcc) {
+ CFX_WideString wsExpression;
+ uint32_t dwStyle = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties |
+ XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent;
+ CXFA_ScriptContext* pScriptContext = m_pDoc->GetXFADoc()->GetScriptContext();
+ if (!pScriptContext) {
+ return nullptr;
+ }
+ CXFA_Node* refNode = nullptr;
+ if (pRefWidgetAcc) {
+ refNode = pRefWidgetAcc->GetNode();
+ wsExpression = wsName;
+ } else {
+ wsExpression = L"$form." + wsName;
+ }
+ XFA_RESOLVENODE_RS resoveNodeRS;
+ int32_t iRet = pScriptContext->ResolveObjects(
+ refNode, wsExpression.AsStringC(), resoveNodeRS, dwStyle);
+ if (iRet < 1) {
+ return nullptr;
+ }
+ if (resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) {
+ CXFA_Node* pNode = resoveNodeRS.objects.front()->AsNode();
+ if (pNode)
+ return static_cast<CXFA_WidgetAcc*>(pNode->GetWidgetData());
+ }
+ return nullptr;
+}
+
+void CXFA_FFDocView::OnPageEvent(CXFA_ContainerLayoutItem* pSender,
+ uint32_t dwEvent) {
+ CXFA_FFPageView* pFFPageView = static_cast<CXFA_FFPageView*>(pSender);
+ m_pDoc->GetDocEnvironment()->PageViewEvent(pFFPageView, dwEvent);
+}
+
+void CXFA_FFDocView::LockUpdate() {
+ m_iLock++;
+}
+void CXFA_FFDocView::UnlockUpdate() {
+ m_iLock--;
+}
+bool CXFA_FFDocView::IsUpdateLocked() {
+ return m_iLock > 0;
+}
+void CXFA_FFDocView::ClearInvalidateList() {
+ m_mapPageInvalidate.clear();
+}
+void CXFA_FFDocView::AddInvalidateRect(CXFA_FFWidget* pWidget,
+ const CFX_RectF& rtInvalidate) {
+ AddInvalidateRect(pWidget->GetPageView(), rtInvalidate);
+}
+
+void CXFA_FFDocView::AddInvalidateRect(CXFA_FFPageView* pPageView,
+ const CFX_RectF& rtInvalidate) {
+ if (m_mapPageInvalidate[pPageView]) {
+ m_mapPageInvalidate[pPageView]->Union(rtInvalidate);
+ return;
+ }
+ m_mapPageInvalidate[pPageView] = pdfium::MakeUnique<CFX_RectF>(rtInvalidate);
+}
+
+void CXFA_FFDocView::RunInvalidate() {
+ for (const auto& pair : m_mapPageInvalidate)
+ m_pDoc->GetDocEnvironment()->InvalidateRect(pair.first, *pair.second);
+ m_mapPageInvalidate.clear();
+}
+
+bool CXFA_FFDocView::RunLayout() {
+ LockUpdate();
+ m_bInLayoutStatus = true;
+ if (!m_pXFADocLayout->IncrementLayout() &&
+ m_pXFADocLayout->StartLayout() < 100) {
+ m_pXFADocLayout->DoLayout();
+ UnlockUpdate();
+ m_bInLayoutStatus = false;
+ m_pDoc->GetDocEnvironment()->PageViewEvent(nullptr,
+ XFA_PAGEVIEWEVENT_StopLayout);
+ return true;
+ }
+ m_bInLayoutStatus = false;
+ m_pDoc->GetDocEnvironment()->PageViewEvent(nullptr,
+ XFA_PAGEVIEWEVENT_StopLayout);
+ UnlockUpdate();
+ return false;
+}
+
+void CXFA_FFDocView::RunSubformIndexChange() {
+ for (CXFA_Node* pSubformNode : m_IndexChangedSubforms) {
+ CXFA_WidgetAcc* pWidgetAcc =
+ static_cast<CXFA_WidgetAcc*>(pSubformNode->GetWidgetData());
+ if (!pWidgetAcc)
+ continue;
+
+ CXFA_EventParam eParam;
+ eParam.m_eType = XFA_EVENT_IndexChange;
+ eParam.m_pTarget = pWidgetAcc;
+ pWidgetAcc->ProcessEvent(XFA_ATTRIBUTEENUM_IndexChange, &eParam);
+ }
+ m_IndexChangedSubforms.clear();
+}
+
+void CXFA_FFDocView::AddNewFormNode(CXFA_Node* pNode) {
+ m_NewAddedNodes.push_back(pNode);
+ InitLayout(pNode);
+}
+
+void CXFA_FFDocView::AddIndexChangedSubform(CXFA_Node* pNode) {
+ ASSERT(pNode->GetElementType() == XFA_Element::Subform);
+ m_IndexChangedSubforms.push_back(pNode);
+}
+
+void CXFA_FFDocView::RunDocClose() {
+ CXFA_Node* pRootItem =
+ ToNode(m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form));
+ if (!pRootItem) {
+ return;
+ }
+ ExecEventActivityByDeepFirst(pRootItem, XFA_EVENT_DocClose, false, true,
+ nullptr);
+}
+
+void CXFA_FFDocView::DestroyDocView() {
+ ClearInvalidateList();
+ m_iStatus = XFA_DOCVIEW_LAYOUTSTATUS_None;
+ m_iLock = 0;
+ m_ValidateAccs.clear();
+ m_BindItems.clear();
+ m_CalculateAccs.clear();
+}
+
+bool CXFA_FFDocView::IsStaticNotify() {
+ return m_pDoc->GetDocType() == XFA_DocType::Static;
+}
+
+void CXFA_FFDocView::AddCalculateWidgetAcc(CXFA_WidgetAcc* pWidgetAcc) {
+ CXFA_WidgetAcc* pCurrentAcc =
+ !m_CalculateAccs.empty() ? m_CalculateAccs.back() : nullptr;
+ if (pCurrentAcc != pWidgetAcc)
+ m_CalculateAccs.push_back(pWidgetAcc);
+}
+
+void CXFA_FFDocView::AddCalculateNodeNotify(CXFA_Node* pNodeChange) {
+ auto* pGlobalData =
+ static_cast<CXFA_CalcData*>(pNodeChange->GetUserData(XFA_CalcData));
+ if (!pGlobalData)
+ return;
+
+ for (auto* pResultAcc : pGlobalData->m_Globals) {
+ if (!pResultAcc->GetNode()->HasRemovedChildren())
+ AddCalculateWidgetAcc(pResultAcc);
+ }
+}
+
+void CXFA_FFDocView::RunCalculateRecursive(int32_t& iIndex) {
+ while (iIndex < pdfium::CollectionSize<int32_t>(m_CalculateAccs)) {
+ CXFA_WidgetAcc* pCurAcc = m_CalculateAccs[iIndex];
+ AddCalculateNodeNotify(pCurAcc->GetNode());
+ int32_t iRefCount =
+ (int32_t)(uintptr_t)pCurAcc->GetNode()->GetUserData(XFA_CalcRefCount);
+ iRefCount++;
+ pCurAcc->GetNode()->SetUserData(XFA_CalcRefCount,
+ (void*)(uintptr_t)iRefCount);
+ if (iRefCount > 11) {
+ break;
+ }
+ if ((pCurAcc->ProcessCalculate()) == XFA_EVENTERROR_Success) {
+ AddValidateWidget(pCurAcc);
+ }
+ iIndex++;
+ RunCalculateRecursive(iIndex);
+ }
+}
+
+int32_t CXFA_FFDocView::RunCalculateWidgets() {
+ if (!m_pDoc->GetDocEnvironment()->IsCalculationsEnabled(m_pDoc)) {
+ return XFA_EVENTERROR_Disabled;
+ }
+ int32_t iCounts = pdfium::CollectionSize<int32_t>(m_CalculateAccs);
+ int32_t iIndex = 0;
+ if (iCounts > 0)
+ RunCalculateRecursive(iIndex);
+
+ for (CXFA_WidgetAcc* pCurAcc : m_CalculateAccs)
+ pCurAcc->GetNode()->SetUserData(XFA_CalcRefCount, (void*)(uintptr_t)0);
+
+ m_CalculateAccs.clear();
+ return XFA_EVENTERROR_Success;
+}
+
+void CXFA_FFDocView::AddValidateWidget(CXFA_WidgetAcc* pWidget) {
+ if (!pdfium::ContainsValue(m_ValidateAccs, pWidget))
+ m_ValidateAccs.push_back(pWidget);
+}
+
+bool CXFA_FFDocView::InitCalculate(CXFA_Node* pNode) {
+ ExecEventActivityByDeepFirst(pNode, XFA_EVENT_InitCalculate, false, true,
+ nullptr);
+ return true;
+}
+
+bool CXFA_FFDocView::InitValidate(CXFA_Node* pNode) {
+ if (!m_pDoc->GetDocEnvironment()->IsValidationsEnabled(m_pDoc))
+ return false;
+
+ ExecEventActivityByDeepFirst(pNode, XFA_EVENT_Validate, false, true, nullptr);
+ m_ValidateAccs.clear();
+ return true;
+}
+
+bool CXFA_FFDocView::RunValidate() {
+ if (!m_pDoc->GetDocEnvironment()->IsValidationsEnabled(m_pDoc))
+ return false;
+
+ for (CXFA_WidgetAcc* pAcc : m_ValidateAccs) {
+ if (!pAcc->GetNode()->HasRemovedChildren())
+ pAcc->ProcessValidate();
+ }
+ m_ValidateAccs.clear();
+ return true;
+}
+bool CXFA_FFDocView::RunEventLayoutReady() {
+ CXFA_Node* pRootItem =
+ ToNode(m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form));
+ if (!pRootItem) {
+ return false;
+ }
+ ExecEventActivityByDeepFirst(pRootItem, XFA_EVENT_Ready, false, true,
+ nullptr);
+ RunLayout();
+ return true;
+}
+
+void CXFA_FFDocView::RunBindItems() {
+ for (auto* item : m_BindItems) {
+ if (item->HasRemovedChildren())
+ continue;
+
+ CXFA_Node* pWidgetNode = item->GetNodeItem(XFA_NODEITEM_Parent);
+ CXFA_WidgetAcc* pAcc =
+ static_cast<CXFA_WidgetAcc*>(pWidgetNode->GetWidgetData());
+ if (!pAcc)
+ continue;
+
+ CXFA_BindItems binditems(item);
+ CXFA_ScriptContext* pScriptContext =
+ pWidgetNode->GetDocument()->GetScriptContext();
+ CFX_WideStringC wsRef;
+ binditems.GetRef(wsRef);
+ uint32_t dwStyle = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties |
+ XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent |
+ XFA_RESOLVENODE_ALL;
+ XFA_RESOLVENODE_RS rs;
+ pScriptContext->ResolveObjects(pWidgetNode, wsRef, rs, dwStyle);
+ pAcc->DeleteItem(-1);
+ if (rs.dwFlags != XFA_RESOVENODE_RSTYPE_Nodes || rs.objects.empty())
+ continue;
+
+ CFX_WideStringC wsValueRef, wsLabelRef;
+ binditems.GetValueRef(wsValueRef);
+ binditems.GetLabelRef(wsLabelRef);
+ const bool bUseValue = wsLabelRef.IsEmpty() || wsLabelRef == wsValueRef;
+ const bool bLabelUseContent = wsLabelRef.IsEmpty() || wsLabelRef == L"$";
+ const bool bValueUseContent = wsValueRef.IsEmpty() || wsValueRef == L"$";
+ CFX_WideString wsValue;
+ CFX_WideString wsLabel;
+ uint32_t uValueHash = FX_HashCode_GetW(wsValueRef, false);
+ for (CXFA_Object* refObject : rs.objects) {
+ CXFA_Node* refNode = refObject->AsNode();
+ if (!refNode)
+ continue;
+ if (bValueUseContent) {
+ wsValue = refNode->GetContent();
+ } else {
+ CXFA_Node* nodeValue = refNode->GetFirstChildByName(uValueHash);
+ wsValue = nodeValue ? nodeValue->GetContent() : refNode->GetContent();
+ }
+ if (!bUseValue) {
+ if (bLabelUseContent) {
+ wsLabel = refNode->GetContent();
+ } else {
+ CXFA_Node* nodeLabel = refNode->GetFirstChildByName(wsLabelRef);
+ if (nodeLabel)
+ wsLabel = nodeLabel->GetContent();
+ }
+ } else {
+ wsLabel = wsValue;
+ }
+ pAcc->InsertItem(wsLabel, wsValue);
+ }
+ }
+ m_BindItems.clear();
+}
+
+void CXFA_FFDocView::SetChangeMark() {
+ if (m_iStatus < XFA_DOCVIEW_LAYOUTSTATUS_End) {
+ return;
+ }
+ m_pDoc->GetDocEnvironment()->SetChangeMark(m_pDoc);
+}
+CXFA_Node* CXFA_FFDocView::GetRootSubform() {
+ CXFA_Node* pFormPacketNode =
+ ToNode(m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form));
+ if (!pFormPacketNode) {
+ return nullptr;
+ }
+ return pFormPacketNode->GetFirstChildByClass(XFA_Element::Subform);
+}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/cxfa_ffdocview.h b/chromium/third_party/pdfium/xfa/fxfa/cxfa_ffdocview.h
new file mode 100644
index 00000000000..05ed9d70867
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fxfa/cxfa_ffdocview.h
@@ -0,0 +1,135 @@
+// 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 XFA_FXFA_CXFA_FFDOCVIEW_H_
+#define XFA_FXFA_CXFA_FFDOCVIEW_H_
+
+#include <map>
+#include <memory>
+#include <vector>
+
+#include "xfa/fxfa/cxfa_eventparam.h"
+#include "xfa/fxfa/cxfa_ffdoc.h"
+
+class CXFA_FFWidgetHandler;
+class CXFA_FFDoc;
+class CXFA_FFWidget;
+class CXFA_WidgetAccIterator;
+
+extern const XFA_ATTRIBUTEENUM gs_EventActivity[];
+enum XFA_DOCVIEW_LAYOUTSTATUS {
+ XFA_DOCVIEW_LAYOUTSTATUS_None,
+ XFA_DOCVIEW_LAYOUTSTATUS_Start,
+ XFA_DOCVIEW_LAYOUTSTATUS_FormInitialize,
+ XFA_DOCVIEW_LAYOUTSTATUS_FormInitCalculate,
+ XFA_DOCVIEW_LAYOUTSTATUS_FormInitValidate,
+ XFA_DOCVIEW_LAYOUTSTATUS_FormFormReady,
+ XFA_DOCVIEW_LAYOUTSTATUS_Doing,
+ XFA_DOCVIEW_LAYOUTSTATUS_PagesetInitialize,
+ XFA_DOCVIEW_LAYOUTSTATUS_PagesetInitCalculate,
+ XFA_DOCVIEW_LAYOUTSTATUS_PagesetInitValidate,
+ XFA_DOCVIEW_LAYOUTSTATUS_PagesetFormReady,
+ XFA_DOCVIEW_LAYOUTSTATUS_LayoutReady,
+ XFA_DOCVIEW_LAYOUTSTATUS_DocReady,
+ XFA_DOCVIEW_LAYOUTSTATUS_End
+};
+
+class CXFA_FFDocView {
+ public:
+ explicit CXFA_FFDocView(CXFA_FFDoc* pDoc);
+ ~CXFA_FFDocView();
+
+ CXFA_FFDoc* GetDoc() { return m_pDoc; }
+ int32_t StartLayout(int32_t iStartPage = 0);
+ int32_t DoLayout(IFX_Pause* pPause);
+ void StopLayout();
+ int32_t GetLayoutStatus();
+ void UpdateDocView();
+ int32_t CountPageViews();
+ CXFA_FFPageView* GetPageView(int32_t nIndex);
+
+ void ResetWidgetData(CXFA_WidgetAcc* pWidgetAcc);
+ int32_t ProcessWidgetEvent(CXFA_EventParam* pParam,
+ CXFA_WidgetAcc* pWidgetAcc);
+ CXFA_FFWidgetHandler* GetWidgetHandler();
+ CXFA_WidgetAccIterator* CreateWidgetAccIterator(
+ XFA_WIDGETORDER eOrder = XFA_WIDGETORDER_PreOrder);
+ CXFA_FFWidget* GetFocusWidget();
+ void KillFocus();
+ bool SetFocus(CXFA_FFWidget* hWidget);
+ CXFA_FFWidget* GetWidgetByName(const CFX_WideString& wsName,
+ CXFA_FFWidget* pRefWidget);
+ CXFA_WidgetAcc* GetWidgetAccByName(const CFX_WideString& wsName,
+ CXFA_WidgetAcc* pRefWidgetAcc);
+ CXFA_LayoutProcessor* GetXFALayout() const;
+ void OnPageEvent(CXFA_ContainerLayoutItem* pSender, uint32_t dwEvent);
+ void LockUpdate();
+ void UnlockUpdate();
+ bool IsUpdateLocked();
+ void ClearInvalidateList();
+ void AddInvalidateRect(CXFA_FFWidget* pWidget, const CFX_RectF& rtInvalidate);
+ void AddInvalidateRect(CXFA_FFPageView* pPageView,
+ const CFX_RectF& rtInvalidate);
+ void RunInvalidate();
+ void RunDocClose();
+ void DestroyDocView();
+
+ bool InitValidate(CXFA_Node* pNode);
+ bool RunValidate();
+
+ void SetChangeMark();
+
+ void AddValidateWidget(CXFA_WidgetAcc* pWidget);
+ void AddCalculateNodeNotify(CXFA_Node* pNodeChange);
+ void AddCalculateWidgetAcc(CXFA_WidgetAcc* pWidgetAcc);
+ int32_t RunCalculateWidgets();
+ bool IsStaticNotify();
+ bool RunLayout();
+ void RunSubformIndexChange();
+ void AddNewFormNode(CXFA_Node* pNode);
+ void AddIndexChangedSubform(CXFA_Node* pNode);
+ CXFA_WidgetAcc* GetFocusWidgetAcc();
+ void SetFocusWidgetAcc(CXFA_WidgetAcc* pWidgetAcc);
+ void DeleteLayoutItem(CXFA_FFWidget* pWidget);
+ int32_t ExecEventActivityByDeepFirst(CXFA_Node* pFormNode,
+ XFA_EVENTTYPE eEventType,
+ bool bIsFormReady,
+ bool bRecursive,
+ CXFA_Node* pExclude);
+ bool m_bLayoutEvent;
+ std::vector<CFX_WideString> m_arrNullTestMsg;
+ CXFA_FFWidget* m_pListFocusWidget;
+ bool m_bInLayoutStatus;
+
+ private:
+ friend class CXFA_FFNotify;
+
+ bool RunEventLayoutReady();
+ void RunBindItems();
+ bool InitCalculate(CXFA_Node* pNode);
+ void InitLayout(CXFA_Node* pNode);
+ void RunCalculateRecursive(int32_t& iIndex);
+ void ShowNullTestMsg();
+ bool ResetSingleWidgetAccData(CXFA_WidgetAcc* pWidgetAcc);
+ CXFA_Node* GetRootSubform();
+
+ CXFA_FFDoc* const m_pDoc;
+ std::unique_ptr<CXFA_FFWidgetHandler> m_pWidgetHandler;
+ CXFA_LayoutProcessor* m_pXFADocLayout; // not owned.
+ CXFA_WidgetAcc* m_pFocusAcc; // not owned.
+ CXFA_FFWidget* m_pFocusWidget; // not owned.
+ CXFA_FFWidget* m_pOldFocusWidget; // not owned.
+ std::map<CXFA_FFPageView*, std::unique_ptr<CFX_RectF>> m_mapPageInvalidate;
+ std::vector<CXFA_WidgetAcc*> m_ValidateAccs;
+ std::vector<CXFA_WidgetAcc*> m_CalculateAccs;
+ std::vector<CXFA_Node*> m_BindItems;
+ std::vector<CXFA_Node*> m_NewAddedNodes;
+ std::vector<CXFA_Node*> m_IndexChangedSubforms;
+ XFA_DOCVIEW_LAYOUTSTATUS m_iStatus;
+ int32_t m_iLock;
+};
+
+#endif // XFA_FXFA_CXFA_FFDOCVIEW_H_
diff --git a/chromium/third_party/pdfium/xfa/fxfa/cxfa_ffpageview.cpp b/chromium/third_party/pdfium/xfa/fxfa/cxfa_ffpageview.cpp
new file mode 100644
index 00000000000..49033bc0ded
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fxfa/cxfa_ffpageview.cpp
@@ -0,0 +1,464 @@
+// 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
+
+#include "xfa/fxfa/cxfa_ffpageview.h"
+
+#include <algorithm>
+#include <memory>
+#include <vector>
+
+#include "third_party/base/ptr_util.h"
+#include "third_party/base/stl_util.h"
+#include "xfa/fde/cfde_rendercontext.h"
+#include "xfa/fxfa/app/xfa_ffcheckbutton.h"
+#include "xfa/fxfa/app/xfa_ffchoicelist.h"
+#include "xfa/fxfa/app/xfa_fffield.h"
+#include "xfa/fxfa/app/xfa_ffimageedit.h"
+#include "xfa/fxfa/app/xfa_ffpushbutton.h"
+#include "xfa/fxfa/app/xfa_fftextedit.h"
+#include "xfa/fxfa/app/xfa_fwladapter.h"
+#include "xfa/fxfa/cxfa_ffdoc.h"
+#include "xfa/fxfa/cxfa_ffdocview.h"
+#include "xfa/fxfa/cxfa_ffwidget.h"
+#include "xfa/fxfa/parser/cxfa_node.h"
+
+namespace {
+
+CFX_Matrix GetPageMatrix(const CFX_RectF& docPageRect,
+ const CFX_Rect& devicePageRect,
+ int32_t iRotate,
+ uint32_t dwCoordinatesType) {
+ ASSERT(iRotate >= 0 && iRotate <= 3);
+
+ bool bFlipX = (dwCoordinatesType & 0x01) != 0;
+ bool bFlipY = (dwCoordinatesType & 0x02) != 0;
+ CFX_Matrix m((bFlipX ? -1.0f : 1.0f), 0, 0, (bFlipY ? -1.0f : 1.0f), 0, 0);
+ if (iRotate == 0 || iRotate == 2) {
+ m.a *= (float)devicePageRect.width / docPageRect.width;
+ m.d *= (float)devicePageRect.height / docPageRect.height;
+ } else {
+ m.a *= (float)devicePageRect.height / docPageRect.width;
+ m.d *= (float)devicePageRect.width / docPageRect.height;
+ }
+ m.Rotate(iRotate * 1.57079632675f);
+ switch (iRotate) {
+ case 0:
+ m.e = bFlipX ? (float)devicePageRect.right() : (float)devicePageRect.left;
+ m.f = bFlipY ? (float)devicePageRect.bottom() : (float)devicePageRect.top;
+ break;
+ case 1:
+ m.e = bFlipY ? (float)devicePageRect.left : (float)devicePageRect.right();
+ m.f = bFlipX ? (float)devicePageRect.bottom() : (float)devicePageRect.top;
+ break;
+ case 2:
+ m.e = bFlipX ? (float)devicePageRect.left : (float)devicePageRect.right();
+ m.f = bFlipY ? (float)devicePageRect.top : (float)devicePageRect.bottom();
+ break;
+ case 3:
+ m.e = bFlipY ? (float)devicePageRect.right() : (float)devicePageRect.left;
+ m.f = bFlipX ? (float)devicePageRect.top : (float)devicePageRect.bottom();
+ break;
+ default:
+ break;
+ }
+ return m;
+}
+
+bool PageWidgetFilter(CXFA_FFWidget* pWidget,
+ uint32_t dwFilter,
+ bool bTraversal,
+ bool bIgnorerelevant) {
+ CXFA_WidgetAcc* pWidgetAcc = pWidget->GetDataAcc();
+
+ if (!!(dwFilter & XFA_WidgetStatus_Focused) &&
+ pWidgetAcc->GetElementType() != XFA_Element::Field) {
+ return false;
+ }
+
+ uint32_t dwStatus = pWidget->GetStatus();
+ if (bTraversal && (dwStatus & XFA_WidgetStatus_Disabled))
+ return false;
+ if (bIgnorerelevant)
+ return !!(dwStatus & XFA_WidgetStatus_Visible);
+
+ dwFilter &= (XFA_WidgetStatus_Visible | XFA_WidgetStatus_Viewable |
+ XFA_WidgetStatus_Printable);
+ return (dwFilter & dwStatus) == dwFilter;
+}
+
+bool IsLayoutElement(XFA_Element eElement, bool bLayoutContainer) {
+ switch (eElement) {
+ case XFA_Element::Draw:
+ case XFA_Element::Field:
+ case XFA_Element::InstanceManager:
+ return !bLayoutContainer;
+ case XFA_Element::Area:
+ case XFA_Element::Subform:
+ case XFA_Element::ExclGroup:
+ case XFA_Element::SubformSet:
+ case XFA_Element::PageArea:
+ case XFA_Element::Form:
+ return true;
+ default:
+ return false;
+ }
+}
+
+} // namespace
+
+CXFA_FFPageView::CXFA_FFPageView(CXFA_FFDocView* pDocView, CXFA_Node* pPageArea)
+ : CXFA_ContainerLayoutItem(pPageArea), m_pDocView(pDocView) {}
+
+CXFA_FFPageView::~CXFA_FFPageView() {}
+
+CXFA_FFDocView* CXFA_FFPageView::GetDocView() const {
+ return m_pDocView;
+}
+
+CFX_RectF CXFA_FFPageView::GetPageViewRect() const {
+ return CFX_RectF(0, 0, GetPageSize());
+}
+
+CFX_Matrix CXFA_FFPageView::GetDisplayMatrix(const CFX_Rect& rtDisp,
+ int32_t iRotate) const {
+ return GetPageMatrix(CFX_RectF(0, 0, GetPageSize()), rtDisp, iRotate, 0);
+}
+
+IXFA_WidgetIterator* CXFA_FFPageView::CreateWidgetIterator(
+ uint32_t dwTraverseWay,
+ uint32_t dwWidgetFilter) {
+ switch (dwTraverseWay) {
+ case XFA_TRAVERSEWAY_Tranvalse:
+ return new CXFA_FFTabOrderPageWidgetIterator(this, dwWidgetFilter);
+ case XFA_TRAVERSEWAY_Form:
+ return new CXFA_FFPageWidgetIterator(this, dwWidgetFilter);
+ }
+ return nullptr;
+}
+
+CXFA_FFPageWidgetIterator::CXFA_FFPageWidgetIterator(CXFA_FFPageView* pPageView,
+ uint32_t dwFilter)
+ : m_pPageView(pPageView), m_dwFilter(dwFilter), m_sIterator(pPageView) {
+ m_bIgnorerelevant =
+ m_pPageView->GetDocView()->GetDoc()->GetXFADoc()->GetCurVersionMode() <
+ XFA_VERSION_205;
+}
+
+CXFA_FFPageWidgetIterator::~CXFA_FFPageWidgetIterator() {}
+
+void CXFA_FFPageWidgetIterator::Reset() {
+ m_sIterator.Reset();
+}
+
+CXFA_FFWidget* CXFA_FFPageWidgetIterator::MoveToFirst() {
+ m_sIterator.Reset();
+ for (CXFA_LayoutItem* pLayoutItem = m_sIterator.GetCurrent(); pLayoutItem;
+ pLayoutItem = m_sIterator.MoveToNext()) {
+ if (CXFA_FFWidget* hWidget = GetWidget(pLayoutItem)) {
+ return hWidget;
+ }
+ }
+ return nullptr;
+}
+
+CXFA_FFWidget* CXFA_FFPageWidgetIterator::MoveToLast() {
+ m_sIterator.SetCurrent(nullptr);
+ return MoveToPrevious();
+}
+
+CXFA_FFWidget* CXFA_FFPageWidgetIterator::MoveToNext() {
+ for (CXFA_LayoutItem* pLayoutItem = m_sIterator.MoveToNext(); pLayoutItem;
+ pLayoutItem = m_sIterator.MoveToNext()) {
+ if (CXFA_FFWidget* hWidget = GetWidget(pLayoutItem)) {
+ return hWidget;
+ }
+ }
+ return nullptr;
+}
+
+CXFA_FFWidget* CXFA_FFPageWidgetIterator::MoveToPrevious() {
+ for (CXFA_LayoutItem* pLayoutItem = m_sIterator.MoveToPrev(); pLayoutItem;
+ pLayoutItem = m_sIterator.MoveToPrev()) {
+ if (CXFA_FFWidget* hWidget = GetWidget(pLayoutItem)) {
+ return hWidget;
+ }
+ }
+ return nullptr;
+}
+
+CXFA_FFWidget* CXFA_FFPageWidgetIterator::GetCurrentWidget() {
+ CXFA_LayoutItem* pLayoutItem = m_sIterator.GetCurrent();
+ return pLayoutItem ? XFA_GetWidgetFromLayoutItem(pLayoutItem) : nullptr;
+}
+
+bool CXFA_FFPageWidgetIterator::SetCurrentWidget(CXFA_FFWidget* hWidget) {
+ return hWidget && m_sIterator.SetCurrent(hWidget);
+}
+
+CXFA_FFWidget* CXFA_FFPageWidgetIterator::GetWidget(
+ CXFA_LayoutItem* pLayoutItem) {
+ CXFA_FFWidget* pWidget = XFA_GetWidgetFromLayoutItem(pLayoutItem);
+ if (!pWidget)
+ return nullptr;
+
+ if (!PageWidgetFilter(pWidget, m_dwFilter, false, m_bIgnorerelevant))
+ return nullptr;
+
+ if (!pWidget->IsLoaded() &&
+ !!(pWidget->GetStatus() & XFA_WidgetStatus_Visible)) {
+ pWidget->LoadWidget();
+ }
+ return pWidget;
+}
+
+void CXFA_TabParam::AppendTabParam(CXFA_TabParam* pParam) {
+ m_Children.push_back(pParam->GetWidget());
+ m_Children.insert(m_Children.end(), pParam->GetChildren().begin(),
+ pParam->GetChildren().end());
+}
+
+void CXFA_TabParam::ClearChildren() {
+ m_Children.clear();
+}
+
+CXFA_FFTabOrderPageWidgetIterator::CXFA_FFTabOrderPageWidgetIterator(
+ CXFA_FFPageView* pPageView,
+ uint32_t dwFilter)
+ : m_pPageView(pPageView), m_dwFilter(dwFilter), m_iCurWidget(-1) {
+ m_bIgnorerelevant =
+ m_pPageView->GetDocView()->GetDoc()->GetXFADoc()->GetCurVersionMode() <
+ XFA_VERSION_205;
+ Reset();
+}
+
+CXFA_FFTabOrderPageWidgetIterator::~CXFA_FFTabOrderPageWidgetIterator() {}
+
+void CXFA_FFTabOrderPageWidgetIterator::Reset() {
+ CreateTabOrderWidgetArray();
+ m_iCurWidget = -1;
+}
+
+CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::MoveToFirst() {
+ for (int32_t i = 0;
+ i < pdfium::CollectionSize<int32_t>(m_TabOrderWidgetArray); i++) {
+ if (PageWidgetFilter(m_TabOrderWidgetArray[i], m_dwFilter, true,
+ m_bIgnorerelevant)) {
+ m_iCurWidget = i;
+ return m_TabOrderWidgetArray[m_iCurWidget];
+ }
+ }
+ return nullptr;
+}
+
+CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::MoveToLast() {
+ for (int32_t i = pdfium::CollectionSize<int32_t>(m_TabOrderWidgetArray) - 1;
+ i >= 0; i--) {
+ if (PageWidgetFilter(m_TabOrderWidgetArray[i], m_dwFilter, true,
+ m_bIgnorerelevant)) {
+ m_iCurWidget = i;
+ return m_TabOrderWidgetArray[m_iCurWidget];
+ }
+ }
+ return nullptr;
+}
+
+CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::MoveToNext() {
+ for (int32_t i = m_iCurWidget + 1;
+ i < pdfium::CollectionSize<int32_t>(m_TabOrderWidgetArray); i++) {
+ if (PageWidgetFilter(m_TabOrderWidgetArray[i], m_dwFilter, true,
+ m_bIgnorerelevant)) {
+ m_iCurWidget = i;
+ return m_TabOrderWidgetArray[m_iCurWidget];
+ }
+ }
+ m_iCurWidget = -1;
+ return nullptr;
+}
+
+CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::MoveToPrevious() {
+ for (int32_t i = m_iCurWidget - 1; i >= 0; i--) {
+ if (PageWidgetFilter(m_TabOrderWidgetArray[i], m_dwFilter, true,
+ m_bIgnorerelevant)) {
+ m_iCurWidget = i;
+ return m_TabOrderWidgetArray[m_iCurWidget];
+ }
+ }
+ m_iCurWidget = -1;
+ return nullptr;
+}
+
+CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::GetCurrentWidget() {
+ return m_iCurWidget >= 0 ? m_TabOrderWidgetArray[m_iCurWidget] : nullptr;
+}
+
+bool CXFA_FFTabOrderPageWidgetIterator::SetCurrentWidget(
+ CXFA_FFWidget* hWidget) {
+ auto it = std::find(m_TabOrderWidgetArray.begin(),
+ m_TabOrderWidgetArray.end(), hWidget);
+ if (it == m_TabOrderWidgetArray.end())
+ return false;
+
+ m_iCurWidget = it - m_TabOrderWidgetArray.begin();
+ return true;
+}
+
+CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::GetTraverseWidget(
+ CXFA_FFWidget* pWidget) {
+ CXFA_WidgetAcc* pAcc = pWidget->GetDataAcc();
+ CXFA_Node* pTraversal = pAcc->GetNode()->GetChild(0, XFA_Element::Traversal);
+ if (pTraversal) {
+ CXFA_Node* pTraverse = pTraversal->GetChild(0, XFA_Element::Traverse);
+ if (pTraverse) {
+ CFX_WideString wsTraverseWidgetName;
+ if (pTraverse->GetAttribute(XFA_ATTRIBUTE_Ref, wsTraverseWidgetName)) {
+ return FindWidgetByName(wsTraverseWidgetName, pWidget);
+ }
+ }
+ }
+ return nullptr;
+}
+CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::FindWidgetByName(
+ const CFX_WideString& wsWidgetName,
+ CXFA_FFWidget* pRefWidget) {
+ return pRefWidget->GetDocView()->GetWidgetByName(wsWidgetName, pRefWidget);
+}
+
+void CXFA_FFTabOrderPageWidgetIterator::CreateTabOrderWidgetArray() {
+ m_TabOrderWidgetArray.clear();
+
+ std::vector<CXFA_FFWidget*> SpaceOrderWidgetArray;
+ CreateSpaceOrderWidgetArray(&SpaceOrderWidgetArray);
+ if (SpaceOrderWidgetArray.empty())
+ return;
+
+ int32_t nWidgetCount = pdfium::CollectionSize<int32_t>(SpaceOrderWidgetArray);
+ CXFA_FFWidget* hWidget = SpaceOrderWidgetArray[0];
+ while (pdfium::CollectionSize<int32_t>(m_TabOrderWidgetArray) <
+ nWidgetCount) {
+ if (!pdfium::ContainsValue(m_TabOrderWidgetArray, hWidget)) {
+ m_TabOrderWidgetArray.push_back(hWidget);
+ CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc();
+ if (pWidgetAcc->GetUIType() == XFA_Element::ExclGroup) {
+ auto it = std::find(SpaceOrderWidgetArray.begin(),
+ SpaceOrderWidgetArray.end(), hWidget);
+ int32_t iWidgetIndex = it != SpaceOrderWidgetArray.end()
+ ? it - SpaceOrderWidgetArray.begin() + 1
+ : 0;
+ while (true) {
+ CXFA_FFWidget* pRadio =
+ SpaceOrderWidgetArray[iWidgetIndex % nWidgetCount];
+ if (pRadio->GetDataAcc()->GetExclGroup() != pWidgetAcc) {
+ break;
+ }
+ if (!pdfium::ContainsValue(m_TabOrderWidgetArray, hWidget)) {
+ m_TabOrderWidgetArray.push_back(pRadio);
+ }
+ iWidgetIndex++;
+ }
+ }
+ if (CXFA_FFWidget* hTraverseWidget = GetTraverseWidget(hWidget)) {
+ hWidget = hTraverseWidget;
+ continue;
+ }
+ }
+ auto it = std::find(SpaceOrderWidgetArray.begin(),
+ SpaceOrderWidgetArray.end(), hWidget);
+ int32_t iWidgetIndex = it != SpaceOrderWidgetArray.end()
+ ? it - SpaceOrderWidgetArray.begin() + 1
+ : 0;
+ hWidget = SpaceOrderWidgetArray[iWidgetIndex % nWidgetCount];
+ }
+}
+
+void CXFA_FFTabOrderPageWidgetIterator::OrderContainer(
+ CXFA_LayoutItemIterator* sIterator,
+ CXFA_LayoutItem* pContainerItem,
+ CXFA_TabParam* pContainer,
+ bool& bCurrentItem,
+ bool& bContentArea,
+ bool bMarsterPage) {
+ std::vector<std::unique_ptr<CXFA_TabParam>> tabParams;
+ CXFA_LayoutItem* pSearchItem = sIterator->MoveToNext();
+ while (pSearchItem) {
+ if (!pSearchItem->IsContentLayoutItem()) {
+ bContentArea = true;
+ pSearchItem = sIterator->MoveToNext();
+ continue;
+ }
+ if (bMarsterPage && bContentArea) {
+ break;
+ }
+ if (bMarsterPage || bContentArea) {
+ CXFA_FFWidget* hWidget = GetWidget(pSearchItem);
+ if (!hWidget) {
+ pSearchItem = sIterator->MoveToNext();
+ continue;
+ }
+ if (pContainerItem && (pSearchItem->GetParent() != pContainerItem)) {
+ bCurrentItem = true;
+ break;
+ }
+ tabParams.push_back(pdfium::MakeUnique<CXFA_TabParam>(hWidget));
+ if (IsLayoutElement(pSearchItem->GetFormNode()->GetElementType(), true)) {
+ OrderContainer(sIterator, pSearchItem, tabParams.back().get(),
+ bCurrentItem, bContentArea, bMarsterPage);
+ }
+ }
+ if (bCurrentItem) {
+ pSearchItem = sIterator->GetCurrent();
+ bCurrentItem = false;
+ } else {
+ pSearchItem = sIterator->MoveToNext();
+ }
+ }
+ std::sort(tabParams.begin(), tabParams.end(),
+ [](const std::unique_ptr<CXFA_TabParam>& arg1,
+ const std::unique_ptr<CXFA_TabParam>& arg2) {
+ const CFX_RectF& rt1 = arg1->GetWidget()->GetWidgetRect();
+ const CFX_RectF& rt2 = arg2->GetWidget()->GetWidgetRect();
+ if (rt1.top - rt2.top >= XFA_FLOAT_PERCISION)
+ return rt1.top < rt2.top;
+ return rt1.left < rt2.left;
+ });
+ for (const auto& pParam : tabParams)
+ pContainer->AppendTabParam(pParam.get());
+}
+
+void CXFA_FFTabOrderPageWidgetIterator::CreateSpaceOrderWidgetArray(
+ std::vector<CXFA_FFWidget*>* WidgetArray) {
+ CXFA_LayoutItemIterator sIterator(m_pPageView);
+ auto pParam = pdfium::MakeUnique<CXFA_TabParam>(nullptr);
+ bool bCurrentItem = false;
+ bool bContentArea = false;
+ OrderContainer(&sIterator, nullptr, pParam.get(), bCurrentItem, bContentArea);
+ WidgetArray->insert(WidgetArray->end(), pParam->GetChildren().begin(),
+ pParam->GetChildren().end());
+
+ sIterator.Reset();
+ bCurrentItem = false;
+ bContentArea = false;
+ pParam->ClearChildren();
+ OrderContainer(&sIterator, nullptr, pParam.get(), bCurrentItem, bContentArea,
+ true);
+ WidgetArray->insert(WidgetArray->end(), pParam->GetChildren().begin(),
+ pParam->GetChildren().end());
+}
+
+CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::GetWidget(
+ CXFA_LayoutItem* pLayoutItem) {
+ if (CXFA_FFWidget* pWidget = XFA_GetWidgetFromLayoutItem(pLayoutItem)) {
+ if (!pWidget->IsLoaded() &&
+ (pWidget->GetStatus() & XFA_WidgetStatus_Visible)) {
+ pWidget->LoadWidget();
+ }
+ return pWidget;
+ }
+ return nullptr;
+}
+
+CXFA_TabParam::CXFA_TabParam(CXFA_FFWidget* pWidget) : m_pWidget(pWidget) {}
+
+CXFA_TabParam::~CXFA_TabParam() {}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/cxfa_ffpageview.h b/chromium/third_party/pdfium/xfa/fxfa/cxfa_ffpageview.h
new file mode 100644
index 00000000000..df4fc6d2c17
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fxfa/cxfa_ffpageview.h
@@ -0,0 +1,114 @@
+// Copyrig 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 XFA_FXFA_CXFA_FFPAGEVIEW_H_
+#define XFA_FXFA_CXFA_FFPAGEVIEW_H_
+
+#include <vector>
+
+#include "xfa/fxfa/parser/cxfa_containerlayoutitem.h"
+#include "xfa/fxfa/parser/cxfa_contentlayoutitem.h"
+#include "xfa/fxfa/parser/cxfa_traversestrategy_layoutitem.h"
+#include "xfa/fxfa/parser/xfa_utils.h"
+
+class CXFA_FFWidget;
+class CXFA_FFDocView;
+
+class CXFA_FFPageView : public CXFA_ContainerLayoutItem {
+ public:
+ CXFA_FFPageView(CXFA_FFDocView* pDocView, CXFA_Node* pPageArea);
+ ~CXFA_FFPageView() override;
+
+ CXFA_FFDocView* GetDocView() const;
+ CFX_RectF GetPageViewRect() const;
+ CFX_Matrix GetDisplayMatrix(const CFX_Rect& rtDisp, int32_t iRotate) const;
+ IXFA_WidgetIterator* CreateWidgetIterator(
+ uint32_t dwTraverseWay = XFA_TRAVERSEWAY_Form,
+ uint32_t dwWidgetFilter = XFA_WidgetStatus_Visible |
+ XFA_WidgetStatus_Viewable);
+
+ protected:
+ CXFA_FFDocView* const m_pDocView;
+};
+
+typedef CXFA_NodeIteratorTemplate<CXFA_LayoutItem,
+ CXFA_TraverseStrategy_LayoutItem>
+ CXFA_LayoutItemIterator;
+
+class CXFA_FFPageWidgetIterator : public IXFA_WidgetIterator {
+ public:
+ CXFA_FFPageWidgetIterator(CXFA_FFPageView* pPageView, uint32_t dwFilter);
+ ~CXFA_FFPageWidgetIterator() override;
+
+ void Reset() override;
+ CXFA_FFWidget* MoveToFirst() override;
+ CXFA_FFWidget* MoveToLast() override;
+ CXFA_FFWidget* MoveToNext() override;
+ CXFA_FFWidget* MoveToPrevious() override;
+ CXFA_FFWidget* GetCurrentWidget() override;
+ bool SetCurrentWidget(CXFA_FFWidget* hWidget) override;
+
+ protected:
+ CXFA_FFWidget* GetWidget(CXFA_LayoutItem* pLayoutItem);
+
+ CXFA_FFPageView* m_pPageView;
+ CXFA_FFWidget* m_hCurWidget;
+ uint32_t m_dwFilter;
+ bool m_bIgnorerelevant;
+ CXFA_LayoutItemIterator m_sIterator;
+};
+
+class CXFA_TabParam {
+ public:
+ explicit CXFA_TabParam(CXFA_FFWidget* pWidget);
+ ~CXFA_TabParam();
+
+ void AppendTabParam(CXFA_TabParam* pParam);
+ void ClearChildren();
+ CXFA_FFWidget* GetWidget() { return m_pWidget; }
+ const std::vector<CXFA_FFWidget*>& GetChildren() const { return m_Children; }
+
+ private:
+ CXFA_FFWidget* const m_pWidget;
+ std::vector<CXFA_FFWidget*> m_Children;
+};
+
+class CXFA_FFTabOrderPageWidgetIterator : public IXFA_WidgetIterator {
+ public:
+ CXFA_FFTabOrderPageWidgetIterator(CXFA_FFPageView* pPageView,
+ uint32_t dwFilter);
+ ~CXFA_FFTabOrderPageWidgetIterator() override;
+
+ void Reset() override;
+ CXFA_FFWidget* MoveToFirst() override;
+ CXFA_FFWidget* MoveToLast() override;
+ CXFA_FFWidget* MoveToNext() override;
+ CXFA_FFWidget* MoveToPrevious() override;
+ CXFA_FFWidget* GetCurrentWidget() override;
+ bool SetCurrentWidget(CXFA_FFWidget* hWidget) override;
+
+ protected:
+ CXFA_FFWidget* GetTraverseWidget(CXFA_FFWidget* pWidget);
+ CXFA_FFWidget* FindWidgetByName(const CFX_WideString& wsWidgetName,
+ CXFA_FFWidget* pRefWidget);
+ void CreateTabOrderWidgetArray();
+ void CreateSpaceOrderWidgetArray(std::vector<CXFA_FFWidget*>* WidgetArray);
+ CXFA_FFWidget* GetWidget(CXFA_LayoutItem* pLayoutItem);
+ void OrderContainer(CXFA_LayoutItemIterator* sIterator,
+ CXFA_LayoutItem* pContainerItem,
+ CXFA_TabParam* pContainer,
+ bool& bCurrentItem,
+ bool& bContentArea,
+ bool bMarsterPage = false);
+
+ std::vector<CXFA_FFWidget*> m_TabOrderWidgetArray;
+ CXFA_FFPageView* m_pPageView;
+ uint32_t m_dwFilter;
+ int32_t m_iCurWidget;
+ bool m_bIgnorerelevant;
+};
+
+#endif // XFA_FXFA_CXFA_FFPAGEVIEW_H_
diff --git a/chromium/third_party/pdfium/xfa/fxfa/cxfa_ffwidget.cpp b/chromium/third_party/pdfium/xfa/fxfa/cxfa_ffwidget.cpp
new file mode 100644
index 00000000000..18d6f94bc71
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fxfa/cxfa_ffwidget.cpp
@@ -0,0 +1,2049 @@
+// 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
+
+#include "xfa/fxfa/cxfa_ffwidget.h"
+
+#include <algorithm>
+#include <memory>
+#include <vector>
+
+#include "core/fpdfapi/page/cpdf_pageobjectholder.h"
+#include "core/fxcodec/codec/ccodec_progressivedecoder.h"
+#include "core/fxcodec/fx_codec.h"
+#include "core/fxcrt/cfx_maybe_owned.h"
+#include "core/fxge/cfx_gemodule.h"
+#include "core/fxge/cfx_pathdata.h"
+#include "core/fxge/cfx_renderdevice.h"
+#include "core/fxge/dib/cfx_imagerenderer.h"
+#include "core/fxge/dib/cfx_imagetransformer.h"
+#include "xfa/fwl/fwl_widgethit.h"
+#include "xfa/fxfa/app/cxfa_textlayout.h"
+#include "xfa/fxfa/cxfa_eventparam.h"
+#include "xfa/fxfa/cxfa_ffapp.h"
+#include "xfa/fxfa/cxfa_ffdoc.h"
+#include "xfa/fxfa/cxfa_ffdocview.h"
+#include "xfa/fxfa/cxfa_ffpageview.h"
+#include "xfa/fxfa/cxfa_widgetacc.h"
+#include "xfa/fxfa/parser/cxfa_corner.h"
+#include "xfa/fxfa/parser/cxfa_node.h"
+#include "xfa/fxgraphics/cfx_color.h"
+#include "xfa/fxgraphics/cfx_graphics.h"
+#include "xfa/fxgraphics/cfx_path.h"
+#include "xfa/fxgraphics/cfx_pattern.h"
+#include "xfa/fxgraphics/cfx_shading.h"
+
+CXFA_FFWidget::CXFA_FFWidget(CXFA_WidgetAcc* pDataAcc)
+ : CXFA_ContentLayoutItem(pDataAcc->GetNode()),
+ m_pPageView(nullptr),
+ m_pDataAcc(pDataAcc) {}
+
+CXFA_FFWidget::~CXFA_FFWidget() {}
+
+const CFWL_App* CXFA_FFWidget::GetFWLApp() {
+ return GetPageView()->GetDocView()->GetDoc()->GetApp()->GetFWLApp();
+}
+
+const CFX_RectF& CXFA_FFWidget::GetWidgetRect() const {
+ if ((m_dwStatus & XFA_WidgetStatus_RectCached) == 0)
+ RecacheWidgetRect();
+ return m_rtWidget;
+}
+
+const CFX_RectF& CXFA_FFWidget::RecacheWidgetRect() const {
+ m_dwStatus |= XFA_WidgetStatus_RectCached;
+ m_rtWidget = GetRect(false);
+ return m_rtWidget;
+}
+
+CFX_RectF CXFA_FFWidget::GetRectWithoutRotate() {
+ CFX_RectF rtWidget = GetWidgetRect();
+ float fValue = 0;
+ switch (m_pDataAcc->GetRotate()) {
+ case 90:
+ rtWidget.top = rtWidget.bottom();
+ fValue = rtWidget.width;
+ rtWidget.width = rtWidget.height;
+ rtWidget.height = fValue;
+ break;
+ case 180:
+ rtWidget.left = rtWidget.right();
+ rtWidget.top = rtWidget.bottom();
+ break;
+ case 270:
+ rtWidget.left = rtWidget.right();
+ fValue = rtWidget.width;
+ rtWidget.width = rtWidget.height;
+ rtWidget.height = fValue;
+ break;
+ }
+ return rtWidget;
+}
+
+uint32_t CXFA_FFWidget::GetStatus() {
+ return m_dwStatus;
+}
+
+void CXFA_FFWidget::ModifyStatus(uint32_t dwAdded, uint32_t dwRemoved) {
+ m_dwStatus = (m_dwStatus & ~dwRemoved) | dwAdded;
+}
+
+CFX_RectF CXFA_FFWidget::GetBBox(uint32_t dwStatus, bool bDrawFocus) {
+ if (bDrawFocus || !m_pPageView)
+ return CFX_RectF();
+ return m_pPageView->GetPageViewRect();
+}
+
+CXFA_WidgetAcc* CXFA_FFWidget::GetDataAcc() {
+ return m_pDataAcc;
+}
+
+bool CXFA_FFWidget::GetToolTip(CFX_WideString& wsToolTip) {
+ if (CXFA_Assist assist = m_pDataAcc->GetAssist()) {
+ if (CXFA_ToolTip toolTip = assist.GetToolTip()) {
+ return toolTip.GetTip(wsToolTip);
+ }
+ }
+ return GetCaptionText(wsToolTip);
+}
+
+void CXFA_FFWidget::RenderWidget(CFX_Graphics* pGS,
+ CFX_Matrix* pMatrix,
+ uint32_t dwStatus) {
+ if (!IsMatchVisibleStatus(dwStatus))
+ return;
+
+ CXFA_Border border = m_pDataAcc->GetBorder();
+ if (!border)
+ return;
+
+ CFX_RectF rtBorder = GetRectWithoutRotate();
+ CXFA_Margin margin = border.GetMargin();
+ if (margin)
+ XFA_RectWidthoutMargin(rtBorder, margin);
+
+ rtBorder.Normalize();
+ DrawBorder(pGS, border, rtBorder, pMatrix);
+}
+
+bool CXFA_FFWidget::IsLoaded() {
+ return !!m_pPageView;
+}
+bool CXFA_FFWidget::LoadWidget() {
+ PerformLayout();
+ return true;
+}
+void CXFA_FFWidget::UnloadWidget() {}
+bool CXFA_FFWidget::PerformLayout() {
+ RecacheWidgetRect();
+ return true;
+}
+bool CXFA_FFWidget::UpdateFWLData() {
+ return false;
+}
+void CXFA_FFWidget::UpdateWidgetProperty() {}
+void CXFA_FFWidget::DrawBorder(CFX_Graphics* pGS,
+ CXFA_Box box,
+ const CFX_RectF& rtBorder,
+ CFX_Matrix* pMatrix,
+ uint32_t dwFlags) {
+ XFA_DrawBox(box, pGS, rtBorder, pMatrix, dwFlags);
+}
+
+void CXFA_FFWidget::InvalidateWidget(const CFX_RectF* pRect) {
+ if (pRect) {
+ GetDoc()->GetDocEnvironment()->InvalidateRect(m_pPageView, *pRect);
+ return;
+ }
+
+ CFX_RectF rtWidget = GetBBox(XFA_WidgetStatus_Focused);
+ rtWidget.Inflate(2, 2);
+ GetDoc()->GetDocEnvironment()->InvalidateRect(m_pPageView, rtWidget);
+}
+
+void CXFA_FFWidget::AddInvalidateRect(const CFX_RectF* pRect) {
+ CFX_RectF rtWidget;
+ if (pRect) {
+ rtWidget = *pRect;
+ } else {
+ rtWidget = GetBBox(XFA_WidgetStatus_Focused);
+ rtWidget.Inflate(2, 2);
+ }
+ m_pDocView->AddInvalidateRect(m_pPageView, rtWidget);
+}
+
+bool CXFA_FFWidget::GetCaptionText(CFX_WideString& wsCap) {
+ CXFA_TextLayout* pCapTextlayout = m_pDataAcc->GetCaptionTextLayout();
+ if (!pCapTextlayout) {
+ return false;
+ }
+ pCapTextlayout->GetText(wsCap);
+ return true;
+}
+
+bool CXFA_FFWidget::IsFocused() {
+ return !!(m_dwStatus & XFA_WidgetStatus_Focused);
+}
+
+bool CXFA_FFWidget::OnMouseEnter() {
+ return false;
+}
+
+bool CXFA_FFWidget::OnMouseExit() {
+ return false;
+}
+
+bool CXFA_FFWidget::OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) {
+ return false;
+}
+
+bool CXFA_FFWidget::OnLButtonUp(uint32_t dwFlags, const CFX_PointF& point) {
+ return false;
+}
+
+bool CXFA_FFWidget::OnLButtonDblClk(uint32_t dwFlags, const CFX_PointF& point) {
+ return false;
+}
+
+bool CXFA_FFWidget::OnMouseMove(uint32_t dwFlags, const CFX_PointF& point) {
+ return false;
+}
+
+bool CXFA_FFWidget::OnMouseWheel(uint32_t dwFlags,
+ int16_t zDelta,
+ const CFX_PointF& point) {
+ return false;
+}
+
+bool CXFA_FFWidget::OnRButtonDown(uint32_t dwFlags, const CFX_PointF& point) {
+ return false;
+}
+
+bool CXFA_FFWidget::OnRButtonUp(uint32_t dwFlags, const CFX_PointF& point) {
+ return false;
+}
+
+bool CXFA_FFWidget::OnRButtonDblClk(uint32_t dwFlags, const CFX_PointF& point) {
+ return false;
+}
+
+bool CXFA_FFWidget::OnSetFocus(CXFA_FFWidget* pOldWidget) {
+ CXFA_FFWidget* pParent = GetParent();
+ if (pParent && !pParent->IsAncestorOf(pOldWidget)) {
+ pParent->OnSetFocus(pOldWidget);
+ }
+ m_dwStatus |= XFA_WidgetStatus_Focused;
+ CXFA_EventParam eParam;
+ eParam.m_eType = XFA_EVENT_Enter;
+ eParam.m_pTarget = m_pDataAcc;
+ m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Enter, &eParam);
+ return true;
+}
+
+bool CXFA_FFWidget::OnKillFocus(CXFA_FFWidget* pNewWidget) {
+ m_dwStatus &= ~XFA_WidgetStatus_Focused;
+ EventKillFocus();
+ if (pNewWidget) {
+ CXFA_FFWidget* pParent = GetParent();
+ if (pParent && !pParent->IsAncestorOf(pNewWidget)) {
+ pParent->OnKillFocus(pNewWidget);
+ }
+ }
+ return true;
+}
+
+bool CXFA_FFWidget::OnKeyDown(uint32_t dwKeyCode, uint32_t dwFlags) {
+ return false;
+}
+
+bool CXFA_FFWidget::OnKeyUp(uint32_t dwKeyCode, uint32_t dwFlags) {
+ return false;
+}
+
+bool CXFA_FFWidget::OnChar(uint32_t dwChar, uint32_t dwFlags) {
+ return false;
+}
+
+FWL_WidgetHit CXFA_FFWidget::OnHitTest(const CFX_PointF& point) {
+ return FWL_WidgetHit::Unknown;
+}
+
+bool CXFA_FFWidget::OnSetCursor(const CFX_PointF& point) {
+ return false;
+}
+
+bool CXFA_FFWidget::CanUndo() {
+ return false;
+}
+
+bool CXFA_FFWidget::CanRedo() {
+ return false;
+}
+
+bool CXFA_FFWidget::Undo() {
+ return false;
+}
+
+bool CXFA_FFWidget::Redo() {
+ return false;
+}
+
+bool CXFA_FFWidget::CanCopy() {
+ return false;
+}
+
+bool CXFA_FFWidget::CanCut() {
+ return false;
+}
+
+bool CXFA_FFWidget::CanPaste() {
+ return false;
+}
+
+bool CXFA_FFWidget::CanSelectAll() {
+ return false;
+}
+
+bool CXFA_FFWidget::CanDelete() {
+ return CanCut();
+}
+
+bool CXFA_FFWidget::CanDeSelect() {
+ return CanCopy();
+}
+
+bool CXFA_FFWidget::Copy(CFX_WideString& wsCopy) {
+ return false;
+}
+
+bool CXFA_FFWidget::Cut(CFX_WideString& wsCut) {
+ return false;
+}
+
+bool CXFA_FFWidget::Paste(const CFX_WideString& wsPaste) {
+ return false;
+}
+
+void CXFA_FFWidget::SelectAll() {}
+
+void CXFA_FFWidget::Delete() {}
+
+void CXFA_FFWidget::DeSelect() {}
+
+bool CXFA_FFWidget::GetSuggestWords(CFX_PointF pointf,
+ std::vector<CFX_ByteString>& sSuggest) {
+ return false;
+}
+bool CXFA_FFWidget::ReplaceSpellCheckWord(CFX_PointF pointf,
+ const CFX_ByteStringC& bsReplace) {
+ return false;
+}
+
+CFX_PointF CXFA_FFWidget::Rotate2Normal(const CFX_PointF& point) {
+ CFX_Matrix mt = GetRotateMatrix();
+ if (mt.IsIdentity())
+ return point;
+
+ CFX_Matrix mtReverse;
+ mtReverse.SetReverse(mt);
+ return mtReverse.Transform(point);
+}
+
+static void XFA_GetMatrix(CFX_Matrix& m,
+ int32_t iRotate,
+ XFA_ATTRIBUTEENUM at,
+ const CFX_RectF& rt) {
+ if (!iRotate) {
+ return;
+ }
+ float fAnchorX = 0;
+ float fAnchorY = 0;
+ switch (at) {
+ case XFA_ATTRIBUTEENUM_TopLeft:
+ fAnchorX = rt.left, fAnchorY = rt.top;
+ break;
+ case XFA_ATTRIBUTEENUM_TopCenter:
+ fAnchorX = (rt.left + rt.right()) / 2, fAnchorY = rt.top;
+ break;
+ case XFA_ATTRIBUTEENUM_TopRight:
+ fAnchorX = rt.right(), fAnchorY = rt.top;
+ break;
+ case XFA_ATTRIBUTEENUM_MiddleLeft:
+ fAnchorX = rt.left, fAnchorY = (rt.top + rt.bottom()) / 2;
+ break;
+ case XFA_ATTRIBUTEENUM_MiddleCenter:
+ fAnchorX = (rt.left + rt.right()) / 2,
+ fAnchorY = (rt.top + rt.bottom()) / 2;
+ break;
+ case XFA_ATTRIBUTEENUM_MiddleRight:
+ fAnchorX = rt.right(), fAnchorY = (rt.top + rt.bottom()) / 2;
+ break;
+ case XFA_ATTRIBUTEENUM_BottomLeft:
+ fAnchorX = rt.left, fAnchorY = rt.bottom();
+ break;
+ case XFA_ATTRIBUTEENUM_BottomCenter:
+ fAnchorX = (rt.left + rt.right()) / 2, fAnchorY = rt.bottom();
+ break;
+ case XFA_ATTRIBUTEENUM_BottomRight:
+ fAnchorX = rt.right(), fAnchorY = rt.bottom();
+ break;
+ default:
+ break;
+ }
+ switch (iRotate) {
+ case 90:
+ m.a = 0, m.b = -1, m.c = 1, m.d = 0, m.e = fAnchorX - fAnchorY,
+ m.f = fAnchorX + fAnchorY;
+ break;
+ case 180:
+ m.a = -1, m.b = 0, m.c = 0, m.d = -1, m.e = fAnchorX * 2,
+ m.f = fAnchorY * 2;
+ break;
+ case 270:
+ m.a = 0, m.b = 1, m.c = -1, m.d = 0, m.e = fAnchorX + fAnchorY,
+ m.f = fAnchorY - fAnchorX;
+ break;
+ }
+}
+
+CFX_Matrix CXFA_FFWidget::GetRotateMatrix() {
+ CFX_Matrix mt;
+ int32_t iRotate = m_pDataAcc->GetRotate();
+ if (!iRotate)
+ return mt;
+
+ CFX_RectF rcWidget = GetRectWithoutRotate();
+ XFA_ATTRIBUTEENUM at = XFA_ATTRIBUTEENUM_TopLeft;
+ XFA_GetMatrix(mt, iRotate, at, rcWidget);
+
+ return mt;
+}
+
+bool CXFA_FFWidget::IsLayoutRectEmpty() {
+ CFX_RectF rtLayout = GetRectWithoutRotate();
+ return rtLayout.width < 0.1f && rtLayout.height < 0.1f;
+}
+CXFA_FFWidget* CXFA_FFWidget::GetParent() {
+ CXFA_Node* pParentNode =
+ m_pDataAcc->GetNode()->GetNodeItem(XFA_NODEITEM_Parent);
+ if (pParentNode) {
+ CXFA_WidgetAcc* pParentWidgetAcc =
+ static_cast<CXFA_WidgetAcc*>(pParentNode->GetWidgetData());
+ if (pParentWidgetAcc) {
+ return pParentWidgetAcc->GetNextWidget(nullptr);
+ }
+ }
+ return nullptr;
+}
+
+bool CXFA_FFWidget::IsAncestorOf(CXFA_FFWidget* pWidget) {
+ if (!pWidget)
+ return false;
+
+ CXFA_Node* pNode = m_pDataAcc->GetNode();
+ CXFA_Node* pChildNode = pWidget->GetDataAcc()->GetNode();
+ while (pChildNode) {
+ if (pChildNode == pNode)
+ return true;
+
+ pChildNode = pChildNode->GetNodeItem(XFA_NODEITEM_Parent);
+ }
+ return false;
+}
+
+bool CXFA_FFWidget::PtInActiveRect(const CFX_PointF& point) {
+ return GetWidgetRect().Contains(point);
+}
+
+CXFA_FFDocView* CXFA_FFWidget::GetDocView() {
+ return m_pDocView;
+}
+
+void CXFA_FFWidget::SetDocView(CXFA_FFDocView* pDocView) {
+ m_pDocView = pDocView;
+}
+
+CXFA_FFDoc* CXFA_FFWidget::GetDoc() {
+ return m_pDocView->GetDoc();
+}
+
+CXFA_FFApp* CXFA_FFWidget::GetApp() {
+ return GetDoc()->GetApp();
+}
+
+IXFA_AppProvider* CXFA_FFWidget::GetAppProvider() {
+ return GetApp()->GetAppProvider();
+}
+
+bool CXFA_FFWidget::IsMatchVisibleStatus(uint32_t dwStatus) {
+ return !!(m_dwStatus & XFA_WidgetStatus_Visible);
+}
+
+void CXFA_FFWidget::EventKillFocus() {
+ if (m_dwStatus & XFA_WidgetStatus_Access) {
+ m_dwStatus &= ~XFA_WidgetStatus_Access;
+ return;
+ }
+ CXFA_EventParam eParam;
+ eParam.m_eType = XFA_EVENT_Exit;
+ eParam.m_pTarget = m_pDataAcc;
+ m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Exit, &eParam);
+}
+bool CXFA_FFWidget::IsButtonDown() {
+ return (m_dwStatus & XFA_WidgetStatus_ButtonDown) != 0;
+}
+void CXFA_FFWidget::SetButtonDown(bool bSet) {
+ bSet ? m_dwStatus |= XFA_WidgetStatus_ButtonDown
+ : m_dwStatus &= ~XFA_WidgetStatus_ButtonDown;
+}
+int32_t XFA_StrokeTypeSetLineDash(CFX_Graphics* pGraphics,
+ int32_t iStrokeType,
+ int32_t iCapType) {
+ switch (iStrokeType) {
+ case XFA_ATTRIBUTEENUM_DashDot: {
+ float dashArray[] = {4, 1, 2, 1};
+ if (iCapType != XFA_ATTRIBUTEENUM_Butt) {
+ dashArray[1] = 2;
+ dashArray[3] = 2;
+ }
+ pGraphics->SetLineDash(0, dashArray, 4);
+ return FX_DASHSTYLE_DashDot;
+ }
+ case XFA_ATTRIBUTEENUM_DashDotDot: {
+ float dashArray[] = {4, 1, 2, 1, 2, 1};
+ if (iCapType != XFA_ATTRIBUTEENUM_Butt) {
+ dashArray[1] = 2;
+ dashArray[3] = 2;
+ dashArray[5] = 2;
+ }
+ pGraphics->SetLineDash(0, dashArray, 6);
+ return FX_DASHSTYLE_DashDotDot;
+ }
+ case XFA_ATTRIBUTEENUM_Dashed: {
+ float dashArray[] = {5, 1};
+ if (iCapType != XFA_ATTRIBUTEENUM_Butt) {
+ dashArray[1] = 2;
+ }
+ pGraphics->SetLineDash(0, dashArray, 2);
+ return FX_DASHSTYLE_Dash;
+ }
+ case XFA_ATTRIBUTEENUM_Dotted: {
+ float dashArray[] = {2, 1};
+ if (iCapType != XFA_ATTRIBUTEENUM_Butt) {
+ dashArray[1] = 2;
+ }
+ pGraphics->SetLineDash(0, dashArray, 2);
+ return FX_DASHSTYLE_Dot;
+ }
+ default:
+ break;
+ }
+ pGraphics->SetLineDash(FX_DASHSTYLE_Solid);
+ return FX_DASHSTYLE_Solid;
+}
+CFX_GraphStateData::LineCap XFA_LineCapToFXGE(int32_t iLineCap) {
+ switch (iLineCap) {
+ case XFA_ATTRIBUTEENUM_Round:
+ return CFX_GraphStateData::LineCapRound;
+ case XFA_ATTRIBUTEENUM_Butt:
+ return CFX_GraphStateData::LineCapButt;
+ default:
+ break;
+ }
+ return CFX_GraphStateData::LineCapSquare;
+}
+
+class CXFA_ImageRenderer {
+ public:
+ CXFA_ImageRenderer();
+ ~CXFA_ImageRenderer();
+
+ bool Start(CFX_RenderDevice* pDevice,
+ const CFX_RetainPtr<CFX_DIBSource>& pDIBSource,
+ FX_ARGB bitmap_argb,
+ int bitmap_alpha,
+ const CFX_Matrix* pImage2Device,
+ uint32_t flags,
+ int blendType = FXDIB_BLEND_NORMAL);
+ bool Continue(IFX_Pause* pPause);
+
+ protected:
+ bool StartDIBSource();
+ void CompositeDIBitmap(const CFX_RetainPtr<CFX_DIBitmap>& pDIBitmap,
+ int left,
+ int top,
+ FX_ARGB mask_argb,
+ int bitmap_alpha,
+ int blend_mode,
+ int Transparency);
+
+ CFX_RenderDevice* m_pDevice;
+ int m_Status;
+ CFX_Matrix m_ImageMatrix;
+ CFX_RetainPtr<CFX_DIBSource> m_pDIBSource;
+ CFX_RetainPtr<CFX_DIBitmap> m_pCloneConvert;
+ int m_BitmapAlpha;
+ FX_ARGB m_FillArgb;
+ uint32_t m_Flags;
+ std::unique_ptr<CFX_ImageTransformer> m_pTransformer;
+ std::unique_ptr<CFX_ImageRenderer> m_DeviceHandle;
+ int32_t m_BlendType;
+ bool m_Result;
+ bool m_bPrint;
+};
+
+CXFA_ImageRenderer::CXFA_ImageRenderer()
+ : m_pDevice(nullptr),
+ m_Status(0),
+ m_BitmapAlpha(255),
+ m_FillArgb(0),
+ m_Flags(0),
+ m_DeviceHandle(nullptr),
+ m_BlendType(FXDIB_BLEND_NORMAL),
+ m_Result(true),
+ m_bPrint(false) {}
+
+CXFA_ImageRenderer::~CXFA_ImageRenderer() {}
+
+bool CXFA_ImageRenderer::Start(CFX_RenderDevice* pDevice,
+ const CFX_RetainPtr<CFX_DIBSource>& pDIBSource,
+ FX_ARGB bitmap_argb,
+ int bitmap_alpha,
+ const CFX_Matrix* pImage2Device,
+ uint32_t flags,
+ int blendType) {
+ m_pDevice = pDevice;
+ m_pDIBSource = pDIBSource;
+ m_FillArgb = bitmap_argb;
+ m_BitmapAlpha = bitmap_alpha;
+ m_ImageMatrix = *pImage2Device;
+ m_Flags = flags;
+ m_BlendType = blendType;
+ return StartDIBSource();
+}
+
+bool CXFA_ImageRenderer::StartDIBSource() {
+ if (m_pDevice->StartDIBitsWithBlend(m_pDIBSource, m_BitmapAlpha, m_FillArgb,
+ &m_ImageMatrix, m_Flags, &m_DeviceHandle,
+ m_BlendType)) {
+ if (m_DeviceHandle) {
+ m_Status = 3;
+ return true;
+ }
+ return false;
+ }
+ CFX_FloatRect image_rect_f = m_ImageMatrix.GetUnitRect();
+ FX_RECT image_rect = image_rect_f.GetOuterRect();
+ int dest_width = image_rect.Width();
+ int dest_height = image_rect.Height();
+ if ((fabs(m_ImageMatrix.b) >= 0.5f || m_ImageMatrix.a == 0) ||
+ (fabs(m_ImageMatrix.c) >= 0.5f || m_ImageMatrix.d == 0)) {
+ if (m_bPrint && !(m_pDevice->GetRenderCaps() & FXRC_BLEND_MODE)) {
+ m_Result = false;
+ return false;
+ }
+ CFX_RetainPtr<CFX_DIBSource> pDib = m_pDIBSource;
+ if (m_pDIBSource->HasAlpha() &&
+ !(m_pDevice->GetRenderCaps() & FXRC_ALPHA_IMAGE) &&
+ !(m_pDevice->GetRenderCaps() & FXRC_GET_BITS)) {
+ m_pCloneConvert = m_pDIBSource->CloneConvert(FXDIB_Rgb);
+ if (!m_pCloneConvert) {
+ m_Result = false;
+ return false;
+ }
+ pDib = m_pCloneConvert;
+ }
+ FX_RECT clip_box = m_pDevice->GetClipBox();
+ clip_box.Intersect(image_rect);
+ m_Status = 2;
+ m_pTransformer = pdfium::MakeUnique<CFX_ImageTransformer>(
+ pDib, &m_ImageMatrix, m_Flags, &clip_box);
+ m_pTransformer->Start();
+ return true;
+ }
+ if (m_ImageMatrix.a < 0) {
+ dest_width = -dest_width;
+ }
+ if (m_ImageMatrix.d > 0) {
+ dest_height = -dest_height;
+ }
+ int dest_left, dest_top;
+ dest_left = dest_width > 0 ? image_rect.left : image_rect.right;
+ dest_top = dest_height > 0 ? image_rect.top : image_rect.bottom;
+ if (m_pDIBSource->IsOpaqueImage() && m_BitmapAlpha == 255) {
+ if (m_pDevice->StretchDIBitsWithFlagsAndBlend(
+ m_pDIBSource, dest_left, dest_top, dest_width, dest_height, m_Flags,
+ m_BlendType)) {
+ return false;
+ }
+ }
+ if (m_pDIBSource->IsAlphaMask()) {
+ if (m_BitmapAlpha != 255) {
+ m_FillArgb = FXARGB_MUL_ALPHA(m_FillArgb, m_BitmapAlpha);
+ }
+ if (m_pDevice->StretchBitMaskWithFlags(m_pDIBSource, dest_left, dest_top,
+ dest_width, dest_height, m_FillArgb,
+ m_Flags)) {
+ return false;
+ }
+ }
+ if (m_bPrint && !(m_pDevice->GetRenderCaps() & FXRC_BLEND_MODE)) {
+ m_Result = false;
+ return true;
+ }
+ FX_RECT clip_box = m_pDevice->GetClipBox();
+ FX_RECT dest_rect = clip_box;
+ dest_rect.Intersect(image_rect);
+ FX_RECT dest_clip(
+ dest_rect.left - image_rect.left, dest_rect.top - image_rect.top,
+ dest_rect.right - image_rect.left, dest_rect.bottom - image_rect.top);
+ CFX_RetainPtr<CFX_DIBitmap> pStretched =
+ m_pDIBSource->StretchTo(dest_width, dest_height, m_Flags, &dest_clip);
+ if (pStretched) {
+ CompositeDIBitmap(pStretched, dest_rect.left, dest_rect.top, m_FillArgb,
+ m_BitmapAlpha, m_BlendType, false);
+ }
+ return false;
+}
+
+bool CXFA_ImageRenderer::Continue(IFX_Pause* pPause) {
+ if (m_Status == 2) {
+ if (m_pTransformer->Continue(pPause))
+ return true;
+
+ CFX_RetainPtr<CFX_DIBitmap> pBitmap = m_pTransformer->DetachBitmap();
+ if (!pBitmap)
+ return false;
+
+ if (pBitmap->IsAlphaMask()) {
+ if (m_BitmapAlpha != 255)
+ m_FillArgb = FXARGB_MUL_ALPHA(m_FillArgb, m_BitmapAlpha);
+ m_Result =
+ m_pDevice->SetBitMask(pBitmap, m_pTransformer->result().left,
+ m_pTransformer->result().top, m_FillArgb);
+ } else {
+ if (m_BitmapAlpha != 255)
+ pBitmap->MultiplyAlpha(m_BitmapAlpha);
+ m_Result = m_pDevice->SetDIBitsWithBlend(
+ pBitmap, m_pTransformer->result().left, m_pTransformer->result().top,
+ m_BlendType);
+ }
+ return false;
+ }
+ if (m_Status == 3)
+ return m_pDevice->ContinueDIBits(m_DeviceHandle.get(), pPause);
+
+ return false;
+}
+
+void CXFA_ImageRenderer::CompositeDIBitmap(
+ const CFX_RetainPtr<CFX_DIBitmap>& pDIBitmap,
+ int left,
+ int top,
+ FX_ARGB mask_argb,
+ int bitmap_alpha,
+ int blend_mode,
+ int Transparency) {
+ if (!pDIBitmap) {
+ return;
+ }
+ bool bIsolated = !!(Transparency & PDFTRANS_ISOLATED);
+ bool bGroup = !!(Transparency & PDFTRANS_GROUP);
+ if (blend_mode == FXDIB_BLEND_NORMAL) {
+ if (!pDIBitmap->IsAlphaMask()) {
+ if (bitmap_alpha < 255) {
+ pDIBitmap->MultiplyAlpha(bitmap_alpha);
+ }
+ if (m_pDevice->SetDIBits(pDIBitmap, left, top)) {
+ return;
+ }
+ } else {
+ uint32_t fill_argb = (mask_argb);
+ if (bitmap_alpha < 255) {
+ ((uint8_t*)&fill_argb)[3] =
+ ((uint8_t*)&fill_argb)[3] * bitmap_alpha / 255;
+ }
+ if (m_pDevice->SetBitMask(pDIBitmap, left, top, fill_argb)) {
+ return;
+ }
+ }
+ }
+ bool bBackAlphaRequired = blend_mode && bIsolated;
+ bool bGetBackGround =
+ ((m_pDevice->GetRenderCaps() & FXRC_ALPHA_OUTPUT)) ||
+ (!(m_pDevice->GetRenderCaps() & FXRC_ALPHA_OUTPUT) &&
+ (m_pDevice->GetRenderCaps() & FXRC_GET_BITS) && !bBackAlphaRequired);
+ if (bGetBackGround) {
+ if (bIsolated || !bGroup) {
+ if (pDIBitmap->IsAlphaMask()) {
+ return;
+ }
+ m_pDevice->SetDIBitsWithBlend(pDIBitmap, left, top, blend_mode);
+ } else {
+ FX_RECT rect(left, top, left + pDIBitmap->GetWidth(),
+ top + pDIBitmap->GetHeight());
+ rect.Intersect(m_pDevice->GetClipBox());
+ CFX_RetainPtr<CFX_DIBitmap> pClone;
+ if (m_pDevice->GetBackDrop() && m_pDevice->GetBitmap()) {
+ pClone = m_pDevice->GetBackDrop()->Clone(&rect);
+ CFX_RetainPtr<CFX_DIBitmap> pForeBitmap = m_pDevice->GetBitmap();
+ pClone->CompositeBitmap(0, 0, pClone->GetWidth(), pClone->GetHeight(),
+ pForeBitmap, rect.left, rect.top);
+ left = left >= 0 ? 0 : left;
+ top = top >= 0 ? 0 : top;
+ if (!pDIBitmap->IsAlphaMask())
+ pClone->CompositeBitmap(0, 0, pClone->GetWidth(), pClone->GetHeight(),
+ pDIBitmap, left, top, blend_mode);
+ else
+ pClone->CompositeMask(0, 0, pClone->GetWidth(), pClone->GetHeight(),
+ pDIBitmap, mask_argb, left, top, blend_mode);
+ } else {
+ pClone = pDIBitmap;
+ }
+ if (m_pDevice->GetBackDrop()) {
+ m_pDevice->SetDIBits(pClone, rect.left, rect.top);
+ } else {
+ if (pDIBitmap->IsAlphaMask())
+ return;
+ m_pDevice->SetDIBitsWithBlend(pDIBitmap, rect.left, rect.top,
+ blend_mode);
+ }
+ }
+ return;
+ }
+ if (!pDIBitmap->HasAlpha() ||
+ (m_pDevice->GetRenderCaps() & FXRC_ALPHA_IMAGE)) {
+ return;
+ }
+ CFX_RetainPtr<CFX_DIBitmap> pCloneConvert =
+ pDIBitmap->CloneConvert(FXDIB_Rgb);
+ if (!pCloneConvert)
+ return;
+
+ CXFA_ImageRenderer imageRender;
+ if (!imageRender.Start(m_pDevice, pCloneConvert, m_FillArgb, m_BitmapAlpha,
+ &m_ImageMatrix, m_Flags)) {
+ return;
+ }
+ while (imageRender.Continue(nullptr))
+ continue;
+}
+
+void XFA_DrawImage(CFX_Graphics* pGS,
+ const CFX_RectF& rtImage,
+ CFX_Matrix* pMatrix,
+ const CFX_RetainPtr<CFX_DIBitmap>& pDIBitmap,
+ int32_t iAspect,
+ int32_t iImageXDpi,
+ int32_t iImageYDpi,
+ int32_t iHorzAlign,
+ int32_t iVertAlign) {
+ if (rtImage.IsEmpty())
+ return;
+ if (!pDIBitmap || !pDIBitmap->GetBuffer())
+ return;
+
+ CFX_RectF rtFit(
+ rtImage.TopLeft(),
+ XFA_UnitPx2Pt((float)pDIBitmap->GetWidth(), (float)iImageXDpi),
+ XFA_UnitPx2Pt((float)pDIBitmap->GetHeight(), (float)iImageYDpi));
+ switch (iAspect) {
+ case XFA_ATTRIBUTEENUM_Fit: {
+ float f1 = rtImage.height / rtFit.height;
+ float f2 = rtImage.width / rtFit.width;
+ f1 = std::min(f1, f2);
+ rtFit.height = rtFit.height * f1;
+ rtFit.width = rtFit.width * f1;
+ } break;
+ case XFA_ATTRIBUTEENUM_Actual:
+ break;
+ case XFA_ATTRIBUTEENUM_Height: {
+ float f1 = rtImage.height / rtFit.height;
+ rtFit.height = rtImage.height;
+ rtFit.width = f1 * rtFit.width;
+ } break;
+ case XFA_ATTRIBUTEENUM_None:
+ rtFit.height = rtImage.height;
+ rtFit.width = rtImage.width;
+ break;
+ case XFA_ATTRIBUTEENUM_Width: {
+ float f1 = rtImage.width / rtFit.width;
+ rtFit.width = rtImage.width;
+ rtFit.height = rtFit.height * f1;
+ } break;
+ }
+ if (iHorzAlign == XFA_ATTRIBUTEENUM_Center) {
+ rtFit.left += (rtImage.width - rtFit.width) / 2;
+ } else if (iHorzAlign == XFA_ATTRIBUTEENUM_Right) {
+ rtFit.left = rtImage.right() - rtFit.width;
+ }
+ if (iVertAlign == XFA_ATTRIBUTEENUM_Middle) {
+ rtFit.top += (rtImage.height - rtFit.height) / 2;
+ } else if (iVertAlign == XFA_ATTRIBUTEENUM_Bottom) {
+ rtFit.top = rtImage.bottom() - rtImage.height;
+ }
+ CFX_RenderDevice* pRenderDevice = pGS->GetRenderDevice();
+ pRenderDevice->SaveState();
+
+ CFX_PathData path;
+ path.AppendRect(rtImage.left, rtImage.bottom(), rtImage.right(), rtImage.top);
+ pRenderDevice->SetClip_PathFill(&path, pMatrix, FXFILL_WINDING);
+
+ CFX_Matrix mtImage(1, 0, 0, -1, 0, 1);
+ mtImage.Concat(
+ CFX_Matrix(rtFit.width, 0, 0, rtFit.height, rtFit.left, rtFit.top));
+ mtImage.Concat(*pMatrix);
+
+ CXFA_ImageRenderer imageRender;
+ bool bRet = imageRender.Start(pRenderDevice, pDIBitmap, 0, 255, &mtImage,
+ FXDIB_INTERPOL);
+ while (bRet)
+ bRet = imageRender.Continue(nullptr);
+
+ pRenderDevice->RestoreState(false);
+}
+
+static const uint8_t g_inv_base64[128] = {
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 62, 255,
+ 255, 255, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 255, 255,
+ 255, 255, 255, 255, 255, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
+ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
+ 25, 255, 255, 255, 255, 255, 255, 26, 27, 28, 29, 30, 31, 32, 33,
+ 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
+ 49, 50, 51, 255, 255, 255, 255, 255,
+};
+
+static uint8_t* XFA_RemoveBase64Whitespace(const uint8_t* pStr, int32_t iLen) {
+ uint8_t* pCP;
+ int32_t i = 0, j = 0;
+ if (iLen == 0) {
+ iLen = FXSYS_strlen((char*)pStr);
+ }
+ pCP = FX_Alloc(uint8_t, iLen + 1);
+ for (; i < iLen; i++) {
+ if ((pStr[i] & 128) == 0) {
+ if (g_inv_base64[pStr[i]] != 0xFF || pStr[i] == '=') {
+ pCP[j++] = pStr[i];
+ }
+ }
+ }
+ pCP[j] = '\0';
+ return pCP;
+}
+static int32_t XFA_Base64Decode(const char* pStr, uint8_t* pOutBuffer) {
+ if (!pStr) {
+ return 0;
+ }
+ uint8_t* pBuffer =
+ XFA_RemoveBase64Whitespace((uint8_t*)pStr, FXSYS_strlen((char*)pStr));
+ if (!pBuffer) {
+ return 0;
+ }
+ int32_t iLen = FXSYS_strlen((char*)pBuffer);
+ int32_t i = 0, j = 0;
+ uint32_t dwLimb = 0;
+ for (; i + 3 < iLen; i += 4) {
+ if (pBuffer[i] == '=' || pBuffer[i + 1] == '=' || pBuffer[i + 2] == '=' ||
+ pBuffer[i + 3] == '=') {
+ if (pBuffer[i] == '=' || pBuffer[i + 1] == '=') {
+ break;
+ }
+ if (pBuffer[i + 2] == '=') {
+ dwLimb = ((uint32_t)g_inv_base64[pBuffer[i]] << 6) |
+ ((uint32_t)g_inv_base64[pBuffer[i + 1]]);
+ pOutBuffer[j] = (uint8_t)(dwLimb >> 4) & 0xFF;
+ j++;
+ } else {
+ dwLimb = ((uint32_t)g_inv_base64[pBuffer[i]] << 12) |
+ ((uint32_t)g_inv_base64[pBuffer[i + 1]] << 6) |
+ ((uint32_t)g_inv_base64[pBuffer[i + 2]]);
+ pOutBuffer[j] = (uint8_t)(dwLimb >> 10) & 0xFF;
+ pOutBuffer[j + 1] = (uint8_t)(dwLimb >> 2) & 0xFF;
+ j += 2;
+ }
+ } else {
+ dwLimb = ((uint32_t)g_inv_base64[pBuffer[i]] << 18) |
+ ((uint32_t)g_inv_base64[pBuffer[i + 1]] << 12) |
+ ((uint32_t)g_inv_base64[pBuffer[i + 2]] << 6) |
+ ((uint32_t)g_inv_base64[pBuffer[i + 3]]);
+ pOutBuffer[j] = (uint8_t)(dwLimb >> 16) & 0xff;
+ pOutBuffer[j + 1] = (uint8_t)(dwLimb >> 8) & 0xff;
+ pOutBuffer[j + 2] = (uint8_t)(dwLimb)&0xff;
+ j += 3;
+ }
+ }
+ FX_Free(pBuffer);
+ return j;
+}
+
+static const char g_base64_chars[] =
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+
+char* XFA_Base64Encode(const uint8_t* buf, int32_t buf_len) {
+ char* out = nullptr;
+ int i, j;
+ uint32_t limb;
+ out = FX_Alloc(char, ((buf_len * 8 + 5) / 6) + 5);
+ for (i = 0, j = 0, limb = 0; i + 2 < buf_len; i += 3, j += 4) {
+ limb = ((uint32_t)buf[i] << 16) | ((uint32_t)buf[i + 1] << 8) |
+ ((uint32_t)buf[i + 2]);
+ out[j] = g_base64_chars[(limb >> 18) & 63];
+ out[j + 1] = g_base64_chars[(limb >> 12) & 63];
+ out[j + 2] = g_base64_chars[(limb >> 6) & 63];
+ out[j + 3] = g_base64_chars[(limb)&63];
+ }
+ switch (buf_len - i) {
+ case 0:
+ break;
+ case 1:
+ limb = ((uint32_t)buf[i]);
+ out[j++] = g_base64_chars[(limb >> 2) & 63];
+ out[j++] = g_base64_chars[(limb << 4) & 63];
+ out[j++] = '=';
+ out[j++] = '=';
+ break;
+ case 2:
+ limb = ((uint32_t)buf[i] << 8) | ((uint32_t)buf[i + 1]);
+ out[j++] = g_base64_chars[(limb >> 10) & 63];
+ out[j++] = g_base64_chars[(limb >> 4) & 63];
+ out[j++] = g_base64_chars[(limb << 2) & 63];
+ out[j++] = '=';
+ break;
+ default:
+ break;
+ }
+ out[j] = '\0';
+ return out;
+}
+FXCODEC_IMAGE_TYPE XFA_GetImageType(const CFX_WideString& wsType) {
+ CFX_WideString wsContentType(wsType);
+ wsContentType.MakeLower();
+ if (wsContentType == L"image/jpg")
+ return FXCODEC_IMAGE_JPG;
+ if (wsContentType == L"image/png")
+ return FXCODEC_IMAGE_PNG;
+ if (wsContentType == L"image/gif")
+ return FXCODEC_IMAGE_GIF;
+ if (wsContentType == L"image/bmp")
+ return FXCODEC_IMAGE_BMP;
+ if (wsContentType == L"image/tif")
+ return FXCODEC_IMAGE_TIF;
+ return FXCODEC_IMAGE_UNKNOWN;
+}
+
+CFX_RetainPtr<CFX_DIBitmap> XFA_LoadImageData(CXFA_FFDoc* pDoc,
+ CXFA_Image* pImage,
+ bool& bNameImage,
+ int32_t& iImageXDpi,
+ int32_t& iImageYDpi) {
+ CFX_WideString wsHref;
+ CFX_WideString wsImage;
+ pImage->GetHref(wsHref);
+ pImage->GetContent(wsImage);
+ if (wsHref.IsEmpty() && wsImage.IsEmpty())
+ return nullptr;
+
+ CFX_WideString wsContentType;
+ pImage->GetContentType(wsContentType);
+ FXCODEC_IMAGE_TYPE type = XFA_GetImageType(wsContentType);
+ CFX_ByteString bsContent;
+ uint8_t* pImageBuffer = nullptr;
+ CFX_RetainPtr<IFX_SeekableReadStream> pImageFileRead;
+ if (wsImage.GetLength() > 0) {
+ XFA_ATTRIBUTEENUM iEncoding =
+ (XFA_ATTRIBUTEENUM)pImage->GetTransferEncoding();
+ if (iEncoding == XFA_ATTRIBUTEENUM_Base64) {
+ CFX_ByteString bsData = wsImage.UTF8Encode();
+ int32_t iLength = bsData.GetLength();
+ pImageBuffer = FX_Alloc(uint8_t, iLength);
+ int32_t iRead = XFA_Base64Decode(bsData.c_str(), pImageBuffer);
+ if (iRead > 0) {
+ pImageFileRead = IFX_MemoryStream::Create(pImageBuffer, iRead);
+ }
+ } else {
+ bsContent = CFX_ByteString::FromUnicode(wsImage);
+ pImageFileRead = IFX_MemoryStream::Create(
+ const_cast<uint8_t*>(bsContent.raw_str()), bsContent.GetLength());
+ }
+ } else {
+ CFX_WideString wsURL = wsHref;
+ if (wsURL.Left(7) != L"http://" && wsURL.Left(6) != L"ftp://") {
+ CFX_RetainPtr<CFX_DIBitmap> pBitmap =
+ pDoc->GetPDFNamedImage(wsURL.AsStringC(), iImageXDpi, iImageYDpi);
+ if (pBitmap) {
+ bNameImage = true;
+ return pBitmap;
+ }
+ }
+ pImageFileRead = pDoc->GetDocEnvironment()->OpenLinkedFile(pDoc, wsURL);
+ }
+ if (!pImageFileRead) {
+ FX_Free(pImageBuffer);
+ return nullptr;
+ }
+ bNameImage = false;
+ CFX_RetainPtr<CFX_DIBitmap> pBitmap =
+ XFA_LoadImageFromBuffer(pImageFileRead, type, iImageXDpi, iImageYDpi);
+ FX_Free(pImageBuffer);
+ return pBitmap;
+}
+static FXDIB_Format XFA_GetDIBFormat(FXCODEC_IMAGE_TYPE type,
+ int32_t iComponents,
+ int32_t iBitsPerComponent) {
+ FXDIB_Format dibFormat = FXDIB_Argb;
+ switch (type) {
+ case FXCODEC_IMAGE_BMP:
+ case FXCODEC_IMAGE_JPG:
+ case FXCODEC_IMAGE_TIF: {
+ dibFormat = FXDIB_Rgb32;
+ int32_t bpp = iComponents * iBitsPerComponent;
+ if (bpp <= 24) {
+ dibFormat = FXDIB_Rgb;
+ }
+ } break;
+ case FXCODEC_IMAGE_PNG:
+ default:
+ break;
+ }
+ return dibFormat;
+}
+
+CFX_RetainPtr<CFX_DIBitmap> XFA_LoadImageFromBuffer(
+ const CFX_RetainPtr<IFX_SeekableReadStream>& pImageFileRead,
+ FXCODEC_IMAGE_TYPE type,
+ int32_t& iImageXDpi,
+ int32_t& iImageYDpi) {
+ CFX_GEModule* pGeModule = CFX_GEModule::Get();
+ if (!pGeModule)
+ return nullptr;
+
+ CCodec_ModuleMgr* pCodecMgr = pGeModule->GetCodecModule();
+ if (!pCodecMgr)
+ return nullptr;
+
+ CFX_DIBAttribute dibAttr;
+ CFX_RetainPtr<CFX_DIBitmap> pBitmap;
+ std::unique_ptr<CCodec_ProgressiveDecoder> pProgressiveDecoder =
+ pCodecMgr->CreateProgressiveDecoder();
+ pProgressiveDecoder->LoadImageInfo(pImageFileRead, type, &dibAttr, false);
+ switch (dibAttr.m_wDPIUnit) {
+ case FXCODEC_RESUNIT_CENTIMETER:
+ dibAttr.m_nXDPI = (int32_t)(dibAttr.m_nXDPI * 2.54f);
+ dibAttr.m_nYDPI = (int32_t)(dibAttr.m_nYDPI * 2.54f);
+ break;
+ case FXCODEC_RESUNIT_METER:
+ dibAttr.m_nXDPI = (int32_t)(dibAttr.m_nXDPI / (float)100 * 2.54f);
+ dibAttr.m_nYDPI = (int32_t)(dibAttr.m_nYDPI / (float)100 * 2.54f);
+ break;
+ default:
+ break;
+ }
+ iImageXDpi = dibAttr.m_nXDPI > 1 ? dibAttr.m_nXDPI : (96);
+ iImageYDpi = dibAttr.m_nYDPI > 1 ? dibAttr.m_nYDPI : (96);
+ if (pProgressiveDecoder->GetWidth() > 0 &&
+ pProgressiveDecoder->GetHeight() > 0) {
+ type = pProgressiveDecoder->GetType();
+ int32_t iComponents = pProgressiveDecoder->GetNumComponents();
+ int32_t iBpc = pProgressiveDecoder->GetBPC();
+ FXDIB_Format dibFormat = XFA_GetDIBFormat(type, iComponents, iBpc);
+ pBitmap = pdfium::MakeRetain<CFX_DIBitmap>();
+ pBitmap->Create(pProgressiveDecoder->GetWidth(),
+ pProgressiveDecoder->GetHeight(), dibFormat);
+ pBitmap->Clear(0xffffffff);
+ int32_t nFrames;
+ if ((pProgressiveDecoder->GetFrames(nFrames) ==
+ FXCODEC_STATUS_DECODE_READY) &&
+ (nFrames > 0)) {
+ pProgressiveDecoder->StartDecode(pBitmap, 0, 0, pBitmap->GetWidth(),
+ pBitmap->GetHeight());
+ pProgressiveDecoder->ContinueDecode();
+ }
+ }
+ return pBitmap;
+}
+
+void XFA_RectWidthoutMargin(CFX_RectF& rt, const CXFA_Margin& mg, bool bUI) {
+ if (!mg) {
+ return;
+ }
+ float fLeftInset, fTopInset, fRightInset, fBottomInset;
+ mg.GetLeftInset(fLeftInset);
+ mg.GetTopInset(fTopInset);
+ mg.GetRightInset(fRightInset);
+ mg.GetBottomInset(fBottomInset);
+ rt.Deflate(fLeftInset, fTopInset, fRightInset, fBottomInset);
+}
+CXFA_FFWidget* XFA_GetWidgetFromLayoutItem(CXFA_LayoutItem* pLayoutItem) {
+ if (XFA_IsCreateWidget(pLayoutItem->GetFormNode()->GetElementType()))
+ return static_cast<CXFA_FFWidget*>(pLayoutItem);
+ return nullptr;
+}
+bool XFA_IsCreateWidget(XFA_Element eType) {
+ return eType == XFA_Element::Field || eType == XFA_Element::Draw ||
+ eType == XFA_Element::Subform || eType == XFA_Element::ExclGroup;
+}
+static void XFA_BOX_GetPath_Arc(CXFA_Box box,
+ CFX_RectF rtDraw,
+ CFX_Path& fillPath,
+ uint32_t dwFlags) {
+ float a, b;
+ a = rtDraw.width / 2.0f;
+ b = rtDraw.height / 2.0f;
+ if (box.IsCircular() || (dwFlags & XFA_DRAWBOX_ForceRound) != 0) {
+ a = b = std::min(a, b);
+ }
+ CFX_PointF center = rtDraw.Center();
+ rtDraw.left = center.x - a;
+ rtDraw.top = center.y - b;
+ rtDraw.width = a + a;
+ rtDraw.height = b + b;
+ float startAngle = 0, sweepAngle = 360;
+ bool bStart = box.GetStartAngle(startAngle);
+ bool bEnd = box.GetSweepAngle(sweepAngle);
+ if (!bStart && !bEnd) {
+ fillPath.AddEllipse(rtDraw);
+ return;
+ }
+ startAngle = -startAngle * FX_PI / 180.0f;
+ sweepAngle = -sweepAngle * FX_PI / 180.0f;
+ fillPath.AddArc(rtDraw.TopLeft(), rtDraw.Size(), startAngle, sweepAngle);
+}
+
+static void XFA_BOX_GetPath(CXFA_Box box,
+ const std::vector<CXFA_Stroke>& strokes,
+ CFX_RectF rtWidget,
+ CFX_Path& path,
+ int32_t nIndex,
+ bool bStart,
+ bool bCorner) {
+ ASSERT(nIndex >= 0 && nIndex < 8);
+ int32_t n = (nIndex & 1) ? nIndex - 1 : nIndex;
+ CXFA_Corner corner1(strokes[n].GetNode());
+ CXFA_Corner corner2(strokes[(n + 2) % 8].GetNode());
+ float fRadius1 = bCorner ? corner1.GetRadius() : 0.0f;
+ float fRadius2 = bCorner ? corner2.GetRadius() : 0.0f;
+ bool bInverted = corner1.IsInverted();
+ float offsetY = 0.0f;
+ float offsetX = 0.0f;
+ bool bRound = corner1.GetJoinType() == XFA_ATTRIBUTEENUM_Round;
+ float halfAfter = 0.0f;
+ float halfBefore = 0.0f;
+ CXFA_Stroke stroke = strokes[nIndex];
+ if (stroke.IsCorner()) {
+ CXFA_Stroke edgeBefore = strokes[(nIndex + 1 * 8 - 1) % 8];
+ CXFA_Stroke edgeAfter = strokes[nIndex + 1];
+ if (stroke.IsInverted()) {
+ if (!stroke.SameStyles(edgeBefore)) {
+ halfBefore = edgeBefore.GetThickness() / 2;
+ }
+ if (!stroke.SameStyles(edgeAfter)) {
+ halfAfter = edgeAfter.GetThickness() / 2;
+ }
+ }
+ } else {
+ CXFA_Stroke edgeBefore = strokes[(nIndex + 8 - 2) % 8];
+ CXFA_Stroke edgeAfter = strokes[(nIndex + 2) % 8];
+ if (!bRound && !bInverted) {
+ halfBefore = edgeBefore.GetThickness() / 2;
+ halfAfter = edgeAfter.GetThickness() / 2;
+ }
+ }
+ float offsetEX = 0.0f;
+ float offsetEY = 0.0f;
+ float sx = 0.0f;
+ float sy = 0.0f;
+ float vx = 1.0f;
+ float vy = 1.0f;
+ float nx = 1.0f;
+ float ny = 1.0f;
+ CFX_PointF cpStart;
+ CFX_PointF cp1;
+ CFX_PointF cp2;
+ if (bRound) {
+ sy = FX_PI / 2;
+ }
+ switch (nIndex) {
+ case 0:
+ case 1:
+ cp1 = rtWidget.TopLeft();
+ cp2 = rtWidget.TopRight();
+ if (nIndex == 0) {
+ cpStart.x = cp1.x - halfBefore;
+ cpStart.y = cp1.y + fRadius1, offsetY = -halfAfter;
+ } else {
+ cpStart.x = cp1.x + fRadius1 - halfBefore, cpStart.y = cp1.y,
+ offsetEX = halfAfter;
+ }
+ vx = 1, vy = 1;
+ nx = -1, ny = 0;
+ if (bRound) {
+ sx = bInverted ? FX_PI / 2 : FX_PI;
+ } else {
+ sx = 1, sy = 0;
+ }
+ break;
+ case 2:
+ case 3:
+ cp1 = rtWidget.TopRight();
+ cp2 = rtWidget.BottomRight();
+ if (nIndex == 2) {
+ cpStart.x = cp1.x - fRadius1, cpStart.y = cp1.y - halfBefore,
+ offsetX = halfAfter;
+ } else {
+ cpStart.x = cp1.x, cpStart.y = cp1.y + fRadius1 - halfBefore,
+ offsetEY = halfAfter;
+ }
+ vx = -1, vy = 1;
+ nx = 0, ny = -1;
+ if (bRound) {
+ sx = bInverted ? FX_PI : FX_PI * 3 / 2;
+ } else {
+ sx = 0, sy = 1;
+ }
+ break;
+ case 4:
+ case 5:
+ cp1 = rtWidget.BottomRight();
+ cp2 = rtWidget.BottomLeft();
+ if (nIndex == 4) {
+ cpStart.x = cp1.x + halfBefore, cpStart.y = cp1.y - fRadius1,
+ offsetY = halfAfter;
+ } else {
+ cpStart.x = cp1.x - fRadius1 + halfBefore, cpStart.y = cp1.y,
+ offsetEX = -halfAfter;
+ }
+ vx = -1, vy = -1;
+ nx = 1, ny = 0;
+ if (bRound) {
+ sx = bInverted ? FX_PI * 3 / 2 : 0;
+ } else {
+ sx = -1, sy = 0;
+ }
+ break;
+ case 6:
+ case 7:
+ cp1 = rtWidget.BottomLeft();
+ cp2 = rtWidget.TopLeft();
+ if (nIndex == 6) {
+ cpStart.x = cp1.x + fRadius1, cpStart.y = cp1.y + halfBefore,
+ offsetX = -halfAfter;
+ } else {
+ cpStart.x = cp1.x, cpStart.y = cp1.y - fRadius1 + halfBefore,
+ offsetEY = -halfAfter;
+ }
+ vx = 1;
+ vy = -1;
+ nx = 0;
+ ny = 1;
+ if (bRound) {
+ sx = bInverted ? 0 : FX_PI / 2;
+ } else {
+ sx = 0;
+ sy = -1;
+ }
+ break;
+ }
+ if (bStart) {
+ path.MoveTo(cpStart);
+ }
+ if (nIndex & 1) {
+ path.LineTo(CFX_PointF(cp2.x + fRadius2 * nx + offsetEX,
+ cp2.y + fRadius2 * ny + offsetEY));
+ return;
+ }
+ if (bRound) {
+ if (fRadius1 < 0)
+ sx -= FX_PI;
+ if (bInverted)
+ sy *= -1;
+
+ CFX_RectF rtRadius(cp1.x + offsetX * 2, cp1.y + offsetY * 2,
+ fRadius1 * 2 * vx - offsetX * 2,
+ fRadius1 * 2 * vy - offsetY * 2);
+ rtRadius.Normalize();
+ if (bInverted)
+ rtRadius.Offset(-fRadius1 * vx, -fRadius1 * vy);
+
+ path.ArcTo(rtRadius.TopLeft(), rtRadius.Size(), sx, sy);
+ } else {
+ CFX_PointF cp;
+ if (bInverted) {
+ cp.x = cp1.x + fRadius1 * vx;
+ cp.y = cp1.y + fRadius1 * vy;
+ } else {
+ cp = cp1;
+ }
+ path.LineTo(cp);
+ path.LineTo(CFX_PointF(cp1.x + fRadius1 * sx + offsetX,
+ cp1.y + fRadius1 * sy + offsetY));
+ }
+}
+static void XFA_BOX_GetFillPath(CXFA_Box box,
+ const std::vector<CXFA_Stroke>& strokes,
+ CFX_RectF rtWidget,
+ CFX_Path& fillPath,
+ uint16_t dwFlags) {
+ if (box.IsArc() || (dwFlags & XFA_DRAWBOX_ForceRound) != 0) {
+ CXFA_Edge edge = box.GetEdge(0);
+ float fThickness = edge.GetThickness();
+ if (fThickness < 0) {
+ fThickness = 0;
+ }
+ float fHalf = fThickness / 2;
+ int32_t iHand = box.GetHand();
+ if (iHand == XFA_ATTRIBUTEENUM_Left) {
+ rtWidget.Inflate(fHalf, fHalf);
+ } else if (iHand == XFA_ATTRIBUTEENUM_Right) {
+ rtWidget.Deflate(fHalf, fHalf);
+ }
+ XFA_BOX_GetPath_Arc(box, rtWidget, fillPath, dwFlags);
+ return;
+ }
+ bool bSameStyles = true;
+ CXFA_Stroke stroke1 = strokes[0];
+ for (int32_t i = 1; i < 8; i++) {
+ CXFA_Stroke stroke2 = strokes[i];
+ if (!stroke1.SameStyles(stroke2)) {
+ bSameStyles = false;
+ break;
+ }
+ stroke1 = stroke2;
+ }
+ if (bSameStyles) {
+ stroke1 = strokes[0];
+ for (int32_t i = 2; i < 8; i += 2) {
+ CXFA_Stroke stroke2 = strokes[i];
+ if (!stroke1.SameStyles(stroke2, XFA_STROKE_SAMESTYLE_NoPresence |
+ XFA_STROKE_SAMESTYLE_Corner)) {
+ bSameStyles = false;
+ break;
+ }
+ stroke1 = stroke2;
+ }
+ if (bSameStyles) {
+ stroke1 = strokes[0];
+ if (stroke1.IsInverted()) {
+ bSameStyles = false;
+ }
+ if (stroke1.GetJoinType() != XFA_ATTRIBUTEENUM_Square) {
+ bSameStyles = false;
+ }
+ }
+ }
+ if (bSameStyles) {
+ fillPath.AddRectangle(rtWidget.left, rtWidget.top, rtWidget.width,
+ rtWidget.height);
+ return;
+ }
+
+ for (int32_t i = 0; i < 8; i += 2) {
+ float sx = 0.0f;
+ float sy = 0.0f;
+ float vx = 1.0f;
+ float vy = 1.0f;
+ float nx = 1.0f;
+ float ny = 1.0f;
+ CFX_PointF cp1, cp2;
+ CXFA_Corner corner1(strokes[i].GetNode());
+ CXFA_Corner corner2(strokes[(i + 2) % 8].GetNode());
+ float fRadius1 = corner1.GetRadius();
+ float fRadius2 = corner2.GetRadius();
+ bool bInverted = corner1.IsInverted();
+ bool bRound = corner1.GetJoinType() == XFA_ATTRIBUTEENUM_Round;
+ if (bRound) {
+ sy = FX_PI / 2;
+ }
+ switch (i) {
+ case 0:
+ cp1 = rtWidget.TopLeft();
+ cp2 = rtWidget.TopRight();
+ vx = 1, vy = 1;
+ nx = -1, ny = 0;
+ if (bRound) {
+ sx = bInverted ? FX_PI / 2 : FX_PI;
+ } else {
+ sx = 1, sy = 0;
+ }
+ break;
+ case 2:
+ cp1 = rtWidget.TopRight();
+ cp2 = rtWidget.BottomRight();
+ vx = -1, vy = 1;
+ nx = 0, ny = -1;
+ if (bRound) {
+ sx = bInverted ? FX_PI : FX_PI * 3 / 2;
+ } else {
+ sx = 0, sy = 1;
+ }
+ break;
+ case 4:
+ cp1 = rtWidget.BottomRight();
+ cp2 = rtWidget.BottomLeft();
+ vx = -1, vy = -1;
+ nx = 1, ny = 0;
+ if (bRound) {
+ sx = bInverted ? FX_PI * 3 / 2 : 0;
+ } else {
+ sx = -1, sy = 0;
+ }
+ break;
+ case 6:
+ cp1 = rtWidget.BottomLeft();
+ cp2 = rtWidget.TopLeft();
+ vx = 1, vy = -1;
+ nx = 0, ny = 1;
+ if (bRound) {
+ sx = bInverted ? 0 : FX_PI / 2;
+ } else {
+ sx = 0;
+ sy = -1;
+ }
+ break;
+ }
+ if (i == 0)
+ fillPath.MoveTo(CFX_PointF(cp1.x, cp1.y + fRadius1));
+
+ if (bRound) {
+ if (fRadius1 < 0)
+ sx -= FX_PI;
+ if (bInverted)
+ sy *= -1;
+
+ CFX_RectF rtRadius(cp1.x, cp1.y, fRadius1 * 2 * vx, fRadius1 * 2 * vy);
+ rtRadius.Normalize();
+ if (bInverted)
+ rtRadius.Offset(-fRadius1 * vx, -fRadius1 * vy);
+
+ fillPath.ArcTo(rtRadius.TopLeft(), rtRadius.Size(), sx, sy);
+ } else {
+ CFX_PointF cp;
+ if (bInverted) {
+ cp.x = cp1.x + fRadius1 * vx;
+ cp.y = cp1.y + fRadius1 * vy;
+ } else {
+ cp = cp1;
+ }
+ fillPath.LineTo(cp);
+ fillPath.LineTo(CFX_PointF(cp1.x + fRadius1 * sx, cp1.y + fRadius1 * sy));
+ }
+ fillPath.LineTo(CFX_PointF(cp2.x + fRadius2 * nx, cp2.y + fRadius2 * ny));
+ }
+}
+static void XFA_BOX_Fill_Radial(CXFA_Box box,
+ CFX_Graphics* pGS,
+ CFX_Path& fillPath,
+ CFX_RectF rtFill,
+ CFX_Matrix* pMatrix) {
+ CXFA_Fill fill = box.GetFill();
+ FX_ARGB crStart, crEnd;
+ crStart = fill.GetColor();
+ int32_t iType = fill.GetRadial(crEnd);
+ if (iType != XFA_ATTRIBUTEENUM_ToEdge) {
+ FX_ARGB temp = crEnd;
+ crEnd = crStart;
+ crStart = temp;
+ }
+ CFX_Shading shading(rtFill.Center(), rtFill.Center(), 0,
+ sqrt(rtFill.Width() * rtFill.Width() +
+ rtFill.Height() * rtFill.Height()) /
+ 2,
+ true, true, crStart, crEnd);
+ CFX_Color cr(&shading);
+ pGS->SetFillColor(&cr);
+ pGS->FillPath(&fillPath, FXFILL_WINDING, pMatrix);
+}
+static void XFA_BOX_Fill_Pattern(CXFA_Box box,
+ CFX_Graphics* pGS,
+ CFX_Path& fillPath,
+ CFX_RectF rtFill,
+ CFX_Matrix* pMatrix) {
+ CXFA_Fill fill = box.GetFill();
+ FX_ARGB crStart, crEnd;
+ crStart = fill.GetColor();
+ int32_t iType = fill.GetPattern(crEnd);
+ FX_HatchStyle iHatch = FX_HatchStyle::Cross;
+ switch (iType) {
+ case XFA_ATTRIBUTEENUM_CrossDiagonal:
+ iHatch = FX_HatchStyle::DiagonalCross;
+ break;
+ case XFA_ATTRIBUTEENUM_DiagonalLeft:
+ iHatch = FX_HatchStyle::ForwardDiagonal;
+ break;
+ case XFA_ATTRIBUTEENUM_DiagonalRight:
+ iHatch = FX_HatchStyle::BackwardDiagonal;
+ break;
+ case XFA_ATTRIBUTEENUM_Horizontal:
+ iHatch = FX_HatchStyle::Horizontal;
+ break;
+ case XFA_ATTRIBUTEENUM_Vertical:
+ iHatch = FX_HatchStyle::Vertical;
+ break;
+ default:
+ break;
+ }
+
+ CFX_Pattern pattern(iHatch, crEnd, crStart);
+ CFX_Color cr(&pattern, 0x0);
+ pGS->SetFillColor(&cr);
+ pGS->FillPath(&fillPath, FXFILL_WINDING, pMatrix);
+}
+static void XFA_BOX_Fill_Linear(CXFA_Box box,
+ CFX_Graphics* pGS,
+ CFX_Path& fillPath,
+ CFX_RectF rtFill,
+ CFX_Matrix* pMatrix) {
+ CXFA_Fill fill = box.GetFill();
+ FX_ARGB crStart = fill.GetColor();
+ FX_ARGB crEnd;
+ int32_t iType = fill.GetLinear(crEnd);
+ CFX_PointF ptStart;
+ CFX_PointF ptEnd;
+ switch (iType) {
+ case XFA_ATTRIBUTEENUM_ToRight:
+ ptStart = CFX_PointF(rtFill.left, rtFill.top);
+ ptEnd = CFX_PointF(rtFill.right(), rtFill.top);
+ break;
+ case XFA_ATTRIBUTEENUM_ToBottom:
+ ptStart = CFX_PointF(rtFill.left, rtFill.top);
+ ptEnd = CFX_PointF(rtFill.left, rtFill.bottom());
+ break;
+ case XFA_ATTRIBUTEENUM_ToLeft:
+ ptStart = CFX_PointF(rtFill.right(), rtFill.top);
+ ptEnd = CFX_PointF(rtFill.left, rtFill.top);
+ break;
+ case XFA_ATTRIBUTEENUM_ToTop:
+ ptStart = CFX_PointF(rtFill.left, rtFill.bottom());
+ ptEnd = CFX_PointF(rtFill.left, rtFill.top);
+ break;
+ default:
+ break;
+ }
+ CFX_Shading shading(ptStart, ptEnd, false, false, crStart, crEnd);
+ CFX_Color cr(&shading);
+ pGS->SetFillColor(&cr);
+ pGS->FillPath(&fillPath, FXFILL_WINDING, pMatrix);
+}
+static void XFA_BOX_Fill(CXFA_Box box,
+ const std::vector<CXFA_Stroke>& strokes,
+ CFX_Graphics* pGS,
+ const CFX_RectF& rtWidget,
+ CFX_Matrix* pMatrix,
+ uint32_t dwFlags) {
+ CXFA_Fill fill = box.GetFill();
+ if (!fill || fill.GetPresence() != XFA_ATTRIBUTEENUM_Visible)
+ return;
+
+ pGS->SaveGraphState();
+ CFX_Path fillPath;
+ XFA_BOX_GetFillPath(box, strokes, rtWidget, fillPath,
+ (dwFlags & XFA_DRAWBOX_ForceRound) != 0);
+ fillPath.Close();
+ XFA_Element eType = fill.GetFillType();
+ switch (eType) {
+ case XFA_Element::Radial:
+ XFA_BOX_Fill_Radial(box, pGS, fillPath, rtWidget, pMatrix);
+ break;
+ case XFA_Element::Pattern:
+ XFA_BOX_Fill_Pattern(box, pGS, fillPath, rtWidget, pMatrix);
+ break;
+ case XFA_Element::Linear:
+ XFA_BOX_Fill_Linear(box, pGS, fillPath, rtWidget, pMatrix);
+ break;
+ default: {
+ FX_ARGB cr;
+ if (eType == XFA_Element::Stipple) {
+ int32_t iRate = fill.GetStipple(cr);
+ if (iRate == 0) {
+ iRate = 100;
+ }
+ int32_t a = 0;
+ FX_COLORREF rgb;
+ ArgbDecode(cr, a, rgb);
+ cr = ArgbEncode(iRate * a / 100, rgb);
+ } else {
+ cr = fill.GetColor();
+ }
+ CFX_Color fillColor(cr);
+ pGS->SetFillColor(&fillColor);
+ pGS->FillPath(&fillPath, FXFILL_WINDING, pMatrix);
+ } break;
+ }
+ pGS->RestoreGraphState();
+}
+static void XFA_BOX_StrokePath(CXFA_Stroke stroke,
+ CFX_Path* pPath,
+ CFX_Graphics* pGS,
+ CFX_Matrix* pMatrix) {
+ if (!stroke || !stroke.IsVisible()) {
+ return;
+ }
+ float fThickness = stroke.GetThickness();
+ if (fThickness < 0.001f) {
+ return;
+ }
+ pGS->SaveGraphState();
+ if (stroke.IsCorner() && fThickness > 2 * stroke.GetRadius()) {
+ fThickness = 2 * stroke.GetRadius();
+ }
+ pGS->SetLineWidth(fThickness, true);
+ pGS->SetLineCap(CFX_GraphStateData::LineCapButt);
+ XFA_StrokeTypeSetLineDash(pGS, stroke.GetStrokeType(),
+ XFA_ATTRIBUTEENUM_Butt);
+ CFX_Color fxColor(stroke.GetColor());
+ pGS->SetStrokeColor(&fxColor);
+ pGS->StrokePath(pPath, pMatrix);
+ pGS->RestoreGraphState();
+}
+static void XFA_BOX_StrokeArc(CXFA_Box box,
+ CFX_Graphics* pGS,
+ CFX_RectF rtWidget,
+ CFX_Matrix* pMatrix,
+ uint32_t dwFlags) {
+ CXFA_Edge edge = box.GetEdge(0);
+ if (!edge || !edge.IsVisible()) {
+ return;
+ }
+ bool bVisible = false;
+ float fThickness = 0;
+ int32_t i3DType = box.Get3DStyle(bVisible, fThickness);
+ if (i3DType) {
+ if (bVisible && fThickness >= 0.001f) {
+ dwFlags |= XFA_DRAWBOX_Lowered3D;
+ }
+ }
+ float fHalf = edge.GetThickness() / 2;
+ if (fHalf < 0) {
+ fHalf = 0;
+ }
+ int32_t iHand = box.GetHand();
+ if (iHand == XFA_ATTRIBUTEENUM_Left) {
+ rtWidget.Inflate(fHalf, fHalf);
+ } else if (iHand == XFA_ATTRIBUTEENUM_Right) {
+ rtWidget.Deflate(fHalf, fHalf);
+ }
+ if ((dwFlags & XFA_DRAWBOX_ForceRound) == 0 ||
+ (dwFlags & XFA_DRAWBOX_Lowered3D) == 0) {
+ if (fHalf < 0.001f)
+ return;
+
+ CFX_Path arcPath;
+ XFA_BOX_GetPath_Arc(box, rtWidget, arcPath, dwFlags);
+ XFA_BOX_StrokePath(edge, &arcPath, pGS, pMatrix);
+ return;
+ }
+ pGS->SaveGraphState();
+ pGS->SetLineWidth(fHalf);
+
+ float a, b;
+ a = rtWidget.width / 2.0f;
+ b = rtWidget.height / 2.0f;
+ if (dwFlags & XFA_DRAWBOX_ForceRound) {
+ a = std::min(a, b);
+ b = a;
+ }
+
+ CFX_PointF center = rtWidget.Center();
+ rtWidget.left = center.x - a;
+ rtWidget.top = center.y - b;
+ rtWidget.width = a + a;
+ rtWidget.height = b + b;
+
+ float startAngle = 0, sweepAngle = 360;
+ startAngle = startAngle * FX_PI / 180.0f;
+ sweepAngle = -sweepAngle * FX_PI / 180.0f;
+
+ CFX_Path arcPath;
+ arcPath.AddArc(rtWidget.TopLeft(), rtWidget.Size(), 3.0f * FX_PI / 4.0f,
+ FX_PI);
+
+ CFX_Color cr(0xFF808080);
+ pGS->SetStrokeColor(&cr);
+ pGS->StrokePath(&arcPath, pMatrix);
+ arcPath.Clear();
+ arcPath.AddArc(rtWidget.TopLeft(), rtWidget.Size(), -1.0f * FX_PI / 4.0f,
+ FX_PI);
+
+ cr.Set(0xFFFFFFFF);
+ pGS->SetStrokeColor(&cr);
+ pGS->StrokePath(&arcPath, pMatrix);
+ rtWidget.Deflate(fHalf, fHalf);
+ arcPath.Clear();
+ arcPath.AddArc(rtWidget.TopLeft(), rtWidget.Size(), 3.0f * FX_PI / 4.0f,
+ FX_PI);
+
+ cr.Set(0xFF404040);
+ pGS->SetStrokeColor(&cr);
+ pGS->StrokePath(&arcPath, pMatrix);
+ arcPath.Clear();
+ arcPath.AddArc(rtWidget.TopLeft(), rtWidget.Size(), -1.0f * FX_PI / 4.0f,
+ FX_PI);
+
+ cr.Set(0xFFC0C0C0);
+ pGS->SetStrokeColor(&cr);
+ pGS->StrokePath(&arcPath, pMatrix);
+ pGS->RestoreGraphState();
+}
+static void XFA_Draw3DRect(CFX_Graphics* pGraphic,
+ const CFX_RectF& rt,
+ float fLineWidth,
+ CFX_Matrix* pMatrix,
+ FX_ARGB argbTopLeft,
+ FX_ARGB argbBottomRight) {
+ CFX_Color crLT(argbTopLeft);
+ pGraphic->SetFillColor(&crLT);
+ float fBottom = rt.bottom();
+ float fRight = rt.right();
+ CFX_Path pathLT;
+ pathLT.MoveTo(CFX_PointF(rt.left, fBottom));
+ pathLT.LineTo(CFX_PointF(rt.left, rt.top));
+ pathLT.LineTo(CFX_PointF(fRight, rt.top));
+ pathLT.LineTo(CFX_PointF(fRight - fLineWidth, rt.top + fLineWidth));
+ pathLT.LineTo(CFX_PointF(rt.left + fLineWidth, rt.top + fLineWidth));
+ pathLT.LineTo(CFX_PointF(rt.left + fLineWidth, fBottom - fLineWidth));
+ pathLT.LineTo(CFX_PointF(rt.left, fBottom));
+ pGraphic->FillPath(&pathLT, FXFILL_WINDING, pMatrix);
+
+ CFX_Color crRB(argbBottomRight);
+ pGraphic->SetFillColor(&crRB);
+
+ CFX_Path pathRB;
+ pathRB.MoveTo(CFX_PointF(fRight, rt.top));
+ pathRB.LineTo(CFX_PointF(fRight, fBottom));
+ pathRB.LineTo(CFX_PointF(rt.left, fBottom));
+ pathRB.LineTo(CFX_PointF(rt.left + fLineWidth, fBottom - fLineWidth));
+ pathRB.LineTo(CFX_PointF(fRight - fLineWidth, fBottom - fLineWidth));
+ pathRB.LineTo(CFX_PointF(fRight - fLineWidth, rt.top + fLineWidth));
+ pathRB.LineTo(CFX_PointF(fRight, rt.top));
+ pGraphic->FillPath(&pathRB, FXFILL_WINDING, pMatrix);
+}
+static void XFA_BOX_Stroke_3DRect_Lowered(CFX_Graphics* pGS,
+ CFX_RectF rt,
+ float fThickness,
+ CFX_Matrix* pMatrix) {
+ float fHalfWidth = fThickness / 2.0f;
+ CFX_RectF rtInner(rt);
+ rtInner.Deflate(fHalfWidth, fHalfWidth);
+ CFX_Color cr(0xFF000000);
+ pGS->SetFillColor(&cr);
+ CFX_Path path;
+ path.AddRectangle(rt.left, rt.top, rt.width, rt.height);
+ path.AddRectangle(rtInner.left, rtInner.top, rtInner.width, rtInner.height);
+ pGS->FillPath(&path, FXFILL_ALTERNATE, pMatrix);
+ XFA_Draw3DRect(pGS, rtInner, fHalfWidth, pMatrix, 0xFF808080, 0xFFC0C0C0);
+}
+static void XFA_BOX_Stroke_3DRect_Raised(CFX_Graphics* pGS,
+ CFX_RectF rt,
+ float fThickness,
+ CFX_Matrix* pMatrix) {
+ float fHalfWidth = fThickness / 2.0f;
+ CFX_RectF rtInner(rt);
+ rtInner.Deflate(fHalfWidth, fHalfWidth);
+ CFX_Color cr(0xFF000000);
+ pGS->SetFillColor(&cr);
+ CFX_Path path;
+ path.AddRectangle(rt.left, rt.top, rt.width, rt.height);
+ path.AddRectangle(rtInner.left, rtInner.top, rtInner.width, rtInner.height);
+ pGS->FillPath(&path, FXFILL_ALTERNATE, pMatrix);
+ XFA_Draw3DRect(pGS, rtInner, fHalfWidth, pMatrix, 0xFFFFFFFF, 0xFF808080);
+}
+static void XFA_BOX_Stroke_3DRect_Etched(CFX_Graphics* pGS,
+ CFX_RectF rt,
+ float fThickness,
+ CFX_Matrix* pMatrix) {
+ float fHalfWidth = fThickness / 2.0f;
+ XFA_Draw3DRect(pGS, rt, fThickness, pMatrix, 0xFF808080, 0xFFFFFFFF);
+ CFX_RectF rtInner(rt);
+ rtInner.Deflate(fHalfWidth, fHalfWidth);
+ XFA_Draw3DRect(pGS, rtInner, fHalfWidth, pMatrix, 0xFFFFFFFF, 0xFF808080);
+}
+static void XFA_BOX_Stroke_3DRect_Embossed(CFX_Graphics* pGS,
+ CFX_RectF rt,
+ float fThickness,
+ CFX_Matrix* pMatrix) {
+ float fHalfWidth = fThickness / 2.0f;
+ XFA_Draw3DRect(pGS, rt, fThickness, pMatrix, 0xFF808080, 0xFF000000);
+ CFX_RectF rtInner(rt);
+ rtInner.Deflate(fHalfWidth, fHalfWidth);
+ XFA_Draw3DRect(pGS, rtInner, fHalfWidth, pMatrix, 0xFF000000, 0xFF808080);
+}
+static void XFA_BOX_Stroke_Rect(CXFA_Box box,
+ const std::vector<CXFA_Stroke>& strokes,
+ CFX_Graphics* pGS,
+ CFX_RectF rtWidget,
+ CFX_Matrix* pMatrix) {
+ bool bVisible = false;
+ float fThickness = 0;
+ int32_t i3DType = box.Get3DStyle(bVisible, fThickness);
+ if (i3DType) {
+ if (!bVisible || fThickness < 0.001f) {
+ return;
+ }
+ switch (i3DType) {
+ case XFA_ATTRIBUTEENUM_Lowered:
+ XFA_BOX_Stroke_3DRect_Lowered(pGS, rtWidget, fThickness, pMatrix);
+ break;
+ case XFA_ATTRIBUTEENUM_Raised:
+ XFA_BOX_Stroke_3DRect_Raised(pGS, rtWidget, fThickness, pMatrix);
+ break;
+ case XFA_ATTRIBUTEENUM_Etched:
+ XFA_BOX_Stroke_3DRect_Etched(pGS, rtWidget, fThickness, pMatrix);
+ break;
+ case XFA_ATTRIBUTEENUM_Embossed:
+ XFA_BOX_Stroke_3DRect_Embossed(pGS, rtWidget, fThickness, pMatrix);
+ break;
+ }
+ return;
+ }
+ bool bClose = false;
+ bool bSameStyles = true;
+ CXFA_Stroke stroke1 = strokes[0];
+ for (int32_t i = 1; i < 8; i++) {
+ CXFA_Stroke stroke2 = strokes[i];
+ if (!stroke1.SameStyles(stroke2)) {
+ bSameStyles = false;
+ break;
+ }
+ stroke1 = stroke2;
+ }
+ if (bSameStyles) {
+ stroke1 = strokes[0];
+ bClose = true;
+ for (int32_t i = 2; i < 8; i += 2) {
+ CXFA_Stroke stroke2 = strokes[i];
+ if (!stroke1.SameStyles(stroke2, XFA_STROKE_SAMESTYLE_NoPresence |
+ XFA_STROKE_SAMESTYLE_Corner)) {
+ bSameStyles = false;
+ break;
+ }
+ stroke1 = stroke2;
+ }
+ if (bSameStyles) {
+ stroke1 = strokes[0];
+ if (stroke1.IsInverted())
+ bSameStyles = false;
+ if (stroke1.GetJoinType() != XFA_ATTRIBUTEENUM_Square)
+ bSameStyles = false;
+ }
+ }
+ bool bStart = true;
+ CFX_Path path;
+ for (int32_t i = 0; i < 8; i++) {
+ CXFA_Stroke stroke = strokes[i];
+ if ((i % 1) == 0 && stroke.GetRadius() < 0) {
+ bool bEmpty = path.IsEmpty();
+ if (!bEmpty) {
+ XFA_BOX_StrokePath(stroke, &path, pGS, pMatrix);
+ path.Clear();
+ }
+ bStart = true;
+ continue;
+ }
+ XFA_BOX_GetPath(box, strokes, rtWidget, path, i, bStart, !bSameStyles);
+ CXFA_Stroke stroke2 = strokes[(i + 1) % 8];
+ bStart = !stroke.SameStyles(stroke2);
+ if (bStart) {
+ XFA_BOX_StrokePath(stroke, &path, pGS, pMatrix);
+ path.Clear();
+ }
+ }
+ bool bEmpty = path.IsEmpty();
+ if (!bEmpty) {
+ if (bClose) {
+ path.Close();
+ }
+ XFA_BOX_StrokePath(strokes[7], &path, pGS, pMatrix);
+ }
+}
+static void XFA_BOX_Stroke(CXFA_Box box,
+ const std::vector<CXFA_Stroke>& strokes,
+ CFX_Graphics* pGS,
+ CFX_RectF rtWidget,
+ CFX_Matrix* pMatrix,
+ uint32_t dwFlags) {
+ if (box.IsArc() || (dwFlags & XFA_DRAWBOX_ForceRound) != 0) {
+ XFA_BOX_StrokeArc(box, pGS, rtWidget, pMatrix, dwFlags);
+ return;
+ }
+ bool bVisible = false;
+ for (int32_t j = 0; j < 4; j++) {
+ if (strokes[j * 2 + 1].IsVisible()) {
+ bVisible = true;
+ break;
+ }
+ }
+ if (!bVisible) {
+ return;
+ }
+ for (int32_t i = 1; i < 8; i += 2) {
+ CXFA_Edge edge(strokes[i].GetNode());
+ float fThickness = edge.GetThickness();
+ if (fThickness < 0) {
+ fThickness = 0;
+ }
+ float fHalf = fThickness / 2;
+ int32_t iHand = box.GetHand();
+ switch (i) {
+ case 1:
+ if (iHand == XFA_ATTRIBUTEENUM_Left) {
+ rtWidget.top -= fHalf;
+ rtWidget.height += fHalf;
+ } else if (iHand == XFA_ATTRIBUTEENUM_Right) {
+ rtWidget.top += fHalf;
+ rtWidget.height -= fHalf;
+ }
+ break;
+ case 3:
+ if (iHand == XFA_ATTRIBUTEENUM_Left) {
+ rtWidget.width += fHalf;
+ } else if (iHand == XFA_ATTRIBUTEENUM_Right) {
+ rtWidget.width -= fHalf;
+ }
+ break;
+ case 5:
+ if (iHand == XFA_ATTRIBUTEENUM_Left) {
+ rtWidget.height += fHalf;
+ } else if (iHand == XFA_ATTRIBUTEENUM_Right) {
+ rtWidget.height -= fHalf;
+ }
+ break;
+ case 7:
+ if (iHand == XFA_ATTRIBUTEENUM_Left) {
+ rtWidget.left -= fHalf;
+ rtWidget.width += fHalf;
+ } else if (iHand == XFA_ATTRIBUTEENUM_Right) {
+ rtWidget.left += fHalf;
+ rtWidget.width -= fHalf;
+ }
+ break;
+ }
+ }
+ XFA_BOX_Stroke_Rect(box, strokes, pGS, rtWidget, pMatrix);
+}
+void XFA_DrawBox(CXFA_Box box,
+ CFX_Graphics* pGS,
+ const CFX_RectF& rtWidget,
+ CFX_Matrix* pMatrix,
+ uint32_t dwFlags) {
+ if (!box || box.GetPresence() != XFA_ATTRIBUTEENUM_Visible)
+ return;
+
+ XFA_Element eType = box.GetElementType();
+ if (eType != XFA_Element::Arc && eType != XFA_Element::Border &&
+ eType != XFA_Element::Rectangle) {
+ return;
+ }
+ std::vector<CXFA_Stroke> strokes;
+ if (!(dwFlags & XFA_DRAWBOX_ForceRound) && eType != XFA_Element::Arc)
+ box.GetStrokes(&strokes);
+
+ XFA_BOX_Fill(box, strokes, pGS, rtWidget, pMatrix, dwFlags);
+ XFA_BOX_Stroke(box, strokes, pGS, rtWidget, pMatrix, dwFlags);
+}
+
+CXFA_CalcData::CXFA_CalcData() : m_iRefCount(0) {}
+
+CXFA_CalcData::~CXFA_CalcData() {}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/cxfa_ffwidget.h b/chromium/third_party/pdfium/xfa/fxfa/cxfa_ffwidget.h
new file mode 100644
index 00000000000..35a36002c72
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fxfa/cxfa_ffwidget.h
@@ -0,0 +1,191 @@
+// 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 XFA_FXFA_CXFA_FFWIDGET_H_
+#define XFA_FXFA_CXFA_FFWIDGET_H_
+
+#include <vector>
+
+#include "core/fxcodec/fx_codec_def.h"
+#include "core/fxge/cfx_graphstatedata.h"
+#include "xfa/fwl/cfwl_app.h"
+#include "xfa/fxfa/fxfa.h"
+#include "xfa/fxfa/parser/cxfa_contentlayoutitem.h"
+
+class CXFA_FFPageView;
+class CXFA_FFDocView;
+class CXFA_FFDoc;
+class CXFA_FFApp;
+enum class FWL_WidgetHit;
+
+inline float XFA_UnitPx2Pt(float fPx, float fDpi) {
+ return fPx * 72.0f / fDpi;
+}
+
+#define XFA_FLOAT_PERCISION 0.001f
+#define XFA_CalcData (void*)(uintptr_t) FXBSTR_ID('X', 'F', 'A', 'C')
+
+enum XFA_WIDGETITEM {
+ XFA_WIDGETITEM_Parent,
+ XFA_WIDGETITEM_FirstChild,
+ XFA_WIDGETITEM_NextSibling,
+ XFA_WIDGETITEM_PrevSibling,
+};
+
+int32_t XFA_StrokeTypeSetLineDash(CFX_Graphics* pGraphics,
+ int32_t iStrokeType,
+ int32_t iCapType);
+CFX_GraphStateData::LineCap XFA_LineCapToFXGE(int32_t iLineCap);
+void XFA_DrawImage(CFX_Graphics* pGS,
+ const CFX_RectF& rtImage,
+ CFX_Matrix* pMatrix,
+ const CFX_RetainPtr<CFX_DIBitmap>& pDIBitmap,
+ int32_t iAspect,
+ int32_t iImageXDpi,
+ int32_t iImageYDpi,
+ int32_t iHorzAlign = XFA_ATTRIBUTEENUM_Left,
+ int32_t iVertAlign = XFA_ATTRIBUTEENUM_Top);
+
+CFX_RetainPtr<CFX_DIBitmap> XFA_LoadImageData(CXFA_FFDoc* pDoc,
+ CXFA_Image* pImage,
+ bool& bNameImage,
+ int32_t& iImageXDpi,
+ int32_t& iImageYDpi);
+
+CFX_RetainPtr<CFX_DIBitmap> XFA_LoadImageFromBuffer(
+ const CFX_RetainPtr<IFX_SeekableReadStream>& pImageFileRead,
+ FXCODEC_IMAGE_TYPE type,
+ int32_t& iImageXDpi,
+ int32_t& iImageYDpi);
+
+FXCODEC_IMAGE_TYPE XFA_GetImageType(const CFX_WideString& wsType);
+char* XFA_Base64Encode(const uint8_t* buf, int32_t buf_len);
+void XFA_RectWidthoutMargin(CFX_RectF& rt,
+ const CXFA_Margin& mg,
+ bool bUI = false);
+CXFA_FFWidget* XFA_GetWidgetFromLayoutItem(CXFA_LayoutItem* pLayoutItem);
+bool XFA_IsCreateWidget(XFA_Element iType);
+#define XFA_DRAWBOX_ForceRound 1
+#define XFA_DRAWBOX_Lowered3D 2
+void XFA_DrawBox(CXFA_Box box,
+ CFX_Graphics* pGS,
+ const CFX_RectF& rtWidget,
+ CFX_Matrix* pMatrix,
+ uint32_t dwFlags = 0);
+
+class CXFA_CalcData {
+ public:
+ CXFA_CalcData();
+ ~CXFA_CalcData();
+
+ std::vector<CXFA_WidgetAcc*> m_Globals;
+ int32_t m_iRefCount;
+};
+
+class CXFA_FFWidget : public CXFA_ContentLayoutItem {
+ public:
+ explicit CXFA_FFWidget(CXFA_WidgetAcc* pDataAcc);
+ ~CXFA_FFWidget() override;
+
+ virtual CFX_RectF GetBBox(uint32_t dwStatus, bool bDrawFocus = false);
+ virtual void RenderWidget(CFX_Graphics* pGS,
+ CFX_Matrix* pMatrix,
+ uint32_t dwStatus);
+ virtual bool IsLoaded();
+ virtual bool LoadWidget();
+ virtual void UnloadWidget();
+ virtual bool PerformLayout();
+ virtual bool UpdateFWLData();
+ virtual void UpdateWidgetProperty();
+ virtual bool OnMouseEnter();
+ virtual bool OnMouseExit();
+ virtual bool OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point);
+ virtual bool OnLButtonUp(uint32_t dwFlags, const CFX_PointF& point);
+ virtual bool OnLButtonDblClk(uint32_t dwFlags, const CFX_PointF& point);
+ virtual bool OnMouseMove(uint32_t dwFlags, const CFX_PointF& point);
+ virtual bool OnMouseWheel(uint32_t dwFlags,
+ int16_t zDelta,
+ const CFX_PointF& point);
+ virtual bool OnRButtonDown(uint32_t dwFlags, const CFX_PointF& point);
+ virtual bool OnRButtonUp(uint32_t dwFlags, const CFX_PointF& point);
+ virtual bool OnRButtonDblClk(uint32_t dwFlags, const CFX_PointF& point);
+
+ virtual bool OnSetFocus(CXFA_FFWidget* pOldWidget);
+ virtual bool OnKillFocus(CXFA_FFWidget* pNewWidget);
+ virtual bool OnKeyDown(uint32_t dwKeyCode, uint32_t dwFlags);
+ virtual bool OnKeyUp(uint32_t dwKeyCode, uint32_t dwFlags);
+ virtual bool OnChar(uint32_t dwChar, uint32_t dwFlags);
+ virtual FWL_WidgetHit OnHitTest(const CFX_PointF& point);
+ virtual bool OnSetCursor(const CFX_PointF& point);
+ virtual bool CanUndo();
+ virtual bool CanRedo();
+ virtual bool Undo();
+ virtual bool Redo();
+ virtual bool CanCopy();
+ virtual bool CanCut();
+ virtual bool CanPaste();
+ virtual bool CanSelectAll();
+ virtual bool CanDelete();
+ virtual bool CanDeSelect();
+ virtual bool Copy(CFX_WideString& wsCopy);
+ virtual bool Cut(CFX_WideString& wsCut);
+ virtual bool Paste(const CFX_WideString& wsPaste);
+ virtual void SelectAll();
+ virtual void Delete();
+ virtual void DeSelect();
+ virtual bool GetSuggestWords(CFX_PointF pointf,
+ std::vector<CFX_ByteString>& sSuggest);
+ virtual bool ReplaceSpellCheckWord(CFX_PointF pointf,
+ const CFX_ByteStringC& bsReplace);
+
+ CXFA_FFPageView* GetPageView() const { return m_pPageView; }
+ void SetPageView(CXFA_FFPageView* pPageView) { m_pPageView = pPageView; }
+ const CFX_RectF& GetWidgetRect() const;
+ const CFX_RectF& RecacheWidgetRect() const;
+ uint32_t GetStatus();
+ void ModifyStatus(uint32_t dwAdded, uint32_t dwRemoved);
+
+ CXFA_WidgetAcc* GetDataAcc();
+ bool GetToolTip(CFX_WideString& wsToolTip);
+
+ CXFA_FFDocView* GetDocView();
+ void SetDocView(CXFA_FFDocView* pDocView);
+ CXFA_FFDoc* GetDoc();
+ CXFA_FFApp* GetApp();
+ IXFA_AppProvider* GetAppProvider();
+ void InvalidateWidget(const CFX_RectF* pRect = nullptr);
+ void AddInvalidateRect(const CFX_RectF* pRect = nullptr);
+ bool GetCaptionText(CFX_WideString& wsCap);
+ bool IsFocused();
+ CFX_PointF Rotate2Normal(const CFX_PointF& point);
+ CFX_Matrix GetRotateMatrix();
+ bool IsLayoutRectEmpty();
+ CXFA_FFWidget* GetParent();
+ bool IsAncestorOf(CXFA_FFWidget* pWidget);
+ const CFWL_App* GetFWLApp();
+
+ protected:
+ virtual bool PtInActiveRect(const CFX_PointF& point);
+
+ void DrawBorder(CFX_Graphics* pGS,
+ CXFA_Box box,
+ const CFX_RectF& rtBorder,
+ CFX_Matrix* pMatrix,
+ uint32_t dwFlags = 0);
+
+ CFX_RectF GetRectWithoutRotate();
+ bool IsMatchVisibleStatus(uint32_t dwStatus);
+ void EventKillFocus();
+ bool IsButtonDown();
+ void SetButtonDown(bool bSet);
+
+ CXFA_FFDocView* m_pDocView;
+ CXFA_FFPageView* m_pPageView;
+ CXFA_WidgetAcc* const m_pDataAcc;
+ mutable CFX_RectF m_rtWidget;
+};
+
+#endif // XFA_FXFA_CXFA_FFWIDGET_H_
diff --git a/chromium/third_party/pdfium/xfa/fxfa/cxfa_ffwidgethandler.cpp b/chromium/third_party/pdfium/xfa/fxfa/cxfa_ffwidgethandler.cpp
new file mode 100644
index 00000000000..ffc1c27070b
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fxfa/cxfa_ffwidgethandler.cpp
@@ -0,0 +1,524 @@
+// 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
+
+#include "xfa/fxfa/cxfa_ffwidgethandler.h"
+
+#include <vector>
+
+#include "xfa/fxfa/app/xfa_ffchoicelist.h"
+#include "xfa/fxfa/app/xfa_fffield.h"
+#include "xfa/fxfa/app/xfa_fwladapter.h"
+#include "xfa/fxfa/cxfa_ffdoc.h"
+#include "xfa/fxfa/cxfa_ffdocview.h"
+#include "xfa/fxfa/cxfa_ffwidget.h"
+#include "xfa/fxfa/parser/cxfa_layoutprocessor.h"
+#include "xfa/fxfa/parser/cxfa_measurement.h"
+#include "xfa/fxfa/parser/cxfa_node.h"
+
+CXFA_FFWidgetHandler::CXFA_FFWidgetHandler(CXFA_FFDocView* pDocView)
+ : m_pDocView(pDocView) {}
+
+CXFA_FFWidgetHandler::~CXFA_FFWidgetHandler() {}
+
+bool CXFA_FFWidgetHandler::OnMouseEnter(CXFA_FFWidget* hWidget) {
+ m_pDocView->LockUpdate();
+ bool bRet = hWidget->OnMouseEnter();
+ m_pDocView->UnlockUpdate();
+ m_pDocView->UpdateDocView();
+ return bRet;
+}
+
+bool CXFA_FFWidgetHandler::OnMouseExit(CXFA_FFWidget* hWidget) {
+ m_pDocView->LockUpdate();
+ bool bRet = hWidget->OnMouseExit();
+ m_pDocView->UnlockUpdate();
+ m_pDocView->UpdateDocView();
+ return bRet;
+}
+
+bool CXFA_FFWidgetHandler::OnLButtonDown(CXFA_FFWidget* hWidget,
+ uint32_t dwFlags,
+ const CFX_PointF& point) {
+ m_pDocView->LockUpdate();
+ bool bRet = hWidget->OnLButtonDown(dwFlags, hWidget->Rotate2Normal(point));
+ if (bRet && m_pDocView->SetFocus(hWidget)) {
+ m_pDocView->GetDoc()->GetDocEnvironment()->SetFocusWidget(
+ m_pDocView->GetDoc(), hWidget);
+ }
+ m_pDocView->UnlockUpdate();
+ m_pDocView->UpdateDocView();
+ return bRet;
+}
+
+bool CXFA_FFWidgetHandler::OnLButtonUp(CXFA_FFWidget* hWidget,
+ uint32_t dwFlags,
+ const CFX_PointF& point) {
+ m_pDocView->LockUpdate();
+ m_pDocView->m_bLayoutEvent = true;
+ bool bRet = hWidget->OnLButtonUp(dwFlags, hWidget->Rotate2Normal(point));
+ m_pDocView->UnlockUpdate();
+ m_pDocView->UpdateDocView();
+ return bRet;
+}
+
+bool CXFA_FFWidgetHandler::OnLButtonDblClk(CXFA_FFWidget* hWidget,
+ uint32_t dwFlags,
+ const CFX_PointF& point) {
+ bool bRet = hWidget->OnLButtonDblClk(dwFlags, hWidget->Rotate2Normal(point));
+ m_pDocView->RunInvalidate();
+ return bRet;
+}
+
+bool CXFA_FFWidgetHandler::OnMouseMove(CXFA_FFWidget* hWidget,
+ uint32_t dwFlags,
+ const CFX_PointF& point) {
+ bool bRet = hWidget->OnMouseMove(dwFlags, hWidget->Rotate2Normal(point));
+ m_pDocView->RunInvalidate();
+ return bRet;
+}
+
+bool CXFA_FFWidgetHandler::OnMouseWheel(CXFA_FFWidget* hWidget,
+ uint32_t dwFlags,
+ int16_t zDelta,
+ const CFX_PointF& point) {
+ bool bRet =
+ hWidget->OnMouseWheel(dwFlags, zDelta, hWidget->Rotate2Normal(point));
+ m_pDocView->RunInvalidate();
+ return bRet;
+}
+
+bool CXFA_FFWidgetHandler::OnRButtonDown(CXFA_FFWidget* hWidget,
+ uint32_t dwFlags,
+ const CFX_PointF& point) {
+ bool bRet = hWidget->OnRButtonDown(dwFlags, hWidget->Rotate2Normal(point));
+ if (bRet && m_pDocView->SetFocus(hWidget)) {
+ m_pDocView->GetDoc()->GetDocEnvironment()->SetFocusWidget(
+ m_pDocView->GetDoc(), hWidget);
+ }
+ m_pDocView->RunInvalidate();
+ return bRet;
+}
+
+bool CXFA_FFWidgetHandler::OnRButtonUp(CXFA_FFWidget* hWidget,
+ uint32_t dwFlags,
+ const CFX_PointF& point) {
+ bool bRet = hWidget->OnRButtonUp(dwFlags, hWidget->Rotate2Normal(point));
+ m_pDocView->RunInvalidate();
+ return bRet;
+}
+
+bool CXFA_FFWidgetHandler::OnRButtonDblClk(CXFA_FFWidget* hWidget,
+ uint32_t dwFlags,
+ const CFX_PointF& point) {
+ bool bRet = hWidget->OnRButtonDblClk(dwFlags, hWidget->Rotate2Normal(point));
+ m_pDocView->RunInvalidate();
+ return bRet;
+}
+
+bool CXFA_FFWidgetHandler::OnKeyDown(CXFA_FFWidget* hWidget,
+ uint32_t dwKeyCode,
+ uint32_t dwFlags) {
+ bool bRet = hWidget->OnKeyDown(dwKeyCode, dwFlags);
+ m_pDocView->RunInvalidate();
+ m_pDocView->UpdateDocView();
+ return bRet;
+}
+
+bool CXFA_FFWidgetHandler::OnKeyUp(CXFA_FFWidget* hWidget,
+ uint32_t dwKeyCode,
+ uint32_t dwFlags) {
+ bool bRet = hWidget->OnKeyUp(dwKeyCode, dwFlags);
+ m_pDocView->RunInvalidate();
+ return bRet;
+}
+
+bool CXFA_FFWidgetHandler::OnChar(CXFA_FFWidget* hWidget,
+ uint32_t dwChar,
+ uint32_t dwFlags) {
+ bool bRet = hWidget->OnChar(dwChar, dwFlags);
+ m_pDocView->RunInvalidate();
+ return bRet;
+}
+
+FWL_WidgetHit CXFA_FFWidgetHandler::OnHitTest(CXFA_FFWidget* hWidget,
+ const CFX_PointF& point) {
+ if (!(hWidget->GetStatus() & XFA_WidgetStatus_Visible))
+ return FWL_WidgetHit::Unknown;
+ return hWidget->OnHitTest(hWidget->Rotate2Normal(point));
+}
+
+bool CXFA_FFWidgetHandler::OnSetCursor(CXFA_FFWidget* hWidget,
+ const CFX_PointF& point) {
+ return hWidget->OnSetCursor(hWidget->Rotate2Normal(point));
+}
+
+void CXFA_FFWidgetHandler::RenderWidget(CXFA_FFWidget* hWidget,
+ CFX_Graphics* pGS,
+ CFX_Matrix* pMatrix,
+ bool bHighlight) {
+ hWidget->RenderWidget(pGS, pMatrix,
+ bHighlight ? XFA_WidgetStatus_Highlight : 0);
+}
+
+bool CXFA_FFWidgetHandler::HasEvent(CXFA_WidgetAcc* pWidgetAcc,
+ XFA_EVENTTYPE eEventType) {
+ if (eEventType == XFA_EVENT_Unknown)
+ return false;
+
+ if (!pWidgetAcc || pWidgetAcc->GetElementType() == XFA_Element::Draw)
+ return false;
+
+ switch (eEventType) {
+ case XFA_EVENT_Calculate: {
+ CXFA_Calculate calc = pWidgetAcc->GetCalculate();
+ return calc && calc.GetScript();
+ }
+ case XFA_EVENT_Validate: {
+ CXFA_Validate val = pWidgetAcc->GetValidate();
+ return val && val.GetScript();
+ }
+ default:
+ break;
+ }
+ return !pWidgetAcc->GetEventByActivity(gs_EventActivity[eEventType]).empty();
+}
+
+int32_t CXFA_FFWidgetHandler::ProcessEvent(CXFA_WidgetAcc* pWidgetAcc,
+ CXFA_EventParam* pParam) {
+ if (!pParam || pParam->m_eType == XFA_EVENT_Unknown)
+ return XFA_EVENTERROR_NotExist;
+ if (!pWidgetAcc || pWidgetAcc->GetElementType() == XFA_Element::Draw)
+ return XFA_EVENTERROR_NotExist;
+
+ switch (pParam->m_eType) {
+ case XFA_EVENT_Calculate:
+ return pWidgetAcc->ProcessCalculate();
+ case XFA_EVENT_Validate:
+ if (m_pDocView->GetDoc()->GetDocEnvironment()->IsValidationsEnabled(
+ m_pDocView->GetDoc())) {
+ return pWidgetAcc->ProcessValidate();
+ }
+ return XFA_EVENTERROR_Disabled;
+ case XFA_EVENT_InitCalculate: {
+ CXFA_Calculate calc = pWidgetAcc->GetCalculate();
+ if (!calc)
+ return XFA_EVENTERROR_NotExist;
+ if (pWidgetAcc->GetNode()->IsUserInteractive())
+ return XFA_EVENTERROR_Disabled;
+
+ CXFA_Script script = calc.GetScript();
+ return pWidgetAcc->ExecuteScript(script, pParam);
+ }
+ default:
+ break;
+ }
+ int32_t iRet =
+ pWidgetAcc->ProcessEvent(gs_EventActivity[pParam->m_eType], pParam);
+ return iRet;
+}
+
+CXFA_FFWidget* CXFA_FFWidgetHandler::CreateWidget(CXFA_FFWidget* hParent,
+ XFA_WIDGETTYPE eType,
+ CXFA_FFWidget* hBefore) {
+ CXFA_Node* pParentFormItem =
+ hParent ? hParent->GetDataAcc()->GetNode() : nullptr;
+ CXFA_Node* pBeforeFormItem =
+ hBefore ? hBefore->GetDataAcc()->GetNode() : nullptr;
+ CXFA_Node* pNewFormItem =
+ CreateWidgetFormItem(eType, pParentFormItem, pBeforeFormItem);
+ if (!pNewFormItem)
+ return nullptr;
+
+ pNewFormItem->GetTemplateNode()->SetFlag(XFA_NodeFlag_Initialized, true);
+ pNewFormItem->SetFlag(XFA_NodeFlag_Initialized, true);
+ m_pDocView->RunLayout();
+ CXFA_LayoutItem* pLayout =
+ m_pDocView->GetXFALayout()->GetLayoutItem(pNewFormItem);
+ return static_cast<CXFA_FFWidget*>(pLayout);
+}
+
+CXFA_Node* CXFA_FFWidgetHandler::CreateWidgetFormItem(
+ XFA_WIDGETTYPE eType,
+ CXFA_Node* pParent,
+ CXFA_Node* pBefore) const {
+ switch (eType) {
+ case XFA_WIDGETTYPE_Barcode:
+ return nullptr;
+ case XFA_WIDGETTYPE_PushButton:
+ return CreatePushButton(pParent, pBefore);
+ case XFA_WIDGETTYPE_CheckButton:
+ return CreateCheckButton(pParent, pBefore);
+ case XFA_WIDGETTYPE_ExcludeGroup:
+ return CreateExclGroup(pParent, pBefore);
+ case XFA_WIDGETTYPE_RadioButton:
+ return CreateRadioButton(pParent, pBefore);
+ case XFA_WIDGETTYPE_Arc:
+ return CreateArc(pParent, pBefore);
+ case XFA_WIDGETTYPE_Rectangle:
+ return CreateRectangle(pParent, pBefore);
+ case XFA_WIDGETTYPE_Image:
+ return CreateImage(pParent, pBefore);
+ case XFA_WIDGETTYPE_Line:
+ return CreateLine(pParent, pBefore);
+ case XFA_WIDGETTYPE_Text:
+ return CreateText(pParent, pBefore);
+ case XFA_WIDGETTYPE_DatetimeEdit:
+ return CreateDatetimeEdit(pParent, pBefore);
+ case XFA_WIDGETTYPE_DecimalField:
+ return CreateDecimalField(pParent, pBefore);
+ case XFA_WIDGETTYPE_NumericField:
+ return CreateNumericField(pParent, pBefore);
+ case XFA_WIDGETTYPE_Signature:
+ return CreateSignature(pParent, pBefore);
+ case XFA_WIDGETTYPE_TextEdit:
+ return CreateTextEdit(pParent, pBefore);
+ case XFA_WIDGETTYPE_DropdownList:
+ return CreateDropdownList(pParent, pBefore);
+ case XFA_WIDGETTYPE_ListBox:
+ return CreateListBox(pParent, pBefore);
+ case XFA_WIDGETTYPE_ImageField:
+ return CreateImageField(pParent, pBefore);
+ case XFA_WIDGETTYPE_PasswordEdit:
+ return CreatePasswordEdit(pParent, pBefore);
+ case XFA_WIDGETTYPE_Subform:
+ return CreateSubform(pParent, pBefore);
+ default:
+ return nullptr;
+ }
+}
+
+CXFA_Node* CXFA_FFWidgetHandler::CreatePushButton(CXFA_Node* pParent,
+ CXFA_Node* pBefore) const {
+ CXFA_Node* pField = CreateField(XFA_Element::Button, pParent, pBefore);
+ CXFA_Node* pCaption = CreateCopyNode(XFA_Element::Caption, pField);
+ CXFA_Node* pValue = CreateCopyNode(XFA_Element::Value, pCaption);
+ CXFA_Node* pText = CreateCopyNode(XFA_Element::Text, pValue);
+ pText->SetContent(L"Button", L"Button", false);
+
+ CXFA_Node* pPara = CreateCopyNode(XFA_Element::Para, pCaption);
+ pPara->SetEnum(XFA_ATTRIBUTE_VAlign, XFA_ATTRIBUTEENUM_Middle, false);
+ pPara->SetEnum(XFA_ATTRIBUTE_HAlign, XFA_ATTRIBUTEENUM_Center, false);
+ CreateFontNode(pCaption);
+
+ CXFA_Node* pBorder = CreateCopyNode(XFA_Element::Border, pField);
+ pBorder->SetEnum(XFA_ATTRIBUTE_Hand, XFA_ATTRIBUTEENUM_Right, false);
+
+ CXFA_Node* pEdge = CreateCopyNode(XFA_Element::Edge, pBorder);
+ pEdge->SetEnum(XFA_ATTRIBUTE_Stroke, XFA_ATTRIBUTEENUM_Raised, false);
+
+ CXFA_Node* pFill = CreateCopyNode(XFA_Element::Fill, pBorder);
+ CXFA_Node* pColor = CreateCopyNode(XFA_Element::Color, pFill);
+ pColor->SetCData(XFA_ATTRIBUTE_Value, L"212, 208, 200", false);
+
+ CXFA_Node* pBind = CreateCopyNode(XFA_Element::Bind, pField);
+ pBind->SetEnum(XFA_ATTRIBUTE_Match, XFA_ATTRIBUTEENUM_None);
+
+ return pField;
+}
+
+CXFA_Node* CXFA_FFWidgetHandler::CreateCheckButton(CXFA_Node* pParent,
+ CXFA_Node* pBefore) const {
+ return CreateField(XFA_Element::CheckButton, pParent, pBefore);
+}
+
+CXFA_Node* CXFA_FFWidgetHandler::CreateExclGroup(CXFA_Node* pParent,
+ CXFA_Node* pBefore) const {
+ return CreateFormItem(XFA_Element::ExclGroup, pParent, pBefore);
+}
+
+CXFA_Node* CXFA_FFWidgetHandler::CreateRadioButton(CXFA_Node* pParent,
+ CXFA_Node* pBefore) const {
+ CXFA_Node* pField = CreateField(XFA_Element::CheckButton, pParent, pBefore);
+ CXFA_Node* pUi = pField->GetFirstChildByClass(XFA_Element::Ui);
+ CXFA_Node* pWidget = pUi->GetFirstChildByClass(XFA_Element::CheckButton);
+ pWidget->SetEnum(XFA_ATTRIBUTE_Shape, XFA_ATTRIBUTEENUM_Round);
+ return pField;
+}
+
+CXFA_Node* CXFA_FFWidgetHandler::CreateDatetimeEdit(CXFA_Node* pParent,
+ CXFA_Node* pBefore) const {
+ CXFA_Node* pField = CreateField(XFA_Element::DateTimeEdit, pParent, pBefore);
+ CreateValueNode(XFA_Element::Date, pField);
+ return pField;
+}
+
+CXFA_Node* CXFA_FFWidgetHandler::CreateDecimalField(CXFA_Node* pParent,
+ CXFA_Node* pBefore) const {
+ CXFA_Node* pField = CreateNumericField(pParent, pBefore);
+ CreateValueNode(XFA_Element::Decimal, pField);
+ return pField;
+}
+
+CXFA_Node* CXFA_FFWidgetHandler::CreateNumericField(CXFA_Node* pParent,
+ CXFA_Node* pBefore) const {
+ return CreateField(XFA_Element::NumericEdit, pParent, pBefore);
+}
+
+CXFA_Node* CXFA_FFWidgetHandler::CreateSignature(CXFA_Node* pParent,
+ CXFA_Node* pBefore) const {
+ return CreateField(XFA_Element::Signature, pParent, pBefore);
+}
+
+CXFA_Node* CXFA_FFWidgetHandler::CreateTextEdit(CXFA_Node* pParent,
+ CXFA_Node* pBefore) const {
+ return CreateField(XFA_Element::TextEdit, pParent, pBefore);
+}
+
+CXFA_Node* CXFA_FFWidgetHandler::CreateDropdownList(CXFA_Node* pParent,
+ CXFA_Node* pBefore) const {
+ return CreateField(XFA_Element::ChoiceList, pParent, pBefore);
+}
+
+CXFA_Node* CXFA_FFWidgetHandler::CreateListBox(CXFA_Node* pParent,
+ CXFA_Node* pBefore) const {
+ CXFA_Node* pField = CreateDropdownList(pParent, pBefore);
+ CXFA_Node* pUi = pField->GetNodeItem(XFA_NODEITEM_FirstChild);
+ CXFA_Node* pListBox = pUi->GetNodeItem(XFA_NODEITEM_FirstChild);
+ pListBox->SetEnum(XFA_ATTRIBUTE_Open, XFA_ATTRIBUTEENUM_Always);
+ pListBox->SetEnum(XFA_ATTRIBUTE_CommitOn, XFA_ATTRIBUTEENUM_Exit);
+ return pField;
+}
+
+CXFA_Node* CXFA_FFWidgetHandler::CreateImageField(CXFA_Node* pParent,
+ CXFA_Node* pBefore) const {
+ return CreateField(XFA_Element::ImageEdit, pParent, pBefore);
+}
+
+CXFA_Node* CXFA_FFWidgetHandler::CreatePasswordEdit(CXFA_Node* pParent,
+ CXFA_Node* pBefore) const {
+ CXFA_Node* pField = CreateField(XFA_Element::PasswordEdit, pParent, pBefore);
+ CXFA_Node* pBind = CreateCopyNode(XFA_Element::Bind, pField);
+ pBind->SetEnum(XFA_ATTRIBUTE_Match, XFA_ATTRIBUTEENUM_None, false);
+ return pField;
+}
+
+CXFA_Node* CXFA_FFWidgetHandler::CreateField(XFA_Element eElement,
+ CXFA_Node* pParent,
+ CXFA_Node* pBefore) const {
+ CXFA_Node* pField = CreateFormItem(XFA_Element::Field, pParent, pBefore);
+ CreateCopyNode(eElement, CreateCopyNode(XFA_Element::Ui, pField));
+ CreateFontNode(pField);
+ return pField;
+}
+
+CXFA_Node* CXFA_FFWidgetHandler::CreateArc(CXFA_Node* pParent,
+ CXFA_Node* pBefore) const {
+ return CreateDraw(XFA_Element::Arc, pParent, pBefore);
+}
+
+CXFA_Node* CXFA_FFWidgetHandler::CreateRectangle(CXFA_Node* pParent,
+ CXFA_Node* pBefore) const {
+ return CreateDraw(XFA_Element::Rectangle, pParent, pBefore);
+}
+
+CXFA_Node* CXFA_FFWidgetHandler::CreateImage(CXFA_Node* pParent,
+ CXFA_Node* pBefore) const {
+ CXFA_Node* pField = CreateDraw(XFA_Element::Image, pParent, pBefore);
+ CreateCopyNode(XFA_Element::ImageEdit,
+ CreateCopyNode(XFA_Element::Ui, pField));
+ return pField;
+}
+
+CXFA_Node* CXFA_FFWidgetHandler::CreateLine(CXFA_Node* pParent,
+ CXFA_Node* pBefore) const {
+ return CreateDraw(XFA_Element::Line, pParent, pBefore);
+}
+
+CXFA_Node* CXFA_FFWidgetHandler::CreateText(CXFA_Node* pParent,
+ CXFA_Node* pBefore) const {
+ CXFA_Node* pField = CreateDraw(XFA_Element::Text, pParent, pBefore);
+ CreateCopyNode(XFA_Element::TextEdit,
+ CreateCopyNode(XFA_Element::Ui, pField));
+ CreateFontNode(pField);
+ return pField;
+}
+
+CXFA_Node* CXFA_FFWidgetHandler::CreateDraw(XFA_Element eElement,
+ CXFA_Node* pParent,
+ CXFA_Node* pBefore) const {
+ CXFA_Node* pDraw = CreateFormItem(XFA_Element::Draw, pParent, pBefore);
+ CreateValueNode(eElement, pDraw);
+ return pDraw;
+}
+
+CXFA_Node* CXFA_FFWidgetHandler::CreateSubform(CXFA_Node* pParent,
+ CXFA_Node* pBefore) const {
+ return CreateFormItem(XFA_Element::Subform, pParent, pBefore);
+}
+
+CXFA_Node* CXFA_FFWidgetHandler::CreateFormItem(XFA_Element eElement,
+ CXFA_Node* pParent,
+ CXFA_Node* pBefore) const {
+ CXFA_Node* pTemplateParent = pParent ? pParent->GetTemplateNode() : nullptr;
+ CXFA_Node* pNewFormItem = pTemplateParent->CloneTemplateToForm(false);
+ if (pParent)
+ pParent->InsertChild(pNewFormItem, pBefore);
+ return pNewFormItem;
+}
+
+CXFA_Node* CXFA_FFWidgetHandler::CreateCopyNode(XFA_Element eElement,
+ CXFA_Node* pParent,
+ CXFA_Node* pBefore) const {
+ CXFA_Node* pTemplateParent = pParent ? pParent->GetTemplateNode() : nullptr;
+ CXFA_Node* pNewNode =
+ CreateTemplateNode(eElement, pTemplateParent,
+ pBefore ? pBefore->GetTemplateNode() : nullptr)
+ ->Clone(false);
+ if (pParent)
+ pParent->InsertChild(pNewNode, pBefore);
+ return pNewNode;
+}
+
+CXFA_Node* CXFA_FFWidgetHandler::CreateTemplateNode(XFA_Element eElement,
+ CXFA_Node* pParent,
+ CXFA_Node* pBefore) const {
+ CXFA_Document* pXFADoc = GetXFADoc();
+ CXFA_Node* pNewTemplateNode =
+ pXFADoc->CreateNode(XFA_XDPPACKET_Template, eElement);
+ if (pParent)
+ pParent->InsertChild(pNewTemplateNode, pBefore);
+ return pNewTemplateNode;
+}
+
+CXFA_Node* CXFA_FFWidgetHandler::CreateFontNode(CXFA_Node* pParent) const {
+ CXFA_Node* pFont = CreateCopyNode(XFA_Element::Font, pParent);
+ pFont->SetCData(XFA_ATTRIBUTE_Typeface, L"Myriad Pro", false);
+ return pFont;
+}
+
+CXFA_Node* CXFA_FFWidgetHandler::CreateMarginNode(CXFA_Node* pParent,
+ uint32_t dwFlags,
+ float fInsets[4]) const {
+ CXFA_Node* pMargin = CreateCopyNode(XFA_Element::Margin, pParent);
+ if (dwFlags & 0x01)
+ pMargin->SetMeasure(XFA_ATTRIBUTE_LeftInset,
+ CXFA_Measurement(fInsets[0], XFA_UNIT_Pt), false);
+ if (dwFlags & 0x02)
+ pMargin->SetMeasure(XFA_ATTRIBUTE_TopInset,
+ CXFA_Measurement(fInsets[1], XFA_UNIT_Pt), false);
+ if (dwFlags & 0x04)
+ pMargin->SetMeasure(XFA_ATTRIBUTE_RightInset,
+ CXFA_Measurement(fInsets[2], XFA_UNIT_Pt), false);
+ if (dwFlags & 0x08)
+ pMargin->SetMeasure(XFA_ATTRIBUTE_BottomInset,
+ CXFA_Measurement(fInsets[3], XFA_UNIT_Pt), false);
+ return pMargin;
+}
+
+CXFA_Node* CXFA_FFWidgetHandler::CreateValueNode(XFA_Element eValue,
+ CXFA_Node* pParent) const {
+ CXFA_Node* pValue = CreateCopyNode(XFA_Element::Value, pParent);
+ CreateCopyNode(eValue, pValue);
+ return pValue;
+}
+
+CXFA_Document* CXFA_FFWidgetHandler::GetObjFactory() const {
+ return GetXFADoc();
+}
+
+CXFA_Document* CXFA_FFWidgetHandler::GetXFADoc() const {
+ return m_pDocView->GetDoc()->GetXFADoc();
+}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/cxfa_ffwidgethandler.h b/chromium/third_party/pdfium/xfa/fxfa/cxfa_ffwidgethandler.h
new file mode 100644
index 00000000000..8f44dbbd454
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fxfa/cxfa_ffwidgethandler.h
@@ -0,0 +1,119 @@
+// 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 XFA_FXFA_CXFA_FFWIDGETHANDLER_H_
+#define XFA_FXFA_CXFA_FFWIDGETHANDLER_H_
+
+#include <vector>
+
+#include "xfa/fxfa/cxfa_eventparam.h"
+#include "xfa/fxfa/fxfa.h"
+#include "xfa/fxfa/parser/cxfa_document.h"
+
+class CXFA_FFDocView;
+enum class FWL_WidgetHit;
+
+class CXFA_FFWidgetHandler {
+ public:
+ explicit CXFA_FFWidgetHandler(CXFA_FFDocView* pDocView);
+ ~CXFA_FFWidgetHandler();
+
+ CXFA_FFWidget* CreateWidget(CXFA_FFWidget* hParent,
+ XFA_WIDGETTYPE eType,
+ CXFA_FFWidget* hBefore = nullptr);
+
+ bool OnMouseEnter(CXFA_FFWidget* hWidget);
+ bool OnMouseExit(CXFA_FFWidget* hWidget);
+ bool OnLButtonDown(CXFA_FFWidget* hWidget,
+ uint32_t dwFlags,
+ const CFX_PointF& point);
+ bool OnLButtonUp(CXFA_FFWidget* hWidget,
+ uint32_t dwFlags,
+ const CFX_PointF& point);
+ bool OnLButtonDblClk(CXFA_FFWidget* hWidget,
+ uint32_t dwFlags,
+ const CFX_PointF& point);
+ bool OnMouseMove(CXFA_FFWidget* hWidget,
+ uint32_t dwFlags,
+ const CFX_PointF& point);
+ bool OnMouseWheel(CXFA_FFWidget* hWidget,
+ uint32_t dwFlags,
+ int16_t zDelta,
+ const CFX_PointF& point);
+ bool OnRButtonDown(CXFA_FFWidget* hWidget,
+ uint32_t dwFlags,
+ const CFX_PointF& point);
+ bool OnRButtonUp(CXFA_FFWidget* hWidget,
+ uint32_t dwFlags,
+ const CFX_PointF& point);
+ bool OnRButtonDblClk(CXFA_FFWidget* hWidget,
+ uint32_t dwFlags,
+ const CFX_PointF& point);
+
+ bool OnKeyDown(CXFA_FFWidget* hWidget, uint32_t dwKeyCode, uint32_t dwFlags);
+ bool OnKeyUp(CXFA_FFWidget* hWidget, uint32_t dwKeyCode, uint32_t dwFlags);
+ bool OnChar(CXFA_FFWidget* hWidget, uint32_t dwChar, uint32_t dwFlags);
+ FWL_WidgetHit OnHitTest(CXFA_FFWidget* hWidget, const CFX_PointF& point);
+ bool OnSetCursor(CXFA_FFWidget* hWidget, const CFX_PointF& point);
+ void RenderWidget(CXFA_FFWidget* hWidget,
+ CFX_Graphics* pGS,
+ CFX_Matrix* pMatrix,
+ bool bHighlight);
+ bool HasEvent(CXFA_WidgetAcc* pWidgetAcc, XFA_EVENTTYPE eEventType);
+ int32_t ProcessEvent(CXFA_WidgetAcc* pWidgetAcc, CXFA_EventParam* pParam);
+
+ private:
+ CXFA_Node* CreateWidgetFormItem(XFA_WIDGETTYPE eType,
+ CXFA_Node* pParent,
+ CXFA_Node* pBefore) const;
+
+ CXFA_Node* CreatePushButton(CXFA_Node* pParent, CXFA_Node* pBefore) const;
+ CXFA_Node* CreateCheckButton(CXFA_Node* pParent, CXFA_Node* pBefore) const;
+ CXFA_Node* CreateExclGroup(CXFA_Node* pParent, CXFA_Node* pBefore) const;
+ CXFA_Node* CreateRadioButton(CXFA_Node* pParent, CXFA_Node* pBefore) const;
+ CXFA_Node* CreateDatetimeEdit(CXFA_Node* pParent, CXFA_Node* pBefore) const;
+ CXFA_Node* CreateDecimalField(CXFA_Node* pParent, CXFA_Node* pBefore) const;
+ CXFA_Node* CreateNumericField(CXFA_Node* pParent, CXFA_Node* pBefore) const;
+ CXFA_Node* CreateSignature(CXFA_Node* pParent, CXFA_Node* pBefore) const;
+ CXFA_Node* CreateTextEdit(CXFA_Node* pParent, CXFA_Node* pBefore) const;
+ CXFA_Node* CreateDropdownList(CXFA_Node* pParent, CXFA_Node* pBefore) const;
+ CXFA_Node* CreateListBox(CXFA_Node* pParent, CXFA_Node* pBefore) const;
+ CXFA_Node* CreateImageField(CXFA_Node* pParent, CXFA_Node* pBefore) const;
+ CXFA_Node* CreatePasswordEdit(CXFA_Node* pParent, CXFA_Node* pBefore) const;
+ CXFA_Node* CreateField(XFA_Element eElement,
+ CXFA_Node* pParent,
+ CXFA_Node* pBefore) const;
+ CXFA_Node* CreateArc(CXFA_Node* pParent, CXFA_Node* pBefore) const;
+ CXFA_Node* CreateRectangle(CXFA_Node* pParent, CXFA_Node* pBefore) const;
+ CXFA_Node* CreateImage(CXFA_Node* pParent, CXFA_Node* pBefore) const;
+ CXFA_Node* CreateLine(CXFA_Node* pParent, CXFA_Node* pBefore) const;
+ CXFA_Node* CreateText(CXFA_Node* pParent, CXFA_Node* pBefore) const;
+ CXFA_Node* CreateDraw(XFA_Element eElement,
+ CXFA_Node* pParent,
+ CXFA_Node* pBefore) const;
+
+ CXFA_Node* CreateSubform(CXFA_Node* pParent, CXFA_Node* pBefore) const;
+ CXFA_Node* CreateFormItem(XFA_Element eElement,
+ CXFA_Node* pParent,
+ CXFA_Node* pBefore) const;
+ CXFA_Node* CreateCopyNode(XFA_Element eElement,
+ CXFA_Node* pParent,
+ CXFA_Node* pBefore = nullptr) const;
+ CXFA_Node* CreateTemplateNode(XFA_Element eElement,
+ CXFA_Node* pParent,
+ CXFA_Node* pBefore) const;
+ CXFA_Node* CreateFontNode(CXFA_Node* pParent) const;
+ CXFA_Node* CreateMarginNode(CXFA_Node* pParent,
+ uint32_t dwFlags,
+ float fInsets[4]) const;
+ CXFA_Node* CreateValueNode(XFA_Element eValue, CXFA_Node* pParent) const;
+ CXFA_Document* GetObjFactory() const;
+ CXFA_Document* GetXFADoc() const;
+
+ CXFA_FFDocView* m_pDocView;
+};
+
+#endif // XFA_FXFA_CXFA_FFWIDGETHANDLER_H_
diff --git a/chromium/third_party/pdfium/xfa/fxfa/cxfa_fileread.cpp b/chromium/third_party/pdfium/xfa/fxfa/cxfa_fileread.cpp
new file mode 100644
index 00000000000..e2ecad2e93f
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fxfa/cxfa_fileread.cpp
@@ -0,0 +1,56 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "xfa/fxfa/cxfa_fileread.h"
+
+#include <algorithm>
+
+#include "core/fpdfapi/parser/cpdf_stream_acc.h"
+#include "third_party/base/stl_util.h"
+
+CXFA_FileRead::CXFA_FileRead(const std::vector<CPDF_Stream*>& streams) {
+ for (CPDF_Stream* pStream : streams) {
+ m_Data.push_back(pdfium::MakeRetain<CPDF_StreamAcc>(pStream));
+ m_Data.back()->LoadAllData();
+ }
+}
+
+CXFA_FileRead::~CXFA_FileRead() {}
+
+FX_FILESIZE CXFA_FileRead::GetSize() {
+ uint32_t dwSize = 0;
+ for (const auto& acc : m_Data)
+ dwSize += acc->GetSize();
+ return dwSize;
+}
+
+bool CXFA_FileRead::ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) {
+ int32_t iCount = pdfium::CollectionSize<int32_t>(m_Data);
+ int32_t index = 0;
+ while (index < iCount) {
+ const auto& acc = m_Data[index];
+ FX_FILESIZE dwSize = acc->GetSize();
+ if (offset < dwSize)
+ break;
+
+ offset -= dwSize;
+ index++;
+ }
+ while (index < iCount) {
+ const auto& acc = m_Data[index];
+ uint32_t dwSize = acc->GetSize();
+ size_t dwRead = std::min(size, static_cast<size_t>(dwSize - offset));
+ memcpy(buffer, acc->GetData() + offset, dwRead);
+ size -= dwRead;
+ if (size == 0)
+ return true;
+
+ buffer = static_cast<uint8_t*>(buffer) + dwRead;
+ offset = 0;
+ index++;
+ }
+ return false;
+}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/cxfa_fileread.h b/chromium/third_party/pdfium/xfa/fxfa/cxfa_fileread.h
new file mode 100644
index 00000000000..0c3348b8d5d
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fxfa/cxfa_fileread.h
@@ -0,0 +1,31 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef XFA_FXFA_CXFA_FILEREAD_H_
+#define XFA_FXFA_CXFA_FILEREAD_H_
+
+#include <vector>
+
+#include "core/fxcrt/cfx_retain_ptr.h"
+#include "core/fxcrt/fx_stream.h"
+
+class CPDF_Stream;
+class CPDF_StreamAcc;
+
+class CXFA_FileRead : public IFX_SeekableReadStream {
+ public:
+ explicit CXFA_FileRead(const std::vector<CPDF_Stream*>& streams);
+ ~CXFA_FileRead() override;
+
+ // IFX_SeekableReadStream
+ FX_FILESIZE GetSize() override;
+ bool ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override;
+
+ private:
+ std::vector<CFX_RetainPtr<CPDF_StreamAcc>> m_Data;
+};
+
+#endif // XFA_FXFA_CXFA_FILEREAD_H_
diff --git a/chromium/third_party/pdfium/xfa/fxfa/cxfa_fontmgr.cpp b/chromium/third_party/pdfium/xfa/fxfa/cxfa_fontmgr.cpp
new file mode 100644
index 00000000000..81e296f8a4c
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fxfa/cxfa_fontmgr.cpp
@@ -0,0 +1,1797 @@
+// 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
+
+#include "xfa/fxfa/cxfa_fontmgr.h"
+
+#include <algorithm>
+#include <memory>
+#include <utility>
+
+#include "core/fpdfapi/font/cpdf_font.h"
+#include "core/fpdfapi/parser/cpdf_dictionary.h"
+#include "core/fpdfapi/parser/cpdf_document.h"
+#include "third_party/base/ptr_util.h"
+#include "xfa/fgas/font/cfgas_gefont.h"
+#include "xfa/fxfa/cxfa_ffapp.h"
+#include "xfa/fxfa/cxfa_ffdoc.h"
+
+namespace {
+
+#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
+const XFA_FONTINFO g_XFAFontsMap[] = {
+ {0x01d5d33e, L"SimSun", L"Arial", 0, 936},
+ {0x01e4f102, L"YouYuan", L"Arial", 1, 936},
+ {0x030549dc, L"LiSu", L"Arial", 1, 936},
+ {0x032edd44, L"Simhei", L"Arial", 1, 936},
+ {0x03eac6fc, L"PoorRichard-Regular", L"Arial", 2, 1252},
+ {0x03ed90e6, L"Nina", L"Arial", 0, 1252},
+ {0x077b56b3, L"KingsoftPhoneticPlain", L"Arial", 0, 1252},
+ {0x078ed524, L"MicrosoftSansSerif", L"Arial", 0, 1252},
+ {0x089b18a9, L"Arial", L"Arial", 0, 1252},
+ {0x0b2cad72, L"MonotypeCorsiva", L"Arial", 8, 1252},
+ {0x0bb003e7, L"Kartika", L"Arial", 2, 1252},
+ {0x0bb469df, L"VinerHandITC", L"Arial", 8, 1252},
+ {0x0bc1a851, L"SegoeUI", L"Arial", 0, 1252},
+ {0x0c112ebd, L"KozukaGothicPro-VIM", L"Arial", 0, 1252},
+ {0x0cfcb9c1, L"AdobeThai", L"Kokila,Arial Narrow", 0, 847},
+ {0x0e7de0f9, L"Playbill", L"Arial", 0, 1252},
+ {0x0eff47c3, L"STHupo", L"Arial", 0, 936},
+ {0x107ad374, L"Constantia", L"Arial", 2, 1252},
+ {0x12194c2d, L"KunstlerScript", L"Arial", 8, 1252},
+ {0x135ef6a1, L"MinionProSmBd",
+ L"Bell MT,Corbel,Times New Roman,Cambria,Berlin Sans FB", 0, 1252},
+ {0x158c4049, L"Garamond", L"Arial", 2, 1252},
+ {0x160ecb24, L"STZhongsong", L"Arial", 0, 936},
+ {0x161ed07e, L"MSGothic", L"Arial", 1, 1252},
+ {0x171d1ed1, L"SnapITC-Regular", L"Arial", 0, 1252},
+ {0x18d1188f, L"Cambria", L"Arial", 2, 1252},
+ {0x18eaf350, L"ArialUnicodeMS", L"Arial", 0, 936},
+ {0x1a92d115, L"MingLiU", L"Arial", 1, 1252},
+ {0x1cc217c6, L"TrebuchetMS", L"Arial", 0, 1252},
+ {0x1d649596, L"BasemicTimes", L"Arial", 0, 1252},
+ {0x1e34ee60, L"BellMT", L"Arial", 2, 1252},
+ {0x1eb36945, L"CooperBlack", L"Arial", 2, 1252},
+ {0x1ef7787d, L"BatangChe", L"Arial", 1, 1252},
+ {0x20b3bd3a, L"BrushScriptMT", L"Arial", 8, 1252},
+ {0x220877aa, L"Candara", L"Arial", 0, 1252},
+ {0x22135007, L"FreestyleScript-Regular", L"Arial", 8, 1252},
+ {0x251059c3, L"Chiller", L"Arial", 0, 1252},
+ {0x25bed6dd, L"MSReferenceSansSerif", L"Arial", 0, 1252},
+ {0x28154c81, L"Parchment-Regular", L"Arial", 8, 1252},
+ {0x29711eb9, L"STLiti", L"Arial", 0, 936},
+ {0x2b1993b4, L"Basemic", L"Arial", 0, 1252},
+ {0x2b316339, L"NiagaraSolid-Reg", L"Arial", 0, 1252},
+ {0x2c147529, L"FootlightMTLight", L"Arial", 0, 1252},
+ {0x2c198928, L"HarlowSolid", L"Arial", 0, 1252},
+ {0x2c6ac6b2, L"LucidaBright", L"Arial", 2, 1252},
+ {0x2c9f38e2, L"KozukaMinchoPro-VIR", L"Arial", 0, 1252},
+ {0x2d5a47b0, L"STCaiyun", L"Arial", 0, 936},
+ {0x2def26bf, L"BernardMT-Condensed", L"Arial", 0, 1252},
+ {0x2fd8930b, L"KozukaMinchoPr6NR", L"Arial", 0, 1252},
+ {0x3115525a, L"FangSong_GB2312", L"Arial", 0, 1252},
+ {0x31327817, L"MyriadPro",
+ L"Calibri,Corbel,Candara,Cambria Math,Franklin Gothic Medium,Arial "
+ L"Narrow,Times New Roman",
+ 0, 1252},
+ {0x32244975, L"Helvetica", L"Arial", 0, 1252},
+ {0x32ac995c, L"Terminal", L"Arial", 0, 1252},
+ {0x338d648a, L"NiagaraEngraved-Reg", L"Arial", 0, 1252},
+ {0x33bb65f2, L"Sylfaen", L"Arial", 2, 1252},
+ {0x3402c30e, L"MSPMincho", L"Arial", 2, 1252},
+ {0x3412bf31, L"SimSun-PUA", L"Arial", 0, 936},
+ {0x36eb39b9, L"BerlinSansFB", L"Arial", 0, 1252},
+ {0x36f42055, L"UniversATT", L"Microsoft Sans Serif", 0, 1252},
+ {0x3864c4f6, L"HighTowerText", L"Arial", 2, 1252},
+ {0x3a257d03, L"FangSong_GB2312", L"Arial", 0, 1252},
+ {0x3cdae668, L"FreestyleScript", L"Arial", 8, 1252},
+ {0x3d55aed7, L"Jokerman", L"Arial", 0, 1252},
+ {0x3d5b4385, L"PMingLiU", L"Arial", 2, 1252},
+ {0x3d9b7669, L"EstrangeloEdessa", L"Arial", 0, 1252},
+ {0x3e532d74, L"FranklinGothicMedium", L"Arial", 0, 1252},
+ {0x3e6aa32d, L"NSimSun", L"Arial", 1, 936},
+ {0x3f6c36a8, L"Gautami", L"Arial", 0, 1252},
+ {0x3ff32662, L"Chiller-Regular", L"Arial", 0, 1252},
+ {0x409de312, L"ModernNo.20", L"Arial", 2, 1252},
+ {0x41443c5e, L"Georgia", L"Arial", 2, 1252},
+ {0x4160ade5, L"BellGothicStdBlack",
+ L"Arial,Arial Unicode MS,Book Antiqua,Dotum,Georgia", 0, 1252},
+ {0x421976c4, L"Modern-Regular", L"Arial", 2, 1252},
+ {0x422a7252, L"Stencil", L"Arial", 0, 1252},
+ {0x42c8554f, L"Fixedsys", L"Arial", 0, 1252},
+ {0x435cb41d, L"Roman", L"Arial", 0, 1252},
+ {0x47882383, L"CourierNew", L"Arial", 1, 1252},
+ {0x480a2338, L"BerlinSansFBDemi", L"Arial", 0, 1252},
+ {0x480bf7a4, L"CourierStd", L"Courier New,Verdana", 0, 1252},
+ {0x481ad6ed, L"VladimirScript", L"Arial", 8, 1252},
+ {0x4911577a, L"YouYuan", L"Arial", 1, 936},
+ {0x4a788d72, L"STXingkai", L"Arial", 0, 936},
+ {0x4bf88566, L"SegoeCondensed", L"Arial", 0, 1252},
+ {0x4ccf51a4, L"BerlinSansFB-Reg", L"Arial", 0, 1252},
+ {0x4ea967ce, L"GulimChe", L"Arial", 1, 1252},
+ {0x4f68bd79, L"LetterGothicStd", L"Courier New,Verdana", 0, 1252},
+ {0x51a0d0e6, L"KozukaGothicPr6NM", L"Arial", 0, 1252},
+ {0x531b3dea, L"BasemicSymbol", L"Arial", 0, 1252},
+ {0x5333fd39, L"CalifornianFB-Reg", L"Arial", 2, 1252},
+ {0x53561a54, L"FZYTK--GBK1-0", L"Arial", 0, 936},
+ {0x55e0dde6, L"LucidaSansTypewriter", L"Arial", 0, 1252},
+ {0x574d4d3d, L"AdobeArabic", L"Arial Narrow", 0, 1252},
+ {0x5792e759, L"STKaiti", L"Arial", 0, 936},
+ {0x5921978e, L"LucidaSansUnicode", L"Arial", 0, 1252},
+ {0x594e2da4, L"Vrinda", L"Arial", 0, 1252},
+ {0x59baa9a2, L"KaiTi_GB2312", L"Arial", 0, 1252},
+ {0x5cfedf4f, L"BaskOldFace", L"Arial", 0, 1252},
+ {0x5f97921c, L"AdobeMyungjoStdM",
+ L"Batang,Bookman Old Style,Consolas,STZhongsong", 0, 936},
+ {0x5fefbfad, L"Batang", L"Arial", 2, 1252},
+ {0x605342b9, L"DotumChe", L"Arial", 1, 1252},
+ {0x608c5f9a, L"KaiTi_GB2312", L"Arial", 0, 936},
+ {0x61efd0d1, L"MaturaMTScriptCapitals", L"Arial", 0, 1252},
+ {0x626608a9, L"MVBoli", L"Arial", 0, 1252},
+ {0x630501a3, L"SmallFonts", L"Arial", 0, 1252},
+ {0x65d0e2a9, L"FZYTK--GBK1-0", L"Arial", 0, 936},
+ {0x669f29e1, L"FZSTK--GBK1-0", L"Arial", 0, 936},
+ {0x673a9e5f, L"Tunga", L"Arial", 0, 1252},
+ {0x691aa4ce, L"NiagaraSolid", L"Arial", 0, 1252},
+ {0x696259b7, L"Corbel", L"Arial", 0, 1252},
+ {0x696ee9be, L"STXihei", L"Arial", 0, 936},
+ {0x6c59cf69, L"Dotum", L"Arial", 0, 1252},
+ {0x707fa561, L"Gungsuh", L"Arial", 2, 1252},
+ {0x71416bb2, L"ZWAdobeF", L"Arial", 0, 1252},
+ {0x71b41801, L"Verdana", L"Arial", 0, 1252},
+ {0x73f25e4c, L"PalatinoLinotype", L"Arial", 0, 1252},
+ {0x73f4d19f, L"NiagaraEngraved", L"Arial", 0, 1252},
+ {0x74001694, L"MyriadProBlack", L"Book Antiqua,Constantia,Dotum,Georgia", 0,
+ 1252},
+ {0x74b14d8f, L"Haettenschweiler", L"Arial", 0, 1252},
+ {0x74cb44ee, L"NSimSun", L"Arial", 1, 936},
+ {0x76b4d7ff, L"Shruti", L"Arial", 0, 1252},
+ {0x788b3533, L"Webdings", L"Arial", 6, 42},
+ {0x797dde99, L"MSSerif", L"Arial", 0, 1252},
+ {0x7a0f9e9e, L"MSMincho", L"Arial", 1, 1252},
+ {0x7b439caf, L"OldEnglishTextMT", L"Arial", 0, 1252},
+ {0x8213a433, L"LucidaSans-Typewriter", L"Arial", 0, 1252},
+ {0x82fec929, L"AdobeSongStdL",
+ L"Centaur,Calibri,STSong,Bell MT,Garamond,Times New Roman", 0, 936},
+ {0x83581825, L"Modern", L"Arial", 0, 1252},
+ {0x835a2823, L"Algerian", L"Arial", 0, 1252},
+ {0x83dab9f5, L"Script", L"Arial", 0, 1252},
+ {0x847b56da, L"Tahoma", L"Arial", 0, 1252},
+ {0x8a783cb2, L"SimSun-PUA", L"Arial", 0, 1252},
+ {0x8b5cac0e, L"Onyx", L"Arial", 0, 1252},
+ {0x8c6a499e, L"Gulim", L"Arial", 0, 1252},
+ {0x8e0af790, L"JuiceITC", L"Arial", 0, 1252},
+ {0x8e8d43b2, L"Centaur", L"Arial", 2, 1252},
+ {0x8ee4dcca, L"BookshelfSymbol7", L"Arial", 0, 1252},
+ {0x90794800, L"BellGothicStdLight", L"Bell MT,Calibri,Times New Roman", 0,
+ 1252},
+ {0x909b516a, L"Century", L"Arial", 2, 1252},
+ {0x92ae370d, L"MSOutlook", L"Arial", 4, 42},
+ {0x93c9fbf1, L"LucidaFax", L"Arial", 2, 1252},
+ {0x9565085e, L"BookAntiqua", L"Arial", 2, 1252},
+ {0x9856d95d, L"AdobeMingStdL", L"Arial,Arial Unicode MS,Cambria,BatangChe",
+ 0, 949},
+ {0x9bbadd6b, L"ColonnaMT", L"Arial", 0, 1252},
+ {0x9cbd16a4, L"ShowcardGothic-Reg", L"Arial", 0, 1252},
+ {0x9d73008e, L"MSSansSerif", L"Arial", 0, 1252},
+ {0xa0607db1, L"GungsuhChe", L"Arial", 1, 1252},
+ {0xa0bcf6a1, L"LatinWide", L"Arial", 2, 1252},
+ {0xa1429b36, L"Symbol", L"Arial", 6, 42},
+ {0xa1fa5abc, L"Wingdings2", L"Arial", 6, 42},
+ {0xa1fa5abd, L"Wingdings3", L"Arial", 6, 42},
+ {0xa427bad4, L"InformalRoman-Regular", L"Arial", 8, 1252},
+ {0xa8b92ece, L"FZSTK--GBK1-0", L"Arial", 0, 936},
+ {0xa8d83ece, L"CalifornianFB", L"Arial", 2, 1252},
+ {0xaa3e082c, L"Kingsoft-Phonetic", L"Arial", 0, 1252},
+ {0xaa6bcabe, L"HarlowSolidItalic", L"Arial", 0, 1252},
+ {0xade5337c, L"MSUIGothic", L"Arial", 0, 1252},
+ {0xb08dd941, L"WideLatin", L"Arial", 2, 1252},
+ {0xb207f05d, L"PoorRichard", L"Arial", 2, 1252},
+ {0xb3bc492f, L"JuiceITC-Regular", L"Arial", 0, 1252},
+ {0xb5545399, L"Marlett", L"Arial", 4, 42},
+ {0xb5dd1ebb, L"BritannicBold", L"Arial", 0, 1252},
+ {0xb699c1c5, L"LucidaCalligraphy-Italic", L"Arial", 0, 1252},
+ {0xb725d629, L"TimesNewRoman", L"Arial", 2, 1252},
+ {0xb7eaebeb, L"AdobeHeitiStdR", L"Batang,Century,Dotum", 0, 936},
+ {0xbd29c486, L"BerlinSansFBDemi-Bold", L"Arial", 0, 1252},
+ {0xbe8a8db4, L"BookshelfSymbolSeven", L"Arial", 0, 1252},
+ {0xc16c0118, L"AdobeHebrew", L"Bell MT,Berlin Sans FB,Calibri", 0, 1252},
+ {0xc318b0af, L"MyriadProLight", L"Calibri,STFangsong,Times New Roman", 0,
+ 1252},
+ {0xc65e5659, L"CambriaMath", L"Arial", 2, 1252},
+ {0xc75c8f05, L"LucidaConsole", L"Arial", 1, 1252},
+ {0xca7c35d6, L"Calibri", L"Arial", 0, 1252},
+ {0xcb053f53, L"MicrosoftYaHei", L"Arial", 0, 936},
+ {0xcb7190f9, L"Magneto-Bold", L"Arial", 0, 1252},
+ {0xcca00cc5, L"System", L"Arial", 0, 1252},
+ {0xccad6f76, L"Jokerman-Regular", L"Arial", 0, 1252},
+ {0xccc5818c, L"EuroSign", L"Arial", 0, 1252},
+ {0xcf3d7234, L"LucidaHandwriting-Italic", L"Arial", 0, 1252},
+ {0xcf7b8fdb, L"MinionPro",
+ L"Bell MT,Corbel,Times New Roman,Cambria,Berlin Sans FB", 0, 1252},
+ {0xcfe5755f, L"Simhei", L"Arial", 1, 936},
+ {0xd011f4ee, L"MSPGothic", L"Arial", 0, 1252},
+ {0xd060e7ef, L"Vivaldi", L"Arial", 8, 1252},
+ {0xd07edec1, L"FranklinGothic-Medium", L"Arial", 0, 1252},
+ {0xd107243f, L"SimSun", L"Arial", 0, 936},
+ {0xd1881562, L"ArialNarrow", L"Arial Narrow", 0, 1252},
+ {0xd22b7dce, L"BodoniMTPosterCompressed", L"Arial", 0, 1252},
+ {0xd22bfa60, L"ComicSansMS", L"Arial", 8, 1252},
+ {0xd3bd0e35, L"Bauhaus93", L"Arial", 0, 1252},
+ {0xd429ee7a, L"STFangsong", L"Arial", 0, 936},
+ {0xd6679c12, L"BernardMTCondensed", L"Arial", 0, 1252},
+ {0xd8e8a027, L"LucidaSans", L"Arial", 0, 1252},
+ {0xd9fe7761, L"HighTowerText-Reg", L"Arial", 2, 1252},
+ {0xda7e551e, L"STSong", L"Arial", 0, 936},
+ {0xdaa6842d, L"STZhongsong", L"Arial", 0, 936},
+ {0xdaaab93f, L"STFangsong", L"Arial", 0, 936},
+ {0xdaeb0713, L"STSong", L"Arial", 0, 936},
+ {0xdafedbef, L"STCaiyun", L"Arial", 0, 936},
+ {0xdb00a3d9, L"Broadway", L"Arial", 0, 1252},
+ {0xdb1f5ad4, L"STXinwei", L"Arial", 0, 936},
+ {0xdb326e7f, L"STKaiti", L"Arial", 0, 936},
+ {0xdb69595a, L"STHupo", L"Arial", 0, 936},
+ {0xdba0082c, L"STXihei", L"Arial", 0, 936},
+ {0xdbd0ab18, L"STXingkai", L"Arial", 0, 936},
+ {0xdc1a7db1, L"STLiti", L"Arial", 0, 936},
+ {0xdc33075f, L"KristenITC-Regular", L"Arial", 8, 1252},
+ {0xdcc7009c, L"Harrington", L"Arial", 0, 1252},
+ {0xdd712466, L"ArialBlack", L"Arial", 0, 1252},
+ {0xdde87b3e, L"Impact", L"Arial", 0, 1252},
+ {0xdf69fb32, L"SnapITC", L"Arial", 0, 1252},
+ {0xdf8b25e8, L"CenturyGothic", L"Arial", 0, 1252},
+ {0xe0f705c0, L"KristenITC", L"Arial", 8, 1252},
+ {0xe1427573, L"Raavi", L"Arial", 0, 1252},
+ {0xe2cea0cb, L"Magneto", L"Arial", 0, 1252},
+ {0xe36a9e17, L"Ravie", L"Arial", 0, 1252},
+ {0xe433f8e2, L"Parchment", L"Arial", 8, 1252},
+ {0xe43dff4a, L"Wingdings", L"Arial", 4, 42},
+ {0xe4e2c405, L"MTExtra", L"Arial", 6, 42},
+ {0xe618cc35, L"InformalRoman", L"Arial", 8, 1252},
+ {0xe6c27ffc, L"Mistral", L"Arial", 8, 1252},
+ {0xe7ebf4b9, L"Courier", L"Courier New", 0, 1252},
+ {0xe8bc4a9d, L"MSReferenceSpecialty", L"Arial", 0, 1252},
+ {0xe90fb013, L"TempusSansITC", L"Arial", 0, 1252},
+ {0xec637b42, L"Consolas", L"Verdana", 1, 1252},
+ {0xed3a683b, L"STXinwei", L"Arial", 0, 936},
+ {0xef264cd1, L"LucidaHandwriting", L"Arial", 0, 1252},
+ {0xf086bca2, L"BaskervilleOldFace", L"Arial", 0, 1252},
+ {0xf1028030, L"Mangal", L"Arial", 2, 1252},
+ {0xf1da7eb9, L"ShowcardGothic", L"Arial", 0, 1252},
+ {0xf210f06a, L"ArialMT", L"Arial", 0, 1252},
+ {0xf477f16a, L"Latha", L"Arial", 0, 1252},
+ {0xf616f3dd, L"LiSu", L"Arial", 1, 936},
+ {0xfa479aa6, L"MicrosoftYaHei", L"Arial", 0, 936},
+ {0xfcd19697, L"BookmanOldStyle", L"Arial", 0, 1252},
+ {0xfe209a82, L"LucidaCalligraphy", L"Arial", 0, 1252},
+ {0xfef135f8, L"AdobeHeitiStd-Regular", L"Batang,Century,Dotum", 0, 936},
+};
+#elif _FXM_PLATFORM_ == _FXM_PLATFORM_LINUX_
+const XFA_FONTINFO g_XFAFontsMap[] = {
+ {0x01d5d33e, L"SimSun",
+ L"WenQuanYi Zen Hei Mono,AR PL UMing CN,AR PL UMing HK,AR PL UMing TW,AR "
+ L"PL UMing TW MBE",
+ 0, 936},
+ {0x01e4f102, L"YouYuan",
+ L"WenQuanYi Zen Hei Mono,AR PL UMing CN,AR PL UMing HK,AR PL UMing TW,AR "
+ L"PL UMing TW MBE",
+ 1, 936},
+ {0x030549dc, L"LiSu",
+ L"WenQuanYi Zen Hei,WenQuanYi Zen Hei Sharp,WenQuanYi Zen Hei "
+ L"Mono,WenQuanYi Micro Hei",
+ 1, 936},
+ {0x032edd44, L"Simhei",
+ L"WenQuanYi Zen Hei,WenQuanYi Zen Hei Sharp,WenQuanYi Zen Hei "
+ L"Mono,WenQuanYi Micro Hei",
+ 1, 936},
+ {0x03eac6fc, L"PoorRichard-Regular", L"Droid Sans Japanese,FreeSerif", 2,
+ 1252},
+ {0x03ed90e6, L"Nina", L"FreeSerif", 0, 1252},
+ {0x077b56b3, L"KingsoftPhoneticPlain",
+ L"Tibetan Machine Uni,LKLUG,Samyak Gujarati,Droid Sans Thai,Droid Sans "
+ L"Armenian,Untitled1,utkal,Lohit Oriya",
+ 0, 1252},
+ {0x078ed524, L"MicrosoftSansSerif",
+ L"Droid Sans Japanese,FreeSerif,WenQuanYi Micro Hei", 0, 1252},
+ {0x089b18a9, L"Arial",
+ L"Droid Sans Japanese,DejaVu Sans Condensed,FreeSerif,WenQuanYi Micro Hei",
+ 0, 1252},
+ {0x0b2cad72, L"MonotypeCorsiva", L"Droid Sans Japanese,FreeSerif", 8, 1252},
+ {0x0bb003e7, L"Kartika",
+ L"FreeSans,Liberation Sans,Liberation Sans Narrow,Nimbus Sans "
+ L"L,Garuda,FreeSerif,WenQuanYi Micro Hei",
+ 2, 1252},
+ {0x0bb469df, L"VinerHandITC",
+ L"Droid Sans Japanese,Ubuntu,Liberation Sans,Liberation Serif", 8, 1252},
+ {0x0bc1a851, L"SegoeUI", L"Droid Sans Japanese,DejaVu Sans", 0, 1252},
+ {0x0c112ebd, L"KozukaGothicPro-VIM", L"FreeSerif", 0, 1252},
+ {0x0cfcb9c1, L"AdobeThai", L"Droid Sans Japanese,Waree", 0, 847},
+ {0x0e7de0f9, L"Playbill",
+ L"KacstQurn,Droid Arabic Naskh,Droid Sans Ethiopic,mry_KacstQurn,Droid "
+ L"Sans Ethiopic,Droid Sans Japanese,FreeSerif",
+ 0, 1252},
+ {0x0eff47c3, L"STHupo", L"AR PL UKai HK,AR PL UMing HK,AR PL UKai CN", 0,
+ 936},
+ {0x107ad374, L"Constantia",
+ L"Droid Sans Japanese,FreeSerif,WenQuanYi Micro Hei,Ubuntu", 2, 1252},
+ {0x12194c2d, L"KunstlerScript", L"Droid Sans Japanese,Liberation Serif", 8,
+ 1252},
+ {0x135ef6a1, L"MinionProSmBd", L"Liberation Serif", 0, 1252},
+ {0x158c4049, L"Garamond",
+ L"Droid Sans Japanese,Liberation Serif,Ubuntu,FreeSerif", 2, 1252},
+ {0x160ecb24, L"STZhongsong",
+ L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,WenQuanYi Zen Hei "
+ L"Sharp,WenQuanYi Micro Hei",
+ 0, 936},
+ {0x161ed07e, L"MSGothic",
+ L"WenQuanYi Micro Hei Mono,WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,AR PL "
+ L"UMing CN,AR PL UMing HK,AR PL UMing TW",
+ 1, 1252},
+ {0x171d1ed1, L"SnapITC-Regular",
+ L"Liberation Sans Narrow,Ubuntu Condensed,Nimbus Sans L,DejaVu Sans", 0,
+ 1252},
+ {0x18d1188f, L"Cambria", L"Droid Sans Japanese,FreeSerif,FreeMono", 2,
+ 1252},
+ {0x18eaf350, L"ArialUnicodeMS",
+ L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,WenQuanYi Zen Hei "
+ L"Sharp,WenQuanYi Micro Hei",
+ 0, 936},
+ {0x1a92d115, L"MingLiU",
+ L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,WenQuanYi Zen Hei "
+ L"Sharp,WenQuanYi Micro Hei",
+ 1, 1252},
+ {0x1cc217c6, L"TrebuchetMS",
+ L"Droid Sans Japanese,Liberation Serif,FreeSerif,Ubuntu", 0, 1252},
+ {0x1d649596, L"BasemicTimes",
+ L"Liberation Serif,Times New Roman,Droid Sans Japanese,FreeSerif,Ubuntu",
+ 0, 1252},
+ {0x1e34ee60, L"BellMT",
+ L"KacstQurn,Droid Sans Japanese,Ubuntu,Liberation Serif", 2, 1252},
+ {0x1eb36945, L"CooperBlack",
+ L"KacstQurn,Droid Sans Japanese,FreeMono,Liberation Mono, WenQuanYi Micro "
+ L"Hei Mono",
+ 2, 1252},
+ {0x1ef7787d, L"BatangChe",
+ L"WenQuanYi Zen Hei Mono,AR PL UMing CN,AR PL UMing HK,AR PL UMing "
+ L"TW,WenQuanYi Zen Hei,WenQuanYi Micro Hei",
+ 1, 1252},
+ {0x20b3bd3a, L"BrushScriptMT",
+ L"KacstQurn,Droid Arabic Naskh,Droid Sans Ethiopic,Droid Sans "
+ L"Japanese,URW Chancery L,Liberation Sans",
+ 8, 1252},
+ {0x220877aa, L"Candara", L"Droid Sans Japanese,DejaVu Sans", 0, 1252},
+ {0x22135007, L"FreestyleScript-Regular",
+ L"KacstQurn,Droid Sans Japanese,Liberation Sans", 8, 1252},
+ {0x251059c3, L"Chiller",
+ L"KacstQurn,Droid Arabic Naskh,Droid Sans Ethiopic,Droid Sans "
+ L"Japanese,Liberation Sans",
+ 0, 1252},
+ {0x25bed6dd, L"MSReferenceSansSerif",
+ L"DejaVu Sans Condensed,Ubuntu Condensed,Droid Sans Japanese,AR PL UKai "
+ L"HK",
+ 0, 1252},
+ {0x28154c81, L"Parchment-Regular", L"Droid Sans Japanese,Liberation Sans",
+ 8, 1252},
+ {0x29711eb9, L"STLiti", L"AR PL UKai HK", 0, 936},
+ {0x2b1993b4, L"Basemic",
+ L"Liberation Serif,Droid Sans Japanese,Liberation Sans", 0, 1252},
+ {0x2b316339, L"NiagaraSolid-Reg", L"Droid Sans Japanese,Liberation Sans", 0,
+ 1252},
+ {0x2c147529, L"FootlightMTLight",
+ L"KacstQurn,Droid Sans Japanese,Liberation Sans", 0, 1252},
+ {0x2c198928, L"HarlowSolid",
+ L"KacstQurn,Droid Sans Japanese,Liberation Sans", 0, 1252},
+ {0x2c6ac6b2, L"LucidaBright",
+ L"KacstQurn,Droid Arabic Naskh,Droid Sans Ethiopic,mry_KacstQurn,Droid "
+ L"Sans Japanese,Liberation Sans",
+ 2, 1252},
+ {0x2c9f38e2, L"KozukaMinchoPro-VIR", L"DejaVu Sans", 0, 1252},
+ {0x2d5a47b0, L"STCaiyun", L"AR PL UKai HK", 0, 936},
+ {0x2def26bf, L"BernardMT-Condensed",
+ L"KacstQurn,Droid Sans Japanese,DejaVu Serif", 0, 1252},
+ {0x2fd8930b, L"KozukaMinchoPr6NR", L"DejaVu Serif", 0, 1252},
+ {0x3115525a, L"FangSong_GB2312",
+ L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,WenQuanYi Zen Hei "
+ L"Sharp,WenQuanYi Micro Hei",
+ 0, 1252},
+ {0x31327817, L"MyriadPro",
+ L"Ubuntu Condensed,Droid Sans Japanese, FreeSerif", 0, 1252},
+ {0x32244975, L"Helvetica",
+ L"Ubuntu,DejaVu Sans Condensed,Liberation Sans,Liberation Sans "
+ L"Narrow,Nimbus Sans L",
+ 0, 1252},
+ {0x32ac995c, L"Terminal", L"DejaVu Serif", 0, 1252},
+ {0x338d648a, L"NiagaraEngraved-Reg", L"Droid Sans Japanese,DejaVu Serif", 0,
+ 1252},
+ {0x33bb65f2, L"Sylfaen", L"Droid Sans Japanese,DejaVu Sans", 2, 1252},
+ {0x3402c30e, L"MSPMincho",
+ L"WenQuanYi Zen Hei Mono,AR PL UMing CN,AR PL UMing HK,AR PL UMing TW", 2,
+ 1252},
+ {0x3412bf31, L"SimSun-PUA",
+ L"WenQuanYi Zen Hei Mono,AR PL UMing CN,AR PL UMing CN,AR PL UMing HK", 0,
+ 936},
+ {0x36eb39b9, L"BerlinSansFB",
+ L"Droid Sans Japanese,Liberation Serif,Ubuntu,FreeSerif", 0, 1252},
+ {0x36f42055, L"UniversATT", L"Microsoft Sans Serif", 0, 1252},
+ {0x3864c4f6, L"HighTowerText", L"Droid Sans Japanese,DejaVu Serif", 2,
+ 1252},
+ {0x3a257d03, L"FangSong_GB2312",
+ L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei", 0, 1252},
+ {0x3c7d1d07, L"Garamond3LTStd",
+ L"Droid Sans Japanese,Ubuntu Condensed,DejaVu Sans Condensed,Liberation "
+ L"Serif,Ubuntu,FreeSerif",
+ 2, 1252},
+ {0x3cdae668, L"FreestyleScript",
+ L"KacstQurn,Droid Sans Japanese,DejaVu Sans", 8, 1252},
+ {0x3d55aed7, L"Jokerman", L"Droid Sans Japanese,DejaVu Sans", 0, 1252},
+ {0x3d5b4385, L"PMingLiU",
+ L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,WenQuanYi Zen Hei "
+ L"Sharp,WenQuanYi Micro Hei",
+ 2, 1252},
+ {0x3d9b7669, L"EstrangeloEdessa", L"Droid Sans Japanese,DejaVu Sans", 0,
+ 1252},
+ {0x3e532d74, L"FranklinGothicMedium", L"Droid Sans Japanese,Ubuntu", 0,
+ 1252},
+ {0x3e6aa32d, L"NSimSun",
+ L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,WenQuanYi Zen Hei "
+ L"Sharp,WenQuanYi Micro Hei",
+ 1, 936},
+ {0x3f6c36a8, L"Gautami",
+ L"Droid Arabic Naskh,Droid Sans Ethiopic, mry_KacstQurn,Droid Sans "
+ L"Japanese,FreeSans",
+ 0, 1252},
+ {0x3ff32662, L"Chiller-Regular",
+ L"KacstQurn,Droid Arabic Naskh,Droid Sans Ethiopic,FreeSans", 0, 1252},
+ {0x409de312, L"ModernNo.20",
+ L"KacstQurn,Droid Sans Japanese,Nimbus Sans L,Nimbus Sans L,FreeSans", 2,
+ 1252},
+ {0x41443c5e, L"Georgia", L"Droid Sans Japanese,FreeSans", 2, 1252},
+ {0x4160ade5, L"BellGothicStdBlack", L"FreeSans", 0, 1252},
+ {0x421976c4, L"Modern-Regular", L"FreeSans", 2, 1252},
+ {0x422a7252, L"Stencil", L"Droid Sans Japanese,FreeSans,Liberation Sans", 0,
+ 1252},
+ {0x42c8554f, L"Fixedsys", L"FreeSerif", 0, 1252},
+ {0x435cb41d, L"Roman", L"FreeSerif", 0, 1252},
+ {0x47882383, L"CourierNew",
+ L"FreeMono,WenQuanYi Micro Hei Mono,AR PL UKai CN,AR PL UKai HK,AR PL "
+ L"UKai TW,AR PL UKai TW MBE,DejaVu Sans",
+ 1, 1252},
+ {0x480a2338, L"BerlinSansFBDemi", L"Droid Sans Japanese,Liberation Serif",
+ 0, 1252},
+ {0x480bf7a4, L"CourierStd", L"DejaVu Sans", 0, 1252},
+ {0x481ad6ed, L"VladimirScript", L"Droid Sans Japanese,DejaVu Serif", 8,
+ 1252},
+ {0x4911577a, L"YouYuan",
+ L"WenQuanYi Zen Hei Mono,AR PL UMing CN,AR PL UMing HK,AR PL UMing TW", 1,
+ 936},
+ {0x4a788d72, L"STXingkai", L"AR PL UKai HK,AR PL UMing HK,AR PL UKai CN", 0,
+ 936},
+ {0x4bf88566, L"SegoeCondensed", L"FreeSerif", 0, 1252},
+ {0x4ccf51a4, L"BerlinSansFB-Reg", L"Droid Sans Japanese,Liberation Serif",
+ 0, 1252},
+ {0x4ea967ce, L"GulimChe",
+ L"WenQuanYi Zen Hei Mono,AR PL UKai CN,AR PL UKai HK,AR PL UKai TW,AR PL "
+ L"UKai TW MBE",
+ 1, 1252},
+ {0x4f68bd79, L"LetterGothicStd",
+ L"FreeMono,Liberation Mono,Andale Mono,WenQuanYi Micro Hei Mono", 0, 1252},
+ {0x51a0d0e6, L"KozukaGothicPr6NM", L"FreeSerif", 0, 1252},
+ {0x531b3dea, L"BasemicSymbol", L"FreeSerif", 0, 1252},
+ {0x5333fd39, L"CalifornianFB-Reg",
+ L"Droid Sans Japanese,URW Chancery L,FreeSerif", 2, 1252},
+ {0x53561a54, L"FZYTK--GBK1-0",
+ L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,WenQuanYi Zen Hei "
+ L"Sharp,WenQuanYi Micro Hei",
+ 0, 936},
+ {0x55e0dde6, L"LucidaSansTypewriter",
+ L"Ubuntu Mono,DejaVu Sans Mono,Nimbus Mono L,Liberation Mono,Courier 10 "
+ L"Pitch,FreeMono",
+ 0, 1252},
+ {0x574d4d3d, L"AdobeArabic", L"Droid Sans Japanese,DejaVu Sans", 0, 1252},
+ {0x5792e759, L"STKaiti", L"WenQuanYi Micro Hei Mono", 0, 936},
+ {0x5921978e, L"LucidaSansUnicode", L"Droid Sans Japanese,DejaVu Sans", 0,
+ 1252},
+ {0x594e2da4, L"Vrinda",
+ L"Droid Arabic Naskh,Droid Sans Ethiopic,Droid Arabic "
+ L"Naskh,mry_KacstQurn,Droid Sans Japanese,FreeSans,FreeSerif",
+ 0, 1252},
+ {0x59baa9a2, L"KaiTi_GB2312",
+ L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,WenQuanYi Zen Hei "
+ L"Sharp,WenQuanYi Micro Hei",
+ 0, 1252},
+ {0x5cfedf4f, L"BaskOldFace",
+ L"KacstQurn,Droid Sans Japanese,Ubuntu,Liberation Serif", 0, 1252},
+ {0x5e16ac91, L"TrajanPro",
+ L"Nimbus Sans L,AR PL UMing HK,AR PL UKai HK,AR PL UMing TW,AR PL UMing "
+ L"TW MBE,DejaVu Sans,DejaVu Serif",
+ 0, 1252},
+ {0x5f388196, L"ITCLegacySansStdMedium",
+ L"Liberation Serif,FreeSerif,FreeSans,Ubuntu", 0, 1252},
+ {0x5f97921c, L"AdobeMyungjoStdM",
+ L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,WenQuanYi Zen Hei "
+ L"Sharp,WenQuanYi Micro Hei",
+ 0, 936},
+ {0x5fefbfad, L"Batang",
+ L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,WenQuanYi Zen Hei "
+ L"Sharp,WenQuanYi Micro Hei",
+ 2, 1252},
+ {0x605342b9, L"DotumChe",
+ L"WenQuanYi Zen Hei Mono,AR PL UMing CN,AR PL UMing HK,AR PL UMing TW", 1,
+ 1252},
+ {0x608c5f9a, L"KaiTi_GB2312",
+ L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,WenQuanYi Zen Hei "
+ L"Sharp,WenQuanYi Micro Hei",
+ 0, 936},
+ {0x61efd0d1, L"MaturaMTScriptCapitals",
+ L"KacstQurn,Droid Arabic Naskh,Droid Sans Ethiopic,mry_KacstQurn,Droid "
+ L"Sans Japanese,DejaVu Serif,DejaVu Sans",
+ 0, 1252},
+ {0x626608a9, L"MVBoli",
+ L"Droid Arabic Naskh,Droid Sans Ethiopic,mry_KacstQurn,Droid Sans "
+ L"Ethiopic,Droid Sans Japanese,DejaVu Sans",
+ 0, 1252},
+ {0x630501a3, L"SmallFonts", L"DejaVu Serif", 0, 1252},
+ {0x65d0e2a9, L"FZYTK--GBK1-0",
+ L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,WenQuanYi Zen Hei "
+ L"Sharp,WenQuanYi Micro Hei",
+ 0, 936},
+ {0x669f29e1, L"FZSTK--GBK1-0",
+ L"AR PL UMing CN,AR PL UKai CN, AR PL UMing HK", 0, 936},
+ {0x673a9e5f, L"Tunga",
+ L"Droid Arabic Naskh,Droid Sans Ethiopic,mry_KacstQurn,Droid Sans "
+ L"Japanese,DejaVu Serif",
+ 0, 1252},
+ {0x691aa4ce, L"NiagaraSolid", L"Droid Sans Japanese,DejaVu Serif", 0, 1252},
+ {0x696259b7, L"Corbel", L"Droid Sans Japanese,DejaVu Sans", 0, 1252},
+ {0x696ee9be, L"STXihei", L"WenQuanYi Micro Hei Mono", 0, 936},
+ {0x6c59cf69, L"Dotum", L"WenQuanYi Zen Hei Mono", 0, 1252},
+ {0x707fa561, L"Gungsuh", L"WenQuanYi Zen Hei Mono", 2, 1252},
+ {0x71416bb2, L"ZWAdobeF",
+ L"KacstArt,KacstBookm,KacstDecorative,KacstDigital,KacstFarsi,KacstLetter,"
+ L"KacstOffice,Dingbats,FreeSerif",
+ 0, 1252},
+ {0x71b41801, L"Verdana",
+ L"DejaVu Sans Condensed,Ubuntu Condensed,Droid Sans Japanese,DejaVu Sans",
+ 0, 1252},
+ {0x73f25e4c, L"PalatinoLinotype", L"Droid Sans Japanese,FreeSerif", 0,
+ 1252},
+ {0x73f4d19f, L"NiagaraEngraved", L"Droid Sans Japanese,FreeSerif", 0, 1252},
+ {0x74001694, L"MyriadProBlack", L"Droid Sans Japanese,AR PL UKai HK", 0,
+ 1252},
+ {0x74b14d8f, L"Haettenschweiler", L"Droid Sans Japanese,DejaVu Serif", 0,
+ 1252},
+ {0x74cb44ee, L"NSimSun", L"WenQuanYi Zen Hei Mono", 1, 936},
+ {0x76b4d7ff, L"Shruti",
+ L"Droid Arabic Naskh,Droid Sans Ethiopic,mry_KacstQurn,Droid Sans "
+ L"Japanese,FreeSans",
+ 0, 1252},
+ {0x788b3533, L"Webdings", L"FreeSans", 6, 42},
+ {0x797dde99, L"MSSerif", L"FreeSans", 0, 1252},
+ {0x7a0f9e9e, L"MSMincho",
+ L"WenQuanYi Micro Hei Mono,AR PL UMing CN,AR PL UMing HK,AR PL UMing TW",
+ 1, 1252},
+ {0x7b439caf, L"OldEnglishTextMT",
+ L"Droid Sans Japanese,Liberation Sans,Ubuntu", 0, 1252},
+ {0x8213a433, L"LucidaSans-Typewriter",
+ L"Ubuntu Mono,Liberation Mono,DejaVu Sans Mono", 0, 1252},
+ {0x82fec929, L"AdobeSongStdL",
+ L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,WenQuanYi Zen Hei "
+ L"Sharp,WenQuanYi Micro Hei",
+ 0, 936},
+ {0x83581825, L"Modern", L"FreeSans", 0, 1252},
+ {0x835a2823, L"Algerian",
+ L"KacstQurn,Droid Sans Japanese,FreeSans,Liberation Sans,Ubuntu", 0, 1252},
+ {0x83dab9f5, L"Script", L"FreeSans", 0, 1252},
+ {0x847b56da, L"Tahoma",
+ L"Droid Sans Japanese,DejaVu Sans Condensed,FreeSerif", 0, 1252},
+ {0x8a783cb2, L"SimSun-PUA",
+ L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,WenQuanYi Zen Hei "
+ L"Sharp,WenQuanYi Micro Hei",
+ 0, 1252},
+ {0x8b5cac0e, L"Onyx", L"Droid Sans Japanese,Liberation Sans", 0, 1252},
+ {0x8c6a499e, L"Gulim",
+ L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,WenQuanYi Zen Hei "
+ L"Sharp,WenQuanYi Micro Hei",
+ 0, 1252},
+ {0x8e0af790, L"JuiceITC", L"Droid Sans Japanese,Liberation Sans", 0, 1252},
+ {0x8e8d43b2, L"Centaur",
+ L"KacstQurn,Droid Sans Japanese,Khmer OS,Khmer OS System", 2, 1252},
+ {0x8ee4dcca, L"BookshelfSymbol7", L"Liberation Sans", 0, 1252},
+ {0x90794800, L"BellGothicStdLight", L"Liberation Sans", 0, 1252},
+ {0x909b516a, L"Century",
+ L"Droid Sans Japanese,Liberation Sans,Liberation Mono,Liberation Serif", 2,
+ 1252},
+ {0x92ae370d, L"MSOutlook", L"Liberation Sans", 4, 42},
+ {0x93c9fbf1, L"LucidaFax",
+ L"KacstQurn,Droid Arabic Naskh,Droid Sans "
+ L"Ethiopic,mry_KacstQurn,Liberation Sans",
+ 2, 1252},
+ {0x9565085e, L"BookAntiqua",
+ L"Droid Sans Japanese,Liberation Sans,Liberation Serif", 2, 1252},
+ {0x9856d95d, L"AdobeMingStdL", L"AR PL UMing HK", 0, 949},
+ {0x9bbadd6b, L"ColonnaMT",
+ L"KacstQurn,Droid Sans Japanese,Khmer OS,Khmer OS System", 0, 1252},
+ {0x9cbd16a4, L"ShowcardGothic-Reg",
+ L"Droid Sans Japanese,Liberation Sans,Ubuntu", 0, 1252},
+ {0x9d73008e, L"MSSansSerif", L"FreeSerif", 0, 1252},
+ {0xa0607db1, L"GungsuhChe",
+ L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,WenQuanYi Zen Hei "
+ L"Sharp,WenQuanYi Micro Hei",
+ 1, 1252},
+ {0xa0bcf6a1, L"LatinWide", L"FreeSerif", 2, 1252},
+ {0xa1429b36, L"Symbol", L"FreeSerif", 6, 42},
+ {0xa1fa5abc, L"Wingdings2", L"FreeSerif", 6, 42},
+ {0xa1fa5abd, L"Wingdings3", L"FreeSerif", 6, 42},
+ {0xa427bad4, L"InformalRoman-Regular",
+ L"Droid Arabic Naskh,Droid Sans Ethiopic,mry_KacstQurn,Droid Sans "
+ L"Japanese,FreeSerif",
+ 8, 1252},
+ {0xa8b92ece, L"FZSTK--GBK1-0", L"AR PL UMing CN", 0, 936},
+ {0xa8d83ece, L"CalifornianFB", L"Droid Sans Japanese,FreeSerif", 2, 1252},
+ {0xaa3e082c, L"Kingsoft-Phonetic",
+ L"Tibetan Machine Uni,LKLUG,Samyak Gujarati,Droid Sans "
+ L"Thai,utkal,Kedage,Mallige,AR PL UKai CN",
+ 0, 1252},
+ {0xaa6bcabe, L"HarlowSolidItalic",
+ L"KacstQurn,Droid Sans Japanese,Liberation Serif", 0, 1252},
+ {0xade5337c, L"MSUIGothic",
+ L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,WenQuanYi Zen Hei "
+ L"Sharp,WenQuanYi Micro Hei",
+ 0, 1252},
+ {0xb08dd941, L"WideLatin",
+ L"KacstQurn,Droid Arabic Naskh,Droid Sans Ethiopic,mry_KacstQurn,Droid "
+ L"Sans Japanese,Liberation Serif",
+ 2, 1252},
+ {0xb12765e0, L"ITCLegacySansStdBook",
+ L"AR PL UMing HK,AR PL UKai HK,FreeSerif,Ubuntu,FreeSans", 0, 1252},
+ {0xb207f05d, L"PoorRichard", L"Droid Sans Japanese,Liberation Serif", 2,
+ 1252},
+ {0xb3bc492f, L"JuiceITC-Regular", L"Droid Sans Japanese,Liberation Serif",
+ 0, 1252},
+ {0xb5545399, L"Marlett", L"Liberation Serif", 4, 42},
+ {0xb5dd1ebb, L"BritannicBold",
+ L"KacstQurn,Droid Arabic Naskh,Droid Sans "
+ L"Ethiopic,mry_KacstQurn,Liberation Serif",
+ 0, 1252},
+ {0xb699c1c5, L"LucidaCalligraphy-Italic",
+ L"KacstQurn,Droid Arabic Naskh,Droid Sans Ethiopic,mry_KacstQurn,Droid "
+ L"Sans Japanese,DejaVu Serif",
+ 0, 1252},
+ {0xb725d629, L"TimesNewRoman", L"Droid Sans Japanese,Liberation Sans", 2,
+ 1252},
+ {0xb7eaebeb, L"AdobeHeitiStdR",
+ L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,WenQuanYi Zen Hei "
+ L"Sharp,WenQuanYi Micro Hei",
+ 0, 936},
+ {0xbd29c486, L"BerlinSansFBDemi-Bold", L"Droid Sans Japanese,DejaVu Serif",
+ 0, 1252},
+ {0xbe8a8db4, L"BookshelfSymbolSeven", L"DejaVu Sans", 0, 1252},
+ {0xc16c0118, L"AdobeHebrew", L"Droid Sans Japanese,Ubuntu,Liberation Serif",
+ 0, 1252},
+ {0xc318b0af, L"MyriadProLight",
+ L"Droid Sans Japanese,AR PL UKai HK,AR PL UMing HK,AR PL UKai CN", 0,
+ 1252},
+ {0xc65e5659, L"CambriaMath", L"Droid Sans Japanese,FreeSerif,FreeMono", 2,
+ 1252},
+ {0xc75c8f05, L"LucidaConsole",
+ L"Liberation Mono,DejaVu Sans Mono,FreeMono,WenQuanYi Micro Hei Mono", 1,
+ 1252},
+ {0xca7c35d6, L"Calibri", L"Droid Sans Japanese,DejaVu Sans", 0, 1252},
+ {0xcb053f53, L"MicrosoftYaHei",
+ L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,WenQuanYi Zen Hei "
+ L"Sharp,WenQuanYi Micro Hei",
+ 0, 936},
+ {0xcb7190f9, L"Magneto-Bold",
+ L"Droid Arabic Naskh,Droid Sans Ethiopic,mry_KacstQurn,Droid Sans "
+ L"Japanese,DejaVu Serif",
+ 0, 1252},
+ {0xcca00cc5, L"System", L"DejaVu Sans", 0, 1252},
+ {0xccad6f76, L"Jokerman-Regular", L"Droid Sans Japanese,DejaVu Sans", 0,
+ 1252},
+ {0xccc5818c, L"EuroSign", L"DejaVu Serif", 0, 1252},
+ {0xcf3d7234, L"LucidaHandwriting-Italic",
+ L"Liberation Sans Narrow,Ubuntu Condensed,Nimbus Sans L,DejaVu Serif", 0,
+ 1252},
+ {0xcf7b8fdb, L"MinionPro", L"DejaVu Sans", 0, 1252},
+ {0xcfe5755f, L"Simhei",
+ L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,WenQuanYi Zen Hei "
+ L"Sharp,WenQuanYi Micro Hei",
+ 1, 936},
+ {0xd011f4ee, L"MSPGothic",
+ L"WenQuanYi Zen Hei Mono,AR PL UMing CN,AR PL UMing HK,AR PL UMing TW", 0,
+ 1252},
+ {0xd060e7ef, L"Vivaldi",
+ L"KacstQurn,Droid Sans Japanese,Liberation Sans,Ubuntu", 8, 1252},
+ {0xd07edec1, L"FranklinGothic-Medium", L"Droid Sans Japanese,Ubuntu", 0,
+ 1252},
+ {0xd107243f, L"SimSun", L"WenQuanYi Zen Hei Mono", 0, 936},
+ {0xd1881562, L"ArialNarrow",
+ L"Liberation Sans Narrow,Droid Sans Japanese,FreeSerif", 0, 1252},
+ {0xd22b7dce, L"BodoniMTPosterCompressed",
+ L"Droid Sans Japanese,DejaVu Serif", 0, 1252},
+ {0xd22bfa60, L"ComicSansMS",
+ L"Droid Sans Japanese,FreeMono,Liberation Mono", 8, 1252},
+ {0xd3bd0e35, L"Bauhaus93",
+ L"KacstQurn,Droid Sans Japanese,Liberation Sans,Ubuntu", 0, 1252},
+ {0xd429ee7a, L"STFangsong", L"WenQuanYi Micro Hei Mono", 0, 936},
+ {0xd6679c12, L"BernardMTCondensed",
+ L"KacstQurn,Droid Sans Japanese,Nimbus Sans L,URW Chancery "
+ L"L,KacstOne,Liberation Sans",
+ 0, 1252},
+ {0xd8e8a027, L"LucidaSans",
+ L"Liberation Sans Narrow,Nimbus Sans L,KacstQurn,Droid Arabic Naskh,Droid "
+ L"Sans Ethiopic,DejaVu Serif Condensed,Liberation Mono,Ubuntu",
+ 0, 1252},
+ {0xd9fe7761, L"HighTowerText-Reg",
+ L"Droid Sans Japanese,Ubuntu,Liberation Serif", 2, 1252},
+ {0xda7e551e, L"STSong", L"WenQuanYi Micro Hei Mono", 0, 936},
+ {0xdaa6842d, L"STZhongsong",
+ L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,WenQuanYi Zen Hei "
+ L"Sharp,WenQuanYi Micro Hei",
+ 0, 936},
+ {0xdaaab93f, L"STFangsong",
+ L"WenQuanYi Micro Hei Mono,WenQuanYi Zen Hei Mono,WenQuanYi Zen "
+ L"Hei,WenQuanYi Zen Hei Sharp",
+ 0, 936},
+ {0xdaeb0713, L"STSong",
+ L"WenQuanYi Micro Hei Mono,WenQuanYi Zen Hei Mono,WenQuanYi Zen "
+ L"Hei,WenQuanYi Zen Hei Sharp",
+ 0, 936},
+ {0xdafedbef, L"STCaiyun", L"AR PL UKai HK,AR PL UMing HK,AR PL UKai CN", 0,
+ 936},
+ {0xdb00a3d9, L"Broadway",
+ L"KacstQurn,Droid Sans Japanese,DejaVu Sans,FreeMono,Liberation Mono", 0,
+ 1252},
+ {0xdb1f5ad4, L"STXinwei", L"AR PL UKai HK,AR PL UMing HK,AR PL UKai CN", 0,
+ 936},
+ {0xdb326e7f, L"STKaiti",
+ L"WenQuanYi Micro Hei Mono,WenQuanYi Zen Hei Mono,WenQuanYi Zen "
+ L"Hei,WenQuanYi Zen Hei Sharp",
+ 0, 936},
+ {0xdb69595a, L"STHupo",
+ L"WenQuanYi Micro Hei Mono,WenQuanYi Zen Hei Mono,WenQuanYi Zen "
+ L"Hei,WenQuanYi Zen Hei Sharp",
+ 0, 936},
+ {0xdba0082c, L"STXihei",
+ L" WenQuanYi Micro Hei Mono,WenQuanYi Zen Hei Mono,WenQuanYi Zen "
+ L"Hei,WenQuanYi Zen Hei Sharp",
+ 0, 936},
+ {0xdbd0ab18, L"STXingkai", L"AR PL UKai HK,AR PL UMing HK,AR PL UKai CN", 0,
+ 936},
+ {0xdc1a7db1, L"STLiti", L"AR PL UKai HK,AR PL UMing HK,AR PL UKai CN", 0,
+ 936},
+ {0xdc33075f, L"KristenITC-Regular",
+ L"Droid Arabic Naskh,Droid Sans Ethiopic,mry_KacstQurn,DejaVu Sans "
+ L"Condensed,Ubuntu,Liberation Sans",
+ 8, 1252},
+ {0xdcc7009c, L"Harrington",
+ L"KacstQurn,Droid Sans Japanese,Liberation Serif,FreeSerif,Ubuntu", 0,
+ 1252},
+ {0xdd712466, L"ArialBlack",
+ L"Droid Sans Japanese,DejaVu Sans,DejaVu Serif,FreeMono", 0, 1252},
+ {0xdde87b3e, L"Impact", L"Droid Sans Japanese,DejaVu Serif", 0, 1252},
+ {0xdf69fb32, L"SnapITC",
+ L"Liberation Sans Narrow,Ubuntu Condensed,DejaVu Sans,DejaVu "
+ L"Serif,FreeMono",
+ 0, 1252},
+ {0xdf8b25e8, L"CenturyGothic",
+ L"Droid Sans Japanese,Liberation Mono,Liberation Sans,Liberation Serif", 0,
+ 1252},
+ {0xe0f705c0, L"KristenITC",
+ L"Droid Arabic Naskh,Droid Sans Ethiopic,mry_KacstQurn,DejaVu Sans "
+ L"Condensed,Ubuntu,Liberation Sans",
+ 8, 1252},
+ {0xe1427573, L"Raavi",
+ L"Droid Arabic Naskh,Droid Sans "
+ L"Ethiopic,mry_KacstQurn,FreeSerif,Liberation Serif,Khmer OS",
+ 0, 1252},
+ {0xe2cea0cb, L"Magneto",
+ L"Droid Arabic Naskh,Droid Sans Ethiopic,mry_KacstQurn,DejaVu "
+ L"Serif,DejaVu Serif Condensed,DejaVu Sans",
+ 0, 1252},
+ {0xe36a9e17, L"Ravie",
+ L"Droid Arabic Naskh,Droid Sans Ethiopic,mry_KacstQurn,DejaVu "
+ L"Serif,DejaVu Sans,FreeMono",
+ 0, 1252},
+ {0xe433f8e2, L"Parchment", L"Droid Sans Japanese,DejaVu Serif", 8, 1252},
+ {0xe43dff4a, L"Wingdings", L"DejaVu Serif", 4, 42},
+ {0xe4e2c405, L"MTExtra", L"DejaVu Serif", 6, 42},
+ {0xe618cc35, L"InformalRoman",
+ L"Droid Arabic Naskh,Droid Sans Ethiopic,mry_KacstQurn,Droid Sans "
+ L"Japanese,Nimbus Sans L,DejaVu Sans Condensed,Ubuntu,Liberation Sans",
+ 8, 1252},
+ {0xe6c27ffc, L"Mistral", L"Droid Sans Japanese,DejaVu Serif", 8, 1252},
+ {0xe7ebf4b9, L"Courier", L"DejaVu Sans,DejaVu Sans Condensed,FreeSerif", 0,
+ 1252},
+ {0xe8bc4a9d, L"MSReferenceSpecialty", L"DejaVu Serif", 0, 1252},
+ {0xe90fb013, L"TempusSansITC",
+ L"Droid Sans Japanese,Ubuntu,Liberation Serif,FreeSerif", 0, 1252},
+ {0xec637b42, L"Consolas",
+ L"DejaVu Sans Condensed,AR PL UKai CN,AR PL UKai HK,AR PL UKai "
+ L"TW,FreeSerif,FreeSans",
+ 1, 1252},
+ {0xed3a683b, L"STXinwei", L"AR PL UKai HK,AR PL UMing HK,AR PL UKai CN", 0,
+ 936},
+ {0xef264cd1, L"LucidaHandwriting",
+ L"Liberation Sans Narrow,Ubuntu Condensed,Nimbus Sans "
+ L"L,KacstQurn,Liberation Mono",
+ 0, 1252},
+ {0xf086bca2, L"BaskervilleOldFace",
+ L"KacstQurn,Droid Sans Japanese,Liberation Serif,Ubuntu,FreeSerif", 0,
+ 1252},
+ {0xf1028030, L"Mangal",
+ L"FreeSans,TSCu_Paranar,Garuda,Liberation Sans,Liberation Sans "
+ L"Narrow,Nimbus Sans L",
+ 2, 1252},
+ {0xf1da7eb9, L"ShowcardGothic",
+ L"Droid Sans Japanese,DejaVu Serif Condensed,DejaVu Sans "
+ L"Condensed,Liberation Sans,Ubuntu",
+ 0, 1252},
+ {0xf210f06a, L"ArialMT",
+ L"Liberation Sans,Liberation Sans Narrow,FreeSans,Nimbus Sans L,Khmer OS "
+ L"System,Khmer OS",
+ 0, 1252},
+ {0xf477f16a, L"Latha",
+ L"Liberation Sans Narrow,Nimbus Sans L,Droid Arabic "
+ L"Naskh,mry_KacstQurn,FreeSerif,Nimbus Sans L",
+ 0, 1252},
+ {0xf616f3dd, L"LiSu",
+ L"WenQuanYi Zen Hei Mono,AR PL UMing CN,AR PL UMing HK,AR PL UMing TW,AR "
+ L"PL UMing TW MBE",
+ 1, 936},
+ {0xfa479aa6, L"MicrosoftYaHei",
+ L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,WenQuanYi Zen Hei "
+ L"Sharp,WenQuanYi Micro Hei",
+ 0, 936},
+ {0xfcd19697, L"BookmanOldStyle",
+ L"Droid Sans Japanese,Liberation Mono,Liberation Sans,Liberation Serif", 0,
+ 1252},
+ {0xfe209a82, L"LucidaCalligraphy",
+ L"KacstQurn,Droid Arabic Naskh,Droid Sans Ethiopic,mry_KacstQurn,Droid "
+ L"Sans Japanese,DejaVu Serif,DejaVu Sans,FreeMono",
+ 0, 1252},
+ {0xfef135f8, L"AdobeHeitiStd-Regular",
+ L"WenQuanYi Zen Hei Mono,WenQuanYi Zen Hei,WenQuanYi Zen Hei "
+ L"Sharp,WenQuanYi Micro Hei",
+ 0, 936},
+};
+#elif _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
+const XFA_FONTINFO g_XFAFontsMap[] = {
+ {0x01d5d33e, L"SimSun", L"STHeiti,Heiti TC,STFangsong", 0, 936},
+ {0x01e4f102, L"YouYuan", L"STHeiti,Heiti TC,STFangsong", 1, 936},
+ {0x030549dc, L"LiSu", L"STHeiti,Heiti TC,STFangsong", 1, 936},
+ {0x032edd44, L"Simhei", L"STHeiti,Heiti TC,STFangsong", 1, 936},
+ {0x03eac6fc, L"PoorRichard-Regular",
+ L"Noteworthy,Avenir Next Condensed,Impact", 2, 1252},
+ {0x03ed90e6, L"Nina", L"Microsoft Sans Serif", 0, 1252},
+ {0x077b56b3, L"KingsoftPhoneticPlain",
+ L"LastResort,Apple "
+ L"Chancery,STIXVariants,STIXSizeOneSym,STIXSizeOneSym,Apple Braille",
+ 0, 1252},
+ {0x078ed524, L"MicrosoftSansSerif", L"Songti SC,Apple Symbols", 0, 1252},
+ {0x089b18a9, L"Arial",
+ L"Arial Unicode MS,Microsoft Sans Serif,Apple Symbols", 0, 1252},
+ {0x0b2cad72, L"MonotypeCorsiva", L"Arial Narrow,Impact", 8, 1252},
+ {0x0bb003e7, L"Kartika",
+ L"Arial Unicode MS,Microsoft Sans Serif,Arial Narrow,Damascus", 2, 1252},
+ {0x0bb469df, L"VinerHandITC", L"Comic Sans MS,Songti SC,STSong", 8, 1252},
+ {0x0bc1a851, L"SegoeUI", L"Apple Symbols", 0, 1252},
+ {0x0c112ebd, L"KozukaGothicPro-VIM", L"Microsoft Sans Serif,Apple Symbols",
+ 0, 1252},
+ {0x0cfcb9c1, L"AdobeThai", L"Avenir Next Condensed Ultra Light", 0, 847},
+ {0x0e7de0f9, L"Playbill", L"STIXNonUnicode", 0, 1252},
+ {0x0eff47c3, L"STHupo", L"Kaiti SC,Songti SC,STHeiti", 0, 936},
+ {0x107ad374, L"Constantia", L"Arial Unicode MS,Palatino,Baskerville", 2,
+ 1252},
+ {0x12194c2d, L"KunstlerScript",
+ L"Avenir Next Condensed Demi Bold,Arial Narrow", 8, 1252},
+ {0x135ef6a1, L"MinionProSmBd", L"Microsoft Sans Serif,Apple Symbols", 0,
+ 1252},
+ {0x158c4049, L"Garamond", L"Impact,Arial Narrow", 2, 1252},
+ {0x160ecb24, L"STZhongsong", L"STFangsong,Songti SC", 0, 936},
+ {0x161ed07e, L"MSGothic",
+ L"WenQuanYi Zen Hei Mono,AR PL UMing CN,AR PL UMing HK,AR PL UMing "
+ L"TW,Microsoft Sans Serif,Apple Symbols",
+ 1, 1252},
+ {0x171d1ed1, L"SnapITC-Regular", L"STHeiti,Arial Black", 0, 1252},
+ {0x18d1188f, L"Cambria", L"Arial Unicode MS", 2, 1252},
+ {0x18eaf350, L"ArialUnicodeMS", L"Microsoft Sans Serif,Apple Symbols", 0,
+ 936},
+ {0x1a92d115, L"MingLiU", L"Heiti SC,STHeiti", 1, 1252},
+ {0x1cc217c6, L"TrebuchetMS", L"Damascus,Impact,Arial Narrow", 0, 1252},
+ {0x1d649596, L"BasemicTimes", L"Liberation Serif,Impact,Arial Narrow", 0,
+ 1252},
+ {0x1e34ee60, L"BellMT",
+ L"Papyrus,STIXNonUnicode,Microsoft Sans Serif,Avenir Light", 2, 1252},
+ {0x1eb36945, L"CooperBlack",
+ L"Marion,STIXNonUnicode,Arial Rounded MT Bold,Lucida Grande", 2, 1252},
+ {0x1ef7787d, L"BatangChe",
+ L"WenQuanYi Zen Hei Mono,AR PL UMing CN,,AR PL UMing HK,AR PL UMing TW,AR "
+ L"PL UMing TW MBE,Arial Unicode MS,Heiti TC",
+ 1, 1252},
+ {0x20b3bd3a, L"BrushScriptMT",
+ L"STIXNonUnicode,Damascus,Arial Narrow,Avenir Next Condensed,Cochin", 8,
+ 1252},
+ {0x220877aa, L"Candara", L"Cochin,Baskerville,Marion", 0, 1252},
+ {0x22135007, L"FreestyleScript-Regular",
+ L"STIXNonUnicode,Nadeem,Zapf Dingbats", 8, 1252},
+ {0x251059c3, L"Chiller",
+ L"Zapf Dingbats,Damascus,STIXNonUnicode,Papyrus,KufiStandardGK,Baghdad", 0,
+ 1252},
+ {0x25bed6dd, L"MSReferenceSansSerif",
+ L"Tahoma,Apple Symbols,Apple LiGothic,Arial Unicode MS,Lucida "
+ L"Grande,Microsoft Sans Serif",
+ 0, 1252},
+ {0x28154c81, L"Parchment-Regular", L"Microsoft Sans Serif,Apple Symbols", 8,
+ 1252},
+ {0x29711eb9, L"STLiti", L"Kaiti SC,Songti SC", 0, 936},
+ {0x2b1993b4, L"Basemic", L"Impact,Arial Narrow", 0, 1252},
+ {0x2b316339, L"NiagaraSolid-Reg", L"Microsoft Sans Serif,Apple Symbols", 0,
+ 1252},
+ {0x2c147529, L"FootlightMTLight",
+ L"STIXNonUnicode,Avenir Next Condensed Heavy,PT Sans,Noteworthy", 0, 1252},
+ {0x2c198928, L"HarlowSolid",
+ L"Avenir Medium,Avenir Next Medium,Arial Unicode MS", 0, 1252},
+ {0x2c6ac6b2, L"LucidaBright",
+ L"PT Sans Narrow,Papyrus,Damascus,STIXNonUnicode,Arial Rounded MT "
+ L"Bold,Comic Sans MS,Avenir Next",
+ 2, 1252},
+ {0x2c9f38e2, L"KozukaMinchoPro-VIR", L"Microsoft Sans Serif,Apple Symbols",
+ 0, 1252},
+ {0x2d5a47b0, L"STCaiyun", L"Kaiti SC,Songti SC", 0, 936},
+ {0x2def26bf, L"BernardMT-Condensed",
+ L"Impact,Avenir Next Condensed Demi Bold,American Typewriter", 0, 1252},
+ {0x2fd8930b, L"KozukaMinchoPr6NR", L"Microsoft Sans Serif,Apple Symbols", 0,
+ 1252},
+ {0x3115525a, L"FangSong_GB2312", L"Hiragino Sans GB,STHeiti", 0, 1252},
+ {0x31327817, L"MyriadPro", L"Microsoft Sans Serif,Apple Symbols", 0, 1252},
+ {0x32244975, L"Helvetica",
+ L"Arial Narrow,Arial Unicode MS,Damascus,STIXNonUnicode", 0, 1252},
+ {0x32ac995c, L"Terminal", L"Microsoft Sans Serif,Apple Symbols", 0, 1252},
+ {0x338d648a, L"NiagaraEngraved-Reg", L"Microsoft Sans Serif,Apple Symbols",
+ 0, 1252},
+ {0x33bb65f2, L"Sylfaen", L"Arial Unicode MS,Marion", 2, 1252},
+ {0x3402c30e, L"MSPMincho", L"Arial Unicode MS,Apple SD Gothic Neo", 2,
+ 1252},
+ {0x3412bf31, L"SimSun-PUA", L"STHeiti,Heiti TC,STFangsong", 0, 936},
+ {0x36eb39b9, L"BerlinSansFB", L"American Typewriter,Impact", 0, 1252},
+ {0x36f42055, L"UniversATT", L"Microsoft Sans Serif", 0, 1252},
+ {0x3864c4f6, L"HighTowerText", L"STIXGeneral,.Helvetica Neue Desk UI", 2,
+ 1252},
+ {0x3a257d03, L"FangSong_GB2312", L"Hiragino Sans GB,STHeiti", 0, 1252},
+ {0x3cdae668, L"FreestyleScript", L"Nadeem,Zapf Dingbats,STIXNonUnicode", 8,
+ 1252},
+ {0x3d55aed7, L"Jokerman",
+ L"Papyrus,Lucida Grande,Heiti TC,American Typewriter", 0, 1252},
+ {0x3d5b4385, L"PMingLiU", L"Heiti SC,STHeiti", 2, 1252},
+ {0x3d9b7669, L"EstrangeloEdessa", L"American Typewriter,Marion", 0, 1252},
+ {0x3e532d74, L"FranklinGothicMedium", L"Impact,Arial Narrow", 0, 1252},
+ {0x3e6aa32d, L"NSimSun", L"STHeiti,STFangsong", 1, 936},
+ {0x3f6c36a8, L"Gautami",
+ L"Damascus,STIXNonUnicode,STIXGeneral,American Typewriter", 0, 1252},
+ {0x3ff32662, L"Chiller-Regular", L"Papyrus,KufiStandardGK,Baghdad", 0,
+ 1252},
+ {0x409de312, L"ModernNo.20", L"Avenir Next Condensed,Impact", 2, 1252},
+ {0x41443c5e, L"Georgia", L".Helvetica Neue Desk UI,Arial Unicode MS", 2,
+ 1252},
+ {0x4160ade5, L"BellGothicStdBlack", L"Microsoft Sans Serif,Apple Symbols",
+ 0, 1252},
+ {0x421976c4, L"Modern-Regular", L"Impact", 2, 1252},
+ {0x422a7252, L"Stencil", L"STIXNonUnicode,Songti SC,Georgia,Baskerville", 0,
+ 1252},
+ {0x42c8554f, L"Fixedsys", L"Microsoft Sans Serif,Apple Symbols", 0, 1252},
+ {0x435cb41d, L"Roman", L"Arial Narrow", 0, 1252},
+ {0x47882383, L"CourierNew", L"PCMyungjo,Osaka,Arial Unicode MS,Songti SC",
+ 1, 1252},
+ {0x480a2338, L"BerlinSansFBDemi",
+ L"STIXNonUnicode,American Typewriter,Avenir Next Condensed Heavy", 0,
+ 1252},
+ {0x480bf7a4, L"CourierStd", L"Courier New", 0, 1252},
+ {0x481ad6ed, L"VladimirScript",
+ L"STIXNonUnicode,Avenir Next Condensed,Impact", 8, 1252},
+ {0x4911577a, L"YouYuan", L"STHeiti,Heiti TC", 1, 936},
+ {0x4a788d72, L"STXingkai", L"Kaiti SC,Songti SC", 0, 936},
+ {0x4bf88566, L"SegoeCondensed", L"Microsoft Sans Serif,Apple Symbols", 0,
+ 1252},
+ {0x4ccf51a4, L"BerlinSansFB-Reg",
+ L"STIXNonUnicode,American Typewriter,Impact", 0, 1252},
+ {0x4ea967ce, L"GulimChe", L"Arial Unicode MS,Heiti TC,STFangsong", 1, 1252},
+ {0x4f68bd79, L"LetterGothicStd",
+ L"Courier New,Andale Mono,Ayuthaya,PCMyungjo,Osaka", 0, 1252},
+ {0x51a0d0e6, L"KozukaGothicPr6NM", L"Microsoft Sans Serif,Apple Symbols", 0,
+ 1252},
+ {0x531b3dea, L"BasemicSymbol", L"Microsoft Sans Serif,Apple Symbols", 0,
+ 1252},
+ {0x5333fd39, L"CalifornianFB-Reg",
+ L"American Typewriter,Avenir Next Condensed,Impact", 2, 1252},
+ {0x53561a54, L"FZYTK--GBK1-0", L"STFangsong,Songti SC,STSong", 0, 936},
+ {0x55e0dde6, L"LucidaSansTypewriter", L"Menlo,Courier New,Andale Mono", 0,
+ 1252},
+ {0x574d4d3d, L"AdobeArabic", L"Arial Narrow", 0, 1252},
+ {0x5792e759, L"STKaiti", L"Songti SC,Arial Unicode MS", 0, 936},
+ {0x5921978e, L"LucidaSansUnicode", L"Lucida Grande,Arial Unicode MS,Menlo",
+ 0, 1252},
+ {0x594e2da4, L"Vrinda", L"Geeza Pro,Damascus,STIXGeneral,Gill Sans", 0,
+ 1252},
+ {0x59baa9a2, L"KaiTi_GB2312", L"Hiragino Sans GB,STHeiti", 0, 1252},
+ {0x5cfedf4f, L"BaskOldFace",
+ L"Avenir Next Condensed Heavy,PT Sans,Avenir Next Condensed", 0, 1252},
+ {0x5e16ac91, L"TrajanPro", L"Arial Narrow,PT Sans Narrow,Damascus", 0,
+ 1252},
+ {0x5f97921c, L"AdobeMyungjoStdM",
+ L"AppleMyungjo,AppleGothic,Arial Unicode MS", 0, 936},
+ {0x5fefbfad, L"Batang", L"Arial Unicode MS,Songti SC", 2, 1252},
+ {0x605342b9, L"DotumChe", L"Arial Unicode MS,Heiti TC", 1, 1252},
+ {0x608c5f9a, L"KaiTi_GB2312", L"Hiragino Sans GB,STHeiti,Heiti TC", 0, 936},
+ {0x61efd0d1, L"MaturaMTScriptCapitals",
+ L"Kokonor,Damascus,STIXNonUnicode,STHeiti,Arial Black,Avenir Next Heavy",
+ 0, 1252},
+ {0x626608a9, L"MVBoli",
+ L"Apple Braille,Geeza Pro,Microsoft Sans Serif,Apple Symbols", 0, 1252},
+ {0x630501a3, L"SmallFonts", L"Microsoft Sans Serif,Apple Symbols", 0, 1252},
+ {0x65d0e2a9, L"FZYTK--GBK1-0", L"STFangsong,Songti SC,STSong", 0, 936},
+ {0x669f29e1, L"FZSTK--GBK1-0", L"STHeiti,Heiti TC", 0, 936},
+ {0x673a9e5f, L"Tunga",
+ L"Damascus,STIXNonUnicode,Avenir Next Condensed,Avenir Next Condensed "
+ L"Ultra Light,Futura",
+ 0, 1252},
+ {0x691aa4ce, L"NiagaraSolid", L"Microsoft Sans Serif,Apple Symbols", 0,
+ 1252},
+ {0x696259b7, L"Corbel", L"Cochin,Baskerville,Marion", 0, 1252},
+ {0x696ee9be, L"STXihei", L"STHeiti,Heiti TC,Songti SC,Arial Unicode MS", 0,
+ 936},
+ {0x6c59cf69, L"Dotum", L"Arial Unicode MS,Songti SC", 0, 1252},
+ {0x707fa561, L"Gungsuh", L"Arial Unicode MS,Heiti TC", 2, 1252},
+ {0x71416bb2, L"ZWAdobeF",
+ L"STIXSizeFourSym,STIXSizeThreeSym,STIXSizeTwoSym,STIXSizeOneSym", 0,
+ 1252},
+ {0x71b41801, L"Verdana",
+ L"Tahoma,Marion,Apple Symbols,.Helvetica Neue Desk UI,Lucida "
+ L"Grande,Courier New",
+ 0, 1252},
+ {0x73f25e4c, L"PalatinoLinotype", L"Palatino,Arial Unicode MS", 0, 1252},
+ {0x73f4d19f, L"NiagaraEngraved", L"Microsoft Sans Serif,Apple Symbols", 0,
+ 1252},
+ {0x74001694, L"MyriadProBlack", L"Palatino,Baskerville,Marion,Cochin", 0,
+ 1252},
+ {0x74b14d8f, L"Haettenschweiler", L"Microsoft Sans Serif,Apple Symbols", 0,
+ 1252},
+ {0x74cb44ee, L"NSimSun", L"STHeiti,Heiti TC,STFangsong", 1, 936},
+ {0x76b4d7ff, L"Shruti",
+ L"Damascus,STIXNonUnicode,Arial Unicode MS,American Typewriter", 0, 1252},
+ {0x788b3533, L"Webdings", L"Microsoft Sans Serif,Apple Symbols", 6, 42},
+ {0x797dde99, L"MSSerif", L"Microsoft Sans Serif,Apple Symbols", 0, 1252},
+ {0x7a0f9e9e, L"MSMincho",
+ L"WenQuanYi Zen Hei Mono,AR PL UMing CN,AR PL UMing HK,AR PL UMing TW,AR "
+ L"PL UMing TW MBE,Arial Unicode MS,Apple SD Gothic Neo",
+ 1, 1252},
+ {0x7b439caf, L"OldEnglishTextMT",
+ L"STIXNonUnicode,Arial Unicode MS,Baskerville,Avenir Next Medium", 0,
+ 1252},
+ {0x8213a433, L"LucidaSans-Typewriter",
+ L"Comic Sans MS,Avenir Next,Arial Rounded MT Bold", 0, 1252},
+ {0x82fec929, L"AdobeSongStdL", L"Heiti TC,STHeiti", 0, 936},
+ {0x83581825, L"Modern", L"Avenir Next Condensed,Impact", 0, 1252},
+ {0x835a2823, L"Algerian",
+ L"STIXNonUnicode,Baskerville,Avenir Next Medium,American Typewriter", 0,
+ 1252},
+ {0x83dab9f5, L"Script", L"Arial Narrow", 0, 1252},
+ {0x847b56da, L"Tahoma", L"Songti SC,Apple Symbols", 0, 1252},
+ {0x8a783cb2, L"SimSun-PUA", L"STHeiti,Heiti TC,STFangsong", 0, 1252},
+ {0x8b5cac0e, L"Onyx", L"Microsoft Sans Serif,Apple Symbols", 0, 1252},
+ {0x8c6a499e, L"Gulim", L"Arial Unicode MS,Songti SC", 0, 1252},
+ {0x8e0af790, L"JuiceITC", L"Nadeem,Al Bayan", 0, 1252},
+ {0x8e8d43b2, L"Centaur", L"Avenir Next Condensed,Noteworthy,Impact", 2,
+ 1252},
+ {0x8ee4dcca, L"BookshelfSymbol7", L"Microsoft Sans Serif,Apple Symbols", 0,
+ 1252},
+ {0x90794800, L"BellGothicStdLight", L"Microsoft Sans Serif,Apple Symbols",
+ 0, 1252},
+ {0x909b516a, L"Century", L"Damascus,Andale Mono,Songti SC,Arial Unicode MS",
+ 2, 1252},
+ {0x92ae370d, L"MSOutlook", L"Microsoft Sans Serif,Apple Symbols", 4, 42},
+ {0x93c9fbf1, L"LucidaFax",
+ L"PT Sans Narrow,Papyrus,Kokonor,Geeza Pro,Arial Rounded MT Bold,Lucida "
+ L"Grande,Futura",
+ 2, 1252},
+ {0x9565085e, L"BookAntiqua", L"Palatino,Microsoft Sans Serif,Apple Symbols",
+ 2, 1252},
+ {0x9856d95d, L"AdobeMingStdL", L"AHiragino Sans GB,Heiti TC,STHeiti", 0,
+ 949},
+ {0x9bbadd6b, L"ColonnaMT", L"Noteworthy,Avenir Next Condensed,Impact", 0,
+ 1252},
+ {0x9cbd16a4, L"ShowcardGothic-Reg",
+ L"Arial Unicode MS,Georgia,American Typewriter", 0, 1252},
+ {0x9d73008e, L"MSSansSerif", L"Songti SC,Apple Symbols", 0, 1252},
+ {0xa0607db1, L"GungsuhChe",
+ L"WenQuanYi Zen Hei Mono,AR PL UMing CN,AR PL UMing HK,AR PL UMing TW,AR "
+ L"PL UMing TW MBE,Arial Unicode MS,Heiti TC,STFangsong",
+ 1, 1252},
+ {0xa0bcf6a1, L"LatinWide", L"Zapfino,Arial Black,STHeiti", 2, 1252},
+ {0xa1429b36, L"Symbol", L"Microsoft Sans Serif,Apple Symbols", 6, 42},
+ {0xa1fa5abc, L"Wingdings2", L"Microsoft Sans Serif,Apple Symbols", 6, 42},
+ {0xa1fa5abd, L"Wingdings3", L"Microsoft Sans Serif,Apple Symbols", 6, 42},
+ {0xa427bad4, L"InformalRoman-Regular",
+ L"STIXNonUnicode,Arial Narrow,Avenir Next Condensed Demi Bold", 8, 1252},
+ {0xa8b92ece, L"FZSTK--GBK1-0", L"STHeiti,Heiti TC,STFangsong", 0, 936},
+ {0xa8d83ece, L"CalifornianFB",
+ L"American Typewriter,Avenir Next Condensed,Impact", 2, 1252},
+ {0xaa3e082c, L"Kingsoft-Phonetic",
+ L"STIXVariants,STIXSizeOneSym,Apple Braille", 0, 1252},
+ {0xaa6bcabe, L"HarlowSolidItalic",
+ L"STIXNonUnicode,Avenir Medium,Avenir Next Medium,Arial Unicode MS", 0,
+ 1252},
+ {0xade5337c, L"MSUIGothic", L"Arial Unicode MS,Apple SD Gothic Neo", 0,
+ 1252},
+ {0xb08dd941, L"WideLatin",
+ L"Marion,Papyrus,Nanum Pen Script,Zapf Dingbats,Damascus,Zapfino,Arial "
+ L"Black,STHeiti",
+ 2, 1252},
+ {0xb12765e0, L"ITCLegacySansStdBook",
+ L"LastResort,.Helvetica Neue Desk UI,Arial Unicode MS,Palatino", 0, 1252},
+ {0xb207f05d, L"PoorRichard", L"Noteworthy,Avenir Next Condensed,Impact", 2,
+ 1252},
+ {0xb3bc492f, L"JuiceITC-Regular", L"Nadeem,Al Bayan,STIXNonUnicode", 0,
+ 1252},
+ {0xb5545399, L"Marlett", L"Microsoft Sans Serif,Apple Symbols", 4, 42},
+ {0xb5dd1ebb, L"BritannicBold",
+ L"Damascus,STIXNonUnicode,Avenir Next Condensed Heavy,PT Sans", 0, 1252},
+ {0xb699c1c5, L"LucidaCalligraphy-Italic", L"STHeiti,Arial Black", 0, 1252},
+ {0xb725d629, L"TimesNewRoman", L"Microsoft Sans Serif,Apple Symbols", 2,
+ 1252},
+ {0xb7eaebeb, L"AdobeHeitiStdR", L"Heiti TC,STHeiti", 0, 936},
+ {0xbd29c486, L"BerlinSansFBDemi-Bold",
+ L"American Typewriter,Avenir Next Condensed Heavy", 0, 1252},
+ {0xbe8a8db4, L"BookshelfSymbolSeven", L"Microsoft Sans Serif,Apple Symbols",
+ 0, 1252},
+ {0xc16c0118, L"AdobeHebrew",
+ L".Helvetica Neue Desk UI,Palatino,American Typewriter", 0, 1252},
+ {0xc318b0af, L"MyriadProLight", L"Palatino,Baskerville,Marion", 0, 1252},
+ {0xc65e5659, L"CambriaMath", L"Arial Unicode MS", 2, 1252},
+ {0xc75c8f05, L"LucidaConsole", L"Courier New,Menlo,Andale Mono", 1, 1252},
+ {0xca7c35d6, L"Calibri", L"Apple Symbols,HeadLineA", 0, 1252},
+ {0xcb053f53, L"MicrosoftYaHei", L"Arial Unicode MS", 0, 936},
+ {0xcb7190f9, L"Magneto-Bold", L"Lucida Grande", 0, 1252},
+ {0xcca00cc5, L"System", L"Microsoft Sans Serif,Apple Symbols", 0, 1252},
+ {0xccad6f76, L"Jokerman-Regular", L"Lucida Grande", 0, 1252},
+ {0xccc5818c, L"EuroSign", L"Microsoft Sans Serif,Apple Symbols", 0, 1252},
+ {0xcf3d7234, L"LucidaHandwriting-Italic",
+ L"Microsoft Sans Serif,Apple Symbols", 0, 1252},
+ {0xcf7b8fdb, L"MinionPro",
+ L"Bell MT,Corbel,Times New Roman,Cambria,Berlin Sans FB", 0, 1252},
+ {0xcfe5755f, L"Simhei", L"STHeiti,Heiti TC,STFangsong", 1, 936},
+ {0xd011f4ee, L"MSPGothic", L"Arial Unicode MS,Apple SD Gothic Neo", 0,
+ 1252},
+ {0xd060e7ef, L"Vivaldi",
+ L"STIXNonUnicode,Arial Unicode MS,Avenir Medium,Avenir Next Medium", 8,
+ 1252},
+ {0xd07edec1, L"FranklinGothic-Medium", L"Impact,Arial Narrow", 0, 1252},
+ {0xd107243f, L"SimSun", L"STHeiti,Heiti TC,STFangsong", 0, 936},
+ {0xd1881562, L"ArialNarrow", L"PT Sans Narrow,Apple Symbols", 0, 1252},
+ {0xd22b7dce, L"BodoniMTPosterCompressed",
+ L"Microsoft Sans Serif,Apple Symbols", 0, 1252},
+ {0xd22bfa60, L"ComicSansMS",
+ L"Damascus,Georgia,.Helvetica Neue Desk UI,Lucida Grande,Arial Unicode MS",
+ 8, 1252},
+ {0xd3bd0e35, L"Bauhaus93",
+ L"STIXNonUnicode,Arial Unicode MS,Avenir Next,Avenir", 0, 1252},
+ {0xd429ee7a, L"STFangsong", L"Songti SC,Arial Unicode MS", 0, 936},
+ {0xd6679c12, L"BernardMTCondensed",
+ L"Impact,Avenir Next Condensed Demi Bold", 0, 1252},
+ {0xd8e8a027, L"LucidaSans",
+ L"Arial Narrow,Khmer MN,Kokonor,Damascus,Microsoft Sans Serif,Apple "
+ L"Symbols",
+ 0, 1252},
+ {0xd9fe7761, L"HighTowerText-Reg",
+ L"STIXGeneral,.Helvetica Neue Desk UI,Trebuchet MS", 2, 1252},
+ {0xda7e551e, L"STSong", L"Arial Unicode MS", 0, 936},
+ {0xdaa6842d, L"STZhongsong", L"STFangsong,Songti SC,STSong", 0, 936},
+ {0xdaaab93f, L"STFangsong", L"Songti SC,Arial Unicode MS", 0, 936},
+ {0xdaeb0713, L"STSong", L"Songti SC,Arial Unicode MS", 0, 936},
+ {0xdafedbef, L"STCaiyun", L"Kaiti SC,Songti SC,STHeiti", 0, 936},
+ {0xdb00a3d9, L"Broadway",
+ L"Papyrus,STIXNonUnicode,Arial Black,Avenir Next Heavy,Heiti TC", 0, 1252},
+ {0xdb1f5ad4, L"STXinwei", L"Kaiti SC,Songti SC,STHeiti", 0, 936},
+ {0xdb326e7f, L"STKaiti", L"Songti SC,Arial Unicode MS", 0, 936},
+ {0xdb69595a, L"STHupo", L"Kaiti SC,Songti SC,STHeiti", 0, 936},
+ {0xdba0082c, L"STXihei", L"Songti SC,Arial Unicode MS", 0, 936},
+ {0xdbd0ab18, L"STXingkai", L"Kaiti SC,Songti SC", 0, 936},
+ {0xdc1a7db1, L"STLiti", L"Kaiti SC,Songti SC", 0, 936},
+ {0xdc33075f, L"KristenITC-Regular",
+ L"STIXNonUnicode,Damascus,Songti SC,STSong", 8, 1252},
+ {0xdcc7009c, L"Harrington",
+ L"STIXNonUnicode,Avenir Next Condensed Heavy,Noteworthy", 0, 1252},
+ {0xdd712466, L"ArialBlack", L"Geeza Pro,Damascus,Songti SC,STSong", 0,
+ 1252},
+ {0xdde87b3e, L"Impact", L"Arial Narrow,Marion", 0, 1252},
+ {0xdf69fb32, L"SnapITC",
+ L"Arial Narrow,PT Sans Narrow,Marion,STHeiti,Arial Black", 0, 1252},
+ {0xdf8b25e8, L"CenturyGothic",
+ L"Damascus,Andale Mono,Songti SC,Arial Unicode MS", 0, 1252},
+ {0xe0f705c0, L"KristenITC", L"Songti SC,STSong", 8, 1252},
+ {0xe1427573, L"Raavi",
+ L"Damascus,STIXNonUnicode,Marion,Papyrus,Avenir Next Condensed "
+ L"Heavy,American Typewriter",
+ 0, 1252},
+ {0xe2cea0cb, L"Magneto",
+ L"STIXNonUnicode,Damascus,Geeza Pro,Lucida Grande,Georgia,Heiti TC", 0,
+ 1252},
+ {0xe36a9e17, L"Ravie", L"STHeiti,Arial Black", 0, 1252},
+ {0xe433f8e2, L"Parchment", L"Microsoft Sans Serif,Apple Symbols", 8, 1252},
+ {0xe43dff4a, L"Wingdings", L"Microsoft Sans Serif,Apple Symbols", 4, 42},
+ {0xe4e2c405, L"MTExtra", L"Microsoft Sans Serif,Apple Symbols", 6, 42},
+ {0xe618cc35, L"InformalRoman", L"Arial Narrow", 8, 1252},
+ {0xe6c27ffc, L"Mistral", L"Apple Symbols", 8, 1252},
+ {0xe7ebf4b9, L"Courier", L"Courier New", 0, 1252},
+ {0xe8bc4a9d, L"MSReferenceSpecialty", L"Microsoft Sans Serif,Apple Symbols",
+ 0, 1252},
+ {0xe90fb013, L"TempusSansITC",
+ L"STIXNonUnicode,Microsoft Sans Serif,Avenir Light", 0, 1252},
+ {0xec637b42, L"Consolas",
+ L"AR PL UKai CN,AR PL UKai HK,AR PL UKai TW,AR PL UKai TW MBE,AR PL UMing "
+ L"CN,AR PL UMing HK,Microsoft Sans Serif,Tahoma",
+ 1, 1252},
+ {0xed3a683b, L"STXinwei", L"Kaiti SC,Songti SC,", 0, 936},
+ {0xef264cd1, L"LucidaHandwriting",
+ L"Arial Narrow,Avenir Next Condensed Demi Bold,Avenir Next "
+ L"Condensed,Avenir Next Condensed Medium,STHeiti,Arial Black",
+ 0, 1252},
+ {0xf086bca2, L"BaskervilleOldFace",
+ L"STIXNonUnicode,Avenir Next Condensed Heavy,PT Sans", 0, 1252},
+ {0xf1028030, L"Mangal",
+ L"Arial Unicode MS,Microsoft Sans Serif,Arial Narrow,Tahoma", 2, 1252},
+ {0xf1da7eb9, L"ShowcardGothic",
+ L"Papyrus,Arial Unicode MS,Georgia,American Typewriter", 0, 1252},
+ {0xf210f06a, L"ArialMT",
+ L"Arial Unicode MS,Arial Narrow,STIXNonUnicode,Damascus,Avenir Next "
+ L"Condensed Demi Bold,Avenir Next Condensed Medium,Avenir Next Condensed",
+ 0, 1252},
+ {0xf477f16a, L"Latha",
+ L"Arial Narrow,Damascus,STIXNonUnicode,American Typewriter", 0, 1252},
+ {0xf616f3dd, L"LiSu", L"STHeiti,Heiti TC,STFangsong", 1, 936},
+ {0xfa479aa6, L"MicrosoftYaHei", L"Arial Unicode MS", 0, 936},
+ {0xfcd19697, L"BookmanOldStyle",
+ L"Geeza Pro,Damascus,Andale Mono,Songti SC,Arial Unicode MS", 0, 1252},
+ {0xfe209a82, L"LucidaCalligraphy",
+ L"Kokonor,Damascus,STIXNonUnicode,STHeiti,Arial Black", 0, 1252},
+ {0xfef135f8, L"AdobeHeitiStd-Regular", L"Heiti TC,STHeiti", 0, 936},
+};
+#elif _FXM_PLATFORM_ == _FXM_PLATFORM_ANDROID_
+const XFA_FONTINFO g_XFAFontsMap[] = {
+ {0x01d5d33e, L"SimSun", L"Droid Sans Fallback", 0, 936},
+ {0x01e4f102, L"YouYuan", L"Droid Sans Fallback", 1, 936},
+ {0x030549dc, L"LiSu", L"Droid Sans Fallback", 1, 936},
+ {0x032edd44, L"Simhei", L"Droid Sans Fallback", 1, 936},
+ {0x03eac6fc, L"PoorRichard-Regular",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback,Droid Arabic "
+ L"Naskh,Droid Sans Ethiopic",
+ 2, 1252},
+ {0x03ed90e6, L"Nina",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0x077b56b3, L"KingsoftPhoneticPlain",
+ L"Droid Sans Thai,Droid Sans Armenian,Droid Arabic Naskh,Droid Sans "
+ L"Ethiopic,Droid Sans Fallback",
+ 0, 1252},
+ {0x078ed524, L"MicrosoftSansSerif", L"Droid Sans Fallback", 0, 1252},
+ {0x089b18a9, L"Arial", L"Droid Sans Fallback", 0, 1252},
+ {0x0b2cad72, L"MonotypeCorsiva",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 8, 1252},
+ {0x0bb003e7, L"Kartika",
+ L"Droid Arabic Naskh,Droid Sans Ethiopic,Roboto,Droid Serif,Droid Sans "
+ L"Mono",
+ 2, 1252},
+ {0x0bb469df, L"VinerHandITC",
+ L"Droid Serif,Roboto,Droid Sans Mono,Droid Sans Fallback", 8, 1252},
+ {0x0bc1a851, L"SegoeUI", L"Droid Sans Fallback", 0, 1252},
+ {0x0c112ebd, L"KozukaGothicPro-VIM",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0x0cfcb9c1, L"AdobeThai",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 847},
+ {0x0e7de0f9, L"Playbill",
+ L"Droid Arabic Naskh,Droid Sans Ethiopic,Roboto,Droid Serif,Droid Sans "
+ L"Mono",
+ 0, 1252},
+ {0x0eff47c3, L"STHupo", L"Droid Sans Fallback", 0, 936},
+ {0x107ad374, L"Constantia",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 2, 1252},
+ {0x12194c2d, L"KunstlerScript",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 8, 1252},
+ {0x135ef6a1, L"MinionProSmBd",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0x158c4049, L"Garamond",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 2, 1252},
+ {0x160ecb24, L"STZhongsong", L"Droid Sans Fallback", 0, 936},
+ {0x161ed07e, L"MSGothic", L"Droid Sans Fallback", 1, 1252},
+ {0x171d1ed1, L"SnapITC-Regular",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0x18d1188f, L"Cambria", L"Droid Sans Fallback", 2, 1252},
+ {0x18eaf350, L"ArialUnicodeMS", L"Droid Sans Fallback", 0, 936},
+ {0x1a92d115, L"MingLiU", L"Droid Sans Fallback", 1, 1252},
+ {0x1cc217c6, L"TrebuchetMS",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0x1d649596, L"BasemicTimes",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0x1e34ee60, L"BellMT",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 2, 1252},
+ {0x1eb36945, L"CooperBlack",
+ L"Droid Serif,Roboto,Droid Sans Mono,Droid Sans Fallback", 2, 1252},
+ {0x1ef7787d, L"BatangChe", L"Droid Sans Fallback", 1, 1252},
+ {0x20b3bd3a, L"BrushScriptMT", L"Droid Arabic Naskh,Droid Sans Ethiopic", 8,
+ 1252},
+ {0x220877aa, L"Candara",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0x22135007, L"FreestyleScript-Regular",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 8, 1252},
+ {0x251059c3, L"Chiller",
+ L"Droid Arabic Naskh,Droid Sans Ethiopic,Roboto,Droid Serif", 0, 1252},
+ {0x25bed6dd, L"MSReferenceSansSerif", L"Droid Sans Fallback", 0, 1252},
+ {0x28154c81, L"Parchment-Regular",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 8, 1252},
+ {0x29711eb9, L"STLiti", L"Droid Sans Fallback", 0, 936},
+ {0x2b1993b4, L"Basemic",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0x2b316339, L"NiagaraSolid-Reg",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0x2c147529, L"FootlightMTLight",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0x2c198928, L"HarlowSolid",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0x2c6ac6b2, L"LucidaBright",
+ L"Droid Arabic Naskh,Droid Sans Ethiopic,Droid Serif,Roboto", 2, 1252},
+ {0x2c9f38e2, L"KozukaMinchoPro-VIR",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0x2d5a47b0, L"STCaiyun", L"Droid Sans Fallback", 0, 936},
+ {0x2def26bf, L"BernardMT-Condensed",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0x2fd8930b, L"KozukaMinchoPr6NR",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0x3115525a, L"FangSong_GB2312", L"Droid Sans Fallback", 0, 1252},
+ {0x31327817, L"MyriadPro",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0x32244975, L"Helvetica",
+ L"Droid Arabic Naskh,Droid Sans Ethiopic,Droid Serif,Roboto", 0, 1252},
+ {0x32ac995c, L"Terminal",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0x338d648a, L"NiagaraEngraved-Reg",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0x33bb65f2, L"Sylfaen",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 2, 1252},
+ {0x3402c30e, L"MSPMincho", L"Droid Sans Fallback", 2, 1252},
+ {0x3412bf31, L"SimSun-PUA", L"Droid Sans Fallback", 0, 936},
+ {0x36eb39b9, L"BerlinSansFB",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0x36f42055, L"UniversATT", L"Microsoft Sans Serif", 0, 1252},
+ {0x3864c4f6, L"HighTowerText",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 2, 1252},
+ {0x3a257d03, L"FangSong_GB2312", L"Droid Sans Fallback", 0, 1252},
+ {0x3cdae668, L"FreestyleScript",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 8, 1252},
+ {0x3d55aed7, L"Jokerman",
+ L"Droid Serif,Roboto,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0x3d5b4385, L"PMingLiU", L"Droid Sans Fallback", 2, 1252},
+ {0x3d9b7669, L"EstrangeloEdessa",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0x3e532d74, L"FranklinGothicMedium",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0x3e6aa32d, L"NSimSun", L"Droid Sans Fallback", 1, 936},
+ {0x3f6c36a8, L"Gautami",
+ L"Droid Arabic Naskh,Droid Sans Ethiopic,Roboto,Droid Serif,Droid Sans "
+ L"Mono,Droid Sans Fallback",
+ 0, 1252},
+ {0x3ff32662, L"Chiller-Regular",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0x409de312, L"ModernNo.20",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 2, 1252},
+ {0x41443c5e, L"Georgia",
+ L"Droid Serif,Roboto,Droid Sans Mono,Droid Sans Fallback", 2, 1252},
+ {0x4160ade5, L"BellGothicStdBlack",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0x421976c4, L"Modern-Regular",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 2, 1252},
+ {0x422a7252, L"Stencil",
+ L"Droid Serif,Roboto,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0x42c8554f, L"Fixedsys",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0x435cb41d, L"Roman",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0x47882383, L"CourierNew", L"Droid Sans Fallback", 1, 1252},
+ {0x480a2338, L"BerlinSansFBDemi",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0x480bf7a4, L"CourierStd", L"Droid Sans Fallback", 0, 1252},
+ {0x481ad6ed, L"VladimirScript",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 8, 1252},
+ {0x4911577a, L"YouYuan", L"Droid Sans Fallback", 1, 936},
+ {0x4a788d72, L"STXingkai", L"Droid Sans Fallback", 0, 936},
+ {0x4bf88566, L"SegoeCondensed",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0x4ccf51a4, L"BerlinSansFB-Reg",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0x4ea967ce, L"GulimChe", L"Droid Sans Fallback", 1, 1252},
+ {0x4f68bd79, L"LetterGothicStd",
+ L"Droid Sans Mono,Droid Arabic Naskh,Droid Sans Ethiopic,Droid Sans "
+ L"Mono,Droid Serif,Droid Sans Fallback",
+ 0, 1252},
+ {0x51a0d0e6, L"KozukaGothicPr6NM",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0x531b3dea, L"BasemicSymbol",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0x5333fd39, L"CalifornianFB-Reg",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 2, 1252},
+ {0x53561a54, L"FZYTK--GBK1-0", L"Droid Sans Fallback", 0, 936},
+ {0x55e0dde6, L"LucidaSansTypewriter",
+ L"Droid Sans Mono,Droid Arabic Naskh,Droid Sans Ethiopic", 0, 1252},
+ {0x574d4d3d, L"AdobeArabic",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0x5792e759, L"STKaiti", L"Droid Sans Fallback", 0, 936},
+ {0x5921978e, L"LucidaSansUnicode", L"Droid Sans Fallback", 0, 1252},
+ {0x594e2da4, L"Vrinda",
+ L"Droid Arabic Naskh,Droid Sans Ethiopic,Roboto,Droid Serif,Droid Sans "
+ L"Mono",
+ 0, 1252},
+ {0x59baa9a2, L"KaiTi_GB2312", L"Droid Sans Fallback", 0, 1252},
+ {0x5cfedf4f, L"BaskOldFace",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0x5f97921c, L"AdobeMyungjoStdM", L"Droid Sans Fallback", 0, 936},
+ {0x5fefbfad, L"Batang", L"Droid Sans Fallback", 2, 1252},
+ {0x605342b9, L"DotumChe", L"Droid Sans Fallback", 1, 1252},
+ {0x608c5f9a, L"KaiTi_GB2312", L"Droid Sans Fallback", 0, 936},
+ {0x61efd0d1, L"MaturaMTScriptCapitals",
+ L"Droid Arabic Naskh,Droid Sans Ethiopic,Droid Serif,Roboto,Droid Sans "
+ L"Mono",
+ 0, 1252},
+ {0x626608a9, L"MVBoli",
+ L"Droid Arabic Naskh,Droid Sans Ethiopic,Droid Serif,Roboto,Droid Sans "
+ L"Mono",
+ 0, 1252},
+ {0x630501a3, L"SmallFonts",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0x65d0e2a9, L"FZYTK--GBK1-0", L"Droid Sans Fallback", 0, 936},
+ {0x669f29e1, L"FZSTK--GBK1-0", L"Droid Sans Fallback", 0, 936},
+ {0x673a9e5f, L"Tunga",
+ L"Droid Arabic Naskh,Droid Sans Ethiopic,Roboto,Droid Serif,Droid Sans "
+ L"Mono,Droid Sans Fallback",
+ 0, 1252},
+ {0x691aa4ce, L"NiagaraSolid",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0x696259b7, L"Corbel",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0x696ee9be, L"STXihei", L"Droid Sans Fallback", 0, 936},
+ {0x6c59cf69, L"Dotum", L"Droid Sans Fallback", 0, 1252},
+ {0x707fa561, L"Gungsuh", L"Droid Sans Fallback", 2, 1252},
+ {0x71416bb2, L"ZWAdobeF",
+ L"Droid Arabic Naskh,Droid Sans Armenian,Droid Sans Ethiopic,Droid Sans "
+ L"Georgian,Droid Sans Hebrew,Droid Sans Thai",
+ 0, 1252},
+ {0x71b41801, L"Verdana",
+ L"Droid Serif,Roboto,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0x73f25e4c, L"PalatinoLinotype", L"Droid Sans Fallback", 0, 1252},
+ {0x73f4d19f, L"NiagaraEngraved",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0x74001694, L"MyriadProBlack", L"Book Antiqua,Constantia,Dotum,Georgia", 0,
+ 1252},
+ {0x74b14d8f, L"Haettenschweiler",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0x74cb44ee, L"NSimSun", L"Droid Sans Fallback", 1, 936},
+ {0x76b4d7ff, L"Shruti",
+ L"Droid Arabic Naskh,Droid Sans Ethiopic,Roboto,Droid Serif,Droid Sans "
+ L"Mono",
+ 0, 1252},
+ {0x788b3533, L"Webdings",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 6, 42},
+ {0x797dde99, L"MSSerif",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0x7a0f9e9e, L"MSMincho", L"Droid Sans Fallback", 1, 1252},
+ {0x7b439caf, L"OldEnglishTextMT",
+ L"Droid Serif,Roboto,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0x8213a433, L"LucidaSans-Typewriter",
+ L"Droid Sans Mono,Droid Serif,Roboto,Droid Sans Fallback", 0, 1252},
+ {0x82fec929, L"AdobeSongStdL", L"Droid Sans Fallback", 0, 936},
+ {0x83581825, L"Modern",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0x835a2823, L"Algerian",
+ L"Droid Serif,Roboto,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0x83dab9f5, L"Script",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0x847b56da, L"Tahoma", L"Droid Sans Fallback", 0, 1252},
+ {0x8a783cb2, L"SimSun-PUA", L"Droid Sans Fallback", 0, 1252},
+ {0x8b5cac0e, L"Onyx",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0x8c6a499e, L"Gulim", L"Droid Sans Fallback", 0, 1252},
+ {0x8e0af790, L"JuiceITC",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0x8e8d43b2, L"Centaur",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 2, 1252},
+ {0x8ee4dcca, L"BookshelfSymbol7",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0x90794800, L"BellGothicStdLight",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0x909b516a, L"Century",
+ L"Droid Serif,Roboto,Droid Sans Mono,Droid Sans Fallback", 2, 1252},
+ {0x92ae370d, L"MSOutlook",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 4, 42},
+ {0x93c9fbf1, L"LucidaFax",
+ L"Droid Arabic Naskh,Droid Sans Ethiopic,Droid Serif,Roboto,Droid Sans "
+ L"Mono",
+ 2, 1252},
+ {0x9565085e, L"BookAntiqua",
+ L"Droid Serif,Roboto,Droid Sans Mono,Droid Sans Fallback", 2, 1252},
+ {0x9856d95d, L"AdobeMingStdL", L"Droid Sans Fallback", 0, 949},
+ {0x9bbadd6b, L"ColonnaMT",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0x9cbd16a4, L"ShowcardGothic-Reg",
+ L"Droid Serif,Roboto,Droid Sans Mono,Droid Sans Fallbac", 0, 1252},
+ {0x9d73008e, L"MSSansSerif",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0xa0607db1, L"GungsuhChe", L"Droid Sans Fallback", 1, 1252},
+ {0xa0bcf6a1, L"LatinWide",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 2, 1252},
+ {0xa1429b36, L"Symbol",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 6, 42},
+ {0xa1fa5abc, L"Wingdings2",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 6, 42},
+ {0xa1fa5abd, L"Wingdings3",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 6, 42},
+ {0xa427bad4, L"InformalRoman-Regular",
+ L"Droid Arabic Naskh,Droid Sans Ethiopic", 8, 1252},
+ {0xa8b92ece, L"FZSTK--GBK1-0", L"Droid Sans Fallback", 0, 936},
+ {0xa8d83ece, L"CalifornianFB",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 2, 1252},
+ {0xaa3e082c, L"Kingsoft-Phonetic",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0xaa6bcabe, L"HarlowSolidItalic",
+ L"Droid Serif,Roboto,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0xade5337c, L"MSUIGothic",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0xb08dd941, L"WideLatin",
+ L"Droid Arabic Naskh,Droid Sans Ethiopic,Droid Serif,Roboto,Droid Sans "
+ L"Mono",
+ 2, 1252},
+ {0xb207f05d, L"PoorRichard",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 2, 1252},
+ {0xb3bc492f, L"JuiceITC-Regular",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0xb5545399, L"Marlett",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 4, 42},
+ {0xb5dd1ebb, L"BritannicBold", L"Droid Arabic Naskh,Droid Sans Ethiopic", 0,
+ 1252},
+ {0xb699c1c5, L"LucidaCalligraphy-Italic",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0xb725d629, L"TimesNewRoman", L"Droid Sans Fallback", 2, 1252},
+ {0xb7eaebeb, L"AdobeHeitiStdR", L"Droid Sans Fallback", 0, 936},
+ {0xbd29c486, L"BerlinSansFBDemi-Bold",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0xbe8a8db4, L"BookshelfSymbolSeven",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0xc16c0118, L"AdobeHebrew",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback,Droid Arabic "
+ L"Naskh,Droid Sans Ethiopic",
+ 0, 1252},
+ {0xc318b0af, L"MyriadProLight",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0xc65e5659, L"CambriaMath", L"Droid Sans Fallback", 2, 1252},
+ {0xc75c8f05, L"LucidaConsole",
+ L"Droid Sans Mono,Droid Serif,Roboto,Droid Sans Fallback", 1, 1252},
+ {0xca7c35d6, L"Calibri", L"Droid Sans Fallback", 0, 1252},
+ {0xcb053f53, L"MicrosoftYaHei", L"Droid Sans Fallback", 0, 936},
+ {0xcb7190f9, L"Magneto-Bold",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0xcca00cc5, L"System",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0xccad6f76, L"Jokerman-Regular",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0xccc5818c, L"EuroSign",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0xcf3d7234, L"LucidaHandwriting-Italic",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0xcf7b8fdb, L"MinionPro",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0xcfe5755f, L"Simhei", L"Droid Sans Fallback", 1, 936},
+ {0xd011f4ee, L"MSPGothic", L"Droid Sans Fallback", 0, 1252},
+ {0xd060e7ef, L"Vivaldi",
+ L"Droid Serif,Roboto,Droid Sans Mono,Droid Sans Fallback", 8, 1252},
+ {0xd07edec1, L"FranklinGothic-Medium",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0xd107243f, L"SimSun", L"Droid Sans Fallback", 0, 936},
+ {0xd1881562, L"ArialNarrow",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0xd22b7dce, L"BodoniMTPosterCompressed",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0xd22bfa60, L"ComicSansMS", L"Droid Serif,Roboto,Droid Sans Fallback", 8,
+ 1252},
+ {0xd3bd0e35, L"Bauhaus93",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0xd429ee7a, L"STFangsong", L"Droid Sans Fallback", 0, 936},
+ {0xd6679c12, L"BernardMTCondensed",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0xd8e8a027, L"LucidaSans",
+ L"Droid Arabic Naskh,Droid Sans Ethiopic,Droid Serif,Roboto", 0, 1252},
+ {0xd9fe7761, L"HighTowerText-Reg",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 2, 1252},
+ {0xda7e551e, L"STSong", L"Droid Sans Fallback", 0, 936},
+ {0xdaa6842d, L"STZhongsong", L"Droid Sans Fallback", 0, 936},
+ {0xdaaab93f, L"STFangsong", L"Droid Sans Fallback", 0, 936},
+ {0xdaeb0713, L"STSong",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 936},
+ {0xdafedbef, L"STCaiyun", L"Droid Sans Fallback", 0, 936},
+ {0xdb00a3d9, L"Broadway",
+ L"Droid Serif,Roboto,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0xdb1f5ad4, L"STXinwei", L"Droid Sans Fallback", 0, 936},
+ {0xdb326e7f, L"STKaiti", L"Droid Sans Fallback", 0, 936},
+ {0xdb69595a, L"STHupo", L"Droid Sans Fallback", 0, 936},
+ {0xdba0082c, L"STXihei", L"Droid Sans Fallback", 0, 936},
+ {0xdbd0ab18, L"STXingkai", L"Droid Sans Fallback", 0, 936},
+ {0xdc1a7db1, L"STLiti", L"Droid Sans Fallback", 0, 936},
+ {0xdc33075f, L"KristenITC-Regular",
+ L"Droid Arabic Naskh,Droid Sans Ethiopic,Droid Serif,Roboto", 8, 1252},
+ {0xdcc7009c, L"Harrington",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0xdd712466, L"ArialBlack",
+ L"Droid Serif,Roboto,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0xdde87b3e, L"Impact",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0xdf69fb32, L"SnapITC",
+ L"Droid Arabic Naskh,Droid Sans Ethiopic,Droid Serif,Roboto,Droid Sans "
+ L"Mono",
+ 0, 1252},
+ {0xdf8b25e8, L"CenturyGothic",
+ L"Droid Serif,Roboto,Droid Serif,Droid Sans Mono", 0, 1252},
+ {0xe0f705c0, L"KristenITC",
+ L"Droid Arabic Naskh,Droid Sans Ethiopic,Droid Serif,Roboto", 8, 1252},
+ {0xe1427573, L"Raavi",
+ L"Droid Arabic Naskh,Droid Sans Ethiopic,Roboto,Droid Serif,Droid Sans "
+ L"Mono",
+ 0, 1252},
+ {0xe2cea0cb, L"Magneto",
+ L"Droid Arabic Naskh,Droid Sans Ethiopic,Droid Serif,Roboto,Droid Sans "
+ L"Mono",
+ 0, 1252},
+ {0xe36a9e17, L"Ravie",
+ L"Droid Arabic Naskh,Droid Sans Ethiopic,Roboto,Droid Serif,Droid Sans "
+ L"Mono",
+ 0, 1252},
+ {0xe433f8e2, L"Parchment",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 8, 1252},
+ {0xe43dff4a, L"Wingdings",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 4, 42},
+ {0xe4e2c405, L"MTExtra",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 6, 42},
+ {0xe618cc35, L"InformalRoman",
+ L"Droid Arabic Naskh,Droid Sans Ethiopic,Roboto,Droid Serif", 8, 1252},
+ {0xe6c27ffc, L"Mistral",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 8, 1252},
+ {0xe7ebf4b9, L"Courier", L"Droid Sans Fallback", 0, 1252},
+ {0xe8bc4a9d, L"MSReferenceSpecialty",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0xe90fb013, L"TempusSansITC",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0xec637b42, L"Consolas", L"Droid Sans Fallback", 1, 1252},
+ {0xed3a683b, L"STXinwei", L"Droid Sans Fallback", 0, 936},
+ {0xef264cd1, L"LucidaHandwriting",
+ L"Droid Arabic Naskh,Droid Sans Ethiopic,Droid Serif,Roboto,Droid Sans "
+ L"Mono",
+ 0, 1252},
+ {0xf086bca2, L"BaskervilleOldFace",
+ L"Roboto,Droid Serif,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0xf1028030, L"Mangal",
+ L"Droid Arabic Naskh,Droid Sans Ethiopic,Droid Serif,Roboto,Droid Sans "
+ L"Mono",
+ 2, 1252},
+ {0xf1da7eb9, L"ShowcardGothic",
+ L"Droid Serif,Roboto,Droid Sans Mono,Droid Sans Fallbac", 0, 1252},
+ {0xf210f06a, L"ArialMT",
+ L"Droid Arabic Naskh,Droid Sans Ethiopic,Roboto,Droid Serif", 0, 1252},
+ {0xf477f16a, L"Latha",
+ L"Droid Arabic Naskh,Droid Sans Ethiopic,Roboto,Droid Serif,Droid Sans "
+ L"Mono",
+ 0, 1252},
+ {0xf616f3dd, L"LiSu", L"Droid Sans Fallback", 1, 936},
+ {0xfa479aa6, L"MicrosoftYaHei", L"Droid Sans Fallback", 0, 936},
+ {0xfcd19697, L"BookmanOldStyle",
+ L"Droid Serif,Roboto,Droid Sans Mono,Droid Sans Fallback", 0, 1252},
+ {0xfe209a82, L"LucidaCalligraphy",
+ L"Droid Arabic Naskh,Droid Sans Ethiopic,Droid Serif,Roboto,Droid Sans "
+ L"Mono",
+ 0, 1252},
+ {0xfef135f8, L"AdobeHeitiStd-Regular", L"Droid Sans Fallback", 0, 936},
+};
+#endif
+
+} // namespace
+
+CFX_WideString XFA_LocalFontNameToEnglishName(
+ const CFX_WideStringC& wsLocalName) {
+ uint32_t dwLocalNameHash = FX_HashCode_GetW(wsLocalName, true);
+ const XFA_FONTINFO* pEnd = g_XFAFontsMap + FX_ArraySize(g_XFAFontsMap);
+ const XFA_FONTINFO* pFontInfo =
+ std::lower_bound(g_XFAFontsMap, pEnd, dwLocalNameHash,
+ [](const XFA_FONTINFO& entry, uint32_t hash) {
+ return entry.dwFontNameHash < hash;
+ });
+ if (pFontInfo < pEnd && pFontInfo->dwFontNameHash == dwLocalNameHash)
+ return pFontInfo->pPsName;
+ return CFX_WideString(wsLocalName);
+}
+
+const XFA_FONTINFO* XFA_GetFontINFOByFontName(
+ const CFX_WideStringC& wsFontName) {
+ CFX_WideString wsFontNameTemp(wsFontName);
+ wsFontNameTemp.Remove(L' ');
+ uint32_t dwCurFontNameHash =
+ FX_HashCode_GetW(wsFontNameTemp.AsStringC(), true);
+ const XFA_FONTINFO* pEnd = g_XFAFontsMap + FX_ArraySize(g_XFAFontsMap);
+ const XFA_FONTINFO* pFontInfo =
+ std::lower_bound(g_XFAFontsMap, pEnd, dwCurFontNameHash,
+ [](const XFA_FONTINFO& entry, uint32_t hash) {
+ return entry.dwFontNameHash < hash;
+ });
+ if (pFontInfo < pEnd && pFontInfo->dwFontNameHash == dwCurFontNameHash)
+ return pFontInfo;
+ return nullptr;
+}
+
+CXFA_FontMgr::CXFA_FontMgr() {}
+
+CXFA_FontMgr::~CXFA_FontMgr() {}
+
+CFX_RetainPtr<CFGAS_GEFont> CXFA_FontMgr::GetFont(
+ CXFA_FFDoc* hDoc,
+ const CFX_WideStringC& wsFontFamily,
+ uint32_t dwFontStyles,
+ uint16_t wCodePage) {
+ uint32_t dwHash = FX_HashCode_GetW(wsFontFamily, false);
+ CFX_ByteString bsKey;
+ bsKey.Format("%u%u%u", dwHash, dwFontStyles, wCodePage);
+ auto iter = m_FontMap.find(bsKey);
+ if (iter != m_FontMap.end())
+ return iter->second;
+
+ CFX_WideString wsEnglishName = XFA_LocalFontNameToEnglishName(wsFontFamily);
+ auto it = m_PDFFontMgrMap.find(hDoc);
+ CXFA_PDFFontMgr* pMgr =
+ it != m_PDFFontMgrMap.end() ? it->second.get() : nullptr;
+ CPDF_Font* pPDFFont = nullptr;
+ CFX_RetainPtr<CFGAS_GEFont> pFont;
+ if (pMgr) {
+ pFont =
+ pMgr->GetFont(wsEnglishName.AsStringC(), dwFontStyles, &pPDFFont, true);
+ if (pFont)
+ return pFont;
+ }
+ if (!pFont && m_pDefFontMgr)
+ pFont = m_pDefFontMgr->GetFont(hDoc, wsFontFamily, dwFontStyles, wCodePage);
+
+ if (!pFont && pMgr) {
+ pPDFFont = nullptr;
+ pFont = pMgr->GetFont(wsEnglishName.AsStringC(), dwFontStyles, &pPDFFont,
+ false);
+ if (pFont)
+ return pFont;
+ }
+ if (!pFont && m_pDefFontMgr) {
+ pFont = m_pDefFontMgr->GetDefaultFont(hDoc, wsFontFamily, dwFontStyles,
+ wCodePage);
+ }
+ if (pFont) {
+ if (pPDFFont) {
+ pMgr->SetFont(pFont, pPDFFont);
+ pFont->SetFontProvider(pMgr);
+ }
+ m_FontMap[bsKey] = pFont;
+ }
+ return pFont;
+}
+
+void CXFA_FontMgr::LoadDocFonts(CXFA_FFDoc* hDoc) {
+ if (!m_PDFFontMgrMap[hDoc])
+ m_PDFFontMgrMap[hDoc] = pdfium::MakeUnique<CXFA_PDFFontMgr>(hDoc);
+}
+
+void CXFA_FontMgr::ReleaseDocFonts(CXFA_FFDoc* hDoc) {
+ m_PDFFontMgrMap.erase(hDoc);
+}
+
+void CXFA_FontMgr::SetDefFontMgr(std::unique_ptr<CXFA_DefFontMgr> pFontMgr) {
+ m_pDefFontMgr = std::move(pFontMgr);
+}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/cxfa_fontmgr.h b/chromium/third_party/pdfium/xfa/fxfa/cxfa_fontmgr.h
new file mode 100644
index 00000000000..8652a344223
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fxfa/cxfa_fontmgr.h
@@ -0,0 +1,56 @@
+// 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 XFA_FXFA_CXFA_FONTMGR_H_
+#define XFA_FXFA_CXFA_FONTMGR_H_
+
+#include <map>
+#include <memory>
+#include <vector>
+
+#include "core/fxcrt/cfx_retain_ptr.h"
+#include "core/fxcrt/fx_ext.h"
+#include "core/fxcrt/fx_system.h"
+#include "xfa/fgas/font/cfgas_fontmgr.h"
+#include "xfa/fxfa/cxfa_deffontmgr.h"
+#include "xfa/fxfa/cxfa_pdffontmgr.h"
+#include "xfa/fxfa/fxfa.h"
+
+class CPDF_Font;
+
+struct XFA_FONTINFO {
+ uint32_t dwFontNameHash;
+ const wchar_t* pPsName;
+ const wchar_t* pReplaceFont;
+ uint16_t dwStyles;
+ uint16_t wCodePage;
+};
+
+CFX_WideString XFA_LocalFontNameToEnglishName(
+ const CFX_WideStringC& wsLocalName);
+const XFA_FONTINFO* XFA_GetFontINFOByFontName(
+ const CFX_WideStringC& wsFontName);
+
+class CXFA_FontMgr {
+ public:
+ CXFA_FontMgr();
+ ~CXFA_FontMgr();
+
+ CFX_RetainPtr<CFGAS_GEFont> GetFont(CXFA_FFDoc* hDoc,
+ const CFX_WideStringC& wsFontFamily,
+ uint32_t dwFontStyles,
+ uint16_t wCodePage = 0xFFFF);
+ void LoadDocFonts(CXFA_FFDoc* hDoc);
+ void ReleaseDocFonts(CXFA_FFDoc* hDoc);
+ void SetDefFontMgr(std::unique_ptr<CXFA_DefFontMgr> pFontMgr);
+
+ private:
+ std::unique_ptr<CXFA_DefFontMgr> m_pDefFontMgr;
+ std::map<CXFA_FFDoc*, std::unique_ptr<CXFA_PDFFontMgr>> m_PDFFontMgrMap;
+ std::map<CFX_ByteString, CFX_RetainPtr<CFGAS_GEFont>> m_FontMap;
+};
+
+#endif // XFA_FXFA_CXFA_FONTMGR_H_
diff --git a/chromium/third_party/pdfium/xfa/fxfa/cxfa_pdffontmgr.cpp b/chromium/third_party/pdfium/xfa/fxfa/cxfa_pdffontmgr.cpp
new file mode 100644
index 00000000000..cadb7cbab55
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fxfa/cxfa_pdffontmgr.cpp
@@ -0,0 +1,208 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "xfa/fxfa/cxfa_pdffontmgr.h"
+
+#include <algorithm>
+
+#include "core/fpdfapi/font/cpdf_font.h"
+#include "xfa/fxfa/cxfa_ffapp.h"
+
+namespace {
+
+// The 5 names per entry are: PsName, Normal, Bold, Italic, BoldItalic.
+const char* const g_XFAPDFFontName[][5] = {
+ {"Adobe PI Std", "AdobePIStd", "AdobePIStd", "AdobePIStd", "AdobePIStd"},
+ {"Myriad Pro Light", "MyriadPro-Light", "MyriadPro-Semibold",
+ "MyriadPro-LightIt", "MyriadPro-SemiboldIt"},
+};
+
+} // namespace
+
+CXFA_PDFFontMgr::CXFA_PDFFontMgr(CXFA_FFDoc* pDoc) : m_pDoc(pDoc) {}
+
+CXFA_PDFFontMgr::~CXFA_PDFFontMgr() {}
+
+CFX_RetainPtr<CFGAS_GEFont> CXFA_PDFFontMgr::FindFont(
+ const CFX_ByteString& strPsName,
+ bool bBold,
+ bool bItalic,
+ CPDF_Font** pDstPDFFont,
+ bool bStrictMatch) {
+ CPDF_Document* pDoc = m_pDoc->GetPDFDoc();
+ if (!pDoc)
+ return nullptr;
+
+ CPDF_Dictionary* pFontSetDict =
+ pDoc->GetRoot()->GetDictFor("AcroForm")->GetDictFor("DR");
+ if (!pFontSetDict)
+ return nullptr;
+
+ pFontSetDict = pFontSetDict->GetDictFor("Font");
+ if (!pFontSetDict)
+ return nullptr;
+
+ CFX_ByteString name = strPsName;
+ name.Remove(' ');
+ CFGAS_FontMgr* pFDEFontMgr = m_pDoc->GetApp()->GetFDEFontMgr();
+ for (const auto& it : *pFontSetDict) {
+ const CFX_ByteString& key = it.first;
+ CPDF_Object* pObj = it.second.get();
+ if (!PsNameMatchDRFontName(name.AsStringC(), bBold, bItalic, key,
+ bStrictMatch)) {
+ continue;
+ }
+ CPDF_Dictionary* pFontDict = ToDictionary(pObj->GetDirect());
+ if (!pFontDict || pFontDict->GetStringFor("Type") != "Font") {
+ return nullptr;
+ }
+ CPDF_Font* pPDFFont = pDoc->LoadFont(pFontDict);
+ if (!pPDFFont) {
+ return nullptr;
+ }
+ if (!pPDFFont->IsEmbedded()) {
+ *pDstPDFFont = pPDFFont;
+ return nullptr;
+ }
+ return CFGAS_GEFont::LoadFont(&pPDFFont->m_Font, pFDEFontMgr);
+ }
+ return nullptr;
+}
+
+CFX_RetainPtr<CFGAS_GEFont> CXFA_PDFFontMgr::GetFont(
+ const CFX_WideStringC& wsFontFamily,
+ uint32_t dwFontStyles,
+ CPDF_Font** pPDFFont,
+ bool bStrictMatch) {
+ uint32_t dwHashCode = FX_HashCode_GetW(wsFontFamily, false);
+ CFX_ByteString strKey;
+ strKey.Format("%u%u", dwHashCode, dwFontStyles);
+ auto it = m_FontMap.find(strKey);
+ if (it != m_FontMap.end())
+ return it->second;
+ CFX_ByteString bsPsName =
+ CFX_ByteString::FromUnicode(CFX_WideString(wsFontFamily));
+ bool bBold = (dwFontStyles & FX_FONTSTYLE_Bold) == FX_FONTSTYLE_Bold;
+ bool bItalic = (dwFontStyles & FX_FONTSTYLE_Italic) == FX_FONTSTYLE_Italic;
+ CFX_ByteString strFontName = PsNameToFontName(bsPsName, bBold, bItalic);
+ CFX_RetainPtr<CFGAS_GEFont> pFont =
+ FindFont(strFontName, bBold, bItalic, pPDFFont, bStrictMatch);
+ if (pFont)
+ m_FontMap[strKey] = pFont;
+ return pFont;
+}
+
+CFX_ByteString CXFA_PDFFontMgr::PsNameToFontName(
+ const CFX_ByteString& strPsName,
+ bool bBold,
+ bool bItalic) {
+ for (size_t i = 0; i < FX_ArraySize(g_XFAPDFFontName); ++i) {
+ if (strPsName == g_XFAPDFFontName[i][0]) {
+ size_t index = 1;
+ if (bBold)
+ ++index;
+ if (bItalic)
+ index += 2;
+ return g_XFAPDFFontName[i][index];
+ }
+ }
+ return strPsName;
+}
+
+bool CXFA_PDFFontMgr::PsNameMatchDRFontName(const CFX_ByteStringC& bsPsName,
+ bool bBold,
+ bool bItalic,
+ const CFX_ByteString& bsDRFontName,
+ bool bStrictMatch) {
+ CFX_ByteString bsDRName = bsDRFontName;
+ bsDRName.Remove('-');
+ int32_t iPsLen = bsPsName.GetLength();
+ int32_t nIndex = bsDRName.Find(bsPsName);
+ if (nIndex != -1 && !bStrictMatch)
+ return true;
+
+ if (nIndex != 0)
+ return false;
+
+ int32_t iDifferLength = bsDRName.GetLength() - iPsLen;
+ if (iDifferLength > 1 || (bBold || bItalic)) {
+ int32_t iBoldIndex = bsDRName.Find("Bold");
+ bool bBoldFont = iBoldIndex > 0;
+ if (bBold != bBoldFont)
+ return false;
+
+ if (bBoldFont) {
+ iDifferLength =
+ std::min(iDifferLength - 4, bsDRName.GetLength() - iBoldIndex - 4);
+ }
+ bool bItalicFont = true;
+ if (bsDRName.Find("Italic") > 0) {
+ iDifferLength -= 6;
+ } else if (bsDRName.Find("It") > 0) {
+ iDifferLength -= 2;
+ } else if (bsDRName.Find("Oblique") > 0) {
+ iDifferLength -= 7;
+ } else {
+ bItalicFont = false;
+ }
+ if (bItalic != bItalicFont)
+ return false;
+
+ if (iDifferLength > 1) {
+ CFX_ByteString bsDRTailer = bsDRName.Right(iDifferLength);
+ if (bsDRTailer == "MT" || bsDRTailer == "PSMT" ||
+ bsDRTailer == "Regular" || bsDRTailer == "Reg") {
+ return true;
+ }
+ if (bBoldFont || bItalicFont)
+ return false;
+
+ bool bMatch = false;
+ switch (bsPsName.GetAt(iPsLen - 1)) {
+ case 'L': {
+ if (bsDRName.Right(5) == "Light") {
+ bMatch = true;
+ }
+ } break;
+ case 'R': {
+ if (bsDRName.Right(7) == "Regular" || bsDRName.Right(3) == "Reg") {
+ bMatch = true;
+ }
+ } break;
+ case 'M': {
+ if (bsDRName.Right(5) == "Medium") {
+ bMatch = true;
+ }
+ } break;
+ default:
+ break;
+ }
+ return bMatch;
+ }
+ }
+ return true;
+}
+
+bool CXFA_PDFFontMgr::GetCharWidth(const CFX_RetainPtr<CFGAS_GEFont>& pFont,
+ wchar_t wUnicode,
+ bool bCharCode,
+ int32_t* pWidth) {
+ if (wUnicode != 0x20 || bCharCode)
+ return false;
+
+ auto it = m_FDE2PDFFont.find(pFont);
+ if (it == m_FDE2PDFFont.end())
+ return false;
+
+ CPDF_Font* pPDFFont = it->second;
+ *pWidth = pPDFFont->GetCharWidthF(pPDFFont->CharCodeFromUnicode(wUnicode));
+ return true;
+}
+
+void CXFA_PDFFontMgr::SetFont(const CFX_RetainPtr<CFGAS_GEFont>& pFont,
+ CPDF_Font* pPDFFont) {
+ m_FDE2PDFFont[pFont] = pPDFFont;
+}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/cxfa_pdffontmgr.h b/chromium/third_party/pdfium/xfa/fxfa/cxfa_pdffontmgr.h
new file mode 100644
index 00000000000..1188ce1fba6
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fxfa/cxfa_pdffontmgr.h
@@ -0,0 +1,57 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef XFA_FXFA_CXFA_PDFFONTMGR_H_
+#define XFA_FXFA_CXFA_PDFFONTMGR_H_
+
+#include <map>
+
+#include "core/fpdfapi/parser/cpdf_dictionary.h"
+#include "core/fpdfapi/parser/cpdf_document.h"
+#include "core/fxcrt/cfx_retain_ptr.h"
+#include "core/fxcrt/fx_string.h"
+#include "xfa/fgas/font/cfgas_gefont.h"
+#include "xfa/fxfa/cxfa_ffdoc.h"
+
+class CPDF_Font;
+class CXFA_FFDoc;
+
+class CXFA_PDFFontMgr {
+ public:
+ explicit CXFA_PDFFontMgr(CXFA_FFDoc* pDoc);
+ ~CXFA_PDFFontMgr();
+
+ CFX_RetainPtr<CFGAS_GEFont> GetFont(const CFX_WideStringC& wsFontFamily,
+ uint32_t dwFontStyles,
+ CPDF_Font** pPDFFont,
+ bool bStrictMatch);
+ bool GetCharWidth(const CFX_RetainPtr<CFGAS_GEFont>& pFont,
+ wchar_t wUnicode,
+ bool bCharCode,
+ int32_t* pWidth);
+ void SetFont(const CFX_RetainPtr<CFGAS_GEFont>& pFont, CPDF_Font* pPDFFont);
+
+ private:
+ CFX_RetainPtr<CFGAS_GEFont> FindFont(const CFX_ByteString& strFamilyName,
+ bool bBold,
+ bool bItalic,
+ CPDF_Font** pPDFFont,
+ bool bStrictMatch);
+ CFX_ByteString PsNameToFontName(const CFX_ByteString& strPsName,
+ bool bBold,
+ bool bItalic);
+ bool PsNameMatchDRFontName(const CFX_ByteStringC& bsPsName,
+ bool bBold,
+ bool bItalic,
+ const CFX_ByteString& bsDRFontName,
+ bool bStrictMatch);
+
+ CXFA_FFDoc* const m_pDoc;
+ std::map<CFX_RetainPtr<CFGAS_GEFont>, CPDF_Font*> m_FDE2PDFFont;
+ std::map<CFX_ByteString, CFX_RetainPtr<CFGAS_GEFont>> m_FontMap;
+};
+
+#endif // XFA_FXFA_CXFA_PDFFONTMGR_H_
diff --git a/chromium/third_party/pdfium/xfa/fxfa/cxfa_rendercontext.cpp b/chromium/third_party/pdfium/xfa/fxfa/cxfa_rendercontext.cpp
new file mode 100644
index 00000000000..ecb42918cb5
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fxfa/cxfa_rendercontext.cpp
@@ -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
+
+#include "xfa/fxfa/cxfa_rendercontext.h"
+
+#include "xfa/fxfa/cxfa_ffpageview.h"
+#include "xfa/fxfa/cxfa_ffwidget.h"
+#include "xfa/fxgraphics/cfx_graphics.h"
+
+namespace {
+
+const int32_t kMaxCount = 30;
+
+} // namsepace
+
+CXFA_RenderContext::CXFA_RenderContext()
+ : m_pWidget(nullptr), m_pPageView(nullptr), m_pGS(nullptr), m_dwStatus(0) {
+ m_matrix.SetIdentity();
+ m_rtClipRect.Reset();
+}
+
+CXFA_RenderContext::~CXFA_RenderContext() {}
+
+int32_t CXFA_RenderContext::StartRender(CXFA_FFPageView* pPageView,
+ CFX_Graphics* pGS,
+ const CFX_Matrix& matrix,
+ const CXFA_RenderOptions& options) {
+ m_pPageView = pPageView;
+ m_pGS = pGS;
+ m_matrix = matrix;
+ m_options = options;
+
+ CFX_Matrix mtRes;
+ mtRes.SetReverse(matrix);
+ m_rtClipRect = pGS->GetClipRect();
+ mtRes.TransformRect(m_rtClipRect);
+ m_dwStatus = m_options.m_bHighlight ? XFA_WidgetStatus_Highlight : 0;
+ uint32_t dwFilterType = XFA_WidgetStatus_Visible |
+ (m_options.m_bPrint ? XFA_WidgetStatus_Printable
+ : XFA_WidgetStatus_Viewable);
+ m_pWidgetIterator.reset(
+ m_pPageView->CreateWidgetIterator(XFA_TRAVERSEWAY_Form, dwFilterType));
+ m_pWidget = m_pWidgetIterator->MoveToNext();
+ return XFA_RENDERSTATUS_Ready;
+}
+
+int32_t CXFA_RenderContext::DoRender(IFX_Pause* pPause) {
+ int32_t iCount = 0;
+ while (m_pWidget) {
+ CXFA_FFWidget* pWidget = m_pWidget;
+ CFX_RectF rtWidgetBox = pWidget->GetBBox(XFA_WidgetStatus_Visible);
+ rtWidgetBox.width += 1;
+ rtWidgetBox.height += 1;
+ if (rtWidgetBox.IntersectWith(m_rtClipRect))
+ pWidget->RenderWidget(m_pGS, &m_matrix, m_dwStatus);
+
+ m_pWidget = m_pWidgetIterator->MoveToNext();
+ iCount++;
+ if (iCount > kMaxCount && pPause && pPause->NeedToPauseNow())
+ return XFA_RENDERSTATUS_ToBeContinued;
+ }
+ return XFA_RENDERSTATUS_Done;
+}
+
+void CXFA_RenderContext::StopRender() {
+ m_pWidgetIterator.reset();
+}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/cxfa_rendercontext.h b/chromium/third_party/pdfium/xfa/fxfa/cxfa_rendercontext.h
new file mode 100644
index 00000000000..960bd058d10
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fxfa/cxfa_rendercontext.h
@@ -0,0 +1,45 @@
+// 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 XFA_FXFA_CXFA_RENDERCONTEXT_H_
+#define XFA_FXFA_CXFA_RENDERCONTEXT_H_
+
+#include <memory>
+
+#include "xfa/fxfa/fxfa.h"
+
+class CXFA_RenderOptions {
+ public:
+ CXFA_RenderOptions() : m_bPrint(false), m_bHighlight(true) {}
+
+ bool m_bPrint;
+ bool m_bHighlight;
+};
+
+class CXFA_RenderContext {
+ public:
+ CXFA_RenderContext();
+ ~CXFA_RenderContext();
+
+ int32_t StartRender(CXFA_FFPageView* pPageView,
+ CFX_Graphics* pGS,
+ const CFX_Matrix& matrix,
+ const CXFA_RenderOptions& options);
+ int32_t DoRender(IFX_Pause* pPause = nullptr);
+ void StopRender();
+
+ private:
+ std::unique_ptr<IXFA_WidgetIterator> m_pWidgetIterator;
+ CXFA_FFWidget* m_pWidget;
+ CXFA_FFPageView* m_pPageView;
+ CFX_Graphics* m_pGS;
+ CFX_Matrix m_matrix;
+ CXFA_RenderOptions m_options;
+ uint32_t m_dwStatus;
+ CFX_RectF m_rtClipRect;
+};
+
+#endif // XFA_FXFA_CXFA_RENDERCONTEXT_H_
diff --git a/chromium/third_party/pdfium/xfa/fxfa/cxfa_widgetacc.cpp b/chromium/third_party/pdfium/xfa/fxfa/cxfa_widgetacc.cpp
new file mode 100644
index 00000000000..be7556ee241
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fxfa/cxfa_widgetacc.cpp
@@ -0,0 +1,1533 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "xfa/fxfa/cxfa_widgetacc.h"
+
+#include <algorithm>
+#include <vector>
+
+#include "third_party/base/stl_util.h"
+#include "xfa/fde/cfde_textout.h"
+#include "xfa/fde/xml/cfde_xmlelement.h"
+#include "xfa/fde/xml/cfde_xmlnode.h"
+#include "xfa/fxfa/app/cxfa_textlayout.h"
+#include "xfa/fxfa/app/xfa_ffwidgetacc.h"
+#include "xfa/fxfa/cxfa_ffapp.h"
+#include "xfa/fxfa/cxfa_ffdoc.h"
+#include "xfa/fxfa/cxfa_ffdocview.h"
+#include "xfa/fxfa/cxfa_ffwidget.h"
+#include "xfa/fxfa/cxfa_fontmgr.h"
+#include "xfa/fxfa/parser/cxfa_layoutprocessor.h"
+#include "xfa/fxfa/parser/cxfa_localevalue.h"
+#include "xfa/fxfa/parser/cxfa_node.h"
+#include "xfa/fxfa/parser/cxfa_scriptcontext.h"
+#include "xfa/fxfa/parser/xfa_utils.h"
+
+class CXFA_WidgetLayoutData {
+ public:
+ CXFA_WidgetLayoutData() : m_fWidgetHeight(-1) {}
+ virtual ~CXFA_WidgetLayoutData() {}
+
+ float m_fWidgetHeight;
+};
+
+namespace {
+
+void FFDeleteCalcData(void* pData) {
+ if (pData)
+ delete ((CXFA_CalcData*)pData);
+}
+
+static XFA_MAPDATABLOCKCALLBACKINFO gs_XFADeleteCalcData = {FFDeleteCalcData,
+ nullptr};
+
+class CXFA_TextLayoutData : public CXFA_WidgetLayoutData {
+ public:
+ CXFA_TextLayoutData() {}
+ ~CXFA_TextLayoutData() override {}
+
+ CXFA_TextLayout* GetTextLayout() const { return m_pTextLayout.get(); }
+ CXFA_TextProvider* GetTextProvider() const { return m_pTextProvider.get(); }
+
+ void LoadText(CXFA_WidgetAcc* pAcc) {
+ if (m_pTextLayout)
+ return;
+
+ m_pTextProvider =
+ pdfium::MakeUnique<CXFA_TextProvider>(pAcc, XFA_TEXTPROVIDERTYPE_Text);
+ m_pTextLayout = pdfium::MakeUnique<CXFA_TextLayout>(m_pTextProvider.get());
+ }
+
+ private:
+ std::unique_ptr<CXFA_TextLayout> m_pTextLayout;
+ std::unique_ptr<CXFA_TextProvider> m_pTextProvider;
+};
+
+class CXFA_ImageLayoutData : public CXFA_WidgetLayoutData {
+ public:
+ CXFA_ImageLayoutData()
+ : m_bNamedImage(false), m_iImageXDpi(0), m_iImageYDpi(0) {}
+
+ ~CXFA_ImageLayoutData() override {}
+
+ bool LoadImageData(CXFA_WidgetAcc* pAcc) {
+ if (m_pDIBitmap)
+ return true;
+
+ CXFA_Value value = pAcc->GetFormValue();
+ if (!value)
+ return false;
+
+ CXFA_Image imageObj = value.GetImage();
+ if (!imageObj)
+ return false;
+
+ CXFA_FFDoc* pFFDoc = pAcc->GetDoc();
+ pAcc->SetImageImage(XFA_LoadImageData(pFFDoc, &imageObj, m_bNamedImage,
+ m_iImageXDpi, m_iImageYDpi));
+ return !!m_pDIBitmap;
+ }
+
+ CFX_RetainPtr<CFX_DIBitmap> m_pDIBitmap;
+ bool m_bNamedImage;
+ int32_t m_iImageXDpi;
+ int32_t m_iImageYDpi;
+};
+
+class CXFA_FieldLayoutData : public CXFA_WidgetLayoutData {
+ public:
+ CXFA_FieldLayoutData() {}
+ ~CXFA_FieldLayoutData() override {}
+
+ bool LoadCaption(CXFA_WidgetAcc* pAcc) {
+ if (m_pCapTextLayout)
+ return true;
+ CXFA_Caption caption = pAcc->GetCaption();
+ if (!caption || caption.GetPresence() == XFA_ATTRIBUTEENUM_Hidden)
+ return false;
+ m_pCapTextProvider.reset(
+ new CXFA_TextProvider(pAcc, XFA_TEXTPROVIDERTYPE_Caption));
+ m_pCapTextLayout =
+ pdfium::MakeUnique<CXFA_TextLayout>(m_pCapTextProvider.get());
+ return true;
+ }
+
+ std::unique_ptr<CXFA_TextLayout> m_pCapTextLayout;
+ std::unique_ptr<CXFA_TextProvider> m_pCapTextProvider;
+ std::unique_ptr<CFDE_TextOut> m_pTextOut;
+ std::vector<float> m_FieldSplitArray;
+};
+
+class CXFA_TextEditData : public CXFA_FieldLayoutData {
+ public:
+};
+
+class CXFA_ImageEditData : public CXFA_FieldLayoutData {
+ public:
+ CXFA_ImageEditData()
+ : m_bNamedImage(false), m_iImageXDpi(0), m_iImageYDpi(0) {}
+
+ ~CXFA_ImageEditData() override {}
+
+ bool LoadImageData(CXFA_WidgetAcc* pAcc) {
+ if (m_pDIBitmap)
+ return true;
+
+ CXFA_Value value = pAcc->GetFormValue();
+ if (!value)
+ return false;
+
+ CXFA_Image imageObj = value.GetImage();
+ CXFA_FFDoc* pFFDoc = pAcc->GetDoc();
+ pAcc->SetImageEditImage(XFA_LoadImageData(pFFDoc, &imageObj, m_bNamedImage,
+ m_iImageXDpi, m_iImageYDpi));
+ return !!m_pDIBitmap;
+ }
+
+ CFX_RetainPtr<CFX_DIBitmap> m_pDIBitmap;
+ bool m_bNamedImage;
+ int32_t m_iImageXDpi;
+ int32_t m_iImageYDpi;
+};
+
+} // namespace
+
+CXFA_WidgetAcc::CXFA_WidgetAcc(CXFA_FFDocView* pDocView, CXFA_Node* pNode)
+ : CXFA_WidgetData(pNode), m_pDocView(pDocView), m_nRecursionDepth(0) {}
+
+CXFA_WidgetAcc::~CXFA_WidgetAcc() {}
+
+bool CXFA_WidgetAcc::GetName(CFX_WideString& wsName, int32_t iNameType) {
+ if (iNameType == 0) {
+ m_pNode->TryCData(XFA_ATTRIBUTE_Name, wsName);
+ return !wsName.IsEmpty();
+ }
+ m_pNode->GetSOMExpression(wsName);
+ if (iNameType == 2 && wsName.GetLength() >= 15) {
+ CFX_WideStringC wsPre = L"xfa[0].form[0].";
+ if (wsPre == CFX_WideStringC(wsName.c_str(), wsPre.GetLength()))
+ wsName.Delete(0, wsPre.GetLength());
+ }
+ return true;
+}
+
+CXFA_Node* CXFA_WidgetAcc::GetDatasets() {
+ return m_pNode->GetBindData();
+}
+
+bool CXFA_WidgetAcc::ProcessValueChanged() {
+ m_pDocView->AddValidateWidget(this);
+ m_pDocView->AddCalculateWidgetAcc(this);
+ m_pDocView->RunCalculateWidgets();
+ m_pDocView->RunValidate();
+ return true;
+}
+
+void CXFA_WidgetAcc::ResetData() {
+ CFX_WideString wsValue;
+ XFA_Element eUIType = GetUIType();
+ switch (eUIType) {
+ case XFA_Element::ImageEdit: {
+ CXFA_Value imageValue = GetDefaultValue();
+ CXFA_Image image = imageValue.GetImage();
+ CFX_WideString wsContentType, wsHref;
+ if (image) {
+ image.GetContent(wsValue);
+ image.GetContentType(wsContentType);
+ image.GetHref(wsHref);
+ }
+ SetImageEdit(wsContentType, wsHref, wsValue);
+ break;
+ }
+ case XFA_Element::ExclGroup: {
+ CXFA_Node* pNextChild = m_pNode->GetNodeItem(
+ XFA_NODEITEM_FirstChild, XFA_ObjectType::ContainerNode);
+ while (pNextChild) {
+ CXFA_Node* pChild = pNextChild;
+ CXFA_WidgetAcc* pAcc =
+ static_cast<CXFA_WidgetAcc*>(pChild->GetWidgetData());
+ if (!pAcc)
+ continue;
+
+ CXFA_Value defValue(nullptr);
+ if (wsValue.IsEmpty() && (defValue = pAcc->GetDefaultValue())) {
+ defValue.GetChildValueContent(wsValue);
+ SetValue(wsValue, XFA_VALUEPICTURE_Raw);
+ pAcc->SetValue(wsValue, XFA_VALUEPICTURE_Raw);
+ } else {
+ CXFA_Node* pItems = pChild->GetChild(0, XFA_Element::Items);
+ if (!pItems)
+ continue;
+
+ CFX_WideString itemText;
+ if (pItems->CountChildren(XFA_Element::Unknown) > 1)
+ itemText = pItems->GetChild(1, XFA_Element::Unknown)->GetContent();
+
+ pAcc->SetValue(itemText, XFA_VALUEPICTURE_Raw);
+ }
+ pNextChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling,
+ XFA_ObjectType::ContainerNode);
+ }
+ break;
+ }
+ case XFA_Element::ChoiceList:
+ ClearAllSelections();
+ default:
+ if (CXFA_Value defValue = GetDefaultValue())
+ defValue.GetChildValueContent(wsValue);
+
+ SetValue(wsValue, XFA_VALUEPICTURE_Raw);
+ break;
+ }
+}
+
+void CXFA_WidgetAcc::SetImageEdit(const CFX_WideString& wsContentType,
+ const CFX_WideString& wsHref,
+ const CFX_WideString& wsData) {
+ CXFA_Image image = GetFormValue().GetImage();
+ if (image) {
+ image.SetContentType(CFX_WideString(wsContentType));
+ image.SetHref(wsHref);
+ }
+ CFX_WideString wsFormatValue(wsData);
+ GetFormatDataValue(wsData, wsFormatValue);
+ m_pNode->SetContent(wsData, wsFormatValue, true);
+ CXFA_Node* pBind = GetDatasets();
+ if (!pBind) {
+ image.SetTransferEncoding(XFA_ATTRIBUTEENUM_Base64);
+ return;
+ }
+ pBind->SetCData(XFA_ATTRIBUTE_ContentType, wsContentType);
+ CXFA_Node* pHrefNode = pBind->GetNodeItem(XFA_NODEITEM_FirstChild);
+ if (pHrefNode) {
+ pHrefNode->SetCData(XFA_ATTRIBUTE_Value, wsHref);
+ } else {
+ CFDE_XMLNode* pXMLNode = pBind->GetXMLMappingNode();
+ ASSERT(pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element);
+ static_cast<CFDE_XMLElement*>(pXMLNode)->SetString(L"href", wsHref);
+ }
+}
+
+CXFA_WidgetAcc* CXFA_WidgetAcc::GetExclGroup() {
+ CXFA_Node* pExcl = m_pNode->GetNodeItem(XFA_NODEITEM_Parent);
+ if (!pExcl || pExcl->GetElementType() != XFA_Element::ExclGroup)
+ return nullptr;
+ return static_cast<CXFA_WidgetAcc*>(pExcl->GetWidgetData());
+}
+
+CXFA_FFDocView* CXFA_WidgetAcc::GetDocView() {
+ return m_pDocView;
+}
+
+CXFA_FFDoc* CXFA_WidgetAcc::GetDoc() {
+ return m_pDocView->GetDoc();
+}
+
+CXFA_FFApp* CXFA_WidgetAcc::GetApp() {
+ return GetDoc()->GetApp();
+}
+
+IXFA_AppProvider* CXFA_WidgetAcc::GetAppProvider() {
+ return GetApp()->GetAppProvider();
+}
+
+int32_t CXFA_WidgetAcc::ProcessEvent(int32_t iActivity,
+ CXFA_EventParam* pEventParam) {
+ if (GetElementType() == XFA_Element::Draw)
+ return XFA_EVENTERROR_NotExist;
+
+ std::vector<CXFA_Node*> eventArray =
+ GetEventByActivity(iActivity, pEventParam->m_bIsFormReady);
+ bool first = true;
+ int32_t iRet = XFA_EVENTERROR_NotExist;
+ for (CXFA_Node* pNode : eventArray) {
+ int32_t result = ProcessEvent(CXFA_Event(pNode), pEventParam);
+ if (first || result == XFA_EVENTERROR_Success)
+ iRet = result;
+ first = false;
+ }
+ return iRet;
+}
+
+int32_t CXFA_WidgetAcc::ProcessEvent(const CXFA_Event& event,
+ CXFA_EventParam* pEventParam) {
+ if (!event)
+ return XFA_EVENTERROR_NotExist;
+
+ switch (event.GetEventType()) {
+ case XFA_Element::Execute:
+ break;
+ case XFA_Element::Script:
+ return ExecuteScript(event.GetScript(), pEventParam);
+ case XFA_Element::SignData:
+ break;
+ case XFA_Element::Submit:
+ return GetDoc()->GetDocEnvironment()->SubmitData(GetDoc(),
+ event.GetSubmit());
+ default:
+ break;
+ }
+ return XFA_EVENTERROR_NotExist;
+}
+
+int32_t CXFA_WidgetAcc::ProcessCalculate() {
+ if (GetElementType() == XFA_Element::Draw)
+ return XFA_EVENTERROR_NotExist;
+
+ CXFA_Calculate calc = GetCalculate();
+ if (!calc)
+ return XFA_EVENTERROR_NotExist;
+ if (GetNode()->IsUserInteractive())
+ return XFA_EVENTERROR_Disabled;
+
+ CXFA_EventParam EventParam;
+ EventParam.m_eType = XFA_EVENT_Calculate;
+ CXFA_Script script = calc.GetScript();
+ int32_t iRet = ExecuteScript(script, &EventParam);
+ if (iRet != XFA_EVENTERROR_Success)
+ return iRet;
+
+ if (GetRawValue() != EventParam.m_wsResult) {
+ SetValue(EventParam.m_wsResult, XFA_VALUEPICTURE_Raw);
+ UpdateUIDisplay();
+ }
+ return XFA_EVENTERROR_Success;
+}
+
+void CXFA_WidgetAcc::ProcessScriptTestValidate(CXFA_Validate validate,
+ int32_t iRet,
+ CFXJSE_Value* pRetValue,
+ bool bVersionFlag) {
+ if (iRet == XFA_EVENTERROR_Success && pRetValue) {
+ if (pRetValue->IsBoolean() && !pRetValue->ToBoolean()) {
+ IXFA_AppProvider* pAppProvider = GetAppProvider();
+ if (!pAppProvider) {
+ return;
+ }
+ CFX_WideString wsTitle = pAppProvider->GetAppTitle();
+ CFX_WideString wsScriptMsg;
+ validate.GetScriptMessageText(wsScriptMsg);
+ int32_t eScriptTest = validate.GetScriptTest();
+ if (eScriptTest == XFA_ATTRIBUTEENUM_Warning) {
+ if (GetNode()->IsUserInteractive())
+ return;
+ if (wsScriptMsg.IsEmpty())
+ wsScriptMsg = GetValidateMessage(false, bVersionFlag);
+
+ if (bVersionFlag) {
+ pAppProvider->MsgBox(wsScriptMsg, wsTitle, XFA_MBICON_Warning,
+ XFA_MB_OK);
+ return;
+ }
+ if (pAppProvider->MsgBox(wsScriptMsg, wsTitle, XFA_MBICON_Warning,
+ XFA_MB_YesNo) == XFA_IDYes) {
+ GetNode()->SetFlag(XFA_NodeFlag_UserInteractive, false);
+ }
+ } else {
+ if (wsScriptMsg.IsEmpty())
+ wsScriptMsg = GetValidateMessage(true, bVersionFlag);
+ pAppProvider->MsgBox(wsScriptMsg, wsTitle, XFA_MBICON_Error, XFA_MB_OK);
+ }
+ }
+ }
+}
+
+int32_t CXFA_WidgetAcc::ProcessFormatTestValidate(CXFA_Validate validate,
+ bool bVersionFlag) {
+ CFX_WideString wsRawValue = GetRawValue();
+ if (!wsRawValue.IsEmpty()) {
+ CFX_WideString wsPicture;
+ validate.GetPicture(wsPicture);
+ if (wsPicture.IsEmpty())
+ return XFA_EVENTERROR_NotExist;
+
+ IFX_Locale* pLocale = GetLocal();
+ if (!pLocale)
+ return XFA_EVENTERROR_NotExist;
+
+ CXFA_LocaleValue lcValue = XFA_GetLocaleValue(this);
+ if (!lcValue.ValidateValue(lcValue.GetValue(), wsPicture, pLocale)) {
+ IXFA_AppProvider* pAppProvider = GetAppProvider();
+ if (!pAppProvider)
+ return XFA_EVENTERROR_NotExist;
+
+ CFX_WideString wsFormatMsg;
+ validate.GetFormatMessageText(wsFormatMsg);
+ CFX_WideString wsTitle = pAppProvider->GetAppTitle();
+ int32_t eFormatTest = validate.GetFormatTest();
+ if (eFormatTest == XFA_ATTRIBUTEENUM_Error) {
+ if (wsFormatMsg.IsEmpty())
+ wsFormatMsg = GetValidateMessage(true, bVersionFlag);
+ pAppProvider->MsgBox(wsFormatMsg, wsTitle, XFA_MBICON_Error, XFA_MB_OK);
+ return XFA_EVENTERROR_Success;
+ }
+ if (GetNode()->IsUserInteractive())
+ return XFA_EVENTERROR_NotExist;
+ if (wsFormatMsg.IsEmpty())
+ wsFormatMsg = GetValidateMessage(false, bVersionFlag);
+
+ if (bVersionFlag) {
+ pAppProvider->MsgBox(wsFormatMsg, wsTitle, XFA_MBICON_Warning,
+ XFA_MB_OK);
+ return XFA_EVENTERROR_Success;
+ }
+ if (pAppProvider->MsgBox(wsFormatMsg, wsTitle, XFA_MBICON_Warning,
+ XFA_MB_YesNo) == XFA_IDYes) {
+ GetNode()->SetFlag(XFA_NodeFlag_UserInteractive, false);
+ }
+ return XFA_EVENTERROR_Success;
+ }
+ }
+ return XFA_EVENTERROR_NotExist;
+}
+
+int32_t CXFA_WidgetAcc::ProcessNullTestValidate(CXFA_Validate validate,
+ int32_t iFlags,
+ bool bVersionFlag) {
+ CFX_WideString wsValue;
+ GetValue(wsValue, XFA_VALUEPICTURE_Raw);
+ if (!wsValue.IsEmpty())
+ return XFA_EVENTERROR_Success;
+ if (m_bIsNull && (m_bPreNull == m_bIsNull))
+ return XFA_EVENTERROR_Success;
+
+ int32_t eNullTest = validate.GetNullTest();
+ CFX_WideString wsNullMsg;
+ validate.GetNullMessageText(wsNullMsg);
+ if (iFlags & 0x01) {
+ int32_t iRet = XFA_EVENTERROR_Success;
+ if (eNullTest != XFA_ATTRIBUTEENUM_Disabled)
+ iRet = XFA_EVENTERROR_Error;
+
+ if (!wsNullMsg.IsEmpty()) {
+ if (eNullTest != XFA_ATTRIBUTEENUM_Disabled) {
+ m_pDocView->m_arrNullTestMsg.push_back(wsNullMsg);
+ return XFA_EVENTERROR_Error;
+ }
+ return XFA_EVENTERROR_Success;
+ }
+ return iRet;
+ }
+ if (wsNullMsg.IsEmpty() && bVersionFlag &&
+ eNullTest != XFA_ATTRIBUTEENUM_Disabled) {
+ return XFA_EVENTERROR_Error;
+ }
+ IXFA_AppProvider* pAppProvider = GetAppProvider();
+ if (!pAppProvider)
+ return XFA_EVENTERROR_NotExist;
+
+ CFX_WideString wsCaptionName;
+ CFX_WideString wsTitle = pAppProvider->GetAppTitle();
+ switch (eNullTest) {
+ case XFA_ATTRIBUTEENUM_Error: {
+ if (wsNullMsg.IsEmpty()) {
+ wsCaptionName = GetValidateCaptionName(bVersionFlag);
+ wsNullMsg.Format(L"%s cannot be blank.", wsCaptionName.c_str());
+ }
+ pAppProvider->MsgBox(wsNullMsg, wsTitle, XFA_MBICON_Status, XFA_MB_OK);
+ return XFA_EVENTERROR_Error;
+ }
+ case XFA_ATTRIBUTEENUM_Warning: {
+ if (GetNode()->IsUserInteractive())
+ return true;
+
+ if (wsNullMsg.IsEmpty()) {
+ wsCaptionName = GetValidateCaptionName(bVersionFlag);
+ wsNullMsg.Format(
+ L"%s cannot be blank. To ignore validations for %s, click Ignore.",
+ wsCaptionName.c_str(), wsCaptionName.c_str());
+ }
+ if (pAppProvider->MsgBox(wsNullMsg, wsTitle, XFA_MBICON_Warning,
+ XFA_MB_YesNo) == XFA_IDYes) {
+ GetNode()->SetFlag(XFA_NodeFlag_UserInteractive, false);
+ }
+ return XFA_EVENTERROR_Error;
+ }
+ case XFA_ATTRIBUTEENUM_Disabled:
+ default:
+ break;
+ }
+ return XFA_EVENTERROR_Success;
+}
+
+CFX_WideString CXFA_WidgetAcc::GetValidateCaptionName(bool bVersionFlag) {
+ CFX_WideString wsCaptionName;
+
+ if (!bVersionFlag) {
+ if (CXFA_Caption caption = GetCaption()) {
+ if (CXFA_Value capValue = caption.GetValue()) {
+ if (CXFA_Text capText = capValue.GetText())
+ capText.GetContent(wsCaptionName);
+ }
+ }
+ }
+ if (wsCaptionName.IsEmpty())
+ GetName(wsCaptionName);
+
+ return wsCaptionName;
+}
+
+CFX_WideString CXFA_WidgetAcc::GetValidateMessage(bool bError,
+ bool bVersionFlag) {
+ CFX_WideString wsCaptionName = GetValidateCaptionName(bVersionFlag);
+ CFX_WideString wsMessage;
+ if (bVersionFlag) {
+ wsMessage.Format(L"%s validation failed", wsCaptionName.c_str());
+ return wsMessage;
+ }
+ if (bError) {
+ wsMessage.Format(L"The value you entered for %s is invalid.",
+ wsCaptionName.c_str());
+ return wsMessage;
+ }
+ wsMessage.Format(
+ L"The value you entered for %s is invalid. To ignore "
+ L"validations for %s, click Ignore.",
+ wsCaptionName.c_str(), wsCaptionName.c_str());
+ return wsMessage;
+}
+
+int32_t CXFA_WidgetAcc::ProcessValidate(int32_t iFlags) {
+ if (GetElementType() == XFA_Element::Draw)
+ return XFA_EVENTERROR_NotExist;
+
+ CXFA_Validate validate = GetValidate();
+ if (!validate)
+ return XFA_EVENTERROR_NotExist;
+
+ bool bInitDoc = validate.GetNode()->NeedsInitApp();
+ bool bStatus = m_pDocView->GetLayoutStatus() < XFA_DOCVIEW_LAYOUTSTATUS_End;
+ int32_t iFormat = 0;
+ CFXJSE_Value* pRetValue = nullptr;
+ int32_t iRet = XFA_EVENTERROR_NotExist;
+ CXFA_Script script = validate.GetScript();
+ if (script) {
+ CXFA_EventParam eParam;
+ eParam.m_eType = XFA_EVENT_Validate;
+ eParam.m_pTarget = this;
+ iRet = ExecuteScript(script, &eParam,
+ ((bInitDoc || bStatus) && GetRawValue().IsEmpty())
+ ? nullptr
+ : &pRetValue);
+ }
+ XFA_VERSION version = GetDoc()->GetXFADoc()->GetCurVersionMode();
+ bool bVersionFlag = false;
+ if (version < XFA_VERSION_208)
+ bVersionFlag = true;
+
+ if (bInitDoc) {
+ validate.GetNode()->ClearFlag(XFA_NodeFlag_NeedsInitApp);
+ } else {
+ iFormat = ProcessFormatTestValidate(validate, bVersionFlag);
+ if (!bVersionFlag)
+ bVersionFlag = GetDoc()->GetXFADoc()->HasFlag(XFA_DOCFLAG_Scripting);
+
+ iRet |= ProcessNullTestValidate(validate, iFlags, bVersionFlag);
+ }
+ if (iFormat != XFA_EVENTERROR_Success)
+ ProcessScriptTestValidate(validate, iRet, pRetValue, bVersionFlag);
+
+ delete pRetValue;
+
+ return iRet | iFormat;
+}
+
+int32_t CXFA_WidgetAcc::ExecuteScript(CXFA_Script script,
+ CXFA_EventParam* pEventParam,
+ CFXJSE_Value** pRetValue) {
+ static const uint32_t MAX_RECURSION_DEPTH = 2;
+ if (m_nRecursionDepth > MAX_RECURSION_DEPTH)
+ return XFA_EVENTERROR_Success;
+
+ ASSERT(pEventParam);
+ if (!script)
+ return XFA_EVENTERROR_NotExist;
+ if (script.GetRunAt() == XFA_ATTRIBUTEENUM_Server)
+ return XFA_EVENTERROR_Disabled;
+
+ CFX_WideString wsExpression;
+ script.GetExpression(wsExpression);
+ if (wsExpression.IsEmpty())
+ return XFA_EVENTERROR_NotExist;
+
+ XFA_SCRIPTTYPE eScriptType = script.GetContentType();
+ if (eScriptType == XFA_SCRIPTTYPE_Unkown)
+ return XFA_EVENTERROR_Success;
+
+ CXFA_FFDoc* pDoc = GetDoc();
+ CXFA_ScriptContext* pContext = pDoc->GetXFADoc()->GetScriptContext();
+ pContext->SetEventParam(*pEventParam);
+ pContext->SetRunAtType((XFA_ATTRIBUTEENUM)script.GetRunAt());
+ std::vector<CXFA_Node*> refNodes;
+ if (pEventParam->m_eType == XFA_EVENT_InitCalculate ||
+ pEventParam->m_eType == XFA_EVENT_Calculate) {
+ pContext->SetNodesOfRunScript(&refNodes);
+ }
+ std::unique_ptr<CFXJSE_Value> pTmpRetValue(
+ new CFXJSE_Value(pContext->GetRuntime()));
+ ++m_nRecursionDepth;
+ bool bRet = pContext->RunScript((XFA_SCRIPTLANGTYPE)eScriptType,
+ wsExpression.AsStringC(), pTmpRetValue.get(),
+ m_pNode);
+ --m_nRecursionDepth;
+ int32_t iRet = XFA_EVENTERROR_Error;
+ if (bRet) {
+ iRet = XFA_EVENTERROR_Success;
+ if (pEventParam->m_eType == XFA_EVENT_Calculate ||
+ pEventParam->m_eType == XFA_EVENT_InitCalculate) {
+ if (!pTmpRetValue->IsUndefined()) {
+ if (!pTmpRetValue->IsNull())
+ pEventParam->m_wsResult = pTmpRetValue->ToWideString();
+
+ iRet = XFA_EVENTERROR_Success;
+ } else {
+ iRet = XFA_EVENTERROR_Error;
+ }
+ if (pEventParam->m_eType == XFA_EVENT_InitCalculate) {
+ if ((iRet == XFA_EVENTERROR_Success) &&
+ (GetRawValue() != pEventParam->m_wsResult)) {
+ SetValue(pEventParam->m_wsResult, XFA_VALUEPICTURE_Raw);
+ m_pDocView->AddValidateWidget(this);
+ }
+ }
+ for (CXFA_Node* pRefNode : refNodes) {
+ if (static_cast<CXFA_WidgetAcc*>(pRefNode->GetWidgetData()) == this)
+ continue;
+
+ auto* pGlobalData =
+ static_cast<CXFA_CalcData*>(pRefNode->GetUserData(XFA_CalcData));
+ if (!pGlobalData) {
+ pGlobalData = new CXFA_CalcData;
+ pRefNode->SetUserData(XFA_CalcData, pGlobalData,
+ &gs_XFADeleteCalcData);
+ }
+ if (!pdfium::ContainsValue(pGlobalData->m_Globals, this))
+ pGlobalData->m_Globals.push_back(this);
+ }
+ }
+ }
+ if (pRetValue)
+ *pRetValue = pTmpRetValue.release();
+
+ pContext->SetNodesOfRunScript(nullptr);
+ return iRet;
+}
+
+CXFA_FFWidget* CXFA_WidgetAcc::GetNextWidget(CXFA_FFWidget* pWidget) {
+ CXFA_LayoutItem* pLayout = nullptr;
+ if (pWidget)
+ pLayout = pWidget->GetNext();
+ else
+ pLayout = m_pDocView->GetXFALayout()->GetLayoutItem(m_pNode);
+
+ return static_cast<CXFA_FFWidget*>(pLayout);
+}
+
+void CXFA_WidgetAcc::UpdateUIDisplay(CXFA_FFWidget* pExcept) {
+ CXFA_FFWidget* pWidget = nullptr;
+ while ((pWidget = GetNextWidget(pWidget)) != nullptr) {
+ if (pWidget == pExcept || !pWidget->IsLoaded() ||
+ (GetUIType() != XFA_Element::CheckButton && pWidget->IsFocused())) {
+ continue;
+ }
+ pWidget->UpdateFWLData();
+ pWidget->AddInvalidateRect();
+ }
+}
+
+void CXFA_WidgetAcc::CalcCaptionSize(CFX_SizeF& szCap) {
+ CXFA_Caption caption = GetCaption();
+ if (!caption || caption.GetPresence() != XFA_ATTRIBUTEENUM_Visible)
+ return;
+
+ LoadCaption();
+ XFA_Element eUIType = GetUIType();
+ int32_t iCapPlacement = caption.GetPlacementType();
+ float fCapReserve = caption.GetReserve();
+ const bool bVert = iCapPlacement == XFA_ATTRIBUTEENUM_Top ||
+ iCapPlacement == XFA_ATTRIBUTEENUM_Bottom;
+ const bool bReserveExit = fCapReserve > 0.01;
+ CXFA_TextLayout* pCapTextLayout =
+ static_cast<CXFA_FieldLayoutData*>(m_pLayoutData.get())
+ ->m_pCapTextLayout.get();
+ if (pCapTextLayout) {
+ if (!bVert && eUIType != XFA_Element::Button)
+ szCap.width = fCapReserve;
+
+ CFX_SizeF minSize;
+ pCapTextLayout->CalcSize(minSize, szCap, szCap);
+ if (bReserveExit)
+ bVert ? szCap.height = fCapReserve : szCap.width = fCapReserve;
+ } else {
+ float fFontSize = 10.0f;
+ if (CXFA_Font font = caption.GetFont())
+ fFontSize = font.GetFontSize();
+ else if (CXFA_Font widgetfont = GetFont())
+ fFontSize = widgetfont.GetFontSize();
+
+ if (bVert) {
+ szCap.height = fCapReserve > 0 ? fCapReserve : fFontSize;
+ } else {
+ szCap.width = fCapReserve > 0 ? fCapReserve : 0;
+ szCap.height = fFontSize;
+ }
+ }
+ if (CXFA_Margin mgCap = caption.GetMargin()) {
+ float fLeftInset, fTopInset, fRightInset, fBottomInset;
+ mgCap.GetLeftInset(fLeftInset);
+ mgCap.GetTopInset(fTopInset);
+ mgCap.GetRightInset(fRightInset);
+ mgCap.GetBottomInset(fBottomInset);
+ if (bReserveExit) {
+ bVert ? (szCap.width += fLeftInset + fRightInset)
+ : (szCap.height += fTopInset + fBottomInset);
+ } else {
+ szCap.width += fLeftInset + fRightInset;
+ szCap.height += fTopInset + fBottomInset;
+ }
+ }
+}
+
+bool CXFA_WidgetAcc::CalculateFieldAutoSize(CFX_SizeF& size) {
+ CFX_SizeF szCap;
+ CalcCaptionSize(szCap);
+ CFX_RectF rtUIMargin = GetUIMargin();
+ size.width += rtUIMargin.left + rtUIMargin.width;
+ size.height += rtUIMargin.top + rtUIMargin.height;
+ if (szCap.width > 0 && szCap.height > 0) {
+ int32_t iCapPlacement = GetCaption().GetPlacementType();
+ switch (iCapPlacement) {
+ case XFA_ATTRIBUTEENUM_Left:
+ case XFA_ATTRIBUTEENUM_Right:
+ case XFA_ATTRIBUTEENUM_Inline: {
+ size.width += szCap.width;
+ size.height = std::max(size.height, szCap.height);
+ } break;
+ case XFA_ATTRIBUTEENUM_Top:
+ case XFA_ATTRIBUTEENUM_Bottom: {
+ size.height += szCap.height;
+ size.width = std::max(size.width, szCap.width);
+ }
+ default:
+ break;
+ }
+ }
+ return CalculateWidgetAutoSize(size);
+}
+
+bool CXFA_WidgetAcc::CalculateWidgetAutoSize(CFX_SizeF& size) {
+ CXFA_Margin mgWidget = GetMargin();
+ if (mgWidget) {
+ float fLeftInset, fTopInset, fRightInset, fBottomInset;
+ mgWidget.GetLeftInset(fLeftInset);
+ mgWidget.GetTopInset(fTopInset);
+ mgWidget.GetRightInset(fRightInset);
+ mgWidget.GetBottomInset(fBottomInset);
+ size.width += fLeftInset + fRightInset;
+ size.height += fTopInset + fBottomInset;
+ }
+ CXFA_Para para = GetPara();
+ if (para)
+ size.width += para.GetMarginLeft() + para.GetTextIndent();
+
+ float fVal = 0;
+ float fMin = 0;
+ float fMax = 0;
+ if (GetWidth(fVal)) {
+ size.width = fVal;
+ } else {
+ if (GetMinWidth(fMin))
+ size.width = std::max(size.width, fMin);
+ if (GetMaxWidth(fMax) && fMax > 0)
+ size.width = std::min(size.width, fMax);
+ }
+ fVal = 0;
+ fMin = 0;
+ fMax = 0;
+ if (GetHeight(fVal)) {
+ size.height = fVal;
+ } else {
+ if (GetMinHeight(fMin))
+ size.height = std::max(size.height, fMin);
+ if (GetMaxHeight(fMax) && fMax > 0)
+ size.height = std::min(size.height, fMax);
+ }
+ return true;
+}
+
+void CXFA_WidgetAcc::CalculateTextContentSize(CFX_SizeF& size) {
+ float fFontSize = GetFontSize();
+ CFX_WideString wsText;
+ GetValue(wsText, XFA_VALUEPICTURE_Display);
+ if (wsText.IsEmpty()) {
+ size.height += fFontSize;
+ return;
+ }
+
+ wchar_t wcEnter = '\n';
+ wchar_t wsLast = wsText.GetAt(wsText.GetLength() - 1);
+ if (wsLast == wcEnter)
+ wsText = wsText + wcEnter;
+
+ CXFA_FieldLayoutData* layoutData =
+ static_cast<CXFA_FieldLayoutData*>(m_pLayoutData.get());
+ if (!layoutData->m_pTextOut) {
+ layoutData->m_pTextOut = pdfium::MakeUnique<CFDE_TextOut>();
+ CFDE_TextOut* pTextOut = layoutData->m_pTextOut.get();
+ pTextOut->SetFont(GetFDEFont());
+ pTextOut->SetFontSize(fFontSize);
+ pTextOut->SetLineBreakTolerance(fFontSize * 0.2f);
+ pTextOut->SetLineSpace(GetLineHeight());
+ uint32_t dwStyles = FDE_TTOSTYLE_LastLineHeight;
+ if (GetUIType() == XFA_Element::TextEdit && IsMultiLine())
+ dwStyles |= FDE_TTOSTYLE_LineWrap;
+
+ pTextOut->SetStyles(dwStyles);
+ }
+ layoutData->m_pTextOut->CalcLogicSize(wsText.c_str(), wsText.GetLength(),
+ size);
+}
+
+bool CXFA_WidgetAcc::CalculateTextEditAutoSize(CFX_SizeF& size) {
+ if (size.width > 0) {
+ CFX_SizeF szOrz = size;
+ CFX_SizeF szCap;
+ CalcCaptionSize(szCap);
+ bool bCapExit = szCap.width > 0.01 && szCap.height > 0.01;
+ int32_t iCapPlacement = XFA_ATTRIBUTEENUM_Unknown;
+ if (bCapExit) {
+ iCapPlacement = GetCaption().GetPlacementType();
+ switch (iCapPlacement) {
+ case XFA_ATTRIBUTEENUM_Left:
+ case XFA_ATTRIBUTEENUM_Right:
+ case XFA_ATTRIBUTEENUM_Inline: {
+ size.width -= szCap.width;
+ }
+ default:
+ break;
+ }
+ }
+ CFX_RectF rtUIMargin = GetUIMargin();
+ size.width -= rtUIMargin.left + rtUIMargin.width;
+ CXFA_Margin mgWidget = GetMargin();
+ if (mgWidget) {
+ float fLeftInset, fRightInset;
+ mgWidget.GetLeftInset(fLeftInset);
+ mgWidget.GetRightInset(fRightInset);
+ size.width -= fLeftInset + fRightInset;
+ }
+ CalculateTextContentSize(size);
+ size.height += rtUIMargin.top + rtUIMargin.height;
+ if (bCapExit) {
+ switch (iCapPlacement) {
+ case XFA_ATTRIBUTEENUM_Left:
+ case XFA_ATTRIBUTEENUM_Right:
+ case XFA_ATTRIBUTEENUM_Inline: {
+ size.height = std::max(size.height, szCap.height);
+ } break;
+ case XFA_ATTRIBUTEENUM_Top:
+ case XFA_ATTRIBUTEENUM_Bottom: {
+ size.height += szCap.height;
+ }
+ default:
+ break;
+ }
+ }
+ size.width = szOrz.width;
+ return CalculateWidgetAutoSize(size);
+ }
+ CalculateTextContentSize(size);
+ return CalculateFieldAutoSize(size);
+}
+
+bool CXFA_WidgetAcc::CalculateCheckButtonAutoSize(CFX_SizeF& size) {
+ float fCheckSize = GetCheckButtonSize();
+ size = CFX_SizeF(fCheckSize, fCheckSize);
+ return CalculateFieldAutoSize(size);
+}
+
+bool CXFA_WidgetAcc::CalculatePushButtonAutoSize(CFX_SizeF& size) {
+ CalcCaptionSize(size);
+ return CalculateWidgetAutoSize(size);
+}
+
+bool CXFA_WidgetAcc::CalculateImageAutoSize(CFX_SizeF& size) {
+ if (!GetImageImage())
+ LoadImageImage();
+
+ size.clear();
+ CFX_RetainPtr<CFX_DIBitmap> pBitmap = GetImageImage();
+ if (pBitmap) {
+ int32_t iImageXDpi = 0;
+ int32_t iImageYDpi = 0;
+ GetImageDpi(iImageXDpi, iImageYDpi);
+ CFX_RectF rtImage(
+ 0, 0, XFA_UnitPx2Pt((float)pBitmap->GetWidth(), (float)iImageXDpi),
+ XFA_UnitPx2Pt((float)pBitmap->GetHeight(), (float)iImageYDpi));
+
+ CFX_RectF rtFit;
+ if (GetWidth(rtFit.width))
+ GetWidthWithoutMargin(rtFit.width);
+ else
+ rtFit.width = rtImage.width;
+
+ if (GetHeight(rtFit.height))
+ GetHeightWithoutMargin(rtFit.height);
+ else
+ rtFit.height = rtImage.height;
+
+ size = rtFit.Size();
+ }
+ return CalculateWidgetAutoSize(size);
+}
+
+bool CXFA_WidgetAcc::CalculateImageEditAutoSize(CFX_SizeF& size) {
+ if (!GetImageEditImage())
+ LoadImageEditImage();
+
+ size.clear();
+ CFX_RetainPtr<CFX_DIBitmap> pBitmap = GetImageEditImage();
+ if (pBitmap) {
+ int32_t iImageXDpi = 0;
+ int32_t iImageYDpi = 0;
+ GetImageEditDpi(iImageXDpi, iImageYDpi);
+ CFX_RectF rtImage(
+ 0, 0, XFA_UnitPx2Pt((float)pBitmap->GetWidth(), (float)iImageXDpi),
+ XFA_UnitPx2Pt((float)pBitmap->GetHeight(), (float)iImageYDpi));
+
+ CFX_RectF rtFit;
+ if (GetWidth(rtFit.width))
+ GetWidthWithoutMargin(rtFit.width);
+ else
+ rtFit.width = rtImage.width;
+
+ if (GetHeight(rtFit.height))
+ GetHeightWithoutMargin(rtFit.height);
+ else
+ rtFit.height = rtImage.height;
+
+ size.width = rtFit.width;
+ size.height = rtFit.height;
+ }
+ return CalculateFieldAutoSize(size);
+}
+
+bool CXFA_WidgetAcc::LoadImageImage() {
+ InitLayoutData();
+ return static_cast<CXFA_ImageLayoutData*>(m_pLayoutData.get())
+ ->LoadImageData(this);
+}
+
+bool CXFA_WidgetAcc::LoadImageEditImage() {
+ InitLayoutData();
+ return static_cast<CXFA_ImageEditData*>(m_pLayoutData.get())
+ ->LoadImageData(this);
+}
+
+void CXFA_WidgetAcc::GetImageDpi(int32_t& iImageXDpi, int32_t& iImageYDpi) {
+ CXFA_ImageLayoutData* pData =
+ static_cast<CXFA_ImageLayoutData*>(m_pLayoutData.get());
+ iImageXDpi = pData->m_iImageXDpi;
+ iImageYDpi = pData->m_iImageYDpi;
+}
+
+void CXFA_WidgetAcc::GetImageEditDpi(int32_t& iImageXDpi, int32_t& iImageYDpi) {
+ CXFA_ImageEditData* pData =
+ static_cast<CXFA_ImageEditData*>(m_pLayoutData.get());
+ iImageXDpi = pData->m_iImageXDpi;
+ iImageYDpi = pData->m_iImageYDpi;
+}
+
+bool CXFA_WidgetAcc::CalculateTextAutoSize(CFX_SizeF& size) {
+ LoadText();
+ CXFA_TextLayout* pTextLayout =
+ static_cast<CXFA_TextLayoutData*>(m_pLayoutData.get())->GetTextLayout();
+ if (pTextLayout) {
+ size.width = pTextLayout->StartLayout(size.width);
+ size.height = pTextLayout->GetLayoutHeight();
+ }
+ return CalculateWidgetAutoSize(size);
+}
+
+void CXFA_WidgetAcc::LoadText() {
+ InitLayoutData();
+ static_cast<CXFA_TextLayoutData*>(m_pLayoutData.get())->LoadText(this);
+}
+
+float CXFA_WidgetAcc::CalculateWidgetAutoWidth(float fWidthCalc) {
+ CXFA_Margin mgWidget = GetMargin();
+ if (mgWidget) {
+ float fLeftInset, fRightInset;
+ mgWidget.GetLeftInset(fLeftInset);
+ mgWidget.GetRightInset(fRightInset);
+ fWidthCalc += fLeftInset + fRightInset;
+ }
+
+ float fMin = 0, fMax = 0;
+ if (GetMinWidth(fMin))
+ fWidthCalc = std::max(fWidthCalc, fMin);
+ if (GetMaxWidth(fMax) && fMax > 0)
+ fWidthCalc = std::min(fWidthCalc, fMax);
+
+ return fWidthCalc;
+}
+
+float CXFA_WidgetAcc::GetWidthWithoutMargin(float fWidthCalc) {
+ CXFA_Margin mgWidget = GetMargin();
+ if (mgWidget) {
+ float fLeftInset, fRightInset;
+ mgWidget.GetLeftInset(fLeftInset);
+ mgWidget.GetRightInset(fRightInset);
+ fWidthCalc -= fLeftInset + fRightInset;
+ }
+ return fWidthCalc;
+}
+
+float CXFA_WidgetAcc::CalculateWidgetAutoHeight(float fHeightCalc) {
+ CXFA_Margin mgWidget = GetMargin();
+ if (mgWidget) {
+ float fTopInset, fBottomInset;
+ mgWidget.GetTopInset(fTopInset);
+ mgWidget.GetBottomInset(fBottomInset);
+ fHeightCalc += fTopInset + fBottomInset;
+ }
+
+ float fMin = 0, fMax = 0;
+ if (GetMinHeight(fMin))
+ fHeightCalc = std::max(fHeightCalc, fMin);
+ if (GetMaxHeight(fMax) && fMax > 0)
+ fHeightCalc = std::min(fHeightCalc, fMax);
+
+ return fHeightCalc;
+}
+
+float CXFA_WidgetAcc::GetHeightWithoutMargin(float fHeightCalc) {
+ CXFA_Margin mgWidget = GetMargin();
+ if (mgWidget) {
+ float fTopInset, fBottomInset;
+ mgWidget.GetTopInset(fTopInset);
+ mgWidget.GetBottomInset(fBottomInset);
+ fHeightCalc -= fTopInset + fBottomInset;
+ }
+ return fHeightCalc;
+}
+
+void CXFA_WidgetAcc::StartWidgetLayout(float& fCalcWidth, float& fCalcHeight) {
+ InitLayoutData();
+ XFA_Element eUIType = GetUIType();
+ if (eUIType == XFA_Element::Text) {
+ m_pLayoutData->m_fWidgetHeight = -1;
+ GetHeight(m_pLayoutData->m_fWidgetHeight);
+ StartTextLayout(fCalcWidth, fCalcHeight);
+ return;
+ }
+ if (fCalcWidth > 0 && fCalcHeight > 0)
+ return;
+
+ m_pLayoutData->m_fWidgetHeight = -1;
+ float fWidth = 0;
+ if (fCalcWidth > 0 && fCalcHeight < 0) {
+ if (!GetHeight(fCalcHeight))
+ CalculateAccWidthAndHeight(eUIType, fCalcWidth, fCalcHeight);
+
+ m_pLayoutData->m_fWidgetHeight = fCalcHeight;
+ return;
+ }
+ if (fCalcWidth < 0 && fCalcHeight < 0) {
+ if (!GetWidth(fWidth) || !GetHeight(fCalcHeight))
+ CalculateAccWidthAndHeight(eUIType, fWidth, fCalcHeight);
+
+ fCalcWidth = fWidth;
+ }
+ m_pLayoutData->m_fWidgetHeight = fCalcHeight;
+}
+
+void CXFA_WidgetAcc::CalculateAccWidthAndHeight(XFA_Element eUIType,
+ float& fWidth,
+ float& fCalcHeight) {
+ CFX_SizeF sz(fWidth, m_pLayoutData->m_fWidgetHeight);
+ switch (eUIType) {
+ case XFA_Element::Barcode:
+ case XFA_Element::ChoiceList:
+ case XFA_Element::Signature:
+ CalculateFieldAutoSize(sz);
+ break;
+ case XFA_Element::ImageEdit:
+ CalculateImageEditAutoSize(sz);
+ break;
+ case XFA_Element::Button:
+ CalculatePushButtonAutoSize(sz);
+ break;
+ case XFA_Element::CheckButton:
+ CalculateCheckButtonAutoSize(sz);
+ break;
+ case XFA_Element::DateTimeEdit:
+ case XFA_Element::NumericEdit:
+ case XFA_Element::PasswordEdit:
+ case XFA_Element::TextEdit:
+ CalculateTextEditAutoSize(sz);
+ break;
+ case XFA_Element::Image:
+ CalculateImageAutoSize(sz);
+ break;
+ case XFA_Element::Arc:
+ case XFA_Element::Line:
+ case XFA_Element::Rectangle:
+ case XFA_Element::Subform:
+ case XFA_Element::ExclGroup:
+ CalculateWidgetAutoSize(sz);
+ break;
+ default:
+ break;
+ }
+ fWidth = sz.width;
+ m_pLayoutData->m_fWidgetHeight = sz.height;
+ fCalcHeight = sz.height;
+}
+
+bool CXFA_WidgetAcc::FindSplitPos(int32_t iBlockIndex, float& fCalcHeight) {
+ XFA_Element eUIType = GetUIType();
+ if (eUIType == XFA_Element::Subform)
+ return false;
+
+ if (eUIType != XFA_Element::Text && eUIType != XFA_Element::TextEdit &&
+ eUIType != XFA_Element::NumericEdit &&
+ eUIType != XFA_Element::PasswordEdit) {
+ fCalcHeight = 0;
+ return true;
+ }
+
+ float fTopInset = 0;
+ float fBottomInset = 0;
+ if (iBlockIndex == 0) {
+ CXFA_Margin mgWidget = GetMargin();
+ if (mgWidget) {
+ mgWidget.GetTopInset(fTopInset);
+ mgWidget.GetBottomInset(fBottomInset);
+ }
+ CFX_RectF rtUIMargin = GetUIMargin();
+ fTopInset += rtUIMargin.top;
+ fBottomInset += rtUIMargin.width;
+ }
+ if (eUIType == XFA_Element::Text) {
+ float fHeight = fCalcHeight;
+ if (iBlockIndex == 0) {
+ fCalcHeight = fCalcHeight - fTopInset;
+ if (fCalcHeight < 0)
+ fCalcHeight = 0;
+ }
+
+ CXFA_TextLayout* pTextLayout =
+ static_cast<CXFA_TextLayoutData*>(m_pLayoutData.get())->GetTextLayout();
+ pTextLayout->DoLayout(iBlockIndex, fCalcHeight, fCalcHeight,
+ m_pLayoutData->m_fWidgetHeight - fTopInset);
+ if (fCalcHeight != 0) {
+ if (iBlockIndex == 0)
+ fCalcHeight = fCalcHeight + fTopInset;
+ if (fabs(fHeight - fCalcHeight) < XFA_FLOAT_PERCISION)
+ return false;
+ }
+ return true;
+ }
+ XFA_ATTRIBUTEENUM iCapPlacement = XFA_ATTRIBUTEENUM_Unknown;
+ float fCapReserve = 0;
+ if (iBlockIndex == 0) {
+ CXFA_Caption caption = GetCaption();
+ if (caption && caption.GetPresence() != XFA_ATTRIBUTEENUM_Hidden) {
+ iCapPlacement = (XFA_ATTRIBUTEENUM)caption.GetPlacementType();
+ fCapReserve = caption.GetReserve();
+ }
+ if (iCapPlacement == XFA_ATTRIBUTEENUM_Top &&
+ fCalcHeight < fCapReserve + fTopInset) {
+ fCalcHeight = 0;
+ return true;
+ }
+ if (iCapPlacement == XFA_ATTRIBUTEENUM_Bottom &&
+ m_pLayoutData->m_fWidgetHeight - fCapReserve - fBottomInset) {
+ fCalcHeight = 0;
+ return true;
+ }
+ if (iCapPlacement != XFA_ATTRIBUTEENUM_Top)
+ fCapReserve = 0;
+ }
+ CXFA_FieldLayoutData* pFieldData =
+ static_cast<CXFA_FieldLayoutData*>(m_pLayoutData.get());
+ int32_t iLinesCount = 0;
+ float fHeight = m_pLayoutData->m_fWidgetHeight;
+ CFX_WideString wsText;
+ GetValue(wsText, XFA_VALUEPICTURE_Display);
+ if (wsText.IsEmpty()) {
+ iLinesCount = 1;
+ } else {
+ if (!pFieldData->m_pTextOut) {
+ float fWidth = 0;
+ GetWidth(fWidth);
+ CalculateAccWidthAndHeight(eUIType, fWidth, fHeight);
+ }
+ iLinesCount = pFieldData->m_pTextOut->GetTotalLines();
+ }
+ std::vector<float>* pFieldArray = &pFieldData->m_FieldSplitArray;
+ int32_t iFieldSplitCount = pdfium::CollectionSize<int32_t>(*pFieldArray);
+ for (int32_t i = 0; i < iBlockIndex * 3; i += 3) {
+ iLinesCount -= (int32_t)(*pFieldArray)[i + 1];
+ fHeight -= (*pFieldArray)[i + 2];
+ }
+ if (iLinesCount == 0)
+ return false;
+
+ float fLineHeight = GetLineHeight();
+ float fFontSize = GetFontSize();
+ float fTextHeight = iLinesCount * fLineHeight - fLineHeight + fFontSize;
+ float fSpaceAbove = 0;
+ float fStartOffset = 0;
+ if (fHeight > 0.1f && iBlockIndex == 0) {
+ fStartOffset = fTopInset;
+ fHeight -= (fTopInset + fBottomInset);
+ if (CXFA_Para para = GetPara()) {
+ fSpaceAbove = para.GetSpaceAbove();
+ float fSpaceBelow = para.GetSpaceBelow();
+ fHeight -= (fSpaceAbove + fSpaceBelow);
+ switch (para.GetVerticalAlign()) {
+ case XFA_ATTRIBUTEENUM_Top:
+ fStartOffset += fSpaceAbove;
+ break;
+ case XFA_ATTRIBUTEENUM_Middle:
+ fStartOffset += ((fHeight - fTextHeight) / 2 + fSpaceAbove);
+ break;
+ case XFA_ATTRIBUTEENUM_Bottom:
+ fStartOffset += (fHeight - fTextHeight + fSpaceAbove);
+ break;
+ }
+ }
+ if (fStartOffset < 0.1f)
+ fStartOffset = 0;
+ }
+ for (int32_t i = iBlockIndex - 1; iBlockIndex > 0 && i < iBlockIndex; i++) {
+ fStartOffset = (*pFieldArray)[i * 3] - (*pFieldArray)[i * 3 + 2];
+ if (fStartOffset < 0.1f)
+ fStartOffset = 0;
+ }
+ if (iFieldSplitCount / 3 == (iBlockIndex + 1))
+ (*pFieldArray)[0] = fStartOffset;
+ else
+ pFieldArray->push_back(fStartOffset);
+
+ XFA_VERSION version = GetDoc()->GetXFADoc()->GetCurVersionMode();
+ bool bCanSplitNoContent = false;
+ XFA_ATTRIBUTEENUM eLayoutMode;
+ GetNode()
+ ->GetNodeItem(XFA_NODEITEM_Parent)
+ ->TryEnum(XFA_ATTRIBUTE_Layout, eLayoutMode, true);
+ if ((eLayoutMode == XFA_ATTRIBUTEENUM_Position ||
+ eLayoutMode == XFA_ATTRIBUTEENUM_Tb ||
+ eLayoutMode == XFA_ATTRIBUTEENUM_Row ||
+ eLayoutMode == XFA_ATTRIBUTEENUM_Table) &&
+ version > XFA_VERSION_208) {
+ bCanSplitNoContent = true;
+ }
+ if ((eLayoutMode == XFA_ATTRIBUTEENUM_Tb ||
+ eLayoutMode == XFA_ATTRIBUTEENUM_Row ||
+ eLayoutMode == XFA_ATTRIBUTEENUM_Table) &&
+ version <= XFA_VERSION_208) {
+ if (fStartOffset < fCalcHeight) {
+ bCanSplitNoContent = true;
+ } else {
+ fCalcHeight = 0;
+ return true;
+ }
+ }
+ if (bCanSplitNoContent) {
+ if ((fCalcHeight - fTopInset - fSpaceAbove < fLineHeight)) {
+ fCalcHeight = 0;
+ return true;
+ }
+ if (fStartOffset + XFA_FLOAT_PERCISION >= fCalcHeight) {
+ if (iFieldSplitCount / 3 == (iBlockIndex + 1)) {
+ (*pFieldArray)[iBlockIndex * 3 + 1] = 0;
+ (*pFieldArray)[iBlockIndex * 3 + 2] = fCalcHeight;
+ } else {
+ pFieldArray->push_back(0);
+ pFieldArray->push_back(fCalcHeight);
+ }
+ return false;
+ }
+ if (fCalcHeight - fStartOffset < fLineHeight) {
+ fCalcHeight = fStartOffset;
+ if (iFieldSplitCount / 3 == (iBlockIndex + 1)) {
+ (*pFieldArray)[iBlockIndex * 3 + 1] = 0;
+ (*pFieldArray)[iBlockIndex * 3 + 2] = fCalcHeight;
+ } else {
+ pFieldArray->push_back(0);
+ pFieldArray->push_back(fCalcHeight);
+ }
+ return true;
+ }
+ float fTextNum =
+ fCalcHeight + XFA_FLOAT_PERCISION - fCapReserve - fStartOffset;
+ int32_t iLineNum =
+ (int32_t)((fTextNum + (fLineHeight - fFontSize)) / fLineHeight);
+ if (iLineNum >= iLinesCount) {
+ if (fCalcHeight - fStartOffset - fTextHeight >= fFontSize) {
+ if (iFieldSplitCount / 3 == (iBlockIndex + 1)) {
+ (*pFieldArray)[iBlockIndex * 3 + 1] = (float)iLinesCount;
+ (*pFieldArray)[iBlockIndex * 3 + 2] = fCalcHeight;
+ } else {
+ pFieldArray->push_back((float)iLinesCount);
+ pFieldArray->push_back(fCalcHeight);
+ }
+ return false;
+ }
+ if (fHeight - fStartOffset - fTextHeight < fFontSize) {
+ iLineNum -= 1;
+ if (iLineNum == 0) {
+ fCalcHeight = 0;
+ return true;
+ }
+ } else {
+ iLineNum = (int32_t)(fTextNum / fLineHeight);
+ }
+ }
+ if (iLineNum > 0) {
+ float fSplitHeight = iLineNum * fLineHeight + fCapReserve + fStartOffset;
+ if (iFieldSplitCount / 3 == (iBlockIndex + 1)) {
+ (*pFieldArray)[iBlockIndex * 3 + 1] = (float)iLineNum;
+ (*pFieldArray)[iBlockIndex * 3 + 2] = fSplitHeight;
+ } else {
+ pFieldArray->push_back((float)iLineNum);
+ pFieldArray->push_back(fSplitHeight);
+ }
+ if (fabs(fSplitHeight - fCalcHeight) < XFA_FLOAT_PERCISION)
+ return false;
+
+ fCalcHeight = fSplitHeight;
+ return true;
+ }
+ }
+ fCalcHeight = 0;
+ return true;
+}
+
+void CXFA_WidgetAcc::InitLayoutData() {
+ if (m_pLayoutData)
+ return;
+
+ switch (GetUIType()) {
+ case XFA_Element::Text:
+ m_pLayoutData = pdfium::MakeUnique<CXFA_TextLayoutData>();
+ return;
+ case XFA_Element::TextEdit:
+ m_pLayoutData = pdfium::MakeUnique<CXFA_TextEditData>();
+ return;
+ case XFA_Element::Image:
+ m_pLayoutData = pdfium::MakeUnique<CXFA_ImageLayoutData>();
+ return;
+ case XFA_Element::ImageEdit:
+ m_pLayoutData = pdfium::MakeUnique<CXFA_ImageEditData>();
+ return;
+ default:
+ break;
+ }
+ if (GetElementType() == XFA_Element::Field) {
+ m_pLayoutData = pdfium::MakeUnique<CXFA_FieldLayoutData>();
+ return;
+ }
+ m_pLayoutData = pdfium::MakeUnique<CXFA_WidgetLayoutData>();
+}
+
+void CXFA_WidgetAcc::StartTextLayout(float& fCalcWidth, float& fCalcHeight) {
+ LoadText();
+ CXFA_TextLayout* pTextLayout =
+ static_cast<CXFA_TextLayoutData*>(m_pLayoutData.get())->GetTextLayout();
+ float fTextHeight = 0;
+ if (fCalcWidth > 0 && fCalcHeight > 0) {
+ float fWidth = GetWidthWithoutMargin(fCalcWidth);
+ pTextLayout->StartLayout(fWidth);
+ fTextHeight = fCalcHeight;
+ fTextHeight = GetHeightWithoutMargin(fTextHeight);
+ pTextLayout->DoLayout(0, fTextHeight, -1, fTextHeight);
+ return;
+ }
+ if (fCalcWidth > 0 && fCalcHeight < 0) {
+ float fWidth = GetWidthWithoutMargin(fCalcWidth);
+ pTextLayout->StartLayout(fWidth);
+ }
+ if (fCalcWidth < 0 && fCalcHeight < 0) {
+ float fMaxWidth = -1;
+ bool bRet = GetWidth(fMaxWidth);
+ if (bRet) {
+ float fWidth = GetWidthWithoutMargin(fMaxWidth);
+ pTextLayout->StartLayout(fWidth);
+ } else {
+ float fWidth = pTextLayout->StartLayout(fMaxWidth);
+ fMaxWidth = CalculateWidgetAutoWidth(fWidth);
+ fWidth = GetWidthWithoutMargin(fMaxWidth);
+ pTextLayout->StartLayout(fWidth);
+ }
+ fCalcWidth = fMaxWidth;
+ }
+ if (m_pLayoutData->m_fWidgetHeight < 0) {
+ m_pLayoutData->m_fWidgetHeight = pTextLayout->GetLayoutHeight();
+ m_pLayoutData->m_fWidgetHeight =
+ CalculateWidgetAutoHeight(m_pLayoutData->m_fWidgetHeight);
+ }
+ fTextHeight = m_pLayoutData->m_fWidgetHeight;
+ fTextHeight = GetHeightWithoutMargin(fTextHeight);
+ pTextLayout->DoLayout(0, fTextHeight, -1, fTextHeight);
+ fCalcHeight = m_pLayoutData->m_fWidgetHeight;
+}
+
+bool CXFA_WidgetAcc::LoadCaption() {
+ InitLayoutData();
+ return static_cast<CXFA_FieldLayoutData*>(m_pLayoutData.get())
+ ->LoadCaption(this);
+}
+
+CXFA_TextLayout* CXFA_WidgetAcc::GetCaptionTextLayout() {
+ return m_pLayoutData
+ ? static_cast<CXFA_FieldLayoutData*>(m_pLayoutData.get())
+ ->m_pCapTextLayout.get()
+ : nullptr;
+}
+
+CXFA_TextLayout* CXFA_WidgetAcc::GetTextLayout() {
+ return m_pLayoutData
+ ? static_cast<CXFA_TextLayoutData*>(m_pLayoutData.get())
+ ->GetTextLayout()
+ : nullptr;
+}
+
+CFX_RetainPtr<CFX_DIBitmap> CXFA_WidgetAcc::GetImageImage() {
+ return m_pLayoutData
+ ? static_cast<CXFA_ImageLayoutData*>(m_pLayoutData.get())
+ ->m_pDIBitmap
+ : nullptr;
+}
+
+CFX_RetainPtr<CFX_DIBitmap> CXFA_WidgetAcc::GetImageEditImage() {
+ return m_pLayoutData
+ ? static_cast<CXFA_ImageEditData*>(m_pLayoutData.get())
+ ->m_pDIBitmap
+ : nullptr;
+}
+
+void CXFA_WidgetAcc::SetImageImage(
+ const CFX_RetainPtr<CFX_DIBitmap>& newImage) {
+ CXFA_ImageLayoutData* pData =
+ static_cast<CXFA_ImageLayoutData*>(m_pLayoutData.get());
+ if (pData->m_pDIBitmap != newImage)
+ pData->m_pDIBitmap = newImage;
+}
+
+void CXFA_WidgetAcc::SetImageEditImage(
+ const CFX_RetainPtr<CFX_DIBitmap>& newImage) {
+ CXFA_ImageEditData* pData =
+ static_cast<CXFA_ImageEditData*>(m_pLayoutData.get());
+ if (pData->m_pDIBitmap != newImage)
+ pData->m_pDIBitmap = newImage;
+}
+
+CXFA_WidgetLayoutData* CXFA_WidgetAcc::GetWidgetLayoutData() {
+ return m_pLayoutData.get();
+}
+
+CFX_RetainPtr<CFGAS_GEFont> CXFA_WidgetAcc::GetFDEFont() {
+ CFX_WideStringC wsFontName = L"Courier";
+ uint32_t dwFontStyle = 0;
+ if (CXFA_Font font = GetFont()) {
+ if (font.IsBold())
+ dwFontStyle |= FX_FONTSTYLE_Bold;
+ if (font.IsItalic())
+ dwFontStyle |= FX_FONTSTYLE_Italic;
+ font.GetTypeface(wsFontName);
+ }
+
+ auto* pDoc = GetDoc();
+ return pDoc->GetApp()->GetXFAFontMgr()->GetFont(pDoc, wsFontName,
+ dwFontStyle);
+}
+
+float CXFA_WidgetAcc::GetFontSize() {
+ float fFontSize = 10.0f;
+ if (CXFA_Font font = GetFont())
+ fFontSize = font.GetFontSize();
+ return fFontSize < 0.1f ? 10.0f : fFontSize;
+}
+
+float CXFA_WidgetAcc::GetLineHeight() {
+ float fLineHeight = 0;
+ if (CXFA_Para para = GetPara())
+ fLineHeight = para.GetLineHeight();
+ if (fLineHeight < 1)
+ fLineHeight = GetFontSize() * 1.2f;
+ return fLineHeight;
+}
+
+FX_ARGB CXFA_WidgetAcc::GetTextColor() {
+ if (CXFA_Font font = GetFont()) {
+ return font.GetColor();
+ }
+ return 0xFF000000;
+}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/cxfa_widgetacc.h b/chromium/third_party/pdfium/xfa/fxfa/cxfa_widgetacc.h
new file mode 100644
index 00000000000..38b17ef63fa
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fxfa/cxfa_widgetacc.h
@@ -0,0 +1,122 @@
+// 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 XFA_FXFA_CXFA_WIDGETACC_H_
+#define XFA_FXFA_CXFA_WIDGETACC_H_
+
+#include <memory>
+
+#include "core/fxcrt/cfx_retain_ptr.h"
+#include "core/fxcrt/fx_coordinates.h"
+#include "core/fxge/dib/cfx_dibitmap.h"
+#include "core/fxge/fx_dib.h"
+#include "xfa/fxfa/parser/cxfa_box.h"
+#include "xfa/fxfa/parser/cxfa_event.h"
+#include "xfa/fxfa/parser/cxfa_image.h"
+#include "xfa/fxfa/parser/cxfa_margin.h"
+#include "xfa/fxfa/parser/cxfa_script.h"
+#include "xfa/fxfa/parser/cxfa_value.h"
+#include "xfa/fxfa/parser/cxfa_widgetdata.h"
+
+class CFGAS_GEFont;
+class CXFA_EventParam;
+class CXFA_FFApp;
+class CXFA_FFDoc;
+class CXFA_FFDocView;
+class CXFA_FFWidget;
+class CXFA_Node;
+class CXFA_TextLayout;
+class CXFA_WidgetLayoutData;
+class IXFA_AppProvider;
+
+class CXFA_WidgetAcc : public CXFA_WidgetData {
+ public:
+ CXFA_WidgetAcc(CXFA_FFDocView* pDocView, CXFA_Node* pNode);
+ ~CXFA_WidgetAcc();
+
+ bool GetName(CFX_WideString& wsName, int32_t iNameType = 0);
+ bool ProcessValueChanged();
+ void ResetData();
+
+ void SetImageEdit(const CFX_WideString& wsContentType,
+ const CFX_WideString& wsHref,
+ const CFX_WideString& wsData);
+
+ CXFA_WidgetAcc* GetExclGroup();
+ CXFA_FFDocView* GetDocView();
+ CXFA_FFDoc* GetDoc();
+ CXFA_FFApp* GetApp();
+ IXFA_AppProvider* GetAppProvider();
+
+ int32_t ProcessEvent(int32_t iActivity, CXFA_EventParam* pEventParam);
+ int32_t ProcessEvent(const CXFA_Event& event, CXFA_EventParam* pEventParam);
+ int32_t ProcessCalculate();
+ int32_t ProcessValidate(int32_t iFlags = 0);
+ int32_t ExecuteScript(CXFA_Script script,
+ CXFA_EventParam* pEventParam,
+ CFXJSE_Value** pRetValue = nullptr);
+
+ CXFA_FFWidget* GetNextWidget(CXFA_FFWidget* pWidget);
+ void StartWidgetLayout(float& fCalcWidth, float& fCalcHeight);
+ bool FindSplitPos(int32_t iBlockIndex, float& fCalcHeight);
+ bool LoadCaption();
+ void LoadText();
+ bool LoadImageImage();
+ bool LoadImageEditImage();
+ void GetImageDpi(int32_t& iImageXDpi, int32_t& iImageYDpi);
+ void GetImageEditDpi(int32_t& iImageXDpi, int32_t& iImageYDpi);
+ CXFA_TextLayout* GetCaptionTextLayout();
+ CXFA_TextLayout* GetTextLayout();
+ CFX_RetainPtr<CFX_DIBitmap> GetImageImage();
+ CFX_RetainPtr<CFX_DIBitmap> GetImageEditImage();
+ void SetImageImage(const CFX_RetainPtr<CFX_DIBitmap>& newImage);
+ void SetImageEditImage(const CFX_RetainPtr<CFX_DIBitmap>& newImage);
+ void UpdateUIDisplay(CXFA_FFWidget* pExcept = nullptr);
+
+ CXFA_Node* GetDatasets();
+ CFX_RetainPtr<CFGAS_GEFont> GetFDEFont();
+ float GetFontSize();
+ FX_ARGB GetTextColor();
+ float GetLineHeight();
+ CXFA_WidgetLayoutData* GetWidgetLayoutData();
+
+ private:
+ void ProcessScriptTestValidate(CXFA_Validate validate,
+ int32_t iRet,
+ CFXJSE_Value* pRetValue,
+ bool bVersionFlag);
+ int32_t ProcessFormatTestValidate(CXFA_Validate validate, bool bVersionFlag);
+ int32_t ProcessNullTestValidate(CXFA_Validate validate,
+ int32_t iFlags,
+ bool bVersionFlag);
+ CFX_WideString GetValidateCaptionName(bool bVersionFlag);
+ CFX_WideString GetValidateMessage(bool bError, bool bVersionFlag);
+ void CalcCaptionSize(CFX_SizeF& szCap);
+ bool CalculateFieldAutoSize(CFX_SizeF& size);
+ bool CalculateWidgetAutoSize(CFX_SizeF& size);
+ bool CalculateTextEditAutoSize(CFX_SizeF& size);
+ bool CalculateCheckButtonAutoSize(CFX_SizeF& size);
+ bool CalculatePushButtonAutoSize(CFX_SizeF& size);
+ bool CalculateImageEditAutoSize(CFX_SizeF& size);
+ bool CalculateImageAutoSize(CFX_SizeF& size);
+ bool CalculateTextAutoSize(CFX_SizeF& size);
+ float CalculateWidgetAutoHeight(float fHeightCalc);
+ float CalculateWidgetAutoWidth(float fWidthCalc);
+ float GetWidthWithoutMargin(float fWidthCalc);
+ float GetHeightWithoutMargin(float fHeightCalc);
+ void CalculateTextContentSize(CFX_SizeF& size);
+ void CalculateAccWidthAndHeight(XFA_Element eUIType,
+ float& fWidth,
+ float& fCalcHeight);
+ void InitLayoutData();
+ void StartTextLayout(float& fCalcWidth, float& fCalcHeight);
+
+ CXFA_FFDocView* m_pDocView;
+ std::unique_ptr<CXFA_WidgetLayoutData> m_pLayoutData;
+ uint32_t m_nRecursionDepth;
+};
+
+#endif // XFA_FXFA_CXFA_WIDGETACC_H_
diff --git a/chromium/third_party/pdfium/xfa/fxfa/cxfa_widgetacciterator.cpp b/chromium/third_party/pdfium/xfa/fxfa/cxfa_widgetacciterator.cpp
new file mode 100644
index 00000000000..373fba99dc8
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fxfa/cxfa_widgetacciterator.cpp
@@ -0,0 +1,31 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "xfa/fxfa/cxfa_widgetacciterator.h"
+
+#include "xfa/fxfa/cxfa_widgetacc.h"
+
+CXFA_WidgetAccIterator::CXFA_WidgetAccIterator(CXFA_Node* pTravelRoot)
+ : m_ContentIterator(pTravelRoot), m_pCurWidgetAcc(nullptr) {}
+
+CXFA_WidgetAccIterator::~CXFA_WidgetAccIterator() {}
+
+CXFA_WidgetAcc* CXFA_WidgetAccIterator::MoveToNext() {
+ CXFA_Node* pItem = m_pCurWidgetAcc ? m_ContentIterator.MoveToNext()
+ : m_ContentIterator.GetCurrent();
+ while (pItem) {
+ m_pCurWidgetAcc = static_cast<CXFA_WidgetAcc*>(pItem->GetWidgetData());
+ if (m_pCurWidgetAcc)
+ return m_pCurWidgetAcc;
+ pItem = m_ContentIterator.MoveToNext();
+ }
+ return nullptr;
+}
+
+void CXFA_WidgetAccIterator::SkipTree() {
+ m_ContentIterator.SkipChildrenAndMoveToNext();
+ m_pCurWidgetAcc = nullptr;
+}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/cxfa_widgetacciterator.h b/chromium/third_party/pdfium/xfa/fxfa/cxfa_widgetacciterator.h
new file mode 100644
index 00000000000..ab18e833c2c
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fxfa/cxfa_widgetacciterator.h
@@ -0,0 +1,28 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef XFA_FXFA_CXFA_WIDGETACCITERATOR_H_
+#define XFA_FXFA_CXFA_WIDGETACCITERATOR_H_
+
+#include "xfa/fxfa/parser/cxfa_traversestrategy_xfacontainernode.h"
+
+class CXFA_Node;
+class CXFA_WidgetAcc;
+
+class CXFA_WidgetAccIterator {
+ public:
+ explicit CXFA_WidgetAccIterator(CXFA_Node* pTravelRoot);
+ ~CXFA_WidgetAccIterator();
+
+ CXFA_WidgetAcc* MoveToNext();
+ void SkipTree();
+
+ private:
+ CXFA_ContainerIterator m_ContentIterator;
+ CXFA_WidgetAcc* m_pCurWidgetAcc; // not owned.
+};
+
+#endif // XFA_FXFA_CXFA_WIDGETACCITERATOR_H_
diff --git a/chromium/third_party/pdfium/xfa/fxfa/fm2js/xfa_error.cpp b/chromium/third_party/pdfium/xfa/fxfa/fm2js/xfa_error.cpp
index 020d9bc5091..1d31ce6958f 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/fm2js/xfa_error.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/fm2js/xfa_error.cpp
@@ -6,12 +6,14 @@
#include "xfa/fxfa/fm2js/xfa_error.h"
-const FX_WCHAR kFMErrUnsupportedChar[] = L"unsupported char '%c'";
-const FX_WCHAR kFMErrBadSuffixNumber[] = L"bad suffix on number";
-const FX_WCHAR kFMErrExpectedIdentifier[] =
+const wchar_t kFMErrUnsupportedChar[] = L"unsupported char '%c'";
+const wchar_t kFMErrBadSuffixNumber[] = L"bad suffix on number";
+const wchar_t kFMErrExpectedIdentifier[] =
L"expected identifier instead of '%s'";
-const FX_WCHAR kFMErrExpectedToken[] = L"expected '%s' instead of '%s'";
-const FX_WCHAR kFMErrExpectedEndIf[] = L"expected 'endif' instead of '%s'";
-const FX_WCHAR kFMErrUnexpectedExpression[] = L"unexpected expression '%s'";
-const FX_WCHAR kFMErrExpectedNonEmptyExpression[] =
+const wchar_t kFMErrExpectedToken[] = L"expected '%s' instead of '%s'";
+const wchar_t kFMErrExpectedEndIf[] = L"expected 'endif' instead of '%s'";
+const wchar_t kFMErrUnexpectedExpression[] = L"unexpected expression '%s'";
+const wchar_t kFMErrExpectedNonEmptyExpression[] =
L"expected non-empty expression";
+const wchar_t kFMErrLongAssignmentChain[] =
+ L"long assignment chains are unsupported";
diff --git a/chromium/third_party/pdfium/xfa/fxfa/fm2js/xfa_error.h b/chromium/third_party/pdfium/xfa/fxfa/fm2js/xfa_error.h
index 5e3fbbe1bab..b6621da4401 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/fm2js/xfa_error.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/fm2js/xfa_error.h
@@ -10,13 +10,14 @@
#include "core/fxcrt/fx_string.h"
#include "core/fxcrt/fx_system.h"
-extern const FX_WCHAR kFMErrUnsupportedChar[];
-extern const FX_WCHAR kFMErrBadSuffixNumber[];
-extern const FX_WCHAR kFMErrExpectedIdentifier[];
-extern const FX_WCHAR kFMErrExpectedToken[];
-extern const FX_WCHAR kFMErrExpectedEndIf[];
-extern const FX_WCHAR kFMErrUnexpectedExpression[];
-extern const FX_WCHAR kFMErrExpectedNonEmptyExpression[];
+extern const wchar_t kFMErrUnsupportedChar[];
+extern const wchar_t kFMErrBadSuffixNumber[];
+extern const wchar_t kFMErrExpectedIdentifier[];
+extern const wchar_t kFMErrExpectedToken[];
+extern const wchar_t kFMErrExpectedEndIf[];
+extern const wchar_t kFMErrUnexpectedExpression[];
+extern const wchar_t kFMErrExpectedNonEmptyExpression[];
+extern const wchar_t kFMErrLongAssignmentChain[];
class CXFA_FMErrorInfo {
public:
diff --git a/chromium/third_party/pdfium/xfa/fxfa/fm2js/xfa_expression.cpp b/chromium/third_party/pdfium/xfa/fxfa/fm2js/xfa_expression.cpp
index 32db6d24df0..c1e451eade0 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/fm2js/xfa_expression.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/fm2js/xfa_expression.cpp
@@ -12,10 +12,10 @@
namespace {
-const FX_WCHAR RUNTIMEBLOCKTEMPARRAY[] =
+const wchar_t RUNTIMEBLOCKTEMPARRAY[] =
L"foxit_xfa_formcalc_runtime_block_temp_array";
-const FX_WCHAR RUNTIMEBLOCKTEMPARRAYINDEX[] =
+const wchar_t RUNTIMEBLOCKTEMPARRAYINDEX[] =
L"foxit_xfa_formcalc_runtime_block_temp_array_index";
} // namespace
diff --git a/chromium/third_party/pdfium/xfa/fxfa/fm2js/xfa_expression.h b/chromium/third_party/pdfium/xfa/fxfa/fm2js/xfa_expression.h
index 6b55ea58155..9177c305d2c 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/fm2js/xfa_expression.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/fm2js/xfa_expression.h
@@ -33,7 +33,7 @@ class CXFA_FMExpression {
uint32_t GetLine() { return m_line; }
XFA_FM_EXPTYPE GetExpType() const { return m_type; }
- protected:
+ private:
XFA_FM_EXPTYPE m_type;
uint32_t m_line;
};
diff --git a/chromium/third_party/pdfium/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp b/chromium/third_party/pdfium/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp
index e8cb2d0279a..56a99157d33 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp
@@ -10,17 +10,21 @@
#include <algorithm>
+#include "core/fxcrt/cfx_decimal.h"
#include "core/fxcrt/fx_ext.h"
#include "fxjs/cfxjse_arguments.h"
#include "fxjs/cfxjse_class.h"
#include "fxjs/cfxjse_value.h"
#include "third_party/base/ptr_util.h"
-#include "xfa/fgas/localization/fgas_locale.h"
+#include "third_party/base/stl_util.h"
#include "xfa/fxfa/app/xfa_ffnotify.h"
#include "xfa/fxfa/fm2js/xfa_program.h"
#include "xfa/fxfa/parser/cxfa_document.h"
+#include "xfa/fxfa/parser/cxfa_localevalue.h"
+#include "xfa/fxfa/parser/cxfa_node.h"
#include "xfa/fxfa/parser/cxfa_scriptcontext.h"
-#include "xfa/fxfa/parser/xfa_localevalue.h"
+#include "xfa/fxfa/parser/cxfa_timezoneprovider.h"
+#include "xfa/fxfa/parser/xfa_utils.h"
namespace {
@@ -28,7 +32,7 @@ const double kFinancialPrecision = 0.00000001;
struct XFA_FMHtmlReserveCode {
uint32_t m_uCode;
- const FX_WCHAR* m_htmlReserve;
+ const wchar_t* m_htmlReserve;
};
struct XFA_FMHtmlHashedReserveCode {
@@ -384,7 +388,7 @@ void AlternateDateTimeSymbols(CFX_WideString& wsPattern,
bool bEscape = false;
int32_t i = 0;
while (i < nLength) {
- FX_WCHAR wc = wsPattern[i];
+ wchar_t wc = wsPattern[i];
if (wc == L'\'') {
bInConstRange = !bInConstRange;
if (bEscape) {
@@ -442,11 +446,11 @@ bool PatternStringType(const CFX_ByteStringC& szPattern,
patternType = XFA_VT_NULL;
wsPattern.MakeLower();
- const FX_WCHAR* pData = wsPattern.c_str();
+ const wchar_t* pData = wsPattern.c_str();
int32_t iLength = wsPattern.GetLength();
int32_t iIndex = 0;
bool bSingleQuotation = false;
- FX_WCHAR patternChar;
+ wchar_t patternChar;
while (iIndex < iLength) {
patternChar = pData[iIndex];
if (patternChar == 0x27) {
@@ -455,7 +459,7 @@ bool PatternStringType(const CFX_ByteStringC& szPattern,
(patternChar == 'y' || patternChar == 'j')) {
patternType = XFA_VT_DATE;
iIndex++;
- FX_WCHAR timePatternChar;
+ wchar_t timePatternChar;
while (iIndex < iLength) {
timePatternChar = pData[iIndex];
if (timePatternChar == 0x27) {
@@ -505,6 +509,40 @@ bool IsWhitespace(char c) {
c == 0x0D;
}
+IFX_Locale* LocaleFromString(CXFA_Document* pDoc,
+ CXFA_LocaleMgr* pMgr,
+ const CFX_ByteStringC& szLocale) {
+ if (!szLocale.IsEmpty())
+ return pMgr->GetLocaleByName(CFX_WideString::FromUTF8(szLocale));
+
+ CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject());
+ ASSERT(pThisNode);
+ return CXFA_WidgetData(pThisNode).GetLocal();
+}
+
+CFX_WideString FormatFromString(IFX_Locale* pLocale,
+ const CFX_ByteStringC& szFormat) {
+ if (!szFormat.IsEmpty())
+ return CFX_WideString::FromUTF8(szFormat);
+
+ return pLocale->GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY_Default);
+}
+
+FX_LOCALEDATETIMESUBCATEGORY SubCategoryFromInt(int32_t iStyle) {
+ switch (iStyle) {
+ case 1:
+ return FX_LOCALEDATETIMESUBCATEGORY_Short;
+ case 3:
+ return FX_LOCALEDATETIMESUBCATEGORY_Long;
+ case 4:
+ return FX_LOCALEDATETIMESUBCATEGORY_Full;
+ case 0:
+ case 2:
+ default:
+ return FX_LOCALEDATETIMESUBCATEGORY_Medium;
+ }
+}
+
} // namespace
// static
@@ -522,7 +560,7 @@ void CXFA_FM2JSContext::Abs(CFXJSE_Value* pThis,
return;
}
- FX_DOUBLE dValue = ValueToDouble(pThis, argOne.get());
+ double dValue = ValueToDouble(pThis, argOne.get());
if (dValue < 0)
dValue = -dValue;
@@ -541,7 +579,7 @@ void CXFA_FM2JSContext::Avg(CFXJSE_Value* pThis,
v8::Isolate* pIsolate = ToJSContext(pThis, nullptr)->GetScriptRuntime();
uint32_t uCount = 0;
- FX_DOUBLE dSum = 0.0;
+ double dSum = 0.0;
for (int32_t i = 0; i < argc; i++) {
std::unique_ptr<CFXJSE_Value> argValue = args.GetValue(i);
if (argValue->IsNull())
@@ -611,8 +649,7 @@ void CXFA_FM2JSContext::Ceil(CFXJSE_Value* pThis,
return;
}
- args.GetReturnValue()->SetFloat(
- FXSYS_ceil(ValueToFloat(pThis, argValue.get())));
+ args.GetReturnValue()->SetFloat(ceil(ValueToFloat(pThis, argValue.get())));
}
// static
@@ -684,8 +721,7 @@ void CXFA_FM2JSContext::Floor(CFXJSE_Value* pThis,
return;
}
- args.GetReturnValue()->SetFloat(
- FXSYS_floor(ValueToFloat(pThis, argValue.get())));
+ args.GetReturnValue()->SetFloat(floor(ValueToFloat(pThis, argValue.get())));
}
// static
@@ -695,7 +731,7 @@ void CXFA_FM2JSContext::Max(CFXJSE_Value* pThis,
CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr);
v8::Isolate* pIsolate = pContext->GetScriptRuntime();
uint32_t uCount = 0;
- FX_DOUBLE dMaxValue = 0.0;
+ double dMaxValue = 0.0;
for (int32_t i = 0; i < args.GetLength(); i++) {
std::unique_ptr<CFXJSE_Value> argValue = args.GetValue(i);
if (argValue->IsNull())
@@ -723,7 +759,7 @@ void CXFA_FM2JSContext::Max(CFXJSE_Value* pThis,
continue;
uCount++;
- FX_DOUBLE dValue = ValueToDouble(pThis, newPropertyValue.get());
+ double dValue = ValueToDouble(pThis, newPropertyValue.get());
dMaxValue = (uCount == 1) ? dValue : std::max(dMaxValue, dValue);
}
} else {
@@ -735,7 +771,7 @@ void CXFA_FM2JSContext::Max(CFXJSE_Value* pThis,
continue;
uCount++;
- FX_DOUBLE dValue = ValueToDouble(pThis, newPropertyValue.get());
+ double dValue = ValueToDouble(pThis, newPropertyValue.get());
dMaxValue = (uCount == 1) ? dValue : std::max(dMaxValue, dValue);
}
}
@@ -746,11 +782,11 @@ void CXFA_FM2JSContext::Max(CFXJSE_Value* pThis,
continue;
uCount++;
- FX_DOUBLE dValue = ValueToDouble(pThis, newPropertyValue.get());
+ double dValue = ValueToDouble(pThis, newPropertyValue.get());
dMaxValue = (uCount == 1) ? dValue : std::max(dMaxValue, dValue);
} else {
uCount++;
- FX_DOUBLE dValue = ValueToDouble(pThis, argValue.get());
+ double dValue = ValueToDouble(pThis, argValue.get());
dMaxValue = (uCount == 1) ? dValue : std::max(dMaxValue, dValue);
}
}
@@ -769,7 +805,7 @@ void CXFA_FM2JSContext::Min(CFXJSE_Value* pThis,
CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr);
v8::Isolate* pIsolate = pContext->GetScriptRuntime();
uint32_t uCount = 0;
- FX_DOUBLE dMinValue = 0.0;
+ double dMinValue = 0.0;
for (int32_t i = 0; i < args.GetLength(); i++) {
std::unique_ptr<CFXJSE_Value> argValue = args.GetValue(i);
if (argValue->IsNull())
@@ -797,7 +833,7 @@ void CXFA_FM2JSContext::Min(CFXJSE_Value* pThis,
continue;
uCount++;
- FX_DOUBLE dValue = ValueToDouble(pThis, newPropertyValue.get());
+ double dValue = ValueToDouble(pThis, newPropertyValue.get());
dMinValue = uCount == 1 ? dValue : std::min(dMinValue, dValue);
}
} else {
@@ -809,7 +845,7 @@ void CXFA_FM2JSContext::Min(CFXJSE_Value* pThis,
continue;
uCount++;
- FX_DOUBLE dValue = ValueToDouble(pThis, newPropertyValue.get());
+ double dValue = ValueToDouble(pThis, newPropertyValue.get());
dMinValue = uCount == 1 ? dValue : std::min(dMinValue, dValue);
}
}
@@ -820,11 +856,11 @@ void CXFA_FM2JSContext::Min(CFXJSE_Value* pThis,
continue;
uCount++;
- FX_DOUBLE dValue = ValueToDouble(pThis, newPropertyValue.get());
+ double dValue = ValueToDouble(pThis, newPropertyValue.get());
dMinValue = uCount == 1 ? dValue : std::min(dMinValue, dValue);
} else {
uCount++;
- FX_DOUBLE dValue = ValueToDouble(pThis, argValue.get());
+ double dValue = ValueToDouble(pThis, argValue.get());
dMinValue = uCount == 1 ? dValue : std::min(dMinValue, dValue);
}
}
@@ -854,9 +890,9 @@ void CXFA_FM2JSContext::Mod(CFXJSE_Value* pThis,
}
bool argOneResult;
- FX_DOUBLE dDividend = ExtractDouble(pThis, argOne.get(), &argOneResult);
+ double dDividend = ExtractDouble(pThis, argOne.get(), &argOneResult);
bool argTwoResult;
- FX_DOUBLE dDivisor = ExtractDouble(pThis, argTwo.get(), &argTwoResult);
+ double dDivisor = ExtractDouble(pThis, argTwo.get(), &argTwoResult);
if (!argOneResult || !argTwoResult) {
pContext->ThrowArgumentMismatchException();
return;
@@ -889,7 +925,7 @@ void CXFA_FM2JSContext::Round(CFXJSE_Value* pThis,
}
bool dValueRet;
- FX_DOUBLE dValue = ExtractDouble(pThis, argOne.get(), &dValueRet);
+ double dValue = ExtractDouble(pThis, argOne.get(), &dValueRet);
if (!dValueRet) {
pContext->ThrowArgumentMismatchException();
return;
@@ -904,17 +940,16 @@ void CXFA_FM2JSContext::Round(CFXJSE_Value* pThis,
}
bool dPrecisionRet;
- FX_DOUBLE dPrecision = ExtractDouble(pThis, argTwo.get(), &dPrecisionRet);
+ double dPrecision = ExtractDouble(pThis, argTwo.get(), &dPrecisionRet);
if (!dPrecisionRet) {
pContext->ThrowArgumentMismatchException();
return;
}
- uPrecision =
- static_cast<uint8_t>(std::min(std::max(dPrecision, 0.0), 12.0));
+ uPrecision = static_cast<uint8_t>(pdfium::clamp(dPrecision, 0.0, 12.0));
}
- CFX_Decimal decimalValue((FX_FLOAT)dValue, uPrecision);
+ CFX_Decimal decimalValue((float)dValue, uPrecision);
CFX_WideString wsValue = decimalValue;
args.GetReturnValue()->SetString(wsValue.UTF8Encode().AsStringC());
}
@@ -932,7 +967,7 @@ void CXFA_FM2JSContext::Sum(CFXJSE_Value* pThis,
CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr);
v8::Isolate* pIsolate = pContext->GetScriptRuntime();
uint32_t uCount = 0;
- FX_DOUBLE dSum = 0.0;
+ double dSum = 0.0;
for (int32_t i = 0; i < argc; i++) {
std::unique_ptr<CFXJSE_Value> argValue = args.GetValue(i);
if (argValue->IsNull())
@@ -1034,9 +1069,7 @@ void CXFA_FM2JSContext::Date2Num(CFXJSE_Value* pThis,
return;
}
- CFX_ByteString dateString;
- ValueToUTF8String(dateValue.get(), dateString);
-
+ CFX_ByteString dateString = ValueToUTF8String(dateValue.get());
CFX_ByteString formatString;
if (argc > 1) {
std::unique_ptr<CFXJSE_Value> formatValue = GetSimpleValue(pThis, args, 1);
@@ -1044,7 +1077,7 @@ void CXFA_FM2JSContext::Date2Num(CFXJSE_Value* pThis,
args.GetReturnValue()->SetNull();
return;
}
- ValueToUTF8String(formatValue.get(), formatString);
+ formatString = ValueToUTF8String(formatValue.get());
}
CFX_ByteString localString;
@@ -1054,16 +1087,12 @@ void CXFA_FM2JSContext::Date2Num(CFXJSE_Value* pThis,
args.GetReturnValue()->SetNull();
return;
}
- ValueToUTF8String(localValue.get(), localString);
- }
-
- CFX_ByteString szIsoDateString;
- if (!Local2IsoDate(pThis, dateString.AsStringC(), formatString.AsStringC(),
- localString.AsStringC(), szIsoDateString)) {
- args.GetReturnValue()->SetInteger(0);
- return;
+ localString = ValueToUTF8String(localValue.get());
}
+ CFX_ByteString szIsoDateString =
+ Local2IsoDate(pThis, dateString.AsStringC(), formatString.AsStringC(),
+ localString.AsStringC());
args.GetReturnValue()->SetInteger(
DateString2Num(szIsoDateString.AsStringC()));
}
@@ -1098,11 +1127,11 @@ void CXFA_FM2JSContext::DateFmt(CFXJSE_Value* pThis,
args.GetReturnValue()->SetNull();
return;
}
- ValueToUTF8String(argLocal.get(), szLocal);
+ szLocal = ValueToUTF8String(argLocal.get());
}
- CFX_ByteString formatStr;
- GetStandardDateFormat(pThis, iStyle, szLocal.AsStringC(), formatStr);
+ CFX_ByteString formatStr =
+ GetStandardDateFormat(pThis, iStyle, szLocal.AsStringC());
args.GetReturnValue()->SetString(formatStr.AsStringC());
}
@@ -1115,15 +1144,12 @@ void CXFA_FM2JSContext::IsoDate2Num(CFXJSE_Value* pThis,
->ThrowParamCountMismatchException(L"IsoDate2Num");
return;
}
-
std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0);
if (argOne->IsNull()) {
args.GetReturnValue()->SetNull();
return;
}
-
- CFX_ByteString szArgString;
- ValueToUTF8String(argOne.get(), szArgString);
+ CFX_ByteString szArgString = ValueToUTF8String(argOne.get());
args.GetReturnValue()->SetInteger(DateString2Num(szArgString.AsStringC()));
}
@@ -1145,9 +1171,7 @@ void CXFA_FM2JSContext::IsoTime2Num(CFXJSE_Value* pThis,
CXFA_Document* pDoc = pContext->GetDocument();
CXFA_LocaleMgr* pMgr = pDoc->GetLocalMgr();
-
- CFX_ByteString szArgString;
- ValueToUTF8String(argOne.get(), szArgString);
+ CFX_ByteString szArgString = ValueToUTF8String(argOne.get());
szArgString = szArgString.Mid(szArgString.Find('T', 0) + 1);
if (szArgString.IsEmpty()) {
args.GetReturnValue()->SetInteger(0);
@@ -1161,19 +1185,16 @@ void CXFA_FM2JSContext::IsoTime2Num(CFXJSE_Value* pThis,
return;
}
- CFX_Unitime uniTime = timeValue.GetTime();
+ CFX_DateTime uniTime = timeValue.GetTime();
int32_t hour = uniTime.GetHour();
int32_t min = uniTime.GetMinute();
int32_t second = uniTime.GetSecond();
int32_t milSecond = uniTime.GetMillisecond();
- FX_TIMEZONE tzLocale;
- pMgr->GetDefLocale()->GetTimeZone(&tzLocale);
-
// TODO(dsinclair): See if there is other time conversion code in pdfium and
// consolidate.
int32_t mins = hour * 60 + min;
- mins -= (tzLocale.tzHour * 60);
+ mins -= (pMgr->GetDefLocale()->GetTimeZone().tzHour * 60);
while (mins > 1440)
mins -= 1440;
while (mins < 0)
@@ -1215,11 +1236,11 @@ void CXFA_FM2JSContext::LocalDateFmt(CFXJSE_Value* pThis,
args.GetReturnValue()->SetNull();
return;
}
- ValueToUTF8String(argLocal.get(), szLocal);
+ szLocal = ValueToUTF8String(argLocal.get());
}
- CFX_ByteString formatStr;
- GetLocalDateFormat(pThis, iStyle, szLocal.AsStringC(), formatStr, false);
+ CFX_ByteString formatStr =
+ GetLocalDateFormat(pThis, iStyle, szLocal.AsStringC(), false);
args.GetReturnValue()->SetString(formatStr.AsStringC());
}
@@ -1253,11 +1274,11 @@ void CXFA_FM2JSContext::LocalTimeFmt(CFXJSE_Value* pThis,
args.GetReturnValue()->SetNull();
return;
}
- ValueToUTF8String(argLocal.get(), szLocal);
+ szLocal = ValueToUTF8String(argLocal.get());
}
- CFX_ByteString formatStr;
- GetLocalTimeFormat(pThis, iStyle, szLocal.AsStringC(), formatStr, false);
+ CFX_ByteString formatStr =
+ GetLocalTimeFormat(pThis, iStyle, szLocal.AsStringC(), false);
args.GetReturnValue()->SetString(formatStr.AsStringC());
}
@@ -1289,7 +1310,7 @@ void CXFA_FM2JSContext::Num2Date(CFXJSE_Value* pThis,
args.GetReturnValue()->SetNull();
return;
}
- ValueToUTF8String(formatValue.get(), formatString);
+ formatString = ValueToUTF8String(formatValue.get());
}
CFX_ByteString localString;
@@ -1299,7 +1320,7 @@ void CXFA_FM2JSContext::Num2Date(CFXJSE_Value* pThis,
args.GetReturnValue()->SetNull();
return;
}
- ValueToUTF8String(localValue.get(), localString);
+ localString = ValueToUTF8String(localValue.get());
}
int32_t iYear = 1900;
@@ -1396,9 +1417,9 @@ void CXFA_FM2JSContext::Num2Date(CFXJSE_Value* pThis,
CFX_ByteString szIsoDateString;
szIsoDateString.Format("%d%02d%02d", iYear + i, iMonth, iDay);
- CFX_ByteString szLocalDateString;
- IsoDate2Local(pThis, szIsoDateString.AsStringC(), formatString.AsStringC(),
- localString.AsStringC(), szLocalDateString);
+ CFX_ByteString szLocalDateString =
+ IsoDate2Local(pThis, szIsoDateString.AsStringC(),
+ formatString.AsStringC(), localString.AsStringC());
args.GetReturnValue()->SetString(szLocalDateString.AsStringC());
}
@@ -1419,7 +1440,7 @@ void CXFA_FM2JSContext::Num2GMTime(CFXJSE_Value* pThis,
return;
}
int32_t iTime = (int32_t)ValueToFloat(pThis, timeValue.get());
- if (FXSYS_abs(iTime) < 1.0) {
+ if (abs(iTime) < 1.0) {
args.GetReturnValue()->SetNull();
return;
}
@@ -1431,7 +1452,7 @@ void CXFA_FM2JSContext::Num2GMTime(CFXJSE_Value* pThis,
args.GetReturnValue()->SetNull();
return;
}
- ValueToUTF8String(formatValue.get(), formatString);
+ formatString = ValueToUTF8String(formatValue.get());
}
CFX_ByteString localString;
@@ -1441,12 +1462,11 @@ void CXFA_FM2JSContext::Num2GMTime(CFXJSE_Value* pThis,
args.GetReturnValue()->SetNull();
return;
}
- ValueToUTF8String(localValue.get(), localString);
+ localString = ValueToUTF8String(localValue.get());
}
- CFX_ByteString szGMTTimeString;
- Num2AllTime(pThis, iTime, formatString.AsStringC(), localString.AsStringC(),
- true, szGMTTimeString);
+ CFX_ByteString szGMTTimeString = Num2AllTime(
+ pThis, iTime, formatString.AsStringC(), localString.AsStringC(), true);
args.GetReturnValue()->SetString(szGMTTimeString.AsStringC());
}
@@ -1465,8 +1485,8 @@ void CXFA_FM2JSContext::Num2Time(CFXJSE_Value* pThis,
args.GetReturnValue()->SetNull();
return;
}
- FX_FLOAT fTime = ValueToFloat(pThis, timeValue.get());
- if (FXSYS_fabs(fTime) < 1.0) {
+ float fTime = ValueToFloat(pThis, timeValue.get());
+ if (fabs(fTime) < 1.0) {
args.GetReturnValue()->SetNull();
return;
}
@@ -1478,7 +1498,7 @@ void CXFA_FM2JSContext::Num2Time(CFXJSE_Value* pThis,
args.GetReturnValue()->SetNull();
return;
}
- ValueToUTF8String(formatValue.get(), formatString);
+ formatString = ValueToUTF8String(formatValue.get());
}
CFX_ByteString localString;
@@ -1488,12 +1508,12 @@ void CXFA_FM2JSContext::Num2Time(CFXJSE_Value* pThis,
args.GetReturnValue()->SetNull();
return;
}
- ValueToUTF8String(localValue.get(), localString);
+ localString = ValueToUTF8String(localValue.get());
}
- CFX_ByteString szLocalTimeString;
- Num2AllTime(pThis, (int32_t)fTime, formatString.AsStringC(),
- localString.AsStringC(), false, szLocalTimeString);
+ CFX_ByteString szLocalTimeString =
+ Num2AllTime(pThis, static_cast<int32_t>(fTime), formatString.AsStringC(),
+ localString.AsStringC(), false);
args.GetReturnValue()->SetString(szLocalTimeString.AsStringC());
}
@@ -1530,7 +1550,7 @@ void CXFA_FM2JSContext::Time2Num(CFXJSE_Value* pThis,
args.GetReturnValue()->SetNull();
return;
}
- ValueToUTF8String(timeValue.get(), timeString);
+ timeString = ValueToUTF8String(timeValue.get());
CFX_ByteString formatString;
if (argc > 1) {
@@ -1539,7 +1559,7 @@ void CXFA_FM2JSContext::Time2Num(CFXJSE_Value* pThis,
args.GetReturnValue()->SetNull();
return;
}
- ValueToUTF8String(formatValue.get(), formatString);
+ formatString = ValueToUTF8String(formatValue.get());
}
CFX_ByteString localString;
@@ -1549,7 +1569,7 @@ void CXFA_FM2JSContext::Time2Num(CFXJSE_Value* pThis,
args.GetReturnValue()->SetNull();
return;
}
- ValueToUTF8String(localValue.get(), localString);
+ localString = ValueToUTF8String(localValue.get());
}
CXFA_Document* pDoc = ToJSContext(pThis, nullptr)->GetDocument();
@@ -1558,7 +1578,6 @@ void CXFA_FM2JSContext::Time2Num(CFXJSE_Value* pThis,
if (localString.IsEmpty()) {
CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject());
ASSERT(pThisNode);
-
CXFA_WidgetData widgetData(pThisNode);
pLocale = widgetData.GetLocal();
} else {
@@ -1568,7 +1587,7 @@ void CXFA_FM2JSContext::Time2Num(CFXJSE_Value* pThis,
CFX_WideString wsFormat;
if (formatString.IsEmpty())
- pLocale->GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY_Default, wsFormat);
+ wsFormat = pLocale->GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY_Default);
else
wsFormat = CFX_WideString::FromUTF8(formatString.AsStringC());
@@ -1581,17 +1600,14 @@ void CXFA_FM2JSContext::Time2Num(CFXJSE_Value* pThis,
return;
}
- CFX_Unitime uniTime = localeValue.GetTime();
+ CFX_DateTime uniTime = localeValue.GetTime();
int32_t hour = uniTime.GetHour();
int32_t min = uniTime.GetMinute();
int32_t second = uniTime.GetSecond();
int32_t milSecond = uniTime.GetMillisecond();
int32_t mins = hour * 60 + min;
- FX_TIMEZONE tz;
- CXFA_TimeZoneProvider provider;
- provider.GetTimeZone(&tz);
- mins -= (tz.tzHour * 60);
+ mins -= (CXFA_TimeZoneProvider().GetTimeZone().tzHour * 60);
while (mins > 1440)
mins -= 1440;
@@ -1633,16 +1649,16 @@ void CXFA_FM2JSContext::TimeFmt(CFXJSE_Value* pThis,
args.GetReturnValue()->SetNull();
return;
}
- ValueToUTF8String(argLocal.get(), szLocal);
+ szLocal = ValueToUTF8String(argLocal.get());
}
- CFX_ByteString formatStr;
- GetStandardTimeFormat(pThis, iStyle, szLocal.AsStringC(), formatStr);
+ CFX_ByteString formatStr =
+ GetStandardTimeFormat(pThis, iStyle, szLocal.AsStringC());
args.GetReturnValue()->SetString(formatStr.AsStringC());
}
// static
-bool CXFA_FM2JSContext::IsIsoDateFormat(const FX_CHAR* pData,
+bool CXFA_FM2JSContext::IsIsoDateFormat(const char* pData,
int32_t iLength,
int32_t& iStyle,
int32_t& iYear,
@@ -1655,7 +1671,7 @@ bool CXFA_FM2JSContext::IsIsoDateFormat(const FX_CHAR* pData,
if (iLength < 4)
return false;
- FX_CHAR strYear[5];
+ char strYear[5];
strYear[4] = '\0';
for (int32_t i = 0; i < 4; ++i) {
if (pData[i] > '9' || pData[i] < '0')
@@ -1670,7 +1686,7 @@ bool CXFA_FM2JSContext::IsIsoDateFormat(const FX_CHAR* pData,
iStyle = pData[4] == '-' ? 1 : 0;
- FX_CHAR strTemp[3];
+ char strTemp[3];
strTemp[2] = '\0';
int32_t iPosOff = iStyle == 0 ? 4 : 5;
if ((pData[iPosOff] > '9' || pData[iPosOff] < '0') ||
@@ -1721,7 +1737,7 @@ bool CXFA_FM2JSContext::IsIsoDateFormat(const FX_CHAR* pData,
}
// static
-bool CXFA_FM2JSContext::IsIsoTimeFormat(const FX_CHAR* pData,
+bool CXFA_FM2JSContext::IsIsoTimeFormat(const char* pData,
int32_t iLength,
int32_t& iHour,
int32_t& iMinute,
@@ -1738,7 +1754,7 @@ bool CXFA_FM2JSContext::IsIsoTimeFormat(const FX_CHAR* pData,
if (!pData)
return false;
- FX_CHAR strTemp[3];
+ char strTemp[3];
strTemp[2] = '\0';
int32_t iZone = 0;
int32_t i = 0;
@@ -1796,7 +1812,7 @@ bool CXFA_FM2JSContext::IsIsoTimeFormat(const FX_CHAR* pData,
}
if (pData[iIndex] == '.') {
++iIndex;
- FX_CHAR strSec[4];
+ char strSec[4];
strSec[3] = '\0';
if (pData[iIndex] > '9' || pData[iIndex] < '0')
return false;
@@ -1868,7 +1884,7 @@ bool CXFA_FM2JSContext::IsIsoTimeFormat(const FX_CHAR* pData,
}
// static
-bool CXFA_FM2JSContext::IsIsoDateTimeFormat(const FX_CHAR* pData,
+bool CXFA_FM2JSContext::IsIsoDateTimeFormat(const char* pData,
int32_t iLength,
int32_t& iYear,
int32_t& iMonth,
@@ -1917,195 +1933,76 @@ bool CXFA_FM2JSContext::IsIsoDateTimeFormat(const FX_CHAR* pData,
}
// static
-bool CXFA_FM2JSContext::Local2IsoDate(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szDate,
- const CFX_ByteStringC& szFormat,
- const CFX_ByteStringC& szLocale,
- CFX_ByteString& strIsoDate) {
+CFX_ByteString CXFA_FM2JSContext::Local2IsoDate(
+ CFXJSE_Value* pThis,
+ const CFX_ByteStringC& szDate,
+ const CFX_ByteStringC& szFormat,
+ const CFX_ByteStringC& szLocale) {
CXFA_Document* pDoc = ToJSContext(pThis, nullptr)->GetDocument();
if (!pDoc)
- return false;
+ return CFX_ByteString();
CXFA_LocaleMgr* pMgr = pDoc->GetLocalMgr();
- IFX_Locale* pLocale = nullptr;
- if (szLocale.IsEmpty()) {
- CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject());
- ASSERT(pThisNode);
-
- CXFA_WidgetData widgetData(pThisNode);
- pLocale = widgetData.GetLocal();
- } else {
- pLocale = pMgr->GetLocaleByName(CFX_WideString::FromUTF8(szLocale));
- }
+ IFX_Locale* pLocale = LocaleFromString(pDoc, pMgr, szLocale);
if (!pLocale)
- return false;
+ return CFX_ByteString();
- CFX_WideString wsFormat;
- if (szFormat.IsEmpty())
- pLocale->GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY_Default, wsFormat);
- else
- wsFormat = CFX_WideString::FromUTF8(szFormat);
+ CFX_WideString wsFormat = FormatFromString(pLocale, szFormat);
+ CFX_DateTime dt =
+ CXFA_LocaleValue(XFA_VT_DATE, CFX_WideString::FromUTF8(szDate), wsFormat,
+ pLocale, pMgr)
+ .GetDate();
- CXFA_LocaleValue widgetValue(XFA_VT_DATE, CFX_WideString::FromUTF8(szDate),
- wsFormat, pLocale, pMgr);
- CFX_Unitime dt = widgetValue.GetDate();
+ CFX_ByteString strIsoDate;
strIsoDate.Format("%4d-%02d-%02d", dt.GetYear(), dt.GetMonth(), dt.GetDay());
- return true;
-}
-
-// static
-bool CXFA_FM2JSContext::Local2IsoTime(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szTime,
- const CFX_ByteStringC& szFormat,
- const CFX_ByteStringC& szLocale,
- CFX_ByteString& strIsoTime) {
- CXFA_Document* pDoc = ToJSContext(pThis, nullptr)->GetDocument();
- if (!pDoc)
- return false;
-
- CXFA_LocaleMgr* pMgr = pDoc->GetLocalMgr();
- IFX_Locale* pLocale = nullptr;
- if (szLocale.IsEmpty()) {
- CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject());
- ASSERT(pThisNode);
-
- CXFA_WidgetData widgetData(pThisNode);
- pLocale = widgetData.GetLocal();
- } else {
- pLocale = pMgr->GetLocaleByName(CFX_WideString::FromUTF8(szLocale));
- }
- if (!pLocale)
- return false;
-
- CFX_WideString wsFormat;
- if (szFormat.IsEmpty())
- pLocale->GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY_Default, wsFormat);
- else
- wsFormat = CFX_WideString::FromUTF8(szFormat);
-
- wsFormat = L"time{" + wsFormat + L"}";
- CXFA_LocaleValue widgetValue(XFA_VT_TIME, CFX_WideString::FromUTF8(szTime),
- wsFormat, pLocale, pMgr);
- CFX_Unitime utime = widgetValue.GetTime();
- strIsoTime.Format("%02d:%02d:%02d.%03d", utime.GetHour(), utime.GetMinute(),
- utime.GetSecond(), utime.GetMillisecond());
- return true;
+ return strIsoDate;
}
// static
-bool CXFA_FM2JSContext::IsoDate2Local(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szDate,
- const CFX_ByteStringC& szFormat,
- const CFX_ByteStringC& szLocale,
- CFX_ByteString& strLocalDate) {
+CFX_ByteString CXFA_FM2JSContext::IsoDate2Local(
+ CFXJSE_Value* pThis,
+ const CFX_ByteStringC& szDate,
+ const CFX_ByteStringC& szFormat,
+ const CFX_ByteStringC& szLocale) {
CXFA_Document* pDoc = ToJSContext(pThis, nullptr)->GetDocument();
if (!pDoc)
- return false;
+ return CFX_ByteString();
CXFA_LocaleMgr* pMgr = pDoc->GetLocalMgr();
- IFX_Locale* pLocale = nullptr;
- if (szLocale.IsEmpty()) {
- CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject());
- ASSERT(pThisNode);
- CXFA_WidgetData widgetData(pThisNode);
- pLocale = widgetData.GetLocal();
- } else {
- pLocale = pMgr->GetLocaleByName(CFX_WideString::FromUTF8(szLocale));
- }
+ IFX_Locale* pLocale = LocaleFromString(pDoc, pMgr, szLocale);
if (!pLocale)
- return false;
+ return CFX_ByteString();
- CFX_WideString wsFormat;
- if (szFormat.IsEmpty())
- pLocale->GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY_Default, wsFormat);
- else
- wsFormat = CFX_WideString::FromUTF8(szFormat);
-
- CXFA_LocaleValue widgetValue(XFA_VT_DATE, CFX_WideString::FromUTF8(szDate),
- pMgr);
+ CFX_WideString wsFormat = FormatFromString(pLocale, szFormat);
CFX_WideString wsRet;
- widgetValue.FormatPatterns(wsRet, wsFormat, pLocale,
- XFA_VALUEPICTURE_Display);
- strLocalDate = wsRet.UTF8Encode();
- return true;
+ CXFA_LocaleValue(XFA_VT_DATE, CFX_WideString::FromUTF8(szDate), pMgr)
+ .FormatPatterns(wsRet, wsFormat, pLocale, XFA_VALUEPICTURE_Display);
+ return wsRet.UTF8Encode();
}
// static
-bool CXFA_FM2JSContext::IsoTime2Local(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szTime,
- const CFX_ByteStringC& szFormat,
- const CFX_ByteStringC& szLocale,
- CFX_ByteString& strLocalTime) {
- CXFA_Document* pDoc = ToJSContext(pThis, nullptr)->GetDocument();
- if (!pDoc)
- return false;
-
- CXFA_LocaleMgr* pMgr = pDoc->GetLocalMgr();
- IFX_Locale* pLocale = nullptr;
- if (szLocale.IsEmpty()) {
- CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject());
- ASSERT(pThisNode);
- CXFA_WidgetData widgetData(pThisNode);
- pLocale = widgetData.GetLocal();
- } else {
- pLocale = pMgr->GetLocaleByName(CFX_WideString::FromUTF8(szLocale));
- }
- if (!pLocale)
- return false;
-
- CFX_WideString wsFormat;
- if (szFormat.IsEmpty())
- pLocale->GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY_Default, wsFormat);
- else
- wsFormat = CFX_WideString::FromUTF8(szFormat);
-
- wsFormat = L"time{" + wsFormat + L"}";
- CXFA_LocaleValue widgetValue(XFA_VT_TIME, CFX_WideString::FromUTF8(szTime),
- pMgr);
- CFX_WideString wsRet;
- widgetValue.FormatPatterns(wsRet, wsFormat, pLocale,
- XFA_VALUEPICTURE_Display);
- strLocalTime = wsRet.UTF8Encode();
- return true;
-}
-
-// static
-bool CXFA_FM2JSContext::GetGMTTime(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szTime,
- const CFX_ByteStringC& szFormat,
- const CFX_ByteStringC& szLocale,
- CFX_ByteString& strGMTTime) {
+CFX_ByteString CXFA_FM2JSContext::IsoTime2Local(
+ CFXJSE_Value* pThis,
+ const CFX_ByteStringC& szTime,
+ const CFX_ByteStringC& szFormat,
+ const CFX_ByteStringC& szLocale) {
CXFA_Document* pDoc = ToJSContext(pThis, nullptr)->GetDocument();
if (!pDoc)
- return false;
+ return CFX_ByteString();
CXFA_LocaleMgr* pMgr = pDoc->GetLocalMgr();
- IFX_Locale* pLocale = nullptr;
- if (szLocale.IsEmpty()) {
- CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject());
- ASSERT(pThisNode);
- CXFA_WidgetData widgetData(pThisNode);
- pLocale = widgetData.GetLocal();
- } else {
- pLocale = pMgr->GetLocaleByName(CFX_WideString::FromUTF8(szLocale));
- }
+ IFX_Locale* pLocale = LocaleFromString(pDoc, pMgr, szLocale);
if (!pLocale)
- return false;
+ return CFX_ByteString();
- CFX_WideString wsFormat;
- if (szFormat.IsEmpty())
- pLocale->GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY_Default, wsFormat);
- else
- wsFormat = CFX_WideString::FromUTF8(szFormat);
-
- wsFormat = L"time{" + wsFormat + L"}";
+ CFX_WideString wsFormat = {
+ L"time{", FormatFromString(pLocale, szFormat).AsStringC(), L"}"};
CXFA_LocaleValue widgetValue(XFA_VT_TIME, CFX_WideString::FromUTF8(szTime),
pMgr);
CFX_WideString wsRet;
widgetValue.FormatPatterns(wsRet, wsFormat, pLocale,
XFA_VALUEPICTURE_Display);
- strGMTTime = wsRet.UTF8Encode();
- return true;
+ return wsRet.UTF8Encode();
}
// static
@@ -2134,7 +2031,7 @@ int32_t CXFA_FM2JSContext::DateString2Num(const CFX_ByteStringC& szDateString) {
}
}
- FX_FLOAT dDays = 0;
+ float dDays = 0;
int32_t i = 1;
if (iYear < 1900)
return 0;
@@ -2166,130 +2063,73 @@ int32_t CXFA_FM2JSContext::DateString2Num(const CFX_ByteStringC& szDateString) {
}
// static
-void CXFA_FM2JSContext::GetLocalDateFormat(CFXJSE_Value* pThis,
- int32_t iStyle,
- const CFX_ByteStringC& szLocalStr,
- CFX_ByteString& strFormat,
- bool bStandard) {
- FX_LOCALEDATETIMESUBCATEGORY strStyle;
- switch (iStyle) {
- case 1:
- strStyle = FX_LOCALEDATETIMESUBCATEGORY_Short;
- break;
- case 3:
- strStyle = FX_LOCALEDATETIMESUBCATEGORY_Long;
- break;
- case 4:
- strStyle = FX_LOCALEDATETIMESUBCATEGORY_Full;
- break;
- case 0:
- case 2:
- default:
- strStyle = FX_LOCALEDATETIMESUBCATEGORY_Medium;
- break;
- }
+CFX_ByteString CXFA_FM2JSContext::GetLocalDateFormat(
+ CFXJSE_Value* pThis,
+ int32_t iStyle,
+ const CFX_ByteStringC& szLocale,
+ bool bStandard) {
CXFA_Document* pDoc = ToJSContext(pThis, nullptr)->GetDocument();
if (!pDoc)
- return;
+ return CFX_ByteString();
- IFX_Locale* pLocale = nullptr;
- if (szLocalStr.IsEmpty()) {
- CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject());
- ASSERT(pThisNode);
-
- CXFA_WidgetData widgetData(pThisNode);
- pLocale = widgetData.GetLocal();
- } else {
- pLocale = pDoc->GetLocalMgr()->GetLocaleByName(
- CFX_WideString::FromUTF8(szLocalStr));
- }
+ CXFA_LocaleMgr* pMgr = pDoc->GetLocalMgr();
+ IFX_Locale* pLocale = LocaleFromString(pDoc, pMgr, szLocale);
if (!pLocale)
- return;
+ return CFX_ByteString();
- CFX_WideString strRet;
- pLocale->GetDatePattern(strStyle, strRet);
+ CFX_WideString strRet = pLocale->GetDatePattern(SubCategoryFromInt(iStyle));
if (!bStandard) {
- CFX_WideString wsSymbols;
- pLocale->GetDateTimeSymbols(wsSymbols);
- AlternateDateTimeSymbols(strRet, wsSymbols, g_sAltTable_Date);
+ AlternateDateTimeSymbols(strRet, pLocale->GetDateTimeSymbols(),
+ g_sAltTable_Date);
}
- strFormat = strRet.UTF8Encode();
+ return strRet.UTF8Encode();
}
// static
-void CXFA_FM2JSContext::GetLocalTimeFormat(CFXJSE_Value* pThis,
- int32_t iStyle,
- const CFX_ByteStringC& szLocalStr,
- CFX_ByteString& strFormat,
- bool bStandard) {
- FX_LOCALEDATETIMESUBCATEGORY strStyle;
- switch (iStyle) {
- case 1:
- strStyle = FX_LOCALEDATETIMESUBCATEGORY_Short;
- break;
- case 3:
- strStyle = FX_LOCALEDATETIMESUBCATEGORY_Long;
- break;
- case 4:
- strStyle = FX_LOCALEDATETIMESUBCATEGORY_Full;
- break;
- case 0:
- case 2:
- default:
- strStyle = FX_LOCALEDATETIMESUBCATEGORY_Medium;
- break;
- }
+CFX_ByteString CXFA_FM2JSContext::GetLocalTimeFormat(
+ CFXJSE_Value* pThis,
+ int32_t iStyle,
+ const CFX_ByteStringC& szLocale,
+ bool bStandard) {
CXFA_Document* pDoc = ToJSContext(pThis, nullptr)->GetDocument();
if (!pDoc)
- return;
-
- IFX_Locale* pLocale = nullptr;
- if (szLocalStr.IsEmpty()) {
- CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject());
- ASSERT(pThisNode);
+ return CFX_ByteString();
- CXFA_WidgetData widgetData(pThisNode);
- pLocale = widgetData.GetLocal();
- } else {
- pLocale = pDoc->GetLocalMgr()->GetLocaleByName(
- CFX_WideString::FromUTF8(szLocalStr));
- }
+ CXFA_LocaleMgr* pMgr = pDoc->GetLocalMgr();
+ IFX_Locale* pLocale = LocaleFromString(pDoc, pMgr, szLocale);
if (!pLocale)
- return;
+ return CFX_ByteString();
- CFX_WideString strRet;
- pLocale->GetTimePattern(strStyle, strRet);
+ CFX_WideString strRet = pLocale->GetTimePattern(SubCategoryFromInt(iStyle));
if (!bStandard) {
- CFX_WideString wsSymbols;
- pLocale->GetDateTimeSymbols(wsSymbols);
- AlternateDateTimeSymbols(strRet, wsSymbols, g_sAltTable_Time);
+ AlternateDateTimeSymbols(strRet, pLocale->GetDateTimeSymbols(),
+ g_sAltTable_Time);
}
- strFormat = strRet.UTF8Encode();
+ return strRet.UTF8Encode();
}
// static
-void CXFA_FM2JSContext::GetStandardDateFormat(CFXJSE_Value* pThis,
- int32_t iStyle,
- const CFX_ByteStringC& szLocalStr,
- CFX_ByteString& strFormat) {
- GetLocalDateFormat(pThis, iStyle, szLocalStr, strFormat, true);
+CFX_ByteString CXFA_FM2JSContext::GetStandardDateFormat(
+ CFXJSE_Value* pThis,
+ int32_t iStyle,
+ const CFX_ByteStringC& szLocalStr) {
+ return GetLocalDateFormat(pThis, iStyle, szLocalStr, true);
}
// static
-void CXFA_FM2JSContext::GetStandardTimeFormat(CFXJSE_Value* pThis,
- int32_t iStyle,
- const CFX_ByteStringC& szLocalStr,
- CFX_ByteString& strFormat) {
- GetLocalTimeFormat(pThis, iStyle, szLocalStr, strFormat, true);
+CFX_ByteString CXFA_FM2JSContext::GetStandardTimeFormat(
+ CFXJSE_Value* pThis,
+ int32_t iStyle,
+ const CFX_ByteStringC& szLocalStr) {
+ return GetLocalTimeFormat(pThis, iStyle, szLocalStr, true);
}
// static
-void CXFA_FM2JSContext::Num2AllTime(CFXJSE_Value* pThis,
- int32_t iTime,
- const CFX_ByteStringC& szFormat,
- const CFX_ByteStringC& szLocale,
- bool bGM,
- CFX_ByteString& strTime) {
+CFX_ByteString CXFA_FM2JSContext::Num2AllTime(CFXJSE_Value* pThis,
+ int32_t iTime,
+ const CFX_ByteStringC& szFormat,
+ const CFX_ByteStringC& szLocale,
+ bool bGM) {
int32_t iHour = 0;
int32_t iMin = 0;
int32_t iSec = 0;
@@ -2307,18 +2147,9 @@ void CXFA_FM2JSContext::Num2AllTime(CFXJSE_Value* pThis,
iSec += iZoneSec;
}
- bool iRet = false;
CFX_ByteString strIsoTime;
strIsoTime.Format("%02d:%02d:%02d", iHour, iMin, iSec);
- if (bGM) {
- iRet =
- GetGMTTime(pThis, strIsoTime.AsStringC(), szFormat, szLocale, strTime);
- } else {
- iRet = IsoTime2Local(pThis, strIsoTime.AsStringC(), szFormat, szLocale,
- strTime);
- }
- if (!iRet)
- strTime = "";
+ return IsoTime2Local(pThis, strIsoTime.AsStringC(), szFormat, szLocale);
}
// static
@@ -2354,23 +2185,22 @@ void CXFA_FM2JSContext::Apr(CFXJSE_Value* pThis,
return;
}
- FX_DOUBLE nPrincipal = ValueToDouble(pThis, argOne.get());
- FX_DOUBLE nPayment = ValueToDouble(pThis, argTwo.get());
- FX_DOUBLE nPeriods = ValueToDouble(pThis, argThree.get());
+ double nPrincipal = ValueToDouble(pThis, argOne.get());
+ double nPayment = ValueToDouble(pThis, argTwo.get());
+ double nPeriods = ValueToDouble(pThis, argThree.get());
if (nPrincipal <= 0 || nPayment <= 0 || nPeriods <= 0) {
pContext->ThrowArgumentMismatchException();
return;
}
- FX_DOUBLE r =
- 2 * (nPeriods * nPayment - nPrincipal) / (nPeriods * nPrincipal);
- FX_DOUBLE nTemp = 1;
+ double r = 2 * (nPeriods * nPayment - nPrincipal) / (nPeriods * nPrincipal);
+ double nTemp = 1;
for (int32_t i = 0; i < nPeriods; ++i)
nTemp *= (1 + r);
- FX_DOUBLE nRet = r * nTemp / (nTemp - 1) - nPayment / nPrincipal;
+ double nRet = r * nTemp / (nTemp - 1) - nPayment / nPrincipal;
while (fabs(nRet) > kFinancialPrecision) {
- FX_DOUBLE nDerivative =
+ double nDerivative =
((nTemp + r * nPeriods * (nTemp / (1 + r))) * (nTemp - 1) -
(r * nTemp * nPeriods * (nTemp / (1 + r)))) /
((nTemp - 1) * (nTemp - 1));
@@ -2408,17 +2238,16 @@ void CXFA_FM2JSContext::CTerm(CFXJSE_Value* pThis,
return;
}
- FX_FLOAT nRate = ValueToFloat(pThis, argOne.get());
- FX_FLOAT nFutureValue = ValueToFloat(pThis, argTwo.get());
- FX_FLOAT nInitAmount = ValueToFloat(pThis, argThree.get());
+ float nRate = ValueToFloat(pThis, argOne.get());
+ float nFutureValue = ValueToFloat(pThis, argTwo.get());
+ float nInitAmount = ValueToFloat(pThis, argThree.get());
if ((nRate <= 0) || (nFutureValue <= 0) || (nInitAmount <= 0)) {
pContext->ThrowArgumentMismatchException();
return;
}
- args.GetReturnValue()->SetFloat(
- FXSYS_log((FX_FLOAT)(nFutureValue / nInitAmount)) /
- FXSYS_log((FX_FLOAT)(1 + nRate)));
+ args.GetReturnValue()->SetFloat(log((float)(nFutureValue / nInitAmount)) /
+ log((float)(1 + nRate)));
}
// static
@@ -2440,17 +2269,17 @@ void CXFA_FM2JSContext::FV(CFXJSE_Value* pThis,
return;
}
- FX_DOUBLE nAmount = ValueToDouble(pThis, argOne.get());
- FX_DOUBLE nRate = ValueToDouble(pThis, argTwo.get());
- FX_DOUBLE nPeriod = ValueToDouble(pThis, argThree.get());
+ double nAmount = ValueToDouble(pThis, argOne.get());
+ double nRate = ValueToDouble(pThis, argTwo.get());
+ double nPeriod = ValueToDouble(pThis, argThree.get());
if ((nRate < 0) || (nPeriod <= 0) || (nAmount <= 0)) {
pContext->ThrowArgumentMismatchException();
return;
}
- FX_DOUBLE dResult = 0;
+ double dResult = 0;
if (nRate) {
- FX_DOUBLE nTemp = 1;
+ double nTemp = 1;
for (int i = 0; i < nPeriod; ++i) {
nTemp *= 1 + nRate;
}
@@ -2484,22 +2313,22 @@ void CXFA_FM2JSContext::IPmt(CFXJSE_Value* pThis,
return;
}
- FX_FLOAT nPrincipalAmount = ValueToFloat(pThis, argOne.get());
- FX_FLOAT nRate = ValueToFloat(pThis, argTwo.get());
- FX_FLOAT nPayment = ValueToFloat(pThis, argThree.get());
- FX_FLOAT nFirstMonth = ValueToFloat(pThis, argFour.get());
- FX_FLOAT nNumberOfMonths = ValueToFloat(pThis, argFive.get());
+ float nPrincipalAmount = ValueToFloat(pThis, argOne.get());
+ float nRate = ValueToFloat(pThis, argTwo.get());
+ float nPayment = ValueToFloat(pThis, argThree.get());
+ float nFirstMonth = ValueToFloat(pThis, argFour.get());
+ float nNumberOfMonths = ValueToFloat(pThis, argFive.get());
if ((nPrincipalAmount <= 0) || (nRate <= 0) || (nPayment <= 0) ||
(nFirstMonth < 0) || (nNumberOfMonths < 0)) {
pContext->ThrowArgumentMismatchException();
return;
}
- FX_FLOAT nRateOfMonth = nRate / 12;
- int32_t iNums = (int32_t)(
- (FXSYS_log10((FX_FLOAT)(nPayment / nPrincipalAmount)) -
- FXSYS_log10((FX_FLOAT)(nPayment / nPrincipalAmount - nRateOfMonth))) /
- FXSYS_log10((FX_FLOAT)(1 + nRateOfMonth)));
+ float nRateOfMonth = nRate / 12;
+ int32_t iNums =
+ (int32_t)((log10((float)(nPayment / nPrincipalAmount)) -
+ log10((float)(nPayment / nPrincipalAmount - nRateOfMonth))) /
+ log10((float)(1 + nRateOfMonth)));
int32_t iEnd = std::min((int32_t)(nFirstMonth + nNumberOfMonths - 1), iNums);
if (nPayment < nPrincipalAmount * nRateOfMonth) {
@@ -2511,7 +2340,7 @@ void CXFA_FM2JSContext::IPmt(CFXJSE_Value* pThis,
for (i = 0; i < nFirstMonth - 1; ++i)
nPrincipalAmount -= nPayment - nPrincipalAmount * nRateOfMonth;
- FX_FLOAT nSum = 0;
+ float nSum = 0;
for (; i < iEnd; ++i) {
nSum += nPrincipalAmount * nRateOfMonth;
nPrincipalAmount -= nPayment - nPrincipalAmount * nRateOfMonth;
@@ -2539,24 +2368,24 @@ void CXFA_FM2JSContext::NPV(CFXJSE_Value* pThis,
}
}
- FX_DOUBLE nRate = ValueToDouble(pThis, argValues[0].get());
+ double nRate = ValueToDouble(pThis, argValues[0].get());
if (nRate <= 0) {
pContext->ThrowArgumentMismatchException();
return;
}
- std::vector<FX_DOUBLE> data(argc - 1);
+ std::vector<double> data(argc - 1);
for (int32_t i = 1; i < argc; i++)
data.push_back(ValueToDouble(pThis, argValues[i].get()));
- FX_DOUBLE nSum = 0;
+ double nSum = 0;
int32_t iIndex = 0;
for (int32_t i = 0; i < argc - 1; i++) {
- FX_DOUBLE nTemp = 1;
+ double nTemp = 1;
for (int32_t j = 0; j <= i; j++)
nTemp *= 1 + nRate;
- FX_DOUBLE nNum = data[iIndex++];
+ double nNum = data[iIndex++];
nSum += nNum / nTemp;
}
args.GetReturnValue()->SetDouble(nSum);
@@ -2581,16 +2410,16 @@ void CXFA_FM2JSContext::Pmt(CFXJSE_Value* pThis,
return;
}
- FX_FLOAT nPrincipal = ValueToFloat(pThis, argOne.get());
- FX_FLOAT nRate = ValueToFloat(pThis, argTwo.get());
- FX_FLOAT nPeriods = ValueToFloat(pThis, argThree.get());
+ float nPrincipal = ValueToFloat(pThis, argOne.get());
+ float nRate = ValueToFloat(pThis, argTwo.get());
+ float nPeriods = ValueToFloat(pThis, argThree.get());
if ((nPrincipal <= 0) || (nRate <= 0) || (nPeriods <= 0)) {
pContext->ThrowArgumentMismatchException();
return;
}
- FX_FLOAT nTmp = 1 + nRate;
- FX_FLOAT nSum = nTmp;
+ float nTmp = 1 + nRate;
+ float nSum = nTmp;
for (int32_t i = 0; i < nPeriods - 1; ++i)
nSum *= nTmp;
@@ -2619,22 +2448,22 @@ void CXFA_FM2JSContext::PPmt(CFXJSE_Value* pThis,
return;
}
- FX_FLOAT nPrincipalAmount = ValueToFloat(pThis, argOne.get());
- FX_FLOAT nRate = ValueToFloat(pThis, argTwo.get());
- FX_FLOAT nPayment = ValueToFloat(pThis, argThree.get());
- FX_FLOAT nFirstMonth = ValueToFloat(pThis, argFour.get());
- FX_FLOAT nNumberOfMonths = ValueToFloat(pThis, argFive.get());
+ float nPrincipalAmount = ValueToFloat(pThis, argOne.get());
+ float nRate = ValueToFloat(pThis, argTwo.get());
+ float nPayment = ValueToFloat(pThis, argThree.get());
+ float nFirstMonth = ValueToFloat(pThis, argFour.get());
+ float nNumberOfMonths = ValueToFloat(pThis, argFive.get());
if ((nPrincipalAmount <= 0) || (nRate <= 0) || (nPayment <= 0) ||
(nFirstMonth < 0) || (nNumberOfMonths < 0)) {
pContext->ThrowArgumentMismatchException();
return;
}
- FX_FLOAT nRateOfMonth = nRate / 12;
- int32_t iNums = (int32_t)(
- (FXSYS_log10((FX_FLOAT)(nPayment / nPrincipalAmount)) -
- FXSYS_log10((FX_FLOAT)(nPayment / nPrincipalAmount - nRateOfMonth))) /
- FXSYS_log10((FX_FLOAT)(1 + nRateOfMonth)));
+ float nRateOfMonth = nRate / 12;
+ int32_t iNums =
+ (int32_t)((log10((float)(nPayment / nPrincipalAmount)) -
+ log10((float)(nPayment / nPrincipalAmount - nRateOfMonth))) /
+ log10((float)(1 + nRateOfMonth)));
int32_t iEnd = std::min((int32_t)(nFirstMonth + nNumberOfMonths - 1), iNums);
if (nPayment < nPrincipalAmount * nRateOfMonth) {
pContext->ThrowArgumentMismatchException();
@@ -2645,8 +2474,8 @@ void CXFA_FM2JSContext::PPmt(CFXJSE_Value* pThis,
for (i = 0; i < nFirstMonth - 1; ++i)
nPrincipalAmount -= nPayment - nPrincipalAmount * nRateOfMonth;
- FX_FLOAT nTemp = 0;
- FX_FLOAT nSum = 0;
+ float nTemp = 0;
+ float nSum = 0;
for (; i < iEnd; ++i) {
nTemp = nPayment - nPrincipalAmount * nRateOfMonth;
nSum += nTemp;
@@ -2674,15 +2503,15 @@ void CXFA_FM2JSContext::PV(CFXJSE_Value* pThis,
return;
}
- FX_DOUBLE nAmount = ValueToDouble(pThis, argOne.get());
- FX_DOUBLE nRate = ValueToDouble(pThis, argTwo.get());
- FX_DOUBLE nPeriod = ValueToDouble(pThis, argThree.get());
+ double nAmount = ValueToDouble(pThis, argOne.get());
+ double nRate = ValueToDouble(pThis, argTwo.get());
+ double nPeriod = ValueToDouble(pThis, argThree.get());
if ((nAmount <= 0) || (nRate < 0) || (nPeriod <= 0)) {
pContext->ThrowArgumentMismatchException();
return;
}
- FX_DOUBLE nTemp = 1;
+ double nTemp = 1;
for (int32_t i = 0; i < nPeriod; ++i)
nTemp *= 1 + nRate;
@@ -2709,17 +2538,16 @@ void CXFA_FM2JSContext::Rate(CFXJSE_Value* pThis,
return;
}
- FX_FLOAT nFuture = ValueToFloat(pThis, argOne.get());
- FX_FLOAT nPresent = ValueToFloat(pThis, argTwo.get());
- FX_FLOAT nTotalNumber = ValueToFloat(pThis, argThree.get());
+ float nFuture = ValueToFloat(pThis, argOne.get());
+ float nPresent = ValueToFloat(pThis, argTwo.get());
+ float nTotalNumber = ValueToFloat(pThis, argThree.get());
if ((nFuture <= 0) || (nPresent < 0) || (nTotalNumber <= 0)) {
pContext->ThrowArgumentMismatchException();
return;
}
args.GetReturnValue()->SetFloat(
- FXSYS_pow((FX_FLOAT)(nFuture / nPresent), (FX_FLOAT)(1 / nTotalNumber)) -
- 1);
+ FXSYS_pow((float)(nFuture / nPresent), (float)(1 / nTotalNumber)) - 1);
}
// static
@@ -2741,17 +2569,16 @@ void CXFA_FM2JSContext::Term(CFXJSE_Value* pThis,
return;
}
- FX_FLOAT nMount = ValueToFloat(pThis, argOne.get());
- FX_FLOAT nRate = ValueToFloat(pThis, argTwo.get());
- FX_FLOAT nFuture = ValueToFloat(pThis, argThree.get());
+ float nMount = ValueToFloat(pThis, argOne.get());
+ float nRate = ValueToFloat(pThis, argTwo.get());
+ float nFuture = ValueToFloat(pThis, argThree.get());
if ((nMount <= 0) || (nRate <= 0) || (nFuture <= 0)) {
pContext->ThrowArgumentMismatchException();
return;
}
- args.GetReturnValue()->SetFloat(
- FXSYS_log((FX_FLOAT)(nFuture / nMount * nRate) + 1) /
- FXSYS_log((FX_FLOAT)(1 + nRate)));
+ args.GetReturnValue()->SetFloat(log((float)(nFuture / nMount * nRate) + 1) /
+ log((float)(1 + nRate)));
}
// static
@@ -2805,17 +2632,15 @@ void CXFA_FM2JSContext::Choose(CFXJSE_Value* pThis,
jsObjectValue->GetObjectProperty(
propertyValue->ToString().AsStringC(), newPropertyValue.get());
}
- CFX_ByteString bsChoosed;
- ValueToUTF8String(newPropertyValue.get(), bsChoosed);
- args.GetReturnValue()->SetString(bsChoosed.AsStringC());
+ CFX_ByteString bsChosen = ValueToUTF8String(newPropertyValue.get());
+ args.GetReturnValue()->SetString(bsChosen.AsStringC());
bFound = true;
}
} else {
iValueIndex++;
if (iValueIndex == iIndex) {
- CFX_ByteString bsChoosed;
- ValueToUTF8String(argIndexValue.get(), bsChoosed);
- args.GetReturnValue()->SetString(bsChoosed.AsStringC());
+ CFX_ByteString bsChosen = ValueToUTF8String(argIndexValue.get());
+ args.GetReturnValue()->SetString(bsChosen.AsStringC());
bFound = true;
}
}
@@ -2898,20 +2723,17 @@ void CXFA_FM2JSContext::Within(CFXJSE_Value* pThis,
std::unique_ptr<CFXJSE_Value> argLow = GetSimpleValue(pThis, args, 1);
std::unique_ptr<CFXJSE_Value> argHigh = GetSimpleValue(pThis, args, 2);
if (argOne->IsNumber()) {
- FX_FLOAT oneNumber = ValueToFloat(pThis, argOne.get());
- FX_FLOAT lowNumber = ValueToFloat(pThis, argLow.get());
- FX_FLOAT heightNumber = ValueToFloat(pThis, argHigh.get());
+ float oneNumber = ValueToFloat(pThis, argOne.get());
+ float lowNumber = ValueToFloat(pThis, argLow.get());
+ float heightNumber = ValueToFloat(pThis, argHigh.get());
args.GetReturnValue()->SetInteger((oneNumber >= lowNumber) &&
(oneNumber <= heightNumber));
return;
}
- CFX_ByteString oneString;
- CFX_ByteString lowString;
- CFX_ByteString heightString;
- ValueToUTF8String(argOne.get(), oneString);
- ValueToUTF8String(argLow.get(), lowString);
- ValueToUTF8String(argHigh.get(), heightString);
+ CFX_ByteString oneString = ValueToUTF8String(argOne.get());
+ CFX_ByteString lowString = ValueToUTF8String(argLow.get());
+ CFX_ByteString heightString = ValueToUTF8String(argHigh.get());
args.GetReturnValue()->SetInteger(
(oneString.Compare(lowString.AsStringC()) >= 0) &&
(oneString.Compare(heightString.AsStringC()) <= 0));
@@ -2943,8 +2765,7 @@ void CXFA_FM2JSContext::Eval(CFXJSE_Value* pThis,
v8::Isolate* pIsolate = pContext->GetScriptRuntime();
std::unique_ptr<CFXJSE_Value> scriptValue = GetSimpleValue(pThis, args, 0);
- CFX_ByteString utf8ScriptString;
- ValueToUTF8String(scriptValue.get(), utf8ScriptString);
+ CFX_ByteString utf8ScriptString = ValueToUTF8String(scriptValue.get());
if (utf8ScriptString.IsEmpty()) {
args.GetReturnValue()->SetNull();
return;
@@ -3038,8 +2859,7 @@ void CXFA_FM2JSContext::UnitType(CFXJSE_Value* pThis,
return;
}
- CFX_ByteString unitspanString;
- ValueToUTF8String(unitspanValue.get(), unitspanString);
+ CFX_ByteString unitspanString = ValueToUTF8String(unitspanValue.get());
if (unitspanString.IsEmpty()) {
args.GetReturnValue()->SetString("in");
return;
@@ -3059,14 +2879,14 @@ void CXFA_FM2JSContext::UnitType(CFXJSE_Value* pThis,
unitspanString.MakeLower();
CFX_WideString wsTypeString =
CFX_WideString::FromUTF8(unitspanString.AsStringC());
- const FX_WCHAR* pData = wsTypeString.c_str();
+ const wchar_t* pData = wsTypeString.c_str();
int32_t u = 0;
int32_t uLen = wsTypeString.GetLength();
while (IsWhitespace(pData[u]))
u++;
XFA_FM2JS_VALUETYPE_ParserStatus eParserStatus = VALUETYPE_START;
- FX_WCHAR typeChar;
+ wchar_t typeChar;
// TODO(dsinclair): Cleanup this parser, figure out what the various checks
// are for.
while (u < uLen) {
@@ -3086,7 +2906,7 @@ void CXFA_FM2JSContext::UnitType(CFXJSE_Value* pThis,
}
eParserStatus = VALUETYPE_HAVEDIGIT;
} else if ((typeChar == 'c' || typeChar == 'p') && (u + 1 < uLen)) {
- FX_WCHAR nextChar = pData[u + 1];
+ wchar_t nextChar = pData[u + 1];
if ((eParserStatus == VALUETYPE_START ||
eParserStatus == VALUETYPE_HAVEDIGIT ||
eParserStatus == VALUETYPE_HAVEDIGITWHITE) &&
@@ -3097,7 +2917,7 @@ void CXFA_FM2JSContext::UnitType(CFXJSE_Value* pThis,
}
eParserStatus = VALUETYPE_HAVEINVALIDCHAR;
} else if (typeChar == 'm' && (u + 1 < uLen)) {
- FX_WCHAR nextChar = pData[u + 1];
+ wchar_t nextChar = pData[u + 1];
if ((eParserStatus == VALUETYPE_START ||
eParserStatus == VALUETYPE_HAVEDIGIT ||
eParserStatus == VALUETYPE_HAVEDIGITWHITE) &&
@@ -3151,9 +2971,8 @@ void CXFA_FM2JSContext::UnitValue(CFXJSE_Value* pThis,
return;
}
- CFX_ByteString unitspanString;
- ValueToUTF8String(unitspanValue.get(), unitspanString);
- const FX_CHAR* pData = unitspanString.c_str();
+ CFX_ByteString unitspanString = ValueToUTF8String(unitspanValue.get());
+ const char* pData = unitspanString.c_str();
if (!pData) {
args.GetReturnValue()->SetInteger(0);
return;
@@ -3171,8 +2990,8 @@ void CXFA_FM2JSContext::UnitValue(CFXJSE_Value* pThis,
++u;
}
- FX_CHAR* pTemp = nullptr;
- FX_DOUBLE dFirstNumber = strtod(pData, &pTemp);
+ char* pTemp = nullptr;
+ double dFirstNumber = strtod(pData, &pTemp);
while (IsWhitespace(pData[u]))
++u;
@@ -3190,9 +3009,8 @@ void CXFA_FM2JSContext::UnitValue(CFXJSE_Value* pThis,
CFX_ByteString strUnit;
if (argc > 1) {
std::unique_ptr<CFXJSE_Value> unitValue = GetSimpleValue(pThis, args, 1);
- CFX_ByteString unitTempString;
- ValueToUTF8String(unitValue.get(), unitTempString);
- const FX_CHAR* pChar = unitTempString.c_str();
+ CFX_ByteString unitTempString = ValueToUTF8String(unitValue.get());
+ const char* pChar = unitTempString.c_str();
int32_t uVal = 0;
while (IsWhitespace(pChar[uVal]))
++uVal;
@@ -3219,7 +3037,7 @@ void CXFA_FM2JSContext::UnitValue(CFXJSE_Value* pThis,
strUnit = strFirstUnit;
}
- FX_DOUBLE dResult = 0;
+ double dResult = 0;
if (strFirstUnit == "in" || strFirstUnit == "inches") {
if (strUnit == "mm" || strUnit == "millimeters")
dResult = dFirstNumber * 25.4;
@@ -3295,15 +3113,13 @@ void CXFA_FM2JSContext::At(CFXJSE_Value* pThis,
return;
}
- CFX_ByteString stringTwo;
- ValueToUTF8String(argTwo.get(), stringTwo);
+ CFX_ByteString stringTwo = ValueToUTF8String(argTwo.get());
if (stringTwo.IsEmpty()) {
args.GetReturnValue()->SetInteger(1);
return;
}
- CFX_ByteString stringOne;
- ValueToUTF8String(argOne.get(), stringOne);
+ CFX_ByteString stringOne = ValueToUTF8String(argOne.get());
FX_STRSIZE iPosition = stringOne.Find(stringTwo.AsStringC());
args.GetReturnValue()->SetInteger(iPosition + 1);
}
@@ -3326,10 +3142,7 @@ void CXFA_FM2JSContext::Concat(CFXJSE_Value* pThis,
continue;
bAllNull = false;
-
- CFX_ByteString valueStr;
- ValueToUTF8String(value.get(), valueStr);
- resultString += valueStr;
+ resultString += ValueToUTF8String(value.get());
}
if (bAllNull) {
@@ -3357,8 +3170,7 @@ void CXFA_FM2JSContext::Decode(CFXJSE_Value* pThis,
return;
}
- CFX_ByteString toDecodeString;
- ValueToUTF8String(argOne.get(), toDecodeString);
+ CFX_ByteString toDecodeString = ValueToUTF8String(argOne.get());
CFX_ByteTextBuf resultBuf;
DecodeURL(toDecodeString.AsStringC(), resultBuf);
args.GetReturnValue()->SetString(resultBuf.AsStringC());
@@ -3372,12 +3184,8 @@ void CXFA_FM2JSContext::Decode(CFXJSE_Value* pThis,
return;
}
- CFX_ByteString toDecodeString;
- ValueToUTF8String(argOne.get(), toDecodeString);
-
- CFX_ByteString identifyString;
- ValueToUTF8String(argTwo.get(), identifyString);
-
+ CFX_ByteString toDecodeString = ValueToUTF8String(argOne.get());
+ CFX_ByteString identifyString = ValueToUTF8String(argTwo.get());
CFX_ByteTextBuf resultBuf;
if (identifyString.EqualNoCase("html"))
DecodeHTML(toDecodeString.AsStringC(), resultBuf);
@@ -3393,18 +3201,18 @@ void CXFA_FM2JSContext::Decode(CFXJSE_Value* pThis,
void CXFA_FM2JSContext::DecodeURL(const CFX_ByteStringC& szURLString,
CFX_ByteTextBuf& szResultString) {
CFX_WideString wsURLString = CFX_WideString::FromUTF8(szURLString);
- const FX_WCHAR* pData = wsURLString.c_str();
+ const wchar_t* pData = wsURLString.c_str();
int32_t i = 0;
CFX_WideTextBuf wsResultBuf;
while (i < wsURLString.GetLength()) {
- FX_WCHAR ch = pData[i];
+ wchar_t ch = pData[i];
if ('%' != ch) {
wsResultBuf.AppendChar(ch);
++i;
continue;
}
- FX_WCHAR chTemp = 0;
+ wchar_t chTemp = 0;
int32_t iCount = 0;
while (iCount < 2) {
++i;
@@ -3434,15 +3242,15 @@ void CXFA_FM2JSContext::DecodeURL(const CFX_ByteStringC& szURLString,
void CXFA_FM2JSContext::DecodeHTML(const CFX_ByteStringC& szHTMLString,
CFX_ByteTextBuf& szResultString) {
CFX_WideString wsHTMLString = CFX_WideString::FromUTF8(szHTMLString);
- FX_WCHAR strString[9];
+ wchar_t strString[9];
int32_t iStrIndex = 0;
int32_t iLen = wsHTMLString.GetLength();
int32_t i = 0;
int32_t iCode = 0;
- const FX_WCHAR* pData = wsHTMLString.c_str();
+ const wchar_t* pData = wsHTMLString.c_str();
CFX_WideTextBuf wsResultBuf;
while (i < iLen) {
- FX_WCHAR ch = pData[i];
+ wchar_t ch = pData[i];
if (ch != '&') {
wsResultBuf.AppendChar(ch);
++i;
@@ -3492,7 +3300,7 @@ void CXFA_FM2JSContext::DecodeHTML(const CFX_ByteStringC& szHTMLString,
}
uint32_t iData = 0;
if (HTMLSTR2Code(strString, iData)) {
- wsResultBuf.AppendChar((FX_WCHAR)iData);
+ wsResultBuf.AppendChar((wchar_t)iData);
} else {
wsResultBuf.AppendChar(iCode);
}
@@ -3510,13 +3318,13 @@ void CXFA_FM2JSContext::DecodeHTML(const CFX_ByteStringC& szHTMLString,
void CXFA_FM2JSContext::DecodeXML(const CFX_ByteStringC& szXMLString,
CFX_ByteTextBuf& szResultString) {
CFX_WideString wsXMLString = CFX_WideString::FromUTF8(szXMLString);
- FX_WCHAR strString[9];
+ wchar_t strString[9];
int32_t iStrIndex = 0;
int32_t iLen = wsXMLString.GetLength();
int32_t i = 0;
int32_t iCode = 0;
- FX_WCHAR ch = 0;
- const FX_WCHAR* pData = wsXMLString.c_str();
+ wchar_t ch = 0;
+ const wchar_t* pData = wsXMLString.c_str();
CFX_WideTextBuf wsXMLBuf;
while (i < iLen) {
ch = pData[i];
@@ -3568,11 +3376,11 @@ void CXFA_FM2JSContext::DecodeXML(const CFX_ByteStringC& szXMLString,
strString[iStrIndex] = 0;
}
- const FX_WCHAR* const strName[] = {L"quot", L"amp", L"apos", L"lt", L"gt"};
+ const wchar_t* const strName[] = {L"quot", L"amp", L"apos", L"lt", L"gt"};
int32_t iIndex = 0;
while (iIndex < 5) {
- if (FXSYS_memcmp(strString, strName[iIndex],
- FXSYS_wcslen(strName[iIndex])) == 0) {
+ if (memcmp(strString, strName[iIndex], FXSYS_wcslen(strName[iIndex])) ==
+ 0) {
break;
}
++iIndex;
@@ -3624,8 +3432,7 @@ void CXFA_FM2JSContext::Encode(CFXJSE_Value* pThis,
return;
}
- CFX_ByteString toEncodeString;
- ValueToUTF8String(argOne.get(), toEncodeString);
+ CFX_ByteString toEncodeString = ValueToUTF8String(argOne.get());
CFX_ByteTextBuf resultBuf;
EncodeURL(toEncodeString.AsStringC(), resultBuf);
args.GetReturnValue()->SetString(resultBuf.AsStringC());
@@ -3639,10 +3446,8 @@ void CXFA_FM2JSContext::Encode(CFXJSE_Value* pThis,
return;
}
- CFX_ByteString toEncodeString;
- ValueToUTF8String(argOne.get(), toEncodeString);
- CFX_ByteString identifyString;
- ValueToUTF8String(argTwo.get(), identifyString);
+ CFX_ByteString toEncodeString = ValueToUTF8String(argOne.get());
+ CFX_ByteString identifyString = ValueToUTF8String(argTwo.get());
CFX_ByteTextBuf resultBuf;
if (identifyString.EqualNoCase("html"))
EncodeHTML(toEncodeString.AsStringC(), resultBuf);
@@ -3659,16 +3464,16 @@ void CXFA_FM2JSContext::EncodeURL(const CFX_ByteStringC& szURLString,
CFX_ByteTextBuf& szResultBuf) {
CFX_WideString wsURLString = CFX_WideString::FromUTF8(szURLString);
CFX_WideTextBuf wsResultBuf;
- FX_WCHAR strEncode[4];
+ wchar_t strEncode[4];
strEncode[0] = '%';
strEncode[3] = 0;
- FX_WCHAR strUnsafe[] = {' ', '<', '>', '"', '#', '%', '{', '}',
- '|', '\\', '^', '~', '[', ']', '`'};
- FX_WCHAR strReserved[] = {';', '/', '?', ':', '@', '=', '&'};
- FX_WCHAR strSpecial[] = {'$', '-', '+', '!', '*', '\'', '(', ')', ','};
- const FX_WCHAR* strCode = L"0123456789abcdef";
+ wchar_t strUnsafe[] = {' ', '<', '>', '"', '#', '%', '{', '}',
+ '|', '\\', '^', '~', '[', ']', '`'};
+ wchar_t strReserved[] = {';', '/', '?', ':', '@', '=', '&'};
+ wchar_t strSpecial[] = {'$', '-', '+', '!', '*', '\'', '(', ')', ','};
+ const wchar_t* strCode = L"0123456789abcdef";
for (int32_t u = 0; u < wsURLString.GetLength(); ++u) {
- FX_WCHAR ch = wsURLString.GetAt(u);
+ wchar_t ch = wsURLString.GetAt(u);
int32_t i = 0;
int32_t iCount = FX_ArraySize(strUnsafe);
while (i < iCount) {
@@ -3719,10 +3524,10 @@ void CXFA_FM2JSContext::EncodeURL(const CFX_ByteStringC& szURLString,
} else if (ch >= 0x20 && ch <= 0x7e) {
wsResultBuf.AppendChar(ch);
} else {
- const FX_WCHAR iRadix = 16;
+ const wchar_t iRadix = 16;
CFX_WideString strTmp;
while (ch >= iRadix) {
- FX_WCHAR tmp = strCode[ch % iRadix];
+ wchar_t tmp = strCode[ch % iRadix];
ch /= iRadix;
strTmp += tmp;
}
@@ -3760,8 +3565,8 @@ void CXFA_FM2JSContext::EncodeHTML(const CFX_ByteStringC& szHTMLString,
CFX_ByteTextBuf& szResultBuf) {
CFX_ByteString str = szHTMLString.c_str();
CFX_WideString wsHTMLString = CFX_WideString::FromUTF8(str.AsStringC());
- const FX_WCHAR* strCode = L"0123456789abcdef";
- FX_WCHAR strEncode[9];
+ const wchar_t* strCode = L"0123456789abcdef";
+ wchar_t strEncode[9];
strEncode[0] = '&';
strEncode[1] = '#';
strEncode[2] = 'x';
@@ -3772,7 +3577,7 @@ void CXFA_FM2JSContext::EncodeHTML(const CFX_ByteStringC& szHTMLString,
CFX_WideTextBuf wsResultBuf;
int32_t iLen = wsHTMLString.GetLength();
int32_t i = 0;
- const FX_WCHAR* pData = wsHTMLString.c_str();
+ const wchar_t* pData = wsHTMLString.c_str();
while (i < iLen) {
uint32_t ch = pData[i];
CFX_WideString htmlReserve;
@@ -3781,7 +3586,7 @@ void CXFA_FM2JSContext::EncodeHTML(const CFX_ByteStringC& szHTMLString,
wsResultBuf << htmlReserve;
wsResultBuf.AppendChar(L';');
} else if (ch >= 32 && ch <= 126) {
- wsResultBuf.AppendChar((FX_WCHAR)ch);
+ wsResultBuf.AppendChar((wchar_t)ch);
} else if (ch < 256) {
int32_t iIndex = ch / 16;
strEncode[3] = strCode[iIndex];
@@ -3810,7 +3615,7 @@ void CXFA_FM2JSContext::EncodeXML(const CFX_ByteStringC& szXMLString,
CFX_ByteTextBuf& szResultBuf) {
CFX_WideString wsXMLString = CFX_WideString::FromUTF8(szXMLString);
CFX_WideTextBuf wsResultBuf;
- FX_WCHAR strEncode[9];
+ wchar_t strEncode[9];
strEncode[0] = '&';
strEncode[1] = '#';
strEncode[2] = 'x';
@@ -3818,10 +3623,10 @@ void CXFA_FM2JSContext::EncodeXML(const CFX_ByteStringC& szXMLString,
strEncode[6] = 0;
strEncode[7] = ';';
strEncode[8] = 0;
- const FX_WCHAR* strCode = L"0123456789abcdef";
- const FX_WCHAR* pData = wsXMLString.c_str();
+ const wchar_t* strCode = L"0123456789abcdef";
+ const wchar_t* pData = wsXMLString.c_str();
for (int32_t u = 0; u < wsXMLString.GetLength(); ++u) {
- FX_WCHAR ch = pData[u];
+ wchar_t ch = pData[u];
switch (ch) {
case '"':
wsResultBuf.AppendChar('&');
@@ -3930,12 +3735,10 @@ void CXFA_FM2JSContext::Format(CFXJSE_Value* pThis,
}
std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0);
- CFX_ByteString szPattern;
- ValueToUTF8String(argOne.get(), szPattern);
+ CFX_ByteString szPattern = ValueToUTF8String(argOne.get());
std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, args, 1);
- CFX_ByteString szValue;
- ValueToUTF8String(argTwo.get(), szValue);
+ CFX_ByteString szValue = ValueToUTF8String(argTwo.get());
CXFA_Document* pDoc = pContext->GetDocument();
CXFA_LocaleMgr* pMgr = pDoc->GetLocalMgr();
@@ -4014,8 +3817,7 @@ void CXFA_FM2JSContext::Left(CFXJSE_Value* pThis,
return;
}
- CFX_ByteString sourceString;
- ValueToUTF8String(argOne.get(), sourceString);
+ CFX_ByteString sourceString = ValueToUTF8String(argOne.get());
int32_t count = std::max(0, ValueToInteger(pThis, argTwo.get()));
args.GetReturnValue()->SetString(sourceString.Left(count).AsStringC());
}
@@ -4035,8 +3837,7 @@ void CXFA_FM2JSContext::Len(CFXJSE_Value* pThis,
return;
}
- CFX_ByteString sourceString;
- ValueToUTF8String(argOne.get(), sourceString);
+ CFX_ByteString sourceString = ValueToUTF8String(argOne.get());
args.GetReturnValue()->SetInteger(sourceString.GetLength());
}
@@ -4050,17 +3851,16 @@ void CXFA_FM2JSContext::Lower(CFXJSE_Value* pThis,
return;
}
- CFX_ByteString argString;
std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0);
if (ValueIsNull(pThis, argOne.get())) {
args.GetReturnValue()->SetNull();
return;
}
- ValueToUTF8String(argOne.get(), argString);
CFX_WideTextBuf lowStringBuf;
+ CFX_ByteString argString = ValueToUTF8String(argOne.get());
CFX_WideString wsArgString = CFX_WideString::FromUTF8(argString.AsStringC());
- const FX_WCHAR* pData = wsArgString.c_str();
+ const wchar_t* pData = wsArgString.c_str();
int32_t i = 0;
while (i < argString.GetLength()) {
int32_t ch = pData[i];
@@ -4093,8 +3893,7 @@ void CXFA_FM2JSContext::Ltrim(CFXJSE_Value* pThis,
return;
}
- CFX_ByteString sourceString;
- ValueToUTF8String(argOne.get(), sourceString);
+ CFX_ByteString sourceString = ValueToUTF8String(argOne.get());
sourceString.TrimLeft();
args.GetReturnValue()->SetString(sourceString.AsStringC());
}
@@ -4116,11 +3915,8 @@ void CXFA_FM2JSContext::Parse(CFXJSE_Value* pThis,
return;
}
- CFX_ByteString szPattern;
- ValueToUTF8String(argOne.get(), szPattern);
- CFX_ByteString szValue;
- ValueToUTF8String(argTwo.get(), szValue);
-
+ CFX_ByteString szPattern = ValueToUTF8String(argOne.get());
+ CFX_ByteString szValue = ValueToUTF8String(argTwo.get());
CXFA_Document* pDoc = pContext->GetDocument();
CXFA_LocaleMgr* pMgr = pDoc->GetLocalMgr();
CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject());
@@ -4245,14 +4041,14 @@ void CXFA_FM2JSContext::Replace(CFXJSE_Value* pThis,
CFX_ByteString oneString;
CFX_ByteString twoString;
if (!ValueIsNull(pThis, argOne.get()) && !ValueIsNull(pThis, argTwo.get())) {
- ValueToUTF8String(argOne.get(), oneString);
- ValueToUTF8String(argTwo.get(), twoString);
+ oneString = ValueToUTF8String(argOne.get());
+ twoString = ValueToUTF8String(argTwo.get());
}
CFX_ByteString threeString;
if (argc > 2) {
std::unique_ptr<CFXJSE_Value> argThree = GetSimpleValue(pThis, args, 2);
- ValueToUTF8String(argThree.get(), threeString);
+ threeString = ValueToUTF8String(argThree.get());
}
int32_t iFindLen = twoString.GetLength();
@@ -4306,8 +4102,7 @@ void CXFA_FM2JSContext::Right(CFXJSE_Value* pThis,
return;
}
- CFX_ByteString sourceString;
- ValueToUTF8String(argOne.get(), sourceString);
+ CFX_ByteString sourceString = ValueToUTF8String(argOne.get());
int32_t count = std::max(0, ValueToInteger(pThis, argTwo.get()));
args.GetReturnValue()->SetString(sourceString.Right(count).AsStringC());
}
@@ -4327,8 +4122,7 @@ void CXFA_FM2JSContext::Rtrim(CFXJSE_Value* pThis,
return;
}
- CFX_ByteString sourceString;
- ValueToUTF8String(argOne.get(), sourceString);
+ CFX_ByteString sourceString = ValueToUTF8String(argOne.get());
sourceString.TrimRight();
args.GetReturnValue()->SetString(sourceString.AsStringC());
}
@@ -4374,7 +4168,7 @@ void CXFA_FM2JSContext::Str(CFXJSE_Value* pThis,
args.GetReturnValue()->SetNull();
return;
}
- FX_FLOAT fNumber = ValueToFloat(pThis, numberValue.get());
+ float fNumber = ValueToFloat(pThis, numberValue.get());
int32_t iWidth = 10;
if (argc > 1) {
@@ -4399,7 +4193,7 @@ void CXFA_FM2JSContext::Str(CFXJSE_Value* pThis,
formatStr += "f";
numberString.Format(formatStr.c_str(), fNumber);
- const FX_CHAR* pData = numberString.c_str();
+ const char* pData = numberString.c_str();
int32_t iLength = numberString.GetLength();
int32_t u = 0;
while (u < iLength) {
@@ -4495,17 +4289,18 @@ void CXFA_FM2JSContext::Stuff(CFXJSE_Value* pThis,
std::unique_ptr<CFXJSE_Value> deleteValue = GetSimpleValue(pThis, args, 2);
if (!sourceValue->IsNull() && !startValue->IsNull() &&
!deleteValue->IsNull()) {
- ValueToUTF8String(sourceValue.get(), sourceString);
+ sourceString = ValueToUTF8String(sourceValue.get());
iLength = sourceString.GetLength();
- iStart = std::min(iLength, std::max(1, static_cast<int32_t>(ValueToFloat(
- pThis, startValue.get()))));
+ iStart = pdfium::clamp(
+ static_cast<int32_t>(ValueToFloat(pThis, startValue.get())), 1,
+ iLength);
iDelete = std::max(
0, static_cast<int32_t>(ValueToFloat(pThis, deleteValue.get())));
}
if (argc > 3) {
std::unique_ptr<CFXJSE_Value> insertValue = GetSimpleValue(pThis, args, 3);
- ValueToUTF8String(insertValue.get(), insertString);
+ insertString = ValueToUTF8String(insertValue.get());
}
iStart -= 1;
@@ -4544,19 +4339,17 @@ void CXFA_FM2JSContext::Substr(CFXJSE_Value* pThis,
return;
}
- CFX_ByteString szSourceStr;
int32_t iStart = 0;
int32_t iCount = 0;
- ValueToUTF8String(stringValue.get(), szSourceStr);
+ CFX_ByteString szSourceStr = ValueToUTF8String(stringValue.get());
int32_t iLength = szSourceStr.GetLength();
if (iLength == 0) {
args.GetReturnValue()->SetString("");
return;
}
- iStart = std::min(
- iLength,
- std::max(1, static_cast<int32_t>(ValueToFloat(pThis, startValue.get()))));
+ iStart = pdfium::clamp(
+ iLength, 1, static_cast<int32_t>(ValueToFloat(pThis, startValue.get())));
iCount =
std::max(0, static_cast<int32_t>(ValueToFloat(pThis, endValue.get())));
@@ -4582,8 +4375,7 @@ void CXFA_FM2JSContext::Uuid(CFXJSE_Value* pThis,
FX_GUID guid;
FX_GUID_CreateV4(&guid);
- CFX_ByteString bsUId;
- FX_GUID_ToString(&guid, bsUId, !!iNum);
+ CFX_ByteString bsUId = FX_GUID_ToString(&guid, !!iNum);
args.GetReturnValue()->SetString(bsUId.AsStringC());
}
@@ -4603,12 +4395,10 @@ void CXFA_FM2JSContext::Upper(CFXJSE_Value* pThis,
return;
}
- CFX_ByteString argString;
- ValueToUTF8String(argOne.get(), argString);
-
CFX_WideTextBuf upperStringBuf;
+ CFX_ByteString argString = ValueToUTF8String(argOne.get());
CFX_WideString wsArgString = CFX_WideString::FromUTF8(argString.AsStringC());
- const FX_WCHAR* pData = wsArgString.c_str();
+ const wchar_t* pData = wsArgString.c_str();
int32_t i = 0;
while (i < wsArgString.GetLength()) {
int32_t ch = pData[i];
@@ -4641,7 +4431,7 @@ void CXFA_FM2JSContext::WordNum(CFXJSE_Value* pThis,
args.GetReturnValue()->SetNull();
return;
}
- FX_FLOAT fNumber = ValueToFloat(pThis, numberValue.get());
+ float fNumber = ValueToFloat(pThis, numberValue.get());
int32_t iIdentifier = 0;
if (argc > 1) {
@@ -4662,7 +4452,7 @@ void CXFA_FM2JSContext::WordNum(CFXJSE_Value* pThis,
args.GetReturnValue()->SetNull();
return;
}
- ValueToUTF8String(localeValue.get(), localeString);
+ localeString = ValueToUTF8String(localeValue.get());
}
if (fNumber < 0.0f || fNumber > 922337203685477550.0f) {
@@ -4692,7 +4482,7 @@ void CXFA_FM2JSContext::TrillionUS(const CFX_ByteStringC& szData,
"Sixty", "Seventy", "Eighty", "Ninety"};
CFX_ByteStringC pComm[] = {" Hundred ", " Thousand ", " Million ",
" Billion ", "Trillion"};
- const FX_CHAR* pData = szData.c_str();
+ const char* pData = szData.c_str();
int32_t iLength = szData.GetLength();
int32_t iComm = 0;
if (iLength > 12)
@@ -4781,7 +4571,7 @@ void CXFA_FM2JSContext::TrillionUS(const CFX_ByteStringC& szData,
void CXFA_FM2JSContext::WordUS(const CFX_ByteStringC& szData,
int32_t iStyle,
CFX_ByteTextBuf& strBuf) {
- const FX_CHAR* pData = szData.c_str();
+ const char* pData = szData.c_str();
int32_t iLength = szData.GetLength();
if (iStyle < 0 || iStyle > 2) {
return;
@@ -4845,8 +4635,7 @@ void CXFA_FM2JSContext::Get(CFXJSE_Value* pThis,
return;
std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0);
- CFX_ByteString urlString;
- ValueToUTF8String(argOne.get(), urlString);
+ CFX_ByteString urlString = ValueToUTF8String(argOne.get());
CFX_RetainPtr<IFX_SeekableReadStream> pFile = pAppProvider->DownloadURL(
CFX_WideString::FromUTF8(urlString.AsStringC()));
if (!pFile)
@@ -4877,30 +4666,28 @@ void CXFA_FM2JSContext::Post(CFXJSE_Value* pThis,
if (!pAppProvider)
return;
- CFX_ByteString bsURL;
std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0);
- ValueToUTF8String(argOne.get(), bsURL);
+ CFX_ByteString bsURL = ValueToUTF8String(argOne.get());
- CFX_ByteString bsData;
std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, args, 1);
- ValueToUTF8String(argTwo.get(), bsData);
+ CFX_ByteString bsData = ValueToUTF8String(argTwo.get());
CFX_ByteString bsContentType;
if (argc > 2) {
std::unique_ptr<CFXJSE_Value> argThree = GetSimpleValue(pThis, args, 2);
- ValueToUTF8String(argThree.get(), bsContentType);
+ bsContentType = ValueToUTF8String(argThree.get());
}
CFX_ByteString bsEncode;
if (argc > 3) {
std::unique_ptr<CFXJSE_Value> argFour = GetSimpleValue(pThis, args, 3);
- ValueToUTF8String(argFour.get(), bsEncode);
+ bsEncode = ValueToUTF8String(argFour.get());
}
CFX_ByteString bsHeader;
if (argc > 4) {
std::unique_ptr<CFXJSE_Value> argFive = GetSimpleValue(pThis, args, 4);
- ValueToUTF8String(argFive.get(), bsHeader);
+ bsHeader = ValueToUTF8String(argFive.get());
}
CFX_WideString decodedResponse;
@@ -4935,18 +4722,16 @@ void CXFA_FM2JSContext::Put(CFXJSE_Value* pThis,
if (!pAppProvider)
return;
- CFX_ByteString bsURL;
std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0);
- ValueToUTF8String(argOne.get(), bsURL);
+ CFX_ByteString bsURL = ValueToUTF8String(argOne.get());
- CFX_ByteString bsData;
std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, args, 1);
- ValueToUTF8String(argTwo.get(), bsData);
+ CFX_ByteString bsData = ValueToUTF8String(argTwo.get());
CFX_ByteString bsEncode;
if (argc > 2) {
std::unique_ptr<CFXJSE_Value> argThree = GetSimpleValue(pThis, args, 2);
- ValueToUTF8String(argThree.get(), bsEncode);
+ bsEncode = ValueToUTF8String(argThree.get());
}
if (!pAppProvider->PutRequestURL(
@@ -5020,8 +4805,8 @@ void CXFA_FM2JSContext::logical_or_operator(CFXJSE_Value* pThis,
return;
}
- FX_FLOAT first = ValueToFloat(pThis, argFirst.get());
- FX_FLOAT second = ValueToFloat(pThis, argSecond.get());
+ float first = ValueToFloat(pThis, argFirst.get());
+ float second = ValueToFloat(pThis, argSecond.get());
args.GetReturnValue()->SetInteger((first || second) ? 1 : 0);
}
@@ -5041,8 +4826,8 @@ void CXFA_FM2JSContext::logical_and_operator(CFXJSE_Value* pThis,
return;
}
- FX_FLOAT first = ValueToFloat(pThis, argFirst.get());
- FX_FLOAT second = ValueToFloat(pThis, argSecond.get());
+ float first = ValueToFloat(pThis, argFirst.get());
+ float second = ValueToFloat(pThis, argSecond.get());
args.GetReturnValue()->SetInteger((first && second) ? 1 : 0);
}
@@ -5074,8 +4859,8 @@ void CXFA_FM2JSContext::equality_operator(CFXJSE_Value* pThis,
return;
}
- FX_DOUBLE first = ValueToDouble(pThis, argFirst.get());
- FX_DOUBLE second = ValueToDouble(pThis, argSecond.get());
+ double first = ValueToDouble(pThis, argFirst.get());
+ double second = ValueToDouble(pThis, argSecond.get());
args.GetReturnValue()->SetInteger((first == second) ? 1 : 0);
}
@@ -5107,8 +4892,8 @@ void CXFA_FM2JSContext::notequality_operator(CFXJSE_Value* pThis,
return;
}
- FX_DOUBLE first = ValueToDouble(pThis, argFirst.get());
- FX_DOUBLE second = ValueToDouble(pThis, argSecond.get());
+ double first = ValueToDouble(pThis, argFirst.get());
+ double second = ValueToDouble(pThis, argSecond.get());
args.GetReturnValue()->SetInteger(first != second);
}
@@ -5161,8 +4946,8 @@ void CXFA_FM2JSContext::less_operator(CFXJSE_Value* pThis,
return;
}
- FX_DOUBLE first = ValueToDouble(pThis, argFirst.get());
- FX_DOUBLE second = ValueToDouble(pThis, argSecond.get());
+ double first = ValueToDouble(pThis, argFirst.get());
+ double second = ValueToDouble(pThis, argSecond.get());
args.GetReturnValue()->SetInteger((first < second) ? 1 : 0);
}
@@ -5189,8 +4974,8 @@ void CXFA_FM2JSContext::lessequal_operator(CFXJSE_Value* pThis,
return;
}
- FX_DOUBLE first = ValueToDouble(pThis, argFirst.get());
- FX_DOUBLE second = ValueToDouble(pThis, argSecond.get());
+ double first = ValueToDouble(pThis, argFirst.get());
+ double second = ValueToDouble(pThis, argSecond.get());
args.GetReturnValue()->SetInteger((first <= second) ? 1 : 0);
}
@@ -5216,8 +5001,8 @@ void CXFA_FM2JSContext::greater_operator(CFXJSE_Value* pThis,
return;
}
- FX_DOUBLE first = ValueToDouble(pThis, argFirst.get());
- FX_DOUBLE second = ValueToDouble(pThis, argSecond.get());
+ double first = ValueToDouble(pThis, argFirst.get());
+ double second = ValueToDouble(pThis, argSecond.get());
args.GetReturnValue()->SetInteger((first > second) ? 1 : 0);
}
@@ -5244,8 +5029,8 @@ void CXFA_FM2JSContext::greaterequal_operator(CFXJSE_Value* pThis,
return;
}
- FX_DOUBLE first = ValueToDouble(pThis, argFirst.get());
- FX_DOUBLE second = ValueToDouble(pThis, argSecond.get());
+ double first = ValueToDouble(pThis, argFirst.get());
+ double second = ValueToDouble(pThis, argSecond.get());
args.GetReturnValue()->SetInteger((first >= second) ? 1 : 0);
}
@@ -5266,8 +5051,8 @@ void CXFA_FM2JSContext::plus_operator(CFXJSE_Value* pThis,
return;
}
- FX_DOUBLE first = ValueToDouble(pThis, argFirst.get());
- FX_DOUBLE second = ValueToDouble(pThis, argSecond.get());
+ double first = ValueToDouble(pThis, argFirst.get());
+ double second = ValueToDouble(pThis, argSecond.get());
args.GetReturnValue()->SetDouble(first + second);
}
@@ -5287,8 +5072,8 @@ void CXFA_FM2JSContext::minus_operator(CFXJSE_Value* pThis,
return;
}
- FX_DOUBLE first = ValueToDouble(pThis, argFirst.get());
- FX_DOUBLE second = ValueToDouble(pThis, argSecond.get());
+ double first = ValueToDouble(pThis, argFirst.get());
+ double second = ValueToDouble(pThis, argSecond.get());
args.GetReturnValue()->SetDouble(first - second);
}
@@ -5308,8 +5093,8 @@ void CXFA_FM2JSContext::multiple_operator(CFXJSE_Value* pThis,
return;
}
- FX_DOUBLE first = ValueToDouble(pThis, argFirst.get());
- FX_DOUBLE second = ValueToDouble(pThis, argSecond.get());
+ double first = ValueToDouble(pThis, argFirst.get());
+ double second = ValueToDouble(pThis, argSecond.get());
args.GetReturnValue()->SetDouble(first * second);
}
@@ -5330,13 +5115,13 @@ void CXFA_FM2JSContext::divide_operator(CFXJSE_Value* pThis,
return;
}
- FX_DOUBLE second = ValueToDouble(pThis, argSecond.get());
+ double second = ValueToDouble(pThis, argSecond.get());
if (second == 0.0) {
pContext->ThrowDivideByZeroException();
return;
}
- FX_DOUBLE first = ValueToDouble(pThis, argFirst.get());
+ double first = ValueToDouble(pThis, argFirst.get());
args.GetReturnValue()->SetDouble(first / second);
}
@@ -5389,7 +5174,7 @@ void CXFA_FM2JSContext::logical_not_operator(CFXJSE_Value* pThis,
return;
}
- FX_DOUBLE first = ValueToDouble(pThis, argOne.get());
+ double first = ValueToDouble(pThis, argOne.get());
args.GetReturnValue()->SetInteger((first == 0.0) ? 1 : 0);
}
@@ -5413,9 +5198,8 @@ void CXFA_FM2JSContext::dot_accessor(CFXJSE_Value* pThis,
}
CFX_ByteString szName = args.GetUTF8String(2);
- CFX_ByteString szSomExp;
- GenerateSomExpression(szName.AsStringC(), args.GetInt32(3), iIndexValue,
- bIsStar, szSomExp);
+ CFX_ByteString szSomExp = GenerateSomExpression(
+ szName.AsStringC(), args.GetInt32(3), iIndexValue, bIsStar);
std::unique_ptr<CFXJSE_Value> argAccessor = args.GetValue(0);
if (argAccessor->IsArray()) {
@@ -5531,10 +5315,9 @@ void CXFA_FM2JSContext::dotdot_accessor(CFXJSE_Value* pThis,
iIndexValue = ValueToInteger(pThis, args.GetValue(4).get());
}
- CFX_ByteString szSomExp;
CFX_ByteString szName = args.GetUTF8String(2);
- GenerateSomExpression(szName.AsStringC(), args.GetInt32(3), iIndexValue,
- bIsStar, szSomExp);
+ CFX_ByteString szSomExp = GenerateSomExpression(
+ szName.AsStringC(), args.GetInt32(3), iIndexValue, bIsStar);
std::unique_ptr<CFXJSE_Value> argAccessor = args.GetValue(0);
if (argAccessor->IsArray()) {
@@ -5642,8 +5425,7 @@ void CXFA_FM2JSContext::eval_translation(CFXJSE_Value* pThis,
}
std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0);
- CFX_ByteString argString;
- ValueToUTF8String(argOne.get(), argString);
+ CFX_ByteString argString = ValueToUTF8String(argOne.get());
if (argString.IsEmpty()) {
pContext->ThrowArgumentMismatchException();
return;
@@ -5941,18 +5723,17 @@ bool CXFA_FM2JSContext::simpleValueCompare(CFXJSE_Value* pThis,
return false;
if (firstValue->IsString()) {
- CFX_ByteString firstString, secondString;
- ValueToUTF8String(firstValue, firstString);
- ValueToUTF8String(secondValue, secondString);
+ CFX_ByteString firstString = ValueToUTF8String(firstValue);
+ CFX_ByteString secondString = ValueToUTF8String(secondValue);
return firstString == secondString;
}
if (firstValue->IsNumber()) {
- FX_FLOAT first = ValueToFloat(pThis, firstValue);
- FX_FLOAT second = ValueToFloat(pThis, secondValue);
- return (first == second);
+ float first = ValueToFloat(pThis, firstValue);
+ float second = ValueToFloat(pThis, secondValue);
+ return first == second;
}
if (firstValue->IsBoolean())
- return (firstValue->ToBoolean() == secondValue->ToBoolean());
+ return firstValue->ToBoolean() == secondValue->ToBoolean();
return firstValue->IsNull() && secondValue && secondValue->IsNull();
}
@@ -6045,24 +5826,23 @@ bool CXFA_FM2JSContext::SetObjectDefaultValue(CFXJSE_Value* pValue,
}
// static
-void CXFA_FM2JSContext::GenerateSomExpression(const CFX_ByteStringC& szName,
- int32_t iIndexFlags,
- int32_t iIndexValue,
- bool bIsStar,
- CFX_ByteString& szSomExp) {
- if (bIsStar) {
- szSomExp = szName + "[*]";
- return;
- }
- if (iIndexFlags == 0) {
- szSomExp = szName;
- return;
- }
+CFX_ByteString CXFA_FM2JSContext::GenerateSomExpression(
+ const CFX_ByteStringC& szName,
+ int32_t iIndexFlags,
+ int32_t iIndexValue,
+ bool bIsStar) {
+ if (bIsStar)
+ return CFX_ByteString(szName, "[*]");
+
+ if (iIndexFlags == 0)
+ return CFX_ByteString(szName);
+
if (iIndexFlags == 1 || iIndexValue == 0) {
- szSomExp = szName + "[" +
- CFX_ByteString::FormatInteger(iIndexValue, FXFORMAT_SIGNED) +
- "]";
- } else if (iIndexFlags == 2) {
+ return CFX_ByteString(szName, "[") +
+ CFX_ByteString::FormatInteger(iIndexValue, FXFORMAT_SIGNED) + "]";
+ }
+ CFX_ByteString szSomExp;
+ if (iIndexFlags == 2) {
szSomExp = (iIndexValue < 0) ? (szName + "[-") : (szName + "[+");
iIndexValue = (iIndexValue < 0) ? (0 - iIndexValue) : iIndexValue;
szSomExp += CFX_ByteString::FormatInteger(iIndexValue);
@@ -6073,6 +5853,7 @@ void CXFA_FM2JSContext::GenerateSomExpression(const CFX_ByteStringC& szName,
szSomExp += CFX_ByteString::FormatInteger(iIndexValue);
szSomExp += "]";
}
+ return szSomExp;
}
// static
@@ -6094,7 +5875,7 @@ bool CXFA_FM2JSContext::GetObjectForName(
dwFlags);
if (iRet >= 1 && resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) {
accessorValue->Assign(
- pScriptContext->GetJSValueFromMap(resoveNodeRS.nodes.GetAt(0)));
+ pScriptContext->GetJSValueFromMap(resoveNodeRS.objects.front()));
return true;
}
return false;
@@ -6162,23 +5943,23 @@ void CXFA_FM2JSContext::ParseResolveResult(
if (resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) {
*bAttribute = false;
- for (int32_t i = 0; i < resoveNodeRS.nodes.GetSize(); i++) {
+ CXFA_ScriptContext* pScriptContext =
+ pContext->GetDocument()->GetScriptContext();
+ for (CXFA_Object* pObject : resoveNodeRS.objects) {
resultValues->push_back(pdfium::MakeUnique<CFXJSE_Value>(pIsolate));
- resultValues->back()->Assign(
- pContext->GetDocument()->GetScriptContext()->GetJSValueFromMap(
- resoveNodeRS.nodes.GetAt(i)));
+ resultValues->back()->Assign(pScriptContext->GetJSValueFromMap(pObject));
}
return;
}
CXFA_ValueArray objectProperties(pIsolate);
- int32_t iRet = resoveNodeRS.GetAttributeResult(objectProperties);
+ int32_t iRet = resoveNodeRS.GetAttributeResult(&objectProperties);
*bAttribute = true;
if (iRet != 0) {
*bAttribute = false;
for (int32_t i = 0; i < iRet; i++) {
resultValues->push_back(pdfium::MakeUnique<CFXJSE_Value>(pIsolate));
- resultValues->back()->Assign(objectProperties[i]);
+ resultValues->back()->Assign(objectProperties.m_Values[i].get());
}
return;
}
@@ -6223,8 +6004,7 @@ int32_t CXFA_FM2JSContext::ValueToInteger(CFXJSE_Value* pThis,
}
// static
-FX_FLOAT CXFA_FM2JSContext::ValueToFloat(CFXJSE_Value* pThis,
- CFXJSE_Value* arg) {
+float CXFA_FM2JSContext::ValueToFloat(CFXJSE_Value* pThis, CFXJSE_Value* arg) {
if (!arg)
return 0.0f;
@@ -6249,7 +6029,7 @@ FX_FLOAT CXFA_FM2JSContext::ValueToFloat(CFXJSE_Value* pThis,
return ValueToFloat(pThis, newPropertyValue.get());
}
if (arg->IsString())
- return (FX_FLOAT)XFA_ByteStringToDouble(arg->ToString().AsStringC());
+ return (float)XFA_ByteStringToDouble(arg->ToString().AsStringC());
if (arg->IsUndefined())
return 0;
@@ -6257,8 +6037,8 @@ FX_FLOAT CXFA_FM2JSContext::ValueToFloat(CFXJSE_Value* pThis,
}
// static
-FX_DOUBLE CXFA_FM2JSContext::ValueToDouble(CFXJSE_Value* pThis,
- CFXJSE_Value* arg) {
+double CXFA_FM2JSContext::ValueToDouble(CFXJSE_Value* pThis,
+ CFXJSE_Value* arg) {
if (!arg)
return 0;
@@ -6325,17 +6105,12 @@ double CXFA_FM2JSContext::ExtractDouble(CFXJSE_Value* pThis,
}
// static
-void CXFA_FM2JSContext::ValueToUTF8String(CFXJSE_Value* arg,
- CFX_ByteString& szOutputString) {
- if (!arg)
- return;
-
- if (arg->IsNull() || arg->IsUndefined())
- szOutputString = "";
- else if (arg->IsBoolean())
- szOutputString = arg->ToBoolean() ? "1" : "0";
- else
- szOutputString = arg->ToString();
+CFX_ByteString CXFA_FM2JSContext::ValueToUTF8String(CFXJSE_Value* arg) {
+ if (!arg || arg->IsNull() || arg->IsUndefined())
+ return CFX_ByteString();
+ if (arg->IsBoolean())
+ return arg->ToBoolean() ? "1" : "0";
+ return arg->ToString();
}
// static.
@@ -6411,7 +6186,7 @@ void CXFA_FM2JSContext::ThrowArgumentMismatchException() const {
ThrowException(L"Argument mismatch in property or function argument.");
}
-void CXFA_FM2JSContext::ThrowException(const FX_WCHAR* str, ...) const {
+void CXFA_FM2JSContext::ThrowException(const wchar_t* str, ...) const {
CFX_WideString wsMessage;
va_list arg_ptr;
va_start(arg_ptr, str);
diff --git a/chromium/third_party/pdfium/xfa/fxfa/fm2js/xfa_fm2jscontext.h b/chromium/third_party/pdfium/xfa/fxfa/fm2js/xfa_fm2jscontext.h
index 0f802fe65e4..33f739f1cc5 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/fm2js/xfa_fm2jscontext.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/fm2js/xfa_fm2jscontext.h
@@ -14,6 +14,8 @@
#include "fxjs/cfxjse_context.h"
#include "xfa/fxfa/parser/xfa_resolvenode_rs.h"
+class CXFA_Document;
+
class CXFA_FM2JSContext : public CFXJSE_HostObject {
public:
CXFA_FM2JSContext(v8::Isolate* pScriptIsolate,
@@ -91,13 +93,13 @@ class CXFA_FM2JSContext : public CFXJSE_HostObject {
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
- static bool IsIsoDateFormat(const FX_CHAR* pData,
+ static bool IsIsoDateFormat(const char* pData,
int32_t iLength,
int32_t& iStyle,
int32_t& iYear,
int32_t& iMonth,
int32_t& iDay);
- static bool IsIsoTimeFormat(const FX_CHAR* pData,
+ static bool IsIsoTimeFormat(const char* pData,
int32_t iLength,
int32_t& iHour,
int32_t& iMinute,
@@ -105,7 +107,7 @@ class CXFA_FM2JSContext : public CFXJSE_HostObject {
int32_t& iMilliSecond,
int32_t& iZoneHour,
int32_t& iZoneMinute);
- static bool IsIsoDateTimeFormat(const FX_CHAR* pData,
+ static bool IsIsoDateTimeFormat(const char* pData,
int32_t iLength,
int32_t& iYear,
int32_t& iMonth,
@@ -116,57 +118,40 @@ class CXFA_FM2JSContext : public CFXJSE_HostObject {
int32_t& iMillionSecond,
int32_t& iZoneHour,
int32_t& iZoneMinute);
- static bool Local2IsoDate(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szDate,
- const CFX_ByteStringC& szFormat,
- const CFX_ByteStringC& szLocale,
- CFX_ByteString& strIsoDate);
- static bool Local2IsoTime(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szTime,
- const CFX_ByteStringC& szFormat,
- const CFX_ByteStringC& szLocale,
- CFX_ByteString& strIsoTime);
- static bool IsoDate2Local(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szDate,
- const CFX_ByteStringC& szFormat,
- const CFX_ByteStringC& szLocale,
- CFX_ByteString& strLocalDate);
- static bool IsoTime2Local(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szTime,
- const CFX_ByteStringC& szFormat,
- const CFX_ByteStringC& szLocale,
- CFX_ByteString& strLocalTime);
- static bool GetGMTTime(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szTime,
- const CFX_ByteStringC& szFormat,
- const CFX_ByteStringC& szLocale,
- CFX_ByteString& strGMTTime);
+ static CFX_ByteString Local2IsoDate(CFXJSE_Value* pThis,
+ const CFX_ByteStringC& szDate,
+ const CFX_ByteStringC& szFormat,
+ const CFX_ByteStringC& szLocale);
+ static CFX_ByteString IsoDate2Local(CFXJSE_Value* pThis,
+ const CFX_ByteStringC& szDate,
+ const CFX_ByteStringC& szFormat,
+ const CFX_ByteStringC& szLocale);
+ static CFX_ByteString IsoTime2Local(CFXJSE_Value* pThis,
+ const CFX_ByteStringC& szTime,
+ const CFX_ByteStringC& szFormat,
+ const CFX_ByteStringC& szLocale);
static int32_t DateString2Num(const CFX_ByteStringC& szDateString);
- static void GetLocalDateFormat(CFXJSE_Value* pThis,
- int32_t iStyle,
- const CFX_ByteStringC& szLocalStr,
- CFX_ByteString& strFormat,
- bool bStandard);
- static void GetLocalTimeFormat(CFXJSE_Value* pThis,
- int32_t iStyle,
- const CFX_ByteStringC& szLocalStr,
- CFX_ByteString& strFormat,
- bool bStandard);
- static void GetStandardDateFormat(CFXJSE_Value* pThis,
- int32_t iStyle,
- const CFX_ByteStringC& szLocalStr,
- CFX_ByteString& strFormat);
- static void GetStandardTimeFormat(CFXJSE_Value* pThis,
- int32_t iStyle,
- const CFX_ByteStringC& szLocalStr,
- CFX_ByteString& strFormat);
-
- static void Num2AllTime(CFXJSE_Value* pThis,
- int32_t iTime,
- const CFX_ByteStringC& szFormat,
- const CFX_ByteStringC& szLocale,
- bool bGM,
- CFX_ByteString& strTime);
+ static CFX_ByteString GetLocalDateFormat(CFXJSE_Value* pThis,
+ int32_t iStyle,
+ const CFX_ByteStringC& szLocalStr,
+ bool bStandard);
+ static CFX_ByteString GetLocalTimeFormat(CFXJSE_Value* pThis,
+ int32_t iStyle,
+ const CFX_ByteStringC& szLocalStr,
+ bool bStandard);
+ static CFX_ByteString GetStandardDateFormat(
+ CFXJSE_Value* pThis,
+ int32_t iStyle,
+ const CFX_ByteStringC& szLocalStr);
+ static CFX_ByteString GetStandardTimeFormat(
+ CFXJSE_Value* pThis,
+ int32_t iStyle,
+ const CFX_ByteStringC& szLocalStr);
+ static CFX_ByteString Num2AllTime(CFXJSE_Value* pThis,
+ int32_t iTime,
+ const CFX_ByteStringC& szFormat,
+ const CFX_ByteStringC& szLocale,
+ bool bGM);
static void GetLocalTimeZone(int32_t& iHour, int32_t& iMin, int32_t& iSec);
static void Apr(CFXJSE_Value* pThis,
@@ -410,11 +395,10 @@ class CXFA_FM2JSContext : public CFXJSE_HostObject {
CFXJSE_Value* pDefaultValue);
static bool SetObjectDefaultValue(CFXJSE_Value* pObjectValue,
CFXJSE_Value* pNewValue);
- static void GenerateSomExpression(const CFX_ByteStringC& szName,
- int32_t iIndexFlags,
- int32_t iIndexValue,
- bool bIsStar,
- CFX_ByteString& szSomExp);
+ static CFX_ByteString GenerateSomExpression(const CFX_ByteStringC& szName,
+ int32_t iIndexFlags,
+ int32_t iIndexValue,
+ bool bIsStar);
static bool GetObjectForName(CFXJSE_Value* pThis,
CFXJSE_Value* accessorValue,
const CFX_ByteStringC& szAccessorName);
@@ -436,10 +420,9 @@ class CXFA_FM2JSContext : public CFXJSE_HostObject {
uint32_t index);
static bool ValueIsNull(CFXJSE_Value* pThis, CFXJSE_Value* pValue);
static int32_t ValueToInteger(CFXJSE_Value* pThis, CFXJSE_Value* pValue);
- static FX_FLOAT ValueToFloat(CFXJSE_Value* pThis, CFXJSE_Value* pValue);
- static FX_DOUBLE ValueToDouble(CFXJSE_Value* pThis, CFXJSE_Value* pValue);
- static void ValueToUTF8String(CFXJSE_Value* pValue,
- CFX_ByteString& outputValue);
+ static float ValueToFloat(CFXJSE_Value* pThis, CFXJSE_Value* pValue);
+ static double ValueToDouble(CFXJSE_Value* pThis, CFXJSE_Value* pValue);
+ static CFX_ByteString ValueToUTF8String(CFXJSE_Value* pValue);
static double ExtractDouble(CFXJSE_Value* pThis,
CFXJSE_Value* src,
bool* ret);
@@ -462,7 +445,7 @@ class CXFA_FM2JSContext : public CFXJSE_HostObject {
const CFX_WideString& exp) const;
void ThrowArgumentMismatchException() const;
void ThrowParamCountMismatchException(const CFX_WideString& method) const;
- void ThrowException(const FX_WCHAR* str, ...) const;
+ void ThrowException(const wchar_t* str, ...) const;
v8::Isolate* m_pIsolate;
CFXJSE_Class* m_pFMClass;
diff --git a/chromium/third_party/pdfium/xfa/fxfa/fm2js/xfa_fmparse.cpp b/chromium/third_party/pdfium/xfa/fxfa/fm2js/xfa_fmparse.cpp
index 52161e8c0ac..c1f609315b4 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/fm2js/xfa_fmparse.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/fm2js/xfa_fmparse.cpp
@@ -12,6 +12,12 @@
#include "third_party/base/ptr_util.h"
+namespace {
+
+const int kMaxAssignmentChainLength = 12;
+
+} // namespace
+
CXFA_FMParse::CXFA_FMParse(const CFX_WideStringC& wsFormcalc,
CXFA_FMErrorInfo* pErrorInfo)
: m_pToken(nullptr), m_pErrorInfo(pErrorInfo) {
@@ -39,7 +45,7 @@ void CXFA_FMParse::Check(XFA_FM_TOKEN op) {
NextToken();
}
-void CXFA_FMParse::Error(uint32_t lineNum, const FX_WCHAR* msg, ...) {
+void CXFA_FMParse::Error(uint32_t lineNum, const wchar_t* msg, ...) {
m_pErrorInfo->linenum = lineNum;
va_list ap;
va_start(ap, msg);
@@ -208,9 +214,12 @@ std::unique_ptr<CXFA_FMExpression> CXFA_FMParse::ParseVarExpression() {
std::unique_ptr<CXFA_FMSimpleExpression> CXFA_FMParse::ParseSimpleExpression() {
uint32_t line = m_pToken->m_uLinenum;
std::unique_ptr<CXFA_FMSimpleExpression> pExp1 = ParseLogicalOrExpression();
+ int level = 1;
while (m_pToken->m_type == TOKassign) {
NextToken();
std::unique_ptr<CXFA_FMSimpleExpression> pExp2 = ParseLogicalOrExpression();
+ if (level++ == kMaxAssignmentChainLength)
+ Error(m_pToken->m_uLinenum, kFMErrLongAssignmentChain);
if (m_pErrorInfo->message.IsEmpty()) {
pExp1 = pdfium::MakeUnique<CXFA_FMAssignExpression>(
line, TOKassign, std::move(pExp1), std::move(pExp2));
@@ -776,9 +785,12 @@ std::unique_ptr<CXFA_FMSimpleExpression> CXFA_FMParse::ParseParenExpression() {
uint32_t line = m_pToken->m_uLinenum;
std::unique_ptr<CXFA_FMSimpleExpression> pExp1 = ParseLogicalOrExpression();
+ int level = 1;
while (m_pToken->m_type == TOKassign) {
NextToken();
std::unique_ptr<CXFA_FMSimpleExpression> pExp2 = ParseLogicalOrExpression();
+ if (level++ == kMaxAssignmentChainLength)
+ Error(m_pToken->m_uLinenum, kFMErrLongAssignmentChain);
if (m_pErrorInfo->message.IsEmpty()) {
pExp1 = pdfium::MakeUnique<CXFA_FMAssignExpression>(
line, TOKassign, std::move(pExp1), std::move(pExp2));
@@ -832,7 +844,7 @@ std::unique_ptr<CXFA_FMExpression> CXFA_FMParse::ParseBlockExpression() {
std::unique_ptr<CXFA_FMExpression> CXFA_FMParse::ParseIfExpression() {
uint32_t line = m_pToken->m_uLinenum;
- const FX_WCHAR* pStartPos = m_lexer->SavePos();
+ const wchar_t* pStartPos = m_lexer->SavePos();
NextToken();
Check(TOKlparen);
std::unique_ptr<CXFA_FMSimpleExpression> pExpression;
diff --git a/chromium/third_party/pdfium/xfa/fxfa/fm2js/xfa_fmparse.h b/chromium/third_party/pdfium/xfa/fxfa/fm2js/xfa_fmparse.h
index 8f2671d1b0d..ccb793ae684 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/fm2js/xfa_fmparse.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/fm2js/xfa_fmparse.h
@@ -20,7 +20,7 @@ class CXFA_FMParse {
void NextToken();
void Check(XFA_FM_TOKEN op);
- void Error(uint32_t lineNum, const FX_WCHAR* msg, ...);
+ void Error(uint32_t lineNum, const wchar_t* msg, ...);
std::vector<std::unique_ptr<CXFA_FMExpression>> ParseTopExpression();
std::unique_ptr<CXFA_FMExpression> ParseFunction();
std::unique_ptr<CXFA_FMExpression> ParseExpression();
diff --git a/chromium/third_party/pdfium/xfa/fxfa/fm2js/xfa_lexer.cpp b/chromium/third_party/pdfium/xfa/fxfa/fm2js/xfa_lexer.cpp
index 6e844bcdf05..7ccd4773fbc 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/fm2js/xfa_lexer.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/fm2js/xfa_lexer.cpp
@@ -11,41 +11,39 @@
namespace {
struct XFA_FMDChar {
- static const FX_WCHAR* inc(const FX_WCHAR*& p) {
+ static const wchar_t* inc(const wchar_t*& p) {
++p;
return p;
}
- static const FX_WCHAR* dec(const FX_WCHAR*& p) {
+ static const wchar_t* dec(const wchar_t*& p) {
--p;
return p;
}
- static uint16_t get(const FX_WCHAR* p) { return *p; }
- static bool isWhiteSpace(const FX_WCHAR* p) {
+ static uint16_t get(const wchar_t* p) { return *p; }
+ static bool isWhiteSpace(const wchar_t* p) {
return (*p) == 0x09 || (*p) == 0x0b || (*p) == 0x0c || (*p) == 0x20;
}
- static bool isLineTerminator(const FX_WCHAR* p) {
+ static bool isLineTerminator(const wchar_t* p) {
return *p == 0x0A || *p == 0x0D;
}
- static bool isBinary(const FX_WCHAR* p) { return (*p) >= '0' && (*p) <= '1'; }
- static bool isOctal(const FX_WCHAR* p) { return (*p) >= '0' && (*p) <= '7'; }
- static bool isDigital(const FX_WCHAR* p) {
- return (*p) >= '0' && (*p) <= '9';
- }
- static bool isHex(const FX_WCHAR* p) {
+ static bool isBinary(const wchar_t* p) { return (*p) >= '0' && (*p) <= '1'; }
+ static bool isOctal(const wchar_t* p) { return (*p) >= '0' && (*p) <= '7'; }
+ static bool isDigital(const wchar_t* p) { return (*p) >= '0' && (*p) <= '9'; }
+ static bool isHex(const wchar_t* p) {
return isDigital(p) || ((*p) >= 'a' && (*p) <= 'f') ||
((*p) >= 'A' && (*p) <= 'F');
}
- static bool isAlpha(const FX_WCHAR* p) {
+ static bool isAlpha(const wchar_t* p) {
return ((*p) <= 'z' && (*p) >= 'a') || ((*p) <= 'Z' && (*p) >= 'A');
}
- static bool isAvalid(const FX_WCHAR* p, bool flag = 0);
- static bool string2number(const FX_WCHAR* s,
- FX_DOUBLE* pValue,
- const FX_WCHAR*& pEnd);
+ static bool isAvalid(const wchar_t* p, bool flag = 0);
+ static bool string2number(const wchar_t* s,
+ double* pValue,
+ const wchar_t*& pEnd);
static bool isUnicodeAlpha(uint16_t ch);
};
-inline bool XFA_FMDChar::isAvalid(const FX_WCHAR* p, bool flag) {
+inline bool XFA_FMDChar::isAvalid(const wchar_t* p, bool flag) {
if (*p == 0) {
return 1;
}
@@ -61,12 +59,12 @@ inline bool XFA_FMDChar::isAvalid(const FX_WCHAR* p, bool flag) {
return 0;
}
-inline bool XFA_FMDChar::string2number(const FX_WCHAR* s,
- FX_DOUBLE* pValue,
- const FX_WCHAR*& pEnd) {
- if (s) {
- *pValue = wcstod((wchar_t*)s, (wchar_t**)&pEnd);
- }
+inline bool XFA_FMDChar::string2number(const wchar_t* s,
+ double* pValue,
+ const wchar_t*& pEnd) {
+ if (s)
+ *pValue = wcstod(const_cast<wchar_t*>(s), const_cast<wchar_t**>(&pEnd));
+
return 0;
}
@@ -148,7 +146,7 @@ const XFA_FM_TOKEN KEYWORD_END = TOKendif;
} // namespace
-const FX_WCHAR* XFA_FM_KeywordToString(XFA_FM_TOKEN op) {
+const wchar_t* XFA_FM_KeywordToString(XFA_FM_TOKEN op) {
if (op < KEYWORD_START || op > KEYWORD_END)
return L"";
return keyWords[op].m_keyword;
@@ -199,12 +197,12 @@ CXFA_FMToken* CXFA_FMLexer::Scan() {
XFA_FMDChar::inc(m_ptr);
break;
case ';': {
- const FX_WCHAR* pTemp = 0;
+ const wchar_t* pTemp = 0;
Comment(m_ptr, pTemp);
m_ptr = pTemp;
} break;
case '"': {
- const FX_WCHAR* pTemp = 0;
+ const wchar_t* pTemp = 0;
p->m_type = TOKstring;
iRet = String(p, m_ptr, pTemp);
m_ptr = pTemp;
@@ -221,7 +219,7 @@ CXFA_FMToken* CXFA_FMLexer::Scan() {
case '8':
case '9': {
p->m_type = TOKnumber;
- const FX_WCHAR* pTemp = 0;
+ const wchar_t* pTemp = 0;
iRet = Number(p, m_ptr, pTemp);
m_ptr = pTemp;
if (iRet) {
@@ -333,7 +331,7 @@ CXFA_FMToken* CXFA_FMLexer::Scan() {
if (XFA_FMDChar::isAvalid(m_ptr)) {
ch = XFA_FMDChar::get(m_ptr);
if (ch == '/') {
- const FX_WCHAR* pTemp = 0;
+ const wchar_t* pTemp = 0;
Comment(m_ptr, pTemp);
m_ptr = pTemp;
break;
@@ -365,7 +363,7 @@ CXFA_FMToken* CXFA_FMLexer::Scan() {
return p;
} else if (ch <= '9' && ch >= '0') {
p->m_type = TOKnumber;
- const FX_WCHAR* pTemp = 0;
+ const wchar_t* pTemp = 0;
XFA_FMDChar::dec(m_ptr);
iRet = Number(p, m_ptr, pTemp);
m_ptr = pTemp;
@@ -389,7 +387,7 @@ CXFA_FMToken* CXFA_FMLexer::Scan() {
XFA_FMDChar::inc(m_ptr);
break;
default: {
- const FX_WCHAR* pTemp = 0;
+ const wchar_t* pTemp = 0;
iRet = Identifiers(p, m_ptr, pTemp);
m_ptr = pTemp;
if (iRet) {
@@ -403,23 +401,22 @@ CXFA_FMToken* CXFA_FMLexer::Scan() {
}
uint32_t CXFA_FMLexer::Number(CXFA_FMToken* t,
- const FX_WCHAR* p,
- const FX_WCHAR*& pEnd) {
- FX_DOUBLE number = 0;
- if (XFA_FMDChar::string2number(p, &number, pEnd)) {
+ const wchar_t* p,
+ const wchar_t*& pEnd) {
+ double number = 0;
+ if (XFA_FMDChar::string2number(p, &number, pEnd))
return 1;
- }
- if (pEnd && XFA_FMDChar::isAlpha(pEnd)) {
+ if (pEnd && XFA_FMDChar::isAlpha(pEnd))
return 1;
- }
+
t->m_wstring = CFX_WideStringC(p, (pEnd - p));
return 0;
}
uint32_t CXFA_FMLexer::String(CXFA_FMToken* t,
- const FX_WCHAR* p,
- const FX_WCHAR*& pEnd) {
- const FX_WCHAR* pStart = p;
+ const wchar_t* p,
+ const wchar_t*& pEnd) {
+ const wchar_t* pStart = p;
uint16_t ch = 0;
XFA_FMDChar::inc(p);
ch = XFA_FMDChar::get(p);
@@ -457,9 +454,9 @@ uint32_t CXFA_FMLexer::String(CXFA_FMToken* t,
}
uint32_t CXFA_FMLexer::Identifiers(CXFA_FMToken* t,
- const FX_WCHAR* p,
- const FX_WCHAR*& pEnd) {
- const FX_WCHAR* pStart = p;
+ const wchar_t* p,
+ const wchar_t*& pEnd) {
+ const wchar_t* pStart = p;
uint16_t ch = 0;
ch = XFA_FMDChar::get(p);
XFA_FMDChar::inc(p);
@@ -491,7 +488,7 @@ uint32_t CXFA_FMLexer::Identifiers(CXFA_FMToken* t,
return 0;
}
-void CXFA_FMLexer::Comment(const FX_WCHAR* p, const FX_WCHAR*& pEnd) {
+void CXFA_FMLexer::Comment(const wchar_t* p, const wchar_t*& pEnd) {
unsigned ch = 0;
XFA_FMDChar::inc(p);
ch = XFA_FMDChar::get(p);
@@ -530,7 +527,7 @@ XFA_FM_TOKEN CXFA_FMLexer::IsKeyword(const CFX_WideStringC& str) {
return TOKidentifier;
}
-void CXFA_FMLexer::Error(const FX_WCHAR* msg, ...) {
+void CXFA_FMLexer::Error(const wchar_t* msg, ...) {
m_pErrorInfo->linenum = m_uCurrentLine;
va_list ap;
va_start(ap, msg);
diff --git a/chromium/third_party/pdfium/xfa/fxfa/fm2js/xfa_lexer.h b/chromium/third_party/pdfium/xfa/fxfa/fm2js/xfa_lexer.h
index 9395c06814f..860c50f30a9 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/fm2js/xfa_lexer.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/fm2js/xfa_lexer.h
@@ -86,10 +86,10 @@ enum XFA_FM_TOKEN {
struct XFA_FMKeyword {
XFA_FM_TOKEN m_type;
uint32_t m_uHash;
- const FX_WCHAR* m_keyword;
+ const wchar_t* m_keyword;
};
-const FX_WCHAR* XFA_FM_KeywordToString(XFA_FM_TOKEN op);
+const wchar_t* XFA_FM_KeywordToString(XFA_FM_TOKEN op);
class CXFA_FMToken {
public:
@@ -107,27 +107,25 @@ class CXFA_FMLexer {
~CXFA_FMLexer();
CXFA_FMToken* NextToken();
- uint32_t Number(CXFA_FMToken* t, const FX_WCHAR* p, const FX_WCHAR*& pEnd);
- uint32_t String(CXFA_FMToken* t, const FX_WCHAR* p, const FX_WCHAR*& pEnd);
- uint32_t Identifiers(CXFA_FMToken* t,
- const FX_WCHAR* p,
- const FX_WCHAR*& pEnd);
- void Comment(const FX_WCHAR* p, const FX_WCHAR*& pEnd);
+ uint32_t Number(CXFA_FMToken* t, const wchar_t* p, const wchar_t*& pEnd);
+ uint32_t String(CXFA_FMToken* t, const wchar_t* p, const wchar_t*& pEnd);
+ uint32_t Identifiers(CXFA_FMToken* t, const wchar_t* p, const wchar_t*& pEnd);
+ void Comment(const wchar_t* p, const wchar_t*& pEnd);
XFA_FM_TOKEN IsKeyword(const CFX_WideStringC& p);
void SetCurrentLine(uint32_t line) { m_uCurrentLine = line; }
void SetToken(CXFA_FMToken* pToken) {
if (m_pToken.get() != pToken)
m_pToken.reset(pToken);
}
- const FX_WCHAR* SavePos() { return m_ptr; }
- void RestorePos(const FX_WCHAR* pPos) { m_ptr = pPos; }
- void Error(const FX_WCHAR* msg, ...);
+ const wchar_t* SavePos() { return m_ptr; }
+ void RestorePos(const wchar_t* pPos) { m_ptr = pPos; }
+ void Error(const wchar_t* msg, ...);
bool HasError() const;
- protected:
+ private:
CXFA_FMToken* Scan();
- const FX_WCHAR* m_ptr;
+ const wchar_t* m_ptr;
uint32_t m_uCurrentLine;
std::unique_ptr<CXFA_FMToken> m_pToken;
CXFA_FMErrorInfo* m_pErrorInfo;
diff --git a/chromium/third_party/pdfium/xfa/fxfa/fm2js/xfa_simpleexpression.cpp b/chromium/third_party/pdfium/xfa/fxfa/fm2js/xfa_simpleexpression.cpp
index 686ddaa17dc..7bc703b59b9 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/fm2js/xfa_simpleexpression.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/fm2js/xfa_simpleexpression.cpp
@@ -12,7 +12,7 @@
namespace {
-const FX_WCHAR* const gs_lpStrExpFuncName[] = {
+const wchar_t* const gs_lpStrExpFuncName[] = {
L"foxit_xfa_formcalc_runtime.assign_value_operator",
L"foxit_xfa_formcalc_runtime.logical_or_operator",
L"foxit_xfa_formcalc_runtime.logical_and_operator",
@@ -42,7 +42,7 @@ const FX_WCHAR* const gs_lpStrExpFuncName[] = {
struct XFA_FMBuildInFunc {
uint32_t m_uHash;
- const FX_WCHAR* m_buildinfunc;
+ const wchar_t* m_buildinfunc;
};
const XFA_FMBuildInFunc g_BuildInFuncs[] = {
@@ -83,7 +83,7 @@ const XFA_FMBuildInFunc g_BuildInFuncs[] = {
struct XFA_FMSOMMethod {
uint32_t m_uHash;
- const FX_WCHAR* m_wsSomMethodName;
+ const wchar_t* m_wsSomMethodName;
uint32_t m_dParameters;
};
const XFA_FMSOMMethod gs_FMSomMethods[] = {
@@ -155,7 +155,7 @@ void CXFA_FMStringExpression::ToJavaScript(CFX_WideTextBuf& javascript) {
CFX_WideString tempStr(m_wsString);
if (tempStr.GetLength() > 2) {
javascript.AppendChar(L'\"');
- FX_WCHAR oneChar;
+ wchar_t oneChar;
for (int16_t i = 1; i < tempStr.GetLength() - 1; i++) {
oneChar = tempStr[i];
switch (oneChar) {
diff --git a/chromium/third_party/pdfium/xfa/fxfa/fm2js/xfa_simpleexpression_unittest.cpp b/chromium/third_party/pdfium/xfa/fxfa/fm2js/xfa_simpleexpression_unittest.cpp
index 7826d9b53c3..a2c7f1b878a 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/fm2js/xfa_simpleexpression_unittest.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/fm2js/xfa_simpleexpression_unittest.cpp
@@ -8,10 +8,13 @@
#include <utility>
#include "testing/gtest/include/gtest/gtest.h"
+#include "testing/test_support.h"
#include "third_party/base/ptr_util.h"
#include "xfa/fxfa/fm2js/xfa_lexer.h"
-TEST(FMCallExpression, more_than_32_arguments) {
+class FMCallExpressionTest : public pdfium::FPDF_Test {};
+
+TEST_F(FMCallExpressionTest, more_than_32_arguments) {
// Use sign as it has 3 object parameters at positions 0, 5, and 6.
auto exp = pdfium::MakeUnique<CXFA_FMIdentifierExpression>(0, L"sign");
diff --git a/chromium/third_party/pdfium/xfa/fxfa/fxfa.h b/chromium/third_party/pdfium/xfa/fxfa/fxfa.h
index dd5fc0fcbc4..559035cba1a 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/fxfa.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/fxfa.h
@@ -10,8 +10,8 @@
#include <vector>
#include "core/fxcrt/cfx_retain_ptr.h"
+#include "xfa/fxfa/cxfa_widgetacc.h"
#include "xfa/fxfa/fxfa_basic.h"
-#include "xfa/fxfa/fxfa_widget.h"
class CFGAS_GEFont;
class CFX_Graphics;
@@ -39,24 +39,15 @@ class IXFA_WidgetIterator;
#define XFA_IDNo 3
#define XFA_IDYes 4
-#define XFA_DOCVIEW_View 0x00000000
-#define XFA_DOCVIEW_MasterPage 0x00000001
-#define XFA_DOCVIEW_Design 0x00000002
-#define XFA_DOCTYPE_Dynamic 0
-#define XFA_DOCTYPE_Static 1
-#define XFA_DOCTYPE_XDP 2
+// Note, values match fpdf_formfill.h DOCTYPE_* flags.
+enum class XFA_DocType { PDF = 0, Dynamic = 1, Static = 2 };
+
#define XFA_PARSESTATUS_StatusErr -3
#define XFA_PARSESTATUS_StreamErr -2
#define XFA_PARSESTATUS_SyntaxErr -1
#define XFA_PARSESTATUS_Ready 0
#define XFA_PARSESTATUS_Done 100
-#define XFA_VALIDATE_preSubmit 1
-#define XFA_VALIDATE_prePrint 2
-#define XFA_VALIDATE_preExecute 3
-#define XFA_VALIDATE_preSave 4
-#define XFA_INVALIDATE_AllPages 0x00000000
-#define XFA_INVALIDATE_CurrentPage 0x00000001
#define XFA_PRINTOPT_ShowDialog 0x00000001
#define XFA_PRINTOPT_CanCancel 0x00000002
#define XFA_PRINTOPT_ShrinkPage 0x00000004
@@ -233,14 +224,13 @@ class IXFA_DocEnvironment {
virtual void SetChangeMark(CXFA_FFDoc* hDoc) = 0;
virtual void InvalidateRect(CXFA_FFPageView* pPageView,
- const CFX_RectF& rt,
- uint32_t dwFlags) = 0;
+ const CFX_RectF& rt) = 0;
virtual void DisplayCaret(CXFA_FFWidget* hWidget,
bool bVisible,
const CFX_RectF* pRtAnchor) = 0;
virtual bool GetPopupPos(CXFA_FFWidget* hWidget,
- FX_FLOAT fMinPopup,
- FX_FLOAT fMaxPopup,
+ float fMinPopup,
+ float fMaxPopup,
const CFX_RectF& rtAnchor,
CFX_RectF& rtPopup) = 0;
virtual bool PopupMenu(CXFA_FFWidget* hWidget, CFX_PointF ptPopup) = 0;
diff --git a/chromium/third_party/pdfium/xfa/fxfa/fxfa_basic.h b/chromium/third_party/pdfium/xfa/fxfa/fxfa_basic.h
index d16f50fd90d..a33f8c81538 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/fxfa_basic.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/fxfa_basic.h
@@ -90,9 +90,9 @@ enum XFA_XDPPACKET_FLAGS {
};
struct XFA_PACKETINFO {
uint32_t uHash;
- const FX_WCHAR* pName;
+ const wchar_t* pName;
XFA_XDPPACKET eName;
- const FX_WCHAR* pURI;
+ const wchar_t* pURI;
uint32_t eFlags;
};
@@ -928,7 +928,7 @@ enum class XFA_Element : int32_t {
};
struct XFA_ELEMENTINFO {
uint32_t uHash;
- const FX_WCHAR* pName;
+ const wchar_t* pName;
XFA_Element eName;
uint32_t dwPackets;
XFA_ObjectType eObjectType;
@@ -944,7 +944,7 @@ enum XFA_ATTRIBUTETYPE {
};
struct XFA_ATTRIBUTEINFO {
uint32_t uHash;
- const FX_WCHAR* pName;
+ const wchar_t* pName;
XFA_ATTRIBUTE eName;
XFA_ATTRIBUTETYPE eType;
uint32_t dwPackets;
@@ -974,7 +974,7 @@ struct XFA_PROPERTY {
struct XFA_ATTRIBUTEENUMINFO {
uint32_t uHash;
- const FX_WCHAR* pName;
+ const wchar_t* pName;
XFA_ATTRIBUTEENUM eName;
};
@@ -1004,7 +1004,7 @@ class CXFA_Object;
typedef void (CXFA_Object::*XFA_METHOD_CALLBACK)(CFXJSE_Arguments* pArguments);
struct XFA_METHODINFO {
uint32_t uHash;
- const FX_WCHAR* pName;
+ const wchar_t* pName;
XFA_METHOD_CALLBACK lpfnCallback;
};
@@ -1017,7 +1017,7 @@ enum XFA_SCRIPT_TYPE {
};
struct XFA_SCRIPTATTRIBUTEINFO {
uint32_t uHash;
- const FX_WCHAR* pName;
+ const wchar_t* pName;
XFA_ATTRIBUTE_CALLBACK lpfnCallback;
int32_t eAttribute;
uint16_t eValueType;
diff --git a/chromium/third_party/pdfium/xfa/fxfa/fxfa_widget.h b/chromium/third_party/pdfium/xfa/fxfa/fxfa_widget.h
deleted file mode 100644
index 74c63c9d52e..00000000000
--- a/chromium/third_party/pdfium/xfa/fxfa/fxfa_widget.h
+++ /dev/null
@@ -1,121 +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 XFA_FXFA_FXFA_WIDGET_H_
-#define XFA_FXFA_FXFA_WIDGET_H_
-
-#include <memory>
-
-#include "core/fxcrt/cfx_retain_ptr.h"
-#include "core/fxcrt/fx_coordinates.h"
-#include "core/fxge/fx_dib.h"
-#include "xfa/fxfa/parser/cxfa_box.h"
-#include "xfa/fxfa/parser/cxfa_event.h"
-#include "xfa/fxfa/parser/cxfa_image.h"
-#include "xfa/fxfa/parser/cxfa_margin.h"
-#include "xfa/fxfa/parser/cxfa_script.h"
-#include "xfa/fxfa/parser/cxfa_value.h"
-#include "xfa/fxfa/parser/cxfa_widgetdata.h"
-
-class CFGAS_GEFont;
-class CXFA_EventParam;
-class CXFA_FFApp;
-class CXFA_FFDoc;
-class CXFA_FFDocView;
-class CXFA_FFWidget;
-class CXFA_Node;
-class CXFA_TextLayout;
-class CXFA_WidgetLayoutData;
-class IXFA_AppProvider;
-
-class CXFA_WidgetAcc : public CXFA_WidgetData {
- public:
- CXFA_WidgetAcc(CXFA_FFDocView* pDocView, CXFA_Node* pNode);
- ~CXFA_WidgetAcc();
-
- bool GetName(CFX_WideString& wsName, int32_t iNameType = 0);
- bool ProcessValueChanged();
- void ResetData();
-
- void SetImageEdit(const CFX_WideString& wsContentType,
- const CFX_WideString& wsHref,
- const CFX_WideString& wsData);
-
- CXFA_WidgetAcc* GetExclGroup();
- CXFA_FFDocView* GetDocView();
- CXFA_FFDoc* GetDoc();
- CXFA_FFApp* GetApp();
- IXFA_AppProvider* GetAppProvider();
-
- int32_t ProcessEvent(int32_t iActivity, CXFA_EventParam* pEventParam);
- int32_t ProcessEvent(CXFA_Event& event, CXFA_EventParam* pEventParam);
- int32_t ProcessCalculate();
- int32_t ProcessValidate(int32_t iFlags = 0);
- int32_t ExecuteScript(CXFA_Script script,
- CXFA_EventParam* pEventParam,
- CFXJSE_Value** pRetValue = nullptr);
-
- CXFA_FFWidget* GetNextWidget(CXFA_FFWidget* pWidget);
- void StartWidgetLayout(FX_FLOAT& fCalcWidth, FX_FLOAT& fCalcHeight);
- bool FindSplitPos(int32_t iBlockIndex, FX_FLOAT& fCalcHeight);
- bool LoadCaption();
- void LoadText();
- bool LoadImageImage();
- bool LoadImageEditImage();
- void GetImageDpi(int32_t& iImageXDpi, int32_t& iImageYDpi);
- void GetImageEditDpi(int32_t& iImageXDpi, int32_t& iImageYDpi);
- CXFA_TextLayout* GetCaptionTextLayout();
- CXFA_TextLayout* GetTextLayout();
- CFX_DIBitmap* GetImageImage();
- CFX_DIBitmap* GetImageEditImage();
- void SetImageImage(CFX_DIBitmap* newImage);
- void SetImageEditImage(CFX_DIBitmap* newImage);
- void UpdateUIDisplay(CXFA_FFWidget* pExcept = nullptr);
-
- CXFA_Node* GetDatasets();
- CFX_RetainPtr<CFGAS_GEFont> GetFDEFont();
- FX_FLOAT GetFontSize();
- FX_ARGB GetTextColor();
- FX_FLOAT GetLineHeight();
- CXFA_WidgetLayoutData* GetWidgetLayoutData();
-
- protected:
- void ProcessScriptTestValidate(CXFA_Validate validate,
- int32_t iRet,
- CFXJSE_Value* pRetValue,
- bool bVersionFlag);
- int32_t ProcessFormatTestValidate(CXFA_Validate validate, bool bVersionFlag);
- int32_t ProcessNullTestValidate(CXFA_Validate validate,
- int32_t iFlags,
- bool bVersionFlag);
- CFX_WideString GetValidateCaptionName(bool bVersionFlag);
- CFX_WideString GetValidateMessage(bool bError, bool bVersionFlag);
- void CalcCaptionSize(CFX_SizeF& szCap);
- bool CalculateFieldAutoSize(CFX_SizeF& size);
- bool CalculateWidgetAutoSize(CFX_SizeF& size);
- bool CalculateTextEditAutoSize(CFX_SizeF& size);
- bool CalculateCheckButtonAutoSize(CFX_SizeF& size);
- bool CalculatePushButtonAutoSize(CFX_SizeF& size);
- bool CalculateImageEditAutoSize(CFX_SizeF& size);
- bool CalculateImageAutoSize(CFX_SizeF& size);
- bool CalculateTextAutoSize(CFX_SizeF& size);
- FX_FLOAT CalculateWidgetAutoHeight(FX_FLOAT fHeightCalc);
- FX_FLOAT CalculateWidgetAutoWidth(FX_FLOAT fWidthCalc);
- FX_FLOAT GetWidthWithoutMargin(FX_FLOAT fWidthCalc);
- FX_FLOAT GetHeightWithoutMargin(FX_FLOAT fHeightCalc);
- void CalculateTextContentSize(CFX_SizeF& size);
- void CalculateAccWidthAndHeight(XFA_Element eUIType,
- FX_FLOAT& fWidth,
- FX_FLOAT& fCalcHeight);
- void InitLayoutData();
- void StartTextLayout(FX_FLOAT& fCalcWidth, FX_FLOAT& fCalcHeight);
-
- CXFA_FFDocView* m_pDocView;
- std::unique_ptr<CXFA_WidgetLayoutData> m_pLayoutData;
- uint32_t m_nRecursionDepth;
-};
-
-#endif // XFA_FXFA_FXFA_WIDGET_H_
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cscript_datawindow.cpp b/chromium/third_party/pdfium/xfa/fxfa/parser/cscript_datawindow.cpp
index c0354a112c5..e2d9f043d17 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cscript_datawindow.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cscript_datawindow.cpp
@@ -8,8 +8,7 @@
#include "fxjs/cfxjse_arguments.h"
#include "xfa/fxfa/parser/cxfa_document.h"
-#include "xfa/fxfa/parser/xfa_localemgr.h"
-#include "xfa/fxfa/parser/xfa_object.h"
+#include "xfa/fxfa/parser/cxfa_localemgr.h"
#include "xfa/fxfa/parser/xfa_utils.h"
CScript_DataWindow::CScript_DataWindow(CXFA_Document* pDocument)
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cscript_datawindow.h b/chromium/third_party/pdfium/xfa/fxfa/parser/cscript_datawindow.h
index e41b7fe17da..ae123168912 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cscript_datawindow.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cscript_datawindow.h
@@ -7,8 +7,9 @@
#ifndef XFA_FXFA_PARSER_CSCRIPT_DATAWINDOW_H_
#define XFA_FXFA_PARSER_CSCRIPT_DATAWINDOW_H_
-#include "fxjs/cfxjse_arguments.h"
-#include "xfa/fxfa/parser/xfa_object.h"
+#include "xfa/fxfa/parser/cxfa_object.h"
+
+class CFXJSE_Arguments;
class CScript_DataWindow : public CXFA_Object {
public:
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cscript_eventpseudomodel.cpp b/chromium/third_party/pdfium/xfa/fxfa/parser/cscript_eventpseudomodel.cpp
index 8cfedd29987..c57b0bdc781 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cscript_eventpseudomodel.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cscript_eventpseudomodel.cpp
@@ -9,12 +9,11 @@
#include "fxjs/cfxjse_arguments.h"
#include "xfa/fxfa/app/xfa_ffnotify.h"
#include "xfa/fxfa/cxfa_eventparam.h"
+#include "xfa/fxfa/cxfa_ffwidgethandler.h"
#include "xfa/fxfa/parser/cxfa_document.h"
+#include "xfa/fxfa/parser/cxfa_localemgr.h"
#include "xfa/fxfa/parser/cxfa_scriptcontext.h"
-#include "xfa/fxfa/parser/xfa_localemgr.h"
-#include "xfa/fxfa/parser/xfa_object.h"
#include "xfa/fxfa/parser/xfa_utils.h"
-#include "xfa/fxfa/xfa_ffwidgethandler.h"
namespace {
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cscript_eventpseudomodel.h b/chromium/third_party/pdfium/xfa/fxfa/parser/cscript_eventpseudomodel.h
index 6415287c8e3..dfad255d7ef 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cscript_eventpseudomodel.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cscript_eventpseudomodel.h
@@ -8,7 +8,7 @@
#define XFA_FXFA_PARSER_CSCRIPT_EVENTPSEUDOMODEL_H_
#include "fxjs/cfxjse_arguments.h"
-#include "xfa/fxfa/parser/xfa_object.h"
+#include "xfa/fxfa/parser/cxfa_object.h"
enum class XFA_Event {
Change = 0,
@@ -63,7 +63,7 @@ class CScript_EventPseudoModel : public CXFA_Object {
void Emit(CFXJSE_Arguments* pArguments);
void Reset(CFXJSE_Arguments* pArguments);
- protected:
+ private:
void Property(CFXJSE_Value* pValue, XFA_Event dwFlag, bool bSetting);
};
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cscript_hostpseudomodel.cpp b/chromium/third_party/pdfium/xfa/fxfa/parser/cscript_hostpseudomodel.cpp
index a06e02f56d3..d2633ec4aee 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cscript_hostpseudomodel.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cscript_hostpseudomodel.cpp
@@ -12,9 +12,9 @@
#include "xfa/fxfa/app/xfa_ffnotify.h"
#include "xfa/fxfa/parser/cxfa_document.h"
#include "xfa/fxfa/parser/cxfa_layoutprocessor.h"
+#include "xfa/fxfa/parser/cxfa_localemgr.h"
+#include "xfa/fxfa/parser/cxfa_node.h"
#include "xfa/fxfa/parser/cxfa_scriptcontext.h"
-#include "xfa/fxfa/parser/xfa_localemgr.h"
-#include "xfa/fxfa/parser/xfa_object.h"
#include "xfa/fxfa/parser/xfa_resolvenode_rs.h"
#include "xfa/fxfa/parser/xfa_utils.h"
@@ -224,6 +224,7 @@ void CScript_HostPseudoModel::GotoURL(CFXJSE_Arguments* pArguments) {
}
pNotify->GetDocEnvironment()->GotoURL(hDoc, wsURL);
}
+
void CScript_HostPseudoModel::OpenList(CFXJSE_Arguments* pArguments) {
if (!m_pDocument->GetScriptContext()->IsRunAtClient()) {
return;
@@ -256,10 +257,10 @@ void CScript_HostPseudoModel::OpenList(CFXJSE_Arguments* pArguments) {
XFA_RESOLVENODE_RS resoveNodeRS;
int32_t iRet = pScriptContext->ResolveObjects(
pObject, pValue->ToWideString().AsStringC(), resoveNodeRS, dwFlag);
- if (iRet < 1 || !resoveNodeRS.nodes[0]->IsNode())
+ if (iRet < 1 || !resoveNodeRS.objects.front()->IsNode())
return;
- pNode = resoveNodeRS.nodes[0]->AsNode();
+ pNode = resoveNodeRS.objects.front()->AsNode();
}
}
CXFA_LayoutProcessor* pDocLayout = m_pDocument->GetDocLayout();
@@ -322,10 +323,10 @@ static int32_t XFA_FilterName(const CFX_WideStringC& wsExpression,
if (nStart >= iLength) {
return iLength;
}
- FX_WCHAR* pBuf = wsFilter.GetBuffer(iLength - nStart);
+ wchar_t* pBuf = wsFilter.GetBuffer(iLength - nStart);
int32_t nCount = 0;
- const FX_WCHAR* pSrc = wsExpression.c_str();
- FX_WCHAR wCur;
+ const wchar_t* pSrc = wsExpression.c_str();
+ wchar_t wCur;
while (nStart < iLength) {
wCur = pSrc[nStart++];
if (wCur == ',') {
@@ -364,22 +365,22 @@ void CScript_HostPseudoModel::ResetData(CFXJSE_Arguments* pArguments) {
while (iStart < iExpLength) {
iStart = XFA_FilterName(wsExpression.AsStringC(), iStart, wsName);
CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext();
- if (!pScriptContext) {
+ if (!pScriptContext)
return;
- }
+
CXFA_Object* pObject = pScriptContext->GetThisObject();
- if (!pObject) {
+ if (!pObject)
return;
- }
+
uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Parent |
XFA_RESOLVENODE_Siblings;
XFA_RESOLVENODE_RS resoveNodeRS;
int32_t iRet = pScriptContext->ResolveObjects(pObject, wsName.AsStringC(),
resoveNodeRS, dwFlag);
- if (iRet < 1 || !resoveNodeRS.nodes[0]->IsNode()) {
+ if (iRet < 1 || !resoveNodeRS.objects.front()->IsNode()) {
continue;
}
- pNode = resoveNodeRS.nodes[0]->AsNode();
+ pNode = resoveNodeRS.objects.front()->AsNode();
pNotify->ResetData(pNode->GetWidgetData());
}
if (!pNode) {
@@ -437,10 +438,10 @@ void CScript_HostPseudoModel::SetFocus(CFXJSE_Arguments* pArguments) {
XFA_RESOLVENODE_RS resoveNodeRS;
int32_t iRet = pScriptContext->ResolveObjects(
pObject, pValue->ToWideString().AsStringC(), resoveNodeRS, dwFlag);
- if (iRet < 1 || !resoveNodeRS.nodes[0]->IsNode())
+ if (iRet < 1 || !resoveNodeRS.objects.front()->IsNode())
return;
- pNode = resoveNodeRS.nodes[0]->AsNode();
+ pNode = resoveNodeRS.objects.front()->AsNode();
}
}
pNotify->SetFocusWidgetNode(pNode);
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cscript_hostpseudomodel.h b/chromium/third_party/pdfium/xfa/fxfa/parser/cscript_hostpseudomodel.h
index 7d24a1d2b42..821f88d1376 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cscript_hostpseudomodel.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cscript_hostpseudomodel.h
@@ -7,9 +7,10 @@
#ifndef XFA_FXFA_PARSER_CSCRIPT_HOSTPSEUDOMODEL_H_
#define XFA_FXFA_PARSER_CSCRIPT_HOSTPSEUDOMODEL_H_
-#include "fxjs/cfxjse_arguments.h"
-#include "xfa/fxfa/parser/cxfa_document.h"
-#include "xfa/fxfa/parser/xfa_object.h"
+#include "xfa/fxfa/parser/cxfa_object.h"
+
+class CFXJSE_Arguments;
+class CXFA_Document;
class CScript_HostPseudoModel : public CXFA_Object {
public:
@@ -50,12 +51,10 @@ class CScript_HostPseudoModel : public CXFA_Object {
void PageDown(CFXJSE_Arguments* pArguments);
void CurrentDateTime(CFXJSE_Arguments* pArguments);
- protected:
+ private:
bool ValidateArgsForMsg(CFXJSE_Arguments* pArguments,
int32_t iArgIndex,
CFX_WideString& wsValue);
-
- private:
void ThrowSetLanguageException() const;
void ThrowSetNumPagesException() const;
void ThrowSetPlatformException() const;
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp b/chromium/third_party/pdfium/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp
index 152b5686195..693d4029a36 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp
@@ -11,16 +11,17 @@
#include "fxjs/cfxjse_arguments.h"
#include "third_party/base/stl_util.h"
#include "xfa/fxfa/app/xfa_ffnotify.h"
+#include "xfa/fxfa/parser/cxfa_arraynodelist.h"
#include "xfa/fxfa/parser/cxfa_containerlayoutitem.h"
#include "xfa/fxfa/parser/cxfa_contentlayoutitem.h"
#include "xfa/fxfa/parser/cxfa_document.h"
#include "xfa/fxfa/parser/cxfa_layoutitem.h"
#include "xfa/fxfa/parser/cxfa_layoutprocessor.h"
+#include "xfa/fxfa/parser/cxfa_localemgr.h"
#include "xfa/fxfa/parser/cxfa_measurement.h"
+#include "xfa/fxfa/parser/cxfa_node.h"
#include "xfa/fxfa/parser/cxfa_scriptcontext.h"
#include "xfa/fxfa/parser/cxfa_traversestrategy_contentlayoutitem.h"
-#include "xfa/fxfa/parser/xfa_localemgr.h"
-#include "xfa/fxfa/parser/xfa_object.h"
#include "xfa/fxfa/parser/xfa_utils.h"
CScript_LayoutPseudoModel::CScript_LayoutPseudoModel(CXFA_Document* pDocument)
@@ -50,7 +51,7 @@ void CScript_LayoutPseudoModel::HWXY(CFXJSE_Arguments* pArguments,
XFA_LAYOUTMODEL_HWXY layoutModel) {
int32_t iLength = pArguments->GetLength();
if (iLength < 1 || iLength > 3) {
- const FX_WCHAR* methodName = nullptr;
+ const wchar_t* methodName = nullptr;
switch (layoutModel) {
case XFA_LAYOUTMODEL_H:
methodName = L"h";
@@ -122,7 +123,7 @@ void CScript_LayoutPseudoModel::HWXY(CFXJSE_Arguments* pArguments,
break;
}
XFA_UNIT unit = measure.GetUnit(wsUnit.AsStringC());
- FX_FLOAT fValue = measure.ToUnit(unit);
+ float fValue = measure.ToUnit(unit);
fValue = FXSYS_round(fValue * 1000) / 1000.0f;
if (pValue)
pValue->SetFloat(fValue);
@@ -209,39 +210,38 @@ void CScript_LayoutPseudoModel::Page(CFXJSE_Arguments* pArguments) {
PageImp(pArguments, false);
}
-void CScript_LayoutPseudoModel::GetObjArray(CXFA_LayoutProcessor* pDocLayout,
- int32_t iPageNo,
- const CFX_WideString& wsType,
- bool bOnPageArea,
- CXFA_NodeArray& retArray) {
+std::vector<CXFA_Node*> CScript_LayoutPseudoModel::GetObjArray(
+ CXFA_LayoutProcessor* pDocLayout,
+ int32_t iPageNo,
+ const CFX_WideString& wsType,
+ bool bOnPageArea) {
CXFA_ContainerLayoutItem* pLayoutPage = pDocLayout->GetPage(iPageNo);
- if (!pLayoutPage) {
- return;
- }
+ if (!pLayoutPage)
+ return std::vector<CXFA_Node*>();
+
+ std::vector<CXFA_Node*> retArray;
if (wsType == L"pageArea") {
- if (CXFA_Node* pMasterPage = pLayoutPage->m_pFormNode) {
- retArray.Add(pMasterPage);
- }
- return;
+ if (pLayoutPage->m_pFormNode)
+ retArray.push_back(pLayoutPage->m_pFormNode);
+ return retArray;
}
if (wsType == L"contentArea") {
for (CXFA_LayoutItem* pItem = pLayoutPage->m_pFirstChild; pItem;
pItem = pItem->m_pNextSibling) {
- if (pItem->m_pFormNode->GetElementType() == XFA_Element::ContentArea) {
- retArray.Add(pItem->m_pFormNode);
- }
+ if (pItem->m_pFormNode->GetElementType() == XFA_Element::ContentArea)
+ retArray.push_back(pItem->m_pFormNode);
}
- return;
+ return retArray;
}
std::set<CXFA_Node*> formItems;
if (wsType.IsEmpty()) {
- if (CXFA_Node* pMasterPage = pLayoutPage->m_pFormNode) {
- retArray.Add(pMasterPage);
- }
+ if (pLayoutPage->m_pFormNode)
+ retArray.push_back(pLayoutPage->m_pFormNode);
+
for (CXFA_LayoutItem* pItem = pLayoutPage->m_pFirstChild; pItem;
pItem = pItem->m_pNextSibling) {
if (pItem->m_pFormNode->GetElementType() == XFA_Element::ContentArea) {
- retArray.Add(pItem->m_pFormNode);
+ retArray.push_back(pItem->m_pFormNode);
if (!bOnPageArea) {
CXFA_NodeIteratorTemplate<CXFA_ContentLayoutItem,
CXFA_TraverseStrategy_ContentLayoutItem>
@@ -260,7 +260,7 @@ void CScript_LayoutPseudoModel::GetObjArray(CXFA_LayoutProcessor* pDocLayout,
continue;
formItems.insert(pItemChild->m_pFormNode);
- retArray.Add(pItemChild->m_pFormNode);
+ retArray.push_back(pItemChild->m_pFormNode);
}
}
} else {
@@ -281,12 +281,12 @@ void CScript_LayoutPseudoModel::GetObjArray(CXFA_LayoutProcessor* pDocLayout,
if (pdfium::ContainsValue(formItems, pItemChild->m_pFormNode))
continue;
formItems.insert(pItemChild->m_pFormNode);
- retArray.Add(pItemChild->m_pFormNode);
+ retArray.push_back(pItemChild->m_pFormNode);
}
}
}
}
- return;
+ return retArray;
}
XFA_Element eType = XFA_Element::Unknown;
if (wsType == L"field") {
@@ -315,7 +315,7 @@ void CScript_LayoutPseudoModel::GetObjArray(CXFA_LayoutProcessor* pDocLayout,
if (pdfium::ContainsValue(formItems, pItemChild->m_pFormNode))
continue;
formItems.insert(pItemChild->m_pFormNode);
- retArray.Add(pItemChild->m_pFormNode);
+ retArray.push_back(pItemChild->m_pFormNode);
}
}
} else {
@@ -332,13 +332,13 @@ void CScript_LayoutPseudoModel::GetObjArray(CXFA_LayoutProcessor* pDocLayout,
if (pdfium::ContainsValue(formItems, pItemChild->m_pFormNode))
continue;
formItems.insert(pItemChild->m_pFormNode);
- retArray.Add(pItemChild->m_pFormNode);
+ retArray.push_back(pItemChild->m_pFormNode);
}
}
}
}
- return;
}
+ return retArray;
}
void CScript_LayoutPseudoModel::PageContent(CFXJSE_Arguments* pArguments) {
@@ -350,30 +350,30 @@ void CScript_LayoutPseudoModel::PageContent(CFXJSE_Arguments* pArguments) {
int32_t iIndex = 0;
CFX_WideString wsType;
bool bOnPageArea = false;
- if (iLength >= 1) {
+ if (iLength >= 1)
iIndex = pArguments->GetInt32(0);
- }
+
if (iLength >= 2) {
CFX_ByteString bsType = pArguments->GetUTF8String(1);
wsType = CFX_WideString::FromUTF8(bsType.AsStringC());
}
- if (iLength >= 3) {
+ if (iLength >= 3)
bOnPageArea = pArguments->GetInt32(2) == 0 ? false : true;
- }
+
CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
- if (!pNotify) {
+ if (!pNotify)
return;
- }
+
CXFA_LayoutProcessor* pDocLayout = m_pDocument->GetDocLayout();
- if (!pDocLayout) {
+ if (!pDocLayout)
return;
- }
- CXFA_NodeArray retArray;
- GetObjArray(pDocLayout, iIndex, wsType, bOnPageArea, retArray);
- CXFA_ArrayNodeList* pArrayNodeList = new CXFA_ArrayNodeList(m_pDocument);
- pArrayNodeList->SetArrayNodeList(retArray);
+
+ auto pArrayNodeList = pdfium::MakeUnique<CXFA_ArrayNodeList>(m_pDocument);
+ pArrayNodeList->SetArrayNodeList(
+ GetObjArray(pDocLayout, iIndex, wsType, bOnPageArea));
pArguments->GetReturnValue()->SetObject(
- pArrayNodeList, m_pDocument->GetScriptContext()->GetJseNormalClass());
+ pArrayNodeList.release(),
+ m_pDocument->GetScriptContext()->GetJseNormalClass());
}
void CScript_LayoutPseudoModel::AbsPageCount(CFXJSE_Arguments* pArguments) {
@@ -397,12 +397,11 @@ void CScript_LayoutPseudoModel::SheetCountInBatch(
void CScript_LayoutPseudoModel::Relayout(CFXJSE_Arguments* pArguments) {
CXFA_Node* pRootNode = m_pDocument->GetRoot();
CXFA_Node* pFormRoot = pRootNode->GetFirstChildByClass(XFA_Element::Form);
- ASSERT(pFormRoot);
CXFA_Node* pContentRootNode = pFormRoot->GetNodeItem(XFA_NODEITEM_FirstChild);
CXFA_LayoutProcessor* pLayoutProcessor = m_pDocument->GetLayoutProcessor();
- if (pContentRootNode) {
+ if (pContentRootNode)
pLayoutProcessor->AddChangedContainer(pContentRootNode);
- }
+
pLayoutProcessor->SetForceReLayout(true);
}
@@ -451,7 +450,7 @@ void CScript_LayoutPseudoModel::PageImp(CFXJSE_Arguments* pArguments,
bool bAbsPage) {
int32_t iLength = pArguments->GetLength();
if (iLength != 1) {
- const FX_WCHAR* methodName;
+ const wchar_t* methodName;
if (bAbsPage) {
methodName = L"absPage";
} else {
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cscript_layoutpseudomodel.h b/chromium/third_party/pdfium/xfa/fxfa/parser/cscript_layoutpseudomodel.h
index 55a00db14ae..ea31a4205ef 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cscript_layoutpseudomodel.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cscript_layoutpseudomodel.h
@@ -7,8 +7,9 @@
#ifndef XFA_FXFA_PARSER_CSCRIPT_LAYOUTPSEUDOMODEL_H_
#define XFA_FXFA_PARSER_CSCRIPT_LAYOUTPSEUDOMODEL_H_
-#include "fxjs/cfxjse_arguments.h"
-#include "xfa/fxfa/parser/xfa_object.h"
+#include <vector>
+
+#include "xfa/fxfa/parser/cxfa_object.h"
enum XFA_LAYOUTMODEL_HWXY {
XFA_LAYOUTMODEL_H,
@@ -17,6 +18,7 @@ enum XFA_LAYOUTMODEL_HWXY {
XFA_LAYOUTMODEL_Y
};
+class CFXJSE_Arguments;
class CXFA_LayoutProcessor;
class CScript_LayoutPseudoModel : public CXFA_Object {
@@ -48,15 +50,12 @@ class CScript_LayoutPseudoModel : public CXFA_Object {
void SheetCount(CFXJSE_Arguments* pArguments);
void AbsPage(CFXJSE_Arguments* pArguments);
- protected:
- void GetObjArray(CXFA_LayoutProcessor* pDocLayout,
- int32_t iPageNo,
- const CFX_WideString& wsType,
- bool bOnPageArea,
- CXFA_NodeArray& retArray);
- void PageImp(CFXJSE_Arguments* pArguments, bool bAbsPage);
-
private:
+ std::vector<CXFA_Node*> GetObjArray(CXFA_LayoutProcessor* pDocLayout,
+ int32_t iPageNo,
+ const CFX_WideString& wsType,
+ bool bOnPageArea);
+ void PageImp(CFXJSE_Arguments* pArguments, bool bAbsPage);
void ThrowSetReadyException() const;
};
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cscript_logpseudomodel.cpp b/chromium/third_party/pdfium/xfa/fxfa/parser/cscript_logpseudomodel.cpp
index 48ccce027fa..d9563ac93e7 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cscript_logpseudomodel.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cscript_logpseudomodel.cpp
@@ -8,8 +8,7 @@
#include "fxjs/cfxjse_arguments.h"
#include "xfa/fxfa/parser/cxfa_document.h"
-#include "xfa/fxfa/parser/xfa_localemgr.h"
-#include "xfa/fxfa/parser/xfa_object.h"
+#include "xfa/fxfa/parser/cxfa_localemgr.h"
#include "xfa/fxfa/parser/xfa_utils.h"
CScript_LogPseudoModel::CScript_LogPseudoModel(CXFA_Document* pDocument)
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cscript_logpseudomodel.h b/chromium/third_party/pdfium/xfa/fxfa/parser/cscript_logpseudomodel.h
index 18f9f51ae7a..2e465e851b5 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cscript_logpseudomodel.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cscript_logpseudomodel.h
@@ -7,8 +7,9 @@
#ifndef XFA_FXFA_PARSER_CSCRIPT_LOGPSEUDOMODEL_H_
#define XFA_FXFA_PARSER_CSCRIPT_LOGPSEUDOMODEL_H_
-#include "fxjs/cfxjse_arguments.h"
-#include "xfa/fxfa/parser/xfa_object.h"
+#include "xfa/fxfa/parser/cxfa_object.h"
+
+class CFXJSE_Arguments;
class CScript_LogPseudoModel : public CXFA_Object {
public:
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cscript_signaturepseudomodel.cpp b/chromium/third_party/pdfium/xfa/fxfa/parser/cscript_signaturepseudomodel.cpp
index e5874a61cc6..0886809db1b 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cscript_signaturepseudomodel.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cscript_signaturepseudomodel.cpp
@@ -9,9 +9,8 @@
#include "fxjs/cfxjse_arguments.h"
#include "xfa/fxfa/app/xfa_ffnotify.h"
#include "xfa/fxfa/parser/cxfa_document.h"
+#include "xfa/fxfa/parser/cxfa_localemgr.h"
#include "xfa/fxfa/parser/cxfa_scriptcontext.h"
-#include "xfa/fxfa/parser/xfa_localemgr.h"
-#include "xfa/fxfa/parser/xfa_object.h"
#include "xfa/fxfa/parser/xfa_utils.h"
CScript_SignaturePseudoModel::CScript_SignaturePseudoModel(
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cscript_signaturepseudomodel.h b/chromium/third_party/pdfium/xfa/fxfa/parser/cscript_signaturepseudomodel.h
index 4f9ded06632..ee527443206 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cscript_signaturepseudomodel.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cscript_signaturepseudomodel.h
@@ -7,8 +7,9 @@
#ifndef XFA_FXFA_PARSER_CSCRIPT_SIGNATUREPSEUDOMODEL_H_
#define XFA_FXFA_PARSER_CSCRIPT_SIGNATUREPSEUDOMODEL_H_
-#include "fxjs/cfxjse_arguments.h"
-#include "xfa/fxfa/parser/xfa_object.h"
+#include "xfa/fxfa/parser/cxfa_object.h"
+
+class CFXJSE_Arguments;
class CScript_SignaturePseudoModel : public CXFA_Object {
public:
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_arraynodelist.cpp b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_arraynodelist.cpp
index 8c9040a1214..03966c3c6c1 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_arraynodelist.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_arraynodelist.cpp
@@ -4,58 +4,51 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/fxfa/parser/xfa_object.h"
+#include "xfa/fxfa/parser/cxfa_arraynodelist.h"
+
+#include <vector>
+
+#include "third_party/base/stl_util.h"
CXFA_ArrayNodeList::CXFA_ArrayNodeList(CXFA_Document* pDocument)
: CXFA_NodeList(pDocument) {}
CXFA_ArrayNodeList::~CXFA_ArrayNodeList() {}
-void CXFA_ArrayNodeList::SetArrayNodeList(const CXFA_NodeArray& srcArray) {
- if (srcArray.GetSize() > 0) {
- m_array.Copy(srcArray);
- }
+void CXFA_ArrayNodeList::SetArrayNodeList(
+ const std::vector<CXFA_Node*>& srcArray) {
+ if (!srcArray.empty())
+ m_array = srcArray;
}
int32_t CXFA_ArrayNodeList::GetLength() {
- return m_array.GetSize();
+ return pdfium::CollectionSize<int32_t>(m_array);
}
bool CXFA_ArrayNodeList::Append(CXFA_Node* pNode) {
- m_array.Add(pNode);
+ m_array.push_back(pNode);
return true;
}
bool CXFA_ArrayNodeList::Insert(CXFA_Node* pNewNode, CXFA_Node* pBeforeNode) {
if (!pBeforeNode) {
- m_array.Add(pNewNode);
+ m_array.push_back(pNewNode);
} else {
- int32_t iSize = m_array.GetSize();
- for (int32_t i = 0; i < iSize; ++i) {
- if (m_array[i] == pBeforeNode) {
- m_array.InsertAt(i, pNewNode);
- break;
- }
- }
+ auto it = std::find(m_array.begin(), m_array.end(), pBeforeNode);
+ if (it != m_array.end())
+ m_array.insert(it, pNewNode);
}
return true;
}
bool CXFA_ArrayNodeList::Remove(CXFA_Node* pNode) {
- int32_t iSize = m_array.GetSize();
- for (int32_t i = 0; i < iSize; ++i) {
- if (m_array[i] == pNode) {
- m_array.RemoveAt(i);
- break;
- }
- }
+ auto it = std::find(m_array.begin(), m_array.end(), pNode);
+ if (it != m_array.end())
+ m_array.erase(it);
return true;
}
CXFA_Node* CXFA_ArrayNodeList::Item(int32_t iIndex) {
- int32_t iSize = m_array.GetSize();
- if (iIndex >= 0 && iIndex < iSize) {
- return m_array[iIndex];
- }
- return nullptr;
+ int32_t iSize = pdfium::CollectionSize<int32_t>(m_array);
+ return (iIndex >= 0 && iIndex < iSize) ? m_array[iIndex] : nullptr;
}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_arraynodelist.h b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_arraynodelist.h
new file mode 100644
index 00000000000..ba00f3045e5
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_arraynodelist.h
@@ -0,0 +1,35 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef XFA_FXFA_PARSER_CXFA_ARRAYNODELIST_H_
+#define XFA_FXFA_PARSER_CXFA_ARRAYNODELIST_H_
+
+#include <vector>
+
+#include "xfa/fxfa/parser/cxfa_nodelist.h"
+
+class CXFA_Document;
+class CXFA_Node;
+
+class CXFA_ArrayNodeList : public CXFA_NodeList {
+ public:
+ explicit CXFA_ArrayNodeList(CXFA_Document* pDocument);
+ ~CXFA_ArrayNodeList() override;
+
+ // From CXFA_NodeList.
+ int32_t GetLength() override;
+ bool Append(CXFA_Node* pNode) override;
+ bool Insert(CXFA_Node* pNewNode, CXFA_Node* pBeforeNode) override;
+ bool Remove(CXFA_Node* pNode) override;
+ CXFA_Node* Item(int32_t iIndex) override;
+
+ void SetArrayNodeList(const std::vector<CXFA_Node*>& srcArray);
+
+ private:
+ std::vector<CXFA_Node*> m_array;
+};
+
+#endif // XFA_FXFA_PARSER_CXFA_ARRAYNODELIST_H_
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_assist.cpp b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_assist.cpp
index 894e729d6d2..809081d9601 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_assist.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_assist.cpp
@@ -6,7 +6,7 @@
#include "xfa/fxfa/parser/cxfa_assist.h"
-#include "xfa/fxfa/parser/xfa_object.h"
+#include "xfa/fxfa/parser/cxfa_node.h"
CXFA_Assist::CXFA_Assist(CXFA_Node* pNode) : CXFA_Data(pNode) {}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_attachnodelist.cpp b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_attachnodelist.cpp
index c23b900af69..9c0b0fd18eb 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_attachnodelist.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_attachnodelist.cpp
@@ -4,7 +4,9 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/fxfa/parser/xfa_object.h"
+#include "xfa/fxfa/parser/cxfa_attachnodelist.h"
+
+#include "xfa/fxfa/parser/cxfa_node.h"
CXFA_AttachNodeList::CXFA_AttachNodeList(CXFA_Document* pDocument,
CXFA_Node* pAttachNode)
@@ -20,17 +22,17 @@ int32_t CXFA_AttachNodeList::GetLength() {
bool CXFA_AttachNodeList::Append(CXFA_Node* pNode) {
CXFA_Node* pParent = pNode->GetNodeItem(XFA_NODEITEM_Parent);
- if (pParent) {
+ if (pParent)
pParent->RemoveChild(pNode);
- }
+
return m_pAttachNode->InsertChild(pNode);
}
bool CXFA_AttachNodeList::Insert(CXFA_Node* pNewNode, CXFA_Node* pBeforeNode) {
CXFA_Node* pParent = pNewNode->GetNodeItem(XFA_NODEITEM_Parent);
- if (pParent) {
+ if (pParent)
pParent->RemoveChild(pNewNode);
- }
+
return m_pAttachNode->InsertChild(pNewNode, pBeforeNode);
}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_attachnodelist.h b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_attachnodelist.h
new file mode 100644
index 00000000000..3bb771a476e
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_attachnodelist.h
@@ -0,0 +1,30 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef XFA_FXFA_PARSER_CXFA_ATTACHNODELIST_H_
+#define XFA_FXFA_PARSER_CXFA_ATTACHNODELIST_H_
+
+#include "xfa/fxfa/parser/cxfa_nodelist.h"
+
+class CXFA_Document;
+class CXFA_Node;
+
+class CXFA_AttachNodeList : public CXFA_NodeList {
+ public:
+ CXFA_AttachNodeList(CXFA_Document* pDocument, CXFA_Node* pAttachNode);
+
+ // From CXFA_NodeList.
+ int32_t GetLength() override;
+ bool Append(CXFA_Node* pNode) override;
+ bool Insert(CXFA_Node* pNewNode, CXFA_Node* pBeforeNode) override;
+ bool Remove(CXFA_Node* pNode) override;
+ CXFA_Node* Item(int32_t iIndex) override;
+
+ private:
+ CXFA_Node* m_pAttachNode;
+};
+
+#endif // XFA_FXFA_PARSER_CXFA_ATTACHNODELIST_H_
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_bind.cpp b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_bind.cpp
index 16efd1f4404..aac2c183212 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_bind.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_bind.cpp
@@ -6,7 +6,7 @@
#include "xfa/fxfa/parser/cxfa_bind.h"
-#include "xfa/fxfa/parser/xfa_object.h"
+#include "xfa/fxfa/parser/cxfa_node.h"
CXFA_Bind::CXFA_Bind(CXFA_Node* pNode) : CXFA_Data(pNode) {}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_binditems.cpp b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_binditems.cpp
index fdb4f0c3762..c3c5cabe4ec 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_binditems.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_binditems.cpp
@@ -6,7 +6,7 @@
#include "xfa/fxfa/parser/cxfa_binditems.h"
-#include "xfa/fxfa/parser/xfa_object.h"
+#include "xfa/fxfa/parser/cxfa_node.h"
CXFA_BindItems::CXFA_BindItems(CXFA_Node* pNode) : CXFA_Data(pNode) {}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_box.cpp b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_box.cpp
index 552c98031a4..300edd01ad3 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_box.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_box.cpp
@@ -8,7 +8,7 @@
#include "xfa/fxfa/parser/cxfa_corner.h"
#include "xfa/fxfa/parser/cxfa_measurement.h"
-#include "xfa/fxfa/parser/xfa_object.h"
+#include "xfa/fxfa/parser/cxfa_node.h"
namespace {
@@ -109,7 +109,7 @@ bool CXFA_Box::IsCircular() const {
return m_pNode->GetBoolean(XFA_ATTRIBUTE_Circular);
}
-bool CXFA_Box::GetStartAngle(FX_FLOAT& fStartAngle) const {
+bool CXFA_Box::GetStartAngle(float& fStartAngle) const {
fStartAngle = 0;
if (!m_pNode)
return false;
@@ -122,7 +122,7 @@ bool CXFA_Box::GetStartAngle(FX_FLOAT& fStartAngle) const {
return bRet;
}
-bool CXFA_Box::GetSweepAngle(FX_FLOAT& fSweepAngle) const {
+bool CXFA_Box::GetSweepAngle(float& fSweepAngle) const {
fSweepAngle = 360;
if (!m_pNode)
return false;
@@ -148,7 +148,7 @@ CXFA_Margin CXFA_Box::GetMargin() const {
: nullptr);
}
-int32_t CXFA_Box::Get3DStyle(bool& bVisible, FX_FLOAT& fThickness) const {
+int32_t CXFA_Box::Get3DStyle(bool& bVisible, float& fThickness) const {
if (IsArc())
return 0;
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_box.h b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_box.h
index a0af2f449b2..d2b79fae566 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_box.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_box.h
@@ -32,23 +32,23 @@ class CXFA_Box : public CXFA_Data {
CXFA_Edge GetEdge(int32_t nIndex = 0) const;
void GetStrokes(std::vector<CXFA_Stroke>* strokes) const;
bool IsCircular() const;
- bool GetStartAngle(FX_FLOAT& fStartAngle) const;
- FX_FLOAT GetStartAngle() const {
- FX_FLOAT fStartAngle;
+ bool GetStartAngle(float& fStartAngle) const;
+ float GetStartAngle() const {
+ float fStartAngle;
GetStartAngle(fStartAngle);
return fStartAngle;
}
- bool GetSweepAngle(FX_FLOAT& fSweepAngle) const;
- FX_FLOAT GetSweepAngle() const {
- FX_FLOAT fSweepAngle;
+ bool GetSweepAngle(float& fSweepAngle) const;
+ float GetSweepAngle() const {
+ float fSweepAngle;
GetSweepAngle(fSweepAngle);
return fSweepAngle;
}
CXFA_Fill GetFill(bool bModified = false) const;
CXFA_Margin GetMargin() const;
- int32_t Get3DStyle(bool& bVisible, FX_FLOAT& fThickness) const;
+ int32_t Get3DStyle(bool& bVisible, float& fThickness) const;
};
#endif // XFA_FXFA_PARSER_CXFA_BOX_H_
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_calculate.cpp b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_calculate.cpp
index d7b1f71caa8..bc89d817772 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_calculate.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_calculate.cpp
@@ -6,8 +6,8 @@
#include "xfa/fxfa/parser/cxfa_calculate.h"
+#include "xfa/fxfa/parser/cxfa_node.h"
#include "xfa/fxfa/parser/cxfa_text.h"
-#include "xfa/fxfa/parser/xfa_object.h"
CXFA_Calculate::CXFA_Calculate(CXFA_Node* pNode) : CXFA_Data(pNode) {}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_caption.cpp b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_caption.cpp
index 7f9e88e8e7f..1be4a206e72 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_caption.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_caption.cpp
@@ -7,7 +7,7 @@
#include "xfa/fxfa/parser/cxfa_caption.h"
#include "xfa/fxfa/parser/cxfa_measurement.h"
-#include "xfa/fxfa/parser/xfa_object.h"
+#include "xfa/fxfa/parser/cxfa_node.h"
CXFA_Caption::CXFA_Caption(CXFA_Node* pNode) : CXFA_Data(pNode) {}
@@ -23,7 +23,7 @@ int32_t CXFA_Caption::GetPlacementType() {
return eAttr;
}
-FX_FLOAT CXFA_Caption::GetReserve() {
+float CXFA_Caption::GetReserve() {
CXFA_Measurement ms;
m_pNode->TryMeasure(XFA_ATTRIBUTE_Reserve, ms);
return ms.ToUnit(XFA_UNIT_Pt);
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_caption.h b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_caption.h
index 70dd435653f..74650ef9a23 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_caption.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_caption.h
@@ -20,7 +20,7 @@ class CXFA_Caption : public CXFA_Data {
int32_t GetPresence();
int32_t GetPlacementType();
- FX_FLOAT GetReserve();
+ float GetReserve();
CXFA_Margin GetMargin();
CXFA_Font GetFont();
CXFA_Value GetValue();
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_containerlayoutitem.cpp b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_containerlayoutitem.cpp
index 5ef29f14cfb..cf4e1ce3f33 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_containerlayoutitem.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_containerlayoutitem.cpp
@@ -9,6 +9,7 @@
#include "xfa/fxfa/parser/cxfa_layoutpagemgr.h"
#include "xfa/fxfa/parser/cxfa_layoutprocessor.h"
#include "xfa/fxfa/parser/cxfa_measurement.h"
+#include "xfa/fxfa/parser/cxfa_node.h"
CXFA_ContainerLayoutItem::CXFA_ContainerLayoutItem(CXFA_Node* pNode)
: CXFA_LayoutItem(pNode, false), m_pOldSubform(nullptr) {}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_contentlayoutitem.cpp b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_contentlayoutitem.cpp
index a10a6782794..c8acff2b1c3 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_contentlayoutitem.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_contentlayoutitem.cpp
@@ -6,6 +6,8 @@
#include "xfa/fxfa/parser/cxfa_contentlayoutitem.h"
+#include "xfa/fxfa/parser/cxfa_node.h"
+
CXFA_ContentLayoutItem::CXFA_ContentLayoutItem(CXFA_Node* pNode)
: CXFA_LayoutItem(pNode, true),
m_pPrev(nullptr),
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_contentlayoutitem.h b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_contentlayoutitem.h
index 9ac1dceb425..9d1fc2abcfb 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_contentlayoutitem.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_contentlayoutitem.h
@@ -9,6 +9,8 @@
#include "xfa/fxfa/parser/cxfa_layoutitem.h"
+#define XFA_LAYOUTITEMKEY (void*)(uintptr_t) FXBSTR_ID('L', 'Y', 'I', 'M')
+
class CXFA_ContentLayoutItem : public CXFA_LayoutItem {
public:
explicit CXFA_ContentLayoutItem(CXFA_Node* pNode);
@@ -18,7 +20,7 @@ class CXFA_ContentLayoutItem : public CXFA_LayoutItem {
CXFA_ContentLayoutItem* m_pNext;
CFX_PointF m_sPos;
CFX_SizeF m_sSize;
- uint32_t m_dwStatus;
+ mutable uint32_t m_dwStatus;
};
inline CXFA_ContentLayoutItem* ToContentLayoutItem(CXFA_LayoutItem* pItem) {
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_data.cpp b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_data.cpp
index 19f85088b8d..9f265b41be3 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_data.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_data.cpp
@@ -8,7 +8,7 @@
#include "core/fxcrt/fx_ext.h"
#include "xfa/fxfa/parser/cxfa_measurement.h"
-#include "xfa/fxfa/parser/xfa_object.h"
+#include "xfa/fxfa/parser/cxfa_node.h"
// Static.
FX_ARGB CXFA_Data::ToColor(const CFX_WideStringC& wsValue) {
@@ -17,7 +17,7 @@ FX_ARGB CXFA_Data::ToColor(const CFX_WideStringC& wsValue) {
return 0xff000000;
int cc = 0;
- const FX_WCHAR* str = wsValue.c_str();
+ const wchar_t* str = wsValue.c_str();
int len = wsValue.GetLength();
while (FXSYS_iswspace(str[cc]) && cc < len)
cc++;
@@ -66,7 +66,7 @@ XFA_Element CXFA_Data::GetElementType() const {
}
bool CXFA_Data::TryMeasure(XFA_ATTRIBUTE eAttr,
- FX_FLOAT& fValue,
+ float& fValue,
bool bUseDefault) const {
CXFA_Measurement ms;
if (m_pNode->TryMeasure(eAttr, ms, bUseDefault)) {
@@ -76,7 +76,7 @@ bool CXFA_Data::TryMeasure(XFA_ATTRIBUTE eAttr,
return false;
}
-bool CXFA_Data::SetMeasure(XFA_ATTRIBUTE eAttr, FX_FLOAT fValue) {
+bool CXFA_Data::SetMeasure(XFA_ATTRIBUTE eAttr, float fValue) {
CXFA_Measurement ms(fValue, XFA_UNIT_Pt);
return m_pNode->SetMeasure(eAttr, ms);
}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_data.h b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_data.h
index 890486d5fa5..90b689020b2 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_data.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_data.h
@@ -19,15 +19,15 @@ class CXFA_Data {
explicit CXFA_Data(CXFA_Node* pNode) : m_pNode(pNode) {}
- operator bool() const { return !!m_pNode; }
+ explicit operator bool() const { return !!m_pNode; }
CXFA_Node* GetNode() const { return m_pNode; }
XFA_Element GetElementType() const;
protected:
bool TryMeasure(XFA_ATTRIBUTE eAttr,
- FX_FLOAT& fValue,
+ float& fValue,
bool bUseDefault = false) const;
- bool SetMeasure(XFA_ATTRIBUTE eAttr, FX_FLOAT fValue);
+ bool SetMeasure(XFA_ATTRIBUTE eAttr, float fValue);
CXFA_Node* m_pNode;
};
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_dataexporter.cpp b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_dataexporter.cpp
index fe9947527d6..3963b162cbe 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_dataexporter.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_dataexporter.cpp
@@ -10,11 +10,14 @@
#include "core/fxcrt/fx_basic.h"
#include "third_party/base/stl_util.h"
-#include "xfa/fde/xml/fde_xml_imp.h"
+#include "xfa/fde/xml/cfde_xmldoc.h"
+#include "xfa/fde/xml/cfde_xmlelement.h"
+#include "xfa/fde/xml/cfde_xmlnode.h"
#include "xfa/fgas/crt/fgas_codepage.h"
#include "xfa/fxfa/parser/cxfa_document.h"
+#include "xfa/fxfa/parser/cxfa_node.h"
#include "xfa/fxfa/parser/cxfa_widgetdata.h"
-#include "xfa/fxfa/parser/xfa_object.h"
+#include "xfa/fxfa/parser/xfa_utils.h"
namespace {
@@ -45,12 +48,33 @@ CFX_WideString ExportEncodeAttribute(const CFX_WideString& str) {
return textBuf.MakeString();
}
+const uint16_t g_XMLValidCharRange[][2] = {{0x09, 0x09},
+ {0x0A, 0x0A},
+ {0x0D, 0x0D},
+ {0x20, 0xD7FF},
+ {0xE000, 0xFFFD}};
+bool IsXMLValidChar(wchar_t ch) {
+ int32_t iStart = 0;
+ int32_t iEnd = FX_ArraySize(g_XMLValidCharRange) - 1;
+ while (iStart <= iEnd) {
+ int32_t iMid = (iStart + iEnd) / 2;
+ if (ch < g_XMLValidCharRange[iMid][0]) {
+ iEnd = iMid - 1;
+ } else if (ch > g_XMLValidCharRange[iMid][1]) {
+ iStart = iMid + 1;
+ } else {
+ return true;
+ }
+ }
+ return false;
+}
+
CFX_WideString ExportEncodeContent(const CFX_WideStringC& str) {
CFX_WideTextBuf textBuf;
int32_t iLen = str.GetLength();
for (int32_t i = 0; i < iLen; i++) {
- FX_WCHAR ch = str.GetAt(i);
- if (!FDE_IsXMLValidChar(ch))
+ wchar_t ch = str.GetAt(i);
+ if (!IsXMLValidChar(ch))
continue;
if (ch == '&') {
@@ -202,12 +226,8 @@ void RegenerateFormFile_Changed(CXFA_Node* pNode,
CFX_RetainPtr<IFX_MemoryStream> pMemStream =
IFX_MemoryStream::Create(true);
-
- // Note: ambiguous without cast below.
- CFX_RetainPtr<IFGAS_Stream> pTempStream = IFGAS_Stream::CreateStream(
- CFX_RetainPtr<IFX_SeekableWriteStream>(pMemStream),
- FX_STREAMACCESS_Text | FX_STREAMACCESS_Write |
- FX_STREAMACCESS_Append);
+ CFX_RetainPtr<IFGAS_Stream> pTempStream =
+ IFGAS_Stream::CreateWriteStream(pMemStream);
pTempStream->SetCodePage(FX_CODEPAGE_UTF8);
pRichTextXML->SaveXMLNode(pTempStream);
@@ -332,7 +352,7 @@ void RegenerateFormFile_Container(CXFA_Node* pNode,
RegenerateFormFile_Changed(pNode, buf, bSaveXML);
FX_STRSIZE nLen = buf.GetLength();
if (nLen > 0)
- pStream->WriteString((const FX_WCHAR*)buf.GetBuffer(), nLen);
+ pStream->WriteString((const wchar_t*)buf.GetBuffer(), nLen);
return;
}
@@ -379,21 +399,21 @@ void RegenerateFormFile_Container(CXFA_Node* pNode,
void XFA_DataExporter_RegenerateFormFile(
CXFA_Node* pNode,
const CFX_RetainPtr<IFGAS_Stream>& pStream,
- const FX_CHAR* pChecksum,
+ const char* pChecksum,
bool bSaveXML) {
if (pNode->IsModelNode()) {
- static const FX_WCHAR s_pwsTagName[] = L"<form";
- static const FX_WCHAR s_pwsClose[] = L"</form\n>";
+ static const wchar_t s_pwsTagName[] = L"<form";
+ static const wchar_t s_pwsClose[] = L"</form\n>";
pStream->WriteString(s_pwsTagName, FXSYS_wcslen(s_pwsTagName));
if (pChecksum) {
- static const FX_WCHAR s_pwChecksum[] = L" checksum=\"";
+ static const wchar_t s_pwChecksum[] = L" checksum=\"";
CFX_WideString wsChecksum = CFX_WideString::FromUTF8(pChecksum);
pStream->WriteString(s_pwChecksum, FXSYS_wcslen(s_pwChecksum));
pStream->WriteString(wsChecksum.c_str(), wsChecksum.GetLength());
pStream->WriteString(L"\"", 1);
}
pStream->WriteString(L" xmlns=\"", FXSYS_wcslen(L" xmlns=\""));
- const FX_WCHAR* pURI = XFA_GetPacketByIndex(XFA_PACKET_Form)->pURI;
+ const wchar_t* pURI = XFA_GetPacketByIndex(XFA_PACKET_Form)->pURI;
pStream->WriteString(pURI, FXSYS_wcslen(pURI));
CFX_WideString wsVersionNumber;
RecognizeXFAVersionNumber(
@@ -460,14 +480,12 @@ bool CXFA_DataExporter::Export(
const CFX_RetainPtr<IFX_SeekableWriteStream>& pWrite,
CXFA_Node* pNode,
uint32_t dwFlag,
- const FX_CHAR* pChecksum) {
+ const char* pChecksum) {
ASSERT(pWrite);
if (!pWrite)
return false;
- CFX_RetainPtr<IFGAS_Stream> pStream = IFGAS_Stream::CreateStream(
- pWrite,
- FX_STREAMACCESS_Text | FX_STREAMACCESS_Write | FX_STREAMACCESS_Append);
+ CFX_RetainPtr<IFGAS_Stream> pStream = IFGAS_Stream::CreateWriteStream(pWrite);
if (!pStream)
return false;
@@ -478,19 +496,19 @@ bool CXFA_DataExporter::Export(
bool CXFA_DataExporter::Export(const CFX_RetainPtr<IFGAS_Stream>& pStream,
CXFA_Node* pNode,
uint32_t dwFlag,
- const FX_CHAR* pChecksum) {
+ const char* pChecksum) {
CFDE_XMLDoc* pXMLDoc = m_pDocument->GetXMLDoc();
if (pNode->IsModelNode()) {
switch (pNode->GetPacketID()) {
case XFA_XDPPACKET_XDP: {
- static const FX_WCHAR s_pwsPreamble[] =
+ static const wchar_t s_pwsPreamble[] =
L"<xdp:xdp xmlns:xdp=\"http://ns.adobe.com/xdp/\">";
pStream->WriteString(s_pwsPreamble, FXSYS_wcslen(s_pwsPreamble));
for (CXFA_Node* pChild = pNode->GetNodeItem(XFA_NODEITEM_FirstChild);
pChild; pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling)) {
Export(pStream, pChild, dwFlag, pChecksum);
}
- static const FX_WCHAR s_pwsPostamble[] = L"</xdp:xdp\n>";
+ static const wchar_t s_pwsPostamble[] = L"</xdp:xdp\n>";
pStream->WriteString(s_pwsPostamble, FXSYS_wcslen(s_pwsPostamble));
break;
}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_dataexporter.h b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_dataexporter.h
index 0e5de007963..ac441ca21d3 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_dataexporter.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_dataexporter.h
@@ -23,13 +23,13 @@ class CXFA_DataExporter {
bool Export(const CFX_RetainPtr<IFX_SeekableWriteStream>& pWrite,
CXFA_Node* pNode,
uint32_t dwFlag,
- const FX_CHAR* pChecksum);
+ const char* pChecksum);
- protected:
+ private:
bool Export(const CFX_RetainPtr<IFGAS_Stream>& pStream,
CXFA_Node* pNode,
uint32_t dwFlag,
- const FX_CHAR* pChecksum);
+ const char* pChecksum);
CXFA_Document* const m_pDocument;
};
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_dataimporter.cpp b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_dataimporter.cpp
index 0199028ecd6..200841f5cb4 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_dataimporter.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_dataimporter.cpp
@@ -10,12 +10,12 @@
#include "core/fxcrt/fx_stream.h"
#include "third_party/base/ptr_util.h"
-#include "xfa/fde/xml/fde_xml_imp.h"
+#include "xfa/fde/xml/cfde_xmlnode.h"
#include "xfa/fxfa/fxfa.h"
#include "xfa/fxfa/fxfa_basic.h"
#include "xfa/fxfa/parser/cxfa_document.h"
+#include "xfa/fxfa/parser/cxfa_node.h"
#include "xfa/fxfa/parser/cxfa_simple_parser.h"
-#include "xfa/fxfa/parser/xfa_object.h"
CXFA_DataImporter::CXFA_DataImporter(CXFA_Document* pDocument)
: m_pDocument(pDocument) {
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_dataimporter.h b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_dataimporter.h
index bf04b05846d..4e8bdda314e 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_dataimporter.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_dataimporter.h
@@ -19,7 +19,7 @@ class CXFA_DataImporter {
bool ImportData(const CFX_RetainPtr<IFX_SeekableReadStream>& pDataDocument);
- protected:
+ private:
CXFA_Document* const m_pDocument;
};
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_document.cpp b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_document.cpp
index adb8eb2e0b9..7c979fec227 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_document.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_document.cpp
@@ -15,9 +15,10 @@
#include "xfa/fxfa/parser/cxfa_document.h"
#include "xfa/fxfa/parser/cxfa_document_parser.h"
#include "xfa/fxfa/parser/cxfa_layoutprocessor.h"
+#include "xfa/fxfa/parser/cxfa_localemgr.h"
+#include "xfa/fxfa/parser/cxfa_node.h"
#include "xfa/fxfa/parser/cxfa_scriptcontext.h"
-#include "xfa/fxfa/parser/xfa_localemgr.h"
-#include "xfa/fxfa/parser/xfa_object.h"
+#include "xfa/fxfa/parser/cxfa_traversestrategy_xfanode.h"
#include "xfa/fxfa/parser/xfa_resolvenode_rs.h"
#include "xfa/fxfa/parser/xfa_utils.h"
@@ -85,16 +86,7 @@ void MergeNode(CXFA_Document* pDocument,
CXFA_Document::CXFA_Document(CXFA_DocumentParser* pParser)
: m_pParser(pParser),
- m_pScriptContext(nullptr),
- m_pLayoutProcessor(nullptr),
m_pRootNode(nullptr),
- m_pLocalMgr(nullptr),
- m_pScriptDataWindow(nullptr),
- m_pScriptEvent(nullptr),
- m_pScriptHost(nullptr),
- m_pScriptLog(nullptr),
- m_pScriptLayout(nullptr),
- m_pScriptSignature(nullptr),
m_eCurVersionMode(XFA_VERSION_DEFAULT),
m_dwDocFlags(0) {
ASSERT(m_pParser);
@@ -107,8 +99,8 @@ CXFA_Document::~CXFA_Document() {
CXFA_LayoutProcessor* CXFA_Document::GetLayoutProcessor() {
if (!m_pLayoutProcessor)
- m_pLayoutProcessor = new CXFA_LayoutProcessor(this);
- return m_pLayoutProcessor;
+ m_pLayoutProcessor = pdfium::MakeUnique<CXFA_LayoutProcessor>(this);
+ return m_pLayoutProcessor.get();
}
CXFA_LayoutProcessor* CXFA_Document::GetDocLayout() {
@@ -116,24 +108,15 @@ CXFA_LayoutProcessor* CXFA_Document::GetDocLayout() {
}
void CXFA_Document::ClearLayoutData() {
- delete m_pLayoutProcessor;
- m_pLayoutProcessor = nullptr;
- delete m_pScriptContext;
- m_pScriptContext = nullptr;
- delete m_pLocalMgr;
- m_pLocalMgr = nullptr;
- delete m_pScriptDataWindow;
- m_pScriptDataWindow = nullptr;
- delete m_pScriptEvent;
- m_pScriptEvent = nullptr;
- delete m_pScriptHost;
- m_pScriptHost = nullptr;
- delete m_pScriptLog;
- m_pScriptLog = nullptr;
- delete m_pScriptLayout;
- m_pScriptLayout = nullptr;
- delete m_pScriptSignature;
- m_pScriptSignature = nullptr;
+ m_pLayoutProcessor.reset();
+ m_pScriptContext.reset();
+ m_pLocalMgr.reset();
+ m_pScriptDataWindow.reset();
+ m_pScriptEvent.reset();
+ m_pScriptHost.reset();
+ m_pScriptLog.reset();
+ m_pScriptLayout.reset();
+ m_pScriptSignature.reset();
}
void CXFA_Document::SetRoot(CXFA_Node* pNewRoot) {
@@ -186,33 +169,34 @@ CXFA_Object* CXFA_Document::GetXFAObject(XFA_HashCode dwNodeNameHash) {
}
case XFA_HASHCODE_DataWindow: {
if (!m_pScriptDataWindow)
- m_pScriptDataWindow = new CScript_DataWindow(this);
- return m_pScriptDataWindow;
+ m_pScriptDataWindow = pdfium::MakeUnique<CScript_DataWindow>(this);
+ return m_pScriptDataWindow.get();
}
case XFA_HASHCODE_Event: {
if (!m_pScriptEvent)
- m_pScriptEvent = new CScript_EventPseudoModel(this);
- return m_pScriptEvent;
+ m_pScriptEvent = pdfium::MakeUnique<CScript_EventPseudoModel>(this);
+ return m_pScriptEvent.get();
}
case XFA_HASHCODE_Host: {
if (!m_pScriptHost)
- m_pScriptHost = new CScript_HostPseudoModel(this);
- return m_pScriptHost;
+ m_pScriptHost = pdfium::MakeUnique<CScript_HostPseudoModel>(this);
+ return m_pScriptHost.get();
}
case XFA_HASHCODE_Log: {
if (!m_pScriptLog)
- m_pScriptLog = new CScript_LogPseudoModel(this);
- return m_pScriptLog;
+ m_pScriptLog = pdfium::MakeUnique<CScript_LogPseudoModel>(this);
+ return m_pScriptLog.get();
}
case XFA_HASHCODE_Signature: {
if (!m_pScriptSignature)
- m_pScriptSignature = new CScript_SignaturePseudoModel(this);
- return m_pScriptSignature;
+ m_pScriptSignature =
+ pdfium::MakeUnique<CScript_SignaturePseudoModel>(this);
+ return m_pScriptSignature.get();
}
case XFA_HASHCODE_Layout: {
if (!m_pScriptLayout)
- m_pScriptLayout = new CScript_LayoutPseudoModel(this);
- return m_pScriptLayout;
+ m_pScriptLayout = pdfium::MakeUnique<CScript_LayoutPseudoModel>(this);
+ return m_pScriptLayout.get();
}
default:
return m_pRootNode->GetFirstChildByName(dwNodeNameHash);
@@ -292,28 +276,27 @@ bool CXFA_Document::IsInteractive() {
CXFA_LocaleMgr* CXFA_Document::GetLocalMgr() {
if (!m_pLocalMgr) {
- m_pLocalMgr =
- new CXFA_LocaleMgr(ToNode(GetXFAObject(XFA_HASHCODE_LocaleSet)),
- GetNotify()->GetAppProvider()->GetLanguage());
+ m_pLocalMgr = pdfium::MakeUnique<CXFA_LocaleMgr>(
+ ToNode(GetXFAObject(XFA_HASHCODE_LocaleSet)),
+ GetNotify()->GetAppProvider()->GetLanguage());
}
- return m_pLocalMgr;
+ return m_pLocalMgr.get();
}
CXFA_ScriptContext* CXFA_Document::InitScriptContext(v8::Isolate* pIsolate) {
- if (!m_pScriptContext)
- m_pScriptContext = new CXFA_ScriptContext(this);
- m_pScriptContext->Initialize(pIsolate);
- return m_pScriptContext;
+ CXFA_ScriptContext* result = GetScriptContext();
+ result->Initialize(pIsolate);
+ return result;
}
CXFA_ScriptContext* CXFA_Document::GetScriptContext() {
if (!m_pScriptContext)
- m_pScriptContext = new CXFA_ScriptContext(this);
- return m_pScriptContext;
+ m_pScriptContext = pdfium::MakeUnique<CXFA_ScriptContext>(this);
+ return m_pScriptContext.get();
}
XFA_VERSION CXFA_Document::RecognizeXFAVersionNumber(
- CFX_WideString& wsTemplateNS) {
+ const CFX_WideString& wsTemplateNS) {
CFX_WideStringC wsTemplateURIPrefix =
XFA_GetPacketByIndex(XFA_PACKET_Template)->pURI;
FX_STRSIZE nPrefixLength = wsTemplateURIPrefix.GetLength();
@@ -361,7 +344,7 @@ void CXFA_Document::DoProtoMerge() {
return;
std::map<uint32_t, CXFA_Node*> mIDMap;
- CXFA_NodeSet sUseNodes;
+ std::unordered_set<CXFA_Node*> sUseNodes;
CXFA_NodeIterator sIterator(pTemplateRoot);
for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode;
pNode = sIterator.MoveToNext()) {
@@ -418,8 +401,8 @@ void CXFA_Document::DoProtoMerge() {
XFA_RESOLVENODE_RS resoveNodeRS;
int32_t iRet = m_pScriptContext->ResolveObjects(pUseHrefNode, wsSOM,
resoveNodeRS, dwFlag);
- if (iRet > 0 && resoveNodeRS.nodes[0]->IsNode())
- pProtoNode = resoveNodeRS.nodes[0]->AsNode();
+ if (iRet > 0 && resoveNodeRS.objects.front()->IsNode())
+ pProtoNode = resoveNodeRS.objects.front()->AsNode();
} else if (!wsID.IsEmpty()) {
auto it = mIDMap.find(FX_HashCode_GetW(wsID, false));
if (it == mIDMap.end())
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_document.h b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_document.h
index fdd230dca77..101b23332e5 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_document.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_document.h
@@ -8,10 +8,12 @@
#define XFA_FXFA_PARSER_CXFA_DOCUMENT_H_
#include <map>
+#include <memory>
+#include <unordered_set>
+#include <vector>
#include "xfa/fxfa/fxfa.h"
-#include "xfa/fxfa/parser/xfa_localemgr.h"
-#include "xfa/fxfa/parser/xfa_object.h"
+#include "xfa/fxfa/parser/cxfa_localemgr.h"
enum XFA_VERSION {
XFA_VERSION_UNKNOWN = 0,
@@ -69,7 +71,7 @@ class CXFA_Document {
CXFA_LocaleMgr* GetLocalMgr();
CXFA_Object* GetXFAObject(XFA_HashCode wsNodeNameHash);
CXFA_Node* GetNodeByID(CXFA_Node* pRoot, const CFX_WideStringC& wsID);
- CXFA_Node* GetNotBindNode(CXFA_ObjArray& arrayNodes);
+ CXFA_Node* GetNotBindNode(const std::vector<CXFA_Object*>& arrayNodes);
CXFA_LayoutProcessor* GetLayoutProcessor();
CXFA_LayoutProcessor* GetDocLayout();
CXFA_ScriptContext* GetScriptContext();
@@ -85,7 +87,7 @@ class CXFA_Document {
bool IsInteractive();
XFA_VERSION GetCurVersionMode() { return m_eCurVersionMode; }
- XFA_VERSION RecognizeXFAVersionNumber(CFX_WideString& wsTemplateNS);
+ XFA_VERSION RecognizeXFAVersionNumber(const CFX_WideString& wsTemplateNS);
CXFA_Node* CreateNode(uint32_t dwPacket, XFA_Element eElement);
CXFA_Node* CreateNode(const XFA_PACKETINFO* pPacket, XFA_Element eElement);
@@ -104,21 +106,21 @@ class CXFA_Document {
void ClearLayoutData();
std::map<uint32_t, CXFA_Node*> m_rgGlobalBinding;
- CXFA_NodeArray m_pPendingPageSet;
+ std::vector<CXFA_Node*> m_pPendingPageSet;
- protected:
+ private:
CXFA_DocumentParser* m_pParser;
- CXFA_ScriptContext* m_pScriptContext;
- CXFA_LayoutProcessor* m_pLayoutProcessor;
CXFA_Node* m_pRootNode;
- CXFA_LocaleMgr* m_pLocalMgr;
- CScript_DataWindow* m_pScriptDataWindow;
- CScript_EventPseudoModel* m_pScriptEvent;
- CScript_HostPseudoModel* m_pScriptHost;
- CScript_LogPseudoModel* m_pScriptLog;
- CScript_LayoutPseudoModel* m_pScriptLayout;
- CScript_SignaturePseudoModel* m_pScriptSignature;
- CXFA_NodeSet m_PurgeNodes;
+ std::unique_ptr<CXFA_ScriptContext> m_pScriptContext;
+ std::unique_ptr<CXFA_LayoutProcessor> m_pLayoutProcessor;
+ std::unique_ptr<CXFA_LocaleMgr> m_pLocalMgr;
+ std::unique_ptr<CScript_DataWindow> m_pScriptDataWindow;
+ std::unique_ptr<CScript_EventPseudoModel> m_pScriptEvent;
+ std::unique_ptr<CScript_HostPseudoModel> m_pScriptHost;
+ std::unique_ptr<CScript_LogPseudoModel> m_pScriptLog;
+ std::unique_ptr<CScript_LayoutPseudoModel> m_pScriptLayout;
+ std::unique_ptr<CScript_SignaturePseudoModel> m_pScriptSignature;
+ std::unordered_set<CXFA_Node*> m_PurgeNodes;
XFA_VERSION m_eCurVersionMode;
uint32_t m_dwDocFlags;
};
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_document_parser.cpp b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_document_parser.cpp
index 90be5687855..b855513f526 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_document_parser.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_document_parser.cpp
@@ -7,6 +7,7 @@
#include "xfa/fxfa/parser/cxfa_document_parser.h"
#include "third_party/base/ptr_util.h"
+#include "xfa/fde/xml/cfde_xmldoc.h"
#include "xfa/fxfa/fxfa.h"
#include "xfa/fxfa/parser/cxfa_document.h"
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_document_parser.h b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_document_parser.h
index 617bddf55be..9a219f74c10 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_document_parser.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_document_parser.h
@@ -31,7 +31,7 @@ class CXFA_DocumentParser {
CXFA_FFNotify* GetNotify() const;
CXFA_Document* GetDocument() const;
- protected:
+ private:
CXFA_SimpleParser m_nodeParser;
CXFA_FFNotify* m_pNotify;
std::unique_ptr<CXFA_Document> m_pDocument;
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_event.cpp b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_event.cpp
index 3e5639617b1..d7534289b38 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_event.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_event.cpp
@@ -6,7 +6,7 @@
#include "xfa/fxfa/parser/cxfa_event.h"
-#include "xfa/fxfa/parser/xfa_object.h"
+#include "xfa/fxfa/parser/cxfa_node.h"
CXFA_Event::CXFA_Event(CXFA_Node* pNode) : CXFA_Data(pNode) {}
@@ -14,7 +14,7 @@ int32_t CXFA_Event::GetActivity() {
return m_pNode->GetEnum(XFA_ATTRIBUTE_Activity);
}
-XFA_Element CXFA_Event::GetEventType() {
+XFA_Element CXFA_Event::GetEventType() const {
CXFA_Node* pChild = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild);
while (pChild) {
XFA_Element eType = pChild->GetElementType();
@@ -30,11 +30,11 @@ void CXFA_Event::GetRef(CFX_WideStringC& wsRef) {
m_pNode->TryCData(XFA_ATTRIBUTE_Ref, wsRef);
}
-CXFA_Script CXFA_Event::GetScript() {
+CXFA_Script CXFA_Event::GetScript() const {
return CXFA_Script(m_pNode->GetChild(0, XFA_Element::Script));
}
-CXFA_Submit CXFA_Event::GetSubmit() {
+CXFA_Submit CXFA_Event::GetSubmit() const {
return CXFA_Submit(m_pNode->GetChild(0, XFA_Element::Submit));
}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_event.h b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_event.h
index b151b399b59..fc0bcf34cc8 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_event.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_event.h
@@ -21,12 +21,10 @@ class CXFA_Event : public CXFA_Data {
explicit CXFA_Event(CXFA_Node* pNode);
int32_t GetActivity();
- XFA_Element GetEventType();
+ XFA_Element GetEventType() const;
+ CXFA_Script GetScript() const;
+ CXFA_Submit GetSubmit() const;
void GetRef(CFX_WideStringC& wsRef);
-
- CXFA_Script GetScript();
- CXFA_Submit GetSubmit();
-
void GetSignDataTarget(CFX_WideString& wsTarget);
};
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_exdata.cpp b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_exdata.cpp
index bf1e930330e..ac82b3043cf 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_exdata.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_exdata.cpp
@@ -6,7 +6,7 @@
#include "xfa/fxfa/parser/cxfa_exdata.h"
-#include "xfa/fxfa/parser/xfa_object.h"
+#include "xfa/fxfa/parser/cxfa_node.h"
CXFA_ExData::CXFA_ExData(CXFA_Node* pNode) : CXFA_Data(pNode) {}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_fill.cpp b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_fill.cpp
index 63949c193dd..8621c3c961a 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_fill.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_fill.cpp
@@ -6,7 +6,7 @@
#include "xfa/fxfa/parser/cxfa_fill.h"
-#include "xfa/fxfa/parser/xfa_object.h"
+#include "xfa/fxfa/parser/cxfa_node.h"
CXFA_Fill::CXFA_Fill(CXFA_Node* pNode) : CXFA_Data(pNode) {}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_font.cpp b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_font.cpp
index cedfda6294e..56e04b75f75 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_font.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_font.cpp
@@ -9,29 +9,29 @@
#include "core/fxge/fx_dib.h"
#include "xfa/fxfa/parser/cxfa_fill.h"
#include "xfa/fxfa/parser/cxfa_measurement.h"
-#include "xfa/fxfa/parser/xfa_object.h"
+#include "xfa/fxfa/parser/cxfa_node.h"
CXFA_Font::CXFA_Font(CXFA_Node* pNode) : CXFA_Data(pNode) {}
-FX_FLOAT CXFA_Font::GetBaselineShift() {
+float CXFA_Font::GetBaselineShift() {
return m_pNode->GetMeasure(XFA_ATTRIBUTE_BaselineShift).ToUnit(XFA_UNIT_Pt);
}
-FX_FLOAT CXFA_Font::GetHorizontalScale() {
+float CXFA_Font::GetHorizontalScale() {
CFX_WideString wsValue;
m_pNode->TryCData(XFA_ATTRIBUTE_FontHorizontalScale, wsValue);
int32_t iScale = FXSYS_wtoi(wsValue.c_str());
- return iScale > 0 ? (FX_FLOAT)iScale : 100.0f;
+ return iScale > 0 ? (float)iScale : 100.0f;
}
-FX_FLOAT CXFA_Font::GetVerticalScale() {
+float CXFA_Font::GetVerticalScale() {
CFX_WideString wsValue;
m_pNode->TryCData(XFA_ATTRIBUTE_FontVerticalScale, wsValue);
int32_t iScale = FXSYS_wtoi(wsValue.c_str());
- return iScale > 0 ? (FX_FLOAT)iScale : 100.0f;
+ return iScale > 0 ? (float)iScale : 100.0f;
}
-FX_FLOAT CXFA_Font::GetLetterSpacing() {
+float CXFA_Font::GetLetterSpacing() {
CFX_WideStringC wsValue;
if (!m_pNode->TryCData(XFA_ATTRIBUTE_LetterSpacing, wsValue))
return 0;
@@ -60,7 +60,7 @@ int32_t CXFA_Font::GetUnderlinePeriod() {
return eAttr;
}
-FX_FLOAT CXFA_Font::GetFontSize() {
+float CXFA_Font::GetFontSize() {
CXFA_Measurement ms;
m_pNode->TryMeasure(XFA_ATTRIBUTE_Size, ms);
return ms.ToUnit(XFA_UNIT_Pt);
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_font.h b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_font.h
index 0342f68b278..2a5fef11226 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_font.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_font.h
@@ -16,14 +16,14 @@ class CXFA_Font : public CXFA_Data {
public:
explicit CXFA_Font(CXFA_Node* pNode);
- FX_FLOAT GetBaselineShift();
- FX_FLOAT GetHorizontalScale();
- FX_FLOAT GetVerticalScale();
- FX_FLOAT GetLetterSpacing();
+ float GetBaselineShift();
+ float GetHorizontalScale();
+ float GetVerticalScale();
+ float GetLetterSpacing();
int32_t GetLineThrough();
int32_t GetUnderline();
int32_t GetUnderlinePeriod();
- FX_FLOAT GetFontSize();
+ float GetFontSize();
void GetTypeface(CFX_WideStringC& wsTypeFace);
bool IsBold();
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_image.cpp b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_image.cpp
index 8cf7fc1e230..8d14d629608 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_image.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_image.cpp
@@ -6,7 +6,7 @@
#include "xfa/fxfa/parser/cxfa_image.h"
-#include "xfa/fxfa/parser/xfa_object.h"
+#include "xfa/fxfa/parser/cxfa_node.h"
CXFA_Image::CXFA_Image(CXFA_Node* pNode, bool bDefValue)
: CXFA_Data(pNode), m_bDefValue(bDefValue) {}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_image.h b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_image.h
index bf69897693e..204441ab6b5 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_image.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_image.h
@@ -26,7 +26,7 @@ class CXFA_Image : public CXFA_Data {
bool SetHref(const CFX_WideString& wsHref);
bool SetTransferEncoding(int32_t iTransferEncoding);
- protected:
+ private:
bool m_bDefValue;
};
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp
new file mode 100644
index 00000000000..8911227f3d6
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp
@@ -0,0 +1,2793 @@
+// 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
+
+#include "xfa/fxfa/parser/cxfa_itemlayoutprocessor.h"
+
+#include <algorithm>
+#include <memory>
+#include <utility>
+#include <vector>
+
+#include "third_party/base/ptr_util.h"
+#include "third_party/base/stl_util.h"
+#include "xfa/fxfa/app/xfa_ffnotify.h"
+#include "xfa/fxfa/parser/cxfa_containerlayoutitem.h"
+#include "xfa/fxfa/parser/cxfa_contentlayoutitem.h"
+#include "xfa/fxfa/parser/cxfa_document.h"
+#include "xfa/fxfa/parser/cxfa_layoutcontext.h"
+#include "xfa/fxfa/parser/cxfa_layoutpagemgr.h"
+#include "xfa/fxfa/parser/cxfa_localemgr.h"
+#include "xfa/fxfa/parser/cxfa_measurement.h"
+#include "xfa/fxfa/parser/cxfa_node.h"
+#include "xfa/fxfa/parser/cxfa_occur.h"
+#include "xfa/fxfa/parser/cxfa_traversestrategy_xfanode.h"
+#include "xfa/fxfa/parser/xfa_utils.h"
+
+namespace {
+
+std::vector<CFX_WideString> SeparateStringW(const wchar_t* pStr,
+ int32_t iStrLen,
+ wchar_t delimiter) {
+ std::vector<CFX_WideString> ret;
+ if (!pStr)
+ return ret;
+ if (iStrLen < 0)
+ iStrLen = FXSYS_wcslen(pStr);
+
+ const wchar_t* pToken = pStr;
+ const wchar_t* pEnd = pStr + iStrLen;
+ while (true) {
+ if (pStr >= pEnd || delimiter == *pStr) {
+ ret.push_back(CFX_WideString(pToken, pStr - pToken));
+ pToken = pStr + 1;
+ if (pStr >= pEnd)
+ break;
+ }
+ pStr++;
+ }
+ return ret;
+}
+
+void UpdateWidgetSize(CXFA_ContentLayoutItem* pLayoutItem,
+ float* fWidth,
+ float* fHeight) {
+ CXFA_Node* pNode = pLayoutItem->m_pFormNode;
+ switch (pNode->GetElementType()) {
+ case XFA_Element::Subform:
+ case XFA_Element::Area:
+ case XFA_Element::ExclGroup:
+ case XFA_Element::SubformSet: {
+ if (*fWidth < -XFA_LAYOUT_FLOAT_PERCISION)
+ *fWidth = pLayoutItem->m_sSize.width;
+ if (*fHeight < -XFA_LAYOUT_FLOAT_PERCISION)
+ *fHeight = pLayoutItem->m_sSize.height;
+ break;
+ }
+ case XFA_Element::Draw:
+ case XFA_Element::Field: {
+ pNode->GetDocument()->GetNotify()->StartFieldDrawLayout(pNode, *fWidth,
+ *fHeight);
+ break;
+ }
+ default:
+ ASSERT(false);
+ }
+}
+
+CFX_SizeF CalculateContainerSpecifiedSize(CXFA_Node* pFormNode,
+ bool* bContainerWidthAutoSize,
+ bool* bContainerHeightAutoSize) {
+ *bContainerWidthAutoSize = true;
+ *bContainerHeightAutoSize = true;
+
+ XFA_Element eType = pFormNode->GetElementType();
+ CXFA_Measurement mTmpValue;
+ CFX_SizeF containerSize;
+ if ((eType == XFA_Element::Subform || eType == XFA_Element::ExclGroup) &&
+ pFormNode->TryMeasure(XFA_ATTRIBUTE_W, mTmpValue, false) &&
+ mTmpValue.GetValue() > XFA_LAYOUT_FLOAT_PERCISION) {
+ containerSize.width = mTmpValue.ToUnit(XFA_UNIT_Pt);
+ *bContainerWidthAutoSize = false;
+ }
+ if ((eType == XFA_Element::Subform || eType == XFA_Element::ExclGroup) &&
+ pFormNode->TryMeasure(XFA_ATTRIBUTE_H, mTmpValue, false) &&
+ mTmpValue.GetValue() > XFA_LAYOUT_FLOAT_PERCISION) {
+ containerSize.height = mTmpValue.ToUnit(XFA_UNIT_Pt);
+ *bContainerHeightAutoSize = false;
+ }
+ if (*bContainerWidthAutoSize && eType == XFA_Element::Subform &&
+ pFormNode->TryMeasure(XFA_ATTRIBUTE_MaxW, mTmpValue, false) &&
+ mTmpValue.GetValue() > XFA_LAYOUT_FLOAT_PERCISION) {
+ containerSize.width = mTmpValue.ToUnit(XFA_UNIT_Pt);
+ *bContainerWidthAutoSize = false;
+ }
+ if (*bContainerHeightAutoSize && eType == XFA_Element::Subform &&
+ pFormNode->TryMeasure(XFA_ATTRIBUTE_MaxH, mTmpValue, false) &&
+ mTmpValue.GetValue() > XFA_LAYOUT_FLOAT_PERCISION) {
+ containerSize.height = mTmpValue.ToUnit(XFA_UNIT_Pt);
+ *bContainerHeightAutoSize = false;
+ }
+ return containerSize;
+}
+
+CFX_SizeF CalculateContainerComponentSizeFromContentSize(
+ CXFA_Node* pFormNode,
+ bool bContainerWidthAutoSize,
+ float fContentCalculatedWidth,
+ bool bContainerHeightAutoSize,
+ float fContentCalculatedHeight,
+ const CFX_SizeF& currentContainerSize) {
+ CFX_SizeF componentSize = currentContainerSize;
+ CXFA_Node* pMarginNode = pFormNode->GetFirstChildByClass(XFA_Element::Margin);
+ CXFA_Measurement mTmpValue;
+ if (bContainerWidthAutoSize) {
+ componentSize.width = fContentCalculatedWidth;
+ if (pMarginNode) {
+ if (pMarginNode->TryMeasure(XFA_ATTRIBUTE_LeftInset, mTmpValue, false))
+ componentSize.width += mTmpValue.ToUnit(XFA_UNIT_Pt);
+ if (pMarginNode->TryMeasure(XFA_ATTRIBUTE_RightInset, mTmpValue, false))
+ componentSize.width += mTmpValue.ToUnit(XFA_UNIT_Pt);
+ }
+ }
+
+ if (bContainerHeightAutoSize) {
+ componentSize.height = fContentCalculatedHeight;
+ if (pMarginNode) {
+ if (pMarginNode->TryMeasure(XFA_ATTRIBUTE_TopInset, mTmpValue, false))
+ componentSize.height += mTmpValue.ToUnit(XFA_UNIT_Pt);
+ if (pMarginNode->TryMeasure(XFA_ATTRIBUTE_BottomInset, mTmpValue,
+ false)) {
+ componentSize.height += mTmpValue.ToUnit(XFA_UNIT_Pt);
+ }
+ }
+ }
+ return componentSize;
+}
+
+void RelocateTableRowCells(CXFA_ContentLayoutItem* pLayoutRow,
+ const std::vector<float>& rgSpecifiedColumnWidths,
+ XFA_ATTRIBUTEENUM eLayout) {
+ bool bContainerWidthAutoSize = true;
+ bool bContainerHeightAutoSize = true;
+ CFX_SizeF containerSize = CalculateContainerSpecifiedSize(
+ pLayoutRow->m_pFormNode, &bContainerWidthAutoSize,
+ &bContainerHeightAutoSize);
+ CXFA_Node* pMarginNode =
+ pLayoutRow->m_pFormNode->GetFirstChildByClass(XFA_Element::Margin);
+ float fLeftInset = 0;
+ float fTopInset = 0;
+ float fRightInset = 0;
+ float fBottomInset = 0;
+ if (pMarginNode) {
+ fLeftInset =
+ pMarginNode->GetMeasure(XFA_ATTRIBUTE_LeftInset).ToUnit(XFA_UNIT_Pt);
+ fTopInset =
+ pMarginNode->GetMeasure(XFA_ATTRIBUTE_TopInset).ToUnit(XFA_UNIT_Pt);
+ fRightInset =
+ pMarginNode->GetMeasure(XFA_ATTRIBUTE_RightInset).ToUnit(XFA_UNIT_Pt);
+ fBottomInset =
+ pMarginNode->GetMeasure(XFA_ATTRIBUTE_BottomInset).ToUnit(XFA_UNIT_Pt);
+ }
+
+ float fContentWidthLimit =
+ bContainerWidthAutoSize ? FLT_MAX
+ : containerSize.width - fLeftInset - fRightInset;
+ float fContentCurrentHeight =
+ pLayoutRow->m_sSize.height - fTopInset - fBottomInset;
+ float fContentCalculatedWidth = 0;
+ float fContentCalculatedHeight = 0;
+ float fCurrentColX = 0;
+ int32_t nCurrentColIdx = 0;
+ bool bMetWholeRowCell = false;
+
+ for (auto* pLayoutChild =
+ static_cast<CXFA_ContentLayoutItem*>(pLayoutRow->m_pFirstChild);
+ pLayoutChild; pLayoutChild = static_cast<CXFA_ContentLayoutItem*>(
+ pLayoutChild->m_pNextSibling)) {
+ int32_t nOriginalColSpan =
+ pLayoutChild->m_pFormNode->GetInteger(XFA_ATTRIBUTE_ColSpan);
+ int32_t nColSpan = nOriginalColSpan;
+ float fColSpanWidth = 0;
+ if (nColSpan == -1 ||
+ nCurrentColIdx + nColSpan >
+ pdfium::CollectionSize<int32_t>(rgSpecifiedColumnWidths)) {
+ nColSpan = pdfium::CollectionSize<int32_t>(rgSpecifiedColumnWidths) -
+ nCurrentColIdx;
+ }
+ for (int32_t i = 0; i < nColSpan; i++)
+ fColSpanWidth += rgSpecifiedColumnWidths[nCurrentColIdx + i];
+
+ if (nColSpan != nOriginalColSpan) {
+ fColSpanWidth =
+ bMetWholeRowCell ? 0 : std::max(fColSpanWidth,
+ pLayoutChild->m_sSize.height);
+ }
+ if (nOriginalColSpan == -1)
+ bMetWholeRowCell = true;
+
+ pLayoutChild->m_sPos = CFX_PointF(fCurrentColX, 0);
+ pLayoutChild->m_sSize.width = fColSpanWidth;
+ if (!XFA_ItemLayoutProcessor_IsTakingSpace(pLayoutChild->m_pFormNode))
+ continue;
+
+ fCurrentColX += fColSpanWidth;
+ nCurrentColIdx += nColSpan;
+ float fNewHeight = bContainerHeightAutoSize ? -1 : fContentCurrentHeight;
+ UpdateWidgetSize(pLayoutChild, &fColSpanWidth, &fNewHeight);
+ pLayoutChild->m_sSize.height = fNewHeight;
+ if (bContainerHeightAutoSize) {
+ fContentCalculatedHeight =
+ std::max(fContentCalculatedHeight, pLayoutChild->m_sSize.height);
+ }
+ }
+
+ if (bContainerHeightAutoSize) {
+ for (CXFA_ContentLayoutItem* pLayoutChild =
+ (CXFA_ContentLayoutItem*)pLayoutRow->m_pFirstChild;
+ pLayoutChild;
+ pLayoutChild = (CXFA_ContentLayoutItem*)pLayoutChild->m_pNextSibling) {
+ UpdateWidgetSize(pLayoutChild, &pLayoutChild->m_sSize.width,
+ &fContentCalculatedHeight);
+ float fOldChildHeight = pLayoutChild->m_sSize.height;
+ pLayoutChild->m_sSize.height = fContentCalculatedHeight;
+ CXFA_Node* pParaNode =
+ pLayoutChild->m_pFormNode->GetFirstChildByClass(XFA_Element::Para);
+ if (pParaNode && pLayoutChild->m_pFirstChild) {
+ float fOffHeight = fContentCalculatedHeight - fOldChildHeight;
+ XFA_ATTRIBUTEENUM eVType = pParaNode->GetEnum(XFA_ATTRIBUTE_VAlign);
+ switch (eVType) {
+ case XFA_ATTRIBUTEENUM_Middle:
+ fOffHeight = fOffHeight / 2;
+ break;
+ case XFA_ATTRIBUTEENUM_Bottom:
+ break;
+ case XFA_ATTRIBUTEENUM_Top:
+ default:
+ fOffHeight = 0;
+ break;
+ }
+ if (fOffHeight > 0) {
+ for (CXFA_ContentLayoutItem* pInnerLayoutChild =
+ (CXFA_ContentLayoutItem*)pLayoutChild->m_pFirstChild;
+ pInnerLayoutChild;
+ pInnerLayoutChild =
+ (CXFA_ContentLayoutItem*)pInnerLayoutChild->m_pNextSibling) {
+ pInnerLayoutChild->m_sPos.y += fOffHeight;
+ }
+ }
+ }
+ }
+ }
+
+ if (bContainerWidthAutoSize) {
+ float fChildSuppliedWidth = fCurrentColX;
+ if (fContentWidthLimit < FLT_MAX &&
+ fContentWidthLimit > fChildSuppliedWidth) {
+ fChildSuppliedWidth = fContentWidthLimit;
+ }
+ fContentCalculatedWidth =
+ std::max(fContentCalculatedWidth, fChildSuppliedWidth);
+ } else {
+ fContentCalculatedWidth = containerSize.width - fLeftInset - fRightInset;
+ }
+
+ if (pLayoutRow->m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout) ==
+ XFA_ATTRIBUTEENUM_Rl_row) {
+ for (CXFA_ContentLayoutItem* pLayoutChild =
+ (CXFA_ContentLayoutItem*)pLayoutRow->m_pFirstChild;
+ pLayoutChild;
+ pLayoutChild = (CXFA_ContentLayoutItem*)pLayoutChild->m_pNextSibling) {
+ pLayoutChild->m_sPos.x = fContentCalculatedWidth -
+ pLayoutChild->m_sPos.x -
+ pLayoutChild->m_sSize.width;
+ }
+ }
+ pLayoutRow->m_sSize = CalculateContainerComponentSizeFromContentSize(
+ pLayoutRow->m_pFormNode, bContainerWidthAutoSize, fContentCalculatedWidth,
+ bContainerHeightAutoSize, fContentCalculatedHeight, containerSize);
+}
+
+void UpdatePendingItemLayout(CXFA_ItemLayoutProcessor* pProcessor,
+ CXFA_ContentLayoutItem* pLayoutItem) {
+ XFA_ATTRIBUTEENUM eLayout =
+ pLayoutItem->m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout);
+ switch (eLayout) {
+ case XFA_ATTRIBUTEENUM_Row:
+ case XFA_ATTRIBUTEENUM_Rl_row:
+ RelocateTableRowCells(pLayoutItem, pProcessor->m_rgSpecifiedColumnWidths,
+ eLayout);
+ break;
+ default:
+ break;
+ }
+}
+
+void AddTrailerBeforeSplit(CXFA_ItemLayoutProcessor* pProcessor,
+ float fSplitPos,
+ CXFA_ContentLayoutItem* pTrailerLayoutItem,
+ bool bUseInherited) {
+ if (!pTrailerLayoutItem)
+ return;
+
+ float fHeight = pTrailerLayoutItem->m_sSize.height;
+ if (bUseInherited) {
+ float fNewSplitPos = 0;
+ if (fSplitPos - fHeight > XFA_LAYOUT_FLOAT_PERCISION)
+ fNewSplitPos = pProcessor->FindSplitPos(fSplitPos - fHeight);
+ if (fNewSplitPos > XFA_LAYOUT_FLOAT_PERCISION)
+ pProcessor->SplitLayoutItem(fNewSplitPos);
+ return;
+ }
+
+ UpdatePendingItemLayout(pProcessor, pTrailerLayoutItem);
+ CXFA_Node* pMarginNode =
+ pProcessor->m_pFormNode->GetFirstChildByClass(XFA_Element::Margin);
+ float fLeftInset = 0;
+ float fTopInset = 0;
+ float fRightInset = 0;
+ float fBottomInset = 0;
+ if (pMarginNode) {
+ fLeftInset =
+ pMarginNode->GetMeasure(XFA_ATTRIBUTE_LeftInset).ToUnit(XFA_UNIT_Pt);
+ fTopInset =
+ pMarginNode->GetMeasure(XFA_ATTRIBUTE_TopInset).ToUnit(XFA_UNIT_Pt);
+ fRightInset =
+ pMarginNode->GetMeasure(XFA_ATTRIBUTE_RightInset).ToUnit(XFA_UNIT_Pt);
+ fBottomInset =
+ pMarginNode->GetMeasure(XFA_ATTRIBUTE_BottomInset).ToUnit(XFA_UNIT_Pt);
+ }
+
+ if (!pProcessor->IsAddNewRowForTrailer(pTrailerLayoutItem)) {
+ pTrailerLayoutItem->m_sPos.y = pProcessor->m_fLastRowY;
+ pTrailerLayoutItem->m_sPos.x = pProcessor->m_fLastRowWidth;
+ pProcessor->m_pLayoutItem->m_sSize.width +=
+ pTrailerLayoutItem->m_sSize.width;
+ pProcessor->m_pLayoutItem->AddChild(pTrailerLayoutItem);
+ return;
+ }
+
+ float fNewSplitPos = 0;
+ if (fSplitPos - fHeight > XFA_LAYOUT_FLOAT_PERCISION)
+ fNewSplitPos = pProcessor->FindSplitPos(fSplitPos - fHeight);
+
+ if (fNewSplitPos > XFA_LAYOUT_FLOAT_PERCISION) {
+ pProcessor->SplitLayoutItem(fNewSplitPos);
+ pTrailerLayoutItem->m_sPos.y = fNewSplitPos - fTopInset - fBottomInset;
+ } else {
+ pTrailerLayoutItem->m_sPos.y = fSplitPos - fTopInset - fBottomInset;
+ }
+
+ switch (pTrailerLayoutItem->m_pFormNode->GetEnum(XFA_ATTRIBUTE_HAlign)) {
+ case XFA_ATTRIBUTEENUM_Right:
+ pTrailerLayoutItem->m_sPos.x = pProcessor->m_pLayoutItem->m_sSize.width -
+ fRightInset -
+ pTrailerLayoutItem->m_sSize.width;
+ break;
+ case XFA_ATTRIBUTEENUM_Center:
+ pTrailerLayoutItem->m_sPos.x =
+ (pProcessor->m_pLayoutItem->m_sSize.width - fLeftInset - fRightInset -
+ pTrailerLayoutItem->m_sSize.width) /
+ 2;
+ break;
+ case XFA_ATTRIBUTEENUM_Left:
+ default:
+ pTrailerLayoutItem->m_sPos.x = fLeftInset;
+ break;
+ }
+ pProcessor->m_pLayoutItem->m_sSize.height += fHeight;
+ pProcessor->m_pLayoutItem->AddChild(pTrailerLayoutItem);
+}
+
+void AddLeaderAfterSplit(CXFA_ItemLayoutProcessor* pProcessor,
+ CXFA_ContentLayoutItem* pLeaderLayoutItem) {
+ UpdatePendingItemLayout(pProcessor, pLeaderLayoutItem);
+
+ CXFA_Node* pMarginNode =
+ pProcessor->m_pFormNode->GetFirstChildByClass(XFA_Element::Margin);
+ float fLeftInset = 0;
+ float fRightInset = 0;
+ if (pMarginNode) {
+ fLeftInset =
+ pMarginNode->GetMeasure(XFA_ATTRIBUTE_LeftInset).ToUnit(XFA_UNIT_Pt);
+ fRightInset =
+ pMarginNode->GetMeasure(XFA_ATTRIBUTE_RightInset).ToUnit(XFA_UNIT_Pt);
+ }
+
+ float fHeight = pLeaderLayoutItem->m_sSize.height;
+ for (CXFA_ContentLayoutItem* pChildItem =
+ (CXFA_ContentLayoutItem*)pProcessor->m_pLayoutItem->m_pFirstChild;
+ pChildItem;
+ pChildItem = (CXFA_ContentLayoutItem*)pChildItem->m_pNextSibling) {
+ pChildItem->m_sPos.y += fHeight;
+ }
+ pLeaderLayoutItem->m_sPos.y = 0;
+
+ switch (pLeaderLayoutItem->m_pFormNode->GetEnum(XFA_ATTRIBUTE_HAlign)) {
+ case XFA_ATTRIBUTEENUM_Right:
+ pLeaderLayoutItem->m_sPos.x = pProcessor->m_pLayoutItem->m_sSize.width -
+ fRightInset -
+ pLeaderLayoutItem->m_sSize.width;
+ break;
+ case XFA_ATTRIBUTEENUM_Center:
+ pLeaderLayoutItem->m_sPos.x =
+ (pProcessor->m_pLayoutItem->m_sSize.width - fLeftInset - fRightInset -
+ pLeaderLayoutItem->m_sSize.width) /
+ 2;
+ break;
+ case XFA_ATTRIBUTEENUM_Left:
+ default:
+ pLeaderLayoutItem->m_sPos.x = fLeftInset;
+ break;
+ }
+ pProcessor->m_pLayoutItem->m_sSize.height += fHeight;
+ pProcessor->m_pLayoutItem->AddChild(pLeaderLayoutItem);
+}
+
+void AddPendingNode(CXFA_ItemLayoutProcessor* pProcessor,
+ CXFA_Node* pPendingNode,
+ bool bBreakPending) {
+ pProcessor->m_PendingNodes.push_back(pPendingNode);
+ pProcessor->m_bBreakPending = bBreakPending;
+}
+
+float InsertPendingItems(CXFA_ItemLayoutProcessor* pProcessor,
+ CXFA_Node* pCurChildNode) {
+ float fTotalHeight = 0;
+ if (pProcessor->m_PendingNodes.empty())
+ return fTotalHeight;
+
+ if (!pProcessor->m_pLayoutItem) {
+ pProcessor->m_pLayoutItem =
+ pProcessor->CreateContentLayoutItem(pCurChildNode);
+ pProcessor->m_pLayoutItem->m_sSize.clear();
+ }
+
+ while (!pProcessor->m_PendingNodes.empty()) {
+ auto pPendingProcessor = pdfium::MakeUnique<CXFA_ItemLayoutProcessor>(
+ pProcessor->m_PendingNodes.front(), nullptr);
+ pProcessor->m_PendingNodes.pop_front();
+ pPendingProcessor->DoLayout(false, FLT_MAX, FLT_MAX, nullptr);
+ CXFA_ContentLayoutItem* pPendingLayoutItem =
+ pPendingProcessor->HasLayoutItem()
+ ? pPendingProcessor->ExtractLayoutItem()
+ : nullptr;
+ if (pPendingLayoutItem) {
+ AddLeaderAfterSplit(pProcessor, pPendingLayoutItem);
+ if (pProcessor->m_bBreakPending)
+ fTotalHeight += pPendingLayoutItem->m_sSize.height;
+ }
+ }
+ return fTotalHeight;
+}
+
+XFA_ATTRIBUTEENUM GetLayout(CXFA_Node* pFormNode, bool* bRootForceTb) {
+ *bRootForceTb = false;
+ XFA_ATTRIBUTEENUM eLayoutMode;
+ if (pFormNode->TryEnum(XFA_ATTRIBUTE_Layout, eLayoutMode, false))
+ return eLayoutMode;
+
+ CXFA_Node* pParentNode = pFormNode->GetNodeItem(XFA_NODEITEM_Parent);
+ if (pParentNode && pParentNode->GetElementType() == XFA_Element::Form) {
+ *bRootForceTb = true;
+ return XFA_ATTRIBUTEENUM_Tb;
+ }
+ return XFA_ATTRIBUTEENUM_Position;
+}
+
+bool ExistContainerKeep(CXFA_Node* pCurNode, bool bPreFind) {
+ if (!pCurNode || !XFA_ItemLayoutProcessor_IsTakingSpace(pCurNode))
+ return false;
+
+ XFA_NODEITEM eItemType = XFA_NODEITEM_PrevSibling;
+ if (!bPreFind)
+ eItemType = XFA_NODEITEM_NextSibling;
+
+ CXFA_Node* pPreContainer =
+ pCurNode->GetNodeItem(eItemType, XFA_ObjectType::ContainerNode);
+ if (!pPreContainer)
+ return false;
+
+ CXFA_Node* pKeep = pCurNode->GetFirstChildByClass(XFA_Element::Keep);
+ if (pKeep) {
+ XFA_ATTRIBUTEENUM ePrevious;
+ XFA_ATTRIBUTE eKeepType = XFA_ATTRIBUTE_Previous;
+ if (!bPreFind)
+ eKeepType = XFA_ATTRIBUTE_Next;
+
+ if (pKeep->TryEnum(eKeepType, ePrevious, false)) {
+ if (ePrevious == XFA_ATTRIBUTEENUM_ContentArea ||
+ ePrevious == XFA_ATTRIBUTEENUM_PageArea) {
+ return true;
+ }
+ }
+ }
+
+ pKeep = pPreContainer->GetFirstChildByClass(XFA_Element::Keep);
+ if (!pKeep)
+ return false;
+
+ XFA_ATTRIBUTE eKeepType = XFA_ATTRIBUTE_Next;
+ if (!bPreFind)
+ eKeepType = XFA_ATTRIBUTE_Previous;
+
+ XFA_ATTRIBUTEENUM eNext;
+ if (!pKeep->TryEnum(eKeepType, eNext, false))
+ return false;
+ if (eNext == XFA_ATTRIBUTEENUM_ContentArea ||
+ eNext == XFA_ATTRIBUTEENUM_PageArea) {
+ return true;
+ }
+ return false;
+}
+
+bool FindBreakNode(CXFA_Node* pContainerNode,
+ CXFA_Node*& pCurActionNode,
+ XFA_ItemLayoutProcessorStages* nCurStage,
+ bool bBreakBefore) {
+ bool bFindRs = false;
+ for (CXFA_Node* pBreakNode = pContainerNode; pBreakNode;
+ pBreakNode = pBreakNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
+ XFA_ATTRIBUTE eAttributeType = XFA_ATTRIBUTE_Before;
+ if (!bBreakBefore)
+ eAttributeType = XFA_ATTRIBUTE_After;
+
+ switch (pBreakNode->GetElementType()) {
+ case XFA_Element::BreakBefore: {
+ if (bBreakBefore) {
+ pCurActionNode = pBreakNode;
+ *nCurStage = XFA_ItemLayoutProcessorStages::BreakBefore;
+ bFindRs = true;
+ }
+ break;
+ }
+ case XFA_Element::BreakAfter: {
+ if (!bBreakBefore) {
+ pCurActionNode = pBreakNode;
+ *nCurStage = XFA_ItemLayoutProcessorStages::BreakAfter;
+ bFindRs = true;
+ }
+ break;
+ }
+ case XFA_Element::Break:
+ if (pBreakNode->GetEnum(eAttributeType) != XFA_ATTRIBUTEENUM_Auto) {
+ pCurActionNode = pBreakNode;
+ *nCurStage = XFA_ItemLayoutProcessorStages::BreakBefore;
+ if (!bBreakBefore)
+ *nCurStage = XFA_ItemLayoutProcessorStages::BreakAfter;
+
+ bFindRs = true;
+ }
+ break;
+ default:
+ break;
+ }
+ if (bFindRs)
+ break;
+ }
+ return bFindRs;
+}
+
+void DeleteLayoutGeneratedNode(CXFA_Node* pGenerateNode) {
+ CXFA_FFNotify* pNotify = pGenerateNode->GetDocument()->GetNotify();
+ CXFA_LayoutProcessor* pDocLayout =
+ pGenerateNode->GetDocument()->GetDocLayout();
+ CXFA_NodeIteratorTemplate<CXFA_Node, CXFA_TraverseStrategy_XFANode> sIterator(
+ pGenerateNode);
+ for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode;
+ pNode = sIterator.MoveToNext()) {
+ CXFA_ContentLayoutItem* pCurLayoutItem =
+ (CXFA_ContentLayoutItem*)pNode->GetUserData(XFA_LAYOUTITEMKEY);
+ CXFA_ContentLayoutItem* pNextLayoutItem = nullptr;
+ while (pCurLayoutItem) {
+ pNextLayoutItem = pCurLayoutItem->m_pNext;
+ pNotify->OnLayoutItemRemoving(pDocLayout, pCurLayoutItem);
+ delete pCurLayoutItem;
+ pCurLayoutItem = pNextLayoutItem;
+ }
+ }
+ pGenerateNode->GetNodeItem(XFA_NODEITEM_Parent)->RemoveChild(pGenerateNode);
+}
+
+uint8_t HAlignEnumToInt(XFA_ATTRIBUTEENUM eHAlign) {
+ switch (eHAlign) {
+ case XFA_ATTRIBUTEENUM_Center:
+ return 1;
+ case XFA_ATTRIBUTEENUM_Right:
+ return 2;
+ case XFA_ATTRIBUTEENUM_Left:
+ default:
+ return 0;
+ }
+}
+
+XFA_ItemLayoutProcessorResult InsertFlowedItem(
+ CXFA_ItemLayoutProcessor* pThis,
+ CXFA_ItemLayoutProcessor* pProcessor,
+ bool bContainerWidthAutoSize,
+ bool bContainerHeightAutoSize,
+ float fContainerHeight,
+ XFA_ATTRIBUTEENUM eFlowStrategy,
+ uint8_t* uCurHAlignState,
+ std::vector<CXFA_ContentLayoutItem*> (&rgCurLineLayoutItems)[3],
+ bool bUseBreakControl,
+ float fAvailHeight,
+ float fRealHeight,
+ float fContentWidthLimit,
+ float* fContentCurRowY,
+ float* fContentCurRowAvailWidth,
+ float* fContentCurRowHeight,
+ bool* bAddedItemInRow,
+ bool* bForceEndPage,
+ CXFA_LayoutContext* pLayoutContext,
+ bool bNewRow) {
+ bool bTakeSpace =
+ XFA_ItemLayoutProcessor_IsTakingSpace(pProcessor->m_pFormNode);
+ uint8_t uHAlign =
+ HAlignEnumToInt(pThis->m_pCurChildNode->GetEnum(XFA_ATTRIBUTE_HAlign));
+ if (bContainerWidthAutoSize)
+ uHAlign = 0;
+
+ if ((eFlowStrategy != XFA_ATTRIBUTEENUM_Rl_tb &&
+ uHAlign < *uCurHAlignState) ||
+ (eFlowStrategy == XFA_ATTRIBUTEENUM_Rl_tb &&
+ uHAlign > *uCurHAlignState)) {
+ return XFA_ItemLayoutProcessorResult::RowFullBreak;
+ }
+
+ *uCurHAlignState = uHAlign;
+ bool bIsOwnSplit =
+ pProcessor->m_pFormNode->GetIntact() == XFA_ATTRIBUTEENUM_None;
+ bool bUseRealHeight =
+ bTakeSpace && bContainerHeightAutoSize && bIsOwnSplit &&
+ pProcessor->m_pFormNode->GetNodeItem(XFA_NODEITEM_Parent)->GetIntact() ==
+ XFA_ATTRIBUTEENUM_None;
+ bool bIsTransHeight = bTakeSpace;
+ if (bIsTransHeight && !bIsOwnSplit) {
+ bool bRootForceTb = false;
+ XFA_ATTRIBUTEENUM eLayoutStrategy =
+ GetLayout(pProcessor->m_pFormNode, &bRootForceTb);
+ if (eLayoutStrategy == XFA_ATTRIBUTEENUM_Lr_tb ||
+ eLayoutStrategy == XFA_ATTRIBUTEENUM_Rl_tb) {
+ bIsTransHeight = false;
+ }
+ }
+
+ bool bUseInherited = false;
+ CXFA_LayoutContext layoutContext;
+ if (pThis->m_pPageMgr) {
+ CXFA_Node* pOverflowNode =
+ pThis->m_pPageMgr->QueryOverflow(pThis->m_pFormNode);
+ if (pOverflowNode) {
+ layoutContext.m_pOverflowNode = pOverflowNode;
+ layoutContext.m_pOverflowProcessor = pThis;
+ pLayoutContext = &layoutContext;
+ }
+ }
+
+ XFA_ItemLayoutProcessorResult eRetValue = XFA_ItemLayoutProcessorResult::Done;
+ if (!bNewRow ||
+ pProcessor->m_ePreProcessRs == XFA_ItemLayoutProcessorResult::Done) {
+ eRetValue = pProcessor->DoLayout(
+ bTakeSpace ? bUseBreakControl : false,
+ bUseRealHeight ? fRealHeight - *fContentCurRowY : FLT_MAX,
+ bIsTransHeight ? fRealHeight - *fContentCurRowY : FLT_MAX,
+ pLayoutContext);
+ pProcessor->m_ePreProcessRs = eRetValue;
+ } else {
+ eRetValue = pProcessor->m_ePreProcessRs;
+ pProcessor->m_ePreProcessRs = XFA_ItemLayoutProcessorResult::Done;
+ }
+ if (pProcessor->HasLayoutItem() == false)
+ return eRetValue;
+
+ CFX_SizeF childSize = pProcessor->GetCurrentComponentSize();
+ if (bUseRealHeight && fRealHeight < XFA_LAYOUT_FLOAT_PERCISION) {
+ fRealHeight = FLT_MAX;
+ fAvailHeight = FLT_MAX;
+ }
+ if (bTakeSpace && (childSize.width >
+ *fContentCurRowAvailWidth + XFA_LAYOUT_FLOAT_PERCISION) &&
+ (fContentWidthLimit - *fContentCurRowAvailWidth >
+ XFA_LAYOUT_FLOAT_PERCISION)) {
+ return XFA_ItemLayoutProcessorResult::RowFullBreak;
+ }
+
+ CXFA_Node* pOverflowLeaderNode = nullptr;
+ CXFA_Node* pOverflowTrailerNode = nullptr;
+ CXFA_Node* pFormNode = nullptr;
+ CXFA_ContentLayoutItem* pTrailerLayoutItem = nullptr;
+ bool bIsAddTrailerHeight = false;
+ if (pThis->m_pPageMgr &&
+ pProcessor->m_pFormNode->GetIntact() == XFA_ATTRIBUTEENUM_None) {
+ pFormNode = pThis->m_pPageMgr->QueryOverflow(pProcessor->m_pFormNode);
+ if (!pFormNode && pLayoutContext && pLayoutContext->m_pOverflowProcessor) {
+ pFormNode = pLayoutContext->m_pOverflowNode;
+ bUseInherited = true;
+ }
+ if (pThis->m_pPageMgr->ProcessOverflow(pFormNode, pOverflowLeaderNode,
+ pOverflowTrailerNode, false,
+ false)) {
+ if (pProcessor->JudgeLeaderOrTrailerForOccur(pOverflowTrailerNode)) {
+ if (pOverflowTrailerNode) {
+ auto pOverflowLeaderProcessor =
+ pdfium::MakeUnique<CXFA_ItemLayoutProcessor>(pOverflowTrailerNode,
+ nullptr);
+ pOverflowLeaderProcessor->DoLayout(false, FLT_MAX, FLT_MAX, nullptr);
+ pTrailerLayoutItem =
+ pOverflowLeaderProcessor->HasLayoutItem()
+ ? pOverflowLeaderProcessor->ExtractLayoutItem()
+ : nullptr;
+ }
+
+ bIsAddTrailerHeight =
+ bUseInherited
+ ? pThis->IsAddNewRowForTrailer(pTrailerLayoutItem)
+ : pProcessor->IsAddNewRowForTrailer(pTrailerLayoutItem);
+ if (bIsAddTrailerHeight) {
+ childSize.height += pTrailerLayoutItem->m_sSize.height;
+ bIsAddTrailerHeight = true;
+ }
+ }
+ }
+ }
+
+ if (!bTakeSpace ||
+ *fContentCurRowY + childSize.height <=
+ fAvailHeight + XFA_LAYOUT_FLOAT_PERCISION ||
+ (!bContainerHeightAutoSize &&
+ pThis->m_fUsedSize + fAvailHeight + XFA_LAYOUT_FLOAT_PERCISION >=
+ fContainerHeight)) {
+ if (!bTakeSpace || eRetValue == XFA_ItemLayoutProcessorResult::Done) {
+ if (pProcessor->m_bUseInheriated) {
+ if (pTrailerLayoutItem)
+ AddTrailerBeforeSplit(pProcessor, childSize.height,
+ pTrailerLayoutItem, false);
+ if (pProcessor->JudgeLeaderOrTrailerForOccur(pOverflowLeaderNode))
+ AddPendingNode(pProcessor, pOverflowLeaderNode, false);
+
+ pProcessor->m_bUseInheriated = false;
+ } else {
+ if (bIsAddTrailerHeight)
+ childSize.height -= pTrailerLayoutItem->m_sSize.height;
+
+ pProcessor->ProcessUnUseOverFlow(pOverflowLeaderNode,
+ pOverflowTrailerNode,
+ pTrailerLayoutItem, pFormNode);
+ }
+
+ CXFA_ContentLayoutItem* pChildLayoutItem =
+ pProcessor->ExtractLayoutItem();
+ if (ExistContainerKeep(pProcessor->m_pFormNode, false) &&
+ pProcessor->m_pFormNode->GetIntact() == XFA_ATTRIBUTEENUM_None) {
+ pThis->m_arrayKeepItems.push_back(pChildLayoutItem);
+ } else {
+ pThis->m_arrayKeepItems.clear();
+ }
+ rgCurLineLayoutItems[uHAlign].push_back(pChildLayoutItem);
+ *bAddedItemInRow = true;
+ if (bTakeSpace) {
+ *fContentCurRowAvailWidth -= childSize.width;
+ *fContentCurRowHeight =
+ std::max(*fContentCurRowHeight, childSize.height);
+ }
+ return XFA_ItemLayoutProcessorResult::Done;
+ }
+
+ if (eRetValue == XFA_ItemLayoutProcessorResult::PageFullBreak) {
+ if (pProcessor->m_bUseInheriated) {
+ if (pTrailerLayoutItem) {
+ AddTrailerBeforeSplit(pProcessor, childSize.height,
+ pTrailerLayoutItem, false);
+ }
+ if (pProcessor->JudgeLeaderOrTrailerForOccur(pOverflowLeaderNode))
+ AddPendingNode(pProcessor, pOverflowLeaderNode, false);
+
+ pProcessor->m_bUseInheriated = false;
+ } else {
+ if (bIsAddTrailerHeight)
+ childSize.height -= pTrailerLayoutItem->m_sSize.height;
+
+ pProcessor->ProcessUnUseOverFlow(pOverflowLeaderNode,
+ pOverflowTrailerNode,
+ pTrailerLayoutItem, pFormNode);
+ }
+ }
+ rgCurLineLayoutItems[uHAlign].push_back(pProcessor->ExtractLayoutItem());
+ *bAddedItemInRow = true;
+ *fContentCurRowAvailWidth -= childSize.width;
+ *fContentCurRowHeight = std::max(*fContentCurRowHeight, childSize.height);
+ return eRetValue;
+ }
+
+ XFA_ItemLayoutProcessorResult eResult;
+ if (pThis->ProcessKeepForSplit(
+ pThis, pProcessor, eRetValue, &rgCurLineLayoutItems[uHAlign],
+ fContentCurRowAvailWidth, fContentCurRowHeight, fContentCurRowY,
+ bAddedItemInRow, bForceEndPage, &eResult)) {
+ return eResult;
+ }
+
+ *bForceEndPage = true;
+ float fSplitPos = pProcessor->FindSplitPos(fAvailHeight - *fContentCurRowY);
+ if (fSplitPos > XFA_LAYOUT_FLOAT_PERCISION) {
+ XFA_ATTRIBUTEENUM eLayout =
+ pProcessor->m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout);
+ if (eLayout == XFA_ATTRIBUTEENUM_Tb &&
+ eRetValue == XFA_ItemLayoutProcessorResult::Done) {
+ pProcessor->ProcessUnUseOverFlow(pOverflowLeaderNode,
+ pOverflowTrailerNode, pTrailerLayoutItem,
+ pFormNode);
+ rgCurLineLayoutItems[uHAlign].push_back(pProcessor->ExtractLayoutItem());
+ *bAddedItemInRow = true;
+ if (bTakeSpace) {
+ *fContentCurRowAvailWidth -= childSize.width;
+ *fContentCurRowHeight =
+ std::max(*fContentCurRowHeight, childSize.height);
+ }
+ return XFA_ItemLayoutProcessorResult::PageFullBreak;
+ }
+
+ CXFA_Node* pTempLeaderNode = nullptr;
+ CXFA_Node* pTempTrailerNode = nullptr;
+ if (pThis->m_pPageMgr && !pProcessor->m_bUseInheriated &&
+ eRetValue != XFA_ItemLayoutProcessorResult::PageFullBreak) {
+ pThis->m_pPageMgr->ProcessOverflow(pFormNode, pTempLeaderNode,
+ pTempTrailerNode, false, true);
+ }
+ if (pTrailerLayoutItem && bIsAddTrailerHeight) {
+ AddTrailerBeforeSplit(pProcessor, fSplitPos, pTrailerLayoutItem,
+ bUseInherited);
+ } else {
+ pProcessor->SplitLayoutItem(fSplitPos);
+ }
+
+ if (bUseInherited) {
+ pProcessor->ProcessUnUseOverFlow(pOverflowLeaderNode,
+ pOverflowTrailerNode, pTrailerLayoutItem,
+ pFormNode);
+ pThis->m_bUseInheriated = true;
+ } else {
+ CXFA_LayoutItem* firstChild = pProcessor->m_pLayoutItem->m_pFirstChild;
+ if (firstChild && !firstChild->m_pNextSibling &&
+ firstChild->m_pFormNode->IsLayoutGeneratedNode()) {
+ pProcessor->ProcessUnUseOverFlow(pOverflowLeaderNode,
+ pOverflowTrailerNode,
+ pTrailerLayoutItem, pFormNode);
+ } else if (pProcessor->JudgeLeaderOrTrailerForOccur(
+ pOverflowLeaderNode)) {
+ AddPendingNode(pProcessor, pOverflowLeaderNode, false);
+ }
+ }
+
+ if (pProcessor->m_pLayoutItem->m_pNextSibling) {
+ childSize = pProcessor->GetCurrentComponentSize();
+ rgCurLineLayoutItems[uHAlign].push_back(pProcessor->ExtractLayoutItem());
+ *bAddedItemInRow = true;
+ if (bTakeSpace) {
+ *fContentCurRowAvailWidth -= childSize.width;
+ *fContentCurRowHeight =
+ std::max(*fContentCurRowHeight, childSize.height);
+ }
+ }
+ return XFA_ItemLayoutProcessorResult::PageFullBreak;
+ }
+
+ if (*fContentCurRowY <= XFA_LAYOUT_FLOAT_PERCISION) {
+ childSize = pProcessor->GetCurrentComponentSize();
+ if (pProcessor->m_pPageMgr->GetNextAvailContentHeight(childSize.height)) {
+ CXFA_Node* pTempLeaderNode = nullptr;
+ CXFA_Node* pTempTrailerNode = nullptr;
+ if (pThis->m_pPageMgr) {
+ if (!pFormNode && pLayoutContext)
+ pFormNode = pLayoutContext->m_pOverflowProcessor->m_pFormNode;
+
+ pThis->m_pPageMgr->ProcessOverflow(pFormNode, pTempLeaderNode,
+ pTempTrailerNode, false, true);
+ }
+ if (bUseInherited) {
+ pProcessor->ProcessUnUseOverFlow(pOverflowLeaderNode,
+ pOverflowTrailerNode,
+ pTrailerLayoutItem, pFormNode);
+ pThis->m_bUseInheriated = true;
+ }
+ return XFA_ItemLayoutProcessorResult::PageFullBreak;
+ }
+
+ rgCurLineLayoutItems[uHAlign].push_back(pProcessor->ExtractLayoutItem());
+ *bAddedItemInRow = true;
+ if (bTakeSpace) {
+ *fContentCurRowAvailWidth -= childSize.width;
+ *fContentCurRowHeight = std::max(*fContentCurRowHeight, childSize.height);
+ }
+ if (eRetValue == XFA_ItemLayoutProcessorResult::Done)
+ *bForceEndPage = false;
+
+ return eRetValue;
+ }
+
+ XFA_ATTRIBUTEENUM eLayout =
+ pProcessor->m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout);
+ if (pProcessor->m_pFormNode->GetIntact() == XFA_ATTRIBUTEENUM_None &&
+ eLayout == XFA_ATTRIBUTEENUM_Tb) {
+ if (pThis->m_pPageMgr) {
+ pThis->m_pPageMgr->ProcessOverflow(pFormNode, pOverflowLeaderNode,
+ pOverflowTrailerNode, false, true);
+ }
+ if (pTrailerLayoutItem)
+ AddTrailerBeforeSplit(pProcessor, fSplitPos, pTrailerLayoutItem, false);
+ if (pProcessor->JudgeLeaderOrTrailerForOccur(pOverflowLeaderNode))
+ AddPendingNode(pProcessor, pOverflowLeaderNode, false);
+
+ return XFA_ItemLayoutProcessorResult::PageFullBreak;
+ }
+
+ if (eRetValue != XFA_ItemLayoutProcessorResult::Done)
+ return XFA_ItemLayoutProcessorResult::PageFullBreak;
+
+ if (!pFormNode && pLayoutContext)
+ pFormNode = pLayoutContext->m_pOverflowProcessor->m_pFormNode;
+ if (pThis->m_pPageMgr) {
+ pThis->m_pPageMgr->ProcessOverflow(pFormNode, pOverflowLeaderNode,
+ pOverflowTrailerNode, false, true);
+ }
+ if (bUseInherited) {
+ pProcessor->ProcessUnUseOverFlow(pOverflowLeaderNode, pOverflowTrailerNode,
+ pTrailerLayoutItem, pFormNode);
+ pThis->m_bUseInheriated = true;
+ }
+ return XFA_ItemLayoutProcessorResult::PageFullBreak;
+}
+
+bool FindLayoutItemSplitPos(CXFA_ContentLayoutItem* pLayoutItem,
+ float fCurVerticalOffset,
+ float* fProposedSplitPos,
+ bool* bAppChange,
+ bool bCalculateMargin) {
+ CXFA_Node* pFormNode = pLayoutItem->m_pFormNode;
+ if (*fProposedSplitPos <= fCurVerticalOffset + XFA_LAYOUT_FLOAT_PERCISION ||
+ *fProposedSplitPos > fCurVerticalOffset + pLayoutItem->m_sSize.height -
+ XFA_LAYOUT_FLOAT_PERCISION) {
+ return false;
+ }
+
+ switch (pFormNode->GetIntact()) {
+ case XFA_ATTRIBUTEENUM_None: {
+ bool bAnyChanged = false;
+ CXFA_Document* pDocument = pFormNode->GetDocument();
+ CXFA_FFNotify* pNotify = pDocument->GetNotify();
+ float fCurTopMargin = 0, fCurBottomMargin = 0;
+ CXFA_Node* pMarginNode =
+ pFormNode->GetFirstChildByClass(XFA_Element::Margin);
+ if (pMarginNode && bCalculateMargin) {
+ fCurTopMargin =
+ pMarginNode->GetMeasure(XFA_ATTRIBUTE_TopInset).ToUnit(XFA_UNIT_Pt);
+ fCurBottomMargin = pMarginNode->GetMeasure(XFA_ATTRIBUTE_BottomInset)
+ .ToUnit(XFA_UNIT_Pt);
+ }
+ bool bChanged = true;
+ while (bChanged) {
+ bChanged = false;
+ {
+ float fRelSplitPos = *fProposedSplitPos - fCurVerticalOffset;
+ if (pNotify->FindSplitPos(pFormNode, pLayoutItem->GetIndex(),
+ fRelSplitPos)) {
+ bAnyChanged = true;
+ bChanged = true;
+ *fProposedSplitPos = fCurVerticalOffset + fRelSplitPos;
+ *bAppChange = true;
+ if (*fProposedSplitPos <=
+ fCurVerticalOffset + XFA_LAYOUT_FLOAT_PERCISION) {
+ return true;
+ }
+ }
+ }
+ float fRelSplitPos = *fProposedSplitPos - fCurBottomMargin;
+ for (CXFA_ContentLayoutItem* pChildItem =
+ (CXFA_ContentLayoutItem*)pLayoutItem->m_pFirstChild;
+ pChildItem;
+ pChildItem = (CXFA_ContentLayoutItem*)pChildItem->m_pNextSibling) {
+ float fChildOffset =
+ fCurVerticalOffset + fCurTopMargin + pChildItem->m_sPos.y;
+ bool bChange = false;
+ if (FindLayoutItemSplitPos(pChildItem, fChildOffset, &fRelSplitPos,
+ &bChange, bCalculateMargin)) {
+ if (fRelSplitPos - fChildOffset < XFA_LAYOUT_FLOAT_PERCISION &&
+ bChange) {
+ *fProposedSplitPos = fRelSplitPos - fCurTopMargin;
+ } else {
+ *fProposedSplitPos = fRelSplitPos + fCurBottomMargin;
+ }
+ bAnyChanged = true;
+ bChanged = true;
+ if (*fProposedSplitPos <=
+ fCurVerticalOffset + XFA_LAYOUT_FLOAT_PERCISION) {
+ return true;
+ }
+ if (bAnyChanged)
+ break;
+ }
+ }
+ }
+ return bAnyChanged;
+ }
+ case XFA_ATTRIBUTEENUM_ContentArea:
+ case XFA_ATTRIBUTEENUM_PageArea: {
+ *fProposedSplitPos = fCurVerticalOffset;
+ return true;
+ }
+ default:
+ return false;
+ }
+}
+
+CFX_PointF CalculatePositionedContainerPos(CXFA_Node* pNode,
+ const CFX_SizeF& size) {
+ XFA_ATTRIBUTEENUM eAnchorType = pNode->GetEnum(XFA_ATTRIBUTE_AnchorType);
+ int32_t nAnchorType = 0;
+ switch (eAnchorType) {
+ case XFA_ATTRIBUTEENUM_TopLeft:
+ nAnchorType = 0;
+ break;
+ case XFA_ATTRIBUTEENUM_TopCenter:
+ nAnchorType = 1;
+ break;
+ case XFA_ATTRIBUTEENUM_TopRight:
+ nAnchorType = 2;
+ break;
+ case XFA_ATTRIBUTEENUM_MiddleLeft:
+ nAnchorType = 3;
+ break;
+ case XFA_ATTRIBUTEENUM_MiddleCenter:
+ nAnchorType = 4;
+ break;
+ case XFA_ATTRIBUTEENUM_MiddleRight:
+ nAnchorType = 5;
+ break;
+ case XFA_ATTRIBUTEENUM_BottomLeft:
+ nAnchorType = 6;
+ break;
+ case XFA_ATTRIBUTEENUM_BottomCenter:
+ nAnchorType = 7;
+ break;
+ case XFA_ATTRIBUTEENUM_BottomRight:
+ nAnchorType = 8;
+ break;
+ default:
+ break;
+ }
+ static const uint8_t nNextPos[4][9] = {{0, 1, 2, 3, 4, 5, 6, 7, 8},
+ {6, 3, 0, 7, 4, 1, 8, 5, 2},
+ {8, 7, 6, 5, 4, 3, 2, 1, 0},
+ {2, 5, 8, 1, 4, 7, 0, 3, 6}};
+
+ CFX_PointF pos(pNode->GetMeasure(XFA_ATTRIBUTE_X).ToUnit(XFA_UNIT_Pt),
+ pNode->GetMeasure(XFA_ATTRIBUTE_Y).ToUnit(XFA_UNIT_Pt));
+ int32_t nRotate =
+ FXSYS_round(pNode->GetMeasure(XFA_ATTRIBUTE_Rotate).GetValue());
+ nRotate = XFA_MapRotation(nRotate) / 90;
+ int32_t nAbsoluteAnchorType = nNextPos[nRotate][nAnchorType];
+ switch (nAbsoluteAnchorType / 3) {
+ case 1:
+ pos.y -= size.height / 2;
+ break;
+ case 2:
+ pos.y -= size.height;
+ break;
+ default:
+ break;
+ }
+ switch (nAbsoluteAnchorType % 3) {
+ case 1:
+ pos.x -= size.width / 2;
+ break;
+ case 2:
+ pos.x -= size.width;
+ break;
+ default:
+ break;
+ }
+ return pos;
+}
+
+} // namespace
+
+CXFA_ItemLayoutProcessor::CXFA_ItemLayoutProcessor(CXFA_Node* pNode,
+ CXFA_LayoutPageMgr* pPageMgr)
+ : m_pFormNode(pNode),
+ m_pLayoutItem(nullptr),
+ m_pCurChildNode(XFA_LAYOUT_INVALIDNODE),
+ m_fUsedSize(0),
+ m_pPageMgr(pPageMgr),
+ m_bBreakPending(true),
+ m_fLastRowWidth(0),
+ m_fLastRowY(0),
+ m_bUseInheriated(false),
+ m_ePreProcessRs(XFA_ItemLayoutProcessorResult::Done),
+ m_bKeepBreakFinish(false),
+ m_bIsProcessKeep(false),
+ m_pKeepHeadNode(nullptr),
+ m_pKeepTailNode(nullptr),
+ m_pOldLayoutItem(nullptr),
+ m_pCurChildPreprocessor(nullptr),
+ m_nCurChildNodeStage(XFA_ItemLayoutProcessorStages::None),
+ m_fWidthLimite(0),
+ m_bHasAvailHeight(true) {
+ ASSERT(m_pFormNode && (m_pFormNode->IsContainerNode() ||
+ m_pFormNode->GetElementType() == XFA_Element::Form));
+ m_pOldLayoutItem =
+ (CXFA_ContentLayoutItem*)m_pFormNode->GetUserData(XFA_LAYOUTITEMKEY);
+}
+
+CXFA_ItemLayoutProcessor::~CXFA_ItemLayoutProcessor() {}
+
+CXFA_ContentLayoutItem* CXFA_ItemLayoutProcessor::CreateContentLayoutItem(
+ CXFA_Node* pFormNode) {
+ if (!pFormNode)
+ return nullptr;
+
+ CXFA_ContentLayoutItem* pLayoutItem = nullptr;
+ if (m_pOldLayoutItem) {
+ pLayoutItem = m_pOldLayoutItem;
+ m_pOldLayoutItem = m_pOldLayoutItem->m_pNext;
+ return pLayoutItem;
+ }
+ pLayoutItem = (CXFA_ContentLayoutItem*)pFormNode->GetDocument()
+ ->GetNotify()
+ ->OnCreateLayoutItem(pFormNode);
+ CXFA_ContentLayoutItem* pPrevLayoutItem =
+ (CXFA_ContentLayoutItem*)pFormNode->GetUserData(XFA_LAYOUTITEMKEY);
+ if (pPrevLayoutItem) {
+ while (pPrevLayoutItem->m_pNext)
+ pPrevLayoutItem = pPrevLayoutItem->m_pNext;
+
+ pPrevLayoutItem->m_pNext = pLayoutItem;
+ pLayoutItem->m_pPrev = pPrevLayoutItem;
+ } else {
+ pFormNode->SetUserData(XFA_LAYOUTITEMKEY, pLayoutItem);
+ }
+ return pLayoutItem;
+}
+
+float CXFA_ItemLayoutProcessor::FindSplitPos(float fProposedSplitPos) {
+ ASSERT(m_pLayoutItem);
+ XFA_ATTRIBUTEENUM eLayout = m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout);
+ bool bCalculateMargin = eLayout != XFA_ATTRIBUTEENUM_Position;
+ while (fProposedSplitPos > XFA_LAYOUT_FLOAT_PERCISION) {
+ bool bAppChange = false;
+ if (!FindLayoutItemSplitPos(m_pLayoutItem, 0, &fProposedSplitPos,
+ &bAppChange, bCalculateMargin)) {
+ break;
+ }
+ }
+ return fProposedSplitPos;
+}
+
+void CXFA_ItemLayoutProcessor::SplitLayoutItem(
+ CXFA_ContentLayoutItem* pLayoutItem,
+ CXFA_ContentLayoutItem* pSecondParent,
+ float fSplitPos) {
+ float fCurTopMargin = 0, fCurBottomMargin = 0;
+ XFA_ATTRIBUTEENUM eLayout = m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout);
+ bool bCalculateMargin = true;
+ if (eLayout == XFA_ATTRIBUTEENUM_Position)
+ bCalculateMargin = false;
+
+ CXFA_Node* pMarginNode =
+ pLayoutItem->m_pFormNode->GetFirstChildByClass(XFA_Element::Margin);
+ if (pMarginNode && bCalculateMargin) {
+ fCurTopMargin =
+ pMarginNode->GetMeasure(XFA_ATTRIBUTE_TopInset).ToUnit(XFA_UNIT_Pt);
+ fCurBottomMargin =
+ pMarginNode->GetMeasure(XFA_ATTRIBUTE_BottomInset).ToUnit(XFA_UNIT_Pt);
+ }
+
+ CXFA_ContentLayoutItem* pSecondLayoutItem = nullptr;
+ if (m_pCurChildPreprocessor &&
+ m_pCurChildPreprocessor->m_pFormNode == pLayoutItem->m_pFormNode) {
+ pSecondLayoutItem = m_pCurChildPreprocessor->CreateContentLayoutItem(
+ pLayoutItem->m_pFormNode);
+ } else {
+ pSecondLayoutItem = CreateContentLayoutItem(pLayoutItem->m_pFormNode);
+ }
+ pSecondLayoutItem->m_sPos.x = pLayoutItem->m_sPos.x;
+ pSecondLayoutItem->m_sSize.width = pLayoutItem->m_sSize.width;
+ pSecondLayoutItem->m_sPos.y = 0;
+ pSecondLayoutItem->m_sSize.height = pLayoutItem->m_sSize.height - fSplitPos;
+ pLayoutItem->m_sSize.height -= pSecondLayoutItem->m_sSize.height;
+ if (pLayoutItem->m_pFirstChild)
+ pSecondLayoutItem->m_sSize.height += fCurTopMargin;
+
+ if (pSecondParent) {
+ pSecondParent->AddChild(pSecondLayoutItem);
+ if (fCurTopMargin > 0 && pLayoutItem->m_pFirstChild) {
+ pSecondParent->m_sSize.height += fCurTopMargin;
+ CXFA_ContentLayoutItem* pParentItem =
+ (CXFA_ContentLayoutItem*)pSecondParent->m_pParent;
+ while (pParentItem) {
+ pParentItem->m_sSize.height += fCurTopMargin;
+ pParentItem = (CXFA_ContentLayoutItem*)pParentItem->m_pParent;
+ }
+ }
+ } else {
+ pSecondLayoutItem->m_pParent = pLayoutItem->m_pParent;
+ pSecondLayoutItem->m_pNextSibling = pLayoutItem->m_pNextSibling;
+ pLayoutItem->m_pNextSibling = pSecondLayoutItem;
+ }
+
+ CXFA_ContentLayoutItem* pChildren =
+ (CXFA_ContentLayoutItem*)pLayoutItem->m_pFirstChild;
+ pLayoutItem->m_pFirstChild = nullptr;
+
+ float lHeightForKeep = 0;
+ float fAddMarginHeight = 0;
+ std::vector<CXFA_ContentLayoutItem*> keepLayoutItems;
+ for (CXFA_ContentLayoutItem *pChildItem = pChildren, *pChildNext = nullptr;
+ pChildItem; pChildItem = pChildNext) {
+ pChildNext = (CXFA_ContentLayoutItem*)pChildItem->m_pNextSibling;
+ pChildItem->m_pNextSibling = nullptr;
+ if (fSplitPos <= fCurTopMargin + pChildItem->m_sPos.y + fCurBottomMargin +
+ XFA_LAYOUT_FLOAT_PERCISION) {
+ if (!ExistContainerKeep(pChildItem->m_pFormNode, true)) {
+ pChildItem->m_sPos.y -= fSplitPos - fCurBottomMargin;
+ pChildItem->m_sPos.y += lHeightForKeep;
+ pChildItem->m_sPos.y += fAddMarginHeight;
+ pSecondLayoutItem->AddChild(pChildItem);
+ continue;
+ }
+ if (lHeightForKeep < XFA_LAYOUT_FLOAT_PERCISION) {
+ for (auto* pPreItem : keepLayoutItems) {
+ pLayoutItem->RemoveChild(pPreItem);
+ pPreItem->m_sPos.y -= fSplitPos;
+ if (pPreItem->m_sPos.y < 0)
+ pPreItem->m_sPos.y = 0;
+ if (pPreItem->m_sPos.y + pPreItem->m_sSize.height > lHeightForKeep) {
+ pPreItem->m_sPos.y = lHeightForKeep;
+ lHeightForKeep += pPreItem->m_sSize.height;
+ pSecondLayoutItem->m_sSize.height += pPreItem->m_sSize.height;
+ if (pSecondParent)
+ pSecondParent->m_sSize.height += pPreItem->m_sSize.height;
+ }
+ pSecondLayoutItem->AddChild(pPreItem);
+ }
+ }
+ pChildItem->m_sPos.y -= fSplitPos;
+ pChildItem->m_sPos.y += lHeightForKeep;
+ pChildItem->m_sPos.y += fAddMarginHeight;
+ pSecondLayoutItem->AddChild(pChildItem);
+ continue;
+ }
+ if (fSplitPos + XFA_LAYOUT_FLOAT_PERCISION >=
+ fCurTopMargin + fCurBottomMargin + pChildItem->m_sPos.y +
+ pChildItem->m_sSize.height) {
+ pLayoutItem->AddChild(pChildItem);
+ if (ExistContainerKeep(pChildItem->m_pFormNode, false))
+ keepLayoutItems.push_back(pChildItem);
+ else
+ keepLayoutItems.clear();
+ continue;
+ }
+
+ float fOldHeight = pSecondLayoutItem->m_sSize.height;
+ SplitLayoutItem(
+ pChildItem, pSecondLayoutItem,
+ fSplitPos - fCurTopMargin - fCurBottomMargin - pChildItem->m_sPos.y);
+ fAddMarginHeight = pSecondLayoutItem->m_sSize.height - fOldHeight;
+ pLayoutItem->AddChild(pChildItem);
+ }
+}
+
+void CXFA_ItemLayoutProcessor::SplitLayoutItem(float fSplitPos) {
+ ASSERT(m_pLayoutItem);
+ SplitLayoutItem(m_pLayoutItem, nullptr, fSplitPos);
+}
+
+CXFA_ContentLayoutItem* CXFA_ItemLayoutProcessor::ExtractLayoutItem() {
+ CXFA_ContentLayoutItem* pLayoutItem = m_pLayoutItem;
+ if (pLayoutItem) {
+ m_pLayoutItem =
+ static_cast<CXFA_ContentLayoutItem*>(pLayoutItem->m_pNextSibling);
+ pLayoutItem->m_pNextSibling = nullptr;
+ }
+
+ if (m_nCurChildNodeStage != XFA_ItemLayoutProcessorStages::Done ||
+ !ToContentLayoutItem(m_pOldLayoutItem)) {
+ return pLayoutItem;
+ }
+
+ if (m_pOldLayoutItem->m_pPrev)
+ m_pOldLayoutItem->m_pPrev->m_pNext = nullptr;
+
+ CXFA_FFNotify* pNotify =
+ m_pOldLayoutItem->m_pFormNode->GetDocument()->GetNotify();
+ CXFA_LayoutProcessor* pDocLayout =
+ m_pOldLayoutItem->m_pFormNode->GetDocument()->GetDocLayout();
+ CXFA_ContentLayoutItem* pOldLayoutItem = m_pOldLayoutItem;
+ while (pOldLayoutItem) {
+ CXFA_ContentLayoutItem* pNextOldLayoutItem = pOldLayoutItem->m_pNext;
+ pNotify->OnLayoutItemRemoving(pDocLayout, pOldLayoutItem);
+ if (pOldLayoutItem->m_pParent)
+ pOldLayoutItem->m_pParent->RemoveChild(pOldLayoutItem);
+
+ delete pOldLayoutItem;
+ pOldLayoutItem = pNextOldLayoutItem;
+ }
+ m_pOldLayoutItem = nullptr;
+ return pLayoutItem;
+}
+
+void CXFA_ItemLayoutProcessor::GotoNextContainerNode(
+ CXFA_Node*& pCurActionNode,
+ XFA_ItemLayoutProcessorStages& nCurStage,
+ CXFA_Node* pParentContainer,
+ bool bUsePageBreak) {
+ CXFA_Node* pEntireContainer = pParentContainer;
+ CXFA_Node* pChildContainer = XFA_LAYOUT_INVALIDNODE;
+ switch (nCurStage) {
+ case XFA_ItemLayoutProcessorStages::BreakBefore:
+ case XFA_ItemLayoutProcessorStages::BreakAfter: {
+ pChildContainer = pCurActionNode->GetNodeItem(XFA_NODEITEM_Parent);
+ break;
+ }
+ case XFA_ItemLayoutProcessorStages::Keep:
+ case XFA_ItemLayoutProcessorStages::Container:
+ pChildContainer = pCurActionNode;
+ break;
+ default:
+ pChildContainer = XFA_LAYOUT_INVALIDNODE;
+ break;
+ }
+
+ switch (nCurStage) {
+ case XFA_ItemLayoutProcessorStages::Keep: {
+ CXFA_Node* pBreakAfterNode =
+ pChildContainer->GetNodeItem(XFA_NODEITEM_FirstChild);
+ if (!m_bKeepBreakFinish &&
+ FindBreakNode(pBreakAfterNode, pCurActionNode, &nCurStage, false)) {
+ return;
+ }
+ goto CheckNextChildContainer;
+ }
+ case XFA_ItemLayoutProcessorStages::None: {
+ pCurActionNode = XFA_LAYOUT_INVALIDNODE;
+ case XFA_ItemLayoutProcessorStages::BookendLeader:
+ for (CXFA_Node* pBookendNode =
+ pCurActionNode == XFA_LAYOUT_INVALIDNODE
+ ? pEntireContainer->GetNodeItem(XFA_NODEITEM_FirstChild)
+ : pCurActionNode->GetNodeItem(XFA_NODEITEM_NextSibling);
+ pBookendNode; pBookendNode = pBookendNode->GetNodeItem(
+ XFA_NODEITEM_NextSibling)) {
+ switch (pBookendNode->GetElementType()) {
+ case XFA_Element::Bookend:
+ case XFA_Element::Break:
+ pCurActionNode = pBookendNode;
+ nCurStage = XFA_ItemLayoutProcessorStages::BookendLeader;
+ return;
+ default:
+ break;
+ }
+ }
+ }
+ {
+ pCurActionNode = XFA_LAYOUT_INVALIDNODE;
+ case XFA_ItemLayoutProcessorStages::BreakBefore:
+ if (pCurActionNode != XFA_LAYOUT_INVALIDNODE) {
+ CXFA_Node* pBreakBeforeNode =
+ pCurActionNode->GetNodeItem(XFA_NODEITEM_NextSibling);
+ if (!m_bKeepBreakFinish &&
+ FindBreakNode(pBreakBeforeNode, pCurActionNode, &nCurStage,
+ true)) {
+ return;
+ }
+ if (m_bIsProcessKeep) {
+ if (ProcessKeepNodesForBreakBefore(pCurActionNode, nCurStage,
+ pChildContainer)) {
+ return;
+ }
+ goto CheckNextChildContainer;
+ }
+ pCurActionNode = pChildContainer;
+ nCurStage = XFA_ItemLayoutProcessorStages::Container;
+ return;
+ }
+ goto CheckNextChildContainer;
+ }
+ case XFA_ItemLayoutProcessorStages::Container: {
+ pCurActionNode = XFA_LAYOUT_INVALIDNODE;
+ case XFA_ItemLayoutProcessorStages::BreakAfter: {
+ if (pCurActionNode == XFA_LAYOUT_INVALIDNODE) {
+ CXFA_Node* pBreakAfterNode =
+ pChildContainer->GetNodeItem(XFA_NODEITEM_FirstChild);
+ if (!m_bKeepBreakFinish &&
+ FindBreakNode(pBreakAfterNode, pCurActionNode, &nCurStage,
+ false)) {
+ return;
+ }
+ } else {
+ CXFA_Node* pBreakAfterNode =
+ pCurActionNode->GetNodeItem(XFA_NODEITEM_NextSibling);
+ if (FindBreakNode(pBreakAfterNode, pCurActionNode, &nCurStage,
+ false)) {
+ return;
+ }
+ }
+ goto CheckNextChildContainer;
+ }
+ }
+
+ CheckNextChildContainer : {
+ CXFA_Node* pNextChildContainer =
+ pChildContainer == XFA_LAYOUT_INVALIDNODE
+ ? pEntireContainer->GetNodeItem(XFA_NODEITEM_FirstChild,
+ XFA_ObjectType::ContainerNode)
+ : pChildContainer->GetNodeItem(XFA_NODEITEM_NextSibling,
+ XFA_ObjectType::ContainerNode);
+ while (pNextChildContainer &&
+ pNextChildContainer->IsLayoutGeneratedNode()) {
+ CXFA_Node* pSaveNode = pNextChildContainer;
+ pNextChildContainer = pNextChildContainer->GetNodeItem(
+ XFA_NODEITEM_NextSibling, XFA_ObjectType::ContainerNode);
+ if (pSaveNode->IsUnusedNode())
+ DeleteLayoutGeneratedNode(pSaveNode);
+ }
+ if (!pNextChildContainer)
+ goto NoMoreChildContainer;
+
+ bool bLastKeep = false;
+ if (ProcessKeepNodesForCheckNext(pCurActionNode, nCurStage,
+ pNextChildContainer, bLastKeep)) {
+ return;
+ }
+ if (!m_bKeepBreakFinish && !bLastKeep &&
+ FindBreakNode(
+ pNextChildContainer->GetNodeItem(XFA_NODEITEM_FirstChild),
+ pCurActionNode, &nCurStage, true)) {
+ return;
+ }
+ pCurActionNode = pNextChildContainer;
+ if (m_bIsProcessKeep)
+ nCurStage = XFA_ItemLayoutProcessorStages::Keep;
+ else
+ nCurStage = XFA_ItemLayoutProcessorStages::Container;
+ return;
+ }
+
+ NoMoreChildContainer : {
+ pCurActionNode = XFA_LAYOUT_INVALIDNODE;
+ case XFA_ItemLayoutProcessorStages::BookendTrailer:
+ for (CXFA_Node* pBookendNode =
+ pCurActionNode == XFA_LAYOUT_INVALIDNODE
+ ? pEntireContainer->GetNodeItem(XFA_NODEITEM_FirstChild)
+ : pCurActionNode->GetNodeItem(XFA_NODEITEM_NextSibling);
+ pBookendNode; pBookendNode = pBookendNode->GetNodeItem(
+ XFA_NODEITEM_NextSibling)) {
+ switch (pBookendNode->GetElementType()) {
+ case XFA_Element::Bookend:
+ case XFA_Element::Break:
+ pCurActionNode = pBookendNode;
+ nCurStage = XFA_ItemLayoutProcessorStages::BookendTrailer;
+ return;
+ default:
+ break;
+ }
+ }
+ }
+ default:
+ pCurActionNode = nullptr;
+ nCurStage = XFA_ItemLayoutProcessorStages::Done;
+ }
+}
+
+bool CXFA_ItemLayoutProcessor::ProcessKeepNodesForCheckNext(
+ CXFA_Node*& pCurActionNode,
+ XFA_ItemLayoutProcessorStages& nCurStage,
+ CXFA_Node*& pNextContainer,
+ bool& bLastKeepNode) {
+ const bool bCanSplit = pNextContainer->GetIntact() == XFA_ATTRIBUTEENUM_None;
+ bool bNextKeep = false;
+ if (ExistContainerKeep(pNextContainer, false))
+ bNextKeep = true;
+
+ if (bNextKeep && !bCanSplit) {
+ if (!m_bIsProcessKeep && !m_bKeepBreakFinish) {
+ m_pKeepHeadNode = pNextContainer;
+ m_bIsProcessKeep = true;
+ }
+ return false;
+ }
+
+ if (m_bIsProcessKeep && m_pKeepHeadNode) {
+ m_pKeepTailNode = pNextContainer;
+ if (!m_bKeepBreakFinish &&
+ FindBreakNode(pNextContainer->GetNodeItem(XFA_NODEITEM_FirstChild),
+ pCurActionNode, &nCurStage, true)) {
+ return true;
+ }
+
+ pNextContainer = m_pKeepHeadNode;
+ m_bKeepBreakFinish = true;
+ m_pKeepHeadNode = nullptr;
+ m_pKeepTailNode = nullptr;
+ m_bIsProcessKeep = false;
+ } else {
+ if (m_bKeepBreakFinish)
+ bLastKeepNode = true;
+ m_bKeepBreakFinish = false;
+ }
+
+ return false;
+}
+
+bool CXFA_ItemLayoutProcessor::ProcessKeepNodesForBreakBefore(
+ CXFA_Node*& pCurActionNode,
+ XFA_ItemLayoutProcessorStages& nCurStage,
+ CXFA_Node* pContainerNode) {
+ if (m_pKeepTailNode == pContainerNode) {
+ pCurActionNode = m_pKeepHeadNode;
+ m_bKeepBreakFinish = true;
+ m_pKeepHeadNode = nullptr;
+ m_pKeepTailNode = nullptr;
+ m_bIsProcessKeep = false;
+ nCurStage = XFA_ItemLayoutProcessorStages::Container;
+ return true;
+ }
+
+ CXFA_Node* pBreakAfterNode =
+ pContainerNode->GetNodeItem(XFA_NODEITEM_FirstChild);
+ return FindBreakNode(pBreakAfterNode, pCurActionNode, &nCurStage, false);
+}
+
+bool XFA_ItemLayoutProcessor_IsTakingSpace(CXFA_Node* pNode) {
+ XFA_ATTRIBUTEENUM ePresence = pNode->GetEnum(XFA_ATTRIBUTE_Presence);
+ return ePresence == XFA_ATTRIBUTEENUM_Visible ||
+ ePresence == XFA_ATTRIBUTEENUM_Invisible;
+}
+
+bool CXFA_ItemLayoutProcessor::IncrementRelayoutNode(
+ CXFA_LayoutProcessor* pLayoutProcessor,
+ CXFA_Node* pNode,
+ CXFA_Node* pParentNode) {
+ return false;
+}
+
+void CXFA_ItemLayoutProcessor::DoLayoutPageArea(
+ CXFA_ContainerLayoutItem* pPageAreaLayoutItem) {
+ CXFA_Node* pFormNode = pPageAreaLayoutItem->m_pFormNode;
+ CXFA_Node* pCurChildNode = XFA_LAYOUT_INVALIDNODE;
+ XFA_ItemLayoutProcessorStages nCurChildNodeStage =
+ XFA_ItemLayoutProcessorStages::None;
+ CXFA_LayoutItem* pBeforeItem = nullptr;
+ for (GotoNextContainerNode(pCurChildNode, nCurChildNodeStage, pFormNode,
+ false);
+ pCurChildNode; GotoNextContainerNode(pCurChildNode, nCurChildNodeStage,
+ pFormNode, false)) {
+ if (nCurChildNodeStage != XFA_ItemLayoutProcessorStages::Container)
+ continue;
+ if (pCurChildNode->GetElementType() == XFA_Element::Variables)
+ continue;
+
+ auto pProcessor =
+ pdfium::MakeUnique<CXFA_ItemLayoutProcessor>(pCurChildNode, nullptr);
+ pProcessor->DoLayout(false, FLT_MAX, FLT_MAX, nullptr);
+ if (!pProcessor->HasLayoutItem())
+ continue;
+
+ pProcessor->SetCurrentComponentPos(CalculatePositionedContainerPos(
+ pCurChildNode, pProcessor->GetCurrentComponentSize()));
+ CXFA_LayoutItem* pProcessItem = pProcessor->ExtractLayoutItem();
+ if (!pBeforeItem)
+ pPageAreaLayoutItem->AddHeadChild(pProcessItem);
+ else
+ pPageAreaLayoutItem->InsertChild(pBeforeItem, pProcessItem);
+
+ pBeforeItem = pProcessItem;
+ }
+
+ pBeforeItem = nullptr;
+ CXFA_LayoutItem* pLayoutItem = pPageAreaLayoutItem->m_pFirstChild;
+ while (pLayoutItem) {
+ if (!pLayoutItem->IsContentLayoutItem() ||
+ pLayoutItem->m_pFormNode->GetElementType() != XFA_Element::Draw) {
+ pLayoutItem = pLayoutItem->m_pNextSibling;
+ continue;
+ }
+ if (pLayoutItem->m_pFormNode->GetElementType() != XFA_Element::Draw)
+ continue;
+
+ CXFA_LayoutItem* pNextLayoutItem = pLayoutItem->m_pNextSibling;
+ pPageAreaLayoutItem->RemoveChild(pLayoutItem);
+ if (!pBeforeItem)
+ pPageAreaLayoutItem->AddHeadChild(pLayoutItem);
+ else
+ pPageAreaLayoutItem->InsertChild(pBeforeItem, pLayoutItem);
+
+ pBeforeItem = pLayoutItem;
+ pLayoutItem = pNextLayoutItem;
+ }
+}
+
+void CXFA_ItemLayoutProcessor::DoLayoutPositionedContainer(
+ CXFA_LayoutContext* pContext) {
+ if (m_pLayoutItem)
+ return;
+
+ m_pLayoutItem = CreateContentLayoutItem(m_pFormNode);
+ bool bIgnoreXY = (m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout) !=
+ XFA_ATTRIBUTEENUM_Position);
+ bool bContainerWidthAutoSize = true;
+ bool bContainerHeightAutoSize = true;
+ CFX_SizeF containerSize = CalculateContainerSpecifiedSize(
+ m_pFormNode, &bContainerWidthAutoSize, &bContainerHeightAutoSize);
+
+ float fContentCalculatedWidth = 0;
+ float fContentCalculatedHeight = 0;
+ float fHiddenContentCalculatedWidth = 0;
+ float fHiddenContentCalculatedHeight = 0;
+ if (m_pCurChildNode == XFA_LAYOUT_INVALIDNODE) {
+ GotoNextContainerNode(m_pCurChildNode, m_nCurChildNodeStage, m_pFormNode,
+ false);
+ }
+
+ int32_t iColIndex = 0;
+ for (; m_pCurChildNode; GotoNextContainerNode(
+ m_pCurChildNode, m_nCurChildNodeStage, m_pFormNode, false)) {
+ if (m_nCurChildNodeStage != XFA_ItemLayoutProcessorStages::Container)
+ continue;
+ if (m_pCurChildNode->GetElementType() == XFA_Element::Variables)
+ continue;
+
+ auto pProcessor = pdfium::MakeUnique<CXFA_ItemLayoutProcessor>(
+ m_pCurChildNode, m_pPageMgr);
+ if (pContext && pContext->m_prgSpecifiedColumnWidths) {
+ int32_t iColSpan = m_pCurChildNode->GetInteger(XFA_ATTRIBUTE_ColSpan);
+ if (iColSpan <= pdfium::CollectionSize<int32_t>(
+ *pContext->m_prgSpecifiedColumnWidths) -
+ iColIndex) {
+ pContext->m_fCurColumnWidth = 0;
+ pContext->m_bCurColumnWidthAvaiable = true;
+ if (iColSpan == -1) {
+ iColSpan = pdfium::CollectionSize<int32_t>(
+ *pContext->m_prgSpecifiedColumnWidths);
+ }
+ for (int32_t i = 0; iColIndex + i < iColSpan; ++i) {
+ pContext->m_fCurColumnWidth +=
+ (*pContext->m_prgSpecifiedColumnWidths)[iColIndex + i];
+ }
+ if (pContext->m_fCurColumnWidth == 0)
+ pContext->m_bCurColumnWidthAvaiable = false;
+
+ iColIndex += iColSpan >= 0 ? iColSpan : 0;
+ }
+ }
+
+ pProcessor->DoLayout(false, FLT_MAX, FLT_MAX, pContext);
+ if (!pProcessor->HasLayoutItem())
+ continue;
+
+ CFX_SizeF size = pProcessor->GetCurrentComponentSize();
+ bool bChangeParentSize = false;
+ if (XFA_ItemLayoutProcessor_IsTakingSpace(m_pCurChildNode))
+ bChangeParentSize = true;
+
+ CFX_PointF absolutePos;
+ if (!bIgnoreXY)
+ absolutePos = CalculatePositionedContainerPos(m_pCurChildNode, size);
+
+ pProcessor->SetCurrentComponentPos(absolutePos);
+ if (bContainerWidthAutoSize) {
+ float fChildSuppliedWidth = absolutePos.x + size.width;
+ if (bChangeParentSize) {
+ fContentCalculatedWidth =
+ std::max(fContentCalculatedWidth, fChildSuppliedWidth);
+ } else {
+ if (fHiddenContentCalculatedWidth < fChildSuppliedWidth &&
+ m_pCurChildNode->GetElementType() != XFA_Element::Subform) {
+ fHiddenContentCalculatedWidth = fChildSuppliedWidth;
+ }
+ }
+ }
+
+ if (bContainerHeightAutoSize) {
+ float fChildSuppliedHeight = absolutePos.y + size.height;
+ if (bChangeParentSize) {
+ fContentCalculatedHeight =
+ std::max(fContentCalculatedHeight, fChildSuppliedHeight);
+ } else {
+ if (fHiddenContentCalculatedHeight < fChildSuppliedHeight &&
+ m_pCurChildNode->GetElementType() != XFA_Element::Subform) {
+ fHiddenContentCalculatedHeight = fChildSuppliedHeight;
+ }
+ }
+ }
+ m_pLayoutItem->AddChild(pProcessor->ExtractLayoutItem());
+ }
+
+ XFA_VERSION eVersion = m_pFormNode->GetDocument()->GetCurVersionMode();
+ if (fContentCalculatedWidth == 0 && eVersion < XFA_VERSION_207)
+ fContentCalculatedWidth = fHiddenContentCalculatedWidth;
+ if (fContentCalculatedHeight == 0 && eVersion < XFA_VERSION_207)
+ fContentCalculatedHeight = fHiddenContentCalculatedHeight;
+
+ containerSize = CalculateContainerComponentSizeFromContentSize(
+ m_pFormNode, bContainerWidthAutoSize, fContentCalculatedWidth,
+ bContainerHeightAutoSize, fContentCalculatedHeight, containerSize);
+ SetCurrentComponentSize(containerSize);
+}
+
+void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) {
+ if (m_pLayoutItem)
+ return;
+ if (!pLayoutNode)
+ pLayoutNode = m_pFormNode;
+
+ ASSERT(m_pCurChildNode == XFA_LAYOUT_INVALIDNODE);
+
+ m_pLayoutItem = CreateContentLayoutItem(m_pFormNode);
+ bool bContainerWidthAutoSize = true;
+ bool bContainerHeightAutoSize = true;
+ CFX_SizeF containerSize = CalculateContainerSpecifiedSize(
+ m_pFormNode, &bContainerWidthAutoSize, &bContainerHeightAutoSize);
+ float fContentCalculatedWidth = 0;
+ float fContentCalculatedHeight = 0;
+ CXFA_Node* pMarginNode =
+ m_pFormNode->GetFirstChildByClass(XFA_Element::Margin);
+ float fLeftInset = 0;
+ float fRightInset = 0;
+ if (pMarginNode) {
+ fLeftInset =
+ pMarginNode->GetMeasure(XFA_ATTRIBUTE_LeftInset).ToUnit(XFA_UNIT_Pt);
+ fRightInset =
+ pMarginNode->GetMeasure(XFA_ATTRIBUTE_RightInset).ToUnit(XFA_UNIT_Pt);
+ }
+
+ float fContentWidthLimit =
+ bContainerWidthAutoSize ? FLT_MAX
+ : containerSize.width - fLeftInset - fRightInset;
+ CFX_WideStringC wsColumnWidths;
+ if (pLayoutNode->TryCData(XFA_ATTRIBUTE_ColumnWidths, wsColumnWidths)) {
+ auto widths = SeparateStringW(wsColumnWidths.c_str(),
+ wsColumnWidths.GetLength(), L' ');
+ for (auto& width : widths) {
+ width.TrimLeft(L' ');
+ if (width.IsEmpty())
+ continue;
+
+ m_rgSpecifiedColumnWidths.push_back(
+ CXFA_Measurement(width.AsStringC()).ToUnit(XFA_UNIT_Pt));
+ }
+ }
+
+ int32_t iSpecifiedColumnCount =
+ pdfium::CollectionSize<int32_t>(m_rgSpecifiedColumnWidths);
+ CXFA_LayoutContext layoutContext;
+ layoutContext.m_prgSpecifiedColumnWidths = &m_rgSpecifiedColumnWidths;
+ CXFA_LayoutContext* pLayoutContext =
+ iSpecifiedColumnCount > 0 ? &layoutContext : nullptr;
+ if (m_pCurChildNode == XFA_LAYOUT_INVALIDNODE) {
+ GotoNextContainerNode(m_pCurChildNode, m_nCurChildNodeStage, m_pFormNode,
+ false);
+ }
+
+ for (; m_pCurChildNode; GotoNextContainerNode(
+ m_pCurChildNode, m_nCurChildNodeStage, m_pFormNode, false)) {
+ layoutContext.m_bCurColumnWidthAvaiable = false;
+ layoutContext.m_fCurColumnWidth = 0;
+ if (m_nCurChildNodeStage != XFA_ItemLayoutProcessorStages::Container)
+ continue;
+
+ auto pProcessor = pdfium::MakeUnique<CXFA_ItemLayoutProcessor>(
+ m_pCurChildNode, m_pPageMgr);
+ pProcessor->DoLayout(false, FLT_MAX, FLT_MAX, pLayoutContext);
+ if (!pProcessor->HasLayoutItem())
+ continue;
+
+ m_pLayoutItem->AddChild(pProcessor->ExtractLayoutItem());
+ }
+
+ int32_t iRowCount = 0;
+ int32_t iColCount = 0;
+ {
+ std::vector<CXFA_ContentLayoutItem*> rgRowItems;
+ std::vector<int32_t> rgRowItemsSpan;
+ std::vector<float> rgRowItemsWidth;
+ for (auto* pLayoutChild =
+ static_cast<CXFA_ContentLayoutItem*>(m_pLayoutItem->m_pFirstChild);
+ pLayoutChild; pLayoutChild = static_cast<CXFA_ContentLayoutItem*>(
+ pLayoutChild->m_pNextSibling)) {
+ if (pLayoutChild->m_pFormNode->GetElementType() != XFA_Element::Subform)
+ continue;
+ if (!XFA_ItemLayoutProcessor_IsTakingSpace(pLayoutChild->m_pFormNode))
+ continue;
+
+ XFA_ATTRIBUTEENUM eLayout =
+ pLayoutChild->m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout);
+ if (eLayout != XFA_ATTRIBUTEENUM_Row &&
+ eLayout != XFA_ATTRIBUTEENUM_Rl_row) {
+ continue;
+ }
+ if (CXFA_ContentLayoutItem* pRowLayoutCell =
+ (CXFA_ContentLayoutItem*)pLayoutChild->m_pFirstChild) {
+ rgRowItems.push_back(pRowLayoutCell);
+ int32_t iColSpan =
+ pRowLayoutCell->m_pFormNode->GetInteger(XFA_ATTRIBUTE_ColSpan);
+ rgRowItemsSpan.push_back(iColSpan);
+ rgRowItemsWidth.push_back(pRowLayoutCell->m_sSize.width);
+ }
+ }
+
+ iRowCount = pdfium::CollectionSize<int32_t>(rgRowItems);
+ iColCount = 0;
+ bool bMoreColumns = true;
+ while (bMoreColumns) {
+ bMoreColumns = false;
+ bool bAutoCol = false;
+ for (int32_t i = 0; i < iRowCount; i++) {
+ while (rgRowItems[i] && (rgRowItemsSpan[i] <= 0 ||
+ !XFA_ItemLayoutProcessor_IsTakingSpace(
+ rgRowItems[i]->m_pFormNode))) {
+ CXFA_ContentLayoutItem* pNewCell =
+ (CXFA_ContentLayoutItem*)rgRowItems[i]->m_pNextSibling;
+ if (rgRowItemsSpan[i] < 0 && XFA_ItemLayoutProcessor_IsTakingSpace(
+ rgRowItems[i]->m_pFormNode)) {
+ pNewCell = nullptr;
+ }
+ rgRowItems[i] = pNewCell;
+ rgRowItemsSpan[i] =
+ pNewCell
+ ? pNewCell->m_pFormNode->GetInteger(XFA_ATTRIBUTE_ColSpan)
+ : 0;
+ rgRowItemsWidth[i] = pNewCell ? pNewCell->m_sSize.width : 0;
+ }
+ CXFA_ContentLayoutItem* pCell = rgRowItems[i];
+ if (!pCell)
+ continue;
+
+ bMoreColumns = true;
+ if (rgRowItemsSpan[i] != 1)
+ continue;
+
+ if (iColCount >= iSpecifiedColumnCount) {
+ int32_t c = iColCount + 1 - pdfium::CollectionSize<int32_t>(
+ m_rgSpecifiedColumnWidths);
+ for (int32_t j = 0; j < c; j++)
+ m_rgSpecifiedColumnWidths.push_back(0);
+ }
+ if (m_rgSpecifiedColumnWidths[iColCount] < XFA_LAYOUT_FLOAT_PERCISION)
+ bAutoCol = true;
+ if (bAutoCol &&
+ m_rgSpecifiedColumnWidths[iColCount] < rgRowItemsWidth[i]) {
+ m_rgSpecifiedColumnWidths[iColCount] = rgRowItemsWidth[i];
+ }
+ }
+
+ if (!bMoreColumns)
+ continue;
+
+ float fFinalColumnWidth = 0.0f;
+ if (pdfium::IndexInBounds(m_rgSpecifiedColumnWidths, iColCount))
+ fFinalColumnWidth = m_rgSpecifiedColumnWidths[iColCount];
+
+ for (int32_t i = 0; i < iRowCount; ++i) {
+ if (!rgRowItems[i])
+ continue;
+ --rgRowItemsSpan[i];
+ rgRowItemsWidth[i] -= fFinalColumnWidth;
+ }
+ ++iColCount;
+ }
+ }
+
+ float fCurrentRowY = 0;
+ for (CXFA_ContentLayoutItem* pLayoutChild =
+ (CXFA_ContentLayoutItem*)m_pLayoutItem->m_pFirstChild;
+ pLayoutChild;
+ pLayoutChild = (CXFA_ContentLayoutItem*)pLayoutChild->m_pNextSibling) {
+ if (!XFA_ItemLayoutProcessor_IsTakingSpace(pLayoutChild->m_pFormNode))
+ continue;
+
+ if (pLayoutChild->m_pFormNode->GetElementType() == XFA_Element::Subform) {
+ XFA_ATTRIBUTEENUM eSubformLayout =
+ pLayoutChild->m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout);
+ if (eSubformLayout == XFA_ATTRIBUTEENUM_Row ||
+ eSubformLayout == XFA_ATTRIBUTEENUM_Rl_row) {
+ RelocateTableRowCells(pLayoutChild, m_rgSpecifiedColumnWidths,
+ eSubformLayout);
+ }
+ }
+
+ pLayoutChild->m_sPos.y = fCurrentRowY;
+ if (bContainerWidthAutoSize) {
+ pLayoutChild->m_sPos.x = 0;
+ } else {
+ switch (pLayoutChild->m_pFormNode->GetEnum(XFA_ATTRIBUTE_HAlign)) {
+ case XFA_ATTRIBUTEENUM_Center:
+ pLayoutChild->m_sPos.x =
+ (fContentWidthLimit - pLayoutChild->m_sSize.width) / 2;
+ break;
+ case XFA_ATTRIBUTEENUM_Right:
+ pLayoutChild->m_sPos.x =
+ fContentWidthLimit - pLayoutChild->m_sSize.width;
+ break;
+ case XFA_ATTRIBUTEENUM_Left:
+ default:
+ pLayoutChild->m_sPos.x = 0;
+ break;
+ }
+ }
+
+ if (bContainerWidthAutoSize) {
+ float fChildSuppliedWidth =
+ pLayoutChild->m_sPos.x + pLayoutChild->m_sSize.width;
+ if (fContentWidthLimit < FLT_MAX &&
+ fContentWidthLimit > fChildSuppliedWidth) {
+ fChildSuppliedWidth = fContentWidthLimit;
+ }
+ fContentCalculatedWidth =
+ std::max(fContentCalculatedWidth, fChildSuppliedWidth);
+ }
+ fCurrentRowY += pLayoutChild->m_sSize.height;
+ }
+
+ if (bContainerHeightAutoSize)
+ fContentCalculatedHeight = std::max(fContentCalculatedHeight, fCurrentRowY);
+
+ containerSize = CalculateContainerComponentSizeFromContentSize(
+ m_pFormNode, bContainerWidthAutoSize, fContentCalculatedWidth,
+ bContainerHeightAutoSize, fContentCalculatedHeight, containerSize);
+ SetCurrentComponentSize(containerSize);
+}
+
+bool CXFA_ItemLayoutProcessor::IsAddNewRowForTrailer(
+ CXFA_ContentLayoutItem* pTrailerItem) {
+ if (!pTrailerItem)
+ return false;
+
+ float fWidth = pTrailerItem->m_sSize.width;
+ XFA_ATTRIBUTEENUM eLayout = m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout);
+ return eLayout == XFA_ATTRIBUTEENUM_Tb || m_fWidthLimite <= fWidth;
+}
+
+float CXFA_ItemLayoutProcessor::InsertKeepLayoutItems() {
+ if (m_arrayKeepItems.empty())
+ return 0;
+
+ if (!m_pLayoutItem) {
+ m_pLayoutItem = CreateContentLayoutItem(m_pFormNode);
+ m_pLayoutItem->m_sSize.clear();
+ }
+
+ float fTotalHeight = 0;
+ for (auto iter = m_arrayKeepItems.rbegin(); iter != m_arrayKeepItems.rend();
+ iter++) {
+ AddLeaderAfterSplit(this, *iter);
+ fTotalHeight += (*iter)->m_sSize.height;
+ }
+ m_arrayKeepItems.clear();
+
+ return fTotalHeight;
+}
+
+bool CXFA_ItemLayoutProcessor::ProcessKeepForSplit(
+ CXFA_ItemLayoutProcessor* pParentProcessor,
+ CXFA_ItemLayoutProcessor* pChildProcessor,
+ XFA_ItemLayoutProcessorResult eRetValue,
+ std::vector<CXFA_ContentLayoutItem*>* rgCurLineLayoutItem,
+ float* fContentCurRowAvailWidth,
+ float* fContentCurRowHeight,
+ float* fContentCurRowY,
+ bool* bAddedItemInRow,
+ bool* bForceEndPage,
+ XFA_ItemLayoutProcessorResult* result) {
+ if (!pParentProcessor || !pChildProcessor)
+ return false;
+
+ if (pParentProcessor->m_pCurChildNode->GetIntact() ==
+ XFA_ATTRIBUTEENUM_None &&
+ pChildProcessor->m_bHasAvailHeight)
+ return false;
+
+ if (!ExistContainerKeep(pParentProcessor->m_pCurChildNode, true))
+ return false;
+
+ CFX_SizeF childSize = pChildProcessor->GetCurrentComponentSize();
+ std::vector<CXFA_ContentLayoutItem*> keepLayoutItems;
+ if (pParentProcessor->JudgePutNextPage(pParentProcessor->m_pLayoutItem,
+ childSize.height, &keepLayoutItems)) {
+ m_arrayKeepItems.clear();
+
+ for (auto* item : keepLayoutItems) {
+ pParentProcessor->m_pLayoutItem->RemoveChild(item);
+ *fContentCurRowY -= item->m_sSize.height;
+ m_arrayKeepItems.push_back(item);
+ }
+ *bAddedItemInRow = true;
+ *bForceEndPage = true;
+ *result = XFA_ItemLayoutProcessorResult::PageFullBreak;
+ return true;
+ }
+
+ rgCurLineLayoutItem->push_back(pChildProcessor->ExtractLayoutItem());
+ *bAddedItemInRow = true;
+ *fContentCurRowAvailWidth -= childSize.width;
+ *fContentCurRowHeight = std::max(*fContentCurRowHeight, childSize.height);
+ *result = eRetValue;
+
+ return true;
+}
+
+bool CXFA_ItemLayoutProcessor::JudgePutNextPage(
+ CXFA_ContentLayoutItem* pParentLayoutItem,
+ float fChildHeight,
+ std::vector<CXFA_ContentLayoutItem*>* pKeepItems) {
+ if (!pParentLayoutItem)
+ return false;
+
+ float fItemsHeight = 0;
+ for (CXFA_ContentLayoutItem* pChildLayoutItem =
+ (CXFA_ContentLayoutItem*)pParentLayoutItem->m_pFirstChild;
+ pChildLayoutItem;
+ pChildLayoutItem =
+ (CXFA_ContentLayoutItem*)pChildLayoutItem->m_pNextSibling) {
+ if (ExistContainerKeep(pChildLayoutItem->m_pFormNode, false)) {
+ pKeepItems->push_back(pChildLayoutItem);
+ fItemsHeight += pChildLayoutItem->m_sSize.height;
+ } else {
+ pKeepItems->clear();
+ fItemsHeight = 0;
+ }
+ }
+ fItemsHeight += fChildHeight;
+ return m_pPageMgr->GetNextAvailContentHeight(fItemsHeight);
+}
+
+void CXFA_ItemLayoutProcessor::ProcessUnUseBinds(CXFA_Node* pFormNode) {
+ if (!pFormNode)
+ return;
+
+ CXFA_NodeIteratorTemplate<CXFA_Node, CXFA_TraverseStrategy_XFANode> sIterator(
+ pFormNode);
+ for (CXFA_Node* pNode = sIterator.MoveToNext(); pNode;
+ pNode = sIterator.MoveToNext()) {
+ if (pNode->IsContainerNode()) {
+ CXFA_Node* pBindNode = pNode->GetBindData();
+ if (pBindNode) {
+ pBindNode->RemoveBindItem(pNode);
+ pNode->SetObject(XFA_ATTRIBUTE_BindingNode, nullptr);
+ }
+ }
+ pNode->SetFlag(XFA_NodeFlag_UnusedNode, true);
+ }
+}
+
+void CXFA_ItemLayoutProcessor::ProcessUnUseOverFlow(
+ CXFA_Node* pLeaderNode,
+ CXFA_Node* pTrailerNode,
+ CXFA_ContentLayoutItem* pTrailerItem,
+ CXFA_Node* pFormNode) {
+ ProcessUnUseBinds(pLeaderNode);
+ ProcessUnUseBinds(pTrailerNode);
+ if (!pFormNode)
+ return;
+
+ if (pFormNode->GetElementType() == XFA_Element::Overflow ||
+ pFormNode->GetElementType() == XFA_Element::Break) {
+ pFormNode = pFormNode->GetNodeItem(XFA_NODEITEM_Parent);
+ }
+ if (pLeaderNode && pFormNode)
+ pFormNode->RemoveChild(pLeaderNode);
+ if (pTrailerNode && pFormNode)
+ pFormNode->RemoveChild(pTrailerNode);
+ if (pTrailerItem)
+ XFA_ReleaseLayoutItem(pTrailerItem);
+}
+
+XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer(
+ bool bUseBreakControl,
+ XFA_ATTRIBUTEENUM eFlowStrategy,
+ float fHeightLimit,
+ float fRealHeight,
+ CXFA_LayoutContext* pContext,
+ bool bRootForceTb) {
+ m_bHasAvailHeight = true;
+ bool bBreakDone = false;
+ bool bContainerWidthAutoSize = true;
+ bool bContainerHeightAutoSize = true;
+ bool bForceEndPage = false;
+ bool bIsManualBreak = false;
+ if (m_pCurChildPreprocessor) {
+ m_pCurChildPreprocessor->m_ePreProcessRs =
+ XFA_ItemLayoutProcessorResult::Done;
+ }
+
+ CFX_SizeF containerSize = CalculateContainerSpecifiedSize(
+ m_pFormNode, &bContainerWidthAutoSize, &bContainerHeightAutoSize);
+ if (pContext && pContext->m_bCurColumnWidthAvaiable) {
+ bContainerWidthAutoSize = false;
+ containerSize.width = pContext->m_fCurColumnWidth;
+ }
+ if (!bContainerHeightAutoSize)
+ containerSize.height -= m_fUsedSize;
+
+ if (!bContainerHeightAutoSize) {
+ CXFA_Node* pParentNode = m_pFormNode->GetNodeItem(XFA_NODEITEM_Parent);
+ bool bFocrTb = false;
+ if (pParentNode &&
+ GetLayout(pParentNode, &bFocrTb) == XFA_ATTRIBUTEENUM_Row) {
+ CXFA_Node* pChildContainer = m_pFormNode->GetNodeItem(
+ XFA_NODEITEM_FirstChild, XFA_ObjectType::ContainerNode);
+ if (pChildContainer &&
+ pChildContainer->GetNodeItem(XFA_NODEITEM_NextSibling,
+ XFA_ObjectType::ContainerNode)) {
+ containerSize.height = 0;
+ bContainerHeightAutoSize = true;
+ }
+ }
+ }
+
+ CXFA_Node* pMarginNode =
+ m_pFormNode->GetFirstChildByClass(XFA_Element::Margin);
+ float fLeftInset = 0;
+ float fTopInset = 0;
+ float fRightInset = 0;
+ float fBottomInset = 0;
+ if (pMarginNode) {
+ fLeftInset =
+ pMarginNode->GetMeasure(XFA_ATTRIBUTE_LeftInset).ToUnit(XFA_UNIT_Pt);
+ fTopInset =
+ pMarginNode->GetMeasure(XFA_ATTRIBUTE_TopInset).ToUnit(XFA_UNIT_Pt);
+ fRightInset =
+ pMarginNode->GetMeasure(XFA_ATTRIBUTE_RightInset).ToUnit(XFA_UNIT_Pt);
+ fBottomInset =
+ pMarginNode->GetMeasure(XFA_ATTRIBUTE_BottomInset).ToUnit(XFA_UNIT_Pt);
+ }
+ float fContentWidthLimit =
+ bContainerWidthAutoSize ? FLT_MAX
+ : containerSize.width - fLeftInset - fRightInset;
+ float fContentCalculatedWidth = 0;
+ float fContentCalculatedHeight = 0;
+ float fAvailHeight = fHeightLimit - fTopInset - fBottomInset;
+ if (fAvailHeight < 0)
+ m_bHasAvailHeight = false;
+
+ fRealHeight = fRealHeight - fTopInset - fBottomInset;
+ float fContentCurRowY = 0;
+ CXFA_ContentLayoutItem* pLayoutChild = nullptr;
+ if (m_pLayoutItem) {
+ if (m_nCurChildNodeStage != XFA_ItemLayoutProcessorStages::Done &&
+ eFlowStrategy != XFA_ATTRIBUTEENUM_Tb) {
+ pLayoutChild = (CXFA_ContentLayoutItem*)m_pLayoutItem->m_pFirstChild;
+ for (CXFA_ContentLayoutItem* pLayoutNext = pLayoutChild; pLayoutNext;
+ pLayoutNext = (CXFA_ContentLayoutItem*)pLayoutNext->m_pNextSibling) {
+ if (pLayoutNext->m_sPos.y != pLayoutChild->m_sPos.y)
+ pLayoutChild = pLayoutNext;
+ }
+ }
+
+ for (CXFA_ContentLayoutItem* pLayoutTempChild =
+ (CXFA_ContentLayoutItem*)m_pLayoutItem->m_pFirstChild;
+ pLayoutTempChild != pLayoutChild;
+ pLayoutTempChild =
+ (CXFA_ContentLayoutItem*)pLayoutTempChild->m_pNextSibling) {
+ if (!XFA_ItemLayoutProcessor_IsTakingSpace(pLayoutTempChild->m_pFormNode))
+ continue;
+
+ fContentCalculatedWidth = std::max(
+ fContentCalculatedWidth,
+ pLayoutTempChild->m_sPos.x + pLayoutTempChild->m_sSize.width);
+ fContentCalculatedHeight = std::max(
+ fContentCalculatedHeight,
+ pLayoutTempChild->m_sPos.y + pLayoutTempChild->m_sSize.height);
+ }
+
+ if (pLayoutChild)
+ fContentCurRowY = pLayoutChild->m_sPos.y;
+ else
+ fContentCurRowY = fContentCalculatedHeight;
+ }
+
+ fContentCurRowY += InsertKeepLayoutItems();
+ if (m_nCurChildNodeStage == XFA_ItemLayoutProcessorStages::None) {
+ GotoNextContainerNode(m_pCurChildNode, m_nCurChildNodeStage, m_pFormNode,
+ true);
+ }
+
+ fContentCurRowY += InsertPendingItems(this, m_pFormNode);
+ if (m_pCurChildPreprocessor &&
+ m_nCurChildNodeStage == XFA_ItemLayoutProcessorStages::Container) {
+ if (ExistContainerKeep(m_pCurChildPreprocessor->GetFormNode(), false)) {
+ m_pKeepHeadNode = m_pCurChildNode;
+ m_bIsProcessKeep = true;
+ m_nCurChildNodeStage = XFA_ItemLayoutProcessorStages::Keep;
+ }
+ }
+
+ while (m_nCurChildNodeStage != XFA_ItemLayoutProcessorStages::Done) {
+ float fContentCurRowHeight = 0;
+ float fContentCurRowAvailWidth = fContentWidthLimit;
+ m_fWidthLimite = fContentCurRowAvailWidth;
+ std::vector<CXFA_ContentLayoutItem*> rgCurLineLayoutItems[3];
+ uint8_t uCurHAlignState =
+ (eFlowStrategy != XFA_ATTRIBUTEENUM_Rl_tb ? 0 : 2);
+ if (pLayoutChild) {
+ for (CXFA_ContentLayoutItem* pLayoutNext = pLayoutChild; pLayoutNext;
+ pLayoutNext = (CXFA_ContentLayoutItem*)pLayoutNext->m_pNextSibling) {
+ if (!pLayoutNext->m_pNextSibling && m_pCurChildPreprocessor &&
+ m_pCurChildPreprocessor->m_pFormNode == pLayoutNext->m_pFormNode) {
+ pLayoutNext->m_pNext = m_pCurChildPreprocessor->m_pLayoutItem;
+ m_pCurChildPreprocessor->m_pLayoutItem = pLayoutNext;
+ break;
+ }
+ uint8_t uHAlign = HAlignEnumToInt(
+ pLayoutNext->m_pFormNode->GetEnum(XFA_ATTRIBUTE_HAlign));
+ rgCurLineLayoutItems[uHAlign].push_back(pLayoutNext);
+ if (eFlowStrategy == XFA_ATTRIBUTEENUM_Lr_tb) {
+ if (uHAlign > uCurHAlignState)
+ uCurHAlignState = uHAlign;
+ } else if (uHAlign < uCurHAlignState) {
+ uCurHAlignState = uHAlign;
+ }
+ if (XFA_ItemLayoutProcessor_IsTakingSpace(pLayoutNext->m_pFormNode)) {
+ if (pLayoutNext->m_sSize.height > fContentCurRowHeight)
+ fContentCurRowHeight = pLayoutNext->m_sSize.height;
+ fContentCurRowAvailWidth -= pLayoutNext->m_sSize.width;
+ }
+ }
+
+ if ((CXFA_ContentLayoutItem*)m_pLayoutItem->m_pFirstChild ==
+ pLayoutChild) {
+ m_pLayoutItem->m_pFirstChild = nullptr;
+ } else {
+ CXFA_ContentLayoutItem* pLayoutNext =
+ (CXFA_ContentLayoutItem*)m_pLayoutItem->m_pFirstChild;
+ for (; pLayoutNext;
+ pLayoutNext =
+ (CXFA_ContentLayoutItem*)pLayoutNext->m_pNextSibling) {
+ if ((CXFA_ContentLayoutItem*)pLayoutNext->m_pNextSibling ==
+ pLayoutChild) {
+ pLayoutNext->m_pNextSibling = nullptr;
+ break;
+ }
+ }
+ }
+
+ CXFA_ContentLayoutItem* pLayoutNextTemp =
+ (CXFA_ContentLayoutItem*)pLayoutChild;
+ while (pLayoutNextTemp) {
+ pLayoutNextTemp->m_pParent = nullptr;
+ CXFA_ContentLayoutItem* pSaveLayoutNext =
+ (CXFA_ContentLayoutItem*)pLayoutNextTemp->m_pNextSibling;
+ pLayoutNextTemp->m_pNextSibling = nullptr;
+ pLayoutNextTemp = pSaveLayoutNext;
+ }
+ pLayoutChild = nullptr;
+ }
+
+ while (m_pCurChildNode) {
+ std::unique_ptr<CXFA_ItemLayoutProcessor> pProcessor;
+ bool bAddedItemInRow = false;
+ fContentCurRowY += InsertPendingItems(this, m_pFormNode);
+ switch (m_nCurChildNodeStage) {
+ case XFA_ItemLayoutProcessorStages::Keep:
+ case XFA_ItemLayoutProcessorStages::None:
+ break;
+ case XFA_ItemLayoutProcessorStages::BreakBefore: {
+ for (auto* item : m_arrayKeepItems) {
+ m_pLayoutItem->RemoveChild(item);
+ fContentCalculatedHeight -= item->m_sSize.height;
+ }
+
+ CXFA_Node* pLeaderNode = nullptr;
+ CXFA_Node* pTrailerNode = nullptr;
+ bool bCreatePage = false;
+ if (!bUseBreakControl || !m_pPageMgr ||
+ !m_pPageMgr->ProcessBreakBeforeOrAfter(m_pCurChildNode, true,
+ pLeaderNode, pTrailerNode,
+ bCreatePage) ||
+ m_pFormNode->GetElementType() == XFA_Element::Form ||
+ !bCreatePage) {
+ break;
+ }
+
+ if (JudgeLeaderOrTrailerForOccur(pLeaderNode))
+ AddPendingNode(this, pLeaderNode, true);
+
+ if (JudgeLeaderOrTrailerForOccur(pTrailerNode)) {
+ if (m_pFormNode->GetNodeItem(XFA_NODEITEM_Parent)
+ ->GetElementType() == XFA_Element::Form &&
+ !m_pLayoutItem) {
+ AddPendingNode(this, pTrailerNode, true);
+ } else {
+ auto pTempProcessor =
+ pdfium::MakeUnique<CXFA_ItemLayoutProcessor>(pTrailerNode,
+ nullptr);
+ InsertFlowedItem(
+ this, pTempProcessor.get(), bContainerWidthAutoSize,
+ bContainerHeightAutoSize, containerSize.height, eFlowStrategy,
+ &uCurHAlignState, rgCurLineLayoutItems, false, FLT_MAX,
+ FLT_MAX, fContentWidthLimit, &fContentCurRowY,
+ &fContentCurRowAvailWidth, &fContentCurRowHeight,
+ &bAddedItemInRow, &bForceEndPage, pContext, false);
+ }
+ }
+ GotoNextContainerNode(m_pCurChildNode, m_nCurChildNodeStage,
+ m_pFormNode, true);
+ bForceEndPage = true;
+ bIsManualBreak = true;
+ goto SuspendAndCreateNewRow;
+ }
+ case XFA_ItemLayoutProcessorStages::BreakAfter: {
+ CXFA_Node* pLeaderNode = nullptr;
+ CXFA_Node* pTrailerNode = nullptr;
+ bool bCreatePage = false;
+ if (!bUseBreakControl || !m_pPageMgr ||
+ !m_pPageMgr->ProcessBreakBeforeOrAfter(m_pCurChildNode, false,
+ pLeaderNode, pTrailerNode,
+ bCreatePage) ||
+ m_pFormNode->GetElementType() == XFA_Element::Form) {
+ break;
+ }
+
+ if (JudgeLeaderOrTrailerForOccur(pTrailerNode)) {
+ auto pTempProcessor = pdfium::MakeUnique<CXFA_ItemLayoutProcessor>(
+ pTrailerNode, nullptr);
+ InsertFlowedItem(
+ this, pTempProcessor.get(), bContainerWidthAutoSize,
+ bContainerHeightAutoSize, containerSize.height, eFlowStrategy,
+ &uCurHAlignState, rgCurLineLayoutItems, false, FLT_MAX, FLT_MAX,
+ fContentWidthLimit, &fContentCurRowY, &fContentCurRowAvailWidth,
+ &fContentCurRowHeight, &bAddedItemInRow, &bForceEndPage,
+ pContext, false);
+ }
+ if (!bCreatePage) {
+ if (JudgeLeaderOrTrailerForOccur(pLeaderNode)) {
+ CalculateRowChildPosition(
+ rgCurLineLayoutItems, eFlowStrategy, bContainerHeightAutoSize,
+ bContainerWidthAutoSize, &fContentCalculatedWidth,
+ &fContentCalculatedHeight, &fContentCurRowY,
+ fContentCurRowHeight, fContentWidthLimit, false);
+ rgCurLineLayoutItems->clear();
+ auto pTempProcessor =
+ pdfium::MakeUnique<CXFA_ItemLayoutProcessor>(pLeaderNode,
+ nullptr);
+ InsertFlowedItem(
+ this, pTempProcessor.get(), bContainerWidthAutoSize,
+ bContainerHeightAutoSize, containerSize.height, eFlowStrategy,
+ &uCurHAlignState, rgCurLineLayoutItems, false, FLT_MAX,
+ FLT_MAX, fContentWidthLimit, &fContentCurRowY,
+ &fContentCurRowAvailWidth, &fContentCurRowHeight,
+ &bAddedItemInRow, &bForceEndPage, pContext, false);
+ }
+ } else {
+ if (JudgeLeaderOrTrailerForOccur(pLeaderNode))
+ AddPendingNode(this, pLeaderNode, true);
+ }
+
+ GotoNextContainerNode(m_pCurChildNode, m_nCurChildNodeStage,
+ m_pFormNode, true);
+ if (bCreatePage) {
+ bForceEndPage = true;
+ bIsManualBreak = true;
+ if (m_nCurChildNodeStage == XFA_ItemLayoutProcessorStages::Done)
+ bBreakDone = true;
+ }
+ goto SuspendAndCreateNewRow;
+ }
+ case XFA_ItemLayoutProcessorStages::BookendLeader: {
+ CXFA_Node* pLeaderNode = nullptr;
+ if (m_pCurChildPreprocessor) {
+ pProcessor.reset(m_pCurChildPreprocessor);
+ m_pCurChildPreprocessor = nullptr;
+ } else if (m_pPageMgr &&
+ m_pPageMgr->ProcessBookendLeaderOrTrailer(
+ m_pCurChildNode, true, pLeaderNode)) {
+ pProcessor = pdfium::MakeUnique<CXFA_ItemLayoutProcessor>(
+ pLeaderNode, m_pPageMgr);
+ }
+
+ if (pProcessor) {
+ if (InsertFlowedItem(
+ this, pProcessor.get(), bContainerWidthAutoSize,
+ bContainerHeightAutoSize, containerSize.height,
+ eFlowStrategy, &uCurHAlignState, rgCurLineLayoutItems,
+ bUseBreakControl, fAvailHeight, fRealHeight,
+ fContentWidthLimit, &fContentCurRowY,
+ &fContentCurRowAvailWidth, &fContentCurRowHeight,
+ &bAddedItemInRow, &bForceEndPage, pContext,
+ false) != XFA_ItemLayoutProcessorResult::Done) {
+ goto SuspendAndCreateNewRow;
+ } else {
+ pProcessor.reset();
+ }
+ }
+ break;
+ }
+ case XFA_ItemLayoutProcessorStages::BookendTrailer: {
+ CXFA_Node* pTrailerNode = nullptr;
+ if (m_pCurChildPreprocessor) {
+ pProcessor.reset(m_pCurChildPreprocessor);
+ m_pCurChildPreprocessor = nullptr;
+ } else if (m_pPageMgr &&
+ m_pPageMgr->ProcessBookendLeaderOrTrailer(
+ m_pCurChildNode, false, pTrailerNode)) {
+ pProcessor = pdfium::MakeUnique<CXFA_ItemLayoutProcessor>(
+ pTrailerNode, m_pPageMgr);
+ }
+ if (pProcessor) {
+ if (InsertFlowedItem(
+ this, pProcessor.get(), bContainerWidthAutoSize,
+ bContainerHeightAutoSize, containerSize.height,
+ eFlowStrategy, &uCurHAlignState, rgCurLineLayoutItems,
+ bUseBreakControl, fAvailHeight, fRealHeight,
+ fContentWidthLimit, &fContentCurRowY,
+ &fContentCurRowAvailWidth, &fContentCurRowHeight,
+ &bAddedItemInRow, &bForceEndPage, pContext,
+ false) != XFA_ItemLayoutProcessorResult::Done) {
+ goto SuspendAndCreateNewRow;
+ } else {
+ pProcessor.reset();
+ }
+ }
+ break;
+ }
+ case XFA_ItemLayoutProcessorStages::Container: {
+ ASSERT(m_pCurChildNode->IsContainerNode());
+ if (m_pCurChildNode->GetElementType() == XFA_Element::Variables)
+ break;
+ if (fContentCurRowY >= fHeightLimit + XFA_LAYOUT_FLOAT_PERCISION &&
+ XFA_ItemLayoutProcessor_IsTakingSpace(m_pCurChildNode)) {
+ bForceEndPage = true;
+ goto SuspendAndCreateNewRow;
+ }
+ if (!m_pCurChildNode->IsContainerNode())
+ break;
+
+ bool bNewRow = false;
+ if (m_pCurChildPreprocessor) {
+ pProcessor.reset(m_pCurChildPreprocessor);
+ m_pCurChildPreprocessor = nullptr;
+ bNewRow = true;
+ } else {
+ pProcessor = pdfium::MakeUnique<CXFA_ItemLayoutProcessor>(
+ m_pCurChildNode, m_pPageMgr);
+ }
+
+ InsertPendingItems(pProcessor.get(), m_pCurChildNode);
+ XFA_ItemLayoutProcessorResult rs = InsertFlowedItem(
+ this, pProcessor.get(), bContainerWidthAutoSize,
+ bContainerHeightAutoSize, containerSize.height, eFlowStrategy,
+ &uCurHAlignState, rgCurLineLayoutItems, bUseBreakControl,
+ fAvailHeight, fRealHeight, fContentWidthLimit, &fContentCurRowY,
+ &fContentCurRowAvailWidth, &fContentCurRowHeight,
+ &bAddedItemInRow, &bForceEndPage, pContext, bNewRow);
+ switch (rs) {
+ case XFA_ItemLayoutProcessorResult::ManualBreak:
+ bIsManualBreak = true;
+ case XFA_ItemLayoutProcessorResult::PageFullBreak:
+ bForceEndPage = true;
+ case XFA_ItemLayoutProcessorResult::RowFullBreak:
+ goto SuspendAndCreateNewRow;
+ case XFA_ItemLayoutProcessorResult::Done:
+ default:
+ fContentCurRowY +=
+ InsertPendingItems(pProcessor.get(), m_pCurChildNode);
+ pProcessor.reset();
+ }
+ break;
+ }
+ case XFA_ItemLayoutProcessorStages::Done:
+ break;
+ default:
+ break;
+ }
+ GotoNextContainerNode(m_pCurChildNode, m_nCurChildNodeStage, m_pFormNode,
+ true);
+ if (bAddedItemInRow && eFlowStrategy == XFA_ATTRIBUTEENUM_Tb)
+ break;
+ else
+ continue;
+ SuspendAndCreateNewRow:
+ if (pProcessor)
+ m_pCurChildPreprocessor = pProcessor.release();
+ break;
+ }
+
+ CalculateRowChildPosition(
+ rgCurLineLayoutItems, eFlowStrategy, bContainerHeightAutoSize,
+ bContainerWidthAutoSize, &fContentCalculatedWidth,
+ &fContentCalculatedHeight, &fContentCurRowY, fContentCurRowHeight,
+ fContentWidthLimit, bRootForceTb);
+ m_fWidthLimite = fContentCurRowAvailWidth;
+ if (bForceEndPage)
+ break;
+ }
+
+ bool bRetValue =
+ m_nCurChildNodeStage == XFA_ItemLayoutProcessorStages::Done &&
+ m_PendingNodes.empty();
+ if (bBreakDone)
+ bRetValue = false;
+
+ containerSize = CalculateContainerComponentSizeFromContentSize(
+ m_pFormNode, bContainerWidthAutoSize, fContentCalculatedWidth,
+ bContainerHeightAutoSize, fContentCalculatedHeight, containerSize);
+
+ if (containerSize.height >= XFA_LAYOUT_FLOAT_PERCISION || m_pLayoutItem ||
+ bRetValue) {
+ if (!m_pLayoutItem)
+ m_pLayoutItem = CreateContentLayoutItem(m_pFormNode);
+ containerSize.height = std::max(containerSize.height, 0.f);
+
+ SetCurrentComponentSize(containerSize);
+ if (bForceEndPage)
+ m_fUsedSize = 0;
+ else
+ m_fUsedSize += m_pLayoutItem->m_sSize.height;
+ }
+
+ return bRetValue
+ ? XFA_ItemLayoutProcessorResult::Done
+ : (bIsManualBreak ? XFA_ItemLayoutProcessorResult::ManualBreak
+ : XFA_ItemLayoutProcessorResult::PageFullBreak);
+}
+
+bool CXFA_ItemLayoutProcessor::CalculateRowChildPosition(
+ std::vector<CXFA_ContentLayoutItem*> (&rgCurLineLayoutItems)[3],
+ XFA_ATTRIBUTEENUM eFlowStrategy,
+ bool bContainerHeightAutoSize,
+ bool bContainerWidthAutoSize,
+ float* fContentCalculatedWidth,
+ float* fContentCalculatedHeight,
+ float* fContentCurRowY,
+ float fContentCurRowHeight,
+ float fContentWidthLimit,
+ bool bRootForceTb) {
+ int32_t nGroupLengths[3] = {0, 0, 0};
+ float fGroupWidths[3] = {0, 0, 0};
+ int32_t nTotalLength = 0;
+ for (int32_t i = 0; i < 3; i++) {
+ nGroupLengths[i] = pdfium::CollectionSize<int32_t>(rgCurLineLayoutItems[i]);
+ for (int32_t c = nGroupLengths[i], j = 0; j < c; j++) {
+ nTotalLength++;
+ if (XFA_ItemLayoutProcessor_IsTakingSpace(
+ rgCurLineLayoutItems[i][j]->m_pFormNode)) {
+ fGroupWidths[i] += rgCurLineLayoutItems[i][j]->m_sSize.width;
+ }
+ }
+ }
+ if (!nTotalLength) {
+ if (bContainerHeightAutoSize) {
+ *fContentCalculatedHeight =
+ std::min(*fContentCalculatedHeight, *fContentCurRowY);
+ }
+ return false;
+ }
+ if (!m_pLayoutItem)
+ m_pLayoutItem = CreateContentLayoutItem(m_pFormNode);
+
+ if (eFlowStrategy != XFA_ATTRIBUTEENUM_Rl_tb) {
+ float fCurPos;
+ fCurPos = 0;
+ for (int32_t c = nGroupLengths[0], j = 0; j < c; j++) {
+ if (bRootForceTb) {
+ rgCurLineLayoutItems[0][j]->m_sPos = CalculatePositionedContainerPos(
+ rgCurLineLayoutItems[0][j]->m_pFormNode,
+ rgCurLineLayoutItems[0][j]->m_sSize);
+ } else {
+ rgCurLineLayoutItems[0][j]->m_sPos =
+ CFX_PointF(fCurPos, *fContentCurRowY);
+ if (XFA_ItemLayoutProcessor_IsTakingSpace(
+ rgCurLineLayoutItems[0][j]->m_pFormNode)) {
+ fCurPos += rgCurLineLayoutItems[0][j]->m_sSize.width;
+ }
+ }
+ m_pLayoutItem->AddChild(rgCurLineLayoutItems[0][j]);
+ m_fLastRowWidth = fCurPos;
+ }
+ fCurPos = (fContentWidthLimit + fGroupWidths[0] - fGroupWidths[1] -
+ fGroupWidths[2]) /
+ 2;
+ for (int32_t c = nGroupLengths[1], j = 0; j < c; j++) {
+ if (bRootForceTb) {
+ rgCurLineLayoutItems[1][j]->m_sPos = CalculatePositionedContainerPos(
+ rgCurLineLayoutItems[1][j]->m_pFormNode,
+ rgCurLineLayoutItems[1][j]->m_sSize);
+ } else {
+ rgCurLineLayoutItems[1][j]->m_sPos =
+ CFX_PointF(fCurPos, *fContentCurRowY);
+ if (XFA_ItemLayoutProcessor_IsTakingSpace(
+ rgCurLineLayoutItems[1][j]->m_pFormNode)) {
+ fCurPos += rgCurLineLayoutItems[1][j]->m_sSize.width;
+ }
+ }
+ m_pLayoutItem->AddChild(rgCurLineLayoutItems[1][j]);
+ m_fLastRowWidth = fCurPos;
+ }
+ fCurPos = fContentWidthLimit - fGroupWidths[2];
+ for (int32_t c = nGroupLengths[2], j = 0; j < c; j++) {
+ if (bRootForceTb) {
+ rgCurLineLayoutItems[2][j]->m_sPos = CalculatePositionedContainerPos(
+ rgCurLineLayoutItems[2][j]->m_pFormNode,
+ rgCurLineLayoutItems[2][j]->m_sSize);
+ } else {
+ rgCurLineLayoutItems[2][j]->m_sPos =
+ CFX_PointF(fCurPos, *fContentCurRowY);
+ if (XFA_ItemLayoutProcessor_IsTakingSpace(
+ rgCurLineLayoutItems[2][j]->m_pFormNode)) {
+ fCurPos += rgCurLineLayoutItems[2][j]->m_sSize.width;
+ }
+ }
+ m_pLayoutItem->AddChild(rgCurLineLayoutItems[2][j]);
+ m_fLastRowWidth = fCurPos;
+ }
+ } else {
+ float fCurPos;
+ fCurPos = fGroupWidths[0];
+ for (int32_t c = nGroupLengths[0], j = 0; j < c; j++) {
+ if (XFA_ItemLayoutProcessor_IsTakingSpace(
+ rgCurLineLayoutItems[0][j]->m_pFormNode)) {
+ fCurPos -= rgCurLineLayoutItems[0][j]->m_sSize.width;
+ }
+ rgCurLineLayoutItems[0][j]->m_sPos =
+ CFX_PointF(fCurPos, *fContentCurRowY);
+ m_pLayoutItem->AddChild(rgCurLineLayoutItems[0][j]);
+ m_fLastRowWidth = fCurPos;
+ }
+ fCurPos = (fContentWidthLimit + fGroupWidths[0] + fGroupWidths[1] -
+ fGroupWidths[2]) /
+ 2;
+ for (int32_t c = nGroupLengths[1], j = 0; j < c; j++) {
+ if (XFA_ItemLayoutProcessor_IsTakingSpace(
+ rgCurLineLayoutItems[1][j]->m_pFormNode)) {
+ fCurPos -= rgCurLineLayoutItems[1][j]->m_sSize.width;
+ }
+ rgCurLineLayoutItems[1][j]->m_sPos =
+ CFX_PointF(fCurPos, *fContentCurRowY);
+ m_pLayoutItem->AddChild(rgCurLineLayoutItems[1][j]);
+ m_fLastRowWidth = fCurPos;
+ }
+ fCurPos = fContentWidthLimit;
+ for (int32_t c = nGroupLengths[2], j = 0; j < c; j++) {
+ if (XFA_ItemLayoutProcessor_IsTakingSpace(
+ rgCurLineLayoutItems[2][j]->m_pFormNode)) {
+ fCurPos -= rgCurLineLayoutItems[2][j]->m_sSize.width;
+ }
+ rgCurLineLayoutItems[2][j]->m_sPos =
+ CFX_PointF(fCurPos, *fContentCurRowY);
+ m_pLayoutItem->AddChild(rgCurLineLayoutItems[2][j]);
+ m_fLastRowWidth = fCurPos;
+ }
+ }
+ m_fLastRowY = *fContentCurRowY;
+ *fContentCurRowY += fContentCurRowHeight;
+ if (bContainerWidthAutoSize) {
+ float fChildSuppliedWidth = fGroupWidths[0];
+ if (fContentWidthLimit < FLT_MAX &&
+ fContentWidthLimit > fChildSuppliedWidth) {
+ fChildSuppliedWidth = fContentWidthLimit;
+ }
+ *fContentCalculatedWidth =
+ std::max(*fContentCalculatedWidth, fChildSuppliedWidth);
+ }
+ if (bContainerHeightAutoSize) {
+ *fContentCalculatedHeight =
+ std::max(*fContentCalculatedHeight, *fContentCurRowY);
+ }
+ return true;
+}
+
+CXFA_Node* CXFA_ItemLayoutProcessor::GetSubformSetParent(
+ CXFA_Node* pSubformSet) {
+ if (pSubformSet && pSubformSet->GetElementType() == XFA_Element::SubformSet) {
+ CXFA_Node* pParent = pSubformSet->GetNodeItem(XFA_NODEITEM_Parent);
+ while (pParent) {
+ if (pParent->GetElementType() != XFA_Element::SubformSet)
+ return pParent;
+ pParent = pParent->GetNodeItem(XFA_NODEITEM_Parent);
+ }
+ }
+ return pSubformSet;
+}
+
+void CXFA_ItemLayoutProcessor::DoLayoutField() {
+ if (m_pLayoutItem)
+ return;
+
+ ASSERT(m_pCurChildNode == XFA_LAYOUT_INVALIDNODE);
+ m_pLayoutItem = CreateContentLayoutItem(m_pFormNode);
+ if (!m_pLayoutItem)
+ return;
+
+ CXFA_Document* pDocument = m_pFormNode->GetDocument();
+ CXFA_FFNotify* pNotify = pDocument->GetNotify();
+ CFX_SizeF size(-1, -1);
+ pNotify->StartFieldDrawLayout(m_pFormNode, size.width, size.height);
+
+ int32_t nRotate =
+ FXSYS_round(m_pFormNode->GetMeasure(XFA_ATTRIBUTE_Rotate).GetValue());
+ nRotate = XFA_MapRotation(nRotate);
+ if (nRotate == 90 || nRotate == 270)
+ std::swap(size.width, size.height);
+
+ SetCurrentComponentSize(size);
+}
+
+XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayout(
+ bool bUseBreakControl,
+ float fHeightLimit,
+ float fRealHeight,
+ CXFA_LayoutContext* pContext) {
+ switch (m_pFormNode->GetElementType()) {
+ case XFA_Element::Subform:
+ case XFA_Element::Area:
+ case XFA_Element::ExclGroup:
+ case XFA_Element::SubformSet: {
+ bool bRootForceTb = false;
+ CXFA_Node* pLayoutNode = GetSubformSetParent(m_pFormNode);
+ XFA_ATTRIBUTEENUM eLayoutStrategy = GetLayout(pLayoutNode, &bRootForceTb);
+ switch (eLayoutStrategy) {
+ case XFA_ATTRIBUTEENUM_Tb:
+ case XFA_ATTRIBUTEENUM_Lr_tb:
+ case XFA_ATTRIBUTEENUM_Rl_tb:
+ return DoLayoutFlowedContainer(bUseBreakControl, eLayoutStrategy,
+ fHeightLimit, fRealHeight, pContext,
+ bRootForceTb);
+ case XFA_ATTRIBUTEENUM_Position:
+ case XFA_ATTRIBUTEENUM_Row:
+ case XFA_ATTRIBUTEENUM_Rl_row:
+ default:
+ DoLayoutPositionedContainer(pContext);
+ m_nCurChildNodeStage = XFA_ItemLayoutProcessorStages::Done;
+ return XFA_ItemLayoutProcessorResult::Done;
+ case XFA_ATTRIBUTEENUM_Table:
+ DoLayoutTableContainer(pLayoutNode);
+ m_nCurChildNodeStage = XFA_ItemLayoutProcessorStages::Done;
+ return XFA_ItemLayoutProcessorResult::Done;
+ }
+ }
+ case XFA_Element::Draw:
+ case XFA_Element::Field:
+ DoLayoutField();
+ m_nCurChildNodeStage = XFA_ItemLayoutProcessorStages::Done;
+ return XFA_ItemLayoutProcessorResult::Done;
+ case XFA_Element::ContentArea:
+ return XFA_ItemLayoutProcessorResult::Done;
+ default:
+ return XFA_ItemLayoutProcessorResult::Done;
+ }
+}
+
+CFX_SizeF CXFA_ItemLayoutProcessor::GetCurrentComponentSize() {
+ return CFX_SizeF(m_pLayoutItem->m_sSize.width, m_pLayoutItem->m_sSize.height);
+}
+
+void CXFA_ItemLayoutProcessor::SetCurrentComponentPos(const CFX_PointF& pos) {
+ m_pLayoutItem->m_sPos = pos;
+}
+
+void CXFA_ItemLayoutProcessor::SetCurrentComponentSize(const CFX_SizeF& size) {
+ m_pLayoutItem->m_sSize = size;
+}
+
+bool CXFA_ItemLayoutProcessor::JudgeLeaderOrTrailerForOccur(
+ CXFA_Node* pFormNode) {
+ if (!pFormNode)
+ return false;
+
+ CXFA_Node* pTemplate = pFormNode->GetTemplateNode();
+ if (!pTemplate)
+ pTemplate = pFormNode;
+
+ CXFA_Occur NodeOccur(pTemplate->GetFirstChildByClass(XFA_Element::Occur));
+ int32_t iMax = NodeOccur.GetMax();
+ if (iMax < 0)
+ return true;
+
+ int32_t iCount = m_PendingNodesCount[pTemplate];
+ if (iCount >= iMax)
+ return false;
+
+ m_PendingNodesCount[pTemplate] = iCount + 1;
+ return true;
+}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_itemlayoutprocessor.h b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_itemlayoutprocessor.h
new file mode 100644
index 00000000000..d5d706e62e6
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_itemlayoutprocessor.h
@@ -0,0 +1,172 @@
+// 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 XFA_FXFA_PARSER_CXFA_ITEMLAYOUTPROCESSOR_H_
+#define XFA_FXFA_PARSER_CXFA_ITEMLAYOUTPROCESSOR_H_
+
+#include <float.h>
+
+#include <list>
+#include <map>
+#include <tuple>
+#include <vector>
+
+#include "core/fxcrt/fx_basic.h"
+#include "core/fxcrt/fx_coordinates.h"
+#include "xfa/fxfa/fxfa_basic.h"
+
+#define XFA_LAYOUT_INVALIDNODE ((CXFA_Node*)(intptr_t)-1)
+#define XFA_LAYOUT_FLOAT_PERCISION (0.0005f)
+
+class CXFA_ContainerLayoutItem;
+class CXFA_ContentLayoutItem;
+class CXFA_ItemLayoutProcessor;
+class CXFA_LayoutContext;
+class CXFA_LayoutPageMgr;
+class CXFA_LayoutProcessor;
+class CXFA_Node;
+
+enum class XFA_ItemLayoutProcessorResult {
+ Done,
+ PageFullBreak,
+ RowFullBreak,
+ ManualBreak,
+};
+
+enum class XFA_ItemLayoutProcessorStages {
+ None,
+ BookendLeader,
+ BreakBefore,
+ Keep,
+ Container,
+ BreakAfter,
+ BookendTrailer,
+ Done,
+};
+
+bool XFA_ItemLayoutProcessor_IsTakingSpace(CXFA_Node* pNode);
+
+class CXFA_ItemLayoutProcessor {
+ public:
+ static bool IncrementRelayoutNode(CXFA_LayoutProcessor* pLayoutProcessor,
+ CXFA_Node* pNode,
+ CXFA_Node* pParentNode);
+
+ CXFA_ItemLayoutProcessor(CXFA_Node* pNode, CXFA_LayoutPageMgr* pPageMgr);
+ ~CXFA_ItemLayoutProcessor();
+
+ XFA_ItemLayoutProcessorResult DoLayout(bool bUseBreakControl,
+ float fHeightLimit,
+ float fRealHeight,
+ CXFA_LayoutContext* pContext);
+ void DoLayoutPageArea(CXFA_ContainerLayoutItem* pPageAreaLayoutItem);
+
+ CFX_SizeF GetCurrentComponentSize();
+ CXFA_Node* GetFormNode() { return m_pFormNode; }
+ bool HasLayoutItem() const { return !!m_pLayoutItem; }
+ CXFA_ContentLayoutItem* ExtractLayoutItem();
+ void SplitLayoutItem(float fSplitPos);
+
+ float FindSplitPos(float fProposedSplitPos);
+
+ bool ProcessKeepForSplit(
+ CXFA_ItemLayoutProcessor* pParentProcessor,
+ CXFA_ItemLayoutProcessor* pChildProcessor,
+ XFA_ItemLayoutProcessorResult eRetValue,
+ std::vector<CXFA_ContentLayoutItem*>* rgCurLineLayoutItem,
+ float* fContentCurRowAvailWidth,
+ float* fContentCurRowHeight,
+ float* fContentCurRowY,
+ bool* bAddedItemInRow,
+ bool* bForceEndPage,
+ XFA_ItemLayoutProcessorResult* result);
+ void ProcessUnUseOverFlow(CXFA_Node* pLeaderNode,
+ CXFA_Node* pTrailerNode,
+ CXFA_ContentLayoutItem* pTrailerItem,
+ CXFA_Node* pFormNode);
+ bool IsAddNewRowForTrailer(CXFA_ContentLayoutItem* pTrailerItem);
+ bool JudgeLeaderOrTrailerForOccur(CXFA_Node* pFormNode);
+
+ CXFA_ContentLayoutItem* CreateContentLayoutItem(CXFA_Node* pFormNode);
+
+ CXFA_Node* m_pFormNode;
+ CXFA_ContentLayoutItem* m_pLayoutItem;
+ CXFA_Node* m_pCurChildNode;
+ float m_fUsedSize;
+ CXFA_LayoutPageMgr* m_pPageMgr;
+ std::list<CXFA_Node*> m_PendingNodes;
+ bool m_bBreakPending;
+ std::vector<float> m_rgSpecifiedColumnWidths;
+ std::vector<CXFA_ContentLayoutItem*> m_arrayKeepItems;
+ float m_fLastRowWidth;
+ float m_fLastRowY;
+ bool m_bUseInheriated;
+ XFA_ItemLayoutProcessorResult m_ePreProcessRs;
+
+ private:
+ void SetCurrentComponentPos(const CFX_PointF& pos);
+ void SetCurrentComponentSize(const CFX_SizeF& size);
+
+ void SplitLayoutItem(CXFA_ContentLayoutItem* pLayoutItem,
+ CXFA_ContentLayoutItem* pSecondParent,
+ float fSplitPos);
+ float InsertKeepLayoutItems();
+ bool CalculateRowChildPosition(
+ std::vector<CXFA_ContentLayoutItem*> (&rgCurLineLayoutItems)[3],
+ XFA_ATTRIBUTEENUM eFlowStrategy,
+ bool bContainerHeightAutoSize,
+ bool bContainerWidthAutoSize,
+ float* fContentCalculatedWidth,
+ float* fContentCalculatedHeight,
+ float* fContentCurRowY,
+ float fContentCurRowHeight,
+ float fContentWidthLimit,
+ bool bRootForceTb);
+ void ProcessUnUseBinds(CXFA_Node* pFormNode);
+ bool JudgePutNextPage(CXFA_ContentLayoutItem* pParentLayoutItem,
+ float fChildHeight,
+ std::vector<CXFA_ContentLayoutItem*>* pKeepItems);
+
+ void DoLayoutPositionedContainer(CXFA_LayoutContext* pContext);
+ void DoLayoutTableContainer(CXFA_Node* pLayoutNode);
+ XFA_ItemLayoutProcessorResult DoLayoutFlowedContainer(
+ bool bUseBreakControl,
+ XFA_ATTRIBUTEENUM eFlowStrategy,
+ float fHeightLimit,
+ float fRealHeight,
+ CXFA_LayoutContext* pContext,
+ bool bRootForceTb);
+ void DoLayoutField();
+
+ void GotoNextContainerNode(CXFA_Node*& pCurActionNode,
+ XFA_ItemLayoutProcessorStages& nCurStage,
+ CXFA_Node* pParentContainer,
+ bool bUsePageBreak);
+
+ bool ProcessKeepNodesForCheckNext(CXFA_Node*& pCurActionNode,
+ XFA_ItemLayoutProcessorStages& nCurStage,
+ CXFA_Node*& pNextContainer,
+ bool& bLastKeepNode);
+
+ bool ProcessKeepNodesForBreakBefore(CXFA_Node*& pCurActionNode,
+ XFA_ItemLayoutProcessorStages& nCurStage,
+ CXFA_Node* pContainerNode);
+
+ CXFA_Node* GetSubformSetParent(CXFA_Node* pSubformSet);
+
+ bool m_bKeepBreakFinish;
+ bool m_bIsProcessKeep;
+ CXFA_Node* m_pKeepHeadNode;
+ CXFA_Node* m_pKeepTailNode;
+ CXFA_ContentLayoutItem* m_pOldLayoutItem;
+ CXFA_ItemLayoutProcessor* m_pCurChildPreprocessor;
+ XFA_ItemLayoutProcessorStages m_nCurChildNodeStage;
+ std::map<CXFA_Node*, int32_t> m_PendingNodesCount;
+ float m_fWidthLimite;
+ bool m_bHasAvailHeight;
+};
+
+#endif // XFA_FXFA_PARSER_CXFA_ITEMLAYOUTPROCESSOR_H_
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_layoutcontext.h b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_layoutcontext.h
new file mode 100644
index 00000000000..a133ee19d99
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_layoutcontext.h
@@ -0,0 +1,32 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef XFA_FXFA_PARSER_CXFA_LAYOUTCONTEXT_H_
+#define XFA_FXFA_PARSER_CXFA_LAYOUTCONTEXT_H_
+
+#include <vector>
+
+class CXFA_ItemLayoutProcess;
+class CXFA_Node;
+
+class CXFA_LayoutContext {
+ public:
+ CXFA_LayoutContext()
+ : m_prgSpecifiedColumnWidths(nullptr),
+ m_fCurColumnWidth(0),
+ m_bCurColumnWidthAvaiable(false),
+ m_pOverflowProcessor(nullptr),
+ m_pOverflowNode(nullptr) {}
+ ~CXFA_LayoutContext() {}
+
+ std::vector<float>* m_prgSpecifiedColumnWidths;
+ float m_fCurColumnWidth;
+ bool m_bCurColumnWidthAvaiable;
+ CXFA_ItemLayoutProcessor* m_pOverflowProcessor;
+ CXFA_Node* m_pOverflowNode;
+};
+
+#endif // XFA_FXFA_PARSER_CXFA_LAYOUTCONTEXT_H_
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_layoutitem.cpp b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_layoutitem.cpp
index 476d6118ac3..b227be9e855 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_layoutitem.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_layoutitem.cpp
@@ -10,6 +10,7 @@
#include "xfa/fxfa/parser/cxfa_containerlayoutitem.h"
#include "xfa/fxfa/parser/cxfa_contentlayoutitem.h"
#include "xfa/fxfa/parser/cxfa_measurement.h"
+#include "xfa/fxfa/parser/cxfa_node.h"
void XFA_ReleaseLayoutItem(CXFA_LayoutItem* pLayoutItem) {
CXFA_LayoutItem* pNode = pLayoutItem->m_pFirstChild;
@@ -64,7 +65,7 @@ CXFA_ContainerLayoutItem* CXFA_LayoutItem::GetPage() const {
CFX_RectF CXFA_LayoutItem::GetRect(bool bRelative) const {
ASSERT(m_bIsContentLayoutItem);
- auto pThis = static_cast<const CXFA_ContentLayoutItem*>(this);
+ auto* pThis = static_cast<const CXFA_ContentLayoutItem*>(this);
CFX_PointF sPos = pThis->m_sPos;
CFX_SizeF sSize = pThis->m_sSize;
if (bRelative)
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp
index f38ef0ebfda..b88dca90097 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp
@@ -6,19 +6,23 @@
#include "xfa/fxfa/parser/cxfa_layoutpagemgr.h"
+#include "third_party/base/stl_util.h"
#include "xfa/fxfa/app/xfa_ffnotify.h"
#include "xfa/fxfa/parser/cxfa_containerlayoutitem.h"
#include "xfa/fxfa/parser/cxfa_contentlayoutitem.h"
#include "xfa/fxfa/parser/cxfa_document.h"
+#include "xfa/fxfa/parser/cxfa_itemlayoutprocessor.h"
#include "xfa/fxfa/parser/cxfa_layoutprocessor.h"
+#include "xfa/fxfa/parser/cxfa_localemgr.h"
#include "xfa/fxfa/parser/cxfa_measurement.h"
+#include "xfa/fxfa/parser/cxfa_node.h"
+#include "xfa/fxfa/parser/cxfa_object.h"
#include "xfa/fxfa/parser/cxfa_scriptcontext.h"
#include "xfa/fxfa/parser/cxfa_traversestrategy_contentareacontainerlayoutitem.h"
#include "xfa/fxfa/parser/cxfa_traversestrategy_layoutitem.h"
+#include "xfa/fxfa/parser/cxfa_traversestrategy_xfacontainernode.h"
+#include "xfa/fxfa/parser/cxfa_traversestrategy_xfanode.h"
#include "xfa/fxfa/parser/xfa_document_datamerger_imp.h"
-#include "xfa/fxfa/parser/xfa_layout_itemlayout.h"
-#include "xfa/fxfa/parser/xfa_localemgr.h"
-#include "xfa/fxfa/parser/xfa_object.h"
#include "xfa/fxfa/parser/xfa_resolvenode_rs.h"
#include "xfa/fxfa/parser/xfa_utils.h"
@@ -172,8 +176,8 @@ CXFA_Node* ResolveBreakTarget(CXFA_Node* pPageSetRoot,
XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties |
XFA_RESOLVENODE_Attributes | XFA_RESOLVENODE_Siblings |
XFA_RESOLVENODE_Parent);
- if (iCount > 0 && rs.nodes[0]->IsNode())
- return rs.nodes[0]->AsNode();
+ if (iCount > 0 && rs.objects.front()->IsNode())
+ return rs.objects.front()->AsNode();
}
iSplitIndex = iSplitNextIndex;
}
@@ -454,13 +458,13 @@ void CXFA_LayoutPageMgr::SubmitContentItem(
}
}
-FX_FLOAT CXFA_LayoutPageMgr::GetAvailHeight() {
+float CXFA_LayoutPageMgr::GetAvailHeight() {
CXFA_ContainerLayoutItem* pLayoutItem =
GetCurrentContainerRecord()->pCurContentArea;
if (!pLayoutItem || !pLayoutItem->m_pFormNode)
return 0.0f;
- FX_FLOAT fAvailHeight =
+ float fAvailHeight =
pLayoutItem->m_pFormNode->GetMeasure(XFA_ATTRIBUTE_H).ToUnit(XFA_UNIT_Pt);
if (fAvailHeight >= XFA_LAYOUT_FLOAT_PERCISION)
return fAvailHeight;
@@ -552,17 +556,16 @@ CXFA_ContainerRecord* CXFA_LayoutPageMgr::CreateContainerRecord(
void CXFA_LayoutPageMgr::AddPageAreaLayoutItem(CXFA_ContainerRecord* pNewRecord,
CXFA_Node* pNewPageArea) {
CXFA_ContainerLayoutItem* pNewPageAreaLayoutItem = nullptr;
- if (m_PageArray.GetSize() > m_nAvailPages) {
+ if (pdfium::IndexInBounds(m_PageArray, m_nAvailPages)) {
CXFA_ContainerLayoutItem* pContainerItem = m_PageArray[m_nAvailPages];
pContainerItem->m_pFormNode = pNewPageArea;
m_nAvailPages++;
pNewPageAreaLayoutItem = pContainerItem;
} else {
CXFA_FFNotify* pNotify = pNewPageArea->GetDocument()->GetNotify();
- CXFA_ContainerLayoutItem* pContainerItem =
- static_cast<CXFA_ContainerLayoutItem*>(
- pNotify->OnCreateLayoutItem(pNewPageArea));
- m_PageArray.Add(pContainerItem);
+ auto* pContainerItem = static_cast<CXFA_ContainerLayoutItem*>(
+ pNotify->OnCreateLayoutItem(pNewPageArea));
+ m_PageArray.push_back(pContainerItem);
m_nAvailPages++;
pNotify->OnPageEvent(pContainerItem, XFA_PAGEVIEWEVENT_PostRemoved);
pNewPageAreaLayoutItem = pContainerItem;
@@ -647,7 +650,7 @@ void CXFA_LayoutPageMgr::FinishPaginatedPageSets() {
}
}
bool bUsable = true;
- CFX_ArrayTemplate<FX_FLOAT> rgUsedHeights;
+ std::vector<float> rgUsedHeights;
for (CXFA_LayoutItem* pChildLayoutItem =
pLastPageAreaLayoutItem->m_pFirstChild;
pChildLayoutItem;
@@ -656,7 +659,7 @@ void CXFA_LayoutPageMgr::FinishPaginatedPageSets() {
XFA_Element::ContentArea) {
continue;
}
- FX_FLOAT fUsedHeight = 0;
+ float fUsedHeight = 0;
for (CXFA_LayoutItem* pContentChildLayoutItem =
pChildLayoutItem->m_pFirstChild;
pContentChildLayoutItem;
@@ -667,7 +670,7 @@ void CXFA_LayoutPageMgr::FinishPaginatedPageSets() {
fUsedHeight += pContent->m_sSize.height;
}
}
- rgUsedHeights.Add(fUsedHeight);
+ rgUsedHeights.push_back(fUsedHeight);
}
int32_t iCurContentAreaIndex = -1;
for (CXFA_Node* pContentAreaNode =
@@ -723,19 +726,19 @@ void CXFA_LayoutPageMgr::FinishPaginatedPageSets() {
}
int32_t CXFA_LayoutPageMgr::GetPageCount() const {
- return m_PageArray.GetSize();
+ return pdfium::CollectionSize<int32_t>(m_PageArray);
}
CXFA_ContainerLayoutItem* CXFA_LayoutPageMgr::GetPage(int32_t index) const {
- if (index < 0 || index >= m_PageArray.GetSize())
+ if (!pdfium::IndexInBounds(m_PageArray, index))
return nullptr;
return m_PageArray[index];
}
int32_t CXFA_LayoutPageMgr::GetPageIndex(
const CXFA_ContainerLayoutItem* pPage) const {
- // FIXME: Find() method should take const.
- return m_PageArray.Find(const_cast<CXFA_ContainerLayoutItem*>(pPage));
+ auto it = std::find(m_PageArray.begin(), m_PageArray.end(), pPage);
+ return it != m_PageArray.end() ? it - m_PageArray.begin() : -1;
}
bool CXFA_LayoutPageMgr::RunBreak(XFA_Element eBreakType,
@@ -1511,7 +1514,7 @@ void CXFA_LayoutPageMgr::ProcessLastPageSet() {
}
}
-bool CXFA_LayoutPageMgr::GetNextAvailContentHeight(FX_FLOAT fChildHeight) {
+bool CXFA_LayoutPageMgr::GetNextAvailContentHeight(float fChildHeight) {
CXFA_Node* pCurContentNode =
GetCurrentContainerRecord()->pCurContentArea->m_pFormNode;
if (!pCurContentNode)
@@ -1520,7 +1523,7 @@ bool CXFA_LayoutPageMgr::GetNextAvailContentHeight(FX_FLOAT fChildHeight) {
pCurContentNode =
pCurContentNode->GetNextSameClassSibling(XFA_Element::ContentArea);
if (pCurContentNode) {
- FX_FLOAT fNextContentHeight =
+ float fNextContentHeight =
pCurContentNode->GetMeasure(XFA_ATTRIBUTE_H).ToUnit(XFA_UNIT_Pt);
return fNextContentHeight > fChildHeight;
}
@@ -1549,7 +1552,7 @@ bool CXFA_LayoutPageMgr::GetNextAvailContentHeight(FX_FLOAT fChildHeight) {
CXFA_Node* pContentArea =
pNextPage->GetFirstChildByClass(XFA_Element::ContentArea);
if (pContentArea) {
- FX_FLOAT fNextContentHeight =
+ float fNextContentHeight =
pContentArea->GetMeasure(XFA_ATTRIBUTE_H).ToUnit(XFA_UNIT_Pt);
if (fNextContentHeight > fChildHeight)
return true;
@@ -1561,7 +1564,7 @@ bool CXFA_LayoutPageMgr::GetNextAvailContentHeight(FX_FLOAT fChildHeight) {
CXFA_Node* pContentArea =
pPageNode->GetFirstChildByClass(XFA_Element::ContentArea);
- FX_FLOAT fNextContentHeight =
+ float fNextContentHeight =
pContentArea->GetMeasure(XFA_ATTRIBUTE_H).ToUnit(XFA_UNIT_Pt);
if (fNextContentHeight < XFA_LAYOUT_FLOAT_PERCISION)
return true;
@@ -1632,9 +1635,7 @@ void CXFA_LayoutPageMgr::SaveLayoutItem(CXFA_LayoutItem* pParentLayoutItem) {
}
}
-CXFA_Node* CXFA_LayoutPageMgr::QueryOverflow(
- CXFA_Node* pFormNode,
- CXFA_LayoutContext* pLayoutContext) {
+CXFA_Node* CXFA_LayoutPageMgr::QueryOverflow(CXFA_Node* pFormNode) {
for (CXFA_Node* pCurNode = pFormNode->GetNodeItem(XFA_NODEITEM_FirstChild);
pCurNode; pCurNode = pCurNode->GetNodeItem((XFA_NODEITEM_NextSibling))) {
if (pCurNode->GetElementType() == XFA_Element::Break) {
@@ -1661,22 +1662,19 @@ void CXFA_LayoutPageMgr::MergePageSetContents() {
CXFA_FFNotify* pNotify = pDocument->GetNotify();
CXFA_LayoutProcessor* pDocLayout = pDocument->GetDocLayout();
CXFA_ContainerLayoutItem* pRootLayout = GetRootLayoutItem();
- {
- for (int32_t iIndex = 0; iIndex < pDocument->m_pPendingPageSet.GetSize();
- iIndex++) {
- CXFA_NodeIteratorTemplate<CXFA_Node, CXFA_TraverseStrategy_XFANode>
- sIterator(pDocument->m_pPendingPageSet.GetAt(iIndex));
- for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode;
- pNode = sIterator.MoveToNext()) {
- if (pNode->IsContainerNode()) {
- CXFA_Node* pBindNode = pNode->GetBindData();
- if (pBindNode) {
- pBindNode->RemoveBindItem(pNode);
- pNode->SetObject(XFA_ATTRIBUTE_BindingNode, nullptr);
- }
+ for (CXFA_Node* pPageNode : pDocument->m_pPendingPageSet) {
+ CXFA_NodeIteratorTemplate<CXFA_Node, CXFA_TraverseStrategy_XFANode>
+ sIterator(pPageNode);
+ for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode;
+ pNode = sIterator.MoveToNext()) {
+ if (pNode->IsContainerNode()) {
+ CXFA_Node* pBindNode = pNode->GetBindData();
+ if (pBindNode) {
+ pBindNode->RemoveBindItem(pNode);
+ pNode->SetObject(XFA_ATTRIBUTE_BindingNode, nullptr);
}
- pNode->SetFlag(XFA_NodeFlag_UnusedNode, true);
}
+ pNode->SetFlag(XFA_NodeFlag_UnusedNode, true);
}
}
@@ -1691,8 +1689,9 @@ void CXFA_LayoutPageMgr::MergePageSetContents() {
CXFA_ContainerLayoutItem* pRootPageSetContainerItem = iterator.GetCurrent();
ASSERT(pRootPageSetContainerItem->m_pFormNode->GetElementType() ==
XFA_Element::PageSet);
- if (iIndex < pDocument->m_pPendingPageSet.GetSize()) {
- pPendingPageSet = pDocument->m_pPendingPageSet.GetAt(iIndex);
+ if (iIndex <
+ pdfium::CollectionSize<int32_t>(pDocument->m_pPendingPageSet)) {
+ pPendingPageSet = pDocument->m_pPendingPageSet[iIndex];
iIndex++;
}
if (!pPendingPageSet) {
@@ -1924,10 +1923,10 @@ void CXFA_LayoutPageMgr::SyncLayoutData() {
}
}
- int32_t nPage = m_PageArray.GetSize();
+ int32_t nPage = pdfium::CollectionSize<int32_t>(m_PageArray);
for (int32_t i = nPage - 1; i >= m_nAvailPages; i--) {
CXFA_ContainerLayoutItem* pPage = m_PageArray[i];
- m_PageArray.RemoveAt(i);
+ m_PageArray.erase(m_PageArray.begin() + i);
pNotify->OnPageEvent(pPage, XFA_PAGEVIEWEVENT_PostRemoved);
delete pPage;
}
@@ -1958,20 +1957,20 @@ void CXFA_LayoutPageMgr::PrepareLayout() {
if (pRootLayoutItem &&
pRootLayoutItem->m_pFormNode->GetPacketID() == XFA_XDPPACKET_Form) {
CXFA_Node* pPageSetFormNode = pRootLayoutItem->m_pFormNode;
- pRootLayoutItem->m_pFormNode->GetDocument()->m_pPendingPageSet.RemoveAll();
+ pRootLayoutItem->m_pFormNode->GetDocument()->m_pPendingPageSet.clear();
if (pPageSetFormNode->HasRemovedChildren()) {
XFA_ReleaseLayoutItem(pRootLayoutItem);
m_pPageSetLayoutItemRoot = nullptr;
pRootLayoutItem = nullptr;
pPageSetFormNode = nullptr;
- m_PageArray.RemoveAll();
+ m_PageArray.clear();
}
while (pPageSetFormNode) {
CXFA_Node* pNextPageSet =
pPageSetFormNode->GetNextSameClassSibling(XFA_Element::PageSet);
pPageSetFormNode->GetNodeItem(XFA_NODEITEM_Parent)
->RemoveChild(pPageSetFormNode, false);
- pRootLayoutItem->m_pFormNode->GetDocument()->m_pPendingPageSet.Add(
+ pRootLayoutItem->m_pFormNode->GetDocument()->m_pPendingPageSet.push_back(
pPageSetFormNode);
pPageSetFormNode = pNextPageSet;
}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_layoutpagemgr.h b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_layoutpagemgr.h
index 3c8e7f9d1e0..085ea896710 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_layoutpagemgr.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_layoutpagemgr.h
@@ -10,11 +10,13 @@
#include <iterator>
#include <list>
#include <map>
+#include <vector>
-#include "xfa/fxfa/parser/xfa_layout_itemlayout.h"
+#include "xfa/fxfa/parser/cxfa_itemlayoutprocessor.h"
class CXFA_ContainerRecord;
class CXFA_LayoutItem;
+class CXFA_Node;
class CXFA_LayoutPageMgr {
public:
@@ -23,8 +25,8 @@ class CXFA_LayoutPageMgr {
bool InitLayoutPage(CXFA_Node* pFormNode);
bool PrepareFirstPage(CXFA_Node* pRootSubform);
- FX_FLOAT GetAvailHeight();
- bool GetNextAvailContentHeight(FX_FLOAT fChildHeight);
+ float GetAvailHeight();
+ bool GetNextAvailContentHeight(float fChildHeight);
void SubmitContentItem(CXFA_ContentLayoutItem* pContentLayoutItem,
XFA_ItemLayoutProcessorResult eStatus);
void FinishPaginatedPageSets();
@@ -45,13 +47,12 @@ class CXFA_LayoutPageMgr {
CXFA_Node*& pTrailerNode,
bool bDataMerge = false,
bool bCreatePage = true);
- CXFA_Node* QueryOverflow(CXFA_Node* pFormNode,
- CXFA_LayoutContext* pLayoutContext = nullptr);
+ CXFA_Node* QueryOverflow(CXFA_Node* pFormNode);
bool ProcessBookendLeaderOrTrailer(CXFA_Node* pBookendNode,
bool bLeader,
CXFA_Node*& pBookendAppendNode);
- protected:
+ private:
bool AppendNewPage(bool bFirstTemPage = false);
void ReorderPendingLayoutRecordToTail(CXFA_ContainerRecord* pNewRecord,
CXFA_ContainerRecord* pPrevRecord);
@@ -140,7 +141,7 @@ class CXFA_LayoutPageMgr {
XFA_ATTRIBUTEENUM m_ePageSetMode;
bool m_bCreateOverFlowPage;
std::map<CXFA_Node*, int32_t> m_pPageSetMap;
- CFX_ArrayTemplate<CXFA_ContainerLayoutItem*> m_PageArray;
+ std::vector<CXFA_ContainerLayoutItem*> m_PageArray;
};
#endif // XFA_FXFA_PARSER_CXFA_LAYOUTPAGEMGR_H_
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_layoutprocessor.cpp b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_layoutprocessor.cpp
index e179d389854..2e919dbc843 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_layoutprocessor.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_layoutprocessor.cpp
@@ -7,20 +7,19 @@
#include "xfa/fxfa/parser/cxfa_layoutprocessor.h"
#include "third_party/base/ptr_util.h"
+#include "third_party/base/stl_util.h"
#include "xfa/fxfa/parser/cxfa_contentlayoutitem.h"
#include "xfa/fxfa/parser/cxfa_document.h"
+#include "xfa/fxfa/parser/cxfa_itemlayoutprocessor.h"
#include "xfa/fxfa/parser/cxfa_layoutpagemgr.h"
+#include "xfa/fxfa/parser/cxfa_localemgr.h"
#include "xfa/fxfa/parser/cxfa_measurement.h"
+#include "xfa/fxfa/parser/cxfa_node.h"
#include "xfa/fxfa/parser/xfa_document_datamerger_imp.h"
-#include "xfa/fxfa/parser/xfa_layout_itemlayout.h"
-#include "xfa/fxfa/parser/xfa_localemgr.h"
-#include "xfa/fxfa/parser/xfa_object.h"
#include "xfa/fxfa/parser/xfa_utils.h"
CXFA_LayoutProcessor::CXFA_LayoutProcessor(CXFA_Document* pDocument)
- : m_pDocument(pDocument),
- m_nProgressCounter(0),
- m_bNeeLayout(true) {}
+ : m_pDocument(pDocument), m_nProgressCounter(0), m_bNeedLayout(true) {}
CXFA_LayoutProcessor::~CXFA_LayoutProcessor() {}
@@ -64,10 +63,10 @@ int32_t CXFA_LayoutProcessor::DoLayout(IFX_Pause* pPause) {
XFA_ItemLayoutProcessorResult eStatus;
CXFA_Node* pFormNode = m_pRootItemLayoutProcessor->GetFormNode();
- FX_FLOAT fPosX = pFormNode->GetMeasure(XFA_ATTRIBUTE_X).ToUnit(XFA_UNIT_Pt);
- FX_FLOAT fPosY = pFormNode->GetMeasure(XFA_ATTRIBUTE_Y).ToUnit(XFA_UNIT_Pt);
+ float fPosX = pFormNode->GetMeasure(XFA_ATTRIBUTE_X).ToUnit(XFA_UNIT_Pt);
+ float fPosY = pFormNode->GetMeasure(XFA_ATTRIBUTE_Y).ToUnit(XFA_UNIT_Pt);
do {
- FX_FLOAT fAvailHeight = m_pLayoutPageMgr->GetAvailHeight();
+ float fAvailHeight = m_pLayoutPageMgr->GetAvailHeight();
eStatus = m_pRootItemLayoutProcessor->DoLayout(true, fAvailHeight,
fAvailHeight, nullptr);
if (eStatus != XFA_ItemLayoutProcessorResult::Done)
@@ -85,8 +84,8 @@ int32_t CXFA_LayoutProcessor::DoLayout(IFX_Pause* pPause) {
if (eStatus == XFA_ItemLayoutProcessorResult::Done) {
m_pLayoutPageMgr->FinishPaginatedPageSets();
m_pLayoutPageMgr->SyncLayoutData();
- m_bNeeLayout = false;
- m_rgChangedContainers.RemoveAll();
+ m_bNeedLayout = false;
+ m_rgChangedContainers.clear();
}
return 100 * (eStatus == XFA_ItemLayoutProcessorResult::Done
? m_nProgressCounter
@@ -95,13 +94,11 @@ int32_t CXFA_LayoutProcessor::DoLayout(IFX_Pause* pPause) {
}
bool CXFA_LayoutProcessor::IncrementLayout() {
- if (m_bNeeLayout) {
+ if (m_bNeedLayout) {
StartLayout(true);
return DoLayout(nullptr) == 100;
}
-
- for (int32_t i = 0, c = m_rgChangedContainers.GetSize(); i < c; i++) {
- CXFA_Node* pNode = m_rgChangedContainers[i];
+ for (CXFA_Node* pNode : m_rgChangedContainers) {
CXFA_Node* pParentNode =
pNode->GetNodeItem(XFA_NODEITEM_Parent, XFA_ObjectType::ContainerNode);
if (!pParentNode)
@@ -111,7 +108,7 @@ bool CXFA_LayoutProcessor::IncrementLayout() {
return false;
}
}
- m_rgChangedContainers.RemoveAll();
+ m_rgChangedContainers.clear();
return true;
}
@@ -129,8 +126,8 @@ CXFA_LayoutItem* CXFA_LayoutProcessor::GetLayoutItem(CXFA_Node* pFormItem) {
}
void CXFA_LayoutProcessor::AddChangedContainer(CXFA_Node* pContainer) {
- if (m_rgChangedContainers.Find(pContainer) < 0)
- m_rgChangedContainers.Add(pContainer);
+ if (!pdfium::ContainsValue(m_rgChangedContainers, pContainer))
+ m_rgChangedContainers.push_back(pContainer);
}
CXFA_ContainerLayoutItem* CXFA_LayoutProcessor::GetRootLayoutItem() const {
@@ -138,5 +135,5 @@ CXFA_ContainerLayoutItem* CXFA_LayoutProcessor::GetRootLayoutItem() const {
}
bool CXFA_LayoutProcessor::IsNeedLayout() {
- return m_bNeeLayout || m_rgChangedContainers.GetSize() > 0;
+ return m_bNeedLayout || !m_rgChangedContainers.empty();
}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_layoutprocessor.h b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_layoutprocessor.h
index 5861bf7048e..75bf2597c55 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_layoutprocessor.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_layoutprocessor.h
@@ -8,9 +8,9 @@
#define XFA_FXFA_PARSER_CXFA_LAYOUTPROCESSOR_H_
#include <memory>
+#include <vector>
#include "core/fxcrt/fx_system.h"
-#include "xfa/fxfa/parser/xfa_object.h"
class CXFA_ContainerLayoutItem;
class CXFA_Document;
@@ -33,7 +33,7 @@ class CXFA_LayoutProcessor {
CXFA_ContainerLayoutItem* GetPage(int32_t index) const;
CXFA_LayoutItem* GetLayoutItem(CXFA_Node* pFormItem);
void AddChangedContainer(CXFA_Node* pContainer);
- void SetForceReLayout(bool bForceRestart) { m_bNeeLayout = bForceRestart; }
+ void SetForceReLayout(bool bForceRestart) { m_bNeedLayout = bForceRestart; }
CXFA_ContainerLayoutItem* GetRootLayoutItem() const;
CXFA_ItemLayoutProcessor* GetRootRootItemLayoutProcessor() const {
return m_pRootItemLayoutProcessor.get();
@@ -48,9 +48,9 @@ class CXFA_LayoutProcessor {
CXFA_Document* const m_pDocument;
std::unique_ptr<CXFA_ItemLayoutProcessor> m_pRootItemLayoutProcessor;
std::unique_ptr<CXFA_LayoutPageMgr> m_pLayoutPageMgr;
- CXFA_NodeArray m_rgChangedContainers;
+ std::vector<CXFA_Node*> m_rgChangedContainers;
uint32_t m_nProgressCounter;
- bool m_bNeeLayout;
+ bool m_bNeedLayout;
};
#endif // XFA_FXFA_PARSER_CXFA_LAYOUTPROCESSOR_H_
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_line.cpp b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_line.cpp
index 38de0d8ca88..8be1d25a46d 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_line.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_line.cpp
@@ -6,7 +6,7 @@
#include "xfa/fxfa/parser/cxfa_line.h"
-#include "xfa/fxfa/parser/xfa_object.h"
+#include "xfa/fxfa/parser/cxfa_node.h"
int32_t CXFA_Line::GetHand() {
return m_pNode->GetEnum(XFA_ATTRIBUTE_Hand);
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_localemgr.cpp b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_localemgr.cpp
new file mode 100644
index 00000000000..b0828576339
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_localemgr.cpp
@@ -0,0 +1,1248 @@
+// 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
+
+#include "xfa/fxfa/parser/cxfa_localemgr.h"
+
+#include <time.h>
+
+#include <memory>
+#include <utility>
+
+#include "core/fxcodec/fx_codec.h"
+#include "core/fxcrt/xml/cxml_element.h"
+#include "core/fxge/cfx_gemodule.h"
+#include "xfa/fxfa/parser/cxfa_node.h"
+#include "xfa/fxfa/parser/cxfa_nodelocale.h"
+#include "xfa/fxfa/parser/cxfa_xmllocale.h"
+#include "xfa/fxfa/parser/xfa_utils.h"
+
+const uint8_t g_enUS_Locale[] = {
+ 0x78, 0x9C, 0x95, 0x56, 0xD1, 0x6E, 0x9B, 0x30, 0x14, 0x7D, 0x9F, 0xB4,
+ 0x7F, 0x40, 0xD6, 0x2A, 0xB5, 0x52, 0x56, 0x6F, 0x8F, 0xA9, 0x88, 0xA5,
+ 0x6C, 0x24, 0x9B, 0x3A, 0xD1, 0x55, 0x22, 0x55, 0xB5, 0xBE, 0x4C, 0x0E,
+ 0xDC, 0x05, 0x34, 0xB0, 0x23, 0x83, 0x37, 0x05, 0xED, 0xE3, 0x67, 0x07,
+ 0xC3, 0xC0, 0xF6, 0x24, 0xC2, 0x4B, 0x7C, 0xCF, 0x3D, 0xE7, 0xE6, 0xDE,
+ 0x63, 0x30, 0x84, 0x25, 0x4F, 0x69, 0x09, 0x01, 0xA3, 0x15, 0xAC, 0x10,
+ 0xB0, 0xEF, 0x4F, 0x09, 0x0A, 0x32, 0xA8, 0xD3, 0x15, 0xDA, 0xB0, 0x43,
+ 0x59, 0xD4, 0xF9, 0xF5, 0xBA, 0x02, 0x51, 0xA4, 0xF4, 0x06, 0x91, 0x50,
+ 0x53, 0x59, 0x46, 0x45, 0x72, 0xAA, 0xF6, 0xBC, 0xAC, 0x8D, 0xEA, 0x20,
+ 0xE0, 0xC0, 0x45, 0x41, 0x99, 0x62, 0x54, 0x9C, 0x35, 0xF9, 0x83, 0x82,
+ 0x6B, 0xB3, 0x26, 0xF7, 0x94, 0x49, 0x2A, 0x4E, 0x21, 0xEE, 0xC2, 0xD7,
+ 0xAF, 0x0C, 0xBE, 0x85, 0xBD, 0xF0, 0x26, 0x62, 0x2A, 0xD2, 0xDC, 0x41,
+ 0xD7, 0x47, 0x51, 0x94, 0x1E, 0xAE, 0xAB, 0xBF, 0x97, 0x0C, 0x3C, 0x60,
+ 0xE9, 0x32, 0xD7, 0xF2, 0x20, 0xEB, 0xC6, 0x81, 0x13, 0x38, 0x36, 0x50,
+ 0xED, 0x41, 0x38, 0x99, 0xAF, 0x69, 0xC3, 0x7D, 0xF8, 0x03, 0xFF, 0xE5,
+ 0x17, 0x44, 0x90, 0xDA, 0x09, 0x3C, 0xB2, 0xA8, 0xE7, 0x9D, 0xA3, 0x80,
+ 0xEE, 0xF7, 0x62, 0x85, 0xDE, 0xA3, 0x91, 0x73, 0x3E, 0xD7, 0x7C, 0x86,
+ 0xF9, 0xEC, 0x9A, 0x6B, 0x96, 0xCF, 0x2B, 0x9F, 0x55, 0x3E, 0x9F, 0x7C,
+ 0x0E, 0xF9, 0xDC, 0xF1, 0x19, 0xF3, 0x7F, 0x4F, 0x32, 0x7A, 0x32, 0xB7,
+ 0x90, 0x5A, 0x91, 0x44, 0xAA, 0x5B, 0x4E, 0x75, 0xAE, 0xD7, 0x5D, 0x92,
+ 0xC4, 0xDC, 0x81, 0x76, 0x12, 0x6A, 0x1B, 0x7B, 0x86, 0x8C, 0xB9, 0xE8,
+ 0x2E, 0x97, 0xC2, 0x01, 0xB7, 0xA2, 0xB0, 0xA1, 0x84, 0x36, 0x52, 0x8C,
+ 0x41, 0x3C, 0xF4, 0x35, 0xEA, 0x71, 0xB4, 0x6B, 0xA6, 0x59, 0xBB, 0x53,
+ 0xBB, 0x4D, 0xBB, 0x45, 0xBB, 0x39, 0xBB, 0x2F, 0xBB, 0x29, 0x7F, 0x3F,
+ 0xFA, 0x21, 0xCD, 0x0A, 0xA8, 0xFA, 0x67, 0xCF, 0x84, 0x64, 0x1D, 0x2B,
+ 0x77, 0xFB, 0x60, 0xC4, 0x23, 0x8F, 0x56, 0x02, 0x4F, 0x2B, 0x28, 0x04,
+ 0x04, 0x35, 0xD5, 0xD4, 0x8A, 0x7C, 0xF8, 0x18, 0x62, 0xFD, 0xDB, 0x25,
+ 0xC8, 0x3A, 0x1A, 0x42, 0x3C, 0x10, 0x75, 0x60, 0x9D, 0x11, 0x5D, 0xE3,
+ 0x0D, 0x3C, 0xD2, 0xA6, 0x01, 0xC1, 0xCE, 0x7B, 0x3A, 0x44, 0xE6, 0x00,
+ 0xF9, 0x21, 0xCB, 0x12, 0x91, 0x8D, 0xBA, 0x16, 0x41, 0xAC, 0xAE, 0x20,
+ 0x5A, 0x04, 0xDF, 0xD4, 0xA5, 0x27, 0x1C, 0xB8, 0x56, 0x21, 0x23, 0x2D,
+ 0x39, 0x3B, 0x20, 0x72, 0xA1, 0xA8, 0x82, 0xEC, 0xAC, 0xB9, 0x40, 0x52,
+ 0xE7, 0x5C, 0x34, 0x4A, 0x84, 0x23, 0xEC, 0xE1, 0xE3, 0xC9, 0x84, 0x0A,
+ 0x68, 0x8A, 0x6A, 0x34, 0xF1, 0x28, 0x9A, 0x4C, 0x9C, 0xDF, 0xC5, 0xF1,
+ 0x5D, 0x92, 0x04, 0xEB, 0xE0, 0x25, 0xC4, 0x23, 0x92, 0x55, 0x61, 0x32,
+ 0xEA, 0x65, 0x9A, 0xF3, 0xA4, 0x83, 0x64, 0x86, 0xC0, 0xCC, 0xA9, 0x25,
+ 0x1E, 0x3E, 0x9E, 0xCC, 0x65, 0x8C, 0xDA, 0x29, 0xAC, 0xDF, 0xEC, 0x4F,
+ 0xA7, 0x38, 0xFB, 0xF9, 0xB9, 0xAA, 0x93, 0x4D, 0xB4, 0xFD, 0xFD, 0x4C,
+ 0xF3, 0x2F, 0xED, 0x4B, 0x67, 0xCE, 0x98, 0xA4, 0x74, 0x4C, 0xEA, 0x53,
+ 0xF1, 0x9F, 0x43, 0x93, 0xD8, 0xB4, 0xA2, 0x30, 0xFD, 0xE2, 0x41, 0xA4,
+ 0x5D, 0xB4, 0xED, 0xF2, 0xB6, 0x6D, 0xDB, 0x10, 0x4F, 0x78, 0x4E, 0x21,
+ 0x23, 0x4C, 0xA5, 0x10, 0xC0, 0xD2, 0x13, 0x22, 0x6F, 0x3A, 0xE9, 0x72,
+ 0xF9, 0xE7, 0x7A, 0x58, 0xDE, 0xCC, 0xAC, 0x72, 0x04, 0x91, 0x02, 0x6B,
+ 0xCC, 0xDF, 0x5F, 0x79, 0x54, 0xD8, 0x9A, 0x62, 0x28, 0xD4, 0x0F, 0x3A,
+ 0x09, 0x4D, 0xD9, 0x0C, 0xD2, 0xA2, 0xA2, 0x6A, 0xF3, 0x6F, 0x7B, 0x7D,
+ 0x97, 0xB6, 0xD5, 0xC3, 0xBB, 0x95, 0xCB, 0x63, 0xA1, 0x37, 0x7E, 0x31,
+ 0x8B, 0x3F, 0x74, 0x7D, 0x35, 0x8B, 0x5E, 0x15, 0x4C, 0xD6, 0x88, 0xBC,
+ 0x9D, 0x45, 0x6E, 0x41, 0x70, 0x44, 0xDE, 0xB9, 0x5C, 0x3C, 0x1D, 0x5B,
+ 0x21, 0xFD, 0x16, 0x0C, 0x4E, 0x4C, 0x81, 0xFE, 0x66, 0x3B, 0x07, 0x6A,
+ 0x9B, 0xD4, 0xA9, 0x31, 0xC9, 0xBB, 0x25, 0x8C, 0xA2, 0xA8, 0xB9, 0x5E,
+ 0x20, 0xF2, 0x94, 0x44, 0xB3, 0x45, 0x63, 0xCB, 0x5D, 0x09, 0xB6, 0x7B,
+ 0xD5, 0x58, 0xF7, 0x55, 0xA4, 0x96, 0x7F, 0x01, 0x75, 0x37, 0x1B, 0x8B,
+};
+const uint8_t g_enGB_Locale[] = {
+ 0x78, 0x9C, 0x95, 0x56, 0xD1, 0x6E, 0xD3, 0x30, 0x14, 0x7D, 0x47, 0xE2,
+ 0x1F, 0xA2, 0x88, 0x49, 0x20, 0x6D, 0x33, 0x3C, 0x6E, 0xEA, 0x2C, 0x75,
+ 0xEB, 0xD6, 0x32, 0xC8, 0xA8, 0x48, 0xC5, 0xC4, 0x5E, 0x90, 0x9B, 0x78,
+ 0x8D, 0x59, 0x62, 0x57, 0x4E, 0xCC, 0x94, 0xFC, 0x02, 0x9F, 0xC0, 0x23,
+ 0xCF, 0x08, 0xF1, 0x01, 0xBC, 0xF0, 0x2F, 0x48, 0xFB, 0x0C, 0x6E, 0x1A,
+ 0x27, 0x4B, 0x1C, 0xAF, 0x64, 0x79, 0x89, 0xEF, 0xB9, 0xE7, 0xDC, 0xDE,
+ 0x7B, 0x9C, 0xB8, 0x19, 0xC5, 0x22, 0x20, 0x31, 0x75, 0x38, 0x49, 0xE8,
+ 0x91, 0x4B, 0xF9, 0xA7, 0xE9, 0xB1, 0xEB, 0x84, 0x34, 0x0D, 0x8E, 0xDC,
+ 0xBB, 0xAF, 0xBF, 0xEE, 0x7E, 0xFE, 0x78, 0x0E, 0xB7, 0xBF, 0xDF, 0x7E,
+ 0xBF, 0x70, 0xF1, 0xA8, 0x24, 0xF2, 0x90, 0x48, 0x3F, 0x4F, 0x96, 0x22,
+ 0x4E, 0xB5, 0x66, 0x25, 0xE9, 0x4A, 0x48, 0x46, 0x38, 0x30, 0x12, 0xC1,
+ 0xB3, 0xE8, 0x02, 0xE0, 0x54, 0xAF, 0xF1, 0x39, 0xE1, 0x8A, 0xC8, 0x7C,
+ 0x84, 0xAA, 0xF0, 0xE9, 0x13, 0x8D, 0x9F, 0xD1, 0xA5, 0xB4, 0x26, 0x3C,
+ 0x22, 0x83, 0xA8, 0x87, 0x8E, 0xD7, 0x92, 0xC5, 0x16, 0x6E, 0x5F, 0x7F,
+ 0xAE, 0x38, 0xB5, 0x80, 0x71, 0x9F, 0x39, 0x56, 0x2B, 0x95, 0x66, 0x3D,
+ 0xD8, 0xA7, 0xEB, 0x8C, 0x26, 0x4B, 0x2A, 0x7B, 0x99, 0x77, 0x41, 0x26,
+ 0x6C, 0xF8, 0x85, 0xF8, 0x62, 0x17, 0x4C, 0x68, 0x60, 0x26, 0x50, 0xCB,
+ 0xA2, 0x9A, 0xB7, 0x89, 0x1C, 0xB2, 0x5C, 0xCA, 0x23, 0xF7, 0x95, 0xDB,
+ 0x72, 0xCE, 0xE6, 0x9A, 0xCD, 0x30, 0x9B, 0x5D, 0x43, 0xCD, 0xB2, 0x79,
+ 0x65, 0xB3, 0xCA, 0xE6, 0x93, 0xCD, 0x21, 0x9B, 0x3B, 0x36, 0x63, 0x1E,
+ 0xF6, 0x24, 0x24, 0xB9, 0x7E, 0x84, 0x60, 0x85, 0x7D, 0x05, 0x8F, 0x1C,
+ 0x74, 0x5E, 0xAE, 0xAB, 0x24, 0xF6, 0x44, 0x0F, 0x5A, 0x28, 0x9A, 0x9A,
+ 0xD8, 0x25, 0x0D, 0x79, 0x1F, 0x5D, 0x44, 0x4A, 0xF6, 0xC0, 0x33, 0xC9,
+ 0x4C, 0xC8, 0x27, 0x99, 0x92, 0x6D, 0x10, 0x35, 0x7D, 0xB5, 0x7A, 0x6C,
+ 0xED, 0x9A, 0x6E, 0xD6, 0xEC, 0xD4, 0x6C, 0xD3, 0x6C, 0xD1, 0x6C, 0xCE,
+ 0xEC, 0xCB, 0x6C, 0xCA, 0xDE, 0x4F, 0x42, 0x61, 0x02, 0x46, 0x93, 0xFA,
+ 0xDD, 0xD3, 0x21, 0x1E, 0x7B, 0xE0, 0x6E, 0x1D, 0xB4, 0x78, 0x78, 0x6E,
+ 0x24, 0x50, 0xB7, 0x02, 0x20, 0x54, 0x12, 0x5D, 0x0D, 0x56, 0xF8, 0xF8,
+ 0x64, 0x84, 0xCA, 0x7B, 0x95, 0xC0, 0xE3, 0x49, 0x13, 0xA2, 0x86, 0x58,
+ 0x06, 0xC6, 0x19, 0x51, 0x35, 0x9E, 0xD1, 0x39, 0xC9, 0x32, 0x2A, 0xF9,
+ 0x66, 0x4F, 0x9B, 0x48, 0x1F, 0x20, 0xD7, 0x2A, 0x8E, 0x5D, 0x7C, 0x0A,
+ 0xD7, 0xAE, 0x33, 0x71, 0x3C, 0xB8, 0x9C, 0x8F, 0x70, 0x95, 0x03, 0x36,
+ 0x54, 0xA3, 0x8E, 0x56, 0xC6, 0x82, 0xAF, 0x5C, 0xFC, 0x38, 0x4D, 0x42,
+ 0x43, 0x2D, 0x19, 0xAA, 0x48, 0x23, 0x21, 0x33, 0xD0, 0x4C, 0x90, 0xE7,
+ 0x21, 0xAB, 0x06, 0x75, 0x46, 0x04, 0x20, 0x63, 0x49, 0x6B, 0xE4, 0x56,
+ 0xD4, 0x19, 0x79, 0x36, 0x3B, 0xF4, 0xBC, 0x43, 0xDF, 0x77, 0xAE, 0x46,
+ 0xA8, 0xC5, 0x31, 0x0A, 0x74, 0x66, 0x7D, 0x94, 0x64, 0x33, 0x6A, 0xAD,
+ 0x18, 0xC0, 0xD7, 0x83, 0x6E, 0x14, 0x3D, 0x3A, 0xEA, 0xCC, 0xA4, 0x8D,
+ 0x5A, 0x00, 0x56, 0xEF, 0xF4, 0x34, 0xF7, 0xC2, 0x9B, 0x59, 0x92, 0xFA,
+ 0xA7, 0x93, 0xB3, 0xDB, 0x4B, 0x12, 0xBD, 0x29, 0xAE, 0x2A, 0x63, 0xDA,
+ 0x24, 0xD0, 0x71, 0x55, 0x1E, 0x89, 0xF7, 0xEE, 0x74, 0x62, 0xDD, 0x09,
+ 0x60, 0xF0, 0x38, 0x06, 0x2E, 0x2E, 0x76, 0x8B, 0xE2, 0x60, 0xBF, 0x28,
+ 0x8A, 0x11, 0xEA, 0xF0, 0x7A, 0x85, 0xB4, 0x30, 0x50, 0x52, 0x52, 0x1E,
+ 0xE4, 0x2E, 0x7E, 0x56, 0x49, 0x0F, 0x0E, 0x06, 0x2A, 0xD7, 0x54, 0x06,
+ 0x94, 0x67, 0xFA, 0x27, 0x77, 0x2C, 0x2A, 0x64, 0x74, 0xDE, 0x14, 0xAA,
+ 0x87, 0xEB, 0x84, 0xBA, 0x6C, 0x48, 0x03, 0x96, 0x10, 0xD8, 0xEC, 0xFD,
+ 0x5A, 0x5F, 0xA5, 0x4D, 0x75, 0xF3, 0x67, 0x2A, 0xD4, 0x9A, 0x95, 0x3B,
+ 0xBD, 0x3B, 0x88, 0xDF, 0x74, 0xBD, 0x33, 0x88, 0x9E, 0x30, 0xAE, 0x52,
+ 0x17, 0xEF, 0x0D, 0x22, 0x17, 0x54, 0x0A, 0x17, 0xBF, 0xEC, 0x73, 0x51,
+ 0x77, 0x6C, 0x40, 0x6A, 0xDB, 0x1B, 0x27, 0xBA, 0x40, 0xFD, 0x7C, 0x6D,
+ 0x02, 0x17, 0xFF, 0xF9, 0x0E, 0xE7, 0x44, 0x87, 0xD0, 0xAF, 0xA1, 0x25,
+ 0x2C, 0x15, 0xE5, 0xC2, 0xC5, 0xD3, 0xE3, 0xF9, 0x60, 0x51, 0xDB, 0xF3,
+ 0xBE, 0x04, 0x99, 0xCD, 0x96, 0xEF, 0x42, 0xBE, 0xA6, 0xD7, 0x24, 0x28,
+ 0x0F, 0xBB, 0x7A, 0xA9, 0x6B, 0x79, 0x39, 0x7C, 0xDA, 0x84, 0xCE, 0x1C,
+ 0xAC, 0x40, 0x6D, 0x66, 0x9D, 0x66, 0x9C, 0x09, 0xFE, 0x60, 0xFA, 0x44,
+ 0x28, 0xC9, 0xA8, 0x74, 0xFC, 0x2C, 0xB4, 0xE6, 0xC7, 0x21, 0x7C, 0x50,
+ 0x38, 0x73, 0xF6, 0x1F, 0xC2, 0x0C, 0x3E, 0x96, 0xE8, 0xED, 0x16, 0xC2,
+ 0x58, 0x92, 0x25, 0xBC, 0x2E, 0x0F, 0x13, 0x16, 0x11, 0x61, 0xD6, 0xF4,
+ 0x1B, 0x51, 0xA8, 0x1B, 0xE2, 0x4C, 0x45, 0x16, 0xB1, 0xA0, 0x9C, 0x63,
+ 0xEF, 0xC3, 0x6B, 0xC7, 0xDB, 0x46, 0x85, 0x91, 0x83, 0x48, 0xD4, 0xD4,
+ 0xF7, 0x5B, 0x7E, 0x14, 0x98, 0xAB, 0x72, 0x32, 0xE7, 0xED, 0x16, 0x92,
+ 0x2F, 0x06, 0x90, 0xBC, 0x5C, 0xF1, 0xD5, 0x67, 0xB1, 0xE1, 0xE9, 0xE6,
+ 0xD0, 0xFD, 0x9E, 0x95, 0x51, 0xF5, 0x19, 0x0B, 0xCB, 0x7F, 0x8E, 0x69,
+ 0xAC, 0xD0};
+const uint8_t g_zhCN_Locale[] = {
+ 0x78, 0x9C, 0xED, 0x56, 0x41, 0x4F, 0xD4, 0x40, 0x14, 0xBE, 0x9B, 0xF8,
+ 0x1F, 0x9A, 0x46, 0x52, 0x4D, 0x58, 0x46, 0x8F, 0x90, 0xD2, 0x64, 0x03,
+ 0x08, 0x06, 0xBB, 0x21, 0x96, 0x68, 0xE0, 0x62, 0xBA, 0xED, 0xB0, 0x2D,
+ 0x6C, 0x3B, 0x64, 0xB6, 0x0D, 0x6E, 0x4F, 0x18, 0x82, 0x82, 0xC2, 0x45,
+ 0x89, 0x9A, 0x80, 0xE1, 0x64, 0x3C, 0x28, 0x9E, 0x8C, 0x01, 0x22, 0xF1,
+ 0xCF, 0xB0, 0xCB, 0x91, 0xBF, 0xE0, 0x9B, 0xED, 0xB4, 0xB4, 0xDD, 0xD9,
+ 0xB5, 0x3F, 0xC0, 0x3D, 0xCD, 0xFB, 0xDE, 0xF7, 0x7D, 0xF3, 0xDE, 0xEB,
+ 0x74, 0xB6, 0x6A, 0x93, 0x58, 0x66, 0x13, 0x4B, 0xBE, 0xE9, 0xE1, 0x49,
+ 0x39, 0x72, 0x9E, 0x4F, 0xD5, 0x64, 0xC9, 0xC6, 0x2D, 0x6B, 0x52, 0xBE,
+ 0x3C, 0x3D, 0xE9, 0x7E, 0x78, 0x7D, 0xF7, 0xEA, 0xC7, 0xE6, 0xE5, 0xC5,
+ 0xFB, 0xEB, 0xDF, 0x7B, 0x10, 0x77, 0x0E, 0x2F, 0xEE, 0xC9, 0x9A, 0xCA,
+ 0x14, 0xBE, 0x6D, 0x52, 0xA3, 0xED, 0xD5, 0x49, 0xB3, 0xC5, 0xC5, 0x0D,
+ 0x8A, 0x1B, 0x84, 0xBA, 0xA6, 0x0F, 0x0C, 0x8F, 0xF8, 0x81, 0x53, 0x03,
+ 0xB8, 0xC5, 0xD7, 0xDA, 0xE5, 0xE9, 0x66, 0xF7, 0x68, 0x47, 0x45, 0x71,
+ 0x74, 0xFB, 0x56, 0x02, 0x9F, 0xEF, 0x09, 0xE1, 0xD3, 0x5D, 0x11, 0xDC,
+ 0x39, 0x3C, 0x14, 0x9B, 0x1C, 0x08, 0xD9, 0xDB, 0x27, 0x62, 0xEF, 0x2D,
+ 0x31, 0xFB, 0x9B, 0x90, 0x7D, 0xF6, 0x59, 0xC8, 0xDE, 0x7F, 0x39, 0x00,
+ 0x1E, 0xD0, 0x28, 0xCB, 0x14, 0x7B, 0x45, 0x99, 0x31, 0x25, 0xC4, 0x5E,
+ 0x24, 0x99, 0xF5, 0x3A, 0x9D, 0x94, 0x1F, 0xC8, 0xFF, 0xA7, 0x57, 0x7A,
+ 0x7A, 0xB6, 0xD9, 0xE6, 0x07, 0x0E, 0x56, 0x5A, 0xF7, 0xD3, 0x71, 0xF7,
+ 0xE8, 0xB8, 0xFB, 0xF1, 0x8B, 0x8A, 0x58, 0x18, 0xE7, 0x39, 0x0A, 0x7B,
+ 0x88, 0xD0, 0xF3, 0x3D, 0x21, 0x77, 0x57, 0x80, 0xC2, 0x24, 0x85, 0x0E,
+ 0x07, 0x22, 0xEE, 0xF6, 0x49, 0x8A, 0xA2, 0xB4, 0xC8, 0x4C, 0xC1, 0x99,
+ 0x87, 0xDD, 0x53, 0x15, 0x6A, 0x2E, 0x56, 0x5B, 0xAC, 0xB3, 0x58, 0x61,
+ 0xB1, 0xB6, 0x62, 0x55, 0x03, 0xEB, 0xF1, 0x30, 0x75, 0x6D, 0x17, 0x7B,
+ 0xC9, 0x6B, 0xCB, 0x43, 0xD8, 0xE0, 0x4D, 0x67, 0x9F, 0x0D, 0x3E, 0x01,
+ 0x32, 0x5C, 0x48, 0xBE, 0xED, 0x4B, 0xA2, 0xBC, 0x13, 0x20, 0x98, 0x9A,
+ 0xDC, 0x15, 0x56, 0x50, 0xC1, 0xF7, 0xCE, 0xF6, 0x56, 0x67, 0x77, 0x5F,
+ 0x45, 0x2C, 0x8C, 0xF3, 0x1C, 0x4D, 0x21, 0x94, 0x6A, 0x58, 0x50, 0xB8,
+ 0x71, 0xE2, 0x5E, 0x02, 0xBC, 0x60, 0x06, 0x01, 0xA6, 0x7E, 0xEF, 0x99,
+ 0xA7, 0x11, 0xBF, 0x8E, 0x56, 0xC2, 0x66, 0x53, 0xD6, 0x96, 0xE0, 0xA7,
+ 0x74, 0xCE, 0x7E, 0x2A, 0xBA, 0x02, 0xA7, 0x47, 0x99, 0x56, 0x60, 0xBC,
+ 0xCA, 0x0C, 0xFC, 0x58, 0xEF, 0xA9, 0xA4, 0xE0, 0xC7, 0x1D, 0x9A, 0xC4,
+ 0x6F, 0x0C, 0x70, 0x28, 0xA1, 0xF6, 0xB0, 0x1D, 0x8B, 0x2B, 0x7A, 0x65,
+ 0xBA, 0x04, 0xBF, 0xE5, 0x10, 0x1A, 0x30, 0x85, 0x90, 0x8F, 0x72, 0xED,
+ 0x02, 0x10, 0xB8, 0x5E, 0xA6, 0xFD, 0x4C, 0x94, 0x6B, 0xBF, 0xEA, 0x38,
+ 0x50, 0xEF, 0x2F, 0x45, 0xD7, 0x95, 0xCE, 0xCE, 0x2B, 0xC5, 0x30, 0x94,
+ 0xAB, 0xAF, 0xEF, 0x14, 0x69, 0x59, 0x45, 0x19, 0x45, 0xC1, 0x2E, 0xD7,
+ 0xBD, 0xD8, 0xA0, 0x84, 0xBC, 0xD7, 0x3E, 0xA8, 0x27, 0x74, 0x7D, 0xC2,
+ 0x30, 0x4A, 0x08, 0x78, 0xFF, 0x55, 0xA6, 0xE8, 0xA3, 0xA3, 0x5C, 0xBB,
+ 0x7C, 0x7E, 0x8B, 0x80, 0x25, 0x07, 0x62, 0xD6, 0xF4, 0x57, 0xD7, 0xE6,
+ 0xBC, 0x96, 0x31, 0x33, 0xFD, 0x70, 0xE3, 0xD9, 0x0B, 0x67, 0x3E, 0x5A,
+ 0x8E, 0x67, 0x96, 0x25, 0x81, 0xCE, 0x0F, 0xBD, 0x3A, 0xA6, 0x37, 0x83,
+ 0xCB, 0xC5, 0xBC, 0x12, 0xC0, 0xE0, 0x00, 0x5B, 0xB2, 0x16, 0x8D, 0x46,
+ 0xD1, 0xF8, 0x58, 0x14, 0x45, 0x2A, 0xCA, 0xF1, 0xFA, 0x8C, 0xB8, 0xD0,
+ 0x0A, 0x29, 0xC5, 0xBE, 0xD5, 0x96, 0xB5, 0x3B, 0xB1, 0x74, 0x7C, 0xBC,
+ 0xA4, 0x72, 0x1D, 0x53, 0x0B, 0xFB, 0x01, 0xDF, 0x72, 0x44, 0xA0, 0x42,
+ 0x85, 0xCA, 0x53, 0xA3, 0xA4, 0xB9, 0x5C, 0xC8, 0x6D, 0x6D, 0x6C, 0xB9,
+ 0x9E, 0x09, 0xE7, 0x60, 0x2C, 0xD1, 0xC7, 0xE9, 0xA2, 0x3A, 0xFD, 0x07,
+ 0x27, 0xE1, 0xBA, 0xCB, 0x1E, 0xFB, 0x68, 0x29, 0x7E, 0x5A, 0xF5, 0x48,
+ 0x29, 0xBA, 0xE7, 0xFA, 0x61, 0x4B, 0xD6, 0x2A, 0xA5, 0xC8, 0x11, 0xA6,
+ 0x44, 0xD6, 0xEE, 0xF7, 0x73, 0x51, 0xBE, 0x6D, 0x40, 0x92, 0xB1, 0xA7,
+ 0x93, 0xC8, 0x03, 0xC9, 0xF9, 0xEA, 0x05, 0xB2, 0x76, 0xFD, 0x07, 0xEE,
+ 0xD7, 0x3C, 0xA3, 0xDF, 0x84, 0x6B, 0xDC, 0x16, 0x61, 0x0B, 0x59, 0x9B,
+ 0xAA, 0x2D, 0x95, 0x16, 0x65, 0x87, 0xDE, 0x2F, 0x41, 0xC5, 0x6A, 0xD9,
+ 0xCB, 0xD0, 0x5E, 0xC7, 0x2B, 0xA6, 0xC5, 0xEE, 0xC7, 0x64, 0xC9, 0xBD,
+ 0xAA, 0x36, 0xA9, 0x63, 0xC9, 0x80, 0x57, 0x51, 0x32, 0x02, 0x5B, 0x7A,
+ 0x2C, 0xA3, 0x2C, 0x9F, 0x93, 0xF4, 0x36, 0x7C, 0x75, 0xD9, 0xD2, 0x02,
+ 0x0C, 0x4C, 0x98, 0x76, 0x7D, 0x97, 0xF8, 0x03, 0xD3, 0x53, 0x24, 0xA4,
+ 0x2E, 0xA6, 0xCC, 0x5F, 0x98, 0x8F, 0x4B, 0x58, 0x70, 0xFF, 0x41, 0x98,
+ 0xC3, 0x75, 0x8A, 0x37, 0x86, 0x10, 0xAA, 0xD4, 0xAC, 0xC3, 0x4B, 0x35,
+ 0x98, 0xB0, 0xE8, 0x98, 0xAE, 0x30, 0x3D, 0x4F, 0xA2, 0x70, 0xCD, 0x94,
+ 0x66, 0x49, 0xE0, 0xB8, 0x16, 0xEB, 0xA3, 0xF2, 0xF4, 0x91, 0xA4, 0x0F,
+ 0xA3, 0x42, 0xCB, 0x96, 0x43, 0x12, 0xEA, 0x93, 0x21, 0x9B, 0x02, 0x73,
+ 0xD8, 0x68, 0x39, 0xA9, 0x1D, 0xFA, 0x8D, 0x55, 0xD2, 0xE3, 0xF1, 0x7D,
+ 0xD1, 0xCD, 0x33, 0x63, 0x51, 0xFC, 0x15, 0x0D, 0xCB, 0xBF, 0xC0, 0xE4,
+ 0x3D, 0x40};
+const uint8_t g_zhTW_Locale[] = {
+ 0x78, 0x9C, 0xED, 0x57, 0xCD, 0x4F, 0xD4, 0x40, 0x14, 0x3F, 0x63, 0xE2,
+ 0xFF, 0x30, 0x69, 0x20, 0xD5, 0x04, 0xA8, 0x1E, 0x21, 0xA5, 0xC9, 0xC6,
+ 0x45, 0x30, 0x58, 0x42, 0xEC, 0x46, 0x22, 0x17, 0x33, 0xDB, 0x0E, 0xDB,
+ 0xC2, 0xB6, 0x43, 0x66, 0xDB, 0xC0, 0xF6, 0x24, 0x12, 0x14, 0x14, 0x62,
+ 0xA2, 0xC4, 0x8F, 0x80, 0xE1, 0x64, 0x3C, 0x28, 0x89, 0x07, 0x0F, 0x2C,
+ 0x51, 0xFF, 0x1A, 0x76, 0x39, 0xFA, 0x2F, 0x38, 0xD3, 0x2F, 0xFA, 0xB1,
+ 0xB3, 0xD4, 0xC4, 0xA3, 0x7B, 0x9A, 0xF7, 0xDE, 0xEF, 0xF7, 0xE6, 0xBD,
+ 0xDF, 0xBC, 0x7D, 0xD9, 0x95, 0x9B, 0x58, 0x87, 0x4D, 0x04, 0x1C, 0x68,
+ 0xA3, 0x29, 0xC1, 0x37, 0x1F, 0xD7, 0x16, 0x05, 0x60, 0xA0, 0x96, 0x3E,
+ 0x25, 0x9C, 0x9F, 0x9E, 0xF4, 0xDE, 0x3E, 0xBF, 0x71, 0xD1, 0xD9, 0x3C,
+ 0xFF, 0xF9, 0xE6, 0xF7, 0x8F, 0xBD, 0xEE, 0xAB, 0x6F, 0xBD, 0xCE, 0xAF,
+ 0x9B, 0x82, 0x72, 0xFD, 0x1A, 0x00, 0x32, 0x63, 0x39, 0x06, 0x24, 0x5A,
+ 0xDB, 0xAE, 0xE3, 0x66, 0x2B, 0x4A, 0xD0, 0x20, 0xA8, 0x81, 0x89, 0x05,
+ 0x1D, 0x86, 0x1A, 0x02, 0xB2, 0x8D, 0x1D, 0xD7, 0x9C, 0xA7, 0xA1, 0x16,
+ 0xB3, 0x87, 0x42, 0x5B, 0x39, 0x3F, 0x7D, 0xD2, 0x3B, 0xDA, 0x91, 0xA5,
+ 0xD0, 0x4A, 0x07, 0xCE, 0xF6, 0x38, 0x81, 0xD3, 0xDD, 0xFE, 0x81, 0xEE,
+ 0xE1, 0x21, 0x2F, 0xD5, 0x01, 0x87, 0xB1, 0x7D, 0xC2, 0xBB, 0x63, 0x8B,
+ 0xC7, 0xF8, 0xC2, 0x61, 0x74, 0x3E, 0x72, 0x18, 0xFB, 0x9B, 0xDC, 0x00,
+ 0xB7, 0x79, 0x16, 0xCB, 0xF7, 0x0F, 0xA2, 0x73, 0x22, 0x61, 0x5A, 0x52,
+ 0x00, 0xEB, 0x75, 0x32, 0x25, 0xDC, 0x16, 0xFE, 0x6B, 0xFB, 0x8F, 0xB4,
+ 0x35, 0x60, 0x3B, 0x35, 0xAC, 0xD4, 0x52, 0x7A, 0xEF, 0x8F, 0x7B, 0x47,
+ 0xC7, 0xBD, 0x77, 0x9F, 0x64, 0x89, 0x99, 0x39, 0x3F, 0xBD, 0xAF, 0xBF,
+ 0xFF, 0x6C, 0x8F, 0x83, 0xDF, 0xED, 0xEB, 0xA7, 0x4A, 0x73, 0xF2, 0x1C,
+ 0xF4, 0xC7, 0x6F, 0x9F, 0x24, 0x7E, 0x10, 0x9C, 0xFA, 0x34, 0x91, 0x1B,
+ 0x8F, 0x80, 0x5D, 0xE8, 0xA3, 0xD8, 0x41, 0xB1, 0xF6, 0x62, 0xD5, 0xC5,
+ 0x7A, 0x8B, 0x95, 0x0E, 0xAC, 0xD1, 0x46, 0xC4, 0x32, 0x2C, 0x64, 0xA7,
+ 0x57, 0x43, 0xE4, 0xA2, 0xD7, 0xBD, 0xE8, 0xEE, 0xB3, 0x87, 0x8A, 0x1D,
+ 0xF9, 0xF0, 0xCB, 0x42, 0x18, 0x5C, 0x9A, 0xA9, 0x4B, 0x10, 0x81, 0xA9,
+ 0xFC, 0xD4, 0xA2, 0x35, 0x7D, 0xED, 0x6E, 0x6F, 0x75, 0x77, 0xF7, 0x65,
+ 0x89, 0x99, 0x39, 0x7F, 0xE2, 0x04, 0xC1, 0x29, 0xE6, 0xD2, 0x65, 0x27,
+ 0xE5, 0xB6, 0x5D, 0xE8, 0x35, 0xA0, 0x8B, 0x16, 0xA0, 0xEB, 0x22, 0xE2,
+ 0x24, 0xD2, 0x27, 0x9E, 0x68, 0x21, 0x2E, 0x7B, 0xCD, 0xA6, 0xA0, 0x3C,
+ 0xA2, 0x1F, 0xB1, 0xDB, 0xF9, 0x2E, 0xAA, 0x22, 0x9D, 0x41, 0xB1, 0x2A,
+ 0xD2, 0x87, 0x10, 0xA7, 0xE9, 0x87, 0xE9, 0x92, 0x50, 0x78, 0x39, 0x9A,
+ 0xD8, 0x69, 0x70, 0x72, 0x94, 0xE2, 0xDB, 0xC8, 0x08, 0xE9, 0x92, 0x2A,
+ 0x55, 0x4B, 0x31, 0x5A, 0x26, 0x26, 0x2E, 0x9F, 0x03, 0x40, 0xC6, 0x13,
+ 0xC9, 0xE1, 0x5A, 0x76, 0x4E, 0x8E, 0x94, 0x27, 0x23, 0x47, 0xC5, 0x34,
+ 0xC5, 0xDE, 0x87, 0xA7, 0xA2, 0xAA, 0x8A, 0xDD, 0x9D, 0x67, 0xA2, 0xA6,
+ 0x89, 0x17, 0x9F, 0x5F, 0x8B, 0x60, 0x49, 0x96, 0x52, 0x0C, 0x5E, 0x8A,
+ 0x50, 0x8D, 0xFE, 0x29, 0x4A, 0x25, 0x08, 0xE4, 0xA8, 0x00, 0x73, 0x52,
+ 0x55, 0x27, 0x35, 0xAD, 0x14, 0x25, 0xD2, 0x23, 0x24, 0xE5, 0x19, 0x4C,
+ 0x8D, 0x5C, 0xEF, 0xD1, 0x70, 0xD4, 0xA8, 0x37, 0x9E, 0x98, 0x19, 0xE8,
+ 0xAC, 0xAC, 0xCE, 0xDA, 0x2D, 0x6D, 0xBA, 0x7A, 0x77, 0x7D, 0x71, 0xC3,
+ 0x9C, 0xF3, 0x97, 0x42, 0x11, 0xD3, 0xA0, 0x80, 0xE9, 0x78, 0x76, 0x1D,
+ 0x91, 0xAC, 0x92, 0x19, 0x5F, 0x54, 0x14, 0xF5, 0xD1, 0x99, 0xD7, 0x05,
+ 0xC5, 0x1F, 0xF5, 0xFD, 0x89, 0x71, 0xDF, 0xF7, 0x65, 0x29, 0x83, 0xE3,
+ 0x53, 0x75, 0x8F, 0x10, 0xE4, 0xE8, 0x6D, 0x41, 0x19, 0x0E, 0xC9, 0x13,
+ 0x13, 0xA5, 0xB9, 0x6B, 0x88, 0xE8, 0xC8, 0x71, 0xA3, 0x6B, 0x47, 0x8A,
+ 0x3C, 0xA6, 0x47, 0xA1, 0x87, 0xA4, 0xAF, 0xCB, 0x56, 0x87, 0xB2, 0xAE,
+ 0x28, 0xBD, 0x81, 0x74, 0xCB, 0x86, 0x74, 0x48, 0xC6, 0xE3, 0x2C, 0x61,
+ 0x98, 0x4B, 0x68, 0x10, 0xEC, 0xAD, 0x59, 0x6C, 0x26, 0x46, 0x4B, 0x32,
+ 0x92, 0x0E, 0x46, 0x4A, 0x12, 0x6C, 0xCB, 0xF1, 0x5A, 0x82, 0x32, 0x56,
+ 0x12, 0xEE, 0x23, 0x82, 0x05, 0xE5, 0x56, 0x01, 0x7D, 0x29, 0x4C, 0xE6,
+ 0xBD, 0xE3, 0xC7, 0xC8, 0x28, 0x93, 0x75, 0xC6, 0x63, 0x18, 0x18, 0x82,
+ 0x32, 0x5F, 0x1B, 0xA6, 0x2B, 0x29, 0x83, 0x18, 0xC0, 0xB2, 0x5A, 0x98,
+ 0x1D, 0x04, 0xA5, 0xB6, 0x58, 0xFD, 0x0B, 0x5A, 0xFA, 0x21, 0x0A, 0xA4,
+ 0x60, 0x27, 0x16, 0xEA, 0x66, 0x4B, 0xA0, 0xBD, 0x86, 0x96, 0xA1, 0x1E,
+ 0xAF, 0xE0, 0xD8, 0x8C, 0x72, 0x56, 0x0C, 0x5C, 0x47, 0x40, 0xA5, 0xAF,
+ 0x05, 0x34, 0xD7, 0x00, 0xF7, 0x05, 0xA9, 0x2F, 0x4C, 0x6D, 0xD3, 0x9F,
+ 0x90, 0x06, 0x58, 0xA0, 0x32, 0x72, 0x00, 0x96, 0x63, 0x61, 0x67, 0x00,
+ 0xE0, 0x0E, 0xF6, 0x88, 0x85, 0x08, 0xBB, 0x85, 0x83, 0x08, 0x4B, 0x59,
+ 0xB0, 0xAE, 0x84, 0xCC, 0xA2, 0x3A, 0x41, 0xEB, 0x03, 0x21, 0x15, 0x02,
+ 0xEB, 0xF4, 0x8B, 0x38, 0x08, 0x52, 0x33, 0xA1, 0xC5, 0x01, 0xCC, 0x61,
+ 0xDF, 0x5B, 0x85, 0x60, 0x06, 0xBB, 0xA6, 0xA5, 0xB3, 0x9E, 0xC6, 0x1E,
+ 0xDE, 0x03, 0xEA, 0x60, 0x30, 0x15, 0x40, 0x37, 0x71, 0x0C, 0x7E, 0x30,
+ 0xF0, 0x6A, 0x0D, 0x5F, 0x21, 0x77, 0xF4, 0x2A, 0x6D, 0xCF, 0x69, 0xAC,
+ 0xE0, 0x00, 0x19, 0xDE, 0x1E, 0x2C, 0xB6, 0xD4, 0x7B, 0xCA, 0x52, 0xF8,
+ 0x67, 0x41, 0xF9, 0x03, 0x11, 0xC2, 0x4A, 0xC9};
+const uint8_t g_zhHK_Locale[] = {
+ 0x78, 0x9C, 0xA5, 0x57, 0x4D, 0x4F, 0x13, 0x41, 0x18, 0x3E, 0x63, 0xE2,
+ 0x7F, 0x98, 0x6C, 0x20, 0x0B, 0x09, 0x50, 0x8A, 0x9F, 0x25, 0xCB, 0x26,
+ 0x44, 0x90, 0x9A, 0x5A, 0x43, 0x2C, 0xD1, 0xC8, 0xC5, 0x6C, 0x77, 0x87,
+ 0xEE, 0x42, 0x77, 0x87, 0x4C, 0xB7, 0xC1, 0x6E, 0x3C, 0x88, 0x04, 0xA5,
+ 0x5A, 0x2E, 0x4A, 0x54, 0x02, 0x86, 0x78, 0x50, 0x0F, 0x48, 0xBC, 0x78,
+ 0x68, 0x89, 0xC6, 0x3F, 0x43, 0x8B, 0x9E, 0xFC, 0x0B, 0xCE, 0xEC, 0x17,
+ 0xFB, 0x35, 0x6D, 0x8D, 0x3D, 0xCD, 0xFB, 0xBC, 0xCF, 0xF3, 0xCE, 0xFB,
+ 0x3E, 0x33, 0x3B, 0x01, 0xA1, 0x8C, 0x64, 0xA9, 0x0C, 0x81, 0x21, 0xE9,
+ 0x70, 0x9A, 0xB3, 0xD4, 0x87, 0xD9, 0x1C, 0x07, 0x14, 0x58, 0x91, 0xA7,
+ 0xB9, 0xD3, 0xE6, 0x71, 0xE7, 0xCD, 0xF3, 0xE1, 0xB3, 0xD6, 0xC6, 0xE9,
+ 0x8F, 0xD7, 0x7F, 0xBE, 0x37, 0x7E, 0x7F, 0xDA, 0xEB, 0x34, 0xBF, 0x9E,
+ 0xD5, 0x5B, 0xED, 0xED, 0xA3, 0x5F, 0x1F, 0x1A, 0x9D, 0xDD, 0x9F, 0xED,
+ 0xC6, 0xC9, 0x08, 0x27, 0x5E, 0xBC, 0x00, 0x80, 0x40, 0x8B, 0x18, 0x8A,
+ 0x84, 0x0B, 0x35, 0xBD, 0x88, 0xCA, 0x15, 0xB7, 0x5E, 0x09, 0xC3, 0x12,
+ 0xC2, 0x9A, 0x64, 0x50, 0xD6, 0x00, 0x10, 0x74, 0x64, 0x98, 0xEA, 0x1D,
+ 0x92, 0xAA, 0xD0, 0x78, 0xC0, 0x89, 0xC5, 0xD3, 0xE6, 0x93, 0xCE, 0xC1,
+ 0xB6, 0x90, 0x72, 0xA2, 0x60, 0xE2, 0xA4, 0xC1, 0x48, 0x34, 0xEB, 0xC9,
+ 0x89, 0xF6, 0xFE, 0x3E, 0xAB, 0xD4, 0x2E, 0x43, 0xB1, 0x75, 0xCC, 0xDA,
+ 0x63, 0x93, 0xA5, 0x38, 0x62, 0x28, 0x5A, 0xEF, 0x19, 0x8A, 0x9D, 0x0D,
+ 0x66, 0x82, 0x39, 0x3C, 0xCD, 0x45, 0xE7, 0x07, 0xEE, 0xDA, 0xB7, 0x30,
+ 0x68, 0x29, 0x90, 0x8A, 0x45, 0x3C, 0xCD, 0xA5, 0xB9, 0x60, 0x95, 0x74,
+ 0x72, 0xF1, 0xC9, 0x64, 0xF8, 0x52, 0x32, 0x7C, 0x39, 0x19, 0xBE, 0x92,
+ 0x0C, 0x5F, 0x4D, 0x86, 0xAF, 0x25, 0xC3, 0xD7, 0x93, 0xE1, 0x4C, 0x32,
+ 0x9C, 0x9E, 0x60, 0xE0, 0x8C, 0x39, 0xD3, 0x93, 0x3D, 0x0D, 0x54, 0xA4,
+ 0x5A, 0xE0, 0x46, 0x92, 0x48, 0xEC, 0xBC, 0x3B, 0xEC, 0x1C, 0x1C, 0x76,
+ 0xDE, 0x7E, 0x14, 0x52, 0x34, 0x8C, 0xE0, 0xE4, 0xC0, 0x92, 0xF1, 0x93,
+ 0x06, 0x83, 0x5F, 0x4F, 0xC4, 0xC9, 0x55, 0x65, 0xD4, 0xD9, 0x4D, 0xE6,
+ 0x6F, 0x1D, 0xFB, 0x38, 0xB0, 0x57, 0x09, 0x43, 0x44, 0xEE, 0x80, 0xAD,
+ 0x8E, 0xCD, 0x11, 0x9F, 0x20, 0xDE, 0x7B, 0xBC, 0xEB, 0x78, 0xBF, 0xF1,
+ 0x4E, 0xBB, 0xF6, 0xA8, 0x43, 0xAC, 0x29, 0x1A, 0xD4, 0x83, 0xDF, 0xBF,
+ 0x0B, 0x91, 0xED, 0x5E, 0xB4, 0x77, 0xE8, 0x41, 0x79, 0x40, 0x34, 0xFD,
+ 0x32, 0x96, 0x06, 0xE7, 0x61, 0x60, 0x13, 0x88, 0xA5, 0x40, 0x7D, 0x12,
+ 0x91, 0x9E, 0xBE, 0xB4, 0xB7, 0x36, 0xDB, 0xF5, 0x1D, 0x21, 0x45, 0xC3,
+ 0x08, 0xEE, 0x83, 0xC0, 0x5E, 0x79, 0x5A, 0xF2, 0xA2, 0xA5, 0x22, 0x4F,
+ 0x9A, 0x83, 0x2A, 0x92, 0x09, 0x17, 0x24, 0xD3, 0x84, 0xD8, 0xF0, 0xAD,
+ 0xF7, 0x11, 0xF7, 0xD5, 0x5B, 0xAE, 0x96, 0xCB, 0x9C, 0xF8, 0x80, 0xFC,
+ 0xF8, 0x76, 0xEB, 0x1B, 0x9F, 0xE7, 0xC9, 0x1D, 0xE4, 0x67, 0x79, 0x72,
+ 0x10, 0x3C, 0x98, 0x23, 0x3F, 0x6A, 0x8C, 0xAF, 0x61, 0x15, 0x29, 0x23,
+ 0xA3, 0xC4, 0x28, 0xD2, 0x97, 0x5E, 0x87, 0xCA, 0xFF, 0xC8, 0x2B, 0x2A,
+ 0xC2, 0x26, 0x2D, 0xD0, 0x53, 0x0E, 0x40, 0x08, 0x71, 0x7D, 0x32, 0x35,
+ 0x3D, 0xE2, 0x53, 0x00, 0x09, 0xF9, 0x34, 0xA3, 0xAA, 0x7C, 0x67, 0xEF,
+ 0x29, 0x9F, 0xCF, 0xF3, 0xED, 0xED, 0x67, 0x7C, 0xA1, 0xC0, 0x9F, 0x7D,
+ 0x7E, 0xC5, 0x83, 0x25, 0x21, 0x15, 0x50, 0xB0, 0x4A, 0x38, 0x2E, 0x25,
+ 0x97, 0xE8, 0xAB, 0x80, 0x6D, 0x13, 0xD1, 0x4F, 0xE5, 0xF3, 0x53, 0x85,
+ 0x42, 0x5F, 0x12, 0xD7, 0x9A, 0x19, 0xAA, 0x89, 0x0A, 0xA8, 0x19, 0x91,
+ 0xD1, 0xDD, 0x4B, 0xB3, 0x48, 0x50, 0xEF, 0x26, 0xCD, 0x4B, 0xC6, 0xCA,
+ 0x6A, 0x56, 0xAF, 0x14, 0xE6, 0x66, 0x6F, 0xAE, 0xDF, 0x7F, 0xA4, 0xE6,
+ 0xAC, 0x25, 0xC7, 0xC3, 0x20, 0xC9, 0x56, 0x1A, 0x55, 0xBD, 0x08, 0x71,
+ 0xD8, 0xC8, 0x10, 0xE6, 0xF6, 0x44, 0x30, 0xF2, 0x2D, 0xC8, 0x9C, 0x68,
+ 0x8D, 0x5A, 0x56, 0x66, 0xDC, 0xB2, 0x2C, 0x21, 0x15, 0xE2, 0xB1, 0xA5,
+ 0x72, 0x15, 0x63, 0x68, 0xC8, 0x35, 0x4E, 0x1C, 0x74, 0xC4, 0x99, 0xCC,
+ 0xE3, 0x61, 0x7F, 0x39, 0xD2, 0x77, 0x9D, 0x35, 0x88, 0x65, 0x68, 0x98,
+ 0x6E, 0x0B, 0x43, 0x71, 0x1D, 0xF5, 0x26, 0x36, 0x8F, 0x3F, 0xE3, 0xF9,
+ 0xD8, 0x03, 0x61, 0xC8, 0x2D, 0xAF, 0x40, 0x59, 0xD3, 0x25, 0x72, 0x5F,
+ 0xC6, 0xBD, 0x2A, 0x4E, 0x9A, 0x29, 0x28, 0x61, 0x54, 0x5D, 0xD3, 0xE8,
+ 0xF5, 0x18, 0xED, 0x53, 0xE1, 0x4F, 0x30, 0xD4, 0xA7, 0x40, 0xD7, 0x8C,
+ 0x6A, 0x85, 0x13, 0xC7, 0xFA, 0xA4, 0x5B, 0x10, 0x23, 0x4E, 0x9C, 0x88,
+ 0xB1, 0xCF, 0x8D, 0x09, 0x9D, 0xBD, 0x77, 0x30, 0x21, 0x67, 0xC2, 0xA0,
+ 0x77, 0x23, 0xED, 0x80, 0x13, 0xB3, 0xB9, 0x41, 0xF2, 0x6C, 0x85, 0x18,
+ 0x5D, 0x54, 0x5A, 0x05, 0xD1, 0x05, 0x95, 0xCD, 0xFE, 0x83, 0x2C, 0x78,
+ 0x10, 0x31, 0x91, 0xFD, 0x6E, 0xC6, 0xFA, 0xA6, 0xEF, 0x41, 0x6D, 0x0D,
+ 0x2E, 0x4B, 0xB2, 0xF7, 0x4C, 0x7B, 0xA1, 0x5B, 0x73, 0x46, 0x41, 0x45,
+ 0x08, 0xF2, 0xE4, 0xB4, 0x40, 0xC1, 0x54, 0xC0, 0x6D, 0x2E, 0x95, 0x48,
+ 0xCB, 0xD7, 0xC8, 0xDF, 0x92, 0x0A, 0x58, 0x20, 0x36, 0x32, 0x08, 0x9A,
+ 0xA1, 0x21, 0xA3, 0x0B, 0xE1, 0x06, 0xAA, 0x62, 0x0D, 0x62, 0xBA, 0x0B,
+ 0x83, 0xE1, 0xB4, 0xB2, 0xA0, 0xF5, 0xA4, 0x64, 0x61, 0x11, 0xC3, 0xF5,
+ 0xAE, 0x94, 0x19, 0x2C, 0x15, 0xC9, 0x47, 0xD9, 0x8D, 0xB2, 0xA8, 0x4A,
+ 0x1A, 0x83, 0x90, 0x43, 0x56, 0x75, 0x55, 0x02, 0xF3, 0xC8, 0x54, 0x35,
+ 0x99, 0xCE, 0x34, 0x76, 0xEF, 0x16, 0xC8, 0x77, 0x27, 0x13, 0x03, 0x64,
+ 0x15, 0x79, 0xE4, 0xBB, 0x5D, 0xB7, 0x2E, 0xA0, 0x1E, 0x76, 0xBB, 0xA7,
+ 0x52, 0xAB, 0x1A, 0xA5, 0x15, 0x64, 0x33, 0x9D, 0xDD, 0xED, 0x47, 0x2E,
+ 0x70, 0x9E, 0x42, 0xCA, 0xF9, 0x27, 0x42, 0xFC, 0x0B, 0xD9, 0x0E, 0x4B,
+ 0xED};
+const uint8_t g_jaJP_Locale[] = {
+ 0x78, 0x9C, 0xED, 0x56, 0xCB, 0x6E, 0xD3, 0x40, 0x14, 0x5D, 0x17, 0x89,
+ 0x7F, 0x18, 0x59, 0x20, 0x83, 0xD4, 0xD6, 0x0D, 0xEF, 0x56, 0xAE, 0xA5,
+ 0x8A, 0x96, 0x86, 0x16, 0xA3, 0x08, 0x57, 0xA0, 0x76, 0x83, 0x26, 0xF6,
+ 0x34, 0x99, 0x36, 0x9E, 0xA9, 0x26, 0xB6, 0x4A, 0xBC, 0xE2, 0x21, 0x20,
+ 0x48, 0x74, 0x01, 0x1B, 0x04, 0x44, 0x62, 0x55, 0x40, 0x02, 0x04, 0x8B,
+ 0x6E, 0xD8, 0xD0, 0xAF, 0x49, 0x5A, 0x56, 0xFC, 0x02, 0x33, 0x7E, 0xC5,
+ 0x8E, 0xED, 0xE0, 0xEE, 0xF1, 0x22, 0x99, 0x7B, 0x7C, 0xCE, 0xF5, 0xBD,
+ 0xE7, 0x8E, 0x47, 0x56, 0x5B, 0xD4, 0x84, 0x2D, 0x04, 0x08, 0xB4, 0xD1,
+ 0xBC, 0xB4, 0x05, 0xEF, 0xAF, 0xD4, 0x24, 0x60, 0xA1, 0xB6, 0x39, 0x2F,
+ 0x0D, 0xDE, 0xEC, 0x1F, 0x7F, 0xFF, 0x76, 0x8E, 0xFF, 0x0D, 0x7A, 0x5F,
+ 0xCF, 0x4B, 0xDA, 0xE9, 0x53, 0x00, 0xA8, 0x82, 0x4C, 0x2C, 0xC8, 0x8C,
+ 0x8E, 0x5D, 0xA7, 0xAD, 0x76, 0xA8, 0x6B, 0x30, 0xD4, 0xA0, 0x0C, 0x43,
+ 0x22, 0x58, 0x13, 0x40, 0xB5, 0x29, 0x71, 0x9A, 0xB7, 0xF9, 0xAD, 0xB6,
+ 0x88, 0x27, 0x82, 0x58, 0xAB, 0x0C, 0x7A, 0x5D, 0x55, 0x09, 0xD6, 0x09,
+ 0xF8, 0x42, 0x3E, 0x7C, 0x31, 0x1F, 0xBE, 0x94, 0x0F, 0x5F, 0xCE, 0x87,
+ 0xAF, 0xE4, 0xC3, 0x57, 0xF3, 0xE1, 0x6B, 0xF9, 0xF0, 0x6C, 0x3E, 0x5C,
+ 0x99, 0x29, 0xC0, 0x0B, 0xFA, 0xAC, 0x8C, 0x34, 0x0A, 0xC2, 0x75, 0xEC,
+ 0x53, 0xD2, 0x37, 0x00, 0xEB, 0x75, 0x36, 0x2F, 0x55, 0xA4, 0xFF, 0x06,
+ 0x9E, 0xC4, 0x40, 0x0B, 0x76, 0x12, 0xDB, 0x8E, 0x47, 0x9A, 0xD8, 0xBE,
+ 0xEF, 0x7B, 0xFC, 0x57, 0x55, 0x44, 0x38, 0xC4, 0x7B, 0xDD, 0x5C, 0xFC,
+ 0xE8, 0xD1, 0x97, 0x7C, 0xFE, 0x8F, 0x83, 0x82, 0x3C, 0x9F, 0x73, 0xF1,
+ 0xDF, 0xCF, 0x5F, 0xE5, 0xE2, 0xFD, 0xDE, 0x87, 0x11, 0x1C, 0xF8, 0xAB,
+ 0x9C, 0x26, 0x46, 0xF6, 0x40, 0xD8, 0x4D, 0xB6, 0x8F, 0x6C, 0x07, 0xD9,
+ 0xDA, 0xB3, 0x55, 0x67, 0xEB, 0xCD, 0x56, 0x5A, 0x5C, 0xA3, 0x8D, 0x18,
+ 0xB6, 0x30, 0xB2, 0x93, 0x2F, 0x79, 0x08, 0x69, 0xFD, 0xBD, 0x6E, 0xFF,
+ 0xC5, 0x1E, 0x1F, 0x4E, 0x04, 0x64, 0x6F, 0xFF, 0x7A, 0x99, 0xBE, 0x0D,
+ 0x86, 0x61, 0xE2, 0x21, 0x88, 0xC1, 0x44, 0x7E, 0x1E, 0x69, 0x47, 0x07,
+ 0x0F, 0xFB, 0x4F, 0x9F, 0xF8, 0xD9, 0x45, 0x18, 0xE3, 0xC7, 0xFB, 0x87,
+ 0x83, 0x77, 0x1F, 0x63, 0x10, 0xF8, 0xAB, 0x48, 0xCB, 0x8F, 0x2D, 0x65,
+ 0xE4, 0xDC, 0x0A, 0x50, 0x0B, 0x3A, 0xA8, 0x06, 0x1D, 0x07, 0x31, 0x12,
+ 0x5B, 0x1F, 0x23, 0xE1, 0xD1, 0xB6, 0xE9, 0xB6, 0x5A, 0x92, 0xB6, 0xCE,
+ 0x2F, 0xB9, 0xFF, 0xF3, 0x40, 0xD6, 0x65, 0x6E, 0xB8, 0xBC, 0x28, 0xF3,
+ 0x41, 0xC8, 0x4B, 0xFC, 0x12, 0xBE, 0xC4, 0x92, 0xA2, 0x1C, 0x2D, 0x4A,
+ 0x1A, 0x05, 0x39, 0x4A, 0xE9, 0x6D, 0x64, 0x05, 0x72, 0x45, 0xD7, 0x95,
+ 0xC5, 0xC5, 0x52, 0x9A, 0x76, 0x93, 0x32, 0x47, 0xA8, 0xF2, 0x35, 0x00,
+ 0xA4, 0x90, 0xD0, 0x10, 0x07, 0xDB, 0x23, 0x86, 0x24, 0x90, 0x94, 0x21,
+ 0x55, 0x79, 0xF0, 0xF6, 0xB1, 0xAC, 0xEB, 0x72, 0xBF, 0xFB, 0x4C, 0x36,
+ 0x0C, 0xF9, 0xE8, 0xD3, 0x6B, 0x79, 0x43, 0x55, 0x12, 0xF4, 0x22, 0x7D,
+ 0x60, 0x46, 0x75, 0x4E, 0xD7, 0xE7, 0x0C, 0x63, 0xAE, 0x9C, 0xC6, 0x37,
+ 0x20, 0x94, 0x94, 0x12, 0x84, 0xDD, 0x0B, 0xC9, 0x28, 0x5F, 0x74, 0x3E,
+ 0xD2, 0x67, 0xB8, 0x15, 0xD6, 0x38, 0x1A, 0xED, 0x8F, 0x65, 0x48, 0xB6,
+ 0xB6, 0xAB, 0x76, 0xDB, 0x58, 0x5A, 0xBC, 0xB1, 0x7B, 0xEF, 0x41, 0x73,
+ 0xD5, 0xDB, 0x08, 0x0C, 0x4B, 0x92, 0x7C, 0x25, 0x71, 0xED, 0x3A, 0x62,
+ 0x69, 0xD7, 0x52, 0x58, 0x58, 0x12, 0xC7, 0xF8, 0x0E, 0x37, 0x25, 0xCD,
+ 0x9B, 0xF4, 0xBC, 0xD9, 0x69, 0xCF, 0xF3, 0x54, 0x25, 0xC5, 0x2B, 0x96,
+ 0x9A, 0x2E, 0x63, 0x88, 0x98, 0x1D, 0x49, 0x3B, 0xE3, 0x8B, 0x4B, 0x0B,
+ 0x77, 0x10, 0x33, 0x11, 0x71, 0xC2, 0x67, 0x9E, 0xCD, 0xEA, 0x84, 0x19,
+ 0x99, 0x06, 0xE2, 0xA6, 0x86, 0x7D, 0x4E, 0xA4, 0xA1, 0x30, 0xBD, 0x85,
+ 0x4C, 0x6C, 0x43, 0xBE, 0x1B, 0xA6, 0xA3, 0x2C, 0xC1, 0xED, 0x42, 0x41,
+ 0x83, 0x51, 0x77, 0x07, 0x8B, 0xF9, 0x4F, 0x96, 0x54, 0xC4, 0x1D, 0x9C,
+ 0x2D, 0x29, 0xB0, 0x31, 0x71, 0xDB, 0x92, 0x36, 0x55, 0x92, 0xEE, 0x21,
+ 0x46, 0x25, 0x6D, 0x26, 0xC3, 0x1E, 0x1A, 0x93, 0x1A, 0x76, 0x34, 0x89,
+ 0x94, 0x33, 0x69, 0x30, 0xDA, 0x81, 0x7E, 0x20, 0x69, 0x7F, 0x0E, 0xF9,
+ 0x89, 0x9D, 0x66, 0x8C, 0x51, 0xE1, 0x36, 0x15, 0x0B, 0x49, 0x5B, 0xA9,
+ 0xAD, 0x9F, 0x40, 0x96, 0x1C, 0x44, 0x46, 0xE4, 0x1F, 0x7F, 0x99, 0xBA,
+ 0xC5, 0xDB, 0xDE, 0xD9, 0x41, 0x9B, 0xD0, 0x8C, 0x4E, 0xDB, 0x28, 0x0C,
+ 0x73, 0xAE, 0x52, 0xCF, 0xDD, 0x86, 0x60, 0x99, 0x3A, 0x4D, 0x6C, 0x82,
+ 0x1A, 0xA3, 0x53, 0x77, 0x6F, 0x02, 0x5D, 0x52, 0xC6, 0x91, 0x75, 0x4C,
+ 0xCC, 0x26, 0x8D, 0xC8, 0x77, 0x0A, 0xC8, 0x7A, 0x87, 0x7F, 0x2A, 0x5A,
+ 0x82, 0x55, 0x44, 0xC0, 0x04, 0x53, 0x32, 0x86, 0x70, 0x9D, 0xBA, 0x0C,
+ 0x23, 0x06, 0x0C, 0xC7, 0x2A, 0x60, 0x2C, 0x58, 0xB4, 0x8E, 0x40, 0x0D,
+ 0xFF, 0x93, 0x52, 0x45, 0x75, 0x86, 0x76, 0xC7, 0x52, 0x16, 0x18, 0xAC,
+ 0xF3, 0x17, 0x77, 0x1C, 0x65, 0xAD, 0x09, 0xF1, 0x58, 0x02, 0x6F, 0xA9,
+ 0x21, 0x6A, 0x01, 0xB7, 0xC6, 0xD2, 0x0C, 0x5A, 0x8A, 0xA6, 0x77, 0x5C,
+ 0xD2, 0xD8, 0xA2, 0x3E, 0x33, 0x18, 0x89, 0x7F, 0xAA, 0x25, 0xE6, 0xA9,
+ 0x2A, 0xC1, 0x87, 0xBD, 0xF6, 0x17, 0x6C, 0x42, 0x08, 0x21};
+const uint8_t g_koKR_Locale[] = {
+ 0x78, 0x9C, 0xED, 0x56, 0x4D, 0x6B, 0xD4, 0x40, 0x18, 0x3E, 0x57, 0xF0,
+ 0x3F, 0x0C, 0xC1, 0x12, 0x85, 0x76, 0xB7, 0xEB, 0x77, 0x4B, 0x1A, 0x28,
+ 0x6E, 0x6D, 0x65, 0x8D, 0x94, 0xA6, 0x58, 0xEC, 0x45, 0x66, 0x93, 0xE9,
+ 0x26, 0xED, 0x26, 0x53, 0x26, 0x09, 0x75, 0x73, 0xAE, 0x52, 0xF0, 0xE2,
+ 0xA1, 0x87, 0xEA, 0x6E, 0xB1, 0x07, 0x11, 0x2A, 0x88, 0x22, 0x22, 0x1E,
+ 0x14, 0x7F, 0x8D, 0x62, 0x6D, 0x8A, 0x7F, 0xC1, 0xC9, 0xE7, 0xE6, 0x63,
+ 0xB2, 0x4D, 0xEF, 0xEE, 0x61, 0x99, 0xF7, 0x99, 0xE7, 0x79, 0xF3, 0xBE,
+ 0xCF, 0x4C, 0x5E, 0x22, 0x74, 0xB1, 0x02, 0xBB, 0x08, 0x98, 0xD0, 0x40,
+ 0xB3, 0xDC, 0x26, 0x7E, 0xDC, 0x5A, 0xE6, 0x80, 0x8A, 0x2C, 0x65, 0x96,
+ 0xFB, 0x35, 0x38, 0x38, 0xFE, 0x34, 0xF8, 0xFD, 0xE1, 0xFD, 0xE5, 0xE3,
+ 0xD7, 0x47, 0x3F, 0xFB, 0xDF, 0xAF, 0x70, 0xE2, 0xC5, 0x0B, 0x00, 0x08,
+ 0x3E, 0xDF, 0x54, 0x21, 0x91, 0x7B, 0x46, 0x1B, 0x77, 0xAD, 0x48, 0xDA,
+ 0x21, 0xA8, 0x83, 0x89, 0x0E, 0x4D, 0x9F, 0x35, 0x06, 0x04, 0x03, 0x9B,
+ 0xB6, 0xF6, 0x80, 0x6E, 0x59, 0x7E, 0x3C, 0x16, 0xC6, 0x62, 0xC3, 0xEB,
+ 0xEF, 0x09, 0xF5, 0x70, 0x9D, 0x82, 0xAF, 0xB2, 0xE1, 0x6B, 0x6C, 0xF8,
+ 0x3A, 0x1B, 0xBE, 0xC1, 0x86, 0x6F, 0xB2, 0xE1, 0x5B, 0x6C, 0xF8, 0x36,
+ 0x1B, 0x9E, 0x66, 0xC3, 0x8D, 0xA9, 0x12, 0xBC, 0xA4, 0xCF, 0x46, 0xAE,
+ 0x51, 0x10, 0xAD, 0x13, 0x9F, 0xD2, 0xBE, 0x01, 0xD8, 0x6E, 0x93, 0x59,
+ 0xAE, 0xC1, 0xFD, 0x37, 0xF0, 0x3C, 0x06, 0xAA, 0xB0, 0x97, 0xBA, 0x76,
+ 0x34, 0x12, 0xBD, 0x83, 0x6F, 0xDE, 0xAB, 0x3D, 0xFA, 0x2F, 0xD4, 0xFD,
+ 0x70, 0x88, 0xF7, 0xF7, 0x98, 0xF8, 0xE9, 0x4B, 0x36, 0xEE, 0xED, 0xEE,
+ 0x33, 0xF1, 0x93, 0x77, 0x47, 0x4C, 0xFC, 0xCF, 0xD7, 0x5D, 0x76, 0xFE,
+ 0x67, 0x87, 0x39, 0x1C, 0x04, 0x2B, 0x46, 0x13, 0xB9, 0x3B, 0x10, 0x75,
+ 0x53, 0xEC, 0xA3, 0xD8, 0x41, 0xB1, 0xF6, 0x62, 0xD5, 0xC5, 0x7A, 0x8B,
+ 0x95, 0x96, 0xD7, 0x68, 0x20, 0xA2, 0xAB, 0x3A, 0x32, 0xD2, 0x2F, 0x79,
+ 0x04, 0x89, 0xDE, 0xFE, 0x1B, 0xEF, 0x70, 0x87, 0x1E, 0x4E, 0x0C, 0x14,
+ 0xB6, 0x4F, 0xFB, 0xB9, 0x6D, 0x30, 0x0C, 0x53, 0x0F, 0x41, 0x04, 0xA6,
+ 0xF2, 0xD3, 0x88, 0x56, 0xF9, 0xD1, 0xEB, 0xBF, 0x08, 0xB2, 0xFB, 0x61,
+ 0x82, 0x7B, 0x3B, 0x03, 0xBA, 0x95, 0x80, 0x20, 0x58, 0xC5, 0x5A, 0x3A,
+ 0xB6, 0xEA, 0xB9, 0xB9, 0x15, 0xA2, 0x2A, 0xB4, 0xD1, 0x12, 0xB4, 0x6D,
+ 0x44, 0xCC, 0xC4, 0xFA, 0x04, 0x89, 0x46, 0xDB, 0xBA, 0xD3, 0xED, 0x72,
+ 0xE2, 0x23, 0xFA, 0xE3, 0x4F, 0x9E, 0xEE, 0xF0, 0x40, 0xE2, 0xA9, 0xE3,
+ 0x3C, 0x68, 0xF2, 0xF4, 0x28, 0x78, 0x30, 0x4F, 0x7F, 0xBE, 0x35, 0x89,
+ 0xAA, 0x2C, 0x4D, 0x17, 0x9B, 0x9D, 0xD2, 0x34, 0x95, 0x32, 0x18, 0x48,
+ 0x0D, 0x13, 0xD4, 0x80, 0x24, 0xD5, 0x40, 0xB3, 0x59, 0x49, 0x65, 0x69,
+ 0x98, 0xD8, 0xBE, 0xAE, 0x4C, 0x05, 0x40, 0x06, 0x89, 0x9C, 0xB1, 0x75,
+ 0x23, 0xE7, 0x4C, 0x0A, 0xC9, 0x38, 0x33, 0x07, 0x34, 0x8D, 0xF7, 0x9E,
+ 0x0F, 0x68, 0x4B, 0x12, 0x7F, 0xF2, 0x85, 0xB6, 0x26, 0xCB, 0xBC, 0xF7,
+ 0x79, 0x97, 0x07, 0x6B, 0x42, 0x3D, 0x25, 0x2A, 0xCB, 0x12, 0x1A, 0x53,
+ 0x9A, 0xA5, 0x52, 0x8E, 0xC0, 0x1A, 0x9A, 0x62, 0x46, 0x92, 0x66, 0x64,
+ 0xB9, 0x92, 0x24, 0xF2, 0x25, 0x14, 0xE5, 0x15, 0xBE, 0x27, 0x39, 0x07,
+ 0xA2, 0xDB, 0xB2, 0x42, 0xD1, 0xF8, 0x0A, 0x2D, 0x40, 0x73, 0x63, 0x73,
+ 0xD1, 0xB0, 0xE4, 0xF9, 0xE6, 0xDD, 0xED, 0xD5, 0x27, 0x5A, 0xCB, 0x5D,
+ 0x0B, 0xAD, 0x4C, 0x93, 0x02, 0xA5, 0xE9, 0x18, 0x6D, 0x44, 0xB2, 0x7E,
+ 0x66, 0xB0, 0xA8, 0x28, 0x8A, 0xD1, 0x97, 0x40, 0xE1, 0x44, 0x77, 0xC2,
+ 0x75, 0xA7, 0x6B, 0xAE, 0xEB, 0x0A, 0xF5, 0x0C, 0xAF, 0x5C, 0xAA, 0x38,
+ 0x84, 0x20, 0x53, 0xE9, 0x71, 0xE2, 0xA5, 0x40, 0x5C, 0x59, 0xB8, 0x85,
+ 0x88, 0x82, 0x4C, 0x3B, 0x7A, 0xE6, 0x78, 0x51, 0xE7, 0x9B, 0x51, 0x68,
+ 0x20, 0x69, 0x6A, 0xD8, 0xE7, 0x58, 0x16, 0x8A, 0xD2, 0xAB, 0x48, 0xD1,
+ 0x0D, 0x48, 0xEF, 0x49, 0x2D, 0xCE, 0x12, 0x6E, 0x97, 0x0A, 0x3A, 0x04,
+ 0x3B, 0x5B, 0xBA, 0x7F, 0x27, 0x26, 0x2A, 0x2A, 0x92, 0x0E, 0xC6, 0x2B,
+ 0x0A, 0x0C, 0xDD, 0x74, 0x2C, 0x4E, 0x9C, 0xAC, 0x48, 0x77, 0x11, 0xC1,
+ 0x9C, 0x38, 0x55, 0x60, 0x0F, 0x8D, 0xC9, 0x1C, 0x76, 0x7C, 0x12, 0x19,
+ 0x67, 0xB2, 0x60, 0x7C, 0x07, 0x83, 0x80, 0x13, 0xFF, 0xFE, 0x78, 0x4B,
+ 0x07, 0x54, 0x86, 0x31, 0x42, 0xA5, 0x5B, 0xD8, 0x5F, 0x70, 0x62, 0x6B,
+ 0x79, 0xF5, 0x1C, 0xB2, 0xF4, 0x41, 0x14, 0x44, 0xC1, 0x84, 0x2C, 0xD4,
+ 0xED, 0xCF, 0x81, 0xDE, 0x16, 0x5A, 0x87, 0x4A, 0x3C, 0x90, 0xE3, 0x30,
+ 0xCA, 0x39, 0xA7, 0xE2, 0x36, 0x02, 0x52, 0xCF, 0x31, 0x3B, 0x1B, 0x18,
+ 0xC8, 0xB6, 0x0A, 0x24, 0xAE, 0xCE, 0x64, 0x4A, 0x3D, 0xFA, 0x75, 0xA8,
+ 0x82, 0x25, 0xEA, 0x64, 0x09, 0x41, 0x37, 0x75, 0x6C, 0x8E, 0x20, 0xDC,
+ 0xC1, 0x0E, 0xD1, 0x11, 0xF1, 0x9F, 0x52, 0xC2, 0x08, 0xAB, 0x59, 0xD2,
+ 0xCF, 0xA4, 0x2C, 0xA2, 0x36, 0x41, 0xDB, 0x23, 0x29, 0x73, 0x04, 0xB6,
+ 0xE9, 0x8B, 0x38, 0x8A, 0xB2, 0xA2, 0x41, 0xBD, 0x84, 0xD0, 0xC2, 0xAE,
+ 0xB3, 0x09, 0xC1, 0x02, 0xB6, 0x35, 0x5D, 0xF1, 0x7B, 0x9A, 0x7C, 0x78,
+ 0xAF, 0xD4, 0x9A, 0x88, 0x4C, 0x0D, 0x50, 0x34, 0x1C, 0x93, 0x97, 0x47,
+ 0x3E, 0x9A, 0x72, 0x3B, 0x81, 0xDD, 0xF7, 0x47, 0xD2, 0x64, 0x9C, 0xA1,
+ 0x05, 0x53, 0x2D, 0x75, 0x9E, 0x42, 0x3D, 0xFC, 0xFC, 0x17, 0xFF, 0x01,
+ 0xDC, 0xF1, 0x18, 0xD3};
+const uint8_t g_esES_Locale[] = {
+ 0x78, 0x9C, 0x9D, 0x56, 0xCF, 0x6B, 0xD4, 0x40, 0x14, 0xBE, 0x0B, 0xFE,
+ 0x0F, 0x21, 0x58, 0x56, 0xA1, 0xDD, 0xD1, 0x63, 0xCB, 0x36, 0x50, 0xDA,
+ 0xDA, 0x95, 0x1A, 0x59, 0x9A, 0xAA, 0xD8, 0x8B, 0x4C, 0x92, 0xE9, 0xEE,
+ 0xB4, 0xC9, 0xCC, 0x32, 0x49, 0x2C, 0x9B, 0xA3, 0xE0, 0x41, 0x10, 0x0B,
+ 0xDE, 0x8A, 0x27, 0x0F, 0x1E, 0x04, 0x8B, 0x77, 0x51, 0x3C, 0xF4, 0x3F,
+ 0x11, 0x6A, 0xEB, 0xC9, 0x7F, 0xC1, 0x37, 0x9B, 0x49, 0x36, 0x3F, 0x66,
+ 0xD7, 0x60, 0x4E, 0xF3, 0xBE, 0xF7, 0x7D, 0x2F, 0xEF, 0x7D, 0x93, 0x4C,
+ 0xD2, 0x0B, 0xB8, 0x87, 0x03, 0x62, 0x30, 0x1C, 0x92, 0x75, 0x93, 0x44,
+ 0xCF, 0xB7, 0x1D, 0xD3, 0xF0, 0x49, 0xE4, 0xAD, 0x9B, 0xD7, 0x1F, 0x7F,
+ 0x5C, 0x9D, 0x9E, 0x5F, 0xBD, 0x3E, 0xBB, 0xFE, 0x72, 0x7E, 0xBB, 0x08,
+ 0xFE, 0x7C, 0x7B, 0x73, 0xF9, 0xFE, 0xFB, 0xEF, 0xB3, 0x57, 0xBF, 0xDE,
+ 0xBE, 0xBB, 0xFC, 0x7A, 0x7A, 0xC7, 0xB4, 0x7A, 0xB2, 0x00, 0xF3, 0xB1,
+ 0x70, 0x26, 0xA1, 0xCB, 0x83, 0x48, 0xD5, 0x1A, 0x0A, 0x32, 0xE4, 0x82,
+ 0x62, 0x06, 0x8C, 0x90, 0xB3, 0x78, 0xF4, 0x08, 0xE0, 0x48, 0xAD, 0x2D,
+ 0xC2, 0x88, 0xE0, 0x3D, 0x94, 0x05, 0x37, 0x6F, 0x28, 0xF4, 0x90, 0xB8,
+ 0x42, 0x87, 0x87, 0x58, 0xA4, 0x4D, 0x14, 0xBB, 0x82, 0x06, 0x1A, 0xEE,
+ 0xA4, 0x49, 0x3D, 0x4A, 0x18, 0xD5, 0xA1, 0x81, 0x06, 0xC5, 0x43, 0x1E,
+ 0xC5, 0x4D, 0x38, 0x22, 0xE3, 0x98, 0x92, 0x10, 0x1A, 0x6C, 0xA4, 0xB8,
+ 0x17, 0x27, 0x3A, 0x9C, 0xF1, 0x17, 0x73, 0x14, 0x3E, 0xF5, 0x1A, 0x19,
+ 0x54, 0x72, 0x29, 0x27, 0x4E, 0x23, 0x03, 0xBB, 0xAE, 0x58, 0x37, 0xEF,
+ 0x99, 0x25, 0xF3, 0x74, 0xD6, 0xE9, 0x6C, 0xD3, 0x99, 0xA6, 0xB3, 0x4C,
+ 0xE7, 0x98, 0xCE, 0x2F, 0x9D, 0x5B, 0x3A, 0xAB, 0x74, 0x1E, 0xE9, 0xFC,
+ 0xD1, 0x39, 0x33, 0xDF, 0x13, 0x1F, 0x4F, 0xD4, 0x53, 0x04, 0x2B, 0xCB,
+ 0xE7, 0x21, 0x65, 0xF2, 0xF6, 0x32, 0xC8, 0xB2, 0x56, 0x90, 0x30, 0x12,
+ 0x55, 0x10, 0x30, 0x21, 0xAE, 0x43, 0xF4, 0xE2, 0x93, 0xF0, 0x78, 0x50,
+ 0x83, 0x8F, 0x12, 0xF2, 0xA2, 0x06, 0xC1, 0xFE, 0x89, 0x7A, 0xC1, 0xE8,
+ 0xE2, 0x83, 0x8B, 0xFD, 0xD9, 0x6D, 0x51, 0xD1, 0x55, 0xA9, 0xC3, 0xD2,
+ 0x9E, 0xA9, 0x56, 0xEB, 0x6D, 0xD6, 0x9B, 0x6C, 0x74, 0x58, 0xEF, 0xAD,
+ 0xDE, 0x58, 0xA3, 0x29, 0x7D, 0x47, 0x21, 0x11, 0xD4, 0x87, 0x87, 0x2D,
+ 0x7F, 0xFD, 0x54, 0x68, 0x6D, 0xD8, 0xE0, 0x6E, 0x1E, 0x94, 0x78, 0xD6,
+ 0xA0, 0x96, 0x40, 0xD5, 0x0A, 0x80, 0x10, 0x81, 0x55, 0x35, 0x58, 0x59,
+ 0xB8, 0xBB, 0xD9, 0xED, 0x21, 0xB9, 0xCA, 0x52, 0x96, 0x5F, 0x06, 0x50,
+ 0x41, 0x96, 0x41, 0xED, 0xA8, 0xC8, 0xBA, 0x8F, 0xC9, 0x00, 0xC7, 0x31,
+ 0x18, 0x3D, 0xDD, 0xD7, 0x22, 0x52, 0xE7, 0xC8, 0x61, 0x12, 0x04, 0xA6,
+ 0xB5, 0x0D, 0x97, 0xB1, 0xD5, 0x81, 0xA3, 0xC9, 0xE8, 0xD8, 0x70, 0x65,
+ 0xAB, 0x67, 0x70, 0xC9, 0x69, 0x0B, 0x4D, 0xAD, 0xA0, 0x2A, 0x11, 0x70,
+ 0x36, 0x34, 0xAD, 0xFF, 0x55, 0x87, 0xC4, 0x07, 0xF1, 0x16, 0xB2, 0x6D,
+ 0xD4, 0x52, 0x11, 0x8D, 0xB8, 0x88, 0x67, 0x9A, 0x86, 0x02, 0x55, 0x66,
+ 0x06, 0x20, 0xA6, 0x61, 0xC9, 0x83, 0x52, 0x54, 0xF1, 0xA0, 0xDF, 0xEF,
+ 0xF4, 0xA1, 0xFD, 0x0E, 0x5C, 0x0E, 0x9C, 0xD2, 0x07, 0x3D, 0x54, 0x62,
+ 0xD6, 0xCA, 0x54, 0x26, 0xEF, 0xF7, 0xD7, 0x6C, 0x7B, 0xCD, 0x71, 0x5A,
+ 0x49, 0xA6, 0xE3, 0x2A, 0x41, 0x0B, 0xBA, 0x9A, 0x55, 0x0A, 0x1A, 0x6C,
+ 0x54, 0x99, 0x4B, 0x59, 0xB5, 0x0F, 0x58, 0xBE, 0xFD, 0x3B, 0x89, 0x1D,
+ 0x1F, 0x8F, 0xC2, 0xC8, 0xD9, 0xDE, 0xBA, 0x7F, 0xF2, 0x14, 0x8F, 0x76,
+ 0xD3, 0x83, 0xCC, 0x9C, 0x32, 0x09, 0x74, 0x2C, 0x09, 0x5D, 0x22, 0x66,
+ 0x0E, 0x55, 0x62, 0xD5, 0x08, 0x60, 0xF0, 0x9C, 0x7A, 0xA6, 0x95, 0x2E,
+ 0xA7, 0xE9, 0x6A, 0x37, 0x4D, 0xD3, 0x1E, 0xAA, 0xF0, 0x1A, 0x85, 0x94,
+ 0xD0, 0x4B, 0x84, 0x20, 0xCC, 0x9B, 0xE4, 0xCA, 0xD5, 0x55, 0xE3, 0x56,
+ 0x4B, 0xE9, 0x98, 0x08, 0x8F, 0xB0, 0x58, 0x29, 0x97, 0x34, 0x2A, 0x54,
+ 0x6B, 0xBD, 0x28, 0x94, 0x4F, 0x57, 0x09, 0x55, 0x59, 0x9F, 0x78, 0x34,
+ 0xC4, 0xB0, 0xE3, 0xCB, 0xB9, 0x3E, 0x4B, 0xD7, 0xD5, 0xC5, 0x97, 0x96,
+ 0x27, 0x63, 0x2A, 0x37, 0xBA, 0xDB, 0x8A, 0x5F, 0x74, 0xBD, 0xD4, 0x8A,
+ 0x0E, 0x87, 0x6C, 0x12, 0x99, 0xD6, 0x4A, 0x2B, 0x72, 0x0A, 0x9F, 0x6F,
+ 0xD3, 0xBA, 0xDB, 0xE4, 0xA2, 0xEA, 0xD8, 0x80, 0xE4, 0xBE, 0x17, 0x4E,
+ 0x54, 0x81, 0xFC, 0xF9, 0x9A, 0x06, 0xA6, 0xF5, 0xF3, 0xE5, 0x67, 0x38,
+ 0x3E, 0x2A, 0x8C, 0x66, 0x11, 0xA5, 0xA1, 0x11, 0x97, 0x0B, 0x38, 0x35,
+ 0x1E, 0xEF, 0xB5, 0x16, 0x95, 0x4D, 0x6F, 0x4A, 0x50, 0xBD, 0x5B, 0xF9,
+ 0x32, 0x4C, 0xC6, 0xE4, 0x10, 0x7B, 0xF2, 0x1C, 0xCC, 0x97, 0xAA, 0x96,
+ 0x3D, 0x81, 0x1F, 0x1F, 0xDF, 0x18, 0x80, 0x17, 0xA8, 0xCC, 0xCC, 0xD3,
+ 0x14, 0xFE, 0x46, 0xD8, 0xDC, 0xF4, 0x26, 0x4F, 0x04, 0x7C, 0x77, 0x0C,
+ 0x27, 0xF6, 0xB5, 0xF9, 0x0D, 0x9F, 0xBB, 0xC4, 0x18, 0xD0, 0x7F, 0x10,
+ 0xFA, 0xF2, 0x67, 0xEA, 0x64, 0x01, 0x61, 0x43, 0x60, 0x17, 0x5E, 0x98,
+ 0xF9, 0x84, 0xFD, 0x11, 0xA6, 0xDA, 0xF4, 0x2E, 0x4F, 0x93, 0x63, 0x6C,
+ 0xEC, 0xF0, 0x78, 0x44, 0x3D, 0x39, 0xC7, 0xCA, 0x93, 0x07, 0x86, 0xBD,
+ 0x88, 0x0A, 0x23, 0x7B, 0x23, 0x9E, 0x53, 0xF7, 0x16, 0xDC, 0x14, 0x98,
+ 0x43, 0x39, 0x99, 0xF1, 0x70, 0x01, 0xC9, 0xE1, 0x2D, 0x48, 0xF6, 0x24,
+ 0x61, 0xC3, 0x23, 0x3E, 0xE5, 0xA9, 0xE6, 0xD0, 0x6C, 0xCF, 0x64, 0x94,
+ 0xFD, 0xFC, 0xC2, 0xF2, 0x2F, 0x7C, 0xDC, 0xCC, 0x2F,
+};
+const uint8_t g_esLA_Locale[] = {
+ 0x78, 0x9C, 0x9D, 0x56, 0xCD, 0x4E, 0xDC, 0x30, 0x10, 0x3E, 0x53, 0xA9,
+ 0xEF, 0x60, 0x45, 0x45, 0x80, 0x04, 0x9B, 0xF6, 0xB8, 0x28, 0x44, 0x5A,
+ 0x01, 0xA5, 0x15, 0x0D, 0x5A, 0x75, 0x51, 0x4B, 0xB9, 0x54, 0x4E, 0x62,
+ 0x36, 0x86, 0xC4, 0x5E, 0x39, 0x09, 0x68, 0xA3, 0xBE, 0x40, 0x4F, 0x3D,
+ 0xF4, 0xD4, 0x63, 0x2B, 0x21, 0xB5, 0x07, 0xD4, 0x47, 0xE8, 0x81, 0x67,
+ 0x41, 0xF0, 0x18, 0x9D, 0xFC, 0x6E, 0x12, 0x3B, 0xE9, 0xD2, 0x9C, 0x3C,
+ 0xDF, 0x7C, 0x9F, 0x77, 0xE6, 0xB3, 0x33, 0x1B, 0xC3, 0xE7, 0x0E, 0xF6,
+ 0x09, 0x62, 0x38, 0x20, 0x3B, 0x1A, 0x09, 0x3F, 0x5A, 0x27, 0x1A, 0x72,
+ 0x49, 0xE8, 0xEC, 0x68, 0x0F, 0xD7, 0x7F, 0xEE, 0xBF, 0xDC, 0xDC, 0x7F,
+ 0xFE, 0xF6, 0xF0, 0xFB, 0x66, 0xFD, 0xEE, 0xC7, 0x4F, 0x88, 0xEF, 0xBE,
+ 0x5E, 0x6F, 0x68, 0xE6, 0xD3, 0x27, 0x08, 0x19, 0xA9, 0x8A, 0xB9, 0x58,
+ 0x4C, 0xE6, 0x81, 0xCD, 0xFD, 0xB0, 0xD8, 0x60, 0x2A, 0xC8, 0x94, 0x0B,
+ 0x8A, 0x59, 0xCA, 0x5A, 0x41, 0x46, 0xC0, 0x59, 0xE4, 0x1D, 0x41, 0x2A,
+ 0x4C, 0xE3, 0x95, 0x3C, 0x36, 0x09, 0x23, 0x82, 0x1B, 0x7A, 0x1E, 0xD4,
+ 0xF0, 0x33, 0x62, 0x0B, 0x75, 0x26, 0xC0, 0x22, 0x51, 0xE1, 0xD8, 0x16,
+ 0xD4, 0x57, 0xF2, 0xE7, 0x2A, 0xFA, 0x79, 0xCC, 0xA8, 0x1A, 0xF7, 0x95,
+ 0x38, 0x9E, 0xF2, 0x30, 0x52, 0x25, 0x42, 0x32, 0x8B, 0x28, 0x09, 0xA0,
+ 0x5C, 0x45, 0x92, 0x3B, 0x51, 0xAC, 0xCE, 0x30, 0x7E, 0xD9, 0xA9, 0x72,
+ 0xA9, 0x23, 0xE5, 0x50, 0xB1, 0xAE, 0x1C, 0xAC, 0x3B, 0x8A, 0xB0, 0x6D,
+ 0x8B, 0x1D, 0xED, 0x85, 0xD6, 0xB2, 0x56, 0x6D, 0xAC, 0xDA, 0x54, 0xB5,
+ 0xA5, 0x6A, 0x43, 0xD5, 0x7E, 0xAA, 0xDD, 0x54, 0x7B, 0xA9, 0x36, 0x52,
+ 0xED, 0xA0, 0xDA, 0x3D, 0xB5, 0x6F, 0xFD, 0x8E, 0xB9, 0x78, 0x5E, 0xBB,
+ 0x81, 0x10, 0x99, 0x2E, 0x0F, 0x28, 0x4B, 0xCB, 0x49, 0x83, 0x0A, 0xF5,
+ 0x63, 0x46, 0xC2, 0x16, 0x06, 0x16, 0x45, 0x32, 0x48, 0x6F, 0x7F, 0x09,
+ 0x87, 0xFB, 0x52, 0xE2, 0x3C, 0x26, 0x97, 0x12, 0x08, 0x27, 0x2E, 0xE4,
+ 0x8D, 0xC3, 0xDB, 0xEF, 0x36, 0x76, 0x17, 0x25, 0xA0, 0x6C, 0xA5, 0xA8,
+ 0xBA, 0x75, 0xCA, 0x45, 0xF9, 0x72, 0xE9, 0x72, 0xE1, 0x8A, 0xAA, 0xE5,
+ 0x7A, 0xE5, 0x62, 0x15, 0x85, 0x76, 0x57, 0x19, 0x10, 0x41, 0x5D, 0xB8,
+ 0xB6, 0xF5, 0x57, 0xBC, 0x80, 0xCC, 0x91, 0x05, 0x67, 0x51, 0x06, 0xCD,
+ 0xD4, 0xB8, 0x95, 0x42, 0x8B, 0xB0, 0xB6, 0x39, 0x11, 0xB8, 0xB6, 0x2F,
+ 0x44, 0x26, 0x1E, 0xEC, 0x0E, 0x0C, 0x3D, 0x5D, 0x55, 0x90, 0x5B, 0x87,
+ 0x50, 0xB6, 0x2A, 0x45, 0x30, 0xA5, 0xF4, 0xD6, 0x98, 0xCA, 0x51, 0x17,
+ 0x47, 0x64, 0x8C, 0xA3, 0x08, 0x0E, 0xA6, 0x72, 0xBB, 0x42, 0x8A, 0x49,
+ 0x76, 0x16, 0xFB, 0xBE, 0x66, 0xEE, 0xC3, 0x83, 0xF6, 0xD6, 0x60, 0x22,
+ 0xA2, 0x35, 0x0B, 0x9E, 0x7C, 0xF5, 0x01, 0x9E, 0xD4, 0x89, 0x4A, 0xD3,
+ 0xB5, 0x89, 0xCF, 0xD9, 0x54, 0x33, 0xFF, 0x5F, 0x1F, 0x10, 0x17, 0xE4,
+ 0x7B, 0xBA, 0x65, 0xE9, 0x4B, 0x6B, 0x42, 0x8F, 0x8B, 0x68, 0xA1, 0x6A,
+ 0x6B, 0x10, 0x6A, 0x20, 0x85, 0x23, 0x11, 0x0D, 0x5A, 0x8E, 0xD4, 0x90,
+ 0x86, 0x23, 0x9E, 0xB7, 0x6D, 0x59, 0xDB, 0x93, 0x09, 0x1A, 0xA1, 0x53,
+ 0x43, 0xAF, 0xB1, 0xBA, 0x64, 0xB9, 0x07, 0x8F, 0x96, 0x65, 0xAD, 0x2F,
+ 0x54, 0x4B, 0x69, 0x8A, 0xD6, 0x33, 0x95, 0x2C, 0x49, 0x3B, 0x6F, 0xF5,
+ 0x59, 0xDC, 0x85, 0x63, 0x40, 0xCB, 0x0B, 0x72, 0x10, 0x5B, 0xD1, 0x85,
+ 0x17, 0x84, 0x93, 0xFD, 0xBD, 0x97, 0x57, 0xEF, 0xB1, 0x77, 0x98, 0x9C,
+ 0xE6, 0x86, 0xD5, 0x49, 0x99, 0x92, 0xC5, 0x81, 0x4D, 0x44, 0xD3, 0xB5,
+ 0x06, 0x56, 0x54, 0x05, 0x18, 0xDC, 0x6D, 0x47, 0x33, 0x93, 0xCD, 0x24,
+ 0x19, 0x0E, 0x92, 0x24, 0x31, 0xF4, 0x06, 0xAF, 0x5B, 0xEA, 0xC4, 0x42,
+ 0x10, 0xE6, 0xCC, 0x35, 0xF3, 0x59, 0x2E, 0x1E, 0x0E, 0x3F, 0xAD, 0x57,
+ 0xCB, 0x8D, 0xA5, 0xF7, 0x99, 0x11, 0xE1, 0x10, 0x16, 0x15, 0x25, 0xAC,
+ 0xCA, 0xBA, 0xD4, 0x1B, 0xA9, 0x9F, 0xAA, 0xC7, 0x45, 0xDB, 0x2B, 0x4D,
+ 0xA8, 0xD8, 0xDE, 0x25, 0x0E, 0x0D, 0x30, 0x5C, 0x8E, 0x41, 0xB9, 0x4B,
+ 0x9E, 0xEE, 0x14, 0x4C, 0x05, 0x8F, 0x67, 0x34, 0xBD, 0x17, 0x9B, 0x4B,
+ 0x2A, 0xAA, 0x0E, 0x56, 0x97, 0x14, 0xC0, 0x84, 0x8F, 0x43, 0xCD, 0xDC,
+ 0x5A, 0x92, 0x9E, 0xC0, 0x77, 0x87, 0x66, 0x3E, 0x97, 0xD8, 0x0B, 0x63,
+ 0x1A, 0x67, 0x5F, 0x1E, 0x4C, 0xC3, 0x99, 0x26, 0x58, 0xDE, 0xC9, 0x2C,
+ 0x80, 0x03, 0x84, 0x59, 0xD4, 0xC8, 0xF7, 0x68, 0x68, 0xC8, 0xD3, 0x85,
+ 0x66, 0x5A, 0x27, 0x47, 0x8F, 0x90, 0xD5, 0x8F, 0x41, 0x12, 0x65, 0xC3,
+ 0x50, 0xAA, 0x3A, 0x7D, 0xF5, 0xE7, 0x33, 0x72, 0x86, 0x9D, 0x72, 0xE8,
+ 0x96, 0x61, 0xB1, 0xA7, 0x35, 0x87, 0xAF, 0x39, 0x17, 0x8D, 0xC1, 0x1D,
+ 0x5D, 0x4D, 0xA0, 0xF0, 0x49, 0xC5, 0x7A, 0x08, 0xBB, 0x3C, 0x16, 0xF0,
+ 0x17, 0x88, 0x26, 0x91, 0xDB, 0xC1, 0x18, 0xB9, 0xDC, 0x26, 0x68, 0x4C,
+ 0xFF, 0x49, 0x79, 0x95, 0x7E, 0x1F, 0x5E, 0xF5, 0x52, 0x46, 0x02, 0xDB,
+ 0xF0, 0xAE, 0xF5, 0x51, 0x8E, 0x3D, 0x4C, 0x3B, 0x08, 0x87, 0x3C, 0x89,
+ 0x2F, 0x30, 0x3A, 0xE0, 0x91, 0x47, 0x9D, 0xB4, 0xA7, 0xAD, 0x77, 0xAF,
+ 0x91, 0xD5, 0x4F, 0x06, 0x03, 0x1C, 0x8F, 0x97, 0xE4, 0xB7, 0xBD, 0x3F,
+ 0x0D, 0xDC, 0x69, 0xDA, 0x25, 0x7A, 0xD3, 0x4B, 0x9B, 0xF0, 0xA5, 0x68,
+ 0xD6, 0x3C, 0x66, 0xD3, 0x73, 0x9E, 0x31, 0xF3, 0x22, 0xB3, 0x11, 0x57,
+ 0x3B, 0x4F, 0x43, 0xCF, 0x3F, 0xEF, 0xCD, 0xBF, 0xC4, 0xB5, 0xD4, 0x04};
+const uint8_t g_deDE_Loacale[] = {
+ 0x78, 0x9C, 0x95, 0x56, 0x4D, 0x6F, 0xD4, 0x30, 0x10, 0xBD, 0x23, 0xF1,
+ 0x1F, 0xAC, 0x88, 0xAA, 0x20, 0xB5, 0x1B, 0x38, 0xB6, 0xDA, 0x46, 0x5A,
+ 0x75, 0xFB, 0x41, 0x4B, 0xCA, 0xAA, 0x69, 0x41, 0xF4, 0x82, 0xBC, 0x89,
+ 0xBB, 0x71, 0x9B, 0xD8, 0x2B, 0xC7, 0x69, 0xB5, 0x39, 0xF2, 0x37, 0xB8,
+ 0x72, 0x04, 0x71, 0xE4, 0x04, 0x17, 0xFE, 0x09, 0x52, 0x25, 0x7E, 0x06,
+ 0x93, 0x8D, 0x93, 0x26, 0xB6, 0xBB, 0x0D, 0xB9, 0xAC, 0xE7, 0xCD, 0x7B,
+ 0xB3, 0x33, 0xCF, 0x89, 0x93, 0x61, 0xC2, 0x43, 0x9C, 0x10, 0xC4, 0x70,
+ 0x4A, 0x76, 0x9C, 0x88, 0x7C, 0x1C, 0xEF, 0x39, 0x28, 0x22, 0x59, 0xB8,
+ 0xE3, 0xDC, 0xFD, 0xFA, 0xF1, 0xF7, 0xFB, 0xB7, 0xE7, 0xF0, 0x73, 0xF7,
+ 0xF9, 0xE7, 0x0B, 0xC7, 0x1B, 0x96, 0x44, 0x16, 0x61, 0x11, 0x2C, 0xD2,
+ 0x29, 0x4F, 0x32, 0xA5, 0x99, 0x09, 0x32, 0xE3, 0x82, 0x62, 0x06, 0x8C,
+ 0x94, 0x33, 0x19, 0x9F, 0x00, 0x9C, 0xA9, 0xB5, 0x77, 0x84, 0x59, 0x8E,
+ 0xC5, 0xD0, 0xAD, 0xA2, 0xA7, 0x4F, 0x14, 0xBC, 0x4F, 0xA6, 0xC2, 0x86,
+ 0xFB, 0xBF, 0xBF, 0x88, 0xC2, 0x40, 0x47, 0x73, 0x41, 0x13, 0x93, 0x8B,
+ 0xA9, 0x81, 0x1D, 0xE5, 0xCC, 0x06, 0x26, 0x26, 0x38, 0xCA, 0x67, 0x79,
+ 0x26, 0x0D, 0x38, 0x20, 0x73, 0x49, 0xD2, 0x29, 0x31, 0x5B, 0x7B, 0x7B,
+ 0x2D, 0xB9, 0x0D, 0x3F, 0xE1, 0x37, 0x76, 0xC1, 0x98, 0x14, 0x7A, 0xC2,
+ 0x6D, 0x19, 0x54, 0xF3, 0x96, 0x11, 0xC2, 0xD3, 0xA9, 0xD8, 0x71, 0x5E,
+ 0x39, 0x2D, 0xDF, 0x6C, 0xA6, 0x99, 0x26, 0xD8, 0xED, 0xEA, 0x6B, 0x96,
+ 0xCD, 0x2B, 0x9B, 0x55, 0x36, 0x9F, 0x6C, 0x0E, 0xD9, 0xDC, 0xB1, 0x19,
+ 0xF3, 0xB0, 0x27, 0x11, 0x5E, 0xA8, 0x1B, 0x08, 0x56, 0x5E, 0xC0, 0x19,
+ 0x93, 0x18, 0xFE, 0xBE, 0x0C, 0xAA, 0xAC, 0xE7, 0x73, 0x03, 0x1A, 0x53,
+ 0xC2, 0x32, 0x83, 0x47, 0xA5, 0xBC, 0xE5, 0x61, 0xDC, 0x65, 0x42, 0x41,
+ 0x22, 0x0C, 0xEE, 0xBE, 0x20, 0x54, 0xC7, 0x02, 0x9C, 0x76, 0x78, 0x6E,
+ 0xD3, 0x5A, 0xAB, 0xCD, 0xD6, 0xC6, 0x55, 0xFD, 0x6A, 0xAD, 0x6A, 0x6D,
+ 0x6A, 0x0D, 0x6A, 0xAD, 0x69, 0x2D, 0x69, 0xDD, 0xD8, 0x1B, 0x49, 0x89,
+ 0xA0, 0x11, 0x25, 0x69, 0xFD, 0xD4, 0xA9, 0xD0, 0x1B, 0xF9, 0xE0, 0x6C,
+ 0x1D, 0xB4, 0x78, 0xDE, 0x44, 0x4B, 0xB8, 0xDD, 0x0A, 0x80, 0x10, 0x81,
+ 0x55, 0x35, 0x58, 0x79, 0x37, 0x03, 0xB4, 0x1B, 0x8B, 0xC1, 0xD0, 0x2D,
+ 0x83, 0x2A, 0xEB, 0x31, 0x0D, 0x73, 0x1B, 0x49, 0x19, 0x68, 0xE7, 0x44,
+ 0x35, 0x81, 0x24, 0x13, 0x2C, 0x25, 0x11, 0x6C, 0xB9, 0xB3, 0x4D, 0xA4,
+ 0x0E, 0x91, 0xCB, 0x3C, 0x49, 0x1C, 0x6F, 0x0F, 0xAE, 0x0D, 0x34, 0x1E,
+ 0x20, 0x1F, 0x2E, 0xF4, 0x01, 0xAE, 0x72, 0xD6, 0x86, 0xAB, 0x15, 0x52,
+ 0xD2, 0x84, 0xB3, 0x99, 0xE3, 0xFD, 0xA7, 0x28, 0x25, 0x11, 0x68, 0xC6,
+ 0x03, 0xDF, 0x1F, 0xF4, 0x54, 0x64, 0x31, 0x17, 0xF2, 0x5E, 0x63, 0x28,
+ 0xDC, 0xCE, 0x88, 0x00, 0x48, 0x9A, 0xB6, 0x46, 0x6E, 0x45, 0x9D, 0x91,
+ 0x0F, 0xB7, 0x7D, 0x7F, 0x1D, 0x9D, 0xC7, 0x02, 0xAD, 0x5F, 0x0C, 0xDD,
+ 0x16, 0x4B, 0x2B, 0xD1, 0x19, 0xF6, 0xB0, 0x54, 0x6D, 0x07, 0x01, 0xEA,
+ 0x23, 0x59, 0x8E, 0x5A, 0x2B, 0x7A, 0xF0, 0xD5, 0xA0, 0x4B, 0x85, 0x41,
+ 0x77, 0x3B, 0x53, 0x29, 0xA3, 0xCE, 0x00, 0xAB, 0xF7, 0xFA, 0xE0, 0xCA,
+ 0x97, 0xD7, 0x87, 0x69, 0x16, 0xEC, 0x8D, 0xF7, 0x6F, 0xDF, 0xE3, 0xF8,
+ 0xB8, 0xB8, 0xA8, 0xAC, 0x69, 0x93, 0x40, 0xC7, 0xF2, 0xF2, 0x68, 0xBC,
+ 0xF7, 0xA7, 0x13, 0xAB, 0x4E, 0x00, 0x83, 0x5B, 0x33, 0x74, 0xBC, 0x62,
+ 0xA3, 0x28, 0xB6, 0x06, 0x45, 0x01, 0xC7, 0x46, 0x87, 0x67, 0x14, 0x52,
+ 0xC2, 0x30, 0x17, 0x82, 0xB0, 0x70, 0x51, 0x2B, 0xB7, 0xB6, 0xD0, 0xB3,
+ 0x9E, 0xD2, 0x39, 0x11, 0x21, 0x61, 0x52, 0x29, 0xD7, 0x2C, 0x2A, 0x57,
+ 0x6B, 0xBD, 0x29, 0x54, 0x4F, 0xD7, 0x09, 0x9B, 0x17, 0x6B, 0x48, 0x53,
+ 0x0C, 0xFB, 0xBD, 0x51, 0xEB, 0xAB, 0xB4, 0xAE, 0x6E, 0xDE, 0xA9, 0x3C,
+ 0x9F, 0xD3, 0x72, 0xAB, 0x07, 0xBD, 0xF8, 0x4D, 0xD7, 0x6B, 0xBD, 0xE8,
+ 0x29, 0x65, 0x79, 0xE6, 0x78, 0x9B, 0xBD, 0xC8, 0x05, 0x11, 0xDC, 0xF1,
+ 0x5E, 0x9A, 0x5C, 0xB7, 0x3B, 0x36, 0x20, 0xB5, 0xEF, 0x8D, 0x13, 0x5D,
+ 0xA0, 0xBE, 0xC1, 0x96, 0x81, 0xE3, 0xFD, 0xF9, 0xF4, 0x15, 0xCE, 0x8A,
+ 0x0E, 0xC3, 0x2C, 0xA2, 0x34, 0x34, 0xE3, 0xE5, 0x02, 0x8E, 0x88, 0xF3,
+ 0xD3, 0xDE, 0xA2, 0xB6, 0xE9, 0xA6, 0xC4, 0xD5, 0xBB, 0x2D, 0x9F, 0x86,
+ 0xC5, 0x9C, 0x5C, 0xE2, 0xB0, 0x3C, 0xFA, 0xEA, 0xA5, 0xAA, 0xE5, 0x2F,
+ 0xE0, 0x13, 0x27, 0x42, 0x13, 0xF0, 0xC2, 0x6D, 0x33, 0xEB, 0x34, 0x65,
+ 0x94, 0xB3, 0x07, 0xD3, 0xBB, 0x3C, 0x17, 0x94, 0x08, 0x14, 0xC8, 0xC8,
+ 0x9A, 0x1F, 0x45, 0xF0, 0x69, 0x81, 0x26, 0xF4, 0x11, 0xC2, 0x21, 0x7C,
+ 0x35, 0x91, 0xDB, 0x15, 0x84, 0x91, 0xC0, 0x53, 0x78, 0x60, 0x1E, 0x26,
+ 0x9C, 0xC5, 0x98, 0x5A, 0xD3, 0xC7, 0xBC, 0xC8, 0xAF, 0x31, 0x3A, 0xE0,
+ 0x32, 0xA6, 0x61, 0x39, 0xC7, 0xE6, 0xBB, 0xD7, 0xC8, 0x5F, 0x45, 0x85,
+ 0x91, 0xC3, 0x98, 0xD7, 0xD4, 0xD3, 0x15, 0x7F, 0x0A, 0xCC, 0x59, 0x39,
+ 0x19, 0x7A, 0xB3, 0x82, 0x04, 0x6F, 0xFA, 0xC7, 0x49, 0xFE, 0x22, 0x67,
+ 0xB3, 0x2B, 0xBE, 0xE4, 0xA9, 0xE6, 0xDC, 0xFB, 0x3D, 0x2B, 0xA3, 0xEA,
+ 0x73, 0x16, 0x96, 0xFF, 0x00, 0x29, 0x27, 0xAF, 0x17,
+};
+const uint8_t g_frFR_Locale[] = {
+ 0x78, 0x9C, 0x95, 0x56, 0x4D, 0x6F, 0xD3, 0x40, 0x10, 0xBD, 0x23, 0xF1,
+ 0x1F, 0x56, 0x16, 0x55, 0x41, 0x6A, 0xBD, 0x70, 0x4C, 0x95, 0x5A, 0xAA,
+ 0xFA, 0x15, 0x28, 0x46, 0x51, 0x53, 0x40, 0xF4, 0x82, 0x36, 0xF6, 0x36,
+ 0xDE, 0xD4, 0xDE, 0x8D, 0xD6, 0x76, 0x4A, 0x7C, 0xE4, 0x3F, 0x70, 0xE2,
+ 0xC2, 0xB5, 0x12, 0x88, 0x03, 0x47, 0xC4, 0x85, 0xFE, 0x13, 0x24, 0x10,
+ 0x3F, 0x83, 0x71, 0xBC, 0x76, 0xED, 0x5D, 0x27, 0xB8, 0xBE, 0x64, 0xE7,
+ 0xCD, 0x7B, 0xE3, 0x99, 0xB7, 0xF6, 0xC6, 0xFD, 0x50, 0x78, 0x24, 0xA4,
+ 0x88, 0x93, 0x88, 0xEE, 0x5A, 0x17, 0xF2, 0xED, 0xD1, 0xA9, 0x85, 0x7C,
+ 0x1A, 0x7B, 0xBB, 0xD6, 0x9F, 0x6F, 0x1F, 0xFE, 0x7E, 0xFD, 0xF2, 0x10,
+ 0x7E, 0x7E, 0x7F, 0xFC, 0xF1, 0xC8, 0x72, 0xFA, 0x39, 0x91, 0xFB, 0x44,
+ 0x8E, 0x16, 0xD1, 0x58, 0x84, 0xB1, 0xD2, 0x4C, 0x24, 0x9D, 0x08, 0xC9,
+ 0x08, 0x07, 0x46, 0x24, 0x78, 0x12, 0xBC, 0x00, 0x38, 0x56, 0x6B, 0x67,
+ 0x4A, 0xF8, 0x9C, 0x51, 0xD9, 0xC7, 0x45, 0x78, 0xFF, 0x9E, 0xC2, 0x2F,
+ 0x6E, 0xAE, 0xE7, 0xB2, 0x2D, 0x11, 0x11, 0x19, 0x1B, 0x20, 0x01, 0x6E,
+ 0xD8, 0x42, 0x65, 0x06, 0x36, 0x4D, 0x19, 0x6F, 0x03, 0xC3, 0x90, 0x26,
+ 0x66, 0x59, 0x71, 0xF3, 0xDD, 0x44, 0x63, 0x3A, 0x4B, 0x68, 0x34, 0x96,
+ 0xD4, 0xC8, 0x08, 0x2F, 0x11, 0x6D, 0x38, 0x17, 0xF3, 0x76, 0x81, 0x7F,
+ 0x73, 0xED, 0xE9, 0x19, 0x5C, 0x33, 0xA9, 0x24, 0x2E, 0x23, 0x44, 0xC6,
+ 0x63, 0xB9, 0x6B, 0x3D, 0xB1, 0xEA, 0xDE, 0xD9, 0xED, 0xCE, 0x99, 0xF0,
+ 0x2A, 0xDF, 0xDA, 0x98, 0x77, 0xB0, 0xCD, 0x94, 0xAF, 0x36, 0xCD, 0xE4,
+ 0x82, 0x61, 0x26, 0x08, 0x6E, 0x99, 0x60, 0xEE, 0x94, 0xBD, 0xDA, 0x25,
+ 0x9F, 0x2C, 0xD4, 0x63, 0x05, 0x2B, 0xC7, 0x67, 0x11, 0xE1, 0x5E, 0x00,
+ 0xAE, 0xE6, 0x51, 0x91, 0x76, 0xC2, 0x94, 0xFB, 0xAC, 0x81, 0x80, 0x25,
+ 0x3A, 0x42, 0xA5, 0x27, 0xA9, 0x06, 0x4E, 0x69, 0xAA, 0x21, 0x73, 0x78,
+ 0xCC, 0x0D, 0x5A, 0x0C, 0xF7, 0xAF, 0x41, 0xB8, 0x6A, 0xA9, 0xD6, 0x5E,
+ 0x6D, 0x0B, 0x55, 0x9F, 0xB6, 0xDE, 0xA3, 0xAD, 0xB7, 0x68, 0xEB, 0x1D,
+ 0xDA, 0x7A, 0x77, 0xB6, 0xDE, 0x9C, 0xAD, 0x37, 0x66, 0xB7, 0xB7, 0x05,
+ 0xC5, 0x98, 0xCF, 0x68, 0x54, 0xBE, 0x91, 0x2A, 0x74, 0xF6, 0x5C, 0xF0,
+ 0xB7, 0x0C, 0x6A, 0x3C, 0x67, 0xA8, 0x25, 0x70, 0xB3, 0x02, 0x20, 0x54,
+ 0x12, 0x55, 0x0D, 0x56, 0xF0, 0x7C, 0xD9, 0xE8, 0x99, 0xBD, 0xBD, 0x0F,
+ 0xF7, 0xCF, 0xC3, 0x22, 0xEF, 0x90, 0x99, 0x8E, 0xE2, 0x4A, 0x96, 0x07,
+ 0xDA, 0x39, 0x52, 0xCC, 0x91, 0xD0, 0x21, 0x49, 0x12, 0x2A, 0xF9, 0x72,
+ 0x8F, 0xAB, 0xA8, 0x3C, 0x98, 0xD2, 0x30, 0xB4, 0x9C, 0x43, 0xB8, 0xD0,
+ 0x01, 0x72, 0xE1, 0x42, 0x6F, 0xE0, 0xCA, 0xA7, 0xAD, 0x98, 0x5A, 0x19,
+ 0x25, 0x0C, 0x05, 0x9F, 0x58, 0xCE, 0xDD, 0x34, 0xB0, 0xCF, 0x4A, 0x82,
+ 0x3A, 0xF1, 0xE3, 0x40, 0xC8, 0x04, 0x14, 0x07, 0xD8, 0x75, 0x71, 0x8B,
+ 0x02, 0x37, 0xA6, 0x03, 0x20, 0x61, 0x51, 0x6D, 0xDA, 0x5A, 0xD4, 0x98,
+ 0x76, 0x30, 0xD8, 0x44, 0x01, 0xDA, 0x84, 0x2E, 0xCE, 0xFB, 0xB8, 0x46,
+ 0xD2, 0x2A, 0x34, 0x06, 0x1D, 0x0C, 0x76, 0x5C, 0x77, 0x67, 0x34, 0xEA,
+ 0x24, 0x59, 0xCE, 0x59, 0x2A, 0x3A, 0xF0, 0xD5, 0x9C, 0x4B, 0x85, 0x41,
+ 0xC7, 0x8D, 0xA1, 0x94, 0x4F, 0x67, 0x80, 0x95, 0xBB, 0x7C, 0x4C, 0xDC,
+ 0xE9, 0xE5, 0x20, 0x8A, 0x47, 0x87, 0x07, 0x47, 0x57, 0xAF, 0xDF, 0x05,
+ 0x27, 0xD9, 0x79, 0xE1, 0x4C, 0x9D, 0x04, 0x3A, 0x9E, 0x46, 0x63, 0x2A,
+ 0x6F, 0xED, 0x69, 0xC4, 0xAA, 0x13, 0xC0, 0xE0, 0xC1, 0xF4, 0x2C, 0x27,
+ 0xDB, 0xCA, 0xB2, 0x9E, 0x9D, 0x65, 0x59, 0x1F, 0x37, 0x78, 0x46, 0x21,
+ 0x25, 0xF4, 0x52, 0x29, 0x29, 0xF7, 0x16, 0xA5, 0xB2, 0xD7, 0x43, 0x0F,
+ 0x3A, 0x4A, 0x67, 0x70, 0x76, 0x50, 0x9E, 0x28, 0xE5, 0x46, 0x8B, 0x0A,
+ 0x6B, 0xAD, 0x57, 0x85, 0xCA, 0xE9, 0x1A, 0xA1, 0x2A, 0xEB, 0x53, 0x0F,
+ 0x4E, 0x33, 0xD8, 0xEE, 0xAD, 0x52, 0x5F, 0xA4, 0x75, 0x75, 0xF5, 0x6F,
+ 0x2B, 0xD2, 0x19, 0xCB, 0xB7, 0xFA, 0xE7, 0xA7, 0x4E, 0x82, 0xAA, 0xED,
+ 0x8D, 0x4E, 0xF4, 0x88, 0xF1, 0x34, 0xB6, 0x9C, 0xED, 0x4E, 0xE4, 0x8C,
+ 0x4A, 0x61, 0x39, 0x8F, 0x4D, 0x2E, 0x6E, 0xCE, 0x0D, 0x48, 0x69, 0x7C,
+ 0x65, 0x45, 0x13, 0x28, 0x9F, 0xB0, 0x65, 0x60, 0x39, 0xBF, 0xDE, 0x7F,
+ 0x86, 0x63, 0xA2, 0xC1, 0x30, 0x8B, 0x28, 0x0D, 0x8B, 0x45, 0xBE, 0x80,
+ 0xD3, 0xE1, 0xE5, 0x69, 0x67, 0x51, 0xDD, 0x75, 0x53, 0x82, 0xF5, 0x6E,
+ 0xF3, 0xD7, 0x61, 0x31, 0xA3, 0x17, 0xC4, 0xCB, 0x4F, 0xBE, 0x72, 0xA9,
+ 0x6A, 0xB9, 0x0B, 0xF8, 0xFA, 0xF1, 0xD1, 0x10, 0xBC, 0xC0, 0x75, 0x66,
+ 0x99, 0x66, 0x9C, 0x09, 0xBE, 0x32, 0xBD, 0x2F, 0xD2, 0xFC, 0x3B, 0x08,
+ 0x8D, 0x12, 0xBF, 0x35, 0xBF, 0xE7, 0x8B, 0x31, 0x45, 0x43, 0xF6, 0x1F,
+ 0xC2, 0x80, 0xC2, 0x57, 0xC6, 0xD5, 0x1A, 0xC2, 0x9E, 0x24, 0x63, 0x78,
+ 0x63, 0x56, 0x13, 0xCE, 0x02, 0xC2, 0x5A, 0xD3, 0x27, 0x22, 0x4B, 0x2F,
+ 0x09, 0x3A, 0x16, 0x49, 0xC0, 0xBC, 0x7C, 0x8E, 0xED, 0x57, 0x4F, 0x91,
+ 0xBB, 0x8E, 0x0A, 0x23, 0x7B, 0x81, 0x28, 0xA9, 0xA7, 0x6B, 0x6E, 0x0A,
+ 0xCC, 0x49, 0x3E, 0x19, 0x7A, 0xBE, 0x86, 0x34, 0x12, 0x1D, 0x48, 0xEE,
+ 0x22, 0xE5, 0x93, 0xA9, 0x58, 0xF2, 0x54, 0x73, 0xF8, 0x76, 0xCF, 0xF2,
+ 0xA8, 0xF8, 0xD2, 0x85, 0xE5, 0x3F, 0x5D, 0x49, 0xBE, 0x1B};
+const uint8_t g_itIT_Locale[] = {
+ 0x78, 0x9C, 0x95, 0x56, 0xD1, 0x6A, 0xD4, 0x40, 0x14, 0x7D, 0x17, 0xFC,
+ 0x87, 0x21, 0x58, 0x50, 0x68, 0x3B, 0xFA, 0xD8, 0x92, 0x06, 0x4A, 0x5B,
+ 0xBB, 0xA5, 0x46, 0x96, 0xEE, 0xAA, 0xD8, 0x17, 0x99, 0x64, 0xA6, 0xD9,
+ 0xB1, 0xC9, 0xCC, 0x32, 0x49, 0x5A, 0x92, 0x47, 0xF1, 0xC1, 0x37, 0x7F,
+ 0x42, 0x10, 0x41, 0xF1, 0x23, 0xFC, 0x13, 0xA1, 0xE2, 0x67, 0x78, 0xB3,
+ 0x99, 0xA4, 0xC9, 0x64, 0xBA, 0xA6, 0x79, 0xD9, 0xB9, 0xE7, 0x9E, 0x73,
+ 0x73, 0xEF, 0x99, 0x64, 0x36, 0x6E, 0x2C, 0x43, 0x12, 0x33, 0x24, 0x48,
+ 0xC2, 0xF6, 0x1C, 0x9E, 0xBD, 0x3B, 0x99, 0x3B, 0x88, 0xB2, 0x34, 0xDC,
+ 0x73, 0xFE, 0x7C, 0xFC, 0x7C, 0xF3, 0xE5, 0xEB, 0xCD, 0xA7, 0x6F, 0x7F,
+ 0x7F, 0xFE, 0x78, 0xDC, 0x06, 0x4F, 0x1C, 0xCF, 0xAD, 0x14, 0x82, 0x12,
+ 0x35, 0x2B, 0x92, 0x40, 0xC6, 0xA9, 0x16, 0x47, 0x8A, 0x45, 0x52, 0x71,
+ 0x22, 0x80, 0x91, 0x48, 0x91, 0x2D, 0x5E, 0x02, 0x9C, 0xEA, 0xB5, 0x17,
+ 0x31, 0x21, 0x08, 0x97, 0x2E, 0xAE, 0xC3, 0x87, 0x0F, 0x34, 0x7E, 0xC1,
+ 0x82, 0x40, 0xD9, 0x12, 0x09, 0x51, 0xE5, 0x10, 0x25, 0x4B, 0xC5, 0x63,
+ 0x66, 0x21, 0x47, 0x91, 0xA5, 0x46, 0xC4, 0xF3, 0x48, 0x0C, 0xE1, 0x38,
+ 0x8F, 0x62, 0x0B, 0x9B, 0x44, 0x32, 0xCD, 0x86, 0x70, 0xCA, 0xB2, 0x8C,
+ 0x25, 0x81, 0x1A, 0xDE, 0x55, 0x66, 0x99, 0xB4, 0xE1, 0x42, 0x5E, 0xD9,
+ 0x05, 0x94, 0x87, 0x66, 0x02, 0x77, 0xAC, 0x6A, 0x78, 0xAB, 0x08, 0x11,
+ 0x30, 0x66, 0xCF, 0x79, 0xE6, 0x74, 0x1C, 0xB4, 0xB9, 0x67, 0x33, 0xCE,
+ 0x66, 0x9B, 0xCD, 0x33, 0x9B, 0x61, 0x36, 0xB7, 0x6C, 0x56, 0xD9, 0x7C,
+ 0xB2, 0x39, 0x64, 0x73, 0xC7, 0x66, 0xCC, 0xDD, 0x9E, 0x50, 0x52, 0xE8,
+ 0x47, 0x09, 0x56, 0x1E, 0x95, 0x09, 0x13, 0x3C, 0x24, 0x2E, 0xAE, 0xA2,
+ 0x3A, 0x0D, 0x3D, 0x0A, 0x46, 0x7F, 0x7D, 0xEF, 0x61, 0xE0, 0x43, 0x36,
+ 0x04, 0x99, 0x0A, 0x65, 0x3C, 0x80, 0xE1, 0xE1, 0xB9, 0x1A, 0x80, 0x57,
+ 0x4C, 0x30, 0x65, 0x82, 0x29, 0x09, 0x48, 0xF5, 0x90, 0x68, 0x08, 0xB7,
+ 0xCD, 0x75, 0x1A, 0xED, 0x6C, 0x9D, 0xEE, 0xD8, 0x6C, 0xD6, 0x6C, 0xD4,
+ 0xEC, 0xD1, 0x6C, 0xCE, 0xEC, 0xCB, 0x6C, 0xC9, 0xDE, 0x0F, 0x14, 0xE2,
+ 0x94, 0xB3, 0xA4, 0x79, 0x11, 0x75, 0xE8, 0xED, 0xFB, 0x60, 0x71, 0x13,
+ 0x74, 0x78, 0xDE, 0xD4, 0x48, 0xE0, 0x7E, 0x05, 0x40, 0x98, 0x22, 0xBA,
+ 0x1A, 0xAC, 0x3C, 0x72, 0xE0, 0xE2, 0xEA, 0xB7, 0x4E, 0x78, 0xF4, 0x36,
+ 0xC4, 0x2D, 0xB1, 0x0A, 0x8C, 0x03, 0xA3, 0x6E, 0x3C, 0x63, 0x53, 0x02,
+ 0x6F, 0x96, 0x12, 0xAB, 0x8D, 0x6D, 0x23, 0x7D, 0x9A, 0x5C, 0xE4, 0x71,
+ 0xEC, 0x78, 0x47, 0x70, 0xA1, 0x43, 0xE4, 0xC3, 0x85, 0xDE, 0xC2, 0x55,
+ 0xCD, 0xD7, 0x32, 0x8D, 0x32, 0x5A, 0x18, 0x4B, 0x11, 0x39, 0xDE, 0xE1,
+ 0xFD, 0x44, 0x09, 0xA3, 0x95, 0x06, 0x83, 0x04, 0x8F, 0x12, 0xA4, 0x0B,
+ 0xA9, 0x32, 0x2D, 0xB1, 0x29, 0x70, 0x6F, 0x3E, 0x00, 0x32, 0x9E, 0x74,
+ 0xE6, 0xED, 0x44, 0xBD, 0x79, 0x27, 0x93, 0x5D, 0xDF, 0xDF, 0x9D, 0xCD,
+ 0xD0, 0xB9, 0x8B, 0x3B, 0x1C, 0xA3, 0x40, 0x6F, 0xD2, 0xFB, 0x28, 0x56,
+ 0x63, 0x36, 0xF7, 0x18, 0xC1, 0xD7, 0x53, 0xAE, 0x14, 0x03, 0x3A, 0xEE,
+ 0x8D, 0xA4, 0x5D, 0x9A, 0x03, 0xD6, 0xEC, 0xF2, 0x71, 0xE1, 0xD3, 0xCB,
+ 0x49, 0x92, 0xCE, 0x8E, 0x0E, 0x9F, 0x5F, 0xBF, 0x21, 0x8B, 0xD3, 0xF2,
+ 0xBC, 0xF6, 0xA5, 0x4B, 0x02, 0x9D, 0xC8, 0x93, 0x80, 0xA9, 0x5B, 0x73,
+ 0x7A, 0xB1, 0xEE, 0x04, 0x30, 0x78, 0x14, 0x43, 0xC7, 0x2B, 0x37, 0xCB,
+ 0x72, 0x67, 0xBB, 0x2C, 0x4B, 0x17, 0xF7, 0x78, 0x83, 0x42, 0x5A, 0x18,
+ 0xE6, 0x4A, 0x31, 0x11, 0x16, 0x8E, 0xF7, 0x08, 0xD5, 0xDA, 0x9D, 0x9D,
+ 0x91, 0xD2, 0x25, 0x9C, 0x15, 0x4C, 0x64, 0xFA, 0x9E, 0x1B, 0x16, 0x15,
+ 0x36, 0x5A, 0x6F, 0x0B, 0x35, 0xD3, 0xF5, 0x42, 0x5D, 0x96, 0xB2, 0x90,
+ 0x27, 0x04, 0x36, 0x7B, 0xB3, 0xD1, 0xD7, 0x69, 0x53, 0xDD, 0xFE, 0xAD,
+ 0xCA, 0x7C, 0xC9, 0xAB, 0x9D, 0xDE, 0x1E, 0xC5, 0x6F, 0xBB, 0xDE, 0x18,
+ 0x45, 0x4F, 0xB8, 0xC8, 0x53, 0xC7, 0xDB, 0x1A, 0x45, 0x2E, 0x99, 0x92,
+ 0x8E, 0xF7, 0x74, 0xC8, 0xC5, 0xFD, 0xB1, 0x01, 0x69, 0x7C, 0x6F, 0x9D,
+ 0xE8, 0x03, 0xCD, 0x03, 0xB6, 0x0A, 0x1C, 0xEF, 0xF7, 0x07, 0x38, 0x65,
+ 0xFB, 0x8C, 0x61, 0x91, 0xE6, 0x23, 0x25, 0x95, 0xD5, 0x02, 0x0E, 0x87,
+ 0x57, 0x67, 0xA3, 0x45, 0x5D, 0xD3, 0x87, 0x12, 0x6C, 0x76, 0x5B, 0xBD,
+ 0x0D, 0xC5, 0x92, 0x5D, 0x90, 0xB0, 0x3A, 0xEA, 0x9A, 0xA5, 0xAE, 0xE5,
+ 0x17, 0xF0, 0x95, 0x43, 0xD1, 0x14, 0xBC, 0xC0, 0x5D, 0x66, 0x93, 0xE6,
+ 0x82, 0x4B, 0x71, 0x67, 0xFA, 0x40, 0xE6, 0x8A, 0x33, 0x85, 0x66, 0x19,
+ 0xB5, 0xE6, 0xF7, 0xA9, 0x0C, 0x18, 0x9A, 0xF2, 0xFF, 0x10, 0x26, 0x0C,
+ 0xBE, 0x23, 0xAE, 0xD7, 0x10, 0xF6, 0x15, 0x09, 0xE0, 0x85, 0xB9, 0x9B,
+ 0x30, 0x5F, 0x10, 0x6E, 0x4D, 0x9F, 0xCA, 0x32, 0xBF, 0x24, 0xE8, 0x58,
+ 0x66, 0x0B, 0x1E, 0x56, 0x73, 0x6C, 0xBD, 0x3E, 0x41, 0xFE, 0x3A, 0x2A,
+ 0x8C, 0x1C, 0x2E, 0x64, 0x43, 0x3D, 0x5B, 0x73, 0x53, 0x60, 0x46, 0xD5,
+ 0x64, 0xE8, 0xC5, 0x1A, 0xD2, 0x4C, 0x8E, 0x20, 0xF9, 0x45, 0x2E, 0xA2,
+ 0xF7, 0x72, 0xC5, 0xD3, 0xCD, 0xE1, 0xDB, 0x3D, 0xAB, 0xA2, 0xFA, 0xD3,
+ 0x16, 0x96, 0xFF, 0x00, 0x20, 0x8B, 0xBE, 0xF7};
+const uint8_t g_ptBR_Locale[] = {
+ 0x78, 0x9C, 0x9D, 0x56, 0x3D, 0x6F, 0xD4, 0x40, 0x10, 0xAD, 0x83, 0xC4,
+ 0x7F, 0x58, 0x59, 0x89, 0x0E, 0xA4, 0x24, 0x86, 0x92, 0xC8, 0x67, 0xE9,
+ 0x92, 0x0B, 0x39, 0x94, 0x18, 0x9D, 0xCE, 0x11, 0x88, 0x34, 0x68, 0x6D,
+ 0xEF, 0xD9, 0x9B, 0xD8, 0xBB, 0xC7, 0xDA, 0x4E, 0xB0, 0x6B, 0x1A, 0x3A,
+ 0x28, 0x29, 0x53, 0x20, 0x2A, 0x44, 0x83, 0x44, 0x49, 0x91, 0xDF, 0x82,
+ 0xB8, 0x9F, 0xC1, 0xFA, 0xF3, 0xFC, 0xB1, 0x36, 0x06, 0x37, 0xDE, 0x99,
+ 0x79, 0x6F, 0x3D, 0xF3, 0x76, 0x76, 0x64, 0xC5, 0xA5, 0x26, 0x74, 0x11,
+ 0x20, 0xD0, 0x43, 0x63, 0x69, 0x15, 0xBC, 0x3E, 0x5C, 0x48, 0xC0, 0x42,
+ 0xBE, 0x39, 0x96, 0xD6, 0x1F, 0x6F, 0xD7, 0x1F, 0xDE, 0xFD, 0x7E, 0xFF,
+ 0x69, 0xFD, 0xED, 0xEB, 0x83, 0x5F, 0x3F, 0xBE, 0xAF, 0x3F, 0xFF, 0x7C,
+ 0x28, 0xA9, 0xF7, 0xEF, 0x01, 0xA0, 0x24, 0x14, 0x62, 0x41, 0xA6, 0x47,
+ 0x9E, 0x41, 0x5D, 0x3F, 0x67, 0xDB, 0x0C, 0xD9, 0x94, 0x61, 0x48, 0x12,
+ 0xD4, 0x16, 0x50, 0x3C, 0x4A, 0x02, 0xE7, 0x39, 0x0F, 0xF9, 0x89, 0xBD,
+ 0x95, 0xD9, 0xEA, 0x25, 0x24, 0x08, 0x33, 0xAA, 0xC8, 0x99, 0x59, 0x89,
+ 0x2C, 0xD1, 0x35, 0x62, 0x1D, 0x31, 0x0F, 0xB2, 0xBB, 0x2F, 0xA2, 0x00,
+ 0x34, 0x18, 0x76, 0x85, 0x04, 0x2C, 0x82, 0x5F, 0x86, 0xC4, 0x11, 0xFB,
+ 0x5D, 0xA1, 0x1F, 0xDA, 0xD4, 0x0F, 0x44, 0x01, 0x1F, 0x05, 0xC8, 0x33,
+ 0x84, 0xB9, 0xD2, 0x30, 0x08, 0xC5, 0x11, 0x42, 0xAF, 0xBB, 0x48, 0x16,
+ 0x8A, 0x9B, 0x21, 0x90, 0xAF, 0x4B, 0x09, 0xAB, 0x92, 0x02, 0x68, 0x18,
+ 0x6C, 0x2C, 0x3D, 0x96, 0x1A, 0xDA, 0x8A, 0x75, 0x15, 0x2B, 0x2A, 0x96,
+ 0x53, 0x2C, 0xA6, 0x58, 0x4B, 0xB1, 0x92, 0x62, 0x1D, 0xC5, 0x22, 0x8A,
+ 0xF5, 0x13, 0x6B, 0x27, 0x96, 0xAD, 0x5F, 0x31, 0x0B, 0x46, 0x95, 0x16,
+ 0xE4, 0x96, 0x6A, 0x51, 0x0F, 0x93, 0x24, 0x9D, 0xC4, 0x28, 0xBD, 0x3E,
+ 0xB2, 0x43, 0xDE, 0xD2, 0x7B, 0x4B, 0xDE, 0x80, 0xB0, 0x11, 0x0B, 0x10,
+ 0x6F, 0x3E, 0x71, 0xE8, 0x4D, 0x08, 0x59, 0xD0, 0x15, 0xC2, 0xA4, 0x23,
+ 0xE4, 0xA3, 0xB7, 0x5D, 0x91, 0xBB, 0x5B, 0x03, 0x5A, 0x9B, 0xE4, 0x40,
+ 0xBA, 0x12, 0xD4, 0xD3, 0x38, 0xFF, 0xBC, 0xB0, 0x76, 0x51, 0xED, 0x52,
+ 0xDA, 0x15, 0xB4, 0x13, 0x6F, 0xE7, 0x2B, 0xC8, 0xB3, 0x3B, 0x49, 0x0F,
+ 0x31, 0x6C, 0x61, 0xE4, 0x55, 0x2F, 0x7F, 0xEE, 0x52, 0x27, 0x1A, 0x3F,
+ 0xA4, 0xC2, 0xA8, 0x87, 0xE6, 0x8D, 0x10, 0xD8, 0x98, 0x95, 0xCD, 0x11,
+ 0x83, 0x95, 0x7D, 0xB9, 0xA5, 0x1E, 0x1E, 0x29, 0x72, 0xF2, 0x2E, 0x1D,
+ 0x93, 0x69, 0xE9, 0x00, 0xE9, 0xAA, 0x20, 0xF0, 0xD9, 0x25, 0x37, 0x86,
+ 0x57, 0xE6, 0xB5, 0x60, 0x80, 0xE6, 0x30, 0xE0, 0xF2, 0x90, 0x52, 0xE8,
+ 0xD2, 0x93, 0xCF, 0xB7, 0x65, 0xE8, 0xBA, 0x92, 0x7A, 0xCC, 0x9F, 0x5D,
+ 0x30, 0x1D, 0xF1, 0x29, 0x09, 0x46, 0x1A, 0x7F, 0xB2, 0xD5, 0x2B, 0xFE,
+ 0x24, 0x32, 0x94, 0xA4, 0xAE, 0x5D, 0x5C, 0x4A, 0x6C, 0x49, 0xFD, 0x7F,
+ 0xBE, 0x87, 0x2C, 0x4E, 0x9F, 0xCA, 0x9A, 0x26, 0x0F, 0xE6, 0xF8, 0x0E,
+ 0x65, 0xC1, 0x86, 0xD5, 0xE4, 0x00, 0x50, 0xF3, 0xE4, 0x92, 0x04, 0xD8,
+ 0x6B, 0x48, 0x52, 0xF1, 0xD4, 0x24, 0x99, 0xCD, 0x46, 0x0E, 0x2F, 0x65,
+ 0xC4, 0xEF, 0xD5, 0x48, 0xD7, 0x47, 0xFE, 0x08, 0x5C, 0x28, 0x72, 0x05,
+ 0xDC, 0xC5, 0xCE, 0xA4, 0x48, 0xC9, 0x19, 0x77, 0x38, 0x35, 0x55, 0x61,
+ 0x36, 0x3B, 0xD0, 0xB4, 0x03, 0x5D, 0x1F, 0xC4, 0xC8, 0x35, 0x48, 0x39,
+ 0x4D, 0x42, 0x22, 0x40, 0xA3, 0xDC, 0xBC, 0x27, 0xCE, 0xB9, 0xB7, 0x68,
+ 0x94, 0x93, 0x48, 0xB3, 0xAE, 0x66, 0x9E, 0xAF, 0x1F, 0x4F, 0x9F, 0xDE,
+ 0xBC, 0x84, 0xCE, 0x69, 0x7C, 0x91, 0xE9, 0x56, 0x05, 0xA5, 0x4C, 0x12,
+ 0x7A, 0x06, 0x62, 0x75, 0xF1, 0x6A, 0xBE, 0x3C, 0x27, 0xEE, 0xE3, 0xFD,
+ 0x6D, 0x4A, 0x6A, 0xBC, 0x1B, 0xC7, 0x4F, 0xF6, 0xE3, 0x98, 0x0F, 0xB3,
+ 0x1A, 0xAE, 0x9B, 0x6A, 0x86, 0x8C, 0x21, 0x62, 0x46, 0x92, 0xBA, 0x0D,
+ 0x0A, 0xF6, 0x60, 0xF2, 0x0A, 0x31, 0x13, 0x91, 0x20, 0xFF, 0xEE, 0x4E,
+ 0x9B, 0x97, 0x08, 0xD2, 0x2A, 0xA2, 0x2C, 0x6C, 0x53, 0xEB, 0x56, 0xDD,
+ 0x95, 0x6F, 0x6F, 0x21, 0x13, 0x7B, 0x90, 0x37, 0xC6, 0x6E, 0xB1, 0x4B,
+ 0x16, 0xEE, 0x24, 0xD8, 0x8C, 0x86, 0x2B, 0x9C, 0x34, 0xC3, 0xFE, 0x40,
+ 0x46, 0x59, 0xC1, 0xCE, 0x40, 0x02, 0xEF, 0xAF, 0xD0, 0x97, 0xD4, 0xBD,
+ 0x81, 0xF0, 0x18, 0x31, 0x2A, 0xA9, 0x8F, 0x5A, 0xE8, 0x8D, 0x30, 0xB5,
+ 0x03, 0x2F, 0x4E, 0xA3, 0xA6, 0x4C, 0xDD, 0x59, 0xB4, 0x61, 0x6A, 0x48,
+ 0xEA, 0x62, 0x9B, 0x4F, 0xA2, 0x1A, 0xA0, 0x87, 0x84, 0x7D, 0x9A, 0x2C,
+ 0x24, 0xF5, 0x70, 0x71, 0xF6, 0x0F, 0xB4, 0xEA, 0x39, 0xB4, 0x48, 0xE9,
+ 0x28, 0x6C, 0xA5, 0x9D, 0xDC, 0xFB, 0x68, 0x85, 0x96, 0xD0, 0x2C, 0xC6,
+ 0x6D, 0x61, 0xE6, 0x7B, 0x6A, 0x11, 0xFF, 0xC3, 0xB3, 0xC0, 0x9C, 0xCB,
+ 0x23, 0x8B, 0x01, 0x98, 0x60, 0x4A, 0x7A, 0x00, 0x47, 0x34, 0x64, 0x18,
+ 0x31, 0xA0, 0x07, 0x56, 0x07, 0x62, 0x62, 0x51, 0x03, 0x81, 0x39, 0xFE,
+ 0x2B, 0x64, 0x86, 0x0C, 0x86, 0x6E, 0x7A, 0x21, 0x13, 0x06, 0x0D, 0x7E,
+ 0xC3, 0xFA, 0x20, 0xE7, 0x0E, 0xC4, 0x1D, 0x80, 0x53, 0x1A, 0x87, 0x57,
+ 0x10, 0x9C, 0xD0, 0xC0, 0xC1, 0x66, 0x52, 0xD3, 0xDE, 0x8B, 0x67, 0x40,
+ 0xEB, 0x07, 0x73, 0x01, 0x4C, 0x87, 0x16, 0xE0, 0x45, 0xEF, 0xA7, 0x39,
+ 0xD6, 0x4E, 0xAA, 0x04, 0x67, 0xBD, 0x30, 0x9D, 0x0E, 0x82, 0x69, 0x51,
+ 0x48, 0xEC, 0x4B, 0x9A, 0x22, 0xB3, 0x24, 0xD3, 0xC1, 0x56, 0x39, 0x4F,
+ 0x45, 0xCE, 0xFE, 0xF7, 0xD5, 0x3F, 0x30, 0xBB, 0xD9, 0x9B};
+const uint8_t g_nlNL_Locale[] = {
+ 0x78, 0x9C, 0x95, 0x56, 0x4D, 0x4F, 0xDC, 0x30, 0x10, 0x3D, 0x53, 0xA9,
+ 0xFF, 0xC1, 0x8A, 0x8A, 0x68, 0x25, 0x96, 0x2D, 0x47, 0x50, 0x88, 0xB4,
+ 0x05, 0x0A, 0x15, 0x04, 0xAD, 0x58, 0xDA, 0xAA, 0x5C, 0x2A, 0x6F, 0x62,
+ 0x76, 0xBD, 0x24, 0xF6, 0xCA, 0x89, 0x41, 0xC9, 0xB1, 0x52, 0x8F, 0xFD,
+ 0x27, 0xAD, 0xDA, 0x5B, 0xFF, 0x4F, 0xA5, 0x4A, 0xFC, 0x8C, 0x8E, 0xF3,
+ 0x45, 0x12, 0x3B, 0x69, 0xC8, 0x05, 0xCF, 0x9B, 0xF7, 0xBC, 0x33, 0xCF,
+ 0xCE, 0x10, 0x3B, 0xE0, 0x1E, 0x0E, 0x08, 0x62, 0x38, 0x24, 0x07, 0x16,
+ 0x0B, 0x3E, 0x5F, 0x9C, 0x5B, 0xC8, 0x27, 0x91, 0x77, 0x60, 0x3D, 0x7C,
+ 0xFB, 0xFD, 0xF7, 0xEB, 0xAF, 0x87, 0x9F, 0x3F, 0x5E, 0xE6, 0xAB, 0x57,
+ 0x96, 0xF3, 0xFC, 0x19, 0x42, 0xB6, 0xE2, 0x33, 0x1F, 0x8B, 0x59, 0x12,
+ 0xCE, 0x79, 0x10, 0x15, 0xD2, 0x85, 0x20, 0x0B, 0x2E, 0x28, 0x66, 0x8A,
+ 0xB5, 0x81, 0xEC, 0x90, 0xB3, 0x78, 0x79, 0x01, 0xA9, 0x48, 0xC5, 0x1B,
+ 0x79, 0xEC, 0xAC, 0x30, 0x93, 0x58, 0x50, 0x7B, 0x9C, 0x87, 0xB5, 0xCC,
+ 0x0D, 0x99, 0x8B, 0x8E, 0x54, 0x88, 0xB1, 0x88, 0x0D, 0x38, 0x5E, 0x0B,
+ 0x1A, 0x98, 0xF8, 0xC4, 0xB4, 0xCB, 0x4A, 0x32, 0x33, 0x1C, 0x98, 0x60,
+ 0x2C, 0x17, 0x32, 0x8A, 0x65, 0x64, 0x48, 0x45, 0x64, 0x1D, 0x93, 0x70,
+ 0x4E, 0x84, 0x21, 0xC7, 0x6F, 0x63, 0x6E, 0xCE, 0x30, 0x7E, 0xD7, 0x25,
+ 0xF2, 0x89, 0xD7, 0x4E, 0xA1, 0x62, 0x5D, 0x19, 0x58, 0x37, 0x14, 0xE1,
+ 0xF9, 0x5C, 0x1C, 0x58, 0xBB, 0x56, 0xCB, 0x59, 0xB3, 0xAB, 0x26, 0x83,
+ 0xBA, 0xEC, 0x7C, 0x8A, 0x99, 0x66, 0x2F, 0xCD, 0x56, 0x9A, 0x5D, 0x34,
+ 0xFB, 0x67, 0xF6, 0xCE, 0x6C, 0x5B, 0xBF, 0x63, 0x3E, 0x4E, 0x6A, 0x17,
+ 0x10, 0x22, 0x27, 0xE5, 0x70, 0x71, 0xA1, 0x1A, 0xB5, 0xAE, 0x40, 0xB8,
+ 0x5E, 0x06, 0xD4, 0xA7, 0x2C, 0xD2, 0xD1, 0x7B, 0x4E, 0x4C, 0xB0, 0x0F,
+ 0xFB, 0x12, 0xA1, 0xE3, 0x77, 0x82, 0xAE, 0x74, 0x34, 0xC5, 0x71, 0x93,
+ 0x8C, 0xB2, 0x95, 0xA1, 0xF2, 0xD6, 0x49, 0xE7, 0x2D, 0x68, 0xE5, 0x6B,
+ 0x95, 0x6B, 0x45, 0x6B, 0xE5, 0x6A, 0x75, 0x6A, 0x25, 0x76, 0x17, 0x17,
+ 0x12, 0x41, 0x7D, 0x4A, 0xC2, 0xFA, 0xCB, 0x5D, 0x40, 0xCE, 0xC4, 0x85,
+ 0x63, 0x28, 0x83, 0x66, 0x6A, 0xDA, 0x4A, 0xA1, 0xC7, 0xB0, 0xB6, 0x39,
+ 0x11, 0xB8, 0xB6, 0x2F, 0x44, 0xCE, 0x9B, 0x43, 0x7B, 0xAC, 0xFE, 0x56,
+ 0xC0, 0xE4, 0xA8, 0x02, 0x50, 0xB6, 0x2A, 0x05, 0x30, 0x9B, 0xC6, 0xAD,
+ 0xE1, 0x94, 0xA3, 0x3E, 0x18, 0x3E, 0xC5, 0x31, 0xB8, 0xCE, 0x2A, 0x83,
+ 0x2B, 0xA4, 0x98, 0x5F, 0x37, 0x32, 0x08, 0x2C, 0xE7, 0x18, 0x1E, 0x74,
+ 0x84, 0x5C, 0x78, 0xD0, 0x27, 0x78, 0x54, 0xEF, 0x15, 0xB3, 0x4B, 0x1A,
+ 0x70, 0xB6, 0xB0, 0x9C, 0xA7, 0xAA, 0x42, 0xE2, 0x83, 0x68, 0x04, 0x9A,
+ 0xD1, 0x60, 0x4D, 0xB4, 0xE4, 0x22, 0xCE, 0x54, 0x23, 0x5D, 0x81, 0x50,
+ 0x03, 0x29, 0x7A, 0x8F, 0x69, 0xD8, 0xEA, 0xBD, 0x86, 0x34, 0x7A, 0x3F,
+ 0xDD, 0x77, 0xDD, 0xFD, 0xD9, 0x6C, 0x0B, 0x49, 0x29, 0xB6, 0xD0, 0xB5,
+ 0x3D, 0xAE, 0x11, 0xBB, 0x94, 0x79, 0xEB, 0x85, 0x72, 0xA0, 0x26, 0x6B,
+ 0xBC, 0x90, 0x0C, 0x12, 0x14, 0x5D, 0x2B, 0x49, 0x9B, 0xAF, 0x7A, 0x6E,
+ 0x75, 0x58, 0x9C, 0xF7, 0x15, 0xA0, 0xE5, 0x25, 0x38, 0x49, 0x5C, 0xFF,
+ 0xF6, 0x34, 0x8C, 0x66, 0xC7, 0x47, 0x6F, 0xEF, 0x3F, 0xE2, 0xE5, 0x59,
+ 0x7A, 0x9D, 0x5B, 0x55, 0x27, 0x65, 0x4A, 0x26, 0xD5, 0x20, 0x6E, 0xFA,
+ 0xD5, 0xC0, 0xCA, 0x7F, 0x94, 0x52, 0xDD, 0x5D, 0xCF, 0x72, 0xD2, 0xED,
+ 0x34, 0xDD, 0xDB, 0x49, 0xD3, 0xD4, 0x1E, 0x37, 0x78, 0xDD, 0x52, 0x4F,
+ 0x0A, 0x41, 0x98, 0x97, 0x58, 0xCE, 0x0B, 0x94, 0xAB, 0xF7, 0xF6, 0xA2,
+ 0xC1, 0xEA, 0x35, 0x11, 0x1E, 0x61, 0x71, 0xF1, 0xC3, 0x9B, 0xBA, 0x4E,
+ 0x39, 0xA2, 0x75, 0x51, 0x75, 0xF6, 0xD8, 0xEC, 0x46, 0x13, 0x2A, 0xB6,
+ 0x87, 0x99, 0x4A, 0x43, 0x0C, 0x97, 0x61, 0xBB, 0xDC, 0x25, 0x4F, 0x77,
+ 0x0A, 0x16, 0x82, 0xCB, 0x35, 0x55, 0x97, 0x60, 0x67, 0xA0, 0xA2, 0xEA,
+ 0x60, 0x73, 0xA0, 0x20, 0xA4, 0x4C, 0x46, 0x96, 0x33, 0x1A, 0x48, 0x4F,
+ 0x89, 0xE0, 0x96, 0xF3, 0x5A, 0x63, 0x3F, 0x1A, 0xD3, 0x38, 0xF1, 0xF2,
+ 0x38, 0x1A, 0xCE, 0x34, 0xC1, 0xF2, 0x1A, 0x66, 0x81, 0xE5, 0xFC, 0xF9,
+ 0xF2, 0x1D, 0xE6, 0x4C, 0x83, 0xD1, 0xA3, 0xA2, 0x11, 0x57, 0x0B, 0x18,
+ 0x2D, 0xEF, 0x2F, 0x9F, 0x20, 0xAB, 0x1F, 0x84, 0x26, 0xCA, 0x06, 0x9D,
+ 0x56, 0xB7, 0x7A, 0xD9, 0x93, 0x35, 0xB9, 0xC1, 0x5E, 0x39, 0x4C, 0xCB,
+ 0xB0, 0xD8, 0xD3, 0x4D, 0xE0, 0xFB, 0xCC, 0x47, 0x53, 0xF0, 0x67, 0x6C,
+ 0x26, 0x50, 0x46, 0x39, 0xEB, 0x21, 0x1C, 0x72, 0x29, 0x28, 0x11, 0x68,
+ 0x16, 0xFB, 0x1D, 0x8C, 0x89, 0x0F, 0xDF, 0x3F, 0x68, 0x4A, 0xFF, 0x4B,
+ 0x39, 0x85, 0xEF, 0x3D, 0x72, 0xDF, 0x4B, 0x99, 0x08, 0x3C, 0x87, 0x77,
+ 0xAC, 0x8F, 0x72, 0xB5, 0xC4, 0xB4, 0x83, 0x70, 0xC6, 0x53, 0x79, 0x8B,
+ 0xD1, 0x09, 0x8F, 0x97, 0xD4, 0x53, 0x3D, 0x8D, 0x3E, 0xBC, 0x43, 0x6E,
+ 0x3F, 0x19, 0x0C, 0xF0, 0x96, 0xBC, 0x24, 0x5F, 0xF6, 0xFE, 0x34, 0x70,
+ 0x17, 0xAA, 0x4B, 0x74, 0xDE, 0x4B, 0x9B, 0xF1, 0x41, 0x34, 0x37, 0x91,
+ 0x6C, 0xB1, 0xE2, 0x19, 0x33, 0x2F, 0x32, 0x1B, 0x6D, 0xB5, 0xF3, 0xB4,
+ 0xC7, 0xF9, 0xA7, 0xBA, 0xF3, 0x0F, 0xD5, 0xFA, 0xC0, 0xFA};
+const uint8_t g_ruRU_Locale[] = {
+ 0x78, 0x9C, 0xAD, 0x57, 0x4D, 0x4F, 0x13, 0x41, 0x18, 0x3E, 0x63, 0xE2,
+ 0x7F, 0x98, 0x6C, 0x24, 0x68, 0x02, 0xAD, 0x1E, 0x25, 0x65, 0x13, 0x22,
+ 0x0A, 0x06, 0xD7, 0x90, 0x16, 0x34, 0x72, 0x31, 0xDB, 0xDD, 0xA1, 0x5D,
+ 0xE8, 0xEE, 0x90, 0xE9, 0x6E, 0xB0, 0x7B, 0x2A, 0x85, 0xE8, 0x05, 0x25,
+ 0xE1, 0xA0, 0x47, 0xF4, 0xE4, 0xC9, 0x50, 0xBE, 0x12, 0x82, 0xB6, 0x24,
+ 0xFE, 0x82, 0xD9, 0xFF, 0x60, 0xD4, 0x9F, 0xE1, 0x3B, 0xFB, 0xD1, 0xEE,
+ 0xB7, 0xC5, 0xD8, 0x1E, 0x3A, 0xF3, 0x3E, 0xCF, 0xF3, 0xCE, 0xFB, 0xB5,
+ 0xD3, 0xB6, 0xD4, 0x20, 0x8A, 0xDC, 0xC0, 0xC8, 0x90, 0x75, 0x3C, 0x23,
+ 0x50, 0xEB, 0x65, 0x79, 0x45, 0x40, 0x2A, 0x6E, 0x2A, 0x33, 0xC2, 0x8F,
+ 0xAB, 0xDD, 0xDF, 0x47, 0x5F, 0x6E, 0xC3, 0xC7, 0xAF, 0xDE, 0x87, 0x9F,
+ 0xEF, 0x8F, 0xEE, 0x08, 0xE2, 0xCD, 0x1B, 0x08, 0x95, 0x38, 0xDF, 0x50,
+ 0x65, 0x5A, 0x69, 0xE9, 0x55, 0xD2, 0x68, 0xFA, 0xD2, 0x1A, 0xC5, 0x35,
+ 0x42, 0x35, 0xD9, 0xE0, 0xAC, 0x31, 0x54, 0xD2, 0x89, 0x61, 0xD6, 0x9F,
+ 0x02, 0xD4, 0xE4, 0xFB, 0x31, 0x6F, 0x2F, 0x3A, 0xFB, 0xAC, 0xC7, 0x4E,
+ 0x58, 0xD7, 0x69, 0x3B, 0xFB, 0xA5, 0xA2, 0x67, 0x0B, 0xC3, 0xBB, 0xEC,
+ 0x9C, 0x9D, 0x38, 0x6D, 0xD6, 0x65, 0x5F, 0x53, 0x09, 0xEC, 0x9B, 0xAB,
+ 0xED, 0xB0, 0x6E, 0x1A, 0xD8, 0x65, 0x57, 0xA0, 0x3D, 0xCF, 0xD3, 0xA6,
+ 0x02, 0x17, 0xCE, 0x3B, 0xD6, 0xCB, 0x86, 0x32, 0xDC, 0x75, 0x21, 0x91,
+ 0x53, 0x67, 0xC7, 0xD9, 0xCE, 0x08, 0xC7, 0xD9, 0x86, 0x50, 0x7A, 0x4E,
+ 0x07, 0x72, 0x3E, 0xCE, 0xC8, 0x97, 0xF5, 0xD9, 0x65, 0x3E, 0xA1, 0xC7,
+ 0xFA, 0x79, 0xF0, 0x19, 0x1C, 0x71, 0x09, 0x91, 0xC4, 0x09, 0xC8, 0x5F,
+ 0x0F, 0x1A, 0x10, 0x6E, 0x08, 0x92, 0xAB, 0x55, 0x3A, 0x23, 0xDC, 0x13,
+ 0x92, 0x9D, 0x29, 0xE4, 0x34, 0x25, 0x0D, 0x1B, 0xA1, 0x1F, 0x99, 0xB2,
+ 0xFF, 0xDD, 0x8A, 0xD4, 0xD8, 0xFD, 0x1E, 0xA4, 0x06, 0xE1, 0x16, 0x3F,
+ 0x15, 0xF1, 0xAB, 0x9E, 0x8A, 0xB9, 0x25, 0x2F, 0xE4, 0xD7, 0x5A, 0x95,
+ 0x5B, 0xA1, 0xD1, 0x87, 0x9D, 0x08, 0x01, 0xF6, 0x21, 0x98, 0x4B, 0x3E,
+ 0x9F, 0x7E, 0x50, 0x7B, 0xEC, 0xBC, 0x54, 0xE4, 0xD8, 0x90, 0x74, 0x05,
+ 0x31, 0xF5, 0x00, 0x3C, 0x73, 0x87, 0x78, 0x0F, 0xD6, 0x17, 0xEC, 0x32,
+ 0x4E, 0x3A, 0x81, 0x72, 0xF7, 0xC1, 0x4F, 0x1A, 0x08, 0xC3, 0xD8, 0x76,
+ 0xF5, 0xDD, 0x38, 0xF0, 0x06, 0xCE, 0xED, 0x40, 0x14, 0xE7, 0x40, 0x38,
+ 0x4D, 0x9C, 0xEB, 0xEC, 0x03, 0x08, 0x0E, 0x9D, 0xD7, 0x49, 0xE5, 0xB6,
+ 0xB3, 0xC3, 0x8E, 0xE1, 0xDD, 0xF7, 0xDA, 0xEC, 0x83, 0xC8, 0x5D, 0xA5,
+ 0xE4, 0x1C, 0x9B, 0x2E, 0xD7, 0xFF, 0x81, 0xB3, 0x1D, 0x3F, 0xF2, 0x90,
+ 0xF5, 0xE2, 0xA6, 0x03, 0xA7, 0x13, 0x37, 0x7D, 0x72, 0xDA, 0x71, 0xD3,
+ 0xE7, 0x24, 0xEB, 0x30, 0x45, 0xC8, 0x8E, 0xB3, 0x43, 0xD5, 0x31, 0xD5,
+ 0x54, 0x0D, 0xEB, 0xE1, 0xEB, 0xC9, 0x37, 0x89, 0xB3, 0x12, 0xB4, 0x33,
+ 0xD8, 0x44, 0xA1, 0xA5, 0x18, 0x84, 0x86, 0xDB, 0x90, 0x73, 0x4C, 0xE5,
+ 0x90, 0x5F, 0xD8, 0xF1, 0x91, 0xE9, 0x23, 0xD6, 0x2B, 0x38, 0x6F, 0x61,
+ 0x6C, 0xB8, 0x61, 0x88, 0x44, 0x8D, 0xC8, 0x5D, 0x05, 0x6A, 0xB8, 0x6A,
+ 0x8B, 0xB1, 0xBB, 0xD6, 0xB3, 0xAA, 0xB2, 0x89, 0x97, 0x64, 0xD3, 0xC4,
+ 0xD4, 0x18, 0xD4, 0x7E, 0x60, 0xF1, 0xAF, 0xE3, 0x35, 0xAB, 0xD1, 0x10,
+ 0xC4, 0x39, 0x24, 0xC1, 0x0B, 0xBD, 0x80, 0x17, 0x9A, 0x80, 0x27, 0x64,
+ 0x82, 0x57, 0x62, 0x40, 0xCD, 0xD2, 0x36, 0x88, 0x51, 0xFB, 0x57, 0xAD,
+ 0x8E, 0x55, 0x90, 0xCE, 0x15, 0x24, 0xA9, 0xC0, 0x95, 0x23, 0x69, 0x9A,
+ 0x75, 0x42, 0xCD, 0xA1, 0x2A, 0xAE, 0x41, 0x28, 0x62, 0xF1, 0x8B, 0x60,
+ 0x6A, 0x7A, 0xAC, 0x08, 0x21, 0x4B, 0xA4, 0x08, 0x0B, 0xD3, 0x92, 0x34,
+ 0x5D, 0xA9, 0xA0, 0xD5, 0x52, 0x31, 0x44, 0xC9, 0xD2, 0x78, 0xC9, 0x5F,
+ 0x4F, 0xE3, 0x26, 0xED, 0x4B, 0x46, 0x12, 0xF8, 0x19, 0x73, 0x49, 0x9C,
+ 0xCF, 0xB3, 0x8D, 0xE5, 0xE6, 0xB7, 0x7C, 0x19, 0xAC, 0xC1, 0x1C, 0xCC,
+ 0xCB, 0xC6, 0xFA, 0xC6, 0x82, 0xDE, 0xAC, 0x3C, 0x9C, 0x7B, 0xB4, 0xF5,
+ 0xFC, 0x55, 0x7D, 0xD1, 0x5E, 0xF5, 0x8A, 0x14, 0x26, 0xB9, 0x4A, 0xC3,
+ 0xD2, 0xAB, 0x98, 0x46, 0x2B, 0x15, 0xB1, 0xF9, 0x21, 0x81, 0x0D, 0x66,
+ 0x59, 0x11, 0x44, 0x7B, 0xD2, 0xB6, 0xEF, 0x17, 0x6C, 0xDB, 0x2E, 0x15,
+ 0x23, 0xBC, 0x6C, 0xA9, 0x62, 0x51, 0x8A, 0x0D, 0xA5, 0x35, 0xD4, 0xDE,
+ 0x1A, 0x59, 0xBB, 0x89, 0xA9, 0x82, 0x0D, 0xD3, 0x97, 0x8E, 0x27, 0x75,
+ 0xBC, 0x1E, 0x89, 0x1C, 0x06, 0x79, 0x0D, 0x53, 0x1D, 0x8B, 0x9A, 0x7C,
+ 0xF7, 0x2A, 0x56, 0x34, 0x5D, 0x86, 0x21, 0x98, 0x0C, 0xBC, 0x78, 0x70,
+ 0xA6, 0xA0, 0x46, 0x89, 0xB5, 0xA9, 0xF1, 0x11, 0xF8, 0xFE, 0x71, 0x44,
+ 0xC9, 0x20, 0x85, 0xF1, 0x11, 0x05, 0xBA, 0x66, 0x58, 0x4D, 0x41, 0x9C,
+ 0x1A, 0x91, 0x6E, 0x63, 0x4A, 0x04, 0xF1, 0x6E, 0x82, 0x3D, 0xAC, 0x4C,
+ 0xA4, 0xE1, 0x41, 0x37, 0x22, 0xA5, 0x89, 0x1A, 0x83, 0x29, 0x74, 0x37,
+ 0x82, 0xE8, 0x7E, 0x47, 0x47, 0x19, 0x39, 0x2A, 0xAD, 0x49, 0xF8, 0x42,
+ 0x10, 0xCB, 0x2B, 0xE5, 0x6B, 0xC8, 0xC2, 0x9D, 0x48, 0x88, 0xDC, 0xAB,
+ 0x2E, 0x11, 0x37, 0x7F, 0xCA, 0x5B, 0x9B, 0x78, 0x4D, 0x56, 0x82, 0xBB,
+ 0x35, 0xD8, 0xFA, 0x3E, 0xA5, 0x16, 0xFC, 0xE0, 0x54, 0xD1, 0x12, 0xD4,
+ 0xA7, 0x98, 0x4E, 0xD0, 0x0C, 0x8D, 0x18, 0x39, 0x84, 0x07, 0xC4, 0xA2,
+ 0x1A, 0xA6, 0xA8, 0x62, 0xAA, 0x19, 0x8C, 0x59, 0x95, 0x54, 0x31, 0x5A,
+ 0xD2, 0xFE, 0x4A, 0x59, 0xC0, 0x55, 0x8A, 0xB7, 0x72, 0x29, 0xB3, 0x54,
+ 0xAE, 0xC2, 0x23, 0x96, 0x47, 0x59, 0xAE, 0xCB, 0x5A, 0x06, 0x61, 0x91,
+ 0xD8, 0xD6, 0x86, 0x8C, 0xE6, 0x89, 0x59, 0xD7, 0x14, 0x9E, 0xD3, 0xD4,
+ 0xB3, 0xC7, 0x48, 0xCA, 0x27, 0x43, 0x01, 0x94, 0x3A, 0x09, 0xC8, 0xE5,
+ 0xDC, 0xA3, 0x81, 0x5B, 0xE3, 0x59, 0xA2, 0x27, 0xB9, 0xB4, 0x0A, 0x19,
+ 0x89, 0x26, 0xB5, 0x2C, 0xA3, 0xB6, 0x4E, 0x5C, 0xA6, 0x17, 0xA4, 0x7B,
+ 0xB3, 0x85, 0xFA, 0x59, 0x2A, 0x7A, 0xFF, 0x3D, 0xC4, 0x3F, 0xDE, 0xCB,
+ 0x8B, 0xC4};
+
+static std::unique_ptr<IFX_Locale> XFA_GetLocaleFromBuffer(const uint8_t* pBuf,
+ int nBufLen) {
+ if (!pBuf || nBufLen <= 0)
+ return nullptr;
+ CFX_GEModule* pGeModule = CFX_GEModule::Get();
+ if (!pGeModule)
+ return nullptr;
+
+ CCodec_ModuleMgr* pCodecMgr = pGeModule->GetCodecModule();
+ if (!pCodecMgr)
+ return nullptr;
+
+ std::unique_ptr<CXML_Element> pLocale;
+ uint8_t* pOut = nullptr;
+ uint32_t dwSize;
+ pCodecMgr->GetFlateModule()->FlateOrLZWDecode(false, pBuf, nBufLen, true, 0,
+ 0, 0, 0, 0, pOut, dwSize);
+ if (pOut) {
+ pLocale = CXML_Element::Parse(pOut, dwSize);
+ FX_Free(pOut);
+ }
+ return pLocale ? std::unique_ptr<IFX_Locale>(
+ new CXFA_XMLLocale(std::move(pLocale)))
+ : nullptr;
+}
+
+static uint16_t XFA_GetLanguage(CFX_WideString wsLanguage) {
+ uint16_t dwLangueID = XFA_LANGID_en_US;
+ if (wsLanguage.GetLength() < 2) {
+ return dwLangueID;
+ }
+ wsLanguage.MakeLower();
+ uint32_t dwIDFirst = wsLanguage.GetAt(0) << 8 | wsLanguage.GetAt(1);
+ uint32_t dwIDSecond = wsLanguage.GetLength() >= 5
+ ? wsLanguage.GetAt(3) << 8 | wsLanguage.GetAt(4)
+ : 0;
+ switch (dwIDFirst) {
+ case FXBSTR_ID(0, 0, 'z', 'h'): {
+ if (dwIDSecond == FXBSTR_ID(0, 0, 'c', 'n')) {
+ dwLangueID = XFA_LANGID_zh_CN;
+ } else if (dwIDSecond == FXBSTR_ID(0, 0, 't', 'w')) {
+ dwLangueID = XFA_LANGID_zh_TW;
+ } else if (dwIDSecond == FXBSTR_ID(0, 0, 'h', 'k')) {
+ dwLangueID = XFA_LANGID_zh_HK;
+ }
+ } break;
+ case FXBSTR_ID(0, 0, 'j', 'a'):
+ dwLangueID = XFA_LANGID_ja_JP;
+ break;
+ case FXBSTR_ID(0, 0, 'k', 'o'):
+ dwLangueID = XFA_LANGID_ko_KR;
+ break;
+ case FXBSTR_ID(0, 0, 'e', 'n'): {
+ if (dwIDSecond == FXBSTR_ID(0, 0, 'g', 'b')) {
+ dwLangueID = XFA_LANGID_en_GB;
+ } else {
+ dwLangueID = XFA_LANGID_en_US;
+ }
+ } break;
+ case FXBSTR_ID(0, 0, 'd', 'e'):
+ dwLangueID = XFA_LANGID_de_DE;
+ break;
+ case FXBSTR_ID(0, 0, 'f', 'r'):
+ dwLangueID = XFA_LANGID_fr_FR;
+ break;
+ case FXBSTR_ID(0, 0, 'e', 's'): {
+ if (dwIDSecond == FXBSTR_ID(0, 0, 'e', 's')) {
+ dwLangueID = XFA_LANGID_es_ES;
+ } else {
+ dwLangueID = XFA_LANGID_es_LA;
+ }
+ } break;
+ case FXBSTR_ID(0, 0, 'i', 't'):
+ dwLangueID = XFA_LANGID_it_IT;
+ break;
+ case FXBSTR_ID(0, 0, 'p', 't'):
+ dwLangueID = XFA_LANGID_pt_BR;
+ break;
+ case FXBSTR_ID(0, 0, 'n', 'l'):
+ dwLangueID = XFA_LANGID_nl_NL;
+ break;
+ case FXBSTR_ID(0, 0, 'r', 'u'):
+ dwLangueID = XFA_LANGID_ru_RU;
+ break;
+ }
+ return dwLangueID;
+}
+
+CXFA_LocaleMgr::CXFA_LocaleMgr(CXFA_Node* pLocaleSet, CFX_WideString wsDeflcid)
+ : m_dwLocaleFlags(0x00) {
+ m_dwDeflcid = XFA_GetLanguage(wsDeflcid);
+ if (pLocaleSet) {
+ CXFA_Node* pNodeLocale = pLocaleSet->GetNodeItem(XFA_NODEITEM_FirstChild);
+ while (pNodeLocale) {
+ m_LocaleArray.emplace_back(new CXFA_NodeLocale(pNodeLocale));
+ pNodeLocale = pNodeLocale->GetNodeItem(XFA_NODEITEM_NextSibling);
+ }
+ }
+ m_pDefLocale = GetLocaleByName(wsDeflcid);
+}
+
+CXFA_LocaleMgr::~CXFA_LocaleMgr() {}
+
+uint16_t CXFA_LocaleMgr::GetDefLocaleID() const {
+ return m_dwDeflcid;
+}
+
+IFX_Locale* CXFA_LocaleMgr::GetDefLocale() {
+ if (m_pDefLocale)
+ return m_pDefLocale;
+
+ if (!m_LocaleArray.empty())
+ return m_LocaleArray[0].get();
+
+ if (!m_XMLLocaleArray.empty())
+ return m_XMLLocaleArray[0].get();
+
+ std::unique_ptr<IFX_Locale> locale(GetLocale(m_dwDeflcid));
+ m_pDefLocale = locale.get();
+ if (locale)
+ m_XMLLocaleArray.push_back(std::move(locale));
+
+ return m_pDefLocale;
+}
+
+std::unique_ptr<IFX_Locale> CXFA_LocaleMgr::GetLocale(uint16_t lcid) {
+ switch (lcid) {
+ case XFA_LANGID_zh_CN:
+ return XFA_GetLocaleFromBuffer(g_zhCN_Locale, sizeof(g_zhCN_Locale));
+ case XFA_LANGID_zh_TW:
+ return XFA_GetLocaleFromBuffer(g_zhTW_Locale, sizeof(g_zhTW_Locale));
+ case XFA_LANGID_zh_HK:
+ return XFA_GetLocaleFromBuffer(g_zhHK_Locale, sizeof(g_zhHK_Locale));
+ case XFA_LANGID_ja_JP:
+ return XFA_GetLocaleFromBuffer(g_jaJP_Locale, sizeof(g_jaJP_Locale));
+ case XFA_LANGID_ko_KR:
+ return XFA_GetLocaleFromBuffer(g_koKR_Locale, sizeof(g_koKR_Locale));
+ case XFA_LANGID_en_GB:
+ return XFA_GetLocaleFromBuffer(g_enGB_Locale, sizeof(g_enGB_Locale));
+ case XFA_LANGID_es_LA:
+ return XFA_GetLocaleFromBuffer(g_esLA_Locale, sizeof(g_esLA_Locale));
+ case XFA_LANGID_es_ES:
+ return XFA_GetLocaleFromBuffer(g_esES_Locale, sizeof(g_esES_Locale));
+ case XFA_LANGID_de_DE:
+ return XFA_GetLocaleFromBuffer(g_deDE_Loacale, sizeof(g_deDE_Loacale));
+ case XFA_LANGID_fr_FR:
+ return XFA_GetLocaleFromBuffer(g_frFR_Locale, sizeof(g_frFR_Locale));
+ case XFA_LANGID_it_IT:
+ return XFA_GetLocaleFromBuffer(g_itIT_Locale, sizeof(g_itIT_Locale));
+ case XFA_LANGID_pt_BR:
+ return XFA_GetLocaleFromBuffer(g_ptBR_Locale, sizeof(g_ptBR_Locale));
+ case XFA_LANGID_nl_NL:
+ return XFA_GetLocaleFromBuffer(g_nlNL_Locale, sizeof(g_nlNL_Locale));
+ case XFA_LANGID_ru_RU:
+ return XFA_GetLocaleFromBuffer(g_ruRU_Locale, sizeof(g_ruRU_Locale));
+ case XFA_LANGID_en_US:
+ default:
+ return XFA_GetLocaleFromBuffer(g_enUS_Locale, sizeof(g_enUS_Locale));
+ }
+}
+
+IFX_Locale* CXFA_LocaleMgr::GetLocaleByName(
+ const CFX_WideString& wsLocaleName) {
+ for (size_t i = 0; i < m_LocaleArray.size(); i++) {
+ IFX_Locale* pLocale = m_LocaleArray[i].get();
+ if (pLocale->GetName() == wsLocaleName)
+ return pLocale;
+ }
+ if (wsLocaleName.GetLength() < 2)
+ return nullptr;
+ for (size_t i = 0; i < m_XMLLocaleArray.size(); i++) {
+ IFX_Locale* pLocale = m_XMLLocaleArray[i].get();
+ if (pLocale->GetName() == wsLocaleName)
+ return pLocale;
+ }
+ uint16_t dwLangueID = XFA_GetLanguage(wsLocaleName);
+ std::unique_ptr<IFX_Locale> pLocale(GetLocale(dwLangueID));
+ IFX_Locale* pRetLocale = pLocale.get();
+ if (pLocale)
+ m_XMLLocaleArray.push_back(std::move(pLocale));
+ return pRetLocale;
+}
+
+void CXFA_LocaleMgr::SetDefLocale(IFX_Locale* pLocale) {
+ m_pDefLocale = pLocale;
+}
+
+CFX_WideStringC CXFA_LocaleMgr::GetConfigLocaleName(CXFA_Node* pConfig) {
+ if (!(m_dwLocaleFlags & 0x01)) {
+ m_wsConfigLocale.clear();
+ if (pConfig) {
+ CXFA_Node* pChildfConfig =
+ pConfig->GetFirstChildByClass(XFA_Element::Acrobat);
+ if (!pChildfConfig) {
+ pChildfConfig = pConfig->GetFirstChildByClass(XFA_Element::Present);
+ }
+ CXFA_Node* pCommon =
+ pChildfConfig
+ ? pChildfConfig->GetFirstChildByClass(XFA_Element::Common)
+ : nullptr;
+ CXFA_Node* pLocale =
+ pCommon ? pCommon->GetFirstChildByClass(XFA_Element::Locale)
+ : nullptr;
+ if (pLocale) {
+ pLocale->TryCData(XFA_ATTRIBUTE_Value, m_wsConfigLocale, false);
+ }
+ }
+ m_dwLocaleFlags |= 0x01;
+ }
+ return m_wsConfigLocale.AsStringC();
+}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_localemgr.h b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_localemgr.h
new file mode 100644
index 00000000000..307cc621d05
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_localemgr.h
@@ -0,0 +1,59 @@
+// 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 XFA_FXFA_PARSER_CXFA_LOCALEMGR_H_
+#define XFA_FXFA_PARSER_CXFA_LOCALEMGR_H_
+
+#include <memory>
+#include <vector>
+
+#include "core/fxcrt/cfx_datetime.h"
+#include "core/fxcrt/ifx_locale.h"
+#include "xfa/fxfa/parser/cxfa_localemgr.h"
+
+class CXFA_Node;
+class IFX_Locale;
+
+#define XFA_LANGID_zh_CN 0x0804
+#define XFA_LANGID_zh_TW 0x0404
+#define XFA_LANGID_zh_HK 0x0c04
+#define XFA_LANGID_ja_JP 0x0411
+#define XFA_LANGID_ko_KR 0x0412
+#define XFA_LANGID_en_US 0x0409
+#define XFA_LANGID_en_GB 0x0809
+#define XFA_LANGID_es_ES 0x0c0a
+#define XFA_LANGID_es_LA 0x080a
+#define XFA_LANGID_de_DE 0x0407
+#define XFA_LANGID_fr_FR 0x040c
+#define XFA_LANGID_it_IT 0x0410
+#define XFA_LANGID_pt_BR 0x0416
+#define XFA_LANGID_nl_NL 0x0413
+#define XFA_LANGID_ru_RU 0x0419
+
+class CXFA_LocaleMgr {
+ public:
+ CXFA_LocaleMgr(CXFA_Node* pLocaleSet, CFX_WideString wsDeflcid);
+ ~CXFA_LocaleMgr();
+
+ uint16_t GetDefLocaleID() const;
+ IFX_Locale* GetDefLocale();
+ IFX_Locale* GetLocaleByName(const CFX_WideString& wsLocaleName);
+
+ void SetDefLocale(IFX_Locale* pLocale);
+ CFX_WideStringC GetConfigLocaleName(CXFA_Node* pConfig);
+
+ private:
+ std::unique_ptr<IFX_Locale> GetLocale(uint16_t lcid);
+
+ std::vector<std::unique_ptr<IFX_Locale>> m_LocaleArray;
+ std::vector<std::unique_ptr<IFX_Locale>> m_XMLLocaleArray;
+ IFX_Locale* m_pDefLocale; // owned by m_LocaleArray or m_XMLLocaleArray.
+ CFX_WideString m_wsConfigLocale;
+ uint16_t m_dwDeflcid;
+ uint16_t m_dwLocaleFlags;
+};
+
+#endif // XFA_FXFA_PARSER_CXFA_LOCALEMGR_H_
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_localevalue.cpp b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_localevalue.cpp
new file mode 100644
index 00000000000..67780924c2a
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_localevalue.cpp
@@ -0,0 +1,979 @@
+// 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
+
+#include "xfa/fxfa/parser/cxfa_localevalue.h"
+
+#include <vector>
+
+#include "core/fxcrt/fx_ext.h"
+#include "third_party/base/ptr_util.h"
+#include "third_party/base/stl_util.h"
+#include "xfa/fgas/crt/cfgas_formatstring.h"
+#include "xfa/fxfa/parser/cxfa_document.h"
+#include "xfa/fxfa/parser/cxfa_localemgr.h"
+#include "xfa/fxfa/parser/xfa_utils.h"
+
+CXFA_LocaleValue::CXFA_LocaleValue() {
+ m_dwType = XFA_VT_NULL;
+ m_bValid = true;
+ m_pLocaleMgr = nullptr;
+}
+CXFA_LocaleValue::CXFA_LocaleValue(const CXFA_LocaleValue& value) {
+ m_dwType = XFA_VT_NULL;
+ m_bValid = true;
+ m_pLocaleMgr = nullptr;
+ *this = value;
+}
+CXFA_LocaleValue::CXFA_LocaleValue(uint32_t dwType,
+ CXFA_LocaleMgr* pLocaleMgr) {
+ m_dwType = dwType;
+ m_bValid = (m_dwType != XFA_VT_NULL);
+ m_pLocaleMgr = pLocaleMgr;
+}
+CXFA_LocaleValue::CXFA_LocaleValue(uint32_t dwType,
+ const CFX_WideString& wsValue,
+ CXFA_LocaleMgr* pLocaleMgr) {
+ m_wsValue = wsValue;
+ m_dwType = dwType;
+ m_pLocaleMgr = pLocaleMgr;
+ m_bValid = ValidateCanonicalValue(wsValue, dwType);
+}
+CXFA_LocaleValue::CXFA_LocaleValue(uint32_t dwType,
+ const CFX_WideString& wsValue,
+ const CFX_WideString& wsFormat,
+ IFX_Locale* pLocale,
+ CXFA_LocaleMgr* pLocaleMgr) {
+ m_pLocaleMgr = pLocaleMgr;
+ m_bValid = true;
+ m_dwType = dwType;
+ m_bValid = ParsePatternValue(wsValue, wsFormat, pLocale);
+}
+CXFA_LocaleValue& CXFA_LocaleValue::operator=(const CXFA_LocaleValue& value) {
+ m_wsValue = value.m_wsValue;
+ m_dwType = value.m_dwType;
+ m_bValid = value.m_bValid;
+ m_pLocaleMgr = value.m_pLocaleMgr;
+ return *this;
+}
+CXFA_LocaleValue::~CXFA_LocaleValue() {}
+static FX_LOCALECATEGORY XFA_ValugeCategory(FX_LOCALECATEGORY eCategory,
+ uint32_t dwValueType) {
+ if (eCategory == FX_LOCALECATEGORY_Unknown) {
+ switch (dwValueType) {
+ case XFA_VT_BOOLEAN:
+ case XFA_VT_INTEGER:
+ case XFA_VT_DECIMAL:
+ case XFA_VT_FLOAT:
+ return FX_LOCALECATEGORY_Num;
+ case XFA_VT_TEXT:
+ return FX_LOCALECATEGORY_Text;
+ case XFA_VT_DATE:
+ return FX_LOCALECATEGORY_Date;
+ case XFA_VT_TIME:
+ return FX_LOCALECATEGORY_Time;
+ case XFA_VT_DATETIME:
+ return FX_LOCALECATEGORY_DateTime;
+ }
+ }
+ return eCategory;
+}
+
+bool CXFA_LocaleValue::ValidateValue(const CFX_WideString& wsValue,
+ const CFX_WideString& wsPattern,
+ IFX_Locale* pLocale,
+ CFX_WideString* pMatchFormat) {
+ CFX_WideString wsOutput;
+ IFX_Locale* locale = m_pLocaleMgr->GetDefLocale();
+ if (pLocale)
+ m_pLocaleMgr->SetDefLocale(pLocale);
+
+ auto pFormat = pdfium::MakeUnique<CFGAS_FormatString>(m_pLocaleMgr);
+ std::vector<CFX_WideString> wsPatterns;
+ pFormat->SplitFormatString(wsPattern, wsPatterns);
+
+ bool bRet = false;
+ int32_t iCount = pdfium::CollectionSize<int32_t>(wsPatterns);
+ int32_t i = 0;
+ for (; i < iCount && !bRet; i++) {
+ CFX_WideString wsFormat = wsPatterns[i];
+ FX_LOCALECATEGORY eCategory = pFormat->GetCategory(wsFormat);
+ eCategory = XFA_ValugeCategory(eCategory, m_dwType);
+ switch (eCategory) {
+ case FX_LOCALECATEGORY_Null:
+ bRet = pFormat->ParseNull(wsValue, wsFormat);
+ if (!bRet) {
+ bRet = wsValue.IsEmpty();
+ }
+ break;
+ case FX_LOCALECATEGORY_Zero:
+ bRet = pFormat->ParseZero(wsValue, wsFormat);
+ if (!bRet) {
+ bRet = wsValue == L"0";
+ }
+ break;
+ case FX_LOCALECATEGORY_Num: {
+ CFX_WideString fNum;
+ bRet = pFormat->ParseNum(wsValue, wsFormat, fNum);
+ if (!bRet) {
+ bRet = pFormat->FormatNum(wsValue, wsFormat, wsOutput);
+ }
+ break;
+ }
+ case FX_LOCALECATEGORY_Text:
+ bRet = pFormat->ParseText(wsValue, wsFormat, wsOutput);
+ wsOutput.clear();
+ if (!bRet) {
+ bRet = pFormat->FormatText(wsValue, wsFormat, wsOutput);
+ }
+ break;
+ case FX_LOCALECATEGORY_Date: {
+ CFX_DateTime dt;
+ bRet = ValidateCanonicalDate(wsValue, &dt);
+ if (!bRet) {
+ bRet = pFormat->ParseDateTime(wsValue, wsFormat, FX_DATETIMETYPE_Date,
+ &dt);
+ if (!bRet) {
+ bRet = pFormat->FormatDateTime(wsValue, wsFormat, wsOutput,
+ FX_DATETIMETYPE_Date);
+ }
+ }
+ break;
+ }
+ case FX_LOCALECATEGORY_Time: {
+ CFX_DateTime dt;
+ bRet = pFormat->ParseDateTime(wsValue, wsFormat, FX_DATETIMETYPE_Time,
+ &dt);
+ if (!bRet) {
+ bRet = pFormat->FormatDateTime(wsValue, wsFormat, wsOutput,
+ FX_DATETIMETYPE_Time);
+ }
+ break;
+ }
+ case FX_LOCALECATEGORY_DateTime: {
+ CFX_DateTime dt;
+ bRet = pFormat->ParseDateTime(wsValue, wsFormat,
+ FX_DATETIMETYPE_DateTime, &dt);
+ if (!bRet) {
+ bRet = pFormat->FormatDateTime(wsValue, wsFormat, wsOutput,
+ FX_DATETIMETYPE_DateTime);
+ }
+ break;
+ }
+ default:
+ bRet = false;
+ break;
+ }
+ }
+ if (bRet && pMatchFormat)
+ *pMatchFormat = wsPatterns[i - 1];
+
+ if (pLocale)
+ m_pLocaleMgr->SetDefLocale(locale);
+
+ return bRet;
+}
+
+CFX_WideString CXFA_LocaleValue::GetValue() const {
+ return m_wsValue;
+}
+uint32_t CXFA_LocaleValue::GetType() const {
+ return m_dwType;
+}
+void CXFA_LocaleValue::SetValue(const CFX_WideString& wsValue,
+ uint32_t dwType) {
+ m_wsValue = wsValue;
+ m_dwType = dwType;
+}
+CFX_WideString CXFA_LocaleValue::GetText() const {
+ if (m_bValid && m_dwType == XFA_VT_TEXT) {
+ return m_wsValue;
+ }
+ return CFX_WideString();
+}
+float CXFA_LocaleValue::GetNum() const {
+ if (m_bValid && (m_dwType == XFA_VT_BOOLEAN || m_dwType == XFA_VT_INTEGER ||
+ m_dwType == XFA_VT_DECIMAL || m_dwType == XFA_VT_FLOAT)) {
+ int64_t nIntegral = 0;
+ uint32_t dwFractional = 0;
+ int32_t nExponent = 0;
+ int cc = 0;
+ bool bNegative = false, bExpSign = false;
+ const wchar_t* str = m_wsValue.c_str();
+ int len = m_wsValue.GetLength();
+ while (FXSYS_iswspace(str[cc]) && cc < len) {
+ cc++;
+ }
+ if (cc >= len) {
+ return 0;
+ }
+ if (str[0] == '+') {
+ cc++;
+ } else if (str[0] == '-') {
+ bNegative = true;
+ cc++;
+ }
+ int nIntegralLen = 0;
+ while (cc < len) {
+ if (str[cc] == '.' || !FXSYS_isDecimalDigit(str[cc]) ||
+ nIntegralLen > 17) {
+ break;
+ }
+ nIntegral = nIntegral * 10 + str[cc] - '0';
+ cc++;
+ nIntegralLen++;
+ }
+ nIntegral = bNegative ? -nIntegral : nIntegral;
+ int scale = 0;
+ double fraction = 0.0;
+ if (cc < len && str[cc] == '.') {
+ cc++;
+ while (cc < len) {
+ fraction += XFA_GetFractionalScale(scale) * (str[cc] - '0');
+ scale++;
+ cc++;
+ if (scale == XFA_GetMaxFractionalScale() ||
+ !FXSYS_isDecimalDigit(str[cc])) {
+ break;
+ }
+ }
+ dwFractional = (uint32_t)(fraction * 4294967296.0);
+ }
+ if (cc < len && (str[cc] == 'E' || str[cc] == 'e')) {
+ cc++;
+ if (cc < len) {
+ if (str[cc] == '+') {
+ cc++;
+ } else if (str[cc] == '-') {
+ bExpSign = true;
+ cc++;
+ }
+ }
+ while (cc < len) {
+ if (str[cc] == '.' || !FXSYS_isDecimalDigit(str[cc])) {
+ break;
+ }
+ nExponent = nExponent * 10 + str[cc] - '0';
+ cc++;
+ }
+ nExponent = bExpSign ? -nExponent : nExponent;
+ }
+ float fValue = (float)(dwFractional / 4294967296.0);
+ fValue = nIntegral + (nIntegral >= 0 ? fValue : -fValue);
+ if (nExponent != 0) {
+ fValue *= FXSYS_pow(10, (float)nExponent);
+ }
+ return fValue;
+ }
+ return 0;
+}
+double CXFA_LocaleValue::GetDoubleNum() const {
+ if (m_bValid && (m_dwType == XFA_VT_BOOLEAN || m_dwType == XFA_VT_INTEGER ||
+ m_dwType == XFA_VT_DECIMAL || m_dwType == XFA_VT_FLOAT)) {
+ int64_t nIntegral = 0;
+ uint32_t dwFractional = 0;
+ int32_t nExponent = 0;
+ int32_t cc = 0;
+ bool bNegative = false, bExpSign = false;
+ const wchar_t* str = m_wsValue.c_str();
+ int len = m_wsValue.GetLength();
+ while (FXSYS_iswspace(str[cc]) && cc < len)
+ cc++;
+
+ if (cc >= len)
+ return 0;
+ if (str[0] == '+') {
+ cc++;
+ } else if (str[0] == '-') {
+ bNegative = true;
+ cc++;
+ }
+
+ int32_t nIntegralLen = 0;
+ while (cc < len) {
+ if (str[cc] == '.' || !FXSYS_isDecimalDigit(str[cc]) ||
+ nIntegralLen > 17) {
+ break;
+ }
+ nIntegral = nIntegral * 10 + str[cc] - '0';
+ cc++;
+ nIntegralLen++;
+ }
+ nIntegral = bNegative ? -nIntegral : nIntegral;
+ int32_t scale = 0;
+ double fraction = 0.0;
+ if (cc < len && str[cc] == '.') {
+ cc++;
+ while (cc < len) {
+ fraction += XFA_GetFractionalScale(scale) * (str[cc] - '0');
+ scale++;
+ cc++;
+ if (scale == XFA_GetMaxFractionalScale() ||
+ !FXSYS_isDecimalDigit(str[cc])) {
+ break;
+ }
+ }
+ dwFractional = static_cast<uint32_t>(fraction * 4294967296.0);
+ }
+ if (cc < len && (str[cc] == 'E' || str[cc] == 'e')) {
+ cc++;
+ if (cc < len) {
+ if (str[cc] == '+') {
+ cc++;
+ } else if (str[cc] == '-') {
+ bExpSign = true;
+ cc++;
+ }
+ }
+ while (cc < len) {
+ if (str[cc] == '.' || !FXSYS_isDecimalDigit(str[cc]))
+ break;
+
+ nExponent = nExponent * 10 + str[cc] - '0';
+ cc++;
+ }
+ nExponent = bExpSign ? -nExponent : nExponent;
+ }
+
+ double dValue = dwFractional / 4294967296.0;
+ dValue = nIntegral + (nIntegral >= 0 ? dValue : -dValue);
+ if (nExponent != 0)
+ dValue *= FXSYS_pow(10, static_cast<float>(nExponent));
+
+ return dValue;
+ }
+ return 0;
+}
+
+CFX_DateTime CXFA_LocaleValue::GetDate() const {
+ if (m_bValid && m_dwType == XFA_VT_DATE) {
+ CFX_DateTime dt;
+ FX_DateFromCanonical(m_wsValue, &dt);
+ return dt;
+ }
+ return CFX_DateTime();
+}
+
+CFX_DateTime CXFA_LocaleValue::GetTime() const {
+ if (m_bValid && m_dwType == XFA_VT_TIME) {
+ ASSERT(m_pLocaleMgr);
+
+ CFX_DateTime dt;
+ FX_TimeFromCanonical(m_wsValue.AsStringC(), &dt,
+ m_pLocaleMgr->GetDefLocale());
+ return dt;
+ }
+ return CFX_DateTime();
+}
+
+CFX_DateTime CXFA_LocaleValue::GetDateTime() const {
+ if (m_bValid && m_dwType == XFA_VT_DATETIME) {
+ int32_t index = m_wsValue.Find('T');
+ CFX_DateTime dt;
+ FX_DateFromCanonical(m_wsValue.Left(index), &dt);
+ ASSERT(m_pLocaleMgr);
+ FX_TimeFromCanonical(
+ m_wsValue.Right(m_wsValue.GetLength() - index - 1).AsStringC(), &dt,
+ m_pLocaleMgr->GetDefLocale());
+ return dt;
+ }
+ return CFX_DateTime();
+}
+
+bool CXFA_LocaleValue::SetText(const CFX_WideString& wsText) {
+ m_dwType = XFA_VT_TEXT;
+ m_wsValue = wsText;
+ return true;
+}
+
+bool CXFA_LocaleValue::SetText(const CFX_WideString& wsText,
+ const CFX_WideString& wsFormat,
+ IFX_Locale* pLocale) {
+ m_dwType = XFA_VT_TEXT;
+ return m_bValid = ParsePatternValue(wsText, wsFormat, pLocale);
+}
+
+bool CXFA_LocaleValue::SetNum(float fNum) {
+ m_dwType = XFA_VT_FLOAT;
+ m_wsValue.Format(L"%.8g", static_cast<double>(fNum));
+ return true;
+}
+
+bool CXFA_LocaleValue::SetNum(const CFX_WideString& wsNum,
+ const CFX_WideString& wsFormat,
+ IFX_Locale* pLocale) {
+ m_dwType = XFA_VT_FLOAT;
+ return m_bValid = ParsePatternValue(wsNum, wsFormat, pLocale);
+}
+
+bool CXFA_LocaleValue::SetDate(const CFX_DateTime& d) {
+ m_dwType = XFA_VT_DATE;
+ m_wsValue.Format(L"%04d-%02d-%02d", d.GetYear(), d.GetMonth(), d.GetDay());
+ return true;
+}
+
+bool CXFA_LocaleValue::SetDate(const CFX_WideString& wsDate,
+ const CFX_WideString& wsFormat,
+ IFX_Locale* pLocale) {
+ m_dwType = XFA_VT_DATE;
+ return m_bValid = ParsePatternValue(wsDate, wsFormat, pLocale);
+}
+
+bool CXFA_LocaleValue::SetTime(const CFX_DateTime& t) {
+ m_dwType = XFA_VT_TIME;
+ m_wsValue.Format(L"%02d:%02d:%02d", t.GetHour(), t.GetMinute(),
+ t.GetSecond());
+ if (t.GetMillisecond() > 0) {
+ CFX_WideString wsTemp;
+ wsTemp.Format(L"%:03d", t.GetMillisecond());
+ m_wsValue += wsTemp;
+ }
+ return true;
+}
+
+bool CXFA_LocaleValue::SetTime(const CFX_WideString& wsTime,
+ const CFX_WideString& wsFormat,
+ IFX_Locale* pLocale) {
+ m_dwType = XFA_VT_TIME;
+ return m_bValid = ParsePatternValue(wsTime, wsFormat, pLocale);
+}
+
+bool CXFA_LocaleValue::SetDateTime(const CFX_DateTime& dt) {
+ m_dwType = XFA_VT_DATETIME;
+ m_wsValue.Format(L"%04d-%02d-%02dT%02d:%02d:%02d", dt.GetYear(),
+ dt.GetMonth(), dt.GetDay(), dt.GetHour(), dt.GetMinute(),
+ dt.GetSecond());
+ if (dt.GetMillisecond() > 0) {
+ CFX_WideString wsTemp;
+ wsTemp.Format(L"%:03d", dt.GetMillisecond());
+ m_wsValue += wsTemp;
+ }
+ return true;
+}
+
+bool CXFA_LocaleValue::SetDateTime(const CFX_WideString& wsDateTime,
+ const CFX_WideString& wsFormat,
+ IFX_Locale* pLocale) {
+ m_dwType = XFA_VT_DATETIME;
+ return m_bValid = ParsePatternValue(wsDateTime, wsFormat, pLocale);
+}
+
+bool CXFA_LocaleValue::FormatPatterns(CFX_WideString& wsResult,
+ const CFX_WideString& wsFormat,
+ IFX_Locale* pLocale,
+ XFA_VALUEPICTURE eValueType) const {
+ auto pFormat = pdfium::MakeUnique<CFGAS_FormatString>(m_pLocaleMgr);
+ std::vector<CFX_WideString> wsPatterns;
+ pFormat->SplitFormatString(wsFormat, wsPatterns);
+ wsResult.clear();
+ int32_t iCount = pdfium::CollectionSize<int32_t>(wsPatterns);
+ for (int32_t i = 0; i < iCount; i++) {
+ if (FormatSinglePattern(wsResult, wsPatterns[i], pLocale, eValueType))
+ return true;
+ }
+ return false;
+}
+
+bool CXFA_LocaleValue::FormatSinglePattern(CFX_WideString& wsResult,
+ const CFX_WideString& wsFormat,
+ IFX_Locale* pLocale,
+ XFA_VALUEPICTURE eValueType) const {
+ IFX_Locale* locale = m_pLocaleMgr->GetDefLocale();
+ if (pLocale)
+ m_pLocaleMgr->SetDefLocale(pLocale);
+
+ wsResult.clear();
+ bool bRet = false;
+ auto pFormat = pdfium::MakeUnique<CFGAS_FormatString>(m_pLocaleMgr);
+ FX_LOCALECATEGORY eCategory = pFormat->GetCategory(wsFormat);
+ eCategory = XFA_ValugeCategory(eCategory, m_dwType);
+ switch (eCategory) {
+ case FX_LOCALECATEGORY_Null:
+ if (m_wsValue.IsEmpty()) {
+ bRet = pFormat->FormatNull(wsFormat, wsResult);
+ }
+ break;
+ case FX_LOCALECATEGORY_Zero:
+ if (m_wsValue == L"0") {
+ bRet = pFormat->FormatZero(wsFormat, wsResult);
+ }
+ break;
+ case FX_LOCALECATEGORY_Num:
+ bRet = pFormat->FormatNum(m_wsValue, wsFormat, wsResult);
+ break;
+ case FX_LOCALECATEGORY_Text:
+ bRet = pFormat->FormatText(m_wsValue, wsFormat, wsResult);
+ break;
+ case FX_LOCALECATEGORY_Date:
+ bRet = pFormat->FormatDateTime(m_wsValue, wsFormat, wsResult,
+ FX_DATETIMETYPE_Date);
+ break;
+ case FX_LOCALECATEGORY_Time:
+ bRet = pFormat->FormatDateTime(m_wsValue, wsFormat, wsResult,
+ FX_DATETIMETYPE_Time);
+ break;
+ case FX_LOCALECATEGORY_DateTime:
+ bRet = pFormat->FormatDateTime(m_wsValue, wsFormat, wsResult,
+ FX_DATETIMETYPE_DateTime);
+ break;
+ default:
+ wsResult = m_wsValue;
+ bRet = true;
+ }
+ if (!bRet && (eCategory != FX_LOCALECATEGORY_Num ||
+ eValueType != XFA_VALUEPICTURE_Display)) {
+ wsResult = m_wsValue;
+ }
+ if (pLocale)
+ m_pLocaleMgr->SetDefLocale(locale);
+
+ return bRet;
+}
+
+static bool XFA_ValueSplitDateTime(const CFX_WideString& wsDateTime,
+ CFX_WideString& wsDate,
+ CFX_WideString& wsTime) {
+ wsDate = L"";
+ wsTime = L"";
+ if (wsDateTime.IsEmpty()) {
+ return false;
+ }
+ int nSplitIndex = -1;
+ nSplitIndex = wsDateTime.Find('T');
+ if (nSplitIndex < 0) {
+ nSplitIndex = wsDateTime.Find(' ');
+ }
+ if (nSplitIndex < 0) {
+ return false;
+ }
+ wsDate = wsDateTime.Left(nSplitIndex);
+ wsTime = wsDateTime.Right(wsDateTime.GetLength() - nSplitIndex - 1);
+ return true;
+}
+bool CXFA_LocaleValue::ValidateCanonicalValue(const CFX_WideString& wsValue,
+ uint32_t dwVType) {
+ if (wsValue.IsEmpty()) {
+ return true;
+ }
+ CFX_DateTime dt;
+ switch (dwVType) {
+ case XFA_VT_DATE: {
+ if (ValidateCanonicalDate(wsValue, &dt))
+ return true;
+
+ CFX_WideString wsDate, wsTime;
+ if (XFA_ValueSplitDateTime(wsValue, wsDate, wsTime) &&
+ ValidateCanonicalDate(wsDate, &dt)) {
+ return true;
+ }
+ return false;
+ }
+ case XFA_VT_TIME: {
+ if (ValidateCanonicalTime(wsValue))
+ return true;
+
+ CFX_WideString wsDate, wsTime;
+ if (XFA_ValueSplitDateTime(wsValue, wsDate, wsTime) &&
+ ValidateCanonicalTime(wsTime)) {
+ return true;
+ }
+ return false;
+ }
+ case XFA_VT_DATETIME: {
+ CFX_WideString wsDate, wsTime;
+ if (XFA_ValueSplitDateTime(wsValue, wsDate, wsTime) &&
+ ValidateCanonicalDate(wsDate, &dt) && ValidateCanonicalTime(wsTime)) {
+ return true;
+ }
+ } break;
+ }
+ return true;
+}
+bool CXFA_LocaleValue::ValidateCanonicalDate(const CFX_WideString& wsDate,
+ CFX_DateTime* unDate) {
+ const uint16_t LastDay[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
+ const uint16_t wCountY = 4, wCountM = 2, wCountD = 2;
+ int nLen = wsDate.GetLength();
+ if (nLen < wCountY || nLen > wCountY + wCountM + wCountD + 2) {
+ return false;
+ }
+ const bool bSymbol = wsDate.Find(0x2D) != -1;
+ uint16_t wYear = 0;
+ uint16_t wMonth = 0;
+ uint16_t wDay = 0;
+ const wchar_t* pDate = wsDate.c_str();
+ int nIndex = 0, nStart = 0;
+ while (pDate[nIndex] != '\0' && nIndex < wCountY) {
+ if (!FXSYS_isDecimalDigit(pDate[nIndex])) {
+ return false;
+ }
+ wYear = (pDate[nIndex] - '0') + wYear * 10;
+ nIndex++;
+ }
+ if (bSymbol) {
+ if (pDate[nIndex] != 0x2D) {
+ return false;
+ }
+ nIndex++;
+ }
+ nStart = nIndex;
+ while (pDate[nIndex] != '\0' && nIndex - nStart < wCountM && nIndex < nLen) {
+ if (!FXSYS_isDecimalDigit(pDate[nIndex])) {
+ return false;
+ }
+ wMonth = (pDate[nIndex] - '0') + wMonth * 10;
+ nIndex++;
+ }
+ if (bSymbol) {
+ if (pDate[nIndex] != 0x2D) {
+ return false;
+ }
+ nIndex++;
+ }
+ nStart = nIndex;
+ while (pDate[nIndex] != '\0' && nIndex - nStart < wCountD && nIndex < nLen) {
+ if (!FXSYS_isDecimalDigit(pDate[nIndex])) {
+ return false;
+ }
+ wDay = (pDate[nIndex] - '0') + wDay * 10;
+ nIndex++;
+ }
+ if (nIndex != nLen) {
+ return false;
+ }
+ if (wYear < 1900 || wYear > 2029) {
+ return false;
+ }
+ if (wMonth < 1 || wMonth > 12) {
+ if (wMonth == 0 && nLen == wCountY) {
+ return true;
+ }
+ return false;
+ }
+ if (wDay < 1) {
+ if (wDay == 0 && (nLen == wCountY + wCountM)) {
+ return true;
+ }
+ return false;
+ }
+ if (wMonth == 2) {
+ if (wYear % 400 == 0 || (wYear % 100 != 0 && wYear % 4 == 0)) {
+ if (wDay > 29) {
+ return false;
+ }
+ } else {
+ if (wDay > 28) {
+ return false;
+ }
+ }
+ } else if (wDay > LastDay[wMonth - 1]) {
+ return false;
+ }
+
+ unDate->SetDate(wYear, static_cast<uint8_t>(wMonth),
+ static_cast<uint8_t>(wDay));
+ return true;
+}
+
+bool CXFA_LocaleValue::ValidateCanonicalTime(const CFX_WideString& wsTime) {
+ int nLen = wsTime.GetLength();
+ if (nLen < 2)
+ return false;
+ const uint16_t wCountH = 2;
+ const uint16_t wCountM = 2;
+ const uint16_t wCountS = 2;
+ const uint16_t wCountF = 3;
+ const bool bSymbol = wsTime.Find(':') != -1;
+ uint16_t wHour = 0;
+ uint16_t wMinute = 0;
+ uint16_t wSecond = 0;
+ uint16_t wFraction = 0;
+ const wchar_t* pTime = wsTime.c_str();
+ int nIndex = 0;
+ int nStart = 0;
+ while (nIndex - nStart < wCountH && pTime[nIndex]) {
+ if (!FXSYS_isDecimalDigit(pTime[nIndex]))
+ return false;
+ wHour = pTime[nIndex] - '0' + wHour * 10;
+ nIndex++;
+ }
+ if (bSymbol) {
+ if (nIndex < nLen && pTime[nIndex] != ':')
+ return false;
+ nIndex++;
+ }
+ nStart = nIndex;
+ while (nIndex - nStart < wCountM && nIndex < nLen && pTime[nIndex]) {
+ if (!FXSYS_isDecimalDigit(pTime[nIndex]))
+ return false;
+ wMinute = pTime[nIndex] - '0' + wMinute * 10;
+ nIndex++;
+ }
+ if (bSymbol) {
+ if (nIndex < nLen && pTime[nIndex] != ':')
+ return false;
+ nIndex++;
+ }
+ nStart = nIndex;
+ while (nIndex - nStart < wCountS && nIndex < nLen && pTime[nIndex]) {
+ if (!FXSYS_isDecimalDigit(pTime[nIndex]))
+ return false;
+ wSecond = pTime[nIndex] - '0' + wSecond * 10;
+ nIndex++;
+ }
+ if (wsTime.Find('.') > 0) {
+ if (pTime[nIndex] != '.')
+ return false;
+ nIndex++;
+ nStart = nIndex;
+ while (nIndex - nStart < wCountF && nIndex < nLen && pTime[nIndex]) {
+ if (!FXSYS_isDecimalDigit(pTime[nIndex]))
+ return false;
+ wFraction = pTime[nIndex] - '0' + wFraction * 10;
+ nIndex++;
+ }
+ }
+ if (nIndex < nLen) {
+ if (pTime[nIndex] == 'Z') {
+ nIndex++;
+ } else if (pTime[nIndex] == '-' || pTime[nIndex] == '+') {
+ int16_t nOffsetH = 0;
+ int16_t nOffsetM = 0;
+ nIndex++;
+ nStart = nIndex;
+ while (nIndex - nStart < wCountH && nIndex < nLen && pTime[nIndex]) {
+ if (!FXSYS_isDecimalDigit(pTime[nIndex]))
+ return false;
+ nOffsetH = pTime[nIndex] - '0' + nOffsetH * 10;
+ nIndex++;
+ }
+ if (bSymbol) {
+ if (nIndex < nLen && pTime[nIndex] != ':')
+ return false;
+ nIndex++;
+ }
+ nStart = nIndex;
+ while (nIndex - nStart < wCountM && nIndex < nLen && pTime[nIndex]) {
+ if (!FXSYS_isDecimalDigit(pTime[nIndex]))
+ return false;
+ nOffsetM = pTime[nIndex] - '0' + nOffsetM * 10;
+ nIndex++;
+ }
+ if (nOffsetH > 12 || nOffsetM >= 60)
+ return false;
+ }
+ }
+ return nIndex == nLen && wHour < 24 && wMinute < 60 && wSecond < 60 &&
+ wFraction <= 999;
+}
+
+bool CXFA_LocaleValue::ValidateCanonicalDateTime(
+ const CFX_WideString& wsDateTime) {
+ CFX_WideString wsDate, wsTime;
+ if (wsDateTime.IsEmpty())
+ return false;
+
+ int nSplitIndex = -1;
+ nSplitIndex = wsDateTime.Find('T');
+ if (nSplitIndex < 0)
+ nSplitIndex = wsDateTime.Find(' ');
+ if (nSplitIndex < 0)
+ return false;
+
+ wsDate = wsDateTime.Left(nSplitIndex);
+ wsTime = wsDateTime.Right(wsDateTime.GetLength() - nSplitIndex - 1);
+ CFX_DateTime dt;
+ return ValidateCanonicalDate(wsDate, &dt) && ValidateCanonicalTime(wsTime);
+}
+
+bool CXFA_LocaleValue::ParsePatternValue(const CFX_WideString& wsValue,
+ const CFX_WideString& wsPattern,
+ IFX_Locale* pLocale) {
+ IFX_Locale* locale = m_pLocaleMgr->GetDefLocale();
+ if (pLocale)
+ m_pLocaleMgr->SetDefLocale(pLocale);
+
+ auto pFormat = pdfium::MakeUnique<CFGAS_FormatString>(m_pLocaleMgr);
+ std::vector<CFX_WideString> wsPatterns;
+ pFormat->SplitFormatString(wsPattern, wsPatterns);
+ bool bRet = false;
+ int32_t iCount = pdfium::CollectionSize<int32_t>(wsPatterns);
+ for (int32_t i = 0; i < iCount && !bRet; i++) {
+ CFX_WideString wsFormat = wsPatterns[i];
+ FX_LOCALECATEGORY eCategory = pFormat->GetCategory(wsFormat);
+ eCategory = XFA_ValugeCategory(eCategory, m_dwType);
+ switch (eCategory) {
+ case FX_LOCALECATEGORY_Null:
+ bRet = pFormat->ParseNull(wsValue, wsFormat);
+ if (bRet) {
+ m_wsValue.clear();
+ }
+ break;
+ case FX_LOCALECATEGORY_Zero:
+ bRet = pFormat->ParseZero(wsValue, wsFormat);
+ if (bRet)
+ m_wsValue = L"0";
+ break;
+ case FX_LOCALECATEGORY_Num: {
+ CFX_WideString fNum;
+ bRet = pFormat->ParseNum(wsValue, wsFormat, fNum);
+ if (bRet) {
+ m_wsValue = fNum;
+ }
+ break;
+ }
+ case FX_LOCALECATEGORY_Text:
+ bRet = pFormat->ParseText(wsValue, wsFormat, m_wsValue);
+ break;
+ case FX_LOCALECATEGORY_Date: {
+ CFX_DateTime dt;
+ bRet = ValidateCanonicalDate(wsValue, &dt);
+ if (!bRet) {
+ bRet = pFormat->ParseDateTime(wsValue, wsFormat, FX_DATETIMETYPE_Date,
+ &dt);
+ }
+ if (bRet)
+ SetDate(dt);
+ break;
+ }
+ case FX_LOCALECATEGORY_Time: {
+ CFX_DateTime dt;
+ bRet = pFormat->ParseDateTime(wsValue, wsFormat, FX_DATETIMETYPE_Time,
+ &dt);
+ if (bRet)
+ SetTime(dt);
+ break;
+ }
+ case FX_LOCALECATEGORY_DateTime: {
+ CFX_DateTime dt;
+ bRet = pFormat->ParseDateTime(wsValue, wsFormat,
+ FX_DATETIMETYPE_DateTime, &dt);
+ if (bRet)
+ SetDateTime(dt);
+ break;
+ }
+ default:
+ m_wsValue = wsValue;
+ bRet = true;
+ break;
+ }
+ }
+ if (!bRet)
+ m_wsValue = wsValue;
+
+ if (pLocale)
+ m_pLocaleMgr->SetDefLocale(locale);
+
+ return bRet;
+}
+
+void CXFA_LocaleValue::GetNumbericFormat(CFX_WideString& wsFormat,
+ int32_t nIntLen,
+ int32_t nDecLen,
+ bool bSign) {
+ ASSERT(wsFormat.IsEmpty());
+ ASSERT(nIntLen >= -1 && nDecLen >= -1);
+ int32_t nTotalLen = (nIntLen >= 0 ? nIntLen : 2) + (bSign ? 1 : 0) +
+ (nDecLen >= 0 ? nDecLen : 2) + (nDecLen == 0 ? 0 : 1);
+ wchar_t* lpBuf = wsFormat.GetBuffer(nTotalLen);
+ int32_t nPos = 0;
+ if (bSign) {
+ lpBuf[nPos++] = L's';
+ }
+ if (nIntLen == -1) {
+ lpBuf[nPos++] = L'z';
+ lpBuf[nPos++] = L'*';
+ } else {
+ while (nIntLen) {
+ lpBuf[nPos++] = L'z';
+ nIntLen--;
+ }
+ }
+ if (nDecLen != 0) {
+ lpBuf[nPos++] = L'.';
+ }
+ if (nDecLen == -1) {
+ lpBuf[nPos++] = L'z';
+ lpBuf[nPos++] = L'*';
+ } else {
+ while (nDecLen) {
+ lpBuf[nPos++] = L'z';
+ nDecLen--;
+ }
+ }
+ wsFormat.ReleaseBuffer(nTotalLen);
+}
+bool CXFA_LocaleValue::ValidateNumericTemp(CFX_WideString& wsNumeric,
+ CFX_WideString& wsFormat,
+ IFX_Locale* pLocale,
+ int32_t* pos) {
+ if (wsFormat.IsEmpty() || wsNumeric.IsEmpty()) {
+ return true;
+ }
+ const wchar_t* pNum = wsNumeric.c_str();
+ const wchar_t* pFmt = wsFormat.c_str();
+ int32_t n = 0, nf = 0;
+ wchar_t c = pNum[n];
+ wchar_t cf = pFmt[nf];
+ if (cf == L's') {
+ if (c == L'-' || c == L'+') {
+ ++n;
+ }
+ ++nf;
+ }
+ bool bLimit = true;
+ int32_t nCount = wsNumeric.GetLength();
+ int32_t nCountFmt = wsFormat.GetLength();
+ while (n < nCount && (bLimit ? nf < nCountFmt : true) &&
+ FXSYS_isDecimalDigit(c = pNum[n])) {
+ if (bLimit == true) {
+ if ((cf = pFmt[nf]) == L'*') {
+ bLimit = false;
+ } else if (cf == L'z') {
+ nf++;
+ } else {
+ return false;
+ }
+ }
+ n++;
+ }
+ if (n == nCount)
+ return true;
+ if (nf == nCountFmt)
+ return false;
+
+ while (nf < nCountFmt && (cf = pFmt[nf]) != L'.') {
+ ASSERT(cf == L'z' || cf == L'*');
+ ++nf;
+ }
+ CFX_WideString wsDecimalSymbol;
+ if (pLocale)
+ wsDecimalSymbol = pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Decimal);
+ else
+ wsDecimalSymbol = CFX_WideString(L'.');
+
+ if (pFmt[nf] != L'.')
+ return false;
+ if (wsDecimalSymbol != CFX_WideStringC(c) && c != L'.')
+ return false;
+
+ ++nf;
+ ++n;
+ bLimit = true;
+ while (n < nCount && (bLimit ? nf < nCountFmt : true) &&
+ FXSYS_isDecimalDigit(c = pNum[n])) {
+ if (bLimit == true) {
+ if ((cf = pFmt[nf]) == L'*') {
+ bLimit = false;
+ } else if (cf == L'z') {
+ nf++;
+ } else {
+ return false;
+ }
+ }
+ n++;
+ }
+ return n == nCount;
+}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_localevalue.h b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_localevalue.h
new file mode 100644
index 00000000000..cb30d377922
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_localevalue.h
@@ -0,0 +1,113 @@
+// 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 XFA_FXFA_PARSER_CXFA_LOCALEVALUE_H_
+#define XFA_FXFA_PARSER_CXFA_LOCALEVALUE_H_
+
+#include "core/fxcrt/fx_string.h"
+#include "core/fxcrt/fx_system.h"
+#include "xfa/fxfa/parser/cxfa_widgetdata.h"
+
+class IFX_Locale;
+class CFX_DateTime;
+class CXFA_LocaleMgr;
+
+#define XFA_VT_NULL 0
+#define XFA_VT_BOOLEAN 1
+#define XFA_VT_INTEGER 2
+#define XFA_VT_DECIMAL 4
+#define XFA_VT_FLOAT 8
+#define XFA_VT_TEXT 16
+#define XFA_VT_DATE 32
+#define XFA_VT_TIME 64
+#define XFA_VT_DATETIME 128
+
+class CXFA_LocaleValue {
+ public:
+ CXFA_LocaleValue();
+ CXFA_LocaleValue(const CXFA_LocaleValue& value);
+ CXFA_LocaleValue(uint32_t dwType, CXFA_LocaleMgr* pLocaleMgr);
+ CXFA_LocaleValue(uint32_t dwType,
+ const CFX_WideString& wsValue,
+ CXFA_LocaleMgr* pLocaleMgr);
+ CXFA_LocaleValue(uint32_t dwType,
+ const CFX_WideString& wsValue,
+ const CFX_WideString& wsFormat,
+ IFX_Locale* pLocale,
+ CXFA_LocaleMgr* pLocaleMgr);
+ ~CXFA_LocaleValue();
+ CXFA_LocaleValue& operator=(const CXFA_LocaleValue& value);
+
+ bool ValidateValue(const CFX_WideString& wsValue,
+ const CFX_WideString& wsPattern,
+ IFX_Locale* pLocale,
+ CFX_WideString* pMatchFormat = nullptr);
+ bool FormatPatterns(CFX_WideString& wsResult,
+ const CFX_WideString& wsFormat,
+ IFX_Locale* pLocale,
+ XFA_VALUEPICTURE eValueType) const;
+ bool FormatSinglePattern(CFX_WideString& wsResult,
+ const CFX_WideString& wsFormat,
+ IFX_Locale* pLocale,
+ XFA_VALUEPICTURE eValueType) const;
+ bool ValidateCanonicalValue(const CFX_WideString& wsValue, uint32_t dwVType);
+ bool ValidateCanonicalDate(const CFX_WideString& wsDate,
+ CFX_DateTime* unDate);
+ bool ValidateCanonicalTime(const CFX_WideString& wsTime);
+ bool ValidateCanonicalDateTime(const CFX_WideString& wsDateTime);
+ void GetNumbericFormat(CFX_WideString& wsFormat,
+ int32_t nIntLen,
+ int32_t nDecLen,
+ bool bSign = true);
+ bool ValidateNumericTemp(CFX_WideString& wsNumeric,
+ CFX_WideString& wsFormat,
+ IFX_Locale* pLocale = nullptr,
+ int32_t* pos = nullptr);
+
+ CFX_WideString GetValue() const;
+ uint32_t GetType() const;
+ void SetValue(const CFX_WideString& wsValue, uint32_t dwType);
+ CFX_WideString GetText() const;
+ float GetNum() const;
+ double GetDoubleNum() const;
+ CFX_DateTime GetDate() const;
+ CFX_DateTime GetTime() const;
+ CFX_DateTime GetDateTime() const;
+ bool SetText(const CFX_WideString& wsText);
+ bool SetText(const CFX_WideString& wsText,
+ const CFX_WideString& wsFormat,
+ IFX_Locale* pLocale);
+ bool SetNum(float fNum);
+ bool SetNum(const CFX_WideString& wsNum,
+ const CFX_WideString& wsFormat,
+ IFX_Locale* pLocale);
+ bool SetDate(const CFX_DateTime& d);
+ bool SetDate(const CFX_WideString& wsDate,
+ const CFX_WideString& wsFormat,
+ IFX_Locale* pLocale);
+ bool SetTime(const CFX_DateTime& t);
+ bool SetTime(const CFX_WideString& wsTime,
+ const CFX_WideString& wsFormat,
+ IFX_Locale* pLocale);
+ bool SetDateTime(const CFX_DateTime& dt);
+ bool SetDateTime(const CFX_WideString& wsDateTime,
+ const CFX_WideString& wsFormat,
+ IFX_Locale* pLocale);
+ bool IsNull() const { return m_dwType == XFA_VT_NULL; }
+ bool IsEmpty() const { return m_wsValue.IsEmpty(); }
+ bool IsValid() const { return m_bValid; }
+
+ private:
+ bool ParsePatternValue(const CFX_WideString& wsValue,
+ const CFX_WideString& wsPattern,
+ IFX_Locale* pLocale);
+ CXFA_LocaleMgr* m_pLocaleMgr;
+ CFX_WideString m_wsValue;
+ uint32_t m_dwType;
+ bool m_bValid;
+};
+
+#endif // XFA_FXFA_PARSER_CXFA_LOCALEVALUE_H_
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_margin.cpp b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_margin.cpp
index 38f9626a882..e3153f26715 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_margin.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_margin.cpp
@@ -6,26 +6,24 @@
#include "xfa/fxfa/parser/cxfa_margin.h"
-#include "xfa/fxfa/parser/xfa_object.h"
-
CXFA_Margin::CXFA_Margin(CXFA_Node* pNode) : CXFA_Data(pNode) {}
-bool CXFA_Margin::GetLeftInset(FX_FLOAT& fInset, FX_FLOAT fDefInset) const {
+bool CXFA_Margin::GetLeftInset(float& fInset, float fDefInset) const {
fInset = fDefInset;
return TryMeasure(XFA_ATTRIBUTE_LeftInset, fInset);
}
-bool CXFA_Margin::GetTopInset(FX_FLOAT& fInset, FX_FLOAT fDefInset) const {
+bool CXFA_Margin::GetTopInset(float& fInset, float fDefInset) const {
fInset = fDefInset;
return TryMeasure(XFA_ATTRIBUTE_TopInset, fInset);
}
-bool CXFA_Margin::GetRightInset(FX_FLOAT& fInset, FX_FLOAT fDefInset) const {
+bool CXFA_Margin::GetRightInset(float& fInset, float fDefInset) const {
fInset = fDefInset;
return TryMeasure(XFA_ATTRIBUTE_RightInset, fInset);
}
-bool CXFA_Margin::GetBottomInset(FX_FLOAT& fInset, FX_FLOAT fDefInset) const {
+bool CXFA_Margin::GetBottomInset(float& fInset, float fDefInset) const {
fInset = fDefInset;
return TryMeasure(XFA_ATTRIBUTE_BottomInset, fInset);
}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_margin.h b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_margin.h
index d1c19551945..89fc4ce38a6 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_margin.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_margin.h
@@ -16,10 +16,10 @@ class CXFA_Margin : public CXFA_Data {
public:
explicit CXFA_Margin(CXFA_Node* pNode);
- bool GetLeftInset(FX_FLOAT& fInset, FX_FLOAT fDefInset = 0) const;
- bool GetTopInset(FX_FLOAT& fInset, FX_FLOAT fDefInset = 0) const;
- bool GetRightInset(FX_FLOAT& fInset, FX_FLOAT fDefInset = 0) const;
- bool GetBottomInset(FX_FLOAT& fInset, FX_FLOAT fDefInset = 0) const;
+ bool GetLeftInset(float& fInset, float fDefInset = 0) const;
+ bool GetTopInset(float& fInset, float fDefInset = 0) const;
+ bool GetRightInset(float& fInset, float fDefInset = 0) const;
+ bool GetBottomInset(float& fInset, float fDefInset = 0) const;
};
#endif // XFA_FXFA_PARSER_CXFA_MARGIN_H_
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_measurement.cpp b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_measurement.cpp
index ebf7b7bff74..fd00c42d340 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_measurement.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_measurement.cpp
@@ -16,7 +16,7 @@ CXFA_Measurement::CXFA_Measurement() {
Set(-1, XFA_UNIT_Unknown);
}
-CXFA_Measurement::CXFA_Measurement(FX_FLOAT fValue, XFA_UNIT eUnit) {
+CXFA_Measurement::CXFA_Measurement(float fValue, XFA_UNIT eUnit) {
Set(fValue, eUnit);
}
@@ -28,8 +28,8 @@ void CXFA_Measurement::Set(const CFX_WideStringC& wsMeasure) {
}
int32_t iUsedLen = 0;
int32_t iOffset = (wsMeasure.GetAt(0) == L'=') ? 1 : 0;
- FX_FLOAT fValue = FXSYS_wcstof(wsMeasure.c_str() + iOffset,
- wsMeasure.GetLength() - iOffset, &iUsedLen);
+ float fValue = FXSYS_wcstof(wsMeasure.c_str() + iOffset,
+ wsMeasure.GetLength() - iOffset, &iUsedLen);
XFA_UNIT eUnit = GetUnit(wsMeasure.Mid(iOffset + iUsedLen));
Set(fValue, eUnit);
}
@@ -66,7 +66,7 @@ bool CXFA_Measurement::ToString(CFX_WideString& wsMeasure) const {
}
}
-bool CXFA_Measurement::ToUnit(XFA_UNIT eUnit, FX_FLOAT& fValue) const {
+bool CXFA_Measurement::ToUnit(XFA_UNIT eUnit, float& fValue) const {
fValue = GetValue();
XFA_UNIT eFrom = GetUnit();
if (eFrom == eUnit)
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_measurement.h b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_measurement.h
index 40f71a7fab7..34cf780f817 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_measurement.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_measurement.h
@@ -15,27 +15,27 @@ class CXFA_Measurement {
public:
explicit CXFA_Measurement(const CFX_WideStringC& wsMeasure);
CXFA_Measurement();
- CXFA_Measurement(FX_FLOAT fValue, XFA_UNIT eUnit);
+ CXFA_Measurement(float fValue, XFA_UNIT eUnit);
void Set(const CFX_WideStringC& wsMeasure);
- void Set(FX_FLOAT fValue, XFA_UNIT eUnit) {
+ void Set(float fValue, XFA_UNIT eUnit) {
m_fValue = fValue;
m_eUnit = eUnit;
}
XFA_UNIT GetUnit(const CFX_WideStringC& wsUnit);
XFA_UNIT GetUnit() const { return m_eUnit; }
- FX_FLOAT GetValue() const { return m_fValue; }
+ float GetValue() const { return m_fValue; }
bool ToString(CFX_WideString& wsMeasure) const;
- bool ToUnit(XFA_UNIT eUnit, FX_FLOAT& fValue) const;
- FX_FLOAT ToUnit(XFA_UNIT eUnit) const {
- FX_FLOAT f;
+ bool ToUnit(XFA_UNIT eUnit, float& fValue) const;
+ float ToUnit(XFA_UNIT eUnit) const {
+ float f;
return ToUnit(eUnit, f) ? f : 0;
}
private:
- FX_FLOAT m_fValue;
+ float m_fValue;
XFA_UNIT m_eUnit;
};
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_node.cpp b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_node.cpp
index 1e508969d1a..5f582458dee 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_node.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_node.cpp
@@ -4,27 +4,35 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/fxfa/parser/xfa_object.h"
+#include "xfa/fxfa/parser/cxfa_node.h"
#include <map>
#include <memory>
+#include <unordered_set>
#include <utility>
#include <vector>
+#include "core/fxcrt/cfx_decimal.h"
#include "core/fxcrt/fx_ext.h"
#include "fxjs/cfxjse_value.h"
#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
-#include "xfa/fde/xml/fde_xml_imp.h"
+#include "xfa/fde/xml/cfde_xmlelement.h"
+#include "xfa/fde/xml/cfde_xmlnode.h"
+#include "xfa/fde/xml/cfde_xmltext.h"
#include "xfa/fgas/crt/fgas_codepage.h"
#include "xfa/fxfa/app/xfa_ffnotify.h"
#include "xfa/fxfa/cxfa_eventparam.h"
+#include "xfa/fxfa/cxfa_ffwidget.h"
+#include "xfa/fxfa/parser/cxfa_arraynodelist.h"
+#include "xfa/fxfa/parser/cxfa_attachnodelist.h"
#include "xfa/fxfa/parser/cxfa_document.h"
#include "xfa/fxfa/parser/cxfa_layoutprocessor.h"
#include "xfa/fxfa/parser/cxfa_measurement.h"
#include "xfa/fxfa/parser/cxfa_occur.h"
#include "xfa/fxfa/parser/cxfa_scriptcontext.h"
#include "xfa/fxfa/parser/cxfa_simple_parser.h"
+#include "xfa/fxfa/parser/cxfa_traversestrategy_xfacontainernode.h"
#include "xfa/fxfa/parser/xfa_basic_data.h"
namespace {
@@ -44,7 +52,7 @@ XFA_MAPDATABLOCKCALLBACKINFO deleteWideStringCallBack = {XFA_DeleteWideString,
XFA_CopyWideString};
void XFA_DataNodeDeleteBindItem(void* pData) {
- delete static_cast<CXFA_NodeArray*>(pData);
+ delete static_cast<std::vector<CXFA_Node*>*>(pData);
}
XFA_MAPDATABLOCKCALLBACKINFO deleteBindItemCallBack = {
@@ -80,32 +88,24 @@ int32_t GetCount(CXFA_Node* pInstMgrNode) {
return iCount;
}
-void SortNodeArrayByDocumentIdx(const CXFA_NodeSet& rgNodeSet,
- CXFA_NodeArray& rgNodeArray,
- CFX_ArrayTemplate<int32_t>& rgIdxArray) {
- int32_t iCount = pdfium::CollectionSize<int32_t>(rgNodeSet);
- rgNodeArray.SetSize(iCount);
- rgIdxArray.SetSize(iCount);
- if (iCount == 0)
- return;
+std::vector<CXFA_Node*> NodesSortedByDocumentIdx(
+ const std::unordered_set<CXFA_Node*>& rgNodeSet) {
+ if (rgNodeSet.empty())
+ return std::vector<CXFA_Node*>();
- int32_t iIndex = -1;
- int32_t iTotalIndex = -1;
+ std::vector<CXFA_Node*> rgNodeArray;
CXFA_Node* pCommonParent =
(*rgNodeSet.begin())->GetNodeItem(XFA_NODEITEM_Parent);
for (CXFA_Node* pNode = pCommonParent->GetNodeItem(XFA_NODEITEM_FirstChild);
- pNode && iIndex < iCount;
- pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
- iTotalIndex++;
- if (pdfium::ContainsValue(rgNodeSet, pNode)) {
- iIndex++;
- rgNodeArray[iIndex] = pNode;
- rgIdxArray[iIndex] = iTotalIndex;
- }
+ pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
+ if (pdfium::ContainsValue(rgNodeSet, pNode))
+ rgNodeArray.push_back(pNode);
}
+ return rgNodeArray;
}
-using CXFA_NodeSetPair = std::pair<CXFA_NodeSet, CXFA_NodeSet>;
+using CXFA_NodeSetPair =
+ std::pair<std::unordered_set<CXFA_Node*>, std::unordered_set<CXFA_Node*>>;
using CXFA_NodeSetPairMap =
std::map<uint32_t, std::unique_ptr<CXFA_NodeSetPair>>;
using CXFA_NodeSetPairMapMap =
@@ -128,8 +128,8 @@ CXFA_NodeSetPair* NodeSetPairForNode(CXFA_Node* pNode,
return (*pNodeSetPairMap)[dwNameHash].get();
}
-void ReorderDataNodes(const CXFA_NodeSet& sSet1,
- const CXFA_NodeSet& sSet2,
+void ReorderDataNodes(const std::unordered_set<CXFA_Node*>& sSet1,
+ const std::unordered_set<CXFA_Node*>& sSet2,
bool bInsertBefore) {
CXFA_NodeSetPairMapMap rgMap;
for (CXFA_Node* pNode : sSet1) {
@@ -156,26 +156,21 @@ void ReorderDataNodes(const CXFA_NodeSet& sSet1,
if (!pNodeSetPair)
continue;
if (!pNodeSetPair->first.empty() && !pNodeSetPair->second.empty()) {
- CXFA_NodeArray rgNodeArray1;
- CXFA_NodeArray rgNodeArray2;
- CFX_ArrayTemplate<int32_t> rgIdxArray1;
- CFX_ArrayTemplate<int32_t> rgIdxArray2;
- SortNodeArrayByDocumentIdx(pNodeSetPair->first, rgNodeArray1,
- rgIdxArray1);
- SortNodeArrayByDocumentIdx(pNodeSetPair->second, rgNodeArray2,
- rgIdxArray2);
+ std::vector<CXFA_Node*> rgNodeArray1 =
+ NodesSortedByDocumentIdx(pNodeSetPair->first);
+ std::vector<CXFA_Node*> rgNodeArray2 =
+ NodesSortedByDocumentIdx(pNodeSetPair->second);
CXFA_Node* pParentNode = nullptr;
CXFA_Node* pBeforeNode = nullptr;
if (bInsertBefore) {
- pBeforeNode = rgNodeArray2[0];
+ pBeforeNode = rgNodeArray2.front();
pParentNode = pBeforeNode->GetNodeItem(XFA_NODEITEM_Parent);
} else {
- CXFA_Node* pLastNode = rgNodeArray2[rgIdxArray2.GetSize() - 1];
+ CXFA_Node* pLastNode = rgNodeArray2.back();
pParentNode = pLastNode->GetNodeItem(XFA_NODEITEM_Parent);
pBeforeNode = pLastNode->GetNodeItem(XFA_NODEITEM_NextSibling);
}
- for (int32_t iIdx = 0; iIdx < rgIdxArray1.GetSize(); iIdx++) {
- CXFA_Node* pCurNode = rgNodeArray1[iIdx];
+ for (auto* pCurNode : rgNodeArray1) {
pParentNode->RemoveChild(pCurNode);
pParentNode->InsertChild(pCurNode, pBeforeNode);
}
@@ -235,8 +230,8 @@ void InsertItem(CXFA_Node* pInstMgrNode,
pInstMgrNode->GetNodeItem(XFA_NODEITEM_Parent)
->InsertChild(pNewInstance, pNextSibling);
if (bMoveDataBindingNodes) {
- CXFA_NodeSet sNew;
- CXFA_NodeSet sAfter;
+ std::unordered_set<CXFA_Node*> sNew;
+ std::unordered_set<CXFA_Node*> sAfter;
CXFA_NodeIteratorTemplate<CXFA_Node,
CXFA_TraverseStrategy_XFAContainerNode>
sIteratorNew(pNewInstance);
@@ -266,8 +261,8 @@ void InsertItem(CXFA_Node* pInstMgrNode,
pInstMgrNode->GetNodeItem(XFA_NODEITEM_Parent)
->InsertChild(pNewInstance, pBeforeInstance);
if (bMoveDataBindingNodes) {
- CXFA_NodeSet sNew;
- CXFA_NodeSet sBefore;
+ std::unordered_set<CXFA_Node*> sNew;
+ std::unordered_set<CXFA_Node*> sBefore;
CXFA_NodeIteratorTemplate<CXFA_Node,
CXFA_TraverseStrategy_XFAContainerNode>
sIteratorNew(pNewInstance);
@@ -348,7 +343,7 @@ CXFA_Node* CreateInstance(CXFA_Node* pInstMgrNode, bool bDataMerge) {
struct XFA_ExecEventParaInfo {
public:
uint32_t m_uHash;
- const FX_WCHAR* m_lpcEventName;
+ const wchar_t* m_lpcEventName;
XFA_EVENTTYPE m_eventType;
uint32_t m_validFlags;
};
@@ -406,11 +401,11 @@ void StrToRGB(const CFX_WideString& strRGB,
g = 0;
b = 0;
- FX_WCHAR zero = '0';
+ wchar_t zero = '0';
int32_t iIndex = 0;
int32_t iLen = strRGB.GetLength();
for (int32_t i = 0; i < iLen; ++i) {
- FX_WCHAR ch = strRGB.GetAt(i);
+ wchar_t ch = strRGB.GetAt(i);
if (ch == L',')
++iIndex;
if (iIndex > 2)
@@ -522,22 +517,21 @@ CXFA_Node* CXFA_Node::Clone(bool bRecursive) {
MergeAllData(pClone);
pClone->UpdateNameHash();
if (IsNeedSavingXMLNode()) {
- CFDE_XMLNode* pCloneXML = nullptr;
+ std::unique_ptr<CFDE_XMLNode> pCloneXML;
if (IsAttributeInXML()) {
CFX_WideString wsName;
GetAttribute(XFA_ATTRIBUTE_Name, wsName, false);
- CFDE_XMLElement* pCloneXMLElement = new CFDE_XMLElement(wsName);
+ auto pCloneXMLElement = pdfium::MakeUnique<CFDE_XMLElement>(wsName);
CFX_WideStringC wsValue = GetCData(XFA_ATTRIBUTE_Value);
if (!wsValue.IsEmpty()) {
pCloneXMLElement->SetTextData(CFX_WideString(wsValue));
}
- pCloneXML = pCloneXMLElement;
- pCloneXMLElement = nullptr;
+ pCloneXML.reset(pCloneXMLElement.release());
pClone->SetEnum(XFA_ATTRIBUTE_Contains, XFA_ATTRIBUTEENUM_Unknown);
} else {
- pCloneXML = m_pXMLNode->Clone(false);
+ pCloneXML = m_pXMLNode->Clone();
}
- pClone->SetXMLMappingNode(pCloneXML);
+ pClone->SetXMLMappingNode(pCloneXML.release());
pClone->SetFlag(XFA_NodeFlag_OwnXMLNode, false);
}
if (bRecursive) {
@@ -612,34 +606,18 @@ CXFA_Node* CXFA_Node::GetNodeItem(XFA_NODEITEM eItem,
return pNode;
}
-int32_t CXFA_Node::GetNodeList(CXFA_NodeArray& nodes,
- uint32_t dwTypeFilter,
- XFA_Element eTypeFilter,
- int32_t iLevel) {
- if (--iLevel < 0) {
- return nodes.GetSize();
- }
+std::vector<CXFA_Node*> CXFA_Node::GetNodeList(uint32_t dwTypeFilter,
+ XFA_Element eTypeFilter) {
+ std::vector<CXFA_Node*> nodes;
if (eTypeFilter != XFA_Element::Unknown) {
- CXFA_Node* pChild = m_pChild;
- while (pChild) {
- if (pChild->GetElementType() == eTypeFilter) {
- nodes.Add(pChild);
- if (iLevel > 0) {
- GetNodeList(nodes, dwTypeFilter, eTypeFilter, iLevel);
- }
- }
- pChild = pChild->m_pNext;
+ for (CXFA_Node* pChild = m_pChild; pChild; pChild = pChild->m_pNext) {
+ if (pChild->GetElementType() == eTypeFilter)
+ nodes.push_back(pChild);
}
} else if (dwTypeFilter ==
(XFA_NODEFILTER_Children | XFA_NODEFILTER_Properties)) {
- CXFA_Node* pChild = m_pChild;
- while (pChild) {
- nodes.Add(pChild);
- if (iLevel > 0) {
- GetNodeList(nodes, dwTypeFilter, eTypeFilter, iLevel);
- }
- pChild = pChild->m_pNext;
- }
+ for (CXFA_Node* pChild = m_pChild; pChild; pChild = pChild->m_pNext)
+ nodes.push_back(pChild);
} else if (dwTypeFilter != 0) {
bool bFilterChildren = !!(dwTypeFilter & XFA_NODEFILTER_Children);
bool bFilterProperties = !!(dwTypeFilter & XFA_NODEFILTER_Properties);
@@ -651,26 +629,26 @@ int32_t CXFA_Node::GetNodeList(CXFA_NodeArray& nodes,
GetElementType(), pChild->GetElementType(), XFA_XDPPACKET_UNKNOWN);
if (pProperty) {
if (bFilterProperties) {
- nodes.Add(pChild);
+ nodes.push_back(pChild);
} else if (bFilterOneOfProperties &&
(pProperty->uFlags & XFA_PROPERTYFLAG_OneOf)) {
- nodes.Add(pChild);
+ nodes.push_back(pChild);
} else if (bFilterChildren &&
(pChild->GetElementType() == XFA_Element::Variables ||
pChild->GetElementType() == XFA_Element::PageSet)) {
- nodes.Add(pChild);
+ nodes.push_back(pChild);
}
} else if (bFilterChildren) {
- nodes.Add(pChild);
+ nodes.push_back(pChild);
}
pChild = pChild->m_pNext;
}
- if (bFilterOneOfProperties && nodes.GetSize() < 1) {
+ if (bFilterOneOfProperties && nodes.empty()) {
int32_t iProperties = 0;
const XFA_PROPERTY* pProperty =
XFA_GetElementProperties(GetElementType(), iProperties);
if (!pProperty || iProperties < 1)
- return 0;
+ return nodes;
for (int32_t i = 0; i < iProperties; i++) {
if (pProperty[i].uFlags & XFA_PROPERTYFLAG_DefaultOneOf) {
const XFA_PACKETINFO* pPacket = XFA_GetPacketByID(GetPacketID());
@@ -680,13 +658,13 @@ int32_t CXFA_Node::GetNodeList(CXFA_NodeArray& nodes,
break;
InsertChild(pNewNode, nullptr);
pNewNode->SetFlag(XFA_NodeFlag_Initialized, true);
- nodes.Add(pNewNode);
+ nodes.push_back(pNewNode);
break;
}
}
}
}
- return nodes.GetSize();
+ return nodes;
}
CXFA_Node* CXFA_Node::CreateSamePacketNode(XFA_Element eType,
@@ -729,74 +707,72 @@ CXFA_Node* CXFA_Node::GetBindData() {
return static_cast<CXFA_Node*>(GetObject(XFA_ATTRIBUTE_BindingNode));
}
-int32_t CXFA_Node::GetBindItems(CXFA_NodeArray& formItems) {
+std::vector<CXFA_Node*> CXFA_Node::GetBindItems() {
if (BindsFormItems()) {
- CXFA_NodeArray* pItems = nullptr;
- TryObject(XFA_ATTRIBUTE_BindingNode, (void*&)pItems);
- formItems.Copy(*pItems);
- return formItems.GetSize();
+ void* pBinding = nullptr;
+ TryObject(XFA_ATTRIBUTE_BindingNode, pBinding);
+ return *static_cast<std::vector<CXFA_Node*>*>(pBinding);
}
+ std::vector<CXFA_Node*> result;
CXFA_Node* pFormNode =
static_cast<CXFA_Node*>(GetObject(XFA_ATTRIBUTE_BindingNode));
if (pFormNode)
- formItems.Add(pFormNode);
- return formItems.GetSize();
+ result.push_back(pFormNode);
+ return result;
}
int32_t CXFA_Node::AddBindItem(CXFA_Node* pFormNode) {
ASSERT(pFormNode);
if (BindsFormItems()) {
- CXFA_NodeArray* pItems = nullptr;
- TryObject(XFA_ATTRIBUTE_BindingNode, (void*&)pItems);
- ASSERT(pItems);
- if (pItems->Find(pFormNode) < 0) {
- pItems->Add(pFormNode);
- }
- return pItems->GetSize();
+ void* pBinding = nullptr;
+ TryObject(XFA_ATTRIBUTE_BindingNode, pBinding);
+ auto* pItems = static_cast<std::vector<CXFA_Node*>*>(pBinding);
+ if (!pdfium::ContainsValue(*pItems, pFormNode))
+ pItems->push_back(pFormNode);
+ return pdfium::CollectionSize<int32_t>(*pItems);
}
CXFA_Node* pOldFormItem =
static_cast<CXFA_Node*>(GetObject(XFA_ATTRIBUTE_BindingNode));
if (!pOldFormItem) {
SetObject(XFA_ATTRIBUTE_BindingNode, pFormNode);
return 1;
- } else if (pOldFormItem == pFormNode) {
- return 1;
}
- CXFA_NodeArray* pItems = new CXFA_NodeArray;
+ if (pOldFormItem == pFormNode)
+ return 1;
+
+ std::vector<CXFA_Node*>* pItems = new std::vector<CXFA_Node*>;
SetObject(XFA_ATTRIBUTE_BindingNode, pItems, &deleteBindItemCallBack);
- pItems->Add(pOldFormItem);
- pItems->Add(pFormNode);
+ pItems->push_back(pOldFormItem);
+ pItems->push_back(pFormNode);
m_uNodeFlags |= XFA_NodeFlag_BindFormItems;
return 2;
}
int32_t CXFA_Node::RemoveBindItem(CXFA_Node* pFormNode) {
if (BindsFormItems()) {
- CXFA_NodeArray* pItems = nullptr;
- TryObject(XFA_ATTRIBUTE_BindingNode, (void*&)pItems);
- ASSERT(pItems);
- int32_t iIndex = pItems->Find(pFormNode);
- int32_t iCount = pItems->GetSize();
- if (iIndex >= 0) {
- if (iIndex != iCount - 1)
- pItems->SetAt(iIndex, pItems->GetAt(iCount - 1));
- pItems->RemoveAt(iCount - 1);
- if (iCount == 2) {
- CXFA_Node* pLastFormNode = pItems->GetAt(0);
- SetObject(XFA_ATTRIBUTE_BindingNode, pLastFormNode);
+ void* pBinding = nullptr;
+ TryObject(XFA_ATTRIBUTE_BindingNode, pBinding);
+ auto* pItems = static_cast<std::vector<CXFA_Node*>*>(pBinding);
+ auto iter = std::find(pItems->begin(), pItems->end(), pFormNode);
+ if (iter != pItems->end()) {
+ *iter = pItems->back();
+ pItems->pop_back();
+ if (pItems->size() == 1) {
+ SetObject(XFA_ATTRIBUTE_BindingNode,
+ (*pItems)[0]); // Invalidates pItems.
m_uNodeFlags &= ~XFA_NodeFlag_BindFormItems;
+ return 1;
}
- iCount--;
}
- return iCount;
+ return pdfium::CollectionSize<int32_t>(*pItems);
}
CXFA_Node* pOldFormItem =
static_cast<CXFA_Node*>(GetObject(XFA_ATTRIBUTE_BindingNode));
- if (pOldFormItem == pFormNode) {
- SetObject(XFA_ATTRIBUTE_BindingNode, nullptr);
- pOldFormItem = nullptr;
- }
- return pOldFormItem ? 1 : 0;
+ if (pOldFormItem != pFormNode)
+ return pOldFormItem ? 1 : 0;
+
+ SetObject(XFA_ATTRIBUTE_BindingNode, nullptr);
+ return 0;
}
bool CXFA_Node::HasBindItem() {
@@ -836,10 +812,7 @@ CXFA_WidgetData* CXFA_Node::GetContainerWidgetData() {
if (!pDataNode)
return nullptr;
pFieldWidgetData = nullptr;
- CXFA_NodeArray formNodes;
- pDataNode->GetBindItems(formNodes);
- for (int32_t i = 0; i < formNodes.GetSize(); i++) {
- CXFA_Node* pFormNode = formNodes.GetAt(i);
+ for (CXFA_Node* pFormNode : pDataNode->GetBindItems()) {
if (!pFormNode || pFormNode->HasRemovedChildren())
continue;
pFieldWidgetData = pFormNode->GetWidgetData();
@@ -1016,16 +989,16 @@ void CXFA_Node::Script_TreeClass_ResolveNode(CFXJSE_Arguments* pArguments) {
return;
}
if (resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) {
- CXFA_Object* pNode = resoveNodeRS.nodes[0];
+ CXFA_Object* pObject = resoveNodeRS.objects.front();
pArguments->GetReturnValue()->Assign(
- pScriptContext->GetJSValueFromMap(pNode));
+ pScriptContext->GetJSValueFromMap(pObject));
} else {
const XFA_SCRIPTATTRIBUTEINFO* lpAttributeInfo =
resoveNodeRS.pScriptAttribute;
if (lpAttributeInfo && lpAttributeInfo->eValueType == XFA_SCRIPT_Object) {
std::unique_ptr<CFXJSE_Value> pValue(
new CFXJSE_Value(pScriptContext->GetRuntime()));
- (resoveNodeRS.nodes[0]->*(lpAttributeInfo->lpfnCallback))(
+ (resoveNodeRS.objects.front()->*(lpAttributeInfo->lpfnCallback))(
pValue.get(), false, (XFA_ATTRIBUTE)lpAttributeInfo->eAttribute);
pArguments->GetReturnValue()->Assign(pValue.get());
} else {
@@ -1068,18 +1041,16 @@ void CXFA_Node::Script_Som_ResolveNodeList(CFXJSE_Value* pValue,
resoveNodeRS, dwFlag);
CXFA_ArrayNodeList* pNodeList = new CXFA_ArrayNodeList(m_pDocument);
if (resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) {
- for (int32_t i = 0; i < resoveNodeRS.nodes.GetSize(); i++) {
- if (resoveNodeRS.nodes[i]->IsNode())
- pNodeList->Append(resoveNodeRS.nodes[i]->AsNode());
+ for (CXFA_Object* pObject : resoveNodeRS.objects) {
+ if (pObject->IsNode())
+ pNodeList->Append(pObject->AsNode());
}
} else {
CXFA_ValueArray valueArray(pScriptContext->GetRuntime());
- if (resoveNodeRS.GetAttributeResult(valueArray) > 0) {
- CXFA_ObjArray objectArray;
- valueArray.GetAttributeObject(objectArray);
- for (int32_t i = 0; i < objectArray.GetSize(); i++) {
- if (objectArray[i]->IsNode())
- pNodeList->Append(objectArray[i]->AsNode());
+ if (resoveNodeRS.GetAttributeResult(&valueArray) > 0) {
+ for (CXFA_Object* pObject : valueArray.GetAttributeObject()) {
+ if (pObject->IsNode())
+ pNodeList->Append(pObject->AsNode());
}
}
}
@@ -1331,13 +1302,16 @@ void CXFA_Node::Script_NodeClass_LoadXML(CFXJSE_Arguments* pArguments) {
pFakeRoot->SetCData(XFA_ATTRIBUTE_ContentType,
CFX_WideString(wsContentType));
}
- CFDE_XMLNode* pFakeXMLRoot = pFakeRoot->GetXMLMappingNode();
+
+ std::unique_ptr<CFDE_XMLNode> pFakeXMLRoot(pFakeRoot->GetXMLMappingNode());
if (!pFakeXMLRoot) {
CFDE_XMLNode* pThisXMLRoot = GetXMLMappingNode();
- pFakeXMLRoot = pThisXMLRoot ? pThisXMLRoot->Clone(false) : nullptr;
+ pFakeXMLRoot = pThisXMLRoot ? pThisXMLRoot->Clone() : nullptr;
+ }
+ if (!pFakeXMLRoot) {
+ pFakeXMLRoot =
+ pdfium::MakeUnique<CFDE_XMLElement>(CFX_WideString(GetClassName()));
}
- if (!pFakeXMLRoot)
- pFakeXMLRoot = new CFDE_XMLElement(CFX_WideString(GetClassName()));
if (bIgnoreRoot) {
CFDE_XMLNode* pXMLChild = pXMLNode->GetNodeItem(CFDE_XMLNode::FirstChild);
@@ -1355,57 +1329,54 @@ void CXFA_Node::Script_NodeClass_LoadXML(CFXJSE_Arguments* pArguments) {
}
pFakeXMLRoot->InsertChildNode(pXMLNode);
}
- pParser->ConstructXFANode(pFakeRoot, pFakeXMLRoot);
+ pParser->ConstructXFANode(pFakeRoot, pFakeXMLRoot.get());
pFakeRoot = pParser->GetRootNode();
- if (pFakeRoot) {
- if (bOverwrite) {
- CXFA_Node* pChild = GetNodeItem(XFA_NODEITEM_FirstChild);
- CXFA_Node* pNewChild = pFakeRoot->GetNodeItem(XFA_NODEITEM_FirstChild);
- int32_t index = 0;
- while (pNewChild) {
- CXFA_Node* pItem = pNewChild->GetNodeItem(XFA_NODEITEM_NextSibling);
- pFakeRoot->RemoveChild(pNewChild);
- InsertChild(index++, pNewChild);
- pNewChild->SetFlag(XFA_NodeFlag_Initialized, true);
- pNewChild = pItem;
- }
- while (pChild) {
- CXFA_Node* pItem = pChild->GetNodeItem(XFA_NODEITEM_NextSibling);
- RemoveChild(pChild);
- pFakeRoot->InsertChild(pChild);
- pChild = pItem;
- }
- if (GetPacketID() == XFA_XDPPACKET_Form &&
- GetElementType() == XFA_Element::ExData) {
- CFDE_XMLNode* pTempXMLNode = GetXMLMappingNode();
- SetXMLMappingNode(pFakeXMLRoot);
- SetFlag(XFA_NodeFlag_OwnXMLNode, false);
- if (pTempXMLNode && !pTempXMLNode->GetNodeItem(CFDE_XMLNode::Parent)) {
- pFakeXMLRoot = pTempXMLNode;
- } else {
- pFakeXMLRoot = nullptr;
- }
- }
- MoveBufferMapData(pFakeRoot, this, XFA_CalcData, true);
- } else {
- CXFA_Node* pChild = pFakeRoot->GetNodeItem(XFA_NODEITEM_FirstChild);
- while (pChild) {
- CXFA_Node* pItem = pChild->GetNodeItem(XFA_NODEITEM_NextSibling);
- pFakeRoot->RemoveChild(pChild);
- InsertChild(pChild);
- pChild->SetFlag(XFA_NodeFlag_Initialized, true);
- pChild = pItem;
- }
+ if (!pFakeRoot)
+ return;
+
+ if (bOverwrite) {
+ CXFA_Node* pChild = GetNodeItem(XFA_NODEITEM_FirstChild);
+ CXFA_Node* pNewChild = pFakeRoot->GetNodeItem(XFA_NODEITEM_FirstChild);
+ int32_t index = 0;
+ while (pNewChild) {
+ CXFA_Node* pItem = pNewChild->GetNodeItem(XFA_NODEITEM_NextSibling);
+ pFakeRoot->RemoveChild(pNewChild);
+ InsertChild(index++, pNewChild);
+ pNewChild->SetFlag(XFA_NodeFlag_Initialized, true);
+ pNewChild = pItem;
}
- if (pFakeXMLRoot) {
- pFakeRoot->SetXMLMappingNode(pFakeXMLRoot);
- pFakeRoot->SetFlag(XFA_NodeFlag_OwnXMLNode, false);
+ while (pChild) {
+ CXFA_Node* pItem = pChild->GetNodeItem(XFA_NODEITEM_NextSibling);
+ RemoveChild(pChild);
+ pFakeRoot->InsertChild(pChild);
+ pChild = pItem;
}
- pFakeRoot->SetFlag(XFA_NodeFlag_HasRemovedChildren, false);
+ if (GetPacketID() == XFA_XDPPACKET_Form &&
+ GetElementType() == XFA_Element::ExData) {
+ CFDE_XMLNode* pTempXMLNode = GetXMLMappingNode();
+ SetXMLMappingNode(pFakeXMLRoot.release());
+ SetFlag(XFA_NodeFlag_OwnXMLNode, false);
+ if (pTempXMLNode && !pTempXMLNode->GetNodeItem(CFDE_XMLNode::Parent))
+ pFakeXMLRoot.reset(pTempXMLNode);
+ else
+ pFakeXMLRoot = nullptr;
+ }
+ MoveBufferMapData(pFakeRoot, this, XFA_CalcData, true);
} else {
- delete pFakeXMLRoot;
- pFakeXMLRoot = nullptr;
+ CXFA_Node* pChild = pFakeRoot->GetNodeItem(XFA_NODEITEM_FirstChild);
+ while (pChild) {
+ CXFA_Node* pItem = pChild->GetNodeItem(XFA_NODEITEM_NextSibling);
+ pFakeRoot->RemoveChild(pChild);
+ InsertChild(pChild);
+ pChild->SetFlag(XFA_NodeFlag_Initialized, true);
+ pChild = pItem;
+ }
}
+ if (pFakeXMLRoot) {
+ pFakeRoot->SetXMLMappingNode(pFakeXMLRoot.release());
+ pFakeRoot->SetFlag(XFA_NodeFlag_OwnXMLNode, false);
+ }
+ pFakeRoot->SetFlag(XFA_NodeFlag_HasRemovedChildren, false);
}
void CXFA_Node::Script_NodeClass_SaveFilteredXML(CFXJSE_Arguments* pArguments) {
@@ -1440,11 +1411,8 @@ void CXFA_Node::Script_NodeClass_SaveXML(CFXJSE_Arguments* pArguments) {
}
CFX_RetainPtr<IFX_MemoryStream> pMemoryStream =
IFX_MemoryStream::Create(true);
-
- // Note: ambiguious below without static_cast.
- CFX_RetainPtr<IFGAS_Stream> pStream = IFGAS_Stream::CreateStream(
- CFX_RetainPtr<IFX_SeekableWriteStream>(pMemoryStream),
- FX_STREAMACCESS_Text | FX_STREAMACCESS_Write | FX_STREAMACCESS_Append);
+ CFX_RetainPtr<IFGAS_Stream> pStream =
+ IFGAS_Stream::CreateWriteStream(pMemoryStream);
if (!pStream) {
pArguments->GetReturnValue()->SetString(bsXMLHeader);
@@ -1552,12 +1520,11 @@ void CXFA_Node::Script_NodeClass_OneOfChild(CFXJSE_Value* pValue,
ThrowInvalidPropertyException();
return;
}
-
- CXFA_NodeArray properts;
- int32_t iSize = GetNodeList(properts, XFA_NODEFILTER_OneOfProperty);
- if (iSize > 0) {
+ std::vector<CXFA_Node*> properties =
+ GetNodeList(XFA_NODEFILTER_OneOfProperty);
+ if (!properties.empty()) {
pValue->Assign(
- m_pDocument->GetScriptContext()->GetJSValueFromMap(properts[0]));
+ m_pDocument->GetScriptContext()->GetJSValueFromMap(properties.front()));
}
}
@@ -1826,8 +1793,8 @@ void CXFA_Node::Script_Attribute_String(CFXJSE_Value* pValue,
XFA_RESOLVENODE_RS resoveNodeRS;
int32_t iRet = m_pDocument->GetScriptContext()->ResolveObjects(
pProtoRoot, wsSOM.AsStringC(), resoveNodeRS, dwFlag);
- if (iRet > 0 && resoveNodeRS.nodes[0]->IsNode()) {
- pProtoNode = resoveNodeRS.nodes[0]->AsNode();
+ if (iRet > 0 && resoveNodeRS.objects.front()->IsNode()) {
+ pProtoNode = resoveNodeRS.objects.front()->AsNode();
}
} else if (!wsID.IsEmpty()) {
pProtoNode = m_pDocument->GetNodeByID(pProtoRoot, wsID.AsStringC());
@@ -1998,22 +1965,17 @@ void CXFA_Node::Script_Som_DefaultValue(CFXJSE_Value* pValue,
CFX_WideString wsFormatValue(wsNewValue);
CXFA_WidgetData* pContainerWidgetData = nullptr;
if (GetPacketID() == XFA_XDPPACKET_Datasets) {
- CXFA_NodeArray formNodes;
- GetBindItems(formNodes);
CFX_WideString wsPicture;
- for (int32_t i = 0; i < formNodes.GetSize(); i++) {
- CXFA_Node* pFormNode = formNodes.GetAt(i);
- if (!pFormNode || pFormNode->HasRemovedChildren()) {
+ for (CXFA_Node* pFormNode : GetBindItems()) {
+ if (!pFormNode || pFormNode->HasRemovedChildren())
continue;
- }
pContainerWidgetData = pFormNode->GetContainerWidgetData();
if (pContainerWidgetData) {
pContainerWidgetData->GetPictureContent(wsPicture,
XFA_VALUEPICTURE_DataBind);
}
- if (!wsPicture.IsEmpty()) {
+ if (!wsPicture.IsEmpty())
break;
- }
pContainerWidgetData = nullptr;
}
} else if (GetPacketID() == XFA_XDPPACKET_Form) {
@@ -2032,7 +1994,7 @@ void CXFA_Node::Script_Som_DefaultValue(CFXJSE_Value* pValue,
pValue->SetInteger(FXSYS_wtoi(content.c_str()));
} else if (eType == XFA_Element::Float || eType == XFA_Element::Decimal) {
CFX_Decimal decimal(content.AsStringC());
- pValue->SetFloat((FX_FLOAT)(double)decimal);
+ pValue->SetFloat((float)(double)decimal);
} else {
pValue->SetString(content.UTF8Encode().AsStringC());
}
@@ -2253,7 +2215,7 @@ void CXFA_Node::Script_Field_DefaultValue(CFXJSE_Value* pValue,
pValue->SetString(content.UTF8Encode().AsStringC());
} else {
CFX_Decimal decimal(content.AsStringC());
- pValue->SetFloat((FX_FLOAT)(double)decimal);
+ pValue->SetFloat((float)(double)decimal);
}
} else if (pNode && pNode->GetElementType() == XFA_Element::Integer) {
pValue->SetInteger(FXSYS_wtoi(content.c_str()));
@@ -2261,7 +2223,7 @@ void CXFA_Node::Script_Field_DefaultValue(CFXJSE_Value* pValue,
pValue->SetBoolean(FXSYS_wtoi(content.c_str()) == 0 ? false : true);
} else if (pNode && pNode->GetElementType() == XFA_Element::Float) {
CFX_Decimal decimal(content.AsStringC());
- pValue->SetFloat((FX_FLOAT)(double)decimal);
+ pValue->SetFloat((float)(double)decimal);
} else {
pValue->SetString(content.UTF8Encode().AsStringC());
}
@@ -3310,7 +3272,7 @@ void CXFA_Node::Script_Form_FormNodes(CFXJSE_Arguments* pArguments) {
return;
}
- CXFA_NodeArray formItems;
+ std::vector<CXFA_Node*> formItems;
CXFA_ArrayNodeList* pFormNodes = new CXFA_ArrayNodeList(m_pDocument);
pFormNodes->SetArrayNodeList(formItems);
pArguments->GetReturnValue()->SetObject(
@@ -3413,9 +3375,8 @@ void CXFA_Node::Script_Packet_GetAttribute(CFXJSE_Arguments* pArguments) {
CFX_WideString wsAttributeValue;
CFDE_XMLNode* pXMLNode = GetXMLMappingNode();
if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) {
- static_cast<CFDE_XMLElement*>(pXMLNode)->GetString(
- CFX_WideString::FromUTF8(bsAttributeName.AsStringC()).c_str(),
- wsAttributeValue);
+ wsAttributeValue = static_cast<CFDE_XMLElement*>(pXMLNode)->GetString(
+ CFX_WideString::FromUTF8(bsAttributeName.AsStringC()).c_str());
}
pArguments->GetReturnValue()->SetString(
wsAttributeValue.UTF8Encode().AsStringC());
@@ -3469,7 +3430,7 @@ void CXFA_Node::Script_Packet_Content(CFXJSE_Value* pValue,
CFDE_XMLNode* pXMLNode = GetXMLMappingNode();
if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) {
CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode);
- pXMLElement->GetTextData(wsTextData);
+ wsTextData = pXMLElement->GetTextData();
}
pValue->SetString(wsTextData.UTF8Encode().AsStringC());
}
@@ -3783,13 +3744,13 @@ bool CXFA_Node::TryMeasure(XFA_ATTRIBUTE eAttr,
void* pValue;
int32_t iBytes;
if (GetMapModuleBuffer(pKey, pValue, iBytes) && iBytes == sizeof(mValue)) {
- FXSYS_memcpy(&mValue, pValue, sizeof(mValue));
+ memcpy(&mValue, pValue, sizeof(mValue));
return true;
}
if (bUseDefault &&
XFA_GetAttributeDefaultValue(pValue, GetElementType(), eAttr,
XFA_ATTRIBUTETYPE_Measure, m_ePacket)) {
- FXSYS_memcpy(&mValue, pValue, sizeof(mValue));
+ memcpy(&mValue, pValue, sizeof(mValue));
return true;
}
return false;
@@ -3842,8 +3803,7 @@ bool CXFA_Node::SetCData(XFA_ATTRIBUTE eAttr,
GetNodeItem(XFA_NODEITEM_FirstChild);
pChildDataNode; pChildDataNode = pChildDataNode->GetNodeItem(
XFA_NODEITEM_NextSibling)) {
- CXFA_NodeArray formNodes;
- if (pChildDataNode->GetBindItems(formNodes) > 0) {
+ if (!pChildDataNode->GetBindItems().empty()) {
bDeleteChildren = false;
break;
}
@@ -3900,8 +3860,7 @@ bool CXFA_Node::SetAttributeValue(const CFX_WideString& wsValue,
GetNodeItem(XFA_NODEITEM_FirstChild);
pChildDataNode; pChildDataNode = pChildDataNode->GetNodeItem(
XFA_NODEITEM_NextSibling)) {
- CXFA_NodeArray formNodes;
- if (pChildDataNode->GetBindItems(formNodes) > 0) {
+ if (!pChildDataNode->GetBindItems().empty()) {
bDeleteChildren = false;
break;
}
@@ -3947,7 +3906,7 @@ bool CXFA_Node::TryCData(XFA_ATTRIBUTE eAttr,
void* pValue = nullptr;
if (XFA_GetAttributeDefaultValue(pValue, GetElementType(), eAttr,
XFA_ATTRIBUTETYPE_Cdata, m_ePacket)) {
- wsValue = (const FX_WCHAR*)pValue;
+ wsValue = (const wchar_t*)pValue;
return true;
}
return false;
@@ -3975,7 +3934,7 @@ bool CXFA_Node::TryCData(XFA_ATTRIBUTE eAttr,
void* pValue = nullptr;
if (XFA_GetAttributeDefaultValue(pValue, GetElementType(), eAttr,
XFA_ATTRIBUTETYPE_Cdata, m_ePacket)) {
- wsValue = (CFX_WideStringC)(const FX_WCHAR*)pValue;
+ wsValue = (CFX_WideStringC)(const wchar_t*)pValue;
return true;
}
return false;
@@ -4018,10 +3977,14 @@ bool CXFA_Node::SetValue(XFA_ATTRIBUTE eAttr,
static_cast<CFDE_XMLElement*>(m_pXMLNode)
->SetString(pInfo->pName, pValue ? L"1" : L"0");
break;
- case XFA_ATTRIBUTETYPE_Integer:
+ case XFA_ATTRIBUTETYPE_Integer: {
+ CFX_WideString wsValue;
+ wsValue.Format(
+ L"%d", static_cast<int32_t>(reinterpret_cast<uintptr_t>(pValue)));
static_cast<CFDE_XMLElement*>(m_pXMLNode)
- ->SetInteger(pInfo->pName, (int32_t)(uintptr_t)pValue);
+ ->SetString(pInfo->pName, wsValue);
break;
+ }
default:
ASSERT(0);
}
@@ -4058,7 +4021,7 @@ bool CXFA_Node::TryUserData(void* pKey, void*& pData, bool bProtoAlso) {
if (!GetMapModuleBuffer(pKey, pData, iBytes, bProtoAlso)) {
return false;
}
- return iBytes == sizeof(void*) && FXSYS_memcpy(&pData, pData, iBytes);
+ return iBytes == sizeof(void*) && memcpy(&pData, pData, iBytes);
}
bool CXFA_Node::SetScriptContent(const CFX_WideString& wsContent,
@@ -4080,7 +4043,7 @@ bool CXFA_Node::SetScriptContent(const CFX_WideString& wsContent,
CXFA_Node* pBind = GetBindData();
if (bSyncData && pBind) {
std::vector<CFX_WideString> wsSaveTextArray;
- int32_t iSize = 0;
+ size_t iSize = 0;
if (!wsContent.IsEmpty()) {
int32_t iStart = 0;
int32_t iLength = wsContent.GetLength();
@@ -4098,7 +4061,7 @@ bool CXFA_Node::SetScriptContent(const CFX_WideString& wsContent,
wsContent.Mid(iStart, iLength - iStart));
}
}
- iSize = pdfium::CollectionSize<int32_t>(wsSaveTextArray);
+ iSize = wsSaveTextArray.size();
}
if (iSize == 0) {
while (CXFA_Node* pChildNode =
@@ -4106,11 +4069,11 @@ bool CXFA_Node::SetScriptContent(const CFX_WideString& wsContent,
pBind->RemoveChild(pChildNode);
}
} else {
- CXFA_NodeArray valueNodes;
- int32_t iDatas = pBind->GetNodeList(
- valueNodes, XFA_NODEFILTER_Children, XFA_Element::DataValue);
+ std::vector<CXFA_Node*> valueNodes = pBind->GetNodeList(
+ XFA_NODEFILTER_Children, XFA_Element::DataValue);
+ size_t iDatas = valueNodes.size();
if (iDatas < iSize) {
- int32_t iAddNodes = iSize - iDatas;
+ size_t iAddNodes = iSize - iDatas;
CXFA_Node* pValueNodes = nullptr;
while (iAddNodes-- > 0) {
pValueNodes =
@@ -4121,7 +4084,7 @@ bool CXFA_Node::SetScriptContent(const CFX_WideString& wsContent,
}
pValueNodes = nullptr;
} else if (iDatas > iSize) {
- int32_t iDelNodes = iDatas - iSize;
+ size_t iDelNodes = iDatas - iSize;
while (iDelNodes-- > 0) {
pBind->RemoveChild(pBind->GetNodeItem(XFA_NODEITEM_FirstChild));
}
@@ -4136,12 +4099,10 @@ bool CXFA_Node::SetScriptContent(const CFX_WideString& wsContent,
i++;
}
}
- CXFA_NodeArray nodeArray;
- pBind->GetBindItems(nodeArray);
- for (int32_t i = 0; i < nodeArray.GetSize(); i++) {
- if (nodeArray[i] != this) {
- nodeArray[i]->SetScriptContent(wsContent, wsContent, bNotify,
- bScriptModify, false);
+ for (CXFA_Node* pArrayNode : pBind->GetBindItems()) {
+ if (pArrayNode != this) {
+ pArrayNode->SetScriptContent(wsContent, wsContent, bNotify,
+ bScriptModify, false);
}
}
}
@@ -4159,12 +4120,10 @@ bool CXFA_Node::SetScriptContent(const CFX_WideString& wsContent,
if (pBindNode && bSyncData) {
pBindNode->SetScriptContent(wsContent, wsXMLValue, bNotify,
bScriptModify, false);
- CXFA_NodeArray nodeArray;
- pBindNode->GetBindItems(nodeArray);
- for (int32_t i = 0; i < nodeArray.GetSize(); i++) {
- if (nodeArray[i] != this) {
- nodeArray[i]->SetScriptContent(wsContent, wsContent, bNotify, true,
- false);
+ for (CXFA_Node* pArrayNode : pBindNode->GetBindItems()) {
+ if (pArrayNode != this) {
+ pArrayNode->SetScriptContent(wsContent, wsContent, bNotify, true,
+ false);
}
}
}
@@ -4223,11 +4182,9 @@ bool CXFA_Node::SetScriptContent(const CFX_WideString& wsContent,
if (pNode) {
SetAttributeValue(wsContent, wsXMLValue, bNotify, bScriptModify);
if (pBindNode && bSyncData) {
- CXFA_NodeArray nodeArray;
- pBindNode->GetBindItems(nodeArray);
- for (int32_t i = 0; i < nodeArray.GetSize(); i++) {
- nodeArray[i]->SetScriptContent(wsContent, wsContent, bNotify,
- bScriptModify, false);
+ for (CXFA_Node* pArrayNode : pBindNode->GetBindItems()) {
+ pArrayNode->SetScriptContent(wsContent, wsContent, bNotify,
+ bScriptModify, false);
}
}
return true;
@@ -4347,7 +4304,7 @@ bool CXFA_Node::TryNamespace(CFX_WideString& wsNamespace) {
if (!pXMLNode || pXMLNode->GetType() != FDE_XMLNODE_Element) {
return false;
}
- static_cast<CFDE_XMLElement*>(pXMLNode)->GetNamespaceURI(wsNamespace);
+ wsNamespace = static_cast<CFDE_XMLElement*>(pXMLNode)->GetNamespaceURI();
return true;
} else if (GetPacketID() == XFA_XDPPACKET_Datasets) {
CFDE_XMLNode* pXMLNode = GetXMLMappingNode();
@@ -4361,9 +4318,9 @@ bool CXFA_Node::TryNamespace(CFX_WideString& wsNamespace) {
GetEnum(XFA_ATTRIBUTE_Contains) == XFA_ATTRIBUTEENUM_MetaData) {
return XFA_FDEExtension_ResolveNamespaceQualifier(
static_cast<CFDE_XMLElement*>(pXMLNode),
- GetCData(XFA_ATTRIBUTE_QualifiedName), wsNamespace);
+ GetCData(XFA_ATTRIBUTE_QualifiedName), &wsNamespace);
}
- static_cast<CFDE_XMLElement*>(pXMLNode)->GetNamespaceURI(wsNamespace);
+ wsNamespace = static_cast<CFDE_XMLElement*>(pXMLNode)->GetNamespaceURI();
return true;
} else {
CXFA_Node* pModelNode = GetModelNode();
@@ -4896,7 +4853,7 @@ bool CXFA_Node::GetMapModuleValue(void* pKey, void*& pValue) {
void CXFA_Node::SetMapModuleString(void* pKey, const CFX_WideStringC& wsValue) {
SetMapModuleBuffer(pKey, (void*)wsValue.c_str(),
- wsValue.GetLength() * sizeof(FX_WCHAR));
+ wsValue.GetLength() * sizeof(wchar_t));
}
bool CXFA_Node::GetMapModuleString(void* pKey, CFX_WideStringC& wsValue) {
@@ -4905,7 +4862,7 @@ bool CXFA_Node::GetMapModuleString(void* pKey, CFX_WideStringC& wsValue) {
if (!GetMapModuleBuffer(pKey, pValue, iBytes)) {
return false;
}
- wsValue = CFX_WideStringC((const FX_WCHAR*)pValue, iBytes / sizeof(FX_WCHAR));
+ wsValue = CFX_WideStringC((const wchar_t*)pValue, iBytes / sizeof(wchar_t));
return true;
}
@@ -4933,7 +4890,7 @@ void CXFA_Node::SetMapModuleBuffer(
pBuffer->pCallbackInfo = pCallbackInfo;
pBuffer->iBytes = iBytes;
- FXSYS_memcpy(pBuffer->GetData(), pValue, iBytes);
+ memcpy(pBuffer->GetData(), pValue, iBytes);
}
bool CXFA_Node::GetMapModuleBuffer(void* pKey,
@@ -5050,8 +5007,7 @@ void CXFA_Node::MergeAllData(void* pDstModule) {
}
pDstBuffer->pCallbackInfo = pSrcBuffer->pCallbackInfo;
pDstBuffer->iBytes = pSrcBuffer->iBytes;
- FXSYS_memcpy(pDstBuffer->GetData(), pSrcBuffer->GetData(),
- pSrcBuffer->iBytes);
+ memcpy(pDstBuffer->GetData(), pSrcBuffer->GetData(), pSrcBuffer->iBytes);
if (pDstBuffer->pCallbackInfo && pDstBuffer->pCallbackInfo->pCopy) {
pDstBuffer->pCallbackInfo->pCopy(*(void**)pDstBuffer->GetData());
}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_node.h b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_node.h
new file mode 100644
index 00000000000..970d267ff3b
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_node.h
@@ -0,0 +1,608 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef XFA_FXFA_PARSER_CXFA_NODE_H_
+#define XFA_FXFA_PARSER_CXFA_NODE_H_
+
+#include <map>
+#include <vector>
+
+#include "core/fxcrt/fx_string.h"
+#include "xfa/fxfa/parser/cxfa_object.h"
+
+class CFDE_XMLNode;
+class CFXJSE_Argument;
+class CXFA_WidgetData;
+
+#define XFA_NODEFILTER_Children 0x01
+#define XFA_NODEFILTER_Properties 0x02
+#define XFA_NODEFILTER_OneOfProperty 0x04
+
+enum XFA_NodeFlag {
+ XFA_NodeFlag_None = 0,
+ XFA_NodeFlag_Initialized = 1 << 0,
+ XFA_NodeFlag_HasRemovedChildren = 1 << 1,
+ XFA_NodeFlag_NeedsInitApp = 1 << 2,
+ XFA_NodeFlag_BindFormItems = 1 << 3,
+ XFA_NodeFlag_UserInteractive = 1 << 4,
+ XFA_NodeFlag_SkipDataBinding = 1 << 5,
+ XFA_NodeFlag_OwnXMLNode = 1 << 6,
+ XFA_NodeFlag_UnusedNode = 1 << 7,
+ XFA_NodeFlag_LayoutGeneratedNode = 1 << 8
+};
+
+enum XFA_SOM_MESSAGETYPE {
+ XFA_SOM_ValidationMessage,
+ XFA_SOM_FormatMessage,
+ XFA_SOM_MandatoryMessage
+};
+
+enum XFA_NODEITEM {
+ XFA_NODEITEM_Parent,
+ XFA_NODEITEM_FirstChild,
+ XFA_NODEITEM_NextSibling,
+ XFA_NODEITEM_PrevSibling,
+};
+
+typedef void (*PD_CALLBACK_FREEDATA)(void* pData);
+typedef void (*PD_CALLBACK_DUPLICATEDATA)(void*& pData);
+
+struct XFA_MAPDATABLOCKCALLBACKINFO {
+ PD_CALLBACK_FREEDATA pFree;
+ PD_CALLBACK_DUPLICATEDATA pCopy;
+};
+
+struct XFA_MAPDATABLOCK {
+ uint8_t* GetData() const { return (uint8_t*)this + sizeof(XFA_MAPDATABLOCK); }
+ XFA_MAPDATABLOCKCALLBACKINFO* pCallbackInfo;
+ int32_t iBytes;
+};
+
+struct XFA_MAPMODULEDATA {
+ XFA_MAPMODULEDATA();
+ ~XFA_MAPMODULEDATA();
+
+ std::map<void*, void*> m_ValueMap;
+ std::map<void*, XFA_MAPDATABLOCK*> m_BufferMap;
+};
+
+class CXFA_Node : public CXFA_Object {
+ public:
+ uint32_t GetPacketID() const { return m_ePacket; }
+
+ void SetFlag(uint32_t dwFlag, bool bNotify);
+ void ClearFlag(uint32_t dwFlag);
+
+ bool IsInitialized() const { return HasFlag(XFA_NodeFlag_Initialized); }
+ bool IsOwnXMLNode() const { return HasFlag(XFA_NodeFlag_OwnXMLNode); }
+ bool IsUserInteractive() const {
+ return HasFlag(XFA_NodeFlag_UserInteractive);
+ }
+ bool IsUnusedNode() const { return HasFlag(XFA_NodeFlag_UnusedNode); }
+ bool IsLayoutGeneratedNode() const {
+ return HasFlag(XFA_NodeFlag_LayoutGeneratedNode);
+ }
+ bool BindsFormItems() const { return HasFlag(XFA_NodeFlag_BindFormItems); }
+ bool HasRemovedChildren() const {
+ return HasFlag(XFA_NodeFlag_HasRemovedChildren);
+ }
+ bool NeedsInitApp() const { return HasFlag(XFA_NodeFlag_NeedsInitApp); }
+
+ bool IsAttributeInXML();
+ bool IsFormContainer() const {
+ return m_ePacket == XFA_XDPPACKET_Form && IsContainerNode();
+ }
+ void SetXMLMappingNode(CFDE_XMLNode* pXMLNode) { m_pXMLNode = pXMLNode; }
+ CFDE_XMLNode* GetXMLMappingNode() const { return m_pXMLNode; }
+ CFDE_XMLNode* CreateXMLMappingNode();
+ bool IsNeedSavingXMLNode();
+ uint32_t GetNameHash() const { return m_dwNameHash; }
+ bool IsUnnamed() const { return m_dwNameHash == 0; }
+ CXFA_Node* GetModelNode();
+ void UpdateNameHash();
+ bool HasAttribute(XFA_ATTRIBUTE eAttr, bool bCanInherit = false);
+ bool SetAttribute(XFA_ATTRIBUTE eAttr,
+ const CFX_WideStringC& wsValue,
+ bool bNotify = false);
+ bool GetAttribute(XFA_ATTRIBUTE eAttr,
+ CFX_WideString& wsValue,
+ bool bUseDefault = true);
+ bool SetAttribute(const CFX_WideStringC& wsAttr,
+ const CFX_WideStringC& wsValue,
+ bool bNotify = false);
+ bool GetAttribute(const CFX_WideStringC& wsAttr,
+ CFX_WideString& wsValue,
+ bool bUseDefault = true);
+ bool RemoveAttribute(const CFX_WideStringC& wsAttr);
+ bool SetContent(const CFX_WideString& wsContent,
+ const CFX_WideString& wsXMLValue,
+ bool bNotify = false,
+ bool bScriptModify = false,
+ bool bSyncData = true);
+ bool TryContent(CFX_WideString& wsContent,
+ bool bScriptModify = false,
+ bool bProto = true);
+ CFX_WideString GetContent();
+
+ bool TryNamespace(CFX_WideString& wsNamespace);
+
+ bool SetBoolean(XFA_ATTRIBUTE eAttr, bool bValue, bool bNotify = false) {
+ return SetValue(eAttr, XFA_ATTRIBUTETYPE_Boolean, (void*)(uintptr_t)bValue,
+ bNotify);
+ }
+ bool TryBoolean(XFA_ATTRIBUTE eAttr, bool& bValue, bool bUseDefault = true);
+ bool GetBoolean(XFA_ATTRIBUTE eAttr) {
+ bool bValue;
+ return TryBoolean(eAttr, bValue, true) ? bValue : false;
+ }
+ bool SetInteger(XFA_ATTRIBUTE eAttr, int32_t iValue, bool bNotify = false) {
+ return SetValue(eAttr, XFA_ATTRIBUTETYPE_Integer, (void*)(uintptr_t)iValue,
+ bNotify);
+ }
+ bool TryInteger(XFA_ATTRIBUTE eAttr,
+ int32_t& iValue,
+ bool bUseDefault = true);
+ int32_t GetInteger(XFA_ATTRIBUTE eAttr) {
+ int32_t iValue;
+ return TryInteger(eAttr, iValue, true) ? iValue : 0;
+ }
+ bool SetEnum(XFA_ATTRIBUTE eAttr,
+ XFA_ATTRIBUTEENUM eValue,
+ bool bNotify = false) {
+ return SetValue(eAttr, XFA_ATTRIBUTETYPE_Enum, (void*)(uintptr_t)eValue,
+ bNotify);
+ }
+ bool TryEnum(XFA_ATTRIBUTE eAttr,
+ XFA_ATTRIBUTEENUM& eValue,
+ bool bUseDefault = true);
+ XFA_ATTRIBUTEENUM GetEnum(XFA_ATTRIBUTE eAttr) {
+ XFA_ATTRIBUTEENUM eValue;
+ return TryEnum(eAttr, eValue, true) ? eValue : XFA_ATTRIBUTEENUM_Unknown;
+ }
+ bool SetCData(XFA_ATTRIBUTE eAttr,
+ const CFX_WideString& wsValue,
+ bool bNotify = false,
+ bool bScriptModify = false);
+ bool SetAttributeValue(const CFX_WideString& wsValue,
+ const CFX_WideString& wsXMLValue,
+ bool bNotify = false,
+ bool bScriptModify = false);
+ bool TryCData(XFA_ATTRIBUTE eAttr,
+ CFX_WideString& wsValue,
+ bool bUseDefault = true,
+ bool bProto = true);
+ bool TryCData(XFA_ATTRIBUTE eAttr,
+ CFX_WideStringC& wsValue,
+ bool bUseDefault = true,
+ bool bProto = true);
+ CFX_WideStringC GetCData(XFA_ATTRIBUTE eAttr) {
+ CFX_WideStringC wsValue;
+ return TryCData(eAttr, wsValue) ? wsValue : CFX_WideStringC();
+ }
+ bool SetMeasure(XFA_ATTRIBUTE eAttr,
+ CXFA_Measurement mValue,
+ bool bNotify = false);
+ bool TryMeasure(XFA_ATTRIBUTE eAttr,
+ CXFA_Measurement& mValue,
+ bool bUseDefault = true) const;
+ CXFA_Measurement GetMeasure(XFA_ATTRIBUTE eAttr) const;
+ bool SetObject(XFA_ATTRIBUTE eAttr,
+ void* pData,
+ XFA_MAPDATABLOCKCALLBACKINFO* pCallbackInfo = nullptr);
+ bool TryObject(XFA_ATTRIBUTE eAttr, void*& pData);
+ void* GetObject(XFA_ATTRIBUTE eAttr) {
+ void* pData;
+ return TryObject(eAttr, pData) ? pData : nullptr;
+ }
+ bool SetUserData(void* pKey,
+ void* pData,
+ XFA_MAPDATABLOCKCALLBACKINFO* pCallbackInfo = nullptr);
+ bool TryUserData(void* pKey, void*& pData, bool bProtoAlso = false);
+ void* GetUserData(void* pKey, bool bProtoAlso = false) {
+ void* pData;
+ return TryUserData(pKey, pData, bProtoAlso) ? pData : nullptr;
+ }
+ CXFA_Node* GetProperty(int32_t index,
+ XFA_Element eType,
+ bool bCreateProperty = true);
+ int32_t CountChildren(XFA_Element eType, bool bOnlyChild = false);
+ CXFA_Node* GetChild(int32_t index,
+ XFA_Element eType,
+ bool bOnlyChild = false);
+ int32_t InsertChild(int32_t index, CXFA_Node* pNode);
+ bool InsertChild(CXFA_Node* pNode, CXFA_Node* pBeforeNode = nullptr);
+ bool RemoveChild(CXFA_Node* pNode, bool bNotify = true);
+ CXFA_Node* Clone(bool bRecursive);
+ CXFA_Node* GetNodeItem(XFA_NODEITEM eItem) const;
+ CXFA_Node* GetNodeItem(XFA_NODEITEM eItem, XFA_ObjectType eType) const;
+ std::vector<CXFA_Node*> GetNodeList(
+ uint32_t dwTypeFilter = XFA_NODEFILTER_Children |
+ XFA_NODEFILTER_Properties,
+ XFA_Element eTypeFilter = XFA_Element::Unknown);
+ CXFA_Node* CreateSamePacketNode(XFA_Element eType,
+ uint32_t dwFlags = XFA_NodeFlag_Initialized);
+ CXFA_Node* CloneTemplateToForm(bool bRecursive);
+ CXFA_Node* GetTemplateNode() const;
+ void SetTemplateNode(CXFA_Node* pTemplateNode);
+ CXFA_Node* GetDataDescriptionNode();
+ void SetDataDescriptionNode(CXFA_Node* pDataDescriptionNode);
+ CXFA_Node* GetBindData();
+ std::vector<CXFA_Node*> GetBindItems();
+ int32_t AddBindItem(CXFA_Node* pFormNode);
+ int32_t RemoveBindItem(CXFA_Node* pFormNode);
+ bool HasBindItem();
+ CXFA_WidgetData* GetWidgetData();
+ CXFA_WidgetData* GetContainerWidgetData();
+ bool GetLocaleName(CFX_WideString& wsLocaleName);
+ XFA_ATTRIBUTEENUM GetIntact();
+ CXFA_Node* GetFirstChildByName(const CFX_WideStringC& wsNodeName) const;
+ CXFA_Node* GetFirstChildByName(uint32_t dwNodeNameHash) const;
+ CXFA_Node* GetFirstChildByClass(XFA_Element eType) const;
+ CXFA_Node* GetNextSameNameSibling(uint32_t dwNodeNameHash) const;
+ CXFA_Node* GetNextSameNameSibling(const CFX_WideStringC& wsNodeName) const;
+ CXFA_Node* GetNextSameClassSibling(XFA_Element eType) const;
+ int32_t GetNodeSameNameIndex() const;
+ int32_t GetNodeSameClassIndex() const;
+ void GetSOMExpression(CFX_WideString& wsSOMExpression);
+ CXFA_Node* GetInstanceMgrOfSubform();
+
+ CXFA_Node* GetOccurNode();
+ void Script_TreeClass_ResolveNode(CFXJSE_Arguments* pArguments);
+ void Script_TreeClass_ResolveNodes(CFXJSE_Arguments* pArguments);
+ void Script_Som_ResolveNodeList(CFXJSE_Value* pValue,
+ CFX_WideString wsExpression,
+ uint32_t dwFlag,
+ CXFA_Node* refNode = nullptr);
+ void Script_TreeClass_All(CFXJSE_Value* pValue,
+ bool bSetting,
+ XFA_ATTRIBUTE eAttribute);
+ void Script_TreeClass_Nodes(CFXJSE_Value* pValue,
+ bool bSetting,
+ XFA_ATTRIBUTE eAttribute);
+ void Script_TreeClass_ClassAll(CFXJSE_Value* pValue,
+ bool bSetting,
+ XFA_ATTRIBUTE eAttribute);
+ void Script_TreeClass_Parent(CFXJSE_Value* pValue,
+ bool bSetting,
+ XFA_ATTRIBUTE eAttribute);
+ void Script_TreeClass_Index(CFXJSE_Value* pValue,
+ bool bSetting,
+ XFA_ATTRIBUTE eAttribute);
+ void Script_TreeClass_ClassIndex(CFXJSE_Value* pValue,
+ bool bSetting,
+ XFA_ATTRIBUTE eAttribute);
+ void Script_TreeClass_SomExpression(CFXJSE_Value* pValue,
+ bool bSetting,
+ XFA_ATTRIBUTE eAttribute);
+ void Script_NodeClass_ApplyXSL(CFXJSE_Arguments* pArguments);
+ void Script_NodeClass_AssignNode(CFXJSE_Arguments* pArguments);
+ void Script_NodeClass_Clone(CFXJSE_Arguments* pArguments);
+ void Script_NodeClass_GetAttribute(CFXJSE_Arguments* pArguments);
+ void Script_NodeClass_GetElement(CFXJSE_Arguments* pArguments);
+ void Script_NodeClass_IsPropertySpecified(CFXJSE_Arguments* pArguments);
+ void Script_NodeClass_LoadXML(CFXJSE_Arguments* pArguments);
+ void Script_NodeClass_SaveFilteredXML(CFXJSE_Arguments* pArguments);
+ void Script_NodeClass_SaveXML(CFXJSE_Arguments* pArguments);
+ void Script_NodeClass_SetAttribute(CFXJSE_Arguments* pArguments);
+ void Script_NodeClass_SetElement(CFXJSE_Arguments* pArguments);
+ void Script_NodeClass_Ns(CFXJSE_Value* pValue,
+ bool bSetting,
+ XFA_ATTRIBUTE eAttribute);
+ void Script_NodeClass_Model(CFXJSE_Value* pValue,
+ bool bSetting,
+ XFA_ATTRIBUTE eAttribute);
+ void Script_NodeClass_IsContainer(CFXJSE_Value* pValue,
+ bool bSetting,
+ XFA_ATTRIBUTE eAttribute);
+ void Script_NodeClass_IsNull(CFXJSE_Value* pValue,
+ bool bSetting,
+ XFA_ATTRIBUTE eAttribute);
+ void Script_NodeClass_OneOfChild(CFXJSE_Value* pValue,
+ bool bSetting,
+ XFA_ATTRIBUTE eAttribute);
+ void Script_ContainerClass_GetDelta(CFXJSE_Arguments* pArguments);
+ void Script_ContainerClass_GetDeltas(CFXJSE_Arguments* pArguments);
+ void Script_ModelClass_ClearErrorList(CFXJSE_Arguments* pArguments);
+ void Script_ModelClass_CreateNode(CFXJSE_Arguments* pArguments);
+ void Script_ModelClass_IsCompatibleNS(CFXJSE_Arguments* pArguments);
+ void Script_ModelClass_Context(CFXJSE_Value* pValue,
+ bool bSetting,
+ XFA_ATTRIBUTE eAttribute);
+ void Script_ModelClass_AliasNode(CFXJSE_Value* pValue,
+ bool bSetting,
+ XFA_ATTRIBUTE eAttribute);
+ void Script_WsdlConnection_Execute(CFXJSE_Arguments* pArguments);
+ void Script_Delta_Restore(CFXJSE_Arguments* pArguments);
+ void Script_Delta_CurrentValue(CFXJSE_Value* pValue,
+ bool bSetting,
+ XFA_ATTRIBUTE eAttribute);
+ void Script_Delta_SavedValue(CFXJSE_Value* pValue,
+ bool bSetting,
+ XFA_ATTRIBUTE eAttribute);
+ void Script_Delta_Target(CFXJSE_Value* pValue,
+ bool bSetting,
+ XFA_ATTRIBUTE eAttribute);
+ void Script_Attribute_SendAttributeChangeMessage(XFA_ATTRIBUTE eAttribute,
+ bool bScriptModify);
+ void Script_Attribute_Integer(CFXJSE_Value* pValue,
+ bool bSetting,
+ XFA_ATTRIBUTE eAttribute);
+ void Script_Attribute_IntegerRead(CFXJSE_Value* pValue,
+ bool bSetting,
+ XFA_ATTRIBUTE eAttribute);
+ void Script_Attribute_BOOL(CFXJSE_Value* pValue,
+ bool bSetting,
+ XFA_ATTRIBUTE eAttribute);
+ void Script_Attribute_BOOLRead(CFXJSE_Value* pValue,
+ bool bSetting,
+ XFA_ATTRIBUTE eAttribute);
+ void Script_Attribute_String(CFXJSE_Value* pValue,
+ bool bSetting,
+ XFA_ATTRIBUTE eAttribute);
+ void Script_Attribute_StringRead(CFXJSE_Value* pValue,
+ bool bSetting,
+ XFA_ATTRIBUTE eAttribute);
+ void Script_Som_ValidationMessage(CFXJSE_Value* pValue,
+ bool bSetting,
+ XFA_ATTRIBUTE eAttribute);
+ void Script_Field_Length(CFXJSE_Value* pValue,
+ bool bSetting,
+ XFA_ATTRIBUTE eAttribute);
+ void Script_Som_DefaultValue(CFXJSE_Value* pValue,
+ bool bSetting,
+ XFA_ATTRIBUTE eAttribute);
+ void Script_Som_DefaultValue_Read(CFXJSE_Value* pValue,
+ bool bSetting,
+ XFA_ATTRIBUTE eAttribute);
+ void Script_Boolean_Value(CFXJSE_Value* pValue,
+ bool bSetting,
+ XFA_ATTRIBUTE eAttribute);
+ void Script_Som_Message(CFXJSE_Value* pValue,
+ bool bSetting,
+ XFA_SOM_MESSAGETYPE iMessageType);
+ void Script_Som_BorderColor(CFXJSE_Value* pValue,
+ bool bSetting,
+ XFA_ATTRIBUTE eAttribute);
+ void Script_Som_BorderWidth(CFXJSE_Value* pValue,
+ bool bSetting,
+ XFA_ATTRIBUTE eAttribute);
+ void Script_Som_FillColor(CFXJSE_Value* pValue,
+ bool bSetting,
+ XFA_ATTRIBUTE eAttribute);
+ void Script_Som_DataNode(CFXJSE_Value* pValue,
+ bool bSetting,
+ XFA_ATTRIBUTE eAttribute);
+ void Script_Som_FontColor(CFXJSE_Value* pValue,
+ bool bSetting,
+ XFA_ATTRIBUTE eAttribute);
+ void Script_Som_Mandatory(CFXJSE_Value* pValue,
+ bool bSetting,
+ XFA_ATTRIBUTE eAttribute);
+ void Script_Som_MandatoryMessage(CFXJSE_Value* pValue,
+ bool bSetting,
+ XFA_ATTRIBUTE eAttribute);
+ void Script_Som_InstanceIndex(CFXJSE_Value* pValue,
+ bool bSetting,
+ XFA_ATTRIBUTE eAttribute);
+ void Script_Draw_DefaultValue(CFXJSE_Value* pValue,
+ bool bSetting,
+ XFA_ATTRIBUTE eAttribute);
+ void Script_Field_DefaultValue(CFXJSE_Value* pValue,
+ bool bSetting,
+ XFA_ATTRIBUTE eAttribute);
+ void Script_Field_EditValue(CFXJSE_Value* pValue,
+ bool bSetting,
+ XFA_ATTRIBUTE eAttribute);
+ void Script_Field_FormatMessage(CFXJSE_Value* pValue,
+ bool bSetting,
+ XFA_ATTRIBUTE eAttribute);
+ void Script_Field_FormattedValue(CFXJSE_Value* pValue,
+ bool bSetting,
+ XFA_ATTRIBUTE eAttribute);
+ void Script_Field_ParentSubform(CFXJSE_Value* pValue,
+ bool bSetting,
+ XFA_ATTRIBUTE eAttribute);
+ void Script_Field_SelectedIndex(CFXJSE_Value* pValue,
+ bool bSetting,
+ XFA_ATTRIBUTE eAttribute);
+ void Script_Field_ClearItems(CFXJSE_Arguments* pArguments);
+ void Script_Field_ExecEvent(CFXJSE_Arguments* pArguments);
+ void Script_Field_ExecInitialize(CFXJSE_Arguments* pArguments);
+ void Script_Field_DeleteItem(CFXJSE_Arguments* pArguments);
+ void Script_Field_GetSaveItem(CFXJSE_Arguments* pArguments);
+ void Script_Field_BoundItem(CFXJSE_Arguments* pArguments);
+ void Script_Field_GetItemState(CFXJSE_Arguments* pArguments);
+ void Script_Field_ExecCalculate(CFXJSE_Arguments* pArguments);
+ void Script_Field_SetItems(CFXJSE_Arguments* pArguments);
+ void Script_Field_GetDisplayItem(CFXJSE_Arguments* pArguments);
+ void Script_Field_SetItemState(CFXJSE_Arguments* pArguments);
+ void Script_Field_AddItem(CFXJSE_Arguments* pArguments);
+ void Script_Field_ExecValidate(CFXJSE_Arguments* pArguments);
+ void Script_ExclGroup_DefaultAndRawValue(CFXJSE_Value* pValue,
+ bool bSetting,
+ XFA_ATTRIBUTE eAttribute);
+ void Script_ExclGroup_ErrorText(CFXJSE_Value* pValue,
+ bool bSetting,
+ XFA_ATTRIBUTE eAttribute);
+ void Script_ExclGroup_Transient(CFXJSE_Value* pValue,
+ bool bSetting,
+ XFA_ATTRIBUTE eAttribute);
+ void Script_ExclGroup_ExecEvent(CFXJSE_Arguments* pArguments);
+ void Script_ExclGroup_SelectedMember(CFXJSE_Arguments* pArguments);
+ void Script_ExclGroup_ExecInitialize(CFXJSE_Arguments* pArguments);
+ void Script_ExclGroup_ExecCalculate(CFXJSE_Arguments* pArguments);
+ void Script_ExclGroup_ExecValidate(CFXJSE_Arguments* pArguments);
+ void Script_Subform_InstanceManager(CFXJSE_Value* pValue,
+ bool bSetting,
+ XFA_ATTRIBUTE eAttribute);
+ void Script_Subform_Locale(CFXJSE_Value* pValue,
+ bool bSetting,
+ XFA_ATTRIBUTE eAttribute);
+ void Script_Subform_ExecEvent(CFXJSE_Arguments* pArguments);
+ void Script_Subform_ExecInitialize(CFXJSE_Arguments* pArguments);
+ void Script_Subform_ExecCalculate(CFXJSE_Arguments* pArguments);
+ void Script_Subform_ExecValidate(CFXJSE_Arguments* pArguments);
+ void Script_Subform_GetInvalidObjects(CFXJSE_Arguments* pArguments);
+
+ int32_t Subform_and_SubformSet_InstanceIndex();
+ void Script_Template_FormNodes(CFXJSE_Arguments* pArguments);
+ void Script_Template_Remerge(CFXJSE_Arguments* pArguments);
+ void Script_Template_ExecInitialize(CFXJSE_Arguments* pArguments);
+ void Script_Template_CreateNode(CFXJSE_Arguments* pArguments);
+ void Script_Template_Recalculate(CFXJSE_Arguments* pArguments);
+ void Script_Template_ExecCalculate(CFXJSE_Arguments* pArguments);
+ void Script_Template_ExecValidate(CFXJSE_Arguments* pArguments);
+ void Script_Manifest_Evaluate(CFXJSE_Arguments* pArguments);
+ void Script_InstanceManager_Count(CFXJSE_Value* pValue,
+ bool bSetting,
+ XFA_ATTRIBUTE eAttribute);
+ void Script_InstanceManager_Max(CFXJSE_Value* pValue,
+ bool bSetting,
+ XFA_ATTRIBUTE eAttribute);
+ void Script_InstanceManager_Min(CFXJSE_Value* pValue,
+ bool bSetting,
+ XFA_ATTRIBUTE eAttribute);
+ void Script_InstanceManager_MoveInstance(CFXJSE_Arguments* pArguments);
+ void Script_InstanceManager_RemoveInstance(CFXJSE_Arguments* pArguments);
+ void Script_InstanceManager_SetInstances(CFXJSE_Arguments* pArguments);
+ void Script_InstanceManager_AddInstance(CFXJSE_Arguments* pArguments);
+ void Script_InstanceManager_InsertInstance(CFXJSE_Arguments* pArguments);
+ int32_t InstanceManager_SetInstances(int32_t iCount);
+ int32_t InstanceManager_MoveInstance(int32_t iTo, int32_t iFrom);
+ void Script_Occur_Max(CFXJSE_Value* pValue,
+ bool bSetting,
+ XFA_ATTRIBUTE eAttribute);
+ void Script_Occur_Min(CFXJSE_Value* pValue,
+ bool bSetting,
+ XFA_ATTRIBUTE eAttribute);
+ void Script_Desc_Metadata(CFXJSE_Arguments* pArguments);
+ void Script_Form_FormNodes(CFXJSE_Arguments* pArguments);
+ void Script_Form_Remerge(CFXJSE_Arguments* pArguments);
+ void Script_Form_ExecInitialize(CFXJSE_Arguments* pArguments);
+ void Script_Form_Recalculate(CFXJSE_Arguments* pArguments);
+ void Script_Form_ExecCalculate(CFXJSE_Arguments* pArguments);
+ void Script_Form_ExecValidate(CFXJSE_Arguments* pArguments);
+ void Script_Form_Checksum(CFXJSE_Value* pValue,
+ bool bSetting,
+ XFA_ATTRIBUTE eAttribute);
+ void Script_Packet_GetAttribute(CFXJSE_Arguments* pArguments);
+ void Script_Packet_SetAttribute(CFXJSE_Arguments* pArguments);
+ void Script_Packet_RemoveAttribute(CFXJSE_Arguments* pArguments);
+ void Script_Packet_Content(CFXJSE_Value* pValue,
+ bool bSetting,
+ XFA_ATTRIBUTE eAttribute);
+ void Script_Source_Next(CFXJSE_Arguments* pArguments);
+ void Script_Source_CancelBatch(CFXJSE_Arguments* pArguments);
+ void Script_Source_First(CFXJSE_Arguments* pArguments);
+ void Script_Source_UpdateBatch(CFXJSE_Arguments* pArguments);
+ void Script_Source_Previous(CFXJSE_Arguments* pArguments);
+ void Script_Source_IsBOF(CFXJSE_Arguments* pArguments);
+ void Script_Source_IsEOF(CFXJSE_Arguments* pArguments);
+ void Script_Source_Cancel(CFXJSE_Arguments* pArguments);
+ void Script_Source_Update(CFXJSE_Arguments* pArguments);
+ void Script_Source_Open(CFXJSE_Arguments* pArguments);
+ void Script_Source_Delete(CFXJSE_Arguments* pArguments);
+ void Script_Source_AddNew(CFXJSE_Arguments* pArguments);
+ void Script_Source_Requery(CFXJSE_Arguments* pArguments);
+ void Script_Source_Resync(CFXJSE_Arguments* pArguments);
+ void Script_Source_Close(CFXJSE_Arguments* pArguments);
+ void Script_Source_Last(CFXJSE_Arguments* pArguments);
+ void Script_Source_HasDataChanged(CFXJSE_Arguments* pArguments);
+ void Script_Source_Db(CFXJSE_Value* pValue,
+ bool bSetting,
+ XFA_ATTRIBUTE eAttribute);
+ void Script_Xfa_This(CFXJSE_Value* pValue,
+ bool bSetting,
+ XFA_ATTRIBUTE eAttribute);
+ void Script_Handler_Version(CFXJSE_Value* pValue,
+ bool bSetting,
+ XFA_ATTRIBUTE eAttribute);
+ void Script_SubmitFormat_Mode(CFXJSE_Value* pValue,
+ bool bSetting,
+ XFA_ATTRIBUTE eAttribute);
+ void Script_Extras_Type(CFXJSE_Value* pValue,
+ bool bSetting,
+ XFA_ATTRIBUTE eAttribute);
+ void Script_Encrypt_Format(CFXJSE_Value* pValue,
+ bool bSetting,
+ XFA_ATTRIBUTE eAttribute);
+ void Script_Script_Stateless(CFXJSE_Value* pValue,
+ bool bSetting,
+ XFA_ATTRIBUTE eAttribute);
+
+ private:
+ friend class CXFA_Document;
+
+ CXFA_Node(CXFA_Document* pDoc,
+ uint16_t ePacket,
+ XFA_ObjectType oType,
+ XFA_Element eType,
+ const CFX_WideStringC& elementName);
+ ~CXFA_Node() override;
+
+ bool HasFlag(XFA_NodeFlag dwFlag) const;
+ CXFA_Node* Deprecated_GetPrevSibling();
+ bool SetValue(XFA_ATTRIBUTE eAttr,
+ XFA_ATTRIBUTETYPE eType,
+ void* pValue,
+ bool bNotify);
+ bool GetValue(XFA_ATTRIBUTE eAttr,
+ XFA_ATTRIBUTETYPE eType,
+ bool bUseDefault,
+ void*& pValue);
+ void OnRemoved(bool bNotify);
+ void OnChanging(XFA_ATTRIBUTE eAttr, bool bNotify);
+ void OnChanged(XFA_ATTRIBUTE eAttr, bool bNotify, bool bScriptModify);
+ int32_t execSingleEventByName(const CFX_WideStringC& wsEventName,
+ XFA_Element eType);
+ bool SetScriptContent(const CFX_WideString& wsContent,
+ const CFX_WideString& wsXMLValue,
+ bool bNotify = true,
+ bool bScriptModify = false,
+ bool bSyncData = true);
+ CFX_WideString GetScriptContent(bool bScriptModify = false);
+ XFA_MAPMODULEDATA* CreateMapModuleData();
+ XFA_MAPMODULEDATA* GetMapModuleData() const;
+ void SetMapModuleValue(void* pKey, void* pValue);
+ bool GetMapModuleValue(void* pKey, void*& pValue);
+ void SetMapModuleString(void* pKey, const CFX_WideStringC& wsValue);
+ bool GetMapModuleString(void* pKey, CFX_WideStringC& wsValue);
+ void SetMapModuleBuffer(
+ void* pKey,
+ void* pValue,
+ int32_t iBytes,
+ XFA_MAPDATABLOCKCALLBACKINFO* pCallbackInfo = nullptr);
+ bool GetMapModuleBuffer(void* pKey,
+ void*& pValue,
+ int32_t& iBytes,
+ bool bProtoAlso = true) const;
+ bool HasMapModuleKey(void* pKey, bool bProtoAlso = false);
+ void RemoveMapModuleKey(void* pKey = nullptr);
+ void MergeAllData(void* pDstModule);
+ void MoveBufferMapData(CXFA_Node* pDstModule, void* pKey);
+ void MoveBufferMapData(CXFA_Node* pSrcModule,
+ CXFA_Node* pDstModule,
+ void* pKey,
+ bool bRecursive = false);
+
+ CXFA_Node* m_pNext;
+ CXFA_Node* m_pChild;
+ CXFA_Node* m_pLastChild;
+ CXFA_Node* m_pParent;
+ CFDE_XMLNode* m_pXMLNode;
+ uint16_t m_ePacket;
+ uint16_t m_uNodeFlags;
+ uint32_t m_dwNameHash;
+ CXFA_Node* m_pAuxNode;
+ XFA_MAPMODULEDATA* m_pMapModuleData;
+
+ private:
+ void ThrowMissingPropertyException(const CFX_WideString& obj,
+ const CFX_WideString& prop) const;
+ void ThrowTooManyOccurancesException(const CFX_WideString& obj) const;
+};
+
+#endif // XFA_FXFA_PARSER_CXFA_NODE_H_
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_nodehelper.cpp b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_nodehelper.cpp
index 2290892318b..abfca846093 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_nodehelper.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_nodehelper.cpp
@@ -8,9 +8,9 @@
#include "core/fxcrt/fx_ext.h"
#include "xfa/fxfa/parser/cxfa_document.h"
+#include "xfa/fxfa/parser/cxfa_localemgr.h"
+#include "xfa/fxfa/parser/cxfa_node.h"
#include "xfa/fxfa/parser/cxfa_scriptcontext.h"
-#include "xfa/fxfa/parser/xfa_localemgr.h"
-#include "xfa/fxfa/parser/xfa_object.h"
#include "xfa/fxfa/parser/xfa_resolvenode_rs.h"
#include "xfa/fxfa/parser/xfa_utils.h"
@@ -25,23 +25,20 @@ CXFA_NodeHelper::CXFA_NodeHelper()
CXFA_NodeHelper::~CXFA_NodeHelper() {}
CXFA_Node* CXFA_NodeHelper::ResolveNodes_GetOneChild(CXFA_Node* parent,
- const FX_WCHAR* pwsName,
+ const wchar_t* pwsName,
bool bIsClassName) {
- if (!parent) {
+ if (!parent)
return nullptr;
- }
- CXFA_NodeArray siblings;
+
+ std::vector<CXFA_Node*> siblings;
uint32_t uNameHash = FX_HashCode_GetW(CFX_WideStringC(pwsName), false);
NodeAcc_TraverseAnySiblings(parent, uNameHash, &siblings, bIsClassName);
- if (siblings.GetSize() == 0) {
- return nullptr;
- }
- return siblings[0];
+ return !siblings.empty() ? siblings[0] : nullptr;
}
int32_t CXFA_NodeHelper::CountSiblings(CXFA_Node* pNode,
XFA_LOGIC_TYPE eLogicType,
- CXFA_NodeArray* pSiblings,
+ std::vector<CXFA_Node*>* pSiblings,
bool bIsClassName) {
if (!pNode)
return 0;
@@ -52,99 +49,81 @@ int32_t CXFA_NodeHelper::CountSiblings(CXFA_Node* pNode,
parent->GetElementType(), pNode->GetElementType(), XFA_XDPPACKET_UNKNOWN);
if (!pProperty && eLogicType == XFA_LOGIC_Transparent) {
parent = ResolveNodes_GetParent(pNode, XFA_LOGIC_Transparent);
- if (!parent) {
+ if (!parent)
return 0;
- }
}
if (bIsClassName) {
return NodeAcc_TraverseSiblings(parent, pNode->GetClassHashCode(),
pSiblings, eLogicType, bIsClassName);
- } else {
- return NodeAcc_TraverseSiblings(parent, pNode->GetNameHash(), pSiblings,
- eLogicType, bIsClassName);
}
+ return NodeAcc_TraverseSiblings(parent, pNode->GetNameHash(), pSiblings,
+ eLogicType, bIsClassName);
}
-int32_t CXFA_NodeHelper::NodeAcc_TraverseAnySiblings(CXFA_Node* parent,
- uint32_t dNameHash,
- CXFA_NodeArray* pSiblings,
- bool bIsClassName) {
- if (!parent || !pSiblings) {
+int32_t CXFA_NodeHelper::NodeAcc_TraverseAnySiblings(
+ CXFA_Node* parent,
+ uint32_t dNameHash,
+ std::vector<CXFA_Node*>* pSiblings,
+ bool bIsClassName) {
+ if (!parent || !pSiblings)
return 0;
- }
+
int32_t nCount = 0;
- int32_t i = 0;
- CXFA_NodeArray properties;
- parent->GetNodeList(properties, XFA_NODEFILTER_Properties);
- int32_t nProperties = properties.GetSize();
- for (i = 0; i < nProperties; ++i) {
- CXFA_Node* child = properties[i];
+ for (CXFA_Node* child : parent->GetNodeList(XFA_NODEFILTER_Properties)) {
if (bIsClassName) {
if (child->GetClassHashCode() == dNameHash) {
- pSiblings->Add(child);
+ pSiblings->push_back(child);
nCount++;
}
} else {
if (child->GetNameHash() == dNameHash) {
- pSiblings->Add(child);
+ pSiblings->push_back(child);
nCount++;
}
}
- if (nCount > 0) {
+ if (nCount > 0)
return nCount;
- }
+
nCount +=
NodeAcc_TraverseAnySiblings(child, dNameHash, pSiblings, bIsClassName);
}
- CXFA_NodeArray children;
- parent->GetNodeList(children, XFA_NODEFILTER_Children);
- int32_t nChildren = children.GetSize();
- for (i = 0; i < nChildren; i++) {
- CXFA_Node* child = children[i];
+ for (CXFA_Node* child : parent->GetNodeList(XFA_NODEFILTER_Children)) {
if (bIsClassName) {
if (child->GetClassHashCode() == dNameHash) {
- if (pSiblings) {
- pSiblings->Add(child);
- }
+ pSiblings->push_back(child);
nCount++;
}
} else {
if (child->GetNameHash() == dNameHash) {
- if (pSiblings) {
- pSiblings->Add(child);
- }
+ pSiblings->push_back(child);
nCount++;
}
}
- if (nCount > 0) {
+ if (nCount > 0)
return nCount;
- }
+
nCount +=
NodeAcc_TraverseAnySiblings(child, dNameHash, pSiblings, bIsClassName);
}
return nCount;
}
-int32_t CXFA_NodeHelper::NodeAcc_TraverseSiblings(CXFA_Node* parent,
- uint32_t dNameHash,
- CXFA_NodeArray* pSiblings,
- XFA_LOGIC_TYPE eLogicType,
- bool bIsClassName,
- bool bIsFindProperty) {
- if (!parent || !pSiblings) {
+int32_t CXFA_NodeHelper::NodeAcc_TraverseSiblings(
+ CXFA_Node* parent,
+ uint32_t dNameHash,
+ std::vector<CXFA_Node*>* pSiblings,
+ XFA_LOGIC_TYPE eLogicType,
+ bool bIsClassName,
+ bool bIsFindProperty) {
+ if (!parent || !pSiblings)
return 0;
- }
+
int32_t nCount = 0;
- int32_t i = 0;
if (bIsFindProperty) {
- CXFA_NodeArray properties;
- parent->GetNodeList(properties, XFA_NODEFILTER_Properties);
- int32_t nProperties = properties.GetSize();
- for (i = 0; i < nProperties; ++i) {
- CXFA_Node* child = properties[i];
+ for (CXFA_Node* child : parent->GetNodeList(XFA_NODEFILTER_Properties)) {
if (bIsClassName) {
if (child->GetClassHashCode() == dNameHash) {
- pSiblings->Add(child);
+ pSiblings->push_back(child);
nCount++;
}
} else {
@@ -152,7 +131,7 @@ int32_t CXFA_NodeHelper::NodeAcc_TraverseSiblings(CXFA_Node* parent,
if (child->GetElementType() != XFA_Element::PageSet &&
child->GetElementType() != XFA_Element::Extras &&
child->GetElementType() != XFA_Element::Items) {
- pSiblings->Add(child);
+ pSiblings->push_back(child);
nCount++;
}
}
@@ -163,36 +142,27 @@ int32_t CXFA_NodeHelper::NodeAcc_TraverseSiblings(CXFA_Node* parent,
eLogicType, bIsClassName, false);
}
}
- if (nCount > 0) {
+ if (nCount > 0)
return nCount;
- }
}
- CXFA_NodeArray children;
- parent->GetNodeList(children, XFA_NODEFILTER_Children);
- int32_t nChildren = children.GetSize();
- for (i = 0; i < nChildren; i++) {
- CXFA_Node* child = children[i];
- if (child->GetElementType() == XFA_Element::Variables) {
+ for (CXFA_Node* child : parent->GetNodeList(XFA_NODEFILTER_Children)) {
+ if (child->GetElementType() == XFA_Element::Variables)
continue;
- }
+
if (bIsClassName) {
if (child->GetClassHashCode() == dNameHash) {
- if (pSiblings) {
- pSiblings->Add(child);
- }
+ pSiblings->push_back(child);
nCount++;
}
} else {
if (child->GetNameHash() == dNameHash) {
- if (pSiblings) {
- pSiblings->Add(child);
- }
+ pSiblings->push_back(child);
nCount++;
}
}
- if (eLogicType == XFA_LOGIC_NoTransparent) {
+ if (eLogicType == XFA_LOGIC_NoTransparent)
continue;
- }
+
if (NodeIsTransparent(child) &&
child->GetElementType() != XFA_Element::PageSet) {
nCount += NodeAcc_TraverseSiblings(child, dNameHash, pSiblings,
@@ -245,7 +215,7 @@ int32_t CXFA_NodeHelper::GetIndex(CXFA_Node* pNode,
if (bIsClassIndex) {
dwHashName = pNode->GetClassHashCode();
}
- CXFA_NodeArray siblings;
+ std::vector<CXFA_Node*> siblings;
int32_t iSize = NodeAcc_TraverseSiblings(parent, dwHashName, &siblings,
eLogicType, bIsClassIndex);
for (int32_t i = 0; i < iSize; ++i) {
@@ -316,7 +286,7 @@ bool CXFA_NodeHelper::CreateNode_ForCondition(CFX_WideString& wsCondition) {
if (wsCondition.GetAt(0) == '[') {
int32_t i = 1;
for (; i < iLen; ++i) {
- FX_WCHAR ch = wsCondition[i];
+ wchar_t ch = wsCondition[i];
if (ch == ' ') {
continue;
}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_nodehelper.h b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_nodehelper.h
index 5097feabacd..cf6c2f17a0b 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_nodehelper.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_nodehelper.h
@@ -7,7 +7,8 @@
#ifndef XFA_FXFA_PARSER_CXFA_NODEHELPER_H_
#define XFA_FXFA_PARSER_CXFA_NODEHELPER_H_
-#include "xfa/fxfa/parser/xfa_object.h"
+#include <vector>
+
#include "xfa/fxfa/parser/xfa_resolvenode_rs.h"
class CXFA_ScriptContext;
@@ -23,7 +24,7 @@ class CXFA_NodeHelper {
~CXFA_NodeHelper();
CXFA_Node* ResolveNodes_GetOneChild(CXFA_Node* parent,
- const FX_WCHAR* pwsName,
+ const wchar_t* pwsName,
bool bIsClassName = false);
CXFA_Node* ResolveNodes_GetParent(
CXFA_Node* pNode,
@@ -31,17 +32,17 @@ class CXFA_NodeHelper {
int32_t NodeAcc_TraverseSiblings(CXFA_Node* parent,
uint32_t dNameHash,
- CXFA_NodeArray* pSiblings,
+ std::vector<CXFA_Node*>* pSiblings,
XFA_LOGIC_TYPE eLogicType,
bool bIsClassName = false,
bool bIsFindProperty = true);
int32_t NodeAcc_TraverseAnySiblings(CXFA_Node* parent,
uint32_t dNameHash,
- CXFA_NodeArray* pSiblings,
+ std::vector<CXFA_Node*>* pSiblings,
bool bIsClassName = false);
int32_t CountSiblings(CXFA_Node* pNode,
XFA_LOGIC_TYPE eLogicType,
- CXFA_NodeArray* pSiblings,
+ std::vector<CXFA_Node*>* pSiblings,
bool bIsClassName = false);
int32_t GetIndex(CXFA_Node* pNode,
XFA_LOGIC_TYPE eLogicType = XFA_LOGIC_NoTransparent,
@@ -60,7 +61,6 @@ class CXFA_NodeHelper {
void SetCreateNodeType(CXFA_Node* refNode);
bool NodeIsProperty(CXFA_Node* refNode);
- public:
XFA_Element m_eLastCreateType;
CXFA_Node* m_pCreateParent;
int32_t m_iCreateCount;
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_nodelist.cpp b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_nodelist.cpp
index 97c531f33b6..86efb29eba6 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_nodelist.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_nodelist.cpp
@@ -4,12 +4,13 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/fxfa/parser/xfa_object.h"
+#include "xfa/fxfa/parser/cxfa_nodelist.h"
#include <memory>
#include "core/fxcrt/fx_ext.h"
#include "xfa/fxfa/parser/cxfa_document.h"
+#include "xfa/fxfa/parser/cxfa_node.h"
#include "xfa/fxfa/parser/cxfa_scriptcontext.h"
CXFA_NodeList::CXFA_NodeList(CXFA_Document* pDocument)
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_nodelist.h b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_nodelist.h
new file mode 100644
index 00000000000..6fffb7bb67b
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_nodelist.h
@@ -0,0 +1,40 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef XFA_FXFA_PARSER_CXFA_NODELIST_H_
+#define XFA_FXFA_PARSER_CXFA_NODELIST_H_
+
+#include "xfa/fxfa/fxfa_basic.h"
+#include "xfa/fxfa/parser/cxfa_object.h"
+
+class CXFA_Node;
+class CFXJSE_Arguments;
+class CFXJSE_Value;
+
+class CXFA_NodeList : public CXFA_Object {
+ public:
+ explicit CXFA_NodeList(CXFA_Document* pDocument);
+ ~CXFA_NodeList() override;
+
+ CXFA_Node* NamedItem(const CFX_WideStringC& wsName);
+ virtual int32_t GetLength() = 0;
+ virtual bool Append(CXFA_Node* pNode) = 0;
+ virtual bool Insert(CXFA_Node* pNewNode, CXFA_Node* pBeforeNode) = 0;
+ virtual bool Remove(CXFA_Node* pNode) = 0;
+ virtual CXFA_Node* Item(int32_t iIndex) = 0;
+
+ void Script_ListClass_Append(CFXJSE_Arguments* pArguments);
+ void Script_ListClass_Insert(CFXJSE_Arguments* pArguments);
+ void Script_ListClass_Remove(CFXJSE_Arguments* pArguments);
+ void Script_ListClass_Item(CFXJSE_Arguments* pArguments);
+
+ void Script_TreelistClass_NamedItem(CFXJSE_Arguments* pArguments);
+ void Script_ListClass_Length(CFXJSE_Value* pValue,
+ bool bSetting,
+ XFA_ATTRIBUTE eAttribute);
+};
+
+#endif // XFA_FXFA_PARSER_CXFA_NODELIST_H_
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_nodelocale.cpp b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_nodelocale.cpp
new file mode 100644
index 00000000000..78b0cef2782
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_nodelocale.cpp
@@ -0,0 +1,175 @@
+// 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
+
+#include "xfa/fxfa/parser/cxfa_nodelocale.h"
+
+#include <utility>
+
+#include "core/fxcrt/xml/cxml_element.h"
+#include "xfa/fxfa/parser/cxfa_document.h"
+#include "xfa/fxfa/parser/cxfa_localemgr.h"
+#include "xfa/fxfa/parser/cxfa_node.h"
+#include "xfa/fxfa/parser/cxfa_timezoneprovider.h"
+#include "xfa/fxfa/parser/xfa_utils.h"
+
+namespace {
+
+const wchar_t g_FX_Percent[] = L"z,zzz,zzz,zzz,zzz,zzz%";
+const wchar_t g_FX_Currency[] = L"$z,zzz,zzz,zzz,zzz,zz9.99";
+const wchar_t g_FX_Decimal[] = L"z,zzz,zzz,zzz,zzz,zz9.zzz";
+const wchar_t g_FX_Integer[] = L"z,zzz,zzz,zzz,zzz,zzz";
+
+} // namespace
+
+CFX_WideString XFA_PatternToString(FX_LOCALENUMSUBCATEGORY category) {
+ switch (category) {
+ case FX_LOCALENUMPATTERN_Percent:
+ return g_FX_Percent;
+ case FX_LOCALENUMPATTERN_Currency:
+ return g_FX_Currency;
+ case FX_LOCALENUMPATTERN_Decimal:
+ return g_FX_Decimal;
+ case FX_LOCALENUMPATTERN_Integer:
+ return g_FX_Integer;
+ }
+ return CFX_WideString();
+}
+
+CXFA_NodeLocale::CXFA_NodeLocale(CXFA_Node* pLocale) : m_pLocale(pLocale) {}
+
+CXFA_NodeLocale::~CXFA_NodeLocale() {}
+
+CFX_WideString CXFA_NodeLocale::GetName() const {
+ return CFX_WideString(m_pLocale ? m_pLocale->GetCData(XFA_ATTRIBUTE_Name)
+ : nullptr);
+}
+
+CFX_WideString CXFA_NodeLocale::GetNumbericSymbol(
+ FX_LOCALENUMSYMBOL eType) const {
+ switch (eType) {
+ case FX_LOCALENUMSYMBOL_Decimal:
+ return GetSymbol(XFA_Element::NumberSymbols, L"decimal");
+ case FX_LOCALENUMSYMBOL_Grouping:
+ return GetSymbol(XFA_Element::NumberSymbols, L"grouping");
+ case FX_LOCALENUMSYMBOL_Percent:
+ return GetSymbol(XFA_Element::NumberSymbols, L"percent");
+ case FX_LOCALENUMSYMBOL_Minus:
+ return GetSymbol(XFA_Element::NumberSymbols, L"minus");
+ case FX_LOCALENUMSYMBOL_Zero:
+ return GetSymbol(XFA_Element::NumberSymbols, L"zero");
+ case FX_LOCALENUMSYMBOL_CurrencySymbol:
+ return GetSymbol(XFA_Element::CurrencySymbols, L"symbol");
+ case FX_LOCALENUMSYMBOL_CurrencyName:
+ return GetSymbol(XFA_Element::CurrencySymbols, L"isoname");
+ }
+ return CFX_WideString();
+}
+
+CFX_WideString CXFA_NodeLocale::GetDateTimeSymbols() const {
+ CXFA_Node* pSymbols =
+ m_pLocale ? m_pLocale->GetChild(0, XFA_Element::DateTimeSymbols)
+ : nullptr;
+ return pSymbols ? pSymbols->GetContent() : CFX_WideString();
+}
+
+CFX_WideString CXFA_NodeLocale::GetMonthName(int32_t nMonth, bool bAbbr) const {
+ return GetCalendarSymbol(XFA_Element::MonthNames, nMonth, bAbbr);
+}
+
+CFX_WideString CXFA_NodeLocale::GetDayName(int32_t nWeek, bool bAbbr) const {
+ return GetCalendarSymbol(XFA_Element::DayNames, nWeek, bAbbr);
+}
+
+CFX_WideString CXFA_NodeLocale::GetMeridiemName(bool bAM) const {
+ return GetCalendarSymbol(XFA_Element::MeridiemNames, bAM ? 0 : 1, false);
+}
+
+FX_TIMEZONE CXFA_NodeLocale::GetTimeZone() const {
+ return CXFA_TimeZoneProvider().GetTimeZone();
+}
+
+CFX_WideString CXFA_NodeLocale::GetEraName(bool bAD) const {
+ return GetCalendarSymbol(XFA_Element::EraNames, bAD ? 1 : 0, false);
+}
+
+CFX_WideString CXFA_NodeLocale::GetDatePattern(
+ FX_LOCALEDATETIMESUBCATEGORY eType) const {
+ switch (eType) {
+ case FX_LOCALEDATETIMESUBCATEGORY_Short:
+ return GetSymbol(XFA_Element::DatePatterns, L"short");
+ case FX_LOCALEDATETIMESUBCATEGORY_Medium:
+ case FX_LOCALEDATETIMESUBCATEGORY_Default:
+ return GetSymbol(XFA_Element::DatePatterns, L"med");
+ case FX_LOCALEDATETIMESUBCATEGORY_Full:
+ return GetSymbol(XFA_Element::DatePatterns, L"full");
+ case FX_LOCALEDATETIMESUBCATEGORY_Long:
+ return GetSymbol(XFA_Element::DatePatterns, L"long");
+ }
+ return CFX_WideString();
+}
+
+CFX_WideString CXFA_NodeLocale::GetTimePattern(
+ FX_LOCALEDATETIMESUBCATEGORY eType) const {
+ switch (eType) {
+ case FX_LOCALEDATETIMESUBCATEGORY_Short:
+ return GetSymbol(XFA_Element::TimePatterns, L"short");
+ case FX_LOCALEDATETIMESUBCATEGORY_Medium:
+ case FX_LOCALEDATETIMESUBCATEGORY_Default:
+ return GetSymbol(XFA_Element::TimePatterns, L"med");
+ case FX_LOCALEDATETIMESUBCATEGORY_Full:
+ return GetSymbol(XFA_Element::TimePatterns, L"full");
+ case FX_LOCALEDATETIMESUBCATEGORY_Long:
+ return GetSymbol(XFA_Element::TimePatterns, L"long");
+ }
+ return CFX_WideString();
+}
+
+CFX_WideString CXFA_NodeLocale::GetNumPattern(
+ FX_LOCALENUMSUBCATEGORY eType) const {
+ return XFA_PatternToString(eType);
+}
+
+CXFA_Node* CXFA_NodeLocale::GetNodeByName(CXFA_Node* pParent,
+ const CFX_WideStringC& wsName) const {
+ CXFA_Node* pChild =
+ pParent ? pParent->GetNodeItem(XFA_NODEITEM_FirstChild) : nullptr;
+ while (pChild) {
+ CFX_WideString wsChild;
+ if (pChild->GetAttribute(XFA_ATTRIBUTE_Name, wsChild)) {
+ if (wsChild == wsName)
+ return pChild;
+ }
+ pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling);
+ }
+ return nullptr;
+}
+
+CFX_WideString CXFA_NodeLocale::GetSymbol(
+ XFA_Element eElement,
+ const CFX_WideStringC& symbol_type) const {
+ CXFA_Node* pSymbols = m_pLocale ? m_pLocale->GetChild(0, eElement) : nullptr;
+ CXFA_Node* pSymbol = GetNodeByName(pSymbols, symbol_type);
+ return pSymbol ? pSymbol->GetContent() : CFX_WideString();
+}
+
+CFX_WideString CXFA_NodeLocale::GetCalendarSymbol(XFA_Element eElement,
+ int index,
+ bool bAbbr) const {
+ CXFA_Node* pCalendar =
+ m_pLocale ? m_pLocale->GetChild(0, XFA_Element::CalendarSymbols)
+ : nullptr;
+ if (!pCalendar)
+ return CFX_WideString();
+
+ CXFA_Node* pNode = pCalendar->GetFirstChildByClass(eElement);
+ for (; pNode; pNode = pNode->GetNextSameClassSibling(eElement)) {
+ if (pNode->GetBoolean(XFA_ATTRIBUTE_Abbr) == bAbbr) {
+ CXFA_Node* pSymbol = pNode->GetChild(index, XFA_Element::Unknown);
+ return pSymbol ? pSymbol->GetContent() : CFX_WideString();
+ }
+ }
+ return CFX_WideString();
+}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_nodelocale.h b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_nodelocale.h
new file mode 100644
index 00000000000..2465650b473
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_nodelocale.h
@@ -0,0 +1,53 @@
+// 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 XFA_FXFA_PARSER_CXFA_NODELOCALE_H_
+#define XFA_FXFA_PARSER_CXFA_NODELOCALE_H_
+
+#include <memory>
+
+#include "core/fxcrt/ifx_locale.h"
+#include "xfa/fxfa/fxfa_basic.h"
+
+class CXFA_Node;
+
+CFX_WideString XFA_PatternToString(FX_LOCALENUMSUBCATEGORY category);
+
+class CXFA_NodeLocale : public IFX_Locale {
+ public:
+ explicit CXFA_NodeLocale(CXFA_Node* pLocale);
+ ~CXFA_NodeLocale() override;
+
+ // IFX_Locale
+ CFX_WideString GetName() const override;
+ CFX_WideString GetNumbericSymbol(FX_LOCALENUMSYMBOL eType) const override;
+
+ CFX_WideString GetDateTimeSymbols() const override;
+ CFX_WideString GetMonthName(int32_t nMonth, bool bAbbr) const override;
+ CFX_WideString GetDayName(int32_t nWeek, bool bAbbr) const override;
+ CFX_WideString GetMeridiemName(bool bAM) const override;
+ FX_TIMEZONE GetTimeZone() const override;
+ CFX_WideString GetEraName(bool bAD) const override;
+
+ CFX_WideString GetDatePattern(
+ FX_LOCALEDATETIMESUBCATEGORY eType) const override;
+ CFX_WideString GetTimePattern(
+ FX_LOCALEDATETIMESUBCATEGORY eType) const override;
+ CFX_WideString GetNumPattern(FX_LOCALENUMSUBCATEGORY eType) const override;
+
+ private:
+ CXFA_Node* GetNodeByName(CXFA_Node* pParent,
+ const CFX_WideStringC& wsName) const;
+ CFX_WideString GetSymbol(XFA_Element eElement,
+ const CFX_WideStringC& symbol_type) const;
+ CFX_WideString GetCalendarSymbol(XFA_Element eElement,
+ int index,
+ bool bAbbr) const;
+
+ CXFA_Node* const m_pLocale;
+};
+
+#endif // XFA_FXFA_PARSER_CXFA_NODELOCALE_H_
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_object.cpp b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_object.cpp
index c8cd354b485..9bbee4ec758 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_object.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_object.cpp
@@ -4,12 +4,14 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/fxfa/parser/xfa_object.h"
+#include "xfa/fxfa/parser/cxfa_object.h"
#include "core/fxcrt/fx_ext.h"
#include "fxjs/cfxjse_value.h"
#include "xfa/fxfa/app/xfa_ffnotify.h"
#include "xfa/fxfa/parser/cxfa_document.h"
+#include "xfa/fxfa/parser/cxfa_node.h"
+#include "xfa/fxfa/parser/cxfa_nodelist.h"
CXFA_Object::CXFA_Object(CXFA_Document* pDocument,
XFA_ObjectType objectType,
@@ -23,18 +25,6 @@ CXFA_Object::CXFA_Object(CXFA_Document* pDocument,
CXFA_Object::~CXFA_Object() {}
-CFX_WideStringC CXFA_Object::GetClassName() const {
- return m_elementName;
-}
-
-uint32_t CXFA_Object::GetClassHashCode() const {
- return m_elementNameHash;
-}
-
-XFA_Element CXFA_Object::GetElementType() const {
- return m_elementType;
-}
-
void CXFA_Object::Script_ObjectClass_ClassName(CFXJSE_Value* pValue,
bool bSetting,
XFA_ATTRIBUTE eAttribute) {
@@ -63,7 +53,7 @@ void CXFA_Object::ThrowArgumentMismatchException() const {
ThrowException(L"Argument mismatch in property or function argument.");
}
-void CXFA_Object::ThrowException(const FX_WCHAR* str, ...) const {
+void CXFA_Object::ThrowException(const wchar_t* str, ...) const {
CFX_WideString wsMessage;
va_list arg_ptr;
va_start(arg_ptr, str);
@@ -71,3 +61,27 @@ void CXFA_Object::ThrowException(const FX_WCHAR* str, ...) const {
va_end(arg_ptr);
FXJSE_ThrowMessage(wsMessage.UTF8Encode().AsStringC());
}
+
+CXFA_Node* CXFA_Object::AsNode() {
+ return IsNode() ? static_cast<CXFA_Node*>(this) : nullptr;
+}
+
+CXFA_NodeList* CXFA_Object::AsNodeList() {
+ return IsNodeList() ? static_cast<CXFA_NodeList*>(this) : nullptr;
+}
+
+const CXFA_Node* CXFA_Object::AsNode() const {
+ return IsNode() ? static_cast<const CXFA_Node*>(this) : nullptr;
+}
+
+const CXFA_NodeList* CXFA_Object::AsNodeList() const {
+ return IsNodeList() ? static_cast<const CXFA_NodeList*>(this) : nullptr;
+}
+
+CXFA_Node* ToNode(CXFA_Object* pObj) {
+ return pObj ? pObj->AsNode() : nullptr;
+}
+
+const CXFA_Node* ToNode(const CXFA_Object* pObj) {
+ return pObj ? pObj->AsNode() : nullptr;
+}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_object.h b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_object.h
new file mode 100644
index 00000000000..95964537127
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_object.h
@@ -0,0 +1,100 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef XFA_FXFA_PARSER_CXFA_OBJECT_H_
+#define XFA_FXFA_PARSER_CXFA_OBJECT_H_
+
+#include "core/fxcrt/fx_string.h"
+#include "fxjs/fxjse.h"
+#include "xfa/fxfa/fxfa_basic.h"
+
+enum class XFA_ObjectType {
+ Object,
+ List,
+ NodeList,
+ Node,
+ NodeC,
+ NodeV,
+ ModelNode,
+ TextNode,
+ ContainerNode,
+ ContentNode,
+ VariablesThis
+};
+
+class CFXJSE_Value;
+class CXFA_Document;
+class CXFA_Node;
+class CXFA_NodeList;
+
+class CXFA_Object : public CFXJSE_HostObject {
+ public:
+ CXFA_Object(CXFA_Document* pDocument,
+ XFA_ObjectType objectType,
+ XFA_Element eType,
+ const CFX_WideStringC& elementName);
+ ~CXFA_Object() override;
+
+ CXFA_Document* GetDocument() const { return m_pDocument; }
+ XFA_ObjectType GetObjectType() const { return m_objectType; }
+
+ bool IsNode() const {
+ return m_objectType == XFA_ObjectType::Node ||
+ m_objectType == XFA_ObjectType::NodeC ||
+ m_objectType == XFA_ObjectType::NodeV ||
+ m_objectType == XFA_ObjectType::ModelNode ||
+ m_objectType == XFA_ObjectType::TextNode ||
+ m_objectType == XFA_ObjectType::ContainerNode ||
+ m_objectType == XFA_ObjectType::ContentNode ||
+ m_objectType == XFA_ObjectType::VariablesThis;
+ }
+ bool IsNodeList() const { return m_objectType == XFA_ObjectType::NodeList; }
+ bool IsContentNode() const {
+ return m_objectType == XFA_ObjectType::ContentNode;
+ }
+ bool IsContainerNode() const {
+ return m_objectType == XFA_ObjectType::ContainerNode;
+ }
+ bool IsModelNode() const { return m_objectType == XFA_ObjectType::ModelNode; }
+ bool IsNodeV() const { return m_objectType == XFA_ObjectType::NodeV; }
+ bool IsVariablesThis() const {
+ return m_objectType == XFA_ObjectType::VariablesThis;
+ }
+
+ CXFA_Node* AsNode();
+ CXFA_NodeList* AsNodeList();
+
+ const CXFA_Node* AsNode() const;
+ const CXFA_NodeList* AsNodeList() const;
+
+ XFA_Element GetElementType() const { return m_elementType; }
+ CFX_WideStringC GetClassName() const { return m_elementName; }
+ uint32_t GetClassHashCode() const { return m_elementNameHash; }
+
+ void Script_ObjectClass_ClassName(CFXJSE_Value* pValue,
+ bool bSetting,
+ XFA_ATTRIBUTE eAttribute);
+
+ void ThrowInvalidPropertyException() const;
+ void ThrowArgumentMismatchException() const;
+ void ThrowIndexOutOfBoundsException() const;
+ void ThrowParamCountMismatchException(const CFX_WideString& method) const;
+
+ protected:
+ void ThrowException(const wchar_t* str, ...) const;
+
+ CXFA_Document* const m_pDocument;
+ const XFA_ObjectType m_objectType;
+ const XFA_Element m_elementType;
+
+ const uint32_t m_elementNameHash;
+ const CFX_WideStringC m_elementName;
+};
+
+CXFA_Node* ToNode(CXFA_Object* pObj);
+const CXFA_Node* ToNode(const CXFA_Object* pObj);
+
+#endif // XFA_FXFA_PARSER_CXFA_OBJECT_H_
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_occur.cpp b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_occur.cpp
index a8994223f93..ddce8d6422a 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_occur.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_occur.cpp
@@ -6,7 +6,7 @@
#include "xfa/fxfa/parser/cxfa_occur.h"
-#include "xfa/fxfa/parser/xfa_object.h"
+#include "xfa/fxfa/parser/cxfa_node.h"
CXFA_Occur::CXFA_Occur(CXFA_Node* pNode) : CXFA_Data(pNode) {}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_para.cpp b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_para.cpp
index bd3a1bb8ff0..c3d55f21648 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_para.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_para.cpp
@@ -7,7 +7,7 @@
#include "xfa/fxfa/parser/cxfa_para.h"
#include "xfa/fxfa/parser/cxfa_measurement.h"
-#include "xfa/fxfa/parser/xfa_object.h"
+#include "xfa/fxfa/parser/cxfa_node.h"
CXFA_Para::CXFA_Para(CXFA_Node* pNode) : CXFA_Data(pNode) {}
@@ -23,37 +23,37 @@ int32_t CXFA_Para::GetVerticalAlign() {
return eAttr;
}
-FX_FLOAT CXFA_Para::GetLineHeight() {
+float CXFA_Para::GetLineHeight() {
CXFA_Measurement ms;
m_pNode->TryMeasure(XFA_ATTRIBUTE_LineHeight, ms);
return ms.ToUnit(XFA_UNIT_Pt);
}
-FX_FLOAT CXFA_Para::GetMarginLeft() {
+float CXFA_Para::GetMarginLeft() {
CXFA_Measurement ms;
m_pNode->TryMeasure(XFA_ATTRIBUTE_MarginLeft, ms);
return ms.ToUnit(XFA_UNIT_Pt);
}
-FX_FLOAT CXFA_Para::GetMarginRight() {
+float CXFA_Para::GetMarginRight() {
CXFA_Measurement ms;
m_pNode->TryMeasure(XFA_ATTRIBUTE_MarginRight, ms);
return ms.ToUnit(XFA_UNIT_Pt);
}
-FX_FLOAT CXFA_Para::GetSpaceAbove() {
+float CXFA_Para::GetSpaceAbove() {
CXFA_Measurement ms;
m_pNode->TryMeasure(XFA_ATTRIBUTE_SpaceAbove, ms);
return ms.ToUnit(XFA_UNIT_Pt);
}
-FX_FLOAT CXFA_Para::GetSpaceBelow() {
+float CXFA_Para::GetSpaceBelow() {
CXFA_Measurement ms;
m_pNode->TryMeasure(XFA_ATTRIBUTE_SpaceBelow, ms);
return ms.ToUnit(XFA_UNIT_Pt);
}
-FX_FLOAT CXFA_Para::GetTextIndent() {
+float CXFA_Para::GetTextIndent() {
CXFA_Measurement ms;
m_pNode->TryMeasure(XFA_ATTRIBUTE_TextIndent, ms);
return ms.ToUnit(XFA_UNIT_Pt);
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_para.h b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_para.h
index e12d48f9fa3..c2d67b8a199 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_para.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_para.h
@@ -18,12 +18,12 @@ class CXFA_Para : public CXFA_Data {
int32_t GetHorizontalAlign();
int32_t GetVerticalAlign();
- FX_FLOAT GetLineHeight();
- FX_FLOAT GetMarginLeft();
- FX_FLOAT GetMarginRight();
- FX_FLOAT GetSpaceAbove();
- FX_FLOAT GetSpaceBelow();
- FX_FLOAT GetTextIndent();
+ float GetLineHeight();
+ float GetMarginLeft();
+ float GetMarginRight();
+ float GetSpaceAbove();
+ float GetSpaceBelow();
+ float GetTextIndent();
};
#endif // XFA_FXFA_PARSER_CXFA_PARA_H_
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_resolveprocessor.cpp b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_resolveprocessor.cpp
index 3ef4e976cab..51487a1e2bb 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_resolveprocessor.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_resolveprocessor.cpp
@@ -6,12 +6,19 @@
#include "xfa/fxfa/parser/cxfa_resolveprocessor.h"
+#include <algorithm>
+#include <utility>
+#include <vector>
+
#include "core/fxcrt/fx_ext.h"
+#include "third_party/base/ptr_util.h"
+#include "third_party/base/stl_util.h"
#include "xfa/fxfa/parser/cxfa_document.h"
+#include "xfa/fxfa/parser/cxfa_localemgr.h"
+#include "xfa/fxfa/parser/cxfa_node.h"
#include "xfa/fxfa/parser/cxfa_nodehelper.h"
+#include "xfa/fxfa/parser/cxfa_object.h"
#include "xfa/fxfa/parser/cxfa_scriptcontext.h"
-#include "xfa/fxfa/parser/xfa_localemgr.h"
-#include "xfa/fxfa/parser/xfa_object.h"
#include "xfa/fxfa/parser/xfa_resolvenode_rs.h"
#include "xfa/fxfa/parser/xfa_utils.h"
@@ -21,12 +28,12 @@ CXFA_ResolveProcessor::CXFA_ResolveProcessor()
CXFA_ResolveProcessor::~CXFA_ResolveProcessor() {}
int32_t CXFA_ResolveProcessor::Resolve(CXFA_ResolveNodesData& rnd) {
- if (!rnd.m_CurNode) {
+ if (!rnd.m_CurObject)
return -1;
- }
- if (!rnd.m_CurNode->IsNode()) {
+
+ if (!rnd.m_CurObject->IsNode()) {
if (rnd.m_dwStyles & XFA_RESOLVENODE_Attributes) {
- return ResolveForAttributeRs(rnd.m_CurNode, rnd,
+ return ResolveForAttributeRs(rnd.m_CurObject, rnd,
rnd.m_wsName.AsStringC());
}
return 0;
@@ -34,7 +41,7 @@ int32_t CXFA_ResolveProcessor::Resolve(CXFA_ResolveNodesData& rnd) {
if (rnd.m_dwStyles & XFA_RESOLVENODE_AnyChild) {
return ResolveAnyChild(rnd);
}
- FX_WCHAR wch = rnd.m_wsName.GetAt(0);
+ wchar_t wch = rnd.m_wsName.GetAt(0);
switch (wch) {
case '$':
return ResolveDollar(rnd);
@@ -51,62 +58,66 @@ int32_t CXFA_ResolveProcessor::Resolve(CXFA_ResolveNodesData& rnd) {
break;
}
if (rnd.m_uHashName == XFA_HASHCODE_This && rnd.m_nLevel == 0) {
- rnd.m_Nodes.Add(rnd.m_pSC->GetThisObject());
+ rnd.m_Objects.push_back(rnd.m_pSC->GetThisObject());
return 1;
- } else if (rnd.m_CurNode->GetElementType() == XFA_Element::Xfa) {
+ }
+ if (rnd.m_CurObject->GetElementType() == XFA_Element::Xfa) {
CXFA_Object* pObjNode =
rnd.m_pSC->GetDocument()->GetXFAObject(rnd.m_uHashName);
if (pObjNode) {
- rnd.m_Nodes.Add(pObjNode);
+ rnd.m_Objects.push_back(pObjNode);
} else if (rnd.m_uHashName == XFA_HASHCODE_Xfa) {
- rnd.m_Nodes.Add(rnd.m_CurNode);
+ rnd.m_Objects.push_back(rnd.m_CurObject);
} else if ((rnd.m_dwStyles & XFA_RESOLVENODE_Attributes) &&
- ResolveForAttributeRs(rnd.m_CurNode, rnd,
+ ResolveForAttributeRs(rnd.m_CurObject, rnd,
rnd.m_wsName.AsStringC())) {
return 1;
}
- if (rnd.m_Nodes.GetSize() > 0) {
+ if (!rnd.m_Objects.empty())
FilterCondition(rnd, rnd.m_wsCondition);
- }
- return rnd.m_Nodes.GetSize();
- }
- int32_t nRet = ResolveNormal(rnd);
- if (nRet < 1 && rnd.m_uHashName == XFA_HASHCODE_Xfa) {
- rnd.m_Nodes.Add(rnd.m_pSC->GetDocument()->GetRoot());
+
+ return pdfium::CollectionSize<int32_t>(rnd.m_Objects);
}
- return rnd.m_Nodes.GetSize();
+ if (ResolveNormal(rnd) < 1 && rnd.m_uHashName == XFA_HASHCODE_Xfa)
+ rnd.m_Objects.push_back(rnd.m_pSC->GetDocument()->GetRoot());
+
+ return pdfium::CollectionSize<int32_t>(rnd.m_Objects);
}
+
int32_t CXFA_ResolveProcessor::ResolveAnyChild(CXFA_ResolveNodesData& rnd) {
CFX_WideString wsName = rnd.m_wsName;
CFX_WideString wsCondition = rnd.m_wsCondition;
CXFA_Node* findNode = nullptr;
- CXFA_NodeArray siblings;
bool bClassName = false;
if (wsName.GetAt(0) == '#') {
bClassName = true;
wsName = wsName.Right(wsName.GetLength() - 1);
}
findNode = m_pNodeHelper->ResolveNodes_GetOneChild(
- ToNode(rnd.m_CurNode), wsName.c_str(), bClassName);
+ ToNode(rnd.m_CurObject), wsName.c_str(), bClassName);
if (!findNode) {
return 0;
}
if (wsCondition.IsEmpty()) {
- rnd.m_Nodes.Add(findNode);
- return rnd.m_Nodes.GetSize();
- }
- m_pNodeHelper->CountSiblings(findNode, XFA_LOGIC_Transparent,
- (CXFA_NodeArray*)&rnd.m_Nodes, bClassName);
+ rnd.m_Objects.push_back(findNode);
+ return pdfium::CollectionSize<int32_t>(rnd.m_Objects);
+ }
+ std::vector<CXFA_Node*> tempNodes;
+ for (CXFA_Object* pObject : rnd.m_Objects)
+ tempNodes.push_back(pObject->AsNode());
+ m_pNodeHelper->CountSiblings(findNode, XFA_LOGIC_Transparent, &tempNodes,
+ bClassName);
+ rnd.m_Objects = std::vector<CXFA_Object*>(tempNodes.begin(), tempNodes.end());
FilterCondition(rnd, wsCondition);
- return rnd.m_Nodes.GetSize();
+ return pdfium::CollectionSize<int32_t>(rnd.m_Objects);
}
+
int32_t CXFA_ResolveProcessor::ResolveDollar(CXFA_ResolveNodesData& rnd) {
- CXFA_ObjArray& nodes = rnd.m_Nodes;
CFX_WideString wsName = rnd.m_wsName;
CFX_WideString wsCondition = rnd.m_wsCondition;
int32_t iNameLen = wsName.GetLength();
if (iNameLen == 1) {
- nodes.Add(rnd.m_CurNode);
+ rnd.m_Objects.push_back(rnd.m_CurObject);
return 1;
}
if (rnd.m_nLevel > 0) {
@@ -115,30 +126,30 @@ int32_t CXFA_ResolveProcessor::ResolveDollar(CXFA_ResolveNodesData& rnd) {
XFA_HashCode dwNameHash = static_cast<XFA_HashCode>(FX_HashCode_GetW(
CFX_WideStringC(wsName.c_str() + 1, iNameLen - 1), false));
if (dwNameHash == XFA_HASHCODE_Xfa) {
- nodes.Add(rnd.m_pSC->GetDocument()->GetRoot());
+ rnd.m_Objects.push_back(rnd.m_pSC->GetDocument()->GetRoot());
} else {
CXFA_Object* pObjNode = rnd.m_pSC->GetDocument()->GetXFAObject(dwNameHash);
- if (pObjNode) {
- rnd.m_Nodes.Add(pObjNode);
- }
+ if (pObjNode)
+ rnd.m_Objects.push_back(pObjNode);
}
- if (rnd.m_Nodes.GetSize() > 0) {
+ if (!rnd.m_Objects.empty())
FilterCondition(rnd, wsCondition);
- }
- return rnd.m_Nodes.GetSize();
+
+ return pdfium::CollectionSize<int32_t>(rnd.m_Objects);
}
+
int32_t CXFA_ResolveProcessor::ResolveExcalmatory(CXFA_ResolveNodesData& rnd) {
- if (rnd.m_nLevel > 0) {
+ if (rnd.m_nLevel > 0)
return 0;
- }
+
CXFA_Node* datasets =
ToNode(rnd.m_pSC->GetDocument()->GetXFAObject(XFA_HASHCODE_Datasets));
- if (!datasets) {
+ if (!datasets)
return 0;
- }
+
CXFA_ResolveNodesData rndFind;
rndFind.m_pSC = rnd.m_pSC;
- rndFind.m_CurNode = datasets;
+ rndFind.m_CurObject = datasets;
rndFind.m_wsName = rnd.m_wsName.Right(rnd.m_wsName.GetLength() - 1);
rndFind.m_uHashName = static_cast<XFA_HashCode>(
FX_HashCode_GetW(rndFind.m_wsName.AsStringC(), false));
@@ -146,19 +157,18 @@ int32_t CXFA_ResolveProcessor::ResolveExcalmatory(CXFA_ResolveNodesData& rnd) {
rndFind.m_dwStyles = XFA_RESOLVENODE_Children;
rndFind.m_wsCondition = rnd.m_wsCondition;
Resolve(rndFind);
- if (rndFind.m_Nodes.GetSize() > 0) {
- rnd.m_Nodes.Append(rndFind.m_Nodes);
- rndFind.m_Nodes.RemoveAll();
- }
- return rnd.m_Nodes.GetSize();
+ rnd.m_Objects.insert(rnd.m_Objects.end(), rndFind.m_Objects.begin(),
+ rndFind.m_Objects.end());
+ return pdfium::CollectionSize<int32_t>(rnd.m_Objects);
}
+
int32_t CXFA_ResolveProcessor::ResolveNumberSign(CXFA_ResolveNodesData& rnd) {
CFX_WideString wsName = rnd.m_wsName.Right(rnd.m_wsName.GetLength() - 1);
CFX_WideString wsCondition = rnd.m_wsCondition;
- CXFA_Node* curNode = ToNode(rnd.m_CurNode);
- if (ResolveForAttributeRs(curNode, rnd, wsName.AsStringC())) {
+ CXFA_Node* curNode = ToNode(rnd.m_CurObject);
+ if (ResolveForAttributeRs(curNode, rnd, wsName.AsStringC()))
return 1;
- }
+
CXFA_ResolveNodesData rndFind;
rndFind.m_pSC = rnd.m_pSC;
rndFind.m_nLevel = rnd.m_nLevel + 1;
@@ -169,42 +179,42 @@ int32_t CXFA_ResolveProcessor::ResolveNumberSign(CXFA_ResolveNodesData& rnd) {
rndFind.m_uHashName = static_cast<XFA_HashCode>(
FX_HashCode_GetW(rndFind.m_wsName.AsStringC(), false));
rndFind.m_wsCondition = wsCondition;
- rndFind.m_CurNode = curNode;
+ rndFind.m_CurObject = curNode;
ResolveNormal(rndFind);
- if (rndFind.m_Nodes.GetSize() > 0) {
- if (wsCondition.GetLength() == 0 && rndFind.m_Nodes.Find(curNode) >= 0) {
- rnd.m_Nodes.Add(curNode);
- } else {
- rnd.m_Nodes.Append(rndFind.m_Nodes);
- rndFind.m_Nodes.RemoveAll();
- }
+ if (rndFind.m_Objects.empty())
+ return 0;
+
+ if (wsCondition.GetLength() == 0 &&
+ pdfium::ContainsValue(rndFind.m_Objects, curNode)) {
+ rnd.m_Objects.push_back(curNode);
+ } else {
+ rnd.m_Objects.insert(rnd.m_Objects.end(), rndFind.m_Objects.begin(),
+ rndFind.m_Objects.end());
}
- return rnd.m_Nodes.GetSize();
+ return pdfium::CollectionSize<int32_t>(rnd.m_Objects);
}
+
int32_t CXFA_ResolveProcessor::ResolveForAttributeRs(
CXFA_Object* curNode,
CXFA_ResolveNodesData& rnd,
const CFX_WideStringC& strAttr) {
const XFA_SCRIPTATTRIBUTEINFO* lpScriptAttribute =
XFA_GetScriptAttributeByName(curNode->GetElementType(), strAttr);
- if (lpScriptAttribute) {
- rnd.m_pScriptAttribute = lpScriptAttribute;
- rnd.m_Nodes.Add(curNode);
- rnd.m_dwFlag = XFA_RESOVENODE_RSTYPE_Attribute;
- return 1;
- }
- return 0;
+ if (!lpScriptAttribute)
+ return 0;
+
+ rnd.m_pScriptAttribute = lpScriptAttribute;
+ rnd.m_Objects.push_back(curNode);
+ rnd.m_dwFlag = XFA_RESOVENODE_RSTYPE_Attribute;
+ return 1;
}
+
int32_t CXFA_ResolveProcessor::ResolveNormal(CXFA_ResolveNodesData& rnd) {
- if (rnd.m_nLevel > 32) {
- return 0;
- }
- if (!rnd.m_CurNode->IsNode()) {
+ if (rnd.m_nLevel > 32 || !rnd.m_CurObject->IsNode())
return 0;
- }
- CXFA_Node* curNode = ToNode(rnd.m_CurNode);
- CXFA_ObjArray& nodes = rnd.m_Nodes;
- int32_t nNum = nodes.GetSize();
+
+ CXFA_Node* curNode = rnd.m_CurObject->AsNode();
+ size_t nNum = rnd.m_Objects.size();
uint32_t dwStyles = rnd.m_dwStyles;
CFX_WideString& wsName = rnd.m_wsName;
XFA_HashCode uNameHash = rnd.m_uHashName;
@@ -215,69 +225,59 @@ int32_t CXFA_ResolveProcessor::ResolveNormal(CXFA_ResolveNodesData& rnd) {
rndFind.m_pSC = rnd.m_pSC;
rndFind.m_nLevel = rnd.m_nLevel + 1;
rndFind.m_uHashName = uNameHash;
- CXFA_NodeArray children;
- CXFA_NodeArray properties;
+ std::vector<CXFA_Node*> children;
+ std::vector<CXFA_Node*> properties;
CXFA_Node* pVariablesNode = nullptr;
CXFA_Node* pPageSetNode = nullptr;
- CXFA_Node* pChild = curNode->GetNodeItem(XFA_NODEITEM_FirstChild);
- while (pChild) {
+ for (CXFA_Node* pChild = curNode->GetNodeItem(XFA_NODEITEM_FirstChild);
+ pChild; pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling)) {
if (pChild->GetElementType() == XFA_Element::Variables) {
pVariablesNode = pChild;
- pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling);
continue;
- } else if (pChild->GetElementType() == XFA_Element::PageSet) {
+ }
+ if (pChild->GetElementType() == XFA_Element::PageSet) {
pPageSetNode = pChild;
- pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling);
continue;
- } else {
- const XFA_PROPERTY* pPropert = XFA_GetPropertyOfElement(
- curNode->GetElementType(), pChild->GetElementType(),
- XFA_XDPPACKET_UNKNOWN);
- if (pPropert) {
- properties.Add(pChild);
- } else {
- children.Add(pChild);
- }
}
- pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling);
+ const XFA_PROPERTY* pProperty = XFA_GetPropertyOfElement(
+ curNode->GetElementType(), pChild->GetElementType(),
+ XFA_XDPPACKET_UNKNOWN);
+ if (pProperty)
+ properties.push_back(pChild);
+ else
+ children.push_back(pChild);
}
if ((dwStyles & XFA_RESOLVENODE_Properties) && pVariablesNode) {
uint32_t uPropHash = pVariablesNode->GetClassHashCode();
if (uPropHash == uNameHash) {
- nodes.Add(pVariablesNode);
+ rnd.m_Objects.push_back(pVariablesNode);
} else {
- rndFind.m_CurNode = pVariablesNode;
+ rndFind.m_CurObject = pVariablesNode;
SetStylesForChild(dwStyles, rndFind);
CFX_WideString wsSaveCondition = rndFind.m_wsCondition;
rndFind.m_wsCondition.clear();
ResolveNormal(rndFind);
rndFind.m_wsCondition = wsSaveCondition;
- if (rndFind.m_Nodes.GetSize() > 0) {
- nodes.Append(rndFind.m_Nodes);
- rndFind.m_Nodes.RemoveAll();
- }
+ rnd.m_Objects.insert(rnd.m_Objects.end(), rndFind.m_Objects.begin(),
+ rndFind.m_Objects.end());
+ rndFind.m_Objects.clear();
}
- if (nodes.GetSize() > nNum) {
+ if (rnd.m_Objects.size() > nNum) {
FilterCondition(rnd, wsCondition);
- if (nodes.GetSize() > 0) {
- return 1;
- }
- return 0;
+ return !rnd.m_Objects.empty() ? 1 : 0;
}
}
if (dwStyles & XFA_RESOLVENODE_Children) {
bool bSetFlag = false;
- if (pPageSetNode && (dwStyles & XFA_RESOLVENODE_Properties)) {
- children.Add(pPageSetNode);
- }
- for (int32_t i = 0; i < children.GetSize(); i++) {
- CXFA_Node* child = children[i];
+ if (pPageSetNode && (dwStyles & XFA_RESOLVENODE_Properties))
+ children.push_back(pPageSetNode);
+
+ for (CXFA_Node* child : children) {
if (dwStyles & XFA_RESOLVENODE_TagName) {
- if (child->GetClassHashCode() == uNameHash) {
- nodes.Add(child);
- }
+ if (child->GetClassHashCode() == uNameHash)
+ rnd.m_Objects.push_back(child);
} else if (child->GetNameHash() == uNameHash) {
- nodes.Add(child);
+ rnd.m_Objects.push_back(child);
}
if (m_pNodeHelper->NodeIsTransparent(child) &&
child->GetElementType() != XFA_Element::PageSet) {
@@ -285,64 +285,55 @@ int32_t CXFA_ResolveProcessor::ResolveNormal(CXFA_ResolveNodesData& rnd) {
SetStylesForChild(dwStyles, rndFind);
bSetFlag = true;
}
- rndFind.m_CurNode = child;
+ rndFind.m_CurObject = child;
CFX_WideString wsSaveCondition = rndFind.m_wsCondition;
rndFind.m_wsCondition.clear();
ResolveNormal(rndFind);
rndFind.m_wsCondition = wsSaveCondition;
- if (rndFind.m_Nodes.GetSize() > 0) {
- nodes.Append(rndFind.m_Nodes);
- rndFind.m_Nodes.RemoveAll();
- }
+ rnd.m_Objects.insert(rnd.m_Objects.end(), rndFind.m_Objects.begin(),
+ rndFind.m_Objects.end());
+ rndFind.m_Objects.clear();
}
}
- if (nodes.GetSize() > nNum) {
+ if (rnd.m_Objects.size() > nNum) {
if (!(dwStyles & XFA_RESOLVENODE_ALL)) {
- CXFA_NodeArray upArrayNodes;
+ std::vector<CXFA_Node*> upArrayNodes;
if (m_pNodeHelper->NodeIsTransparent(ToNode(curNode))) {
- m_pNodeHelper->CountSiblings(ToNode(nodes[0]), XFA_LOGIC_Transparent,
- &upArrayNodes,
+ m_pNodeHelper->CountSiblings(ToNode(rnd.m_Objects[0]),
+ XFA_LOGIC_Transparent, &upArrayNodes,
!!(dwStyles & XFA_RESOLVENODE_TagName));
}
- if (upArrayNodes.GetSize() > nodes.GetSize()) {
- upArrayNodes[0] = ToNode(nodes[0]);
- nodes.RemoveAll();
- nodes.Append((CXFA_ObjArray&)upArrayNodes);
- upArrayNodes.RemoveAll();
+ if (upArrayNodes.size() > rnd.m_Objects.size()) {
+ CXFA_Object* pSaveObject = rnd.m_Objects.front();
+ rnd.m_Objects = std::vector<CXFA_Object*>(upArrayNodes.begin(),
+ upArrayNodes.end());
+ rnd.m_Objects.front() = pSaveObject;
}
}
FilterCondition(rnd, wsCondition);
- if (nodes.GetSize() > 0) {
- return 1;
- }
- return 0;
+ return !rnd.m_Objects.empty() ? 1 : 0;
}
}
if (dwStyles & XFA_RESOLVENODE_Attributes) {
- if (ResolveForAttributeRs(curNode, rnd, wsName.AsStringC())) {
+ if (ResolveForAttributeRs(curNode, rnd, wsName.AsStringC()))
return 1;
- }
}
if (dwStyles & XFA_RESOLVENODE_Properties) {
- for (int32_t i = 0; i < properties.GetSize(); i++) {
- CXFA_Node* childProperty = properties[i];
- if (childProperty->IsUnnamed()) {
- uint32_t uPropHash = childProperty->GetClassHashCode();
- if (uPropHash == uNameHash) {
- nodes.Add(childProperty);
- }
- } else if (childProperty->GetNameHash() == uNameHash &&
- childProperty->GetElementType() != XFA_Element::Extras &&
- childProperty->GetElementType() != XFA_Element::Items) {
- nodes.Add(childProperty);
+ for (CXFA_Node* pChildProperty : properties) {
+ if (pChildProperty->IsUnnamed()) {
+ if (pChildProperty->GetClassHashCode() == uNameHash)
+ rnd.m_Objects.push_back(pChildProperty);
+ continue;
+ }
+ if (pChildProperty->GetNameHash() == uNameHash &&
+ pChildProperty->GetElementType() != XFA_Element::Extras &&
+ pChildProperty->GetElementType() != XFA_Element::Items) {
+ rnd.m_Objects.push_back(pChildProperty);
}
}
- if (nodes.GetSize() > nNum) {
+ if (rnd.m_Objects.size() > nNum) {
FilterCondition(rnd, wsCondition);
- if (nodes.GetSize() > 0) {
- return 1;
- }
- return 0;
+ return !rnd.m_Objects.empty() ? 1 : 0;
}
CXFA_Node* pProp = nullptr;
if (XFA_Element::Subform == curNode->GetElementType() &&
@@ -360,8 +351,8 @@ int32_t CXFA_ResolveProcessor::ResolveNormal(CXFA_ResolveNodesData& rnd) {
}
}
if (pProp) {
- nodes.Add(pProp);
- return nodes.GetSize();
+ rnd.m_Objects.push_back(pProp);
+ return pdfium::CollectionSize<int32_t>(rnd.m_Objects);
}
}
CXFA_Node* parentNode = m_pNodeHelper->ResolveNodes_GetParent(
@@ -369,11 +360,10 @@ int32_t CXFA_ResolveProcessor::ResolveNormal(CXFA_ResolveNodesData& rnd) {
uint32_t uCurClassHash = curNode->GetClassHashCode();
if (!parentNode) {
if (uCurClassHash == uNameHash) {
- nodes.Add(curNode->AsNode());
+ rnd.m_Objects.push_back(curNode->AsNode());
FilterCondition(rnd, wsCondition);
- if (nodes.GetSize() > 0) {
+ if (!rnd.m_Objects.empty())
return 1;
- }
}
return 0;
}
@@ -381,25 +371,23 @@ int32_t CXFA_ResolveProcessor::ResolveNormal(CXFA_ResolveNodesData& rnd) {
CXFA_Node* child = parentNode->GetNodeItem(XFA_NODEITEM_FirstChild);
uint32_t dwSubStyles =
XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties;
- if (dwStyles & XFA_RESOLVENODE_TagName) {
+ if (dwStyles & XFA_RESOLVENODE_TagName)
dwSubStyles |= XFA_RESOLVENODE_TagName;
- }
- if (dwStyles & XFA_RESOLVENODE_ALL) {
+ if (dwStyles & XFA_RESOLVENODE_ALL)
dwSubStyles |= XFA_RESOLVENODE_ALL;
- }
rndFind.m_dwStyles = dwSubStyles;
while (child) {
if (child == curNode) {
if (dwStyles & XFA_RESOLVENODE_TagName) {
if (uCurClassHash == uNameHash) {
- nodes.Add(curNode);
+ rnd.m_Objects.push_back(curNode);
}
} else {
if (child->GetNameHash() == uNameHash) {
- nodes.Add(curNode);
+ rnd.m_Objects.push_back(curNode);
if (rnd.m_nLevel == 0 && wsCondition.GetLength() == 0) {
- nodes.RemoveAll();
- nodes.Add(curNode);
+ rnd.m_Objects.clear();
+ rnd.m_Objects.push_back(curNode);
return 1;
}
}
@@ -408,11 +396,10 @@ int32_t CXFA_ResolveProcessor::ResolveNormal(CXFA_ResolveNodesData& rnd) {
continue;
}
if (dwStyles & XFA_RESOLVENODE_TagName) {
- if (child->GetClassHashCode() == uNameHash) {
- nodes.Add(child);
- }
+ if (child->GetClassHashCode() == uNameHash)
+ rnd.m_Objects.push_back(child);
} else if (child->GetNameHash() == uNameHash) {
- nodes.Add(child);
+ rnd.m_Objects.push_back(child);
}
const XFA_PROPERTY* pPropert = XFA_GetPropertyOfElement(
parentNode->GetElementType(), child->GetElementType(),
@@ -429,7 +416,7 @@ int32_t CXFA_ResolveProcessor::ResolveNormal(CXFA_ResolveNodesData& rnd) {
}
}
if (bInnerSearch) {
- rndFind.m_CurNode = child;
+ rndFind.m_CurObject = child;
CFX_WideString wsOriginCondition = rndFind.m_wsCondition;
rndFind.m_wsCondition.clear();
uint32_t dwOriginStyle = rndFind.m_dwStyles;
@@ -437,31 +424,27 @@ int32_t CXFA_ResolveProcessor::ResolveNormal(CXFA_ResolveNodesData& rnd) {
ResolveNormal(rndFind);
rndFind.m_dwStyles = dwOriginStyle;
rndFind.m_wsCondition = wsOriginCondition;
- if (rndFind.m_Nodes.GetSize() > 0) {
- nodes.Append(rndFind.m_Nodes);
- rndFind.m_Nodes.RemoveAll();
- }
+ rnd.m_Objects.insert(rnd.m_Objects.end(), rndFind.m_Objects.begin(),
+ rndFind.m_Objects.end());
+ rndFind.m_Objects.clear();
}
child = child->GetNodeItem(XFA_NODEITEM_NextSibling);
}
- if (nodes.GetSize() > nNum) {
+ if (rnd.m_Objects.size() > nNum) {
if (m_pNodeHelper->NodeIsTransparent(parentNode)) {
- CXFA_NodeArray upArrayNodes;
- m_pNodeHelper->CountSiblings(ToNode(nodes[0]), XFA_LOGIC_Transparent,
- &upArrayNodes,
+ std::vector<CXFA_Node*> upArrayNodes;
+ m_pNodeHelper->CountSiblings(ToNode(rnd.m_Objects.front()),
+ XFA_LOGIC_Transparent, &upArrayNodes,
!!(dwStyles & XFA_RESOLVENODE_TagName));
- if (upArrayNodes.GetSize() > nodes.GetSize()) {
- upArrayNodes[0] = ToNode(nodes[0]);
- nodes.RemoveAll();
- nodes.Append((CXFA_ObjArray&)upArrayNodes);
- upArrayNodes.RemoveAll();
+ if (upArrayNodes.size() > rnd.m_Objects.size()) {
+ CXFA_Object* pSaveObject = rnd.m_Objects.front();
+ rnd.m_Objects = std::vector<CXFA_Object*>(upArrayNodes.begin(),
+ upArrayNodes.end());
+ rnd.m_Objects.front() = pSaveObject;
}
}
FilterCondition(rnd, wsCondition);
- if (nodes.GetSize() > 0) {
- return 1;
- }
- return 0;
+ return !rnd.m_Objects.empty() ? 1 : 0;
}
}
if (dwStyles & XFA_RESOLVENODE_Parent) {
@@ -474,39 +457,35 @@ int32_t CXFA_ResolveProcessor::ResolveNormal(CXFA_ResolveNodesData& rnd) {
dwSubStyles |= XFA_RESOLVENODE_ALL;
}
rndFind.m_dwStyles = dwSubStyles;
- rndFind.m_CurNode = parentNode;
- CXFA_NodeArray& array = rnd.m_pSC->GetUpObjectArray();
- array.Add(parentNode);
+ rndFind.m_CurObject = parentNode;
+ rnd.m_pSC->GetUpObjectArray()->push_back(parentNode);
ResolveNormal(rndFind);
- if (rndFind.m_Nodes.GetSize() > 0) {
- nodes.Append(rndFind.m_Nodes);
- rndFind.m_Nodes.RemoveAll();
- }
- if (nodes.GetSize() > nNum) {
+ rnd.m_Objects.insert(rnd.m_Objects.end(), rndFind.m_Objects.begin(),
+ rndFind.m_Objects.end());
+ rndFind.m_Objects.clear();
+ if (rnd.m_Objects.size() > nNum)
return 1;
- }
}
return 0;
}
+
int32_t CXFA_ResolveProcessor::ResolveAsterisk(CXFA_ResolveNodesData& rnd) {
- CXFA_Node* curNode = ToNode(rnd.m_CurNode);
- CXFA_ObjArray& nodes = rnd.m_Nodes;
- CXFA_NodeArray array;
- curNode->GetNodeList(array,
- XFA_NODEFILTER_Children | XFA_NODEFILTER_Properties);
- nodes.Append((CXFA_ObjArray&)array);
- return nodes.GetSize();
+ CXFA_Node* curNode = ToNode(rnd.m_CurObject);
+ std::vector<CXFA_Node*> array =
+ curNode->GetNodeList(XFA_NODEFILTER_Children | XFA_NODEFILTER_Properties);
+ rnd.m_Objects.insert(rnd.m_Objects.end(), array.begin(), array.end());
+ return pdfium::CollectionSize<int32_t>(rnd.m_Objects);
}
-int32_t CXFA_ResolveProcessor::ResolvePopStack(
- CFX_ArrayTemplate<int32_t>& stack) {
- int32_t nType = -1;
- int32_t iSize = stack.GetSize() - 1;
- if (iSize > -1) {
- nType = stack[iSize];
- stack.RemoveAt(iSize, 1);
- }
+
+int32_t CXFA_ResolveProcessor::ResolvePopStack(std::vector<int32_t>* stack) {
+ if (stack->empty())
+ return -1;
+
+ int32_t nType = stack->back();
+ stack->pop_back();
return nType;
}
+
int32_t CXFA_ResolveProcessor::GetFilter(const CFX_WideStringC& wsExpression,
int32_t nStart,
CXFA_ResolveNodesData& rnd) {
@@ -517,14 +496,14 @@ int32_t CXFA_ResolveProcessor::GetFilter(const CFX_WideStringC& wsExpression,
}
CFX_WideString& wsName = rnd.m_wsName;
CFX_WideString& wsCondition = rnd.m_wsCondition;
- FX_WCHAR* pNameBuf = wsName.GetBuffer(iLength - nStart);
- FX_WCHAR* pConditionBuf = wsCondition.GetBuffer(iLength - nStart);
+ wchar_t* pNameBuf = wsName.GetBuffer(iLength - nStart);
+ wchar_t* pConditionBuf = wsCondition.GetBuffer(iLength - nStart);
int32_t nNameCount = 0;
int32_t nConditionCount = 0;
- CFX_ArrayTemplate<int32_t> stack;
+ std::vector<int32_t> stack;
int32_t nType = -1;
- const FX_WCHAR* pSrc = wsExpression.c_str();
- FX_WCHAR wPrev = 0, wCur;
+ const wchar_t* pSrc = wsExpression.c_str();
+ wchar_t wPrev = 0, wCur;
bool bIsCondition = false;
while (nStart < iLength) {
wCur = pSrc[nStart++];
@@ -537,7 +516,7 @@ int32_t CXFA_ResolveProcessor::GetFilter(const CFX_WideStringC& wsExpression,
rnd.m_dwStyles |= XFA_RESOLVENODE_AnyChild;
continue;
}
- FX_WCHAR wLookahead = nStart < iLength ? pSrc[nStart] : 0;
+ wchar_t wLookahead = nStart < iLength ? pSrc[nStart] : 0;
if (wLookahead != '[' && wLookahead != '(') {
if (nType < 0) {
break;
@@ -559,19 +538,19 @@ int32_t CXFA_ResolveProcessor::GetFilter(const CFX_WideStringC& wsExpression,
switch (nType) {
case 0:
if (wCur == ']') {
- nType = ResolvePopStack(stack);
+ nType = ResolvePopStack(&stack);
bRecursive = false;
}
break;
case 1:
if (wCur == ')') {
- nType = ResolvePopStack(stack);
+ nType = ResolvePopStack(&stack);
bRecursive = false;
}
break;
case 2:
if (wCur == '"') {
- nType = ResolvePopStack(stack);
+ nType = ResolvePopStack(&stack);
bRecursive = false;
}
break;
@@ -579,24 +558,24 @@ int32_t CXFA_ResolveProcessor::GetFilter(const CFX_WideStringC& wsExpression,
if (bRecursive) {
switch (wCur) {
case '[':
- stack.Add(nType);
+ stack.push_back(nType);
nType = 0;
break;
case '(':
- stack.Add(nType);
+ stack.push_back(nType);
nType = 1;
break;
case '"':
- stack.Add(nType);
+ stack.push_back(nType);
nType = 2;
break;
}
}
wPrev = wCur;
}
- if (stack.GetSize() > 0) {
+ if (!stack.empty())
return -1;
- }
+
wsName.ReleaseBuffer(nNameCount);
wsName.TrimLeft();
wsName.TrimRight();
@@ -611,13 +590,12 @@ void CXFA_ResolveProcessor::ConditionArray(int32_t iCurIndex,
CFX_WideString wsCondition,
int32_t iFoundCount,
CXFA_ResolveNodesData& rnd) {
- CXFA_NodeArray& findNodes = (CXFA_NodeArray&)rnd.m_Nodes;
int32_t iLen = wsCondition.GetLength();
bool bRelative = false;
bool bAll = false;
int32_t i = 1;
for (; i < iLen; ++i) {
- FX_WCHAR ch = wsCondition[i];
+ wchar_t ch = wsCondition[i];
if (ch == ' ') {
continue;
}
@@ -634,15 +612,15 @@ void CXFA_ResolveProcessor::ConditionArray(int32_t iCurIndex,
if (bAll) {
if (rnd.m_dwStyles & XFA_RESOLVENODE_CreateNode) {
if (rnd.m_dwStyles & XFA_RESOLVENODE_Bind) {
- m_pNodeHelper->m_pCreateParent = ToNode(rnd.m_CurNode);
+ m_pNodeHelper->m_pCreateParent = ToNode(rnd.m_CurObject);
m_pNodeHelper->m_iCreateCount = 1;
- findNodes.RemoveAll();
+ rnd.m_Objects.clear();
m_pNodeHelper->m_iCurAllStart = -1;
m_pNodeHelper->m_pAllStartParent = nullptr;
} else {
if (m_pNodeHelper->m_iCurAllStart == -1) {
m_pNodeHelper->m_iCurAllStart = m_iCurStart;
- m_pNodeHelper->m_pAllStartParent = ToNode(rnd.m_CurNode);
+ m_pNodeHelper->m_pAllStartParent = ToNode(rnd.m_CurObject);
}
}
} else if (rnd.m_dwStyles & XFA_RESOLVENODE_BindNew) {
@@ -663,22 +641,22 @@ void CXFA_ResolveProcessor::ConditionArray(int32_t iCurIndex,
}
if (iFoundCount <= iIndex || iIndex < 0) {
if (rnd.m_dwStyles & XFA_RESOLVENODE_CreateNode) {
- m_pNodeHelper->m_pCreateParent = ToNode(rnd.m_CurNode);
+ m_pNodeHelper->m_pCreateParent = ToNode(rnd.m_CurObject);
m_pNodeHelper->m_iCreateCount = iIndex - iFoundCount + 1;
}
- findNodes.RemoveAll();
+ rnd.m_Objects.clear();
} else {
- CXFA_Node* ret = findNodes[iIndex];
- findNodes.RemoveAll();
- findNodes.Add(ret);
+ CXFA_Object* ret = rnd.m_Objects[iIndex];
+ rnd.m_Objects.clear();
+ rnd.m_Objects.push_back(ret);
}
}
+
void CXFA_ResolveProcessor::DoPredicateFilter(int32_t iCurIndex,
CFX_WideString wsCondition,
int32_t iFoundCount,
CXFA_ResolveNodesData& rnd) {
- CXFA_NodeArray& findNodes = (CXFA_NodeArray&)rnd.m_Nodes;
- ASSERT(iFoundCount == findNodes.GetSize());
+ ASSERT(iFoundCount == pdfium::CollectionSize<int32_t>(rnd.m_Objects));
CFX_WideString wsExpression;
XFA_SCRIPTLANGTYPE eLangType = XFA_SCRIPTLANGTYPE_Unkown;
if (wsCondition.Left(2) == L".[" && wsCondition.Right(1) == L"]") {
@@ -692,25 +670,20 @@ void CXFA_ResolveProcessor::DoPredicateFilter(int32_t iCurIndex,
CXFA_ScriptContext* pContext = rnd.m_pSC;
wsExpression = wsCondition.Mid(2, wsCondition.GetLength() - 3);
for (int32_t i = iFoundCount - 1; i >= 0; i--) {
- CXFA_Object* node = findNodes[i];
- bool bRet = false;
- std::unique_ptr<CFXJSE_Value> pRetValue(
- new CFXJSE_Value(rnd.m_pSC->GetRuntime()));
- bRet = pContext->RunScript(eLangType, wsExpression.AsStringC(),
- pRetValue.get(), node);
+ auto pRetValue = pdfium::MakeUnique<CFXJSE_Value>(rnd.m_pSC->GetRuntime());
+ bool bRet = pContext->RunScript(eLangType, wsExpression.AsStringC(),
+ pRetValue.get(), rnd.m_Objects[i]);
if (!bRet || !pRetValue->ToBoolean())
- findNodes.RemoveAt(i);
+ rnd.m_Objects.erase(rnd.m_Objects.begin() + i);
}
}
void CXFA_ResolveProcessor::FilterCondition(CXFA_ResolveNodesData& rnd,
CFX_WideString wsCondition) {
- CXFA_NodeArray& findNodes = (CXFA_NodeArray&)rnd.m_Nodes;
int32_t iCurrIndex = 0;
- const CXFA_NodeArray& array = rnd.m_pSC->GetUpObjectArray();
- int32_t iSize = array.GetSize();
- if (iSize) {
- CXFA_Node* curNode = array[iSize - 1];
+ const std::vector<CXFA_Node*>* pArray = rnd.m_pSC->GetUpObjectArray();
+ if (!pArray->empty()) {
+ CXFA_Node* curNode = pArray->back();
bool bIsProperty = m_pNodeHelper->NodeIsProperty(curNode);
if (curNode->IsUnnamed() ||
(bIsProperty && curNode->GetElementType() != XFA_Element::PageSet)) {
@@ -721,7 +694,7 @@ void CXFA_ResolveProcessor::FilterCondition(CXFA_ResolveNodesData& rnd,
bIsProperty, false);
}
}
- int32_t iFoundCount = findNodes.GetSize();
+ int32_t iFoundCount = pdfium::CollectionSize<int32_t>(rnd.m_Objects);
wsCondition.TrimLeft();
wsCondition.TrimRight();
int32_t iLen = wsCondition.GetLength();
@@ -734,19 +707,19 @@ void CXFA_ResolveProcessor::FilterCondition(CXFA_ResolveNodesData& rnd,
}
if (iFoundCount <= iCurrIndex) {
if (rnd.m_dwStyles & XFA_RESOLVENODE_CreateNode) {
- m_pNodeHelper->m_pCreateParent = ToNode(rnd.m_CurNode);
+ m_pNodeHelper->m_pCreateParent = ToNode(rnd.m_CurObject);
m_pNodeHelper->m_iCreateCount = iCurrIndex - iFoundCount + 1;
}
- findNodes.RemoveAll();
+ rnd.m_Objects.clear();
return;
} else {
- CXFA_Node* ret = findNodes[iCurrIndex];
- findNodes.RemoveAll();
- findNodes.Add(ret);
+ CXFA_Object* ret = rnd.m_Objects[iCurrIndex];
+ rnd.m_Objects.clear();
+ rnd.m_Objects.push_back(ret);
return;
}
}
- FX_WCHAR wTypeChar = wsCondition[0];
+ wchar_t wTypeChar = wsCondition[0];
switch (wTypeChar) {
case '[':
ConditionArray(iCurrIndex, wsCondition, iFoundCount, rnd);
@@ -775,22 +748,23 @@ void CXFA_ResolveProcessor::SetStylesForChild(uint32_t dwParentStyles,
dwSubStyles |= XFA_RESOLVENODE_ALL;
rnd.m_dwStyles = dwSubStyles;
}
+
int32_t CXFA_ResolveProcessor::SetResultCreateNode(
XFA_RESOLVENODE_RS& resolveNodeRS,
CFX_WideString& wsLastCondition) {
- if (m_pNodeHelper->m_pCreateParent) {
- resolveNodeRS.nodes.Add(m_pNodeHelper->m_pCreateParent);
- } else {
+ if (m_pNodeHelper->m_pCreateParent)
+ resolveNodeRS.objects.push_back(m_pNodeHelper->m_pCreateParent);
+ else
m_pNodeHelper->CreateNode_ForCondition(wsLastCondition);
- }
+
resolveNodeRS.dwFlags = m_pNodeHelper->m_iCreateFlag;
if (resolveNodeRS.dwFlags == XFA_RESOLVENODE_RSTYPE_CreateNodeOne) {
- if (m_pNodeHelper->m_iCurAllStart != -1) {
+ if (m_pNodeHelper->m_iCurAllStart != -1)
resolveNodeRS.dwFlags = XFA_RESOLVENODE_RSTYPE_CreateNodeMidAll;
- }
}
- return resolveNodeRS.nodes.GetSize();
+ return pdfium::CollectionSize<int32_t>(resolveNodeRS.objects);
}
+
void CXFA_ResolveProcessor::SetIndexDataBind(CFX_WideString& wsNextCondition,
int32_t& iIndex,
int32_t iCount) {
@@ -807,16 +781,14 @@ void CXFA_ResolveProcessor::SetIndexDataBind(CFX_WideString& wsNextCondition,
CXFA_ResolveNodesData::CXFA_ResolveNodesData(CXFA_ScriptContext* pSC)
: m_pSC(pSC),
- m_CurNode(nullptr),
+ m_CurObject(nullptr),
m_wsName(),
m_uHashName(XFA_HASHCODE_None),
m_wsCondition(),
m_nLevel(0),
- m_Nodes(),
+ m_Objects(),
m_dwStyles(XFA_RESOLVENODE_Children),
m_pScriptAttribute(nullptr),
m_dwFlag(XFA_RESOVENODE_RSTYPE_Nodes) {}
-CXFA_ResolveNodesData::~CXFA_ResolveNodesData() {
- m_Nodes.RemoveAll();
-}
+CXFA_ResolveNodesData::~CXFA_ResolveNodesData() {}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_resolveprocessor.h b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_resolveprocessor.h
index d806d57b93e..f4eafea0236 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_resolveprocessor.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_resolveprocessor.h
@@ -8,8 +8,8 @@
#define XFA_FXFA_PARSER_CXFA_RESOLVEPROCESSOR_H_
#include <memory>
+#include <vector>
-#include "xfa/fxfa/parser/xfa_object.h"
#include "xfa/fxfa/parser/xfa_resolvenode_rs.h"
class CXFA_NodeHelper;
@@ -21,12 +21,12 @@ class CXFA_ResolveNodesData {
~CXFA_ResolveNodesData();
CXFA_ScriptContext* m_pSC;
- CXFA_Object* m_CurNode;
+ CXFA_Object* m_CurObject;
CFX_WideString m_wsName;
XFA_HashCode m_uHashName;
CFX_WideString m_wsCondition;
int32_t m_nLevel;
- CXFA_ObjArray m_Nodes;
+ std::vector<CXFA_Object*> m_Objects; // Not owned.
uint32_t m_dwStyles;
const XFA_SCRIPTATTRIBUTEINFO* m_pScriptAttribute;
XFA_RESOVENODE_RSTYPE m_dwFlag;
@@ -60,7 +60,7 @@ class CXFA_ResolveProcessor {
int32_t ResolveNumberSign(CXFA_ResolveNodesData& rnd);
int32_t ResolveAsterisk(CXFA_ResolveNodesData& rnd);
int32_t ResolveNormal(CXFA_ResolveNodesData& rnd);
- int32_t ResolvePopStack(CFX_ArrayTemplate<int32_t>& stack);
+ int32_t ResolvePopStack(std::vector<int32_t>* stack);
void SetStylesForChild(uint32_t dwParentStyles, CXFA_ResolveNodesData& rnd);
void ConditionArray(int32_t iCurIndex,
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_script.cpp b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_script.cpp
index 16f65f99f44..ccd1997c471 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_script.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_script.cpp
@@ -6,7 +6,7 @@
#include "xfa/fxfa/parser/cxfa_script.h"
-#include "xfa/fxfa/parser/xfa_object.h"
+#include "xfa/fxfa/parser/cxfa_node.h"
CXFA_Script::CXFA_Script(CXFA_Node* pNode) : CXFA_Data(pNode) {}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_scriptcontext.cpp b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_scriptcontext.cpp
index 584cd76bedd..f539c39f760 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_scriptcontext.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_scriptcontext.cpp
@@ -13,14 +13,18 @@
#include "fxjs/cfxjse_class.h"
#include "fxjs/cfxjse_value.h"
#include "third_party/base/ptr_util.h"
+#include "third_party/base/stl_util.h"
#include "xfa/fxfa/app/xfa_ffnotify.h"
#include "xfa/fxfa/cxfa_eventparam.h"
#include "xfa/fxfa/parser/cxfa_document.h"
+#include "xfa/fxfa/parser/cxfa_localemgr.h"
+#include "xfa/fxfa/parser/cxfa_node.h"
#include "xfa/fxfa/parser/cxfa_nodehelper.h"
+#include "xfa/fxfa/parser/cxfa_nodelist.h"
+#include "xfa/fxfa/parser/cxfa_object.h"
#include "xfa/fxfa/parser/cxfa_resolveprocessor.h"
+#include "xfa/fxfa/parser/cxfa_thisproxy.h"
#include "xfa/fxfa/parser/xfa_basic_data.h"
-#include "xfa/fxfa/parser/xfa_localemgr.h"
-#include "xfa/fxfa/parser/xfa_object.h"
#include "xfa/fxfa/parser/xfa_resolvenode_rs.h"
#include "xfa/fxfa/parser/xfa_utils.h"
@@ -131,7 +135,6 @@ CXFA_ScriptContext::~CXFA_ScriptContext() {
delete pVariableContext;
}
m_mapVariableToContext.clear();
- m_upObjectArray.RemoveAll();
}
void CXFA_ScriptContext::Initialize(v8::Isolate* pIsolate) {
@@ -146,12 +149,12 @@ bool CXFA_ScriptContext::RunScript(XFA_SCRIPTLANGTYPE eScriptType,
CFXJSE_Value* hRetValue,
CXFA_Object* pThisObject) {
CFX_ByteString btScript;
- XFA_SCRIPTLANGTYPE eSaveType = m_eScriptType;
+ CFX_AutoRestorer<XFA_SCRIPTLANGTYPE> typeRestorer(&m_eScriptType);
m_eScriptType = eScriptType;
if (eScriptType == XFA_SCRIPTLANGTYPE_Formcalc) {
if (!m_FM2JSContext) {
- m_FM2JSContext.reset(
- new CXFA_FM2JSContext(m_pIsolate, m_JsContext.get(), m_pDocument));
+ m_FM2JSContext = pdfium::MakeUnique<CXFA_FM2JSContext>(
+ m_pIsolate, m_JsContext.get(), m_pDocument);
}
CFX_WideTextBuf wsJavaScript;
CFX_WideString wsErrorInfo;
@@ -165,14 +168,12 @@ bool CXFA_ScriptContext::RunScript(XFA_SCRIPTLANGTYPE eScriptType,
} else {
btScript = FX_UTF8Encode(wsScript);
}
- CXFA_Object* pOriginalObject = m_pThisObject;
+ CFX_AutoRestorer<CXFA_Object*> nodeRestorer(&m_pThisObject);
m_pThisObject = pThisObject;
CFXJSE_Value* pValue = pThisObject ? GetJSValueFromMap(pThisObject) : nullptr;
- bool bRet = m_JsContext->ExecuteScript(btScript.c_str(), hRetValue, pValue);
- m_pThisObject = pOriginalObject;
- m_eScriptType = eSaveType;
- return bRet;
+ return m_JsContext->ExecuteScript(btScript.c_str(), hRetValue, pValue);
}
+
void CXFA_ScriptContext::GlobalPropertySetter(CFXJSE_Value* pObject,
const CFX_ByteStringC& szPropName,
CFXJSE_Value* pValue) {
@@ -215,13 +216,13 @@ bool CXFA_ScriptContext::QueryNodeByFlag(CXFA_Node* refNode,
if (ResolveObjects(refNode, propname, resolveRs, dwFlag) <= 0)
return false;
if (resolveRs.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) {
- pValue->Assign(GetJSValueFromMap(resolveRs.nodes[0]));
+ pValue->Assign(GetJSValueFromMap(resolveRs.objects.front()));
return true;
}
if (resolveRs.dwFlags == XFA_RESOVENODE_RSTYPE_Attribute) {
const XFA_SCRIPTATTRIBUTEINFO* lpAttributeInfo = resolveRs.pScriptAttribute;
if (lpAttributeInfo) {
- (resolveRs.nodes[0]->*(lpAttributeInfo->lpfnCallback))(
+ (resolveRs.objects.front()->*(lpAttributeInfo->lpfnCallback))(
pValue, bSetting, (XFA_ATTRIBUTE)lpAttributeInfo->eAttribute);
}
}
@@ -491,16 +492,13 @@ bool CXFA_ScriptContext::RunVariablesScript(CXFA_Node* pScriptNode) {
return false;
CFX_ByteString btScript = FX_UTF8Encode(wsScript);
- std::unique_ptr<CFXJSE_Value> hRetValue(new CFXJSE_Value(m_pIsolate));
+ auto hRetValue = pdfium::MakeUnique<CFXJSE_Value>(m_pIsolate);
CXFA_Node* pThisObject = pParent->GetNodeItem(XFA_NODEITEM_Parent);
CFXJSE_Context* pVariablesContext =
CreateVariablesContext(pScriptNode, pThisObject);
- CXFA_Object* pOriginalObject = m_pThisObject;
+ CFX_AutoRestorer<CXFA_Object*> nodeRestorer(&m_pThisObject);
m_pThisObject = pThisObject;
- bool bRet =
- pVariablesContext->ExecuteScript(btScript.c_str(), hRetValue.get());
- m_pThisObject = pOriginalObject;
- return bRet;
+ return pVariablesContext->ExecuteScript(btScript.c_str(), hRetValue.get());
}
bool CXFA_ScriptContext::QueryVariableValue(CXFA_Node* pScriptNode,
@@ -523,7 +521,7 @@ bool CXFA_ScriptContext::QueryVariableValue(CXFA_Node* pScriptNode,
bool bRes = false;
CFXJSE_Context* pVariableContext = static_cast<CFXJSE_Context*>(lpVariables);
std::unique_ptr<CFXJSE_Value> pObject = pVariableContext->GetGlobalObject();
- std::unique_ptr<CFXJSE_Value> hVariableValue(new CFXJSE_Value(m_pIsolate));
+ auto hVariableValue = pdfium::MakeUnique<CFXJSE_Value>(m_pIsolate);
if (!bGetter) {
pObject->SetObjectOwnProperty(szPropName, pValue);
bRes = true;
@@ -547,7 +545,7 @@ void CXFA_ScriptContext::DefineJsClass() {
void CXFA_ScriptContext::RemoveBuiltInObjs(CFXJSE_Context* pContext) const {
static const CFX_ByteStringC OBJ_NAME[2] = {"Number", "Date"};
std::unique_ptr<CFXJSE_Value> pObject = pContext->GetGlobalObject();
- std::unique_ptr<CFXJSE_Value> hProp(new CFXJSE_Value(m_pIsolate));
+ auto hProp = pdfium::MakeUnique<CFXJSE_Value>(m_pIsolate);
for (int i = 0; i < 2; ++i) {
if (pObject->GetObjectProperty(OBJ_NAME[i], hProp.get()))
pObject->DeleteObjectProperty(OBJ_NAME[i]);
@@ -556,38 +554,41 @@ void CXFA_ScriptContext::RemoveBuiltInObjs(CFXJSE_Context* pContext) const {
CFXJSE_Class* CXFA_ScriptContext::GetJseNormalClass() {
return m_pJsClass;
}
-int32_t CXFA_ScriptContext::ResolveObjects(CXFA_Object* refNode,
+
+int32_t CXFA_ScriptContext::ResolveObjects(CXFA_Object* refObject,
const CFX_WideStringC& wsExpression,
XFA_RESOLVENODE_RS& resolveNodeRS,
uint32_t dwStyles,
CXFA_Node* bindNode) {
- if (wsExpression.IsEmpty()) {
+ if (wsExpression.IsEmpty())
return 0;
- }
+
if (m_eScriptType != XFA_SCRIPTLANGTYPE_Formcalc ||
(dwStyles & (XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings))) {
- m_upObjectArray.RemoveAll();
+ m_upObjectArray.clear();
}
- if (refNode && refNode->IsNode() &&
+ if (refObject && refObject->IsNode() &&
(dwStyles & (XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings))) {
- m_upObjectArray.Add(refNode->AsNode());
+ m_upObjectArray.push_back(refObject->AsNode());
}
+
bool bNextCreate = false;
if (dwStyles & XFA_RESOLVENODE_CreateNode) {
m_ResolveProcessor->GetNodeHelper()->SetCreateNodeType(bindNode);
}
m_ResolveProcessor->GetNodeHelper()->m_pCreateParent = nullptr;
m_ResolveProcessor->GetNodeHelper()->m_iCurAllStart = -1;
+
CXFA_ResolveNodesData rndFind;
int32_t nStart = 0;
int32_t nLevel = 0;
int32_t nRet = -1;
rndFind.m_pSC = this;
- CXFA_ObjArray findNodes;
- findNodes.Add(refNode ? refNode : m_pDocument->GetRoot());
+ std::vector<CXFA_Object*> findObjects;
+ findObjects.push_back(refObject ? refObject : m_pDocument->GetRoot());
int32_t nNodes = 0;
while (true) {
- nNodes = findNodes.GetSize();
+ nNodes = pdfium::CollectionSize<int32_t>(findObjects);
int32_t i = 0;
rndFind.m_dwStyles = dwStyles;
m_ResolveProcessor->SetCurStart(nStart);
@@ -597,21 +598,22 @@ int32_t CXFA_ScriptContext::ResolveObjects(CXFA_Object* refNode,
CXFA_Node* pDataNode = nullptr;
nStart = m_ResolveProcessor->GetNodeHelper()->m_iCurAllStart;
if (nStart != -1) {
- pDataNode = m_pDocument->GetNotBindNode(findNodes);
+ pDataNode = m_pDocument->GetNotBindNode(findObjects);
if (pDataNode) {
- findNodes.RemoveAll();
- findNodes.Add(pDataNode);
+ findObjects.clear();
+ findObjects.push_back(pDataNode);
break;
}
} else {
- pDataNode = findNodes[0]->AsNode();
- findNodes.RemoveAll();
- findNodes.Add(pDataNode);
+ pDataNode = findObjects.front()->AsNode();
+ findObjects.clear();
+ findObjects.push_back(pDataNode);
break;
}
dwStyles |= XFA_RESOLVENODE_Bind;
- findNodes.RemoveAll();
- findNodes.Add(m_ResolveProcessor->GetNodeHelper()->m_pAllStartParent);
+ findObjects.clear();
+ findObjects.push_back(
+ m_ResolveProcessor->GetNodeHelper()->m_pAllStartParent);
continue;
} else {
break;
@@ -628,7 +630,7 @@ int32_t CXFA_ScriptContext::ResolveObjects(CXFA_Object* refNode,
break;
}
}
- CXFA_ObjArray retNodes;
+ std::vector<CXFA_Object*> retObjects;
while (i < nNodes) {
bool bDataBind = false;
if (((dwStyles & XFA_RESOLVENODE_Bind) ||
@@ -639,7 +641,7 @@ int32_t CXFA_ScriptContext::ResolveObjects(CXFA_Object* refNode,
m_ResolveProcessor->SetIndexDataBind(rndBind.m_wsCondition, i, nNodes);
bDataBind = true;
}
- rndFind.m_CurNode = findNodes[i++];
+ rndFind.m_CurObject = findObjects[i++];
rndFind.m_nLevel = nLevel;
rndFind.m_dwFlag = XFA_RESOVENODE_RSTYPE_Nodes;
nRet = m_ResolveProcessor->Resolve(rndFind);
@@ -648,30 +650,29 @@ int32_t CXFA_ScriptContext::ResolveObjects(CXFA_Object* refNode,
}
if (rndFind.m_dwFlag == XFA_RESOVENODE_RSTYPE_Attribute &&
rndFind.m_pScriptAttribute && nStart < wsExpression.GetLength()) {
- std::unique_ptr<CFXJSE_Value> pValue(new CFXJSE_Value(m_pIsolate));
- (rndFind.m_Nodes[0]->*(rndFind.m_pScriptAttribute->lpfnCallback))(
+ auto pValue = pdfium::MakeUnique<CFXJSE_Value>(m_pIsolate);
+ (rndFind.m_Objects.front()
+ ->*(rndFind.m_pScriptAttribute->lpfnCallback))(
pValue.get(), false,
(XFA_ATTRIBUTE)rndFind.m_pScriptAttribute->eAttribute);
- rndFind.m_Nodes.SetAt(0, ToObject(pValue.get(), nullptr));
+ rndFind.m_Objects.front() = ToObject(pValue.get(), nullptr);
}
- int32_t iSize = m_upObjectArray.GetSize();
- if (iSize) {
- m_upObjectArray.RemoveAt(iSize - 1);
- }
- retNodes.Append(rndFind.m_Nodes);
- rndFind.m_Nodes.RemoveAll();
- if (bDataBind) {
+ if (!m_upObjectArray.empty())
+ m_upObjectArray.pop_back();
+ retObjects.insert(retObjects.end(), rndFind.m_Objects.begin(),
+ rndFind.m_Objects.end());
+ rndFind.m_Objects.clear();
+ if (bDataBind)
break;
- }
}
- findNodes.RemoveAll();
- nNodes = retNodes.GetSize();
+ findObjects.clear();
+ nNodes = pdfium::CollectionSize<int32_t>(retObjects);
if (nNodes < 1) {
if (dwStyles & XFA_RESOLVENODE_CreateNode) {
bNextCreate = true;
if (!m_ResolveProcessor->GetNodeHelper()->m_pCreateParent) {
m_ResolveProcessor->GetNodeHelper()->m_pCreateParent =
- ToNode(rndFind.m_CurNode);
+ ToNode(rndFind.m_CurObject);
m_ResolveProcessor->GetNodeHelper()->m_iCreateCount = 1;
}
bool bCreate =
@@ -687,8 +688,9 @@ int32_t CXFA_ScriptContext::ResolveObjects(CXFA_Object* refNode,
break;
}
}
- findNodes.Copy(retNodes);
- rndFind.m_Nodes.RemoveAll();
+ findObjects =
+ std::vector<CXFA_Object*>(retObjects.begin(), retObjects.end());
+ rndFind.m_Objects.clear();
if (nLevel == 0) {
dwStyles &= ~(XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings);
}
@@ -697,7 +699,8 @@ int32_t CXFA_ScriptContext::ResolveObjects(CXFA_Object* refNode,
if (!bNextCreate) {
resolveNodeRS.dwFlags = rndFind.m_dwFlag;
if (nNodes > 0) {
- resolveNodeRS.nodes.Append(findNodes);
+ resolveNodeRS.objects.insert(resolveNodeRS.objects.end(),
+ findObjects.begin(), findObjects.end());
}
if (rndFind.m_dwFlag == XFA_RESOVENODE_RSTYPE_Attribute) {
resolveNodeRS.pScriptAttribute = rndFind.m_pScriptAttribute;
@@ -711,7 +714,7 @@ int32_t CXFA_ScriptContext::ResolveObjects(CXFA_Object* refNode,
if (!bNextCreate && (dwStyles & XFA_RESOLVENODE_CreateNode)) {
resolveNodeRS.dwFlags = XFA_RESOVENODE_RSTYPE_ExistNodes;
}
- return resolveNodeRS.nodes.GetSize();
+ return pdfium::CollectionSize<int32_t>(resolveNodeRS.objects);
}
return nNodes;
}
@@ -730,7 +733,7 @@ CFXJSE_Value* CXFA_ScriptContext::GetJSValueFromMap(CXFA_Object* pObject) {
if (iter != m_mapObjectToValue.end())
return iter->second.get();
- std::unique_ptr<CFXJSE_Value> jsValue(new CFXJSE_Value(m_pIsolate));
+ auto jsValue = pdfium::MakeUnique<CFXJSE_Value>(m_pIsolate);
jsValue->SetObject(pObject, m_pJsClass);
CFXJSE_Value* pValue = jsValue.get();
m_mapObjectToValue.insert(std::make_pair(pObject, std::move(jsValue)));
@@ -752,18 +755,17 @@ void CXFA_ScriptContext::GetSomExpression(CXFA_Node* refNode,
lpNodeHelper->GetNameExpression(refNode, wsExpression, true,
XFA_LOGIC_Transparent);
}
-void CXFA_ScriptContext::SetNodesOfRunScript(CXFA_NodeArray* pArray) {
+void CXFA_ScriptContext::SetNodesOfRunScript(std::vector<CXFA_Node*>* pArray) {
m_pScriptNodeArray = pArray;
}
-void CXFA_ScriptContext::AddNodesOfRunScript(const CXFA_NodeArray& nodes) {
- if (!m_pScriptNodeArray)
- return;
- if (nodes.GetSize() > 0)
- m_pScriptNodeArray->Copy(nodes);
+
+void CXFA_ScriptContext::AddNodesOfRunScript(
+ const std::vector<CXFA_Node*>& nodes) {
+ if (m_pScriptNodeArray && !nodes.empty())
+ *m_pScriptNodeArray = nodes;
}
+
void CXFA_ScriptContext::AddNodesOfRunScript(CXFA_Node* pNode) {
- if (!m_pScriptNodeArray)
- return;
- if (m_pScriptNodeArray->Find(pNode) == -1)
- m_pScriptNodeArray->Add(pNode);
+ if (m_pScriptNodeArray && !pdfium::ContainsValue(*m_pScriptNodeArray, pNode))
+ m_pScriptNodeArray->push_back(pNode);
}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_scriptcontext.h b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_scriptcontext.h
index 6d4f73a632f..3f81bb8ebe3 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_scriptcontext.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_scriptcontext.h
@@ -32,9 +32,9 @@ class CXFA_ScriptContext {
bool RunScript(XFA_SCRIPTLANGTYPE eScriptType,
const CFX_WideStringC& wsScript,
CFXJSE_Value* pRetValue,
- CXFA_Object* pThisObject = nullptr);
+ CXFA_Object* pThisObject);
- int32_t ResolveObjects(CXFA_Object* refNode,
+ int32_t ResolveObjects(CXFA_Object* refObject,
const CFX_WideStringC& wsExpression,
XFA_RESOLVENODE_RS& resolveNodeRS,
uint32_t dwStyles = XFA_RESOLVENODE_Children,
@@ -48,8 +48,8 @@ class CXFA_ScriptContext {
int32_t GetIndexByClassName(CXFA_Node* refNode);
void GetSomExpression(CXFA_Node* refNode, CFX_WideString& wsExpression);
- void SetNodesOfRunScript(CXFA_NodeArray* pArray);
- void AddNodesOfRunScript(const CXFA_NodeArray& nodes);
+ void SetNodesOfRunScript(std::vector<CXFA_Node*>* pArray);
+ void AddNodesOfRunScript(const std::vector<CXFA_Node*>& nodes);
void AddNodesOfRunScript(CXFA_Node* pNode);
CFXJSE_Class* GetJseNormalClass();
@@ -91,7 +91,7 @@ class CXFA_ScriptContext {
CXFA_Object* GetVariablesThis(CXFA_Object* pObject, bool bScriptNode = false);
bool IsStrictScopeInJavaScript();
XFA_SCRIPTLANGTYPE GetType();
- CXFA_NodeArray& GetUpObjectArray() { return m_upObjectArray; }
+ std::vector<CXFA_Node*>* GetUpObjectArray() { return &m_upObjectArray; }
CXFA_Document* GetDocument() const { return m_pDocument; }
static CXFA_Object* ToObject(CFXJSE_Value* pValue, CFXJSE_Class* pClass);
@@ -111,10 +111,10 @@ class CXFA_ScriptContext {
std::map<CXFA_Object*, std::unique_ptr<CFXJSE_Value>> m_mapObjectToValue;
std::map<CXFA_Object*, CFXJSE_Context*> m_mapVariableToContext;
CXFA_EventParam m_eventParam;
- CXFA_NodeArray m_upObjectArray;
+ std::vector<CXFA_Node*> m_upObjectArray;
// CacheList holds the NodeList items so we can clean them up when we're done.
std::vector<std::unique_ptr<CXFA_NodeList>> m_CacheList;
- CXFA_NodeArray* m_pScriptNodeArray;
+ std::vector<CXFA_Node*>* m_pScriptNodeArray;
std::unique_ptr<CXFA_ResolveProcessor> m_ResolveProcessor;
std::unique_ptr<CXFA_FM2JSContext> m_FM2JSContext;
CXFA_Object* m_pThisObject;
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_simple_parser.cpp b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_simple_parser.cpp
index 4a6956de198..cce4b68a270 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_simple_parser.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_simple_parser.cpp
@@ -7,17 +7,25 @@
#include "xfa/fxfa/parser/cxfa_simple_parser.h"
#include <utility>
+#include <vector>
+#include "core/fxcrt/cfx_checksumcontext.h"
#include "core/fxcrt/fx_ext.h"
#include "third_party/base/ptr_util.h"
+#include "xfa/fde/xml/cfde_xmlchardata.h"
+#include "xfa/fde/xml/cfde_xmldoc.h"
+#include "xfa/fde/xml/cfde_xmlelement.h"
+#include "xfa/fde/xml/cfde_xmlinstruction.h"
+#include "xfa/fde/xml/cfde_xmlnode.h"
+#include "xfa/fde/xml/cfde_xmlparser.h"
+#include "xfa/fde/xml/cfde_xmltext.h"
#include "xfa/fgas/crt/fgas_codepage.h"
+#include "xfa/fgas/crt/ifgas_stream.h"
#include "xfa/fxfa/fxfa.h"
#include "xfa/fxfa/parser/cxfa_document.h"
-#include "xfa/fxfa/parser/cxfa_widetextread.h"
-#include "xfa/fxfa/parser/cxfa_xml_parser.h"
+#include "xfa/fxfa/parser/cxfa_node.h"
#include "xfa/fxfa/parser/xfa_basic_data.h"
#include "xfa/fxfa/parser/xfa_utils.h"
-#include "xfa/fxfa/xfa_checksum.h"
namespace {
@@ -47,14 +55,14 @@ CFDE_XMLNode* GetDocumentNode(CFDE_XMLDoc* pXMLDoc,
return nullptr;
}
-void GetElementTagNamespaceURI(CFDE_XMLElement* pElement,
- CFX_WideString& wsNamespaceURI) {
- CFX_WideString wsNodeStr;
- pElement->GetNamespacePrefix(wsNodeStr);
+CFX_WideString GetElementTagNamespaceURI(CFDE_XMLElement* pElement) {
+ CFX_WideString wsNodeStr = pElement->GetNamespacePrefix();
+ CFX_WideString wsNamespaceURI;
if (!XFA_FDEExtension_ResolveNamespaceQualifier(
- pElement, wsNodeStr.AsStringC(), wsNamespaceURI)) {
- wsNamespaceURI.clear();
+ pElement, wsNodeStr.AsStringC(), &wsNamespaceURI)) {
+ return CFX_WideString();
}
+ return wsNamespaceURI;
}
bool MatchNodeName(CFDE_XMLNode* pNode,
@@ -65,18 +73,18 @@ bool MatchNodeName(CFDE_XMLNode* pNode,
return false;
CFDE_XMLElement* pElement = reinterpret_cast<CFDE_XMLElement*>(pNode);
- CFX_WideString wsNodeStr;
- pElement->GetLocalTagName(wsNodeStr);
+ CFX_WideString wsNodeStr = pElement->GetLocalTagName();
if (wsNodeStr != wsLocalTagName)
return false;
- GetElementTagNamespaceURI(pElement, wsNodeStr);
+ wsNodeStr = GetElementTagNamespaceURI(pElement);
if (eMatchFlags & XFA_XDPPACKET_FLAGS_NOMATCH)
return true;
if (eMatchFlags & XFA_XDPPACKET_FLAGS_PREFIXMATCH) {
return wsNodeStr.Left(wsNamespaceURIPrefix.GetLength()) ==
wsNamespaceURIPrefix;
}
+
return wsNodeStr == wsNamespaceURIPrefix;
}
@@ -107,7 +115,7 @@ bool ResolveAttribute(CFDE_XMLElement* pElement,
return false;
}
if (!XFA_FDEExtension_ResolveNamespaceQualifier(
- pElement, wsNSPrefix.AsStringC(), wsNamespaceURI)) {
+ pElement, wsNSPrefix.AsStringC(), &wsNamespaceURI)) {
wsNamespaceURI.clear();
return false;
}
@@ -122,26 +130,23 @@ bool FindAttributeWithNS(CFDE_XMLElement* pElement,
if (!pElement)
return false;
- CFX_WideString wsAttrName;
- CFX_WideString wsAttrValue;
CFX_WideString wsAttrNS;
- for (int32_t iAttrCount = pElement->CountAttributes(), i = 0; i < iAttrCount;
- i++) {
- pElement->GetAttribute(i, wsAttrName, wsAttrValue);
- FX_STRSIZE iFind = wsAttrName.Find(L':', 0);
+ for (auto it : pElement->GetAttributes()) {
+ FX_STRSIZE iFind = it.first.Find(L':', 0);
CFX_WideString wsNSPrefix;
if (iFind < 0) {
- if (wsLocalAttributeName != wsAttrName)
+ if (wsLocalAttributeName != it.first)
continue;
} else {
if (wsLocalAttributeName !=
- wsAttrName.Right(wsAttrName.GetLength() - iFind - 1)) {
+ it.first.Right(it.first.GetLength() - iFind - 1)) {
continue;
}
- wsNSPrefix = wsAttrName.Left(iFind);
+ wsNSPrefix = it.first.Left(iFind);
}
+
if (!XFA_FDEExtension_ResolveNamespaceQualifier(
- pElement, wsNSPrefix.AsStringC(), wsAttrNS)) {
+ pElement, wsNSPrefix.AsStringC(), &wsAttrNS)) {
continue;
}
if (bMatchNSAsPrefix) {
@@ -153,7 +158,7 @@ bool FindAttributeWithNS(CFDE_XMLElement* pElement,
if (wsAttrNS != wsNamespaceURIPrefix)
continue;
}
- wsValue = wsAttrValue;
+ wsValue = it.second;
return true;
}
return false;
@@ -200,30 +205,22 @@ void ConvertXMLToPlainText(CFDE_XMLElement* pRootXMLNode,
pXMLChild = pXMLChild->GetNodeItem(CFDE_XMLNode::NextSibling)) {
switch (pXMLChild->GetType()) {
case FDE_XMLNODE_Element: {
- CFX_WideString wsTextData;
- static_cast<CFDE_XMLElement*>(pXMLChild)->GetTextData(wsTextData);
+ CFX_WideString wsTextData =
+ static_cast<CFDE_XMLElement*>(pXMLChild)->GetTextData();
wsTextData += L"\n";
wsOutput += wsTextData;
break;
}
- case FDE_XMLNODE_Text: {
- CFX_WideString wsText;
- static_cast<CFDE_XMLText*>(pXMLChild)->GetText(wsText);
+ case FDE_XMLNODE_Text:
+ case FDE_XMLNODE_CharData: {
+ CFX_WideString wsText =
+ static_cast<CFDE_XMLText*>(pXMLChild)->GetText();
if (IsStringAllWhitespace(wsText))
continue;
wsOutput = wsText;
break;
}
- case FDE_XMLNODE_CharData: {
- CFX_WideString wsCharData;
- static_cast<CFDE_XMLCharData*>(pXMLChild)->GetCharData(wsCharData);
- if (IsStringAllWhitespace(wsCharData))
- continue;
-
- wsOutput = wsCharData;
- break;
- }
default:
ASSERT(false);
break;
@@ -254,13 +251,8 @@ const XFA_PACKETINFO* GetPacketByName(const CFX_WideStringC& wsName) {
} // namespace
bool XFA_RecognizeRichText(CFDE_XMLElement* pRichTextXMLNode) {
- if (pRichTextXMLNode) {
- CFX_WideString wsNamespaceURI;
- GetElementTagNamespaceURI(pRichTextXMLNode, wsNamespaceURI);
- if (wsNamespaceURI == L"http://www.w3.org/1999/xhtml")
- return true;
- }
- return false;
+ return pRichTextXMLNode && GetElementTagNamespaceURI(pRichTextXMLNode) ==
+ L"http://www.w3.org/1999/xhtml";
}
CXFA_SimpleParser::CXFA_SimpleParser(CXFA_Document* pFactory,
@@ -285,8 +277,7 @@ int32_t CXFA_SimpleParser::StartParse(
XFA_XDPPACKET ePacketID) {
CloseParser();
m_pFileRead = pStream;
- m_pStream = IFGAS_Stream::CreateStream(
- pStream, FX_STREAMACCESS_Read | FX_STREAMACCESS_Text);
+ m_pStream = IFGAS_Stream::CreateReadStream(pStream);
if (!m_pStream)
return XFA_PARSESTATUS_StreamErr;
@@ -297,7 +288,7 @@ int32_t CXFA_SimpleParser::StartParse(
}
m_pXMLDoc = pdfium::MakeUnique<CFDE_XMLDoc>();
auto pNewParser =
- pdfium::MakeUnique<CXFA_XMLParser>(m_pXMLDoc->GetRoot(), m_pStream);
+ pdfium::MakeUnique<CFDE_XMLParser>(m_pXMLDoc->GetRoot(), m_pStream);
m_pXMLParser = pNewParser.get();
if (!m_pXMLDoc->LoadXML(std::move(pNewParser)))
return XFA_PARSESTATUS_StatusErr;
@@ -319,6 +310,7 @@ int32_t CXFA_SimpleParser::DoParse(IFX_Pause* pPause) {
m_pRootNode = ParseAsXDPPacket(GetDocumentNode(m_pXMLDoc.get()), m_ePacketID);
m_pXMLDoc->CloseXML();
m_pStream.Reset();
+
if (!m_pRootNode)
return XFA_PARSESTATUS_StatusErr;
@@ -331,9 +323,10 @@ int32_t CXFA_SimpleParser::ParseXMLData(const CFX_WideString& wsXML,
CloseParser();
pXMLNode = nullptr;
m_pXMLDoc = pdfium::MakeUnique<CFDE_XMLDoc>();
- auto pStream = pdfium::MakeRetain<CXFA_WideTextRead>(wsXML);
+ CFX_RetainPtr<IFGAS_Stream> pStream =
+ IFGAS_Stream::CreateWideStringReadStream(wsXML);
auto pParser =
- pdfium::MakeUnique<CXFA_XMLParser>(m_pXMLDoc->GetRoot(), pStream);
+ pdfium::MakeUnique<CFDE_XMLParser>(m_pXMLDoc->GetRoot(), pStream);
pParser->m_dwCheckStatus = 0x03;
if (!m_pXMLDoc->LoadXML(std::move(pParser)))
return XFA_PARSESTATUS_StatusErr;
@@ -369,9 +362,8 @@ void CXFA_SimpleParser::ConstructXFANode(CXFA_Node* pXFANode,
if (!pXFAChild)
return;
- CFX_WideString wsNodeStr;
CFDE_XMLElement* child = static_cast<CFDE_XMLElement*>(pXMLChild);
- child->GetLocalTagName(wsNodeStr);
+ CFX_WideString wsNodeStr = child->GetLocalTagName();
pXFAChild->SetCData(XFA_ATTRIBUTE_Name, wsNodeStr);
CFX_WideString wsChildValue;
XFA_GetPlainTextFromRichText(child, wsChildValue);
@@ -407,7 +399,7 @@ CFDE_XMLDoc* CXFA_SimpleParser::GetXMLDoc() const {
bool XFA_FDEExtension_ResolveNamespaceQualifier(
CFDE_XMLElement* pNode,
const CFX_WideStringC& wsQualifier,
- CFX_WideString& wsNamespaceURI) {
+ CFX_WideString* wsNamespaceURI) {
if (!pNode)
return false;
@@ -420,17 +412,18 @@ bool XFA_FDEExtension_ResolveNamespaceQualifier(
} else {
wsNSAttribute = L"xmlns:" + wsQualifier;
}
- for (; pNode != pFakeRoot; pNode = static_cast<CFDE_XMLElement*>(
- pNode->GetNodeItem(CFDE_XMLNode::Parent))) {
- if (pNode->GetType() != FDE_XMLNODE_Element)
+ for (CFDE_XMLNode* pParent = pNode; pParent != pFakeRoot;
+ pParent = pParent->GetNodeItem(CFDE_XMLNode::Parent)) {
+ if (pParent->GetType() != FDE_XMLNODE_Element)
continue;
- if (pNode->HasAttribute(wsNSAttribute.c_str())) {
- pNode->GetString(wsNSAttribute.c_str(), wsNamespaceURI);
+ auto* pElement = static_cast<CFDE_XMLElement*>(pParent);
+ if (pElement->HasAttribute(wsNSAttribute.c_str())) {
+ *wsNamespaceURI = pElement->GetString(wsNSAttribute.c_str());
return true;
}
}
- wsNamespaceURI.clear();
+ wsNamespaceURI->clear();
return bRet;
}
@@ -469,6 +462,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_XDP(
XFA_GetPacketByIndex(XFA_PACKET_XDP)->eFlags)) {
return nullptr;
}
+
CXFA_Node* pXFARootNode =
m_pFactory->CreateNode(XFA_XDPPACKET_XDP, XFA_Element::Xfa);
if (!pXFARootNode)
@@ -476,109 +470,98 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_XDP(
m_pRootNode = pXFARootNode;
pXFARootNode->SetCData(XFA_ATTRIBUTE_Name, L"xfa");
- {
- CFDE_XMLElement* pElement = static_cast<CFDE_XMLElement*>(pXMLDocumentNode);
- int32_t iAttributeCount = pElement->CountAttributes();
- for (int32_t i = 0; i < iAttributeCount; i++) {
- CFX_WideString wsAttriName, wsAttriValue;
- pElement->GetAttribute(i, wsAttriName, wsAttriValue);
- if (wsAttriName == L"uuid")
- pXFARootNode->SetCData(XFA_ATTRIBUTE_Uuid, wsAttriValue);
- else if (wsAttriName == L"timeStamp")
- pXFARootNode->SetCData(XFA_ATTRIBUTE_TimeStamp, wsAttriValue);
- }
+
+ CFDE_XMLElement* pElement = static_cast<CFDE_XMLElement*>(pXMLDocumentNode);
+ for (auto it : pElement->GetAttributes()) {
+ if (it.first == L"uuid")
+ pXFARootNode->SetCData(XFA_ATTRIBUTE_Uuid, it.second);
+ else if (it.first == L"timeStamp")
+ pXFARootNode->SetCData(XFA_ATTRIBUTE_TimeStamp, it.second);
}
CFDE_XMLNode* pXMLConfigDOMRoot = nullptr;
CXFA_Node* pXFAConfigDOMRoot = nullptr;
- {
- for (CFDE_XMLNode* pChildItem =
- pXMLDocumentNode->GetNodeItem(CFDE_XMLNode::FirstChild);
- pChildItem;
- pChildItem = pChildItem->GetNodeItem(CFDE_XMLNode::NextSibling)) {
- const XFA_PACKETINFO* pPacketInfo =
- XFA_GetPacketByIndex(XFA_PACKET_Config);
- if (!MatchNodeName(pChildItem, pPacketInfo->pName, pPacketInfo->pURI,
- pPacketInfo->eFlags)) {
- continue;
- }
- if (pXFARootNode->GetFirstChildByName(pPacketInfo->uHash)) {
- return nullptr;
- }
- pXMLConfigDOMRoot = pChildItem;
- pXFAConfigDOMRoot =
- ParseAsXDPPacket_Config(pXMLConfigDOMRoot, XFA_XDPPACKET_Config);
- pXFARootNode->InsertChild(pXFAConfigDOMRoot, nullptr);
+ for (CFDE_XMLNode* pChildItem =
+ pXMLDocumentNode->GetNodeItem(CFDE_XMLNode::FirstChild);
+ pChildItem;
+ pChildItem = pChildItem->GetNodeItem(CFDE_XMLNode::NextSibling)) {
+ const XFA_PACKETINFO* pPacketInfo = XFA_GetPacketByIndex(XFA_PACKET_Config);
+ if (!MatchNodeName(pChildItem, pPacketInfo->pName, pPacketInfo->pURI,
+ pPacketInfo->eFlags)) {
+ continue;
}
+ if (pXFARootNode->GetFirstChildByName(pPacketInfo->uHash))
+ return nullptr;
+
+ pXMLConfigDOMRoot = pChildItem;
+ pXFAConfigDOMRoot =
+ ParseAsXDPPacket_Config(pXMLConfigDOMRoot, XFA_XDPPACKET_Config);
+ pXFARootNode->InsertChild(pXFAConfigDOMRoot, nullptr);
}
CFDE_XMLNode* pXMLDatasetsDOMRoot = nullptr;
CFDE_XMLNode* pXMLFormDOMRoot = nullptr;
CFDE_XMLNode* pXMLTemplateDOMRoot = nullptr;
- {
- for (CFDE_XMLNode* pChildItem =
- pXMLDocumentNode->GetNodeItem(CFDE_XMLNode::FirstChild);
- pChildItem;
- pChildItem = pChildItem->GetNodeItem(CFDE_XMLNode::NextSibling)) {
- if (!pChildItem || pChildItem->GetType() != FDE_XMLNODE_Element)
- continue;
- if (pChildItem == pXMLConfigDOMRoot)
- continue;
+ for (CFDE_XMLNode* pChildItem =
+ pXMLDocumentNode->GetNodeItem(CFDE_XMLNode::FirstChild);
+ pChildItem;
+ pChildItem = pChildItem->GetNodeItem(CFDE_XMLNode::NextSibling)) {
+ if (!pChildItem || pChildItem->GetType() != FDE_XMLNODE_Element)
+ continue;
+ if (pChildItem == pXMLConfigDOMRoot)
+ continue;
- CFDE_XMLElement* pElement =
- reinterpret_cast<CFDE_XMLElement*>(pChildItem);
- CFX_WideString wsPacketName;
- pElement->GetLocalTagName(wsPacketName);
- const XFA_PACKETINFO* pPacketInfo =
- GetPacketByName(wsPacketName.AsStringC());
- if (pPacketInfo && pPacketInfo->pURI) {
- if (!MatchNodeName(pElement, pPacketInfo->pName, pPacketInfo->pURI,
- pPacketInfo->eFlags)) {
- pPacketInfo = nullptr;
- }
+ CFDE_XMLElement* pElement = reinterpret_cast<CFDE_XMLElement*>(pChildItem);
+ CFX_WideString wsPacketName = pElement->GetLocalTagName();
+ const XFA_PACKETINFO* pPacketInfo =
+ GetPacketByName(wsPacketName.AsStringC());
+ if (pPacketInfo && pPacketInfo->pURI) {
+ if (!MatchNodeName(pElement, pPacketInfo->pName, pPacketInfo->pURI,
+ pPacketInfo->eFlags)) {
+ pPacketInfo = nullptr;
}
- XFA_XDPPACKET ePacket =
- pPacketInfo ? pPacketInfo->eName : XFA_XDPPACKET_USER;
- if (ePacket == XFA_XDPPACKET_XDP)
- continue;
- if (ePacket == XFA_XDPPACKET_Datasets) {
- if (pXMLDatasetsDOMRoot)
- return nullptr;
+ }
+ XFA_XDPPACKET ePacket =
+ pPacketInfo ? pPacketInfo->eName : XFA_XDPPACKET_USER;
+ if (ePacket == XFA_XDPPACKET_XDP)
+ continue;
+ if (ePacket == XFA_XDPPACKET_Datasets) {
+ if (pXMLDatasetsDOMRoot)
+ return nullptr;
- pXMLDatasetsDOMRoot = pElement;
- } else if (ePacket == XFA_XDPPACKET_Form) {
- if (pXMLFormDOMRoot)
- return nullptr;
+ pXMLDatasetsDOMRoot = pElement;
+ } else if (ePacket == XFA_XDPPACKET_Form) {
+ if (pXMLFormDOMRoot)
+ return nullptr;
- pXMLFormDOMRoot = pElement;
- } else if (ePacket == XFA_XDPPACKET_Template) {
- if (pXMLTemplateDOMRoot) {
- // Found a duplicate template packet.
+ pXMLFormDOMRoot = pElement;
+ } else if (ePacket == XFA_XDPPACKET_Template) {
+ // Found a duplicate template packet.
+ if (pXMLTemplateDOMRoot)
+ return nullptr;
+
+ CXFA_Node* pPacketNode = ParseAsXDPPacket(pElement, ePacket);
+ if (pPacketNode) {
+ pXMLTemplateDOMRoot = pElement;
+ pXFARootNode->InsertChild(pPacketNode);
+ }
+ } else {
+ CXFA_Node* pPacketNode = ParseAsXDPPacket(pElement, ePacket);
+ if (pPacketNode) {
+ if (pPacketInfo &&
+ (pPacketInfo->eFlags & XFA_XDPPACKET_FLAGS_SUPPORTONE) &&
+ pXFARootNode->GetFirstChildByName(pPacketInfo->uHash)) {
return nullptr;
}
- CXFA_Node* pPacketNode = ParseAsXDPPacket(pElement, ePacket);
- if (pPacketNode) {
- pXMLTemplateDOMRoot = pElement;
- pXFARootNode->InsertChild(pPacketNode);
- }
- } else {
- CXFA_Node* pPacketNode = ParseAsXDPPacket(pElement, ePacket);
- if (pPacketNode) {
- if (pPacketInfo &&
- (pPacketInfo->eFlags & XFA_XDPPACKET_FLAGS_SUPPORTONE) &&
- pXFARootNode->GetFirstChildByName(pPacketInfo->uHash)) {
- return nullptr;
- }
- pXFARootNode->InsertChild(pPacketNode);
- }
+ pXFARootNode->InsertChild(pPacketNode);
}
}
}
- if (!pXMLTemplateDOMRoot) {
- // No template is found.
+ // No template is found.
+ if (!pXMLTemplateDOMRoot)
return nullptr;
- }
+
if (pXMLDatasetsDOMRoot) {
CXFA_Node* pPacketNode =
ParseAsXDPPacket(pXMLDatasetsDOMRoot, XFA_XDPPACKET_Datasets);
@@ -591,6 +574,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_XDP(
if (pPacketNode)
pXFARootNode->InsertChild(pPacketNode);
}
+
pXFARootNode->SetXMLMappingNode(pXMLDocumentNode);
return pXFARootNode;
}
@@ -635,12 +619,11 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_TemplateForm(
pNode->SetCData(XFA_ATTRIBUTE_Name,
XFA_GetPacketByIndex(XFA_PACKET_Template)->pName);
if (m_bDocumentParser) {
- CFX_WideString wsNamespaceURI;
CFDE_XMLElement* pXMLDocumentElement =
static_cast<CFDE_XMLElement*>(pXMLDocumentNode);
- pXMLDocumentElement->GetNamespaceURI(wsNamespaceURI);
+ CFX_WideString wsNamespaceURI = pXMLDocumentElement->GetNamespaceURI();
if (wsNamespaceURI.IsEmpty())
- pXMLDocumentElement->GetString(L"xmlns:xfa", wsNamespaceURI);
+ wsNamespaceURI = pXMLDocumentElement->GetString(L"xmlns:xfa");
pNode->GetDocument()->RecognizeXFAVersionNumber(wsNamespaceURI);
}
@@ -654,13 +637,13 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_TemplateForm(
XFA_GetPacketByIndex(XFA_PACKET_Form)->eFlags)) {
CFDE_XMLElement* pXMLDocumentElement =
static_cast<CFDE_XMLElement*>(pXMLDocumentNode);
- CFX_WideString wsChecksum;
- pXMLDocumentElement->GetString(L"checksum", wsChecksum);
+ CFX_WideString wsChecksum = pXMLDocumentElement->GetString(L"checksum");
if (wsChecksum.GetLength() != 28 ||
m_pXMLParser->m_dwCheckStatus != 0x03) {
return nullptr;
}
- std::unique_ptr<CXFA_ChecksumContext> pChecksum(new CXFA_ChecksumContext);
+
+ auto pChecksum = pdfium::MakeUnique<CFX_ChecksumContext>();
pChecksum->StartChecksum();
pChecksum->UpdateChecksum(m_pFileRead, m_pXMLParser->m_nStart[0],
m_pXMLParser->m_nSize[0]);
@@ -750,8 +733,8 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Data(
delete pDataXMLNode;
return nullptr;
}
- CFX_WideString wsLocalName;
- static_cast<CFDE_XMLElement*>(pDataXMLNode)->GetLocalTagName(wsLocalName);
+ CFX_WideString wsLocalName =
+ static_cast<CFDE_XMLElement*>(pDataXMLNode)->GetLocalTagName();
pNode->SetCData(XFA_ATTRIBUTE_Name, wsLocalName);
if (!DataLoader(pNode, pDataXMLNode, true))
return nullptr;
@@ -847,8 +830,8 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_User(
if (!pNode)
return nullptr;
- CFX_WideString wsName;
- static_cast<CFDE_XMLElement*>(pXMLDocumentNode)->GetLocalTagName(wsName);
+ CFX_WideString wsName =
+ static_cast<CFDE_XMLElement*>(pXMLDocumentNode)->GetLocalTagName();
pNode->SetCData(XFA_ATTRIBUTE_Name, wsName);
if (!UserPacketLoader(pNode, pXMLDocumentNode))
return nullptr;
@@ -880,8 +863,7 @@ CXFA_Node* CXFA_SimpleParser::NormalLoader(CXFA_Node* pXFANode,
switch (pXMLChild->GetType()) {
case FDE_XMLNODE_Element: {
CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLChild);
- CFX_WideString wsTagName;
- pXMLElement->GetLocalTagName(wsTagName);
+ CFX_WideString wsTagName = pXMLElement->GetLocalTagName();
XFA_Element eType = XFA_GetElementTypeForName(wsTagName.AsStringC());
if (eType == XFA_Element::Unknown)
continue;
@@ -903,16 +885,12 @@ CXFA_Node* CXFA_SimpleParser::NormalLoader(CXFA_Node* pXFANode,
pXFAChild->SetAttribute(XFA_ATTRIBUTE_Name, wsTagName.AsStringC());
bool IsNeedValue = true;
- for (int32_t i = 0, count = pXMLElement->CountAttributes(); i < count;
- i++) {
- CFX_WideString wsAttrQualifiedName;
+ for (auto it : pXMLElement->GetAttributes()) {
CFX_WideString wsAttrName;
- CFX_WideString wsAttrValue;
- pXMLElement->GetAttribute(i, wsAttrQualifiedName, wsAttrValue);
- GetAttributeLocalName(wsAttrQualifiedName.AsStringC(), wsAttrName);
- if (wsAttrName == L"nil" && wsAttrValue == L"true") {
+ GetAttributeLocalName(it.first.AsStringC(), wsAttrName);
+ if (wsAttrName == L"nil" && it.second == L"true")
IsNeedValue = false;
- }
+
const XFA_ATTRIBUTEINFO* lpAttrInfo =
XFA_GetAttributeByName(wsAttrName.AsStringC());
if (!lpAttrInfo)
@@ -922,7 +900,7 @@ CXFA_Node* CXFA_SimpleParser::NormalLoader(CXFA_Node* pXFANode,
lpAttrInfo->eName != XFA_ATTRIBUTE_Save) {
continue;
}
- pXFAChild->SetAttribute(lpAttrInfo->eName, wsAttrValue.AsStringC());
+ pXFAChild->SetAttribute(lpAttrInfo->eName, it.second.AsStringC());
}
pXFANode->InsertChild(pXFAChild);
if (eType == XFA_Element::Validate || eType == XFA_Element::Locale) {
@@ -996,10 +974,8 @@ void CXFA_SimpleParser::ParseContentNode(CXFA_Node* pXFANode,
} else {
if (eNodeType == FDE_XMLNODE_Element)
break;
- if (eNodeType == FDE_XMLNODE_Text)
- static_cast<CFDE_XMLText*>(pXMLChild)->GetText(wsValue);
- else if (eNodeType == FDE_XMLNODE_CharData)
- static_cast<CFDE_XMLCharData*>(pXMLChild)->GetCharData(wsValue);
+ if (eNodeType == FDE_XMLNODE_Text || eNodeType == FDE_XMLNODE_CharData)
+ wsValue = static_cast<CFDE_XMLText*>(pXMLChild)->GetText();
}
break;
}
@@ -1027,8 +1003,8 @@ void CXFA_SimpleParser::ParseDataGroup(CXFA_Node* pXFANode,
case FDE_XMLNODE_Element: {
CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLChild);
{
- CFX_WideString wsNamespaceURI;
- GetElementTagNamespaceURI(pXMLElement, wsNamespaceURI);
+ CFX_WideString wsNamespaceURI =
+ GetElementTagNamespaceURI(pXMLElement);
if (wsNamespaceURI == L"http://www.xfa.com/schema/xfa-package/" ||
wsNamespaceURI == L"http://www.xfa.org/schema/xfa-package/" ||
wsNamespaceURI == L"http://www.w3.org/2001/XMLSchema-instance") {
@@ -1079,21 +1055,17 @@ void CXFA_SimpleParser::ParseDataGroup(CXFA_Node* pXFANode,
if (!pXFAChild)
return;
- CFX_WideString wsNodeName;
- pXMLElement->GetLocalTagName(wsNodeName);
- pXFAChild->SetCData(XFA_ATTRIBUTE_Name, wsNodeName);
+ pXFAChild->SetCData(XFA_ATTRIBUTE_Name, pXMLElement->GetLocalTagName());
bool bNeedValue = true;
- for (int32_t i = 0; i < pXMLElement->CountAttributes(); ++i) {
- CFX_WideString wsQualifiedName;
- CFX_WideString wsValue;
+
+ for (auto it : pXMLElement->GetAttributes()) {
CFX_WideString wsName;
CFX_WideString wsNS;
- pXMLElement->GetAttribute(i, wsQualifiedName, wsValue);
- if (!ResolveAttribute(pXMLElement, wsQualifiedName.AsStringC(),
- wsName, wsNS)) {
+ if (!ResolveAttribute(pXMLElement, it.first.AsStringC(), wsName,
+ wsNS)) {
continue;
}
- if (wsName == L"nil" && wsValue == L"true") {
+ if (wsName == L"nil" && it.second == L"true") {
bNeedValue = false;
continue;
}
@@ -1109,8 +1081,8 @@ void CXFA_SimpleParser::ParseDataGroup(CXFA_Node* pXFANode,
return;
pXFAMetaData->SetCData(XFA_ATTRIBUTE_Name, wsName);
- pXFAMetaData->SetCData(XFA_ATTRIBUTE_QualifiedName, wsQualifiedName);
- pXFAMetaData->SetCData(XFA_ATTRIBUTE_Value, wsValue);
+ pXFAMetaData->SetCData(XFA_ATTRIBUTE_QualifiedName, it.first);
+ pXFAMetaData->SetCData(XFA_ATTRIBUTE_Value, it.second);
pXFAMetaData->SetEnum(XFA_ATTRIBUTE_Contains,
XFA_ATTRIBUTEENUM_MetaData);
pXFAChild->InsertChild(pXFAMetaData);
@@ -1132,29 +1104,10 @@ void CXFA_SimpleParser::ParseDataGroup(CXFA_Node* pXFANode,
pXFAChild->SetFlag(XFA_NodeFlag_Initialized, false);
continue;
}
- case FDE_XMLNODE_CharData: {
- CFDE_XMLCharData* pXMLCharData =
- static_cast<CFDE_XMLCharData*>(pXMLChild);
- CFX_WideString wsCharData;
- pXMLCharData->GetCharData(wsCharData);
- if (IsStringAllWhitespace(wsCharData))
- continue;
-
- CXFA_Node* pXFAChild = m_pFactory->CreateNode(XFA_XDPPACKET_Datasets,
- XFA_Element::DataValue);
- if (!pXFAChild)
- return;
-
- pXFAChild->SetCData(XFA_ATTRIBUTE_Value, wsCharData);
- pXFANode->InsertChild(pXFAChild);
- pXFAChild->SetXMLMappingNode(pXMLCharData);
- pXFAChild->SetFlag(XFA_NodeFlag_Initialized, false);
- continue;
- }
+ case FDE_XMLNODE_CharData:
case FDE_XMLNODE_Text: {
CFDE_XMLText* pXMLText = static_cast<CFDE_XMLText*>(pXMLChild);
- CFX_WideString wsText;
- pXMLText->GetText(wsText);
+ CFX_WideString wsText = pXMLText->GetText();
if (IsStringAllWhitespace(wsText))
continue;
@@ -1191,14 +1144,8 @@ void CXFA_SimpleParser::ParseDataValue(CXFA_Node* pXFANode,
continue;
CFX_WideString wsText;
- if (eNodeType == FDE_XMLNODE_Text) {
- static_cast<CFDE_XMLText*>(pXMLChild)->GetText(wsText);
- if (!pXMLCurValueNode)
- pXMLCurValueNode = pXMLChild;
-
- wsCurValueTextBuf << wsText;
- } else if (eNodeType == FDE_XMLNODE_CharData) {
- static_cast<CFDE_XMLCharData*>(pXMLChild)->GetCharData(wsText);
+ if (eNodeType == FDE_XMLNODE_Text || eNodeType == FDE_XMLNODE_CharData) {
+ wsText = static_cast<CFDE_XMLText*>(pXMLChild)->GetText();
if (!pXMLCurValueNode)
pXMLCurValueNode = pXMLChild;
@@ -1236,8 +1183,8 @@ void CXFA_SimpleParser::ParseDataValue(CXFA_Node* pXFANode,
if (!pXFAChild)
return;
- CFX_WideString wsNodeStr;
- static_cast<CFDE_XMLElement*>(pXMLChild)->GetLocalTagName(wsNodeStr);
+ CFX_WideString wsNodeStr =
+ static_cast<CFDE_XMLElement*>(pXMLChild)->GetLocalTagName();
pXFAChild->SetCData(XFA_ATTRIBUTE_Name, wsNodeStr);
ParseDataValue(pXFAChild, pXMLChild, ePacketID);
pXFANode->InsertChild(pXFAChild);
@@ -1277,25 +1224,20 @@ void CXFA_SimpleParser::ParseInstruction(CXFA_Node* pXFANode,
if (!m_bDocumentParser)
return;
- CFX_WideString wsTargetName;
- pXMLInstruction->GetTargetName(wsTargetName);
+ CFX_WideString wsTargetName = pXMLInstruction->GetName();
+ const std::vector<CFX_WideString>& target_data =
+ pXMLInstruction->GetTargetData();
if (wsTargetName == L"originalXFAVersion") {
- CFX_WideString wsData;
- if (pXMLInstruction->GetData(0, wsData) &&
- (pXFANode->GetDocument()->RecognizeXFAVersionNumber(wsData) !=
- XFA_VERSION_UNKNOWN)) {
- wsData.clear();
- if (pXMLInstruction->GetData(1, wsData) &&
- wsData == L"v2.7-scripting:1") {
- pXFANode->GetDocument()->SetFlag(XFA_DOCFLAG_Scripting, true);
- }
+ if (target_data.size() > 1 &&
+ (pXFANode->GetDocument()->RecognizeXFAVersionNumber(target_data[0]) !=
+ XFA_VERSION_UNKNOWN) &&
+ target_data[1] == L"v2.7-scripting:1") {
+ pXFANode->GetDocument()->SetFlag(XFA_DOCFLAG_Scripting, true);
}
} else if (wsTargetName == L"acrobat") {
- CFX_WideString wsData;
- if (pXMLInstruction->GetData(0, wsData) && wsData == L"JavaScript") {
- if (pXMLInstruction->GetData(1, wsData) && wsData == L"strictScoping") {
- pXFANode->GetDocument()->SetFlag(XFA_DOCFLAG_StrictScoping, true);
- }
+ if (target_data.size() > 1 && target_data[0] == L"JavaScript" &&
+ target_data[1] == L"strictScoping") {
+ pXFANode->GetDocument()->SetFlag(XFA_DOCFLAG_StrictScoping, true);
}
}
}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_simple_parser.h b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_simple_parser.h
index 5f61ad7d28f..a9bcec21390 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_simple_parser.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_simple_parser.h
@@ -9,12 +9,14 @@
#include <memory>
-#include "xfa/fde/xml/fde_xml_imp.h"
#include "xfa/fxfa/fxfa_basic.h"
class CXFA_Document;
class CXFA_Node;
-class CXFA_XMLParser;
+class CFDE_XMLDoc;
+class CFDE_XMLInstruction;
+class CFDE_XMLNode;
+class CFDE_XMLParser;
class IFX_SeekableReadStream;
class IFX_Pause;
class IFGAS_Stream;
@@ -76,7 +78,7 @@ class CXFA_SimpleParser {
CFDE_XMLInstruction* pXMLInstruction,
XFA_XDPPACKET ePacketID);
- CXFA_XMLParser* m_pXMLParser;
+ CFDE_XMLParser* m_pXMLParser;
std::unique_ptr<CFDE_XMLDoc> m_pXMLDoc;
CFX_RetainPtr<IFGAS_Stream> m_pStream;
CFX_RetainPtr<IFX_SeekableReadStream> m_pFileRead;
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_stroke.cpp b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_stroke.cpp
index 602f2f9f1fa..df11cbee00c 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_stroke.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_stroke.cpp
@@ -7,7 +7,8 @@
#include "xfa/fxfa/parser/cxfa_stroke.h"
#include "xfa/fxfa/parser/cxfa_measurement.h"
-#include "xfa/fxfa/parser/xfa_object.h"
+#include "xfa/fxfa/parser/cxfa_node.h"
+#include "xfa/fxfa/parser/xfa_utils.h"
int32_t CXFA_Stroke::GetPresence() const {
return m_pNode ? m_pNode->GetEnum(XFA_ATTRIBUTE_Presence)
@@ -25,7 +26,7 @@ int32_t CXFA_Stroke::GetStrokeType() const {
: XFA_ATTRIBUTEENUM_Solid;
}
-FX_FLOAT CXFA_Stroke::GetThickness() const {
+float CXFA_Stroke::GetThickness() const {
return GetMSThickness().ToUnit(XFA_UNIT_Pt);
}
@@ -80,7 +81,7 @@ bool CXFA_Stroke::IsInverted() const {
return m_pNode ? m_pNode->GetBoolean(XFA_ATTRIBUTE_Inverted) : false;
}
-FX_FLOAT CXFA_Stroke::GetRadius() const {
+float CXFA_Stroke::GetRadius() const {
return m_pNode ? m_pNode->GetMeasure(XFA_ATTRIBUTE_Radius).ToUnit(XFA_UNIT_Pt)
: 0;
}
@@ -88,7 +89,7 @@ FX_FLOAT CXFA_Stroke::GetRadius() const {
bool CXFA_Stroke::SameStyles(CXFA_Stroke stroke, uint32_t dwFlags) const {
if (m_pNode == stroke.GetNode())
return true;
- if (FXSYS_fabs(GetThickness() - stroke.GetThickness()) >= 0.01f)
+ if (fabs(GetThickness() - stroke.GetThickness()) >= 0.01f)
return false;
if ((dwFlags & XFA_STROKE_SAMESTYLE_NoPresence) == 0 &&
IsVisible() != stroke.IsVisible()) {
@@ -99,7 +100,7 @@ bool CXFA_Stroke::SameStyles(CXFA_Stroke stroke, uint32_t dwFlags) const {
if (GetColor() != stroke.GetColor())
return false;
if ((dwFlags & XFA_STROKE_SAMESTYLE_Corner) != 0 &&
- FXSYS_fabs(GetRadius() - stroke.GetRadius()) >= 0.01f) {
+ fabs(GetRadius() - stroke.GetRadius()) >= 0.01f) {
return false;
}
return true;
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_stroke.h b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_stroke.h
index cf941c8f0f9..63709b91602 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_stroke.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_stroke.h
@@ -30,14 +30,14 @@ class CXFA_Stroke : public CXFA_Data {
int32_t GetPresence() const;
int32_t GetCapType() const;
int32_t GetStrokeType() const;
- FX_FLOAT GetThickness() const;
+ float GetThickness() const;
CXFA_Measurement GetMSThickness() const;
void SetMSThickness(CXFA_Measurement msThinkness);
FX_ARGB GetColor() const;
void SetColor(FX_ARGB argb);
int32_t GetJoinType() const;
bool IsInverted() const;
- FX_FLOAT GetRadius() const;
+ float GetRadius() const;
bool SameStyles(CXFA_Stroke stroke, uint32_t dwFlags = 0) const;
};
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_submit.cpp b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_submit.cpp
index 50bef1e811a..e390e6314b6 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_submit.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_submit.cpp
@@ -6,7 +6,7 @@
#include "xfa/fxfa/parser/cxfa_submit.h"
-#include "xfa/fxfa/parser/xfa_object.h"
+#include "xfa/fxfa/parser/cxfa_node.h"
CXFA_Submit::CXFA_Submit(CXFA_Node* pNode) : CXFA_Data(pNode) {}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_text.cpp b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_text.cpp
index fc7d7aa280e..192a4deac45 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_text.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_text.cpp
@@ -6,7 +6,7 @@
#include "xfa/fxfa/parser/cxfa_text.h"
-#include "xfa/fxfa/parser/xfa_object.h"
+#include "xfa/fxfa/parser/cxfa_node.h"
CXFA_Text::CXFA_Text(CXFA_Node* pNode) : CXFA_Data(pNode) {}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_thisproxy.cpp b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_thisproxy.cpp
index bf6f12c804d..2938c1fb3fb 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_thisproxy.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_thisproxy.cpp
@@ -4,7 +4,9 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/fxfa/parser/xfa_object.h"
+#include "xfa/fxfa/parser/cxfa_thisproxy.h"
+
+#include "xfa/fxfa/parser/cxfa_node.h"
CXFA_ThisProxy::CXFA_ThisProxy(CXFA_Node* pThisNode, CXFA_Node* pScriptNode)
: CXFA_Object(pThisNode->GetDocument(),
@@ -18,11 +20,3 @@ CXFA_ThisProxy::CXFA_ThisProxy(CXFA_Node* pThisNode, CXFA_Node* pScriptNode)
}
CXFA_ThisProxy::~CXFA_ThisProxy() {}
-
-CXFA_Node* CXFA_ThisProxy::GetThisNode() const {
- return m_pThisNode;
-}
-
-CXFA_Node* CXFA_ThisProxy::GetScriptNode() const {
- return m_pScriptNode;
-}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_thisproxy.h b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_thisproxy.h
new file mode 100644
index 00000000000..4bb0f5a1b53
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_thisproxy.h
@@ -0,0 +1,27 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef XFA_FXFA_PARSER_CXFA_THISPROXY_H_
+#define XFA_FXFA_PARSER_CXFA_THISPROXY_H_
+
+#include "xfa/fxfa/parser/cxfa_object.h"
+
+class CXFA_Node;
+
+class CXFA_ThisProxy : public CXFA_Object {
+ public:
+ CXFA_ThisProxy(CXFA_Node* pThisNode, CXFA_Node* pScriptNode);
+ ~CXFA_ThisProxy() override;
+
+ CXFA_Node* GetThisNode() const { return m_pThisNode; }
+ CXFA_Node* GetScriptNode() const { return m_pScriptNode; }
+
+ private:
+ CXFA_Node* m_pThisNode;
+ CXFA_Node* m_pScriptNode;
+};
+
+#endif // XFA_FXFA_PARSER_CXFA_THISPROXY_H_
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_timezoneprovider.cpp b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_timezoneprovider.cpp
new file mode 100644
index 00000000000..022b9225b47
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_timezoneprovider.cpp
@@ -0,0 +1,32 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "xfa/fxfa/parser/cxfa_timezoneprovider.h"
+
+#include <time.h>
+
+static bool g_bProviderTimeZoneSet = false;
+
+CXFA_TimeZoneProvider::CXFA_TimeZoneProvider() {
+#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
+ if (!g_bProviderTimeZoneSet) {
+ g_bProviderTimeZoneSet = true;
+ _tzset();
+ }
+ m_tz.tzHour = static_cast<int8_t>(_timezone / 3600 * -1);
+ m_tz.tzMinute = static_cast<int8_t>((abs(_timezone) % 3600) / 60);
+#else
+ if (!g_bProviderTimeZoneSet) {
+ g_bProviderTimeZoneSet = true;
+ tzset();
+ }
+ m_tz.tzHour = static_cast<int8_t>(timezone / 3600 * -1);
+ m_tz.tzMinute =
+ static_cast<int8_t>((abs(static_cast<int>(timezone)) % 3600) / 60);
+#endif
+}
+
+CXFA_TimeZoneProvider::~CXFA_TimeZoneProvider() {}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_timezoneprovider.h b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_timezoneprovider.h
new file mode 100644
index 00000000000..753fbb74daa
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_timezoneprovider.h
@@ -0,0 +1,23 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef XFA_FXFA_PARSER_CXFA_TIMEZONEPROVIDER_H_
+#define XFA_FXFA_PARSER_CXFA_TIMEZONEPROVIDER_H_
+
+#include "core/fxcrt/cfx_datetime.h"
+
+class CXFA_TimeZoneProvider {
+ public:
+ CXFA_TimeZoneProvider();
+ ~CXFA_TimeZoneProvider();
+
+ FX_TIMEZONE GetTimeZone() const { return m_tz; }
+
+ private:
+ FX_TIMEZONE m_tz;
+};
+
+#endif // XFA_FXFA_PARSER_CXFA_TIMEZONEPROVIDER_H_
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_tooltip.cpp b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_tooltip.cpp
index afe0e224afa..f3de7aa5916 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_tooltip.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_tooltip.cpp
@@ -6,7 +6,7 @@
#include "xfa/fxfa/parser/cxfa_tooltip.h"
-#include "xfa/fxfa/parser/xfa_object.h"
+#include "xfa/fxfa/parser/cxfa_node.h"
CXFA_ToolTip::CXFA_ToolTip(CXFA_Node* pNode) : CXFA_Data(pNode) {}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_traversestrategy_xfacontainernode.h b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_traversestrategy_xfacontainernode.h
new file mode 100644
index 00000000000..d507c262fef
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_traversestrategy_xfacontainernode.h
@@ -0,0 +1,33 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef XFA_FXFA_PARSER_CXFA_TRAVERSESTRATEGY_XFACONTAINERNODE_H_
+#define XFA_FXFA_PARSER_CXFA_TRAVERSESTRATEGY_XFACONTAINERNODE_H_
+
+#include "xfa/fxfa/parser/cxfa_node.h"
+#include "xfa/fxfa/parser/xfa_utils.h"
+
+class CXFA_TraverseStrategy_XFAContainerNode {
+ public:
+ static CXFA_Node* GetFirstChild(CXFA_Node* pTemplateNode) {
+ return pTemplateNode->GetNodeItem(XFA_NODEITEM_FirstChild,
+ XFA_ObjectType::ContainerNode);
+ }
+ static CXFA_Node* GetNextSibling(CXFA_Node* pTemplateNode) {
+ return pTemplateNode->GetNodeItem(XFA_NODEITEM_NextSibling,
+ XFA_ObjectType::ContainerNode);
+ }
+ static CXFA_Node* GetParent(CXFA_Node* pTemplateNode) {
+ return pTemplateNode->GetNodeItem(XFA_NODEITEM_Parent,
+ XFA_ObjectType::ContainerNode);
+ }
+};
+
+typedef CXFA_NodeIteratorTemplate<CXFA_Node,
+ CXFA_TraverseStrategy_XFAContainerNode>
+ CXFA_ContainerIterator;
+
+#endif // XFA_FXFA_PARSER_CXFA_TRAVERSESTRATEGY_XFACONTAINERNODE_H_
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_traversestrategy_xfanode.h b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_traversestrategy_xfanode.h
new file mode 100644
index 00000000000..b6fb156cb95
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_traversestrategy_xfanode.h
@@ -0,0 +1,28 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef XFA_FXFA_PARSER_CXFA_TRAVERSESTRATEGY_XFANODE_H_
+#define XFA_FXFA_PARSER_CXFA_TRAVERSESTRATEGY_XFANODE_H_
+
+#include "xfa/fxfa/parser/xfa_utils.h"
+
+class CXFA_TraverseStrategy_XFANode {
+ public:
+ static inline CXFA_Node* GetFirstChild(CXFA_Node* pTemplateNode) {
+ return pTemplateNode->GetNodeItem(XFA_NODEITEM_FirstChild);
+ }
+ static inline CXFA_Node* GetNextSibling(CXFA_Node* pTemplateNode) {
+ return pTemplateNode->GetNodeItem(XFA_NODEITEM_NextSibling);
+ }
+ static inline CXFA_Node* GetParent(CXFA_Node* pTemplateNode) {
+ return pTemplateNode->GetNodeItem(XFA_NODEITEM_Parent);
+ }
+};
+
+typedef CXFA_NodeIteratorTemplate<CXFA_Node, CXFA_TraverseStrategy_XFANode>
+ CXFA_NodeIterator;
+
+#endif // XFA_FXFA_PARSER_CXFA_TRAVERSESTRATEGY_XFANODE_H_
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_validate.cpp b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_validate.cpp
index 5706d96aaa3..712d0f28297 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_validate.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_validate.cpp
@@ -6,7 +6,8 @@
#include "xfa/fxfa/parser/cxfa_validate.h"
-#include "xfa/fxfa/parser/xfa_object.h"
+#include "xfa/fxfa/parser/cxfa_node.h"
+#include "xfa/fxfa/parser/xfa_utils.h"
CXFA_Validate::CXFA_Validate(CXFA_Node* pNode) : CXFA_Data(pNode) {}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_validate.h b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_validate.h
index 03bbaddf7bb..470cefe7735 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_validate.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_validate.h
@@ -31,7 +31,7 @@ class CXFA_Validate : public CXFA_Data {
void GetPicture(CFX_WideString& wsPicture);
CXFA_Script GetScript();
- protected:
+ private:
void GetMessageText(CFX_WideString& wsMessage,
const CFX_WideString& wsMessageType);
void SetMessageText(CFX_WideString& wsMessage,
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_value.cpp b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_value.cpp
index 4d467aee2c5..4f166d5d420 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_value.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_value.cpp
@@ -6,7 +6,7 @@
#include "xfa/fxfa/parser/cxfa_value.h"
-#include "xfa/fxfa/parser/xfa_object.h"
+#include "xfa/fxfa/parser/cxfa_node.h"
XFA_Element CXFA_Value::GetChildValueClassID() {
if (!m_pNode)
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_valuearray.cpp b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_valuearray.cpp
index 04afc40b0ee..eded624c360 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_valuearray.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_valuearray.cpp
@@ -6,17 +6,20 @@
#include "xfa/fxfa/parser/cxfa_valuearray.h"
+#include <algorithm>
+
#include "xfa/fxfa/parser/cxfa_scriptcontext.h"
CXFA_ValueArray::CXFA_ValueArray(v8::Isolate* pIsolate)
: m_pIsolate(pIsolate) {}
-CXFA_ValueArray::~CXFA_ValueArray() {
- for (int32_t i = 0; i < GetSize(); i++)
- delete GetAt(i);
-}
+CXFA_ValueArray::~CXFA_ValueArray() {}
-void CXFA_ValueArray::GetAttributeObject(CXFA_ObjArray& objArray) {
- for (int32_t i = 0; i < GetSize(); i++)
- objArray.Add(CXFA_ScriptContext::ToObject(GetAt(i), nullptr));
+std::vector<CXFA_Object*> CXFA_ValueArray::GetAttributeObject() {
+ std::vector<CXFA_Object*> result(m_Values.size());
+ std::transform(m_Values.begin(), m_Values.end(), result.begin(),
+ [](const std::unique_ptr<CFXJSE_Value>& value) {
+ return CXFA_ScriptContext::ToObject(value.get(), nullptr);
+ });
+ return result;
}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_valuearray.h b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_valuearray.h
index 2c4ea297796..f0c5d234c91 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_valuearray.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_valuearray.h
@@ -7,17 +7,21 @@
#ifndef XFA_FXFA_PARSER_CXFA_VALUEARRAY_H_
#define XFA_FXFA_PARSER_CXFA_VALUEARRAY_H_
+#include <memory>
+#include <vector>
+
#include "fxjs/cfxjse_value.h"
#include "xfa/fxfa/fxfa.h"
-class CXFA_ValueArray : public CFX_ArrayTemplate<CFXJSE_Value*> {
+class CXFA_ValueArray {
public:
explicit CXFA_ValueArray(v8::Isolate* pIsolate);
~CXFA_ValueArray();
- void GetAttributeObject(CXFA_ObjArray& objArray);
+ std::vector<CXFA_Object*> GetAttributeObject();
v8::Isolate* const m_pIsolate;
+ std::vector<std::unique_ptr<CFXJSE_Value>> m_Values;
};
#endif // XFA_FXFA_PARSER_CXFA_VALUEARRAY_H_
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_widetextread.cpp b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_widetextread.cpp
deleted file mode 100644
index 34fa6b9c5e5..00000000000
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_widetextread.cpp
+++ /dev/null
@@ -1,102 +0,0 @@
-// Copyright 2016 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#include "xfa/fxfa/parser/cxfa_widetextread.h"
-
-#include <algorithm>
-
-#include "core/fxcrt/fx_ext.h"
-#include "xfa/fgas/crt/fgas_codepage.h"
-
-CXFA_WideTextRead::CXFA_WideTextRead(const CFX_WideString& wsBuffer)
- : m_wsBuffer(wsBuffer), m_iPosition(0) {}
-
-CXFA_WideTextRead::~CXFA_WideTextRead() {}
-
-uint32_t CXFA_WideTextRead::GetAccessModes() const {
- return FX_STREAMACCESS_Read | FX_STREAMACCESS_Text;
-}
-
-int32_t CXFA_WideTextRead::GetLength() const {
- return m_wsBuffer.GetLength() * sizeof(FX_WCHAR);
-}
-
-int32_t CXFA_WideTextRead::Seek(FX_STREAMSEEK eSeek, int32_t iOffset) {
- switch (eSeek) {
- case FX_STREAMSEEK_Begin:
- m_iPosition = iOffset;
- break;
- case FX_STREAMSEEK_Current:
- m_iPosition += iOffset;
- break;
- case FX_STREAMSEEK_End:
- m_iPosition = m_wsBuffer.GetLength() + iOffset;
- break;
- }
- m_iPosition = std::min(std::max(0, m_iPosition), m_wsBuffer.GetLength());
- return GetPosition();
-}
-
-int32_t CXFA_WideTextRead::GetPosition() {
- return m_iPosition * sizeof(FX_WCHAR);
-}
-
-bool CXFA_WideTextRead::IsEOF() const {
- return m_iPosition >= m_wsBuffer.GetLength();
-}
-
-int32_t CXFA_WideTextRead::ReadData(uint8_t* pBuffer, int32_t iBufferSize) {
- return 0;
-}
-
-int32_t CXFA_WideTextRead::ReadString(FX_WCHAR* pStr,
- int32_t iMaxLength,
- bool& bEOS) {
- iMaxLength = std::min(iMaxLength, m_wsBuffer.GetLength() - m_iPosition);
- if (iMaxLength == 0)
- return 0;
-
- FXSYS_wcsncpy(pStr, m_wsBuffer.c_str() + m_iPosition, iMaxLength);
- m_iPosition += iMaxLength;
- bEOS = IsEOF();
- return iMaxLength;
-}
-
-int32_t CXFA_WideTextRead::WriteData(const uint8_t* pBuffer,
- int32_t iBufferSize) {
- return 0;
-}
-
-int32_t CXFA_WideTextRead::WriteString(const FX_WCHAR* pStr, int32_t iLength) {
- return 0;
-}
-
-bool CXFA_WideTextRead::SetLength(int32_t iLength) {
- return false;
-}
-
-int32_t CXFA_WideTextRead::GetBOM(uint8_t bom[4]) const {
- return 0;
-}
-
-uint16_t CXFA_WideTextRead::GetCodePage() const {
- return (sizeof(FX_WCHAR) == 2) ? FX_CODEPAGE_UTF16LE : FX_CODEPAGE_UTF32LE;
-}
-
-uint16_t CXFA_WideTextRead::SetCodePage(uint16_t wCodePage) {
- return GetCodePage();
-}
-
-CFX_RetainPtr<IFGAS_Stream> CXFA_WideTextRead::CreateSharedStream(
- uint32_t dwAccess,
- int32_t iOffset,
- int32_t iLength) {
- return nullptr;
-}
-
-CFX_WideString CXFA_WideTextRead::GetSrcText() const {
- return m_wsBuffer;
-}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_widetextread.h b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_widetextread.h
deleted file mode 100644
index 2ccb042908c..00000000000
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_widetextread.h
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright 2016 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef XFA_FXFA_PARSER_CXFA_WIDETEXTREAD_H_
-#define XFA_FXFA_PARSER_CXFA_WIDETEXTREAD_H_
-
-#include "core/fxcrt/cfx_retain_ptr.h"
-#include "xfa/fgas/crt/fgas_stream.h"
-
-class CXFA_WideTextRead : public IFGAS_Stream {
- public:
- template <typename T, typename... Args>
- friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args);
-
- // IFGAS_Stream
- uint32_t GetAccessModes() const override;
- int32_t GetLength() const override;
- int32_t Seek(FX_STREAMSEEK eSeek, int32_t iOffset) override;
- int32_t GetPosition() override;
- bool IsEOF() const override;
- int32_t ReadData(uint8_t* pBuffer, int32_t iBufferSize) override;
- int32_t ReadString(FX_WCHAR* pStr, int32_t iMaxLength, bool& bEOS) override;
- int32_t WriteData(const uint8_t* pBuffer, int32_t iBufferSize) override;
- int32_t WriteString(const FX_WCHAR* pStr, int32_t iLength) override;
- void Flush() override {}
- bool SetLength(int32_t iLength) override;
- int32_t GetBOM(uint8_t bom[4]) const override;
- uint16_t GetCodePage() const override;
- uint16_t SetCodePage(uint16_t wCodePage) override;
- CFX_RetainPtr<IFGAS_Stream> CreateSharedStream(uint32_t dwAccess,
- int32_t iOffset,
- int32_t iLength) override;
-
- CFX_WideString GetSrcText() const;
-
- protected:
- explicit CXFA_WideTextRead(const CFX_WideString& wsBuffer);
- ~CXFA_WideTextRead() override;
-
- CFX_WideString m_wsBuffer;
- int32_t m_iPosition;
-};
-
-#endif // XFA_FXFA_PARSER_CXFA_WIDETEXTREAD_H_
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_widgetdata.cpp b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_widgetdata.cpp
index d3533c277aa..8784b6e9d13 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_widgetdata.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_widgetdata.cpp
@@ -6,22 +6,24 @@
#include "xfa/fxfa/parser/cxfa_widgetdata.h"
+#include "core/fxcrt/cfx_decimal.h"
#include "core/fxcrt/fx_ext.h"
+#include "fxbarcode/BC_Library.h"
#include "third_party/base/stl_util.h"
-#include "xfa/fxbarcode/BC_Library.h"
#include "xfa/fxfa/app/xfa_ffnotify.h"
#include "xfa/fxfa/parser/cxfa_document.h"
#include "xfa/fxfa/parser/cxfa_event.h"
+#include "xfa/fxfa/parser/cxfa_localevalue.h"
#include "xfa/fxfa/parser/cxfa_measurement.h"
-#include "xfa/fxfa/parser/xfa_localevalue.h"
-#include "xfa/fxfa/parser/xfa_object.h"
+#include "xfa/fxfa/parser/cxfa_node.h"
+#include "xfa/fxfa/parser/xfa_utils.h"
namespace {
-FX_FLOAT GetEdgeThickness(const std::vector<CXFA_Stroke>& strokes,
- bool b3DStyle,
- int32_t nIndex) {
- FX_FLOAT fThickness = 0;
+float GetEdgeThickness(const std::vector<CXFA_Stroke>& strokes,
+ bool b3DStyle,
+ int32_t nIndex) {
+ float fThickness = 0;
if (strokes[nIndex * 2 + 1].GetPresence() == XFA_ATTRIBUTEENUM_Visible) {
if (nIndex == 0)
@@ -225,7 +227,7 @@ CFX_WideStringC GetAttributeDefaultValue_Cdata(XFA_Element eElement,
void* pValue;
if (XFA_GetAttributeDefaultValue(pValue, eElement, eAttribute,
XFA_ATTRIBUTETYPE_Cdata, dwPacket)) {
- return (const FX_WCHAR*)pValue;
+ return (const wchar_t*)pValue;
}
return nullptr;
}
@@ -315,35 +317,32 @@ CXFA_Para CXFA_WidgetData::GetPara(bool bModified) {
return CXFA_Para(m_pNode->GetProperty(0, XFA_Element::Para, bModified));
}
-void CXFA_WidgetData::GetEventList(CXFA_NodeArray& events) {
- m_pNode->GetNodeList(events, 0, XFA_Element::Event);
+std::vector<CXFA_Node*> CXFA_WidgetData::GetEventList() {
+ return m_pNode->GetNodeList(0, XFA_Element::Event);
}
-int32_t CXFA_WidgetData::GetEventByActivity(int32_t iActivity,
- CXFA_NodeArray& events,
- bool bIsFormReady) {
- CXFA_NodeArray allEvents;
- GetEventList(allEvents);
- int32_t iCount = allEvents.GetSize();
- for (int32_t i = 0; i < iCount; i++) {
- CXFA_Event event(allEvents[i]);
+std::vector<CXFA_Node*> CXFA_WidgetData::GetEventByActivity(int32_t iActivity,
+ bool bIsFormReady) {
+ std::vector<CXFA_Node*> events;
+ for (CXFA_Node* pNode : GetEventList()) {
+ CXFA_Event event(pNode);
if (event.GetActivity() == iActivity) {
if (iActivity == XFA_ATTRIBUTEENUM_Ready) {
CFX_WideStringC wsRef;
event.GetRef(wsRef);
if (bIsFormReady) {
if (wsRef == CFX_WideStringC(L"$form"))
- events.Add(allEvents[i]);
+ events.push_back(pNode);
} else {
if (wsRef == CFX_WideStringC(L"$layout"))
- events.Add(allEvents[i]);
+ events.push_back(pNode);
}
} else {
- events.Add(allEvents[i]);
+ events.push_back(pNode);
}
}
}
- return events.GetSize();
+ return events;
}
CXFA_Value CXFA_WidgetData::GetDefaultValue(bool bModified) {
@@ -375,27 +374,27 @@ CXFA_Assist CXFA_WidgetData::GetAssist(bool bModified) {
return CXFA_Assist(m_pNode->GetProperty(0, XFA_Element::Assist, bModified));
}
-bool CXFA_WidgetData::GetWidth(FX_FLOAT& fWidth) {
+bool CXFA_WidgetData::GetWidth(float& fWidth) {
return TryMeasure(XFA_ATTRIBUTE_W, fWidth);
}
-bool CXFA_WidgetData::GetHeight(FX_FLOAT& fHeight) {
+bool CXFA_WidgetData::GetHeight(float& fHeight) {
return TryMeasure(XFA_ATTRIBUTE_H, fHeight);
}
-bool CXFA_WidgetData::GetMinWidth(FX_FLOAT& fMinWidth) {
+bool CXFA_WidgetData::GetMinWidth(float& fMinWidth) {
return TryMeasure(XFA_ATTRIBUTE_MinW, fMinWidth);
}
-bool CXFA_WidgetData::GetMinHeight(FX_FLOAT& fMinHeight) {
+bool CXFA_WidgetData::GetMinHeight(float& fMinHeight) {
return TryMeasure(XFA_ATTRIBUTE_MinH, fMinHeight);
}
-bool CXFA_WidgetData::GetMaxWidth(FX_FLOAT& fMaxWidth) {
+bool CXFA_WidgetData::GetMaxWidth(float& fMaxWidth) {
return TryMeasure(XFA_ATTRIBUTE_MaxW, fMaxWidth);
}
-bool CXFA_WidgetData::GetMaxHeight(FX_FLOAT& fMaxHeight) {
+bool CXFA_WidgetData::GetMaxHeight(float& fMaxHeight) {
return TryMeasure(XFA_ATTRIBUTE_MaxH, fMaxHeight);
}
@@ -419,14 +418,14 @@ CFX_RectF CXFA_WidgetData::GetUIMargin() {
if (border && border.GetPresence() != XFA_ATTRIBUTEENUM_Visible)
return CFX_RectF();
- FX_FLOAT fLeftInset, fTopInset, fRightInset, fBottomInset;
+ float fLeftInset, fTopInset, fRightInset, fBottomInset;
bool bLeft = mgUI.GetLeftInset(fLeftInset);
bool bTop = mgUI.GetTopInset(fTopInset);
bool bRight = mgUI.GetRightInset(fRightInset);
bool bBottom = mgUI.GetBottomInset(fBottomInset);
if (border) {
bool bVisible = false;
- FX_FLOAT fThickness = 0;
+ float fThickness = 0;
border.Get3DStyle(bVisible, fThickness);
if (!bLeft || !bTop || !bRight || !bBottom) {
std::vector<CXFA_Stroke> strokes;
@@ -509,7 +508,7 @@ bool CXFA_WidgetData::IsRadioButton() {
return false;
}
-FX_FLOAT CXFA_WidgetData::GetCheckButtonSize() {
+float CXFA_WidgetData::GetCheckButtonSize() {
CXFA_Node* pUIChild = GetUIChild();
if (pUIChild)
return pUIChild->GetMeasure(XFA_ATTRIBUTE_Size).ToUnit(XFA_UNIT_Pt);
@@ -733,35 +732,32 @@ int32_t CXFA_WidgetData::GetChoiceListOpen() {
bool CXFA_WidgetData::IsListBox() {
int32_t iOpenMode = GetChoiceListOpen();
- return (iOpenMode == XFA_ATTRIBUTEENUM_Always ||
- iOpenMode == XFA_ATTRIBUTEENUM_MultiSelect);
+ return iOpenMode == XFA_ATTRIBUTEENUM_Always ||
+ iOpenMode == XFA_ATTRIBUTEENUM_MultiSelect;
}
int32_t CXFA_WidgetData::CountChoiceListItems(bool bSaveValue) {
- CXFA_NodeArray pItems;
- CXFA_Node* pItem = nullptr;
+ std::vector<CXFA_Node*> pItems;
int32_t iCount = 0;
- CXFA_Node* pNode = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild);
- for (; pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
+ for (CXFA_Node* pNode = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild); pNode;
+ pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
if (pNode->GetElementType() != XFA_Element::Items)
continue;
-
iCount++;
- pItems.Add(pNode);
+ pItems.push_back(pNode);
if (iCount == 2)
break;
}
if (iCount == 0)
return 0;
- pItem = pItems[0];
+ CXFA_Node* pItem = pItems[0];
if (iCount > 1) {
bool bItemOneHasSave = pItems[0]->GetBoolean(XFA_ATTRIBUTE_Save);
bool bItemTwoHasSave = pItems[1]->GetBoolean(XFA_ATTRIBUTE_Save);
if (bItemOneHasSave != bItemTwoHasSave && bSaveValue == bItemTwoHasSave)
pItem = pItems[1];
}
- pItems.RemoveAll();
return pItem->CountChildren(XFA_Element::Unknown);
}
@@ -769,16 +765,15 @@ bool CXFA_WidgetData::GetChoiceListItem(CFX_WideString& wsText,
int32_t nIndex,
bool bSaveValue) {
wsText.clear();
- CXFA_NodeArray pItemsArray;
+ std::vector<CXFA_Node*> pItemsArray;
CXFA_Node* pItems = nullptr;
int32_t iCount = 0;
CXFA_Node* pNode = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild);
for (; pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
if (pNode->GetElementType() != XFA_Element::Items)
continue;
-
iCount++;
- pItemsArray.Add(pNode);
+ pItemsArray.push_back(pNode);
if (iCount == 2)
break;
}
@@ -802,97 +797,74 @@ bool CXFA_WidgetData::GetChoiceListItem(CFX_WideString& wsText,
return false;
}
-void CXFA_WidgetData::GetChoiceListItems(
- std::vector<CFX_WideString>& wsTextArray,
+std::vector<CFX_WideString> CXFA_WidgetData::GetChoiceListItems(
bool bSaveValue) {
- CXFA_NodeArray pItems;
- CXFA_Node* pItem = nullptr;
- int32_t iCount = 0;
- CXFA_Node* pNode = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild);
- for (; pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
- if (pNode->GetElementType() != XFA_Element::Items)
- continue;
-
- iCount++;
- pItems.Add(pNode);
- if (iCount == 2)
- break;
+ std::vector<CXFA_Node*> items;
+ for (CXFA_Node* pNode = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild);
+ pNode && items.size() < 2;
+ pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
+ if (pNode->GetElementType() == XFA_Element::Items)
+ items.push_back(pNode);
}
- if (iCount == 0)
- return;
+ if (items.empty())
+ return std::vector<CFX_WideString>();
- pItem = pItems[0];
- if (iCount > 1) {
- bool bItemOneHasSave = pItems[0]->GetBoolean(XFA_ATTRIBUTE_Save);
- bool bItemTwoHasSave = pItems[1]->GetBoolean(XFA_ATTRIBUTE_Save);
+ CXFA_Node* pItem = items.front();
+ if (items.size() > 1) {
+ bool bItemOneHasSave = items[0]->GetBoolean(XFA_ATTRIBUTE_Save);
+ bool bItemTwoHasSave = items[1]->GetBoolean(XFA_ATTRIBUTE_Save);
if (bItemOneHasSave != bItemTwoHasSave && bSaveValue == bItemTwoHasSave)
- pItem = pItems[1];
+ pItem = items[1];
}
- pItems.RemoveAll();
- pNode = pItem->GetNodeItem(XFA_NODEITEM_FirstChild);
- for (; pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
+
+ std::vector<CFX_WideString> wsTextArray;
+ for (CXFA_Node* pNode = pItem->GetNodeItem(XFA_NODEITEM_FirstChild); pNode;
+ pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
wsTextArray.emplace_back();
pNode->TryContent(wsTextArray.back());
}
+ return wsTextArray;
}
int32_t CXFA_WidgetData::CountSelectedItems() {
- std::vector<CFX_WideString> wsValueArray;
- GetSelectedItemsValue(wsValueArray);
+ std::vector<CFX_WideString> wsValueArray = GetSelectedItemsValue();
if (IsListBox() || !IsChoiceListAllowTextEntry())
return pdfium::CollectionSize<int32_t>(wsValueArray);
int32_t iSelected = 0;
- std::vector<CFX_WideString> wsSaveTextArray;
- GetChoiceListItems(wsSaveTextArray, true);
- int32_t iValues = pdfium::CollectionSize<int32_t>(wsValueArray);
- for (int32_t i = 0; i < iValues; i++) {
- int32_t iSaves = pdfium::CollectionSize<int32_t>(wsSaveTextArray);
- for (int32_t j = 0; j < iSaves; j++) {
- if (wsValueArray[i] == wsSaveTextArray[j]) {
- iSelected++;
- break;
- }
- }
+ std::vector<CFX_WideString> wsSaveTextArray = GetChoiceListItems(true);
+ for (const auto& value : wsValueArray) {
+ if (pdfium::ContainsValue(wsSaveTextArray, value))
+ iSelected++;
}
return iSelected;
}
int32_t CXFA_WidgetData::GetSelectedItem(int32_t nIndex) {
- std::vector<CFX_WideString> wsValueArray;
- GetSelectedItemsValue(wsValueArray);
- std::vector<CFX_WideString> wsSaveTextArray;
- GetChoiceListItems(wsSaveTextArray, true);
- int32_t iSaves = pdfium::CollectionSize<int32_t>(wsSaveTextArray);
- for (int32_t j = 0; j < iSaves; j++) {
- if (wsValueArray[nIndex] == wsSaveTextArray[j])
- return j;
- }
- return -1;
-}
+ std::vector<CFX_WideString> wsValueArray = GetSelectedItemsValue();
+ if (!pdfium::IndexInBounds(wsValueArray, nIndex))
+ return -1;
-void CXFA_WidgetData::GetSelectedItems(CFX_ArrayTemplate<int32_t>& iSelArray) {
- std::vector<CFX_WideString> wsValueArray;
- GetSelectedItemsValue(wsValueArray);
- int32_t iValues = pdfium::CollectionSize<int32_t>(wsValueArray);
- if (iValues < 1)
- return;
+ std::vector<CFX_WideString> wsSaveTextArray = GetChoiceListItems(true);
+ auto it = std::find(wsSaveTextArray.begin(), wsSaveTextArray.end(),
+ wsValueArray[nIndex]);
+ return it != wsSaveTextArray.end() ? it - wsSaveTextArray.begin() : -1;
+}
- std::vector<CFX_WideString> wsSaveTextArray;
- GetChoiceListItems(wsSaveTextArray, true);
- int32_t iSaves = pdfium::CollectionSize<int32_t>(wsSaveTextArray);
- for (int32_t i = 0; i < iValues; i++) {
- for (int32_t j = 0; j < iSaves; j++) {
- if (wsValueArray[i] == wsSaveTextArray[j]) {
- iSelArray.Add(j);
- break;
- }
- }
+std::vector<int32_t> CXFA_WidgetData::GetSelectedItems() {
+ std::vector<int32_t> iSelArray;
+ std::vector<CFX_WideString> wsValueArray = GetSelectedItemsValue();
+ std::vector<CFX_WideString> wsSaveTextArray = GetChoiceListItems(true);
+ for (const auto& value : wsValueArray) {
+ auto it = std::find(wsSaveTextArray.begin(), wsSaveTextArray.end(), value);
+ if (it != wsSaveTextArray.end())
+ iSelArray.push_back(it - wsSaveTextArray.begin());
}
+ return iSelArray;
}
-void CXFA_WidgetData::GetSelectedItemsValue(
- std::vector<CFX_WideString>& wsSelTextArray) {
+std::vector<CFX_WideString> CXFA_WidgetData::GetSelectedItemsValue() {
+ std::vector<CFX_WideString> wsSelTextArray;
CFX_WideString wsValue = GetRawValue();
if (GetChoiceListOpen() == XFA_ATTRIBUTEENUM_MultiSelect) {
if (!wsValue.IsEmpty()) {
@@ -905,7 +877,6 @@ void CXFA_WidgetData::GetSelectedItemsValue(
iStart = iEnd + 1;
if (iStart >= iLength)
break;
-
iEnd = wsValue.Find(L'\n', iStart);
if (iEnd < 0)
wsSelTextArray.push_back(wsValue.Mid(iStart, iLength - iStart));
@@ -914,25 +885,14 @@ void CXFA_WidgetData::GetSelectedItemsValue(
} else {
wsSelTextArray.push_back(wsValue);
}
+ return wsSelTextArray;
}
bool CXFA_WidgetData::GetItemState(int32_t nIndex) {
- if (nIndex < 0)
- return false;
-
- std::vector<CFX_WideString> wsSaveTextArray;
- GetChoiceListItems(wsSaveTextArray, true);
- if (pdfium::CollectionSize<int32_t>(wsSaveTextArray) <= nIndex)
- return false;
-
- std::vector<CFX_WideString> wsValueArray;
- GetSelectedItemsValue(wsValueArray);
- int32_t iValues = pdfium::CollectionSize<int32_t>(wsValueArray);
- for (int32_t j = 0; j < iValues; j++) {
- if (wsValueArray[j] == wsSaveTextArray[nIndex])
- return true;
- }
- return false;
+ std::vector<CFX_WideString> wsSaveTextArray = GetChoiceListItems(true);
+ return pdfium::IndexInBounds(wsSaveTextArray, nIndex) &&
+ pdfium::ContainsValue(GetSelectedItemsValue(),
+ wsSaveTextArray[nIndex]);
}
void CXFA_WidgetData::SetItemState(int32_t nIndex,
@@ -940,24 +900,17 @@ void CXFA_WidgetData::SetItemState(int32_t nIndex,
bool bNotify,
bool bScriptModify,
bool bSyncData) {
- if (nIndex < 0)
- return;
-
- std::vector<CFX_WideString> wsSaveTextArray;
- GetChoiceListItems(wsSaveTextArray, true);
- if (pdfium::CollectionSize<int32_t>(wsSaveTextArray) <= nIndex)
+ std::vector<CFX_WideString> wsSaveTextArray = GetChoiceListItems(true);
+ if (!pdfium::IndexInBounds(wsSaveTextArray, nIndex))
return;
int32_t iSel = -1;
- std::vector<CFX_WideString> wsValueArray;
- GetSelectedItemsValue(wsValueArray);
- int32_t iValues = pdfium::CollectionSize<int32_t>(wsValueArray);
- for (int32_t j = 0; j < iValues; j++) {
- if (wsValueArray[j] == wsSaveTextArray[nIndex]) {
- iSel = j;
- break;
- }
- }
+ std::vector<CFX_WideString> wsValueArray = GetSelectedItemsValue();
+ auto it = std::find(wsValueArray.begin(), wsValueArray.end(),
+ wsSaveTextArray[nIndex]);
+ if (it != wsValueArray.end())
+ iSel = it - wsValueArray.begin();
+
if (GetChoiceListOpen() == XFA_ATTRIBUTEENUM_MultiSelect) {
if (bSelected) {
if (iSel < 0) {
@@ -970,14 +923,10 @@ void CXFA_WidgetData::SetItemState(int32_t nIndex,
bSyncData);
}
} else if (iSel >= 0) {
- CFX_ArrayTemplate<int32_t> iSelArray;
- GetSelectedItems(iSelArray);
- for (int32_t i = 0; i < iSelArray.GetSize(); i++) {
- if (iSelArray[i] == nIndex) {
- iSelArray.RemoveAt(i);
- break;
- }
- }
+ std::vector<int32_t> iSelArray = GetSelectedItems();
+ auto it = std::find(iSelArray.begin(), iSelArray.end(), nIndex);
+ if (it != iSelArray.end())
+ iSelArray.erase(it);
SetSelectedItems(iSelArray, bNotify, bScriptModify, bSyncData);
}
} else {
@@ -996,15 +945,14 @@ void CXFA_WidgetData::SetItemState(int32_t nIndex,
}
}
-void CXFA_WidgetData::SetSelectedItems(CFX_ArrayTemplate<int32_t>& iSelArray,
+void CXFA_WidgetData::SetSelectedItems(const std::vector<int32_t>& iSelArray,
bool bNotify,
bool bScriptModify,
bool bSyncData) {
CFX_WideString wsValue;
- int32_t iSize = iSelArray.GetSize();
+ int32_t iSize = pdfium::CollectionSize<int32_t>(iSelArray);
if (iSize >= 1) {
- std::vector<CFX_WideString> wsSaveTextArray;
- GetChoiceListItems(wsSaveTextArray, true);
+ std::vector<CFX_WideString> wsSaveTextArray = GetChoiceListItems(true);
CFX_WideString wsItemValue;
for (int32_t i = 0; i < iSize; i++) {
wsItemValue = (iSize == 1) ? wsSaveTextArray[iSelArray[i]]
@@ -1038,18 +986,13 @@ void CXFA_WidgetData::InsertItem(const CFX_WideString& wsLabel,
if (wsNewValue.IsEmpty())
wsNewValue = wsLabel;
- CXFA_NodeArray listitems;
- int32_t iCount = 0;
- CXFA_Node* pItemNode = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild);
- for (; pItemNode;
- pItemNode = pItemNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
- if (pItemNode->GetElementType() != XFA_Element::Items)
- continue;
-
- listitems.Add(pItemNode);
- iCount++;
+ std::vector<CXFA_Node*> listitems;
+ for (CXFA_Node* pItem = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild); pItem;
+ pItem = pItem->GetNodeItem(XFA_NODEITEM_NextSibling)) {
+ if (pItem->GetElementType() == XFA_Element::Items)
+ listitems.push_back(pItem);
}
- if (iCount < 1) {
+ if (listitems.empty()) {
CXFA_Node* pItems = m_pNode->CreateSamePacketNode(XFA_Element::Items);
m_pNode->InsertChild(-1, pItems);
InsertListTextItem(pItems, wsLabel, nIndex);
@@ -1057,7 +1000,7 @@ void CXFA_WidgetData::InsertItem(const CFX_WideString& wsLabel,
m_pNode->InsertChild(-1, pSaveItems);
pSaveItems->SetBoolean(XFA_ATTRIBUTE_Save, true);
InsertListTextItem(pSaveItems, wsNewValue, nIndex);
- } else if (iCount > 1) {
+ } else if (listitems.size() > 1) {
for (int32_t i = 0; i < 2; i++) {
CXFA_Node* pNode = listitems[i];
bool bHasSave = pNode->GetBoolean(XFA_ATTRIBUTE_Save);
@@ -1074,7 +1017,6 @@ void CXFA_WidgetData::InsertItem(const CFX_WideString& wsLabel,
m_pNode->InsertChild(-1, pSaveItems);
pSaveItems->SetBoolean(XFA_ATTRIBUTE_Save, true);
pSaveItems->SetEnum(XFA_ATTRIBUTE_Presence, XFA_ATTRIBUTEENUM_Hidden);
- listitems.RemoveAll();
CXFA_Node* pListNode = pNode->GetNodeItem(XFA_NODEITEM_FirstChild);
int32_t i = 0;
while (pListNode) {
@@ -1097,14 +1039,13 @@ void CXFA_WidgetData::InsertItem(const CFX_WideString& wsLabel,
void CXFA_WidgetData::GetItemLabel(const CFX_WideStringC& wsValue,
CFX_WideString& wsLabel) {
int32_t iCount = 0;
- CXFA_NodeArray listitems;
+ std::vector<CXFA_Node*> listitems;
CXFA_Node* pItems = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild);
for (; pItems; pItems = pItems->GetNodeItem(XFA_NODEITEM_NextSibling)) {
if (pItems->GetElementType() != XFA_Element::Items)
continue;
-
iCount++;
- listitems.Add(pItems);
+ listitems.push_back(pItems);
}
if (iCount <= 1) {
wsLabel = wsValue;
@@ -1143,14 +1084,13 @@ void CXFA_WidgetData::GetItemLabel(const CFX_WideStringC& wsValue,
void CXFA_WidgetData::GetItemValue(const CFX_WideStringC& wsLabel,
CFX_WideString& wsValue) {
int32_t iCount = 0;
- CXFA_NodeArray listitems;
- CXFA_Node* pItems = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild);
- for (; pItems; pItems = pItems->GetNodeItem(XFA_NODEITEM_NextSibling)) {
+ std::vector<CXFA_Node*> listitems;
+ for (CXFA_Node* pItems = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild);
+ pItems; pItems = pItems->GetNodeItem(XFA_NODEITEM_NextSibling)) {
if (pItems->GetElementType() != XFA_Element::Items)
continue;
-
iCount++;
- listitems.Add(pItems);
+ listitems.push_back(pItems);
}
if (iCount <= 1) {
wsValue = wsLabel;
@@ -1292,24 +1232,24 @@ bool CXFA_WidgetData::GetBarcodeAttribute_DataLength(int32_t& val) {
return false;
}
-bool CXFA_WidgetData::GetBarcodeAttribute_StartChar(FX_CHAR& val) {
+bool CXFA_WidgetData::GetBarcodeAttribute_StartChar(char& val) {
CXFA_Node* pUIChild = GetUIChild();
CFX_WideStringC wsStartEndChar;
if (pUIChild->TryCData(XFA_ATTRIBUTE_StartChar, wsStartEndChar)) {
if (wsStartEndChar.GetLength()) {
- val = (FX_CHAR)wsStartEndChar.GetAt(0);
+ val = (char)wsStartEndChar.GetAt(0);
return true;
}
}
return false;
}
-bool CXFA_WidgetData::GetBarcodeAttribute_EndChar(FX_CHAR& val) {
+bool CXFA_WidgetData::GetBarcodeAttribute_EndChar(char& val) {
CXFA_Node* pUIChild = GetUIChild();
CFX_WideStringC wsStartEndChar;
if (pUIChild->TryCData(XFA_ATTRIBUTE_EndChar, wsStartEndChar)) {
if (wsStartEndChar.GetLength()) {
- val = (FX_CHAR)wsStartEndChar.GetAt(0);
+ val = (char)wsStartEndChar.GetAt(0);
return true;
}
}
@@ -1393,20 +1333,20 @@ bool CXFA_WidgetData::GetBarcodeAttribute_Truncate(bool& val) {
return false;
}
-bool CXFA_WidgetData::GetBarcodeAttribute_WideNarrowRatio(FX_FLOAT& val) {
+bool CXFA_WidgetData::GetBarcodeAttribute_WideNarrowRatio(float& val) {
CXFA_Node* pUIChild = GetUIChild();
CFX_WideString wsWideNarrowRatio;
if (pUIChild->TryCData(XFA_ATTRIBUTE_WideNarrowRatio, wsWideNarrowRatio)) {
FX_STRSIZE ptPos = wsWideNarrowRatio.Find(':');
- FX_FLOAT fRatio = 0;
+ float fRatio = 0;
if (ptPos >= 0) {
- fRatio = (FX_FLOAT)FXSYS_wtoi(wsWideNarrowRatio.c_str());
+ fRatio = (float)FXSYS_wtoi(wsWideNarrowRatio.c_str());
} else {
int32_t fA, fB;
fA = FXSYS_wtoi(wsWideNarrowRatio.Left(ptPos).c_str());
fB = FXSYS_wtoi(wsWideNarrowRatio.Mid(ptPos + 1).c_str());
if (fB)
- fRatio = (FX_FLOAT)fA / fB;
+ fRatio = (float)fA / fB;
}
val = fRatio;
return true;
@@ -1548,7 +1488,7 @@ bool CXFA_WidgetData::GetPictureContent(CFX_WideString& wsPicture,
return true;
}
}
- CFX_WideString wsDataPicture, wsTimePicture;
+
IFX_Locale* pLocale = GetLocal();
if (!pLocale)
return false;
@@ -1556,19 +1496,18 @@ bool CXFA_WidgetData::GetPictureContent(CFX_WideString& wsPicture,
uint32_t dwType = widgetValue.GetType();
switch (dwType) {
case XFA_VT_DATE:
- pLocale->GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY_Medium,
- wsPicture);
+ wsPicture =
+ pLocale->GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY_Medium);
break;
case XFA_VT_TIME:
- pLocale->GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY_Medium,
- wsPicture);
+ wsPicture =
+ pLocale->GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY_Medium);
break;
case XFA_VT_DATETIME:
- pLocale->GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY_Medium,
- wsDataPicture);
- pLocale->GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY_Medium,
- wsTimePicture);
- wsPicture = wsDataPicture + L"T" + wsTimePicture;
+ wsPicture =
+ pLocale->GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY_Medium) +
+ L"T" +
+ pLocale->GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY_Medium);
break;
case XFA_VT_DECIMAL:
case XFA_VT_FLOAT:
@@ -1578,7 +1517,6 @@ bool CXFA_WidgetData::GetPictureContent(CFX_WideString& wsPicture,
}
return true;
}
-
case XFA_VALUEPICTURE_Edit: {
CXFA_Node* pUI = m_pNode->GetChild(0, XFA_Element::Ui);
if (pUI) {
@@ -1587,32 +1525,29 @@ bool CXFA_WidgetData::GetPictureContent(CFX_WideString& wsPicture,
return true;
}
}
- {
- CFX_WideString wsDataPicture, wsTimePicture;
- IFX_Locale* pLocale = GetLocal();
- if (!pLocale) {
- return false;
- }
- uint32_t dwType = widgetValue.GetType();
- switch (dwType) {
- case XFA_VT_DATE:
- pLocale->GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY_Short,
- wsPicture);
- break;
- case XFA_VT_TIME:
- pLocale->GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY_Short,
- wsPicture);
- break;
- case XFA_VT_DATETIME:
- pLocale->GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY_Short,
- wsDataPicture);
- pLocale->GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY_Short,
- wsTimePicture);
- wsPicture = wsDataPicture + L"T" + wsTimePicture;
- break;
- default:
- break;
- }
+
+ IFX_Locale* pLocale = GetLocal();
+ if (!pLocale)
+ return false;
+
+ uint32_t dwType = widgetValue.GetType();
+ switch (dwType) {
+ case XFA_VT_DATE:
+ wsPicture =
+ pLocale->GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY_Short);
+ break;
+ case XFA_VT_TIME:
+ wsPicture =
+ pLocale->GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY_Short);
+ break;
+ case XFA_VT_DATETIME:
+ wsPicture =
+ pLocale->GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY_Short) +
+ L"T" +
+ pLocale->GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY_Short);
+ break;
+ default:
+ break;
}
return true;
}
@@ -1659,7 +1594,7 @@ bool CXFA_WidgetData::GetValue(CFX_WideString& wsValue,
if (eValueType == XFA_VALUEPICTURE_Display) {
int32_t iSelItemIndex = GetSelectedItem(0);
if (iSelItemIndex >= 0) {
- GetChoiceListItem(wsValue, iSelItemIndex);
+ GetChoiceListItem(wsValue, iSelItemIndex, false);
wsPicture.clear();
}
}
@@ -1845,8 +1780,8 @@ void CXFA_WidgetData::FormatNumStr(const CFX_WideString& wsValue,
return;
CFX_WideString wsSrcNum = wsValue;
- CFX_WideString wsGroupSymbol;
- pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Grouping, wsGroupSymbol);
+ CFX_WideString wsGroupSymbol =
+ pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Grouping);
bool bNeg = false;
if (wsSrcNum[0] == '-') {
bNeg = true;
@@ -1868,15 +1803,12 @@ void CXFA_WidgetData::FormatNumStr(const CFX_WideString& wsValue,
wsOutput += wsSrcNum[i];
}
if (dot_index < len) {
- CFX_WideString wsSymbol;
- pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Decimal, wsSymbol);
- wsOutput += wsSymbol;
+ wsOutput += pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Decimal);
wsOutput += wsSrcNum.Right(len - dot_index - 1);
}
if (bNeg) {
- CFX_WideString wsMinusymbol;
- pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Minus, wsMinusymbol);
- wsOutput = wsMinusymbol + wsOutput;
+ wsOutput =
+ pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Minus) + wsOutput;
}
}
}
@@ -1919,7 +1851,7 @@ CFX_WideString CXFA_WidgetData::NumericLimit(const CFX_WideString& wsValue,
i++;
}
for (; i < iCount; i++) {
- FX_WCHAR wc = wsValue[i];
+ wchar_t wc = wsValue[i];
if (FXSYS_isDecimalDigit(wc)) {
if (iLead >= 0) {
iLead_++;
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_widgetdata.h b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_widgetdata.h
index 4f5db3bad6d..fb44745ad9f 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_widgetdata.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_widgetdata.h
@@ -9,6 +9,7 @@
#include <vector>
+#include "core/fxcrt/fx_coordinates.h"
#include "core/fxcrt/fx_string.h"
#include "core/fxcrt/fx_system.h"
#include "xfa/fxfa/parser/cxfa_assist.h"
@@ -21,7 +22,6 @@
#include "xfa/fxfa/parser/cxfa_margin.h"
#include "xfa/fxfa/parser/cxfa_para.h"
#include "xfa/fxfa/parser/cxfa_validate.h"
-#include "xfa/fxfa/parser/xfa_object.h"
enum XFA_CHECKSTATE {
XFA_CHECKSTATE_On = 0,
@@ -53,22 +53,21 @@ class CXFA_WidgetData : public CXFA_Data {
CXFA_Font GetFont(bool bModified = false);
CXFA_Margin GetMargin(bool bModified = false);
CXFA_Para GetPara(bool bModified = false);
- void GetEventList(CXFA_NodeArray& events);
- int32_t GetEventByActivity(int32_t iActivity,
- CXFA_NodeArray& events,
- bool bIsFormReady = false);
+ std::vector<CXFA_Node*> GetEventList();
+ std::vector<CXFA_Node*> GetEventByActivity(int32_t iActivity,
+ bool bIsFormReady = false);
CXFA_Value GetDefaultValue(bool bModified = false);
CXFA_Value GetFormValue(bool bModified = false);
CXFA_Calculate GetCalculate(bool bModified = false);
CXFA_Validate GetValidate(bool bModified = false);
CXFA_Bind GetBind(bool bModified = false);
CXFA_Assist GetAssist(bool bModified = false);
- bool GetWidth(FX_FLOAT& fWidth);
- bool GetHeight(FX_FLOAT& fHeight);
- bool GetMinWidth(FX_FLOAT& fMinWidth);
- bool GetMinHeight(FX_FLOAT& fMinHeight);
- bool GetMaxWidth(FX_FLOAT& fMaxWidth);
- bool GetMaxHeight(FX_FLOAT& fMaxHeight);
+ bool GetWidth(float& fWidth);
+ bool GetHeight(float& fHeight);
+ bool GetMinWidth(float& fMinWidth);
+ bool GetMinHeight(float& fMinHeight);
+ bool GetMaxWidth(float& fMaxWidth);
+ bool GetMaxHeight(float& fMaxHeight);
CXFA_Border GetUIBorder();
CFX_RectF GetUIMargin();
int32_t GetButtonHighlight();
@@ -76,7 +75,7 @@ class CXFA_WidgetData : public CXFA_Data {
bool GetButtonDown(CFX_WideString& wsDown, bool& bRichText);
int32_t GetCheckButtonShape();
int32_t GetCheckButtonMark();
- FX_FLOAT GetCheckButtonSize();
+ float GetCheckButtonSize();
bool IsAllowNeutral();
bool IsRadioButton();
XFA_CHECKSTATE GetCheckState();
@@ -94,23 +93,22 @@ class CXFA_WidgetData : public CXFA_Data {
bool IsChoiceListAllowTextEntry();
int32_t GetChoiceListOpen();
bool IsListBox();
- int32_t CountChoiceListItems(bool bSaveValue = false);
+ int32_t CountChoiceListItems(bool bSaveValue);
bool GetChoiceListItem(CFX_WideString& wsText,
int32_t nIndex,
- bool bSaveValue = false);
- void GetChoiceListItems(std::vector<CFX_WideString>& wsTextArray,
- bool bSaveValue = false);
+ bool bSaveValue);
+ std::vector<CFX_WideString> GetChoiceListItems(bool bSaveValue);
int32_t CountSelectedItems();
int32_t GetSelectedItem(int32_t nIndex = 0);
- void GetSelectedItems(CFX_ArrayTemplate<int32_t>& iSelArray);
- void GetSelectedItemsValue(std::vector<CFX_WideString>& wsSelTextArray);
+ std::vector<int32_t> GetSelectedItems();
+ std::vector<CFX_WideString> GetSelectedItemsValue();
bool GetItemState(int32_t nIndex);
void SetItemState(int32_t nIndex,
bool bSelected,
bool bNotify,
bool bScriptModify,
bool bSyncData);
- void SetSelectedItems(CFX_ArrayTemplate<int32_t>& iSelArray,
+ void SetSelectedItems(const std::vector<int32_t>& iSelArray,
bool bNotify,
bool bScriptModify,
bool bSyncData);
@@ -140,15 +138,15 @@ class CXFA_WidgetData : public CXFA_Data {
bool GetBarcodeAttribute_CharEncoding(int32_t& val);
bool GetBarcodeAttribute_Checksum(bool& val);
bool GetBarcodeAttribute_DataLength(int32_t& val);
- bool GetBarcodeAttribute_StartChar(FX_CHAR& val);
- bool GetBarcodeAttribute_EndChar(FX_CHAR& val);
+ bool GetBarcodeAttribute_StartChar(char& val);
+ bool GetBarcodeAttribute_EndChar(char& val);
bool GetBarcodeAttribute_ECLevel(int32_t& val);
bool GetBarcodeAttribute_ModuleWidth(int32_t& val);
bool GetBarcodeAttribute_ModuleHeight(int32_t& val);
bool GetBarcodeAttribute_PrintChecksum(bool& val);
bool GetBarcodeAttribute_TextLocation(int32_t& val);
bool GetBarcodeAttribute_Truncate(bool& val);
- bool GetBarcodeAttribute_WideNarrowRatio(FX_FLOAT& val);
+ bool GetBarcodeAttribute_WideNarrowRatio(float& val);
void GetPasswordChar(CFX_WideString& wsPassWord);
bool IsMultiLine();
int32_t GetVerticalScrollPolicy();
@@ -163,7 +161,7 @@ class CXFA_WidgetData : public CXFA_Data {
bool m_bIsNull;
bool m_bPreNull;
- protected:
+ private:
void SyncValue(const CFX_WideString& wsValue, bool bNotify);
void InsertListTextItem(CXFA_Node* pItems,
const CFX_WideString& wsText,
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_xml_parser.cpp b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_xml_parser.cpp
deleted file mode 100644
index b2020225168..00000000000
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_xml_parser.cpp
+++ /dev/null
@@ -1,172 +0,0 @@
-// Copyright 2016 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#include "xfa/fxfa/parser/cxfa_xml_parser.h"
-
-CXFA_XMLParser::CXFA_XMLParser(CFDE_XMLNode* pRoot,
- const CFX_RetainPtr<IFGAS_Stream>& pStream)
- : m_nElementStart(0),
- m_dwCheckStatus(0),
- m_dwCurrentCheckStatus(0),
- m_pRoot(pRoot),
- m_pStream(pStream),
- m_pParser(new CFDE_XMLSyntaxParser),
- m_pParent(pRoot),
- m_pChild(nullptr),
- m_NodeStack(16),
- m_syntaxParserResult(FDE_XmlSyntaxResult::None) {
- ASSERT(m_pParent && m_pStream);
- m_NodeStack.Push(m_pParent);
- m_pParser->Init(m_pStream, 32 * 1024, 1024 * 1024);
-}
-
-CXFA_XMLParser::~CXFA_XMLParser() {
- m_NodeStack.RemoveAll(false);
- m_ws1.clear();
- m_ws2.clear();
-}
-
-int32_t CXFA_XMLParser::DoParser(IFX_Pause* pPause) {
- if (m_syntaxParserResult == FDE_XmlSyntaxResult::Error)
- return -1;
- if (m_syntaxParserResult == FDE_XmlSyntaxResult::EndOfString)
- return 100;
-
- int32_t iCount = 0;
- while (true) {
- m_syntaxParserResult = m_pParser->DoSyntaxParse();
- switch (m_syntaxParserResult) {
- case FDE_XmlSyntaxResult::InstructionOpen:
- break;
- case FDE_XmlSyntaxResult::InstructionClose:
- if (m_pChild) {
- if (m_pChild->GetType() != FDE_XMLNODE_Instruction) {
- m_syntaxParserResult = FDE_XmlSyntaxResult::Error;
- break;
- }
- }
- m_pChild = m_pParent;
- break;
- case FDE_XmlSyntaxResult::ElementOpen:
- if (m_dwCheckStatus != 0x03 && m_NodeStack.GetSize() == 2) {
- m_nElementStart = m_pParser->GetCurrentPos() - 1;
- }
- break;
- case FDE_XmlSyntaxResult::ElementBreak:
- break;
- case FDE_XmlSyntaxResult::ElementClose:
- if (m_pChild->GetType() != FDE_XMLNODE_Element) {
- m_syntaxParserResult = FDE_XmlSyntaxResult::Error;
- break;
- }
- m_pParser->GetTagName(m_ws1);
- static_cast<CFDE_XMLElement*>(m_pChild)->GetTagName(m_ws2);
- if (m_ws1.GetLength() > 0 && m_ws1 != m_ws2) {
- m_syntaxParserResult = FDE_XmlSyntaxResult::Error;
- break;
- }
- m_NodeStack.Pop();
- if (m_NodeStack.GetSize() < 1) {
- m_syntaxParserResult = FDE_XmlSyntaxResult::Error;
- break;
- } else if (m_dwCurrentCheckStatus != 0 && m_NodeStack.GetSize() == 2) {
- m_nSize[m_dwCurrentCheckStatus - 1] =
- m_pParser->GetCurrentBinaryPos() -
- m_nStart[m_dwCurrentCheckStatus - 1];
- m_dwCurrentCheckStatus = 0;
- }
-
- m_pParent = static_cast<CFDE_XMLNode*>(*m_NodeStack.GetTopElement());
- m_pChild = m_pParent;
- iCount++;
- break;
- case FDE_XmlSyntaxResult::TargetName:
- m_pParser->GetTargetName(m_ws1);
- if (m_ws1 == L"originalXFAVersion" || m_ws1 == L"acrobat") {
- m_pChild = new CFDE_XMLInstruction(m_ws1);
- m_pParent->InsertChildNode(m_pChild);
- } else {
- m_pChild = nullptr;
- }
- m_ws1.clear();
- break;
- case FDE_XmlSyntaxResult::TagName:
- m_pParser->GetTagName(m_ws1);
- m_pChild = new CFDE_XMLElement(m_ws1);
- m_pParent->InsertChildNode(m_pChild);
- m_NodeStack.Push(m_pChild);
- m_pParent = m_pChild;
-
- if (m_dwCheckStatus != 0x03 && m_NodeStack.GetSize() == 3) {
- CFX_WideString wsTag;
- static_cast<CFDE_XMLElement*>(m_pChild)->GetLocalTagName(wsTag);
- if (wsTag == L"template") {
- m_dwCheckStatus |= 0x01;
- m_dwCurrentCheckStatus = 0x01;
- m_nStart[0] = m_pParser->GetCurrentBinaryPos() -
- (m_pParser->GetCurrentPos() - m_nElementStart);
- } else if (wsTag == L"datasets") {
- m_dwCheckStatus |= 0x02;
- m_dwCurrentCheckStatus = 0x02;
- m_nStart[1] = m_pParser->GetCurrentBinaryPos() -
- (m_pParser->GetCurrentPos() - m_nElementStart);
- }
- }
- break;
- case FDE_XmlSyntaxResult::AttriName:
- m_pParser->GetAttributeName(m_ws1);
- break;
- case FDE_XmlSyntaxResult::AttriValue:
- if (m_pChild) {
- m_pParser->GetAttributeName(m_ws2);
- if (m_pChild->GetType() == FDE_XMLNODE_Element) {
- static_cast<CFDE_XMLElement*>(m_pChild)->SetString(m_ws1, m_ws2);
- }
- }
- m_ws1.clear();
- break;
- case FDE_XmlSyntaxResult::Text:
- m_pParser->GetTextData(m_ws1);
- m_pChild = new CFDE_XMLText(m_ws1);
- m_pParent->InsertChildNode(m_pChild);
- m_pChild = m_pParent;
- break;
- case FDE_XmlSyntaxResult::CData:
- m_pParser->GetTextData(m_ws1);
- m_pChild = new CFDE_XMLCharData(m_ws1);
- m_pParent->InsertChildNode(m_pChild);
- m_pChild = m_pParent;
- break;
- case FDE_XmlSyntaxResult::TargetData:
- if (m_pChild) {
- if (m_pChild->GetType() != FDE_XMLNODE_Instruction) {
- m_syntaxParserResult = FDE_XmlSyntaxResult::Error;
- break;
- }
- if (!m_ws1.IsEmpty()) {
- static_cast<CFDE_XMLInstruction*>(m_pChild)->AppendData(m_ws1);
- }
- m_pParser->GetTargetData(m_ws1);
- static_cast<CFDE_XMLInstruction*>(m_pChild)->AppendData(m_ws1);
- }
- m_ws1.clear();
- break;
- default:
- break;
- }
- if (m_syntaxParserResult == FDE_XmlSyntaxResult::Error ||
- m_syntaxParserResult == FDE_XmlSyntaxResult::EndOfString) {
- break;
- }
- if (pPause && iCount > 500 && pPause->NeedToPauseNow()) {
- break;
- }
- }
- return (m_syntaxParserResult == FDE_XmlSyntaxResult::Error ||
- m_NodeStack.GetSize() != 1)
- ? -1
- : m_pParser->GetStatus();
-}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_xml_parser.h b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_xml_parser.h
deleted file mode 100644
index 9393b7e597e..00000000000
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_xml_parser.h
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright 2016 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef XFA_FXFA_PARSER_CXFA_XML_PARSER_H_
-#define XFA_FXFA_PARSER_CXFA_XML_PARSER_H_
-
-#include <memory>
-
-#include "xfa/fde/xml/fde_xml_imp.h"
-
-class IFGAS_Stream;
-class IFX_Pause;
-
-class CXFA_XMLParser : public IFDE_XMLParser {
- public:
- CXFA_XMLParser(CFDE_XMLNode* pRoot,
- const CFX_RetainPtr<IFGAS_Stream>& pStream);
- ~CXFA_XMLParser() override;
-
- // IFDE_XMLParser
- int32_t DoParser(IFX_Pause* pPause) override;
-
- FX_FILESIZE m_nStart[2];
- size_t m_nSize[2];
- FX_FILESIZE m_nElementStart;
- uint16_t m_dwCheckStatus;
- uint16_t m_dwCurrentCheckStatus;
-
- protected:
- CFDE_XMLNode* m_pRoot;
- CFX_RetainPtr<IFGAS_Stream> m_pStream;
- std::unique_ptr<CFDE_XMLSyntaxParser> m_pParser;
- CFDE_XMLNode* m_pParent;
- CFDE_XMLNode* m_pChild;
- CFX_StackTemplate<CFDE_XMLNode*> m_NodeStack;
- CFX_WideString m_ws1;
- CFX_WideString m_ws2;
- FDE_XmlSyntaxResult m_syntaxParserResult;
-};
-
-#endif // XFA_FXFA_PARSER_CXFA_XML_PARSER_H_
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_xmllocale.cpp b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_xmllocale.cpp
new file mode 100644
index 00000000000..dd1d7cd1b81
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_xmllocale.cpp
@@ -0,0 +1,194 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "xfa/fxfa/parser/cxfa_xmllocale.h"
+
+#include <utility>
+
+#include "core/fxcrt/xml/cxml_element.h"
+#include "xfa/fxfa/parser/cxfa_document.h"
+#include "xfa/fxfa/parser/cxfa_localemgr.h"
+#include "xfa/fxfa/parser/cxfa_nodelocale.h"
+#include "xfa/fxfa/parser/cxfa_timezoneprovider.h"
+#include "xfa/fxfa/parser/xfa_utils.h"
+
+CXFA_XMLLocale::CXFA_XMLLocale(std::unique_ptr<CXML_Element> pLocaleData)
+ : m_pLocaleData(std::move(pLocaleData)) {}
+
+CXFA_XMLLocale::~CXFA_XMLLocale() {}
+
+CFX_WideString CXFA_XMLLocale::GetName() const {
+ return m_pLocaleData ? m_pLocaleData->GetAttrValue("name") : CFX_WideString();
+}
+
+CFX_WideString CXFA_XMLLocale::GetNumbericSymbol(
+ FX_LOCALENUMSYMBOL eType) const {
+ CFX_ByteString bsSymbols;
+ CFX_WideString wsName;
+ switch (eType) {
+ case FX_LOCALENUMSYMBOL_Decimal:
+ bsSymbols = "numberSymbols";
+ wsName = L"decimal";
+ break;
+ case FX_LOCALENUMSYMBOL_Grouping:
+ bsSymbols = "numberSymbols";
+ wsName = L"grouping";
+ break;
+ case FX_LOCALENUMSYMBOL_Percent:
+ bsSymbols = "numberSymbols";
+ wsName = L"percent";
+ break;
+ case FX_LOCALENUMSYMBOL_Minus:
+ bsSymbols = "numberSymbols";
+ wsName = L"minus";
+ break;
+ case FX_LOCALENUMSYMBOL_Zero:
+ bsSymbols = "numberSymbols";
+ wsName = L"zero";
+ break;
+ case FX_LOCALENUMSYMBOL_CurrencySymbol:
+ bsSymbols = "currencySymbols";
+ wsName = L"symbol";
+ break;
+ case FX_LOCALENUMSYMBOL_CurrencyName:
+ bsSymbols = "currencySymbols";
+ wsName = L"isoname";
+ break;
+ default:
+ return CFX_WideString();
+ }
+ CXML_Element* pElement = m_pLocaleData->GetElement("", bsSymbols.AsStringC());
+ if (!pElement)
+ return CFX_WideString();
+
+ return GetPattern(
+ pElement, CFX_ByteStringC(bsSymbols.c_str(), bsSymbols.GetLength() - 1),
+ wsName.AsStringC());
+}
+
+CFX_WideString CXFA_XMLLocale::GetDateTimeSymbols() const {
+ if (!m_pLocaleData)
+ return CFX_WideString();
+
+ CFX_ByteString bsSpace;
+ CXML_Element* pNumberSymbols =
+ m_pLocaleData->GetElement(bsSpace.AsStringC(), "dateTimeSymbols");
+ return pNumberSymbols ? pNumberSymbols->GetContent(0) : CFX_WideString();
+}
+
+CFX_WideString CXFA_XMLLocale::GetMonthName(int32_t nMonth, bool bAbbr) const {
+ return GetCalendarSymbol("month", nMonth, bAbbr);
+}
+
+CFX_WideString CXFA_XMLLocale::GetDayName(int32_t nWeek, bool bAbbr) const {
+ return GetCalendarSymbol("day", nWeek, bAbbr);
+}
+
+CFX_WideString CXFA_XMLLocale::GetMeridiemName(bool bAM) const {
+ return GetCalendarSymbol("meridiem", bAM ? 0 : 1, false);
+}
+
+FX_TIMEZONE CXFA_XMLLocale::GetTimeZone() const {
+ return CXFA_TimeZoneProvider().GetTimeZone();
+}
+
+CFX_WideString CXFA_XMLLocale::GetEraName(bool bAD) const {
+ return GetCalendarSymbol("era", bAD ? 1 : 0, false);
+}
+
+CFX_WideString CXFA_XMLLocale::GetCalendarSymbol(const CFX_ByteStringC& symbol,
+ int index,
+ bool bAbbr) const {
+ if (!m_pLocaleData)
+ return CFX_WideString();
+
+ CXML_Element* pChild = m_pLocaleData->GetElement("", "calendarSymbols");
+ if (!pChild)
+ return CFX_WideString();
+
+ CFX_ByteString pstrSymbolNames = symbol + "Names";
+ CXML_Element* pSymbolNames =
+ pChild->GetElement("", pstrSymbolNames.AsStringC());
+ if (!pSymbolNames)
+ return CFX_WideString();
+ if ((!!pSymbolNames->GetAttrInteger("abbr")) != bAbbr)
+ pSymbolNames = pChild->GetElement("", pstrSymbolNames.AsStringC(), 1);
+
+ if (!pSymbolNames || (!!pSymbolNames->GetAttrInteger("abbr")) != bAbbr)
+ return CFX_WideString();
+
+ CXML_Element* pSymbolName = pSymbolNames->GetElement("", symbol, index);
+ return pSymbolName ? pSymbolName->GetContent(0) : CFX_WideString();
+}
+
+CFX_WideString CXFA_XMLLocale::GetDatePattern(
+ FX_LOCALEDATETIMESUBCATEGORY eType) const {
+ CXML_Element* pElement = m_pLocaleData->GetElement("", "datePatterns");
+ if (!pElement)
+ return CFX_WideString();
+
+ CFX_WideString wsName;
+ switch (eType) {
+ case FX_LOCALEDATETIMESUBCATEGORY_Short:
+ wsName = L"short";
+ break;
+ case FX_LOCALEDATETIMESUBCATEGORY_Default:
+ case FX_LOCALEDATETIMESUBCATEGORY_Medium:
+ wsName = L"med";
+ break;
+ case FX_LOCALEDATETIMESUBCATEGORY_Full:
+ wsName = L"full";
+ break;
+ case FX_LOCALEDATETIMESUBCATEGORY_Long:
+ wsName = L"long";
+ break;
+ }
+ return GetPattern(pElement, "datePattern", wsName.AsStringC());
+}
+
+CFX_WideString CXFA_XMLLocale::GetTimePattern(
+ FX_LOCALEDATETIMESUBCATEGORY eType) const {
+ CXML_Element* pElement = m_pLocaleData->GetElement("", "timePatterns");
+ if (!pElement)
+ return CFX_WideString();
+
+ CFX_WideString wsName;
+ switch (eType) {
+ case FX_LOCALEDATETIMESUBCATEGORY_Short:
+ wsName = L"short";
+ break;
+ case FX_LOCALEDATETIMESUBCATEGORY_Default:
+ case FX_LOCALEDATETIMESUBCATEGORY_Medium:
+ wsName = L"med";
+ break;
+ case FX_LOCALEDATETIMESUBCATEGORY_Full:
+ wsName = L"full";
+ break;
+ case FX_LOCALEDATETIMESUBCATEGORY_Long:
+ wsName = L"long";
+ break;
+ }
+ return GetPattern(pElement, "timePattern", wsName.AsStringC());
+}
+
+CFX_WideString CXFA_XMLLocale::GetNumPattern(
+ FX_LOCALENUMSUBCATEGORY eType) const {
+ return m_pLocaleData->GetElement("", "numberPatterns")
+ ? XFA_PatternToString(eType)
+ : CFX_WideString();
+}
+
+CFX_WideString CXFA_XMLLocale::GetPattern(CXML_Element* pElement,
+ const CFX_ByteStringC& bsTag,
+ const CFX_WideStringC& wsName) const {
+ int32_t iCount = pElement->CountElements("", bsTag);
+ for (int32_t i = 0; i < iCount; i++) {
+ CXML_Element* pChild = pElement->GetElement("", bsTag, i);
+ if (pChild->GetAttrValue("name") == wsName)
+ return pChild->GetContent(0);
+ }
+ return CFX_WideString();
+}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_xmllocale.h b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_xmllocale.h
new file mode 100644
index 00000000000..a58385601cb
--- /dev/null
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_xmllocale.h
@@ -0,0 +1,49 @@
+// 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 XFA_FXFA_PARSER_CXFA_XMLLOCALE_H_
+#define XFA_FXFA_PARSER_CXFA_XMLLOCALE_H_
+
+#include <memory>
+
+#include "core/fxcrt/ifx_locale.h"
+
+class CXML_Element;
+
+class CXFA_XMLLocale : public IFX_Locale {
+ public:
+ explicit CXFA_XMLLocale(std::unique_ptr<CXML_Element> pLocaleData);
+ ~CXFA_XMLLocale() override;
+
+ // IFX_Locale
+ CFX_WideString GetName() const override;
+ CFX_WideString GetNumbericSymbol(FX_LOCALENUMSYMBOL eType) const override;
+
+ CFX_WideString GetDateTimeSymbols() const override;
+ CFX_WideString GetMonthName(int32_t nMonth, bool bAbbr) const override;
+ CFX_WideString GetDayName(int32_t nWeek, bool bAbbr) const override;
+ CFX_WideString GetMeridiemName(bool bAM) const override;
+ FX_TIMEZONE GetTimeZone() const override;
+ CFX_WideString GetEraName(bool bAD) const override;
+
+ CFX_WideString GetDatePattern(
+ FX_LOCALEDATETIMESUBCATEGORY eType) const override;
+ CFX_WideString GetTimePattern(
+ FX_LOCALEDATETIMESUBCATEGORY eType) const override;
+ CFX_WideString GetNumPattern(FX_LOCALENUMSUBCATEGORY eType) const override;
+
+ private:
+ CFX_WideString GetPattern(CXML_Element* pElement,
+ const CFX_ByteStringC& bsTag,
+ const CFX_WideStringC& wsName) const;
+ CFX_WideString GetCalendarSymbol(const CFX_ByteStringC& symbol,
+ int index,
+ bool bAbbr) const;
+
+ std::unique_ptr<CXML_Element> m_pLocaleData;
+};
+
+#endif // XFA_FXFA_PARSER_CXFA_XMLLOCALE_H_
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/xfa_basic_data.cpp b/chromium/third_party/pdfium/xfa/fxfa/parser/xfa_basic_data.cpp
index fecc942c7db..8e2986fecf0 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/xfa_basic_data.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/xfa_basic_data.cpp
@@ -7,7 +7,7 @@
#include "xfa/fxfa/parser/xfa_basic_data.h"
#include "xfa/fxfa/fxfa_basic.h"
-#include "xfa/fxfa/parser/xfa_object.h"
+#include "xfa/fxfa/parser/cxfa_object.h"
const XFA_ELEMENTINFO g_XFAElementData[] = {
{0x23ee3, L"ps", XFA_Element::Ps, XFA_XDPPACKET_Config,
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/xfa_basic_data_element_script.cpp b/chromium/third_party/pdfium/xfa/fxfa/parser/xfa_basic_data_element_script.cpp
index 675fb8a39a9..bb8a9857406 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/xfa_basic_data_element_script.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/xfa_basic_data_element_script.cpp
@@ -13,6 +13,8 @@
#include "xfa/fxfa/parser/cscript_layoutpseudomodel.h"
#include "xfa/fxfa/parser/cscript_logpseudomodel.h"
#include "xfa/fxfa/parser/cscript_signaturepseudomodel.h"
+#include "xfa/fxfa/parser/cxfa_node.h"
+#include "xfa/fxfa/parser/cxfa_nodelist.h"
const XFA_SCRIPTHIERARCHY g_XFAScriptIndex[] = {
{0, 0, 0, 2, 316}, {0, 0, 2, 2, 316}, {0, 0, 4, 2, 316},
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/chromium/third_party/pdfium/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
index 03ab81e39f2..82aec1f00d5 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
@@ -11,13 +11,16 @@
#include "core/fxcrt/fx_ext.h"
#include "third_party/base/stl_util.h"
-#include "xfa/fde/xml/fde_xml_imp.h"
+#include "xfa/fde/xml/cfde_xmlelement.h"
+#include "xfa/fde/xml/cfde_xmlnode.h"
#include "xfa/fxfa/parser/cxfa_document.h"
#include "xfa/fxfa/parser/cxfa_layoutprocessor.h"
+#include "xfa/fxfa/parser/cxfa_localemgr.h"
+#include "xfa/fxfa/parser/cxfa_node.h"
#include "xfa/fxfa/parser/cxfa_occur.h"
#include "xfa/fxfa/parser/cxfa_scriptcontext.h"
-#include "xfa/fxfa/parser/xfa_localemgr.h"
-#include "xfa/fxfa/parser/xfa_object.h"
+#include "xfa/fxfa/parser/cxfa_traversestrategy_xfacontainernode.h"
+#include "xfa/fxfa/parser/cxfa_traversestrategy_xfanode.h"
#include "xfa/fxfa/parser/xfa_resolvenode_rs.h"
#include "xfa/fxfa/parser/xfa_utils.h"
@@ -153,17 +156,16 @@ void CreateDataBinding(CXFA_Node* pFormNode,
case XFA_Element::ChoiceList:
defValue.GetChildValueContent(wsValue);
if (pWidgetData->GetChoiceListOpen() == XFA_ATTRIBUTEENUM_MultiSelect) {
- std::vector<CFX_WideString> wsSelTextArray;
- pWidgetData->GetSelectedItemsValue(wsSelTextArray);
- int32_t iSize = pdfium::CollectionSize<int32_t>(wsSelTextArray);
- if (iSize >= 1) {
- CXFA_Node* pValue = nullptr;
- for (int32_t i = 0; i < iSize; i++) {
- pValue = pDataNode->CreateSamePacketNode(XFA_Element::DataValue);
+ std::vector<CFX_WideString> wsSelTextArray =
+ pWidgetData->GetSelectedItemsValue();
+ if (!wsSelTextArray.empty()) {
+ for (const auto& text : wsSelTextArray) {
+ CXFA_Node* pValue =
+ pDataNode->CreateSamePacketNode(XFA_Element::DataValue);
pValue->SetCData(XFA_ATTRIBUTE_Name, L"value");
pValue->CreateXMLMappingNode();
pDataNode->InsertChild(pValue);
- pValue->SetCData(XFA_ATTRIBUTE_Value, wsSelTextArray[i]);
+ pValue->SetCData(XFA_ATTRIBUTE_Value, text);
}
} else {
CFDE_XMLNode* pXMLNode = pDataNode->GetXMLMappingNode();
@@ -282,14 +284,15 @@ void CreateDataBinding(CXFA_Node* pFormNode,
CFDE_XMLElement* pXMLDataElement =
static_cast<CFDE_XMLElement*>(pDataNode->GetXMLMappingNode());
ASSERT(pXMLDataElement);
- CFX_WideString wsContentType;
- CFX_WideString wsHref;
- pXMLDataElement->GetString(L"xfa:contentType", wsContentType);
+
+ CFX_WideString wsContentType =
+ pXMLDataElement->GetString(L"xfa:contentType");
if (!wsContentType.IsEmpty()) {
pDataNode->SetCData(XFA_ATTRIBUTE_ContentType, wsContentType);
image.SetContentType(wsContentType);
}
- pXMLDataElement->GetString(L"href", wsHref);
+
+ CFX_WideString wsHref = pXMLDataElement->GetString(L"href");
if (!wsHref.IsEmpty())
image.SetHref(wsHref);
}
@@ -297,20 +300,19 @@ void CreateDataBinding(CXFA_Node* pFormNode,
}
case XFA_Element::ChoiceList:
if (pWidgetData->GetChoiceListOpen() == XFA_ATTRIBUTEENUM_MultiSelect) {
- CXFA_NodeArray items;
- pDataNode->GetNodeList(items);
- int32_t iCounts = items.GetSize();
- if (iCounts > 0) {
+ std::vector<CXFA_Node*> items = pDataNode->GetNodeList();
+ if (!items.empty()) {
+ bool single = items.size() == 1;
wsNormalizeValue.clear();
CFX_WideString wsItem;
- for (int32_t i = 0; i < iCounts; i++) {
- items[i]->TryContent(wsItem);
- wsItem = (iCounts == 1) ? wsItem : wsItem + L"\n";
+ for (CXFA_Node* pNode : items) {
+ pNode->TryContent(wsItem);
+ wsItem = single ? wsItem : wsItem + L"\n";
wsNormalizeValue += wsItem;
}
CXFA_ExData exData = defValue.GetExData();
ASSERT(exData);
- exData.SetContentType(iCounts == 1 ? L"text/plain" : L"text/xml");
+ exData.SetContentType(single ? L"text/plain" : L"text/xml");
}
FormValueNode_SetChildContent(defValue.GetNode(), wsNormalizeValue,
XFA_Element::ExData);
@@ -464,12 +466,12 @@ CXFA_Node* FindDataRefDataNode(CXFA_Document* pDocument,
pTemplateNode);
if (rs.dwFlags == XFA_RESOLVENODE_RSTYPE_CreateNodeAll ||
rs.dwFlags == XFA_RESOLVENODE_RSTYPE_CreateNodeMidAll ||
- rs.nodes.GetSize() > 1) {
- return pDocument->GetNotBindNode(rs.nodes);
+ rs.objects.size() > 1) {
+ return pDocument->GetNotBindNode(rs.objects);
}
if (rs.dwFlags == XFA_RESOLVENODE_RSTYPE_CreateNodeOne) {
- CXFA_Object* pObject = (rs.nodes.GetSize() > 0) ? rs.nodes[0] : nullptr;
+ CXFA_Object* pObject = !rs.objects.empty() ? rs.objects.front() : nullptr;
CXFA_Node* pNode = ToNode(pObject);
return (bForceBind || !pNode || !pNode->HasBindItem()) ? pNode : nullptr;
}
@@ -492,7 +494,7 @@ bool NeedGenerateForm(CXFA_Node* pTemplateChild, bool bUseInstanceManager) {
CXFA_Node* CloneOrMergeInstanceManager(CXFA_Document* pDocument,
CXFA_Node* pFormParent,
CXFA_Node* pTemplateNode,
- CXFA_NodeArray& subforms) {
+ std::vector<CXFA_Node*>* subforms) {
CFX_WideStringC wsSubformName = pTemplateNode->GetCData(XFA_ATTRIBUTE_Name);
CFX_WideString wsInstMgrNodeName = L"_" + wsSubformName;
uint32_t dwInstNameHash =
@@ -518,7 +520,7 @@ CXFA_Node* CloneOrMergeInstanceManager(CXFA_Document* pDocument,
CXFA_Node* pNextNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling);
pFormParent->RemoveChild(pNode);
- subforms.Add(pNode);
+ subforms->push_back(pNode);
pNode = pNextNode;
}
pFormParent->RemoveChild(pExistingNode);
@@ -653,39 +655,31 @@ CXFA_Node* FindMatchingDataNode(
return pResult;
}
-void SortRecurseRecord(CFX_ArrayTemplate<RecurseRecord>& rgRecords,
+void SortRecurseRecord(std::vector<RecurseRecord>* rgRecords,
CXFA_Node* pDataScope,
bool bChoiceMode) {
- int32_t iCount = rgRecords.GetSize();
- CFX_ArrayTemplate<RecurseRecord> rgResultRecord;
- for (CXFA_Node* pChildNode = pDataScope->GetNodeItem(XFA_NODEITEM_FirstChild);
- pChildNode;
- pChildNode = pChildNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
- for (int32_t i = 0; i < iCount; i++) {
- CXFA_Node* pNode = rgRecords[i].pDataChild;
- if (pChildNode == pNode) {
- RecurseRecord sNewRecord = {rgRecords[i].pTemplateChild, pNode};
- rgResultRecord.Add(sNewRecord);
- rgRecords.RemoveAt(i);
- iCount--;
+ std::vector<RecurseRecord> rgResultRecord;
+ for (CXFA_Node* pNode = pDataScope->GetNodeItem(XFA_NODEITEM_FirstChild);
+ pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
+ auto it = std::find_if(rgRecords->begin(), rgRecords->end(),
+ [pNode](const RecurseRecord& record) {
+ return pNode == record.pDataChild;
+ });
+ if (it != rgRecords->end()) {
+ rgResultRecord.push_back(*it);
+ rgRecords->erase(it);
+ if (bChoiceMode)
break;
- }
}
- if (bChoiceMode && rgResultRecord.GetSize() > 0)
- break;
}
+ if (rgResultRecord.empty())
+ return;
- if (rgResultRecord.GetSize() > 0) {
- if (!bChoiceMode) {
- for (int32_t i = 0; i < iCount; i++) {
- RecurseRecord sNewRecord = {rgRecords[i].pTemplateChild,
- rgRecords[i].pDataChild};
- rgResultRecord.Add(sNewRecord);
- }
- }
- rgRecords.RemoveAll();
- rgRecords.Copy(rgResultRecord);
+ if (!bChoiceMode) {
+ rgResultRecord.insert(rgResultRecord.end(), rgRecords->begin(),
+ rgRecords->end());
}
+ *rgRecords = rgResultRecord;
}
CXFA_Node* CopyContainer_SubformSet(CXFA_Document* pDocument,
@@ -700,13 +694,13 @@ CXFA_Node* CopyContainer_SubformSet(CXFA_Document* pDocument,
bool bUseInstanceManager =
pFormParentNode->GetElementType() != XFA_Element::Area;
CXFA_Node* pInstMgrNode = nullptr;
- CXFA_NodeArray subformArray;
- CXFA_NodeArray* pSearchArray = nullptr;
+ std::vector<CXFA_Node*> subformArray;
+ std::vector<CXFA_Node*>* pSearchArray = nullptr;
if (!bOneInstance &&
(eType == XFA_Element::SubformSet || eType == XFA_Element::Subform)) {
pInstMgrNode = bUseInstanceManager ? CloneOrMergeInstanceManager(
pDocument, pFormParentNode,
- pTemplateNode, subformArray)
+ pTemplateNode, &subformArray)
: nullptr;
if (CXFA_Node* pOccurTemplateNode =
pTemplateNode->GetFirstChildByClass(XFA_Element::Occur)) {
@@ -724,10 +718,9 @@ CXFA_Node* CopyContainer_SubformSet(CXFA_Document* pDocument,
pSearchArray = &subformArray;
if (pFormParentNode->GetElementType() == XFA_Element::PageArea) {
bOneInstance = true;
- if (subformArray.GetSize() < 1)
+ if (subformArray.empty())
pSearchArray = nullptr;
- } else if ((pTemplateNode->GetNameHash() == 0) &&
- (subformArray.GetSize() < 1)) {
+ } else if (pTemplateNode->GetNameHash() == 0 && subformArray.empty()) {
pSearchArray = nullptr;
}
}
@@ -753,7 +746,7 @@ CXFA_Node* CopyContainer_SubformSet(CXFA_Document* pDocument,
sNodeIterator.MoveToNext();
} else {
std::map<CXFA_Node*, CXFA_Node*> subformMapArray;
- CXFA_NodeArray nodeArray;
+ std::vector<CXFA_Node*> nodeArray;
for (; iMax < 0 || iCurRepeatIndex < iMax; iCurRepeatIndex++) {
bool bSelfMatch = false;
XFA_ATTRIBUTEENUM eBindMatch = XFA_ATTRIBUTEENUM_None;
@@ -772,11 +765,10 @@ CXFA_Node* CopyContainer_SubformSet(CXFA_Document* pDocument,
CreateDataBinding(pSubformNode, pDataNode, true);
ASSERT(pSubformNode);
subformMapArray[pSubformNode] = pDataNode;
- nodeArray.Add(pSubformNode);
+ nodeArray.push_back(pSubformNode);
}
- for (int32_t iIndex = 0; iIndex < nodeArray.GetSize(); iIndex++) {
- CXFA_Node* pSubform = nodeArray[iIndex];
+ for (CXFA_Node* pSubform : nodeArray) {
CXFA_Node* pDataNode = nullptr;
auto it = subformMapArray.find(pSubform);
if (it != subformMapArray.end())
@@ -818,8 +810,8 @@ CXFA_Node* CopyContainer_SubformSet(CXFA_Document* pDocument,
if (!pFirstInstance)
pFirstInstance = pSubformSetNode;
- CFX_ArrayTemplate<RecurseRecord> rgItemMatchList;
- CFX_ArrayTemplate<CXFA_Node*> rgItemUnmatchList;
+ std::vector<RecurseRecord> rgItemMatchList;
+ std::vector<CXFA_Node*> rgItemUnmatchList;
for (CXFA_Node* pTemplateChild =
pTemplateNode->GetNodeItem(XFA_NODEITEM_FirstChild);
pTemplateChild; pTemplateChild = pTemplateChild->GetNodeItem(
@@ -837,42 +829,39 @@ CXFA_Node* CopyContainer_SubformSet(CXFA_Document* pDocument,
if (pDataMatch) {
RecurseRecord sNewRecord = {pTemplateChild, pDataMatch};
if (bSelfMatch)
- rgItemMatchList.InsertAt(0, sNewRecord);
+ rgItemMatchList.insert(rgItemMatchList.begin(), sNewRecord);
else
- rgItemMatchList.Add(sNewRecord);
+ rgItemMatchList.push_back(sNewRecord);
} else {
- rgItemUnmatchList.Add(pTemplateChild);
+ rgItemUnmatchList.push_back(pTemplateChild);
}
} else {
- rgItemUnmatchList.Add(pTemplateChild);
+ rgItemUnmatchList.push_back(pTemplateChild);
}
}
}
switch (eRelation) {
case XFA_ATTRIBUTEENUM_Choice: {
- ASSERT(rgItemMatchList.GetSize());
- SortRecurseRecord(rgItemMatchList, pDataScope, true);
+ ASSERT(!rgItemMatchList.empty());
+ SortRecurseRecord(&rgItemMatchList, pDataScope, true);
pDocument->DataMerge_CopyContainer(
- rgItemMatchList[0].pTemplateChild, pSubformSetNode, pDataScope,
- false, true, true);
+ rgItemMatchList.front().pTemplateChild, pSubformSetNode,
+ pDataScope, false, true, true);
break;
}
case XFA_ATTRIBUTEENUM_Unordered: {
- if (rgItemMatchList.GetSize()) {
- SortRecurseRecord(rgItemMatchList, pDataScope, false);
- for (int32_t i = 0, count = rgItemMatchList.GetSize(); i < count;
- i++) {
- pDocument->DataMerge_CopyContainer(
- rgItemMatchList[i].pTemplateChild, pSubformSetNode,
- pDataScope, false, true, true);
+ if (!rgItemMatchList.empty()) {
+ SortRecurseRecord(&rgItemMatchList, pDataScope, false);
+ for (const auto& matched : rgItemMatchList) {
+ pDocument->DataMerge_CopyContainer(matched.pTemplateChild,
+ pSubformSetNode, pDataScope,
+ false, true, true);
}
}
- for (int32_t i = 0, count = rgItemUnmatchList.GetSize(); i < count;
- i++) {
- pDocument->DataMerge_CopyContainer(rgItemUnmatchList[i],
- pSubformSetNode, pDataScope,
- false, true, true);
+ for (auto* unmatched : rgItemUnmatchList) {
+ pDocument->DataMerge_CopyContainer(unmatched, pSubformSetNode,
+ pDataScope, false, true, true);
}
break;
}
@@ -904,14 +893,14 @@ CXFA_Node* CopyContainer_SubformSet(CXFA_Document* pDocument,
if (iCurRepeatIndex == 0 && bAccessedDataDOM == false) {
int32_t iLimit = iMax;
if (pInstMgrNode && pTemplateNode->GetNameHash() == 0) {
- iLimit = subformArray.GetSize();
+ iLimit = pdfium::CollectionSize<int32_t>(subformArray);
if (iLimit < iMin)
iLimit = iInit;
}
for (; (iLimit < 0 || iCurRepeatIndex < iLimit); iCurRepeatIndex++) {
if (pInstMgrNode) {
- if (pSearchArray && pSearchArray->GetSize() < 1) {
+ if (pSearchArray && pSearchArray->empty()) {
if (pTemplateNode->GetNameHash() != 0)
break;
pSearchArray = nullptr;
@@ -1158,7 +1147,7 @@ void UpdateBindingRelations(CXFA_Document* pDocument,
pDocument->GetScriptContext()->ResolveObjects(pDataScope, wsRef, rs,
dFlags, pTemplateNode);
CXFA_Object* pObject =
- (rs.nodes.GetSize() > 0) ? rs.nodes[0] : nullptr;
+ !rs.objects.empty() ? rs.objects.front() : nullptr;
pDataNode = ToNode(pObject);
if (pDataNode) {
CreateDataBinding(pFormNode, pDataNode,
@@ -1247,21 +1236,21 @@ CXFA_Node* XFA_DataMerge_FindFormDOMInstance(CXFA_Document* pDocument,
return nullptr;
}
-CXFA_Node* XFA_NodeMerge_CloneOrMergeContainer(CXFA_Document* pDocument,
- CXFA_Node* pFormParent,
- CXFA_Node* pTemplateNode,
- bool bRecursive,
- CXFA_NodeArray* pSubformArray) {
+CXFA_Node* XFA_NodeMerge_CloneOrMergeContainer(
+ CXFA_Document* pDocument,
+ CXFA_Node* pFormParent,
+ CXFA_Node* pTemplateNode,
+ bool bRecursive,
+ std::vector<CXFA_Node*>* pSubformArray) {
CXFA_Node* pExistingNode = nullptr;
if (!pSubformArray) {
pExistingNode = XFA_DataMerge_FindFormDOMInstance(
pDocument, pTemplateNode->GetElementType(),
pTemplateNode->GetNameHash(), pFormParent);
- } else if (pSubformArray->GetSize() > 0) {
- pExistingNode = pSubformArray->GetAt(0);
- pSubformArray->RemoveAt(0);
+ } else if (!pSubformArray->empty()) {
+ pExistingNode = pSubformArray->front();
+ pSubformArray->erase(pSubformArray->begin());
}
-
if (pExistingNode) {
if (pSubformArray) {
pFormParent->InsertChild(pExistingNode);
@@ -1354,9 +1343,10 @@ void CXFA_Document::DataMerge_UpdateBindingRelations(
UpdateBindingRelations(this, pFormUpdateRoot, pDataScope, true, false);
}
-CXFA_Node* CXFA_Document::GetNotBindNode(CXFA_ObjArray& arrayNodes) {
- for (int32_t i = 0; i < arrayNodes.GetSize(); i++) {
- CXFA_Node* pNode = arrayNodes[i]->AsNode();
+CXFA_Node* CXFA_Document::GetNotBindNode(
+ const std::vector<CXFA_Object*>& arrayObjects) {
+ for (CXFA_Object* pObject : arrayObjects) {
+ CXFA_Node* pNode = pObject->AsNode();
if (pNode && !pNode->HasBindItem())
return pNode;
}
@@ -1482,7 +1472,7 @@ void CXFA_Document::DoDataMerge() {
CXFA_Node* pPageSetNode =
pSubformSetNode->GetFirstChildByClass(XFA_Element::PageSet);
while (pPageSetNode) {
- m_pPendingPageSet.Add(pPageSetNode);
+ m_pPendingPageSet.push_back(pPageSetNode);
CXFA_Node* pNextPageSetNode =
pPageSetNode->GetNextSameClassSibling(XFA_Element::PageSet);
pSubformSetNode->RemoveChild(pPageSetNode);
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/xfa_document_datamerger_imp.h b/chromium/third_party/pdfium/xfa/fxfa/parser/xfa_document_datamerger_imp.h
index f9ea087731c..9e58678867b 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/xfa_document_datamerger_imp.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/xfa_document_datamerger_imp.h
@@ -7,13 +7,19 @@
#ifndef XFA_FXFA_PARSER_XFA_DOCUMENT_DATAMERGER_IMP_H_
#define XFA_FXFA_PARSER_XFA_DOCUMENT_DATAMERGER_IMP_H_
-#include "xfa/fxfa/parser/xfa_object.h"
+#include <vector>
-CXFA_Node* XFA_NodeMerge_CloneOrMergeContainer(CXFA_Document* pDocument,
- CXFA_Node* pFormParent,
- CXFA_Node* pTemplateNode,
- bool bRecursive,
- CXFA_NodeArray* pSubformArray);
+#include "xfa/fxfa/fxfa_basic.h"
+
+class CXFA_Document;
+class CXFA_Node;
+
+CXFA_Node* XFA_NodeMerge_CloneOrMergeContainer(
+ CXFA_Document* pDocument,
+ CXFA_Node* pFormParent,
+ CXFA_Node* pTemplateNode,
+ bool bRecursive,
+ std::vector<CXFA_Node*>* pSubformArray);
CXFA_Node* XFA_DataMerge_FindDataScope(CXFA_Node* pParentFormNode);
CXFA_Node* XFA_DataMerge_FindFormDOMInstance(CXFA_Document* pDocument,
XFA_Element eType,
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/xfa_layout_itemlayout.cpp b/chromium/third_party/pdfium/xfa/fxfa/parser/xfa_layout_itemlayout.cpp
deleted file mode 100644
index dd38c963d68..00000000000
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/xfa_layout_itemlayout.cpp
+++ /dev/null
@@ -1,2793 +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
-
-#include "xfa/fxfa/parser/xfa_layout_itemlayout.h"
-
-#include <algorithm>
-#include <memory>
-#include <utility>
-#include <vector>
-
-#include "third_party/base/ptr_util.h"
-#include "third_party/base/stl_util.h"
-#include "xfa/fxfa/app/xfa_ffnotify.h"
-#include "xfa/fxfa/parser/cxfa_containerlayoutitem.h"
-#include "xfa/fxfa/parser/cxfa_contentlayoutitem.h"
-#include "xfa/fxfa/parser/cxfa_document.h"
-#include "xfa/fxfa/parser/cxfa_layoutpagemgr.h"
-#include "xfa/fxfa/parser/cxfa_measurement.h"
-#include "xfa/fxfa/parser/cxfa_occur.h"
-#include "xfa/fxfa/parser/xfa_localemgr.h"
-#include "xfa/fxfa/parser/xfa_object.h"
-#include "xfa/fxfa/parser/xfa_utils.h"
-
-namespace {
-
-std::vector<CFX_WideString> SeparateStringW(const FX_WCHAR* pStr,
- int32_t iStrLen,
- FX_WCHAR delimiter) {
- std::vector<CFX_WideString> ret;
- if (!pStr)
- return ret;
- if (iStrLen < 0)
- iStrLen = FXSYS_wcslen(pStr);
-
- const FX_WCHAR* pToken = pStr;
- const FX_WCHAR* pEnd = pStr + iStrLen;
- while (true) {
- if (pStr >= pEnd || delimiter == *pStr) {
- ret.push_back(CFX_WideString(pToken, pStr - pToken));
- pToken = pStr + 1;
- if (pStr >= pEnd)
- break;
- }
- pStr++;
- }
- return ret;
-}
-
-void UpdateWidgetSize(CXFA_ContentLayoutItem* pLayoutItem,
- FX_FLOAT* fWidth,
- FX_FLOAT* fHeight) {
- CXFA_Node* pNode = pLayoutItem->m_pFormNode;
- switch (pNode->GetElementType()) {
- case XFA_Element::Subform:
- case XFA_Element::Area:
- case XFA_Element::ExclGroup:
- case XFA_Element::SubformSet: {
- if (*fWidth < -XFA_LAYOUT_FLOAT_PERCISION)
- *fWidth = pLayoutItem->m_sSize.width;
- if (*fHeight < -XFA_LAYOUT_FLOAT_PERCISION)
- *fHeight = pLayoutItem->m_sSize.height;
- break;
- }
- case XFA_Element::Draw:
- case XFA_Element::Field: {
- pNode->GetDocument()->GetNotify()->StartFieldDrawLayout(pNode, *fWidth,
- *fHeight);
- break;
- }
- default:
- ASSERT(false);
- }
-}
-
-CFX_SizeF CalculateContainerSpecifiedSize(CXFA_Node* pFormNode,
- bool* bContainerWidthAutoSize,
- bool* bContainerHeightAutoSize) {
- *bContainerWidthAutoSize = true;
- *bContainerHeightAutoSize = true;
-
- XFA_Element eType = pFormNode->GetElementType();
- CXFA_Measurement mTmpValue;
- CFX_SizeF containerSize;
- if ((eType == XFA_Element::Subform || eType == XFA_Element::ExclGroup) &&
- pFormNode->TryMeasure(XFA_ATTRIBUTE_W, mTmpValue, false) &&
- mTmpValue.GetValue() > XFA_LAYOUT_FLOAT_PERCISION) {
- containerSize.width = mTmpValue.ToUnit(XFA_UNIT_Pt);
- *bContainerWidthAutoSize = false;
- }
- if ((eType == XFA_Element::Subform || eType == XFA_Element::ExclGroup) &&
- pFormNode->TryMeasure(XFA_ATTRIBUTE_H, mTmpValue, false) &&
- mTmpValue.GetValue() > XFA_LAYOUT_FLOAT_PERCISION) {
- containerSize.height = mTmpValue.ToUnit(XFA_UNIT_Pt);
- *bContainerHeightAutoSize = false;
- }
- if (*bContainerWidthAutoSize && eType == XFA_Element::Subform &&
- pFormNode->TryMeasure(XFA_ATTRIBUTE_MaxW, mTmpValue, false) &&
- mTmpValue.GetValue() > XFA_LAYOUT_FLOAT_PERCISION) {
- containerSize.width = mTmpValue.ToUnit(XFA_UNIT_Pt);
- *bContainerWidthAutoSize = false;
- }
- if (*bContainerHeightAutoSize && eType == XFA_Element::Subform &&
- pFormNode->TryMeasure(XFA_ATTRIBUTE_MaxH, mTmpValue, false) &&
- mTmpValue.GetValue() > XFA_LAYOUT_FLOAT_PERCISION) {
- containerSize.height = mTmpValue.ToUnit(XFA_UNIT_Pt);
- *bContainerHeightAutoSize = false;
- }
- return containerSize;
-}
-
-CFX_SizeF CalculateContainerComponentSizeFromContentSize(
- CXFA_Node* pFormNode,
- bool bContainerWidthAutoSize,
- FX_FLOAT fContentCalculatedWidth,
- bool bContainerHeightAutoSize,
- FX_FLOAT fContentCalculatedHeight,
- const CFX_SizeF& currentContainerSize) {
- CFX_SizeF componentSize = currentContainerSize;
- CXFA_Node* pMarginNode = pFormNode->GetFirstChildByClass(XFA_Element::Margin);
- CXFA_Measurement mTmpValue;
- if (bContainerWidthAutoSize) {
- componentSize.width = fContentCalculatedWidth;
- if (pMarginNode) {
- if (pMarginNode->TryMeasure(XFA_ATTRIBUTE_LeftInset, mTmpValue, false))
- componentSize.width += mTmpValue.ToUnit(XFA_UNIT_Pt);
- if (pMarginNode->TryMeasure(XFA_ATTRIBUTE_RightInset, mTmpValue, false))
- componentSize.width += mTmpValue.ToUnit(XFA_UNIT_Pt);
- }
- }
-
- if (bContainerHeightAutoSize) {
- componentSize.height = fContentCalculatedHeight;
- if (pMarginNode) {
- if (pMarginNode->TryMeasure(XFA_ATTRIBUTE_TopInset, mTmpValue, false))
- componentSize.height += mTmpValue.ToUnit(XFA_UNIT_Pt);
- if (pMarginNode->TryMeasure(XFA_ATTRIBUTE_BottomInset, mTmpValue,
- false)) {
- componentSize.height += mTmpValue.ToUnit(XFA_UNIT_Pt);
- }
- }
- }
- return componentSize;
-}
-
-void RelocateTableRowCells(
- CXFA_ContentLayoutItem* pLayoutRow,
- const CFX_ArrayTemplate<FX_FLOAT>& rgSpecifiedColumnWidths,
- XFA_ATTRIBUTEENUM eLayout) {
- bool bContainerWidthAutoSize = true;
- bool bContainerHeightAutoSize = true;
- CFX_SizeF containerSize = CalculateContainerSpecifiedSize(
- pLayoutRow->m_pFormNode, &bContainerWidthAutoSize,
- &bContainerHeightAutoSize);
- CXFA_Node* pMarginNode =
- pLayoutRow->m_pFormNode->GetFirstChildByClass(XFA_Element::Margin);
- FX_FLOAT fLeftInset = 0;
- FX_FLOAT fTopInset = 0;
- FX_FLOAT fRightInset = 0;
- FX_FLOAT fBottomInset = 0;
- if (pMarginNode) {
- fLeftInset =
- pMarginNode->GetMeasure(XFA_ATTRIBUTE_LeftInset).ToUnit(XFA_UNIT_Pt);
- fTopInset =
- pMarginNode->GetMeasure(XFA_ATTRIBUTE_TopInset).ToUnit(XFA_UNIT_Pt);
- fRightInset =
- pMarginNode->GetMeasure(XFA_ATTRIBUTE_RightInset).ToUnit(XFA_UNIT_Pt);
- fBottomInset =
- pMarginNode->GetMeasure(XFA_ATTRIBUTE_BottomInset).ToUnit(XFA_UNIT_Pt);
- }
-
- FX_FLOAT fContentWidthLimit =
- bContainerWidthAutoSize ? FLT_MAX
- : containerSize.width - fLeftInset - fRightInset;
- FX_FLOAT fContentCurrentHeight =
- pLayoutRow->m_sSize.height - fTopInset - fBottomInset;
- FX_FLOAT fContentCalculatedWidth = 0;
- FX_FLOAT fContentCalculatedHeight = 0;
- FX_FLOAT fCurrentColX = 0;
- int32_t nCurrentColIdx = 0;
- bool bMetWholeRowCell = false;
-
- for (auto pLayoutChild =
- static_cast<CXFA_ContentLayoutItem*>(pLayoutRow->m_pFirstChild);
- pLayoutChild; pLayoutChild = static_cast<CXFA_ContentLayoutItem*>(
- pLayoutChild->m_pNextSibling)) {
- int32_t nOriginalColSpan =
- pLayoutChild->m_pFormNode->GetInteger(XFA_ATTRIBUTE_ColSpan);
- int32_t nColSpan = nOriginalColSpan;
- FX_FLOAT fColSpanWidth = 0;
- if (nColSpan == -1 ||
- nCurrentColIdx + nColSpan > rgSpecifiedColumnWidths.GetSize()) {
- nColSpan = rgSpecifiedColumnWidths.GetSize() - nCurrentColIdx;
- }
- for (int32_t i = 0; i < nColSpan; i++)
- fColSpanWidth += rgSpecifiedColumnWidths[nCurrentColIdx + i];
-
- if (nColSpan != nOriginalColSpan) {
- fColSpanWidth =
- bMetWholeRowCell ? 0 : std::max(fColSpanWidth,
- pLayoutChild->m_sSize.height);
- }
- if (nOriginalColSpan == -1)
- bMetWholeRowCell = true;
-
- pLayoutChild->m_sPos = CFX_PointF(fCurrentColX, 0);
- pLayoutChild->m_sSize.width = fColSpanWidth;
- if (!XFA_ItemLayoutProcessor_IsTakingSpace(pLayoutChild->m_pFormNode))
- continue;
-
- fCurrentColX += fColSpanWidth;
- nCurrentColIdx += nColSpan;
- FX_FLOAT fNewHeight = bContainerHeightAutoSize ? -1 : fContentCurrentHeight;
- UpdateWidgetSize(pLayoutChild, &fColSpanWidth, &fNewHeight);
- pLayoutChild->m_sSize.height = fNewHeight;
- if (bContainerHeightAutoSize) {
- fContentCalculatedHeight =
- std::max(fContentCalculatedHeight, pLayoutChild->m_sSize.height);
- }
- }
-
- if (bContainerHeightAutoSize) {
- for (CXFA_ContentLayoutItem* pLayoutChild =
- (CXFA_ContentLayoutItem*)pLayoutRow->m_pFirstChild;
- pLayoutChild;
- pLayoutChild = (CXFA_ContentLayoutItem*)pLayoutChild->m_pNextSibling) {
- UpdateWidgetSize(pLayoutChild, &pLayoutChild->m_sSize.width,
- &fContentCalculatedHeight);
- FX_FLOAT fOldChildHeight = pLayoutChild->m_sSize.height;
- pLayoutChild->m_sSize.height = fContentCalculatedHeight;
- CXFA_Node* pParaNode =
- pLayoutChild->m_pFormNode->GetFirstChildByClass(XFA_Element::Para);
- if (pParaNode && pLayoutChild->m_pFirstChild) {
- FX_FLOAT fOffHeight = fContentCalculatedHeight - fOldChildHeight;
- XFA_ATTRIBUTEENUM eVType = pParaNode->GetEnum(XFA_ATTRIBUTE_VAlign);
- switch (eVType) {
- case XFA_ATTRIBUTEENUM_Middle:
- fOffHeight = fOffHeight / 2;
- break;
- case XFA_ATTRIBUTEENUM_Bottom:
- break;
- case XFA_ATTRIBUTEENUM_Top:
- default:
- fOffHeight = 0;
- break;
- }
- if (fOffHeight > 0) {
- for (CXFA_ContentLayoutItem* pInnerLayoutChild =
- (CXFA_ContentLayoutItem*)pLayoutChild->m_pFirstChild;
- pInnerLayoutChild;
- pInnerLayoutChild =
- (CXFA_ContentLayoutItem*)pInnerLayoutChild->m_pNextSibling) {
- pInnerLayoutChild->m_sPos.y += fOffHeight;
- }
- }
- }
- }
- }
-
- if (bContainerWidthAutoSize) {
- FX_FLOAT fChildSuppliedWidth = fCurrentColX;
- if (fContentWidthLimit < FLT_MAX &&
- fContentWidthLimit > fChildSuppliedWidth) {
- fChildSuppliedWidth = fContentWidthLimit;
- }
- fContentCalculatedWidth =
- std::max(fContentCalculatedWidth, fChildSuppliedWidth);
- } else {
- fContentCalculatedWidth = containerSize.width - fLeftInset - fRightInset;
- }
-
- if (pLayoutRow->m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout) ==
- XFA_ATTRIBUTEENUM_Rl_row) {
- for (CXFA_ContentLayoutItem* pLayoutChild =
- (CXFA_ContentLayoutItem*)pLayoutRow->m_pFirstChild;
- pLayoutChild;
- pLayoutChild = (CXFA_ContentLayoutItem*)pLayoutChild->m_pNextSibling) {
- pLayoutChild->m_sPos.x = fContentCalculatedWidth -
- pLayoutChild->m_sPos.x -
- pLayoutChild->m_sSize.width;
- }
- }
- pLayoutRow->m_sSize = CalculateContainerComponentSizeFromContentSize(
- pLayoutRow->m_pFormNode, bContainerWidthAutoSize, fContentCalculatedWidth,
- bContainerHeightAutoSize, fContentCalculatedHeight, containerSize);
-}
-
-void UpdatePendingItemLayout(CXFA_ItemLayoutProcessor* pProcessor,
- CXFA_ContentLayoutItem* pLayoutItem) {
- XFA_ATTRIBUTEENUM eLayout =
- pLayoutItem->m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout);
- switch (eLayout) {
- case XFA_ATTRIBUTEENUM_Row:
- case XFA_ATTRIBUTEENUM_Rl_row:
- RelocateTableRowCells(pLayoutItem, pProcessor->m_rgSpecifiedColumnWidths,
- eLayout);
- break;
- default:
- break;
- }
-}
-
-void AddTrailerBeforeSplit(CXFA_ItemLayoutProcessor* pProcessor,
- FX_FLOAT fSplitPos,
- CXFA_ContentLayoutItem* pTrailerLayoutItem,
- bool bUseInherited) {
- if (!pTrailerLayoutItem)
- return;
-
- FX_FLOAT fHeight = pTrailerLayoutItem->m_sSize.height;
- if (bUseInherited) {
- FX_FLOAT fNewSplitPos = 0;
- if (fSplitPos - fHeight > XFA_LAYOUT_FLOAT_PERCISION)
- fNewSplitPos = pProcessor->FindSplitPos(fSplitPos - fHeight);
- if (fNewSplitPos > XFA_LAYOUT_FLOAT_PERCISION)
- pProcessor->SplitLayoutItem(fNewSplitPos);
- return;
- }
-
- UpdatePendingItemLayout(pProcessor, pTrailerLayoutItem);
- CXFA_Node* pMarginNode =
- pProcessor->m_pFormNode->GetFirstChildByClass(XFA_Element::Margin);
- FX_FLOAT fLeftInset = 0;
- FX_FLOAT fTopInset = 0;
- FX_FLOAT fRightInset = 0;
- FX_FLOAT fBottomInset = 0;
- if (pMarginNode) {
- fLeftInset =
- pMarginNode->GetMeasure(XFA_ATTRIBUTE_LeftInset).ToUnit(XFA_UNIT_Pt);
- fTopInset =
- pMarginNode->GetMeasure(XFA_ATTRIBUTE_TopInset).ToUnit(XFA_UNIT_Pt);
- fRightInset =
- pMarginNode->GetMeasure(XFA_ATTRIBUTE_RightInset).ToUnit(XFA_UNIT_Pt);
- fBottomInset =
- pMarginNode->GetMeasure(XFA_ATTRIBUTE_BottomInset).ToUnit(XFA_UNIT_Pt);
- }
-
- if (!pProcessor->IsAddNewRowForTrailer(pTrailerLayoutItem)) {
- pTrailerLayoutItem->m_sPos.y = pProcessor->m_fLastRowY;
- pTrailerLayoutItem->m_sPos.x = pProcessor->m_fLastRowWidth;
- pProcessor->m_pLayoutItem->m_sSize.width +=
- pTrailerLayoutItem->m_sSize.width;
- pProcessor->m_pLayoutItem->AddChild(pTrailerLayoutItem);
- return;
- }
-
- FX_FLOAT fNewSplitPos = 0;
- if (fSplitPos - fHeight > XFA_LAYOUT_FLOAT_PERCISION)
- fNewSplitPos = pProcessor->FindSplitPos(fSplitPos - fHeight);
-
- if (fNewSplitPos > XFA_LAYOUT_FLOAT_PERCISION) {
- pProcessor->SplitLayoutItem(fNewSplitPos);
- pTrailerLayoutItem->m_sPos.y = fNewSplitPos - fTopInset - fBottomInset;
- } else {
- pTrailerLayoutItem->m_sPos.y = fSplitPos - fTopInset - fBottomInset;
- }
-
- switch (pTrailerLayoutItem->m_pFormNode->GetEnum(XFA_ATTRIBUTE_HAlign)) {
- case XFA_ATTRIBUTEENUM_Right:
- pTrailerLayoutItem->m_sPos.x = pProcessor->m_pLayoutItem->m_sSize.width -
- fRightInset -
- pTrailerLayoutItem->m_sSize.width;
- break;
- case XFA_ATTRIBUTEENUM_Center:
- pTrailerLayoutItem->m_sPos.x =
- (pProcessor->m_pLayoutItem->m_sSize.width - fLeftInset - fRightInset -
- pTrailerLayoutItem->m_sSize.width) /
- 2;
- break;
- case XFA_ATTRIBUTEENUM_Left:
- default:
- pTrailerLayoutItem->m_sPos.x = fLeftInset;
- break;
- }
- pProcessor->m_pLayoutItem->m_sSize.height += fHeight;
- pProcessor->m_pLayoutItem->AddChild(pTrailerLayoutItem);
-}
-
-void AddLeaderAfterSplit(CXFA_ItemLayoutProcessor* pProcessor,
- CXFA_ContentLayoutItem* pLeaderLayoutItem) {
- UpdatePendingItemLayout(pProcessor, pLeaderLayoutItem);
-
- CXFA_Node* pMarginNode =
- pProcessor->m_pFormNode->GetFirstChildByClass(XFA_Element::Margin);
- FX_FLOAT fLeftInset = 0;
- FX_FLOAT fRightInset = 0;
- if (pMarginNode) {
- fLeftInset =
- pMarginNode->GetMeasure(XFA_ATTRIBUTE_LeftInset).ToUnit(XFA_UNIT_Pt);
- fRightInset =
- pMarginNode->GetMeasure(XFA_ATTRIBUTE_RightInset).ToUnit(XFA_UNIT_Pt);
- }
-
- FX_FLOAT fHeight = pLeaderLayoutItem->m_sSize.height;
- for (CXFA_ContentLayoutItem* pChildItem =
- (CXFA_ContentLayoutItem*)pProcessor->m_pLayoutItem->m_pFirstChild;
- pChildItem;
- pChildItem = (CXFA_ContentLayoutItem*)pChildItem->m_pNextSibling) {
- pChildItem->m_sPos.y += fHeight;
- }
- pLeaderLayoutItem->m_sPos.y = 0;
-
- switch (pLeaderLayoutItem->m_pFormNode->GetEnum(XFA_ATTRIBUTE_HAlign)) {
- case XFA_ATTRIBUTEENUM_Right:
- pLeaderLayoutItem->m_sPos.x = pProcessor->m_pLayoutItem->m_sSize.width -
- fRightInset -
- pLeaderLayoutItem->m_sSize.width;
- break;
- case XFA_ATTRIBUTEENUM_Center:
- pLeaderLayoutItem->m_sPos.x =
- (pProcessor->m_pLayoutItem->m_sSize.width - fLeftInset - fRightInset -
- pLeaderLayoutItem->m_sSize.width) /
- 2;
- break;
- case XFA_ATTRIBUTEENUM_Left:
- default:
- pLeaderLayoutItem->m_sPos.x = fLeftInset;
- break;
- }
- pProcessor->m_pLayoutItem->m_sSize.height += fHeight;
- pProcessor->m_pLayoutItem->AddChild(pLeaderLayoutItem);
-}
-
-void AddPendingNode(CXFA_ItemLayoutProcessor* pProcessor,
- CXFA_Node* pPendingNode,
- bool bBreakPending) {
- pProcessor->m_PendingNodes.push_back(pPendingNode);
- pProcessor->m_bBreakPending = bBreakPending;
-}
-
-FX_FLOAT InsertPendingItems(CXFA_ItemLayoutProcessor* pProcessor,
- CXFA_Node* pCurChildNode) {
- FX_FLOAT fTotalHeight = 0;
- if (pProcessor->m_PendingNodes.empty())
- return fTotalHeight;
-
- if (!pProcessor->m_pLayoutItem) {
- pProcessor->m_pLayoutItem =
- pProcessor->CreateContentLayoutItem(pCurChildNode);
- pProcessor->m_pLayoutItem->m_sSize.clear();
- }
-
- while (!pProcessor->m_PendingNodes.empty()) {
- auto pPendingProcessor = pdfium::MakeUnique<CXFA_ItemLayoutProcessor>(
- pProcessor->m_PendingNodes.front(), nullptr);
- pProcessor->m_PendingNodes.pop_front();
- pPendingProcessor->DoLayout(false, FLT_MAX, FLT_MAX, nullptr);
- CXFA_ContentLayoutItem* pPendingLayoutItem =
- pPendingProcessor->HasLayoutItem()
- ? pPendingProcessor->ExtractLayoutItem()
- : nullptr;
- if (pPendingLayoutItem) {
- AddLeaderAfterSplit(pProcessor, pPendingLayoutItem);
- if (pProcessor->m_bBreakPending)
- fTotalHeight += pPendingLayoutItem->m_sSize.height;
- }
- }
- return fTotalHeight;
-}
-
-XFA_ATTRIBUTEENUM GetLayout(CXFA_Node* pFormNode, bool* bRootForceTb) {
- *bRootForceTb = false;
- XFA_ATTRIBUTEENUM eLayoutMode;
- if (pFormNode->TryEnum(XFA_ATTRIBUTE_Layout, eLayoutMode, false))
- return eLayoutMode;
-
- CXFA_Node* pParentNode = pFormNode->GetNodeItem(XFA_NODEITEM_Parent);
- if (pParentNode && pParentNode->GetElementType() == XFA_Element::Form) {
- *bRootForceTb = true;
- return XFA_ATTRIBUTEENUM_Tb;
- }
- return XFA_ATTRIBUTEENUM_Position;
-}
-
-bool ExistContainerKeep(CXFA_Node* pCurNode, bool bPreFind) {
- if (!pCurNode || !XFA_ItemLayoutProcessor_IsTakingSpace(pCurNode))
- return false;
-
- XFA_NODEITEM eItemType = XFA_NODEITEM_PrevSibling;
- if (!bPreFind)
- eItemType = XFA_NODEITEM_NextSibling;
-
- CXFA_Node* pPreContainer =
- pCurNode->GetNodeItem(eItemType, XFA_ObjectType::ContainerNode);
- if (!pPreContainer)
- return false;
-
- CXFA_Node* pKeep = pCurNode->GetFirstChildByClass(XFA_Element::Keep);
- if (pKeep) {
- XFA_ATTRIBUTEENUM ePrevious;
- XFA_ATTRIBUTE eKeepType = XFA_ATTRIBUTE_Previous;
- if (!bPreFind)
- eKeepType = XFA_ATTRIBUTE_Next;
-
- if (pKeep->TryEnum(eKeepType, ePrevious, false)) {
- if (ePrevious == XFA_ATTRIBUTEENUM_ContentArea ||
- ePrevious == XFA_ATTRIBUTEENUM_PageArea) {
- return true;
- }
- }
- }
-
- pKeep = pPreContainer->GetFirstChildByClass(XFA_Element::Keep);
- if (!pKeep)
- return false;
-
- XFA_ATTRIBUTE eKeepType = XFA_ATTRIBUTE_Next;
- if (!bPreFind)
- eKeepType = XFA_ATTRIBUTE_Previous;
-
- XFA_ATTRIBUTEENUM eNext;
- if (!pKeep->TryEnum(eKeepType, eNext, false))
- return false;
- if (eNext == XFA_ATTRIBUTEENUM_ContentArea ||
- eNext == XFA_ATTRIBUTEENUM_PageArea) {
- return true;
- }
- return false;
-}
-
-bool FindBreakNode(CXFA_Node* pContainerNode,
- CXFA_Node*& pCurActionNode,
- XFA_ItemLayoutProcessorStages* nCurStage,
- bool bBreakBefore) {
- bool bFindRs = false;
- for (CXFA_Node* pBreakNode = pContainerNode; pBreakNode;
- pBreakNode = pBreakNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
- XFA_ATTRIBUTE eAttributeType = XFA_ATTRIBUTE_Before;
- if (!bBreakBefore)
- eAttributeType = XFA_ATTRIBUTE_After;
-
- switch (pBreakNode->GetElementType()) {
- case XFA_Element::BreakBefore: {
- if (bBreakBefore) {
- pCurActionNode = pBreakNode;
- *nCurStage = XFA_ItemLayoutProcessorStages::BreakBefore;
- bFindRs = true;
- }
- break;
- }
- case XFA_Element::BreakAfter: {
- if (!bBreakBefore) {
- pCurActionNode = pBreakNode;
- *nCurStage = XFA_ItemLayoutProcessorStages::BreakAfter;
- bFindRs = true;
- }
- break;
- }
- case XFA_Element::Break:
- if (pBreakNode->GetEnum(eAttributeType) != XFA_ATTRIBUTEENUM_Auto) {
- pCurActionNode = pBreakNode;
- *nCurStage = XFA_ItemLayoutProcessorStages::BreakBefore;
- if (!bBreakBefore)
- *nCurStage = XFA_ItemLayoutProcessorStages::BreakAfter;
-
- bFindRs = true;
- }
- break;
- default:
- break;
- }
- if (bFindRs)
- break;
- }
- return bFindRs;
-}
-
-void DeleteLayoutGeneratedNode(CXFA_Node* pGenerateNode) {
- CXFA_FFNotify* pNotify = pGenerateNode->GetDocument()->GetNotify();
- CXFA_LayoutProcessor* pDocLayout =
- pGenerateNode->GetDocument()->GetDocLayout();
- CXFA_NodeIteratorTemplate<CXFA_Node, CXFA_TraverseStrategy_XFANode> sIterator(
- pGenerateNode);
- for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode;
- pNode = sIterator.MoveToNext()) {
- CXFA_ContentLayoutItem* pCurLayoutItem =
- (CXFA_ContentLayoutItem*)pNode->GetUserData(XFA_LAYOUTITEMKEY);
- CXFA_ContentLayoutItem* pNextLayoutItem = nullptr;
- while (pCurLayoutItem) {
- pNextLayoutItem = pCurLayoutItem->m_pNext;
- pNotify->OnLayoutItemRemoving(pDocLayout, pCurLayoutItem);
- delete pCurLayoutItem;
- pCurLayoutItem = pNextLayoutItem;
- }
- }
- pGenerateNode->GetNodeItem(XFA_NODEITEM_Parent)->RemoveChild(pGenerateNode);
-}
-
-uint8_t HAlignEnumToInt(XFA_ATTRIBUTEENUM eHAlign) {
- switch (eHAlign) {
- case XFA_ATTRIBUTEENUM_Center:
- return 1;
- case XFA_ATTRIBUTEENUM_Right:
- return 2;
- case XFA_ATTRIBUTEENUM_Left:
- default:
- return 0;
- }
-}
-
-XFA_ItemLayoutProcessorResult InsertFlowedItem(
- CXFA_ItemLayoutProcessor* pThis,
- CXFA_ItemLayoutProcessor* pProcessor,
- bool bContainerWidthAutoSize,
- bool bContainerHeightAutoSize,
- FX_FLOAT fContainerHeight,
- XFA_ATTRIBUTEENUM eFlowStrategy,
- uint8_t* uCurHAlignState,
- CFX_ArrayTemplate<CXFA_ContentLayoutItem*> (&rgCurLineLayoutItems)[3],
- bool bUseBreakControl,
- FX_FLOAT fAvailHeight,
- FX_FLOAT fRealHeight,
- FX_FLOAT fContentWidthLimit,
- FX_FLOAT* fContentCurRowY,
- FX_FLOAT* fContentCurRowAvailWidth,
- FX_FLOAT* fContentCurRowHeight,
- bool* bAddedItemInRow,
- bool* bForceEndPage,
- CXFA_LayoutContext* pLayoutContext,
- bool bNewRow) {
- bool bTakeSpace =
- XFA_ItemLayoutProcessor_IsTakingSpace(pProcessor->m_pFormNode);
- uint8_t uHAlign =
- HAlignEnumToInt(pThis->m_pCurChildNode->GetEnum(XFA_ATTRIBUTE_HAlign));
- if (bContainerWidthAutoSize)
- uHAlign = 0;
-
- if ((eFlowStrategy != XFA_ATTRIBUTEENUM_Rl_tb &&
- uHAlign < *uCurHAlignState) ||
- (eFlowStrategy == XFA_ATTRIBUTEENUM_Rl_tb &&
- uHAlign > *uCurHAlignState)) {
- return XFA_ItemLayoutProcessorResult::RowFullBreak;
- }
-
- *uCurHAlignState = uHAlign;
- bool bIsOwnSplit =
- pProcessor->m_pFormNode->GetIntact() == XFA_ATTRIBUTEENUM_None;
- bool bUseRealHeight =
- bTakeSpace && bContainerHeightAutoSize && bIsOwnSplit &&
- pProcessor->m_pFormNode->GetNodeItem(XFA_NODEITEM_Parent)->GetIntact() ==
- XFA_ATTRIBUTEENUM_None;
- bool bIsTransHeight = bTakeSpace;
- if (bIsTransHeight && !bIsOwnSplit) {
- bool bRootForceTb = false;
- XFA_ATTRIBUTEENUM eLayoutStrategy =
- GetLayout(pProcessor->m_pFormNode, &bRootForceTb);
- if (eLayoutStrategy == XFA_ATTRIBUTEENUM_Lr_tb ||
- eLayoutStrategy == XFA_ATTRIBUTEENUM_Rl_tb) {
- bIsTransHeight = false;
- }
- }
-
- bool bUseInherited = false;
- CXFA_LayoutContext layoutContext;
- if (pThis->m_pPageMgr) {
- CXFA_Node* pOverflowNode =
- pThis->m_pPageMgr->QueryOverflow(pThis->m_pFormNode);
- if (pOverflowNode) {
- layoutContext.m_pOverflowNode = pOverflowNode;
- layoutContext.m_pOverflowProcessor = pThis;
- pLayoutContext = &layoutContext;
- }
- }
-
- XFA_ItemLayoutProcessorResult eRetValue = XFA_ItemLayoutProcessorResult::Done;
- if (!bNewRow ||
- pProcessor->m_ePreProcessRs == XFA_ItemLayoutProcessorResult::Done) {
- eRetValue = pProcessor->DoLayout(
- bTakeSpace ? bUseBreakControl : false,
- bUseRealHeight ? fRealHeight - *fContentCurRowY : FLT_MAX,
- bIsTransHeight ? fRealHeight - *fContentCurRowY : FLT_MAX,
- pLayoutContext);
- pProcessor->m_ePreProcessRs = eRetValue;
- } else {
- eRetValue = pProcessor->m_ePreProcessRs;
- pProcessor->m_ePreProcessRs = XFA_ItemLayoutProcessorResult::Done;
- }
- if (pProcessor->HasLayoutItem() == false)
- return eRetValue;
-
- CFX_SizeF childSize = pProcessor->GetCurrentComponentSize();
- if (bUseRealHeight && fRealHeight < XFA_LAYOUT_FLOAT_PERCISION) {
- fRealHeight = FLT_MAX;
- fAvailHeight = FLT_MAX;
- }
- if (bTakeSpace && (childSize.width >
- *fContentCurRowAvailWidth + XFA_LAYOUT_FLOAT_PERCISION) &&
- (fContentWidthLimit - *fContentCurRowAvailWidth >
- XFA_LAYOUT_FLOAT_PERCISION)) {
- return XFA_ItemLayoutProcessorResult::RowFullBreak;
- }
-
- CXFA_Node* pOverflowLeaderNode = nullptr;
- CXFA_Node* pOverflowTrailerNode = nullptr;
- CXFA_Node* pFormNode = nullptr;
- CXFA_ContentLayoutItem* pTrailerLayoutItem = nullptr;
- bool bIsAddTrailerHeight = false;
- if (pThis->m_pPageMgr &&
- pProcessor->m_pFormNode->GetIntact() == XFA_ATTRIBUTEENUM_None) {
- pFormNode = pThis->m_pPageMgr->QueryOverflow(pProcessor->m_pFormNode);
- if (!pFormNode && pLayoutContext && pLayoutContext->m_pOverflowProcessor) {
- pFormNode = pLayoutContext->m_pOverflowNode;
- bUseInherited = true;
- }
- if (pThis->m_pPageMgr->ProcessOverflow(pFormNode, pOverflowLeaderNode,
- pOverflowTrailerNode, false,
- false)) {
- if (pProcessor->JudgeLeaderOrTrailerForOccur(pOverflowTrailerNode)) {
- if (pOverflowTrailerNode) {
- auto pOverflowLeaderProcessor =
- pdfium::MakeUnique<CXFA_ItemLayoutProcessor>(pOverflowTrailerNode,
- nullptr);
- pOverflowLeaderProcessor->DoLayout(false, FLT_MAX, FLT_MAX, nullptr);
- pTrailerLayoutItem =
- pOverflowLeaderProcessor->HasLayoutItem()
- ? pOverflowLeaderProcessor->ExtractLayoutItem()
- : nullptr;
- }
-
- bIsAddTrailerHeight =
- bUseInherited
- ? pThis->IsAddNewRowForTrailer(pTrailerLayoutItem)
- : pProcessor->IsAddNewRowForTrailer(pTrailerLayoutItem);
- if (bIsAddTrailerHeight) {
- childSize.height += pTrailerLayoutItem->m_sSize.height;
- bIsAddTrailerHeight = true;
- }
- }
- }
- }
-
- if (!bTakeSpace ||
- *fContentCurRowY + childSize.height <=
- fAvailHeight + XFA_LAYOUT_FLOAT_PERCISION ||
- (!bContainerHeightAutoSize &&
- pThis->m_fUsedSize + fAvailHeight + XFA_LAYOUT_FLOAT_PERCISION >=
- fContainerHeight)) {
- if (!bTakeSpace || eRetValue == XFA_ItemLayoutProcessorResult::Done) {
- if (pProcessor->m_bUseInheriated) {
- if (pTrailerLayoutItem)
- AddTrailerBeforeSplit(pProcessor, childSize.height,
- pTrailerLayoutItem, false);
- if (pProcessor->JudgeLeaderOrTrailerForOccur(pOverflowLeaderNode))
- AddPendingNode(pProcessor, pOverflowLeaderNode, false);
-
- pProcessor->m_bUseInheriated = false;
- } else {
- if (bIsAddTrailerHeight)
- childSize.height -= pTrailerLayoutItem->m_sSize.height;
-
- pProcessor->ProcessUnUseOverFlow(pOverflowLeaderNode,
- pOverflowTrailerNode,
- pTrailerLayoutItem, pFormNode);
- }
-
- CXFA_ContentLayoutItem* pChildLayoutItem =
- pProcessor->ExtractLayoutItem();
- if (ExistContainerKeep(pProcessor->m_pFormNode, false) &&
- pProcessor->m_pFormNode->GetIntact() == XFA_ATTRIBUTEENUM_None) {
- pThis->m_arrayKeepItems.push_back(pChildLayoutItem);
- } else {
- pThis->m_arrayKeepItems.clear();
- }
- rgCurLineLayoutItems[uHAlign].Add(pChildLayoutItem);
- *bAddedItemInRow = true;
- if (bTakeSpace) {
- *fContentCurRowAvailWidth -= childSize.width;
- *fContentCurRowHeight =
- std::max(*fContentCurRowHeight, childSize.height);
- }
- return XFA_ItemLayoutProcessorResult::Done;
- }
-
- if (eRetValue == XFA_ItemLayoutProcessorResult::PageFullBreak) {
- if (pProcessor->m_bUseInheriated) {
- if (pTrailerLayoutItem) {
- AddTrailerBeforeSplit(pProcessor, childSize.height,
- pTrailerLayoutItem, false);
- }
- if (pProcessor->JudgeLeaderOrTrailerForOccur(pOverflowLeaderNode))
- AddPendingNode(pProcessor, pOverflowLeaderNode, false);
-
- pProcessor->m_bUseInheriated = false;
- } else {
- if (bIsAddTrailerHeight)
- childSize.height -= pTrailerLayoutItem->m_sSize.height;
-
- pProcessor->ProcessUnUseOverFlow(pOverflowLeaderNode,
- pOverflowTrailerNode,
- pTrailerLayoutItem, pFormNode);
- }
- }
- rgCurLineLayoutItems[uHAlign].Add(pProcessor->ExtractLayoutItem());
- *bAddedItemInRow = true;
- *fContentCurRowAvailWidth -= childSize.width;
- *fContentCurRowHeight = std::max(*fContentCurRowHeight, childSize.height);
- return eRetValue;
- }
-
- XFA_ItemLayoutProcessorResult eResult;
- if (pThis->ProcessKeepForSplit(
- pThis, pProcessor, eRetValue, &rgCurLineLayoutItems[uHAlign],
- fContentCurRowAvailWidth, fContentCurRowHeight, fContentCurRowY,
- bAddedItemInRow, bForceEndPage, &eResult)) {
- return eResult;
- }
-
- *bForceEndPage = true;
- FX_FLOAT fSplitPos =
- pProcessor->FindSplitPos(fAvailHeight - *fContentCurRowY);
- if (fSplitPos > XFA_LAYOUT_FLOAT_PERCISION) {
- XFA_ATTRIBUTEENUM eLayout =
- pProcessor->m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout);
- if (eLayout == XFA_ATTRIBUTEENUM_Tb &&
- eRetValue == XFA_ItemLayoutProcessorResult::Done) {
- pProcessor->ProcessUnUseOverFlow(pOverflowLeaderNode,
- pOverflowTrailerNode, pTrailerLayoutItem,
- pFormNode);
- rgCurLineLayoutItems[uHAlign].Add(pProcessor->ExtractLayoutItem());
- *bAddedItemInRow = true;
- if (bTakeSpace) {
- *fContentCurRowAvailWidth -= childSize.width;
- *fContentCurRowHeight =
- std::max(*fContentCurRowHeight, childSize.height);
- }
- return XFA_ItemLayoutProcessorResult::PageFullBreak;
- }
-
- CXFA_Node* pTempLeaderNode = nullptr;
- CXFA_Node* pTempTrailerNode = nullptr;
- if (pThis->m_pPageMgr && !pProcessor->m_bUseInheriated &&
- eRetValue != XFA_ItemLayoutProcessorResult::PageFullBreak) {
- pThis->m_pPageMgr->ProcessOverflow(pFormNode, pTempLeaderNode,
- pTempTrailerNode, false, true);
- }
- if (pTrailerLayoutItem && bIsAddTrailerHeight) {
- AddTrailerBeforeSplit(pProcessor, fSplitPos, pTrailerLayoutItem,
- bUseInherited);
- } else {
- pProcessor->SplitLayoutItem(fSplitPos);
- }
-
- if (bUseInherited) {
- pProcessor->ProcessUnUseOverFlow(pOverflowLeaderNode,
- pOverflowTrailerNode, pTrailerLayoutItem,
- pFormNode);
- pThis->m_bUseInheriated = true;
- } else {
- CXFA_LayoutItem* firstChild = pProcessor->m_pLayoutItem->m_pFirstChild;
- if (firstChild && !firstChild->m_pNextSibling &&
- firstChild->m_pFormNode->IsLayoutGeneratedNode()) {
- pProcessor->ProcessUnUseOverFlow(pOverflowLeaderNode,
- pOverflowTrailerNode,
- pTrailerLayoutItem, pFormNode);
- } else if (pProcessor->JudgeLeaderOrTrailerForOccur(
- pOverflowLeaderNode)) {
- AddPendingNode(pProcessor, pOverflowLeaderNode, false);
- }
- }
-
- if (pProcessor->m_pLayoutItem->m_pNextSibling) {
- childSize = pProcessor->GetCurrentComponentSize();
- rgCurLineLayoutItems[uHAlign].Add(pProcessor->ExtractLayoutItem());
- *bAddedItemInRow = true;
- if (bTakeSpace) {
- *fContentCurRowAvailWidth -= childSize.width;
- *fContentCurRowHeight =
- std::max(*fContentCurRowHeight, childSize.height);
- }
- }
- return XFA_ItemLayoutProcessorResult::PageFullBreak;
- }
-
- if (*fContentCurRowY <= XFA_LAYOUT_FLOAT_PERCISION) {
- childSize = pProcessor->GetCurrentComponentSize();
- if (pProcessor->m_pPageMgr->GetNextAvailContentHeight(childSize.height)) {
- CXFA_Node* pTempLeaderNode = nullptr;
- CXFA_Node* pTempTrailerNode = nullptr;
- if (pThis->m_pPageMgr) {
- if (!pFormNode && pLayoutContext)
- pFormNode = pLayoutContext->m_pOverflowProcessor->m_pFormNode;
-
- pThis->m_pPageMgr->ProcessOverflow(pFormNode, pTempLeaderNode,
- pTempTrailerNode, false, true);
- }
- if (bUseInherited) {
- pProcessor->ProcessUnUseOverFlow(pOverflowLeaderNode,
- pOverflowTrailerNode,
- pTrailerLayoutItem, pFormNode);
- pThis->m_bUseInheriated = true;
- }
- return XFA_ItemLayoutProcessorResult::PageFullBreak;
- }
-
- rgCurLineLayoutItems[uHAlign].Add(pProcessor->ExtractLayoutItem());
- *bAddedItemInRow = true;
- if (bTakeSpace) {
- *fContentCurRowAvailWidth -= childSize.width;
- *fContentCurRowHeight = std::max(*fContentCurRowHeight, childSize.height);
- }
- if (eRetValue == XFA_ItemLayoutProcessorResult::Done)
- *bForceEndPage = false;
-
- return eRetValue;
- }
-
- XFA_ATTRIBUTEENUM eLayout =
- pProcessor->m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout);
- if (pProcessor->m_pFormNode->GetIntact() == XFA_ATTRIBUTEENUM_None &&
- eLayout == XFA_ATTRIBUTEENUM_Tb) {
- if (pThis->m_pPageMgr) {
- pThis->m_pPageMgr->ProcessOverflow(pFormNode, pOverflowLeaderNode,
- pOverflowTrailerNode, false, true);
- }
- if (pTrailerLayoutItem)
- AddTrailerBeforeSplit(pProcessor, fSplitPos, pTrailerLayoutItem, false);
- if (pProcessor->JudgeLeaderOrTrailerForOccur(pOverflowLeaderNode))
- AddPendingNode(pProcessor, pOverflowLeaderNode, false);
-
- return XFA_ItemLayoutProcessorResult::PageFullBreak;
- }
-
- if (eRetValue != XFA_ItemLayoutProcessorResult::Done)
- return XFA_ItemLayoutProcessorResult::PageFullBreak;
-
- if (!pFormNode && pLayoutContext)
- pFormNode = pLayoutContext->m_pOverflowProcessor->m_pFormNode;
- if (pThis->m_pPageMgr) {
- pThis->m_pPageMgr->ProcessOverflow(pFormNode, pOverflowLeaderNode,
- pOverflowTrailerNode, false, true);
- }
- if (bUseInherited) {
- pProcessor->ProcessUnUseOverFlow(pOverflowLeaderNode, pOverflowTrailerNode,
- pTrailerLayoutItem, pFormNode);
- pThis->m_bUseInheriated = true;
- }
- return XFA_ItemLayoutProcessorResult::PageFullBreak;
-}
-
-bool FindLayoutItemSplitPos(CXFA_ContentLayoutItem* pLayoutItem,
- FX_FLOAT fCurVerticalOffset,
- FX_FLOAT* fProposedSplitPos,
- bool* bAppChange,
- bool bCalculateMargin) {
- CXFA_Node* pFormNode = pLayoutItem->m_pFormNode;
- if (*fProposedSplitPos <= fCurVerticalOffset + XFA_LAYOUT_FLOAT_PERCISION ||
- *fProposedSplitPos > fCurVerticalOffset + pLayoutItem->m_sSize.height -
- XFA_LAYOUT_FLOAT_PERCISION) {
- return false;
- }
-
- switch (pFormNode->GetIntact()) {
- case XFA_ATTRIBUTEENUM_None: {
- bool bAnyChanged = false;
- CXFA_Document* pDocument = pFormNode->GetDocument();
- CXFA_FFNotify* pNotify = pDocument->GetNotify();
- FX_FLOAT fCurTopMargin = 0, fCurBottomMargin = 0;
- CXFA_Node* pMarginNode =
- pFormNode->GetFirstChildByClass(XFA_Element::Margin);
- if (pMarginNode && bCalculateMargin) {
- fCurTopMargin =
- pMarginNode->GetMeasure(XFA_ATTRIBUTE_TopInset).ToUnit(XFA_UNIT_Pt);
- fCurBottomMargin = pMarginNode->GetMeasure(XFA_ATTRIBUTE_BottomInset)
- .ToUnit(XFA_UNIT_Pt);
- }
- bool bChanged = true;
- while (bChanged) {
- bChanged = false;
- {
- FX_FLOAT fRelSplitPos = *fProposedSplitPos - fCurVerticalOffset;
- if (pNotify->FindSplitPos(pFormNode, pLayoutItem->GetIndex(),
- fRelSplitPos)) {
- bAnyChanged = true;
- bChanged = true;
- *fProposedSplitPos = fCurVerticalOffset + fRelSplitPos;
- *bAppChange = true;
- if (*fProposedSplitPos <=
- fCurVerticalOffset + XFA_LAYOUT_FLOAT_PERCISION) {
- return true;
- }
- }
- }
- FX_FLOAT fRelSplitPos = *fProposedSplitPos - fCurBottomMargin;
- for (CXFA_ContentLayoutItem* pChildItem =
- (CXFA_ContentLayoutItem*)pLayoutItem->m_pFirstChild;
- pChildItem;
- pChildItem = (CXFA_ContentLayoutItem*)pChildItem->m_pNextSibling) {
- FX_FLOAT fChildOffset =
- fCurVerticalOffset + fCurTopMargin + pChildItem->m_sPos.y;
- bool bChange = false;
- if (FindLayoutItemSplitPos(pChildItem, fChildOffset, &fRelSplitPos,
- &bChange, bCalculateMargin)) {
- if (fRelSplitPos - fChildOffset < XFA_LAYOUT_FLOAT_PERCISION &&
- bChange) {
- *fProposedSplitPos = fRelSplitPos - fCurTopMargin;
- } else {
- *fProposedSplitPos = fRelSplitPos + fCurBottomMargin;
- }
- bAnyChanged = true;
- bChanged = true;
- if (*fProposedSplitPos <=
- fCurVerticalOffset + XFA_LAYOUT_FLOAT_PERCISION) {
- return true;
- }
- if (bAnyChanged)
- break;
- }
- }
- }
- return bAnyChanged;
- }
- case XFA_ATTRIBUTEENUM_ContentArea:
- case XFA_ATTRIBUTEENUM_PageArea: {
- *fProposedSplitPos = fCurVerticalOffset;
- return true;
- }
- default:
- return false;
- }
-}
-
-CFX_PointF CalculatePositionedContainerPos(CXFA_Node* pNode,
- const CFX_SizeF& size) {
- XFA_ATTRIBUTEENUM eAnchorType = pNode->GetEnum(XFA_ATTRIBUTE_AnchorType);
- int32_t nAnchorType = 0;
- switch (eAnchorType) {
- case XFA_ATTRIBUTEENUM_TopLeft:
- nAnchorType = 0;
- break;
- case XFA_ATTRIBUTEENUM_TopCenter:
- nAnchorType = 1;
- break;
- case XFA_ATTRIBUTEENUM_TopRight:
- nAnchorType = 2;
- break;
- case XFA_ATTRIBUTEENUM_MiddleLeft:
- nAnchorType = 3;
- break;
- case XFA_ATTRIBUTEENUM_MiddleCenter:
- nAnchorType = 4;
- break;
- case XFA_ATTRIBUTEENUM_MiddleRight:
- nAnchorType = 5;
- break;
- case XFA_ATTRIBUTEENUM_BottomLeft:
- nAnchorType = 6;
- break;
- case XFA_ATTRIBUTEENUM_BottomCenter:
- nAnchorType = 7;
- break;
- case XFA_ATTRIBUTEENUM_BottomRight:
- nAnchorType = 8;
- break;
- default:
- break;
- }
- static const uint8_t nNextPos[4][9] = {{0, 1, 2, 3, 4, 5, 6, 7, 8},
- {6, 3, 0, 7, 4, 1, 8, 5, 2},
- {8, 7, 6, 5, 4, 3, 2, 1, 0},
- {2, 5, 8, 1, 4, 7, 0, 3, 6}};
-
- CFX_PointF pos(pNode->GetMeasure(XFA_ATTRIBUTE_X).ToUnit(XFA_UNIT_Pt),
- pNode->GetMeasure(XFA_ATTRIBUTE_Y).ToUnit(XFA_UNIT_Pt));
- int32_t nRotate =
- FXSYS_round(pNode->GetMeasure(XFA_ATTRIBUTE_Rotate).GetValue());
- nRotate = XFA_MapRotation(nRotate) / 90;
- int32_t nAbsoluteAnchorType = nNextPos[nRotate][nAnchorType];
- switch (nAbsoluteAnchorType / 3) {
- case 1:
- pos.y -= size.height / 2;
- break;
- case 2:
- pos.y -= size.height;
- break;
- default:
- break;
- }
- switch (nAbsoluteAnchorType % 3) {
- case 1:
- pos.x -= size.width / 2;
- break;
- case 2:
- pos.x -= size.width;
- break;
- default:
- break;
- }
- return pos;
-}
-
-} // namespace
-
-CXFA_ItemLayoutProcessor::CXFA_ItemLayoutProcessor(CXFA_Node* pNode,
- CXFA_LayoutPageMgr* pPageMgr)
- : m_pFormNode(pNode),
- m_pLayoutItem(nullptr),
- m_pCurChildNode(XFA_LAYOUT_INVALIDNODE),
- m_fUsedSize(0),
- m_pPageMgr(pPageMgr),
- m_bBreakPending(true),
- m_fLastRowWidth(0),
- m_fLastRowY(0),
- m_bUseInheriated(false),
- m_ePreProcessRs(XFA_ItemLayoutProcessorResult::Done),
- m_bKeepBreakFinish(false),
- m_bIsProcessKeep(false),
- m_pKeepHeadNode(nullptr),
- m_pKeepTailNode(nullptr),
- m_pOldLayoutItem(nullptr),
- m_pCurChildPreprocessor(nullptr),
- m_nCurChildNodeStage(XFA_ItemLayoutProcessorStages::None),
- m_fWidthLimite(0),
- m_bHasAvailHeight(true) {
- ASSERT(m_pFormNode && (m_pFormNode->IsContainerNode() ||
- m_pFormNode->GetElementType() == XFA_Element::Form));
- m_pOldLayoutItem =
- (CXFA_ContentLayoutItem*)m_pFormNode->GetUserData(XFA_LAYOUTITEMKEY);
-}
-
-CXFA_ItemLayoutProcessor::~CXFA_ItemLayoutProcessor() {}
-
-CXFA_ContentLayoutItem* CXFA_ItemLayoutProcessor::CreateContentLayoutItem(
- CXFA_Node* pFormNode) {
- if (!pFormNode)
- return nullptr;
-
- CXFA_ContentLayoutItem* pLayoutItem = nullptr;
- if (m_pOldLayoutItem) {
- pLayoutItem = m_pOldLayoutItem;
- m_pOldLayoutItem = m_pOldLayoutItem->m_pNext;
- return pLayoutItem;
- }
- pLayoutItem = (CXFA_ContentLayoutItem*)pFormNode->GetDocument()
- ->GetNotify()
- ->OnCreateLayoutItem(pFormNode);
- CXFA_ContentLayoutItem* pPrevLayoutItem =
- (CXFA_ContentLayoutItem*)pFormNode->GetUserData(XFA_LAYOUTITEMKEY);
- if (pPrevLayoutItem) {
- while (pPrevLayoutItem->m_pNext)
- pPrevLayoutItem = pPrevLayoutItem->m_pNext;
-
- pPrevLayoutItem->m_pNext = pLayoutItem;
- pLayoutItem->m_pPrev = pPrevLayoutItem;
- } else {
- pFormNode->SetUserData(XFA_LAYOUTITEMKEY, pLayoutItem);
- }
- return pLayoutItem;
-}
-
-FX_FLOAT CXFA_ItemLayoutProcessor::FindSplitPos(FX_FLOAT fProposedSplitPos) {
- ASSERT(m_pLayoutItem);
- XFA_ATTRIBUTEENUM eLayout = m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout);
- bool bCalculateMargin = eLayout != XFA_ATTRIBUTEENUM_Position;
- while (fProposedSplitPos > XFA_LAYOUT_FLOAT_PERCISION) {
- bool bAppChange = false;
- if (!FindLayoutItemSplitPos(m_pLayoutItem, 0, &fProposedSplitPos,
- &bAppChange, bCalculateMargin)) {
- break;
- }
- }
- return fProposedSplitPos;
-}
-
-void CXFA_ItemLayoutProcessor::SplitLayoutItem(
- CXFA_ContentLayoutItem* pLayoutItem,
- CXFA_ContentLayoutItem* pSecondParent,
- FX_FLOAT fSplitPos) {
- FX_FLOAT fCurTopMargin = 0, fCurBottomMargin = 0;
- XFA_ATTRIBUTEENUM eLayout = m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout);
- bool bCalculateMargin = true;
- if (eLayout == XFA_ATTRIBUTEENUM_Position)
- bCalculateMargin = false;
-
- CXFA_Node* pMarginNode =
- pLayoutItem->m_pFormNode->GetFirstChildByClass(XFA_Element::Margin);
- if (pMarginNode && bCalculateMargin) {
- fCurTopMargin =
- pMarginNode->GetMeasure(XFA_ATTRIBUTE_TopInset).ToUnit(XFA_UNIT_Pt);
- fCurBottomMargin =
- pMarginNode->GetMeasure(XFA_ATTRIBUTE_BottomInset).ToUnit(XFA_UNIT_Pt);
- }
-
- CXFA_ContentLayoutItem* pSecondLayoutItem = nullptr;
- if (m_pCurChildPreprocessor &&
- m_pCurChildPreprocessor->m_pFormNode == pLayoutItem->m_pFormNode) {
- pSecondLayoutItem = m_pCurChildPreprocessor->CreateContentLayoutItem(
- pLayoutItem->m_pFormNode);
- } else {
- pSecondLayoutItem = CreateContentLayoutItem(pLayoutItem->m_pFormNode);
- }
- pSecondLayoutItem->m_sPos.x = pLayoutItem->m_sPos.x;
- pSecondLayoutItem->m_sSize.width = pLayoutItem->m_sSize.width;
- pSecondLayoutItem->m_sPos.y = 0;
- pSecondLayoutItem->m_sSize.height = pLayoutItem->m_sSize.height - fSplitPos;
- pLayoutItem->m_sSize.height -= pSecondLayoutItem->m_sSize.height;
- if (pLayoutItem->m_pFirstChild)
- pSecondLayoutItem->m_sSize.height += fCurTopMargin;
-
- if (pSecondParent) {
- pSecondParent->AddChild(pSecondLayoutItem);
- if (fCurTopMargin > 0 && pLayoutItem->m_pFirstChild) {
- pSecondParent->m_sSize.height += fCurTopMargin;
- CXFA_ContentLayoutItem* pParentItem =
- (CXFA_ContentLayoutItem*)pSecondParent->m_pParent;
- while (pParentItem) {
- pParentItem->m_sSize.height += fCurTopMargin;
- pParentItem = (CXFA_ContentLayoutItem*)pParentItem->m_pParent;
- }
- }
- } else {
- pSecondLayoutItem->m_pParent = pLayoutItem->m_pParent;
- pSecondLayoutItem->m_pNextSibling = pLayoutItem->m_pNextSibling;
- pLayoutItem->m_pNextSibling = pSecondLayoutItem;
- }
-
- CXFA_ContentLayoutItem* pChildren =
- (CXFA_ContentLayoutItem*)pLayoutItem->m_pFirstChild;
- pLayoutItem->m_pFirstChild = nullptr;
- FX_FLOAT lHeightForKeep = 0;
- CFX_ArrayTemplate<CXFA_ContentLayoutItem*> keepLayoutItems;
- FX_FLOAT fAddMarginHeight = 0;
- for (CXFA_ContentLayoutItem *pChildItem = pChildren, *pChildNext = nullptr;
- pChildItem; pChildItem = pChildNext) {
- pChildNext = (CXFA_ContentLayoutItem*)pChildItem->m_pNextSibling;
- pChildItem->m_pNextSibling = nullptr;
- if (fSplitPos <= fCurTopMargin + pChildItem->m_sPos.y + fCurBottomMargin +
- XFA_LAYOUT_FLOAT_PERCISION) {
- if (!ExistContainerKeep(pChildItem->m_pFormNode, true)) {
- pChildItem->m_sPos.y -= fSplitPos - fCurBottomMargin;
- pChildItem->m_sPos.y += lHeightForKeep;
- pChildItem->m_sPos.y += fAddMarginHeight;
- pSecondLayoutItem->AddChild(pChildItem);
- continue;
- }
-
- if (lHeightForKeep < XFA_LAYOUT_FLOAT_PERCISION) {
- for (int32_t iIndex = 0; iIndex < keepLayoutItems.GetSize(); iIndex++) {
- CXFA_ContentLayoutItem* pPreItem = keepLayoutItems[iIndex];
- pLayoutItem->RemoveChild(pPreItem);
- pPreItem->m_sPos.y -= fSplitPos;
- if (pPreItem->m_sPos.y < 0)
- pPreItem->m_sPos.y = 0;
-
- if (pPreItem->m_sPos.y + pPreItem->m_sSize.height > lHeightForKeep) {
- pPreItem->m_sPos.y = lHeightForKeep;
- lHeightForKeep += pPreItem->m_sSize.height;
- pSecondLayoutItem->m_sSize.height += pPreItem->m_sSize.height;
- if (pSecondParent)
- pSecondParent->m_sSize.height += pPreItem->m_sSize.height;
- }
- pSecondLayoutItem->AddChild(pPreItem);
- }
- }
-
- pChildItem->m_sPos.y -= fSplitPos;
- pChildItem->m_sPos.y += lHeightForKeep;
- pChildItem->m_sPos.y += fAddMarginHeight;
- pSecondLayoutItem->AddChild(pChildItem);
- continue;
- }
-
- if (fSplitPos + XFA_LAYOUT_FLOAT_PERCISION >=
- fCurTopMargin + fCurBottomMargin + pChildItem->m_sPos.y +
- pChildItem->m_sSize.height) {
- pLayoutItem->AddChild(pChildItem);
- if (ExistContainerKeep(pChildItem->m_pFormNode, false))
- keepLayoutItems.Add(pChildItem);
- else
- keepLayoutItems.RemoveAll();
-
- continue;
- }
-
- FX_FLOAT fOldHeight = pSecondLayoutItem->m_sSize.height;
- SplitLayoutItem(
- pChildItem, pSecondLayoutItem,
- fSplitPos - fCurTopMargin - fCurBottomMargin - pChildItem->m_sPos.y);
- fAddMarginHeight = pSecondLayoutItem->m_sSize.height - fOldHeight;
- pLayoutItem->AddChild(pChildItem);
- }
-}
-
-void CXFA_ItemLayoutProcessor::SplitLayoutItem(FX_FLOAT fSplitPos) {
- ASSERT(m_pLayoutItem);
- SplitLayoutItem(m_pLayoutItem, nullptr, fSplitPos);
-}
-
-CXFA_ContentLayoutItem* CXFA_ItemLayoutProcessor::ExtractLayoutItem() {
- CXFA_ContentLayoutItem* pLayoutItem = m_pLayoutItem;
- if (pLayoutItem) {
- m_pLayoutItem =
- static_cast<CXFA_ContentLayoutItem*>(pLayoutItem->m_pNextSibling);
- pLayoutItem->m_pNextSibling = nullptr;
- }
-
- if (m_nCurChildNodeStage != XFA_ItemLayoutProcessorStages::Done ||
- !ToContentLayoutItem(m_pOldLayoutItem)) {
- return pLayoutItem;
- }
-
- if (m_pOldLayoutItem->m_pPrev)
- m_pOldLayoutItem->m_pPrev->m_pNext = nullptr;
-
- CXFA_FFNotify* pNotify =
- m_pOldLayoutItem->m_pFormNode->GetDocument()->GetNotify();
- CXFA_LayoutProcessor* pDocLayout =
- m_pOldLayoutItem->m_pFormNode->GetDocument()->GetDocLayout();
- CXFA_ContentLayoutItem* pOldLayoutItem = m_pOldLayoutItem;
- while (pOldLayoutItem) {
- CXFA_ContentLayoutItem* pNextOldLayoutItem = pOldLayoutItem->m_pNext;
- pNotify->OnLayoutItemRemoving(pDocLayout, pOldLayoutItem);
- if (pOldLayoutItem->m_pParent)
- pOldLayoutItem->m_pParent->RemoveChild(pOldLayoutItem);
-
- delete pOldLayoutItem;
- pOldLayoutItem = pNextOldLayoutItem;
- }
- m_pOldLayoutItem = nullptr;
- return pLayoutItem;
-}
-
-void CXFA_ItemLayoutProcessor::GotoNextContainerNode(
- CXFA_Node*& pCurActionNode,
- XFA_ItemLayoutProcessorStages& nCurStage,
- CXFA_Node* pParentContainer,
- bool bUsePageBreak) {
- CXFA_Node* pEntireContainer = pParentContainer;
- CXFA_Node* pChildContainer = XFA_LAYOUT_INVALIDNODE;
- switch (nCurStage) {
- case XFA_ItemLayoutProcessorStages::BreakBefore:
- case XFA_ItemLayoutProcessorStages::BreakAfter: {
- pChildContainer = pCurActionNode->GetNodeItem(XFA_NODEITEM_Parent);
- break;
- }
- case XFA_ItemLayoutProcessorStages::Keep:
- case XFA_ItemLayoutProcessorStages::Container:
- pChildContainer = pCurActionNode;
- break;
- default:
- pChildContainer = XFA_LAYOUT_INVALIDNODE;
- break;
- }
-
- switch (nCurStage) {
- case XFA_ItemLayoutProcessorStages::Keep: {
- CXFA_Node* pBreakAfterNode =
- pChildContainer->GetNodeItem(XFA_NODEITEM_FirstChild);
- if (!m_bKeepBreakFinish &&
- FindBreakNode(pBreakAfterNode, pCurActionNode, &nCurStage, false)) {
- return;
- }
- goto CheckNextChildContainer;
- }
- case XFA_ItemLayoutProcessorStages::None: {
- pCurActionNode = XFA_LAYOUT_INVALIDNODE;
- case XFA_ItemLayoutProcessorStages::BookendLeader:
- for (CXFA_Node* pBookendNode =
- pCurActionNode == XFA_LAYOUT_INVALIDNODE
- ? pEntireContainer->GetNodeItem(XFA_NODEITEM_FirstChild)
- : pCurActionNode->GetNodeItem(XFA_NODEITEM_NextSibling);
- pBookendNode; pBookendNode = pBookendNode->GetNodeItem(
- XFA_NODEITEM_NextSibling)) {
- switch (pBookendNode->GetElementType()) {
- case XFA_Element::Bookend:
- case XFA_Element::Break:
- pCurActionNode = pBookendNode;
- nCurStage = XFA_ItemLayoutProcessorStages::BookendLeader;
- return;
- default:
- break;
- }
- }
- }
- {
- pCurActionNode = XFA_LAYOUT_INVALIDNODE;
- case XFA_ItemLayoutProcessorStages::BreakBefore:
- if (pCurActionNode != XFA_LAYOUT_INVALIDNODE) {
- CXFA_Node* pBreakBeforeNode =
- pCurActionNode->GetNodeItem(XFA_NODEITEM_NextSibling);
- if (!m_bKeepBreakFinish &&
- FindBreakNode(pBreakBeforeNode, pCurActionNode, &nCurStage,
- true)) {
- return;
- }
- if (m_bIsProcessKeep) {
- if (ProcessKeepNodesForBreakBefore(pCurActionNode, nCurStage,
- pChildContainer)) {
- return;
- }
- goto CheckNextChildContainer;
- }
- pCurActionNode = pChildContainer;
- nCurStage = XFA_ItemLayoutProcessorStages::Container;
- return;
- }
- goto CheckNextChildContainer;
- }
- case XFA_ItemLayoutProcessorStages::Container: {
- pCurActionNode = XFA_LAYOUT_INVALIDNODE;
- case XFA_ItemLayoutProcessorStages::BreakAfter: {
- if (pCurActionNode == XFA_LAYOUT_INVALIDNODE) {
- CXFA_Node* pBreakAfterNode =
- pChildContainer->GetNodeItem(XFA_NODEITEM_FirstChild);
- if (!m_bKeepBreakFinish &&
- FindBreakNode(pBreakAfterNode, pCurActionNode, &nCurStage,
- false)) {
- return;
- }
- } else {
- CXFA_Node* pBreakAfterNode =
- pCurActionNode->GetNodeItem(XFA_NODEITEM_NextSibling);
- if (FindBreakNode(pBreakAfterNode, pCurActionNode, &nCurStage,
- false)) {
- return;
- }
- }
- goto CheckNextChildContainer;
- }
- }
-
- CheckNextChildContainer : {
- CXFA_Node* pNextChildContainer =
- pChildContainer == XFA_LAYOUT_INVALIDNODE
- ? pEntireContainer->GetNodeItem(XFA_NODEITEM_FirstChild,
- XFA_ObjectType::ContainerNode)
- : pChildContainer->GetNodeItem(XFA_NODEITEM_NextSibling,
- XFA_ObjectType::ContainerNode);
- while (pNextChildContainer &&
- pNextChildContainer->IsLayoutGeneratedNode()) {
- CXFA_Node* pSaveNode = pNextChildContainer;
- pNextChildContainer = pNextChildContainer->GetNodeItem(
- XFA_NODEITEM_NextSibling, XFA_ObjectType::ContainerNode);
- if (pSaveNode->IsUnusedNode())
- DeleteLayoutGeneratedNode(pSaveNode);
- }
- if (!pNextChildContainer)
- goto NoMoreChildContainer;
-
- bool bLastKeep = false;
- if (ProcessKeepNodesForCheckNext(pCurActionNode, nCurStage,
- pNextChildContainer, bLastKeep)) {
- return;
- }
- if (!m_bKeepBreakFinish && !bLastKeep &&
- FindBreakNode(
- pNextChildContainer->GetNodeItem(XFA_NODEITEM_FirstChild),
- pCurActionNode, &nCurStage, true)) {
- return;
- }
- pCurActionNode = pNextChildContainer;
- if (m_bIsProcessKeep)
- nCurStage = XFA_ItemLayoutProcessorStages::Keep;
- else
- nCurStage = XFA_ItemLayoutProcessorStages::Container;
- return;
- }
-
- NoMoreChildContainer : {
- pCurActionNode = XFA_LAYOUT_INVALIDNODE;
- case XFA_ItemLayoutProcessorStages::BookendTrailer:
- for (CXFA_Node* pBookendNode =
- pCurActionNode == XFA_LAYOUT_INVALIDNODE
- ? pEntireContainer->GetNodeItem(XFA_NODEITEM_FirstChild)
- : pCurActionNode->GetNodeItem(XFA_NODEITEM_NextSibling);
- pBookendNode; pBookendNode = pBookendNode->GetNodeItem(
- XFA_NODEITEM_NextSibling)) {
- switch (pBookendNode->GetElementType()) {
- case XFA_Element::Bookend:
- case XFA_Element::Break:
- pCurActionNode = pBookendNode;
- nCurStage = XFA_ItemLayoutProcessorStages::BookendTrailer;
- return;
- default:
- break;
- }
- }
- }
- default:
- pCurActionNode = nullptr;
- nCurStage = XFA_ItemLayoutProcessorStages::Done;
- }
-}
-
-bool CXFA_ItemLayoutProcessor::ProcessKeepNodesForCheckNext(
- CXFA_Node*& pCurActionNode,
- XFA_ItemLayoutProcessorStages& nCurStage,
- CXFA_Node*& pNextContainer,
- bool& bLastKeepNode) {
- const bool bCanSplit = pNextContainer->GetIntact() == XFA_ATTRIBUTEENUM_None;
- bool bNextKeep = false;
- if (ExistContainerKeep(pNextContainer, false))
- bNextKeep = true;
-
- if (bNextKeep && !bCanSplit) {
- if (!m_bIsProcessKeep && !m_bKeepBreakFinish) {
- m_pKeepHeadNode = pNextContainer;
- m_bIsProcessKeep = true;
- }
- return false;
- }
-
- if (m_bIsProcessKeep && m_pKeepHeadNode) {
- m_pKeepTailNode = pNextContainer;
- if (!m_bKeepBreakFinish &&
- FindBreakNode(pNextContainer->GetNodeItem(XFA_NODEITEM_FirstChild),
- pCurActionNode, &nCurStage, true)) {
- return true;
- }
-
- pNextContainer = m_pKeepHeadNode;
- m_bKeepBreakFinish = true;
- m_pKeepHeadNode = nullptr;
- m_pKeepTailNode = nullptr;
- m_bIsProcessKeep = false;
- } else {
- if (m_bKeepBreakFinish)
- bLastKeepNode = true;
- m_bKeepBreakFinish = false;
- }
-
- return false;
-}
-
-bool CXFA_ItemLayoutProcessor::ProcessKeepNodesForBreakBefore(
- CXFA_Node*& pCurActionNode,
- XFA_ItemLayoutProcessorStages& nCurStage,
- CXFA_Node* pContainerNode) {
- if (m_pKeepTailNode == pContainerNode) {
- pCurActionNode = m_pKeepHeadNode;
- m_bKeepBreakFinish = true;
- m_pKeepHeadNode = nullptr;
- m_pKeepTailNode = nullptr;
- m_bIsProcessKeep = false;
- nCurStage = XFA_ItemLayoutProcessorStages::Container;
- return true;
- }
-
- CXFA_Node* pBreakAfterNode =
- pContainerNode->GetNodeItem(XFA_NODEITEM_FirstChild);
- return FindBreakNode(pBreakAfterNode, pCurActionNode, &nCurStage, false);
-}
-
-bool XFA_ItemLayoutProcessor_IsTakingSpace(CXFA_Node* pNode) {
- XFA_ATTRIBUTEENUM ePresence = pNode->GetEnum(XFA_ATTRIBUTE_Presence);
- return ePresence == XFA_ATTRIBUTEENUM_Visible ||
- ePresence == XFA_ATTRIBUTEENUM_Invisible;
-}
-
-bool CXFA_ItemLayoutProcessor::IncrementRelayoutNode(
- CXFA_LayoutProcessor* pLayoutProcessor,
- CXFA_Node* pNode,
- CXFA_Node* pParentNode) {
- return false;
-}
-
-void CXFA_ItemLayoutProcessor::DoLayoutPageArea(
- CXFA_ContainerLayoutItem* pPageAreaLayoutItem) {
- CXFA_Node* pFormNode = pPageAreaLayoutItem->m_pFormNode;
- CXFA_Node* pCurChildNode = XFA_LAYOUT_INVALIDNODE;
- XFA_ItemLayoutProcessorStages nCurChildNodeStage =
- XFA_ItemLayoutProcessorStages::None;
- CXFA_LayoutItem* pBeforeItem = nullptr;
- for (GotoNextContainerNode(pCurChildNode, nCurChildNodeStage, pFormNode,
- false);
- pCurChildNode; GotoNextContainerNode(pCurChildNode, nCurChildNodeStage,
- pFormNode, false)) {
- if (nCurChildNodeStage != XFA_ItemLayoutProcessorStages::Container)
- continue;
- if (pCurChildNode->GetElementType() == XFA_Element::Variables)
- continue;
-
- auto pProcessor =
- pdfium::MakeUnique<CXFA_ItemLayoutProcessor>(pCurChildNode, nullptr);
- pProcessor->DoLayout(false, FLT_MAX, FLT_MAX, nullptr);
- if (!pProcessor->HasLayoutItem())
- continue;
-
- pProcessor->SetCurrentComponentPos(CalculatePositionedContainerPos(
- pCurChildNode, pProcessor->GetCurrentComponentSize()));
- CXFA_LayoutItem* pProcessItem = pProcessor->ExtractLayoutItem();
- if (!pBeforeItem)
- pPageAreaLayoutItem->AddHeadChild(pProcessItem);
- else
- pPageAreaLayoutItem->InsertChild(pBeforeItem, pProcessItem);
-
- pBeforeItem = pProcessItem;
- }
-
- pBeforeItem = nullptr;
- CXFA_LayoutItem* pLayoutItem = pPageAreaLayoutItem->m_pFirstChild;
- while (pLayoutItem) {
- if (!pLayoutItem->IsContentLayoutItem() ||
- pLayoutItem->m_pFormNode->GetElementType() != XFA_Element::Draw) {
- pLayoutItem = pLayoutItem->m_pNextSibling;
- continue;
- }
- if (pLayoutItem->m_pFormNode->GetElementType() != XFA_Element::Draw)
- continue;
-
- CXFA_LayoutItem* pNextLayoutItem = pLayoutItem->m_pNextSibling;
- pPageAreaLayoutItem->RemoveChild(pLayoutItem);
- if (!pBeforeItem)
- pPageAreaLayoutItem->AddHeadChild(pLayoutItem);
- else
- pPageAreaLayoutItem->InsertChild(pBeforeItem, pLayoutItem);
-
- pBeforeItem = pLayoutItem;
- pLayoutItem = pNextLayoutItem;
- }
-}
-
-void CXFA_ItemLayoutProcessor::DoLayoutPositionedContainer(
- CXFA_LayoutContext* pContext) {
- if (m_pLayoutItem)
- return;
-
- m_pLayoutItem = CreateContentLayoutItem(m_pFormNode);
- bool bIgnoreXY = (m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout) !=
- XFA_ATTRIBUTEENUM_Position);
- bool bContainerWidthAutoSize = true;
- bool bContainerHeightAutoSize = true;
- CFX_SizeF containerSize = CalculateContainerSpecifiedSize(
- m_pFormNode, &bContainerWidthAutoSize, &bContainerHeightAutoSize);
-
- FX_FLOAT fContentCalculatedWidth = 0;
- FX_FLOAT fContentCalculatedHeight = 0;
- FX_FLOAT fHiddenContentCalculatedWidth = 0;
- FX_FLOAT fHiddenContentCalculatedHeight = 0;
- if (m_pCurChildNode == XFA_LAYOUT_INVALIDNODE) {
- GotoNextContainerNode(m_pCurChildNode, m_nCurChildNodeStage, m_pFormNode,
- false);
- }
-
- int32_t iColIndex = 0;
- for (; m_pCurChildNode; GotoNextContainerNode(
- m_pCurChildNode, m_nCurChildNodeStage, m_pFormNode, false)) {
- if (m_nCurChildNodeStage != XFA_ItemLayoutProcessorStages::Container)
- continue;
- if (m_pCurChildNode->GetElementType() == XFA_Element::Variables)
- continue;
-
- auto pProcessor = pdfium::MakeUnique<CXFA_ItemLayoutProcessor>(
- m_pCurChildNode, m_pPageMgr);
- if (pContext && pContext->m_prgSpecifiedColumnWidths) {
- int32_t iColSpan = m_pCurChildNode->GetInteger(XFA_ATTRIBUTE_ColSpan);
- if (iColSpan <=
- pContext->m_prgSpecifiedColumnWidths->GetSize() - iColIndex) {
- pContext->m_fCurColumnWidth = 0;
- pContext->m_bCurColumnWidthAvaiable = true;
- if (iColSpan == -1)
- iColSpan = pContext->m_prgSpecifiedColumnWidths->GetSize();
-
- for (int32_t i = 0; iColIndex + i < iColSpan; ++i) {
- pContext->m_fCurColumnWidth +=
- pContext->m_prgSpecifiedColumnWidths->GetAt(iColIndex + i);
- }
- if (pContext->m_fCurColumnWidth == 0)
- pContext->m_bCurColumnWidthAvaiable = false;
-
- iColIndex += iColSpan >= 0 ? iColSpan : 0;
- }
- }
-
- pProcessor->DoLayout(false, FLT_MAX, FLT_MAX, pContext);
- if (!pProcessor->HasLayoutItem())
- continue;
-
- CFX_SizeF size = pProcessor->GetCurrentComponentSize();
- bool bChangeParentSize = false;
- if (XFA_ItemLayoutProcessor_IsTakingSpace(m_pCurChildNode))
- bChangeParentSize = true;
-
- CFX_PointF absolutePos;
- if (!bIgnoreXY)
- absolutePos = CalculatePositionedContainerPos(m_pCurChildNode, size);
-
- pProcessor->SetCurrentComponentPos(absolutePos);
- if (bContainerWidthAutoSize) {
- FX_FLOAT fChildSuppliedWidth = absolutePos.x + size.width;
- if (bChangeParentSize) {
- fContentCalculatedWidth =
- std::max(fContentCalculatedWidth, fChildSuppliedWidth);
- } else {
- if (fHiddenContentCalculatedWidth < fChildSuppliedWidth &&
- m_pCurChildNode->GetElementType() != XFA_Element::Subform) {
- fHiddenContentCalculatedWidth = fChildSuppliedWidth;
- }
- }
- }
-
- if (bContainerHeightAutoSize) {
- FX_FLOAT fChildSuppliedHeight = absolutePos.y + size.height;
- if (bChangeParentSize) {
- fContentCalculatedHeight =
- std::max(fContentCalculatedHeight, fChildSuppliedHeight);
- } else {
- if (fHiddenContentCalculatedHeight < fChildSuppliedHeight &&
- m_pCurChildNode->GetElementType() != XFA_Element::Subform) {
- fHiddenContentCalculatedHeight = fChildSuppliedHeight;
- }
- }
- }
- m_pLayoutItem->AddChild(pProcessor->ExtractLayoutItem());
- }
-
- XFA_VERSION eVersion = m_pFormNode->GetDocument()->GetCurVersionMode();
- if (fContentCalculatedWidth == 0 && eVersion < XFA_VERSION_207)
- fContentCalculatedWidth = fHiddenContentCalculatedWidth;
- if (fContentCalculatedHeight == 0 && eVersion < XFA_VERSION_207)
- fContentCalculatedHeight = fHiddenContentCalculatedHeight;
-
- containerSize = CalculateContainerComponentSizeFromContentSize(
- m_pFormNode, bContainerWidthAutoSize, fContentCalculatedWidth,
- bContainerHeightAutoSize, fContentCalculatedHeight, containerSize);
- SetCurrentComponentSize(containerSize);
-}
-
-void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) {
- if (m_pLayoutItem)
- return;
- if (!pLayoutNode)
- pLayoutNode = m_pFormNode;
-
- ASSERT(m_pCurChildNode == XFA_LAYOUT_INVALIDNODE);
-
- m_pLayoutItem = CreateContentLayoutItem(m_pFormNode);
- bool bContainerWidthAutoSize = true;
- bool bContainerHeightAutoSize = true;
- CFX_SizeF containerSize = CalculateContainerSpecifiedSize(
- m_pFormNode, &bContainerWidthAutoSize, &bContainerHeightAutoSize);
- FX_FLOAT fContentCalculatedWidth = 0;
- FX_FLOAT fContentCalculatedHeight = 0;
- CXFA_Node* pMarginNode =
- m_pFormNode->GetFirstChildByClass(XFA_Element::Margin);
- FX_FLOAT fLeftInset = 0;
- FX_FLOAT fRightInset = 0;
- if (pMarginNode) {
- fLeftInset =
- pMarginNode->GetMeasure(XFA_ATTRIBUTE_LeftInset).ToUnit(XFA_UNIT_Pt);
- fRightInset =
- pMarginNode->GetMeasure(XFA_ATTRIBUTE_RightInset).ToUnit(XFA_UNIT_Pt);
- }
-
- FX_FLOAT fContentWidthLimit =
- bContainerWidthAutoSize ? FLT_MAX
- : containerSize.width - fLeftInset - fRightInset;
- CFX_WideStringC wsColumnWidths;
- if (pLayoutNode->TryCData(XFA_ATTRIBUTE_ColumnWidths, wsColumnWidths)) {
- auto widths = SeparateStringW(wsColumnWidths.c_str(),
- wsColumnWidths.GetLength(), L' ');
- for (auto& width : widths) {
- width.TrimLeft(L' ');
- if (width.IsEmpty())
- continue;
-
- CXFA_Measurement measure(width.AsStringC());
- m_rgSpecifiedColumnWidths.Add(measure.ToUnit(XFA_UNIT_Pt));
- }
- }
-
- int32_t iSpecifiedColumnCount = m_rgSpecifiedColumnWidths.GetSize();
- CXFA_LayoutContext layoutContext;
- layoutContext.m_prgSpecifiedColumnWidths = &m_rgSpecifiedColumnWidths;
- CXFA_LayoutContext* pLayoutContext =
- iSpecifiedColumnCount > 0 ? &layoutContext : nullptr;
- if (m_pCurChildNode == XFA_LAYOUT_INVALIDNODE) {
- GotoNextContainerNode(m_pCurChildNode, m_nCurChildNodeStage, m_pFormNode,
- false);
- }
-
- for (; m_pCurChildNode; GotoNextContainerNode(
- m_pCurChildNode, m_nCurChildNodeStage, m_pFormNode, false)) {
- layoutContext.m_bCurColumnWidthAvaiable = false;
- layoutContext.m_fCurColumnWidth = 0;
- if (m_nCurChildNodeStage != XFA_ItemLayoutProcessorStages::Container)
- continue;
-
- auto pProcessor = pdfium::MakeUnique<CXFA_ItemLayoutProcessor>(
- m_pCurChildNode, m_pPageMgr);
- pProcessor->DoLayout(false, FLT_MAX, FLT_MAX, pLayoutContext);
- if (!pProcessor->HasLayoutItem())
- continue;
-
- m_pLayoutItem->AddChild(pProcessor->ExtractLayoutItem());
- }
-
- int32_t iRowCount = 0;
- int32_t iColCount = 0;
- {
- CFX_ArrayTemplate<CXFA_ContentLayoutItem*> rgRowItems;
- CFX_ArrayTemplate<int32_t> rgRowItemsSpan;
- CFX_ArrayTemplate<FX_FLOAT> rgRowItemsWidth;
- for (CXFA_ContentLayoutItem* pLayoutChild =
- (CXFA_ContentLayoutItem*)m_pLayoutItem->m_pFirstChild;
- pLayoutChild;
- pLayoutChild = (CXFA_ContentLayoutItem*)pLayoutChild->m_pNextSibling) {
- if (pLayoutChild->m_pFormNode->GetElementType() != XFA_Element::Subform)
- continue;
- if (!XFA_ItemLayoutProcessor_IsTakingSpace(pLayoutChild->m_pFormNode))
- continue;
-
- XFA_ATTRIBUTEENUM eLayout =
- pLayoutChild->m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout);
- if (eLayout != XFA_ATTRIBUTEENUM_Row &&
- eLayout != XFA_ATTRIBUTEENUM_Rl_row) {
- continue;
- }
- if (CXFA_ContentLayoutItem* pRowLayoutCell =
- (CXFA_ContentLayoutItem*)pLayoutChild->m_pFirstChild) {
- rgRowItems.Add(pRowLayoutCell);
- int32_t iColSpan =
- pRowLayoutCell->m_pFormNode->GetInteger(XFA_ATTRIBUTE_ColSpan);
- rgRowItemsSpan.Add(iColSpan);
- rgRowItemsWidth.Add(pRowLayoutCell->m_sSize.width);
- }
- }
-
- iRowCount = rgRowItems.GetSize();
- iColCount = 0;
- bool bMoreColumns = true;
- while (bMoreColumns) {
- bMoreColumns = false;
- bool bAutoCol = false;
- for (int32_t i = 0; i < iRowCount; i++) {
- while (rgRowItems[i] && (rgRowItemsSpan[i] <= 0 ||
- !XFA_ItemLayoutProcessor_IsTakingSpace(
- rgRowItems[i]->m_pFormNode))) {
- CXFA_ContentLayoutItem* pNewCell =
- (CXFA_ContentLayoutItem*)rgRowItems[i]->m_pNextSibling;
- if (rgRowItemsSpan[i] < 0 && XFA_ItemLayoutProcessor_IsTakingSpace(
- rgRowItems[i]->m_pFormNode)) {
- pNewCell = nullptr;
- }
- rgRowItems[i] = pNewCell;
- rgRowItemsSpan[i] =
- pNewCell
- ? pNewCell->m_pFormNode->GetInteger(XFA_ATTRIBUTE_ColSpan)
- : 0;
- rgRowItemsWidth[i] = pNewCell ? pNewCell->m_sSize.width : 0;
- }
- CXFA_ContentLayoutItem* pCell = rgRowItems[i];
- if (!pCell)
- continue;
-
- bMoreColumns = true;
- if (rgRowItemsSpan[i] != 1)
- continue;
-
- if (iColCount >= iSpecifiedColumnCount) {
- int32_t c = iColCount + 1 - m_rgSpecifiedColumnWidths.GetSize();
- for (int32_t j = 0; j < c; j++)
- m_rgSpecifiedColumnWidths.Add(0);
- }
- if (m_rgSpecifiedColumnWidths[iColCount] < XFA_LAYOUT_FLOAT_PERCISION)
- bAutoCol = true;
- if (bAutoCol &&
- m_rgSpecifiedColumnWidths[iColCount] < rgRowItemsWidth[i]) {
- m_rgSpecifiedColumnWidths[iColCount] = rgRowItemsWidth[i];
- }
- }
-
- if (!bMoreColumns)
- continue;
-
- FX_FLOAT fFinalColumnWidth = 0.0f;
- if (iColCount < m_rgSpecifiedColumnWidths.GetSize())
- fFinalColumnWidth = m_rgSpecifiedColumnWidths[iColCount];
- for (int32_t i = 0; i < iRowCount; ++i) {
- if (!rgRowItems[i])
- continue;
- --rgRowItemsSpan[i];
- rgRowItemsWidth[i] -= fFinalColumnWidth;
- }
- ++iColCount;
- }
- }
-
- FX_FLOAT fCurrentRowY = 0;
- for (CXFA_ContentLayoutItem* pLayoutChild =
- (CXFA_ContentLayoutItem*)m_pLayoutItem->m_pFirstChild;
- pLayoutChild;
- pLayoutChild = (CXFA_ContentLayoutItem*)pLayoutChild->m_pNextSibling) {
- if (!XFA_ItemLayoutProcessor_IsTakingSpace(pLayoutChild->m_pFormNode))
- continue;
-
- if (pLayoutChild->m_pFormNode->GetElementType() == XFA_Element::Subform) {
- XFA_ATTRIBUTEENUM eSubformLayout =
- pLayoutChild->m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout);
- if (eSubformLayout == XFA_ATTRIBUTEENUM_Row ||
- eSubformLayout == XFA_ATTRIBUTEENUM_Rl_row) {
- RelocateTableRowCells(pLayoutChild, m_rgSpecifiedColumnWidths,
- eSubformLayout);
- }
- }
-
- pLayoutChild->m_sPos.y = fCurrentRowY;
- if (bContainerWidthAutoSize) {
- pLayoutChild->m_sPos.x = 0;
- } else {
- switch (pLayoutChild->m_pFormNode->GetEnum(XFA_ATTRIBUTE_HAlign)) {
- case XFA_ATTRIBUTEENUM_Center:
- pLayoutChild->m_sPos.x =
- (fContentWidthLimit - pLayoutChild->m_sSize.width) / 2;
- break;
- case XFA_ATTRIBUTEENUM_Right:
- pLayoutChild->m_sPos.x =
- fContentWidthLimit - pLayoutChild->m_sSize.width;
- break;
- case XFA_ATTRIBUTEENUM_Left:
- default:
- pLayoutChild->m_sPos.x = 0;
- break;
- }
- }
-
- if (bContainerWidthAutoSize) {
- FX_FLOAT fChildSuppliedWidth =
- pLayoutChild->m_sPos.x + pLayoutChild->m_sSize.width;
- if (fContentWidthLimit < FLT_MAX &&
- fContentWidthLimit > fChildSuppliedWidth) {
- fChildSuppliedWidth = fContentWidthLimit;
- }
- fContentCalculatedWidth =
- std::max(fContentCalculatedWidth, fChildSuppliedWidth);
- }
- fCurrentRowY += pLayoutChild->m_sSize.height;
- }
-
- if (bContainerHeightAutoSize)
- fContentCalculatedHeight = std::max(fContentCalculatedHeight, fCurrentRowY);
-
- containerSize = CalculateContainerComponentSizeFromContentSize(
- m_pFormNode, bContainerWidthAutoSize, fContentCalculatedWidth,
- bContainerHeightAutoSize, fContentCalculatedHeight, containerSize);
- SetCurrentComponentSize(containerSize);
-}
-
-bool CXFA_ItemLayoutProcessor::IsAddNewRowForTrailer(
- CXFA_ContentLayoutItem* pTrailerItem) {
- if (!pTrailerItem)
- return false;
-
- FX_FLOAT fWidth = pTrailerItem->m_sSize.width;
- XFA_ATTRIBUTEENUM eLayout = m_pFormNode->GetEnum(XFA_ATTRIBUTE_Layout);
- return eLayout == XFA_ATTRIBUTEENUM_Tb || m_fWidthLimite <= fWidth;
-}
-
-FX_FLOAT CXFA_ItemLayoutProcessor::InsertKeepLayoutItems() {
- if (m_arrayKeepItems.empty())
- return 0;
-
- if (!m_pLayoutItem) {
- m_pLayoutItem = CreateContentLayoutItem(m_pFormNode);
- m_pLayoutItem->m_sSize.clear();
- }
-
- FX_FLOAT fTotalHeight = 0;
- for (auto iter = m_arrayKeepItems.rbegin(); iter != m_arrayKeepItems.rend();
- iter++) {
- AddLeaderAfterSplit(this, *iter);
- fTotalHeight += (*iter)->m_sSize.height;
- }
- m_arrayKeepItems.clear();
-
- return fTotalHeight;
-}
-
-bool CXFA_ItemLayoutProcessor::ProcessKeepForSplit(
- CXFA_ItemLayoutProcessor* pParentProcessor,
- CXFA_ItemLayoutProcessor* pChildProcessor,
- XFA_ItemLayoutProcessorResult eRetValue,
- CFX_ArrayTemplate<CXFA_ContentLayoutItem*>* rgCurLineLayoutItem,
- FX_FLOAT* fContentCurRowAvailWidth,
- FX_FLOAT* fContentCurRowHeight,
- FX_FLOAT* fContentCurRowY,
- bool* bAddedItemInRow,
- bool* bForceEndPage,
- XFA_ItemLayoutProcessorResult* result) {
- if (!pParentProcessor || !pChildProcessor)
- return false;
-
- if (pParentProcessor->m_pCurChildNode->GetIntact() ==
- XFA_ATTRIBUTEENUM_None &&
- pChildProcessor->m_bHasAvailHeight)
- return false;
-
- if (!ExistContainerKeep(pParentProcessor->m_pCurChildNode, true))
- return false;
-
- CFX_SizeF childSize = pChildProcessor->GetCurrentComponentSize();
- std::vector<CXFA_ContentLayoutItem*> keepLayoutItems;
- if (pParentProcessor->JudgePutNextPage(pParentProcessor->m_pLayoutItem,
- childSize.height, &keepLayoutItems)) {
- m_arrayKeepItems.clear();
-
- for (auto item : keepLayoutItems) {
- pParentProcessor->m_pLayoutItem->RemoveChild(item);
- *fContentCurRowY -= item->m_sSize.height;
- m_arrayKeepItems.push_back(item);
- }
- *bAddedItemInRow = true;
- *bForceEndPage = true;
- *result = XFA_ItemLayoutProcessorResult::PageFullBreak;
- return true;
- }
-
- rgCurLineLayoutItem->Add(pChildProcessor->ExtractLayoutItem());
- *bAddedItemInRow = true;
- *fContentCurRowAvailWidth -= childSize.width;
- *fContentCurRowHeight = std::max(*fContentCurRowHeight, childSize.height);
- *result = eRetValue;
-
- return true;
-}
-
-bool CXFA_ItemLayoutProcessor::JudgePutNextPage(
- CXFA_ContentLayoutItem* pParentLayoutItem,
- FX_FLOAT fChildHeight,
- std::vector<CXFA_ContentLayoutItem*>* pKeepItems) {
- if (!pParentLayoutItem)
- return false;
-
- FX_FLOAT fItemsHeight = 0;
- for (CXFA_ContentLayoutItem* pChildLayoutItem =
- (CXFA_ContentLayoutItem*)pParentLayoutItem->m_pFirstChild;
- pChildLayoutItem;
- pChildLayoutItem =
- (CXFA_ContentLayoutItem*)pChildLayoutItem->m_pNextSibling) {
- if (ExistContainerKeep(pChildLayoutItem->m_pFormNode, false)) {
- pKeepItems->push_back(pChildLayoutItem);
- fItemsHeight += pChildLayoutItem->m_sSize.height;
- } else {
- pKeepItems->clear();
- fItemsHeight = 0;
- }
- }
- fItemsHeight += fChildHeight;
- return m_pPageMgr->GetNextAvailContentHeight(fItemsHeight);
-}
-
-void CXFA_ItemLayoutProcessor::ProcessUnUseBinds(CXFA_Node* pFormNode) {
- if (!pFormNode)
- return;
-
- CXFA_NodeIteratorTemplate<CXFA_Node, CXFA_TraverseStrategy_XFANode> sIterator(
- pFormNode);
- for (CXFA_Node* pNode = sIterator.MoveToNext(); pNode;
- pNode = sIterator.MoveToNext()) {
- if (pNode->IsContainerNode()) {
- CXFA_Node* pBindNode = pNode->GetBindData();
- if (pBindNode) {
- pBindNode->RemoveBindItem(pNode);
- pNode->SetObject(XFA_ATTRIBUTE_BindingNode, nullptr);
- }
- }
- pNode->SetFlag(XFA_NodeFlag_UnusedNode, true);
- }
-}
-
-void CXFA_ItemLayoutProcessor::ProcessUnUseOverFlow(
- CXFA_Node* pLeaderNode,
- CXFA_Node* pTrailerNode,
- CXFA_ContentLayoutItem* pTrailerItem,
- CXFA_Node* pFormNode) {
- ProcessUnUseBinds(pLeaderNode);
- ProcessUnUseBinds(pTrailerNode);
- if (!pFormNode)
- return;
-
- if (pFormNode->GetElementType() == XFA_Element::Overflow ||
- pFormNode->GetElementType() == XFA_Element::Break) {
- pFormNode = pFormNode->GetNodeItem(XFA_NODEITEM_Parent);
- }
- if (pLeaderNode && pFormNode)
- pFormNode->RemoveChild(pLeaderNode);
- if (pTrailerNode && pFormNode)
- pFormNode->RemoveChild(pTrailerNode);
- if (pTrailerItem)
- XFA_ReleaseLayoutItem(pTrailerItem);
-}
-
-XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer(
- bool bUseBreakControl,
- XFA_ATTRIBUTEENUM eFlowStrategy,
- FX_FLOAT fHeightLimit,
- FX_FLOAT fRealHeight,
- CXFA_LayoutContext* pContext,
- bool bRootForceTb) {
- m_bHasAvailHeight = true;
- bool bBreakDone = false;
- bool bContainerWidthAutoSize = true;
- bool bContainerHeightAutoSize = true;
- bool bForceEndPage = false;
- bool bIsManualBreak = false;
- if (m_pCurChildPreprocessor) {
- m_pCurChildPreprocessor->m_ePreProcessRs =
- XFA_ItemLayoutProcessorResult::Done;
- }
-
- CFX_SizeF containerSize = CalculateContainerSpecifiedSize(
- m_pFormNode, &bContainerWidthAutoSize, &bContainerHeightAutoSize);
- if (pContext && pContext->m_bCurColumnWidthAvaiable) {
- bContainerWidthAutoSize = false;
- containerSize.width = pContext->m_fCurColumnWidth;
- }
- if (!bContainerHeightAutoSize)
- containerSize.height -= m_fUsedSize;
-
- if (!bContainerHeightAutoSize) {
- CXFA_Node* pParentNode = m_pFormNode->GetNodeItem(XFA_NODEITEM_Parent);
- bool bFocrTb = false;
- if (pParentNode &&
- GetLayout(pParentNode, &bFocrTb) == XFA_ATTRIBUTEENUM_Row) {
- CXFA_Node* pChildContainer = m_pFormNode->GetNodeItem(
- XFA_NODEITEM_FirstChild, XFA_ObjectType::ContainerNode);
- if (pChildContainer &&
- pChildContainer->GetNodeItem(XFA_NODEITEM_NextSibling,
- XFA_ObjectType::ContainerNode)) {
- containerSize.height = 0;
- bContainerHeightAutoSize = true;
- }
- }
- }
-
- CXFA_Node* pMarginNode =
- m_pFormNode->GetFirstChildByClass(XFA_Element::Margin);
- FX_FLOAT fLeftInset = 0;
- FX_FLOAT fTopInset = 0;
- FX_FLOAT fRightInset = 0;
- FX_FLOAT fBottomInset = 0;
- if (pMarginNode) {
- fLeftInset =
- pMarginNode->GetMeasure(XFA_ATTRIBUTE_LeftInset).ToUnit(XFA_UNIT_Pt);
- fTopInset =
- pMarginNode->GetMeasure(XFA_ATTRIBUTE_TopInset).ToUnit(XFA_UNIT_Pt);
- fRightInset =
- pMarginNode->GetMeasure(XFA_ATTRIBUTE_RightInset).ToUnit(XFA_UNIT_Pt);
- fBottomInset =
- pMarginNode->GetMeasure(XFA_ATTRIBUTE_BottomInset).ToUnit(XFA_UNIT_Pt);
- }
- FX_FLOAT fContentWidthLimit =
- bContainerWidthAutoSize ? FLT_MAX
- : containerSize.width - fLeftInset - fRightInset;
- FX_FLOAT fContentCalculatedWidth = 0;
- FX_FLOAT fContentCalculatedHeight = 0;
- FX_FLOAT fAvailHeight = fHeightLimit - fTopInset - fBottomInset;
- if (fAvailHeight < 0)
- m_bHasAvailHeight = false;
-
- fRealHeight = fRealHeight - fTopInset - fBottomInset;
- FX_FLOAT fContentCurRowY = 0;
- CXFA_ContentLayoutItem* pLayoutChild = nullptr;
- if (m_pLayoutItem) {
- if (m_nCurChildNodeStage != XFA_ItemLayoutProcessorStages::Done &&
- eFlowStrategy != XFA_ATTRIBUTEENUM_Tb) {
- pLayoutChild = (CXFA_ContentLayoutItem*)m_pLayoutItem->m_pFirstChild;
- for (CXFA_ContentLayoutItem* pLayoutNext = pLayoutChild; pLayoutNext;
- pLayoutNext = (CXFA_ContentLayoutItem*)pLayoutNext->m_pNextSibling) {
- if (pLayoutNext->m_sPos.y != pLayoutChild->m_sPos.y)
- pLayoutChild = pLayoutNext;
- }
- }
-
- for (CXFA_ContentLayoutItem* pLayoutTempChild =
- (CXFA_ContentLayoutItem*)m_pLayoutItem->m_pFirstChild;
- pLayoutTempChild != pLayoutChild;
- pLayoutTempChild =
- (CXFA_ContentLayoutItem*)pLayoutTempChild->m_pNextSibling) {
- if (!XFA_ItemLayoutProcessor_IsTakingSpace(pLayoutTempChild->m_pFormNode))
- continue;
-
- fContentCalculatedWidth = std::max(
- fContentCalculatedWidth,
- pLayoutTempChild->m_sPos.x + pLayoutTempChild->m_sSize.width);
- fContentCalculatedHeight = std::max(
- fContentCalculatedHeight,
- pLayoutTempChild->m_sPos.y + pLayoutTempChild->m_sSize.height);
- }
-
- if (pLayoutChild)
- fContentCurRowY = pLayoutChild->m_sPos.y;
- else
- fContentCurRowY = fContentCalculatedHeight;
- }
-
- fContentCurRowY += InsertKeepLayoutItems();
- if (m_nCurChildNodeStage == XFA_ItemLayoutProcessorStages::None) {
- GotoNextContainerNode(m_pCurChildNode, m_nCurChildNodeStage, m_pFormNode,
- true);
- }
-
- fContentCurRowY += InsertPendingItems(this, m_pFormNode);
- if (m_pCurChildPreprocessor &&
- m_nCurChildNodeStage == XFA_ItemLayoutProcessorStages::Container) {
- if (ExistContainerKeep(m_pCurChildPreprocessor->GetFormNode(), false)) {
- m_pKeepHeadNode = m_pCurChildNode;
- m_bIsProcessKeep = true;
- m_nCurChildNodeStage = XFA_ItemLayoutProcessorStages::Keep;
- }
- }
-
- while (m_nCurChildNodeStage != XFA_ItemLayoutProcessorStages::Done) {
- FX_FLOAT fContentCurRowHeight = 0;
- FX_FLOAT fContentCurRowAvailWidth = fContentWidthLimit;
- m_fWidthLimite = fContentCurRowAvailWidth;
- CFX_ArrayTemplate<CXFA_ContentLayoutItem*> rgCurLineLayoutItems[3];
- uint8_t uCurHAlignState =
- (eFlowStrategy != XFA_ATTRIBUTEENUM_Rl_tb ? 0 : 2);
- if (pLayoutChild) {
- for (CXFA_ContentLayoutItem* pLayoutNext = pLayoutChild; pLayoutNext;
- pLayoutNext = (CXFA_ContentLayoutItem*)pLayoutNext->m_pNextSibling) {
- if (!pLayoutNext->m_pNextSibling && m_pCurChildPreprocessor &&
- m_pCurChildPreprocessor->m_pFormNode == pLayoutNext->m_pFormNode) {
- pLayoutNext->m_pNext = m_pCurChildPreprocessor->m_pLayoutItem;
- m_pCurChildPreprocessor->m_pLayoutItem = pLayoutNext;
- break;
- }
- uint8_t uHAlign = HAlignEnumToInt(
- pLayoutNext->m_pFormNode->GetEnum(XFA_ATTRIBUTE_HAlign));
- rgCurLineLayoutItems[uHAlign].Add(pLayoutNext);
- if (eFlowStrategy == XFA_ATTRIBUTEENUM_Lr_tb) {
- if (uHAlign > uCurHAlignState)
- uCurHAlignState = uHAlign;
- } else if (uHAlign < uCurHAlignState) {
- uCurHAlignState = uHAlign;
- }
- if (XFA_ItemLayoutProcessor_IsTakingSpace(pLayoutNext->m_pFormNode)) {
- if (pLayoutNext->m_sSize.height > fContentCurRowHeight)
- fContentCurRowHeight = pLayoutNext->m_sSize.height;
- fContentCurRowAvailWidth -= pLayoutNext->m_sSize.width;
- }
- }
-
- if ((CXFA_ContentLayoutItem*)m_pLayoutItem->m_pFirstChild ==
- pLayoutChild) {
- m_pLayoutItem->m_pFirstChild = nullptr;
- } else {
- CXFA_ContentLayoutItem* pLayoutNext =
- (CXFA_ContentLayoutItem*)m_pLayoutItem->m_pFirstChild;
- for (; pLayoutNext;
- pLayoutNext =
- (CXFA_ContentLayoutItem*)pLayoutNext->m_pNextSibling) {
- if ((CXFA_ContentLayoutItem*)pLayoutNext->m_pNextSibling ==
- pLayoutChild) {
- pLayoutNext->m_pNextSibling = nullptr;
- break;
- }
- }
- }
-
- CXFA_ContentLayoutItem* pLayoutNextTemp =
- (CXFA_ContentLayoutItem*)pLayoutChild;
- while (pLayoutNextTemp) {
- pLayoutNextTemp->m_pParent = nullptr;
- CXFA_ContentLayoutItem* pSaveLayoutNext =
- (CXFA_ContentLayoutItem*)pLayoutNextTemp->m_pNextSibling;
- pLayoutNextTemp->m_pNextSibling = nullptr;
- pLayoutNextTemp = pSaveLayoutNext;
- }
- pLayoutChild = nullptr;
- }
-
- while (m_pCurChildNode) {
- std::unique_ptr<CXFA_ItemLayoutProcessor> pProcessor;
- bool bAddedItemInRow = false;
- fContentCurRowY += InsertPendingItems(this, m_pFormNode);
- switch (m_nCurChildNodeStage) {
- case XFA_ItemLayoutProcessorStages::Keep:
- case XFA_ItemLayoutProcessorStages::None:
- break;
- case XFA_ItemLayoutProcessorStages::BreakBefore: {
- for (auto item : m_arrayKeepItems) {
- m_pLayoutItem->RemoveChild(item);
- fContentCalculatedHeight -= item->m_sSize.height;
- }
-
- CXFA_Node* pLeaderNode = nullptr;
- CXFA_Node* pTrailerNode = nullptr;
- bool bCreatePage = false;
- if (!bUseBreakControl || !m_pPageMgr ||
- !m_pPageMgr->ProcessBreakBeforeOrAfter(m_pCurChildNode, true,
- pLeaderNode, pTrailerNode,
- bCreatePage) ||
- m_pFormNode->GetElementType() == XFA_Element::Form ||
- !bCreatePage) {
- break;
- }
-
- if (JudgeLeaderOrTrailerForOccur(pLeaderNode))
- AddPendingNode(this, pLeaderNode, true);
-
- if (JudgeLeaderOrTrailerForOccur(pTrailerNode)) {
- if (m_pFormNode->GetNodeItem(XFA_NODEITEM_Parent)
- ->GetElementType() == XFA_Element::Form &&
- !m_pLayoutItem) {
- AddPendingNode(this, pTrailerNode, true);
- } else {
- auto pTempProcessor =
- pdfium::MakeUnique<CXFA_ItemLayoutProcessor>(pTrailerNode,
- nullptr);
- InsertFlowedItem(
- this, pTempProcessor.get(), bContainerWidthAutoSize,
- bContainerHeightAutoSize, containerSize.height, eFlowStrategy,
- &uCurHAlignState, rgCurLineLayoutItems, false, FLT_MAX,
- FLT_MAX, fContentWidthLimit, &fContentCurRowY,
- &fContentCurRowAvailWidth, &fContentCurRowHeight,
- &bAddedItemInRow, &bForceEndPage, pContext, false);
- }
- }
- GotoNextContainerNode(m_pCurChildNode, m_nCurChildNodeStage,
- m_pFormNode, true);
- bForceEndPage = true;
- bIsManualBreak = true;
- goto SuspendAndCreateNewRow;
- }
- case XFA_ItemLayoutProcessorStages::BreakAfter: {
- CXFA_Node* pLeaderNode = nullptr;
- CXFA_Node* pTrailerNode = nullptr;
- bool bCreatePage = false;
- if (!bUseBreakControl || !m_pPageMgr ||
- !m_pPageMgr->ProcessBreakBeforeOrAfter(m_pCurChildNode, false,
- pLeaderNode, pTrailerNode,
- bCreatePage) ||
- m_pFormNode->GetElementType() == XFA_Element::Form) {
- break;
- }
-
- if (JudgeLeaderOrTrailerForOccur(pTrailerNode)) {
- auto pTempProcessor = pdfium::MakeUnique<CXFA_ItemLayoutProcessor>(
- pTrailerNode, nullptr);
- InsertFlowedItem(
- this, pTempProcessor.get(), bContainerWidthAutoSize,
- bContainerHeightAutoSize, containerSize.height, eFlowStrategy,
- &uCurHAlignState, rgCurLineLayoutItems, false, FLT_MAX, FLT_MAX,
- fContentWidthLimit, &fContentCurRowY, &fContentCurRowAvailWidth,
- &fContentCurRowHeight, &bAddedItemInRow, &bForceEndPage,
- pContext, false);
- }
- if (!bCreatePage) {
- if (JudgeLeaderOrTrailerForOccur(pLeaderNode)) {
- CalculateRowChildPosition(
- rgCurLineLayoutItems, eFlowStrategy, bContainerHeightAutoSize,
- bContainerWidthAutoSize, &fContentCalculatedWidth,
- &fContentCalculatedHeight, &fContentCurRowY,
- fContentCurRowHeight, fContentWidthLimit, false);
- rgCurLineLayoutItems->RemoveAll();
- auto pTempProcessor =
- pdfium::MakeUnique<CXFA_ItemLayoutProcessor>(pLeaderNode,
- nullptr);
- InsertFlowedItem(
- this, pTempProcessor.get(), bContainerWidthAutoSize,
- bContainerHeightAutoSize, containerSize.height, eFlowStrategy,
- &uCurHAlignState, rgCurLineLayoutItems, false, FLT_MAX,
- FLT_MAX, fContentWidthLimit, &fContentCurRowY,
- &fContentCurRowAvailWidth, &fContentCurRowHeight,
- &bAddedItemInRow, &bForceEndPage, pContext, false);
- }
- } else {
- if (JudgeLeaderOrTrailerForOccur(pLeaderNode))
- AddPendingNode(this, pLeaderNode, true);
- }
-
- GotoNextContainerNode(m_pCurChildNode, m_nCurChildNodeStage,
- m_pFormNode, true);
- if (bCreatePage) {
- bForceEndPage = true;
- bIsManualBreak = true;
- if (m_nCurChildNodeStage == XFA_ItemLayoutProcessorStages::Done)
- bBreakDone = true;
- }
- goto SuspendAndCreateNewRow;
- }
- case XFA_ItemLayoutProcessorStages::BookendLeader: {
- CXFA_Node* pLeaderNode = nullptr;
- if (m_pCurChildPreprocessor) {
- pProcessor.reset(m_pCurChildPreprocessor);
- m_pCurChildPreprocessor = nullptr;
- } else if (m_pPageMgr &&
- m_pPageMgr->ProcessBookendLeaderOrTrailer(
- m_pCurChildNode, true, pLeaderNode)) {
- pProcessor = pdfium::MakeUnique<CXFA_ItemLayoutProcessor>(
- pLeaderNode, m_pPageMgr);
- }
-
- if (pProcessor) {
- if (InsertFlowedItem(
- this, pProcessor.get(), bContainerWidthAutoSize,
- bContainerHeightAutoSize, containerSize.height,
- eFlowStrategy, &uCurHAlignState, rgCurLineLayoutItems,
- bUseBreakControl, fAvailHeight, fRealHeight,
- fContentWidthLimit, &fContentCurRowY,
- &fContentCurRowAvailWidth, &fContentCurRowHeight,
- &bAddedItemInRow, &bForceEndPage, pContext,
- false) != XFA_ItemLayoutProcessorResult::Done) {
- goto SuspendAndCreateNewRow;
- } else {
- pProcessor.reset();
- }
- }
- break;
- }
- case XFA_ItemLayoutProcessorStages::BookendTrailer: {
- CXFA_Node* pTrailerNode = nullptr;
- if (m_pCurChildPreprocessor) {
- pProcessor.reset(m_pCurChildPreprocessor);
- m_pCurChildPreprocessor = nullptr;
- } else if (m_pPageMgr &&
- m_pPageMgr->ProcessBookendLeaderOrTrailer(
- m_pCurChildNode, false, pTrailerNode)) {
- pProcessor = pdfium::MakeUnique<CXFA_ItemLayoutProcessor>(
- pTrailerNode, m_pPageMgr);
- }
- if (pProcessor) {
- if (InsertFlowedItem(
- this, pProcessor.get(), bContainerWidthAutoSize,
- bContainerHeightAutoSize, containerSize.height,
- eFlowStrategy, &uCurHAlignState, rgCurLineLayoutItems,
- bUseBreakControl, fAvailHeight, fRealHeight,
- fContentWidthLimit, &fContentCurRowY,
- &fContentCurRowAvailWidth, &fContentCurRowHeight,
- &bAddedItemInRow, &bForceEndPage, pContext,
- false) != XFA_ItemLayoutProcessorResult::Done) {
- goto SuspendAndCreateNewRow;
- } else {
- pProcessor.reset();
- }
- }
- break;
- }
- case XFA_ItemLayoutProcessorStages::Container: {
- ASSERT(m_pCurChildNode->IsContainerNode());
- if (m_pCurChildNode->GetElementType() == XFA_Element::Variables)
- break;
- if (fContentCurRowY >= fHeightLimit + XFA_LAYOUT_FLOAT_PERCISION &&
- XFA_ItemLayoutProcessor_IsTakingSpace(m_pCurChildNode)) {
- bForceEndPage = true;
- goto SuspendAndCreateNewRow;
- }
- if (!m_pCurChildNode->IsContainerNode())
- break;
-
- bool bNewRow = false;
- if (m_pCurChildPreprocessor) {
- pProcessor.reset(m_pCurChildPreprocessor);
- m_pCurChildPreprocessor = nullptr;
- bNewRow = true;
- } else {
- pProcessor = pdfium::MakeUnique<CXFA_ItemLayoutProcessor>(
- m_pCurChildNode, m_pPageMgr);
- }
-
- InsertPendingItems(pProcessor.get(), m_pCurChildNode);
- XFA_ItemLayoutProcessorResult rs = InsertFlowedItem(
- this, pProcessor.get(), bContainerWidthAutoSize,
- bContainerHeightAutoSize, containerSize.height, eFlowStrategy,
- &uCurHAlignState, rgCurLineLayoutItems, bUseBreakControl,
- fAvailHeight, fRealHeight, fContentWidthLimit, &fContentCurRowY,
- &fContentCurRowAvailWidth, &fContentCurRowHeight,
- &bAddedItemInRow, &bForceEndPage, pContext, bNewRow);
- switch (rs) {
- case XFA_ItemLayoutProcessorResult::ManualBreak:
- bIsManualBreak = true;
- case XFA_ItemLayoutProcessorResult::PageFullBreak:
- bForceEndPage = true;
- case XFA_ItemLayoutProcessorResult::RowFullBreak:
- goto SuspendAndCreateNewRow;
- case XFA_ItemLayoutProcessorResult::Done:
- default:
- fContentCurRowY +=
- InsertPendingItems(pProcessor.get(), m_pCurChildNode);
- pProcessor.reset();
- }
- break;
- }
- case XFA_ItemLayoutProcessorStages::Done:
- break;
- default:
- break;
- }
- GotoNextContainerNode(m_pCurChildNode, m_nCurChildNodeStage, m_pFormNode,
- true);
- if (bAddedItemInRow && eFlowStrategy == XFA_ATTRIBUTEENUM_Tb)
- break;
- else
- continue;
- SuspendAndCreateNewRow:
- if (pProcessor)
- m_pCurChildPreprocessor = pProcessor.release();
- break;
- }
-
- CalculateRowChildPosition(
- rgCurLineLayoutItems, eFlowStrategy, bContainerHeightAutoSize,
- bContainerWidthAutoSize, &fContentCalculatedWidth,
- &fContentCalculatedHeight, &fContentCurRowY, fContentCurRowHeight,
- fContentWidthLimit, bRootForceTb);
- m_fWidthLimite = fContentCurRowAvailWidth;
- if (bForceEndPage)
- break;
- }
-
- bool bRetValue =
- m_nCurChildNodeStage == XFA_ItemLayoutProcessorStages::Done &&
- m_PendingNodes.empty();
- if (bBreakDone)
- bRetValue = false;
-
- containerSize = CalculateContainerComponentSizeFromContentSize(
- m_pFormNode, bContainerWidthAutoSize, fContentCalculatedWidth,
- bContainerHeightAutoSize, fContentCalculatedHeight, containerSize);
-
- if (containerSize.height >= XFA_LAYOUT_FLOAT_PERCISION || m_pLayoutItem ||
- bRetValue) {
- if (!m_pLayoutItem)
- m_pLayoutItem = CreateContentLayoutItem(m_pFormNode);
- containerSize.height = std::max(containerSize.height, 0.f);
-
- SetCurrentComponentSize(containerSize);
- if (bForceEndPage)
- m_fUsedSize = 0;
- else
- m_fUsedSize += m_pLayoutItem->m_sSize.height;
- }
-
- return bRetValue
- ? XFA_ItemLayoutProcessorResult::Done
- : (bIsManualBreak ? XFA_ItemLayoutProcessorResult::ManualBreak
- : XFA_ItemLayoutProcessorResult::PageFullBreak);
-}
-
-bool CXFA_ItemLayoutProcessor::CalculateRowChildPosition(
- CFX_ArrayTemplate<CXFA_ContentLayoutItem*> (&rgCurLineLayoutItems)[3],
- XFA_ATTRIBUTEENUM eFlowStrategy,
- bool bContainerHeightAutoSize,
- bool bContainerWidthAutoSize,
- FX_FLOAT* fContentCalculatedWidth,
- FX_FLOAT* fContentCalculatedHeight,
- FX_FLOAT* fContentCurRowY,
- FX_FLOAT fContentCurRowHeight,
- FX_FLOAT fContentWidthLimit,
- bool bRootForceTb) {
- int32_t nGroupLengths[3] = {0, 0, 0};
- FX_FLOAT fGroupWidths[3] = {0, 0, 0};
- int32_t nTotalLength = 0;
- for (int32_t i = 0; i < 3; i++) {
- nGroupLengths[i] = rgCurLineLayoutItems[i].GetSize();
- for (int32_t c = nGroupLengths[i], j = 0; j < c; j++) {
- nTotalLength++;
- if (XFA_ItemLayoutProcessor_IsTakingSpace(
- rgCurLineLayoutItems[i][j]->m_pFormNode)) {
- fGroupWidths[i] += rgCurLineLayoutItems[i][j]->m_sSize.width;
- }
- }
- }
-
- if (!nTotalLength) {
- if (bContainerHeightAutoSize) {
- *fContentCalculatedHeight =
- std::min(*fContentCalculatedHeight, *fContentCurRowY);
- }
- return false;
- }
-
- if (!m_pLayoutItem)
- m_pLayoutItem = CreateContentLayoutItem(m_pFormNode);
-
- if (eFlowStrategy != XFA_ATTRIBUTEENUM_Rl_tb) {
- FX_FLOAT fCurPos;
- fCurPos = 0;
- for (int32_t c = nGroupLengths[0], j = 0; j < c; j++) {
- if (bRootForceTb) {
- rgCurLineLayoutItems[0][j]->m_sPos = CalculatePositionedContainerPos(
- rgCurLineLayoutItems[0][j]->m_pFormNode,
- rgCurLineLayoutItems[0][j]->m_sSize);
- } else {
- rgCurLineLayoutItems[0][j]->m_sPos =
- CFX_PointF(fCurPos, *fContentCurRowY);
- if (XFA_ItemLayoutProcessor_IsTakingSpace(
- rgCurLineLayoutItems[0][j]->m_pFormNode)) {
- fCurPos += rgCurLineLayoutItems[0][j]->m_sSize.width;
- }
- }
- m_pLayoutItem->AddChild(rgCurLineLayoutItems[0][j]);
- m_fLastRowWidth = fCurPos;
- }
- fCurPos = (fContentWidthLimit + fGroupWidths[0] - fGroupWidths[1] -
- fGroupWidths[2]) /
- 2;
- for (int32_t c = nGroupLengths[1], j = 0; j < c; j++) {
- if (bRootForceTb) {
- rgCurLineLayoutItems[1][j]->m_sPos = CalculatePositionedContainerPos(
- rgCurLineLayoutItems[1][j]->m_pFormNode,
- rgCurLineLayoutItems[1][j]->m_sSize);
- } else {
- rgCurLineLayoutItems[1][j]->m_sPos =
- CFX_PointF(fCurPos, *fContentCurRowY);
- if (XFA_ItemLayoutProcessor_IsTakingSpace(
- rgCurLineLayoutItems[1][j]->m_pFormNode)) {
- fCurPos += rgCurLineLayoutItems[1][j]->m_sSize.width;
- }
- }
- m_pLayoutItem->AddChild(rgCurLineLayoutItems[1][j]);
- m_fLastRowWidth = fCurPos;
- }
- fCurPos = fContentWidthLimit - fGroupWidths[2];
- for (int32_t c = nGroupLengths[2], j = 0; j < c; j++) {
- if (bRootForceTb) {
- rgCurLineLayoutItems[2][j]->m_sPos = CalculatePositionedContainerPos(
- rgCurLineLayoutItems[2][j]->m_pFormNode,
- rgCurLineLayoutItems[2][j]->m_sSize);
- } else {
- rgCurLineLayoutItems[2][j]->m_sPos =
- CFX_PointF(fCurPos, *fContentCurRowY);
- if (XFA_ItemLayoutProcessor_IsTakingSpace(
- rgCurLineLayoutItems[2][j]->m_pFormNode)) {
- fCurPos += rgCurLineLayoutItems[2][j]->m_sSize.width;
- }
- }
- m_pLayoutItem->AddChild(rgCurLineLayoutItems[2][j]);
- m_fLastRowWidth = fCurPos;
- }
- } else {
- FX_FLOAT fCurPos;
- fCurPos = fGroupWidths[0];
- for (int32_t c = nGroupLengths[0], j = 0; j < c; j++) {
- if (XFA_ItemLayoutProcessor_IsTakingSpace(
- rgCurLineLayoutItems[0][j]->m_pFormNode)) {
- fCurPos -= rgCurLineLayoutItems[0][j]->m_sSize.width;
- }
- rgCurLineLayoutItems[0][j]->m_sPos =
- CFX_PointF(fCurPos, *fContentCurRowY);
- m_pLayoutItem->AddChild(rgCurLineLayoutItems[0][j]);
- m_fLastRowWidth = fCurPos;
- }
- fCurPos = (fContentWidthLimit + fGroupWidths[0] + fGroupWidths[1] -
- fGroupWidths[2]) /
- 2;
- for (int32_t c = nGroupLengths[1], j = 0; j < c; j++) {
- if (XFA_ItemLayoutProcessor_IsTakingSpace(
- rgCurLineLayoutItems[1][j]->m_pFormNode)) {
- fCurPos -= rgCurLineLayoutItems[1][j]->m_sSize.width;
- }
- rgCurLineLayoutItems[1][j]->m_sPos =
- CFX_PointF(fCurPos, *fContentCurRowY);
- m_pLayoutItem->AddChild(rgCurLineLayoutItems[1][j]);
- m_fLastRowWidth = fCurPos;
- }
- fCurPos = fContentWidthLimit;
- for (int32_t c = nGroupLengths[2], j = 0; j < c; j++) {
- if (XFA_ItemLayoutProcessor_IsTakingSpace(
- rgCurLineLayoutItems[2][j]->m_pFormNode)) {
- fCurPos -= rgCurLineLayoutItems[2][j]->m_sSize.width;
- }
- rgCurLineLayoutItems[2][j]->m_sPos =
- CFX_PointF(fCurPos, *fContentCurRowY);
- m_pLayoutItem->AddChild(rgCurLineLayoutItems[2][j]);
- m_fLastRowWidth = fCurPos;
- }
- }
- m_fLastRowY = *fContentCurRowY;
- *fContentCurRowY += fContentCurRowHeight;
- if (bContainerWidthAutoSize) {
- FX_FLOAT fChildSuppliedWidth = fGroupWidths[0];
- if (fContentWidthLimit < FLT_MAX &&
- fContentWidthLimit > fChildSuppliedWidth) {
- fChildSuppliedWidth = fContentWidthLimit;
- }
- *fContentCalculatedWidth =
- std::max(*fContentCalculatedWidth, fChildSuppliedWidth);
- }
- if (bContainerHeightAutoSize) {
- *fContentCalculatedHeight =
- std::max(*fContentCalculatedHeight, *fContentCurRowY);
- }
- return true;
-}
-
-CXFA_Node* CXFA_ItemLayoutProcessor::GetSubformSetParent(
- CXFA_Node* pSubformSet) {
- if (pSubformSet && pSubformSet->GetElementType() == XFA_Element::SubformSet) {
- CXFA_Node* pParent = pSubformSet->GetNodeItem(XFA_NODEITEM_Parent);
- while (pParent) {
- if (pParent->GetElementType() != XFA_Element::SubformSet)
- return pParent;
- pParent = pParent->GetNodeItem(XFA_NODEITEM_Parent);
- }
- }
- return pSubformSet;
-}
-
-void CXFA_ItemLayoutProcessor::DoLayoutField() {
- if (m_pLayoutItem)
- return;
-
- ASSERT(m_pCurChildNode == XFA_LAYOUT_INVALIDNODE);
- m_pLayoutItem = CreateContentLayoutItem(m_pFormNode);
- if (!m_pLayoutItem)
- return;
-
- CXFA_Document* pDocument = m_pFormNode->GetDocument();
- CXFA_FFNotify* pNotify = pDocument->GetNotify();
- CFX_SizeF size(-1, -1);
- pNotify->StartFieldDrawLayout(m_pFormNode, size.width, size.height);
-
- int32_t nRotate =
- FXSYS_round(m_pFormNode->GetMeasure(XFA_ATTRIBUTE_Rotate).GetValue());
- nRotate = XFA_MapRotation(nRotate);
- if (nRotate == 90 || nRotate == 270)
- std::swap(size.width, size.height);
-
- SetCurrentComponentSize(size);
-}
-
-XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayout(
- bool bUseBreakControl,
- FX_FLOAT fHeightLimit,
- FX_FLOAT fRealHeight,
- CXFA_LayoutContext* pContext) {
- switch (m_pFormNode->GetElementType()) {
- case XFA_Element::Subform:
- case XFA_Element::Area:
- case XFA_Element::ExclGroup:
- case XFA_Element::SubformSet: {
- bool bRootForceTb = false;
- CXFA_Node* pLayoutNode = GetSubformSetParent(m_pFormNode);
- XFA_ATTRIBUTEENUM eLayoutStrategy = GetLayout(pLayoutNode, &bRootForceTb);
- switch (eLayoutStrategy) {
- case XFA_ATTRIBUTEENUM_Tb:
- case XFA_ATTRIBUTEENUM_Lr_tb:
- case XFA_ATTRIBUTEENUM_Rl_tb:
- return DoLayoutFlowedContainer(bUseBreakControl, eLayoutStrategy,
- fHeightLimit, fRealHeight, pContext,
- bRootForceTb);
- case XFA_ATTRIBUTEENUM_Position:
- case XFA_ATTRIBUTEENUM_Row:
- case XFA_ATTRIBUTEENUM_Rl_row:
- default:
- DoLayoutPositionedContainer(pContext);
- m_nCurChildNodeStage = XFA_ItemLayoutProcessorStages::Done;
- return XFA_ItemLayoutProcessorResult::Done;
- case XFA_ATTRIBUTEENUM_Table:
- DoLayoutTableContainer(pLayoutNode);
- m_nCurChildNodeStage = XFA_ItemLayoutProcessorStages::Done;
- return XFA_ItemLayoutProcessorResult::Done;
- }
- }
- case XFA_Element::Draw:
- case XFA_Element::Field:
- DoLayoutField();
- m_nCurChildNodeStage = XFA_ItemLayoutProcessorStages::Done;
- return XFA_ItemLayoutProcessorResult::Done;
- case XFA_Element::ContentArea:
- return XFA_ItemLayoutProcessorResult::Done;
- default:
- return XFA_ItemLayoutProcessorResult::Done;
- }
-}
-
-CFX_SizeF CXFA_ItemLayoutProcessor::GetCurrentComponentSize() {
- return CFX_SizeF(m_pLayoutItem->m_sSize.width, m_pLayoutItem->m_sSize.height);
-}
-
-void CXFA_ItemLayoutProcessor::SetCurrentComponentPos(const CFX_PointF& pos) {
- m_pLayoutItem->m_sPos = pos;
-}
-
-void CXFA_ItemLayoutProcessor::SetCurrentComponentSize(const CFX_SizeF& size) {
- m_pLayoutItem->m_sSize = size;
-}
-
-bool CXFA_ItemLayoutProcessor::JudgeLeaderOrTrailerForOccur(
- CXFA_Node* pFormNode) {
- if (!pFormNode)
- return false;
-
- CXFA_Node* pTemplate = pFormNode->GetTemplateNode();
- if (!pTemplate)
- pTemplate = pFormNode;
-
- CXFA_Occur NodeOccur(pTemplate->GetFirstChildByClass(XFA_Element::Occur));
- int32_t iMax = NodeOccur.GetMax();
- if (iMax < 0)
- return true;
-
- int32_t iCount = m_PendingNodesCount[pTemplate];
- if (iCount >= iMax)
- return false;
-
- m_PendingNodesCount[pTemplate] = iCount + 1;
- return true;
-}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/xfa_layout_itemlayout.h b/chromium/third_party/pdfium/xfa/fxfa/parser/xfa_layout_itemlayout.h
deleted file mode 100644
index d411bf0e9fa..00000000000
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/xfa_layout_itemlayout.h
+++ /dev/null
@@ -1,188 +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 XFA_FXFA_PARSER_XFA_LAYOUT_ITEMLAYOUT_H_
-#define XFA_FXFA_PARSER_XFA_LAYOUT_ITEMLAYOUT_H_
-
-#include <float.h>
-
-#include <list>
-#include <map>
-#include <tuple>
-#include <vector>
-
-#include "core/fxcrt/fx_basic.h"
-#include "core/fxcrt/fx_coordinates.h"
-#include "xfa/fxfa/fxfa_basic.h"
-
-#define XFA_LAYOUT_INVALIDNODE ((CXFA_Node*)(intptr_t)-1)
-#define XFA_LAYOUT_FLOAT_PERCISION (0.0005f)
-
-class CXFA_ContainerLayoutItem;
-class CXFA_ContentLayoutItem;
-class CXFA_ItemLayoutProcessor;
-class CXFA_LayoutPageMgr;
-class CXFA_LayoutProcessor;
-class CXFA_Node;
-
-enum class XFA_ItemLayoutProcessorResult {
- Done,
- PageFullBreak,
- RowFullBreak,
- ManualBreak,
-};
-
-enum class XFA_ItemLayoutProcessorStages {
- None,
- BookendLeader,
- BreakBefore,
- Keep,
- Container,
- BreakAfter,
- BookendTrailer,
- Done,
-};
-
-class CXFA_LayoutContext {
- public:
- CXFA_LayoutContext()
- : m_prgSpecifiedColumnWidths(nullptr),
- m_fCurColumnWidth(0),
- m_bCurColumnWidthAvaiable(false),
- m_pOverflowProcessor(nullptr),
- m_pOverflowNode(nullptr) {}
- ~CXFA_LayoutContext() {}
-
- CFX_ArrayTemplate<FX_FLOAT>* m_prgSpecifiedColumnWidths;
- FX_FLOAT m_fCurColumnWidth;
- bool m_bCurColumnWidthAvaiable;
- CXFA_ItemLayoutProcessor* m_pOverflowProcessor;
- CXFA_Node* m_pOverflowNode;
-};
-
-bool XFA_ItemLayoutProcessor_IsTakingSpace(CXFA_Node* pNode);
-
-class CXFA_ItemLayoutProcessor {
- public:
- static bool IncrementRelayoutNode(CXFA_LayoutProcessor* pLayoutProcessor,
- CXFA_Node* pNode,
- CXFA_Node* pParentNode);
-
- CXFA_ItemLayoutProcessor(CXFA_Node* pNode, CXFA_LayoutPageMgr* pPageMgr);
- ~CXFA_ItemLayoutProcessor();
-
- XFA_ItemLayoutProcessorResult DoLayout(bool bUseBreakControl,
- FX_FLOAT fHeightLimit,
- FX_FLOAT fRealHeight,
- CXFA_LayoutContext* pContext);
- void DoLayoutPageArea(CXFA_ContainerLayoutItem* pPageAreaLayoutItem);
-
- CFX_SizeF GetCurrentComponentSize();
- CXFA_Node* GetFormNode() { return m_pFormNode; }
- bool HasLayoutItem() const { return !!m_pLayoutItem; }
- CXFA_ContentLayoutItem* ExtractLayoutItem();
- void SplitLayoutItem(FX_FLOAT fSplitPos);
-
- FX_FLOAT FindSplitPos(FX_FLOAT fProposedSplitPos);
-
- bool ProcessKeepForSplit(
- CXFA_ItemLayoutProcessor* pParentProcessor,
- CXFA_ItemLayoutProcessor* pChildProcessor,
- XFA_ItemLayoutProcessorResult eRetValue,
- CFX_ArrayTemplate<CXFA_ContentLayoutItem*>* rgCurLineLayoutItem,
- FX_FLOAT* fContentCurRowAvailWidth,
- FX_FLOAT* fContentCurRowHeight,
- FX_FLOAT* fContentCurRowY,
- bool* bAddedItemInRow,
- bool* bForceEndPage,
- XFA_ItemLayoutProcessorResult* result);
- void ProcessUnUseOverFlow(CXFA_Node* pLeaderNode,
- CXFA_Node* pTrailerNode,
- CXFA_ContentLayoutItem* pTrailerItem,
- CXFA_Node* pFormNode);
- bool IsAddNewRowForTrailer(CXFA_ContentLayoutItem* pTrailerItem);
- bool JudgeLeaderOrTrailerForOccur(CXFA_Node* pFormNode);
-
- CXFA_ContentLayoutItem* CreateContentLayoutItem(CXFA_Node* pFormNode);
-
- CXFA_Node* m_pFormNode;
- CXFA_ContentLayoutItem* m_pLayoutItem;
- CXFA_Node* m_pCurChildNode;
- FX_FLOAT m_fUsedSize;
- CXFA_LayoutPageMgr* m_pPageMgr;
- std::list<CXFA_Node*> m_PendingNodes;
- bool m_bBreakPending;
- CFX_ArrayTemplate<FX_FLOAT> m_rgSpecifiedColumnWidths;
- std::vector<CXFA_ContentLayoutItem*> m_arrayKeepItems;
- FX_FLOAT m_fLastRowWidth;
- FX_FLOAT m_fLastRowY;
- bool m_bUseInheriated;
- XFA_ItemLayoutProcessorResult m_ePreProcessRs;
-
- private:
- void SetCurrentComponentPos(const CFX_PointF& pos);
- void SetCurrentComponentSize(const CFX_SizeF& size);
-
- void SplitLayoutItem(CXFA_ContentLayoutItem* pLayoutItem,
- CXFA_ContentLayoutItem* pSecondParent,
- FX_FLOAT fSplitPos);
- FX_FLOAT InsertKeepLayoutItems();
- bool CalculateRowChildPosition(
- CFX_ArrayTemplate<CXFA_ContentLayoutItem*> (&rgCurLineLayoutItems)[3],
- XFA_ATTRIBUTEENUM eFlowStrategy,
- bool bContainerHeightAutoSize,
- bool bContainerWidthAutoSize,
- FX_FLOAT* fContentCalculatedWidth,
- FX_FLOAT* fContentCalculatedHeight,
- FX_FLOAT* fContentCurRowY,
- FX_FLOAT fContentCurRowHeight,
- FX_FLOAT fContentWidthLimit,
- bool bRootForceTb);
- void ProcessUnUseBinds(CXFA_Node* pFormNode);
- bool JudgePutNextPage(CXFA_ContentLayoutItem* pParentLayoutItem,
- FX_FLOAT fChildHeight,
- std::vector<CXFA_ContentLayoutItem*>* pKeepItems);
-
- void DoLayoutPositionedContainer(CXFA_LayoutContext* pContext);
- void DoLayoutTableContainer(CXFA_Node* pLayoutNode);
- XFA_ItemLayoutProcessorResult DoLayoutFlowedContainer(
- bool bUseBreakControl,
- XFA_ATTRIBUTEENUM eFlowStrategy,
- FX_FLOAT fHeightLimit,
- FX_FLOAT fRealHeight,
- CXFA_LayoutContext* pContext,
- bool bRootForceTb);
- void DoLayoutField();
-
- void GotoNextContainerNode(CXFA_Node*& pCurActionNode,
- XFA_ItemLayoutProcessorStages& nCurStage,
- CXFA_Node* pParentContainer,
- bool bUsePageBreak);
-
- bool ProcessKeepNodesForCheckNext(CXFA_Node*& pCurActionNode,
- XFA_ItemLayoutProcessorStages& nCurStage,
- CXFA_Node*& pNextContainer,
- bool& bLastKeepNode);
-
- bool ProcessKeepNodesForBreakBefore(CXFA_Node*& pCurActionNode,
- XFA_ItemLayoutProcessorStages& nCurStage,
- CXFA_Node* pContainerNode);
-
- CXFA_Node* GetSubformSetParent(CXFA_Node* pSubformSet);
-
- bool m_bKeepBreakFinish;
- bool m_bIsProcessKeep;
- CXFA_Node* m_pKeepHeadNode;
- CXFA_Node* m_pKeepTailNode;
- CXFA_ContentLayoutItem* m_pOldLayoutItem;
- CXFA_ItemLayoutProcessor* m_pCurChildPreprocessor;
- XFA_ItemLayoutProcessorStages m_nCurChildNodeStage;
- std::map<CXFA_Node*, int32_t> m_PendingNodesCount;
- FX_FLOAT m_fWidthLimite;
- bool m_bHasAvailHeight;
-};
-
-#endif // XFA_FXFA_PARSER_XFA_LAYOUT_ITEMLAYOUT_H_
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/xfa_locale.cpp b/chromium/third_party/pdfium/xfa/fxfa/parser/xfa_locale.cpp
deleted file mode 100644
index d835eb2bc7c..00000000000
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/xfa_locale.cpp
+++ /dev/null
@@ -1,394 +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
-
-#include "xfa/fxfa/parser/xfa_locale.h"
-
-#include <utility>
-
-#include "core/fxcrt/fx_xml.h"
-#include "xfa/fxfa/parser/cxfa_document.h"
-#include "xfa/fxfa/parser/xfa_localemgr.h"
-#include "xfa/fxfa/parser/xfa_object.h"
-#include "xfa/fxfa/parser/xfa_utils.h"
-
-static const FX_WCHAR g_FX_Percent[] = L"z,zzz,zzz,zzz,zzz,zzz%";
-static const FX_WCHAR g_FX_Currency[] = L"$z,zzz,zzz,zzz,zzz,zz9.99";
-static const FX_WCHAR g_FX_Decimal[] = L"z,zzz,zzz,zzz,zzz,zz9.zzz";
-static const FX_WCHAR g_FX_Integer[] = L"z,zzz,zzz,zzz,zzz,zzz";
-
-CXFA_XMLLocale::CXFA_XMLLocale(std::unique_ptr<CXML_Element> pLocaleData)
- : m_pLocaleData(std::move(pLocaleData)) {}
-
-CXFA_XMLLocale::~CXFA_XMLLocale() {}
-
-CFX_WideString CXFA_XMLLocale::GetName() const {
- return m_pLocaleData ? m_pLocaleData->GetAttrValue("name") : CFX_WideString();
-}
-
-void CXFA_XMLLocale::GetNumbericSymbol(FX_LOCALENUMSYMBOL eType,
- CFX_WideString& wsNumSymbol) const {
- CFX_ByteString bsSymbols;
- CFX_WideString wsName;
- switch (eType) {
- case FX_LOCALENUMSYMBOL_Decimal:
- bsSymbols = "numberSymbols";
- wsName = L"decimal";
- break;
- case FX_LOCALENUMSYMBOL_Grouping:
- bsSymbols = "numberSymbols";
- wsName = L"grouping";
- break;
- case FX_LOCALENUMSYMBOL_Percent:
- bsSymbols = "numberSymbols";
- wsName = L"percent";
- break;
- case FX_LOCALENUMSYMBOL_Minus:
- bsSymbols = "numberSymbols";
- wsName = L"minus";
- break;
- case FX_LOCALENUMSYMBOL_Zero:
- bsSymbols = "numberSymbols";
- wsName = L"zero";
- break;
- case FX_LOCALENUMSYMBOL_CurrencySymbol:
- bsSymbols = "currencySymbols";
- wsName = L"symbol";
- break;
- case FX_LOCALENUMSYMBOL_CurrencyName:
- bsSymbols = "currencySymbols";
- wsName = L"isoname";
- break;
- default:
- return;
- }
- CXML_Element* pElement = m_pLocaleData->GetElement("", bsSymbols.AsStringC());
- if (!pElement) {
- return;
- }
- GetPattern(pElement,
- CFX_ByteStringC(bsSymbols.c_str(), bsSymbols.GetLength() - 1),
- wsName.AsStringC(), wsNumSymbol);
-}
-
-void CXFA_XMLLocale::GetDateTimeSymbols(CFX_WideString& wsDtSymbol) const {
- if (!m_pLocaleData) {
- return;
- }
- CFX_ByteString bsSpace;
- CXML_Element* pNumberSymbols =
- m_pLocaleData->GetElement(bsSpace.AsStringC(), "dateTimeSymbols");
- if (!pNumberSymbols) {
- return;
- }
- wsDtSymbol = pNumberSymbols->GetContent(0);
-}
-
-void CXFA_XMLLocale::GetMonthName(int32_t nMonth,
- CFX_WideString& wsMonthName,
- bool bAbbr) const {
- wsMonthName = GetCalendarSymbol("month", nMonth, bAbbr);
-}
-
-void CXFA_XMLLocale::GetDayName(int32_t nWeek,
- CFX_WideString& wsDayName,
- bool bAbbr) const {
- wsDayName = GetCalendarSymbol("day", nWeek, bAbbr);
-}
-
-void CXFA_XMLLocale::GetMeridiemName(CFX_WideString& wsMeridiemName,
- bool bAM) const {
- wsMeridiemName = GetCalendarSymbol("meridiem", bAM ? 0 : 1, false);
-}
-
-void CXFA_XMLLocale::GetTimeZone(FX_TIMEZONE* tz) const {
- CXFA_TimeZoneProvider provider;
- provider.GetTimeZone(tz);
-}
-
-void CXFA_XMLLocale::GetEraName(CFX_WideString& wsEraName, bool bAD) const {
- wsEraName = GetCalendarSymbol("era", bAD ? 1 : 0, false);
-}
-
-CFX_WideString CXFA_XMLLocale::GetCalendarSymbol(const CFX_ByteStringC& symbol,
- int index,
- bool bAbbr) const {
- CFX_ByteString pstrSymbolNames = symbol + "Names";
- CFX_WideString wsSymbolName = L"";
- if (m_pLocaleData) {
- CXML_Element* pChild = m_pLocaleData->GetElement("", "calendarSymbols");
- if (pChild) {
- CXML_Element* pSymbolNames =
- pChild->GetElement("", pstrSymbolNames.AsStringC());
- if (pSymbolNames) {
- if ((!!pSymbolNames->GetAttrInteger("abbr")) != bAbbr) {
- pSymbolNames = pChild->GetElement("", pstrSymbolNames.AsStringC(), 1);
- }
- if (pSymbolNames && (!!pSymbolNames->GetAttrInteger("abbr")) == bAbbr) {
- CXML_Element* pSymbolName =
- pSymbolNames->GetElement("", symbol, index);
- if (pSymbolName) {
- wsSymbolName = pSymbolName->GetContent(0);
- }
- }
- }
- }
- }
- return wsSymbolName;
-}
-
-void CXFA_XMLLocale::GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY eType,
- CFX_WideString& wsPattern) const {
- CXML_Element* pElement = m_pLocaleData->GetElement("", "datePatterns");
- if (!pElement) {
- return;
- }
- CFX_WideString wsName;
- switch (eType) {
- case FX_LOCALEDATETIMESUBCATEGORY_Short:
- wsName = L"short";
- break;
- case FX_LOCALEDATETIMESUBCATEGORY_Default:
- case FX_LOCALEDATETIMESUBCATEGORY_Medium:
- wsName = L"med";
- break;
- case FX_LOCALEDATETIMESUBCATEGORY_Full:
- wsName = L"full";
- break;
- case FX_LOCALEDATETIMESUBCATEGORY_Long:
- wsName = L"long";
- break;
- }
- GetPattern(pElement, "datePattern", wsName.AsStringC(), wsPattern);
-}
-
-void CXFA_XMLLocale::GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY eType,
- CFX_WideString& wsPattern) const {
- CXML_Element* pElement = m_pLocaleData->GetElement("", "timePatterns");
- if (!pElement) {
- return;
- }
- CFX_WideString wsName;
- switch (eType) {
- case FX_LOCALEDATETIMESUBCATEGORY_Short:
- wsName = L"short";
- break;
- case FX_LOCALEDATETIMESUBCATEGORY_Default:
- case FX_LOCALEDATETIMESUBCATEGORY_Medium:
- wsName = L"med";
- break;
- case FX_LOCALEDATETIMESUBCATEGORY_Full:
- wsName = L"full";
- break;
- case FX_LOCALEDATETIMESUBCATEGORY_Long:
- wsName = L"long";
- break;
- }
- GetPattern(pElement, "timePattern", wsName.AsStringC(), wsPattern);
-}
-
-void CXFA_XMLLocale::GetNumPattern(FX_LOCALENUMSUBCATEGORY eType,
- CFX_WideString& wsPattern) const {
- CXML_Element* pElement = m_pLocaleData->GetElement("", "numberPatterns");
- if (!pElement) {
- return;
- }
- switch (eType) {
- case FX_LOCALENUMPATTERN_Percent:
- wsPattern = g_FX_Percent;
- break;
- case FX_LOCALENUMPATTERN_Currency:
- wsPattern = g_FX_Currency;
- break;
- case FX_LOCALENUMPATTERN_Decimal:
- wsPattern = g_FX_Decimal;
- break;
- case FX_LOCALENUMPATTERN_Integer:
- wsPattern = g_FX_Integer;
- break;
- }
-}
-
-void CXFA_XMLLocale::GetPattern(CXML_Element* pElement,
- const CFX_ByteStringC& bsTag,
- const CFX_WideStringC& wsName,
- CFX_WideString& wsPattern) const {
- int32_t iCount = pElement->CountElements("", bsTag);
- for (int32_t i = 0; i < iCount; i++) {
- CXML_Element* pChild = pElement->GetElement("", bsTag, i);
- if (pChild->GetAttrValue("name") == wsName) {
- wsPattern = pChild->GetContent(0);
- return;
- }
- }
-}
-
-CXFA_NodeLocale::CXFA_NodeLocale(CXFA_Node* pLocale) : m_pLocale(pLocale) {}
-
-CXFA_NodeLocale::~CXFA_NodeLocale() {}
-
-CFX_WideString CXFA_NodeLocale::GetName() const {
- return CFX_WideString(m_pLocale ? m_pLocale->GetCData(XFA_ATTRIBUTE_Name)
- : nullptr);
-}
-
-void CXFA_NodeLocale::GetNumbericSymbol(FX_LOCALENUMSYMBOL eType,
- CFX_WideString& wsNumSymbol) const {
- switch (eType) {
- case FX_LOCALENUMSYMBOL_Decimal:
- wsNumSymbol = GetSymbol(XFA_Element::NumberSymbols, L"decimal");
- break;
- case FX_LOCALENUMSYMBOL_Grouping:
- wsNumSymbol = GetSymbol(XFA_Element::NumberSymbols, L"grouping");
- break;
- case FX_LOCALENUMSYMBOL_Percent:
- wsNumSymbol = GetSymbol(XFA_Element::NumberSymbols, L"percent");
- break;
- case FX_LOCALENUMSYMBOL_Minus:
- wsNumSymbol = GetSymbol(XFA_Element::NumberSymbols, L"minus");
- break;
- case FX_LOCALENUMSYMBOL_Zero:
- wsNumSymbol = GetSymbol(XFA_Element::NumberSymbols, L"zero");
- break;
- case FX_LOCALENUMSYMBOL_CurrencySymbol:
- wsNumSymbol = GetSymbol(XFA_Element::CurrencySymbols, L"symbol");
- break;
- case FX_LOCALENUMSYMBOL_CurrencyName:
- wsNumSymbol = GetSymbol(XFA_Element::CurrencySymbols, L"isoname");
- break;
- }
-}
-
-void CXFA_NodeLocale::GetDateTimeSymbols(CFX_WideString& wsDtSymbol) const {
- CXFA_Node* pSymbols =
- m_pLocale ? m_pLocale->GetChild(0, XFA_Element::DateTimeSymbols)
- : nullptr;
- wsDtSymbol = pSymbols ? pSymbols->GetContent() : CFX_WideString();
-}
-
-void CXFA_NodeLocale::GetMonthName(int32_t nMonth,
- CFX_WideString& wsMonthName,
- bool bAbbr) const {
- wsMonthName = GetCalendarSymbol(XFA_Element::MonthNames, nMonth, bAbbr);
-}
-
-void CXFA_NodeLocale::GetDayName(int32_t nWeek,
- CFX_WideString& wsDayName,
- bool bAbbr) const {
- wsDayName = GetCalendarSymbol(XFA_Element::DayNames, nWeek, bAbbr);
-}
-
-void CXFA_NodeLocale::GetMeridiemName(CFX_WideString& wsMeridiemName,
- bool bAM) const {
- wsMeridiemName =
- GetCalendarSymbol(XFA_Element::MeridiemNames, bAM ? 0 : 1, false);
-}
-
-void CXFA_NodeLocale::GetTimeZone(FX_TIMEZONE* tz) const {
- CXFA_TimeZoneProvider provider;
- provider.GetTimeZone(tz);
-}
-
-void CXFA_NodeLocale::GetEraName(CFX_WideString& wsEraName, bool bAD) const {
- wsEraName = GetCalendarSymbol(XFA_Element::EraNames, bAD ? 1 : 0, false);
-}
-
-void CXFA_NodeLocale::GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY eType,
- CFX_WideString& wsPattern) const {
- switch (eType) {
- case FX_LOCALEDATETIMESUBCATEGORY_Short:
- wsPattern = GetSymbol(XFA_Element::DatePatterns, L"short");
- break;
- case FX_LOCALEDATETIMESUBCATEGORY_Medium:
- case FX_LOCALEDATETIMESUBCATEGORY_Default:
- wsPattern = GetSymbol(XFA_Element::DatePatterns, L"med");
- break;
- case FX_LOCALEDATETIMESUBCATEGORY_Full:
- wsPattern = GetSymbol(XFA_Element::DatePatterns, L"full");
- break;
- case FX_LOCALEDATETIMESUBCATEGORY_Long:
- wsPattern = GetSymbol(XFA_Element::DatePatterns, L"long");
- break;
- }
-}
-
-void CXFA_NodeLocale::GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY eType,
- CFX_WideString& wsPattern) const {
- switch (eType) {
- case FX_LOCALEDATETIMESUBCATEGORY_Short:
- wsPattern = GetSymbol(XFA_Element::TimePatterns, L"short");
- break;
- case FX_LOCALEDATETIMESUBCATEGORY_Medium:
- case FX_LOCALEDATETIMESUBCATEGORY_Default:
- wsPattern = GetSymbol(XFA_Element::TimePatterns, L"med");
- break;
- case FX_LOCALEDATETIMESUBCATEGORY_Full:
- wsPattern = GetSymbol(XFA_Element::TimePatterns, L"full");
- break;
- case FX_LOCALEDATETIMESUBCATEGORY_Long:
- wsPattern = GetSymbol(XFA_Element::TimePatterns, L"long");
- break;
- }
-}
-
-void CXFA_NodeLocale::GetNumPattern(FX_LOCALENUMSUBCATEGORY eType,
- CFX_WideString& wsPattern) const {
- switch (eType) {
- case FX_LOCALENUMPATTERN_Percent:
- wsPattern = g_FX_Percent;
- break;
- case FX_LOCALENUMPATTERN_Currency:
- wsPattern = g_FX_Currency;
- break;
- case FX_LOCALENUMPATTERN_Decimal:
- wsPattern = g_FX_Decimal;
- break;
- case FX_LOCALENUMPATTERN_Integer:
- wsPattern = g_FX_Integer;
- break;
- }
-}
-
-CXFA_Node* CXFA_NodeLocale::GetNodeByName(CXFA_Node* pParent,
- const CFX_WideStringC& wsName) const {
- CXFA_Node* pChild =
- pParent ? pParent->GetNodeItem(XFA_NODEITEM_FirstChild) : nullptr;
- while (pChild) {
- CFX_WideString wsChild;
- if (pChild->GetAttribute(XFA_ATTRIBUTE_Name, wsChild)) {
- if (wsChild == wsName) {
- return pChild;
- }
- }
- pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling);
- }
- return nullptr;
-}
-
-CFX_WideString CXFA_NodeLocale::GetSymbol(
- XFA_Element eElement,
- const CFX_WideStringC& symbol_type) const {
- CXFA_Node* pSymbols = m_pLocale ? m_pLocale->GetChild(0, eElement) : nullptr;
- CXFA_Node* pSymbol = GetNodeByName(pSymbols, symbol_type);
- return pSymbol ? pSymbol->GetContent() : CFX_WideString();
-}
-
-CFX_WideString CXFA_NodeLocale::GetCalendarSymbol(XFA_Element eElement,
- int index,
- bool bAbbr) const {
- CXFA_Node* pCalendar =
- m_pLocale ? m_pLocale->GetChild(0, XFA_Element::CalendarSymbols)
- : nullptr;
- if (pCalendar) {
- CXFA_Node* pNode = pCalendar->GetFirstChildByClass(eElement);
- for (; pNode; pNode = pNode->GetNextSameClassSibling(eElement)) {
- if (pNode->GetBoolean(XFA_ATTRIBUTE_Abbr) == bAbbr) {
- CXFA_Node* pSymbol = pNode->GetChild(index, XFA_Element::Unknown);
- return pSymbol ? pSymbol->GetContent() : CFX_WideString();
- }
- }
- }
- return CFX_WideString();
-}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/xfa_locale.h b/chromium/third_party/pdfium/xfa/fxfa/parser/xfa_locale.h
deleted file mode 100644
index 5326f513c1e..00000000000
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/xfa_locale.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 XFA_FXFA_PARSER_XFA_LOCALE_H_
-#define XFA_FXFA_PARSER_XFA_LOCALE_H_
-
-#include <memory>
-
-#include "xfa/fgas/localization/fgas_locale.h"
-#include "xfa/fxfa/parser/xfa_object.h"
-
-class CXFA_XMLLocale : public IFX_Locale {
- public:
- explicit CXFA_XMLLocale(std::unique_ptr<CXML_Element> pLocaleData);
- ~CXFA_XMLLocale() override;
-
- // IFX_Locale
- CFX_WideString GetName() const override;
- void GetNumbericSymbol(FX_LOCALENUMSYMBOL eType,
- CFX_WideString& wsNumSymbol) const override;
-
- void GetDateTimeSymbols(CFX_WideString& wsDtSymbol) const override;
- void GetMonthName(int32_t nMonth,
- CFX_WideString& wsMonthName,
- bool bAbbr = true) const override;
- void GetDayName(int32_t nWeek,
- CFX_WideString& wsDayName,
- bool bAbbr = true) const override;
- void GetMeridiemName(CFX_WideString& wsMeridiemName,
- bool bAM = true) const override;
- void GetTimeZone(FX_TIMEZONE* tz) const override;
- void GetEraName(CFX_WideString& wsEraName, bool bAD = true) const override;
-
- void GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY eType,
- CFX_WideString& wsPattern) const override;
- void GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY eType,
- CFX_WideString& wsPattern) const override;
- void GetNumPattern(FX_LOCALENUMSUBCATEGORY eType,
- CFX_WideString& wsPattern) const override;
-
- protected:
- void GetPattern(CXML_Element* pElement,
- const CFX_ByteStringC& bsTag,
- const CFX_WideStringC& wsName,
- CFX_WideString& wsPattern) const;
- CFX_WideString GetCalendarSymbol(const CFX_ByteStringC& symbol,
- int index,
- bool bAbbr) const;
-
- private:
- std::unique_ptr<CXML_Element> m_pLocaleData;
-};
-
-class CXFA_NodeLocale : public IFX_Locale {
- public:
- explicit CXFA_NodeLocale(CXFA_Node* pLocale);
- ~CXFA_NodeLocale() override;
-
- // IFX_Locale
- CFX_WideString GetName() const override;
- void GetNumbericSymbol(FX_LOCALENUMSYMBOL eType,
- CFX_WideString& wsNumSymbol) const override;
-
- void GetDateTimeSymbols(CFX_WideString& wsDtSymbol) const override;
- void GetMonthName(int32_t nMonth,
- CFX_WideString& wsMonthName,
- bool bAbbr = true) const override;
- void GetDayName(int32_t nWeek,
- CFX_WideString& wsDayName,
- bool bAbbr = true) const override;
- void GetMeridiemName(CFX_WideString& wsMeridiemName,
- bool bAM = true) const override;
- void GetTimeZone(FX_TIMEZONE* tz) const override;
- void GetEraName(CFX_WideString& wsEraName, bool bAD = true) const override;
-
- void GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY eType,
- CFX_WideString& wsPattern) const override;
- void GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY eType,
- CFX_WideString& wsPattern) const override;
- void GetNumPattern(FX_LOCALENUMSUBCATEGORY eType,
- CFX_WideString& wsPattern) const override;
-
- protected:
- CXFA_Node* GetNodeByName(CXFA_Node* pParent,
- const CFX_WideStringC& wsName) const;
- CFX_WideString GetSymbol(XFA_Element eElement,
- const CFX_WideStringC& symbol_type) const;
- CFX_WideString GetCalendarSymbol(XFA_Element eElement,
- int index,
- bool bAbbr) const;
-
- CXFA_Node* const m_pLocale;
-};
-
-#endif // XFA_FXFA_PARSER_XFA_LOCALE_H_
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/xfa_localemgr.cpp b/chromium/third_party/pdfium/xfa/fxfa/parser/xfa_localemgr.cpp
deleted file mode 100644
index 0cd64ea6dc6..00000000000
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/xfa_localemgr.cpp
+++ /dev/null
@@ -1,1274 +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
-
-#include "xfa/fxfa/parser/xfa_localemgr.h"
-
-#include <time.h>
-
-#include <memory>
-#include <utility>
-
-#include "core/fxcodec/fx_codec.h"
-#include "core/fxcrt/fx_xml.h"
-#include "core/fxge/cfx_gemodule.h"
-#include "xfa/fxfa/parser/cxfa_document.h"
-#include "xfa/fxfa/parser/xfa_locale.h"
-#include "xfa/fxfa/parser/xfa_object.h"
-#include "xfa/fxfa/parser/xfa_utils.h"
-
-const uint8_t g_enUS_Locale[] = {
- 0x78, 0x9C, 0x95, 0x56, 0xD1, 0x6E, 0x9B, 0x30, 0x14, 0x7D, 0x9F, 0xB4,
- 0x7F, 0x40, 0xD6, 0x2A, 0xB5, 0x52, 0x56, 0x6F, 0x8F, 0xA9, 0x88, 0xA5,
- 0x6C, 0x24, 0x9B, 0x3A, 0xD1, 0x55, 0x22, 0x55, 0xB5, 0xBE, 0x4C, 0x0E,
- 0xDC, 0x05, 0x34, 0xB0, 0x23, 0x83, 0x37, 0x05, 0xED, 0xE3, 0x67, 0x07,
- 0xC3, 0xC0, 0xF6, 0x24, 0xC2, 0x4B, 0x7C, 0xCF, 0x3D, 0xE7, 0xE6, 0xDE,
- 0x63, 0x30, 0x84, 0x25, 0x4F, 0x69, 0x09, 0x01, 0xA3, 0x15, 0xAC, 0x10,
- 0xB0, 0xEF, 0x4F, 0x09, 0x0A, 0x32, 0xA8, 0xD3, 0x15, 0xDA, 0xB0, 0x43,
- 0x59, 0xD4, 0xF9, 0xF5, 0xBA, 0x02, 0x51, 0xA4, 0xF4, 0x06, 0x91, 0x50,
- 0x53, 0x59, 0x46, 0x45, 0x72, 0xAA, 0xF6, 0xBC, 0xAC, 0x8D, 0xEA, 0x20,
- 0xE0, 0xC0, 0x45, 0x41, 0x99, 0x62, 0x54, 0x9C, 0x35, 0xF9, 0x83, 0x82,
- 0x6B, 0xB3, 0x26, 0xF7, 0x94, 0x49, 0x2A, 0x4E, 0x21, 0xEE, 0xC2, 0xD7,
- 0xAF, 0x0C, 0xBE, 0x85, 0xBD, 0xF0, 0x26, 0x62, 0x2A, 0xD2, 0xDC, 0x41,
- 0xD7, 0x47, 0x51, 0x94, 0x1E, 0xAE, 0xAB, 0xBF, 0x97, 0x0C, 0x3C, 0x60,
- 0xE9, 0x32, 0xD7, 0xF2, 0x20, 0xEB, 0xC6, 0x81, 0x13, 0x38, 0x36, 0x50,
- 0xED, 0x41, 0x38, 0x99, 0xAF, 0x69, 0xC3, 0x7D, 0xF8, 0x03, 0xFF, 0xE5,
- 0x17, 0x44, 0x90, 0xDA, 0x09, 0x3C, 0xB2, 0xA8, 0xE7, 0x9D, 0xA3, 0x80,
- 0xEE, 0xF7, 0x62, 0x85, 0xDE, 0xA3, 0x91, 0x73, 0x3E, 0xD7, 0x7C, 0x86,
- 0xF9, 0xEC, 0x9A, 0x6B, 0x96, 0xCF, 0x2B, 0x9F, 0x55, 0x3E, 0x9F, 0x7C,
- 0x0E, 0xF9, 0xDC, 0xF1, 0x19, 0xF3, 0x7F, 0x4F, 0x32, 0x7A, 0x32, 0xB7,
- 0x90, 0x5A, 0x91, 0x44, 0xAA, 0x5B, 0x4E, 0x75, 0xAE, 0xD7, 0x5D, 0x92,
- 0xC4, 0xDC, 0x81, 0x76, 0x12, 0x6A, 0x1B, 0x7B, 0x86, 0x8C, 0xB9, 0xE8,
- 0x2E, 0x97, 0xC2, 0x01, 0xB7, 0xA2, 0xB0, 0xA1, 0x84, 0x36, 0x52, 0x8C,
- 0x41, 0x3C, 0xF4, 0x35, 0xEA, 0x71, 0xB4, 0x6B, 0xA6, 0x59, 0xBB, 0x53,
- 0xBB, 0x4D, 0xBB, 0x45, 0xBB, 0x39, 0xBB, 0x2F, 0xBB, 0x29, 0x7F, 0x3F,
- 0xFA, 0x21, 0xCD, 0x0A, 0xA8, 0xFA, 0x67, 0xCF, 0x84, 0x64, 0x1D, 0x2B,
- 0x77, 0xFB, 0x60, 0xC4, 0x23, 0x8F, 0x56, 0x02, 0x4F, 0x2B, 0x28, 0x04,
- 0x04, 0x35, 0xD5, 0xD4, 0x8A, 0x7C, 0xF8, 0x18, 0x62, 0xFD, 0xDB, 0x25,
- 0xC8, 0x3A, 0x1A, 0x42, 0x3C, 0x10, 0x75, 0x60, 0x9D, 0x11, 0x5D, 0xE3,
- 0x0D, 0x3C, 0xD2, 0xA6, 0x01, 0xC1, 0xCE, 0x7B, 0x3A, 0x44, 0xE6, 0x00,
- 0xF9, 0x21, 0xCB, 0x12, 0x91, 0x8D, 0xBA, 0x16, 0x41, 0xAC, 0xAE, 0x20,
- 0x5A, 0x04, 0xDF, 0xD4, 0xA5, 0x27, 0x1C, 0xB8, 0x56, 0x21, 0x23, 0x2D,
- 0x39, 0x3B, 0x20, 0x72, 0xA1, 0xA8, 0x82, 0xEC, 0xAC, 0xB9, 0x40, 0x52,
- 0xE7, 0x5C, 0x34, 0x4A, 0x84, 0x23, 0xEC, 0xE1, 0xE3, 0xC9, 0x84, 0x0A,
- 0x68, 0x8A, 0x6A, 0x34, 0xF1, 0x28, 0x9A, 0x4C, 0x9C, 0xDF, 0xC5, 0xF1,
- 0x5D, 0x92, 0x04, 0xEB, 0xE0, 0x25, 0xC4, 0x23, 0x92, 0x55, 0x61, 0x32,
- 0xEA, 0x65, 0x9A, 0xF3, 0xA4, 0x83, 0x64, 0x86, 0xC0, 0xCC, 0xA9, 0x25,
- 0x1E, 0x3E, 0x9E, 0xCC, 0x65, 0x8C, 0xDA, 0x29, 0xAC, 0xDF, 0xEC, 0x4F,
- 0xA7, 0x38, 0xFB, 0xF9, 0xB9, 0xAA, 0x93, 0x4D, 0xB4, 0xFD, 0xFD, 0x4C,
- 0xF3, 0x2F, 0xED, 0x4B, 0x67, 0xCE, 0x98, 0xA4, 0x74, 0x4C, 0xEA, 0x53,
- 0xF1, 0x9F, 0x43, 0x93, 0xD8, 0xB4, 0xA2, 0x30, 0xFD, 0xE2, 0x41, 0xA4,
- 0x5D, 0xB4, 0xED, 0xF2, 0xB6, 0x6D, 0xDB, 0x10, 0x4F, 0x78, 0x4E, 0x21,
- 0x23, 0x4C, 0xA5, 0x10, 0xC0, 0xD2, 0x13, 0x22, 0x6F, 0x3A, 0xE9, 0x72,
- 0xF9, 0xE7, 0x7A, 0x58, 0xDE, 0xCC, 0xAC, 0x72, 0x04, 0x91, 0x02, 0x6B,
- 0xCC, 0xDF, 0x5F, 0x79, 0x54, 0xD8, 0x9A, 0x62, 0x28, 0xD4, 0x0F, 0x3A,
- 0x09, 0x4D, 0xD9, 0x0C, 0xD2, 0xA2, 0xA2, 0x6A, 0xF3, 0x6F, 0x7B, 0x7D,
- 0x97, 0xB6, 0xD5, 0xC3, 0xBB, 0x95, 0xCB, 0x63, 0xA1, 0x37, 0x7E, 0x31,
- 0x8B, 0x3F, 0x74, 0x7D, 0x35, 0x8B, 0x5E, 0x15, 0x4C, 0xD6, 0x88, 0xBC,
- 0x9D, 0x45, 0x6E, 0x41, 0x70, 0x44, 0xDE, 0xB9, 0x5C, 0x3C, 0x1D, 0x5B,
- 0x21, 0xFD, 0x16, 0x0C, 0x4E, 0x4C, 0x81, 0xFE, 0x66, 0x3B, 0x07, 0x6A,
- 0x9B, 0xD4, 0xA9, 0x31, 0xC9, 0xBB, 0x25, 0x8C, 0xA2, 0xA8, 0xB9, 0x5E,
- 0x20, 0xF2, 0x94, 0x44, 0xB3, 0x45, 0x63, 0xCB, 0x5D, 0x09, 0xB6, 0x7B,
- 0xD5, 0x58, 0xF7, 0x55, 0xA4, 0x96, 0x7F, 0x01, 0x75, 0x37, 0x1B, 0x8B,
-};
-const uint8_t g_enGB_Locale[] = {
- 0x78, 0x9C, 0x95, 0x56, 0xD1, 0x6E, 0xD3, 0x30, 0x14, 0x7D, 0x47, 0xE2,
- 0x1F, 0xA2, 0x88, 0x49, 0x20, 0x6D, 0x33, 0x3C, 0x6E, 0xEA, 0x2C, 0x75,
- 0xEB, 0xD6, 0x32, 0xC8, 0xA8, 0x48, 0xC5, 0xC4, 0x5E, 0x90, 0x9B, 0x78,
- 0x8D, 0x59, 0x62, 0x57, 0x4E, 0xCC, 0x94, 0xFC, 0x02, 0x9F, 0xC0, 0x23,
- 0xCF, 0x08, 0xF1, 0x01, 0xBC, 0xF0, 0x2F, 0x48, 0xFB, 0x0C, 0x6E, 0x1A,
- 0x27, 0x4B, 0x1C, 0xAF, 0x64, 0x79, 0x89, 0xEF, 0xB9, 0xE7, 0xDC, 0xDE,
- 0x7B, 0x9C, 0xB8, 0x19, 0xC5, 0x22, 0x20, 0x31, 0x75, 0x38, 0x49, 0xE8,
- 0x91, 0x4B, 0xF9, 0xA7, 0xE9, 0xB1, 0xEB, 0x84, 0x34, 0x0D, 0x8E, 0xDC,
- 0xBB, 0xAF, 0xBF, 0xEE, 0x7E, 0xFE, 0x78, 0x0E, 0xB7, 0xBF, 0xDF, 0x7E,
- 0xBF, 0x70, 0xF1, 0xA8, 0x24, 0xF2, 0x90, 0x48, 0x3F, 0x4F, 0x96, 0x22,
- 0x4E, 0xB5, 0x66, 0x25, 0xE9, 0x4A, 0x48, 0x46, 0x38, 0x30, 0x12, 0xC1,
- 0xB3, 0xE8, 0x02, 0xE0, 0x54, 0xAF, 0xF1, 0x39, 0xE1, 0x8A, 0xC8, 0x7C,
- 0x84, 0xAA, 0xF0, 0xE9, 0x13, 0x8D, 0x9F, 0xD1, 0xA5, 0xB4, 0x26, 0x3C,
- 0x22, 0x83, 0xA8, 0x87, 0x8E, 0xD7, 0x92, 0xC5, 0x16, 0x6E, 0x5F, 0x7F,
- 0xAE, 0x38, 0xB5, 0x80, 0x71, 0x9F, 0x39, 0x56, 0x2B, 0x95, 0x66, 0x3D,
- 0xD8, 0xA7, 0xEB, 0x8C, 0x26, 0x4B, 0x2A, 0x7B, 0x99, 0x77, 0x41, 0x26,
- 0x6C, 0xF8, 0x85, 0xF8, 0x62, 0x17, 0x4C, 0x68, 0x60, 0x26, 0x50, 0xCB,
- 0xA2, 0x9A, 0xB7, 0x89, 0x1C, 0xB2, 0x5C, 0xCA, 0x23, 0xF7, 0x95, 0xDB,
- 0x72, 0xCE, 0xE6, 0x9A, 0xCD, 0x30, 0x9B, 0x5D, 0x43, 0xCD, 0xB2, 0x79,
- 0x65, 0xB3, 0xCA, 0xE6, 0x93, 0xCD, 0x21, 0x9B, 0x3B, 0x36, 0x63, 0x1E,
- 0xF6, 0x24, 0x24, 0xB9, 0x7E, 0x84, 0x60, 0x85, 0x7D, 0x05, 0x8F, 0x1C,
- 0x74, 0x5E, 0xAE, 0xAB, 0x24, 0xF6, 0x44, 0x0F, 0x5A, 0x28, 0x9A, 0x9A,
- 0xD8, 0x25, 0x0D, 0x79, 0x1F, 0x5D, 0x44, 0x4A, 0xF6, 0xC0, 0x33, 0xC9,
- 0x4C, 0xC8, 0x27, 0x99, 0x92, 0x6D, 0x10, 0x35, 0x7D, 0xB5, 0x7A, 0x6C,
- 0xED, 0x9A, 0x6E, 0xD6, 0xEC, 0xD4, 0x6C, 0xD3, 0x6C, 0xD1, 0x6C, 0xCE,
- 0xEC, 0xCB, 0x6C, 0xCA, 0xDE, 0x4F, 0x42, 0x61, 0x02, 0x46, 0x93, 0xFA,
- 0xDD, 0xD3, 0x21, 0x1E, 0x7B, 0xE0, 0x6E, 0x1D, 0xB4, 0x78, 0x78, 0x6E,
- 0x24, 0x50, 0xB7, 0x02, 0x20, 0x54, 0x12, 0x5D, 0x0D, 0x56, 0xF8, 0xF8,
- 0x64, 0x84, 0xCA, 0x7B, 0x95, 0xC0, 0xE3, 0x49, 0x13, 0xA2, 0x86, 0x58,
- 0x06, 0xC6, 0x19, 0x51, 0x35, 0x9E, 0xD1, 0x39, 0xC9, 0x32, 0x2A, 0xF9,
- 0x66, 0x4F, 0x9B, 0x48, 0x1F, 0x20, 0xD7, 0x2A, 0x8E, 0x5D, 0x7C, 0x0A,
- 0xD7, 0xAE, 0x33, 0x71, 0x3C, 0xB8, 0x9C, 0x8F, 0x70, 0x95, 0x03, 0x36,
- 0x54, 0xA3, 0x8E, 0x56, 0xC6, 0x82, 0xAF, 0x5C, 0xFC, 0x38, 0x4D, 0x42,
- 0x43, 0x2D, 0x19, 0xAA, 0x48, 0x23, 0x21, 0x33, 0xD0, 0x4C, 0x90, 0xE7,
- 0x21, 0xAB, 0x06, 0x75, 0x46, 0x04, 0x20, 0x63, 0x49, 0x6B, 0xE4, 0x56,
- 0xD4, 0x19, 0x79, 0x36, 0x3B, 0xF4, 0xBC, 0x43, 0xDF, 0x77, 0xAE, 0x46,
- 0xA8, 0xC5, 0x31, 0x0A, 0x74, 0x66, 0x7D, 0x94, 0x64, 0x33, 0x6A, 0xAD,
- 0x18, 0xC0, 0xD7, 0x83, 0x6E, 0x14, 0x3D, 0x3A, 0xEA, 0xCC, 0xA4, 0x8D,
- 0x5A, 0x00, 0x56, 0xEF, 0xF4, 0x34, 0xF7, 0xC2, 0x9B, 0x59, 0x92, 0xFA,
- 0xA7, 0x93, 0xB3, 0xDB, 0x4B, 0x12, 0xBD, 0x29, 0xAE, 0x2A, 0x63, 0xDA,
- 0x24, 0xD0, 0x71, 0x55, 0x1E, 0x89, 0xF7, 0xEE, 0x74, 0x62, 0xDD, 0x09,
- 0x60, 0xF0, 0x38, 0x06, 0x2E, 0x2E, 0x76, 0x8B, 0xE2, 0x60, 0xBF, 0x28,
- 0x8A, 0x11, 0xEA, 0xF0, 0x7A, 0x85, 0xB4, 0x30, 0x50, 0x52, 0x52, 0x1E,
- 0xE4, 0x2E, 0x7E, 0x56, 0x49, 0x0F, 0x0E, 0x06, 0x2A, 0xD7, 0x54, 0x06,
- 0x94, 0x67, 0xFA, 0x27, 0x77, 0x2C, 0x2A, 0x64, 0x74, 0xDE, 0x14, 0xAA,
- 0x87, 0xEB, 0x84, 0xBA, 0x6C, 0x48, 0x03, 0x96, 0x10, 0xD8, 0xEC, 0xFD,
- 0x5A, 0x5F, 0xA5, 0x4D, 0x75, 0xF3, 0x67, 0x2A, 0xD4, 0x9A, 0x95, 0x3B,
- 0xBD, 0x3B, 0x88, 0xDF, 0x74, 0xBD, 0x33, 0x88, 0x9E, 0x30, 0xAE, 0x52,
- 0x17, 0xEF, 0x0D, 0x22, 0x17, 0x54, 0x0A, 0x17, 0xBF, 0xEC, 0x73, 0x51,
- 0x77, 0x6C, 0x40, 0x6A, 0xDB, 0x1B, 0x27, 0xBA, 0x40, 0xFD, 0x7C, 0x6D,
- 0x02, 0x17, 0xFF, 0xF9, 0x0E, 0xE7, 0x44, 0x87, 0xD0, 0xAF, 0xA1, 0x25,
- 0x2C, 0x15, 0xE5, 0xC2, 0xC5, 0xD3, 0xE3, 0xF9, 0x60, 0x51, 0xDB, 0xF3,
- 0xBE, 0x04, 0x99, 0xCD, 0x96, 0xEF, 0x42, 0xBE, 0xA6, 0xD7, 0x24, 0x28,
- 0x0F, 0xBB, 0x7A, 0xA9, 0x6B, 0x79, 0x39, 0x7C, 0xDA, 0x84, 0xCE, 0x1C,
- 0xAC, 0x40, 0x6D, 0x66, 0x9D, 0x66, 0x9C, 0x09, 0xFE, 0x60, 0xFA, 0x44,
- 0x28, 0xC9, 0xA8, 0x74, 0xFC, 0x2C, 0xB4, 0xE6, 0xC7, 0x21, 0x7C, 0x50,
- 0x38, 0x73, 0xF6, 0x1F, 0xC2, 0x0C, 0x3E, 0x96, 0xE8, 0xED, 0x16, 0xC2,
- 0x58, 0x92, 0x25, 0xBC, 0x2E, 0x0F, 0x13, 0x16, 0x11, 0x61, 0xD6, 0xF4,
- 0x1B, 0x51, 0xA8, 0x1B, 0xE2, 0x4C, 0x45, 0x16, 0xB1, 0xA0, 0x9C, 0x63,
- 0xEF, 0xC3, 0x6B, 0xC7, 0xDB, 0x46, 0x85, 0x91, 0x83, 0x48, 0xD4, 0xD4,
- 0xF7, 0x5B, 0x7E, 0x14, 0x98, 0xAB, 0x72, 0x32, 0xE7, 0xED, 0x16, 0x92,
- 0x2F, 0x06, 0x90, 0xBC, 0x5C, 0xF1, 0xD5, 0x67, 0xB1, 0xE1, 0xE9, 0xE6,
- 0xD0, 0xFD, 0x9E, 0x95, 0x51, 0xF5, 0x19, 0x0B, 0xCB, 0x7F, 0x8E, 0x69,
- 0xAC, 0xD0};
-const uint8_t g_zhCN_Locale[] = {
- 0x78, 0x9C, 0xED, 0x56, 0x41, 0x4F, 0xD4, 0x40, 0x14, 0xBE, 0x9B, 0xF8,
- 0x1F, 0x9A, 0x46, 0x52, 0x4D, 0x58, 0x46, 0x8F, 0x90, 0xD2, 0x64, 0x03,
- 0x08, 0x06, 0xBB, 0x21, 0x96, 0x68, 0xE0, 0x62, 0xBA, 0xED, 0xB0, 0x2D,
- 0x6C, 0x3B, 0x64, 0xB6, 0x0D, 0x6E, 0x4F, 0x18, 0x82, 0x82, 0xC2, 0x45,
- 0x89, 0x9A, 0x80, 0xE1, 0x64, 0x3C, 0x28, 0x9E, 0x8C, 0x01, 0x22, 0xF1,
- 0xCF, 0xB0, 0xCB, 0x91, 0xBF, 0xE0, 0x9B, 0xED, 0xB4, 0xB4, 0xDD, 0xD9,
- 0xB5, 0x3F, 0xC0, 0x3D, 0xCD, 0xFB, 0xDE, 0xF7, 0x7D, 0xF3, 0xDE, 0xEB,
- 0x74, 0xB6, 0x6A, 0x93, 0x58, 0x66, 0x13, 0x4B, 0xBE, 0xE9, 0xE1, 0x49,
- 0x39, 0x72, 0x9E, 0x4F, 0xD5, 0x64, 0xC9, 0xC6, 0x2D, 0x6B, 0x52, 0xBE,
- 0x3C, 0x3D, 0xE9, 0x7E, 0x78, 0x7D, 0xF7, 0xEA, 0xC7, 0xE6, 0xE5, 0xC5,
- 0xFB, 0xEB, 0xDF, 0x7B, 0x10, 0x77, 0x0E, 0x2F, 0xEE, 0xC9, 0x9A, 0xCA,
- 0x14, 0xBE, 0x6D, 0x52, 0xA3, 0xED, 0xD5, 0x49, 0xB3, 0xC5, 0xC5, 0x0D,
- 0x8A, 0x1B, 0x84, 0xBA, 0xA6, 0x0F, 0x0C, 0x8F, 0xF8, 0x81, 0x53, 0x03,
- 0xB8, 0xC5, 0xD7, 0xDA, 0xE5, 0xE9, 0x66, 0xF7, 0x68, 0x47, 0x45, 0x71,
- 0x74, 0xFB, 0x56, 0x02, 0x9F, 0xEF, 0x09, 0xE1, 0xD3, 0x5D, 0x11, 0xDC,
- 0x39, 0x3C, 0x14, 0x9B, 0x1C, 0x08, 0xD9, 0xDB, 0x27, 0x62, 0xEF, 0x2D,
- 0x31, 0xFB, 0x9B, 0x90, 0x7D, 0xF6, 0x59, 0xC8, 0xDE, 0x7F, 0x39, 0x00,
- 0x1E, 0xD0, 0x28, 0xCB, 0x14, 0x7B, 0x45, 0x99, 0x31, 0x25, 0xC4, 0x5E,
- 0x24, 0x99, 0xF5, 0x3A, 0x9D, 0x94, 0x1F, 0xC8, 0xFF, 0xA7, 0x57, 0x7A,
- 0x7A, 0xB6, 0xD9, 0xE6, 0x07, 0x0E, 0x56, 0x5A, 0xF7, 0xD3, 0x71, 0xF7,
- 0xE8, 0xB8, 0xFB, 0xF1, 0x8B, 0x8A, 0x58, 0x18, 0xE7, 0x39, 0x0A, 0x7B,
- 0x88, 0xD0, 0xF3, 0x3D, 0x21, 0x77, 0x57, 0x80, 0xC2, 0x24, 0x85, 0x0E,
- 0x07, 0x22, 0xEE, 0xF6, 0x49, 0x8A, 0xA2, 0xB4, 0xC8, 0x4C, 0xC1, 0x99,
- 0x87, 0xDD, 0x53, 0x15, 0x6A, 0x2E, 0x56, 0x5B, 0xAC, 0xB3, 0x58, 0x61,
- 0xB1, 0xB6, 0x62, 0x55, 0x03, 0xEB, 0xF1, 0x30, 0x75, 0x6D, 0x17, 0x7B,
- 0xC9, 0x6B, 0xCB, 0x43, 0xD8, 0xE0, 0x4D, 0x67, 0x9F, 0x0D, 0x3E, 0x01,
- 0x32, 0x5C, 0x48, 0xBE, 0xED, 0x4B, 0xA2, 0xBC, 0x13, 0x20, 0x98, 0x9A,
- 0xDC, 0x15, 0x56, 0x50, 0xC1, 0xF7, 0xCE, 0xF6, 0x56, 0x67, 0x77, 0x5F,
- 0x45, 0x2C, 0x8C, 0xF3, 0x1C, 0x4D, 0x21, 0x94, 0x6A, 0x58, 0x50, 0xB8,
- 0x71, 0xE2, 0x5E, 0x02, 0xBC, 0x60, 0x06, 0x01, 0xA6, 0x7E, 0xEF, 0x99,
- 0xA7, 0x11, 0xBF, 0x8E, 0x56, 0xC2, 0x66, 0x53, 0xD6, 0x96, 0xE0, 0xA7,
- 0x74, 0xCE, 0x7E, 0x2A, 0xBA, 0x02, 0xA7, 0x47, 0x99, 0x56, 0x60, 0xBC,
- 0xCA, 0x0C, 0xFC, 0x58, 0xEF, 0xA9, 0xA4, 0xE0, 0xC7, 0x1D, 0x9A, 0xC4,
- 0x6F, 0x0C, 0x70, 0x28, 0xA1, 0xF6, 0xB0, 0x1D, 0x8B, 0x2B, 0x7A, 0x65,
- 0xBA, 0x04, 0xBF, 0xE5, 0x10, 0x1A, 0x30, 0x85, 0x90, 0x8F, 0x72, 0xED,
- 0x02, 0x10, 0xB8, 0x5E, 0xA6, 0xFD, 0x4C, 0x94, 0x6B, 0xBF, 0xEA, 0x38,
- 0x50, 0xEF, 0x2F, 0x45, 0xD7, 0x95, 0xCE, 0xCE, 0x2B, 0xC5, 0x30, 0x94,
- 0xAB, 0xAF, 0xEF, 0x14, 0x69, 0x59, 0x45, 0x19, 0x45, 0xC1, 0x2E, 0xD7,
- 0xBD, 0xD8, 0xA0, 0x84, 0xBC, 0xD7, 0x3E, 0xA8, 0x27, 0x74, 0x7D, 0xC2,
- 0x30, 0x4A, 0x08, 0x78, 0xFF, 0x55, 0xA6, 0xE8, 0xA3, 0xA3, 0x5C, 0xBB,
- 0x7C, 0x7E, 0x8B, 0x80, 0x25, 0x07, 0x62, 0xD6, 0xF4, 0x57, 0xD7, 0xE6,
- 0xBC, 0x96, 0x31, 0x33, 0xFD, 0x70, 0xE3, 0xD9, 0x0B, 0x67, 0x3E, 0x5A,
- 0x8E, 0x67, 0x96, 0x25, 0x81, 0xCE, 0x0F, 0xBD, 0x3A, 0xA6, 0x37, 0x83,
- 0xCB, 0xC5, 0xBC, 0x12, 0xC0, 0xE0, 0x00, 0x5B, 0xB2, 0x16, 0x8D, 0x46,
- 0xD1, 0xF8, 0x58, 0x14, 0x45, 0x2A, 0xCA, 0xF1, 0xFA, 0x8C, 0xB8, 0xD0,
- 0x0A, 0x29, 0xC5, 0xBE, 0xD5, 0x96, 0xB5, 0x3B, 0xB1, 0x74, 0x7C, 0xBC,
- 0xA4, 0x72, 0x1D, 0x53, 0x0B, 0xFB, 0x01, 0xDF, 0x72, 0x44, 0xA0, 0x42,
- 0x85, 0xCA, 0x53, 0xA3, 0xA4, 0xB9, 0x5C, 0xC8, 0x6D, 0x6D, 0x6C, 0xB9,
- 0x9E, 0x09, 0xE7, 0x60, 0x2C, 0xD1, 0xC7, 0xE9, 0xA2, 0x3A, 0xFD, 0x07,
- 0x27, 0xE1, 0xBA, 0xCB, 0x1E, 0xFB, 0x68, 0x29, 0x7E, 0x5A, 0xF5, 0x48,
- 0x29, 0xBA, 0xE7, 0xFA, 0x61, 0x4B, 0xD6, 0x2A, 0xA5, 0xC8, 0x11, 0xA6,
- 0x44, 0xD6, 0xEE, 0xF7, 0x73, 0x51, 0xBE, 0x6D, 0x40, 0x92, 0xB1, 0xA7,
- 0x93, 0xC8, 0x03, 0xC9, 0xF9, 0xEA, 0x05, 0xB2, 0x76, 0xFD, 0x07, 0xEE,
- 0xD7, 0x3C, 0xA3, 0xDF, 0x84, 0x6B, 0xDC, 0x16, 0x61, 0x0B, 0x59, 0x9B,
- 0xAA, 0x2D, 0x95, 0x16, 0x65, 0x87, 0xDE, 0x2F, 0x41, 0xC5, 0x6A, 0xD9,
- 0xCB, 0xD0, 0x5E, 0xC7, 0x2B, 0xA6, 0xC5, 0xEE, 0xC7, 0x64, 0xC9, 0xBD,
- 0xAA, 0x36, 0xA9, 0x63, 0xC9, 0x80, 0x57, 0x51, 0x32, 0x02, 0x5B, 0x7A,
- 0x2C, 0xA3, 0x2C, 0x9F, 0x93, 0xF4, 0x36, 0x7C, 0x75, 0xD9, 0xD2, 0x02,
- 0x0C, 0x4C, 0x98, 0x76, 0x7D, 0x97, 0xF8, 0x03, 0xD3, 0x53, 0x24, 0xA4,
- 0x2E, 0xA6, 0xCC, 0x5F, 0x98, 0x8F, 0x4B, 0x58, 0x70, 0xFF, 0x41, 0x98,
- 0xC3, 0x75, 0x8A, 0x37, 0x86, 0x10, 0xAA, 0xD4, 0xAC, 0xC3, 0x4B, 0x35,
- 0x98, 0xB0, 0xE8, 0x98, 0xAE, 0x30, 0x3D, 0x4F, 0xA2, 0x70, 0xCD, 0x94,
- 0x66, 0x49, 0xE0, 0xB8, 0x16, 0xEB, 0xA3, 0xF2, 0xF4, 0x91, 0xA4, 0x0F,
- 0xA3, 0x42, 0xCB, 0x96, 0x43, 0x12, 0xEA, 0x93, 0x21, 0x9B, 0x02, 0x73,
- 0xD8, 0x68, 0x39, 0xA9, 0x1D, 0xFA, 0x8D, 0x55, 0xD2, 0xE3, 0xF1, 0x7D,
- 0xD1, 0xCD, 0x33, 0x63, 0x51, 0xFC, 0x15, 0x0D, 0xCB, 0xBF, 0xC0, 0xE4,
- 0x3D, 0x40};
-const uint8_t g_zhTW_Locale[] = {
- 0x78, 0x9C, 0xED, 0x57, 0xCD, 0x4F, 0xD4, 0x40, 0x14, 0x3F, 0x63, 0xE2,
- 0xFF, 0x30, 0x69, 0x20, 0xD5, 0x04, 0xA8, 0x1E, 0x21, 0xA5, 0xC9, 0xC6,
- 0x45, 0x30, 0x58, 0x42, 0xEC, 0x46, 0x22, 0x17, 0x33, 0xDB, 0x0E, 0xDB,
- 0xC2, 0xB6, 0x43, 0x66, 0xDB, 0xC0, 0xF6, 0x24, 0x12, 0x14, 0x14, 0x62,
- 0xA2, 0xC4, 0x8F, 0x80, 0xE1, 0x64, 0x3C, 0x28, 0x89, 0x07, 0x0F, 0x2C,
- 0x51, 0xFF, 0x1A, 0x76, 0x39, 0xFA, 0x2F, 0x38, 0xD3, 0x2F, 0xFA, 0xB1,
- 0xB3, 0xD4, 0xC4, 0xA3, 0x7B, 0x9A, 0xF7, 0xDE, 0xEF, 0xF7, 0xE6, 0xBD,
- 0xDF, 0xBC, 0x7D, 0xD9, 0x95, 0x9B, 0x58, 0x87, 0x4D, 0x04, 0x1C, 0x68,
- 0xA3, 0x29, 0xC1, 0x37, 0x1F, 0xD7, 0x16, 0x05, 0x60, 0xA0, 0x96, 0x3E,
- 0x25, 0x9C, 0x9F, 0x9E, 0xF4, 0xDE, 0x3E, 0xBF, 0x71, 0xD1, 0xD9, 0x3C,
- 0xFF, 0xF9, 0xE6, 0xF7, 0x8F, 0xBD, 0xEE, 0xAB, 0x6F, 0xBD, 0xCE, 0xAF,
- 0x9B, 0x82, 0x72, 0xFD, 0x1A, 0x00, 0x32, 0x63, 0x39, 0x06, 0x24, 0x5A,
- 0xDB, 0xAE, 0xE3, 0x66, 0x2B, 0x4A, 0xD0, 0x20, 0xA8, 0x81, 0x89, 0x05,
- 0x1D, 0x86, 0x1A, 0x02, 0xB2, 0x8D, 0x1D, 0xD7, 0x9C, 0xA7, 0xA1, 0x16,
- 0xB3, 0x87, 0x42, 0x5B, 0x39, 0x3F, 0x7D, 0xD2, 0x3B, 0xDA, 0x91, 0xA5,
- 0xD0, 0x4A, 0x07, 0xCE, 0xF6, 0x38, 0x81, 0xD3, 0xDD, 0xFE, 0x81, 0xEE,
- 0xE1, 0x21, 0x2F, 0xD5, 0x01, 0x87, 0xB1, 0x7D, 0xC2, 0xBB, 0x63, 0x8B,
- 0xC7, 0xF8, 0xC2, 0x61, 0x74, 0x3E, 0x72, 0x18, 0xFB, 0x9B, 0xDC, 0x00,
- 0xB7, 0x79, 0x16, 0xCB, 0xF7, 0x0F, 0xA2, 0x73, 0x22, 0x61, 0x5A, 0x52,
- 0x00, 0xEB, 0x75, 0x32, 0x25, 0xDC, 0x16, 0xFE, 0x6B, 0xFB, 0x8F, 0xB4,
- 0x35, 0x60, 0x3B, 0x35, 0xAC, 0xD4, 0x52, 0x7A, 0xEF, 0x8F, 0x7B, 0x47,
- 0xC7, 0xBD, 0x77, 0x9F, 0x64, 0x89, 0x99, 0x39, 0x3F, 0xBD, 0xAF, 0xBF,
- 0xFF, 0x6C, 0x8F, 0x83, 0xDF, 0xED, 0xEB, 0xA7, 0x4A, 0x73, 0xF2, 0x1C,
- 0xF4, 0xC7, 0x6F, 0x9F, 0x24, 0x7E, 0x10, 0x9C, 0xFA, 0x34, 0x91, 0x1B,
- 0x8F, 0x80, 0x5D, 0xE8, 0xA3, 0xD8, 0x41, 0xB1, 0xF6, 0x62, 0xD5, 0xC5,
- 0x7A, 0x8B, 0x95, 0x0E, 0xAC, 0xD1, 0x46, 0xC4, 0x32, 0x2C, 0x64, 0xA7,
- 0x57, 0x43, 0xE4, 0xA2, 0xD7, 0xBD, 0xE8, 0xEE, 0xB3, 0x87, 0x8A, 0x1D,
- 0xF9, 0xF0, 0xCB, 0x42, 0x18, 0x5C, 0x9A, 0xA9, 0x4B, 0x10, 0x81, 0xA9,
- 0xFC, 0xD4, 0xA2, 0x35, 0x7D, 0xED, 0x6E, 0x6F, 0x75, 0x77, 0xF7, 0x65,
- 0x89, 0x99, 0x39, 0x7F, 0xE2, 0x04, 0xC1, 0x29, 0xE6, 0xD2, 0x65, 0x27,
- 0xE5, 0xB6, 0x5D, 0xE8, 0x35, 0xA0, 0x8B, 0x16, 0xA0, 0xEB, 0x22, 0xE2,
- 0x24, 0xD2, 0x27, 0x9E, 0x68, 0x21, 0x2E, 0x7B, 0xCD, 0xA6, 0xA0, 0x3C,
- 0xA2, 0x1F, 0xB1, 0xDB, 0xF9, 0x2E, 0xAA, 0x22, 0x9D, 0x41, 0xB1, 0x2A,
- 0xD2, 0x87, 0x10, 0xA7, 0xE9, 0x87, 0xE9, 0x92, 0x50, 0x78, 0x39, 0x9A,
- 0xD8, 0x69, 0x70, 0x72, 0x94, 0xE2, 0xDB, 0xC8, 0x08, 0xE9, 0x92, 0x2A,
- 0x55, 0x4B, 0x31, 0x5A, 0x26, 0x26, 0x2E, 0x9F, 0x03, 0x40, 0xC6, 0x13,
- 0xC9, 0xE1, 0x5A, 0x76, 0x4E, 0x8E, 0x94, 0x27, 0x23, 0x47, 0xC5, 0x34,
- 0xC5, 0xDE, 0x87, 0xA7, 0xA2, 0xAA, 0x8A, 0xDD, 0x9D, 0x67, 0xA2, 0xA6,
- 0x89, 0x17, 0x9F, 0x5F, 0x8B, 0x60, 0x49, 0x96, 0x52, 0x0C, 0x5E, 0x8A,
- 0x50, 0x8D, 0xFE, 0x29, 0x4A, 0x25, 0x08, 0xE4, 0xA8, 0x00, 0x73, 0x52,
- 0x55, 0x27, 0x35, 0xAD, 0x14, 0x25, 0xD2, 0x23, 0x24, 0xE5, 0x19, 0x4C,
- 0x8D, 0x5C, 0xEF, 0xD1, 0x70, 0xD4, 0xA8, 0x37, 0x9E, 0x98, 0x19, 0xE8,
- 0xAC, 0xAC, 0xCE, 0xDA, 0x2D, 0x6D, 0xBA, 0x7A, 0x77, 0x7D, 0x71, 0xC3,
- 0x9C, 0xF3, 0x97, 0x42, 0x11, 0xD3, 0xA0, 0x80, 0xE9, 0x78, 0x76, 0x1D,
- 0x91, 0xAC, 0x92, 0x19, 0x5F, 0x54, 0x14, 0xF5, 0xD1, 0x99, 0xD7, 0x05,
- 0xC5, 0x1F, 0xF5, 0xFD, 0x89, 0x71, 0xDF, 0xF7, 0x65, 0x29, 0x83, 0xE3,
- 0x53, 0x75, 0x8F, 0x10, 0xE4, 0xE8, 0x6D, 0x41, 0x19, 0x0E, 0xC9, 0x13,
- 0x13, 0xA5, 0xB9, 0x6B, 0x88, 0xE8, 0xC8, 0x71, 0xA3, 0x6B, 0x47, 0x8A,
- 0x3C, 0xA6, 0x47, 0xA1, 0x87, 0xA4, 0xAF, 0xCB, 0x56, 0x87, 0xB2, 0xAE,
- 0x28, 0xBD, 0x81, 0x74, 0xCB, 0x86, 0x74, 0x48, 0xC6, 0xE3, 0x2C, 0x61,
- 0x98, 0x4B, 0x68, 0x10, 0xEC, 0xAD, 0x59, 0x6C, 0x26, 0x46, 0x4B, 0x32,
- 0x92, 0x0E, 0x46, 0x4A, 0x12, 0x6C, 0xCB, 0xF1, 0x5A, 0x82, 0x32, 0x56,
- 0x12, 0xEE, 0x23, 0x82, 0x05, 0xE5, 0x56, 0x01, 0x7D, 0x29, 0x4C, 0xE6,
- 0xBD, 0xE3, 0xC7, 0xC8, 0x28, 0x93, 0x75, 0xC6, 0x63, 0x18, 0x18, 0x82,
- 0x32, 0x5F, 0x1B, 0xA6, 0x2B, 0x29, 0x83, 0x18, 0xC0, 0xB2, 0x5A, 0x98,
- 0x1D, 0x04, 0xA5, 0xB6, 0x58, 0xFD, 0x0B, 0x5A, 0xFA, 0x21, 0x0A, 0xA4,
- 0x60, 0x27, 0x16, 0xEA, 0x66, 0x4B, 0xA0, 0xBD, 0x86, 0x96, 0xA1, 0x1E,
- 0xAF, 0xE0, 0xD8, 0x8C, 0x72, 0x56, 0x0C, 0x5C, 0x47, 0x40, 0xA5, 0xAF,
- 0x05, 0x34, 0xD7, 0x00, 0xF7, 0x05, 0xA9, 0x2F, 0x4C, 0x6D, 0xD3, 0x9F,
- 0x90, 0x06, 0x58, 0xA0, 0x32, 0x72, 0x00, 0x96, 0x63, 0x61, 0x67, 0x00,
- 0xE0, 0x0E, 0xF6, 0x88, 0x85, 0x08, 0xBB, 0x85, 0x83, 0x08, 0x4B, 0x59,
- 0xB0, 0xAE, 0x84, 0xCC, 0xA2, 0x3A, 0x41, 0xEB, 0x03, 0x21, 0x15, 0x02,
- 0xEB, 0xF4, 0x8B, 0x38, 0x08, 0x52, 0x33, 0xA1, 0xC5, 0x01, 0xCC, 0x61,
- 0xDF, 0x5B, 0x85, 0x60, 0x06, 0xBB, 0xA6, 0xA5, 0xB3, 0x9E, 0xC6, 0x1E,
- 0xDE, 0x03, 0xEA, 0x60, 0x30, 0x15, 0x40, 0x37, 0x71, 0x0C, 0x7E, 0x30,
- 0xF0, 0x6A, 0x0D, 0x5F, 0x21, 0x77, 0xF4, 0x2A, 0x6D, 0xCF, 0x69, 0xAC,
- 0xE0, 0x00, 0x19, 0xDE, 0x1E, 0x2C, 0xB6, 0xD4, 0x7B, 0xCA, 0x52, 0xF8,
- 0x67, 0x41, 0xF9, 0x03, 0x11, 0xC2, 0x4A, 0xC9};
-const uint8_t g_zhHK_Locale[] = {
- 0x78, 0x9C, 0xA5, 0x57, 0x4D, 0x4F, 0x13, 0x41, 0x18, 0x3E, 0x63, 0xE2,
- 0x7F, 0x98, 0x6C, 0x20, 0x0B, 0x09, 0x50, 0x8A, 0x9F, 0x25, 0xCB, 0x26,
- 0x44, 0x90, 0x9A, 0x5A, 0x43, 0x2C, 0xD1, 0xC8, 0xC5, 0x6C, 0x77, 0x87,
- 0xEE, 0x42, 0x77, 0x87, 0x4C, 0xB7, 0xC1, 0x6E, 0x3C, 0x88, 0x04, 0xA5,
- 0x5A, 0x2E, 0x4A, 0x54, 0x02, 0x86, 0x78, 0x50, 0x0F, 0x48, 0xBC, 0x78,
- 0x68, 0x89, 0xC6, 0x3F, 0x43, 0x8B, 0x9E, 0xFC, 0x0B, 0xCE, 0xEC, 0x17,
- 0xFB, 0x35, 0x6D, 0x8D, 0x3D, 0xCD, 0xFB, 0xBC, 0xCF, 0xF3, 0xCE, 0xFB,
- 0x3E, 0x33, 0x3B, 0x01, 0xA1, 0x8C, 0x64, 0xA9, 0x0C, 0x81, 0x21, 0xE9,
- 0x70, 0x9A, 0xB3, 0xD4, 0x87, 0xD9, 0x1C, 0x07, 0x14, 0x58, 0x91, 0xA7,
- 0xB9, 0xD3, 0xE6, 0x71, 0xE7, 0xCD, 0xF3, 0xE1, 0xB3, 0xD6, 0xC6, 0xE9,
- 0x8F, 0xD7, 0x7F, 0xBE, 0x37, 0x7E, 0x7F, 0xDA, 0xEB, 0x34, 0xBF, 0x9E,
- 0xD5, 0x5B, 0xED, 0xED, 0xA3, 0x5F, 0x1F, 0x1A, 0x9D, 0xDD, 0x9F, 0xED,
- 0xC6, 0xC9, 0x08, 0x27, 0x5E, 0xBC, 0x00, 0x80, 0x40, 0x8B, 0x18, 0x8A,
- 0x84, 0x0B, 0x35, 0xBD, 0x88, 0xCA, 0x15, 0xB7, 0x5E, 0x09, 0xC3, 0x12,
- 0xC2, 0x9A, 0x64, 0x50, 0xD6, 0x00, 0x10, 0x74, 0x64, 0x98, 0xEA, 0x1D,
- 0x92, 0xAA, 0xD0, 0x78, 0xC0, 0x89, 0xC5, 0xD3, 0xE6, 0x93, 0xCE, 0xC1,
- 0xB6, 0x90, 0x72, 0xA2, 0x60, 0xE2, 0xA4, 0xC1, 0x48, 0x34, 0xEB, 0xC9,
- 0x89, 0xF6, 0xFE, 0x3E, 0xAB, 0xD4, 0x2E, 0x43, 0xB1, 0x75, 0xCC, 0xDA,
- 0x63, 0x93, 0xA5, 0x38, 0x62, 0x28, 0x5A, 0xEF, 0x19, 0x8A, 0x9D, 0x0D,
- 0x66, 0x82, 0x39, 0x3C, 0xCD, 0x45, 0xE7, 0x07, 0xEE, 0xDA, 0xB7, 0x30,
- 0x68, 0x29, 0x90, 0x8A, 0x45, 0x3C, 0xCD, 0xA5, 0xB9, 0x60, 0x95, 0x74,
- 0x72, 0xF1, 0xC9, 0x64, 0xF8, 0x52, 0x32, 0x7C, 0x39, 0x19, 0xBE, 0x92,
- 0x0C, 0x5F, 0x4D, 0x86, 0xAF, 0x25, 0xC3, 0xD7, 0x93, 0xE1, 0x4C, 0x32,
- 0x9C, 0x9E, 0x60, 0xE0, 0x8C, 0x39, 0xD3, 0x93, 0x3D, 0x0D, 0x54, 0xA4,
- 0x5A, 0xE0, 0x46, 0x92, 0x48, 0xEC, 0xBC, 0x3B, 0xEC, 0x1C, 0x1C, 0x76,
- 0xDE, 0x7E, 0x14, 0x52, 0x34, 0x8C, 0xE0, 0xE4, 0xC0, 0x92, 0xF1, 0x93,
- 0x06, 0x83, 0x5F, 0x4F, 0xC4, 0xC9, 0x55, 0x65, 0xD4, 0xD9, 0x4D, 0xE6,
- 0x6F, 0x1D, 0xFB, 0x38, 0xB0, 0x57, 0x09, 0x43, 0x44, 0xEE, 0x80, 0xAD,
- 0x8E, 0xCD, 0x11, 0x9F, 0x20, 0xDE, 0x7B, 0xBC, 0xEB, 0x78, 0xBF, 0xF1,
- 0x4E, 0xBB, 0xF6, 0xA8, 0x43, 0xAC, 0x29, 0x1A, 0xD4, 0x83, 0xDF, 0xBF,
- 0x0B, 0x91, 0xED, 0x5E, 0xB4, 0x77, 0xE8, 0x41, 0x79, 0x40, 0x34, 0xFD,
- 0x32, 0x96, 0x06, 0xE7, 0x61, 0x60, 0x13, 0x88, 0xA5, 0x40, 0x7D, 0x12,
- 0x91, 0x9E, 0xBE, 0xB4, 0xB7, 0x36, 0xDB, 0xF5, 0x1D, 0x21, 0x45, 0xC3,
- 0x08, 0xEE, 0x83, 0xC0, 0x5E, 0x79, 0x5A, 0xF2, 0xA2, 0xA5, 0x22, 0x4F,
- 0x9A, 0x83, 0x2A, 0x92, 0x09, 0x17, 0x24, 0xD3, 0x84, 0xD8, 0xF0, 0xAD,
- 0xF7, 0x11, 0xF7, 0xD5, 0x5B, 0xAE, 0x96, 0xCB, 0x9C, 0xF8, 0x80, 0xFC,
- 0xF8, 0x76, 0xEB, 0x1B, 0x9F, 0xE7, 0xC9, 0x1D, 0xE4, 0x67, 0x79, 0x72,
- 0x10, 0x3C, 0x98, 0x23, 0x3F, 0x6A, 0x8C, 0xAF, 0x61, 0x15, 0x29, 0x23,
- 0xA3, 0xC4, 0x28, 0xD2, 0x97, 0x5E, 0x87, 0xCA, 0xFF, 0xC8, 0x2B, 0x2A,
- 0xC2, 0x26, 0x2D, 0xD0, 0x53, 0x0E, 0x40, 0x08, 0x71, 0x7D, 0x32, 0x35,
- 0x3D, 0xE2, 0x53, 0x00, 0x09, 0xF9, 0x34, 0xA3, 0xAA, 0x7C, 0x67, 0xEF,
- 0x29, 0x9F, 0xCF, 0xF3, 0xED, 0xED, 0x67, 0x7C, 0xA1, 0xC0, 0x9F, 0x7D,
- 0x7E, 0xC5, 0x83, 0x25, 0x21, 0x15, 0x50, 0xB0, 0x4A, 0x38, 0x2E, 0x25,
- 0x97, 0xE8, 0xAB, 0x80, 0x6D, 0x13, 0xD1, 0x4F, 0xE5, 0xF3, 0x53, 0x85,
- 0x42, 0x5F, 0x12, 0xD7, 0x9A, 0x19, 0xAA, 0x89, 0x0A, 0xA8, 0x19, 0x91,
- 0xD1, 0xDD, 0x4B, 0xB3, 0x48, 0x50, 0xEF, 0x26, 0xCD, 0x4B, 0xC6, 0xCA,
- 0x6A, 0x56, 0xAF, 0x14, 0xE6, 0x66, 0x6F, 0xAE, 0xDF, 0x7F, 0xA4, 0xE6,
- 0xAC, 0x25, 0xC7, 0xC3, 0x20, 0xC9, 0x56, 0x1A, 0x55, 0xBD, 0x08, 0x71,
- 0xD8, 0xC8, 0x10, 0xE6, 0xF6, 0x44, 0x30, 0xF2, 0x2D, 0xC8, 0x9C, 0x68,
- 0x8D, 0x5A, 0x56, 0x66, 0xDC, 0xB2, 0x2C, 0x21, 0x15, 0xE2, 0xB1, 0xA5,
- 0x72, 0x15, 0x63, 0x68, 0xC8, 0x35, 0x4E, 0x1C, 0x74, 0xC4, 0x99, 0xCC,
- 0xE3, 0x61, 0x7F, 0x39, 0xD2, 0x77, 0x9D, 0x35, 0x88, 0x65, 0x68, 0x98,
- 0x6E, 0x0B, 0x43, 0x71, 0x1D, 0xF5, 0x26, 0x36, 0x8F, 0x3F, 0xE3, 0xF9,
- 0xD8, 0x03, 0x61, 0xC8, 0x2D, 0xAF, 0x40, 0x59, 0xD3, 0x25, 0x72, 0x5F,
- 0xC6, 0xBD, 0x2A, 0x4E, 0x9A, 0x29, 0x28, 0x61, 0x54, 0x5D, 0xD3, 0xE8,
- 0xF5, 0x18, 0xED, 0x53, 0xE1, 0x4F, 0x30, 0xD4, 0xA7, 0x40, 0xD7, 0x8C,
- 0x6A, 0x85, 0x13, 0xC7, 0xFA, 0xA4, 0x5B, 0x10, 0x23, 0x4E, 0x9C, 0x88,
- 0xB1, 0xCF, 0x8D, 0x09, 0x9D, 0xBD, 0x77, 0x30, 0x21, 0x67, 0xC2, 0xA0,
- 0x77, 0x23, 0xED, 0x80, 0x13, 0xB3, 0xB9, 0x41, 0xF2, 0x6C, 0x85, 0x18,
- 0x5D, 0x54, 0x5A, 0x05, 0xD1, 0x05, 0x95, 0xCD, 0xFE, 0x83, 0x2C, 0x78,
- 0x10, 0x31, 0x91, 0xFD, 0x6E, 0xC6, 0xFA, 0xA6, 0xEF, 0x41, 0x6D, 0x0D,
- 0x2E, 0x4B, 0xB2, 0xF7, 0x4C, 0x7B, 0xA1, 0x5B, 0x73, 0x46, 0x41, 0x45,
- 0x08, 0xF2, 0xE4, 0xB4, 0x40, 0xC1, 0x54, 0xC0, 0x6D, 0x2E, 0x95, 0x48,
- 0xCB, 0xD7, 0xC8, 0xDF, 0x92, 0x0A, 0x58, 0x20, 0x36, 0x32, 0x08, 0x9A,
- 0xA1, 0x21, 0xA3, 0x0B, 0xE1, 0x06, 0xAA, 0x62, 0x0D, 0x62, 0xBA, 0x0B,
- 0x83, 0xE1, 0xB4, 0xB2, 0xA0, 0xF5, 0xA4, 0x64, 0x61, 0x11, 0xC3, 0xF5,
- 0xAE, 0x94, 0x19, 0x2C, 0x15, 0xC9, 0x47, 0xD9, 0x8D, 0xB2, 0xA8, 0x4A,
- 0x1A, 0x83, 0x90, 0x43, 0x56, 0x75, 0x55, 0x02, 0xF3, 0xC8, 0x54, 0x35,
- 0x99, 0xCE, 0x34, 0x76, 0xEF, 0x16, 0xC8, 0x77, 0x27, 0x13, 0x03, 0x64,
- 0x15, 0x79, 0xE4, 0xBB, 0x5D, 0xB7, 0x2E, 0xA0, 0x1E, 0x76, 0xBB, 0xA7,
- 0x52, 0xAB, 0x1A, 0xA5, 0x15, 0x64, 0x33, 0x9D, 0xDD, 0xED, 0x47, 0x2E,
- 0x70, 0x9E, 0x42, 0xCA, 0xF9, 0x27, 0x42, 0xFC, 0x0B, 0xD9, 0x0E, 0x4B,
- 0xED};
-const uint8_t g_jaJP_Locale[] = {
- 0x78, 0x9C, 0xED, 0x56, 0xCB, 0x6E, 0xD3, 0x40, 0x14, 0x5D, 0x17, 0x89,
- 0x7F, 0x18, 0x59, 0x20, 0x83, 0xD4, 0xD6, 0x0D, 0xEF, 0x56, 0xAE, 0xA5,
- 0x8A, 0x96, 0x86, 0x16, 0xA3, 0x08, 0x57, 0xA0, 0x76, 0x83, 0x26, 0xF6,
- 0x34, 0x99, 0x36, 0x9E, 0xA9, 0x26, 0xB6, 0x4A, 0xBC, 0xE2, 0x21, 0x20,
- 0x48, 0x74, 0x01, 0x1B, 0x04, 0x44, 0x62, 0x55, 0x40, 0x02, 0x04, 0x8B,
- 0x6E, 0xD8, 0xD0, 0xAF, 0x49, 0x5A, 0x56, 0xFC, 0x02, 0x33, 0x7E, 0xC5,
- 0x8E, 0xED, 0xE0, 0xEE, 0xF1, 0x22, 0x99, 0x7B, 0x7C, 0xCE, 0xF5, 0xBD,
- 0xE7, 0x8E, 0x47, 0x56, 0x5B, 0xD4, 0x84, 0x2D, 0x04, 0x08, 0xB4, 0xD1,
- 0xBC, 0xB4, 0x05, 0xEF, 0xAF, 0xD4, 0x24, 0x60, 0xA1, 0xB6, 0x39, 0x2F,
- 0x0D, 0xDE, 0xEC, 0x1F, 0x7F, 0xFF, 0x76, 0x8E, 0xFF, 0x0D, 0x7A, 0x5F,
- 0xCF, 0x4B, 0xDA, 0xE9, 0x53, 0x00, 0xA8, 0x82, 0x4C, 0x2C, 0xC8, 0x8C,
- 0x8E, 0x5D, 0xA7, 0xAD, 0x76, 0xA8, 0x6B, 0x30, 0xD4, 0xA0, 0x0C, 0x43,
- 0x22, 0x58, 0x13, 0x40, 0xB5, 0x29, 0x71, 0x9A, 0xB7, 0xF9, 0xAD, 0xB6,
- 0x88, 0x27, 0x82, 0x58, 0xAB, 0x0C, 0x7A, 0x5D, 0x55, 0x09, 0xD6, 0x09,
- 0xF8, 0x42, 0x3E, 0x7C, 0x31, 0x1F, 0xBE, 0x94, 0x0F, 0x5F, 0xCE, 0x87,
- 0xAF, 0xE4, 0xC3, 0x57, 0xF3, 0xE1, 0x6B, 0xF9, 0xF0, 0x6C, 0x3E, 0x5C,
- 0x99, 0x29, 0xC0, 0x0B, 0xFA, 0xAC, 0x8C, 0x34, 0x0A, 0xC2, 0x75, 0xEC,
- 0x53, 0xD2, 0x37, 0x00, 0xEB, 0x75, 0x36, 0x2F, 0x55, 0xA4, 0xFF, 0x06,
- 0x9E, 0xC4, 0x40, 0x0B, 0x76, 0x12, 0xDB, 0x8E, 0x47, 0x9A, 0xD8, 0xBE,
- 0xEF, 0x7B, 0xFC, 0x57, 0x55, 0x44, 0x38, 0xC4, 0x7B, 0xDD, 0x5C, 0xFC,
- 0xE8, 0xD1, 0x97, 0x7C, 0xFE, 0x8F, 0x83, 0x82, 0x3C, 0x9F, 0x73, 0xF1,
- 0xDF, 0xCF, 0x5F, 0xE5, 0xE2, 0xFD, 0xDE, 0x87, 0x11, 0x1C, 0xF8, 0xAB,
- 0x9C, 0x26, 0x46, 0xF6, 0x40, 0xD8, 0x4D, 0xB6, 0x8F, 0x6C, 0x07, 0xD9,
- 0xDA, 0xB3, 0x55, 0x67, 0xEB, 0xCD, 0x56, 0x5A, 0x5C, 0xA3, 0x8D, 0x18,
- 0xB6, 0x30, 0xB2, 0x93, 0x2F, 0x79, 0x08, 0x69, 0xFD, 0xBD, 0x6E, 0xFF,
- 0xC5, 0x1E, 0x1F, 0x4E, 0x04, 0x64, 0x6F, 0xFF, 0x7A, 0x99, 0xBE, 0x0D,
- 0x86, 0x61, 0xE2, 0x21, 0x88, 0xC1, 0x44, 0x7E, 0x1E, 0x69, 0x47, 0x07,
- 0x0F, 0xFB, 0x4F, 0x9F, 0xF8, 0xD9, 0x45, 0x18, 0xE3, 0xC7, 0xFB, 0x87,
- 0x83, 0x77, 0x1F, 0x63, 0x10, 0xF8, 0xAB, 0x48, 0xCB, 0x8F, 0x2D, 0x65,
- 0xE4, 0xDC, 0x0A, 0x50, 0x0B, 0x3A, 0xA8, 0x06, 0x1D, 0x07, 0x31, 0x12,
- 0x5B, 0x1F, 0x23, 0xE1, 0xD1, 0xB6, 0xE9, 0xB6, 0x5A, 0x92, 0xB6, 0xCE,
- 0x2F, 0xB9, 0xFF, 0xF3, 0x40, 0xD6, 0x65, 0x6E, 0xB8, 0xBC, 0x28, 0xF3,
- 0x41, 0xC8, 0x4B, 0xFC, 0x12, 0xBE, 0xC4, 0x92, 0xA2, 0x1C, 0x2D, 0x4A,
- 0x1A, 0x05, 0x39, 0x4A, 0xE9, 0x6D, 0x64, 0x05, 0x72, 0x45, 0xD7, 0x95,
- 0xC5, 0xC5, 0x52, 0x9A, 0x76, 0x93, 0x32, 0x47, 0xA8, 0xF2, 0x35, 0x00,
- 0xA4, 0x90, 0xD0, 0x10, 0x07, 0xDB, 0x23, 0x86, 0x24, 0x90, 0x94, 0x21,
- 0x55, 0x79, 0xF0, 0xF6, 0xB1, 0xAC, 0xEB, 0x72, 0xBF, 0xFB, 0x4C, 0x36,
- 0x0C, 0xF9, 0xE8, 0xD3, 0x6B, 0x79, 0x43, 0x55, 0x12, 0xF4, 0x22, 0x7D,
- 0x60, 0x46, 0x75, 0x4E, 0xD7, 0xE7, 0x0C, 0x63, 0xAE, 0x9C, 0xC6, 0x37,
- 0x20, 0x94, 0x94, 0x12, 0x84, 0xDD, 0x0B, 0xC9, 0x28, 0x5F, 0x74, 0x3E,
- 0xD2, 0x67, 0xB8, 0x15, 0xD6, 0x38, 0x1A, 0xED, 0x8F, 0x65, 0x48, 0xB6,
- 0xB6, 0xAB, 0x76, 0xDB, 0x58, 0x5A, 0xBC, 0xB1, 0x7B, 0xEF, 0x41, 0x73,
- 0xD5, 0xDB, 0x08, 0x0C, 0x4B, 0x92, 0x7C, 0x25, 0x71, 0xED, 0x3A, 0x62,
- 0x69, 0xD7, 0x52, 0x58, 0x58, 0x12, 0xC7, 0xF8, 0x0E, 0x37, 0x25, 0xCD,
- 0x9B, 0xF4, 0xBC, 0xD9, 0x69, 0xCF, 0xF3, 0x54, 0x25, 0xC5, 0x2B, 0x96,
- 0x9A, 0x2E, 0x63, 0x88, 0x98, 0x1D, 0x49, 0x3B, 0xE3, 0x8B, 0x4B, 0x0B,
- 0x77, 0x10, 0x33, 0x11, 0x71, 0xC2, 0x67, 0x9E, 0xCD, 0xEA, 0x84, 0x19,
- 0x99, 0x06, 0xE2, 0xA6, 0x86, 0x7D, 0x4E, 0xA4, 0xA1, 0x30, 0xBD, 0x85,
- 0x4C, 0x6C, 0x43, 0xBE, 0x1B, 0xA6, 0xA3, 0x2C, 0xC1, 0xED, 0x42, 0x41,
- 0x83, 0x51, 0x77, 0x07, 0x8B, 0xF9, 0x4F, 0x96, 0x54, 0xC4, 0x1D, 0x9C,
- 0x2D, 0x29, 0xB0, 0x31, 0x71, 0xDB, 0x92, 0x36, 0x55, 0x92, 0xEE, 0x21,
- 0x46, 0x25, 0x6D, 0x26, 0xC3, 0x1E, 0x1A, 0x93, 0x1A, 0x76, 0x34, 0x89,
- 0x94, 0x33, 0x69, 0x30, 0xDA, 0x81, 0x7E, 0x20, 0x69, 0x7F, 0x0E, 0xF9,
- 0x89, 0x9D, 0x66, 0x8C, 0x51, 0xE1, 0x36, 0x15, 0x0B, 0x49, 0x5B, 0xA9,
- 0xAD, 0x9F, 0x40, 0x96, 0x1C, 0x44, 0x46, 0xE4, 0x1F, 0x7F, 0x99, 0xBA,
- 0xC5, 0xDB, 0xDE, 0xD9, 0x41, 0x9B, 0xD0, 0x8C, 0x4E, 0xDB, 0x28, 0x0C,
- 0x73, 0xAE, 0x52, 0xCF, 0xDD, 0x86, 0x60, 0x99, 0x3A, 0x4D, 0x6C, 0x82,
- 0x1A, 0xA3, 0x53, 0x77, 0x6F, 0x02, 0x5D, 0x52, 0xC6, 0x91, 0x75, 0x4C,
- 0xCC, 0x26, 0x8D, 0xC8, 0x77, 0x0A, 0xC8, 0x7A, 0x87, 0x7F, 0x2A, 0x5A,
- 0x82, 0x55, 0x44, 0xC0, 0x04, 0x53, 0x32, 0x86, 0x70, 0x9D, 0xBA, 0x0C,
- 0x23, 0x06, 0x0C, 0xC7, 0x2A, 0x60, 0x2C, 0x58, 0xB4, 0x8E, 0x40, 0x0D,
- 0xFF, 0x93, 0x52, 0x45, 0x75, 0x86, 0x76, 0xC7, 0x52, 0x16, 0x18, 0xAC,
- 0xF3, 0x17, 0x77, 0x1C, 0x65, 0xAD, 0x09, 0xF1, 0x58, 0x02, 0x6F, 0xA9,
- 0x21, 0x6A, 0x01, 0xB7, 0xC6, 0xD2, 0x0C, 0x5A, 0x8A, 0xA6, 0x77, 0x5C,
- 0xD2, 0xD8, 0xA2, 0x3E, 0x33, 0x18, 0x89, 0x7F, 0xAA, 0x25, 0xE6, 0xA9,
- 0x2A, 0xC1, 0x87, 0xBD, 0xF6, 0x17, 0x6C, 0x42, 0x08, 0x21};
-const uint8_t g_koKR_Locale[] = {
- 0x78, 0x9C, 0xED, 0x56, 0x4D, 0x6B, 0xD4, 0x40, 0x18, 0x3E, 0x57, 0xF0,
- 0x3F, 0x0C, 0xC1, 0x12, 0x85, 0x76, 0xB7, 0xEB, 0x77, 0x4B, 0x1A, 0x28,
- 0x6E, 0x6D, 0x65, 0x8D, 0x94, 0xA6, 0x58, 0xEC, 0x45, 0x66, 0x93, 0xE9,
- 0x26, 0xED, 0x26, 0x53, 0x26, 0x09, 0x75, 0x73, 0xAE, 0x52, 0xF0, 0xE2,
- 0xA1, 0x87, 0xEA, 0x6E, 0xB1, 0x07, 0x11, 0x2A, 0x88, 0x22, 0x22, 0x1E,
- 0x14, 0x7F, 0x8D, 0x62, 0x6D, 0x8A, 0x7F, 0xC1, 0xC9, 0xE7, 0xE6, 0x63,
- 0xB2, 0x4D, 0xEF, 0xEE, 0x61, 0x99, 0xF7, 0x99, 0xE7, 0x79, 0xF3, 0xBE,
- 0xCF, 0x4C, 0x5E, 0x22, 0x74, 0xB1, 0x02, 0xBB, 0x08, 0x98, 0xD0, 0x40,
- 0xB3, 0xDC, 0x26, 0x7E, 0xDC, 0x5A, 0xE6, 0x80, 0x8A, 0x2C, 0x65, 0x96,
- 0xFB, 0x35, 0x38, 0x38, 0xFE, 0x34, 0xF8, 0xFD, 0xE1, 0xFD, 0xE5, 0xE3,
- 0xD7, 0x47, 0x3F, 0xFB, 0xDF, 0xAF, 0x70, 0xE2, 0xC5, 0x0B, 0x00, 0x08,
- 0x3E, 0xDF, 0x54, 0x21, 0x91, 0x7B, 0x46, 0x1B, 0x77, 0xAD, 0x48, 0xDA,
- 0x21, 0xA8, 0x83, 0x89, 0x0E, 0x4D, 0x9F, 0x35, 0x06, 0x04, 0x03, 0x9B,
- 0xB6, 0xF6, 0x80, 0x6E, 0x59, 0x7E, 0x3C, 0x16, 0xC6, 0x62, 0xC3, 0xEB,
- 0xEF, 0x09, 0xF5, 0x70, 0x9D, 0x82, 0xAF, 0xB2, 0xE1, 0x6B, 0x6C, 0xF8,
- 0x3A, 0x1B, 0xBE, 0xC1, 0x86, 0x6F, 0xB2, 0xE1, 0x5B, 0x6C, 0xF8, 0x36,
- 0x1B, 0x9E, 0x66, 0xC3, 0x8D, 0xA9, 0x12, 0xBC, 0xA4, 0xCF, 0x46, 0xAE,
- 0x51, 0x10, 0xAD, 0x13, 0x9F, 0xD2, 0xBE, 0x01, 0xD8, 0x6E, 0x93, 0x59,
- 0xAE, 0xC1, 0xFD, 0x37, 0xF0, 0x3C, 0x06, 0xAA, 0xB0, 0x97, 0xBA, 0x76,
- 0x34, 0x12, 0xBD, 0x83, 0x6F, 0xDE, 0xAB, 0x3D, 0xFA, 0x2F, 0xD4, 0xFD,
- 0x70, 0x88, 0xF7, 0xF7, 0x98, 0xF8, 0xE9, 0x4B, 0x36, 0xEE, 0xED, 0xEE,
- 0x33, 0xF1, 0x93, 0x77, 0x47, 0x4C, 0xFC, 0xCF, 0xD7, 0x5D, 0x76, 0xFE,
- 0x67, 0x87, 0x39, 0x1C, 0x04, 0x2B, 0x46, 0x13, 0xB9, 0x3B, 0x10, 0x75,
- 0x53, 0xEC, 0xA3, 0xD8, 0x41, 0xB1, 0xF6, 0x62, 0xD5, 0xC5, 0x7A, 0x8B,
- 0x95, 0x96, 0xD7, 0x68, 0x20, 0xA2, 0xAB, 0x3A, 0x32, 0xD2, 0x2F, 0x79,
- 0x04, 0x89, 0xDE, 0xFE, 0x1B, 0xEF, 0x70, 0x87, 0x1E, 0x4E, 0x0C, 0x14,
- 0xB6, 0x4F, 0xFB, 0xB9, 0x6D, 0x30, 0x0C, 0x53, 0x0F, 0x41, 0x04, 0xA6,
- 0xF2, 0xD3, 0x88, 0x56, 0xF9, 0xD1, 0xEB, 0xBF, 0x08, 0xB2, 0xFB, 0x61,
- 0x82, 0x7B, 0x3B, 0x03, 0xBA, 0x95, 0x80, 0x20, 0x58, 0xC5, 0x5A, 0x3A,
- 0xB6, 0xEA, 0xB9, 0xB9, 0x15, 0xA2, 0x2A, 0xB4, 0xD1, 0x12, 0xB4, 0x6D,
- 0x44, 0xCC, 0xC4, 0xFA, 0x04, 0x89, 0x46, 0xDB, 0xBA, 0xD3, 0xED, 0x72,
- 0xE2, 0x23, 0xFA, 0xE3, 0x4F, 0x9E, 0xEE, 0xF0, 0x40, 0xE2, 0xA9, 0xE3,
- 0x3C, 0x68, 0xF2, 0xF4, 0x28, 0x78, 0x30, 0x4F, 0x7F, 0xBE, 0x35, 0x89,
- 0xAA, 0x2C, 0x4D, 0x17, 0x9B, 0x9D, 0xD2, 0x34, 0x95, 0x32, 0x18, 0x48,
- 0x0D, 0x13, 0xD4, 0x80, 0x24, 0xD5, 0x40, 0xB3, 0x59, 0x49, 0x65, 0x69,
- 0x98, 0xD8, 0xBE, 0xAE, 0x4C, 0x05, 0x40, 0x06, 0x89, 0x9C, 0xB1, 0x75,
- 0x23, 0xE7, 0x4C, 0x0A, 0xC9, 0x38, 0x33, 0x07, 0x34, 0x8D, 0xF7, 0x9E,
- 0x0F, 0x68, 0x4B, 0x12, 0x7F, 0xF2, 0x85, 0xB6, 0x26, 0xCB, 0xBC, 0xF7,
- 0x79, 0x97, 0x07, 0x6B, 0x42, 0x3D, 0x25, 0x2A, 0xCB, 0x12, 0x1A, 0x53,
- 0x9A, 0xA5, 0x52, 0x8E, 0xC0, 0x1A, 0x9A, 0x62, 0x46, 0x92, 0x66, 0x64,
- 0xB9, 0x92, 0x24, 0xF2, 0x25, 0x14, 0xE5, 0x15, 0xBE, 0x27, 0x39, 0x07,
- 0xA2, 0xDB, 0xB2, 0x42, 0xD1, 0xF8, 0x0A, 0x2D, 0x40, 0x73, 0x63, 0x73,
- 0xD1, 0xB0, 0xE4, 0xF9, 0xE6, 0xDD, 0xED, 0xD5, 0x27, 0x5A, 0xCB, 0x5D,
- 0x0B, 0xAD, 0x4C, 0x93, 0x02, 0xA5, 0xE9, 0x18, 0x6D, 0x44, 0xB2, 0x7E,
- 0x66, 0xB0, 0xA8, 0x28, 0x8A, 0xD1, 0x97, 0x40, 0xE1, 0x44, 0x77, 0xC2,
- 0x75, 0xA7, 0x6B, 0xAE, 0xEB, 0x0A, 0xF5, 0x0C, 0xAF, 0x5C, 0xAA, 0x38,
- 0x84, 0x20, 0x53, 0xE9, 0x71, 0xE2, 0xA5, 0x40, 0x5C, 0x59, 0xB8, 0x85,
- 0x88, 0x82, 0x4C, 0x3B, 0x7A, 0xE6, 0x78, 0x51, 0xE7, 0x9B, 0x51, 0x68,
- 0x20, 0x69, 0x6A, 0xD8, 0xE7, 0x58, 0x16, 0x8A, 0xD2, 0xAB, 0x48, 0xD1,
- 0x0D, 0x48, 0xEF, 0x49, 0x2D, 0xCE, 0x12, 0x6E, 0x97, 0x0A, 0x3A, 0x04,
- 0x3B, 0x5B, 0xBA, 0x7F, 0x27, 0x26, 0x2A, 0x2A, 0x92, 0x0E, 0xC6, 0x2B,
- 0x0A, 0x0C, 0xDD, 0x74, 0x2C, 0x4E, 0x9C, 0xAC, 0x48, 0x77, 0x11, 0xC1,
- 0x9C, 0x38, 0x55, 0x60, 0x0F, 0x8D, 0xC9, 0x1C, 0x76, 0x7C, 0x12, 0x19,
- 0x67, 0xB2, 0x60, 0x7C, 0x07, 0x83, 0x80, 0x13, 0xFF, 0xFE, 0x78, 0x4B,
- 0x07, 0x54, 0x86, 0x31, 0x42, 0xA5, 0x5B, 0xD8, 0x5F, 0x70, 0x62, 0x6B,
- 0x79, 0xF5, 0x1C, 0xB2, 0xF4, 0x41, 0x14, 0x44, 0xC1, 0x84, 0x2C, 0xD4,
- 0xED, 0xCF, 0x81, 0xDE, 0x16, 0x5A, 0x87, 0x4A, 0x3C, 0x90, 0xE3, 0x30,
- 0xCA, 0x39, 0xA7, 0xE2, 0x36, 0x02, 0x52, 0xCF, 0x31, 0x3B, 0x1B, 0x18,
- 0xC8, 0xB6, 0x0A, 0x24, 0xAE, 0xCE, 0x64, 0x4A, 0x3D, 0xFA, 0x75, 0xA8,
- 0x82, 0x25, 0xEA, 0x64, 0x09, 0x41, 0x37, 0x75, 0x6C, 0x8E, 0x20, 0xDC,
- 0xC1, 0x0E, 0xD1, 0x11, 0xF1, 0x9F, 0x52, 0xC2, 0x08, 0xAB, 0x59, 0xD2,
- 0xCF, 0xA4, 0x2C, 0xA2, 0x36, 0x41, 0xDB, 0x23, 0x29, 0x73, 0x04, 0xB6,
- 0xE9, 0x8B, 0x38, 0x8A, 0xB2, 0xA2, 0x41, 0xBD, 0x84, 0xD0, 0xC2, 0xAE,
- 0xB3, 0x09, 0xC1, 0x02, 0xB6, 0x35, 0x5D, 0xF1, 0x7B, 0x9A, 0x7C, 0x78,
- 0xAF, 0xD4, 0x9A, 0x88, 0x4C, 0x0D, 0x50, 0x34, 0x1C, 0x93, 0x97, 0x47,
- 0x3E, 0x9A, 0x72, 0x3B, 0x81, 0xDD, 0xF7, 0x47, 0xD2, 0x64, 0x9C, 0xA1,
- 0x05, 0x53, 0x2D, 0x75, 0x9E, 0x42, 0x3D, 0xFC, 0xFC, 0x17, 0xFF, 0x01,
- 0xDC, 0xF1, 0x18, 0xD3};
-const uint8_t g_esES_Locale[] = {
- 0x78, 0x9C, 0x9D, 0x56, 0xCF, 0x6B, 0xD4, 0x40, 0x14, 0xBE, 0x0B, 0xFE,
- 0x0F, 0x21, 0x58, 0x56, 0xA1, 0xDD, 0xD1, 0x63, 0xCB, 0x36, 0x50, 0xDA,
- 0xDA, 0x95, 0x1A, 0x59, 0x9A, 0xAA, 0xD8, 0x8B, 0x4C, 0x92, 0xE9, 0xEE,
- 0xB4, 0xC9, 0xCC, 0x32, 0x49, 0x2C, 0x9B, 0xA3, 0xE0, 0x41, 0x10, 0x0B,
- 0xDE, 0x8A, 0x27, 0x0F, 0x1E, 0x04, 0x8B, 0x77, 0x51, 0x3C, 0xF4, 0x3F,
- 0x11, 0x6A, 0xEB, 0xC9, 0x7F, 0xC1, 0x37, 0x9B, 0x49, 0x36, 0x3F, 0x66,
- 0xD7, 0x60, 0x4E, 0xF3, 0xBE, 0xF7, 0x7D, 0x2F, 0xEF, 0x7D, 0x93, 0x4C,
- 0xD2, 0x0B, 0xB8, 0x87, 0x03, 0x62, 0x30, 0x1C, 0x92, 0x75, 0x93, 0x44,
- 0xCF, 0xB7, 0x1D, 0xD3, 0xF0, 0x49, 0xE4, 0xAD, 0x9B, 0xD7, 0x1F, 0x7F,
- 0x5C, 0x9D, 0x9E, 0x5F, 0xBD, 0x3E, 0xBB, 0xFE, 0x72, 0x7E, 0xBB, 0x08,
- 0xFE, 0x7C, 0x7B, 0x73, 0xF9, 0xFE, 0xFB, 0xEF, 0xB3, 0x57, 0xBF, 0xDE,
- 0xBE, 0xBB, 0xFC, 0x7A, 0x7A, 0xC7, 0xB4, 0x7A, 0xB2, 0x00, 0xF3, 0xB1,
- 0x70, 0x26, 0xA1, 0xCB, 0x83, 0x48, 0xD5, 0x1A, 0x0A, 0x32, 0xE4, 0x82,
- 0x62, 0x06, 0x8C, 0x90, 0xB3, 0x78, 0xF4, 0x08, 0xE0, 0x48, 0xAD, 0x2D,
- 0xC2, 0x88, 0xE0, 0x3D, 0x94, 0x05, 0x37, 0x6F, 0x28, 0xF4, 0x90, 0xB8,
- 0x42, 0x87, 0x87, 0x58, 0xA4, 0x4D, 0x14, 0xBB, 0x82, 0x06, 0x1A, 0xEE,
- 0xA4, 0x49, 0x3D, 0x4A, 0x18, 0xD5, 0xA1, 0x81, 0x06, 0xC5, 0x43, 0x1E,
- 0xC5, 0x4D, 0x38, 0x22, 0xE3, 0x98, 0x92, 0x10, 0x1A, 0x6C, 0xA4, 0xB8,
- 0x17, 0x27, 0x3A, 0x9C, 0xF1, 0x17, 0x73, 0x14, 0x3E, 0xF5, 0x1A, 0x19,
- 0x54, 0x72, 0x29, 0x27, 0x4E, 0x23, 0x03, 0xBB, 0xAE, 0x58, 0x37, 0xEF,
- 0x99, 0x25, 0xF3, 0x74, 0xD6, 0xE9, 0x6C, 0xD3, 0x99, 0xA6, 0xB3, 0x4C,
- 0xE7, 0x98, 0xCE, 0x2F, 0x9D, 0x5B, 0x3A, 0xAB, 0x74, 0x1E, 0xE9, 0xFC,
- 0xD1, 0x39, 0x33, 0xDF, 0x13, 0x1F, 0x4F, 0xD4, 0x53, 0x04, 0x2B, 0xCB,
- 0xE7, 0x21, 0x65, 0xF2, 0xF6, 0x32, 0xC8, 0xB2, 0x56, 0x90, 0x30, 0x12,
- 0x55, 0x10, 0x30, 0x21, 0xAE, 0x43, 0xF4, 0xE2, 0x93, 0xF0, 0x78, 0x50,
- 0x83, 0x8F, 0x12, 0xF2, 0xA2, 0x06, 0xC1, 0xFE, 0x89, 0x7A, 0xC1, 0xE8,
- 0xE2, 0x83, 0x8B, 0xFD, 0xD9, 0x6D, 0x51, 0xD1, 0x55, 0xA9, 0xC3, 0xD2,
- 0x9E, 0xA9, 0x56, 0xEB, 0x6D, 0xD6, 0x9B, 0x6C, 0x74, 0x58, 0xEF, 0xAD,
- 0xDE, 0x58, 0xA3, 0x29, 0x7D, 0x47, 0x21, 0x11, 0xD4, 0x87, 0x87, 0x2D,
- 0x7F, 0xFD, 0x54, 0x68, 0x6D, 0xD8, 0xE0, 0x6E, 0x1E, 0x94, 0x78, 0xD6,
- 0xA0, 0x96, 0x40, 0xD5, 0x0A, 0x80, 0x10, 0x81, 0x55, 0x35, 0x58, 0x59,
- 0xB8, 0xBB, 0xD9, 0xED, 0x21, 0xB9, 0xCA, 0x52, 0x96, 0x5F, 0x06, 0x50,
- 0x41, 0x96, 0x41, 0xED, 0xA8, 0xC8, 0xBA, 0x8F, 0xC9, 0x00, 0xC7, 0x31,
- 0x18, 0x3D, 0xDD, 0xD7, 0x22, 0x52, 0xE7, 0xC8, 0x61, 0x12, 0x04, 0xA6,
- 0xB5, 0x0D, 0x97, 0xB1, 0xD5, 0x81, 0xA3, 0xC9, 0xE8, 0xD8, 0x70, 0x65,
- 0xAB, 0x67, 0x70, 0xC9, 0x69, 0x0B, 0x4D, 0xAD, 0xA0, 0x2A, 0x11, 0x70,
- 0x36, 0x34, 0xAD, 0xFF, 0x55, 0x87, 0xC4, 0x07, 0xF1, 0x16, 0xB2, 0x6D,
- 0xD4, 0x52, 0x11, 0x8D, 0xB8, 0x88, 0x67, 0x9A, 0x86, 0x02, 0x55, 0x66,
- 0x06, 0x20, 0xA6, 0x61, 0xC9, 0x83, 0x52, 0x54, 0xF1, 0xA0, 0xDF, 0xEF,
- 0xF4, 0xA1, 0xFD, 0x0E, 0x5C, 0x0E, 0x9C, 0xD2, 0x07, 0x3D, 0x54, 0x62,
- 0xD6, 0xCA, 0x54, 0x26, 0xEF, 0xF7, 0xD7, 0x6C, 0x7B, 0xCD, 0x71, 0x5A,
- 0x49, 0xA6, 0xE3, 0x2A, 0x41, 0x0B, 0xBA, 0x9A, 0x55, 0x0A, 0x1A, 0x6C,
- 0x54, 0x99, 0x4B, 0x59, 0xB5, 0x0F, 0x58, 0xBE, 0xFD, 0x3B, 0x89, 0x1D,
- 0x1F, 0x8F, 0xC2, 0xC8, 0xD9, 0xDE, 0xBA, 0x7F, 0xF2, 0x14, 0x8F, 0x76,
- 0xD3, 0x83, 0xCC, 0x9C, 0x32, 0x09, 0x74, 0x2C, 0x09, 0x5D, 0x22, 0x66,
- 0x0E, 0x55, 0x62, 0xD5, 0x08, 0x60, 0xF0, 0x9C, 0x7A, 0xA6, 0x95, 0x2E,
- 0xA7, 0xE9, 0x6A, 0x37, 0x4D, 0xD3, 0x1E, 0xAA, 0xF0, 0x1A, 0x85, 0x94,
- 0xD0, 0x4B, 0x84, 0x20, 0xCC, 0x9B, 0xE4, 0xCA, 0xD5, 0x55, 0xE3, 0x56,
- 0x4B, 0xE9, 0x98, 0x08, 0x8F, 0xB0, 0x58, 0x29, 0x97, 0x34, 0x2A, 0x54,
- 0x6B, 0xBD, 0x28, 0x94, 0x4F, 0x57, 0x09, 0x55, 0x59, 0x9F, 0x78, 0x34,
- 0xC4, 0xB0, 0xE3, 0xCB, 0xB9, 0x3E, 0x4B, 0xD7, 0xD5, 0xC5, 0x97, 0x96,
- 0x27, 0x63, 0x2A, 0x37, 0xBA, 0xDB, 0x8A, 0x5F, 0x74, 0xBD, 0xD4, 0x8A,
- 0x0E, 0x87, 0x6C, 0x12, 0x99, 0xD6, 0x4A, 0x2B, 0x72, 0x0A, 0x9F, 0x6F,
- 0xD3, 0xBA, 0xDB, 0xE4, 0xA2, 0xEA, 0xD8, 0x80, 0xE4, 0xBE, 0x17, 0x4E,
- 0x54, 0x81, 0xFC, 0xF9, 0x9A, 0x06, 0xA6, 0xF5, 0xF3, 0xE5, 0x67, 0x38,
- 0x3E, 0x2A, 0x8C, 0x66, 0x11, 0xA5, 0xA1, 0x11, 0x97, 0x0B, 0x38, 0x35,
- 0x1E, 0xEF, 0xB5, 0x16, 0x95, 0x4D, 0x6F, 0x4A, 0x50, 0xBD, 0x5B, 0xF9,
- 0x32, 0x4C, 0xC6, 0xE4, 0x10, 0x7B, 0xF2, 0x1C, 0xCC, 0x97, 0xAA, 0x96,
- 0x3D, 0x81, 0x1F, 0x1F, 0xDF, 0x18, 0x80, 0x17, 0xA8, 0xCC, 0xCC, 0xD3,
- 0x14, 0xFE, 0x46, 0xD8, 0xDC, 0xF4, 0x26, 0x4F, 0x04, 0x7C, 0x77, 0x0C,
- 0x27, 0xF6, 0xB5, 0xF9, 0x0D, 0x9F, 0xBB, 0xC4, 0x18, 0xD0, 0x7F, 0x10,
- 0xFA, 0xF2, 0x67, 0xEA, 0x64, 0x01, 0x61, 0x43, 0x60, 0x17, 0x5E, 0x98,
- 0xF9, 0x84, 0xFD, 0x11, 0xA6, 0xDA, 0xF4, 0x2E, 0x4F, 0x93, 0x63, 0x6C,
- 0xEC, 0xF0, 0x78, 0x44, 0x3D, 0x39, 0xC7, 0xCA, 0x93, 0x07, 0x86, 0xBD,
- 0x88, 0x0A, 0x23, 0x7B, 0x23, 0x9E, 0x53, 0xF7, 0x16, 0xDC, 0x14, 0x98,
- 0x43, 0x39, 0x99, 0xF1, 0x70, 0x01, 0xC9, 0xE1, 0x2D, 0x48, 0xF6, 0x24,
- 0x61, 0xC3, 0x23, 0x3E, 0xE5, 0xA9, 0xE6, 0xD0, 0x6C, 0xCF, 0x64, 0x94,
- 0xFD, 0xFC, 0xC2, 0xF2, 0x2F, 0x7C, 0xDC, 0xCC, 0x2F,
-};
-const uint8_t g_esLA_Locale[] = {
- 0x78, 0x9C, 0x9D, 0x56, 0xCD, 0x4E, 0xDC, 0x30, 0x10, 0x3E, 0x53, 0xA9,
- 0xEF, 0x60, 0x45, 0x45, 0x80, 0x04, 0x9B, 0xF6, 0xB8, 0x28, 0x44, 0x5A,
- 0x01, 0xA5, 0x15, 0x0D, 0x5A, 0x75, 0x51, 0x4B, 0xB9, 0x54, 0x4E, 0x62,
- 0x36, 0x86, 0xC4, 0x5E, 0x39, 0x09, 0x68, 0xA3, 0xBE, 0x40, 0x4F, 0x3D,
- 0xF4, 0xD4, 0x63, 0x2B, 0x21, 0xB5, 0x07, 0xD4, 0x47, 0xE8, 0x81, 0x67,
- 0x41, 0xF0, 0x18, 0x9D, 0xFC, 0x6E, 0x12, 0x3B, 0xE9, 0xD2, 0x9C, 0x3C,
- 0xDF, 0x7C, 0x9F, 0x77, 0xE6, 0xB3, 0x33, 0x1B, 0xC3, 0xE7, 0x0E, 0xF6,
- 0x09, 0x62, 0x38, 0x20, 0x3B, 0x1A, 0x09, 0x3F, 0x5A, 0x27, 0x1A, 0x72,
- 0x49, 0xE8, 0xEC, 0x68, 0x0F, 0xD7, 0x7F, 0xEE, 0xBF, 0xDC, 0xDC, 0x7F,
- 0xFE, 0xF6, 0xF0, 0xFB, 0x66, 0xFD, 0xEE, 0xC7, 0x4F, 0x88, 0xEF, 0xBE,
- 0x5E, 0x6F, 0x68, 0xE6, 0xD3, 0x27, 0x08, 0x19, 0xA9, 0x8A, 0xB9, 0x58,
- 0x4C, 0xE6, 0x81, 0xCD, 0xFD, 0xB0, 0xD8, 0x60, 0x2A, 0xC8, 0x94, 0x0B,
- 0x8A, 0x59, 0xCA, 0x5A, 0x41, 0x46, 0xC0, 0x59, 0xE4, 0x1D, 0x41, 0x2A,
- 0x4C, 0xE3, 0x95, 0x3C, 0x36, 0x09, 0x23, 0x82, 0x1B, 0x7A, 0x1E, 0xD4,
- 0xF0, 0x33, 0x62, 0x0B, 0x75, 0x26, 0xC0, 0x22, 0x51, 0xE1, 0xD8, 0x16,
- 0xD4, 0x57, 0xF2, 0xE7, 0x2A, 0xFA, 0x79, 0xCC, 0xA8, 0x1A, 0xF7, 0x95,
- 0x38, 0x9E, 0xF2, 0x30, 0x52, 0x25, 0x42, 0x32, 0x8B, 0x28, 0x09, 0xA0,
- 0x5C, 0x45, 0x92, 0x3B, 0x51, 0xAC, 0xCE, 0x30, 0x7E, 0xD9, 0xA9, 0x72,
- 0xA9, 0x23, 0xE5, 0x50, 0xB1, 0xAE, 0x1C, 0xAC, 0x3B, 0x8A, 0xB0, 0x6D,
- 0x8B, 0x1D, 0xED, 0x85, 0xD6, 0xB2, 0x56, 0x6D, 0xAC, 0xDA, 0x54, 0xB5,
- 0xA5, 0x6A, 0x43, 0xD5, 0x7E, 0xAA, 0xDD, 0x54, 0x7B, 0xA9, 0x36, 0x52,
- 0xED, 0xA0, 0xDA, 0x3D, 0xB5, 0x6F, 0xFD, 0x8E, 0xB9, 0x78, 0x5E, 0xBB,
- 0x81, 0x10, 0x99, 0x2E, 0x0F, 0x28, 0x4B, 0xCB, 0x49, 0x83, 0x0A, 0xF5,
- 0x63, 0x46, 0xC2, 0x16, 0x06, 0x16, 0x45, 0x32, 0x48, 0x6F, 0x7F, 0x09,
- 0x87, 0xFB, 0x52, 0xE2, 0x3C, 0x26, 0x97, 0x12, 0x08, 0x27, 0x2E, 0xE4,
- 0x8D, 0xC3, 0xDB, 0xEF, 0x36, 0x76, 0x17, 0x25, 0xA0, 0x6C, 0xA5, 0xA8,
- 0xBA, 0x75, 0xCA, 0x45, 0xF9, 0x72, 0xE9, 0x72, 0xE1, 0x8A, 0xAA, 0xE5,
- 0x7A, 0xE5, 0x62, 0x15, 0x85, 0x76, 0x57, 0x19, 0x10, 0x41, 0x5D, 0xB8,
- 0xB6, 0xF5, 0x57, 0xBC, 0x80, 0xCC, 0x91, 0x05, 0x67, 0x51, 0x06, 0xCD,
- 0xD4, 0xB8, 0x95, 0x42, 0x8B, 0xB0, 0xB6, 0x39, 0x11, 0xB8, 0xB6, 0x2F,
- 0x44, 0x26, 0x1E, 0xEC, 0x0E, 0x0C, 0x3D, 0x5D, 0x55, 0x90, 0x5B, 0x87,
- 0x50, 0xB6, 0x2A, 0x45, 0x30, 0xA5, 0xF4, 0xD6, 0x98, 0xCA, 0x51, 0x17,
- 0x47, 0x64, 0x8C, 0xA3, 0x08, 0x0E, 0xA6, 0x72, 0xBB, 0x42, 0x8A, 0x49,
- 0x76, 0x16, 0xFB, 0xBE, 0x66, 0xEE, 0xC3, 0x83, 0xF6, 0xD6, 0x60, 0x22,
- 0xA2, 0x35, 0x0B, 0x9E, 0x7C, 0xF5, 0x01, 0x9E, 0xD4, 0x89, 0x4A, 0xD3,
- 0xB5, 0x89, 0xCF, 0xD9, 0x54, 0x33, 0xFF, 0x5F, 0x1F, 0x10, 0x17, 0xE4,
- 0x7B, 0xBA, 0x65, 0xE9, 0x4B, 0x6B, 0x42, 0x8F, 0x8B, 0x68, 0xA1, 0x6A,
- 0x6B, 0x10, 0x6A, 0x20, 0x85, 0x23, 0x11, 0x0D, 0x5A, 0x8E, 0xD4, 0x90,
- 0x86, 0x23, 0x9E, 0xB7, 0x6D, 0x59, 0xDB, 0x93, 0x09, 0x1A, 0xA1, 0x53,
- 0x43, 0xAF, 0xB1, 0xBA, 0x64, 0xB9, 0x07, 0x8F, 0x96, 0x65, 0xAD, 0x2F,
- 0x54, 0x4B, 0x69, 0x8A, 0xD6, 0x33, 0x95, 0x2C, 0x49, 0x3B, 0x6F, 0xF5,
- 0x59, 0xDC, 0x85, 0x63, 0x40, 0xCB, 0x0B, 0x72, 0x10, 0x5B, 0xD1, 0x85,
- 0x17, 0x84, 0x93, 0xFD, 0xBD, 0x97, 0x57, 0xEF, 0xB1, 0x77, 0x98, 0x9C,
- 0xE6, 0x86, 0xD5, 0x49, 0x99, 0x92, 0xC5, 0x81, 0x4D, 0x44, 0xD3, 0xB5,
- 0x06, 0x56, 0x54, 0x05, 0x18, 0xDC, 0x6D, 0x47, 0x33, 0x93, 0xCD, 0x24,
- 0x19, 0x0E, 0x92, 0x24, 0x31, 0xF4, 0x06, 0xAF, 0x5B, 0xEA, 0xC4, 0x42,
- 0x10, 0xE6, 0xCC, 0x35, 0xF3, 0x59, 0x2E, 0x1E, 0x0E, 0x3F, 0xAD, 0x57,
- 0xCB, 0x8D, 0xA5, 0xF7, 0x99, 0x11, 0xE1, 0x10, 0x16, 0x15, 0x25, 0xAC,
- 0xCA, 0xBA, 0xD4, 0x1B, 0xA9, 0x9F, 0xAA, 0xC7, 0x45, 0xDB, 0x2B, 0x4D,
- 0xA8, 0xD8, 0xDE, 0x25, 0x0E, 0x0D, 0x30, 0x5C, 0x8E, 0x41, 0xB9, 0x4B,
- 0x9E, 0xEE, 0x14, 0x4C, 0x05, 0x8F, 0x67, 0x34, 0xBD, 0x17, 0x9B, 0x4B,
- 0x2A, 0xAA, 0x0E, 0x56, 0x97, 0x14, 0xC0, 0x84, 0x8F, 0x43, 0xCD, 0xDC,
- 0x5A, 0x92, 0x9E, 0xC0, 0x77, 0x87, 0x66, 0x3E, 0x97, 0xD8, 0x0B, 0x63,
- 0x1A, 0x67, 0x5F, 0x1E, 0x4C, 0xC3, 0x99, 0x26, 0x58, 0xDE, 0xC9, 0x2C,
- 0x80, 0x03, 0x84, 0x59, 0xD4, 0xC8, 0xF7, 0x68, 0x68, 0xC8, 0xD3, 0x85,
- 0x66, 0x5A, 0x27, 0x47, 0x8F, 0x90, 0xD5, 0x8F, 0x41, 0x12, 0x65, 0xC3,
- 0x50, 0xAA, 0x3A, 0x7D, 0xF5, 0xE7, 0x33, 0x72, 0x86, 0x9D, 0x72, 0xE8,
- 0x96, 0x61, 0xB1, 0xA7, 0x35, 0x87, 0xAF, 0x39, 0x17, 0x8D, 0xC1, 0x1D,
- 0x5D, 0x4D, 0xA0, 0xF0, 0x49, 0xC5, 0x7A, 0x08, 0xBB, 0x3C, 0x16, 0xF0,
- 0x17, 0x88, 0x26, 0x91, 0xDB, 0xC1, 0x18, 0xB9, 0xDC, 0x26, 0x68, 0x4C,
- 0xFF, 0x49, 0x79, 0x95, 0x7E, 0x1F, 0x5E, 0xF5, 0x52, 0x46, 0x02, 0xDB,
- 0xF0, 0xAE, 0xF5, 0x51, 0x8E, 0x3D, 0x4C, 0x3B, 0x08, 0x87, 0x3C, 0x89,
- 0x2F, 0x30, 0x3A, 0xE0, 0x91, 0x47, 0x9D, 0xB4, 0xA7, 0xAD, 0x77, 0xAF,
- 0x91, 0xD5, 0x4F, 0x06, 0x03, 0x1C, 0x8F, 0x97, 0xE4, 0xB7, 0xBD, 0x3F,
- 0x0D, 0xDC, 0x69, 0xDA, 0x25, 0x7A, 0xD3, 0x4B, 0x9B, 0xF0, 0xA5, 0x68,
- 0xD6, 0x3C, 0x66, 0xD3, 0x73, 0x9E, 0x31, 0xF3, 0x22, 0xB3, 0x11, 0x57,
- 0x3B, 0x4F, 0x43, 0xCF, 0x3F, 0xEF, 0xCD, 0xBF, 0xC4, 0xB5, 0xD4, 0x04};
-const uint8_t g_deDE_Loacale[] = {
- 0x78, 0x9C, 0x95, 0x56, 0x4D, 0x6F, 0xD4, 0x30, 0x10, 0xBD, 0x23, 0xF1,
- 0x1F, 0xAC, 0x88, 0xAA, 0x20, 0xB5, 0x1B, 0x38, 0xB6, 0xDA, 0x46, 0x5A,
- 0x75, 0xFB, 0x41, 0x4B, 0xCA, 0xAA, 0x69, 0x41, 0xF4, 0x82, 0xBC, 0x89,
- 0xBB, 0x71, 0x9B, 0xD8, 0x2B, 0xC7, 0x69, 0xB5, 0x39, 0xF2, 0x37, 0xB8,
- 0x72, 0x04, 0x71, 0xE4, 0x04, 0x17, 0xFE, 0x09, 0x52, 0x25, 0x7E, 0x06,
- 0x93, 0x8D, 0x93, 0x26, 0xB6, 0xBB, 0x0D, 0xB9, 0xAC, 0xE7, 0xCD, 0x7B,
- 0xB3, 0x33, 0xCF, 0x89, 0x93, 0x61, 0xC2, 0x43, 0x9C, 0x10, 0xC4, 0x70,
- 0x4A, 0x76, 0x9C, 0x88, 0x7C, 0x1C, 0xEF, 0x39, 0x28, 0x22, 0x59, 0xB8,
- 0xE3, 0xDC, 0xFD, 0xFA, 0xF1, 0xF7, 0xFB, 0xB7, 0xE7, 0xF0, 0x73, 0xF7,
- 0xF9, 0xE7, 0x0B, 0xC7, 0x1B, 0x96, 0x44, 0x16, 0x61, 0x11, 0x2C, 0xD2,
- 0x29, 0x4F, 0x32, 0xA5, 0x99, 0x09, 0x32, 0xE3, 0x82, 0x62, 0x06, 0x8C,
- 0x94, 0x33, 0x19, 0x9F, 0x00, 0x9C, 0xA9, 0xB5, 0x77, 0x84, 0x59, 0x8E,
- 0xC5, 0xD0, 0xAD, 0xA2, 0xA7, 0x4F, 0x14, 0xBC, 0x4F, 0xA6, 0xC2, 0x86,
- 0xFB, 0xBF, 0xBF, 0x88, 0xC2, 0x40, 0x47, 0x73, 0x41, 0x13, 0x93, 0x8B,
- 0xA9, 0x81, 0x1D, 0xE5, 0xCC, 0x06, 0x26, 0x26, 0x38, 0xCA, 0x67, 0x79,
- 0x26, 0x0D, 0x38, 0x20, 0x73, 0x49, 0xD2, 0x29, 0x31, 0x5B, 0x7B, 0x7B,
- 0x2D, 0xB9, 0x0D, 0x3F, 0xE1, 0x37, 0x76, 0xC1, 0x98, 0x14, 0x7A, 0xC2,
- 0x6D, 0x19, 0x54, 0xF3, 0x96, 0x11, 0xC2, 0xD3, 0xA9, 0xD8, 0x71, 0x5E,
- 0x39, 0x2D, 0xDF, 0x6C, 0xA6, 0x99, 0x26, 0xD8, 0xED, 0xEA, 0x6B, 0x96,
- 0xCD, 0x2B, 0x9B, 0x55, 0x36, 0x9F, 0x6C, 0x0E, 0xD9, 0xDC, 0xB1, 0x19,
- 0xF3, 0xB0, 0x27, 0x11, 0x5E, 0xA8, 0x1B, 0x08, 0x56, 0x5E, 0xC0, 0x19,
- 0x93, 0x18, 0xFE, 0xBE, 0x0C, 0xAA, 0xAC, 0xE7, 0x73, 0x03, 0x1A, 0x53,
- 0xC2, 0x32, 0x83, 0x47, 0xA5, 0xBC, 0xE5, 0x61, 0xDC, 0x65, 0x42, 0x41,
- 0x22, 0x0C, 0xEE, 0xBE, 0x20, 0x54, 0xC7, 0x02, 0x9C, 0x76, 0x78, 0x6E,
- 0xD3, 0x5A, 0xAB, 0xCD, 0xD6, 0xC6, 0x55, 0xFD, 0x6A, 0xAD, 0x6A, 0x6D,
- 0x6A, 0x0D, 0x6A, 0xAD, 0x69, 0x2D, 0x69, 0xDD, 0xD8, 0x1B, 0x49, 0x89,
- 0xA0, 0x11, 0x25, 0x69, 0xFD, 0xD4, 0xA9, 0xD0, 0x1B, 0xF9, 0xE0, 0x6C,
- 0x1D, 0xB4, 0x78, 0xDE, 0x44, 0x4B, 0xB8, 0xDD, 0x0A, 0x80, 0x10, 0x81,
- 0x55, 0x35, 0x58, 0x79, 0x37, 0x03, 0xB4, 0x1B, 0x8B, 0xC1, 0xD0, 0x2D,
- 0x83, 0x2A, 0xEB, 0x31, 0x0D, 0x73, 0x1B, 0x49, 0x19, 0x68, 0xE7, 0x44,
- 0x35, 0x81, 0x24, 0x13, 0x2C, 0x25, 0x11, 0x6C, 0xB9, 0xB3, 0x4D, 0xA4,
- 0x0E, 0x91, 0xCB, 0x3C, 0x49, 0x1C, 0x6F, 0x0F, 0xAE, 0x0D, 0x34, 0x1E,
- 0x20, 0x1F, 0x2E, 0xF4, 0x01, 0xAE, 0x72, 0xD6, 0x86, 0xAB, 0x15, 0x52,
- 0xD2, 0x84, 0xB3, 0x99, 0xE3, 0xFD, 0xA7, 0x28, 0x25, 0x11, 0x68, 0xC6,
- 0x03, 0xDF, 0x1F, 0xF4, 0x54, 0x64, 0x31, 0x17, 0xF2, 0x5E, 0x63, 0x28,
- 0xDC, 0xCE, 0x88, 0x00, 0x48, 0x9A, 0xB6, 0x46, 0x6E, 0x45, 0x9D, 0x91,
- 0x0F, 0xB7, 0x7D, 0x7F, 0x1D, 0x9D, 0xC7, 0x02, 0xAD, 0x5F, 0x0C, 0xDD,
- 0x16, 0x4B, 0x2B, 0xD1, 0x19, 0xF6, 0xB0, 0x54, 0x6D, 0x07, 0x01, 0xEA,
- 0x23, 0x59, 0x8E, 0x5A, 0x2B, 0x7A, 0xF0, 0xD5, 0xA0, 0x4B, 0x85, 0x41,
- 0x77, 0x3B, 0x53, 0x29, 0xA3, 0xCE, 0x00, 0xAB, 0xF7, 0xFA, 0xE0, 0xCA,
- 0x97, 0xD7, 0x87, 0x69, 0x16, 0xEC, 0x8D, 0xF7, 0x6F, 0xDF, 0xE3, 0xF8,
- 0xB8, 0xB8, 0xA8, 0xAC, 0x69, 0x93, 0x40, 0xC7, 0xF2, 0xF2, 0x68, 0xBC,
- 0xF7, 0xA7, 0x13, 0xAB, 0x4E, 0x00, 0x83, 0x5B, 0x33, 0x74, 0xBC, 0x62,
- 0xA3, 0x28, 0xB6, 0x06, 0x45, 0x01, 0xC7, 0x46, 0x87, 0x67, 0x14, 0x52,
- 0xC2, 0x30, 0x17, 0x82, 0xB0, 0x70, 0x51, 0x2B, 0xB7, 0xB6, 0xD0, 0xB3,
- 0x9E, 0xD2, 0x39, 0x11, 0x21, 0x61, 0x52, 0x29, 0xD7, 0x2C, 0x2A, 0x57,
- 0x6B, 0xBD, 0x29, 0x54, 0x4F, 0xD7, 0x09, 0x9B, 0x17, 0x6B, 0x48, 0x53,
- 0x0C, 0xFB, 0xBD, 0x51, 0xEB, 0xAB, 0xB4, 0xAE, 0x6E, 0xDE, 0xA9, 0x3C,
- 0x9F, 0xD3, 0x72, 0xAB, 0x07, 0xBD, 0xF8, 0x4D, 0xD7, 0x6B, 0xBD, 0xE8,
- 0x29, 0x65, 0x79, 0xE6, 0x78, 0x9B, 0xBD, 0xC8, 0x05, 0x11, 0xDC, 0xF1,
- 0x5E, 0x9A, 0x5C, 0xB7, 0x3B, 0x36, 0x20, 0xB5, 0xEF, 0x8D, 0x13, 0x5D,
- 0xA0, 0xBE, 0xC1, 0x96, 0x81, 0xE3, 0xFD, 0xF9, 0xF4, 0x15, 0xCE, 0x8A,
- 0x0E, 0xC3, 0x2C, 0xA2, 0x34, 0x34, 0xE3, 0xE5, 0x02, 0x8E, 0x88, 0xF3,
- 0xD3, 0xDE, 0xA2, 0xB6, 0xE9, 0xA6, 0xC4, 0xD5, 0xBB, 0x2D, 0x9F, 0x86,
- 0xC5, 0x9C, 0x5C, 0xE2, 0xB0, 0x3C, 0xFA, 0xEA, 0xA5, 0xAA, 0xE5, 0x2F,
- 0xE0, 0x13, 0x27, 0x42, 0x13, 0xF0, 0xC2, 0x6D, 0x33, 0xEB, 0x34, 0x65,
- 0x94, 0xB3, 0x07, 0xD3, 0xBB, 0x3C, 0x17, 0x94, 0x08, 0x14, 0xC8, 0xC8,
- 0x9A, 0x1F, 0x45, 0xF0, 0x69, 0x81, 0x26, 0xF4, 0x11, 0xC2, 0x21, 0x7C,
- 0x35, 0x91, 0xDB, 0x15, 0x84, 0x91, 0xC0, 0x53, 0x78, 0x60, 0x1E, 0x26,
- 0x9C, 0xC5, 0x98, 0x5A, 0xD3, 0xC7, 0xBC, 0xC8, 0xAF, 0x31, 0x3A, 0xE0,
- 0x32, 0xA6, 0x61, 0x39, 0xC7, 0xE6, 0xBB, 0xD7, 0xC8, 0x5F, 0x45, 0x85,
- 0x91, 0xC3, 0x98, 0xD7, 0xD4, 0xD3, 0x15, 0x7F, 0x0A, 0xCC, 0x59, 0x39,
- 0x19, 0x7A, 0xB3, 0x82, 0x04, 0x6F, 0xFA, 0xC7, 0x49, 0xFE, 0x22, 0x67,
- 0xB3, 0x2B, 0xBE, 0xE4, 0xA9, 0xE6, 0xDC, 0xFB, 0x3D, 0x2B, 0xA3, 0xEA,
- 0x73, 0x16, 0x96, 0xFF, 0x00, 0x29, 0x27, 0xAF, 0x17,
-};
-const uint8_t g_frFR_Locale[] = {
- 0x78, 0x9C, 0x95, 0x56, 0x4D, 0x6F, 0xD3, 0x40, 0x10, 0xBD, 0x23, 0xF1,
- 0x1F, 0x56, 0x16, 0x55, 0x41, 0x6A, 0xBD, 0x70, 0x4C, 0x95, 0x5A, 0xAA,
- 0xFA, 0x15, 0x28, 0x46, 0x51, 0x53, 0x40, 0xF4, 0x82, 0x36, 0xF6, 0x36,
- 0xDE, 0xD4, 0xDE, 0x8D, 0xD6, 0x76, 0x4A, 0x7C, 0xE4, 0x3F, 0x70, 0xE2,
- 0xC2, 0xB5, 0x12, 0x88, 0x03, 0x47, 0xC4, 0x85, 0xFE, 0x13, 0x24, 0x10,
- 0x3F, 0x83, 0x71, 0xBC, 0x76, 0xED, 0x5D, 0x27, 0xB8, 0xBE, 0x64, 0xE7,
- 0xCD, 0x7B, 0xE3, 0x99, 0xB7, 0xF6, 0xC6, 0xFD, 0x50, 0x78, 0x24, 0xA4,
- 0x88, 0x93, 0x88, 0xEE, 0x5A, 0x17, 0xF2, 0xED, 0xD1, 0xA9, 0x85, 0x7C,
- 0x1A, 0x7B, 0xBB, 0xD6, 0x9F, 0x6F, 0x1F, 0xFE, 0x7E, 0xFD, 0xF2, 0x10,
- 0x7E, 0x7E, 0x7F, 0xFC, 0xF1, 0xC8, 0x72, 0xFA, 0x39, 0x91, 0xFB, 0x44,
- 0x8E, 0x16, 0xD1, 0x58, 0x84, 0xB1, 0xD2, 0x4C, 0x24, 0x9D, 0x08, 0xC9,
- 0x08, 0x07, 0x46, 0x24, 0x78, 0x12, 0xBC, 0x00, 0x38, 0x56, 0x6B, 0x67,
- 0x4A, 0xF8, 0x9C, 0x51, 0xD9, 0xC7, 0x45, 0x78, 0xFF, 0x9E, 0xC2, 0x2F,
- 0x6E, 0xAE, 0xE7, 0xB2, 0x2D, 0x11, 0x11, 0x19, 0x1B, 0x20, 0x01, 0x6E,
- 0xD8, 0x42, 0x65, 0x06, 0x36, 0x4D, 0x19, 0x6F, 0x03, 0xC3, 0x90, 0x26,
- 0x66, 0x59, 0x71, 0xF3, 0xDD, 0x44, 0x63, 0x3A, 0x4B, 0x68, 0x34, 0x96,
- 0xD4, 0xC8, 0x08, 0x2F, 0x11, 0x6D, 0x38, 0x17, 0xF3, 0x76, 0x81, 0x7F,
- 0x73, 0xED, 0xE9, 0x19, 0x5C, 0x33, 0xA9, 0x24, 0x2E, 0x23, 0x44, 0xC6,
- 0x63, 0xB9, 0x6B, 0x3D, 0xB1, 0xEA, 0xDE, 0xD9, 0xED, 0xCE, 0x99, 0xF0,
- 0x2A, 0xDF, 0xDA, 0x98, 0x77, 0xB0, 0xCD, 0x94, 0xAF, 0x36, 0xCD, 0xE4,
- 0x82, 0x61, 0x26, 0x08, 0x6E, 0x99, 0x60, 0xEE, 0x94, 0xBD, 0xDA, 0x25,
- 0x9F, 0x2C, 0xD4, 0x63, 0x05, 0x2B, 0xC7, 0x67, 0x11, 0xE1, 0x5E, 0x00,
- 0xAE, 0xE6, 0x51, 0x91, 0x76, 0xC2, 0x94, 0xFB, 0xAC, 0x81, 0x80, 0x25,
- 0x3A, 0x42, 0xA5, 0x27, 0xA9, 0x06, 0x4E, 0x69, 0xAA, 0x21, 0x73, 0x78,
- 0xCC, 0x0D, 0x5A, 0x0C, 0xF7, 0xAF, 0x41, 0xB8, 0x6A, 0xA9, 0xD6, 0x5E,
- 0x6D, 0x0B, 0x55, 0x9F, 0xB6, 0xDE, 0xA3, 0xAD, 0xB7, 0x68, 0xEB, 0x1D,
- 0xDA, 0x7A, 0x77, 0xB6, 0xDE, 0x9C, 0xAD, 0x37, 0x66, 0xB7, 0xB7, 0x05,
- 0xC5, 0x98, 0xCF, 0x68, 0x54, 0xBE, 0x91, 0x2A, 0x74, 0xF6, 0x5C, 0xF0,
- 0xB7, 0x0C, 0x6A, 0x3C, 0x67, 0xA8, 0x25, 0x70, 0xB3, 0x02, 0x20, 0x54,
- 0x12, 0x55, 0x0D, 0x56, 0xF0, 0x7C, 0xD9, 0xE8, 0x99, 0xBD, 0xBD, 0x0F,
- 0xF7, 0xCF, 0xC3, 0x22, 0xEF, 0x90, 0x99, 0x8E, 0xE2, 0x4A, 0x96, 0x07,
- 0xDA, 0x39, 0x52, 0xCC, 0x91, 0xD0, 0x21, 0x49, 0x12, 0x2A, 0xF9, 0x72,
- 0x8F, 0xAB, 0xA8, 0x3C, 0x98, 0xD2, 0x30, 0xB4, 0x9C, 0x43, 0xB8, 0xD0,
- 0x01, 0x72, 0xE1, 0x42, 0x6F, 0xE0, 0xCA, 0xA7, 0xAD, 0x98, 0x5A, 0x19,
- 0x25, 0x0C, 0x05, 0x9F, 0x58, 0xCE, 0xDD, 0x34, 0xB0, 0xCF, 0x4A, 0x82,
- 0x3A, 0xF1, 0xE3, 0x40, 0xC8, 0x04, 0x14, 0x07, 0xD8, 0x75, 0x71, 0x8B,
- 0x02, 0x37, 0xA6, 0x03, 0x20, 0x61, 0x51, 0x6D, 0xDA, 0x5A, 0xD4, 0x98,
- 0x76, 0x30, 0xD8, 0x44, 0x01, 0xDA, 0x84, 0x2E, 0xCE, 0xFB, 0xB8, 0x46,
- 0xD2, 0x2A, 0x34, 0x06, 0x1D, 0x0C, 0x76, 0x5C, 0x77, 0x67, 0x34, 0xEA,
- 0x24, 0x59, 0xCE, 0x59, 0x2A, 0x3A, 0xF0, 0xD5, 0x9C, 0x4B, 0x85, 0x41,
- 0xC7, 0x8D, 0xA1, 0x94, 0x4F, 0x67, 0x80, 0x95, 0xBB, 0x7C, 0x4C, 0xDC,
- 0xE9, 0xE5, 0x20, 0x8A, 0x47, 0x87, 0x07, 0x47, 0x57, 0xAF, 0xDF, 0x05,
- 0x27, 0xD9, 0x79, 0xE1, 0x4C, 0x9D, 0x04, 0x3A, 0x9E, 0x46, 0x63, 0x2A,
- 0x6F, 0xED, 0x69, 0xC4, 0xAA, 0x13, 0xC0, 0xE0, 0xC1, 0xF4, 0x2C, 0x27,
- 0xDB, 0xCA, 0xB2, 0x9E, 0x9D, 0x65, 0x59, 0x1F, 0x37, 0x78, 0x46, 0x21,
- 0x25, 0xF4, 0x52, 0x29, 0x29, 0xF7, 0x16, 0xA5, 0xB2, 0xD7, 0x43, 0x0F,
- 0x3A, 0x4A, 0x67, 0x70, 0x76, 0x50, 0x9E, 0x28, 0xE5, 0x46, 0x8B, 0x0A,
- 0x6B, 0xAD, 0x57, 0x85, 0xCA, 0xE9, 0x1A, 0xA1, 0x2A, 0xEB, 0x53, 0x0F,
- 0x4E, 0x33, 0xD8, 0xEE, 0xAD, 0x52, 0x5F, 0xA4, 0x75, 0x75, 0xF5, 0x6F,
- 0x2B, 0xD2, 0x19, 0xCB, 0xB7, 0xFA, 0xE7, 0xA7, 0x4E, 0x82, 0xAA, 0xED,
- 0x8D, 0x4E, 0xF4, 0x88, 0xF1, 0x34, 0xB6, 0x9C, 0xED, 0x4E, 0xE4, 0x8C,
- 0x4A, 0x61, 0x39, 0x8F, 0x4D, 0x2E, 0x6E, 0xCE, 0x0D, 0x48, 0x69, 0x7C,
- 0x65, 0x45, 0x13, 0x28, 0x9F, 0xB0, 0x65, 0x60, 0x39, 0xBF, 0xDE, 0x7F,
- 0x86, 0x63, 0xA2, 0xC1, 0x30, 0x8B, 0x28, 0x0D, 0x8B, 0x45, 0xBE, 0x80,
- 0xD3, 0xE1, 0xE5, 0x69, 0x67, 0x51, 0xDD, 0x75, 0x53, 0x82, 0xF5, 0x6E,
- 0xF3, 0xD7, 0x61, 0x31, 0xA3, 0x17, 0xC4, 0xCB, 0x4F, 0xBE, 0x72, 0xA9,
- 0x6A, 0xB9, 0x0B, 0xF8, 0xFA, 0xF1, 0xD1, 0x10, 0xBC, 0xC0, 0x75, 0x66,
- 0x99, 0x66, 0x9C, 0x09, 0xBE, 0x32, 0xBD, 0x2F, 0xD2, 0xFC, 0x3B, 0x08,
- 0x8D, 0x12, 0xBF, 0x35, 0xBF, 0xE7, 0x8B, 0x31, 0x45, 0x43, 0xF6, 0x1F,
- 0xC2, 0x80, 0xC2, 0x57, 0xC6, 0xD5, 0x1A, 0xC2, 0x9E, 0x24, 0x63, 0x78,
- 0x63, 0x56, 0x13, 0xCE, 0x02, 0xC2, 0x5A, 0xD3, 0x27, 0x22, 0x4B, 0x2F,
- 0x09, 0x3A, 0x16, 0x49, 0xC0, 0xBC, 0x7C, 0x8E, 0xED, 0x57, 0x4F, 0x91,
- 0xBB, 0x8E, 0x0A, 0x23, 0x7B, 0x81, 0x28, 0xA9, 0xA7, 0x6B, 0x6E, 0x0A,
- 0xCC, 0x49, 0x3E, 0x19, 0x7A, 0xBE, 0x86, 0x34, 0x12, 0x1D, 0x48, 0xEE,
- 0x22, 0xE5, 0x93, 0xA9, 0x58, 0xF2, 0x54, 0x73, 0xF8, 0x76, 0xCF, 0xF2,
- 0xA8, 0xF8, 0xD2, 0x85, 0xE5, 0x3F, 0x5D, 0x49, 0xBE, 0x1B};
-const uint8_t g_itIT_Locale[] = {
- 0x78, 0x9C, 0x95, 0x56, 0xD1, 0x6A, 0xD4, 0x40, 0x14, 0x7D, 0x17, 0xFC,
- 0x87, 0x21, 0x58, 0x50, 0x68, 0x3B, 0xFA, 0xD8, 0x92, 0x06, 0x4A, 0x5B,
- 0xBB, 0xA5, 0x46, 0x96, 0xEE, 0xAA, 0xD8, 0x17, 0x99, 0x64, 0xA6, 0xD9,
- 0xB1, 0xC9, 0xCC, 0x32, 0x49, 0x5A, 0x92, 0x47, 0xF1, 0xC1, 0x37, 0x7F,
- 0x42, 0x10, 0x41, 0xF1, 0x23, 0xFC, 0x13, 0xA1, 0xE2, 0x67, 0x78, 0xB3,
- 0x99, 0xA4, 0xC9, 0x64, 0xBA, 0xA6, 0x79, 0xD9, 0xB9, 0xE7, 0x9E, 0x73,
- 0x73, 0xEF, 0x99, 0x64, 0x36, 0x6E, 0x2C, 0x43, 0x12, 0x33, 0x24, 0x48,
- 0xC2, 0xF6, 0x1C, 0x9E, 0xBD, 0x3B, 0x99, 0x3B, 0x88, 0xB2, 0x34, 0xDC,
- 0x73, 0xFE, 0x7C, 0xFC, 0x7C, 0xF3, 0xE5, 0xEB, 0xCD, 0xA7, 0x6F, 0x7F,
- 0x7F, 0xFE, 0x78, 0xDC, 0x06, 0x4F, 0x1C, 0xCF, 0xAD, 0x14, 0x82, 0x12,
- 0x35, 0x2B, 0x92, 0x40, 0xC6, 0xA9, 0x16, 0x47, 0x8A, 0x45, 0x52, 0x71,
- 0x22, 0x80, 0x91, 0x48, 0x91, 0x2D, 0x5E, 0x02, 0x9C, 0xEA, 0xB5, 0x17,
- 0x31, 0x21, 0x08, 0x97, 0x2E, 0xAE, 0xC3, 0x87, 0x0F, 0x34, 0x7E, 0xC1,
- 0x82, 0x40, 0xD9, 0x12, 0x09, 0x51, 0xE5, 0x10, 0x25, 0x4B, 0xC5, 0x63,
- 0x66, 0x21, 0x47, 0x91, 0xA5, 0x46, 0xC4, 0xF3, 0x48, 0x0C, 0xE1, 0x38,
- 0x8F, 0x62, 0x0B, 0x9B, 0x44, 0x32, 0xCD, 0x86, 0x70, 0xCA, 0xB2, 0x8C,
- 0x25, 0x81, 0x1A, 0xDE, 0x55, 0x66, 0x99, 0xB4, 0xE1, 0x42, 0x5E, 0xD9,
- 0x05, 0x94, 0x87, 0x66, 0x02, 0x77, 0xAC, 0x6A, 0x78, 0xAB, 0x08, 0x11,
- 0x30, 0x66, 0xCF, 0x79, 0xE6, 0x74, 0x1C, 0xB4, 0xB9, 0x67, 0x33, 0xCE,
- 0x66, 0x9B, 0xCD, 0x33, 0x9B, 0x61, 0x36, 0xB7, 0x6C, 0x56, 0xD9, 0x7C,
- 0xB2, 0x39, 0x64, 0x73, 0xC7, 0x66, 0xCC, 0xDD, 0x9E, 0x50, 0x52, 0xE8,
- 0x47, 0x09, 0x56, 0x1E, 0x95, 0x09, 0x13, 0x3C, 0x24, 0x2E, 0xAE, 0xA2,
- 0x3A, 0x0D, 0x3D, 0x0A, 0x46, 0x7F, 0x7D, 0xEF, 0x61, 0xE0, 0x43, 0x36,
- 0x04, 0x99, 0x0A, 0x65, 0x3C, 0x80, 0xE1, 0xE1, 0xB9, 0x1A, 0x80, 0x57,
- 0x4C, 0x30, 0x65, 0x82, 0x29, 0x09, 0x48, 0xF5, 0x90, 0x68, 0x08, 0xB7,
- 0xCD, 0x75, 0x1A, 0xED, 0x6C, 0x9D, 0xEE, 0xD8, 0x6C, 0xD6, 0x6C, 0xD4,
- 0xEC, 0xD1, 0x6C, 0xCE, 0xEC, 0xCB, 0x6C, 0xC9, 0xDE, 0x0F, 0x14, 0xE2,
- 0x94, 0xB3, 0xA4, 0x79, 0x11, 0x75, 0xE8, 0xED, 0xFB, 0x60, 0x71, 0x13,
- 0x74, 0x78, 0xDE, 0xD4, 0x48, 0xE0, 0x7E, 0x05, 0x40, 0x98, 0x22, 0xBA,
- 0x1A, 0xAC, 0x3C, 0x72, 0xE0, 0xE2, 0xEA, 0xB7, 0x4E, 0x78, 0xF4, 0x36,
- 0xC4, 0x2D, 0xB1, 0x0A, 0x8C, 0x03, 0xA3, 0x6E, 0x3C, 0x63, 0x53, 0x02,
- 0x6F, 0x96, 0x12, 0xAB, 0x8D, 0x6D, 0x23, 0x7D, 0x9A, 0x5C, 0xE4, 0x71,
- 0xEC, 0x78, 0x47, 0x70, 0xA1, 0x43, 0xE4, 0xC3, 0x85, 0xDE, 0xC2, 0x55,
- 0xCD, 0xD7, 0x32, 0x8D, 0x32, 0x5A, 0x18, 0x4B, 0x11, 0x39, 0xDE, 0xE1,
- 0xFD, 0x44, 0x09, 0xA3, 0x95, 0x06, 0x83, 0x04, 0x8F, 0x12, 0xA4, 0x0B,
- 0xA9, 0x32, 0x2D, 0xB1, 0x29, 0x70, 0x6F, 0x3E, 0x00, 0x32, 0x9E, 0x74,
- 0xE6, 0xED, 0x44, 0xBD, 0x79, 0x27, 0x93, 0x5D, 0xDF, 0xDF, 0x9D, 0xCD,
- 0xD0, 0xB9, 0x8B, 0x3B, 0x1C, 0xA3, 0x40, 0x6F, 0xD2, 0xFB, 0x28, 0x56,
- 0x63, 0x36, 0xF7, 0x18, 0xC1, 0xD7, 0x53, 0xAE, 0x14, 0x03, 0x3A, 0xEE,
- 0x8D, 0xA4, 0x5D, 0x9A, 0x03, 0xD6, 0xEC, 0xF2, 0x71, 0xE1, 0xD3, 0xCB,
- 0x49, 0x92, 0xCE, 0x8E, 0x0E, 0x9F, 0x5F, 0xBF, 0x21, 0x8B, 0xD3, 0xF2,
- 0xBC, 0xF6, 0xA5, 0x4B, 0x02, 0x9D, 0xC8, 0x93, 0x80, 0xA9, 0x5B, 0x73,
- 0x7A, 0xB1, 0xEE, 0x04, 0x30, 0x78, 0x14, 0x43, 0xC7, 0x2B, 0x37, 0xCB,
- 0x72, 0x67, 0xBB, 0x2C, 0x4B, 0x17, 0xF7, 0x78, 0x83, 0x42, 0x5A, 0x18,
- 0xE6, 0x4A, 0x31, 0x11, 0x16, 0x8E, 0xF7, 0x08, 0xD5, 0xDA, 0x9D, 0x9D,
- 0x91, 0xD2, 0x25, 0x9C, 0x15, 0x4C, 0x64, 0xFA, 0x9E, 0x1B, 0x16, 0x15,
- 0x36, 0x5A, 0x6F, 0x0B, 0x35, 0xD3, 0xF5, 0x42, 0x5D, 0x96, 0xB2, 0x90,
- 0x27, 0x04, 0x36, 0x7B, 0xB3, 0xD1, 0xD7, 0x69, 0x53, 0xDD, 0xFE, 0xAD,
- 0xCA, 0x7C, 0xC9, 0xAB, 0x9D, 0xDE, 0x1E, 0xC5, 0x6F, 0xBB, 0xDE, 0x18,
- 0x45, 0x4F, 0xB8, 0xC8, 0x53, 0xC7, 0xDB, 0x1A, 0x45, 0x2E, 0x99, 0x92,
- 0x8E, 0xF7, 0x74, 0xC8, 0xC5, 0xFD, 0xB1, 0x01, 0x69, 0x7C, 0x6F, 0x9D,
- 0xE8, 0x03, 0xCD, 0x03, 0xB6, 0x0A, 0x1C, 0xEF, 0xF7, 0x07, 0x38, 0x65,
- 0xFB, 0x8C, 0x61, 0x91, 0xE6, 0x23, 0x25, 0x95, 0xD5, 0x02, 0x0E, 0x87,
- 0x57, 0x67, 0xA3, 0x45, 0x5D, 0xD3, 0x87, 0x12, 0x6C, 0x76, 0x5B, 0xBD,
- 0x0D, 0xC5, 0x92, 0x5D, 0x90, 0xB0, 0x3A, 0xEA, 0x9A, 0xA5, 0xAE, 0xE5,
- 0x17, 0xF0, 0x95, 0x43, 0xD1, 0x14, 0xBC, 0xC0, 0x5D, 0x66, 0x93, 0xE6,
- 0x82, 0x4B, 0x71, 0x67, 0xFA, 0x40, 0xE6, 0x8A, 0x33, 0x85, 0x66, 0x19,
- 0xB5, 0xE6, 0xF7, 0xA9, 0x0C, 0x18, 0x9A, 0xF2, 0xFF, 0x10, 0x26, 0x0C,
- 0xBE, 0x23, 0xAE, 0xD7, 0x10, 0xF6, 0x15, 0x09, 0xE0, 0x85, 0xB9, 0x9B,
- 0x30, 0x5F, 0x10, 0x6E, 0x4D, 0x9F, 0xCA, 0x32, 0xBF, 0x24, 0xE8, 0x58,
- 0x66, 0x0B, 0x1E, 0x56, 0x73, 0x6C, 0xBD, 0x3E, 0x41, 0xFE, 0x3A, 0x2A,
- 0x8C, 0x1C, 0x2E, 0x64, 0x43, 0x3D, 0x5B, 0x73, 0x53, 0x60, 0x46, 0xD5,
- 0x64, 0xE8, 0xC5, 0x1A, 0xD2, 0x4C, 0x8E, 0x20, 0xF9, 0x45, 0x2E, 0xA2,
- 0xF7, 0x72, 0xC5, 0xD3, 0xCD, 0xE1, 0xDB, 0x3D, 0xAB, 0xA2, 0xFA, 0xD3,
- 0x16, 0x96, 0xFF, 0x00, 0x20, 0x8B, 0xBE, 0xF7};
-const uint8_t g_ptBR_Locale[] = {
- 0x78, 0x9C, 0x9D, 0x56, 0x3D, 0x6F, 0xD4, 0x40, 0x10, 0xAD, 0x83, 0xC4,
- 0x7F, 0x58, 0x59, 0x89, 0x0E, 0xA4, 0x24, 0x86, 0x92, 0xC8, 0x67, 0xE9,
- 0x92, 0x0B, 0x39, 0x94, 0x18, 0x9D, 0xCE, 0x11, 0x88, 0x34, 0x68, 0x6D,
- 0xEF, 0xD9, 0x9B, 0xD8, 0xBB, 0xC7, 0xDA, 0x4E, 0xB0, 0x6B, 0x1A, 0x3A,
- 0x28, 0x29, 0x53, 0x20, 0x2A, 0x44, 0x83, 0x44, 0x49, 0x91, 0xDF, 0x82,
- 0xB8, 0x9F, 0xC1, 0xFA, 0xF3, 0xFC, 0xB1, 0x36, 0x06, 0x37, 0xDE, 0x99,
- 0x79, 0x6F, 0x3D, 0xF3, 0x76, 0x76, 0x64, 0xC5, 0xA5, 0x26, 0x74, 0x11,
- 0x20, 0xD0, 0x43, 0x63, 0x69, 0x15, 0xBC, 0x3E, 0x5C, 0x48, 0xC0, 0x42,
- 0xBE, 0x39, 0x96, 0xD6, 0x1F, 0x6F, 0xD7, 0x1F, 0xDE, 0xFD, 0x7E, 0xFF,
- 0x69, 0xFD, 0xED, 0xEB, 0x83, 0x5F, 0x3F, 0xBE, 0xAF, 0x3F, 0xFF, 0x7C,
- 0x28, 0xA9, 0xF7, 0xEF, 0x01, 0xA0, 0x24, 0x14, 0x62, 0x41, 0xA6, 0x47,
- 0x9E, 0x41, 0x5D, 0x3F, 0x67, 0xDB, 0x0C, 0xD9, 0x94, 0x61, 0x48, 0x12,
- 0xD4, 0x16, 0x50, 0x3C, 0x4A, 0x02, 0xE7, 0x39, 0x0F, 0xF9, 0x89, 0xBD,
- 0x95, 0xD9, 0xEA, 0x25, 0x24, 0x08, 0x33, 0xAA, 0xC8, 0x99, 0x59, 0x89,
- 0x2C, 0xD1, 0x35, 0x62, 0x1D, 0x31, 0x0F, 0xB2, 0xBB, 0x2F, 0xA2, 0x00,
- 0x34, 0x18, 0x76, 0x85, 0x04, 0x2C, 0x82, 0x5F, 0x86, 0xC4, 0x11, 0xFB,
- 0x5D, 0xA1, 0x1F, 0xDA, 0xD4, 0x0F, 0x44, 0x01, 0x1F, 0x05, 0xC8, 0x33,
- 0x84, 0xB9, 0xD2, 0x30, 0x08, 0xC5, 0x11, 0x42, 0xAF, 0xBB, 0x48, 0x16,
- 0x8A, 0x9B, 0x21, 0x90, 0xAF, 0x4B, 0x09, 0xAB, 0x92, 0x02, 0x68, 0x18,
- 0x6C, 0x2C, 0x3D, 0x96, 0x1A, 0xDA, 0x8A, 0x75, 0x15, 0x2B, 0x2A, 0x96,
- 0x53, 0x2C, 0xA6, 0x58, 0x4B, 0xB1, 0x92, 0x62, 0x1D, 0xC5, 0x22, 0x8A,
- 0xF5, 0x13, 0x6B, 0x27, 0x96, 0xAD, 0x5F, 0x31, 0x0B, 0x46, 0x95, 0x16,
- 0xE4, 0x96, 0x6A, 0x51, 0x0F, 0x93, 0x24, 0x9D, 0xC4, 0x28, 0xBD, 0x3E,
- 0xB2, 0x43, 0xDE, 0xD2, 0x7B, 0x4B, 0xDE, 0x80, 0xB0, 0x11, 0x0B, 0x10,
- 0x6F, 0x3E, 0x71, 0xE8, 0x4D, 0x08, 0x59, 0xD0, 0x15, 0xC2, 0xA4, 0x23,
- 0xE4, 0xA3, 0xB7, 0x5D, 0x91, 0xBB, 0x5B, 0x03, 0x5A, 0x9B, 0xE4, 0x40,
- 0xBA, 0x12, 0xD4, 0xD3, 0x38, 0xFF, 0xBC, 0xB0, 0x76, 0x51, 0xED, 0x52,
- 0xDA, 0x15, 0xB4, 0x13, 0x6F, 0xE7, 0x2B, 0xC8, 0xB3, 0x3B, 0x49, 0x0F,
- 0x31, 0x6C, 0x61, 0xE4, 0x55, 0x2F, 0x7F, 0xEE, 0x52, 0x27, 0x1A, 0x3F,
- 0xA4, 0xC2, 0xA8, 0x87, 0xE6, 0x8D, 0x10, 0xD8, 0x98, 0x95, 0xCD, 0x11,
- 0x83, 0x95, 0x7D, 0xB9, 0xA5, 0x1E, 0x1E, 0x29, 0x72, 0xF2, 0x2E, 0x1D,
- 0x93, 0x69, 0xE9, 0x00, 0xE9, 0xAA, 0x20, 0xF0, 0xD9, 0x25, 0x37, 0x86,
- 0x57, 0xE6, 0xB5, 0x60, 0x80, 0xE6, 0x30, 0xE0, 0xF2, 0x90, 0x52, 0xE8,
- 0xD2, 0x93, 0xCF, 0xB7, 0x65, 0xE8, 0xBA, 0x92, 0x7A, 0xCC, 0x9F, 0x5D,
- 0x30, 0x1D, 0xF1, 0x29, 0x09, 0x46, 0x1A, 0x7F, 0xB2, 0xD5, 0x2B, 0xFE,
- 0x24, 0x32, 0x94, 0xA4, 0xAE, 0x5D, 0x5C, 0x4A, 0x6C, 0x49, 0xFD, 0x7F,
- 0xBE, 0x87, 0x2C, 0x4E, 0x9F, 0xCA, 0x9A, 0x26, 0x0F, 0xE6, 0xF8, 0x0E,
- 0x65, 0xC1, 0x86, 0xD5, 0xE4, 0x00, 0x50, 0xF3, 0xE4, 0x92, 0x04, 0xD8,
- 0x6B, 0x48, 0x52, 0xF1, 0xD4, 0x24, 0x99, 0xCD, 0x46, 0x0E, 0x2F, 0x65,
- 0xC4, 0xEF, 0xD5, 0x48, 0xD7, 0x47, 0xFE, 0x08, 0x5C, 0x28, 0x72, 0x05,
- 0xDC, 0xC5, 0xCE, 0xA4, 0x48, 0xC9, 0x19, 0x77, 0x38, 0x35, 0x55, 0x61,
- 0x36, 0x3B, 0xD0, 0xB4, 0x03, 0x5D, 0x1F, 0xC4, 0xC8, 0x35, 0x48, 0x39,
- 0x4D, 0x42, 0x22, 0x40, 0xA3, 0xDC, 0xBC, 0x27, 0xCE, 0xB9, 0xB7, 0x68,
- 0x94, 0x93, 0x48, 0xB3, 0xAE, 0x66, 0x9E, 0xAF, 0x1F, 0x4F, 0x9F, 0xDE,
- 0xBC, 0x84, 0xCE, 0x69, 0x7C, 0x91, 0xE9, 0x56, 0x05, 0xA5, 0x4C, 0x12,
- 0x7A, 0x06, 0x62, 0x75, 0xF1, 0x6A, 0xBE, 0x3C, 0x27, 0xEE, 0xE3, 0xFD,
- 0x6D, 0x4A, 0x6A, 0xBC, 0x1B, 0xC7, 0x4F, 0xF6, 0xE3, 0x98, 0x0F, 0xB3,
- 0x1A, 0xAE, 0x9B, 0x6A, 0x86, 0x8C, 0x21, 0x62, 0x46, 0x92, 0xBA, 0x0D,
- 0x0A, 0xF6, 0x60, 0xF2, 0x0A, 0x31, 0x13, 0x91, 0x20, 0xFF, 0xEE, 0x4E,
- 0x9B, 0x97, 0x08, 0xD2, 0x2A, 0xA2, 0x2C, 0x6C, 0x53, 0xEB, 0x56, 0xDD,
- 0x95, 0x6F, 0x6F, 0x21, 0x13, 0x7B, 0x90, 0x37, 0xC6, 0x6E, 0xB1, 0x4B,
- 0x16, 0xEE, 0x24, 0xD8, 0x8C, 0x86, 0x2B, 0x9C, 0x34, 0xC3, 0xFE, 0x40,
- 0x46, 0x59, 0xC1, 0xCE, 0x40, 0x02, 0xEF, 0xAF, 0xD0, 0x97, 0xD4, 0xBD,
- 0x81, 0xF0, 0x18, 0x31, 0x2A, 0xA9, 0x8F, 0x5A, 0xE8, 0x8D, 0x30, 0xB5,
- 0x03, 0x2F, 0x4E, 0xA3, 0xA6, 0x4C, 0xDD, 0x59, 0xB4, 0x61, 0x6A, 0x48,
- 0xEA, 0x62, 0x9B, 0x4F, 0xA2, 0x1A, 0xA0, 0x87, 0x84, 0x7D, 0x9A, 0x2C,
- 0x24, 0xF5, 0x70, 0x71, 0xF6, 0x0F, 0xB4, 0xEA, 0x39, 0xB4, 0x48, 0xE9,
- 0x28, 0x6C, 0xA5, 0x9D, 0xDC, 0xFB, 0x68, 0x85, 0x96, 0xD0, 0x2C, 0xC6,
- 0x6D, 0x61, 0xE6, 0x7B, 0x6A, 0x11, 0xFF, 0xC3, 0xB3, 0xC0, 0x9C, 0xCB,
- 0x23, 0x8B, 0x01, 0x98, 0x60, 0x4A, 0x7A, 0x00, 0x47, 0x34, 0x64, 0x18,
- 0x31, 0xA0, 0x07, 0x56, 0x07, 0x62, 0x62, 0x51, 0x03, 0x81, 0x39, 0xFE,
- 0x2B, 0x64, 0x86, 0x0C, 0x86, 0x6E, 0x7A, 0x21, 0x13, 0x06, 0x0D, 0x7E,
- 0xC3, 0xFA, 0x20, 0xE7, 0x0E, 0xC4, 0x1D, 0x80, 0x53, 0x1A, 0x87, 0x57,
- 0x10, 0x9C, 0xD0, 0xC0, 0xC1, 0x66, 0x52, 0xD3, 0xDE, 0x8B, 0x67, 0x40,
- 0xEB, 0x07, 0x73, 0x01, 0x4C, 0x87, 0x16, 0xE0, 0x45, 0xEF, 0xA7, 0x39,
- 0xD6, 0x4E, 0xAA, 0x04, 0x67, 0xBD, 0x30, 0x9D, 0x0E, 0x82, 0x69, 0x51,
- 0x48, 0xEC, 0x4B, 0x9A, 0x22, 0xB3, 0x24, 0xD3, 0xC1, 0x56, 0x39, 0x4F,
- 0x45, 0xCE, 0xFE, 0xF7, 0xD5, 0x3F, 0x30, 0xBB, 0xD9, 0x9B};
-const uint8_t g_nlNL_Locale[] = {
- 0x78, 0x9C, 0x95, 0x56, 0x4D, 0x4F, 0xDC, 0x30, 0x10, 0x3D, 0x53, 0xA9,
- 0xFF, 0xC1, 0x8A, 0x8A, 0x68, 0x25, 0x96, 0x2D, 0x47, 0x50, 0x88, 0xB4,
- 0x05, 0x0A, 0x15, 0x04, 0xAD, 0x58, 0xDA, 0xAA, 0x5C, 0x2A, 0x6F, 0x62,
- 0x76, 0xBD, 0x24, 0xF6, 0xCA, 0x89, 0x41, 0xC9, 0xB1, 0x52, 0x8F, 0xFD,
- 0x27, 0xAD, 0xDA, 0x5B, 0xFF, 0x4F, 0xA5, 0x4A, 0xFC, 0x8C, 0x8E, 0xF3,
- 0x45, 0x12, 0x3B, 0x69, 0xC8, 0x05, 0xCF, 0x9B, 0xF7, 0xBC, 0x33, 0xCF,
- 0xCE, 0x10, 0x3B, 0xE0, 0x1E, 0x0E, 0x08, 0x62, 0x38, 0x24, 0x07, 0x16,
- 0x0B, 0x3E, 0x5F, 0x9C, 0x5B, 0xC8, 0x27, 0x91, 0x77, 0x60, 0x3D, 0x7C,
- 0xFB, 0xFD, 0xF7, 0xEB, 0xAF, 0x87, 0x9F, 0x3F, 0x5E, 0xE6, 0xAB, 0x57,
- 0x96, 0xF3, 0xFC, 0x19, 0x42, 0xB6, 0xE2, 0x33, 0x1F, 0x8B, 0x59, 0x12,
- 0xCE, 0x79, 0x10, 0x15, 0xD2, 0x85, 0x20, 0x0B, 0x2E, 0x28, 0x66, 0x8A,
- 0xB5, 0x81, 0xEC, 0x90, 0xB3, 0x78, 0x79, 0x01, 0xA9, 0x48, 0xC5, 0x1B,
- 0x79, 0xEC, 0xAC, 0x30, 0x93, 0x58, 0x50, 0x7B, 0x9C, 0x87, 0xB5, 0xCC,
- 0x0D, 0x99, 0x8B, 0x8E, 0x54, 0x88, 0xB1, 0x88, 0x0D, 0x38, 0x5E, 0x0B,
- 0x1A, 0x98, 0xF8, 0xC4, 0xB4, 0xCB, 0x4A, 0x32, 0x33, 0x1C, 0x98, 0x60,
- 0x2C, 0x17, 0x32, 0x8A, 0x65, 0x64, 0x48, 0x45, 0x64, 0x1D, 0x93, 0x70,
- 0x4E, 0x84, 0x21, 0xC7, 0x6F, 0x63, 0x6E, 0xCE, 0x30, 0x7E, 0xD7, 0x25,
- 0xF2, 0x89, 0xD7, 0x4E, 0xA1, 0x62, 0x5D, 0x19, 0x58, 0x37, 0x14, 0xE1,
- 0xF9, 0x5C, 0x1C, 0x58, 0xBB, 0x56, 0xCB, 0x59, 0xB3, 0xAB, 0x26, 0x83,
- 0xBA, 0xEC, 0x7C, 0x8A, 0x99, 0x66, 0x2F, 0xCD, 0x56, 0x9A, 0x5D, 0x34,
- 0xFB, 0x67, 0xF6, 0xCE, 0x6C, 0x5B, 0xBF, 0x63, 0x3E, 0x4E, 0x6A, 0x17,
- 0x10, 0x22, 0x27, 0xE5, 0x70, 0x71, 0xA1, 0x1A, 0xB5, 0xAE, 0x40, 0xB8,
- 0x5E, 0x06, 0xD4, 0xA7, 0x2C, 0xD2, 0xD1, 0x7B, 0x4E, 0x4C, 0xB0, 0x0F,
- 0xFB, 0x12, 0xA1, 0xE3, 0x77, 0x82, 0xAE, 0x74, 0x34, 0xC5, 0x71, 0x93,
- 0x8C, 0xB2, 0x95, 0xA1, 0xF2, 0xD6, 0x49, 0xE7, 0x2D, 0x68, 0xE5, 0x6B,
- 0x95, 0x6B, 0x45, 0x6B, 0xE5, 0x6A, 0x75, 0x6A, 0x25, 0x76, 0x17, 0x17,
- 0x12, 0x41, 0x7D, 0x4A, 0xC2, 0xFA, 0xCB, 0x5D, 0x40, 0xCE, 0xC4, 0x85,
- 0x63, 0x28, 0x83, 0x66, 0x6A, 0xDA, 0x4A, 0xA1, 0xC7, 0xB0, 0xB6, 0x39,
- 0x11, 0xB8, 0xB6, 0x2F, 0x44, 0xCE, 0x9B, 0x43, 0x7B, 0xAC, 0xFE, 0x56,
- 0xC0, 0xE4, 0xA8, 0x02, 0x50, 0xB6, 0x2A, 0x05, 0x30, 0x9B, 0xC6, 0xAD,
- 0xE1, 0x94, 0xA3, 0x3E, 0x18, 0x3E, 0xC5, 0x31, 0xB8, 0xCE, 0x2A, 0x83,
- 0x2B, 0xA4, 0x98, 0x5F, 0x37, 0x32, 0x08, 0x2C, 0xE7, 0x18, 0x1E, 0x74,
- 0x84, 0x5C, 0x78, 0xD0, 0x27, 0x78, 0x54, 0xEF, 0x15, 0xB3, 0x4B, 0x1A,
- 0x70, 0xB6, 0xB0, 0x9C, 0xA7, 0xAA, 0x42, 0xE2, 0x83, 0x68, 0x04, 0x9A,
- 0xD1, 0x60, 0x4D, 0xB4, 0xE4, 0x22, 0xCE, 0x54, 0x23, 0x5D, 0x81, 0x50,
- 0x03, 0x29, 0x7A, 0x8F, 0x69, 0xD8, 0xEA, 0xBD, 0x86, 0x34, 0x7A, 0x3F,
- 0xDD, 0x77, 0xDD, 0xFD, 0xD9, 0x6C, 0x0B, 0x49, 0x29, 0xB6, 0xD0, 0xB5,
- 0x3D, 0xAE, 0x11, 0xBB, 0x94, 0x79, 0xEB, 0x85, 0x72, 0xA0, 0x26, 0x6B,
- 0xBC, 0x90, 0x0C, 0x12, 0x14, 0x5D, 0x2B, 0x49, 0x9B, 0xAF, 0x7A, 0x6E,
- 0x75, 0x58, 0x9C, 0xF7, 0x15, 0xA0, 0xE5, 0x25, 0x38, 0x49, 0x5C, 0xFF,
- 0xF6, 0x34, 0x8C, 0x66, 0xC7, 0x47, 0x6F, 0xEF, 0x3F, 0xE2, 0xE5, 0x59,
- 0x7A, 0x9D, 0x5B, 0x55, 0x27, 0x65, 0x4A, 0x26, 0xD5, 0x20, 0x6E, 0xFA,
- 0xD5, 0xC0, 0xCA, 0x7F, 0x94, 0x52, 0xDD, 0x5D, 0xCF, 0x72, 0xD2, 0xED,
- 0x34, 0xDD, 0xDB, 0x49, 0xD3, 0xD4, 0x1E, 0x37, 0x78, 0xDD, 0x52, 0x4F,
- 0x0A, 0x41, 0x98, 0x97, 0x58, 0xCE, 0x0B, 0x94, 0xAB, 0xF7, 0xF6, 0xA2,
- 0xC1, 0xEA, 0x35, 0x11, 0x1E, 0x61, 0x71, 0xF1, 0xC3, 0x9B, 0xBA, 0x4E,
- 0x39, 0xA2, 0x75, 0x51, 0x75, 0xF6, 0xD8, 0xEC, 0x46, 0x13, 0x2A, 0xB6,
- 0x87, 0x99, 0x4A, 0x43, 0x0C, 0x97, 0x61, 0xBB, 0xDC, 0x25, 0x4F, 0x77,
- 0x0A, 0x16, 0x82, 0xCB, 0x35, 0x55, 0x97, 0x60, 0x67, 0xA0, 0xA2, 0xEA,
- 0x60, 0x73, 0xA0, 0x20, 0xA4, 0x4C, 0x46, 0x96, 0x33, 0x1A, 0x48, 0x4F,
- 0x89, 0xE0, 0x96, 0xF3, 0x5A, 0x63, 0x3F, 0x1A, 0xD3, 0x38, 0xF1, 0xF2,
- 0x38, 0x1A, 0xCE, 0x34, 0xC1, 0xF2, 0x1A, 0x66, 0x81, 0xE5, 0xFC, 0xF9,
- 0xF2, 0x1D, 0xE6, 0x4C, 0x83, 0xD1, 0xA3, 0xA2, 0x11, 0x57, 0x0B, 0x18,
- 0x2D, 0xEF, 0x2F, 0x9F, 0x20, 0xAB, 0x1F, 0x84, 0x26, 0xCA, 0x06, 0x9D,
- 0x56, 0xB7, 0x7A, 0xD9, 0x93, 0x35, 0xB9, 0xC1, 0x5E, 0x39, 0x4C, 0xCB,
- 0xB0, 0xD8, 0xD3, 0x4D, 0xE0, 0xFB, 0xCC, 0x47, 0x53, 0xF0, 0x67, 0x6C,
- 0x26, 0x50, 0x46, 0x39, 0xEB, 0x21, 0x1C, 0x72, 0x29, 0x28, 0x11, 0x68,
- 0x16, 0xFB, 0x1D, 0x8C, 0x89, 0x0F, 0xDF, 0x3F, 0x68, 0x4A, 0xFF, 0x4B,
- 0x39, 0x85, 0xEF, 0x3D, 0x72, 0xDF, 0x4B, 0x99, 0x08, 0x3C, 0x87, 0x77,
- 0xAC, 0x8F, 0x72, 0xB5, 0xC4, 0xB4, 0x83, 0x70, 0xC6, 0x53, 0x79, 0x8B,
- 0xD1, 0x09, 0x8F, 0x97, 0xD4, 0x53, 0x3D, 0x8D, 0x3E, 0xBC, 0x43, 0x6E,
- 0x3F, 0x19, 0x0C, 0xF0, 0x96, 0xBC, 0x24, 0x5F, 0xF6, 0xFE, 0x34, 0x70,
- 0x17, 0xAA, 0x4B, 0x74, 0xDE, 0x4B, 0x9B, 0xF1, 0x41, 0x34, 0x37, 0x91,
- 0x6C, 0xB1, 0xE2, 0x19, 0x33, 0x2F, 0x32, 0x1B, 0x6D, 0xB5, 0xF3, 0xB4,
- 0xC7, 0xF9, 0xA7, 0xBA, 0xF3, 0x0F, 0xD5, 0xFA, 0xC0, 0xFA};
-const uint8_t g_ruRU_Locale[] = {
- 0x78, 0x9C, 0xAD, 0x57, 0x4D, 0x4F, 0x13, 0x41, 0x18, 0x3E, 0x63, 0xE2,
- 0x7F, 0x98, 0x6C, 0x24, 0x68, 0x02, 0xAD, 0x1E, 0x25, 0x65, 0x13, 0x22,
- 0x0A, 0x06, 0xD7, 0x90, 0x16, 0x34, 0x72, 0x31, 0xDB, 0xDD, 0xA1, 0x5D,
- 0xE8, 0xEE, 0x90, 0xE9, 0x6E, 0xB0, 0x7B, 0x2A, 0x85, 0xE8, 0x05, 0x25,
- 0xE1, 0xA0, 0x47, 0xF4, 0xE4, 0xC9, 0x50, 0xBE, 0x12, 0x82, 0xB6, 0x24,
- 0xFE, 0x82, 0xD9, 0xFF, 0x60, 0xD4, 0x9F, 0xE1, 0x3B, 0xFB, 0xD1, 0xEE,
- 0xB7, 0xC5, 0xD8, 0x1E, 0x3A, 0xF3, 0x3E, 0xCF, 0xF3, 0xCE, 0xFB, 0xB5,
- 0xD3, 0xB6, 0xD4, 0x20, 0x8A, 0xDC, 0xC0, 0xC8, 0x90, 0x75, 0x3C, 0x23,
- 0x50, 0xEB, 0x65, 0x79, 0x45, 0x40, 0x2A, 0x6E, 0x2A, 0x33, 0xC2, 0x8F,
- 0xAB, 0xDD, 0xDF, 0x47, 0x5F, 0x6E, 0xC3, 0xC7, 0xAF, 0xDE, 0x87, 0x9F,
- 0xEF, 0x8F, 0xEE, 0x08, 0xE2, 0xCD, 0x1B, 0x08, 0x95, 0x38, 0xDF, 0x50,
- 0x65, 0x5A, 0x69, 0xE9, 0x55, 0xD2, 0x68, 0xFA, 0xD2, 0x1A, 0xC5, 0x35,
- 0x42, 0x35, 0xD9, 0xE0, 0xAC, 0x31, 0x54, 0xD2, 0x89, 0x61, 0xD6, 0x9F,
- 0x02, 0xD4, 0xE4, 0xFB, 0x31, 0x6F, 0x2F, 0x3A, 0xFB, 0xAC, 0xC7, 0x4E,
- 0x58, 0xD7, 0x69, 0x3B, 0xFB, 0xA5, 0xA2, 0x67, 0x0B, 0xC3, 0xBB, 0xEC,
- 0x9C, 0x9D, 0x38, 0x6D, 0xD6, 0x65, 0x5F, 0x53, 0x09, 0xEC, 0x9B, 0xAB,
- 0xED, 0xB0, 0x6E, 0x1A, 0xD8, 0x65, 0x57, 0xA0, 0x3D, 0xCF, 0xD3, 0xA6,
- 0x02, 0x17, 0xCE, 0x3B, 0xD6, 0xCB, 0x86, 0x32, 0xDC, 0x75, 0x21, 0x91,
- 0x53, 0x67, 0xC7, 0xD9, 0xCE, 0x08, 0xC7, 0xD9, 0x86, 0x50, 0x7A, 0x4E,
- 0x07, 0x72, 0x3E, 0xCE, 0xC8, 0x97, 0xF5, 0xD9, 0x65, 0x3E, 0xA1, 0xC7,
- 0xFA, 0x79, 0xF0, 0x19, 0x1C, 0x71, 0x09, 0x91, 0xC4, 0x09, 0xC8, 0x5F,
- 0x0F, 0x1A, 0x10, 0x6E, 0x08, 0x92, 0xAB, 0x55, 0x3A, 0x23, 0xDC, 0x13,
- 0x92, 0x9D, 0x29, 0xE4, 0x34, 0x25, 0x0D, 0x1B, 0xA1, 0x1F, 0x99, 0xB2,
- 0xFF, 0xDD, 0x8A, 0xD4, 0xD8, 0xFD, 0x1E, 0xA4, 0x06, 0xE1, 0x16, 0x3F,
- 0x15, 0xF1, 0xAB, 0x9E, 0x8A, 0xB9, 0x25, 0x2F, 0xE4, 0xD7, 0x5A, 0x95,
- 0x5B, 0xA1, 0xD1, 0x87, 0x9D, 0x08, 0x01, 0xF6, 0x21, 0x98, 0x4B, 0x3E,
- 0x9F, 0x7E, 0x50, 0x7B, 0xEC, 0xBC, 0x54, 0xE4, 0xD8, 0x90, 0x74, 0x05,
- 0x31, 0xF5, 0x00, 0x3C, 0x73, 0x87, 0x78, 0x0F, 0xD6, 0x17, 0xEC, 0x32,
- 0x4E, 0x3A, 0x81, 0x72, 0xF7, 0xC1, 0x4F, 0x1A, 0x08, 0xC3, 0xD8, 0x76,
- 0xF5, 0xDD, 0x38, 0xF0, 0x06, 0xCE, 0xED, 0x40, 0x14, 0xE7, 0x40, 0x38,
- 0x4D, 0x9C, 0xEB, 0xEC, 0x03, 0x08, 0x0E, 0x9D, 0xD7, 0x49, 0xE5, 0xB6,
- 0xB3, 0xC3, 0x8E, 0xE1, 0xDD, 0xF7, 0xDA, 0xEC, 0x83, 0xC8, 0x5D, 0xA5,
- 0xE4, 0x1C, 0x9B, 0x2E, 0xD7, 0xFF, 0x81, 0xB3, 0x1D, 0x3F, 0xF2, 0x90,
- 0xF5, 0xE2, 0xA6, 0x03, 0xA7, 0x13, 0x37, 0x7D, 0x72, 0xDA, 0x71, 0xD3,
- 0xE7, 0x24, 0xEB, 0x30, 0x45, 0xC8, 0x8E, 0xB3, 0x43, 0xD5, 0x31, 0xD5,
- 0x54, 0x0D, 0xEB, 0xE1, 0xEB, 0xC9, 0x37, 0x89, 0xB3, 0x12, 0xB4, 0x33,
- 0xD8, 0x44, 0xA1, 0xA5, 0x18, 0x84, 0x86, 0xDB, 0x90, 0x73, 0x4C, 0xE5,
- 0x90, 0x5F, 0xD8, 0xF1, 0x91, 0xE9, 0x23, 0xD6, 0x2B, 0x38, 0x6F, 0x61,
- 0x6C, 0xB8, 0x61, 0x88, 0x44, 0x8D, 0xC8, 0x5D, 0x05, 0x6A, 0xB8, 0x6A,
- 0x8B, 0xB1, 0xBB, 0xD6, 0xB3, 0xAA, 0xB2, 0x89, 0x97, 0x64, 0xD3, 0xC4,
- 0xD4, 0x18, 0xD4, 0x7E, 0x60, 0xF1, 0xAF, 0xE3, 0x35, 0xAB, 0xD1, 0x10,
- 0xC4, 0x39, 0x24, 0xC1, 0x0B, 0xBD, 0x80, 0x17, 0x9A, 0x80, 0x27, 0x64,
- 0x82, 0x57, 0x62, 0x40, 0xCD, 0xD2, 0x36, 0x88, 0x51, 0xFB, 0x57, 0xAD,
- 0x8E, 0x55, 0x90, 0xCE, 0x15, 0x24, 0xA9, 0xC0, 0x95, 0x23, 0x69, 0x9A,
- 0x75, 0x42, 0xCD, 0xA1, 0x2A, 0xAE, 0x41, 0x28, 0x62, 0xF1, 0x8B, 0x60,
- 0x6A, 0x7A, 0xAC, 0x08, 0x21, 0x4B, 0xA4, 0x08, 0x0B, 0xD3, 0x92, 0x34,
- 0x5D, 0xA9, 0xA0, 0xD5, 0x52, 0x31, 0x44, 0xC9, 0xD2, 0x78, 0xC9, 0x5F,
- 0x4F, 0xE3, 0x26, 0xED, 0x4B, 0x46, 0x12, 0xF8, 0x19, 0x73, 0x49, 0x9C,
- 0xCF, 0xB3, 0x8D, 0xE5, 0xE6, 0xB7, 0x7C, 0x19, 0xAC, 0xC1, 0x1C, 0xCC,
- 0xCB, 0xC6, 0xFA, 0xC6, 0x82, 0xDE, 0xAC, 0x3C, 0x9C, 0x7B, 0xB4, 0xF5,
- 0xFC, 0x55, 0x7D, 0xD1, 0x5E, 0xF5, 0x8A, 0x14, 0x26, 0xB9, 0x4A, 0xC3,
- 0xD2, 0xAB, 0x98, 0x46, 0x2B, 0x15, 0xB1, 0xF9, 0x21, 0x81, 0x0D, 0x66,
- 0x59, 0x11, 0x44, 0x7B, 0xD2, 0xB6, 0xEF, 0x17, 0x6C, 0xDB, 0x2E, 0x15,
- 0x23, 0xBC, 0x6C, 0xA9, 0x62, 0x51, 0x8A, 0x0D, 0xA5, 0x35, 0xD4, 0xDE,
- 0x1A, 0x59, 0xBB, 0x89, 0xA9, 0x82, 0x0D, 0xD3, 0x97, 0x8E, 0x27, 0x75,
- 0xBC, 0x1E, 0x89, 0x1C, 0x06, 0x79, 0x0D, 0x53, 0x1D, 0x8B, 0x9A, 0x7C,
- 0xF7, 0x2A, 0x56, 0x34, 0x5D, 0x86, 0x21, 0x98, 0x0C, 0xBC, 0x78, 0x70,
- 0xA6, 0xA0, 0x46, 0x89, 0xB5, 0xA9, 0xF1, 0x11, 0xF8, 0xFE, 0x71, 0x44,
- 0xC9, 0x20, 0x85, 0xF1, 0x11, 0x05, 0xBA, 0x66, 0x58, 0x4D, 0x41, 0x9C,
- 0x1A, 0x91, 0x6E, 0x63, 0x4A, 0x04, 0xF1, 0x6E, 0x82, 0x3D, 0xAC, 0x4C,
- 0xA4, 0xE1, 0x41, 0x37, 0x22, 0xA5, 0x89, 0x1A, 0x83, 0x29, 0x74, 0x37,
- 0x82, 0xE8, 0x7E, 0x47, 0x47, 0x19, 0x39, 0x2A, 0xAD, 0x49, 0xF8, 0x42,
- 0x10, 0xCB, 0x2B, 0xE5, 0x6B, 0xC8, 0xC2, 0x9D, 0x48, 0x88, 0xDC, 0xAB,
- 0x2E, 0x11, 0x37, 0x7F, 0xCA, 0x5B, 0x9B, 0x78, 0x4D, 0x56, 0x82, 0xBB,
- 0x35, 0xD8, 0xFA, 0x3E, 0xA5, 0x16, 0xFC, 0xE0, 0x54, 0xD1, 0x12, 0xD4,
- 0xA7, 0x98, 0x4E, 0xD0, 0x0C, 0x8D, 0x18, 0x39, 0x84, 0x07, 0xC4, 0xA2,
- 0x1A, 0xA6, 0xA8, 0x62, 0xAA, 0x19, 0x8C, 0x59, 0x95, 0x54, 0x31, 0x5A,
- 0xD2, 0xFE, 0x4A, 0x59, 0xC0, 0x55, 0x8A, 0xB7, 0x72, 0x29, 0xB3, 0x54,
- 0xAE, 0xC2, 0x23, 0x96, 0x47, 0x59, 0xAE, 0xCB, 0x5A, 0x06, 0x61, 0x91,
- 0xD8, 0xD6, 0x86, 0x8C, 0xE6, 0x89, 0x59, 0xD7, 0x14, 0x9E, 0xD3, 0xD4,
- 0xB3, 0xC7, 0x48, 0xCA, 0x27, 0x43, 0x01, 0x94, 0x3A, 0x09, 0xC8, 0xE5,
- 0xDC, 0xA3, 0x81, 0x5B, 0xE3, 0x59, 0xA2, 0x27, 0xB9, 0xB4, 0x0A, 0x19,
- 0x89, 0x26, 0xB5, 0x2C, 0xA3, 0xB6, 0x4E, 0x5C, 0xA6, 0x17, 0xA4, 0x7B,
- 0xB3, 0x85, 0xFA, 0x59, 0x2A, 0x7A, 0xFF, 0x3D, 0xC4, 0x3F, 0xDE, 0xCB,
- 0x8B, 0xC4};
-
-static std::unique_ptr<IFX_Locale> XFA_GetLocaleFromBuffer(const uint8_t* pBuf,
- int nBufLen) {
- if (!pBuf || nBufLen <= 0)
- return nullptr;
- CFX_GEModule* pGeModule = CFX_GEModule::Get();
- if (!pGeModule)
- return nullptr;
-
- CCodec_ModuleMgr* pCodecMgr = pGeModule->GetCodecModule();
- if (!pCodecMgr)
- return nullptr;
-
- std::unique_ptr<CXML_Element> pLocale;
- uint8_t* pOut = nullptr;
- uint32_t dwSize;
- pCodecMgr->GetFlateModule()->FlateOrLZWDecode(false, pBuf, nBufLen, true, 0,
- 0, 0, 0, 0, pOut, dwSize);
- if (pOut) {
- pLocale = CXML_Element::Parse(pOut, dwSize);
- FX_Free(pOut);
- }
- return pLocale ? std::unique_ptr<IFX_Locale>(
- new CXFA_XMLLocale(std::move(pLocale)))
- : nullptr;
-}
-
-static uint16_t XFA_GetLanguage(CFX_WideString wsLanguage) {
- uint16_t dwLangueID = XFA_LANGID_en_US;
- if (wsLanguage.GetLength() < 2) {
- return dwLangueID;
- }
- wsLanguage.MakeLower();
- uint32_t dwIDFirst = wsLanguage.GetAt(0) << 8 | wsLanguage.GetAt(1);
- uint32_t dwIDSecond = wsLanguage.GetLength() >= 5
- ? wsLanguage.GetAt(3) << 8 | wsLanguage.GetAt(4)
- : 0;
- switch (dwIDFirst) {
- case FXBSTR_ID(0, 0, 'z', 'h'): {
- if (dwIDSecond == FXBSTR_ID(0, 0, 'c', 'n')) {
- dwLangueID = XFA_LANGID_zh_CN;
- } else if (dwIDSecond == FXBSTR_ID(0, 0, 't', 'w')) {
- dwLangueID = XFA_LANGID_zh_TW;
- } else if (dwIDSecond == FXBSTR_ID(0, 0, 'h', 'k')) {
- dwLangueID = XFA_LANGID_zh_HK;
- }
- } break;
- case FXBSTR_ID(0, 0, 'j', 'a'):
- dwLangueID = XFA_LANGID_ja_JP;
- break;
- case FXBSTR_ID(0, 0, 'k', 'o'):
- dwLangueID = XFA_LANGID_ko_KR;
- break;
- case FXBSTR_ID(0, 0, 'e', 'n'): {
- if (dwIDSecond == FXBSTR_ID(0, 0, 'g', 'b')) {
- dwLangueID = XFA_LANGID_en_GB;
- } else {
- dwLangueID = XFA_LANGID_en_US;
- }
- } break;
- case FXBSTR_ID(0, 0, 'd', 'e'):
- dwLangueID = XFA_LANGID_de_DE;
- break;
- case FXBSTR_ID(0, 0, 'f', 'r'):
- dwLangueID = XFA_LANGID_fr_FR;
- break;
- case FXBSTR_ID(0, 0, 'e', 's'): {
- if (dwIDSecond == FXBSTR_ID(0, 0, 'e', 's')) {
- dwLangueID = XFA_LANGID_es_ES;
- } else {
- dwLangueID = XFA_LANGID_es_LA;
- }
- } break;
- case FXBSTR_ID(0, 0, 'i', 't'):
- dwLangueID = XFA_LANGID_it_IT;
- break;
- case FXBSTR_ID(0, 0, 'p', 't'):
- dwLangueID = XFA_LANGID_pt_BR;
- break;
- case FXBSTR_ID(0, 0, 'n', 'l'):
- dwLangueID = XFA_LANGID_nl_NL;
- break;
- case FXBSTR_ID(0, 0, 'r', 'u'):
- dwLangueID = XFA_LANGID_ru_RU;
- break;
- }
- return dwLangueID;
-}
-
-CXFA_LocaleMgr::CXFA_LocaleMgr(CXFA_Node* pLocaleSet, CFX_WideString wsDeflcid)
- : m_dwLocaleFlags(0x00) {
- m_dwDeflcid = XFA_GetLanguage(wsDeflcid);
- if (pLocaleSet) {
- CXFA_Node* pNodeLocale = pLocaleSet->GetNodeItem(XFA_NODEITEM_FirstChild);
- while (pNodeLocale) {
- m_LocaleArray.emplace_back(new CXFA_NodeLocale(pNodeLocale));
- pNodeLocale = pNodeLocale->GetNodeItem(XFA_NODEITEM_NextSibling);
- }
- }
- m_pDefLocale = GetLocaleByName(wsDeflcid);
-}
-
-CXFA_LocaleMgr::~CXFA_LocaleMgr() {}
-
-uint16_t CXFA_LocaleMgr::GetDefLocaleID() const {
- return m_dwDeflcid;
-}
-
-IFX_Locale* CXFA_LocaleMgr::GetDefLocale() {
- if (m_pDefLocale)
- return m_pDefLocale;
-
- if (!m_LocaleArray.empty())
- return m_LocaleArray[0].get();
-
- if (!m_XMLLocaleArray.empty())
- return m_XMLLocaleArray[0].get();
-
- std::unique_ptr<IFX_Locale> locale(GetLocale(m_dwDeflcid));
- m_pDefLocale = locale.get();
- if (locale)
- m_XMLLocaleArray.push_back(std::move(locale));
-
- return m_pDefLocale;
-}
-
-std::unique_ptr<IFX_Locale> CXFA_LocaleMgr::GetLocale(uint16_t lcid) {
- switch (lcid) {
- case XFA_LANGID_zh_CN:
- return XFA_GetLocaleFromBuffer(g_zhCN_Locale, sizeof(g_zhCN_Locale));
- case XFA_LANGID_zh_TW:
- return XFA_GetLocaleFromBuffer(g_zhTW_Locale, sizeof(g_zhTW_Locale));
- case XFA_LANGID_zh_HK:
- return XFA_GetLocaleFromBuffer(g_zhHK_Locale, sizeof(g_zhHK_Locale));
- case XFA_LANGID_ja_JP:
- return XFA_GetLocaleFromBuffer(g_jaJP_Locale, sizeof(g_jaJP_Locale));
- case XFA_LANGID_ko_KR:
- return XFA_GetLocaleFromBuffer(g_koKR_Locale, sizeof(g_koKR_Locale));
- case XFA_LANGID_en_GB:
- return XFA_GetLocaleFromBuffer(g_enGB_Locale, sizeof(g_enGB_Locale));
- case XFA_LANGID_es_LA:
- return XFA_GetLocaleFromBuffer(g_esLA_Locale, sizeof(g_esLA_Locale));
- case XFA_LANGID_es_ES:
- return XFA_GetLocaleFromBuffer(g_esES_Locale, sizeof(g_esES_Locale));
- case XFA_LANGID_de_DE:
- return XFA_GetLocaleFromBuffer(g_deDE_Loacale, sizeof(g_deDE_Loacale));
- case XFA_LANGID_fr_FR:
- return XFA_GetLocaleFromBuffer(g_frFR_Locale, sizeof(g_frFR_Locale));
- case XFA_LANGID_it_IT:
- return XFA_GetLocaleFromBuffer(g_itIT_Locale, sizeof(g_itIT_Locale));
- case XFA_LANGID_pt_BR:
- return XFA_GetLocaleFromBuffer(g_ptBR_Locale, sizeof(g_ptBR_Locale));
- case XFA_LANGID_nl_NL:
- return XFA_GetLocaleFromBuffer(g_nlNL_Locale, sizeof(g_nlNL_Locale));
- case XFA_LANGID_ru_RU:
- return XFA_GetLocaleFromBuffer(g_ruRU_Locale, sizeof(g_ruRU_Locale));
- case XFA_LANGID_en_US:
- default:
- return XFA_GetLocaleFromBuffer(g_enUS_Locale, sizeof(g_enUS_Locale));
- }
-}
-
-IFX_Locale* CXFA_LocaleMgr::GetLocaleByName(
- const CFX_WideString& wsLocaleName) {
- for (size_t i = 0; i < m_LocaleArray.size(); i++) {
- IFX_Locale* pLocale = m_LocaleArray[i].get();
- if (pLocale->GetName() == wsLocaleName)
- return pLocale;
- }
- if (wsLocaleName.GetLength() < 2)
- return nullptr;
- for (size_t i = 0; i < m_XMLLocaleArray.size(); i++) {
- IFX_Locale* pLocale = m_XMLLocaleArray[i].get();
- if (pLocale->GetName() == wsLocaleName)
- return pLocale;
- }
- uint16_t dwLangueID = XFA_GetLanguage(wsLocaleName);
- std::unique_ptr<IFX_Locale> pLocale(GetLocale(dwLangueID));
- IFX_Locale* pRetLocale = pLocale.get();
- if (pLocale)
- m_XMLLocaleArray.push_back(std::move(pLocale));
- return pRetLocale;
-}
-
-void CXFA_LocaleMgr::SetDefLocale(IFX_Locale* pLocale) {
- m_pDefLocale = pLocale;
-}
-
-CFX_WideStringC CXFA_LocaleMgr::GetConfigLocaleName(CXFA_Node* pConfig) {
- if (!(m_dwLocaleFlags & 0x01)) {
- m_wsConfigLocale.clear();
- if (pConfig) {
- CXFA_Node* pChildfConfig =
- pConfig->GetFirstChildByClass(XFA_Element::Acrobat);
- if (!pChildfConfig) {
- pChildfConfig = pConfig->GetFirstChildByClass(XFA_Element::Present);
- }
- CXFA_Node* pCommon =
- pChildfConfig
- ? pChildfConfig->GetFirstChildByClass(XFA_Element::Common)
- : nullptr;
- CXFA_Node* pLocale =
- pCommon ? pCommon->GetFirstChildByClass(XFA_Element::Locale)
- : nullptr;
- if (pLocale) {
- pLocale->TryCData(XFA_ATTRIBUTE_Value, m_wsConfigLocale, false);
- }
- }
- m_dwLocaleFlags |= 0x01;
- }
- return m_wsConfigLocale.AsStringC();
-}
-
-static bool g_bProviderTimeZoneSet = false;
-
-CXFA_TimeZoneProvider::CXFA_TimeZoneProvider() {
-#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
- if (!g_bProviderTimeZoneSet) {
- g_bProviderTimeZoneSet = true;
- _tzset();
- }
- m_tz.tzHour = (int8_t)(_timezone / 3600 * -1);
- m_tz.tzMinute = (int8_t)((FXSYS_abs(_timezone) % 3600) / 60);
-#else
- if (!g_bProviderTimeZoneSet) {
- g_bProviderTimeZoneSet = true;
- tzset();
- }
- m_tz.tzHour = (int8_t)(timezone / 3600 * -1);
- m_tz.tzMinute = (int8_t)((FXSYS_abs((int)timezone) % 3600) / 60);
-#endif
-}
-
-CXFA_TimeZoneProvider::~CXFA_TimeZoneProvider() {}
-
-void CXFA_TimeZoneProvider::GetTimeZone(FX_TIMEZONE* tz) const {
- *tz = m_tz;
-}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/xfa_localemgr.h b/chromium/third_party/pdfium/xfa/fxfa/parser/xfa_localemgr.h
deleted file mode 100644
index eb405dcfc72..00000000000
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/xfa_localemgr.h
+++ /dev/null
@@ -1,71 +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 XFA_FXFA_PARSER_XFA_LOCALEMGR_H_
-#define XFA_FXFA_PARSER_XFA_LOCALEMGR_H_
-
-#include <memory>
-#include <vector>
-
-#include "xfa/fgas/localization/fgas_datetime.h"
-#include "xfa/fgas/localization/fgas_locale.h"
-#include "xfa/fxfa/parser/xfa_localemgr.h"
-
-class CXFA_Node;
-class IFX_Locale;
-
-#define XFA_LANGID_zh_CN 0x0804
-#define XFA_LANGID_zh_TW 0x0404
-#define XFA_LANGID_zh_HK 0x0c04
-#define XFA_LANGID_ja_JP 0x0411
-#define XFA_LANGID_ko_KR 0x0412
-#define XFA_LANGID_en_US 0x0409
-#define XFA_LANGID_en_GB 0x0809
-#define XFA_LANGID_es_ES 0x0c0a
-#define XFA_LANGID_es_LA 0x080a
-#define XFA_LANGID_de_DE 0x0407
-#define XFA_LANGID_fr_FR 0x040c
-#define XFA_LANGID_it_IT 0x0410
-#define XFA_LANGID_pt_BR 0x0416
-#define XFA_LANGID_nl_NL 0x0413
-#define XFA_LANGID_ru_RU 0x0419
-
-class CXFA_LocaleMgr : public IFX_LocaleMgr {
- public:
- CXFA_LocaleMgr(CXFA_Node* pLocaleSet, CFX_WideString wsDeflcid);
- ~CXFA_LocaleMgr() override;
-
- // IFX_LocaleMgr
- uint16_t GetDefLocaleID() const override;
- IFX_Locale* GetDefLocale() override;
- IFX_Locale* GetLocaleByName(const CFX_WideString& wsLocaleName) override;
-
- void SetDefLocale(IFX_Locale* pLocale);
- CFX_WideStringC GetConfigLocaleName(CXFA_Node* pConfig);
-
- protected:
- std::unique_ptr<IFX_Locale> GetLocale(uint16_t lcid) override;
-
- std::vector<std::unique_ptr<IFX_Locale>> m_LocaleArray;
- std::vector<std::unique_ptr<IFX_Locale>> m_XMLLocaleArray;
- IFX_Locale* m_pDefLocale; // owned by m_LocaleArray or m_XMLLocaleArray.
- CFX_WideString m_wsConfigLocale;
- uint16_t m_dwDeflcid;
- uint16_t m_dwLocaleFlags;
-};
-
-class CXFA_TimeZoneProvider {
- public:
- CXFA_TimeZoneProvider();
- ~CXFA_TimeZoneProvider();
-
- void GetTimeZone(FX_TIMEZONE* tz) const;
-
- private:
- FX_TIMEZONE m_tz;
-};
-
-#endif // XFA_FXFA_PARSER_XFA_LOCALEMGR_H_
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/xfa_localevalue.cpp b/chromium/third_party/pdfium/xfa/fxfa/parser/xfa_localevalue.cpp
deleted file mode 100644
index 7e92535c3d5..00000000000
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/xfa_localevalue.cpp
+++ /dev/null
@@ -1,984 +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
-
-#include "xfa/fxfa/parser/xfa_localevalue.h"
-
-#include <vector>
-
-#include "core/fxcrt/fx_ext.h"
-#include "third_party/base/ptr_util.h"
-#include "third_party/base/stl_util.h"
-#include "xfa/fgas/localization/fgas_localeimp.h"
-#include "xfa/fxfa/parser/cxfa_document.h"
-#include "xfa/fxfa/parser/xfa_localemgr.h"
-#include "xfa/fxfa/parser/xfa_object.h"
-#include "xfa/fxfa/parser/xfa_utils.h"
-
-static const FX_DOUBLE fraction_scales[] = {0.1,
- 0.01,
- 0.001,
- 0.0001,
- 0.00001,
- 0.000001,
- 0.0000001,
- 0.00000001,
- 0.000000001,
- 0.0000000001,
- 0.00000000001,
- 0.000000000001,
- 0.0000000000001,
- 0.00000000000001,
- 0.000000000000001,
- 0.0000000000000001};
-CXFA_LocaleValue::CXFA_LocaleValue() {
- m_dwType = XFA_VT_NULL;
- m_bValid = true;
- m_pLocaleMgr = nullptr;
-}
-CXFA_LocaleValue::CXFA_LocaleValue(const CXFA_LocaleValue& value) {
- m_dwType = XFA_VT_NULL;
- m_bValid = true;
- m_pLocaleMgr = nullptr;
- *this = value;
-}
-CXFA_LocaleValue::CXFA_LocaleValue(uint32_t dwType,
- CXFA_LocaleMgr* pLocaleMgr) {
- m_dwType = dwType;
- m_bValid = (m_dwType != XFA_VT_NULL);
- m_pLocaleMgr = pLocaleMgr;
-}
-CXFA_LocaleValue::CXFA_LocaleValue(uint32_t dwType,
- const CFX_WideString& wsValue,
- CXFA_LocaleMgr* pLocaleMgr) {
- m_wsValue = wsValue;
- m_dwType = dwType;
- m_pLocaleMgr = pLocaleMgr;
- m_bValid = ValidateCanonicalValue(wsValue, dwType);
-}
-CXFA_LocaleValue::CXFA_LocaleValue(uint32_t dwType,
- const CFX_WideString& wsValue,
- const CFX_WideString& wsFormat,
- IFX_Locale* pLocale,
- CXFA_LocaleMgr* pLocaleMgr) {
- m_pLocaleMgr = pLocaleMgr;
- m_bValid = true;
- m_dwType = dwType;
- m_bValid = ParsePatternValue(wsValue, wsFormat, pLocale);
-}
-CXFA_LocaleValue& CXFA_LocaleValue::operator=(const CXFA_LocaleValue& value) {
- m_wsValue = value.m_wsValue;
- m_dwType = value.m_dwType;
- m_bValid = value.m_bValid;
- m_pLocaleMgr = value.m_pLocaleMgr;
- return *this;
-}
-CXFA_LocaleValue::~CXFA_LocaleValue() {}
-static FX_LOCALECATEGORY XFA_ValugeCategory(FX_LOCALECATEGORY eCategory,
- uint32_t dwValueType) {
- if (eCategory == FX_LOCALECATEGORY_Unknown) {
- switch (dwValueType) {
- case XFA_VT_BOOLEAN:
- case XFA_VT_INTEGER:
- case XFA_VT_DECIMAL:
- case XFA_VT_FLOAT:
- return FX_LOCALECATEGORY_Num;
- case XFA_VT_TEXT:
- return FX_LOCALECATEGORY_Text;
- case XFA_VT_DATE:
- return FX_LOCALECATEGORY_Date;
- case XFA_VT_TIME:
- return FX_LOCALECATEGORY_Time;
- case XFA_VT_DATETIME:
- return FX_LOCALECATEGORY_DateTime;
- }
- }
- return eCategory;
-}
-
-bool CXFA_LocaleValue::ValidateValue(const CFX_WideString& wsValue,
- const CFX_WideString& wsPattern,
- IFX_Locale* pLocale,
- CFX_WideString* pMatchFormat) {
- CFX_WideString wsOutput;
- IFX_Locale* locale = m_pLocaleMgr->GetDefLocale();
- if (pLocale)
- m_pLocaleMgr->SetDefLocale(pLocale);
-
- auto pFormat = pdfium::MakeUnique<CFX_FormatString>(m_pLocaleMgr, false);
- std::vector<CFX_WideString> wsPatterns;
- pFormat->SplitFormatString(wsPattern, wsPatterns);
-
- bool bRet = false;
- int32_t iCount = pdfium::CollectionSize<int32_t>(wsPatterns);
- int32_t i = 0;
- for (; i < iCount && !bRet; i++) {
- CFX_WideString wsFormat = wsPatterns[i];
- FX_LOCALECATEGORY eCategory = pFormat->GetCategory(wsFormat);
- eCategory = XFA_ValugeCategory(eCategory, m_dwType);
- switch (eCategory) {
- case FX_LOCALECATEGORY_Null:
- bRet = pFormat->ParseNull(wsValue, wsFormat);
- if (!bRet) {
- bRet = wsValue.IsEmpty();
- }
- break;
- case FX_LOCALECATEGORY_Zero:
- bRet = pFormat->ParseZero(wsValue, wsFormat);
- if (!bRet) {
- bRet = wsValue == L"0";
- }
- break;
- case FX_LOCALECATEGORY_Num: {
- CFX_WideString fNum;
- bRet = pFormat->ParseNum(wsValue, wsFormat, fNum);
- if (!bRet) {
- bRet = pFormat->FormatNum(wsValue, wsFormat, wsOutput);
- }
- break;
- }
- case FX_LOCALECATEGORY_Text:
- bRet = pFormat->ParseText(wsValue, wsFormat, wsOutput);
- wsOutput.clear();
- if (!bRet) {
- bRet = pFormat->FormatText(wsValue, wsFormat, wsOutput);
- }
- break;
- case FX_LOCALECATEGORY_Date: {
- CFX_Unitime dt;
- bRet = ValidateCanonicalDate(wsValue, dt);
- if (!bRet) {
- bRet = pFormat->ParseDateTime(wsValue, wsFormat, FX_DATETIMETYPE_Date,
- dt);
- if (!bRet) {
- bRet = pFormat->FormatDateTime(wsValue, wsFormat, wsOutput,
- FX_DATETIMETYPE_Date);
- }
- }
- break;
- }
- case FX_LOCALECATEGORY_Time: {
- CFX_Unitime dt;
- bRet =
- pFormat->ParseDateTime(wsValue, wsFormat, FX_DATETIMETYPE_Time, dt);
- if (!bRet) {
- bRet = pFormat->FormatDateTime(wsValue, wsFormat, wsOutput,
- FX_DATETIMETYPE_Time);
- }
- break;
- }
- case FX_LOCALECATEGORY_DateTime: {
- CFX_Unitime dt;
- bRet = pFormat->ParseDateTime(wsValue, wsFormat,
- FX_DATETIMETYPE_DateTime, dt);
- if (!bRet) {
- bRet = pFormat->FormatDateTime(wsValue, wsFormat, wsOutput,
- FX_DATETIMETYPE_DateTime);
- }
- break;
- }
- default:
- bRet = false;
- break;
- }
- }
- if (bRet && pMatchFormat)
- *pMatchFormat = wsPatterns[i - 1];
-
- if (pLocale)
- m_pLocaleMgr->SetDefLocale(locale);
-
- return bRet;
-}
-
-CFX_WideString CXFA_LocaleValue::GetValue() const {
- return m_wsValue;
-}
-uint32_t CXFA_LocaleValue::GetType() const {
- return m_dwType;
-}
-void CXFA_LocaleValue::SetValue(const CFX_WideString& wsValue,
- uint32_t dwType) {
- m_wsValue = wsValue;
- m_dwType = dwType;
-}
-CFX_WideString CXFA_LocaleValue::GetText() const {
- if (m_bValid && m_dwType == XFA_VT_TEXT) {
- return m_wsValue;
- }
- return CFX_WideString();
-}
-FX_FLOAT CXFA_LocaleValue::GetNum() const {
- if (m_bValid && (m_dwType == XFA_VT_BOOLEAN || m_dwType == XFA_VT_INTEGER ||
- m_dwType == XFA_VT_DECIMAL || m_dwType == XFA_VT_FLOAT)) {
- int64_t nIntegral = 0;
- uint32_t dwFractional = 0;
- int32_t nExponent = 0;
- int cc = 0;
- bool bNegative = false, bExpSign = false;
- const FX_WCHAR* str = m_wsValue.c_str();
- int len = m_wsValue.GetLength();
- while (FXSYS_iswspace(str[cc]) && cc < len) {
- cc++;
- }
- if (cc >= len) {
- return 0;
- }
- if (str[0] == '+') {
- cc++;
- } else if (str[0] == '-') {
- bNegative = true;
- cc++;
- }
- int nIntegralLen = 0;
- while (cc < len) {
- if (str[cc] == '.' || !FXSYS_isDecimalDigit(str[cc]) ||
- nIntegralLen > 17) {
- break;
- }
- nIntegral = nIntegral * 10 + str[cc] - '0';
- cc++;
- nIntegralLen++;
- }
- nIntegral = bNegative ? -nIntegral : nIntegral;
- int scale = 0;
- double fraction = 0.0;
- if (cc < len && str[cc] == '.') {
- cc++;
- while (cc < len) {
- fraction += fraction_scales[scale] * (str[cc] - '0');
- scale++;
- cc++;
- if (scale == sizeof fraction_scales / sizeof(double) ||
- !FXSYS_isDecimalDigit(str[cc])) {
- break;
- }
- }
- dwFractional = (uint32_t)(fraction * 4294967296.0);
- }
- if (cc < len && (str[cc] == 'E' || str[cc] == 'e')) {
- cc++;
- if (cc < len) {
- if (str[cc] == '+') {
- cc++;
- } else if (str[cc] == '-') {
- bExpSign = true;
- cc++;
- }
- }
- while (cc < len) {
- if (str[cc] == '.' || !FXSYS_isDecimalDigit(str[cc])) {
- break;
- }
- nExponent = nExponent * 10 + str[cc] - '0';
- cc++;
- }
- nExponent = bExpSign ? -nExponent : nExponent;
- }
- FX_FLOAT fValue = (FX_FLOAT)(dwFractional / 4294967296.0);
- fValue = nIntegral + (nIntegral >= 0 ? fValue : -fValue);
- if (nExponent != 0) {
- fValue *= FXSYS_pow(10, (FX_FLOAT)nExponent);
- }
- return fValue;
- }
- return 0;
-}
-FX_DOUBLE CXFA_LocaleValue::GetDoubleNum() const {
- if (m_bValid && (m_dwType == XFA_VT_BOOLEAN || m_dwType == XFA_VT_INTEGER ||
- m_dwType == XFA_VT_DECIMAL || m_dwType == XFA_VT_FLOAT)) {
- int64_t nIntegral = 0;
- uint32_t dwFractional = 0;
- int32_t nExponent = 0;
- int32_t cc = 0;
- bool bNegative = false, bExpSign = false;
- const FX_WCHAR* str = m_wsValue.c_str();
- int len = m_wsValue.GetLength();
- while (FXSYS_iswspace(str[cc]) && cc < len) {
- cc++;
- }
- if (cc >= len) {
- return 0;
- }
- if (str[0] == '+') {
- cc++;
- } else if (str[0] == '-') {
- bNegative = true;
- cc++;
- }
- int32_t nIntegralLen = 0;
- while (cc < len) {
- if (str[cc] == '.' || !FXSYS_isDecimalDigit(str[cc]) ||
- nIntegralLen > 17) {
- break;
- }
- nIntegral = nIntegral * 10 + str[cc] - '0';
- cc++;
- nIntegralLen++;
- }
- nIntegral = bNegative ? -nIntegral : nIntegral;
- int32_t scale = 0;
- FX_DOUBLE fraction = 0.0;
- if (cc < len && str[cc] == '.') {
- cc++;
- while (cc < len) {
- fraction += fraction_scales[scale] * (str[cc] - '0');
- scale++;
- cc++;
- if (scale == sizeof fraction_scales / sizeof(FX_DOUBLE) ||
- !FXSYS_isDecimalDigit(str[cc])) {
- break;
- }
- }
- dwFractional = (uint32_t)(fraction * 4294967296.0);
- }
- if (cc < len && (str[cc] == 'E' || str[cc] == 'e')) {
- cc++;
- if (cc < len) {
- if (str[cc] == '+') {
- cc++;
- } else if (str[cc] == '-') {
- bExpSign = true;
- cc++;
- }
- }
- while (cc < len) {
- if (str[cc] == '.' || !FXSYS_isDecimalDigit(str[cc])) {
- break;
- }
- nExponent = nExponent * 10 + str[cc] - '0';
- cc++;
- }
- nExponent = bExpSign ? -nExponent : nExponent;
- }
- FX_DOUBLE dValue = (dwFractional / 4294967296.0);
- dValue = nIntegral + (nIntegral >= 0 ? dValue : -dValue);
- if (nExponent != 0) {
- dValue *= FXSYS_pow(10, (FX_FLOAT)nExponent);
- }
- return dValue;
- }
- return 0;
-}
-CFX_Unitime CXFA_LocaleValue::GetDate() const {
- if (m_bValid && m_dwType == XFA_VT_DATE) {
- CFX_Unitime dt;
- FX_DateFromCanonical(m_wsValue, dt);
- return dt;
- }
- return CFX_Unitime();
-}
-CFX_Unitime CXFA_LocaleValue::GetTime() const {
- if (m_bValid && m_dwType == XFA_VT_TIME) {
- CFX_Unitime dt(0);
- ASSERT(m_pLocaleMgr);
- FX_TimeFromCanonical(m_wsValue.AsStringC(), dt,
- m_pLocaleMgr->GetDefLocale());
- return dt;
- }
- return CFX_Unitime();
-}
-CFX_Unitime CXFA_LocaleValue::GetDateTime() const {
- if (m_bValid && m_dwType == XFA_VT_DATETIME) {
- int32_t index = m_wsValue.Find('T');
- CFX_Unitime dt;
- FX_DateFromCanonical(m_wsValue.Left(index), dt);
- ASSERT(m_pLocaleMgr);
- FX_TimeFromCanonical(
- m_wsValue.Right(m_wsValue.GetLength() - index - 1).AsStringC(), dt,
- m_pLocaleMgr->GetDefLocale());
- return dt;
- }
- return CFX_Unitime();
-}
-bool CXFA_LocaleValue::SetText(const CFX_WideString& wsText) {
- m_dwType = XFA_VT_TEXT;
- m_wsValue = wsText;
- return true;
-}
-bool CXFA_LocaleValue::SetText(const CFX_WideString& wsText,
- const CFX_WideString& wsFormat,
- IFX_Locale* pLocale) {
- m_dwType = XFA_VT_TEXT;
- return m_bValid = ParsePatternValue(wsText, wsFormat, pLocale);
-}
-bool CXFA_LocaleValue::SetNum(FX_FLOAT fNum) {
- m_dwType = XFA_VT_FLOAT;
- m_wsValue.Format(L"%.8g", (FX_DOUBLE)fNum);
- return true;
-}
-bool CXFA_LocaleValue::SetNum(const CFX_WideString& wsNum,
- const CFX_WideString& wsFormat,
- IFX_Locale* pLocale) {
- m_dwType = XFA_VT_FLOAT;
- return m_bValid = ParsePatternValue(wsNum, wsFormat, pLocale);
-}
-bool CXFA_LocaleValue::SetDate(const CFX_Unitime& d) {
- m_dwType = XFA_VT_DATE;
- m_wsValue.Format(L"%04d-%02d-%02d", d.GetYear(), d.GetMonth(), d.GetDay());
- return true;
-}
-bool CXFA_LocaleValue::SetDate(const CFX_WideString& wsDate,
- const CFX_WideString& wsFormat,
- IFX_Locale* pLocale) {
- m_dwType = XFA_VT_DATE;
- return m_bValid = ParsePatternValue(wsDate, wsFormat, pLocale);
-}
-bool CXFA_LocaleValue::SetTime(const CFX_Unitime& t) {
- m_dwType = XFA_VT_TIME;
- m_wsValue.Format(L"%02d:%02d:%02d", t.GetHour(), t.GetMinute(),
- t.GetSecond());
- if (t.GetMillisecond() > 0) {
- CFX_WideString wsTemp;
- wsTemp.Format(L"%:03d", t.GetMillisecond());
- m_wsValue += wsTemp;
- }
- return true;
-}
-bool CXFA_LocaleValue::SetTime(const CFX_WideString& wsTime,
- const CFX_WideString& wsFormat,
- IFX_Locale* pLocale) {
- m_dwType = XFA_VT_TIME;
- return m_bValid = ParsePatternValue(wsTime, wsFormat, pLocale);
-}
-bool CXFA_LocaleValue::SetDateTime(const CFX_Unitime& dt) {
- m_dwType = XFA_VT_DATETIME;
- m_wsValue.Format(L"%04d-%02d-%02dT%02d:%02d:%02d", dt.GetYear(),
- dt.GetMonth(), dt.GetDay(), dt.GetHour(), dt.GetMinute(),
- dt.GetSecond());
- if (dt.GetMillisecond() > 0) {
- CFX_WideString wsTemp;
- wsTemp.Format(L"%:03d", dt.GetMillisecond());
- m_wsValue += wsTemp;
- }
- return true;
-}
-bool CXFA_LocaleValue::SetDateTime(const CFX_WideString& wsDateTime,
- const CFX_WideString& wsFormat,
- IFX_Locale* pLocale) {
- m_dwType = XFA_VT_DATETIME;
- return m_bValid = ParsePatternValue(wsDateTime, wsFormat, pLocale);
-}
-
-bool CXFA_LocaleValue::FormatPatterns(CFX_WideString& wsResult,
- const CFX_WideString& wsFormat,
- IFX_Locale* pLocale,
- XFA_VALUEPICTURE eValueType) const {
- auto pFormat = pdfium::MakeUnique<CFX_FormatString>(m_pLocaleMgr, false);
- std::vector<CFX_WideString> wsPatterns;
- pFormat->SplitFormatString(wsFormat, wsPatterns);
- wsResult.clear();
- int32_t iCount = pdfium::CollectionSize<int32_t>(wsPatterns);
- for (int32_t i = 0; i < iCount; i++) {
- if (FormatSinglePattern(wsResult, wsPatterns[i], pLocale, eValueType))
- return true;
- }
- return false;
-}
-
-bool CXFA_LocaleValue::FormatSinglePattern(CFX_WideString& wsResult,
- const CFX_WideString& wsFormat,
- IFX_Locale* pLocale,
- XFA_VALUEPICTURE eValueType) const {
- IFX_Locale* locale = m_pLocaleMgr->GetDefLocale();
- if (pLocale)
- m_pLocaleMgr->SetDefLocale(pLocale);
-
- wsResult.clear();
- bool bRet = false;
- auto pFormat = pdfium::MakeUnique<CFX_FormatString>(m_pLocaleMgr, false);
- FX_LOCALECATEGORY eCategory = pFormat->GetCategory(wsFormat);
- eCategory = XFA_ValugeCategory(eCategory, m_dwType);
- switch (eCategory) {
- case FX_LOCALECATEGORY_Null:
- if (m_wsValue.IsEmpty()) {
- bRet = pFormat->FormatNull(wsFormat, wsResult);
- }
- break;
- case FX_LOCALECATEGORY_Zero:
- if (m_wsValue == L"0") {
- bRet = pFormat->FormatZero(wsFormat, wsResult);
- }
- break;
- case FX_LOCALECATEGORY_Num:
- bRet = pFormat->FormatNum(m_wsValue, wsFormat, wsResult);
- break;
- case FX_LOCALECATEGORY_Text:
- bRet = pFormat->FormatText(m_wsValue, wsFormat, wsResult);
- break;
- case FX_LOCALECATEGORY_Date:
- bRet = pFormat->FormatDateTime(m_wsValue, wsFormat, wsResult,
- FX_DATETIMETYPE_Date);
- break;
- case FX_LOCALECATEGORY_Time:
- bRet = pFormat->FormatDateTime(m_wsValue, wsFormat, wsResult,
- FX_DATETIMETYPE_Time);
- break;
- case FX_LOCALECATEGORY_DateTime:
- bRet = pFormat->FormatDateTime(m_wsValue, wsFormat, wsResult,
- FX_DATETIMETYPE_DateTime);
- break;
- default:
- wsResult = m_wsValue;
- bRet = true;
- }
- if (!bRet && (eCategory != FX_LOCALECATEGORY_Num ||
- eValueType != XFA_VALUEPICTURE_Display)) {
- wsResult = m_wsValue;
- }
- if (pLocale)
- m_pLocaleMgr->SetDefLocale(locale);
-
- return bRet;
-}
-
-static bool XFA_ValueSplitDateTime(const CFX_WideString& wsDateTime,
- CFX_WideString& wsDate,
- CFX_WideString& wsTime) {
- wsDate = L"";
- wsTime = L"";
- if (wsDateTime.IsEmpty()) {
- return false;
- }
- int nSplitIndex = -1;
- nSplitIndex = wsDateTime.Find('T');
- if (nSplitIndex < 0) {
- nSplitIndex = wsDateTime.Find(' ');
- }
- if (nSplitIndex < 0) {
- return false;
- }
- wsDate = wsDateTime.Left(nSplitIndex);
- wsTime = wsDateTime.Right(wsDateTime.GetLength() - nSplitIndex - 1);
- return true;
-}
-bool CXFA_LocaleValue::ValidateCanonicalValue(const CFX_WideString& wsValue,
- uint32_t dwVType) {
- if (wsValue.IsEmpty()) {
- return true;
- }
- CFX_Unitime dt;
- switch (dwVType) {
- case XFA_VT_DATE: {
- if (ValidateCanonicalDate(wsValue, dt)) {
- return true;
- }
- CFX_WideString wsDate, wsTime;
- if (XFA_ValueSplitDateTime(wsValue, wsDate, wsTime) &&
- ValidateCanonicalDate(wsDate, dt)) {
- return true;
- }
- return false;
- }
- case XFA_VT_TIME: {
- if (ValidateCanonicalTime(wsValue)) {
- return true;
- }
- CFX_WideString wsDate, wsTime;
- if (XFA_ValueSplitDateTime(wsValue, wsDate, wsTime) &&
- ValidateCanonicalTime(wsTime)) {
- return true;
- }
- return false;
- }
- case XFA_VT_DATETIME: {
- CFX_WideString wsDate, wsTime;
- if (XFA_ValueSplitDateTime(wsValue, wsDate, wsTime) &&
- ValidateCanonicalDate(wsDate, dt) && ValidateCanonicalTime(wsTime)) {
- return true;
- }
- } break;
- }
- return true;
-}
-bool CXFA_LocaleValue::ValidateCanonicalDate(const CFX_WideString& wsDate,
- CFX_Unitime& unDate) {
- const uint16_t LastDay[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
- const uint16_t wCountY = 4, wCountM = 2, wCountD = 2;
- int nLen = wsDate.GetLength();
- if (nLen < wCountY || nLen > wCountY + wCountM + wCountD + 2) {
- return false;
- }
- const bool bSymbol = wsDate.Find(0x2D) != -1;
- uint16_t wYear = 0;
- uint16_t wMonth = 0;
- uint16_t wDay = 0;
- const FX_WCHAR* pDate = wsDate.c_str();
- int nIndex = 0, nStart = 0;
- while (pDate[nIndex] != '\0' && nIndex < wCountY) {
- if (!FXSYS_isDecimalDigit(pDate[nIndex])) {
- return false;
- }
- wYear = (pDate[nIndex] - '0') + wYear * 10;
- nIndex++;
- }
- if (bSymbol) {
- if (pDate[nIndex] != 0x2D) {
- return false;
- }
- nIndex++;
- }
- nStart = nIndex;
- while (pDate[nIndex] != '\0' && nIndex - nStart < wCountM && nIndex < nLen) {
- if (!FXSYS_isDecimalDigit(pDate[nIndex])) {
- return false;
- }
- wMonth = (pDate[nIndex] - '0') + wMonth * 10;
- nIndex++;
- }
- if (bSymbol) {
- if (pDate[nIndex] != 0x2D) {
- return false;
- }
- nIndex++;
- }
- nStart = nIndex;
- while (pDate[nIndex] != '\0' && nIndex - nStart < wCountD && nIndex < nLen) {
- if (!FXSYS_isDecimalDigit(pDate[nIndex])) {
- return false;
- }
- wDay = (pDate[nIndex] - '0') + wDay * 10;
- nIndex++;
- }
- if (nIndex != nLen) {
- return false;
- }
- if (wYear < 1900 || wYear > 2029) {
- return false;
- }
- if (wMonth < 1 || wMonth > 12) {
- if (wMonth == 0 && nLen == wCountY) {
- return true;
- }
- return false;
- }
- if (wDay < 1) {
- if (wDay == 0 && (nLen == wCountY + wCountM)) {
- return true;
- }
- return false;
- }
- if (wMonth == 2) {
- if (wYear % 400 == 0 || (wYear % 100 != 0 && wYear % 4 == 0)) {
- if (wDay > 29) {
- return false;
- }
- } else {
- if (wDay > 28) {
- return false;
- }
- }
- } else if (wDay > LastDay[wMonth - 1]) {
- return false;
- }
- CFX_Unitime ut;
- ut.Set(wYear, static_cast<uint8_t>(wMonth), static_cast<uint8_t>(wDay));
- unDate = unDate + ut;
- return true;
-}
-bool CXFA_LocaleValue::ValidateCanonicalTime(const CFX_WideString& wsTime) {
- int nLen = wsTime.GetLength();
- if (nLen < 2)
- return false;
- const uint16_t wCountH = 2;
- const uint16_t wCountM = 2;
- const uint16_t wCountS = 2;
- const uint16_t wCountF = 3;
- const bool bSymbol = wsTime.Find(':') != -1;
- uint16_t wHour = 0;
- uint16_t wMinute = 0;
- uint16_t wSecond = 0;
- uint16_t wFraction = 0;
- const FX_WCHAR* pTime = wsTime.c_str();
- int nIndex = 0;
- int nStart = 0;
- while (nIndex - nStart < wCountH && pTime[nIndex]) {
- if (!FXSYS_isDecimalDigit(pTime[nIndex]))
- return false;
- wHour = pTime[nIndex] - '0' + wHour * 10;
- nIndex++;
- }
- if (bSymbol) {
- if (nIndex < nLen && pTime[nIndex] != ':')
- return false;
- nIndex++;
- }
- nStart = nIndex;
- while (nIndex - nStart < wCountM && nIndex < nLen && pTime[nIndex]) {
- if (!FXSYS_isDecimalDigit(pTime[nIndex]))
- return false;
- wMinute = pTime[nIndex] - '0' + wMinute * 10;
- nIndex++;
- }
- if (bSymbol) {
- if (nIndex < nLen && pTime[nIndex] != ':')
- return false;
- nIndex++;
- }
- nStart = nIndex;
- while (nIndex - nStart < wCountS && nIndex < nLen && pTime[nIndex]) {
- if (!FXSYS_isDecimalDigit(pTime[nIndex]))
- return false;
- wSecond = pTime[nIndex] - '0' + wSecond * 10;
- nIndex++;
- }
- if (wsTime.Find('.') > 0) {
- if (pTime[nIndex] != '.')
- return false;
- nIndex++;
- nStart = nIndex;
- while (nIndex - nStart < wCountF && nIndex < nLen && pTime[nIndex]) {
- if (!FXSYS_isDecimalDigit(pTime[nIndex]))
- return false;
- wFraction = pTime[nIndex] - '0' + wFraction * 10;
- nIndex++;
- }
- }
- if (nIndex < nLen) {
- if (pTime[nIndex] == 'Z') {
- nIndex++;
- } else if (pTime[nIndex] == '-' || pTime[nIndex] == '+') {
- int16_t nOffsetH = 0;
- int16_t nOffsetM = 0;
- nIndex++;
- nStart = nIndex;
- while (nIndex - nStart < wCountH && nIndex < nLen && pTime[nIndex]) {
- if (!FXSYS_isDecimalDigit(pTime[nIndex]))
- return false;
- nOffsetH = pTime[nIndex] - '0' + nOffsetH * 10;
- nIndex++;
- }
- if (bSymbol) {
- if (nIndex < nLen && pTime[nIndex] != ':')
- return false;
- nIndex++;
- }
- nStart = nIndex;
- while (nIndex - nStart < wCountM && nIndex < nLen && pTime[nIndex]) {
- if (!FXSYS_isDecimalDigit(pTime[nIndex]))
- return false;
- nOffsetM = pTime[nIndex] - '0' + nOffsetM * 10;
- nIndex++;
- }
- if (nOffsetH > 12 || nOffsetM >= 60)
- return false;
- }
- }
- return nIndex == nLen && wHour < 24 && wMinute < 60 && wSecond < 60 &&
- wFraction <= 999;
-}
-bool CXFA_LocaleValue::ValidateCanonicalDateTime(
- const CFX_WideString& wsDateTime) {
- CFX_WideString wsDate, wsTime;
- if (wsDateTime.IsEmpty()) {
- return false;
- }
- int nSplitIndex = -1;
- nSplitIndex = wsDateTime.Find('T');
- if (nSplitIndex < 0) {
- nSplitIndex = wsDateTime.Find(' ');
- }
- if (nSplitIndex < 0) {
- return false;
- }
- wsDate = wsDateTime.Left(nSplitIndex);
- wsTime = wsDateTime.Right(wsDateTime.GetLength() - nSplitIndex - 1);
- CFX_Unitime dt;
- return ValidateCanonicalDate(wsDate, dt) && ValidateCanonicalTime(wsTime);
-}
-bool CXFA_LocaleValue::ParsePatternValue(const CFX_WideString& wsValue,
- const CFX_WideString& wsPattern,
- IFX_Locale* pLocale) {
- IFX_Locale* locale = m_pLocaleMgr->GetDefLocale();
- if (pLocale)
- m_pLocaleMgr->SetDefLocale(pLocale);
-
- auto pFormat = pdfium::MakeUnique<CFX_FormatString>(m_pLocaleMgr, false);
- std::vector<CFX_WideString> wsPatterns;
- pFormat->SplitFormatString(wsPattern, wsPatterns);
- bool bRet = false;
- int32_t iCount = pdfium::CollectionSize<int32_t>(wsPatterns);
- for (int32_t i = 0; i < iCount && !bRet; i++) {
- CFX_WideString wsFormat = wsPatterns[i];
- FX_LOCALECATEGORY eCategory = pFormat->GetCategory(wsFormat);
- eCategory = XFA_ValugeCategory(eCategory, m_dwType);
- switch (eCategory) {
- case FX_LOCALECATEGORY_Null:
- bRet = pFormat->ParseNull(wsValue, wsFormat);
- if (bRet) {
- m_wsValue.clear();
- }
- break;
- case FX_LOCALECATEGORY_Zero:
- bRet = pFormat->ParseZero(wsValue, wsFormat);
- if (bRet)
- m_wsValue = L"0";
- break;
- case FX_LOCALECATEGORY_Num: {
- CFX_WideString fNum;
- bRet = pFormat->ParseNum(wsValue, wsFormat, fNum);
- if (bRet) {
- m_wsValue = fNum;
- }
- break;
- }
- case FX_LOCALECATEGORY_Text:
- bRet = pFormat->ParseText(wsValue, wsFormat, m_wsValue);
- break;
- case FX_LOCALECATEGORY_Date: {
- CFX_Unitime dt;
- bRet = ValidateCanonicalDate(wsValue, dt);
- if (!bRet) {
- bRet = pFormat->ParseDateTime(wsValue, wsFormat, FX_DATETIMETYPE_Date,
- dt);
- }
- if (bRet) {
- SetDate(dt);
- }
- break;
- }
- case FX_LOCALECATEGORY_Time: {
- CFX_Unitime dt;
- bRet =
- pFormat->ParseDateTime(wsValue, wsFormat, FX_DATETIMETYPE_Time, dt);
- if (bRet) {
- SetTime(dt);
- }
- break;
- }
- case FX_LOCALECATEGORY_DateTime: {
- CFX_Unitime dt;
- bRet = pFormat->ParseDateTime(wsValue, wsFormat,
- FX_DATETIMETYPE_DateTime, dt);
- if (bRet) {
- SetDateTime(dt);
- }
- break;
- }
- default:
- m_wsValue = wsValue;
- bRet = true;
- break;
- }
- }
- if (!bRet)
- m_wsValue = wsValue;
-
- if (pLocale)
- m_pLocaleMgr->SetDefLocale(locale);
-
- return bRet;
-}
-
-void CXFA_LocaleValue::GetNumbericFormat(CFX_WideString& wsFormat,
- int32_t nIntLen,
- int32_t nDecLen,
- bool bSign) {
- ASSERT(wsFormat.IsEmpty());
- ASSERT(nIntLen >= -1 && nDecLen >= -1);
- int32_t nTotalLen = (nIntLen >= 0 ? nIntLen : 2) + (bSign ? 1 : 0) +
- (nDecLen >= 0 ? nDecLen : 2) + (nDecLen == 0 ? 0 : 1);
- FX_WCHAR* lpBuf = wsFormat.GetBuffer(nTotalLen);
- int32_t nPos = 0;
- if (bSign) {
- lpBuf[nPos++] = L's';
- }
- if (nIntLen == -1) {
- lpBuf[nPos++] = L'z';
- lpBuf[nPos++] = L'*';
- } else {
- while (nIntLen) {
- lpBuf[nPos++] = L'z';
- nIntLen--;
- }
- }
- if (nDecLen != 0) {
- lpBuf[nPos++] = L'.';
- }
- if (nDecLen == -1) {
- lpBuf[nPos++] = L'z';
- lpBuf[nPos++] = L'*';
- } else {
- while (nDecLen) {
- lpBuf[nPos++] = L'z';
- nDecLen--;
- }
- }
- wsFormat.ReleaseBuffer(nTotalLen);
-}
-bool CXFA_LocaleValue::ValidateNumericTemp(CFX_WideString& wsNumeric,
- CFX_WideString& wsFormat,
- IFX_Locale* pLocale,
- int32_t* pos) {
- if (wsFormat.IsEmpty() || wsNumeric.IsEmpty()) {
- return true;
- }
- const FX_WCHAR* pNum = wsNumeric.c_str();
- const FX_WCHAR* pFmt = wsFormat.c_str();
- int32_t n = 0, nf = 0;
- FX_WCHAR c = pNum[n];
- FX_WCHAR cf = pFmt[nf];
- if (cf == L's') {
- if (c == L'-' || c == L'+') {
- ++n;
- }
- ++nf;
- }
- bool bLimit = true;
- int32_t nCount = wsNumeric.GetLength();
- int32_t nCountFmt = wsFormat.GetLength();
- while (n < nCount && (bLimit ? nf < nCountFmt : true) &&
- FXSYS_isDecimalDigit(c = pNum[n])) {
- if (bLimit == true) {
- if ((cf = pFmt[nf]) == L'*') {
- bLimit = false;
- } else if (cf == L'z') {
- nf++;
- } else {
- return false;
- }
- }
- n++;
- }
- if (n == nCount) {
- return true;
- }
- if (nf == nCountFmt) {
- return false;
- }
- while (nf < nCountFmt && (cf = pFmt[nf]) != L'.') {
- ASSERT(cf == L'z' || cf == L'*');
- ++nf;
- }
- CFX_WideString wsDecimalSymbol;
- if (pLocale) {
- pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Decimal, wsDecimalSymbol);
- } else {
- wsDecimalSymbol = CFX_WideString(L'.');
- }
- if (pFmt[nf] != L'.') {
- return false;
- }
- if (wsDecimalSymbol != CFX_WideStringC(c) && c != L'.') {
- return false;
- }
- ++nf;
- ++n;
- bLimit = true;
- while (n < nCount && (bLimit ? nf < nCountFmt : true) &&
- FXSYS_isDecimalDigit(c = pNum[n])) {
- if (bLimit == true) {
- if ((cf = pFmt[nf]) == L'*') {
- bLimit = false;
- } else if (cf == L'z') {
- nf++;
- } else {
- return false;
- }
- }
- n++;
- }
- return n == nCount;
-}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/xfa_localevalue.h b/chromium/third_party/pdfium/xfa/fxfa/parser/xfa_localevalue.h
deleted file mode 100644
index dbc3513a3f3..00000000000
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/xfa_localevalue.h
+++ /dev/null
@@ -1,112 +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 XFA_FXFA_PARSER_XFA_LOCALEVALUE_H_
-#define XFA_FXFA_PARSER_XFA_LOCALEVALUE_H_
-
-#include "core/fxcrt/fx_string.h"
-#include "core/fxcrt/fx_system.h"
-#include "xfa/fxfa/parser/cxfa_widgetdata.h"
-
-class IFX_Locale;
-class CFX_Unitime;
-class CXFA_LocaleMgr;
-
-#define XFA_VT_NULL 0
-#define XFA_VT_BOOLEAN 1
-#define XFA_VT_INTEGER 2
-#define XFA_VT_DECIMAL 4
-#define XFA_VT_FLOAT 8
-#define XFA_VT_TEXT 16
-#define XFA_VT_DATE 32
-#define XFA_VT_TIME 64
-#define XFA_VT_DATETIME 128
-
-class CXFA_LocaleValue {
- public:
- CXFA_LocaleValue();
- CXFA_LocaleValue(const CXFA_LocaleValue& value);
- CXFA_LocaleValue(uint32_t dwType, CXFA_LocaleMgr* pLocaleMgr);
- CXFA_LocaleValue(uint32_t dwType,
- const CFX_WideString& wsValue,
- CXFA_LocaleMgr* pLocaleMgr);
- CXFA_LocaleValue(uint32_t dwType,
- const CFX_WideString& wsValue,
- const CFX_WideString& wsFormat,
- IFX_Locale* pLocale,
- CXFA_LocaleMgr* pLocaleMgr);
- ~CXFA_LocaleValue();
- CXFA_LocaleValue& operator=(const CXFA_LocaleValue& value);
-
- bool ValidateValue(const CFX_WideString& wsValue,
- const CFX_WideString& wsPattern,
- IFX_Locale* pLocale,
- CFX_WideString* pMatchFormat = nullptr);
- bool FormatPatterns(CFX_WideString& wsResult,
- const CFX_WideString& wsFormat,
- IFX_Locale* pLocale,
- XFA_VALUEPICTURE eValueType) const;
- bool FormatSinglePattern(CFX_WideString& wsResult,
- const CFX_WideString& wsFormat,
- IFX_Locale* pLocale,
- XFA_VALUEPICTURE eValueType) const;
- bool ValidateCanonicalValue(const CFX_WideString& wsValue, uint32_t dwVType);
- bool ValidateCanonicalDate(const CFX_WideString& wsDate, CFX_Unitime& unDate);
- bool ValidateCanonicalTime(const CFX_WideString& wsTime);
- bool ValidateCanonicalDateTime(const CFX_WideString& wsDateTime);
- void GetNumbericFormat(CFX_WideString& wsFormat,
- int32_t nIntLen,
- int32_t nDecLen,
- bool bSign = true);
- bool ValidateNumericTemp(CFX_WideString& wsNumeric,
- CFX_WideString& wsFormat,
- IFX_Locale* pLocale = nullptr,
- int32_t* pos = nullptr);
-
- CFX_WideString GetValue() const;
- uint32_t GetType() const;
- void SetValue(const CFX_WideString& wsValue, uint32_t dwType);
- CFX_WideString GetText() const;
- FX_FLOAT GetNum() const;
- FX_DOUBLE GetDoubleNum() const;
- CFX_Unitime GetDate() const;
- CFX_Unitime GetTime() const;
- CFX_Unitime GetDateTime() const;
- bool SetText(const CFX_WideString& wsText);
- bool SetText(const CFX_WideString& wsText,
- const CFX_WideString& wsFormat,
- IFX_Locale* pLocale);
- bool SetNum(FX_FLOAT fNum);
- bool SetNum(const CFX_WideString& wsNum,
- const CFX_WideString& wsFormat,
- IFX_Locale* pLocale);
- bool SetDate(const CFX_Unitime& d);
- bool SetDate(const CFX_WideString& wsDate,
- const CFX_WideString& wsFormat,
- IFX_Locale* pLocale);
- bool SetTime(const CFX_Unitime& t);
- bool SetTime(const CFX_WideString& wsTime,
- const CFX_WideString& wsFormat,
- IFX_Locale* pLocale);
- bool SetDateTime(const CFX_Unitime& dt);
- bool SetDateTime(const CFX_WideString& wsDateTime,
- const CFX_WideString& wsFormat,
- IFX_Locale* pLocale);
- bool IsNull() const { return m_dwType == XFA_VT_NULL; }
- bool IsEmpty() const { return m_wsValue.IsEmpty(); }
- bool IsValid() const { return m_bValid; }
-
- protected:
- bool ParsePatternValue(const CFX_WideString& wsValue,
- const CFX_WideString& wsPattern,
- IFX_Locale* pLocale);
- CXFA_LocaleMgr* m_pLocaleMgr;
- CFX_WideString m_wsValue;
- uint32_t m_dwType;
- bool m_bValid;
-};
-
-#endif // XFA_FXFA_PARSER_XFA_LOCALEVALUE_H_
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/xfa_object.h b/chromium/third_party/pdfium/xfa/fxfa/parser/xfa_object.h
deleted file mode 100644
index cc116505e0a..00000000000
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/xfa_object.h
+++ /dev/null
@@ -1,823 +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 XFA_FXFA_PARSER_XFA_OBJECT_H_
-#define XFA_FXFA_PARSER_XFA_OBJECT_H_
-
-#include <map>
-#include <unordered_set>
-
-#include "fxjs/cfxjse_arguments.h"
-#include "xfa/fde/xml/fde_xml.h"
-#include "xfa/fxfa/parser/xfa_utils.h"
-
-class CXFA_Document;
-class CXFA_Node;
-class CXFA_NodeList;
-
-enum class XFA_ObjectType {
- Object,
- List,
- NodeList,
- Node,
- NodeC,
- NodeV,
- ModelNode,
- TextNode,
- ContainerNode,
- ContentNode,
- VariablesThis
-};
-
-enum XFA_NodeFlag {
- XFA_NodeFlag_None = 0,
- XFA_NodeFlag_Initialized = 1 << 0,
- XFA_NodeFlag_HasRemovedChildren = 1 << 1,
- XFA_NodeFlag_NeedsInitApp = 1 << 2,
- XFA_NodeFlag_BindFormItems = 1 << 3,
- XFA_NodeFlag_UserInteractive = 1 << 4,
- XFA_NodeFlag_SkipDataBinding = 1 << 5,
- XFA_NodeFlag_OwnXMLNode = 1 << 6,
- XFA_NodeFlag_UnusedNode = 1 << 7,
- XFA_NodeFlag_LayoutGeneratedNode = 1 << 8
-};
-
-class CXFA_Object : public CFXJSE_HostObject {
- public:
- CXFA_Object(CXFA_Document* pDocument,
- XFA_ObjectType objectType,
- XFA_Element eType,
- const CFX_WideStringC& elementName);
- ~CXFA_Object() override;
-
- CXFA_Document* GetDocument() const { return m_pDocument; }
- XFA_ObjectType GetObjectType() const { return m_objectType; }
-
- bool IsNode() const {
- return m_objectType == XFA_ObjectType::Node ||
- m_objectType == XFA_ObjectType::NodeC ||
- m_objectType == XFA_ObjectType::NodeV ||
- m_objectType == XFA_ObjectType::ModelNode ||
- m_objectType == XFA_ObjectType::TextNode ||
- m_objectType == XFA_ObjectType::ContainerNode ||
- m_objectType == XFA_ObjectType::ContentNode ||
- m_objectType == XFA_ObjectType::VariablesThis;
- }
- bool IsNodeList() const { return m_objectType == XFA_ObjectType::NodeList; }
- bool IsContentNode() const {
- return m_objectType == XFA_ObjectType::ContentNode;
- }
- bool IsContainerNode() const {
- return m_objectType == XFA_ObjectType::ContainerNode;
- }
- bool IsModelNode() const { return m_objectType == XFA_ObjectType::ModelNode; }
- bool IsNodeV() const { return m_objectType == XFA_ObjectType::NodeV; }
- bool IsVariablesThis() const {
- return m_objectType == XFA_ObjectType::VariablesThis;
- }
-
- CXFA_Node* AsNode();
- CXFA_NodeList* AsNodeList();
-
- const CXFA_Node* AsNode() const;
- const CXFA_NodeList* AsNodeList() const;
-
- XFA_Element GetElementType() const;
- CFX_WideStringC GetClassName() const;
- uint32_t GetClassHashCode() const;
- void Script_ObjectClass_ClassName(CFXJSE_Value* pValue,
- bool bSetting,
- XFA_ATTRIBUTE eAttribute);
-
- void ThrowInvalidPropertyException() const;
- void ThrowArgumentMismatchException() const;
- void ThrowIndexOutOfBoundsException() const;
- void ThrowParamCountMismatchException(const CFX_WideString& method) const;
-
- protected:
- void ThrowException(const FX_WCHAR* str, ...) const;
-
- CXFA_Document* const m_pDocument;
- const XFA_ObjectType m_objectType;
- const XFA_Element m_elementType;
-
- const uint32_t m_elementNameHash;
- const CFX_WideStringC m_elementName;
-};
-using CXFA_ObjArray = CFX_ArrayTemplate<CXFA_Object*>;
-
-#define XFA_NODEFILTER_Children 0x01
-#define XFA_NODEFILTER_Properties 0x02
-#define XFA_NODEFILTER_OneOfProperty 0x04
-#define XFA_CLONEFLAG_Content 0x01
-enum XFA_NODEITEM {
- XFA_NODEITEM_Parent,
- XFA_NODEITEM_FirstChild,
- XFA_NODEITEM_NextSibling,
- XFA_NODEITEM_PrevSibling,
-};
-enum XFA_SOM_MESSAGETYPE {
- XFA_SOM_ValidationMessage,
- XFA_SOM_FormatMessage,
- XFA_SOM_MandatoryMessage
-};
-
-using CXFA_NodeArray = CFX_ArrayTemplate<CXFA_Node*>;
-using CXFA_NodeStack = CFX_StackTemplate<CXFA_Node*>;
-using CXFA_NodeSet = std::unordered_set<CXFA_Node*>;
-
-typedef void (*PD_CALLBACK_FREEDATA)(void* pData);
-typedef void (*PD_CALLBACK_DUPLICATEDATA)(void*& pData);
-
-struct XFA_MAPDATABLOCKCALLBACKINFO {
- PD_CALLBACK_FREEDATA pFree;
- PD_CALLBACK_DUPLICATEDATA pCopy;
-};
-
-struct XFA_MAPDATABLOCK {
- uint8_t* GetData() const { return (uint8_t*)this + sizeof(XFA_MAPDATABLOCK); }
- XFA_MAPDATABLOCKCALLBACKINFO* pCallbackInfo;
- int32_t iBytes;
-};
-
-struct XFA_MAPMODULEDATA {
- XFA_MAPMODULEDATA();
- ~XFA_MAPMODULEDATA();
-
- std::map<void*, void*> m_ValueMap;
- std::map<void*, XFA_MAPDATABLOCK*> m_BufferMap;
-};
-
-#define XFA_CalcRefCount (void*)(uintptr_t) FXBSTR_ID('X', 'F', 'A', 'R')
-#define XFA_CalcData (void*)(uintptr_t) FXBSTR_ID('X', 'F', 'A', 'C')
-#define XFA_LAYOUTITEMKEY (void*)(uintptr_t) FXBSTR_ID('L', 'Y', 'I', 'M')
-
-class CXFA_Node : public CXFA_Object {
- public:
- uint32_t GetPacketID() const { return m_ePacket; }
-
- void SetFlag(uint32_t dwFlag, bool bNotify);
- void ClearFlag(uint32_t dwFlag);
-
- bool IsInitialized() const { return HasFlag(XFA_NodeFlag_Initialized); }
- bool IsOwnXMLNode() const { return HasFlag(XFA_NodeFlag_OwnXMLNode); }
- bool IsUserInteractive() const {
- return HasFlag(XFA_NodeFlag_UserInteractive);
- }
- bool IsUnusedNode() const { return HasFlag(XFA_NodeFlag_UnusedNode); }
- bool IsLayoutGeneratedNode() const {
- return HasFlag(XFA_NodeFlag_LayoutGeneratedNode);
- }
- bool BindsFormItems() const { return HasFlag(XFA_NodeFlag_BindFormItems); }
- bool HasRemovedChildren() const {
- return HasFlag(XFA_NodeFlag_HasRemovedChildren);
- }
- bool NeedsInitApp() const { return HasFlag(XFA_NodeFlag_NeedsInitApp); }
-
- bool IsAttributeInXML();
- bool IsFormContainer() const {
- return m_ePacket == XFA_XDPPACKET_Form && IsContainerNode();
- }
- void SetXMLMappingNode(CFDE_XMLNode* pXMLNode) { m_pXMLNode = pXMLNode; }
- CFDE_XMLNode* GetXMLMappingNode() const { return m_pXMLNode; }
- CFDE_XMLNode* CreateXMLMappingNode();
- bool IsNeedSavingXMLNode();
- uint32_t GetNameHash() const { return m_dwNameHash; }
- bool IsUnnamed() const { return m_dwNameHash == 0; }
- CXFA_Node* GetModelNode();
- void UpdateNameHash();
- bool HasAttribute(XFA_ATTRIBUTE eAttr, bool bCanInherit = false);
- bool SetAttribute(XFA_ATTRIBUTE eAttr,
- const CFX_WideStringC& wsValue,
- bool bNotify = false);
- bool GetAttribute(XFA_ATTRIBUTE eAttr,
- CFX_WideString& wsValue,
- bool bUseDefault = true);
- bool SetAttribute(const CFX_WideStringC& wsAttr,
- const CFX_WideStringC& wsValue,
- bool bNotify = false);
- bool GetAttribute(const CFX_WideStringC& wsAttr,
- CFX_WideString& wsValue,
- bool bUseDefault = true);
- bool RemoveAttribute(const CFX_WideStringC& wsAttr);
- bool SetContent(const CFX_WideString& wsContent,
- const CFX_WideString& wsXMLValue,
- bool bNotify = false,
- bool bScriptModify = false,
- bool bSyncData = true);
- bool TryContent(CFX_WideString& wsContent,
- bool bScriptModify = false,
- bool bProto = true);
- CFX_WideString GetContent();
-
- bool TryNamespace(CFX_WideString& wsNamespace);
-
- bool SetBoolean(XFA_ATTRIBUTE eAttr, bool bValue, bool bNotify = false) {
- return SetValue(eAttr, XFA_ATTRIBUTETYPE_Boolean, (void*)(uintptr_t)bValue,
- bNotify);
- }
- bool TryBoolean(XFA_ATTRIBUTE eAttr, bool& bValue, bool bUseDefault = true);
- bool GetBoolean(XFA_ATTRIBUTE eAttr) {
- bool bValue;
- return TryBoolean(eAttr, bValue, true) ? bValue : false;
- }
- bool SetInteger(XFA_ATTRIBUTE eAttr, int32_t iValue, bool bNotify = false) {
- return SetValue(eAttr, XFA_ATTRIBUTETYPE_Integer, (void*)(uintptr_t)iValue,
- bNotify);
- }
- bool TryInteger(XFA_ATTRIBUTE eAttr,
- int32_t& iValue,
- bool bUseDefault = true);
- int32_t GetInteger(XFA_ATTRIBUTE eAttr) {
- int32_t iValue;
- return TryInteger(eAttr, iValue, true) ? iValue : 0;
- }
- bool SetEnum(XFA_ATTRIBUTE eAttr,
- XFA_ATTRIBUTEENUM eValue,
- bool bNotify = false) {
- return SetValue(eAttr, XFA_ATTRIBUTETYPE_Enum, (void*)(uintptr_t)eValue,
- bNotify);
- }
- bool TryEnum(XFA_ATTRIBUTE eAttr,
- XFA_ATTRIBUTEENUM& eValue,
- bool bUseDefault = true);
- XFA_ATTRIBUTEENUM GetEnum(XFA_ATTRIBUTE eAttr) {
- XFA_ATTRIBUTEENUM eValue;
- return TryEnum(eAttr, eValue, true) ? eValue : XFA_ATTRIBUTEENUM_Unknown;
- }
- bool SetCData(XFA_ATTRIBUTE eAttr,
- const CFX_WideString& wsValue,
- bool bNotify = false,
- bool bScriptModify = false);
- bool SetAttributeValue(const CFX_WideString& wsValue,
- const CFX_WideString& wsXMLValue,
- bool bNotify = false,
- bool bScriptModify = false);
- bool TryCData(XFA_ATTRIBUTE eAttr,
- CFX_WideString& wsValue,
- bool bUseDefault = true,
- bool bProto = true);
- bool TryCData(XFA_ATTRIBUTE eAttr,
- CFX_WideStringC& wsValue,
- bool bUseDefault = true,
- bool bProto = true);
- CFX_WideStringC GetCData(XFA_ATTRIBUTE eAttr) {
- CFX_WideStringC wsValue;
- return TryCData(eAttr, wsValue) ? wsValue : CFX_WideStringC();
- }
- bool SetMeasure(XFA_ATTRIBUTE eAttr,
- CXFA_Measurement mValue,
- bool bNotify = false);
- bool TryMeasure(XFA_ATTRIBUTE eAttr,
- CXFA_Measurement& mValue,
- bool bUseDefault = true) const;
- CXFA_Measurement GetMeasure(XFA_ATTRIBUTE eAttr) const;
- bool SetObject(XFA_ATTRIBUTE eAttr,
- void* pData,
- XFA_MAPDATABLOCKCALLBACKINFO* pCallbackInfo = nullptr);
- bool TryObject(XFA_ATTRIBUTE eAttr, void*& pData);
- void* GetObject(XFA_ATTRIBUTE eAttr) {
- void* pData;
- return TryObject(eAttr, pData) ? pData : nullptr;
- }
- bool SetUserData(void* pKey,
- void* pData,
- XFA_MAPDATABLOCKCALLBACKINFO* pCallbackInfo = nullptr);
- bool TryUserData(void* pKey, void*& pData, bool bProtoAlso = false);
- void* GetUserData(void* pKey, bool bProtoAlso = false) {
- void* pData;
- return TryUserData(pKey, pData, bProtoAlso) ? pData : nullptr;
- }
- CXFA_Node* GetProperty(int32_t index,
- XFA_Element eType,
- bool bCreateProperty = true);
- int32_t CountChildren(XFA_Element eType, bool bOnlyChild = false);
- CXFA_Node* GetChild(int32_t index,
- XFA_Element eType,
- bool bOnlyChild = false);
- int32_t InsertChild(int32_t index, CXFA_Node* pNode);
- bool InsertChild(CXFA_Node* pNode, CXFA_Node* pBeforeNode = nullptr);
- bool RemoveChild(CXFA_Node* pNode, bool bNotify = true);
- CXFA_Node* Clone(bool bRecursive);
- CXFA_Node* GetNodeItem(XFA_NODEITEM eItem) const;
- CXFA_Node* GetNodeItem(XFA_NODEITEM eItem, XFA_ObjectType eType) const;
- int32_t GetNodeList(CXFA_NodeArray& nodes,
- uint32_t dwTypeFilter = XFA_NODEFILTER_Children |
- XFA_NODEFILTER_Properties,
- XFA_Element eTypeFilter = XFA_Element::Unknown,
- int32_t iLevel = 1);
- CXFA_Node* CreateSamePacketNode(XFA_Element eType,
- uint32_t dwFlags = XFA_NodeFlag_Initialized);
- CXFA_Node* CloneTemplateToForm(bool bRecursive);
- CXFA_Node* GetTemplateNode() const;
- void SetTemplateNode(CXFA_Node* pTemplateNode);
- CXFA_Node* GetDataDescriptionNode();
- void SetDataDescriptionNode(CXFA_Node* pDataDescriptionNode);
- CXFA_Node* GetBindData();
- int32_t GetBindItems(CXFA_NodeArray& formItems);
- int32_t AddBindItem(CXFA_Node* pFormNode);
- int32_t RemoveBindItem(CXFA_Node* pFormNode);
- bool HasBindItem();
- CXFA_WidgetData* GetWidgetData();
- CXFA_WidgetData* GetContainerWidgetData();
- bool GetLocaleName(CFX_WideString& wsLocaleName);
- XFA_ATTRIBUTEENUM GetIntact();
- CXFA_Node* GetFirstChildByName(const CFX_WideStringC& wsNodeName) const;
- CXFA_Node* GetFirstChildByName(uint32_t dwNodeNameHash) const;
- CXFA_Node* GetFirstChildByClass(XFA_Element eType) const;
- CXFA_Node* GetNextSameNameSibling(uint32_t dwNodeNameHash) const;
- CXFA_Node* GetNextSameNameSibling(const CFX_WideStringC& wsNodeName) const;
- CXFA_Node* GetNextSameClassSibling(XFA_Element eType) const;
- int32_t GetNodeSameNameIndex() const;
- int32_t GetNodeSameClassIndex() const;
- void GetSOMExpression(CFX_WideString& wsSOMExpression);
- CXFA_Node* GetInstanceMgrOfSubform();
-
- CXFA_Node* GetOccurNode();
- void Script_TreeClass_ResolveNode(CFXJSE_Arguments* pArguments);
- void Script_TreeClass_ResolveNodes(CFXJSE_Arguments* pArguments);
- void Script_Som_ResolveNodeList(CFXJSE_Value* pValue,
- CFX_WideString wsExpression,
- uint32_t dwFlag,
- CXFA_Node* refNode = nullptr);
- void Script_TreeClass_All(CFXJSE_Value* pValue,
- bool bSetting,
- XFA_ATTRIBUTE eAttribute);
- void Script_TreeClass_Nodes(CFXJSE_Value* pValue,
- bool bSetting,
- XFA_ATTRIBUTE eAttribute);
- void Script_TreeClass_ClassAll(CFXJSE_Value* pValue,
- bool bSetting,
- XFA_ATTRIBUTE eAttribute);
- void Script_TreeClass_Parent(CFXJSE_Value* pValue,
- bool bSetting,
- XFA_ATTRIBUTE eAttribute);
- void Script_TreeClass_Index(CFXJSE_Value* pValue,
- bool bSetting,
- XFA_ATTRIBUTE eAttribute);
- void Script_TreeClass_ClassIndex(CFXJSE_Value* pValue,
- bool bSetting,
- XFA_ATTRIBUTE eAttribute);
- void Script_TreeClass_SomExpression(CFXJSE_Value* pValue,
- bool bSetting,
- XFA_ATTRIBUTE eAttribute);
- void Script_NodeClass_ApplyXSL(CFXJSE_Arguments* pArguments);
- void Script_NodeClass_AssignNode(CFXJSE_Arguments* pArguments);
- void Script_NodeClass_Clone(CFXJSE_Arguments* pArguments);
- void Script_NodeClass_GetAttribute(CFXJSE_Arguments* pArguments);
- void Script_NodeClass_GetElement(CFXJSE_Arguments* pArguments);
- void Script_NodeClass_IsPropertySpecified(CFXJSE_Arguments* pArguments);
- void Script_NodeClass_LoadXML(CFXJSE_Arguments* pArguments);
- void Script_NodeClass_SaveFilteredXML(CFXJSE_Arguments* pArguments);
- void Script_NodeClass_SaveXML(CFXJSE_Arguments* pArguments);
- void Script_NodeClass_SetAttribute(CFXJSE_Arguments* pArguments);
- void Script_NodeClass_SetElement(CFXJSE_Arguments* pArguments);
- void Script_NodeClass_Ns(CFXJSE_Value* pValue,
- bool bSetting,
- XFA_ATTRIBUTE eAttribute);
- void Script_NodeClass_Model(CFXJSE_Value* pValue,
- bool bSetting,
- XFA_ATTRIBUTE eAttribute);
- void Script_NodeClass_IsContainer(CFXJSE_Value* pValue,
- bool bSetting,
- XFA_ATTRIBUTE eAttribute);
- void Script_NodeClass_IsNull(CFXJSE_Value* pValue,
- bool bSetting,
- XFA_ATTRIBUTE eAttribute);
- void Script_NodeClass_OneOfChild(CFXJSE_Value* pValue,
- bool bSetting,
- XFA_ATTRIBUTE eAttribute);
- void Script_ContainerClass_GetDelta(CFXJSE_Arguments* pArguments);
- void Script_ContainerClass_GetDeltas(CFXJSE_Arguments* pArguments);
- void Script_ModelClass_ClearErrorList(CFXJSE_Arguments* pArguments);
- void Script_ModelClass_CreateNode(CFXJSE_Arguments* pArguments);
- void Script_ModelClass_IsCompatibleNS(CFXJSE_Arguments* pArguments);
- void Script_ModelClass_Context(CFXJSE_Value* pValue,
- bool bSetting,
- XFA_ATTRIBUTE eAttribute);
- void Script_ModelClass_AliasNode(CFXJSE_Value* pValue,
- bool bSetting,
- XFA_ATTRIBUTE eAttribute);
- void Script_WsdlConnection_Execute(CFXJSE_Arguments* pArguments);
- void Script_Delta_Restore(CFXJSE_Arguments* pArguments);
- void Script_Delta_CurrentValue(CFXJSE_Value* pValue,
- bool bSetting,
- XFA_ATTRIBUTE eAttribute);
- void Script_Delta_SavedValue(CFXJSE_Value* pValue,
- bool bSetting,
- XFA_ATTRIBUTE eAttribute);
- void Script_Delta_Target(CFXJSE_Value* pValue,
- bool bSetting,
- XFA_ATTRIBUTE eAttribute);
- void Script_Attribute_SendAttributeChangeMessage(XFA_ATTRIBUTE eAttribute,
- bool bScriptModify);
- void Script_Attribute_Integer(CFXJSE_Value* pValue,
- bool bSetting,
- XFA_ATTRIBUTE eAttribute);
- void Script_Attribute_IntegerRead(CFXJSE_Value* pValue,
- bool bSetting,
- XFA_ATTRIBUTE eAttribute);
- void Script_Attribute_BOOL(CFXJSE_Value* pValue,
- bool bSetting,
- XFA_ATTRIBUTE eAttribute);
- void Script_Attribute_BOOLRead(CFXJSE_Value* pValue,
- bool bSetting,
- XFA_ATTRIBUTE eAttribute);
- void Script_Attribute_String(CFXJSE_Value* pValue,
- bool bSetting,
- XFA_ATTRIBUTE eAttribute);
- void Script_Attribute_StringRead(CFXJSE_Value* pValue,
- bool bSetting,
- XFA_ATTRIBUTE eAttribute);
- void Script_Som_ValidationMessage(CFXJSE_Value* pValue,
- bool bSetting,
- XFA_ATTRIBUTE eAttribute);
- void Script_Field_Length(CFXJSE_Value* pValue,
- bool bSetting,
- XFA_ATTRIBUTE eAttribute);
- void Script_Som_DefaultValue(CFXJSE_Value* pValue,
- bool bSetting,
- XFA_ATTRIBUTE eAttribute);
- void Script_Som_DefaultValue_Read(CFXJSE_Value* pValue,
- bool bSetting,
- XFA_ATTRIBUTE eAttribute);
- void Script_Boolean_Value(CFXJSE_Value* pValue,
- bool bSetting,
- XFA_ATTRIBUTE eAttribute);
- void Script_Som_Message(CFXJSE_Value* pValue,
- bool bSetting,
- XFA_SOM_MESSAGETYPE iMessageType);
- void Script_Som_BorderColor(CFXJSE_Value* pValue,
- bool bSetting,
- XFA_ATTRIBUTE eAttribute);
- void Script_Som_BorderWidth(CFXJSE_Value* pValue,
- bool bSetting,
- XFA_ATTRIBUTE eAttribute);
- void Script_Som_FillColor(CFXJSE_Value* pValue,
- bool bSetting,
- XFA_ATTRIBUTE eAttribute);
- void Script_Som_DataNode(CFXJSE_Value* pValue,
- bool bSetting,
- XFA_ATTRIBUTE eAttribute);
- void Script_Som_FontColor(CFXJSE_Value* pValue,
- bool bSetting,
- XFA_ATTRIBUTE eAttribute);
- void Script_Som_Mandatory(CFXJSE_Value* pValue,
- bool bSetting,
- XFA_ATTRIBUTE eAttribute);
- void Script_Som_MandatoryMessage(CFXJSE_Value* pValue,
- bool bSetting,
- XFA_ATTRIBUTE eAttribute);
- void Script_Som_InstanceIndex(CFXJSE_Value* pValue,
- bool bSetting,
- XFA_ATTRIBUTE eAttribute);
- void Script_Draw_DefaultValue(CFXJSE_Value* pValue,
- bool bSetting,
- XFA_ATTRIBUTE eAttribute);
- void Script_Field_DefaultValue(CFXJSE_Value* pValue,
- bool bSetting,
- XFA_ATTRIBUTE eAttribute);
- void Script_Field_EditValue(CFXJSE_Value* pValue,
- bool bSetting,
- XFA_ATTRIBUTE eAttribute);
- void Script_Field_FormatMessage(CFXJSE_Value* pValue,
- bool bSetting,
- XFA_ATTRIBUTE eAttribute);
- void Script_Field_FormattedValue(CFXJSE_Value* pValue,
- bool bSetting,
- XFA_ATTRIBUTE eAttribute);
- void Script_Field_ParentSubform(CFXJSE_Value* pValue,
- bool bSetting,
- XFA_ATTRIBUTE eAttribute);
- void Script_Field_SelectedIndex(CFXJSE_Value* pValue,
- bool bSetting,
- XFA_ATTRIBUTE eAttribute);
- void Script_Field_ClearItems(CFXJSE_Arguments* pArguments);
- void Script_Field_ExecEvent(CFXJSE_Arguments* pArguments);
- void Script_Field_ExecInitialize(CFXJSE_Arguments* pArguments);
- void Script_Field_DeleteItem(CFXJSE_Arguments* pArguments);
- void Script_Field_GetSaveItem(CFXJSE_Arguments* pArguments);
- void Script_Field_BoundItem(CFXJSE_Arguments* pArguments);
- void Script_Field_GetItemState(CFXJSE_Arguments* pArguments);
- void Script_Field_ExecCalculate(CFXJSE_Arguments* pArguments);
- void Script_Field_SetItems(CFXJSE_Arguments* pArguments);
- void Script_Field_GetDisplayItem(CFXJSE_Arguments* pArguments);
- void Script_Field_SetItemState(CFXJSE_Arguments* pArguments);
- void Script_Field_AddItem(CFXJSE_Arguments* pArguments);
- void Script_Field_ExecValidate(CFXJSE_Arguments* pArguments);
- void Script_ExclGroup_DefaultAndRawValue(CFXJSE_Value* pValue,
- bool bSetting,
- XFA_ATTRIBUTE eAttribute);
- void Script_ExclGroup_ErrorText(CFXJSE_Value* pValue,
- bool bSetting,
- XFA_ATTRIBUTE eAttribute);
- void Script_ExclGroup_Transient(CFXJSE_Value* pValue,
- bool bSetting,
- XFA_ATTRIBUTE eAttribute);
- void Script_ExclGroup_ExecEvent(CFXJSE_Arguments* pArguments);
- void Script_ExclGroup_SelectedMember(CFXJSE_Arguments* pArguments);
- void Script_ExclGroup_ExecInitialize(CFXJSE_Arguments* pArguments);
- void Script_ExclGroup_ExecCalculate(CFXJSE_Arguments* pArguments);
- void Script_ExclGroup_ExecValidate(CFXJSE_Arguments* pArguments);
- void Script_Subform_InstanceManager(CFXJSE_Value* pValue,
- bool bSetting,
- XFA_ATTRIBUTE eAttribute);
- void Script_Subform_Locale(CFXJSE_Value* pValue,
- bool bSetting,
- XFA_ATTRIBUTE eAttribute);
- void Script_Subform_ExecEvent(CFXJSE_Arguments* pArguments);
- void Script_Subform_ExecInitialize(CFXJSE_Arguments* pArguments);
- void Script_Subform_ExecCalculate(CFXJSE_Arguments* pArguments);
- void Script_Subform_ExecValidate(CFXJSE_Arguments* pArguments);
- void Script_Subform_GetInvalidObjects(CFXJSE_Arguments* pArguments);
-
- int32_t Subform_and_SubformSet_InstanceIndex();
- void Script_Template_FormNodes(CFXJSE_Arguments* pArguments);
- void Script_Template_Remerge(CFXJSE_Arguments* pArguments);
- void Script_Template_ExecInitialize(CFXJSE_Arguments* pArguments);
- void Script_Template_CreateNode(CFXJSE_Arguments* pArguments);
- void Script_Template_Recalculate(CFXJSE_Arguments* pArguments);
- void Script_Template_ExecCalculate(CFXJSE_Arguments* pArguments);
- void Script_Template_ExecValidate(CFXJSE_Arguments* pArguments);
- void Script_Manifest_Evaluate(CFXJSE_Arguments* pArguments);
- void Script_InstanceManager_Count(CFXJSE_Value* pValue,
- bool bSetting,
- XFA_ATTRIBUTE eAttribute);
- void Script_InstanceManager_Max(CFXJSE_Value* pValue,
- bool bSetting,
- XFA_ATTRIBUTE eAttribute);
- void Script_InstanceManager_Min(CFXJSE_Value* pValue,
- bool bSetting,
- XFA_ATTRIBUTE eAttribute);
- void Script_InstanceManager_MoveInstance(CFXJSE_Arguments* pArguments);
- void Script_InstanceManager_RemoveInstance(CFXJSE_Arguments* pArguments);
- void Script_InstanceManager_SetInstances(CFXJSE_Arguments* pArguments);
- void Script_InstanceManager_AddInstance(CFXJSE_Arguments* pArguments);
- void Script_InstanceManager_InsertInstance(CFXJSE_Arguments* pArguments);
- int32_t InstanceManager_SetInstances(int32_t iCount);
- int32_t InstanceManager_MoveInstance(int32_t iTo, int32_t iFrom);
- void Script_Occur_Max(CFXJSE_Value* pValue,
- bool bSetting,
- XFA_ATTRIBUTE eAttribute);
- void Script_Occur_Min(CFXJSE_Value* pValue,
- bool bSetting,
- XFA_ATTRIBUTE eAttribute);
- void Script_Desc_Metadata(CFXJSE_Arguments* pArguments);
- void Script_Form_FormNodes(CFXJSE_Arguments* pArguments);
- void Script_Form_Remerge(CFXJSE_Arguments* pArguments);
- void Script_Form_ExecInitialize(CFXJSE_Arguments* pArguments);
- void Script_Form_Recalculate(CFXJSE_Arguments* pArguments);
- void Script_Form_ExecCalculate(CFXJSE_Arguments* pArguments);
- void Script_Form_ExecValidate(CFXJSE_Arguments* pArguments);
- void Script_Form_Checksum(CFXJSE_Value* pValue,
- bool bSetting,
- XFA_ATTRIBUTE eAttribute);
- void Script_Packet_GetAttribute(CFXJSE_Arguments* pArguments);
- void Script_Packet_SetAttribute(CFXJSE_Arguments* pArguments);
- void Script_Packet_RemoveAttribute(CFXJSE_Arguments* pArguments);
- void Script_Packet_Content(CFXJSE_Value* pValue,
- bool bSetting,
- XFA_ATTRIBUTE eAttribute);
- void Script_Source_Next(CFXJSE_Arguments* pArguments);
- void Script_Source_CancelBatch(CFXJSE_Arguments* pArguments);
- void Script_Source_First(CFXJSE_Arguments* pArguments);
- void Script_Source_UpdateBatch(CFXJSE_Arguments* pArguments);
- void Script_Source_Previous(CFXJSE_Arguments* pArguments);
- void Script_Source_IsBOF(CFXJSE_Arguments* pArguments);
- void Script_Source_IsEOF(CFXJSE_Arguments* pArguments);
- void Script_Source_Cancel(CFXJSE_Arguments* pArguments);
- void Script_Source_Update(CFXJSE_Arguments* pArguments);
- void Script_Source_Open(CFXJSE_Arguments* pArguments);
- void Script_Source_Delete(CFXJSE_Arguments* pArguments);
- void Script_Source_AddNew(CFXJSE_Arguments* pArguments);
- void Script_Source_Requery(CFXJSE_Arguments* pArguments);
- void Script_Source_Resync(CFXJSE_Arguments* pArguments);
- void Script_Source_Close(CFXJSE_Arguments* pArguments);
- void Script_Source_Last(CFXJSE_Arguments* pArguments);
- void Script_Source_HasDataChanged(CFXJSE_Arguments* pArguments);
- void Script_Source_Db(CFXJSE_Value* pValue,
- bool bSetting,
- XFA_ATTRIBUTE eAttribute);
- void Script_Xfa_This(CFXJSE_Value* pValue,
- bool bSetting,
- XFA_ATTRIBUTE eAttribute);
- void Script_Handler_Version(CFXJSE_Value* pValue,
- bool bSetting,
- XFA_ATTRIBUTE eAttribute);
- void Script_SubmitFormat_Mode(CFXJSE_Value* pValue,
- bool bSetting,
- XFA_ATTRIBUTE eAttribute);
- void Script_Extras_Type(CFXJSE_Value* pValue,
- bool bSetting,
- XFA_ATTRIBUTE eAttribute);
- void Script_Encrypt_Format(CFXJSE_Value* pValue,
- bool bSetting,
- XFA_ATTRIBUTE eAttribute);
- void Script_Script_Stateless(CFXJSE_Value* pValue,
- bool bSetting,
- XFA_ATTRIBUTE eAttribute);
-
- protected:
- friend class CXFA_Document;
-
- CXFA_Node(CXFA_Document* pDoc,
- uint16_t ePacket,
- XFA_ObjectType oType,
- XFA_Element eType,
- const CFX_WideStringC& elementName);
- ~CXFA_Node() override;
-
- bool HasFlag(XFA_NodeFlag dwFlag) const;
- CXFA_Node* Deprecated_GetPrevSibling();
- bool SetValue(XFA_ATTRIBUTE eAttr,
- XFA_ATTRIBUTETYPE eType,
- void* pValue,
- bool bNotify);
- bool GetValue(XFA_ATTRIBUTE eAttr,
- XFA_ATTRIBUTETYPE eType,
- bool bUseDefault,
- void*& pValue);
- void OnRemoved(bool bNotify);
- void OnChanging(XFA_ATTRIBUTE eAttr, bool bNotify);
- void OnChanged(XFA_ATTRIBUTE eAttr, bool bNotify, bool bScriptModify);
- int32_t execSingleEventByName(const CFX_WideStringC& wsEventName,
- XFA_Element eType);
- bool SetScriptContent(const CFX_WideString& wsContent,
- const CFX_WideString& wsXMLValue,
- bool bNotify = true,
- bool bScriptModify = false,
- bool bSyncData = true);
- CFX_WideString GetScriptContent(bool bScriptModify = false);
- XFA_MAPMODULEDATA* CreateMapModuleData();
- XFA_MAPMODULEDATA* GetMapModuleData() const;
- void SetMapModuleValue(void* pKey, void* pValue);
- bool GetMapModuleValue(void* pKey, void*& pValue);
- void SetMapModuleString(void* pKey, const CFX_WideStringC& wsValue);
- bool GetMapModuleString(void* pKey, CFX_WideStringC& wsValue);
- void SetMapModuleBuffer(
- void* pKey,
- void* pValue,
- int32_t iBytes,
- XFA_MAPDATABLOCKCALLBACKINFO* pCallbackInfo = nullptr);
- bool GetMapModuleBuffer(void* pKey,
- void*& pValue,
- int32_t& iBytes,
- bool bProtoAlso = true) const;
- bool HasMapModuleKey(void* pKey, bool bProtoAlso = false);
- void RemoveMapModuleKey(void* pKey = nullptr);
- void MergeAllData(void* pDstModule);
- void MoveBufferMapData(CXFA_Node* pDstModule, void* pKey);
- void MoveBufferMapData(CXFA_Node* pSrcModule,
- CXFA_Node* pDstModule,
- void* pKey,
- bool bRecursive = false);
-
- CXFA_Node* m_pNext;
- CXFA_Node* m_pChild;
- CXFA_Node* m_pLastChild;
- CXFA_Node* m_pParent;
- CFDE_XMLNode* m_pXMLNode;
- uint16_t m_ePacket;
- uint16_t m_uNodeFlags;
- uint32_t m_dwNameHash;
- CXFA_Node* m_pAuxNode;
- XFA_MAPMODULEDATA* m_pMapModuleData;
-
- private:
- void ThrowMissingPropertyException(const CFX_WideString& obj,
- const CFX_WideString& prop) const;
- void ThrowTooManyOccurancesException(const CFX_WideString& obj) const;
-};
-
-class CXFA_ThisProxy : public CXFA_Object {
- public:
- CXFA_ThisProxy(CXFA_Node* pThisNode, CXFA_Node* pScriptNode);
- ~CXFA_ThisProxy() override;
-
- CXFA_Node* GetThisNode() const;
- CXFA_Node* GetScriptNode() const;
-
- private:
- CXFA_Node* m_pThisNode;
- CXFA_Node* m_pScriptNode;
-};
-
-class CXFA_NodeList : public CXFA_Object {
- public:
- explicit CXFA_NodeList(CXFA_Document* pDocument);
- ~CXFA_NodeList() override;
-
- CXFA_Node* NamedItem(const CFX_WideStringC& wsName);
- virtual int32_t GetLength() = 0;
- virtual bool Append(CXFA_Node* pNode) = 0;
- virtual bool Insert(CXFA_Node* pNewNode, CXFA_Node* pBeforeNode) = 0;
- virtual bool Remove(CXFA_Node* pNode) = 0;
- virtual CXFA_Node* Item(int32_t iIndex) = 0;
-
- void Script_ListClass_Append(CFXJSE_Arguments* pArguments);
- void Script_ListClass_Insert(CFXJSE_Arguments* pArguments);
- void Script_ListClass_Remove(CFXJSE_Arguments* pArguments);
- void Script_ListClass_Item(CFXJSE_Arguments* pArguments);
-
- void Script_TreelistClass_NamedItem(CFXJSE_Arguments* pArguments);
- void Script_ListClass_Length(CFXJSE_Value* pValue,
- bool bSetting,
- XFA_ATTRIBUTE eAttribute);
-};
-
-class CXFA_ArrayNodeList : public CXFA_NodeList {
- public:
- explicit CXFA_ArrayNodeList(CXFA_Document* pDocument);
- ~CXFA_ArrayNodeList() override;
-
- // From CXFA_NodeList.
- int32_t GetLength() override;
- bool Append(CXFA_Node* pNode) override;
- bool Insert(CXFA_Node* pNewNode, CXFA_Node* pBeforeNode) override;
- bool Remove(CXFA_Node* pNode) override;
- CXFA_Node* Item(int32_t iIndex) override;
-
- void SetArrayNodeList(const CXFA_NodeArray& srcArray);
-
- protected:
- CXFA_NodeArray m_array;
-};
-
-class CXFA_AttachNodeList : public CXFA_NodeList {
- public:
- CXFA_AttachNodeList(CXFA_Document* pDocument, CXFA_Node* pAttachNode);
-
- // From CXFA_NodeList.
- int32_t GetLength() override;
- bool Append(CXFA_Node* pNode) override;
- bool Insert(CXFA_Node* pNewNode, CXFA_Node* pBeforeNode) override;
- bool Remove(CXFA_Node* pNode) override;
- CXFA_Node* Item(int32_t iIndex) override;
-
- protected:
- CXFA_Node* m_pAttachNode;
-};
-class CXFA_TraverseStrategy_XFAContainerNode {
- public:
- static CXFA_Node* GetFirstChild(CXFA_Node* pTemplateNode,
- void* pUserData = nullptr) {
- return pTemplateNode->GetNodeItem(XFA_NODEITEM_FirstChild,
- XFA_ObjectType::ContainerNode);
- }
- static CXFA_Node* GetNextSibling(CXFA_Node* pTemplateNode,
- void* pUserData = nullptr) {
- return pTemplateNode->GetNodeItem(XFA_NODEITEM_NextSibling,
- XFA_ObjectType::ContainerNode);
- }
- static CXFA_Node* GetParent(CXFA_Node* pTemplateNode,
- void* pUserData = nullptr) {
- return pTemplateNode->GetNodeItem(XFA_NODEITEM_Parent,
- XFA_ObjectType::ContainerNode);
- }
-};
-typedef CXFA_NodeIteratorTemplate<CXFA_Node,
- CXFA_TraverseStrategy_XFAContainerNode>
- CXFA_ContainerIterator;
-class CXFA_TraverseStrategy_XFANode {
- public:
- static inline CXFA_Node* GetFirstChild(CXFA_Node* pTemplateNode) {
- return pTemplateNode->GetNodeItem(XFA_NODEITEM_FirstChild);
- }
- static inline CXFA_Node* GetNextSibling(CXFA_Node* pTemplateNode) {
- return pTemplateNode->GetNodeItem(XFA_NODEITEM_NextSibling);
- }
- static inline CXFA_Node* GetParent(CXFA_Node* pTemplateNode) {
- return pTemplateNode->GetNodeItem(XFA_NODEITEM_Parent);
- }
-};
-typedef CXFA_NodeIteratorTemplate<CXFA_Node, CXFA_TraverseStrategy_XFANode>
- CXFA_NodeIterator;
-
-inline CXFA_Node* CXFA_Object::AsNode() {
- return IsNode() ? static_cast<CXFA_Node*>(this) : nullptr;
-}
-
-inline CXFA_NodeList* CXFA_Object::AsNodeList() {
- return IsNodeList() ? static_cast<CXFA_NodeList*>(this) : nullptr;
-}
-
-inline const CXFA_Node* CXFA_Object::AsNode() const {
- return IsNode() ? static_cast<const CXFA_Node*>(this) : nullptr;
-}
-
-inline const CXFA_NodeList* CXFA_Object::AsNodeList() const {
- return IsNodeList() ? static_cast<const CXFA_NodeList*>(this) : nullptr;
-}
-
-inline CXFA_Node* ToNode(CXFA_Object* pObj) {
- return pObj ? pObj->AsNode() : nullptr;
-}
-
-inline const CXFA_Node* ToNode(const CXFA_Object* pObj) {
- return pObj ? pObj->AsNode() : nullptr;
-}
-
-#endif // XFA_FXFA_PARSER_XFA_OBJECT_H_
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/xfa_resolvenode_rs.h b/chromium/third_party/pdfium/xfa/fxfa/parser/xfa_resolvenode_rs.h
index 7ad218efe8c..a30d540ef05 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/xfa_resolvenode_rs.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/xfa_resolvenode_rs.h
@@ -8,8 +8,11 @@
#define XFA_FXFA_PARSER_XFA_RESOLVENODE_RS_H_
#include <memory>
+#include <utility>
+#include <vector>
#include "fxjs/cfxjse_value.h"
+#include "third_party/base/ptr_util.h"
#include "xfa/fxfa/fxfa.h"
#include "xfa/fxfa/parser/cxfa_valuearray.h"
@@ -43,20 +46,20 @@ struct XFA_RESOLVENODE_RS {
XFA_RESOLVENODE_RS();
~XFA_RESOLVENODE_RS();
- int32_t GetAttributeResult(CXFA_ValueArray& valueArray) const {
+ size_t GetAttributeResult(CXFA_ValueArray* valueArray) const {
if (pScriptAttribute && pScriptAttribute->eValueType == XFA_SCRIPT_Object) {
- v8::Isolate* pIsolate = valueArray.m_pIsolate;
- for (int32_t i = 0; i < nodes.GetSize(); i++) {
- std::unique_ptr<CFXJSE_Value> pValue(new CFXJSE_Value(pIsolate));
- (nodes[i]->*(pScriptAttribute->lpfnCallback))(
- pValue.get(), false, (XFA_ATTRIBUTE)pScriptAttribute->eAttribute);
- valueArray.Add(pValue.release());
+ for (CXFA_Object* pObject : objects) {
+ auto pValue = pdfium::MakeUnique<CFXJSE_Value>(valueArray->m_pIsolate);
+ (pObject->*(pScriptAttribute->lpfnCallback))(
+ pValue.get(), false,
+ static_cast<XFA_ATTRIBUTE>(pScriptAttribute->eAttribute));
+ valueArray->m_Values.push_back(std::move(pValue));
}
}
- return valueArray.GetSize();
+ return valueArray->m_Values.size();
}
- CXFA_ObjArray nodes;
+ std::vector<CXFA_Object*> objects; // Not owned.
XFA_RESOVENODE_RSTYPE dwFlags;
const XFA_SCRIPTATTRIBUTEINFO* pScriptAttribute;
};
@@ -64,7 +67,6 @@ struct XFA_RESOLVENODE_RS {
inline XFA_RESOLVENODE_RS::XFA_RESOLVENODE_RS()
: dwFlags(XFA_RESOVENODE_RSTYPE_Nodes), pScriptAttribute(nullptr) {}
-inline XFA_RESOLVENODE_RS::~XFA_RESOLVENODE_RS() {
- nodes.RemoveAll();
-}
+inline XFA_RESOLVENODE_RS::~XFA_RESOLVENODE_RS() {}
+
#endif // XFA_FXFA_PARSER_XFA_RESOLVENODE_RS_H_
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/xfa_utils.cpp b/chromium/third_party/pdfium/xfa/fxfa/parser/xfa_utils.cpp
index 6f54c0e5fe4..6bd04c322fc 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/xfa_utils.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/xfa_utils.cpp
@@ -7,34 +7,37 @@
#include "xfa/fxfa/parser/xfa_utils.h"
#include "core/fxcrt/fx_ext.h"
-#include "xfa/fde/xml/fde_xml_imp.h"
+#include "xfa/fde/xml/cfde_xmlchardata.h"
+#include "xfa/fde/xml/cfde_xmlelement.h"
+#include "xfa/fde/xml/cfde_xmlnode.h"
+#include "xfa/fde/xml/cfde_xmltext.h"
#include "xfa/fxfa/parser/cxfa_document.h"
+#include "xfa/fxfa/parser/cxfa_localemgr.h"
+#include "xfa/fxfa/parser/cxfa_localevalue.h"
#include "xfa/fxfa/parser/cxfa_measurement.h"
+#include "xfa/fxfa/parser/cxfa_node.h"
#include "xfa/fxfa/parser/xfa_basic_data.h"
-#include "xfa/fxfa/parser/xfa_localemgr.h"
-#include "xfa/fxfa/parser/xfa_localevalue.h"
-#include "xfa/fxfa/parser/xfa_object.h"
namespace {
-const FX_DOUBLE fraction_scales[] = {0.1,
- 0.01,
- 0.001,
- 0.0001,
- 0.00001,
- 0.000001,
- 0.0000001,
- 0.00000001,
- 0.000000001,
- 0.0000000001,
- 0.00000000001,
- 0.000000000001,
- 0.0000000000001,
- 0.00000000000001,
- 0.000000000000001,
- 0.0000000000000001};
-
-FX_DOUBLE WideStringToDouble(const CFX_WideString& wsStringVal) {
+const double fraction_scales[] = {0.1,
+ 0.01,
+ 0.001,
+ 0.0001,
+ 0.00001,
+ 0.000001,
+ 0.0000001,
+ 0.00000001,
+ 0.000000001,
+ 0.0000000001,
+ 0.00000000001,
+ 0.000000000001,
+ 0.0000000000001,
+ 0.00000000000001,
+ 0.000000000000001,
+ 0.0000000000000001};
+
+double WideStringToDouble(const CFX_WideString& wsStringVal) {
CFX_WideString wsValue = wsStringVal;
wsValue.TrimLeft();
wsValue.TrimRight();
@@ -44,7 +47,7 @@ FX_DOUBLE WideStringToDouble(const CFX_WideString& wsStringVal) {
int32_t cc = 0;
bool bNegative = false;
bool bExpSign = false;
- const FX_WCHAR* str = wsValue.c_str();
+ const wchar_t* str = wsValue.c_str();
int32_t len = wsValue.GetLength();
if (str[0] == '+') {
cc++;
@@ -67,25 +70,23 @@ FX_DOUBLE WideStringToDouble(const CFX_WideString& wsStringVal) {
}
nIntegral = bNegative ? -nIntegral : nIntegral;
int32_t scale = 0;
- FX_DOUBLE fraction = 0.0;
+ double fraction = 0.0;
if (cc < len && str[cc] == '.') {
cc++;
while (cc < len) {
- fraction += fraction_scales[scale] * (str[cc] - '0');
+ fraction += XFA_GetFractionalScale(scale) * (str[cc] - '0');
scale++;
cc++;
- if (cc == len) {
+ if (cc == len)
break;
- }
- if (scale == sizeof(fraction_scales) / sizeof(FX_DOUBLE) ||
- str[cc] == 'E' || str[cc] == 'e') {
+ if (scale == XFA_GetMaxFractionalScale() || str[cc] == 'E' ||
+ str[cc] == 'e') {
break;
}
- if (!FXSYS_isDecimalDigit(str[cc])) {
+ if (!FXSYS_isDecimalDigit(str[cc]))
return 0;
- }
}
- dwFractional = (uint32_t)(fraction * 4294967296.0);
+ dwFractional = static_cast<uint32_t>(fraction * 4294967296.0);
}
if (cc < len && (str[cc] == 'E' || str[cc] == 'e')) {
cc++;
@@ -98,24 +99,33 @@ FX_DOUBLE WideStringToDouble(const CFX_WideString& wsStringVal) {
}
}
while (cc < len) {
- if (str[cc] == '.' || !FXSYS_isDecimalDigit(str[cc])) {
+ if (str[cc] == '.' || !FXSYS_isDecimalDigit(str[cc]))
return 0;
- }
+
nExponent = nExponent * 10 + str[cc] - '0';
cc++;
}
nExponent = bExpSign ? -nExponent : nExponent;
}
- FX_DOUBLE dValue = (dwFractional / 4294967296.0);
+
+ double dValue = dwFractional / 4294967296.0;
dValue = nIntegral + (nIntegral >= 0 ? dValue : -dValue);
- if (nExponent != 0) {
- dValue *= FXSYS_pow(10, (FX_FLOAT)nExponent);
- }
+ if (nExponent != 0)
+ dValue *= FXSYS_pow(10, static_cast<float>(nExponent));
+
return dValue;
}
} // namespace
+double XFA_GetFractionalScale(uint32_t idx) {
+ return fraction_scales[idx];
+}
+
+int XFA_GetMaxFractionalScale() {
+ return FX_ArraySize(fraction_scales);
+}
+
CXFA_LocaleValue XFA_GetLocaleValue(CXFA_WidgetData* pWidgetData) {
CXFA_Node* pNodeValue =
pWidgetData->GetNode()->GetChild(0, XFA_Element::Value);
@@ -167,8 +177,7 @@ void XFA_GetPlainTextFromRichText(CFDE_XMLNode* pXMLNode,
switch (pXMLNode->GetType()) {
case FDE_XMLNODE_Element: {
CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode);
- CFX_WideString wsTag;
- pXMLElement->GetLocalTagName(wsTag);
+ CFX_WideString wsTag = pXMLElement->GetLocalTagName();
uint32_t uTag = FX_HashCode_GetW(wsTag.AsStringC(), true);
if (uTag == 0x0001f714) {
wsPlainText += L"\n";
@@ -182,17 +191,15 @@ void XFA_GetPlainTextFromRichText(CFDE_XMLNode* pXMLNode,
wsPlainText += L"\n";
}
}
- } break;
- case FDE_XMLNODE_Text: {
- CFX_WideString wsContent;
- static_cast<CFDE_XMLText*>(pXMLNode)->GetText(wsContent);
- wsPlainText += wsContent;
- } break;
+ break;
+ }
+ case FDE_XMLNODE_Text:
case FDE_XMLNODE_CharData: {
- CFX_WideString wsCharData;
- static_cast<CFDE_XMLCharData*>(pXMLNode)->GetCharData(wsCharData);
- wsPlainText += wsCharData;
- } break;
+ CFX_WideString wsContent =
+ static_cast<CFDE_XMLText*>(pXMLNode)->GetText();
+ wsPlainText += wsContent;
+ break;
+ }
default:
break;
}
@@ -221,7 +228,7 @@ bool XFA_FieldIsMultiListBox(CXFA_Node* pFieldNode) {
return bRet;
}
-FX_DOUBLE XFA_ByteStringToDouble(const CFX_ByteStringC& szStringVal) {
+double XFA_ByteStringToDouble(const CFX_ByteStringC& szStringVal) {
CFX_WideString wsValue = CFX_WideString::FromUTF8(szStringVal);
return WideStringToDouble(wsValue);
}
@@ -328,10 +335,10 @@ const XFA_PROPERTY* XFA_GetPropertyOfElement(XFA_Element eElement,
if (!pProperties || iCount < 1)
return nullptr;
- auto it = std::find_if(pProperties, pProperties + iCount,
- [eProperty](const XFA_PROPERTY& prop) {
- return prop.eName == eProperty;
- });
+ auto* it = std::find_if(pProperties, pProperties + iCount,
+ [eProperty](const XFA_PROPERTY& prop) {
+ return prop.eName == eProperty;
+ });
if (it == pProperties + iCount)
return nullptr;
@@ -375,10 +382,11 @@ XFA_Element XFA_GetElementTypeForName(const CFX_WideStringC& wsName) {
uint32_t uHash = FX_HashCode_GetW(wsName, false);
const XFA_ELEMENTINFO* pEnd = g_XFAElementData + g_iXFAElementCount;
- auto pInfo = std::lower_bound(g_XFAElementData, pEnd, uHash,
- [](const XFA_ELEMENTINFO& info, uint32_t hash) {
- return info.uHash < hash;
- });
+ auto* pInfo =
+ std::lower_bound(g_XFAElementData, pEnd, uHash,
+ [](const XFA_ELEMENTINFO& info, uint32_t hash) {
+ return info.uHash < hash;
+ });
if (pInfo < pEnd && pInfo->uHash == uHash)
return pInfo->eName;
return XFA_Element::Unknown;
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/xfa_utils.h b/chromium/third_party/pdfium/xfa/fxfa/parser/xfa_utils.h
index d09afda0f95..36d62c76023 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/xfa_utils.h
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/xfa_utils.h
@@ -7,9 +7,7 @@
#ifndef XFA_FXFA_PARSER_XFA_UTILS_H_
#define XFA_FXFA_PARSER_XFA_UTILS_H_
-#include "xfa/fde/xml/fde_xml.h"
-#include "xfa/fgas/crt/fgas_stream.h"
-#include "xfa/fgas/crt/fgas_utils.h"
+#include "xfa/fgas/crt/ifgas_stream.h"
#include "xfa/fxfa/fxfa_basic.h"
class CFDE_XMLElement;
@@ -18,152 +16,135 @@ class CXFA_LocaleValue;
class CXFA_Node;
class CXFA_WidgetData;
+double XFA_GetFractionalScale(uint32_t idx);
+int XFA_GetMaxFractionalScale();
+
bool XFA_FDEExtension_ResolveNamespaceQualifier(
CFDE_XMLElement* pNode,
const CFX_WideStringC& wsQualifier,
- CFX_WideString& wsNamespaceURI);
+ CFX_WideString* wsNamespaceURI);
template <class NodeType, class TraverseStrategy>
class CXFA_NodeIteratorTemplate {
public:
- explicit CXFA_NodeIteratorTemplate(NodeType* pRootNode = nullptr)
- : m_pRoot(pRootNode), m_NodeStack(100) {
- if (pRootNode) {
- m_NodeStack.Push(pRootNode);
- }
- }
- bool Init(NodeType* pRootNode) {
- if (!pRootNode) {
+ explicit CXFA_NodeIteratorTemplate(NodeType* pRoot)
+ : m_pRoot(pRoot), m_pCurrent(pRoot) {}
+
+ NodeType* GetRoot() const { return m_pRoot; }
+ NodeType* GetCurrent() const { return m_pCurrent; }
+
+ void Reset() { m_pCurrent = m_pRoot; }
+ bool SetCurrent(NodeType* pNode) {
+ if (!RootReachableFromNode(pNode)) {
+ m_pCurrent = nullptr;
return false;
}
- m_pRoot = pRootNode;
- m_NodeStack.RemoveAll(false);
- m_NodeStack.Push(pRootNode);
- return true;
- }
- void Clear() { m_NodeStack.RemoveAll(false); }
- void Reset() {
- Clear();
- if (m_pRoot) {
- m_NodeStack.Push(m_pRoot);
- }
- }
- bool SetCurrent(NodeType* pCurNode) {
- m_NodeStack.RemoveAll(false);
- if (pCurNode) {
- CFX_StackTemplate<NodeType*> revStack(100);
- NodeType* pNode;
- for (pNode = pCurNode; pNode && pNode != m_pRoot;
- pNode = TraverseStrategy::GetParent(pNode)) {
- revStack.Push(pNode);
- }
- if (!pNode) {
- return false;
- }
- revStack.Push(m_pRoot);
- while (revStack.GetSize()) {
- m_NodeStack.Push(*revStack.GetTopElement());
- revStack.Pop();
- }
- }
+ m_pCurrent = pNode;
return true;
}
- NodeType* GetCurrent() const {
- return m_NodeStack.GetSize() ? *m_NodeStack.GetTopElement() : nullptr;
- }
- NodeType* GetRoot() const { return m_pRoot; }
+
NodeType* MoveToPrev() {
- int32_t nStackLength = m_NodeStack.GetSize();
- if (nStackLength == 1) {
+ if (!m_pRoot)
return nullptr;
- } else if (nStackLength > 1) {
- NodeType* pCurItem = *m_NodeStack.GetTopElement();
- m_NodeStack.Pop();
- NodeType* pParentItem = *m_NodeStack.GetTopElement();
- NodeType* pParentFirstChildItem =
- TraverseStrategy::GetFirstChild(pParentItem);
- if (pCurItem == pParentFirstChildItem) {
- return pParentItem;
- }
- NodeType *pPrevItem = pParentFirstChildItem, *pPrevItemNext = nullptr;
- for (; pPrevItem; pPrevItem = pPrevItemNext) {
- pPrevItemNext = TraverseStrategy::GetNextSibling(pPrevItem);
- if (!pPrevItemNext || pPrevItemNext == pCurItem) {
- break;
- }
- }
- m_NodeStack.Push(pPrevItem);
- } else {
- m_NodeStack.RemoveAll(false);
- if (m_pRoot) {
- m_NodeStack.Push(m_pRoot);
- }
+ if (!m_pCurrent) {
+ m_pCurrent = LastDescendant(m_pRoot);
+ return m_pCurrent;
}
- if (m_NodeStack.GetSize() > 0) {
- NodeType* pChildItem = *m_NodeStack.GetTopElement();
- while ((pChildItem = TraverseStrategy::GetFirstChild(pChildItem)) !=
- nullptr) {
- while (NodeType* pNextItem =
- TraverseStrategy::GetNextSibling(pChildItem)) {
- pChildItem = pNextItem;
- }
- m_NodeStack.Push(pChildItem);
- }
- return *m_NodeStack.GetTopElement();
+ NodeType* pSibling = PreviousSiblingWithinSubtree(m_pCurrent);
+ if (pSibling) {
+ m_pCurrent = LastDescendant(pSibling);
+ return m_pCurrent;
+ }
+ NodeType* pParent = ParentWithinSubtree(m_pCurrent);
+ if (pParent) {
+ m_pCurrent = pParent;
+ return m_pCurrent;
}
return nullptr;
}
+
NodeType* MoveToNext() {
- NodeType** ppNode = nullptr;
- NodeType* pCurrent = GetCurrent();
- while (m_NodeStack.GetSize() > 0) {
- while ((ppNode = m_NodeStack.GetTopElement()) != nullptr) {
- if (pCurrent != *ppNode) {
- return *ppNode;
- }
- NodeType* pChild = TraverseStrategy::GetFirstChild(*ppNode);
- if (!pChild) {
- break;
- }
- m_NodeStack.Push(pChild);
- }
- while ((ppNode = m_NodeStack.GetTopElement()) != nullptr) {
- NodeType* pNext = TraverseStrategy::GetNextSibling(*ppNode);
- m_NodeStack.Pop();
- if (m_NodeStack.GetSize() == 0) {
- break;
- }
- if (pNext) {
- m_NodeStack.Push(pNext);
- break;
- }
- }
+ if (!m_pRoot || !m_pCurrent)
+ return nullptr;
+ NodeType* pChild = TraverseStrategy::GetFirstChild(m_pCurrent);
+ if (pChild) {
+ m_pCurrent = pChild;
+ return m_pCurrent;
}
- return nullptr;
+ return SkipChildrenAndMoveToNext();
}
+
NodeType* SkipChildrenAndMoveToNext() {
- NodeType** ppNode = nullptr;
- while ((ppNode = m_NodeStack.GetTopElement()) != nullptr) {
- NodeType* pNext = TraverseStrategy::GetNextSibling(*ppNode);
- m_NodeStack.Pop();
- if (m_NodeStack.GetSize() == 0) {
- break;
- }
- if (pNext) {
- m_NodeStack.Push(pNext);
- break;
+ if (!m_pRoot)
+ return nullptr;
+ NodeType* pNode = m_pCurrent;
+ while (pNode) {
+ NodeType* pSibling = NextSiblingWithinSubtree(pNode);
+ if (pSibling) {
+ m_pCurrent = pSibling;
+ return m_pCurrent;
}
+ pNode = ParentWithinSubtree(pNode);
+ }
+ m_pCurrent = nullptr;
+ return m_pCurrent;
+ }
+
+ private:
+ bool RootReachableFromNode(NodeType* pNode) {
+ if (!pNode)
+ return false;
+ if (pNode == m_pRoot)
+ return true;
+ return RootReachableFromNode(TraverseStrategy::GetParent(pNode));
+ }
+
+ NodeType* ParentWithinSubtree(NodeType* pNode) {
+ if (!pNode || pNode == m_pRoot)
+ return nullptr;
+ return TraverseStrategy::GetParent(pNode);
+ }
+
+ NodeType* NextSiblingWithinSubtree(NodeType* pNode) {
+ if (pNode == m_pRoot)
+ return nullptr;
+ return TraverseStrategy::GetNextSibling(pNode);
+ }
+
+ NodeType* PreviousSiblingWithinSubtree(NodeType* pNode) {
+ NodeType* pParent = ParentWithinSubtree(pNode);
+ if (!pParent)
+ return nullptr;
+ NodeType* pCurrent = TraverseStrategy::GetFirstChild(pParent);
+ NodeType* pPrevious = nullptr;
+ while (pCurrent != pNode) {
+ pPrevious = pCurrent;
+ pCurrent = TraverseStrategy::GetNextSibling(pCurrent);
+ }
+ return pPrevious;
+ }
+
+ NodeType* LastChild(NodeType* pNode) {
+ NodeType* pPrevious = nullptr;
+ NodeType* pChild = TraverseStrategy::GetFirstChild(pNode);
+ while (pChild) {
+ pPrevious = pChild;
+ pChild = NextSiblingWithinSubtree(pChild);
}
- return GetCurrent();
+ return pPrevious;
+ }
+
+ NodeType* LastDescendant(NodeType* pNode) {
+ NodeType* pChild = LastChild(pNode);
+ return pChild ? LastDescendant(pChild) : pNode;
}
- protected:
NodeType* m_pRoot;
- CFX_StackTemplate<NodeType*> m_NodeStack;
+ NodeType* m_pCurrent;
};
CXFA_LocaleValue XFA_GetLocaleValue(CXFA_WidgetData* pWidgetData);
-FX_DOUBLE XFA_ByteStringToDouble(const CFX_ByteStringC& szStringVal);
+double XFA_ByteStringToDouble(const CFX_ByteStringC& szStringVal);
int32_t XFA_MapRotation(int32_t nRotation);
bool XFA_RecognizeRichText(CFDE_XMLElement* pRichTextXMLNode);
@@ -175,7 +156,7 @@ void XFA_DataExporter_DealWithDataGroupNode(CXFA_Node* pDataNode);
void XFA_DataExporter_RegenerateFormFile(
CXFA_Node* pNode,
const CFX_RetainPtr<IFGAS_Stream>& pStream,
- const FX_CHAR* pChecksum = nullptr,
+ const char* pChecksum = nullptr,
bool bSaveXML = false);
const XFA_NOTSUREATTRIBUTE* XFA_GetNotsureAttribute(
diff --git a/chromium/third_party/pdfium/xfa/fxfa/parser/xfa_utils_unittest.cpp b/chromium/third_party/pdfium/xfa/fxfa/parser/xfa_utils_unittest.cpp
index 93ee3b94aa9..e4dd09419e3 100644
--- a/chromium/third_party/pdfium/xfa/fxfa/parser/xfa_utils_unittest.cpp
+++ b/chromium/third_party/pdfium/xfa/fxfa/parser/xfa_utils_unittest.cpp
@@ -2,10 +2,18 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "testing/gtest/include/gtest/gtest.h"
#include "xfa/fxfa/parser/xfa_utils.h"
-TEST(XfaUtilsImp, XFA_MapRotation) {
+#include <memory>
+#include <vector>
+
+#include "testing/gtest/include/gtest/gtest.h"
+#include "testing/test_support.h"
+#include "third_party/base/ptr_util.h"
+
+class XfaUtilsImpTest : public pdfium::FPDF_Test {};
+
+TEST_F(XfaUtilsImpTest, XFA_MapRotation) {
struct TestCase {
int input;
int expected_output;
@@ -20,3 +28,248 @@ TEST(XfaUtilsImp, XFA_MapRotation) {
XFA_MapRotation(TestCases[i].input));
}
}
+
+class XFANodeIteratorTest : public pdfium::FPDF_Test {
+ public:
+ class Node {
+ public:
+ class Strategy {
+ public:
+ static Node* GetFirstChild(Node* pNode) {
+ return pNode && !pNode->children_.empty() ? pNode->children_.front()
+ : nullptr;
+ }
+ static Node* GetNextSibling(Node* pNode) {
+ return pNode ? pNode->next_sibling_ : nullptr;
+ }
+ static Node* GetParent(Node* pNode) {
+ return pNode ? pNode->parent_ : nullptr;
+ }
+ };
+
+ explicit Node(Node* parent) : parent_(parent), next_sibling_(nullptr) {
+ if (parent) {
+ if (!parent->children_.empty())
+ parent->children_.back()->next_sibling_ = this;
+ parent->children_.push_back(this);
+ }
+ }
+
+ private:
+ Node* parent_;
+ Node* next_sibling_;
+ std::vector<Node*> children_;
+ };
+
+ using Iterator = CXFA_NodeIteratorTemplate<Node, Node::Strategy>;
+
+ // Builds a tree along the lines of:
+ //
+ // root
+ // |
+ // child1--child2
+ // |
+ // child3------------child7--child9
+ // | |
+ // child4--child6 child8
+ // |
+ // child5
+ //
+ void SetUp() override {
+ root_ = pdfium::MakeUnique<Node>(nullptr);
+ child1_ = pdfium::MakeUnique<Node>(root_.get());
+ child2_ = pdfium::MakeUnique<Node>(root_.get());
+ child3_ = pdfium::MakeUnique<Node>(child2_.get());
+ child4_ = pdfium::MakeUnique<Node>(child3_.get());
+ child5_ = pdfium::MakeUnique<Node>(child4_.get());
+ child6_ = pdfium::MakeUnique<Node>(child3_.get());
+ child7_ = pdfium::MakeUnique<Node>(child2_.get());
+ child8_ = pdfium::MakeUnique<Node>(child7_.get());
+ child9_ = pdfium::MakeUnique<Node>(child2_.get());
+ }
+
+ Node* root() const { return root_.get(); }
+ Node* child1() const { return child1_.get(); }
+ Node* child2() const { return child2_.get(); }
+ Node* child3() const { return child3_.get(); }
+ Node* child4() const { return child4_.get(); }
+ Node* child5() const { return child5_.get(); }
+ Node* child6() const { return child6_.get(); }
+ Node* child7() const { return child7_.get(); }
+ Node* child8() const { return child8_.get(); }
+ Node* child9() const { return child9_.get(); }
+
+ protected:
+ std::unique_ptr<Node> root_;
+ std::unique_ptr<Node> child1_;
+ std::unique_ptr<Node> child2_;
+ std::unique_ptr<Node> child3_;
+ std::unique_ptr<Node> child4_;
+ std::unique_ptr<Node> child5_;
+ std::unique_ptr<Node> child6_;
+ std::unique_ptr<Node> child7_;
+ std::unique_ptr<Node> child8_;
+ std::unique_ptr<Node> child9_;
+};
+
+TEST_F(XFANodeIteratorTest, Empty) {
+ Iterator iter(nullptr);
+ EXPECT_EQ(nullptr, iter.GetRoot());
+ EXPECT_EQ(nullptr, iter.GetCurrent());
+ EXPECT_EQ(nullptr, iter.MoveToNext());
+ EXPECT_EQ(nullptr, iter.MoveToPrev());
+ EXPECT_EQ(nullptr, iter.SkipChildrenAndMoveToNext());
+}
+
+TEST_F(XFANodeIteratorTest, Root) {
+ Iterator iter(root());
+ EXPECT_EQ(root(), iter.GetRoot());
+ EXPECT_EQ(root(), iter.GetCurrent());
+}
+
+TEST_F(XFANodeIteratorTest, Current) {
+ Iterator iter(root());
+ iter.SetCurrent(child1());
+ EXPECT_EQ(root(), iter.GetRoot());
+ EXPECT_EQ(child1(), iter.GetCurrent());
+}
+
+TEST_F(XFANodeIteratorTest, CurrentOutsideRootDisallowed) {
+ Iterator iter(child1());
+ iter.SetCurrent(root());
+ EXPECT_EQ(child1(), iter.GetRoot());
+ EXPECT_EQ(nullptr, iter.GetCurrent());
+}
+
+TEST_F(XFANodeIteratorTest, CurrentNull) {
+ Iterator iter(root());
+ EXPECT_EQ(child1(), iter.MoveToNext());
+
+ iter.SetCurrent(nullptr);
+ EXPECT_EQ(nullptr, iter.GetCurrent());
+
+ EXPECT_EQ(nullptr, iter.MoveToNext());
+ EXPECT_EQ(nullptr, iter.GetCurrent());
+}
+
+TEST_F(XFANodeIteratorTest, MoveToPrev) {
+ Iterator iter(root());
+ iter.SetCurrent(child9());
+
+ EXPECT_EQ(child8(), iter.MoveToPrev());
+ EXPECT_EQ(child8(), iter.GetCurrent());
+
+ EXPECT_EQ(child7(), iter.MoveToPrev());
+ EXPECT_EQ(child7(), iter.GetCurrent());
+
+ EXPECT_EQ(child6(), iter.MoveToPrev());
+ EXPECT_EQ(child6(), iter.GetCurrent());
+
+ EXPECT_EQ(child5(), iter.MoveToPrev());
+ EXPECT_EQ(child5(), iter.GetCurrent());
+
+ EXPECT_EQ(child4(), iter.MoveToPrev());
+ EXPECT_EQ(child4(), iter.GetCurrent());
+
+ EXPECT_EQ(child3(), iter.MoveToPrev());
+ EXPECT_EQ(child3(), iter.GetCurrent());
+
+ EXPECT_EQ(child2(), iter.MoveToPrev());
+ EXPECT_EQ(child2(), iter.GetCurrent());
+
+ EXPECT_EQ(child1(), iter.MoveToPrev());
+ EXPECT_EQ(child1(), iter.GetCurrent());
+
+ EXPECT_EQ(root(), iter.MoveToPrev());
+ EXPECT_EQ(root(), iter.GetCurrent());
+
+ EXPECT_EQ(nullptr, iter.MoveToPrev());
+ EXPECT_EQ(root(), iter.GetCurrent());
+
+ EXPECT_EQ(nullptr, iter.MoveToPrev());
+ EXPECT_EQ(root(), iter.GetCurrent());
+}
+
+TEST_F(XFANodeIteratorTest, MoveToNext) {
+ Iterator iter(root());
+ iter.SetCurrent(child2());
+
+ EXPECT_EQ(child3(), iter.MoveToNext());
+ EXPECT_EQ(child3(), iter.GetCurrent());
+
+ EXPECT_EQ(child4(), iter.MoveToNext());
+ EXPECT_EQ(child4(), iter.GetCurrent());
+
+ EXPECT_EQ(child5(), iter.MoveToNext());
+ EXPECT_EQ(child5(), iter.GetCurrent());
+
+ EXPECT_EQ(child6(), iter.MoveToNext());
+ EXPECT_EQ(child6(), iter.GetCurrent());
+
+ EXPECT_EQ(child7(), iter.MoveToNext());
+ EXPECT_EQ(child7(), iter.GetCurrent());
+
+ EXPECT_EQ(child8(), iter.MoveToNext());
+ EXPECT_EQ(child8(), iter.GetCurrent());
+
+ EXPECT_EQ(child9(), iter.MoveToNext());
+ EXPECT_EQ(child9(), iter.GetCurrent());
+
+ EXPECT_EQ(nullptr, iter.MoveToNext());
+ EXPECT_EQ(nullptr, iter.GetCurrent());
+
+ EXPECT_EQ(nullptr, iter.MoveToNext());
+ EXPECT_EQ(nullptr, iter.GetCurrent());
+}
+
+TEST_F(XFANodeIteratorTest, SkipChildrenAndMoveToNext) {
+ Iterator iter(root());
+ iter.SetCurrent(child3());
+ EXPECT_EQ(child7(), iter.SkipChildrenAndMoveToNext());
+ EXPECT_EQ(child9(), iter.SkipChildrenAndMoveToNext());
+ EXPECT_EQ(nullptr, iter.SkipChildrenAndMoveToNext());
+}
+
+TEST_F(XFANodeIteratorTest, BackAndForth) {
+ Iterator iter(root());
+ EXPECT_EQ(child1(), iter.MoveToNext());
+ EXPECT_EQ(child2(), iter.MoveToNext());
+ EXPECT_EQ(child3(), iter.MoveToNext());
+ EXPECT_EQ(child4(), iter.MoveToNext());
+ EXPECT_EQ(child5(), iter.MoveToNext());
+ EXPECT_EQ(child4(), iter.MoveToPrev());
+ EXPECT_EQ(child3(), iter.MoveToPrev());
+ EXPECT_EQ(child2(), iter.MoveToPrev());
+ EXPECT_EQ(child1(), iter.MoveToPrev());
+}
+
+TEST_F(XFANodeIteratorTest, NextFromBeforeTheBeginning) {
+ Iterator iter(root());
+ EXPECT_EQ(nullptr, iter.MoveToPrev());
+ EXPECT_EQ(root(), iter.GetCurrent());
+ EXPECT_EQ(child1(), iter.MoveToNext());
+}
+
+TEST_F(XFANodeIteratorTest, PrevFromAfterTheEnd) {
+ Iterator iter(root());
+ iter.SetCurrent(child9());
+ EXPECT_EQ(nullptr, iter.MoveToNext());
+ EXPECT_EQ(child9(), iter.MoveToPrev());
+}
+
+TEST_F(XFANodeIteratorTest, ChildAsRootPrev) {
+ Iterator iter(child3());
+ EXPECT_EQ(nullptr, iter.MoveToPrev());
+
+ iter.SetCurrent(child4());
+ EXPECT_EQ(child3(), iter.MoveToPrev());
+ EXPECT_EQ(nullptr, iter.MoveToPrev());
+}
+
+TEST_F(XFANodeIteratorTest, ChildAsRootNext) {
+ Iterator iter(child3());
+ iter.SetCurrent(child4());
+ EXPECT_EQ(child5(), iter.MoveToNext());
+ EXPECT_EQ(child6(), iter.MoveToNext());
+ EXPECT_EQ(nullptr, iter.MoveToNext());
+}
diff --git a/chromium/third_party/pdfium/xfa/fxfa/xfa_checksum.h b/chromium/third_party/pdfium/xfa/fxfa/xfa_checksum.h
deleted file mode 100644
index 31cf1015535..00000000000
--- a/chromium/third_party/pdfium/xfa/fxfa/xfa_checksum.h
+++ /dev/null
@@ -1,80 +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 XFA_FXFA_XFA_CHECKSUM_H_
-#define XFA_FXFA_XFA_CHECKSUM_H_
-
-#include <memory>
-
-#include "core/fdrm/crypto/fx_crypt.h"
-#include "xfa/fde/xml/cfx_saxreader.h"
-#include "xfa/fxfa/fxfa.h"
-
-class CXFA_SAXReaderHandler;
-class CXFA_ChecksumContext;
-
-class CXFA_SAXContext {
- public:
- CXFA_SAXContext() : m_eNode(CFX_SAXItem::Type::Unknown) {}
-
- CFX_ByteTextBuf m_TextBuf;
- CFX_ByteString m_bsTagName;
- CFX_SAXItem::Type m_eNode;
-};
-
-class CXFA_SAXReaderHandler {
- public:
- explicit CXFA_SAXReaderHandler(CXFA_ChecksumContext* pContext);
- ~CXFA_SAXReaderHandler();
-
- CXFA_SAXContext* OnTagEnter(const CFX_ByteStringC& bsTagName,
- CFX_SAXItem::Type eType,
- uint32_t dwStartPos);
- void OnTagAttribute(CXFA_SAXContext* pTag,
- const CFX_ByteStringC& bsAttri,
- const CFX_ByteStringC& bsValue);
- void OnTagBreak(CXFA_SAXContext* pTag);
- void OnTagData(CXFA_SAXContext* pTag,
- CFX_SAXItem::Type eType,
- const CFX_ByteStringC& bsData,
- uint32_t dwStartPos);
- void OnTagClose(CXFA_SAXContext* pTag, uint32_t dwEndPos);
- void OnTagEnd(CXFA_SAXContext* pTag,
- const CFX_ByteStringC& bsTagName,
- uint32_t dwEndPos);
-
- void OnTargetData(CXFA_SAXContext* pTag,
- CFX_SAXItem::Type eType,
- const CFX_ByteStringC& bsData,
- uint32_t dwStartPos);
-
- protected:
- void UpdateChecksum(bool bCheckSpace);
-
- CXFA_ChecksumContext* m_pContext;
- CXFA_SAXContext m_SAXContext;
-};
-
-class CXFA_ChecksumContext {
- public:
- CXFA_ChecksumContext();
- ~CXFA_ChecksumContext();
-
- void StartChecksum();
- void Update(const CFX_ByteStringC& bsText);
- bool UpdateChecksum(const CFX_RetainPtr<IFX_SeekableReadStream>& pSrcFile,
- FX_FILESIZE offset = 0,
- size_t size = 0);
- void FinishChecksum();
- CFX_ByteString GetChecksum() const;
-
- protected:
- std::unique_ptr<CFX_SAXReader> m_pSAXReader;
- std::unique_ptr<CRYPT_sha1_context> m_pByteContext;
- CFX_ByteString m_bsChecksum;
-};
-
-#endif // XFA_FXFA_XFA_CHECKSUM_H_
diff --git a/chromium/third_party/pdfium/xfa/fxfa/xfa_ffapp.h b/chromium/third_party/pdfium/xfa/fxfa/xfa_ffapp.h
deleted file mode 100644
index 411fd2d273b..00000000000
--- a/chromium/third_party/pdfium/xfa/fxfa/xfa_ffapp.h
+++ /dev/null
@@ -1,86 +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 XFA_FXFA_XFA_FFAPP_H_
-#define XFA_FXFA_XFA_FFAPP_H_
-
-#include <memory>
-#include <vector>
-
-#include "core/fpdfapi/parser/cpdf_stream.h"
-#include "core/fpdfapi/parser/cpdf_stream_acc.h"
-#include "core/fxcrt/cfx_retain_ptr.h"
-#include "xfa/fgas/font/cfgas_fontmgr.h"
-#include "xfa/fwl/cfwl_app.h"
-#include "xfa/fxfa/fxfa.h"
-
-class CXFA_DefFontMgr;
-class CXFA_FWLAdapterWidgetMgr;
-class CXFA_FWLTheme;
-class CXFA_FFDocHandler;
-class CXFA_FontMgr;
-class IFWL_AdapterTimerMgr;
-class CFWL_WidgetMgrDelegate;
-
-// Layering prevents fxcrt from knowing about CPDF_Streams; this could go
-// in fpdfsdk, but it is XFA-Only.
-CFX_RetainPtr<IFX_SeekableReadStream> MakeSeekableReadStream(
- const std::vector<CPDF_Stream*>& streams);
-
-class CXFA_FFApp {
- public:
- explicit CXFA_FFApp(IXFA_AppProvider* pProvider);
- ~CXFA_FFApp();
-
- std::unique_ptr<CXFA_FFDoc> CreateDoc(IXFA_DocEnvironment* pDocEnvironment,
- CPDF_Document* pPDFDoc);
- void SetDefaultFontMgr(std::unique_ptr<CXFA_DefFontMgr> pFontMgr);
-
- CXFA_FFDocHandler* GetDocHandler();
- CXFA_FWLAdapterWidgetMgr* GetWidgetMgr(CFWL_WidgetMgrDelegate* pDelegate);
- CFGAS_FontMgr* GetFDEFontMgr();
- CXFA_FWLTheme* GetFWLTheme();
-
- IXFA_AppProvider* GetAppProvider() const { return m_pProvider; }
- const CFWL_App* GetFWLApp() const { return m_pFWLApp.get(); }
- IFWL_AdapterTimerMgr* GetTimerMgr() const;
- CXFA_FontMgr* GetXFAFontMgr() const;
- CFWL_WidgetMgrDelegate* GetWidgetMgrDelegate() const {
- return m_pWidgetMgrDelegate;
- }
-
- void ClearEventTargets();
-
- protected:
- std::unique_ptr<CXFA_FFDocHandler> m_pDocHandler;
- IXFA_AppProvider* const m_pProvider;
-
- // The fonts stored in the font manager may have been created by the default
- // font manager. The GEFont::LoadFont call takes the manager as a param and
- // stores it internally. When you destroy the GEFont it tries to unregister
- // from the font manager and if the default font manager was destroyed first
- // get get a use-after-free. The m_pFWLTheme can try to cleanup a GEFont
- // when it frees, so make sure it gets cleaned up first. That requires
- // m_pFWLApp to be cleaned up as well.
- //
- // TODO(dsinclair): The GEFont should have the FontMgr as the pointer instead
- // of the DEFFontMgr so this goes away. Bug 561.
- std::unique_ptr<CFGAS_FontMgr> m_pFDEFontMgr;
- std::unique_ptr<CXFA_FontMgr> m_pFontMgr;
-
-#if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
- std::unique_ptr<CFX_FontSourceEnum_File> m_pFontSource;
-#endif
- std::unique_ptr<CXFA_FWLAdapterWidgetMgr> m_pAdapterWidgetMgr;
- CFWL_WidgetMgrDelegate* m_pWidgetMgrDelegate; // not owned.
-
- // |m_pFWLApp| has to be released first, then |m_pFWLTheme| since the former
- // may refers to theme manager and the latter refers to font manager.
- std::unique_ptr<CXFA_FWLTheme> m_pFWLTheme;
- std::unique_ptr<CFWL_App> m_pFWLApp;
-};
-
-#endif // XFA_FXFA_XFA_FFAPP_H_
diff --git a/chromium/third_party/pdfium/xfa/fxfa/xfa_ffdoc.h b/chromium/third_party/pdfium/xfa/fxfa/xfa_ffdoc.h
deleted file mode 100644
index 44079704e7b..00000000000
--- a/chromium/third_party/pdfium/xfa/fxfa/xfa_ffdoc.h
+++ /dev/null
@@ -1,74 +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 XFA_FXFA_XFA_FFDOC_H_
-#define XFA_FXFA_XFA_FFDOC_H_
-
-#include <map>
-#include <memory>
-
-#include "xfa/fxfa/fxfa.h"
-#include "xfa/fxfa/parser/cxfa_document.h"
-#include "xfa/fxfa/parser/cxfa_document_parser.h"
-
-class CXFA_ChecksumContext;
-class CXFA_FFApp;
-class CXFA_FFNotify;
-class CXFA_FFDocView;
-
-struct FX_IMAGEDIB_AND_DPI {
- CFX_DIBSource* pDibSource;
- int32_t iImageXDpi;
- int32_t iImageYDpi;
-};
-
-class CXFA_FFDoc {
- public:
- CXFA_FFDoc(CXFA_FFApp* pApp, IXFA_DocEnvironment* pDocEnvironment);
- ~CXFA_FFDoc();
-
- IXFA_DocEnvironment* GetDocEnvironment() const { return m_pDocEnvironment; }
- uint32_t GetDocType();
- void SetDocType(uint32_t dwType);
-
- int32_t StartLoad();
- int32_t DoLoad(IFX_Pause* pPause = nullptr);
- void StopLoad();
-
- CXFA_FFDocView* CreateDocView(uint32_t dwView = 0);
-
- bool OpenDoc(const CFX_RetainPtr<IFX_SeekableReadStream>& pStream);
- bool OpenDoc(CPDF_Document* pPDFDoc);
- bool CloseDoc();
-
- CXFA_Document* GetXFADoc() { return m_pDocumentParser->GetDocument(); }
- CXFA_FFApp* GetApp() { return m_pApp; }
- CXFA_FFDocView* GetDocView(CXFA_LayoutProcessor* pLayout);
- CXFA_FFDocView* GetDocView();
- CPDF_Document* GetPDFDoc();
- CFX_DIBitmap* GetPDFNamedImage(const CFX_WideStringC& wsName,
- int32_t& iImageXDpi,
- int32_t& iImageYDpi);
-
- bool SavePackage(XFA_HashCode code,
- const CFX_RetainPtr<IFX_SeekableWriteStream>& pFile,
- CXFA_ChecksumContext* pCSContext);
- bool ImportData(const CFX_RetainPtr<IFX_SeekableReadStream>& pStream,
- bool bXDP = true);
-
- protected:
- IXFA_DocEnvironment* const m_pDocEnvironment;
- std::unique_ptr<CXFA_DocumentParser> m_pDocumentParser;
- CFX_RetainPtr<IFX_SeekableReadStream> m_pStream;
- CXFA_FFApp* m_pApp;
- std::unique_ptr<CXFA_FFNotify> m_pNotify;
- CPDF_Document* m_pPDFDoc;
- std::map<uint32_t, FX_IMAGEDIB_AND_DPI> m_HashToDibDpiMap;
- std::map<uint32_t, std::unique_ptr<CXFA_FFDocView>> m_TypeToDocViewMap;
- uint32_t m_dwDocType;
-};
-
-#endif // XFA_FXFA_XFA_FFDOC_H_
diff --git a/chromium/third_party/pdfium/xfa/fxfa/xfa_ffdochandler.h b/chromium/third_party/pdfium/xfa/fxfa/xfa_ffdochandler.h
deleted file mode 100644
index 0e4f71786ca..00000000000
--- a/chromium/third_party/pdfium/xfa/fxfa/xfa_ffdochandler.h
+++ /dev/null
@@ -1,31 +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 XFA_FXFA_XFA_FFDOCHANDLER_H_
-#define XFA_FXFA_XFA_FFDOCHANDLER_H_
-
-#include "xfa/fxfa/fxfa.h"
-
-class CXFA_ChecksumContext;
-
-class CXFA_FFDocHandler {
- public:
- CXFA_FFDocHandler();
- ~CXFA_FFDocHandler();
-
- CFXJSE_Value* GetXFAScriptObject(CXFA_FFDoc* hDoc);
- XFA_ATTRIBUTEENUM GetRestoreState(CXFA_FFDoc* hDoc);
-
- bool RunDocScript(CXFA_FFDoc* hDoc,
- XFA_SCRIPTTYPE eScriptType,
- const CFX_WideStringC& wsScript,
- CFXJSE_Value* pRetValue,
- CFXJSE_Value* pThisObject);
-
- protected:
-};
-
-#endif // XFA_FXFA_XFA_FFDOCHANDLER_H_
diff --git a/chromium/third_party/pdfium/xfa/fxfa/xfa_ffdocview.h b/chromium/third_party/pdfium/xfa/fxfa/xfa_ffdocview.h
deleted file mode 100644
index d8df8b4312d..00000000000
--- a/chromium/third_party/pdfium/xfa/fxfa/xfa_ffdocview.h
+++ /dev/null
@@ -1,153 +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 XFA_FXFA_XFA_FFDOCVIEW_H_
-#define XFA_FXFA_XFA_FFDOCVIEW_H_
-
-#include <map>
-#include <memory>
-#include <vector>
-
-#include "xfa/fxfa/cxfa_eventparam.h"
-#include "xfa/fxfa/xfa_ffdoc.h"
-
-class CXFA_FFWidgetHandler;
-class CXFA_FFDoc;
-class CXFA_FFWidget;
-class CXFA_WidgetAccIterator;
-
-extern const XFA_ATTRIBUTEENUM gs_EventActivity[];
-enum XFA_DOCVIEW_LAYOUTSTATUS {
- XFA_DOCVIEW_LAYOUTSTATUS_None,
- XFA_DOCVIEW_LAYOUTSTATUS_Start,
- XFA_DOCVIEW_LAYOUTSTATUS_FormInitialize,
- XFA_DOCVIEW_LAYOUTSTATUS_FormInitCalculate,
- XFA_DOCVIEW_LAYOUTSTATUS_FormInitValidate,
- XFA_DOCVIEW_LAYOUTSTATUS_FormFormReady,
- XFA_DOCVIEW_LAYOUTSTATUS_Doing,
- XFA_DOCVIEW_LAYOUTSTATUS_PagesetInitialize,
- XFA_DOCVIEW_LAYOUTSTATUS_PagesetInitCalculate,
- XFA_DOCVIEW_LAYOUTSTATUS_PagesetInitValidate,
- XFA_DOCVIEW_LAYOUTSTATUS_PagesetFormReady,
- XFA_DOCVIEW_LAYOUTSTATUS_LayoutReady,
- XFA_DOCVIEW_LAYOUTSTATUS_DocReady,
- XFA_DOCVIEW_LAYOUTSTATUS_End
-};
-class CXFA_FFDocView {
- public:
- explicit CXFA_FFDocView(CXFA_FFDoc* pDoc);
- ~CXFA_FFDocView();
-
- CXFA_FFDoc* GetDoc() { return m_pDoc; }
- int32_t StartLayout(int32_t iStartPage = 0);
- int32_t DoLayout(IFX_Pause* pPause);
- void StopLayout();
- int32_t GetLayoutStatus();
- void UpdateDocView();
- int32_t CountPageViews();
- CXFA_FFPageView* GetPageView(int32_t nIndex);
-
- void ResetWidgetData(CXFA_WidgetAcc* pWidgetAcc);
- int32_t ProcessWidgetEvent(CXFA_EventParam* pParam,
- CXFA_WidgetAcc* pWidgetAcc);
- CXFA_FFWidgetHandler* GetWidgetHandler();
- CXFA_WidgetAccIterator* CreateWidgetAccIterator(
- XFA_WIDGETORDER eOrder = XFA_WIDGETORDER_PreOrder);
- CXFA_FFWidget* GetFocusWidget();
- void KillFocus();
- bool SetFocus(CXFA_FFWidget* hWidget);
- CXFA_FFWidget* GetWidgetByName(const CFX_WideString& wsName,
- CXFA_FFWidget* pRefWidget);
- CXFA_WidgetAcc* GetWidgetAccByName(const CFX_WideString& wsName,
- CXFA_WidgetAcc* pRefWidgetAcc);
- CXFA_LayoutProcessor* GetXFALayout() const;
- void OnPageEvent(CXFA_ContainerLayoutItem* pSender, uint32_t dwEvent);
- void LockUpdate();
- void UnlockUpdate();
- bool IsUpdateLocked();
- void ClearInvalidateList();
- void AddInvalidateRect(CXFA_FFWidget* pWidget, const CFX_RectF& rtInvalidate);
- void AddInvalidateRect(CXFA_FFPageView* pPageView,
- const CFX_RectF& rtInvalidate);
- void RunInvalidate();
- void RunDocClose();
- void DestroyDocView();
-
- bool InitValidate(CXFA_Node* pNode);
- bool RunValidate();
-
- void SetChangeMark();
-
- void AddValidateWidget(CXFA_WidgetAcc* pWidget);
- void AddCalculateNodeNotify(CXFA_Node* pNodeChange);
- void AddCalculateWidgetAcc(CXFA_WidgetAcc* pWidgetAcc);
- int32_t RunCalculateWidgets();
- bool IsStaticNotify();
- bool RunLayout();
- void RunSubformIndexChange();
- void AddNewFormNode(CXFA_Node* pNode);
- void AddIndexChangedSubform(CXFA_Node* pNode);
- CXFA_WidgetAcc* GetFocusWidgetAcc();
- void SetFocusWidgetAcc(CXFA_WidgetAcc* pWidgetAcc);
- void DeleteLayoutItem(CXFA_FFWidget* pWidget);
- int32_t ExecEventActivityByDeepFirst(CXFA_Node* pFormNode,
- XFA_EVENTTYPE eEventType,
- bool bIsFormReady,
- bool bRecursive,
- CXFA_Node* pExclude);
- bool m_bLayoutEvent;
- std::vector<CFX_WideString> m_arrNullTestMsg;
- CXFA_FFWidget* m_pListFocusWidget;
- bool m_bInLayoutStatus;
-
- protected:
- bool RunEventLayoutReady();
- void RunBindItems();
- bool InitCalculate(CXFA_Node* pNode);
- void InitLayout(CXFA_Node* pNode);
- void RunCalculateRecursive(int32_t& iIndex);
- void ShowNullTestMsg();
- bool ResetSingleWidgetAccData(CXFA_WidgetAcc* pWidgetAcc);
- CXFA_Node* GetRootSubform();
-
- CXFA_FFDoc* const m_pDoc;
- std::unique_ptr<CXFA_FFWidgetHandler> m_pWidgetHandler;
- CXFA_LayoutProcessor* m_pXFADocLayout; // not owned.
- CXFA_WidgetAcc* m_pFocusAcc; // not owned.
- CXFA_FFWidget* m_pFocusWidget; // not owned.
- CXFA_FFWidget* m_pOldFocusWidget; // not owned.
- std::map<CXFA_FFPageView*, std::unique_ptr<CFX_RectF>> m_mapPageInvalidate;
- std::vector<CXFA_WidgetAcc*> m_ValidateAccs;
- std::vector<CXFA_WidgetAcc*> m_CalculateAccs;
- std::vector<CXFA_Node*> m_BindItems;
- std::vector<CXFA_Node*> m_NewAddedNodes;
- std::vector<CXFA_Node*> m_IndexChangedSubforms;
- XFA_DOCVIEW_LAYOUTSTATUS m_iStatus;
- int32_t m_iLock;
- friend class CXFA_FFNotify;
-};
-
-class CXFA_WidgetAccIterator {
- public:
- CXFA_WidgetAccIterator(CXFA_FFDocView* pDocView, CXFA_Node* pTravelRoot);
- ~CXFA_WidgetAccIterator();
-
- void Reset();
- CXFA_WidgetAcc* MoveToFirst();
- CXFA_WidgetAcc* MoveToLast();
- CXFA_WidgetAcc* MoveToNext();
- CXFA_WidgetAcc* MoveToPrevious();
- CXFA_WidgetAcc* GetCurrentWidgetAcc();
- bool SetCurrentWidgetAcc(CXFA_WidgetAcc* hWidget);
- void SkipTree();
-
- protected:
- CXFA_ContainerIterator m_ContentIterator;
- CXFA_FFDocView* const m_pDocView;
- CXFA_WidgetAcc* m_pCurWidgetAcc; // not owned.
-};
-
-#endif // XFA_FXFA_XFA_FFDOCVIEW_H_
diff --git a/chromium/third_party/pdfium/xfa/fxfa/xfa_ffpageview.h b/chromium/third_party/pdfium/xfa/fxfa/xfa_ffpageview.h
deleted file mode 100644
index 4b50a2365db..00000000000
--- a/chromium/third_party/pdfium/xfa/fxfa/xfa_ffpageview.h
+++ /dev/null
@@ -1,107 +0,0 @@
-// Copyrig 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 XFA_FXFA_XFA_FFPAGEVIEW_H_
-#define XFA_FXFA_XFA_FFPAGEVIEW_H_
-
-#include <vector>
-
-#include "xfa/fxfa/parser/cxfa_containerlayoutitem.h"
-#include "xfa/fxfa/parser/cxfa_contentlayoutitem.h"
-#include "xfa/fxfa/parser/cxfa_traversestrategy_layoutitem.h"
-
-class CXFA_FFWidget;
-class CXFA_FFDocView;
-
-class CXFA_FFPageView : public CXFA_ContainerLayoutItem {
- public:
- CXFA_FFPageView(CXFA_FFDocView* pDocView, CXFA_Node* pPageArea);
- ~CXFA_FFPageView() override;
-
- CXFA_FFDocView* GetDocView() const;
- CFX_RectF GetPageViewRect() const;
- CFX_Matrix GetDisplayMatrix(const CFX_Rect& rtDisp, int32_t iRotate) const;
- IXFA_WidgetIterator* CreateWidgetIterator(
- uint32_t dwTraverseWay = XFA_TRAVERSEWAY_Form,
- uint32_t dwWidgetFilter = XFA_WidgetStatus_Visible |
- XFA_WidgetStatus_Viewable);
-
- protected:
- CXFA_FFDocView* const m_pDocView;
-};
-
-typedef CXFA_NodeIteratorTemplate<CXFA_LayoutItem,
- CXFA_TraverseStrategy_LayoutItem>
- CXFA_LayoutItemIterator;
-
-class CXFA_FFPageWidgetIterator : public IXFA_WidgetIterator {
- public:
- CXFA_FFPageWidgetIterator(CXFA_FFPageView* pPageView, uint32_t dwFilter);
- ~CXFA_FFPageWidgetIterator() override;
-
- void Reset() override;
- CXFA_FFWidget* MoveToFirst() override;
- CXFA_FFWidget* MoveToLast() override;
- CXFA_FFWidget* MoveToNext() override;
- CXFA_FFWidget* MoveToPrevious() override;
- CXFA_FFWidget* GetCurrentWidget() override;
- bool SetCurrentWidget(CXFA_FFWidget* hWidget) override;
-
- protected:
- CXFA_FFWidget* GetWidget(CXFA_LayoutItem* pLayoutItem);
-
- CXFA_FFPageView* m_pPageView;
- CXFA_FFWidget* m_hCurWidget;
- uint32_t m_dwFilter;
- bool m_bIgnorerelevant;
- CXFA_LayoutItemIterator m_sIterator;
-};
-
-class CXFA_TabParam {
- public:
- CXFA_TabParam();
- ~CXFA_TabParam();
-
- CXFA_FFWidget* m_pWidget;
- std::vector<CXFA_FFWidget*> m_Children;
-};
-
-class CXFA_FFTabOrderPageWidgetIterator : public IXFA_WidgetIterator {
- public:
- CXFA_FFTabOrderPageWidgetIterator(CXFA_FFPageView* pPageView,
- uint32_t dwFilter);
- ~CXFA_FFTabOrderPageWidgetIterator() override;
-
- void Reset() override;
- CXFA_FFWidget* MoveToFirst() override;
- CXFA_FFWidget* MoveToLast() override;
- CXFA_FFWidget* MoveToNext() override;
- CXFA_FFWidget* MoveToPrevious() override;
- CXFA_FFWidget* GetCurrentWidget() override;
- bool SetCurrentWidget(CXFA_FFWidget* hWidget) override;
-
- protected:
- CXFA_FFWidget* GetTraverseWidget(CXFA_FFWidget* pWidget);
- CXFA_FFWidget* FindWidgetByName(const CFX_WideString& wsWidgetName,
- CXFA_FFWidget* pRefWidget);
- void CreateTabOrderWidgetArray();
- void CreateSpaceOrderWidgetArray(std::vector<CXFA_FFWidget*>* WidgetArray);
- CXFA_FFWidget* GetWidget(CXFA_LayoutItem* pLayoutItem);
- void OrderContainer(CXFA_LayoutItemIterator* sIterator,
- CXFA_LayoutItem* pContainerItem,
- CXFA_TabParam* pContainer,
- bool& bCurrentItem,
- bool& bContentArea,
- bool bMarsterPage = false);
-
- std::vector<CXFA_FFWidget*> m_TabOrderWidgetArray;
- CXFA_FFPageView* m_pPageView;
- uint32_t m_dwFilter;
- int32_t m_iCurWidget;
- bool m_bIgnorerelevant;
-};
-
-#endif // XFA_FXFA_XFA_FFPAGEVIEW_H_
diff --git a/chromium/third_party/pdfium/xfa/fxfa/xfa_ffwidget.h b/chromium/third_party/pdfium/xfa/fxfa/xfa_ffwidget.h
deleted file mode 100644
index 5972b8ad70e..00000000000
--- a/chromium/third_party/pdfium/xfa/fxfa/xfa_ffwidget.h
+++ /dev/null
@@ -1,190 +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 XFA_FXFA_XFA_FFWIDGET_H_
-#define XFA_FXFA_XFA_FFWIDGET_H_
-
-#include <vector>
-
-#include "core/fxcodec/fx_codec_def.h"
-#include "core/fxge/cfx_graphstatedata.h"
-#include "xfa/fwl/cfwl_app.h"
-#include "xfa/fxfa/fxfa.h"
-#include "xfa/fxfa/parser/cxfa_contentlayoutitem.h"
-
-class CXFA_FFPageView;
-class CXFA_FFDocView;
-class CXFA_FFDoc;
-class CXFA_FFApp;
-enum class FWL_WidgetHit;
-
-inline FX_FLOAT XFA_UnitPx2Pt(FX_FLOAT fPx, FX_FLOAT fDpi) {
- return fPx * 72.0f / fDpi;
-}
-
-#define XFA_FLOAT_PERCISION 0.001f
-
-enum XFA_WIDGETITEM {
- XFA_WIDGETITEM_Parent,
- XFA_WIDGETITEM_FirstChild,
- XFA_WIDGETITEM_NextSibling,
- XFA_WIDGETITEM_PrevSibling,
-};
-
-class CXFA_CalcData {
- public:
- CXFA_CalcData();
- ~CXFA_CalcData();
-
- std::vector<CXFA_WidgetAcc*> m_Globals;
- int32_t m_iRefCount;
-};
-
-class CXFA_FFWidget : public CXFA_ContentLayoutItem {
- public:
- explicit CXFA_FFWidget(CXFA_WidgetAcc* pDataAcc);
- ~CXFA_FFWidget() override;
-
- virtual CFX_RectF GetBBox(uint32_t dwStatus, bool bDrawFocus = false);
- virtual void RenderWidget(CFX_Graphics* pGS,
- CFX_Matrix* pMatrix,
- uint32_t dwStatus);
- virtual bool IsLoaded();
- virtual bool LoadWidget();
- virtual void UnloadWidget();
- virtual bool PerformLayout();
- virtual bool UpdateFWLData();
- virtual void UpdateWidgetProperty();
- virtual bool OnMouseEnter();
- virtual bool OnMouseExit();
- virtual bool OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point);
- virtual bool OnLButtonUp(uint32_t dwFlags, const CFX_PointF& point);
- virtual bool OnLButtonDblClk(uint32_t dwFlags, const CFX_PointF& point);
- virtual bool OnMouseMove(uint32_t dwFlags, const CFX_PointF& point);
- virtual bool OnMouseWheel(uint32_t dwFlags,
- int16_t zDelta,
- const CFX_PointF& point);
- virtual bool OnRButtonDown(uint32_t dwFlags, const CFX_PointF& point);
- virtual bool OnRButtonUp(uint32_t dwFlags, const CFX_PointF& point);
- virtual bool OnRButtonDblClk(uint32_t dwFlags, const CFX_PointF& point);
-
- virtual bool OnSetFocus(CXFA_FFWidget* pOldWidget);
- virtual bool OnKillFocus(CXFA_FFWidget* pNewWidget);
- virtual bool OnKeyDown(uint32_t dwKeyCode, uint32_t dwFlags);
- virtual bool OnKeyUp(uint32_t dwKeyCode, uint32_t dwFlags);
- virtual bool OnChar(uint32_t dwChar, uint32_t dwFlags);
- virtual FWL_WidgetHit OnHitTest(const CFX_PointF& point);
- virtual bool OnSetCursor(const CFX_PointF& point);
- virtual bool CanUndo();
- virtual bool CanRedo();
- virtual bool Undo();
- virtual bool Redo();
- virtual bool CanCopy();
- virtual bool CanCut();
- virtual bool CanPaste();
- virtual bool CanSelectAll();
- virtual bool CanDelete();
- virtual bool CanDeSelect();
- virtual bool Copy(CFX_WideString& wsCopy);
- virtual bool Cut(CFX_WideString& wsCut);
- virtual bool Paste(const CFX_WideString& wsPaste);
- virtual void SelectAll();
- virtual void Delete();
- virtual void DeSelect();
- virtual bool GetSuggestWords(CFX_PointF pointf,
- std::vector<CFX_ByteString>& sSuggest);
- virtual bool ReplaceSpellCheckWord(CFX_PointF pointf,
- const CFX_ByteStringC& bsReplace);
-
- CXFA_FFPageView* GetPageView() const { return m_pPageView; }
- void SetPageView(CXFA_FFPageView* pPageView) { m_pPageView = pPageView; }
- CFX_RectF GetWidgetRect();
- CFX_RectF RecacheWidgetRect();
- uint32_t GetStatus();
- void ModifyStatus(uint32_t dwAdded, uint32_t dwRemoved);
-
- CXFA_WidgetAcc* GetDataAcc();
- bool GetToolTip(CFX_WideString& wsToolTip);
-
- CXFA_FFDocView* GetDocView();
- void SetDocView(CXFA_FFDocView* pDocView);
- CXFA_FFDoc* GetDoc();
- CXFA_FFApp* GetApp();
- IXFA_AppProvider* GetAppProvider();
- void InvalidateWidget(const CFX_RectF* pRect = nullptr);
- void AddInvalidateRect(const CFX_RectF* pRect = nullptr);
- bool GetCaptionText(CFX_WideString& wsCap);
- bool IsFocused();
- CFX_PointF Rotate2Normal(const CFX_PointF& point);
- CFX_Matrix GetRotateMatrix();
- bool IsLayoutRectEmpty();
- CXFA_FFWidget* GetParent();
- bool IsAncestorOf(CXFA_FFWidget* pWidget);
- const CFWL_App* GetFWLApp();
-
- protected:
- virtual bool PtInActiveRect(const CFX_PointF& point);
-
- void DrawBorder(CFX_Graphics* pGS,
- CXFA_Box box,
- const CFX_RectF& rtBorder,
- CFX_Matrix* pMatrix,
- uint32_t dwFlags = 0);
-
- CFX_RectF GetRectWithoutRotate();
- bool IsMatchVisibleStatus(uint32_t dwStatus);
- void EventKillFocus();
- bool IsButtonDown();
- void SetButtonDown(bool bSet);
-
- CXFA_FFDocView* m_pDocView;
- CXFA_FFPageView* m_pPageView;
- CXFA_WidgetAcc* m_pDataAcc;
- CFX_RectF m_rtWidget;
-};
-
-int32_t XFA_StrokeTypeSetLineDash(CFX_Graphics* pGraphics,
- int32_t iStrokeType,
- int32_t iCapType);
-CFX_GraphStateData::LineCap XFA_LineCapToFXGE(int32_t iLineCap);
-void XFA_DrawImage(CFX_Graphics* pGS,
- const CFX_RectF& rtImage,
- CFX_Matrix* pMatrix,
- CFX_DIBitmap* pDIBitmap,
- int32_t iAspect,
- int32_t iImageXDpi,
- int32_t iImageYDpi,
- int32_t iHorzAlign = XFA_ATTRIBUTEENUM_Left,
- int32_t iVertAlign = XFA_ATTRIBUTEENUM_Top);
-
-CFX_DIBitmap* XFA_LoadImageData(CXFA_FFDoc* pDoc,
- CXFA_Image* pImage,
- bool& bNameImage,
- int32_t& iImageXDpi,
- int32_t& iImageYDpi);
-
-CFX_DIBitmap* XFA_LoadImageFromBuffer(
- const CFX_RetainPtr<IFX_SeekableReadStream>& pImageFileRead,
- FXCODEC_IMAGE_TYPE type,
- int32_t& iImageXDpi,
- int32_t& iImageYDpi);
-
-FXCODEC_IMAGE_TYPE XFA_GetImageType(const CFX_WideString& wsType);
-FX_CHAR* XFA_Base64Encode(const uint8_t* buf, int32_t buf_len);
-void XFA_RectWidthoutMargin(CFX_RectF& rt,
- const CXFA_Margin& mg,
- bool bUI = false);
-CXFA_FFWidget* XFA_GetWidgetFromLayoutItem(CXFA_LayoutItem* pLayoutItem);
-bool XFA_IsCreateWidget(XFA_Element iType);
-#define XFA_DRAWBOX_ForceRound 1
-#define XFA_DRAWBOX_Lowered3D 2
-void XFA_DrawBox(CXFA_Box box,
- CFX_Graphics* pGS,
- const CFX_RectF& rtWidget,
- CFX_Matrix* pMatrix,
- uint32_t dwFlags = 0);
-
-#endif // XFA_FXFA_XFA_FFWIDGET_H_
diff --git a/chromium/third_party/pdfium/xfa/fxfa/xfa_ffwidgethandler.h b/chromium/third_party/pdfium/xfa/fxfa/xfa_ffwidgethandler.h
deleted file mode 100644
index 66bda3e02a5..00000000000
--- a/chromium/third_party/pdfium/xfa/fxfa/xfa_ffwidgethandler.h
+++ /dev/null
@@ -1,119 +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 XFA_FXFA_XFA_FFWIDGETHANDLER_H_
-#define XFA_FXFA_XFA_FFWIDGETHANDLER_H_
-
-#include <vector>
-
-#include "xfa/fxfa/cxfa_eventparam.h"
-#include "xfa/fxfa/fxfa.h"
-#include "xfa/fxfa/parser/cxfa_document.h"
-
-class CXFA_FFDocView;
-enum class FWL_WidgetHit;
-
-class CXFA_FFWidgetHandler {
- public:
- explicit CXFA_FFWidgetHandler(CXFA_FFDocView* pDocView);
- ~CXFA_FFWidgetHandler();
-
- CXFA_FFWidget* CreateWidget(CXFA_FFWidget* hParent,
- XFA_WIDGETTYPE eType,
- CXFA_FFWidget* hBefore = nullptr);
-
- bool OnMouseEnter(CXFA_FFWidget* hWidget);
- bool OnMouseExit(CXFA_FFWidget* hWidget);
- bool OnLButtonDown(CXFA_FFWidget* hWidget,
- uint32_t dwFlags,
- const CFX_PointF& point);
- bool OnLButtonUp(CXFA_FFWidget* hWidget,
- uint32_t dwFlags,
- const CFX_PointF& point);
- bool OnLButtonDblClk(CXFA_FFWidget* hWidget,
- uint32_t dwFlags,
- const CFX_PointF& point);
- bool OnMouseMove(CXFA_FFWidget* hWidget,
- uint32_t dwFlags,
- const CFX_PointF& point);
- bool OnMouseWheel(CXFA_FFWidget* hWidget,
- uint32_t dwFlags,
- int16_t zDelta,
- const CFX_PointF& point);
- bool OnRButtonDown(CXFA_FFWidget* hWidget,
- uint32_t dwFlags,
- const CFX_PointF& point);
- bool OnRButtonUp(CXFA_FFWidget* hWidget,
- uint32_t dwFlags,
- const CFX_PointF& point);
- bool OnRButtonDblClk(CXFA_FFWidget* hWidget,
- uint32_t dwFlags,
- const CFX_PointF& point);
-
- bool OnKeyDown(CXFA_FFWidget* hWidget, uint32_t dwKeyCode, uint32_t dwFlags);
- bool OnKeyUp(CXFA_FFWidget* hWidget, uint32_t dwKeyCode, uint32_t dwFlags);
- bool OnChar(CXFA_FFWidget* hWidget, uint32_t dwChar, uint32_t dwFlags);
- FWL_WidgetHit OnHitTest(CXFA_FFWidget* hWidget, const CFX_PointF& point);
- bool OnSetCursor(CXFA_FFWidget* hWidget, const CFX_PointF& point);
- void RenderWidget(CXFA_FFWidget* hWidget,
- CFX_Graphics* pGS,
- CFX_Matrix* pMatrix,
- bool bHighlight);
- bool HasEvent(CXFA_WidgetAcc* pWidgetAcc, XFA_EVENTTYPE eEventType);
- int32_t ProcessEvent(CXFA_WidgetAcc* pWidgetAcc, CXFA_EventParam* pParam);
-
- protected:
- CXFA_Node* CreateWidgetFormItem(XFA_WIDGETTYPE eType,
- CXFA_Node* pParent,
- CXFA_Node* pBefore) const;
-
- CXFA_Node* CreatePushButton(CXFA_Node* pParent, CXFA_Node* pBefore) const;
- CXFA_Node* CreateCheckButton(CXFA_Node* pParent, CXFA_Node* pBefore) const;
- CXFA_Node* CreateExclGroup(CXFA_Node* pParent, CXFA_Node* pBefore) const;
- CXFA_Node* CreateRadioButton(CXFA_Node* pParent, CXFA_Node* pBefore) const;
- CXFA_Node* CreateDatetimeEdit(CXFA_Node* pParent, CXFA_Node* pBefore) const;
- CXFA_Node* CreateDecimalField(CXFA_Node* pParent, CXFA_Node* pBefore) const;
- CXFA_Node* CreateNumericField(CXFA_Node* pParent, CXFA_Node* pBefore) const;
- CXFA_Node* CreateSignature(CXFA_Node* pParent, CXFA_Node* pBefore) const;
- CXFA_Node* CreateTextEdit(CXFA_Node* pParent, CXFA_Node* pBefore) const;
- CXFA_Node* CreateDropdownList(CXFA_Node* pParent, CXFA_Node* pBefore) const;
- CXFA_Node* CreateListBox(CXFA_Node* pParent, CXFA_Node* pBefore) const;
- CXFA_Node* CreateImageField(CXFA_Node* pParent, CXFA_Node* pBefore) const;
- CXFA_Node* CreatePasswordEdit(CXFA_Node* pParent, CXFA_Node* pBefore) const;
- CXFA_Node* CreateField(XFA_Element eElement,
- CXFA_Node* pParent,
- CXFA_Node* pBefore) const;
- CXFA_Node* CreateArc(CXFA_Node* pParent, CXFA_Node* pBefore) const;
- CXFA_Node* CreateRectangle(CXFA_Node* pParent, CXFA_Node* pBefore) const;
- CXFA_Node* CreateImage(CXFA_Node* pParent, CXFA_Node* pBefore) const;
- CXFA_Node* CreateLine(CXFA_Node* pParent, CXFA_Node* pBefore) const;
- CXFA_Node* CreateText(CXFA_Node* pParent, CXFA_Node* pBefore) const;
- CXFA_Node* CreateDraw(XFA_Element eElement,
- CXFA_Node* pParent,
- CXFA_Node* pBefore) const;
-
- CXFA_Node* CreateSubform(CXFA_Node* pParent, CXFA_Node* pBefore) const;
- CXFA_Node* CreateFormItem(XFA_Element eElement,
- CXFA_Node* pParent,
- CXFA_Node* pBefore) const;
- CXFA_Node* CreateCopyNode(XFA_Element eElement,
- CXFA_Node* pParent,
- CXFA_Node* pBefore = nullptr) const;
- CXFA_Node* CreateTemplateNode(XFA_Element eElement,
- CXFA_Node* pParent,
- CXFA_Node* pBefore) const;
- CXFA_Node* CreateFontNode(CXFA_Node* pParent) const;
- CXFA_Node* CreateMarginNode(CXFA_Node* pParent,
- uint32_t dwFlags,
- FX_FLOAT fInsets[4]) const;
- CXFA_Node* CreateValueNode(XFA_Element eValue, CXFA_Node* pParent) const;
- CXFA_Document* GetObjFactory() const;
- CXFA_Document* GetXFADoc() const;
-
- CXFA_FFDocView* m_pDocView;
-};
-
-#endif // XFA_FXFA_XFA_FFWIDGETHANDLER_H_
diff --git a/chromium/third_party/pdfium/xfa/fxfa/xfa_fontmgr.h b/chromium/third_party/pdfium/xfa/fxfa/xfa_fontmgr.h
deleted file mode 100644
index f00b069ef03..00000000000
--- a/chromium/third_party/pdfium/xfa/fxfa/xfa_fontmgr.h
+++ /dev/null
@@ -1,103 +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 XFA_FXFA_XFA_FONTMGR_H_
-#define XFA_FXFA_XFA_FONTMGR_H_
-
-#include <map>
-#include <memory>
-#include <vector>
-
-#include "core/fxcrt/cfx_retain_ptr.h"
-#include "core/fxcrt/fx_ext.h"
-#include "core/fxcrt/fx_system.h"
-#include "xfa/fgas/font/cfgas_fontmgr.h"
-#include "xfa/fxfa/fxfa.h"
-
-class CPDF_Font;
-
-struct XFA_FONTINFO {
- uint32_t dwFontNameHash;
- const FX_WCHAR* pPsName;
- const FX_WCHAR* pReplaceFont;
- uint16_t dwStyles;
- uint16_t wCodePage;
-};
-
-class CXFA_DefFontMgr {
- public:
- CXFA_DefFontMgr();
- ~CXFA_DefFontMgr();
-
- CFX_RetainPtr<CFGAS_GEFont> GetFont(CXFA_FFDoc* hDoc,
- const CFX_WideStringC& wsFontFamily,
- uint32_t dwFontStyles,
- uint16_t wCodePage = 0xFFFF);
- CFX_RetainPtr<CFGAS_GEFont> GetDefaultFont(
- CXFA_FFDoc* hDoc,
- const CFX_WideStringC& wsFontFamily,
- uint32_t dwFontStyles,
- uint16_t wCodePage = 0xFFFF);
-
- protected:
- std::vector<CFX_RetainPtr<CFGAS_GEFont>> m_CacheFonts;
-};
-
-class CXFA_PDFFontMgr {
- public:
- explicit CXFA_PDFFontMgr(CXFA_FFDoc* pDoc);
- ~CXFA_PDFFontMgr();
-
- CFX_RetainPtr<CFGAS_GEFont> GetFont(const CFX_WideStringC& wsFontFamily,
- uint32_t dwFontStyles,
- CPDF_Font** pPDFFont,
- bool bStrictMatch);
- bool GetCharWidth(const CFX_RetainPtr<CFGAS_GEFont>& pFont,
- FX_WCHAR wUnicode,
- bool bCharCode,
- int32_t* pWidth);
- void SetFont(const CFX_RetainPtr<CFGAS_GEFont>& pFont, CPDF_Font* pPDFFont);
-
- protected:
- CFX_RetainPtr<CFGAS_GEFont> FindFont(const CFX_ByteString& strFamilyName,
- bool bBold,
- bool bItalic,
- CPDF_Font** pPDFFont,
- bool bStrictMatch);
- CFX_ByteString PsNameToFontName(const CFX_ByteString& strPsName,
- bool bBold,
- bool bItalic);
- bool PsNameMatchDRFontName(const CFX_ByteStringC& bsPsName,
- bool bBold,
- bool bItalic,
- const CFX_ByteString& bsDRFontName,
- bool bStrictMatch);
-
- CXFA_FFDoc* const m_pDoc;
- std::map<CFX_RetainPtr<CFGAS_GEFont>, CPDF_Font*> m_FDE2PDFFont;
- std::map<CFX_ByteString, CFX_RetainPtr<CFGAS_GEFont>> m_FontMap;
-};
-
-class CXFA_FontMgr {
- public:
- CXFA_FontMgr();
- ~CXFA_FontMgr();
-
- CFX_RetainPtr<CFGAS_GEFont> GetFont(CXFA_FFDoc* hDoc,
- const CFX_WideStringC& wsFontFamily,
- uint32_t dwFontStyles,
- uint16_t wCodePage = 0xFFFF);
- void LoadDocFonts(CXFA_FFDoc* hDoc);
- void ReleaseDocFonts(CXFA_FFDoc* hDoc);
- void SetDefFontMgr(std::unique_ptr<CXFA_DefFontMgr> pFontMgr);
-
- protected:
- std::unique_ptr<CXFA_DefFontMgr> m_pDefFontMgr;
- std::map<CXFA_FFDoc*, std::unique_ptr<CXFA_PDFFontMgr>> m_PDFFontMgrMap;
- std::map<CFX_ByteString, CFX_RetainPtr<CFGAS_GEFont>> m_FontMap;
-};
-
-#endif // XFA_FXFA_XFA_FONTMGR_H_
diff --git a/chromium/third_party/pdfium/xfa/fxfa/xfa_rendercontext.h b/chromium/third_party/pdfium/xfa/fxfa/xfa_rendercontext.h
deleted file mode 100644
index c424005b1e2..00000000000
--- a/chromium/third_party/pdfium/xfa/fxfa/xfa_rendercontext.h
+++ /dev/null
@@ -1,45 +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 XFA_FXFA_XFA_RENDERCONTEXT_H_
-#define XFA_FXFA_XFA_RENDERCONTEXT_H_
-
-#include <memory>
-
-#include "xfa/fxfa/fxfa.h"
-
-class CXFA_RenderOptions {
- public:
- CXFA_RenderOptions() : m_bPrint(false), m_bHighlight(true) {}
-
- bool m_bPrint;
- bool m_bHighlight;
-};
-
-class CXFA_RenderContext {
- public:
- CXFA_RenderContext();
- ~CXFA_RenderContext();
-
- int32_t StartRender(CXFA_FFPageView* pPageView,
- CFX_Graphics* pGS,
- const CFX_Matrix& matrix,
- const CXFA_RenderOptions& options);
- int32_t DoRender(IFX_Pause* pPause = nullptr);
- void StopRender();
-
- protected:
- std::unique_ptr<IXFA_WidgetIterator> m_pWidgetIterator;
- CXFA_FFWidget* m_pWidget;
- CXFA_FFPageView* m_pPageView;
- CFX_Graphics* m_pGS;
- CFX_Matrix m_matrix;
- CXFA_RenderOptions m_options;
- uint32_t m_dwStatus;
- CFX_RectF m_rtClipRect;
-};
-
-#endif // XFA_FXFA_XFA_RENDERCONTEXT_H_
diff --git a/chromium/third_party/pdfium/xfa/fxgraphics/cfx_graphics.cpp b/chromium/third_party/pdfium/xfa/fxgraphics/cfx_graphics.cpp
index d2f2151d91c..a3821dd067b 100644
--- a/chromium/third_party/pdfium/xfa/fxgraphics/cfx_graphics.cpp
+++ b/chromium/third_party/pdfium/xfa/fxgraphics/cfx_graphics.cpp
@@ -134,15 +134,15 @@ void CFX_Graphics::SetLineCap(CFX_GraphStateData::LineCap lineCap) {
}
}
-void CFX_Graphics::SetLineDash(FX_FLOAT dashPhase,
- FX_FLOAT* dashArray,
+void CFX_Graphics::SetLineDash(float dashPhase,
+ float* dashArray,
int32_t dashCount) {
if (dashCount > 0 && !dashArray)
return;
dashCount = dashCount < 0 ? 0 : dashCount;
if (m_type == FX_CONTEXT_Device && m_renderDevice) {
- FX_FLOAT scale = 1.0;
+ float scale = 1.0;
if (m_info.isActOnDash) {
scale = m_info.graphState.m_LineWidth;
}
@@ -159,7 +159,7 @@ void CFX_Graphics::SetLineDash(FX_DashStyle dashStyle) {
RenderDeviceSetLineDash(dashStyle);
}
-void CFX_Graphics::SetLineWidth(FX_FLOAT lineWidth, bool isActOnDash) {
+void CFX_Graphics::SetLineWidth(float lineWidth, bool isActOnDash) {
if (m_type == FX_CONTEXT_Device && m_renderDevice) {
m_info.graphState.m_LineWidth = lineWidth;
m_info.isActOnDash = isActOnDash;
@@ -198,7 +198,7 @@ void CFX_Graphics::FillPath(CFX_Path* path,
RenderDeviceFillPath(path, fillMode, matrix);
}
-void CFX_Graphics::StretchImage(CFX_DIBSource* source,
+void CFX_Graphics::StretchImage(const CFX_RetainPtr<CFX_DIBSource>& source,
const CFX_RectF& rect,
CFX_Matrix* matrix) {
if (!source)
@@ -226,7 +226,7 @@ CFX_RectF CFX_Graphics::GetClipRect() const {
return CFX_RectF();
FX_RECT r = m_renderDevice->GetClipBox();
- return CFX_Rect(r.left, r.top, r.Width(), r.Height()).As<FX_FLOAT>();
+ return CFX_Rect(r.left, r.top, r.Width(), r.Height()).As<float>();
}
void CFX_Graphics::SetClipRect(const CFX_RectF& rect) {
@@ -248,22 +248,22 @@ void CFX_Graphics::RenderDeviceSetLineDash(FX_DashStyle dashStyle) {
return;
}
case FX_DASHSTYLE_Dash: {
- FX_FLOAT dashArray[] = {3, 1};
+ float dashArray[] = {3, 1};
SetLineDash(0, dashArray, 2);
return;
}
case FX_DASHSTYLE_Dot: {
- FX_FLOAT dashArray[] = {1, 1};
+ float dashArray[] = {1, 1};
SetLineDash(0, dashArray, 2);
return;
}
case FX_DASHSTYLE_DashDot: {
- FX_FLOAT dashArray[] = {3, 1, 1, 1};
+ float dashArray[] = {3, 1, 1, 1};
SetLineDash(0, dashArray, 4);
return;
}
case FX_DASHSTYLE_DashDotDot: {
- FX_FLOAT dashArray[] = {4, 1, 2, 1, 2, 1};
+ float dashArray[] = {4, 1, 2, 1, 2, 1};
SetLineDash(0, dashArray, 6);
return;
}
@@ -318,48 +318,48 @@ void CFX_Graphics::RenderDeviceFillPath(CFX_Path* path,
}
}
-void CFX_Graphics::RenderDeviceStretchImage(CFX_DIBSource* source,
- const CFX_RectF& rect,
- CFX_Matrix* matrix) {
+void CFX_Graphics::RenderDeviceStretchImage(
+ const CFX_RetainPtr<CFX_DIBSource>& source,
+ const CFX_RectF& rect,
+ CFX_Matrix* matrix) {
CFX_Matrix m1(m_info.CTM.a, m_info.CTM.b, m_info.CTM.c, m_info.CTM.d,
m_info.CTM.e, m_info.CTM.f);
if (matrix) {
m1.Concat(*matrix);
}
- std::unique_ptr<CFX_DIBitmap> bmp1 =
+ CFX_RetainPtr<CFX_DIBitmap> bmp1 =
source->StretchTo((int32_t)rect.Width(), (int32_t)rect.Height());
CFX_Matrix m2(rect.Width(), 0.0, 0.0, rect.Height(), rect.left, rect.top);
m2.Concat(m1);
int32_t left;
int32_t top;
- std::unique_ptr<CFX_DIBitmap> bmp2 = bmp1->FlipImage(false, true);
- std::unique_ptr<CFX_DIBitmap> bmp3 = bmp2->TransformTo(&m2, left, top);
+ CFX_RetainPtr<CFX_DIBitmap> bmp2 = bmp1->FlipImage(false, true);
+ CFX_RetainPtr<CFX_DIBitmap> bmp3 = bmp2->TransformTo(&m2, left, top);
CFX_RectF r = GetClipRect();
- CFX_DIBitmap* bitmap = m_renderDevice->GetBitmap();
+ CFX_RetainPtr<CFX_DIBitmap> bitmap = m_renderDevice->GetBitmap();
bitmap->CompositeBitmap(FXSYS_round(r.left), FXSYS_round(r.top),
- FXSYS_round(r.Width()), FXSYS_round(r.Height()),
- bmp3.get(), FXSYS_round(r.left - left),
- FXSYS_round(r.top - top));
+ FXSYS_round(r.Width()), FXSYS_round(r.Height()), bmp3,
+ FXSYS_round(r.left - left), FXSYS_round(r.top - top));
}
void CFX_Graphics::FillPathWithPattern(CFX_Path* path,
FX_FillMode fillMode,
CFX_Matrix* matrix) {
CFX_Pattern* pattern = m_info.fillColor->m_info.pattern;
- CFX_DIBitmap* bitmap = m_renderDevice->GetBitmap();
+ CFX_RetainPtr<CFX_DIBitmap> bitmap = m_renderDevice->GetBitmap();
int32_t width = bitmap->GetWidth();
int32_t height = bitmap->GetHeight();
- CFX_DIBitmap bmp;
- bmp.Create(width, height, FXDIB_Argb);
- m_renderDevice->GetDIBits(&bmp, 0, 0);
+ auto bmp = pdfium::MakeRetain<CFX_DIBitmap>();
+ bmp->Create(width, height, FXDIB_Argb);
+ m_renderDevice->GetDIBits(bmp, 0, 0);
FX_HatchStyle hatchStyle = m_info.fillColor->m_info.pattern->m_hatchStyle;
const FX_HATCHDATA& data = hatchBitmapData[static_cast<int>(hatchStyle)];
- CFX_DIBitmap mask;
- mask.Create(data.width, data.height, FXDIB_1bppMask);
- FXSYS_memcpy(mask.GetBuffer(), data.maskBits, mask.GetPitch() * data.height);
+ auto mask = pdfium::MakeRetain<CFX_DIBitmap>();
+ mask->Create(data.width, data.height, FXDIB_1bppMask);
+ memcpy(mask->GetBuffer(), data.maskBits, mask->GetPitch() * data.height);
CFX_FloatRect rectf = path->GetPathData()->GetBoundingBox();
if (matrix)
matrix->TransformRect(rectf);
@@ -367,49 +367,48 @@ void CFX_Graphics::FillPathWithPattern(CFX_Path* path,
FX_RECT rect(FXSYS_round(rectf.left), FXSYS_round(rectf.top),
FXSYS_round(rectf.right), FXSYS_round(rectf.bottom));
CFX_FxgeDevice device;
- device.Attach(&bmp, false, nullptr, false);
+ device.Attach(bmp, false, nullptr, false);
device.FillRect(&rect, m_info.fillColor->m_info.pattern->m_backArgb);
- for (int32_t j = rect.bottom; j < rect.top; j += mask.GetHeight()) {
- for (int32_t i = rect.left; i < rect.right; i += mask.GetWidth()) {
- device.SetBitMask(&mask, i, j,
+ for (int32_t j = rect.bottom; j < rect.top; j += mask->GetHeight()) {
+ for (int32_t i = rect.left; i < rect.right; i += mask->GetWidth()) {
+ device.SetBitMask(mask, i, j,
m_info.fillColor->m_info.pattern->m_foreArgb);
}
}
m_renderDevice->SaveState();
m_renderDevice->SetClip_PathFill(path->GetPathData(), matrix, fillMode);
- SetDIBitsWithMatrix(&bmp, &pattern->m_matrix);
+ SetDIBitsWithMatrix(bmp, &pattern->m_matrix);
m_renderDevice->RestoreState(false);
}
void CFX_Graphics::FillPathWithShading(CFX_Path* path,
FX_FillMode fillMode,
CFX_Matrix* matrix) {
- CFX_DIBitmap* bitmap = m_renderDevice->GetBitmap();
+ CFX_RetainPtr<CFX_DIBitmap> bitmap = m_renderDevice->GetBitmap();
int32_t width = bitmap->GetWidth();
int32_t height = bitmap->GetHeight();
- FX_FLOAT start_x = m_info.fillColor->m_shading->m_beginPoint.x;
- FX_FLOAT start_y = m_info.fillColor->m_shading->m_beginPoint.y;
- FX_FLOAT end_x = m_info.fillColor->m_shading->m_endPoint.x;
- FX_FLOAT end_y = m_info.fillColor->m_shading->m_endPoint.y;
- CFX_DIBitmap bmp;
- bmp.Create(width, height, FXDIB_Argb);
- m_renderDevice->GetDIBits(&bmp, 0, 0);
- int32_t pitch = bmp.GetPitch();
+ float start_x = m_info.fillColor->m_shading->m_beginPoint.x;
+ float start_y = m_info.fillColor->m_shading->m_beginPoint.y;
+ float end_x = m_info.fillColor->m_shading->m_endPoint.x;
+ float end_y = m_info.fillColor->m_shading->m_endPoint.y;
+ auto bmp = pdfium::MakeRetain<CFX_DIBitmap>();
+ bmp->Create(width, height, FXDIB_Argb);
+ m_renderDevice->GetDIBits(bmp, 0, 0);
+ int32_t pitch = bmp->GetPitch();
bool result = false;
switch (m_info.fillColor->m_shading->m_type) {
case FX_SHADING_Axial: {
- FX_FLOAT x_span = end_x - start_x;
- FX_FLOAT y_span = end_y - start_y;
- FX_FLOAT axis_len_square = (x_span * x_span) + (y_span * y_span);
+ float x_span = end_x - start_x;
+ float y_span = end_y - start_y;
+ float axis_len_square = (x_span * x_span) + (y_span * y_span);
for (int32_t row = 0; row < height; row++) {
- uint32_t* dib_buf = (uint32_t*)(bmp.GetBuffer() + row * pitch);
+ uint32_t* dib_buf = (uint32_t*)(bmp->GetBuffer() + row * pitch);
for (int32_t column = 0; column < width; column++) {
- FX_FLOAT x = (FX_FLOAT)(column);
- FX_FLOAT y = (FX_FLOAT)(row);
- FX_FLOAT scale =
- (((x - start_x) * x_span) + ((y - start_y) * y_span)) /
- axis_len_square;
+ float x = (float)(column);
+ float y = (float)(row);
+ float scale = (((x - start_x) * x_span) + ((y - start_y) * y_span)) /
+ axis_len_square;
if (scale < 0) {
if (!m_info.fillColor->m_shading->m_isExtendedBegin) {
continue;
@@ -429,31 +428,31 @@ void CFX_Graphics::FillPathWithShading(CFX_Path* path,
break;
}
case FX_SHADING_Radial: {
- FX_FLOAT start_r = m_info.fillColor->m_shading->m_beginRadius;
- FX_FLOAT end_r = m_info.fillColor->m_shading->m_endRadius;
- FX_FLOAT a = ((start_x - end_x) * (start_x - end_x)) +
- ((start_y - end_y) * (start_y - end_y)) -
- ((start_r - end_r) * (start_r - end_r));
+ float start_r = m_info.fillColor->m_shading->m_beginRadius;
+ float end_r = m_info.fillColor->m_shading->m_endRadius;
+ float a = ((start_x - end_x) * (start_x - end_x)) +
+ ((start_y - end_y) * (start_y - end_y)) -
+ ((start_r - end_r) * (start_r - end_r));
for (int32_t row = 0; row < height; row++) {
- uint32_t* dib_buf = (uint32_t*)(bmp.GetBuffer() + row * pitch);
+ uint32_t* dib_buf = (uint32_t*)(bmp->GetBuffer() + row * pitch);
for (int32_t column = 0; column < width; column++) {
- FX_FLOAT x = (FX_FLOAT)(column);
- FX_FLOAT y = (FX_FLOAT)(row);
- FX_FLOAT b = -2 * (((x - start_x) * (end_x - start_x)) +
- ((y - start_y) * (end_y - start_y)) +
- (start_r * (end_r - start_r)));
- FX_FLOAT c = ((x - start_x) * (x - start_x)) +
- ((y - start_y) * (y - start_y)) - (start_r * start_r);
- FX_FLOAT s;
+ float x = (float)(column);
+ float y = (float)(row);
+ float b = -2 * (((x - start_x) * (end_x - start_x)) +
+ ((y - start_y) * (end_y - start_y)) +
+ (start_r * (end_r - start_r)));
+ float c = ((x - start_x) * (x - start_x)) +
+ ((y - start_y) * (y - start_y)) - (start_r * start_r);
+ float s;
if (a == 0) {
s = -c / b;
} else {
- FX_FLOAT b2_4ac = (b * b) - 4 * (a * c);
+ float b2_4ac = (b * b) - 4 * (a * c);
if (b2_4ac < 0) {
continue;
}
- FX_FLOAT root = (FXSYS_sqrt(b2_4ac));
- FX_FLOAT s1, s2;
+ float root = (sqrt(b2_4ac));
+ float s1, s2;
if (a > 0) {
s1 = (-b - root) / (2 * a);
s2 = (-b + root) / (2 * a);
@@ -497,24 +496,25 @@ void CFX_Graphics::FillPathWithShading(CFX_Path* path,
if (result) {
m_renderDevice->SaveState();
m_renderDevice->SetClip_PathFill(path->GetPathData(), matrix, fillMode);
- SetDIBitsWithMatrix(&bmp, matrix);
+ SetDIBitsWithMatrix(bmp, matrix);
m_renderDevice->RestoreState(false);
}
}
-void CFX_Graphics::SetDIBitsWithMatrix(CFX_DIBSource* source,
- CFX_Matrix* matrix) {
+void CFX_Graphics::SetDIBitsWithMatrix(
+ const CFX_RetainPtr<CFX_DIBSource>& source,
+ CFX_Matrix* matrix) {
if (matrix->IsIdentity()) {
m_renderDevice->SetDIBits(source, 0, 0);
} else {
- CFX_Matrix m((FX_FLOAT)source->GetWidth(), 0, 0,
- (FX_FLOAT)source->GetHeight(), 0, 0);
+ CFX_Matrix m((float)source->GetWidth(), 0, 0, (float)source->GetHeight(), 0,
+ 0);
m.Concat(*matrix);
int32_t left;
int32_t top;
- std::unique_ptr<CFX_DIBitmap> bmp1 = source->FlipImage(false, true);
- std::unique_ptr<CFX_DIBitmap> bmp2 = bmp1->TransformTo(&m, left, top);
- m_renderDevice->SetDIBits(bmp2.get(), left, top);
+ CFX_RetainPtr<CFX_DIBitmap> bmp1 = source->FlipImage(false, true);
+ CFX_RetainPtr<CFX_DIBitmap> bmp2 = bmp1->TransformTo(&m, left, top);
+ m_renderDevice->SetDIBits(bmp2, left, top);
}
}
diff --git a/chromium/third_party/pdfium/xfa/fxgraphics/cfx_graphics.h b/chromium/third_party/pdfium/xfa/fxgraphics/cfx_graphics.h
index c18f8eb4c9b..264ec94d535 100644
--- a/chromium/third_party/pdfium/xfa/fxgraphics/cfx_graphics.h
+++ b/chromium/third_party/pdfium/xfa/fxgraphics/cfx_graphics.h
@@ -54,9 +54,9 @@ class CFX_Graphics {
CFX_RenderDevice* GetRenderDevice();
void SetLineCap(CFX_GraphStateData::LineCap lineCap);
- void SetLineDash(FX_FLOAT dashPhase, FX_FLOAT* dashArray, int32_t dashCount);
+ void SetLineDash(float dashPhase, float* dashArray, int32_t dashCount);
void SetLineDash(FX_DashStyle dashStyle);
- void SetLineWidth(FX_FLOAT lineWidth, bool isActOnDash = false);
+ void SetLineWidth(float lineWidth, bool isActOnDash = false);
void SetStrokeColor(CFX_Color* color);
void SetFillColor(CFX_Color* color);
void SetClipRect(const CFX_RectF& rect);
@@ -64,7 +64,7 @@ class CFX_Graphics {
void FillPath(CFX_Path* path,
FX_FillMode fillMode = FXFILL_WINDING,
CFX_Matrix* matrix = nullptr);
- void StretchImage(CFX_DIBSource* source,
+ void StretchImage(const CFX_RetainPtr<CFX_DIBSource>& source,
const CFX_RectF& rect,
CFX_Matrix* matrix = nullptr);
void ConcatMatrix(const CFX_Matrix* matrix);
@@ -90,7 +90,7 @@ class CFX_Graphics {
void RenderDeviceFillPath(CFX_Path* path,
FX_FillMode fillMode,
CFX_Matrix* matrix);
- void RenderDeviceStretchImage(CFX_DIBSource* source,
+ void RenderDeviceStretchImage(const CFX_RetainPtr<CFX_DIBSource>& source,
const CFX_RectF& rect,
CFX_Matrix* matrix);
@@ -101,7 +101,8 @@ class CFX_Graphics {
FX_FillMode fillMode,
CFX_Matrix* matrix);
- void SetDIBitsWithMatrix(CFX_DIBSource* source, CFX_Matrix* matrix);
+ void SetDIBitsWithMatrix(const CFX_RetainPtr<CFX_DIBSource>& source,
+ CFX_Matrix* matrix);
CFX_RenderDevice* m_renderDevice;
std::vector<std::unique_ptr<TInfo>> m_infoStack;
diff --git a/chromium/third_party/pdfium/xfa/fxgraphics/cfx_path.cpp b/chromium/third_party/pdfium/xfa/fxgraphics/cfx_path.cpp
index d56eb13f674..fc0051ad4cb 100644
--- a/chromium/third_party/pdfium/xfa/fxgraphics/cfx_path.cpp
+++ b/chromium/third_party/pdfium/xfa/fxgraphics/cfx_path.cpp
@@ -39,8 +39,8 @@ void CFX_Path::BezierTo(const CFX_PointF& c1,
void CFX_Path::ArcTo(const CFX_PointF& pos,
const CFX_SizeF& size,
- FX_FLOAT start_angle,
- FX_FLOAT sweep_angle) {
+ float start_angle,
+ float sweep_angle) {
CFX_SizeF new_size = size / 2.0f;
ArcToInternal(CFX_PointF(pos.x + new_size.width, pos.y + new_size.height),
new_size, start_angle, sweep_angle);
@@ -48,16 +48,16 @@ void CFX_Path::ArcTo(const CFX_PointF& pos,
void CFX_Path::ArcToInternal(const CFX_PointF& pos,
const CFX_SizeF& size,
- FX_FLOAT start_angle,
- FX_FLOAT sweep_angle) {
- FX_FLOAT x0 = FXSYS_cos(sweep_angle / 2);
- FX_FLOAT y0 = FXSYS_sin(sweep_angle / 2);
- FX_FLOAT tx = ((1.0f - x0) * 4) / (3 * 1.0f);
- FX_FLOAT ty = y0 - ((tx * x0) / y0);
+ float start_angle,
+ float sweep_angle) {
+ float x0 = cos(sweep_angle / 2);
+ float y0 = sin(sweep_angle / 2);
+ float tx = ((1.0f - x0) * 4) / (3 * 1.0f);
+ float ty = y0 - ((tx * x0) / y0);
CFX_PointF points[] = {CFX_PointF(x0 + tx, -ty), CFX_PointF(x0 + tx, ty)};
- FX_FLOAT sn = FXSYS_sin(start_angle + sweep_angle / 2);
- FX_FLOAT cs = FXSYS_cos(start_angle + sweep_angle / 2);
+ float sn = sin(start_angle + sweep_angle / 2);
+ float cs = cos(start_angle + sweep_angle / 2);
CFX_PointF bezier;
bezier.x = pos.x + (size.width * ((points[0].x * cs) - (points[0].y * sn)));
@@ -68,8 +68,8 @@ void CFX_Path::ArcToInternal(const CFX_PointF& pos,
bezier.y = pos.y + (size.height * ((points[1].x * sn) + (points[1].y * cs)));
data_.AppendPoint(bezier, FXPT_TYPE::BezierTo, false);
- bezier.x = pos.x + (size.width * FXSYS_cos(start_angle + sweep_angle));
- bezier.y = pos.y + (size.height * FXSYS_sin(start_angle + sweep_angle));
+ bezier.x = pos.x + (size.width * cos(start_angle + sweep_angle));
+ bezier.y = pos.y + (size.height * sin(start_angle + sweep_angle));
data_.AppendPoint(bezier, FXPT_TYPE::BezierTo, false);
}
@@ -78,10 +78,7 @@ void CFX_Path::AddLine(const CFX_PointF& p1, const CFX_PointF& p2) {
data_.AppendPoint(p2, FXPT_TYPE::LineTo, false);
}
-void CFX_Path::AddRectangle(FX_FLOAT left,
- FX_FLOAT top,
- FX_FLOAT width,
- FX_FLOAT height) {
+void CFX_Path::AddRectangle(float left, float top, float width, float height) {
data_.AppendRect(left, top, left + width, top + height);
}
@@ -91,12 +88,12 @@ void CFX_Path::AddEllipse(const CFX_RectF& rect) {
void CFX_Path::AddArc(const CFX_PointF& original_pos,
const CFX_SizeF& original_size,
- FX_FLOAT start_angle,
- FX_FLOAT sweep_angle) {
+ float start_angle,
+ float sweep_angle) {
if (sweep_angle == 0)
return;
- const FX_FLOAT bezier_arc_angle_epsilon = 0.01f;
+ const float bezier_arc_angle_epsilon = 0.01f;
while (start_angle > FX_PI * 2)
start_angle -= FX_PI * 2;
while (start_angle < 0)
@@ -108,13 +105,13 @@ void CFX_Path::AddArc(const CFX_PointF& original_pos,
CFX_SizeF size = original_size / 2;
CFX_PointF pos(original_pos.x + size.width, original_pos.y + size.height);
- data_.AppendPoint(pos + CFX_PointF(size.width * FXSYS_cos(start_angle),
- size.height * FXSYS_sin(start_angle)),
+ data_.AppendPoint(pos + CFX_PointF(size.width * cos(start_angle),
+ size.height * sin(start_angle)),
FXPT_TYPE::MoveTo, false);
- FX_FLOAT total_sweep = 0;
- FX_FLOAT local_sweep = 0;
- FX_FLOAT prev_sweep = 0;
+ float total_sweep = 0;
+ float local_sweep = 0;
+ float prev_sweep = 0;
bool done = false;
do {
if (sweep_angle < 0) {
diff --git a/chromium/third_party/pdfium/xfa/fxgraphics/cfx_path.h b/chromium/third_party/pdfium/xfa/fxgraphics/cfx_path.h
index 267831603a6..186465f8102 100644
--- a/chromium/third_party/pdfium/xfa/fxgraphics/cfx_path.h
+++ b/chromium/third_party/pdfium/xfa/fxgraphics/cfx_path.h
@@ -30,27 +30,24 @@ class CFX_Path final {
const CFX_PointF& to);
void ArcTo(const CFX_PointF& pos,
const CFX_SizeF& size,
- FX_FLOAT startAngle,
- FX_FLOAT sweepAngle);
+ float startAngle,
+ float sweepAngle);
void AddLine(const CFX_PointF& p1, const CFX_PointF& p2);
- void AddRectangle(FX_FLOAT left,
- FX_FLOAT top,
- FX_FLOAT width,
- FX_FLOAT height);
+ void AddRectangle(float left, float top, float width, float height);
void AddEllipse(const CFX_RectF& rect);
void AddArc(const CFX_PointF& pos,
const CFX_SizeF& size,
- FX_FLOAT startAngle,
- FX_FLOAT sweepAngle);
+ float startAngle,
+ float sweepAngle);
void AddSubpath(CFX_Path* path);
private:
void ArcToInternal(const CFX_PointF& pos,
const CFX_SizeF& size,
- FX_FLOAT start_angle,
- FX_FLOAT sweep_angle);
+ float start_angle,
+ float sweep_angle);
CFX_PathData data_;
};
diff --git a/chromium/third_party/pdfium/xfa/fxgraphics/cfx_shading.cpp b/chromium/third_party/pdfium/xfa/fxgraphics/cfx_shading.cpp
index 07936302c93..7dc8ce34125 100644
--- a/chromium/third_party/pdfium/xfa/fxgraphics/cfx_shading.cpp
+++ b/chromium/third_party/pdfium/xfa/fxgraphics/cfx_shading.cpp
@@ -26,8 +26,8 @@ CFX_Shading::CFX_Shading(const CFX_PointF& beginPoint,
CFX_Shading::CFX_Shading(const CFX_PointF& beginPoint,
const CFX_PointF& endPoint,
- const FX_FLOAT beginRadius,
- const FX_FLOAT endRadius,
+ const float beginRadius,
+ const float endRadius,
bool isExtendedBegin,
bool isExtendedEnd,
const FX_ARGB beginArgb,
@@ -59,11 +59,11 @@ void CFX_Shading::InitArgbArray() {
int32_t b2;
ArgbDecode(m_endArgb, a2, r2, g2, b2);
- FX_FLOAT f = (FX_FLOAT)(FX_SHADING_Steps - 1);
- FX_FLOAT aScale = 1.0 * (a2 - a1) / f;
- FX_FLOAT rScale = 1.0 * (r2 - r1) / f;
- FX_FLOAT gScale = 1.0 * (g2 - g1) / f;
- FX_FLOAT bScale = 1.0 * (b2 - b1) / f;
+ float f = (float)(FX_SHADING_Steps - 1);
+ float aScale = 1.0 * (a2 - a1) / f;
+ float rScale = 1.0 * (r2 - r1) / f;
+ float gScale = 1.0 * (g2 - g1) / f;
+ float bScale = 1.0 * (b2 - b1) / f;
for (int32_t i = 0; i < FX_SHADING_Steps; i++) {
int32_t a3 = static_cast<int32_t>(i * aScale);
diff --git a/chromium/third_party/pdfium/xfa/fxgraphics/cfx_shading.h b/chromium/third_party/pdfium/xfa/fxgraphics/cfx_shading.h
index 4189581895b..1fb34d2b07d 100644
--- a/chromium/third_party/pdfium/xfa/fxgraphics/cfx_shading.h
+++ b/chromium/third_party/pdfium/xfa/fxgraphics/cfx_shading.h
@@ -28,8 +28,8 @@ class CFX_Shading {
// Radial shading.
CFX_Shading(const CFX_PointF& beginPoint,
const CFX_PointF& endPoint,
- const FX_FLOAT beginRadius,
- const FX_FLOAT endRadius,
+ const float beginRadius,
+ const float endRadius,
bool isExtendedBegin,
bool isExtendedEnd,
const FX_ARGB beginArgb,
@@ -44,8 +44,8 @@ class CFX_Shading {
const CFX_Shading_Type m_type;
const CFX_PointF m_beginPoint;
const CFX_PointF m_endPoint;
- const FX_FLOAT m_beginRadius;
- const FX_FLOAT m_endRadius;
+ const float m_beginRadius;
+ const float m_endRadius;
const bool m_isExtendedBegin;
const bool m_isExtendedEnd;
const FX_ARGB m_beginArgb;